From f4679c012e458638a2c08af70e87a19d06830168 Mon Sep 17 00:00:00 2001 From: Sergey Date: Fri, 4 Jul 2025 02:00:41 +0300 Subject: [PATCH] 1.21.2 --- assets/minecraft/atlases/armor_trims.json | 72 +- assets/minecraft/blockstates/bee_nest.json | 40 +- assets/minecraft/blockstates/beehive.json | 40 +- .../minecraft/blockstates/creaking_heart.json | 40 + .../blockstates/pale_hanging_moss.json | 10 + .../blockstates/pale_moss_block.json | 7 + .../blockstates/pale_moss_carpet.json | 154 + .../blockstates/pale_oak_button.json | 118 + .../minecraft/blockstates/pale_oak_door.json | 124 + .../minecraft/blockstates/pale_oak_fence.json | 48 + .../blockstates/pale_oak_fence_gate.json | 80 + .../blockstates/pale_oak_hanging_sign.json | 7 + .../blockstates/pale_oak_leaves.json | 7 + .../minecraft/blockstates/pale_oak_log.json | 16 + .../blockstates/pale_oak_planks.json | 7 + .../blockstates/pale_oak_pressure_plate.json | 10 + .../blockstates/pale_oak_sapling.json | 7 + .../minecraft/blockstates/pale_oak_sign.json | 7 + .../minecraft/blockstates/pale_oak_slab.json | 13 + .../blockstates/pale_oak_stairs.json | 209 + .../blockstates/pale_oak_trapdoor.json | 69 + .../pale_oak_wall_hanging_sign.json | 7 + .../blockstates/pale_oak_wall_sign.json | 7 + .../minecraft/blockstates/pale_oak_wood.json | 16 + .../blockstates/potted_pale_oak_sapling.json | 7 + .../blockstates/stripped_pale_oak_log.json | 16 + .../blockstates/stripped_pale_oak_wood.json | 16 + assets/minecraft/lang/deprecated.json | 272 + assets/minecraft/lang/en_us.json | 317 +- .../{bee_nest.json => bee_nest_empty.json} | 0 .../{beehive.json => beehive_empty.json} | 0 assets/minecraft/models/block/comparator.json | 35 +- .../minecraft/models/block/comparator_on.json | 163 +- .../models/block/comparator_on_subtract.json | 217 +- .../models/block/comparator_subtract.json | 81 +- .../models/block/creaking_heart.json | 7 + .../models/block/creaking_heart_active.json | 7 + .../creaking_heart_active_horizontal.json | 7 + .../block/creaking_heart_horizontal.json | 7 + assets/minecraft/models/block/dragon_egg.json | 175 +- .../models/block/flower_pot_cross.json | 2 + .../models/block/mossy_carpet_side.json | 16 + .../models/block/pale_hanging_moss.json | 6 + .../models/block/pale_hanging_moss_tip.json | 6 + .../models/block/pale_moss_block.json | 6 + .../models/block/pale_moss_carpet.json | 6 + .../block/pale_moss_carpet_side_small.json | 6 + .../block/pale_moss_carpet_side_tall.json | 6 + .../models/block/pale_oak_button.json | 6 + .../block/pale_oak_button_inventory.json | 6 + .../models/block/pale_oak_button_pressed.json | 6 + .../block/pale_oak_door_bottom_left.json | 7 + .../block/pale_oak_door_bottom_left_open.json | 7 + .../block/pale_oak_door_bottom_right.json | 7 + .../pale_oak_door_bottom_right_open.json | 7 + .../models/block/pale_oak_door_top_left.json | 7 + .../block/pale_oak_door_top_left_open.json | 7 + .../models/block/pale_oak_door_top_right.json | 7 + .../block/pale_oak_door_top_right_open.json | 7 + .../models/block/pale_oak_fence_gate.json | 6 + .../block/pale_oak_fence_gate_open.json | 6 + .../block/pale_oak_fence_gate_wall.json | 6 + .../block/pale_oak_fence_gate_wall_open.json | 6 + .../block/pale_oak_fence_inventory.json | 6 + .../models/block/pale_oak_fence_post.json | 6 + .../models/block/pale_oak_fence_side.json | 6 + .../models/block/pale_oak_hanging_sign.json | 5 + .../models/block/pale_oak_leaves.json | 6 + .../minecraft/models/block/pale_oak_log.json | 7 + .../models/block/pale_oak_log_horizontal.json | 7 + .../models/block/pale_oak_planks.json | 6 + .../models/block/pale_oak_pressure_plate.json | 6 + .../block/pale_oak_pressure_plate_down.json | 6 + .../models/block/pale_oak_sapling.json | 6 + .../minecraft/models/block/pale_oak_sign.json | 5 + .../minecraft/models/block/pale_oak_slab.json | 8 + .../models/block/pale_oak_slab_top.json | 8 + .../models/block/pale_oak_stairs.json | 8 + .../models/block/pale_oak_stairs_inner.json | 8 + .../models/block/pale_oak_stairs_outer.json | 8 + .../block/pale_oak_trapdoor_bottom.json | 6 + .../models/block/pale_oak_trapdoor_open.json | 6 + .../models/block/pale_oak_trapdoor_top.json | 6 + .../minecraft/models/block/pale_oak_wood.json | 7 + .../models/block/potted_pale_oak_sapling.json | 6 + .../models/block/redstone_torch.json | 2 +- .../models/block/redstone_torch_off.json | 2 +- .../models/block/redstone_wall_torch.json | 2 +- .../models/block/redstone_wall_torch_off.json | 2 +- .../models/block/repeater_1tick.json | 2 - .../models/block/repeater_1tick_locked.json | 12 +- .../models/block/repeater_1tick_on.json | 130 +- .../block/repeater_1tick_on_locked.json | 60 +- .../models/block/repeater_2tick.json | 2 - .../models/block/repeater_2tick_locked.json | 2 - .../models/block/repeater_2tick_on.json | 130 +- .../block/repeater_2tick_on_locked.json | 60 +- .../models/block/repeater_3tick.json | 2 - .../models/block/repeater_3tick_locked.json | 2 - .../models/block/repeater_3tick_on.json | 130 +- .../block/repeater_3tick_on_locked.json | 60 +- .../models/block/repeater_4tick.json | 2 - .../models/block/repeater_4tick_locked.json | 2 - .../models/block/repeater_4tick_on.json | 130 +- .../block/repeater_4tick_on_locked.json | 60 +- .../models/block/scaffolding_unstable.json | 10 +- .../models/block/small_dripleaf_bottom.json | 8 +- .../models/block/small_dripleaf_top.json | 20 +- .../models/block/stripped_pale_oak_log.json | 7 + .../stripped_pale_oak_log_horizontal.json | 7 + .../models/block/stripped_pale_oak_wood.json | 7 + .../models/block/template_redstone_torch.json | 68 + .../block/template_redstone_torch_wall.json | 75 + .../models/block/template_torch.json | 24 +- .../models/block/template_torch_unlit.json | 19 + .../models/block/template_torch_wall.json | 26 +- .../block/template_torch_wall_unlit.json | 20 + .../models/block/template_vault.json | 2 +- .../models/block/tinted_flower_pot_cross.json | 2 + .../models/equipment/armadillo_scute.json | 13 + .../models/equipment/black_carpet.json | 9 + .../models/equipment/blue_carpet.json | 9 + .../models/equipment/brown_carpet.json | 9 + .../minecraft/models/equipment/chainmail.json | 14 + .../models/equipment/cyan_carpet.json | 9 + .../minecraft/models/equipment/diamond.json | 19 + assets/minecraft/models/equipment/elytra.json | 10 + assets/minecraft/models/equipment/gold.json | 19 + .../models/equipment/gray_carpet.json | 9 + .../models/equipment/green_carpet.json | 9 + assets/minecraft/models/equipment/iron.json | 19 + .../minecraft/models/equipment/leather.json | 34 + .../models/equipment/light_blue_carpet.json | 9 + .../models/equipment/light_gray_carpet.json | 9 + .../models/equipment/lime_carpet.json | 9 + .../models/equipment/magenta_carpet.json | 9 + .../minecraft/models/equipment/netherite.json | 14 + .../models/equipment/orange_carpet.json | 9 + .../models/equipment/pink_carpet.json | 9 + .../models/equipment/purple_carpet.json | 9 + .../models/equipment/red_carpet.json | 9 + .../models/equipment/trader_llama.json | 9 + .../models/equipment/turtle_scute.json | 9 + .../models/equipment/white_carpet.json | 9 + .../models/equipment/yellow_carpet.json | 9 + assets/minecraft/models/item/bee_nest.json | 18 +- .../minecraft/models/item/bee_nest_empty.json | 10 + .../minecraft/models/item/bee_nest_honey.json | 10 + assets/minecraft/models/item/beehive.json | 18 +- .../minecraft/models/item/beehive_empty.json | 10 + .../minecraft/models/item/beehive_honey.json | 10 + .../minecraft/models/item/black_bundle.json | 6 + .../models/item/black_bundle_open_back.json | 6 + .../models/item/black_bundle_open_front.json | 6 + assets/minecraft/models/item/blue_bundle.json | 6 + .../models/item/blue_bundle_open_back.json | 6 + .../models/item/blue_bundle_open_front.json | 6 + .../item/bordure_indented_banner_pattern.json | 6 + assets/minecraft/models/item/breeze_rod.json | 2 +- .../minecraft/models/item/brown_bundle.json | 6 + .../models/item/brown_bundle_open_back.json | 6 + .../models/item/brown_bundle_open_front.json | 6 + assets/minecraft/models/item/bundle.json | 13 +- .../minecraft/models/item/bundle_filled.json | 6 - .../models/item/bundle_open_back.json | 6 + .../models/item/bundle_open_front.json | 6 + .../minecraft/models/item/creaking_heart.json | 3 + .../models/item/creaking_spawn_egg.json | 3 + assets/minecraft/models/item/cyan_bundle.json | 6 + .../models/item/cyan_bundle_open_back.json | 6 + .../models/item/cyan_bundle_open_front.json | 6 + .../item/field_masoned_banner_pattern.json | 6 + assets/minecraft/models/item/gray_bundle.json | 6 + .../models/item/gray_bundle_open_back.json | 6 + .../models/item/gray_bundle_open_front.json | 6 + .../minecraft/models/item/green_bundle.json | 6 + .../models/item/green_bundle_open_back.json | 6 + .../models/item/green_bundle_open_front.json | 6 + .../models/item/light_blue_bundle.json | 6 + .../item/light_blue_bundle_open_back.json | 6 + .../item/light_blue_bundle_open_front.json | 6 + .../models/item/light_gray_bundle.json | 6 + .../item/light_gray_bundle_open_back.json | 6 + .../item/light_gray_bundle_open_front.json | 6 + assets/minecraft/models/item/lime_bundle.json | 6 + .../models/item/lime_bundle_open_back.json | 6 + .../models/item/lime_bundle_open_front.json | 6 + .../minecraft/models/item/magenta_bundle.json | 6 + .../models/item/magenta_bundle_open_back.json | 6 + .../item/magenta_bundle_open_front.json | 6 + .../minecraft/models/item/orange_bundle.json | 6 + .../models/item/orange_bundle_open_back.json | 6 + .../models/item/orange_bundle_open_front.json | 6 + .../models/item/pale_hanging_moss.json | 6 + .../models/item/pale_moss_block.json | 3 + .../models/item/pale_moss_carpet.json | 3 + .../minecraft/models/item/pale_oak_boat.json | 6 + .../models/item/pale_oak_button.json | 3 + .../models/item/pale_oak_chest_boat.json | 6 + .../minecraft/models/item/pale_oak_door.json | 6 + .../minecraft/models/item/pale_oak_fence.json | 3 + .../models/item/pale_oak_fence_gate.json | 3 + .../models/item/pale_oak_hanging_sign.json | 6 + .../models/item/pale_oak_leaves.json | 3 + .../minecraft/models/item/pale_oak_log.json | 3 + .../models/item/pale_oak_planks.json | 3 + .../models/item/pale_oak_pressure_plate.json | 3 + .../models/item/pale_oak_sapling.json | 6 + .../minecraft/models/item/pale_oak_sign.json | 6 + .../minecraft/models/item/pale_oak_slab.json | 3 + .../models/item/pale_oak_stairs.json | 3 + .../models/item/pale_oak_trapdoor.json | 3 + .../minecraft/models/item/pale_oak_wood.json | 3 + assets/minecraft/models/item/pink_bundle.json | 6 + .../models/item/pink_bundle_open_back.json | 6 + .../models/item/pink_bundle_open_front.json | 6 + .../minecraft/models/item/purple_bundle.json | 6 + .../models/item/purple_bundle_open_back.json | 6 + .../models/item/purple_bundle_open_front.json | 6 + assets/minecraft/models/item/red_bundle.json | 6 + .../models/item/red_bundle_open_back.json | 6 + .../models/item/red_bundle_open_front.json | 6 + .../models/item/stripped_pale_oak_log.json | 3 + .../models/item/stripped_pale_oak_wood.json | 3 + .../minecraft/models/item/white_bundle.json | 6 + .../models/item/white_bundle_open_back.json | 6 + .../models/item/white_bundle_open_front.json | 6 + .../minecraft/models/item/yellow_bundle.json | 6 + .../models/item/yellow_bundle_open_back.json | 6 + .../models/item/yellow_bundle_open_front.json | 6 + assets/minecraft/particles/trail.json | 5 + assets/minecraft/post_effect/blur.json | 111 + .../post => post_effect}/creeper.json | 28 +- .../minecraft/post_effect/entity_outline.json | 61 + assets/minecraft/post_effect/invert.json | 33 + assets/minecraft/post_effect/spider.json | 274 + .../minecraft/post_effect/transparency.json | 77 + assets/minecraft/shaders/core/blit_screen.fsh | 4 +- .../minecraft/shaders/core/blit_screen.json | 6 +- ...endertype_entity_cutout.fsh => entity.fsh} | 10 +- ...cutout_no_cull_z_offset.vsh => entity.vsh} | 13 +- ...{rendertype_entity_glint.fsh => glint.fsh} | 2 +- ...rtype_armor_entity_glint.vsh => glint.vsh} | 2 +- .../core/{rendertype_gui.fsh => gui.fsh} | 0 .../core/{rendertype_gui.vsh => gui.vsh} | 0 assets/minecraft/shaders/core/lightmap.fsh | 68 + assets/minecraft/shaders/core/lightmap.json | 17 + assets/minecraft/shaders/core/particle.fsh | 2 +- assets/minecraft/shaders/core/particle.json | 4 +- assets/minecraft/shaders/core/particle.vsh | 2 +- assets/minecraft/shaders/core/position.fsh | 2 +- assets/minecraft/shaders/core/position.json | 4 +- assets/minecraft/shaders/core/position.vsh | 2 +- .../shaders/core/position_color.json | 4 +- .../shaders/core/position_color_lightmap.json | 4 +- .../core/position_color_tex_lightmap.json | 4 +- .../minecraft/shaders/core/position_tex.json | 4 +- .../shaders/core/position_tex_color.fsh | 2 +- .../shaders/core/position_tex_color.json | 4 +- .../core/rendertype_armor_cutout_no_cull.fsh | 25 - .../core/rendertype_armor_cutout_no_cull.json | 12 +- .../core/rendertype_armor_cutout_no_cull.vsh | 34 - .../core/rendertype_armor_entity_glint.fsh | 24 - .../core/rendertype_armor_entity_glint.json | 5 +- ...json => rendertype_armor_translucent.json} | 12 +- .../shaders/core/rendertype_beacon_beam.fsh | 2 +- .../shaders/core/rendertype_beacon_beam.json | 5 +- .../shaders/core/rendertype_breeze_wind.fsh | 23 - .../shaders/core/rendertype_breeze_wind.json | 15 +- .../shaders/core/rendertype_breeze_wind.vsh | 32 - .../shaders/core/rendertype_clouds.fsh | 12 +- .../shaders/core/rendertype_clouds.json | 6 +- .../shaders/core/rendertype_clouds.vsh | 16 +- .../shaders/core/rendertype_crumbling.json | 4 +- .../shaders/core/rendertype_cutout.json | 11 +- .../shaders/core/rendertype_cutout.vsh | 30 - .../shaders/core/rendertype_cutout_mipped.fsh | 24 - .../core/rendertype_cutout_mipped.json | 11 +- .../shaders/core/rendertype_end_gateway.json | 4 +- .../shaders/core/rendertype_end_portal.fsh | 2 +- .../shaders/core/rendertype_end_portal.json | 4 +- .../shaders/core/rendertype_end_portal.vsh | 2 +- .../shaders/core/rendertype_energy_swirl.fsh | 23 - .../shaders/core/rendertype_energy_swirl.json | 16 +- .../shaders/core/rendertype_energy_swirl.vsh | 24 - .../shaders/core/rendertype_entity_alpha.json | 4 +- .../core/rendertype_entity_cutout.json | 9 +- .../shaders/core/rendertype_entity_cutout.vsh | 37 - .../core/rendertype_entity_cutout_no_cull.fsh | 29 - .../rendertype_entity_cutout_no_cull.json | 9 +- .../core/rendertype_entity_cutout_no_cull.vsh | 37 - ...dertype_entity_cutout_no_cull_z_offset.fsh | 29 - ...ertype_entity_cutout_no_cull_z_offset.json | 9 +- .../shaders/core/rendertype_entity_decal.fsh | 2 +- .../shaders/core/rendertype_entity_decal.json | 4 +- .../shaders/core/rendertype_entity_decal.vsh | 4 +- .../shaders/core/rendertype_entity_glint.json | 4 +- .../shaders/core/rendertype_entity_glint.vsh | 21 - .../core/rendertype_entity_glint_direct.fsh | 24 - .../core/rendertype_entity_glint_direct.json | 17 - .../core/rendertype_entity_glint_direct.vsh | 21 - .../core/rendertype_entity_no_outline.fsh | 21 - .../core/rendertype_entity_no_outline.json | 9 +- .../core/rendertype_entity_no_outline.vsh | 31 - .../shaders/core/rendertype_entity_shadow.fsh | 2 +- .../core/rendertype_entity_shadow.json | 4 +- .../shaders/core/rendertype_entity_shadow.vsh | 2 +- .../core/rendertype_entity_smooth_cutout.fsh | 29 - .../core/rendertype_entity_smooth_cutout.json | 9 +- .../core/rendertype_entity_smooth_cutout.vsh | 37 - .../shaders/core/rendertype_entity_solid.fsh | 25 - .../shaders/core/rendertype_entity_solid.json | 4 +- .../shaders/core/rendertype_entity_solid.vsh | 37 - .../core/rendertype_entity_translucent.fsh | 29 - .../core/rendertype_entity_translucent.json | 9 +- .../core/rendertype_entity_translucent.vsh | 37 - .../rendertype_entity_translucent_cull.fsh | 25 - .../rendertype_entity_translucent_cull.vsh | 36 - ...rendertype_entity_translucent_emissive.fsh | 26 - ...endertype_entity_translucent_emissive.json | 16 +- ...rendertype_entity_translucent_emissive.vsh | 33 - .../shaders/core/rendertype_eyes.fsh | 20 - .../shaders/core/rendertype_eyes.json | 12 +- .../shaders/core/rendertype_eyes.vsh | 23 - .../shaders/core/rendertype_glint.fsh | 24 - .../shaders/core/rendertype_glint.json | 4 +- .../shaders/core/rendertype_glint.vsh | 21 - .../core/rendertype_glint_translucent.fsh | 24 - .../core/rendertype_glint_translucent.json | 4 +- .../core/rendertype_glint_translucent.vsh | 21 - .../shaders/core/rendertype_gui.json | 4 +- .../rendertype_gui_ghost_recipe_overlay.fsh | 15 - .../rendertype_gui_ghost_recipe_overlay.json | 4 +- .../rendertype_gui_ghost_recipe_overlay.vsh | 15 - .../shaders/core/rendertype_gui_overlay.fsh | 15 - .../shaders/core/rendertype_gui_overlay.json | 4 +- .../shaders/core/rendertype_gui_overlay.vsh | 15 - .../core/rendertype_gui_text_highlight.fsh | 15 - .../core/rendertype_gui_text_highlight.json | 4 +- .../core/rendertype_gui_text_highlight.vsh | 15 - ...endertype_item_entity_translucent_cull.fsh | 2 +- ...ndertype_item_entity_translucent_cull.json | 4 +- ...endertype_item_entity_translucent_cull.vsh | 4 +- .../shaders/core/rendertype_leash.fsh | 2 +- .../shaders/core/rendertype_leash.json | 4 +- .../shaders/core/rendertype_leash.vsh | 2 +- .../shaders/core/rendertype_lightning.fsh | 2 +- .../shaders/core/rendertype_lightning.json | 5 +- .../shaders/core/rendertype_lightning.vsh | 2 +- .../shaders/core/rendertype_lines.fsh | 2 +- .../shaders/core/rendertype_lines.json | 4 +- .../shaders/core/rendertype_lines.vsh | 2 +- .../shaders/core/rendertype_outline.json | 4 +- .../shaders/core/rendertype_solid.fsh | 21 - .../shaders/core/rendertype_solid.json | 6 +- .../shaders/core/rendertype_solid.vsh | 30 - .../shaders/core/rendertype_text.fsh | 2 +- .../shaders/core/rendertype_text.json | 4 +- .../shaders/core/rendertype_text.vsh | 2 +- .../core/rendertype_text_background.fsh | 2 +- .../core/rendertype_text_background.json | 4 +- .../core/rendertype_text_background.vsh | 2 +- ...endertype_text_background_see_through.json | 4 +- .../core/rendertype_text_intensity.fsh | 2 +- .../core/rendertype_text_intensity.json | 4 +- .../core/rendertype_text_intensity.vsh | 2 +- ...rendertype_text_intensity_see_through.json | 4 +- .../core/rendertype_text_see_through.json | 4 +- .../shaders/core/rendertype_translucent.fsh | 21 - .../shaders/core/rendertype_translucent.json | 6 +- .../shaders/core/rendertype_translucent.vsh | 30 - .../rendertype_translucent_moving_block.json | 4 +- .../shaders/core/rendertype_tripwire.fsh | 24 - .../shaders/core/rendertype_tripwire.json | 11 +- .../shaders/core/rendertype_tripwire.vsh | 30 - .../shaders/core/rendertype_water_mask.json | 4 +- .../{rendertype_cutout.fsh => terrain.fsh} | 6 +- ...ndertype_cutout_mipped.vsh => terrain.vsh} | 8 +- .../shaders/{program => post}/bits.fsh | 4 +- .../shaders/{program => post}/bits.json | 12 +- assets/minecraft/shaders/post/blit.fsh | 13 + .../shaders/{program => post}/blit.json | 12 +- .../shaders/{program => post}/blit.vsh | 0 assets/minecraft/shaders/post/blur.json | 81 - .../shaders/{program => post}/blur.vsh | 0 .../shaders/{program => post}/box_blur.fsh | 6 +- .../shaders/{program => post}/box_blur.json | 12 +- .../{program => post}/color_convolve.fsh | 4 +- .../{program => post}/color_convolve.json | 12 +- .../shaders/post/entity_outline.json | 46 +- .../entity_outline_box_blur.fsh | 6 +- .../entity_outline_box_blur.json | 7 +- .../{program => post}/entity_sobel.fsh | 12 +- .../shaders/{program => post}/invert.fsh | 4 +- assets/minecraft/shaders/post/invert.json | 28 +- .../shaders/{program => post}/invert.vsh | 0 .../shaders/{program => post}/rotscale.vsh | 1 - .../shaders/{program => post}/screenquad.vsh | 0 .../shaders/{program => post}/sobel.vsh | 0 assets/minecraft/shaders/post/spider.json | 244 +- .../shaders/{program => post}/spiderclip.fsh | 4 +- .../{program => post}/transparency.fsh | 8 +- .../minecraft/shaders/post/transparency.json | 83 +- assets/minecraft/shaders/program/blit.fsh | 13 - .../shaders/program/entity_outline.json | 18 - assets/minecraft/shaders/program/invert.json | 19 - assets/minecraft/shaders/program/spider.json | 25 - .../shaders/program/transparency.json | 28 - assets/minecraft/texts/credits.json | 3 +- .../textures/block/creaking_heart.png | 3 + .../textures/block/creaking_heart_active.png | 3 + .../textures/block/creaking_heart_top.png | 3 + .../block/creaking_heart_top_active.png | 3 + .../textures/block/pale_hanging_moss.png | 3 + .../textures/block/pale_hanging_moss_tip.png | 3 + .../textures/block/pale_moss_block.png | 3 + .../textures/block/pale_moss_carpet.png | 3 + .../block/pale_moss_carpet_side_small.png | 3 + .../block/pale_moss_carpet_side_tall.png | 3 + .../textures/block/pale_oak_door_bottom.png | 3 + .../textures/block/pale_oak_door_top.png | 3 + .../textures/block/pale_oak_leaves.png | 3 + .../minecraft/textures/block/pale_oak_log.png | 3 + .../textures/block/pale_oak_log_top.png | 3 + .../textures/block/pale_oak_planks.png | 3 + .../textures/block/pale_oak_sapling.png | 3 + .../textures/block/pale_oak_trapdoor.png | 3 + .../textures/block/redstone_torch.png | 4 +- .../textures/block/stripped_pale_oak_log.png | 3 + .../block/stripped_pale_oak_log_top.png | 3 + .../textures/entity/bee/bee_stinger.png | 4 +- assets/minecraft/textures/entity/blaze.png | 4 +- .../textures/entity/boat/pale_oak.png | 3 + .../textures/entity/chest_boat/pale_oak.png | 3 + .../textures/entity/creaking/creaking.png | 3 + .../entity/creaking/creaking_eyes.png | 3 + .../horse_body/diamond.png} | 0 .../horse_body/gold.png} | 0 .../horse_body/iron.png} | 0 .../horse_body/leather.png} | 0 .../equipment/humanoid/chainmail.png} | 0 .../equipment/humanoid/diamond.png} | 0 .../equipment/humanoid/gold.png} | 0 .../equipment/humanoid/iron.png} | 0 .../equipment/humanoid/leather.png} | 0 .../equipment/humanoid/leather_overlay.png} | 0 .../equipment/humanoid/netherite.png} | 0 .../equipment/humanoid/turtle_scute.png} | 0 .../humanoid_leggings/chainmail.png} | 0 .../equipment/humanoid_leggings/diamond.png} | 0 .../equipment/humanoid_leggings/gold.png} | 0 .../equipment/humanoid_leggings/iron.png} | 0 .../equipment/humanoid_leggings/leather.png} | 0 .../humanoid_leggings/leather_overlay.png} | 0 .../humanoid_leggings/netherite.png} | 0 .../decor => equipment/llama_body}/black.png | 0 .../decor => equipment/llama_body}/blue.png | 0 .../decor => equipment/llama_body}/brown.png | 0 .../decor => equipment/llama_body}/cyan.png | 0 .../decor => equipment/llama_body}/gray.png | 0 .../decor => equipment/llama_body}/green.png | 0 .../llama_body}/light_blue.png | 0 .../llama_body}/light_gray.png | 0 .../decor => equipment/llama_body}/lime.png | 0 .../llama_body}/magenta.png | 0 .../decor => equipment/llama_body}/orange.png | 0 .../decor => equipment/llama_body}/pink.png | 0 .../decor => equipment/llama_body}/purple.png | 0 .../decor => equipment/llama_body}/red.png | 0 .../llama_body}/trader_llama.png | 0 .../decor => equipment/llama_body}/white.png | 0 .../decor => equipment/llama_body}/yellow.png | 0 .../entity/{ => equipment/wings}/elytra.png | 0 .../wolf_body/armadillo_scute.png} | 0 .../wolf_body/armadillo_scute_overlay.png} | 0 .../entity/fish/tropical_a_pattern_1.png | 4 +- .../entity/fish/tropical_a_pattern_2.png | 4 +- .../entity/fish/tropical_a_pattern_3.png | 4 +- .../entity/fish/tropical_a_pattern_4.png | 4 +- .../entity/fish/tropical_a_pattern_5.png | 4 +- .../entity/fish/tropical_a_pattern_6.png | 4 +- .../entity/fish/tropical_b_pattern_1.png | 4 +- .../entity/fish/tropical_b_pattern_2.png | 4 +- .../entity/fish/tropical_b_pattern_3.png | 4 +- .../entity/fish/tropical_b_pattern_4.png | 4 +- .../entity/fish/tropical_b_pattern_5.png | 4 +- .../entity/fish/tropical_b_pattern_6.png | 4 +- .../textures/entity/projectiles/arrow.png | 4 +- .../entity/projectiles/spectral_arrow.png | 4 +- .../entity/projectiles/tipped_arrow.png | 4 +- .../entity/signs/hanging/pale_oak.png | 3 + .../textures/entity/signs/pale_oak.png | 3 + .../textures/gui/hanging_signs/pale_oak.png | 3 + .../sprites/container/bundle/background.png | 3 - .../sprites/container/bundle/blocked_slot.png | 3 - .../bundle/bundle_progressbar_border.png | 3 + .../bundle_progressbar_border.png.mcmeta | 10 + .../bundle/bundle_progressbar_fill.png | 3 + .../bundle/bundle_progressbar_fill.png.mcmeta | 10 + .../bundle/bundle_progressbar_full.png | 3 + .../bundle/bundle_progressbar_full.png.mcmeta | 10 + .../gui/sprites/container/bundle/slot.png | 3 - .../container/bundle/slot_background.png | 3 + .../container/bundle/slot_highlight_back.png | 3 + ....mcmeta => slot_highlight_back.png.mcmeta} | 4 +- .../container/bundle/slot_highlight_front.png | 3 + .../bundle/slot_highlight_front.png.mcmeta | 10 + .../sprites/container/loom/pattern_slot.png | 4 +- .../sprites/container/slot_highlight_back.png | 3 + .../container/slot_highlight_back.png.mcmeta | 10 + .../container/slot_highlight_front.png | 3 + .../container/slot_highlight_front.png.mcmeta | 10 + .../textures/gui/sprites/hud/air_empty.png | 3 + .../gui/sprites/tooltip/background.png | 3 + .../gui/sprites/tooltip/background.png.mcmeta | 10 + .../textures/gui/sprites/tooltip/frame.png | 3 + .../gui/sprites/tooltip/frame.png.mcmeta | 11 + .../minecraft/textures/item/black_bundle.png | 3 + .../textures/item/black_bundle_open_back.png | 3 + .../textures/item/black_bundle_open_front.png | 3 + .../minecraft/textures/item/blue_bundle.png | 3 + .../textures/item/blue_bundle_open_back.png | 3 + .../textures/item/blue_bundle_open_front.png | 3 + .../item/bordure_indented_banner_pattern.png | 3 + .../minecraft/textures/item/brown_bundle.png | 3 + .../textures/item/brown_bundle_open_back.png | 3 + .../textures/item/brown_bundle_open_front.png | 3 + assets/minecraft/textures/item/bundle.png | 4 +- .../minecraft/textures/item/bundle_filled.png | 3 - .../textures/item/bundle_open_back.png | 3 + .../textures/item/bundle_open_front.png | 3 + .../textures/item/creeper_banner_pattern.png | 4 +- .../minecraft/textures/item/cyan_bundle.png | 3 + .../textures/item/cyan_bundle_open_back.png | 3 + .../textures/item/cyan_bundle_open_front.png | 3 + .../item/field_masoned_banner_pattern.png | 3 + .../textures/item/flow_banner_pattern.png | 4 +- .../textures/item/flower_banner_pattern.png | 4 +- .../textures/item/globe_banner_pattern.png | 4 +- .../minecraft/textures/item/gray_bundle.png | 3 + .../textures/item/gray_bundle_open_back.png | 3 + .../textures/item/gray_bundle_open_front.png | 3 + .../minecraft/textures/item/green_bundle.png | 3 + .../textures/item/green_bundle_open_back.png | 3 + .../textures/item/green_bundle_open_front.png | 3 + .../textures/item/guster_banner_pattern.png | 4 +- .../textures/item/light_blue_bundle.png | 3 + .../item/light_blue_bundle_open_back.png | 3 + .../item/light_blue_bundle_open_front.png | 3 + .../textures/item/light_gray_bundle.png | 3 + .../item/light_gray_bundle_open_back.png | 3 + .../item/light_gray_bundle_open_front.png | 3 + .../minecraft/textures/item/lime_bundle.png | 3 + .../textures/item/lime_bundle_open_back.png | 3 + .../textures/item/lime_bundle_open_front.png | 3 + .../textures/item/magenta_bundle.png | 3 + .../item/magenta_bundle_open_back.png | 3 + .../item/magenta_bundle_open_front.png | 3 + .../textures/item/mojang_banner_pattern.png | 4 +- .../minecraft/textures/item/orange_bundle.png | 3 + .../textures/item/orange_bundle_open_back.png | 3 + .../item/orange_bundle_open_front.png | 3 + .../minecraft/textures/item/pale_oak_boat.png | 3 + .../textures/item/pale_oak_chest_boat.png | 3 + .../minecraft/textures/item/pale_oak_door.png | 3 + .../textures/item/pale_oak_hanging_sign.png | 3 + .../minecraft/textures/item/pale_oak_sign.png | 3 + .../textures/item/piglin_banner_pattern.png | 4 +- .../minecraft/textures/item/pink_bundle.png | 3 + .../textures/item/pink_bundle_open_back.png | 3 + .../textures/item/pink_bundle_open_front.png | 3 + .../minecraft/textures/item/purple_bundle.png | 3 + .../textures/item/purple_bundle_open_back.png | 3 + .../item/purple_bundle_open_front.png | 3 + assets/minecraft/textures/item/red_bundle.png | 3 + .../textures/item/red_bundle_open_back.png | 3 + .../textures/item/red_bundle_open_front.png | 3 + .../textures/item/skull_banner_pattern.png | 4 +- .../minecraft/textures/item/white_bundle.png | 3 + .../textures/item/white_bundle_open_back.png | 3 + .../textures/item/white_bundle_open_front.png | 3 + .../minecraft/textures/item/yellow_bundle.png | 3 + .../textures/item/yellow_bundle_open_back.png | 3 + .../item/yellow_bundle_open_front.png | 3 + ...meta => enchanted_glint_entity.png.mcmeta} | 0 .../misc/enchanted_glint_item.png.mcmeta | 5 + .../minecraft/textures/misc/nausea.png.mcmeta | 5 + .../armor => entity/humanoid}/bolt.png | 0 .../armor => entity/humanoid}/coast.png | 0 .../armor => entity/humanoid}/dune.png | 0 .../{models/armor => entity/humanoid}/eye.png | 0 .../armor => entity/humanoid}/flow.png | 0 .../armor => entity/humanoid}/host.png | 0 .../armor => entity/humanoid}/raiser.png | 0 .../{models/armor => entity/humanoid}/rib.png | 0 .../armor => entity/humanoid}/sentry.png | 0 .../armor => entity/humanoid}/shaper.png | 0 .../armor => entity/humanoid}/silence.png | 0 .../armor => entity/humanoid}/snout.png | 0 .../armor => entity/humanoid}/spire.png | 0 .../armor => entity/humanoid}/tide.png | 0 .../{models/armor => entity/humanoid}/vex.png | 0 .../armor => entity/humanoid}/ward.png | 0 .../armor => entity/humanoid}/wayfinder.png | 0 .../armor => entity/humanoid}/wild.png | 0 .../humanoid_leggings/bolt.png} | 0 .../humanoid_leggings/coast.png} | 0 .../humanoid_leggings/dune.png} | 0 .../humanoid_leggings/eye.png} | 0 .../humanoid_leggings/flow.png} | 0 .../humanoid_leggings/host.png} | 0 .../humanoid_leggings/raiser.png} | 0 .../humanoid_leggings/rib.png} | 0 .../humanoid_leggings/sentry.png} | 0 .../humanoid_leggings/shaper.png} | 0 .../humanoid_leggings/silence.png} | 0 .../humanoid_leggings/snout.png} | 0 .../humanoid_leggings/spire.png} | 0 .../humanoid_leggings/tide.png} | 0 .../humanoid_leggings/vex.png} | 0 .../humanoid_leggings/ward.png} | 0 .../humanoid_leggings/wayfinder.png} | 0 .../humanoid_leggings/wild.png} | 0 com/mojang/blaze3d/Blaze3D.java | 14 +- com/mojang/blaze3d/ProjectionType.java | 34 + com/mojang/blaze3d/TracyBootstrap.java | 31 + com/mojang/blaze3d/TracyFrameCapture.java | 109 + com/mojang/blaze3d/buffers/BufferType.java | 21 + com/mojang/blaze3d/buffers/BufferUsage.java | 27 + com/mojang/blaze3d/buffers/GpuBuffer.java | 136 + com/mojang/blaze3d/buffers/GpuFence.java | 32 + com/mojang/blaze3d/buffers/package-info.java | 11 + .../blaze3d/font/TrueTypeGlyphProvider.java | 145 +- .../blaze3d/framegraph/FrameGraphBuilder.java | 362 + com/mojang/blaze3d/framegraph/FramePass.java | 21 + .../blaze3d/framegraph/package-info.java | 11 + .../blaze3d/pipeline/RenderPipeline.java | 99 - com/mojang/blaze3d/pipeline/RenderTarget.java | 80 +- .../blaze3d/pipeline/TextureTarget.java | 6 +- .../platform/ClientShutdownWatchdog.java | 30 + .../platform/FramerateLimitTracker.java | 56 + com/mojang/blaze3d/platform/GLX.java | 4 +- com/mojang/blaze3d/platform/GlConst.java | 17 + .../blaze3d/platform/GlStateManager.java | 88 +- com/mojang/blaze3d/platform/MacosUtil.java | 2 + com/mojang/blaze3d/platform/NativeImage.java | 204 +- com/mojang/blaze3d/platform/Window.java | 60 +- .../preprocessor/GlslPreprocessor.java | 11 + .../resource/CrossFrameResourcePool.java | 83 + .../resource/GraphicsResourceAllocator.java | 23 + .../resource/RenderTargetDescriptor.java | 17 + .../blaze3d/resource/ResourceDescriptor.java | 11 + .../blaze3d/resource/ResourceHandle.java | 17 + com/mojang/blaze3d/resource/package-info.java | 11 + com/mojang/blaze3d/shaders/BlendMode.java | 146 - .../blaze3d/shaders/CompiledShader.java | 94 + com/mojang/blaze3d/shaders/EffectProgram.java | 46 - com/mojang/blaze3d/shaders/Program.java | 108 - .../blaze3d/shaders/ProgramManager.java | 51 - com/mojang/blaze3d/shaders/Shader.java | 17 - com/mojang/blaze3d/shaders/Uniform.java | 51 +- com/mojang/blaze3d/systems/RenderSystem.java | 302 +- com/mojang/blaze3d/vertex/BufferBuilder.java | 7 +- com/mojang/blaze3d/vertex/BufferUploader.java | 11 +- .../blaze3d/vertex/ByteBufferBuilder.java | 7 + com/mojang/blaze3d/vertex/PoseStack.java | 5 + .../vertex/SheetedDecalTextureGenerator.java | 2 +- com/mojang/blaze3d/vertex/VertexBuffer.java | 94 +- com/mojang/blaze3d/vertex/VertexConsumer.java | 48 +- com/mojang/blaze3d/vertex/VertexFormat.java | 41 +- com/mojang/realmsclient/RealmsMainScreen.java | 245 +- .../realmsclient/client/FileUpload.java | 65 +- .../realmsclient/client/RealmsClient.java | 31 +- .../realmsclient/client/UploadStatus.java | 51 +- .../worldupload/RealmsCreateWorldFlow.java | 117 + .../RealmsUploadCanceledException.java | 15 + .../worldupload/RealmsUploadException.java | 19 + .../RealmsUploadFailedException.java | 23 + .../RealmsUploadTooLargeException.java | 23 + .../RealmsUploadWorldNotClosedException.java | 13 + .../worldupload/RealmsUploadWorldPacker.java | 100 + .../client/worldupload/RealmsWorldUpload.java | 126 + .../RealmsWorldUploadStatusTracker.java | 27 + .../client/worldupload/package-info.java | 11 + com/mojang/realmsclient/dto/PlayerInfo.java | 4 +- com/mojang/realmsclient/dto/RealmsNews.java | 9 +- com/mojang/realmsclient/dto/RealmsServer.java | 44 +- .../realmsclient/dto/RealmsServerAddress.java | 11 +- .../realmsclient/dto/RealmsServerList.java | 16 +- .../dto/RealmsSettings.java} | 4 +- .../realmsclient/dto/RealmsWorldOptions.java | 97 +- .../realmsclient/dto/ServerActivity.java | 2 + .../realmsclient/gui/RealmsDataFetcher.java | 17 +- .../realmsclient/gui/RealmsNewsManager.java | 20 +- .../gui/RealmsWorldSlotButton.java | 39 +- com/mojang/realmsclient/gui/RowButton.java | 34 +- .../gui/screens/AddRealmPopupScreen.java | 14 +- .../gui/screens/RealmsBackupInfoScreen.java | 5 - .../gui/screens/RealmsBackupScreen.java | 57 +- .../gui/screens/RealmsBrokenWorldScreen.java | 20 +- .../screens/RealmsConfigureWorldScreen.java | 16 +- .../gui/screens/RealmsCreateRealmScreen.java | 80 +- .../screens/RealmsNotificationsScreen.java | 27 +- .../screens/RealmsPendingInvitesScreen.java | 125 +- .../gui/screens/RealmsPlayerScreen.java | 5 - .../screens/RealmsResetNormalWorldScreen.java | 113 - .../gui/screens/RealmsResetWorldScreen.java | 37 +- .../RealmsSelectFileToUploadScreen.java | 17 +- .../RealmsSelectWorldTemplateScreen.java | 96 +- .../gui/screens/RealmsSettingsScreen.java | 3 +- .../gui/screens/RealmsSlotOptionsScreen.java | 62 +- .../screens/RealmsSubscriptionInfoScreen.java | 7 +- .../gui/screens/RealmsUploadScreen.java | 304 +- .../gui/screens/UploadResult.java | 9 + com/mojang/realmsclient/util/JsonUtils.java | 7 +- com/mojang/realmsclient/util/RealmsUtil.java | 2 +- .../realmsclient/util/UploadTokenCache.java | 3 +- .../util/WorldGenerationInfo.java | 9 - .../realmsclient/util/task/ConnectTask.java | 6 +- .../util/task/CreateSnapshotRealmTask.java | 86 - .../util/task/GetServerDetailsTask.java | 39 +- .../task/ResettingGeneratedWorldTask.java | 23 - .../advancement/adventure/arbalistic.json | 5 +- .../adventure/hero_of_the_village.json | 3 +- .../advancement/adventure/overoverkill.json | 2 +- .../adventure/two_birds_one_arrow.json | 5 +- .../adventure/voluntary_exile.json | 16 +- .../adventure/whos_the_pillager_now.json | 5 +- .../husbandry/ride_a_boat_with_a_goat.json | 2 +- .../advancement/nether/distract_piglin.json | 16 +- .../recipes/combat/diamond_sword.json | 2 +- .../recipes/combat/golden_sword.json | 2 +- .../recipes/combat/iron_sword.json | 2 +- .../combat/netherite_boots_smithing.json | 2 +- .../combat/netherite_chestplate_smithing.json | 2 +- .../combat/netherite_helmet_smithing.json | 2 +- .../combat/netherite_leggings_smithing.json | 2 +- .../combat/netherite_sword_smithing.json | 2 +- .../decorations/black_shulker_box.json | 32 + .../recipes/decorations/blue_shulker_box.json | 32 + .../decorations/brown_shulker_box.json | 32 + .../recipes/decorations/cyan_shulker_box.json | 32 + .../recipes/decorations/gray_shulker_box.json | 32 + .../decorations/green_shulker_box.json | 32 + .../decorations/light_blue_shulker_box.json | 32 + .../decorations/light_gray_shulker_box.json | 32 + .../recipes/decorations/lime_shulker_box.json | 32 + .../decorations/magenta_shulker_box.json | 32 + .../decorations/orange_shulker_box.json | 32 + .../recipes/decorations/pink_shulker_box.json | 32 + .../decorations/purple_shulker_box.json | 32 + .../recipes/decorations/red_shulker_box.json | 32 + .../decorations/white_shulker_box.json | 32 + .../decorations/yellow_shulker_box.json | 32 + .../food/suspicious_stew_from_allium.json | 32 + .../suspicious_stew_from_azure_bluet.json | 32 + .../suspicious_stew_from_blue_orchid.json | 32 + .../food/suspicious_stew_from_cornflower.json | 32 + .../food/suspicious_stew_from_dandelion.json | 32 + ...spicious_stew_from_lily_of_the_valley.json | 32 + .../suspicious_stew_from_orange_tulip.json | 32 + .../suspicious_stew_from_oxeye_daisy.json | 32 + .../food/suspicious_stew_from_pink_tulip.json | 32 + .../food/suspicious_stew_from_poppy.json | 32 + .../food/suspicious_stew_from_red_tulip.json | 32 + .../suspicious_stew_from_torchflower.json | 32 + .../suspicious_stew_from_white_tulip.json | 32 + .../suspicious_stew_from_wither_rose.json | 32 + .../misc/bordure_indented_banner_pattern.json | 32 + .../misc/field_masoned_banner_pattern.json | 32 + .../recipes/tools/black_bundle.json | 32 + .../recipes/tools/blue_bundle.json | 32 + .../recipes/tools/brown_bundle.json | 32 + .../advancement/recipes/tools/bundle.json | 0 .../recipes/tools/cyan_bundle.json | 32 + .../recipes/tools/diamond_axe.json | 2 +- .../recipes/tools/diamond_hoe.json | 2 +- .../recipes/tools/diamond_pickaxe.json | 2 +- .../recipes/tools/diamond_shovel.json | 2 +- .../advancement/recipes/tools/golden_axe.json | 2 +- .../advancement/recipes/tools/golden_hoe.json | 2 +- .../recipes/tools/golden_pickaxe.json | 2 +- .../recipes/tools/golden_shovel.json | 2 +- .../recipes/tools/gray_bundle.json | 32 + .../recipes/tools/green_bundle.json | 32 + .../advancement/recipes/tools/iron_axe.json | 2 +- .../advancement/recipes/tools/iron_hoe.json | 2 +- .../recipes/tools/iron_pickaxe.json | 2 +- .../recipes/tools/iron_shovel.json | 2 +- .../recipes/tools/light_blue_bundle.json | 32 + .../recipes/tools/light_gray_bundle.json | 32 + .../recipes/tools/lime_bundle.json | 32 + .../recipes/tools/magenta_bundle.json | 32 + .../recipes/tools/netherite_axe_smithing.json | 2 +- .../recipes/tools/netherite_hoe_smithing.json | 2 +- .../tools/netherite_pickaxe_smithing.json | 2 +- .../tools/netherite_shovel_smithing.json | 2 +- .../recipes/tools/orange_bundle.json | 32 + .../recipes/tools/pink_bundle.json | 32 + .../recipes/tools/purple_bundle.json | 32 + .../advancement/recipes/tools/red_bundle.json | 32 + .../recipes/tools/white_bundle.json | 32 + .../recipes/tools/yellow_bundle.json | 32 + data/minecraft/damage_type/ender_pearl.json | 6 + data/minecraft/damage_type/mace_smash.json | 5 + data/minecraft/datapacks/bundle/pack.mcmeta | 13 - .../minecart_improvements/pack.mcmeta | 13 + .../redstone_experiments/pack.mcmeta | 13 + .../datapacks/trade_rebalance/pack.mcmeta | 2 +- .../adventure/adventuring_time.json | 1050 ++ .../advancement/adventure/kill_a_mob.json | 577 ++ .../advancement/adventure/kill_all_mobs.json | 653 ++ .../building_blocks/pale_oak_planks.json | 32 + .../building_blocks/pale_oak_slab.json | 32 + .../building_blocks/pale_oak_stairs.json | 32 + .../building_blocks/pale_oak_wood.json | 32 + .../stripped_pale_oak_wood.json | 32 + .../recipes/decorations/pale_moss_carpet.json | 32 + .../recipes/decorations/pale_oak_fence.json | 32 + .../decorations/pale_oak_hanging_sign.json | 32 + .../recipes/decorations/pale_oak_sign.json | 32 + .../recipes/redstone/pale_oak_button.json | 32 + .../recipes/redstone/pale_oak_door.json | 32 + .../recipes/redstone/pale_oak_fence_gate.json | 32 + .../redstone/pale_oak_pressure_plate.json | 32 + .../recipes/redstone/pale_oak_trapdoor.json | 32 + .../recipes/transportation/pale_oak_boat.json | 28 + .../transportation/pale_oak_chest_boat.json | 32 + .../loot_table/blocks/creaking_heart.json | 33 + .../loot_table/blocks/pale_hanging_moss.json | 44 + .../loot_table/blocks/pale_moss_block.json | 21 + .../loot_table/blocks/pale_moss_carpet.json | 30 + .../loot_table/blocks/pale_oak_button.json | 21 + .../loot_table/blocks/pale_oak_door.json | 30 + .../loot_table/blocks/pale_oak_fence.json | 21 + .../blocks/pale_oak_fence_gate.json | 21 + .../blocks/pale_oak_hanging_sign.json | 21 + .../loot_table/blocks/pale_oak_leaves.json | 136 + .../loot_table/blocks/pale_oak_log.json | 21 + .../loot_table/blocks/pale_oak_planks.json | 21 + .../blocks/pale_oak_pressure_plate.json | 21 + .../loot_table/blocks/pale_oak_sapling.json | 21 + .../loot_table/blocks/pale_oak_sign.json | 21 + .../loot_table/blocks/pale_oak_slab.json | 35 + .../loot_table/blocks/pale_oak_stairs.json | 21 + .../loot_table/blocks/pale_oak_trapdoor.json | 21 + .../loot_table/blocks/pale_oak_wood.json | 21 + .../blocks/potted_pale_oak_sapling.json | 36 + .../blocks/stripped_pale_oak_log.json | 21 + .../blocks/stripped_pale_oak_wood.json | 21 + .../minecraft/recipe/pale_moss_carpet.json | 15 + .../data/minecraft/recipe/pale_oak_boat.json | 16 + .../minecraft/recipe/pale_oak_button.json | 12 + .../minecraft/recipe/pale_oak_chest_boat.json | 13 + .../data/minecraft/recipe/pale_oak_door.json | 17 + .../data/minecraft/recipe/pale_oak_fence.json | 17 + .../minecraft/recipe/pale_oak_fence_gate.json | 17 + .../recipe/pale_oak_hanging_sign.json | 18 + .../minecraft/recipe/pale_oak_planks.json | 12 + .../recipe/pale_oak_pressure_plate.json | 15 + .../data/minecraft/recipe/pale_oak_sign.json | 18 + .../data/minecraft/recipe/pale_oak_slab.json | 15 + .../minecraft/recipe/pale_oak_stairs.json | 17 + .../minecraft/recipe/pale_oak_trapdoor.json | 16 + .../data/minecraft/recipe/pale_oak_wood.json | 16 + .../recipe/stripped_pale_oak_wood.json | 16 + .../tags/block/ceiling_hanging_signs.json | 5 + .../block/combination_step_sound_blocks.json | 5 + .../data/minecraft/tags/block/dirt.json | 5 + .../minecraft/tags/block/fence_gates.json | 5 + .../minecraft/tags/block/flower_pots.json | 5 + .../data/minecraft/tags/block/leaves.json | 5 + .../minecraft/tags/block/logs_that_burn.json | 5 + .../minecraft/tags/block/mineable/axe.json | 5 + .../minecraft/tags/block/mineable/hoe.json | 7 + .../tags/block/overworld_natural_logs.json | 5 + .../minecraft/tags/block/pale_oak_logs.json | 8 + .../data/minecraft/tags/block/planks.json | 5 + .../data/minecraft/tags/block/saplings.json | 5 + .../minecraft/tags/block/standing_signs.json | 5 + .../minecraft/tags/block/sword_efficient.json | 5 + .../tags/block/wall_hanging_signs.json | 5 + .../data/minecraft/tags/block/wall_signs.json | 5 + .../minecraft/tags/block/wooden_buttons.json | 5 + .../minecraft/tags/block/wooden_doors.json | 5 + .../minecraft/tags/block/wooden_fences.json | 5 + .../tags/block/wooden_pressure_plates.json | 5 + .../minecraft/tags/block/wooden_slabs.json | 5 + .../minecraft/tags/block/wooden_stairs.json | 5 + .../tags/block/wooden_trapdoors.json | 5 + .../data/minecraft/tags/entity_type/boat.json | 5 + .../data/minecraft/tags/item/boats.json | 5 + .../data/minecraft/tags/item/chest_boats.json | 5 + .../data/minecraft/tags/item/dirt.json | 5 + .../data/minecraft/tags/item/fence_gates.json | 5 + .../minecraft/tags/item/hanging_signs.json | 5 + .../data/minecraft/tags/item/leaves.json | 5 + .../minecraft/tags/item/logs_that_burn.json | 5 + .../minecraft/tags/item/pale_oak_logs.json | 8 + .../data/minecraft/tags/item/planks.json | 5 + .../data/minecraft/tags/item/saplings.json | 5 + .../data/minecraft/tags/item/signs.json | 5 + .../minecraft/tags/item/wooden_buttons.json | 5 + .../minecraft/tags/item/wooden_doors.json | 5 + .../minecraft/tags/item/wooden_fences.json | 5 + .../tags/item/wooden_pressure_plates.json | 5 + .../minecraft/tags/item/wooden_slabs.json | 5 + .../minecraft/tags/item/wooden_stairs.json | 5 + .../minecraft/tags/item/wooden_trapdoors.json | 5 + .../biome/has_structure/trial_chambers.json | 5 + .../tags/worldgen/biome/is_forest.json | 5 + .../tags/worldgen/biome/is_overworld.json | 5 + .../worldgen/biome/stronghold_biased_to.json | 5 + .../minecraft/worldgen/biome/pale_garden.json | 166 + .../overworld.json | 3 + .../datapacks/winter_drop/pack.mcmeta | 13 + data/minecraft/enchantment/aqua_affinity.json | 2 +- .../enchantment/blast_protection.json | 2 +- data/minecraft/enchantment/depth_strider.json | 2 +- data/minecraft/enchantment/efficiency.json | 2 +- .../enchantment/fire_protection.json | 2 +- data/minecraft/enchantment/respiration.json | 2 +- data/minecraft/enchantment/soul_speed.json | 52 +- data/minecraft/enchantment/sweeping_edge.json | 2 +- data/minecraft/enchantment/swift_sneak.json | 2 +- data/minecraft/enchantment/thorns.json | 2 +- .../instrument/admire_goat_horn.json | 8 + data/minecraft/instrument/call_goat_horn.json | 8 + .../minecraft/instrument/dream_goat_horn.json | 8 + data/minecraft/instrument/feel_goat_horn.json | 8 + .../instrument/ponder_goat_horn.json | 8 + data/minecraft/instrument/seek_goat_horn.json | 8 + data/minecraft/instrument/sing_goat_horn.json | 8 + .../minecraft/instrument/yearn_goat_horn.json | 8 + .../loot_table/blocks/black_banner.json | 3 +- .../loot_table/blocks/blue_banner.json | 3 +- .../loot_table/blocks/brown_banner.json | 3 +- .../loot_table/blocks/creaking_heart.json | 4 + .../loot_table/blocks/cyan_banner.json | 3 +- .../loot_table/blocks/gray_banner.json | 3 +- .../loot_table/blocks/green_banner.json | 3 +- .../loot_table/blocks/light_blue_banner.json | 3 +- .../loot_table/blocks/light_gray_banner.json | 3 +- .../loot_table/blocks/lime_banner.json | 3 +- .../loot_table/blocks/magenta_banner.json | 3 +- .../loot_table/blocks/orange_banner.json | 3 +- .../loot_table/blocks/pale_hanging_moss.json | 4 + .../loot_table/blocks/pale_moss_block.json | 4 + .../loot_table/blocks/pale_moss_carpet.json | 4 + .../loot_table/blocks/pale_oak_button.json | 4 + .../loot_table/blocks/pale_oak_door.json | 4 + .../loot_table/blocks/pale_oak_fence.json | 4 + .../blocks/pale_oak_fence_gate.json | 4 + .../blocks/pale_oak_hanging_sign.json | 4 + .../loot_table/blocks/pale_oak_leaves.json | 4 + .../loot_table/blocks/pale_oak_log.json | 4 + .../loot_table/blocks/pale_oak_planks.json | 4 + .../blocks/pale_oak_pressure_plate.json | 4 + .../loot_table/blocks/pale_oak_sapling.json | 4 + .../loot_table/blocks/pale_oak_sign.json | 4 + .../loot_table/blocks/pale_oak_slab.json | 4 + .../loot_table/blocks/pale_oak_stairs.json | 4 + .../loot_table/blocks/pale_oak_trapdoor.json | 4 + .../loot_table/blocks/pale_oak_wood.json | 4 + .../loot_table/blocks/pink_banner.json | 3 +- .../blocks/potted_pale_oak_sapling.json | 4 + .../loot_table/blocks/purple_banner.json | 3 +- .../loot_table/blocks/red_banner.json | 3 +- .../blocks/stripped_pale_oak_log.json | 4 + .../blocks/stripped_pale_oak_wood.json | 4 + .../loot_table/blocks/white_banner.json | 3 +- .../loot_table/blocks/yellow_banner.json | 3 +- .../loot_table/entities/creaking.json | 4 + .../entities/creaking_transient.json | 4 + data/minecraft/loot_table/entities/sheep.json | 283 + .../loot_table/entities/sheep/black.json | 10 - .../loot_table/entities/sheep/blue.json | 10 - .../loot_table/entities/sheep/brown.json | 10 - .../loot_table/entities/sheep/cyan.json | 10 - .../loot_table/entities/sheep/gray.json | 10 - .../loot_table/entities/sheep/green.json | 10 - .../loot_table/entities/sheep/light_blue.json | 10 - .../loot_table/entities/sheep/light_gray.json | 10 - .../loot_table/entities/sheep/lime.json | 10 - .../loot_table/entities/sheep/magenta.json | 10 - .../loot_table/entities/sheep/orange.json | 10 - .../loot_table/entities/sheep/pink.json | 10 - .../loot_table/entities/sheep/purple.json | 10 - .../loot_table/entities/sheep/red.json | 10 - .../loot_table/entities/sheep/white.json | 10 - .../loot_table/entities/sheep/yellow.json | 10 - .../loot_table/gameplay/armadillo_shed.json | 16 + .../loot_table/gameplay/chicken_lay.json | 16 + .../hero_of_the_village/baby_gift.json | 16 + .../hero_of_the_village/unemployed_gift.json | 16 + .../loot_table/shearing/mooshroom.json | 49 + .../loot_table/shearing/mooshroom/brown.json | 16 + .../loot_table/shearing/mooshroom/red.json | 16 + data/minecraft/loot_table/shearing/sheep.json | 289 + .../loot_table/shearing/sheep/black.json | 20 + .../loot_table/shearing/sheep/blue.json | 20 + .../loot_table/shearing/sheep/brown.json | 20 + .../loot_table/shearing/sheep/cyan.json | 20 + .../loot_table/shearing/sheep/gray.json | 20 + .../loot_table/shearing/sheep/green.json | 20 + .../loot_table/shearing/sheep/light_blue.json | 20 + .../loot_table/shearing/sheep/light_gray.json | 20 + .../loot_table/shearing/sheep/lime.json | 20 + .../loot_table/shearing/sheep/magenta.json | 20 + .../loot_table/shearing/sheep/orange.json | 20 + .../loot_table/shearing/sheep/pink.json | 20 + .../loot_table/shearing/sheep/purple.json | 20 + .../loot_table/shearing/sheep/red.json | 20 + .../loot_table/shearing/sheep/white.json | 20 + .../loot_table/shearing/sheep/yellow.json | 20 + .../loot_table/shearing/snow_golem.json | 16 + data/minecraft/painting_variant/alban.json | 8 + data/minecraft/painting_variant/aztec.json | 8 + data/minecraft/painting_variant/aztec2.json | 8 + data/minecraft/painting_variant/backyard.json | 8 + data/minecraft/painting_variant/baroque.json | 8 + data/minecraft/painting_variant/bomb.json | 8 + data/minecraft/painting_variant/bouquet.json | 8 + .../painting_variant/burning_skull.json | 8 + data/minecraft/painting_variant/bust.json | 8 + data/minecraft/painting_variant/cavebird.json | 8 + data/minecraft/painting_variant/changing.json | 8 + data/minecraft/painting_variant/cotan.json | 8 + data/minecraft/painting_variant/courbet.json | 8 + data/minecraft/painting_variant/creebet.json | 8 + .../painting_variant/donkey_kong.json | 8 + data/minecraft/painting_variant/earth.json | 4 + data/minecraft/painting_variant/endboss.json | 8 + data/minecraft/painting_variant/fern.json | 8 + data/minecraft/painting_variant/fighters.json | 8 + data/minecraft/painting_variant/finding.json | 8 + data/minecraft/painting_variant/fire.json | 4 + data/minecraft/painting_variant/graham.json | 8 + data/minecraft/painting_variant/humble.json | 8 + data/minecraft/painting_variant/kebab.json | 8 + data/minecraft/painting_variant/lowmist.json | 8 + data/minecraft/painting_variant/match.json | 8 + .../painting_variant/meditative.json | 8 + data/minecraft/painting_variant/orb.json | 8 + data/minecraft/painting_variant/owlemons.json | 8 + data/minecraft/painting_variant/passage.json | 8 + data/minecraft/painting_variant/pigscene.json | 8 + data/minecraft/painting_variant/plant.json | 8 + data/minecraft/painting_variant/pointer.json | 8 + data/minecraft/painting_variant/pond.json | 8 + data/minecraft/painting_variant/pool.json | 8 + .../painting_variant/prairie_ride.json | 8 + data/minecraft/painting_variant/sea.json | 8 + data/minecraft/painting_variant/skeleton.json | 8 + .../painting_variant/skull_and_roses.json | 8 + data/minecraft/painting_variant/stage.json | 8 + .../painting_variant/sunflowers.json | 8 + data/minecraft/painting_variant/sunset.json | 8 + data/minecraft/painting_variant/tides.json | 8 + data/minecraft/painting_variant/unpacked.json | 8 + data/minecraft/painting_variant/void.json | 8 + data/minecraft/painting_variant/wanderer.json | 8 + .../minecraft/painting_variant/wasteland.json | 8 + data/minecraft/painting_variant/water.json | 4 + data/minecraft/painting_variant/wind.json | 4 + data/minecraft/painting_variant/wither.json | 4 + data/minecraft/recipe/acacia_boat.json | 4 +- data/minecraft/recipe/acacia_button.json | 4 +- data/minecraft/recipe/acacia_chest_boat.json | 8 +- data/minecraft/recipe/acacia_door.json | 4 +- data/minecraft/recipe/acacia_fence.json | 8 +- data/minecraft/recipe/acacia_fence_gate.json | 8 +- .../minecraft/recipe/acacia_hanging_sign.json | 8 +- data/minecraft/recipe/acacia_planks.json | 4 +- .../recipe/acacia_pressure_plate.json | 4 +- data/minecraft/recipe/acacia_sign.json | 8 +- data/minecraft/recipe/acacia_slab.json | 4 +- data/minecraft/recipe/acacia_stairs.json | 4 +- data/minecraft/recipe/acacia_trapdoor.json | 4 +- data/minecraft/recipe/acacia_wood.json | 4 +- data/minecraft/recipe/activator_rail.json | 12 +- data/minecraft/recipe/amethyst_block.json | 4 +- data/minecraft/recipe/andesite.json | 8 +- data/minecraft/recipe/andesite_slab.json | 4 +- ...esite_slab_from_andesite_stonecutting.json | 4 +- data/minecraft/recipe/andesite_stairs.json | 4 +- ...ite_stairs_from_andesite_stonecutting.json | 4 +- data/minecraft/recipe/andesite_wall.json | 4 +- ...esite_wall_from_andesite_stonecutting.json | 4 +- data/minecraft/recipe/anvil.json | 8 +- data/minecraft/recipe/armor_stand.json | 8 +- data/minecraft/recipe/arrow.json | 12 +- data/minecraft/recipe/baked_potato.json | 4 +- .../baked_potato_from_campfire_cooking.json | 4 +- .../recipe/baked_potato_from_smoking.json | 4 +- data/minecraft/recipe/bamboo_block.json | 36 +- data/minecraft/recipe/bamboo_button.json | 4 +- data/minecraft/recipe/bamboo_chest_raft.json | 8 +- data/minecraft/recipe/bamboo_door.json | 4 +- data/minecraft/recipe/bamboo_fence.json | 8 +- data/minecraft/recipe/bamboo_fence_gate.json | 8 +- .../minecraft/recipe/bamboo_hanging_sign.json | 8 +- data/minecraft/recipe/bamboo_mosaic.json | 4 +- data/minecraft/recipe/bamboo_mosaic_slab.json | 4 +- .../recipe/bamboo_mosaic_stairs.json | 4 +- data/minecraft/recipe/bamboo_planks.json | 4 +- .../recipe/bamboo_pressure_plate.json | 4 +- data/minecraft/recipe/bamboo_raft.json | 4 +- data/minecraft/recipe/bamboo_sign.json | 8 +- data/minecraft/recipe/bamboo_slab.json | 4 +- data/minecraft/recipe/bamboo_stairs.json | 4 +- data/minecraft/recipe/bamboo_trapdoor.json | 4 +- data/minecraft/recipe/barrel.json | 8 +- data/minecraft/recipe/beacon.json | 12 +- data/minecraft/recipe/beehive.json | 8 +- data/minecraft/recipe/beetroot_soup.json | 28 +- data/minecraft/recipe/birch_boat.json | 4 +- data/minecraft/recipe/birch_button.json | 4 +- data/minecraft/recipe/birch_chest_boat.json | 8 +- data/minecraft/recipe/birch_door.json | 4 +- data/minecraft/recipe/birch_fence.json | 8 +- data/minecraft/recipe/birch_fence_gate.json | 8 +- data/minecraft/recipe/birch_hanging_sign.json | 8 +- data/minecraft/recipe/birch_planks.json | 4 +- .../recipe/birch_pressure_plate.json | 4 +- data/minecraft/recipe/birch_sign.json | 8 +- data/minecraft/recipe/birch_slab.json | 4 +- data/minecraft/recipe/birch_stairs.json | 4 +- data/minecraft/recipe/birch_trapdoor.json | 4 +- data/minecraft/recipe/birch_wood.json | 4 +- data/minecraft/recipe/black_banner.json | 8 +- data/minecraft/recipe/black_bed.json | 8 +- data/minecraft/recipe/black_bundle.json | 8 + data/minecraft/recipe/black_candle.json | 8 +- data/minecraft/recipe/black_carpet.json | 4 +- .../recipe/black_concrete_powder.json | 36 +- data/minecraft/recipe/black_dye.json | 4 +- .../recipe/black_dye_from_wither_rose.json | 4 +- .../recipe/black_glazed_terracotta.json | 4 +- data/minecraft/recipe/black_shulker_box.json | 8 + .../minecraft/recipe/black_stained_glass.json | 8 +- .../recipe/black_stained_glass_pane.json | 4 +- ...ck_stained_glass_pane_from_glass_pane.json | 8 +- data/minecraft/recipe/black_terracotta.json | 8 +- data/minecraft/recipe/blackstone_slab.json | 4 +- ...one_slab_from_blackstone_stonecutting.json | 4 +- data/minecraft/recipe/blackstone_stairs.json | 4 +- ...e_stairs_from_blackstone_stonecutting.json | 4 +- data/minecraft/recipe/blackstone_wall.json | 4 +- ...one_wall_from_blackstone_stonecutting.json | 4 +- data/minecraft/recipe/blast_furnace.json | 12 +- data/minecraft/recipe/blaze_powder.json | 4 +- data/minecraft/recipe/blue_banner.json | 8 +- data/minecraft/recipe/blue_bed.json | 8 +- data/minecraft/recipe/blue_bundle.json | 8 + data/minecraft/recipe/blue_candle.json | 8 +- data/minecraft/recipe/blue_carpet.json | 4 +- .../recipe/blue_concrete_powder.json | 36 +- data/minecraft/recipe/blue_dye.json | 4 +- .../recipe/blue_dye_from_cornflower.json | 4 +- .../recipe/blue_glazed_terracotta.json | 4 +- data/minecraft/recipe/blue_ice.json | 36 +- data/minecraft/recipe/blue_shulker_box.json | 8 + data/minecraft/recipe/blue_stained_glass.json | 8 +- .../recipe/blue_stained_glass_pane.json | 4 +- ...ue_stained_glass_pane_from_glass_pane.json | 8 +- data/minecraft/recipe/blue_terracotta.json | 8 +- .../bolt_armor_trim_smithing_template.json | 16 +- ..._trim_smithing_template_smithing_trim.json | 12 +- data/minecraft/recipe/bone_block.json | 4 +- data/minecraft/recipe/bone_meal.json | 4 +- .../recipe/bone_meal_from_bone_block.json | 4 +- data/minecraft/recipe/book.json | 16 +- data/minecraft/recipe/bookshelf.json | 8 +- .../bordure_indented_banner_pattern.json | 12 + data/minecraft/recipe/bow.json | 8 +- data/minecraft/recipe/bowl.json | 4 +- data/minecraft/recipe/bread.json | 4 +- data/minecraft/recipe/brewing_stand.json | 8 +- data/minecraft/recipe/brick.json | 4 +- data/minecraft/recipe/brick_slab.json | 4 +- .../brick_slab_from_bricks_stonecutting.json | 4 +- data/minecraft/recipe/brick_stairs.json | 4 +- ...brick_stairs_from_bricks_stonecutting.json | 4 +- data/minecraft/recipe/brick_wall.json | 4 +- .../brick_wall_from_bricks_stonecutting.json | 4 +- data/minecraft/recipe/bricks.json | 4 +- data/minecraft/recipe/brown_banner.json | 8 +- data/minecraft/recipe/brown_bed.json | 8 +- data/minecraft/recipe/brown_bundle.json | 8 + data/minecraft/recipe/brown_candle.json | 8 +- data/minecraft/recipe/brown_carpet.json | 4 +- .../recipe/brown_concrete_powder.json | 36 +- data/minecraft/recipe/brown_dye.json | 4 +- .../recipe/brown_glazed_terracotta.json | 4 +- data/minecraft/recipe/brown_shulker_box.json | 8 + .../minecraft/recipe/brown_stained_glass.json | 8 +- .../recipe/brown_stained_glass_pane.json | 4 +- ...wn_stained_glass_pane_from_glass_pane.json | 8 +- data/minecraft/recipe/brown_terracotta.json | 8 +- data/minecraft/recipe/brush.json | 12 +- data/minecraft/recipe/bucket.json | 4 +- .../data/minecraft => }/recipe/bundle.json | 13 +- data/minecraft/recipe/cake.json | 16 +- .../recipe/calibrated_sculk_sensor.json | 8 +- data/minecraft/recipe/campfire.json | 12 +- data/minecraft/recipe/candle.json | 8 +- data/minecraft/recipe/carrot_on_a_stick.json | 8 +- data/minecraft/recipe/cartography_table.json | 8 +- data/minecraft/recipe/cauldron.json | 4 +- data/minecraft/recipe/chain.json | 8 +- data/minecraft/recipe/charcoal.json | 4 +- data/minecraft/recipe/cherry_boat.json | 4 +- data/minecraft/recipe/cherry_button.json | 4 +- data/minecraft/recipe/cherry_chest_boat.json | 8 +- data/minecraft/recipe/cherry_door.json | 4 +- data/minecraft/recipe/cherry_fence.json | 8 +- data/minecraft/recipe/cherry_fence_gate.json | 8 +- .../minecraft/recipe/cherry_hanging_sign.json | 8 +- data/minecraft/recipe/cherry_planks.json | 4 +- .../recipe/cherry_pressure_plate.json | 4 +- data/minecraft/recipe/cherry_sign.json | 8 +- data/minecraft/recipe/cherry_slab.json | 4 +- data/minecraft/recipe/cherry_stairs.json | 4 +- data/minecraft/recipe/cherry_trapdoor.json | 4 +- data/minecraft/recipe/cherry_wood.json | 4 +- data/minecraft/recipe/chest.json | 4 +- data/minecraft/recipe/chest_minecart.json | 8 +- data/minecraft/recipe/chiseled_bookshelf.json | 8 +- data/minecraft/recipe/chiseled_copper.json | 4 +- ...copper_from_copper_block_stonecutting.json | 4 +- ...d_copper_from_cut_copper_stonecutting.json | 4 +- data/minecraft/recipe/chiseled_deepslate.json | 4 +- ...e_from_cobbled_deepslate_stonecutting.json | 4 +- .../recipe/chiseled_nether_bricks.json | 4 +- ...ricks_from_nether_bricks_stonecutting.json | 4 +- .../recipe/chiseled_polished_blackstone.json | 4 +- ...ackstone_from_blackstone_stonecutting.json | 4 +- ...from_polished_blackstone_stonecutting.json | 4 +- .../recipe/chiseled_quartz_block.json | 4 +- ..._block_from_quartz_block_stonecutting.json | 4 +- .../recipe/chiseled_red_sandstone.json | 4 +- ...stone_from_red_sandstone_stonecutting.json | 4 +- data/minecraft/recipe/chiseled_sandstone.json | 4 +- ...sandstone_from_sandstone_stonecutting.json | 4 +- .../recipe/chiseled_stone_bricks.json | 4 +- ...bricks_from_stone_bricks_stonecutting.json | 4 +- ..._stone_bricks_stone_from_stonecutting.json | 4 +- data/minecraft/recipe/chiseled_tuff.json | 4 +- .../recipe/chiseled_tuff_bricks.json | 4 +- ...ricks_from_polished_tuff_stonecutting.json | 4 +- ..._bricks_from_tuff_bricks_stonecutting.json | 4 +- ...ed_tuff_bricks_from_tuff_stonecutting.json | 4 +- .../chiseled_tuff_from_tuff_stonecutting.json | 4 +- data/minecraft/recipe/clay.json | 4 +- data/minecraft/recipe/clock.json | 8 +- data/minecraft/recipe/coal.json | 4 +- data/minecraft/recipe/coal_block.json | 4 +- .../recipe/coal_from_blasting_coal_ore.json | 4 +- ...coal_from_blasting_deepslate_coal_ore.json | 4 +- .../recipe/coal_from_smelting_coal_ore.json | 4 +- ...coal_from_smelting_deepslate_coal_ore.json | 4 +- data/minecraft/recipe/coarse_dirt.json | 8 +- .../coast_armor_trim_smithing_template.json | 12 +- ..._trim_smithing_template_smithing_trim.json | 12 +- .../recipe/cobbled_deepslate_slab.json | 4 +- ...b_from_cobbled_deepslate_stonecutting.json | 4 +- .../recipe/cobbled_deepslate_stairs.json | 4 +- ...s_from_cobbled_deepslate_stonecutting.json | 4 +- .../recipe/cobbled_deepslate_wall.json | 4 +- ...l_from_cobbled_deepslate_stonecutting.json | 4 +- data/minecraft/recipe/cobblestone_slab.json | 4 +- ...ne_slab_from_cobblestone_stonecutting.json | 4 +- data/minecraft/recipe/cobblestone_stairs.json | 4 +- ..._stairs_from_cobblestone_stonecutting.json | 4 +- data/minecraft/recipe/cobblestone_wall.json | 4 +- ...ne_wall_from_cobblestone_stonecutting.json | 4 +- data/minecraft/recipe/comparator.json | 12 +- data/minecraft/recipe/compass.json | 8 +- data/minecraft/recipe/composter.json | 4 +- data/minecraft/recipe/conduit.json | 8 +- data/minecraft/recipe/cooked_beef.json | 4 +- .../cooked_beef_from_campfire_cooking.json | 4 +- .../recipe/cooked_beef_from_smoking.json | 4 +- data/minecraft/recipe/cooked_chicken.json | 4 +- .../cooked_chicken_from_campfire_cooking.json | 4 +- .../recipe/cooked_chicken_from_smoking.json | 4 +- data/minecraft/recipe/cooked_cod.json | 4 +- .../cooked_cod_from_campfire_cooking.json | 4 +- .../recipe/cooked_cod_from_smoking.json | 4 +- data/minecraft/recipe/cooked_mutton.json | 4 +- .../cooked_mutton_from_campfire_cooking.json | 4 +- .../recipe/cooked_mutton_from_smoking.json | 4 +- data/minecraft/recipe/cooked_porkchop.json | 4 +- ...cooked_porkchop_from_campfire_cooking.json | 4 +- .../recipe/cooked_porkchop_from_smoking.json | 4 +- data/minecraft/recipe/cooked_rabbit.json | 4 +- .../cooked_rabbit_from_campfire_cooking.json | 4 +- .../recipe/cooked_rabbit_from_smoking.json | 4 +- data/minecraft/recipe/cooked_salmon.json | 4 +- .../cooked_salmon_from_campfire_cooking.json | 4 +- .../recipe/cooked_salmon_from_smoking.json | 4 +- data/minecraft/recipe/cookie.json | 8 +- data/minecraft/recipe/copper_block.json | 4 +- data/minecraft/recipe/copper_bulb.json | 12 +- data/minecraft/recipe/copper_door.json | 4 +- data/minecraft/recipe/copper_grate.json | 4 +- ..._grate_from_copper_block_stonecutting.json | 4 +- data/minecraft/recipe/copper_ingot.json | 4 +- ...copper_ingot_from_blasting_copper_ore.json | 4 +- ...ot_from_blasting_deepslate_copper_ore.json | 4 +- ...copper_ingot_from_blasting_raw_copper.json | 4 +- ...copper_ingot_from_smelting_copper_ore.json | 4 +- ...ot_from_smelting_deepslate_copper_ore.json | 4 +- ...copper_ingot_from_smelting_raw_copper.json | 4 +- .../copper_ingot_from_waxed_copper_block.json | 4 +- data/minecraft/recipe/copper_trapdoor.json | 4 +- .../recipe/cracked_deepslate_bricks.json | 4 +- .../recipe/cracked_deepslate_tiles.json | 4 +- .../recipe/cracked_nether_bricks.json | 4 +- .../cracked_polished_blackstone_bricks.json | 4 +- .../recipe/cracked_stone_bricks.json | 4 +- data/minecraft/recipe/crafter.json | 16 +- data/minecraft/recipe/crafting_table.json | 4 +- .../recipe/creeper_banner_pattern.json | 8 +- data/minecraft/recipe/crimson_button.json | 4 +- data/minecraft/recipe/crimson_door.json | 4 +- data/minecraft/recipe/crimson_fence.json | 8 +- data/minecraft/recipe/crimson_fence_gate.json | 8 +- .../recipe/crimson_hanging_sign.json | 8 +- data/minecraft/recipe/crimson_hyphae.json | 4 +- data/minecraft/recipe/crimson_planks.json | 4 +- .../recipe/crimson_pressure_plate.json | 4 +- data/minecraft/recipe/crimson_sign.json | 8 +- data/minecraft/recipe/crimson_slab.json | 4 +- data/minecraft/recipe/crimson_stairs.json | 4 +- data/minecraft/recipe/crimson_trapdoor.json | 4 +- data/minecraft/recipe/crossbow.json | 16 +- data/minecraft/recipe/cut_copper.json | 4 +- ...copper_from_copper_block_stonecutting.json | 4 +- data/minecraft/recipe/cut_copper_slab.json | 4 +- ...r_slab_from_copper_block_stonecutting.json | 4 +- ...per_slab_from_cut_copper_stonecutting.json | 4 +- data/minecraft/recipe/cut_copper_stairs.json | 4 +- ...stairs_from_copper_block_stonecutting.json | 4 +- ...r_stairs_from_cut_copper_stonecutting.json | 4 +- data/minecraft/recipe/cut_red_sandstone.json | 4 +- ...stone_from_red_sandstone_stonecutting.json | 4 +- .../recipe/cut_red_sandstone_slab.json | 4 +- ...b_from_cut_red_sandstone_stonecutting.json | 4 +- ..._slab_from_red_sandstone_stonecutting.json | 4 +- data/minecraft/recipe/cut_sandstone.json | 4 +- ...sandstone_from_sandstone_stonecutting.json | 4 +- data/minecraft/recipe/cut_sandstone_slab.json | 4 +- ..._slab_from_cut_sandstone_stonecutting.json | 4 +- ...tone_slab_from_sandstone_stonecutting.json | 4 +- data/minecraft/recipe/cyan_banner.json | 8 +- data/minecraft/recipe/cyan_bed.json | 8 +- data/minecraft/recipe/cyan_bundle.json | 8 + data/minecraft/recipe/cyan_candle.json | 8 +- data/minecraft/recipe/cyan_carpet.json | 4 +- .../recipe/cyan_concrete_powder.json | 36 +- data/minecraft/recipe/cyan_dye.json | 8 +- .../recipe/cyan_dye_from_pitcher_plant.json | 4 +- .../recipe/cyan_glazed_terracotta.json | 4 +- data/minecraft/recipe/cyan_shulker_box.json | 8 + data/minecraft/recipe/cyan_stained_glass.json | 8 +- .../recipe/cyan_stained_glass_pane.json | 4 +- ...an_stained_glass_pane_from_glass_pane.json | 8 +- data/minecraft/recipe/cyan_terracotta.json | 8 +- data/minecraft/recipe/dark_oak_boat.json | 4 +- data/minecraft/recipe/dark_oak_button.json | 4 +- .../minecraft/recipe/dark_oak_chest_boat.json | 8 +- data/minecraft/recipe/dark_oak_door.json | 4 +- data/minecraft/recipe/dark_oak_fence.json | 8 +- .../minecraft/recipe/dark_oak_fence_gate.json | 8 +- .../recipe/dark_oak_hanging_sign.json | 8 +- data/minecraft/recipe/dark_oak_planks.json | 4 +- .../recipe/dark_oak_pressure_plate.json | 4 +- data/minecraft/recipe/dark_oak_sign.json | 8 +- data/minecraft/recipe/dark_oak_slab.json | 4 +- data/minecraft/recipe/dark_oak_stairs.json | 4 +- data/minecraft/recipe/dark_oak_trapdoor.json | 4 +- data/minecraft/recipe/dark_oak_wood.json | 4 +- data/minecraft/recipe/dark_prismarine.json | 8 +- .../recipe/dark_prismarine_slab.json | 4 +- ...lab_from_dark_prismarine_stonecutting.json | 4 +- .../recipe/dark_prismarine_stairs.json | 4 +- ...irs_from_dark_prismarine_stonecutting.json | 4 +- data/minecraft/recipe/daylight_detector.json | 12 +- .../recipe/decorated_pot_simple.json | 4 +- data/minecraft/recipe/deepslate.json | 4 +- .../recipe/deepslate_brick_slab.json | 4 +- ...b_from_cobbled_deepslate_stonecutting.json | 4 +- ...ab_from_deepslate_bricks_stonecutting.json | 4 +- ..._from_polished_deepslate_stonecutting.json | 4 +- .../recipe/deepslate_brick_stairs.json | 4 +- ...s_from_cobbled_deepslate_stonecutting.json | 4 +- ...rs_from_deepslate_bricks_stonecutting.json | 4 +- ..._from_polished_deepslate_stonecutting.json | 4 +- .../recipe/deepslate_brick_wall.json | 4 +- ...l_from_cobbled_deepslate_stonecutting.json | 4 +- ...ll_from_deepslate_bricks_stonecutting.json | 4 +- ..._from_polished_deepslate_stonecutting.json | 4 +- data/minecraft/recipe/deepslate_bricks.json | 4 +- ...s_from_cobbled_deepslate_stonecutting.json | 4 +- ..._from_polished_deepslate_stonecutting.json | 4 +- .../minecraft/recipe/deepslate_tile_slab.json | 4 +- ...b_from_cobbled_deepslate_stonecutting.json | 4 +- ...ab_from_deepslate_bricks_stonecutting.json | 4 +- ...lab_from_deepslate_tiles_stonecutting.json | 4 +- ..._from_polished_deepslate_stonecutting.json | 4 +- .../recipe/deepslate_tile_stairs.json | 4 +- ...s_from_cobbled_deepslate_stonecutting.json | 4 +- ...rs_from_deepslate_bricks_stonecutting.json | 4 +- ...irs_from_deepslate_tiles_stonecutting.json | 4 +- ..._from_polished_deepslate_stonecutting.json | 4 +- .../minecraft/recipe/deepslate_tile_wall.json | 4 +- ...l_from_cobbled_deepslate_stonecutting.json | 4 +- ...ll_from_deepslate_bricks_stonecutting.json | 4 +- ...all_from_deepslate_tiles_stonecutting.json | 4 +- ..._from_polished_deepslate_stonecutting.json | 4 +- data/minecraft/recipe/deepslate_tiles.json | 4 +- ...s_from_cobbled_deepslate_stonecutting.json | 4 +- ...es_from_deepslate_bricks_stonecutting.json | 4 +- ..._from_polished_deepslate_stonecutting.json | 4 +- data/minecraft/recipe/detector_rail.json | 12 +- data/minecraft/recipe/diamond.json | 4 +- data/minecraft/recipe/diamond_axe.json | 8 +- data/minecraft/recipe/diamond_block.json | 4 +- data/minecraft/recipe/diamond_boots.json | 4 +- data/minecraft/recipe/diamond_chestplate.json | 4 +- ...d_from_blasting_deepslate_diamond_ore.json | 4 +- .../diamond_from_blasting_diamond_ore.json | 4 +- ...d_from_smelting_deepslate_diamond_ore.json | 4 +- .../diamond_from_smelting_diamond_ore.json | 4 +- data/minecraft/recipe/diamond_helmet.json | 4 +- data/minecraft/recipe/diamond_hoe.json | 8 +- data/minecraft/recipe/diamond_leggings.json | 4 +- data/minecraft/recipe/diamond_pickaxe.json | 8 +- data/minecraft/recipe/diamond_shovel.json | 8 +- data/minecraft/recipe/diamond_sword.json | 8 +- data/minecraft/recipe/diorite.json | 8 +- data/minecraft/recipe/diorite_slab.json | 4 +- ...iorite_slab_from_diorite_stonecutting.json | 4 +- data/minecraft/recipe/diorite_stairs.json | 4 +- ...rite_stairs_from_diorite_stonecutting.json | 4 +- data/minecraft/recipe/diorite_wall.json | 4 +- ...iorite_wall_from_diorite_stonecutting.json | 4 +- data/minecraft/recipe/dispenser.json | 12 +- data/minecraft/recipe/dried_kelp.json | 4 +- data/minecraft/recipe/dried_kelp_block.json | 4 +- .../dried_kelp_from_campfire_cooking.json | 4 +- .../recipe/dried_kelp_from_smelting.json | 4 +- .../recipe/dried_kelp_from_smoking.json | 4 +- data/minecraft/recipe/dripstone_block.json | 4 +- data/minecraft/recipe/dropper.json | 8 +- .../dune_armor_trim_smithing_template.json | 12 +- ..._trim_smithing_template_smithing_trim.json | 12 +- data/minecraft/recipe/dye_black_bed.json | 64 +- data/minecraft/recipe/dye_black_carpet.json | 64 +- data/minecraft/recipe/dye_black_wool.json | 64 +- data/minecraft/recipe/dye_blue_bed.json | 64 +- data/minecraft/recipe/dye_blue_carpet.json | 64 +- data/minecraft/recipe/dye_blue_wool.json | 64 +- data/minecraft/recipe/dye_brown_bed.json | 64 +- data/minecraft/recipe/dye_brown_carpet.json | 64 +- data/minecraft/recipe/dye_brown_wool.json | 64 +- data/minecraft/recipe/dye_cyan_bed.json | 64 +- data/minecraft/recipe/dye_cyan_carpet.json | 64 +- data/minecraft/recipe/dye_cyan_wool.json | 64 +- data/minecraft/recipe/dye_gray_bed.json | 64 +- data/minecraft/recipe/dye_gray_carpet.json | 64 +- data/minecraft/recipe/dye_gray_wool.json | 64 +- data/minecraft/recipe/dye_green_bed.json | 64 +- data/minecraft/recipe/dye_green_carpet.json | 64 +- data/minecraft/recipe/dye_green_wool.json | 64 +- data/minecraft/recipe/dye_light_blue_bed.json | 64 +- .../recipe/dye_light_blue_carpet.json | 64 +- .../minecraft/recipe/dye_light_blue_wool.json | 64 +- data/minecraft/recipe/dye_light_gray_bed.json | 64 +- .../recipe/dye_light_gray_carpet.json | 64 +- .../minecraft/recipe/dye_light_gray_wool.json | 64 +- data/minecraft/recipe/dye_lime_bed.json | 64 +- data/minecraft/recipe/dye_lime_carpet.json | 64 +- data/minecraft/recipe/dye_lime_wool.json | 64 +- data/minecraft/recipe/dye_magenta_bed.json | 64 +- data/minecraft/recipe/dye_magenta_carpet.json | 64 +- data/minecraft/recipe/dye_magenta_wool.json | 64 +- data/minecraft/recipe/dye_orange_bed.json | 64 +- data/minecraft/recipe/dye_orange_carpet.json | 64 +- data/minecraft/recipe/dye_orange_wool.json | 64 +- data/minecraft/recipe/dye_pink_bed.json | 64 +- data/minecraft/recipe/dye_pink_carpet.json | 64 +- data/minecraft/recipe/dye_pink_wool.json | 64 +- data/minecraft/recipe/dye_purple_bed.json | 64 +- data/minecraft/recipe/dye_purple_carpet.json | 64 +- data/minecraft/recipe/dye_purple_wool.json | 64 +- data/minecraft/recipe/dye_red_bed.json | 64 +- data/minecraft/recipe/dye_red_carpet.json | 64 +- data/minecraft/recipe/dye_red_wool.json | 64 +- data/minecraft/recipe/dye_white_bed.json | 64 +- data/minecraft/recipe/dye_white_carpet.json | 64 +- data/minecraft/recipe/dye_white_wool.json | 64 +- data/minecraft/recipe/dye_yellow_bed.json | 64 +- data/minecraft/recipe/dye_yellow_carpet.json | 64 +- data/minecraft/recipe/dye_yellow_wool.json | 64 +- data/minecraft/recipe/emerald.json | 4 +- data/minecraft/recipe/emerald_block.json | 4 +- ...d_from_blasting_deepslate_emerald_ore.json | 4 +- .../emerald_from_blasting_emerald_ore.json | 4 +- ...d_from_smelting_deepslate_emerald_ore.json | 4 +- .../emerald_from_smelting_emerald_ore.json | 4 +- data/minecraft/recipe/enchanting_table.json | 12 +- data/minecraft/recipe/end_crystal.json | 12 +- data/minecraft/recipe/end_rod.json | 8 +- .../recipe/end_stone_brick_slab.json | 4 +- ...lab_from_end_stone_brick_stonecutting.json | 4 +- ...rick_slab_from_end_stone_stonecutting.json | 4 +- .../recipe/end_stone_brick_stairs.json | 4 +- ...irs_from_end_stone_brick_stonecutting.json | 4 +- ...ck_stairs_from_end_stone_stonecutting.json | 4 +- .../recipe/end_stone_brick_wall.json | 4 +- ...all_from_end_stone_brick_stonecutting.json | 4 +- ...rick_wall_from_end_stone_stonecutting.json | 4 +- data/minecraft/recipe/end_stone_bricks.json | 4 +- ...ne_bricks_from_end_stone_stonecutting.json | 4 +- data/minecraft/recipe/ender_chest.json | 8 +- data/minecraft/recipe/ender_eye.json | 8 +- .../recipe/exposed_chiseled_copper.json | 4 +- ...pper_from_exposed_copper_stonecutting.json | 4 +- ..._from_exposed_cut_copper_stonecutting.json | 4 +- .../minecraft/recipe/exposed_copper_bulb.json | 12 +- .../recipe/exposed_copper_grate.json | 4 +- ...rate_from_exposed_copper_stonecutting.json | 4 +- data/minecraft/recipe/exposed_cut_copper.json | 4 +- ...pper_from_exposed_copper_stonecutting.json | 4 +- .../recipe/exposed_cut_copper_slab.json | 4 +- ...slab_from_exposed_copper_stonecutting.json | 4 +- ..._from_exposed_cut_copper_stonecutting.json | 4 +- .../recipe/exposed_cut_copper_stairs.json | 4 +- ...airs_from_exposed_copper_stonecutting.json | 4 +- ..._from_exposed_cut_copper_stonecutting.json | 4 +- .../eye_armor_trim_smithing_template.json | 12 +- ..._trim_smithing_template_smithing_trim.json | 12 +- .../recipe/fermented_spider_eye.json | 12 +- .../recipe/field_masoned_banner_pattern.json | 12 + data/minecraft/recipe/fire_charge.json | 16 +- .../recipe/firework_rocket_simple.json | 8 +- data/minecraft/recipe/fishing_rod.json | 8 +- data/minecraft/recipe/fletching_table.json | 8 +- data/minecraft/recipe/flint_and_steel.json | 8 +- .../flow_armor_trim_smithing_template.json | 12 +- ..._trim_smithing_template_smithing_trim.json | 12 +- .../recipe/flower_banner_pattern.json | 8 +- data/minecraft/recipe/flower_pot.json | 4 +- data/minecraft/recipe/furnace.json | 4 +- data/minecraft/recipe/furnace_minecart.json | 8 +- data/minecraft/recipe/glass.json | 4 +- data/minecraft/recipe/glass_bottle.json | 4 +- data/minecraft/recipe/glass_pane.json | 4 +- .../recipe/glistering_melon_slice.json | 8 +- data/minecraft/recipe/glow_item_frame.json | 8 +- data/minecraft/recipe/glowstone.json | 4 +- data/minecraft/recipe/gold_block.json | 4 +- ...ngot_from_blasting_deepslate_gold_ore.json | 4 +- .../gold_ingot_from_blasting_gold_ore.json | 4 +- ...d_ingot_from_blasting_nether_gold_ore.json | 4 +- .../gold_ingot_from_blasting_raw_gold.json | 4 +- .../recipe/gold_ingot_from_gold_block.json | 4 +- .../recipe/gold_ingot_from_nuggets.json | 4 +- ...ngot_from_smelting_deepslate_gold_ore.json | 4 +- .../gold_ingot_from_smelting_gold_ore.json | 4 +- ...d_ingot_from_smelting_nether_gold_ore.json | 4 +- .../gold_ingot_from_smelting_raw_gold.json | 4 +- data/minecraft/recipe/gold_nugget.json | 4 +- .../recipe/gold_nugget_from_blasting.json | 40 +- .../recipe/gold_nugget_from_smelting.json | 40 +- data/minecraft/recipe/golden_apple.json | 8 +- data/minecraft/recipe/golden_axe.json | 8 +- data/minecraft/recipe/golden_boots.json | 4 +- data/minecraft/recipe/golden_carrot.json | 8 +- data/minecraft/recipe/golden_chestplate.json | 4 +- data/minecraft/recipe/golden_helmet.json | 4 +- data/minecraft/recipe/golden_hoe.json | 8 +- data/minecraft/recipe/golden_leggings.json | 4 +- data/minecraft/recipe/golden_pickaxe.json | 8 +- data/minecraft/recipe/golden_shovel.json | 8 +- data/minecraft/recipe/golden_sword.json | 8 +- data/minecraft/recipe/granite.json | 8 +- data/minecraft/recipe/granite_slab.json | 4 +- ...ranite_slab_from_granite_stonecutting.json | 4 +- data/minecraft/recipe/granite_stairs.json | 4 +- ...nite_stairs_from_granite_stonecutting.json | 4 +- data/minecraft/recipe/granite_wall.json | 4 +- ...ranite_wall_from_granite_stonecutting.json | 4 +- data/minecraft/recipe/gray_banner.json | 8 +- data/minecraft/recipe/gray_bed.json | 8 +- data/minecraft/recipe/gray_bundle.json | 8 + data/minecraft/recipe/gray_candle.json | 8 +- data/minecraft/recipe/gray_carpet.json | 4 +- .../recipe/gray_concrete_powder.json | 36 +- data/minecraft/recipe/gray_dye.json | 8 +- .../recipe/gray_glazed_terracotta.json | 4 +- data/minecraft/recipe/gray_shulker_box.json | 8 + data/minecraft/recipe/gray_stained_glass.json | 8 +- .../recipe/gray_stained_glass_pane.json | 4 +- ...ay_stained_glass_pane_from_glass_pane.json | 8 +- data/minecraft/recipe/gray_terracotta.json | 8 +- data/minecraft/recipe/green_banner.json | 8 +- data/minecraft/recipe/green_bed.json | 8 +- data/minecraft/recipe/green_bundle.json | 8 + data/minecraft/recipe/green_candle.json | 8 +- data/minecraft/recipe/green_carpet.json | 4 +- .../recipe/green_concrete_powder.json | 36 +- data/minecraft/recipe/green_dye.json | 4 +- .../recipe/green_glazed_terracotta.json | 4 +- data/minecraft/recipe/green_shulker_box.json | 8 + .../minecraft/recipe/green_stained_glass.json | 8 +- .../recipe/green_stained_glass_pane.json | 4 +- ...en_stained_glass_pane_from_glass_pane.json | 8 +- data/minecraft/recipe/green_terracotta.json | 8 +- data/minecraft/recipe/grindstone.json | 12 +- data/minecraft/recipe/hay_block.json | 36 +- .../recipe/heavy_weighted_pressure_plate.json | 4 +- data/minecraft/recipe/honey_block.json | 4 +- data/minecraft/recipe/honey_bottle.json | 20 +- data/minecraft/recipe/honeycomb_block.json | 4 +- data/minecraft/recipe/hopper.json | 8 +- data/minecraft/recipe/hopper_minecart.json | 8 +- .../host_armor_trim_smithing_template.json | 12 +- ..._trim_smithing_template_smithing_trim.json | 12 +- data/minecraft/recipe/iron_axe.json | 8 +- data/minecraft/recipe/iron_bars.json | 4 +- data/minecraft/recipe/iron_block.json | 4 +- data/minecraft/recipe/iron_boots.json | 4 +- data/minecraft/recipe/iron_chestplate.json | 4 +- data/minecraft/recipe/iron_door.json | 4 +- data/minecraft/recipe/iron_helmet.json | 4 +- data/minecraft/recipe/iron_hoe.json | 8 +- ...ngot_from_blasting_deepslate_iron_ore.json | 4 +- .../iron_ingot_from_blasting_iron_ore.json | 4 +- .../iron_ingot_from_blasting_raw_iron.json | 4 +- .../recipe/iron_ingot_from_iron_block.json | 4 +- .../recipe/iron_ingot_from_nuggets.json | 4 +- ...ngot_from_smelting_deepslate_iron_ore.json | 4 +- .../iron_ingot_from_smelting_iron_ore.json | 4 +- .../iron_ingot_from_smelting_raw_iron.json | 4 +- data/minecraft/recipe/iron_leggings.json | 4 +- data/minecraft/recipe/iron_nugget.json | 4 +- .../recipe/iron_nugget_from_blasting.json | 56 +- .../recipe/iron_nugget_from_smelting.json | 56 +- data/minecraft/recipe/iron_pickaxe.json | 8 +- data/minecraft/recipe/iron_shovel.json | 8 +- data/minecraft/recipe/iron_sword.json | 8 +- data/minecraft/recipe/iron_trapdoor.json | 4 +- data/minecraft/recipe/item_frame.json | 8 +- data/minecraft/recipe/jack_o_lantern.json | 8 +- data/minecraft/recipe/jukebox.json | 8 +- data/minecraft/recipe/jungle_boat.json | 4 +- data/minecraft/recipe/jungle_button.json | 4 +- data/minecraft/recipe/jungle_chest_boat.json | 8 +- data/minecraft/recipe/jungle_door.json | 4 +- data/minecraft/recipe/jungle_fence.json | 8 +- data/minecraft/recipe/jungle_fence_gate.json | 8 +- .../minecraft/recipe/jungle_hanging_sign.json | 8 +- data/minecraft/recipe/jungle_planks.json | 4 +- .../recipe/jungle_pressure_plate.json | 4 +- data/minecraft/recipe/jungle_sign.json | 8 +- data/minecraft/recipe/jungle_slab.json | 4 +- data/minecraft/recipe/jungle_stairs.json | 4 +- data/minecraft/recipe/jungle_trapdoor.json | 4 +- data/minecraft/recipe/jungle_wood.json | 4 +- data/minecraft/recipe/ladder.json | 4 +- data/minecraft/recipe/lantern.json | 8 +- data/minecraft/recipe/lapis_block.json | 4 +- data/minecraft/recipe/lapis_lazuli.json | 4 +- ...uli_from_blasting_deepslate_lapis_ore.json | 4 +- .../lapis_lazuli_from_blasting_lapis_ore.json | 4 +- ...uli_from_smelting_deepslate_lapis_ore.json | 4 +- .../lapis_lazuli_from_smelting_lapis_ore.json | 4 +- data/minecraft/recipe/lead.json | 8 +- data/minecraft/recipe/leather.json | 4 +- data/minecraft/recipe/leather_boots.json | 4 +- data/minecraft/recipe/leather_chestplate.json | 4 +- data/minecraft/recipe/leather_helmet.json | 4 +- .../minecraft/recipe/leather_horse_armor.json | 4 +- data/minecraft/recipe/leather_leggings.json | 4 +- data/minecraft/recipe/lectern.json | 8 +- data/minecraft/recipe/lever.json | 8 +- data/minecraft/recipe/light_blue_banner.json | 8 +- data/minecraft/recipe/light_blue_bed.json | 8 +- data/minecraft/recipe/light_blue_bundle.json | 8 + data/minecraft/recipe/light_blue_candle.json | 8 +- data/minecraft/recipe/light_blue_carpet.json | 4 +- .../recipe/light_blue_concrete_powder.json | 36 +- .../light_blue_dye_from_blue_orchid.json | 4 +- .../light_blue_dye_from_blue_white_dye.json | 8 +- .../recipe/light_blue_glazed_terracotta.json | 4 +- .../recipe/light_blue_shulker_box.json | 8 + .../recipe/light_blue_stained_glass.json | 8 +- .../recipe/light_blue_stained_glass_pane.json | 4 +- ...ue_stained_glass_pane_from_glass_pane.json | 8 +- .../recipe/light_blue_terracotta.json | 8 +- data/minecraft/recipe/light_gray_banner.json | 8 +- data/minecraft/recipe/light_gray_bed.json | 8 +- data/minecraft/recipe/light_gray_bundle.json | 8 + data/minecraft/recipe/light_gray_candle.json | 8 +- data/minecraft/recipe/light_gray_carpet.json | 4 +- .../recipe/light_gray_concrete_powder.json | 36 +- .../light_gray_dye_from_azure_bluet.json | 4 +- .../light_gray_dye_from_black_white_dye.json | 12 +- .../light_gray_dye_from_gray_white_dye.json | 8 +- .../light_gray_dye_from_oxeye_daisy.json | 4 +- .../light_gray_dye_from_white_tulip.json | 4 +- .../recipe/light_gray_glazed_terracotta.json | 4 +- .../recipe/light_gray_shulker_box.json | 8 + .../recipe/light_gray_stained_glass.json | 8 +- .../recipe/light_gray_stained_glass_pane.json | 4 +- ...ay_stained_glass_pane_from_glass_pane.json | 8 +- .../recipe/light_gray_terracotta.json | 8 +- .../recipe/light_weighted_pressure_plate.json | 4 +- data/minecraft/recipe/lightning_rod.json | 4 +- data/minecraft/recipe/lime_banner.json | 8 +- data/minecraft/recipe/lime_bed.json | 8 +- data/minecraft/recipe/lime_bundle.json | 8 + data/minecraft/recipe/lime_candle.json | 8 +- data/minecraft/recipe/lime_carpet.json | 4 +- .../recipe/lime_concrete_powder.json | 36 +- data/minecraft/recipe/lime_dye.json | 8 +- .../recipe/lime_dye_from_smelting.json | 4 +- .../recipe/lime_glazed_terracotta.json | 4 +- data/minecraft/recipe/lime_shulker_box.json | 8 + data/minecraft/recipe/lime_stained_glass.json | 8 +- .../recipe/lime_stained_glass_pane.json | 4 +- ...me_stained_glass_pane_from_glass_pane.json | 8 +- data/minecraft/recipe/lime_terracotta.json | 8 +- data/minecraft/recipe/lodestone.json | 8 +- data/minecraft/recipe/loom.json | 8 +- data/minecraft/recipe/mace.json | 8 +- data/minecraft/recipe/magenta_banner.json | 8 +- data/minecraft/recipe/magenta_bed.json | 8 +- data/minecraft/recipe/magenta_bundle.json | 8 + data/minecraft/recipe/magenta_candle.json | 8 +- data/minecraft/recipe/magenta_carpet.json | 4 +- .../recipe/magenta_concrete_powder.json | 36 +- .../recipe/magenta_dye_from_allium.json | 4 +- .../magenta_dye_from_blue_red_pink.json | 12 +- .../magenta_dye_from_blue_red_white_dye.json | 16 +- .../recipe/magenta_dye_from_lilac.json | 4 +- .../magenta_dye_from_purple_and_pink.json | 8 +- .../recipe/magenta_glazed_terracotta.json | 4 +- .../minecraft/recipe/magenta_shulker_box.json | 8 + .../recipe/magenta_stained_glass.json | 8 +- .../recipe/magenta_stained_glass_pane.json | 4 +- ...ta_stained_glass_pane_from_glass_pane.json | 8 +- data/minecraft/recipe/magenta_terracotta.json | 8 +- data/minecraft/recipe/magma_block.json | 4 +- data/minecraft/recipe/magma_cream.json | 8 +- data/minecraft/recipe/mangrove_boat.json | 4 +- data/minecraft/recipe/mangrove_button.json | 4 +- .../minecraft/recipe/mangrove_chest_boat.json | 8 +- data/minecraft/recipe/mangrove_door.json | 4 +- data/minecraft/recipe/mangrove_fence.json | 8 +- .../minecraft/recipe/mangrove_fence_gate.json | 8 +- .../recipe/mangrove_hanging_sign.json | 8 +- data/minecraft/recipe/mangrove_planks.json | 4 +- .../recipe/mangrove_pressure_plate.json | 4 +- data/minecraft/recipe/mangrove_sign.json | 8 +- data/minecraft/recipe/mangrove_slab.json | 4 +- data/minecraft/recipe/mangrove_stairs.json | 4 +- data/minecraft/recipe/mangrove_trapdoor.json | 4 +- data/minecraft/recipe/mangrove_wood.json | 4 +- data/minecraft/recipe/map.json | 8 +- data/minecraft/recipe/melon.json | 36 +- data/minecraft/recipe/melon_seeds.json | 4 +- data/minecraft/recipe/minecart.json | 4 +- .../recipe/mojang_banner_pattern.json | 8 +- data/minecraft/recipe/moss_carpet.json | 4 +- .../mossy_cobblestone_from_moss_block.json | 8 +- .../recipe/mossy_cobblestone_from_vine.json | 8 +- .../recipe/mossy_cobblestone_slab.json | 4 +- ...b_from_mossy_cobblestone_stonecutting.json | 4 +- .../recipe/mossy_cobblestone_stairs.json | 4 +- ...s_from_mossy_cobblestone_stonecutting.json | 4 +- .../recipe/mossy_cobblestone_wall.json | 4 +- ...l_from_mossy_cobblestone_stonecutting.json | 4 +- .../recipe/mossy_stone_brick_slab.json | 4 +- ...b_from_mossy_stone_brick_stonecutting.json | 4 +- .../recipe/mossy_stone_brick_stairs.json | 4 +- ...s_from_mossy_stone_brick_stonecutting.json | 4 +- .../recipe/mossy_stone_brick_wall.json | 4 +- ...l_from_mossy_stone_brick_stonecutting.json | 4 +- .../mossy_stone_bricks_from_moss_block.json | 8 +- .../recipe/mossy_stone_bricks_from_vine.json | 8 +- data/minecraft/recipe/mud_brick_slab.json | 4 +- ...ick_slab_from_mud_bricks_stonecutting.json | 4 +- data/minecraft/recipe/mud_brick_stairs.json | 4 +- ...k_stairs_from_mud_bricks_stonecutting.json | 4 +- data/minecraft/recipe/mud_brick_wall.json | 4 +- ...ick_wall_from_mud_bricks_stonecutting.json | 4 +- data/minecraft/recipe/mud_bricks.json | 4 +- .../recipe/muddy_mangrove_roots.json | 8 +- data/minecraft/recipe/mushroom_stew.json | 12 +- data/minecraft/recipe/music_disc_5.json | 36 +- data/minecraft/recipe/nether_brick.json | 4 +- data/minecraft/recipe/nether_brick_fence.json | 8 +- data/minecraft/recipe/nether_brick_slab.json | 4 +- ..._slab_from_nether_bricks_stonecutting.json | 4 +- .../minecraft/recipe/nether_brick_stairs.json | 4 +- ...tairs_from_nether_bricks_stonecutting.json | 4 +- data/minecraft/recipe/nether_brick_wall.json | 4 +- ..._wall_from_nether_bricks_stonecutting.json | 4 +- data/minecraft/recipe/nether_bricks.json | 4 +- data/minecraft/recipe/nether_wart_block.json | 36 +- .../recipe/netherite_axe_smithing.json | 12 +- data/minecraft/recipe/netherite_block.json | 4 +- .../recipe/netherite_boots_smithing.json | 12 +- .../recipe/netherite_chestplate_smithing.json | 12 +- .../recipe/netherite_helmet_smithing.json | 12 +- .../recipe/netherite_hoe_smithing.json | 12 +- data/minecraft/recipe/netherite_ingot.json | 32 +- .../netherite_ingot_from_netherite_block.json | 4 +- .../recipe/netherite_leggings_smithing.json | 12 +- .../recipe/netherite_pickaxe_smithing.json | 12 +- data/minecraft/recipe/netherite_scrap.json | 4 +- .../recipe/netherite_scrap_from_blasting.json | 4 +- .../recipe/netherite_shovel_smithing.json | 12 +- .../recipe/netherite_sword_smithing.json | 12 +- .../netherite_upgrade_smithing_template.json | 12 +- data/minecraft/recipe/note_block.json | 8 +- data/minecraft/recipe/oak_boat.json | 4 +- data/minecraft/recipe/oak_button.json | 4 +- data/minecraft/recipe/oak_chest_boat.json | 8 +- data/minecraft/recipe/oak_door.json | 4 +- data/minecraft/recipe/oak_fence.json | 8 +- data/minecraft/recipe/oak_fence_gate.json | 8 +- data/minecraft/recipe/oak_hanging_sign.json | 8 +- data/minecraft/recipe/oak_planks.json | 4 +- data/minecraft/recipe/oak_pressure_plate.json | 4 +- data/minecraft/recipe/oak_sign.json | 8 +- data/minecraft/recipe/oak_slab.json | 4 +- data/minecraft/recipe/oak_stairs.json | 4 +- data/minecraft/recipe/oak_trapdoor.json | 4 +- data/minecraft/recipe/oak_wood.json | 4 +- data/minecraft/recipe/observer.json | 12 +- data/minecraft/recipe/orange_banner.json | 8 +- data/minecraft/recipe/orange_bed.json | 8 +- data/minecraft/recipe/orange_bundle.json | 8 + data/minecraft/recipe/orange_candle.json | 8 +- data/minecraft/recipe/orange_carpet.json | 4 +- .../recipe/orange_concrete_powder.json | 36 +- .../recipe/orange_dye_from_orange_tulip.json | 4 +- .../recipe/orange_dye_from_red_yellow.json | 8 +- .../recipe/orange_dye_from_torchflower.json | 4 +- .../recipe/orange_glazed_terracotta.json | 4 +- data/minecraft/recipe/orange_shulker_box.json | 8 + .../recipe/orange_stained_glass.json | 8 +- .../recipe/orange_stained_glass_pane.json | 4 +- ...ge_stained_glass_pane_from_glass_pane.json | 8 +- data/minecraft/recipe/orange_terracotta.json | 8 +- .../recipe/oxidized_chiseled_copper.json | 4 +- ...per_from_oxidized_copper_stonecutting.json | 4 +- ...from_oxidized_cut_copper_stonecutting.json | 4 +- .../recipe/oxidized_copper_bulb.json | 12 +- .../recipe/oxidized_copper_grate.json | 4 +- ...ate_from_oxidized_copper_stonecutting.json | 4 +- .../minecraft/recipe/oxidized_cut_copper.json | 4 +- ...per_from_oxidized_copper_stonecutting.json | 4 +- .../recipe/oxidized_cut_copper_slab.json | 4 +- ...lab_from_oxidized_copper_stonecutting.json | 4 +- ...from_oxidized_cut_copper_stonecutting.json | 4 +- .../recipe/oxidized_cut_copper_stairs.json | 4 +- ...irs_from_oxidized_copper_stonecutting.json | 4 +- ...from_oxidized_cut_copper_stonecutting.json | 4 +- data/minecraft/recipe/packed_ice.json | 36 +- data/minecraft/recipe/packed_mud.json | 8 +- data/minecraft/recipe/painting.json | 8 +- data/minecraft/recipe/paper.json | 4 +- data/minecraft/recipe/pink_banner.json | 8 +- data/minecraft/recipe/pink_bed.json | 8 +- data/minecraft/recipe/pink_bundle.json | 8 + data/minecraft/recipe/pink_candle.json | 8 +- data/minecraft/recipe/pink_carpet.json | 4 +- .../recipe/pink_concrete_powder.json | 36 +- .../minecraft/recipe/pink_dye_from_peony.json | 4 +- .../recipe/pink_dye_from_pink_petals.json | 4 +- .../recipe/pink_dye_from_pink_tulip.json | 4 +- .../recipe/pink_dye_from_red_white_dye.json | 8 +- .../recipe/pink_glazed_terracotta.json | 4 +- data/minecraft/recipe/pink_shulker_box.json | 8 + data/minecraft/recipe/pink_stained_glass.json | 8 +- .../recipe/pink_stained_glass_pane.json | 4 +- ...nk_stained_glass_pane_from_glass_pane.json | 8 +- data/minecraft/recipe/pink_terracotta.json | 8 +- data/minecraft/recipe/piston.json | 16 +- data/minecraft/recipe/polished_andesite.json | 4 +- ...d_andesite_from_andesite_stonecutting.json | 4 +- .../recipe/polished_andesite_slab.json | 4 +- ...esite_slab_from_andesite_stonecutting.json | 4 +- ...b_from_polished_andesite_stonecutting.json | 4 +- .../recipe/polished_andesite_stairs.json | 4 +- ...ite_stairs_from_andesite_stonecutting.json | 4 +- ...s_from_polished_andesite_stonecutting.json | 4 +- data/minecraft/recipe/polished_basalt.json | 4 +- ...ished_basalt_from_basalt_stonecutting.json | 4 +- .../minecraft/recipe/polished_blackstone.json | 4 +- .../polished_blackstone_brick_slab.json | 4 +- ...ick_slab_from_blackstone_stonecutting.json | 4 +- ...lished_blackstone_bricks_stonecutting.json | 4 +- ...from_polished_blackstone_stonecutting.json | 4 +- .../polished_blackstone_brick_stairs.json | 4 +- ...k_stairs_from_blackstone_stonecutting.json | 4 +- ...lished_blackstone_bricks_stonecutting.json | 4 +- ...from_polished_blackstone_stonecutting.json | 4 +- .../polished_blackstone_brick_wall.json | 4 +- ...ick_wall_from_blackstone_stonecutting.json | 4 +- ...lished_blackstone_bricks_stonecutting.json | 4 +- ...from_polished_blackstone_stonecutting.json | 4 +- .../recipe/polished_blackstone_bricks.json | 4 +- ...e_bricks_from_blackstone_stonecutting.json | 4 +- ...from_polished_blackstone_stonecutting.json | 4 +- .../recipe/polished_blackstone_button.json | 4 +- ...ackstone_from_blackstone_stonecutting.json | 4 +- .../polished_blackstone_pressure_plate.json | 4 +- .../recipe/polished_blackstone_slab.json | 4 +- ...one_slab_from_blackstone_stonecutting.json | 4 +- ...from_polished_blackstone_stonecutting.json | 4 +- .../recipe/polished_blackstone_stairs.json | 4 +- ...e_stairs_from_blackstone_stonecutting.json | 4 +- ...from_polished_blackstone_stonecutting.json | 4 +- .../recipe/polished_blackstone_wall.json | 4 +- ...one_wall_from_blackstone_stonecutting.json | 4 +- ...from_polished_blackstone_stonecutting.json | 4 +- data/minecraft/recipe/polished_deepslate.json | 4 +- ...e_from_cobbled_deepslate_stonecutting.json | 4 +- .../recipe/polished_deepslate_slab.json | 4 +- ...b_from_cobbled_deepslate_stonecutting.json | 4 +- ..._from_polished_deepslate_stonecutting.json | 4 +- .../recipe/polished_deepslate_stairs.json | 4 +- ...s_from_cobbled_deepslate_stonecutting.json | 4 +- ..._from_polished_deepslate_stonecutting.json | 4 +- .../recipe/polished_deepslate_wall.json | 4 +- ...l_from_cobbled_deepslate_stonecutting.json | 4 +- ..._from_polished_deepslate_stonecutting.json | 4 +- data/minecraft/recipe/polished_diorite.json | 4 +- ...hed_diorite_from_diorite_stonecutting.json | 4 +- .../recipe/polished_diorite_slab.json | 4 +- ...iorite_slab_from_diorite_stonecutting.json | 4 +- ...ab_from_polished_diorite_stonecutting.json | 4 +- .../recipe/polished_diorite_stairs.json | 4 +- ...rite_stairs_from_diorite_stonecutting.json | 4 +- ...rs_from_polished_diorite_stonecutting.json | 4 +- data/minecraft/recipe/polished_granite.json | 4 +- ...hed_granite_from_granite_stonecutting.json | 4 +- .../recipe/polished_granite_slab.json | 4 +- ...ranite_slab_from_granite_stonecutting.json | 4 +- ...ab_from_polished_granite_stonecutting.json | 4 +- .../recipe/polished_granite_stairs.json | 4 +- ...nite_stairs_from_granite_stonecutting.json | 4 +- ...rs_from_polished_granite_stonecutting.json | 4 +- data/minecraft/recipe/polished_tuff.json | 4 +- .../polished_tuff_from_tuff_stonecutting.json | 4 +- data/minecraft/recipe/polished_tuff_slab.json | 4 +- ..._slab_from_polished_tuff_stonecutting.json | 4 +- ...shed_tuff_slab_from_tuff_stonecutting.json | 4 +- .../recipe/polished_tuff_stairs.json | 4 +- ...tairs_from_polished_tuff_stonecutting.json | 4 +- ...ed_tuff_stairs_from_tuff_stonecutting.json | 4 +- data/minecraft/recipe/polished_tuff_wall.json | 4 +- ..._wall_from_polished_tuff_stonecutting.json | 4 +- ...shed_tuff_wall_from_tuff_stonecutting.json | 4 +- .../minecraft/recipe/popped_chorus_fruit.json | 4 +- data/minecraft/recipe/powered_rail.json | 12 +- data/minecraft/recipe/prismarine.json | 4 +- .../recipe/prismarine_brick_slab.json | 4 +- ...ick_slab_from_prismarine_stonecutting.json | 4 +- .../recipe/prismarine_brick_stairs.json | 4 +- ...k_stairs_from_prismarine_stonecutting.json | 4 +- data/minecraft/recipe/prismarine_bricks.json | 36 +- data/minecraft/recipe/prismarine_slab.json | 4 +- ...ine_slab_from_prismarine_stonecutting.json | 4 +- data/minecraft/recipe/prismarine_stairs.json | 4 +- ...e_stairs_from_prismarine_stonecutting.json | 4 +- data/minecraft/recipe/prismarine_wall.json | 4 +- ...ine_wall_from_prismarine_stonecutting.json | 4 +- data/minecraft/recipe/pumpkin_pie.json | 12 +- data/minecraft/recipe/pumpkin_seeds.json | 4 +- data/minecraft/recipe/purple_banner.json | 8 +- data/minecraft/recipe/purple_bed.json | 8 +- data/minecraft/recipe/purple_bundle.json | 8 + data/minecraft/recipe/purple_candle.json | 8 +- data/minecraft/recipe/purple_carpet.json | 4 +- .../recipe/purple_concrete_powder.json | 36 +- data/minecraft/recipe/purple_dye.json | 8 +- .../recipe/purple_glazed_terracotta.json | 4 +- data/minecraft/recipe/purple_shulker_box.json | 8 + .../recipe/purple_stained_glass.json | 8 +- .../recipe/purple_stained_glass_pane.json | 4 +- ...le_stained_glass_pane_from_glass_pane.json | 8 +- data/minecraft/recipe/purple_terracotta.json | 8 +- data/minecraft/recipe/purpur_block.json | 4 +- data/minecraft/recipe/purpur_pillar.json | 4 +- ...pillar_from_purpur_block_stonecutting.json | 4 +- data/minecraft/recipe/purpur_slab.json | 8 +- ...r_slab_from_purpur_block_stonecutting.json | 4 +- data/minecraft/recipe/purpur_stairs.json | 8 +- ...stairs_from_purpur_block_stonecutting.json | 4 +- data/minecraft/recipe/quartz.json | 4 +- data/minecraft/recipe/quartz_block.json | 4 +- data/minecraft/recipe/quartz_bricks.json | 4 +- ...bricks_from_quartz_block_stonecutting.json | 4 +- .../recipe/quartz_from_blasting.json | 4 +- data/minecraft/recipe/quartz_pillar.json | 4 +- ...pillar_from_quartz_block_stonecutting.json | 4 +- data/minecraft/recipe/quartz_slab.json | 12 +- .../recipe/quartz_slab_from_stonecutting.json | 4 +- data/minecraft/recipe/quartz_stairs.json | 12 +- ...stairs_from_quartz_block_stonecutting.json | 4 +- .../rabbit_stew_from_brown_mushroom.json | 20 +- .../recipe/rabbit_stew_from_red_mushroom.json | 20 +- data/minecraft/recipe/rail.json | 8 +- .../raiser_armor_trim_smithing_template.json | 12 +- ..._trim_smithing_template_smithing_trim.json | 12 +- data/minecraft/recipe/raw_copper.json | 4 +- data/minecraft/recipe/raw_copper_block.json | 4 +- data/minecraft/recipe/raw_gold.json | 4 +- data/minecraft/recipe/raw_gold_block.json | 4 +- data/minecraft/recipe/raw_iron.json | 4 +- data/minecraft/recipe/raw_iron_block.json | 4 +- data/minecraft/recipe/recovery_compass.json | 8 +- data/minecraft/recipe/red_banner.json | 8 +- data/minecraft/recipe/red_bed.json | 8 +- data/minecraft/recipe/red_bundle.json | 8 + data/minecraft/recipe/red_candle.json | 8 +- data/minecraft/recipe/red_carpet.json | 4 +- .../minecraft/recipe/red_concrete_powder.json | 36 +- .../recipe/red_dye_from_beetroot.json | 4 +- data/minecraft/recipe/red_dye_from_poppy.json | 4 +- .../recipe/red_dye_from_rose_bush.json | 4 +- data/minecraft/recipe/red_dye_from_tulip.json | 4 +- .../recipe/red_glazed_terracotta.json | 4 +- .../recipe/red_nether_brick_slab.json | 4 +- ...b_from_red_nether_bricks_stonecutting.json | 4 +- .../recipe/red_nether_brick_stairs.json | 4 +- ...s_from_red_nether_bricks_stonecutting.json | 4 +- .../recipe/red_nether_brick_wall.json | 4 +- ...l_from_red_nether_bricks_stonecutting.json | 4 +- data/minecraft/recipe/red_nether_bricks.json | 8 +- data/minecraft/recipe/red_sandstone.json | 4 +- data/minecraft/recipe/red_sandstone_slab.json | 8 +- ..._slab_from_red_sandstone_stonecutting.json | 4 +- .../recipe/red_sandstone_stairs.json | 12 +- ...tairs_from_red_sandstone_stonecutting.json | 4 +- data/minecraft/recipe/red_sandstone_wall.json | 4 +- ..._wall_from_red_sandstone_stonecutting.json | 4 +- data/minecraft/recipe/red_shulker_box.json | 8 + data/minecraft/recipe/red_stained_glass.json | 8 +- .../recipe/red_stained_glass_pane.json | 4 +- ...ed_stained_glass_pane_from_glass_pane.json | 8 +- data/minecraft/recipe/red_terracotta.json | 8 +- data/minecraft/recipe/redstone.json | 4 +- data/minecraft/recipe/redstone_block.json | 4 +- ..._from_blasting_deepslate_redstone_ore.json | 4 +- .../redstone_from_blasting_redstone_ore.json | 4 +- ..._from_smelting_deepslate_redstone_ore.json | 4 +- .../redstone_from_smelting_redstone_ore.json | 4 +- data/minecraft/recipe/redstone_lamp.json | 8 +- data/minecraft/recipe/redstone_torch.json | 8 +- data/minecraft/recipe/repeater.json | 12 +- data/minecraft/recipe/respawn_anchor.json | 8 +- .../rib_armor_trim_smithing_template.json | 12 +- ..._trim_smithing_template_smithing_trim.json | 12 +- data/minecraft/recipe/sandstone.json | 4 +- data/minecraft/recipe/sandstone_slab.json | 8 +- ...tone_slab_from_sandstone_stonecutting.json | 4 +- data/minecraft/recipe/sandstone_stairs.json | 12 +- ...ne_stairs_from_sandstone_stonecutting.json | 4 +- data/minecraft/recipe/sandstone_wall.json | 4 +- ...tone_wall_from_sandstone_stonecutting.json | 4 +- data/minecraft/recipe/scaffolding.json | 8 +- data/minecraft/recipe/sea_lantern.json | 8 +- .../sentry_armor_trim_smithing_template.json | 12 +- ..._trim_smithing_template_smithing_trim.json | 12 +- .../shaper_armor_trim_smithing_template.json | 12 +- ..._trim_smithing_template_smithing_trim.json | 12 +- data/minecraft/recipe/shears.json | 4 +- data/minecraft/recipe/shield.json | 8 +- data/minecraft/recipe/shulker_box.json | 8 +- .../recipe/shulker_box_coloring.json | 4 - .../silence_armor_trim_smithing_template.json | 12 +- ..._trim_smithing_template_smithing_trim.json | 12 +- .../recipe/skull_banner_pattern.json | 8 +- data/minecraft/recipe/slime_ball.json | 4 +- data/minecraft/recipe/slime_block.json | 4 +- data/minecraft/recipe/smithing_table.json | 8 +- data/minecraft/recipe/smoker.json | 8 +- data/minecraft/recipe/smooth_basalt.json | 4 +- data/minecraft/recipe/smooth_quartz.json | 4 +- data/minecraft/recipe/smooth_quartz_slab.json | 4 +- ..._slab_from_smooth_quartz_stonecutting.json | 4 +- .../recipe/smooth_quartz_stairs.json | 4 +- ...tairs_from_smooth_quartz_stonecutting.json | 4 +- .../recipe/smooth_red_sandstone.json | 4 +- .../recipe/smooth_red_sandstone_slab.json | 4 +- ...rom_smooth_red_sandstone_stonecutting.json | 4 +- .../recipe/smooth_red_sandstone_stairs.json | 4 +- ...rom_smooth_red_sandstone_stonecutting.json | 4 +- data/minecraft/recipe/smooth_sandstone.json | 4 +- .../recipe/smooth_sandstone_slab.json | 4 +- ...ab_from_smooth_sandstone_stonecutting.json | 4 +- .../recipe/smooth_sandstone_stairs.json | 4 +- ...rs_from_smooth_sandstone_stonecutting.json | 4 +- data/minecraft/recipe/smooth_stone.json | 4 +- data/minecraft/recipe/smooth_stone_slab.json | 4 +- ...e_slab_from_smooth_stone_stonecutting.json | 4 +- .../snout_armor_trim_smithing_template.json | 12 +- ..._trim_smithing_template_smithing_trim.json | 12 +- data/minecraft/recipe/snow.json | 4 +- data/minecraft/recipe/snow_block.json | 4 +- data/minecraft/recipe/soul_campfire.json | 12 +- data/minecraft/recipe/soul_lantern.json | 8 +- data/minecraft/recipe/soul_torch.json | 16 +- data/minecraft/recipe/spectral_arrow.json | 8 +- .../spire_armor_trim_smithing_template.json | 12 +- ..._trim_smithing_template_smithing_trim.json | 12 +- data/minecraft/recipe/sponge.json | 4 +- data/minecraft/recipe/spruce_boat.json | 4 +- data/minecraft/recipe/spruce_button.json | 4 +- data/minecraft/recipe/spruce_chest_boat.json | 8 +- data/minecraft/recipe/spruce_door.json | 4 +- data/minecraft/recipe/spruce_fence.json | 8 +- data/minecraft/recipe/spruce_fence_gate.json | 8 +- .../minecraft/recipe/spruce_hanging_sign.json | 8 +- data/minecraft/recipe/spruce_planks.json | 4 +- .../recipe/spruce_pressure_plate.json | 4 +- data/minecraft/recipe/spruce_sign.json | 8 +- data/minecraft/recipe/spruce_slab.json | 4 +- data/minecraft/recipe/spruce_stairs.json | 4 +- data/minecraft/recipe/spruce_trapdoor.json | 4 +- data/minecraft/recipe/spruce_wood.json | 4 +- data/minecraft/recipe/spyglass.json | 8 +- data/minecraft/recipe/stick.json | 4 +- .../recipe/stick_from_bamboo_item.json | 4 +- data/minecraft/recipe/sticky_piston.json | 8 +- data/minecraft/recipe/stone.json | 4 +- data/minecraft/recipe/stone_axe.json | 8 +- data/minecraft/recipe/stone_brick_slab.json | 4 +- ...k_slab_from_stone_bricks_stonecutting.json | 4 +- ...ne_brick_slab_from_stone_stonecutting.json | 4 +- data/minecraft/recipe/stone_brick_stairs.json | 4 +- ...stairs_from_stone_bricks_stonecutting.json | 4 +- ..._brick_stairs_from_stone_stonecutting.json | 4 +- data/minecraft/recipe/stone_brick_wall.json | 4 +- ...k_wall_from_stone_bricks_stonecutting.json | 4 +- ...e_brick_walls_from_stone_stonecutting.json | 4 +- data/minecraft/recipe/stone_bricks.json | 4 +- .../stone_bricks_from_stone_stonecutting.json | 4 +- data/minecraft/recipe/stone_button.json | 4 +- data/minecraft/recipe/stone_hoe.json | 8 +- data/minecraft/recipe/stone_pickaxe.json | 8 +- .../recipe/stone_pressure_plate.json | 4 +- data/minecraft/recipe/stone_shovel.json | 8 +- data/minecraft/recipe/stone_slab.json | 4 +- .../stone_slab_from_stone_stonecutting.json | 4 +- data/minecraft/recipe/stone_stairs.json | 4 +- .../stone_stairs_from_stone_stonecutting.json | 4 +- data/minecraft/recipe/stone_sword.json | 8 +- data/minecraft/recipe/stonecutter.json | 8 +- .../recipe/stripped_acacia_wood.json | 4 +- .../minecraft/recipe/stripped_birch_wood.json | 4 +- .../recipe/stripped_cherry_wood.json | 4 +- .../recipe/stripped_crimson_hyphae.json | 4 +- .../recipe/stripped_dark_oak_wood.json | 4 +- .../recipe/stripped_jungle_wood.json | 4 +- .../recipe/stripped_mangrove_wood.json | 4 +- data/minecraft/recipe/stripped_oak_wood.json | 4 +- .../recipe/stripped_spruce_wood.json | 4 +- .../recipe/stripped_warped_hyphae.json | 4 +- .../recipe/sugar_from_honey_bottle.json | 4 +- .../recipe/sugar_from_sugar_cane.json | 4 +- data/minecraft/recipe/suspicious_stew.json | 4 - .../recipe/suspicious_stew_from_allium.json | 23 + .../suspicious_stew_from_azure_bluet.json | 22 + .../suspicious_stew_from_blue_orchid.json | 23 + .../suspicious_stew_from_cornflower.json | 23 + .../suspicious_stew_from_dandelion.json | 23 + ...spicious_stew_from_lily_of_the_valley.json | 23 + .../suspicious_stew_from_orange_tulip.json | 23 + .../suspicious_stew_from_oxeye_daisy.json | 22 + .../suspicious_stew_from_pink_tulip.json | 23 + .../recipe/suspicious_stew_from_poppy.json | 23 + .../suspicious_stew_from_red_tulip.json | 23 + .../suspicious_stew_from_torchflower.json | 23 + .../suspicious_stew_from_white_tulip.json | 23 + .../suspicious_stew_from_wither_rose.json | 22 + data/minecraft/recipe/target.json | 8 +- data/minecraft/recipe/terracotta.json | 4 +- .../tide_armor_trim_smithing_template.json | 12 +- ..._trim_smithing_template_smithing_trim.json | 12 +- data/minecraft/recipe/tinted_glass.json | 8 +- data/minecraft/recipe/tnt.json | 12 +- data/minecraft/recipe/tnt_minecart.json | 8 +- data/minecraft/recipe/torch.json | 12 +- data/minecraft/recipe/trapped_chest.json | 8 +- data/minecraft/recipe/tripwire_hook.json | 12 +- data/minecraft/recipe/tuff_brick_slab.json | 4 +- ..._slab_from_polished_tuff_stonecutting.json | 4 +- ...ck_slab_from_tuff_bricks_stonecutting.json | 4 +- ...uff_brick_slab_from_tuff_stonecutting.json | 4 +- data/minecraft/recipe/tuff_brick_stairs.json | 4 +- ...tairs_from_polished_tuff_stonecutting.json | 4 +- ..._stairs_from_tuff_bricks_stonecutting.json | 4 +- ...f_brick_stairs_from_tuff_stonecutting.json | 4 +- data/minecraft/recipe/tuff_brick_wall.json | 4 +- ..._wall_from_polished_tuff_stonecutting.json | 4 +- ...ck_wall_from_tuff_bricks_stonecutting.json | 4 +- ...uff_brick_wall_from_tuff_stonecutting.json | 4 +- data/minecraft/recipe/tuff_bricks.json | 4 +- ...ricks_from_polished_tuff_stonecutting.json | 4 +- .../tuff_bricks_from_tuff_stonecutting.json | 4 +- data/minecraft/recipe/tuff_slab.json | 4 +- .../tuff_slab_from_tuff_stonecutting.json | 4 +- data/minecraft/recipe/tuff_stairs.json | 4 +- .../tuff_stairs_from_tuff_stonecutting.json | 4 +- data/minecraft/recipe/tuff_wall.json | 4 +- .../tuff_wall_from_tuff_stonecutting.json | 4 +- data/minecraft/recipe/turtle_helmet.json | 4 +- .../vex_armor_trim_smithing_template.json | 12 +- ..._trim_smithing_template_smithing_trim.json | 12 +- .../ward_armor_trim_smithing_template.json | 12 +- ..._trim_smithing_template_smithing_trim.json | 12 +- data/minecraft/recipe/warped_button.json | 4 +- data/minecraft/recipe/warped_door.json | 4 +- data/minecraft/recipe/warped_fence.json | 8 +- data/minecraft/recipe/warped_fence_gate.json | 8 +- .../recipe/warped_fungus_on_a_stick.json | 8 +- .../minecraft/recipe/warped_hanging_sign.json | 8 +- data/minecraft/recipe/warped_hyphae.json | 4 +- data/minecraft/recipe/warped_planks.json | 4 +- .../recipe/warped_pressure_plate.json | 4 +- data/minecraft/recipe/warped_sign.json | 8 +- data/minecraft/recipe/warped_slab.json | 4 +- data/minecraft/recipe/warped_stairs.json | 4 +- data/minecraft/recipe/warped_trapdoor.json | 4 +- .../recipe/waxed_chiseled_copper.json | 4 +- .../waxed_chiseled_copper_from_honeycomb.json | 8 +- ..._from_waxed_copper_block_stonecutting.json | 4 +- ...er_from_waxed_cut_copper_stonecutting.json | 4 +- .../waxed_copper_block_from_honeycomb.json | 8 +- data/minecraft/recipe/waxed_copper_bulb.json | 12 +- .../waxed_copper_bulb_from_honeycomb.json | 8 +- .../waxed_copper_door_from_honeycomb.json | 8 +- data/minecraft/recipe/waxed_copper_grate.json | 4 +- .../waxed_copper_grate_from_honeycomb.json | 8 +- ..._from_waxed_copper_block_stonecutting.json | 4 +- .../waxed_copper_trapdoor_from_honeycomb.json | 8 +- data/minecraft/recipe/waxed_cut_copper.json | 4 +- .../waxed_cut_copper_from_honeycomb.json | 8 +- ..._from_waxed_copper_block_stonecutting.json | 4 +- .../recipe/waxed_cut_copper_slab.json | 4 +- .../waxed_cut_copper_slab_from_honeycomb.json | 8 +- ..._from_waxed_copper_block_stonecutting.json | 4 +- ...ab_from_waxed_cut_copper_stonecutting.json | 4 +- .../recipe/waxed_cut_copper_stairs.json | 4 +- ...axed_cut_copper_stairs_from_honeycomb.json | 8 +- ..._from_waxed_copper_block_stonecutting.json | 4 +- ...rs_from_waxed_cut_copper_stonecutting.json | 4 +- .../recipe/waxed_exposed_chiseled_copper.json | 4 +- ...xposed_chiseled_copper_from_honeycomb.json | 8 +- ...rom_waxed_exposed_copper_stonecutting.json | 4 +- ...waxed_exposed_cut_copper_stonecutting.json | 4 +- .../recipe/waxed_exposed_copper_bulb.json | 12 +- ...ed_exposed_copper_bulb_from_honeycomb.json | 8 +- ...ed_exposed_copper_door_from_honeycomb.json | 8 +- .../waxed_exposed_copper_from_honeycomb.json | 8 +- .../recipe/waxed_exposed_copper_grate.json | 4 +- ...d_exposed_copper_grate_from_honeycomb.json | 8 +- ...rom_waxed_exposed_copper_stonecutting.json | 4 +- ...xposed_copper_trapdoor_from_honeycomb.json | 8 +- .../recipe/waxed_exposed_cut_copper.json | 4 +- ...xed_exposed_cut_copper_from_honeycomb.json | 8 +- ...rom_waxed_exposed_copper_stonecutting.json | 4 +- .../recipe/waxed_exposed_cut_copper_slab.json | 4 +- ...xposed_cut_copper_slab_from_honeycomb.json | 8 +- ...rom_waxed_exposed_copper_stonecutting.json | 4 +- ...waxed_exposed_cut_copper_stonecutting.json | 4 +- .../waxed_exposed_cut_copper_stairs.json | 4 +- ...osed_cut_copper_stairs_from_honeycomb.json | 8 +- ...rom_waxed_exposed_copper_stonecutting.json | 4 +- ...waxed_exposed_cut_copper_stonecutting.json | 4 +- .../waxed_oxidized_chiseled_copper.json | 4 +- ...idized_chiseled_copper_from_honeycomb.json | 8 +- ...om_waxed_oxidized_copper_stonecutting.json | 4 +- ...axed_oxidized_cut_copper_stonecutting.json | 4 +- .../recipe/waxed_oxidized_copper_bulb.json | 12 +- ...d_oxidized_copper_bulb_from_honeycomb.json | 8 +- ...d_oxidized_copper_door_from_honeycomb.json | 8 +- .../waxed_oxidized_copper_from_honeycomb.json | 8 +- .../recipe/waxed_oxidized_copper_grate.json | 4 +- ..._oxidized_copper_grate_from_honeycomb.json | 8 +- ...om_waxed_oxidized_copper_stonecutting.json | 4 +- ...idized_copper_trapdoor_from_honeycomb.json | 8 +- .../recipe/waxed_oxidized_cut_copper.json | 4 +- ...ed_oxidized_cut_copper_from_honeycomb.json | 8 +- ...om_waxed_oxidized_copper_stonecutting.json | 4 +- .../waxed_oxidized_cut_copper_slab.json | 4 +- ...idized_cut_copper_slab_from_honeycomb.json | 8 +- ...om_waxed_oxidized_copper_stonecutting.json | 4 +- ...axed_oxidized_cut_copper_stonecutting.json | 4 +- .../waxed_oxidized_cut_copper_stairs.json | 4 +- ...ized_cut_copper_stairs_from_honeycomb.json | 8 +- ...om_waxed_oxidized_copper_stonecutting.json | 4 +- ...axed_oxidized_cut_copper_stonecutting.json | 4 +- .../waxed_weathered_chiseled_copper.json | 4 +- ...thered_chiseled_copper_from_honeycomb.json | 8 +- ...m_waxed_weathered_copper_stonecutting.json | 4 +- ...xed_weathered_cut_copper_stonecutting.json | 4 +- .../recipe/waxed_weathered_copper_bulb.json | 12 +- ..._weathered_copper_bulb_from_honeycomb.json | 8 +- ..._weathered_copper_door_from_honeycomb.json | 8 +- ...waxed_weathered_copper_from_honeycomb.json | 8 +- .../recipe/waxed_weathered_copper_grate.json | 4 +- ...weathered_copper_grate_from_honeycomb.json | 8 +- ...m_waxed_weathered_copper_stonecutting.json | 4 +- ...thered_copper_trapdoor_from_honeycomb.json | 8 +- .../recipe/waxed_weathered_cut_copper.json | 4 +- ...d_weathered_cut_copper_from_honeycomb.json | 8 +- ...m_waxed_weathered_copper_stonecutting.json | 4 +- .../waxed_weathered_cut_copper_slab.json | 4 +- ...thered_cut_copper_slab_from_honeycomb.json | 8 +- ...m_waxed_weathered_copper_stonecutting.json | 4 +- ...xed_weathered_cut_copper_stonecutting.json | 4 +- .../waxed_weathered_cut_copper_stairs.json | 4 +- ...ered_cut_copper_stairs_from_honeycomb.json | 8 +- ...m_waxed_weathered_copper_stonecutting.json | 4 +- ...xed_weathered_cut_copper_stonecutting.json | 4 +- ...ayfinder_armor_trim_smithing_template.json | 12 +- ..._trim_smithing_template_smithing_trim.json | 12 +- .../recipe/weathered_chiseled_copper.json | 4 +- ...er_from_weathered_copper_stonecutting.json | 4 +- ...rom_weathered_cut_copper_stonecutting.json | 4 +- .../recipe/weathered_copper_bulb.json | 12 +- .../recipe/weathered_copper_grate.json | 4 +- ...te_from_weathered_copper_stonecutting.json | 4 +- .../recipe/weathered_cut_copper.json | 4 +- ...er_from_weathered_copper_stonecutting.json | 4 +- .../recipe/weathered_cut_copper_slab.json | 4 +- ...ab_from_weathered_copper_stonecutting.json | 4 +- ...rom_weathered_cut_copper_stonecutting.json | 4 +- .../recipe/weathered_cut_copper_stairs.json | 4 +- ...rs_from_weathered_copper_stonecutting.json | 4 +- ...rom_weathered_cut_copper_stonecutting.json | 4 +- data/minecraft/recipe/wheat.json | 4 +- data/minecraft/recipe/white_banner.json | 8 +- data/minecraft/recipe/white_bed.json | 8 +- data/minecraft/recipe/white_bundle.json | 8 + data/minecraft/recipe/white_candle.json | 8 +- data/minecraft/recipe/white_carpet.json | 4 +- .../recipe/white_concrete_powder.json | 36 +- data/minecraft/recipe/white_dye.json | 4 +- .../white_dye_from_lily_of_the_valley.json | 4 +- .../recipe/white_glazed_terracotta.json | 4 +- data/minecraft/recipe/white_shulker_box.json | 8 + .../minecraft/recipe/white_stained_glass.json | 8 +- .../recipe/white_stained_glass_pane.json | 4 +- ...te_stained_glass_pane_from_glass_pane.json | 8 +- data/minecraft/recipe/white_terracotta.json | 8 +- .../recipe/white_wool_from_string.json | 4 +- .../wild_armor_trim_smithing_template.json | 12 +- ..._trim_smithing_template_smithing_trim.json | 12 +- data/minecraft/recipe/wind_charge.json | 4 +- data/minecraft/recipe/wolf_armor.json | 4 +- data/minecraft/recipe/wooden_axe.json | 8 +- data/minecraft/recipe/wooden_hoe.json | 8 +- data/minecraft/recipe/wooden_pickaxe.json | 8 +- data/minecraft/recipe/wooden_shovel.json | 8 +- data/minecraft/recipe/wooden_sword.json | 8 +- data/minecraft/recipe/writable_book.json | 12 +- data/minecraft/recipe/yellow_banner.json | 8 +- data/minecraft/recipe/yellow_bed.json | 8 +- data/minecraft/recipe/yellow_bundle.json | 8 + data/minecraft/recipe/yellow_candle.json | 8 +- data/minecraft/recipe/yellow_carpet.json | 4 +- .../recipe/yellow_concrete_powder.json | 36 +- .../recipe/yellow_dye_from_dandelion.json | 4 +- .../recipe/yellow_dye_from_sunflower.json | 4 +- .../recipe/yellow_glazed_terracotta.json | 4 +- data/minecraft/recipe/yellow_shulker_box.json | 8 + .../recipe/yellow_stained_glass.json | 8 +- .../recipe/yellow_stained_glass_pane.json | 4 +- ...ow_stained_glass_pane_from_glass_pane.json | 8 +- data/minecraft/recipe/yellow_terracotta.json | 8 +- .../city/entrance/entrance_connector.nbt | 4 +- .../city/entrance/entrance_path_1.nbt | 4 +- .../city/entrance/entrance_path_2.nbt | 4 +- .../city/entrance/entrance_path_3.nbt | 4 +- .../city/entrance/entrance_path_4.nbt | 4 +- .../city/entrance/entrance_path_5.nbt | 4 +- .../city_center/city_center_1.nbt | 4 +- .../city_center/city_center_2.nbt | 4 +- .../city_center/city_center_3.nbt | 4 +- .../city_center/walls/bottom_1.nbt | 4 +- .../city_center/walls/bottom_2.nbt | 4 +- .../city_center/walls/bottom_left_corner.nbt | 4 +- .../city_center/walls/bottom_right_corner.nbt | 4 +- .../walls/bottom_right_corner_1.nbt | 4 +- .../walls/bottom_right_corner_2.nbt | 4 +- .../ancient_city/city_center/walls/left.nbt | 4 +- .../ancient_city/city_center/walls/right.nbt | 4 +- .../ancient_city/city_center/walls/top.nbt | 4 +- .../city_center/walls/top_left_corner.nbt | 4 +- .../city_center/walls/top_right_corner.nbt | 4 +- .../ancient_city/structures/barracks.nbt | 4 +- .../ancient_city/structures/camp_1.nbt | 4 +- .../ancient_city/structures/camp_2.nbt | 4 +- .../ancient_city/structures/camp_3.nbt | 4 +- .../ancient_city/structures/chamber_1.nbt | 4 +- .../ancient_city/structures/chamber_2.nbt | 4 +- .../ancient_city/structures/chamber_3.nbt | 4 +- .../ancient_city/structures/ice_box_1.nbt | 4 +- .../structures/large_pillar_1.nbt | 4 +- .../ancient_city/structures/large_ruin_1.nbt | 4 +- .../structures/medium_pillar_1.nbt | 4 +- .../ancient_city/structures/medium_ruin_1.nbt | 4 +- .../ancient_city/structures/medium_ruin_2.nbt | 4 +- .../ancient_city/structures/sauna_1.nbt | 4 +- .../ancient_city/structures/small_ruin_1.nbt | 4 +- .../ancient_city/structures/small_ruin_2.nbt | 4 +- .../ancient_city/structures/small_statue.nbt | 4 +- .../ancient_city/structures/tall_ruin_1.nbt | 4 +- .../ancient_city/structures/tall_ruin_2.nbt | 4 +- .../ancient_city/structures/tall_ruin_3.nbt | 4 +- .../ancient_city/structures/tall_ruin_4.nbt | 4 +- .../walls/intact_corner_wall_1.nbt | 4 +- .../walls/intact_horizontal_wall_1.nbt | 4 +- .../walls/intact_horizontal_wall_2.nbt | 4 +- .../walls/intact_horizontal_wall_bridge.nbt | 4 +- .../intact_horizontal_wall_passage_1.nbt | 4 +- .../walls/intact_horizontal_wall_stairs_1.nbt | 4 +- .../walls/intact_horizontal_wall_stairs_2.nbt | 4 +- .../walls/intact_horizontal_wall_stairs_3.nbt | 4 +- .../walls/intact_horizontal_wall_stairs_4.nbt | 4 +- .../walls/intact_intersection_wall_1.nbt | 4 +- .../walls/intact_lshape_wall_1.nbt | 4 +- .../walls/ruined_corner_wall_1.nbt | 4 +- .../walls/ruined_corner_wall_2.nbt | 4 +- .../walls/ruined_horizontal_wall_stairs_1.nbt | 4 +- .../walls/ruined_horizontal_wall_stairs_2.nbt | 4 +- .../walls/ruined_horizontal_wall_stairs_3.nbt | 4 +- .../walls/ruined_horizontal_wall_stairs_4.nbt | 4 +- .../structure/bastion/blocks/air.nbt | 4 +- .../structure/bastion/blocks/gold.nbt | 4 +- .../bastion/bridge/bridge_pieces/bridge.nbt | 4 +- .../bridge/connectors/back_bridge_bottom.nbt | 4 +- .../bridge/connectors/back_bridge_top.nbt | 4 +- .../structure/bastion/bridge/legs/leg_0.nbt | 4 +- .../structure/bastion/bridge/legs/leg_1.nbt | 4 +- .../bastion/bridge/rampart_plates/plate_0.nbt | 4 +- .../bastion/bridge/ramparts/rampart_0.nbt | 4 +- .../bastion/bridge/ramparts/rampart_1.nbt | 4 +- .../bridge/starting_pieces/entrance.nbt | 4 +- .../bridge/starting_pieces/entrance_base.nbt | 4 +- .../bridge/starting_pieces/entrance_face.nbt | 4 +- .../bastion/bridge/walls/wall_base_0.nbt | 4 +- .../bastion/bridge/walls/wall_base_1.nbt | 4 +- .../bastion/hoglin_stable/air_base.nbt | 4 +- .../connectors/end_post_connector.nbt | 4 +- .../hoglin_stable/large_stables/inner_0.nbt | 4 +- .../hoglin_stable/large_stables/inner_1.nbt | 4 +- .../hoglin_stable/large_stables/inner_2.nbt | 4 +- .../hoglin_stable/large_stables/inner_3.nbt | 4 +- .../hoglin_stable/large_stables/inner_4.nbt | 4 +- .../hoglin_stable/large_stables/outer_0.nbt | 4 +- .../hoglin_stable/large_stables/outer_1.nbt | 4 +- .../hoglin_stable/large_stables/outer_2.nbt | 4 +- .../hoglin_stable/large_stables/outer_3.nbt | 4 +- .../hoglin_stable/large_stables/outer_4.nbt | 4 +- .../bastion/hoglin_stable/posts/end_post.nbt | 4 +- .../hoglin_stable/posts/stair_post.nbt | 4 +- .../rampart_plates/rampart_plate_1.nbt | 4 +- .../hoglin_stable/ramparts/ramparts_1.nbt | 4 +- .../hoglin_stable/ramparts/ramparts_2.nbt | 4 +- .../hoglin_stable/ramparts/ramparts_3.nbt | 4 +- .../hoglin_stable/small_stables/inner_0.nbt | 4 +- .../hoglin_stable/small_stables/inner_1.nbt | 4 +- .../hoglin_stable/small_stables/inner_2.nbt | 4 +- .../hoglin_stable/small_stables/inner_3.nbt | 4 +- .../hoglin_stable/small_stables/outer_0.nbt | 4 +- .../hoglin_stable/small_stables/outer_1.nbt | 4 +- .../hoglin_stable/small_stables/outer_2.nbt | 4 +- .../hoglin_stable/small_stables/outer_3.nbt | 4 +- .../hoglin_stable/stairs/stairs_1_0.nbt | 4 +- .../hoglin_stable/stairs/stairs_1_1.nbt | 4 +- .../hoglin_stable/stairs/stairs_1_2.nbt | 4 +- .../hoglin_stable/stairs/stairs_1_3.nbt | 4 +- .../hoglin_stable/stairs/stairs_1_4.nbt | 4 +- .../hoglin_stable/stairs/stairs_2_0.nbt | 4 +- .../hoglin_stable/stairs/stairs_2_1.nbt | 4 +- .../hoglin_stable/stairs/stairs_2_2.nbt | 4 +- .../hoglin_stable/stairs/stairs_2_3.nbt | 4 +- .../hoglin_stable/stairs/stairs_2_4.nbt | 4 +- .../hoglin_stable/stairs/stairs_3_0.nbt | 4 +- .../hoglin_stable/stairs/stairs_3_1.nbt | 4 +- .../hoglin_stable/stairs/stairs_3_2.nbt | 4 +- .../hoglin_stable/stairs/stairs_3_3.nbt | 4 +- .../hoglin_stable/stairs/stairs_3_4.nbt | 4 +- .../starting_pieces/stairs_0_mirrored.nbt | 4 +- .../starting_pieces/stairs_1_mirrored.nbt | 4 +- .../starting_pieces/stairs_2_mirrored.nbt | 4 +- .../starting_pieces/stairs_3_mirrored.nbt | 4 +- .../starting_pieces/stairs_4_mirrored.nbt | 4 +- .../starting_pieces/starting_stairs_0.nbt | 4 +- .../starting_pieces/starting_stairs_1.nbt | 4 +- .../starting_pieces/starting_stairs_2.nbt | 4 +- .../starting_pieces/starting_stairs_3.nbt | 4 +- .../starting_pieces/starting_stairs_4.nbt | 4 +- .../hoglin_stable/walls/side_wall_0.nbt | 4 +- .../hoglin_stable/walls/side_wall_1.nbt | 4 +- .../bastion/hoglin_stable/walls/wall_base.nbt | 4 +- .../bastion/mobs/crossbow_piglin.nbt | 4 +- .../structure/bastion/mobs/empty.nbt | 4 +- .../structure/bastion/mobs/hoglin.nbt | 4 +- .../structure/bastion/mobs/melee_piglin.nbt | 4 +- .../bastion/mobs/melee_piglin_always.nbt | 2 +- .../structure/bastion/mobs/sword_piglin.nbt | 2 +- .../treasure/bases/centers/center_0.nbt | 4 +- .../treasure/bases/centers/center_1.nbt | 4 +- .../treasure/bases/centers/center_2.nbt | 4 +- .../treasure/bases/centers/center_3.nbt | 4 +- .../bastion/treasure/bases/lava_basin.nbt | 4 +- .../bastion/treasure/big_air_full.nbt | 4 +- .../bastion/treasure/brains/center_brain.nbt | 4 +- .../connectors/center_to_wall_middle.nbt | 4 +- .../connectors/center_to_wall_top.nbt | 4 +- .../center_to_wall_top_entrance.nbt | 4 +- .../treasure/corners/bottom/corner_0.nbt | 4 +- .../treasure/corners/bottom/corner_1.nbt | 4 +- .../bastion/treasure/corners/edges/bottom.nbt | 4 +- .../bastion/treasure/corners/edges/middle.nbt | 4 +- .../bastion/treasure/corners/edges/top.nbt | 4 +- .../treasure/corners/middle/corner_0.nbt | 4 +- .../treasure/corners/middle/corner_1.nbt | 4 +- .../bastion/treasure/corners/top/corner_0.nbt | 4 +- .../bastion/treasure/corners/top/corner_1.nbt | 4 +- .../bastion/treasure/entrances/entrance_0.nbt | 4 +- .../bastion/treasure/extensions/empty.nbt | 4 +- .../bastion/treasure/extensions/fire_room.nbt | 4 +- .../bastion/treasure/extensions/house_0.nbt | 4 +- .../bastion/treasure/extensions/house_1.nbt | 4 +- .../treasure/extensions/large_bridge_0.nbt | 4 +- .../treasure/extensions/large_bridge_1.nbt | 4 +- .../treasure/extensions/large_bridge_2.nbt | 4 +- .../treasure/extensions/large_bridge_3.nbt | 4 +- .../treasure/extensions/roofed_bridge.nbt | 4 +- .../treasure/extensions/small_bridge_0.nbt | 4 +- .../treasure/extensions/small_bridge_1.nbt | 4 +- .../treasure/extensions/small_bridge_2.nbt | 4 +- .../treasure/extensions/small_bridge_3.nbt | 4 +- .../treasure/ramparts/bottom_wall_0.nbt | 4 +- .../treasure/ramparts/lava_basin_main.nbt | 4 +- .../treasure/ramparts/lava_basin_side.nbt | 4 +- .../treasure/ramparts/mid_wall_main.nbt | 4 +- .../treasure/ramparts/mid_wall_side.nbt | 4 +- .../bastion/treasure/ramparts/top_wall.nbt | 4 +- .../bastion/treasure/roofs/center_roof.nbt | 4 +- .../bastion/treasure/roofs/corner_roof.nbt | 4 +- .../bastion/treasure/roofs/wall_roof.nbt | 2 +- .../bastion/treasure/stairs/lower_stairs.nbt | 4 +- .../bastion/treasure/walls/bottom/wall_0.nbt | 4 +- .../bastion/treasure/walls/bottom/wall_1.nbt | 4 +- .../bastion/treasure/walls/bottom/wall_2.nbt | 4 +- .../bastion/treasure/walls/bottom/wall_3.nbt | 4 +- .../bastion/treasure/walls/entrance_wall.nbt | 4 +- .../bastion/treasure/walls/lava_wall.nbt | 2 +- .../bastion/treasure/walls/mid/wall_0.nbt | 4 +- .../bastion/treasure/walls/mid/wall_1.nbt | 4 +- .../bastion/treasure/walls/mid/wall_2.nbt | 4 +- .../treasure/walls/outer/bottom_corner.nbt | 4 +- .../walls/outer/medium_outer_wall.nbt | 4 +- .../treasure/walls/outer/mid_corner.nbt | 4 +- .../treasure/walls/outer/outer_wall.nbt | 4 +- .../treasure/walls/outer/tall_outer_wall.nbt | 4 +- .../treasure/walls/outer/top_corner.nbt | 4 +- .../treasure/walls/top/main_entrance.nbt | 4 +- .../bastion/treasure/walls/top/wall_0.nbt | 4 +- .../bastion/treasure/walls/top/wall_1.nbt | 4 +- .../structure/bastion/units/air_base.nbt | 4 +- .../bastion/units/center_pieces/center_0.nbt | 4 +- .../bastion/units/center_pieces/center_1.nbt | 4 +- .../bastion/units/center_pieces/center_2.nbt | 4 +- .../structure/bastion/units/edges/edge_0.nbt | 4 +- .../bastion/units/fillers/stage_0.nbt | 4 +- .../bastion/units/pathways/pathway_0.nbt | 4 +- .../bastion/units/pathways/pathway_wall_0.nbt | 4 +- .../bastion/units/rampart_plates/plate_0.nbt | 4 +- .../bastion/units/ramparts/ramparts_0.nbt | 4 +- .../bastion/units/ramparts/ramparts_1.nbt | 4 +- .../bastion/units/ramparts/ramparts_2.nbt | 4 +- .../bastion/units/stages/rot/stage_1_0.nbt | 4 +- .../bastion/units/stages/stage_0_0.nbt | 4 +- .../bastion/units/stages/stage_0_1.nbt | 4 +- .../bastion/units/stages/stage_0_2.nbt | 4 +- .../bastion/units/stages/stage_0_3.nbt | 4 +- .../bastion/units/stages/stage_1_0.nbt | 4 +- .../bastion/units/stages/stage_1_1.nbt | 4 +- .../bastion/units/stages/stage_1_2.nbt | 4 +- .../bastion/units/stages/stage_1_3.nbt | 4 +- .../bastion/units/stages/stage_2_0.nbt | 4 +- .../bastion/units/stages/stage_2_1.nbt | 4 +- .../bastion/units/stages/stage_3_0.nbt | 4 +- .../bastion/units/stages/stage_3_1.nbt | 4 +- .../bastion/units/stages/stage_3_2.nbt | 4 +- .../bastion/units/stages/stage_3_3.nbt | 4 +- .../bastion/units/wall_units/edge_0_large.nbt | 4 +- .../bastion/units/wall_units/unit_0.nbt | 4 +- .../bastion/units/walls/connected_wall.nbt | 4 +- .../bastion/units/walls/wall_base.nbt | 4 +- .../structure/end_city/base_floor.nbt | 4 +- .../structure/end_city/base_roof.nbt | 4 +- .../structure/end_city/bridge_end.nbt | 4 +- .../end_city/bridge_gentle_stairs.nbt | 4 +- .../structure/end_city/bridge_piece.nbt | 4 +- .../end_city/bridge_steep_stairs.nbt | 4 +- .../structure/end_city/fat_tower_base.nbt | 4 +- .../structure/end_city/fat_tower_middle.nbt | 4 +- .../structure/end_city/fat_tower_top.nbt | 4 +- .../structure/end_city/second_floor_1.nbt | 4 +- .../structure/end_city/second_floor_2.nbt | 4 +- .../structure/end_city/second_roof.nbt | 4 +- data/minecraft/structure/end_city/ship.nbt | 4 +- .../structure/end_city/third_floor_1.nbt | 4 +- .../structure/end_city/third_floor_2.nbt | 4 +- .../structure/end_city/third_roof.nbt | 4 +- .../structure/end_city/tower_base.nbt | 4 +- .../structure/end_city/tower_floor.nbt | 4 +- .../structure/end_city/tower_piece.nbt | 4 +- .../structure/end_city/tower_top.nbt | 4 +- data/minecraft/structure/fossil/skull_1.nbt | 4 +- .../structure/fossil/skull_1_coal.nbt | 4 +- data/minecraft/structure/fossil/skull_2.nbt | 4 +- .../structure/fossil/skull_2_coal.nbt | 4 +- data/minecraft/structure/fossil/skull_3.nbt | 4 +- .../structure/fossil/skull_3_coal.nbt | 4 +- data/minecraft/structure/fossil/skull_4.nbt | 4 +- .../structure/fossil/skull_4_coal.nbt | 4 +- data/minecraft/structure/fossil/spine_1.nbt | 4 +- .../structure/fossil/spine_1_coal.nbt | 4 +- data/minecraft/structure/fossil/spine_2.nbt | 4 +- .../structure/fossil/spine_2_coal.nbt | 4 +- data/minecraft/structure/fossil/spine_3.nbt | 4 +- .../structure/fossil/spine_3_coal.nbt | 4 +- data/minecraft/structure/fossil/spine_4.nbt | 4 +- .../structure/fossil/spine_4_coal.nbt | 4 +- data/minecraft/structure/igloo/bottom.nbt | 4 +- data/minecraft/structure/igloo/middle.nbt | 4 +- data/minecraft/structure/igloo/top.nbt | 4 +- .../structure/nether_fossils/fossil_1.nbt | 4 +- .../structure/nether_fossils/fossil_10.nbt | 4 +- .../structure/nether_fossils/fossil_11.nbt | 4 +- .../structure/nether_fossils/fossil_12.nbt | 4 +- .../structure/nether_fossils/fossil_13.nbt | 4 +- .../structure/nether_fossils/fossil_14.nbt | 2 +- .../structure/nether_fossils/fossil_2.nbt | 4 +- .../structure/nether_fossils/fossil_3.nbt | 4 +- .../structure/nether_fossils/fossil_4.nbt | 4 +- .../structure/nether_fossils/fossil_5.nbt | 4 +- .../structure/nether_fossils/fossil_6.nbt | 4 +- .../structure/nether_fossils/fossil_7.nbt | 4 +- .../structure/nether_fossils/fossil_8.nbt | 4 +- .../structure/nether_fossils/fossil_9.nbt | 4 +- .../structure/pillager_outpost/base_plate.nbt | 4 +- .../pillager_outpost/feature_cage1.nbt | 4 +- .../pillager_outpost/feature_cage2.nbt | 4 +- .../feature_cage_with_allays.nbt | 4 +- .../pillager_outpost/feature_logs.nbt | 4 +- .../pillager_outpost/feature_plate.nbt | 4 +- .../pillager_outpost/feature_targets.nbt | 4 +- .../pillager_outpost/feature_tent1.nbt | 4 +- .../pillager_outpost/feature_tent2.nbt | 4 +- .../structure/pillager_outpost/watchtower.nbt | 4 +- .../pillager_outpost/watchtower_overgrown.nbt | 4 +- .../ruined_portal/giant_portal_1.nbt | 4 +- .../ruined_portal/giant_portal_2.nbt | 4 +- .../ruined_portal/giant_portal_3.nbt | 4 +- .../structure/ruined_portal/portal_1.nbt | 4 +- .../structure/ruined_portal/portal_10.nbt | 4 +- .../structure/ruined_portal/portal_2.nbt | 4 +- .../structure/ruined_portal/portal_3.nbt | 4 +- .../structure/ruined_portal/portal_4.nbt | 4 +- .../structure/ruined_portal/portal_5.nbt | 4 +- .../structure/ruined_portal/portal_6.nbt | 2 +- .../structure/ruined_portal/portal_7.nbt | 4 +- .../structure/ruined_portal/portal_8.nbt | 4 +- .../structure/ruined_portal/portal_9.nbt | 4 +- .../shipwreck/rightsideup_backhalf.nbt | 4 +- .../rightsideup_backhalf_degraded.nbt | 4 +- .../shipwreck/rightsideup_fronthalf.nbt | 4 +- .../rightsideup_fronthalf_degraded.nbt | 4 +- .../structure/shipwreck/rightsideup_full.nbt | 4 +- .../shipwreck/rightsideup_full_degraded.nbt | 4 +- .../structure/shipwreck/sideways_backhalf.nbt | 4 +- .../shipwreck/sideways_backhalf_degraded.nbt | 4 +- .../shipwreck/sideways_fronthalf.nbt | 4 +- .../shipwreck/sideways_fronthalf_degraded.nbt | 4 +- .../structure/shipwreck/sideways_full.nbt | 4 +- .../shipwreck/sideways_full_degraded.nbt | 4 +- .../shipwreck/upsidedown_backhalf.nbt | 4 +- .../upsidedown_backhalf_degraded.nbt | 4 +- .../shipwreck/upsidedown_fronthalf.nbt | 4 +- .../upsidedown_fronthalf_degraded.nbt | 4 +- .../structure/shipwreck/upsidedown_full.nbt | 4 +- .../shipwreck/upsidedown_full_degraded.nbt | 4 +- .../structure/shipwreck/with_mast.nbt | 4 +- .../shipwreck/with_mast_degraded.nbt | 4 +- .../trail_ruins/buildings/group_full_1.nbt | 4 +- .../trail_ruins/buildings/group_full_2.nbt | 4 +- .../trail_ruins/buildings/group_full_3.nbt | 4 +- .../trail_ruins/buildings/group_full_4.nbt | 4 +- .../trail_ruins/buildings/group_full_5.nbt | 4 +- .../trail_ruins/buildings/group_hall_1.nbt | 4 +- .../trail_ruins/buildings/group_hall_2.nbt | 4 +- .../trail_ruins/buildings/group_hall_3.nbt | 4 +- .../trail_ruins/buildings/group_hall_4.nbt | 4 +- .../trail_ruins/buildings/group_hall_5.nbt | 4 +- .../trail_ruins/buildings/group_lower_1.nbt | 4 +- .../trail_ruins/buildings/group_lower_2.nbt | 4 +- .../trail_ruins/buildings/group_lower_3.nbt | 4 +- .../trail_ruins/buildings/group_lower_4.nbt | 4 +- .../trail_ruins/buildings/group_lower_5.nbt | 4 +- .../trail_ruins/buildings/group_room_1.nbt | 4 +- .../trail_ruins/buildings/group_room_2.nbt | 4 +- .../trail_ruins/buildings/group_room_3.nbt | 4 +- .../trail_ruins/buildings/group_room_4.nbt | 4 +- .../trail_ruins/buildings/group_room_5.nbt | 4 +- .../trail_ruins/buildings/group_upper_1.nbt | 4 +- .../trail_ruins/buildings/group_upper_2.nbt | 4 +- .../trail_ruins/buildings/group_upper_3.nbt | 4 +- .../trail_ruins/buildings/group_upper_4.nbt | 4 +- .../trail_ruins/buildings/group_upper_5.nbt | 4 +- .../trail_ruins/buildings/large_room_1.nbt | 4 +- .../trail_ruins/buildings/large_room_2.nbt | 4 +- .../trail_ruins/buildings/large_room_3.nbt | 4 +- .../trail_ruins/buildings/large_room_4.nbt | 4 +- .../trail_ruins/buildings/large_room_5.nbt | 4 +- .../trail_ruins/buildings/one_room_1.nbt | 4 +- .../trail_ruins/buildings/one_room_2.nbt | 4 +- .../trail_ruins/buildings/one_room_3.nbt | 4 +- .../trail_ruins/buildings/one_room_4.nbt | 4 +- .../trail_ruins/buildings/one_room_5.nbt | 4 +- .../structure/trail_ruins/decor/decor_1.nbt | 4 +- .../structure/trail_ruins/decor/decor_2.nbt | 4 +- .../structure/trail_ruins/decor/decor_3.nbt | 4 +- .../structure/trail_ruins/decor/decor_4.nbt | 4 +- .../structure/trail_ruins/decor/decor_5.nbt | 4 +- .../structure/trail_ruins/decor/decor_6.nbt | 4 +- .../structure/trail_ruins/decor/decor_7.nbt | 4 +- .../trail_ruins/roads/long_road_end.nbt | 4 +- .../trail_ruins/roads/road_end_1.nbt | 4 +- .../trail_ruins/roads/road_section_1.nbt | 4 +- .../trail_ruins/roads/road_section_2.nbt | 4 +- .../trail_ruins/roads/road_section_3.nbt | 4 +- .../trail_ruins/roads/road_section_4.nbt | 4 +- .../trail_ruins/roads/road_spacer_1.nbt | 4 +- .../structure/trail_ruins/tower/hall_1.nbt | 4 +- .../structure/trail_ruins/tower/hall_2.nbt | 4 +- .../structure/trail_ruins/tower/hall_3.nbt | 4 +- .../structure/trail_ruins/tower/hall_4.nbt | 4 +- .../structure/trail_ruins/tower/hall_5.nbt | 4 +- .../trail_ruins/tower/large_hall_1.nbt | 4 +- .../trail_ruins/tower/large_hall_2.nbt | 4 +- .../trail_ruins/tower/large_hall_3.nbt | 4 +- .../trail_ruins/tower/large_hall_4.nbt | 4 +- .../trail_ruins/tower/large_hall_5.nbt | 4 +- .../trail_ruins/tower/one_room_1.nbt | 4 +- .../trail_ruins/tower/one_room_2.nbt | 4 +- .../trail_ruins/tower/one_room_3.nbt | 4 +- .../trail_ruins/tower/one_room_4.nbt | 4 +- .../trail_ruins/tower/one_room_5.nbt | 4 +- .../trail_ruins/tower/platform_1.nbt | 4 +- .../trail_ruins/tower/platform_2.nbt | 4 +- .../trail_ruins/tower/platform_3.nbt | 4 +- .../trail_ruins/tower/platform_4.nbt | 4 +- .../trail_ruins/tower/platform_5.nbt | 4 +- .../structure/trail_ruins/tower/stable_1.nbt | 4 +- .../structure/trail_ruins/tower/stable_2.nbt | 4 +- .../structure/trail_ruins/tower/stable_3.nbt | 4 +- .../structure/trail_ruins/tower/stable_4.nbt | 4 +- .../structure/trail_ruins/tower/stable_5.nbt | 2 +- .../structure/trail_ruins/tower/tower_1.nbt | 4 +- .../structure/trail_ruins/tower/tower_2.nbt | 4 +- .../structure/trail_ruins/tower/tower_3.nbt | 4 +- .../structure/trail_ruins/tower/tower_4.nbt | 4 +- .../structure/trail_ruins/tower/tower_5.nbt | 4 +- .../trail_ruins/tower/tower_top_1.nbt | 4 +- .../trail_ruins/tower/tower_top_2.nbt | 4 +- .../trail_ruins/tower/tower_top_3.nbt | 4 +- .../trail_ruins/tower/tower_top_4.nbt | 4 +- .../trail_ruins/tower/tower_top_5.nbt | 4 +- .../chamber/addon/c1_breeze.nbt | 4 +- .../chamber/addon/full_corner_column.nbt | 4 +- .../chamber/addon/full_stacked_walkway.nbt | 4 +- .../chamber/addon/full_stacked_walkway_2.nbt | 4 +- .../chamber/addon/grate_bridge.nbt | 4 +- .../chamber/addon/hanging_platform.nbt | 4 +- .../chamber/addon/lower_staircase_down.nbt | 4 +- .../chamber/addon/short_grate_platform.nbt | 4 +- .../chamber/addon/short_platform.nbt | 4 +- .../chamber/addon/walkway_with_bridge_1.nbt | 4 +- .../trial_chambers/chamber/assembly.nbt | 4 +- .../chamber/assembly/cover_1.nbt | 4 +- .../chamber/assembly/cover_2.nbt | 4 +- .../chamber/assembly/cover_3.nbt | 4 +- .../chamber/assembly/cover_4.nbt | 4 +- .../chamber/assembly/cover_5.nbt | 4 +- .../chamber/assembly/cover_6.nbt | 4 +- .../chamber/assembly/cover_7.nbt | 4 +- .../chamber/assembly/full_column.nbt | 4 +- .../chamber/assembly/hanging_1.nbt | 4 +- .../chamber/assembly/hanging_2.nbt | 4 +- .../chamber/assembly/hanging_3.nbt | 4 +- .../chamber/assembly/hanging_4.nbt | 4 +- .../chamber/assembly/hanging_5.nbt | 4 +- .../chamber/assembly/left_staircase_1.nbt | 4 +- .../chamber/assembly/left_staircase_2.nbt | 4 +- .../chamber/assembly/left_staircase_3.nbt | 4 +- .../chamber/assembly/platform_1.nbt | 4 +- .../chamber/assembly/right_staircase_1.nbt | 4 +- .../chamber/assembly/right_staircase_2.nbt | 4 +- .../chamber/assembly/right_staircase_3.nbt | 4 +- .../chamber/assembly/spawner_1.nbt | 4 +- .../trial_chambers/chamber/chamber_1.nbt | 4 +- .../trial_chambers/chamber/chamber_2.nbt | 4 +- .../trial_chambers/chamber/chamber_4.nbt | 4 +- .../trial_chambers/chamber/chamber_8.nbt | 4 +- .../trial_chambers/chamber/entrance_cap.nbt | 4 +- .../trial_chambers/chamber/eruption.nbt | 4 +- .../chamber/eruption/breeze_slice_1.nbt | 4 +- .../chamber/eruption/center_1.nbt | 4 +- .../chamber/eruption/quadrant_1.nbt | 4 +- .../chamber/eruption/quadrant_2.nbt | 4 +- .../chamber/eruption/quadrant_3.nbt | 4 +- .../chamber/eruption/quadrant_4.nbt | 4 +- .../chamber/eruption/quadrant_5.nbt | 4 +- .../chamber/eruption/slice_1.nbt | 4 +- .../chamber/eruption/slice_2.nbt | 4 +- .../chamber/eruption/slice_3.nbt | 4 +- .../trial_chambers/chamber/pedestal.nbt | 4 +- .../chamber/pedestal/center_1.nbt | 4 +- .../chamber/pedestal/ominous_slice_1.nbt | 4 +- .../chamber/pedestal/quadrant_1.nbt | 4 +- .../chamber/pedestal/quadrant_2.nbt | 4 +- .../chamber/pedestal/quadrant_3.nbt | 4 +- .../chamber/pedestal/slice_1.nbt | 4 +- .../chamber/pedestal/slice_2.nbt | 4 +- .../chamber/pedestal/slice_3.nbt | 4 +- .../chamber/pedestal/slice_4.nbt | 4 +- .../chamber/pedestal/slice_5.nbt | 4 +- .../trial_chambers/chamber/slanted.nbt | 4 +- .../trial_chambers/chamber/slanted/center.nbt | 4 +- .../chamber/slanted/hallway_1.nbt | 4 +- .../chamber/slanted/hallway_2.nbt | 4 +- .../chamber/slanted/hallway_3.nbt | 4 +- .../chamber/slanted/hallway_4.nbt | 3 - .../chamber/slanted/hallway_5.nbt | 3 - .../chamber/slanted/ominous_upper_arm_1.nbt | 4 +- .../chamber/slanted/quadrant_1.nbt | 4 +- .../chamber/slanted/quadrant_2.nbt | 4 +- .../chamber/slanted/quadrant_3.nbt | 4 +- .../chamber/slanted/quadrant_4.nbt | 4 +- .../trial_chambers/chamber/slanted/ramp_1.nbt | 4 +- .../trial_chambers/chamber/slanted/ramp_2.nbt | 4 +- .../trial_chambers/chamber/slanted/ramp_3.nbt | 4 +- .../trial_chambers/chamber/slanted/ramp_4.nbt | 4 +- .../chests/connectors/supply.nbt | 4 +- .../trial_chambers/chests/supply.nbt | 4 +- .../corridor/addon/arrow_dispenser.nbt | 4 +- .../corridor/addon/bridge_lower.nbt | 4 +- .../corridor/addon/chandelier_upper.nbt | 4 +- .../corridor/addon/decoration_upper.nbt | 4 +- .../corridor/addon/display_1.nbt | 4 +- .../corridor/addon/display_2.nbt | 4 +- .../corridor/addon/display_3.nbt | 4 +- .../corridor/addon/head_upper.nbt | 4 +- .../corridor/addon/ladder_to_middle.nbt | 4 +- .../corridor/addon/open_walkway.nbt | 4 +- .../corridor/addon/open_walkway_upper.nbt | 4 +- .../corridor/addon/reward_upper.nbt | 4 +- .../corridor/addon/staircase.nbt | 4 +- .../trial_chambers/corridor/addon/wall.nbt | 4 +- .../corridor/addon/walled_walkway.nbt | 4 +- .../corridor/atrium/bogged_relief.nbt | 4 +- .../corridor/atrium/breeze_relief.nbt | 4 +- .../corridor/atrium/grand_staircase_1.nbt | 4 +- .../corridor/atrium/grand_staircase_2.nbt | 4 +- .../corridor/atrium/grand_staircase_3.nbt | 4 +- .../corridor/atrium/spider_relief.nbt | 4 +- .../corridor/atrium/spiral_relief.nbt | 4 +- .../trial_chambers/corridor/atrium_1.nbt | 4 +- .../trial_chambers/corridor/end_1.nbt | 4 +- .../trial_chambers/corridor/end_2.nbt | 4 +- .../trial_chambers/corridor/entrance_1.nbt | 4 +- .../trial_chambers/corridor/entrance_2.nbt | 4 +- .../trial_chambers/corridor/entrance_3.nbt | 4 +- .../trial_chambers/corridor/first_plate.nbt | 4 +- .../trial_chambers/corridor/second_plate.nbt | 4 +- .../trial_chambers/corridor/straight_1.nbt | 4 +- .../trial_chambers/corridor/straight_2.nbt | 4 +- .../trial_chambers/corridor/straight_3.nbt | 4 +- .../trial_chambers/corridor/straight_4.nbt | 4 +- .../trial_chambers/corridor/straight_5.nbt | 4 +- .../trial_chambers/corridor/straight_6.nbt | 4 +- .../trial_chambers/corridor/straight_7.nbt | 4 +- .../trial_chambers/corridor/straight_8.nbt | 4 +- .../structure/trial_chambers/decor/barrel.nbt | 4 +- .../trial_chambers/decor/black_bed.nbt | 3 + .../trial_chambers/decor/blue_bed.nbt | 3 + .../trial_chambers/decor/brown_bed.nbt | 3 + .../trial_chambers/decor/candle_1.nbt | 4 +- .../trial_chambers/decor/candle_2.nbt | 4 +- .../trial_chambers/decor/candle_3.nbt | 4 +- .../trial_chambers/decor/candle_4.nbt | 4 +- .../trial_chambers/decor/cyan_bed.nbt | 3 + .../trial_chambers/decor/dead_bush_pot.nbt | 4 +- .../trial_chambers/decor/disposal.nbt | 3 + .../trial_chambers/decor/empty_pot.nbt | 4 +- .../trial_chambers/decor/flow_pot.nbt | 4 +- .../trial_chambers/decor/gray_bed.nbt | 3 + .../trial_chambers/decor/green_bed.nbt | 3 + .../trial_chambers/decor/guster_pot.nbt | 4 +- .../trial_chambers/decor/light_blue_bed.nbt | 3 + .../trial_chambers/decor/light_gray_bed.nbt | 3 + .../trial_chambers/decor/lime_bed.nbt | 3 + .../trial_chambers/decor/magenta_bed.nbt | 3 + .../trial_chambers/decor/orange_bed.nbt | 3 + .../trial_chambers/decor/pink_bed.nbt | 3 + .../trial_chambers/decor/purple_bed.nbt | 3 + .../trial_chambers/decor/red_bed.nbt | 3 + .../trial_chambers/decor/scrape_pot.nbt | 4 +- .../trial_chambers/decor/undecorated_pot.nbt | 4 +- .../trial_chambers/decor/white_bed.nbt | 3 + .../trial_chambers/decor/yellow_bed.nbt | 3 + .../trial_chambers/dispensers/chamber.nbt | 4 +- .../dispensers/floor_dispenser.nbt | 4 +- .../dispensers/wall_dispenser.nbt | 4 +- .../trial_chambers/hallway/cache_1.nbt | 4 +- .../hallway/corner_staircase.nbt | 4 +- .../hallway/corner_staircase_down.nbt | 4 +- .../hallway/corridor_connector_1.nbt | 4 +- .../trial_chambers/hallway/encounter_1.nbt | 3 + .../trial_chambers/hallway/encounter_2.nbt | 3 + .../trial_chambers/hallway/encounter_3.nbt | 3 + .../trial_chambers/hallway/encounter_4.nbt | 3 + .../trial_chambers/hallway/encounter_5.nbt | 3 + .../trial_chambers/hallway/left_corner.nbt | 4 +- .../hallway/long_straight_staircase.nbt | 4 +- .../hallway/long_straight_staircase_down.nbt | 4 +- .../hallway/lower_hallway_connector.nbt | 4 +- .../trial_chambers/hallway/right_corner.nbt | 4 +- .../trial_chambers/hallway/rubble.nbt | 4 +- .../trial_chambers/hallway/rubble_chamber.nbt | 4 +- .../hallway/rubble_chamber_thin.nbt | 4 +- .../trial_chambers/hallway/rubble_thin.nbt | 4 +- .../trial_chambers/hallway/straight.nbt | 4 +- .../hallway/straight_staircase.nbt | 4 +- .../hallway/straight_staircase_down.nbt | 4 +- .../hallway/trapped_staircase.nbt | 3 + .../hallway/upper_hallway_connector.nbt | 4 +- .../intersection/intersection_1.nbt | 4 +- .../intersection/intersection_2.nbt | 4 +- .../intersection/intersection_3.nbt | 4 +- .../trial_chambers/reward/ominous_vault.nbt | 4 +- .../structure/trial_chambers/reward/vault.nbt | 4 +- .../trial_chambers/spawner/breeze/breeze.nbt | 4 +- .../spawner/connectors/breeze.nbt | 4 +- .../spawner/connectors/melee.nbt | 4 +- .../spawner/connectors/ranged.nbt | 4 +- .../spawner/connectors/slow_ranged.nbt | 4 +- .../spawner/connectors/small_melee.nbt | 4 +- .../trial_chambers/spawner/melee/husk.nbt | 4 +- .../trial_chambers/spawner/melee/spider.nbt | 4 +- .../trial_chambers/spawner/melee/zombie.nbt | 4 +- .../spawner/ranged/poison_skeleton.nbt | 4 +- .../spawner/ranged/skeleton.nbt | 4 +- .../trial_chambers/spawner/ranged/stray.nbt | 4 +- .../spawner/slow_ranged/poison_skeleton.nbt | 4 +- .../spawner/slow_ranged/skeleton.nbt | 4 +- .../spawner/slow_ranged/stray.nbt | 4 +- .../spawner/small_melee/baby_zombie.nbt | 4 +- .../spawner/small_melee/cave_spider.nbt | 4 +- .../spawner/small_melee/silverfish.nbt | 4 +- .../spawner/small_melee/slime.nbt | 4 +- .../structure/underwater_ruin/big_brick_1.nbt | 4 +- .../structure/underwater_ruin/big_brick_2.nbt | 4 +- .../structure/underwater_ruin/big_brick_3.nbt | 4 +- .../structure/underwater_ruin/big_brick_8.nbt | 4 +- .../underwater_ruin/big_cracked_1.nbt | 4 +- .../underwater_ruin/big_cracked_2.nbt | 4 +- .../underwater_ruin/big_cracked_3.nbt | 4 +- .../underwater_ruin/big_cracked_8.nbt | 4 +- .../structure/underwater_ruin/big_mossy_1.nbt | 4 +- .../structure/underwater_ruin/big_mossy_2.nbt | 4 +- .../structure/underwater_ruin/big_mossy_3.nbt | 4 +- .../structure/underwater_ruin/big_mossy_8.nbt | 4 +- .../structure/underwater_ruin/big_warm_4.nbt | 4 +- .../structure/underwater_ruin/big_warm_5.nbt | 4 +- .../structure/underwater_ruin/big_warm_6.nbt | 4 +- .../structure/underwater_ruin/big_warm_7.nbt | 4 +- .../structure/underwater_ruin/brick_1.nbt | 4 +- .../structure/underwater_ruin/brick_2.nbt | 4 +- .../structure/underwater_ruin/brick_3.nbt | 4 +- .../structure/underwater_ruin/brick_4.nbt | 4 +- .../structure/underwater_ruin/brick_5.nbt | 4 +- .../structure/underwater_ruin/brick_6.nbt | 4 +- .../structure/underwater_ruin/brick_7.nbt | 4 +- .../structure/underwater_ruin/brick_8.nbt | 4 +- .../structure/underwater_ruin/cracked_1.nbt | 4 +- .../structure/underwater_ruin/cracked_2.nbt | 4 +- .../structure/underwater_ruin/cracked_3.nbt | 4 +- .../structure/underwater_ruin/cracked_4.nbt | 4 +- .../structure/underwater_ruin/cracked_5.nbt | 4 +- .../structure/underwater_ruin/cracked_6.nbt | 4 +- .../structure/underwater_ruin/cracked_7.nbt | 4 +- .../structure/underwater_ruin/cracked_8.nbt | 4 +- .../structure/underwater_ruin/mossy_1.nbt | 4 +- .../structure/underwater_ruin/mossy_2.nbt | 4 +- .../structure/underwater_ruin/mossy_3.nbt | 4 +- .../structure/underwater_ruin/mossy_4.nbt | 4 +- .../structure/underwater_ruin/mossy_5.nbt | 4 +- .../structure/underwater_ruin/mossy_6.nbt | 4 +- .../structure/underwater_ruin/mossy_7.nbt | 4 +- .../structure/underwater_ruin/mossy_8.nbt | 4 +- .../structure/underwater_ruin/warm_1.nbt | 4 +- .../structure/underwater_ruin/warm_2.nbt | 4 +- .../structure/underwater_ruin/warm_3.nbt | 4 +- .../structure/underwater_ruin/warm_4.nbt | 4 +- .../structure/underwater_ruin/warm_5.nbt | 4 +- .../structure/underwater_ruin/warm_6.nbt | 4 +- .../structure/underwater_ruin/warm_7.nbt | 4 +- .../structure/underwater_ruin/warm_8.nbt | 4 +- .../village/common/animals/cat_black.nbt | 4 +- .../village/common/animals/cat_british.nbt | 4 +- .../village/common/animals/cat_calico.nbt | 4 +- .../village/common/animals/cat_jellie.nbt | 4 +- .../village/common/animals/cat_persian.nbt | 4 +- .../village/common/animals/cat_ragdoll.nbt | 4 +- .../village/common/animals/cat_red.nbt | 4 +- .../village/common/animals/cat_siamese.nbt | 4 +- .../village/common/animals/cat_tabby.nbt | 4 +- .../village/common/animals/cat_white.nbt | 4 +- .../village/common/animals/cows_1.nbt | 4 +- .../village/common/animals/horses_1.nbt | 4 +- .../village/common/animals/horses_2.nbt | 4 +- .../village/common/animals/horses_3.nbt | 4 +- .../village/common/animals/horses_4.nbt | 4 +- .../village/common/animals/horses_5.nbt | 4 +- .../village/common/animals/pigs_1.nbt | 4 +- .../village/common/animals/sheep_1.nbt | 4 +- .../village/common/animals/sheep_2.nbt | 4 +- .../structure/village/common/iron_golem.nbt | 4 +- .../structure/village/common/well_bottom.nbt | 4 +- .../structure/village/decays/grass_11x13.nbt | 4 +- .../structure/village/decays/grass_16x16.nbt | 4 +- .../structure/village/decays/grass_9x9.nbt | 4 +- .../structure/village/desert/camel_spawn.nbt | 4 +- .../village/desert/desert_lamp_1.nbt | 4 +- .../desert/houses/desert_animal_pen_1.nbt | 4 +- .../desert/houses/desert_animal_pen_2.nbt | 4 +- .../desert/houses/desert_armorer_1.nbt | 4 +- .../desert/houses/desert_butcher_shop_1.nbt | 4 +- .../houses/desert_cartographer_house_1.nbt | 4 +- .../village/desert/houses/desert_farm_1.nbt | 4 +- .../village/desert/houses/desert_farm_2.nbt | 4 +- .../village/desert/houses/desert_fisher_1.nbt | 4 +- .../desert/houses/desert_fletcher_house_1.nbt | 4 +- .../desert/houses/desert_large_farm_1.nbt | 4 +- .../desert/houses/desert_library_1.nbt | 4 +- .../village/desert/houses/desert_mason_1.nbt | 4 +- .../desert/houses/desert_medium_house_1.nbt | 4 +- .../desert/houses/desert_medium_house_2.nbt | 4 +- .../desert/houses/desert_shepherd_house_1.nbt | 4 +- .../desert/houses/desert_small_house_1.nbt | 4 +- .../desert/houses/desert_small_house_2.nbt | 4 +- .../desert/houses/desert_small_house_3.nbt | 4 +- .../desert/houses/desert_small_house_4.nbt | 4 +- .../desert/houses/desert_small_house_5.nbt | 4 +- .../desert/houses/desert_small_house_6.nbt | 4 +- .../desert/houses/desert_small_house_7.nbt | 4 +- .../desert/houses/desert_small_house_8.nbt | 4 +- .../desert/houses/desert_tannery_1.nbt | 4 +- .../village/desert/houses/desert_temple_1.nbt | 4 +- .../village/desert/houses/desert_temple_2.nbt | 4 +- .../desert/houses/desert_tool_smith_1.nbt | 4 +- .../desert/houses/desert_weaponsmith_1.nbt | 4 +- .../village/desert/streets/corner_01.nbt | 4 +- .../village/desert/streets/corner_02.nbt | 4 +- .../village/desert/streets/crossroad_01.nbt | 4 +- .../village/desert/streets/crossroad_02.nbt | 4 +- .../village/desert/streets/crossroad_03.nbt | 4 +- .../village/desert/streets/square_01.nbt | 4 +- .../village/desert/streets/square_02.nbt | 4 +- .../village/desert/streets/straight_01.nbt | 4 +- .../village/desert/streets/straight_02.nbt | 4 +- .../village/desert/streets/straight_03.nbt | 4 +- .../village/desert/streets/turn_01.nbt | 4 +- .../desert/terminators/terminator_01.nbt | 4 +- .../desert/terminators/terminator_02.nbt | 4 +- .../town_centers/desert_meeting_point_1.nbt | 4 +- .../town_centers/desert_meeting_point_2.nbt | 4 +- .../town_centers/desert_meeting_point_3.nbt | 4 +- .../village/desert/villagers/baby.nbt | 2 +- .../village/desert/villagers/nitwit.nbt | 2 +- .../village/desert/villagers/unemployed.nbt | 4 +- .../zombie/houses/desert_medium_house_1.nbt | 4 +- .../zombie/houses/desert_medium_house_2.nbt | 4 +- .../zombie/houses/desert_small_house_1.nbt | 4 +- .../zombie/houses/desert_small_house_2.nbt | 4 +- .../zombie/houses/desert_small_house_3.nbt | 4 +- .../zombie/houses/desert_small_house_4.nbt | 4 +- .../zombie/houses/desert_small_house_5.nbt | 4 +- .../zombie/houses/desert_small_house_6.nbt | 4 +- .../zombie/houses/desert_small_house_7.nbt | 4 +- .../zombie/houses/desert_small_house_8.nbt | 4 +- .../desert/zombie/streets/corner_01.nbt | 4 +- .../desert/zombie/streets/corner_02.nbt | 4 +- .../desert/zombie/streets/crossroad_01.nbt | 4 +- .../desert/zombie/streets/crossroad_02.nbt | 4 +- .../desert/zombie/streets/crossroad_03.nbt | 4 +- .../desert/zombie/streets/square_01.nbt | 4 +- .../desert/zombie/streets/square_02.nbt | 4 +- .../desert/zombie/streets/straight_01.nbt | 4 +- .../desert/zombie/streets/straight_02.nbt | 4 +- .../desert/zombie/streets/straight_03.nbt | 4 +- .../village/desert/zombie/streets/turn_01.nbt | 4 +- .../zombie/terminators/terminator_02.nbt | 4 +- .../town_centers/desert_meeting_point_1.nbt | 4 +- .../town_centers/desert_meeting_point_2.nbt | 4 +- .../town_centers/desert_meeting_point_3.nbt | 4 +- .../desert/zombie/villagers/nitwit.nbt | 2 +- .../desert/zombie/villagers/unemployed.nbt | 4 +- .../plains/houses/plains_accessory_1.nbt | 4 +- .../plains/houses/plains_animal_pen_1.nbt | 4 +- .../plains/houses/plains_animal_pen_2.nbt | 4 +- .../plains/houses/plains_animal_pen_3.nbt | 4 +- .../plains/houses/plains_armorer_house_1.nbt | 4 +- .../plains/houses/plains_big_house_1.nbt | 4 +- .../plains/houses/plains_butcher_shop_1.nbt | 4 +- .../plains/houses/plains_butcher_shop_2.nbt | 4 +- .../plains/houses/plains_cartographer_1.nbt | 4 +- .../plains/houses/plains_fisher_cottage_1.nbt | 4 +- .../plains/houses/plains_fletcher_house_1.nbt | 4 +- .../plains/houses/plains_large_farm_1.nbt | 4 +- .../plains/houses/plains_library_1.nbt | 4 +- .../plains/houses/plains_library_2.nbt | 4 +- .../plains/houses/plains_masons_house_1.nbt | 4 +- .../plains/houses/plains_medium_house_1.nbt | 4 +- .../plains/houses/plains_medium_house_2.nbt | 4 +- .../plains/houses/plains_meeting_point_4.nbt | 4 +- .../plains/houses/plains_meeting_point_5.nbt | 4 +- .../houses/plains_shepherds_house_1.nbt | 4 +- .../plains/houses/plains_small_farm_1.nbt | 4 +- .../plains/houses/plains_small_house_1.nbt | 4 +- .../plains/houses/plains_small_house_2.nbt | 4 +- .../plains/houses/plains_small_house_3.nbt | 4 +- .../plains/houses/plains_small_house_4.nbt | 4 +- .../plains/houses/plains_small_house_5.nbt | 4 +- .../plains/houses/plains_small_house_6.nbt | 4 +- .../plains/houses/plains_small_house_7.nbt | 4 +- .../plains/houses/plains_small_house_8.nbt | 4 +- .../village/plains/houses/plains_stable_1.nbt | 4 +- .../village/plains/houses/plains_stable_2.nbt | 4 +- .../plains/houses/plains_tannery_1.nbt | 4 +- .../village/plains/houses/plains_temple_3.nbt | 4 +- .../village/plains/houses/plains_temple_4.nbt | 4 +- .../plains/houses/plains_tool_smith_1.nbt | 4 +- .../plains/houses/plains_weaponsmith_1.nbt | 4 +- .../village/plains/plains_lamp_1.nbt | 4 +- .../village/plains/streets/corner_01.nbt | 4 +- .../village/plains/streets/corner_02.nbt | 4 +- .../village/plains/streets/corner_03.nbt | 4 +- .../village/plains/streets/crossroad_01.nbt | 4 +- .../village/plains/streets/crossroad_02.nbt | 4 +- .../village/plains/streets/crossroad_03.nbt | 4 +- .../village/plains/streets/crossroad_04.nbt | 4 +- .../village/plains/streets/crossroad_05.nbt | 4 +- .../village/plains/streets/crossroad_06.nbt | 4 +- .../village/plains/streets/straight_01.nbt | 4 +- .../village/plains/streets/straight_02.nbt | 4 +- .../village/plains/streets/straight_03.nbt | 4 +- .../village/plains/streets/straight_04.nbt | 4 +- .../village/plains/streets/straight_05.nbt | 4 +- .../village/plains/streets/straight_06.nbt | 4 +- .../village/plains/streets/turn_01.nbt | 4 +- .../plains/terminators/terminator_01.nbt | 4 +- .../plains/terminators/terminator_02.nbt | 4 +- .../plains/terminators/terminator_03.nbt | 4 +- .../plains/terminators/terminator_04.nbt | 4 +- .../town_centers/plains_fountain_01.nbt | 4 +- .../town_centers/plains_meeting_point_1.nbt | 4 +- .../town_centers/plains_meeting_point_2.nbt | 4 +- .../town_centers/plains_meeting_point_3.nbt | 4 +- .../village/plains/villagers/baby.nbt | 4 +- .../village/plains/villagers/nitwit.nbt | 2 +- .../village/plains/villagers/unemployed.nbt | 2 +- .../zombie/houses/plains_animal_pen_3.nbt | 4 +- .../zombie/houses/plains_big_house_1.nbt | 4 +- .../zombie/houses/plains_butcher_shop_2.nbt | 4 +- .../zombie/houses/plains_fletcher_house_1.nbt | 4 +- .../zombie/houses/plains_medium_house_1.nbt | 4 +- .../zombie/houses/plains_medium_house_2.nbt | 4 +- .../zombie/houses/plains_meeting_point_4.nbt | 4 +- .../zombie/houses/plains_meeting_point_5.nbt | 4 +- .../houses/plains_shepherds_house_1.nbt | 4 +- .../zombie/houses/plains_small_house_1.nbt | 4 +- .../zombie/houses/plains_small_house_2.nbt | 4 +- .../zombie/houses/plains_small_house_3.nbt | 4 +- .../zombie/houses/plains_small_house_4.nbt | 4 +- .../zombie/houses/plains_small_house_5.nbt | 4 +- .../zombie/houses/plains_small_house_6.nbt | 4 +- .../zombie/houses/plains_small_house_7.nbt | 4 +- .../zombie/houses/plains_small_house_8.nbt | 4 +- .../plains/zombie/houses/plains_stable_1.nbt | 2 +- .../plains/zombie/streets/corner_01.nbt | 4 +- .../plains/zombie/streets/corner_02.nbt | 4 +- .../plains/zombie/streets/corner_03.nbt | 4 +- .../plains/zombie/streets/crossroad_01.nbt | 4 +- .../plains/zombie/streets/crossroad_02.nbt | 4 +- .../plains/zombie/streets/crossroad_03.nbt | 4 +- .../plains/zombie/streets/crossroad_04.nbt | 4 +- .../plains/zombie/streets/crossroad_05.nbt | 4 +- .../plains/zombie/streets/crossroad_06.nbt | 4 +- .../plains/zombie/streets/straight_01.nbt | 4 +- .../plains/zombie/streets/straight_02.nbt | 4 +- .../plains/zombie/streets/straight_03.nbt | 4 +- .../plains/zombie/streets/straight_04.nbt | 4 +- .../plains/zombie/streets/straight_05.nbt | 4 +- .../plains/zombie/streets/straight_06.nbt | 4 +- .../village/plains/zombie/streets/turn_01.nbt | 4 +- .../town_centers/plains_fountain_01.nbt | 4 +- .../town_centers/plains_meeting_point_1.nbt | 4 +- .../town_centers/plains_meeting_point_2.nbt | 4 +- .../town_centers/plains_meeting_point_3.nbt | 4 +- .../plains/zombie/villagers/nitwit.nbt | 4 +- .../plains/zombie/villagers/unemployed.nbt | 2 +- .../savanna/houses/savanna_animal_pen_1.nbt | 4 +- .../savanna/houses/savanna_animal_pen_2.nbt | 4 +- .../savanna/houses/savanna_animal_pen_3.nbt | 4 +- .../savanna/houses/savanna_armorer_1.nbt | 4 +- .../houses/savanna_butchers_shop_1.nbt | 4 +- .../houses/savanna_butchers_shop_2.nbt | 4 +- .../savanna/houses/savanna_cartographer_1.nbt | 4 +- .../houses/savanna_fisher_cottage_1.nbt | 4 +- .../houses/savanna_fletcher_house_1.nbt | 4 +- .../savanna/houses/savanna_large_farm_1.nbt | 4 +- .../savanna/houses/savanna_large_farm_2.nbt | 4 +- .../savanna/houses/savanna_library_1.nbt | 4 +- .../savanna/houses/savanna_mason_1.nbt | 4 +- .../savanna/houses/savanna_medium_house_1.nbt | 4 +- .../savanna/houses/savanna_medium_house_2.nbt | 4 +- .../savanna/houses/savanna_shepherd_1.nbt | 4 +- .../savanna/houses/savanna_small_farm.nbt | 4 +- .../savanna/houses/savanna_small_house_1.nbt | 4 +- .../savanna/houses/savanna_small_house_2.nbt | 4 +- .../savanna/houses/savanna_small_house_3.nbt | 4 +- .../savanna/houses/savanna_small_house_4.nbt | 4 +- .../savanna/houses/savanna_small_house_5.nbt | 4 +- .../savanna/houses/savanna_small_house_6.nbt | 4 +- .../savanna/houses/savanna_small_house_7.nbt | 4 +- .../savanna/houses/savanna_small_house_8.nbt | 4 +- .../savanna/houses/savanna_tannery_1.nbt | 4 +- .../savanna/houses/savanna_temple_1.nbt | 4 +- .../savanna/houses/savanna_temple_2.nbt | 4 +- .../savanna/houses/savanna_tool_smith_1.nbt | 4 +- .../savanna/houses/savanna_weaponsmith_1.nbt | 4 +- .../savanna/houses/savanna_weaponsmith_2.nbt | 4 +- .../village/savanna/savanna_lamp_post_01.nbt | 4 +- .../village/savanna/streets/corner_01.nbt | 4 +- .../village/savanna/streets/corner_03.nbt | 4 +- .../village/savanna/streets/crossroad_02.nbt | 4 +- .../village/savanna/streets/crossroad_03.nbt | 4 +- .../village/savanna/streets/crossroad_04.nbt | 4 +- .../village/savanna/streets/crossroad_05.nbt | 4 +- .../village/savanna/streets/crossroad_06.nbt | 4 +- .../village/savanna/streets/crossroad_07.nbt | 4 +- .../village/savanna/streets/split_01.nbt | 4 +- .../village/savanna/streets/split_02.nbt | 4 +- .../village/savanna/streets/straight_02.nbt | 4 +- .../village/savanna/streets/straight_04.nbt | 4 +- .../village/savanna/streets/straight_05.nbt | 4 +- .../village/savanna/streets/straight_06.nbt | 4 +- .../village/savanna/streets/straight_08.nbt | 4 +- .../village/savanna/streets/straight_09.nbt | 4 +- .../village/savanna/streets/straight_10.nbt | 4 +- .../village/savanna/streets/straight_11.nbt | 4 +- .../village/savanna/streets/turn_01.nbt | 4 +- .../savanna/terminators/terminator_05.nbt | 4 +- .../town_centers/savanna_meeting_point_1.nbt | 4 +- .../town_centers/savanna_meeting_point_2.nbt | 4 +- .../town_centers/savanna_meeting_point_3.nbt | 4 +- .../town_centers/savanna_meeting_point_4.nbt | 4 +- .../village/savanna/villagers/baby.nbt | 2 +- .../village/savanna/villagers/nitwit.nbt | 4 +- .../village/savanna/villagers/unemployed.nbt | 2 +- .../zombie/houses/savanna_animal_pen_2.nbt | 4 +- .../zombie/houses/savanna_animal_pen_3.nbt | 4 +- .../zombie/houses/savanna_large_farm_2.nbt | 4 +- .../zombie/houses/savanna_medium_house_1.nbt | 4 +- .../zombie/houses/savanna_medium_house_2.nbt | 4 +- .../zombie/houses/savanna_small_house_1.nbt | 4 +- .../zombie/houses/savanna_small_house_2.nbt | 4 +- .../zombie/houses/savanna_small_house_3.nbt | 4 +- .../zombie/houses/savanna_small_house_4.nbt | 4 +- .../zombie/houses/savanna_small_house_5.nbt | 4 +- .../zombie/houses/savanna_small_house_6.nbt | 4 +- .../zombie/houses/savanna_small_house_7.nbt | 4 +- .../zombie/houses/savanna_small_house_8.nbt | 4 +- .../savanna/zombie/streets/corner_01.nbt | 4 +- .../savanna/zombie/streets/corner_03.nbt | 4 +- .../savanna/zombie/streets/crossroad_02.nbt | 4 +- .../savanna/zombie/streets/crossroad_03.nbt | 4 +- .../savanna/zombie/streets/crossroad_04.nbt | 4 +- .../savanna/zombie/streets/crossroad_05.nbt | 4 +- .../savanna/zombie/streets/crossroad_06.nbt | 4 +- .../savanna/zombie/streets/crossroad_07.nbt | 4 +- .../savanna/zombie/streets/split_01.nbt | 4 +- .../savanna/zombie/streets/split_02.nbt | 4 +- .../savanna/zombie/streets/straight_02.nbt | 4 +- .../savanna/zombie/streets/straight_04.nbt | 4 +- .../savanna/zombie/streets/straight_05.nbt | 4 +- .../savanna/zombie/streets/straight_06.nbt | 2 +- .../savanna/zombie/streets/straight_08.nbt | 4 +- .../savanna/zombie/streets/straight_09.nbt | 4 +- .../savanna/zombie/streets/straight_10.nbt | 4 +- .../savanna/zombie/streets/straight_11.nbt | 4 +- .../savanna/zombie/streets/turn_01.nbt | 4 +- .../zombie/terminators/terminator_05.nbt | 4 +- .../town_centers/savanna_meeting_point_1.nbt | 4 +- .../town_centers/savanna_meeting_point_2.nbt | 4 +- .../town_centers/savanna_meeting_point_3.nbt | 4 +- .../town_centers/savanna_meeting_point_4.nbt | 4 +- .../savanna/zombie/villagers/nitwit.nbt | 2 +- .../savanna/zombie/villagers/unemployed.nbt | 2 +- .../snowy/houses/snowy_animal_pen_1.nbt | 4 +- .../snowy/houses/snowy_animal_pen_2.nbt | 4 +- .../snowy/houses/snowy_armorer_house_1.nbt | 4 +- .../snowy/houses/snowy_armorer_house_2.nbt | 4 +- .../snowy/houses/snowy_butchers_shop_1.nbt | 4 +- .../snowy/houses/snowy_butchers_shop_2.nbt | 4 +- .../houses/snowy_cartographer_house_1.nbt | 4 +- .../village/snowy/houses/snowy_farm_1.nbt | 4 +- .../village/snowy/houses/snowy_farm_2.nbt | 4 +- .../snowy/houses/snowy_fisher_cottage.nbt | 4 +- .../snowy/houses/snowy_fletcher_house_1.nbt | 4 +- .../village/snowy/houses/snowy_library_1.nbt | 4 +- .../snowy/houses/snowy_masons_house_1.nbt | 4 +- .../snowy/houses/snowy_masons_house_2.nbt | 4 +- .../snowy/houses/snowy_medium_house_1.nbt | 4 +- .../snowy/houses/snowy_medium_house_2.nbt | 4 +- .../snowy/houses/snowy_medium_house_3.nbt | 4 +- .../snowy/houses/snowy_shepherds_house_1.nbt | 4 +- .../snowy/houses/snowy_small_house_1.nbt | 4 +- .../snowy/houses/snowy_small_house_2.nbt | 4 +- .../snowy/houses/snowy_small_house_3.nbt | 4 +- .../snowy/houses/snowy_small_house_4.nbt | 4 +- .../snowy/houses/snowy_small_house_5.nbt | 4 +- .../snowy/houses/snowy_small_house_6.nbt | 4 +- .../snowy/houses/snowy_small_house_7.nbt | 4 +- .../snowy/houses/snowy_small_house_8.nbt | 4 +- .../village/snowy/houses/snowy_tannery_1.nbt | 4 +- .../village/snowy/houses/snowy_temple_1.nbt | 4 +- .../snowy/houses/snowy_tool_smith_1.nbt | 4 +- .../snowy/houses/snowy_weapon_smith_1.nbt | 4 +- .../village/snowy/snowy_lamp_post_01.nbt | 4 +- .../village/snowy/snowy_lamp_post_02.nbt | 4 +- .../village/snowy/snowy_lamp_post_03.nbt | 4 +- .../village/snowy/streets/corner_01.nbt | 4 +- .../village/snowy/streets/corner_02.nbt | 4 +- .../village/snowy/streets/corner_03.nbt | 4 +- .../village/snowy/streets/crossroad_01.nbt | 4 +- .../village/snowy/streets/crossroad_02.nbt | 4 +- .../village/snowy/streets/crossroad_03.nbt | 4 +- .../village/snowy/streets/crossroad_04.nbt | 4 +- .../village/snowy/streets/crossroad_05.nbt | 4 +- .../village/snowy/streets/crossroad_06.nbt | 4 +- .../village/snowy/streets/square_01.nbt | 4 +- .../village/snowy/streets/straight_01.nbt | 4 +- .../village/snowy/streets/straight_02.nbt | 4 +- .../village/snowy/streets/straight_03.nbt | 4 +- .../village/snowy/streets/straight_04.nbt | 4 +- .../village/snowy/streets/straight_06.nbt | 4 +- .../village/snowy/streets/straight_08.nbt | 4 +- .../village/snowy/streets/turn_01.nbt | 4 +- .../town_centers/snowy_meeting_point_1.nbt | 4 +- .../town_centers/snowy_meeting_point_2.nbt | 4 +- .../town_centers/snowy_meeting_point_3.nbt | 4 +- .../village/snowy/villagers/baby.nbt | 4 +- .../village/snowy/villagers/nitwit.nbt | 2 +- .../village/snowy/villagers/unemployed.nbt | 2 +- .../zombie/houses/snowy_medium_house_1.nbt | 4 +- .../zombie/houses/snowy_medium_house_2.nbt | 4 +- .../zombie/houses/snowy_medium_house_3.nbt | 4 +- .../zombie/houses/snowy_small_house_1.nbt | 4 +- .../zombie/houses/snowy_small_house_2.nbt | 4 +- .../zombie/houses/snowy_small_house_3.nbt | 4 +- .../zombie/houses/snowy_small_house_4.nbt | 4 +- .../zombie/houses/snowy_small_house_5.nbt | 4 +- .../zombie/houses/snowy_small_house_6.nbt | 4 +- .../zombie/houses/snowy_small_house_7.nbt | 4 +- .../zombie/houses/snowy_small_house_8.nbt | 4 +- .../snowy/zombie/streets/corner_01.nbt | 4 +- .../snowy/zombie/streets/corner_02.nbt | 4 +- .../snowy/zombie/streets/corner_03.nbt | 4 +- .../snowy/zombie/streets/crossroad_01.nbt | 4 +- .../snowy/zombie/streets/crossroad_02.nbt | 4 +- .../snowy/zombie/streets/crossroad_03.nbt | 4 +- .../snowy/zombie/streets/crossroad_04.nbt | 4 +- .../snowy/zombie/streets/crossroad_05.nbt | 4 +- .../snowy/zombie/streets/crossroad_06.nbt | 4 +- .../snowy/zombie/streets/square_01.nbt | 4 +- .../snowy/zombie/streets/straight_01.nbt | 4 +- .../snowy/zombie/streets/straight_02.nbt | 4 +- .../snowy/zombie/streets/straight_03.nbt | 4 +- .../snowy/zombie/streets/straight_04.nbt | 4 +- .../snowy/zombie/streets/straight_06.nbt | 4 +- .../snowy/zombie/streets/straight_08.nbt | 4 +- .../village/snowy/zombie/streets/turn_01.nbt | 4 +- .../town_centers/snowy_meeting_point_1.nbt | 4 +- .../town_centers/snowy_meeting_point_2.nbt | 4 +- .../town_centers/snowy_meeting_point_3.nbt | 4 +- .../village/snowy/zombie/villagers/nitwit.nbt | 2 +- .../snowy/zombie/villagers/unemployed.nbt | 2 +- .../taiga/houses/taiga_animal_pen_1.nbt | 4 +- .../village/taiga/houses/taiga_armorer_2.nbt | 4 +- .../taiga/houses/taiga_armorer_house_1.nbt | 4 +- .../taiga/houses/taiga_butcher_shop_1.nbt | 4 +- .../houses/taiga_cartographer_house_1.nbt | 4 +- .../taiga/houses/taiga_fisher_cottage_1.nbt | 4 +- .../taiga/houses/taiga_fletcher_house_1.nbt | 4 +- .../taiga/houses/taiga_large_farm_1.nbt | 4 +- .../taiga/houses/taiga_large_farm_2.nbt | 4 +- .../village/taiga/houses/taiga_library_1.nbt | 4 +- .../taiga/houses/taiga_masons_house_1.nbt | 4 +- .../taiga/houses/taiga_medium_house_1.nbt | 4 +- .../taiga/houses/taiga_medium_house_2.nbt | 4 +- .../taiga/houses/taiga_medium_house_3.nbt | 4 +- .../taiga/houses/taiga_medium_house_4.nbt | 4 +- .../taiga/houses/taiga_shepherds_house_1.nbt | 4 +- .../taiga/houses/taiga_small_farm_1.nbt | 4 +- .../taiga/houses/taiga_small_house_1.nbt | 4 +- .../taiga/houses/taiga_small_house_2.nbt | 4 +- .../taiga/houses/taiga_small_house_3.nbt | 4 +- .../taiga/houses/taiga_small_house_4.nbt | 4 +- .../taiga/houses/taiga_small_house_5.nbt | 4 +- .../village/taiga/houses/taiga_tannery_1.nbt | 4 +- .../village/taiga/houses/taiga_temple_1.nbt | 4 +- .../taiga/houses/taiga_tool_smith_1.nbt | 4 +- .../taiga/houses/taiga_weaponsmith_1.nbt | 4 +- .../taiga/houses/taiga_weaponsmith_2.nbt | 4 +- .../village/taiga/streets/corner_01.nbt | 4 +- .../village/taiga/streets/corner_02.nbt | 4 +- .../village/taiga/streets/corner_03.nbt | 4 +- .../village/taiga/streets/crossroad_01.nbt | 4 +- .../village/taiga/streets/crossroad_02.nbt | 4 +- .../village/taiga/streets/crossroad_03.nbt | 4 +- .../village/taiga/streets/crossroad_04.nbt | 4 +- .../village/taiga/streets/crossroad_05.nbt | 4 +- .../village/taiga/streets/crossroad_06.nbt | 4 +- .../village/taiga/streets/straight_01.nbt | 4 +- .../village/taiga/streets/straight_02.nbt | 4 +- .../village/taiga/streets/straight_03.nbt | 4 +- .../village/taiga/streets/straight_04.nbt | 4 +- .../village/taiga/streets/straight_05.nbt | 4 +- .../village/taiga/streets/straight_06.nbt | 4 +- .../village/taiga/streets/turn_01.nbt | 4 +- .../village/taiga/taiga_decoration_1.nbt | 4 +- .../village/taiga/taiga_decoration_2.nbt | 4 +- .../village/taiga/taiga_decoration_3.nbt | 4 +- .../village/taiga/taiga_decoration_4.nbt | 4 +- .../village/taiga/taiga_decoration_5.nbt | 4 +- .../village/taiga/taiga_decoration_6.nbt | 4 +- .../village/taiga/taiga_lamp_post_1.nbt | 4 +- .../town_centers/taiga_meeting_point_1.nbt | 4 +- .../town_centers/taiga_meeting_point_2.nbt | 4 +- .../village/taiga/villagers/baby.nbt | 4 +- .../village/taiga/villagers/nitwit.nbt | 4 +- .../village/taiga/villagers/unemployed.nbt | 2 +- .../houses/taiga_cartographer_house_1.nbt | 4 +- .../zombie/houses/taiga_fisher_cottage_1.nbt | 4 +- .../zombie/houses/taiga_large_farm_2.nbt | 4 +- .../taiga/zombie/houses/taiga_library_1.nbt | 4 +- .../zombie/houses/taiga_medium_house_1.nbt | 4 +- .../zombie/houses/taiga_medium_house_2.nbt | 4 +- .../zombie/houses/taiga_medium_house_3.nbt | 4 +- .../zombie/houses/taiga_medium_house_4.nbt | 4 +- .../zombie/houses/taiga_shepherds_house_1.nbt | 4 +- .../zombie/houses/taiga_small_house_1.nbt | 4 +- .../zombie/houses/taiga_small_house_2.nbt | 4 +- .../zombie/houses/taiga_small_house_3.nbt | 4 +- .../zombie/houses/taiga_small_house_4.nbt | 4 +- .../zombie/houses/taiga_small_house_5.nbt | 4 +- .../taiga/zombie/houses/taiga_temple_1.nbt | 4 +- .../zombie/houses/taiga_tool_smith_1.nbt | 4 +- .../zombie/houses/taiga_weaponsmith_2.nbt | 4 +- .../taiga/zombie/streets/corner_01.nbt | 4 +- .../taiga/zombie/streets/corner_02.nbt | 4 +- .../taiga/zombie/streets/corner_03.nbt | 4 +- .../taiga/zombie/streets/crossroad_01.nbt | 4 +- .../taiga/zombie/streets/crossroad_02.nbt | 4 +- .../taiga/zombie/streets/crossroad_03.nbt | 4 +- .../taiga/zombie/streets/crossroad_04.nbt | 4 +- .../taiga/zombie/streets/crossroad_05.nbt | 4 +- .../taiga/zombie/streets/crossroad_06.nbt | 4 +- .../taiga/zombie/streets/straight_01.nbt | 4 +- .../taiga/zombie/streets/straight_02.nbt | 4 +- .../taiga/zombie/streets/straight_03.nbt | 4 +- .../taiga/zombie/streets/straight_04.nbt | 4 +- .../taiga/zombie/streets/straight_05.nbt | 4 +- .../taiga/zombie/streets/straight_06.nbt | 4 +- .../village/taiga/zombie/streets/turn_01.nbt | 4 +- .../town_centers/taiga_meeting_point_1.nbt | 4 +- .../town_centers/taiga_meeting_point_2.nbt | 4 +- .../village/taiga/zombie/villagers/nitwit.nbt | 4 +- .../taiga/zombie/villagers/unemployed.nbt | 4 +- .../structure/woodland_mansion/1x1_a1.nbt | 4 +- .../structure/woodland_mansion/1x1_a2.nbt | 4 +- .../structure/woodland_mansion/1x1_a3.nbt | 4 +- .../structure/woodland_mansion/1x1_a4.nbt | 4 +- .../structure/woodland_mansion/1x1_a5.nbt | 4 +- .../structure/woodland_mansion/1x1_as1.nbt | 4 +- .../structure/woodland_mansion/1x1_as2.nbt | 4 +- .../structure/woodland_mansion/1x1_as3.nbt | 4 +- .../structure/woodland_mansion/1x1_as4.nbt | 4 +- .../structure/woodland_mansion/1x1_b1.nbt | 4 +- .../structure/woodland_mansion/1x1_b2.nbt | 4 +- .../structure/woodland_mansion/1x1_b3.nbt | 4 +- .../structure/woodland_mansion/1x1_b4.nbt | 4 +- .../structure/woodland_mansion/1x1_b5.nbt | 4 +- .../structure/woodland_mansion/1x2_a1.nbt | 4 +- .../structure/woodland_mansion/1x2_a2.nbt | 4 +- .../structure/woodland_mansion/1x2_a3.nbt | 4 +- .../structure/woodland_mansion/1x2_a4.nbt | 4 +- .../structure/woodland_mansion/1x2_a5.nbt | 4 +- .../structure/woodland_mansion/1x2_a6.nbt | 4 +- .../structure/woodland_mansion/1x2_a7.nbt | 4 +- .../structure/woodland_mansion/1x2_a8.nbt | 4 +- .../structure/woodland_mansion/1x2_a9.nbt | 4 +- .../structure/woodland_mansion/1x2_b1.nbt | 4 +- .../structure/woodland_mansion/1x2_b2.nbt | 4 +- .../structure/woodland_mansion/1x2_b3.nbt | 4 +- .../structure/woodland_mansion/1x2_b4.nbt | 4 +- .../structure/woodland_mansion/1x2_b5.nbt | 4 +- .../structure/woodland_mansion/1x2_c1.nbt | 4 +- .../structure/woodland_mansion/1x2_c2.nbt | 4 +- .../structure/woodland_mansion/1x2_c3.nbt | 4 +- .../structure/woodland_mansion/1x2_c4.nbt | 4 +- .../woodland_mansion/1x2_c_stairs.nbt | 4 +- .../structure/woodland_mansion/1x2_d1.nbt | 4 +- .../structure/woodland_mansion/1x2_d2.nbt | 4 +- .../structure/woodland_mansion/1x2_d3.nbt | 4 +- .../structure/woodland_mansion/1x2_d4.nbt | 4 +- .../structure/woodland_mansion/1x2_d5.nbt | 4 +- .../woodland_mansion/1x2_d_stairs.nbt | 4 +- .../structure/woodland_mansion/1x2_s1.nbt | 4 +- .../structure/woodland_mansion/1x2_s2.nbt | 4 +- .../structure/woodland_mansion/1x2_se1.nbt | 4 +- .../structure/woodland_mansion/2x2_a1.nbt | 4 +- .../structure/woodland_mansion/2x2_a2.nbt | 4 +- .../structure/woodland_mansion/2x2_a3.nbt | 4 +- .../structure/woodland_mansion/2x2_a4.nbt | 4 +- .../structure/woodland_mansion/2x2_b1.nbt | 4 +- .../structure/woodland_mansion/2x2_b2.nbt | 4 +- .../structure/woodland_mansion/2x2_b3.nbt | 4 +- .../structure/woodland_mansion/2x2_b4.nbt | 4 +- .../structure/woodland_mansion/2x2_b5.nbt | 4 +- .../structure/woodland_mansion/2x2_s1.nbt | 4 +- .../woodland_mansion/carpet_east.nbt | 4 +- .../woodland_mansion/carpet_north.nbt | 4 +- .../woodland_mansion/carpet_south_1.nbt | 4 +- .../woodland_mansion/carpet_south_2.nbt | 4 +- .../woodland_mansion/carpet_west_1.nbt | 4 +- .../woodland_mansion/carpet_west_2.nbt | 4 +- .../woodland_mansion/corridor_floor.nbt | 4 +- .../structure/woodland_mansion/entrance.nbt | 4 +- .../woodland_mansion/indoors_door_1.nbt | 4 +- .../woodland_mansion/indoors_door_2.nbt | 4 +- .../woodland_mansion/indoors_wall_1.nbt | 4 +- .../woodland_mansion/indoors_wall_2.nbt | 4 +- .../structure/woodland_mansion/roof.nbt | 4 +- .../woodland_mansion/roof_corner.nbt | 4 +- .../structure/woodland_mansion/roof_front.nbt | 4 +- .../woodland_mansion/roof_inner_corner.nbt | 4 +- .../structure/woodland_mansion/small_wall.nbt | 4 +- .../woodland_mansion/small_wall_corner.nbt | 4 +- .../woodland_mansion/wall_corner.nbt | 4 +- .../structure/woodland_mansion/wall_flat.nbt | 4 +- .../woodland_mansion/wall_window.nbt | 4 +- .../tags/banner_pattern/no_item_required.json | 4 +- .../pattern_item/bordure_indented.json | 5 + .../pattern_item/field_masoned.json | 5 + .../tags/block/bats_spawnable_on.json | 5 + .../tags/damage_type/bypasses_armor.json | 1 + .../damage_type/can_break_armor_stand.json | 4 +- data/minecraft/tags/damage_type/is_fall.json | 1 + .../tags/damage_type/is_player_attack.json | 3 +- .../tags/damage_type/mace_smash.json | 5 + .../tags/damage_type/no_knockback.json | 1 + .../tags/damage_type/panic_causes.json | 4 +- data/minecraft/tags/entity_type/boat.json | 13 + data/minecraft/tags/item/brewing_fuel.json | 5 + data/minecraft/tags/item/bundles.json | 21 + .../tags/item/diamond_tool_materials.json | 5 + .../tags/item/duplicates_allays.json | 5 + .../tags/item/furnace_minecart_fuel.json | 6 + .../tags/item/gaze_disguise_equipment.json | 5 + .../tags/item/gold_tool_materials.json | 5 + .../tags/item/iron_tool_materials.json | 5 + .../tags/item/map_invisibility_equipment.json | 5 + .../tags/item/netherite_tool_materials.json | 5 + .../tags/item/panda_eats_from_ground.json | 6 + .../tags/item/piglin_safe_armor.json | 8 + .../tags/item/repairs_chain_armor.json | 5 + .../tags/item/repairs_diamond_armor.json | 5 + .../tags/item/repairs_gold_armor.json | 5 + .../tags/item/repairs_iron_armor.json | 5 + .../tags/item/repairs_leather_armor.json | 5 + .../tags/item/repairs_netherite_armor.json | 5 + .../tags/item/repairs_turtle_helmet.json | 5 + .../tags/item/repairs_wolf_armor.json | 5 + data/minecraft/tags/item/shulker_boxes.json | 21 + .../tags/item/villager_picks_up.json | 8 + data/minecraft/tags/item/wolf_food.json | 9 +- .../tags/item/wooden_tool_materials.json | 5 + .../trial_chamber/breeze/normal.json | 17 + .../trial_chamber/breeze/ominous.json | 26 + .../trial_chamber/melee/husk/normal.json | 15 + .../trial_chamber/melee/husk/ominous.json | 29 + .../trial_chamber/melee/spider/normal.json | 15 + .../trial_chamber/melee/spider/ominous.json | 26 + .../trial_chamber/melee/zombie/normal.json | 15 + .../trial_chamber/melee/zombie/ominous.json | 29 + .../ranged/poison_skeleton/normal.json | 15 + .../ranged/poison_skeleton/ominous.json | 29 + .../trial_chamber/ranged/skeleton/normal.json | 15 + .../ranged/skeleton/ominous.json | 29 + .../trial_chamber/ranged/stray/normal.json | 15 + .../trial_chamber/ranged/stray/ominous.json | 29 + .../slow_ranged/poison_skeleton/normal.json | 15 + .../slow_ranged/poison_skeleton/ominous.json | 29 + .../slow_ranged/skeleton/normal.json | 15 + .../slow_ranged/skeleton/ominous.json | 29 + .../slow_ranged/stray/normal.json | 15 + .../slow_ranged/stray/ominous.json | 29 + .../small_melee/baby_zombie/normal.json | 15 + .../small_melee/baby_zombie/ominous.json | 29 + .../small_melee/cave_spider/normal.json | 15 + .../small_melee/cave_spider/ominous.json | 26 + .../small_melee/silverfish/normal.json | 15 + .../small_melee/silverfish/ominous.json | 26 + .../small_melee/slime/normal.json | 25 + .../small_melee/slime/ominous.json | 36 + data/minecraft/worldgen/biome/badlands.json | 12 +- .../worldgen/biome/bamboo_jungle.json | 12 +- .../worldgen/biome/basalt_deltas.json | 4 +- data/minecraft/worldgen/biome/beach.json | 12 +- .../worldgen/biome/birch_forest.json | 12 +- .../worldgen/biome/cherry_grove.json | 12 +- data/minecraft/worldgen/biome/cold_ocean.json | 13 +- .../worldgen/biome/crimson_forest.json | 4 +- .../minecraft/worldgen/biome/dark_forest.json | 12 +- .../worldgen/biome/deep_cold_ocean.json | 13 +- data/minecraft/worldgen/biome/deep_dark.json | 12 +- .../worldgen/biome/deep_frozen_ocean.json | 12 +- .../worldgen/biome/deep_lukewarm_ocean.json | 13 +- data/minecraft/worldgen/biome/deep_ocean.json | 13 +- data/minecraft/worldgen/biome/desert.json | 12 +- .../worldgen/biome/dripstone_caves.json | 12 +- .../minecraft/worldgen/biome/end_barrens.json | 2 +- .../worldgen/biome/end_highlands.json | 2 +- .../worldgen/biome/end_midlands.json | 2 +- .../worldgen/biome/eroded_badlands.json | 12 +- .../worldgen/biome/flower_forest.json | 12 +- data/minecraft/worldgen/biome/forest.json | 12 +- .../worldgen/biome/frozen_ocean.json | 12 +- .../worldgen/biome/frozen_peaks.json | 12 +- .../worldgen/biome/frozen_river.json | 12 +- data/minecraft/worldgen/biome/grove.json | 12 +- data/minecraft/worldgen/biome/ice_spikes.json | 12 +- .../worldgen/biome/jagged_peaks.json | 12 +- data/minecraft/worldgen/biome/jungle.json | 12 +- .../worldgen/biome/lukewarm_ocean.json | 12 +- data/minecraft/worldgen/biome/lush_caves.json | 12 +- .../worldgen/biome/mangrove_swamp.json | 12 +- data/minecraft/worldgen/biome/meadow.json | 12 +- .../worldgen/biome/mushroom_fields.json | 12 +- .../worldgen/biome/nether_wastes.json | 4 +- data/minecraft/worldgen/biome/ocean.json | 13 +- .../biome/old_growth_birch_forest.json | 12 +- .../worldgen/biome/old_growth_pine_taiga.json | 12 +- .../biome/old_growth_spruce_taiga.json | 12 +- data/minecraft/worldgen/biome/plains.json | 12 +- data/minecraft/worldgen/biome/river.json | 12 +- data/minecraft/worldgen/biome/savanna.json | 12 +- .../worldgen/biome/savanna_plateau.json | 12 +- .../worldgen/biome/small_end_islands.json | 2 +- .../minecraft/worldgen/biome/snowy_beach.json | 12 +- .../worldgen/biome/snowy_plains.json | 12 +- .../worldgen/biome/snowy_slopes.json | 12 +- .../minecraft/worldgen/biome/snowy_taiga.json | 12 +- .../worldgen/biome/soul_sand_valley.json | 4 +- .../worldgen/biome/sparse_jungle.json | 12 +- .../minecraft/worldgen/biome/stony_peaks.json | 12 +- .../minecraft/worldgen/biome/stony_shore.json | 12 +- .../worldgen/biome/sunflower_plains.json | 12 +- data/minecraft/worldgen/biome/swamp.json | 12 +- data/minecraft/worldgen/biome/taiga.json | 12 +- data/minecraft/worldgen/biome/the_end.json | 2 +- data/minecraft/worldgen/biome/the_void.json | 2 +- data/minecraft/worldgen/biome/warm_ocean.json | 12 +- .../worldgen/biome/warped_forest.json | 4 +- .../worldgen/biome/windswept_forest.json | 12 +- .../biome/windswept_gravelly_hills.json | 12 +- .../worldgen/biome/windswept_hills.json | 12 +- .../worldgen/biome/windswept_savanna.json | 12 +- .../worldgen/biome/wooded_badlands.json | 12 +- .../configured_feature/crimson_fungus.json | 1 + .../crimson_fungus_planted.json | 1 + .../pale_garden_vegetation.json | 16 + .../pale_moss_patch_bonemeal.json | 27 + .../pale_moss_vegetation.json | 38 + .../worldgen/configured_feature/pale_oak.json | 60 + .../configured_feature/pale_oak_creaking.json | 64 + .../configured_feature/seagrass_simple.json | 11 - .../configured_feature/warped_fungus.json | 1 + .../warped_fungus_planted.json | 1 + .../pale_garden_vegetation.json | 23 + .../placed_feature/pale_oak_checked.json | 17 + .../pale_oak_creaking_checked.json | 17 + .../placed_feature/seagrass_simple.json | 46 - .../trial_chambers/chamber/entrance_cap.json | 2 +- .../trial_chambers/chamber/slanted.json | 22 - .../trial_chambers/decor/bed.json | 181 + .../trial_chambers/decor/disposal.json | 16 + .../template_pool/trial_chambers/hallway.json | 54 + net/minecraft/CrashReportCategory.java | 8 +- net/minecraft/DetectedVersion.java | 8 +- net/minecraft/Optionull.java | 6 + net/minecraft/SharedConstants.java | 19 +- net/minecraft/TracingExecutor.java | 58 + net/minecraft/Util.java | 279 +- .../advancements/AdvancementRewards.java | 21 +- .../advancements/CriteriaTriggers.java | 4 +- .../critereon/AnyBlockInteractionTrigger.java | 6 +- .../critereon/BlockPredicate.java | 20 +- .../critereon/ConsumeItemTrigger.java | 9 +- .../critereon/CriterionValidator.java | 14 +- .../DefaultBlockInteractionTrigger.java | 6 +- .../critereon/EntityEquipmentPredicate.java | 10 +- .../critereon/EntityPredicate.java | 11 +- .../critereon/EntitySubPredicates.java | 71 +- .../critereon/EntityTypePredicate.java | 10 +- .../critereon/FishingRodHookedTrigger.java | 7 +- .../critereon/InputPredicate.java | 43 + .../advancements/critereon/ItemPredicate.java | 27 +- .../critereon/ItemTrimPredicate.java | 12 +- .../critereon/ItemUsedOnLocationTrigger.java | 13 +- .../critereon/KilledByArrowTrigger.java | 111 + .../critereon/KilledByCrossbowTrigger.java | 91 - .../critereon/LootTableTrigger.java | 3 +- .../critereon/PlayerPredicate.java | 60 +- .../advancements/critereon/PlayerTrigger.java | 15 +- .../critereon/RecipeCraftedTrigger.java | 35 +- .../critereon/RecipeUnlockedTrigger.java | 15 +- .../critereon/SheepPredicate.java | 39 + .../critereon/ShotCrossbowTrigger.java | 9 +- .../critereon/UsedTotemTrigger.java | 9 +- net/minecraft/client/Camera.java | 34 +- net/minecraft/client/ClientRecipeBook.java | 171 +- net/minecraft/client/GameNarrator.java | 10 +- net/minecraft/client/GuiMessageTag.java | 3 +- net/minecraft/client/InactivityFpsLimit.java | 39 + net/minecraft/client/KeyboardHandler.java | 82 +- net/minecraft/client/Minecraft.java | 633 +- net/minecraft/client/MouseHandler.java | 119 +- net/minecraft/client/OptionInstance.java | 59 +- net/minecraft/client/Options.java | 91 +- .../client/PeriodicNotificationManager.java | 2 +- .../client/RecipeBookCategories.java | 69 - net/minecraft/client/ScrollWheelHandler.java | 49 + .../client/animation/KeyframeAnimations.java | 14 +- .../definitions/BreezeAnimation.java | 463 +- .../definitions/CreakingAnimation.java | 238 + .../client/color/block/BlockColors.java | 4 +- .../client/color/item/ItemColors.java | 18 +- .../client/gui/BundleMouseActions.java | 74 + net/minecraft/client/gui/Font.java | 281 +- net/minecraft/client/gui/Gui.java | 421 +- net/minecraft/client/gui/GuiGraphics.java | 870 +- .../client/gui/ItemSlotMouseAction.java | 18 + net/minecraft/client/gui/MapRenderer.java | 170 - .../client/gui/components/AbstractButton.java | 17 +- .../gui/components/AbstractScrollWidget.java | 11 +- .../gui/components/AbstractSelectionList.java | 58 +- .../gui/components/AbstractSliderButton.java | 20 +- .../client/gui/components/AbstractWidget.java | 13 +- .../gui/components/BossHealthOverlay.java | 34 +- .../client/gui/components/ChatComponent.java | 24 +- .../client/gui/components/Checkbox.java | 8 +- .../ContainerObjectSelectionList.java | 12 +- .../client/gui/components/CycleButton.java | 32 +- .../gui/components/DebugScreenOverlay.java | 77 +- .../client/gui/components/EditBox.java | 4 +- .../client/gui/components/ImageButton.java | 3 +- .../client/gui/components/ImageWidget.java | 15 +- .../client/gui/components/LockIconButton.java | 3 +- .../client/gui/components/LogoRenderer.java | 17 +- .../gui/components/MultiLineEditBox.java | 11 +- .../gui/components/ObjectSelectionList.java | 3 +- .../gui/components/PlayerFaceRenderer.java | 30 +- .../gui/components/PlayerSkinWidget.java | 16 +- .../gui/components/PlayerTabOverlay.java | 22 +- .../client/gui/components/PopupScreen.java | 8 +- .../gui/components/SpriteIconButton.java | 5 +- .../gui/components/StateSwitchingButton.java | 8 +- .../gui/components/SubtitleOverlay.java | 10 +- .../client/gui/components/TabButton.java | 6 +- .../debugchart/AbstractDebugChart.java | 10 +- .../components/debugchart/FpsDebugChart.java | 3 - .../components/debugchart/PingDebugChart.java | 3 - .../debugchart/ProfilerPieChart.java | 159 + .../components/debugchart/TpsDebugChart.java | 5 +- .../components/spectator/SpectatorGui.java | 27 +- .../gui/components/tabs/TabNavigationBar.java | 29 +- .../components/toasts/AdvancementToast.java | 61 +- .../gui/components/toasts/RecipeToast.java | 84 +- .../gui/components/toasts/SystemToast.java | 84 +- .../client/gui/components/toasts/Toast.java | 10 +- .../gui/components/toasts/ToastComponent.java | 161 - .../gui/components/toasts/ToastManager.java | 187 + .../gui/components/toasts/TutorialToast.java | 63 +- .../client/gui/font/FontManager.java | 116 +- net/minecraft/client/gui/font/FontSet.java | 20 +- .../client/gui/font/glyphs/BakedGlyph.java | 68 +- .../client/gui/font/glyphs/EmptyGlyph.java | 2 +- .../client/gui/font/glyphs/SpecialGlyphs.java | 2 +- .../gui/font/providers/GlyphProviderType.java | 8 +- .../gui/screens/BackupConfirmScreen.java | 35 +- .../client/gui/screens/ConnectScreen.java | 10 +- .../gui/screens/CreateBuffetWorldScreen.java | 54 +- .../gui/screens/CreateFlatWorldScreen.java | 85 +- .../client/gui/screens/DeathScreen.java | 8 +- .../client/gui/screens/DemoIntroScreen.java | 5 +- .../gui/screens/GenericMessageScreen.java | 2 +- .../gui/screens/LevelLoadingScreen.java | 29 +- .../client/gui/screens/LoadingOverlay.java | 40 +- .../gui/screens/NoticeWithLinkScreen.java | 5 +- .../client/gui/screens/PauseScreen.java | 17 +- .../gui/screens/PresetFlatWorldScreen.java | 57 +- .../gui/screens/ReceivingLevelScreen.java | 11 +- net/minecraft/client/gui/screens/Screen.java | 67 +- .../client/gui/screens/ShareToLanScreen.java | 6 +- .../client/gui/screens/TitleScreen.java | 56 +- .../client/gui/screens/WinScreen.java | 10 +- .../gui/screens/achievement/StatsScreen.java | 181 +- .../screens/advancements/AdvancementTab.java | 3 +- .../advancements/AdvancementTabType.java | 3 +- .../advancements/AdvancementWidget.java | 15 +- .../advancements/AdvancementsScreen.java | 9 +- .../screens/debug/GameModeSwitcherScreen.java | 9 +- .../inventory/AbstractContainerScreen.java | 139 +- .../inventory/AbstractFurnaceScreen.java | 112 +- .../inventory/AbstractRecipeBookScreen.java | 128 + .../inventory/AbstractSignEditScreen.java | 14 +- .../gui/screens/inventory/AnvilScreen.java | 7 +- .../gui/screens/inventory/BeaconScreen.java | 9 +- .../screens/inventory/BlastFurnaceScreen.java | 14 +- .../gui/screens/inventory/BookEditScreen.java | 23 +- .../gui/screens/inventory/BookViewScreen.java | 5 +- .../screens/inventory/BrewingStandScreen.java | 9 +- .../inventory/CartographyTableScreen.java | 27 +- .../screens/inventory/ContainerScreen.java | 7 +- .../gui/screens/inventory/CrafterScreen.java | 7 +- .../gui/screens/inventory/CraftingScreen.java | 92 +- .../CreativeModeInventoryScreen.java | 287 +- .../inventory/CyclingSlotBackground.java | 4 +- .../screens/inventory/DispenserScreen.java | 3 +- .../EffectRenderingInventoryScreen.java | 128 - .../screens/inventory/EffectsInInventory.java | 129 + .../screens/inventory/EnchantmentScreen.java | 40 +- .../gui/screens/inventory/FurnaceScreen.java | 15 +- .../screens/inventory/GrindstoneScreen.java | 5 +- .../inventory/HangingSignEditScreen.java | 5 +- .../gui/screens/inventory/HopperScreen.java | 3 +- .../inventory/HorseInventoryScreen.java | 11 +- .../screens/inventory/InventoryScreen.java | 115 +- .../screens/inventory/ItemCombinerScreen.java | 3 +- .../gui/screens/inventory/LoomScreen.java | 59 +- .../gui/screens/inventory/MerchantScreen.java | 41 +- .../gui/screens/inventory/PageButton.java | 3 +- .../screens/inventory/ShulkerBoxScreen.java | 3 +- .../gui/screens/inventory/SignEditScreen.java | 18 +- .../gui/screens/inventory/SmithingScreen.java | 22 +- .../gui/screens/inventory/SmokerScreen.java | 12 +- .../screens/inventory/StonecutterScreen.java | 53 +- .../tooltip/ClientActivePlayersTooltip.java | 14 +- .../tooltip/ClientBundleTooltip.java | 217 +- .../inventory/tooltip/ClientTextTooltip.java | 2 +- .../tooltip/ClientTooltipComponent.java | 20 +- .../inventory/tooltip/TooltipRenderUtil.java | 54 +- .../multiplayer/JoinMultiplayerScreen.java | 16 +- .../multiplayer/ServerLinksScreen.java | 3 +- .../multiplayer/ServerSelectionList.java | 20 +- .../options/AccessibilityOptionsScreen.java | 14 +- .../gui/screens/options/OptionsScreen.java | 6 +- .../options/SkinCustomizationScreen.java | 2 +- .../screens/options/VideoSettingsScreen.java | 5 +- .../options/controls/KeyBindsList.java | 17 +- .../options/controls/KeyBindsScreen.java | 7 +- .../screens/packs/PackSelectionScreen.java | 3 +- .../packs/TransferableSelectionList.java | 19 +- .../AbstractFurnaceRecipeBookComponent.java | 73 - .../BlastingRecipeBookComponent.java | 23 - .../CraftingRecipeBookComponent.java | 104 + .../FurnaceRecipeBookComponent.java | 65 + .../gui/screens/recipebook/GhostRecipe.java | 100 - .../gui/screens/recipebook/GhostSlots.java | 84 + .../recipebook/OverlayRecipeComponent.java | 279 +- .../recipebook/RecipeBookComponent.java | 284 +- .../screens/recipebook/RecipeBookPage.java | 74 +- .../recipebook/RecipeBookTabButton.java | 70 +- .../gui/screens/recipebook/RecipeButton.java | 108 +- .../screens/recipebook/RecipeCollection.java | 128 +- .../recipebook/RecipeShownListener.java | 11 - .../recipebook/RecipeUpdateListener.java | 3 +- .../recipebook/SearchRecipeBookCategory.java | 31 + .../screens/recipebook/SlotSelectTime.java | 10 + .../SmeltingRecipeBookComponent.java | 23 - .../SmokingRecipeBookComponent.java | 23 - .../reporting/AbstractReportScreen.java | 9 +- .../screens/reporting/ChatReportScreen.java | 12 +- .../reporting/ChatSelectionScreen.java | 281 +- .../screens/reporting/NameReportScreen.java | 22 +- .../ReportReasonSelectionScreen.java | 65 +- .../screens/reporting/SkinReportScreen.java | 12 +- .../gui/screens/social/PlayerEntry.java | 15 +- .../social/SocialInteractionsScreen.java | 5 +- .../ConfirmExperimentalFeaturesScreen.java | 61 +- .../worldselection/CreateWorldCallback.java | 17 + .../worldselection/CreateWorldScreen.java | 241 +- .../worldselection/DataPackReloadCookie.java | 10 + .../worldselection/EditGameRulesScreen.java | 56 +- .../worldselection/EditWorldScreen.java | 7 +- .../worldselection/ExperimentsScreen.java | 3 +- .../InitialWorldCreationOptions.java | 17 + .../worldselection/OptimizeWorldScreen.java | 1 + .../screens/worldselection/PresetEditor.java | 6 +- .../worldselection/WorldCreationContext.java | 53 +- .../WorldCreationContextMapper.java | 15 + .../worldselection/WorldCreationUiState.java | 32 +- .../worldselection/WorldOpenFlows.java | 23 +- .../worldselection/WorldSelectionList.java | 32 +- .../client/gui/spectator/PlayerMenuItem.java | 7 +- .../client/gui/spectator/SpectatorMenu.java | 15 +- .../gui/spectator/SpectatorMenuItem.java | 2 +- .../TeleportToPlayerMenuCategory.java | 6 +- .../TeleportToTeamMenuCategory.java | 21 +- net/minecraft/client/main/GameConfig.java | 14 +- net/minecraft/client/main/Main.java | 154 +- .../client/model/AbstractBoatModel.java | 33 + .../client/model/AbstractEquineModel.java | 231 + .../client/model/AbstractPiglinModel.java | 93 + .../client/model/AbstractZombieModel.java | 16 +- .../model/AgeableHierarchicalModel.java | 39 - .../client/model/AgeableListModel.java | 79 - net/minecraft/client/model/AllayModel.java | 107 +- .../client/model/AnimationUtils.java | 56 +- .../client/model/ArmadilloModel.java | 37 +- .../client/model/ArmorStandArmorModel.java | 55 +- .../client/model/ArmorStandModel.java | 45 +- net/minecraft/client/model/ArrowModel.java | 43 + net/minecraft/client/model/AxolotlModel.java | 322 +- .../client/model/BabyModelTransform.java | 41 + net/minecraft/client/model/BatModel.java | 28 +- net/minecraft/client/model/BeeModel.java | 78 +- .../client/model/BeeStingerModel.java | 27 + net/minecraft/client/model/BellModel.java | 58 + net/minecraft/client/model/BlazeModel.java | 32 +- net/minecraft/client/model/BoatModel.java | 133 +- net/minecraft/client/model/BoggedModel.java | 12 +- net/minecraft/client/model/BookModel.java | 15 +- net/minecraft/client/model/BreezeModel.java | 40 +- net/minecraft/client/model/CamelModel.java | 77 +- net/minecraft/client/model/CatModel.java | 83 +- .../client/model/ChestBoatModel.java | 53 - net/minecraft/client/model/ChestModel.java | 70 + .../client/model/ChestRaftModel.java | 53 - net/minecraft/client/model/ChickenModel.java | 40 +- net/minecraft/client/model/CodModel.java | 24 +- .../model/ColorableAgeableListModel.java | 22 - .../model/ColorableHierarchicalModel.java | 22 - net/minecraft/client/model/CowModel.java | 10 +- net/minecraft/client/model/CreakingModel.java | 105 + net/minecraft/client/model/CreeperModel.java | 30 +- net/minecraft/client/model/DolphinModel.java | 30 +- ...hestedHorseModel.java => DonkeyModel.java} | 39 +- net/minecraft/client/model/DrownedModel.java | 52 +- net/minecraft/client/model/ElytraModel.java | 65 +- .../client/model/EndCrystalModel.java | 59 + net/minecraft/client/model/EndermanModel.java | 87 +- .../client/model/EndermiteModel.java | 21 +- net/minecraft/client/model/EntityModel.java | 31 +- .../client/model/EvokerFangsModel.java | 49 +- net/minecraft/client/model/FelineModel.java | 174 + net/minecraft/client/model/FoxModel.java | 122 +- net/minecraft/client/model/FrogModel.java | 62 +- net/minecraft/client/model/GhastModel.java | 22 +- .../client/model/GiantZombieModel.java | 8 +- net/minecraft/client/model/GoatModel.java | 26 +- net/minecraft/client/model/GuardianModel.java | 65 +- .../client/model/HierarchicalModel.java | 65 - net/minecraft/client/model/HoglinModel.java | 70 +- net/minecraft/client/model/HorseModel.java | 288 +- .../client/model/HumanoidArmorModel.java | 4 +- net/minecraft/client/model/HumanoidModel.java | 299 +- net/minecraft/client/model/IllagerModel.java | 52 +- .../client/model/IronGolemModel.java | 54 +- .../client/model/LavaSlimeModel.java | 27 +- .../client/model/LeashKnotModel.java | 18 +- net/minecraft/client/model/ListModel.java | 29 - net/minecraft/client/model/LlamaModel.java | 87 +- .../client/model/LlamaSpitModel.java | 16 +- net/minecraft/client/model/MinecartModel.java | 17 +- net/minecraft/client/model/Model.java | 67 +- net/minecraft/client/model/ModelUtils.java | 21 - net/minecraft/client/model/OcelotModel.java | 162 +- net/minecraft/client/model/PandaModel.java | 91 +- net/minecraft/client/model/ParrotModel.java | 177 +- net/minecraft/client/model/PhantomModel.java | 20 +- net/minecraft/client/model/PigModel.java | 10 +- .../client/model/PiglinHeadModel.java | 8 +- net/minecraft/client/model/PiglinModel.java | 166 +- .../client/model/PlayerCapeModel.java | 53 + .../client/model/PlayerEarsModel.java | 35 + net/minecraft/client/model/PlayerModel.java | 153 +- .../client/model/PolarBearModel.java | 51 +- .../client/model/PufferfishBigModel.java | 19 +- .../client/model/PufferfishMidModel.java | 41 +- .../client/model/PufferfishSmallModel.java | 19 +- .../client/model/QuadrupedModel.java | 51 +- net/minecraft/client/model/RabbitModel.java | 108 +- net/minecraft/client/model/RaftModel.java | 74 +- net/minecraft/client/model/RavagerModel.java | 84 +- net/minecraft/client/model/SalmonModel.java | 34 +- net/minecraft/client/model/SheepFurModel.java | 24 +- net/minecraft/client/model/SheepModel.java | 26 +- net/minecraft/client/model/ShieldModel.java | 11 +- .../client/model/ShulkerBulletModel.java | 20 +- net/minecraft/client/model/ShulkerModel.java | 68 +- .../client/model/SilverfishModel.java | 18 +- net/minecraft/client/model/SkeletonModel.java | 50 +- net/minecraft/client/model/SkullModel.java | 10 +- .../client/model/SkullModelBase.java | 5 +- net/minecraft/client/model/SlimeModel.java | 17 +- net/minecraft/client/model/SnifferModel.java | 50 +- .../client/model/SnowGolemModel.java | 22 +- net/minecraft/client/model/SpiderModel.java | 123 +- .../client/model/SpinAttackEffectModel.java | 54 + net/minecraft/client/model/SquidModel.java | 21 +- net/minecraft/client/model/StriderModel.java | 75 +- net/minecraft/client/model/TadpoleModel.java | 30 +- net/minecraft/client/model/TridentModel.java | 11 +- .../client/model/TropicalFishModelA.java | 24 +- .../client/model/TropicalFishModelB.java | 24 +- net/minecraft/client/model/TurtleModel.java | 83 +- net/minecraft/client/model/VexModel.java | 59 +- net/minecraft/client/model/VillagerModel.java | 36 +- net/minecraft/client/model/WardenModel.java | 57 +- .../client/model/WaterPatchModel.java | 10 - .../client/model/WindChargeModel.java | 20 +- net/minecraft/client/model/WitchModel.java | 48 +- .../client/model/WitherBossModel.java | 37 +- net/minecraft/client/model/WolfModel.java | 88 +- net/minecraft/client/model/ZombieModel.java | 8 +- .../client/model/ZombieVillagerModel.java | 24 +- .../client/model/ZombifiedPiglinModel.java | 30 + .../client/model/dragon/DragonHeadModel.java | 14 +- .../client/model/dragon/EnderDragonModel.java | 286 + .../client/model/geom/LayerDefinitions.java | 358 +- .../client/model/geom/ModelLayerLocation.java | 33 +- .../client/model/geom/ModelLayers.java | 118 +- .../client/model/geom/ModelPart.java | 46 +- .../client/model/geom/PartNames.java | 7 + net/minecraft/client/model/geom/PartPose.java | 35 +- .../model/geom/builders/LayerDefinition.java | 4 + .../model/geom/builders/MeshDefinition.java | 15 +- .../model/geom/builders/MeshTransformer.java | 15 + .../model/geom/builders/PartDefinition.java | 22 +- .../multiplayer/ClientAdvancements.java | 2 +- .../client/multiplayer/ClientChunkCache.java | 66 +- .../ClientCommonPacketListenerImpl.java | 53 +- ...ClientConfigurationPacketListenerImpl.java | 1 - .../ClientHandshakePacketListenerImpl.java | 10 +- .../client/multiplayer/ClientLevel.java | 250 +- .../multiplayer/ClientPacketListener.java | 694 +- .../multiplayer/ClientRecipeContainer.java | 31 + .../multiplayer/ClientSuggestionProvider.java | 18 +- .../multiplayer/CommonListenerCookie.java | 1 - .../multiplayer/MultiPlayerGameMode.java | 74 +- .../client/multiplayer/PlayerInfo.java | 9 + .../multiplayer/RegistryDataCollector.java | 132 +- .../client/multiplayer/ServerData.java | 6 +- .../client/multiplayer/ServerList.java | 9 +- .../multiplayer/SessionSearchTrees.java | 25 +- .../client/multiplayer/TagCollector.java | 48 - .../multiplayer/chat/LoggedChatEvent.java | 6 +- .../chat/report/ReportEnvironment.java | 22 +- .../multiplayer/chat/report/ReportReason.java | 14 +- .../client/particle/AttackSweepParticle.java | 2 +- .../client/particle/DustParticle.java | 8 +- .../client/particle/DustPlumeParticle.java | 8 +- .../client/particle/FireworkParticles.java | 4 +- .../particle/FlyStraightTowardsParticle.java | 8 +- .../particle/FlyTowardsPositionParticle.java | 9 +- .../client/particle/GustParticle.java | 2 +- .../particle/HugeExplosionParticle.java | 2 +- .../client/particle/ItemPickupParticle.java | 1 - .../particle/MobAppearanceParticle.java | 11 +- .../client/particle/ParticleEngine.java | 224 +- .../client/particle/ParticleRenderType.java | 19 +- .../client/particle/SquidInkParticle.java | 8 +- .../client/particle/TerrainParticle.java | 14 + .../client/particle/TrailParticle.java | 68 + .../client/particle/WhiteAshParticle.java | 8 +- .../client/player/AbstractClientPlayer.java | 35 +- .../player/{Input.java => ClientInput.java} | 24 +- .../client/player/KeyboardInput.java | 30 +- net/minecraft/client/player/LocalPlayer.java | 224 +- net/minecraft/client/player/RemotePlayer.java | 19 +- .../BlockEntityWithoutLevelRenderer.java | 7 +- .../client/renderer/CloudRenderer.java | 346 + .../renderer/CompiledShaderProgram.java | 273 + .../client/renderer/CoreShaders.java | 90 + net/minecraft/client/renderer/CubeMap.java | 8 +- .../renderer/DimensionSpecialEffects.java | 51 +- .../client/renderer/EffectInstance.java | 445 - .../client/renderer/FogParameters.java | 10 + .../client/renderer/FogRenderer.java | 336 +- .../client/renderer/GameRenderer.java | 1194 +-- .../client/renderer/GpuWarnlistManager.java | 53 +- .../client/renderer/ItemBlockRenderTypes.java | 34 +- .../client/renderer/ItemInHandRenderer.java | 21 +- .../client/renderer/ItemModelShaper.java | 49 +- .../client/renderer/LevelEventHandler.java | 692 ++ .../client/renderer/LevelRenderer.java | 3077 ++---- .../client/renderer/LevelTargetBundle.java | 91 + .../client/renderer/LightTexture.java | 155 +- .../client/renderer/MapRenderer.java | 100 + .../client/renderer/MultiBufferSource.java | 2 +- net/minecraft/client/renderer/Octree.java | 269 + .../client/renderer/OutlineBufferSource.java | 4 +- .../client/renderer/PanoramaRenderer.java | 17 +- net/minecraft/client/renderer/PostChain.java | 417 +- .../client/renderer/PostChainConfig.java | 144 + net/minecraft/client/renderer/PostPass.java | 210 +- .../client/renderer/RenderBuffers.java | 10 +- .../client/renderer/RenderStateShard.java | 318 +- net/minecraft/client/renderer/RenderType.java | 436 +- .../client/renderer/ScreenEffectRenderer.java | 6 +- .../renderer/SectionOcclusionGraph.java | 192 +- .../client/renderer/ShaderDefines.java | 100 + .../client/renderer/ShaderInstance.java | 528 - .../client/renderer/ShaderManager.java | 497 + .../client/renderer/ShaderProgram.java | 14 + .../client/renderer/ShaderProgramConfig.java | 58 + .../client/renderer/ShapeRenderer.java | 189 + net/minecraft/client/renderer/Sheets.java | 7 +- .../client/renderer/SkyRenderer.java | 283 + net/minecraft/client/renderer/ViewArea.java | 88 +- .../renderer/WeatherEffectRenderer.java | 243 + .../client/renderer/WorldBorderRenderer.java | 133 + .../renderer/block/BlockRenderDispatcher.java | 4 +- .../renderer/block/LiquidBlockRenderer.java | 45 +- .../renderer/block/ModelBlockRenderer.java | 44 +- .../renderer/block/model/BakedOverrides.java | 103 + .../renderer/block/model/BakedQuad.java | 16 +- .../renderer/block/model/BlockElement.java | 35 +- .../renderer/block/model/BlockModel.java | 101 +- .../block/model/BlockModelDefinition.java | 132 +- .../renderer/block/model/FaceBakery.java | 129 +- .../block/model/ItemModelGenerator.java | 10 +- .../renderer/block/model/ItemOverride.java | 37 +- .../renderer/block/model/ItemOverrides.java | 131 - .../renderer/block/model/MultiVariant.java | 61 +- .../block/model/UnbakedBlockStateModel.java | 11 + .../renderer/block/model/VariantSelector.java | 59 + .../block/model/multipart/AndCondition.java | 8 +- .../model/multipart/KeyValueCondition.java | 7 +- .../block/model/multipart/MultiPart.java | 139 +- .../block/model/multipart/OrCondition.java | 8 +- .../block/model/multipart/Selector.java | 18 +- .../renderer/blockentity/BannerRenderer.java | 45 +- .../renderer/blockentity/BeaconRenderer.java | 7 +- .../renderer/blockentity/BedRenderer.java | 37 +- .../renderer/blockentity/BellRenderer.java | 51 +- .../BlockEntityRenderDispatcher.java | 3 +- .../blockentity/CampfireRenderer.java | 3 +- .../renderer/blockentity/ChestRenderer.java | 100 +- .../blockentity/EnchantTableRenderer.java | 5 +- .../blockentity/HangingSignRenderer.java | 19 +- .../renderer/blockentity/LecternRenderer.java | 5 +- .../blockentity/PistonHeadRenderer.java | 3 +- .../blockentity/ShulkerBoxRenderer.java | 30 +- .../renderer/blockentity/SignRenderer.java | 67 +- .../blockentity/SkullBlockRenderer.java | 3 +- .../renderer/blockentity/SpawnerRenderer.java | 5 +- .../blockentity/StructureBlockRenderer.java | 17 +- .../blockentity/TheEndGatewayRenderer.java | 5 +- .../chunk/CompileTaskDynamicQueue.java | 76 + .../renderer/chunk/RenderChunkRegion.java | 4 +- .../renderer/chunk/SectionCompiler.java | 5 +- .../chunk/SectionRenderDispatcher.java | 460 +- .../client/renderer/culling/Frustum.java | 57 +- .../renderer/debug/BeeDebugRenderer.java | 45 +- .../renderer/debug/BrainDebugRenderer.java | 26 +- .../renderer/debug/BreezeDebugRenderer.java | 28 +- .../renderer/debug/ChunkBorderRenderer.java | 14 +- .../debug/ChunkCullingDebugRenderer.java | 174 + .../renderer/debug/CollisionBoxRenderer.java | 3 +- .../client/renderer/debug/DebugRenderer.java | 85 +- .../debug/GameEventListenerRenderer.java | 9 +- .../debug/GoalSelectorDebugRenderer.java | 8 +- .../renderer/debug/HeightMapRenderer.java | 4 +- .../debug/LightSectionDebugRenderer.java | 4 +- .../debug/NeighborsUpdateRenderer.java | 4 +- .../renderer/debug/OctreeDebugRenderer.java | 72 + .../renderer/debug/PathfindingRenderer.java | 3 +- .../renderer/debug/RaidDebugRenderer.java | 1 - .../RedstoneWireOrientationsRenderer.java | 54 + .../renderer/debug/StructureRenderer.java | 23 +- .../renderer/debug/SupportBlockRenderer.java | 6 +- .../debug/WorldGenAttemptRenderer.java | 4 +- .../renderer/entity/AbstractBoatRenderer.java | 70 + .../entity/AbstractHoglinRenderer.java | 25 + .../entity/AbstractHorseRenderer.java | 26 +- .../entity/AbstractMinecartRenderer.java | 179 + .../entity/AbstractSkeletonRenderer.java | 39 + .../entity/AbstractZombieRenderer.java | 26 +- .../renderer/entity/AgeableMobRenderer.java | 28 + .../client/renderer/entity/AllayRenderer.java | 19 +- .../renderer/entity/ArmadilloRenderer.java | 19 +- .../renderer/entity/ArmorStandRenderer.java | 77 +- .../client/renderer/entity/ArrowRenderer.java | 73 +- .../renderer/entity/AxolotlRenderer.java | 22 +- .../client/renderer/entity/BatRenderer.java | 19 +- .../client/renderer/entity/BeeRenderer.java | 29 +- .../client/renderer/entity/BlazeRenderer.java | 15 +- .../client/renderer/entity/BoatRenderer.java | 97 +- .../renderer/entity/BoggedRenderer.java | 14 +- .../renderer/entity/BreezeRenderer.java | 32 +- .../client/renderer/entity/CamelRenderer.java | 30 +- .../client/renderer/entity/CatRenderer.java | 52 +- .../renderer/entity/CaveSpiderRenderer.java | 15 +- .../renderer/entity/ChestedHorseRenderer.java | 35 - .../renderer/entity/ChickenRenderer.java | 25 +- .../client/renderer/entity/CodRenderer.java | 26 +- .../client/renderer/entity/CowRenderer.java | 19 +- .../renderer/entity/CreakingRenderer.java | 40 + .../renderer/entity/CreeperRenderer.java | 28 +- .../renderer/entity/DisplayRenderer.java | 257 +- .../renderer/entity/DolphinRenderer.java | 21 +- .../renderer/entity/DonkeyRenderer.java | 36 + .../entity/DragonFireballRenderer.java | 26 +- .../renderer/entity/DrownedRenderer.java | 35 +- .../entity/ElderGuardianRenderer.java | 10 +- .../renderer/entity/EndCrystalRenderer.java | 106 +- .../renderer/entity/EnderDragonRenderer.java | 467 +- .../renderer/entity/EndermanRenderer.java | 43 +- .../renderer/entity/EndermiteRenderer.java | 18 +- .../entity/EntityRenderDispatcher.java | 168 +- .../renderer/entity/EntityRenderer.java | 234 +- .../entity/EntityRendererProvider.java | 38 +- .../renderer/entity/EntityRenderers.java | 111 +- .../renderer/entity/EvokerFangsRenderer.java | 45 +- .../renderer/entity/EvokerRenderer.java | 31 +- .../entity/ExperienceOrbRenderer.java | 57 +- .../renderer/entity/FallingBlockRenderer.java | 74 +- .../entity/FireworkEntityRenderer.java | 40 +- .../renderer/entity/FishingHookRenderer.java | 84 +- .../client/renderer/entity/FoxRenderer.java | 44 +- .../client/renderer/entity/FrogRenderer.java | 23 +- .../client/renderer/entity/GhastRenderer.java | 25 +- .../renderer/entity/GiantMobRenderer.java | 28 +- .../renderer/entity/GlowSquidRenderer.java | 8 +- .../client/renderer/entity/GoatRenderer.java | 18 +- .../renderer/entity/GuardianRenderer.java | 174 +- .../renderer/entity/HoglinRenderer.java | 20 +- .../client/renderer/entity/HorseRenderer.java | 25 +- .../renderer/entity/HumanoidMobRenderer.java | 67 +- .../client/renderer/entity/HuskRenderer.java | 21 +- .../renderer/entity/IllagerRenderer.java | 23 +- .../renderer/entity/IllusionerRenderer.java | 60 +- .../renderer/entity/IronGolemRenderer.java | 35 +- .../renderer/entity/ItemEntityRenderer.java | 53 +- .../renderer/entity/ItemFrameRenderer.java | 142 +- .../client/renderer/entity/ItemRenderer.java | 238 +- .../renderer/entity/LeashKnotRenderer.java | 26 +- .../entity/LightningBoltRenderer.java | 93 +- .../renderer/entity/LivingEntityRenderer.java | 352 +- .../client/renderer/entity/LlamaRenderer.java | 28 +- .../renderer/entity/LlamaSpitRenderer.java | 35 +- .../renderer/entity/MagmaCubeRenderer.java | 32 +- .../renderer/entity/MinecartRenderer.java | 103 +- .../client/renderer/entity/MobRenderer.java | 12 +- .../renderer/entity/MushroomCowRenderer.java | 33 +- .../client/renderer/entity/NoopRenderer.java | 9 +- .../renderer/entity/OcelotRenderer.java | 20 +- .../entity/OminousItemSpawnerRenderer.java | 39 +- .../renderer/entity/PaintingRenderer.java | 215 +- .../client/renderer/entity/PandaRenderer.java | 124 +- .../renderer/entity/ParrotRenderer.java | 32 +- .../renderer/entity/PhantomRenderer.java | 33 +- .../client/renderer/entity/PigRenderer.java | 24 +- .../renderer/entity/PiglinRenderer.java | 76 +- .../renderer/entity/PillagerRenderer.java | 14 +- .../renderer/entity/PolarBearRenderer.java | 21 +- .../renderer/entity/PufferfishRenderer.java | 60 +- .../renderer/entity/RabbitRenderer.java | 26 +- .../client/renderer/entity/RaftRenderer.java | 33 + .../renderer/entity/RavagerRenderer.java | 23 +- .../renderer/entity/RenderLayerParent.java | 10 +- .../renderer/entity/SalmonRenderer.java | 59 +- .../client/renderer/entity/SheepRenderer.java | 27 +- .../entity/ShulkerBulletRenderer.java | 44 +- .../renderer/entity/ShulkerRenderer.java | 60 +- .../renderer/entity/SilverfishRenderer.java | 18 +- .../renderer/entity/SkeletonRenderer.java | 34 +- .../client/renderer/entity/SlimeRenderer.java | 36 +- .../renderer/entity/SnifferRenderer.java | 26 +- .../renderer/entity/SnowGolemRenderer.java | 24 +- .../entity/SpectralArrowRenderer.java | 13 +- .../renderer/entity/SpiderRenderer.java | 22 +- .../client/renderer/entity/SquidRenderer.java | 40 +- .../client/renderer/entity/StrayRenderer.java | 12 +- .../renderer/entity/StriderRenderer.java | 41 +- .../renderer/entity/TadpoleRenderer.java | 12 +- .../renderer/entity/ThrownItemRenderer.java | 39 +- .../entity/ThrownTridentRenderer.java | 30 +- .../entity/TippableArrowRenderer.java | 19 +- .../renderer/entity/TntMinecartRenderer.java | 34 +- .../client/renderer/entity/TntRenderer.java | 43 +- .../renderer/entity/TropicalFishRenderer.java | 60 +- .../renderer/entity/TurtleRenderer.java | 27 +- .../renderer/entity/UndeadHorseRenderer.java | 35 +- .../client/renderer/entity/VexRenderer.java | 21 +- .../renderer/entity/VillagerRenderer.java | 42 +- .../renderer/entity/VindicatorRenderer.java | 26 +- .../entity/WanderingTraderRenderer.java | 25 +- .../renderer/entity/WardenRenderer.java | 63 +- .../renderer/entity/WindChargeRenderer.java | 27 +- .../client/renderer/entity/WitchRenderer.java | 30 +- .../renderer/entity/WitherBossRenderer.java | 33 +- .../entity/WitherSkeletonRenderer.java | 13 +- .../renderer/entity/WitherSkullRenderer.java | 34 +- .../client/renderer/entity/WolfRenderer.java | 51 +- .../renderer/entity/ZoglinRenderer.java | 11 +- .../renderer/entity/ZombieRenderer.java | 36 +- .../entity/ZombieVillagerRenderer.java | 35 +- .../entity/ZombifiedPiglinRenderer.java | 57 + .../renderer/entity/layers/ArrowLayer.java | 41 +- .../entity/layers/BeeStingerLayer.java | 60 +- .../entity/layers/BreezeEyesLayer.java | 10 +- .../entity/layers/BreezeWindLayer.java | 30 +- .../renderer/entity/layers/CapeLayer.java | 92 +- .../entity/layers/CarriedBlockLayer.java | 25 +- .../entity/layers/CatCollarLayer.java | 49 +- .../entity/layers/CreeperPowerLayer.java | 18 +- .../entity/layers/CrossedArmsItemLayer.java | 45 +- .../entity/layers/CustomHeadLayer.java | 108 +- .../entity/layers/Deadmau5EarsLayer.java | 55 +- .../layers/DolphinCarryingItemLayer.java | 58 +- .../entity/layers/DrownedOuterLayer.java | 43 +- .../renderer/entity/layers/ElytraLayer.java | 72 - .../entity/layers/EnderEyesLayer.java | 6 +- .../entity/layers/EnergySwirlLayer.java | 38 +- .../entity/layers/EquipmentLayerRenderer.java | 114 + .../renderer/entity/layers/EyesLayer.java | 23 +- .../entity/layers/FoxHeldItemLayer.java | 93 +- .../entity/layers/HorseArmorLayer.java | 63 +- .../entity/layers/HorseMarkingLayer.java | 27 +- .../entity/layers/HumanoidArmorLayer.java | 139 +- .../layers/IronGolemCrackinessLayer.java | 37 +- .../entity/layers/IronGolemFlowerLayer.java | 25 +- .../entity/layers/ItemInHandLayer.java | 84 +- .../layers/LivingEntityEmissiveLayer.java | 77 + .../entity/layers/LlamaDecorLayer.java | 86 +- .../layers/MushroomCowMushroomLayer.java | 37 +- .../entity/layers/PandaHoldsItemLayer.java | 49 +- .../entity/layers/ParrotOnShoulderLayer.java | 75 +- .../entity/layers/PhantomEyesLayer.java | 6 +- .../entity/layers/PlayerItemInHandLayer.java | 56 +- .../renderer/entity/layers/RenderLayer.java | 70 +- .../renderer/entity/layers/SaddleLayer.java | 47 +- .../renderer/entity/layers/SheepFurLayer.java | 89 - .../entity/layers/SheepWoolLayer.java | 65 + .../entity/layers/ShulkerHeadLayer.java | 38 - .../entity/layers/SkeletonClothingLayer.java | 39 +- .../entity/layers/SlimeOuterLayer.java | 41 +- .../entity/layers/SnowGolemHeadLayer.java | 55 +- .../entity/layers/SpiderEyesLayer.java | 6 +- .../entity/layers/SpinAttackEffectLayer.java | 58 +- .../entity/layers/StuckInBodyLayer.java | 100 +- .../layers/TropicalFishPatternLayer.java | 47 +- .../layers/VillagerProfessionLayer.java | 67 +- .../entity/layers/WardenEmissiveLayer.java | 79 - .../renderer/entity/layers/WingsLayer.java | 66 + .../entity/layers/WitchItemLayer.java | 31 +- .../entity/layers/WitherArmorLayer.java | 18 +- .../entity/layers/WolfArmorLayer.java | 98 +- .../entity/layers/WolfCollarLayer.java | 29 +- .../entity/player/PlayerRenderer.java | 309 +- .../entity/state/AllayRenderState.java | 12 + .../entity/state/ArmadilloRenderState.java | 13 + .../entity/state/ArmorStandRenderState.java | 22 + .../entity/state/ArrowRenderState.java | 11 + .../entity/state/AxolotlRenderState.java | 14 + .../renderer/entity/state/BatRenderState.java | 12 + .../renderer/entity/state/BeeRenderState.java | 13 + .../state/BlockDisplayEntityRenderState.java | 17 + .../entity/state/BoatRenderState.java | 16 + .../entity/state/BoggedRenderState.java | 9 + .../entity/state/BreezeRenderState.java | 15 + .../entity/state/CamelRenderState.java | 17 + .../renderer/entity/state/CatRenderState.java | 16 + .../entity/state/ChickenRenderState.java | 10 + .../entity/state/CreakingRenderState.java | 13 + .../entity/state/CreeperRenderState.java | 10 + .../state/DisplayEntityRenderState.java | 17 + .../entity/state/DolphinRenderState.java | 9 + .../entity/state/DonkeyRenderState.java | 9 + .../entity/state/EndCrystalRenderState.java | 13 + .../entity/state/EnderDragonRenderState.java | 40 + .../entity/state/EndermanRenderState.java | 13 + .../entity/state/EntityRenderState.java | 41 + .../entity/state/EquineRenderState.java | 14 + .../entity/state/EvokerFangsRenderState.java | 10 + .../entity/state/EvokerRenderState.java | 9 + .../state/ExperienceOrbRenderState.java | 9 + .../entity/state/FallingBlockRenderState.java | 68 + .../entity/state/FelineRenderState.java | 14 + .../state/FireworkRocketRenderState.java | 15 + .../entity/state/FishingHookRenderState.java | 10 + .../renderer/entity/state/FoxRenderState.java | 17 + .../entity/state/FrogRenderState.java | 17 + .../entity/state/GhastRenderState.java | 9 + .../entity/state/GoatRenderState.java | 11 + .../entity/state/GuardianRenderState.java | 21 + .../entity/state/HoglinRenderState.java | 10 + .../entity/state/HorseRenderState.java | 14 + .../entity/state/HumanoidRenderState.java | 29 + .../entity/state/IllagerRenderState.java | 17 + .../entity/state/IllusionerRenderState.java | 11 + .../entity/state/IronGolemRenderState.java | 12 + .../state/ItemDisplayEntityRenderState.java | 20 + .../entity/state/ItemEntityRenderState.java | 15 + .../entity/state/ItemFrameRenderState.java | 23 + .../state/LightningBoltRenderState.java | 9 + .../entity/state/LivingEntityRenderState.java | 60 + .../entity/state/LlamaRenderState.java | 14 + .../entity/state/LlamaSpitRenderState.java | 10 + .../entity/state/MinecartRenderState.java | 29 + .../entity/state/MinecartTntRenderState.java | 9 + .../entity/state/MushroomCowRenderState.java | 10 + .../state/OminousItemSpawnerRenderState.java | 14 + .../entity/state/PaintingRenderState.java | 15 + .../entity/state/PandaRenderState.java | 20 + .../entity/state/ParrotRenderState.java | 13 + .../entity/state/PhantomRenderState.java | 10 + .../renderer/entity/state/PigRenderState.java | 14 + .../entity/state/PiglinRenderState.java | 13 + .../entity/state/PlayerRenderState.java | 56 + .../entity/state/PolarBearRenderState.java | 9 + .../entity/state/PufferfishRenderState.java | 9 + .../entity/state/RabbitRenderState.java | 12 + .../entity/state/RavagerRenderState.java | 11 + .../entity/state/SaddleableRenderState.java | 9 + .../entity/state/SalmonRenderState.java | 10 + .../entity/state/SheepRenderState.java | 14 + .../state/ShulkerBulletRenderState.java | 10 + .../entity/state/ShulkerRenderState.java | 19 + .../entity/state/SkeletonRenderState.java | 10 + .../entity/state/SlimeRenderState.java | 10 + .../entity/state/SnifferRenderState.java | 15 + .../entity/state/SquidRenderState.java | 11 + .../entity/state/StriderRenderState.java | 16 + .../state/TextDisplayEntityRenderState.java | 20 + .../entity/state/ThrownItemRenderState.java | 14 + .../state/ThrownTridentRenderState.java | 11 + .../state/TippableArrowRenderState.java | 9 + .../renderer/entity/state/TntRenderState.java | 13 + .../entity/state/TropicalFishRenderState.java | 12 + .../entity/state/TurtleRenderState.java | 11 + .../renderer/entity/state/VexRenderState.java | 9 + .../state/VillagerDataHolderRenderState.java | 10 + .../entity/state/VillagerRenderState.java | 18 + .../entity/state/WardenRenderState.java | 17 + .../entity/state/WitchRenderState.java | 10 + .../entity/state/WitherRenderState.java | 12 + .../entity/state/WitherSkullRenderState.java | 11 + .../entity/state/WolfRenderState.java | 35 + .../entity/state/ZombieRenderState.java | 10 + .../state/ZombieVillagerRenderState.java | 17 + .../state/ZombifiedPiglinRenderState.java | 9 + .../renderer/entity/state/package-info.java | 11 + .../client/renderer/item/ItemProperties.java | 26 +- .../client/renderer/state/MapRenderState.java | 29 + .../client/renderer/state/package-info.java | 11 + .../renderer/texture/AbstractTexture.java | 9 +- .../client/renderer/texture/HttpTexture.java | 11 +- .../renderer/texture/MipmapGenerator.java | 17 +- .../texture/MissingTextureAtlasSprite.java | 16 +- .../renderer/texture/OverlayTexture.java | 5 +- .../renderer/texture/SimpleTexture.java | 11 +- .../renderer/texture/SpriteContents.java | 26 +- .../client/renderer/texture/TextureAtlas.java | 22 +- .../renderer/texture/TextureManager.java | 32 +- .../atlas/sources/PalettedPermutations.java | 27 +- .../client/resources/DefaultPlayerSkin.java | 45 +- .../client/resources/MapTextureManager.java | 101 + .../client/resources/SkinManager.java | 7 +- .../client/resources/TextureAtlasHolder.java | 27 +- .../resources/language/ClientLanguage.java | 9 +- .../metadata/gui/GuiSpriteScaling.java | 34 +- .../client/resources/model/BakedModel.java | 6 +- .../model/BlockStateModelLoader.java | 283 +- .../client/resources/model/BuiltInModel.java | 14 +- .../resources/model/DelegateBakedModel.java | 56 + .../resources/model/EquipmentModelSet.java | 28 + .../client/resources/model/ItemModel.java | 55 + .../client/resources/model/Material.java | 4 +- .../resources/model/MissingBlockModel.java | 40 + .../client/resources/model/ModelBaker.java | 4 - .../client/resources/model/ModelBakery.java | 191 +- .../resources/model/ModelDiscovery.java | 138 + .../resources/model/ModelGroupCollector.java | 82 + .../client/resources/model/ModelManager.java | 217 +- .../model/ModelResourceLocation.java | 4 - .../resources/model/MultiPartBakedModel.java | 88 +- .../resources/model/SimpleBakedModel.java | 72 +- .../client/resources/model/SpecialModels.java | 27 + .../client/resources/model/UnbakedModel.java | 12 +- .../resources/model/WeightedBakedModel.java | 82 +- .../server/DownloadedPackSource.java | 81 +- .../sounds/AbstractSoundInstance.java | 7 +- .../sounds/BiomeAmbientSoundsHandler.java | 2 +- .../sounds/MinecartSoundInstance.java | 4 +- .../sounds/RidingMinecartSoundInstance.java | 7 +- .../resources/sounds/SimpleSoundInstance.java | 19 +- .../client/server/IntegratedServer.java | 13 +- net/minecraft/client/sounds/MusicManager.java | 4 +- net/minecraft/client/sounds/SoundEngine.java | 28 +- .../client/sounds/SoundEngineExecutor.java | 2 +- net/minecraft/client/sounds/SoundManager.java | 77 +- .../client/telemetry/TelemetryEventLog.java | 12 +- .../client/telemetry/TelemetryLogManager.java | 3 +- .../client/telemetry/TelemetryProperty.java | 23 +- .../client/tutorial/BundleTutorial.java | 61 - .../tutorial/CraftPlanksTutorialStep.java | 4 +- .../FindTreeTutorialStepInstance.java | 7 +- .../MovementTutorialStepInstance.java | 17 +- .../tutorial/OpenInventoryTutorialStep.java | 4 +- .../PunchTreeTutorialStepInstance.java | 4 +- net/minecraft/client/tutorial/Tutorial.java | 46 +- .../client/tutorial/TutorialStepInstance.java | 7 +- .../commands/CommandBuildContext.java | 11 +- .../commands/CommandSourceStack.java | 42 +- net/minecraft/commands/Commands.java | 46 +- .../commands/SharedSuggestionProvider.java | 5 +- .../arguments/ResourceKeyArgument.java | 55 +- .../arguments/ResourceLocationArgument.java | 27 - .../coordinates/WorldCoordinates.java | 7 - .../commands/arguments/item/ItemParser.java | 2 +- .../arguments/selector/SelectorPattern.java | 31 + .../options/EntitySelectorOptions.java | 100 +- .../synchronization/SuggestionProviders.java | 4 - net/minecraft/core/BlockPos.java | 22 +- .../core/DefaultedMappedRegistry.java | 6 +- net/minecraft/core/DefaultedRegistry.java | 2 +- net/minecraft/core/Direction.java | 143 +- net/minecraft/core/FrontAndTop.java | 12 +- net/minecraft/core/GlobalPos.java | 4 + net/minecraft/core/Holder.java | 31 +- net/minecraft/core/HolderGetter.java | 6 +- net/minecraft/core/HolderLookup.java | 88 +- net/minecraft/core/HolderSet.java | 21 +- net/minecraft/core/MappedRegistry.java | 312 +- net/minecraft/core/Registry.java | 79 +- net/minecraft/core/RegistryAccess.java | 30 +- net/minecraft/core/RegistrySetBuilder.java | 57 +- .../core/RegistrySynchronization.java | 12 +- net/minecraft/core/SectionPos.java | 4 +- net/minecraft/core/Vec3i.java | 7 + net/minecraft/core/WritableRegistry.java | 4 + .../core/cauldron/CauldronInteraction.java | 317 +- .../core/component/DataComponentHolder.java | 5 + .../core/component/DataComponentPatch.java | 2 +- .../component/DataComponentPredicate.java | 17 + .../core/component/DataComponents.java | 61 +- .../component/PatchedDataComponentMap.java | 5 + .../dispenser/BoatDispenseItemBehavior.java | 33 +- .../core/dispenser/DispenseItemBehavior.java | 114 +- .../EquipmentDispenseItemBehavior.java | 39 + .../MinecartDispenseItemBehavior.java | 79 + .../dispenser/ProjectileDispenseBehavior.java | 21 +- .../dispenser/ShearsDispenseItemBehavior.java | 10 +- .../core/particles/ColorParticleOption.java | 12 +- .../particles/DustColorTransitionOptions.java | 32 +- .../core/particles/DustParticleOptions.java | 24 +- .../core/particles/ItemParticleOption.java | 3 +- .../core/particles/ParticleTypes.java | 6 + .../particles/TargetColorParticleOption.java | 27 + .../core/registries/BuiltInRegistries.java | 39 +- net/minecraft/core/registries/Registries.java | 24 +- net/minecraft/data/BlockFamilies.java | 18 +- net/minecraft/data/DataProvider.java | 27 +- net/minecraft/data/Main.java | 61 +- .../advancements/AdvancementProvider.java | 3 +- .../packs/VanillaAdventureAdvancements.java | 419 +- .../packs/VanillaHusbandryAdvancements.java | 275 +- .../packs/VanillaNetherAdvancements.java | 256 +- .../packs/VanillaStoryAdvancements.java | 102 +- .../packs/VanillaTheEndAdvancements.java | 64 +- .../packs/WinterDropAdvancementProvider.java | 13 + .../WinterDropAdventureAdvancements.java | 28 + .../data/info/BiomeParametersDumpReport.java | 3 +- net/minecraft/data/info/BlockListReport.java | 3 +- net/minecraft/data/info/CommandsReport.java | 3 +- .../data/info/DatapackStructureReport.java | 135 + net/minecraft/data/info/ItemListReport.java | 3 +- net/minecraft/data/info/PacketReport.java | 7 +- .../data/info/RegistryDumpReport.java | 9 +- .../data/loot/BlockLootSubProvider.java | 172 +- .../data/loot/EntityLootSubProvider.java | 96 +- .../data/loot/LootTableProvider.java | 23 +- net/minecraft/data/loot/packs/LootData.java | 29 + .../data/loot/packs/VanillaBlockLoot.java | 130 +- .../data/loot/packs/VanillaEntityLoot.java | 59 +- .../data/loot/packs/VanillaEquipmentLoot.java | 49 +- .../data/loot/packs/VanillaGiftLoot.java | 16 + .../data/loot/packs/VanillaShearingLoot.java | 55 + .../data/loot/packs/WinterDropBlockLoot.java | 40 + .../packs/WinterDropLootTableProvider.java | 17 + .../data/models/BlockModelGenerators.java | 1240 +-- .../data/models/EquipmentModelProvider.java | 37 + .../data/models/ItemModelGenerators.java | 115 +- net/minecraft/data/models/ModelProvider.java | 10 +- .../data/models/model/ModelTemplates.java | 5 + .../data/models/model/TextureMapping.java | 4 + .../data/models/model/TexturedModel.java | 1 + net/minecraft/data/recipes/RecipeBuilder.java | 9 +- net/minecraft/data/recipes/RecipeOutput.java | 10 +- .../data/recipes/RecipeProvider.java | 828 +- .../data/recipes/ShapedRecipeBuilder.java | 52 +- .../data/recipes/ShapelessRecipeBuilder.java | 73 +- .../recipes/SimpleCookingRecipeBuilder.java | 28 +- .../data/recipes/SingleItemRecipeBuilder.java | 25 +- .../SmithingTransformRecipeBuilder.java | 32 +- .../recipes/SmithingTrimRecipeBuilder.java | 28 +- .../data/recipes/SpecialRecipeBuilder.java | 8 +- .../data/recipes/TransmuteRecipeBuilder.java | 73 + .../recipes/packs/BundleRecipeProvider.java | 28 - .../recipes/packs/VanillaRecipeProvider.java | 3233 +++--- .../packs/WinterDropRecipeProvider.java | 46 + .../RegistriesDatapackGenerator.java | 3 +- .../registries/RegistryPatchGenerator.java | 14 +- .../data/registries/VanillaRegistries.java | 10 +- .../data/registries/WinterDropRegistries.java | 26 + net/minecraft/data/structures/NbtToSnbt.java | 2 +- net/minecraft/data/structures/SnbtToNbt.java | 4 +- .../data/structures/StructureUpdater.java | 8 +- .../data/tags/BannerPatternTagsProvider.java | 6 +- .../data/tags/DamageTypeTagsProvider.java | 13 +- .../data/tags/EntityTypeTagsProvider.java | 12 + net/minecraft/data/tags/TagsProvider.java | 3 +- .../data/tags/VanillaBlockTagsProvider.java | 1 + .../data/tags/VanillaItemTagsProvider.java | 46 +- .../tags/WinterDropBiomeTagsProvider.java | 25 + .../tags/WinterDropBlockTagsProvider.java | 45 + .../WinterDropEntityTypeTagsProvider.java | 19 + .../data/tags/WinterDropItemTagsProvider.java | 43 + .../data/worldgen/BiomeDefaultFeatures.java | 105 +- net/minecraft/data/worldgen/Pools.java | 8 +- .../worldgen/TrialChambersStructurePools.java | 131 +- .../data/worldgen/WinterDropBiomes.java | 28 + .../data/worldgen/biome/BiomeData.java | 2 +- .../data/worldgen/biome/NetherBiomes.java | 60 +- .../data/worldgen/biome/OverworldBiomes.java | 257 +- .../worldgen/features/AquaticFeatures.java | 5 - .../data/worldgen/features/CaveFeatures.java | 2 +- .../data/worldgen/features/FeatureUtils.java | 2 +- .../features/MiscOverworldFeatures.java | 9 +- .../data/worldgen/features/TreeFeatures.java | 81 +- .../worldgen/features/VegetationFeatures.java | 151 +- .../worldgen/placement/AquaticPlacements.java | 38 +- .../worldgen/placement/TreePlacements.java | 104 +- .../placement/VegetationPlacements.java | 106 +- .../gametest/framework/GameTestHelper.java | 106 +- .../gametest/framework/GameTestInfo.java | 6 +- .../gametest/framework/GameTestServer.java | 21 +- .../framework/JUnitLikeTestReporter.java | 2 +- .../gametest/framework/LogTestReporter.java | 2 +- .../gametest/framework/StructureUtils.java | 40 +- .../gametest/framework/TestCommand.java | 12 +- .../locale/DeprecatedTranslationsInfo.java | 92 + net/minecraft/locale/Language.java | 15 +- net/minecraft/network/FriendlyByteBuf.java | 44 +- net/minecraft/network/chat/ChatType.java | 4 +- .../network/chat/ChatTypeDecoration.java | 19 +- net/minecraft/network/chat/Component.java | 20 +- .../network/chat/ComponentContents.java | 6 +- net/minecraft/network/chat/HoverEvent.java | 24 +- .../network/chat/contents/ScoreContents.java | 69 +- .../chat/contents/SelectorContents.java | 83 +- .../network/codec/ByteBufCodecs.java | 74 +- net/minecraft/network/codec/StreamCodec.java | 92 + .../common/ClientCommonPacketListener.java | 3 +- .../ClientboundCustomPayloadPacket.java | 2 + .../common/ServerCommonPacketListener.java | 3 +- .../RedstoneWireOrientationsDebugPayload.java | 35 + .../game/ClientGamePacketListener.java | 23 +- .../game/ClientboundAddEntityPacket.java | 12 +- .../game/ClientboundContainerClosePacket.java | 4 +- .../ClientboundContainerSetContentPacket.java | 4 +- .../ClientboundContainerSetDataPacket.java | 4 +- .../ClientboundContainerSetSlotPacket.java | 6 +- .../game/ClientboundCooldownPacket.java | 9 +- .../ClientboundEntityPositionSyncPacket.java | 36 + .../game/ClientboundExplodePacket.java | 164 +- .../ClientboundHorseScreenOpenPacket.java | 4 +- .../game/ClientboundMerchantOffersPacket.java | 4 +- .../game/ClientboundMoveEntityPacket.java | 9 +- .../game/ClientboundMoveMinecartPacket.java | 36 + .../game/ClientboundOpenScreenPacket.java | 2 +- .../ClientboundPlaceGhostRecipePacket.java | 44 +- .../ClientboundPlayerInfoUpdatePacket.java | 37 +- .../game/ClientboundPlayerPositionPacket.java | 87 +- .../game/ClientboundPlayerRotationPacket.java | 22 + .../game/ClientboundRecipeBookAddPacket.java | 52 + .../ClientboundRecipeBookRemovePacket.java | 24 + .../ClientboundRecipeBookSettingsPacket.java | 22 + .../game/ClientboundRecipePacket.java | 87 - .../game/ClientboundRotateHeadPacket.java | 5 +- .../game/ClientboundSetCarriedItemPacket.java | 44 - .../game/ClientboundSetCursorItemPacket.java | 22 + .../game/ClientboundSetEquipmentPacket.java | 3 +- .../game/ClientboundSetHeldSlotPacket.java | 38 + .../ClientboundSetPlayerInventoryPacket.java | 27 + .../game/ClientboundSetTimePacket.java | 49 +- .../game/ClientboundTeleportEntityPacket.java | 90 +- .../game/ClientboundUpdateRecipesPacket.java | 28 +- .../protocol/game/CommonPlayerSpawnInfo.java | 5 +- .../network/protocol/game/DebugPackets.java | 7 + .../protocol/game/GamePacketTypes.java | 13 +- .../network/protocol/game/GameProtocols.java | 19 +- .../game/ServerGamePacketListener.java | 6 +- .../game/ServerboundClientTickEndPacket.java | 20 + ...ServerboundContainerButtonClickPacket.java | 2 +- .../game/ServerboundContainerClickPacket.java | 4 +- .../game/ServerboundContainerClosePacket.java | 4 +- ...rboundContainerSlotStateChangedPacket.java | 4 +- .../game/ServerboundEditBookPacket.java | 8 +- .../game/ServerboundMovePlayerPacket.java | 95 +- .../game/ServerboundMoveVehiclePacket.java | 6 +- .../game/ServerboundPlaceRecipePacket.java | 52 +- .../game/ServerboundPlayerInputPacket.java | 65 +- ...ServerboundRecipeBookSeenRecipePacket.java | 29 +- .../ServerboundSelectBundleItemPacket.java | 30 + .../game/ServerboundSetJigsawBlockPacket.java | 2 +- .../login/ClientLoginPacketListener.java | 5 +- .../login/ClientboundGameProfilePacket.java | 36 - .../login/ClientboundLoginFinishedPacket.java | 28 + .../protocol/login/LoginPacketTypes.java | 2 +- .../protocol/login/LoginProtocols.java | 7 +- .../login/ServerLoginPacketListener.java | 3 +- net/minecraft/realms/RealmsConnect.java | 7 +- .../realms/RealmsObjectSelectionList.java | 64 - net/minecraft/realms/RealmsScreen.java | 1 + net/minecraft/recipebook/PlaceRecipe.java | 58 - .../recipebook/PlaceRecipeHelper.java | 59 + .../recipebook/ServerPlaceRecipe.java | 292 +- .../package-info.java | 2 +- net/minecraft/resources/DependantName.java | 10 + .../resources/RegistryDataLoader.java | 143 +- net/minecraft/server/Bootstrap.java | 8 +- net/minecraft/server/Main.java | 44 +- net/minecraft/server/MinecraftServer.java | 309 +- net/minecraft/server/PlayerAdvancements.java | 7 +- .../server/ReloadableServerRegistries.java | 110 +- .../server/ReloadableServerResources.java | 118 +- .../server/ServerAdvancementManager.java | 31 +- .../server/ServerFunctionLibrary.java | 27 +- .../server/ServerFunctionManager.java | 13 +- .../server/SuppressedExceptionCollector.java | 78 + net/minecraft/server/WorldLoader.java | 55 +- net/minecraft/server/chase/ChaseClient.java | 10 +- net/minecraft/server/chase/ChaseServer.java | 2 +- .../server/commands/AdvancementCommands.java | 99 +- .../server/commands/CloneCommands.java | 2 +- .../server/commands/DamageCommand.java | 2 +- .../server/commands/EnchantCommand.java | 2 +- .../server/commands/ExecuteCommand.java | 30 +- .../server/commands/ExperienceCommand.java | 22 +- .../server/commands/FillBiomeCommand.java | 2 +- .../server/commands/GameRuleCommand.java | 28 +- .../server/commands/KillCommand.java | 2 +- .../server/commands/LocateCommand.java | 19 +- net/minecraft/server/commands/LookAt.java | 30 + .../server/commands/LootCommand.java | 39 +- .../server/commands/PlaceCommand.java | 7 +- .../server/commands/RaidCommand.java | 8 +- .../server/commands/RecipeCommand.java | 14 +- .../server/commands/RotateCommand.java | 85 + .../server/commands/ScheduleCommand.java | 15 +- .../commands/SetPlayerIdleTimeoutCommand.java | 7 +- .../commands/SpawnArmorTrimsCommand.java | 105 +- .../server/commands/SpreadPlayersCommand.java | 8 +- .../server/commands/SummonCommand.java | 6 +- .../server/commands/TeleportCommand.java | 169 +- .../server/commands/TickCommand.java | 7 +- .../server/dedicated/DedicatedServer.java | 48 +- .../dedicated/DedicatedServerProperties.java | 24 +- .../server/dedicated/ServerWatchdog.java | 49 +- .../server/level/ChunkGenerationTask.java | 17 +- net/minecraft/server/level/ChunkHolder.java | 57 +- net/minecraft/server/level/ChunkMap.java | 287 +- .../server/level/ChunkTaskDispatcher.java | 97 + .../server/level/ChunkTaskPriorityQueue.java | 90 +- .../level/ChunkTaskPriorityQueueSorter.java | 204 - .../server/level/ClientInformation.java | 9 +- net/minecraft/server/level/DemoMode.java | 4 +- .../server/level/DistanceManager.java | 76 +- .../server/level/GenerationChunkHolder.java | 28 +- .../level}/ParticleStatus.java | 18 +- .../server/level/PlayerRespawnLogic.java | 4 +- .../server/level/ServerChunkCache.java | 191 +- net/minecraft/server/level/ServerEntity.java | 116 +- .../server/level/ServerEntityGetter.java | 81 + net/minecraft/server/level/ServerLevel.java | 215 +- net/minecraft/server/level/ServerPlayer.java | 586 +- .../server/level/ServerPlayerGameMode.java | 62 +- .../level/ThreadedLevelLightEngine.java | 27 +- .../level/ThrottlingChunkTaskDispatcher.java | 48 + net/minecraft/server/level/TicketType.java | 1 + .../server/level/TickingTracker.java | 5 + .../server/level/WorldGenRegion.java | 9 +- .../ProcessorChunkProgressListener.java | 14 +- .../server/network/LegacyTextFilter.java | 189 + .../PlayerSafetyServiceTextFilter.java | 170 + .../ServerCommonPacketListenerImpl.java | 14 +- ...ServerConfigurationPacketListenerImpl.java | 5 +- .../network/ServerGamePacketListenerImpl.java | 273 +- .../ServerLoginPacketListenerImpl.java | 4 +- .../server/network/ServerTextFilter.java | 295 + net/minecraft/server/network/TextFilter.java | 14 +- .../server/network/TextFilterClient.java | 410 - net/minecraft/server/packs/DownloadQueue.java | 9 +- .../packs/repository/PackRepository.java | 5 + .../resources/PreparableReloadListener.java | 8 +- .../resources/ProfiledReloadInstance.java | 60 +- .../ResourceManagerReloadListener.java | 17 +- .../SimpleJsonResourceReloadListener.java | 61 +- .../SimplePreparableReloadListener.java | 12 +- .../packs/resources/SimpleReloadInstance.java | 3 +- .../server/players/GameProfileCache.java | 4 +- net/minecraft/server/players/PlayerList.java | 84 +- net/minecraft/sounds/SoundEvent.java | 35 +- net/minecraft/sounds/SoundEvents.java | 39 +- net/minecraft/stats/RecipeBook.java | 65 +- net/minecraft/stats/RecipeBookSettings.java | 130 +- net/minecraft/stats/ServerRecipeBook.java | 153 +- net/minecraft/stats/StatFormatter.java | 2 +- net/minecraft/tags/BannerPatternTags.java | 2 + net/minecraft/tags/BlockTags.java | 4 +- net/minecraft/tags/DamageTypeTags.java | 1 + net/minecraft/tags/EntityTypeTags.java | 1 + net/minecraft/tags/ItemTags.java | 24 + net/minecraft/tags/TagEntry.java | 4 +- net/minecraft/tags/TagKey.java | 6 + net/minecraft/tags/TagLoader.java | 126 +- net/minecraft/tags/TagManager.java | 62 - .../tags/TagNetworkSerialization.java | 46 +- net/minecraft/util/ARGB.java | 116 + net/minecraft/util/BinaryAnimator.java | 37 + net/minecraft/util/CommonColors.java | 4 +- net/minecraft/util/CommonLinks.java | 14 +- net/minecraft/util/ExtraCodecs.java | 23 +- net/minecraft/util/FastColor.java | 104 - net/minecraft/util/GsonHelper.java | 2 +- net/minecraft/util/MemoryReserve.java | 13 +- net/minecraft/util/Mth.java | 56 +- net/minecraft/util/RandomSource.java | 4 + net/minecraft/util/SpawnUtil.java | 29 +- net/minecraft/util/StringRepresentable.java | 4 + net/minecraft/util/StringUtil.java | 2 +- net/minecraft/util/TickThrottler.java | 26 + net/minecraft/util/TriState.java | 15 + net/minecraft/util/context/ContextKey.java | 23 + net/minecraft/util/context/ContextKeySet.java | 56 + net/minecraft/util/context/ContextMap.java | 88 + net/minecraft/util/context/package-info.java | 8 + net/minecraft/util/datafix/DataFixers.java | 46 +- .../util/datafix/ExtraDataFixUtils.java | 48 + .../datafix/fixes/AttributeIdPrefixFix.java | 26 + .../datafix/fixes/AttributesRenameFix.java | 62 + ...ename.java => AttributesRenameLegacy.java} | 22 +- .../util/datafix/fixes/BoatSplitFix.java | 82 + .../datafix/fixes/CarvingStepRemoveFix.java | 35 + .../fixes/ChunkPalettedStorageFix.java | 1021 +- .../ContainerBlockEntityLockPredicateFix.java | 24 + .../util/datafix/fixes/EffectDurationFix.java | 13 +- .../util/datafix/fixes/EntityRenameFix.java | 9 +- ...esistantToDamageResistantComponentFix.java | 15 + .../datafix/fixes/FoodToConsumableFix.java | 43 + .../fixes/LockComponentPredicateFix.java | 31 + .../fixes/NamedEntityWriteReadFix.java | 14 +- .../datafix/fixes/OminousBannerRarityFix.java | 57 + .../TrialSpawnerConfigInRegistryFix.java | 190 + .../fixes/VillagerSetCanPickUpLootFix.java | 23 + net/minecraft/util/datafix/schemas/V1022.java | 1 + net/minecraft/util/datafix/schemas/V135.java | 2 + net/minecraft/util/datafix/schemas/V1460.java | 1 + .../util/datafix/schemas/V3818_3.java | 55 +- net/minecraft/util/datafix/schemas/V4059.java | 32 + net/minecraft/util/datafix/schemas/V4067.java | 44 + net/minecraft/util/datafix/schemas/V4070.java | 25 + net/minecraft/util/datafix/schemas/V4071.java | 28 + net/minecraft/util/datafix/schemas/V705.java | 38 +- .../util/debugchart/package-info.java | 8 + .../util/profiling/InactiveProfiler.java | 13 +- .../util/profiling/ProfileCollector.java | 3 +- net/minecraft/util/profiling/Profiler.java | 57 + .../util/profiling/ProfilerFiller.java | 159 +- .../util/profiling/SingleTickProfiler.java | 2 +- .../util/profiling/TracyZoneFiller.java | 140 + net/minecraft/util/profiling/Zone.java | 52 + .../jfr/event/ChunkGenerationEvent.java | 2 +- .../profiling/metrics/MetricCategory.java | 2 +- .../profiling/ActiveMetricsRecorder.java | 2 +- .../thread/AbstractConsecutiveExecutor.java | 135 + .../util/thread/BlockableEventLoop.java | 33 +- .../util/thread/ConsecutiveExecutor.java | 15 + .../thread/PriorityConsecutiveExecutor.java | 23 + .../util/thread/ProcessorHandle.java | 50 - .../util/thread/ProcessorMailbox.java | 156 - net/minecraft/util/thread/StrictQueue.java | 54 +- net/minecraft/util/thread/TaskScheduler.java | 45 + .../util/worldupdate/WorldUpgrader.java | 51 +- net/minecraft/world/Difficulty.java | 3 +- net/minecraft/world/InteractionResult.java | 69 +- .../world/InteractionResultHolder.java | 39 - .../world/ItemInteractionResult.java | 28 - net/minecraft/world/LockCode.java | 41 +- net/minecraft/world/SimpleContainer.java | 6 +- .../world/damagesource/DamageSources.java | 20 +- .../world/damagesource/DamageTypes.java | 6 + .../world/effect/AbsorptionMobEffect.java | 5 +- .../world/effect/BadOmenMobEffect.java | 20 +- .../world/effect/HealOrHarmMobEffect.java | 21 +- .../world/effect/HungerMobEffect.java | 5 +- .../world/effect/InfestedMobEffect.java | 27 +- net/minecraft/world/effect/MobEffect.java | 15 +- .../world/effect/MobEffectInstance.java | 13 +- .../world/effect/OozingMobEffect.java | 17 +- .../world/effect/PoisonMobEffect.java | 5 +- .../world/effect/RaidOmenMobEffect.java | 3 +- .../world/effect/RegenerationMobEffect.java | 3 +- .../world/effect/SaturationMobEffect.java | 7 +- .../world/effect/WeavingMobEffect.java | 28 +- .../world/effect/WindChargedMobEffect.java | 4 +- .../world/effect/WitherMobEffect.java | 5 +- net/minecraft/world/entity/AgeableMob.java | 28 +- .../world/entity/AnimationState.java | 32 +- .../world/entity/AreaEffectCloud.java | 162 +- .../world/entity/ConversionParams.java | 15 + .../world/entity/ConversionType.java | 146 + net/minecraft/world/entity/Display.java | 158 +- .../world/entity/ElytraAnimationState.java | 65 + net/minecraft/world/entity/Entity.java | 777 +- net/minecraft/world/entity/EntityEvent.java | 3 +- .../world/entity/EntitySelector.java | 32 +- .../world/entity/EntitySpawnReason.java | 31 + net/minecraft/world/entity/EntityType.java | 533 +- net/minecraft/world/entity/EquipmentSlot.java | 25 +- .../world/entity/EquipmentSlotGroup.java | 5 +- .../world/entity/EquipmentTable.java | 7 +- net/minecraft/world/entity/EquipmentUser.java | 40 +- net/minecraft/world/entity/ExperienceOrb.java | 18 +- net/minecraft/world/entity/FlyingMob.java | 2 - net/minecraft/world/entity/GlowSquid.java | 25 +- net/minecraft/world/entity/HumanoidArm.java | 3 +- net/minecraft/world/entity/Interaction.java | 12 +- net/minecraft/world/entity/Leashable.java | 19 +- net/minecraft/world/entity/LerpingModel.java | 8 - net/minecraft/world/entity/LightningBolt.java | 13 +- net/minecraft/world/entity/LivingEntity.java | 1027 +- net/minecraft/world/entity/Marker.java | 11 +- net/minecraft/world/entity/Mob.java | 335 +- net/minecraft/world/entity/MobSpawnType.java | 29 - net/minecraft/world/entity/NeutralMob.java | 16 +- .../world/entity/OminousItemSpawner.java | 74 +- net/minecraft/world/entity/PathfinderMob.java | 4 +- .../world/entity/PortalProcessor.java | 8 +- .../world/entity/PositionMoveRotation.java | 65 + net/minecraft/world/entity/PowerableMob.java | 5 - net/minecraft/world/entity/Relative.java | 71 + .../world/entity/RelativeMovement.java | 50 - net/minecraft/world/entity/Shearable.java | 4 +- .../world/entity/SpawnPlacements.java | 26 +- net/minecraft/world/entity/TamableAnimal.java | 16 +- .../world/entity/WalkAnimationState.java | 18 +- .../ai/attributes/AttributeInstance.java | 10 + .../entity/ai/attributes/AttributeMap.java | 11 +- .../ai/attributes/AttributeModifier.java | 5 +- .../entity/ai/attributes/Attributes.java | 74 +- .../ai/attributes/DefaultAttributes.java | 3 + .../CelebrateVillagersSurvivedRaid.java | 4 +- .../entity/ai/behavior/GiveGiftToHero.java | 66 +- .../entity/ai/behavior/GoToWantedItem.java | 3 +- .../ai/behavior/LongJumpToRandomPos.java | 6 +- .../world/entity/ai/behavior/MeleeAttack.java | 14 +- .../ai/behavior/PrepareRamNearestTarget.java | 2 +- .../world/entity/ai/behavior/RamTarget.java | 2 +- .../entity/ai/behavior/StartAttacking.java | 25 +- .../StopAttackingIfTargetInvalid.java | 31 +- .../world/entity/ai/behavior/Swim.java | 4 +- .../entity/ai/behavior/WorkAtComposter.java | 6 +- .../entity/ai/behavior/warden/SonicBoom.java | 2 +- .../world/entity/ai/control/Control.java | 7 + .../world/entity/ai/control/LookControl.java | 9 - .../ai/control/SmoothSwimmingMoveControl.java | 2 +- .../world/entity/ai/goal/AvoidEntityGoal.java | 7 +- .../world/entity/ai/goal/BegGoal.java | 6 +- .../world/entity/ai/goal/BreakDoorGoal.java | 2 +- .../world/entity/ai/goal/BreedGoal.java | 7 +- .../world/entity/ai/goal/EatBlockGoal.java | 4 +- .../world/entity/ai/goal/FollowBoatGoal.java | 12 +- net/minecraft/world/entity/ai/goal/Goal.java | 11 + .../world/entity/ai/goal/GoalSelector.java | 11 +- .../entity/ai/goal/LookAtPlayerGoal.java | 26 +- .../world/entity/ai/goal/MeleeAttackGoal.java | 2 +- .../entity/ai/goal/OcelotAttackGoal.java | 2 +- .../world/entity/ai/goal/OfferFlowerGoal.java | 3 +- .../world/entity/ai/goal/RemoveBlockGoal.java | 2 +- .../world/entity/ai/goal/TemptGoal.java | 7 +- .../goal/target/DefendVillageTargetGoal.java | 6 +- .../ai/goal/target/HurtByTargetGoal.java | 2 +- .../target/NearestAttackableTargetGoal.java | 45 +- .../NearestAttackableWitchTargetGoal.java | 8 +- .../NearestHealableRaiderTargetGoal.java | 6 +- .../goal/target/NonTameRandomTargetGoal.java | 10 +- .../target/ResetUniversalAngerTargetGoal.java | 2 +- .../entity/ai/goal/target/TargetGoal.java | 2 +- .../memory/NearestVisibleLivingEntities.java | 9 +- .../ai/navigation/GroundPathNavigation.java | 27 +- .../entity/ai/navigation/PathNavigation.java | 40 +- .../navigation/WaterBoundPathNavigation.java | 2 +- .../ai/sensing/AxolotlAttackablesSensor.java | 11 +- .../ai/sensing/BreezeAttackEntitySensor.java | 14 +- .../ai/sensing/FrogAttackablesSensor.java | 13 +- .../entity/ai/sensing/NearestItemSensor.java | 2 +- .../ai/sensing/NearestLivingEntitySensor.java | 14 +- .../NearestVisibleLivingEntitySensor.java | 12 +- .../ai/sensing/PiglinSpecificSensor.java | 2 +- .../world/entity/ai/sensing/PlayerSensor.java | 11 +- .../world/entity/ai/sensing/Sensing.java | 7 +- .../world/entity/ai/sensing/Sensor.java | 62 +- .../entity/ai/sensing/TemptingSensor.java | 8 +- .../ai/sensing/VillagerHostilesSensor.java | 5 +- .../entity/ai/sensing/WardenEntitySensor.java | 10 - .../ai/targeting/TargetingConditions.java | 34 +- .../entity/ai/util/AirAndWaterRandomPos.java | 2 +- .../world/entity/ai/util/GoalUtils.java | 2 +- .../world/entity/ai/util/HoverRandomPos.java | 5 +- .../world/entity/ai/util/LandRandomPos.java | 2 +- .../world/entity/ai/util/RandomPos.java | 28 +- .../world/entity/ai/village/VillageSiege.java | 6 +- .../entity/ai/village/poi/PoiManager.java | 10 +- .../entity/ai/village/poi/PoiRecord.java | 33 +- .../entity/ai/village/poi/PoiSection.java | 32 +- .../world/entity/ai/village/poi/PoiTypes.java | 2 +- net/minecraft/world/entity/ambient/Bat.java | 53 +- .../world/entity/animal/AbstractFish.java | 8 +- .../entity/animal/AbstractSchoolingFish.java | 8 +- .../entity/animal/AgeableWaterCreature.java | 80 + net/minecraft/world/entity/animal/Animal.java | 44 +- net/minecraft/world/entity/animal/Bee.java | 336 +- .../world/entity/animal/Bucketable.java | 2 +- net/minecraft/world/entity/animal/Cat.java | 96 +- .../world/entity/animal/Chicken.java | 26 +- net/minecraft/world/entity/animal/Cow.java | 12 +- .../world/entity/animal/Dolphin.java | 61 +- net/minecraft/world/entity/animal/Fox.java | 183 +- .../world/entity/animal/IronGolem.java | 35 +- .../world/entity/animal/MushroomCow.java | 112 +- net/minecraft/world/entity/animal/Ocelot.java | 29 +- net/minecraft/world/entity/animal/Panda.java | 137 +- net/minecraft/world/entity/animal/Parrot.java | 50 +- net/minecraft/world/entity/animal/Pig.java | 42 +- .../world/entity/animal/PolarBear.java | 30 +- .../world/entity/animal/Pufferfish.java | 27 +- net/minecraft/world/entity/animal/Rabbit.java | 34 +- net/minecraft/world/entity/animal/Salmon.java | 114 +- net/minecraft/world/entity/animal/Sheep.java | 143 +- .../world/entity/animal/SnowGolem.java | 63 +- net/minecraft/world/entity/animal/Squid.java | 77 +- .../world/entity/animal/TropicalFish.java | 23 +- net/minecraft/world/entity/animal/Turtle.java | 41 +- .../world/entity/animal/WaterAnimal.java | 18 +- net/minecraft/world/entity/animal/Wolf.java | 239 +- .../world/entity/animal/WolfVariants.java | 6 +- .../world/entity/animal/allay/Allay.java | 111 +- .../world/entity/animal/allay/AllayAi.java | 6 +- .../entity/animal/armadillo/Armadillo.java | 125 +- .../world/entity/animal/axolotl/Axolotl.java | 125 +- .../entity/animal/axolotl/AxolotlAi.java | 14 +- .../world/entity/animal/camel/Camel.java | 54 +- .../world/entity/animal/frog/Frog.java | 66 +- .../world/entity/animal/frog/FrogAi.java | 18 +- .../world/entity/animal/frog/ShootTongue.java | 2 +- .../world/entity/animal/frog/Tadpole.java | 49 +- .../world/entity/animal/goat/Goat.java | 75 +- .../world/entity/animal/goat/GoatAi.java | 11 +- .../animal/horse/AbstractChestedHorse.java | 20 +- .../entity/animal/horse/AbstractHorse.java | 72 +- .../world/entity/animal/horse/Donkey.java | 3 +- .../world/entity/animal/horse/Horse.java | 35 +- .../world/entity/animal/horse/Llama.java | 57 +- .../world/entity/animal/horse/Mule.java | 3 +- .../entity/animal/horse/SkeletonHorse.java | 18 +- .../entity/animal/horse/SkeletonTrapGoal.java | 12 +- .../entity/animal/horse/TraderLlama.java | 18 +- .../world/entity/animal/horse/Variant.java | 3 +- .../entity/animal/horse/ZombieHorse.java | 18 +- .../world/entity/animal/sniffer/Sniffer.java | 79 +- .../world/entity/boss/EnderDragonPart.java | 9 +- .../boss/enderdragon/DragonFlightHistory.java | 46 + .../entity/boss/enderdragon/EndCrystal.java | 42 +- .../entity/boss/enderdragon/EnderDragon.java | 313 +- .../phases/AbstractDragonPhaseInstance.java | 3 +- .../phases/DragonChargePlayerPhase.java | 3 +- .../enderdragon/phases/DragonDeathPhase.java | 5 +- .../phases/DragonHoldingPatternPhase.java | 13 +- .../enderdragon/phases/DragonHoverPhase.java | 3 +- .../phases/DragonLandingApproachPhase.java | 13 +- .../phases/DragonLandingPhase.java | 5 +- .../phases/DragonPhaseInstance.java | 7 +- .../phases/DragonSittingAttackingPhase.java | 3 +- .../phases/DragonSittingFlamingPhase.java | 9 +- .../phases/DragonSittingScanningPhase.java | 11 +- .../phases/DragonStrafePlayerPhase.java | 9 +- .../phases/DragonTakeoffPhase.java | 7 +- .../world/entity/boss/wither/WitherBoss.java | 69 +- .../world/entity/decoration/ArmorStand.java | 159 +- .../decoration/BlockAttachedEntity.java | 45 +- .../entity/decoration/HangingEntity.java | 5 +- .../world/entity/decoration/ItemFrame.java | 87 +- .../decoration/LeashFenceKnotEntity.java | 9 +- .../world/entity/decoration/Painting.java | 14 +- .../entity/decoration/PaintingVariant.java | 16 +- .../entity/decoration/PaintingVariants.java | 28 +- .../world/entity/item/FallingBlockEntity.java | 61 +- .../world/entity/item/ItemEntity.java | 64 +- .../world/entity/item/PrimedTnt.java | 33 +- .../world/entity/monster/AbstractIllager.java | 4 +- .../entity/monster/AbstractSkeleton.java | 28 +- net/minecraft/world/entity/monster/Blaze.java | 13 +- .../world/entity/monster/Bogged.java | 40 +- .../world/entity/monster/CaveSpider.java | 19 +- .../world/entity/monster/Creeper.java | 28 +- .../world/entity/monster/Drowned.java | 75 +- .../world/entity/monster/ElderGuardian.java | 10 +- .../world/entity/monster/EnderMan.java | 101 +- .../world/entity/monster/Endermite.java | 18 +- .../world/entity/monster/Evoker.java | 57 +- net/minecraft/world/entity/monster/Ghast.java | 34 +- net/minecraft/world/entity/monster/Giant.java | 4 +- .../world/entity/monster/Guardian.java | 68 +- net/minecraft/world/entity/monster/Husk.java | 18 +- .../world/entity/monster/Illusioner.java | 30 +- .../world/entity/monster/MagmaCube.java | 12 +- .../world/entity/monster/Monster.java | 31 +- .../entity/monster/PatrollingMonster.java | 30 +- .../world/entity/monster/Phantom.java | 32 +- .../world/entity/monster/Pillager.java | 27 +- .../world/entity/monster/Ravager.java | 74 +- .../world/entity/monster/Shulker.java | 52 +- .../world/entity/monster/Silverfish.java | 31 +- .../world/entity/monster/Skeleton.java | 19 +- net/minecraft/world/entity/monster/Slime.java | 103 +- .../entity/monster/SpellcasterIllager.java | 11 +- .../world/entity/monster/Spider.java | 22 +- net/minecraft/world/entity/monster/Stray.java | 15 +- .../world/entity/monster/Strider.java | 54 +- net/minecraft/world/entity/monster/Vex.java | 28 +- .../world/entity/monster/Vindicator.java | 37 +- net/minecraft/world/entity/monster/Witch.java | 20 +- .../world/entity/monster/WitherSkeleton.java | 18 +- .../world/entity/monster/Zoglin.java | 71 +- .../world/entity/monster/Zombie.java | 167 +- .../world/entity/monster/ZombieVillager.java | 82 +- .../world/entity/monster/ZombifiedPiglin.java | 34 +- .../world/entity/monster/breeze/Breeze.java | 37 +- .../world/entity/monster/breeze/BreezeAi.java | 13 +- .../entity/monster/breeze/BreezeUtil.java | 13 +- .../world/entity/monster/breeze/LongJump.java | 49 +- .../world/entity/monster/breeze/Shoot.java | 31 +- .../entity/monster/creaking/Creaking.java | 323 + .../entity/monster/creaking/CreakingAi.java | 102 + .../monster/creaking/CreakingTransient.java | 194 + .../entity/monster/creaking/package-info.java | 8 + .../world/entity/monster/hoglin/Hoglin.java | 88 +- .../world/entity/monster/hoglin/HoglinAi.java | 11 +- .../entity/monster/hoglin/HoglinBase.java | 22 +- .../entity/monster/piglin/AbstractPiglin.java | 32 +- .../world/entity/monster/piglin/Piglin.java | 103 +- .../world/entity/monster/piglin/PiglinAi.java | 167 +- .../entity/monster/piglin/PiglinBrute.java | 57 +- .../entity/monster/piglin/PiglinBruteAi.java | 30 +- .../monster/piglin/StartHuntingHoglin.java | 4 +- .../StopHoldingItemIfNoLongerAdmiring.java | 2 +- .../world/entity/monster/warden/Warden.java | 92 +- .../world/entity/monster/warden/WardenAi.java | 16 +- .../monster/warden/WardenSpawnTracker.java | 6 +- .../world/entity/npc/AbstractVillager.java | 17 +- .../world/entity/npc/CatSpawner.java | 6 +- .../world/entity/npc/InventoryCarrier.java | 7 +- net/minecraft/world/entity/npc/Villager.java | 120 +- .../world/entity/npc/VillagerTrades.java | 9 +- .../world/entity/npc/WanderingTrader.java | 9 +- .../entity/npc/WanderingTraderSpawner.java | 6 +- net/minecraft/world/entity/player/Input.java | 40 + .../world/entity/player/Inventory.java | 47 +- net/minecraft/world/entity/player/Player.java | 384 +- .../world/entity/player/ProfilePublicKey.java | 2 +- .../world/entity/player/StackedContents.java | 486 +- .../entity/player/StackedItemContents.java | 67 + .../entity/projectile/AbstractArrow.java | 261 +- .../projectile/AbstractHurtingProjectile.java | 83 +- .../world/entity/projectile/Arrow.java | 7 +- .../entity/projectile/DragonFireball.java | 9 +- .../world/entity/projectile/EvokerFangs.java | 11 +- .../world/entity/projectile/EyeOfEnder.java | 27 +- .../world/entity/projectile/Fireball.java | 13 +- .../projectile/FireworkRocketEntity.java | 43 +- .../world/entity/projectile/FishingHook.java | 34 +- .../entity/projectile/LargeFireball.java | 6 +- .../world/entity/projectile/LlamaSpit.java | 6 +- .../world/entity/projectile/Projectile.java | 148 +- .../entity/projectile/ProjectileUtil.java | 27 +- .../entity/projectile/ShulkerBullet.java | 42 +- .../entity/projectile/SmallFireball.java | 11 +- .../world/entity/projectile/Snowball.java | 8 +- .../entity/projectile/SpectralArrow.java | 2 +- .../projectile/ThrowableItemProjectile.java | 13 +- .../projectile/ThrowableProjectile.java | 78 +- .../world/entity/projectile/ThrownEgg.java | 12 +- .../entity/projectile/ThrownEnderpearl.java | 140 +- .../projectile/ThrownExperienceBottle.java | 9 +- .../world/entity/projectile/ThrownPotion.java | 32 +- .../entity/projectile/ThrownTrident.java | 25 +- .../world/entity/projectile/WitherSkull.java | 12 +- .../windcharge/AbstractWindCharge.java | 17 +- .../windcharge/BreezeWindCharge.java | 2 +- .../projectile/windcharge/WindCharge.java | 9 +- .../projectile/windcharge/package-info.java | 8 + net/minecraft/world/entity/raid/Raid.java | 124 +- net/minecraft/world/entity/raid/Raider.java | 129 +- .../world/entity/vehicle/AbstractBoat.java | 828 ++ .../entity/vehicle/AbstractChestBoat.java | 202 + .../entity/vehicle/AbstractMinecart.java | 725 +- .../vehicle/AbstractMinecartContainer.java | 28 +- net/minecraft/world/entity/vehicle/Boat.java | 944 +- .../world/entity/vehicle/ChestBoat.java | 219 +- .../world/entity/vehicle/ChestRaft.java | 18 + .../world/entity/vehicle/ContainerEntity.java | 46 +- .../world/entity/vehicle/Minecart.java | 57 +- .../entity/vehicle/MinecartBehavior.java | 125 + .../world/entity/vehicle/MinecartChest.java | 21 +- .../entity/vehicle/MinecartCommandBlock.java | 18 +- .../world/entity/vehicle/MinecartFurnace.java | 92 +- .../world/entity/vehicle/MinecartHopper.java | 33 +- .../world/entity/vehicle/MinecartSpawner.java | 16 +- .../world/entity/vehicle/MinecartTNT.java | 66 +- .../entity/vehicle/NewMinecartBehavior.java | 575 ++ .../entity/vehicle/OldMinecartBehavior.java | 453 + net/minecraft/world/entity/vehicle/Raft.java | 18 + .../world/entity/vehicle/VehicleEntity.java | 53 +- net/minecraft/world/flag/FeatureFlags.java | 11 +- net/minecraft/world/food/FoodData.java | 45 +- net/minecraft/world/food/FoodProperties.java | 92 +- net/minecraft/world/food/Foods.java | 61 +- .../inventory/AbstractContainerMenu.java | 82 +- .../world/inventory/AbstractCraftingMenu.java | 93 + .../world/inventory/AbstractFurnaceMenu.java | 113 +- net/minecraft/world/inventory/AnvilMenu.java | 23 +- net/minecraft/world/inventory/BeaconMenu.java | 13 +- .../world/inventory/BlastFurnaceMenu.java | 14 +- .../world/inventory/BrewingStandMenu.java | 14 +- .../world/inventory/CartographyTableMenu.java | 15 +- net/minecraft/world/inventory/ChestMenu.java | 24 +- .../world/inventory/CrafterMenu.java | 19 +- .../world/inventory/CraftingMenu.java | 126 +- .../world/inventory/DispenserMenu.java | 21 +- .../world/inventory/EnchantmentMenu.java | 16 +- .../world/inventory/FurnaceMenu.java | 7 +- .../world/inventory/GrindstoneMenu.java | 11 +- net/minecraft/world/inventory/HopperMenu.java | 15 +- .../world/inventory/HorseInventoryMenu.java | 20 +- .../world/inventory/InventoryMenu.java | 76 +- .../world/inventory/ItemCombinerMenu.java | 57 +- .../ItemCombinerMenuSlotDefinition.java | 28 +- net/minecraft/world/inventory/LoomMenu.java | 17 +- .../world/inventory/MerchantMenu.java | 11 +- .../world/inventory/RecipeBookMenu.java | 48 +- .../world/inventory/RecipeCraftingHolder.java | 9 +- net/minecraft/world/inventory/ResultSlot.java | 24 +- .../world/inventory/ShulkerBoxMenu.java | 10 +- net/minecraft/world/inventory/Slot.java | 20 +- .../world/inventory/SmithingMenu.java | 101 +- net/minecraft/world/inventory/SmokerMenu.java | 5 +- .../inventory/StackedContentsCompatible.java | 5 +- .../world/inventory/StonecutterMenu.java | 83 +- .../inventory/TransientCraftingContainer.java | 8 +- .../world/item/AdventureModePredicate.java | 22 +- net/minecraft/world/item/AirItem.java | 10 +- net/minecraft/world/item/AnimalArmorItem.java | 58 +- net/minecraft/world/item/ArmorItem.java | 169 +- net/minecraft/world/item/ArmorMaterial.java | 63 - net/minecraft/world/item/ArmorMaterials.java | 124 - net/minecraft/world/item/ArmorStandItem.java | 6 +- net/minecraft/world/item/AxeItem.java | 11 +- net/minecraft/world/item/BannerItem.java | 5 +- .../world/item/BannerPatternItem.java | 13 - net/minecraft/world/item/BlockItem.java | 19 +- net/minecraft/world/item/BoatItem.java | 81 +- net/minecraft/world/item/BoneMealItem.java | 12 +- net/minecraft/world/item/BookItem.java | 17 - net/minecraft/world/item/BottleItem.java | 29 +- net/minecraft/world/item/BowItem.java | 41 +- net/minecraft/world/item/BrushItem.java | 19 +- net/minecraft/world/item/BucketItem.java | 31 +- net/minecraft/world/item/BundleItem.java | 292 +- net/minecraft/world/item/ChorusFruitItem.java | 63 - net/minecraft/world/item/CompassItem.java | 9 +- net/minecraft/world/item/ComplexItem.java | 22 - .../world/item/CreativeModeTabs.java | 282 +- net/minecraft/world/item/CrossbowItem.java | 33 +- net/minecraft/world/item/DebugStickItem.java | 8 +- net/minecraft/world/item/DiggerItem.java | 22 +- .../world/item/DiscFragmentItem.java | 2 +- net/minecraft/world/item/DyeColor.java | 7 +- net/minecraft/world/item/DyeItem.java | 2 +- net/minecraft/world/item/EggItem.java | 20 +- net/minecraft/world/item/ElytraItem.java | 42 - net/minecraft/world/item/EmptyMapItem.java | 14 +- .../world/item/EnchantedBookItem.java | 23 - net/minecraft/world/item/EndCrystalItem.java | 2 +- net/minecraft/world/item/EnderEyeItem.java | 58 +- net/minecraft/world/item/EnderpearlItem.java | 18 +- net/minecraft/world/item/Equipable.java | 54 - .../world/item/ExperienceBottleItem.java | 28 +- net/minecraft/world/item/FireChargeItem.java | 13 +- .../world/item/FireworkRocketItem.java | 46 +- net/minecraft/world/item/FishingRodItem.java | 18 +- .../world/item/FlintAndSteelItem.java | 4 +- .../world/item/FoodOnAStickItem.java | 20 +- .../world/item/HangingEntityItem.java | 10 +- net/minecraft/world/item/HoeItem.java | 11 +- net/minecraft/world/item/HoneyBottleItem.java | 72 - net/minecraft/world/item/HoneycombItem.java | 9 +- net/minecraft/world/item/Instrument.java | 19 +- net/minecraft/world/item/InstrumentItem.java | 73 +- net/minecraft/world/item/Instruments.java | 30 +- net/minecraft/world/item/Item.java | 327 +- net/minecraft/world/item/ItemCooldowns.java | 60 +- .../world/item/ItemDisplayContext.java | 3 +- .../world/item/ItemNameBlockItem.java | 14 - net/minecraft/world/item/ItemStack.java | 223 +- .../world/item/ItemUseAnimation.java | 43 + net/minecraft/world/item/ItemUtils.java | 8 +- net/minecraft/world/item/Items.java | 2052 ++-- net/minecraft/world/item/JukeboxPlayable.java | 23 +- .../world/item/JukeboxSongPlayer.java | 7 +- .../world/item/KnowledgeBookItem.java | 23 +- net/minecraft/world/item/LeadItem.java | 13 +- .../world/item/LingeringPotionItem.java | 6 +- net/minecraft/world/item/MaceItem.java | 80 +- net/minecraft/world/item/MapItem.java | 21 +- net/minecraft/world/item/MilkBucketItem.java | 52 - net/minecraft/world/item/MinecartItem.java | 111 +- net/minecraft/world/item/MobBucketItem.java | 11 +- net/minecraft/world/item/NameTagItem.java | 4 +- .../world/item/OminousBottleItem.java | 68 - net/minecraft/world/item/PickaxeItem.java | 4 +- .../world/item/PlaceOnWaterBlockItem.java | 10 +- net/minecraft/world/item/PlayerHeadItem.java | 4 +- net/minecraft/world/item/PotionItem.java | 67 +- .../world/item/ProjectileWeaponItem.java | 15 +- net/minecraft/world/item/Rarity.java | 3 +- net/minecraft/world/item/SaddleItem.java | 2 +- .../world/item/ScaffoldingBlockItem.java | 6 +- .../world/item/ServerItemCooldowns.java | 13 +- net/minecraft/world/item/ShearsItem.java | 18 +- net/minecraft/world/item/ShieldItem.java | 33 +- net/minecraft/world/item/ShovelItem.java | 9 +- net/minecraft/world/item/SignItem.java | 6 +- .../world/item/SmithingTemplateItem.java | 55 +- net/minecraft/world/item/SnowballItem.java | 20 +- net/minecraft/world/item/SolidBucketItem.java | 5 - net/minecraft/world/item/SpawnEggItem.java | 41 +- .../world/item/SplashPotionItem.java | 6 +- net/minecraft/world/item/SpyglassItem.java | 13 +- .../world/item/StandingAndWallBlockItem.java | 6 +- .../world/item/SuspiciousStewItem.java | 45 - net/minecraft/world/item/SwordItem.java | 30 +- .../world/item/ThrowablePotionItem.java | 28 +- net/minecraft/world/item/Tier.java | 25 - net/minecraft/world/item/TieredItem.java | 24 - net/minecraft/world/item/Tiers.java | 71 - net/minecraft/world/item/TippedArrowItem.java | 6 +- net/minecraft/world/item/ToolMaterial.java | 85 + net/minecraft/world/item/TridentItem.java | 121 +- net/minecraft/world/item/UseAnim.java | 14 - net/minecraft/world/item/WindChargeItem.java | 37 +- .../world/item/WritableBookItem.java | 10 +- net/minecraft/world/item/WrittenBookItem.java | 23 +- net/minecraft/world/item/alchemy/Potion.java | 33 +- .../world/item/alchemy/PotionContents.java | 55 +- net/minecraft/world/item/alchemy/Potions.java | 40 +- .../world/item/armortrim/ArmorTrim.java | 135 - .../world/item/armortrim/TrimMaterials.java | 77 - .../world/item/component/BundleContents.java | 66 +- .../world/item/component/Consumable.java | 179 + .../item/component/ConsumableListener.java | 9 + .../world/item/component/Consumables.java | 71 + .../world/item/component/DamageResistant.java | 24 + .../world/item/component/DeathProtection.java | 43 + .../world/item/component/DyedItemColor.java | 18 +- .../item/component/FireworkExplosion.java | 5 +- .../component/OminousBottleAmplifier.java | 39 + .../item/component/SuspiciousStewEffects.java | 32 +- net/minecraft/world/item/component/Tool.java | 34 +- .../world/item/component/UseCooldown.java | 40 + .../world/item/component/UseRemainder.java | 49 + .../ApplyStatusEffectsConsumeEffect.java | 64 + .../ClearAllStatusEffectsConsumeEffect.java | 24 + .../item/consume_effects/ConsumeEffect.java | 47 + .../PlaySoundConsumeEffect.java | 31 + .../RemoveStatusEffectsConsumeEffect.java | 47 + .../TeleportRandomlyConsumeEffect.java | 84 + .../item/consume_effects/package-info.java | 8 + .../item/crafting/AbstractCookingRecipe.java | 145 +- .../world/item/crafting/ArmorDyeRecipe.java | 51 +- .../item/crafting/BannerDuplicateRecipe.java | 81 +- .../world/item/crafting/BlastingRecipe.java | 24 +- .../item/crafting/BookCloningRecipe.java | 59 +- .../item/crafting/CampfireCookingRecipe.java | 21 +- .../item/crafting/CookingBookCategory.java | 25 +- .../item/crafting/CraftingBookCategory.java | 3 +- .../world/item/crafting/CraftingInput.java | 6 +- .../world/item/crafting/CraftingRecipe.java | 34 +- .../world/item/crafting/CustomRecipe.java | 43 +- .../item/crafting/DecoratedPotRecipe.java | 58 +- .../crafting/ExtendedRecipeBookCategory.java | 4 + .../item/crafting/FireworkRocketRecipe.java | 50 +- .../item/crafting/FireworkStarFadeRecipe.java | 53 +- .../item/crafting/FireworkStarRecipe.java | 131 +- .../world/item/crafting/Ingredient.java | 217 +- .../world/item/crafting/MapCloningRecipe.java | 50 +- .../item/crafting/MapExtendingRecipe.java | 4 +- .../world/item/crafting/PlacementInfo.java | 98 + net/minecraft/world/item/crafting/Recipe.java | 53 +- .../world/item/crafting/RecipeAccess.java | 9 + .../item/crafting/RecipeBookCategories.java | 28 + .../item/crafting/RecipeBookCategory.java | 4 + .../world/item/crafting/RecipeCache.java | 22 +- .../world/item/crafting/RecipeHolder.java | 9 +- .../world/item/crafting/RecipeManager.java | 325 +- .../world/item/crafting/RecipeMap.java | 52 + .../item/crafting/RecipePropertySet.java | 51 + .../world/item/crafting/RecipeSerializer.java | 42 +- .../world/item/crafting/RepairItemRecipe.java | 38 +- .../world/item/crafting/SelectableRecipe.java | 58 + .../world/item/crafting/ShapedRecipe.java | 49 +- .../item/crafting/ShapedRecipePattern.java | 108 +- .../world/item/crafting/ShapelessRecipe.java | 100 +- .../item/crafting/ShieldDecorationRecipe.java | 65 +- .../item/crafting/ShulkerBoxColoring.java | 72 - .../crafting/SimpleCookingSerializer.java | 63 - .../SimpleCraftingRecipeSerializer.java | 34 - .../world/item/crafting/SingleItemRecipe.java | 74 +- .../world/item/crafting/SmeltingRecipe.java | 25 +- .../world/item/crafting/SmithingRecipe.java | 30 +- .../crafting/SmithingTransformRecipe.java | 104 +- .../item/crafting/SmithingTrimRecipe.java | 144 +- .../world/item/crafting/SmokingRecipe.java | 21 +- .../item/crafting/StonecutterRecipe.java | 36 +- .../item/crafting/SuspiciousStewRecipe.java | 71 - .../item/crafting/TippedArrowRecipe.java | 9 +- .../world/item/crafting/TransmuteRecipe.java | 146 + .../display/DisplayContentsFactory.java | 24 + .../display/FurnaceRecipeDisplay.java | 50 + .../item/crafting/display/RecipeDisplay.java | 29 + .../crafting/display/RecipeDisplayEntry.java | 49 + .../crafting/display/RecipeDisplayId.java | 11 + .../item/crafting/display/RecipeDisplays.java | 13 + .../display/ShapedCraftingRecipeDisplay.java | 60 + .../ShapelessCraftingRecipeDisplay.java | 40 + .../item/crafting/display/SlotDisplay.java | 318 + .../crafting/display/SlotDisplayContext.java | 18 + .../item/crafting/display/SlotDisplays.java | 16 + .../display/SmithingRecipeDisplay.java | 39 + .../display/StonecutterRecipeDisplay.java | 32 + .../item/crafting/display/package-info.java | 8 + .../item/enchantment/ConditionalEffect.java | 14 +- .../world/item/enchantment/Enchantable.java | 23 + .../world/item/enchantment/Enchantment.java | 79 +- .../EnchantmentEffectComponents.java | 7 +- .../item/enchantment/EnchantmentHelper.java | 72 +- .../world/item/enchantment/Enchantments.java | 214 +- .../item/enchantment/ItemEnchantments.java | 2 +- .../world/item/enchantment/Repairable.java | 25 + .../TargetedConditionalEffect.java | 10 +- .../enchantment/effects/ChangeItemDamage.java | 34 + .../enchantment/effects/DamageEntity.java | 2 +- .../item/enchantment/effects/DamageItem.java | 27 - .../effects/EnchantmentEntityEffect.java | 2 +- .../EnchantmentLocationBasedEffect.java | 2 +- .../effects/SpawnParticlesEffect.java | 10 +- .../effects/SummonEntityEffect.java | 4 +- .../world/item/equipment/ArmorMaterial.java | 76 + .../world/item/equipment/ArmorMaterials.java | 65 + .../world/item/equipment/ArmorType.java | 41 + .../world/item/equipment/EquipmentModel.java | 125 + .../world/item/equipment/EquipmentModels.java | 84 + .../world/item/equipment/Equippable.java | 174 + .../world/item/equipment/package-info.java | 8 + .../world/item/equipment/trim/ArmorTrim.java | 75 + .../trim}/TrimMaterial.java | 21 +- .../item/equipment/trim/TrimMaterials.java | 67 + .../trim}/TrimPattern.java | 9 +- .../trim}/TrimPatterns.java | 60 +- .../item/equipment/trim/package-info.java | 8 + .../world/item/trading/ItemCost.java | 2 +- .../world/level/BaseCommandBlock.java | 2 +- net/minecraft/world/level/BaseSpawner.java | 21 +- .../world/level/BlockAndTintGetter.java | 2 +- .../world/level/BlockCollisions.java | 30 +- net/minecraft/world/level/BlockGetter.java | 94 +- net/minecraft/world/level/ChunkPos.java | 24 + .../world/level/CollisionGetter.java | 31 +- .../world/level/CommonLevelAccessor.java | 4 +- .../world/level/EmptyBlockAndTintGetter.java | 56 + .../world/level/EmptyBlockGetter.java | 2 +- net/minecraft/world/level/EntityGetter.java | 70 - net/minecraft/world/level/Explosion.java | 460 +- .../level/ExplosionDamageCalculator.java | 10 +- net/minecraft/world/level/GameRules.java | 120 +- net/minecraft/world/level/GameType.java | 8 +- net/minecraft/world/level/Level.java | 278 +- net/minecraft/world/level/LevelAccessor.java | 56 +- .../world/level/LevelHeightAccessor.java | 28 +- net/minecraft/world/level/LevelReader.java | 14 +- net/minecraft/world/level/LevelSettings.java | 12 +- net/minecraft/world/level/NaturalSpawner.java | 99 +- .../world/level/PathNavigationRegion.java | 13 +- .../world/level/ScheduledTickAccess.java | 34 + .../world/level/ServerExplosion.java | 336 + .../world/level/StructureManager.java | 6 +- net/minecraft/world/level/biome/Biome.java | 65 +- .../level/biome/BiomeGenerationSettings.java | 51 +- .../world/level/biome/BiomeSource.java | 2 +- .../level/biome/BiomeSpecialEffects.java | 22 +- net/minecraft/world/level/biome/Climate.java | 157 +- .../world/level/biome/FixedBiomeSource.java | 3 +- .../MultiNoiseBiomeSourceParameterList.java | 44 +- .../MultiNoiseBiomeSourceParameterLists.java | 5 + .../level/biome/OverworldBiomeBuilder.java | 43 +- .../world/level/biome/TheEndBiomeSource.java | 4 +- .../level/block/AbstractCandleBlock.java | 11 +- .../level/block/AbstractCauldronBlock.java | 10 +- .../level/block/AbstractFurnaceBlock.java | 21 +- .../world/level/block/AbstractSkullBlock.java | 18 +- .../world/level/block/AmethystBlock.java | 1 - .../level/block/AmethystClusterBlock.java | 25 +- .../world/level/block/AnvilBlock.java | 11 +- .../world/level/block/AttachedStemBlock.java | 26 +- .../world/level/block/AzaleaBlock.java | 6 + .../world/level/block/BambooSaplingBlock.java | 25 +- .../world/level/block/BambooStalkBlock.java | 31 +- .../world/level/block/BannerBlock.java | 18 +- .../world/level/block/BarrelBlock.java | 21 +- .../world/level/block/BarrierBlock.java | 24 +- .../level/block/BaseCoralPlantTypeBlock.java | 30 +- .../level/block/BaseCoralWallFanBlock.java | 24 +- .../world/level/block/BaseFireBlock.java | 15 +- .../level/block/BasePressurePlateBlock.java | 17 +- .../world/level/block/BaseRailBlock.java | 42 +- .../world/level/block/BaseTorchBlock.java | 18 +- .../world/level/block/BeaconBlock.java | 14 +- net/minecraft/world/level/block/BedBlock.java | 35 +- .../world/level/block/BeehiveBlock.java | 96 +- .../world/level/block/BellBlock.java | 59 +- .../world/level/block/BigDripleafBlock.java | 31 +- .../level/block/BigDripleafStemBlock.java | 22 +- net/minecraft/world/level/block/Block.java | 104 +- .../world/level/block/BlockTypes.java | 6 +- net/minecraft/world/level/block/Blocks.java | 8916 ++++++++--------- ...va => BonemealableFeaturePlacerBlock.java} | 28 +- .../world/level/block/BrewingStandBlock.java | 15 +- .../world/level/block/BrushableBlock.java | 24 +- .../world/level/block/BubbleColumnBlock.java | 22 +- .../world/level/block/BushBlock.java | 22 +- .../world/level/block/ButtonBlock.java | 22 +- .../world/level/block/CactusBlock.java | 21 +- .../world/level/block/CakeBlock.java | 38 +- .../block/CalibratedSculkSensorBlock.java | 8 +- .../world/level/block/CampfireBlock.java | 75 +- .../world/level/block/CandleBlock.java | 33 +- .../world/level/block/CandleCakeBlock.java | 35 +- .../world/level/block/CarpetBlock.java | 18 +- .../level/block/CartographyTableBlock.java | 7 +- .../world/level/block/CarvedPumpkinBlock.java | 20 +- .../world/level/block/CauldronBlock.java | 5 +- .../world/level/block/CaveVines.java | 5 +- .../world/level/block/CaveVinesBlock.java | 2 +- .../level/block/CaveVinesPlantBlock.java | 2 +- .../level/block/CeilingHangingSignBlock.java | 32 +- .../world/level/block/ChainBlock.java | 21 +- .../world/level/block/ChestBlock.java | 83 +- .../level/block/ChiseledBookShelfBlock.java | 27 +- .../world/level/block/ChorusFlowerBlock.java | 22 +- .../world/level/block/ChorusPlantBlock.java | 23 +- .../world/level/block/CocoaBlock.java | 17 +- .../world/level/block/CommandBlock.java | 65 +- .../world/level/block/ComparatorBlock.java | 20 +- .../world/level/block/ComposterBlock.java | 33 +- .../level/block/ConcretePowderBlock.java | 19 +- .../world/level/block/ConduitBlock.java | 21 +- .../world/level/block/CopperBulbBlock.java | 6 +- .../world/level/block/CoralBlock.java | 20 +- .../world/level/block/CoralFanBlock.java | 26 +- .../world/level/block/CoralPlantBlock.java | 26 +- .../world/level/block/CoralWallFanBlock.java | 26 +- .../world/level/block/CrafterBlock.java | 38 +- .../world/level/block/CraftingTableBlock.java | 7 +- .../world/level/block/CreakingHeartBlock.java | 193 + .../world/level/block/CropBlock.java | 4 +- .../level/block/CrossCollisionBlock.java | 4 +- .../level/block/DaylightDetectorBlock.java | 16 +- .../world/level/block/DecoratedPotBlock.java | 66 +- .../world/level/block/DetectorRailBlock.java | 2 +- .../world/level/block/DiodeBlock.java | 22 +- .../world/level/block/DirectionalBlock.java | 5 +- .../world/level/block/DirtPathBlock.java | 19 +- .../world/level/block/DispenserBlock.java | 64 +- .../world/level/block/DoorBlock.java | 62 +- .../level/block/DoubleBlockCombiner.java | 74 +- .../world/level/block/DoublePlantBlock.java | 25 +- .../world/level/block/DragonEggBlock.java | 2 +- .../level/block/EnchantingTableBlock.java | 7 +- .../world/level/block/EndGatewayBlock.java | 26 +- .../world/level/block/EndPortalBlock.java | 42 +- .../level/block/EndPortalFrameBlock.java | 4 +- .../world/level/block/EnderChestBlock.java | 45 +- .../block/EquipableCarvedPumpkinBlock.java | 24 - ...aceAttachedHorizontalDirectionalBlock.java | 18 +- .../world/level/block/FallingBlock.java | 20 +- .../world/level/block/FarmBlock.java | 26 +- .../world/level/block/FenceBlock.java | 48 +- .../world/level/block/FenceGateBlock.java | 69 +- .../world/level/block/FireBlock.java | 36 +- .../world/level/block/FlowerBlock.java | 2 +- .../world/level/block/FlowerPotBlock.java | 41 +- .../world/level/block/FrogspawnBlock.java | 20 +- .../world/level/block/FrostedIceBlock.java | 12 +- .../world/level/block/FungusBlock.java | 2 +- .../world/level/block/GlowLichenBlock.java | 24 +- .../world/level/block/GrassBlock.java | 18 +- .../world/level/block/GrindstoneBlock.java | 7 +- .../world/level/block/GrowingPlantBlock.java | 5 +- .../level/block/GrowingPlantBodyBlock.java | 25 +- .../level/block/GrowingPlantHeadBlock.java | 29 +- .../world/level/block/HangingMossBlock.java | 133 + .../world/level/block/HangingRootsBlock.java | 22 +- .../world/level/block/HeavyCoreBlock.java | 31 +- .../world/level/block/HoneyBlock.java | 22 +- .../world/level/block/HopperBlock.java | 24 +- .../block/HorizontalDirectionalBlock.java | 5 +- .../world/level/block/HugeMushroomBlock.java | 21 +- net/minecraft/world/level/block/IceBlock.java | 4 +- .../world/level/block/InfestedBlock.java | 3 +- .../world/level/block/IronBarsBlock.java | 25 +- .../world/level/block/JigsawBlock.java | 17 +- .../world/level/block/JukeboxBlock.java | 17 +- .../world/level/block/LadderBlock.java | 26 +- .../world/level/block/LanternBlock.java | 22 +- .../level/block/LayeredCauldronBlock.java | 12 +- .../world/level/block/LeavesBlock.java | 27 +- .../world/level/block/LecternBlock.java | 39 +- .../world/level/block/LeverBlock.java | 26 +- .../world/level/block/LightBlock.java | 26 +- .../world/level/block/LightningRodBlock.java | 24 +- .../world/level/block/LiquidBlock.java | 28 +- .../world/level/block/LoomBlock.java | 7 +- .../world/level/block/MagmaBlock.java | 20 +- .../level/block/MangrovePropaguleBlock.java | 23 +- .../world/level/block/MangroveRootsBlock.java | 21 +- .../world/level/block/MossyCarpetBlock.java | 323 + .../world/level/block/MultifaceBlock.java | 42 +- .../world/level/block/MushroomBlock.java | 4 +- .../world/level/block/NetherPortalBlock.java | 128 +- .../world/level/block/NetherrackBlock.java | 7 +- .../world/level/block/NoteBlock.java | 60 +- .../world/level/block/NyliumBlock.java | 13 +- .../world/level/block/ObserverBlock.java | 33 +- .../world/level/block/PinkPetalsBlock.java | 4 +- .../world/level/block/PipeBlock.java | 2 +- .../world/level/block/PitcherCropBlock.java | 23 +- .../level/block/PointedDripstoneBlock.java | 57 +- net/minecraft/world/level/block/Portal.java | 4 +- .../world/level/block/PowderSnowBlock.java | 12 +- .../world/level/block/PoweredRailBlock.java | 2 +- .../world/level/block/PumpkinBlock.java | 30 +- .../world/level/block/RedStoneOreBlock.java | 18 +- .../world/level/block/RedStoneWireBlock.java | 148 +- .../world/level/block/RedstoneLampBlock.java | 13 +- .../world/level/block/RedstoneTorchBlock.java | 26 +- .../level/block/RedstoneWallTorchBlock.java | 32 +- .../world/level/block/RepeaterBlock.java | 23 +- .../world/level/block/RespawnAnchorBlock.java | 28 +- .../world/level/block/ScaffoldingBlock.java | 23 +- .../world/level/block/SculkSensorBlock.java | 30 +- .../world/level/block/SculkShriekerBlock.java | 26 +- .../world/level/block/SculkSpreader.java | 35 +- .../world/level/block/SculkVeinBlock.java | 33 +- .../world/level/block/SeaPickleBlock.java | 77 +- .../world/level/block/SeagrassBlock.java | 28 +- .../world/level/block/ShulkerBoxBlock.java | 28 +- .../world/level/block/SignBlock.java | 55 +- .../world/level/block/SkullBlock.java | 2 +- .../world/level/block/SlabBlock.java | 20 +- .../world/level/block/SlimeBlock.java | 8 +- .../world/level/block/SmallDripleafBlock.java | 23 +- .../world/level/block/SmithingTableBlock.java | 7 +- .../world/level/block/SnifferEggBlock.java | 6 +- .../world/level/block/SnowLayerBlock.java | 17 +- .../world/level/block/SnowyDirtBlock.java | 19 +- .../world/level/block/SoulFireBlock.java | 16 +- .../world/level/block/SoulSandBlock.java | 20 +- .../world/level/block/SoundType.java | 12 + .../world/level/block/SpongeBlock.java | 8 +- .../world/level/block/SporeBlossomBlock.java | 17 +- .../level/block/SpreadingSnowyDirtBlock.java | 4 +- .../world/level/block/StairBlock.java | 26 +- .../world/level/block/StandingSignBlock.java | 18 +- .../world/level/block/StemBlock.java | 4 +- .../world/level/block/StonecutterBlock.java | 11 +- .../world/level/block/StructureBlock.java | 15 +- .../world/level/block/SugarCaneBlock.java | 19 +- .../level/block/SweetBerryBushBlock.java | 33 +- .../world/level/block/TallGrassBlock.java | 11 +- .../world/level/block/TintedGlassBlock.java | 8 +- net/minecraft/world/level/block/TntBlock.java | 50 +- .../world/level/block/TransparentBlock.java | 2 +- .../world/level/block/TrapDoorBlock.java | 53 +- .../world/level/block/TrappedChestBlock.java | 2 +- .../world/level/block/TripWireBlock.java | 38 +- .../world/level/block/TripWireHookBlock.java | 37 +- .../world/level/block/TurtleEggBlock.java | 20 +- .../world/level/block/VaultBlock.java | 29 +- .../world/level/block/VineBlock.java | 25 +- .../world/level/block/WallBannerBlock.java | 27 +- .../world/level/block/WallBlock.java | 28 +- .../level/block/WallHangingSignBlock.java | 41 +- .../world/level/block/WallSignBlock.java | 27 +- .../world/level/block/WallSkullBlock.java | 9 +- .../world/level/block/WallTorchBlock.java | 24 +- .../world/level/block/WaterlilyBlock.java | 4 +- .../block/WaterloggedTransparentBlock.java | 21 +- .../world/level/block/WitherRoseBlock.java | 10 +- .../world/level/block/WitherSkullBlock.java | 13 +- .../world/level/block/WoolCarpetBlock.java | 17 +- .../entity/AbstractFurnaceBlockEntity.java | 282 +- .../level/block/entity/BannerBlockEntity.java | 4 +- .../level/block/entity/BannerPatterns.java | 2 +- .../level/block/entity/BarrelBlockEntity.java | 2 +- .../entity/BaseContainerBlockEntity.java | 10 +- .../level/block/entity/BeaconBlockEntity.java | 24 +- .../block/entity/BeehiveBlockEntity.java | 14 +- .../block/entity/BlastFurnaceBlockEntity.java | 4 +- .../world/level/block/entity/BlockEntity.java | 6 +- .../level/block/entity/BlockEntityType.java | 429 +- .../block/entity/BrewingStandBlockEntity.java | 9 +- .../block/entity/BrushableBlockEntity.java | 131 +- .../CalibratedSculkSensorBlockEntity.java | 6 +- .../block/entity/CampfireBlockEntity.java | 62 +- .../entity/ChiseledBookShelfBlockEntity.java | 7 +- .../block/entity/CommandBlockEntity.java | 6 +- .../block/entity/CrafterBlockEntity.java | 6 +- .../entity/CreakingHeartBlockEntity.java | 219 + .../block/entity/DecoratedPotBlockEntity.java | 8 +- .../entity/EnchantingTableBlockEntity.java | 4 +- .../world/level/block/entity/FuelValues.java | 147 + .../level/block/entity/JigsawBlockEntity.java | 19 +- .../block/entity/JukeboxBlockEntity.java | 8 +- .../block/entity/LecternBlockEntity.java | 14 +- .../RandomizableContainerBlockEntity.java | 4 +- .../entity/SculkCatalystBlockEntity.java | 11 +- .../block/entity/SculkSensorBlockEntity.java | 34 +- .../entity/SculkShriekerBlockEntity.java | 35 +- .../level/block/entity/SkullBlockEntity.java | 6 +- .../level/block/entity/SmokerBlockEntity.java | 4 +- .../block/entity/StructureBlockEntity.java | 4 +- .../entity/TheEndGatewayBlockEntity.java | 8 +- .../block/entity/TrappedChestBlockEntity.java | 11 +- .../block/entity/TrialSpawnerBlockEntity.java | 16 +- .../entity/trialspawner/TrialSpawner.java | 88 +- .../trialspawner/TrialSpawnerConfig.java | 120 +- .../trialspawner/TrialSpawnerConfigs.java | 326 + .../entity/trialspawner/TrialSpawnerData.java | 22 +- .../trialspawner/TrialSpawnerState.java | 8 +- .../block/entity/vault/VaultBlockEntity.java | 14 +- .../world/level/block/grower/TreeGrower.java | 9 +- .../level/block/piston/MovingPistonBlock.java | 3 +- .../level/block/piston/PistonBaseBlock.java | 33 +- .../level/block/piston/PistonHeadBlock.java | 31 +- .../block/piston/PistonMovingBlockEntity.java | 13 +- .../level/block/state/BlockBehaviour.java | 306 +- .../world/level/block/state/StateHolder.java | 76 +- .../block/state/properties/BlockSetType.java | 1 + .../properties/BlockStateProperties.java | 13 +- .../state/properties/BooleanProperty.java | 35 +- .../state/properties/DirectionProperty.java | 36 - .../block/state/properties/EnumProperty.java | 65 +- .../state/properties/IntegerProperty.java | 31 +- .../block/state/properties/Property.java | 6 +- .../block/state/properties/RailShape.java | 2 +- .../block/state/properties/WoodType.java | 1 + .../world/level/border/WorldBorder.java | 10 +- .../world/level/chunk/ChunkAccess.java | 69 +- .../world/level/chunk/ChunkGenerator.java | 54 +- .../chunk/ChunkGeneratorStructureState.java | 5 +- .../world/level/chunk/ChunkSource.java | 5 +- .../world/level/chunk/GlobalPalette.java | 2 +- .../world/level/chunk/HashMapPalette.java | 4 +- .../world/level/chunk/ImposterProtoChunk.java | 39 +- .../world/level/chunk/LevelChunk.java | 57 +- .../world/level/chunk/LevelChunkSection.java | 14 +- .../world/level/chunk/LinearPalette.java | 4 +- net/minecraft/world/level/chunk/Palette.java | 2 +- .../world/level/chunk/PalettedContainer.java | 41 +- .../level/chunk/PalettedContainerRO.java | 2 + .../world/level/chunk/ProtoChunk.java | 42 +- .../world/level/chunk/SingleValuePalette.java | 2 +- .../world/level/chunk/UpgradeData.java | 255 +- .../world/level/chunk/status/ChunkStatus.java | 2 +- .../level/chunk/status/ChunkStatusTasks.java | 47 +- .../level/chunk/status/WorldGenContext.java | 7 +- .../level/chunk/storage/ChunkSerializer.java | 520 - .../level/chunk/storage/ChunkStorage.java | 4 +- .../level/chunk/storage/EntityStorage.java | 11 +- .../world/level/chunk/storage/IOWorker.java | 105 +- .../chunk/storage/RecreatingChunkStorage.java | 5 +- .../level/chunk/storage/SectionStorage.java | 225 +- .../chunk/storage/SerializableChunkData.java | 673 ++ .../level/dimension/DimensionDefaults.java | 1 + .../level/dimension/end/EndDragonFight.java | 32 +- .../level/entity/EntitySectionStorage.java | 33 +- .../world/level/levelgen/Aquifer.java | 136 +- .../level/levelgen/BelowZeroRetrogen.java | 6 +- .../level/levelgen/DebugLevelSource.java | 8 +- .../world/level/levelgen/FlatLevelSource.java | 20 +- .../world/level/levelgen/GenerationStep.java | 21 - .../world/level/levelgen/Heightmap.java | 58 +- .../levelgen/NoiseBasedChunkGenerator.java | 70 +- .../world/level/levelgen/NoiseChunk.java | 132 +- .../world/level/levelgen/NoiseSettings.java | 4 +- .../world/level/levelgen/PatrolSpawner.java | 8 +- .../world/level/levelgen/PhantomSpawner.java | 6 +- .../world/level/levelgen/SurfaceRules.java | 196 +- .../world/level/levelgen/SurfaceSystem.java | 16 +- .../world/level/levelgen/WorldDimensions.java | 19 +- .../level/levelgen/WorldGenSettings.java | 2 +- .../levelgen/WorldGenerationContext.java | 2 +- .../world/level/levelgen/WorldOptions.java | 4 + .../level/levelgen/XoroshiroRandomSource.java | 5 +- .../level/levelgen/blending/Blender.java | 24 +- .../level/levelgen/blending/BlendingData.java | 86 +- .../feature/AbstractHugeMushroomFeature.java | 4 +- .../feature/BasaltColumnsFeature.java | 4 +- .../levelgen/feature/BlockBlobFeature.java | 4 +- .../levelgen/feature/BlockPileFeature.java | 2 +- .../levelgen/feature/DesertWellFeature.java | 2 +- .../level/levelgen/feature/DiskFeature.java | 9 +- .../levelgen/feature/FeatureCountTracker.java | 2 +- .../levelgen/feature/FillLayerFeature.java | 2 +- .../level/levelgen/feature/FossilFeature.java | 6 +- .../level/levelgen/feature/GeodeFeature.java | 3 +- .../feature/HugeBrownMushroomFeature.java | 2 +- .../feature/HugeRedMushroomFeature.java | 2 +- .../levelgen/feature/IceSpikeFeature.java | 2 +- .../level/levelgen/feature/LakeFeature.java | 2 +- .../levelgen/feature/MonsterRoomFeature.java | 2 +- .../NetherForestVegetationFeature.java | 4 +- .../levelgen/feature/ReplaceBlobsFeature.java | 6 +- .../levelgen/feature/SimpleBlockFeature.java | 3 + .../level/levelgen/feature/SpikeFeature.java | 5 +- .../level/levelgen/feature/TreeFeature.java | 2 +- .../feature/foliageplacers/FoliagePlacer.java | 7 +- .../treedecorators/BeehiveDecorator.java | 4 +- .../CreakingHeartDecorator.java | 56 + .../treedecorators/PaleMossDecorator.java | 101 + .../feature/treedecorators/TreeDecorator.java | 5 + .../treedecorators/TreeDecoratorType.java | 2 + .../flat/FlatLevelGeneratorPreset.java | 3 +- .../levelgen/material/MaterialRuleList.java | 7 +- .../placement/CarvingMaskPlacement.java | 34 - .../placement/CountOnEveryLayerPlacement.java | 2 +- .../placement/HeightmapPlacement.java | 2 +- .../levelgen/placement/PlacementContext.java | 9 +- .../placement/PlacementModifierType.java | 1 - .../level/levelgen/presets/WorldPresets.java | 14 +- .../structure/LegacyStructureDataHandler.java | 9 +- .../structure/ScatteredFeaturePiece.java | 2 +- .../levelgen/structure/StructureCheck.java | 7 +- .../StructureFeatureIndexSavedData.java | 5 +- .../levelgen/structure/StructurePiece.java | 11 +- .../structure/StructureSpawnOverride.java | 6 +- .../levelgen/structure/StructureStart.java | 6 +- .../structure/pieces/PiecesContainer.java | 2 +- .../structure/pools/EmptyPoolElement.java | 2 +- .../structure/pools/FeaturePoolElement.java | 17 +- .../structure/pools/JigsawPlacement.java | 79 +- .../structure/pools/ListPoolElement.java | 2 +- .../structure/pools/SinglePoolElement.java | 26 +- .../structure/pools/StructurePoolElement.java | 2 +- .../pools/alias/PoolAliasLookup.java | 2 +- .../structures/BuriedTreasurePieces.java | 2 +- .../structure/structures/EndCityPieces.java | 3 +- .../structure/structures/MineshaftPieces.java | 19 +- .../structures/MineshaftStructure.java | 14 +- .../structures/OceanMonumentPieces.java | 6 +- .../structure/structures/OceanRuinPieces.java | 8 +- .../structures/OceanRuinStructure.java | 9 +- .../structures/RuinedPortalStructure.java | 20 +- .../structure/structures/ShipwreckPieces.java | 2 +- .../structures/StrongholdPieces.java | 50 +- .../structure/structures/SwampHutPiece.java | 10 +- .../structures/WoodlandMansionPieces.java | 10 +- .../structures/WoodlandMansionStructure.java | 13 +- .../templatesystem/StructureTemplate.java | 105 +- .../level/lighting/BlockLightEngine.java | 4 +- .../level/lighting/ChunkSkyLightSources.java | 18 +- .../lighting/LayerLightSectionStorage.java | 4 + .../level/lighting/LevelLightEngine.java | 19 +- .../world/level/lighting/LightEngine.java | 48 +- .../world/level/lighting/SkyLightEngine.java | 4 +- .../world/level/material/FlowingFluid.java | 412 +- net/minecraft/world/level/material/Fluid.java | 5 +- .../world/level/material/FluidState.java | 11 +- .../world/level/material/LavaFluid.java | 37 +- .../world/level/material/MapColor.java | 15 +- .../world/level/material/WaterFluid.java | 5 +- .../level/pathfinder/FlyNodeEvaluator.java | 2 +- .../world/level/pathfinder/PathFinder.java | 50 +- .../level/pathfinder/WalkNodeEvaluator.java | 8 +- .../level/portal/DimensionTransition.java | 62 - .../world/level/portal/PortalForcer.java | 14 +- .../world/level/portal/PortalShape.java | 129 +- .../level/portal/TeleportTransition.java | 114 + .../redstone/CollectingNeighborUpdater.java | 52 +- .../DefaultRedstoneWireEvaluator.java | 42 + .../redstone/ExperimentalRedstoneUtils.java | 31 + .../ExperimentalRedstoneWireEvaluator.java | 209 + .../redstone/InstantNeighborUpdater.java | 13 +- .../world/level/redstone/NeighborUpdater.java | 37 +- .../world/level/redstone/Orientation.java | 202 + .../world/level/redstone/Redstone.java | 2 + .../level/redstone/RedstoneWireEvaluator.java | 46 + .../world/level/saveddata/SavedData.java | 26 +- .../saveddata/maps/MapItemSavedData.java | 176 +- .../level/storage/DimensionDataStorage.java | 138 +- .../world/level/storage/LevelData.java | 6 - .../level/storage/LevelStorageSource.java | 74 +- .../world/level/storage/ServerLevelData.java | 3 + .../level/storage/loot/BuiltInLootTables.java | 42 +- .../world/level/storage/loot/IntRange.java | 6 +- .../world/level/storage/loot/LootContext.java | 41 +- .../level/storage/loot/LootContextUser.java | 6 +- .../level/storage/loot/LootDataType.java | 15 +- .../world/level/storage/loot/LootParams.java | 86 +- .../world/level/storage/loot/LootTable.java | 29 +- .../level/storage/loot/ValidationContext.java | 46 +- .../level/storage/loot/entries/LootItem.java | 3 +- .../storage/loot/entries/NestedLootTable.java | 7 +- .../loot/functions/ApplyBonusCount.java | 9 +- .../loot/functions/ApplyExplosionDecay.java | 2 +- .../loot/functions/CopyBlockState.java | 8 +- .../functions/CopyComponentsFunction.java | 8 +- .../functions/CopyCustomDataFunction.java | 53 +- .../loot/functions/CopyNameFunction.java | 17 +- .../functions/EnchantRandomlyFunction.java | 2 +- .../functions/EnchantWithLevelsFunction.java | 4 +- .../EnchantedCountIncreaseFunction.java | 8 +- .../functions/ExplorationMapFunction.java | 9 +- .../loot/functions/FillPlayerHead.java | 9 +- .../loot/functions/FunctionReference.java | 4 +- .../storage/loot/functions/LimitCount.java | 4 +- .../loot/functions/SetAttributesFunction.java | 12 +- .../loot/functions/SetContainerLootTable.java | 2 +- .../functions/SetCustomModelDataFunction.java | 4 +- .../functions/SetEnchantmentsFunction.java | 8 +- .../loot/functions/SetInstrumentFunction.java | 12 +- .../loot/functions/SetItemCountFunction.java | 4 +- .../loot/functions/SetItemDamageFunction.java | 4 +- .../loot/functions/SetItemFunction.java | 6 +- .../loot/functions/SetLoreFunction.java | 6 +- .../loot/functions/SetNameFunction.java | 10 +- .../SetOminousBottleAmplifierFunction.java | 7 +- .../loot/functions/SetStewEffectFunction.java | 6 +- .../loot/functions/SmeltItemFunction.java | 7 +- .../loot/functions/ToggleTooltips.java | 2 +- .../loot/parameters/LootContextParam.java | 24 - .../loot/parameters/LootContextParamSet.java | 100 - .../loot/parameters/LootContextParamSets.java | 79 +- .../loot/parameters/LootContextParams.java | 30 +- .../predicates/BonusLevelTableCondition.java | 9 +- .../loot/predicates/ConditionReference.java | 4 +- .../predicates/DamageSourceCondition.java | 11 +- .../predicates/EnchantmentActiveCheck.java | 6 +- .../predicates/EntityHasScoreCondition.java | 8 +- .../loot/predicates/ExplosionCondition.java | 9 +- .../predicates/InvertedLootItemCondition.java | 4 +- .../loot/predicates/LocationCheck.java | 6 +- .../LootItemBlockStatePropertyCondition.java | 6 +- .../LootItemEntityPropertyCondition.java | 11 +- .../LootItemKilledByPlayerCondition.java | 9 +- ...ndomChanceWithEnchantedBonusCondition.java | 12 +- .../storage/loot/predicates/MatchTool.java | 9 +- .../storage/loot/predicates/TimeCheck.java | 4 +- .../loot/predicates/ValueCheckCondition.java | 6 +- .../providers/nbt/ContextNbtProvider.java | 19 +- .../loot/providers/nbt/NbtProvider.java | 4 +- .../providers/nbt/StorageNbtProvider.java | 9 +- .../number/BinomialDistributionGenerator.java | 6 +- .../number/EnchantmentLevelProvider.java | 2 +- .../providers/number/ScoreboardValue.java | 4 +- .../providers/number/UniformGenerator.java | 6 +- .../score/ContextScoreboardNameProvider.java | 9 +- .../score/FixedScoreboardNameProvider.java | 7 +- .../score/ScoreboardNameProvider.java | 4 +- .../level/timers/FunctionTagCallback.java | 2 +- net/minecraft/world/phys/AABB.java | 80 +- net/minecraft/world/phys/BlockHitResult.java | 35 +- net/minecraft/world/phys/Vec3.java | 36 +- .../world/phys/shapes/CollisionContext.java | 16 +- .../phys/shapes/EntityCollisionContext.java | 11 +- .../phys/shapes/MinecartCollisionContext.java | 47 + net/minecraft/world/phys/shapes/Shapes.java | 19 - .../world/phys/shapes/VoxelShape.java | 31 +- net/minecraft/world/scores/DisplaySlot.java | 3 +- .../world/scores/ScoreboardSaveData.java | 8 +- .../world/ticks/LevelChunkTicks.java | 28 +- net/minecraft/world/ticks/LevelTicks.java | 12 +- .../world/ticks/ProtoChunkTicks.java | 19 +- net/minecraft/world/ticks/SavedTick.java | 20 +- net/minecraft/world/ticks/ScheduledTick.java | 4 + .../ticks/SerializableTickContainer.java | 5 +- version.json | 14 +- 6078 files changed, 96938 insertions(+), 75781 deletions(-) create mode 100644 assets/minecraft/blockstates/creaking_heart.json create mode 100644 assets/minecraft/blockstates/pale_hanging_moss.json create mode 100644 assets/minecraft/blockstates/pale_moss_block.json create mode 100644 assets/minecraft/blockstates/pale_moss_carpet.json create mode 100644 assets/minecraft/blockstates/pale_oak_button.json create mode 100644 assets/minecraft/blockstates/pale_oak_door.json create mode 100644 assets/minecraft/blockstates/pale_oak_fence.json create mode 100644 assets/minecraft/blockstates/pale_oak_fence_gate.json create mode 100644 assets/minecraft/blockstates/pale_oak_hanging_sign.json create mode 100644 assets/minecraft/blockstates/pale_oak_leaves.json create mode 100644 assets/minecraft/blockstates/pale_oak_log.json create mode 100644 assets/minecraft/blockstates/pale_oak_planks.json create mode 100644 assets/minecraft/blockstates/pale_oak_pressure_plate.json create mode 100644 assets/minecraft/blockstates/pale_oak_sapling.json create mode 100644 assets/minecraft/blockstates/pale_oak_sign.json create mode 100644 assets/minecraft/blockstates/pale_oak_slab.json create mode 100644 assets/minecraft/blockstates/pale_oak_stairs.json create mode 100644 assets/minecraft/blockstates/pale_oak_trapdoor.json create mode 100644 assets/minecraft/blockstates/pale_oak_wall_hanging_sign.json create mode 100644 assets/minecraft/blockstates/pale_oak_wall_sign.json create mode 100644 assets/minecraft/blockstates/pale_oak_wood.json create mode 100644 assets/minecraft/blockstates/potted_pale_oak_sapling.json create mode 100644 assets/minecraft/blockstates/stripped_pale_oak_log.json create mode 100644 assets/minecraft/blockstates/stripped_pale_oak_wood.json create mode 100644 assets/minecraft/lang/deprecated.json rename assets/minecraft/models/block/{bee_nest.json => bee_nest_empty.json} (100%) rename assets/minecraft/models/block/{beehive.json => beehive_empty.json} (100%) create mode 100644 assets/minecraft/models/block/creaking_heart.json create mode 100644 assets/minecraft/models/block/creaking_heart_active.json create mode 100644 assets/minecraft/models/block/creaking_heart_active_horizontal.json create mode 100644 assets/minecraft/models/block/creaking_heart_horizontal.json create mode 100644 assets/minecraft/models/block/mossy_carpet_side.json create mode 100644 assets/minecraft/models/block/pale_hanging_moss.json create mode 100644 assets/minecraft/models/block/pale_hanging_moss_tip.json create mode 100644 assets/minecraft/models/block/pale_moss_block.json create mode 100644 assets/minecraft/models/block/pale_moss_carpet.json create mode 100644 assets/minecraft/models/block/pale_moss_carpet_side_small.json create mode 100644 assets/minecraft/models/block/pale_moss_carpet_side_tall.json create mode 100644 assets/minecraft/models/block/pale_oak_button.json create mode 100644 assets/minecraft/models/block/pale_oak_button_inventory.json create mode 100644 assets/minecraft/models/block/pale_oak_button_pressed.json create mode 100644 assets/minecraft/models/block/pale_oak_door_bottom_left.json create mode 100644 assets/minecraft/models/block/pale_oak_door_bottom_left_open.json create mode 100644 assets/minecraft/models/block/pale_oak_door_bottom_right.json create mode 100644 assets/minecraft/models/block/pale_oak_door_bottom_right_open.json create mode 100644 assets/minecraft/models/block/pale_oak_door_top_left.json create mode 100644 assets/minecraft/models/block/pale_oak_door_top_left_open.json create mode 100644 assets/minecraft/models/block/pale_oak_door_top_right.json create mode 100644 assets/minecraft/models/block/pale_oak_door_top_right_open.json create mode 100644 assets/minecraft/models/block/pale_oak_fence_gate.json create mode 100644 assets/minecraft/models/block/pale_oak_fence_gate_open.json create mode 100644 assets/minecraft/models/block/pale_oak_fence_gate_wall.json create mode 100644 assets/minecraft/models/block/pale_oak_fence_gate_wall_open.json create mode 100644 assets/minecraft/models/block/pale_oak_fence_inventory.json create mode 100644 assets/minecraft/models/block/pale_oak_fence_post.json create mode 100644 assets/minecraft/models/block/pale_oak_fence_side.json create mode 100644 assets/minecraft/models/block/pale_oak_hanging_sign.json create mode 100644 assets/minecraft/models/block/pale_oak_leaves.json create mode 100644 assets/minecraft/models/block/pale_oak_log.json create mode 100644 assets/minecraft/models/block/pale_oak_log_horizontal.json create mode 100644 assets/minecraft/models/block/pale_oak_planks.json create mode 100644 assets/minecraft/models/block/pale_oak_pressure_plate.json create mode 100644 assets/minecraft/models/block/pale_oak_pressure_plate_down.json create mode 100644 assets/minecraft/models/block/pale_oak_sapling.json create mode 100644 assets/minecraft/models/block/pale_oak_sign.json create mode 100644 assets/minecraft/models/block/pale_oak_slab.json create mode 100644 assets/minecraft/models/block/pale_oak_slab_top.json create mode 100644 assets/minecraft/models/block/pale_oak_stairs.json create mode 100644 assets/minecraft/models/block/pale_oak_stairs_inner.json create mode 100644 assets/minecraft/models/block/pale_oak_stairs_outer.json create mode 100644 assets/minecraft/models/block/pale_oak_trapdoor_bottom.json create mode 100644 assets/minecraft/models/block/pale_oak_trapdoor_open.json create mode 100644 assets/minecraft/models/block/pale_oak_trapdoor_top.json create mode 100644 assets/minecraft/models/block/pale_oak_wood.json create mode 100644 assets/minecraft/models/block/potted_pale_oak_sapling.json create mode 100644 assets/minecraft/models/block/stripped_pale_oak_log.json create mode 100644 assets/minecraft/models/block/stripped_pale_oak_log_horizontal.json create mode 100644 assets/minecraft/models/block/stripped_pale_oak_wood.json create mode 100644 assets/minecraft/models/block/template_redstone_torch.json create mode 100644 assets/minecraft/models/block/template_redstone_torch_wall.json create mode 100644 assets/minecraft/models/block/template_torch_unlit.json create mode 100644 assets/minecraft/models/block/template_torch_wall_unlit.json create mode 100644 assets/minecraft/models/equipment/armadillo_scute.json create mode 100644 assets/minecraft/models/equipment/black_carpet.json create mode 100644 assets/minecraft/models/equipment/blue_carpet.json create mode 100644 assets/minecraft/models/equipment/brown_carpet.json create mode 100644 assets/minecraft/models/equipment/chainmail.json create mode 100644 assets/minecraft/models/equipment/cyan_carpet.json create mode 100644 assets/minecraft/models/equipment/diamond.json create mode 100644 assets/minecraft/models/equipment/elytra.json create mode 100644 assets/minecraft/models/equipment/gold.json create mode 100644 assets/minecraft/models/equipment/gray_carpet.json create mode 100644 assets/minecraft/models/equipment/green_carpet.json create mode 100644 assets/minecraft/models/equipment/iron.json create mode 100644 assets/minecraft/models/equipment/leather.json create mode 100644 assets/minecraft/models/equipment/light_blue_carpet.json create mode 100644 assets/minecraft/models/equipment/light_gray_carpet.json create mode 100644 assets/minecraft/models/equipment/lime_carpet.json create mode 100644 assets/minecraft/models/equipment/magenta_carpet.json create mode 100644 assets/minecraft/models/equipment/netherite.json create mode 100644 assets/minecraft/models/equipment/orange_carpet.json create mode 100644 assets/minecraft/models/equipment/pink_carpet.json create mode 100644 assets/minecraft/models/equipment/purple_carpet.json create mode 100644 assets/minecraft/models/equipment/red_carpet.json create mode 100644 assets/minecraft/models/equipment/trader_llama.json create mode 100644 assets/minecraft/models/equipment/turtle_scute.json create mode 100644 assets/minecraft/models/equipment/white_carpet.json create mode 100644 assets/minecraft/models/equipment/yellow_carpet.json create mode 100644 assets/minecraft/models/item/bee_nest_empty.json create mode 100644 assets/minecraft/models/item/bee_nest_honey.json create mode 100644 assets/minecraft/models/item/beehive_empty.json create mode 100644 assets/minecraft/models/item/beehive_honey.json create mode 100644 assets/minecraft/models/item/black_bundle.json create mode 100644 assets/minecraft/models/item/black_bundle_open_back.json create mode 100644 assets/minecraft/models/item/black_bundle_open_front.json create mode 100644 assets/minecraft/models/item/blue_bundle.json create mode 100644 assets/minecraft/models/item/blue_bundle_open_back.json create mode 100644 assets/minecraft/models/item/blue_bundle_open_front.json create mode 100644 assets/minecraft/models/item/bordure_indented_banner_pattern.json create mode 100644 assets/minecraft/models/item/brown_bundle.json create mode 100644 assets/minecraft/models/item/brown_bundle_open_back.json create mode 100644 assets/minecraft/models/item/brown_bundle_open_front.json delete mode 100644 assets/minecraft/models/item/bundle_filled.json create mode 100644 assets/minecraft/models/item/bundle_open_back.json create mode 100644 assets/minecraft/models/item/bundle_open_front.json create mode 100644 assets/minecraft/models/item/creaking_heart.json create mode 100644 assets/minecraft/models/item/creaking_spawn_egg.json create mode 100644 assets/minecraft/models/item/cyan_bundle.json create mode 100644 assets/minecraft/models/item/cyan_bundle_open_back.json create mode 100644 assets/minecraft/models/item/cyan_bundle_open_front.json create mode 100644 assets/minecraft/models/item/field_masoned_banner_pattern.json create mode 100644 assets/minecraft/models/item/gray_bundle.json create mode 100644 assets/minecraft/models/item/gray_bundle_open_back.json create mode 100644 assets/minecraft/models/item/gray_bundle_open_front.json create mode 100644 assets/minecraft/models/item/green_bundle.json create mode 100644 assets/minecraft/models/item/green_bundle_open_back.json create mode 100644 assets/minecraft/models/item/green_bundle_open_front.json create mode 100644 assets/minecraft/models/item/light_blue_bundle.json create mode 100644 assets/minecraft/models/item/light_blue_bundle_open_back.json create mode 100644 assets/minecraft/models/item/light_blue_bundle_open_front.json create mode 100644 assets/minecraft/models/item/light_gray_bundle.json create mode 100644 assets/minecraft/models/item/light_gray_bundle_open_back.json create mode 100644 assets/minecraft/models/item/light_gray_bundle_open_front.json create mode 100644 assets/minecraft/models/item/lime_bundle.json create mode 100644 assets/minecraft/models/item/lime_bundle_open_back.json create mode 100644 assets/minecraft/models/item/lime_bundle_open_front.json create mode 100644 assets/minecraft/models/item/magenta_bundle.json create mode 100644 assets/minecraft/models/item/magenta_bundle_open_back.json create mode 100644 assets/minecraft/models/item/magenta_bundle_open_front.json create mode 100644 assets/minecraft/models/item/orange_bundle.json create mode 100644 assets/minecraft/models/item/orange_bundle_open_back.json create mode 100644 assets/minecraft/models/item/orange_bundle_open_front.json create mode 100644 assets/minecraft/models/item/pale_hanging_moss.json create mode 100644 assets/minecraft/models/item/pale_moss_block.json create mode 100644 assets/minecraft/models/item/pale_moss_carpet.json create mode 100644 assets/minecraft/models/item/pale_oak_boat.json create mode 100644 assets/minecraft/models/item/pale_oak_button.json create mode 100644 assets/minecraft/models/item/pale_oak_chest_boat.json create mode 100644 assets/minecraft/models/item/pale_oak_door.json create mode 100644 assets/minecraft/models/item/pale_oak_fence.json create mode 100644 assets/minecraft/models/item/pale_oak_fence_gate.json create mode 100644 assets/minecraft/models/item/pale_oak_hanging_sign.json create mode 100644 assets/minecraft/models/item/pale_oak_leaves.json create mode 100644 assets/minecraft/models/item/pale_oak_log.json create mode 100644 assets/minecraft/models/item/pale_oak_planks.json create mode 100644 assets/minecraft/models/item/pale_oak_pressure_plate.json create mode 100644 assets/minecraft/models/item/pale_oak_sapling.json create mode 100644 assets/minecraft/models/item/pale_oak_sign.json create mode 100644 assets/minecraft/models/item/pale_oak_slab.json create mode 100644 assets/minecraft/models/item/pale_oak_stairs.json create mode 100644 assets/minecraft/models/item/pale_oak_trapdoor.json create mode 100644 assets/minecraft/models/item/pale_oak_wood.json create mode 100644 assets/minecraft/models/item/pink_bundle.json create mode 100644 assets/minecraft/models/item/pink_bundle_open_back.json create mode 100644 assets/minecraft/models/item/pink_bundle_open_front.json create mode 100644 assets/minecraft/models/item/purple_bundle.json create mode 100644 assets/minecraft/models/item/purple_bundle_open_back.json create mode 100644 assets/minecraft/models/item/purple_bundle_open_front.json create mode 100644 assets/minecraft/models/item/red_bundle.json create mode 100644 assets/minecraft/models/item/red_bundle_open_back.json create mode 100644 assets/minecraft/models/item/red_bundle_open_front.json create mode 100644 assets/minecraft/models/item/stripped_pale_oak_log.json create mode 100644 assets/minecraft/models/item/stripped_pale_oak_wood.json create mode 100644 assets/minecraft/models/item/white_bundle.json create mode 100644 assets/minecraft/models/item/white_bundle_open_back.json create mode 100644 assets/minecraft/models/item/white_bundle_open_front.json create mode 100644 assets/minecraft/models/item/yellow_bundle.json create mode 100644 assets/minecraft/models/item/yellow_bundle_open_back.json create mode 100644 assets/minecraft/models/item/yellow_bundle_open_front.json create mode 100644 assets/minecraft/particles/trail.json create mode 100644 assets/minecraft/post_effect/blur.json rename assets/minecraft/{shaders/post => post_effect}/creeper.json (58%) create mode 100644 assets/minecraft/post_effect/entity_outline.json create mode 100644 assets/minecraft/post_effect/invert.json create mode 100644 assets/minecraft/post_effect/spider.json create mode 100644 assets/minecraft/post_effect/transparency.json rename assets/minecraft/shaders/core/{rendertype_entity_cutout.fsh => entity.fsh} (80%) rename assets/minecraft/shaders/core/{rendertype_entity_cutout_no_cull_z_offset.vsh => entity.vsh} (75%) rename assets/minecraft/shaders/core/{rendertype_entity_glint.fsh => glint.fsh} (93%) rename assets/minecraft/shaders/core/{rendertype_armor_entity_glint.vsh => glint.vsh} (92%) rename assets/minecraft/shaders/core/{rendertype_gui.fsh => gui.fsh} (100%) rename assets/minecraft/shaders/core/{rendertype_gui.vsh => gui.vsh} (100%) create mode 100644 assets/minecraft/shaders/core/lightmap.fsh create mode 100644 assets/minecraft/shaders/core/lightmap.json delete mode 100644 assets/minecraft/shaders/core/rendertype_armor_cutout_no_cull.fsh delete mode 100644 assets/minecraft/shaders/core/rendertype_armor_cutout_no_cull.vsh delete mode 100644 assets/minecraft/shaders/core/rendertype_armor_entity_glint.fsh rename assets/minecraft/shaders/core/{rendertype_entity_translucent_cull.json => rendertype_armor_translucent.json} (82%) delete mode 100644 assets/minecraft/shaders/core/rendertype_breeze_wind.fsh delete mode 100644 assets/minecraft/shaders/core/rendertype_breeze_wind.vsh delete mode 100644 assets/minecraft/shaders/core/rendertype_cutout.vsh delete mode 100644 assets/minecraft/shaders/core/rendertype_cutout_mipped.fsh delete mode 100644 assets/minecraft/shaders/core/rendertype_energy_swirl.fsh delete mode 100644 assets/minecraft/shaders/core/rendertype_energy_swirl.vsh delete mode 100644 assets/minecraft/shaders/core/rendertype_entity_cutout.vsh delete mode 100644 assets/minecraft/shaders/core/rendertype_entity_cutout_no_cull.fsh delete mode 100644 assets/minecraft/shaders/core/rendertype_entity_cutout_no_cull.vsh delete mode 100644 assets/minecraft/shaders/core/rendertype_entity_cutout_no_cull_z_offset.fsh delete mode 100644 assets/minecraft/shaders/core/rendertype_entity_glint.vsh delete mode 100644 assets/minecraft/shaders/core/rendertype_entity_glint_direct.fsh delete mode 100644 assets/minecraft/shaders/core/rendertype_entity_glint_direct.json delete mode 100644 assets/minecraft/shaders/core/rendertype_entity_glint_direct.vsh delete mode 100644 assets/minecraft/shaders/core/rendertype_entity_no_outline.fsh delete mode 100644 assets/minecraft/shaders/core/rendertype_entity_no_outline.vsh delete mode 100644 assets/minecraft/shaders/core/rendertype_entity_smooth_cutout.fsh delete mode 100644 assets/minecraft/shaders/core/rendertype_entity_smooth_cutout.vsh delete mode 100644 assets/minecraft/shaders/core/rendertype_entity_solid.fsh delete mode 100644 assets/minecraft/shaders/core/rendertype_entity_solid.vsh delete mode 100644 assets/minecraft/shaders/core/rendertype_entity_translucent.fsh delete mode 100644 assets/minecraft/shaders/core/rendertype_entity_translucent.vsh delete mode 100644 assets/minecraft/shaders/core/rendertype_entity_translucent_cull.fsh delete mode 100644 assets/minecraft/shaders/core/rendertype_entity_translucent_cull.vsh delete mode 100644 assets/minecraft/shaders/core/rendertype_entity_translucent_emissive.fsh delete mode 100644 assets/minecraft/shaders/core/rendertype_entity_translucent_emissive.vsh delete mode 100644 assets/minecraft/shaders/core/rendertype_eyes.fsh delete mode 100644 assets/minecraft/shaders/core/rendertype_eyes.vsh delete mode 100644 assets/minecraft/shaders/core/rendertype_glint.fsh delete mode 100644 assets/minecraft/shaders/core/rendertype_glint.vsh delete mode 100644 assets/minecraft/shaders/core/rendertype_glint_translucent.fsh delete mode 100644 assets/minecraft/shaders/core/rendertype_glint_translucent.vsh delete mode 100644 assets/minecraft/shaders/core/rendertype_gui_ghost_recipe_overlay.fsh delete mode 100644 assets/minecraft/shaders/core/rendertype_gui_ghost_recipe_overlay.vsh delete mode 100644 assets/minecraft/shaders/core/rendertype_gui_overlay.fsh delete mode 100644 assets/minecraft/shaders/core/rendertype_gui_overlay.vsh delete mode 100644 assets/minecraft/shaders/core/rendertype_gui_text_highlight.fsh delete mode 100644 assets/minecraft/shaders/core/rendertype_gui_text_highlight.vsh delete mode 100644 assets/minecraft/shaders/core/rendertype_solid.fsh delete mode 100644 assets/minecraft/shaders/core/rendertype_solid.vsh delete mode 100644 assets/minecraft/shaders/core/rendertype_translucent.fsh delete mode 100644 assets/minecraft/shaders/core/rendertype_translucent.vsh delete mode 100644 assets/minecraft/shaders/core/rendertype_tripwire.fsh delete mode 100644 assets/minecraft/shaders/core/rendertype_tripwire.vsh rename assets/minecraft/shaders/core/{rendertype_cutout.fsh => terrain.fsh} (81%) rename assets/minecraft/shaders/core/{rendertype_cutout_mipped.vsh => terrain.vsh} (78%) rename assets/minecraft/shaders/{program => post}/bits.fsh (85%) rename assets/minecraft/shaders/{program => post}/bits.json (75%) create mode 100644 assets/minecraft/shaders/post/blit.fsh rename assets/minecraft/shaders/{program => post}/blit.json (65%) rename assets/minecraft/shaders/{program => post}/blit.vsh (100%) delete mode 100644 assets/minecraft/shaders/post/blur.json rename assets/minecraft/shaders/{program => post}/blur.vsh (100%) rename assets/minecraft/shaders/{program => post}/box_blur.fsh (78%) rename assets/minecraft/shaders/{program => post}/box_blur.json (76%) rename assets/minecraft/shaders/{program => post}/color_convolve.fsh (89%) rename assets/minecraft/shaders/{program => post}/color_convolve.json (82%) rename assets/minecraft/shaders/{program => post}/entity_outline_box_blur.fsh (60%) rename assets/minecraft/shaders/{program => post}/entity_outline_box_blur.json (81%) rename assets/minecraft/shaders/{program => post}/entity_sobel.fsh (57%) rename assets/minecraft/shaders/{program => post}/invert.fsh (72%) rename assets/minecraft/shaders/{program => post}/invert.vsh (100%) rename assets/minecraft/shaders/{program => post}/rotscale.vsh (97%) rename assets/minecraft/shaders/{program => post}/screenquad.vsh (100%) rename assets/minecraft/shaders/{program => post}/sobel.vsh (100%) rename assets/minecraft/shaders/{program => post}/spiderclip.fsh (92%) rename assets/minecraft/shaders/{program => post}/transparency.fsh (90%) delete mode 100644 assets/minecraft/shaders/program/blit.fsh delete mode 100644 assets/minecraft/shaders/program/entity_outline.json delete mode 100644 assets/minecraft/shaders/program/invert.json delete mode 100644 assets/minecraft/shaders/program/spider.json delete mode 100644 assets/minecraft/shaders/program/transparency.json create mode 100644 assets/minecraft/textures/block/creaking_heart.png create mode 100644 assets/minecraft/textures/block/creaking_heart_active.png create mode 100644 assets/minecraft/textures/block/creaking_heart_top.png create mode 100644 assets/minecraft/textures/block/creaking_heart_top_active.png create mode 100644 assets/minecraft/textures/block/pale_hanging_moss.png create mode 100644 assets/minecraft/textures/block/pale_hanging_moss_tip.png create mode 100644 assets/minecraft/textures/block/pale_moss_block.png create mode 100644 assets/minecraft/textures/block/pale_moss_carpet.png create mode 100644 assets/minecraft/textures/block/pale_moss_carpet_side_small.png create mode 100644 assets/minecraft/textures/block/pale_moss_carpet_side_tall.png create mode 100644 assets/minecraft/textures/block/pale_oak_door_bottom.png create mode 100644 assets/minecraft/textures/block/pale_oak_door_top.png create mode 100644 assets/minecraft/textures/block/pale_oak_leaves.png create mode 100644 assets/minecraft/textures/block/pale_oak_log.png create mode 100644 assets/minecraft/textures/block/pale_oak_log_top.png create mode 100644 assets/minecraft/textures/block/pale_oak_planks.png create mode 100644 assets/minecraft/textures/block/pale_oak_sapling.png create mode 100644 assets/minecraft/textures/block/pale_oak_trapdoor.png create mode 100644 assets/minecraft/textures/block/stripped_pale_oak_log.png create mode 100644 assets/minecraft/textures/block/stripped_pale_oak_log_top.png create mode 100644 assets/minecraft/textures/entity/boat/pale_oak.png create mode 100644 assets/minecraft/textures/entity/chest_boat/pale_oak.png create mode 100644 assets/minecraft/textures/entity/creaking/creaking.png create mode 100644 assets/minecraft/textures/entity/creaking/creaking_eyes.png rename assets/minecraft/textures/entity/{horse/armor/horse_armor_diamond.png => equipment/horse_body/diamond.png} (100%) rename assets/minecraft/textures/entity/{horse/armor/horse_armor_gold.png => equipment/horse_body/gold.png} (100%) rename assets/minecraft/textures/entity/{horse/armor/horse_armor_iron.png => equipment/horse_body/iron.png} (100%) rename assets/minecraft/textures/entity/{horse/armor/horse_armor_leather.png => equipment/horse_body/leather.png} (100%) rename assets/minecraft/textures/{models/armor/chainmail_layer_1.png => entity/equipment/humanoid/chainmail.png} (100%) rename assets/minecraft/textures/{models/armor/diamond_layer_1.png => entity/equipment/humanoid/diamond.png} (100%) rename assets/minecraft/textures/{models/armor/gold_layer_1.png => entity/equipment/humanoid/gold.png} (100%) rename assets/minecraft/textures/{models/armor/iron_layer_1.png => entity/equipment/humanoid/iron.png} (100%) rename assets/minecraft/textures/{models/armor/leather_layer_1.png => entity/equipment/humanoid/leather.png} (100%) rename assets/minecraft/textures/{models/armor/leather_layer_1_overlay.png => entity/equipment/humanoid/leather_overlay.png} (100%) rename assets/minecraft/textures/{models/armor/netherite_layer_1.png => entity/equipment/humanoid/netherite.png} (100%) rename assets/minecraft/textures/{models/armor/turtle_layer_1.png => entity/equipment/humanoid/turtle_scute.png} (100%) rename assets/minecraft/textures/{models/armor/chainmail_layer_2.png => entity/equipment/humanoid_leggings/chainmail.png} (100%) rename assets/minecraft/textures/{models/armor/diamond_layer_2.png => entity/equipment/humanoid_leggings/diamond.png} (100%) rename assets/minecraft/textures/{models/armor/gold_layer_2.png => entity/equipment/humanoid_leggings/gold.png} (100%) rename assets/minecraft/textures/{models/armor/iron_layer_2.png => entity/equipment/humanoid_leggings/iron.png} (100%) rename assets/minecraft/textures/{models/armor/leather_layer_2.png => entity/equipment/humanoid_leggings/leather.png} (100%) rename assets/minecraft/textures/{models/armor/leather_layer_2_overlay.png => entity/equipment/humanoid_leggings/leather_overlay.png} (100%) rename assets/minecraft/textures/{models/armor/netherite_layer_2.png => entity/equipment/humanoid_leggings/netherite.png} (100%) rename assets/minecraft/textures/entity/{llama/decor => equipment/llama_body}/black.png (100%) rename assets/minecraft/textures/entity/{llama/decor => equipment/llama_body}/blue.png (100%) rename assets/minecraft/textures/entity/{llama/decor => equipment/llama_body}/brown.png (100%) rename assets/minecraft/textures/entity/{llama/decor => equipment/llama_body}/cyan.png (100%) rename assets/minecraft/textures/entity/{llama/decor => equipment/llama_body}/gray.png (100%) rename assets/minecraft/textures/entity/{llama/decor => equipment/llama_body}/green.png (100%) rename assets/minecraft/textures/entity/{llama/decor => equipment/llama_body}/light_blue.png (100%) rename assets/minecraft/textures/entity/{llama/decor => equipment/llama_body}/light_gray.png (100%) rename assets/minecraft/textures/entity/{llama/decor => equipment/llama_body}/lime.png (100%) rename assets/minecraft/textures/entity/{llama/decor => equipment/llama_body}/magenta.png (100%) rename assets/minecraft/textures/entity/{llama/decor => equipment/llama_body}/orange.png (100%) rename assets/minecraft/textures/entity/{llama/decor => equipment/llama_body}/pink.png (100%) rename assets/minecraft/textures/entity/{llama/decor => equipment/llama_body}/purple.png (100%) rename assets/minecraft/textures/entity/{llama/decor => equipment/llama_body}/red.png (100%) rename assets/minecraft/textures/entity/{llama/decor => equipment/llama_body}/trader_llama.png (100%) rename assets/minecraft/textures/entity/{llama/decor => equipment/llama_body}/white.png (100%) rename assets/minecraft/textures/entity/{llama/decor => equipment/llama_body}/yellow.png (100%) rename assets/minecraft/textures/entity/{ => equipment/wings}/elytra.png (100%) rename assets/minecraft/textures/entity/{wolf/wolf_armor.png => equipment/wolf_body/armadillo_scute.png} (100%) rename assets/minecraft/textures/entity/{wolf/wolf_armor_overlay.png => equipment/wolf_body/armadillo_scute_overlay.png} (100%) create mode 100644 assets/minecraft/textures/entity/signs/hanging/pale_oak.png create mode 100644 assets/minecraft/textures/entity/signs/pale_oak.png create mode 100644 assets/minecraft/textures/gui/hanging_signs/pale_oak.png delete mode 100644 assets/minecraft/textures/gui/sprites/container/bundle/background.png delete mode 100644 assets/minecraft/textures/gui/sprites/container/bundle/blocked_slot.png create mode 100644 assets/minecraft/textures/gui/sprites/container/bundle/bundle_progressbar_border.png create mode 100644 assets/minecraft/textures/gui/sprites/container/bundle/bundle_progressbar_border.png.mcmeta create mode 100644 assets/minecraft/textures/gui/sprites/container/bundle/bundle_progressbar_fill.png create mode 100644 assets/minecraft/textures/gui/sprites/container/bundle/bundle_progressbar_fill.png.mcmeta create mode 100644 assets/minecraft/textures/gui/sprites/container/bundle/bundle_progressbar_full.png create mode 100644 assets/minecraft/textures/gui/sprites/container/bundle/bundle_progressbar_full.png.mcmeta delete mode 100644 assets/minecraft/textures/gui/sprites/container/bundle/slot.png create mode 100644 assets/minecraft/textures/gui/sprites/container/bundle/slot_background.png create mode 100644 assets/minecraft/textures/gui/sprites/container/bundle/slot_highlight_back.png rename assets/minecraft/textures/gui/sprites/container/bundle/{background.png.mcmeta => slot_highlight_back.png.mcmeta} (68%) create mode 100644 assets/minecraft/textures/gui/sprites/container/bundle/slot_highlight_front.png create mode 100644 assets/minecraft/textures/gui/sprites/container/bundle/slot_highlight_front.png.mcmeta create mode 100644 assets/minecraft/textures/gui/sprites/container/slot_highlight_back.png create mode 100644 assets/minecraft/textures/gui/sprites/container/slot_highlight_back.png.mcmeta create mode 100644 assets/minecraft/textures/gui/sprites/container/slot_highlight_front.png create mode 100644 assets/minecraft/textures/gui/sprites/container/slot_highlight_front.png.mcmeta create mode 100644 assets/minecraft/textures/gui/sprites/hud/air_empty.png create mode 100644 assets/minecraft/textures/gui/sprites/tooltip/background.png create mode 100644 assets/minecraft/textures/gui/sprites/tooltip/background.png.mcmeta create mode 100644 assets/minecraft/textures/gui/sprites/tooltip/frame.png create mode 100644 assets/minecraft/textures/gui/sprites/tooltip/frame.png.mcmeta create mode 100644 assets/minecraft/textures/item/black_bundle.png create mode 100644 assets/minecraft/textures/item/black_bundle_open_back.png create mode 100644 assets/minecraft/textures/item/black_bundle_open_front.png create mode 100644 assets/minecraft/textures/item/blue_bundle.png create mode 100644 assets/minecraft/textures/item/blue_bundle_open_back.png create mode 100644 assets/minecraft/textures/item/blue_bundle_open_front.png create mode 100644 assets/minecraft/textures/item/bordure_indented_banner_pattern.png create mode 100644 assets/minecraft/textures/item/brown_bundle.png create mode 100644 assets/minecraft/textures/item/brown_bundle_open_back.png create mode 100644 assets/minecraft/textures/item/brown_bundle_open_front.png delete mode 100644 assets/minecraft/textures/item/bundle_filled.png create mode 100644 assets/minecraft/textures/item/bundle_open_back.png create mode 100644 assets/minecraft/textures/item/bundle_open_front.png create mode 100644 assets/minecraft/textures/item/cyan_bundle.png create mode 100644 assets/minecraft/textures/item/cyan_bundle_open_back.png create mode 100644 assets/minecraft/textures/item/cyan_bundle_open_front.png create mode 100644 assets/minecraft/textures/item/field_masoned_banner_pattern.png create mode 100644 assets/minecraft/textures/item/gray_bundle.png create mode 100644 assets/minecraft/textures/item/gray_bundle_open_back.png create mode 100644 assets/minecraft/textures/item/gray_bundle_open_front.png create mode 100644 assets/minecraft/textures/item/green_bundle.png create mode 100644 assets/minecraft/textures/item/green_bundle_open_back.png create mode 100644 assets/minecraft/textures/item/green_bundle_open_front.png create mode 100644 assets/minecraft/textures/item/light_blue_bundle.png create mode 100644 assets/minecraft/textures/item/light_blue_bundle_open_back.png create mode 100644 assets/minecraft/textures/item/light_blue_bundle_open_front.png create mode 100644 assets/minecraft/textures/item/light_gray_bundle.png create mode 100644 assets/minecraft/textures/item/light_gray_bundle_open_back.png create mode 100644 assets/minecraft/textures/item/light_gray_bundle_open_front.png create mode 100644 assets/minecraft/textures/item/lime_bundle.png create mode 100644 assets/minecraft/textures/item/lime_bundle_open_back.png create mode 100644 assets/minecraft/textures/item/lime_bundle_open_front.png create mode 100644 assets/minecraft/textures/item/magenta_bundle.png create mode 100644 assets/minecraft/textures/item/magenta_bundle_open_back.png create mode 100644 assets/minecraft/textures/item/magenta_bundle_open_front.png create mode 100644 assets/minecraft/textures/item/orange_bundle.png create mode 100644 assets/minecraft/textures/item/orange_bundle_open_back.png create mode 100644 assets/minecraft/textures/item/orange_bundle_open_front.png create mode 100644 assets/minecraft/textures/item/pale_oak_boat.png create mode 100644 assets/minecraft/textures/item/pale_oak_chest_boat.png create mode 100644 assets/minecraft/textures/item/pale_oak_door.png create mode 100644 assets/minecraft/textures/item/pale_oak_hanging_sign.png create mode 100644 assets/minecraft/textures/item/pale_oak_sign.png create mode 100644 assets/minecraft/textures/item/pink_bundle.png create mode 100644 assets/minecraft/textures/item/pink_bundle_open_back.png create mode 100644 assets/minecraft/textures/item/pink_bundle_open_front.png create mode 100644 assets/minecraft/textures/item/purple_bundle.png create mode 100644 assets/minecraft/textures/item/purple_bundle_open_back.png create mode 100644 assets/minecraft/textures/item/purple_bundle_open_front.png create mode 100644 assets/minecraft/textures/item/red_bundle.png create mode 100644 assets/minecraft/textures/item/red_bundle_open_back.png create mode 100644 assets/minecraft/textures/item/red_bundle_open_front.png create mode 100644 assets/minecraft/textures/item/white_bundle.png create mode 100644 assets/minecraft/textures/item/white_bundle_open_back.png create mode 100644 assets/minecraft/textures/item/white_bundle_open_front.png create mode 100644 assets/minecraft/textures/item/yellow_bundle.png create mode 100644 assets/minecraft/textures/item/yellow_bundle_open_back.png create mode 100644 assets/minecraft/textures/item/yellow_bundle_open_front.png rename assets/minecraft/textures/misc/{enchanted_item_glint.png.mcmeta => enchanted_glint_entity.png.mcmeta} (100%) create mode 100644 assets/minecraft/textures/misc/enchanted_glint_item.png.mcmeta create mode 100644 assets/minecraft/textures/misc/nausea.png.mcmeta rename assets/minecraft/textures/trims/{models/armor => entity/humanoid}/bolt.png (100%) rename assets/minecraft/textures/trims/{models/armor => entity/humanoid}/coast.png (100%) rename assets/minecraft/textures/trims/{models/armor => entity/humanoid}/dune.png (100%) rename assets/minecraft/textures/trims/{models/armor => entity/humanoid}/eye.png (100%) rename assets/minecraft/textures/trims/{models/armor => entity/humanoid}/flow.png (100%) rename assets/minecraft/textures/trims/{models/armor => entity/humanoid}/host.png (100%) rename assets/minecraft/textures/trims/{models/armor => entity/humanoid}/raiser.png (100%) rename assets/minecraft/textures/trims/{models/armor => entity/humanoid}/rib.png (100%) rename assets/minecraft/textures/trims/{models/armor => entity/humanoid}/sentry.png (100%) rename assets/minecraft/textures/trims/{models/armor => entity/humanoid}/shaper.png (100%) rename assets/minecraft/textures/trims/{models/armor => entity/humanoid}/silence.png (100%) rename assets/minecraft/textures/trims/{models/armor => entity/humanoid}/snout.png (100%) rename assets/minecraft/textures/trims/{models/armor => entity/humanoid}/spire.png (100%) rename assets/minecraft/textures/trims/{models/armor => entity/humanoid}/tide.png (100%) rename assets/minecraft/textures/trims/{models/armor => entity/humanoid}/vex.png (100%) rename assets/minecraft/textures/trims/{models/armor => entity/humanoid}/ward.png (100%) rename assets/minecraft/textures/trims/{models/armor => entity/humanoid}/wayfinder.png (100%) rename assets/minecraft/textures/trims/{models/armor => entity/humanoid}/wild.png (100%) rename assets/minecraft/textures/trims/{models/armor/bolt_leggings.png => entity/humanoid_leggings/bolt.png} (100%) rename assets/minecraft/textures/trims/{models/armor/coast_leggings.png => entity/humanoid_leggings/coast.png} (100%) rename assets/minecraft/textures/trims/{models/armor/dune_leggings.png => entity/humanoid_leggings/dune.png} (100%) rename assets/minecraft/textures/trims/{models/armor/eye_leggings.png => entity/humanoid_leggings/eye.png} (100%) rename assets/minecraft/textures/trims/{models/armor/flow_leggings.png => entity/humanoid_leggings/flow.png} (100%) rename assets/minecraft/textures/trims/{models/armor/host_leggings.png => entity/humanoid_leggings/host.png} (100%) rename assets/minecraft/textures/trims/{models/armor/raiser_leggings.png => entity/humanoid_leggings/raiser.png} (100%) rename assets/minecraft/textures/trims/{models/armor/rib_leggings.png => entity/humanoid_leggings/rib.png} (100%) rename assets/minecraft/textures/trims/{models/armor/sentry_leggings.png => entity/humanoid_leggings/sentry.png} (100%) rename assets/minecraft/textures/trims/{models/armor/shaper_leggings.png => entity/humanoid_leggings/shaper.png} (100%) rename assets/minecraft/textures/trims/{models/armor/silence_leggings.png => entity/humanoid_leggings/silence.png} (100%) rename assets/minecraft/textures/trims/{models/armor/snout_leggings.png => entity/humanoid_leggings/snout.png} (100%) rename assets/minecraft/textures/trims/{models/armor/spire_leggings.png => entity/humanoid_leggings/spire.png} (100%) rename assets/minecraft/textures/trims/{models/armor/tide_leggings.png => entity/humanoid_leggings/tide.png} (100%) rename assets/minecraft/textures/trims/{models/armor/vex_leggings.png => entity/humanoid_leggings/vex.png} (100%) rename assets/minecraft/textures/trims/{models/armor/ward_leggings.png => entity/humanoid_leggings/ward.png} (100%) rename assets/minecraft/textures/trims/{models/armor/wayfinder_leggings.png => entity/humanoid_leggings/wayfinder.png} (100%) rename assets/minecraft/textures/trims/{models/armor/wild_leggings.png => entity/humanoid_leggings/wild.png} (100%) create mode 100644 com/mojang/blaze3d/ProjectionType.java create mode 100644 com/mojang/blaze3d/TracyBootstrap.java create mode 100644 com/mojang/blaze3d/TracyFrameCapture.java create mode 100644 com/mojang/blaze3d/buffers/BufferType.java create mode 100644 com/mojang/blaze3d/buffers/BufferUsage.java create mode 100644 com/mojang/blaze3d/buffers/GpuBuffer.java create mode 100644 com/mojang/blaze3d/buffers/GpuFence.java create mode 100644 com/mojang/blaze3d/buffers/package-info.java create mode 100644 com/mojang/blaze3d/framegraph/FrameGraphBuilder.java create mode 100644 com/mojang/blaze3d/framegraph/FramePass.java create mode 100644 com/mojang/blaze3d/framegraph/package-info.java delete mode 100644 com/mojang/blaze3d/pipeline/RenderPipeline.java create mode 100644 com/mojang/blaze3d/platform/ClientShutdownWatchdog.java create mode 100644 com/mojang/blaze3d/platform/FramerateLimitTracker.java create mode 100644 com/mojang/blaze3d/resource/CrossFrameResourcePool.java create mode 100644 com/mojang/blaze3d/resource/GraphicsResourceAllocator.java create mode 100644 com/mojang/blaze3d/resource/RenderTargetDescriptor.java create mode 100644 com/mojang/blaze3d/resource/ResourceDescriptor.java create mode 100644 com/mojang/blaze3d/resource/ResourceHandle.java create mode 100644 com/mojang/blaze3d/resource/package-info.java delete mode 100644 com/mojang/blaze3d/shaders/BlendMode.java create mode 100644 com/mojang/blaze3d/shaders/CompiledShader.java delete mode 100644 com/mojang/blaze3d/shaders/EffectProgram.java delete mode 100644 com/mojang/blaze3d/shaders/Program.java delete mode 100644 com/mojang/blaze3d/shaders/ProgramManager.java delete mode 100644 com/mojang/blaze3d/shaders/Shader.java create mode 100644 com/mojang/realmsclient/client/worldupload/RealmsCreateWorldFlow.java create mode 100644 com/mojang/realmsclient/client/worldupload/RealmsUploadCanceledException.java create mode 100644 com/mojang/realmsclient/client/worldupload/RealmsUploadException.java create mode 100644 com/mojang/realmsclient/client/worldupload/RealmsUploadFailedException.java create mode 100644 com/mojang/realmsclient/client/worldupload/RealmsUploadTooLargeException.java create mode 100644 com/mojang/realmsclient/client/worldupload/RealmsUploadWorldNotClosedException.java create mode 100644 com/mojang/realmsclient/client/worldupload/RealmsUploadWorldPacker.java create mode 100644 com/mojang/realmsclient/client/worldupload/RealmsWorldUpload.java create mode 100644 com/mojang/realmsclient/client/worldupload/RealmsWorldUploadStatusTracker.java create mode 100644 com/mojang/realmsclient/client/worldupload/package-info.java rename com/mojang/{blaze3d/shaders/Effect.java => realmsclient/dto/RealmsSettings.java} (54%) delete mode 100644 com/mojang/realmsclient/gui/screens/RealmsResetNormalWorldScreen.java delete mode 100644 com/mojang/realmsclient/util/WorldGenerationInfo.java delete mode 100644 com/mojang/realmsclient/util/task/CreateSnapshotRealmTask.java delete mode 100644 com/mojang/realmsclient/util/task/ResettingGeneratedWorldTask.java create mode 100644 data/minecraft/advancement/recipes/decorations/black_shulker_box.json create mode 100644 data/minecraft/advancement/recipes/decorations/blue_shulker_box.json create mode 100644 data/minecraft/advancement/recipes/decorations/brown_shulker_box.json create mode 100644 data/minecraft/advancement/recipes/decorations/cyan_shulker_box.json create mode 100644 data/minecraft/advancement/recipes/decorations/gray_shulker_box.json create mode 100644 data/minecraft/advancement/recipes/decorations/green_shulker_box.json create mode 100644 data/minecraft/advancement/recipes/decorations/light_blue_shulker_box.json create mode 100644 data/minecraft/advancement/recipes/decorations/light_gray_shulker_box.json create mode 100644 data/minecraft/advancement/recipes/decorations/lime_shulker_box.json create mode 100644 data/minecraft/advancement/recipes/decorations/magenta_shulker_box.json create mode 100644 data/minecraft/advancement/recipes/decorations/orange_shulker_box.json create mode 100644 data/minecraft/advancement/recipes/decorations/pink_shulker_box.json create mode 100644 data/minecraft/advancement/recipes/decorations/purple_shulker_box.json create mode 100644 data/minecraft/advancement/recipes/decorations/red_shulker_box.json create mode 100644 data/minecraft/advancement/recipes/decorations/white_shulker_box.json create mode 100644 data/minecraft/advancement/recipes/decorations/yellow_shulker_box.json create mode 100644 data/minecraft/advancement/recipes/food/suspicious_stew_from_allium.json create mode 100644 data/minecraft/advancement/recipes/food/suspicious_stew_from_azure_bluet.json create mode 100644 data/minecraft/advancement/recipes/food/suspicious_stew_from_blue_orchid.json create mode 100644 data/minecraft/advancement/recipes/food/suspicious_stew_from_cornflower.json create mode 100644 data/minecraft/advancement/recipes/food/suspicious_stew_from_dandelion.json create mode 100644 data/minecraft/advancement/recipes/food/suspicious_stew_from_lily_of_the_valley.json create mode 100644 data/minecraft/advancement/recipes/food/suspicious_stew_from_orange_tulip.json create mode 100644 data/minecraft/advancement/recipes/food/suspicious_stew_from_oxeye_daisy.json create mode 100644 data/minecraft/advancement/recipes/food/suspicious_stew_from_pink_tulip.json create mode 100644 data/minecraft/advancement/recipes/food/suspicious_stew_from_poppy.json create mode 100644 data/minecraft/advancement/recipes/food/suspicious_stew_from_red_tulip.json create mode 100644 data/minecraft/advancement/recipes/food/suspicious_stew_from_torchflower.json create mode 100644 data/minecraft/advancement/recipes/food/suspicious_stew_from_white_tulip.json create mode 100644 data/minecraft/advancement/recipes/food/suspicious_stew_from_wither_rose.json create mode 100644 data/minecraft/advancement/recipes/misc/bordure_indented_banner_pattern.json create mode 100644 data/minecraft/advancement/recipes/misc/field_masoned_banner_pattern.json create mode 100644 data/minecraft/advancement/recipes/tools/black_bundle.json create mode 100644 data/minecraft/advancement/recipes/tools/blue_bundle.json create mode 100644 data/minecraft/advancement/recipes/tools/brown_bundle.json rename data/minecraft/{datapacks/bundle/data/minecraft => }/advancement/recipes/tools/bundle.json (100%) create mode 100644 data/minecraft/advancement/recipes/tools/cyan_bundle.json create mode 100644 data/minecraft/advancement/recipes/tools/gray_bundle.json create mode 100644 data/minecraft/advancement/recipes/tools/green_bundle.json create mode 100644 data/minecraft/advancement/recipes/tools/light_blue_bundle.json create mode 100644 data/minecraft/advancement/recipes/tools/light_gray_bundle.json create mode 100644 data/minecraft/advancement/recipes/tools/lime_bundle.json create mode 100644 data/minecraft/advancement/recipes/tools/magenta_bundle.json create mode 100644 data/minecraft/advancement/recipes/tools/orange_bundle.json create mode 100644 data/minecraft/advancement/recipes/tools/pink_bundle.json create mode 100644 data/minecraft/advancement/recipes/tools/purple_bundle.json create mode 100644 data/minecraft/advancement/recipes/tools/red_bundle.json create mode 100644 data/minecraft/advancement/recipes/tools/white_bundle.json create mode 100644 data/minecraft/advancement/recipes/tools/yellow_bundle.json create mode 100644 data/minecraft/damage_type/ender_pearl.json create mode 100644 data/minecraft/damage_type/mace_smash.json delete mode 100644 data/minecraft/datapacks/bundle/pack.mcmeta create mode 100644 data/minecraft/datapacks/minecart_improvements/pack.mcmeta create mode 100644 data/minecraft/datapacks/redstone_experiments/pack.mcmeta create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/advancement/adventure/adventuring_time.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/advancement/adventure/kill_a_mob.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/advancement/adventure/kill_all_mobs.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/advancement/recipes/building_blocks/pale_oak_planks.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/advancement/recipes/building_blocks/pale_oak_slab.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/advancement/recipes/building_blocks/pale_oak_stairs.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/advancement/recipes/building_blocks/pale_oak_wood.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/advancement/recipes/building_blocks/stripped_pale_oak_wood.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/advancement/recipes/decorations/pale_moss_carpet.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/advancement/recipes/decorations/pale_oak_fence.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/advancement/recipes/decorations/pale_oak_hanging_sign.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/advancement/recipes/decorations/pale_oak_sign.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/advancement/recipes/redstone/pale_oak_button.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/advancement/recipes/redstone/pale_oak_door.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/advancement/recipes/redstone/pale_oak_fence_gate.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/advancement/recipes/redstone/pale_oak_pressure_plate.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/advancement/recipes/redstone/pale_oak_trapdoor.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/advancement/recipes/transportation/pale_oak_boat.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/advancement/recipes/transportation/pale_oak_chest_boat.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/loot_table/blocks/creaking_heart.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/loot_table/blocks/pale_hanging_moss.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/loot_table/blocks/pale_moss_block.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/loot_table/blocks/pale_moss_carpet.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/loot_table/blocks/pale_oak_button.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/loot_table/blocks/pale_oak_door.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/loot_table/blocks/pale_oak_fence.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/loot_table/blocks/pale_oak_fence_gate.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/loot_table/blocks/pale_oak_hanging_sign.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/loot_table/blocks/pale_oak_leaves.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/loot_table/blocks/pale_oak_log.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/loot_table/blocks/pale_oak_planks.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/loot_table/blocks/pale_oak_pressure_plate.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/loot_table/blocks/pale_oak_sapling.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/loot_table/blocks/pale_oak_sign.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/loot_table/blocks/pale_oak_slab.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/loot_table/blocks/pale_oak_stairs.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/loot_table/blocks/pale_oak_trapdoor.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/loot_table/blocks/pale_oak_wood.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/loot_table/blocks/potted_pale_oak_sapling.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/loot_table/blocks/stripped_pale_oak_log.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/loot_table/blocks/stripped_pale_oak_wood.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/recipe/pale_moss_carpet.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/recipe/pale_oak_boat.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/recipe/pale_oak_button.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/recipe/pale_oak_chest_boat.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/recipe/pale_oak_door.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/recipe/pale_oak_fence.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/recipe/pale_oak_fence_gate.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/recipe/pale_oak_hanging_sign.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/recipe/pale_oak_planks.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/recipe/pale_oak_pressure_plate.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/recipe/pale_oak_sign.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/recipe/pale_oak_slab.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/recipe/pale_oak_stairs.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/recipe/pale_oak_trapdoor.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/recipe/pale_oak_wood.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/recipe/stripped_pale_oak_wood.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/tags/block/ceiling_hanging_signs.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/tags/block/combination_step_sound_blocks.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/tags/block/dirt.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/tags/block/fence_gates.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/tags/block/flower_pots.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/tags/block/leaves.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/tags/block/logs_that_burn.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/tags/block/mineable/axe.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/tags/block/mineable/hoe.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/tags/block/overworld_natural_logs.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/tags/block/pale_oak_logs.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/tags/block/planks.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/tags/block/saplings.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/tags/block/standing_signs.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/tags/block/sword_efficient.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/tags/block/wall_hanging_signs.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/tags/block/wall_signs.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/tags/block/wooden_buttons.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/tags/block/wooden_doors.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/tags/block/wooden_fences.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/tags/block/wooden_pressure_plates.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/tags/block/wooden_slabs.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/tags/block/wooden_stairs.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/tags/block/wooden_trapdoors.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/tags/entity_type/boat.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/tags/item/boats.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/tags/item/chest_boats.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/tags/item/dirt.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/tags/item/fence_gates.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/tags/item/hanging_signs.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/tags/item/leaves.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/tags/item/logs_that_burn.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/tags/item/pale_oak_logs.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/tags/item/planks.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/tags/item/saplings.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/tags/item/signs.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/tags/item/wooden_buttons.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/tags/item/wooden_doors.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/tags/item/wooden_fences.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/tags/item/wooden_pressure_plates.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/tags/item/wooden_slabs.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/tags/item/wooden_stairs.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/tags/item/wooden_trapdoors.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/tags/worldgen/biome/has_structure/trial_chambers.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/tags/worldgen/biome/is_forest.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/tags/worldgen/biome/is_overworld.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/tags/worldgen/biome/stronghold_biased_to.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/worldgen/biome/pale_garden.json create mode 100644 data/minecraft/datapacks/winter_drop/data/minecraft/worldgen/multi_noise_biome_source_parameter_list/overworld.json create mode 100644 data/minecraft/datapacks/winter_drop/pack.mcmeta create mode 100644 data/minecraft/instrument/admire_goat_horn.json create mode 100644 data/minecraft/instrument/call_goat_horn.json create mode 100644 data/minecraft/instrument/dream_goat_horn.json create mode 100644 data/minecraft/instrument/feel_goat_horn.json create mode 100644 data/minecraft/instrument/ponder_goat_horn.json create mode 100644 data/minecraft/instrument/seek_goat_horn.json create mode 100644 data/minecraft/instrument/sing_goat_horn.json create mode 100644 data/minecraft/instrument/yearn_goat_horn.json create mode 100644 data/minecraft/loot_table/blocks/creaking_heart.json create mode 100644 data/minecraft/loot_table/blocks/pale_hanging_moss.json create mode 100644 data/minecraft/loot_table/blocks/pale_moss_block.json create mode 100644 data/minecraft/loot_table/blocks/pale_moss_carpet.json create mode 100644 data/minecraft/loot_table/blocks/pale_oak_button.json create mode 100644 data/minecraft/loot_table/blocks/pale_oak_door.json create mode 100644 data/minecraft/loot_table/blocks/pale_oak_fence.json create mode 100644 data/minecraft/loot_table/blocks/pale_oak_fence_gate.json create mode 100644 data/minecraft/loot_table/blocks/pale_oak_hanging_sign.json create mode 100644 data/minecraft/loot_table/blocks/pale_oak_leaves.json create mode 100644 data/minecraft/loot_table/blocks/pale_oak_log.json create mode 100644 data/minecraft/loot_table/blocks/pale_oak_planks.json create mode 100644 data/minecraft/loot_table/blocks/pale_oak_pressure_plate.json create mode 100644 data/minecraft/loot_table/blocks/pale_oak_sapling.json create mode 100644 data/minecraft/loot_table/blocks/pale_oak_sign.json create mode 100644 data/minecraft/loot_table/blocks/pale_oak_slab.json create mode 100644 data/minecraft/loot_table/blocks/pale_oak_stairs.json create mode 100644 data/minecraft/loot_table/blocks/pale_oak_trapdoor.json create mode 100644 data/minecraft/loot_table/blocks/pale_oak_wood.json create mode 100644 data/minecraft/loot_table/blocks/potted_pale_oak_sapling.json create mode 100644 data/minecraft/loot_table/blocks/stripped_pale_oak_log.json create mode 100644 data/minecraft/loot_table/blocks/stripped_pale_oak_wood.json create mode 100644 data/minecraft/loot_table/entities/creaking.json create mode 100644 data/minecraft/loot_table/entities/creaking_transient.json create mode 100644 data/minecraft/loot_table/gameplay/armadillo_shed.json create mode 100644 data/minecraft/loot_table/gameplay/chicken_lay.json create mode 100644 data/minecraft/loot_table/gameplay/hero_of_the_village/baby_gift.json create mode 100644 data/minecraft/loot_table/gameplay/hero_of_the_village/unemployed_gift.json create mode 100644 data/minecraft/loot_table/shearing/mooshroom.json create mode 100644 data/minecraft/loot_table/shearing/mooshroom/brown.json create mode 100644 data/minecraft/loot_table/shearing/mooshroom/red.json create mode 100644 data/minecraft/loot_table/shearing/sheep.json create mode 100644 data/minecraft/loot_table/shearing/sheep/black.json create mode 100644 data/minecraft/loot_table/shearing/sheep/blue.json create mode 100644 data/minecraft/loot_table/shearing/sheep/brown.json create mode 100644 data/minecraft/loot_table/shearing/sheep/cyan.json create mode 100644 data/minecraft/loot_table/shearing/sheep/gray.json create mode 100644 data/minecraft/loot_table/shearing/sheep/green.json create mode 100644 data/minecraft/loot_table/shearing/sheep/light_blue.json create mode 100644 data/minecraft/loot_table/shearing/sheep/light_gray.json create mode 100644 data/minecraft/loot_table/shearing/sheep/lime.json create mode 100644 data/minecraft/loot_table/shearing/sheep/magenta.json create mode 100644 data/minecraft/loot_table/shearing/sheep/orange.json create mode 100644 data/minecraft/loot_table/shearing/sheep/pink.json create mode 100644 data/minecraft/loot_table/shearing/sheep/purple.json create mode 100644 data/minecraft/loot_table/shearing/sheep/red.json create mode 100644 data/minecraft/loot_table/shearing/sheep/white.json create mode 100644 data/minecraft/loot_table/shearing/sheep/yellow.json create mode 100644 data/minecraft/loot_table/shearing/snow_golem.json create mode 100644 data/minecraft/recipe/black_bundle.json create mode 100644 data/minecraft/recipe/black_shulker_box.json create mode 100644 data/minecraft/recipe/blue_bundle.json create mode 100644 data/minecraft/recipe/blue_shulker_box.json create mode 100644 data/minecraft/recipe/bordure_indented_banner_pattern.json create mode 100644 data/minecraft/recipe/brown_bundle.json create mode 100644 data/minecraft/recipe/brown_shulker_box.json rename data/minecraft/{datapacks/bundle/data/minecraft => }/recipe/bundle.json (54%) create mode 100644 data/minecraft/recipe/cyan_bundle.json create mode 100644 data/minecraft/recipe/cyan_shulker_box.json create mode 100644 data/minecraft/recipe/field_masoned_banner_pattern.json create mode 100644 data/minecraft/recipe/gray_bundle.json create mode 100644 data/minecraft/recipe/gray_shulker_box.json create mode 100644 data/minecraft/recipe/green_bundle.json create mode 100644 data/minecraft/recipe/green_shulker_box.json create mode 100644 data/minecraft/recipe/light_blue_bundle.json create mode 100644 data/minecraft/recipe/light_blue_shulker_box.json create mode 100644 data/minecraft/recipe/light_gray_bundle.json create mode 100644 data/minecraft/recipe/light_gray_shulker_box.json create mode 100644 data/minecraft/recipe/lime_bundle.json create mode 100644 data/minecraft/recipe/lime_shulker_box.json create mode 100644 data/minecraft/recipe/magenta_bundle.json create mode 100644 data/minecraft/recipe/magenta_shulker_box.json create mode 100644 data/minecraft/recipe/orange_bundle.json create mode 100644 data/minecraft/recipe/orange_shulker_box.json create mode 100644 data/minecraft/recipe/pink_bundle.json create mode 100644 data/minecraft/recipe/pink_shulker_box.json create mode 100644 data/minecraft/recipe/purple_bundle.json create mode 100644 data/minecraft/recipe/purple_shulker_box.json create mode 100644 data/minecraft/recipe/red_bundle.json create mode 100644 data/minecraft/recipe/red_shulker_box.json delete mode 100644 data/minecraft/recipe/shulker_box_coloring.json delete mode 100644 data/minecraft/recipe/suspicious_stew.json create mode 100644 data/minecraft/recipe/suspicious_stew_from_allium.json create mode 100644 data/minecraft/recipe/suspicious_stew_from_azure_bluet.json create mode 100644 data/minecraft/recipe/suspicious_stew_from_blue_orchid.json create mode 100644 data/minecraft/recipe/suspicious_stew_from_cornflower.json create mode 100644 data/minecraft/recipe/suspicious_stew_from_dandelion.json create mode 100644 data/minecraft/recipe/suspicious_stew_from_lily_of_the_valley.json create mode 100644 data/minecraft/recipe/suspicious_stew_from_orange_tulip.json create mode 100644 data/minecraft/recipe/suspicious_stew_from_oxeye_daisy.json create mode 100644 data/minecraft/recipe/suspicious_stew_from_pink_tulip.json create mode 100644 data/minecraft/recipe/suspicious_stew_from_poppy.json create mode 100644 data/minecraft/recipe/suspicious_stew_from_red_tulip.json create mode 100644 data/minecraft/recipe/suspicious_stew_from_torchflower.json create mode 100644 data/minecraft/recipe/suspicious_stew_from_white_tulip.json create mode 100644 data/minecraft/recipe/suspicious_stew_from_wither_rose.json create mode 100644 data/minecraft/recipe/white_bundle.json create mode 100644 data/minecraft/recipe/white_shulker_box.json create mode 100644 data/minecraft/recipe/yellow_bundle.json create mode 100644 data/minecraft/recipe/yellow_shulker_box.json delete mode 100644 data/minecraft/structure/trial_chambers/chamber/slanted/hallway_4.nbt delete mode 100644 data/minecraft/structure/trial_chambers/chamber/slanted/hallway_5.nbt create mode 100644 data/minecraft/structure/trial_chambers/decor/black_bed.nbt create mode 100644 data/minecraft/structure/trial_chambers/decor/blue_bed.nbt create mode 100644 data/minecraft/structure/trial_chambers/decor/brown_bed.nbt create mode 100644 data/minecraft/structure/trial_chambers/decor/cyan_bed.nbt create mode 100644 data/minecraft/structure/trial_chambers/decor/disposal.nbt create mode 100644 data/minecraft/structure/trial_chambers/decor/gray_bed.nbt create mode 100644 data/minecraft/structure/trial_chambers/decor/green_bed.nbt create mode 100644 data/minecraft/structure/trial_chambers/decor/light_blue_bed.nbt create mode 100644 data/minecraft/structure/trial_chambers/decor/light_gray_bed.nbt create mode 100644 data/minecraft/structure/trial_chambers/decor/lime_bed.nbt create mode 100644 data/minecraft/structure/trial_chambers/decor/magenta_bed.nbt create mode 100644 data/minecraft/structure/trial_chambers/decor/orange_bed.nbt create mode 100644 data/minecraft/structure/trial_chambers/decor/pink_bed.nbt create mode 100644 data/minecraft/structure/trial_chambers/decor/purple_bed.nbt create mode 100644 data/minecraft/structure/trial_chambers/decor/red_bed.nbt create mode 100644 data/minecraft/structure/trial_chambers/decor/white_bed.nbt create mode 100644 data/minecraft/structure/trial_chambers/decor/yellow_bed.nbt create mode 100644 data/minecraft/structure/trial_chambers/hallway/encounter_1.nbt create mode 100644 data/minecraft/structure/trial_chambers/hallway/encounter_2.nbt create mode 100644 data/minecraft/structure/trial_chambers/hallway/encounter_3.nbt create mode 100644 data/minecraft/structure/trial_chambers/hallway/encounter_4.nbt create mode 100644 data/minecraft/structure/trial_chambers/hallway/encounter_5.nbt create mode 100644 data/minecraft/structure/trial_chambers/hallway/trapped_staircase.nbt create mode 100644 data/minecraft/tags/banner_pattern/pattern_item/bordure_indented.json create mode 100644 data/minecraft/tags/banner_pattern/pattern_item/field_masoned.json create mode 100644 data/minecraft/tags/block/bats_spawnable_on.json create mode 100644 data/minecraft/tags/damage_type/mace_smash.json create mode 100644 data/minecraft/tags/entity_type/boat.json create mode 100644 data/minecraft/tags/item/brewing_fuel.json create mode 100644 data/minecraft/tags/item/bundles.json create mode 100644 data/minecraft/tags/item/diamond_tool_materials.json create mode 100644 data/minecraft/tags/item/duplicates_allays.json create mode 100644 data/minecraft/tags/item/furnace_minecart_fuel.json create mode 100644 data/minecraft/tags/item/gaze_disguise_equipment.json create mode 100644 data/minecraft/tags/item/gold_tool_materials.json create mode 100644 data/minecraft/tags/item/iron_tool_materials.json create mode 100644 data/minecraft/tags/item/map_invisibility_equipment.json create mode 100644 data/minecraft/tags/item/netherite_tool_materials.json create mode 100644 data/minecraft/tags/item/panda_eats_from_ground.json create mode 100644 data/minecraft/tags/item/piglin_safe_armor.json create mode 100644 data/minecraft/tags/item/repairs_chain_armor.json create mode 100644 data/minecraft/tags/item/repairs_diamond_armor.json create mode 100644 data/minecraft/tags/item/repairs_gold_armor.json create mode 100644 data/minecraft/tags/item/repairs_iron_armor.json create mode 100644 data/minecraft/tags/item/repairs_leather_armor.json create mode 100644 data/minecraft/tags/item/repairs_netherite_armor.json create mode 100644 data/minecraft/tags/item/repairs_turtle_helmet.json create mode 100644 data/minecraft/tags/item/repairs_wolf_armor.json create mode 100644 data/minecraft/tags/item/shulker_boxes.json create mode 100644 data/minecraft/tags/item/villager_picks_up.json create mode 100644 data/minecraft/tags/item/wooden_tool_materials.json create mode 100644 data/minecraft/trial_spawner/trial_chamber/breeze/normal.json create mode 100644 data/minecraft/trial_spawner/trial_chamber/breeze/ominous.json create mode 100644 data/minecraft/trial_spawner/trial_chamber/melee/husk/normal.json create mode 100644 data/minecraft/trial_spawner/trial_chamber/melee/husk/ominous.json create mode 100644 data/minecraft/trial_spawner/trial_chamber/melee/spider/normal.json create mode 100644 data/minecraft/trial_spawner/trial_chamber/melee/spider/ominous.json create mode 100644 data/minecraft/trial_spawner/trial_chamber/melee/zombie/normal.json create mode 100644 data/minecraft/trial_spawner/trial_chamber/melee/zombie/ominous.json create mode 100644 data/minecraft/trial_spawner/trial_chamber/ranged/poison_skeleton/normal.json create mode 100644 data/minecraft/trial_spawner/trial_chamber/ranged/poison_skeleton/ominous.json create mode 100644 data/minecraft/trial_spawner/trial_chamber/ranged/skeleton/normal.json create mode 100644 data/minecraft/trial_spawner/trial_chamber/ranged/skeleton/ominous.json create mode 100644 data/minecraft/trial_spawner/trial_chamber/ranged/stray/normal.json create mode 100644 data/minecraft/trial_spawner/trial_chamber/ranged/stray/ominous.json create mode 100644 data/minecraft/trial_spawner/trial_chamber/slow_ranged/poison_skeleton/normal.json create mode 100644 data/minecraft/trial_spawner/trial_chamber/slow_ranged/poison_skeleton/ominous.json create mode 100644 data/minecraft/trial_spawner/trial_chamber/slow_ranged/skeleton/normal.json create mode 100644 data/minecraft/trial_spawner/trial_chamber/slow_ranged/skeleton/ominous.json create mode 100644 data/minecraft/trial_spawner/trial_chamber/slow_ranged/stray/normal.json create mode 100644 data/minecraft/trial_spawner/trial_chamber/slow_ranged/stray/ominous.json create mode 100644 data/minecraft/trial_spawner/trial_chamber/small_melee/baby_zombie/normal.json create mode 100644 data/minecraft/trial_spawner/trial_chamber/small_melee/baby_zombie/ominous.json create mode 100644 data/minecraft/trial_spawner/trial_chamber/small_melee/cave_spider/normal.json create mode 100644 data/minecraft/trial_spawner/trial_chamber/small_melee/cave_spider/ominous.json create mode 100644 data/minecraft/trial_spawner/trial_chamber/small_melee/silverfish/normal.json create mode 100644 data/minecraft/trial_spawner/trial_chamber/small_melee/silverfish/ominous.json create mode 100644 data/minecraft/trial_spawner/trial_chamber/small_melee/slime/normal.json create mode 100644 data/minecraft/trial_spawner/trial_chamber/small_melee/slime/ominous.json create mode 100644 data/minecraft/worldgen/configured_feature/pale_garden_vegetation.json create mode 100644 data/minecraft/worldgen/configured_feature/pale_moss_patch_bonemeal.json create mode 100644 data/minecraft/worldgen/configured_feature/pale_moss_vegetation.json create mode 100644 data/minecraft/worldgen/configured_feature/pale_oak.json create mode 100644 data/minecraft/worldgen/configured_feature/pale_oak_creaking.json delete mode 100644 data/minecraft/worldgen/configured_feature/seagrass_simple.json create mode 100644 data/minecraft/worldgen/placed_feature/pale_garden_vegetation.json create mode 100644 data/minecraft/worldgen/placed_feature/pale_oak_checked.json create mode 100644 data/minecraft/worldgen/placed_feature/pale_oak_creaking_checked.json delete mode 100644 data/minecraft/worldgen/placed_feature/seagrass_simple.json create mode 100644 data/minecraft/worldgen/template_pool/trial_chambers/decor/bed.json create mode 100644 data/minecraft/worldgen/template_pool/trial_chambers/decor/disposal.json create mode 100644 net/minecraft/TracingExecutor.java create mode 100644 net/minecraft/advancements/critereon/InputPredicate.java create mode 100644 net/minecraft/advancements/critereon/KilledByArrowTrigger.java delete mode 100644 net/minecraft/advancements/critereon/KilledByCrossbowTrigger.java create mode 100644 net/minecraft/advancements/critereon/SheepPredicate.java create mode 100644 net/minecraft/client/InactivityFpsLimit.java delete mode 100644 net/minecraft/client/RecipeBookCategories.java create mode 100644 net/minecraft/client/ScrollWheelHandler.java create mode 100644 net/minecraft/client/animation/definitions/CreakingAnimation.java create mode 100644 net/minecraft/client/gui/BundleMouseActions.java create mode 100644 net/minecraft/client/gui/ItemSlotMouseAction.java delete mode 100644 net/minecraft/client/gui/MapRenderer.java create mode 100644 net/minecraft/client/gui/components/debugchart/ProfilerPieChart.java delete mode 100644 net/minecraft/client/gui/components/toasts/ToastComponent.java create mode 100644 net/minecraft/client/gui/components/toasts/ToastManager.java create mode 100644 net/minecraft/client/gui/screens/inventory/AbstractRecipeBookScreen.java delete mode 100644 net/minecraft/client/gui/screens/inventory/EffectRenderingInventoryScreen.java create mode 100644 net/minecraft/client/gui/screens/inventory/EffectsInInventory.java delete mode 100644 net/minecraft/client/gui/screens/recipebook/AbstractFurnaceRecipeBookComponent.java delete mode 100644 net/minecraft/client/gui/screens/recipebook/BlastingRecipeBookComponent.java create mode 100644 net/minecraft/client/gui/screens/recipebook/CraftingRecipeBookComponent.java create mode 100644 net/minecraft/client/gui/screens/recipebook/FurnaceRecipeBookComponent.java delete mode 100644 net/minecraft/client/gui/screens/recipebook/GhostRecipe.java create mode 100644 net/minecraft/client/gui/screens/recipebook/GhostSlots.java delete mode 100644 net/minecraft/client/gui/screens/recipebook/RecipeShownListener.java create mode 100644 net/minecraft/client/gui/screens/recipebook/SearchRecipeBookCategory.java create mode 100644 net/minecraft/client/gui/screens/recipebook/SlotSelectTime.java delete mode 100644 net/minecraft/client/gui/screens/recipebook/SmeltingRecipeBookComponent.java delete mode 100644 net/minecraft/client/gui/screens/recipebook/SmokingRecipeBookComponent.java create mode 100644 net/minecraft/client/gui/screens/worldselection/CreateWorldCallback.java create mode 100644 net/minecraft/client/gui/screens/worldselection/DataPackReloadCookie.java create mode 100644 net/minecraft/client/gui/screens/worldselection/InitialWorldCreationOptions.java create mode 100644 net/minecraft/client/gui/screens/worldselection/WorldCreationContextMapper.java create mode 100644 net/minecraft/client/model/AbstractBoatModel.java create mode 100644 net/minecraft/client/model/AbstractEquineModel.java create mode 100644 net/minecraft/client/model/AbstractPiglinModel.java delete mode 100644 net/minecraft/client/model/AgeableHierarchicalModel.java delete mode 100644 net/minecraft/client/model/AgeableListModel.java create mode 100644 net/minecraft/client/model/ArrowModel.java create mode 100644 net/minecraft/client/model/BabyModelTransform.java create mode 100644 net/minecraft/client/model/BeeStingerModel.java create mode 100644 net/minecraft/client/model/BellModel.java delete mode 100644 net/minecraft/client/model/ChestBoatModel.java create mode 100644 net/minecraft/client/model/ChestModel.java delete mode 100644 net/minecraft/client/model/ChestRaftModel.java delete mode 100644 net/minecraft/client/model/ColorableAgeableListModel.java delete mode 100644 net/minecraft/client/model/ColorableHierarchicalModel.java create mode 100644 net/minecraft/client/model/CreakingModel.java rename net/minecraft/client/model/{ChestedHorseModel.java => DonkeyModel.java} (67%) create mode 100644 net/minecraft/client/model/EndCrystalModel.java create mode 100644 net/minecraft/client/model/FelineModel.java delete mode 100644 net/minecraft/client/model/HierarchicalModel.java delete mode 100644 net/minecraft/client/model/ListModel.java delete mode 100644 net/minecraft/client/model/ModelUtils.java create mode 100644 net/minecraft/client/model/PlayerCapeModel.java create mode 100644 net/minecraft/client/model/PlayerEarsModel.java create mode 100644 net/minecraft/client/model/SpinAttackEffectModel.java delete mode 100644 net/minecraft/client/model/WaterPatchModel.java create mode 100644 net/minecraft/client/model/ZombifiedPiglinModel.java create mode 100644 net/minecraft/client/model/dragon/EnderDragonModel.java create mode 100644 net/minecraft/client/model/geom/builders/MeshTransformer.java create mode 100644 net/minecraft/client/multiplayer/ClientRecipeContainer.java delete mode 100644 net/minecraft/client/multiplayer/TagCollector.java create mode 100644 net/minecraft/client/particle/TrailParticle.java rename net/minecraft/client/player/{Input.java => ClientInput.java} (50%) create mode 100644 net/minecraft/client/renderer/CloudRenderer.java create mode 100644 net/minecraft/client/renderer/CompiledShaderProgram.java create mode 100644 net/minecraft/client/renderer/CoreShaders.java delete mode 100644 net/minecraft/client/renderer/EffectInstance.java create mode 100644 net/minecraft/client/renderer/FogParameters.java create mode 100644 net/minecraft/client/renderer/LevelEventHandler.java create mode 100644 net/minecraft/client/renderer/LevelTargetBundle.java create mode 100644 net/minecraft/client/renderer/MapRenderer.java create mode 100644 net/minecraft/client/renderer/Octree.java create mode 100644 net/minecraft/client/renderer/PostChainConfig.java create mode 100644 net/minecraft/client/renderer/ShaderDefines.java delete mode 100644 net/minecraft/client/renderer/ShaderInstance.java create mode 100644 net/minecraft/client/renderer/ShaderManager.java create mode 100644 net/minecraft/client/renderer/ShaderProgram.java create mode 100644 net/minecraft/client/renderer/ShaderProgramConfig.java create mode 100644 net/minecraft/client/renderer/ShapeRenderer.java create mode 100644 net/minecraft/client/renderer/SkyRenderer.java create mode 100644 net/minecraft/client/renderer/WeatherEffectRenderer.java create mode 100644 net/minecraft/client/renderer/WorldBorderRenderer.java create mode 100644 net/minecraft/client/renderer/block/model/BakedOverrides.java delete mode 100644 net/minecraft/client/renderer/block/model/ItemOverrides.java create mode 100644 net/minecraft/client/renderer/block/model/UnbakedBlockStateModel.java create mode 100644 net/minecraft/client/renderer/block/model/VariantSelector.java create mode 100644 net/minecraft/client/renderer/chunk/CompileTaskDynamicQueue.java create mode 100644 net/minecraft/client/renderer/debug/ChunkCullingDebugRenderer.java create mode 100644 net/minecraft/client/renderer/debug/OctreeDebugRenderer.java create mode 100644 net/minecraft/client/renderer/debug/RedstoneWireOrientationsRenderer.java create mode 100644 net/minecraft/client/renderer/entity/AbstractBoatRenderer.java create mode 100644 net/minecraft/client/renderer/entity/AbstractHoglinRenderer.java create mode 100644 net/minecraft/client/renderer/entity/AbstractMinecartRenderer.java create mode 100644 net/minecraft/client/renderer/entity/AbstractSkeletonRenderer.java create mode 100644 net/minecraft/client/renderer/entity/AgeableMobRenderer.java delete mode 100644 net/minecraft/client/renderer/entity/ChestedHorseRenderer.java create mode 100644 net/minecraft/client/renderer/entity/CreakingRenderer.java create mode 100644 net/minecraft/client/renderer/entity/DonkeyRenderer.java create mode 100644 net/minecraft/client/renderer/entity/RaftRenderer.java create mode 100644 net/minecraft/client/renderer/entity/ZombifiedPiglinRenderer.java delete mode 100644 net/minecraft/client/renderer/entity/layers/ElytraLayer.java create mode 100644 net/minecraft/client/renderer/entity/layers/EquipmentLayerRenderer.java create mode 100644 net/minecraft/client/renderer/entity/layers/LivingEntityEmissiveLayer.java delete mode 100644 net/minecraft/client/renderer/entity/layers/SheepFurLayer.java create mode 100644 net/minecraft/client/renderer/entity/layers/SheepWoolLayer.java delete mode 100644 net/minecraft/client/renderer/entity/layers/ShulkerHeadLayer.java delete mode 100644 net/minecraft/client/renderer/entity/layers/WardenEmissiveLayer.java create mode 100644 net/minecraft/client/renderer/entity/layers/WingsLayer.java create mode 100644 net/minecraft/client/renderer/entity/state/AllayRenderState.java create mode 100644 net/minecraft/client/renderer/entity/state/ArmadilloRenderState.java create mode 100644 net/minecraft/client/renderer/entity/state/ArmorStandRenderState.java create mode 100644 net/minecraft/client/renderer/entity/state/ArrowRenderState.java create mode 100644 net/minecraft/client/renderer/entity/state/AxolotlRenderState.java create mode 100644 net/minecraft/client/renderer/entity/state/BatRenderState.java create mode 100644 net/minecraft/client/renderer/entity/state/BeeRenderState.java create mode 100644 net/minecraft/client/renderer/entity/state/BlockDisplayEntityRenderState.java create mode 100644 net/minecraft/client/renderer/entity/state/BoatRenderState.java create mode 100644 net/minecraft/client/renderer/entity/state/BoggedRenderState.java create mode 100644 net/minecraft/client/renderer/entity/state/BreezeRenderState.java create mode 100644 net/minecraft/client/renderer/entity/state/CamelRenderState.java create mode 100644 net/minecraft/client/renderer/entity/state/CatRenderState.java create mode 100644 net/minecraft/client/renderer/entity/state/ChickenRenderState.java create mode 100644 net/minecraft/client/renderer/entity/state/CreakingRenderState.java create mode 100644 net/minecraft/client/renderer/entity/state/CreeperRenderState.java create mode 100644 net/minecraft/client/renderer/entity/state/DisplayEntityRenderState.java create mode 100644 net/minecraft/client/renderer/entity/state/DolphinRenderState.java create mode 100644 net/minecraft/client/renderer/entity/state/DonkeyRenderState.java create mode 100644 net/minecraft/client/renderer/entity/state/EndCrystalRenderState.java create mode 100644 net/minecraft/client/renderer/entity/state/EnderDragonRenderState.java create mode 100644 net/minecraft/client/renderer/entity/state/EndermanRenderState.java create mode 100644 net/minecraft/client/renderer/entity/state/EntityRenderState.java create mode 100644 net/minecraft/client/renderer/entity/state/EquineRenderState.java create mode 100644 net/minecraft/client/renderer/entity/state/EvokerFangsRenderState.java create mode 100644 net/minecraft/client/renderer/entity/state/EvokerRenderState.java create mode 100644 net/minecraft/client/renderer/entity/state/ExperienceOrbRenderState.java create mode 100644 net/minecraft/client/renderer/entity/state/FallingBlockRenderState.java create mode 100644 net/minecraft/client/renderer/entity/state/FelineRenderState.java create mode 100644 net/minecraft/client/renderer/entity/state/FireworkRocketRenderState.java create mode 100644 net/minecraft/client/renderer/entity/state/FishingHookRenderState.java create mode 100644 net/minecraft/client/renderer/entity/state/FoxRenderState.java create mode 100644 net/minecraft/client/renderer/entity/state/FrogRenderState.java create mode 100644 net/minecraft/client/renderer/entity/state/GhastRenderState.java create mode 100644 net/minecraft/client/renderer/entity/state/GoatRenderState.java create mode 100644 net/minecraft/client/renderer/entity/state/GuardianRenderState.java create mode 100644 net/minecraft/client/renderer/entity/state/HoglinRenderState.java create mode 100644 net/minecraft/client/renderer/entity/state/HorseRenderState.java create mode 100644 net/minecraft/client/renderer/entity/state/HumanoidRenderState.java create mode 100644 net/minecraft/client/renderer/entity/state/IllagerRenderState.java create mode 100644 net/minecraft/client/renderer/entity/state/IllusionerRenderState.java create mode 100644 net/minecraft/client/renderer/entity/state/IronGolemRenderState.java create mode 100644 net/minecraft/client/renderer/entity/state/ItemDisplayEntityRenderState.java create mode 100644 net/minecraft/client/renderer/entity/state/ItemEntityRenderState.java create mode 100644 net/minecraft/client/renderer/entity/state/ItemFrameRenderState.java create mode 100644 net/minecraft/client/renderer/entity/state/LightningBoltRenderState.java create mode 100644 net/minecraft/client/renderer/entity/state/LivingEntityRenderState.java create mode 100644 net/minecraft/client/renderer/entity/state/LlamaRenderState.java create mode 100644 net/minecraft/client/renderer/entity/state/LlamaSpitRenderState.java create mode 100644 net/minecraft/client/renderer/entity/state/MinecartRenderState.java create mode 100644 net/minecraft/client/renderer/entity/state/MinecartTntRenderState.java create mode 100644 net/minecraft/client/renderer/entity/state/MushroomCowRenderState.java create mode 100644 net/minecraft/client/renderer/entity/state/OminousItemSpawnerRenderState.java create mode 100644 net/minecraft/client/renderer/entity/state/PaintingRenderState.java create mode 100644 net/minecraft/client/renderer/entity/state/PandaRenderState.java create mode 100644 net/minecraft/client/renderer/entity/state/ParrotRenderState.java create mode 100644 net/minecraft/client/renderer/entity/state/PhantomRenderState.java create mode 100644 net/minecraft/client/renderer/entity/state/PigRenderState.java create mode 100644 net/minecraft/client/renderer/entity/state/PiglinRenderState.java create mode 100644 net/minecraft/client/renderer/entity/state/PlayerRenderState.java create mode 100644 net/minecraft/client/renderer/entity/state/PolarBearRenderState.java create mode 100644 net/minecraft/client/renderer/entity/state/PufferfishRenderState.java create mode 100644 net/minecraft/client/renderer/entity/state/RabbitRenderState.java create mode 100644 net/minecraft/client/renderer/entity/state/RavagerRenderState.java create mode 100644 net/minecraft/client/renderer/entity/state/SaddleableRenderState.java create mode 100644 net/minecraft/client/renderer/entity/state/SalmonRenderState.java create mode 100644 net/minecraft/client/renderer/entity/state/SheepRenderState.java create mode 100644 net/minecraft/client/renderer/entity/state/ShulkerBulletRenderState.java create mode 100644 net/minecraft/client/renderer/entity/state/ShulkerRenderState.java create mode 100644 net/minecraft/client/renderer/entity/state/SkeletonRenderState.java create mode 100644 net/minecraft/client/renderer/entity/state/SlimeRenderState.java create mode 100644 net/minecraft/client/renderer/entity/state/SnifferRenderState.java create mode 100644 net/minecraft/client/renderer/entity/state/SquidRenderState.java create mode 100644 net/minecraft/client/renderer/entity/state/StriderRenderState.java create mode 100644 net/minecraft/client/renderer/entity/state/TextDisplayEntityRenderState.java create mode 100644 net/minecraft/client/renderer/entity/state/ThrownItemRenderState.java create mode 100644 net/minecraft/client/renderer/entity/state/ThrownTridentRenderState.java create mode 100644 net/minecraft/client/renderer/entity/state/TippableArrowRenderState.java create mode 100644 net/minecraft/client/renderer/entity/state/TntRenderState.java create mode 100644 net/minecraft/client/renderer/entity/state/TropicalFishRenderState.java create mode 100644 net/minecraft/client/renderer/entity/state/TurtleRenderState.java create mode 100644 net/minecraft/client/renderer/entity/state/VexRenderState.java create mode 100644 net/minecraft/client/renderer/entity/state/VillagerDataHolderRenderState.java create mode 100644 net/minecraft/client/renderer/entity/state/VillagerRenderState.java create mode 100644 net/minecraft/client/renderer/entity/state/WardenRenderState.java create mode 100644 net/minecraft/client/renderer/entity/state/WitchRenderState.java create mode 100644 net/minecraft/client/renderer/entity/state/WitherRenderState.java create mode 100644 net/minecraft/client/renderer/entity/state/WitherSkullRenderState.java create mode 100644 net/minecraft/client/renderer/entity/state/WolfRenderState.java create mode 100644 net/minecraft/client/renderer/entity/state/ZombieRenderState.java create mode 100644 net/minecraft/client/renderer/entity/state/ZombieVillagerRenderState.java create mode 100644 net/minecraft/client/renderer/entity/state/ZombifiedPiglinRenderState.java create mode 100644 net/minecraft/client/renderer/entity/state/package-info.java create mode 100644 net/minecraft/client/renderer/state/MapRenderState.java create mode 100644 net/minecraft/client/renderer/state/package-info.java create mode 100644 net/minecraft/client/resources/MapTextureManager.java create mode 100644 net/minecraft/client/resources/model/DelegateBakedModel.java create mode 100644 net/minecraft/client/resources/model/EquipmentModelSet.java create mode 100644 net/minecraft/client/resources/model/ItemModel.java create mode 100644 net/minecraft/client/resources/model/MissingBlockModel.java create mode 100644 net/minecraft/client/resources/model/ModelDiscovery.java create mode 100644 net/minecraft/client/resources/model/ModelGroupCollector.java create mode 100644 net/minecraft/client/resources/model/SpecialModels.java delete mode 100644 net/minecraft/client/tutorial/BundleTutorial.java create mode 100644 net/minecraft/commands/arguments/selector/SelectorPattern.java create mode 100644 net/minecraft/core/dispenser/EquipmentDispenseItemBehavior.java create mode 100644 net/minecraft/core/dispenser/MinecartDispenseItemBehavior.java create mode 100644 net/minecraft/core/particles/TargetColorParticleOption.java create mode 100644 net/minecraft/data/advancements/packs/WinterDropAdvancementProvider.java create mode 100644 net/minecraft/data/advancements/packs/WinterDropAdventureAdvancements.java create mode 100644 net/minecraft/data/info/DatapackStructureReport.java create mode 100644 net/minecraft/data/loot/packs/LootData.java create mode 100644 net/minecraft/data/loot/packs/WinterDropBlockLoot.java create mode 100644 net/minecraft/data/loot/packs/WinterDropLootTableProvider.java create mode 100644 net/minecraft/data/models/EquipmentModelProvider.java create mode 100644 net/minecraft/data/recipes/TransmuteRecipeBuilder.java delete mode 100644 net/minecraft/data/recipes/packs/BundleRecipeProvider.java create mode 100644 net/minecraft/data/recipes/packs/WinterDropRecipeProvider.java create mode 100644 net/minecraft/data/registries/WinterDropRegistries.java create mode 100644 net/minecraft/data/tags/WinterDropBiomeTagsProvider.java create mode 100644 net/minecraft/data/tags/WinterDropBlockTagsProvider.java create mode 100644 net/minecraft/data/tags/WinterDropEntityTypeTagsProvider.java create mode 100644 net/minecraft/data/tags/WinterDropItemTagsProvider.java create mode 100644 net/minecraft/data/worldgen/WinterDropBiomes.java create mode 100644 net/minecraft/locale/DeprecatedTranslationsInfo.java create mode 100644 net/minecraft/network/protocol/common/custom/RedstoneWireOrientationsDebugPayload.java create mode 100644 net/minecraft/network/protocol/game/ClientboundEntityPositionSyncPacket.java create mode 100644 net/minecraft/network/protocol/game/ClientboundMoveMinecartPacket.java create mode 100644 net/minecraft/network/protocol/game/ClientboundPlayerRotationPacket.java create mode 100644 net/minecraft/network/protocol/game/ClientboundRecipeBookAddPacket.java create mode 100644 net/minecraft/network/protocol/game/ClientboundRecipeBookRemovePacket.java create mode 100644 net/minecraft/network/protocol/game/ClientboundRecipeBookSettingsPacket.java delete mode 100644 net/minecraft/network/protocol/game/ClientboundRecipePacket.java delete mode 100644 net/minecraft/network/protocol/game/ClientboundSetCarriedItemPacket.java create mode 100644 net/minecraft/network/protocol/game/ClientboundSetCursorItemPacket.java create mode 100644 net/minecraft/network/protocol/game/ClientboundSetHeldSlotPacket.java create mode 100644 net/minecraft/network/protocol/game/ClientboundSetPlayerInventoryPacket.java create mode 100644 net/minecraft/network/protocol/game/ServerboundClientTickEndPacket.java create mode 100644 net/minecraft/network/protocol/game/ServerboundSelectBundleItemPacket.java delete mode 100644 net/minecraft/network/protocol/login/ClientboundGameProfilePacket.java create mode 100644 net/minecraft/network/protocol/login/ClientboundLoginFinishedPacket.java delete mode 100644 net/minecraft/realms/RealmsObjectSelectionList.java delete mode 100644 net/minecraft/recipebook/PlaceRecipe.java create mode 100644 net/minecraft/recipebook/PlaceRecipeHelper.java rename net/minecraft/{world/item/armortrim => references}/package-info.java (84%) create mode 100644 net/minecraft/resources/DependantName.java create mode 100644 net/minecraft/server/SuppressedExceptionCollector.java create mode 100644 net/minecraft/server/commands/LookAt.java create mode 100644 net/minecraft/server/commands/RotateCommand.java create mode 100644 net/minecraft/server/level/ChunkTaskDispatcher.java delete mode 100644 net/minecraft/server/level/ChunkTaskPriorityQueueSorter.java rename net/minecraft/{client => server/level}/ParticleStatus.java (57%) create mode 100644 net/minecraft/server/level/ServerEntityGetter.java create mode 100644 net/minecraft/server/level/ThrottlingChunkTaskDispatcher.java create mode 100644 net/minecraft/server/network/LegacyTextFilter.java create mode 100644 net/minecraft/server/network/PlayerSafetyServiceTextFilter.java create mode 100644 net/minecraft/server/network/ServerTextFilter.java delete mode 100644 net/minecraft/server/network/TextFilterClient.java delete mode 100644 net/minecraft/tags/TagManager.java create mode 100644 net/minecraft/util/ARGB.java create mode 100644 net/minecraft/util/BinaryAnimator.java delete mode 100644 net/minecraft/util/FastColor.java create mode 100644 net/minecraft/util/TickThrottler.java create mode 100644 net/minecraft/util/TriState.java create mode 100644 net/minecraft/util/context/ContextKey.java create mode 100644 net/minecraft/util/context/ContextKeySet.java create mode 100644 net/minecraft/util/context/ContextMap.java create mode 100644 net/minecraft/util/context/package-info.java create mode 100644 net/minecraft/util/datafix/fixes/AttributeIdPrefixFix.java create mode 100644 net/minecraft/util/datafix/fixes/AttributesRenameFix.java rename net/minecraft/util/datafix/fixes/{AttributesRename.java => AttributesRenameLegacy.java} (76%) create mode 100644 net/minecraft/util/datafix/fixes/BoatSplitFix.java create mode 100644 net/minecraft/util/datafix/fixes/CarvingStepRemoveFix.java create mode 100644 net/minecraft/util/datafix/fixes/ContainerBlockEntityLockPredicateFix.java create mode 100644 net/minecraft/util/datafix/fixes/FireResistantToDamageResistantComponentFix.java create mode 100644 net/minecraft/util/datafix/fixes/FoodToConsumableFix.java create mode 100644 net/minecraft/util/datafix/fixes/LockComponentPredicateFix.java create mode 100644 net/minecraft/util/datafix/fixes/OminousBannerRarityFix.java create mode 100644 net/minecraft/util/datafix/fixes/TrialSpawnerConfigInRegistryFix.java create mode 100644 net/minecraft/util/datafix/fixes/VillagerSetCanPickUpLootFix.java create mode 100644 net/minecraft/util/datafix/schemas/V4059.java create mode 100644 net/minecraft/util/datafix/schemas/V4067.java create mode 100644 net/minecraft/util/datafix/schemas/V4070.java create mode 100644 net/minecraft/util/datafix/schemas/V4071.java create mode 100644 net/minecraft/util/debugchart/package-info.java create mode 100644 net/minecraft/util/profiling/Profiler.java create mode 100644 net/minecraft/util/profiling/TracyZoneFiller.java create mode 100644 net/minecraft/util/profiling/Zone.java create mode 100644 net/minecraft/util/thread/AbstractConsecutiveExecutor.java create mode 100644 net/minecraft/util/thread/ConsecutiveExecutor.java create mode 100644 net/minecraft/util/thread/PriorityConsecutiveExecutor.java delete mode 100644 net/minecraft/util/thread/ProcessorHandle.java delete mode 100644 net/minecraft/util/thread/ProcessorMailbox.java create mode 100644 net/minecraft/util/thread/TaskScheduler.java delete mode 100644 net/minecraft/world/InteractionResultHolder.java delete mode 100644 net/minecraft/world/ItemInteractionResult.java create mode 100644 net/minecraft/world/entity/ConversionParams.java create mode 100644 net/minecraft/world/entity/ConversionType.java create mode 100644 net/minecraft/world/entity/ElytraAnimationState.java create mode 100644 net/minecraft/world/entity/EntitySpawnReason.java delete mode 100644 net/minecraft/world/entity/LerpingModel.java delete mode 100644 net/minecraft/world/entity/MobSpawnType.java create mode 100644 net/minecraft/world/entity/PositionMoveRotation.java delete mode 100644 net/minecraft/world/entity/PowerableMob.java create mode 100644 net/minecraft/world/entity/Relative.java delete mode 100644 net/minecraft/world/entity/RelativeMovement.java create mode 100644 net/minecraft/world/entity/animal/AgeableWaterCreature.java create mode 100644 net/minecraft/world/entity/boss/enderdragon/DragonFlightHistory.java create mode 100644 net/minecraft/world/entity/monster/creaking/Creaking.java create mode 100644 net/minecraft/world/entity/monster/creaking/CreakingAi.java create mode 100644 net/minecraft/world/entity/monster/creaking/CreakingTransient.java create mode 100644 net/minecraft/world/entity/monster/creaking/package-info.java create mode 100644 net/minecraft/world/entity/player/Input.java create mode 100644 net/minecraft/world/entity/player/StackedItemContents.java create mode 100644 net/minecraft/world/entity/projectile/windcharge/package-info.java create mode 100644 net/minecraft/world/entity/vehicle/AbstractBoat.java create mode 100644 net/minecraft/world/entity/vehicle/AbstractChestBoat.java create mode 100644 net/minecraft/world/entity/vehicle/ChestRaft.java create mode 100644 net/minecraft/world/entity/vehicle/MinecartBehavior.java create mode 100644 net/minecraft/world/entity/vehicle/NewMinecartBehavior.java create mode 100644 net/minecraft/world/entity/vehicle/OldMinecartBehavior.java create mode 100644 net/minecraft/world/entity/vehicle/Raft.java create mode 100644 net/minecraft/world/inventory/AbstractCraftingMenu.java delete mode 100644 net/minecraft/world/item/ArmorMaterial.java delete mode 100644 net/minecraft/world/item/ArmorMaterials.java delete mode 100644 net/minecraft/world/item/BookItem.java delete mode 100644 net/minecraft/world/item/ChorusFruitItem.java delete mode 100644 net/minecraft/world/item/ComplexItem.java delete mode 100644 net/minecraft/world/item/ElytraItem.java delete mode 100644 net/minecraft/world/item/EnchantedBookItem.java delete mode 100644 net/minecraft/world/item/Equipable.java delete mode 100644 net/minecraft/world/item/HoneyBottleItem.java delete mode 100644 net/minecraft/world/item/ItemNameBlockItem.java create mode 100644 net/minecraft/world/item/ItemUseAnimation.java delete mode 100644 net/minecraft/world/item/MilkBucketItem.java delete mode 100644 net/minecraft/world/item/OminousBottleItem.java delete mode 100644 net/minecraft/world/item/SuspiciousStewItem.java delete mode 100644 net/minecraft/world/item/Tier.java delete mode 100644 net/minecraft/world/item/TieredItem.java delete mode 100644 net/minecraft/world/item/Tiers.java create mode 100644 net/minecraft/world/item/ToolMaterial.java delete mode 100644 net/minecraft/world/item/UseAnim.java delete mode 100644 net/minecraft/world/item/armortrim/ArmorTrim.java delete mode 100644 net/minecraft/world/item/armortrim/TrimMaterials.java create mode 100644 net/minecraft/world/item/component/Consumable.java create mode 100644 net/minecraft/world/item/component/ConsumableListener.java create mode 100644 net/minecraft/world/item/component/Consumables.java create mode 100644 net/minecraft/world/item/component/DamageResistant.java create mode 100644 net/minecraft/world/item/component/DeathProtection.java create mode 100644 net/minecraft/world/item/component/OminousBottleAmplifier.java create mode 100644 net/minecraft/world/item/component/UseCooldown.java create mode 100644 net/minecraft/world/item/component/UseRemainder.java create mode 100644 net/minecraft/world/item/consume_effects/ApplyStatusEffectsConsumeEffect.java create mode 100644 net/minecraft/world/item/consume_effects/ClearAllStatusEffectsConsumeEffect.java create mode 100644 net/minecraft/world/item/consume_effects/ConsumeEffect.java create mode 100644 net/minecraft/world/item/consume_effects/PlaySoundConsumeEffect.java create mode 100644 net/minecraft/world/item/consume_effects/RemoveStatusEffectsConsumeEffect.java create mode 100644 net/minecraft/world/item/consume_effects/TeleportRandomlyConsumeEffect.java create mode 100644 net/minecraft/world/item/consume_effects/package-info.java create mode 100644 net/minecraft/world/item/crafting/ExtendedRecipeBookCategory.java create mode 100644 net/minecraft/world/item/crafting/PlacementInfo.java create mode 100644 net/minecraft/world/item/crafting/RecipeAccess.java create mode 100644 net/minecraft/world/item/crafting/RecipeBookCategories.java create mode 100644 net/minecraft/world/item/crafting/RecipeBookCategory.java create mode 100644 net/minecraft/world/item/crafting/RecipeMap.java create mode 100644 net/minecraft/world/item/crafting/RecipePropertySet.java create mode 100644 net/minecraft/world/item/crafting/SelectableRecipe.java delete mode 100644 net/minecraft/world/item/crafting/ShulkerBoxColoring.java delete mode 100644 net/minecraft/world/item/crafting/SimpleCookingSerializer.java delete mode 100644 net/minecraft/world/item/crafting/SimpleCraftingRecipeSerializer.java delete mode 100644 net/minecraft/world/item/crafting/SuspiciousStewRecipe.java create mode 100644 net/minecraft/world/item/crafting/TransmuteRecipe.java create mode 100644 net/minecraft/world/item/crafting/display/DisplayContentsFactory.java create mode 100644 net/minecraft/world/item/crafting/display/FurnaceRecipeDisplay.java create mode 100644 net/minecraft/world/item/crafting/display/RecipeDisplay.java create mode 100644 net/minecraft/world/item/crafting/display/RecipeDisplayEntry.java create mode 100644 net/minecraft/world/item/crafting/display/RecipeDisplayId.java create mode 100644 net/minecraft/world/item/crafting/display/RecipeDisplays.java create mode 100644 net/minecraft/world/item/crafting/display/ShapedCraftingRecipeDisplay.java create mode 100644 net/minecraft/world/item/crafting/display/ShapelessCraftingRecipeDisplay.java create mode 100644 net/minecraft/world/item/crafting/display/SlotDisplay.java create mode 100644 net/minecraft/world/item/crafting/display/SlotDisplayContext.java create mode 100644 net/minecraft/world/item/crafting/display/SlotDisplays.java create mode 100644 net/minecraft/world/item/crafting/display/SmithingRecipeDisplay.java create mode 100644 net/minecraft/world/item/crafting/display/StonecutterRecipeDisplay.java create mode 100644 net/minecraft/world/item/crafting/display/package-info.java create mode 100644 net/minecraft/world/item/enchantment/Enchantable.java create mode 100644 net/minecraft/world/item/enchantment/Repairable.java create mode 100644 net/minecraft/world/item/enchantment/effects/ChangeItemDamage.java delete mode 100644 net/minecraft/world/item/enchantment/effects/DamageItem.java create mode 100644 net/minecraft/world/item/equipment/ArmorMaterial.java create mode 100644 net/minecraft/world/item/equipment/ArmorMaterials.java create mode 100644 net/minecraft/world/item/equipment/ArmorType.java create mode 100644 net/minecraft/world/item/equipment/EquipmentModel.java create mode 100644 net/minecraft/world/item/equipment/EquipmentModels.java create mode 100644 net/minecraft/world/item/equipment/Equippable.java create mode 100644 net/minecraft/world/item/equipment/package-info.java create mode 100644 net/minecraft/world/item/equipment/trim/ArmorTrim.java rename net/minecraft/world/item/{armortrim => equipment/trim}/TrimMaterial.java (67%) create mode 100644 net/minecraft/world/item/equipment/trim/TrimMaterials.java rename net/minecraft/world/item/{armortrim => equipment/trim}/TrimPattern.java (82%) rename net/minecraft/world/item/{armortrim => equipment/trim}/TrimPatterns.java (51%) create mode 100644 net/minecraft/world/item/equipment/trim/package-info.java create mode 100644 net/minecraft/world/level/EmptyBlockAndTintGetter.java create mode 100644 net/minecraft/world/level/ScheduledTickAccess.java create mode 100644 net/minecraft/world/level/ServerExplosion.java rename net/minecraft/world/level/block/{MossBlock.java => BonemealableFeaturePlacerBlock.java} (52%) create mode 100644 net/minecraft/world/level/block/CreakingHeartBlock.java delete mode 100644 net/minecraft/world/level/block/EquipableCarvedPumpkinBlock.java create mode 100644 net/minecraft/world/level/block/HangingMossBlock.java create mode 100644 net/minecraft/world/level/block/MossyCarpetBlock.java create mode 100644 net/minecraft/world/level/block/entity/CreakingHeartBlockEntity.java create mode 100644 net/minecraft/world/level/block/entity/FuelValues.java create mode 100644 net/minecraft/world/level/block/entity/trialspawner/TrialSpawnerConfigs.java delete mode 100644 net/minecraft/world/level/block/state/properties/DirectionProperty.java delete mode 100644 net/minecraft/world/level/chunk/storage/ChunkSerializer.java create mode 100644 net/minecraft/world/level/chunk/storage/SerializableChunkData.java create mode 100644 net/minecraft/world/level/levelgen/feature/treedecorators/CreakingHeartDecorator.java create mode 100644 net/minecraft/world/level/levelgen/feature/treedecorators/PaleMossDecorator.java delete mode 100644 net/minecraft/world/level/levelgen/placement/CarvingMaskPlacement.java delete mode 100644 net/minecraft/world/level/portal/DimensionTransition.java create mode 100644 net/minecraft/world/level/portal/TeleportTransition.java create mode 100644 net/minecraft/world/level/redstone/DefaultRedstoneWireEvaluator.java create mode 100644 net/minecraft/world/level/redstone/ExperimentalRedstoneUtils.java create mode 100644 net/minecraft/world/level/redstone/ExperimentalRedstoneWireEvaluator.java create mode 100644 net/minecraft/world/level/redstone/Orientation.java create mode 100644 net/minecraft/world/level/redstone/RedstoneWireEvaluator.java delete mode 100644 net/minecraft/world/level/storage/loot/parameters/LootContextParam.java delete mode 100644 net/minecraft/world/level/storage/loot/parameters/LootContextParamSet.java create mode 100644 net/minecraft/world/phys/shapes/MinecartCollisionContext.java diff --git a/assets/minecraft/atlases/armor_trims.json b/assets/minecraft/atlases/armor_trims.json index 74f41956..149d65a8 100644 --- a/assets/minecraft/atlases/armor_trims.json +++ b/assets/minecraft/atlases/armor_trims.json @@ -3,42 +3,42 @@ { "type": "paletted_permutations", "textures": [ - "trims/models/armor/coast", - "trims/models/armor/coast_leggings", - "trims/models/armor/sentry", - "trims/models/armor/sentry_leggings", - "trims/models/armor/dune", - "trims/models/armor/dune_leggings", - "trims/models/armor/wild", - "trims/models/armor/wild_leggings", - "trims/models/armor/ward", - "trims/models/armor/ward_leggings", - "trims/models/armor/eye", - "trims/models/armor/eye_leggings", - "trims/models/armor/vex", - "trims/models/armor/vex_leggings", - "trims/models/armor/tide", - "trims/models/armor/tide_leggings", - "trims/models/armor/snout", - "trims/models/armor/snout_leggings", - "trims/models/armor/rib", - "trims/models/armor/rib_leggings", - "trims/models/armor/spire", - "trims/models/armor/spire_leggings", - "trims/models/armor/wayfinder", - "trims/models/armor/wayfinder_leggings", - "trims/models/armor/shaper", - "trims/models/armor/shaper_leggings", - "trims/models/armor/silence", - "trims/models/armor/silence_leggings", - "trims/models/armor/raiser", - "trims/models/armor/raiser_leggings", - "trims/models/armor/host", - "trims/models/armor/host_leggings", - "trims/models/armor/flow", - "trims/models/armor/flow_leggings", - "trims/models/armor/bolt", - "trims/models/armor/bolt_leggings" + "trims/entity/humanoid/coast", + "trims/entity/humanoid_leggings/coast", + "trims/entity/humanoid/sentry", + "trims/entity/humanoid_leggings/sentry", + "trims/entity/humanoid/dune", + "trims/entity/humanoid_leggings/dune", + "trims/entity/humanoid/wild", + "trims/entity/humanoid_leggings/wild", + "trims/entity/humanoid/ward", + "trims/entity/humanoid_leggings/ward", + "trims/entity/humanoid/eye", + "trims/entity/humanoid_leggings/eye", + "trims/entity/humanoid/vex", + "trims/entity/humanoid_leggings/vex", + "trims/entity/humanoid/tide", + "trims/entity/humanoid_leggings/tide", + "trims/entity/humanoid/snout", + "trims/entity/humanoid_leggings/snout", + "trims/entity/humanoid/rib", + "trims/entity/humanoid_leggings/rib", + "trims/entity/humanoid/spire", + "trims/entity/humanoid_leggings/spire", + "trims/entity/humanoid/wayfinder", + "trims/entity/humanoid_leggings/wayfinder", + "trims/entity/humanoid/shaper", + "trims/entity/humanoid_leggings/shaper", + "trims/entity/humanoid/silence", + "trims/entity/humanoid_leggings/silence", + "trims/entity/humanoid/raiser", + "trims/entity/humanoid_leggings/raiser", + "trims/entity/humanoid/host", + "trims/entity/humanoid_leggings/host", + "trims/entity/humanoid/flow", + "trims/entity/humanoid_leggings/flow", + "trims/entity/humanoid/bolt", + "trims/entity/humanoid_leggings/bolt" ], "palette_key": "trims/color_palettes/trim_palette", "permutations": { diff --git a/assets/minecraft/blockstates/bee_nest.json b/assets/minecraft/blockstates/bee_nest.json index 0f9836da..d76bd009 100644 --- a/assets/minecraft/blockstates/bee_nest.json +++ b/assets/minecraft/blockstates/bee_nest.json @@ -1,23 +1,23 @@ { "variants": { "facing=east,honey_level=0": { - "model": "minecraft:block/bee_nest", + "model": "minecraft:block/bee_nest_empty", "y": 90 }, "facing=east,honey_level=1": { - "model": "minecraft:block/bee_nest", + "model": "minecraft:block/bee_nest_empty", "y": 90 }, "facing=east,honey_level=2": { - "model": "minecraft:block/bee_nest", + "model": "minecraft:block/bee_nest_empty", "y": 90 }, "facing=east,honey_level=3": { - "model": "minecraft:block/bee_nest", + "model": "minecraft:block/bee_nest_empty", "y": 90 }, "facing=east,honey_level=4": { - "model": "minecraft:block/bee_nest", + "model": "minecraft:block/bee_nest_empty", "y": 90 }, "facing=east,honey_level=5": { @@ -25,41 +25,41 @@ "y": 90 }, "facing=north,honey_level=0": { - "model": "minecraft:block/bee_nest" + "model": "minecraft:block/bee_nest_empty" }, "facing=north,honey_level=1": { - "model": "minecraft:block/bee_nest" + "model": "minecraft:block/bee_nest_empty" }, "facing=north,honey_level=2": { - "model": "minecraft:block/bee_nest" + "model": "minecraft:block/bee_nest_empty" }, "facing=north,honey_level=3": { - "model": "minecraft:block/bee_nest" + "model": "minecraft:block/bee_nest_empty" }, "facing=north,honey_level=4": { - "model": "minecraft:block/bee_nest" + "model": "minecraft:block/bee_nest_empty" }, "facing=north,honey_level=5": { "model": "minecraft:block/bee_nest_honey" }, "facing=south,honey_level=0": { - "model": "minecraft:block/bee_nest", + "model": "minecraft:block/bee_nest_empty", "y": 180 }, "facing=south,honey_level=1": { - "model": "minecraft:block/bee_nest", + "model": "minecraft:block/bee_nest_empty", "y": 180 }, "facing=south,honey_level=2": { - "model": "minecraft:block/bee_nest", + "model": "minecraft:block/bee_nest_empty", "y": 180 }, "facing=south,honey_level=3": { - "model": "minecraft:block/bee_nest", + "model": "minecraft:block/bee_nest_empty", "y": 180 }, "facing=south,honey_level=4": { - "model": "minecraft:block/bee_nest", + "model": "minecraft:block/bee_nest_empty", "y": 180 }, "facing=south,honey_level=5": { @@ -67,23 +67,23 @@ "y": 180 }, "facing=west,honey_level=0": { - "model": "minecraft:block/bee_nest", + "model": "minecraft:block/bee_nest_empty", "y": 270 }, "facing=west,honey_level=1": { - "model": "minecraft:block/bee_nest", + "model": "minecraft:block/bee_nest_empty", "y": 270 }, "facing=west,honey_level=2": { - "model": "minecraft:block/bee_nest", + "model": "minecraft:block/bee_nest_empty", "y": 270 }, "facing=west,honey_level=3": { - "model": "minecraft:block/bee_nest", + "model": "minecraft:block/bee_nest_empty", "y": 270 }, "facing=west,honey_level=4": { - "model": "minecraft:block/bee_nest", + "model": "minecraft:block/bee_nest_empty", "y": 270 }, "facing=west,honey_level=5": { diff --git a/assets/minecraft/blockstates/beehive.json b/assets/minecraft/blockstates/beehive.json index f39b70b4..cebaa777 100644 --- a/assets/minecraft/blockstates/beehive.json +++ b/assets/minecraft/blockstates/beehive.json @@ -1,23 +1,23 @@ { "variants": { "facing=east,honey_level=0": { - "model": "minecraft:block/beehive", + "model": "minecraft:block/beehive_empty", "y": 90 }, "facing=east,honey_level=1": { - "model": "minecraft:block/beehive", + "model": "minecraft:block/beehive_empty", "y": 90 }, "facing=east,honey_level=2": { - "model": "minecraft:block/beehive", + "model": "minecraft:block/beehive_empty", "y": 90 }, "facing=east,honey_level=3": { - "model": "minecraft:block/beehive", + "model": "minecraft:block/beehive_empty", "y": 90 }, "facing=east,honey_level=4": { - "model": "minecraft:block/beehive", + "model": "minecraft:block/beehive_empty", "y": 90 }, "facing=east,honey_level=5": { @@ -25,41 +25,41 @@ "y": 90 }, "facing=north,honey_level=0": { - "model": "minecraft:block/beehive" + "model": "minecraft:block/beehive_empty" }, "facing=north,honey_level=1": { - "model": "minecraft:block/beehive" + "model": "minecraft:block/beehive_empty" }, "facing=north,honey_level=2": { - "model": "minecraft:block/beehive" + "model": "minecraft:block/beehive_empty" }, "facing=north,honey_level=3": { - "model": "minecraft:block/beehive" + "model": "minecraft:block/beehive_empty" }, "facing=north,honey_level=4": { - "model": "minecraft:block/beehive" + "model": "minecraft:block/beehive_empty" }, "facing=north,honey_level=5": { "model": "minecraft:block/beehive_honey" }, "facing=south,honey_level=0": { - "model": "minecraft:block/beehive", + "model": "minecraft:block/beehive_empty", "y": 180 }, "facing=south,honey_level=1": { - "model": "minecraft:block/beehive", + "model": "minecraft:block/beehive_empty", "y": 180 }, "facing=south,honey_level=2": { - "model": "minecraft:block/beehive", + "model": "minecraft:block/beehive_empty", "y": 180 }, "facing=south,honey_level=3": { - "model": "minecraft:block/beehive", + "model": "minecraft:block/beehive_empty", "y": 180 }, "facing=south,honey_level=4": { - "model": "minecraft:block/beehive", + "model": "minecraft:block/beehive_empty", "y": 180 }, "facing=south,honey_level=5": { @@ -67,23 +67,23 @@ "y": 180 }, "facing=west,honey_level=0": { - "model": "minecraft:block/beehive", + "model": "minecraft:block/beehive_empty", "y": 270 }, "facing=west,honey_level=1": { - "model": "minecraft:block/beehive", + "model": "minecraft:block/beehive_empty", "y": 270 }, "facing=west,honey_level=2": { - "model": "minecraft:block/beehive", + "model": "minecraft:block/beehive_empty", "y": 270 }, "facing=west,honey_level=3": { - "model": "minecraft:block/beehive", + "model": "minecraft:block/beehive_empty", "y": 270 }, "facing=west,honey_level=4": { - "model": "minecraft:block/beehive", + "model": "minecraft:block/beehive_empty", "y": 270 }, "facing=west,honey_level=5": { diff --git a/assets/minecraft/blockstates/creaking_heart.json b/assets/minecraft/blockstates/creaking_heart.json new file mode 100644 index 00000000..5eb05dda --- /dev/null +++ b/assets/minecraft/blockstates/creaking_heart.json @@ -0,0 +1,40 @@ +{ + "variants": { + "axis=x,creaking=active": { + "model": "minecraft:block/creaking_heart_active_horizontal", + "x": 90, + "y": 90 + }, + "axis=x,creaking=disabled": { + "model": "minecraft:block/creaking_heart_horizontal", + "x": 90, + "y": 90 + }, + "axis=x,creaking=dormant": { + "model": "minecraft:block/creaking_heart_active_horizontal", + "x": 90, + "y": 90 + }, + "axis=y,creaking=active": { + "model": "minecraft:block/creaking_heart_active" + }, + "axis=y,creaking=disabled": { + "model": "minecraft:block/creaking_heart" + }, + "axis=y,creaking=dormant": { + "model": "minecraft:block/creaking_heart_active" + }, + "axis=z,creaking=active": { + "model": "minecraft:block/creaking_heart_active_horizontal", + "x": 90 + }, + "axis=z,creaking=disabled": { + "model": "minecraft:block/creaking_heart_horizontal", + "x": 90 + }, + "axis=z,creaking=dormant": { + "model": "minecraft:block/creaking_heart_active_horizontal", + "x": 90 + } + } +} \ No newline at end of file diff --git a/assets/minecraft/blockstates/pale_hanging_moss.json b/assets/minecraft/blockstates/pale_hanging_moss.json new file mode 100644 index 00000000..932d0908 --- /dev/null +++ b/assets/minecraft/blockstates/pale_hanging_moss.json @@ -0,0 +1,10 @@ +{ + "variants": { + "tip=false": { + "model": "minecraft:block/pale_hanging_moss" + }, + "tip=true": { + "model": "minecraft:block/pale_hanging_moss_tip" + } + } +} \ No newline at end of file diff --git a/assets/minecraft/blockstates/pale_moss_block.json b/assets/minecraft/blockstates/pale_moss_block.json new file mode 100644 index 00000000..046db23c --- /dev/null +++ b/assets/minecraft/blockstates/pale_moss_block.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "minecraft:block/pale_moss_block" + } + } +} \ No newline at end of file diff --git a/assets/minecraft/blockstates/pale_moss_carpet.json b/assets/minecraft/blockstates/pale_moss_carpet.json new file mode 100644 index 00000000..1fd7b845 --- /dev/null +++ b/assets/minecraft/blockstates/pale_moss_carpet.json @@ -0,0 +1,154 @@ +{ + "multipart": [ + { + "apply": { + "model": "minecraft:block/pale_moss_carpet" + }, + "when": { + "bottom": "true" + } + }, + { + "apply": { + "model": "minecraft:block/pale_moss_carpet" + }, + "when": { + "bottom": "false", + "east": "none", + "north": "none", + "south": "none", + "west": "none" + } + }, + { + "apply": { + "model": "minecraft:block/pale_moss_carpet_side_tall" + }, + "when": { + "north": "tall" + } + }, + { + "apply": { + "model": "minecraft:block/pale_moss_carpet_side_small" + }, + "when": { + "north": "low" + } + }, + { + "apply": { + "model": "minecraft:block/pale_moss_carpet_side_tall" + }, + "when": { + "bottom": "false", + "east": "none", + "north": "none", + "south": "none", + "west": "none" + } + }, + { + "apply": { + "model": "minecraft:block/pale_moss_carpet_side_tall", + "uvlock": true, + "y": 90 + }, + "when": { + "east": "tall" + } + }, + { + "apply": { + "model": "minecraft:block/pale_moss_carpet_side_small", + "uvlock": true, + "y": 90 + }, + "when": { + "east": "low" + } + }, + { + "apply": { + "model": "minecraft:block/pale_moss_carpet_side_tall", + "uvlock": true, + "y": 90 + }, + "when": { + "bottom": "false", + "east": "none", + "north": "none", + "south": "none", + "west": "none" + } + }, + { + "apply": { + "model": "minecraft:block/pale_moss_carpet_side_tall", + "uvlock": true, + "y": 180 + }, + "when": { + "south": "tall" + } + }, + { + "apply": { + "model": "minecraft:block/pale_moss_carpet_side_small", + "uvlock": true, + "y": 180 + }, + "when": { + "south": "low" + } + }, + { + "apply": { + "model": "minecraft:block/pale_moss_carpet_side_tall", + "uvlock": true, + "y": 180 + }, + "when": { + "bottom": "false", + "east": "none", + "north": "none", + "south": "none", + "west": "none" + } + }, + { + "apply": { + "model": "minecraft:block/pale_moss_carpet_side_tall", + "uvlock": true, + "y": 270 + }, + "when": { + "west": "tall" + } + }, + { + "apply": { + "model": "minecraft:block/pale_moss_carpet_side_small", + "uvlock": true, + "y": 270 + }, + "when": { + "west": "low" + } + }, + { + "apply": { + "model": "minecraft:block/pale_moss_carpet_side_tall", + "uvlock": true, + "y": 270 + }, + "when": { + "bottom": "false", + "east": "none", + "north": "none", + "south": "none", + "west": "none" + } + } + ] +} \ No newline at end of file diff --git a/assets/minecraft/blockstates/pale_oak_button.json b/assets/minecraft/blockstates/pale_oak_button.json new file mode 100644 index 00000000..9179ab89 --- /dev/null +++ b/assets/minecraft/blockstates/pale_oak_button.json @@ -0,0 +1,118 @@ +{ + "variants": { + "face=ceiling,facing=east,powered=false": { + "model": "minecraft:block/pale_oak_button", + "x": 180, + "y": 270 + }, + "face=ceiling,facing=east,powered=true": { + "model": "minecraft:block/pale_oak_button_pressed", + "x": 180, + "y": 270 + }, + "face=ceiling,facing=north,powered=false": { + "model": "minecraft:block/pale_oak_button", + "x": 180, + "y": 180 + }, + "face=ceiling,facing=north,powered=true": { + "model": "minecraft:block/pale_oak_button_pressed", + "x": 180, + "y": 180 + }, + "face=ceiling,facing=south,powered=false": { + "model": "minecraft:block/pale_oak_button", + "x": 180 + }, + "face=ceiling,facing=south,powered=true": { + "model": "minecraft:block/pale_oak_button_pressed", + "x": 180 + }, + "face=ceiling,facing=west,powered=false": { + "model": "minecraft:block/pale_oak_button", + "x": 180, + "y": 90 + }, + "face=ceiling,facing=west,powered=true": { + "model": "minecraft:block/pale_oak_button_pressed", + "x": 180, + "y": 90 + }, + "face=floor,facing=east,powered=false": { + "model": "minecraft:block/pale_oak_button", + "y": 90 + }, + "face=floor,facing=east,powered=true": { + "model": "minecraft:block/pale_oak_button_pressed", + "y": 90 + }, + "face=floor,facing=north,powered=false": { + "model": "minecraft:block/pale_oak_button" + }, + "face=floor,facing=north,powered=true": { + "model": "minecraft:block/pale_oak_button_pressed" + }, + "face=floor,facing=south,powered=false": { + "model": "minecraft:block/pale_oak_button", + "y": 180 + }, + "face=floor,facing=south,powered=true": { + "model": "minecraft:block/pale_oak_button_pressed", + "y": 180 + }, + "face=floor,facing=west,powered=false": { + "model": "minecraft:block/pale_oak_button", + "y": 270 + }, + "face=floor,facing=west,powered=true": { + "model": "minecraft:block/pale_oak_button_pressed", + "y": 270 + }, + "face=wall,facing=east,powered=false": { + "model": "minecraft:block/pale_oak_button", + "uvlock": true, + "x": 90, + "y": 90 + }, + "face=wall,facing=east,powered=true": { + "model": "minecraft:block/pale_oak_button_pressed", + "uvlock": true, + "x": 90, + "y": 90 + }, + "face=wall,facing=north,powered=false": { + "model": "minecraft:block/pale_oak_button", + "uvlock": true, + "x": 90 + }, + "face=wall,facing=north,powered=true": { + "model": "minecraft:block/pale_oak_button_pressed", + "uvlock": true, + "x": 90 + }, + "face=wall,facing=south,powered=false": { + "model": "minecraft:block/pale_oak_button", + "uvlock": true, + "x": 90, + "y": 180 + }, + "face=wall,facing=south,powered=true": { + "model": "minecraft:block/pale_oak_button_pressed", + "uvlock": true, + "x": 90, + "y": 180 + }, + "face=wall,facing=west,powered=false": { + "model": "minecraft:block/pale_oak_button", + "uvlock": true, + "x": 90, + "y": 270 + }, + "face=wall,facing=west,powered=true": { + "model": "minecraft:block/pale_oak_button_pressed", + "uvlock": true, + "x": 90, + "y": 270 + } + } +} \ No newline at end of file diff --git a/assets/minecraft/blockstates/pale_oak_door.json b/assets/minecraft/blockstates/pale_oak_door.json new file mode 100644 index 00000000..f642a798 --- /dev/null +++ b/assets/minecraft/blockstates/pale_oak_door.json @@ -0,0 +1,124 @@ +{ + "variants": { + "facing=east,half=lower,hinge=left,open=false": { + "model": "minecraft:block/pale_oak_door_bottom_left" + }, + "facing=east,half=lower,hinge=left,open=true": { + "model": "minecraft:block/pale_oak_door_bottom_left_open", + "y": 90 + }, + "facing=east,half=lower,hinge=right,open=false": { + "model": "minecraft:block/pale_oak_door_bottom_right" + }, + "facing=east,half=lower,hinge=right,open=true": { + "model": "minecraft:block/pale_oak_door_bottom_right_open", + "y": 270 + }, + "facing=east,half=upper,hinge=left,open=false": { + "model": "minecraft:block/pale_oak_door_top_left" + }, + "facing=east,half=upper,hinge=left,open=true": { + "model": "minecraft:block/pale_oak_door_top_left_open", + "y": 90 + }, + "facing=east,half=upper,hinge=right,open=false": { + "model": "minecraft:block/pale_oak_door_top_right" + }, + "facing=east,half=upper,hinge=right,open=true": { + "model": "minecraft:block/pale_oak_door_top_right_open", + "y": 270 + }, + "facing=north,half=lower,hinge=left,open=false": { + "model": "minecraft:block/pale_oak_door_bottom_left", + "y": 270 + }, + "facing=north,half=lower,hinge=left,open=true": { + "model": "minecraft:block/pale_oak_door_bottom_left_open" + }, + "facing=north,half=lower,hinge=right,open=false": { + "model": "minecraft:block/pale_oak_door_bottom_right", + "y": 270 + }, + "facing=north,half=lower,hinge=right,open=true": { + "model": "minecraft:block/pale_oak_door_bottom_right_open", + "y": 180 + }, + "facing=north,half=upper,hinge=left,open=false": { + "model": "minecraft:block/pale_oak_door_top_left", + "y": 270 + }, + "facing=north,half=upper,hinge=left,open=true": { + "model": "minecraft:block/pale_oak_door_top_left_open" + }, + "facing=north,half=upper,hinge=right,open=false": { + "model": "minecraft:block/pale_oak_door_top_right", + "y": 270 + }, + "facing=north,half=upper,hinge=right,open=true": { + "model": "minecraft:block/pale_oak_door_top_right_open", + "y": 180 + }, + "facing=south,half=lower,hinge=left,open=false": { + "model": "minecraft:block/pale_oak_door_bottom_left", + "y": 90 + }, + "facing=south,half=lower,hinge=left,open=true": { + "model": "minecraft:block/pale_oak_door_bottom_left_open", + "y": 180 + }, + "facing=south,half=lower,hinge=right,open=false": { + "model": "minecraft:block/pale_oak_door_bottom_right", + "y": 90 + }, + "facing=south,half=lower,hinge=right,open=true": { + "model": "minecraft:block/pale_oak_door_bottom_right_open" + }, + "facing=south,half=upper,hinge=left,open=false": { + "model": "minecraft:block/pale_oak_door_top_left", + "y": 90 + }, + "facing=south,half=upper,hinge=left,open=true": { + "model": "minecraft:block/pale_oak_door_top_left_open", + "y": 180 + }, + "facing=south,half=upper,hinge=right,open=false": { + "model": "minecraft:block/pale_oak_door_top_right", + "y": 90 + }, + "facing=south,half=upper,hinge=right,open=true": { + "model": "minecraft:block/pale_oak_door_top_right_open" + }, + "facing=west,half=lower,hinge=left,open=false": { + "model": "minecraft:block/pale_oak_door_bottom_left", + "y": 180 + }, + "facing=west,half=lower,hinge=left,open=true": { + "model": "minecraft:block/pale_oak_door_bottom_left_open", + "y": 270 + }, + "facing=west,half=lower,hinge=right,open=false": { + "model": "minecraft:block/pale_oak_door_bottom_right", + "y": 180 + }, + "facing=west,half=lower,hinge=right,open=true": { + "model": "minecraft:block/pale_oak_door_bottom_right_open", + "y": 90 + }, + "facing=west,half=upper,hinge=left,open=false": { + "model": "minecraft:block/pale_oak_door_top_left", + "y": 180 + }, + "facing=west,half=upper,hinge=left,open=true": { + "model": "minecraft:block/pale_oak_door_top_left_open", + "y": 270 + }, + "facing=west,half=upper,hinge=right,open=false": { + "model": "minecraft:block/pale_oak_door_top_right", + "y": 180 + }, + "facing=west,half=upper,hinge=right,open=true": { + "model": "minecraft:block/pale_oak_door_top_right_open", + "y": 90 + } + } +} \ No newline at end of file diff --git a/assets/minecraft/blockstates/pale_oak_fence.json b/assets/minecraft/blockstates/pale_oak_fence.json new file mode 100644 index 00000000..76960957 --- /dev/null +++ b/assets/minecraft/blockstates/pale_oak_fence.json @@ -0,0 +1,48 @@ +{ + "multipart": [ + { + "apply": { + "model": "minecraft:block/pale_oak_fence_post" + } + }, + { + "apply": { + "model": "minecraft:block/pale_oak_fence_side", + "uvlock": true + }, + "when": { + "north": "true" + } + }, + { + "apply": { + "model": "minecraft:block/pale_oak_fence_side", + "uvlock": true, + "y": 90 + }, + "when": { + "east": "true" + } + }, + { + "apply": { + "model": "minecraft:block/pale_oak_fence_side", + "uvlock": true, + "y": 180 + }, + "when": { + "south": "true" + } + }, + { + "apply": { + "model": "minecraft:block/pale_oak_fence_side", + "uvlock": true, + "y": 270 + }, + "when": { + "west": "true" + } + } + ] +} \ No newline at end of file diff --git a/assets/minecraft/blockstates/pale_oak_fence_gate.json b/assets/minecraft/blockstates/pale_oak_fence_gate.json new file mode 100644 index 00000000..dbdc769e --- /dev/null +++ b/assets/minecraft/blockstates/pale_oak_fence_gate.json @@ -0,0 +1,80 @@ +{ + "variants": { + "facing=east,in_wall=false,open=false": { + "model": "minecraft:block/pale_oak_fence_gate", + "uvlock": true, + "y": 270 + }, + "facing=east,in_wall=false,open=true": { + "model": "minecraft:block/pale_oak_fence_gate_open", + "uvlock": true, + "y": 270 + }, + "facing=east,in_wall=true,open=false": { + "model": "minecraft:block/pale_oak_fence_gate_wall", + "uvlock": true, + "y": 270 + }, + "facing=east,in_wall=true,open=true": { + "model": "minecraft:block/pale_oak_fence_gate_wall_open", + "uvlock": true, + "y": 270 + }, + "facing=north,in_wall=false,open=false": { + "model": "minecraft:block/pale_oak_fence_gate", + "uvlock": true, + "y": 180 + }, + "facing=north,in_wall=false,open=true": { + "model": "minecraft:block/pale_oak_fence_gate_open", + "uvlock": true, + "y": 180 + }, + "facing=north,in_wall=true,open=false": { + "model": "minecraft:block/pale_oak_fence_gate_wall", + "uvlock": true, + "y": 180 + }, + "facing=north,in_wall=true,open=true": { + "model": "minecraft:block/pale_oak_fence_gate_wall_open", + "uvlock": true, + "y": 180 + }, + "facing=south,in_wall=false,open=false": { + "model": "minecraft:block/pale_oak_fence_gate", + "uvlock": true + }, + "facing=south,in_wall=false,open=true": { + "model": "minecraft:block/pale_oak_fence_gate_open", + "uvlock": true + }, + "facing=south,in_wall=true,open=false": { + "model": "minecraft:block/pale_oak_fence_gate_wall", + "uvlock": true + }, + "facing=south,in_wall=true,open=true": { + "model": "minecraft:block/pale_oak_fence_gate_wall_open", + "uvlock": true + }, + "facing=west,in_wall=false,open=false": { + "model": "minecraft:block/pale_oak_fence_gate", + "uvlock": true, + "y": 90 + }, + "facing=west,in_wall=false,open=true": { + "model": "minecraft:block/pale_oak_fence_gate_open", + "uvlock": true, + "y": 90 + }, + "facing=west,in_wall=true,open=false": { + "model": "minecraft:block/pale_oak_fence_gate_wall", + "uvlock": true, + "y": 90 + }, + "facing=west,in_wall=true,open=true": { + "model": "minecraft:block/pale_oak_fence_gate_wall_open", + "uvlock": true, + "y": 90 + } + } +} \ No newline at end of file diff --git a/assets/minecraft/blockstates/pale_oak_hanging_sign.json b/assets/minecraft/blockstates/pale_oak_hanging_sign.json new file mode 100644 index 00000000..bde6deba --- /dev/null +++ b/assets/minecraft/blockstates/pale_oak_hanging_sign.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "minecraft:block/pale_oak_hanging_sign" + } + } +} \ No newline at end of file diff --git a/assets/minecraft/blockstates/pale_oak_leaves.json b/assets/minecraft/blockstates/pale_oak_leaves.json new file mode 100644 index 00000000..8de6861a --- /dev/null +++ b/assets/minecraft/blockstates/pale_oak_leaves.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "minecraft:block/pale_oak_leaves" + } + } +} \ No newline at end of file diff --git a/assets/minecraft/blockstates/pale_oak_log.json b/assets/minecraft/blockstates/pale_oak_log.json new file mode 100644 index 00000000..9b2d759a --- /dev/null +++ b/assets/minecraft/blockstates/pale_oak_log.json @@ -0,0 +1,16 @@ +{ + "variants": { + "axis=x": { + "model": "minecraft:block/pale_oak_log_horizontal", + "x": 90, + "y": 90 + }, + "axis=y": { + "model": "minecraft:block/pale_oak_log" + }, + "axis=z": { + "model": "minecraft:block/pale_oak_log_horizontal", + "x": 90 + } + } +} \ No newline at end of file diff --git a/assets/minecraft/blockstates/pale_oak_planks.json b/assets/minecraft/blockstates/pale_oak_planks.json new file mode 100644 index 00000000..b9fca1f3 --- /dev/null +++ b/assets/minecraft/blockstates/pale_oak_planks.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "minecraft:block/pale_oak_planks" + } + } +} \ No newline at end of file diff --git a/assets/minecraft/blockstates/pale_oak_pressure_plate.json b/assets/minecraft/blockstates/pale_oak_pressure_plate.json new file mode 100644 index 00000000..78576b30 --- /dev/null +++ b/assets/minecraft/blockstates/pale_oak_pressure_plate.json @@ -0,0 +1,10 @@ +{ + "variants": { + "powered=false": { + "model": "minecraft:block/pale_oak_pressure_plate" + }, + "powered=true": { + "model": "minecraft:block/pale_oak_pressure_plate_down" + } + } +} \ No newline at end of file diff --git a/assets/minecraft/blockstates/pale_oak_sapling.json b/assets/minecraft/blockstates/pale_oak_sapling.json new file mode 100644 index 00000000..45c2673a --- /dev/null +++ b/assets/minecraft/blockstates/pale_oak_sapling.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "minecraft:block/pale_oak_sapling" + } + } +} \ No newline at end of file diff --git a/assets/minecraft/blockstates/pale_oak_sign.json b/assets/minecraft/blockstates/pale_oak_sign.json new file mode 100644 index 00000000..be6f9eb8 --- /dev/null +++ b/assets/minecraft/blockstates/pale_oak_sign.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "minecraft:block/pale_oak_sign" + } + } +} \ No newline at end of file diff --git a/assets/minecraft/blockstates/pale_oak_slab.json b/assets/minecraft/blockstates/pale_oak_slab.json new file mode 100644 index 00000000..91ad3cca --- /dev/null +++ b/assets/minecraft/blockstates/pale_oak_slab.json @@ -0,0 +1,13 @@ +{ + "variants": { + "type=bottom": { + "model": "minecraft:block/pale_oak_slab" + }, + "type=double": { + "model": "minecraft:block/pale_oak_planks" + }, + "type=top": { + "model": "minecraft:block/pale_oak_slab_top" + } + } +} \ No newline at end of file diff --git a/assets/minecraft/blockstates/pale_oak_stairs.json b/assets/minecraft/blockstates/pale_oak_stairs.json new file mode 100644 index 00000000..a9124eaf --- /dev/null +++ b/assets/minecraft/blockstates/pale_oak_stairs.json @@ -0,0 +1,209 @@ +{ + "variants": { + "facing=east,half=bottom,shape=inner_left": { + "model": "minecraft:block/pale_oak_stairs_inner", + "uvlock": true, + "y": 270 + }, + "facing=east,half=bottom,shape=inner_right": { + "model": "minecraft:block/pale_oak_stairs_inner" + }, + "facing=east,half=bottom,shape=outer_left": { + "model": "minecraft:block/pale_oak_stairs_outer", + "uvlock": true, + "y": 270 + }, + "facing=east,half=bottom,shape=outer_right": { + "model": "minecraft:block/pale_oak_stairs_outer" + }, + "facing=east,half=bottom,shape=straight": { + "model": "minecraft:block/pale_oak_stairs" + }, + "facing=east,half=top,shape=inner_left": { + "model": "minecraft:block/pale_oak_stairs_inner", + "uvlock": true, + "x": 180 + }, + "facing=east,half=top,shape=inner_right": { + "model": "minecraft:block/pale_oak_stairs_inner", + "uvlock": true, + "x": 180, + "y": 90 + }, + "facing=east,half=top,shape=outer_left": { + "model": "minecraft:block/pale_oak_stairs_outer", + "uvlock": true, + "x": 180 + }, + "facing=east,half=top,shape=outer_right": { + "model": "minecraft:block/pale_oak_stairs_outer", + "uvlock": true, + "x": 180, + "y": 90 + }, + "facing=east,half=top,shape=straight": { + "model": "minecraft:block/pale_oak_stairs", + "uvlock": true, + "x": 180 + }, + "facing=north,half=bottom,shape=inner_left": { + "model": "minecraft:block/pale_oak_stairs_inner", + "uvlock": true, + "y": 180 + }, + "facing=north,half=bottom,shape=inner_right": { + "model": "minecraft:block/pale_oak_stairs_inner", + "uvlock": true, + "y": 270 + }, + "facing=north,half=bottom,shape=outer_left": { + "model": "minecraft:block/pale_oak_stairs_outer", + "uvlock": true, + "y": 180 + }, + "facing=north,half=bottom,shape=outer_right": { + "model": "minecraft:block/pale_oak_stairs_outer", + "uvlock": true, + "y": 270 + }, + "facing=north,half=bottom,shape=straight": { + "model": "minecraft:block/pale_oak_stairs", + "uvlock": true, + "y": 270 + }, + "facing=north,half=top,shape=inner_left": { + "model": "minecraft:block/pale_oak_stairs_inner", + "uvlock": true, + "x": 180, + "y": 270 + }, + "facing=north,half=top,shape=inner_right": { + "model": "minecraft:block/pale_oak_stairs_inner", + "uvlock": true, + "x": 180 + }, + "facing=north,half=top,shape=outer_left": { + "model": "minecraft:block/pale_oak_stairs_outer", + "uvlock": true, + "x": 180, + "y": 270 + }, + "facing=north,half=top,shape=outer_right": { + "model": "minecraft:block/pale_oak_stairs_outer", + "uvlock": true, + "x": 180 + }, + "facing=north,half=top,shape=straight": { + "model": "minecraft:block/pale_oak_stairs", + "uvlock": true, + "x": 180, + "y": 270 + }, + "facing=south,half=bottom,shape=inner_left": { + "model": "minecraft:block/pale_oak_stairs_inner" + }, + "facing=south,half=bottom,shape=inner_right": { + "model": "minecraft:block/pale_oak_stairs_inner", + "uvlock": true, + "y": 90 + }, + "facing=south,half=bottom,shape=outer_left": { + "model": "minecraft:block/pale_oak_stairs_outer" + }, + "facing=south,half=bottom,shape=outer_right": { + "model": "minecraft:block/pale_oak_stairs_outer", + "uvlock": true, + "y": 90 + }, + "facing=south,half=bottom,shape=straight": { + "model": "minecraft:block/pale_oak_stairs", + "uvlock": true, + "y": 90 + }, + "facing=south,half=top,shape=inner_left": { + "model": "minecraft:block/pale_oak_stairs_inner", + "uvlock": true, + "x": 180, + "y": 90 + }, + "facing=south,half=top,shape=inner_right": { + "model": "minecraft:block/pale_oak_stairs_inner", + "uvlock": true, + "x": 180, + "y": 180 + }, + "facing=south,half=top,shape=outer_left": { + "model": "minecraft:block/pale_oak_stairs_outer", + "uvlock": true, + "x": 180, + "y": 90 + }, + "facing=south,half=top,shape=outer_right": { + "model": "minecraft:block/pale_oak_stairs_outer", + "uvlock": true, + "x": 180, + "y": 180 + }, + "facing=south,half=top,shape=straight": { + "model": "minecraft:block/pale_oak_stairs", + "uvlock": true, + "x": 180, + "y": 90 + }, + "facing=west,half=bottom,shape=inner_left": { + "model": "minecraft:block/pale_oak_stairs_inner", + "uvlock": true, + "y": 90 + }, + "facing=west,half=bottom,shape=inner_right": { + "model": "minecraft:block/pale_oak_stairs_inner", + "uvlock": true, + "y": 180 + }, + "facing=west,half=bottom,shape=outer_left": { + "model": "minecraft:block/pale_oak_stairs_outer", + "uvlock": true, + "y": 90 + }, + "facing=west,half=bottom,shape=outer_right": { + "model": "minecraft:block/pale_oak_stairs_outer", + "uvlock": true, + "y": 180 + }, + "facing=west,half=bottom,shape=straight": { + "model": "minecraft:block/pale_oak_stairs", + "uvlock": true, + "y": 180 + }, + "facing=west,half=top,shape=inner_left": { + "model": "minecraft:block/pale_oak_stairs_inner", + "uvlock": true, + "x": 180, + "y": 180 + }, + "facing=west,half=top,shape=inner_right": { + "model": "minecraft:block/pale_oak_stairs_inner", + "uvlock": true, + "x": 180, + "y": 270 + }, + "facing=west,half=top,shape=outer_left": { + "model": "minecraft:block/pale_oak_stairs_outer", + "uvlock": true, + "x": 180, + "y": 180 + }, + "facing=west,half=top,shape=outer_right": { + "model": "minecraft:block/pale_oak_stairs_outer", + "uvlock": true, + "x": 180, + "y": 270 + }, + "facing=west,half=top,shape=straight": { + "model": "minecraft:block/pale_oak_stairs", + "uvlock": true, + "x": 180, + "y": 180 + } + } +} \ No newline at end of file diff --git a/assets/minecraft/blockstates/pale_oak_trapdoor.json b/assets/minecraft/blockstates/pale_oak_trapdoor.json new file mode 100644 index 00000000..52e57594 --- /dev/null +++ b/assets/minecraft/blockstates/pale_oak_trapdoor.json @@ -0,0 +1,69 @@ +{ + "variants": { + "facing=east,half=bottom,open=false": { + "model": "minecraft:block/pale_oak_trapdoor_bottom", + "y": 90 + }, + "facing=east,half=bottom,open=true": { + "model": "minecraft:block/pale_oak_trapdoor_open", + "y": 90 + }, + "facing=east,half=top,open=false": { + "model": "minecraft:block/pale_oak_trapdoor_top", + "y": 90 + }, + "facing=east,half=top,open=true": { + "model": "minecraft:block/pale_oak_trapdoor_open", + "x": 180, + "y": 270 + }, + "facing=north,half=bottom,open=false": { + "model": "minecraft:block/pale_oak_trapdoor_bottom" + }, + "facing=north,half=bottom,open=true": { + "model": "minecraft:block/pale_oak_trapdoor_open" + }, + "facing=north,half=top,open=false": { + "model": "minecraft:block/pale_oak_trapdoor_top" + }, + "facing=north,half=top,open=true": { + "model": "minecraft:block/pale_oak_trapdoor_open", + "x": 180, + "y": 180 + }, + "facing=south,half=bottom,open=false": { + "model": "minecraft:block/pale_oak_trapdoor_bottom", + "y": 180 + }, + "facing=south,half=bottom,open=true": { + "model": "minecraft:block/pale_oak_trapdoor_open", + "y": 180 + }, + "facing=south,half=top,open=false": { + "model": "minecraft:block/pale_oak_trapdoor_top", + "y": 180 + }, + "facing=south,half=top,open=true": { + "model": "minecraft:block/pale_oak_trapdoor_open", + "x": 180, + "y": 0 + }, + "facing=west,half=bottom,open=false": { + "model": "minecraft:block/pale_oak_trapdoor_bottom", + "y": 270 + }, + "facing=west,half=bottom,open=true": { + "model": "minecraft:block/pale_oak_trapdoor_open", + "y": 270 + }, + "facing=west,half=top,open=false": { + "model": "minecraft:block/pale_oak_trapdoor_top", + "y": 270 + }, + "facing=west,half=top,open=true": { + "model": "minecraft:block/pale_oak_trapdoor_open", + "x": 180, + "y": 90 + } + } +} \ No newline at end of file diff --git a/assets/minecraft/blockstates/pale_oak_wall_hanging_sign.json b/assets/minecraft/blockstates/pale_oak_wall_hanging_sign.json new file mode 100644 index 00000000..bde6deba --- /dev/null +++ b/assets/minecraft/blockstates/pale_oak_wall_hanging_sign.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "minecraft:block/pale_oak_hanging_sign" + } + } +} \ No newline at end of file diff --git a/assets/minecraft/blockstates/pale_oak_wall_sign.json b/assets/minecraft/blockstates/pale_oak_wall_sign.json new file mode 100644 index 00000000..be6f9eb8 --- /dev/null +++ b/assets/minecraft/blockstates/pale_oak_wall_sign.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "minecraft:block/pale_oak_sign" + } + } +} \ No newline at end of file diff --git a/assets/minecraft/blockstates/pale_oak_wood.json b/assets/minecraft/blockstates/pale_oak_wood.json new file mode 100644 index 00000000..2a98bc05 --- /dev/null +++ b/assets/minecraft/blockstates/pale_oak_wood.json @@ -0,0 +1,16 @@ +{ + "variants": { + "axis=x": { + "model": "minecraft:block/pale_oak_wood", + "x": 90, + "y": 90 + }, + "axis=y": { + "model": "minecraft:block/pale_oak_wood" + }, + "axis=z": { + "model": "minecraft:block/pale_oak_wood", + "x": 90 + } + } +} \ No newline at end of file diff --git a/assets/minecraft/blockstates/potted_pale_oak_sapling.json b/assets/minecraft/blockstates/potted_pale_oak_sapling.json new file mode 100644 index 00000000..5d1731dc --- /dev/null +++ b/assets/minecraft/blockstates/potted_pale_oak_sapling.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "minecraft:block/potted_pale_oak_sapling" + } + } +} \ No newline at end of file diff --git a/assets/minecraft/blockstates/stripped_pale_oak_log.json b/assets/minecraft/blockstates/stripped_pale_oak_log.json new file mode 100644 index 00000000..c49669e0 --- /dev/null +++ b/assets/minecraft/blockstates/stripped_pale_oak_log.json @@ -0,0 +1,16 @@ +{ + "variants": { + "axis=x": { + "model": "minecraft:block/stripped_pale_oak_log_horizontal", + "x": 90, + "y": 90 + }, + "axis=y": { + "model": "minecraft:block/stripped_pale_oak_log" + }, + "axis=z": { + "model": "minecraft:block/stripped_pale_oak_log_horizontal", + "x": 90 + } + } +} \ No newline at end of file diff --git a/assets/minecraft/blockstates/stripped_pale_oak_wood.json b/assets/minecraft/blockstates/stripped_pale_oak_wood.json new file mode 100644 index 00000000..07b79a1e --- /dev/null +++ b/assets/minecraft/blockstates/stripped_pale_oak_wood.json @@ -0,0 +1,16 @@ +{ + "variants": { + "axis=x": { + "model": "minecraft:block/stripped_pale_oak_wood", + "x": 90, + "y": 90 + }, + "axis=y": { + "model": "minecraft:block/stripped_pale_oak_wood" + }, + "axis=z": { + "model": "minecraft:block/stripped_pale_oak_wood", + "x": 90 + } + } +} \ No newline at end of file diff --git a/assets/minecraft/lang/deprecated.json b/assets/minecraft/lang/deprecated.json new file mode 100644 index 00000000..b7987e7a --- /dev/null +++ b/assets/minecraft/lang/deprecated.json @@ -0,0 +1,272 @@ +{ + "removed": [ + "upgrade.minecraft.netherite_upgrade", + "item.minecraft.creeper_banner_pattern.desc", + "item.minecraft.flow_banner_pattern.desc", + "item.minecraft.flower_banner_pattern.desc", + "item.minecraft.globe_banner_pattern.desc", + "item.minecraft.guster_banner_pattern.desc", + "item.minecraft.mojang_banner_pattern.desc", + "item.minecraft.piglin_banner_pattern.desc", + "item.minecraft.skull_banner_pattern.desc", + "argument.time.invalid_tick_count", + "arguments.nbtpath.too_large", + "block.minecraft.grass", + "book.invalid.tag", + "commands.fillbiome.success", + "commands.function.success.multiple", + "commands.function.success.multiple.result", + "commands.function.success.single", + "commands.function.success.single.result", + "commands.publish.success", + "connect.reconfiging", + "dataPack.update_1_20.description", + "dataPack.update_1_20.name", + "dataPack.update_1_21.description", + "dataPack.update_1_21.name", + "deathScreen.score", + "event.minecraft.raid.defeat", + "event.minecraft.raid.victory", + "gui.abuseReport.reason.false_reporting", + "gui.chatReport.comments", + "gui.chatReport.describe", + "gui.chatReport.discard.content", + "gui.chatReport.discard.discard", + "gui.chatReport.discard.draft", + "gui.chatReport.discard.return", + "gui.chatReport.discard.title", + "gui.chatReport.draft.content", + "gui.chatReport.draft.discard", + "gui.chatReport.draft.edit", + "gui.chatReport.draft.quittotitle.content", + "gui.chatReport.draft.quittotitle.title", + "gui.chatReport.draft.title", + "gui.chatReport.more_comments", + "gui.chatReport.observed_what", + "gui.chatReport.read_info", + "gui.chatReport.select_reason", + "gui.chatReport.send.comments_too_long", + "gui.chatReport.send.no_reason", + "item_modifier.unknown", + "item.minecraft.angler_pottery_shard", + "item.minecraft.archer_pottery_shard", + "item.minecraft.arms_up_pottery_shard", + "item.minecraft.blade_pottery_shard", + "item.minecraft.brewer_pottery_shard", + "item.minecraft.bundle.fullness", + "item.minecraft.burn_pottery_shard", + "item.minecraft.danger_pottery_shard", + "item.minecraft.explorer_pottery_shard", + "item.minecraft.friend_pottery_shard", + "item.minecraft.heart_pottery_shard", + "item.minecraft.heartbreak_pottery_shard", + "item.minecraft.howl_pottery_shard", + "item.minecraft.miner_pottery_shard", + "item.minecraft.mourner_pottery_shard", + "item.minecraft.music_disc_5.desc", + "item.minecraft.music_disc_11.desc", + "item.minecraft.music_disc_13.desc", + "item.minecraft.music_disc_blocks.desc", + "item.minecraft.music_disc_cat.desc", + "item.minecraft.music_disc_chirp.desc", + "item.minecraft.music_disc_creator_music_box.desc", + "item.minecraft.music_disc_creator.desc", + "item.minecraft.music_disc_far.desc", + "item.minecraft.music_disc_mall.desc", + "item.minecraft.music_disc_mellohi.desc", + "item.minecraft.music_disc_otherside.desc", + "item.minecraft.music_disc_pigstep.desc", + "item.minecraft.music_disc_precipice.desc", + "item.minecraft.music_disc_relic.desc", + "item.minecraft.music_disc_stal.desc", + "item.minecraft.music_disc_strad.desc", + "item.minecraft.music_disc_wait.desc", + "item.minecraft.music_disc_ward.desc", + "item.minecraft.plenty_pottery_shard", + "item.minecraft.pottery_shard_archer", + "item.minecraft.pottery_shard_arms_up", + "item.minecraft.pottery_shard_prize", + "item.minecraft.pottery_shard_skull", + "item.minecraft.prize_pottery_shard", + "item.minecraft.scute", + "item.minecraft.sheaf_pottery_shard", + "item.minecraft.shelter_pottery_shard", + "item.minecraft.skull_pottery_shard", + "item.minecraft.snort_pottery_shard", + "item.nbt_tags", + "mco.account.privacy.info", + "mco.account.privacyinfo", + "mco.client.incompatible.msg.line1", + "mco.client.incompatible.msg.line2", + "mco.client.incompatible.msg.line3", + "mco.configure.world.close.question.line2", + "mco.configure.world.delete.question.line2", + "mco.configure.world.invited", + "mco.configure.world.leave.question.line2", + "mco.configure.world.resourcepack.question.line1", + "mco.configure.world.resourcepack.question.line2", + "mco.configure.world.restore.download.question.line2", + "mco.configure.world.restore.question.line2", + "mco.configure.world.slot.switch.question.line2", + "mco.configure.world.spawnAnimals", + "mco.configure.world.spawnNPCs", + "mco.configure.world.spawn_toggle.title", + "mco.configure.world.subscription.day", + "mco.configure.world.subscription.days", + "mco.configure.world.subscription.month", + "mco.configure.world.subscription.months", + "mco.configure.world.uninvite.question", + "mco.create.world.skip", + "mco.create.world.subtitle", + "mco.download.confirmation.line1", + "mco.download.confirmation.line2", + "mco.errorMessage.realmsService", + "mco.gui.ok", + "mco.reset.world.seed", + "mco.reset.world.upload", + "mco.selectServer.configureRealm", + "mco.selectServer.expiredSubscribe", + "mco.selectServer.minigame", + "mco.snapshot.creating", + "mco.snapshot.friendsRealm.upgrade", + "mco.upload.entry.cheats", + "mco.upload.entry.commands", + "mco.upload.size.failure.line1", + "mco.upload.size.failure.line2", + "mco.version", + "multiplayer.disconnect.out_of_order_chat", + "multiplayer.disconnect.unsigned_chat", + "narration.edit_box", + "painting.minecraft.earth.author", + "painting.minecraft.fire.author", + "painting.minecraft.water.author", + "painting.minecraft.wind.author", + "painting.minecraft.wither.author", + "predicate.unknown", + "resourcepack.downloading", + "resourcepack.progress", + "resourcepack.requesting", + "selectWorld.cheats", + "selectWorld.edit.export_worldgen_settings", + "selectWorld.edit.export_worldgen_settings.failure", + "selectWorld.edit.export_worldgen_settings.success", + "selectWorld.futureworld.error.text", + "selectWorld.futureworld.error.title", + "selectWorld.gameMode.adventure.line1", + "selectWorld.gameMode.adventure.line2", + "selectWorld.gameMode.creative.line1", + "selectWorld.gameMode.creative.line2", + "selectWorld.gameMode.hardcore.line1", + "selectWorld.gameMode.hardcore.line2", + "selectWorld.gameMode.spectator.line1", + "selectWorld.gameMode.spectator.line2", + "selectWorld.gameMode.survival.line1", + "selectWorld.gameMode.survival.line2", + "selectWorld.import_worldgen_settings", + "selectWorld.import_worldgen_settings.failure", + "selectWorld.import_worldgen_settings.select_file", + "selectWorld.moreWorldOptions", + "selectWorld.resultFolder", + "selectWorld.versionJoinButton", + "selectWorld.versionQuestion", + "selectWorld.versionWarning", + "subtitles.block.trial_spawner.ambient_charged", + "subtitles.block.trial_spawner.charge_activate", + "subtitles.entity.camel.step", + "subtitles.entity.camel.step_sand", + "subtitles.entity.drowned.step", + "subtitles.entity.generic.wind_burst", + "subtitles.entity.goat.step", + "subtitles.entity.hoglin.step", + "subtitles.entity.llama.step", + "subtitles.entity.panda.step", + "subtitles.entity.piglin_brute.step", + "subtitles.entity.piglin.step", + "subtitles.entity.ravager.step", + "subtitles.entity.sniffer.egg_crack", + "subtitles.entity.sniffer.egg_hatch", + "subtitles.entity.sniffer.step", + "subtitles.entity.warden.step", + "subtitles.entity.zoglin.step", + "symlink_warning.message", + "title.32bit.deprecation", + "title.32bit.deprecation.realms", + "title.32bit.deprecation.realms.check", + "title.32bit.deprecation.realms.header", + "tutorial.bundleInsert.description", + "tutorial.bundleInsert.title", + "attribute.name.generic.armor", + "attribute.name.generic.armor_toughness", + "attribute.name.generic.attack_damage", + "attribute.name.generic.attack_knockback", + "attribute.name.generic.attack_speed", + "attribute.name.generic.block_interaction_range", + "attribute.name.generic.burning_time", + "attribute.name.generic.entity_interaction_range", + "attribute.name.generic.explosion_knockback_resistance", + "attribute.name.generic.fall_damage_multiplier", + "attribute.name.generic.flying_speed", + "attribute.name.generic.follow_range", + "attribute.name.generic.gravity", + "attribute.name.generic.jump_strength", + "attribute.name.generic.knockback_resistance", + "attribute.name.generic.luck", + "attribute.name.generic.max_absorption", + "attribute.name.generic.max_health", + "attribute.name.generic.movement_efficiency", + "attribute.name.generic.movement_speed", + "attribute.name.generic.oxygen_bonus", + "attribute.name.generic.safe_fall_distance", + "attribute.name.generic.scale", + "attribute.name.generic.step_height", + "attribute.name.generic.water_movement_efficiency", + "attribute.name.horse.jump_strength", + "attribute.name.player.block_break_speed", + "attribute.name.player.block_interaction_range", + "attribute.name.player.entity_interaction_range", + "attribute.name.player.mining_efficiency", + "attribute.name.player.sneaking_speed", + "attribute.name.player.submerged_mining_speed", + "attribute.name.player.sweeping_damage_ratio", + "attribute.name.zombie.spawn_reinforcements", + "realms.missing.snapshot.error.text", + "entity.minecraft.boat", + "entity.minecraft.chest_boat" + ], + "renamed": { + "item.minecraft.dune_armor_trim_smithing_template.new": "item.minecraft.dune_armor_trim_smithing_template", + "item.minecraft.eye_armor_trim_smithing_template.new": "item.minecraft.eye_armor_trim_smithing_template", + "item.minecraft.flow_armor_trim_smithing_template.new": "item.minecraft.flow_armor_trim_smithing_template", + "item.minecraft.bolt_armor_trim_smithing_template.new": "item.minecraft.bolt_armor_trim_smithing_template", + "item.minecraft.host_armor_trim_smithing_template.new": "item.minecraft.host_armor_trim_smithing_template", + "item.minecraft.netherite_upgrade_smithing_template.new": "item.minecraft.netherite_upgrade_smithing_template", + "item.minecraft.raiser_armor_trim_smithing_template.new": "item.minecraft.raiser_armor_trim_smithing_template", + "item.minecraft.rib_armor_trim_smithing_template.new": "item.minecraft.rib_armor_trim_smithing_template", + "item.minecraft.sentry_armor_trim_smithing_template.new": "item.minecraft.sentry_armor_trim_smithing_template", + "item.minecraft.shaper_armor_trim_smithing_template.new": "item.minecraft.shaper_armor_trim_smithing_template", + "item.minecraft.silence_armor_trim_smithing_template.new": "item.minecraft.silence_armor_trim_smithing_template", + "item.minecraft.snout_armor_trim_smithing_template.new": "item.minecraft.snout_armor_trim_smithing_template", + "item.minecraft.spire_armor_trim_smithing_template.new": "item.minecraft.spire_armor_trim_smithing_template", + "item.minecraft.tide_armor_trim_smithing_template.new": "item.minecraft.tide_armor_trim_smithing_template", + "item.minecraft.vex_armor_trim_smithing_template.new": "item.minecraft.vex_armor_trim_smithing_template", + "item.minecraft.ward_armor_trim_smithing_template.new": "item.minecraft.ward_armor_trim_smithing_template", + "item.minecraft.wayfinder_armor_trim_smithing_template.new": "item.minecraft.wayfinder_armor_trim_smithing_template", + "item.minecraft.wild_armor_trim_smithing_template.new": "item.minecraft.wild_armor_trim_smithing_template", + "item.minecraft.coast_armor_trim_smithing_template.new": "item.minecraft.coast_armor_trim_smithing_template", + "item.minecraft.creeper_banner_pattern.new": "item.minecraft.creeper_banner_pattern", + "item.minecraft.flow_banner_pattern.new": "item.minecraft.flow_banner_pattern", + "item.minecraft.flower_banner_pattern.new": "item.minecraft.flower_banner_pattern", + "item.minecraft.globe_banner_pattern.new": "item.minecraft.globe_banner_pattern", + "item.minecraft.guster_banner_pattern.new": "item.minecraft.guster_banner_pattern", + "item.minecraft.mojang_banner_pattern.new": "item.minecraft.mojang_banner_pattern", + "item.minecraft.piglin_banner_pattern.new": "item.minecraft.piglin_banner_pattern", + "item.minecraft.skull_banner_pattern.new": "item.minecraft.skull_banner_pattern", + "lanServer.port.unavailable.new": "lanServer.port.unavailable", + "lanServer.port.invalid.new": "lanServer.port.invalid", + "multiplayer.disconnect.invalid_public_key_signature.new": "multiplayer.disconnect.invalid_public_key_signature", + "selectWorld.allowCommands.new": "selectWorld.allowCommands", + "gui.abuseReport.reason.generic": "gui.abuseReport.reason.i_want_to_report_them", + "gui.abuseReport.reason.generic.description": "gui.abuseReport.reason.i_want_to_report_them.description", + "commands.drop.no_loot_table": "commands.drop.no_loot_table.entity" + } +} diff --git a/assets/minecraft/lang/en_us.json b/assets/minecraft/lang/en_us.json index 0ec346f8..ea1055b5 100644 --- a/assets/minecraft/lang/en_us.json +++ b/assets/minecraft/lang/en_us.json @@ -5,7 +5,6 @@ "addServer.add": "Done", "addServer.enterIp": "Server Address", "addServer.enterName": "Server Name", - "addServer.hideAddress": "Hide Address", "addServer.resourcePack": "Server Resource Packs", "addServer.resourcePack.disabled": "Disabled", "addServer.resourcePack.enabled": "Enabled", @@ -84,7 +83,7 @@ "advancements.adventure.trade.title": "What a Deal!", "advancements.adventure.trim_with_all_exclusive_armor_patterns.description": "Apply these smithing templates at least once: Spire, Snout, Rib, Ward, Silence, Vex, Tide, Wayfinder", "advancements.adventure.trim_with_all_exclusive_armor_patterns.title": "Smithing with Style", - "advancements.adventure.trim_with_any_armor_pattern.description": "Craft a trimmed armor at a Smithing Table", + "advancements.adventure.trim_with_any_armor_pattern.description": "Craft trimmed armor at a Smithing Table", "advancements.adventure.trim_with_any_armor_pattern.title": "Crafting a New Look", "advancements.adventure.two_birds_one_arrow.description": "Kill two Phantoms with a piercing Arrow", "advancements.adventure.two_birds_one_arrow.title": "Two Birds, One Arrow", @@ -155,7 +154,7 @@ "advancements.husbandry.plant_seed.title": "A Seedy Place", "advancements.husbandry.remove_wolf_armor.description": "Remove Wolf Armor from a Wolf using Shears", "advancements.husbandry.remove_wolf_armor.title": "Shear Brilliance", - "advancements.husbandry.repair_wolf_armor.description": "Repair a damaged Wolf Armor using Armadillo Scutes", + "advancements.husbandry.repair_wolf_armor.description": "Fully repair damaged Wolf Armor using Armadillo Scutes", "advancements.husbandry.repair_wolf_armor.title": "Good as New", "advancements.husbandry.ride_a_boat_with_a_goat.description": "Get in a Boat and float with a Goat", "advancements.husbandry.ride_a_boat_with_a_goat.title": "Whatever Floats Your Goat!", @@ -163,7 +162,7 @@ "advancements.husbandry.root.title": "Husbandry", "advancements.husbandry.safely_harvest_honey.description": "Use a Campfire to collect Honey from a Beehive using a Glass Bottle without aggravating the Bees", "advancements.husbandry.safely_harvest_honey.title": "Bee Our Guest", - "advancements.husbandry.silk_touch_nest.description": "Move a Bee Nest, with 3 Bees inside, using Silk Touch", + "advancements.husbandry.silk_touch_nest.description": "Move a Bee Nest or Beehive, with 3 Bees inside, using Silk Touch", "advancements.husbandry.silk_touch_nest.title": "Total Beelocation", "advancements.husbandry.tactical_fishing.description": "Catch a Fish... without a Fishing Rod!", "advancements.husbandry.tactical_fishing.title": "Tactical Fishing", @@ -262,8 +261,6 @@ "advancements.toast.challenge": "Challenge Complete!", "advancements.toast.goal": "Goal Reached!", "advancements.toast.task": "Advancement Made!", - "advMode.allEntities": "Use \"@e\" to target all entities", - "advMode.allPlayers": "Use \"@a\" to target all players", "advMode.command": "Console Command", "advMode.mode": "Mode", "advMode.mode.auto": "Repeat", @@ -273,12 +270,9 @@ "advMode.mode.redstoneTriggered": "Needs Redstone", "advMode.mode.sequence": "Chain", "advMode.mode.unconditional": "Unconditional", - "advMode.nearestPlayer": "Use \"@p\" to target nearest player", "advMode.notAllowed": "Must be an opped player in creative mode", "advMode.notEnabled": "Command blocks are not enabled on this server", "advMode.previousOutput": "Previous Output", - "advMode.randomPlayer": "Use \"@r\" to target random player", - "advMode.self": "Use \"@s\" to target the executing entity", "advMode.setCommand": "Set Console Command for Block", "advMode.setCommand.success": "Command set: %s", "advMode.trackOutput": "Track output", @@ -422,6 +416,19 @@ "attribute.modifier.take.0": "-%s %s", "attribute.modifier.take.1": "-%s%% %s", "attribute.modifier.take.2": "-%s%% %s", + "attribute.name.armor": "Armor", + "attribute.name.armor_toughness": "Armor Toughness", + "attribute.name.attack_damage": "Attack Damage", + "attribute.name.attack_knockback": "Attack Knockback", + "attribute.name.attack_speed": "Attack Speed", + "attribute.name.block_break_speed": "Block Break Speed", + "attribute.name.block_interaction_range": "Block Interaction Range", + "attribute.name.burning_time": "Burning Time", + "attribute.name.entity_interaction_range": "Entity Interaction Range", + "attribute.name.explosion_knockback_resistance": "Explosion Knockback Resistance", + "attribute.name.fall_damage_multiplier": "Fall Damage Multiplier", + "attribute.name.flying_speed": "Flying Speed", + "attribute.name.follow_range": "Mob Follow Range", "attribute.name.generic.armor": "Armor", "attribute.name.generic.armor_toughness": "Armor Toughness", "attribute.name.generic.attack_damage": "Attack Damage", @@ -447,7 +454,17 @@ "attribute.name.generic.scale": "Scale", "attribute.name.generic.step_height": "Step Height", "attribute.name.generic.water_movement_efficiency": "Water Movement Efficiency", + "attribute.name.gravity": "Gravity", "attribute.name.horse.jump_strength": "Horse Jump Strength", + "attribute.name.jump_strength": "Jump Strength", + "attribute.name.knockback_resistance": "Knockback Resistance", + "attribute.name.luck": "Luck", + "attribute.name.max_absorption": "Max Absorption", + "attribute.name.max_health": "Max Health", + "attribute.name.mining_efficiency": "Mining Efficiency", + "attribute.name.movement_efficiency": "Movement Efficiency", + "attribute.name.movement_speed": "Speed", + "attribute.name.oxygen_bonus": "Oxygen Bonus", "attribute.name.player.block_break_speed": "Block Break Speed", "attribute.name.player.block_interaction_range": "Block Interaction Range", "attribute.name.player.entity_interaction_range": "Entity Interaction Range", @@ -455,6 +472,15 @@ "attribute.name.player.sneaking_speed": "Sneaking Speed", "attribute.name.player.submerged_mining_speed": "Submerged Mining Speed", "attribute.name.player.sweeping_damage_ratio": "Sweeping Damage Ratio", + "attribute.name.safe_fall_distance": "Safe Fall Distance", + "attribute.name.scale": "Scale", + "attribute.name.sneaking_speed": "Sneaking Speed", + "attribute.name.spawn_reinforcements": "Zombie Reinforcements", + "attribute.name.step_height": "Step Height", + "attribute.name.submerged_mining_speed": "Submerged Mining Speed", + "attribute.name.sweeping_damage_ratio": "Sweeping Damage Ratio", + "attribute.name.tempt_range": "Mob Tempt Range", + "attribute.name.water_movement_efficiency": "Water Movement Efficiency", "attribute.name.zombie.spawn_reinforcements": "Zombie Reinforcements", "biome.minecraft.badlands": "Badlands", "biome.minecraft.bamboo_jungle": "Bamboo Jungle", @@ -495,6 +521,7 @@ "biome.minecraft.old_growth_birch_forest": "Old Growth Birch Forest", "biome.minecraft.old_growth_pine_taiga": "Old Growth Pine Taiga", "biome.minecraft.old_growth_spruce_taiga": "Old Growth Spruce Taiga", + "biome.minecraft.pale_garden": "Pale Garden", "biome.minecraft.plains": "Plains", "biome.minecraft.river": "River", "biome.minecraft.savanna": "Savanna", @@ -1440,6 +1467,7 @@ "block.minecraft.cracked_stone_bricks": "Cracked Stone Bricks", "block.minecraft.crafter": "Crafter", "block.minecraft.crafting_table": "Crafting Table", + "block.minecraft.creaking_heart": "Creaking Heart", "block.minecraft.creeper_head": "Creeper Head", "block.minecraft.creeper_wall_head": "Creeper Wall Head", "block.minecraft.crimson_button": "Crimson Button", @@ -1854,6 +1882,26 @@ "block.minecraft.oxidized_cut_copper_stairs": "Oxidized Cut Copper Stairs", "block.minecraft.packed_ice": "Packed Ice", "block.minecraft.packed_mud": "Packed Mud", + "block.minecraft.pale_hanging_moss": "Pale Hanging Moss", + "block.minecraft.pale_moss_block": "Pale Moss Block", + "block.minecraft.pale_moss_carpet": "Pale Moss Carpet", + "block.minecraft.pale_oak_button": "Pale Oak Button", + "block.minecraft.pale_oak_door": "Pale Oak Door", + "block.minecraft.pale_oak_fence": "Pale Oak Fence", + "block.minecraft.pale_oak_fence_gate": "Pale Oak Fence Gate", + "block.minecraft.pale_oak_hanging_sign": "Pale Oak Hanging Sign", + "block.minecraft.pale_oak_leaves": "Pale Oak Leaves", + "block.minecraft.pale_oak_log": "Pale Oak Log", + "block.minecraft.pale_oak_planks": "Pale Oak Planks", + "block.minecraft.pale_oak_pressure_plate": "Pale Oak Pressure Plate", + "block.minecraft.pale_oak_sapling": "Pale Oak Sapling", + "block.minecraft.pale_oak_sign": "Pale Oak Sign", + "block.minecraft.pale_oak_slab": "Pale Oak Slab", + "block.minecraft.pale_oak_stairs": "Pale Oak Stairs", + "block.minecraft.pale_oak_trapdoor": "Pale Oak Trapdoor", + "block.minecraft.pale_oak_wall_hanging_sign": "Pale Oak Wall Hanging Sign", + "block.minecraft.pale_oak_wall_sign": "Pale Oak Wall Sign", + "block.minecraft.pale_oak_wood": "Pale Oak Wood", "block.minecraft.pearlescent_froglight": "Pearlescent Froglight", "block.minecraft.peony": "Peony", "block.minecraft.petrified_oak_slab": "Petrified Oak Slab", @@ -1937,6 +1985,7 @@ "block.minecraft.potted_oak_sapling": "Potted Oak Sapling", "block.minecraft.potted_orange_tulip": "Potted Orange Tulip", "block.minecraft.potted_oxeye_daisy": "Potted Oxeye Daisy", + "block.minecraft.potted_pale_oak_sapling": "Potted Pale Oak Sapling", "block.minecraft.potted_pink_tulip": "Potted Pink Tulip", "block.minecraft.potted_poppy": "Potted Poppy", "block.minecraft.potted_red_mushroom": "Potted Red Mushroom", @@ -2120,6 +2169,8 @@ "block.minecraft.stripped_mangrove_wood": "Stripped Mangrove Wood", "block.minecraft.stripped_oak_log": "Stripped Oak Log", "block.minecraft.stripped_oak_wood": "Stripped Oak Wood", + "block.minecraft.stripped_pale_oak_log": "Stripped Pale Oak Log", + "block.minecraft.stripped_pale_oak_wood": "Stripped Pale Oak Wood", "block.minecraft.stripped_spruce_log": "Stripped Spruce Log", "block.minecraft.stripped_spruce_wood": "Stripped Spruce Wood", "block.minecraft.stripped_warped_hyphae": "Stripped Warped Hyphae", @@ -2304,7 +2355,7 @@ "chat.link.confirmTrusted": "Do you want to open this link or copy it to your clipboard?", "chat.link.open": "Open in Browser", "chat.link.warning": "Never open links from people that you don't trust!", - "chat.queue": "[+%s pending lines]", + "chat.queue": "[+%s pending line(s)]", "chat.square_brackets": "[%s]", "chat.tag.error": "Server sent invalid message.", "chat.tag.modified": "Message modified by the server. Original:", @@ -2354,7 +2405,6 @@ "command.forkLimit": "Maximum number of contexts (%s) reached", "command.unknown.argument": "Incorrect argument for command", "command.unknown.command": "Unknown or incomplete command, see below for error", - "commands.advancement.advancementNotFound": "No advancement was found by the name '%1$s'", "commands.advancement.criterionNotFound": "The advancement %1$s does not contain the criterion '%2$s'", "commands.advancement.grant.criterion.to.many.failure": "Couldn't grant criterion '%s' of advancement %s to %s players as they already have it", "commands.advancement.grant.criterion.to.many.success": "Granted criterion '%s' of advancement %s to %s players", @@ -2478,7 +2528,7 @@ "commands.debug.function.traceFailed": "Failed to trace function", "commands.debug.notRunning": "The tick profiler hasn't started", "commands.debug.started": "Started tick profiling", - "commands.debug.stopped": "Stopped tick profiling after %s seconds and %s ticks (%s ticks per second)", + "commands.debug.stopped": "Stopped tick profiling after %s second(s) and %s tick(s) (%s tick(s) per second)", "commands.defaultgamemode.success": "The default game mode is now %s", "commands.deop.failed": "Nothing changed. The player is not an operator", "commands.deop.success": "Made %s no longer a server operator", @@ -2487,6 +2537,7 @@ "commands.difficulty.success": "The difficulty has been set to %s", "commands.drop.no_held_items": "Entity can't hold any items", "commands.drop.no_loot_table": "Entity %s has no loot table", + "commands.drop.no_loot_table.block": "Block %s has no loot table", "commands.drop.success.multiple": "Dropped %s items", "commands.drop.success.multiple_with_table": "Dropped %s items from loot table %s", "commands.drop.success.single": "Dropped %s %s", @@ -2649,6 +2700,7 @@ "commands.ride.mount.failure.wrong_dimension": "Can't mount entity in different dimension", "commands.ride.mount.success": "%s started riding %s", "commands.ride.not_riding": "%s is not riding any vehicle", + "commands.rotate.success": "Rotated %s", "commands.save.alreadyOff": "Saving is already turned off", "commands.save.alreadyOn": "Saving is already turned on", "commands.save.disabled": "Automatic saving is now disabled", @@ -2659,7 +2711,8 @@ "commands.schedule.cleared.failure": "No schedules with id %s", "commands.schedule.cleared.success": "Removed %s schedule(s) with id %s", "commands.schedule.created.function": "Scheduled function '%s' in %s tick(s) at gametime %s", - "commands.schedule.created.tag": "Scheduled tag '%s' in %s ticks at gametime %s", + "commands.schedule.created.tag": "Scheduled tag '%s' in %s tick(s) at gametime %s", + "commands.schedule.macro": "Can't schedule a macro", "commands.schedule.same_tick": "Can't schedule for current tick", "commands.scoreboard.objectives.add.duplicate": "An objective already exists by that name", "commands.scoreboard.objectives.add.success": "Created new objective %s", @@ -2711,6 +2764,7 @@ "commands.setblock.failed": "Could not set the block", "commands.setblock.success": "Changed the block at %s, %s, %s", "commands.setidletimeout.success": "The player idle timeout is now %s minute(s)", + "commands.setidletimeout.success.disabled": "The player idle timeout is now disabled", "commands.setworldspawn.failure.not_overworld": "Can only set the world spawn for overworld", "commands.setworldspawn.success": "Set the world spawn point to %s, %s, %s [%s]", "commands.spawnpoint.success.multiple": "Set spawn point to %s, %s, %s [%s] in %s for %s players", @@ -2722,8 +2776,8 @@ "commands.spreadplayers.failed.entities": "Could not spread %s entity/entities around %s, %s (too many entities for space - try using spread of at most %s)", "commands.spreadplayers.failed.invalid.height": "Invalid maxHeight %s; expected higher than world minimum %s", "commands.spreadplayers.failed.teams": "Could not spread %s team(s) around %s, %s (too many entities for space - try using spread of at most %s)", - "commands.spreadplayers.success.entities": "Spread %s player(s) around %s, %s with an average distance of %s blocks apart", - "commands.spreadplayers.success.teams": "Spread %s team(s) around %s, %s with an average distance of %s blocks apart", + "commands.spreadplayers.success.entities": "Spread %s entity/entities around %s, %s with an average distance of %s block(s) apart", + "commands.spreadplayers.success.teams": "Spread %s team(s) around %s, %s with an average distance of %s block(s) apart", "commands.stop.stopping": "Stopping the server", "commands.stopsound.success.source.any": "Stopped all '%s' sounds", "commands.stopsound.success.source.sound": "Stopped sound '%s' on source '%s'", @@ -2867,6 +2921,8 @@ "connect.transferring": "Transferring to new server...", "container.barrel": "Barrel", "container.beacon": "Beacon", + "container.beehive.bees": "Bees: %s / %s", + "container.beehive.honey": "Honey: %s / %s", "container.blast_furnace": "Blast Furnace", "container.brewing": "Brewing Stand", "container.cartography_table": "Cartography Table", @@ -2913,68 +2969,6 @@ "controls.title": "Controls", "createWorld.customize.buffet.biome": "Please select a biome", "createWorld.customize.buffet.title": "Buffet world customization", - "createWorld.customize.custom.baseSize": "Depth Base Size", - "createWorld.customize.custom.biomeDepthOffset": "Biome Depth Offset", - "createWorld.customize.custom.biomeDepthWeight": "Biome Depth Weight", - "createWorld.customize.custom.biomeScaleOffset": "Biome Scale Offset", - "createWorld.customize.custom.biomeScaleWeight": "Biome Scale Weight", - "createWorld.customize.custom.biomeSize": "Biome Size", - "createWorld.customize.custom.center": "Center Height", - "createWorld.customize.custom.confirm1": "This will overwrite your current", - "createWorld.customize.custom.confirm2": "settings and cannot be undone.", - "createWorld.customize.custom.confirmTitle": "Warning!", - "createWorld.customize.custom.coordinateScale": "Coordinate Scale", - "createWorld.customize.custom.count": "Spawn Tries", - "createWorld.customize.custom.defaults": "Defaults", - "createWorld.customize.custom.depthNoiseScaleExponent": "Depth Noise Exponent", - "createWorld.customize.custom.depthNoiseScaleX": "Depth Noise Scale X", - "createWorld.customize.custom.depthNoiseScaleZ": "Depth Noise Scale Z", - "createWorld.customize.custom.dungeonChance": "Dungeon Count", - "createWorld.customize.custom.fixedBiome": "Biome", - "createWorld.customize.custom.heightScale": "Height Scale", - "createWorld.customize.custom.lavaLakeChance": "Lava Lake Rarity", - "createWorld.customize.custom.lowerLimitScale": "Lower Limit Scale", - "createWorld.customize.custom.mainNoiseScaleX": "Main Noise Scale X", - "createWorld.customize.custom.mainNoiseScaleY": "Main Noise Scale Y", - "createWorld.customize.custom.mainNoiseScaleZ": "Main Noise Scale Z", - "createWorld.customize.custom.maxHeight": "Max. Height", - "createWorld.customize.custom.minHeight": "Min. Height", - "createWorld.customize.custom.next": "Next Page", - "createWorld.customize.custom.page0": "Basic Settings", - "createWorld.customize.custom.page1": "Ore Settings", - "createWorld.customize.custom.page2": "Advanced Settings (Expert Users Only!)", - "createWorld.customize.custom.page3": "Extra Advanced Settings (Expert Users Only!)", - "createWorld.customize.custom.preset.caveChaos": "Caves of Chaos", - "createWorld.customize.custom.preset.caveDelight": "Caver's Delight", - "createWorld.customize.custom.preset.drought": "Drought", - "createWorld.customize.custom.preset.goodLuck": "Good Luck", - "createWorld.customize.custom.preset.isleLand": "Isle Land", - "createWorld.customize.custom.preset.mountains": "Mountain Madness", - "createWorld.customize.custom.preset.waterWorld": "Water World", - "createWorld.customize.custom.presets": "Presets", - "createWorld.customize.custom.presets.title": "Customize World Presets", - "createWorld.customize.custom.prev": "Previous Page", - "createWorld.customize.custom.randomize": "Randomize", - "createWorld.customize.custom.riverSize": "River Size", - "createWorld.customize.custom.seaLevel": "Sea Level", - "createWorld.customize.custom.size": "Spawn Size", - "createWorld.customize.custom.spread": "Spread Height", - "createWorld.customize.custom.stretchY": "Height Stretch", - "createWorld.customize.custom.upperLimitScale": "Upper Limit Scale", - "createWorld.customize.custom.useCaves": "Caves", - "createWorld.customize.custom.useDungeons": "Dungeons", - "createWorld.customize.custom.useLavaLakes": "Lava Lakes", - "createWorld.customize.custom.useLavaOceans": "Lava Oceans", - "createWorld.customize.custom.useMansions": "Woodland Mansions", - "createWorld.customize.custom.useMineShafts": "Mineshafts", - "createWorld.customize.custom.useMonuments": "Ocean Monuments", - "createWorld.customize.custom.useOceanRuins": "Ocean Ruins", - "createWorld.customize.custom.useRavines": "Ravines", - "createWorld.customize.custom.useStrongholds": "Strongholds", - "createWorld.customize.custom.useTemples": "Temples", - "createWorld.customize.custom.useVillages": "Villages", - "createWorld.customize.custom.useWaterLakes": "Water Lakes", - "createWorld.customize.custom.waterLakeChance": "Water Lake Rarity", "createWorld.customize.flat.height": "Height", "createWorld.customize.flat.layer": "%s", "createWorld.customize.flat.layer.bottom": "Bottom - %s", @@ -2997,6 +2991,10 @@ "credits_and_attribution.screen.title": "Credits and Attribution", "dataPack.bundle.description": "Enables experimental Bundle item", "dataPack.bundle.name": "Bundles", + "dataPack.minecart_improvements.description": "Improved movement for Minecarts", + "dataPack.minecart_improvements.name": "Minecart Improvements", + "dataPack.redstone_experiments.description": "Experimental Redstone changes", + "dataPack.redstone_experiments.name": "Redstone Experiments", "dataPack.title": "Select Data Packs", "dataPack.trade_rebalance.description": "Updated trades for Villagers", "dataPack.trade_rebalance.name": "Villager Trade Rebalance", @@ -3010,6 +3008,8 @@ "dataPack.validation.working": "Validating selected data packs...", "dataPack.vanilla.description": "The default data for Minecraft", "dataPack.vanilla.name": "Default", + "dataPack.winter_drop.description": "New features and content for the Winter Drop", + "dataPack.winter_drop.name": "Winter Drop", "datapackFailure.safeMode": "Safe Mode", "datapackFailure.safeMode.failed.description": "This world contains invalid or corrupted save data.", "datapackFailure.safeMode.failed.title": "Failed to load world in Safe Mode.", @@ -3065,6 +3065,8 @@ "death.attack.lava.player": "%1$s tried to swim in lava to escape %2$s", "death.attack.lightningBolt": "%1$s was struck by lightning", "death.attack.lightningBolt.player": "%1$s was struck by lightning while fighting %2$s", + "death.attack.mace_smash": "%1$s was smashed by %2$s", + "death.attack.mace_smash.item": "%1$s was smashed by %2$s with %3$s", "death.attack.magic": "%1$s was killed by magic", "death.attack.magic.player": "%1$s was killed by magic while trying to escape %2$s", "death.attack.message_too_long": "Actually, the message was too long to deliver fully. Sorry! Here's a stripped version: %s", @@ -3183,23 +3185,17 @@ "demo.reminder": "The demo time has expired. Buy the game to continue or start a new world!", "difficulty.lock.question": "Are you sure you want to lock the difficulty of this world? This will set this world to always be %1$s, and you will never be able to change that again.", "difficulty.lock.title": "Lock World Difficulty", - "disconnect.closed": "Connection closed", - "disconnect.disconnected": "Disconnected by Server", "disconnect.endOfStream": "End of stream", "disconnect.exceeded_packet_rate": "Kicked for exceeding packet rate limit", "disconnect.genericReason": "%s", "disconnect.ignoring_status_request": "Ignoring status request", - "disconnect.kicked": "Was kicked from the game", - "disconnect.loginFailed": "Failed to log in", "disconnect.loginFailedInfo": "Failed to log in: %s", "disconnect.loginFailedInfo.insufficientPrivileges": "Multiplayer is disabled. Please check your Microsoft account settings.", "disconnect.loginFailedInfo.invalidSession": "Invalid session (Try restarting your game and the launcher)", "disconnect.loginFailedInfo.serversUnavailable": "The authentication servers are currently not reachable. Please try again.", "disconnect.loginFailedInfo.userBanned": "You are banned from playing online", "disconnect.lost": "Connection Lost", - "disconnect.overflow": "Buffer overflow", "disconnect.packetError": "Network Protocol Error", - "disconnect.quitting": "Quitting", "disconnect.spam": "Kicked for spamming", "disconnect.timeout": "Timed out", "disconnect.transfer": "Transferred to another server", @@ -3304,14 +3300,20 @@ "enchantment.minecraft.unbreaking": "Unbreaking", "enchantment.minecraft.vanishing_curse": "Curse of Vanishing", "enchantment.minecraft.wind_burst": "Wind Burst", + "entity.minecraft.acacia_boat": "Acacia Boat", + "entity.minecraft.acacia_chest_boat": "Acacia Boat with Chest", "entity.minecraft.allay": "Allay", "entity.minecraft.area_effect_cloud": "Area Effect Cloud", "entity.minecraft.armadillo": "Armadillo", "entity.minecraft.armor_stand": "Armor Stand", "entity.minecraft.arrow": "Arrow", "entity.minecraft.axolotl": "Axolotl", + "entity.minecraft.bamboo_chest_raft": "Bamboo Raft with Chest", + "entity.minecraft.bamboo_raft": "Bamboo Raft", "entity.minecraft.bat": "Bat", "entity.minecraft.bee": "Bee", + "entity.minecraft.birch_boat": "Birch Boat", + "entity.minecraft.birch_chest_boat": "Birch Boat with Chest", "entity.minecraft.blaze": "Blaze", "entity.minecraft.block_display": "Block Display", "entity.minecraft.boat": "Boat", @@ -3321,13 +3323,19 @@ "entity.minecraft.camel": "Camel", "entity.minecraft.cat": "Cat", "entity.minecraft.cave_spider": "Cave Spider", + "entity.minecraft.cherry_boat": "Cherry Boat", + "entity.minecraft.cherry_chest_boat": "Cherry Boat with Chest", "entity.minecraft.chest_boat": "Boat with Chest", "entity.minecraft.chest_minecart": "Minecart with Chest", "entity.minecraft.chicken": "Chicken", "entity.minecraft.cod": "Cod", "entity.minecraft.command_block_minecart": "Minecart with Command Block", "entity.minecraft.cow": "Cow", + "entity.minecraft.creaking": "Creaking", + "entity.minecraft.creaking_transient": "Creaking", "entity.minecraft.creeper": "Creeper", + "entity.minecraft.dark_oak_boat": "Dark Oak Boat", + "entity.minecraft.dark_oak_chest_boat": "Dark Oak Boat with Chest", "entity.minecraft.dolphin": "Dolphin", "entity.minecraft.donkey": "Donkey", "entity.minecraft.dragon_fireball": "Dragon Fireball", @@ -3368,19 +3376,27 @@ "entity.minecraft.item": "Item", "entity.minecraft.item_display": "Item Display", "entity.minecraft.item_frame": "Item Frame", + "entity.minecraft.jungle_boat": "Jungle Boat", + "entity.minecraft.jungle_chest_boat": "Jungle Boat with Chest", "entity.minecraft.killer_bunny": "The Killer Bunny", "entity.minecraft.leash_knot": "Leash Knot", "entity.minecraft.lightning_bolt": "Lightning Bolt", "entity.minecraft.llama": "Llama", "entity.minecraft.llama_spit": "Llama Spit", "entity.minecraft.magma_cube": "Magma Cube", + "entity.minecraft.mangrove_boat": "Mangrove Boat", + "entity.minecraft.mangrove_chest_boat": "Mangrove Boat with Chest", "entity.minecraft.marker": "Marker", "entity.minecraft.minecart": "Minecart", "entity.minecraft.mooshroom": "Mooshroom", "entity.minecraft.mule": "Mule", + "entity.minecraft.oak_boat": "Oak Boat", + "entity.minecraft.oak_chest_boat": "Oak Boat with Chest", "entity.minecraft.ocelot": "Ocelot", "entity.minecraft.ominous_item_spawner": "Ominous Item Spawner", "entity.minecraft.painting": "Painting", + "entity.minecraft.pale_oak_boat": "Pale Oak Boat", + "entity.minecraft.pale_oak_chest_boat": "Pale Oak Boat with Chest", "entity.minecraft.panda": "Panda", "entity.minecraft.parrot": "Parrot", "entity.minecraft.phantom": "Phantom", @@ -3409,6 +3425,8 @@ "entity.minecraft.spawner_minecart": "Minecart with Monster Spawner", "entity.minecraft.spectral_arrow": "Spectral Arrow", "entity.minecraft.spider": "Spider", + "entity.minecraft.spruce_boat": "Spruce Boat", + "entity.minecraft.spruce_chest_boat": "Spruce Boat with Chest", "entity.minecraft.squid": "Squid", "entity.minecraft.stray": "Stray", "entity.minecraft.strider": "Strider", @@ -3538,6 +3556,7 @@ "gamerule.commandModificationBlockLimit": "Command modification block limit", "gamerule.commandModificationBlockLimit.description": "Number of blocks that can be changed at once by one command, such as fill or clone.", "gamerule.disableElytraMovementCheck": "Disable elytra movement check", + "gamerule.disablePlayerMovementCheck": "Disable player movement check", "gamerule.disableRaids": "Disable raids", "gamerule.doDaylightCycle": "Advance time of day", "gamerule.doEntityDrops": "Drop entity equipment", @@ -3580,6 +3599,8 @@ "gamerule.maxCommandForkCount": "Command context limit", "gamerule.maxCommandForkCount.description": "Maximum number of contexts that can be used by commands like 'execute as'.", "gamerule.maxEntityCramming": "Entity cramming threshold", + "gamerule.minecartMaxSpeed": "Minecart max speed", + "gamerule.minecartMaxSpeed.description": "Maximum default speed of a moving Minecart on land.", "gamerule.mobExplosionDropDecay": "In mob explosions, some blocks won't drop their loot", "gamerule.mobExplosionDropDecay.description": "Some of the drops from blocks destroyed by explosions caused by mobs are lost in the explosion.", "gamerule.mobGriefing": "Allow destructive mob actions", @@ -3638,8 +3659,9 @@ "gui.abuseReport.error.title": "Problem sending your report", "gui.abuseReport.message": "Where did you observe the bad behavior?\nThis will help us in researching your case.", "gui.abuseReport.more_comments": "Please describe what happened:", + "gui.abuseReport.name.comment_box_label": "Please describe why you want to report this name:", "gui.abuseReport.name.reporting": "You are reporting \"%s\".", - "gui.abuseReport.name.title": "Report Player Name", + "gui.abuseReport.name.title": "Report Inappropriate Player Name", "gui.abuseReport.observed_what": "Why are you reporting this?", "gui.abuseReport.read_info": "Learn About Reporting", "gui.abuseReport.reason.alcohol_tobacco_drugs": "Drugs or alcohol", @@ -3663,10 +3685,12 @@ "gui.abuseReport.reason.non_consensual_intimate_imagery.description": "Someone is talking about, sharing, or otherwise promoting private and intimate images.", "gui.abuseReport.reason.self_harm_or_suicide": "Self-harm or suicide", "gui.abuseReport.reason.self_harm_or_suicide.description": "Someone is threatening to harm themselves in real life or talking about harming themselves in real life.", + "gui.abuseReport.reason.sexually_inappropriate": "Sexually inappropriate", + "gui.abuseReport.reason.sexually_inappropriate.description": "Skins that are graphic in nature relating to sexual acts, sexual organs, and sexual violence.", "gui.abuseReport.reason.terrorism_or_violent_extremism": "Terrorism or violent extremism", "gui.abuseReport.reason.terrorism_or_violent_extremism.description": "Someone is talking about, promoting, or threatening to commit acts of terrorism or violent extremism for political, religious, ideological, or other reasons.", "gui.abuseReport.reason.title": "Select Report Category", - "gui.abuseReport.report_sent_msg": "We’ve successfully received your report. Thank you!\n\nOur team will review it as soon as possible.", + "gui.abuseReport.report_sent_msg": "We've successfully received your report. Thank you!\n\nOur team will review it as soon as possible.", "gui.abuseReport.select_reason": "Select Report Category", "gui.abuseReport.send": "Send Report", "gui.abuseReport.send.comment_too_long": "Please shorten the comment", @@ -3689,11 +3713,11 @@ "gui.all": "All", "gui.back": "Back", "gui.banned.description": "%s\n\n%s\n\nLearn more at the following link: %s", - "gui.banned.description.permanent": "Your account is permanently banned, which means you can’t play online or join Realms.", + "gui.banned.description.permanent": "Your account is permanently banned, which means you can't play online or join Realms.", "gui.banned.description.reason": "We recently received a report for bad behavior by your account. Our moderators have now reviewed your case and identified it as %s, which goes against the Minecraft Community Standards.", "gui.banned.description.reason_id": "Code: %s", "gui.banned.description.reason_id_message": "Code: %s - %s", - "gui.banned.description.temporary": "%s Until then, you can’t play online or join Realms.", + "gui.banned.description.temporary": "%s Until then, you can't play online or join Realms.", "gui.banned.description.temporary.duration": "Your account is temporarily suspended and will be reactivated in %s.", "gui.banned.description.unknownreason": "We recently received a report for bad behavior by your account. Our moderators have now reviewed your case and identified that it goes against the Minecraft Community Standards.", "gui.banned.name.description": "Your current name - \"%s\" - violates our Community Standards. You can play singleplayer, but will need to change your name to play online.\n\nLearn more or submit a case review at the following link: %s", @@ -3732,7 +3756,7 @@ "gui.chatReport.more_comments": "Please describe what happened:", "gui.chatReport.observed_what": "Why are you reporting this?", "gui.chatReport.read_info": "Learn About Reporting", - "gui.chatReport.report_sent_msg": "We’ve successfully received your report. Thank you!\n\nOur team will review it as soon as possible.", + "gui.chatReport.report_sent_msg": "We've successfully received your report. Thank you!\n\nOur team will review it as soon as possible.", "gui.chatReport.select_chat": "Select Chat Messages to Report", "gui.chatReport.select_reason": "Select Report Category", "gui.chatReport.selected_chat": "%s Chat Message(s) Selected to Report", @@ -3755,7 +3779,7 @@ "gui.done": "Done", "gui.down": "Down", "gui.entity_tooltip.type": "Type: %s", - "gui.fileDropFailure.detail": "Rejected %d files", + "gui.fileDropFailure.detail": "Rejected %s files", "gui.fileDropFailure.title": "Failed to add files", "gui.hours": "%s hour(s)", "gui.loadingMinecraft": "Loading Minecraft", @@ -3866,18 +3890,22 @@ "item.minecraft.beetroot_soup": "Beetroot Soup", "item.minecraft.birch_boat": "Birch Boat", "item.minecraft.birch_chest_boat": "Birch Boat with Chest", + "item.minecraft.black_bundle": "Black Bundle", "item.minecraft.black_dye": "Black Dye", "item.minecraft.blade_pottery_shard": "Blade Pottery Shard", "item.minecraft.blade_pottery_sherd": "Blade Pottery Sherd", "item.minecraft.blaze_powder": "Blaze Powder", "item.minecraft.blaze_rod": "Blaze Rod", "item.minecraft.blaze_spawn_egg": "Blaze Spawn Egg", + "item.minecraft.blue_bundle": "Blue Bundle", "item.minecraft.blue_dye": "Blue Dye", "item.minecraft.bogged_spawn_egg": "Bogged Spawn Egg", "item.minecraft.bolt_armor_trim_smithing_template": "Smithing Template", + "item.minecraft.bolt_armor_trim_smithing_template.new": "Bolt Armor Trim", "item.minecraft.bone": "Bone", "item.minecraft.bone_meal": "Bone Meal", "item.minecraft.book": "Book", + "item.minecraft.bordure_indented_banner_pattern": "Bordure Indented Banner Pattern", "item.minecraft.bow": "Bow", "item.minecraft.bowl": "Bowl", "item.minecraft.bread": "Bread", @@ -3887,10 +3915,14 @@ "item.minecraft.brewer_pottery_sherd": "Brewer Pottery Sherd", "item.minecraft.brewing_stand": "Brewing Stand", "item.minecraft.brick": "Brick", + "item.minecraft.brown_bundle": "Brown Bundle", "item.minecraft.brown_dye": "Brown Dye", "item.minecraft.brush": "Brush", "item.minecraft.bucket": "Bucket", "item.minecraft.bundle": "Bundle", + "item.minecraft.bundle.empty": "Empty", + "item.minecraft.bundle.empty.description": "Can hold a mixed stack of items", + "item.minecraft.bundle.full": "Full", "item.minecraft.bundle.fullness": "%s/%s", "item.minecraft.burn_pottery_shard": "Burn Pottery Shard", "item.minecraft.burn_pottery_sherd": "Burn Pottery Sherd", @@ -3915,6 +3947,7 @@ "item.minecraft.clock": "Clock", "item.minecraft.coal": "Coal", "item.minecraft.coast_armor_trim_smithing_template": "Smithing Template", + "item.minecraft.coast_armor_trim_smithing_template.new": "Coast Armor Trim", "item.minecraft.cocoa_beans": "Cocoa Beans", "item.minecraft.cod": "Raw Cod", "item.minecraft.cod_bucket": "Bucket of Cod", @@ -3931,11 +3964,14 @@ "item.minecraft.cookie": "Cookie", "item.minecraft.copper_ingot": "Copper Ingot", "item.minecraft.cow_spawn_egg": "Cow Spawn Egg", + "item.minecraft.creaking_spawn_egg": "Creaking Spawn Egg", "item.minecraft.creeper_banner_pattern": "Banner Pattern", "item.minecraft.creeper_banner_pattern.desc": "Creeper Charge", + "item.minecraft.creeper_banner_pattern.new": "Creeper Charge Banner Pattern", "item.minecraft.creeper_spawn_egg": "Creeper Spawn Egg", "item.minecraft.crossbow": "Crossbow", "item.minecraft.crossbow.projectile": "Projectile:", + "item.minecraft.cyan_bundle": "Cyan Bundle", "item.minecraft.cyan_dye": "Cyan Dye", "item.minecraft.danger_pottery_shard": "Danger Pottery Shard", "item.minecraft.danger_pottery_sherd": "Danger Pottery Sherd", @@ -3964,6 +4000,7 @@ "item.minecraft.dried_kelp": "Dried Kelp", "item.minecraft.drowned_spawn_egg": "Drowned Spawn Egg", "item.minecraft.dune_armor_trim_smithing_template": "Smithing Template", + "item.minecraft.dune_armor_trim_smithing_template.new": "Dune Armor Trim", "item.minecraft.echo_shard": "Echo Shard", "item.minecraft.egg": "Egg", "item.minecraft.elder_guardian_spawn_egg": "Elder Guardian Spawn Egg", @@ -3982,8 +4019,10 @@ "item.minecraft.explorer_pottery_shard": "Explorer Pottery Shard", "item.minecraft.explorer_pottery_sherd": "Explorer Pottery Sherd", "item.minecraft.eye_armor_trim_smithing_template": "Smithing Template", + "item.minecraft.eye_armor_trim_smithing_template.new": "Eye Armor Trim", "item.minecraft.feather": "Feather", "item.minecraft.fermented_spider_eye": "Fermented Spider Eye", + "item.minecraft.field_masoned_banner_pattern": "Field Masoned Banner Pattern", "item.minecraft.filled_map": "Map", "item.minecraft.fire_charge": "Fire Charge", "item.minecraft.firework_rocket": "Firework Rocket", @@ -4019,11 +4058,14 @@ "item.minecraft.flint": "Flint", "item.minecraft.flint_and_steel": "Flint and Steel", "item.minecraft.flow_armor_trim_smithing_template": "Smithing Template", + "item.minecraft.flow_armor_trim_smithing_template.new": "Flow Armor Trim", "item.minecraft.flow_banner_pattern": "Banner Pattern", "item.minecraft.flow_banner_pattern.desc": "Flow", + "item.minecraft.flow_banner_pattern.new": "Flow Banner Pattern", "item.minecraft.flow_pottery_sherd": "Flow Pottery Sherd", "item.minecraft.flower_banner_pattern": "Banner Pattern", "item.minecraft.flower_banner_pattern.desc": "Flower Charge", + "item.minecraft.flower_banner_pattern.new": "Flower Charge Banner Pattern", "item.minecraft.flower_pot": "Flower Pot", "item.minecraft.fox_spawn_egg": "Fox Spawn Egg", "item.minecraft.friend_pottery_shard": "Friend Pottery Shard", @@ -4036,6 +4078,7 @@ "item.minecraft.glistering_melon_slice": "Glistering Melon Slice", "item.minecraft.globe_banner_pattern": "Banner Pattern", "item.minecraft.globe_banner_pattern.desc": "Globe", + "item.minecraft.globe_banner_pattern.new": "Globe Banner Pattern", "item.minecraft.glow_berries": "Glow Berries", "item.minecraft.glow_ink_sac": "Glow Ink Sac", "item.minecraft.glow_item_frame": "Glow Item Frame", @@ -4057,12 +4100,15 @@ "item.minecraft.golden_pickaxe": "Golden Pickaxe", "item.minecraft.golden_shovel": "Golden Shovel", "item.minecraft.golden_sword": "Golden Sword", + "item.minecraft.gray_bundle": "Gray Bundle", "item.minecraft.gray_dye": "Gray Dye", + "item.minecraft.green_bundle": "Green Bundle", "item.minecraft.green_dye": "Green Dye", "item.minecraft.guardian_spawn_egg": "Guardian Spawn Egg", "item.minecraft.gunpowder": "Gunpowder", "item.minecraft.guster_banner_pattern": "Banner Pattern", "item.minecraft.guster_banner_pattern.desc": "Guster", + "item.minecraft.guster_banner_pattern.new": "Guster Banner Pattern", "item.minecraft.guster_pottery_sherd": "Guster Pottery Sherd", "item.minecraft.heart_of_the_sea": "Heart of the Sea", "item.minecraft.heart_pottery_shard": "Heart Pottery Shard", @@ -4075,6 +4121,7 @@ "item.minecraft.hopper_minecart": "Minecart with Hopper", "item.minecraft.horse_spawn_egg": "Horse Spawn Egg", "item.minecraft.host_armor_trim_smithing_template": "Smithing Template", + "item.minecraft.host_armor_trim_smithing_template.new": "Host Armor Trim", "item.minecraft.howl_pottery_shard": "Howl Pottery Shard", "item.minecraft.howl_pottery_sherd": "Howl Pottery Sherd", "item.minecraft.husk_spawn_egg": "Husk Spawn Egg", @@ -4105,8 +4152,11 @@ "item.minecraft.leather_helmet": "Leather Cap", "item.minecraft.leather_horse_armor": "Leather Horse Armor", "item.minecraft.leather_leggings": "Leather Pants", + "item.minecraft.light_blue_bundle": "Light Blue Bundle", "item.minecraft.light_blue_dye": "Light Blue Dye", + "item.minecraft.light_gray_bundle": "Light Gray Bundle", "item.minecraft.light_gray_dye": "Light Gray Dye", + "item.minecraft.lime_bundle": "Lime Bundle", "item.minecraft.lime_dye": "Lime Dye", "item.minecraft.lingering_potion": "Lingering Potion", "item.minecraft.lingering_potion.effect.awkward": "Awkward Lingering Potion", @@ -4138,6 +4188,7 @@ "item.minecraft.llama_spawn_egg": "Llama Spawn Egg", "item.minecraft.lodestone_compass": "Lodestone Compass", "item.minecraft.mace": "Mace", + "item.minecraft.magenta_bundle": "Magenta Bundle", "item.minecraft.magenta_dye": "Magenta Dye", "item.minecraft.magma_cream": "Magma Cream", "item.minecraft.magma_cube_spawn_egg": "Magma Cube Spawn Egg", @@ -4152,6 +4203,7 @@ "item.minecraft.miner_pottery_sherd": "Miner Pottery Sherd", "item.minecraft.mojang_banner_pattern": "Banner Pattern", "item.minecraft.mojang_banner_pattern.desc": "Thing", + "item.minecraft.mojang_banner_pattern.new": "Thing Banner Pattern", "item.minecraft.mooshroom_spawn_egg": "Mooshroom Spawn Egg", "item.minecraft.mourner_pottery_shard": "Mourner Pottery Shard", "item.minecraft.mourner_pottery_sherd": "Mourner Pottery Sherd", @@ -4213,13 +4265,17 @@ "item.minecraft.netherite_shovel": "Netherite Shovel", "item.minecraft.netherite_sword": "Netherite Sword", "item.minecraft.netherite_upgrade_smithing_template": "Smithing Template", + "item.minecraft.netherite_upgrade_smithing_template.new": "Netherite Upgrade", "item.minecraft.oak_boat": "Oak Boat", "item.minecraft.oak_chest_boat": "Oak Boat with Chest", "item.minecraft.ocelot_spawn_egg": "Ocelot Spawn Egg", "item.minecraft.ominous_bottle": "Ominous Bottle", "item.minecraft.ominous_trial_key": "Ominous Trial Key", + "item.minecraft.orange_bundle": "Orange Bundle", "item.minecraft.orange_dye": "Orange Dye", "item.minecraft.painting": "Painting", + "item.minecraft.pale_oak_boat": "Pale Oak Boat", + "item.minecraft.pale_oak_chest_boat": "Pale Oak Boat with Chest", "item.minecraft.panda_spawn_egg": "Panda Spawn Egg", "item.minecraft.paper": "Paper", "item.minecraft.parrot_spawn_egg": "Parrot Spawn Egg", @@ -4228,9 +4284,11 @@ "item.minecraft.pig_spawn_egg": "Pig Spawn Egg", "item.minecraft.piglin_banner_pattern": "Banner Pattern", "item.minecraft.piglin_banner_pattern.desc": "Snout", + "item.minecraft.piglin_banner_pattern.new": "Snout Banner Pattern", "item.minecraft.piglin_brute_spawn_egg": "Piglin Brute Spawn Egg", "item.minecraft.piglin_spawn_egg": "Piglin Spawn Egg", "item.minecraft.pillager_spawn_egg": "Pillager Spawn Egg", + "item.minecraft.pink_bundle": "Pink Bundle", "item.minecraft.pink_dye": "Pink Dye", "item.minecraft.pitcher_plant": "Pitcher Plant", "item.minecraft.pitcher_pod": "Pitcher Pod", @@ -4282,6 +4340,7 @@ "item.minecraft.pufferfish_spawn_egg": "Pufferfish Spawn Egg", "item.minecraft.pumpkin_pie": "Pumpkin Pie", "item.minecraft.pumpkin_seeds": "Pumpkin Seeds", + "item.minecraft.purple_bundle": "Purple Bundle", "item.minecraft.purple_dye": "Purple Dye", "item.minecraft.quartz": "Nether Quartz", "item.minecraft.rabbit": "Raw Rabbit", @@ -4290,14 +4349,17 @@ "item.minecraft.rabbit_spawn_egg": "Rabbit Spawn Egg", "item.minecraft.rabbit_stew": "Rabbit Stew", "item.minecraft.raiser_armor_trim_smithing_template": "Smithing Template", + "item.minecraft.raiser_armor_trim_smithing_template.new": "Raiser Armor Trim", "item.minecraft.ravager_spawn_egg": "Ravager Spawn Egg", "item.minecraft.raw_copper": "Raw Copper", "item.minecraft.raw_gold": "Raw Gold", "item.minecraft.raw_iron": "Raw Iron", "item.minecraft.recovery_compass": "Recovery Compass", + "item.minecraft.red_bundle": "Red Bundle", "item.minecraft.red_dye": "Red Dye", "item.minecraft.redstone": "Redstone Dust", "item.minecraft.rib_armor_trim_smithing_template": "Smithing Template", + "item.minecraft.rib_armor_trim_smithing_template.new": "Rib Armor Trim", "item.minecraft.rotten_flesh": "Rotten Flesh", "item.minecraft.saddle": "Saddle", "item.minecraft.salmon": "Raw Salmon", @@ -4306,7 +4368,9 @@ "item.minecraft.scrape_pottery_sherd": "Scrape Pottery Sherd", "item.minecraft.scute": "Scute", "item.minecraft.sentry_armor_trim_smithing_template": "Smithing Template", + "item.minecraft.sentry_armor_trim_smithing_template.new": "Sentry Armor Trim", "item.minecraft.shaper_armor_trim_smithing_template": "Smithing Template", + "item.minecraft.shaper_armor_trim_smithing_template.new": "Shaper Armor Trim", "item.minecraft.sheaf_pottery_shard": "Sheaf Pottery Shard", "item.minecraft.sheaf_pottery_sherd": "Sheaf Pottery Sherd", "item.minecraft.shears": "Shears", @@ -4334,11 +4398,13 @@ "item.minecraft.shulker_spawn_egg": "Shulker Spawn Egg", "item.minecraft.sign": "Sign", "item.minecraft.silence_armor_trim_smithing_template": "Smithing Template", + "item.minecraft.silence_armor_trim_smithing_template.new": "Silence Armor Trim", "item.minecraft.silverfish_spawn_egg": "Silverfish Spawn Egg", "item.minecraft.skeleton_horse_spawn_egg": "Skeleton Horse Spawn Egg", "item.minecraft.skeleton_spawn_egg": "Skeleton Spawn Egg", "item.minecraft.skull_banner_pattern": "Banner Pattern", "item.minecraft.skull_banner_pattern.desc": "Skull Charge", + "item.minecraft.skull_banner_pattern.new": "Skull Charge Banner Pattern", "item.minecraft.skull_pottery_shard": "Skull Pottery Shard", "item.minecraft.skull_pottery_sherd": "Skull Pottery Sherd", "item.minecraft.slime_ball": "Slimeball", @@ -4359,12 +4425,14 @@ "item.minecraft.snort_pottery_shard": "Snort Pottery Shard", "item.minecraft.snort_pottery_sherd": "Snort Pottery Sherd", "item.minecraft.snout_armor_trim_smithing_template": "Smithing Template", + "item.minecraft.snout_armor_trim_smithing_template.new": "Snout Armor Trim", "item.minecraft.snow_golem_spawn_egg": "Snow Golem Spawn Egg", "item.minecraft.snowball": "Snowball", "item.minecraft.spectral_arrow": "Spectral Arrow", "item.minecraft.spider_eye": "Spider Eye", "item.minecraft.spider_spawn_egg": "Spider Spawn Egg", "item.minecraft.spire_armor_trim_smithing_template": "Smithing Template", + "item.minecraft.spire_armor_trim_smithing_template.new": "Spire Armor Trim", "item.minecraft.splash_potion": "Splash Potion", "item.minecraft.splash_potion.effect.awkward": "Awkward Splash Potion", "item.minecraft.splash_potion.effect.empty": "Splash Uncraftable Potion", @@ -4411,6 +4479,7 @@ "item.minecraft.tadpole_bucket": "Bucket of Tadpole", "item.minecraft.tadpole_spawn_egg": "Tadpole Spawn Egg", "item.minecraft.tide_armor_trim_smithing_template": "Smithing Template", + "item.minecraft.tide_armor_trim_smithing_template.new": "Tide Armor Trim", "item.minecraft.tipped_arrow": "Tipped Arrow", "item.minecraft.tipped_arrow.effect.awkward": "Tipped Arrow", "item.minecraft.tipped_arrow.effect.empty": "Uncraftable Tipped Arrow", @@ -4451,19 +4520,24 @@ "item.minecraft.turtle_scute": "Turtle Scute", "item.minecraft.turtle_spawn_egg": "Turtle Spawn Egg", "item.minecraft.vex_armor_trim_smithing_template": "Smithing Template", + "item.minecraft.vex_armor_trim_smithing_template.new": "Vex Armor Trim", "item.minecraft.vex_spawn_egg": "Vex Spawn Egg", "item.minecraft.villager_spawn_egg": "Villager Spawn Egg", "item.minecraft.vindicator_spawn_egg": "Vindicator Spawn Egg", "item.minecraft.wandering_trader_spawn_egg": "Wandering Trader Spawn Egg", "item.minecraft.ward_armor_trim_smithing_template": "Smithing Template", + "item.minecraft.ward_armor_trim_smithing_template.new": "Ward Armor Trim", "item.minecraft.warden_spawn_egg": "Warden Spawn Egg", "item.minecraft.warped_fungus_on_a_stick": "Warped Fungus on a Stick", "item.minecraft.water_bucket": "Water Bucket", "item.minecraft.wayfinder_armor_trim_smithing_template": "Smithing Template", + "item.minecraft.wayfinder_armor_trim_smithing_template.new": "Wayfinder Armor Trim", "item.minecraft.wheat": "Wheat", "item.minecraft.wheat_seeds": "Wheat Seeds", + "item.minecraft.white_bundle": "White Bundle", "item.minecraft.white_dye": "White Dye", "item.minecraft.wild_armor_trim_smithing_template": "Smithing Template", + "item.minecraft.wild_armor_trim_smithing_template.new": "Wild Armor Trim", "item.minecraft.wind_charge": "Wind Charge", "item.minecraft.witch_spawn_egg": "Witch Spawn Egg", "item.minecraft.wither_skeleton_spawn_egg": "Wither Skeleton Spawn Egg", @@ -4477,6 +4551,7 @@ "item.minecraft.wooden_sword": "Wooden Sword", "item.minecraft.writable_book": "Book and Quill", "item.minecraft.written_book": "Written Book", + "item.minecraft.yellow_bundle": "Yellow Bundle", "item.minecraft.yellow_dye": "Yellow Dye", "item.minecraft.zoglin_spawn_egg": "Zoglin Spawn Egg", "item.minecraft.zombie_horse_spawn_egg": "Zombie Horse Spawn Egg", @@ -4546,7 +4621,7 @@ "jukebox_song.minecraft.ward": "C418 - ward", "key.advancements": "Advancements", "key.attack": "Attack/Destroy", - "key.back": "Walk Backwards", + "key.back": "Walk Backward", "key.categories.creative": "Creative Mode", "key.categories.gameplay": "Gameplay", "key.categories.inventory": "Inventory", @@ -4557,7 +4632,7 @@ "key.chat": "Open Chat", "key.command": "Open Command", "key.drop": "Drop Selected Item", - "key.forward": "Walk Forwards", + "key.forward": "Walk Forward", "key.fullscreen": "Toggle Fullscreen", "key.hotbar.1": "Hotbar Slot 1", "key.hotbar.2": "Hotbar Slot 2", @@ -4700,8 +4775,8 @@ "loading.progress": "%s%%", "mco.account.privacy.info": "Read more about Mojang and privacy laws", "mco.account.privacy.info.button": "Read more about GDPR", - "mco.account.privacy.information": "Mojang implements certain procedures to help protect children and their privacy including complying with the Children’s Online Privacy Protection Act (COPPA) and General Data Protection Regulation (GDPR).\n\nYou may need to obtain parental consent before accessing your Realms account.", - "mco.account.privacyinfo": "Mojang implements certain procedures to help protect children and their privacy including complying with the Children’s Online Privacy Protection Act (COPPA) and General Data Protection Regulation (GDPR).\n\nYou may need to obtain parental consent before accessing your Realms account.\n\nIf you have an older Minecraft account (you log in with your username), you need to migrate the account to a Mojang account in order to access Realms.", + "mco.account.privacy.information": "Mojang implements certain procedures to help protect children and their privacy including complying with the Children's Online Privacy Protection Act (COPPA) and General Data Protection Regulation (GDPR).\n\nYou may need to obtain parental consent before accessing your Realms account.", + "mco.account.privacyinfo": "Mojang implements certain procedures to help protect children and their privacy including complying with the Children's Online Privacy Protection Act (COPPA) and General Data Protection Regulation (GDPR).\n\nYou may need to obtain parental consent before accessing your Realms account.\n\nIf you have an older Minecraft account (you log in with your username), you need to migrate the account to a Mojang account in order to access Realms.", "mco.account.update": "Update account", "mco.activity.noactivity": "No activity for the past %s day(s)", "mco.activity.title": "Player activity", @@ -4855,6 +4930,7 @@ "mco.connect.success": "Done", "mco.create.world": "Create", "mco.create.world.error": "You must enter a name!", + "mco.create.world.failed": "Failed to create world!", "mco.create.world.reset.title": "Creating world...", "mco.create.world.skip": "Skip", "mco.create.world.subtitle": "Optionally, select what world to put on your new realm", @@ -4886,6 +4962,7 @@ "mco.errorMessage.6009": "Invalid Realm description", "mco.errorMessage.connectionFailure": "An error occurred, please try again later.", "mco.errorMessage.generic": "An error occurred: ", + "mco.errorMessage.initialize.failed": "Failed to initialize Realm", "mco.errorMessage.noDetails": "No error details provided", "mco.errorMessage.realmsService": "An error occurred (%s):", "mco.errorMessage.realmsService.connectivity": "Could not connect to Realms: %s", @@ -5014,6 +5091,8 @@ "mco.upload.entry.commands": "%1$s, %2$s", "mco.upload.entry.id": "%1$s (%2$s)", "mco.upload.failed": "Upload failed! (%s)", + "mco.upload.failed.too_big.description": "The selected world is too big. The maximum allowed size is %s.", + "mco.upload.failed.too_big.title": "World too big", "mco.upload.hardcore": "Hardcore worlds can't be uploaded!", "mco.upload.percent": "%s %%", "mco.upload.preparing": "Preparing your world", @@ -5027,15 +5106,10 @@ "mco.version": "Version: %s", "mco.warning": "Warning!", "mco.worldSlot.minigame": "Minigame", - "menu.convertingLevel": "Converting world", "menu.disconnect": "Disconnect", "menu.feedback": "Feedback...", "menu.feedback.title": "Feedback", "menu.game": "Game Menu", - "menu.generatingLevel": "Generating world", - "menu.generatingTerrain": "Building terrain", - "menu.loadingForcedChunks": "Loading forced chunks for dimension %s", - "menu.loadingLevel": "Loading world", "menu.modded": " (Modded)", "menu.multiplayer": "Multiplayer", "menu.online": "Minecraft Realms", @@ -5047,7 +5121,6 @@ "menu.quit": "Quit Game", "menu.reportBugs": "Report Bugs", "menu.resetdemo": "Reset Demo World", - "menu.respawning": "Respawning", "menu.returnToGame": "Back to Game", "menu.returnToMenu": "Save and Quit to Title", "menu.savingChunks": "Saving chunks", @@ -5058,14 +5131,12 @@ "menu.shareToLan": "Open to LAN", "menu.singleplayer": "Singleplayer", "menu.working": "Working...", - "merchant.current_level": "Trader's current level", "merchant.deprecated": "Villagers restock up to two times per day.", "merchant.level.1": "Novice", "merchant.level.2": "Apprentice", "merchant.level.3": "Journeyman", "merchant.level.4": "Expert", "merchant.level.5": "Master", - "merchant.next_level": "Trader's next level", "merchant.title": "%s - %s", "merchant.trades": "Trades", "mirror.front_back": "↑ ↓", @@ -5171,8 +5242,8 @@ "narration.selection.usage": "Press up and down buttons to move to another entry", "narration.slider.usage.focused": "Press left or right keyboard buttons to change value", "narration.slider.usage.hovered": "Drag slider to change value", - "narration.suggestion": "Selected suggestion %d out of %d: %s", - "narration.suggestion.tooltip": "Selected suggestion %d out of %d: %s (%s)", + "narration.suggestion": "Selected suggestion %s out of %s: %s", + "narration.suggestion.tooltip": "Selected suggestion %s out of %s: %s (%s)", "narration.suggestion.usage.cycle.fixed": "Press Tab to cycle to the next suggestion", "narration.suggestion.usage.cycle.hidable": "Press Tab to cycle to the next suggestion, or Escape to leave suggestions", "narration.suggestion.usage.fill.fixed": "Press Tab to use suggestion", @@ -5202,6 +5273,7 @@ "narrator.toast.disabled": "Narrator Disabled", "narrator.toast.enabled": "Narrator Enabled", "optimizeWorld.confirm.description": "This will attempt to optimize your world by making sure all data is stored in the most recent game format. This can take a very long time, depending on your world. Once done, your world may play faster but will no longer be compatible with older versions of the game. Are you sure you wish to proceed?", + "optimizeWorld.confirm.proceed": "Create Backup and Optimize", "optimizeWorld.confirm.title": "Optimize World", "optimizeWorld.info.converted": "Upgraded chunks: %s", "optimizeWorld.info.skipped": "Skipped chunks: %s", @@ -5221,6 +5293,8 @@ "optimizeWorld.title": "Optimizing World '%s'", "options.accessibility": "Accessibility Settings...", "options.accessibility.high_contrast": "High Contrast", + "options.accessibility.high_contrast_block_outline": "High Contrast Block Outlines", + "options.accessibility.high_contrast_block_outline.tooltip": "Enhances the block outline contrast of the targeted block.", "options.accessibility.high_contrast.error.tooltip": "High Contrast resource pack is not available.", "options.accessibility.high_contrast.tooltip": "Enhances the contrast of UI elements.", "options.accessibility.link": "Accessibility Guide", @@ -5260,7 +5334,7 @@ "options.biomeBlendRadius.15": "15x15 (Maximum)", "options.chat": "Chat Settings...", "options.chat.color": "Colors", - "options.chat.delay": "Chat Delay: %s seconds", + "options.chat.delay": "Chat Delay: %s second(s)", "options.chat.delay_none": "Chat Delay: None", "options.chat.height.focused": "Focused Height", "options.chat.height.unfocused": "Unfocused Height", @@ -5280,7 +5354,6 @@ "options.clouds.fast": "Fast", "options.controls": "Controls...", "options.credits_and_attribution": "Credits & Attribution...", - "options.customizeTitle": "Customize World Settings", "options.damageTiltStrength": "Damage Tilt", "options.damageTiltStrength.tooltip": "The amount of camera shake caused by being hurt.", "options.darkMojangStudiosBackgroundColor": "Monochrome Logo", @@ -5352,6 +5425,11 @@ "options.hideMatchedNames.tooltip": "3rd-party Servers may send chat messages in non-standard formats.\nWith this option on, hidden players will be matched based on chat sender names.", "options.hideSplashTexts": "Hide Splash Texts", "options.hideSplashTexts.tooltip": "Hides the yellow splash text in the main menu.", + "options.inactivityFpsLimit": "Reduce FPS when", + "options.inactivityFpsLimit.afk": "AFK", + "options.inactivityFpsLimit.afk.tooltip": "Limits framerate to 30 when the game is not getting any player input for more than a minute. Further limits it to 10 after 9 more minutes.", + "options.inactivityFpsLimit.minimized": "Minimized", + "options.inactivityFpsLimit.minimized.tooltip": "Limits framerate only when the game window is minimized.", "options.invertMouse": "Invert Mouse", "options.japaneseGlyphVariants": "Japanese Glyph Variants", "options.japaneseGlyphVariants.tooltip": "Uses Japanese variants of CJK characters in the default font.", @@ -5415,6 +5493,8 @@ "options.renderClouds": "Clouds", "options.renderDistance": "Render Distance", "options.resourcepack": "Resource Packs...", + "options.rotateWithMinecart": "Rotate with Minecarts", + "options.rotateWithMinecart.tooltip": "Whether the player's view should rotate with a turning Minecart. Only available in worlds with the 'Minecart Improvements' experimental setting turned on.", "options.screenEffectScale": "Distortion Effects", "options.screenEffectScale.tooltip": "Strength of nausea and Nether portal screen distortion effects.\nAt lower values, the nausea effect is replaced with a green overlay.", "options.sensitivity": "Sensitivity", @@ -5597,7 +5677,6 @@ "quickplay.error.realm_connect": "Could not connect to Realm", "quickplay.error.realm_permission": "Lacking permission to connect to this Realm", "quickplay.error.title": "Failed to Quick Play", - "realms.missing.module.error.text": "Realms could not be opened right now, please try again later", "realms.missing.snapshot.error.text": "Realms is currently not supported in snapshots", "recipe.notFound": "Unknown recipe: %s", "recipe.toast.description": "Check your recipe book", @@ -5625,6 +5704,7 @@ "resourcePack.programmer_art.name": "Programmer Art", "resourcepack.progress": "Downloading file (%s MB)...", "resourcepack.requesting": "Making Request...", + "resourcePack.runtime_failure": "Resource pack error detected", "resourcePack.server.name": "World Specific Resources", "resourcePack.title": "Select Resource Packs", "resourcePack.vanilla.description": "The default look and feel of Minecraft", @@ -5642,7 +5722,6 @@ "selectServer.hiddenAddress": "(Hidden)", "selectServer.refresh": "Refresh", "selectServer.select": "Join Server", - "selectServer.title": "Select Server", "selectWorld.access_failure": "Failed to access world", "selectWorld.allowCommands": "Allow Cheats", "selectWorld.allowCommands.info": "Commands like /gamemode, /experience", @@ -5664,7 +5743,6 @@ "selectWorld.conversion": "Must be converted!", "selectWorld.conversion.tooltip": "This world must be opened in an older version (like 1.6.4) to be safely converted", "selectWorld.create": "Create New World", - "selectWorld.createDemo": "Play New Demo World", "selectWorld.customizeType": "Customize", "selectWorld.data_read": "Reading world data...", "selectWorld.dataPacks": "Data Packs", @@ -5846,7 +5924,6 @@ "stat.minecraft.interact_with_smoker": "Interactions with Smoker", "stat.minecraft.interact_with_stonecutter": "Interactions with Stonecutter", "stat.minecraft.jump": "Jumps", - "stat.minecraft.junk_fished": "Junk Fished", "stat.minecraft.leave_game": "Games Quit", "stat.minecraft.minecart_one_cm": "Distance by Minecart", "stat.minecraft.mob_kills": "Mob Kills", @@ -5862,7 +5939,6 @@ "stat.minecraft.pot_flower": "Plants Potted", "stat.minecraft.raid_trigger": "Raids Triggered", "stat.minecraft.raid_win": "Raids Won", - "stat.minecraft.ring_bell": "Bells Rung", "stat.minecraft.sleep_in_bed": "Times Slept in a Bed", "stat.minecraft.sneak_time": "Sneak Time", "stat.minecraft.sprint_one_cm": "Distance Sprinted", @@ -5874,7 +5950,6 @@ "stat.minecraft.time_since_rest": "Time Since Last Rest", "stat.minecraft.total_world_time": "Time with World Open", "stat.minecraft.traded_with_villager": "Traded with Villagers", - "stat.minecraft.treasure_fished": "Treasure Fished", "stat.minecraft.trigger_trapped_chest": "Trapped Chests Triggered", "stat.minecraft.tune_noteblock": "Note Blocks Tuned", "stat.minecraft.use_cauldron": "Water Taken from Cauldron", @@ -5883,7 +5958,6 @@ "stat.minecraft.walk_under_water_one_cm": "Distance Walked under Water", "stat.mobsButton": "Mobs", "stats.none": "-", - "stats.tooltip.type.statistic": "Statistic", "structure_block.button.detect_size": "DETECT", "structure_block.button.load": "LOAD", "structure_block.button.save": "SAVE", @@ -5976,6 +6050,9 @@ "subtitles.block.copper_trapdoor.open": "Trapdoor opens", "subtitles.block.crafter.craft": "Crafter crafts", "subtitles.block.crafter.fail": "Crafter fails crafting", + "subtitles.block.creaking_heart.hurt": "Creaking Heart screams", + "subtitles.block.creaking_heart.idle": "Eerie noise", + "subtitles.block.creaking_heart.spawn": "Creaking Heart awakens", "subtitles.block.decorated_pot.insert": "Decorated Pot fills", "subtitles.block.decorated_pot.insert_fail": "Decorated Pot wobbles", "subtitles.block.decorated_pot.shatter": "Decorated Pot shatters", @@ -6004,6 +6081,7 @@ "subtitles.block.lava.extinguish": "Lava hisses", "subtitles.block.lever.click": "Lever clicks", "subtitles.block.note_block.note": "Note Block plays", + "subtitles.block.pale_hanging_moss.idle": "Eerie noise", "subtitles.block.piston.move": "Piston moves", "subtitles.block.pointed_dripstone.drip_lava": "Lava drips", "subtitles.block.pointed_dripstone.drip_lava_into_cauldron": "Lava drips into Cauldron", @@ -6162,6 +6240,16 @@ "subtitles.entity.cow.death": "Cow dies", "subtitles.entity.cow.hurt": "Cow hurts", "subtitles.entity.cow.milk": "Cow gets milked", + "subtitles.entity.creaking.activate": "Creaking activates", + "subtitles.entity.creaking.ambient": "Creaking creaks", + "subtitles.entity.creaking.angry": "Creaking sees player", + "subtitles.entity.creaking.attack": "Creaking attacks", + "subtitles.entity.creaking.deactivate": "Creaking deactivates", + "subtitles.entity.creaking.death": "Creaking dies", + "subtitles.entity.creaking.freeze": "Creaking stops", + "subtitles.entity.creaking.spawn": "Creaking lives", + "subtitles.entity.creaking.sway": "Creaking is shielded", + "subtitles.entity.creaking.unfreeze": "Creaking moves", "subtitles.entity.creeper.death": "Creeper dies", "subtitles.entity.creeper.hurt": "Creeper hurts", "subtitles.entity.creeper.primed": "Creeper hisses", @@ -6379,6 +6467,7 @@ "subtitles.entity.parrot.imitate.blaze": "Parrot breathes", "subtitles.entity.parrot.imitate.bogged": "Parrot rattles", "subtitles.entity.parrot.imitate.breeze": "Parrot whirs", + "subtitles.entity.parrot.imitate.creaking": "Parrot creaks", "subtitles.entity.parrot.imitate.creeper": "Parrot hisses", "subtitles.entity.parrot.imitate.drowned": "Parrot gurgles", "subtitles.entity.parrot.imitate.elder_guardian": "Parrot moans", @@ -6704,6 +6793,7 @@ "subtitles.item.bucket.fill_tadpole": "Tadpole captured", "subtitles.item.bundle.drop_contents": "Bundle empties", "subtitles.item.bundle.insert": "Item packed", + "subtitles.item.bundle.insert_fail": "Bundle full", "subtitles.item.bundle.remove_one": "Item unpacked", "subtitles.item.chorus_fruit.teleport": "Player teleports", "subtitles.item.crop.plant": "Crop planted", @@ -6743,6 +6833,7 @@ "subtitles.item.wolf_armor.repair": "Wolf Armor is repaired", "subtitles.particle.soul_escape": "Soul escapes", "subtitles.ui.cartography_table.take_result": "Map drawn", + "subtitles.ui.hud.bubble_pop": "Breath meter dropping", "subtitles.ui.loom.take_result": "Loom used", "subtitles.ui.stonecutter.take_result": "Stonecutter used", "subtitles.weather.rain": "Rain falls", @@ -6778,7 +6869,7 @@ "telemetry.event.performance_metrics.description": "Knowing the overall performance profile of Minecraft helps us tune and optimize the game for a wide range of machine specifications and operating systems. \nGame version is included to help us compare the performance profile for new versions of Minecraft.", "telemetry.event.performance_metrics.title": "Performance Metrics", "telemetry.event.required": "%s (Required)", - "telemetry.event.world_load_times.description": "It’s important for us to understand how long it takes to join a world, and how that changes over time. For example, when we add new features or do larger technical changes, we need to see what impact that had on load times.", + "telemetry.event.world_load_times.description": "It's important for us to understand how long it takes to join a world, and how that changes over time. For example, when we add new features or do larger technical changes, we need to see what impact that had on load times.", "telemetry.event.world_load_times.title": "World Load Times", "telemetry.event.world_loaded.description": "Knowing how players play Minecraft (such as Game Mode, client or server modded, and game version) allows us to focus game updates to improve the areas that players care about most.\nThe World Loaded event is paired with the World Unloaded event to calculate how long the play session has lasted.", "telemetry.event.world_loaded.title": "World Loaded", diff --git a/assets/minecraft/models/block/bee_nest.json b/assets/minecraft/models/block/bee_nest_empty.json similarity index 100% rename from assets/minecraft/models/block/bee_nest.json rename to assets/minecraft/models/block/bee_nest_empty.json diff --git a/assets/minecraft/models/block/beehive.json b/assets/minecraft/models/block/beehive_empty.json similarity index 100% rename from assets/minecraft/models/block/beehive.json rename to assets/minecraft/models/block/beehive_empty.json diff --git a/assets/minecraft/models/block/comparator.json b/assets/minecraft/models/block/comparator.json index f0203eae..d886187c 100644 --- a/assets/minecraft/models/block/comparator.json +++ b/assets/minecraft/models/block/comparator.json @@ -22,34 +22,31 @@ { "from": [ 4, 2, 11 ], "to": [ 6, 7, 13 ], "faces": { - "down": { "uv": [ 7, 13, 9, 15 ], "texture": "#unlit" }, - "up": { "uv": [ 7, 6, 9, 8 ], "texture": "#unlit" }, - "north": { "uv": [ 7, 6, 9, 11 ], "texture": "#unlit" }, - "south": { "uv": [ 7, 6, 9, 11 ], "texture": "#unlit" }, - "west": { "uv": [ 7, 6, 9, 11 ], "texture": "#unlit" }, - "east": { "uv": [ 7, 6, 9, 11 ], "texture": "#unlit" } + "up": { "uv": [ 7, 6, 9, 8 ], "texture": "#unlit" }, + "north": { "uv": [ 7, 6, 9, 11 ], "texture": "#unlit" }, + "south": { "uv": [ 7, 6, 9, 11 ], "texture": "#unlit" }, + "west": { "uv": [ 7, 6, 9, 11 ], "texture": "#unlit" }, + "east": { "uv": [ 7, 6, 9, 11 ], "texture": "#unlit" } } }, { "from": [ 10, 2, 11 ], "to": [ 12, 7, 13 ], "faces": { - "down": { "uv": [ 7, 13, 9, 15 ], "texture": "#unlit" }, - "up": { "uv": [ 7, 6, 9, 8 ], "texture": "#unlit" }, - "north": { "uv": [ 7, 6, 9, 11 ], "texture": "#unlit" }, - "south": { "uv": [ 7, 6, 9, 11 ], "texture": "#unlit" }, - "west": { "uv": [ 7, 6, 9, 11 ], "texture": "#unlit" }, - "east": { "uv": [ 7, 6, 9, 11 ], "texture": "#unlit" } + "up": { "uv": [ 7, 6, 9, 8 ], "texture": "#unlit" }, + "north": { "uv": [ 7, 6, 9, 11 ], "texture": "#unlit" }, + "south": { "uv": [ 7, 6, 9, 11 ], "texture": "#unlit" }, + "west": { "uv": [ 7, 6, 9, 11 ], "texture": "#unlit" }, + "east": { "uv": [ 7, 6, 9, 11 ], "texture": "#unlit" } } }, { "from": [ 7, 2, 2 ], - "to": [ 9, 4, 4 ], + "to": [ 9, 5, 4 ], "faces": { - "down": { "uv": [ 7, 13, 9, 15 ], "texture": "#unlit" }, - "up": { "uv": [ 7, 6, 9, 8 ], "texture": "#unlit" }, - "north": { "uv": [ 7, 6, 9, 8 ], "texture": "#unlit" }, - "south": { "uv": [ 7, 6, 9, 8 ], "texture": "#unlit" }, - "west": { "uv": [ 7, 6, 9, 8 ], "texture": "#unlit" }, - "east": { "uv": [ 7, 6, 9, 8 ], "texture": "#unlit" } + "up": { "uv": [ 7, 6, 9, 8 ], "texture": "#unlit" }, + "north": { "uv": [ 7, 6, 9, 9 ], "texture": "#unlit" }, + "south": { "uv": [ 7, 6, 9, 9 ], "texture": "#unlit" }, + "west": { "uv": [ 7, 6, 9, 9 ], "texture": "#unlit" }, + "east": { "uv": [ 7, 6, 9, 9 ], "texture": "#unlit" } } } ] diff --git a/assets/minecraft/models/block/comparator_on.json b/assets/minecraft/models/block/comparator_on.json index caa96734..00133846 100644 --- a/assets/minecraft/models/block/comparator_on.json +++ b/assets/minecraft/models/block/comparator_on.json @@ -19,55 +19,132 @@ "east": { "uv": [ 0, 14, 16, 16 ], "texture": "#slab", "cullface": "east" } } }, - { "from": [ 4, 7, 11 ], + { "from": [ 4, 2, 11 ], "to": [ 6, 7, 13 ], + "shade": false, "faces": { - "up": { "uv": [ 7, 6, 9, 8 ], "texture": "#lit" } - } - }, - { "from": [ 4, 2, 10 ], - "to": [ 6, 8, 14 ], - "faces": { - "west": { "uv": [ 6, 5, 10, 11 ], "texture": "#lit" }, - "east": { "uv": [ 6, 5, 10, 11 ], "texture": "#lit" } - } - }, - { "from": [ 3, 2, 11 ], - "to": [ 7, 8, 13 ], - "faces": { - "north": { "uv": [ 6, 5, 10, 11 ], "texture": "#lit" }, - "south": { "uv": [ 6, 5, 10, 11 ], "texture": "#lit" } - } - }, - { "from": [ 10, 7, 11 ], - "to": [ 12, 7, 13 ], - "faces": { - "up": { "uv": [ 7, 6, 9, 8 ], "texture": "#lit" } - } - }, - { "from": [ 10, 2, 10 ], - "to": [ 12, 8, 14 ], - "faces": { - "west": { "uv": [ 6, 5, 10, 11 ], "texture": "#lit" }, - "east": { "uv": [ 6, 5, 10, 11 ], "texture": "#lit" } - } - }, - { "from": [ 9, 2, 11 ], - "to": [ 13, 8, 13 ], - "faces": { - "north": { "uv": [ 6, 5, 10, 11 ], "texture": "#lit" }, - "south": { "uv": [ 6, 5, 10, 11 ], "texture": "#lit" } + "up": { "uv": [ 7, 6, 9, 8 ], "texture": "#lit" }, + "north": { "uv": [ 7, 6, 9, 11 ], "texture": "#lit" }, + "south": { "uv": [ 7, 6, 9, 11 ], "texture": "#lit" }, + "west": { "uv": [ 7, 6, 9, 11 ], "texture": "#lit" }, + "east": { "uv": [ 7, 6, 9, 11 ], "texture": "#lit" } } }, { "from": [ 7, 2, 2 ], - "to": [ 9, 4, 4 ], + "to": [ 9, 5, 4 ], "faces": { - "down": { "uv": [ 7, 13, 9, 15 ], "texture": "#unlit" }, - "up": { "uv": [ 7, 6, 9, 8 ], "texture": "#unlit" }, - "north": { "uv": [ 7, 6, 9, 8 ], "texture": "#unlit" }, - "south": { "uv": [ 7, 6, 9, 8 ], "texture": "#unlit" }, - "west": { "uv": [ 7, 6, 9, 8 ], "texture": "#unlit" }, - "east": { "uv": [ 7, 6, 9, 8 ], "texture": "#unlit" } + "up": { "uv": [ 7, 6, 9, 8 ], "texture": "#unlit" }, + "north": { "uv": [ 7, 6, 9, 9 ], "texture": "#unlit" }, + "south": { "uv": [ 7, 6, 9, 9 ], "texture": "#unlit" }, + "west": { "uv": [ 7, 6, 9, 9 ], "texture": "#unlit" }, + "east": { "uv": [ 7, 6, 9, 9 ], "texture": "#unlit" } + } + }, + { "from": [ 10, 2, 11 ], + "to": [ 12, 7, 13 ], + "shade": false, + "faces": { + "up": { "uv": [ 7, 6, 9, 8 ], "texture": "#lit" }, + "north": { "uv": [ 7, 6, 9, 11 ], "texture": "#lit" }, + "south": { "uv": [ 7, 6, 9, 11 ], "texture": "#lit" }, + "west": { "uv": [ 7, 6, 9, 11 ], "texture": "#lit" }, + "east": { "uv": [ 7, 6, 9, 11 ], "texture": "#lit" } + } + }, + { + "from": [ 3.5, 1.5, 10.5 ], + "to": [ 6.5, 4.5, 13.5 ], + "shade": false, + "faces": { + "up": { "uv": [ 6, 5, 7, 6 ], "texture": "#lit" } + } + }, + { + "from": [ 3.5, 7.5, 10.5 ], + "to": [ 6.5, 10.5, 13.5 ], + "shade": false, + "faces": { + "down": { "uv": [ 6, 5, 7, 6 ], "texture": "#lit" } + } + }, + { + "from": [ 3.5, 4.5, 7.5 ], + "to": [ 6.5, 7.5, 10.5 ], + "shade": false, + "faces": { + "south": { "uv": [ 6, 5, 7, 6 ], "texture": "#lit" } + } + }, + { + "from": [ 3.5, 4.5, 13.5 ], + "to": [ 6.5, 7.5, 16.5 ], + "shade": false, + "faces": { + "north": { "uv": [ 6, 5, 7, 6 ], "texture": "#lit" } + } + }, + { + "from": [ 0.5, 4.5, 10.5 ], + "to": [ 3.5, 7.5, 13.5 ], + "shade": false, + "faces": { + "east": { "uv": [ 6, 5, 7, 6 ], "texture": "#lit" } + } + }, + { + "from": [ 6.5, 4.5, 10.5 ], + "to": [ 9.5, 7.5, 13.5 ], + "shade": false, + "faces": { + "west": { "uv": [ 6, 5, 7, 6 ], "texture": "#lit" } + } + }, + { + "from": [ 9.5, 1.5, 10.5 ], + "to": [ 12.5, 4.5, 13.5 ], + "shade": false, + "faces": { + "up": { "uv": [ 6, 5, 7, 6 ], "texture": "#lit" } + } + }, + { + "from": [ 9.5, 7.5, 10.5 ], + "to": [ 12.5, 10.5, 13.5 ], + "shade": false, + "faces": { + "down": { "uv": [ 6, 5, 7, 6 ], "texture": "#lit" } + } + }, + { + "from": [ 9.5, 4.5, 7.5 ], + "to": [ 12.5, 7.5, 10.5 ], + "shade": false, + "faces": { + "south": { "uv": [ 6, 5, 7, 6 ], "texture": "#lit" } + } + }, + { + "from": [ 9.5, 4.5, 13.5 ], + "to": [ 12.5, 7.5, 16.5 ], + "shade": false, + "faces": { + "north": { "uv": [ 6, 5, 7, 6 ], "texture": "#lit" } + } + }, + { + "from": [ 6.5, 4.5, 10.5 ], + "to": [ 9.5, 7.5, 13.5 ], + "shade": false, + "faces": { + "east": { "uv": [ 6, 5, 7, 6 ], "texture": "#lit" } + } + }, + { + "from": [ 12.5, 4.5, 10.5 ], + "to": [ 15.5, 7.5, 13.5 ], + "shade": false, + "faces": { + "west": { "uv": [ 6, 5, 7, 6 ], "texture": "#lit" } } } ] diff --git a/assets/minecraft/models/block/comparator_on_subtract.json b/assets/minecraft/models/block/comparator_on_subtract.json index 061cc0be..7d86c2ba 100644 --- a/assets/minecraft/models/block/comparator_on_subtract.json +++ b/assets/minecraft/models/block/comparator_on_subtract.json @@ -19,64 +19,181 @@ "east": { "uv": [ 0, 14, 16, 16 ], "texture": "#slab", "cullface": "east" } } }, - { "from": [ 4, 7, 11 ], - "to": [ 6, 7, 13 ], - "faces": { - "up": { "uv": [ 7, 6, 9, 8 ], "texture": "#lit" } - } - }, - { "from": [ 4, 2, 10 ], - "to": [ 6, 8, 14 ], - "faces": { - "west": { "uv": [ 6, 5, 10, 11 ], "texture": "#lit" }, - "east": { "uv": [ 6, 5, 10, 11 ], "texture": "#lit" } - } - }, - { "from": [ 3, 2, 11 ], - "to": [ 7, 8, 13 ], - "faces": { - "north": { "uv": [ 6, 5, 10, 11 ], "texture": "#lit" }, - "south": { "uv": [ 6, 5, 10, 11 ], "texture": "#lit" } - } - }, - { "from": [ 10, 7, 11 ], - "to": [ 12, 7, 13 ], - "faces": { - "up": { "uv": [ 7, 6, 9, 8 ], "texture": "#lit" } - } - }, - { "from": [ 10, 2, 10 ], - "to": [ 12, 8, 14 ], - "faces": { - "west": { "uv": [ 6, 5, 10, 11 ], "texture": "#lit" }, - "east": { "uv": [ 6, 5, 10, 11 ], "texture": "#lit" } - } - }, - { "from": [ 9, 2, 11 ], - "to": [ 13, 8, 13 ], - "faces": { - "north": { "uv": [ 6, 5, 10, 11 ], "texture": "#lit" }, - "south": { "uv": [ 6, 5, 10, 11 ], "texture": "#lit" } - } - }, - { "from": [ 7, 5, 2 ], + { "from": [ 7, 2, 2 ], "to": [ 9, 5, 4 ], + "shade": false, "faces": { - "up": { "uv": [ 7, 6, 9, 8 ], "texture": "#lit" } + "up": { "uv": [ 7, 6, 9, 8 ], "texture": "#lit" }, + "north": { "uv": [ 7, 6, 9, 9 ], "texture": "#lit" }, + "south": { "uv": [ 7, 6, 9, 9 ], "texture": "#lit" }, + "west": { "uv": [ 7, 6, 9, 9 ], "texture": "#lit" }, + "east": { "uv": [ 7, 6, 9, 9 ], "texture": "#lit" } } }, - { "from": [ 7, 2, 1 ], - "to": [ 9, 6, 5 ], + { "from": [ 4, 2, 11 ], + "to": [ 6, 7, 13 ], + "shade": false, "faces": { - "west": { "uv": [ 6, 5, 10, 9 ], "texture": "#lit" }, - "east": { "uv": [ 6, 5, 10, 9 ], "texture": "#lit" } + "up": { "uv": [ 7, 6, 9, 8 ], "texture": "#lit" }, + "north": { "uv": [ 7, 6, 9, 11 ], "texture": "#lit" }, + "south": { "uv": [ 7, 6, 9, 11 ], "texture": "#lit" }, + "west": { "uv": [ 7, 6, 9, 11 ], "texture": "#lit" }, + "east": { "uv": [ 7, 6, 9, 11 ], "texture": "#lit" } } }, - { "from": [ 6, 2, 2 ], - "to": [ 10, 6, 4 ], + { "from": [ 10, 2, 11 ], + "to": [ 12, 7, 13 ], + "shade": false, "faces": { - "north": { "uv": [ 6, 5, 10, 9 ], "texture": "#lit" }, - "south": { "uv": [ 6, 5, 10, 9 ], "texture": "#lit" } + "up": { "uv": [ 7, 6, 9, 8 ], "texture": "#lit" }, + "north": { "uv": [ 7, 6, 9, 11 ], "texture": "#lit" }, + "south": { "uv": [ 7, 6, 9, 11 ], "texture": "#lit" }, + "west": { "uv": [ 7, 6, 9, 11 ], "texture": "#lit" }, + "east": { "uv": [ 7, 6, 9, 11 ], "texture": "#lit" } + } + }, + { + "from": [ 3.5, 1.5, 10.5 ], + "to": [ 6.5, 4.5, 13.5 ], + "shade": false, + "faces": { + "up": { "uv": [ 6, 5, 7, 6 ], "texture": "#lit" } + } + }, + { + "from": [ 3.5, 7.5, 10.5 ], + "to": [ 6.5, 10.5, 13.5 ], + "shade": false, + "faces": { + "down": { "uv": [ 6, 5, 7, 6 ], "texture": "#lit" } + } + }, + { + "from": [ 3.5, 4.5, 7.5 ], + "to": [ 6.5, 7.5, 10.5 ], + "shade": false, + "faces": { + "south": { "uv": [ 6, 5, 7, 6 ], "texture": "#lit" } + } + }, + { + "from": [ 3.5, 4.5, 13.5 ], + "to": [ 6.5, 7.5, 16.5 ], + "shade": false, + "faces": { + "north": { "uv": [ 6, 5, 7, 6 ], "texture": "#lit" } + } + }, + { + "from": [ 0.5, 4.5, 10.5 ], + "to": [ 3.5, 7.5, 13.5 ], + "shade": false, + "faces": { + "east": { "uv": [ 6, 5, 7, 6 ], "texture": "#lit" } + } + }, + { + "from": [ 6.5, 4.5, 10.5 ], + "to": [ 9.5, 7.5, 13.5 ], + "shade": false, + "faces": { + "west": { "uv": [ 6, 5, 7, 6 ], "texture": "#lit" } + } + }, + { + "from": [ 9.5, 1.5, 10.5 ], + "to": [ 12.5, 4.5, 13.5 ], + "shade": false, + "faces": { + "up": { "uv": [ 6, 5, 7, 6 ], "texture": "#lit" } + } + }, + { + "from": [ 9.5, 7.5, 10.5 ], + "to": [ 12.5, 10.5, 13.5 ], + "shade": false, + "faces": { + "down": { "uv": [ 6, 5, 7, 6 ], "texture": "#lit" } + } + }, + { + "from": [ 9.5, 4.5, 7.5 ], + "to": [ 12.5, 7.5, 10.5 ], + "shade": false, + "faces": { + "south": { "uv": [ 6, 5, 7, 6 ], "texture": "#lit" } + } + }, + { + "from": [ 9.5, 4.5, 13.5 ], + "to": [ 12.5, 7.5, 16.5 ], + "shade": false, + "faces": { + "north": { "uv": [ 6, 5, 7, 6 ], "texture": "#lit" } + } + }, + { + "from": [ 6.5, 4.5, 10.5 ], + "to": [ 9.5, 7.5, 13.5 ], + "shade": false, + "faces": { + "east": { "uv": [ 6, 5, 7, 6 ], "texture": "#lit" } + } + }, + { + "from": [ 12.5, 4.5, 10.5 ], + "to": [ 15.5, 7.5, 13.5 ], + "shade": false, + "faces": { + "west": { "uv": [ 6, 5, 7, 6 ], "texture": "#lit" } + } + }, + { + "from": [ 6.5, -0.5, 1.5 ], + "to": [ 9.5, 2.5, 4.5 ], + "shade": false, + "faces": { + "up": { "uv": [ 6, 5, 7, 6 ], "texture": "#lit" } + } + }, + { + "from": [ 6.5, 5.5, 1.5 ], + "to": [ 9.5, 8.5, 4.5 ], + "shade": false, + "faces": { + "down": { "uv": [ 6, 5, 7, 6 ], "texture": "#lit" } + } + }, + { + "from": [ 6.5, 2.5, -1.5 ], + "to": [ 9.5, 5.5, 1.5 ], + "shade": false, + "faces": { + "south": { "uv": [ 6, 5, 7, 6 ], "texture": "#lit" } + } + }, + { + "from": [ 6.5, 2.5, 4.5 ], + "to": [ 9.5, 5.5, 7.5 ], + "shade": false, + "faces": { + "north": { "uv": [ 6, 5, 7, 6 ], "texture": "#lit" } + } + }, + { + "from": [ 3.5, 2.5, 1.5 ], + "to": [ 6.5, 5.5, 4.5 ], + "shade": false, + "faces": { + "east": { "uv": [ 6, 5, 7, 6 ], "texture": "#lit" } + } + }, + { + "from": [ 9.5, 2.5, 1.5 ], + "to": [ 12.5, 5.5, 4.5 ], + "shade": false, + "faces": { + "west": { "uv": [ 6, 5, 7, 6 ], "texture": "#lit" } } } ] diff --git a/assets/minecraft/models/block/comparator_subtract.json b/assets/minecraft/models/block/comparator_subtract.json index e2ce2031..1119d370 100644 --- a/assets/minecraft/models/block/comparator_subtract.json +++ b/assets/minecraft/models/block/comparator_subtract.json @@ -22,43 +22,80 @@ { "from": [ 4, 2, 11 ], "to": [ 6, 7, 13 ], "faces": { - "down": { "uv": [ 7, 13, 9, 15 ], "texture": "#unlit" }, - "up": { "uv": [ 7, 6, 9, 8 ], "texture": "#unlit" }, - "north": { "uv": [ 7, 6, 9, 11 ], "texture": "#unlit" }, - "south": { "uv": [ 7, 6, 9, 11 ], "texture": "#unlit" }, - "west": { "uv": [ 7, 6, 9, 11 ], "texture": "#unlit" }, - "east": { "uv": [ 7, 6, 9, 11 ], "texture": "#unlit" } + "up": { "uv": [ 7, 6, 9, 8 ], "texture": "#unlit" }, + "north": { "uv": [ 7, 6, 9, 11 ], "texture": "#unlit" }, + "south": { "uv": [ 7, 6, 9, 11 ], "texture": "#unlit" }, + "west": { "uv": [ 7, 6, 9, 11 ], "texture": "#unlit" }, + "east": { "uv": [ 7, 6, 9, 11 ], "texture": "#unlit" } } }, { "from": [ 10, 2, 11 ], "to": [ 12, 7, 13 ], "faces": { - "down": { "uv": [ 7, 13, 9, 15 ], "texture": "#unlit" }, - "up": { "uv": [ 7, 6, 9, 8 ], "texture": "#unlit" }, - "north": { "uv": [ 7, 6, 9, 11 ], "texture": "#unlit" }, - "south": { "uv": [ 7, 6, 9, 11 ], "texture": "#unlit" }, - "west": { "uv": [ 7, 6, 9, 11 ], "texture": "#unlit" }, - "east": { "uv": [ 7, 6, 9, 11 ], "texture": "#unlit" } + "up": { "uv": [ 7, 6, 9, 8 ], "texture": "#unlit" }, + "north": { "uv": [ 7, 6, 9, 11 ], "texture": "#unlit" }, + "south": { "uv": [ 7, 6, 9, 11 ], "texture": "#unlit" }, + "west": { "uv": [ 7, 6, 9, 11 ], "texture": "#unlit" }, + "east": { "uv": [ 7, 6, 9, 11 ], "texture": "#unlit" } } }, - { "from": [ 7, 5, 2 ], + { "from": [ 7, 2, 2 ], "to": [ 9, 5, 4 ], + "shade": false, "faces": { - "up": { "uv": [ 7, 6, 9, 8 ], "texture": "#lit" } + "up": { "uv": [ 7, 6, 9, 8 ], "texture": "#lit" }, + "north": { "uv": [ 7, 6, 9, 9 ], "texture": "#lit" }, + "south": { "uv": [ 7, 6, 9, 9 ], "texture": "#lit" }, + "west": { "uv": [ 7, 6, 9, 9 ], "texture": "#lit" }, + "east": { "uv": [ 7, 6, 9, 9 ], "texture": "#lit" } } }, - { "from": [ 7, 2, 1 ], - "to": [ 9, 6, 5 ], + { + "from": [ 6.5, -0.5, 1.5 ], + "to": [ 9.5, 2.5, 4.5 ], + "shade": false, "faces": { - "west": { "uv": [ 6, 5, 10, 9 ], "texture": "#lit" }, - "east": { "uv": [ 6, 5, 10, 9 ], "texture": "#lit" } + "up": { "uv": [ 6, 5, 7, 6 ], "texture": "#lit" } } }, - { "from": [ 6, 2, 2 ], - "to": [ 10, 6, 4 ], + { + "from": [ 6.5, 5.5, 1.5 ], + "to": [ 9.5, 8.5, 4.5 ], + "shade": false, "faces": { - "north": { "uv": [ 6, 5, 10, 9 ], "texture": "#lit" }, - "south": { "uv": [ 6, 5, 10, 9 ], "texture": "#lit" } + "down": { "uv": [ 6, 5, 7, 6 ], "texture": "#lit" } + } + }, + { + "from": [ 6.5, 2.5, -1.5 ], + "to": [ 9.5, 5.5, 1.5 ], + "shade": false, + "faces": { + "south": { "uv": [ 6, 5, 7, 6 ], "texture": "#lit" } + } + }, + { + "from": [ 6.5, 2.5, 4.5 ], + "to": [ 9.5, 5.5, 7.5 ], + "shade": false, + "faces": { + "north": { "uv": [ 6, 5, 7, 6 ], "texture": "#lit" } + } + }, + { + "from": [ 3.5, 2.5, 1.5 ], + "to": [ 6.5, 5.5, 4.5 ], + "shade": false, + "faces": { + "east": { "uv": [ 6, 5, 7, 6 ], "texture": "#lit" } + } + }, + { + "from": [ 9.5, 2.5, 1.5 ], + "to": [ 12.5, 5.5, 4.5 ], + "shade": false, + "faces": { + "west": { "uv": [ 6, 5, 7, 6 ], "texture": "#lit" } } } ] diff --git a/assets/minecraft/models/block/creaking_heart.json b/assets/minecraft/models/block/creaking_heart.json new file mode 100644 index 00000000..e40768a2 --- /dev/null +++ b/assets/minecraft/models/block/creaking_heart.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:block/cube_column", + "textures": { + "end": "minecraft:block/creaking_heart_top", + "side": "minecraft:block/creaking_heart" + } +} \ No newline at end of file diff --git a/assets/minecraft/models/block/creaking_heart_active.json b/assets/minecraft/models/block/creaking_heart_active.json new file mode 100644 index 00000000..cd2b0498 --- /dev/null +++ b/assets/minecraft/models/block/creaking_heart_active.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:block/cube_column", + "textures": { + "end": "minecraft:block/creaking_heart_top_active", + "side": "minecraft:block/creaking_heart_active" + } +} \ No newline at end of file diff --git a/assets/minecraft/models/block/creaking_heart_active_horizontal.json b/assets/minecraft/models/block/creaking_heart_active_horizontal.json new file mode 100644 index 00000000..c3601332 --- /dev/null +++ b/assets/minecraft/models/block/creaking_heart_active_horizontal.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:block/cube_column_horizontal", + "textures": { + "end": "minecraft:block/creaking_heart_top_active", + "side": "minecraft:block/creaking_heart_active" + } +} \ No newline at end of file diff --git a/assets/minecraft/models/block/creaking_heart_horizontal.json b/assets/minecraft/models/block/creaking_heart_horizontal.json new file mode 100644 index 00000000..475abb74 --- /dev/null +++ b/assets/minecraft/models/block/creaking_heart_horizontal.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:block/cube_column_horizontal", + "textures": { + "end": "minecraft:block/creaking_heart_top", + "side": "minecraft:block/creaking_heart" + } +} \ No newline at end of file diff --git a/assets/minecraft/models/block/dragon_egg.json b/assets/minecraft/models/block/dragon_egg.json index 0e60bd70..042d4ebe 100644 --- a/assets/minecraft/models/block/dragon_egg.json +++ b/assets/minecraft/models/block/dragon_egg.json @@ -1,96 +1,79 @@ -{ "parent": "block/block", - "textures": { - "particle": "block/dragon_egg", - "all": "block/dragon_egg" - }, - "elements": [ - { "from": [ 6, 15, 6 ], - "to": [ 10, 16, 10 ], - "faces": { - "down": { "uv": [ 6, 6, 10, 10 ], "texture": "#all" }, - "up": { "uv": [ 6, 6, 10, 10 ], "texture": "#all" }, - "north": { "uv": [ 6, 15, 10, 16 ], "texture": "#all" }, - "south": { "uv": [ 6, 15, 10, 16 ], "texture": "#all" }, - "west": { "uv": [ 6, 15, 10, 16 ], "texture": "#all" }, - "east": { "uv": [ 6, 15, 10, 16 ], "texture": "#all" } - } - }, - { "from": [ 5, 14, 5 ], - "to": [ 11, 15, 11 ], - "faces": { - "down": { "uv": [ 5, 5, 11, 11 ], "texture": "#all" }, - "up": { "uv": [ 5, 5, 11, 11 ], "texture": "#all" }, - "north": { "uv": [ 5, 14, 11, 15 ], "texture": "#all" }, - "south": { "uv": [ 5, 14, 11, 15 ], "texture": "#all" }, - "west": { "uv": [ 5, 14, 11, 15 ], "texture": "#all" }, - "east": { "uv": [ 5, 14, 11, 15 ], "texture": "#all" } - } - }, - { "from": [ 5, 13, 5 ], - "to": [ 11, 14, 11 ], - "faces": { - "down": { "uv": [ 4, 4, 12, 12 ], "texture": "#all" }, - "up": { "uv": [ 4, 4, 12, 12 ], "texture": "#all" }, - "north": { "uv": [ 4, 13, 12, 14 ], "texture": "#all" }, - "south": { "uv": [ 4, 13, 12, 14 ], "texture": "#all" }, - "west": { "uv": [ 4, 13, 12, 14 ], "texture": "#all" }, - "east": { "uv": [ 4, 13, 12, 14 ], "texture": "#all" } - } - }, - { "from": [ 3, 11, 3 ], - "to": [ 13, 13, 13 ], - "faces": { - "down": { "uv": [ 3, 3, 13, 13 ], "texture": "#all" }, - "up": { "uv": [ 3, 3, 13, 13 ], "texture": "#all" }, - "north": { "uv": [ 3, 11, 13, 13 ], "texture": "#all" }, - "south": { "uv": [ 3, 11, 13, 13 ], "texture": "#all" }, - "west": { "uv": [ 3, 11, 13, 13 ], "texture": "#all" }, - "east": { "uv": [ 3, 11, 13, 13 ], "texture": "#all" } - } - }, - { "from": [ 2, 8, 2 ], - "to": [ 14, 11, 14 ], - "faces": { - "down": { "uv": [ 2, 2, 14, 14 ], "texture": "#all" }, - "up": { "uv": [ 2, 2, 14, 14 ], "texture": "#all" }, - "north": { "uv": [ 2, 8, 14, 11 ], "texture": "#all" }, - "south": { "uv": [ 2, 8, 14, 11 ], "texture": "#all" }, - "west": { "uv": [ 2, 8, 14, 11 ], "texture": "#all" }, - "east": { "uv": [ 2, 8, 14, 11 ], "texture": "#all" } - } - }, - { "from": [ 1, 3, 1 ], - "to": [ 15, 8, 15 ], - "faces": { - "down": { "uv": [ 1, 1, 15, 15 ], "texture": "#all" }, - "up": { "uv": [ 1, 1, 15, 15 ], "texture": "#all" }, - "north": { "uv": [ 1, 3, 15, 8 ], "texture": "#all" }, - "south": { "uv": [ 1, 3, 15, 8 ], "texture": "#all" }, - "west": { "uv": [ 1, 3, 15, 8 ], "texture": "#all" }, - "east": { "uv": [ 1, 3, 15, 8 ], "texture": "#all" } - } - }, - { "from": [ 2, 1, 2 ], - "to": [ 14, 3, 14 ], - "faces": { - "down": { "uv": [ 2, 2, 14, 14 ], "texture": "#all" }, - "up": { "uv": [ 2, 2, 14, 14 ], "texture": "#all" }, - "north": { "uv": [ 2, 1, 14, 3 ], "texture": "#all" }, - "south": { "uv": [ 2, 1, 14, 3 ], "texture": "#all" }, - "west": { "uv": [ 2, 1, 14, 3 ], "texture": "#all" }, - "east": { "uv": [ 2, 1, 14, 3 ], "texture": "#all" } - } - }, - { "from": [ 3, 0, 3 ], - "to": [ 13, 1, 13 ], - "faces": { - "down": { "uv": [ 3, 3, 13, 13 ], "texture": "#all" }, - "up": { "uv": [ 3, 3, 13, 13 ], "texture": "#all" }, - "north": { "uv": [ 3, 0, 13, 1 ], "texture": "#all" }, - "south": { "uv": [ 3, 0, 13, 1 ], "texture": "#all" }, - "west": { "uv": [ 3, 0, 13, 1 ], "texture": "#all" }, - "east": { "uv": [ 3, 0, 13, 1 ], "texture": "#all" } - } - } - ] -} +{ + "parent": "block/block", + "textures": { + "particle": "block/dragon_egg", + "all": "block/dragon_egg" + }, + "elements": [ + { + "from": [6, 15, 6], + "to": [10, 16, 10], + "faces": { + "north": {"uv": [6, 0, 10, 1], "texture": "#all"}, + "east": {"uv": [6, 0, 10, 1], "texture": "#all"}, + "south": {"uv": [6, 0, 10, 1], "texture": "#all"}, + "west": {"uv": [6, 0, 10, 1], "texture": "#all"}, + "up": {"uv": [6, 6, 10, 10], "texture": "#all", "cullface": "up"} + } + }, + { + "from": [5, 14, 5], + "to": [11, 15, 11], + "faces": { + "north": {"uv": [5, 1, 11, 2], "texture": "#all"}, + "east": {"uv": [5, 1, 11, 2], "texture": "#all"}, + "south": {"uv": [5, 1, 11, 2], "texture": "#all"}, + "west": {"uv": [5, 1, 11, 2], "texture": "#all"}, + "up": {"uv": [5, 5, 11, 11], "texture": "#all"} + } + }, + { + "from": [4, 13, 4], + "to": [12, 14, 12], + "rotation": {"angle": 0, "axis": "y", "origin": [0, -1, 0]}, + "faces": { + "north": {"uv": [4, 2, 12, 3], "texture": "#all"}, + "east": {"uv": [4, 2, 12, 3], "texture": "#all"}, + "south": {"uv": [4, 2, 12, 3], "texture": "#all"}, + "west": {"uv": [4, 2, 12, 3], "texture": "#all"}, + "up": {"uv": [4, 4, 12, 12], "texture": "#all"} + } + }, + { + "from": [3, 0, 3], + "to": [13, 13, 13], + "faces": { + "north": {"uv": [3, 3, 13, 16], "texture": "#all"}, + "east": {"uv": [3, 3, 13, 16], "texture": "#all"}, + "south": {"uv": [3, 3, 13, 16], "texture": "#all"}, + "west": {"uv": [3, 3, 13, 16], "texture": "#all"}, + "up": {"uv": [3, 3, 13, 13], "texture": "#all"}, + "down": {"uv": [3, 3, 13, 13], "texture": "#all", "cullface": "down"} + } + }, + { + "from": [2, 1, 2], + "to": [14, 11, 14], + "faces": { + "north": {"uv": [2, 5, 14, 15], "texture": "#all"}, + "east": {"uv": [2, 5, 14, 15], "texture": "#all"}, + "south": {"uv": [2, 5, 14, 15], "texture": "#all"}, + "west": {"uv": [2, 5, 14, 15], "texture": "#all"}, + "up": {"uv": [2, 2, 14, 14], "texture": "#all"}, + "down": {"uv": [2, 2, 14, 14], "texture": "#all"} + } + }, + { + "from": [1, 3, 1], + "to": [15, 8, 15], + "faces": { + "north": {"uv": [1, 8, 15, 13], "texture": "#all"}, + "east": {"uv": [1, 8, 15, 13], "texture": "#all"}, + "south": {"uv": [1, 8, 15, 13], "texture": "#all"}, + "west": {"uv": [1, 8, 15, 13], "texture": "#all"}, + "up": {"uv": [1, 1, 15, 15], "texture": "#all"}, + "down": {"uv": [1, 1, 15, 15], "texture": "#all"} + } + } + ] +} \ No newline at end of file diff --git a/assets/minecraft/models/block/flower_pot_cross.json b/assets/minecraft/models/block/flower_pot_cross.json index dbc2c9df..05d1cbe2 100644 --- a/assets/minecraft/models/block/flower_pot_cross.json +++ b/assets/minecraft/models/block/flower_pot_cross.json @@ -56,6 +56,7 @@ { "from": [ 2.6, 4, 8 ], "to": [ 13.4, 16, 8 ], "rotation": { "origin": [ 8, 8, 8 ], "axis": "y", "angle": 45, "rescale": true }, + "shade": false, "faces": { "north": { "uv": [ 0, 0, 16, 16 ], "texture": "#plant" }, "south": { "uv": [ 0, 0, 16, 16 ], "texture": "#plant" } @@ -64,6 +65,7 @@ { "from": [ 8, 4, 2.6 ], "to": [ 8, 16, 13.4 ], "rotation": { "origin": [ 8, 8, 8 ], "axis": "y", "angle": 45, "rescale": true }, + "shade": false, "faces": { "west": { "uv": [ 0, 0, 16, 16 ], "texture": "#plant" }, "east": { "uv": [ 0, 0, 16, 16 ], "texture": "#plant" } diff --git a/assets/minecraft/models/block/mossy_carpet_side.json b/assets/minecraft/models/block/mossy_carpet_side.json new file mode 100644 index 00000000..e63ad2dd --- /dev/null +++ b/assets/minecraft/models/block/mossy_carpet_side.json @@ -0,0 +1,16 @@ +{ + "ambientocclusion": true, + "textures": { + "particle": "#side" + }, + "elements": [ + { "from": [ 0, 0, 0.1 ], + "to": [ 16, 16, 0.1 ], + "shade": true, + "faces": { + "north": { "uv": [ 16, 0, 0, 16 ], "texture": "#side"}, + "south": { "uv": [ 0, 0, 16, 16 ], "texture": "#side"} + } + } + ] +} diff --git a/assets/minecraft/models/block/pale_hanging_moss.json b/assets/minecraft/models/block/pale_hanging_moss.json new file mode 100644 index 00000000..c4b4d1c8 --- /dev/null +++ b/assets/minecraft/models/block/pale_hanging_moss.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/cross", + "textures": { + "cross": "minecraft:block/pale_hanging_moss" + } +} \ No newline at end of file diff --git a/assets/minecraft/models/block/pale_hanging_moss_tip.json b/assets/minecraft/models/block/pale_hanging_moss_tip.json new file mode 100644 index 00000000..ca893a94 --- /dev/null +++ b/assets/minecraft/models/block/pale_hanging_moss_tip.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/cross", + "textures": { + "cross": "minecraft:block/pale_hanging_moss_tip" + } +} \ No newline at end of file diff --git a/assets/minecraft/models/block/pale_moss_block.json b/assets/minecraft/models/block/pale_moss_block.json new file mode 100644 index 00000000..e5f25ac4 --- /dev/null +++ b/assets/minecraft/models/block/pale_moss_block.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/cube_all", + "textures": { + "all": "minecraft:block/pale_moss_block" + } +} \ No newline at end of file diff --git a/assets/minecraft/models/block/pale_moss_carpet.json b/assets/minecraft/models/block/pale_moss_carpet.json new file mode 100644 index 00000000..cc17e46c --- /dev/null +++ b/assets/minecraft/models/block/pale_moss_carpet.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/carpet", + "textures": { + "wool": "minecraft:block/pale_moss_carpet" + } +} \ No newline at end of file diff --git a/assets/minecraft/models/block/pale_moss_carpet_side_small.json b/assets/minecraft/models/block/pale_moss_carpet_side_small.json new file mode 100644 index 00000000..08fbb865 --- /dev/null +++ b/assets/minecraft/models/block/pale_moss_carpet_side_small.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/mossy_carpet_side", + "textures": { + "side": "minecraft:block/pale_moss_carpet_side_small" + } +} \ No newline at end of file diff --git a/assets/minecraft/models/block/pale_moss_carpet_side_tall.json b/assets/minecraft/models/block/pale_moss_carpet_side_tall.json new file mode 100644 index 00000000..6a1c75c7 --- /dev/null +++ b/assets/minecraft/models/block/pale_moss_carpet_side_tall.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/mossy_carpet_side", + "textures": { + "side": "minecraft:block/pale_moss_carpet_side_tall" + } +} \ No newline at end of file diff --git a/assets/minecraft/models/block/pale_oak_button.json b/assets/minecraft/models/block/pale_oak_button.json new file mode 100644 index 00000000..898512c5 --- /dev/null +++ b/assets/minecraft/models/block/pale_oak_button.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/button", + "textures": { + "texture": "minecraft:block/pale_oak_planks" + } +} \ No newline at end of file diff --git a/assets/minecraft/models/block/pale_oak_button_inventory.json b/assets/minecraft/models/block/pale_oak_button_inventory.json new file mode 100644 index 00000000..f1588700 --- /dev/null +++ b/assets/minecraft/models/block/pale_oak_button_inventory.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/button_inventory", + "textures": { + "texture": "minecraft:block/pale_oak_planks" + } +} \ No newline at end of file diff --git a/assets/minecraft/models/block/pale_oak_button_pressed.json b/assets/minecraft/models/block/pale_oak_button_pressed.json new file mode 100644 index 00000000..bbbbea08 --- /dev/null +++ b/assets/minecraft/models/block/pale_oak_button_pressed.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/button_pressed", + "textures": { + "texture": "minecraft:block/pale_oak_planks" + } +} \ No newline at end of file diff --git a/assets/minecraft/models/block/pale_oak_door_bottom_left.json b/assets/minecraft/models/block/pale_oak_door_bottom_left.json new file mode 100644 index 00000000..04841d82 --- /dev/null +++ b/assets/minecraft/models/block/pale_oak_door_bottom_left.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:block/door_bottom_left", + "textures": { + "bottom": "minecraft:block/pale_oak_door_bottom", + "top": "minecraft:block/pale_oak_door_top" + } +} \ No newline at end of file diff --git a/assets/minecraft/models/block/pale_oak_door_bottom_left_open.json b/assets/minecraft/models/block/pale_oak_door_bottom_left_open.json new file mode 100644 index 00000000..639730e9 --- /dev/null +++ b/assets/minecraft/models/block/pale_oak_door_bottom_left_open.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:block/door_bottom_left_open", + "textures": { + "bottom": "minecraft:block/pale_oak_door_bottom", + "top": "minecraft:block/pale_oak_door_top" + } +} \ No newline at end of file diff --git a/assets/minecraft/models/block/pale_oak_door_bottom_right.json b/assets/minecraft/models/block/pale_oak_door_bottom_right.json new file mode 100644 index 00000000..1719305b --- /dev/null +++ b/assets/minecraft/models/block/pale_oak_door_bottom_right.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:block/door_bottom_right", + "textures": { + "bottom": "minecraft:block/pale_oak_door_bottom", + "top": "minecraft:block/pale_oak_door_top" + } +} \ No newline at end of file diff --git a/assets/minecraft/models/block/pale_oak_door_bottom_right_open.json b/assets/minecraft/models/block/pale_oak_door_bottom_right_open.json new file mode 100644 index 00000000..7cd2a1ef --- /dev/null +++ b/assets/minecraft/models/block/pale_oak_door_bottom_right_open.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:block/door_bottom_right_open", + "textures": { + "bottom": "minecraft:block/pale_oak_door_bottom", + "top": "minecraft:block/pale_oak_door_top" + } +} \ No newline at end of file diff --git a/assets/minecraft/models/block/pale_oak_door_top_left.json b/assets/minecraft/models/block/pale_oak_door_top_left.json new file mode 100644 index 00000000..ee6559a1 --- /dev/null +++ b/assets/minecraft/models/block/pale_oak_door_top_left.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:block/door_top_left", + "textures": { + "bottom": "minecraft:block/pale_oak_door_bottom", + "top": "minecraft:block/pale_oak_door_top" + } +} \ No newline at end of file diff --git a/assets/minecraft/models/block/pale_oak_door_top_left_open.json b/assets/minecraft/models/block/pale_oak_door_top_left_open.json new file mode 100644 index 00000000..16aeb0d3 --- /dev/null +++ b/assets/minecraft/models/block/pale_oak_door_top_left_open.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:block/door_top_left_open", + "textures": { + "bottom": "minecraft:block/pale_oak_door_bottom", + "top": "minecraft:block/pale_oak_door_top" + } +} \ No newline at end of file diff --git a/assets/minecraft/models/block/pale_oak_door_top_right.json b/assets/minecraft/models/block/pale_oak_door_top_right.json new file mode 100644 index 00000000..603238fc --- /dev/null +++ b/assets/minecraft/models/block/pale_oak_door_top_right.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:block/door_top_right", + "textures": { + "bottom": "minecraft:block/pale_oak_door_bottom", + "top": "minecraft:block/pale_oak_door_top" + } +} \ No newline at end of file diff --git a/assets/minecraft/models/block/pale_oak_door_top_right_open.json b/assets/minecraft/models/block/pale_oak_door_top_right_open.json new file mode 100644 index 00000000..f2c0ad5a --- /dev/null +++ b/assets/minecraft/models/block/pale_oak_door_top_right_open.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:block/door_top_right_open", + "textures": { + "bottom": "minecraft:block/pale_oak_door_bottom", + "top": "minecraft:block/pale_oak_door_top" + } +} \ No newline at end of file diff --git a/assets/minecraft/models/block/pale_oak_fence_gate.json b/assets/minecraft/models/block/pale_oak_fence_gate.json new file mode 100644 index 00000000..4038af50 --- /dev/null +++ b/assets/minecraft/models/block/pale_oak_fence_gate.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/template_fence_gate", + "textures": { + "texture": "minecraft:block/pale_oak_planks" + } +} \ No newline at end of file diff --git a/assets/minecraft/models/block/pale_oak_fence_gate_open.json b/assets/minecraft/models/block/pale_oak_fence_gate_open.json new file mode 100644 index 00000000..23b2d2ae --- /dev/null +++ b/assets/minecraft/models/block/pale_oak_fence_gate_open.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/template_fence_gate_open", + "textures": { + "texture": "minecraft:block/pale_oak_planks" + } +} \ No newline at end of file diff --git a/assets/minecraft/models/block/pale_oak_fence_gate_wall.json b/assets/minecraft/models/block/pale_oak_fence_gate_wall.json new file mode 100644 index 00000000..4a667a4b --- /dev/null +++ b/assets/minecraft/models/block/pale_oak_fence_gate_wall.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/template_fence_gate_wall", + "textures": { + "texture": "minecraft:block/pale_oak_planks" + } +} \ No newline at end of file diff --git a/assets/minecraft/models/block/pale_oak_fence_gate_wall_open.json b/assets/minecraft/models/block/pale_oak_fence_gate_wall_open.json new file mode 100644 index 00000000..8f558cd8 --- /dev/null +++ b/assets/minecraft/models/block/pale_oak_fence_gate_wall_open.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/template_fence_gate_wall_open", + "textures": { + "texture": "minecraft:block/pale_oak_planks" + } +} \ No newline at end of file diff --git a/assets/minecraft/models/block/pale_oak_fence_inventory.json b/assets/minecraft/models/block/pale_oak_fence_inventory.json new file mode 100644 index 00000000..63aad0b5 --- /dev/null +++ b/assets/minecraft/models/block/pale_oak_fence_inventory.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/fence_inventory", + "textures": { + "texture": "minecraft:block/pale_oak_planks" + } +} \ No newline at end of file diff --git a/assets/minecraft/models/block/pale_oak_fence_post.json b/assets/minecraft/models/block/pale_oak_fence_post.json new file mode 100644 index 00000000..d531237b --- /dev/null +++ b/assets/minecraft/models/block/pale_oak_fence_post.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/fence_post", + "textures": { + "texture": "minecraft:block/pale_oak_planks" + } +} \ No newline at end of file diff --git a/assets/minecraft/models/block/pale_oak_fence_side.json b/assets/minecraft/models/block/pale_oak_fence_side.json new file mode 100644 index 00000000..aae5a271 --- /dev/null +++ b/assets/minecraft/models/block/pale_oak_fence_side.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/fence_side", + "textures": { + "texture": "minecraft:block/pale_oak_planks" + } +} \ No newline at end of file diff --git a/assets/minecraft/models/block/pale_oak_hanging_sign.json b/assets/minecraft/models/block/pale_oak_hanging_sign.json new file mode 100644 index 00000000..aa64adf2 --- /dev/null +++ b/assets/minecraft/models/block/pale_oak_hanging_sign.json @@ -0,0 +1,5 @@ +{ + "textures": { + "particle": "minecraft:block/stripped_pale_oak_log" + } +} \ No newline at end of file diff --git a/assets/minecraft/models/block/pale_oak_leaves.json b/assets/minecraft/models/block/pale_oak_leaves.json new file mode 100644 index 00000000..ed007419 --- /dev/null +++ b/assets/minecraft/models/block/pale_oak_leaves.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/leaves", + "textures": { + "all": "minecraft:block/pale_oak_leaves" + } +} \ No newline at end of file diff --git a/assets/minecraft/models/block/pale_oak_log.json b/assets/minecraft/models/block/pale_oak_log.json new file mode 100644 index 00000000..a3803c5f --- /dev/null +++ b/assets/minecraft/models/block/pale_oak_log.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:block/cube_column", + "textures": { + "end": "minecraft:block/pale_oak_log_top", + "side": "minecraft:block/pale_oak_log" + } +} \ No newline at end of file diff --git a/assets/minecraft/models/block/pale_oak_log_horizontal.json b/assets/minecraft/models/block/pale_oak_log_horizontal.json new file mode 100644 index 00000000..8e36591b --- /dev/null +++ b/assets/minecraft/models/block/pale_oak_log_horizontal.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:block/cube_column_horizontal", + "textures": { + "end": "minecraft:block/pale_oak_log_top", + "side": "minecraft:block/pale_oak_log" + } +} \ No newline at end of file diff --git a/assets/minecraft/models/block/pale_oak_planks.json b/assets/minecraft/models/block/pale_oak_planks.json new file mode 100644 index 00000000..685cb040 --- /dev/null +++ b/assets/minecraft/models/block/pale_oak_planks.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/cube_all", + "textures": { + "all": "minecraft:block/pale_oak_planks" + } +} \ No newline at end of file diff --git a/assets/minecraft/models/block/pale_oak_pressure_plate.json b/assets/minecraft/models/block/pale_oak_pressure_plate.json new file mode 100644 index 00000000..260e8800 --- /dev/null +++ b/assets/minecraft/models/block/pale_oak_pressure_plate.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/pressure_plate_up", + "textures": { + "texture": "minecraft:block/pale_oak_planks" + } +} \ No newline at end of file diff --git a/assets/minecraft/models/block/pale_oak_pressure_plate_down.json b/assets/minecraft/models/block/pale_oak_pressure_plate_down.json new file mode 100644 index 00000000..5b037784 --- /dev/null +++ b/assets/minecraft/models/block/pale_oak_pressure_plate_down.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/pressure_plate_down", + "textures": { + "texture": "minecraft:block/pale_oak_planks" + } +} \ No newline at end of file diff --git a/assets/minecraft/models/block/pale_oak_sapling.json b/assets/minecraft/models/block/pale_oak_sapling.json new file mode 100644 index 00000000..b4ddd4cc --- /dev/null +++ b/assets/minecraft/models/block/pale_oak_sapling.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/cross", + "textures": { + "cross": "minecraft:block/pale_oak_sapling" + } +} \ No newline at end of file diff --git a/assets/minecraft/models/block/pale_oak_sign.json b/assets/minecraft/models/block/pale_oak_sign.json new file mode 100644 index 00000000..47da6531 --- /dev/null +++ b/assets/minecraft/models/block/pale_oak_sign.json @@ -0,0 +1,5 @@ +{ + "textures": { + "particle": "minecraft:block/pale_oak_planks" + } +} \ No newline at end of file diff --git a/assets/minecraft/models/block/pale_oak_slab.json b/assets/minecraft/models/block/pale_oak_slab.json new file mode 100644 index 00000000..13b13936 --- /dev/null +++ b/assets/minecraft/models/block/pale_oak_slab.json @@ -0,0 +1,8 @@ +{ + "parent": "minecraft:block/slab", + "textures": { + "bottom": "minecraft:block/pale_oak_planks", + "side": "minecraft:block/pale_oak_planks", + "top": "minecraft:block/pale_oak_planks" + } +} \ No newline at end of file diff --git a/assets/minecraft/models/block/pale_oak_slab_top.json b/assets/minecraft/models/block/pale_oak_slab_top.json new file mode 100644 index 00000000..28a93f06 --- /dev/null +++ b/assets/minecraft/models/block/pale_oak_slab_top.json @@ -0,0 +1,8 @@ +{ + "parent": "minecraft:block/slab_top", + "textures": { + "bottom": "minecraft:block/pale_oak_planks", + "side": "minecraft:block/pale_oak_planks", + "top": "minecraft:block/pale_oak_planks" + } +} \ No newline at end of file diff --git a/assets/minecraft/models/block/pale_oak_stairs.json b/assets/minecraft/models/block/pale_oak_stairs.json new file mode 100644 index 00000000..96793897 --- /dev/null +++ b/assets/minecraft/models/block/pale_oak_stairs.json @@ -0,0 +1,8 @@ +{ + "parent": "minecraft:block/stairs", + "textures": { + "bottom": "minecraft:block/pale_oak_planks", + "side": "minecraft:block/pale_oak_planks", + "top": "minecraft:block/pale_oak_planks" + } +} \ No newline at end of file diff --git a/assets/minecraft/models/block/pale_oak_stairs_inner.json b/assets/minecraft/models/block/pale_oak_stairs_inner.json new file mode 100644 index 00000000..bb0597a9 --- /dev/null +++ b/assets/minecraft/models/block/pale_oak_stairs_inner.json @@ -0,0 +1,8 @@ +{ + "parent": "minecraft:block/inner_stairs", + "textures": { + "bottom": "minecraft:block/pale_oak_planks", + "side": "minecraft:block/pale_oak_planks", + "top": "minecraft:block/pale_oak_planks" + } +} \ No newline at end of file diff --git a/assets/minecraft/models/block/pale_oak_stairs_outer.json b/assets/minecraft/models/block/pale_oak_stairs_outer.json new file mode 100644 index 00000000..d440f5d6 --- /dev/null +++ b/assets/minecraft/models/block/pale_oak_stairs_outer.json @@ -0,0 +1,8 @@ +{ + "parent": "minecraft:block/outer_stairs", + "textures": { + "bottom": "minecraft:block/pale_oak_planks", + "side": "minecraft:block/pale_oak_planks", + "top": "minecraft:block/pale_oak_planks" + } +} \ No newline at end of file diff --git a/assets/minecraft/models/block/pale_oak_trapdoor_bottom.json b/assets/minecraft/models/block/pale_oak_trapdoor_bottom.json new file mode 100644 index 00000000..af013f0c --- /dev/null +++ b/assets/minecraft/models/block/pale_oak_trapdoor_bottom.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/template_orientable_trapdoor_bottom", + "textures": { + "texture": "minecraft:block/pale_oak_trapdoor" + } +} \ No newline at end of file diff --git a/assets/minecraft/models/block/pale_oak_trapdoor_open.json b/assets/minecraft/models/block/pale_oak_trapdoor_open.json new file mode 100644 index 00000000..bd0aa87a --- /dev/null +++ b/assets/minecraft/models/block/pale_oak_trapdoor_open.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/template_orientable_trapdoor_open", + "textures": { + "texture": "minecraft:block/pale_oak_trapdoor" + } +} \ No newline at end of file diff --git a/assets/minecraft/models/block/pale_oak_trapdoor_top.json b/assets/minecraft/models/block/pale_oak_trapdoor_top.json new file mode 100644 index 00000000..86757e05 --- /dev/null +++ b/assets/minecraft/models/block/pale_oak_trapdoor_top.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/template_orientable_trapdoor_top", + "textures": { + "texture": "minecraft:block/pale_oak_trapdoor" + } +} \ No newline at end of file diff --git a/assets/minecraft/models/block/pale_oak_wood.json b/assets/minecraft/models/block/pale_oak_wood.json new file mode 100644 index 00000000..5b4e8032 --- /dev/null +++ b/assets/minecraft/models/block/pale_oak_wood.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:block/cube_column", + "textures": { + "end": "minecraft:block/pale_oak_log", + "side": "minecraft:block/pale_oak_log" + } +} \ No newline at end of file diff --git a/assets/minecraft/models/block/potted_pale_oak_sapling.json b/assets/minecraft/models/block/potted_pale_oak_sapling.json new file mode 100644 index 00000000..1c5d576c --- /dev/null +++ b/assets/minecraft/models/block/potted_pale_oak_sapling.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/flower_pot_cross", + "textures": { + "plant": "minecraft:block/pale_oak_sapling" + } +} \ No newline at end of file diff --git a/assets/minecraft/models/block/redstone_torch.json b/assets/minecraft/models/block/redstone_torch.json index 47d4d756..b4353431 100644 --- a/assets/minecraft/models/block/redstone_torch.json +++ b/assets/minecraft/models/block/redstone_torch.json @@ -1,5 +1,5 @@ { - "parent": "minecraft:block/template_torch", + "parent": "minecraft:block/template_redstone_torch", "textures": { "torch": "minecraft:block/redstone_torch" } diff --git a/assets/minecraft/models/block/redstone_torch_off.json b/assets/minecraft/models/block/redstone_torch_off.json index 9dcffffe..a0686d2d 100644 --- a/assets/minecraft/models/block/redstone_torch_off.json +++ b/assets/minecraft/models/block/redstone_torch_off.json @@ -1,5 +1,5 @@ { - "parent": "minecraft:block/template_torch", + "parent": "minecraft:block/template_torch_unlit", "textures": { "torch": "minecraft:block/redstone_torch_off" } diff --git a/assets/minecraft/models/block/redstone_wall_torch.json b/assets/minecraft/models/block/redstone_wall_torch.json index 2d2a9496..6373dfb5 100644 --- a/assets/minecraft/models/block/redstone_wall_torch.json +++ b/assets/minecraft/models/block/redstone_wall_torch.json @@ -1,5 +1,5 @@ { - "parent": "minecraft:block/template_torch_wall", + "parent": "minecraft:block/template_redstone_torch_wall", "textures": { "torch": "minecraft:block/redstone_torch" } diff --git a/assets/minecraft/models/block/redstone_wall_torch_off.json b/assets/minecraft/models/block/redstone_wall_torch_off.json index eb02aed8..0e0889f6 100644 --- a/assets/minecraft/models/block/redstone_wall_torch_off.json +++ b/assets/minecraft/models/block/redstone_wall_torch_off.json @@ -1,5 +1,5 @@ { - "parent": "minecraft:block/template_torch_wall", + "parent": "minecraft:block/template_torch_wall_unlit", "textures": { "torch": "minecraft:block/redstone_torch_off" } diff --git a/assets/minecraft/models/block/repeater_1tick.json b/assets/minecraft/models/block/repeater_1tick.json index 8539d997..d360b571 100644 --- a/assets/minecraft/models/block/repeater_1tick.json +++ b/assets/minecraft/models/block/repeater_1tick.json @@ -21,7 +21,6 @@ { "from": [ 7, 2, 6 ], "to": [ 9, 7, 8 ], "faces": { - "down": { "uv": [ 7, 13, 9, 15 ], "texture": "#unlit" }, "up": { "uv": [ 7, 6, 9, 8 ], "texture": "#unlit" }, "north": { "uv": [ 7, 6, 9, 11 ], "texture": "#unlit" }, "south": { "uv": [ 7, 6, 9, 11 ], "texture": "#unlit" }, @@ -32,7 +31,6 @@ { "from": [ 7, 2, 2 ], "to": [ 9, 7, 4 ], "faces": { - "down": { "uv": [ 7, 13, 9, 15 ], "texture": "#unlit" }, "up": { "uv": [ 7, 6, 9, 8 ], "texture": "#unlit" }, "north": { "uv": [ 7, 6, 9, 11 ], "texture": "#unlit" }, "south": { "uv": [ 7, 6, 9, 11 ], "texture": "#unlit" }, diff --git a/assets/minecraft/models/block/repeater_1tick_locked.json b/assets/minecraft/models/block/repeater_1tick_locked.json index d1457f3d..e264b0c1 100644 --- a/assets/minecraft/models/block/repeater_1tick_locked.json +++ b/assets/minecraft/models/block/repeater_1tick_locked.json @@ -22,7 +22,6 @@ { "from": [ 2, 2, 6 ], "to": [ 14, 4, 8 ], "faces": { - "down": { "uv": [ 7, 2, 9, 14 ], "texture": "#lock", "rotation": 90 }, "up": { "uv": [ 7, 2, 9, 14 ], "texture": "#lock", "rotation": 90 }, "north": { "uv": [ 2, 7, 14, 9 ], "texture": "#lock" }, "south": { "uv": [ 2, 7, 14, 9 ], "texture": "#lock" }, @@ -33,12 +32,11 @@ { "from": [ 7, 2, 2 ], "to": [ 9, 7, 4 ], "faces": { - "down": { "uv": [ 7, 13, 9, 15 ], "texture": "#unlit" }, - "up": { "uv": [ 7, 6, 9, 8 ], "texture": "#unlit" }, - "north": { "uv": [ 7, 6, 9, 11 ], "texture": "#unlit" }, - "south": { "uv": [ 7, 6, 9, 11 ], "texture": "#unlit" }, - "west": { "uv": [ 7, 6, 9, 11 ], "texture": "#unlit" }, - "east": { "uv": [ 7, 6, 9, 11 ], "texture": "#unlit" } + "up": { "uv": [ 7, 6, 9, 8 ], "texture": "#unlit" }, + "north": { "uv": [ 7, 6, 9, 11 ], "texture": "#unlit" }, + "south": { "uv": [ 7, 6, 9, 11 ], "texture": "#unlit" }, + "west": { "uv": [ 7, 6, 9, 11 ], "texture": "#unlit" }, + "east": { "uv": [ 7, 6, 9, 11 ], "texture": "#unlit" } } } ] diff --git a/assets/minecraft/models/block/repeater_1tick_on.json b/assets/minecraft/models/block/repeater_1tick_on.json index 8123d2cb..2d5dd932 100644 --- a/assets/minecraft/models/block/repeater_1tick_on.json +++ b/assets/minecraft/models/block/repeater_1tick_on.json @@ -18,44 +18,122 @@ "east": { "uv": [ 0, 14, 16, 16 ], "texture": "#slab", "cullface": "east" } } }, - { "from": [ 7, 7, 6 ], + { "from": [ 7, 2, 6 ], "to": [ 9, 7, 8 ], + "shade": false, "faces": { - "up": { "uv": [ 7, 6, 9, 8 ], "texture": "#lit" } + "up": { "uv": [ 7, 6, 9, 8 ], "texture": "#lit" }, + "north": { "uv": [ 7, 6, 9, 11 ], "texture": "#lit" }, + "south": { "uv": [ 7, 6, 9, 11 ], "texture": "#lit" }, + "west": { "uv": [ 7, 6, 9, 11 ], "texture": "#lit" }, + "east": { "uv": [ 7, 6, 9, 11 ], "texture": "#lit" } } }, - { "from": [ 7, 2, 5 ], - "to": [ 9, 8, 9 ], - "faces": { - "west": { "uv": [ 6, 5, 10, 11 ], "texture": "#lit" }, - "east": { "uv": [ 6, 5, 10, 11 ], "texture": "#lit" } - } - }, - { "from": [ 6, 2, 6 ], - "to": [ 10, 8, 8 ], - "faces": { - "north": { "uv": [ 6, 5, 10, 11 ], "texture": "#lit" }, - "south": { "uv": [ 6, 5, 10, 11 ], "texture": "#lit" } - } - }, - { "from": [ 7, 7, 2 ], + { "from": [ 7, 2, 2 ], "to": [ 9, 7, 4 ], + "shade": false, "faces": { - "up": { "uv": [ 7, 6, 9, 8 ], "texture": "#lit" } + "up": { "uv": [ 7, 6, 9, 8 ], "texture": "#lit" }, + "north": { "uv": [ 7, 6, 9, 11 ], "texture": "#lit" }, + "south": { "uv": [ 7, 6, 9, 11 ], "texture": "#lit" }, + "west": { "uv": [ 7, 6, 9, 11 ], "texture": "#lit" }, + "east": { "uv": [ 7, 6, 9, 11 ], "texture": "#lit" } } }, - { "from": [ 7, 2, 1 ], - "to": [ 9, 8, 5 ], + { + "from": [ 6.5, 1.5, 1.5 ], + "to": [ 9.5, 4.5, 4.5 ], + "shade": false, "faces": { - "west": { "uv": [ 6, 5, 10, 11 ], "texture": "#lit" }, - "east": { "uv": [ 6, 5, 10, 11 ], "texture": "#lit" } + "up": { "uv": [ 8, 5, 9, 6 ], "texture": "#lit" } } }, - { "from": [ 6, 2, 2 ], - "to": [ 10, 8, 4 ], + { + "from": [ 6.5, 7.5, 1.5 ], + "to": [ 9.5, 10.5, 4.5 ], + "shade": false, "faces": { - "north": { "uv": [ 6, 5, 10, 11 ], "texture": "#lit" }, - "south": { "uv": [ 6, 5, 10, 11 ], "texture": "#lit" } + "down": { "uv": [ 7, 5, 8, 6 ], "texture": "#lit" } + } + }, + { + "from": [ 6.5, 4.5, -1.5 ], + "to": [ 9.5, 7.5, 1.5 ], + "shade": false, + "faces": { + "south": { "uv": [ 9, 6, 10, 7 ], "texture": "#lit" } + } + }, + { + "from": [ 6.5, 4.5, 4.5 ], + "to": [ 9.5, 7.5, 7.5 ], + "shade": false, + "faces": { + "north": { "uv": [ 6, 6, 7, 7 ], "texture": "#lit" } + } + }, + { + "from": [ 3.5, 4.5, 1.5 ], + "to": [ 6.5, 7.5, 4.5 ], + "shade": false, + "faces": { + "east": { "uv": [ 9, 7, 10, 8 ], "texture": "#lit" } + } + }, + { + "from": [ 9.5, 4.5, 1.5 ], + "to": [ 12.5, 7.5, 4.5 ], + "shade": false, + "faces": { + "west": { "uv": [ 6, 7, 7, 8 ], "texture": "#lit" } + } + }, + { + "from": [ 6.5, 1.5, 5.5 ], + "to": [ 9.5, 4.5, 8.5 ], + "shade": false, + "faces": { + "up": { "uv": [ 8, 5, 9, 6 ], "texture": "#lit" } + } + }, + { + "from": [ 6.5, 7.5, 5.5 ], + "to": [ 9.5, 10.5, 8.5 ], + "shade": false, + "faces": { + "down": { "uv": [ 7, 5, 8, 6 ], "texture": "#lit" } + } + }, + { + "from": [ 6.5, 4.5, 2.5 ], + "to": [ 9.5, 7.5, 5.5 ], + "shade": false, + "faces": { + "south": { "uv": [ 9, 6, 10, 7 ], "texture": "#lit" } + } + }, + { + "from": [ 6.5, 4.5, 8.5 ], + "to": [ 9.5, 7.5, 11.5 ], + "shade": false, + "faces": { + "north": { "uv": [ 6, 6, 7, 7 ], "texture": "#lit" } + } + }, + { + "from": [ 3.5, 4.5, 5.5 ], + "to": [ 6.5, 7.5, 8.5 ], + "shade": false, + "faces": { + "east": { "uv": [ 9, 7, 10, 8 ], "texture": "#lit" } + } + }, + { + "from": [ 9.5, 4.5, 5.5 ], + "to": [ 12.5, 7.5, 8.5 ], + "shade": false, + "faces": { + "west": { "uv": [ 6, 7, 7, 8 ], "texture": "#lit" } } } ] diff --git a/assets/minecraft/models/block/repeater_1tick_on_locked.json b/assets/minecraft/models/block/repeater_1tick_on_locked.json index 60a40718..44e53d81 100644 --- a/assets/minecraft/models/block/repeater_1tick_on_locked.json +++ b/assets/minecraft/models/block/repeater_1tick_on_locked.json @@ -22,7 +22,6 @@ { "from": [ 2, 2, 6 ], "to": [ 14, 4, 8 ], "faces": { - "down": { "uv": [ 7, 2, 9, 14 ], "texture": "#lock", "rotation": 90 }, "up": { "uv": [ 7, 2, 9, 14 ], "texture": "#lock", "rotation": 90 }, "north": { "uv": [ 2, 7, 14, 9 ], "texture": "#lock" }, "south": { "uv": [ 2, 7, 14, 9 ], "texture": "#lock" }, @@ -30,24 +29,63 @@ "east": { "uv": [ 6, 7, 8, 9 ], "texture": "#lock" } } }, - { "from": [ 7, 7, 2 ], + { "from": [ 7, 2, 2 ], "to": [ 9, 7, 4 ], + "shade": false, "faces": { - "up": { "uv": [ 7, 6, 9, 8 ], "texture": "#lit" } + "up": { "uv": [ 7, 6, 9, 8 ], "texture": "#lit" }, + "north": { "uv": [ 7, 6, 9, 11 ], "texture": "#lit" }, + "south": { "uv": [ 7, 6, 9, 11 ], "texture": "#lit" }, + "west": { "uv": [ 7, 6, 9, 11 ], "texture": "#lit" }, + "east": { "uv": [ 7, 6, 9, 11 ], "texture": "#lit" } } }, - { "from": [ 7, 2, 1 ], - "to": [ 9, 8, 5 ], + { + "from": [ 6.5, 1.5, 1.5 ], + "to": [ 9.5, 4.5, 4.5 ], + "shade": false, "faces": { - "west": { "uv": [ 6, 5, 10, 11 ], "texture": "#lit" }, - "east": { "uv": [ 6, 5, 10, 11 ], "texture": "#lit" } + "up": { "uv": [ 8, 5, 9, 6 ], "texture": "#lit" } } }, - { "from": [ 6, 2, 2 ], - "to": [ 10, 8, 4 ], + { + "from": [ 6.5, 7.5, 1.5 ], + "to": [ 9.5, 10.5, 4.5 ], + "shade": false, "faces": { - "north": { "uv": [ 6, 5, 10, 11 ], "texture": "#lit" }, - "south": { "uv": [ 6, 5, 10, 11 ], "texture": "#lit" } + "down": { "uv": [ 7, 5, 8, 6 ], "texture": "#lit" } + } + }, + { + "from": [ 6.5, 4.5, -1.5 ], + "to": [ 9.5, 7.5, 1.5 ], + "shade": false, + "faces": { + "south": { "uv": [ 9, 6, 10, 7 ], "texture": "#lit" } + } + }, + { + "from": [ 6.5, 4.5, 4.5 ], + "to": [ 9.5, 7.5, 7.5 ], + "shade": false, + "faces": { + "north": { "uv": [ 6, 6, 7, 7 ], "texture": "#lit" } + } + }, + { + "from": [ 3.5, 4.5, 1.5 ], + "to": [ 6.5, 7.5, 4.5 ], + "shade": false, + "faces": { + "east": { "uv": [ 9, 7, 10, 8 ], "texture": "#lit" } + } + }, + { + "from": [ 9.5, 4.5, 1.5 ], + "to": [ 12.5, 7.5, 4.5 ], + "shade": false, + "faces": { + "west": { "uv": [ 6, 7, 7, 8 ], "texture": "#lit" } } } ] diff --git a/assets/minecraft/models/block/repeater_2tick.json b/assets/minecraft/models/block/repeater_2tick.json index b8323e2b..833c187b 100644 --- a/assets/minecraft/models/block/repeater_2tick.json +++ b/assets/minecraft/models/block/repeater_2tick.json @@ -21,7 +21,6 @@ { "from": [ 7, 2, 8 ], "to": [ 9, 7, 10 ], "faces": { - "down": { "uv": [ 7, 13, 9, 15 ], "texture": "#unlit" }, "up": { "uv": [ 7, 6, 9, 8 ], "texture": "#unlit" }, "north": { "uv": [ 7, 6, 9, 11 ], "texture": "#unlit" }, "south": { "uv": [ 7, 6, 9, 11 ], "texture": "#unlit" }, @@ -32,7 +31,6 @@ { "from": [ 7, 2, 2 ], "to": [ 9, 7, 4 ], "faces": { - "down": { "uv": [ 7, 13, 9, 15 ], "texture": "#unlit" }, "up": { "uv": [ 7, 6, 9, 8 ], "texture": "#unlit" }, "north": { "uv": [ 7, 6, 9, 11 ], "texture": "#unlit" }, "south": { "uv": [ 7, 6, 9, 11 ], "texture": "#unlit" }, diff --git a/assets/minecraft/models/block/repeater_2tick_locked.json b/assets/minecraft/models/block/repeater_2tick_locked.json index 8dc5975b..47c5337a 100644 --- a/assets/minecraft/models/block/repeater_2tick_locked.json +++ b/assets/minecraft/models/block/repeater_2tick_locked.json @@ -22,7 +22,6 @@ { "from": [ 2, 2, 8 ], "to": [ 14, 4, 10 ], "faces": { - "down": { "uv": [ 7, 2, 9, 14 ], "texture": "#lock", "rotation": 90 }, "up": { "uv": [ 7, 2, 9, 14 ], "texture": "#lock", "rotation": 90 }, "north": { "uv": [ 2, 7, 14, 9 ], "texture": "#lock" }, "south": { "uv": [ 2, 7, 14, 9 ], "texture": "#lock" }, @@ -33,7 +32,6 @@ { "from": [ 7, 2, 2 ], "to": [ 9, 7, 4 ], "faces": { - "down": { "uv": [ 7, 13, 9, 15 ], "texture": "#unlit" }, "up": { "uv": [ 7, 6, 9, 8 ], "texture": "#unlit" }, "north": { "uv": [ 7, 6, 9, 11 ], "texture": "#unlit" }, "south": { "uv": [ 7, 6, 9, 11 ], "texture": "#unlit" }, diff --git a/assets/minecraft/models/block/repeater_2tick_on.json b/assets/minecraft/models/block/repeater_2tick_on.json index 11a2bcb1..e7285624 100644 --- a/assets/minecraft/models/block/repeater_2tick_on.json +++ b/assets/minecraft/models/block/repeater_2tick_on.json @@ -18,44 +18,122 @@ "east": { "uv": [ 0, 14, 16, 16 ], "texture": "#slab", "cullface": "east" } } }, - { "from": [ 7, 7, 8 ], + { "from": [ 7, 2, 8 ], "to": [ 9, 7, 10 ], + "shade": false, "faces": { - "up": { "uv": [ 7, 6, 9, 8 ], "texture": "#lit" } + "up": { "uv": [ 7, 6, 9, 8 ], "texture": "#lit" }, + "north": { "uv": [ 7, 6, 9, 11 ], "texture": "#lit" }, + "south": { "uv": [ 7, 6, 9, 11 ], "texture": "#lit" }, + "west": { "uv": [ 7, 6, 9, 11 ], "texture": "#lit" }, + "east": { "uv": [ 7, 6, 9, 11 ], "texture": "#lit" } } }, - { "from": [ 7, 2, 7 ], - "to": [ 9, 8, 11 ], - "faces": { - "west": { "uv": [ 6, 5, 10, 11 ], "texture": "#lit" }, - "east": { "uv": [ 6, 5, 10, 11 ], "texture": "#lit" } - } - }, - { "from": [ 6, 2, 8 ], - "to": [ 10, 8, 10 ], - "faces": { - "north": { "uv": [ 6, 5, 10, 11 ], "texture": "#lit" }, - "south": { "uv": [ 6, 5, 10, 11 ], "texture": "#lit" } - } - }, - { "from": [ 7, 7, 2 ], + { "from": [ 7, 2, 2 ], "to": [ 9, 7, 4 ], + "shade": false, "faces": { - "up": { "uv": [ 7, 6, 9, 8 ], "texture": "#lit" } + "up": { "uv": [ 7, 6, 9, 8 ], "texture": "#lit" }, + "north": { "uv": [ 7, 6, 9, 11 ], "texture": "#lit" }, + "south": { "uv": [ 7, 6, 9, 11 ], "texture": "#lit" }, + "west": { "uv": [ 7, 6, 9, 11 ], "texture": "#lit" }, + "east": { "uv": [ 7, 6, 9, 11 ], "texture": "#lit" } } }, - { "from": [ 7, 2, 1 ], - "to": [ 9, 8, 5 ], + { + "from": [ 6.5, 1.5, 1.5 ], + "to": [ 9.5, 4.5, 4.5 ], + "shade": false, "faces": { - "west": { "uv": [ 6, 5, 10, 11 ], "texture": "#lit" }, - "east": { "uv": [ 6, 5, 10, 11 ], "texture": "#lit" } + "up": { "uv": [ 8, 5, 9, 6 ], "texture": "#lit" } } }, - { "from": [ 6, 2, 2 ], - "to": [ 10, 8, 4 ], + { + "from": [ 6.5, 7.5, 1.5 ], + "to": [ 9.5, 10.5, 4.5 ], + "shade": false, "faces": { - "north": { "uv": [ 6, 5, 10, 11 ], "texture": "#lit" }, - "south": { "uv": [ 6, 5, 10, 11 ], "texture": "#lit" } + "down": { "uv": [ 7, 5, 8, 6 ], "texture": "#lit" } + } + }, + { + "from": [ 6.5, 4.5, -1.5 ], + "to": [ 9.5, 7.5, 1.5 ], + "shade": false, + "faces": { + "south": { "uv": [ 9, 6, 10, 7 ], "texture": "#lit" } + } + }, + { + "from": [ 6.5, 4.5, 4.5 ], + "to": [ 9.5, 7.5, 7.5 ], + "shade": false, + "faces": { + "north": { "uv": [ 6, 6, 7, 7 ], "texture": "#lit" } + } + }, + { + "from": [ 3.5, 4.5, 1.5 ], + "to": [ 6.5, 7.5, 4.5 ], + "shade": false, + "faces": { + "east": { "uv": [ 9, 7, 10, 8 ], "texture": "#lit" } + } + }, + { + "from": [ 9.5, 4.5, 1.5 ], + "to": [ 12.5, 7.5, 4.5 ], + "shade": false, + "faces": { + "west": { "uv": [ 6, 7, 7, 8 ], "texture": "#lit" } + } + }, + { + "from": [ 6.5, 1.5, 7.5 ], + "to": [ 9.5, 4.5, 10.5 ], + "shade": false, + "faces": { + "up": { "uv": [ 8, 5, 9, 6 ], "texture": "#lit" } + } + }, + { + "from": [ 6.5, 7.5, 7.5 ], + "to": [ 9.5, 10.5, 10.5 ], + "shade": false, + "faces": { + "down": { "uv": [ 7, 5, 8, 6 ], "texture": "#lit" } + } + }, + { + "from": [ 6.5, 4.5, 4.5 ], + "to": [ 9.5, 7.5, 7.5 ], + "shade": false, + "faces": { + "south": { "uv": [ 9, 6, 10, 7 ], "texture": "#lit" } + } + }, + { + "from": [ 6.5, 4.5, 10.5 ], + "to": [ 9.5, 7.5, 13.5 ], + "shade": false, + "faces": { + "north": { "uv": [ 6, 6, 7, 7 ], "texture": "#lit" } + } + }, + { + "from": [ 3.5, 4.5, 7.5 ], + "to": [ 6.5, 7.5, 10.5 ], + "shade": false, + "faces": { + "east": { "uv": [ 9, 7, 10, 8 ], "texture": "#lit" } + } + }, + { + "from": [ 9.5, 4.5, 7.5 ], + "to": [ 12.5, 7.5, 10.5 ], + "shade": false, + "faces": { + "west": { "uv": [ 6, 7, 7, 8 ], "texture": "#lit" } } } ] diff --git a/assets/minecraft/models/block/repeater_2tick_on_locked.json b/assets/minecraft/models/block/repeater_2tick_on_locked.json index 12a1cbe8..897e0bfc 100644 --- a/assets/minecraft/models/block/repeater_2tick_on_locked.json +++ b/assets/minecraft/models/block/repeater_2tick_on_locked.json @@ -22,7 +22,6 @@ { "from": [ 2, 2, 8 ], "to": [ 14, 4, 10 ], "faces": { - "down": { "uv": [ 7, 2, 9, 14 ], "texture": "#lock", "rotation": 90 }, "up": { "uv": [ 7, 2, 9, 14 ], "texture": "#lock", "rotation": 90 }, "north": { "uv": [ 2, 7, 14, 9 ], "texture": "#lock" }, "south": { "uv": [ 2, 7, 14, 9 ], "texture": "#lock" }, @@ -30,24 +29,63 @@ "east": { "uv": [ 6, 7, 8, 9 ], "texture": "#lock" } } }, - { "from": [ 7, 7, 2 ], + { "from": [ 7, 2, 2 ], "to": [ 9, 7, 4 ], + "shade": false, "faces": { - "up": { "uv": [ 7, 6, 9, 8 ], "texture": "#lit" } + "up": { "uv": [ 7, 6, 9, 8 ], "texture": "#lit" }, + "north": { "uv": [ 7, 6, 9, 11 ], "texture": "#lit" }, + "south": { "uv": [ 7, 6, 9, 11 ], "texture": "#lit" }, + "west": { "uv": [ 7, 6, 9, 11 ], "texture": "#lit" }, + "east": { "uv": [ 7, 6, 9, 11 ], "texture": "#lit" } } }, - { "from": [ 7, 2, 1 ], - "to": [ 9, 8, 5 ], + { + "from": [ 6.5, 1.5, 1.5 ], + "to": [ 9.5, 4.5, 4.5 ], + "shade": false, "faces": { - "west": { "uv": [ 6, 5, 10, 11 ], "texture": "#lit" }, - "east": { "uv": [ 6, 5, 10, 11 ], "texture": "#lit" } + "up": { "uv": [ 8, 5, 9, 6 ], "texture": "#lit" } } }, - { "from": [ 6, 2, 2 ], - "to": [ 10, 8, 4 ], + { + "from": [ 6.5, 7.5, 1.5 ], + "to": [ 9.5, 10.5, 4.5 ], + "shade": false, "faces": { - "north": { "uv": [ 6, 5, 10, 11 ], "texture": "#lit" }, - "south": { "uv": [ 6, 5, 10, 11 ], "texture": "#lit" } + "down": { "uv": [ 7, 5, 8, 6 ], "texture": "#lit" } + } + }, + { + "from": [ 6.5, 4.5, -1.5 ], + "to": [ 9.5, 7.5, 1.5 ], + "shade": false, + "faces": { + "south": { "uv": [ 9, 6, 10, 7 ], "texture": "#lit" } + } + }, + { + "from": [ 6.5, 4.5, 4.5 ], + "to": [ 9.5, 7.5, 7.5 ], + "shade": false, + "faces": { + "north": { "uv": [ 6, 6, 7, 7 ], "texture": "#lit" } + } + }, + { + "from": [ 3.5, 4.5, 1.5 ], + "to": [ 6.5, 7.5, 4.5 ], + "shade": false, + "faces": { + "east": { "uv": [ 9, 7, 10, 8 ], "texture": "#lit" } + } + }, + { + "from": [ 9.5, 4.5, 1.5 ], + "to": [ 12.5, 7.5, 4.5 ], + "shade": false, + "faces": { + "west": { "uv": [ 6, 7, 7, 8 ], "texture": "#lit" } } } ] diff --git a/assets/minecraft/models/block/repeater_3tick.json b/assets/minecraft/models/block/repeater_3tick.json index e854cc01..ea1d922c 100644 --- a/assets/minecraft/models/block/repeater_3tick.json +++ b/assets/minecraft/models/block/repeater_3tick.json @@ -21,7 +21,6 @@ { "from": [ 7, 2, 10 ], "to": [ 9, 7, 12 ], "faces": { - "down": { "uv": [ 7, 13, 9, 15 ], "texture": "#unlit" }, "up": { "uv": [ 7, 6, 9, 8 ], "texture": "#unlit" }, "north": { "uv": [ 7, 6, 9, 11 ], "texture": "#unlit" }, "south": { "uv": [ 7, 6, 9, 11 ], "texture": "#unlit" }, @@ -32,7 +31,6 @@ { "from": [ 7, 2, 2 ], "to": [ 9, 7, 4 ], "faces": { - "down": { "uv": [ 7, 13, 9, 15 ], "texture": "#unlit" }, "up": { "uv": [ 7, 6, 9, 8 ], "texture": "#unlit" }, "north": { "uv": [ 7, 6, 9, 11 ], "texture": "#unlit" }, "south": { "uv": [ 7, 6, 9, 11 ], "texture": "#unlit" }, diff --git a/assets/minecraft/models/block/repeater_3tick_locked.json b/assets/minecraft/models/block/repeater_3tick_locked.json index 6d64a3dc..13ce208d 100644 --- a/assets/minecraft/models/block/repeater_3tick_locked.json +++ b/assets/minecraft/models/block/repeater_3tick_locked.json @@ -22,7 +22,6 @@ { "from": [ 2, 2, 10 ], "to": [ 14, 4, 12 ], "faces": { - "down": { "uv": [ 7, 2, 9, 14 ], "texture": "#lock", "rotation": 90 }, "up": { "uv": [ 7, 2, 9, 14 ], "texture": "#lock", "rotation": 90 }, "north": { "uv": [ 2, 7, 14, 9 ], "texture": "#lock" }, "south": { "uv": [ 2, 7, 14, 9 ], "texture": "#lock" }, @@ -33,7 +32,6 @@ { "from": [ 7, 2, 2 ], "to": [ 9, 7, 4 ], "faces": { - "down": { "uv": [ 7, 13, 9, 15 ], "texture": "#unlit" }, "up": { "uv": [ 7, 6, 9, 8 ], "texture": "#unlit" }, "north": { "uv": [ 7, 6, 9, 11 ], "texture": "#unlit" }, "south": { "uv": [ 7, 6, 9, 11 ], "texture": "#unlit" }, diff --git a/assets/minecraft/models/block/repeater_3tick_on.json b/assets/minecraft/models/block/repeater_3tick_on.json index 414032e6..fd141383 100644 --- a/assets/minecraft/models/block/repeater_3tick_on.json +++ b/assets/minecraft/models/block/repeater_3tick_on.json @@ -18,44 +18,122 @@ "east": { "uv": [ 0, 14, 16, 16 ], "texture": "#slab", "cullface": "east" } } }, - { "from": [ 7, 7, 10 ], + { "from": [ 7, 2, 10 ], "to": [ 9, 7, 12 ], + "shade": false, "faces": { - "up": { "uv": [ 7, 6, 9, 8 ], "texture": "#lit" } + "up": { "uv": [ 7, 6, 9, 8 ], "texture": "#lit" }, + "north": { "uv": [ 7, 6, 9, 11 ], "texture": "#lit" }, + "south": { "uv": [ 7, 6, 9, 11 ], "texture": "#lit" }, + "west": { "uv": [ 7, 6, 9, 11 ], "texture": "#lit" }, + "east": { "uv": [ 7, 6, 9, 11 ], "texture": "#lit" } } }, - { "from": [ 7, 2, 9 ], - "to": [ 9, 8, 13 ], - "faces": { - "west": { "uv": [ 6, 5, 10, 11 ], "texture": "#lit" }, - "east": { "uv": [ 6, 5, 10, 11 ], "texture": "#lit" } - } - }, - { "from": [ 6, 2, 10 ], - "to": [ 10, 8, 12 ], - "faces": { - "north": { "uv": [ 6, 5, 10, 11 ], "texture": "#lit" }, - "south": { "uv": [ 6, 5, 10, 11 ], "texture": "#lit" } - } - }, - { "from": [ 7, 7, 2 ], + { "from": [ 7, 2, 2 ], "to": [ 9, 7, 4 ], + "shade": false, "faces": { - "up": { "uv": [ 7, 6, 9, 8 ], "texture": "#lit" } + "up": { "uv": [ 7, 6, 9, 8 ], "texture": "#lit" }, + "north": { "uv": [ 7, 6, 9, 11 ], "texture": "#lit" }, + "south": { "uv": [ 7, 6, 9, 11 ], "texture": "#lit" }, + "west": { "uv": [ 7, 6, 9, 11 ], "texture": "#lit" }, + "east": { "uv": [ 7, 6, 9, 11 ], "texture": "#lit" } } }, - { "from": [ 7, 2, 1 ], - "to": [ 9, 8, 5 ], + { + "from": [ 6.5, 1.5, 1.5 ], + "to": [ 9.5, 4.5, 4.5 ], + "shade": false, "faces": { - "west": { "uv": [ 6, 5, 10, 11 ], "texture": "#lit" }, - "east": { "uv": [ 6, 5, 10, 11 ], "texture": "#lit" } + "up": { "uv": [ 8, 5, 9, 6 ], "texture": "#lit" } } }, - { "from": [ 6, 2, 2 ], - "to": [ 10, 8, 4 ], + { + "from": [ 6.5, 7.5, 1.5 ], + "to": [ 9.5, 10.5, 4.5 ], + "shade": false, "faces": { - "north": { "uv": [ 6, 5, 10, 11 ], "texture": "#lit" }, - "south": { "uv": [ 6, 5, 10, 11 ], "texture": "#lit" } + "down": { "uv": [ 7, 5, 8, 6 ], "texture": "#lit" } + } + }, + { + "from": [ 6.5, 4.5, -1.5 ], + "to": [ 9.5, 7.5, 1.5 ], + "shade": false, + "faces": { + "south": { "uv": [ 9, 6, 10, 7 ], "texture": "#lit" } + } + }, + { + "from": [ 6.5, 4.5, 4.5 ], + "to": [ 9.5, 7.5, 7.5 ], + "shade": false, + "faces": { + "north": { "uv": [ 6, 6, 7, 7 ], "texture": "#lit" } + } + }, + { + "from": [ 3.5, 4.5, 1.5 ], + "to": [ 6.5, 7.5, 4.5 ], + "shade": false, + "faces": { + "east": { "uv": [ 9, 7, 10, 8 ], "texture": "#lit" } + } + }, + { + "from": [ 9.5, 4.5, 1.5 ], + "to": [ 12.5, 7.5, 4.5 ], + "shade": false, + "faces": { + "west": { "uv": [ 6, 7, 7, 8 ], "texture": "#lit" } + } + }, + { + "from": [ 6.5, 1.5, 9.5 ], + "to": [ 9.5, 4.5, 12.5 ], + "shade": false, + "faces": { + "up": { "uv": [ 8, 5, 9, 6 ], "texture": "#lit" } + } + }, + { + "from": [ 6.5, 7.5, 9.5 ], + "to": [ 9.5, 10.5, 12.5 ], + "shade": false, + "faces": { + "down": { "uv": [ 7, 5, 8, 6 ], "texture": "#lit" } + } + }, + { + "from": [ 6.5, 4.5, 6.5 ], + "to": [ 9.5, 7.5, 9.5 ], + "shade": false, + "faces": { + "south": { "uv": [ 9, 6, 10, 7 ], "texture": "#lit" } + } + }, + { + "from": [ 6.5, 4.5, 12.5 ], + "to": [ 9.5, 7.5, 15.5 ], + "shade": false, + "faces": { + "north": { "uv": [ 6, 6, 7, 7 ], "texture": "#lit" } + } + }, + { + "from": [ 3.5, 4.5, 9.5 ], + "to": [ 6.5, 7.5, 12.5 ], + "shade": false, + "faces": { + "east": { "uv": [ 9, 7, 10, 8 ], "texture": "#lit" } + } + }, + { + "from": [ 9.5, 4.5, 9.5 ], + "to": [ 12.5, 7.5, 12.5 ], + "shade": false, + "faces": { + "west": { "uv": [ 6, 7, 7, 8 ], "texture": "#lit" } } } ] diff --git a/assets/minecraft/models/block/repeater_3tick_on_locked.json b/assets/minecraft/models/block/repeater_3tick_on_locked.json index 5c21a323..d5aca9eb 100644 --- a/assets/minecraft/models/block/repeater_3tick_on_locked.json +++ b/assets/minecraft/models/block/repeater_3tick_on_locked.json @@ -22,7 +22,6 @@ { "from": [ 2, 2, 10 ], "to": [ 14, 4, 12 ], "faces": { - "down": { "uv": [ 7, 2, 9, 14 ], "texture": "#lock", "rotation": 90 }, "up": { "uv": [ 7, 2, 9, 14 ], "texture": "#lock", "rotation": 90 }, "north": { "uv": [ 2, 7, 14, 9 ], "texture": "#lock" }, "south": { "uv": [ 2, 7, 14, 9 ], "texture": "#lock" }, @@ -30,24 +29,63 @@ "east": { "uv": [ 6, 7, 8, 9 ], "texture": "#lock" } } }, - { "from": [ 7, 7, 2 ], + { "from": [ 7, 2, 2 ], "to": [ 9, 7, 4 ], + "shade": false, "faces": { - "up": { "uv": [ 7, 6, 9, 8 ], "texture": "#lit" } + "up": { "uv": [ 7, 6, 9, 8 ], "texture": "#lit" }, + "north": { "uv": [ 7, 6, 9, 11 ], "texture": "#lit" }, + "south": { "uv": [ 7, 6, 9, 11 ], "texture": "#lit" }, + "west": { "uv": [ 7, 6, 9, 11 ], "texture": "#lit" }, + "east": { "uv": [ 7, 6, 9, 11 ], "texture": "#lit" } } }, - { "from": [ 7, 2, 1 ], - "to": [ 9, 8, 5 ], + { + "from": [ 6.5, 1.5, 1.5 ], + "to": [ 9.5, 4.5, 4.5 ], + "shade": false, "faces": { - "west": { "uv": [ 6, 5, 10, 11 ], "texture": "#lit" }, - "east": { "uv": [ 6, 5, 10, 11 ], "texture": "#lit" } + "up": { "uv": [ 8, 5, 9, 6 ], "texture": "#lit" } } }, - { "from": [ 6, 2, 2 ], - "to": [ 10, 8, 4 ], + { + "from": [ 6.5, 7.5, 1.5 ], + "to": [ 9.5, 10.5, 4.5 ], + "shade": false, "faces": { - "north": { "uv": [ 6, 5, 10, 11 ], "texture": "#lit" }, - "south": { "uv": [ 6, 5, 10, 11 ], "texture": "#lit" } + "down": { "uv": [ 7, 5, 8, 6 ], "texture": "#lit" } + } + }, + { + "from": [ 6.5, 4.5, -1.5 ], + "to": [ 9.5, 7.5, 1.5 ], + "shade": false, + "faces": { + "south": { "uv": [ 9, 6, 10, 7 ], "texture": "#lit" } + } + }, + { + "from": [ 6.5, 4.5, 4.5 ], + "to": [ 9.5, 7.5, 7.5 ], + "shade": false, + "faces": { + "north": { "uv": [ 6, 6, 7, 7 ], "texture": "#lit" } + } + }, + { + "from": [ 3.5, 4.5, 1.5 ], + "to": [ 6.5, 7.5, 4.5 ], + "shade": false, + "faces": { + "east": { "uv": [ 9, 7, 10, 8 ], "texture": "#lit" } + } + }, + { + "from": [ 9.5, 4.5, 1.5 ], + "to": [ 12.5, 7.5, 4.5 ], + "shade": false, + "faces": { + "west": { "uv": [ 6, 7, 7, 8 ], "texture": "#lit" } } } ] diff --git a/assets/minecraft/models/block/repeater_4tick.json b/assets/minecraft/models/block/repeater_4tick.json index a708a44f..f8b357b6 100644 --- a/assets/minecraft/models/block/repeater_4tick.json +++ b/assets/minecraft/models/block/repeater_4tick.json @@ -21,7 +21,6 @@ { "from": [ 7, 2, 12 ], "to": [ 9, 7, 14 ], "faces": { - "down": { "uv": [ 7, 13, 9, 15 ], "texture": "#unlit" }, "up": { "uv": [ 7, 6, 9, 8 ], "texture": "#unlit" }, "north": { "uv": [ 7, 6, 9, 11 ], "texture": "#unlit" }, "south": { "uv": [ 7, 6, 9, 11 ], "texture": "#unlit" }, @@ -32,7 +31,6 @@ { "from": [ 7, 2, 2 ], "to": [ 9, 7, 4 ], "faces": { - "down": { "uv": [ 7, 13, 9, 15 ], "texture": "#unlit" }, "up": { "uv": [ 7, 6, 9, 8 ], "texture": "#unlit" }, "north": { "uv": [ 7, 6, 9, 11 ], "texture": "#unlit" }, "south": { "uv": [ 7, 6, 9, 11 ], "texture": "#unlit" }, diff --git a/assets/minecraft/models/block/repeater_4tick_locked.json b/assets/minecraft/models/block/repeater_4tick_locked.json index fac32c88..7a6aca0c 100644 --- a/assets/minecraft/models/block/repeater_4tick_locked.json +++ b/assets/minecraft/models/block/repeater_4tick_locked.json @@ -22,7 +22,6 @@ { "from": [ 2, 2, 12 ], "to": [ 14, 4, 14 ], "faces": { - "down": { "uv": [ 7, 2, 9, 14 ], "texture": "#lock", "rotation": 90 }, "up": { "uv": [ 7, 2, 9, 14 ], "texture": "#lock", "rotation": 90 }, "north": { "uv": [ 2, 7, 14, 9 ], "texture": "#lock" }, "south": { "uv": [ 2, 7, 14, 9 ], "texture": "#lock" }, @@ -33,7 +32,6 @@ { "from": [ 7, 2, 2 ], "to": [ 9, 7, 4 ], "faces": { - "down": { "uv": [ 7, 13, 9, 15 ], "texture": "#unlit" }, "up": { "uv": [ 7, 6, 9, 8 ], "texture": "#unlit" }, "north": { "uv": [ 7, 6, 9, 11 ], "texture": "#unlit" }, "south": { "uv": [ 7, 6, 9, 11 ], "texture": "#unlit" }, diff --git a/assets/minecraft/models/block/repeater_4tick_on.json b/assets/minecraft/models/block/repeater_4tick_on.json index 4e081aa8..01cd3288 100644 --- a/assets/minecraft/models/block/repeater_4tick_on.json +++ b/assets/minecraft/models/block/repeater_4tick_on.json @@ -18,44 +18,122 @@ "east": { "uv": [ 0, 14, 16, 16 ], "texture": "#slab", "cullface": "east" } } }, - { "from": [ 7, 7, 12 ], + { "from": [ 7, 2, 12 ], "to": [ 9, 7, 14 ], + "shade": false, "faces": { - "up": { "uv": [ 7, 6, 9, 8 ], "texture": "#lit" } + "up": { "uv": [ 7, 6, 9, 8 ], "texture": "#lit" }, + "north": { "uv": [ 7, 6, 9, 11 ], "texture": "#lit" }, + "south": { "uv": [ 7, 6, 9, 11 ], "texture": "#lit" }, + "west": { "uv": [ 7, 6, 9, 11 ], "texture": "#lit" }, + "east": { "uv": [ 7, 6, 9, 11 ], "texture": "#lit" } } }, - { "from": [ 7, 2, 11 ], - "to": [ 9, 8, 15 ], - "faces": { - "west": { "uv": [ 6, 5, 10, 11 ], "texture": "#lit" }, - "east": { "uv": [ 6, 5, 10, 11 ], "texture": "#lit" } - } - }, - { "from": [ 6, 2, 12 ], - "to": [ 10, 8, 14 ], - "faces": { - "north": { "uv": [ 6, 5, 10, 11 ], "texture": "#lit" }, - "south": { "uv": [ 6, 5, 10, 11 ], "texture": "#lit" } - } - }, - { "from": [ 7, 7, 2 ], + { "from": [ 7, 2, 2 ], "to": [ 9, 7, 4 ], + "shade": false, "faces": { - "up": { "uv": [ 7, 6, 9, 8 ], "texture": "#lit" } + "up": { "uv": [ 7, 6, 9, 8 ], "texture": "#lit" }, + "north": { "uv": [ 7, 6, 9, 11 ], "texture": "#lit" }, + "south": { "uv": [ 7, 6, 9, 11 ], "texture": "#lit" }, + "west": { "uv": [ 7, 6, 9, 11 ], "texture": "#lit" }, + "east": { "uv": [ 7, 6, 9, 11 ], "texture": "#lit" } } }, - { "from": [ 7, 2, 1 ], - "to": [ 9, 8, 5 ], + { + "from": [ 6.5, 1.5, 1.5 ], + "to": [ 9.5, 4.5, 4.5 ], + "shade": false, "faces": { - "west": { "uv": [ 6, 5, 10, 11 ], "texture": "#lit" }, - "east": { "uv": [ 6, 5, 10, 11 ], "texture": "#lit" } + "up": { "uv": [ 8, 5, 9, 6 ], "texture": "#lit" } } }, - { "from": [ 6, 2, 2 ], - "to": [ 10, 8, 4 ], + { + "from": [ 6.5, 7.5, 1.5 ], + "to": [ 9.5, 10.5, 4.5 ], + "shade": false, "faces": { - "north": { "uv": [ 6, 5, 10, 11 ], "texture": "#lit" }, - "south": { "uv": [ 6, 5, 10, 11 ], "texture": "#lit" } + "down": { "uv": [ 7, 5, 8, 6 ], "texture": "#lit" } + } + }, + { + "from": [ 6.5, 4.5, -1.5 ], + "to": [ 9.5, 7.5, 1.5 ], + "shade": false, + "faces": { + "south": { "uv": [ 9, 6, 10, 7 ], "texture": "#lit" } + } + }, + { + "from": [ 6.5, 4.5, 4.5 ], + "to": [ 9.5, 7.5, 7.5 ], + "shade": false, + "faces": { + "north": { "uv": [ 6, 6, 7, 7 ], "texture": "#lit" } + } + }, + { + "from": [ 3.5, 4.5, 1.5 ], + "to": [ 6.5, 7.5, 4.5 ], + "shade": false, + "faces": { + "east": { "uv": [ 9, 7, 10, 8 ], "texture": "#lit" } + } + }, + { + "from": [ 9.5, 4.5, 1.5 ], + "to": [ 12.5, 7.5, 4.5 ], + "shade": false, + "faces": { + "west": { "uv": [ 6, 7, 7, 8 ], "texture": "#lit" } + } + }, + { + "from": [ 6.5, 1.5, 11.5 ], + "to": [ 9.5, 4.5, 14.5 ], + "shade": false, + "faces": { + "up": { "uv": [ 8, 5, 9, 6 ], "texture": "#lit" } + } + }, + { + "from": [ 6.5, 7.5, 11.5 ], + "to": [ 9.5, 10.5, 14.5 ], + "shade": false, + "faces": { + "down": { "uv": [ 7, 5, 8, 6 ], "texture": "#lit" } + } + }, + { + "from": [ 6.5, 4.5, 8.5 ], + "to": [ 9.5, 7.5, 11.5 ], + "shade": false, + "faces": { + "south": { "uv": [ 9, 6, 10, 7 ], "texture": "#lit" } + } + }, + { + "from": [ 6.5, 4.5, 14.5 ], + "to": [ 9.5, 7.5, 17.5 ], + "shade": false, + "faces": { + "north": { "uv": [ 6, 6, 7, 7 ], "texture": "#lit" } + } + }, + { + "from": [ 3.5, 4.5, 11.5 ], + "to": [ 6.5, 7.5, 14.5 ], + "shade": false, + "faces": { + "east": { "uv": [ 9, 7, 10, 8 ], "texture": "#lit" } + } + }, + { + "from": [ 9.5, 4.5, 11.5 ], + "to": [ 12.5, 7.5, 14.5 ], + "shade": false, + "faces": { + "west": { "uv": [ 6, 7, 7, 8 ], "texture": "#lit" } } } ] diff --git a/assets/minecraft/models/block/repeater_4tick_on_locked.json b/assets/minecraft/models/block/repeater_4tick_on_locked.json index fcdd6448..6ad187cd 100644 --- a/assets/minecraft/models/block/repeater_4tick_on_locked.json +++ b/assets/minecraft/models/block/repeater_4tick_on_locked.json @@ -22,7 +22,6 @@ { "from": [ 2, 2, 12 ], "to": [ 14, 4, 14 ], "faces": { - "down": { "uv": [ 7, 2, 9, 14 ], "texture": "#lock", "rotation": 90 }, "up": { "uv": [ 7, 2, 9, 14 ], "texture": "#lock", "rotation": 90 }, "north": { "uv": [ 2, 7, 14, 9 ], "texture": "#lock" }, "south": { "uv": [ 2, 7, 14, 9 ], "texture": "#lock" }, @@ -30,24 +29,63 @@ "east": { "uv": [ 6, 7, 8, 9 ], "texture": "#lock" } } }, - { "from": [ 7, 7, 2 ], + { "from": [ 7, 2, 2 ], "to": [ 9, 7, 4 ], + "shade": false, "faces": { - "up": { "uv": [ 7, 6, 9, 8 ], "texture": "#lit" } + "up": { "uv": [ 7, 6, 9, 8 ], "texture": "#lit" }, + "north": { "uv": [ 7, 6, 9, 11 ], "texture": "#lit" }, + "south": { "uv": [ 7, 6, 9, 11 ], "texture": "#lit" }, + "west": { "uv": [ 7, 6, 9, 11 ], "texture": "#lit" }, + "east": { "uv": [ 7, 6, 9, 11 ], "texture": "#lit" } } }, - { "from": [ 7, 2, 1 ], - "to": [ 9, 8, 5 ], + { + "from": [ 6.5, 1.5, 1.5 ], + "to": [ 9.5, 4.5, 4.5 ], + "shade": false, "faces": { - "west": { "uv": [ 6, 5, 10, 11 ], "texture": "#lit" }, - "east": { "uv": [ 6, 5, 10, 11 ], "texture": "#lit" } + "up": { "uv": [ 8, 5, 9, 6 ], "texture": "#lit" } } }, - { "from": [ 6, 2, 2 ], - "to": [ 10, 8, 4 ], + { + "from": [ 6.5, 7.5, 1.5 ], + "to": [ 9.5, 10.5, 4.5 ], + "shade": false, "faces": { - "north": { "uv": [ 6, 5, 10, 11 ], "texture": "#lit" }, - "south": { "uv": [ 6, 5, 10, 11 ], "texture": "#lit" } + "down": { "uv": [ 7, 5, 8, 6 ], "texture": "#lit" } + } + }, + { + "from": [ 6.5, 4.5, -1.5 ], + "to": [ 9.5, 7.5, 1.5 ], + "shade": false, + "faces": { + "south": { "uv": [ 9, 6, 10, 7 ], "texture": "#lit" } + } + }, + { + "from": [ 6.5, 4.5, 4.5 ], + "to": [ 9.5, 7.5, 7.5 ], + "shade": false, + "faces": { + "north": { "uv": [ 6, 6, 7, 7 ], "texture": "#lit" } + } + }, + { + "from": [ 3.5, 4.5, 1.5 ], + "to": [ 6.5, 7.5, 4.5 ], + "shade": false, + "faces": { + "east": { "uv": [ 9, 7, 10, 8 ], "texture": "#lit" } + } + }, + { + "from": [ 9.5, 4.5, 1.5 ], + "to": [ 12.5, 7.5, 4.5 ], + "shade": false, + "faces": { + "west": { "uv": [ 6, 7, 7, 8 ], "texture": "#lit" } } } ] diff --git a/assets/minecraft/models/block/scaffolding_unstable.json b/assets/minecraft/models/block/scaffolding_unstable.json index f5d64e3c..72ba9369 100644 --- a/assets/minecraft/models/block/scaffolding_unstable.json +++ b/assets/minecraft/models/block/scaffolding_unstable.json @@ -109,7 +109,7 @@ "faces": { "north": { "texture": "#side", "uv": [2, 0, 14, 2] , "cullface": "north" }, "south": { "texture": "#side", "uv": [2, 2, 14, 4] }, - "down": { "texture": "#bottom", "cullface": "bottom" } + "down": { "texture": "#bottom", "cullface": "down" } } }, { @@ -118,7 +118,7 @@ "faces": { "north": { "texture": "#side", "uv": [14, 0, 2, 2] }, "south": { "texture": "#side", "uv": [2, 0, 14, 2] , "cullface": "south" }, - "down": { "texture": "#bottom", "cullface": "bottom" } + "down": { "texture": "#bottom", "cullface": "down" } } }, { @@ -127,7 +127,7 @@ "faces": { "east": { "texture": "#side", "uv": [14, 0, 2, 2], "cullface": "east"}, "west": { "texture": "#side", "uv": [14, 2, 2, 4] }, - "down": { "texture": "#bottom", "cullface": "bottom" } + "down": { "texture": "#bottom", "cullface": "down" } } }, { @@ -136,8 +136,8 @@ "faces": { "east": { "texture": "#side", "uv": [2, 0, 14, 2] }, "west": { "texture": "#side", "uv": [14, 0, 2, 2], "cullface": "west" }, - "down": { "texture": "#bottom", "cullface": "bottom" } + "down": { "texture": "#bottom", "cullface": "down" } } } ] -} \ No newline at end of file +} diff --git a/assets/minecraft/models/block/small_dripleaf_bottom.json b/assets/minecraft/models/block/small_dripleaf_bottom.json index c6913e7c..df2b8fe5 100644 --- a/assets/minecraft/models/block/small_dripleaf_bottom.json +++ b/assets/minecraft/models/block/small_dripleaf_bottom.json @@ -10,8 +10,8 @@ "rotation": { "origin": [ 8, 8, 8 ], "axis": "y", "angle": 45, "rescale": false }, "shade": false, "faces": { - "north": { "uv": [ 3, 0, 14, 16 ], "texture": "#stem" }, - "south": { "uv": [ 3, 0, 14, 16 ], "texture": "#stem" } + "north": { "uv": [ 5, 0, 12, 16 ], "texture": "#stem" }, + "south": { "uv": [ 5, 0, 12, 16 ], "texture": "#stem" } } }, { "from": [ 4.5, 0, 8 ], @@ -19,8 +19,8 @@ "rotation": { "origin": [ 8, 8, 8 ], "axis": "y", "angle": -45, "rescale": false }, "shade": false, "faces": { - "north": { "uv": [ 3, 0, 14, 16 ], "texture": "#stem" }, - "south": { "uv": [ 3, 0, 14, 16 ], "texture": "#stem" } + "north": { "uv": [ 5, 0, 12, 16 ], "texture": "#stem" }, + "south": { "uv": [ 5, 0, 12, 16 ], "texture": "#stem" } } } ] diff --git a/assets/minecraft/models/block/small_dripleaf_top.json b/assets/minecraft/models/block/small_dripleaf_top.json index c9e2929c..847edac3 100644 --- a/assets/minecraft/models/block/small_dripleaf_top.json +++ b/assets/minecraft/models/block/small_dripleaf_top.json @@ -7,24 +7,24 @@ "particle": "block/small_dripleaf_top" }, "elements": [ - { "from": [ 8, 2.99, 8 ], - "to": [ 15, 2.99, 15 ], + { "from": [ 8, 3, 8 ], + "to": [ 15, 3, 15 ], "shade": false, "faces": { "down": { "uv": [ 8, 0, 0, 8 ], "texture": "#top" }, "up": { "uv": [ 8, 8, 0, 0 ], "texture": "#top" } } }, - { "from": [ 1, 8, 1 ], - "to": [ 8, 8, 8 ], + { "from": [ 1, 8.02, 1 ], + "to": [ 8, 8.02, 8 ], "shade": false, "faces": { "down": { "uv": [ 0, 8, 8, 0 ], "texture": "#top" }, "up": { "uv": [ 0, 0, 8, 8 ], "texture": "#top" } } }, - { "from": [ 1, 12, 8 ], - "to": [ 8, 12, 15 ], + { "from": [ 1, 12.02, 8 ], + "to": [ 8, 12.02, 15 ], "shade": false, "faces": { "down": { "uv": [ 8, 0, 0, 8 ], "texture": "#top" , "rotation": 270}, @@ -41,8 +41,8 @@ "south": { "uv": [ 0, 0, 8, 1 ], "texture": "#side" } } }, - { "from": [ 1, 7, 1.01 ], - "to": [ 8, 8, 8 ], + { "from": [ 1, 7.02, 1 ], + "to": [ 8, 8.02, 8 ], "shade": false, "faces": { "east": { "uv": [ 0, 0, 8, 1 ], "texture": "#side" }, @@ -51,8 +51,8 @@ "south": { "uv": [ 0, 0, 8, 1 ], "texture": "#side" } } }, - { "from": [ 1, 11, 8 ], - "to": [ 8, 12, 15 ], + { "from": [ 1, 11.02, 8 ], + "to": [ 8, 12.02, 15 ], "shade": false, "faces": { "east": { "uv": [ 0, 0, 8, 1 ], "texture": "#side"}, diff --git a/assets/minecraft/models/block/stripped_pale_oak_log.json b/assets/minecraft/models/block/stripped_pale_oak_log.json new file mode 100644 index 00000000..92a32ce9 --- /dev/null +++ b/assets/minecraft/models/block/stripped_pale_oak_log.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:block/cube_column", + "textures": { + "end": "minecraft:block/stripped_pale_oak_log_top", + "side": "minecraft:block/stripped_pale_oak_log" + } +} \ No newline at end of file diff --git a/assets/minecraft/models/block/stripped_pale_oak_log_horizontal.json b/assets/minecraft/models/block/stripped_pale_oak_log_horizontal.json new file mode 100644 index 00000000..eedd285b --- /dev/null +++ b/assets/minecraft/models/block/stripped_pale_oak_log_horizontal.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:block/cube_column_horizontal", + "textures": { + "end": "minecraft:block/stripped_pale_oak_log_top", + "side": "minecraft:block/stripped_pale_oak_log" + } +} \ No newline at end of file diff --git a/assets/minecraft/models/block/stripped_pale_oak_wood.json b/assets/minecraft/models/block/stripped_pale_oak_wood.json new file mode 100644 index 00000000..9ace5fd3 --- /dev/null +++ b/assets/minecraft/models/block/stripped_pale_oak_wood.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:block/cube_column", + "textures": { + "end": "minecraft:block/stripped_pale_oak_log", + "side": "minecraft:block/stripped_pale_oak_log" + } +} \ No newline at end of file diff --git a/assets/minecraft/models/block/template_redstone_torch.json b/assets/minecraft/models/block/template_redstone_torch.json new file mode 100644 index 00000000..de6022cd --- /dev/null +++ b/assets/minecraft/models/block/template_redstone_torch.json @@ -0,0 +1,68 @@ +{ + "ambientocclusion": false, + "textures": { + "particle": "#torch" + }, + "elements": [ + { "from": [ 7, 0, 7 ], + "to": [ 9, 10, 9 ], + "shade": false, + "faces": { + "down": { "uv": [ 7, 13, 9, 15 ], "texture": "#torch", "cullface": "down" }, + "up": { "uv": [ 7, 6, 9, 8 ], "texture": "#torch" }, + "north": { "uv": [ 7, 6, 9, 16 ], "texture": "#torch" }, + "east": { "uv": [ 7, 6, 9, 16 ], "texture": "#torch" }, + "south": { "uv": [ 7, 6, 9, 16 ], "texture": "#torch" }, + "west": { "uv": [ 7, 6, 9, 16 ], "texture": "#torch" } + } + }, + { + "from": [ 6.5, 7.5, 6.5 ], + "to": [ 9.5, 7.5, 9.5 ], + "shade": false, + "faces": { + "up": { "uv": [ 8, 5, 9, 6 ], "texture": "#torch" } + } + }, + { + "from": [ 6.5, 10.5, 6.5 ], + "to": [ 9.5, 10.5, 9.5 ], + "shade": false, + "faces": { + "down": { "uv": [ 7, 5, 8, 6 ], "texture": "#torch" } + } + }, + { + "from": [ 6.5, 7.5, 6.5 ], + "to": [ 9.5, 10.5, 6.5 ], + "shade": false, + "faces": { + "south": { "uv": [ 9, 6, 10, 7 ], "texture": "#torch" } + } + }, + { + "from": [ 9.5, 7.5, 6.5 ], + "to": [ 9.5, 10.5, 9.5 ], + "shade": false, + "faces": { + "west": { "uv": [ 6, 7, 7, 8 ], "texture": "#torch" } + } + }, + { + "from": [ 6.5, 7.5, 9.5 ], + "to": [ 9.5, 10.5, 9.5 ], + "shade": false, + "faces": { + "north": { "uv": [ 6, 6, 7, 7 ], "texture": "#torch" } + } + }, + { + "from": [ 6.5, 7.5, 6.5 ], + "to": [ 6.5, 10.5, 9.5 ], + "shade": false, + "faces": { + "east": { "uv": [ 9, 7, 10, 8 ], "texture": "#torch" } + } + } + ] +} diff --git a/assets/minecraft/models/block/template_redstone_torch_wall.json b/assets/minecraft/models/block/template_redstone_torch_wall.json new file mode 100644 index 00000000..6c11497f --- /dev/null +++ b/assets/minecraft/models/block/template_redstone_torch_wall.json @@ -0,0 +1,75 @@ +{ + "ambientocclusion": false, + "textures": { + "particle": "#torch" + }, + "elements": [ + { "from": [ -1, 3.5, 7 ], + "to": [ 1, 13.5, 9 ], + "rotation": { "origin": [ 0, 3.5, 8 ], "axis": "z", "angle": -22.5 }, + "shade": false, + "faces": { + "down": { "uv": [ 7, 13, 9, 15 ], "texture": "#torch" }, + "up": { "uv": [ 7, 6, 9, 8 ], "texture": "#torch" }, + "north": { "uv": [ 7, 6, 9, 16 ], "texture": "#torch" }, + "east": { "uv": [ 7, 6, 9, 16 ], "texture": "#torch" }, + "south": { "uv": [ 7, 6, 9, 16 ], "texture": "#torch" }, + "west": { "uv": [ 7, 6, 9, 16 ], "texture": "#torch" } + } + }, + { + "from": [ -1.5, 8, 6.5 ], + "to": [ 1.5, 11, 9.5 ], + "shade": false, + "rotation": { "origin": [ 0, 3.5, 8 ], "axis": "z", "angle": -22.5 }, + "faces": { + "up": { "uv": [ 6, 5, 7, 6 ], "texture": "#torch" } + } + }, + { + "from": [ -1.5, 14, 6.5 ], + "to": [ 1.5, 17, 9.5 ], + "shade": false, + "rotation": { "origin": [ 0, 3.5, 8 ], "axis": "z", "angle": -22.5 }, + "faces": { + "down": { "uv": [ 6, 5, 7, 6 ], "texture": "#torch" } + } + }, + { + "from": [ -1.5, 11, 3.5 ], + "to": [ 1.5, 14, 6.5 ], + "shade": false, + "rotation": { "origin": [ 0, 3.5, 8 ], "axis": "z", "angle": -22.5 }, + "faces": { + "south": { "uv": [ 6, 5, 7, 6 ], "texture": "#torch" } + } + }, + { + "from": [ 1.5, 11, 6.5 ], + "to": [ 4.5, 14, 9.5 ], + "shade": false, + "rotation": { "origin": [ 0, 3.5, 8 ], "axis": "z", "angle": -22.5 }, + "faces": { + "west": { "uv": [ 6, 5, 7, 6 ], "texture": "#torch" } + } + }, + { + "from": [ -1.5, 11, 9.5 ], + "to": [ 1.5, 14, 12.5 ], + "shade": false, + "rotation": { "origin": [ 0, 3.5, 8 ], "axis": "z", "angle": -22.5 }, + "faces": { + "north": { "uv": [ 6, 5, 7, 6 ], "texture": "#torch" } + } + }, + { + "from": [ -4.5, 11, 6.5 ], + "to": [ -1.5, 14, 9.5 ], + "shade": false, + "rotation": { "origin": [ 0, 3.5, 8 ], "axis": "z", "angle": -22.5 }, + "faces": { + "east": { "uv": [ 6, 5, 7, 6 ], "texture": "#torch" } + } + } + ] +} diff --git a/assets/minecraft/models/block/template_torch.json b/assets/minecraft/models/block/template_torch.json index aef12fcf..21ed1138 100644 --- a/assets/minecraft/models/block/template_torch.json +++ b/assets/minecraft/models/block/template_torch.json @@ -8,24 +8,12 @@ "to": [ 9, 10, 9 ], "shade": false, "faces": { - "down": { "uv": [ 7, 13, 9, 15 ], "texture": "#torch" }, - "up": { "uv": [ 7, 6, 9, 8 ], "texture": "#torch" } - } - }, - { "from": [ 7, 0, 0 ], - "to": [ 9, 16, 16 ], - "shade": false, - "faces": { - "west": { "uv": [ 0, 0, 16, 16 ], "texture": "#torch" }, - "east": { "uv": [ 0, 0, 16, 16 ], "texture": "#torch" } - } - }, - { "from": [ 0, 0, 7 ], - "to": [ 16, 16, 9 ], - "shade": false, - "faces": { - "north": { "uv": [ 0, 0, 16, 16 ], "texture": "#torch" }, - "south": { "uv": [ 0, 0, 16, 16 ], "texture": "#torch" } + "down": { "uv": [ 7, 13, 9, 15 ], "texture": "#torch", "cullface": "down" }, + "up": { "uv": [ 7, 6, 9, 8 ], "texture": "#torch" }, + "north": { "uv": [ 7, 6, 9, 16 ], "texture": "#torch" }, + "east": { "uv": [ 7, 6, 9, 16 ], "texture": "#torch" }, + "south": { "uv": [ 7, 6, 9, 16 ], "texture": "#torch" }, + "west": { "uv": [ 7, 6, 9, 16 ], "texture": "#torch" } } } ] diff --git a/assets/minecraft/models/block/template_torch_unlit.json b/assets/minecraft/models/block/template_torch_unlit.json new file mode 100644 index 00000000..ef0829e2 --- /dev/null +++ b/assets/minecraft/models/block/template_torch_unlit.json @@ -0,0 +1,19 @@ +{ + "ambientocclusion": false, + "textures": { + "particle": "#torch" + }, + "elements": [ + { "from": [ 7, 0, 7 ], + "to": [ 9, 10, 9 ], + "faces": { + "down": { "uv": [ 7, 13, 9, 15 ], "texture": "#torch", "cullface": "down" }, + "up": { "uv": [ 7, 6, 9, 8 ], "texture": "#torch" }, + "north": { "uv": [ 7, 6, 9, 16 ], "texture": "#torch" }, + "east": { "uv": [ 7, 6, 9, 16 ], "texture": "#torch" }, + "south": { "uv": [ 7, 6, 9, 16 ], "texture": "#torch" }, + "west": { "uv": [ 7, 6, 9, 16 ], "texture": "#torch" } + } + } + ] +} diff --git a/assets/minecraft/models/block/template_torch_wall.json b/assets/minecraft/models/block/template_torch_wall.json index 1a6d297e..a7083f01 100644 --- a/assets/minecraft/models/block/template_torch_wall.json +++ b/assets/minecraft/models/block/template_torch_wall.json @@ -9,26 +9,12 @@ "rotation": { "origin": [ 0, 3.5, 8 ], "axis": "z", "angle": -22.5 }, "shade": false, "faces": { - "down": { "uv": [ 7, 13, 9, 15 ], "texture": "#torch" }, - "up": { "uv": [ 7, 6, 9, 8 ], "texture": "#torch" } - } - }, - { "from": [ -1, 3.5, 0 ], - "to": [ 1, 19.5, 16 ], - "rotation": { "origin": [ 0, 3.5, 8 ], "axis": "z", "angle": -22.5 }, - "shade": false, - "faces": { - "west": { "uv": [ 0, 0, 16, 16 ], "texture": "#torch" }, - "east": { "uv": [ 0, 0, 16, 16 ], "texture": "#torch" } - } - }, - { "from": [ -8, 3.5, 7 ], - "to": [ 8, 19.5, 9 ], - "rotation": { "origin": [ 0, 3.5, 8 ], "axis": "z", "angle": -22.5 }, - "shade": false, - "faces": { - "north": { "uv": [ 0, 0, 16, 16 ], "texture": "#torch" }, - "south": { "uv": [ 0, 0, 16, 16 ], "texture": "#torch" } + "down": { "uv": [ 7, 13, 9, 15 ], "texture": "#torch" }, + "up": { "uv": [ 7, 6, 9, 8 ], "texture": "#torch" }, + "north": { "uv": [ 7, 6, 9, 16 ], "texture": "#torch" }, + "east": { "uv": [ 7, 6, 9, 16 ], "texture": "#torch" }, + "south": { "uv": [ 7, 6, 9, 16 ], "texture": "#torch" }, + "west": { "uv": [ 7, 6, 9, 16 ], "texture": "#torch" } } } ] diff --git a/assets/minecraft/models/block/template_torch_wall_unlit.json b/assets/minecraft/models/block/template_torch_wall_unlit.json new file mode 100644 index 00000000..3b11230b --- /dev/null +++ b/assets/minecraft/models/block/template_torch_wall_unlit.json @@ -0,0 +1,20 @@ +{ + "ambientocclusion": false, + "textures": { + "particle": "#torch" + }, + "elements": [ + { "from": [ -1, 3.5, 7 ], + "to": [ 1, 13.5, 9 ], + "rotation": { "origin": [ 0, 3.5, 8 ], "axis": "z", "angle": -22.5 }, + "faces": { + "down": { "uv": [ 7, 13, 9, 15 ], "texture": "#torch" }, + "up": { "uv": [ 7, 6, 9, 8 ], "texture": "#torch" }, + "north": { "uv": [ 7, 6, 9, 16 ], "texture": "#torch" }, + "east": { "uv": [ 7, 6, 9, 16 ], "texture": "#torch" }, + "south": { "uv": [ 7, 6, 9, 16 ], "texture": "#torch" }, + "west": { "uv": [ 7, 6, 9, 16 ], "texture": "#torch" } + } + } + ] +} diff --git a/assets/minecraft/models/block/template_vault.json b/assets/minecraft/models/block/template_vault.json index 9f13248a..d88a3709 100644 --- a/assets/minecraft/models/block/template_vault.json +++ b/assets/minecraft/models/block/template_vault.json @@ -14,7 +14,7 @@ "south": {"uv": [0, 0, 16, 16], "texture": "#side", "cullface": "south"}, "west": {"uv": [0, 0, 16, 16], "texture": "#side", "cullface": "west"}, "up": {"uv": [0, 0, 16, 16], "texture": "#top", "cullface": "up"}, - "down": {"uv": [0, 0, 16, 16], "texture": "#bottom"} + "down": {"uv": [0, 0, 16, 16], "texture": "#bottom", "cullface": "down"} } }, { diff --git a/assets/minecraft/models/block/tinted_flower_pot_cross.json b/assets/minecraft/models/block/tinted_flower_pot_cross.json index 3bdc26c1..1fabc7a1 100644 --- a/assets/minecraft/models/block/tinted_flower_pot_cross.json +++ b/assets/minecraft/models/block/tinted_flower_pot_cross.json @@ -56,6 +56,7 @@ { "from": [ 2.6, 4, 8 ], "to": [ 13.4, 16, 8 ], "rotation": { "origin": [ 8, 8, 8 ], "axis": "y", "angle": 45, "rescale": true }, + "shade": false, "faces": { "north": { "uv": [ 0, 0, 16, 16 ], "texture": "#plant", "tintindex": 0 }, "south": { "uv": [ 0, 0, 16, 16 ], "texture": "#plant", "tintindex": 0 } @@ -64,6 +65,7 @@ { "from": [ 8, 4, 2.6 ], "to": [ 8, 16, 13.4 ], "rotation": { "origin": [ 8, 8, 8 ], "axis": "y", "angle": 45, "rescale": true }, + "shade": false, "faces": { "west": { "uv": [ 0, 0, 16, 16 ], "texture": "#plant", "tintindex": 0 }, "east": { "uv": [ 0, 0, 16, 16 ], "texture": "#plant", "tintindex": 0 } diff --git a/assets/minecraft/models/equipment/armadillo_scute.json b/assets/minecraft/models/equipment/armadillo_scute.json new file mode 100644 index 00000000..37f47b7d --- /dev/null +++ b/assets/minecraft/models/equipment/armadillo_scute.json @@ -0,0 +1,13 @@ +{ + "layers": { + "wolf_body": [ + { + "texture": "minecraft:armadillo_scute" + }, + { + "dyeable": {}, + "texture": "minecraft:armadillo_scute_overlay" + } + ] + } +} \ No newline at end of file diff --git a/assets/minecraft/models/equipment/black_carpet.json b/assets/minecraft/models/equipment/black_carpet.json new file mode 100644 index 00000000..effa588e --- /dev/null +++ b/assets/minecraft/models/equipment/black_carpet.json @@ -0,0 +1,9 @@ +{ + "layers": { + "llama_body": [ + { + "texture": "minecraft:black" + } + ] + } +} \ No newline at end of file diff --git a/assets/minecraft/models/equipment/blue_carpet.json b/assets/minecraft/models/equipment/blue_carpet.json new file mode 100644 index 00000000..693be95a --- /dev/null +++ b/assets/minecraft/models/equipment/blue_carpet.json @@ -0,0 +1,9 @@ +{ + "layers": { + "llama_body": [ + { + "texture": "minecraft:blue" + } + ] + } +} \ No newline at end of file diff --git a/assets/minecraft/models/equipment/brown_carpet.json b/assets/minecraft/models/equipment/brown_carpet.json new file mode 100644 index 00000000..20f60498 --- /dev/null +++ b/assets/minecraft/models/equipment/brown_carpet.json @@ -0,0 +1,9 @@ +{ + "layers": { + "llama_body": [ + { + "texture": "minecraft:brown" + } + ] + } +} \ No newline at end of file diff --git a/assets/minecraft/models/equipment/chainmail.json b/assets/minecraft/models/equipment/chainmail.json new file mode 100644 index 00000000..f2aab0f5 --- /dev/null +++ b/assets/minecraft/models/equipment/chainmail.json @@ -0,0 +1,14 @@ +{ + "layers": { + "humanoid": [ + { + "texture": "minecraft:chainmail" + } + ], + "humanoid_leggings": [ + { + "texture": "minecraft:chainmail" + } + ] + } +} \ No newline at end of file diff --git a/assets/minecraft/models/equipment/cyan_carpet.json b/assets/minecraft/models/equipment/cyan_carpet.json new file mode 100644 index 00000000..20bb1e35 --- /dev/null +++ b/assets/minecraft/models/equipment/cyan_carpet.json @@ -0,0 +1,9 @@ +{ + "layers": { + "llama_body": [ + { + "texture": "minecraft:cyan" + } + ] + } +} \ No newline at end of file diff --git a/assets/minecraft/models/equipment/diamond.json b/assets/minecraft/models/equipment/diamond.json new file mode 100644 index 00000000..0fbf43ec --- /dev/null +++ b/assets/minecraft/models/equipment/diamond.json @@ -0,0 +1,19 @@ +{ + "layers": { + "horse_body": [ + { + "texture": "minecraft:diamond" + } + ], + "humanoid": [ + { + "texture": "minecraft:diamond" + } + ], + "humanoid_leggings": [ + { + "texture": "minecraft:diamond" + } + ] + } +} \ No newline at end of file diff --git a/assets/minecraft/models/equipment/elytra.json b/assets/minecraft/models/equipment/elytra.json new file mode 100644 index 00000000..2a6806f5 --- /dev/null +++ b/assets/minecraft/models/equipment/elytra.json @@ -0,0 +1,10 @@ +{ + "layers": { + "wings": [ + { + "texture": "minecraft:elytra", + "use_player_texture": true + } + ] + } +} \ No newline at end of file diff --git a/assets/minecraft/models/equipment/gold.json b/assets/minecraft/models/equipment/gold.json new file mode 100644 index 00000000..477deb65 --- /dev/null +++ b/assets/minecraft/models/equipment/gold.json @@ -0,0 +1,19 @@ +{ + "layers": { + "horse_body": [ + { + "texture": "minecraft:gold" + } + ], + "humanoid": [ + { + "texture": "minecraft:gold" + } + ], + "humanoid_leggings": [ + { + "texture": "minecraft:gold" + } + ] + } +} \ No newline at end of file diff --git a/assets/minecraft/models/equipment/gray_carpet.json b/assets/minecraft/models/equipment/gray_carpet.json new file mode 100644 index 00000000..aa938316 --- /dev/null +++ b/assets/minecraft/models/equipment/gray_carpet.json @@ -0,0 +1,9 @@ +{ + "layers": { + "llama_body": [ + { + "texture": "minecraft:gray" + } + ] + } +} \ No newline at end of file diff --git a/assets/minecraft/models/equipment/green_carpet.json b/assets/minecraft/models/equipment/green_carpet.json new file mode 100644 index 00000000..a91f5518 --- /dev/null +++ b/assets/minecraft/models/equipment/green_carpet.json @@ -0,0 +1,9 @@ +{ + "layers": { + "llama_body": [ + { + "texture": "minecraft:green" + } + ] + } +} \ No newline at end of file diff --git a/assets/minecraft/models/equipment/iron.json b/assets/minecraft/models/equipment/iron.json new file mode 100644 index 00000000..e5777d8e --- /dev/null +++ b/assets/minecraft/models/equipment/iron.json @@ -0,0 +1,19 @@ +{ + "layers": { + "horse_body": [ + { + "texture": "minecraft:iron" + } + ], + "humanoid": [ + { + "texture": "minecraft:iron" + } + ], + "humanoid_leggings": [ + { + "texture": "minecraft:iron" + } + ] + } +} \ No newline at end of file diff --git a/assets/minecraft/models/equipment/leather.json b/assets/minecraft/models/equipment/leather.json new file mode 100644 index 00000000..f5901c3b --- /dev/null +++ b/assets/minecraft/models/equipment/leather.json @@ -0,0 +1,34 @@ +{ + "layers": { + "horse_body": [ + { + "dyeable": { + "color_when_undyed": -6265536 + }, + "texture": "minecraft:leather" + } + ], + "humanoid": [ + { + "dyeable": { + "color_when_undyed": -6265536 + }, + "texture": "minecraft:leather" + }, + { + "texture": "minecraft:leather_overlay" + } + ], + "humanoid_leggings": [ + { + "dyeable": { + "color_when_undyed": -6265536 + }, + "texture": "minecraft:leather" + }, + { + "texture": "minecraft:leather_overlay" + } + ] + } +} \ No newline at end of file diff --git a/assets/minecraft/models/equipment/light_blue_carpet.json b/assets/minecraft/models/equipment/light_blue_carpet.json new file mode 100644 index 00000000..2ba39a44 --- /dev/null +++ b/assets/minecraft/models/equipment/light_blue_carpet.json @@ -0,0 +1,9 @@ +{ + "layers": { + "llama_body": [ + { + "texture": "minecraft:light_blue" + } + ] + } +} \ No newline at end of file diff --git a/assets/minecraft/models/equipment/light_gray_carpet.json b/assets/minecraft/models/equipment/light_gray_carpet.json new file mode 100644 index 00000000..12e5d2dd --- /dev/null +++ b/assets/minecraft/models/equipment/light_gray_carpet.json @@ -0,0 +1,9 @@ +{ + "layers": { + "llama_body": [ + { + "texture": "minecraft:light_gray" + } + ] + } +} \ No newline at end of file diff --git a/assets/minecraft/models/equipment/lime_carpet.json b/assets/minecraft/models/equipment/lime_carpet.json new file mode 100644 index 00000000..cc48b804 --- /dev/null +++ b/assets/minecraft/models/equipment/lime_carpet.json @@ -0,0 +1,9 @@ +{ + "layers": { + "llama_body": [ + { + "texture": "minecraft:lime" + } + ] + } +} \ No newline at end of file diff --git a/assets/minecraft/models/equipment/magenta_carpet.json b/assets/minecraft/models/equipment/magenta_carpet.json new file mode 100644 index 00000000..20a76870 --- /dev/null +++ b/assets/minecraft/models/equipment/magenta_carpet.json @@ -0,0 +1,9 @@ +{ + "layers": { + "llama_body": [ + { + "texture": "minecraft:magenta" + } + ] + } +} \ No newline at end of file diff --git a/assets/minecraft/models/equipment/netherite.json b/assets/minecraft/models/equipment/netherite.json new file mode 100644 index 00000000..29b42d82 --- /dev/null +++ b/assets/minecraft/models/equipment/netherite.json @@ -0,0 +1,14 @@ +{ + "layers": { + "humanoid": [ + { + "texture": "minecraft:netherite" + } + ], + "humanoid_leggings": [ + { + "texture": "minecraft:netherite" + } + ] + } +} \ No newline at end of file diff --git a/assets/minecraft/models/equipment/orange_carpet.json b/assets/minecraft/models/equipment/orange_carpet.json new file mode 100644 index 00000000..8d0824c0 --- /dev/null +++ b/assets/minecraft/models/equipment/orange_carpet.json @@ -0,0 +1,9 @@ +{ + "layers": { + "llama_body": [ + { + "texture": "minecraft:orange" + } + ] + } +} \ No newline at end of file diff --git a/assets/minecraft/models/equipment/pink_carpet.json b/assets/minecraft/models/equipment/pink_carpet.json new file mode 100644 index 00000000..a2c57c69 --- /dev/null +++ b/assets/minecraft/models/equipment/pink_carpet.json @@ -0,0 +1,9 @@ +{ + "layers": { + "llama_body": [ + { + "texture": "minecraft:pink" + } + ] + } +} \ No newline at end of file diff --git a/assets/minecraft/models/equipment/purple_carpet.json b/assets/minecraft/models/equipment/purple_carpet.json new file mode 100644 index 00000000..bf304d20 --- /dev/null +++ b/assets/minecraft/models/equipment/purple_carpet.json @@ -0,0 +1,9 @@ +{ + "layers": { + "llama_body": [ + { + "texture": "minecraft:purple" + } + ] + } +} \ No newline at end of file diff --git a/assets/minecraft/models/equipment/red_carpet.json b/assets/minecraft/models/equipment/red_carpet.json new file mode 100644 index 00000000..47f48ed6 --- /dev/null +++ b/assets/minecraft/models/equipment/red_carpet.json @@ -0,0 +1,9 @@ +{ + "layers": { + "llama_body": [ + { + "texture": "minecraft:red" + } + ] + } +} \ No newline at end of file diff --git a/assets/minecraft/models/equipment/trader_llama.json b/assets/minecraft/models/equipment/trader_llama.json new file mode 100644 index 00000000..47deaf6b --- /dev/null +++ b/assets/minecraft/models/equipment/trader_llama.json @@ -0,0 +1,9 @@ +{ + "layers": { + "llama_body": [ + { + "texture": "minecraft:trader_llama" + } + ] + } +} \ No newline at end of file diff --git a/assets/minecraft/models/equipment/turtle_scute.json b/assets/minecraft/models/equipment/turtle_scute.json new file mode 100644 index 00000000..65fe733c --- /dev/null +++ b/assets/minecraft/models/equipment/turtle_scute.json @@ -0,0 +1,9 @@ +{ + "layers": { + "humanoid": [ + { + "texture": "minecraft:turtle_scute" + } + ] + } +} \ No newline at end of file diff --git a/assets/minecraft/models/equipment/white_carpet.json b/assets/minecraft/models/equipment/white_carpet.json new file mode 100644 index 00000000..3a9c2896 --- /dev/null +++ b/assets/minecraft/models/equipment/white_carpet.json @@ -0,0 +1,9 @@ +{ + "layers": { + "llama_body": [ + { + "texture": "minecraft:white" + } + ] + } +} \ No newline at end of file diff --git a/assets/minecraft/models/equipment/yellow_carpet.json b/assets/minecraft/models/equipment/yellow_carpet.json new file mode 100644 index 00000000..dc478a4a --- /dev/null +++ b/assets/minecraft/models/equipment/yellow_carpet.json @@ -0,0 +1,9 @@ +{ + "layers": { + "llama_body": [ + { + "texture": "minecraft:yellow" + } + ] + } +} \ No newline at end of file diff --git a/assets/minecraft/models/item/bee_nest.json b/assets/minecraft/models/item/bee_nest.json index 3298365a..39634a5b 100644 --- a/assets/minecraft/models/item/bee_nest.json +++ b/assets/minecraft/models/item/bee_nest.json @@ -1,3 +1,17 @@ { - "parent": "minecraft:block/bee_nest" -} \ No newline at end of file + "parent": "minecraft:block/bee_nest_empty", + "overrides" : [ + { + "predicate" : { + "honey_level" : 0 + }, + "model" : "item/bee_nest_empty" + }, + { + "predicate" : { + "honey_level" : 1 + }, + "model" : "item/bee_nest_honey" + } + ] +} diff --git a/assets/minecraft/models/item/bee_nest_empty.json b/assets/minecraft/models/item/bee_nest_empty.json new file mode 100644 index 00000000..ac0aa623 --- /dev/null +++ b/assets/minecraft/models/item/bee_nest_empty.json @@ -0,0 +1,10 @@ +{ + "parent": "minecraft:block/orientable_with_bottom", + "textures": { + "bottom": "minecraft:block/bee_nest_bottom", + "front": "minecraft:block/bee_nest_front", + "particle": "minecraft:block/bee_nest_side", + "side": "minecraft:block/bee_nest_side", + "top": "minecraft:block/bee_nest_top" + } +} \ No newline at end of file diff --git a/assets/minecraft/models/item/bee_nest_honey.json b/assets/minecraft/models/item/bee_nest_honey.json new file mode 100644 index 00000000..25850dbf --- /dev/null +++ b/assets/minecraft/models/item/bee_nest_honey.json @@ -0,0 +1,10 @@ +{ + "parent": "minecraft:block/orientable_with_bottom", + "textures": { + "bottom": "minecraft:block/bee_nest_bottom", + "front": "minecraft:block/bee_nest_front_honey", + "particle": "minecraft:block/bee_nest_side", + "side": "minecraft:block/bee_nest_side", + "top": "minecraft:block/bee_nest_top" + } +} \ No newline at end of file diff --git a/assets/minecraft/models/item/beehive.json b/assets/minecraft/models/item/beehive.json index cf1475c3..afc4081b 100644 --- a/assets/minecraft/models/item/beehive.json +++ b/assets/minecraft/models/item/beehive.json @@ -1,3 +1,17 @@ { - "parent": "minecraft:block/beehive" -} \ No newline at end of file + "parent": "minecraft:block/beehive_empty", + "overrides" : [ + { + "predicate" : { + "honey_level" : 0 + }, + "model" : "item/beehive_empty" + }, + { + "predicate" : { + "honey_level" : 1 + }, + "model" : "item/beehive_honey" + } + ] +} diff --git a/assets/minecraft/models/item/beehive_empty.json b/assets/minecraft/models/item/beehive_empty.json new file mode 100644 index 00000000..4c875e63 --- /dev/null +++ b/assets/minecraft/models/item/beehive_empty.json @@ -0,0 +1,10 @@ +{ + "parent": "minecraft:block/orientable_with_bottom", + "textures": { + "bottom": "minecraft:block/beehive_end", + "front": "minecraft:block/beehive_front", + "particle": "minecraft:block/beehive_side", + "side": "minecraft:block/beehive_side", + "top": "minecraft:block/beehive_end" + } +} \ No newline at end of file diff --git a/assets/minecraft/models/item/beehive_honey.json b/assets/minecraft/models/item/beehive_honey.json new file mode 100644 index 00000000..1973867c --- /dev/null +++ b/assets/minecraft/models/item/beehive_honey.json @@ -0,0 +1,10 @@ +{ + "parent": "minecraft:block/orientable_with_bottom", + "textures": { + "bottom": "minecraft:block/beehive_end", + "front": "minecraft:block/beehive_front_honey", + "particle": "minecraft:block/beehive_side", + "side": "minecraft:block/beehive_side", + "top": "minecraft:block/beehive_end" + } +} \ No newline at end of file diff --git a/assets/minecraft/models/item/black_bundle.json b/assets/minecraft/models/item/black_bundle.json new file mode 100644 index 00000000..84299e45 --- /dev/null +++ b/assets/minecraft/models/item/black_bundle.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "minecraft:item/black_bundle" + } +} \ No newline at end of file diff --git a/assets/minecraft/models/item/black_bundle_open_back.json b/assets/minecraft/models/item/black_bundle_open_back.json new file mode 100644 index 00000000..863e592b --- /dev/null +++ b/assets/minecraft/models/item/black_bundle_open_back.json @@ -0,0 +1,6 @@ +{ + "parent": "item/bundle", + "textures": { + "layer0": "item/black_bundle_open_back" + } +} diff --git a/assets/minecraft/models/item/black_bundle_open_front.json b/assets/minecraft/models/item/black_bundle_open_front.json new file mode 100644 index 00000000..d0159a8f --- /dev/null +++ b/assets/minecraft/models/item/black_bundle_open_front.json @@ -0,0 +1,6 @@ +{ + "parent": "item/bundle", + "textures": { + "layer0": "item/black_bundle_open_front" + } +} diff --git a/assets/minecraft/models/item/blue_bundle.json b/assets/minecraft/models/item/blue_bundle.json new file mode 100644 index 00000000..f6005a3c --- /dev/null +++ b/assets/minecraft/models/item/blue_bundle.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "minecraft:item/blue_bundle" + } +} \ No newline at end of file diff --git a/assets/minecraft/models/item/blue_bundle_open_back.json b/assets/minecraft/models/item/blue_bundle_open_back.json new file mode 100644 index 00000000..29011ca3 --- /dev/null +++ b/assets/minecraft/models/item/blue_bundle_open_back.json @@ -0,0 +1,6 @@ +{ + "parent": "item/bundle", + "textures": { + "layer0": "item/blue_bundle_open_back" + } +} diff --git a/assets/minecraft/models/item/blue_bundle_open_front.json b/assets/minecraft/models/item/blue_bundle_open_front.json new file mode 100644 index 00000000..0dca2593 --- /dev/null +++ b/assets/minecraft/models/item/blue_bundle_open_front.json @@ -0,0 +1,6 @@ +{ + "parent": "item/bundle", + "textures": { + "layer0": "item/blue_bundle_open_front" + } +} diff --git a/assets/minecraft/models/item/bordure_indented_banner_pattern.json b/assets/minecraft/models/item/bordure_indented_banner_pattern.json new file mode 100644 index 00000000..02706b20 --- /dev/null +++ b/assets/minecraft/models/item/bordure_indented_banner_pattern.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "minecraft:item/bordure_indented_banner_pattern" + } +} \ No newline at end of file diff --git a/assets/minecraft/models/item/breeze_rod.json b/assets/minecraft/models/item/breeze_rod.json index c747ba41..3e621f36 100644 --- a/assets/minecraft/models/item/breeze_rod.json +++ b/assets/minecraft/models/item/breeze_rod.json @@ -1,5 +1,5 @@ { - "parent": "minecraft:item/generated", + "parent": "minecraft:item/handheld", "textures": { "layer0": "minecraft:item/breeze_rod" } diff --git a/assets/minecraft/models/item/brown_bundle.json b/assets/minecraft/models/item/brown_bundle.json new file mode 100644 index 00000000..7f289642 --- /dev/null +++ b/assets/minecraft/models/item/brown_bundle.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "minecraft:item/brown_bundle" + } +} \ No newline at end of file diff --git a/assets/minecraft/models/item/brown_bundle_open_back.json b/assets/minecraft/models/item/brown_bundle_open_back.json new file mode 100644 index 00000000..bf1e27b0 --- /dev/null +++ b/assets/minecraft/models/item/brown_bundle_open_back.json @@ -0,0 +1,6 @@ +{ + "parent": "item/bundle", + "textures": { + "layer0": "item/brown_bundle_open_back" + } +} diff --git a/assets/minecraft/models/item/brown_bundle_open_front.json b/assets/minecraft/models/item/brown_bundle_open_front.json new file mode 100644 index 00000000..637ad47e --- /dev/null +++ b/assets/minecraft/models/item/brown_bundle_open_front.json @@ -0,0 +1,6 @@ +{ + "parent": "item/bundle", + "textures": { + "layer0": "item/brown_bundle_open_front" + } +} diff --git a/assets/minecraft/models/item/bundle.json b/assets/minecraft/models/item/bundle.json index 8229ddbd..af189a9c 100644 --- a/assets/minecraft/models/item/bundle.json +++ b/assets/minecraft/models/item/bundle.json @@ -1,9 +1,6 @@ { - "parent": "item/generated", - "textures": { - "layer0": "item/bundle" - }, - "overrides": [ - { "predicate": { "filled": 0.0000001 }, "model": "item/bundle_filled" } - ] -} + "parent": "minecraft:item/generated", + "textures": { + "layer0": "minecraft:item/bundle" + } +} \ No newline at end of file diff --git a/assets/minecraft/models/item/bundle_filled.json b/assets/minecraft/models/item/bundle_filled.json deleted file mode 100644 index cf601f5a..00000000 --- a/assets/minecraft/models/item/bundle_filled.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "parent": "item/bundle", - "textures": { - "layer0": "item/bundle_filled" - } -} diff --git a/assets/minecraft/models/item/bundle_open_back.json b/assets/minecraft/models/item/bundle_open_back.json new file mode 100644 index 00000000..66851f18 --- /dev/null +++ b/assets/minecraft/models/item/bundle_open_back.json @@ -0,0 +1,6 @@ +{ + "parent": "item/bundle", + "textures": { + "layer0": "item/bundle_open_back" + } +} diff --git a/assets/minecraft/models/item/bundle_open_front.json b/assets/minecraft/models/item/bundle_open_front.json new file mode 100644 index 00000000..9c254570 --- /dev/null +++ b/assets/minecraft/models/item/bundle_open_front.json @@ -0,0 +1,6 @@ +{ + "parent": "item/bundle", + "textures": { + "layer0": "item/bundle_open_front" + } +} diff --git a/assets/minecraft/models/item/creaking_heart.json b/assets/minecraft/models/item/creaking_heart.json new file mode 100644 index 00000000..a071b726 --- /dev/null +++ b/assets/minecraft/models/item/creaking_heart.json @@ -0,0 +1,3 @@ +{ + "parent": "minecraft:block/creaking_heart" +} \ No newline at end of file diff --git a/assets/minecraft/models/item/creaking_spawn_egg.json b/assets/minecraft/models/item/creaking_spawn_egg.json new file mode 100644 index 00000000..d1aaa9d6 --- /dev/null +++ b/assets/minecraft/models/item/creaking_spawn_egg.json @@ -0,0 +1,3 @@ +{ + "parent": "minecraft:item/template_spawn_egg" +} \ No newline at end of file diff --git a/assets/minecraft/models/item/cyan_bundle.json b/assets/minecraft/models/item/cyan_bundle.json new file mode 100644 index 00000000..99689686 --- /dev/null +++ b/assets/minecraft/models/item/cyan_bundle.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "minecraft:item/cyan_bundle" + } +} \ No newline at end of file diff --git a/assets/minecraft/models/item/cyan_bundle_open_back.json b/assets/minecraft/models/item/cyan_bundle_open_back.json new file mode 100644 index 00000000..27a03d17 --- /dev/null +++ b/assets/minecraft/models/item/cyan_bundle_open_back.json @@ -0,0 +1,6 @@ +{ + "parent": "item/bundle", + "textures": { + "layer0": "item/cyan_bundle_open_back" + } +} diff --git a/assets/minecraft/models/item/cyan_bundle_open_front.json b/assets/minecraft/models/item/cyan_bundle_open_front.json new file mode 100644 index 00000000..c7eccd84 --- /dev/null +++ b/assets/minecraft/models/item/cyan_bundle_open_front.json @@ -0,0 +1,6 @@ +{ + "parent": "item/bundle", + "textures": { + "layer0": "item/cyan_bundle_open_front" + } +} diff --git a/assets/minecraft/models/item/field_masoned_banner_pattern.json b/assets/minecraft/models/item/field_masoned_banner_pattern.json new file mode 100644 index 00000000..404fbede --- /dev/null +++ b/assets/minecraft/models/item/field_masoned_banner_pattern.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "minecraft:item/field_masoned_banner_pattern" + } +} \ No newline at end of file diff --git a/assets/minecraft/models/item/gray_bundle.json b/assets/minecraft/models/item/gray_bundle.json new file mode 100644 index 00000000..a076d156 --- /dev/null +++ b/assets/minecraft/models/item/gray_bundle.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "minecraft:item/gray_bundle" + } +} \ No newline at end of file diff --git a/assets/minecraft/models/item/gray_bundle_open_back.json b/assets/minecraft/models/item/gray_bundle_open_back.json new file mode 100644 index 00000000..7b4a9a7d --- /dev/null +++ b/assets/minecraft/models/item/gray_bundle_open_back.json @@ -0,0 +1,6 @@ +{ + "parent": "item/bundle", + "textures": { + "layer0": "item/gray_bundle_open_back" + } +} diff --git a/assets/minecraft/models/item/gray_bundle_open_front.json b/assets/minecraft/models/item/gray_bundle_open_front.json new file mode 100644 index 00000000..cbcccfec --- /dev/null +++ b/assets/minecraft/models/item/gray_bundle_open_front.json @@ -0,0 +1,6 @@ +{ + "parent": "item/bundle", + "textures": { + "layer0": "item/gray_bundle_open_front" + } +} diff --git a/assets/minecraft/models/item/green_bundle.json b/assets/minecraft/models/item/green_bundle.json new file mode 100644 index 00000000..c4589577 --- /dev/null +++ b/assets/minecraft/models/item/green_bundle.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "minecraft:item/green_bundle" + } +} \ No newline at end of file diff --git a/assets/minecraft/models/item/green_bundle_open_back.json b/assets/minecraft/models/item/green_bundle_open_back.json new file mode 100644 index 00000000..a0b9c2a7 --- /dev/null +++ b/assets/minecraft/models/item/green_bundle_open_back.json @@ -0,0 +1,6 @@ +{ + "parent": "item/bundle", + "textures": { + "layer0": "item/green_bundle_open_back" + } +} diff --git a/assets/minecraft/models/item/green_bundle_open_front.json b/assets/minecraft/models/item/green_bundle_open_front.json new file mode 100644 index 00000000..23dd6989 --- /dev/null +++ b/assets/minecraft/models/item/green_bundle_open_front.json @@ -0,0 +1,6 @@ +{ + "parent": "item/bundle", + "textures": { + "layer0": "item/green_bundle_open_front" + } +} diff --git a/assets/minecraft/models/item/light_blue_bundle.json b/assets/minecraft/models/item/light_blue_bundle.json new file mode 100644 index 00000000..7f4e733b --- /dev/null +++ b/assets/minecraft/models/item/light_blue_bundle.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "minecraft:item/light_blue_bundle" + } +} \ No newline at end of file diff --git a/assets/minecraft/models/item/light_blue_bundle_open_back.json b/assets/minecraft/models/item/light_blue_bundle_open_back.json new file mode 100644 index 00000000..3a0cfc26 --- /dev/null +++ b/assets/minecraft/models/item/light_blue_bundle_open_back.json @@ -0,0 +1,6 @@ +{ + "parent": "item/bundle", + "textures": { + "layer0": "item/light_blue_bundle_open_back" + } +} diff --git a/assets/minecraft/models/item/light_blue_bundle_open_front.json b/assets/minecraft/models/item/light_blue_bundle_open_front.json new file mode 100644 index 00000000..824e3ccd --- /dev/null +++ b/assets/minecraft/models/item/light_blue_bundle_open_front.json @@ -0,0 +1,6 @@ +{ + "parent": "item/bundle", + "textures": { + "layer0": "item/light_blue_bundle_open_front" + } +} diff --git a/assets/minecraft/models/item/light_gray_bundle.json b/assets/minecraft/models/item/light_gray_bundle.json new file mode 100644 index 00000000..88a6b82d --- /dev/null +++ b/assets/minecraft/models/item/light_gray_bundle.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "minecraft:item/light_gray_bundle" + } +} \ No newline at end of file diff --git a/assets/minecraft/models/item/light_gray_bundle_open_back.json b/assets/minecraft/models/item/light_gray_bundle_open_back.json new file mode 100644 index 00000000..cbeab629 --- /dev/null +++ b/assets/minecraft/models/item/light_gray_bundle_open_back.json @@ -0,0 +1,6 @@ +{ + "parent": "item/bundle", + "textures": { + "layer0": "item/light_gray_bundle_open_back" + } +} diff --git a/assets/minecraft/models/item/light_gray_bundle_open_front.json b/assets/minecraft/models/item/light_gray_bundle_open_front.json new file mode 100644 index 00000000..bb274a9b --- /dev/null +++ b/assets/minecraft/models/item/light_gray_bundle_open_front.json @@ -0,0 +1,6 @@ +{ + "parent": "item/bundle", + "textures": { + "layer0": "item/light_gray_bundle_open_front" + } +} diff --git a/assets/minecraft/models/item/lime_bundle.json b/assets/minecraft/models/item/lime_bundle.json new file mode 100644 index 00000000..3af851fb --- /dev/null +++ b/assets/minecraft/models/item/lime_bundle.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "minecraft:item/lime_bundle" + } +} \ No newline at end of file diff --git a/assets/minecraft/models/item/lime_bundle_open_back.json b/assets/minecraft/models/item/lime_bundle_open_back.json new file mode 100644 index 00000000..5516ba15 --- /dev/null +++ b/assets/minecraft/models/item/lime_bundle_open_back.json @@ -0,0 +1,6 @@ +{ + "parent": "item/bundle", + "textures": { + "layer0": "item/lime_bundle_open_back" + } +} diff --git a/assets/minecraft/models/item/lime_bundle_open_front.json b/assets/minecraft/models/item/lime_bundle_open_front.json new file mode 100644 index 00000000..2179105a --- /dev/null +++ b/assets/minecraft/models/item/lime_bundle_open_front.json @@ -0,0 +1,6 @@ +{ + "parent": "item/bundle", + "textures": { + "layer0": "item/lime_bundle_open_front" + } +} diff --git a/assets/minecraft/models/item/magenta_bundle.json b/assets/minecraft/models/item/magenta_bundle.json new file mode 100644 index 00000000..973ef505 --- /dev/null +++ b/assets/minecraft/models/item/magenta_bundle.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "minecraft:item/magenta_bundle" + } +} \ No newline at end of file diff --git a/assets/minecraft/models/item/magenta_bundle_open_back.json b/assets/minecraft/models/item/magenta_bundle_open_back.json new file mode 100644 index 00000000..6d8ed84d --- /dev/null +++ b/assets/minecraft/models/item/magenta_bundle_open_back.json @@ -0,0 +1,6 @@ +{ + "parent": "item/bundle", + "textures": { + "layer0": "item/magenta_bundle_open_back" + } +} diff --git a/assets/minecraft/models/item/magenta_bundle_open_front.json b/assets/minecraft/models/item/magenta_bundle_open_front.json new file mode 100644 index 00000000..89b5a622 --- /dev/null +++ b/assets/minecraft/models/item/magenta_bundle_open_front.json @@ -0,0 +1,6 @@ +{ + "parent": "item/bundle", + "textures": { + "layer0": "item/magenta_bundle_open_front" + } +} diff --git a/assets/minecraft/models/item/orange_bundle.json b/assets/minecraft/models/item/orange_bundle.json new file mode 100644 index 00000000..593cfc8d --- /dev/null +++ b/assets/minecraft/models/item/orange_bundle.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "minecraft:item/orange_bundle" + } +} \ No newline at end of file diff --git a/assets/minecraft/models/item/orange_bundle_open_back.json b/assets/minecraft/models/item/orange_bundle_open_back.json new file mode 100644 index 00000000..f9980720 --- /dev/null +++ b/assets/minecraft/models/item/orange_bundle_open_back.json @@ -0,0 +1,6 @@ +{ + "parent": "item/bundle", + "textures": { + "layer0": "item/orange_bundle_open_back" + } +} diff --git a/assets/minecraft/models/item/orange_bundle_open_front.json b/assets/minecraft/models/item/orange_bundle_open_front.json new file mode 100644 index 00000000..4387fded --- /dev/null +++ b/assets/minecraft/models/item/orange_bundle_open_front.json @@ -0,0 +1,6 @@ +{ + "parent": "item/bundle", + "textures": { + "layer0": "item/orange_bundle_open_front" + } +} diff --git a/assets/minecraft/models/item/pale_hanging_moss.json b/assets/minecraft/models/item/pale_hanging_moss.json new file mode 100644 index 00000000..41100eed --- /dev/null +++ b/assets/minecraft/models/item/pale_hanging_moss.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "minecraft:block/pale_hanging_moss" + } +} \ No newline at end of file diff --git a/assets/minecraft/models/item/pale_moss_block.json b/assets/minecraft/models/item/pale_moss_block.json new file mode 100644 index 00000000..89a69ea6 --- /dev/null +++ b/assets/minecraft/models/item/pale_moss_block.json @@ -0,0 +1,3 @@ +{ + "parent": "minecraft:block/pale_moss_block" +} \ No newline at end of file diff --git a/assets/minecraft/models/item/pale_moss_carpet.json b/assets/minecraft/models/item/pale_moss_carpet.json new file mode 100644 index 00000000..26f94ad4 --- /dev/null +++ b/assets/minecraft/models/item/pale_moss_carpet.json @@ -0,0 +1,3 @@ +{ + "parent": "minecraft:block/pale_moss_carpet" +} \ No newline at end of file diff --git a/assets/minecraft/models/item/pale_oak_boat.json b/assets/minecraft/models/item/pale_oak_boat.json new file mode 100644 index 00000000..d40a5136 --- /dev/null +++ b/assets/minecraft/models/item/pale_oak_boat.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "minecraft:item/pale_oak_boat" + } +} \ No newline at end of file diff --git a/assets/minecraft/models/item/pale_oak_button.json b/assets/minecraft/models/item/pale_oak_button.json new file mode 100644 index 00000000..cdad389a --- /dev/null +++ b/assets/minecraft/models/item/pale_oak_button.json @@ -0,0 +1,3 @@ +{ + "parent": "minecraft:block/pale_oak_button_inventory" +} \ No newline at end of file diff --git a/assets/minecraft/models/item/pale_oak_chest_boat.json b/assets/minecraft/models/item/pale_oak_chest_boat.json new file mode 100644 index 00000000..00d122ea --- /dev/null +++ b/assets/minecraft/models/item/pale_oak_chest_boat.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "minecraft:item/pale_oak_chest_boat" + } +} \ No newline at end of file diff --git a/assets/minecraft/models/item/pale_oak_door.json b/assets/minecraft/models/item/pale_oak_door.json new file mode 100644 index 00000000..0f7964be --- /dev/null +++ b/assets/minecraft/models/item/pale_oak_door.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "minecraft:item/pale_oak_door" + } +} \ No newline at end of file diff --git a/assets/minecraft/models/item/pale_oak_fence.json b/assets/minecraft/models/item/pale_oak_fence.json new file mode 100644 index 00000000..b5b71354 --- /dev/null +++ b/assets/minecraft/models/item/pale_oak_fence.json @@ -0,0 +1,3 @@ +{ + "parent": "minecraft:block/pale_oak_fence_inventory" +} \ No newline at end of file diff --git a/assets/minecraft/models/item/pale_oak_fence_gate.json b/assets/minecraft/models/item/pale_oak_fence_gate.json new file mode 100644 index 00000000..1c5a842a --- /dev/null +++ b/assets/minecraft/models/item/pale_oak_fence_gate.json @@ -0,0 +1,3 @@ +{ + "parent": "minecraft:block/pale_oak_fence_gate" +} \ No newline at end of file diff --git a/assets/minecraft/models/item/pale_oak_hanging_sign.json b/assets/minecraft/models/item/pale_oak_hanging_sign.json new file mode 100644 index 00000000..4d5f08f4 --- /dev/null +++ b/assets/minecraft/models/item/pale_oak_hanging_sign.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "minecraft:item/pale_oak_hanging_sign" + } +} \ No newline at end of file diff --git a/assets/minecraft/models/item/pale_oak_leaves.json b/assets/minecraft/models/item/pale_oak_leaves.json new file mode 100644 index 00000000..5b7e1362 --- /dev/null +++ b/assets/minecraft/models/item/pale_oak_leaves.json @@ -0,0 +1,3 @@ +{ + "parent": "minecraft:block/pale_oak_leaves" +} \ No newline at end of file diff --git a/assets/minecraft/models/item/pale_oak_log.json b/assets/minecraft/models/item/pale_oak_log.json new file mode 100644 index 00000000..0eb844ba --- /dev/null +++ b/assets/minecraft/models/item/pale_oak_log.json @@ -0,0 +1,3 @@ +{ + "parent": "minecraft:block/pale_oak_log" +} \ No newline at end of file diff --git a/assets/minecraft/models/item/pale_oak_planks.json b/assets/minecraft/models/item/pale_oak_planks.json new file mode 100644 index 00000000..d797221c --- /dev/null +++ b/assets/minecraft/models/item/pale_oak_planks.json @@ -0,0 +1,3 @@ +{ + "parent": "minecraft:block/pale_oak_planks" +} \ No newline at end of file diff --git a/assets/minecraft/models/item/pale_oak_pressure_plate.json b/assets/minecraft/models/item/pale_oak_pressure_plate.json new file mode 100644 index 00000000..4cd5b4f2 --- /dev/null +++ b/assets/minecraft/models/item/pale_oak_pressure_plate.json @@ -0,0 +1,3 @@ +{ + "parent": "minecraft:block/pale_oak_pressure_plate" +} \ No newline at end of file diff --git a/assets/minecraft/models/item/pale_oak_sapling.json b/assets/minecraft/models/item/pale_oak_sapling.json new file mode 100644 index 00000000..7c162db6 --- /dev/null +++ b/assets/minecraft/models/item/pale_oak_sapling.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "minecraft:block/pale_oak_sapling" + } +} \ No newline at end of file diff --git a/assets/minecraft/models/item/pale_oak_sign.json b/assets/minecraft/models/item/pale_oak_sign.json new file mode 100644 index 00000000..c9018638 --- /dev/null +++ b/assets/minecraft/models/item/pale_oak_sign.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "minecraft:item/pale_oak_sign" + } +} \ No newline at end of file diff --git a/assets/minecraft/models/item/pale_oak_slab.json b/assets/minecraft/models/item/pale_oak_slab.json new file mode 100644 index 00000000..bcd617ec --- /dev/null +++ b/assets/minecraft/models/item/pale_oak_slab.json @@ -0,0 +1,3 @@ +{ + "parent": "minecraft:block/pale_oak_slab" +} \ No newline at end of file diff --git a/assets/minecraft/models/item/pale_oak_stairs.json b/assets/minecraft/models/item/pale_oak_stairs.json new file mode 100644 index 00000000..6b682772 --- /dev/null +++ b/assets/minecraft/models/item/pale_oak_stairs.json @@ -0,0 +1,3 @@ +{ + "parent": "minecraft:block/pale_oak_stairs" +} \ No newline at end of file diff --git a/assets/minecraft/models/item/pale_oak_trapdoor.json b/assets/minecraft/models/item/pale_oak_trapdoor.json new file mode 100644 index 00000000..4da9662e --- /dev/null +++ b/assets/minecraft/models/item/pale_oak_trapdoor.json @@ -0,0 +1,3 @@ +{ + "parent": "minecraft:block/pale_oak_trapdoor_bottom" +} \ No newline at end of file diff --git a/assets/minecraft/models/item/pale_oak_wood.json b/assets/minecraft/models/item/pale_oak_wood.json new file mode 100644 index 00000000..60be9f58 --- /dev/null +++ b/assets/minecraft/models/item/pale_oak_wood.json @@ -0,0 +1,3 @@ +{ + "parent": "minecraft:block/pale_oak_wood" +} \ No newline at end of file diff --git a/assets/minecraft/models/item/pink_bundle.json b/assets/minecraft/models/item/pink_bundle.json new file mode 100644 index 00000000..2d76ab30 --- /dev/null +++ b/assets/minecraft/models/item/pink_bundle.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "minecraft:item/pink_bundle" + } +} \ No newline at end of file diff --git a/assets/minecraft/models/item/pink_bundle_open_back.json b/assets/minecraft/models/item/pink_bundle_open_back.json new file mode 100644 index 00000000..c30768bb --- /dev/null +++ b/assets/minecraft/models/item/pink_bundle_open_back.json @@ -0,0 +1,6 @@ +{ + "parent": "item/bundle", + "textures": { + "layer0": "item/pink_bundle_open_back" + } +} diff --git a/assets/minecraft/models/item/pink_bundle_open_front.json b/assets/minecraft/models/item/pink_bundle_open_front.json new file mode 100644 index 00000000..26d8f26d --- /dev/null +++ b/assets/minecraft/models/item/pink_bundle_open_front.json @@ -0,0 +1,6 @@ +{ + "parent": "item/bundle", + "textures": { + "layer0": "item/pink_bundle_open_front" + } +} diff --git a/assets/minecraft/models/item/purple_bundle.json b/assets/minecraft/models/item/purple_bundle.json new file mode 100644 index 00000000..a6a56bf6 --- /dev/null +++ b/assets/minecraft/models/item/purple_bundle.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "minecraft:item/purple_bundle" + } +} \ No newline at end of file diff --git a/assets/minecraft/models/item/purple_bundle_open_back.json b/assets/minecraft/models/item/purple_bundle_open_back.json new file mode 100644 index 00000000..17cf859e --- /dev/null +++ b/assets/minecraft/models/item/purple_bundle_open_back.json @@ -0,0 +1,6 @@ +{ + "parent": "item/bundle", + "textures": { + "layer0": "item/purple_bundle_open_back" + } +} diff --git a/assets/minecraft/models/item/purple_bundle_open_front.json b/assets/minecraft/models/item/purple_bundle_open_front.json new file mode 100644 index 00000000..6ac61497 --- /dev/null +++ b/assets/minecraft/models/item/purple_bundle_open_front.json @@ -0,0 +1,6 @@ +{ + "parent": "item/bundle", + "textures": { + "layer0": "item/purple_bundle_open_front" + } +} diff --git a/assets/minecraft/models/item/red_bundle.json b/assets/minecraft/models/item/red_bundle.json new file mode 100644 index 00000000..2b450a41 --- /dev/null +++ b/assets/minecraft/models/item/red_bundle.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "minecraft:item/red_bundle" + } +} \ No newline at end of file diff --git a/assets/minecraft/models/item/red_bundle_open_back.json b/assets/minecraft/models/item/red_bundle_open_back.json new file mode 100644 index 00000000..1ff1d08e --- /dev/null +++ b/assets/minecraft/models/item/red_bundle_open_back.json @@ -0,0 +1,6 @@ +{ + "parent": "item/bundle", + "textures": { + "layer0": "item/red_bundle_open_back" + } +} diff --git a/assets/minecraft/models/item/red_bundle_open_front.json b/assets/minecraft/models/item/red_bundle_open_front.json new file mode 100644 index 00000000..b8fe9c32 --- /dev/null +++ b/assets/minecraft/models/item/red_bundle_open_front.json @@ -0,0 +1,6 @@ +{ + "parent": "item/bundle", + "textures": { + "layer0": "item/red_bundle_open_front" + } +} diff --git a/assets/minecraft/models/item/stripped_pale_oak_log.json b/assets/minecraft/models/item/stripped_pale_oak_log.json new file mode 100644 index 00000000..3021c285 --- /dev/null +++ b/assets/minecraft/models/item/stripped_pale_oak_log.json @@ -0,0 +1,3 @@ +{ + "parent": "minecraft:block/stripped_pale_oak_log" +} \ No newline at end of file diff --git a/assets/minecraft/models/item/stripped_pale_oak_wood.json b/assets/minecraft/models/item/stripped_pale_oak_wood.json new file mode 100644 index 00000000..c55c0a6a --- /dev/null +++ b/assets/minecraft/models/item/stripped_pale_oak_wood.json @@ -0,0 +1,3 @@ +{ + "parent": "minecraft:block/stripped_pale_oak_wood" +} \ No newline at end of file diff --git a/assets/minecraft/models/item/white_bundle.json b/assets/minecraft/models/item/white_bundle.json new file mode 100644 index 00000000..6efd8ccb --- /dev/null +++ b/assets/minecraft/models/item/white_bundle.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "minecraft:item/white_bundle" + } +} \ No newline at end of file diff --git a/assets/minecraft/models/item/white_bundle_open_back.json b/assets/minecraft/models/item/white_bundle_open_back.json new file mode 100644 index 00000000..6692dda4 --- /dev/null +++ b/assets/minecraft/models/item/white_bundle_open_back.json @@ -0,0 +1,6 @@ +{ + "parent": "item/bundle", + "textures": { + "layer0": "item/white_bundle_open_back" + } +} diff --git a/assets/minecraft/models/item/white_bundle_open_front.json b/assets/minecraft/models/item/white_bundle_open_front.json new file mode 100644 index 00000000..ca14ae3b --- /dev/null +++ b/assets/minecraft/models/item/white_bundle_open_front.json @@ -0,0 +1,6 @@ +{ + "parent": "item/bundle", + "textures": { + "layer0": "item/white_bundle_open_front" + } +} diff --git a/assets/minecraft/models/item/yellow_bundle.json b/assets/minecraft/models/item/yellow_bundle.json new file mode 100644 index 00000000..c685714d --- /dev/null +++ b/assets/minecraft/models/item/yellow_bundle.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "minecraft:item/yellow_bundle" + } +} \ No newline at end of file diff --git a/assets/minecraft/models/item/yellow_bundle_open_back.json b/assets/minecraft/models/item/yellow_bundle_open_back.json new file mode 100644 index 00000000..9f598be7 --- /dev/null +++ b/assets/minecraft/models/item/yellow_bundle_open_back.json @@ -0,0 +1,6 @@ +{ + "parent": "item/bundle", + "textures": { + "layer0": "item/yellow_bundle_open_back" + } +} diff --git a/assets/minecraft/models/item/yellow_bundle_open_front.json b/assets/minecraft/models/item/yellow_bundle_open_front.json new file mode 100644 index 00000000..9c3f41e1 --- /dev/null +++ b/assets/minecraft/models/item/yellow_bundle_open_front.json @@ -0,0 +1,6 @@ +{ + "parent": "item/bundle", + "textures": { + "layer0": "item/yellow_bundle_open_front" + } +} diff --git a/assets/minecraft/particles/trail.json b/assets/minecraft/particles/trail.json new file mode 100644 index 00000000..5590ac4d --- /dev/null +++ b/assets/minecraft/particles/trail.json @@ -0,0 +1,5 @@ +{ + "textures": [ + "minecraft:generic_0" + ] +} diff --git a/assets/minecraft/post_effect/blur.json b/assets/minecraft/post_effect/blur.json new file mode 100644 index 00000000..90aed326 --- /dev/null +++ b/assets/minecraft/post_effect/blur.json @@ -0,0 +1,111 @@ +{ + "targets": { + "swap": {} + }, + "passes": [ + { + "program": "minecraft:post/box_blur", + "inputs": [ + { + "sampler_name": "In", + "target": "minecraft:main", + "bilinear": true + } + ], + "output": "swap", + "uniforms": [ + { + "name": "BlurDir", + "values": [ 1.0, 0.0 ] + } + ] + }, + { + "program": "minecraft:post/box_blur", + "inputs": [ + { + "sampler_name": "In", + "target": "swap", + "bilinear": true + } + ], + "output": "minecraft:main", + "uniforms": [ + { + "name": "BlurDir", + "values": [ 0.0, 1.0 ] + } + ] + }, { + "program": "minecraft:post/box_blur", + "inputs": [ + { + "sampler_name": "In", + "target": "minecraft:main", + "bilinear": true + } + ], + "output": "swap", + "uniforms": [ + { + "name": "BlurDir", + "values": [ 1.0, 0.0 ], + "RadiusMultiplier" : 0.5 + } + ] + }, + { + "program": "minecraft:post/box_blur", + "inputs": [ + { + "sampler_name": "In", + "target": "swap", + "bilinear": true + } + ], + "output": "minecraft:main", + "uniforms": [ + { + "name": "BlurDir", + "values": [ 0.0, 1.0 ], + "RadiusMultiplier" : 0.5 + } + ] + }, { + "program": "minecraft:post/box_blur", + "inputs": [ + { + "sampler_name": "In", + "target": "minecraft:main", + "bilinear": true + } + ], + "output": "swap", + "uniforms": [ + { + "name": "BlurDir", + "values": [ 1.0, 0.0 ], + "RadiusMultiplier" : 0.25 + } + ] + }, + { + "program": "minecraft:post/box_blur", + "inputs": [ + { + "sampler_name": "In", + "target": "swap", + "bilinear": true + } + ], + "output": "minecraft:main", + "uniforms": [ + { + "name": "BlurDir", + "values": [ 0.0, 1.0 ], + "RadiusMultiplier" : 0.25 + } + ] + } + ] +} diff --git a/assets/minecraft/shaders/post/creeper.json b/assets/minecraft/post_effect/creeper.json similarity index 58% rename from assets/minecraft/shaders/post/creeper.json rename to assets/minecraft/post_effect/creeper.json index da503f1a..5e816341 100644 --- a/assets/minecraft/shaders/post/creeper.json +++ b/assets/minecraft/post_effect/creeper.json @@ -1,12 +1,17 @@ { - "targets": [ - "swap" - ], + "targets": { + "swap": {} + }, "passes": [ { - "name": "color_convolve", - "intarget": "minecraft:main", - "outtarget": "swap", + "program": "minecraft:post/color_convolve", + "inputs": [ + { + "sampler_name": "In", + "target": "minecraft:main" + } + ], + "output": "swap", "uniforms": [ { "name": "RedMatrix", @@ -23,9 +28,14 @@ ] }, { - "name": "bits", - "intarget": "swap", - "outtarget": "minecraft:main", + "program": "minecraft:post/bits", + "inputs": [ + { + "sampler_name": "In", + "target": "swap" + } + ], + "output": "minecraft:main", "uniforms": [ { "name": "Resolution", diff --git a/assets/minecraft/post_effect/entity_outline.json b/assets/minecraft/post_effect/entity_outline.json new file mode 100644 index 00000000..cbecbdd2 --- /dev/null +++ b/assets/minecraft/post_effect/entity_outline.json @@ -0,0 +1,61 @@ +{ + "targets": { + "swap": {} + }, + "passes": [ + { + "program": "minecraft:post/entity_outline", + "inputs": [ + { + "sampler_name": "In", + "target": "minecraft:entity_outline" + } + ], + "output": "swap" + }, + { + "program": "minecraft:post/entity_outline_box_blur", + "inputs": [ + { + "sampler_name": "In", + "target": "swap", + "bilinear": true + } + ], + "output": "minecraft:entity_outline", + "uniforms": [ + { + "name": "BlurDir", + "values": [ 1.0, 0.0 ] + } + ] + }, + { + "program": "minecraft:post/entity_outline_box_blur", + "inputs": [ + { + "sampler_name": "In", + "target": "minecraft:entity_outline", + "bilinear": true + } + ], + "output": "swap", + "uniforms": [ + { + "name": "BlurDir", + "values": [ 0.0, 1.0 ] + } + ] + }, + { + "program": "minecraft:post/blit", + "inputs": [ + { + "sampler_name": "In", + "target": "swap" + } + ], + "output": "minecraft:entity_outline" + } + ] +} diff --git a/assets/minecraft/post_effect/invert.json b/assets/minecraft/post_effect/invert.json new file mode 100644 index 00000000..7ef7355e --- /dev/null +++ b/assets/minecraft/post_effect/invert.json @@ -0,0 +1,33 @@ +{ + "targets": { + "swap": {} + }, + "passes": [ + { + "program": "minecraft:post/invert", + "inputs": [ + { + "sampler_name": "In", + "target": "minecraft:main" + } + ], + "output": "swap", + "uniforms": [ + { + "name": "InverseAmount", + "values": [ 0.8 ] + } + ] + }, + { + "program": "minecraft:post/blit", + "inputs": [ + { + "sampler_name": "In", + "target": "swap" + } + ], + "output": "minecraft:main" + } + ] +} diff --git a/assets/minecraft/post_effect/spider.json b/assets/minecraft/post_effect/spider.json new file mode 100644 index 00000000..3eb6ee6b --- /dev/null +++ b/assets/minecraft/post_effect/spider.json @@ -0,0 +1,274 @@ +{ + "targets": { + "large_blur": {}, + "small_blur": {}, + "temp": {}, + "swap": {} + }, + "passes": [ + { + "program": "minecraft:post/box_blur", + "inputs": [ + { + "sampler_name": "In", + "target": "minecraft:main", + "bilinear": true + } + ], + "output": "temp", + "uniforms": [ + { + "name": "BlurDir", + "values": [ 1.0, 0.0 ] + }, + { + "name": "Radius", + "values": [ 15.0 ] + } + ] + }, + { + "program": "minecraft:post/box_blur", + "inputs": [ + { + "sampler_name": "In", + "target": "temp", + "bilinear": true + } + ], + "output": "large_blur", + "uniforms": [ + { + "name": "BlurDir", + "values": [ 0.0, 1.0 ] + }, + { + "name": "Radius", + "values": [ 15.0 ] + } + ] + }, + { + "program": "minecraft:post/box_blur", + "inputs": [ + { + "sampler_name": "In", + "target": "minecraft:main", + "bilinear": true + } + ], + "output": "temp", + "uniforms": [ + { + "name": "BlurDir", + "values": [ 1.0, 0.0 ] + }, + { + "name": "Radius", + "values": [ 7.0 ] + } + ] + }, + { + "program": "minecraft:post/box_blur", + "inputs": [ + { + "sampler_name": "In", + "target": "temp", + "bilinear": true + } + ], + "output": "small_blur", + "uniforms": [ + { + "name": "BlurDir", + "values": [ 0.0, 1.0 ] + }, + { + "name": "Radius", + "values": [ 7.0 ] + } + ] + }, + { + "program": "minecraft:post/spider", + "inputs": [ + { + "sampler_name": "In", + "target": "minecraft:main" + }, + { + "sampler_name": "Blur", + "target": "large_blur" + } + ], + "output": "temp", + "uniforms": [ + { + "name": "InScale", + "values": [ 1.25, 2.0 ] + }, + { + "name": "InOffset", + "values": [ -0.125, -0.1 ] + }, + { + "name": "Scissor", + "values": [ 0.0, 0.0, 1.0, 1.0 ] + }, + { + "name": "Vignette", + "values": [ 0.1, 0.1, 0.9, 0.9 ] + } + ] + }, + { + "program": "minecraft:post/spider", + "inputs": [ + { + "sampler_name": "In", + "target": "small_blur" + }, + { + "sampler_name": "Blur", + "target": "temp" + } + ], + "output": "swap", + "uniforms": [ + { + "name": "InScale", + "values": [ 2.35, 4.2 ] + }, + { + "name": "InOffset", + "values": [ -1.1, -1.5 ] + }, + { + "name": "InRotation", + "values": [ -45.0 ] + }, + { + "name": "Scissor", + "values": [ 0.21, 0.0, 0.79, 1.0 ] + }, + { + "name": "Vignette", + "values": [ 0.31, 0.1, 0.69, 0.9 ] + } + ] + }, + { + "program": "minecraft:post/spider", + "inputs": [ + { + "sampler_name": "In", + "target": "small_blur" + }, + { + "sampler_name": "Blur", + "target": "swap" + } + ], + "output": "temp", + "uniforms": [ + { + "name": "InScale", + "values": [ 2.35, 4.2 ] + }, + { + "name": "InOffset", + "values": [ 0.45, -4.45 ] + }, + { + "name": "InRotation", + "values": [ 45.0 ] + }, + { + "name": "Scissor", + "values": [ 0.21, 0.0, 0.79, 1.0 ] + }, + { + "name": "Vignette", + "values": [ 0.31, 0.1, 0.69, 0.9 ] + } + ] + }, + { + "program": "minecraft:post/spider", + "inputs": [ + { + "sampler_name": "In", + "target": "small_blur" + }, + { + "sampler_name": "Blur", + "target": "temp" + } + ], + "output": "swap", + "uniforms": [ + { + "name": "InScale", + "values": [ 2.35, 2.35 ] + }, + { + "name": "InOffset", + "values": [ -0.385, -1.29 ] + }, + { + "name": "InRotation", + "values": [ 0.0 ] + }, + { + "name": "Vignette", + "values": [ 0.31, 0.1, 0.69, 0.9 ] + } + ] + }, + { + "program": "minecraft:post/spider", + "inputs": [ + { + "sampler_name": "In", + "target": "small_blur" + }, + { + "sampler_name": "Blur", + "target": "swap" + } + ], + "output": "temp", + "uniforms": [ + { + "name": "InScale", + "values": [ 2.35, 2.35 ] + }, + { + "name": "InOffset", + "values": [ -0.965, -1.29 ] + }, + { + "name": "Vignette", + "values": [ 0.31, 0.1, 0.69, 0.9 ] + } + ] + }, + { + "program": "minecraft:post/blit", + "inputs": [ + { + "sampler_name": "In", + "target": "temp" + } + ], + "output": "minecraft:main", + "uniforms": [ + { + "name": "ColorModulate", + "values": [ 1.0, 0.8, 0.8, 1.0 ] + } + ] + } + ] +} diff --git a/assets/minecraft/post_effect/transparency.json b/assets/minecraft/post_effect/transparency.json new file mode 100644 index 00000000..f0e1ea0c --- /dev/null +++ b/assets/minecraft/post_effect/transparency.json @@ -0,0 +1,77 @@ +{ + "targets" : { + "final": {} + }, + "passes": [ + { + "program": "minecraft:post/transparency", + "inputs": [ + { + "sampler_name": "Main", + "target": "minecraft:main" + }, + { + "sampler_name": "MainDepth", + "target": "minecraft:main", + "use_depth_buffer": true + }, + { + "sampler_name": "Translucent", + "target": "minecraft:translucent" + }, + { + "sampler_name": "TranslucentDepth", + "target": "minecraft:translucent", + "use_depth_buffer": true + }, + { + "sampler_name": "ItemEntity", + "target": "minecraft:item_entity" + }, + { + "sampler_name": "ItemEntityDepth", + "target": "minecraft:item_entity", + "use_depth_buffer": true + }, + { + "sampler_name": "Particles", + "target": "minecraft:particles" + }, + { + "sampler_name": "ParticlesDepth", + "target": "minecraft:particles", + "use_depth_buffer": true + }, + { + "sampler_name": "Clouds", + "target": "minecraft:clouds" + }, + { + "sampler_name": "CloudsDepth", + "target": "minecraft:clouds", + "use_depth_buffer": true + }, + { + "sampler_name": "Weather", + "target": "minecraft:weather" + }, + { + "sampler_name": "WeatherDepth", + "target": "minecraft:weather", + "use_depth_buffer": true + } + ], + "output": "final" + }, + { + "program": "minecraft:post/blit", + "inputs": [ + { + "sampler_name": "In", + "target": "final" + } + ], + "output": "minecraft:main" + } + ] +} diff --git a/assets/minecraft/shaders/core/blit_screen.fsh b/assets/minecraft/shaders/core/blit_screen.fsh index b750ae82..a1d34267 100644 --- a/assets/minecraft/shaders/core/blit_screen.fsh +++ b/assets/minecraft/shaders/core/blit_screen.fsh @@ -1,11 +1,11 @@ #version 150 -uniform sampler2D DiffuseSampler; +uniform sampler2D InSampler; in vec2 texCoord; out vec4 fragColor; void main() { - fragColor = texture(DiffuseSampler, texCoord); + fragColor = texture(InSampler, texCoord); } diff --git a/assets/minecraft/shaders/core/blit_screen.json b/assets/minecraft/shaders/core/blit_screen.json index 72894ff6..61d51e1f 100644 --- a/assets/minecraft/shaders/core/blit_screen.json +++ b/assets/minecraft/shaders/core/blit_screen.json @@ -1,8 +1,8 @@ { - "vertex": "blit_screen", - "fragment": "blit_screen", + "vertex": "minecraft:core/blit_screen", + "fragment": "minecraft:core/blit_screen", "samplers": [ - { "name": "DiffuseSampler" } + { "name": "InSampler" } ], "uniforms": [ ] diff --git a/assets/minecraft/shaders/core/rendertype_entity_cutout.fsh b/assets/minecraft/shaders/core/entity.fsh similarity index 80% rename from assets/minecraft/shaders/core/rendertype_entity_cutout.fsh rename to assets/minecraft/shaders/core/entity.fsh index 82ee596b..9ac7cb71 100644 --- a/assets/minecraft/shaders/core/rendertype_entity_cutout.fsh +++ b/assets/minecraft/shaders/core/entity.fsh @@ -1,6 +1,6 @@ #version 150 -#moj_import +#moj_import uniform sampler2D Sampler0; @@ -19,11 +19,17 @@ out vec4 fragColor; void main() { vec4 color = texture(Sampler0, texCoord0); - if (color.a < 0.1) { +#ifdef ALPHA_CUTOUT + if (color.a < ALPHA_CUTOUT) { discard; } +#endif color *= vertexColor * ColorModulator; +#ifndef NO_OVERLAY color.rgb = mix(overlayColor.rgb, color.rgb, overlayColor.a); +#endif +#ifndef EMISSIVE color *= lightMapColor; +#endif fragColor = linear_fog(color, vertexDistance, FogStart, FogEnd, FogColor); } diff --git a/assets/minecraft/shaders/core/rendertype_entity_cutout_no_cull_z_offset.vsh b/assets/minecraft/shaders/core/entity.vsh similarity index 75% rename from assets/minecraft/shaders/core/rendertype_entity_cutout_no_cull_z_offset.vsh rename to assets/minecraft/shaders/core/entity.vsh index de8af38a..df60034b 100644 --- a/assets/minecraft/shaders/core/rendertype_entity_cutout_no_cull_z_offset.vsh +++ b/assets/minecraft/shaders/core/entity.vsh @@ -1,7 +1,7 @@ #version 150 -#moj_import -#moj_import +#moj_import +#moj_import in vec3 Position; in vec4 Color; @@ -15,6 +15,7 @@ uniform sampler2D Sampler2; uniform mat4 ModelViewMat; uniform mat4 ProjMat; +uniform mat4 TextureMat; uniform int FogShape; uniform vec3 Light0_Direction; @@ -30,8 +31,16 @@ void main() { gl_Position = ProjMat * ModelViewMat * vec4(Position, 1.0); vertexDistance = fog_distance(Position, FogShape); +#ifdef NO_CARDINAL_LIGHTING + vertexColor = Color; +#else vertexColor = minecraft_mix_light(Light0_Direction, Light1_Direction, Normal, Color); +#endif lightMapColor = texelFetch(Sampler2, UV2 / 16, 0); overlayColor = texelFetch(Sampler1, UV1, 0); + texCoord0 = UV0; +#ifdef APPLY_TEXTURE_MATRIX + texCoord0 = (TextureMat * vec4(UV0, 0.0, 1.0)).xy; +#endif } diff --git a/assets/minecraft/shaders/core/rendertype_entity_glint.fsh b/assets/minecraft/shaders/core/glint.fsh similarity index 93% rename from assets/minecraft/shaders/core/rendertype_entity_glint.fsh rename to assets/minecraft/shaders/core/glint.fsh index 9bcfd7db..500c14b1 100644 --- a/assets/minecraft/shaders/core/rendertype_entity_glint.fsh +++ b/assets/minecraft/shaders/core/glint.fsh @@ -1,6 +1,6 @@ #version 150 -#moj_import +#moj_import uniform sampler2D Sampler0; diff --git a/assets/minecraft/shaders/core/rendertype_armor_entity_glint.vsh b/assets/minecraft/shaders/core/glint.vsh similarity index 92% rename from assets/minecraft/shaders/core/rendertype_armor_entity_glint.vsh rename to assets/minecraft/shaders/core/glint.vsh index f123a0e1..8ba97c1f 100644 --- a/assets/minecraft/shaders/core/rendertype_armor_entity_glint.vsh +++ b/assets/minecraft/shaders/core/glint.vsh @@ -1,6 +1,6 @@ #version 150 -#moj_import +#moj_import in vec3 Position; in vec2 UV0; diff --git a/assets/minecraft/shaders/core/rendertype_gui.fsh b/assets/minecraft/shaders/core/gui.fsh similarity index 100% rename from assets/minecraft/shaders/core/rendertype_gui.fsh rename to assets/minecraft/shaders/core/gui.fsh diff --git a/assets/minecraft/shaders/core/rendertype_gui.vsh b/assets/minecraft/shaders/core/gui.vsh similarity index 100% rename from assets/minecraft/shaders/core/rendertype_gui.vsh rename to assets/minecraft/shaders/core/gui.vsh diff --git a/assets/minecraft/shaders/core/lightmap.fsh b/assets/minecraft/shaders/core/lightmap.fsh new file mode 100644 index 00000000..657bd9df --- /dev/null +++ b/assets/minecraft/shaders/core/lightmap.fsh @@ -0,0 +1,68 @@ +#version 150 + +uniform float AmbientLightFactor; +uniform float SkyFactor; +uniform float BlockFactor; +uniform int UseBrightLightmap; +uniform vec3 SkyLightColor; +uniform float NightVisionFactor; +uniform float DarknessScale; +uniform float DarkenWorldFactor; +uniform float BrightnessFactor; + +in vec2 texCoord; + +out vec4 fragColor; + +float get_brightness(float level) { + float curved_level = level / (4.0 - 3.0 * level); + return mix(curved_level, 1.0, AmbientLightFactor); +} + +vec3 notGamma(vec3 x) { + vec3 nx = 1.0 - x; + return 1.0 - nx * nx * nx * nx; +} + +void main() { + float block_brightness = get_brightness(floor(texCoord.x * 16) / 15) * BlockFactor; + float sky_brightness = get_brightness(floor(texCoord.y * 16) / 15) * SkyFactor; + + // cubic nonsense, dips to yellowish in the middle, white when fully saturated + vec3 color = vec3( + block_brightness, + block_brightness * ((block_brightness * 0.6 + 0.4) * 0.6 + 0.4), + block_brightness * (block_brightness * block_brightness * 0.6 + 0.4) + ); + + if (UseBrightLightmap != 0) { + color = mix(color, vec3(0.99, 1.12, 1.0), 0.25); + color = clamp(color, 0.0, 1.0); + } else { + color += SkyLightColor * sky_brightness; + color = mix(color, vec3(0.75), 0.04); + + vec3 darkened_color = color * vec3(0.7, 0.6, 0.6); + color = mix(color, darkened_color, DarkenWorldFactor); + } + + if (NightVisionFactor > 0.0) { + // scale up uniformly until 1.0 is hit by one of the colors + float max_component = max(color.r, max(color.g, color.b)); + if (max_component < 1.0) { + vec3 bright_color = color / max_component; + color = mix(color, bright_color, NightVisionFactor); + } + } + + if (UseBrightLightmap == 0) { + color = clamp(color - vec3(DarknessScale), 0.0, 1.0); + } + + vec3 notGamma = notGamma(color); + color = mix(color, notGamma, BrightnessFactor); + color = mix(color, vec3(0.75), 0.04); + color = clamp(color, 0.0, 1.0); + + fragColor = vec4(color, 1.0); +} diff --git a/assets/minecraft/shaders/core/lightmap.json b/assets/minecraft/shaders/core/lightmap.json new file mode 100644 index 00000000..3b90e934 --- /dev/null +++ b/assets/minecraft/shaders/core/lightmap.json @@ -0,0 +1,17 @@ +{ + "vertex": "minecraft:core/blit_screen", + "fragment": "minecraft:core/lightmap", + "samplers": [ + ], + "uniforms": [ + { "name": "AmbientLightFactor", "type": "float", "count": 1, "values": [1.0] }, + { "name": "SkyFactor", "type": "float", "count": 1, "values": [1.0] }, + { "name": "BlockFactor", "type": "float", "count": 1, "values": [1.0] }, + { "name": "UseBrightLightmap", "type": "int", "count": 1, "values": [0] }, + { "name": "SkyLightColor", "type": "float", "count": 3, "values": [1.0] }, + { "name": "NightVisionFactor", "type": "float", "count": 1, "values": [0.0] }, + { "name": "DarknessScale", "type": "float", "count": 1, "values": [0.0] }, + { "name": "DarkenWorldFactor", "type": "float", "count": 1, "values": [0.0] }, + { "name": "BrightnessFactor", "type": "float", "count": 1, "values": [1.0] } + ] +} diff --git a/assets/minecraft/shaders/core/particle.fsh b/assets/minecraft/shaders/core/particle.fsh index 58f81d29..a08e0742 100644 --- a/assets/minecraft/shaders/core/particle.fsh +++ b/assets/minecraft/shaders/core/particle.fsh @@ -1,6 +1,6 @@ #version 150 -#moj_import +#moj_import uniform sampler2D Sampler0; diff --git a/assets/minecraft/shaders/core/particle.json b/assets/minecraft/shaders/core/particle.json index a3d33094..2f334b45 100644 --- a/assets/minecraft/shaders/core/particle.json +++ b/assets/minecraft/shaders/core/particle.json @@ -1,6 +1,6 @@ { - "vertex": "particle", - "fragment": "particle", + "vertex": "minecraft:core/particle", + "fragment": "minecraft:core/particle", "samplers": [ { "name": "Sampler0" }, { "name": "Sampler2" } diff --git a/assets/minecraft/shaders/core/particle.vsh b/assets/minecraft/shaders/core/particle.vsh index a2ae56b7..2d1cce3f 100644 --- a/assets/minecraft/shaders/core/particle.vsh +++ b/assets/minecraft/shaders/core/particle.vsh @@ -1,6 +1,6 @@ #version 150 -#moj_import +#moj_import in vec3 Position; in vec2 UV0; diff --git a/assets/minecraft/shaders/core/position.fsh b/assets/minecraft/shaders/core/position.fsh index 83ce3b1d..00b37260 100644 --- a/assets/minecraft/shaders/core/position.fsh +++ b/assets/minecraft/shaders/core/position.fsh @@ -1,6 +1,6 @@ #version 150 -#moj_import +#moj_import uniform vec4 ColorModulator; uniform float FogStart; diff --git a/assets/minecraft/shaders/core/position.json b/assets/minecraft/shaders/core/position.json index 78516f65..29b6475f 100644 --- a/assets/minecraft/shaders/core/position.json +++ b/assets/minecraft/shaders/core/position.json @@ -1,6 +1,6 @@ { - "vertex": "position", - "fragment": "position", + "vertex": "minecraft:core/position", + "fragment": "minecraft:core/position", "samplers": [ ], "uniforms": [ diff --git a/assets/minecraft/shaders/core/position.vsh b/assets/minecraft/shaders/core/position.vsh index 6ff178e2..a667402d 100644 --- a/assets/minecraft/shaders/core/position.vsh +++ b/assets/minecraft/shaders/core/position.vsh @@ -1,6 +1,6 @@ #version 150 -#moj_import +#moj_import in vec3 Position; diff --git a/assets/minecraft/shaders/core/position_color.json b/assets/minecraft/shaders/core/position_color.json index 827d9af4..6d715d92 100644 --- a/assets/minecraft/shaders/core/position_color.json +++ b/assets/minecraft/shaders/core/position_color.json @@ -1,6 +1,6 @@ { - "vertex": "position_color", - "fragment": "position_color", + "vertex": "minecraft:core/position_color", + "fragment": "minecraft:core/position_color", "samplers": [ ], "uniforms": [ diff --git a/assets/minecraft/shaders/core/position_color_lightmap.json b/assets/minecraft/shaders/core/position_color_lightmap.json index ed33a8b0..d84b26f6 100644 --- a/assets/minecraft/shaders/core/position_color_lightmap.json +++ b/assets/minecraft/shaders/core/position_color_lightmap.json @@ -1,6 +1,6 @@ { - "vertex": "position_color_lightmap", - "fragment": "position_color_lightmap", + "vertex": "minecraft:core/position_color_lightmap", + "fragment": "minecraft:core/position_color_lightmap", "samplers": [ { "name": "Sampler2" } ], diff --git a/assets/minecraft/shaders/core/position_color_tex_lightmap.json b/assets/minecraft/shaders/core/position_color_tex_lightmap.json index 1f1dbd53..f7eb56e0 100644 --- a/assets/minecraft/shaders/core/position_color_tex_lightmap.json +++ b/assets/minecraft/shaders/core/position_color_tex_lightmap.json @@ -1,6 +1,6 @@ { - "vertex": "position_color_tex_lightmap", - "fragment": "position_color_tex_lightmap", + "vertex": "minecraft:core/position_color_tex_lightmap", + "fragment": "minecraft:core/position_color_tex_lightmap", "samplers": [ { "name": "Sampler0" } ], diff --git a/assets/minecraft/shaders/core/position_tex.json b/assets/minecraft/shaders/core/position_tex.json index 7ba6e132..9f402324 100644 --- a/assets/minecraft/shaders/core/position_tex.json +++ b/assets/minecraft/shaders/core/position_tex.json @@ -1,6 +1,6 @@ { - "vertex": "position_tex", - "fragment": "position_tex", + "vertex": "minecraft:core/position_tex", + "fragment": "minecraft:core/position_tex", "samplers": [ { "name": "Sampler0" } ], diff --git a/assets/minecraft/shaders/core/position_tex_color.fsh b/assets/minecraft/shaders/core/position_tex_color.fsh index f64629e9..759ec1a2 100644 --- a/assets/minecraft/shaders/core/position_tex_color.fsh +++ b/assets/minecraft/shaders/core/position_tex_color.fsh @@ -11,7 +11,7 @@ out vec4 fragColor; void main() { vec4 color = texture(Sampler0, texCoord0) * vertexColor; - if (color.a < 0.1) { + if (color.a == 0.0) { discard; } fragColor = color * ColorModulator; diff --git a/assets/minecraft/shaders/core/position_tex_color.json b/assets/minecraft/shaders/core/position_tex_color.json index 367ef5e9..f9454656 100644 --- a/assets/minecraft/shaders/core/position_tex_color.json +++ b/assets/minecraft/shaders/core/position_tex_color.json @@ -1,6 +1,6 @@ { - "vertex": "position_tex_color", - "fragment": "position_tex_color", + "vertex": "minecraft:core/position_tex_color", + "fragment": "minecraft:core/position_tex_color", "samplers": [ { "name": "Sampler0" } ], diff --git a/assets/minecraft/shaders/core/rendertype_armor_cutout_no_cull.fsh b/assets/minecraft/shaders/core/rendertype_armor_cutout_no_cull.fsh deleted file mode 100644 index 232a61df..00000000 --- a/assets/minecraft/shaders/core/rendertype_armor_cutout_no_cull.fsh +++ /dev/null @@ -1,25 +0,0 @@ -#version 150 - -#moj_import - -uniform sampler2D Sampler0; - -uniform vec4 ColorModulator; -uniform float FogStart; -uniform float FogEnd; -uniform vec4 FogColor; - -in float vertexDistance; -in vec4 vertexColor; -in vec2 texCoord0; -in vec2 texCoord1; - -out vec4 fragColor; - -void main() { - vec4 color = texture(Sampler0, texCoord0) * vertexColor * ColorModulator; - if (color.a < 0.1) { - discard; - } - fragColor = linear_fog(color, vertexDistance, FogStart, FogEnd, FogColor); -} diff --git a/assets/minecraft/shaders/core/rendertype_armor_cutout_no_cull.json b/assets/minecraft/shaders/core/rendertype_armor_cutout_no_cull.json index 7f15d3bf..85173fe8 100644 --- a/assets/minecraft/shaders/core/rendertype_armor_cutout_no_cull.json +++ b/assets/minecraft/shaders/core/rendertype_armor_cutout_no_cull.json @@ -1,6 +1,14 @@ { - "vertex": "rendertype_armor_cutout_no_cull", - "fragment": "rendertype_armor_cutout_no_cull", + "vertex": "minecraft:core/entity", + "fragment": "minecraft:core/entity", + "defines": { + "values": { + "ALPHA_CUTOUT": "0.1" + }, + "flags": [ + "NO_OVERLAY" + ] + }, "samplers": [ { "name": "Sampler0" }, { "name": "Sampler2" } diff --git a/assets/minecraft/shaders/core/rendertype_armor_cutout_no_cull.vsh b/assets/minecraft/shaders/core/rendertype_armor_cutout_no_cull.vsh deleted file mode 100644 index 6366633b..00000000 --- a/assets/minecraft/shaders/core/rendertype_armor_cutout_no_cull.vsh +++ /dev/null @@ -1,34 +0,0 @@ -#version 150 - -#moj_import -#moj_import - -in vec3 Position; -in vec4 Color; -in vec2 UV0; -in vec2 UV1; -in ivec2 UV2; -in vec3 Normal; - -uniform sampler2D Sampler2; - -uniform mat4 ModelViewMat; -uniform mat4 ProjMat; -uniform int FogShape; - -uniform vec3 Light0_Direction; -uniform vec3 Light1_Direction; - -out float vertexDistance; -out vec4 vertexColor; -out vec2 texCoord0; -out vec2 texCoord1; - -void main() { - gl_Position = ProjMat * ModelViewMat * vec4(Position, 1.0); - - vertexDistance = fog_distance(Position, FogShape); - vertexColor = minecraft_mix_light(Light0_Direction, Light1_Direction, Normal, Color) * texelFetch(Sampler2, UV2 / 16, 0); - texCoord0 = UV0; - texCoord1 = UV1; -} diff --git a/assets/minecraft/shaders/core/rendertype_armor_entity_glint.fsh b/assets/minecraft/shaders/core/rendertype_armor_entity_glint.fsh deleted file mode 100644 index 9bcfd7db..00000000 --- a/assets/minecraft/shaders/core/rendertype_armor_entity_glint.fsh +++ /dev/null @@ -1,24 +0,0 @@ -#version 150 - -#moj_import - -uniform sampler2D Sampler0; - -uniform vec4 ColorModulator; -uniform float FogStart; -uniform float FogEnd; -uniform float GlintAlpha; - -in float vertexDistance; -in vec2 texCoord0; - -out vec4 fragColor; - -void main() { - vec4 color = texture(Sampler0, texCoord0) * ColorModulator; - if (color.a < 0.1) { - discard; - } - float fade = linear_fog_fade(vertexDistance, FogStart, FogEnd) * GlintAlpha; - fragColor = vec4(color.rgb * fade, color.a); -} diff --git a/assets/minecraft/shaders/core/rendertype_armor_entity_glint.json b/assets/minecraft/shaders/core/rendertype_armor_entity_glint.json index 982489f6..c321e633 100644 --- a/assets/minecraft/shaders/core/rendertype_armor_entity_glint.json +++ b/assets/minecraft/shaders/core/rendertype_armor_entity_glint.json @@ -1,6 +1,6 @@ { - "vertex": "rendertype_armor_entity_glint", - "fragment": "rendertype_armor_entity_glint", + "vertex": "minecraft:core/glint", + "fragment": "minecraft:core/glint", "samplers": [ { "name": "Sampler0" } ], @@ -11,6 +11,7 @@ { "name": "GlintAlpha", "type": "float", "count": 1, "values": [ 1.0 ] }, { "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] }, { "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] }, + { "name": "FogColor", "type": "float", "count": 4, "values": [ 0.0, 0.0, 0.0, 0.0 ] }, { "name": "FogShape", "type": "int", "count": 1, "values": [ 0 ] }, { "name": "TextureMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] } ] diff --git a/assets/minecraft/shaders/core/rendertype_entity_translucent_cull.json b/assets/minecraft/shaders/core/rendertype_armor_translucent.json similarity index 82% rename from assets/minecraft/shaders/core/rendertype_entity_translucent_cull.json rename to assets/minecraft/shaders/core/rendertype_armor_translucent.json index 2db71dd7..85173fe8 100644 --- a/assets/minecraft/shaders/core/rendertype_entity_translucent_cull.json +++ b/assets/minecraft/shaders/core/rendertype_armor_translucent.json @@ -1,6 +1,14 @@ { - "vertex": "rendertype_entity_translucent_cull", - "fragment": "rendertype_entity_translucent_cull", + "vertex": "minecraft:core/entity", + "fragment": "minecraft:core/entity", + "defines": { + "values": { + "ALPHA_CUTOUT": "0.1" + }, + "flags": [ + "NO_OVERLAY" + ] + }, "samplers": [ { "name": "Sampler0" }, { "name": "Sampler2" } diff --git a/assets/minecraft/shaders/core/rendertype_beacon_beam.fsh b/assets/minecraft/shaders/core/rendertype_beacon_beam.fsh index 88ce640a..7669c9e1 100644 --- a/assets/minecraft/shaders/core/rendertype_beacon_beam.fsh +++ b/assets/minecraft/shaders/core/rendertype_beacon_beam.fsh @@ -1,6 +1,6 @@ #version 150 -#moj_import +#moj_import uniform sampler2D Sampler0; diff --git a/assets/minecraft/shaders/core/rendertype_beacon_beam.json b/assets/minecraft/shaders/core/rendertype_beacon_beam.json index 145874ff..f34c777d 100644 --- a/assets/minecraft/shaders/core/rendertype_beacon_beam.json +++ b/assets/minecraft/shaders/core/rendertype_beacon_beam.json @@ -1,6 +1,6 @@ { - "vertex": "rendertype_beacon_beam", - "fragment": "rendertype_beacon_beam", + "vertex": "minecraft:core/rendertype_beacon_beam", + "fragment": "minecraft:core/rendertype_beacon_beam", "samplers": [ { "name": "Sampler0" } ], @@ -10,6 +10,7 @@ { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] }, { "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] }, { "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] }, + { "name": "FogShape", "type": "int", "count": 1, "values": [ 0 ] }, { "name": "FogColor", "type": "float", "count": 4, "values": [ 0.0, 0.0, 0.0, 0.0 ] } ] } diff --git a/assets/minecraft/shaders/core/rendertype_breeze_wind.fsh b/assets/minecraft/shaders/core/rendertype_breeze_wind.fsh deleted file mode 100644 index 89514fba..00000000 --- a/assets/minecraft/shaders/core/rendertype_breeze_wind.fsh +++ /dev/null @@ -1,23 +0,0 @@ -#version 150 - -#moj_import - -uniform sampler2D Sampler0; - -uniform vec4 ColorModulator; -uniform float FogStart; -uniform float FogEnd; - -in float vertexDistance; -in vec4 vertexColor; -in vec2 texCoord0; - -out vec4 fragColor; - -void main() { - vec4 color = texture(Sampler0, texCoord0) * vertexColor * ColorModulator; - if (color.a < 0.1) { - discard; - } - fragColor = color * linear_fog_fade(vertexDistance, FogStart, FogEnd); -} diff --git a/assets/minecraft/shaders/core/rendertype_breeze_wind.json b/assets/minecraft/shaders/core/rendertype_breeze_wind.json index 17da015f..c5aa6a4d 100644 --- a/assets/minecraft/shaders/core/rendertype_breeze_wind.json +++ b/assets/minecraft/shaders/core/rendertype_breeze_wind.json @@ -1,6 +1,16 @@ { - "vertex": "rendertype_breeze_wind", - "fragment": "rendertype_breeze_wind", + "vertex": "minecraft:core/entity", + "fragment": "minecraft:core/entity", + "defines": { + "values": { + "ALPHA_CUTOUT": "0.1" + }, + "flags": [ + "APPLY_TEXTURE_MATRIX", + "NO_CARDINAL_LIGHTING", + "NO_OVERLAY" + ] + }, "samplers": [ { "name": "Sampler0" }, { "name": "Sampler2" } @@ -12,6 +22,7 @@ { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] }, { "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] }, { "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] }, + { "name": "FogColor", "type": "float", "count": 4, "values": [ 0.0, 0.0, 0.0, 0.0 ] }, { "name": "FogShape", "type": "int", "count": 1, "values": [ 0 ] } ] } diff --git a/assets/minecraft/shaders/core/rendertype_breeze_wind.vsh b/assets/minecraft/shaders/core/rendertype_breeze_wind.vsh deleted file mode 100644 index 583325b9..00000000 --- a/assets/minecraft/shaders/core/rendertype_breeze_wind.vsh +++ /dev/null @@ -1,32 +0,0 @@ -#version 150 - -#moj_import -#moj_import - -in vec3 Position; -in vec4 Color; -in vec2 UV0; -in ivec2 UV2; - -uniform sampler2D Sampler0; -uniform sampler2D Sampler2; - -uniform mat4 ModelViewMat; -uniform mat4 ProjMat; -uniform mat4 TextureMat; -uniform int FogShape; - -out float vertexDistance; -out vec4 vertexColor; -out vec4 lightMapColor; -out vec2 texCoord0; - -void main() { - gl_Position = ProjMat * ModelViewMat * vec4(Position, 1.0); - - vertexDistance = fog_distance(Position, FogShape); - lightMapColor = texelFetch(Sampler2, UV2 / 16, 0); - vertexColor = Color * lightMapColor; - - texCoord0 = (TextureMat * vec4(UV0, 0.0, 1.0)).xy; -} diff --git a/assets/minecraft/shaders/core/rendertype_clouds.fsh b/assets/minecraft/shaders/core/rendertype_clouds.fsh index 941d07fd..19f60967 100644 --- a/assets/minecraft/shaders/core/rendertype_clouds.fsh +++ b/assets/minecraft/shaders/core/rendertype_clouds.fsh @@ -1,24 +1,16 @@ #version 150 -#moj_import +#moj_import -uniform sampler2D Sampler0; - -uniform vec4 ColorModulator; uniform float FogStart; uniform float FogEnd; uniform vec4 FogColor; -in vec2 texCoord0; in float vertexDistance; in vec4 vertexColor; out vec4 fragColor; void main() { - vec4 color = texture(Sampler0, texCoord0) * vertexColor * ColorModulator; - if (color.a < 0.1) { - discard; - } - fragColor = linear_fog(color, vertexDistance, FogStart, FogEnd, FogColor); + fragColor = linear_fog(vertexColor, vertexDistance, FogStart, FogEnd, FogColor); } diff --git a/assets/minecraft/shaders/core/rendertype_clouds.json b/assets/minecraft/shaders/core/rendertype_clouds.json index 583a72bd..dc7d8c1e 100644 --- a/assets/minecraft/shaders/core/rendertype_clouds.json +++ b/assets/minecraft/shaders/core/rendertype_clouds.json @@ -1,12 +1,12 @@ { - "vertex": "rendertype_clouds", - "fragment": "rendertype_clouds", + "vertex": "minecraft:core/rendertype_clouds", + "fragment": "minecraft:core/rendertype_clouds", "samplers": [ - { "name": "Sampler0" } ], "uniforms": [ { "name": "ModelViewMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] }, { "name": "ProjMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] }, + { "name": "ModelOffset", "type": "float", "count": 3, "values": [ 0.0, 0.0, 0.0 ] }, { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] }, { "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] }, { "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] }, diff --git a/assets/minecraft/shaders/core/rendertype_clouds.vsh b/assets/minecraft/shaders/core/rendertype_clouds.vsh index cab15097..1abb3766 100644 --- a/assets/minecraft/shaders/core/rendertype_clouds.vsh +++ b/assets/minecraft/shaders/core/rendertype_clouds.vsh @@ -1,25 +1,23 @@ #version 150 -#moj_import +#moj_import in vec3 Position; -in vec2 UV0; in vec4 Color; -in vec3 Normal; uniform mat4 ModelViewMat; uniform mat4 ProjMat; +uniform vec3 ModelOffset; uniform int FogShape; +uniform vec4 ColorModulator; -out vec2 texCoord0; out float vertexDistance; out vec4 vertexColor; void main() { - vec4 pos = ModelViewMat * vec4(Position, 1.0); - gl_Position = ProjMat * pos; + vec3 pos = Position + ModelOffset; + gl_Position = ProjMat * ModelViewMat * vec4(pos, 1.0); - texCoord0 = UV0; - vertexDistance = fog_distance(pos.xyz, FogShape); - vertexColor = Color; + vertexDistance = fog_distance(pos, FogShape); + vertexColor = Color * ColorModulator; } diff --git a/assets/minecraft/shaders/core/rendertype_crumbling.json b/assets/minecraft/shaders/core/rendertype_crumbling.json index 01cd4bb2..9dd3add9 100644 --- a/assets/minecraft/shaders/core/rendertype_crumbling.json +++ b/assets/minecraft/shaders/core/rendertype_crumbling.json @@ -1,6 +1,6 @@ { - "vertex": "rendertype_crumbling", - "fragment": "rendertype_crumbling", + "vertex": "minecraft:core/rendertype_crumbling", + "fragment": "minecraft:core/rendertype_crumbling", "samplers": [ { "name": "Sampler0" } ], diff --git a/assets/minecraft/shaders/core/rendertype_cutout.json b/assets/minecraft/shaders/core/rendertype_cutout.json index a9460d25..ea3a5b05 100644 --- a/assets/minecraft/shaders/core/rendertype_cutout.json +++ b/assets/minecraft/shaders/core/rendertype_cutout.json @@ -1,6 +1,11 @@ { - "vertex": "rendertype_cutout", - "fragment": "rendertype_cutout", + "vertex": "minecraft:core/terrain", + "fragment": "minecraft:core/terrain", + "defines": { + "values": { + "ALPHA_CUTOUT": "0.1" + } + }, "samplers": [ { "name": "Sampler0" }, { "name": "Sampler2" } @@ -8,7 +13,7 @@ "uniforms": [ { "name": "ModelViewMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] }, { "name": "ProjMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] }, - { "name": "ChunkOffset", "type": "float", "count": 3, "values": [ 0.0, 0.0, 0.0 ] }, + { "name": "ModelOffset", "type": "float", "count": 3, "values": [ 0.0, 0.0, 0.0 ] }, { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] }, { "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] }, { "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] }, diff --git a/assets/minecraft/shaders/core/rendertype_cutout.vsh b/assets/minecraft/shaders/core/rendertype_cutout.vsh deleted file mode 100644 index 02f3d117..00000000 --- a/assets/minecraft/shaders/core/rendertype_cutout.vsh +++ /dev/null @@ -1,30 +0,0 @@ -#version 150 - -#moj_import -#moj_import - -in vec3 Position; -in vec4 Color; -in vec2 UV0; -in ivec2 UV2; -in vec3 Normal; - -uniform sampler2D Sampler2; - -uniform mat4 ModelViewMat; -uniform mat4 ProjMat; -uniform vec3 ChunkOffset; -uniform int FogShape; - -out float vertexDistance; -out vec4 vertexColor; -out vec2 texCoord0; - -void main() { - vec3 pos = Position + ChunkOffset; - gl_Position = ProjMat * ModelViewMat * vec4(pos, 1.0); - - vertexDistance = fog_distance(pos, FogShape); - vertexColor = Color * minecraft_sample_lightmap(Sampler2, UV2); - texCoord0 = UV0; -} diff --git a/assets/minecraft/shaders/core/rendertype_cutout_mipped.fsh b/assets/minecraft/shaders/core/rendertype_cutout_mipped.fsh deleted file mode 100644 index cb63a69a..00000000 --- a/assets/minecraft/shaders/core/rendertype_cutout_mipped.fsh +++ /dev/null @@ -1,24 +0,0 @@ -#version 150 - -#moj_import - -uniform sampler2D Sampler0; - -uniform vec4 ColorModulator; -uniform float FogStart; -uniform float FogEnd; -uniform vec4 FogColor; - -in float vertexDistance; -in vec4 vertexColor; -in vec2 texCoord0; - -out vec4 fragColor; - -void main() { - vec4 color = texture(Sampler0, texCoord0) * vertexColor * ColorModulator; - if (color.a < 0.5) { - discard; - } - fragColor = linear_fog(color, vertexDistance, FogStart, FogEnd, FogColor); -} diff --git a/assets/minecraft/shaders/core/rendertype_cutout_mipped.json b/assets/minecraft/shaders/core/rendertype_cutout_mipped.json index 7698959a..31880fd5 100644 --- a/assets/minecraft/shaders/core/rendertype_cutout_mipped.json +++ b/assets/minecraft/shaders/core/rendertype_cutout_mipped.json @@ -1,6 +1,11 @@ { - "vertex": "rendertype_cutout_mipped", - "fragment": "rendertype_cutout_mipped", + "vertex": "minecraft:core/terrain", + "fragment": "minecraft:core/terrain", + "defines": { + "values": { + "ALPHA_CUTOUT": "0.5" + } + }, "samplers": [ { "name": "Sampler0" }, { "name": "Sampler2" } @@ -8,7 +13,7 @@ "uniforms": [ { "name": "ModelViewMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] }, { "name": "ProjMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] }, - { "name": "ChunkOffset", "type": "float", "count": 3, "values": [ 0.0, 0.0, 0.0 ] }, + { "name": "ModelOffset", "type": "float", "count": 3, "values": [ 0.0, 0.0, 0.0 ] }, { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] }, { "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] }, { "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] }, diff --git a/assets/minecraft/shaders/core/rendertype_end_gateway.json b/assets/minecraft/shaders/core/rendertype_end_gateway.json index dd4095d2..1ba8c97c 100644 --- a/assets/minecraft/shaders/core/rendertype_end_gateway.json +++ b/assets/minecraft/shaders/core/rendertype_end_gateway.json @@ -1,6 +1,6 @@ { - "vertex": "rendertype_end_portal", - "fragment": "rendertype_end_portal", + "vertex": "minecraft:core/rendertype_end_portal", + "fragment": "minecraft:core/rendertype_end_portal", "samplers": [ { "name": "Sampler0" }, { "name": "Sampler1" } diff --git a/assets/minecraft/shaders/core/rendertype_end_portal.fsh b/assets/minecraft/shaders/core/rendertype_end_portal.fsh index b6a400cd..46011dd2 100644 --- a/assets/minecraft/shaders/core/rendertype_end_portal.fsh +++ b/assets/minecraft/shaders/core/rendertype_end_portal.fsh @@ -1,6 +1,6 @@ #version 150 -#moj_import +#moj_import uniform sampler2D Sampler0; uniform sampler2D Sampler1; diff --git a/assets/minecraft/shaders/core/rendertype_end_portal.json b/assets/minecraft/shaders/core/rendertype_end_portal.json index c6687648..5f93d105 100644 --- a/assets/minecraft/shaders/core/rendertype_end_portal.json +++ b/assets/minecraft/shaders/core/rendertype_end_portal.json @@ -1,6 +1,6 @@ { - "vertex": "rendertype_end_portal", - "fragment": "rendertype_end_portal", + "vertex": "minecraft:core/rendertype_end_portal", + "fragment": "minecraft:core/rendertype_end_portal", "samplers": [ { "name": "Sampler0" }, { "name": "Sampler1" } diff --git a/assets/minecraft/shaders/core/rendertype_end_portal.vsh b/assets/minecraft/shaders/core/rendertype_end_portal.vsh index 1c094831..a31786cb 100644 --- a/assets/minecraft/shaders/core/rendertype_end_portal.vsh +++ b/assets/minecraft/shaders/core/rendertype_end_portal.vsh @@ -1,6 +1,6 @@ #version 150 -#moj_import +#moj_import in vec3 Position; diff --git a/assets/minecraft/shaders/core/rendertype_energy_swirl.fsh b/assets/minecraft/shaders/core/rendertype_energy_swirl.fsh deleted file mode 100644 index 89514fba..00000000 --- a/assets/minecraft/shaders/core/rendertype_energy_swirl.fsh +++ /dev/null @@ -1,23 +0,0 @@ -#version 150 - -#moj_import - -uniform sampler2D Sampler0; - -uniform vec4 ColorModulator; -uniform float FogStart; -uniform float FogEnd; - -in float vertexDistance; -in vec4 vertexColor; -in vec2 texCoord0; - -out vec4 fragColor; - -void main() { - vec4 color = texture(Sampler0, texCoord0) * vertexColor * ColorModulator; - if (color.a < 0.1) { - discard; - } - fragColor = color * linear_fog_fade(vertexDistance, FogStart, FogEnd); -} diff --git a/assets/minecraft/shaders/core/rendertype_energy_swirl.json b/assets/minecraft/shaders/core/rendertype_energy_swirl.json index 3696b6fe..f8ad7958 100644 --- a/assets/minecraft/shaders/core/rendertype_energy_swirl.json +++ b/assets/minecraft/shaders/core/rendertype_energy_swirl.json @@ -1,6 +1,17 @@ { - "vertex": "rendertype_energy_swirl", - "fragment": "rendertype_energy_swirl", + "vertex": "minecraft:core/entity", + "fragment": "minecraft:core/entity", + "defines": { + "values": { + "ALPHA_CUTOUT": "0.1" + }, + "flags": [ + "APPLY_TEXTURE_MATRIX", + "NO_CARDINAL_LIGHTING", + "NO_OVERLAY", + "EMISSIVE" + ] + }, "samplers": [ { "name": "Sampler0" } ], @@ -11,6 +22,7 @@ { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] }, { "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] }, { "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] }, + { "name": "FogColor", "type": "float", "count": 4, "values": [ 0.0, 0.0, 0.0, 0.0 ] }, { "name": "FogShape", "type": "int", "count": 1, "values": [ 0 ] } ] } diff --git a/assets/minecraft/shaders/core/rendertype_energy_swirl.vsh b/assets/minecraft/shaders/core/rendertype_energy_swirl.vsh deleted file mode 100644 index 23ddffdd..00000000 --- a/assets/minecraft/shaders/core/rendertype_energy_swirl.vsh +++ /dev/null @@ -1,24 +0,0 @@ -#version 150 - -#moj_import - -in vec3 Position; -in vec4 Color; -in vec2 UV0; - -uniform mat4 ModelViewMat; -uniform mat4 ProjMat; -uniform mat4 TextureMat; -uniform int FogShape; - -out float vertexDistance; -out vec4 vertexColor; -out vec2 texCoord0; - -void main() { - gl_Position = ProjMat * ModelViewMat * vec4(Position, 1.0); - - vertexDistance = fog_distance(Position, FogShape); - vertexColor = Color; - texCoord0 = (TextureMat * vec4(UV0, 0.0, 1.0)).xy; -} diff --git a/assets/minecraft/shaders/core/rendertype_entity_alpha.json b/assets/minecraft/shaders/core/rendertype_entity_alpha.json index 3e312576..b1d9f34f 100644 --- a/assets/minecraft/shaders/core/rendertype_entity_alpha.json +++ b/assets/minecraft/shaders/core/rendertype_entity_alpha.json @@ -1,6 +1,6 @@ { - "vertex": "rendertype_entity_alpha", - "fragment": "rendertype_entity_alpha", + "vertex": "minecraft:core/rendertype_entity_alpha", + "fragment": "minecraft:core/rendertype_entity_alpha", "samplers": [ { "name": "Sampler0" } ], diff --git a/assets/minecraft/shaders/core/rendertype_entity_cutout.json b/assets/minecraft/shaders/core/rendertype_entity_cutout.json index def64e8a..f1f459b6 100644 --- a/assets/minecraft/shaders/core/rendertype_entity_cutout.json +++ b/assets/minecraft/shaders/core/rendertype_entity_cutout.json @@ -1,6 +1,11 @@ { - "vertex": "rendertype_entity_cutout", - "fragment": "rendertype_entity_cutout", + "vertex": "minecraft:core/entity", + "fragment": "minecraft:core/entity", + "defines": { + "values": { + "ALPHA_CUTOUT": "0.1" + } + }, "samplers": [ { "name": "Sampler0" }, { "name": "Sampler1" }, diff --git a/assets/minecraft/shaders/core/rendertype_entity_cutout.vsh b/assets/minecraft/shaders/core/rendertype_entity_cutout.vsh deleted file mode 100644 index de8af38a..00000000 --- a/assets/minecraft/shaders/core/rendertype_entity_cutout.vsh +++ /dev/null @@ -1,37 +0,0 @@ -#version 150 - -#moj_import -#moj_import - -in vec3 Position; -in vec4 Color; -in vec2 UV0; -in ivec2 UV1; -in ivec2 UV2; -in vec3 Normal; - -uniform sampler2D Sampler1; -uniform sampler2D Sampler2; - -uniform mat4 ModelViewMat; -uniform mat4 ProjMat; -uniform int FogShape; - -uniform vec3 Light0_Direction; -uniform vec3 Light1_Direction; - -out float vertexDistance; -out vec4 vertexColor; -out vec4 lightMapColor; -out vec4 overlayColor; -out vec2 texCoord0; - -void main() { - gl_Position = ProjMat * ModelViewMat * vec4(Position, 1.0); - - vertexDistance = fog_distance(Position, FogShape); - vertexColor = minecraft_mix_light(Light0_Direction, Light1_Direction, Normal, Color); - lightMapColor = texelFetch(Sampler2, UV2 / 16, 0); - overlayColor = texelFetch(Sampler1, UV1, 0); - texCoord0 = UV0; -} diff --git a/assets/minecraft/shaders/core/rendertype_entity_cutout_no_cull.fsh b/assets/minecraft/shaders/core/rendertype_entity_cutout_no_cull.fsh deleted file mode 100644 index 82ee596b..00000000 --- a/assets/minecraft/shaders/core/rendertype_entity_cutout_no_cull.fsh +++ /dev/null @@ -1,29 +0,0 @@ -#version 150 - -#moj_import - -uniform sampler2D Sampler0; - -uniform vec4 ColorModulator; -uniform float FogStart; -uniform float FogEnd; -uniform vec4 FogColor; - -in float vertexDistance; -in vec4 vertexColor; -in vec4 lightMapColor; -in vec4 overlayColor; -in vec2 texCoord0; - -out vec4 fragColor; - -void main() { - vec4 color = texture(Sampler0, texCoord0); - if (color.a < 0.1) { - discard; - } - color *= vertexColor * ColorModulator; - color.rgb = mix(overlayColor.rgb, color.rgb, overlayColor.a); - color *= lightMapColor; - fragColor = linear_fog(color, vertexDistance, FogStart, FogEnd, FogColor); -} diff --git a/assets/minecraft/shaders/core/rendertype_entity_cutout_no_cull.json b/assets/minecraft/shaders/core/rendertype_entity_cutout_no_cull.json index 2c3ec23e..f1f459b6 100644 --- a/assets/minecraft/shaders/core/rendertype_entity_cutout_no_cull.json +++ b/assets/minecraft/shaders/core/rendertype_entity_cutout_no_cull.json @@ -1,6 +1,11 @@ { - "vertex": "rendertype_entity_cutout_no_cull", - "fragment": "rendertype_entity_cutout_no_cull", + "vertex": "minecraft:core/entity", + "fragment": "minecraft:core/entity", + "defines": { + "values": { + "ALPHA_CUTOUT": "0.1" + } + }, "samplers": [ { "name": "Sampler0" }, { "name": "Sampler1" }, diff --git a/assets/minecraft/shaders/core/rendertype_entity_cutout_no_cull.vsh b/assets/minecraft/shaders/core/rendertype_entity_cutout_no_cull.vsh deleted file mode 100644 index de8af38a..00000000 --- a/assets/minecraft/shaders/core/rendertype_entity_cutout_no_cull.vsh +++ /dev/null @@ -1,37 +0,0 @@ -#version 150 - -#moj_import -#moj_import - -in vec3 Position; -in vec4 Color; -in vec2 UV0; -in ivec2 UV1; -in ivec2 UV2; -in vec3 Normal; - -uniform sampler2D Sampler1; -uniform sampler2D Sampler2; - -uniform mat4 ModelViewMat; -uniform mat4 ProjMat; -uniform int FogShape; - -uniform vec3 Light0_Direction; -uniform vec3 Light1_Direction; - -out float vertexDistance; -out vec4 vertexColor; -out vec4 lightMapColor; -out vec4 overlayColor; -out vec2 texCoord0; - -void main() { - gl_Position = ProjMat * ModelViewMat * vec4(Position, 1.0); - - vertexDistance = fog_distance(Position, FogShape); - vertexColor = minecraft_mix_light(Light0_Direction, Light1_Direction, Normal, Color); - lightMapColor = texelFetch(Sampler2, UV2 / 16, 0); - overlayColor = texelFetch(Sampler1, UV1, 0); - texCoord0 = UV0; -} diff --git a/assets/minecraft/shaders/core/rendertype_entity_cutout_no_cull_z_offset.fsh b/assets/minecraft/shaders/core/rendertype_entity_cutout_no_cull_z_offset.fsh deleted file mode 100644 index 82ee596b..00000000 --- a/assets/minecraft/shaders/core/rendertype_entity_cutout_no_cull_z_offset.fsh +++ /dev/null @@ -1,29 +0,0 @@ -#version 150 - -#moj_import - -uniform sampler2D Sampler0; - -uniform vec4 ColorModulator; -uniform float FogStart; -uniform float FogEnd; -uniform vec4 FogColor; - -in float vertexDistance; -in vec4 vertexColor; -in vec4 lightMapColor; -in vec4 overlayColor; -in vec2 texCoord0; - -out vec4 fragColor; - -void main() { - vec4 color = texture(Sampler0, texCoord0); - if (color.a < 0.1) { - discard; - } - color *= vertexColor * ColorModulator; - color.rgb = mix(overlayColor.rgb, color.rgb, overlayColor.a); - color *= lightMapColor; - fragColor = linear_fog(color, vertexDistance, FogStart, FogEnd, FogColor); -} diff --git a/assets/minecraft/shaders/core/rendertype_entity_cutout_no_cull_z_offset.json b/assets/minecraft/shaders/core/rendertype_entity_cutout_no_cull_z_offset.json index a2129c2c..f1f459b6 100644 --- a/assets/minecraft/shaders/core/rendertype_entity_cutout_no_cull_z_offset.json +++ b/assets/minecraft/shaders/core/rendertype_entity_cutout_no_cull_z_offset.json @@ -1,6 +1,11 @@ { - "vertex": "rendertype_entity_cutout_no_cull_z_offset", - "fragment": "rendertype_entity_cutout_no_cull_z_offset", + "vertex": "minecraft:core/entity", + "fragment": "minecraft:core/entity", + "defines": { + "values": { + "ALPHA_CUTOUT": "0.1" + } + }, "samplers": [ { "name": "Sampler0" }, { "name": "Sampler1" }, diff --git a/assets/minecraft/shaders/core/rendertype_entity_decal.fsh b/assets/minecraft/shaders/core/rendertype_entity_decal.fsh index 9b6022b9..d1d0929e 100644 --- a/assets/minecraft/shaders/core/rendertype_entity_decal.fsh +++ b/assets/minecraft/shaders/core/rendertype_entity_decal.fsh @@ -1,6 +1,6 @@ #version 150 -#moj_import +#moj_import uniform sampler2D Sampler0; diff --git a/assets/minecraft/shaders/core/rendertype_entity_decal.json b/assets/minecraft/shaders/core/rendertype_entity_decal.json index d3b01a99..eeac88a0 100644 --- a/assets/minecraft/shaders/core/rendertype_entity_decal.json +++ b/assets/minecraft/shaders/core/rendertype_entity_decal.json @@ -1,6 +1,6 @@ { - "vertex": "rendertype_entity_decal", - "fragment": "rendertype_entity_decal", + "vertex": "minecraft:core/rendertype_entity_decal", + "fragment": "minecraft:core/rendertype_entity_decal", "samplers": [ { "name": "Sampler0" }, { "name": "Sampler1" }, diff --git a/assets/minecraft/shaders/core/rendertype_entity_decal.vsh b/assets/minecraft/shaders/core/rendertype_entity_decal.vsh index 9c7e6e9d..a20e6611 100644 --- a/assets/minecraft/shaders/core/rendertype_entity_decal.vsh +++ b/assets/minecraft/shaders/core/rendertype_entity_decal.vsh @@ -1,7 +1,7 @@ #version 150 -#moj_import -#moj_import +#moj_import +#moj_import in vec3 Position; in vec4 Color; diff --git a/assets/minecraft/shaders/core/rendertype_entity_glint.json b/assets/minecraft/shaders/core/rendertype_entity_glint.json index 0e5ad710..c560c554 100644 --- a/assets/minecraft/shaders/core/rendertype_entity_glint.json +++ b/assets/minecraft/shaders/core/rendertype_entity_glint.json @@ -1,6 +1,6 @@ { - "vertex": "rendertype_entity_glint", - "fragment": "rendertype_entity_glint", + "vertex": "minecraft:core/glint", + "fragment": "minecraft:core/glint", "samplers": [ { "name": "Sampler0" } ], diff --git a/assets/minecraft/shaders/core/rendertype_entity_glint.vsh b/assets/minecraft/shaders/core/rendertype_entity_glint.vsh deleted file mode 100644 index f123a0e1..00000000 --- a/assets/minecraft/shaders/core/rendertype_entity_glint.vsh +++ /dev/null @@ -1,21 +0,0 @@ -#version 150 - -#moj_import - -in vec3 Position; -in vec2 UV0; - -uniform mat4 ModelViewMat; -uniform mat4 ProjMat; -uniform mat4 TextureMat; -uniform int FogShape; - -out float vertexDistance; -out vec2 texCoord0; - -void main() { - gl_Position = ProjMat * ModelViewMat * vec4(Position, 1.0); - - vertexDistance = fog_distance(Position, FogShape); - texCoord0 = (TextureMat * vec4(UV0, 0.0, 1.0)).xy; -} diff --git a/assets/minecraft/shaders/core/rendertype_entity_glint_direct.fsh b/assets/minecraft/shaders/core/rendertype_entity_glint_direct.fsh deleted file mode 100644 index 9bcfd7db..00000000 --- a/assets/minecraft/shaders/core/rendertype_entity_glint_direct.fsh +++ /dev/null @@ -1,24 +0,0 @@ -#version 150 - -#moj_import - -uniform sampler2D Sampler0; - -uniform vec4 ColorModulator; -uniform float FogStart; -uniform float FogEnd; -uniform float GlintAlpha; - -in float vertexDistance; -in vec2 texCoord0; - -out vec4 fragColor; - -void main() { - vec4 color = texture(Sampler0, texCoord0) * ColorModulator; - if (color.a < 0.1) { - discard; - } - float fade = linear_fog_fade(vertexDistance, FogStart, FogEnd) * GlintAlpha; - fragColor = vec4(color.rgb * fade, color.a); -} diff --git a/assets/minecraft/shaders/core/rendertype_entity_glint_direct.json b/assets/minecraft/shaders/core/rendertype_entity_glint_direct.json deleted file mode 100644 index 1f4d484a..00000000 --- a/assets/minecraft/shaders/core/rendertype_entity_glint_direct.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "vertex": "rendertype_entity_glint_direct", - "fragment": "rendertype_entity_glint_direct", - "samplers": [ - { "name": "Sampler0" } - ], - "uniforms": [ - { "name": "ModelViewMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] }, - { "name": "ProjMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] }, - { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] }, - { "name": "GlintAlpha", "type": "float", "count": 1, "values": [ 1.0 ] }, - { "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] }, - { "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] }, - { "name": "FogShape", "type": "int", "count": 1, "values": [ 0 ] }, - { "name": "TextureMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] } - ] -} diff --git a/assets/minecraft/shaders/core/rendertype_entity_glint_direct.vsh b/assets/minecraft/shaders/core/rendertype_entity_glint_direct.vsh deleted file mode 100644 index f123a0e1..00000000 --- a/assets/minecraft/shaders/core/rendertype_entity_glint_direct.vsh +++ /dev/null @@ -1,21 +0,0 @@ -#version 150 - -#moj_import - -in vec3 Position; -in vec2 UV0; - -uniform mat4 ModelViewMat; -uniform mat4 ProjMat; -uniform mat4 TextureMat; -uniform int FogShape; - -out float vertexDistance; -out vec2 texCoord0; - -void main() { - gl_Position = ProjMat * ModelViewMat * vec4(Position, 1.0); - - vertexDistance = fog_distance(Position, FogShape); - texCoord0 = (TextureMat * vec4(UV0, 0.0, 1.0)).xy; -} diff --git a/assets/minecraft/shaders/core/rendertype_entity_no_outline.fsh b/assets/minecraft/shaders/core/rendertype_entity_no_outline.fsh deleted file mode 100644 index 851068d0..00000000 --- a/assets/minecraft/shaders/core/rendertype_entity_no_outline.fsh +++ /dev/null @@ -1,21 +0,0 @@ -#version 150 - -#moj_import - -uniform sampler2D Sampler0; - -uniform vec4 ColorModulator; -uniform float FogStart; -uniform float FogEnd; -uniform vec4 FogColor; - -in float vertexDistance; -in vec4 vertexColor; -in vec2 texCoord0; - -out vec4 fragColor; - -void main() { - vec4 color = texture(Sampler0, texCoord0) * vertexColor * ColorModulator; - fragColor = linear_fog(color, vertexDistance, FogStart, FogEnd, FogColor); -} diff --git a/assets/minecraft/shaders/core/rendertype_entity_no_outline.json b/assets/minecraft/shaders/core/rendertype_entity_no_outline.json index b9267dde..0598bc5b 100644 --- a/assets/minecraft/shaders/core/rendertype_entity_no_outline.json +++ b/assets/minecraft/shaders/core/rendertype_entity_no_outline.json @@ -1,6 +1,11 @@ { - "vertex": "rendertype_entity_no_outline", - "fragment": "rendertype_entity_no_outline", + "vertex": "minecraft:core/entity", + "fragment": "minecraft:core/entity", + "defines": { + "flags": [ + "NO_OVERLAY" + ] + }, "samplers": [ { "name": "Sampler0" }, { "name": "Sampler2" } diff --git a/assets/minecraft/shaders/core/rendertype_entity_no_outline.vsh b/assets/minecraft/shaders/core/rendertype_entity_no_outline.vsh deleted file mode 100644 index c65e7764..00000000 --- a/assets/minecraft/shaders/core/rendertype_entity_no_outline.vsh +++ /dev/null @@ -1,31 +0,0 @@ -#version 150 - -#moj_import -#moj_import - -in vec3 Position; -in vec4 Color; -in vec2 UV0; -in ivec2 UV2; -in vec3 Normal; - -uniform sampler2D Sampler2; - -uniform mat4 ModelViewMat; -uniform mat4 ProjMat; -uniform int FogShape; - -uniform vec3 Light0_Direction; -uniform vec3 Light1_Direction; - -out float vertexDistance; -out vec4 vertexColor; -out vec2 texCoord0; - -void main() { - gl_Position = ProjMat * ModelViewMat * vec4(Position, 1.0); - - vertexDistance = fog_distance(Position, FogShape); - vertexColor = minecraft_mix_light(Light0_Direction, Light1_Direction, Normal, Color) * texelFetch(Sampler2, UV2 / 16, 0); - texCoord0 = UV0; -} diff --git a/assets/minecraft/shaders/core/rendertype_entity_shadow.fsh b/assets/minecraft/shaders/core/rendertype_entity_shadow.fsh index 3d3dd998..9ee628f5 100644 --- a/assets/minecraft/shaders/core/rendertype_entity_shadow.fsh +++ b/assets/minecraft/shaders/core/rendertype_entity_shadow.fsh @@ -1,6 +1,6 @@ #version 150 -#moj_import +#moj_import uniform sampler2D Sampler0; diff --git a/assets/minecraft/shaders/core/rendertype_entity_shadow.json b/assets/minecraft/shaders/core/rendertype_entity_shadow.json index 49dd839d..b9960d06 100644 --- a/assets/minecraft/shaders/core/rendertype_entity_shadow.json +++ b/assets/minecraft/shaders/core/rendertype_entity_shadow.json @@ -1,6 +1,6 @@ { - "vertex": "rendertype_entity_shadow", - "fragment": "rendertype_entity_shadow", + "vertex": "minecraft:core/rendertype_entity_shadow", + "fragment": "minecraft:core/rendertype_entity_shadow", "samplers": [ { "name": "Sampler0" } ], diff --git a/assets/minecraft/shaders/core/rendertype_entity_shadow.vsh b/assets/minecraft/shaders/core/rendertype_entity_shadow.vsh index f5103b4c..d88ec239 100644 --- a/assets/minecraft/shaders/core/rendertype_entity_shadow.vsh +++ b/assets/minecraft/shaders/core/rendertype_entity_shadow.vsh @@ -1,6 +1,6 @@ #version 150 -#moj_import +#moj_import in vec3 Position; in vec4 Color; diff --git a/assets/minecraft/shaders/core/rendertype_entity_smooth_cutout.fsh b/assets/minecraft/shaders/core/rendertype_entity_smooth_cutout.fsh deleted file mode 100644 index 82ee596b..00000000 --- a/assets/minecraft/shaders/core/rendertype_entity_smooth_cutout.fsh +++ /dev/null @@ -1,29 +0,0 @@ -#version 150 - -#moj_import - -uniform sampler2D Sampler0; - -uniform vec4 ColorModulator; -uniform float FogStart; -uniform float FogEnd; -uniform vec4 FogColor; - -in float vertexDistance; -in vec4 vertexColor; -in vec4 lightMapColor; -in vec4 overlayColor; -in vec2 texCoord0; - -out vec4 fragColor; - -void main() { - vec4 color = texture(Sampler0, texCoord0); - if (color.a < 0.1) { - discard; - } - color *= vertexColor * ColorModulator; - color.rgb = mix(overlayColor.rgb, color.rgb, overlayColor.a); - color *= lightMapColor; - fragColor = linear_fog(color, vertexDistance, FogStart, FogEnd, FogColor); -} diff --git a/assets/minecraft/shaders/core/rendertype_entity_smooth_cutout.json b/assets/minecraft/shaders/core/rendertype_entity_smooth_cutout.json index 016e8c14..f1f459b6 100644 --- a/assets/minecraft/shaders/core/rendertype_entity_smooth_cutout.json +++ b/assets/minecraft/shaders/core/rendertype_entity_smooth_cutout.json @@ -1,6 +1,11 @@ { - "vertex": "rendertype_entity_smooth_cutout", - "fragment": "rendertype_entity_smooth_cutout", + "vertex": "minecraft:core/entity", + "fragment": "minecraft:core/entity", + "defines": { + "values": { + "ALPHA_CUTOUT": "0.1" + } + }, "samplers": [ { "name": "Sampler0" }, { "name": "Sampler1" }, diff --git a/assets/minecraft/shaders/core/rendertype_entity_smooth_cutout.vsh b/assets/minecraft/shaders/core/rendertype_entity_smooth_cutout.vsh deleted file mode 100644 index de8af38a..00000000 --- a/assets/minecraft/shaders/core/rendertype_entity_smooth_cutout.vsh +++ /dev/null @@ -1,37 +0,0 @@ -#version 150 - -#moj_import -#moj_import - -in vec3 Position; -in vec4 Color; -in vec2 UV0; -in ivec2 UV1; -in ivec2 UV2; -in vec3 Normal; - -uniform sampler2D Sampler1; -uniform sampler2D Sampler2; - -uniform mat4 ModelViewMat; -uniform mat4 ProjMat; -uniform int FogShape; - -uniform vec3 Light0_Direction; -uniform vec3 Light1_Direction; - -out float vertexDistance; -out vec4 vertexColor; -out vec4 lightMapColor; -out vec4 overlayColor; -out vec2 texCoord0; - -void main() { - gl_Position = ProjMat * ModelViewMat * vec4(Position, 1.0); - - vertexDistance = fog_distance(Position, FogShape); - vertexColor = minecraft_mix_light(Light0_Direction, Light1_Direction, Normal, Color); - lightMapColor = texelFetch(Sampler2, UV2 / 16, 0); - overlayColor = texelFetch(Sampler1, UV1, 0); - texCoord0 = UV0; -} diff --git a/assets/minecraft/shaders/core/rendertype_entity_solid.fsh b/assets/minecraft/shaders/core/rendertype_entity_solid.fsh deleted file mode 100644 index ff8974fc..00000000 --- a/assets/minecraft/shaders/core/rendertype_entity_solid.fsh +++ /dev/null @@ -1,25 +0,0 @@ -#version 150 - -#moj_import - -uniform sampler2D Sampler0; - -uniform vec4 ColorModulator; -uniform float FogStart; -uniform float FogEnd; -uniform vec4 FogColor; - -in float vertexDistance; -in vec4 vertexColor; -in vec4 lightMapColor; -in vec4 overlayColor; -in vec2 texCoord0; - -out vec4 fragColor; - -void main() { - vec4 color = texture(Sampler0, texCoord0) * vertexColor * ColorModulator; - color.rgb = mix(overlayColor.rgb, color.rgb, overlayColor.a); - color *= lightMapColor; - fragColor = linear_fog(color, vertexDistance, FogStart, FogEnd, FogColor); -} diff --git a/assets/minecraft/shaders/core/rendertype_entity_solid.json b/assets/minecraft/shaders/core/rendertype_entity_solid.json index 244b7a04..45bbeb78 100644 --- a/assets/minecraft/shaders/core/rendertype_entity_solid.json +++ b/assets/minecraft/shaders/core/rendertype_entity_solid.json @@ -1,6 +1,6 @@ { - "vertex": "rendertype_entity_solid", - "fragment": "rendertype_entity_solid", + "vertex": "minecraft:core/entity", + "fragment": "minecraft:core/entity", "samplers": [ { "name": "Sampler0" }, { "name": "Sampler1" }, diff --git a/assets/minecraft/shaders/core/rendertype_entity_solid.vsh b/assets/minecraft/shaders/core/rendertype_entity_solid.vsh deleted file mode 100644 index de8af38a..00000000 --- a/assets/minecraft/shaders/core/rendertype_entity_solid.vsh +++ /dev/null @@ -1,37 +0,0 @@ -#version 150 - -#moj_import -#moj_import - -in vec3 Position; -in vec4 Color; -in vec2 UV0; -in ivec2 UV1; -in ivec2 UV2; -in vec3 Normal; - -uniform sampler2D Sampler1; -uniform sampler2D Sampler2; - -uniform mat4 ModelViewMat; -uniform mat4 ProjMat; -uniform int FogShape; - -uniform vec3 Light0_Direction; -uniform vec3 Light1_Direction; - -out float vertexDistance; -out vec4 vertexColor; -out vec4 lightMapColor; -out vec4 overlayColor; -out vec2 texCoord0; - -void main() { - gl_Position = ProjMat * ModelViewMat * vec4(Position, 1.0); - - vertexDistance = fog_distance(Position, FogShape); - vertexColor = minecraft_mix_light(Light0_Direction, Light1_Direction, Normal, Color); - lightMapColor = texelFetch(Sampler2, UV2 / 16, 0); - overlayColor = texelFetch(Sampler1, UV1, 0); - texCoord0 = UV0; -} diff --git a/assets/minecraft/shaders/core/rendertype_entity_translucent.fsh b/assets/minecraft/shaders/core/rendertype_entity_translucent.fsh deleted file mode 100644 index 82ee596b..00000000 --- a/assets/minecraft/shaders/core/rendertype_entity_translucent.fsh +++ /dev/null @@ -1,29 +0,0 @@ -#version 150 - -#moj_import - -uniform sampler2D Sampler0; - -uniform vec4 ColorModulator; -uniform float FogStart; -uniform float FogEnd; -uniform vec4 FogColor; - -in float vertexDistance; -in vec4 vertexColor; -in vec4 lightMapColor; -in vec4 overlayColor; -in vec2 texCoord0; - -out vec4 fragColor; - -void main() { - vec4 color = texture(Sampler0, texCoord0); - if (color.a < 0.1) { - discard; - } - color *= vertexColor * ColorModulator; - color.rgb = mix(overlayColor.rgb, color.rgb, overlayColor.a); - color *= lightMapColor; - fragColor = linear_fog(color, vertexDistance, FogStart, FogEnd, FogColor); -} diff --git a/assets/minecraft/shaders/core/rendertype_entity_translucent.json b/assets/minecraft/shaders/core/rendertype_entity_translucent.json index cf4ed96a..f1f459b6 100644 --- a/assets/minecraft/shaders/core/rendertype_entity_translucent.json +++ b/assets/minecraft/shaders/core/rendertype_entity_translucent.json @@ -1,6 +1,11 @@ { - "vertex": "rendertype_entity_translucent", - "fragment": "rendertype_entity_translucent", + "vertex": "minecraft:core/entity", + "fragment": "minecraft:core/entity", + "defines": { + "values": { + "ALPHA_CUTOUT": "0.1" + } + }, "samplers": [ { "name": "Sampler0" }, { "name": "Sampler1" }, diff --git a/assets/minecraft/shaders/core/rendertype_entity_translucent.vsh b/assets/minecraft/shaders/core/rendertype_entity_translucent.vsh deleted file mode 100644 index de8af38a..00000000 --- a/assets/minecraft/shaders/core/rendertype_entity_translucent.vsh +++ /dev/null @@ -1,37 +0,0 @@ -#version 150 - -#moj_import -#moj_import - -in vec3 Position; -in vec4 Color; -in vec2 UV0; -in ivec2 UV1; -in ivec2 UV2; -in vec3 Normal; - -uniform sampler2D Sampler1; -uniform sampler2D Sampler2; - -uniform mat4 ModelViewMat; -uniform mat4 ProjMat; -uniform int FogShape; - -uniform vec3 Light0_Direction; -uniform vec3 Light1_Direction; - -out float vertexDistance; -out vec4 vertexColor; -out vec4 lightMapColor; -out vec4 overlayColor; -out vec2 texCoord0; - -void main() { - gl_Position = ProjMat * ModelViewMat * vec4(Position, 1.0); - - vertexDistance = fog_distance(Position, FogShape); - vertexColor = minecraft_mix_light(Light0_Direction, Light1_Direction, Normal, Color); - lightMapColor = texelFetch(Sampler2, UV2 / 16, 0); - overlayColor = texelFetch(Sampler1, UV1, 0); - texCoord0 = UV0; -} diff --git a/assets/minecraft/shaders/core/rendertype_entity_translucent_cull.fsh b/assets/minecraft/shaders/core/rendertype_entity_translucent_cull.fsh deleted file mode 100644 index 232a61df..00000000 --- a/assets/minecraft/shaders/core/rendertype_entity_translucent_cull.fsh +++ /dev/null @@ -1,25 +0,0 @@ -#version 150 - -#moj_import - -uniform sampler2D Sampler0; - -uniform vec4 ColorModulator; -uniform float FogStart; -uniform float FogEnd; -uniform vec4 FogColor; - -in float vertexDistance; -in vec4 vertexColor; -in vec2 texCoord0; -in vec2 texCoord1; - -out vec4 fragColor; - -void main() { - vec4 color = texture(Sampler0, texCoord0) * vertexColor * ColorModulator; - if (color.a < 0.1) { - discard; - } - fragColor = linear_fog(color, vertexDistance, FogStart, FogEnd, FogColor); -} diff --git a/assets/minecraft/shaders/core/rendertype_entity_translucent_cull.vsh b/assets/minecraft/shaders/core/rendertype_entity_translucent_cull.vsh deleted file mode 100644 index a2c9595e..00000000 --- a/assets/minecraft/shaders/core/rendertype_entity_translucent_cull.vsh +++ /dev/null @@ -1,36 +0,0 @@ -#version 150 - -#moj_import -#moj_import - -in vec3 Position; -in vec4 Color; -in vec2 UV0; -in vec2 UV1; -in ivec2 UV2; -in vec3 Normal; - -uniform sampler2D Sampler2; - -uniform mat4 ModelViewMat; -uniform mat4 ProjMat; -uniform int FogShape; - -uniform vec3 Light0_Direction; -uniform vec3 Light1_Direction; - -out float vertexDistance; -out vec4 vertexColor; -out vec2 texCoord0; -out vec2 texCoord1; -out vec2 texCoord2; - -void main() { - gl_Position = ProjMat * ModelViewMat * vec4(Position, 1.0); - - vertexDistance = fog_distance(Position, FogShape); - vertexColor = minecraft_mix_light(Light0_Direction, Light1_Direction, Normal, Color) * texelFetch(Sampler2, UV2 / 16, 0); - texCoord0 = UV0; - texCoord1 = UV1; - texCoord2 = UV2; -} diff --git a/assets/minecraft/shaders/core/rendertype_entity_translucent_emissive.fsh b/assets/minecraft/shaders/core/rendertype_entity_translucent_emissive.fsh deleted file mode 100644 index b624e4bf..00000000 --- a/assets/minecraft/shaders/core/rendertype_entity_translucent_emissive.fsh +++ /dev/null @@ -1,26 +0,0 @@ -#version 150 - -#moj_import - -uniform sampler2D Sampler0; - -uniform vec4 ColorModulator; -uniform float FogStart; -uniform float FogEnd; - -in float vertexDistance; -in vec4 vertexColor; -in vec4 overlayColor; -in vec2 texCoord0; - -out vec4 fragColor; - -void main() { - vec4 color = texture(Sampler0, texCoord0); - if (color.a < 0.1) { - discard; - } - color *= vertexColor * ColorModulator; - color.rgb = mix(overlayColor.rgb, color.rgb, overlayColor.a); - fragColor = color * linear_fog_fade(vertexDistance, FogStart, FogEnd); -} diff --git a/assets/minecraft/shaders/core/rendertype_entity_translucent_emissive.json b/assets/minecraft/shaders/core/rendertype_entity_translucent_emissive.json index 84e7f320..4e6bf9f0 100644 --- a/assets/minecraft/shaders/core/rendertype_entity_translucent_emissive.json +++ b/assets/minecraft/shaders/core/rendertype_entity_translucent_emissive.json @@ -1,6 +1,14 @@ { - "vertex": "rendertype_entity_translucent_emissive", - "fragment": "rendertype_entity_translucent_emissive", + "vertex": "minecraft:core/entity", + "fragment": "minecraft:core/entity", + "defines": { + "values": { + "ALPHA_CUTOUT": "0.1" + }, + "flags": [ + "EMISSIVE" + ] + }, "samplers": [ { "name": "Sampler0" }, { "name": "Sampler1" }, @@ -13,6 +21,8 @@ { "name": "Light0_Direction", "type": "float", "count": 3, "values": [0.0, 0.0, 0.0] }, { "name": "Light1_Direction", "type": "float", "count": 3, "values": [0.0, 0.0, 0.0] }, { "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] }, - { "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] } + { "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] }, + { "name": "FogColor", "type": "float", "count": 4, "values": [ 0.0, 0.0, 0.0, 0.0 ] }, + { "name": "FogShape", "type": "int", "count": 1, "values": [ 0 ] } ] } diff --git a/assets/minecraft/shaders/core/rendertype_entity_translucent_emissive.vsh b/assets/minecraft/shaders/core/rendertype_entity_translucent_emissive.vsh deleted file mode 100644 index c1c4fb6a..00000000 --- a/assets/minecraft/shaders/core/rendertype_entity_translucent_emissive.vsh +++ /dev/null @@ -1,33 +0,0 @@ -#version 150 - -#moj_import - -in vec3 Position; -in vec4 Color; -in vec2 UV0; -in ivec2 UV1; -in ivec2 UV2; -in vec3 Normal; - -uniform sampler2D Sampler1; -uniform sampler2D Sampler2; - -uniform mat4 ModelViewMat; -uniform mat4 ProjMat; - -uniform vec3 Light0_Direction; -uniform vec3 Light1_Direction; - -out float vertexDistance; -out vec4 vertexColor; -out vec4 overlayColor; -out vec2 texCoord0; - -void main() { - gl_Position = ProjMat * ModelViewMat * vec4(Position, 1.0); - - vertexDistance = length((ModelViewMat * vec4(Position, 1.0)).xyz); - vertexColor = minecraft_mix_light(Light0_Direction, Light1_Direction, Normal, Color); - overlayColor = texelFetch(Sampler1, UV1, 0); - texCoord0 = UV0; -} diff --git a/assets/minecraft/shaders/core/rendertype_eyes.fsh b/assets/minecraft/shaders/core/rendertype_eyes.fsh deleted file mode 100644 index cde91df5..00000000 --- a/assets/minecraft/shaders/core/rendertype_eyes.fsh +++ /dev/null @@ -1,20 +0,0 @@ -#version 150 - -#moj_import - -uniform sampler2D Sampler0; - -uniform vec4 ColorModulator; -uniform float FogStart; -uniform float FogEnd; - -in float vertexDistance; -in vec4 vertexColor; -in vec2 texCoord0; - -out vec4 fragColor; - -void main() { - vec4 color = texture(Sampler0, texCoord0) * vertexColor; - fragColor = color * ColorModulator * linear_fog_fade(vertexDistance, FogStart, FogEnd); -} diff --git a/assets/minecraft/shaders/core/rendertype_eyes.json b/assets/minecraft/shaders/core/rendertype_eyes.json index 48dad45e..3af08632 100644 --- a/assets/minecraft/shaders/core/rendertype_eyes.json +++ b/assets/minecraft/shaders/core/rendertype_eyes.json @@ -1,6 +1,13 @@ { - "vertex": "rendertype_eyes", - "fragment": "rendertype_eyes", + "vertex": "minecraft:core/entity", + "fragment": "minecraft:core/entity", + "defines": { + "flags": [ + "EMISSIVE", + "NO_OVERLAY", + "NO_CARDINAL_LIGHTING" + ] + }, "samplers": [ { "name": "Sampler0" } ], @@ -10,6 +17,7 @@ { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] }, { "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] }, { "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] }, + { "name": "FogColor", "type": "float", "count": 4, "values": [ 0.0, 0.0, 0.0, 0.0 ] }, { "name": "FogShape", "type": "int", "count": 1, "values": [ 0 ] } ] } diff --git a/assets/minecraft/shaders/core/rendertype_eyes.vsh b/assets/minecraft/shaders/core/rendertype_eyes.vsh deleted file mode 100644 index f5103b4c..00000000 --- a/assets/minecraft/shaders/core/rendertype_eyes.vsh +++ /dev/null @@ -1,23 +0,0 @@ -#version 150 - -#moj_import - -in vec3 Position; -in vec4 Color; -in vec2 UV0; - -uniform mat4 ModelViewMat; -uniform mat4 ProjMat; -uniform int FogShape; - -out float vertexDistance; -out vec4 vertexColor; -out vec2 texCoord0; - -void main() { - gl_Position = ProjMat * ModelViewMat * vec4(Position, 1.0); - - vertexDistance = fog_distance(Position, FogShape); - vertexColor = Color; - texCoord0 = UV0; -} diff --git a/assets/minecraft/shaders/core/rendertype_glint.fsh b/assets/minecraft/shaders/core/rendertype_glint.fsh deleted file mode 100644 index 9bcfd7db..00000000 --- a/assets/minecraft/shaders/core/rendertype_glint.fsh +++ /dev/null @@ -1,24 +0,0 @@ -#version 150 - -#moj_import - -uniform sampler2D Sampler0; - -uniform vec4 ColorModulator; -uniform float FogStart; -uniform float FogEnd; -uniform float GlintAlpha; - -in float vertexDistance; -in vec2 texCoord0; - -out vec4 fragColor; - -void main() { - vec4 color = texture(Sampler0, texCoord0) * ColorModulator; - if (color.a < 0.1) { - discard; - } - float fade = linear_fog_fade(vertexDistance, FogStart, FogEnd) * GlintAlpha; - fragColor = vec4(color.rgb * fade, color.a); -} diff --git a/assets/minecraft/shaders/core/rendertype_glint.json b/assets/minecraft/shaders/core/rendertype_glint.json index 8af35330..c560c554 100644 --- a/assets/minecraft/shaders/core/rendertype_glint.json +++ b/assets/minecraft/shaders/core/rendertype_glint.json @@ -1,6 +1,6 @@ { - "vertex": "rendertype_glint", - "fragment": "rendertype_glint", + "vertex": "minecraft:core/glint", + "fragment": "minecraft:core/glint", "samplers": [ { "name": "Sampler0" } ], diff --git a/assets/minecraft/shaders/core/rendertype_glint.vsh b/assets/minecraft/shaders/core/rendertype_glint.vsh deleted file mode 100644 index f123a0e1..00000000 --- a/assets/minecraft/shaders/core/rendertype_glint.vsh +++ /dev/null @@ -1,21 +0,0 @@ -#version 150 - -#moj_import - -in vec3 Position; -in vec2 UV0; - -uniform mat4 ModelViewMat; -uniform mat4 ProjMat; -uniform mat4 TextureMat; -uniform int FogShape; - -out float vertexDistance; -out vec2 texCoord0; - -void main() { - gl_Position = ProjMat * ModelViewMat * vec4(Position, 1.0); - - vertexDistance = fog_distance(Position, FogShape); - texCoord0 = (TextureMat * vec4(UV0, 0.0, 1.0)).xy; -} diff --git a/assets/minecraft/shaders/core/rendertype_glint_translucent.fsh b/assets/minecraft/shaders/core/rendertype_glint_translucent.fsh deleted file mode 100644 index 9bcfd7db..00000000 --- a/assets/minecraft/shaders/core/rendertype_glint_translucent.fsh +++ /dev/null @@ -1,24 +0,0 @@ -#version 150 - -#moj_import - -uniform sampler2D Sampler0; - -uniform vec4 ColorModulator; -uniform float FogStart; -uniform float FogEnd; -uniform float GlintAlpha; - -in float vertexDistance; -in vec2 texCoord0; - -out vec4 fragColor; - -void main() { - vec4 color = texture(Sampler0, texCoord0) * ColorModulator; - if (color.a < 0.1) { - discard; - } - float fade = linear_fog_fade(vertexDistance, FogStart, FogEnd) * GlintAlpha; - fragColor = vec4(color.rgb * fade, color.a); -} diff --git a/assets/minecraft/shaders/core/rendertype_glint_translucent.json b/assets/minecraft/shaders/core/rendertype_glint_translucent.json index d0a7147e..c560c554 100644 --- a/assets/minecraft/shaders/core/rendertype_glint_translucent.json +++ b/assets/minecraft/shaders/core/rendertype_glint_translucent.json @@ -1,6 +1,6 @@ { - "vertex": "rendertype_glint_translucent", - "fragment": "rendertype_glint_translucent", + "vertex": "minecraft:core/glint", + "fragment": "minecraft:core/glint", "samplers": [ { "name": "Sampler0" } ], diff --git a/assets/minecraft/shaders/core/rendertype_glint_translucent.vsh b/assets/minecraft/shaders/core/rendertype_glint_translucent.vsh deleted file mode 100644 index f123a0e1..00000000 --- a/assets/minecraft/shaders/core/rendertype_glint_translucent.vsh +++ /dev/null @@ -1,21 +0,0 @@ -#version 150 - -#moj_import - -in vec3 Position; -in vec2 UV0; - -uniform mat4 ModelViewMat; -uniform mat4 ProjMat; -uniform mat4 TextureMat; -uniform int FogShape; - -out float vertexDistance; -out vec2 texCoord0; - -void main() { - gl_Position = ProjMat * ModelViewMat * vec4(Position, 1.0); - - vertexDistance = fog_distance(Position, FogShape); - texCoord0 = (TextureMat * vec4(UV0, 0.0, 1.0)).xy; -} diff --git a/assets/minecraft/shaders/core/rendertype_gui.json b/assets/minecraft/shaders/core/rendertype_gui.json index bc550e8f..29060a48 100644 --- a/assets/minecraft/shaders/core/rendertype_gui.json +++ b/assets/minecraft/shaders/core/rendertype_gui.json @@ -1,6 +1,6 @@ { - "vertex": "rendertype_gui", - "fragment": "rendertype_gui", + "vertex": "minecraft:core/gui", + "fragment": "minecraft:core/gui", "samplers": [ ], "uniforms": [ diff --git a/assets/minecraft/shaders/core/rendertype_gui_ghost_recipe_overlay.fsh b/assets/minecraft/shaders/core/rendertype_gui_ghost_recipe_overlay.fsh deleted file mode 100644 index d7da70e8..00000000 --- a/assets/minecraft/shaders/core/rendertype_gui_ghost_recipe_overlay.fsh +++ /dev/null @@ -1,15 +0,0 @@ -#version 150 - -in vec4 vertexColor; - -uniform vec4 ColorModulator; - -out vec4 fragColor; - -void main() { - vec4 color = vertexColor; - if (color.a == 0.0) { - discard; - } - fragColor = color * ColorModulator; -} diff --git a/assets/minecraft/shaders/core/rendertype_gui_ghost_recipe_overlay.json b/assets/minecraft/shaders/core/rendertype_gui_ghost_recipe_overlay.json index 9a1d76e5..29060a48 100644 --- a/assets/minecraft/shaders/core/rendertype_gui_ghost_recipe_overlay.json +++ b/assets/minecraft/shaders/core/rendertype_gui_ghost_recipe_overlay.json @@ -1,6 +1,6 @@ { - "vertex": "rendertype_gui_ghost_recipe_overlay", - "fragment": "rendertype_gui_ghost_recipe_overlay", + "vertex": "minecraft:core/gui", + "fragment": "minecraft:core/gui", "samplers": [ ], "uniforms": [ diff --git a/assets/minecraft/shaders/core/rendertype_gui_ghost_recipe_overlay.vsh b/assets/minecraft/shaders/core/rendertype_gui_ghost_recipe_overlay.vsh deleted file mode 100644 index 19d3fdba..00000000 --- a/assets/minecraft/shaders/core/rendertype_gui_ghost_recipe_overlay.vsh +++ /dev/null @@ -1,15 +0,0 @@ -#version 150 - -in vec3 Position; -in vec4 Color; - -uniform mat4 ModelViewMat; -uniform mat4 ProjMat; - -out vec4 vertexColor; - -void main() { - gl_Position = ProjMat * ModelViewMat * vec4(Position, 1.0); - - vertexColor = Color; -} diff --git a/assets/minecraft/shaders/core/rendertype_gui_overlay.fsh b/assets/minecraft/shaders/core/rendertype_gui_overlay.fsh deleted file mode 100644 index d7da70e8..00000000 --- a/assets/minecraft/shaders/core/rendertype_gui_overlay.fsh +++ /dev/null @@ -1,15 +0,0 @@ -#version 150 - -in vec4 vertexColor; - -uniform vec4 ColorModulator; - -out vec4 fragColor; - -void main() { - vec4 color = vertexColor; - if (color.a == 0.0) { - discard; - } - fragColor = color * ColorModulator; -} diff --git a/assets/minecraft/shaders/core/rendertype_gui_overlay.json b/assets/minecraft/shaders/core/rendertype_gui_overlay.json index 625c2586..29060a48 100644 --- a/assets/minecraft/shaders/core/rendertype_gui_overlay.json +++ b/assets/minecraft/shaders/core/rendertype_gui_overlay.json @@ -1,6 +1,6 @@ { - "vertex": "rendertype_gui_overlay", - "fragment": "rendertype_gui_overlay", + "vertex": "minecraft:core/gui", + "fragment": "minecraft:core/gui", "samplers": [ ], "uniforms": [ diff --git a/assets/minecraft/shaders/core/rendertype_gui_overlay.vsh b/assets/minecraft/shaders/core/rendertype_gui_overlay.vsh deleted file mode 100644 index 19d3fdba..00000000 --- a/assets/minecraft/shaders/core/rendertype_gui_overlay.vsh +++ /dev/null @@ -1,15 +0,0 @@ -#version 150 - -in vec3 Position; -in vec4 Color; - -uniform mat4 ModelViewMat; -uniform mat4 ProjMat; - -out vec4 vertexColor; - -void main() { - gl_Position = ProjMat * ModelViewMat * vec4(Position, 1.0); - - vertexColor = Color; -} diff --git a/assets/minecraft/shaders/core/rendertype_gui_text_highlight.fsh b/assets/minecraft/shaders/core/rendertype_gui_text_highlight.fsh deleted file mode 100644 index d7da70e8..00000000 --- a/assets/minecraft/shaders/core/rendertype_gui_text_highlight.fsh +++ /dev/null @@ -1,15 +0,0 @@ -#version 150 - -in vec4 vertexColor; - -uniform vec4 ColorModulator; - -out vec4 fragColor; - -void main() { - vec4 color = vertexColor; - if (color.a == 0.0) { - discard; - } - fragColor = color * ColorModulator; -} diff --git a/assets/minecraft/shaders/core/rendertype_gui_text_highlight.json b/assets/minecraft/shaders/core/rendertype_gui_text_highlight.json index 170e2cb4..29060a48 100644 --- a/assets/minecraft/shaders/core/rendertype_gui_text_highlight.json +++ b/assets/minecraft/shaders/core/rendertype_gui_text_highlight.json @@ -1,6 +1,6 @@ { - "vertex": "rendertype_gui_text_highlight", - "fragment": "rendertype_gui_text_highlight", + "vertex": "minecraft:core/gui", + "fragment": "minecraft:core/gui", "samplers": [ ], "uniforms": [ diff --git a/assets/minecraft/shaders/core/rendertype_gui_text_highlight.vsh b/assets/minecraft/shaders/core/rendertype_gui_text_highlight.vsh deleted file mode 100644 index 19d3fdba..00000000 --- a/assets/minecraft/shaders/core/rendertype_gui_text_highlight.vsh +++ /dev/null @@ -1,15 +0,0 @@ -#version 150 - -in vec3 Position; -in vec4 Color; - -uniform mat4 ModelViewMat; -uniform mat4 ProjMat; - -out vec4 vertexColor; - -void main() { - gl_Position = ProjMat * ModelViewMat * vec4(Position, 1.0); - - vertexColor = Color; -} diff --git a/assets/minecraft/shaders/core/rendertype_item_entity_translucent_cull.fsh b/assets/minecraft/shaders/core/rendertype_item_entity_translucent_cull.fsh index 232a61df..0eb9feea 100644 --- a/assets/minecraft/shaders/core/rendertype_item_entity_translucent_cull.fsh +++ b/assets/minecraft/shaders/core/rendertype_item_entity_translucent_cull.fsh @@ -1,6 +1,6 @@ #version 150 -#moj_import +#moj_import uniform sampler2D Sampler0; diff --git a/assets/minecraft/shaders/core/rendertype_item_entity_translucent_cull.json b/assets/minecraft/shaders/core/rendertype_item_entity_translucent_cull.json index cb19baf2..dc813b36 100644 --- a/assets/minecraft/shaders/core/rendertype_item_entity_translucent_cull.json +++ b/assets/minecraft/shaders/core/rendertype_item_entity_translucent_cull.json @@ -1,6 +1,6 @@ { - "vertex": "rendertype_item_entity_translucent_cull", - "fragment": "rendertype_item_entity_translucent_cull", + "vertex": "minecraft:core/rendertype_item_entity_translucent_cull", + "fragment": "minecraft:core/rendertype_item_entity_translucent_cull", "samplers": [ { "name": "Sampler0" }, { "name": "Sampler2" } diff --git a/assets/minecraft/shaders/core/rendertype_item_entity_translucent_cull.vsh b/assets/minecraft/shaders/core/rendertype_item_entity_translucent_cull.vsh index a2c9595e..022efea3 100644 --- a/assets/minecraft/shaders/core/rendertype_item_entity_translucent_cull.vsh +++ b/assets/minecraft/shaders/core/rendertype_item_entity_translucent_cull.vsh @@ -1,7 +1,7 @@ #version 150 -#moj_import -#moj_import +#moj_import +#moj_import in vec3 Position; in vec4 Color; diff --git a/assets/minecraft/shaders/core/rendertype_leash.fsh b/assets/minecraft/shaders/core/rendertype_leash.fsh index f6aabc62..0f0cf302 100644 --- a/assets/minecraft/shaders/core/rendertype_leash.fsh +++ b/assets/minecraft/shaders/core/rendertype_leash.fsh @@ -1,6 +1,6 @@ #version 150 -#moj_import +#moj_import uniform float FogStart; uniform float FogEnd; diff --git a/assets/minecraft/shaders/core/rendertype_leash.json b/assets/minecraft/shaders/core/rendertype_leash.json index 62701714..0aa90d26 100644 --- a/assets/minecraft/shaders/core/rendertype_leash.json +++ b/assets/minecraft/shaders/core/rendertype_leash.json @@ -1,6 +1,6 @@ { - "vertex": "rendertype_leash", - "fragment": "rendertype_leash", + "vertex": "minecraft:core/rendertype_leash", + "fragment": "minecraft:core/rendertype_leash", "samplers": [ { "name": "Sampler2" } ], diff --git a/assets/minecraft/shaders/core/rendertype_leash.vsh b/assets/minecraft/shaders/core/rendertype_leash.vsh index be108e6d..28073fdd 100644 --- a/assets/minecraft/shaders/core/rendertype_leash.vsh +++ b/assets/minecraft/shaders/core/rendertype_leash.vsh @@ -1,6 +1,6 @@ #version 150 -#moj_import +#moj_import in vec3 Position; in vec4 Color; diff --git a/assets/minecraft/shaders/core/rendertype_lightning.fsh b/assets/minecraft/shaders/core/rendertype_lightning.fsh index f555d413..552521f1 100644 --- a/assets/minecraft/shaders/core/rendertype_lightning.fsh +++ b/assets/minecraft/shaders/core/rendertype_lightning.fsh @@ -1,6 +1,6 @@ #version 150 -#moj_import +#moj_import uniform vec4 ColorModulator; uniform float FogStart; diff --git a/assets/minecraft/shaders/core/rendertype_lightning.json b/assets/minecraft/shaders/core/rendertype_lightning.json index 9e7f3d36..78bf9b5e 100644 --- a/assets/minecraft/shaders/core/rendertype_lightning.json +++ b/assets/minecraft/shaders/core/rendertype_lightning.json @@ -1,6 +1,6 @@ { - "vertex": "rendertype_lightning", - "fragment": "rendertype_lightning", + "vertex": "minecraft:core/rendertype_lightning", + "fragment": "minecraft:core/rendertype_lightning", "samplers": [ ], "uniforms": [ @@ -9,6 +9,7 @@ { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] }, { "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] }, { "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] }, + { "name": "FogColor", "type": "float", "count": 4, "values": [ 0.0, 0.0, 0.0, 0.0 ] }, { "name": "FogShape", "type": "int", "count": 1, "values": [ 0 ] } ] } diff --git a/assets/minecraft/shaders/core/rendertype_lightning.vsh b/assets/minecraft/shaders/core/rendertype_lightning.vsh index 00d7de2f..d58eb6da 100644 --- a/assets/minecraft/shaders/core/rendertype_lightning.vsh +++ b/assets/minecraft/shaders/core/rendertype_lightning.vsh @@ -1,6 +1,6 @@ #version 150 -#moj_import +#moj_import in vec3 Position; in vec4 Color; diff --git a/assets/minecraft/shaders/core/rendertype_lines.fsh b/assets/minecraft/shaders/core/rendertype_lines.fsh index 057f31fc..46949e1f 100644 --- a/assets/minecraft/shaders/core/rendertype_lines.fsh +++ b/assets/minecraft/shaders/core/rendertype_lines.fsh @@ -1,6 +1,6 @@ #version 150 -#moj_import +#moj_import uniform vec4 ColorModulator; uniform float FogStart; diff --git a/assets/minecraft/shaders/core/rendertype_lines.json b/assets/minecraft/shaders/core/rendertype_lines.json index 670a8bd7..32ce8870 100644 --- a/assets/minecraft/shaders/core/rendertype_lines.json +++ b/assets/minecraft/shaders/core/rendertype_lines.json @@ -1,6 +1,6 @@ { - "vertex": "rendertype_lines", - "fragment": "rendertype_lines", + "vertex": "minecraft:core/rendertype_lines", + "fragment": "minecraft:core/rendertype_lines", "samplers": [ ], "uniforms": [ diff --git a/assets/minecraft/shaders/core/rendertype_lines.vsh b/assets/minecraft/shaders/core/rendertype_lines.vsh index 82c69d17..a7408de6 100644 --- a/assets/minecraft/shaders/core/rendertype_lines.vsh +++ b/assets/minecraft/shaders/core/rendertype_lines.vsh @@ -1,6 +1,6 @@ #version 150 -#moj_import +#moj_import in vec3 Position; in vec4 Color; diff --git a/assets/minecraft/shaders/core/rendertype_outline.json b/assets/minecraft/shaders/core/rendertype_outline.json index ea6c72fe..6e4fb121 100644 --- a/assets/minecraft/shaders/core/rendertype_outline.json +++ b/assets/minecraft/shaders/core/rendertype_outline.json @@ -1,6 +1,6 @@ { - "vertex": "rendertype_outline", - "fragment": "rendertype_outline", + "vertex": "minecraft:core/rendertype_outline", + "fragment": "minecraft:core/rendertype_outline", "samplers": [ { "name": "Sampler0" } ], diff --git a/assets/minecraft/shaders/core/rendertype_solid.fsh b/assets/minecraft/shaders/core/rendertype_solid.fsh deleted file mode 100644 index 851068d0..00000000 --- a/assets/minecraft/shaders/core/rendertype_solid.fsh +++ /dev/null @@ -1,21 +0,0 @@ -#version 150 - -#moj_import - -uniform sampler2D Sampler0; - -uniform vec4 ColorModulator; -uniform float FogStart; -uniform float FogEnd; -uniform vec4 FogColor; - -in float vertexDistance; -in vec4 vertexColor; -in vec2 texCoord0; - -out vec4 fragColor; - -void main() { - vec4 color = texture(Sampler0, texCoord0) * vertexColor * ColorModulator; - fragColor = linear_fog(color, vertexDistance, FogStart, FogEnd, FogColor); -} diff --git a/assets/minecraft/shaders/core/rendertype_solid.json b/assets/minecraft/shaders/core/rendertype_solid.json index a9e5db45..ce415faa 100644 --- a/assets/minecraft/shaders/core/rendertype_solid.json +++ b/assets/minecraft/shaders/core/rendertype_solid.json @@ -1,6 +1,6 @@ { - "vertex": "rendertype_solid", - "fragment": "rendertype_solid", + "vertex": "minecraft:core/terrain", + "fragment": "minecraft:core/terrain", "samplers": [ { "name": "Sampler0" }, { "name": "Sampler2" } @@ -8,7 +8,7 @@ "uniforms": [ { "name": "ModelViewMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] }, { "name": "ProjMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] }, - { "name": "ChunkOffset", "type": "float", "count": 3, "values": [ 0.0, 0.0, 0.0 ] }, + { "name": "ModelOffset", "type": "float", "count": 3, "values": [ 0.0, 0.0, 0.0 ] }, { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] }, { "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] }, { "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] }, diff --git a/assets/minecraft/shaders/core/rendertype_solid.vsh b/assets/minecraft/shaders/core/rendertype_solid.vsh deleted file mode 100644 index 02f3d117..00000000 --- a/assets/minecraft/shaders/core/rendertype_solid.vsh +++ /dev/null @@ -1,30 +0,0 @@ -#version 150 - -#moj_import -#moj_import - -in vec3 Position; -in vec4 Color; -in vec2 UV0; -in ivec2 UV2; -in vec3 Normal; - -uniform sampler2D Sampler2; - -uniform mat4 ModelViewMat; -uniform mat4 ProjMat; -uniform vec3 ChunkOffset; -uniform int FogShape; - -out float vertexDistance; -out vec4 vertexColor; -out vec2 texCoord0; - -void main() { - vec3 pos = Position + ChunkOffset; - gl_Position = ProjMat * ModelViewMat * vec4(pos, 1.0); - - vertexDistance = fog_distance(pos, FogShape); - vertexColor = Color * minecraft_sample_lightmap(Sampler2, UV2); - texCoord0 = UV0; -} diff --git a/assets/minecraft/shaders/core/rendertype_text.fsh b/assets/minecraft/shaders/core/rendertype_text.fsh index 3fe46019..49cbc4b5 100644 --- a/assets/minecraft/shaders/core/rendertype_text.fsh +++ b/assets/minecraft/shaders/core/rendertype_text.fsh @@ -1,6 +1,6 @@ #version 150 -#moj_import +#moj_import uniform sampler2D Sampler0; diff --git a/assets/minecraft/shaders/core/rendertype_text.json b/assets/minecraft/shaders/core/rendertype_text.json index 607a9c1e..8fff4c6f 100644 --- a/assets/minecraft/shaders/core/rendertype_text.json +++ b/assets/minecraft/shaders/core/rendertype_text.json @@ -1,6 +1,6 @@ { - "vertex": "rendertype_text", - "fragment": "rendertype_text", + "vertex": "minecraft:core/rendertype_text", + "fragment": "minecraft:core/rendertype_text", "samplers": [ { "name": "Sampler0" }, { "name": "Sampler2" } diff --git a/assets/minecraft/shaders/core/rendertype_text.vsh b/assets/minecraft/shaders/core/rendertype_text.vsh index f53b07f1..2852ddd7 100644 --- a/assets/minecraft/shaders/core/rendertype_text.vsh +++ b/assets/minecraft/shaders/core/rendertype_text.vsh @@ -1,6 +1,6 @@ #version 150 -#moj_import +#moj_import in vec3 Position; in vec4 Color; diff --git a/assets/minecraft/shaders/core/rendertype_text_background.fsh b/assets/minecraft/shaders/core/rendertype_text_background.fsh index 87237bed..1879b4a2 100644 --- a/assets/minecraft/shaders/core/rendertype_text_background.fsh +++ b/assets/minecraft/shaders/core/rendertype_text_background.fsh @@ -1,6 +1,6 @@ #version 150 -#moj_import +#moj_import uniform sampler2D Sampler0; diff --git a/assets/minecraft/shaders/core/rendertype_text_background.json b/assets/minecraft/shaders/core/rendertype_text_background.json index b498c38a..2709bf99 100644 --- a/assets/minecraft/shaders/core/rendertype_text_background.json +++ b/assets/minecraft/shaders/core/rendertype_text_background.json @@ -1,6 +1,6 @@ { - "vertex": "rendertype_text_background", - "fragment": "rendertype_text_background", + "vertex": "minecraft:core/rendertype_text_background", + "fragment": "minecraft:core/rendertype_text_background", "samplers": [ { "name": "Sampler2" } ], diff --git a/assets/minecraft/shaders/core/rendertype_text_background.vsh b/assets/minecraft/shaders/core/rendertype_text_background.vsh index e29f3d9c..e1a2769b 100644 --- a/assets/minecraft/shaders/core/rendertype_text_background.vsh +++ b/assets/minecraft/shaders/core/rendertype_text_background.vsh @@ -1,6 +1,6 @@ #version 150 -#moj_import +#moj_import in vec3 Position; in vec4 Color; diff --git a/assets/minecraft/shaders/core/rendertype_text_background_see_through.json b/assets/minecraft/shaders/core/rendertype_text_background_see_through.json index a1fb14dd..8407a3b3 100644 --- a/assets/minecraft/shaders/core/rendertype_text_background_see_through.json +++ b/assets/minecraft/shaders/core/rendertype_text_background_see_through.json @@ -1,6 +1,6 @@ { - "vertex": "rendertype_text_background_see_through", - "fragment": "rendertype_text_background_see_through", + "vertex": "minecraft:core/rendertype_text_background_see_through", + "fragment": "minecraft:core/rendertype_text_background_see_through", "samplers": [ ], "uniforms": [ diff --git a/assets/minecraft/shaders/core/rendertype_text_intensity.fsh b/assets/minecraft/shaders/core/rendertype_text_intensity.fsh index adf5282d..c842858b 100644 --- a/assets/minecraft/shaders/core/rendertype_text_intensity.fsh +++ b/assets/minecraft/shaders/core/rendertype_text_intensity.fsh @@ -1,6 +1,6 @@ #version 150 -#moj_import +#moj_import uniform sampler2D Sampler0; diff --git a/assets/minecraft/shaders/core/rendertype_text_intensity.json b/assets/minecraft/shaders/core/rendertype_text_intensity.json index 18712ec0..04262bf7 100644 --- a/assets/minecraft/shaders/core/rendertype_text_intensity.json +++ b/assets/minecraft/shaders/core/rendertype_text_intensity.json @@ -1,6 +1,6 @@ { - "vertex": "rendertype_text_intensity", - "fragment": "rendertype_text_intensity", + "vertex": "minecraft:core/rendertype_text_intensity", + "fragment": "minecraft:core/rendertype_text_intensity", "samplers": [ { "name": "Sampler0" }, { "name": "Sampler2" } diff --git a/assets/minecraft/shaders/core/rendertype_text_intensity.vsh b/assets/minecraft/shaders/core/rendertype_text_intensity.vsh index f53b07f1..2852ddd7 100644 --- a/assets/minecraft/shaders/core/rendertype_text_intensity.vsh +++ b/assets/minecraft/shaders/core/rendertype_text_intensity.vsh @@ -1,6 +1,6 @@ #version 150 -#moj_import +#moj_import in vec3 Position; in vec4 Color; diff --git a/assets/minecraft/shaders/core/rendertype_text_intensity_see_through.json b/assets/minecraft/shaders/core/rendertype_text_intensity_see_through.json index aaeee8b4..a1479e1e 100644 --- a/assets/minecraft/shaders/core/rendertype_text_intensity_see_through.json +++ b/assets/minecraft/shaders/core/rendertype_text_intensity_see_through.json @@ -1,6 +1,6 @@ { - "vertex": "rendertype_text_intensity_see_through", - "fragment": "rendertype_text_intensity_see_through", + "vertex": "minecraft:core/rendertype_text_intensity_see_through", + "fragment": "minecraft:core/rendertype_text_intensity_see_through", "samplers": [ { "name": "Sampler0" } ], diff --git a/assets/minecraft/shaders/core/rendertype_text_see_through.json b/assets/minecraft/shaders/core/rendertype_text_see_through.json index ae7f4bee..c54dc685 100644 --- a/assets/minecraft/shaders/core/rendertype_text_see_through.json +++ b/assets/minecraft/shaders/core/rendertype_text_see_through.json @@ -1,6 +1,6 @@ { - "vertex": "rendertype_text_see_through", - "fragment": "rendertype_text_see_through", + "vertex": "minecraft:core/rendertype_text_see_through", + "fragment": "minecraft:core/rendertype_text_see_through", "samplers": [ { "name": "Sampler0" } ], diff --git a/assets/minecraft/shaders/core/rendertype_translucent.fsh b/assets/minecraft/shaders/core/rendertype_translucent.fsh deleted file mode 100644 index 851068d0..00000000 --- a/assets/minecraft/shaders/core/rendertype_translucent.fsh +++ /dev/null @@ -1,21 +0,0 @@ -#version 150 - -#moj_import - -uniform sampler2D Sampler0; - -uniform vec4 ColorModulator; -uniform float FogStart; -uniform float FogEnd; -uniform vec4 FogColor; - -in float vertexDistance; -in vec4 vertexColor; -in vec2 texCoord0; - -out vec4 fragColor; - -void main() { - vec4 color = texture(Sampler0, texCoord0) * vertexColor * ColorModulator; - fragColor = linear_fog(color, vertexDistance, FogStart, FogEnd, FogColor); -} diff --git a/assets/minecraft/shaders/core/rendertype_translucent.json b/assets/minecraft/shaders/core/rendertype_translucent.json index f157ec73..ce415faa 100644 --- a/assets/minecraft/shaders/core/rendertype_translucent.json +++ b/assets/minecraft/shaders/core/rendertype_translucent.json @@ -1,6 +1,6 @@ { - "vertex": "rendertype_translucent", - "fragment": "rendertype_translucent", + "vertex": "minecraft:core/terrain", + "fragment": "minecraft:core/terrain", "samplers": [ { "name": "Sampler0" }, { "name": "Sampler2" } @@ -8,7 +8,7 @@ "uniforms": [ { "name": "ModelViewMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] }, { "name": "ProjMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] }, - { "name": "ChunkOffset", "type": "float", "count": 3, "values": [ 0.0, 0.0, 0.0 ] }, + { "name": "ModelOffset", "type": "float", "count": 3, "values": [ 0.0, 0.0, 0.0 ] }, { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] }, { "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] }, { "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] }, diff --git a/assets/minecraft/shaders/core/rendertype_translucent.vsh b/assets/minecraft/shaders/core/rendertype_translucent.vsh deleted file mode 100644 index 02f3d117..00000000 --- a/assets/minecraft/shaders/core/rendertype_translucent.vsh +++ /dev/null @@ -1,30 +0,0 @@ -#version 150 - -#moj_import -#moj_import - -in vec3 Position; -in vec4 Color; -in vec2 UV0; -in ivec2 UV2; -in vec3 Normal; - -uniform sampler2D Sampler2; - -uniform mat4 ModelViewMat; -uniform mat4 ProjMat; -uniform vec3 ChunkOffset; -uniform int FogShape; - -out float vertexDistance; -out vec4 vertexColor; -out vec2 texCoord0; - -void main() { - vec3 pos = Position + ChunkOffset; - gl_Position = ProjMat * ModelViewMat * vec4(pos, 1.0); - - vertexDistance = fog_distance(pos, FogShape); - vertexColor = Color * minecraft_sample_lightmap(Sampler2, UV2); - texCoord0 = UV0; -} diff --git a/assets/minecraft/shaders/core/rendertype_translucent_moving_block.json b/assets/minecraft/shaders/core/rendertype_translucent_moving_block.json index 1c08b62c..2e2c8401 100644 --- a/assets/minecraft/shaders/core/rendertype_translucent_moving_block.json +++ b/assets/minecraft/shaders/core/rendertype_translucent_moving_block.json @@ -1,6 +1,6 @@ { - "vertex": "rendertype_translucent_moving_block", - "fragment": "rendertype_translucent_moving_block", + "vertex": "minecraft:core/rendertype_translucent_moving_block", + "fragment": "minecraft:core/rendertype_translucent_moving_block", "samplers": [ { "name": "Sampler0" }, { "name": "Sampler2" } diff --git a/assets/minecraft/shaders/core/rendertype_tripwire.fsh b/assets/minecraft/shaders/core/rendertype_tripwire.fsh deleted file mode 100644 index 3fe46019..00000000 --- a/assets/minecraft/shaders/core/rendertype_tripwire.fsh +++ /dev/null @@ -1,24 +0,0 @@ -#version 150 - -#moj_import - -uniform sampler2D Sampler0; - -uniform vec4 ColorModulator; -uniform float FogStart; -uniform float FogEnd; -uniform vec4 FogColor; - -in float vertexDistance; -in vec4 vertexColor; -in vec2 texCoord0; - -out vec4 fragColor; - -void main() { - vec4 color = texture(Sampler0, texCoord0) * vertexColor * ColorModulator; - if (color.a < 0.1) { - discard; - } - fragColor = linear_fog(color, vertexDistance, FogStart, FogEnd, FogColor); -} diff --git a/assets/minecraft/shaders/core/rendertype_tripwire.json b/assets/minecraft/shaders/core/rendertype_tripwire.json index 759278d8..ea3a5b05 100644 --- a/assets/minecraft/shaders/core/rendertype_tripwire.json +++ b/assets/minecraft/shaders/core/rendertype_tripwire.json @@ -1,6 +1,11 @@ { - "vertex": "rendertype_tripwire", - "fragment": "rendertype_tripwire", + "vertex": "minecraft:core/terrain", + "fragment": "minecraft:core/terrain", + "defines": { + "values": { + "ALPHA_CUTOUT": "0.1" + } + }, "samplers": [ { "name": "Sampler0" }, { "name": "Sampler2" } @@ -8,7 +13,7 @@ "uniforms": [ { "name": "ModelViewMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] }, { "name": "ProjMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] }, - { "name": "ChunkOffset", "type": "float", "count": 3, "values": [ 0.0, 0.0, 0.0 ] }, + { "name": "ModelOffset", "type": "float", "count": 3, "values": [ 0.0, 0.0, 0.0 ] }, { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] }, { "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] }, { "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] }, diff --git a/assets/minecraft/shaders/core/rendertype_tripwire.vsh b/assets/minecraft/shaders/core/rendertype_tripwire.vsh deleted file mode 100644 index 02f3d117..00000000 --- a/assets/minecraft/shaders/core/rendertype_tripwire.vsh +++ /dev/null @@ -1,30 +0,0 @@ -#version 150 - -#moj_import -#moj_import - -in vec3 Position; -in vec4 Color; -in vec2 UV0; -in ivec2 UV2; -in vec3 Normal; - -uniform sampler2D Sampler2; - -uniform mat4 ModelViewMat; -uniform mat4 ProjMat; -uniform vec3 ChunkOffset; -uniform int FogShape; - -out float vertexDistance; -out vec4 vertexColor; -out vec2 texCoord0; - -void main() { - vec3 pos = Position + ChunkOffset; - gl_Position = ProjMat * ModelViewMat * vec4(pos, 1.0); - - vertexDistance = fog_distance(pos, FogShape); - vertexColor = Color * minecraft_sample_lightmap(Sampler2, UV2); - texCoord0 = UV0; -} diff --git a/assets/minecraft/shaders/core/rendertype_water_mask.json b/assets/minecraft/shaders/core/rendertype_water_mask.json index 32bfac93..9cb3f074 100644 --- a/assets/minecraft/shaders/core/rendertype_water_mask.json +++ b/assets/minecraft/shaders/core/rendertype_water_mask.json @@ -1,6 +1,6 @@ { - "vertex": "rendertype_water_mask", - "fragment": "rendertype_water_mask", + "vertex": "minecraft:core/rendertype_water_mask", + "fragment": "minecraft:core/rendertype_water_mask", "samplers": [ ], "uniforms": [ diff --git a/assets/minecraft/shaders/core/rendertype_cutout.fsh b/assets/minecraft/shaders/core/terrain.fsh similarity index 81% rename from assets/minecraft/shaders/core/rendertype_cutout.fsh rename to assets/minecraft/shaders/core/terrain.fsh index 3fe46019..d56036e6 100644 --- a/assets/minecraft/shaders/core/rendertype_cutout.fsh +++ b/assets/minecraft/shaders/core/terrain.fsh @@ -1,6 +1,6 @@ #version 150 -#moj_import +#moj_import uniform sampler2D Sampler0; @@ -17,8 +17,10 @@ out vec4 fragColor; void main() { vec4 color = texture(Sampler0, texCoord0) * vertexColor * ColorModulator; - if (color.a < 0.1) { +#ifdef ALPHA_CUTOUT + if (color.a < ALPHA_CUTOUT) { discard; } +#endif fragColor = linear_fog(color, vertexDistance, FogStart, FogEnd, FogColor); } diff --git a/assets/minecraft/shaders/core/rendertype_cutout_mipped.vsh b/assets/minecraft/shaders/core/terrain.vsh similarity index 78% rename from assets/minecraft/shaders/core/rendertype_cutout_mipped.vsh rename to assets/minecraft/shaders/core/terrain.vsh index 02f3d117..ca48c669 100644 --- a/assets/minecraft/shaders/core/rendertype_cutout_mipped.vsh +++ b/assets/minecraft/shaders/core/terrain.vsh @@ -1,7 +1,7 @@ #version 150 -#moj_import -#moj_import +#moj_import +#moj_import in vec3 Position; in vec4 Color; @@ -13,7 +13,7 @@ uniform sampler2D Sampler2; uniform mat4 ModelViewMat; uniform mat4 ProjMat; -uniform vec3 ChunkOffset; +uniform vec3 ModelOffset; uniform int FogShape; out float vertexDistance; @@ -21,7 +21,7 @@ out vec4 vertexColor; out vec2 texCoord0; void main() { - vec3 pos = Position + ChunkOffset; + vec3 pos = Position + ModelOffset; gl_Position = ProjMat * ModelViewMat * vec4(pos, 1.0); vertexDistance = fog_distance(pos, FogShape); diff --git a/assets/minecraft/shaders/program/bits.fsh b/assets/minecraft/shaders/post/bits.fsh similarity index 85% rename from assets/minecraft/shaders/program/bits.fsh rename to assets/minecraft/shaders/post/bits.fsh index d4b86c22..754f8bfc 100644 --- a/assets/minecraft/shaders/program/bits.fsh +++ b/assets/minecraft/shaders/post/bits.fsh @@ -1,6 +1,6 @@ #version 150 -uniform sampler2D DiffuseSampler; +uniform sampler2D InSampler; in vec2 texCoord; in vec2 oneTexel; @@ -17,7 +17,7 @@ void main() { vec2 mosaicInSize = InSize / MosaicSize; vec2 fractPix = fract(texCoord * mosaicInSize) / mosaicInSize; - vec4 baseTexel = texture(DiffuseSampler, texCoord - fractPix); + vec4 baseTexel = texture(InSampler, texCoord - fractPix); vec3 fractTexel = baseTexel.rgb - fract(baseTexel.rgb * Resolution) / Resolution; float luma = dot(fractTexel, vec3(0.3, 0.59, 0.11)); diff --git a/assets/minecraft/shaders/program/bits.json b/assets/minecraft/shaders/post/bits.json similarity index 75% rename from assets/minecraft/shaders/program/bits.json rename to assets/minecraft/shaders/post/bits.json index e2623f7d..54f9e0b5 100644 --- a/assets/minecraft/shaders/program/bits.json +++ b/assets/minecraft/shaders/post/bits.json @@ -1,14 +1,8 @@ { - "blend": { - "func": "add", - "srcrgb": "srcalpha", - "dstrgb": "1-srcalpha" - }, - "vertex": "sobel", - "fragment": "bits", - "attributes": [ "Position" ], + "vertex": "minecraft:post/sobel", + "fragment": "minecraft:post/bits", "samplers": [ - { "name": "DiffuseSampler" } + { "name": "InSampler" } ], "uniforms": [ { "name": "ProjMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] }, diff --git a/assets/minecraft/shaders/post/blit.fsh b/assets/minecraft/shaders/post/blit.fsh new file mode 100644 index 00000000..db4d0d1e --- /dev/null +++ b/assets/minecraft/shaders/post/blit.fsh @@ -0,0 +1,13 @@ +#version 150 + +uniform sampler2D InSampler; + +uniform vec4 ColorModulate; + +in vec2 texCoord; + +out vec4 fragColor; + +void main(){ + fragColor = texture(InSampler, texCoord) * ColorModulate; +} diff --git a/assets/minecraft/shaders/program/blit.json b/assets/minecraft/shaders/post/blit.json similarity index 65% rename from assets/minecraft/shaders/program/blit.json rename to assets/minecraft/shaders/post/blit.json index 1256b6b1..9ea94a61 100644 --- a/assets/minecraft/shaders/program/blit.json +++ b/assets/minecraft/shaders/post/blit.json @@ -1,14 +1,8 @@ { - "blend": { - "func": "add", - "srcrgb": "srcalpha", - "dstrgb": "1-srcalpha" - }, - "vertex": "blit", - "fragment": "blit", - "attributes": [ "Position" ], + "vertex": "minecraft:post/blit", + "fragment": "minecraft:post/blit", "samplers": [ - { "name": "DiffuseSampler" } + { "name": "InSampler" } ], "uniforms": [ { "name": "ProjMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] }, diff --git a/assets/minecraft/shaders/program/blit.vsh b/assets/minecraft/shaders/post/blit.vsh similarity index 100% rename from assets/minecraft/shaders/program/blit.vsh rename to assets/minecraft/shaders/post/blit.vsh diff --git a/assets/minecraft/shaders/post/blur.json b/assets/minecraft/shaders/post/blur.json deleted file mode 100644 index 096cd06f..00000000 --- a/assets/minecraft/shaders/post/blur.json +++ /dev/null @@ -1,81 +0,0 @@ -{ - "targets": [ - "swap" - ], - "passes": [ - { - "name": "box_blur", - "intarget": "minecraft:main", - "outtarget": "swap", - "use_linear_filter": true, - "uniforms": [ - { - "name": "BlurDir", - "values": [ 1.0, 0.0 ] - } - ] - }, - { - "name": "box_blur", - "intarget": "swap", - "outtarget": "minecraft:main", - "use_linear_filter": true, - "uniforms": [ - { - "name": "BlurDir", - "values": [ 0.0, 1.0 ] - } - ] - }, { - "name": "box_blur", - "intarget": "minecraft:main", - "outtarget": "swap", - "use_linear_filter": true, - "uniforms": [ - { - "name": "BlurDir", - "values": [ 1.0, 0.0 ], - "RadiusMultiplier" : 0.5 - } - ] - }, - { - "name": "box_blur", - "intarget": "swap", - "outtarget": "minecraft:main", - "use_linear_filter": true, - "uniforms": [ - { - "name": "BlurDir", - "values": [ 0.0, 1.0 ], - "RadiusMultiplier" : 0.5 - } - ] - }, { - "name": "box_blur", - "intarget": "minecraft:main", - "outtarget": "swap", - "use_linear_filter": true, - "uniforms": [ - { - "name": "BlurDir", - "values": [ 1.0, 0.0 ], - "RadiusMultiplier" : 0.25 - } - ] - }, - { - "name": "box_blur", - "intarget": "swap", - "outtarget": "minecraft:main", - "use_linear_filter": true, - "uniforms": [ - { - "name": "BlurDir", - "values": [ 0.0, 1.0 ], - "RadiusMultiplier" : 0.25 - } - ] - } - ] -} diff --git a/assets/minecraft/shaders/program/blur.vsh b/assets/minecraft/shaders/post/blur.vsh similarity index 100% rename from assets/minecraft/shaders/program/blur.vsh rename to assets/minecraft/shaders/post/blur.vsh diff --git a/assets/minecraft/shaders/program/box_blur.fsh b/assets/minecraft/shaders/post/box_blur.fsh similarity index 78% rename from assets/minecraft/shaders/program/box_blur.fsh rename to assets/minecraft/shaders/post/box_blur.fsh index ea02d30d..381e1e84 100644 --- a/assets/minecraft/shaders/program/box_blur.fsh +++ b/assets/minecraft/shaders/post/box_blur.fsh @@ -1,6 +1,6 @@ #version 150 -uniform sampler2D DiffuseSampler; +uniform sampler2D InSampler; in vec2 texCoord; in vec2 sampleStep; @@ -17,8 +17,8 @@ void main() { vec4 blurred = vec4(0.0); float actualRadius = round(Radius * RadiusMultiplier); for (float a = -actualRadius + 0.5; a <= actualRadius; a += 2.0) { - blurred += texture(DiffuseSampler, texCoord + sampleStep * a); + blurred += texture(InSampler, texCoord + sampleStep * a); } - blurred += texture(DiffuseSampler, texCoord + sampleStep * actualRadius) / 2.0; + blurred += texture(InSampler, texCoord + sampleStep * actualRadius) / 2.0; fragColor = blurred / (actualRadius + 0.5); } diff --git a/assets/minecraft/shaders/program/box_blur.json b/assets/minecraft/shaders/post/box_blur.json similarity index 76% rename from assets/minecraft/shaders/program/box_blur.json rename to assets/minecraft/shaders/post/box_blur.json index e60d51b4..c2d389f2 100644 --- a/assets/minecraft/shaders/program/box_blur.json +++ b/assets/minecraft/shaders/post/box_blur.json @@ -1,14 +1,8 @@ { - "blend": { - "func": "add", - "srcrgb": "one", - "dstrgb": "zero" - }, - "vertex": "blur", - "fragment": "box_blur", - "attributes": [ "Position" ], + "vertex": "minecraft:post/blur", + "fragment": "minecraft:post/box_blur", "samplers": [ - { "name": "DiffuseSampler" } + { "name": "InSampler" } ], "uniforms": [ { "name": "ProjMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] }, diff --git a/assets/minecraft/shaders/program/color_convolve.fsh b/assets/minecraft/shaders/post/color_convolve.fsh similarity index 89% rename from assets/minecraft/shaders/program/color_convolve.fsh rename to assets/minecraft/shaders/post/color_convolve.fsh index 9ee675f3..329e1e55 100644 --- a/assets/minecraft/shaders/program/color_convolve.fsh +++ b/assets/minecraft/shaders/post/color_convolve.fsh @@ -1,6 +1,6 @@ #version 150 -uniform sampler2D DiffuseSampler; +uniform sampler2D InSampler; in vec2 texCoord; in vec2 oneTexel; @@ -18,7 +18,7 @@ uniform float Saturation; out vec4 fragColor; void main() { - vec4 InTexel = texture(DiffuseSampler, texCoord); + vec4 InTexel = texture(InSampler, texCoord); // Color Matrix float RedValue = dot(InTexel.rgb, RedMatrix); diff --git a/assets/minecraft/shaders/program/color_convolve.json b/assets/minecraft/shaders/post/color_convolve.json similarity index 82% rename from assets/minecraft/shaders/program/color_convolve.json rename to assets/minecraft/shaders/post/color_convolve.json index e3a32c2d..5ed0aeb9 100644 --- a/assets/minecraft/shaders/program/color_convolve.json +++ b/assets/minecraft/shaders/post/color_convolve.json @@ -1,14 +1,8 @@ { - "blend": { - "func": "add", - "srcrgb": "one", - "dstrgb": "zero" - }, - "vertex": "sobel", - "fragment": "color_convolve", - "attributes": [ "Position" ], + "vertex": "minecraft:post/sobel", + "fragment": "minecraft:post/color_convolve", "samplers": [ - { "name": "DiffuseSampler" } + { "name": "InSampler" } ], "uniforms": [ { "name": "ProjMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] }, diff --git a/assets/minecraft/shaders/post/entity_outline.json b/assets/minecraft/shaders/post/entity_outline.json index a2efc39c..a60098f0 100644 --- a/assets/minecraft/shaders/post/entity_outline.json +++ b/assets/minecraft/shaders/post/entity_outline.json @@ -1,42 +1,12 @@ { - "targets": [ - "swap", - "final" + "vertex": "minecraft:post/sobel", + "fragment": "minecraft:post/entity_sobel", + "samplers": [ + { "name": "InSampler" } ], - "passes": [ - { - "name": "entity_outline", - "intarget": "final", - "outtarget": "swap" - }, - { - "name": "entity_outline_box_blur", - "intarget": "swap", - "outtarget": "final", - "use_linear_filter": true, - "uniforms": [ - { - "name": "BlurDir", - "values": [ 1.0, 0.0 ] - } - ] - }, - { - "name": "entity_outline_box_blur", - "intarget": "final", - "outtarget": "swap", - "use_linear_filter": true, - "uniforms": [ - { - "name": "BlurDir", - "values": [ 0.0, 1.0 ] - } - ] - }, - { - "name": "blit", - "intarget": "swap", - "outtarget": "final" - } + "uniforms": [ + { "name": "ProjMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] }, + { "name": "InSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] }, + { "name": "OutSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] } ] } diff --git a/assets/minecraft/shaders/program/entity_outline_box_blur.fsh b/assets/minecraft/shaders/post/entity_outline_box_blur.fsh similarity index 60% rename from assets/minecraft/shaders/program/entity_outline_box_blur.fsh rename to assets/minecraft/shaders/post/entity_outline_box_blur.fsh index 1c59ff64..4197a656 100644 --- a/assets/minecraft/shaders/program/entity_outline_box_blur.fsh +++ b/assets/minecraft/shaders/post/entity_outline_box_blur.fsh @@ -1,6 +1,6 @@ #version 150 -uniform sampler2D DiffuseSampler; +uniform sampler2D InSampler; in vec2 texCoord; in vec2 sampleStep; @@ -11,8 +11,8 @@ void main() { vec4 blurred = vec4(0.0); float radius = 2.0; for (float a = -radius + 0.5; a <= radius; a += 2.0) { - blurred += texture(DiffuseSampler, texCoord + sampleStep * a); + blurred += texture(InSampler, texCoord + sampleStep * a); } - blurred += texture(DiffuseSampler, texCoord + sampleStep * radius) / 2.0; + blurred += texture(InSampler, texCoord + sampleStep * radius) / 2.0; fragColor = vec4((blurred / (radius + 0.5)).rgb, blurred.a); } diff --git a/assets/minecraft/shaders/program/entity_outline_box_blur.json b/assets/minecraft/shaders/post/entity_outline_box_blur.json similarity index 81% rename from assets/minecraft/shaders/program/entity_outline_box_blur.json rename to assets/minecraft/shaders/post/entity_outline_box_blur.json index 58fa7da1..d46d1520 100644 --- a/assets/minecraft/shaders/program/entity_outline_box_blur.json +++ b/assets/minecraft/shaders/post/entity_outline_box_blur.json @@ -4,11 +4,10 @@ "srcrgb": "one", "dstrgb": "zero" }, - "vertex": "blur", - "fragment": "entity_outline_box_blur", - "attributes": [ "Position" ], + "vertex": "minecraft:post/blur", + "fragment": "minecraft:post/entity_outline_box_blur", "samplers": [ - { "name": "DiffuseSampler" } + { "name": "InSampler" } ], "uniforms": [ { "name": "ProjMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] }, diff --git a/assets/minecraft/shaders/program/entity_sobel.fsh b/assets/minecraft/shaders/post/entity_sobel.fsh similarity index 57% rename from assets/minecraft/shaders/program/entity_sobel.fsh rename to assets/minecraft/shaders/post/entity_sobel.fsh index 77081385..080bb9a2 100644 --- a/assets/minecraft/shaders/program/entity_sobel.fsh +++ b/assets/minecraft/shaders/post/entity_sobel.fsh @@ -1,6 +1,6 @@ #version 150 -uniform sampler2D DiffuseSampler; +uniform sampler2D InSampler; in vec2 texCoord; in vec2 oneTexel; @@ -8,11 +8,11 @@ in vec2 oneTexel; out vec4 fragColor; void main(){ - vec4 center = texture(DiffuseSampler, texCoord); - vec4 left = texture(DiffuseSampler, texCoord - vec2(oneTexel.x, 0.0)); - vec4 right = texture(DiffuseSampler, texCoord + vec2(oneTexel.x, 0.0)); - vec4 up = texture(DiffuseSampler, texCoord - vec2(0.0, oneTexel.y)); - vec4 down = texture(DiffuseSampler, texCoord + vec2(0.0, oneTexel.y)); + vec4 center = texture(InSampler, texCoord); + vec4 left = texture(InSampler, texCoord - vec2(oneTexel.x, 0.0)); + vec4 right = texture(InSampler, texCoord + vec2(oneTexel.x, 0.0)); + vec4 up = texture(InSampler, texCoord - vec2(0.0, oneTexel.y)); + vec4 down = texture(InSampler, texCoord + vec2(0.0, oneTexel.y)); float leftDiff = abs(center.a - left.a); float rightDiff = abs(center.a - right.a); float upDiff = abs(center.a - up.a); diff --git a/assets/minecraft/shaders/program/invert.fsh b/assets/minecraft/shaders/post/invert.fsh similarity index 72% rename from assets/minecraft/shaders/program/invert.fsh rename to assets/minecraft/shaders/post/invert.fsh index fce3ba46..106418f6 100644 --- a/assets/minecraft/shaders/program/invert.fsh +++ b/assets/minecraft/shaders/post/invert.fsh @@ -1,6 +1,6 @@ #version 150 -uniform sampler2D DiffuseSampler; +uniform sampler2D InSampler; in vec2 texCoord; @@ -9,7 +9,7 @@ uniform float InverseAmount; out vec4 fragColor; void main(){ - vec4 diffuseColor = texture(DiffuseSampler, texCoord); + vec4 diffuseColor = texture(InSampler, texCoord); vec4 invertColor = 1.0 - diffuseColor; vec4 outColor = mix(diffuseColor, invertColor, InverseAmount); fragColor = vec4(outColor.rgb, 1.0); diff --git a/assets/minecraft/shaders/post/invert.json b/assets/minecraft/shaders/post/invert.json index 2ab63fb6..e3ef44e9 100644 --- a/assets/minecraft/shaders/post/invert.json +++ b/assets/minecraft/shaders/post/invert.json @@ -1,23 +1,13 @@ { - "targets": [ - "swap" + "vertex": "minecraft:post/blit", + "fragment": "minecraft:post/invert", + "samplers": [ + { "name": "InSampler" } ], - "passes": [ - { - "name": "invert", - "intarget": "minecraft:main", - "outtarget": "swap", - "uniforms": [ - { - "name": "InverseAmount", - "values": [ 0.8 ] - } - ] - }, - { - "name": "blit", - "intarget": "swap", - "outtarget": "minecraft:main" - } + "uniforms": [ + { "name": "ProjMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] }, + { "name": "InSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] }, + { "name": "OutSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] }, + { "name": "InverseAmount", "type": "float", "count": 1, "values": [ 0.0 ] } ] } diff --git a/assets/minecraft/shaders/program/invert.vsh b/assets/minecraft/shaders/post/invert.vsh similarity index 100% rename from assets/minecraft/shaders/program/invert.vsh rename to assets/minecraft/shaders/post/invert.vsh diff --git a/assets/minecraft/shaders/program/rotscale.vsh b/assets/minecraft/shaders/post/rotscale.vsh similarity index 97% rename from assets/minecraft/shaders/program/rotscale.vsh rename to assets/minecraft/shaders/post/rotscale.vsh index 6c55a893..7ca34de5 100644 --- a/assets/minecraft/shaders/program/rotscale.vsh +++ b/assets/minecraft/shaders/post/rotscale.vsh @@ -9,7 +9,6 @@ uniform vec2 OutSize; uniform vec2 InScale; uniform vec2 InOffset; uniform float InRotation; -uniform float Time; out vec2 texCoord; out vec2 scaledCoord; diff --git a/assets/minecraft/shaders/program/screenquad.vsh b/assets/minecraft/shaders/post/screenquad.vsh similarity index 100% rename from assets/minecraft/shaders/program/screenquad.vsh rename to assets/minecraft/shaders/post/screenquad.vsh diff --git a/assets/minecraft/shaders/program/sobel.vsh b/assets/minecraft/shaders/post/sobel.vsh similarity index 100% rename from assets/minecraft/shaders/program/sobel.vsh rename to assets/minecraft/shaders/post/sobel.vsh diff --git a/assets/minecraft/shaders/post/spider.json b/assets/minecraft/shaders/post/spider.json index ea8a59fa..1999cae7 100644 --- a/assets/minecraft/shaders/post/spider.json +++ b/assets/minecraft/shaders/post/spider.json @@ -1,234 +1,18 @@ { - "targets": [ - "largeBlur", - "smallBlur", - "temp", - "swap" + "vertex": "minecraft:post/rotscale", + "fragment": "minecraft:post/spiderclip", + "samplers": [ + { "name": "InSampler" }, + { "name": "BlurSampler" } ], - "passes": [ - { - "name": "box_blur", - "intarget": "minecraft:main", - "outtarget": "temp", - "use_linear_filter": true, - "uniforms": [ - { - "name": "BlurDir", - "values": [ 1.0, 0.0 ] - }, - { - "name": "Radius", - "values": [ 15.0 ] - } - ] - }, - { - "name": "box_blur", - "intarget": "temp", - "outtarget": "largeBlur", - "use_linear_filter": true, - "uniforms": [ - { - "name": "BlurDir", - "values": [ 0.0, 1.0 ] - }, - { - "name": "Radius", - "values": [ 15.0 ] - } - ] - }, - { - "name": "box_blur", - "intarget": "minecraft:main", - "outtarget": "temp", - "use_linear_filter": true, - "uniforms": [ - { - "name": "BlurDir", - "values": [ 1.0, 0.0 ] - }, - { - "name": "Radius", - "values": [ 7.0 ] - } - ] - }, - { - "name": "box_blur", - "intarget": "temp", - "outtarget": "smallBlur", - "use_linear_filter": true, - "uniforms": [ - { - "name": "BlurDir", - "values": [ 0.0, 1.0 ] - }, - { - "name": "Radius", - "values": [ 7.0 ] - } - ] - }, - { - "name": "spider", - "intarget": "minecraft:main", - "outtarget": "temp", - "auxtargets": [ - { - "name": "BlurSampler", - "id": "largeBlur" - } - ], - "uniforms": [ - { - "name": "InScale", - "values": [ 1.25, 2.0 ] - }, - { - "name": "InOffset", - "values": [ -0.125, -0.1 ] - }, - { - "name": "Scissor", - "values": [ 0.0, 0.0, 1.0, 1.0 ] - }, - { - "name": "Vignette", - "values": [ 0.1, 0.1, 0.9, 0.9 ] - } - ] - }, - { - "name": "spider", - "intarget": "smallBlur", - "outtarget": "swap", - "auxtargets": [ - { - "name": "BlurSampler", - "id": "temp" - } - ], - "uniforms": [ - { - "name": "InScale", - "values": [ 2.35, 4.2 ] - }, - { - "name": "InOffset", - "values": [ -1.1, -1.5 ] - }, - { - "name": "InRotation", - "values": [ -45.0 ] - }, - { - "name": "Scissor", - "values": [ 0.21, 0.0, 0.79, 1.0 ] - }, - { - "name": "Vignette", - "values": [ 0.31, 0.1, 0.69, 0.9 ] - } - ] - }, - { - "name": "spider", - "intarget": "smallBlur", - "outtarget": "temp", - "auxtargets": [ - { - "name": "BlurSampler", - "id": "swap" - } - ], - "uniforms": [ - { - "name": "InScale", - "values": [ 2.35, 4.2 ] - }, - { - "name": "InOffset", - "values": [ 0.45, -4.45 ] - }, - { - "name": "InRotation", - "values": [ 45.0 ] - }, - { - "name": "Scissor", - "values": [ 0.21, 0.0, 0.79, 1.0 ] - }, - { - "name": "Vignette", - "values": [ 0.31, 0.1, 0.69, 0.9 ] - } - ] - }, - { - "name": "spider", - "intarget": "smallBlur", - "outtarget": "swap", - "auxtargets": [ - { - "name": "BlurSampler", - "id": "temp" - } - ], - "uniforms": [ - { - "name": "InScale", - "values": [ 2.35, 2.35 ] - }, - { - "name": "InOffset", - "values": [ -0.385, -1.29 ] - }, - { - "name": "InRotation", - "values": [ 0.0 ] - }, - { - "name": "Vignette", - "values": [ 0.31, 0.1, 0.69, 0.9 ] - } - ] - }, - { - "name": "spider", - "intarget": "smallBlur", - "outtarget": "temp", - "auxtargets": [ - { - "name": "BlurSampler", - "id": "swap" - } - ], - "uniforms": [ - { - "name": "InScale", - "values": [ 2.35, 2.35 ] - }, - { - "name": "InOffset", - "values": [ -0.965, -1.29 ] - }, - { - "name": "Vignette", - "values": [ 0.31, 0.1, 0.69, 0.9 ] - } - ] - }, - { - "name": "blit", - "intarget": "temp", - "outtarget": "minecraft:main", - "uniforms": [ - { - "name": "ColorModulate", - "values": [ 1.0, 0.8, 0.8, 1.0 ] - } - ] - } + "uniforms": [ + { "name": "ProjMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] }, + { "name": "InSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] }, + { "name": "InScale", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] }, + { "name": "InOffset", "type": "float", "count": 2, "values": [ 0.0, 0.0 ] }, + { "name": "InRotation", "type": "float", "count": 1, "values": [ 0.0 ] }, + { "name": "Scissor", "type": "float", "count": 4, "values": [ 0.0, 0.0, 1.0, 1.0 ] }, + { "name": "Vignette", "type": "float", "count": 4, "values": [ 0.0, 0.0, 1.0, 1.0 ] }, + { "name": "OutSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] } ] } diff --git a/assets/minecraft/shaders/program/spiderclip.fsh b/assets/minecraft/shaders/post/spiderclip.fsh similarity index 92% rename from assets/minecraft/shaders/program/spiderclip.fsh rename to assets/minecraft/shaders/post/spiderclip.fsh index c586188f..4d4eafc6 100644 --- a/assets/minecraft/shaders/program/spiderclip.fsh +++ b/assets/minecraft/shaders/post/spiderclip.fsh @@ -1,6 +1,6 @@ #version 150 -uniform sampler2D DiffuseSampler; +uniform sampler2D InSampler; uniform sampler2D BlurSampler; in vec2 texCoord; @@ -13,7 +13,7 @@ uniform vec4 Vignette; out vec4 fragColor; void main() { - vec4 ScaledTexel = texture(DiffuseSampler, scaledCoord); + vec4 ScaledTexel = texture(InSampler, scaledCoord); vec4 BlurTexel = texture(BlurSampler, texCoord); vec4 OutTexel = ScaledTexel; diff --git a/assets/minecraft/shaders/program/transparency.fsh b/assets/minecraft/shaders/post/transparency.fsh similarity index 90% rename from assets/minecraft/shaders/program/transparency.fsh rename to assets/minecraft/shaders/post/transparency.fsh index 3b277ace..690b3178 100644 --- a/assets/minecraft/shaders/program/transparency.fsh +++ b/assets/minecraft/shaders/post/transparency.fsh @@ -1,7 +1,7 @@ #version 150 -uniform sampler2D DiffuseSampler; -uniform sampler2D DiffuseDepthSampler; +uniform sampler2D MainSampler; +uniform sampler2D MainDepthSampler; uniform sampler2D TranslucentSampler; uniform sampler2D TranslucentDepthSampler; uniform sampler2D ItemEntitySampler; @@ -51,8 +51,8 @@ vec3 blend( vec3 dst, vec4 src ) { } void main() { - color_layers[0] = vec4( texture( DiffuseSampler, texCoord ).rgb, 1.0 ); - depth_layers[0] = texture( DiffuseDepthSampler, texCoord ).r; + color_layers[0] = vec4( texture( MainSampler, texCoord ).rgb, 1.0 ); + depth_layers[0] = texture( MainDepthSampler, texCoord ).r; active_layers = 1; try_insert( texture( TranslucentSampler, texCoord ), texture( TranslucentDepthSampler, texCoord ).r ); diff --git a/assets/minecraft/shaders/post/transparency.json b/assets/minecraft/shaders/post/transparency.json index 8642ac2d..8f5b68ce 100644 --- a/assets/minecraft/shaders/post/transparency.json +++ b/assets/minecraft/shaders/post/transparency.json @@ -1,69 +1,22 @@ { - "targets": [ - "water", - "translucent", - "itemEntity", - "particles", - "clouds", - "weather", - "final" + "vertex": "minecraft:post/screenquad", + "fragment": "minecraft:post/transparency", + "samplers": [ + { "name": "MainSampler" }, + { "name": "MainDepthSampler" }, + { "name": "TranslucentSampler" }, + { "name": "TranslucentDepthSampler" }, + { "name": "ItemEntitySampler" }, + { "name": "ItemEntityDepthSampler" }, + { "name": "ParticlesSampler" }, + { "name": "ParticlesDepthSampler" }, + { "name": "CloudsSampler" }, + { "name": "CloudsDepthSampler" }, + { "name": "WeatherSampler" }, + { "name": "WeatherDepthSampler" } ], - "passes": [ - { - "name": "transparency", - "intarget": "minecraft:main", - "outtarget": "final", - "auxtargets": [ - { - "name": "DiffuseDepthSampler", - "id": "minecraft:main:depth" - }, - { - "name": "TranslucentSampler", - "id": "translucent" - }, - { - "name": "TranslucentDepthSampler", - "id": "translucent:depth" - }, - { - "name": "ItemEntitySampler", - "id": "itemEntity" - }, - { - "name": "ItemEntityDepthSampler", - "id": "itemEntity:depth" - }, - { - "name": "ParticlesSampler", - "id": "particles" - }, - { - "name": "ParticlesDepthSampler", - "id": "particles:depth" - }, - { - "name": "CloudsSampler", - "id": "clouds" - }, - { - "name": "CloudsDepthSampler", - "id": "clouds:depth" - }, - { - "name": "WeatherSampler", - "id": "weather" - }, - { - "name": "WeatherDepthSampler", - "id": "weather:depth" - } - ] - }, - { - "name": "blit", - "intarget": "final", - "outtarget": "minecraft:main" - } + "uniforms": [ + { "name": "ProjMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] }, + { "name": "OutSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] } ] } diff --git a/assets/minecraft/shaders/program/blit.fsh b/assets/minecraft/shaders/program/blit.fsh deleted file mode 100644 index 18202e06..00000000 --- a/assets/minecraft/shaders/program/blit.fsh +++ /dev/null @@ -1,13 +0,0 @@ -#version 150 - -uniform sampler2D DiffuseSampler; - -uniform vec4 ColorModulate; - -in vec2 texCoord; - -out vec4 fragColor; - -void main(){ - fragColor = texture(DiffuseSampler, texCoord) * ColorModulate; -} diff --git a/assets/minecraft/shaders/program/entity_outline.json b/assets/minecraft/shaders/program/entity_outline.json deleted file mode 100644 index d7c77631..00000000 --- a/assets/minecraft/shaders/program/entity_outline.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "blend": { - "func": "add", - "srcrgb": "srcalpha", - "dstrgb": "1-srcalpha" - }, - "vertex": "sobel", - "fragment": "entity_sobel", - "attributes": [ "Position" ], - "samplers": [ - { "name": "DiffuseSampler" } - ], - "uniforms": [ - { "name": "ProjMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] }, - { "name": "InSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] }, - { "name": "OutSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] } - ] -} diff --git a/assets/minecraft/shaders/program/invert.json b/assets/minecraft/shaders/program/invert.json deleted file mode 100644 index f9ab649c..00000000 --- a/assets/minecraft/shaders/program/invert.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "blend": { - "func": "add", - "srcrgb": "one", - "dstrgb": "zero" - }, - "vertex": "blit", - "fragment": "invert", - "attributes": [ "Position" ], - "samplers": [ - { "name": "DiffuseSampler" } - ], - "uniforms": [ - { "name": "ProjMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] }, - { "name": "InSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] }, - { "name": "OutSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] }, - { "name": "InverseAmount", "type": "float", "count": 1, "values": [ 0.0 ] } - ] -} diff --git a/assets/minecraft/shaders/program/spider.json b/assets/minecraft/shaders/program/spider.json deleted file mode 100644 index 3a47688e..00000000 --- a/assets/minecraft/shaders/program/spider.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "blend": { - "func": "add", - "srcrgb": "one", - "dstrgb": "zero" - }, - "vertex": "rotscale", - "fragment": "spiderclip", - "attributes": [ "Position" ], - "samplers": [ - { "name": "DiffuseSampler" }, - { "name": "BlurSampler" } - ], - "uniforms": [ - { "name": "ProjMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] }, - { "name": "InSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] }, - { "name": "InScale", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] }, - { "name": "InOffset", "type": "float", "count": 2, "values": [ 0.0, 0.0 ] }, - { "name": "InRotation", "type": "float", "count": 1, "values": [ 0.0 ] }, - { "name": "Time", "type": "float", "count": 1, "values": [ 0.0 ] }, - { "name": "Scissor", "type": "float", "count": 4, "values": [ 0.0, 0.0, 1.0, 1.0 ] }, - { "name": "Vignette", "type": "float", "count": 4, "values": [ 0.0, 0.0, 1.0, 1.0 ] }, - { "name": "OutSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] } - ] -} diff --git a/assets/minecraft/shaders/program/transparency.json b/assets/minecraft/shaders/program/transparency.json deleted file mode 100644 index 66b9835d..00000000 --- a/assets/minecraft/shaders/program/transparency.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "blend": { - "func": "add", - "srcrgb": "one", - "dstrgb": "zero" - }, - "vertex": "screenquad", - "fragment": "transparency", - "attributes": [ "Position" ], - "samplers": [ - { "name": "DiffuseSampler" }, - { "name": "DiffuseDepthSampler" }, - { "name": "TranslucentSampler" }, - { "name": "TranslucentDepthSampler" }, - { "name": "ItemEntitySampler" }, - { "name": "ItemEntityDepthSampler" }, - { "name": "ParticlesSampler" }, - { "name": "ParticlesDepthSampler" }, - { "name": "CloudsSampler" }, - { "name": "CloudsDepthSampler" }, - { "name": "WeatherSampler" }, - { "name": "WeatherDepthSampler" } - ], - "uniforms": [ - { "name": "ProjMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] }, - { "name": "OutSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] } - ] -} diff --git a/assets/minecraft/texts/credits.json b/assets/minecraft/texts/credits.json index 0d681b8b..da4b8013 100644 --- a/assets/minecraft/texts/credits.json +++ b/assets/minecraft/texts/credits.json @@ -938,7 +938,7 @@ { "title": "Music composed by", "names": [ - "Aaron Cherof ", + "Aaron Cherof", "Daniel Rosenfeld", "Kumi Tanioka", "Lena Raine" @@ -1235,6 +1235,7 @@ "Mikołaj Błażejewski (Lionbridge)", "Mikołaj Gruźliński (Lionbridge)", "Mikołaj Pawlak (Lionbridge)", + "Mikołaj Szadkowski (Lionbridge)", "Mykhailo Prokhorov (Lionbridge)", "Nicholas Latino", "Nikola Janiak (Lionbridge)", diff --git a/assets/minecraft/textures/block/creaking_heart.png b/assets/minecraft/textures/block/creaking_heart.png new file mode 100644 index 00000000..d8601b79 --- /dev/null +++ b/assets/minecraft/textures/block/creaking_heart.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7be6500bdd6334941dd51f013ad423e355471ad1243f796f9381f83299bb747c +size 230 diff --git a/assets/minecraft/textures/block/creaking_heart_active.png b/assets/minecraft/textures/block/creaking_heart_active.png new file mode 100644 index 00000000..eff5ffc9 --- /dev/null +++ b/assets/minecraft/textures/block/creaking_heart_active.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:26a512d6d47c970cd0a670805e6a59ec556538274002454821b5837b639f09cb +size 236 diff --git a/assets/minecraft/textures/block/creaking_heart_top.png b/assets/minecraft/textures/block/creaking_heart_top.png new file mode 100644 index 00000000..e7c16c53 --- /dev/null +++ b/assets/minecraft/textures/block/creaking_heart_top.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2c98cfb528d113b8b11972466f545daaedf4cd2af1da63abc867c840ac3f4e4c +size 225 diff --git a/assets/minecraft/textures/block/creaking_heart_top_active.png b/assets/minecraft/textures/block/creaking_heart_top_active.png new file mode 100644 index 00000000..9a258f80 --- /dev/null +++ b/assets/minecraft/textures/block/creaking_heart_top_active.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:36ff0c93cffaca71f94b26e7f0d23a882999fe81dbb3d66326db1d93b0e0d5ba +size 240 diff --git a/assets/minecraft/textures/block/pale_hanging_moss.png b/assets/minecraft/textures/block/pale_hanging_moss.png new file mode 100644 index 00000000..b0361d49 --- /dev/null +++ b/assets/minecraft/textures/block/pale_hanging_moss.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:67ce64d50d19c90535016a3bc08341695cdc02150f7f71e7071cbaae7cd76349 +size 184 diff --git a/assets/minecraft/textures/block/pale_hanging_moss_tip.png b/assets/minecraft/textures/block/pale_hanging_moss_tip.png new file mode 100644 index 00000000..927db74a --- /dev/null +++ b/assets/minecraft/textures/block/pale_hanging_moss_tip.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f746fe2fe76437de6035cbf0661a340eeeb14c345f7cc962d6214e063bdc2438 +size 172 diff --git a/assets/minecraft/textures/block/pale_moss_block.png b/assets/minecraft/textures/block/pale_moss_block.png new file mode 100644 index 00000000..38d5ad7d --- /dev/null +++ b/assets/minecraft/textures/block/pale_moss_block.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1b854b4f1696d4a3367f99c637d0dd4c1ceebf28c70f6f84863304bf75e423c9 +size 206 diff --git a/assets/minecraft/textures/block/pale_moss_carpet.png b/assets/minecraft/textures/block/pale_moss_carpet.png new file mode 100644 index 00000000..38d5ad7d --- /dev/null +++ b/assets/minecraft/textures/block/pale_moss_carpet.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1b854b4f1696d4a3367f99c637d0dd4c1ceebf28c70f6f84863304bf75e423c9 +size 206 diff --git a/assets/minecraft/textures/block/pale_moss_carpet_side_small.png b/assets/minecraft/textures/block/pale_moss_carpet_side_small.png new file mode 100644 index 00000000..d08f1171 --- /dev/null +++ b/assets/minecraft/textures/block/pale_moss_carpet_side_small.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:45dafd4f114cc58371f4c8e8252e7a1ab5fbfee9413d1f4fd445092242e3346e +size 158 diff --git a/assets/minecraft/textures/block/pale_moss_carpet_side_tall.png b/assets/minecraft/textures/block/pale_moss_carpet_side_tall.png new file mode 100644 index 00000000..8228ce89 --- /dev/null +++ b/assets/minecraft/textures/block/pale_moss_carpet_side_tall.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d5c91ffde3023d5106918bf1616327429522c1221acfeb17f6634f400efc01d0 +size 202 diff --git a/assets/minecraft/textures/block/pale_oak_door_bottom.png b/assets/minecraft/textures/block/pale_oak_door_bottom.png new file mode 100644 index 00000000..7c162a2d --- /dev/null +++ b/assets/minecraft/textures/block/pale_oak_door_bottom.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:263d795388af54610f76afe6a64f0d60ff15adbd4aa8e00c8ca237eea4fc2978 +size 227 diff --git a/assets/minecraft/textures/block/pale_oak_door_top.png b/assets/minecraft/textures/block/pale_oak_door_top.png new file mode 100644 index 00000000..4ad5848d --- /dev/null +++ b/assets/minecraft/textures/block/pale_oak_door_top.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:25c04fdc28cea14863fae6de4aaccf1fad603414337a0d3824d9eb84565d48bb +size 224 diff --git a/assets/minecraft/textures/block/pale_oak_leaves.png b/assets/minecraft/textures/block/pale_oak_leaves.png new file mode 100644 index 00000000..6edf1513 --- /dev/null +++ b/assets/minecraft/textures/block/pale_oak_leaves.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9b38cfd632fc1d52f6601553d52a06160fc94d73b1832768fd1cb6b4c0182f6e +size 221 diff --git a/assets/minecraft/textures/block/pale_oak_log.png b/assets/minecraft/textures/block/pale_oak_log.png new file mode 100644 index 00000000..0c7d6cc4 --- /dev/null +++ b/assets/minecraft/textures/block/pale_oak_log.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:04c5f2e1f381eea1664b70d44d8e5a041485478f393b2fbb50c721f26e317c96 +size 201 diff --git a/assets/minecraft/textures/block/pale_oak_log_top.png b/assets/minecraft/textures/block/pale_oak_log_top.png new file mode 100644 index 00000000..bd3c65a3 --- /dev/null +++ b/assets/minecraft/textures/block/pale_oak_log_top.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dec26b8cd793955cb048d67e3060f473a3fe73f8ad18045b88b79a4f2dd2da5d +size 231 diff --git a/assets/minecraft/textures/block/pale_oak_planks.png b/assets/minecraft/textures/block/pale_oak_planks.png new file mode 100644 index 00000000..5ebfdd5a --- /dev/null +++ b/assets/minecraft/textures/block/pale_oak_planks.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5813b68f896bd4e68a6748b6987372aa1217e223a9fa0ed666c22ed2a74649c0 +size 202 diff --git a/assets/minecraft/textures/block/pale_oak_sapling.png b/assets/minecraft/textures/block/pale_oak_sapling.png new file mode 100644 index 00000000..a6f6928f --- /dev/null +++ b/assets/minecraft/textures/block/pale_oak_sapling.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c42486070f5f3ef51a9451cb86185f6109eef7289c702fbef6eba487bb15b126 +size 201 diff --git a/assets/minecraft/textures/block/pale_oak_trapdoor.png b/assets/minecraft/textures/block/pale_oak_trapdoor.png new file mode 100644 index 00000000..c564afd1 --- /dev/null +++ b/assets/minecraft/textures/block/pale_oak_trapdoor.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cb81fbccea7d22c56cecf0cfce1d17c1194f83aceb4d4d645c653ee320bf408a +size 188 diff --git a/assets/minecraft/textures/block/redstone_torch.png b/assets/minecraft/textures/block/redstone_torch.png index 05678a83..a41106b4 100644 --- a/assets/minecraft/textures/block/redstone_torch.png +++ b/assets/minecraft/textures/block/redstone_torch.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:51a5b27b4572409b377fb253d80429ffae6a924fa61d7d8796ddce3c6af452be -size 146 +oid sha256:160caba109123055dc002a7471439cb32502cbcb07074524be564782586872a6 +size 150 diff --git a/assets/minecraft/textures/block/stripped_pale_oak_log.png b/assets/minecraft/textures/block/stripped_pale_oak_log.png new file mode 100644 index 00000000..50fc4a6c --- /dev/null +++ b/assets/minecraft/textures/block/stripped_pale_oak_log.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2c9707d43f70423767c2965d7b0a99f360e497dad097cfeaf62c0a659d6ffaaf +size 183 diff --git a/assets/minecraft/textures/block/stripped_pale_oak_log_top.png b/assets/minecraft/textures/block/stripped_pale_oak_log_top.png new file mode 100644 index 00000000..5adbf277 --- /dev/null +++ b/assets/minecraft/textures/block/stripped_pale_oak_log_top.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:98da751ab565233534c8eb0905c9456d4f96e0f02bc09f477bdf07266354271e +size 221 diff --git a/assets/minecraft/textures/entity/bee/bee_stinger.png b/assets/minecraft/textures/entity/bee/bee_stinger.png index 93061188..ebf51be9 100644 --- a/assets/minecraft/textures/entity/bee/bee_stinger.png +++ b/assets/minecraft/textures/entity/bee/bee_stinger.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b43e7a4ee53b4c1dccf7794972863779a1956cac8e3b96af8051a81522f542a4 -size 108 +oid sha256:3e45639f5b47203584dffdc69f0d2faf7567287e28c7f25ca003c1050971102f +size 101 diff --git a/assets/minecraft/textures/entity/blaze.png b/assets/minecraft/textures/entity/blaze.png index 460f34cf..beabd513 100644 --- a/assets/minecraft/textures/entity/blaze.png +++ b/assets/minecraft/textures/entity/blaze.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:55ecacf801ffd66ed3e48c646e0cf6dff75e5970c87369c67637053ac2fad99f -size 368 +oid sha256:ed70f0215135bb836379e068b3b4fe1f2f792d5c6b94f1a4cd48b4f91015eee5 +size 370 diff --git a/assets/minecraft/textures/entity/boat/pale_oak.png b/assets/minecraft/textures/entity/boat/pale_oak.png new file mode 100644 index 00000000..9a8e403e --- /dev/null +++ b/assets/minecraft/textures/entity/boat/pale_oak.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:48f28affb2b81863cec5abbbb7a0bd01bd2ad80f38e31306f37bf72b1be5b7e5 +size 1057 diff --git a/assets/minecraft/textures/entity/chest_boat/pale_oak.png b/assets/minecraft/textures/entity/chest_boat/pale_oak.png new file mode 100644 index 00000000..2faf9eba --- /dev/null +++ b/assets/minecraft/textures/entity/chest_boat/pale_oak.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:74b77ebfb5c78e97771c825f5b9af6230a3647ec495f3649b0fca41deff6c0d3 +size 1927 diff --git a/assets/minecraft/textures/entity/creaking/creaking.png b/assets/minecraft/textures/entity/creaking/creaking.png new file mode 100644 index 00000000..ba493bdc --- /dev/null +++ b/assets/minecraft/textures/entity/creaking/creaking.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bc9a96b9a6f7043e2332a32dccfd468b87de8a472c2cbb445c1305ef8370e080 +size 1164 diff --git a/assets/minecraft/textures/entity/creaking/creaking_eyes.png b/assets/minecraft/textures/entity/creaking/creaking_eyes.png new file mode 100644 index 00000000..3305657f --- /dev/null +++ b/assets/minecraft/textures/entity/creaking/creaking_eyes.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:09595ddcfc80e7852d30532279f9f4930ab635a233de4616d75c18cbb1725016 +size 120 diff --git a/assets/minecraft/textures/entity/horse/armor/horse_armor_diamond.png b/assets/minecraft/textures/entity/equipment/horse_body/diamond.png similarity index 100% rename from assets/minecraft/textures/entity/horse/armor/horse_armor_diamond.png rename to assets/minecraft/textures/entity/equipment/horse_body/diamond.png diff --git a/assets/minecraft/textures/entity/horse/armor/horse_armor_gold.png b/assets/minecraft/textures/entity/equipment/horse_body/gold.png similarity index 100% rename from assets/minecraft/textures/entity/horse/armor/horse_armor_gold.png rename to assets/minecraft/textures/entity/equipment/horse_body/gold.png diff --git a/assets/minecraft/textures/entity/horse/armor/horse_armor_iron.png b/assets/minecraft/textures/entity/equipment/horse_body/iron.png similarity index 100% rename from assets/minecraft/textures/entity/horse/armor/horse_armor_iron.png rename to assets/minecraft/textures/entity/equipment/horse_body/iron.png diff --git a/assets/minecraft/textures/entity/horse/armor/horse_armor_leather.png b/assets/minecraft/textures/entity/equipment/horse_body/leather.png similarity index 100% rename from assets/minecraft/textures/entity/horse/armor/horse_armor_leather.png rename to assets/minecraft/textures/entity/equipment/horse_body/leather.png diff --git a/assets/minecraft/textures/models/armor/chainmail_layer_1.png b/assets/minecraft/textures/entity/equipment/humanoid/chainmail.png similarity index 100% rename from assets/minecraft/textures/models/armor/chainmail_layer_1.png rename to assets/minecraft/textures/entity/equipment/humanoid/chainmail.png diff --git a/assets/minecraft/textures/models/armor/diamond_layer_1.png b/assets/minecraft/textures/entity/equipment/humanoid/diamond.png similarity index 100% rename from assets/minecraft/textures/models/armor/diamond_layer_1.png rename to assets/minecraft/textures/entity/equipment/humanoid/diamond.png diff --git a/assets/minecraft/textures/models/armor/gold_layer_1.png b/assets/minecraft/textures/entity/equipment/humanoid/gold.png similarity index 100% rename from assets/minecraft/textures/models/armor/gold_layer_1.png rename to assets/minecraft/textures/entity/equipment/humanoid/gold.png diff --git a/assets/minecraft/textures/models/armor/iron_layer_1.png b/assets/minecraft/textures/entity/equipment/humanoid/iron.png similarity index 100% rename from assets/minecraft/textures/models/armor/iron_layer_1.png rename to assets/minecraft/textures/entity/equipment/humanoid/iron.png diff --git a/assets/minecraft/textures/models/armor/leather_layer_1.png b/assets/minecraft/textures/entity/equipment/humanoid/leather.png similarity index 100% rename from assets/minecraft/textures/models/armor/leather_layer_1.png rename to assets/minecraft/textures/entity/equipment/humanoid/leather.png diff --git a/assets/minecraft/textures/models/armor/leather_layer_1_overlay.png b/assets/minecraft/textures/entity/equipment/humanoid/leather_overlay.png similarity index 100% rename from assets/minecraft/textures/models/armor/leather_layer_1_overlay.png rename to assets/minecraft/textures/entity/equipment/humanoid/leather_overlay.png diff --git a/assets/minecraft/textures/models/armor/netherite_layer_1.png b/assets/minecraft/textures/entity/equipment/humanoid/netherite.png similarity index 100% rename from assets/minecraft/textures/models/armor/netherite_layer_1.png rename to assets/minecraft/textures/entity/equipment/humanoid/netherite.png diff --git a/assets/minecraft/textures/models/armor/turtle_layer_1.png b/assets/minecraft/textures/entity/equipment/humanoid/turtle_scute.png similarity index 100% rename from assets/minecraft/textures/models/armor/turtle_layer_1.png rename to assets/minecraft/textures/entity/equipment/humanoid/turtle_scute.png diff --git a/assets/minecraft/textures/models/armor/chainmail_layer_2.png b/assets/minecraft/textures/entity/equipment/humanoid_leggings/chainmail.png similarity index 100% rename from assets/minecraft/textures/models/armor/chainmail_layer_2.png rename to assets/minecraft/textures/entity/equipment/humanoid_leggings/chainmail.png diff --git a/assets/minecraft/textures/models/armor/diamond_layer_2.png b/assets/minecraft/textures/entity/equipment/humanoid_leggings/diamond.png similarity index 100% rename from assets/minecraft/textures/models/armor/diamond_layer_2.png rename to assets/minecraft/textures/entity/equipment/humanoid_leggings/diamond.png diff --git a/assets/minecraft/textures/models/armor/gold_layer_2.png b/assets/minecraft/textures/entity/equipment/humanoid_leggings/gold.png similarity index 100% rename from assets/minecraft/textures/models/armor/gold_layer_2.png rename to assets/minecraft/textures/entity/equipment/humanoid_leggings/gold.png diff --git a/assets/minecraft/textures/models/armor/iron_layer_2.png b/assets/minecraft/textures/entity/equipment/humanoid_leggings/iron.png similarity index 100% rename from assets/minecraft/textures/models/armor/iron_layer_2.png rename to assets/minecraft/textures/entity/equipment/humanoid_leggings/iron.png diff --git a/assets/minecraft/textures/models/armor/leather_layer_2.png b/assets/minecraft/textures/entity/equipment/humanoid_leggings/leather.png similarity index 100% rename from assets/minecraft/textures/models/armor/leather_layer_2.png rename to assets/minecraft/textures/entity/equipment/humanoid_leggings/leather.png diff --git a/assets/minecraft/textures/models/armor/leather_layer_2_overlay.png b/assets/minecraft/textures/entity/equipment/humanoid_leggings/leather_overlay.png similarity index 100% rename from assets/minecraft/textures/models/armor/leather_layer_2_overlay.png rename to assets/minecraft/textures/entity/equipment/humanoid_leggings/leather_overlay.png diff --git a/assets/minecraft/textures/models/armor/netherite_layer_2.png b/assets/minecraft/textures/entity/equipment/humanoid_leggings/netherite.png similarity index 100% rename from assets/minecraft/textures/models/armor/netherite_layer_2.png rename to assets/minecraft/textures/entity/equipment/humanoid_leggings/netherite.png diff --git a/assets/minecraft/textures/entity/llama/decor/black.png b/assets/minecraft/textures/entity/equipment/llama_body/black.png similarity index 100% rename from assets/minecraft/textures/entity/llama/decor/black.png rename to assets/minecraft/textures/entity/equipment/llama_body/black.png diff --git a/assets/minecraft/textures/entity/llama/decor/blue.png b/assets/minecraft/textures/entity/equipment/llama_body/blue.png similarity index 100% rename from assets/minecraft/textures/entity/llama/decor/blue.png rename to assets/minecraft/textures/entity/equipment/llama_body/blue.png diff --git a/assets/minecraft/textures/entity/llama/decor/brown.png b/assets/minecraft/textures/entity/equipment/llama_body/brown.png similarity index 100% rename from assets/minecraft/textures/entity/llama/decor/brown.png rename to assets/minecraft/textures/entity/equipment/llama_body/brown.png diff --git a/assets/minecraft/textures/entity/llama/decor/cyan.png b/assets/minecraft/textures/entity/equipment/llama_body/cyan.png similarity index 100% rename from assets/minecraft/textures/entity/llama/decor/cyan.png rename to assets/minecraft/textures/entity/equipment/llama_body/cyan.png diff --git a/assets/minecraft/textures/entity/llama/decor/gray.png b/assets/minecraft/textures/entity/equipment/llama_body/gray.png similarity index 100% rename from assets/minecraft/textures/entity/llama/decor/gray.png rename to assets/minecraft/textures/entity/equipment/llama_body/gray.png diff --git a/assets/minecraft/textures/entity/llama/decor/green.png b/assets/minecraft/textures/entity/equipment/llama_body/green.png similarity index 100% rename from assets/minecraft/textures/entity/llama/decor/green.png rename to assets/minecraft/textures/entity/equipment/llama_body/green.png diff --git a/assets/minecraft/textures/entity/llama/decor/light_blue.png b/assets/minecraft/textures/entity/equipment/llama_body/light_blue.png similarity index 100% rename from assets/minecraft/textures/entity/llama/decor/light_blue.png rename to assets/minecraft/textures/entity/equipment/llama_body/light_blue.png diff --git a/assets/minecraft/textures/entity/llama/decor/light_gray.png b/assets/minecraft/textures/entity/equipment/llama_body/light_gray.png similarity index 100% rename from assets/minecraft/textures/entity/llama/decor/light_gray.png rename to assets/minecraft/textures/entity/equipment/llama_body/light_gray.png diff --git a/assets/minecraft/textures/entity/llama/decor/lime.png b/assets/minecraft/textures/entity/equipment/llama_body/lime.png similarity index 100% rename from assets/minecraft/textures/entity/llama/decor/lime.png rename to assets/minecraft/textures/entity/equipment/llama_body/lime.png diff --git a/assets/minecraft/textures/entity/llama/decor/magenta.png b/assets/minecraft/textures/entity/equipment/llama_body/magenta.png similarity index 100% rename from assets/minecraft/textures/entity/llama/decor/magenta.png rename to assets/minecraft/textures/entity/equipment/llama_body/magenta.png diff --git a/assets/minecraft/textures/entity/llama/decor/orange.png b/assets/minecraft/textures/entity/equipment/llama_body/orange.png similarity index 100% rename from assets/minecraft/textures/entity/llama/decor/orange.png rename to assets/minecraft/textures/entity/equipment/llama_body/orange.png diff --git a/assets/minecraft/textures/entity/llama/decor/pink.png b/assets/minecraft/textures/entity/equipment/llama_body/pink.png similarity index 100% rename from assets/minecraft/textures/entity/llama/decor/pink.png rename to assets/minecraft/textures/entity/equipment/llama_body/pink.png diff --git a/assets/minecraft/textures/entity/llama/decor/purple.png b/assets/minecraft/textures/entity/equipment/llama_body/purple.png similarity index 100% rename from assets/minecraft/textures/entity/llama/decor/purple.png rename to assets/minecraft/textures/entity/equipment/llama_body/purple.png diff --git a/assets/minecraft/textures/entity/llama/decor/red.png b/assets/minecraft/textures/entity/equipment/llama_body/red.png similarity index 100% rename from assets/minecraft/textures/entity/llama/decor/red.png rename to assets/minecraft/textures/entity/equipment/llama_body/red.png diff --git a/assets/minecraft/textures/entity/llama/decor/trader_llama.png b/assets/minecraft/textures/entity/equipment/llama_body/trader_llama.png similarity index 100% rename from assets/minecraft/textures/entity/llama/decor/trader_llama.png rename to assets/minecraft/textures/entity/equipment/llama_body/trader_llama.png diff --git a/assets/minecraft/textures/entity/llama/decor/white.png b/assets/minecraft/textures/entity/equipment/llama_body/white.png similarity index 100% rename from assets/minecraft/textures/entity/llama/decor/white.png rename to assets/minecraft/textures/entity/equipment/llama_body/white.png diff --git a/assets/minecraft/textures/entity/llama/decor/yellow.png b/assets/minecraft/textures/entity/equipment/llama_body/yellow.png similarity index 100% rename from assets/minecraft/textures/entity/llama/decor/yellow.png rename to assets/minecraft/textures/entity/equipment/llama_body/yellow.png diff --git a/assets/minecraft/textures/entity/elytra.png b/assets/minecraft/textures/entity/equipment/wings/elytra.png similarity index 100% rename from assets/minecraft/textures/entity/elytra.png rename to assets/minecraft/textures/entity/equipment/wings/elytra.png diff --git a/assets/minecraft/textures/entity/wolf/wolf_armor.png b/assets/minecraft/textures/entity/equipment/wolf_body/armadillo_scute.png similarity index 100% rename from assets/minecraft/textures/entity/wolf/wolf_armor.png rename to assets/minecraft/textures/entity/equipment/wolf_body/armadillo_scute.png diff --git a/assets/minecraft/textures/entity/wolf/wolf_armor_overlay.png b/assets/minecraft/textures/entity/equipment/wolf_body/armadillo_scute_overlay.png similarity index 100% rename from assets/minecraft/textures/entity/wolf/wolf_armor_overlay.png rename to assets/minecraft/textures/entity/equipment/wolf_body/armadillo_scute_overlay.png diff --git a/assets/minecraft/textures/entity/fish/tropical_a_pattern_1.png b/assets/minecraft/textures/entity/fish/tropical_a_pattern_1.png index e3589bff..62a0fc8e 100644 --- a/assets/minecraft/textures/entity/fish/tropical_a_pattern_1.png +++ b/assets/minecraft/textures/entity/fish/tropical_a_pattern_1.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b2b5c7291bf2921d4b57b87fe87e07733805a2784f60481ee595fc9681dd9784 -size 146 +oid sha256:95201a0b3a1787e53a7b96e943cce0a237e5e23513b2cd7f488b776c6d2f1b58 +size 135 diff --git a/assets/minecraft/textures/entity/fish/tropical_a_pattern_2.png b/assets/minecraft/textures/entity/fish/tropical_a_pattern_2.png index 6d055702..47bd06d9 100644 --- a/assets/minecraft/textures/entity/fish/tropical_a_pattern_2.png +++ b/assets/minecraft/textures/entity/fish/tropical_a_pattern_2.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:24bf899f4e1ec7f798f00dc40e03a093dcfd713e2567bc779e6f15e470020ab9 -size 165 +oid sha256:763b06293f37f2894f530c0a094450272b3e07c52ca804f89981b6b21b685218 +size 147 diff --git a/assets/minecraft/textures/entity/fish/tropical_a_pattern_3.png b/assets/minecraft/textures/entity/fish/tropical_a_pattern_3.png index db08ebe4..f32ad573 100644 --- a/assets/minecraft/textures/entity/fish/tropical_a_pattern_3.png +++ b/assets/minecraft/textures/entity/fish/tropical_a_pattern_3.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:05980b41d2bd453a4487a9b82bf132a0e6fb92d084b899c48d4022bf82b0f416 -size 170 +oid sha256:cbe3fb903267ca0a34a336882ffb6873f0de25193207ec315e7bf349c2d95f68 +size 148 diff --git a/assets/minecraft/textures/entity/fish/tropical_a_pattern_4.png b/assets/minecraft/textures/entity/fish/tropical_a_pattern_4.png index 62866174..3df81f61 100644 --- a/assets/minecraft/textures/entity/fish/tropical_a_pattern_4.png +++ b/assets/minecraft/textures/entity/fish/tropical_a_pattern_4.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9d9c965a3df1eaa21ffc8577c13cc14a541eca1e85b113a0babe03e504883c16 -size 160 +oid sha256:f23f43a865bcc805c2597b0aecc3a017571b134cbc7c188836c25e5013793ef0 +size 151 diff --git a/assets/minecraft/textures/entity/fish/tropical_a_pattern_5.png b/assets/minecraft/textures/entity/fish/tropical_a_pattern_5.png index 668b00b8..cd972bbc 100644 --- a/assets/minecraft/textures/entity/fish/tropical_a_pattern_5.png +++ b/assets/minecraft/textures/entity/fish/tropical_a_pattern_5.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d3951e30293ffd68814b4cc0c48746c07eb9bc0923ae7f7a0b44127a8558f8a7 -size 206 +oid sha256:0fb25e99437ee93a0041dddfd59d73908d60196ba05b4f2d696e2e3bd574a128 +size 152 diff --git a/assets/minecraft/textures/entity/fish/tropical_a_pattern_6.png b/assets/minecraft/textures/entity/fish/tropical_a_pattern_6.png index 24c75972..3498d8ae 100644 --- a/assets/minecraft/textures/entity/fish/tropical_a_pattern_6.png +++ b/assets/minecraft/textures/entity/fish/tropical_a_pattern_6.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:85c6555cdd6c0c7e71dbe226fca4040210b7818f291a703a00d1af03d302055a -size 162 +oid sha256:a412bbc294921fe7d163b50fc1f57c830f2246464f372d9583f45879e59d16f6 +size 152 diff --git a/assets/minecraft/textures/entity/fish/tropical_b_pattern_1.png b/assets/minecraft/textures/entity/fish/tropical_b_pattern_1.png index 236cb472..d63bdc08 100644 --- a/assets/minecraft/textures/entity/fish/tropical_b_pattern_1.png +++ b/assets/minecraft/textures/entity/fish/tropical_b_pattern_1.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:53fcf2852122c274c747d60f39875e7711854eb4476918d669828e6c0588a86d -size 180 +oid sha256:012e00a09ac340cf3532ad2d7ffbeac4d3a683c9d1baa03299f72e94256c49e8 +size 170 diff --git a/assets/minecraft/textures/entity/fish/tropical_b_pattern_2.png b/assets/minecraft/textures/entity/fish/tropical_b_pattern_2.png index 6733ab8b..60e08df2 100644 --- a/assets/minecraft/textures/entity/fish/tropical_b_pattern_2.png +++ b/assets/minecraft/textures/entity/fish/tropical_b_pattern_2.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:97c13669538a653475c95683dfb3c4190df33b3f3157a647a49764f6c056281e -size 184 +oid sha256:14c7d7b73df038a4794e856290608988a92e535ec641b28c1464df3a30cc748f +size 172 diff --git a/assets/minecraft/textures/entity/fish/tropical_b_pattern_3.png b/assets/minecraft/textures/entity/fish/tropical_b_pattern_3.png index 25b3072f..e276ea73 100644 --- a/assets/minecraft/textures/entity/fish/tropical_b_pattern_3.png +++ b/assets/minecraft/textures/entity/fish/tropical_b_pattern_3.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d5b2da7df865cfa79730b8e7387a20855396b46a24d6034c3b9e7f8f8327fc99 -size 187 +oid sha256:2b59c6d785a5a4d8ef7972b2de04e38b9e858936a1f10f903740210ebfb64634 +size 174 diff --git a/assets/minecraft/textures/entity/fish/tropical_b_pattern_4.png b/assets/minecraft/textures/entity/fish/tropical_b_pattern_4.png index 402f52b9..30fe48d6 100644 --- a/assets/minecraft/textures/entity/fish/tropical_b_pattern_4.png +++ b/assets/minecraft/textures/entity/fish/tropical_b_pattern_4.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:166bbb8e7c50861f1f6738be098e313e91e6a7f468a5e9ff984ef7b145c7b850 -size 194 +oid sha256:4bf34acff34569d228d63b73c4dfa2322773742a0622ef212884891ede5f32aa +size 178 diff --git a/assets/minecraft/textures/entity/fish/tropical_b_pattern_5.png b/assets/minecraft/textures/entity/fish/tropical_b_pattern_5.png index 43d5a9d9..e3a06d75 100644 --- a/assets/minecraft/textures/entity/fish/tropical_b_pattern_5.png +++ b/assets/minecraft/textures/entity/fish/tropical_b_pattern_5.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:30569d3fb325fbf4f8cc06159b341bf81d69739b309fb5a9c4da09e4079ad6c1 -size 175 +oid sha256:df577694472da03a35fc6391357b708d961a8f71f2da82bc28369038f12c22ba +size 166 diff --git a/assets/minecraft/textures/entity/fish/tropical_b_pattern_6.png b/assets/minecraft/textures/entity/fish/tropical_b_pattern_6.png index 7539e1a5..095aaeb9 100644 --- a/assets/minecraft/textures/entity/fish/tropical_b_pattern_6.png +++ b/assets/minecraft/textures/entity/fish/tropical_b_pattern_6.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:70118d99af0879658e05f0dccb02ac00cfa8b3158f969f5bf8111fb3c4efef23 -size 179 +oid sha256:bd0fd1a6acec35c98b381669fb7d4c092ba33ce6095ddda7893820cfee3d223f +size 168 diff --git a/assets/minecraft/textures/entity/projectiles/arrow.png b/assets/minecraft/textures/entity/projectiles/arrow.png index 369ed173..61006abc 100644 --- a/assets/minecraft/textures/entity/projectiles/arrow.png +++ b/assets/minecraft/textures/entity/projectiles/arrow.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:630483313e847f86c5af6f73b572a03fc0b943e99c780505cbfb14c8ec299553 -size 170 +oid sha256:4208c5d953ebaa8451c502275309759363592fbf21e3896854babc2c569874fa +size 189 diff --git a/assets/minecraft/textures/entity/projectiles/spectral_arrow.png b/assets/minecraft/textures/entity/projectiles/spectral_arrow.png index 03fcc3e9..6e003438 100644 --- a/assets/minecraft/textures/entity/projectiles/spectral_arrow.png +++ b/assets/minecraft/textures/entity/projectiles/spectral_arrow.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:deff2b4f82393efac5d344b8aa0e420f82d0f854cfc525e8672d973982137f55 -size 192 +oid sha256:4cd81c03e8e3229b646e334a70301dfeda7d92307261510da0f3e1c97c995e01 +size 170 diff --git a/assets/minecraft/textures/entity/projectiles/tipped_arrow.png b/assets/minecraft/textures/entity/projectiles/tipped_arrow.png index 369ed173..6f0a24f9 100644 --- a/assets/minecraft/textures/entity/projectiles/tipped_arrow.png +++ b/assets/minecraft/textures/entity/projectiles/tipped_arrow.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:630483313e847f86c5af6f73b572a03fc0b943e99c780505cbfb14c8ec299553 -size 170 +oid sha256:98db9e24851f1cb3ab8bf67a7858d0b7765f58eb4bec7276d60233ee5a53af68 +size 189 diff --git a/assets/minecraft/textures/entity/signs/hanging/pale_oak.png b/assets/minecraft/textures/entity/signs/hanging/pale_oak.png new file mode 100644 index 00000000..13d8267a --- /dev/null +++ b/assets/minecraft/textures/entity/signs/hanging/pale_oak.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d0b7766d12a383dcce32dca2bf158ff876a02cb30737cd49b74cb0f259984418 +size 409 diff --git a/assets/minecraft/textures/entity/signs/pale_oak.png b/assets/minecraft/textures/entity/signs/pale_oak.png new file mode 100644 index 00000000..173fd810 --- /dev/null +++ b/assets/minecraft/textures/entity/signs/pale_oak.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d83dc5bac3be05d0783f1aca78800d63f9e026509d2c18b8ded4f9571f019bee +size 432 diff --git a/assets/minecraft/textures/gui/hanging_signs/pale_oak.png b/assets/minecraft/textures/gui/hanging_signs/pale_oak.png new file mode 100644 index 00000000..7b39904e --- /dev/null +++ b/assets/minecraft/textures/gui/hanging_signs/pale_oak.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ccaf0caffffba1ee8f920fa12dfb34bd6e2ff5986836cb5e8e7aee021447a230 +size 222 diff --git a/assets/minecraft/textures/gui/sprites/container/bundle/background.png b/assets/minecraft/textures/gui/sprites/container/bundle/background.png deleted file mode 100644 index 76463c36..00000000 --- a/assets/minecraft/textures/gui/sprites/container/bundle/background.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:717040a135c8013eb5e0985c029fa94474081b5cbb8d5d23c7b66b45bbd47207 -size 90 diff --git a/assets/minecraft/textures/gui/sprites/container/bundle/blocked_slot.png b/assets/minecraft/textures/gui/sprites/container/bundle/blocked_slot.png deleted file mode 100644 index 7da50e4f..00000000 --- a/assets/minecraft/textures/gui/sprites/container/bundle/blocked_slot.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:4600bacb950e8c62d74f82341b3aa3f95278bb273278e2b9fb7c2a5b74a238f7 -size 170 diff --git a/assets/minecraft/textures/gui/sprites/container/bundle/bundle_progressbar_border.png b/assets/minecraft/textures/gui/sprites/container/bundle/bundle_progressbar_border.png new file mode 100644 index 00000000..5af0f00a --- /dev/null +++ b/assets/minecraft/textures/gui/sprites/container/bundle/bundle_progressbar_border.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b6dbede505e3063eaffbde3a7819feaa19132808ebbb9ed703db57f9ebafbcf4 +size 112 diff --git a/assets/minecraft/textures/gui/sprites/container/bundle/bundle_progressbar_border.png.mcmeta b/assets/minecraft/textures/gui/sprites/container/bundle/bundle_progressbar_border.png.mcmeta new file mode 100644 index 00000000..406e48d4 --- /dev/null +++ b/assets/minecraft/textures/gui/sprites/container/bundle/bundle_progressbar_border.png.mcmeta @@ -0,0 +1,10 @@ +{ + "gui": { + "scaling": { + "type": "nine_slice", + "width": 12, + "height": 12, + "border": 2 + } + } +} diff --git a/assets/minecraft/textures/gui/sprites/container/bundle/bundle_progressbar_fill.png b/assets/minecraft/textures/gui/sprites/container/bundle/bundle_progressbar_fill.png new file mode 100644 index 00000000..5e571fb2 --- /dev/null +++ b/assets/minecraft/textures/gui/sprites/container/bundle/bundle_progressbar_fill.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:10cfb8174fadadd84cb4ef0842ed0386cd506efce40c159b5df7665b5040d628 +size 94 diff --git a/assets/minecraft/textures/gui/sprites/container/bundle/bundle_progressbar_fill.png.mcmeta b/assets/minecraft/textures/gui/sprites/container/bundle/bundle_progressbar_fill.png.mcmeta new file mode 100644 index 00000000..c9e83e5c --- /dev/null +++ b/assets/minecraft/textures/gui/sprites/container/bundle/bundle_progressbar_fill.png.mcmeta @@ -0,0 +1,10 @@ +{ + "gui": { + "scaling": { + "type": "nine_slice", + "width": 6, + "height": 6, + "border": 2 + } + } +} diff --git a/assets/minecraft/textures/gui/sprites/container/bundle/bundle_progressbar_full.png b/assets/minecraft/textures/gui/sprites/container/bundle/bundle_progressbar_full.png new file mode 100644 index 00000000..b424e0e3 --- /dev/null +++ b/assets/minecraft/textures/gui/sprites/container/bundle/bundle_progressbar_full.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7076a7a034067d7dfff4d74f92c413251e8bbc4897cbc484c234b66b044660d4 +size 94 diff --git a/assets/minecraft/textures/gui/sprites/container/bundle/bundle_progressbar_full.png.mcmeta b/assets/minecraft/textures/gui/sprites/container/bundle/bundle_progressbar_full.png.mcmeta new file mode 100644 index 00000000..c9e83e5c --- /dev/null +++ b/assets/minecraft/textures/gui/sprites/container/bundle/bundle_progressbar_full.png.mcmeta @@ -0,0 +1,10 @@ +{ + "gui": { + "scaling": { + "type": "nine_slice", + "width": 6, + "height": 6, + "border": 2 + } + } +} diff --git a/assets/minecraft/textures/gui/sprites/container/bundle/slot.png b/assets/minecraft/textures/gui/sprites/container/bundle/slot.png deleted file mode 100644 index 5b801974..00000000 --- a/assets/minecraft/textures/gui/sprites/container/bundle/slot.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:d17b701f5fe688fd71607bf3a2600ce381e9ca4188a6d430c6e15347bbab0156 -size 123 diff --git a/assets/minecraft/textures/gui/sprites/container/bundle/slot_background.png b/assets/minecraft/textures/gui/sprites/container/bundle/slot_background.png new file mode 100644 index 00000000..aff884c2 --- /dev/null +++ b/assets/minecraft/textures/gui/sprites/container/bundle/slot_background.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c56d1a3124b838baf20e7022fe76e94f5d15cbe6eadbd6060ac374107de51965 +size 111 diff --git a/assets/minecraft/textures/gui/sprites/container/bundle/slot_highlight_back.png b/assets/minecraft/textures/gui/sprites/container/bundle/slot_highlight_back.png new file mode 100644 index 00000000..3fb006e3 --- /dev/null +++ b/assets/minecraft/textures/gui/sprites/container/bundle/slot_highlight_back.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:53002d882dc48b6d4d3727a9f64df361ba97d12a53e00a3db4f7bf24e389f226 +size 96 diff --git a/assets/minecraft/textures/gui/sprites/container/bundle/background.png.mcmeta b/assets/minecraft/textures/gui/sprites/container/bundle/slot_highlight_back.png.mcmeta similarity index 68% rename from assets/minecraft/textures/gui/sprites/container/bundle/background.png.mcmeta rename to assets/minecraft/textures/gui/sprites/container/bundle/slot_highlight_back.png.mcmeta index 2d596bf6..21fe5868 100644 --- a/assets/minecraft/textures/gui/sprites/container/bundle/background.png.mcmeta +++ b/assets/minecraft/textures/gui/sprites/container/bundle/slot_highlight_back.png.mcmeta @@ -2,8 +2,8 @@ "gui": { "scaling": { "type": "nine_slice", - "width": 32, - "height": 32, + "width": 24, + "height": 24, "border": 4 } } diff --git a/assets/minecraft/textures/gui/sprites/container/bundle/slot_highlight_front.png b/assets/minecraft/textures/gui/sprites/container/bundle/slot_highlight_front.png new file mode 100644 index 00000000..41a55e37 --- /dev/null +++ b/assets/minecraft/textures/gui/sprites/container/bundle/slot_highlight_front.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5eaada2b194107aa6a3efa9927b12473feaa73a2881c5dec7e0773adc7d38519 +size 96 diff --git a/assets/minecraft/textures/gui/sprites/container/bundle/slot_highlight_front.png.mcmeta b/assets/minecraft/textures/gui/sprites/container/bundle/slot_highlight_front.png.mcmeta new file mode 100644 index 00000000..21fe5868 --- /dev/null +++ b/assets/minecraft/textures/gui/sprites/container/bundle/slot_highlight_front.png.mcmeta @@ -0,0 +1,10 @@ +{ + "gui": { + "scaling": { + "type": "nine_slice", + "width": 24, + "height": 24, + "border": 4 + } + } +} diff --git a/assets/minecraft/textures/gui/sprites/container/loom/pattern_slot.png b/assets/minecraft/textures/gui/sprites/container/loom/pattern_slot.png index 908a5d73..395cbb4a 100644 --- a/assets/minecraft/textures/gui/sprites/container/loom/pattern_slot.png +++ b/assets/minecraft/textures/gui/sprites/container/loom/pattern_slot.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:413102a00f33215cb1d3595f1e1ed894251ae81e6eaa039f57ea338cc43debea -size 129 +oid sha256:59d8dd78dcc044cf67ffff8c4b5d2da84abea2177d8062917fcea6246b8b9b94 +size 114 diff --git a/assets/minecraft/textures/gui/sprites/container/slot_highlight_back.png b/assets/minecraft/textures/gui/sprites/container/slot_highlight_back.png new file mode 100644 index 00000000..a6060dd4 --- /dev/null +++ b/assets/minecraft/textures/gui/sprites/container/slot_highlight_back.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:05c9829a17371e03ccfd78c881cc96472dbe7b44bb8c1c3e375ab8713aa72118 +size 107 diff --git a/assets/minecraft/textures/gui/sprites/container/slot_highlight_back.png.mcmeta b/assets/minecraft/textures/gui/sprites/container/slot_highlight_back.png.mcmeta new file mode 100644 index 00000000..21fe5868 --- /dev/null +++ b/assets/minecraft/textures/gui/sprites/container/slot_highlight_back.png.mcmeta @@ -0,0 +1,10 @@ +{ + "gui": { + "scaling": { + "type": "nine_slice", + "width": 24, + "height": 24, + "border": 4 + } + } +} diff --git a/assets/minecraft/textures/gui/sprites/container/slot_highlight_front.png b/assets/minecraft/textures/gui/sprites/container/slot_highlight_front.png new file mode 100644 index 00000000..16c50790 --- /dev/null +++ b/assets/minecraft/textures/gui/sprites/container/slot_highlight_front.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5320308b875335b0d9a872f84dc5d2294d09ca84917f7c9dd28ee10e4d655bb9 +size 107 diff --git a/assets/minecraft/textures/gui/sprites/container/slot_highlight_front.png.mcmeta b/assets/minecraft/textures/gui/sprites/container/slot_highlight_front.png.mcmeta new file mode 100644 index 00000000..21fe5868 --- /dev/null +++ b/assets/minecraft/textures/gui/sprites/container/slot_highlight_front.png.mcmeta @@ -0,0 +1,10 @@ +{ + "gui": { + "scaling": { + "type": "nine_slice", + "width": 24, + "height": 24, + "border": 4 + } + } +} diff --git a/assets/minecraft/textures/gui/sprites/hud/air_empty.png b/assets/minecraft/textures/gui/sprites/hud/air_empty.png new file mode 100644 index 00000000..52510797 --- /dev/null +++ b/assets/minecraft/textures/gui/sprites/hud/air_empty.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:15a130e1bc9a7fcea69345961f0a395d678752c050350f83428c469c370bd2a1 +size 121 diff --git a/assets/minecraft/textures/gui/sprites/tooltip/background.png b/assets/minecraft/textures/gui/sprites/tooltip/background.png new file mode 100644 index 00000000..6c5417a2 --- /dev/null +++ b/assets/minecraft/textures/gui/sprites/tooltip/background.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:844aa8f558db719d252114b4712ad5977d4c088e7e0df8fc9ed93706bfe4e0c4 +size 128 diff --git a/assets/minecraft/textures/gui/sprites/tooltip/background.png.mcmeta b/assets/minecraft/textures/gui/sprites/tooltip/background.png.mcmeta new file mode 100644 index 00000000..a0bd7e24 --- /dev/null +++ b/assets/minecraft/textures/gui/sprites/tooltip/background.png.mcmeta @@ -0,0 +1,10 @@ +{ + "gui": { + "scaling": { + "type": "nine_slice", + "width": 100, + "height": 100, + "border": 9 + } + } +} diff --git a/assets/minecraft/textures/gui/sprites/tooltip/frame.png b/assets/minecraft/textures/gui/sprites/tooltip/frame.png new file mode 100644 index 00000000..81395bc5 --- /dev/null +++ b/assets/minecraft/textures/gui/sprites/tooltip/frame.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b9be0c1336e35fa59a8e5b4f01ebe2ff417f682a776c2e5560bee195e619f151 +size 592 diff --git a/assets/minecraft/textures/gui/sprites/tooltip/frame.png.mcmeta b/assets/minecraft/textures/gui/sprites/tooltip/frame.png.mcmeta new file mode 100644 index 00000000..e107d241 --- /dev/null +++ b/assets/minecraft/textures/gui/sprites/tooltip/frame.png.mcmeta @@ -0,0 +1,11 @@ +{ + "gui": { + "scaling": { + "type": "nine_slice", + "width": 100, + "height": 100, + "border": 10, + "stretch_inner": true + } + } +} diff --git a/assets/minecraft/textures/item/black_bundle.png b/assets/minecraft/textures/item/black_bundle.png new file mode 100644 index 00000000..340acbf1 --- /dev/null +++ b/assets/minecraft/textures/item/black_bundle.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ef3ddfb9fff7659e911d2ae08507f0f375952c5c2f35eafad24ebb61e66f01ec +size 206 diff --git a/assets/minecraft/textures/item/black_bundle_open_back.png b/assets/minecraft/textures/item/black_bundle_open_back.png new file mode 100644 index 00000000..1ca1c9e8 --- /dev/null +++ b/assets/minecraft/textures/item/black_bundle_open_back.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:41457dcdf16b33e60a2fabbd44e5204f696c4b154d57d56297e6a65d8b38f338 +size 152 diff --git a/assets/minecraft/textures/item/black_bundle_open_front.png b/assets/minecraft/textures/item/black_bundle_open_front.png new file mode 100644 index 00000000..e89c48bb --- /dev/null +++ b/assets/minecraft/textures/item/black_bundle_open_front.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:47573721a22bbc59e4ff33c8b0b00eb8fb535d7d020943651f642f39b82655d9 +size 191 diff --git a/assets/minecraft/textures/item/blue_bundle.png b/assets/minecraft/textures/item/blue_bundle.png new file mode 100644 index 00000000..05db8589 --- /dev/null +++ b/assets/minecraft/textures/item/blue_bundle.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:36cedd32aff0de7f2e0a6a19d4776fa4e977a9adeefe1d247273f477759d9c5c +size 206 diff --git a/assets/minecraft/textures/item/blue_bundle_open_back.png b/assets/minecraft/textures/item/blue_bundle_open_back.png new file mode 100644 index 00000000..8c0496c1 --- /dev/null +++ b/assets/minecraft/textures/item/blue_bundle_open_back.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:31c41d76bf47cb1771b6a54ef6e3e0ad0892fdee8b2292bf8214de9667e03948 +size 152 diff --git a/assets/minecraft/textures/item/blue_bundle_open_front.png b/assets/minecraft/textures/item/blue_bundle_open_front.png new file mode 100644 index 00000000..cd159f82 --- /dev/null +++ b/assets/minecraft/textures/item/blue_bundle_open_front.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9c74ea271b2654846efc44bb551bcb040dd782c25c6cc43cd9e58dcd992f0e33 +size 191 diff --git a/assets/minecraft/textures/item/bordure_indented_banner_pattern.png b/assets/minecraft/textures/item/bordure_indented_banner_pattern.png new file mode 100644 index 00000000..168a9851 --- /dev/null +++ b/assets/minecraft/textures/item/bordure_indented_banner_pattern.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0c3000745e674c0b85462a176fcdfdd7fb4313828bd2716f8ab6b8cebe72bcc9 +size 205 diff --git a/assets/minecraft/textures/item/brown_bundle.png b/assets/minecraft/textures/item/brown_bundle.png new file mode 100644 index 00000000..d526175f --- /dev/null +++ b/assets/minecraft/textures/item/brown_bundle.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ec0101aa75abf005da275d6a17ea2f4957ff4b0ab52ce0d0dc3c38da913dc2e2 +size 217 diff --git a/assets/minecraft/textures/item/brown_bundle_open_back.png b/assets/minecraft/textures/item/brown_bundle_open_back.png new file mode 100644 index 00000000..57b4fece --- /dev/null +++ b/assets/minecraft/textures/item/brown_bundle_open_back.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:43bf977f35ddb370230c4b2d5d5ac38c0b80667ebe0ef0763329a25dfa34cbab +size 162 diff --git a/assets/minecraft/textures/item/brown_bundle_open_front.png b/assets/minecraft/textures/item/brown_bundle_open_front.png new file mode 100644 index 00000000..aa086cb2 --- /dev/null +++ b/assets/minecraft/textures/item/brown_bundle_open_front.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9b3783b255e0e87940936a63a46eaa74f8dc79698bfe1082772d32ca832cd204 +size 197 diff --git a/assets/minecraft/textures/item/bundle.png b/assets/minecraft/textures/item/bundle.png index 0a0b6468..5169779c 100644 --- a/assets/minecraft/textures/item/bundle.png +++ b/assets/minecraft/textures/item/bundle.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:357b6eb5f03aceb375157a3bc371b99f92c3bc743e87c538ddccaebc28460315 -size 232 +oid sha256:0eb1ea87436ddbe11abea3511632c6d777eb0d1bf24db4f592268d77b2523e9c +size 206 diff --git a/assets/minecraft/textures/item/bundle_filled.png b/assets/minecraft/textures/item/bundle_filled.png deleted file mode 100644 index 5169779c..00000000 --- a/assets/minecraft/textures/item/bundle_filled.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:0eb1ea87436ddbe11abea3511632c6d777eb0d1bf24db4f592268d77b2523e9c -size 206 diff --git a/assets/minecraft/textures/item/bundle_open_back.png b/assets/minecraft/textures/item/bundle_open_back.png new file mode 100644 index 00000000..207106f0 --- /dev/null +++ b/assets/minecraft/textures/item/bundle_open_back.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c5e43b183b499622a1ed70f229ffb0aee6e06eabbf4549ba274307dd02144d1e +size 152 diff --git a/assets/minecraft/textures/item/bundle_open_front.png b/assets/minecraft/textures/item/bundle_open_front.png new file mode 100644 index 00000000..6e5e2c2e --- /dev/null +++ b/assets/minecraft/textures/item/bundle_open_front.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5fec97f3abc6d15e1f341751e59c255fd01c693195b2fc9af8f724b45c1a4270 +size 191 diff --git a/assets/minecraft/textures/item/creeper_banner_pattern.png b/assets/minecraft/textures/item/creeper_banner_pattern.png index f0521184..4d3a2cf5 100644 --- a/assets/minecraft/textures/item/creeper_banner_pattern.png +++ b/assets/minecraft/textures/item/creeper_banner_pattern.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:624275c8d974c76b26ff29bc6e84262086c16b87c8c23bc3d02a0d725ef86b03 -size 192 +oid sha256:8d0d81b5b752d1555cdf3e243d9bd61a9e662e82ccdab42067ba78698fb26dee +size 210 diff --git a/assets/minecraft/textures/item/cyan_bundle.png b/assets/minecraft/textures/item/cyan_bundle.png new file mode 100644 index 00000000..52df2a13 --- /dev/null +++ b/assets/minecraft/textures/item/cyan_bundle.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0e628d59b7e160fe5d1c1d74dc9914df4c4433343fe964aca459ae5ee4120ff2 +size 206 diff --git a/assets/minecraft/textures/item/cyan_bundle_open_back.png b/assets/minecraft/textures/item/cyan_bundle_open_back.png new file mode 100644 index 00000000..c81df8f3 --- /dev/null +++ b/assets/minecraft/textures/item/cyan_bundle_open_back.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6a7f4e0b28c1f0f890b682828902803842698c54a4311179909820f1f1cc8fb6 +size 152 diff --git a/assets/minecraft/textures/item/cyan_bundle_open_front.png b/assets/minecraft/textures/item/cyan_bundle_open_front.png new file mode 100644 index 00000000..90dcbccf --- /dev/null +++ b/assets/minecraft/textures/item/cyan_bundle_open_front.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4698af2c5c6b660176d6b893be3189cc006ab90a1e2f74d6a6911ece5a1712f0 +size 191 diff --git a/assets/minecraft/textures/item/field_masoned_banner_pattern.png b/assets/minecraft/textures/item/field_masoned_banner_pattern.png new file mode 100644 index 00000000..e43d51e9 --- /dev/null +++ b/assets/minecraft/textures/item/field_masoned_banner_pattern.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0f7f419f7a0183d209b93687fbfc7bc3b9501da48d70d18d9666c7d37dd8253f +size 214 diff --git a/assets/minecraft/textures/item/flow_banner_pattern.png b/assets/minecraft/textures/item/flow_banner_pattern.png index f0521184..ed107e0d 100644 --- a/assets/minecraft/textures/item/flow_banner_pattern.png +++ b/assets/minecraft/textures/item/flow_banner_pattern.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:624275c8d974c76b26ff29bc6e84262086c16b87c8c23bc3d02a0d725ef86b03 -size 192 +oid sha256:820ad28d20423b757456cad1bf94eda8daf30026ad733d565f5ffc93ec4b9d9b +size 212 diff --git a/assets/minecraft/textures/item/flower_banner_pattern.png b/assets/minecraft/textures/item/flower_banner_pattern.png index f0521184..9d8d4395 100644 --- a/assets/minecraft/textures/item/flower_banner_pattern.png +++ b/assets/minecraft/textures/item/flower_banner_pattern.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:624275c8d974c76b26ff29bc6e84262086c16b87c8c23bc3d02a0d725ef86b03 -size 192 +oid sha256:6854cdd8bfe3ca73bf56b8cc82b75ee8104b726a4856161f2dcabb2196943f05 +size 218 diff --git a/assets/minecraft/textures/item/globe_banner_pattern.png b/assets/minecraft/textures/item/globe_banner_pattern.png index f0521184..9d17402a 100644 --- a/assets/minecraft/textures/item/globe_banner_pattern.png +++ b/assets/minecraft/textures/item/globe_banner_pattern.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:624275c8d974c76b26ff29bc6e84262086c16b87c8c23bc3d02a0d725ef86b03 -size 192 +oid sha256:8c3ed69b58e17e0ab1ffd62dd714bafaa06b181425c7c46e13a1350a8122cfec +size 214 diff --git a/assets/minecraft/textures/item/gray_bundle.png b/assets/minecraft/textures/item/gray_bundle.png new file mode 100644 index 00000000..0a7692bb --- /dev/null +++ b/assets/minecraft/textures/item/gray_bundle.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4d8dbcbd1c095a4e07ddd7749a492f17b853aebe6447a3b97b4acb2644dd07b1 +size 206 diff --git a/assets/minecraft/textures/item/gray_bundle_open_back.png b/assets/minecraft/textures/item/gray_bundle_open_back.png new file mode 100644 index 00000000..01b8e9ea --- /dev/null +++ b/assets/minecraft/textures/item/gray_bundle_open_back.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bc1c3f78ae85056217f569e3d0ef688727d75785d33f9e3337dd4cf1d029f248 +size 152 diff --git a/assets/minecraft/textures/item/gray_bundle_open_front.png b/assets/minecraft/textures/item/gray_bundle_open_front.png new file mode 100644 index 00000000..aee53ef7 --- /dev/null +++ b/assets/minecraft/textures/item/gray_bundle_open_front.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:19bb276fe396b71f213c493d1259e1a5e8f7f74880825a495d153923ffbbb3fe +size 191 diff --git a/assets/minecraft/textures/item/green_bundle.png b/assets/minecraft/textures/item/green_bundle.png new file mode 100644 index 00000000..c8d337c9 --- /dev/null +++ b/assets/minecraft/textures/item/green_bundle.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d00437a3e22c321e918189f61a72a18334be50d001da914a06cd2b1f1302e0d7 +size 206 diff --git a/assets/minecraft/textures/item/green_bundle_open_back.png b/assets/minecraft/textures/item/green_bundle_open_back.png new file mode 100644 index 00000000..361f770c --- /dev/null +++ b/assets/minecraft/textures/item/green_bundle_open_back.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d8c0841f1bb97b7904d951fdb2f7890b12564a2d9bc279fce390ef43503fd4e4 +size 152 diff --git a/assets/minecraft/textures/item/green_bundle_open_front.png b/assets/minecraft/textures/item/green_bundle_open_front.png new file mode 100644 index 00000000..24882995 --- /dev/null +++ b/assets/minecraft/textures/item/green_bundle_open_front.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ebdea03ba52bce5f3d2fbb350e65e9c69dd7543b7b1bc63f03a7b6384482b79e +size 191 diff --git a/assets/minecraft/textures/item/guster_banner_pattern.png b/assets/minecraft/textures/item/guster_banner_pattern.png index f0521184..acb1506d 100644 --- a/assets/minecraft/textures/item/guster_banner_pattern.png +++ b/assets/minecraft/textures/item/guster_banner_pattern.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:624275c8d974c76b26ff29bc6e84262086c16b87c8c23bc3d02a0d725ef86b03 -size 192 +oid sha256:bf6945f97f00abef4f08c79dbe6e0b9d7515eddc27c374f5a397ac8a3d89a702 +size 207 diff --git a/assets/minecraft/textures/item/light_blue_bundle.png b/assets/minecraft/textures/item/light_blue_bundle.png new file mode 100644 index 00000000..b8ac2f24 --- /dev/null +++ b/assets/minecraft/textures/item/light_blue_bundle.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dca45d59594a5dd411dd7554b43bda1b83ca146a42787748b8524746ad460308 +size 206 diff --git a/assets/minecraft/textures/item/light_blue_bundle_open_back.png b/assets/minecraft/textures/item/light_blue_bundle_open_back.png new file mode 100644 index 00000000..66c909fd --- /dev/null +++ b/assets/minecraft/textures/item/light_blue_bundle_open_back.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8380309c69e919377d296188f71b30cfb6f143bfb2d197c6e0e09e0fc2865d5a +size 152 diff --git a/assets/minecraft/textures/item/light_blue_bundle_open_front.png b/assets/minecraft/textures/item/light_blue_bundle_open_front.png new file mode 100644 index 00000000..eadc9ddb --- /dev/null +++ b/assets/minecraft/textures/item/light_blue_bundle_open_front.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:12482a7694f665417c37d00e8d4e757c5763c30cdf437f1e758d85741c873ef8 +size 191 diff --git a/assets/minecraft/textures/item/light_gray_bundle.png b/assets/minecraft/textures/item/light_gray_bundle.png new file mode 100644 index 00000000..adf504ba --- /dev/null +++ b/assets/minecraft/textures/item/light_gray_bundle.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:819c143038f07967ce82a0c55f91e74f6afc15589fe896ecce2820eddfd14046 +size 206 diff --git a/assets/minecraft/textures/item/light_gray_bundle_open_back.png b/assets/minecraft/textures/item/light_gray_bundle_open_back.png new file mode 100644 index 00000000..d24eb9ee --- /dev/null +++ b/assets/minecraft/textures/item/light_gray_bundle_open_back.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:be1f298bb2ebfb2cd063d6dd531ca64c0f07fb1db233f7bc798b9846c491ada8 +size 152 diff --git a/assets/minecraft/textures/item/light_gray_bundle_open_front.png b/assets/minecraft/textures/item/light_gray_bundle_open_front.png new file mode 100644 index 00000000..303a864a --- /dev/null +++ b/assets/minecraft/textures/item/light_gray_bundle_open_front.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3e4a77f88bea4a12003bc62742d874d27c77cdced9c1c5d948f9cd75cd955920 +size 191 diff --git a/assets/minecraft/textures/item/lime_bundle.png b/assets/minecraft/textures/item/lime_bundle.png new file mode 100644 index 00000000..d720d515 --- /dev/null +++ b/assets/minecraft/textures/item/lime_bundle.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5b2a2b78c6c95d1c9ef031dcd6b4cac6c48469b275ce5bbe94c0487cd7271a59 +size 206 diff --git a/assets/minecraft/textures/item/lime_bundle_open_back.png b/assets/minecraft/textures/item/lime_bundle_open_back.png new file mode 100644 index 00000000..566833a1 --- /dev/null +++ b/assets/minecraft/textures/item/lime_bundle_open_back.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f37fe4c89075a1bf94468eb6c76d91f3fc43ce455e86b5de8c3bdc3e3338e2af +size 152 diff --git a/assets/minecraft/textures/item/lime_bundle_open_front.png b/assets/minecraft/textures/item/lime_bundle_open_front.png new file mode 100644 index 00000000..9260ec10 --- /dev/null +++ b/assets/minecraft/textures/item/lime_bundle_open_front.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2a5fe6e456dd6df0c9d02ba4eb8a5f5b8d4fa3a4c7cfa4f081e29527a4f9a0c4 +size 191 diff --git a/assets/minecraft/textures/item/magenta_bundle.png b/assets/minecraft/textures/item/magenta_bundle.png new file mode 100644 index 00000000..1de2ada8 --- /dev/null +++ b/assets/minecraft/textures/item/magenta_bundle.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f87f8f55777172430dcc97214ffd5eddd78110e89edc4153e7fca1540857e770 +size 206 diff --git a/assets/minecraft/textures/item/magenta_bundle_open_back.png b/assets/minecraft/textures/item/magenta_bundle_open_back.png new file mode 100644 index 00000000..ebb8916a --- /dev/null +++ b/assets/minecraft/textures/item/magenta_bundle_open_back.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:53c0a5b8d19d107d7089ec138eff4c567f1eef357807db34f40752fede51eb36 +size 152 diff --git a/assets/minecraft/textures/item/magenta_bundle_open_front.png b/assets/minecraft/textures/item/magenta_bundle_open_front.png new file mode 100644 index 00000000..b814a934 --- /dev/null +++ b/assets/minecraft/textures/item/magenta_bundle_open_front.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c4d6c3bb0be02c595a85410284c7957e85f8dc8a6a3d44d76f038a3e613548f5 +size 191 diff --git a/assets/minecraft/textures/item/mojang_banner_pattern.png b/assets/minecraft/textures/item/mojang_banner_pattern.png index f0521184..c0ec8a13 100644 --- a/assets/minecraft/textures/item/mojang_banner_pattern.png +++ b/assets/minecraft/textures/item/mojang_banner_pattern.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:624275c8d974c76b26ff29bc6e84262086c16b87c8c23bc3d02a0d725ef86b03 -size 192 +oid sha256:92759f2618d9cb3beb98c266a0563ed7586428a78f6bf3a8d61e09325d0e632d +size 216 diff --git a/assets/minecraft/textures/item/orange_bundle.png b/assets/minecraft/textures/item/orange_bundle.png new file mode 100644 index 00000000..7f824dfc --- /dev/null +++ b/assets/minecraft/textures/item/orange_bundle.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9060d023b68352c73660f1278b4adb7c7ad9b37c608dba2c765e7e05b9730d82 +size 206 diff --git a/assets/minecraft/textures/item/orange_bundle_open_back.png b/assets/minecraft/textures/item/orange_bundle_open_back.png new file mode 100644 index 00000000..3ff36f93 --- /dev/null +++ b/assets/minecraft/textures/item/orange_bundle_open_back.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:79959b4409ff0f2845287bc18ec02e4bf417d010c323eb33342c19a6889a77ad +size 152 diff --git a/assets/minecraft/textures/item/orange_bundle_open_front.png b/assets/minecraft/textures/item/orange_bundle_open_front.png new file mode 100644 index 00000000..a2d617d3 --- /dev/null +++ b/assets/minecraft/textures/item/orange_bundle_open_front.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:064c96232802cf6ee2a31dae4d484b6a04163c0003fe5ec504dea927d70d3726 +size 191 diff --git a/assets/minecraft/textures/item/pale_oak_boat.png b/assets/minecraft/textures/item/pale_oak_boat.png new file mode 100644 index 00000000..effec5aa --- /dev/null +++ b/assets/minecraft/textures/item/pale_oak_boat.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:de24915de8ad288bfc9133aaf06452406c6ba466fa72f617c2ac60dac3a8c88b +size 215 diff --git a/assets/minecraft/textures/item/pale_oak_chest_boat.png b/assets/minecraft/textures/item/pale_oak_chest_boat.png new file mode 100644 index 00000000..f887f296 --- /dev/null +++ b/assets/minecraft/textures/item/pale_oak_chest_boat.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d184c633358827c2d9eca7dbc8a41cf94b8956532985d27e4ae66cd815d2fab2 +size 251 diff --git a/assets/minecraft/textures/item/pale_oak_door.png b/assets/minecraft/textures/item/pale_oak_door.png new file mode 100644 index 00000000..d62daa07 --- /dev/null +++ b/assets/minecraft/textures/item/pale_oak_door.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:db895c8e022123bc82f92ecfa4cef880d5572c8c109f90caef402095e386ae13 +size 180 diff --git a/assets/minecraft/textures/item/pale_oak_hanging_sign.png b/assets/minecraft/textures/item/pale_oak_hanging_sign.png new file mode 100644 index 00000000..36ba9250 --- /dev/null +++ b/assets/minecraft/textures/item/pale_oak_hanging_sign.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2cff876b061caa78988a8dd8e20794b02fbca65c1a33dd8b8dbbbb881eec973e +size 207 diff --git a/assets/minecraft/textures/item/pale_oak_sign.png b/assets/minecraft/textures/item/pale_oak_sign.png new file mode 100644 index 00000000..066538c6 --- /dev/null +++ b/assets/minecraft/textures/item/pale_oak_sign.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:aab37b8a151108437681161d78767451f1982e761e0f93631dae2ad55e9d67aa +size 183 diff --git a/assets/minecraft/textures/item/piglin_banner_pattern.png b/assets/minecraft/textures/item/piglin_banner_pattern.png index f0521184..9a96bd0c 100644 --- a/assets/minecraft/textures/item/piglin_banner_pattern.png +++ b/assets/minecraft/textures/item/piglin_banner_pattern.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:624275c8d974c76b26ff29bc6e84262086c16b87c8c23bc3d02a0d725ef86b03 -size 192 +oid sha256:2f426f4631bcbcb1b834b088c797e574847bf5599900b6334be5583bfd9206ae +size 210 diff --git a/assets/minecraft/textures/item/pink_bundle.png b/assets/minecraft/textures/item/pink_bundle.png new file mode 100644 index 00000000..3960ec7b --- /dev/null +++ b/assets/minecraft/textures/item/pink_bundle.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f984d17c518981ab7b9f55c9d82cda4b415bd138938cf667d7030422c071b18d +size 206 diff --git a/assets/minecraft/textures/item/pink_bundle_open_back.png b/assets/minecraft/textures/item/pink_bundle_open_back.png new file mode 100644 index 00000000..45557c0a --- /dev/null +++ b/assets/minecraft/textures/item/pink_bundle_open_back.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:603d7dbcee8a5c94afddce8d50c769940c7f345a17ab1129a26773ca5830f736 +size 151 diff --git a/assets/minecraft/textures/item/pink_bundle_open_front.png b/assets/minecraft/textures/item/pink_bundle_open_front.png new file mode 100644 index 00000000..fd595bc1 --- /dev/null +++ b/assets/minecraft/textures/item/pink_bundle_open_front.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b0b97be39f55dd506f64d96363ebc2d62463485145b8d7ce4cfa02ccc0269f3e +size 191 diff --git a/assets/minecraft/textures/item/purple_bundle.png b/assets/minecraft/textures/item/purple_bundle.png new file mode 100644 index 00000000..1ae90add --- /dev/null +++ b/assets/minecraft/textures/item/purple_bundle.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e93e223a65f1cf5dede2284b1734413e39dfd5edd3df9fbd437d715bf065ac22 +size 206 diff --git a/assets/minecraft/textures/item/purple_bundle_open_back.png b/assets/minecraft/textures/item/purple_bundle_open_back.png new file mode 100644 index 00000000..cf49c5b3 --- /dev/null +++ b/assets/minecraft/textures/item/purple_bundle_open_back.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:53b3efbed87c18eb4234911c69458e113dcfedd5e1d154c1bd734e5a67802be6 +size 152 diff --git a/assets/minecraft/textures/item/purple_bundle_open_front.png b/assets/minecraft/textures/item/purple_bundle_open_front.png new file mode 100644 index 00000000..143dac8f --- /dev/null +++ b/assets/minecraft/textures/item/purple_bundle_open_front.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:80b4c5a85a303c3544935e37246eea8e2a6fc440917e92a4dec1de0adac4bcaa +size 191 diff --git a/assets/minecraft/textures/item/red_bundle.png b/assets/minecraft/textures/item/red_bundle.png new file mode 100644 index 00000000..30f04cee --- /dev/null +++ b/assets/minecraft/textures/item/red_bundle.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c48d53d0c92b681736889bd80b8dbfbdc330bfc234ce8fc5e77ef86bd1337ab7 +size 217 diff --git a/assets/minecraft/textures/item/red_bundle_open_back.png b/assets/minecraft/textures/item/red_bundle_open_back.png new file mode 100644 index 00000000..2024a404 --- /dev/null +++ b/assets/minecraft/textures/item/red_bundle_open_back.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a9f31af9e04aadc46768a7c18cf81824ccf247248c8c0c842292dd101e1c0057 +size 162 diff --git a/assets/minecraft/textures/item/red_bundle_open_front.png b/assets/minecraft/textures/item/red_bundle_open_front.png new file mode 100644 index 00000000..9559e05e --- /dev/null +++ b/assets/minecraft/textures/item/red_bundle_open_front.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:298c9eb545ee593740eb63d97165eaafc784f69939cdf3408e4e288bb073c6df +size 197 diff --git a/assets/minecraft/textures/item/skull_banner_pattern.png b/assets/minecraft/textures/item/skull_banner_pattern.png index f0521184..05446182 100644 --- a/assets/minecraft/textures/item/skull_banner_pattern.png +++ b/assets/minecraft/textures/item/skull_banner_pattern.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:624275c8d974c76b26ff29bc6e84262086c16b87c8c23bc3d02a0d725ef86b03 -size 192 +oid sha256:c7b94cfb03cb2a27104f3fefe1d88a67d9fb59540537994d22452dcad71cf96c +size 213 diff --git a/assets/minecraft/textures/item/white_bundle.png b/assets/minecraft/textures/item/white_bundle.png new file mode 100644 index 00000000..f33780a0 --- /dev/null +++ b/assets/minecraft/textures/item/white_bundle.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:78b0e0a6a2d02ccd1d37b9d7d48f37e27ffb469c57787499940369cfd781d28a +size 206 diff --git a/assets/minecraft/textures/item/white_bundle_open_back.png b/assets/minecraft/textures/item/white_bundle_open_back.png new file mode 100644 index 00000000..efa220a2 --- /dev/null +++ b/assets/minecraft/textures/item/white_bundle_open_back.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:504a83a3a33d0fc7f90981d02ac9c5d4cdfcb7be0cc329b50b5c63d5e16995e9 +size 152 diff --git a/assets/minecraft/textures/item/white_bundle_open_front.png b/assets/minecraft/textures/item/white_bundle_open_front.png new file mode 100644 index 00000000..0ebd5c2c --- /dev/null +++ b/assets/minecraft/textures/item/white_bundle_open_front.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:325109e77c1de7c3a2a4bc65ee1218d062cb681fed43fb838966452d912115e1 +size 191 diff --git a/assets/minecraft/textures/item/yellow_bundle.png b/assets/minecraft/textures/item/yellow_bundle.png new file mode 100644 index 00000000..401b90a8 --- /dev/null +++ b/assets/minecraft/textures/item/yellow_bundle.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:67157916f9fecaea5a9f67a1ed51200d9103f10a76584811ce1616c30e8e0ae3 +size 206 diff --git a/assets/minecraft/textures/item/yellow_bundle_open_back.png b/assets/minecraft/textures/item/yellow_bundle_open_back.png new file mode 100644 index 00000000..825ff926 --- /dev/null +++ b/assets/minecraft/textures/item/yellow_bundle_open_back.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8d5bfcf02e90e6dac96579721b2721e6bda304cd9bbf356d9eed536a08b93f4b +size 152 diff --git a/assets/minecraft/textures/item/yellow_bundle_open_front.png b/assets/minecraft/textures/item/yellow_bundle_open_front.png new file mode 100644 index 00000000..a81c9e7d --- /dev/null +++ b/assets/minecraft/textures/item/yellow_bundle_open_front.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:16da871fe81cf9f51f67dd49e745a458b5eca7216fa5c309f304a8207aa12b32 +size 191 diff --git a/assets/minecraft/textures/misc/enchanted_item_glint.png.mcmeta b/assets/minecraft/textures/misc/enchanted_glint_entity.png.mcmeta similarity index 100% rename from assets/minecraft/textures/misc/enchanted_item_glint.png.mcmeta rename to assets/minecraft/textures/misc/enchanted_glint_entity.png.mcmeta diff --git a/assets/minecraft/textures/misc/enchanted_glint_item.png.mcmeta b/assets/minecraft/textures/misc/enchanted_glint_item.png.mcmeta new file mode 100644 index 00000000..e38a5ad3 --- /dev/null +++ b/assets/minecraft/textures/misc/enchanted_glint_item.png.mcmeta @@ -0,0 +1,5 @@ +{ + "texture": { + "blur": true + } +} diff --git a/assets/minecraft/textures/misc/nausea.png.mcmeta b/assets/minecraft/textures/misc/nausea.png.mcmeta new file mode 100644 index 00000000..e38a5ad3 --- /dev/null +++ b/assets/minecraft/textures/misc/nausea.png.mcmeta @@ -0,0 +1,5 @@ +{ + "texture": { + "blur": true + } +} diff --git a/assets/minecraft/textures/trims/models/armor/bolt.png b/assets/minecraft/textures/trims/entity/humanoid/bolt.png similarity index 100% rename from assets/minecraft/textures/trims/models/armor/bolt.png rename to assets/minecraft/textures/trims/entity/humanoid/bolt.png diff --git a/assets/minecraft/textures/trims/models/armor/coast.png b/assets/minecraft/textures/trims/entity/humanoid/coast.png similarity index 100% rename from assets/minecraft/textures/trims/models/armor/coast.png rename to assets/minecraft/textures/trims/entity/humanoid/coast.png diff --git a/assets/minecraft/textures/trims/models/armor/dune.png b/assets/minecraft/textures/trims/entity/humanoid/dune.png similarity index 100% rename from assets/minecraft/textures/trims/models/armor/dune.png rename to assets/minecraft/textures/trims/entity/humanoid/dune.png diff --git a/assets/minecraft/textures/trims/models/armor/eye.png b/assets/minecraft/textures/trims/entity/humanoid/eye.png similarity index 100% rename from assets/minecraft/textures/trims/models/armor/eye.png rename to assets/minecraft/textures/trims/entity/humanoid/eye.png diff --git a/assets/minecraft/textures/trims/models/armor/flow.png b/assets/minecraft/textures/trims/entity/humanoid/flow.png similarity index 100% rename from assets/minecraft/textures/trims/models/armor/flow.png rename to assets/minecraft/textures/trims/entity/humanoid/flow.png diff --git a/assets/minecraft/textures/trims/models/armor/host.png b/assets/minecraft/textures/trims/entity/humanoid/host.png similarity index 100% rename from assets/minecraft/textures/trims/models/armor/host.png rename to assets/minecraft/textures/trims/entity/humanoid/host.png diff --git a/assets/minecraft/textures/trims/models/armor/raiser.png b/assets/minecraft/textures/trims/entity/humanoid/raiser.png similarity index 100% rename from assets/minecraft/textures/trims/models/armor/raiser.png rename to assets/minecraft/textures/trims/entity/humanoid/raiser.png diff --git a/assets/minecraft/textures/trims/models/armor/rib.png b/assets/minecraft/textures/trims/entity/humanoid/rib.png similarity index 100% rename from assets/minecraft/textures/trims/models/armor/rib.png rename to assets/minecraft/textures/trims/entity/humanoid/rib.png diff --git a/assets/minecraft/textures/trims/models/armor/sentry.png b/assets/minecraft/textures/trims/entity/humanoid/sentry.png similarity index 100% rename from assets/minecraft/textures/trims/models/armor/sentry.png rename to assets/minecraft/textures/trims/entity/humanoid/sentry.png diff --git a/assets/minecraft/textures/trims/models/armor/shaper.png b/assets/minecraft/textures/trims/entity/humanoid/shaper.png similarity index 100% rename from assets/minecraft/textures/trims/models/armor/shaper.png rename to assets/minecraft/textures/trims/entity/humanoid/shaper.png diff --git a/assets/minecraft/textures/trims/models/armor/silence.png b/assets/minecraft/textures/trims/entity/humanoid/silence.png similarity index 100% rename from assets/minecraft/textures/trims/models/armor/silence.png rename to assets/minecraft/textures/trims/entity/humanoid/silence.png diff --git a/assets/minecraft/textures/trims/models/armor/snout.png b/assets/minecraft/textures/trims/entity/humanoid/snout.png similarity index 100% rename from assets/minecraft/textures/trims/models/armor/snout.png rename to assets/minecraft/textures/trims/entity/humanoid/snout.png diff --git a/assets/minecraft/textures/trims/models/armor/spire.png b/assets/minecraft/textures/trims/entity/humanoid/spire.png similarity index 100% rename from assets/minecraft/textures/trims/models/armor/spire.png rename to assets/minecraft/textures/trims/entity/humanoid/spire.png diff --git a/assets/minecraft/textures/trims/models/armor/tide.png b/assets/minecraft/textures/trims/entity/humanoid/tide.png similarity index 100% rename from assets/minecraft/textures/trims/models/armor/tide.png rename to assets/minecraft/textures/trims/entity/humanoid/tide.png diff --git a/assets/minecraft/textures/trims/models/armor/vex.png b/assets/minecraft/textures/trims/entity/humanoid/vex.png similarity index 100% rename from assets/minecraft/textures/trims/models/armor/vex.png rename to assets/minecraft/textures/trims/entity/humanoid/vex.png diff --git a/assets/minecraft/textures/trims/models/armor/ward.png b/assets/minecraft/textures/trims/entity/humanoid/ward.png similarity index 100% rename from assets/minecraft/textures/trims/models/armor/ward.png rename to assets/minecraft/textures/trims/entity/humanoid/ward.png diff --git a/assets/minecraft/textures/trims/models/armor/wayfinder.png b/assets/minecraft/textures/trims/entity/humanoid/wayfinder.png similarity index 100% rename from assets/minecraft/textures/trims/models/armor/wayfinder.png rename to assets/minecraft/textures/trims/entity/humanoid/wayfinder.png diff --git a/assets/minecraft/textures/trims/models/armor/wild.png b/assets/minecraft/textures/trims/entity/humanoid/wild.png similarity index 100% rename from assets/minecraft/textures/trims/models/armor/wild.png rename to assets/minecraft/textures/trims/entity/humanoid/wild.png diff --git a/assets/minecraft/textures/trims/models/armor/bolt_leggings.png b/assets/minecraft/textures/trims/entity/humanoid_leggings/bolt.png similarity index 100% rename from assets/minecraft/textures/trims/models/armor/bolt_leggings.png rename to assets/minecraft/textures/trims/entity/humanoid_leggings/bolt.png diff --git a/assets/minecraft/textures/trims/models/armor/coast_leggings.png b/assets/minecraft/textures/trims/entity/humanoid_leggings/coast.png similarity index 100% rename from assets/minecraft/textures/trims/models/armor/coast_leggings.png rename to assets/minecraft/textures/trims/entity/humanoid_leggings/coast.png diff --git a/assets/minecraft/textures/trims/models/armor/dune_leggings.png b/assets/minecraft/textures/trims/entity/humanoid_leggings/dune.png similarity index 100% rename from assets/minecraft/textures/trims/models/armor/dune_leggings.png rename to assets/minecraft/textures/trims/entity/humanoid_leggings/dune.png diff --git a/assets/minecraft/textures/trims/models/armor/eye_leggings.png b/assets/minecraft/textures/trims/entity/humanoid_leggings/eye.png similarity index 100% rename from assets/minecraft/textures/trims/models/armor/eye_leggings.png rename to assets/minecraft/textures/trims/entity/humanoid_leggings/eye.png diff --git a/assets/minecraft/textures/trims/models/armor/flow_leggings.png b/assets/minecraft/textures/trims/entity/humanoid_leggings/flow.png similarity index 100% rename from assets/minecraft/textures/trims/models/armor/flow_leggings.png rename to assets/minecraft/textures/trims/entity/humanoid_leggings/flow.png diff --git a/assets/minecraft/textures/trims/models/armor/host_leggings.png b/assets/minecraft/textures/trims/entity/humanoid_leggings/host.png similarity index 100% rename from assets/minecraft/textures/trims/models/armor/host_leggings.png rename to assets/minecraft/textures/trims/entity/humanoid_leggings/host.png diff --git a/assets/minecraft/textures/trims/models/armor/raiser_leggings.png b/assets/minecraft/textures/trims/entity/humanoid_leggings/raiser.png similarity index 100% rename from assets/minecraft/textures/trims/models/armor/raiser_leggings.png rename to assets/minecraft/textures/trims/entity/humanoid_leggings/raiser.png diff --git a/assets/minecraft/textures/trims/models/armor/rib_leggings.png b/assets/minecraft/textures/trims/entity/humanoid_leggings/rib.png similarity index 100% rename from assets/minecraft/textures/trims/models/armor/rib_leggings.png rename to assets/minecraft/textures/trims/entity/humanoid_leggings/rib.png diff --git a/assets/minecraft/textures/trims/models/armor/sentry_leggings.png b/assets/minecraft/textures/trims/entity/humanoid_leggings/sentry.png similarity index 100% rename from assets/minecraft/textures/trims/models/armor/sentry_leggings.png rename to assets/minecraft/textures/trims/entity/humanoid_leggings/sentry.png diff --git a/assets/minecraft/textures/trims/models/armor/shaper_leggings.png b/assets/minecraft/textures/trims/entity/humanoid_leggings/shaper.png similarity index 100% rename from assets/minecraft/textures/trims/models/armor/shaper_leggings.png rename to assets/minecraft/textures/trims/entity/humanoid_leggings/shaper.png diff --git a/assets/minecraft/textures/trims/models/armor/silence_leggings.png b/assets/minecraft/textures/trims/entity/humanoid_leggings/silence.png similarity index 100% rename from assets/minecraft/textures/trims/models/armor/silence_leggings.png rename to assets/minecraft/textures/trims/entity/humanoid_leggings/silence.png diff --git a/assets/minecraft/textures/trims/models/armor/snout_leggings.png b/assets/minecraft/textures/trims/entity/humanoid_leggings/snout.png similarity index 100% rename from assets/minecraft/textures/trims/models/armor/snout_leggings.png rename to assets/minecraft/textures/trims/entity/humanoid_leggings/snout.png diff --git a/assets/minecraft/textures/trims/models/armor/spire_leggings.png b/assets/minecraft/textures/trims/entity/humanoid_leggings/spire.png similarity index 100% rename from assets/minecraft/textures/trims/models/armor/spire_leggings.png rename to assets/minecraft/textures/trims/entity/humanoid_leggings/spire.png diff --git a/assets/minecraft/textures/trims/models/armor/tide_leggings.png b/assets/minecraft/textures/trims/entity/humanoid_leggings/tide.png similarity index 100% rename from assets/minecraft/textures/trims/models/armor/tide_leggings.png rename to assets/minecraft/textures/trims/entity/humanoid_leggings/tide.png diff --git a/assets/minecraft/textures/trims/models/armor/vex_leggings.png b/assets/minecraft/textures/trims/entity/humanoid_leggings/vex.png similarity index 100% rename from assets/minecraft/textures/trims/models/armor/vex_leggings.png rename to assets/minecraft/textures/trims/entity/humanoid_leggings/vex.png diff --git a/assets/minecraft/textures/trims/models/armor/ward_leggings.png b/assets/minecraft/textures/trims/entity/humanoid_leggings/ward.png similarity index 100% rename from assets/minecraft/textures/trims/models/armor/ward_leggings.png rename to assets/minecraft/textures/trims/entity/humanoid_leggings/ward.png diff --git a/assets/minecraft/textures/trims/models/armor/wayfinder_leggings.png b/assets/minecraft/textures/trims/entity/humanoid_leggings/wayfinder.png similarity index 100% rename from assets/minecraft/textures/trims/models/armor/wayfinder_leggings.png rename to assets/minecraft/textures/trims/entity/humanoid_leggings/wayfinder.png diff --git a/assets/minecraft/textures/trims/models/armor/wild_leggings.png b/assets/minecraft/textures/trims/entity/humanoid_leggings/wild.png similarity index 100% rename from assets/minecraft/textures/trims/models/armor/wild_leggings.png rename to assets/minecraft/textures/trims/entity/humanoid_leggings/wild.png diff --git a/com/mojang/blaze3d/Blaze3D.java b/com/mojang/blaze3d/Blaze3D.java index e37ae7b6..e5c02fc1 100644 --- a/com/mojang/blaze3d/Blaze3D.java +++ b/com/mojang/blaze3d/Blaze3D.java @@ -1,8 +1,5 @@ package com.mojang.blaze3d; -import com.mojang.blaze3d.pipeline.RenderCall; -import com.mojang.blaze3d.pipeline.RenderPipeline; -import java.util.concurrent.ConcurrentLinkedQueue; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import org.lwjgl.glfw.GLFW; @@ -10,14 +7,6 @@ import org.lwjgl.system.MemoryUtil; @Environment(EnvType.CLIENT) public class Blaze3D { - public static void process(RenderPipeline pipeline, float unknown) { - ConcurrentLinkedQueue concurrentLinkedQueue = pipeline.getRecordingQueue(); - } - - public static void render(RenderPipeline pipeline, float unknown) { - ConcurrentLinkedQueue concurrentLinkedQueue = pipeline.getProcessedQueue(); - } - public static void youJustLostTheGame() { MemoryUtil.memSet(0L, 0, 1L); } @@ -25,4 +14,7 @@ public class Blaze3D { public static double getTime() { return GLFW.glfwGetTime(); } + + private Blaze3D() { + } } diff --git a/com/mojang/blaze3d/ProjectionType.java b/com/mojang/blaze3d/ProjectionType.java new file mode 100644 index 00000000..0c537c51 --- /dev/null +++ b/com/mojang/blaze3d/ProjectionType.java @@ -0,0 +1,34 @@ +package com.mojang.blaze3d; + +import com.mojang.blaze3d.vertex.VertexSorting; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import org.joml.Matrix4f; + +@Environment(EnvType.CLIENT) +public enum ProjectionType { + PERSPECTIVE(VertexSorting.DISTANCE_TO_ORIGIN, (matrix4f, f) -> matrix4f.scale(1.0F - f / 4096.0F)), + ORTHOGRAPHIC(VertexSorting.ORTHOGRAPHIC_Z, (matrix4f, f) -> matrix4f.translate(0.0F, 0.0F, f / 512.0F)); + + private final VertexSorting vertexSorting; + private final ProjectionType.LayeringTransform layeringTransform; + + private ProjectionType(final VertexSorting vertexSorting, final ProjectionType.LayeringTransform layeringTransform) { + this.vertexSorting = vertexSorting; + this.layeringTransform = layeringTransform; + } + + public VertexSorting vertexSorting() { + return this.vertexSorting; + } + + public void applyLayeringTransform(Matrix4f matrix4f, float f) { + this.layeringTransform.apply(matrix4f, f); + } + + @FunctionalInterface + @Environment(EnvType.CLIENT) + interface LayeringTransform { + void apply(Matrix4f matrix4f, float f); + } +} diff --git a/com/mojang/blaze3d/TracyBootstrap.java b/com/mojang/blaze3d/TracyBootstrap.java new file mode 100644 index 00000000..1c94e64b --- /dev/null +++ b/com/mojang/blaze3d/TracyBootstrap.java @@ -0,0 +1,31 @@ +package com.mojang.blaze3d; + +import com.mojang.jtracy.TracyClient; +import com.mojang.logging.LogListeners; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import org.slf4j.event.Level; + +@Environment(EnvType.CLIENT) +public class TracyBootstrap { + private static boolean setup; + + public static void setup() { + if (!setup) { + TracyClient.load(); + if (TracyClient.isAvailable()) { + LogListeners.addListener("Tracy", (string, level) -> TracyClient.message(string, messageColor(level))); + setup = true; + } + } + } + + private static int messageColor(Level level) { + return switch (level) { + case DEBUG -> 11184810; + case WARN -> 16777130; + case ERROR -> 16755370; + default -> 16777215; + }; + } +} diff --git a/com/mojang/blaze3d/TracyFrameCapture.java b/com/mojang/blaze3d/TracyFrameCapture.java new file mode 100644 index 00000000..930dbd2d --- /dev/null +++ b/com/mojang/blaze3d/TracyFrameCapture.java @@ -0,0 +1,109 @@ +package com.mojang.blaze3d; + +import com.mojang.blaze3d.buffers.BufferType; +import com.mojang.blaze3d.buffers.BufferUsage; +import com.mojang.blaze3d.buffers.GpuBuffer; +import com.mojang.blaze3d.buffers.GpuFence; +import com.mojang.blaze3d.pipeline.RenderTarget; +import com.mojang.blaze3d.pipeline.TextureTarget; +import com.mojang.blaze3d.platform.GlStateManager; +import com.mojang.jtracy.TracyClient; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import org.jetbrains.annotations.Nullable; + +@Environment(EnvType.CLIENT) +public class TracyFrameCapture implements AutoCloseable { + private static final int MAX_WIDTH = 320; + private static final int MAX_HEIGHT = 180; + private static final int BYTES_PER_PIXEL = 4; + private int targetWidth; + private int targetHeight; + private int width; + private int height; + private final RenderTarget frameBuffer = new TextureTarget(320, 180, false); + private final GpuBuffer pixelbuffer = new GpuBuffer(BufferType.PIXEL_PACK, BufferUsage.STREAM_READ, 0); + @Nullable + private GpuFence fence; + private int lastCaptureDelay; + private boolean capturedThisFrame; + + private void resize(int i, int j) { + float f = (float)i / j; + if (i > 320) { + i = 320; + j = (int)(320.0F / f); + } + + if (j > 180) { + i = (int)(180.0F * f); + j = 180; + } + + i = i / 4 * 4; + j = j / 4 * 4; + if (this.width != i || this.height != j) { + this.width = i; + this.height = j; + this.frameBuffer.resize(i, j); + this.pixelbuffer.resize(i * j * 4); + if (this.fence != null) { + this.fence.close(); + this.fence = null; + } + } + } + + public void capture(RenderTarget renderTarget) { + if (this.fence == null && !this.capturedThisFrame) { + this.capturedThisFrame = true; + if (renderTarget.width != this.targetWidth || renderTarget.height != this.targetHeight) { + this.targetWidth = renderTarget.width; + this.targetHeight = renderTarget.height; + this.resize(this.targetWidth, this.targetHeight); + } + + GlStateManager._glBindFramebuffer(36009, this.frameBuffer.frameBufferId); + GlStateManager._glBindFramebuffer(36008, renderTarget.frameBufferId); + GlStateManager._glBlitFrameBuffer(0, 0, renderTarget.width, renderTarget.height, 0, 0, this.width, this.height, 16384, 9729); + GlStateManager._glBindFramebuffer(36008, 0); + GlStateManager._glBindFramebuffer(36009, 0); + this.pixelbuffer.bind(); + GlStateManager._glBindFramebuffer(36008, this.frameBuffer.frameBufferId); + GlStateManager._readPixels(0, 0, this.width, this.height, 6408, 5121, 0L); + GlStateManager._glBindFramebuffer(36008, 0); + this.fence = new GpuFence(); + this.lastCaptureDelay = 0; + } + } + + public void upload() { + if (this.fence != null) { + if (this.fence.awaitCompletion(0L)) { + this.fence = null; + + try (GpuBuffer.ReadView readView = this.pixelbuffer.read()) { + if (readView != null) { + TracyClient.frameImage(readView.data(), this.width, this.height, this.lastCaptureDelay, true); + } + } + } + } + } + + public void endFrame() { + this.lastCaptureDelay++; + this.capturedThisFrame = false; + TracyClient.markFrame(); + } + + public void close() { + if (this.fence != null) { + this.fence.close(); + this.fence = null; + } + + this.pixelbuffer.close(); + this.frameBuffer.destroyBuffers(); + } +} diff --git a/com/mojang/blaze3d/buffers/BufferType.java b/com/mojang/blaze3d/buffers/BufferType.java new file mode 100644 index 00000000..76943794 --- /dev/null +++ b/com/mojang/blaze3d/buffers/BufferType.java @@ -0,0 +1,21 @@ +package com.mojang.blaze3d.buffers; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; + +@Environment(EnvType.CLIENT) +public enum BufferType { + VERTICES(34962), + INDICES(34963), + PIXEL_PACK(35051), + COPY_READ(36662), + COPY_WRITE(36663), + PIXEL_UNPACK(35052), + UNIFORM(35345); + + final int id; + + private BufferType(final int j) { + this.id = j; + } +} diff --git a/com/mojang/blaze3d/buffers/BufferUsage.java b/com/mojang/blaze3d/buffers/BufferUsage.java new file mode 100644 index 00000000..a3d7c23b --- /dev/null +++ b/com/mojang/blaze3d/buffers/BufferUsage.java @@ -0,0 +1,27 @@ +package com.mojang.blaze3d.buffers; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; + +@Environment(EnvType.CLIENT) +public enum BufferUsage { + DYNAMIC_WRITE(35048, false, true), + STATIC_WRITE(35044, false, true), + STREAM_WRITE(35040, false, true), + STATIC_READ(35045, true, false), + DYNAMIC_READ(35049, true, false), + STREAM_READ(35041, true, false), + DYNAMIC_COPY(35050, false, false), + STATIC_COPY(35046, false, false), + STREAM_COPY(35042, false, false); + + final int id; + final boolean readable; + final boolean writable; + + private BufferUsage(final int j, final boolean bl, final boolean bl2) { + this.id = j; + this.readable = bl; + this.writable = bl2; + } +} diff --git a/com/mojang/blaze3d/buffers/GpuBuffer.java b/com/mojang/blaze3d/buffers/GpuBuffer.java new file mode 100644 index 00000000..e9f897c0 --- /dev/null +++ b/com/mojang/blaze3d/buffers/GpuBuffer.java @@ -0,0 +1,136 @@ +package com.mojang.blaze3d.buffers; + +import com.mojang.blaze3d.platform.GlStateManager; +import com.mojang.jtracy.MemoryPool; +import com.mojang.jtracy.TracyClient; +import java.nio.ByteBuffer; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import org.jetbrains.annotations.Nullable; + +@Environment(EnvType.CLIENT) +public class GpuBuffer implements AutoCloseable { + private static final MemoryPool MEMORY_POOl = TracyClient.createMemoryPool("GPU Buffers"); + private final BufferType type; + private final BufferUsage usage; + private boolean closed; + private boolean initialized = false; + public final int handle; + public int size; + + public GpuBuffer(BufferType bufferType, BufferUsage bufferUsage, int i) { + this.type = bufferType; + this.size = i; + this.usage = bufferUsage; + this.handle = GlStateManager._glGenBuffers(); + } + + public GpuBuffer(BufferType bufferType, BufferUsage bufferUsage, ByteBuffer byteBuffer) { + this(bufferType, bufferUsage, byteBuffer.remaining()); + this.write(byteBuffer, 0); + } + + public void resize(int i) { + if (this.closed) { + throw new IllegalStateException("Buffer already closed"); + } else { + if (this.initialized) { + MEMORY_POOl.free(this.handle); + } + + this.size = i; + if (this.usage.writable) { + this.initialized = false; + } else { + this.bind(); + GlStateManager._glBufferData(this.type.id, i, this.usage.id); + MEMORY_POOl.malloc(this.handle, i); + this.initialized = true; + } + } + } + + public void write(ByteBuffer byteBuffer, int i) { + if (this.closed) { + throw new IllegalStateException("Buffer already closed"); + } else if (!this.usage.writable) { + throw new IllegalStateException("Buffer is not writable"); + } else { + int j = byteBuffer.remaining(); + if (j + i > this.size) { + throw new IllegalArgumentException( + "Cannot write more data than this buffer can hold (attempting to write " + j + " bytes at offset " + i + " to " + this.size + " size buffer)" + ); + } else { + this.bind(); + if (this.initialized) { + GlStateManager._glBufferSubData(this.type.id, i, byteBuffer); + } else if (i == 0 && j == this.size) { + GlStateManager._glBufferData(this.type.id, byteBuffer, this.usage.id); + MEMORY_POOl.malloc(this.handle, this.size); + this.initialized = true; + } else { + GlStateManager._glBufferData(this.type.id, this.size, this.usage.id); + GlStateManager._glBufferSubData(this.type.id, i, byteBuffer); + MEMORY_POOl.malloc(this.handle, this.size); + this.initialized = true; + } + } + } + } + + @Nullable + public GpuBuffer.ReadView read() { + return this.read(0, this.size); + } + + @Nullable + public GpuBuffer.ReadView read(int i, int j) { + if (this.closed) { + throw new IllegalStateException("Buffer already closed"); + } else if (!this.usage.readable) { + throw new IllegalStateException("Buffer is not readable"); + } else if (i + j > this.size) { + throw new IllegalArgumentException( + "Cannot read more data than this buffer can hold (attempting to read " + j + " bytes at offset " + i + " from " + this.size + " size buffer)" + ); + } else { + this.bind(); + ByteBuffer byteBuffer = GlStateManager._glMapBufferRange(this.type.id, i, j, 1); + return byteBuffer == null ? null : new GpuBuffer.ReadView(this.type.id, byteBuffer); + } + } + + public void close() { + if (!this.closed) { + this.closed = true; + GlStateManager._glDeleteBuffers(this.handle); + if (this.initialized) { + MEMORY_POOl.free(this.handle); + } + } + } + + public void bind() { + GlStateManager._glBindBuffer(this.type.id, this.handle); + } + + @Environment(EnvType.CLIENT) + public static class ReadView implements AutoCloseable { + private final int target; + private final ByteBuffer data; + + protected ReadView(int i, ByteBuffer byteBuffer) { + this.target = i; + this.data = byteBuffer; + } + + public ByteBuffer data() { + return this.data; + } + + public void close() { + GlStateManager._glUnmapBuffer(this.target); + } + } +} diff --git a/com/mojang/blaze3d/buffers/GpuFence.java b/com/mojang/blaze3d/buffers/GpuFence.java new file mode 100644 index 00000000..26e2066c --- /dev/null +++ b/com/mojang/blaze3d/buffers/GpuFence.java @@ -0,0 +1,32 @@ +package com.mojang.blaze3d.buffers; + +import com.mojang.blaze3d.platform.GlStateManager; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; + +@Environment(EnvType.CLIENT) +public class GpuFence implements AutoCloseable { + private long handle = GlStateManager._glFenceSync(37143, 0); + + public void close() { + if (this.handle != 0L) { + GlStateManager._glDeleteSync(this.handle); + this.handle = 0L; + } + } + + public boolean awaitCompletion(long l) { + if (this.handle == 0L) { + return true; + } else { + int i = GlStateManager._glClientWaitSync(this.handle, 0, l); + if (i == 37147) { + return false; + } else if (i == 37149) { + throw new IllegalStateException("Failed to complete gpu fence"); + } else { + return true; + } + } + } +} diff --git a/com/mojang/blaze3d/buffers/package-info.java b/com/mojang/blaze3d/buffers/package-info.java new file mode 100644 index 00000000..a74cb616 --- /dev/null +++ b/com/mojang/blaze3d/buffers/package-info.java @@ -0,0 +1,11 @@ +@ParametersAreNonnullByDefault +@MethodsReturnNonnullByDefault +@FieldsAreNonnullByDefault +@Environment(EnvType.CLIENT) +package com.mojang.blaze3d.buffers; + +import com.mojang.blaze3d.FieldsAreNonnullByDefault; +import com.mojang.blaze3d.MethodsReturnNonnullByDefault; +import javax.annotation.ParametersAreNonnullByDefault; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; diff --git a/com/mojang/blaze3d/font/TrueTypeGlyphProvider.java b/com/mojang/blaze3d/font/TrueTypeGlyphProvider.java index f0509eee..e702edde 100644 --- a/com/mojang/blaze3d/font/TrueTypeGlyphProvider.java +++ b/com/mojang/blaze3d/font/TrueTypeGlyphProvider.java @@ -1,15 +1,15 @@ package com.mojang.blaze3d.font; -import com.mojang.blaze3d.platform.NativeImage; +import com.mojang.blaze3d.font.TrueTypeGlyphProvider.Glyph.1; import it.unimi.dsi.fastutil.ints.IntArraySet; -import it.unimi.dsi.fastutil.ints.IntOpenHashSet; import it.unimi.dsi.fastutil.ints.IntSet; import java.nio.ByteBuffer; import java.nio.IntBuffer; -import java.util.Objects; +import java.util.Locale; import java.util.function.Function; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; +import net.minecraft.client.gui.font.CodepointMap; import net.minecraft.client.gui.font.glyphs.BakedGlyph; import net.minecraft.client.gui.font.providers.FreeTypeUtil; import org.jetbrains.annotations.Nullable; @@ -28,13 +28,16 @@ public class TrueTypeGlyphProvider implements GlyphProvider { @Nullable private FT_Face face; final float oversample; - private final IntSet skip = new IntArraySet(); + private final CodepointMap glyphs = new CodepointMap<>( + TrueTypeGlyphProvider.GlyphEntry[]::new, TrueTypeGlyphProvider.GlyphEntry[][]::new + ); public TrueTypeGlyphProvider(ByteBuffer fontMemory, FT_Face face, float size, float oversample, float shiftX, float shiftY, String skip) { this.fontMemory = fontMemory; this.face = face; this.oversample = oversample; - skip.codePoints().forEach(this.skip::add); + IntSet intSet = new IntArraySet(); + skip.codePoints().forEach(intSet::add); int i = Math.round(size * oversample); FreeType.FT_Set_Pixel_Sizes(face, i, i); float f = shiftX * oversample; @@ -43,31 +46,65 @@ public class TrueTypeGlyphProvider implements GlyphProvider { try (MemoryStack memoryStack = MemoryStack.stackPush()) { FT_Vector fT_Vector = FreeTypeUtil.setVector(FT_Vector.malloc(memoryStack), f, g); FreeType.FT_Set_Transform(face, null, fT_Vector); + IntBuffer intBuffer = memoryStack.mallocInt(1); + int j = (int)FreeType.FT_Get_First_Char(face, intBuffer); + + while (true) { + int k = intBuffer.get(0); + if (k == 0) { + return; + } + + if (!intSet.contains(j)) { + this.glyphs.put(j, new TrueTypeGlyphProvider.GlyphEntry(k)); + } + + j = (int)FreeType.FT_Get_Next_Char(face, j, intBuffer); + } } } @Nullable @Override public GlyphInfo getGlyph(int character) { - FT_Face fT_Face = this.validateFontOpen(); - if (this.skip.contains(character)) { - return null; - } else { - int i = FreeType.FT_Get_Char_Index(fT_Face, character); - if (i == 0) { - return null; - } else { - FreeTypeUtil.assertError(FreeType.FT_Load_Glyph(fT_Face, i, 4194312), "Loading glyph"); - FT_GlyphSlot fT_GlyphSlot = (FT_GlyphSlot)Objects.requireNonNull(fT_Face.glyph(), "Glyph not initialized"); - float f = FreeTypeUtil.x(fT_GlyphSlot.advance()); - FT_Bitmap fT_Bitmap = fT_GlyphSlot.bitmap(); - int j = fT_GlyphSlot.bitmap_left(); - int k = fT_GlyphSlot.bitmap_top(); - int l = fT_Bitmap.width(); - int m = fT_Bitmap.rows(); - return (GlyphInfo)(l > 0 && m > 0 ? new TrueTypeGlyphProvider.Glyph(j, k, l, m, f, i) : () -> f / this.oversample); + TrueTypeGlyphProvider.GlyphEntry glyphEntry = this.glyphs.get(character); + return glyphEntry != null ? this.getOrLoadGlyphInfo(character, glyphEntry) : null; + } + + private GlyphInfo getOrLoadGlyphInfo(int i, TrueTypeGlyphProvider.GlyphEntry glyphEntry) { + GlyphInfo glyphInfo = glyphEntry.glyph; + if (glyphInfo == null) { + FT_Face fT_Face = this.validateFontOpen(); + synchronized (fT_Face) { + glyphInfo = glyphEntry.glyph; + if (glyphInfo == null) { + glyphInfo = this.loadGlyph(i, fT_Face, glyphEntry.index); + glyphEntry.glyph = glyphInfo; + } } } + + return glyphInfo; + } + + private GlyphInfo loadGlyph(int i, FT_Face fT_Face, int j) { + int k = FreeType.FT_Load_Glyph(fT_Face, j, 4194312); + if (k != 0) { + FreeTypeUtil.assertError(k, String.format(Locale.ROOT, "Loading glyph U+%06X", i)); + } + + FT_GlyphSlot fT_GlyphSlot = fT_Face.glyph(); + if (fT_GlyphSlot == null) { + throw new NullPointerException(String.format(Locale.ROOT, "Glyph U+%06X not initialized", i)); + } else { + float f = FreeTypeUtil.x(fT_GlyphSlot.advance()); + FT_Bitmap fT_Bitmap = fT_GlyphSlot.bitmap(); + int l = fT_GlyphSlot.bitmap_left(); + int m = fT_GlyphSlot.bitmap_top(); + int n = fT_Bitmap.width(); + int o = fT_Bitmap.rows(); + return (GlyphInfo)(n > 0 && o > 0 ? new TrueTypeGlyphProvider.Glyph(l, m, n, o, f, j) : () -> f / this.oversample); + } } FT_Face validateFontOpen() { @@ -94,19 +131,7 @@ public class TrueTypeGlyphProvider implements GlyphProvider { @Override public IntSet getSupportedGlyphs() { - FT_Face fT_Face = this.validateFontOpen(); - IntSet intSet = new IntOpenHashSet(); - - try (MemoryStack memoryStack = MemoryStack.stackPush()) { - IntBuffer intBuffer = memoryStack.mallocInt(1); - - for (long l = FreeType.FT_Get_First_Char(fT_Face, intBuffer); intBuffer.get(0) != 0; l = FreeType.FT_Get_Next_Char(fT_Face, l, intBuffer)) { - intSet.add((int)l); - } - } - - intSet.removeAll(this.skip); - return intSet; + return this.glyphs.keySet(); } @Environment(EnvType.CLIENT) @@ -134,48 +159,18 @@ public class TrueTypeGlyphProvider implements GlyphProvider { @Override public BakedGlyph bake(Function function) { - return (BakedGlyph)function.apply(new SheetGlyphInfo() { - @Override - public int getPixelWidth() { - return Glyph.this.width; - } + return (BakedGlyph)function.apply(new 1(this)); + } + } - @Override - public int getPixelHeight() { - return Glyph.this.height; - } + @Environment(EnvType.CLIENT) + static class GlyphEntry { + final int index; + @Nullable + volatile GlyphInfo glyph; - @Override - public float getOversample() { - return TrueTypeGlyphProvider.this.oversample; - } - - @Override - public float getBearingLeft() { - return Glyph.this.bearingX; - } - - @Override - public float getBearingTop() { - return Glyph.this.bearingY; - } - - @Override - public void upload(int xOffset, int yOffset) { - FT_Face fT_Face = TrueTypeGlyphProvider.this.validateFontOpen(); - NativeImage nativeImage = new NativeImage(NativeImage.Format.LUMINANCE, Glyph.this.width, Glyph.this.height, false); - if (nativeImage.copyFromFont(fT_Face, Glyph.this.index)) { - nativeImage.upload(0, xOffset, yOffset, 0, 0, Glyph.this.width, Glyph.this.height, false, true); - } else { - nativeImage.close(); - } - } - - @Override - public boolean isColored() { - return false; - } - }); + GlyphEntry(int i) { + this.index = i; } } } diff --git a/com/mojang/blaze3d/framegraph/FrameGraphBuilder.java b/com/mojang/blaze3d/framegraph/FrameGraphBuilder.java new file mode 100644 index 00000000..d71d1573 --- /dev/null +++ b/com/mojang/blaze3d/framegraph/FrameGraphBuilder.java @@ -0,0 +1,362 @@ +package com.mojang.blaze3d.framegraph; + +import com.mojang.blaze3d.framegraph.FrameGraphBuilder.Inspector.1; +import com.mojang.blaze3d.resource.GraphicsResourceAllocator; +import com.mojang.blaze3d.resource.ResourceDescriptor; +import com.mojang.blaze3d.resource.ResourceHandle; +import java.util.ArrayDeque; +import java.util.ArrayList; +import java.util.BitSet; +import java.util.Collection; +import java.util.Deque; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import org.jetbrains.annotations.Nullable; + +@Environment(EnvType.CLIENT) +public class FrameGraphBuilder { + private final List> internalResources = new ArrayList(); + private final List> externalResources = new ArrayList(); + private final List passes = new ArrayList(); + + public FramePass addPass(String string) { + FrameGraphBuilder.Pass pass = new FrameGraphBuilder.Pass(this.passes.size(), string); + this.passes.add(pass); + return pass; + } + + public ResourceHandle importExternal(String string, T object) { + FrameGraphBuilder.ExternalResource externalResource = new FrameGraphBuilder.ExternalResource<>(string, null, object); + this.externalResources.add(externalResource); + return externalResource.handle; + } + + public ResourceHandle createInternal(String string, ResourceDescriptor resourceDescriptor) { + return this.createInternalResource(string, resourceDescriptor, null).handle; + } + + FrameGraphBuilder.InternalVirtualResource createInternalResource( + String string, ResourceDescriptor resourceDescriptor, @Nullable FrameGraphBuilder.Pass pass + ) { + int i = this.internalResources.size(); + FrameGraphBuilder.InternalVirtualResource internalVirtualResource = new FrameGraphBuilder.InternalVirtualResource<>(i, string, pass, resourceDescriptor); + this.internalResources.add(internalVirtualResource); + return internalVirtualResource; + } + + public void execute(GraphicsResourceAllocator graphicsResourceAllocator) { + this.execute(graphicsResourceAllocator, FrameGraphBuilder.Inspector.NONE); + } + + public void execute(GraphicsResourceAllocator graphicsResourceAllocator, FrameGraphBuilder.Inspector inspector) { + BitSet bitSet = this.identifyPassesToKeep(); + List list = new ArrayList(bitSet.cardinality()); + BitSet bitSet2 = new BitSet(this.passes.size()); + + for (FrameGraphBuilder.Pass pass : this.passes) { + this.resolvePassOrder(pass, bitSet, bitSet2, list); + } + + this.assignResourceLifetimes(list); + + for (FrameGraphBuilder.Pass pass : list) { + for (FrameGraphBuilder.InternalVirtualResource internalVirtualResource : pass.resourcesToAcquire) { + inspector.acquireResource(internalVirtualResource.name); + internalVirtualResource.acquire(graphicsResourceAllocator); + } + + inspector.beforeExecutePass(pass.name); + pass.task.run(); + inspector.afterExecutePass(pass.name); + + for (int i = pass.resourcesToRelease.nextSetBit(0); i >= 0; i = pass.resourcesToRelease.nextSetBit(i + 1)) { + FrameGraphBuilder.InternalVirtualResource internalVirtualResource = (FrameGraphBuilder.InternalVirtualResource)this.internalResources.get(i); + inspector.releaseResource(internalVirtualResource.name); + internalVirtualResource.release(graphicsResourceAllocator); + } + } + } + + private BitSet identifyPassesToKeep() { + Deque deque = new ArrayDeque(this.passes.size()); + BitSet bitSet = new BitSet(this.passes.size()); + + for (FrameGraphBuilder.VirtualResource virtualResource : this.externalResources) { + FrameGraphBuilder.Pass pass = virtualResource.handle.createdBy; + if (pass != null) { + this.discoverAllRequiredPasses(pass, bitSet, deque); + } + } + + for (FrameGraphBuilder.Pass pass2 : this.passes) { + if (pass2.disableCulling) { + this.discoverAllRequiredPasses(pass2, bitSet, deque); + } + } + + return bitSet; + } + + private void discoverAllRequiredPasses(FrameGraphBuilder.Pass pass, BitSet bitSet, Deque deque) { + deque.add(pass); + + while (!deque.isEmpty()) { + FrameGraphBuilder.Pass pass2 = (FrameGraphBuilder.Pass)deque.poll(); + if (!bitSet.get(pass2.id)) { + bitSet.set(pass2.id); + + for (int i = pass2.requiredPassIds.nextSetBit(0); i >= 0; i = pass2.requiredPassIds.nextSetBit(i + 1)) { + deque.add((FrameGraphBuilder.Pass)this.passes.get(i)); + } + } + } + } + + private void resolvePassOrder(FrameGraphBuilder.Pass pass, BitSet bitSet, BitSet bitSet2, List list) { + if (bitSet2.get(pass.id)) { + String string = (String)bitSet2.stream().mapToObj(ix -> ((FrameGraphBuilder.Pass)this.passes.get(ix)).name).collect(Collectors.joining(", ")); + throw new IllegalStateException("Frame graph cycle detected between " + string); + } else if (bitSet.get(pass.id)) { + bitSet2.set(pass.id); + bitSet.clear(pass.id); + + for (int i = pass.requiredPassIds.nextSetBit(0); i >= 0; i = pass.requiredPassIds.nextSetBit(i + 1)) { + this.resolvePassOrder((FrameGraphBuilder.Pass)this.passes.get(i), bitSet, bitSet2, list); + } + + for (FrameGraphBuilder.Handle handle : pass.writesFrom) { + for (int j = handle.readBy.nextSetBit(0); j >= 0; j = handle.readBy.nextSetBit(j + 1)) { + if (j != pass.id) { + this.resolvePassOrder((FrameGraphBuilder.Pass)this.passes.get(j), bitSet, bitSet2, list); + } + } + } + + list.add(pass); + bitSet2.clear(pass.id); + } + } + + private void assignResourceLifetimes(Collection collection) { + FrameGraphBuilder.Pass[] passs = new FrameGraphBuilder.Pass[this.internalResources.size()]; + + for (FrameGraphBuilder.Pass pass : collection) { + for (int i = pass.requiredResourceIds.nextSetBit(0); i >= 0; i = pass.requiredResourceIds.nextSetBit(i + 1)) { + FrameGraphBuilder.InternalVirtualResource internalVirtualResource = (FrameGraphBuilder.InternalVirtualResource)this.internalResources.get(i); + FrameGraphBuilder.Pass pass2 = passs[i]; + passs[i] = pass; + if (pass2 == null) { + pass.resourcesToAcquire.add(internalVirtualResource); + } else { + pass2.resourcesToRelease.clear(i); + } + + pass.resourcesToRelease.set(i); + } + } + } + + @Environment(EnvType.CLIENT) + static class ExternalResource extends FrameGraphBuilder.VirtualResource { + private final T resource; + + public ExternalResource(String string, @Nullable FrameGraphBuilder.Pass pass, T object) { + super(string, pass); + this.resource = object; + } + + @Override + public T get() { + return this.resource; + } + } + + @Environment(EnvType.CLIENT) + static class Handle implements ResourceHandle { + final FrameGraphBuilder.VirtualResource holder; + private final int version; + @Nullable + final FrameGraphBuilder.Pass createdBy; + final BitSet readBy = new BitSet(); + @Nullable + private FrameGraphBuilder.Handle aliasedBy; + + Handle(FrameGraphBuilder.VirtualResource virtualResource, int i, @Nullable FrameGraphBuilder.Pass pass) { + this.holder = virtualResource; + this.version = i; + this.createdBy = pass; + } + + @Override + public T get() { + return this.holder.get(); + } + + FrameGraphBuilder.Handle writeAndAlias(FrameGraphBuilder.Pass pass) { + if (this.holder.handle != this) { + throw new IllegalStateException("Handle " + this + " is no longer valid, as its contents were moved into " + this.aliasedBy); + } else { + FrameGraphBuilder.Handle handle = new FrameGraphBuilder.Handle<>(this.holder, this.version + 1, pass); + this.holder.handle = handle; + this.aliasedBy = handle; + return handle; + } + } + + public String toString() { + return this.createdBy != null ? this.holder + "#" + this.version + " (from " + this.createdBy + ")" : this.holder + "#" + this.version; + } + } + + @Environment(EnvType.CLIENT) + public interface Inspector { + FrameGraphBuilder.Inspector NONE = new 1(); + + default void acquireResource(String string) { + } + + default void releaseResource(String string) { + } + + default void beforeExecutePass(String string) { + } + + default void afterExecutePass(String string) { + } + } + + @Environment(EnvType.CLIENT) + static class InternalVirtualResource extends FrameGraphBuilder.VirtualResource { + final int id; + private final ResourceDescriptor descriptor; + @Nullable + private T physicalResource; + + public InternalVirtualResource(int i, String string, @Nullable FrameGraphBuilder.Pass pass, ResourceDescriptor resourceDescriptor) { + super(string, pass); + this.id = i; + this.descriptor = resourceDescriptor; + } + + @Override + public T get() { + return (T)Objects.requireNonNull(this.physicalResource, "Resource is not currently available"); + } + + public void acquire(GraphicsResourceAllocator graphicsResourceAllocator) { + if (this.physicalResource != null) { + throw new IllegalStateException("Tried to acquire physical resource, but it was already assigned"); + } else { + this.physicalResource = graphicsResourceAllocator.acquire(this.descriptor); + } + } + + public void release(GraphicsResourceAllocator graphicsResourceAllocator) { + if (this.physicalResource == null) { + throw new IllegalStateException("Tried to release physical resource that was not allocated"); + } else { + graphicsResourceAllocator.release(this.descriptor, this.physicalResource); + this.physicalResource = null; + } + } + } + + @Environment(EnvType.CLIENT) + class Pass implements FramePass { + final int id; + final String name; + final List> writesFrom = new ArrayList(); + final BitSet requiredResourceIds = new BitSet(); + final BitSet requiredPassIds = new BitSet(); + Runnable task = () -> {}; + final List> resourcesToAcquire = new ArrayList(); + final BitSet resourcesToRelease = new BitSet(); + boolean disableCulling; + + public Pass(final int i, final String string) { + this.id = i; + this.name = string; + } + + private void markResourceRequired(FrameGraphBuilder.Handle handle) { + if (handle.holder instanceof FrameGraphBuilder.InternalVirtualResource internalVirtualResource) { + this.requiredResourceIds.set(internalVirtualResource.id); + } + } + + private void markPassRequired(FrameGraphBuilder.Pass pass) { + this.requiredPassIds.set(pass.id); + } + + @Override + public ResourceHandle createsInternal(String string, ResourceDescriptor resourceDescriptor) { + FrameGraphBuilder.InternalVirtualResource internalVirtualResource = FrameGraphBuilder.this.createInternalResource(string, resourceDescriptor, this); + this.requiredResourceIds.set(internalVirtualResource.id); + return internalVirtualResource.handle; + } + + @Override + public void reads(ResourceHandle resourceHandle) { + this._reads((FrameGraphBuilder.Handle)resourceHandle); + } + + private void _reads(FrameGraphBuilder.Handle handle) { + this.markResourceRequired(handle); + if (handle.createdBy != null) { + this.markPassRequired(handle.createdBy); + } + + handle.readBy.set(this.id); + } + + @Override + public ResourceHandle readsAndWrites(ResourceHandle resourceHandle) { + return this._readsAndWrites((FrameGraphBuilder.Handle)resourceHandle); + } + + @Override + public void requires(FramePass framePass) { + this.requiredPassIds.set(((FrameGraphBuilder.Pass)framePass).id); + } + + @Override + public void disableCulling() { + this.disableCulling = true; + } + + private FrameGraphBuilder.Handle _readsAndWrites(FrameGraphBuilder.Handle handle) { + this.writesFrom.add(handle); + this._reads(handle); + return handle.writeAndAlias(this); + } + + @Override + public void executes(Runnable runnable) { + this.task = runnable; + } + + public String toString() { + return this.name; + } + } + + @Environment(EnvType.CLIENT) + abstract static class VirtualResource { + public final String name; + public FrameGraphBuilder.Handle handle; + + public VirtualResource(String string, @Nullable FrameGraphBuilder.Pass pass) { + this.name = string; + this.handle = new FrameGraphBuilder.Handle<>(this, 0, pass); + } + + public abstract T get(); + + public String toString() { + return this.name; + } + } +} diff --git a/com/mojang/blaze3d/framegraph/FramePass.java b/com/mojang/blaze3d/framegraph/FramePass.java new file mode 100644 index 00000000..3010e3d0 --- /dev/null +++ b/com/mojang/blaze3d/framegraph/FramePass.java @@ -0,0 +1,21 @@ +package com.mojang.blaze3d.framegraph; + +import com.mojang.blaze3d.resource.ResourceDescriptor; +import com.mojang.blaze3d.resource.ResourceHandle; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; + +@Environment(EnvType.CLIENT) +public interface FramePass { + ResourceHandle createsInternal(String string, ResourceDescriptor resourceDescriptor); + + void reads(ResourceHandle resourceHandle); + + ResourceHandle readsAndWrites(ResourceHandle resourceHandle); + + void requires(FramePass framePass); + + void disableCulling(); + + void executes(Runnable runnable); +} diff --git a/com/mojang/blaze3d/framegraph/package-info.java b/com/mojang/blaze3d/framegraph/package-info.java new file mode 100644 index 00000000..82875df7 --- /dev/null +++ b/com/mojang/blaze3d/framegraph/package-info.java @@ -0,0 +1,11 @@ +@ParametersAreNonnullByDefault +@MethodsReturnNonnullByDefault +@FieldsAreNonnullByDefault +@Environment(EnvType.CLIENT) +package com.mojang.blaze3d.framegraph; + +import com.mojang.blaze3d.FieldsAreNonnullByDefault; +import com.mojang.blaze3d.MethodsReturnNonnullByDefault; +import javax.annotation.ParametersAreNonnullByDefault; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; diff --git a/com/mojang/blaze3d/pipeline/RenderPipeline.java b/com/mojang/blaze3d/pipeline/RenderPipeline.java deleted file mode 100644 index 61a0ffdf..00000000 --- a/com/mojang/blaze3d/pipeline/RenderPipeline.java +++ /dev/null @@ -1,99 +0,0 @@ -package com.mojang.blaze3d.pipeline; - -import com.google.common.collect.ImmutableList; -import java.util.List; -import java.util.concurrent.ConcurrentLinkedQueue; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; - -@Environment(EnvType.CLIENT) -public class RenderPipeline { - private final List> renderCalls = ImmutableList.of( - new ConcurrentLinkedQueue(), new ConcurrentLinkedQueue(), new ConcurrentLinkedQueue(), new ConcurrentLinkedQueue() - ); - private volatile boolean isRecording; - private volatile int recordingBuffer; - private volatile boolean isProcessing; - private volatile int processedBuffer; - private volatile int renderingBuffer; - - public RenderPipeline() { - this.recordingBuffer = this.processedBuffer = this.renderingBuffer + 1; - } - - public boolean canBeginRecording() { - return !this.isRecording && this.recordingBuffer == this.processedBuffer; - } - - public boolean beginRecording() { - if (this.isRecording) { - throw new RuntimeException("ALREADY RECORDING !!!"); - } else if (this.canBeginRecording()) { - this.recordingBuffer = (this.processedBuffer + 1) % this.renderCalls.size(); - this.isRecording = true; - return true; - } else { - return false; - } - } - - public void recordRenderCall(RenderCall renderCall) { - if (!this.isRecording) { - throw new RuntimeException("NOT RECORDING !!!"); - } else { - ConcurrentLinkedQueue concurrentLinkedQueue = this.getRecordingQueue(); - concurrentLinkedQueue.add(renderCall); - } - } - - public void endRecording() { - if (this.isRecording) { - this.isRecording = false; - } else { - throw new RuntimeException("NOT RECORDING !!!"); - } - } - - public boolean canBeginProcessing() { - return !this.isProcessing && this.recordingBuffer != this.processedBuffer; - } - - public boolean beginProcessing() { - if (this.isProcessing) { - throw new RuntimeException("ALREADY PROCESSING !!!"); - } else if (this.canBeginProcessing()) { - this.isProcessing = true; - return true; - } else { - return false; - } - } - - public void processRecordedQueue() { - if (!this.isProcessing) { - throw new RuntimeException("NOT PROCESSING !!!"); - } - } - - public void endProcessing() { - if (this.isProcessing) { - this.isProcessing = false; - this.renderingBuffer = this.processedBuffer; - this.processedBuffer = this.recordingBuffer; - } else { - throw new RuntimeException("NOT PROCESSING !!!"); - } - } - - public ConcurrentLinkedQueue startRendering() { - return (ConcurrentLinkedQueue)this.renderCalls.get(this.renderingBuffer); - } - - public ConcurrentLinkedQueue getRecordingQueue() { - return (ConcurrentLinkedQueue)this.renderCalls.get(this.recordingBuffer); - } - - public ConcurrentLinkedQueue getProcessedQueue() { - return (ConcurrentLinkedQueue)this.renderCalls.get(this.processedBuffer); - } -} diff --git a/com/mojang/blaze3d/pipeline/RenderTarget.java b/com/mojang/blaze3d/pipeline/RenderTarget.java index ff41f856..2fdb06b5 100644 --- a/com/mojang/blaze3d/pipeline/RenderTarget.java +++ b/com/mojang/blaze3d/pipeline/RenderTarget.java @@ -11,8 +11,8 @@ import java.util.Objects; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.Util; -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.ShaderInstance; +import net.minecraft.client.renderer.CompiledShaderProgram; +import net.minecraft.client.renderer.CoreShaders; @Environment(EnvType.CLIENT) public abstract class RenderTarget { @@ -38,22 +38,14 @@ public abstract class RenderTarget { this.depthBufferId = -1; } - public void resize(int width, int height, boolean clearError) { - if (!RenderSystem.isOnRenderThread()) { - RenderSystem.recordRenderCall(() -> this._resize(width, height, clearError)); - } else { - this._resize(width, height, clearError); - } - } - - private void _resize(int width, int height, boolean clearError) { + public void resize(int i, int j) { RenderSystem.assertOnRenderThreadOrInit(); GlStateManager._enableDepthTest(); if (this.frameBufferId >= 0) { this.destroyBuffers(); } - this.createBuffers(width, height, clearError); + this.createBuffers(i, j); GlStateManager._glBindFramebuffer(36160, 0); } @@ -86,14 +78,14 @@ public abstract class RenderTarget { GlStateManager._glBindFramebuffer(36160, 0); } - public void createBuffers(int width, int height, boolean clearError) { + public void createBuffers(int i, int j) { RenderSystem.assertOnRenderThreadOrInit(); - int i = RenderSystem.maxSupportedTextureSize(); - if (width > 0 && width <= i && height > 0 && height <= i) { - this.viewWidth = width; - this.viewHeight = height; - this.width = width; - this.height = height; + int k = RenderSystem.maxSupportedTextureSize(); + if (i > 0 && i <= k && j > 0 && j <= k) { + this.viewWidth = i; + this.viewHeight = j; + this.width = i; + this.height = j; this.frameBufferId = GlStateManager.glGenFramebuffers(); this.colorTextureId = TextureUtil.generateTextureId(); if (this.useDepth) { @@ -119,10 +111,10 @@ public abstract class RenderTarget { } this.checkStatus(); - this.clear(clearError); + this.clear(); this.unbindRead(); } else { - throw new IllegalArgumentException("Window " + width + "x" + height + " size out of bounds (max. size: " + i + ")"); + throw new IllegalArgumentException("Window " + i + "x" + j + " size out of bounds (max. size: " + k + ")"); } } @@ -174,14 +166,6 @@ public abstract class RenderTarget { } public void bindWrite(boolean setViewport) { - if (!RenderSystem.isOnRenderThread()) { - RenderSystem.recordRenderCall(() -> this._bindWrite(setViewport)); - } else { - this._bindWrite(setViewport); - } - } - - private void _bindWrite(boolean setViewport) { RenderSystem.assertOnRenderThreadOrInit(); GlStateManager._glBindFramebuffer(36160, this.frameBufferId); if (setViewport) { @@ -190,11 +174,8 @@ public abstract class RenderTarget { } public void unbindWrite() { - if (!RenderSystem.isOnRenderThread()) { - RenderSystem.recordRenderCall(() -> GlStateManager._glBindFramebuffer(36160, 0)); - } else { - GlStateManager._glBindFramebuffer(36160, 0); - } + RenderSystem.assertOnRenderThreadOrInit(); + GlStateManager._glBindFramebuffer(36160, 0); } public void setClearColor(float red, float green, float blue, float alpha) { @@ -205,39 +186,32 @@ public abstract class RenderTarget { } public void blitToScreen(int width, int height) { - this.blitToScreen(width, height, true); + GlStateManager._glBindFramebuffer(36008, this.frameBufferId); + GlStateManager._glBlitFrameBuffer(0, 0, this.width, this.height, 0, 0, width, height, 16384, 9728); + GlStateManager._glBindFramebuffer(36008, 0); } - public void blitToScreen(int width, int height, boolean disableBlend) { - this._blitToScreen(width, height, disableBlend); - } - - private void _blitToScreen(int width, int height, boolean disableBlend) { + public void blitAndBlendToScreen(int i, int j) { RenderSystem.assertOnRenderThread(); GlStateManager._colorMask(true, true, true, false); GlStateManager._disableDepthTest(); GlStateManager._depthMask(false); - GlStateManager._viewport(0, 0, width, height); - if (disableBlend) { - GlStateManager._disableBlend(); - } - - Minecraft minecraft = Minecraft.getInstance(); - ShaderInstance shaderInstance = (ShaderInstance)Objects.requireNonNull(minecraft.gameRenderer.blitShader, "Blit shader not loaded"); - shaderInstance.setSampler("DiffuseSampler", this.colorTextureId); - shaderInstance.apply(); + GlStateManager._viewport(0, 0, i, j); + CompiledShaderProgram compiledShaderProgram = (CompiledShaderProgram)Objects.requireNonNull( + RenderSystem.setShader(CoreShaders.BLIT_SCREEN), "Blit shader not loaded" + ); + compiledShaderProgram.bindSampler("InSampler", this.colorTextureId); BufferBuilder bufferBuilder = RenderSystem.renderThreadTesselator().begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.BLIT_SCREEN); bufferBuilder.addVertex(0.0F, 0.0F, 0.0F); bufferBuilder.addVertex(1.0F, 0.0F, 0.0F); bufferBuilder.addVertex(1.0F, 1.0F, 0.0F); bufferBuilder.addVertex(0.0F, 1.0F, 0.0F); - BufferUploader.draw(bufferBuilder.buildOrThrow()); - shaderInstance.clear(); + BufferUploader.drawWithShader(bufferBuilder.buildOrThrow()); GlStateManager._depthMask(true); GlStateManager._colorMask(true, true, true, true); } - public void clear(boolean clearError) { + public void clear() { RenderSystem.assertOnRenderThreadOrInit(); this.bindWrite(true); GlStateManager._clearColor(this.clearChannels[0], this.clearChannels[1], this.clearChannels[2], this.clearChannels[3]); @@ -247,7 +221,7 @@ public abstract class RenderTarget { i |= 256; } - GlStateManager._clear(i, clearError); + GlStateManager._clear(i); this.unbindWrite(); } diff --git a/com/mojang/blaze3d/pipeline/TextureTarget.java b/com/mojang/blaze3d/pipeline/TextureTarget.java index 567b720a..c5d45e33 100644 --- a/com/mojang/blaze3d/pipeline/TextureTarget.java +++ b/com/mojang/blaze3d/pipeline/TextureTarget.java @@ -6,9 +6,9 @@ import net.fabricmc.api.Environment; @Environment(EnvType.CLIENT) public class TextureTarget extends RenderTarget { - public TextureTarget(int width, int height, boolean useDepth, boolean clearError) { - super(useDepth); + public TextureTarget(int i, int j, boolean bl) { + super(bl); RenderSystem.assertOnRenderThreadOrInit(); - this.resize(width, height, clearError); + this.resize(i, j); } } diff --git a/com/mojang/blaze3d/platform/ClientShutdownWatchdog.java b/com/mojang/blaze3d/platform/ClientShutdownWatchdog.java new file mode 100644 index 00000000..69e491e7 --- /dev/null +++ b/com/mojang/blaze3d/platform/ClientShutdownWatchdog.java @@ -0,0 +1,30 @@ +package com.mojang.blaze3d.platform; + +import java.io.File; +import java.time.Duration; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.CrashReport; +import net.minecraft.client.Minecraft; +import net.minecraft.server.dedicated.ServerWatchdog; + +@Environment(EnvType.CLIENT) +public class ClientShutdownWatchdog { + private static final Duration CRASH_REPORT_PRELOAD_LOAD = Duration.ofSeconds(15L); + + public static void startShutdownWatchdog(File file, long l) { + Thread thread = new Thread(() -> { + try { + Thread.sleep(CRASH_REPORT_PRELOAD_LOAD); + } catch (InterruptedException var4) { + return; + } + + CrashReport crashReport = ServerWatchdog.createWatchdogCrashReport("Client shutdown", l); + Minecraft.saveReport(file, crashReport); + }); + thread.setDaemon(true); + thread.setName("Client shutdown watchdog"); + thread.start(); + } +} diff --git a/com/mojang/blaze3d/platform/FramerateLimitTracker.java b/com/mojang/blaze3d/platform/FramerateLimitTracker.java new file mode 100644 index 00000000..5404bf17 --- /dev/null +++ b/com/mojang/blaze3d/platform/FramerateLimitTracker.java @@ -0,0 +1,56 @@ +package com.mojang.blaze3d.platform; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.Util; +import net.minecraft.client.InactivityFpsLimit; +import net.minecraft.client.Minecraft; +import net.minecraft.client.Options; + +@Environment(EnvType.CLIENT) +public class FramerateLimitTracker { + private static final int OUT_OF_LEVEL_MENU_LIMIT = 60; + private static final int ICONIFIED_WINDOW_LIMIT = 10; + private static final int AFK_LIMIT = 30; + private static final int LONG_AFK_LIMIT = 10; + private static final long AFK_THRESHOLD_MS = 60000L; + private static final long LONG_AFK_THRESHOLD_MS = 600000L; + private final Options options; + private final Minecraft minecraft; + private int framerateLimit; + private long latestInputTime; + + public FramerateLimitTracker(Options options, Minecraft minecraft) { + this.options = options; + this.minecraft = minecraft; + this.framerateLimit = options.framerateLimit().get(); + } + + public int getFramerateLimit() { + InactivityFpsLimit inactivityFpsLimit = this.options.inactivityFpsLimit().get(); + if (this.minecraft.getWindow().isIconified()) { + return 10; + } else { + if (inactivityFpsLimit == InactivityFpsLimit.AFK) { + long l = Util.getMillis() - this.latestInputTime; + if (l > 600000L) { + return 10; + } + + if (l > 60000L) { + return Math.min(this.framerateLimit, 30); + } + } + + return this.minecraft.level != null || this.minecraft.screen == null && this.minecraft.getOverlay() == null ? this.framerateLimit : 60; + } + } + + public void setFramerateLimit(int i) { + this.framerateLimit = i; + } + + public void onInputReceived() { + this.latestInputTime = Util.getMillis(); + } +} diff --git a/com/mojang/blaze3d/platform/GLX.java b/com/mojang/blaze3d/platform/GLX.java index e8afa9fc..d81e7dae 100644 --- a/com/mojang/blaze3d/platform/GLX.java +++ b/com/mojang/blaze3d/platform/GLX.java @@ -17,7 +17,7 @@ import java.util.function.LongSupplier; import java.util.function.Supplier; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; -import net.minecraft.client.renderer.GameRenderer; +import net.minecraft.client.renderer.CoreShaders; import org.lwjgl.Version; import org.lwjgl.glfw.GLFW; import org.lwjgl.glfw.GLFWErrorCallback; @@ -110,7 +110,7 @@ public class GLX { RenderSystem.assertOnRenderThread(); GlStateManager._depthMask(false); GlStateManager._disableCull(); - RenderSystem.setShader(GameRenderer::getRendertypeLinesShader); + RenderSystem.setShader(CoreShaders.RENDERTYPE_LINES); Tesselator tesselator = RenderSystem.renderThreadTesselator(); BufferBuilder bufferBuilder = tesselator.begin(VertexFormat.Mode.LINES, DefaultVertexFormat.POSITION_COLOR_NORMAL); RenderSystem.lineWidth(4.0F); diff --git a/com/mojang/blaze3d/platform/GlConst.java b/com/mojang/blaze3d/platform/GlConst.java index b4cd2cb1..afbde063 100644 --- a/com/mojang/blaze3d/platform/GlConst.java +++ b/com/mojang/blaze3d/platform/GlConst.java @@ -18,6 +18,8 @@ public class GlConst { public static final int GL_TRIANGLE_FAN = 6; public static final int GL_TRIANGLES = 4; public static final int GL_WRITE_ONLY = 35001; + public static final int GL_READ_ONLY = 35000; + public static final int GL_MAP_READ_BIT = 1; public static final int GL_EQUAL = 514; public static final int GL_LEQUAL = 515; public static final int GL_GREATER = 516; @@ -69,6 +71,16 @@ public class GlConst { public static final int GL_DEPTH_COMPONENT24 = 33190; public static final int GL_STATIC_DRAW = 35044; public static final int GL_DYNAMIC_DRAW = 35048; + public static final int GL_STREAM_DRAW = 35040; + public static final int GL_STATIC_READ = 35045; + public static final int GL_DYNAMIC_READ = 35049; + public static final int GL_STREAM_READ = 35041; + public static final int GL_STATIC_COPY = 35046; + public static final int GL_DYNAMIC_COPY = 35050; + public static final int GL_STREAM_COPY = 35042; + public static final int GL_SYNC_GPU_COMMANDS_COMPLETE = 37143; + public static final int GL_TIMEOUT_EXPIRED = 37147; + public static final int GL_WAIT_FAILED = 37149; public static final int GL_UNPACK_SWAP_BYTES = 3312; public static final int GL_UNPACK_LSB_FIRST = 3313; public static final int GL_UNPACK_ROW_LENGTH = 3314; @@ -101,6 +113,11 @@ public class GlConst { public static final int GL_TEXTURE_COMPARE_MODE = 34892; public static final int GL_ARRAY_BUFFER = 34962; public static final int GL_ELEMENT_ARRAY_BUFFER = 34963; + public static final int GL_PIXEL_PACK_BUFFER = 35051; + public static final int GL_COPY_READ_BUFFER = 36662; + public static final int GL_COPY_WRITE_BUFFER = 36663; + public static final int GL_PIXEL_UNPACK_BUFFER = 35052; + public static final int GL_UNIFORM_BUFFER = 35345; public static final int GL_ALPHA_BIAS = 3357; public static final int GL_RGB = 6407; public static final int GL_RG = 33319; diff --git a/com/mojang/blaze3d/platform/GlStateManager.java b/com/mojang/blaze3d/platform/GlStateManager.java index 59c628f7..c1e6a127 100644 --- a/com/mojang/blaze3d/platform/GlStateManager.java +++ b/com/mojang/blaze3d/platform/GlStateManager.java @@ -3,10 +3,11 @@ package com.mojang.blaze3d.platform; import com.google.common.base.Charsets; import com.mojang.blaze3d.DontObfuscate; import com.mojang.blaze3d.systems.RenderSystem; +import com.mojang.jtracy.Plot; +import com.mojang.jtracy.TracyClient; import java.nio.ByteBuffer; import java.nio.FloatBuffer; import java.nio.IntBuffer; -import java.util.List; import java.util.function.Consumer; import java.util.stream.IntStream; import net.fabricmc.api.EnvType; @@ -23,6 +24,7 @@ import org.lwjgl.opengl.GL15; import org.lwjgl.opengl.GL20; import org.lwjgl.opengl.GL20C; import org.lwjgl.opengl.GL30; +import org.lwjgl.opengl.GL32; import org.lwjgl.opengl.GL32C; import org.lwjgl.system.MemoryStack; import org.lwjgl.system.MemoryUtil; @@ -31,6 +33,10 @@ import org.lwjgl.system.MemoryUtil; @DontObfuscate public class GlStateManager { private static final boolean ON_LINUX = Util.getPlatform() == Util.OS.LINUX; + private static final Plot PLOT_TEXTURES = TracyClient.createPlot("GPU Textures"); + private static int numTextures = 0; + private static final Plot PLOT_BUFFERS = TracyClient.createPlot("GPU Buffers"); + private static int numBuffers = 0; public static final int TEXTURE_COUNT = 12; private static final GlStateManager.BlendState BLEND = new GlStateManager.BlendState(); private static final GlStateManager.DepthState DEPTH = new GlStateManager.DepthState(); @@ -39,6 +45,8 @@ public class GlStateManager { private static final GlStateManager.ColorLogicState COLOR_LOGIC = new GlStateManager.ColorLogicState(); private static final GlStateManager.StencilState STENCIL = new GlStateManager.StencilState(); private static final GlStateManager.ScissorState SCISSOR = new GlStateManager.ScissorState(); + private static final GlStateManager.FramebufferState READ_FRAMEBUFFER = new GlStateManager.FramebufferState(); + private static final GlStateManager.FramebufferState DRAW_FRAMEBUFFER = new GlStateManager.FramebufferState(); private static int activeTexture; private static final GlStateManager.TextureState[] TEXTURES = (GlStateManager.TextureState[])IntStream.range(0, 12) .mapToObj(i -> new GlStateManager.TextureState()) @@ -141,15 +149,9 @@ public class GlStateManager { return GL20.glCreateShader(i); } - public static void glShaderSource(int i, List list) { + public static void glShaderSource(int i, String string) { RenderSystem.assertOnRenderThread(); - StringBuilder stringBuilder = new StringBuilder(); - - for (String string : list) { - stringBuilder.append(string); - } - - byte[] bs = stringBuilder.toString().getBytes(Charsets.UTF_8); + byte[] bs = string.getBytes(Charsets.UTF_8); ByteBuffer byteBuffer = MemoryUtil.memAlloc(bs.length + 1); byteBuffer.put(bs); byteBuffer.put((byte)0); @@ -271,6 +273,8 @@ public class GlStateManager { public static int _glGenBuffers() { RenderSystem.assertOnRenderThreadOrInit(); + numBuffers++; + PLOT_BUFFERS.setValue(numBuffers); return GL15.glGenBuffers(); } @@ -294,6 +298,11 @@ public class GlStateManager { GL15.glBufferData(i, byteBuffer, j); } + public static void _glBufferSubData(int i, int j, ByteBuffer byteBuffer) { + RenderSystem.assertOnRenderThreadOrInit(); + GL15.glBufferSubData(i, (long)j, byteBuffer); + } + public static void _glBufferData(int i, long l, int j) { RenderSystem.assertOnRenderThreadOrInit(); GL15.glBufferData(i, l, j); @@ -305,6 +314,12 @@ public class GlStateManager { return GL15.glMapBuffer(i, j); } + @Nullable + public static ByteBuffer _glMapBufferRange(int i, int j, int k, int l) { + RenderSystem.assertOnRenderThreadOrInit(); + return GL30.glMapBufferRange(i, j, k, l); + } + public static void _glUnmapBuffer(int i) { RenderSystem.assertOnRenderThreadOrInit(); GL15.glUnmapBuffer(i); @@ -318,6 +333,8 @@ public class GlStateManager { GL32C.glBindBuffer(34962, 0); } + numBuffers--; + PLOT_BUFFERS.setValue(numBuffers); GL15.glDeleteBuffers(i); } @@ -333,7 +350,16 @@ public class GlStateManager { public static void _glBindFramebuffer(int i, int j) { RenderSystem.assertOnRenderThreadOrInit(); - GL30.glBindFramebuffer(i, j); + + boolean bl = switch (i) { + case 36008 -> READ_FRAMEBUFFER.update(j); + case 36009 -> DRAW_FRAMEBUFFER.update(j); + case 36160 -> READ_FRAMEBUFFER.update(j) | DRAW_FRAMEBUFFER.update(j); + default -> true; + }; + if (bl) { + GL30.glBindFramebuffer(i, j); + } } public static void _glBlitFrameBuffer(int i, int j, int k, int l, int m, int n, int o, int p, int q, int r) { @@ -507,11 +533,15 @@ public class GlStateManager { public static int _genTexture() { RenderSystem.assertOnRenderThreadOrInit(); + numTextures++; + PLOT_TEXTURES.setValue(numTextures); return GL11.glGenTextures(); } public static void _genTextures(int[] is) { RenderSystem.assertOnRenderThreadOrInit(); + numTextures += is.length; + PLOT_TEXTURES.setValue(numTextures); GL11.glGenTextures(is); } @@ -524,6 +554,9 @@ public class GlStateManager { textureState.binding = -1; } } + + numTextures--; + PLOT_TEXTURES.setValue(numTextures); } public static void _deleteTextures(int[] is) { @@ -538,6 +571,8 @@ public class GlStateManager { } GL11.glDeleteTextures(is); + numTextures -= is.length; + PLOT_TEXTURES.setValue(numTextures); } public static void _bindTexture(int i) { @@ -651,10 +686,10 @@ public class GlStateManager { GL11.glClearStencil(i); } - public static void _clear(int i, boolean bl) { + public static void _clear(int i) { RenderSystem.assertOnRenderThreadOrInit(); GL11.glClear(i); - if (bl) { + if (MacosUtil.IS_MACOS) { _getError(); } } @@ -719,6 +754,21 @@ public class GlStateManager { return GL11.glGetInteger(i); } + public static long _glFenceSync(int i, int j) { + RenderSystem.assertOnRenderThreadOrInit(); + return GL32.glFenceSync(i, j); + } + + public static int _glClientWaitSync(long l, int i, long m) { + RenderSystem.assertOnRenderThreadOrInit(); + return GL32.glClientWaitSync(l, i, m); + } + + public static void _glDeleteSync(long l) { + RenderSystem.assertOnRenderThreadOrInit(); + GL32.glDeleteSync(l); + } + @Environment(EnvType.CLIENT) static class BlendState { public final GlStateManager.BooleanState mode = new GlStateManager.BooleanState(3042); @@ -810,6 +860,20 @@ public class GlStateManager { } } + @Environment(EnvType.CLIENT) + static class FramebufferState { + public int binding; + + public boolean update(int i) { + if (i != this.binding) { + this.binding = i; + return true; + } else { + return false; + } + } + } + @Environment(EnvType.CLIENT) public static enum LogicOp { AND(5377), diff --git a/com/mojang/blaze3d/platform/MacosUtil.java b/com/mojang/blaze3d/platform/MacosUtil.java index 97b08253..a3c8b2d3 100644 --- a/com/mojang/blaze3d/platform/MacosUtil.java +++ b/com/mojang/blaze3d/platform/MacosUtil.java @@ -6,6 +6,7 @@ import com.sun.jna.Pointer; import java.io.IOException; import java.io.InputStream; import java.util.Base64; +import java.util.Locale; import java.util.Optional; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; @@ -14,6 +15,7 @@ import org.lwjgl.glfw.GLFWNativeCocoa; @Environment(EnvType.CLIENT) public class MacosUtil { + public static final boolean IS_MACOS = System.getProperty("os.name").toLowerCase(Locale.ROOT).contains("mac"); private static final int NS_RESIZABLE_WINDOW_MASK = 8; private static final int NS_FULL_SCREEN_WINDOW_MASK = 16384; diff --git a/com/mojang/blaze3d/platform/NativeImage.java b/com/mojang/blaze3d/platform/NativeImage.java index 298e372d..b9d03f50 100644 --- a/com/mojang/blaze3d/platform/NativeImage.java +++ b/com/mojang/blaze3d/platform/NativeImage.java @@ -1,14 +1,14 @@ package com.mojang.blaze3d.platform; import com.mojang.blaze3d.systems.RenderSystem; +import com.mojang.jtracy.MemoryPool; +import com.mojang.jtracy.TracyClient; import com.mojang.logging.LogUtils; -import java.io.ByteArrayOutputStream; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.nio.ByteBuffer; import java.nio.IntBuffer; -import java.nio.channels.Channels; import java.nio.channels.WritableByteChannel; import java.nio.file.Files; import java.nio.file.Path; @@ -21,7 +21,7 @@ import java.util.function.IntUnaryOperator; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.gui.font.providers.FreeTypeUtil; -import net.minecraft.util.FastColor; +import net.minecraft.util.ARGB; import net.minecraft.util.PngInfo; import org.apache.commons.io.IOUtils; import org.jetbrains.annotations.Nullable; @@ -40,6 +40,7 @@ import org.slf4j.Logger; @Environment(EnvType.CLIENT) public final class NativeImage implements AutoCloseable { private static final Logger LOGGER = LogUtils.getLogger(); + private static final MemoryPool MEMORY_POOL = TracyClient.createMemoryPool("NativeImage"); private static final Set OPEN_OPTIONS = EnumSet.of( StandardOpenOption.WRITE, StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING ); @@ -67,6 +68,7 @@ public final class NativeImage implements AutoCloseable { this.pixels = MemoryUtil.nmemAlloc(this.size); } + MEMORY_POOL.malloc(this.pixels, (int)this.size); if (this.pixels == 0L) { throw new IllegalStateException("Unable to allocate texture of size " + width + "x" + height + " (" + format.components() + " channels)"); } @@ -140,7 +142,7 @@ public final class NativeImage implements AutoCloseable { } else { PngInfo.validateHeader(textureData); - NativeImage var7; + NativeImage var9; try (MemoryStack memoryStack = MemoryStack.stackPush()) { IntBuffer intBuffer = memoryStack.mallocInt(1); IntBuffer intBuffer2 = memoryStack.mallocInt(1); @@ -150,12 +152,12 @@ public final class NativeImage implements AutoCloseable { throw new IOException("Could not load image: " + STBImage.stbi_failure_reason()); } - var7 = new NativeImage( - format == null ? NativeImage.Format.getStbFormat(intBuffer3.get(0)) : format, intBuffer.get(0), intBuffer2.get(0), true, MemoryUtil.memAddress(byteBuffer) - ); + long l = MemoryUtil.memAddress(byteBuffer); + MEMORY_POOL.malloc(l, byteBuffer.limit()); + var9 = new NativeImage(format == null ? NativeImage.Format.getStbFormat(intBuffer3.get(0)) : format, intBuffer.get(0), intBuffer2.get(0), true, l); } - return var7; + return var9; } } @@ -183,6 +185,8 @@ public final class NativeImage implements AutoCloseable { } else { MemoryUtil.nmemFree(this.pixels); } + + MEMORY_POOL.free(this.pixels); } this.pixels = 0L; @@ -200,30 +204,38 @@ public final class NativeImage implements AutoCloseable { return this.format; } - public int getPixelRGBA(int x, int y) { + private int getPixelABGR(int i, int j) { if (this.format != NativeImage.Format.RGBA) { throw new IllegalArgumentException(String.format(Locale.ROOT, "getPixelRGBA only works on RGBA images; have %s", this.format)); - } else if (this.isOutsideBounds(x, y)) { - throw new IllegalArgumentException(String.format(Locale.ROOT, "(%s, %s) outside of image bounds (%s, %s)", x, y, this.width, this.height)); + } else if (this.isOutsideBounds(i, j)) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "(%s, %s) outside of image bounds (%s, %s)", i, j, this.width, this.height)); } else { this.checkAllocated(); - long l = (x + (long)y * this.width) * 4L; + long l = (i + (long)j * this.width) * 4L; return MemoryUtil.memGetInt(this.pixels + l); } } - public void setPixelRGBA(int x, int y, int abgrColor) { + public int getPixel(int i, int j) { + return ARGB.fromABGR(this.getPixelABGR(i, j)); + } + + private void setPixelABGR(int i, int j, int k) { if (this.format != NativeImage.Format.RGBA) { throw new IllegalArgumentException(String.format(Locale.ROOT, "setPixelRGBA only works on RGBA images; have %s", this.format)); - } else if (this.isOutsideBounds(x, y)) { - throw new IllegalArgumentException(String.format(Locale.ROOT, "(%s, %s) outside of image bounds (%s, %s)", x, y, this.width, this.height)); + } else if (this.isOutsideBounds(i, j)) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "(%s, %s) outside of image bounds (%s, %s)", i, j, this.width, this.height)); } else { this.checkAllocated(); - long l = (x + (long)y * this.width) * 4L; - MemoryUtil.memPutInt(this.pixels + l, abgrColor); + long l = (i + (long)j * this.width) * 4L; + MemoryUtil.memPutInt(this.pixels + l, k); } } + public void setPixel(int i, int j, int k) { + this.setPixelABGR(i, j, ARGB.toABGR(k)); + } + public NativeImage mappedCopy(IntUnaryOperator function) { if (this.format != NativeImage.Format.RGBA) { throw new IllegalArgumentException(String.format(Locale.ROOT, "function application only works on RGBA images; have %s", this.format)); @@ -235,7 +247,9 @@ public final class NativeImage implements AutoCloseable { IntBuffer intBuffer2 = MemoryUtil.memIntBuffer(nativeImage.pixels, i); for (int j = 0; j < i; j++) { - intBuffer2.put(j, function.applyAsInt(intBuffer.get(j))); + int k = ARGB.fromABGR(intBuffer.get(j)); + int l = function.applyAsInt(k); + intBuffer2.put(j, ARGB.toABGR(l)); } return nativeImage; @@ -251,14 +265,16 @@ public final class NativeImage implements AutoCloseable { IntBuffer intBuffer = MemoryUtil.memIntBuffer(this.pixels, i); for (int j = 0; j < i; j++) { - intBuffer.put(j, function.applyAsInt(intBuffer.get(j))); + int k = ARGB.fromABGR(intBuffer.get(j)); + int l = function.applyAsInt(k); + intBuffer.put(j, ARGB.toABGR(l)); } } } - public int[] getPixelsRGBA() { + public int[] getPixelsABGR() { if (this.format != NativeImage.Format.RGBA) { - throw new IllegalArgumentException(String.format(Locale.ROOT, "getPixelsRGBA only works on RGBA images; have %s", this.format)); + throw new IllegalArgumentException(String.format(Locale.ROOT, "getPixels only works on RGBA images; have %s", this.format)); } else { this.checkAllocated(); int[] is = new int[this.width * this.height]; @@ -267,53 +283,14 @@ public final class NativeImage implements AutoCloseable { } } - public void setPixelLuminance(int x, int y, byte luminance) { - RenderSystem.assertOnRenderThread(); - if (!this.format.hasLuminance()) { - throw new IllegalArgumentException(String.format(Locale.ROOT, "setPixelLuminance only works on image with luminance; have %s", this.format)); - } else if (this.isOutsideBounds(x, y)) { - throw new IllegalArgumentException(String.format(Locale.ROOT, "(%s, %s) outside of image bounds (%s, %s)", x, y, this.width, this.height)); - } else { - this.checkAllocated(); - long l = (x + (long)y * this.width) * this.format.components() + this.format.luminanceOffset() / 8; - MemoryUtil.memPutByte(this.pixels + l, luminance); - } - } + public int[] getPixels() { + int[] is = this.getPixelsABGR(); - public byte getRedOrLuminance(int x, int y) { - RenderSystem.assertOnRenderThread(); - if (!this.format.hasLuminanceOrRed()) { - throw new IllegalArgumentException(String.format(Locale.ROOT, "no red or luminance in %s", this.format)); - } else if (this.isOutsideBounds(x, y)) { - throw new IllegalArgumentException(String.format(Locale.ROOT, "(%s, %s) outside of image bounds (%s, %s)", x, y, this.width, this.height)); - } else { - int i = (x + y * this.width) * this.format.components() + this.format.luminanceOrRedOffset() / 8; - return MemoryUtil.memGetByte(this.pixels + i); + for (int i = 0; i < is.length; i++) { + is[i] = ARGB.fromABGR(is[i]); } - } - public byte getGreenOrLuminance(int x, int y) { - RenderSystem.assertOnRenderThread(); - if (!this.format.hasLuminanceOrGreen()) { - throw new IllegalArgumentException(String.format(Locale.ROOT, "no green or luminance in %s", this.format)); - } else if (this.isOutsideBounds(x, y)) { - throw new IllegalArgumentException(String.format(Locale.ROOT, "(%s, %s) outside of image bounds (%s, %s)", x, y, this.width, this.height)); - } else { - int i = (x + y * this.width) * this.format.components() + this.format.luminanceOrGreenOffset() / 8; - return MemoryUtil.memGetByte(this.pixels + i); - } - } - - public byte getBlueOrLuminance(int x, int y) { - RenderSystem.assertOnRenderThread(); - if (!this.format.hasLuminanceOrBlue()) { - throw new IllegalArgumentException(String.format(Locale.ROOT, "no blue or luminance in %s", this.format)); - } else if (this.isOutsideBounds(x, y)) { - throw new IllegalArgumentException(String.format(Locale.ROOT, "(%s, %s) outside of image bounds (%s, %s)", x, y, this.width, this.height)); - } else { - int i = (x + y * this.width) * this.format.components() + this.format.luminanceOrBlueOffset() / 8; - return MemoryUtil.memGetByte(this.pixels + i); - } + return is; } public byte getLuminanceOrAlpha(int x, int y) { @@ -327,48 +304,6 @@ public final class NativeImage implements AutoCloseable { } } - public void blendPixel(int x, int y, int abgrColor) { - if (this.format != NativeImage.Format.RGBA) { - throw new UnsupportedOperationException("Can only call blendPixel with RGBA format"); - } else { - int i = this.getPixelRGBA(x, y); - float f = FastColor.ABGR32.alpha(abgrColor) / 255.0F; - float g = FastColor.ABGR32.blue(abgrColor) / 255.0F; - float h = FastColor.ABGR32.green(abgrColor) / 255.0F; - float j = FastColor.ABGR32.red(abgrColor) / 255.0F; - float k = FastColor.ABGR32.alpha(i) / 255.0F; - float l = FastColor.ABGR32.blue(i) / 255.0F; - float m = FastColor.ABGR32.green(i) / 255.0F; - float n = FastColor.ABGR32.red(i) / 255.0F; - float p = 1.0F - f; - float q = f * f + k * p; - float r = g * f + l * p; - float s = h * f + m * p; - float t = j * f + n * p; - if (q > 1.0F) { - q = 1.0F; - } - - if (r > 1.0F) { - r = 1.0F; - } - - if (s > 1.0F) { - s = 1.0F; - } - - if (t > 1.0F) { - t = 1.0F; - } - - int u = (int)(q * 255.0F); - int v = (int)(r * 255.0F); - int w = (int)(s * 255.0F); - int z = (int)(t * 255.0F); - this.setPixelRGBA(x, y, FastColor.ABGR32.color(u, v, w, z)); - } - } - @Deprecated public int[] makePixelArray() { if (this.format != NativeImage.Format.RGBA) { @@ -379,10 +314,7 @@ public final class NativeImage implements AutoCloseable { for (int i = 0; i < this.getHeight(); i++) { for (int j = 0; j < this.getWidth(); j++) { - int k = this.getPixelRGBA(j, i); - is[j + i * this.getWidth()] = FastColor.ARGB32.color( - FastColor.ABGR32.alpha(k), FastColor.ABGR32.red(k), FastColor.ABGR32.green(k), FastColor.ABGR32.blue(k) - ); + is[j + i * this.getWidth()] = this.getPixel(j, i); } } @@ -464,7 +396,7 @@ public final class NativeImage implements AutoCloseable { if (opaque && this.format.hasAlpha()) { for (int i = 0; i < this.getHeight(); i++) { for (int j = 0; j < this.getWidth(); j++) { - this.setPixelRGBA(j, i, this.getPixelRGBA(j, i) | 255 << this.format.alphaOffset()); + this.setPixelABGR(j, i, this.getPixelABGR(j, i) | 255 << this.format.alphaOffset()); } } } @@ -545,48 +477,6 @@ public final class NativeImage implements AutoCloseable { } } - public byte[] asByteArray() throws IOException { - ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); - - byte[] var3; - try { - WritableByteChannel writableByteChannel = Channels.newChannel(byteArrayOutputStream); - - try { - if (!this.writeToChannel(writableByteChannel)) { - throw new IOException("Could not write image to byte array: " + STBImage.stbi_failure_reason()); - } - - var3 = byteArrayOutputStream.toByteArray(); - } catch (Throwable var7) { - if (writableByteChannel != null) { - try { - writableByteChannel.close(); - } catch (Throwable var6) { - var7.addSuppressed(var6); - } - } - - throw var7; - } - - if (writableByteChannel != null) { - writableByteChannel.close(); - } - } catch (Throwable var8) { - try { - byteArrayOutputStream.close(); - } catch (Throwable var5) { - var8.addSuppressed(var5); - } - - throw var8; - } - - byteArrayOutputStream.close(); - return var3; - } - private boolean writeToChannel(WritableByteChannel channel) throws IOException { NativeImage.WriteCallback writeCallback = new NativeImage.WriteCallback(channel); @@ -635,7 +525,7 @@ public final class NativeImage implements AutoCloseable { public void fillRect(int x, int y, int width, int height, int value) { for (int i = y; i < y + height; i++) { for (int j = x; j < x + width; j++) { - this.setPixelRGBA(j, i, value); + this.setPixel(j, i, value); } } } @@ -649,8 +539,8 @@ public final class NativeImage implements AutoCloseable { for (int j = 0; j < width; j++) { int k = mirrorX ? width - 1 - j : j; int l = mirrorY ? height - 1 - i : i; - int m = this.getPixelRGBA(xFrom + j, yFrom + i); - source.setPixelRGBA(xTo + k, yTo + l, m); + int m = this.getPixelABGR(xFrom + j, yFrom + i); + source.setPixelABGR(xTo + k, yTo + l, m); } } } diff --git a/com/mojang/blaze3d/platform/Window.java b/com/mojang/blaze3d/platform/Window.java index ceaa18b1..60e399ec 100644 --- a/com/mojang/blaze3d/platform/Window.java +++ b/com/mojang/blaze3d/platform/Window.java @@ -1,5 +1,6 @@ package com.mojang.blaze3d.platform; +import com.mojang.blaze3d.TracyFrameCapture; import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.logging.LogUtils; import java.io.IOException; @@ -12,7 +13,9 @@ import java.util.Optional; import java.util.function.BiConsumer; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; -import net.minecraft.client.Minecraft; +import net.minecraft.CrashReport; +import net.minecraft.CrashReportCategory; +import net.minecraft.ReportedException; import net.minecraft.client.main.SilentInitException; import net.minecraft.server.packs.PackResources; import net.minecraft.server.packs.resources.IoSupplier; @@ -22,6 +25,7 @@ import org.lwjgl.glfw.Callbacks; import org.lwjgl.glfw.GLFW; import org.lwjgl.glfw.GLFWErrorCallback; import org.lwjgl.glfw.GLFWImage; +import org.lwjgl.glfw.GLFWWindowCloseCallback; import org.lwjgl.glfw.GLFWImage.Buffer; import org.lwjgl.opengl.GL; import org.lwjgl.system.MemoryStack; @@ -56,8 +60,8 @@ public final class Window implements AutoCloseable { private double guiScale; private String errorSection = ""; private boolean dirty; - private int framerateLimit; private boolean vsync; + private boolean iconified; public Window( WindowEventHandler eventHandler, ScreenManager screenManager, DisplayData displayData, @Nullable String preferredFullscreenVideoMode, String title @@ -110,6 +114,7 @@ public final class Window implements AutoCloseable { GLFW.glfwSetWindowSizeCallback(this.window, this::onResize); GLFW.glfwSetWindowFocusCallback(this.window, this::onFocus); GLFW.glfwSetCursorEnterCallback(this.window, this::onEnter); + GLFW.glfwSetWindowIconifyCallback(this.window, this::onIconify); } public static String getPlatform() { @@ -162,7 +167,7 @@ public final class Window implements AutoCloseable { try (NativeImage nativeImage = NativeImage.read((InputStream)((IoSupplier)list.get(j)).get())) { ByteBuffer byteBuffer = MemoryUtil.memAlloc(nativeImage.getWidth() * nativeImage.getHeight() * 4); list2.add(byteBuffer); - byteBuffer.asIntBuffer().put(nativeImage.getPixelsRGBA()); + byteBuffer.asIntBuffer().put(nativeImage.getPixelsABGR()); buffer.position(j); buffer.width(nativeImage.getWidth()); buffer.height(nativeImage.getHeight()); @@ -243,7 +248,15 @@ public final class Window implements AutoCloseable { this.framebufferWidth = framebufferWidth; this.framebufferHeight = framebufferHeight; if (this.getWidth() != i || this.getHeight() != j) { - this.eventHandler.resizeDisplay(); + try { + this.eventHandler.resizeDisplay(); + } catch (Exception var10) { + CrashReport crashReport = CrashReport.forThrowable(var10, "Window resize"); + CrashReportCategory crashReportCategory = crashReport.addCategory("Window Dimensions"); + crashReportCategory.setDetail("Old", i + "x" + j); + crashReportCategory.setDetail("New", framebufferWidth + "x" + framebufferHeight); + throw new ReportedException(crashReport); + } } } } @@ -277,19 +290,15 @@ public final class Window implements AutoCloseable { } } - public void setFramerateLimit(int limit) { - this.framerateLimit = limit; + private void onIconify(long l, boolean bl) { + this.iconified = bl; } - public int getFramerateLimit() { - return this.framerateLimit; - } - - public void updateDisplay() { - RenderSystem.flipFrame(this.window); + public void updateDisplay(@Nullable TracyFrameCapture tracyFrameCapture) { + RenderSystem.flipFrame(this.window, tracyFrameCapture); if (this.fullscreen != this.actuallyFullscreen) { this.actuallyFullscreen = this.fullscreen; - this.updateFullscreen(this.vsync); + this.updateFullscreen(this.vsync, tracyFrameCapture); } } @@ -321,7 +330,7 @@ public final class Window implements AutoCloseable { LOGGER.warn("Failed to find suitable monitor for fullscreen mode"); this.fullscreen = false; } else { - if (Minecraft.ON_OSX) { + if (MacosUtil.IS_MACOS) { MacosUtil.exitNativeFullscreen(this.window); } @@ -338,7 +347,7 @@ public final class Window implements AutoCloseable { this.width = videoMode.getWidth(); this.height = videoMode.getHeight(); GLFW.glfwSetWindowMonitor(this.window, monitor.getMonitor(), this.x, this.y, this.width, this.height, videoMode.getRefreshRate()); - if (Minecraft.ON_OSX) { + if (MacosUtil.IS_MACOS) { MacosUtil.clearResizableBit(this.window); } } @@ -362,16 +371,16 @@ public final class Window implements AutoCloseable { this.setMode(); } - private void updateFullscreen(boolean vsyncEnabled) { + private void updateFullscreen(boolean bl, @Nullable TracyFrameCapture tracyFrameCapture) { RenderSystem.assertOnRenderThread(); try { this.setMode(); this.eventHandler.resizeDisplay(); - this.updateVsync(vsyncEnabled); - this.updateDisplay(); - } catch (Exception var3) { - LOGGER.error("Couldn't toggle fullscreen", (Throwable)var3); + this.updateVsync(bl); + this.updateDisplay(tracyFrameCapture); + } catch (Exception var4) { + LOGGER.error("Couldn't toggle fullscreen", (Throwable)var4); } } @@ -418,6 +427,10 @@ public final class Window implements AutoCloseable { return this.fullscreen; } + public boolean isIconified() { + return this.iconified; + } + public int getWidth() { return this.framebufferWidth; } @@ -471,6 +484,13 @@ public final class Window implements AutoCloseable { InputConstants.updateRawMouseInput(this.window, enableRawMouseMotion); } + public void setWindowCloseCallback(Runnable runnable) { + GLFWWindowCloseCallback gLFWWindowCloseCallback = GLFW.glfwSetWindowCloseCallback(this.window, l -> runnable.run()); + if (gLFWWindowCloseCallback != null) { + gLFWWindowCloseCallback.free(); + } + } + @Environment(EnvType.CLIENT) public static class WindowInitFailed extends SilentInitException { WindowInitFailed(String string) { diff --git a/com/mojang/blaze3d/preprocessor/GlslPreprocessor.java b/com/mojang/blaze3d/preprocessor/GlslPreprocessor.java index 75d8cb60..fbd28cac 100644 --- a/com/mojang/blaze3d/preprocessor/GlslPreprocessor.java +++ b/com/mojang/blaze3d/preprocessor/GlslPreprocessor.java @@ -9,6 +9,7 @@ import java.util.regex.Pattern; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.FileUtil; +import net.minecraft.client.renderer.ShaderDefines; import net.minecraft.util.StringUtil; import org.jetbrains.annotations.Nullable; @@ -125,6 +126,16 @@ public abstract class GlslPreprocessor { @Nullable public abstract String applyImport(boolean useFullPath, String directory); + public static String injectDefines(String string, ShaderDefines shaderDefines) { + if (shaderDefines.isEmpty()) { + return string; + } else { + int i = string.indexOf(10); + int j = i + 1; + return string.substring(0, j) + shaderDefines.asSourceDirectives() + "#line 1 0\n" + string.substring(j); + } + } + @Environment(EnvType.CLIENT) static final class Context { int glslVersion; diff --git a/com/mojang/blaze3d/resource/CrossFrameResourcePool.java b/com/mojang/blaze3d/resource/CrossFrameResourcePool.java new file mode 100644 index 00000000..e2bfc9fd --- /dev/null +++ b/com/mojang/blaze3d/resource/CrossFrameResourcePool.java @@ -0,0 +1,83 @@ +package com.mojang.blaze3d.resource; + +import com.google.common.annotations.VisibleForTesting; +import java.util.ArrayDeque; +import java.util.Collection; +import java.util.Deque; +import java.util.Iterator; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; + +@Environment(EnvType.CLIENT) +public class CrossFrameResourcePool implements GraphicsResourceAllocator, AutoCloseable { + private final int framesToKeepResource; + private final Deque> pool = new ArrayDeque(); + + public CrossFrameResourcePool(int i) { + this.framesToKeepResource = i; + } + + public void endFrame() { + Iterator> iterator = this.pool.iterator(); + + while (iterator.hasNext()) { + CrossFrameResourcePool.ResourceEntry resourceEntry = (CrossFrameResourcePool.ResourceEntry)iterator.next(); + if (resourceEntry.framesToLive-- == 0) { + resourceEntry.close(); + iterator.remove(); + } + } + } + + @Override + public T acquire(ResourceDescriptor resourceDescriptor) { + Iterator> iterator = this.pool.iterator(); + + while (iterator.hasNext()) { + CrossFrameResourcePool.ResourceEntry resourceEntry = (CrossFrameResourcePool.ResourceEntry)iterator.next(); + if (resourceEntry.descriptor.equals(resourceDescriptor)) { + iterator.remove(); + return (T)resourceEntry.value; + } + } + + return resourceDescriptor.allocate(); + } + + @Override + public void release(ResourceDescriptor resourceDescriptor, T object) { + this.pool.addFirst(new CrossFrameResourcePool.ResourceEntry<>(resourceDescriptor, object, this.framesToKeepResource)); + } + + public void clear() { + this.pool.forEach(CrossFrameResourcePool.ResourceEntry::close); + this.pool.clear(); + } + + public void close() { + this.clear(); + } + + @VisibleForTesting + protected Collection> entries() { + return this.pool; + } + + @Environment(EnvType.CLIENT) + @VisibleForTesting + protected static final class ResourceEntry implements AutoCloseable { + final ResourceDescriptor descriptor; + final T value; + int framesToLive; + + ResourceEntry(ResourceDescriptor resourceDescriptor, T object, int i) { + this.descriptor = resourceDescriptor; + this.value = object; + this.framesToLive = i; + } + + public void close() { + this.descriptor.free(this.value); + } + } +} diff --git a/com/mojang/blaze3d/resource/GraphicsResourceAllocator.java b/com/mojang/blaze3d/resource/GraphicsResourceAllocator.java new file mode 100644 index 00000000..32e931a9 --- /dev/null +++ b/com/mojang/blaze3d/resource/GraphicsResourceAllocator.java @@ -0,0 +1,23 @@ +package com.mojang.blaze3d.resource; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; + +@Environment(EnvType.CLIENT) +public interface GraphicsResourceAllocator { + GraphicsResourceAllocator UNPOOLED = new GraphicsResourceAllocator() { + @Override + public T acquire(ResourceDescriptor resourceDescriptor) { + return resourceDescriptor.allocate(); + } + + @Override + public void release(ResourceDescriptor resourceDescriptor, T object) { + resourceDescriptor.free(object); + } + }; + + T acquire(ResourceDescriptor resourceDescriptor); + + void release(ResourceDescriptor resourceDescriptor, T object); +} diff --git a/com/mojang/blaze3d/resource/RenderTargetDescriptor.java b/com/mojang/blaze3d/resource/RenderTargetDescriptor.java new file mode 100644 index 00000000..6faea1da --- /dev/null +++ b/com/mojang/blaze3d/resource/RenderTargetDescriptor.java @@ -0,0 +1,17 @@ +package com.mojang.blaze3d.resource; + +import com.mojang.blaze3d.pipeline.RenderTarget; +import com.mojang.blaze3d.pipeline.TextureTarget; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; + +@Environment(EnvType.CLIENT) +public record RenderTargetDescriptor(int width, int height, boolean useDepth) implements ResourceDescriptor { + public RenderTarget allocate() { + return new TextureTarget(this.width, this.height, this.useDepth); + } + + public void free(RenderTarget renderTarget) { + renderTarget.destroyBuffers(); + } +} diff --git a/com/mojang/blaze3d/resource/ResourceDescriptor.java b/com/mojang/blaze3d/resource/ResourceDescriptor.java new file mode 100644 index 00000000..247684a4 --- /dev/null +++ b/com/mojang/blaze3d/resource/ResourceDescriptor.java @@ -0,0 +1,11 @@ +package com.mojang.blaze3d.resource; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; + +@Environment(EnvType.CLIENT) +public interface ResourceDescriptor { + T allocate(); + + void free(T object); +} diff --git a/com/mojang/blaze3d/resource/ResourceHandle.java b/com/mojang/blaze3d/resource/ResourceHandle.java new file mode 100644 index 00000000..1905aa4d --- /dev/null +++ b/com/mojang/blaze3d/resource/ResourceHandle.java @@ -0,0 +1,17 @@ +package com.mojang.blaze3d.resource; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; + +@Environment(EnvType.CLIENT) +public interface ResourceHandle { + ResourceHandle INVALID_HANDLE = () -> { + throw new IllegalStateException("Cannot dereference handle with no underlying resource"); + }; + + static ResourceHandle invalid() { + return (ResourceHandle)INVALID_HANDLE; + } + + T get(); +} diff --git a/com/mojang/blaze3d/resource/package-info.java b/com/mojang/blaze3d/resource/package-info.java new file mode 100644 index 00000000..8ac4f170 --- /dev/null +++ b/com/mojang/blaze3d/resource/package-info.java @@ -0,0 +1,11 @@ +@ParametersAreNonnullByDefault +@MethodsReturnNonnullByDefault +@FieldsAreNonnullByDefault +@Environment(EnvType.CLIENT) +package com.mojang.blaze3d.resource; + +import com.mojang.blaze3d.FieldsAreNonnullByDefault; +import com.mojang.blaze3d.MethodsReturnNonnullByDefault; +import javax.annotation.ParametersAreNonnullByDefault; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; diff --git a/com/mojang/blaze3d/shaders/BlendMode.java b/com/mojang/blaze3d/shaders/BlendMode.java deleted file mode 100644 index 35c21ee8..00000000 --- a/com/mojang/blaze3d/shaders/BlendMode.java +++ /dev/null @@ -1,146 +0,0 @@ -package com.mojang.blaze3d.shaders; - -import com.mojang.blaze3d.systems.RenderSystem; -import java.util.Locale; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import org.jetbrains.annotations.Nullable; - -@Environment(EnvType.CLIENT) -public class BlendMode { - @Nullable - private static BlendMode lastApplied; - private final int srcColorFactor; - private final int srcAlphaFactor; - private final int dstColorFactor; - private final int dstAlphaFactor; - private final int blendFunc; - private final boolean separateBlend; - private final boolean opaque; - - private BlendMode(boolean separateBlend, boolean opaque, int srcColorFactor, int dstColorFactor, int srcAlphaFactor, int dstAlphaFactor, int blendFunc) { - this.separateBlend = separateBlend; - this.srcColorFactor = srcColorFactor; - this.dstColorFactor = dstColorFactor; - this.srcAlphaFactor = srcAlphaFactor; - this.dstAlphaFactor = dstAlphaFactor; - this.opaque = opaque; - this.blendFunc = blendFunc; - } - - public BlendMode() { - this(false, true, 1, 0, 1, 0, 32774); - } - - public BlendMode(int srcFactor, int dstFactor, int blendFunc) { - this(false, false, srcFactor, dstFactor, srcFactor, dstFactor, blendFunc); - } - - public BlendMode(int srcColorFactor, int dstColorFactor, int srcAlphaFactor, int dstAlphaFactor, int blendFunc) { - this(true, false, srcColorFactor, dstColorFactor, srcAlphaFactor, dstAlphaFactor, blendFunc); - } - - public void apply() { - if (!this.equals(lastApplied)) { - if (lastApplied == null || this.opaque != lastApplied.isOpaque()) { - lastApplied = this; - if (this.opaque) { - RenderSystem.disableBlend(); - return; - } - - RenderSystem.enableBlend(); - } - - RenderSystem.blendEquation(this.blendFunc); - if (this.separateBlend) { - RenderSystem.blendFuncSeparate(this.srcColorFactor, this.dstColorFactor, this.srcAlphaFactor, this.dstAlphaFactor); - } else { - RenderSystem.blendFunc(this.srcColorFactor, this.dstColorFactor); - } - } - } - - public boolean equals(Object object) { - if (this == object) { - return true; - } else if (!(object instanceof BlendMode blendMode)) { - return false; - } else if (this.blendFunc != blendMode.blendFunc) { - return false; - } else if (this.dstAlphaFactor != blendMode.dstAlphaFactor) { - return false; - } else if (this.dstColorFactor != blendMode.dstColorFactor) { - return false; - } else if (this.opaque != blendMode.opaque) { - return false; - } else if (this.separateBlend != blendMode.separateBlend) { - return false; - } else { - return this.srcAlphaFactor != blendMode.srcAlphaFactor ? false : this.srcColorFactor == blendMode.srcColorFactor; - } - } - - public int hashCode() { - int i = this.srcColorFactor; - i = 31 * i + this.srcAlphaFactor; - i = 31 * i + this.dstColorFactor; - i = 31 * i + this.dstAlphaFactor; - i = 31 * i + this.blendFunc; - i = 31 * i + (this.separateBlend ? 1 : 0); - return 31 * i + (this.opaque ? 1 : 0); - } - - public boolean isOpaque() { - return this.opaque; - } - - /** - * Converts a blend function name to an id, returning add (32774) if not recognized. - */ - public static int stringToBlendFunc(String funcName) { - String string = funcName.trim().toLowerCase(Locale.ROOT); - if ("add".equals(string)) { - return 32774; - } else if ("subtract".equals(string)) { - return 32778; - } else if ("reversesubtract".equals(string)) { - return 32779; - } else if ("reverse_subtract".equals(string)) { - return 32779; - } else if ("min".equals(string)) { - return 32775; - } else { - return "max".equals(string) ? 32776 : 32774; - } - } - - public static int stringToBlendFactor(String factorName) { - String string = factorName.trim().toLowerCase(Locale.ROOT); - string = string.replaceAll("_", ""); - string = string.replaceAll("one", "1"); - string = string.replaceAll("zero", "0"); - string = string.replaceAll("minus", "-"); - if ("0".equals(string)) { - return 0; - } else if ("1".equals(string)) { - return 1; - } else if ("srccolor".equals(string)) { - return 768; - } else if ("1-srccolor".equals(string)) { - return 769; - } else if ("dstcolor".equals(string)) { - return 774; - } else if ("1-dstcolor".equals(string)) { - return 775; - } else if ("srcalpha".equals(string)) { - return 770; - } else if ("1-srcalpha".equals(string)) { - return 771; - } else if ("dstalpha".equals(string)) { - return 772; - } else { - return "1-dstalpha".equals(string) ? 773 : -1; - } - } -} diff --git a/com/mojang/blaze3d/shaders/CompiledShader.java b/com/mojang/blaze3d/shaders/CompiledShader.java new file mode 100644 index 00000000..2b7efbae --- /dev/null +++ b/com/mojang/blaze3d/shaders/CompiledShader.java @@ -0,0 +1,94 @@ +package com.mojang.blaze3d.shaders; + +import com.mojang.blaze3d.platform.GlStateManager; +import com.mojang.blaze3d.systems.RenderSystem; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.client.renderer.ShaderManager; +import net.minecraft.resources.FileToIdConverter; +import net.minecraft.resources.ResourceLocation; +import org.apache.commons.lang3.StringUtils; +import org.jetbrains.annotations.Nullable; + +@Environment(EnvType.CLIENT) +public class CompiledShader implements AutoCloseable { + private static final int NOT_ALLOCATED = -1; + private final ResourceLocation id; + private int shaderId; + + private CompiledShader(int i, ResourceLocation resourceLocation) { + this.id = resourceLocation; + this.shaderId = i; + } + + public static CompiledShader compile(ResourceLocation resourceLocation, CompiledShader.Type type, String string) throws ShaderManager.CompilationException { + RenderSystem.assertOnRenderThread(); + int i = GlStateManager.glCreateShader(type.glType()); + GlStateManager.glShaderSource(i, string); + GlStateManager.glCompileShader(i); + if (GlStateManager.glGetShaderi(i, 35713) == 0) { + String string2 = StringUtils.trim(GlStateManager.glGetShaderInfoLog(i, 32768)); + throw new ShaderManager.CompilationException("Couldn't compile " + type.getName() + " shader (" + resourceLocation + ") : " + string2); + } else { + return new CompiledShader(i, resourceLocation); + } + } + + public void close() { + if (this.shaderId == -1) { + throw new IllegalStateException("Already closed"); + } else { + RenderSystem.assertOnRenderThread(); + GlStateManager.glDeleteShader(this.shaderId); + this.shaderId = -1; + } + } + + public ResourceLocation getId() { + return this.id; + } + + public int getShaderId() { + return this.shaderId; + } + + @Environment(EnvType.CLIENT) + public static enum Type { + VERTEX("vertex", ".vsh", 35633), + FRAGMENT("fragment", ".fsh", 35632); + + private static final CompiledShader.Type[] TYPES = values(); + private final String name; + private final String extension; + private final int glType; + + private Type(final String string2, final String string3, final int j) { + this.name = string2; + this.extension = string3; + this.glType = j; + } + + @Nullable + public static CompiledShader.Type byLocation(ResourceLocation resourceLocation) { + for (CompiledShader.Type type : TYPES) { + if (resourceLocation.getPath().endsWith(type.extension)) { + return type; + } + } + + return null; + } + + public String getName() { + return this.name; + } + + public int glType() { + return this.glType; + } + + public FileToIdConverter idConverter() { + return new FileToIdConverter("shaders", this.extension); + } + } +} diff --git a/com/mojang/blaze3d/shaders/EffectProgram.java b/com/mojang/blaze3d/shaders/EffectProgram.java deleted file mode 100644 index 782a1bc5..00000000 --- a/com/mojang/blaze3d/shaders/EffectProgram.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.mojang.blaze3d.shaders; - -import com.mojang.blaze3d.preprocessor.GlslPreprocessor; -import com.mojang.blaze3d.systems.RenderSystem; -import java.io.IOException; -import java.io.InputStream; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; - -@Environment(EnvType.CLIENT) -public class EffectProgram extends Program { - private static final GlslPreprocessor PREPROCESSOR = new GlslPreprocessor() { - @Override - public String applyImport(boolean useFullPath, String directory) { - return "#error Import statement not supported"; - } - }; - private int references; - - private EffectProgram(Program.Type type, int id, String name) { - super(type, id, name); - } - - public void attachToEffect(Effect effect) { - RenderSystem.assertOnRenderThread(); - this.references++; - this.attachToShader(effect); - } - - @Override - public void close() { - RenderSystem.assertOnRenderThread(); - this.references--; - if (this.references <= 0) { - super.close(); - } - } - - public static EffectProgram compileShader(Program.Type type, String name, InputStream shaderData, String sourceName) throws IOException { - RenderSystem.assertOnRenderThread(); - int i = compileShaderInternal(type, name, shaderData, sourceName, PREPROCESSOR); - EffectProgram effectProgram = new EffectProgram(type, i, name); - type.getPrograms().put(name, effectProgram); - return effectProgram; - } -} diff --git a/com/mojang/blaze3d/shaders/Program.java b/com/mojang/blaze3d/shaders/Program.java deleted file mode 100644 index d5eeecd9..00000000 --- a/com/mojang/blaze3d/shaders/Program.java +++ /dev/null @@ -1,108 +0,0 @@ -package com.mojang.blaze3d.shaders; - -import com.google.common.collect.Maps; -import com.mojang.blaze3d.platform.GlStateManager; -import com.mojang.blaze3d.preprocessor.GlslPreprocessor; -import com.mojang.blaze3d.systems.RenderSystem; -import java.io.IOException; -import java.io.InputStream; -import java.nio.charset.StandardCharsets; -import java.util.Map; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import org.apache.commons.io.IOUtils; -import org.apache.commons.lang3.StringUtils; - -@Environment(EnvType.CLIENT) -public class Program { - private static final int MAX_LOG_LENGTH = 32768; - private final Program.Type type; - private final String name; - private int id; - - protected Program(Program.Type type, int id, String name) { - this.type = type; - this.id = id; - this.name = name; - } - - public void attachToShader(Shader shader) { - RenderSystem.assertOnRenderThread(); - GlStateManager.glAttachShader(shader.getId(), this.getId()); - } - - public void close() { - if (this.id != -1) { - RenderSystem.assertOnRenderThread(); - GlStateManager.glDeleteShader(this.id); - this.id = -1; - this.type.getPrograms().remove(this.name); - } - } - - public String getName() { - return this.name; - } - - public static Program compileShader(Program.Type type, String name, InputStream shaderData, String sourceName, GlslPreprocessor preprocessor) throws IOException { - RenderSystem.assertOnRenderThread(); - int i = compileShaderInternal(type, name, shaderData, sourceName, preprocessor); - Program program = new Program(type, i, name); - type.getPrograms().put(name, program); - return program; - } - - protected static int compileShaderInternal(Program.Type type, String name, InputStream shaderData, String sourceName, GlslPreprocessor preprocessor) throws IOException { - String string = IOUtils.toString(shaderData, StandardCharsets.UTF_8); - if (string == null) { - throw new IOException("Could not load program " + type.getName()); - } else { - int i = GlStateManager.glCreateShader(type.getGlType()); - GlStateManager.glShaderSource(i, preprocessor.process(string)); - GlStateManager.glCompileShader(i); - if (GlStateManager.glGetShaderi(i, 35713) == 0) { - String string2 = StringUtils.trim(GlStateManager.glGetShaderInfoLog(i, 32768)); - throw new IOException("Couldn't compile " + type.getName() + " program (" + sourceName + ", " + name + ") : " + string2); - } else { - return i; - } - } - } - - protected int getId() { - return this.id; - } - - @Environment(EnvType.CLIENT) - public static enum Type { - VERTEX("vertex", ".vsh", 35633), - FRAGMENT("fragment", ".fsh", 35632); - - private final String name; - private final String extension; - private final int glType; - private final Map programs = Maps.newHashMap(); - - private Type(final String name, final String extension, final int glType) { - this.name = name; - this.extension = extension; - this.glType = glType; - } - - public String getName() { - return this.name; - } - - public String getExtension() { - return this.extension; - } - - int getGlType() { - return this.glType; - } - - public Map getPrograms() { - return this.programs; - } - } -} diff --git a/com/mojang/blaze3d/shaders/ProgramManager.java b/com/mojang/blaze3d/shaders/ProgramManager.java deleted file mode 100644 index 9f3e6950..00000000 --- a/com/mojang/blaze3d/shaders/ProgramManager.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.mojang.blaze3d.shaders; - -import com.mojang.blaze3d.platform.GlStateManager; -import com.mojang.blaze3d.systems.RenderSystem; -import com.mojang.logging.LogUtils; -import java.io.IOException; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import org.slf4j.Logger; - -@Environment(EnvType.CLIENT) -public class ProgramManager { - private static final Logger LOGGER = LogUtils.getLogger(); - - public static void glUseProgram(int program) { - RenderSystem.assertOnRenderThread(); - GlStateManager._glUseProgram(program); - } - - public static void releaseProgram(Shader shader) { - RenderSystem.assertOnRenderThread(); - shader.getFragmentProgram().close(); - shader.getVertexProgram().close(); - GlStateManager.glDeleteProgram(shader.getId()); - } - - public static int createProgram() throws IOException { - RenderSystem.assertOnRenderThread(); - int i = GlStateManager.glCreateProgram(); - if (i <= 0) { - throw new IOException("Could not create shader program (returned program ID " + i + ")"); - } else { - return i; - } - } - - public static void linkShader(Shader shader) { - RenderSystem.assertOnRenderThread(); - shader.attachToProgram(); - GlStateManager.glLinkProgram(shader.getId()); - int i = GlStateManager.glGetProgrami(shader.getId(), 35714); - if (i == 0) { - LOGGER.warn( - "Error encountered when linking program containing VS {} and FS {}. Log output:", - shader.getVertexProgram().getName(), - shader.getFragmentProgram().getName() - ); - LOGGER.warn(GlStateManager.glGetProgramInfoLog(shader.getId(), 32768)); - } - } -} diff --git a/com/mojang/blaze3d/shaders/Shader.java b/com/mojang/blaze3d/shaders/Shader.java deleted file mode 100644 index 3239b8d5..00000000 --- a/com/mojang/blaze3d/shaders/Shader.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.mojang.blaze3d.shaders; - -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; - -@Environment(EnvType.CLIENT) -public interface Shader { - int getId(); - - void markDirty(); - - Program getVertexProgram(); - - Program getFragmentProgram(); - - void attachToProgram(); -} diff --git a/com/mojang/blaze3d/shaders/Uniform.java b/com/mojang/blaze3d/shaders/Uniform.java index 2218e5bf..ec403ea6 100644 --- a/com/mojang/blaze3d/shaders/Uniform.java +++ b/com/mojang/blaze3d/shaders/Uniform.java @@ -5,8 +5,11 @@ import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.logging.LogUtils; import java.nio.FloatBuffer; import java.nio.IntBuffer; +import java.util.Arrays; +import java.util.List; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; +import net.minecraft.client.renderer.ShaderProgramConfig; import org.joml.Matrix3f; import org.joml.Matrix4f; import org.joml.Vector3f; @@ -35,20 +38,17 @@ public class Uniform extends AbstractUniform implements AutoCloseable { private final IntBuffer intValues; private final FloatBuffer floatValues; private final String name; - private boolean dirty; - private final Shader parent; - public Uniform(String name, int type, int count, Shader parent) { - this.name = name; - this.count = count; - this.type = type; - this.parent = parent; - if (type <= 3) { - this.intValues = MemoryUtil.memAllocInt(count); + public Uniform(String string, int i, int j) { + this.name = string; + this.count = j; + this.type = i; + if (i <= 3) { + this.intValues = MemoryUtil.memAllocInt(j); this.floatValues = null; } else { this.intValues = null; - this.floatValues = MemoryUtil.memAllocFloat(count); + this.floatValues = MemoryUtil.memAllocFloat(j); } this.location = -1; @@ -63,12 +63,27 @@ public class Uniform extends AbstractUniform implements AutoCloseable { RenderSystem.glUniform1i(location, value); } - public static int glGetAttribLocation(int program, CharSequence name) { - return GlStateManager._glGetAttribLocation(program, name); + public void setFromConfig(ShaderProgramConfig.Uniform uniform) { + this.setFromConfig(uniform.values(), uniform.count()); } - public static void glBindAttribLocation(int program, int index, CharSequence name) { - GlStateManager._glBindAttribLocation(program, index, name); + public void setFromConfig(List list, int i) { + float[] fs = new float[Math.max(i, 16)]; + if (list.size() == 1) { + Arrays.fill(fs, (Float)list.getFirst()); + } else { + for (int j = 0; j < list.size(); j++) { + fs[j] = (Float)list.get(j); + } + } + + if (this.type <= 3) { + this.setSafe((int)fs[0], (int)fs[1], (int)fs[2], (int)fs[3]); + } else if (this.type <= 7) { + this.setSafe(fs[0], fs[1], fs[2], fs[3]); + } else { + this.set(Arrays.copyOfRange(fs, 0, i)); + } } public void close() { @@ -82,10 +97,6 @@ public class Uniform extends AbstractUniform implements AutoCloseable { } private void markDirty() { - this.dirty = true; - if (this.parent != null) { - this.parent.markDirty(); - } } public static int getTypeFromString(String typeName) { @@ -427,10 +438,6 @@ public class Uniform extends AbstractUniform implements AutoCloseable { } public void upload() { - if (!this.dirty) { - } - - this.dirty = false; if (this.type <= 3) { this.uploadAsInteger(); } else if (this.type <= 7) { diff --git a/com/mojang/blaze3d/systems/RenderSystem.java b/com/mojang/blaze3d/systems/RenderSystem.java index bea05d69..dca18030 100644 --- a/com/mojang/blaze3d/systems/RenderSystem.java +++ b/com/mojang/blaze3d/systems/RenderSystem.java @@ -2,13 +2,17 @@ package com.mojang.blaze3d.systems; import com.google.common.collect.Queues; import com.mojang.blaze3d.DontObfuscate; +import com.mojang.blaze3d.ProjectionType; +import com.mojang.blaze3d.TracyFrameCapture; +import com.mojang.blaze3d.buffers.BufferType; +import com.mojang.blaze3d.buffers.BufferUsage; +import com.mojang.blaze3d.buffers.GpuBuffer; import com.mojang.blaze3d.pipeline.RenderCall; import com.mojang.blaze3d.platform.GLX; import com.mojang.blaze3d.platform.GlStateManager; -import com.mojang.blaze3d.shaders.FogShape; +import com.mojang.blaze3d.systems.RenderSystem.AutoStorageIndexBuffer.IndexGenerator; import com.mojang.blaze3d.vertex.Tesselator; import com.mojang.blaze3d.vertex.VertexFormat; -import com.mojang.blaze3d.vertex.VertexSorting; import com.mojang.logging.LogUtils; import java.nio.ByteBuffer; import java.nio.FloatBuffer; @@ -19,25 +23,25 @@ import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicLong; import java.util.function.Consumer; import java.util.function.IntConsumer; -import java.util.function.Supplier; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.Util; -import net.minecraft.client.GraphicsStatus; import net.minecraft.client.Minecraft; -import net.minecraft.client.OptionInstance; -import net.minecraft.client.renderer.ShaderInstance; +import net.minecraft.client.renderer.CompiledShaderProgram; +import net.minecraft.client.renderer.FogParameters; +import net.minecraft.client.renderer.ShaderProgram; import net.minecraft.client.renderer.texture.AbstractTexture; import net.minecraft.client.renderer.texture.TextureManager; import net.minecraft.resources.ResourceLocation; import net.minecraft.util.Mth; -import net.minecraft.util.TimeSource; +import net.minecraft.util.TimeSource.NanoTimeSource; import org.jetbrains.annotations.Nullable; import org.joml.Matrix4f; import org.joml.Matrix4fStack; import org.joml.Vector3f; import org.lwjgl.glfw.GLFW; import org.lwjgl.glfw.GLFWErrorCallbackI; +import org.lwjgl.system.MemoryUtil; import org.slf4j.Logger; @Environment(EnvType.CLIENT) @@ -71,24 +75,20 @@ public class RenderSystem { }); private static Matrix4f projectionMatrix = new Matrix4f(); private static Matrix4f savedProjectionMatrix = new Matrix4f(); - private static VertexSorting vertexSorting = VertexSorting.DISTANCE_TO_ORIGIN; - private static VertexSorting savedVertexSorting = VertexSorting.DISTANCE_TO_ORIGIN; + private static ProjectionType projectionType = ProjectionType.PERSPECTIVE; + private static ProjectionType savedProjectionType = ProjectionType.PERSPECTIVE; private static final Matrix4fStack modelViewStack = new Matrix4fStack(16); - private static Matrix4f modelViewMatrix = new Matrix4f(); private static Matrix4f textureMatrix = new Matrix4f(); private static final int[] shaderTextures = new int[12]; private static final float[] shaderColor = new float[]{1.0F, 1.0F, 1.0F, 1.0F}; private static float shaderGlintAlpha = 1.0F; - private static float shaderFogStart; - private static float shaderFogEnd = 1.0F; - private static final float[] shaderFogColor = new float[]{0.0F, 0.0F, 0.0F, 0.0F}; - private static FogShape shaderFogShape = FogShape.SPHERE; + private static FogParameters shaderFog = FogParameters.NO_FOG; private static final Vector3f[] shaderLightDirections = new Vector3f[2]; private static float shaderGameTime; private static float shaderLineWidth = 1.0F; private static String apiDescription = "Unknown"; @Nullable - private static ShaderInstance shader; + private static CompiledShaderProgram shader; private static final AtomicLong pollEventsWaitStart = new AtomicLong(); private static final AtomicBoolean pollingEvents = new AtomicBoolean(false); @@ -139,11 +139,15 @@ public class RenderSystem { return pollingEvents.get() && Util.getMillis() - pollEventsWaitStart.get() > 200L; } - public static void flipFrame(long l) { + public static void flipFrame(long l, @Nullable TracyFrameCapture tracyFrameCapture) { pollEvents(); replayQueue(); Tesselator.getInstance().clear(); GLFW.glfwSwapBuffers(l); + if (tracyFrameCapture != null) { + tracyFrameCapture.endFrame(); + } + pollEvents(); } @@ -336,18 +340,18 @@ public class RenderSystem { GlStateManager._clearStencil(i); } - public static void clear(int i, boolean bl) { - GlStateManager._clear(i, bl); + public static void clear(int i) { + GlStateManager._clear(i); } - public static void setShaderFogStart(float f) { + public static void setShaderFog(FogParameters fogParameters) { assertOnRenderThread(); - shaderFogStart = f; + shaderFog = fogParameters; } - public static float getShaderFogStart() { + public static FogParameters getShaderFog() { assertOnRenderThread(); - return shaderFogStart; + return shaderFog; } public static void setShaderGlintAlpha(double d) { @@ -364,69 +368,25 @@ public class RenderSystem { return shaderGlintAlpha; } - public static void setShaderFogEnd(float f) { - assertOnRenderThread(); - shaderFogEnd = f; - } - - public static float getShaderFogEnd() { - assertOnRenderThread(); - return shaderFogEnd; - } - - public static void setShaderFogColor(float f, float g, float h, float i) { - assertOnRenderThread(); - shaderFogColor[0] = f; - shaderFogColor[1] = g; - shaderFogColor[2] = h; - shaderFogColor[3] = i; - } - - public static void setShaderFogColor(float f, float g, float h) { - setShaderFogColor(f, g, h, 1.0F); - } - - public static float[] getShaderFogColor() { - assertOnRenderThread(); - return shaderFogColor; - } - - public static void setShaderFogShape(FogShape fogShape) { - assertOnRenderThread(); - shaderFogShape = fogShape; - } - - public static FogShape getShaderFogShape() { - assertOnRenderThread(); - return shaderFogShape; - } - public static void setShaderLights(Vector3f vector3f, Vector3f vector3f2) { assertOnRenderThread(); shaderLightDirections[0] = vector3f; shaderLightDirections[1] = vector3f2; } - public static void setupShaderLights(ShaderInstance shaderInstance) { + public static void setupShaderLights(CompiledShaderProgram compiledShaderProgram) { assertOnRenderThread(); - if (shaderInstance.LIGHT0_DIRECTION != null) { - shaderInstance.LIGHT0_DIRECTION.set(shaderLightDirections[0]); + if (compiledShaderProgram.LIGHT0_DIRECTION != null) { + compiledShaderProgram.LIGHT0_DIRECTION.set(shaderLightDirections[0]); } - if (shaderInstance.LIGHT1_DIRECTION != null) { - shaderInstance.LIGHT1_DIRECTION.set(shaderLightDirections[1]); + if (compiledShaderProgram.LIGHT1_DIRECTION != null) { + compiledShaderProgram.LIGHT1_DIRECTION.set(shaderLightDirections[1]); } } public static void setShaderColor(float f, float g, float h, float i) { - if (!isOnRenderThread()) { - recordRenderCall(() -> _setShaderColor(f, g, h, i)); - } else { - _setShaderColor(f, g, h, i); - } - } - - private static void _setShaderColor(float f, float g, float h, float i) { + assertOnRenderThread(); shaderColor[0] = f; shaderColor[1] = g; shaderColor[2] = h; @@ -444,11 +404,8 @@ public class RenderSystem { } public static void lineWidth(float f) { - if (!isOnRenderThread()) { - recordRenderCall(() -> shaderLineWidth = f); - } else { - shaderLineWidth = f; - } + assertOnRenderThread(); + shaderLineWidth = f; } public static float getShaderLineWidth() { @@ -478,7 +435,7 @@ public class RenderSystem { return apiDescription; } - public static TimeSource.NanoTimeSource initBackendSystem() { + public static NanoTimeSource initBackendSystem() { return GLX._initGlfw()::getAsLong; } @@ -507,7 +464,7 @@ public class RenderSystem { GlStateManager._depthFunc(515); projectionMatrix.identity(); savedProjectionMatrix.identity(); - modelViewMatrix.identity(); + modelViewStack.clear(); textureMatrix.identity(); GlStateManager._viewport(i, j, k, l); } @@ -656,22 +613,6 @@ public class RenderSystem { } } - public static void glGenBuffers(Consumer consumer) { - if (!isOnRenderThread()) { - recordRenderCall(() -> consumer.accept(GlStateManager._glGenBuffers())); - } else { - consumer.accept(GlStateManager._glGenBuffers()); - } - } - - public static void glGenVertexArrays(Consumer consumer) { - if (!isOnRenderThread()) { - recordRenderCall(() -> consumer.accept(GlStateManager._glGenVertexArrays())); - } else { - consumer.accept(GlStateManager._glGenVertexArrays()); - } - } - public static Tesselator renderThreadTesselator() { assertOnRenderThread(); return RENDER_THREAD_TESSELATOR; @@ -683,43 +624,36 @@ public class RenderSystem { ); } - @Deprecated - public static void runAsFancy(Runnable runnable) { - boolean bl = Minecraft.useShaderTransparency(); - if (!bl) { - runnable.run(); - } else { - OptionInstance optionInstance = Minecraft.getInstance().options.graphicsMode(); - GraphicsStatus graphicsStatus = optionInstance.get(); - optionInstance.set(GraphicsStatus.FANCY); - runnable.run(); - optionInstance.set(graphicsStatus); - } - } - - public static void setShader(Supplier supplier) { - if (!isOnRenderThread()) { - recordRenderCall(() -> shader = (ShaderInstance)supplier.get()); - } else { - shader = (ShaderInstance)supplier.get(); - } + public static void overlayBlendFunc() { + blendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); } @Nullable - public static ShaderInstance getShader() { + public static CompiledShaderProgram setShader(ShaderProgram shaderProgram) { + assertOnRenderThread(); + CompiledShaderProgram compiledShaderProgram = Minecraft.getInstance().getShaderManager().getProgram(shaderProgram); + shader = compiledShaderProgram; + return compiledShaderProgram; + } + + public static void setShader(CompiledShaderProgram compiledShaderProgram) { + assertOnRenderThread(); + shader = compiledShaderProgram; + } + + public static void clearShader() { + assertOnRenderThread(); + shader = null; + } + + @Nullable + public static CompiledShaderProgram getShader() { assertOnRenderThread(); return shader; } public static void setShaderTexture(int i, ResourceLocation resourceLocation) { - if (!isOnRenderThread()) { - recordRenderCall(() -> _setShaderTexture(i, resourceLocation)); - } else { - _setShaderTexture(i, resourceLocation); - } - } - - public static void _setShaderTexture(int i, ResourceLocation resourceLocation) { + assertOnRenderThread(); if (i >= 0 && i < shaderTextures.length) { TextureManager textureManager = Minecraft.getInstance().getTextureManager(); AbstractTexture abstractTexture = textureManager.getTexture(resourceLocation); @@ -728,14 +662,7 @@ public class RenderSystem { } public static void setShaderTexture(int i, int j) { - if (!isOnRenderThread()) { - recordRenderCall(() -> _setShaderTexture(i, j)); - } else { - _setShaderTexture(i, j); - } - } - - public static void _setShaderTexture(int i, int j) { + assertOnRenderThread(); if (i >= 0 && i < shaderTextures.length) { shaderTextures[i] = j; } @@ -746,69 +673,32 @@ public class RenderSystem { return i >= 0 && i < shaderTextures.length ? shaderTextures[i] : 0; } - public static void setProjectionMatrix(Matrix4f matrix4f, VertexSorting vertexSorting) { - Matrix4f matrix4f2 = new Matrix4f(matrix4f); - if (!isOnRenderThread()) { - recordRenderCall(() -> { - projectionMatrix = matrix4f2; - RenderSystem.vertexSorting = vertexSorting; - }); - } else { - projectionMatrix = matrix4f2; - RenderSystem.vertexSorting = vertexSorting; - } + public static void setProjectionMatrix(Matrix4f matrix4f, ProjectionType projectionType) { + assertOnRenderThread(); + projectionMatrix = new Matrix4f(matrix4f); + RenderSystem.projectionType = projectionType; } public static void setTextureMatrix(Matrix4f matrix4f) { - Matrix4f matrix4f2 = new Matrix4f(matrix4f); - if (!isOnRenderThread()) { - recordRenderCall(() -> textureMatrix = matrix4f2); - } else { - textureMatrix = matrix4f2; - } + assertOnRenderThread(); + textureMatrix = new Matrix4f(matrix4f); } public static void resetTextureMatrix() { - if (!isOnRenderThread()) { - recordRenderCall(() -> textureMatrix.identity()); - } else { - textureMatrix.identity(); - } - } - - public static void applyModelViewMatrix() { - Matrix4f matrix4f = new Matrix4f(modelViewStack); - if (!isOnRenderThread()) { - recordRenderCall(() -> modelViewMatrix = matrix4f); - } else { - modelViewMatrix = matrix4f; - } + assertOnRenderThread(); + textureMatrix.identity(); } public static void backupProjectionMatrix() { - if (!isOnRenderThread()) { - recordRenderCall(() -> _backupProjectionMatrix()); - } else { - _backupProjectionMatrix(); - } - } - - private static void _backupProjectionMatrix() { + assertOnRenderThread(); savedProjectionMatrix = projectionMatrix; - savedVertexSorting = vertexSorting; + savedProjectionType = projectionType; } public static void restoreProjectionMatrix() { - if (!isOnRenderThread()) { - recordRenderCall(() -> _restoreProjectionMatrix()); - } else { - _restoreProjectionMatrix(); - } - } - - private static void _restoreProjectionMatrix() { + assertOnRenderThread(); projectionMatrix = savedProjectionMatrix; - vertexSorting = savedVertexSorting; + projectionType = savedProjectionType; } public static Matrix4f getProjectionMatrix() { @@ -818,10 +708,11 @@ public class RenderSystem { public static Matrix4f getModelViewMatrix() { assertOnRenderThread(); - return modelViewMatrix; + return modelViewStack; } public static Matrix4fStack getModelViewStack() { + assertOnRenderThread(); return modelViewStack; } @@ -841,12 +732,8 @@ public class RenderSystem { } public static void setShaderGameTime(long l, float f) { - float g = ((float)(l % 24000L) + f) / 24000.0F; - if (!isOnRenderThread()) { - recordRenderCall(() -> shaderGameTime = g); - } else { - shaderGameTime = g; - } + assertOnRenderThread(); + shaderGameTime = ((float)(l % 24000L) + f) / 24000.0F; } public static float getShaderGameTime() { @@ -854,21 +741,22 @@ public class RenderSystem { return shaderGameTime; } - public static VertexSorting getVertexSorting() { + public static ProjectionType getProjectionType() { assertOnRenderThread(); - return vertexSorting; + return projectionType; } @Environment(EnvType.CLIENT) public static final class AutoStorageIndexBuffer { private final int vertexStride; private final int indexStride; - private final RenderSystem.AutoStorageIndexBuffer.IndexGenerator generator; - private int name; + private final IndexGenerator generator; + @Nullable + private GpuBuffer buffer; private VertexFormat.IndexType type = VertexFormat.IndexType.SHORT; private int indexCount; - AutoStorageIndexBuffer(int vertexStride, int indexStride, RenderSystem.AutoStorageIndexBuffer.IndexGenerator generator) { + AutoStorageIndexBuffer(int vertexStride, int indexStride, IndexGenerator generator) { this.vertexStride = vertexStride; this.indexStride = indexStride; this.generator = generator; @@ -879,11 +767,11 @@ public class RenderSystem { } public void bind(int index) { - if (this.name == 0) { - this.name = GlStateManager._glGenBuffers(); + if (this.buffer == null) { + this.buffer = new GpuBuffer(BufferType.INDICES, BufferUsage.DYNAMIC_WRITE, 0); } - GlStateManager._glBindBuffer(34963, this.name); + this.buffer.bind(); this.ensureStorage(index); } @@ -895,11 +783,9 @@ public class RenderSystem { int j = i * this.vertexStride; VertexFormat.IndexType indexType = VertexFormat.IndexType.least(j); int k = Mth.roundToward(neededIndexCount * indexType.bytes, 4); - GlStateManager._glBufferData(34963, k, 35048); - ByteBuffer byteBuffer = GlStateManager._glMapBuffer(34963, 35001); - if (byteBuffer == null) { - throw new RuntimeException("Failed to map GL buffer"); - } else { + ByteBuffer byteBuffer = MemoryUtil.memAlloc(k); + + try { this.type = indexType; it.unimi.dsi.fastutil.ints.IntConsumer intConsumer = this.intConsumer(byteBuffer); @@ -907,9 +793,14 @@ public class RenderSystem { this.generator.accept(intConsumer, l * this.vertexStride / this.indexStride); } - GlStateManager._glUnmapBuffer(34963); - this.indexCount = neededIndexCount; + byteBuffer.flip(); + this.buffer.resize(k); + this.buffer.write(byteBuffer, 0); + } finally { + MemoryUtil.memFree(byteBuffer); } + + this.indexCount = neededIndexCount; } } @@ -926,10 +817,5 @@ public class RenderSystem { public VertexFormat.IndexType type() { return this.type; } - - @Environment(EnvType.CLIENT) - interface IndexGenerator { - void accept(it.unimi.dsi.fastutil.ints.IntConsumer intConsumer, int i); - } } } diff --git a/com/mojang/blaze3d/vertex/BufferBuilder.java b/com/mojang/blaze3d/vertex/BufferBuilder.java index d71d41ab..5d65dc35 100644 --- a/com/mojang/blaze3d/vertex/BufferBuilder.java +++ b/com/mojang/blaze3d/vertex/BufferBuilder.java @@ -1,10 +1,11 @@ package com.mojang.blaze3d.vertex; +import com.mojang.blaze3d.vertex.MeshData.DrawState; import java.nio.ByteOrder; import java.util.stream.Collectors; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; -import net.minecraft.util.FastColor; +import net.minecraft.util.ARGB; import net.minecraft.util.Mth; import org.jetbrains.annotations.Nullable; import org.lwjgl.system.MemoryUtil; @@ -80,7 +81,7 @@ public class BufferBuilder implements VertexConsumer { } else { int i = this.mode.indexCount(this.vertices); VertexFormat.IndexType indexType = VertexFormat.IndexType.least(this.vertices); - return new MeshData(result, new MeshData.DrawState(this.format, this.vertices, i, this.mode, indexType)); + return new MeshData(result, new DrawState(this.format, this.vertices, i, this.mode, indexType)); } } } @@ -126,7 +127,7 @@ public class BufferBuilder implements VertexConsumer { } private static void putRgba(long pointer, int color) { - int i = FastColor.ABGR32.fromArgb32(color); + int i = ARGB.toABGR(color); MemoryUtil.memPutInt(pointer, IS_LITTLE_ENDIAN ? i : Integer.reverseBytes(i)); } diff --git a/com/mojang/blaze3d/vertex/BufferUploader.java b/com/mojang/blaze3d/vertex/BufferUploader.java index 2acf2b9b..632117a4 100644 --- a/com/mojang/blaze3d/vertex/BufferUploader.java +++ b/com/mojang/blaze3d/vertex/BufferUploader.java @@ -22,25 +22,18 @@ public class BufferUploader { } public static void drawWithShader(MeshData meshData) { - if (!RenderSystem.isOnRenderThreadOrInit()) { - RenderSystem.recordRenderCall(() -> _drawWithShader(meshData)); - } else { - _drawWithShader(meshData); - } - } - - private static void _drawWithShader(MeshData meshData) { + RenderSystem.assertOnRenderThread(); VertexBuffer vertexBuffer = upload(meshData); vertexBuffer.drawWithShader(RenderSystem.getModelViewMatrix(), RenderSystem.getProjectionMatrix(), RenderSystem.getShader()); } public static void draw(MeshData meshData) { + RenderSystem.assertOnRenderThread(); VertexBuffer vertexBuffer = upload(meshData); vertexBuffer.draw(); } private static VertexBuffer upload(MeshData meshData) { - RenderSystem.assertOnRenderThread(); VertexBuffer vertexBuffer = bindImmediateBuffer(meshData.drawState().format()); vertexBuffer.upload(meshData); return vertexBuffer; diff --git a/com/mojang/blaze3d/vertex/ByteBufferBuilder.java b/com/mojang/blaze3d/vertex/ByteBufferBuilder.java index 98151aff..b0874f15 100644 --- a/com/mojang/blaze3d/vertex/ByteBufferBuilder.java +++ b/com/mojang/blaze3d/vertex/ByteBufferBuilder.java @@ -1,5 +1,7 @@ package com.mojang.blaze3d.vertex; +import com.mojang.jtracy.MemoryPool; +import com.mojang.jtracy.TracyClient; import com.mojang.logging.LogUtils; import java.nio.ByteBuffer; import net.fabricmc.api.EnvType; @@ -11,6 +13,7 @@ import org.slf4j.Logger; @Environment(EnvType.CLIENT) public class ByteBufferBuilder implements AutoCloseable { + private static final MemoryPool MEMORY_POOL = TracyClient.createMemoryPool("ByteBufferBuilder"); private static final Logger LOGGER = LogUtils.getLogger(); private static final MemoryAllocator ALLOCATOR = MemoryUtil.getAllocator(false); private static final int MAX_GROWTH_SIZE = 2097152; @@ -25,6 +28,7 @@ public class ByteBufferBuilder implements AutoCloseable { public ByteBufferBuilder(int capacity) { this.capacity = capacity; this.pointer = ALLOCATOR.malloc(capacity); + MEMORY_POOL.malloc(this.pointer, capacity); if (this.pointer == 0L) { throw new OutOfMemoryError("Failed to allocate " + capacity + " bytes"); } @@ -47,7 +51,9 @@ public class ByteBufferBuilder implements AutoCloseable { } private void resize(int newSize) { + MEMORY_POOL.free(this.pointer); this.pointer = ALLOCATOR.realloc(this.pointer, newSize); + MEMORY_POOL.malloc(this.pointer, newSize); LOGGER.debug("Needed to grow BufferBuilder buffer: Old size {} bytes, new size {} bytes.", this.capacity, newSize); if (this.pointer == 0L) { throw new OutOfMemoryError("Failed to resize buffer from " + this.capacity + " bytes to " + newSize + " bytes"); @@ -109,6 +115,7 @@ public class ByteBufferBuilder implements AutoCloseable { public void close() { if (this.pointer != 0L) { + MEMORY_POOL.free(this.pointer); ALLOCATOR.free(this.pointer); this.pointer = 0L; this.generation = -1; diff --git a/com/mojang/blaze3d/vertex/PoseStack.java b/com/mojang/blaze3d/vertex/PoseStack.java index dfea5aa6..23427f97 100644 --- a/com/mojang/blaze3d/vertex/PoseStack.java +++ b/com/mojang/blaze3d/vertex/PoseStack.java @@ -6,6 +6,7 @@ import java.util.Deque; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.Util; +import net.minecraft.world.phys.Vec3; import org.joml.Matrix3f; import org.joml.Matrix4f; import org.joml.Quaternionf; @@ -28,6 +29,10 @@ public class PoseStack { pose.pose.translate(x, y, z); } + public void translate(Vec3 vec3) { + this.translate(vec3.x, vec3.y, vec3.z); + } + public void scale(float x, float y, float z) { PoseStack.Pose pose = (PoseStack.Pose)this.poseStack.getLast(); pose.pose.scale(x, y, z); diff --git a/com/mojang/blaze3d/vertex/SheetedDecalTextureGenerator.java b/com/mojang/blaze3d/vertex/SheetedDecalTextureGenerator.java index 21c8714c..56a18b92 100644 --- a/com/mojang/blaze3d/vertex/SheetedDecalTextureGenerator.java +++ b/com/mojang/blaze3d/vertex/SheetedDecalTextureGenerator.java @@ -62,7 +62,7 @@ public class SheetedDecalTextureGenerator implements VertexConsumer { public VertexConsumer setNormal(float normalX, float normalY, float normalZ) { this.delegate.setNormal(normalX, normalY, normalZ); Vector3f vector3f = this.normalInversePose.transform(normalX, normalY, normalZ, this.normal); - Direction direction = Direction.getNearest(vector3f.x(), vector3f.y(), vector3f.z()); + Direction direction = Direction.getApproximateNearest(vector3f.x(), vector3f.y(), vector3f.z()); Vector3f vector3f2 = this.cameraInversePose.transformPosition(this.x, this.y, this.z, this.worldPos); vector3f2.rotateY((float) Math.PI); vector3f2.rotateX((float) (-Math.PI / 2)); diff --git a/com/mojang/blaze3d/vertex/VertexBuffer.java b/com/mojang/blaze3d/vertex/VertexBuffer.java index 1ed3a4cb..c4736fdb 100644 --- a/com/mojang/blaze3d/vertex/VertexBuffer.java +++ b/com/mojang/blaze3d/vertex/VertexBuffer.java @@ -1,20 +1,25 @@ package com.mojang.blaze3d.vertex; +import com.mojang.blaze3d.buffers.BufferType; +import com.mojang.blaze3d.buffers.BufferUsage; +import com.mojang.blaze3d.buffers.GpuBuffer; import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.systems.RenderSystem; +import com.mojang.blaze3d.vertex.MeshData.DrawState; import java.nio.ByteBuffer; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.ShaderInstance; +import net.minecraft.client.renderer.CompiledShaderProgram; import org.jetbrains.annotations.Nullable; import org.joml.Matrix4f; @Environment(EnvType.CLIENT) public class VertexBuffer implements AutoCloseable { - private final VertexBuffer.Usage usage; - private int vertexBufferId; - private int indexBufferId; + private final BufferUsage usage; + private final GpuBuffer vertexBuffer; + @Nullable + private GpuBuffer indexBuffer = null; private int arrayObjectId; @Nullable private VertexFormat format; @@ -24,11 +29,10 @@ public class VertexBuffer implements AutoCloseable { private int indexCount; private VertexFormat.Mode mode; - public VertexBuffer(VertexBuffer.Usage usage) { - this.usage = usage; + public VertexBuffer(BufferUsage bufferUsage) { + this.usage = bufferUsage; RenderSystem.assertOnRenderThread(); - this.vertexBufferId = GlStateManager._glGenBuffers(); - this.indexBufferId = GlStateManager._glGenBuffers(); + this.vertexBuffer = new GpuBuffer(BufferType.VERTICES, bufferUsage, 0); this.arrayObjectId = GlStateManager._glGenVertexArrays(); } @@ -42,7 +46,7 @@ public class VertexBuffer implements AutoCloseable { } RenderSystem.assertOnRenderThread(); - MeshData.DrawState drawState = meshData.drawState(); + DrawState drawState = meshData.drawState(); this.format = this.uploadVertexBuffer(drawState, meshData.vertexBuffer()); this.sequentialIndices = this.uploadIndexBuffer(drawState, meshData.indexBuffer()); this.indexCount = drawState.indexCount(); @@ -75,15 +79,18 @@ public class VertexBuffer implements AutoCloseable { public void uploadIndexBuffer(ByteBufferBuilder.Result result) { ByteBufferBuilder.Result var2 = result; - label40: { + label46: { try { if (this.isInvalid()) { - break label40; + break label46; } RenderSystem.assertOnRenderThread(); - GlStateManager._glBindBuffer(34963, this.indexBufferId); - RenderSystem.glBufferData(34963, result.byteBuffer(), this.usage.id); + if (this.indexBuffer != null) { + this.indexBuffer.close(); + } + + this.indexBuffer = new GpuBuffer(BufferType.INDICES, this.usage, result.byteBuffer()); this.sequentialIndices = null; } catch (Throwable var6) { if (result != null) { @@ -109,34 +116,38 @@ public class VertexBuffer implements AutoCloseable { } } - private VertexFormat uploadVertexBuffer(MeshData.DrawState drawState, @Nullable ByteBuffer buffer) { + private VertexFormat uploadVertexBuffer(DrawState drawState, @Nullable ByteBuffer buffer) { boolean bl = false; if (!drawState.format().equals(this.format)) { if (this.format != null) { this.format.clearBufferState(); } - GlStateManager._glBindBuffer(34962, this.vertexBufferId); + this.vertexBuffer.bind(); drawState.format().setupBufferState(); bl = true; } if (buffer != null) { if (!bl) { - GlStateManager._glBindBuffer(34962, this.vertexBufferId); + this.vertexBuffer.bind(); } - RenderSystem.glBufferData(34962, buffer, this.usage.id); + this.vertexBuffer.resize(buffer.remaining()); + this.vertexBuffer.write(buffer, 0); } return drawState.format(); } @Nullable - private RenderSystem.AutoStorageIndexBuffer uploadIndexBuffer(MeshData.DrawState drawState, @Nullable ByteBuffer buffer) { + private RenderSystem.AutoStorageIndexBuffer uploadIndexBuffer(DrawState drawState, @Nullable ByteBuffer buffer) { if (buffer != null) { - GlStateManager._glBindBuffer(34963, this.indexBufferId); - RenderSystem.glBufferData(34963, buffer, this.usage.id); + if (this.indexBuffer != null) { + this.indexBuffer.close(); + } + + this.indexBuffer = new GpuBuffer(BufferType.INDICES, this.usage, buffer); return null; } else { RenderSystem.AutoStorageIndexBuffer autoStorageIndexBuffer = RenderSystem.getSequentialBuffer(drawState.mode()); @@ -167,30 +178,21 @@ public class VertexBuffer implements AutoCloseable { return autoStorageIndexBuffer != null ? autoStorageIndexBuffer.type() : this.indexType; } - public void drawWithShader(Matrix4f modelViewMatrix, Matrix4f projectionMatrix, ShaderInstance shader) { - if (!RenderSystem.isOnRenderThread()) { - RenderSystem.recordRenderCall(() -> this._drawWithShader(new Matrix4f(modelViewMatrix), new Matrix4f(projectionMatrix), shader)); - } else { - this._drawWithShader(modelViewMatrix, projectionMatrix, shader); + public void drawWithShader(Matrix4f matrix4f, Matrix4f matrix4f2, @Nullable CompiledShaderProgram compiledShaderProgram) { + if (compiledShaderProgram != null) { + RenderSystem.assertOnRenderThread(); + compiledShaderProgram.setDefaultUniforms(this.mode, matrix4f, matrix4f2, Minecraft.getInstance().getWindow()); + compiledShaderProgram.apply(); + this.draw(); + compiledShaderProgram.clear(); } } - private void _drawWithShader(Matrix4f modelViewMatrix, Matrix4f projectionMatrix, ShaderInstance shader) { - shader.setDefaultUniforms(this.mode, modelViewMatrix, projectionMatrix, Minecraft.getInstance().getWindow()); - shader.apply(); - this.draw(); - shader.clear(); - } - public void close() { - if (this.vertexBufferId >= 0) { - RenderSystem.glDeleteBuffers(this.vertexBufferId); - this.vertexBufferId = -1; - } - - if (this.indexBufferId >= 0) { - RenderSystem.glDeleteBuffers(this.indexBufferId); - this.indexBufferId = -1; + this.vertexBuffer.close(); + if (this.indexBuffer != null) { + this.indexBuffer.close(); + this.indexBuffer = null; } if (this.arrayObjectId >= 0) { @@ -206,16 +208,4 @@ public class VertexBuffer implements AutoCloseable { public boolean isInvalid() { return this.arrayObjectId == -1; } - - @Environment(EnvType.CLIENT) - public static enum Usage { - STATIC(35044), - DYNAMIC(35048); - - final int id; - - private Usage(final int id) { - this.id = id; - } - } } diff --git a/com/mojang/blaze3d/vertex/VertexConsumer.java b/com/mojang/blaze3d/vertex/VertexConsumer.java index 526b6ee1..428b2688 100644 --- a/com/mojang/blaze3d/vertex/VertexConsumer.java +++ b/com/mojang/blaze3d/vertex/VertexConsumer.java @@ -4,9 +4,10 @@ import java.nio.ByteBuffer; import java.nio.IntBuffer; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; +import net.minecraft.client.renderer.LightTexture; import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.core.Vec3i; -import net.minecraft.util.FastColor; +import net.minecraft.util.ARGB; import org.joml.Matrix4f; import org.joml.Vector3f; import org.lwjgl.system.MemoryStack; @@ -39,11 +40,11 @@ public interface VertexConsumer { } default VertexConsumer setColor(int color) { - return this.setColor(FastColor.ARGB32.red(color), FastColor.ARGB32.green(color), FastColor.ARGB32.blue(color), FastColor.ARGB32.alpha(color)); + return this.setColor(ARGB.red(color), ARGB.green(color), ARGB.blue(color), ARGB.alpha(color)); } default VertexConsumer setWhiteAlpha(int alpha) { - return this.setColor(FastColor.ARGB32.color(alpha, -1)); + return this.setColor(ARGB.color(alpha, -1)); } default VertexConsumer setLight(int packedLight) { @@ -82,45 +83,46 @@ public interface VertexConsumer { boolean readAlpha ) { int[] is = quad.getVertices(); - Vec3i vec3i = quad.getDirection().getNormal(); + Vec3i vec3i = quad.getDirection().getUnitVec3i(); Matrix4f matrix4f = pose.pose(); Vector3f vector3f = pose.transformNormal(vec3i.getX(), vec3i.getY(), vec3i.getZ(), new Vector3f()); int i = 8; int j = is.length / 8; int k = (int)(alpha * 255.0F); + int l = quad.getLightEmission(); try (MemoryStack memoryStack = MemoryStack.stackPush()) { ByteBuffer byteBuffer = memoryStack.malloc(DefaultVertexFormat.BLOCK.getVertexSize()); IntBuffer intBuffer = byteBuffer.asIntBuffer(); - for (int l = 0; l < j; l++) { + for (int m = 0; m < j; m++) { intBuffer.clear(); - intBuffer.put(is, l * 8, 8); + intBuffer.put(is, m * 8, 8); float f = byteBuffer.getFloat(0); float g = byteBuffer.getFloat(4); float h = byteBuffer.getFloat(8); - float p; float q; float r; + float s; if (readAlpha) { - float m = byteBuffer.get(12) & 255; - float n = byteBuffer.get(13) & 255; - float o = byteBuffer.get(14) & 255; - p = m * brightness[l] * red; - q = n * brightness[l] * green; - r = o * brightness[l] * blue; + float n = byteBuffer.get(12) & 255; + float o = byteBuffer.get(13) & 255; + float p = byteBuffer.get(14) & 255; + q = n * brightness[m] * red; + r = o * brightness[m] * green; + s = p * brightness[m] * blue; } else { - p = brightness[l] * red * 255.0F; - q = brightness[l] * green * 255.0F; - r = brightness[l] * blue * 255.0F; + q = brightness[m] * red * 255.0F; + r = brightness[m] * green * 255.0F; + s = brightness[m] * blue * 255.0F; } - int s = FastColor.ARGB32.color(k, (int)p, (int)q, (int)r); - int t = lightmap[l]; - float o = byteBuffer.getFloat(16); - float u = byteBuffer.getFloat(20); + int t = ARGB.color(k, (int)q, (int)r, (int)s); + int u = LightTexture.lightCoordsWithEmission(lightmap[m], l); + float p = byteBuffer.getFloat(16); + float v = byteBuffer.getFloat(20); Vector3f vector3f2 = matrix4f.transformPosition(f, g, h, new Vector3f()); - this.addVertex(vector3f2.x(), vector3f2.y(), vector3f2.z(), s, o, u, packedOverlay, t, vector3f.x(), vector3f.y(), vector3f.z()); + this.addVertex(vector3f2.x(), vector3f2.y(), vector3f2.z(), t, p, v, packedOverlay, u, vector3f.x(), vector3f.y(), vector3f.z()); } } } @@ -146,4 +148,8 @@ public interface VertexConsumer { Vector3f vector3f = pose.transformNormal(normalX, normalY, normalZ, new Vector3f()); return this.setNormal(vector3f.x(), vector3f.y(), vector3f.z()); } + + default VertexConsumer setNormal(PoseStack.Pose pose, Vector3f vector3f) { + return this.setNormal(pose, vector3f.x(), vector3f.y(), vector3f.z()); + } } diff --git a/com/mojang/blaze3d/vertex/VertexFormat.java b/com/mojang/blaze3d/vertex/VertexFormat.java index 99b4cbda..6edaaa6b 100644 --- a/com/mojang/blaze3d/vertex/VertexFormat.java +++ b/com/mojang/blaze3d/vertex/VertexFormat.java @@ -2,6 +2,7 @@ package com.mojang.blaze3d.vertex; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; +import com.mojang.blaze3d.buffers.BufferUsage; import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.systems.RenderSystem; import it.unimi.dsi.fastutil.ints.IntArrayList; @@ -40,22 +41,17 @@ public class VertexFormat { return new VertexFormat.Builder(); } - public String toString() { - StringBuilder stringBuilder = new StringBuilder("Vertex format (").append(this.vertexSize).append(" bytes):\n"); + public void bindAttributes(int i) { + int j = 0; - for (int i = 0; i < this.elements.size(); i++) { - VertexFormatElement vertexFormatElement = (VertexFormatElement)this.elements.get(i); - stringBuilder.append(i) - .append(". ") - .append((String)this.names.get(i)) - .append(": ") - .append(vertexFormatElement) - .append(" @ ") - .append(this.getOffset(vertexFormatElement)) - .append('\n'); + for (String string : this.getElementAttributeNames()) { + GlStateManager._glBindAttribLocation(i, j, string); + j++; } + } - return stringBuilder.toString(); + public String toString() { + return "VertexFormat" + this.names; } public int getVertexSize() { @@ -110,14 +106,7 @@ public class VertexFormat { } public void setupBufferState() { - if (!RenderSystem.isOnRenderThread()) { - RenderSystem.recordRenderCall(this::_setupBufferState); - } else { - this._setupBufferState(); - } - } - - private void _setupBufferState() { + RenderSystem.assertOnRenderThread(); int i = this.getVertexSize(); for (int j = 0; j < this.elements.size(); j++) { @@ -128,14 +117,8 @@ public class VertexFormat { } public void clearBufferState() { - if (!RenderSystem.isOnRenderThread()) { - RenderSystem.recordRenderCall(this::_clearBufferState); - } else { - this._clearBufferState(); - } - } + RenderSystem.assertOnRenderThread(); - private void _clearBufferState() { for (int i = 0; i < this.elements.size(); i++) { GlStateManager._disableVertexAttribArray(i); } @@ -144,7 +127,7 @@ public class VertexFormat { public VertexBuffer getImmediateDrawVertexBuffer() { VertexBuffer vertexBuffer = this.immediateDrawVertexBuffer; if (vertexBuffer == null) { - this.immediateDrawVertexBuffer = vertexBuffer = new VertexBuffer(VertexBuffer.Usage.DYNAMIC); + this.immediateDrawVertexBuffer = vertexBuffer = new VertexBuffer(BufferUsage.DYNAMIC_WRITE); } return vertexBuffer; diff --git a/com/mojang/realmsclient/RealmsMainScreen.java b/com/mojang/realmsclient/RealmsMainScreen.java index 56bfddab..e6d7e435 100644 --- a/com/mojang/realmsclient/RealmsMainScreen.java +++ b/com/mojang/realmsclient/RealmsMainScreen.java @@ -12,6 +12,8 @@ import com.mojang.realmsclient.dto.RealmsNotification; import com.mojang.realmsclient.dto.RealmsServer; import com.mojang.realmsclient.dto.RealmsServerPlayerLists; import com.mojang.realmsclient.dto.RegionPingResult; +import com.mojang.realmsclient.dto.RealmsNotification.InfoPopup; +import com.mojang.realmsclient.dto.RealmsNotification.VisitUrl; import com.mojang.realmsclient.exception.RealmsServiceException; import com.mojang.realmsclient.gui.RealmsDataFetcher; import com.mojang.realmsclient.gui.RealmsServerList; @@ -22,14 +24,17 @@ import com.mojang.realmsclient.gui.screens.RealmsGenericErrorScreen; import com.mojang.realmsclient.gui.screens.RealmsLongRunningMcoTaskScreen; import com.mojang.realmsclient.gui.screens.RealmsPendingInvitesScreen; import com.mojang.realmsclient.gui.screens.RealmsPopups; -import com.mojang.realmsclient.gui.task.DataFetcher; +import com.mojang.realmsclient.gui.task.DataFetcher.Subscription; +import com.mojang.realmsclient.gui.task.DataFetcher.Task; import com.mojang.realmsclient.util.RealmsPersistence; import com.mojang.realmsclient.util.RealmsUtil; +import com.mojang.realmsclient.util.RealmsPersistence.RealmsPersistenceData; import com.mojang.realmsclient.util.task.GetServerDetailsTask; import java.util.ArrayList; import java.util.Collection; import java.util.HashSet; import java.util.List; +import java.util.Objects; import java.util.Optional; import java.util.Set; import java.util.UUID; @@ -65,20 +70,22 @@ import net.minecraft.client.gui.layouts.Layout; import net.minecraft.client.gui.layouts.LayoutSettings; import net.minecraft.client.gui.layouts.LinearLayout; import net.minecraft.client.gui.layouts.SpacerElement; +import net.minecraft.client.gui.layouts.GridLayout.RowHelper; import net.minecraft.client.gui.navigation.CommonInputs; import net.minecraft.client.gui.navigation.ScreenRectangle; import net.minecraft.client.gui.screens.ConfirmLinkScreen; import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.gui.screens.inventory.tooltip.ClientActivePlayersTooltip; +import net.minecraft.client.renderer.RenderType; import net.minecraft.client.resources.sounds.SimpleSoundInstance; import net.minecraft.network.chat.CommonComponents; import net.minecraft.network.chat.Component; -import net.minecraft.realms.RealmsObjectSelectionList; import net.minecraft.realms.RealmsScreen; import net.minecraft.resources.ResourceLocation; import net.minecraft.sounds.SoundEvents; import net.minecraft.util.CommonLinks; import net.minecraft.util.Mth; +import net.minecraft.world.level.GameType; import org.apache.commons.lang3.StringUtils; import org.jetbrains.annotations.Nullable; import org.slf4j.Logger; @@ -93,6 +100,7 @@ public class RealmsMainScreen extends RealmsScreen { static final ResourceLocation CLOSED_SPRITE = ResourceLocation.withDefaultNamespace("realm_status/closed"); private static final ResourceLocation INVITE_SPRITE = ResourceLocation.withDefaultNamespace("icon/invite"); private static final ResourceLocation NEWS_SPRITE = ResourceLocation.withDefaultNamespace("icon/news"); + public static final ResourceLocation HARDCORE_MODE_SPRITE = ResourceLocation.withDefaultNamespace("hud/heart/hardcore_full"); static final Logger LOGGER = LogUtils.getLogger(); private static final ResourceLocation LOGO_LOCATION = ResourceLocation.withDefaultNamespace("textures/gui/title/realms.png"); private static final ResourceLocation NO_REALMS_LOCATION = ResourceLocation.withDefaultNamespace("textures/gui/realms/no_realms.png"); @@ -135,7 +143,7 @@ public class RealmsMainScreen extends RealmsScreen { private static boolean snapshotToggle = SNAPSHOT; private final CompletableFuture availability = RealmsAvailability.get(); @Nullable - private DataFetcher.Subscription dataSubscription; + private Subscription dataSubscription; private final Set handledSeenNotifications = new HashSet(); private static boolean regionsPinged; private final RateLimiter inviteNarrationLimiter; @@ -146,14 +154,14 @@ public class RealmsMainScreen extends RealmsScreen { private Button configureButton; private Button leaveButton; RealmsMainScreen.RealmSelectionList realmSelectionList; - private RealmsServerList serverList; - private List availableSnapshotServers = List.of(); + RealmsServerList serverList; + List availableSnapshotServers = List.of(); RealmsServerPlayerLists onlinePlayersPerRealm = new RealmsServerPlayerLists(); private volatile boolean trialsAvailable; @Nullable private volatile String newsLink; long lastClickTime; - private final List notifications = new ArrayList(); + final List notifications = new ArrayList(); private Button addRealmButton; private RealmsMainScreen.NotificationButton pendingInvitesButton; private RealmsMainScreen.NotificationButton newsButton; @@ -181,7 +189,7 @@ public class RealmsMainScreen extends RealmsScreen { if (string != null) { ConfirmLinkScreen.confirmLinkNow(this, string); if (this.newsButton.notificationCount() != 0) { - RealmsPersistence.RealmsPersistenceData realmsPersistenceData = RealmsPersistence.readFile(); + RealmsPersistenceData realmsPersistenceData = RealmsPersistence.readFile(); realmsPersistenceData.hasUnreadNews = false; RealmsPersistence.writeFile(realmsPersistenceData); this.newsButton.setNotificationCount(0); @@ -296,7 +304,7 @@ public class RealmsMainScreen extends RealmsScreen { private Layout createFooter(RealmsMainScreen.LayoutState layoutState) { GridLayout gridLayout = new GridLayout().spacing(4); - GridLayout.RowHelper rowHelper = gridLayout.createRowHelper(3); + RowHelper rowHelper = gridLayout.createRowHelper(3); if (layoutState == RealmsMainScreen.LayoutState.LIST) { rowHelper.addChild(this.playButton); rowHelper.addChild(this.configureButton); @@ -361,13 +369,13 @@ public class RealmsMainScreen extends RealmsScreen { } private void debugRefreshDataFetchers() { - for (DataFetcher.Task task : this.minecraft.realmsDataFetcher().getTasks()) { + for (Task task : this.minecraft.realmsDataFetcher().getTasks()) { task.reset(); } } - private DataFetcher.Subscription initDataFetcher(RealmsDataFetcher dataFetcher) { - DataFetcher.Subscription subscription = dataFetcher.dataFetcher.createSubscription(); + private Subscription initDataFetcher(RealmsDataFetcher dataFetcher) { + Subscription subscription = dataFetcher.dataFetcher.createSubscription(); subscription.subscribe(dataFetcher.serverListUpdateTask, serverListData -> { this.serverList.updateServersList(serverListData.serverList()); this.availableSnapshotServers = serverListData.availableSnapshotServers(); @@ -390,7 +398,7 @@ public class RealmsMainScreen extends RealmsScreen { this.notifications.addAll(list); for (RealmsNotification realmsNotification : list) { - if (realmsNotification instanceof RealmsNotification.InfoPopup infoPopup) { + if (realmsNotification instanceof InfoPopup infoPopup) { PopupScreen popupScreen = infoPopup.buildScreen(this, this::dismissNotification); if (popupScreen != null) { this.minecraft.setScreen(popupScreen); @@ -421,7 +429,7 @@ public class RealmsMainScreen extends RealmsScreen { return subscription; } - private void markNotificationsAsSeen(Collection notifications) { + void markNotificationsAsSeen(Collection notifications) { List list = new ArrayList(notifications.size()); for (RealmsNotification realmsNotification : notifications) { @@ -453,60 +461,11 @@ public class RealmsMainScreen extends RealmsScreen { } private void refreshListAndLayout() { - RealmsServer realmsServer = this.getSelectedServer(); - this.realmSelectionList.clear(); - - for (RealmsNotification realmsNotification : this.notifications) { - if (this.addListEntriesForNotification(realmsNotification)) { - this.markNotificationsAsSeen(List.of(realmsNotification)); - break; - } - } - - for (RealmsServer realmsServer2 : this.availableSnapshotServers) { - this.realmSelectionList.addEntry(new RealmsMainScreen.AvailableSnapshotEntry(realmsServer2)); - } - - for (RealmsServer realmsServer2 : this.serverList) { - RealmsMainScreen.Entry entry; - if (isSnapshot() && !realmsServer2.isSnapshotRealm()) { - if (realmsServer2.state == RealmsServer.State.UNINITIALIZED) { - continue; - } - - entry = new RealmsMainScreen.ParentEntry(realmsServer2); - } else { - entry = new RealmsMainScreen.ServerEntry(realmsServer2); - } - - this.realmSelectionList.addEntry(entry); - if (realmsServer != null && realmsServer.id == realmsServer2.id) { - this.realmSelectionList.setSelected(entry); - } - } - + this.realmSelectionList.refreshEntries(this, this.getSelectedServer()); this.updateLayout(); this.updateButtonStates(); } - private boolean addListEntriesForNotification(RealmsNotification notification) { - if (!(notification instanceof RealmsNotification.VisitUrl visitUrl)) { - return false; - } else { - Component component = visitUrl.getMessage(); - int i = this.font.wordWrapHeight(component, 216); - int j = Mth.positiveCeilDiv(i + 7, 36) - 1; - this.realmSelectionList.addEntry(new RealmsMainScreen.NotificationMessageEntry(component, j + 2, visitUrl)); - - for (int k = 0; k < j; k++) { - this.realmSelectionList.addEntry(new RealmsMainScreen.EmptyEntry()); - } - - this.realmSelectionList.addEntry(new RealmsMainScreen.ButtonEntry(visitUrl.buildOpenLinkButton(this))); - return true; - } - } - private void pingRegions() { new Thread(() -> { List list = Ping.pingAllRegions(); @@ -715,7 +674,11 @@ public class RealmsMainScreen extends RealmsScreen { } public static Component getVersionComponent(String version, int color) { - return (Component)(StringUtils.isBlank(version) ? CommonComponents.EMPTY : Component.translatable("mco.version", Component.literal(version).withColor(color))); + return (Component)(StringUtils.isBlank(version) ? CommonComponents.EMPTY : Component.literal(version).withColor(color)); + } + + public static Component getGameModeComponent(int i, boolean bl) { + return (Component)(bl ? Component.translatable("gameMode.hardcore").withColor(-65536) : GameType.byId(i).getLongDisplayName()); } static boolean isSelfOwnedServer(RealmsServer server) { @@ -749,10 +712,16 @@ public class RealmsMainScreen extends RealmsScreen { @Override public void render(GuiGraphics guiGraphics, int index, int top, int left, int width, int height, int mouseX, int mouseY, boolean hovering, float partialTick) { - guiGraphics.blitSprite(RealmsMainScreen.NEW_REALM_SPRITE, left - 5, top + height / 2 - 10, 40, 20); + guiGraphics.blitSprite(RenderType::guiTextured, RealmsMainScreen.NEW_REALM_SPRITE, left - 5, top + height / 2 - 10, 40, 20); int i = top + height / 2 - 9 / 2; guiGraphics.drawString(RealmsMainScreen.this.font, START_SNAPSHOT_REALM, left + 40 - 2, i - 5, 8388479); - guiGraphics.drawString(RealmsMainScreen.this.font, Component.translatable("mco.snapshot.description", this.parent.name), left + 40 - 2, i + 5, -8355712); + guiGraphics.drawString( + RealmsMainScreen.this.font, + Component.translatable("mco.snapshot.description", Objects.requireNonNullElse(this.parent.name, "unknown server")), + left + 40 - 2, + i + 5, + -8355712 + ); this.tooltip.refreshTooltipForNextRenderPass(hovering, this.isFocused(), new ScreenRectangle(left, top, width, height)); } @@ -780,7 +749,7 @@ public class RealmsMainScreen extends RealmsScreen { .setMessage(Component.translatable("mco.snapshot.createSnapshotPopup.text")) .addButton( Component.translatable("mco.selectServer.create"), - popupScreen -> RealmsMainScreen.this.minecraft.setScreen(new RealmsCreateRealmScreen(RealmsMainScreen.this, this.parent.id)) + popupScreen -> RealmsMainScreen.this.minecraft.setScreen(new RealmsCreateRealmScreen(RealmsMainScreen.this, this.parent, true)) ) .addButton(CommonComponents.GUI_CANCEL, PopupScreen::onClose) .build() @@ -790,7 +759,10 @@ public class RealmsMainScreen extends RealmsScreen { @Override public Component getNarration() { return Component.translatable( - "gui.narrate.button", CommonComponents.joinForNarration(START_SNAPSHOT_REALM, Component.translatable("mco.snapshot.description", this.parent.name)) + "gui.narrate.button", + CommonComponents.joinForNarration( + START_SNAPSHOT_REALM, Component.translatable("mco.snapshot.description", Objects.requireNonNullElse(this.parent.name, "unknown server")) + ) ); } } @@ -896,7 +868,7 @@ public class RealmsMainScreen extends RealmsScreen { private void drawRealmStatus( GuiGraphics guiGraphics, int x, int y, int mouseX, int mouseY, ResourceLocation spriteLocation, Supplier tooltipSupplier ) { - guiGraphics.blitSprite(spriteLocation, x, y, 10, 28); + guiGraphics.blitSprite(RenderType::guiTextured, spriteLocation, x, y, 10, 28); if (RealmsMainScreen.this.realmSelectionList.isMouseOver(mouseX, mouseY) && mouseX >= x && mouseX <= x + 10 && mouseY >= y && mouseY <= y + 28) { RealmsMainScreen.this.setTooltipForNextRenderPass((Component)tooltipSupplier.get()); } @@ -914,13 +886,15 @@ public class RealmsMainScreen extends RealmsScreen { } } - protected void renderClampedString(GuiGraphics guiGraphics, String text, int minX, int y, int maxX, int color) { - int i = maxX - minX; - if (RealmsMainScreen.this.font.width(text) > i) { - String string = RealmsMainScreen.this.font.plainSubstrByWidth(text, i - RealmsMainScreen.this.font.width("... ")); - guiGraphics.drawString(RealmsMainScreen.this.font, string + "...", minX, y, color, false); - } else { - guiGraphics.drawString(RealmsMainScreen.this.font, text, minX, y, color, false); + protected void renderClampedString(GuiGraphics guiGraphics, @Nullable String text, int minX, int y, int maxX, int color) { + if (text != null) { + int i = maxX - minX; + if (RealmsMainScreen.this.font.width(text) > i) { + String string = RealmsMainScreen.this.font.plainSubstrByWidth(text, i - RealmsMainScreen.this.font.width("... ")); + guiGraphics.drawString(RealmsMainScreen.this.font, string + "...", minX, y, color, false); + } else { + guiGraphics.drawString(RealmsMainScreen.this.font, text, minX, y, color, false); + } } } @@ -928,6 +902,28 @@ public class RealmsMainScreen extends RealmsScreen { return left + width - RealmsMainScreen.this.font.width(versionComponent) - 20; } + protected int gameModeTextX(int i, int j, Component component) { + return i + j - RealmsMainScreen.this.font.width(component) - 20; + } + + protected int renderGameMode(RealmsServer realmsServer, GuiGraphics guiGraphics, int i, int j, int k) { + boolean bl = realmsServer.isHardcore; + int l = realmsServer.gameMode; + int m = i; + if (GameType.isValidId(l)) { + Component component = RealmsMainScreen.getGameModeComponent(l, bl); + m = this.gameModeTextX(i, j, component); + guiGraphics.drawString(RealmsMainScreen.this.font, component, m, this.secondLineY(k), -8355712, false); + } + + if (bl) { + m -= 10; + guiGraphics.blitSprite(RenderType::guiTextured, RealmsMainScreen.HARDCORE_MODE_SPRITE, m, this.secondLineY(k), 8, 8); + } + + return m; + } + protected int firstLineY(int top) { return top + 1; } @@ -992,7 +988,9 @@ public class RealmsMainScreen extends RealmsScreen { } private void drawNotificationCounter(GuiGraphics guiGraphics) { - guiGraphics.blitSprite(NOTIFICATION_ICONS[Math.min(this.notificationCount, 6) - 1], this.getX() + this.getWidth() - 5, this.getY() - 3, 8, 8); + guiGraphics.blitSprite( + RenderType::guiTextured, NOTIFICATION_ICONS[Math.min(this.notificationCount, 6) - 1], this.getX() + this.getWidth() - 5, this.getY() - 3, 8, 8 + ); } } @@ -1114,7 +1112,12 @@ public class RealmsMainScreen extends RealmsScreen { guiGraphics.drawString(RealmsMainScreen.this.font, component, k, j, -8355712, false); } - guiGraphics.drawString(RealmsMainScreen.this.font, this.server.getDescription(), i, this.secondLineY(j), -8355712, false); + int l = left; + if (!this.server.isMinigameActive()) { + l = this.renderGameMode(this.server, guiGraphics, left, width, j); + } + + this.renderClampedString(guiGraphics, this.server.getDescription(), i, this.secondLineY(j), l, -8355712); this.renderThirdLine(guiGraphics, top, left, this.server); this.renderStatusLights(this.server, guiGraphics, left + width, top, mouseX, mouseY); this.tooltip.refreshTooltipForNextRenderPass(hovering, this.isFocused(), new ScreenRectangle(left, top, width, height)); @@ -1122,14 +1125,14 @@ public class RealmsMainScreen extends RealmsScreen { @Override public Component getNarration() { - return Component.literal(this.server.name); + return Component.literal((String)Objects.requireNonNullElse(this.server.name, "unknown server")); } } @Environment(EnvType.CLIENT) - class RealmSelectionList extends RealmsObjectSelectionList { + class RealmSelectionList extends ObjectSelectionList { public RealmSelectionList() { - super(RealmsMainScreen.this.width, RealmsMainScreen.this.height, 0, 36); + super(Minecraft.getInstance(), RealmsMainScreen.this.width, RealmsMainScreen.this.height, 0, 36); } public void setSelected(@Nullable RealmsMainScreen.Entry entry) { @@ -1137,15 +1140,61 @@ public class RealmsMainScreen extends RealmsScreen { RealmsMainScreen.this.updateButtonStates(); } - @Override - public int getMaxPosition() { - return this.getItemCount() * 36; - } - @Override public int getRowWidth() { return 300; } + + void refreshEntries(RealmsMainScreen realmsMainScreen, @Nullable RealmsServer realmsServer) { + this.clearEntries(); + + for (RealmsNotification realmsNotification : RealmsMainScreen.this.notifications) { + if (realmsNotification instanceof VisitUrl visitUrl) { + this.addEntriesForNotification(visitUrl, realmsMainScreen); + RealmsMainScreen.this.markNotificationsAsSeen(List.of(realmsNotification)); + break; + } + } + + this.refreshServerEntries(realmsServer); + } + + private void refreshServerEntries(@Nullable RealmsServer realmsServer) { + for (RealmsServer realmsServer2 : RealmsMainScreen.this.availableSnapshotServers) { + this.addEntry(RealmsMainScreen.this.new AvailableSnapshotEntry(realmsServer2)); + } + + for (RealmsServer realmsServer2 : RealmsMainScreen.this.serverList) { + RealmsMainScreen.Entry entry; + if (RealmsMainScreen.isSnapshot() && !realmsServer2.isSnapshotRealm()) { + if (realmsServer2.state == RealmsServer.State.UNINITIALIZED) { + continue; + } + + entry = RealmsMainScreen.this.new ParentEntry(realmsServer2); + } else { + entry = RealmsMainScreen.this.new ServerEntry(realmsServer2); + } + + this.addEntry(entry); + if (realmsServer != null && realmsServer.id == realmsServer2.id) { + this.setSelected(entry); + } + } + } + + private void addEntriesForNotification(VisitUrl visitUrl, RealmsMainScreen realmsMainScreen) { + Component component = visitUrl.getMessage(); + int i = RealmsMainScreen.this.font.wordWrapHeight(component, 216); + int j = Mth.positiveCeilDiv(i + 7, 36) - 1; + this.addEntry(RealmsMainScreen.this.new NotificationMessageEntry(component, j + 2, visitUrl)); + + for (int k = 0; k < j; k++) { + this.addEntry(RealmsMainScreen.this.new EmptyEntry()); + } + + this.addEntry(RealmsMainScreen.this.new ButtonEntry(visitUrl.buildOpenLinkButton(realmsMainScreen))); + } } @Environment(EnvType.CLIENT) @@ -1174,14 +1223,14 @@ public class RealmsMainScreen extends RealmsScreen { @Override public void render(GuiGraphics guiGraphics, int index, int top, int left, int width, int height, int mouseX, int mouseY, boolean hovering, float partialTick) { if (this.serverData.state == RealmsServer.State.UNINITIALIZED) { - guiGraphics.blitSprite(RealmsMainScreen.NEW_REALM_SPRITE, left - 5, top + height / 2 - 10, 40, 20); + guiGraphics.blitSprite(RenderType::guiTextured, RealmsMainScreen.NEW_REALM_SPRITE, left - 5, top + height / 2 - 10, 40, 20); int i = top + height / 2 - 9 / 2; guiGraphics.drawString(RealmsMainScreen.this.font, RealmsMainScreen.SERVER_UNITIALIZED_TEXT, left + 40 - 2, i, 8388479); } else { this.renderStatusLights(this.serverData, guiGraphics, left + 36, top, mouseX, mouseY); RealmsUtil.renderPlayerFace(guiGraphics, left, top, 32, this.serverData.ownerUUID); this.renderFirstLine(guiGraphics, top, left, width); - this.renderSecondLine(guiGraphics, top, left); + this.renderSecondLine(guiGraphics, top, left, width); this.renderThirdLine(guiGraphics, top, left, this.serverData); boolean bl = this.renderOnlinePlayers(guiGraphics, top, left, width, height, mouseX, mouseY); this.renderStatusLights(this.serverData, guiGraphics, left + width, top, mouseX, mouseY); @@ -1202,16 +1251,18 @@ public class RealmsMainScreen extends RealmsScreen { } } - private void renderSecondLine(GuiGraphics guiGraphics, int top, int left) { - int i = this.textX(left); - int j = this.firstLineY(top); - int k = this.secondLineY(j); + private void renderSecondLine(GuiGraphics guiGraphics, int i, int j, int k) { + int l = this.textX(j); + int m = this.firstLineY(i); + int n = this.secondLineY(m); String string = this.serverData.getMinigameName(); - if (this.serverData.isMinigameActive() && string != null) { + boolean bl = this.serverData.isMinigameActive(); + if (bl && string != null) { Component component = Component.literal(string).withStyle(ChatFormatting.GRAY); - guiGraphics.drawString(RealmsMainScreen.this.font, Component.translatable("mco.selectServer.minigameName", component).withColor(-171), i, k, -1, false); + guiGraphics.drawString(RealmsMainScreen.this.font, Component.translatable("mco.selectServer.minigameName", component).withColor(-171), l, n, -1, false); } else { - guiGraphics.drawString(RealmsMainScreen.this.font, this.serverData.getDescription(), i, this.secondLineY(j), -8355712, false); + int o = this.renderGameMode(this.serverData, guiGraphics, j, k, m); + this.renderClampedString(guiGraphics, this.serverData.getDescription(), l, this.secondLineY(m), o, -8355712); } } @@ -1249,7 +1300,7 @@ public class RealmsMainScreen extends RealmsScreen { private void createUnitializedRealm() { RealmsMainScreen.this.minecraft.getSoundManager().play(SimpleSoundInstance.forUI(SoundEvents.UI_BUTTON_CLICK, 1.0F)); - RealmsCreateRealmScreen realmsCreateRealmScreen = new RealmsCreateRealmScreen(RealmsMainScreen.this, this.serverData); + RealmsCreateRealmScreen realmsCreateRealmScreen = new RealmsCreateRealmScreen(RealmsMainScreen.this, this.serverData, this.serverData.isSnapshotRealm()); RealmsMainScreen.this.minecraft.setScreen(realmsCreateRealmScreen); } @@ -1289,7 +1340,7 @@ public class RealmsMainScreen extends RealmsScreen { public Component getNarration() { return (Component)(this.serverData.state == RealmsServer.State.UNINITIALIZED ? RealmsMainScreen.UNITIALIZED_WORLD_NARRATION - : Component.translatable("narrator.select", this.serverData.name)); + : Component.translatable("narrator.select", Objects.requireNonNullElse(this.serverData.name, "unknown server"))); } public RealmsServer getServer() { diff --git a/com/mojang/realmsclient/client/FileUpload.java b/com/mojang/realmsclient/client/FileUpload.java index 2d761a03..2a54d6e5 100644 --- a/com/mojang/realmsclient/client/FileUpload.java +++ b/com/mojang/realmsclient/client/FileUpload.java @@ -3,6 +3,7 @@ package com.mojang.realmsclient.client; import com.google.gson.JsonElement; import com.google.gson.JsonParser; import com.mojang.logging.LogUtils; +import com.mojang.realmsclient.client.worldupload.RealmsUploadCanceledException; import com.mojang.realmsclient.dto.UploadInfo; import com.mojang.realmsclient.gui.screens.UploadResult; import java.io.File; @@ -16,9 +17,9 @@ import java.util.Optional; import java.util.concurrent.CompletableFuture; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; -import java.util.function.Consumer; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; +import net.minecraft.Util; import net.minecraft.client.User; import org.apache.http.HttpResponse; import org.apache.http.NameValuePair; @@ -46,7 +47,7 @@ public class FileUpload { private final String clientVersion; private final String worldVersion; private final UploadStatus uploadStatus; - private final AtomicBoolean cancelled = new AtomicBoolean(false); + final AtomicBoolean cancelled = new AtomicBoolean(false); @Nullable private CompletableFuture uploadTask; private final RequestConfig requestConfig = RequestConfig.custom() @@ -66,19 +67,22 @@ public class FileUpload { this.uploadStatus = uploadStatus; } - public void upload(Consumer resultConsumer) { - if (this.uploadTask == null) { - this.uploadTask = CompletableFuture.supplyAsync(() -> this.requestUpload(0)); - this.uploadTask.thenAccept(resultConsumer); + public UploadResult upload() { + if (this.uploadTask != null) { + return new UploadResult.Builder().build(); + } else { + this.uploadTask = CompletableFuture.supplyAsync(() -> this.requestUpload(0), Util.backgroundExecutor()); + if (this.cancelled.get()) { + this.cancel(); + return new UploadResult.Builder().build(); + } else { + return (UploadResult)this.uploadTask.join(); + } } } public void cancel() { this.cancelled.set(true); - if (this.uploadTask != null) { - this.uploadTask.cancel(false); - this.uploadTask = null; - } } /** @@ -89,7 +93,7 @@ public class FileUpload { if (this.cancelled.get()) { return builder.build(); } else { - this.uploadStatus.totalBytes = this.file.length(); + this.uploadStatus.setTotalBytes(this.file.length()); HttpPost httpPost = new HttpPost(this.uploadInfo.getUploadEndpoint().resolve("/upload/" + this.realmId + "/" + this.slotId)); CloseableHttpClient closeableHttpClient = HttpClientBuilder.create().setDefaultRequestConfig(this.requestConfig).build(); @@ -107,9 +111,10 @@ public class FileUpload { } catch (Exception var12) { if (!this.cancelled.get()) { LOGGER.error("Caught exception while uploading: ", (Throwable)var12); + return builder.build(); } - return builder.build(); + throw new RealmsUploadCanceledException(); } finally { this.cleanup(httpPost, closeableHttpClient); } @@ -189,15 +194,15 @@ public class FileUpload { } @Environment(EnvType.CLIENT) - static class CustomInputStreamEntity extends InputStreamEntity { + class CustomInputStreamEntity extends InputStreamEntity { private final long length; private final InputStream content; private final UploadStatus uploadStatus; - public CustomInputStreamEntity(InputStream content, long length, UploadStatus uploadStatus) { - super(content); - this.content = content; - this.length = length; + public CustomInputStreamEntity(final InputStream inputStream, final long l, final UploadStatus uploadStatus) { + super(inputStream); + this.content = inputStream; + this.length = l; this.uploadStatus = uploadStatus; } @@ -211,8 +216,12 @@ public class FileUpload { int i; if (this.length < 0L) { while ((i = inputStream.read(bs)) != -1) { + if (FileUpload.this.cancelled.get()) { + throw new RealmsUploadCanceledException(); + } + outputStream.write(bs, 0, i); - this.uploadStatus.bytesWritten += i; + this.uploadStatus.onWrite(i); } } else { long l = this.length; @@ -223,13 +232,29 @@ public class FileUpload { break; } + if (FileUpload.this.cancelled.get()) { + throw new RealmsUploadCanceledException(); + } + outputStream.write(bs, 0, i); - this.uploadStatus.bytesWritten += i; + this.uploadStatus.onWrite(i); l -= i; outputStream.flush(); } } - } finally { + } catch (Throwable var8) { + if (inputStream != null) { + try { + inputStream.close(); + } catch (Throwable var7) { + var8.addSuppressed(var7); + } + } + + throw var8; + } + + if (inputStream != null) { inputStream.close(); } } diff --git a/com/mojang/realmsclient/client/RealmsClient.java b/com/mojang/realmsclient/client/RealmsClient.java index 9ff203ce..43ee5455 100644 --- a/com/mojang/realmsclient/client/RealmsClient.java +++ b/com/mojang/realmsclient/client/RealmsClient.java @@ -3,6 +3,8 @@ package com.mojang.realmsclient.client; import com.google.gson.JsonArray; import com.mojang.logging.LogUtils; import com.mojang.realmsclient.RealmsMainScreen; +import com.mojang.realmsclient.client.RealmsError.AuthenticationError; +import com.mojang.realmsclient.client.RealmsError.CustomError; import com.mojang.realmsclient.dto.BackupList; import com.mojang.realmsclient.dto.GuardedSerializer; import com.mojang.realmsclient.dto.Ops; @@ -27,7 +29,7 @@ import com.mojang.realmsclient.dto.WorldTemplatePaginatedList; import com.mojang.realmsclient.exception.RealmsHttpException; import com.mojang.realmsclient.exception.RealmsServiceException; import com.mojang.realmsclient.exception.RetryCallException; -import com.mojang.realmsclient.util.WorldGenerationInfo; +import com.mojang.realmsclient.util.UploadTokenCache; import com.mojang.util.UndashedUuid; import java.net.URI; import java.net.URISyntaxException; @@ -209,7 +211,7 @@ public class RealmsClient { try { return RealmsClient.CompatibleVersionResponse.valueOf(string2); } catch (IllegalArgumentException var5) { - throw new RealmsServiceException(RealmsError.CustomError.unknownCompatibilityResponse(string2)); + throw new RealmsServiceException(CustomError.unknownCompatibilityResponse(string2)); } } @@ -300,15 +302,6 @@ public class RealmsClient { return Boolean.valueOf(string2); } - public Boolean resetWorldWithSeed(long worldId, WorldGenerationInfo generationInfo) throws RealmsServiceException { - RealmsWorldResetDto realmsWorldResetDto = new RealmsWorldResetDto( - generationInfo.seed(), -1L, generationInfo.levelType().getDtoIndex(), generationInfo.generateStructures(), generationInfo.experiments() - ); - String string = this.url("worlds" + "/$WORLD_ID/reset".replace("$WORLD_ID", String.valueOf(worldId))); - String string2 = this.execute(Request.post(string, GSON.toJson(realmsWorldResetDto), 30000, 80000)); - return Boolean.valueOf(string2); - } - public Boolean resetWorldWithTemplate(long worldId, String worldTemplateId) throws RealmsServiceException { RealmsWorldResetDto realmsWorldResetDto = new RealmsWorldResetDto(null, Long.valueOf(worldTemplateId), -1, false, Set.of()); String string = this.url("worlds" + "/$WORLD_ID/reset".replace("$WORLD_ID", String.valueOf(worldId))); @@ -352,9 +345,15 @@ public class RealmsClient { } @Nullable - public UploadInfo requestUploadInfo(long worldId, @Nullable String token) throws RealmsServiceException { - String string = this.url("worlds" + "/$WORLD_ID/backups/upload".replace("$WORLD_ID", String.valueOf(worldId))); - return UploadInfo.parse(this.execute(Request.put(string, UploadInfo.createRequest(token)))); + public UploadInfo requestUploadInfo(long l) throws RealmsServiceException { + String string = this.url("worlds" + "/$WORLD_ID/backups/upload".replace("$WORLD_ID", String.valueOf(l))); + String string2 = UploadTokenCache.get(l); + UploadInfo uploadInfo = UploadInfo.parse(this.execute(Request.put(string, UploadInfo.createRequest(string2)))); + if (uploadInfo != null) { + UploadTokenCache.put(l, uploadInfo.getToken()); + } + + return uploadInfo; } public void rejectInvitation(String inviteId) throws RealmsServiceException { @@ -416,7 +415,7 @@ public class RealmsClient { } else if (i == 401) { String string2 = request.getHeader("WWW-Authenticate"); LOGGER.info("Could not authorize you against Realms server: {}", string2); - throw new RealmsServiceException(new RealmsError.AuthenticationError(string2)); + throw new RealmsServiceException(new AuthenticationError(string2)); } else { RealmsError realmsError = RealmsError.parse(i, string); throw new RealmsServiceException(realmsError); @@ -426,7 +425,7 @@ public class RealmsClient { throw new RetryCallException(j, i); } } catch (RealmsHttpException var5) { - throw new RealmsServiceException(RealmsError.CustomError.connectivityError(var5)); + throw new RealmsServiceException(CustomError.connectivityError(var5)); } } diff --git a/com/mojang/realmsclient/client/UploadStatus.java b/com/mojang/realmsclient/client/UploadStatus.java index 617a8283..a4e4fcdc 100644 --- a/com/mojang/realmsclient/client/UploadStatus.java +++ b/com/mojang/realmsclient/client/UploadStatus.java @@ -2,9 +2,56 @@ package com.mojang.realmsclient.client; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; +import net.minecraft.Util; @Environment(EnvType.CLIENT) public class UploadStatus { - public volatile long bytesWritten; - public volatile long totalBytes; + private volatile long bytesWritten; + private volatile long totalBytes; + private long previousTimeSnapshot = Util.getMillis(); + private long previousBytesWritten; + private long bytesPerSecond; + + public void setTotalBytes(long l) { + this.totalBytes = l; + } + + public long getTotalBytes() { + return this.totalBytes; + } + + public long getBytesWritten() { + return this.bytesWritten; + } + + public void onWrite(long l) { + this.bytesWritten += l; + } + + public boolean uploadStarted() { + return this.bytesWritten != 0L; + } + + public boolean uploadCompleted() { + return this.bytesWritten == this.getTotalBytes(); + } + + public double getPercentage() { + return Math.min((double)this.getBytesWritten() / this.getTotalBytes(), 1.0); + } + + public void refreshBytesPerSecond() { + long l = Util.getMillis(); + long m = l - this.previousTimeSnapshot; + if (m >= 1000L) { + long n = this.bytesWritten; + this.bytesPerSecond = 1000L * (n - this.previousBytesWritten) / m; + this.previousBytesWritten = n; + this.previousTimeSnapshot = l; + } + } + + public long getBytesPerSecond() { + return this.bytesPerSecond; + } } diff --git a/com/mojang/realmsclient/client/worldupload/RealmsCreateWorldFlow.java b/com/mojang/realmsclient/client/worldupload/RealmsCreateWorldFlow.java new file mode 100644 index 00000000..cefede14 --- /dev/null +++ b/com/mojang/realmsclient/client/worldupload/RealmsCreateWorldFlow.java @@ -0,0 +1,117 @@ +package com.mojang.realmsclient.client.worldupload; + +import com.mojang.logging.LogUtils; +import com.mojang.realmsclient.RealmsMainScreen; +import com.mojang.realmsclient.dto.RealmsServer; +import com.mojang.realmsclient.dto.RealmsWorldOptions; +import com.mojang.realmsclient.gui.screens.RealmsConfigureWorldScreen; +import com.mojang.realmsclient.gui.screens.RealmsGenericErrorScreen; +import com.mojang.realmsclient.util.task.RealmCreationTask; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.concurrent.CompletionException; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.SharedConstants; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.screens.AlertScreen; +import net.minecraft.client.gui.screens.Screen; +import net.minecraft.client.gui.screens.worldselection.CreateWorldScreen; +import net.minecraft.core.LayeredRegistryAccess; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.NbtIo; +import net.minecraft.network.chat.CommonComponents; +import net.minecraft.network.chat.Component; +import net.minecraft.server.RegistryLayer; +import net.minecraft.world.level.storage.PrimaryLevelData; +import org.jetbrains.annotations.Nullable; +import org.slf4j.Logger; + +@Environment(EnvType.CLIENT) +public class RealmsCreateWorldFlow { + private static final Logger LOGGER = LogUtils.getLogger(); + + public static void createWorld( + Minecraft minecraft, Screen screen, Screen screen2, int i, RealmsServer realmsServer, @Nullable RealmCreationTask realmCreationTask + ) { + CreateWorldScreen.openFresh( + minecraft, + screen, + (createWorldScreen, layeredRegistryAccess, primaryLevelData, path) -> { + Path path2; + try { + path2 = createTemporaryWorldFolder(layeredRegistryAccess, primaryLevelData, path); + } catch (IOException var13) { + LOGGER.warn("Failed to create temporary world folder."); + minecraft.setScreen(new RealmsGenericErrorScreen(Component.translatable("mco.create.world.failed"), screen2)); + return true; + } + + RealmsWorldOptions realmsWorldOptions = RealmsWorldOptions.createFromSettings( + primaryLevelData.getLevelSettings(), SharedConstants.getCurrentVersion().getName() + ); + RealmsWorldUpload realmsWorldUpload = new RealmsWorldUpload( + path2, realmsWorldOptions, minecraft.getUser(), realmsServer.id, i, RealmsWorldUploadStatusTracker.noOp() + ); + minecraft.forceSetScreen( + new AlertScreen(realmsWorldUpload::cancel, Component.translatable("mco.create.world.reset.title"), Component.empty(), CommonComponents.GUI_CANCEL, false) + ); + if (realmCreationTask != null) { + realmCreationTask.run(); + } + + realmsWorldUpload.packAndUpload().handleAsync((object, throwable) -> { + if (throwable != null) { + if (throwable instanceof CompletionException completionException) { + throwable = completionException.getCause(); + } + + if (throwable instanceof RealmsUploadCanceledException) { + minecraft.forceSetScreen(screen2); + } else { + if (throwable instanceof RealmsUploadFailedException realmsUploadFailedException) { + LOGGER.warn("Failed to create realms world {}", realmsUploadFailedException.getStatusMessage()); + } else { + LOGGER.warn("Failed to create realms world {}", throwable.getMessage()); + } + + minecraft.forceSetScreen(new RealmsGenericErrorScreen(Component.translatable("mco.create.world.failed"), screen2)); + } + } else { + if (screen instanceof RealmsConfigureWorldScreen realmsConfigureWorldScreen) { + realmsConfigureWorldScreen.fetchServerData(realmsServer.id); + } + + if (realmCreationTask != null) { + RealmsMainScreen.play(realmsServer, screen, true); + } else { + minecraft.forceSetScreen(screen); + } + + RealmsMainScreen.refreshServerList(); + } + + return null; + }, minecraft); + return true; + } + ); + } + + private static Path createTemporaryWorldFolder( + LayeredRegistryAccess layeredRegistryAccess, PrimaryLevelData primaryLevelData, @Nullable Path path + ) throws IOException { + Path path2 = Files.createTempDirectory("minecraft_realms_world_upload"); + if (path != null) { + Files.move(path, path2.resolve("datapacks")); + } + + CompoundTag compoundTag = primaryLevelData.createTag(layeredRegistryAccess.compositeAccess(), null); + CompoundTag compoundTag2 = new CompoundTag(); + compoundTag2.put("Data", compoundTag); + Path path3 = Files.createFile(path2.resolve("level.dat")); + NbtIo.writeCompressed(compoundTag2, path3); + return path2; + } +} diff --git a/com/mojang/realmsclient/client/worldupload/RealmsUploadCanceledException.java b/com/mojang/realmsclient/client/worldupload/RealmsUploadCanceledException.java new file mode 100644 index 00000000..89b4af4e --- /dev/null +++ b/com/mojang/realmsclient/client/worldupload/RealmsUploadCanceledException.java @@ -0,0 +1,15 @@ +package com.mojang.realmsclient.client.worldupload; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.network.chat.Component; + +@Environment(EnvType.CLIENT) +public class RealmsUploadCanceledException extends RealmsUploadException { + private static final Component UPLOAD_CANCELED = Component.translatable("mco.upload.cancelled"); + + @Override + public Component getStatusMessage() { + return UPLOAD_CANCELED; + } +} diff --git a/com/mojang/realmsclient/client/worldupload/RealmsUploadException.java b/com/mojang/realmsclient/client/worldupload/RealmsUploadException.java new file mode 100644 index 00000000..b8580eff --- /dev/null +++ b/com/mojang/realmsclient/client/worldupload/RealmsUploadException.java @@ -0,0 +1,19 @@ +package com.mojang.realmsclient.client.worldupload; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.network.chat.Component; +import org.jetbrains.annotations.Nullable; + +@Environment(EnvType.CLIENT) +public abstract class RealmsUploadException extends RuntimeException { + @Nullable + public Component getStatusMessage() { + return null; + } + + @Nullable + public Component[] getErrorMessages() { + return null; + } +} diff --git a/com/mojang/realmsclient/client/worldupload/RealmsUploadFailedException.java b/com/mojang/realmsclient/client/worldupload/RealmsUploadFailedException.java new file mode 100644 index 00000000..c19bb614 --- /dev/null +++ b/com/mojang/realmsclient/client/worldupload/RealmsUploadFailedException.java @@ -0,0 +1,23 @@ +package com.mojang.realmsclient.client.worldupload; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.network.chat.Component; + +@Environment(EnvType.CLIENT) +public class RealmsUploadFailedException extends RealmsUploadException { + private final Component errorMessage; + + public RealmsUploadFailedException(Component component) { + this.errorMessage = component; + } + + public RealmsUploadFailedException(String string) { + this(Component.literal(string)); + } + + @Override + public Component getStatusMessage() { + return Component.translatable("mco.upload.failed", this.errorMessage); + } +} diff --git a/com/mojang/realmsclient/client/worldupload/RealmsUploadTooLargeException.java b/com/mojang/realmsclient/client/worldupload/RealmsUploadTooLargeException.java new file mode 100644 index 00000000..bf0b102f --- /dev/null +++ b/com/mojang/realmsclient/client/worldupload/RealmsUploadTooLargeException.java @@ -0,0 +1,23 @@ +package com.mojang.realmsclient.client.worldupload; + +import com.mojang.realmsclient.Unit; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.network.chat.Component; + +@Environment(EnvType.CLIENT) +public class RealmsUploadTooLargeException extends RealmsUploadException { + final long sizeLimit; + + public RealmsUploadTooLargeException(long l) { + this.sizeLimit = l; + } + + @Override + public Component[] getErrorMessages() { + return new Component[]{ + Component.translatable("mco.upload.failed.too_big.title"), + Component.translatable("mco.upload.failed.too_big.description", Unit.humanReadable(this.sizeLimit, Unit.getLargest(this.sizeLimit))) + }; + } +} diff --git a/com/mojang/realmsclient/client/worldupload/RealmsUploadWorldNotClosedException.java b/com/mojang/realmsclient/client/worldupload/RealmsUploadWorldNotClosedException.java new file mode 100644 index 00000000..a22501b9 --- /dev/null +++ b/com/mojang/realmsclient/client/worldupload/RealmsUploadWorldNotClosedException.java @@ -0,0 +1,13 @@ +package com.mojang.realmsclient.client.worldupload; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.network.chat.Component; + +@Environment(EnvType.CLIENT) +public class RealmsUploadWorldNotClosedException extends RealmsUploadException { + @Override + public Component getStatusMessage() { + return Component.translatable("mco.upload.close.failure"); + } +} diff --git a/com/mojang/realmsclient/client/worldupload/RealmsUploadWorldPacker.java b/com/mojang/realmsclient/client/worldupload/RealmsUploadWorldPacker.java new file mode 100644 index 00000000..f787ad0d --- /dev/null +++ b/com/mojang/realmsclient/client/worldupload/RealmsUploadWorldPacker.java @@ -0,0 +1,100 @@ +package com.mojang.realmsclient.client.worldupload; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.nio.file.Path; +import java.util.function.BooleanSupplier; +import java.util.zip.GZIPOutputStream; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import org.apache.commons.compress.archivers.tar.TarArchiveEntry; +import org.apache.commons.compress.archivers.tar.TarArchiveOutputStream; + +@Environment(EnvType.CLIENT) +public class RealmsUploadWorldPacker { + private static final long SIZE_LIMIT = 5368709120L; + private static final String WORLD_FOLDER_NAME = "world"; + private final BooleanSupplier isCanceled; + private final Path directoryToPack; + + public static File pack(Path path, BooleanSupplier booleanSupplier) throws IOException { + return new RealmsUploadWorldPacker(path, booleanSupplier).tarGzipArchive(); + } + + private RealmsUploadWorldPacker(Path path, BooleanSupplier booleanSupplier) { + this.isCanceled = booleanSupplier; + this.directoryToPack = path; + } + + private File tarGzipArchive() throws IOException { + TarArchiveOutputStream tarArchiveOutputStream = null; + + File var3; + try { + File file = File.createTempFile("realms-upload-file", ".tar.gz"); + tarArchiveOutputStream = new TarArchiveOutputStream(new GZIPOutputStream(new FileOutputStream(file))); + tarArchiveOutputStream.setLongFileMode(3); + this.addFileToTarGz(tarArchiveOutputStream, this.directoryToPack, "world", true); + if (this.isCanceled.getAsBoolean()) { + throw new RealmsUploadCanceledException(); + } + + tarArchiveOutputStream.finish(); + this.verifyBelowSizeLimit(file.length()); + var3 = file; + } finally { + if (tarArchiveOutputStream != null) { + tarArchiveOutputStream.close(); + } + } + + return var3; + } + + private void addFileToTarGz(TarArchiveOutputStream tarArchiveOutputStream, Path path, String string, boolean bl) throws IOException { + if (this.isCanceled.getAsBoolean()) { + throw new RealmsUploadCanceledException(); + } else { + this.verifyBelowSizeLimit(tarArchiveOutputStream.getBytesWritten()); + File file = path.toFile(); + String string2 = bl ? string : string + file.getName(); + TarArchiveEntry tarArchiveEntry = new TarArchiveEntry(file, string2); + tarArchiveOutputStream.putArchiveEntry(tarArchiveEntry); + if (file.isFile()) { + InputStream inputStream = new FileInputStream(file); + + try { + inputStream.transferTo(tarArchiveOutputStream); + } catch (Throwable var14) { + try { + inputStream.close(); + } catch (Throwable var13) { + var14.addSuppressed(var13); + } + + throw var14; + } + + inputStream.close(); + tarArchiveOutputStream.closeArchiveEntry(); + } else { + tarArchiveOutputStream.closeArchiveEntry(); + File[] files = file.listFiles(); + if (files != null) { + for (File file2 : files) { + this.addFileToTarGz(tarArchiveOutputStream, file2.toPath(), string2 + "/", false); + } + } + } + } + } + + private void verifyBelowSizeLimit(long l) { + if (l > 5368709120L) { + throw new RealmsUploadTooLargeException(5368709120L); + } + } +} diff --git a/com/mojang/realmsclient/client/worldupload/RealmsWorldUpload.java b/com/mojang/realmsclient/client/worldupload/RealmsWorldUpload.java new file mode 100644 index 00000000..14619aa1 --- /dev/null +++ b/com/mojang/realmsclient/client/worldupload/RealmsWorldUpload.java @@ -0,0 +1,126 @@ +package com.mojang.realmsclient.client.worldupload; + +import com.mojang.logging.LogUtils; +import com.mojang.realmsclient.client.FileUpload; +import com.mojang.realmsclient.client.RealmsClient; +import com.mojang.realmsclient.dto.RealmsWorldOptions; +import com.mojang.realmsclient.dto.UploadInfo; +import com.mojang.realmsclient.exception.RealmsServiceException; +import com.mojang.realmsclient.exception.RetryCallException; +import com.mojang.realmsclient.gui.screens.UploadResult; +import com.mojang.realmsclient.util.UploadTokenCache; +import java.io.File; +import java.io.IOException; +import java.nio.file.Path; +import java.util.concurrent.CancellationException; +import java.util.concurrent.CompletableFuture; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.SharedConstants; +import net.minecraft.Util; +import net.minecraft.client.User; +import org.jetbrains.annotations.Nullable; +import org.slf4j.Logger; + +@Environment(EnvType.CLIENT) +public class RealmsWorldUpload { + private static final Logger LOGGER = LogUtils.getLogger(); + public static final int UPLOAD_RETRIES = 20; + private final RealmsClient client = RealmsClient.create(); + private final Path worldFolder; + private final RealmsWorldOptions worldOptions; + private final User user; + private final long realmId; + private final int slotId; + private final RealmsWorldUploadStatusTracker statusCallback; + private volatile boolean cancelled; + @Nullable + private FileUpload uploadTask; + + public RealmsWorldUpload( + Path path, RealmsWorldOptions realmsWorldOptions, User user, long l, int i, RealmsWorldUploadStatusTracker realmsWorldUploadStatusTracker + ) { + this.worldFolder = path; + this.worldOptions = realmsWorldOptions; + this.user = user; + this.realmId = l; + this.slotId = i; + this.statusCallback = realmsWorldUploadStatusTracker; + } + + public CompletableFuture packAndUpload() { + return CompletableFuture.runAsync( + () -> { + File file = null; + + try { + UploadInfo uploadInfo = this.requestUploadInfoWithRetries(); + file = RealmsUploadWorldPacker.pack(this.worldFolder, () -> this.cancelled); + this.statusCallback.setUploading(); + FileUpload fileUpload = new FileUpload( + file, + this.realmId, + this.slotId, + uploadInfo, + this.user, + SharedConstants.getCurrentVersion().getName(), + this.worldOptions.version, + this.statusCallback.getUploadStatus() + ); + this.uploadTask = fileUpload; + UploadResult uploadResult = fileUpload.upload(); + String string = uploadResult.getSimplifiedErrorMessage(); + if (string != null) { + throw new RealmsUploadFailedException(string); + } + + UploadTokenCache.invalidate(this.realmId); + this.client.updateSlot(this.realmId, this.slotId, this.worldOptions); + } catch (IOException var11) { + throw new RealmsUploadFailedException(var11.getMessage()); + } catch (RealmsServiceException var12) { + throw new RealmsUploadFailedException(var12.realmsError.errorMessage()); + } catch (CancellationException | InterruptedException var13) { + throw new RealmsUploadCanceledException(); + } finally { + if (file != null) { + LOGGER.debug("Deleting file {}", file.getAbsolutePath()); + file.delete(); + } + } + }, + Util.backgroundExecutor() + ); + } + + public void cancel() { + this.cancelled = true; + if (this.uploadTask != null) { + this.uploadTask.cancel(); + this.uploadTask = null; + } + } + + private UploadInfo requestUploadInfoWithRetries() throws RealmsServiceException, InterruptedException { + for (int i = 0; i < 20; i++) { + try { + UploadInfo uploadInfo = this.client.requestUploadInfo(this.realmId); + if (this.cancelled) { + throw new RealmsUploadCanceledException(); + } + + if (uploadInfo != null) { + if (!uploadInfo.isWorldClosed()) { + throw new RealmsUploadWorldNotClosedException(); + } + + return uploadInfo; + } + } catch (RetryCallException var3) { + Thread.sleep(var3.delaySeconds * 1000L); + } + } + + throw new RealmsUploadWorldNotClosedException(); + } +} diff --git a/com/mojang/realmsclient/client/worldupload/RealmsWorldUploadStatusTracker.java b/com/mojang/realmsclient/client/worldupload/RealmsWorldUploadStatusTracker.java new file mode 100644 index 00000000..49564e4d --- /dev/null +++ b/com/mojang/realmsclient/client/worldupload/RealmsWorldUploadStatusTracker.java @@ -0,0 +1,27 @@ +package com.mojang.realmsclient.client.worldupload; + +import com.mojang.realmsclient.client.UploadStatus; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; + +@Environment(EnvType.CLIENT) +public interface RealmsWorldUploadStatusTracker { + UploadStatus getUploadStatus(); + + void setUploading(); + + static RealmsWorldUploadStatusTracker noOp() { + return new RealmsWorldUploadStatusTracker() { + private final UploadStatus uploadStatus = new UploadStatus(); + + @Override + public UploadStatus getUploadStatus() { + return this.uploadStatus; + } + + @Override + public void setUploading() { + } + }; + } +} diff --git a/com/mojang/realmsclient/client/worldupload/package-info.java b/com/mojang/realmsclient/client/worldupload/package-info.java new file mode 100644 index 00000000..de58452e --- /dev/null +++ b/com/mojang/realmsclient/client/worldupload/package-info.java @@ -0,0 +1,11 @@ +@ParametersAreNonnullByDefault +@MethodsReturnNonnullByDefault +@FieldsAreNonnullByDefault +@Environment(EnvType.CLIENT) +package com.mojang.realmsclient.client.worldupload; + +import javax.annotation.ParametersAreNonnullByDefault; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.FieldsAreNonnullByDefault; +import net.minecraft.MethodsReturnNonnullByDefault; diff --git a/com/mojang/realmsclient/dto/PlayerInfo.java b/com/mojang/realmsclient/dto/PlayerInfo.java index c9ad64e8..41d13667 100644 --- a/com/mojang/realmsclient/dto/PlayerInfo.java +++ b/com/mojang/realmsclient/dto/PlayerInfo.java @@ -4,10 +4,12 @@ import com.google.gson.annotations.SerializedName; import java.util.UUID; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; +import org.jetbrains.annotations.Nullable; @Environment(EnvType.CLIENT) public class PlayerInfo extends ValueObject implements ReflectionBasedSerialization { @SerializedName("name") + @Nullable private String name; @SerializedName("uuid") private UUID uuid; @@ -19,7 +21,7 @@ public class PlayerInfo extends ValueObject implements ReflectionBasedSerializat private boolean online; public String getName() { - return this.name; + return this.name == null ? "" : this.name; } public void setName(String name) { diff --git a/com/mojang/realmsclient/dto/RealmsNews.java b/com/mojang/realmsclient/dto/RealmsNews.java index 6cf45589..a89ecb97 100644 --- a/com/mojang/realmsclient/dto/RealmsNews.java +++ b/com/mojang/realmsclient/dto/RealmsNews.java @@ -6,22 +6,23 @@ import com.mojang.logging.LogUtils; import com.mojang.realmsclient.util.JsonUtils; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; +import org.jetbrains.annotations.Nullable; import org.slf4j.Logger; @Environment(EnvType.CLIENT) public class RealmsNews extends ValueObject { private static final Logger LOGGER = LogUtils.getLogger(); + @Nullable public String newsLink; public static RealmsNews parse(String json) { RealmsNews realmsNews = new RealmsNews(); try { - JsonParser jsonParser = new JsonParser(); - JsonObject jsonObject = jsonParser.parse(json).getAsJsonObject(); + JsonObject jsonObject = JsonParser.parseString(json).getAsJsonObject(); realmsNews.newsLink = JsonUtils.getStringOr("newsLink", jsonObject, null); - } catch (Exception var4) { - LOGGER.error("Could not parse RealmsNews: {}", var4.getMessage()); + } catch (Exception var3) { + LOGGER.error("Could not parse RealmsNews: {}", var3.getMessage()); } return realmsNews; diff --git a/com/mojang/realmsclient/dto/RealmsServer.java b/com/mojang/realmsclient/dto/RealmsServer.java index 9528f8fb..0c2de1e8 100644 --- a/com/mojang/realmsclient/dto/RealmsServer.java +++ b/com/mojang/realmsclient/dto/RealmsServer.java @@ -29,10 +29,13 @@ public class RealmsServer extends ValueObject { private static final Logger LOGGER = LogUtils.getLogger(); private static final int NO_VALUE = -1; public long id; + @Nullable public String remoteSubscriptionId; + @Nullable public String name; public String motd; public RealmsServer.State state; + @Nullable public String owner; public UUID ownerUUID = Util.NIL_UUID; public List players; @@ -41,10 +44,13 @@ public class RealmsServer extends ValueObject { public boolean expiredTrial; public int daysLeft; public RealmsServer.WorldType worldType; + public boolean isHardcore; + public int gameMode; public int activeSlot; @Nullable public String minigameName; public int minigameId; + @Nullable public String minigameImage; public long parentRealmId = -1L; @Nullable @@ -56,6 +62,7 @@ public class RealmsServer extends ValueObject { return this.motd; } + @Nullable public String getName() { return this.name; } @@ -80,7 +87,7 @@ public class RealmsServer extends ValueObject { realmsServer.id = JsonUtils.getLongOr("id", json, -1L); realmsServer.remoteSubscriptionId = JsonUtils.getStringOr("remoteSubscriptionId", json, null); realmsServer.name = JsonUtils.getStringOr("name", json, null); - realmsServer.motd = JsonUtils.getStringOr("motd", json, null); + realmsServer.motd = JsonUtils.getStringOr("motd", json, ""); realmsServer.state = getState(JsonUtils.getStringOr("state", json, RealmsServer.State.CLOSED.name())); realmsServer.owner = JsonUtils.getStringOr("owner", json, null); if (json.get("players") != null && json.get("players").isJsonArray()) { @@ -94,6 +101,8 @@ public class RealmsServer extends ValueObject { realmsServer.expired = JsonUtils.getBooleanOr("expired", json, false); realmsServer.expiredTrial = JsonUtils.getBooleanOr("expiredTrial", json, false); realmsServer.worldType = getWorldType(JsonUtils.getStringOr("worldType", json, RealmsServer.WorldType.NORMAL.name())); + realmsServer.isHardcore = JsonUtils.getBooleanOr("isHardcore", json, false); + realmsServer.gameMode = JsonUtils.getIntOr("gameMode", json, -1); realmsServer.ownerUUID = JsonUtils.getUuidOr("ownerUUID", json, Util.NIL_UUID); if (json.get("slots") != null && json.get("slots").isJsonArray()) { realmsServer.slots = parseSlots(json.get("slots").getAsJsonArray()); @@ -152,13 +161,13 @@ public class RealmsServer extends ValueObject { for (JsonElement jsonElement : jsonArray) { try { JsonObject jsonObject = jsonElement.getAsJsonObject(); - JsonParser jsonParser = new JsonParser(); - JsonElement jsonElement2 = jsonParser.parse(jsonObject.get("options").getAsString()); + JsonElement jsonElement2 = JsonParser.parseString(jsonObject.get("options").getAsString()); + RealmsSettings realmsSettings = parseSettings(jsonObject.get("settings")); RealmsWorldOptions realmsWorldOptions; if (jsonElement2 == null) { realmsWorldOptions = RealmsWorldOptions.createDefaults(); } else { - realmsWorldOptions = RealmsWorldOptions.parse(jsonElement2.getAsJsonObject()); + realmsWorldOptions = RealmsWorldOptions.parse(jsonElement2.getAsJsonObject(), realmsSettings); } int i = JsonUtils.getIntOr("slotId", jsonObject, -1); @@ -176,6 +185,23 @@ public class RealmsServer extends ValueObject { return map; } + private static RealmsSettings parseSettings(JsonElement jsonElement) { + boolean bl = false; + if (jsonElement.isJsonArray()) { + for (JsonElement jsonElement2 : jsonElement.getAsJsonArray()) { + JsonObject jsonObject = jsonElement2.getAsJsonObject(); + bl = readBoolean(jsonObject, "hardcore", bl); + } + } + + return new RealmsSettings(bl); + } + + private static boolean readBoolean(JsonObject jsonObject, String string, boolean bl) { + String string2 = JsonUtils.getStringOr("name", jsonObject, null); + return string2 != null && string2.equals(string) ? JsonUtils.getBooleanOr("value", jsonObject, bl) : bl; + } + private static Map createEmptySlots() { Map map = Maps.newHashMap(); map.put(1, RealmsWorldOptions.createEmptyDefaults()); @@ -268,6 +294,8 @@ public class RealmsServer extends ValueObject { realmsServer.expiredTrial = this.expiredTrial; realmsServer.daysLeft = this.daysLeft; realmsServer.worldType = this.worldType; + realmsServer.isHardcore = this.isHardcore; + realmsServer.gameMode = this.gameMode; realmsServer.ownerUUID = this.ownerUUID; realmsServer.minigameName = this.minigameName; realmsServer.activeSlot = this.activeSlot; @@ -299,11 +327,13 @@ public class RealmsServer extends ValueObject { } public String getWorldName(int slot) { - return this.name + " (" + ((RealmsWorldOptions)this.slots.get(slot)).getSlotName(slot) + ")"; + return this.name == null + ? ((RealmsWorldOptions)this.slots.get(slot)).getSlotName(slot) + : this.name + " (" + ((RealmsWorldOptions)this.slots.get(slot)).getSlotName(slot) + ")"; } public ServerData toServerData(String ip) { - return new ServerData(this.name, ip, ServerData.Type.REALM); + return new ServerData((String)Objects.requireNonNullElse(this.name, "unknown server"), ip, ServerData.Type.REALM); } @Environment(EnvType.CLIENT) @@ -341,7 +371,7 @@ public class RealmsServer extends ValueObject { .compareTrueFirst(first.isSnapshotRealm(), second.isSnapshotRealm()) .compareTrueFirst(first.state == RealmsServer.State.UNINITIALIZED, second.state == RealmsServer.State.UNINITIALIZED) .compareTrueFirst(first.expiredTrial, second.expiredTrial) - .compareTrueFirst(first.owner.equals(this.refOwner), second.owner.equals(this.refOwner)) + .compareTrueFirst(Objects.equals(first.owner, this.refOwner), Objects.equals(second.owner, this.refOwner)) .compareFalseFirst(first.expired, second.expired) .compareTrueFirst(first.state == RealmsServer.State.OPEN, second.state == RealmsServer.State.OPEN) .compare(first.id, second.id) diff --git a/com/mojang/realmsclient/dto/RealmsServerAddress.java b/com/mojang/realmsclient/dto/RealmsServerAddress.java index c2ab9d1d..32d2853e 100644 --- a/com/mojang/realmsclient/dto/RealmsServerAddress.java +++ b/com/mojang/realmsclient/dto/RealmsServerAddress.java @@ -6,26 +6,29 @@ import com.mojang.logging.LogUtils; import com.mojang.realmsclient.util.JsonUtils; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; +import org.jetbrains.annotations.Nullable; import org.slf4j.Logger; @Environment(EnvType.CLIENT) public class RealmsServerAddress extends ValueObject { private static final Logger LOGGER = LogUtils.getLogger(); + @Nullable public String address; + @Nullable public String resourcePackUrl; + @Nullable public String resourcePackHash; public static RealmsServerAddress parse(String json) { - JsonParser jsonParser = new JsonParser(); RealmsServerAddress realmsServerAddress = new RealmsServerAddress(); try { - JsonObject jsonObject = jsonParser.parse(json).getAsJsonObject(); + JsonObject jsonObject = JsonParser.parseString(json).getAsJsonObject(); realmsServerAddress.address = JsonUtils.getStringOr("address", jsonObject, null); realmsServerAddress.resourcePackUrl = JsonUtils.getStringOr("resourcePackUrl", jsonObject, null); realmsServerAddress.resourcePackHash = JsonUtils.getStringOr("resourcePackHash", jsonObject, null); - } catch (Exception var4) { - LOGGER.error("Could not parse RealmsServerAddress: {}", var4.getMessage()); + } catch (Exception var3) { + LOGGER.error("Could not parse RealmsServerAddress: {}", var3.getMessage()); } return realmsServerAddress; diff --git a/com/mojang/realmsclient/dto/RealmsServerList.java b/com/mojang/realmsclient/dto/RealmsServerList.java index 06451031..885e4cc2 100644 --- a/com/mojang/realmsclient/dto/RealmsServerList.java +++ b/com/mojang/realmsclient/dto/RealmsServerList.java @@ -1,12 +1,10 @@ package com.mojang.realmsclient.dto; -import com.google.common.collect.Lists; -import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonParser; import com.mojang.logging.LogUtils; -import java.util.Iterator; +import java.util.ArrayList; import java.util.List; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; @@ -19,17 +17,13 @@ public class RealmsServerList extends ValueObject { public static RealmsServerList parse(String json) { RealmsServerList realmsServerList = new RealmsServerList(); - realmsServerList.servers = Lists.newArrayList(); + realmsServerList.servers = new ArrayList(); try { - JsonParser jsonParser = new JsonParser(); - JsonObject jsonObject = jsonParser.parse(json).getAsJsonObject(); + JsonObject jsonObject = JsonParser.parseString(json).getAsJsonObject(); if (jsonObject.get("servers").isJsonArray()) { - JsonArray jsonArray = jsonObject.get("servers").getAsJsonArray(); - Iterator iterator = jsonArray.iterator(); - - while (iterator.hasNext()) { - realmsServerList.servers.add(RealmsServer.parse(((JsonElement)iterator.next()).getAsJsonObject())); + for (JsonElement jsonElement : jsonObject.get("servers").getAsJsonArray()) { + realmsServerList.servers.add(RealmsServer.parse(jsonElement.getAsJsonObject())); } } } catch (Exception var6) { diff --git a/com/mojang/blaze3d/shaders/Effect.java b/com/mojang/realmsclient/dto/RealmsSettings.java similarity index 54% rename from com/mojang/blaze3d/shaders/Effect.java rename to com/mojang/realmsclient/dto/RealmsSettings.java index 7ec2624c..9a173274 100644 --- a/com/mojang/blaze3d/shaders/Effect.java +++ b/com/mojang/realmsclient/dto/RealmsSettings.java @@ -1,8 +1,8 @@ -package com.mojang.blaze3d.shaders; +package com.mojang.realmsclient.dto; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; @Environment(EnvType.CLIENT) -public interface Effect extends Shader { +public record RealmsSettings(boolean hardcore) { } diff --git a/com/mojang/realmsclient/dto/RealmsWorldOptions.java b/com/mojang/realmsclient/dto/RealmsWorldOptions.java index 7a194505..7da362e7 100644 --- a/com/mojang/realmsclient/dto/RealmsWorldOptions.java +++ b/com/mojang/realmsclient/dto/RealmsWorldOptions.java @@ -7,19 +7,21 @@ import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.resources.language.I18n; import net.minecraft.util.StringUtil; +import net.minecraft.world.Difficulty; +import net.minecraft.world.level.GameType; +import net.minecraft.world.level.LevelSettings; import org.jetbrains.annotations.Nullable; @Environment(EnvType.CLIENT) public class RealmsWorldOptions extends ValueObject { public final boolean pvp; - public final boolean spawnAnimals; public final boolean spawnMonsters; - public final boolean spawnNPCs; public final int spawnProtection; public final boolean commandBlocks; public final boolean forceGameMode; public final int difficulty; public final int gameMode; + public final boolean hardcore; private final String slotName; public final String version; public final RealmsServer.Compatibility compatibility; @@ -29,13 +31,12 @@ public class RealmsWorldOptions extends ValueObject { public boolean empty; private static final boolean DEFAULT_FORCE_GAME_MODE = false; private static final boolean DEFAULT_PVP = true; - private static final boolean DEFAULT_SPAWN_ANIMALS = true; private static final boolean DEFAULT_SPAWN_MONSTERS = true; - private static final boolean DEFAULT_SPAWN_NPCS = true; private static final int DEFAULT_SPAWN_PROTECTION = 0; private static final boolean DEFAULT_COMMAND_BLOCKS = false; private static final int DEFAULT_DIFFICULTY = 2; private static final int DEFAULT_GAME_MODE = 0; + private static final boolean DEFAULT_HARDCORE_MODE = false; private static final String DEFAULT_SLOT_NAME = ""; private static final String DEFAULT_VERSION = ""; private static final RealmsServer.Compatibility DEFAULT_COMPATIBILITY = RealmsServer.Compatibility.UNVERIFIABLE; @@ -43,35 +44,31 @@ public class RealmsWorldOptions extends ValueObject { private static final String DEFAULT_TEMPLATE_IMAGE = null; public RealmsWorldOptions( - boolean pvp, - boolean spawnAnimals, - boolean spawnMonsters, - boolean spawnNPCs, - int spawnProtection, - boolean commandBlocks, - int difficulty, - int gameMode, - boolean forceGameMode, - String slotName, - String version, - RealmsServer.Compatibility compatibility + boolean bl, boolean bl2, int i, boolean bl3, int j, int k, boolean bl4, boolean bl5, String string, String string2, RealmsServer.Compatibility compatibility ) { - this.pvp = pvp; - this.spawnAnimals = spawnAnimals; - this.spawnMonsters = spawnMonsters; - this.spawnNPCs = spawnNPCs; - this.spawnProtection = spawnProtection; - this.commandBlocks = commandBlocks; - this.difficulty = difficulty; - this.gameMode = gameMode; - this.forceGameMode = forceGameMode; - this.slotName = slotName; - this.version = version; + this.pvp = bl; + this.spawnMonsters = bl2; + this.spawnProtection = i; + this.commandBlocks = bl3; + this.difficulty = j; + this.gameMode = k; + this.hardcore = bl4; + this.forceGameMode = bl5; + this.slotName = string; + this.version = string2; this.compatibility = compatibility; } public static RealmsWorldOptions createDefaults() { - return new RealmsWorldOptions(true, true, true, true, 0, false, 2, 0, false, "", "", DEFAULT_COMPATIBILITY); + return new RealmsWorldOptions(true, true, 0, false, 2, 0, false, false, "", "", DEFAULT_COMPATIBILITY); + } + + public static RealmsWorldOptions createDefaultsWith(GameType gameType, Difficulty difficulty, boolean bl, String string, String string2) { + return new RealmsWorldOptions(true, true, 0, false, difficulty.getId(), gameType.getId(), bl, false, string2, string, DEFAULT_COMPATIBILITY); + } + + public static RealmsWorldOptions createFromSettings(LevelSettings levelSettings, String string) { + return createDefaultsWith(levelSettings.gameType(), levelSettings.difficulty(), levelSettings.hardcore(), string, levelSettings.levelName()); } public static RealmsWorldOptions createEmptyDefaults() { @@ -84,23 +81,22 @@ public class RealmsWorldOptions extends ValueObject { this.empty = empty; } - public static RealmsWorldOptions parse(JsonObject json) { + public static RealmsWorldOptions parse(JsonObject jsonObject, RealmsSettings realmsSettings) { RealmsWorldOptions realmsWorldOptions = new RealmsWorldOptions( - JsonUtils.getBooleanOr("pvp", json, true), - JsonUtils.getBooleanOr("spawnAnimals", json, true), - JsonUtils.getBooleanOr("spawnMonsters", json, true), - JsonUtils.getBooleanOr("spawnNPCs", json, true), - JsonUtils.getIntOr("spawnProtection", json, 0), - JsonUtils.getBooleanOr("commandBlocks", json, false), - JsonUtils.getIntOr("difficulty", json, 2), - JsonUtils.getIntOr("gameMode", json, 0), - JsonUtils.getBooleanOr("forceGameMode", json, false), - JsonUtils.getRequiredStringOr("slotName", json, ""), - JsonUtils.getRequiredStringOr("version", json, ""), - RealmsServer.getCompatibility(JsonUtils.getRequiredStringOr("compatibility", json, RealmsServer.Compatibility.UNVERIFIABLE.name())) + JsonUtils.getBooleanOr("pvp", jsonObject, true), + JsonUtils.getBooleanOr("spawnMonsters", jsonObject, true), + JsonUtils.getIntOr("spawnProtection", jsonObject, 0), + JsonUtils.getBooleanOr("commandBlocks", jsonObject, false), + JsonUtils.getIntOr("difficulty", jsonObject, 2), + JsonUtils.getIntOr("gameMode", jsonObject, 0), + realmsSettings.hardcore(), + JsonUtils.getBooleanOr("forceGameMode", jsonObject, false), + JsonUtils.getRequiredStringOr("slotName", jsonObject, ""), + JsonUtils.getRequiredStringOr("version", jsonObject, ""), + RealmsServer.getCompatibility(JsonUtils.getRequiredStringOr("compatibility", jsonObject, RealmsServer.Compatibility.UNVERIFIABLE.name())) ); - realmsWorldOptions.templateId = JsonUtils.getLongOr("worldTemplateId", json, -1L); - realmsWorldOptions.templateImage = JsonUtils.getStringOr("worldTemplateImage", json, DEFAULT_TEMPLATE_IMAGE); + realmsWorldOptions.templateId = JsonUtils.getLongOr("worldTemplateId", jsonObject, -1L); + realmsWorldOptions.templateImage = JsonUtils.getStringOr("worldTemplateImage", jsonObject, DEFAULT_TEMPLATE_IMAGE); return realmsWorldOptions; } @@ -122,18 +118,10 @@ public class RealmsWorldOptions extends ValueObject { jsonObject.addProperty("pvp", this.pvp); } - if (!this.spawnAnimals) { - jsonObject.addProperty("spawnAnimals", this.spawnAnimals); - } - if (!this.spawnMonsters) { jsonObject.addProperty("spawnMonsters", this.spawnMonsters); } - if (!this.spawnNPCs) { - jsonObject.addProperty("spawnNPCs", this.spawnNPCs); - } - if (this.spawnProtection != 0) { jsonObject.addProperty("spawnProtection", this.spawnProtection); } @@ -150,6 +138,10 @@ public class RealmsWorldOptions extends ValueObject { jsonObject.addProperty("gameMode", this.gameMode); } + if (this.hardcore) { + jsonObject.addProperty("hardcore", this.hardcore); + } + if (this.forceGameMode) { jsonObject.addProperty("forceGameMode", this.forceGameMode); } @@ -172,13 +164,12 @@ public class RealmsWorldOptions extends ValueObject { public RealmsWorldOptions clone() { return new RealmsWorldOptions( this.pvp, - this.spawnAnimals, this.spawnMonsters, - this.spawnNPCs, this.spawnProtection, this.commandBlocks, this.difficulty, this.gameMode, + this.hardcore, this.forceGameMode, this.slotName, this.version, diff --git a/com/mojang/realmsclient/dto/ServerActivity.java b/com/mojang/realmsclient/dto/ServerActivity.java index 387e8e8b..867d6378 100644 --- a/com/mojang/realmsclient/dto/ServerActivity.java +++ b/com/mojang/realmsclient/dto/ServerActivity.java @@ -4,9 +4,11 @@ import com.google.gson.JsonObject; import com.mojang.realmsclient.util.JsonUtils; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; +import org.jetbrains.annotations.Nullable; @Environment(EnvType.CLIENT) public class ServerActivity extends ValueObject { + @Nullable public String profileUuid; public long joinTime; public long leaveTime; diff --git a/com/mojang/realmsclient/gui/RealmsDataFetcher.java b/com/mojang/realmsclient/gui/RealmsDataFetcher.java index 831fe422..9819f20b 100644 --- a/com/mojang/realmsclient/gui/RealmsDataFetcher.java +++ b/com/mojang/realmsclient/gui/RealmsDataFetcher.java @@ -8,6 +8,7 @@ import com.mojang.realmsclient.dto.RealmsServer; import com.mojang.realmsclient.dto.RealmsServerPlayerLists; import com.mojang.realmsclient.gui.task.DataFetcher; import com.mojang.realmsclient.gui.task.RepeatedDelayStrategy; +import com.mojang.realmsclient.gui.task.DataFetcher.Task; import com.mojang.realmsclient.util.RealmsPersistence; import java.time.Duration; import java.util.List; @@ -19,13 +20,13 @@ import net.minecraft.Util; @Environment(EnvType.CLIENT) public class RealmsDataFetcher { public final DataFetcher dataFetcher = new DataFetcher(Util.ioPool(), TimeUnit.MILLISECONDS, Util.timeSource); - private final List> tasks; - public final DataFetcher.Task> notificationsTask; - public final DataFetcher.Task serverListUpdateTask; - public final DataFetcher.Task pendingInvitesTask; - public final DataFetcher.Task trialAvailabilityTask; - public final DataFetcher.Task newsTask; - public final DataFetcher.Task onlinePlayersTask; + private final List> tasks; + public final Task> notificationsTask; + public final Task serverListUpdateTask; + public final Task pendingInvitesTask; + public final Task trialAvailabilityTask; + public final Task newsTask; + public final Task onlinePlayersTask; public final RealmsNewsManager newsManager = new RealmsNewsManager(new RealmsPersistence()); public RealmsDataFetcher(RealmsClient realmsClient) { @@ -53,7 +54,7 @@ public class RealmsDataFetcher { ); } - public List> getTasks() { + public List> getTasks() { return this.tasks; } diff --git a/com/mojang/realmsclient/gui/RealmsNewsManager.java b/com/mojang/realmsclient/gui/RealmsNewsManager.java index 67850849..3129eaf5 100644 --- a/com/mojang/realmsclient/gui/RealmsNewsManager.java +++ b/com/mojang/realmsclient/gui/RealmsNewsManager.java @@ -2,6 +2,7 @@ package com.mojang.realmsclient.gui; import com.mojang.realmsclient.dto.RealmsNews; import com.mojang.realmsclient.util.RealmsPersistence; +import com.mojang.realmsclient.util.RealmsPersistence.RealmsPersistenceData; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; @@ -13,7 +14,7 @@ public class RealmsNewsManager { public RealmsNewsManager(RealmsPersistence newsLocalStorage) { this.newsLocalStorage = newsLocalStorage; - RealmsPersistence.RealmsPersistenceData realmsPersistenceData = newsLocalStorage.read(); + RealmsPersistenceData realmsPersistenceData = newsLocalStorage.read(); this.hasUnreadNews = realmsPersistenceData.hasUnreadNews; this.newsLink = realmsPersistenceData.newsLink; } @@ -27,21 +28,20 @@ public class RealmsNewsManager { } public void updateUnreadNews(RealmsNews realmsNews) { - RealmsPersistence.RealmsPersistenceData realmsPersistenceData = this.updateNewsStorage(realmsNews); + RealmsPersistenceData realmsPersistenceData = this.updateNewsStorage(realmsNews); this.hasUnreadNews = realmsPersistenceData.hasUnreadNews; this.newsLink = realmsPersistenceData.newsLink; } - private RealmsPersistence.RealmsPersistenceData updateNewsStorage(RealmsNews realmsNews) { - RealmsPersistence.RealmsPersistenceData realmsPersistenceData = new RealmsPersistence.RealmsPersistenceData(); - realmsPersistenceData.newsLink = realmsNews.newsLink; - RealmsPersistence.RealmsPersistenceData realmsPersistenceData2 = this.newsLocalStorage.read(); - boolean bl = realmsPersistenceData.newsLink == null || realmsPersistenceData.newsLink.equals(realmsPersistenceData2.newsLink); - if (bl) { + private RealmsPersistenceData updateNewsStorage(RealmsNews realmsNews) { + RealmsPersistenceData realmsPersistenceData = this.newsLocalStorage.read(); + if (realmsNews.newsLink != null && !realmsNews.newsLink.equals(realmsPersistenceData.newsLink)) { + RealmsPersistenceData realmsPersistenceData2 = new RealmsPersistenceData(); + realmsPersistenceData2.newsLink = realmsNews.newsLink; + realmsPersistenceData2.hasUnreadNews = true; + this.newsLocalStorage.save(realmsPersistenceData2); return realmsPersistenceData2; } else { - realmsPersistenceData.hasUnreadNews = true; - this.newsLocalStorage.save(realmsPersistenceData); return realmsPersistenceData; } } diff --git a/com/mojang/realmsclient/gui/RealmsWorldSlotButton.java b/com/mojang/realmsclient/gui/RealmsWorldSlotButton.java index 2bbf58f1..cdb880fb 100644 --- a/com/mojang/realmsclient/gui/RealmsWorldSlotButton.java +++ b/com/mojang/realmsclient/gui/RealmsWorldSlotButton.java @@ -1,6 +1,5 @@ package com.mojang.realmsclient.gui; -import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.realmsclient.RealmsMainScreen; import com.mojang.realmsclient.dto.RealmsServer; import com.mojang.realmsclient.dto.RealmsWorldOptions; @@ -12,10 +11,12 @@ import net.minecraft.client.gui.Font; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.Button; import net.minecraft.client.gui.components.Tooltip; +import net.minecraft.client.renderer.RenderType; import net.minecraft.network.chat.CommonComponents; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.MutableComponent; import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.ARGB; import org.jetbrains.annotations.Nullable; @Environment(EnvType.CLIENT) @@ -30,6 +31,8 @@ public class RealmsWorldSlotButton extends Button { private static final Component SWITCH_TO_MINIGAME_SLOT_TOOLTIP = Component.translatable("mco.configure.world.slot.tooltip.minigame"); private static final Component SWITCH_TO_WORLD_SLOT_TOOLTIP = Component.translatable("mco.configure.world.slot.tooltip"); static final Component MINIGAME = Component.translatable("mco.worldSlot.minigame"); + private static final int WORLD_NAME_MAX_WIDTH = 64; + private static final String DOTS = "..."; private final int slotIndex; @Nullable private RealmsWorldSlotButton.State state; @@ -98,30 +101,35 @@ public class RealmsWorldSlotButton extends Button { resourceLocation = EMPTY_SLOT_LOCATION; } + int k = -1; if (this.state.isCurrentlyActiveSlot) { - guiGraphics.setColor(0.56F, 0.56F, 0.56F, 1.0F); + k = ARGB.colorFromFloat(1.0F, 0.56F, 0.56F, 0.56F); } - guiGraphics.blit(resourceLocation, i + 3, j + 3, 0.0F, 0.0F, 74, 74, 74, 74); - boolean bl2 = bl && this.state.action != RealmsWorldSlotButton.Action.NOTHING; - if (bl2) { - guiGraphics.setColor(1.0F, 1.0F, 1.0F, 1.0F); + guiGraphics.blit(RenderType::guiTextured, resourceLocation, i + 3, j + 3, 0.0F, 0.0F, 74, 74, 74, 74, 74, 74, k); + if (bl && this.state.action != RealmsWorldSlotButton.Action.NOTHING) { + guiGraphics.blitSprite(RenderType::guiTextured, SLOT_FRAME_SPRITE, i, j, 80, 80); } else if (this.state.isCurrentlyActiveSlot) { - guiGraphics.setColor(0.8F, 0.8F, 0.8F, 1.0F); + guiGraphics.blitSprite(RenderType::guiTextured, SLOT_FRAME_SPRITE, i, j, 80, 80, ARGB.colorFromFloat(1.0F, 0.8F, 0.8F, 0.8F)); } else { - guiGraphics.setColor(0.56F, 0.56F, 0.56F, 1.0F); + guiGraphics.blitSprite(RenderType::guiTextured, SLOT_FRAME_SPRITE, i, j, 80, 80, ARGB.colorFromFloat(1.0F, 0.56F, 0.56F, 0.56F)); } - guiGraphics.blitSprite(SLOT_FRAME_SPRITE, i, j, 80, 80); - guiGraphics.setColor(1.0F, 1.0F, 1.0F, 1.0F); if (this.state.isCurrentlyActiveSlot) { - RenderSystem.enableBlend(); - guiGraphics.blitSprite(CHECKMARK_SPRITE, i + 67, j + 4, 9, 8); - RenderSystem.disableBlend(); + guiGraphics.blitSprite(RenderType::guiTextured, CHECKMARK_SPRITE, i + 67, j + 4, 9, 8); + } + + if (this.state.hardcore) { + guiGraphics.blitSprite(RenderType::guiTextured, RealmsMainScreen.HARDCORE_MODE_SPRITE, i + 3, j + 4, 9, 8); } Font font = Minecraft.getInstance().font; - guiGraphics.drawCenteredString(font, this.state.slotName, i + 40, j + 66, -1); + String string = this.state.slotName; + if (font.width(string) > 64) { + string = font.plainSubstrByWidth(string, 64 - font.width("...")) + "..."; + } + + guiGraphics.drawCenteredString(font, string, i + 40, j + 66, -1); guiGraphics.drawCenteredString( font, RealmsMainScreen.getVersionComponent(this.state.slotVersion, this.state.compatibility.isCompatible()), i + 40, j + 80 + 2, -1 ); @@ -147,6 +155,7 @@ public class RealmsWorldSlotButton extends Button { public final boolean empty; public final boolean minigame; public final RealmsWorldSlotButton.Action action; + public final boolean hardcore; public State(RealmsServer server, int slot) { this.minigame = slot == 4; @@ -158,6 +167,7 @@ public class RealmsWorldSlotButton extends Button { this.empty = server.minigameId == -1; this.slotVersion = ""; this.compatibility = RealmsServer.Compatibility.UNVERIFIABLE; + this.hardcore = false; } else { RealmsWorldOptions realmsWorldOptions = (RealmsWorldOptions)server.slots.get(slot); this.isCurrentlyActiveSlot = server.activeSlot == slot && !server.isMinigameActive(); @@ -167,6 +177,7 @@ public class RealmsWorldSlotButton extends Button { this.empty = realmsWorldOptions.empty; this.slotVersion = realmsWorldOptions.version; this.compatibility = realmsWorldOptions.compatibility; + this.hardcore = realmsWorldOptions.hardcore; } this.action = RealmsWorldSlotButton.getAction(server, this.isCurrentlyActiveSlot, this.minigame); diff --git a/com/mojang/realmsclient/gui/RowButton.java b/com/mojang/realmsclient/gui/RowButton.java index ab39ab23..a3bb9bf7 100644 --- a/com/mojang/realmsclient/gui/RowButton.java +++ b/com/mojang/realmsclient/gui/RowButton.java @@ -4,8 +4,8 @@ import java.util.List; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.components.AbstractSelectionList; import net.minecraft.client.gui.components.ObjectSelectionList; -import net.minecraft.realms.RealmsObjectSelectionList; @Environment(EnvType.CLIENT) public abstract class RowButton { @@ -40,30 +40,28 @@ public abstract class RowButton { public abstract void onClick(int index); - public static void drawButtonsInRow( - GuiGraphics guiGraphics, List buttons, RealmsObjectSelectionList pendingInvitations, int x, int y, int mouseX, int mouseY - ) { - for (RowButton rowButton : buttons) { - if (pendingInvitations.getRowWidth() > rowButton.getRight()) { - rowButton.drawForRowAt(guiGraphics, x, y, mouseX, mouseY); + public static void drawButtonsInRow(GuiGraphics guiGraphics, List list, AbstractSelectionList abstractSelectionList, int i, int j, int k, int l) { + for (RowButton rowButton : list) { + if (abstractSelectionList.getRowWidth() > rowButton.getRight()) { + rowButton.drawForRowAt(guiGraphics, i, j, k, l); } } } public static void rowButtonMouseClicked( - RealmsObjectSelectionList list, ObjectSelectionList.Entry entry, List buttons, int button, double mouseX, double mouseY + AbstractSelectionList abstractSelectionList, ObjectSelectionList.Entry entry, List list, int i, double d, double e ) { - int i = list.children().indexOf(entry); - if (i > -1) { - list.selectItem(i); - int j = list.getRowLeft(); - int k = list.getRowTop(i); - int l = (int)(mouseX - j); - int m = (int)(mouseY - k); + int j = abstractSelectionList.children().indexOf(entry); + if (j > -1) { + abstractSelectionList.setSelectedIndex(j); + int k = abstractSelectionList.getRowLeft(); + int l = abstractSelectionList.getRowTop(j); + int m = (int)(d - k); + int n = (int)(e - l); - for (RowButton rowButton : buttons) { - if (l >= rowButton.xOffset && l <= rowButton.getRight() && m >= rowButton.yOffset && m <= rowButton.getBottom()) { - rowButton.onClick(i); + for (RowButton rowButton : list) { + if (m >= rowButton.xOffset && m <= rowButton.getRight() && n >= rowButton.yOffset && n <= rowButton.getBottom()) { + rowButton.onClick(j); } } } diff --git a/com/mojang/realmsclient/gui/screens/AddRealmPopupScreen.java b/com/mojang/realmsclient/gui/screens/AddRealmPopupScreen.java index ce9c0162..20972e8a 100644 --- a/com/mojang/realmsclient/gui/screens/AddRealmPopupScreen.java +++ b/com/mojang/realmsclient/gui/screens/AddRealmPopupScreen.java @@ -5,7 +5,6 @@ import java.util.Collection; import java.util.List; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; -import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.Button; import net.minecraft.client.gui.components.FittingMultiLineTextWidget; @@ -14,6 +13,7 @@ import net.minecraft.client.gui.components.Tooltip; import net.minecraft.client.gui.components.WidgetSprites; import net.minecraft.client.gui.screens.ConfirmLinkScreen; import net.minecraft.client.gui.screens.Screen; +import net.minecraft.client.renderer.RenderType; import net.minecraft.network.chat.Component; import net.minecraft.realms.RealmsScreen; import net.minecraft.resources.ResourceLocation; @@ -116,7 +116,9 @@ public class AddRealmPopupScreen extends RealmsScreen { int i = 8; guiGraphics.pose().pushPose(); guiGraphics.pose().translate(0.0F, 0.0F, 110.0F); - guiGraphics.blitSprite(TRIAL_AVAILABLE_SPRITE, button.getX() + button.getWidth() - 8 - 4, button.getY() + button.getHeight() / 2 - 4, 8, 8); + guiGraphics.blitSprite( + RenderType::guiTextured, TRIAL_AVAILABLE_SPRITE, button.getX() + button.getWidth() - 8 - 4, button.getY() + button.getHeight() / 2 - 4, 8, 8 + ); guiGraphics.pose().popPose(); } @@ -124,12 +126,14 @@ public class AddRealmPopupScreen extends RealmsScreen { public void renderBackground(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) { this.backgroundScreen.render(guiGraphics, -1, -1, partialTick); guiGraphics.flush(); - RenderSystem.clear(256, Minecraft.ON_OSX); + RenderSystem.clear(256); this.clearTooltipForNextRenderPass(); this.renderTransparentBackground(guiGraphics); - guiGraphics.blitSprite(BACKGROUND_SPRITE, this.left(), this.top(), 320, 172); + guiGraphics.blitSprite(RenderType::guiTextured, BACKGROUND_SPRITE, this.left(), this.top(), 320, 172); if (!carouselImages.isEmpty()) { - guiGraphics.blit((ResourceLocation)carouselImages.get(this.carouselIndex), this.left() + 10, this.top() + 10, 0, 0.0F, 0.0F, 195, 152, 195, 152); + guiGraphics.blit( + RenderType::guiTextured, (ResourceLocation)carouselImages.get(this.carouselIndex), this.left() + 10, this.top() + 10, 0.0F, 0.0F, 195, 152, 195, 152 + ); } } diff --git a/com/mojang/realmsclient/gui/screens/RealmsBackupInfoScreen.java b/com/mojang/realmsclient/gui/screens/RealmsBackupInfoScreen.java index f76cc593..d22cbd1b 100644 --- a/com/mojang/realmsclient/gui/screens/RealmsBackupInfoScreen.java +++ b/com/mojang/realmsclient/gui/screens/RealmsBackupInfoScreen.java @@ -140,11 +140,6 @@ public class RealmsBackupInfoScreen extends RealmsScreen { }; } - @Override - public boolean mouseClicked(double mouseX, double mouseY, int button) { - return true; - } - @Override public Component getNarration() { return Component.translatable("narrator.select", this.key + " " + this.value); diff --git a/com/mojang/realmsclient/gui/screens/RealmsBackupScreen.java b/com/mojang/realmsclient/gui/screens/RealmsBackupScreen.java index 09cc0211..6ce0aa22 100644 --- a/com/mojang/realmsclient/gui/screens/RealmsBackupScreen.java +++ b/com/mojang/realmsclient/gui/screens/RealmsBackupScreen.java @@ -14,6 +14,7 @@ import java.util.ArrayList; import java.util.Collections; import java.util.Date; import java.util.List; +import java.util.Objects; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.Minecraft; @@ -99,31 +100,32 @@ public class RealmsBackupScreen extends RealmsScreen { private void fetchRealmsBackups() { (new Thread("Realms-fetch-backups") { - public void run() { - RealmsClient realmsClient = RealmsClient.create(); + public void run() { + RealmsClient realmsClient = RealmsClient.create(); - try { - List list = realmsClient.backupsFor(RealmsBackupScreen.this.serverData.id).backups; - RealmsBackupScreen.this.minecraft.execute(() -> { - RealmsBackupScreen.this.backups = list; - RealmsBackupScreen.this.noBackups = RealmsBackupScreen.this.backups.isEmpty(); - if (!RealmsBackupScreen.this.noBackups && RealmsBackupScreen.this.downloadButton != null) { - RealmsBackupScreen.this.downloadButton.active = true; - } + try { + List list = realmsClient.backupsFor(RealmsBackupScreen.this.serverData.id).backups; + RealmsBackupScreen.this.minecraft + .execute( + () -> { + RealmsBackupScreen.this.backups = list; + RealmsBackupScreen.this.noBackups = RealmsBackupScreen.this.backups.isEmpty(); + if (!RealmsBackupScreen.this.noBackups && RealmsBackupScreen.this.downloadButton != null) { + RealmsBackupScreen.this.downloadButton.active = true; + } - if (RealmsBackupScreen.this.backupList != null) { - RealmsBackupScreen.this.backupList.children().clear(); - - for (Backup backup : RealmsBackupScreen.this.backups) { - RealmsBackupScreen.this.backupList.addEntry(backup); - } - } - }); - } catch (RealmsServiceException var3) { - RealmsBackupScreen.LOGGER.error("Couldn't request backups", (Throwable)var3); + if (RealmsBackupScreen.this.backupList != null) { + RealmsBackupScreen.this.backupList + .replaceEntries(RealmsBackupScreen.this.backups.stream().map(backup -> RealmsBackupScreen.this.new Entry(backup)).toList()); + } + } + ); + } catch (RealmsServiceException var3) { + RealmsBackupScreen.LOGGER.error("Couldn't request backups", (Throwable)var3); + } } - } - }).start(); + }) + .start(); } @Override @@ -144,7 +146,7 @@ public class RealmsBackupScreen extends RealmsScreen { new DownloadTask( this.serverData.id, this.slotId, - this.serverData.name + (String)Objects.requireNonNullElse(this.serverData.name, "") + " (" + ((RealmsWorldOptions)this.serverData.slots.get(this.serverData.activeSlot)).getSlotName(this.serverData.activeSlot) + ")", @@ -170,15 +172,6 @@ public class RealmsBackupScreen extends RealmsScreen { ); } - public void addEntry(Backup backup) { - this.addEntry(RealmsBackupScreen.this.new Entry(backup)); - } - - @Override - public int getMaxPosition() { - return this.getItemCount() * 36 + this.headerHeight; - } - @Override public int getRowWidth() { return 300; diff --git a/com/mojang/realmsclient/gui/screens/RealmsBrokenWorldScreen.java b/com/mojang/realmsclient/gui/screens/RealmsBrokenWorldScreen.java index 7685ebc9..dc6eff97 100644 --- a/com/mojang/realmsclient/gui/screens/RealmsBrokenWorldScreen.java +++ b/com/mojang/realmsclient/gui/screens/RealmsBrokenWorldScreen.java @@ -22,11 +22,13 @@ import net.fabricmc.api.Environment; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.Button; import net.minecraft.client.gui.screens.Screen; +import net.minecraft.client.renderer.RenderType; import net.minecraft.network.chat.CommonComponents; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.ComponentUtils; import net.minecraft.realms.RealmsScreen; import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.ARGB; import net.minecraft.util.Mth; import org.jetbrains.annotations.Nullable; import org.slf4j.Logger; @@ -254,22 +256,16 @@ public class RealmsBrokenWorldScreen extends RealmsScreen { resourceLocation = RealmsTextureManager.worldTemplate(String.valueOf(this.serverData.minigameId), this.serverData.minigameImage); } - if (!isActiveNonMinigame) { - guiGraphics.setColor(0.56F, 0.56F, 0.56F, 1.0F); - } else if (isActiveNonMinigame) { - float f = 0.9F + 0.1F * Mth.cos(this.animTick * 0.2F); - guiGraphics.setColor(f, f, f, 1.0F); - } - - guiGraphics.blit(resourceLocation, x + 3, y + 3, 0.0F, 0.0F, 74, 74, 74, 74); if (isActiveNonMinigame) { - guiGraphics.setColor(1.0F, 1.0F, 1.0F, 1.0F); + float f = 0.9F + 0.1F * Mth.cos(this.animTick * 0.2F); + guiGraphics.blit(RenderType::guiTextured, resourceLocation, x + 3, y + 3, 0.0F, 0.0F, 74, 74, 74, 74, 74, 74, ARGB.colorFromFloat(1.0F, f, f, f)); + guiGraphics.blitSprite(RenderType::guiTextured, SLOT_FRAME_SPRITE, x, y, 80, 80); } else { - guiGraphics.setColor(0.56F, 0.56F, 0.56F, 1.0F); + int i = ARGB.colorFromFloat(1.0F, 0.56F, 0.56F, 0.56F); + guiGraphics.blit(RenderType::guiTextured, resourceLocation, x + 3, y + 3, 0.0F, 0.0F, 74, 74, 74, 74, 74, 74, i); + guiGraphics.blitSprite(RenderType::guiTextured, SLOT_FRAME_SPRITE, x, y, 80, 80, i); } - guiGraphics.blitSprite(SLOT_FRAME_SPRITE, x, y, 80, 80); guiGraphics.drawCenteredString(this.font, text, x + 40, y + 66, -1); - guiGraphics.setColor(1.0F, 1.0F, 1.0F, 1.0F); } } diff --git a/com/mojang/realmsclient/gui/screens/RealmsConfigureWorldScreen.java b/com/mojang/realmsclient/gui/screens/RealmsConfigureWorldScreen.java index d1256cab..4808453b 100644 --- a/com/mojang/realmsclient/gui/screens/RealmsConfigureWorldScreen.java +++ b/com/mojang/realmsclient/gui/screens/RealmsConfigureWorldScreen.java @@ -7,6 +7,7 @@ import com.mojang.realmsclient.client.RealmsClient; import com.mojang.realmsclient.dto.RealmsServer; import com.mojang.realmsclient.dto.RealmsWorldOptions; import com.mojang.realmsclient.dto.WorldTemplate; +import com.mojang.realmsclient.dto.WorldTemplate.WorldTemplateType; import com.mojang.realmsclient.exception.RealmsServiceException; import com.mojang.realmsclient.gui.RealmsWorldSlotButton; import com.mojang.realmsclient.util.task.CloseServerTask; @@ -14,11 +15,13 @@ import com.mojang.realmsclient.util.task.OpenServerTask; import com.mojang.realmsclient.util.task.SwitchMinigameTask; import com.mojang.realmsclient.util.task.SwitchSlotTask; import java.util.List; +import java.util.Objects; import java.util.function.Supplier; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.Button; +import net.minecraft.client.renderer.RenderType; import net.minecraft.network.chat.CommonComponents; import net.minecraft.network.chat.Component; import net.minecraft.realms.RealmsScreen; @@ -216,7 +219,7 @@ public class RealmsConfigureWorldScreen extends RealmsScreen { if (this.serverData == null) { guiGraphics.drawCenteredString(this.font, this.title, this.width / 2, 17, -1); } else { - String string = this.serverData.getName(); + String string = (String)Objects.requireNonNullElse(this.serverData.getName(), ""); int i = this.font.width(string); int j = this.serverData.state == RealmsServer.State.CLOSED ? -6250336 : 8388479; int k = this.font.width(this.title); @@ -245,7 +248,7 @@ public class RealmsConfigureWorldScreen extends RealmsScreen { } } - private void fetchServerData(long serverId) { + public void fetchServerData(long serverId) { new Thread(() -> { RealmsClient realmsClient = RealmsClient.create(); @@ -365,7 +368,7 @@ public class RealmsConfigureWorldScreen extends RealmsScreen { } private void drawRealmStatus(GuiGraphics guiGraphics, int x, int y, int mouseX, int mouseY, ResourceLocation sprite, Supplier tooltipSupplier) { - guiGraphics.blitSprite(sprite, x, y, 10, 28); + guiGraphics.blitSprite(RenderType::guiTextured, sprite, x, y, 10, 28); if (mouseX >= x && mouseX <= x + 9 && mouseY >= y && mouseY <= y + 27) { this.setTooltipForNextRenderPass((Component)tooltipSupplier.get()); } @@ -402,6 +405,9 @@ public class RealmsConfigureWorldScreen extends RealmsScreen { try { realmsClient.updateSlot(this.serverData.id, this.serverData.activeSlot, worldOptions); this.serverData.slots.put(this.serverData.activeSlot, worldOptions); + if (realmsWorldOptions.gameMode != worldOptions.gameMode || realmsWorldOptions.hardcore != worldOptions.hardcore) { + RealmsMainScreen.refreshServerList(); + } } catch (RealmsServiceException var5) { LOGGER.error("Couldn't save slot settings", (Throwable)var5); this.minecraft.setScreen(new RealmsGenericErrorScreen(var5, this)); @@ -412,7 +418,7 @@ public class RealmsConfigureWorldScreen extends RealmsScreen { } public void saveSettings(String key, String value) { - String string = StringUtil.isBlank(value) ? null : value; + String string = StringUtil.isBlank(value) ? "" : value; RealmsClient realmsClient = RealmsClient.create(); try { @@ -447,7 +453,7 @@ public class RealmsConfigureWorldScreen extends RealmsScreen { } private void templateSelectionCallback(@Nullable WorldTemplate worldTemplate) { - if (worldTemplate != null && WorldTemplate.WorldTemplateType.MINIGAME == worldTemplate.type) { + if (worldTemplate != null && WorldTemplateType.MINIGAME == worldTemplate.type) { this.stateChanged(); this.minecraft .setScreen(new RealmsLongRunningMcoTaskScreen(this.lastScreen, new SwitchMinigameTask(this.serverData.id, worldTemplate, this.getNewScreen()))); diff --git a/com/mojang/realmsclient/gui/screens/RealmsCreateRealmScreen.java b/com/mojang/realmsclient/gui/screens/RealmsCreateRealmScreen.java index fc24b963..12f81820 100644 --- a/com/mojang/realmsclient/gui/screens/RealmsCreateRealmScreen.java +++ b/com/mojang/realmsclient/gui/screens/RealmsCreateRealmScreen.java @@ -1,18 +1,22 @@ package com.mojang.realmsclient.gui.screens; import com.mojang.realmsclient.RealmsMainScreen; +import com.mojang.realmsclient.client.RealmsClient; import com.mojang.realmsclient.dto.RealmsServer; -import com.mojang.realmsclient.util.task.CreateSnapshotRealmTask; +import com.mojang.realmsclient.exception.RealmsServiceException; import com.mojang.realmsclient.util.task.RealmCreationTask; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.atomic.AtomicBoolean; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; +import net.minecraft.Util; import net.minecraft.client.gui.components.AbstractWidget; import net.minecraft.client.gui.components.Button; import net.minecraft.client.gui.components.EditBox; import net.minecraft.client.gui.layouts.CommonLayouts; import net.minecraft.client.gui.layouts.HeaderAndFooterLayout; import net.minecraft.client.gui.layouts.LinearLayout; -import net.minecraft.client.gui.screens.Screen; +import net.minecraft.client.gui.screens.AlertScreen; import net.minecraft.network.chat.CommonComponents; import net.minecraft.network.chat.Component; import net.minecraft.realms.RealmsScreen; @@ -31,16 +35,10 @@ public class RealmsCreateRealmScreen extends RealmsScreen { private EditBox descriptionBox; private final Runnable createWorldRunnable; - public RealmsCreateRealmScreen(RealmsMainScreen lastScreen, RealmsServer realmsServer) { + public RealmsCreateRealmScreen(RealmsMainScreen realmsMainScreen, RealmsServer realmsServer, boolean bl) { super(CREATE_REALM_TEXT); - this.lastScreen = lastScreen; - this.createWorldRunnable = () -> this.createWorld(realmsServer); - } - - public RealmsCreateRealmScreen(RealmsMainScreen lastScreen, long parentId) { - super(CREATE_REALM_TEXT); - this.lastScreen = lastScreen; - this.createWorldRunnable = () -> this.createSnapshotWorld(parentId); + this.lastScreen = realmsMainScreen; + this.createWorldRunnable = () -> this.createWorld(realmsServer, bl); } @Override @@ -73,7 +71,46 @@ public class RealmsCreateRealmScreen extends RealmsScreen { this.layout.arrangeElements(); } - private void createWorld(RealmsServer realmsServer) { + private void createWorld(RealmsServer realmsServer, boolean bl) { + if (!realmsServer.isSnapshotRealm() && bl) { + AtomicBoolean atomicBoolean = new AtomicBoolean(); + this.minecraft.setScreen(new AlertScreen(() -> { + atomicBoolean.set(true); + this.lastScreen.resetScreen(); + this.minecraft.setScreen(this.lastScreen); + }, Component.translatable("mco.upload.preparing"), Component.empty())); + CompletableFuture.supplyAsync(() -> createSnapshotRealm(realmsServer), Util.backgroundExecutor()).thenAcceptAsync(realmsServerx -> { + if (!atomicBoolean.get()) { + this.showResetWorldScreen(realmsServerx); + } + }, this.minecraft).exceptionallyAsync(throwable -> { + this.lastScreen.resetScreen(); + Component component; + if (throwable.getCause() instanceof RealmsServiceException realmsServiceException) { + component = realmsServiceException.realmsError.errorMessage(); + } else { + component = Component.translatable("mco.errorMessage.initialize.failed"); + } + + this.minecraft.setScreen(new RealmsGenericErrorScreen(component, this.lastScreen)); + return null; + }, this.minecraft); + } else { + this.showResetWorldScreen(realmsServer); + } + } + + private static RealmsServer createSnapshotRealm(RealmsServer realmsServer) { + RealmsClient realmsClient = RealmsClient.create(); + + try { + return realmsClient.createSnapshotRealm(realmsServer.id); + } catch (RealmsServiceException var3) { + throw new RuntimeException(var3); + } + } + + private void showResetWorldScreen(RealmsServer realmsServer) { RealmCreationTask realmCreationTask = new RealmCreationTask(realmsServer.id, this.nameBox.getValue(), this.descriptionBox.getValue()); RealmsResetWorldScreen realmsResetWorldScreen = RealmsResetWorldScreen.forNewRealm( this, realmsServer, realmCreationTask, () -> this.minecraft.execute(() -> { @@ -84,25 +121,6 @@ public class RealmsCreateRealmScreen extends RealmsScreen { this.minecraft.setScreen(realmsResetWorldScreen); } - private void createSnapshotWorld(long parentId) { - Screen screen = new RealmsResetNormalWorldScreen( - worldGenerationInfo -> { - if (worldGenerationInfo == null) { - this.minecraft.setScreen(this); - } else { - this.minecraft - .setScreen( - new RealmsLongRunningMcoTaskScreen( - this, new CreateSnapshotRealmTask(this.lastScreen, parentId, worldGenerationInfo, this.nameBox.getValue(), this.descriptionBox.getValue()) - ) - ); - } - }, - CREATE_REALM_TEXT - ); - this.minecraft.setScreen(screen); - } - @Override public void onClose() { this.minecraft.setScreen(this.lastScreen); diff --git a/com/mojang/realmsclient/gui/screens/RealmsNotificationsScreen.java b/com/mojang/realmsclient/gui/screens/RealmsNotificationsScreen.java index 02715e73..1511eb4a 100644 --- a/com/mojang/realmsclient/gui/screens/RealmsNotificationsScreen.java +++ b/com/mojang/realmsclient/gui/screens/RealmsNotificationsScreen.java @@ -3,7 +3,7 @@ package com.mojang.realmsclient.gui.screens; import com.mojang.realmsclient.RealmsAvailability; import com.mojang.realmsclient.dto.RealmsNotification; import com.mojang.realmsclient.gui.RealmsDataFetcher; -import com.mojang.realmsclient.gui.task.DataFetcher; +import com.mojang.realmsclient.gui.task.DataFetcher.Subscription; import java.util.Objects; import java.util.concurrent.CompletableFuture; import net.fabricmc.api.EnvType; @@ -11,6 +11,7 @@ import net.fabricmc.api.Environment; import net.minecraft.client.GameNarrator; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.screens.TitleScreen; +import net.minecraft.client.renderer.RenderType; import net.minecraft.realms.RealmsScreen; import net.minecraft.resources.ResourceLocation; import org.jetbrains.annotations.Nullable; @@ -23,7 +24,7 @@ public class RealmsNotificationsScreen extends RealmsScreen { private static final ResourceLocation TRIAL_AVAILABLE_SPRITE = ResourceLocation.withDefaultNamespace("icon/trial_available"); private final CompletableFuture validClient = RealmsAvailability.get().thenApply(result -> result.type() == RealmsAvailability.Type.SUCCESS); @Nullable - private DataFetcher.Subscription realmsDataSubscription; + private Subscription realmsDataSubscription; @Nullable private RealmsNotificationsScreen.DataFetcherConfiguration currentConfiguration; private volatile int numberOfPendingInvites; @@ -32,8 +33,8 @@ public class RealmsNotificationsScreen extends RealmsScreen { private static boolean hasUnseenNotifications; private final RealmsNotificationsScreen.DataFetcherConfiguration showAll = new RealmsNotificationsScreen.DataFetcherConfiguration() { @Override - public DataFetcher.Subscription initDataFetcher(RealmsDataFetcher dataFetcher) { - DataFetcher.Subscription subscription = dataFetcher.dataFetcher.createSubscription(); + public Subscription initDataFetcher(RealmsDataFetcher dataFetcher) { + Subscription subscription = dataFetcher.dataFetcher.createSubscription(); RealmsNotificationsScreen.this.addNewsAndInvitesSubscriptions(dataFetcher, subscription); RealmsNotificationsScreen.this.addNotificationsSubscriptions(dataFetcher, subscription); return subscription; @@ -46,8 +47,8 @@ public class RealmsNotificationsScreen extends RealmsScreen { }; private final RealmsNotificationsScreen.DataFetcherConfiguration onlyNotifications = new RealmsNotificationsScreen.DataFetcherConfiguration() { @Override - public DataFetcher.Subscription initDataFetcher(RealmsDataFetcher dataFetcher) { - DataFetcher.Subscription subscription = dataFetcher.dataFetcher.createSubscription(); + public Subscription initDataFetcher(RealmsDataFetcher dataFetcher) { + Subscription subscription = dataFetcher.dataFetcher.createSubscription(); RealmsNotificationsScreen.this.addNotificationsSubscriptions(dataFetcher, subscription); return subscription; } @@ -130,28 +131,28 @@ public class RealmsNotificationsScreen extends RealmsScreen { int m = k + 48 + 2; int n = l - 3; if (hasUnseenNotifications) { - guiGraphics.blitSprite(UNSEEN_NOTIFICATION_SPRITE, n - 12, m + 3, 10, 10); + guiGraphics.blitSprite(RenderType::guiTextured, UNSEEN_NOTIFICATION_SPRITE, n - 12, m + 3, 10, 10); n -= 16; } if (this.currentConfiguration != null && this.currentConfiguration.showOldNotifications()) { if (hasUnreadNews) { - guiGraphics.blitSprite(NEWS_SPRITE, n - 14, m + 1, 14, 14); + guiGraphics.blitSprite(RenderType::guiTextured, NEWS_SPRITE, n - 14, m + 1, 14, 14); n -= 16; } if (i != 0) { - guiGraphics.blitSprite(INVITE_SPRITE, n - 14, m + 1, 14, 14); + guiGraphics.blitSprite(RenderType::guiTextured, INVITE_SPRITE, n - 14, m + 1, 14, 14); n -= 16; } if (trialAvailable) { - guiGraphics.blitSprite(TRIAL_AVAILABLE_SPRITE, n - 10, m + 4, 8, 8); + guiGraphics.blitSprite(RenderType::guiTextured, TRIAL_AVAILABLE_SPRITE, n - 10, m + 4, 8, 8); } } } - void addNewsAndInvitesSubscriptions(RealmsDataFetcher dataFetcher, DataFetcher.Subscription subscription) { + void addNewsAndInvitesSubscriptions(RealmsDataFetcher dataFetcher, Subscription subscription) { subscription.subscribe(dataFetcher.pendingInvitesTask, integer -> this.numberOfPendingInvites = integer); subscription.subscribe(dataFetcher.trialAvailabilityTask, boolean_ -> trialAvailable = boolean_); subscription.subscribe(dataFetcher.newsTask, realmsNews -> { @@ -160,7 +161,7 @@ public class RealmsNotificationsScreen extends RealmsScreen { }); } - void addNotificationsSubscriptions(RealmsDataFetcher dataFetcher, DataFetcher.Subscription subscription) { + void addNotificationsSubscriptions(RealmsDataFetcher dataFetcher, Subscription subscription) { subscription.subscribe(dataFetcher.notificationsTask, list -> { hasUnseenNotifications = false; @@ -175,7 +176,7 @@ public class RealmsNotificationsScreen extends RealmsScreen { @Environment(EnvType.CLIENT) interface DataFetcherConfiguration { - DataFetcher.Subscription initDataFetcher(RealmsDataFetcher dataFetcher); + Subscription initDataFetcher(RealmsDataFetcher dataFetcher); boolean showOldNotifications(); } diff --git a/com/mojang/realmsclient/gui/screens/RealmsPendingInvitesScreen.java b/com/mojang/realmsclient/gui/screens/RealmsPendingInvitesScreen.java index 196f6062..c2a1eccd 100644 --- a/com/mojang/realmsclient/gui/screens/RealmsPendingInvitesScreen.java +++ b/com/mojang/realmsclient/gui/screens/RealmsPendingInvitesScreen.java @@ -7,6 +7,8 @@ import com.mojang.realmsclient.dto.PendingInvite; import com.mojang.realmsclient.exception.RealmsServiceException; import com.mojang.realmsclient.gui.RealmsDataFetcher; import com.mojang.realmsclient.gui.RowButton; +import com.mojang.realmsclient.gui.screens.RealmsPendingInvitesScreen.Entry.AcceptRowButton; +import com.mojang.realmsclient.gui.screens.RealmsPendingInvitesScreen.Entry.RejectRowButton; import com.mojang.realmsclient.util.RealmsUtil; import java.util.Arrays; import java.util.List; @@ -14,13 +16,13 @@ import java.util.concurrent.CompletableFuture; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.Util; +import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.Button; import net.minecraft.client.gui.components.ObjectSelectionList; import net.minecraft.client.gui.screens.Screen; import net.minecraft.network.chat.CommonComponents; import net.minecraft.network.chat.Component; -import net.minecraft.realms.RealmsObjectSelectionList; import net.minecraft.realms.RealmsScreen; import net.minecraft.resources.ResourceLocation; import org.jetbrains.annotations.Nullable; @@ -48,7 +50,6 @@ public class RealmsPendingInvitesScreen extends RealmsScreen { @Nullable Component toolTip; RealmsPendingInvitesScreen.PendingInvitationSelectionList pendingInvitationSelectionList; - int selectedInvite = -1; private Button acceptButton; private Button rejectButton; @@ -69,17 +70,13 @@ public class RealmsPendingInvitesScreen extends RealmsScreen { } }, this.screenExecutor); this.addRenderableWidget(this.pendingInvitationSelectionList); - this.acceptButton = this.addRenderableWidget(Button.builder(ACCEPT_INVITE, button -> { - this.handleInvitation(this.selectedInvite, true); - this.selectedInvite = -1; - this.updateButtonStates(); - }).bounds(this.width / 2 - 174, this.height - 32, 100, 20).build()); + this.acceptButton = this.addRenderableWidget( + Button.builder(ACCEPT_INVITE, button -> this.handleInvitation(true)).bounds(this.width / 2 - 174, this.height - 32, 100, 20).build() + ); this.addRenderableWidget(Button.builder(CommonComponents.GUI_DONE, button -> this.onClose()).bounds(this.width / 2 - 50, this.height - 32, 100, 20).build()); - this.rejectButton = this.addRenderableWidget(Button.builder(REJECT_INVITE, button -> { - this.handleInvitation(this.selectedInvite, false); - this.selectedInvite = -1; - this.updateButtonStates(); - }).bounds(this.width / 2 + 74, this.height - 32, 100, 20).build()); + this.rejectButton = this.addRenderableWidget( + Button.builder(REJECT_INVITE, button -> this.handleInvitation(false)).bounds(this.width / 2 + 74, this.height - 32, 100, 20).build() + ); this.updateButtonStates(); } @@ -88,28 +85,29 @@ public class RealmsPendingInvitesScreen extends RealmsScreen { this.minecraft.setScreen(this.lastScreen); } - void handleInvitation(int index, boolean shouldAccept) { - if (index < this.pendingInvitationSelectionList.getItemCount()) { - String string = ((RealmsPendingInvitesScreen.Entry)this.pendingInvitationSelectionList.children().get(index)).pendingInvite.invitationId; + void handleInvitation(boolean bl) { + if (this.pendingInvitationSelectionList.getSelected() instanceof RealmsPendingInvitesScreen.Entry entry) { + String string = entry.pendingInvite.invitationId; CompletableFuture.supplyAsync(() -> { try { RealmsClient realmsClient = RealmsClient.create(); - if (shouldAccept) { + if (bl) { realmsClient.acceptInvitation(string); } else { realmsClient.rejectInvitation(string); } return true; - } catch (RealmsServiceException var3x) { - LOGGER.error("Couldn't handle invite", (Throwable)var3x); + } catch (RealmsServiceException var3) { + LOGGER.error("Couldn't handle invite", (Throwable)var3); return false; } }, Util.ioPool()).thenAcceptAsync(boolean_ -> { if (boolean_) { - this.pendingInvitationSelectionList.removeAtIndex(index); + this.pendingInvitationSelectionList.removeInvitation(entry); + this.updateButtonStates(); RealmsDataFetcher realmsDataFetcher = this.minecraft.realmsDataFetcher(); - if (shouldAccept) { + if (bl) { realmsDataFetcher.serverListUpdateTask.reset(); } @@ -121,25 +119,22 @@ public class RealmsPendingInvitesScreen extends RealmsScreen { @Override public void render(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) { - super.render(guiGraphics, mouseX, mouseY, partialTick); this.toolTip = null; + super.render(guiGraphics, mouseX, mouseY, partialTick); guiGraphics.drawCenteredString(this.font, this.title, this.width / 2, 12, -1); if (this.toolTip != null) { guiGraphics.renderTooltip(this.font, this.toolTip, mouseX, mouseY); } - if (this.pendingInvites.isDone() && this.pendingInvitationSelectionList.getItemCount() == 0) { + if (this.pendingInvites.isDone() && this.pendingInvitationSelectionList.hasPendingInvites()) { guiGraphics.drawCenteredString(this.font, NO_PENDING_INVITES_TEXT, this.width / 2, this.height / 2 - 20, -1); } } void updateButtonStates() { - this.acceptButton.visible = this.shouldAcceptAndRejectButtonBeVisible(this.selectedInvite); - this.rejectButton.visible = this.shouldAcceptAndRejectButtonBeVisible(this.selectedInvite); - } - - private boolean shouldAcceptAndRejectButtonBeVisible(int selectedInvite) { - return selectedInvite != -1; + RealmsPendingInvitesScreen.Entry entry = this.pendingInvitationSelectionList.getSelected(); + this.acceptButton.visible = entry != null; + this.rejectButton.visible = entry != null; } @Environment(EnvType.CLIENT) @@ -150,7 +145,7 @@ public class RealmsPendingInvitesScreen extends RealmsScreen { Entry(final PendingInvite pendingInvite) { this.pendingInvite = pendingInvite; - this.rowButtons = Arrays.asList(new RealmsPendingInvitesScreen.Entry.AcceptRowButton(), new RealmsPendingInvitesScreen.Entry.RejectRowButton()); + this.rowButtons = Arrays.asList(new AcceptRowButton(this), new RejectRowButton(this)); } @Override @@ -183,61 +178,12 @@ public class RealmsPendingInvitesScreen extends RealmsScreen { ); return Component.translatable("narrator.select", component); } - - @Environment(EnvType.CLIENT) - class AcceptRowButton extends RowButton { - AcceptRowButton() { - super(15, 15, 215, 5); - } - - @Override - protected void draw(GuiGraphics guiGraphics, int x, int y, boolean showTooltip) { - guiGraphics.blitSprite(showTooltip ? RealmsPendingInvitesScreen.ACCEPT_HIGHLIGHTED_SPRITE : RealmsPendingInvitesScreen.ACCEPT_SPRITE, x, y, 18, 18); - if (showTooltip) { - RealmsPendingInvitesScreen.this.toolTip = RealmsPendingInvitesScreen.ACCEPT_INVITE; - } - } - - @Override - public void onClick(int index) { - RealmsPendingInvitesScreen.this.handleInvitation(index, true); - } - } - - @Environment(EnvType.CLIENT) - class RejectRowButton extends RowButton { - RejectRowButton() { - super(15, 15, 235, 5); - } - - @Override - protected void draw(GuiGraphics guiGraphics, int x, int y, boolean showTooltip) { - guiGraphics.blitSprite(showTooltip ? RealmsPendingInvitesScreen.REJECT_HIGHLIGHTED_SPRITE : RealmsPendingInvitesScreen.REJECT_SPRITE, x, y, 18, 18); - if (showTooltip) { - RealmsPendingInvitesScreen.this.toolTip = RealmsPendingInvitesScreen.REJECT_INVITE; - } - } - - @Override - public void onClick(int index) { - RealmsPendingInvitesScreen.this.handleInvitation(index, false); - } - } } @Environment(EnvType.CLIENT) - class PendingInvitationSelectionList extends RealmsObjectSelectionList { + class PendingInvitationSelectionList extends ObjectSelectionList { public PendingInvitationSelectionList() { - super(RealmsPendingInvitesScreen.this.width, RealmsPendingInvitesScreen.this.height - 72, 32, 36); - } - - public void removeAtIndex(int index) { - this.remove(index); - } - - @Override - public int getMaxPosition() { - return this.getItemCount() * 36; + super(Minecraft.getInstance(), RealmsPendingInvitesScreen.this.width, RealmsPendingInvitesScreen.this.height - 72, 32, 36); } @Override @@ -246,20 +192,17 @@ public class RealmsPendingInvitesScreen extends RealmsScreen { } @Override - public void selectItem(int index) { - super.selectItem(index); - this.selectInviteListItem(index); - } - - public void selectInviteListItem(int index) { - RealmsPendingInvitesScreen.this.selectedInvite = index; + public void setSelectedIndex(int i) { + super.setSelectedIndex(i); RealmsPendingInvitesScreen.this.updateButtonStates(); } - public void setSelected(@Nullable RealmsPendingInvitesScreen.Entry selected) { - super.setSelected(selected); - RealmsPendingInvitesScreen.this.selectedInvite = this.children().indexOf(selected); - RealmsPendingInvitesScreen.this.updateButtonStates(); + public boolean hasPendingInvites() { + return this.getItemCount() == 0; + } + + public void removeInvitation(RealmsPendingInvitesScreen.Entry entry) { + this.removeEntry(entry); } } } diff --git a/com/mojang/realmsclient/gui/screens/RealmsPlayerScreen.java b/com/mojang/realmsclient/gui/screens/RealmsPlayerScreen.java index 4adba735..72d1e9b4 100644 --- a/com/mojang/realmsclient/gui/screens/RealmsPlayerScreen.java +++ b/com/mojang/realmsclient/gui/screens/RealmsPlayerScreen.java @@ -274,11 +274,6 @@ public class RealmsPlayerScreen extends RealmsScreen { guiGraphics.drawString(RealmsPlayerScreen.this.font, component, x + this.getRowWidth() / 2 - RealmsPlayerScreen.this.font.width(component) / 2, y, -1, false); } - @Override - public int getMaxPosition() { - return this.getItemCount() * this.itemHeight + this.headerHeight; - } - @Override public int getRowWidth() { return 300; diff --git a/com/mojang/realmsclient/gui/screens/RealmsResetNormalWorldScreen.java b/com/mojang/realmsclient/gui/screens/RealmsResetNormalWorldScreen.java deleted file mode 100644 index 4386dc94..00000000 --- a/com/mojang/realmsclient/gui/screens/RealmsResetNormalWorldScreen.java +++ /dev/null @@ -1,113 +0,0 @@ -package com.mojang.realmsclient.gui.screens; - -import com.mojang.realmsclient.util.LevelType; -import com.mojang.realmsclient.util.WorldGenerationInfo; -import java.util.HashSet; -import java.util.Set; -import java.util.function.Consumer; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.client.gui.components.AbstractWidget; -import net.minecraft.client.gui.components.Button; -import net.minecraft.client.gui.components.CycleButton; -import net.minecraft.client.gui.components.EditBox; -import net.minecraft.client.gui.layouts.CommonLayouts; -import net.minecraft.client.gui.layouts.HeaderAndFooterLayout; -import net.minecraft.client.gui.layouts.LinearLayout; -import net.minecraft.client.gui.screens.worldselection.ExperimentsScreen; -import net.minecraft.network.chat.CommonComponents; -import net.minecraft.network.chat.Component; -import net.minecraft.realms.RealmsScreen; -import net.minecraft.server.packs.repository.Pack; -import net.minecraft.server.packs.repository.PackRepository; -import net.minecraft.server.packs.repository.PackSource; -import net.minecraft.server.packs.repository.ServerPacksSource; - -@Environment(EnvType.CLIENT) -public class RealmsResetNormalWorldScreen extends RealmsScreen { - private static final Component SEED_LABEL = Component.translatable("mco.reset.world.seed"); - public static final Component TITLE = Component.translatable("mco.reset.world.generate"); - private static final int BUTTON_SPACING = 10; - private static final int CONTENT_WIDTH = 210; - private final HeaderAndFooterLayout layout = new HeaderAndFooterLayout(this); - private final Consumer callback; - private EditBox seedEdit; - private LevelType levelType = LevelType.DEFAULT; - private boolean generateStructures = true; - private final Set experiments = new HashSet(); - private final Component buttonTitle; - - public RealmsResetNormalWorldScreen(Consumer callback, Component buttonTitle) { - super(TITLE); - this.callback = callback; - this.buttonTitle = buttonTitle; - } - - @Override - public void init() { - this.seedEdit = new EditBox(this.font, 210, 20, Component.translatable("mco.reset.world.seed")); - this.seedEdit.setMaxLength(32); - this.layout.addTitleHeader(this.title, this.font); - LinearLayout linearLayout = this.layout.addToContents(LinearLayout.vertical()).spacing(10); - linearLayout.addChild(CommonLayouts.labeledElement(this.font, this.seedEdit, SEED_LABEL)); - linearLayout.addChild( - CycleButton.builder(LevelType::getName) - .withValues(LevelType.values()) - .withInitialValue(this.levelType) - .create(0, 0, 210, 20, Component.translatable("selectWorld.mapType"), (cycleButton, levelType) -> this.levelType = levelType) - ); - linearLayout.addChild( - CycleButton.onOffBuilder(this.generateStructures) - .create(0, 0, 210, 20, Component.translatable("selectWorld.mapFeatures"), (cycleButton, boolean_) -> this.generateStructures = boolean_) - ); - this.createExperimentsButton(linearLayout); - LinearLayout linearLayout2 = this.layout.addToFooter(LinearLayout.horizontal().spacing(10)); - linearLayout2.addChild(Button.builder(this.buttonTitle, button -> this.callback.accept(this.createWorldGenerationInfo())).build()); - linearLayout2.addChild(Button.builder(CommonComponents.GUI_BACK, button -> this.onClose()).build()); - this.layout.visitWidgets(guiEventListener -> { - AbstractWidget var10000 = this.addRenderableWidget(guiEventListener); - }); - this.repositionElements(); - } - - @Override - protected void setInitialFocus() { - this.setInitialFocus(this.seedEdit); - } - - private void createExperimentsButton(LinearLayout layout) { - PackRepository packRepository = ServerPacksSource.createVanillaTrustedRepository(); - packRepository.reload(); - layout.addChild( - Button.builder( - Component.translatable("selectWorld.experiments"), button -> this.minecraft.setScreen(new ExperimentsScreen(this, packRepository, packRepositoryxx -> { - this.experiments.clear(); - - for (Pack pack : packRepositoryxx.getSelectedPacks()) { - if (pack.getPackSource() == PackSource.FEATURE) { - this.experiments.add(pack.getId()); - } - } - - this.minecraft.setScreen(this); - })) - ) - .width(210) - .build() - ); - } - - private WorldGenerationInfo createWorldGenerationInfo() { - return new WorldGenerationInfo(this.seedEdit.getValue(), this.levelType, this.generateStructures, this.experiments); - } - - @Override - protected void repositionElements() { - this.layout.arrangeElements(); - } - - @Override - public void onClose() { - this.callback.accept(null); - } -} diff --git a/com/mojang/realmsclient/gui/screens/RealmsResetWorldScreen.java b/com/mojang/realmsclient/gui/screens/RealmsResetWorldScreen.java index ec0b1a16..8f8ac4f9 100644 --- a/com/mojang/realmsclient/gui/screens/RealmsResetWorldScreen.java +++ b/com/mojang/realmsclient/gui/screens/RealmsResetWorldScreen.java @@ -1,15 +1,15 @@ package com.mojang.realmsclient.gui.screens; import com.mojang.logging.LogUtils; +import com.mojang.realmsclient.RealmsMainScreen; import com.mojang.realmsclient.client.RealmsClient; +import com.mojang.realmsclient.client.worldupload.RealmsCreateWorldFlow; import com.mojang.realmsclient.dto.RealmsServer; import com.mojang.realmsclient.dto.WorldTemplate; import com.mojang.realmsclient.dto.WorldTemplatePaginatedList; import com.mojang.realmsclient.exception.RealmsServiceException; -import com.mojang.realmsclient.util.WorldGenerationInfo; import com.mojang.realmsclient.util.task.LongRunningTask; import com.mojang.realmsclient.util.task.RealmCreationTask; -import com.mojang.realmsclient.util.task.ResettingGeneratedWorldTask; import com.mojang.realmsclient.util.task.ResettingTemplateWorldTask; import com.mojang.realmsclient.util.task.SwitchSlotTask; import java.util.ArrayList; @@ -26,11 +26,14 @@ import net.minecraft.client.gui.layouts.HeaderAndFooterLayout; import net.minecraft.client.gui.layouts.LayoutSettings; import net.minecraft.client.gui.layouts.LinearLayout; import net.minecraft.client.gui.layouts.SpacerElement; +import net.minecraft.client.gui.layouts.GridLayout.RowHelper; import net.minecraft.client.gui.screens.Screen; +import net.minecraft.client.renderer.RenderType; import net.minecraft.network.chat.CommonComponents; import net.minecraft.network.chat.Component; import net.minecraft.realms.RealmsScreen; import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.ARGB; import org.jetbrains.annotations.Nullable; import org.slf4j.Logger; @@ -41,6 +44,7 @@ public class RealmsResetWorldScreen extends RealmsScreen { private static final Component CREATE_REALM_SUBTITLE = Component.translatable("mco.selectServer.create.subtitle"); private static final Component CREATE_WORLD_TITLE = Component.translatable("mco.configure.world.switch.slot"); private static final Component CREATE_WORLD_SUBTITLE = Component.translatable("mco.configure.world.switch.slot.subtitle"); + private static final Component GENERATE_NEW_WORLD = Component.translatable("mco.reset.world.generate"); private static final Component RESET_WORLD_TITLE = Component.translatable("mco.reset.world.title"); private static final Component RESET_WORLD_SUBTITLE = Component.translatable("mco.reset.world.warning"); public static final Component CREATE_WORLD_RESET_TASK_TITLE = Component.translatable("mco.create.world.reset.title"); @@ -158,14 +162,14 @@ public class RealmsResetWorldScreen extends RealmsScreen { } }).start(); GridLayout gridLayout = this.layout.addToContents(new GridLayout()); - GridLayout.RowHelper rowHelper = gridLayout.createRowHelper(3); + RowHelper rowHelper = gridLayout.createRowHelper(3); rowHelper.defaultCellSetting().paddingHorizontal(16); rowHelper.addChild( new RealmsResetWorldScreen.FrameButton( this.minecraft.font, - RealmsResetNormalWorldScreen.TITLE, + GENERATE_NEW_WORLD, NEW_WORLD_LOCATION, - button -> this.minecraft.setScreen(new RealmsResetNormalWorldScreen(this::generationSelectionCallback, this.title)) + button -> RealmsCreateWorldFlow.createWorld(this.minecraft, this.lastScreen, this, this.slot, this.serverData, this.realmCreationTask) ) ); rowHelper.addChild( @@ -240,13 +244,8 @@ public class RealmsResetWorldScreen extends RealmsScreen { if (template != null) { this.runResetTasks(new ResettingTemplateWorldTask(template, this.serverData.id, this.resetTaskTitle, this.resetWorldRunnable)); } - } - private void generationSelectionCallback(@Nullable WorldGenerationInfo generationInfo) { - this.minecraft.setScreen(this); - if (generationInfo != null) { - this.runResetTasks(new ResettingGeneratedWorldTask(generationInfo, this.serverData.id, this.resetTaskTitle, this.resetWorldRunnable)); - } + RealmsMainScreen.refreshServerList(); } private void runResetTasks(LongRunningTask task) { @@ -279,17 +278,17 @@ public class RealmsResetWorldScreen extends RealmsScreen { @Override public void renderWidget(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) { boolean bl = this.isHoveredOrFocused(); + int i = -1; if (bl) { - guiGraphics.setColor(0.56F, 0.56F, 0.56F, 1.0F); + i = ARGB.colorFromFloat(1.0F, 0.56F, 0.56F, 0.56F); } - int i = this.getX(); - int j = this.getY(); - guiGraphics.blit(this.image, i + 2, j + 2, 0.0F, 0.0F, 56, 56, 56, 56); - guiGraphics.blitSprite(SLOT_FRAME_SPRITE, i, j, 60, 60); - guiGraphics.setColor(1.0F, 1.0F, 1.0F, 1.0F); - int k = bl ? -6250336 : -1; - guiGraphics.drawCenteredString(RealmsResetWorldScreen.this.font, this.getMessage(), i + 28, j - 14, k); + int j = this.getX(); + int k = this.getY(); + guiGraphics.blit(RenderType::guiTextured, this.image, j + 2, k + 2, 0.0F, 0.0F, 56, 56, 56, 56, 56, 56, i); + guiGraphics.blitSprite(RenderType::guiTextured, SLOT_FRAME_SPRITE, j, k, 60, 60, i); + int l = bl ? -6250336 : -1; + guiGraphics.drawCenteredString(RealmsResetWorldScreen.this.font, this.getMessage(), j + 28, k - 14, l); } } } diff --git a/com/mojang/realmsclient/gui/screens/RealmsSelectFileToUploadScreen.java b/com/mojang/realmsclient/gui/screens/RealmsSelectFileToUploadScreen.java index aa159cb0..3f140346 100644 --- a/com/mojang/realmsclient/gui/screens/RealmsSelectFileToUploadScreen.java +++ b/com/mojang/realmsclient/gui/screens/RealmsSelectFileToUploadScreen.java @@ -10,13 +10,13 @@ import java.util.List; import java.util.stream.Collectors; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; +import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.Button; import net.minecraft.client.gui.components.ObjectSelectionList; import net.minecraft.network.chat.CommonComponents; import net.minecraft.network.chat.Component; import net.minecraft.realms.RealmsLabel; -import net.minecraft.realms.RealmsObjectSelectionList; import net.minecraft.realms.RealmsScreen; import net.minecraft.world.level.storage.LevelStorageSource; import net.minecraft.world.level.storage.LevelSummary; @@ -144,7 +144,7 @@ public class RealmsSelectFileToUploadScreen extends RealmsScreen { @Override public boolean mouseClicked(double mouseX, double mouseY, int button) { - RealmsSelectFileToUploadScreen.this.worldSelectionList.selectItem(RealmsSelectFileToUploadScreen.this.levelList.indexOf(this.levelSummary)); + RealmsSelectFileToUploadScreen.this.worldSelectionList.setSelectedIndex(RealmsSelectFileToUploadScreen.this.levelList.indexOf(this.levelSummary)); return super.mouseClicked(mouseX, mouseY, button); } @@ -173,9 +173,10 @@ public class RealmsSelectFileToUploadScreen extends RealmsScreen { } @Environment(EnvType.CLIENT) - class WorldSelectionList extends RealmsObjectSelectionList { + class WorldSelectionList extends ObjectSelectionList { public WorldSelectionList() { super( + Minecraft.getInstance(), RealmsSelectFileToUploadScreen.this.width, RealmsSelectFileToUploadScreen.this.height - 40 - RealmsSelectFileToUploadScreen.row(0), RealmsSelectFileToUploadScreen.row(0), @@ -187,11 +188,6 @@ public class RealmsSelectFileToUploadScreen extends RealmsScreen { this.addEntry(RealmsSelectFileToUploadScreen.this.new Entry(levelSummary)); } - @Override - public int getMaxPosition() { - return RealmsSelectFileToUploadScreen.this.levelList.size() * 36; - } - public void setSelected(@Nullable RealmsSelectFileToUploadScreen.Entry selected) { super.setSelected(selected); RealmsSelectFileToUploadScreen.this.selectedWorld = this.children().indexOf(selected); @@ -199,5 +195,10 @@ public class RealmsSelectFileToUploadScreen extends RealmsScreen { && RealmsSelectFileToUploadScreen.this.selectedWorld < this.getItemCount() && !((LevelSummary)RealmsSelectFileToUploadScreen.this.levelList.get(RealmsSelectFileToUploadScreen.this.selectedWorld)).isHardcore(); } + + @Override + public int getRowWidth() { + return (int)(this.width * 0.6); + } } } diff --git a/com/mojang/realmsclient/gui/screens/RealmsSelectWorldTemplateScreen.java b/com/mojang/realmsclient/gui/screens/RealmsSelectWorldTemplateScreen.java index 59eb3244..40f6474d 100644 --- a/com/mojang/realmsclient/gui/screens/RealmsSelectWorldTemplateScreen.java +++ b/com/mojang/realmsclient/gui/screens/RealmsSelectWorldTemplateScreen.java @@ -10,6 +10,8 @@ import com.mojang.realmsclient.dto.WorldTemplatePaginatedList; import com.mojang.realmsclient.exception.RealmsServiceException; import com.mojang.realmsclient.util.RealmsTextureManager; import com.mojang.realmsclient.util.TextRenderingUtils; +import com.mojang.realmsclient.util.TextRenderingUtils.Line; +import com.mojang.realmsclient.util.TextRenderingUtils.LineSegment; import java.util.Arrays; import java.util.Collections; import java.util.List; @@ -18,6 +20,7 @@ import java.util.stream.Collectors; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.Util; +import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.AbstractWidget; import net.minecraft.client.gui.components.Button; @@ -28,10 +31,10 @@ import net.minecraft.client.gui.components.WidgetSprites; import net.minecraft.client.gui.layouts.HeaderAndFooterLayout; import net.minecraft.client.gui.layouts.LinearLayout; import net.minecraft.client.gui.screens.ConfirmLinkScreen; +import net.minecraft.client.renderer.RenderType; import net.minecraft.client.resources.language.I18n; import net.minecraft.network.chat.CommonComponents; import net.minecraft.network.chat.Component; -import net.minecraft.realms.RealmsObjectSelectionList; import net.minecraft.realms.RealmsScreen; import net.minecraft.resources.ResourceLocation; import net.minecraft.util.CommonLinks; @@ -61,7 +64,7 @@ public class RealmsSelectWorldTemplateScreen extends RealmsScreen { @Nullable private Component[] warning; @Nullable - List noTemplatesMessage; + List noTemplatesMessage; public RealmsSelectWorldTemplateScreen(Component title, Consumer callback, RealmsServer.WorldType worldType) { this(title, callback, worldType, null); @@ -151,50 +154,43 @@ public class RealmsSelectWorldTemplateScreen extends RealmsScreen { private void fetchTemplatesAsync(WorldTemplatePaginatedList output) { (new Thread("realms-template-fetcher") { - public void run() { - WorldTemplatePaginatedList worldTemplatePaginatedList = output; - RealmsClient realmsClient = RealmsClient.create(); + public void run() { + WorldTemplatePaginatedList worldTemplatePaginatedList = output; + RealmsClient realmsClient = RealmsClient.create(); - while (worldTemplatePaginatedList != null) { - Either either = RealmsSelectWorldTemplateScreen.this.fetchTemplates(worldTemplatePaginatedList, realmsClient); - worldTemplatePaginatedList = (WorldTemplatePaginatedList)RealmsSelectWorldTemplateScreen.this.minecraft - .submit( - () -> { - if (either.right().isPresent()) { - RealmsSelectWorldTemplateScreen.LOGGER.error("Couldn't fetch templates", (Throwable)either.right().get()); - if (RealmsSelectWorldTemplateScreen.this.worldTemplateList.isEmpty()) { - RealmsSelectWorldTemplateScreen.this.noTemplatesMessage = TextRenderingUtils.decompose(I18n.get("mco.template.select.failure")); - } + while (worldTemplatePaginatedList != null) { + Either either = RealmsSelectWorldTemplateScreen.this.fetchTemplates(worldTemplatePaginatedList, realmsClient); + worldTemplatePaginatedList = (WorldTemplatePaginatedList)RealmsSelectWorldTemplateScreen.this.minecraft.submit(() -> { + if (either.right().isPresent()) { + RealmsSelectWorldTemplateScreen.LOGGER.error("Couldn't fetch templates", (Throwable)either.right().get()); + if (RealmsSelectWorldTemplateScreen.this.worldTemplateList.isEmpty()) { + RealmsSelectWorldTemplateScreen.this.noTemplatesMessage = TextRenderingUtils.decompose(I18n.get("mco.template.select.failure")); + } - return null; - } else { - WorldTemplatePaginatedList worldTemplatePaginatedListx = (WorldTemplatePaginatedList)either.left().get(); + return null; + } else { + WorldTemplatePaginatedList worldTemplatePaginatedListx = (WorldTemplatePaginatedList)either.left().get(); - for (WorldTemplate worldTemplate : worldTemplatePaginatedListx.templates) { - RealmsSelectWorldTemplateScreen.this.worldTemplateList.addEntry(worldTemplate); - } + for (WorldTemplate worldTemplate : worldTemplatePaginatedListx.templates) { + RealmsSelectWorldTemplateScreen.this.worldTemplateList.addEntry(worldTemplate); + } - if (worldTemplatePaginatedListx.templates.isEmpty()) { - if (RealmsSelectWorldTemplateScreen.this.worldTemplateList.isEmpty()) { - String string = I18n.get("mco.template.select.none", "%link"); - TextRenderingUtils.LineSegment lineSegment = TextRenderingUtils.LineSegment.link( - I18n.get("mco.template.select.none.linkTitle"), CommonLinks.REALMS_CONTENT_CREATION.toString() - ); - RealmsSelectWorldTemplateScreen.this.noTemplatesMessage = TextRenderingUtils.decompose(string, lineSegment); - } - - return null; - } else { - return worldTemplatePaginatedListx; - } - } + if (worldTemplatePaginatedListx.templates.isEmpty()) { + if (RealmsSelectWorldTemplateScreen.this.worldTemplateList.isEmpty()) { + String string = I18n.get("mco.template.select.none", "%link"); + LineSegment lineSegment = LineSegment.link(I18n.get("mco.template.select.none.linkTitle"), CommonLinks.REALMS_CONTENT_CREATION.toString()); + RealmsSelectWorldTemplateScreen.this.noTemplatesMessage = TextRenderingUtils.decompose(string, lineSegment); } - ) - .join(); - } + + return null; + } else { + return worldTemplatePaginatedListx; + } + } + }).join(); } - }) - .start(); + } + }).start(); } Either fetchTemplates(WorldTemplatePaginatedList templates, RealmsClient realmsClient) { @@ -221,14 +217,14 @@ public class RealmsSelectWorldTemplateScreen extends RealmsScreen { } } - private void renderMultilineMessage(GuiGraphics guiGraphics, int x, int y, List lines) { + private void renderMultilineMessage(GuiGraphics guiGraphics, int x, int y, List lines) { for (int i = 0; i < lines.size(); i++) { - TextRenderingUtils.Line line = (TextRenderingUtils.Line)lines.get(i); + Line line = (Line)lines.get(i); int j = row(4 + i); int k = line.segments.stream().mapToInt(lineSegmentx -> this.font.width(lineSegmentx.renderedText())).sum(); int l = this.width / 2 - k / 2; - for (TextRenderingUtils.LineSegment lineSegment : line.segments) { + for (LineSegment lineSegment : line.segments) { int m = lineSegment.isLink() ? 3368635 : -1; int n = guiGraphics.drawString(this.font, lineSegment.renderedText(), l, j, m); if (lineSegment.isLink() && x > l && x < n && y > j - 3 && y < j + 8) { @@ -301,8 +297,10 @@ public class RealmsSelectWorldTemplateScreen extends RealmsScreen { @Override public void render(GuiGraphics guiGraphics, int index, int top, int left, int width, int height, int mouseX, int mouseY, boolean hovering, float partialTick) { - guiGraphics.blit(RealmsTextureManager.worldTemplate(this.template.id, this.template.image), left + 1, top + 1 + 1, 0.0F, 0.0F, 38, 38, 38, 38); - guiGraphics.blitSprite(RealmsSelectWorldTemplateScreen.SLOT_FRAME_SPRITE, left, top + 1, 40, 40); + guiGraphics.blit( + RenderType::guiTextured, RealmsTextureManager.worldTemplate(this.template.id, this.template.image), left + 1, top + 1 + 1, 0.0F, 0.0F, 38, 38, 38, 38 + ); + guiGraphics.blitSprite(RenderType::guiTextured, RealmsSelectWorldTemplateScreen.SLOT_FRAME_SPRITE, left, top + 1, 40, 40); int i = 5; int j = RealmsSelectWorldTemplateScreen.this.font.width(this.template.version); if (this.websiteButton != null) { @@ -338,13 +336,14 @@ public class RealmsSelectWorldTemplateScreen extends RealmsScreen { } @Environment(EnvType.CLIENT) - class WorldTemplateList extends RealmsObjectSelectionList { + class WorldTemplateList extends ObjectSelectionList { public WorldTemplateList() { this(Collections.emptyList()); } public WorldTemplateList(final Iterable templates) { super( + Minecraft.getInstance(), RealmsSelectWorldTemplateScreen.this.width, RealmsSelectWorldTemplateScreen.this.height - 33 - RealmsSelectWorldTemplateScreen.this.getHeaderHeight(), RealmsSelectWorldTemplateScreen.this.getHeaderHeight(), @@ -373,11 +372,6 @@ public class RealmsSelectWorldTemplateScreen extends RealmsScreen { RealmsSelectWorldTemplateScreen.this.updateButtonStates(); } - @Override - public int getMaxPosition() { - return this.getItemCount() * 46; - } - @Override public int getRowWidth() { return 300; diff --git a/com/mojang/realmsclient/gui/screens/RealmsSettingsScreen.java b/com/mojang/realmsclient/gui/screens/RealmsSettingsScreen.java index 976b9a76..6fb5e55a 100644 --- a/com/mojang/realmsclient/gui/screens/RealmsSettingsScreen.java +++ b/com/mojang/realmsclient/gui/screens/RealmsSettingsScreen.java @@ -1,6 +1,7 @@ package com.mojang.realmsclient.gui.screens; import com.mojang.realmsclient.dto.RealmsServer; +import java.util.Objects; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.gui.GuiGraphics; @@ -51,7 +52,7 @@ public class RealmsSettingsScreen extends RealmsScreen { this.addRenderableWidget(button); this.nameEdit = new EditBox(this.minecraft.font, i, row(4), 212, 20, Component.translatable("mco.configure.world.name")); this.nameEdit.setMaxLength(32); - this.nameEdit.setValue(this.serverData.getName()); + this.nameEdit.setValue((String)Objects.requireNonNullElse(this.serverData.getName(), "")); this.addRenderableWidget(this.nameEdit); this.descEdit = new EditBox(this.minecraft.font, i, row(8), 212, 20, Component.translatable("mco.configure.world.description")); this.descEdit.setMaxLength(32); diff --git a/com/mojang/realmsclient/gui/screens/RealmsSlotOptionsScreen.java b/com/mojang/realmsclient/gui/screens/RealmsSlotOptionsScreen.java index 631bbf31..edc8c348 100644 --- a/com/mojang/realmsclient/gui/screens/RealmsSlotOptionsScreen.java +++ b/com/mojang/realmsclient/gui/screens/RealmsSlotOptionsScreen.java @@ -39,8 +39,6 @@ public class RealmsSlotOptionsScreen extends RealmsScreen { private final String defaultSlotName; private String worldName; private boolean pvp; - private boolean spawnNPCs; - private boolean spawnAnimals; private boolean spawnMonsters; int spawnProtection; private boolean commandBlocks; @@ -60,17 +58,13 @@ public class RealmsSlotOptionsScreen extends RealmsScreen { this.pvp = options.pvp; this.spawnProtection = options.spawnProtection; this.forceGameMode = options.forceGameMode; - this.spawnAnimals = options.spawnAnimals; this.spawnMonsters = options.spawnMonsters; - this.spawnNPCs = options.spawnNPCs; this.commandBlocks = options.commandBlocks; } else { this.pvp = true; this.spawnProtection = 0; this.forceGameMode = false; - this.spawnAnimals = true; this.spawnMonsters = true; - this.spawnNPCs = true; this.commandBlocks = true; } } @@ -127,19 +121,11 @@ public class RealmsSlotOptionsScreen extends RealmsScreen { .withInitialValue(this.gameMode) .create(this.column1X, row(3), this.columnWidth, 20, Component.translatable("selectWorld.gameMode"), (cycleButtonx, gameType) -> this.gameMode = gameType) ); - Component component2 = Component.translatable("mco.configure.world.spawn_toggle.message"); - CycleButton cycleButton2 = this.addRenderableWidget( - CycleButton.onOffBuilder(this.spawnAnimals) - .create( - i, - row(3), - this.columnWidth, - 20, - Component.translatable("mco.configure.world.spawnAnimals"), - this.confirmDangerousOption(component2, boolean_ -> this.spawnAnimals = boolean_) - ) + this.spawnProtectionButton = this.addRenderableWidget( + new RealmsSlotOptionsScreen.SettingsSlider(i, row(3), this.columnWidth, this.spawnProtection, 0.0F, 16.0F) ); - CycleButton cycleButton3 = CycleButton.onOffBuilder(this.difficulty != Difficulty.PEACEFUL && this.spawnMonsters) + Component component2 = Component.translatable("mco.configure.world.spawn_toggle.message"); + CycleButton cycleButton2 = CycleButton.onOffBuilder(this.difficulty != Difficulty.PEACEFUL && this.spawnMonsters) .create( i, row(5), @@ -156,55 +142,39 @@ public class RealmsSlotOptionsScreen extends RealmsScreen { this.difficulty = difficulty; if (this.worldType == RealmsServer.WorldType.NORMAL) { boolean bl = this.difficulty != Difficulty.PEACEFUL; - cycleButton3.active = bl; - cycleButton3.setValue(bl && this.spawnMonsters); + cycleButton2.active = bl; + cycleButton2.setValue(bl && this.spawnMonsters); } }) ); - this.addRenderableWidget(cycleButton3); - this.spawnProtectionButton = this.addRenderableWidget( - new RealmsSlotOptionsScreen.SettingsSlider(this.column1X, row(7), this.columnWidth, this.spawnProtection, 0.0F, 16.0F) - ); - CycleButton cycleButton4 = this.addRenderableWidget( - CycleButton.onOffBuilder(this.spawnNPCs) - .create( - i, - row(7), - this.columnWidth, - 20, - Component.translatable("mco.configure.world.spawnNPCs"), - this.confirmDangerousOption(Component.translatable("mco.configure.world.spawn_toggle.message.npc"), boolean_ -> this.spawnNPCs = boolean_) - ) - ); - CycleButton cycleButton5 = this.addRenderableWidget( + this.addRenderableWidget(cycleButton2); + CycleButton cycleButton3 = this.addRenderableWidget( CycleButton.onOffBuilder(this.forceGameMode) .create( this.column1X, - row(9), + row(7), this.columnWidth, 20, Component.translatable("mco.configure.world.forceGameMode"), (cycleButtonx, boolean_) -> this.forceGameMode = boolean_ ) ); - CycleButton cycleButton6 = this.addRenderableWidget( + CycleButton cycleButton4 = this.addRenderableWidget( CycleButton.onOffBuilder(this.commandBlocks) .create( - i, row(9), this.columnWidth, 20, Component.translatable("mco.configure.world.commandBlocks"), (cycleButtonx, boolean_) -> this.commandBlocks = boolean_ + i, row(7), this.columnWidth, 20, Component.translatable("mco.configure.world.commandBlocks"), (cycleButtonx, boolean_) -> this.commandBlocks = boolean_ ) ); if (this.worldType != RealmsServer.WorldType.NORMAL) { cycleButton.active = false; cycleButton2.active = false; + this.spawnProtectionButton.active = false; cycleButton4.active = false; cycleButton3.active = false; - this.spawnProtectionButton.active = false; - cycleButton6.active = false; - cycleButton5.active = false; } if (this.difficulty == Difficulty.PEACEFUL) { - cycleButton3.active = false; + cycleButton2.active = false; } this.addRenderableWidget( @@ -260,13 +230,12 @@ public class RealmsSlotOptionsScreen extends RealmsScreen { .saveSlotSettings( new RealmsWorldOptions( this.pvp, - this.spawnAnimals, bl, - this.spawnNPCs, this.spawnProtection, this.commandBlocks, i, j, + this.options.hardcore, this.forceGameMode, this.worldName, this.options.version, @@ -278,13 +247,12 @@ public class RealmsSlotOptionsScreen extends RealmsScreen { .saveSlotSettings( new RealmsWorldOptions( this.options.pvp, - this.options.spawnAnimals, this.options.spawnMonsters, - this.options.spawnNPCs, this.options.spawnProtection, this.options.commandBlocks, i, j, + this.options.hardcore, this.options.forceGameMode, this.worldName, this.options.version, diff --git a/com/mojang/realmsclient/gui/screens/RealmsSubscriptionInfoScreen.java b/com/mojang/realmsclient/gui/screens/RealmsSubscriptionInfoScreen.java index f9eeebf1..b6b49924 100644 --- a/com/mojang/realmsclient/gui/screens/RealmsSubscriptionInfoScreen.java +++ b/com/mojang/realmsclient/gui/screens/RealmsSubscriptionInfoScreen.java @@ -5,6 +5,7 @@ import com.mojang.realmsclient.RealmsMainScreen; import com.mojang.realmsclient.client.RealmsClient; import com.mojang.realmsclient.dto.RealmsServer; import com.mojang.realmsclient.dto.Subscription; +import com.mojang.realmsclient.dto.Subscription.SubscriptionType; import com.mojang.realmsclient.exception.RealmsServiceException; import java.text.DateFormat; import java.util.Calendar; @@ -42,7 +43,7 @@ public class RealmsSubscriptionInfoScreen extends RealmsScreen { private Component daysLeft = UNKNOWN; private Component startDate = UNKNOWN; @Nullable - private Subscription.SubscriptionType type; + private SubscriptionType type; public RealmsSubscriptionInfoScreen(Screen lastScreen, RealmsServer serverData, Screen mainScreen) { super(GameNarrator.NO_TITLE); @@ -140,9 +141,9 @@ public class RealmsSubscriptionInfoScreen extends RealmsScreen { guiGraphics.drawCenteredString(this.font, SUBSCRIPTION_TITLE, this.width / 2, 17, -1); guiGraphics.drawString(this.font, SUBSCRIPTION_START_LABEL, i, row(0), -6250336, false); guiGraphics.drawString(this.font, this.startDate, i, row(1), -1, false); - if (this.type == Subscription.SubscriptionType.NORMAL) { + if (this.type == SubscriptionType.NORMAL) { guiGraphics.drawString(this.font, TIME_LEFT_LABEL, i, row(3), -6250336, false); - } else if (this.type == Subscription.SubscriptionType.RECURRING) { + } else if (this.type == SubscriptionType.RECURRING) { guiGraphics.drawString(this.font, DAYS_LEFT_LABEL, i, row(3), -6250336, false); } diff --git a/com/mojang/realmsclient/gui/screens/RealmsUploadScreen.java b/com/mojang/realmsclient/gui/screens/RealmsUploadScreen.java index 3f1cdda7..4dfa8ff0 100644 --- a/com/mojang/realmsclient/gui/screens/RealmsUploadScreen.java +++ b/com/mojang/realmsclient/gui/screens/RealmsUploadScreen.java @@ -2,35 +2,25 @@ package com.mojang.realmsclient.gui.screens; import com.google.common.collect.Lists; import com.google.common.util.concurrent.RateLimiter; -import com.mojang.logging.LogUtils; import com.mojang.realmsclient.RealmsMainScreen; import com.mojang.realmsclient.Unit; -import com.mojang.realmsclient.client.FileUpload; -import com.mojang.realmsclient.client.RealmsClient; import com.mojang.realmsclient.client.UploadStatus; -import com.mojang.realmsclient.dto.UploadInfo; -import com.mojang.realmsclient.exception.RealmsServiceException; -import com.mojang.realmsclient.exception.RetryCallException; -import com.mojang.realmsclient.util.UploadTokenCache; +import com.mojang.realmsclient.client.worldupload.RealmsUploadException; +import com.mojang.realmsclient.client.worldupload.RealmsWorldUpload; +import com.mojang.realmsclient.client.worldupload.RealmsWorldUploadStatusTracker; +import com.mojang.realmsclient.dto.RealmsWorldOptions; import com.mojang.realmsclient.util.task.LongRunningTask; import com.mojang.realmsclient.util.task.RealmCreationTask; import com.mojang.realmsclient.util.task.SwitchSlotTask; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; +import java.nio.file.Path; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Locale; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.locks.ReentrantLock; -import java.util.zip.GZIPOutputStream; +import java.util.concurrent.CompletionException; +import java.util.concurrent.atomic.AtomicReference; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; -import net.minecraft.SharedConstants; -import net.minecraft.Util; import net.minecraft.client.GameNarrator; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.AbstractWidget; @@ -41,15 +31,10 @@ import net.minecraft.network.chat.CommonComponents; import net.minecraft.network.chat.Component; import net.minecraft.realms.RealmsScreen; import net.minecraft.world.level.storage.LevelSummary; -import org.apache.commons.compress.archivers.tar.TarArchiveEntry; -import org.apache.commons.compress.archivers.tar.TarArchiveOutputStream; import org.jetbrains.annotations.Nullable; -import org.slf4j.Logger; @Environment(EnvType.CLIENT) -public class RealmsUploadScreen extends RealmsScreen { - private static final Logger LOGGER = LogUtils.getLogger(); - private static final ReentrantLock UPLOAD_LOCK = new ReentrantLock(); +public class RealmsUploadScreen extends RealmsScreen implements RealmsWorldUploadStatusTracker { private static final int BAR_WIDTH = 200; private static final int BAR_TOP = 80; private static final int BAR_BOTTOM = 95; @@ -62,6 +47,7 @@ public class RealmsUploadScreen extends RealmsScreen { private final RealmCreationTask realmCreationTask; private final long realmId; private final int slotId; + final AtomicReference currentUpload = new AtomicReference(); private final UploadStatus uploadStatus; private final RateLimiter narrationRateLimiter; @Nullable @@ -78,11 +64,6 @@ public class RealmsUploadScreen extends RealmsScreen { @Nullable private Button cancelButton; private int tickCount; - @Nullable - private Long previousWrittenBytes; - @Nullable - private Long previousTimeSnapshot; - private long bytesPersSecond; private final HeaderAndFooterLayout layout = new HeaderAndFooterLayout(this); public RealmsUploadScreen( @@ -143,7 +124,12 @@ public class RealmsUploadScreen extends RealmsScreen { private void onCancel() { this.cancelled = true; - this.minecraft.setScreen(this.lastScreen); + RealmsWorldUpload realmsWorldUpload = (RealmsWorldUpload)this.currentUpload.get(); + if (realmsWorldUpload != null) { + realmsWorldUpload.cancel(); + } else { + this.minecraft.setScreen(this.lastScreen); + } } @Override @@ -164,10 +150,7 @@ public class RealmsUploadScreen extends RealmsScreen { @Override public void render(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) { super.render(guiGraphics, mouseX, mouseY, partialTick); - if (!this.uploadFinished - && this.uploadStatus.bytesWritten != 0L - && this.uploadStatus.bytesWritten == this.uploadStatus.totalBytes - && this.cancelButton != null) { + if (!this.uploadFinished && this.uploadStatus.uploadStarted() && this.uploadStatus.uploadCompleted() && this.cancelButton != null) { this.status = VERIFYING_TEXT; this.cancelButton.active = false; } @@ -177,7 +160,7 @@ public class RealmsUploadScreen extends RealmsScreen { guiGraphics.drawString(this.font, DOTS[this.tickCount / 10 % DOTS.length], this.width / 2 + this.font.width(this.status) / 2 + 5, 50, -1, false); } - if (this.uploadStatus.bytesWritten != 0L && !this.cancelled) { + if (this.uploadStatus.uploadStarted() && !this.cancelled) { this.drawProgressBar(guiGraphics); this.drawUploadSpeed(guiGraphics); } @@ -191,7 +174,7 @@ public class RealmsUploadScreen extends RealmsScreen { } private void drawProgressBar(GuiGraphics guiGraphics) { - double d = Math.min((double)this.uploadStatus.bytesWritten / this.uploadStatus.totalBytes, 1.0); + double d = this.uploadStatus.getPercentage(); this.progress = String.format(Locale.ROOT, "%.1f", d * 100.0); int i = (this.width - 200) / 2; int j = i + (int)Math.round(200.0 * d); @@ -201,22 +184,7 @@ public class RealmsUploadScreen extends RealmsScreen { } private void drawUploadSpeed(GuiGraphics guiGraphics) { - if (this.tickCount % 20 == 0) { - if (this.previousWrittenBytes != null && this.previousTimeSnapshot != null) { - long l = Util.getMillis() - this.previousTimeSnapshot; - if (l == 0L) { - l = 1L; - } - - this.bytesPersSecond = 1000L * (this.uploadStatus.bytesWritten - this.previousWrittenBytes) / l; - this.drawUploadSpeed0(guiGraphics, this.bytesPersSecond); - } - - this.previousWrittenBytes = this.uploadStatus.bytesWritten; - this.previousTimeSnapshot = Util.getMillis(); - } else { - this.drawUploadSpeed0(guiGraphics, this.bytesPersSecond); - } + this.drawUploadSpeed0(guiGraphics, this.uploadStatus.getBytesPerSecond()); } private void drawUploadSpeed0(GuiGraphics guiGraphics, long bytesPerSecond) { @@ -232,6 +200,7 @@ public class RealmsUploadScreen extends RealmsScreen { public void tick() { super.tick(); this.tickCount++; + this.uploadStatus.refreshBytesPerSecond(); if (this.narrationRateLimiter.tryAcquire(1)) { Component component = this.createProgressNarrationMessage(); this.minecraft.getNarrator().sayNow(component); @@ -254,204 +223,63 @@ public class RealmsUploadScreen extends RealmsScreen { } private void upload() { - new Thread( - () -> { - File file = null; - RealmsClient realmsClient = RealmsClient.create(); + Path path = this.minecraft.gameDirectory.toPath().resolve("saves").resolve(this.selectedLevel.getLevelId()); + RealmsWorldOptions realmsWorldOptions = RealmsWorldOptions.createFromSettings( + this.selectedLevel.getSettings(), this.selectedLevel.levelVersion().minecraftVersionName() + ); + RealmsWorldUpload realmsWorldUpload = new RealmsWorldUpload(path, realmsWorldOptions, this.minecraft.getUser(), this.realmId, this.slotId, this); + if (!this.currentUpload.compareAndSet(null, realmsWorldUpload)) { + throw new IllegalStateException("Tried to start uploading but was already uploading"); + } else { + realmsWorldUpload.packAndUpload().handleAsync((object, throwable) -> { + if (throwable != null) { + if (throwable instanceof CompletionException completionException) { + throwable = completionException.getCause(); + } - try { - if (!UPLOAD_LOCK.tryLock(1L, TimeUnit.SECONDS)) { - this.status = Component.translatable("mco.upload.close.failure"); - } else { - UploadInfo uploadInfo = null; - - for (int i = 0; i < 20; i++) { - try { - if (this.cancelled) { - this.uploadCancelled(); - return; - } - - uploadInfo = realmsClient.requestUploadInfo(this.realmId, UploadTokenCache.get(this.realmId)); - if (uploadInfo != null) { - break; - } - } catch (RetryCallException var18) { - Thread.sleep(var18.delaySeconds * 1000); - } - } - - if (uploadInfo == null) { - this.status = Component.translatable("mco.upload.close.failure"); - } else { - UploadTokenCache.put(this.realmId, uploadInfo.getToken()); - if (!uploadInfo.isWorldClosed()) { - this.status = Component.translatable("mco.upload.close.failure"); - } else if (this.cancelled) { - this.uploadCancelled(); - } else { - File file2 = new File(this.minecraft.gameDirectory.getAbsolutePath(), "saves"); - file = this.tarGzipArchive(new File(file2, this.selectedLevel.getLevelId())); - if (this.cancelled) { - this.uploadCancelled(); - } else if (this.verify(file)) { - this.status = Component.translatable("mco.upload.uploading", this.selectedLevel.getLevelName()); - FileUpload fileUpload = new FileUpload( - file, - this.realmId, - this.slotId, - uploadInfo, - this.minecraft.getUser(), - SharedConstants.getCurrentVersion().getName(), - this.selectedLevel.levelVersion().minecraftVersionName(), - this.uploadStatus - ); - fileUpload.upload(uploadResult -> { - if (uploadResult.statusCode >= 200 && uploadResult.statusCode < 300) { - this.uploadFinished = true; - this.status = Component.translatable("mco.upload.done"); - if (this.backButton != null) { - this.backButton.setMessage(CommonComponents.GUI_DONE); - } - - UploadTokenCache.invalidate(this.realmId); - } else if (uploadResult.statusCode == 400 && uploadResult.errorMessage != null) { - this.setErrorMessage(Component.translatable("mco.upload.failed", uploadResult.errorMessage)); - } else { - this.setErrorMessage(Component.translatable("mco.upload.failed", uploadResult.statusCode)); - } - }); - - while (!fileUpload.isFinished()) { - if (this.cancelled) { - fileUpload.cancel(); - this.uploadCancelled(); - return; - } - - try { - Thread.sleep(500L); - } catch (InterruptedException var17) { - LOGGER.error("Failed to check Realms file upload status"); - } - } - } else { - long l = file.length(); - Unit unit = Unit.getLargest(l); - Unit unit2 = Unit.getLargest(5368709120L); - if (Unit.humanReadable(l, unit).equals(Unit.humanReadable(5368709120L, unit2)) && unit != Unit.B) { - Unit unit3 = Unit.values()[unit.ordinal() - 1]; - this.setErrorMessage( - Component.translatable("mco.upload.size.failure.line1", this.selectedLevel.getLevelName()), - Component.translatable("mco.upload.size.failure.line2", Unit.humanReadable(l, unit3), Unit.humanReadable(5368709120L, unit3)) - ); - } else { - this.setErrorMessage( - Component.translatable("mco.upload.size.failure.line1", this.selectedLevel.getLevelName()), - Component.translatable("mco.upload.size.failure.line2", Unit.humanReadable(l, unit), Unit.humanReadable(5368709120L, unit2)) - ); - } - } - } - } + if (throwable instanceof RealmsUploadException realmsUploadException) { + if (realmsUploadException.getStatusMessage() != null) { + this.status = realmsUploadException.getStatusMessage(); } - } catch (IOException var19) { - this.setErrorMessage(Component.translatable("mco.upload.failed", var19.getMessage())); - } catch (RealmsServiceException var20) { - this.setErrorMessage(Component.translatable("mco.upload.failed", var20.realmsError.errorMessage())); - } catch (InterruptedException var21) { - LOGGER.error("Could not acquire upload lock"); - } finally { - this.uploadFinished = true; - if (UPLOAD_LOCK.isHeldByCurrentThread()) { - UPLOAD_LOCK.unlock(); - this.showDots = false; - if (this.backButton != null) { - this.backButton.visible = true; - } - if (this.cancelButton != null) { - this.cancelButton.visible = false; - } - - if (file != null) { - LOGGER.debug("Deleting file {}", file.getAbsolutePath()); - file.delete(); - } - } else { - return; - } + this.setErrorMessage(realmsUploadException.getErrorMessages()); + } else { + this.status = Component.translatable("mco.upload.failed", throwable.getMessage()); + } + } else { + this.status = Component.translatable("mco.upload.done"); + if (this.backButton != null) { + this.backButton.setMessage(CommonComponents.GUI_DONE); } } - ) - .start(); + + this.uploadFinished = true; + this.showDots = false; + if (this.backButton != null) { + this.backButton.visible = true; + } + + if (this.cancelButton != null) { + this.cancelButton.visible = false; + } + + this.currentUpload.set(null); + return null; + }, this.minecraft); + } } - private void setErrorMessage(Component... errorMessage) { + private void setErrorMessage(@Nullable Component... errorMessage) { this.errorMessage = errorMessage; } - private void uploadCancelled() { - this.status = Component.translatable("mco.upload.cancelled"); - LOGGER.debug("Upload was cancelled"); + @Override + public UploadStatus getUploadStatus() { + return this.uploadStatus; } - private boolean verify(File file) { - return file.length() < 5368709120L; - } - - private File tarGzipArchive(File file) throws IOException { - TarArchiveOutputStream tarArchiveOutputStream = null; - - File var4; - try { - File file2 = File.createTempFile("realms-upload-file", ".tar.gz"); - tarArchiveOutputStream = new TarArchiveOutputStream(new GZIPOutputStream(new FileOutputStream(file2))); - tarArchiveOutputStream.setLongFileMode(3); - this.addFileToTarGz(tarArchiveOutputStream, file.getAbsolutePath(), "world", true); - tarArchiveOutputStream.finish(); - var4 = file2; - } finally { - if (tarArchiveOutputStream != null) { - tarArchiveOutputStream.close(); - } - } - - return var4; - } - - private void addFileToTarGz(TarArchiveOutputStream tarArchiveOutputStream, String pathname, String name, boolean rootDirectory) throws IOException { - if (!this.cancelled) { - File file = new File(pathname); - String string = rootDirectory ? name : name + file.getName(); - TarArchiveEntry tarArchiveEntry = new TarArchiveEntry(file, string); - tarArchiveOutputStream.putArchiveEntry(tarArchiveEntry); - if (file.isFile()) { - InputStream inputStream = new FileInputStream(file); - - try { - inputStream.transferTo(tarArchiveOutputStream); - } catch (Throwable var14) { - try { - inputStream.close(); - } catch (Throwable var13) { - var14.addSuppressed(var13); - } - - throw var14; - } - - inputStream.close(); - tarArchiveOutputStream.closeArchiveEntry(); - } else { - tarArchiveOutputStream.closeArchiveEntry(); - File[] files = file.listFiles(); - if (files != null) { - for (File file2 : files) { - this.addFileToTarGz(tarArchiveOutputStream, file2.getAbsolutePath(), string + "/", false); - } - } - } - } + @Override + public void setUploading() { + this.status = Component.translatable("mco.upload.uploading", this.selectedLevel.getLevelName()); } } diff --git a/com/mojang/realmsclient/gui/screens/UploadResult.java b/com/mojang/realmsclient/gui/screens/UploadResult.java index 4eff783e..3f1b1e26 100644 --- a/com/mojang/realmsclient/gui/screens/UploadResult.java +++ b/com/mojang/realmsclient/gui/screens/UploadResult.java @@ -15,6 +15,15 @@ public class UploadResult { this.errorMessage = errorMessage; } + @Nullable + public String getSimplifiedErrorMessage() { + if (this.statusCode >= 200 && this.statusCode < 300) { + return null; + } else { + return this.statusCode == 400 && this.errorMessage != null ? this.errorMessage : String.valueOf(this.statusCode); + } + } + @Environment(EnvType.CLIENT) public static class Builder { private int statusCode = -1; diff --git a/com/mojang/realmsclient/util/JsonUtils.java b/com/mojang/realmsclient/util/JsonUtils.java index b4b4aec5..ad770c5f 100644 --- a/com/mojang/realmsclient/util/JsonUtils.java +++ b/com/mojang/realmsclient/util/JsonUtils.java @@ -45,12 +45,7 @@ public class JsonUtils { } public static String getRequiredStringOr(String key, JsonObject json, String defaultValue) { - JsonElement jsonElement = json.get(key); - if (jsonElement != null) { - return jsonElement.isJsonNull() ? defaultValue : jsonElement.getAsString(); - } else { - return defaultValue; - } + return getStringOr(key, json, defaultValue); } @Nullable diff --git a/com/mojang/realmsclient/util/RealmsUtil.java b/com/mojang/realmsclient/util/RealmsUtil.java index 596e3bd4..57c93fee 100644 --- a/com/mojang/realmsclient/util/RealmsUtil.java +++ b/com/mojang/realmsclient/util/RealmsUtil.java @@ -47,6 +47,6 @@ public class RealmsUtil { Minecraft minecraft = Minecraft.getInstance(); ProfileResult profileResult = minecraft.getMinecraftSessionService().fetchProfile(playerUuid, false); PlayerSkin playerSkin = profileResult != null ? minecraft.getSkinManager().getInsecureSkin(profileResult.profile()) : DefaultPlayerSkin.get(playerUuid); - PlayerFaceRenderer.draw(guiGraphics, playerSkin.texture(), x, y, size); + PlayerFaceRenderer.draw(guiGraphics, playerSkin, x, y, size); } } diff --git a/com/mojang/realmsclient/util/UploadTokenCache.java b/com/mojang/realmsclient/util/UploadTokenCache.java index 968d23bf..7712b1cb 100644 --- a/com/mojang/realmsclient/util/UploadTokenCache.java +++ b/com/mojang/realmsclient/util/UploadTokenCache.java @@ -4,6 +4,7 @@ import it.unimi.dsi.fastutil.longs.Long2ObjectMap; import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; +import org.jetbrains.annotations.Nullable; @Environment(EnvType.CLIENT) public class UploadTokenCache { @@ -17,7 +18,7 @@ public class UploadTokenCache { TOKEN_CACHE.remove(worldId); } - public static void put(long worldId, String token) { + public static void put(long worldId, @Nullable String token) { TOKEN_CACHE.put(worldId, token); } } diff --git a/com/mojang/realmsclient/util/WorldGenerationInfo.java b/com/mojang/realmsclient/util/WorldGenerationInfo.java deleted file mode 100644 index 954967fb..00000000 --- a/com/mojang/realmsclient/util/WorldGenerationInfo.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.mojang.realmsclient.util; - -import java.util.Set; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; - -@Environment(EnvType.CLIENT) -public record WorldGenerationInfo(String seed, LevelType levelType, boolean generateStructures, Set experiments) { -} diff --git a/com/mojang/realmsclient/util/task/ConnectTask.java b/com/mojang/realmsclient/util/task/ConnectTask.java index 2e47ea06..d1dbe39a 100644 --- a/com/mojang/realmsclient/util/task/ConnectTask.java +++ b/com/mojang/realmsclient/util/task/ConnectTask.java @@ -24,7 +24,11 @@ public class ConnectTask extends LongRunningTask { } public void run() { - this.realmsConnect.connect(this.server, ServerAddress.parseString(this.address.address)); + if (this.address.address != null) { + this.realmsConnect.connect(this.server, ServerAddress.parseString(this.address.address)); + } else { + this.abortTask(); + } } @Override diff --git a/com/mojang/realmsclient/util/task/CreateSnapshotRealmTask.java b/com/mojang/realmsclient/util/task/CreateSnapshotRealmTask.java deleted file mode 100644 index 143030c3..00000000 --- a/com/mojang/realmsclient/util/task/CreateSnapshotRealmTask.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.mojang.realmsclient.util.task; - -import com.mojang.logging.LogUtils; -import com.mojang.realmsclient.RealmsMainScreen; -import com.mojang.realmsclient.client.RealmsClient; -import com.mojang.realmsclient.dto.RealmsServer; -import com.mojang.realmsclient.exception.RealmsServiceException; -import com.mojang.realmsclient.gui.screens.RealmsResetWorldScreen; -import com.mojang.realmsclient.util.WorldGenerationInfo; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.client.Minecraft; -import net.minecraft.network.chat.Component; -import org.jetbrains.annotations.Nullable; -import org.slf4j.Logger; - -@Environment(EnvType.CLIENT) -public class CreateSnapshotRealmTask extends LongRunningTask { - private static final Logger LOGGER = LogUtils.getLogger(); - private static final Component TITLE = Component.translatable("mco.snapshot.creating"); - private final long parentId; - private final WorldGenerationInfo generationInfo; - private final String name; - private final String description; - private final RealmsMainScreen realmsMainScreen; - @Nullable - private RealmCreationTask creationTask; - @Nullable - private ResettingGeneratedWorldTask generateWorldTask; - - public CreateSnapshotRealmTask(RealmsMainScreen realmsMainScreen, long parentId, WorldGenerationInfo generationInfo, String name, String description) { - this.parentId = parentId; - this.generationInfo = generationInfo; - this.name = name; - this.description = description; - this.realmsMainScreen = realmsMainScreen; - } - - public void run() { - RealmsClient realmsClient = RealmsClient.create(); - - try { - RealmsServer realmsServer = realmsClient.createSnapshotRealm(this.parentId); - this.creationTask = new RealmCreationTask(realmsServer.id, this.name, this.description); - this.generateWorldTask = new ResettingGeneratedWorldTask( - this.generationInfo, - realmsServer.id, - RealmsResetWorldScreen.CREATE_WORLD_RESET_TASK_TITLE, - () -> Minecraft.getInstance().execute(() -> RealmsMainScreen.play(realmsServer, this.realmsMainScreen, true)) - ); - if (this.aborted()) { - return; - } - - this.creationTask.run(); - if (this.aborted()) { - return; - } - - this.generateWorldTask.run(); - } catch (RealmsServiceException var3) { - LOGGER.error("Couldn't create snapshot world", (Throwable)var3); - this.error(var3); - } catch (Exception var4) { - LOGGER.error("Couldn't create snapshot world", (Throwable)var4); - this.error(var4); - } - } - - @Override - public Component getTitle() { - return TITLE; - } - - @Override - public void abortTask() { - super.abortTask(); - if (this.creationTask != null) { - this.creationTask.abortTask(); - } - - if (this.generateWorldTask != null) { - this.generateWorldTask.abortTask(); - } - } -} diff --git a/com/mojang/realmsclient/util/task/GetServerDetailsTask.java b/com/mojang/realmsclient/util/task/GetServerDetailsTask.java index c287e714..d438711c 100644 --- a/com/mojang/realmsclient/util/task/GetServerDetailsTask.java +++ b/com/mojang/realmsclient/util/task/GetServerDetailsTask.java @@ -14,6 +14,7 @@ import com.mojang.realmsclient.gui.screens.RealmsPopups; import com.mojang.realmsclient.gui.screens.RealmsTermsScreen; import java.net.URL; import java.nio.charset.StandardCharsets; +import java.util.Objects; import java.util.UUID; import java.util.concurrent.CancellationException; import java.util.concurrent.CompletableFuture; @@ -78,17 +79,23 @@ public class GetServerDetailsTask extends LongRunningTask { return; } - boolean bl2 = realmsServerAddress.resourcePackUrl != null && realmsServerAddress.resourcePackHash != null; - Screen screen = (Screen)(bl2 - ? this.resourcePackDownloadConfirmationScreen(realmsServerAddress, generatePackId(this.server), this::connectScreen) - : this.connectScreen(realmsServerAddress)); - setScreen(screen); + if (realmsServerAddress.address == null) { + this.error(Component.translatable("mco.errorMessage.connectionFailure")); + } else { + boolean bl2 = realmsServerAddress.resourcePackUrl != null && realmsServerAddress.resourcePackHash != null; + Screen screen = (Screen)(bl2 + ? this.resourcePackDownloadConfirmationScreen(realmsServerAddress, generatePackId(this.server), this::connectScreen) + : this.connectScreen(realmsServerAddress)); + setScreen(screen); + } } private static UUID generatePackId(RealmsServer realmsServer) { return realmsServer.minigameName != null ? UUID.nameUUIDFromBytes(("minigame:" + realmsServer.minigameName).getBytes(StandardCharsets.UTF_8)) - : UUID.nameUUIDFromBytes(("realms:" + realmsServer.name + ":" + realmsServer.activeSlot).getBytes(StandardCharsets.UTF_8)); + : UUID.nameUUIDFromBytes( + ("realms:" + (String)Objects.requireNonNullElse(realmsServer.name, "") + ":" + realmsServer.activeSlot).getBytes(StandardCharsets.UTF_8) + ); } @Override @@ -133,15 +140,19 @@ public class GetServerDetailsTask extends LongRunningTask { private CompletableFuture scheduleResourcePackDownload(RealmsServerAddress serverAddress, UUID id) { try { - DownloadedPackSource downloadedPackSource = Minecraft.getInstance().getDownloadedPackSource(); - CompletableFuture completableFuture = downloadedPackSource.waitForPackFeedback(id); - downloadedPackSource.allowServerPacks(); - downloadedPackSource.pushPack(id, new URL(serverAddress.resourcePackUrl), serverAddress.resourcePackHash); - return completableFuture; + if (serverAddress.resourcePackUrl != null) { + return CompletableFuture.failedFuture(new IllegalStateException("resourcePackUrl was null")); + } else if (serverAddress.resourcePackHash != null) { + return CompletableFuture.failedFuture(new IllegalStateException("resourcePackHash was null")); + } else { + DownloadedPackSource downloadedPackSource = Minecraft.getInstance().getDownloadedPackSource(); + CompletableFuture completableFuture = downloadedPackSource.waitForPackFeedback(id); + downloadedPackSource.allowServerPacks(); + downloadedPackSource.pushPack(id, new URL(serverAddress.resourcePackUrl), serverAddress.resourcePackHash); + return completableFuture; + } } catch (Exception var5) { - CompletableFuture completableFuturex = new CompletableFuture(); - completableFuturex.completeExceptionally(var5); - return completableFuturex; + return CompletableFuture.failedFuture(var5); } } } diff --git a/com/mojang/realmsclient/util/task/ResettingGeneratedWorldTask.java b/com/mojang/realmsclient/util/task/ResettingGeneratedWorldTask.java deleted file mode 100644 index 6922958f..00000000 --- a/com/mojang/realmsclient/util/task/ResettingGeneratedWorldTask.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.mojang.realmsclient.util.task; - -import com.mojang.realmsclient.client.RealmsClient; -import com.mojang.realmsclient.exception.RealmsServiceException; -import com.mojang.realmsclient.util.WorldGenerationInfo; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.network.chat.Component; - -@Environment(EnvType.CLIENT) -public class ResettingGeneratedWorldTask extends ResettingWorldTask { - private final WorldGenerationInfo generationInfo; - - public ResettingGeneratedWorldTask(WorldGenerationInfo generationInfo, long serverId, Component title, Runnable callback) { - super(serverId, title, callback); - this.generationInfo = generationInfo; - } - - @Override - protected void sendResetRequest(RealmsClient client, long serverId) throws RealmsServiceException { - client.resetWorldWithSeed(serverId, this.generationInfo); - } -} diff --git a/data/minecraft/advancement/adventure/arbalistic.json b/data/minecraft/advancement/adventure/arbalistic.json index e5618874..5a307fbd 100644 --- a/data/minecraft/advancement/adventure/arbalistic.json +++ b/data/minecraft/advancement/adventure/arbalistic.json @@ -3,9 +3,12 @@ "criteria": { "arbalistic": { "conditions": { + "fired_from_weapon": { + "items": "minecraft:crossbow" + }, "unique_entity_types": 5 }, - "trigger": "minecraft:killed_by_crossbow" + "trigger": "minecraft:killed_by_arrow" } }, "display": { diff --git a/data/minecraft/advancement/adventure/hero_of_the_village.json b/data/minecraft/advancement/adventure/hero_of_the_village.json index 21a4bb0f..1380cf76 100644 --- a/data/minecraft/advancement/adventure/hero_of_the_village.json +++ b/data/minecraft/advancement/adventure/hero_of_the_village.json @@ -48,7 +48,8 @@ } ], "minecraft:hide_additional_tooltip": {}, - "minecraft:item_name": "{\"color\":\"gold\",\"translate\":\"block.minecraft.ominous_banner\"}" + "minecraft:item_name": "{\"translate\":\"block.minecraft.ominous_banner\"}", + "minecraft:rarity": "uncommon" }, "count": 1, "id": "minecraft:white_banner" diff --git a/data/minecraft/advancement/adventure/overoverkill.json b/data/minecraft/advancement/adventure/overoverkill.json index 46745331..6c147955 100644 --- a/data/minecraft/advancement/adventure/overoverkill.json +++ b/data/minecraft/advancement/adventure/overoverkill.json @@ -16,7 +16,7 @@ "tags": [ { "expected": true, - "id": "minecraft:is_player_attack" + "id": "minecraft:mace_smash" } ] }, diff --git a/data/minecraft/advancement/adventure/two_birds_one_arrow.json b/data/minecraft/advancement/adventure/two_birds_one_arrow.json index adea2222..be6d2015 100644 --- a/data/minecraft/advancement/adventure/two_birds_one_arrow.json +++ b/data/minecraft/advancement/adventure/two_birds_one_arrow.json @@ -3,6 +3,9 @@ "criteria": { "two_birds": { "conditions": { + "fired_from_weapon": { + "items": "minecraft:crossbow" + }, "victims": [ [ { @@ -24,7 +27,7 @@ ] ] }, - "trigger": "minecraft:killed_by_crossbow" + "trigger": "minecraft:killed_by_arrow" } }, "display": { diff --git a/data/minecraft/advancement/adventure/voluntary_exile.json b/data/minecraft/advancement/adventure/voluntary_exile.json index e45f9f6b..20b1b0a1 100644 --- a/data/minecraft/advancement/adventure/voluntary_exile.json +++ b/data/minecraft/advancement/adventure/voluntary_exile.json @@ -12,9 +12,6 @@ "equipment": { "head": { "components": { - "minecraft:attribute_modifiers": { - "modifiers": [] - }, "minecraft:banner_patterns": [ { "color": "cyan", @@ -49,15 +46,7 @@ "pattern": "minecraft:border" } ], - "minecraft:enchantments": { - "levels": {} - }, - "minecraft:hide_additional_tooltip": {}, - "minecraft:item_name": "{\"color\":\"gold\",\"translate\":\"block.minecraft.ominous_banner\"}", - "minecraft:lore": [], - "minecraft:max_stack_size": 16, - "minecraft:rarity": "common", - "minecraft:repair_cost": 0 + "minecraft:item_name": "{\"translate\":\"block.minecraft.ominous_banner\"}" }, "items": "minecraft:white_banner" } @@ -111,7 +100,8 @@ } ], "minecraft:hide_additional_tooltip": {}, - "minecraft:item_name": "{\"color\":\"gold\",\"translate\":\"block.minecraft.ominous_banner\"}" + "minecraft:item_name": "{\"translate\":\"block.minecraft.ominous_banner\"}", + "minecraft:rarity": "uncommon" }, "count": 1, "id": "minecraft:white_banner" diff --git a/data/minecraft/advancement/adventure/whos_the_pillager_now.json b/data/minecraft/advancement/adventure/whos_the_pillager_now.json index 8a59f942..3fed1f2c 100644 --- a/data/minecraft/advancement/adventure/whos_the_pillager_now.json +++ b/data/minecraft/advancement/adventure/whos_the_pillager_now.json @@ -3,6 +3,9 @@ "criteria": { "kill_pillager": { "conditions": { + "fired_from_weapon": { + "items": "minecraft:crossbow" + }, "victims": [ [ { @@ -15,7 +18,7 @@ ] ] }, - "trigger": "minecraft:killed_by_crossbow" + "trigger": "minecraft:killed_by_arrow" } }, "display": { diff --git a/data/minecraft/advancement/husbandry/ride_a_boat_with_a_goat.json b/data/minecraft/advancement/husbandry/ride_a_boat_with_a_goat.json index 0ae432c1..a747619a 100644 --- a/data/minecraft/advancement/husbandry/ride_a_boat_with_a_goat.json +++ b/data/minecraft/advancement/husbandry/ride_a_boat_with_a_goat.json @@ -9,7 +9,7 @@ "entity": "this", "predicate": { "vehicle": { - "type": "minecraft:boat", + "type": "#minecraft:boat", "passenger": { "type": "minecraft:goat" } diff --git a/data/minecraft/advancement/nether/distract_piglin.json b/data/minecraft/advancement/nether/distract_piglin.json index 2faa7181..b754d8cb 100644 --- a/data/minecraft/advancement/nether/distract_piglin.json +++ b/data/minecraft/advancement/nether/distract_piglin.json @@ -27,7 +27,7 @@ "predicate": { "equipment": { "head": { - "items": "minecraft:golden_helmet" + "items": "#minecraft:piglin_safe_armor" } } } @@ -41,7 +41,7 @@ "predicate": { "equipment": { "chest": { - "items": "minecraft:golden_chestplate" + "items": "#minecraft:piglin_safe_armor" } } } @@ -55,7 +55,7 @@ "predicate": { "equipment": { "legs": { - "items": "minecraft:golden_leggings" + "items": "#minecraft:piglin_safe_armor" } } } @@ -69,7 +69,7 @@ "predicate": { "equipment": { "feet": { - "items": "minecraft:golden_boots" + "items": "#minecraft:piglin_safe_armor" } } } @@ -105,7 +105,7 @@ "predicate": { "equipment": { "head": { - "items": "minecraft:golden_helmet" + "items": "#minecraft:piglin_safe_armor" } } } @@ -119,7 +119,7 @@ "predicate": { "equipment": { "chest": { - "items": "minecraft:golden_chestplate" + "items": "#minecraft:piglin_safe_armor" } } } @@ -133,7 +133,7 @@ "predicate": { "equipment": { "legs": { - "items": "minecraft:golden_leggings" + "items": "#minecraft:piglin_safe_armor" } } } @@ -147,7 +147,7 @@ "predicate": { "equipment": { "feet": { - "items": "minecraft:golden_boots" + "items": "#minecraft:piglin_safe_armor" } } } diff --git a/data/minecraft/advancement/recipes/combat/diamond_sword.json b/data/minecraft/advancement/recipes/combat/diamond_sword.json index 7b9fb0cf..6d945b11 100644 --- a/data/minecraft/advancement/recipes/combat/diamond_sword.json +++ b/data/minecraft/advancement/recipes/combat/diamond_sword.json @@ -5,7 +5,7 @@ "conditions": { "items": [ { - "items": "minecraft:diamond" + "items": "#minecraft:diamond_tool_materials" } ] }, diff --git a/data/minecraft/advancement/recipes/combat/golden_sword.json b/data/minecraft/advancement/recipes/combat/golden_sword.json index 1b3dd220..a6b8a22e 100644 --- a/data/minecraft/advancement/recipes/combat/golden_sword.json +++ b/data/minecraft/advancement/recipes/combat/golden_sword.json @@ -5,7 +5,7 @@ "conditions": { "items": [ { - "items": "minecraft:gold_ingot" + "items": "#minecraft:gold_tool_materials" } ] }, diff --git a/data/minecraft/advancement/recipes/combat/iron_sword.json b/data/minecraft/advancement/recipes/combat/iron_sword.json index 2fc629c2..5899a6a4 100644 --- a/data/minecraft/advancement/recipes/combat/iron_sword.json +++ b/data/minecraft/advancement/recipes/combat/iron_sword.json @@ -5,7 +5,7 @@ "conditions": { "items": [ { - "items": "minecraft:iron_ingot" + "items": "#minecraft:iron_tool_materials" } ] }, diff --git a/data/minecraft/advancement/recipes/combat/netherite_boots_smithing.json b/data/minecraft/advancement/recipes/combat/netherite_boots_smithing.json index eed5d448..0ca28531 100644 --- a/data/minecraft/advancement/recipes/combat/netherite_boots_smithing.json +++ b/data/minecraft/advancement/recipes/combat/netherite_boots_smithing.json @@ -5,7 +5,7 @@ "conditions": { "items": [ { - "items": "minecraft:netherite_ingot" + "items": "#minecraft:netherite_tool_materials" } ] }, diff --git a/data/minecraft/advancement/recipes/combat/netherite_chestplate_smithing.json b/data/minecraft/advancement/recipes/combat/netherite_chestplate_smithing.json index 37b29b56..fec2f5cb 100644 --- a/data/minecraft/advancement/recipes/combat/netherite_chestplate_smithing.json +++ b/data/minecraft/advancement/recipes/combat/netherite_chestplate_smithing.json @@ -5,7 +5,7 @@ "conditions": { "items": [ { - "items": "minecraft:netherite_ingot" + "items": "#minecraft:netherite_tool_materials" } ] }, diff --git a/data/minecraft/advancement/recipes/combat/netherite_helmet_smithing.json b/data/minecraft/advancement/recipes/combat/netherite_helmet_smithing.json index a8240ad1..afc1f9cb 100644 --- a/data/minecraft/advancement/recipes/combat/netherite_helmet_smithing.json +++ b/data/minecraft/advancement/recipes/combat/netherite_helmet_smithing.json @@ -5,7 +5,7 @@ "conditions": { "items": [ { - "items": "minecraft:netherite_ingot" + "items": "#minecraft:netherite_tool_materials" } ] }, diff --git a/data/minecraft/advancement/recipes/combat/netherite_leggings_smithing.json b/data/minecraft/advancement/recipes/combat/netherite_leggings_smithing.json index da9d1c9f..f2c162dc 100644 --- a/data/minecraft/advancement/recipes/combat/netherite_leggings_smithing.json +++ b/data/minecraft/advancement/recipes/combat/netherite_leggings_smithing.json @@ -5,7 +5,7 @@ "conditions": { "items": [ { - "items": "minecraft:netherite_ingot" + "items": "#minecraft:netherite_tool_materials" } ] }, diff --git a/data/minecraft/advancement/recipes/combat/netherite_sword_smithing.json b/data/minecraft/advancement/recipes/combat/netherite_sword_smithing.json index 3a45cc60..0280ef80 100644 --- a/data/minecraft/advancement/recipes/combat/netherite_sword_smithing.json +++ b/data/minecraft/advancement/recipes/combat/netherite_sword_smithing.json @@ -5,7 +5,7 @@ "conditions": { "items": [ { - "items": "minecraft:netherite_ingot" + "items": "#minecraft:netherite_tool_materials" } ] }, diff --git a/data/minecraft/advancement/recipes/decorations/black_shulker_box.json b/data/minecraft/advancement/recipes/decorations/black_shulker_box.json new file mode 100644 index 00000000..0206b688 --- /dev/null +++ b/data/minecraft/advancement/recipes/decorations/black_shulker_box.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_shulker_box": { + "conditions": { + "items": [ + { + "items": "#minecraft:shulker_boxes" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "minecraft:black_shulker_box" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_shulker_box" + ] + ], + "rewards": { + "recipes": [ + "minecraft:black_shulker_box" + ] + } +} \ No newline at end of file diff --git a/data/minecraft/advancement/recipes/decorations/blue_shulker_box.json b/data/minecraft/advancement/recipes/decorations/blue_shulker_box.json new file mode 100644 index 00000000..63af0808 --- /dev/null +++ b/data/minecraft/advancement/recipes/decorations/blue_shulker_box.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_shulker_box": { + "conditions": { + "items": [ + { + "items": "#minecraft:shulker_boxes" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "minecraft:blue_shulker_box" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_shulker_box" + ] + ], + "rewards": { + "recipes": [ + "minecraft:blue_shulker_box" + ] + } +} \ No newline at end of file diff --git a/data/minecraft/advancement/recipes/decorations/brown_shulker_box.json b/data/minecraft/advancement/recipes/decorations/brown_shulker_box.json new file mode 100644 index 00000000..2084251e --- /dev/null +++ b/data/minecraft/advancement/recipes/decorations/brown_shulker_box.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_shulker_box": { + "conditions": { + "items": [ + { + "items": "#minecraft:shulker_boxes" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "minecraft:brown_shulker_box" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_shulker_box" + ] + ], + "rewards": { + "recipes": [ + "minecraft:brown_shulker_box" + ] + } +} \ No newline at end of file diff --git a/data/minecraft/advancement/recipes/decorations/cyan_shulker_box.json b/data/minecraft/advancement/recipes/decorations/cyan_shulker_box.json new file mode 100644 index 00000000..36c766a2 --- /dev/null +++ b/data/minecraft/advancement/recipes/decorations/cyan_shulker_box.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_shulker_box": { + "conditions": { + "items": [ + { + "items": "#minecraft:shulker_boxes" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "minecraft:cyan_shulker_box" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_shulker_box" + ] + ], + "rewards": { + "recipes": [ + "minecraft:cyan_shulker_box" + ] + } +} \ No newline at end of file diff --git a/data/minecraft/advancement/recipes/decorations/gray_shulker_box.json b/data/minecraft/advancement/recipes/decorations/gray_shulker_box.json new file mode 100644 index 00000000..0b180cd5 --- /dev/null +++ b/data/minecraft/advancement/recipes/decorations/gray_shulker_box.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_shulker_box": { + "conditions": { + "items": [ + { + "items": "#minecraft:shulker_boxes" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "minecraft:gray_shulker_box" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_shulker_box" + ] + ], + "rewards": { + "recipes": [ + "minecraft:gray_shulker_box" + ] + } +} \ No newline at end of file diff --git a/data/minecraft/advancement/recipes/decorations/green_shulker_box.json b/data/minecraft/advancement/recipes/decorations/green_shulker_box.json new file mode 100644 index 00000000..632a386c --- /dev/null +++ b/data/minecraft/advancement/recipes/decorations/green_shulker_box.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_shulker_box": { + "conditions": { + "items": [ + { + "items": "#minecraft:shulker_boxes" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "minecraft:green_shulker_box" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_shulker_box" + ] + ], + "rewards": { + "recipes": [ + "minecraft:green_shulker_box" + ] + } +} \ No newline at end of file diff --git a/data/minecraft/advancement/recipes/decorations/light_blue_shulker_box.json b/data/minecraft/advancement/recipes/decorations/light_blue_shulker_box.json new file mode 100644 index 00000000..53475fed --- /dev/null +++ b/data/minecraft/advancement/recipes/decorations/light_blue_shulker_box.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_shulker_box": { + "conditions": { + "items": [ + { + "items": "#minecraft:shulker_boxes" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "minecraft:light_blue_shulker_box" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_shulker_box" + ] + ], + "rewards": { + "recipes": [ + "minecraft:light_blue_shulker_box" + ] + } +} \ No newline at end of file diff --git a/data/minecraft/advancement/recipes/decorations/light_gray_shulker_box.json b/data/minecraft/advancement/recipes/decorations/light_gray_shulker_box.json new file mode 100644 index 00000000..70574ede --- /dev/null +++ b/data/minecraft/advancement/recipes/decorations/light_gray_shulker_box.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_shulker_box": { + "conditions": { + "items": [ + { + "items": "#minecraft:shulker_boxes" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "minecraft:light_gray_shulker_box" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_shulker_box" + ] + ], + "rewards": { + "recipes": [ + "minecraft:light_gray_shulker_box" + ] + } +} \ No newline at end of file diff --git a/data/minecraft/advancement/recipes/decorations/lime_shulker_box.json b/data/minecraft/advancement/recipes/decorations/lime_shulker_box.json new file mode 100644 index 00000000..908856a7 --- /dev/null +++ b/data/minecraft/advancement/recipes/decorations/lime_shulker_box.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_shulker_box": { + "conditions": { + "items": [ + { + "items": "#minecraft:shulker_boxes" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "minecraft:lime_shulker_box" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_shulker_box" + ] + ], + "rewards": { + "recipes": [ + "minecraft:lime_shulker_box" + ] + } +} \ No newline at end of file diff --git a/data/minecraft/advancement/recipes/decorations/magenta_shulker_box.json b/data/minecraft/advancement/recipes/decorations/magenta_shulker_box.json new file mode 100644 index 00000000..2202d88a --- /dev/null +++ b/data/minecraft/advancement/recipes/decorations/magenta_shulker_box.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_shulker_box": { + "conditions": { + "items": [ + { + "items": "#minecraft:shulker_boxes" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "minecraft:magenta_shulker_box" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_shulker_box" + ] + ], + "rewards": { + "recipes": [ + "minecraft:magenta_shulker_box" + ] + } +} \ No newline at end of file diff --git a/data/minecraft/advancement/recipes/decorations/orange_shulker_box.json b/data/minecraft/advancement/recipes/decorations/orange_shulker_box.json new file mode 100644 index 00000000..a9f88b04 --- /dev/null +++ b/data/minecraft/advancement/recipes/decorations/orange_shulker_box.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_shulker_box": { + "conditions": { + "items": [ + { + "items": "#minecraft:shulker_boxes" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "minecraft:orange_shulker_box" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_shulker_box" + ] + ], + "rewards": { + "recipes": [ + "minecraft:orange_shulker_box" + ] + } +} \ No newline at end of file diff --git a/data/minecraft/advancement/recipes/decorations/pink_shulker_box.json b/data/minecraft/advancement/recipes/decorations/pink_shulker_box.json new file mode 100644 index 00000000..de707e6e --- /dev/null +++ b/data/minecraft/advancement/recipes/decorations/pink_shulker_box.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_shulker_box": { + "conditions": { + "items": [ + { + "items": "#minecraft:shulker_boxes" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "minecraft:pink_shulker_box" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_shulker_box" + ] + ], + "rewards": { + "recipes": [ + "minecraft:pink_shulker_box" + ] + } +} \ No newline at end of file diff --git a/data/minecraft/advancement/recipes/decorations/purple_shulker_box.json b/data/minecraft/advancement/recipes/decorations/purple_shulker_box.json new file mode 100644 index 00000000..adfef665 --- /dev/null +++ b/data/minecraft/advancement/recipes/decorations/purple_shulker_box.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_shulker_box": { + "conditions": { + "items": [ + { + "items": "#minecraft:shulker_boxes" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "minecraft:purple_shulker_box" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_shulker_box" + ] + ], + "rewards": { + "recipes": [ + "minecraft:purple_shulker_box" + ] + } +} \ No newline at end of file diff --git a/data/minecraft/advancement/recipes/decorations/red_shulker_box.json b/data/minecraft/advancement/recipes/decorations/red_shulker_box.json new file mode 100644 index 00000000..598f0009 --- /dev/null +++ b/data/minecraft/advancement/recipes/decorations/red_shulker_box.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_shulker_box": { + "conditions": { + "items": [ + { + "items": "#minecraft:shulker_boxes" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "minecraft:red_shulker_box" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_shulker_box" + ] + ], + "rewards": { + "recipes": [ + "minecraft:red_shulker_box" + ] + } +} \ No newline at end of file diff --git a/data/minecraft/advancement/recipes/decorations/white_shulker_box.json b/data/minecraft/advancement/recipes/decorations/white_shulker_box.json new file mode 100644 index 00000000..adecba50 --- /dev/null +++ b/data/minecraft/advancement/recipes/decorations/white_shulker_box.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_shulker_box": { + "conditions": { + "items": [ + { + "items": "#minecraft:shulker_boxes" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "minecraft:white_shulker_box" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_shulker_box" + ] + ], + "rewards": { + "recipes": [ + "minecraft:white_shulker_box" + ] + } +} \ No newline at end of file diff --git a/data/minecraft/advancement/recipes/decorations/yellow_shulker_box.json b/data/minecraft/advancement/recipes/decorations/yellow_shulker_box.json new file mode 100644 index 00000000..a43160e1 --- /dev/null +++ b/data/minecraft/advancement/recipes/decorations/yellow_shulker_box.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_shulker_box": { + "conditions": { + "items": [ + { + "items": "#minecraft:shulker_boxes" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "minecraft:yellow_shulker_box" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_shulker_box" + ] + ], + "rewards": { + "recipes": [ + "minecraft:yellow_shulker_box" + ] + } +} \ No newline at end of file diff --git a/data/minecraft/advancement/recipes/food/suspicious_stew_from_allium.json b/data/minecraft/advancement/recipes/food/suspicious_stew_from_allium.json new file mode 100644 index 00000000..7db1e637 --- /dev/null +++ b/data/minecraft/advancement/recipes/food/suspicious_stew_from_allium.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_allium": { + "conditions": { + "items": [ + { + "items": "minecraft:allium" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "minecraft:suspicious_stew_from_allium" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_allium" + ] + ], + "rewards": { + "recipes": [ + "minecraft:suspicious_stew_from_allium" + ] + } +} \ No newline at end of file diff --git a/data/minecraft/advancement/recipes/food/suspicious_stew_from_azure_bluet.json b/data/minecraft/advancement/recipes/food/suspicious_stew_from_azure_bluet.json new file mode 100644 index 00000000..75568ad2 --- /dev/null +++ b/data/minecraft/advancement/recipes/food/suspicious_stew_from_azure_bluet.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_azure_bluet": { + "conditions": { + "items": [ + { + "items": "minecraft:azure_bluet" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "minecraft:suspicious_stew_from_azure_bluet" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_azure_bluet" + ] + ], + "rewards": { + "recipes": [ + "minecraft:suspicious_stew_from_azure_bluet" + ] + } +} \ No newline at end of file diff --git a/data/minecraft/advancement/recipes/food/suspicious_stew_from_blue_orchid.json b/data/minecraft/advancement/recipes/food/suspicious_stew_from_blue_orchid.json new file mode 100644 index 00000000..d7ca7e53 --- /dev/null +++ b/data/minecraft/advancement/recipes/food/suspicious_stew_from_blue_orchid.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_blue_orchid": { + "conditions": { + "items": [ + { + "items": "minecraft:blue_orchid" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "minecraft:suspicious_stew_from_blue_orchid" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_blue_orchid" + ] + ], + "rewards": { + "recipes": [ + "minecraft:suspicious_stew_from_blue_orchid" + ] + } +} \ No newline at end of file diff --git a/data/minecraft/advancement/recipes/food/suspicious_stew_from_cornflower.json b/data/minecraft/advancement/recipes/food/suspicious_stew_from_cornflower.json new file mode 100644 index 00000000..9b8e604a --- /dev/null +++ b/data/minecraft/advancement/recipes/food/suspicious_stew_from_cornflower.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_cornflower": { + "conditions": { + "items": [ + { + "items": "minecraft:cornflower" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "minecraft:suspicious_stew_from_cornflower" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_cornflower" + ] + ], + "rewards": { + "recipes": [ + "minecraft:suspicious_stew_from_cornflower" + ] + } +} \ No newline at end of file diff --git a/data/minecraft/advancement/recipes/food/suspicious_stew_from_dandelion.json b/data/minecraft/advancement/recipes/food/suspicious_stew_from_dandelion.json new file mode 100644 index 00000000..b622eb31 --- /dev/null +++ b/data/minecraft/advancement/recipes/food/suspicious_stew_from_dandelion.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_dandelion": { + "conditions": { + "items": [ + { + "items": "minecraft:dandelion" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "minecraft:suspicious_stew_from_dandelion" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_dandelion" + ] + ], + "rewards": { + "recipes": [ + "minecraft:suspicious_stew_from_dandelion" + ] + } +} \ No newline at end of file diff --git a/data/minecraft/advancement/recipes/food/suspicious_stew_from_lily_of_the_valley.json b/data/minecraft/advancement/recipes/food/suspicious_stew_from_lily_of_the_valley.json new file mode 100644 index 00000000..04349bf5 --- /dev/null +++ b/data/minecraft/advancement/recipes/food/suspicious_stew_from_lily_of_the_valley.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_lily_of_the_valley": { + "conditions": { + "items": [ + { + "items": "minecraft:lily_of_the_valley" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "minecraft:suspicious_stew_from_lily_of_the_valley" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_lily_of_the_valley" + ] + ], + "rewards": { + "recipes": [ + "minecraft:suspicious_stew_from_lily_of_the_valley" + ] + } +} \ No newline at end of file diff --git a/data/minecraft/advancement/recipes/food/suspicious_stew_from_orange_tulip.json b/data/minecraft/advancement/recipes/food/suspicious_stew_from_orange_tulip.json new file mode 100644 index 00000000..44b027be --- /dev/null +++ b/data/minecraft/advancement/recipes/food/suspicious_stew_from_orange_tulip.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_orange_tulip": { + "conditions": { + "items": [ + { + "items": "minecraft:orange_tulip" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "minecraft:suspicious_stew_from_orange_tulip" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_orange_tulip" + ] + ], + "rewards": { + "recipes": [ + "minecraft:suspicious_stew_from_orange_tulip" + ] + } +} \ No newline at end of file diff --git a/data/minecraft/advancement/recipes/food/suspicious_stew_from_oxeye_daisy.json b/data/minecraft/advancement/recipes/food/suspicious_stew_from_oxeye_daisy.json new file mode 100644 index 00000000..274a2d61 --- /dev/null +++ b/data/minecraft/advancement/recipes/food/suspicious_stew_from_oxeye_daisy.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_oxeye_daisy": { + "conditions": { + "items": [ + { + "items": "minecraft:oxeye_daisy" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "minecraft:suspicious_stew_from_oxeye_daisy" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_oxeye_daisy" + ] + ], + "rewards": { + "recipes": [ + "minecraft:suspicious_stew_from_oxeye_daisy" + ] + } +} \ No newline at end of file diff --git a/data/minecraft/advancement/recipes/food/suspicious_stew_from_pink_tulip.json b/data/minecraft/advancement/recipes/food/suspicious_stew_from_pink_tulip.json new file mode 100644 index 00000000..54e91382 --- /dev/null +++ b/data/minecraft/advancement/recipes/food/suspicious_stew_from_pink_tulip.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_pink_tulip": { + "conditions": { + "items": [ + { + "items": "minecraft:pink_tulip" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "minecraft:suspicious_stew_from_pink_tulip" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_pink_tulip" + ] + ], + "rewards": { + "recipes": [ + "minecraft:suspicious_stew_from_pink_tulip" + ] + } +} \ No newline at end of file diff --git a/data/minecraft/advancement/recipes/food/suspicious_stew_from_poppy.json b/data/minecraft/advancement/recipes/food/suspicious_stew_from_poppy.json new file mode 100644 index 00000000..c1cdb32a --- /dev/null +++ b/data/minecraft/advancement/recipes/food/suspicious_stew_from_poppy.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_poppy": { + "conditions": { + "items": [ + { + "items": "minecraft:poppy" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "minecraft:suspicious_stew_from_poppy" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_poppy" + ] + ], + "rewards": { + "recipes": [ + "minecraft:suspicious_stew_from_poppy" + ] + } +} \ No newline at end of file diff --git a/data/minecraft/advancement/recipes/food/suspicious_stew_from_red_tulip.json b/data/minecraft/advancement/recipes/food/suspicious_stew_from_red_tulip.json new file mode 100644 index 00000000..a9ae49a7 --- /dev/null +++ b/data/minecraft/advancement/recipes/food/suspicious_stew_from_red_tulip.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_red_tulip": { + "conditions": { + "items": [ + { + "items": "minecraft:red_tulip" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "minecraft:suspicious_stew_from_red_tulip" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_red_tulip" + ] + ], + "rewards": { + "recipes": [ + "minecraft:suspicious_stew_from_red_tulip" + ] + } +} \ No newline at end of file diff --git a/data/minecraft/advancement/recipes/food/suspicious_stew_from_torchflower.json b/data/minecraft/advancement/recipes/food/suspicious_stew_from_torchflower.json new file mode 100644 index 00000000..367b11f9 --- /dev/null +++ b/data/minecraft/advancement/recipes/food/suspicious_stew_from_torchflower.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_the_recipe": { + "conditions": { + "recipe": "minecraft:suspicious_stew_from_torchflower" + }, + "trigger": "minecraft:recipe_unlocked" + }, + "has_torchflower": { + "conditions": { + "items": [ + { + "items": "minecraft:torchflower" + } + ] + }, + "trigger": "minecraft:inventory_changed" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_torchflower" + ] + ], + "rewards": { + "recipes": [ + "minecraft:suspicious_stew_from_torchflower" + ] + } +} \ No newline at end of file diff --git a/data/minecraft/advancement/recipes/food/suspicious_stew_from_white_tulip.json b/data/minecraft/advancement/recipes/food/suspicious_stew_from_white_tulip.json new file mode 100644 index 00000000..3f5bd1ce --- /dev/null +++ b/data/minecraft/advancement/recipes/food/suspicious_stew_from_white_tulip.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_the_recipe": { + "conditions": { + "recipe": "minecraft:suspicious_stew_from_white_tulip" + }, + "trigger": "minecraft:recipe_unlocked" + }, + "has_white_tulip": { + "conditions": { + "items": [ + { + "items": "minecraft:white_tulip" + } + ] + }, + "trigger": "minecraft:inventory_changed" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_white_tulip" + ] + ], + "rewards": { + "recipes": [ + "minecraft:suspicious_stew_from_white_tulip" + ] + } +} \ No newline at end of file diff --git a/data/minecraft/advancement/recipes/food/suspicious_stew_from_wither_rose.json b/data/minecraft/advancement/recipes/food/suspicious_stew_from_wither_rose.json new file mode 100644 index 00000000..fc8b1643 --- /dev/null +++ b/data/minecraft/advancement/recipes/food/suspicious_stew_from_wither_rose.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_the_recipe": { + "conditions": { + "recipe": "minecraft:suspicious_stew_from_wither_rose" + }, + "trigger": "minecraft:recipe_unlocked" + }, + "has_wither_rose": { + "conditions": { + "items": [ + { + "items": "minecraft:wither_rose" + } + ] + }, + "trigger": "minecraft:inventory_changed" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_wither_rose" + ] + ], + "rewards": { + "recipes": [ + "minecraft:suspicious_stew_from_wither_rose" + ] + } +} \ No newline at end of file diff --git a/data/minecraft/advancement/recipes/misc/bordure_indented_banner_pattern.json b/data/minecraft/advancement/recipes/misc/bordure_indented_banner_pattern.json new file mode 100644 index 00000000..a2326600 --- /dev/null +++ b/data/minecraft/advancement/recipes/misc/bordure_indented_banner_pattern.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_the_recipe": { + "conditions": { + "recipe": "minecraft:bordure_indented_banner_pattern" + }, + "trigger": "minecraft:recipe_unlocked" + }, + "has_vines": { + "conditions": { + "items": [ + { + "items": "minecraft:vine" + } + ] + }, + "trigger": "minecraft:inventory_changed" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_vines" + ] + ], + "rewards": { + "recipes": [ + "minecraft:bordure_indented_banner_pattern" + ] + } +} \ No newline at end of file diff --git a/data/minecraft/advancement/recipes/misc/field_masoned_banner_pattern.json b/data/minecraft/advancement/recipes/misc/field_masoned_banner_pattern.json new file mode 100644 index 00000000..6709a6d2 --- /dev/null +++ b/data/minecraft/advancement/recipes/misc/field_masoned_banner_pattern.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_bricks": { + "conditions": { + "items": [ + { + "items": "minecraft:bricks" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "minecraft:field_masoned_banner_pattern" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_bricks" + ] + ], + "rewards": { + "recipes": [ + "minecraft:field_masoned_banner_pattern" + ] + } +} \ No newline at end of file diff --git a/data/minecraft/advancement/recipes/tools/black_bundle.json b/data/minecraft/advancement/recipes/tools/black_bundle.json new file mode 100644 index 00000000..91ccc873 --- /dev/null +++ b/data/minecraft/advancement/recipes/tools/black_bundle.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_black_dye": { + "conditions": { + "items": [ + { + "items": "minecraft:black_dye" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "minecraft:black_bundle" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_black_dye" + ] + ], + "rewards": { + "recipes": [ + "minecraft:black_bundle" + ] + } +} \ No newline at end of file diff --git a/data/minecraft/advancement/recipes/tools/blue_bundle.json b/data/minecraft/advancement/recipes/tools/blue_bundle.json new file mode 100644 index 00000000..43a67260 --- /dev/null +++ b/data/minecraft/advancement/recipes/tools/blue_bundle.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_blue_dye": { + "conditions": { + "items": [ + { + "items": "minecraft:blue_dye" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "minecraft:blue_bundle" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_blue_dye" + ] + ], + "rewards": { + "recipes": [ + "minecraft:blue_bundle" + ] + } +} \ No newline at end of file diff --git a/data/minecraft/advancement/recipes/tools/brown_bundle.json b/data/minecraft/advancement/recipes/tools/brown_bundle.json new file mode 100644 index 00000000..18d75fcb --- /dev/null +++ b/data/minecraft/advancement/recipes/tools/brown_bundle.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_brown_dye": { + "conditions": { + "items": [ + { + "items": "minecraft:brown_dye" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "minecraft:brown_bundle" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_brown_dye" + ] + ], + "rewards": { + "recipes": [ + "minecraft:brown_bundle" + ] + } +} \ No newline at end of file diff --git a/data/minecraft/datapacks/bundle/data/minecraft/advancement/recipes/tools/bundle.json b/data/minecraft/advancement/recipes/tools/bundle.json similarity index 100% rename from data/minecraft/datapacks/bundle/data/minecraft/advancement/recipes/tools/bundle.json rename to data/minecraft/advancement/recipes/tools/bundle.json diff --git a/data/minecraft/advancement/recipes/tools/cyan_bundle.json b/data/minecraft/advancement/recipes/tools/cyan_bundle.json new file mode 100644 index 00000000..68f8c387 --- /dev/null +++ b/data/minecraft/advancement/recipes/tools/cyan_bundle.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_cyan_dye": { + "conditions": { + "items": [ + { + "items": "minecraft:cyan_dye" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "minecraft:cyan_bundle" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_cyan_dye" + ] + ], + "rewards": { + "recipes": [ + "minecraft:cyan_bundle" + ] + } +} \ No newline at end of file diff --git a/data/minecraft/advancement/recipes/tools/diamond_axe.json b/data/minecraft/advancement/recipes/tools/diamond_axe.json index 31dbd4fb..f72454f5 100644 --- a/data/minecraft/advancement/recipes/tools/diamond_axe.json +++ b/data/minecraft/advancement/recipes/tools/diamond_axe.json @@ -5,7 +5,7 @@ "conditions": { "items": [ { - "items": "minecraft:diamond" + "items": "#minecraft:diamond_tool_materials" } ] }, diff --git a/data/minecraft/advancement/recipes/tools/diamond_hoe.json b/data/minecraft/advancement/recipes/tools/diamond_hoe.json index 0431c5b3..7be4e4a3 100644 --- a/data/minecraft/advancement/recipes/tools/diamond_hoe.json +++ b/data/minecraft/advancement/recipes/tools/diamond_hoe.json @@ -5,7 +5,7 @@ "conditions": { "items": [ { - "items": "minecraft:diamond" + "items": "#minecraft:diamond_tool_materials" } ] }, diff --git a/data/minecraft/advancement/recipes/tools/diamond_pickaxe.json b/data/minecraft/advancement/recipes/tools/diamond_pickaxe.json index 71a75541..8e9b1b07 100644 --- a/data/minecraft/advancement/recipes/tools/diamond_pickaxe.json +++ b/data/minecraft/advancement/recipes/tools/diamond_pickaxe.json @@ -5,7 +5,7 @@ "conditions": { "items": [ { - "items": "minecraft:diamond" + "items": "#minecraft:diamond_tool_materials" } ] }, diff --git a/data/minecraft/advancement/recipes/tools/diamond_shovel.json b/data/minecraft/advancement/recipes/tools/diamond_shovel.json index e3bc5ce6..dc30177a 100644 --- a/data/minecraft/advancement/recipes/tools/diamond_shovel.json +++ b/data/minecraft/advancement/recipes/tools/diamond_shovel.json @@ -5,7 +5,7 @@ "conditions": { "items": [ { - "items": "minecraft:diamond" + "items": "#minecraft:diamond_tool_materials" } ] }, diff --git a/data/minecraft/advancement/recipes/tools/golden_axe.json b/data/minecraft/advancement/recipes/tools/golden_axe.json index cbb72327..146169b6 100644 --- a/data/minecraft/advancement/recipes/tools/golden_axe.json +++ b/data/minecraft/advancement/recipes/tools/golden_axe.json @@ -5,7 +5,7 @@ "conditions": { "items": [ { - "items": "minecraft:gold_ingot" + "items": "#minecraft:gold_tool_materials" } ] }, diff --git a/data/minecraft/advancement/recipes/tools/golden_hoe.json b/data/minecraft/advancement/recipes/tools/golden_hoe.json index c08e99b0..bfc7e725 100644 --- a/data/minecraft/advancement/recipes/tools/golden_hoe.json +++ b/data/minecraft/advancement/recipes/tools/golden_hoe.json @@ -5,7 +5,7 @@ "conditions": { "items": [ { - "items": "minecraft:gold_ingot" + "items": "#minecraft:gold_tool_materials" } ] }, diff --git a/data/minecraft/advancement/recipes/tools/golden_pickaxe.json b/data/minecraft/advancement/recipes/tools/golden_pickaxe.json index f3608952..b8855c3d 100644 --- a/data/minecraft/advancement/recipes/tools/golden_pickaxe.json +++ b/data/minecraft/advancement/recipes/tools/golden_pickaxe.json @@ -5,7 +5,7 @@ "conditions": { "items": [ { - "items": "minecraft:gold_ingot" + "items": "#minecraft:gold_tool_materials" } ] }, diff --git a/data/minecraft/advancement/recipes/tools/golden_shovel.json b/data/minecraft/advancement/recipes/tools/golden_shovel.json index e4ceef2c..0e643c0b 100644 --- a/data/minecraft/advancement/recipes/tools/golden_shovel.json +++ b/data/minecraft/advancement/recipes/tools/golden_shovel.json @@ -5,7 +5,7 @@ "conditions": { "items": [ { - "items": "minecraft:gold_ingot" + "items": "#minecraft:gold_tool_materials" } ] }, diff --git a/data/minecraft/advancement/recipes/tools/gray_bundle.json b/data/minecraft/advancement/recipes/tools/gray_bundle.json new file mode 100644 index 00000000..b8ff6a2c --- /dev/null +++ b/data/minecraft/advancement/recipes/tools/gray_bundle.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_gray_dye": { + "conditions": { + "items": [ + { + "items": "minecraft:gray_dye" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "minecraft:gray_bundle" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_gray_dye" + ] + ], + "rewards": { + "recipes": [ + "minecraft:gray_bundle" + ] + } +} \ No newline at end of file diff --git a/data/minecraft/advancement/recipes/tools/green_bundle.json b/data/minecraft/advancement/recipes/tools/green_bundle.json new file mode 100644 index 00000000..fc75d8ce --- /dev/null +++ b/data/minecraft/advancement/recipes/tools/green_bundle.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_green_dye": { + "conditions": { + "items": [ + { + "items": "minecraft:green_dye" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "minecraft:green_bundle" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_green_dye" + ] + ], + "rewards": { + "recipes": [ + "minecraft:green_bundle" + ] + } +} \ No newline at end of file diff --git a/data/minecraft/advancement/recipes/tools/iron_axe.json b/data/minecraft/advancement/recipes/tools/iron_axe.json index d4dcd43d..bba795e5 100644 --- a/data/minecraft/advancement/recipes/tools/iron_axe.json +++ b/data/minecraft/advancement/recipes/tools/iron_axe.json @@ -5,7 +5,7 @@ "conditions": { "items": [ { - "items": "minecraft:iron_ingot" + "items": "#minecraft:iron_tool_materials" } ] }, diff --git a/data/minecraft/advancement/recipes/tools/iron_hoe.json b/data/minecraft/advancement/recipes/tools/iron_hoe.json index 90d60874..3e28715f 100644 --- a/data/minecraft/advancement/recipes/tools/iron_hoe.json +++ b/data/minecraft/advancement/recipes/tools/iron_hoe.json @@ -5,7 +5,7 @@ "conditions": { "items": [ { - "items": "minecraft:iron_ingot" + "items": "#minecraft:iron_tool_materials" } ] }, diff --git a/data/minecraft/advancement/recipes/tools/iron_pickaxe.json b/data/minecraft/advancement/recipes/tools/iron_pickaxe.json index 98edb583..0bbdbdef 100644 --- a/data/minecraft/advancement/recipes/tools/iron_pickaxe.json +++ b/data/minecraft/advancement/recipes/tools/iron_pickaxe.json @@ -5,7 +5,7 @@ "conditions": { "items": [ { - "items": "minecraft:iron_ingot" + "items": "#minecraft:iron_tool_materials" } ] }, diff --git a/data/minecraft/advancement/recipes/tools/iron_shovel.json b/data/minecraft/advancement/recipes/tools/iron_shovel.json index 449cfb5d..38835c37 100644 --- a/data/minecraft/advancement/recipes/tools/iron_shovel.json +++ b/data/minecraft/advancement/recipes/tools/iron_shovel.json @@ -5,7 +5,7 @@ "conditions": { "items": [ { - "items": "minecraft:iron_ingot" + "items": "#minecraft:iron_tool_materials" } ] }, diff --git a/data/minecraft/advancement/recipes/tools/light_blue_bundle.json b/data/minecraft/advancement/recipes/tools/light_blue_bundle.json new file mode 100644 index 00000000..880e5d90 --- /dev/null +++ b/data/minecraft/advancement/recipes/tools/light_blue_bundle.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_light_blue_dye": { + "conditions": { + "items": [ + { + "items": "minecraft:light_blue_dye" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "minecraft:light_blue_bundle" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_light_blue_dye" + ] + ], + "rewards": { + "recipes": [ + "minecraft:light_blue_bundle" + ] + } +} \ No newline at end of file diff --git a/data/minecraft/advancement/recipes/tools/light_gray_bundle.json b/data/minecraft/advancement/recipes/tools/light_gray_bundle.json new file mode 100644 index 00000000..5b190fb0 --- /dev/null +++ b/data/minecraft/advancement/recipes/tools/light_gray_bundle.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_light_gray_dye": { + "conditions": { + "items": [ + { + "items": "minecraft:light_gray_dye" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "minecraft:light_gray_bundle" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_light_gray_dye" + ] + ], + "rewards": { + "recipes": [ + "minecraft:light_gray_bundle" + ] + } +} \ No newline at end of file diff --git a/data/minecraft/advancement/recipes/tools/lime_bundle.json b/data/minecraft/advancement/recipes/tools/lime_bundle.json new file mode 100644 index 00000000..2ac8c127 --- /dev/null +++ b/data/minecraft/advancement/recipes/tools/lime_bundle.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_lime_dye": { + "conditions": { + "items": [ + { + "items": "minecraft:lime_dye" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "minecraft:lime_bundle" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_lime_dye" + ] + ], + "rewards": { + "recipes": [ + "minecraft:lime_bundle" + ] + } +} \ No newline at end of file diff --git a/data/minecraft/advancement/recipes/tools/magenta_bundle.json b/data/minecraft/advancement/recipes/tools/magenta_bundle.json new file mode 100644 index 00000000..6ae38bc7 --- /dev/null +++ b/data/minecraft/advancement/recipes/tools/magenta_bundle.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_magenta_dye": { + "conditions": { + "items": [ + { + "items": "minecraft:magenta_dye" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "minecraft:magenta_bundle" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_magenta_dye" + ] + ], + "rewards": { + "recipes": [ + "minecraft:magenta_bundle" + ] + } +} \ No newline at end of file diff --git a/data/minecraft/advancement/recipes/tools/netherite_axe_smithing.json b/data/minecraft/advancement/recipes/tools/netherite_axe_smithing.json index aa37d1b8..20a08b73 100644 --- a/data/minecraft/advancement/recipes/tools/netherite_axe_smithing.json +++ b/data/minecraft/advancement/recipes/tools/netherite_axe_smithing.json @@ -5,7 +5,7 @@ "conditions": { "items": [ { - "items": "minecraft:netherite_ingot" + "items": "#minecraft:netherite_tool_materials" } ] }, diff --git a/data/minecraft/advancement/recipes/tools/netherite_hoe_smithing.json b/data/minecraft/advancement/recipes/tools/netherite_hoe_smithing.json index 137ad2fe..186f0b05 100644 --- a/data/minecraft/advancement/recipes/tools/netherite_hoe_smithing.json +++ b/data/minecraft/advancement/recipes/tools/netherite_hoe_smithing.json @@ -5,7 +5,7 @@ "conditions": { "items": [ { - "items": "minecraft:netherite_ingot" + "items": "#minecraft:netherite_tool_materials" } ] }, diff --git a/data/minecraft/advancement/recipes/tools/netherite_pickaxe_smithing.json b/data/minecraft/advancement/recipes/tools/netherite_pickaxe_smithing.json index efaeb520..74feb952 100644 --- a/data/minecraft/advancement/recipes/tools/netherite_pickaxe_smithing.json +++ b/data/minecraft/advancement/recipes/tools/netherite_pickaxe_smithing.json @@ -5,7 +5,7 @@ "conditions": { "items": [ { - "items": "minecraft:netherite_ingot" + "items": "#minecraft:netherite_tool_materials" } ] }, diff --git a/data/minecraft/advancement/recipes/tools/netherite_shovel_smithing.json b/data/minecraft/advancement/recipes/tools/netherite_shovel_smithing.json index e6db20d1..0f3426a0 100644 --- a/data/minecraft/advancement/recipes/tools/netherite_shovel_smithing.json +++ b/data/minecraft/advancement/recipes/tools/netherite_shovel_smithing.json @@ -5,7 +5,7 @@ "conditions": { "items": [ { - "items": "minecraft:netherite_ingot" + "items": "#minecraft:netherite_tool_materials" } ] }, diff --git a/data/minecraft/advancement/recipes/tools/orange_bundle.json b/data/minecraft/advancement/recipes/tools/orange_bundle.json new file mode 100644 index 00000000..e0c6a980 --- /dev/null +++ b/data/minecraft/advancement/recipes/tools/orange_bundle.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_orange_dye": { + "conditions": { + "items": [ + { + "items": "minecraft:orange_dye" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "minecraft:orange_bundle" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_orange_dye" + ] + ], + "rewards": { + "recipes": [ + "minecraft:orange_bundle" + ] + } +} \ No newline at end of file diff --git a/data/minecraft/advancement/recipes/tools/pink_bundle.json b/data/minecraft/advancement/recipes/tools/pink_bundle.json new file mode 100644 index 00000000..ba94bca7 --- /dev/null +++ b/data/minecraft/advancement/recipes/tools/pink_bundle.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_pink_dye": { + "conditions": { + "items": [ + { + "items": "minecraft:pink_dye" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "minecraft:pink_bundle" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_pink_dye" + ] + ], + "rewards": { + "recipes": [ + "minecraft:pink_bundle" + ] + } +} \ No newline at end of file diff --git a/data/minecraft/advancement/recipes/tools/purple_bundle.json b/data/minecraft/advancement/recipes/tools/purple_bundle.json new file mode 100644 index 00000000..174244fd --- /dev/null +++ b/data/minecraft/advancement/recipes/tools/purple_bundle.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_purple_dye": { + "conditions": { + "items": [ + { + "items": "minecraft:purple_dye" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "minecraft:purple_bundle" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_purple_dye" + ] + ], + "rewards": { + "recipes": [ + "minecraft:purple_bundle" + ] + } +} \ No newline at end of file diff --git a/data/minecraft/advancement/recipes/tools/red_bundle.json b/data/minecraft/advancement/recipes/tools/red_bundle.json new file mode 100644 index 00000000..bc7abd62 --- /dev/null +++ b/data/minecraft/advancement/recipes/tools/red_bundle.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_red_dye": { + "conditions": { + "items": [ + { + "items": "minecraft:red_dye" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "minecraft:red_bundle" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_red_dye" + ] + ], + "rewards": { + "recipes": [ + "minecraft:red_bundle" + ] + } +} \ No newline at end of file diff --git a/data/minecraft/advancement/recipes/tools/white_bundle.json b/data/minecraft/advancement/recipes/tools/white_bundle.json new file mode 100644 index 00000000..33061545 --- /dev/null +++ b/data/minecraft/advancement/recipes/tools/white_bundle.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_the_recipe": { + "conditions": { + "recipe": "minecraft:white_bundle" + }, + "trigger": "minecraft:recipe_unlocked" + }, + "has_white_dye": { + "conditions": { + "items": [ + { + "items": "minecraft:white_dye" + } + ] + }, + "trigger": "minecraft:inventory_changed" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_white_dye" + ] + ], + "rewards": { + "recipes": [ + "minecraft:white_bundle" + ] + } +} \ No newline at end of file diff --git a/data/minecraft/advancement/recipes/tools/yellow_bundle.json b/data/minecraft/advancement/recipes/tools/yellow_bundle.json new file mode 100644 index 00000000..691e1fff --- /dev/null +++ b/data/minecraft/advancement/recipes/tools/yellow_bundle.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_the_recipe": { + "conditions": { + "recipe": "minecraft:yellow_bundle" + }, + "trigger": "minecraft:recipe_unlocked" + }, + "has_yellow_dye": { + "conditions": { + "items": [ + { + "items": "minecraft:yellow_dye" + } + ] + }, + "trigger": "minecraft:inventory_changed" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_yellow_dye" + ] + ], + "rewards": { + "recipes": [ + "minecraft:yellow_bundle" + ] + } +} \ No newline at end of file diff --git a/data/minecraft/damage_type/ender_pearl.json b/data/minecraft/damage_type/ender_pearl.json new file mode 100644 index 00000000..511ec358 --- /dev/null +++ b/data/minecraft/damage_type/ender_pearl.json @@ -0,0 +1,6 @@ +{ + "death_message_type": "fall_variants", + "exhaustion": 0.0, + "message_id": "fall", + "scaling": "when_caused_by_living_non_player" +} \ No newline at end of file diff --git a/data/minecraft/damage_type/mace_smash.json b/data/minecraft/damage_type/mace_smash.json new file mode 100644 index 00000000..931f77c1 --- /dev/null +++ b/data/minecraft/damage_type/mace_smash.json @@ -0,0 +1,5 @@ +{ + "exhaustion": 0.1, + "message_id": "mace_smash", + "scaling": "when_caused_by_living_non_player" +} \ No newline at end of file diff --git a/data/minecraft/datapacks/bundle/pack.mcmeta b/data/minecraft/datapacks/bundle/pack.mcmeta deleted file mode 100644 index 45188cc8..00000000 --- a/data/minecraft/datapacks/bundle/pack.mcmeta +++ /dev/null @@ -1,13 +0,0 @@ -{ - "features": { - "enabled": [ - "minecraft:bundle" - ] - }, - "pack": { - "description": { - "translate": "dataPack.bundle.description" - }, - "pack_format": 48 - } -} \ No newline at end of file diff --git a/data/minecraft/datapacks/minecart_improvements/pack.mcmeta b/data/minecraft/datapacks/minecart_improvements/pack.mcmeta new file mode 100644 index 00000000..5aa6ede3 --- /dev/null +++ b/data/minecraft/datapacks/minecart_improvements/pack.mcmeta @@ -0,0 +1,13 @@ +{ + "features": { + "enabled": [ + "minecraft:minecart_improvements" + ] + }, + "pack": { + "description": { + "translate": "dataPack.minecart_improvements.description" + }, + "pack_format": 57 + } +} \ No newline at end of file diff --git a/data/minecraft/datapacks/redstone_experiments/pack.mcmeta b/data/minecraft/datapacks/redstone_experiments/pack.mcmeta new file mode 100644 index 00000000..10177ea5 --- /dev/null +++ b/data/minecraft/datapacks/redstone_experiments/pack.mcmeta @@ -0,0 +1,13 @@ +{ + "features": { + "enabled": [ + "minecraft:redstone_experiments" + ] + }, + "pack": { + "description": { + "translate": "dataPack.redstone_experiments.description" + }, + "pack_format": 57 + } +} \ No newline at end of file diff --git a/data/minecraft/datapacks/trade_rebalance/pack.mcmeta b/data/minecraft/datapacks/trade_rebalance/pack.mcmeta index 91bcb789..21d85752 100644 --- a/data/minecraft/datapacks/trade_rebalance/pack.mcmeta +++ b/data/minecraft/datapacks/trade_rebalance/pack.mcmeta @@ -8,6 +8,6 @@ "description": { "translate": "dataPack.trade_rebalance.description" }, - "pack_format": 48 + "pack_format": 57 } } \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/advancement/adventure/adventuring_time.json b/data/minecraft/datapacks/winter_drop/data/minecraft/advancement/adventure/adventuring_time.json new file mode 100644 index 00000000..5e301dc3 --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/advancement/adventure/adventuring_time.json @@ -0,0 +1,1050 @@ +{ + "parent": "minecraft:adventure/sleep_in_bed", + "criteria": { + "minecraft:badlands": { + "conditions": { + "player": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "location": { + "biomes": "minecraft:badlands" + } + } + } + ] + }, + "trigger": "minecraft:location" + }, + "minecraft:bamboo_jungle": { + "conditions": { + "player": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "location": { + "biomes": "minecraft:bamboo_jungle" + } + } + } + ] + }, + "trigger": "minecraft:location" + }, + "minecraft:beach": { + "conditions": { + "player": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "location": { + "biomes": "minecraft:beach" + } + } + } + ] + }, + "trigger": "minecraft:location" + }, + "minecraft:birch_forest": { + "conditions": { + "player": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "location": { + "biomes": "minecraft:birch_forest" + } + } + } + ] + }, + "trigger": "minecraft:location" + }, + "minecraft:cherry_grove": { + "conditions": { + "player": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "location": { + "biomes": "minecraft:cherry_grove" + } + } + } + ] + }, + "trigger": "minecraft:location" + }, + "minecraft:cold_ocean": { + "conditions": { + "player": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "location": { + "biomes": "minecraft:cold_ocean" + } + } + } + ] + }, + "trigger": "minecraft:location" + }, + "minecraft:dark_forest": { + "conditions": { + "player": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "location": { + "biomes": "minecraft:dark_forest" + } + } + } + ] + }, + "trigger": "minecraft:location" + }, + "minecraft:deep_cold_ocean": { + "conditions": { + "player": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "location": { + "biomes": "minecraft:deep_cold_ocean" + } + } + } + ] + }, + "trigger": "minecraft:location" + }, + "minecraft:deep_dark": { + "conditions": { + "player": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "location": { + "biomes": "minecraft:deep_dark" + } + } + } + ] + }, + "trigger": "minecraft:location" + }, + "minecraft:deep_frozen_ocean": { + "conditions": { + "player": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "location": { + "biomes": "minecraft:deep_frozen_ocean" + } + } + } + ] + }, + "trigger": "minecraft:location" + }, + "minecraft:deep_lukewarm_ocean": { + "conditions": { + "player": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "location": { + "biomes": "minecraft:deep_lukewarm_ocean" + } + } + } + ] + }, + "trigger": "minecraft:location" + }, + "minecraft:deep_ocean": { + "conditions": { + "player": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "location": { + "biomes": "minecraft:deep_ocean" + } + } + } + ] + }, + "trigger": "minecraft:location" + }, + "minecraft:desert": { + "conditions": { + "player": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "location": { + "biomes": "minecraft:desert" + } + } + } + ] + }, + "trigger": "minecraft:location" + }, + "minecraft:dripstone_caves": { + "conditions": { + "player": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "location": { + "biomes": "minecraft:dripstone_caves" + } + } + } + ] + }, + "trigger": "minecraft:location" + }, + "minecraft:eroded_badlands": { + "conditions": { + "player": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "location": { + "biomes": "minecraft:eroded_badlands" + } + } + } + ] + }, + "trigger": "minecraft:location" + }, + "minecraft:flower_forest": { + "conditions": { + "player": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "location": { + "biomes": "minecraft:flower_forest" + } + } + } + ] + }, + "trigger": "minecraft:location" + }, + "minecraft:forest": { + "conditions": { + "player": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "location": { + "biomes": "minecraft:forest" + } + } + } + ] + }, + "trigger": "minecraft:location" + }, + "minecraft:frozen_ocean": { + "conditions": { + "player": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "location": { + "biomes": "minecraft:frozen_ocean" + } + } + } + ] + }, + "trigger": "minecraft:location" + }, + "minecraft:frozen_peaks": { + "conditions": { + "player": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "location": { + "biomes": "minecraft:frozen_peaks" + } + } + } + ] + }, + "trigger": "minecraft:location" + }, + "minecraft:frozen_river": { + "conditions": { + "player": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "location": { + "biomes": "minecraft:frozen_river" + } + } + } + ] + }, + "trigger": "minecraft:location" + }, + "minecraft:grove": { + "conditions": { + "player": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "location": { + "biomes": "minecraft:grove" + } + } + } + ] + }, + "trigger": "minecraft:location" + }, + "minecraft:ice_spikes": { + "conditions": { + "player": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "location": { + "biomes": "minecraft:ice_spikes" + } + } + } + ] + }, + "trigger": "minecraft:location" + }, + "minecraft:jagged_peaks": { + "conditions": { + "player": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "location": { + "biomes": "minecraft:jagged_peaks" + } + } + } + ] + }, + "trigger": "minecraft:location" + }, + "minecraft:jungle": { + "conditions": { + "player": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "location": { + "biomes": "minecraft:jungle" + } + } + } + ] + }, + "trigger": "minecraft:location" + }, + "minecraft:lukewarm_ocean": { + "conditions": { + "player": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "location": { + "biomes": "minecraft:lukewarm_ocean" + } + } + } + ] + }, + "trigger": "minecraft:location" + }, + "minecraft:lush_caves": { + "conditions": { + "player": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "location": { + "biomes": "minecraft:lush_caves" + } + } + } + ] + }, + "trigger": "minecraft:location" + }, + "minecraft:mangrove_swamp": { + "conditions": { + "player": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "location": { + "biomes": "minecraft:mangrove_swamp" + } + } + } + ] + }, + "trigger": "minecraft:location" + }, + "minecraft:meadow": { + "conditions": { + "player": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "location": { + "biomes": "minecraft:meadow" + } + } + } + ] + }, + "trigger": "minecraft:location" + }, + "minecraft:mushroom_fields": { + "conditions": { + "player": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "location": { + "biomes": "minecraft:mushroom_fields" + } + } + } + ] + }, + "trigger": "minecraft:location" + }, + "minecraft:ocean": { + "conditions": { + "player": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "location": { + "biomes": "minecraft:ocean" + } + } + } + ] + }, + "trigger": "minecraft:location" + }, + "minecraft:old_growth_birch_forest": { + "conditions": { + "player": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "location": { + "biomes": "minecraft:old_growth_birch_forest" + } + } + } + ] + }, + "trigger": "minecraft:location" + }, + "minecraft:old_growth_pine_taiga": { + "conditions": { + "player": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "location": { + "biomes": "minecraft:old_growth_pine_taiga" + } + } + } + ] + }, + "trigger": "minecraft:location" + }, + "minecraft:old_growth_spruce_taiga": { + "conditions": { + "player": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "location": { + "biomes": "minecraft:old_growth_spruce_taiga" + } + } + } + ] + }, + "trigger": "minecraft:location" + }, + "minecraft:pale_garden": { + "conditions": { + "player": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "location": { + "biomes": "minecraft:pale_garden" + } + } + } + ] + }, + "trigger": "minecraft:location" + }, + "minecraft:plains": { + "conditions": { + "player": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "location": { + "biomes": "minecraft:plains" + } + } + } + ] + }, + "trigger": "minecraft:location" + }, + "minecraft:river": { + "conditions": { + "player": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "location": { + "biomes": "minecraft:river" + } + } + } + ] + }, + "trigger": "minecraft:location" + }, + "minecraft:savanna": { + "conditions": { + "player": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "location": { + "biomes": "minecraft:savanna" + } + } + } + ] + }, + "trigger": "minecraft:location" + }, + "minecraft:savanna_plateau": { + "conditions": { + "player": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "location": { + "biomes": "minecraft:savanna_plateau" + } + } + } + ] + }, + "trigger": "minecraft:location" + }, + "minecraft:snowy_beach": { + "conditions": { + "player": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "location": { + "biomes": "minecraft:snowy_beach" + } + } + } + ] + }, + "trigger": "minecraft:location" + }, + "minecraft:snowy_plains": { + "conditions": { + "player": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "location": { + "biomes": "minecraft:snowy_plains" + } + } + } + ] + }, + "trigger": "minecraft:location" + }, + "minecraft:snowy_slopes": { + "conditions": { + "player": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "location": { + "biomes": "minecraft:snowy_slopes" + } + } + } + ] + }, + "trigger": "minecraft:location" + }, + "minecraft:snowy_taiga": { + "conditions": { + "player": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "location": { + "biomes": "minecraft:snowy_taiga" + } + } + } + ] + }, + "trigger": "minecraft:location" + }, + "minecraft:sparse_jungle": { + "conditions": { + "player": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "location": { + "biomes": "minecraft:sparse_jungle" + } + } + } + ] + }, + "trigger": "minecraft:location" + }, + "minecraft:stony_peaks": { + "conditions": { + "player": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "location": { + "biomes": "minecraft:stony_peaks" + } + } + } + ] + }, + "trigger": "minecraft:location" + }, + "minecraft:stony_shore": { + "conditions": { + "player": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "location": { + "biomes": "minecraft:stony_shore" + } + } + } + ] + }, + "trigger": "minecraft:location" + }, + "minecraft:sunflower_plains": { + "conditions": { + "player": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "location": { + "biomes": "minecraft:sunflower_plains" + } + } + } + ] + }, + "trigger": "minecraft:location" + }, + "minecraft:swamp": { + "conditions": { + "player": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "location": { + "biomes": "minecraft:swamp" + } + } + } + ] + }, + "trigger": "minecraft:location" + }, + "minecraft:taiga": { + "conditions": { + "player": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "location": { + "biomes": "minecraft:taiga" + } + } + } + ] + }, + "trigger": "minecraft:location" + }, + "minecraft:warm_ocean": { + "conditions": { + "player": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "location": { + "biomes": "minecraft:warm_ocean" + } + } + } + ] + }, + "trigger": "minecraft:location" + }, + "minecraft:windswept_forest": { + "conditions": { + "player": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "location": { + "biomes": "minecraft:windswept_forest" + } + } + } + ] + }, + "trigger": "minecraft:location" + }, + "minecraft:windswept_gravelly_hills": { + "conditions": { + "player": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "location": { + "biomes": "minecraft:windswept_gravelly_hills" + } + } + } + ] + }, + "trigger": "minecraft:location" + }, + "minecraft:windswept_hills": { + "conditions": { + "player": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "location": { + "biomes": "minecraft:windswept_hills" + } + } + } + ] + }, + "trigger": "minecraft:location" + }, + "minecraft:windswept_savanna": { + "conditions": { + "player": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "location": { + "biomes": "minecraft:windswept_savanna" + } + } + } + ] + }, + "trigger": "minecraft:location" + }, + "minecraft:wooded_badlands": { + "conditions": { + "player": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "location": { + "biomes": "minecraft:wooded_badlands" + } + } + } + ] + }, + "trigger": "minecraft:location" + } + }, + "display": { + "description": { + "translate": "advancements.adventure.adventuring_time.description" + }, + "frame": "challenge", + "icon": { + "count": 1, + "id": "minecraft:diamond_boots" + }, + "title": { + "translate": "advancements.adventure.adventuring_time.title" + } + }, + "requirements": [ + [ + "minecraft:mushroom_fields" + ], + [ + "minecraft:deep_frozen_ocean" + ], + [ + "minecraft:frozen_ocean" + ], + [ + "minecraft:deep_cold_ocean" + ], + [ + "minecraft:cold_ocean" + ], + [ + "minecraft:deep_ocean" + ], + [ + "minecraft:ocean" + ], + [ + "minecraft:deep_lukewarm_ocean" + ], + [ + "minecraft:lukewarm_ocean" + ], + [ + "minecraft:warm_ocean" + ], + [ + "minecraft:stony_shore" + ], + [ + "minecraft:swamp" + ], + [ + "minecraft:mangrove_swamp" + ], + [ + "minecraft:snowy_slopes" + ], + [ + "minecraft:snowy_plains" + ], + [ + "minecraft:snowy_beach" + ], + [ + "minecraft:windswept_gravelly_hills" + ], + [ + "minecraft:grove" + ], + [ + "minecraft:windswept_hills" + ], + [ + "minecraft:snowy_taiga" + ], + [ + "minecraft:windswept_forest" + ], + [ + "minecraft:taiga" + ], + [ + "minecraft:plains" + ], + [ + "minecraft:meadow" + ], + [ + "minecraft:beach" + ], + [ + "minecraft:forest" + ], + [ + "minecraft:old_growth_spruce_taiga" + ], + [ + "minecraft:flower_forest" + ], + [ + "minecraft:birch_forest" + ], + [ + "minecraft:dark_forest" + ], + [ + "minecraft:savanna_plateau" + ], + [ + "minecraft:savanna" + ], + [ + "minecraft:jungle" + ], + [ + "minecraft:badlands" + ], + [ + "minecraft:desert" + ], + [ + "minecraft:wooded_badlands" + ], + [ + "minecraft:jagged_peaks" + ], + [ + "minecraft:stony_peaks" + ], + [ + "minecraft:frozen_river" + ], + [ + "minecraft:river" + ], + [ + "minecraft:ice_spikes" + ], + [ + "minecraft:old_growth_pine_taiga" + ], + [ + "minecraft:sunflower_plains" + ], + [ + "minecraft:old_growth_birch_forest" + ], + [ + "minecraft:sparse_jungle" + ], + [ + "minecraft:bamboo_jungle" + ], + [ + "minecraft:eroded_badlands" + ], + [ + "minecraft:windswept_savanna" + ], + [ + "minecraft:cherry_grove" + ], + [ + "minecraft:pale_garden" + ], + [ + "minecraft:frozen_peaks" + ], + [ + "minecraft:dripstone_caves" + ], + [ + "minecraft:lush_caves" + ], + [ + "minecraft:deep_dark" + ] + ], + "rewards": { + "experience": 500 + }, + "sends_telemetry_event": true +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/advancement/adventure/kill_a_mob.json b/data/minecraft/datapacks/winter_drop/data/minecraft/advancement/adventure/kill_a_mob.json new file mode 100644 index 00000000..ba17fb7e --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/advancement/adventure/kill_a_mob.json @@ -0,0 +1,577 @@ +{ + "parent": "minecraft:adventure/root", + "criteria": { + "minecraft:blaze": { + "conditions": { + "entity": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type": "minecraft:blaze" + } + } + ] + }, + "trigger": "minecraft:player_killed_entity" + }, + "minecraft:bogged": { + "conditions": { + "entity": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type": "minecraft:bogged" + } + } + ] + }, + "trigger": "minecraft:player_killed_entity" + }, + "minecraft:breeze": { + "conditions": { + "entity": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type": "minecraft:breeze" + } + } + ] + }, + "trigger": "minecraft:player_killed_entity" + }, + "minecraft:cave_spider": { + "conditions": { + "entity": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type": "minecraft:cave_spider" + } + } + ] + }, + "trigger": "minecraft:player_killed_entity" + }, + "minecraft:creaking_transient": { + "conditions": { + "entity": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type": "minecraft:creaking_transient" + } + } + ] + }, + "trigger": "minecraft:player_killed_entity" + }, + "minecraft:creeper": { + "conditions": { + "entity": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type": "minecraft:creeper" + } + } + ] + }, + "trigger": "minecraft:player_killed_entity" + }, + "minecraft:drowned": { + "conditions": { + "entity": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type": "minecraft:drowned" + } + } + ] + }, + "trigger": "minecraft:player_killed_entity" + }, + "minecraft:elder_guardian": { + "conditions": { + "entity": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type": "minecraft:elder_guardian" + } + } + ] + }, + "trigger": "minecraft:player_killed_entity" + }, + "minecraft:ender_dragon": { + "conditions": { + "entity": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type": "minecraft:ender_dragon" + } + } + ] + }, + "trigger": "minecraft:player_killed_entity" + }, + "minecraft:enderman": { + "conditions": { + "entity": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type": "minecraft:enderman" + } + } + ] + }, + "trigger": "minecraft:player_killed_entity" + }, + "minecraft:endermite": { + "conditions": { + "entity": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type": "minecraft:endermite" + } + } + ] + }, + "trigger": "minecraft:player_killed_entity" + }, + "minecraft:evoker": { + "conditions": { + "entity": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type": "minecraft:evoker" + } + } + ] + }, + "trigger": "minecraft:player_killed_entity" + }, + "minecraft:ghast": { + "conditions": { + "entity": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type": "minecraft:ghast" + } + } + ] + }, + "trigger": "minecraft:player_killed_entity" + }, + "minecraft:guardian": { + "conditions": { + "entity": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type": "minecraft:guardian" + } + } + ] + }, + "trigger": "minecraft:player_killed_entity" + }, + "minecraft:hoglin": { + "conditions": { + "entity": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type": "minecraft:hoglin" + } + } + ] + }, + "trigger": "minecraft:player_killed_entity" + }, + "minecraft:husk": { + "conditions": { + "entity": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type": "minecraft:husk" + } + } + ] + }, + "trigger": "minecraft:player_killed_entity" + }, + "minecraft:magma_cube": { + "conditions": { + "entity": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type": "minecraft:magma_cube" + } + } + ] + }, + "trigger": "minecraft:player_killed_entity" + }, + "minecraft:phantom": { + "conditions": { + "entity": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type": "minecraft:phantom" + } + } + ] + }, + "trigger": "minecraft:player_killed_entity" + }, + "minecraft:piglin": { + "conditions": { + "entity": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type": "minecraft:piglin" + } + } + ] + }, + "trigger": "minecraft:player_killed_entity" + }, + "minecraft:piglin_brute": { + "conditions": { + "entity": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type": "minecraft:piglin_brute" + } + } + ] + }, + "trigger": "minecraft:player_killed_entity" + }, + "minecraft:pillager": { + "conditions": { + "entity": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type": "minecraft:pillager" + } + } + ] + }, + "trigger": "minecraft:player_killed_entity" + }, + "minecraft:ravager": { + "conditions": { + "entity": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type": "minecraft:ravager" + } + } + ] + }, + "trigger": "minecraft:player_killed_entity" + }, + "minecraft:shulker": { + "conditions": { + "entity": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type": "minecraft:shulker" + } + } + ] + }, + "trigger": "minecraft:player_killed_entity" + }, + "minecraft:silverfish": { + "conditions": { + "entity": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type": "minecraft:silverfish" + } + } + ] + }, + "trigger": "minecraft:player_killed_entity" + }, + "minecraft:skeleton": { + "conditions": { + "entity": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type": "minecraft:skeleton" + } + } + ] + }, + "trigger": "minecraft:player_killed_entity" + }, + "minecraft:slime": { + "conditions": { + "entity": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type": "minecraft:slime" + } + } + ] + }, + "trigger": "minecraft:player_killed_entity" + }, + "minecraft:spider": { + "conditions": { + "entity": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type": "minecraft:spider" + } + } + ] + }, + "trigger": "minecraft:player_killed_entity" + }, + "minecraft:stray": { + "conditions": { + "entity": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type": "minecraft:stray" + } + } + ] + }, + "trigger": "minecraft:player_killed_entity" + }, + "minecraft:vex": { + "conditions": { + "entity": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type": "minecraft:vex" + } + } + ] + }, + "trigger": "minecraft:player_killed_entity" + }, + "minecraft:vindicator": { + "conditions": { + "entity": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type": "minecraft:vindicator" + } + } + ] + }, + "trigger": "minecraft:player_killed_entity" + }, + "minecraft:witch": { + "conditions": { + "entity": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type": "minecraft:witch" + } + } + ] + }, + "trigger": "minecraft:player_killed_entity" + }, + "minecraft:wither": { + "conditions": { + "entity": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type": "minecraft:wither" + } + } + ] + }, + "trigger": "minecraft:player_killed_entity" + }, + "minecraft:wither_skeleton": { + "conditions": { + "entity": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type": "minecraft:wither_skeleton" + } + } + ] + }, + "trigger": "minecraft:player_killed_entity" + }, + "minecraft:zoglin": { + "conditions": { + "entity": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type": "minecraft:zoglin" + } + } + ] + }, + "trigger": "minecraft:player_killed_entity" + }, + "minecraft:zombie": { + "conditions": { + "entity": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type": "minecraft:zombie" + } + } + ] + }, + "trigger": "minecraft:player_killed_entity" + }, + "minecraft:zombie_villager": { + "conditions": { + "entity": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type": "minecraft:zombie_villager" + } + } + ] + }, + "trigger": "minecraft:player_killed_entity" + }, + "minecraft:zombified_piglin": { + "conditions": { + "entity": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type": "minecraft:zombified_piglin" + } + } + ] + }, + "trigger": "minecraft:player_killed_entity" + } + }, + "display": { + "description": { + "translate": "advancements.adventure.kill_a_mob.description" + }, + "icon": { + "count": 1, + "id": "minecraft:iron_sword" + }, + "title": { + "translate": "advancements.adventure.kill_a_mob.title" + } + }, + "requirements": [ + [ + "minecraft:blaze", + "minecraft:bogged", + "minecraft:breeze", + "minecraft:cave_spider", + "minecraft:creeper", + "minecraft:drowned", + "minecraft:elder_guardian", + "minecraft:ender_dragon", + "minecraft:enderman", + "minecraft:endermite", + "minecraft:evoker", + "minecraft:ghast", + "minecraft:guardian", + "minecraft:hoglin", + "minecraft:husk", + "minecraft:magma_cube", + "minecraft:phantom", + "minecraft:piglin", + "minecraft:piglin_brute", + "minecraft:pillager", + "minecraft:ravager", + "minecraft:shulker", + "minecraft:silverfish", + "minecraft:skeleton", + "minecraft:slime", + "minecraft:spider", + "minecraft:stray", + "minecraft:vex", + "minecraft:vindicator", + "minecraft:witch", + "minecraft:wither_skeleton", + "minecraft:wither", + "minecraft:zoglin", + "minecraft:zombie_villager", + "minecraft:zombie", + "minecraft:zombified_piglin", + "minecraft:creaking_transient" + ] + ], + "sends_telemetry_event": true +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/advancement/adventure/kill_all_mobs.json b/data/minecraft/datapacks/winter_drop/data/minecraft/advancement/adventure/kill_all_mobs.json new file mode 100644 index 00000000..a4ab20a9 --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/advancement/adventure/kill_all_mobs.json @@ -0,0 +1,653 @@ +{ + "parent": "minecraft:adventure/kill_a_mob", + "criteria": { + "minecraft:blaze": { + "conditions": { + "entity": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type": "minecraft:blaze" + } + } + ] + }, + "trigger": "minecraft:player_killed_entity" + }, + "minecraft:bogged": { + "conditions": { + "entity": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type": "minecraft:bogged" + } + } + ] + }, + "trigger": "minecraft:player_killed_entity" + }, + "minecraft:breeze": { + "conditions": { + "entity": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type": "minecraft:breeze" + } + } + ] + }, + "trigger": "minecraft:player_killed_entity" + }, + "minecraft:cave_spider": { + "conditions": { + "entity": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type": "minecraft:cave_spider" + } + } + ] + }, + "trigger": "minecraft:player_killed_entity" + }, + "minecraft:creaking_transient": { + "conditions": { + "entity": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type": "minecraft:creaking_transient" + } + } + ] + }, + "trigger": "minecraft:player_killed_entity" + }, + "minecraft:creeper": { + "conditions": { + "entity": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type": "minecraft:creeper" + } + } + ] + }, + "trigger": "minecraft:player_killed_entity" + }, + "minecraft:drowned": { + "conditions": { + "entity": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type": "minecraft:drowned" + } + } + ] + }, + "trigger": "minecraft:player_killed_entity" + }, + "minecraft:elder_guardian": { + "conditions": { + "entity": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type": "minecraft:elder_guardian" + } + } + ] + }, + "trigger": "minecraft:player_killed_entity" + }, + "minecraft:ender_dragon": { + "conditions": { + "entity": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type": "minecraft:ender_dragon" + } + } + ] + }, + "trigger": "minecraft:player_killed_entity" + }, + "minecraft:enderman": { + "conditions": { + "entity": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type": "minecraft:enderman" + } + } + ] + }, + "trigger": "minecraft:player_killed_entity" + }, + "minecraft:endermite": { + "conditions": { + "entity": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type": "minecraft:endermite" + } + } + ] + }, + "trigger": "minecraft:player_killed_entity" + }, + "minecraft:evoker": { + "conditions": { + "entity": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type": "minecraft:evoker" + } + } + ] + }, + "trigger": "minecraft:player_killed_entity" + }, + "minecraft:ghast": { + "conditions": { + "entity": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type": "minecraft:ghast" + } + } + ] + }, + "trigger": "minecraft:player_killed_entity" + }, + "minecraft:guardian": { + "conditions": { + "entity": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type": "minecraft:guardian" + } + } + ] + }, + "trigger": "minecraft:player_killed_entity" + }, + "minecraft:hoglin": { + "conditions": { + "entity": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type": "minecraft:hoglin" + } + } + ] + }, + "trigger": "minecraft:player_killed_entity" + }, + "minecraft:husk": { + "conditions": { + "entity": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type": "minecraft:husk" + } + } + ] + }, + "trigger": "minecraft:player_killed_entity" + }, + "minecraft:magma_cube": { + "conditions": { + "entity": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type": "minecraft:magma_cube" + } + } + ] + }, + "trigger": "minecraft:player_killed_entity" + }, + "minecraft:phantom": { + "conditions": { + "entity": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type": "minecraft:phantom" + } + } + ] + }, + "trigger": "minecraft:player_killed_entity" + }, + "minecraft:piglin": { + "conditions": { + "entity": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type": "minecraft:piglin" + } + } + ] + }, + "trigger": "minecraft:player_killed_entity" + }, + "minecraft:piglin_brute": { + "conditions": { + "entity": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type": "minecraft:piglin_brute" + } + } + ] + }, + "trigger": "minecraft:player_killed_entity" + }, + "minecraft:pillager": { + "conditions": { + "entity": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type": "minecraft:pillager" + } + } + ] + }, + "trigger": "minecraft:player_killed_entity" + }, + "minecraft:ravager": { + "conditions": { + "entity": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type": "minecraft:ravager" + } + } + ] + }, + "trigger": "minecraft:player_killed_entity" + }, + "minecraft:shulker": { + "conditions": { + "entity": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type": "minecraft:shulker" + } + } + ] + }, + "trigger": "minecraft:player_killed_entity" + }, + "minecraft:silverfish": { + "conditions": { + "entity": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type": "minecraft:silverfish" + } + } + ] + }, + "trigger": "minecraft:player_killed_entity" + }, + "minecraft:skeleton": { + "conditions": { + "entity": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type": "minecraft:skeleton" + } + } + ] + }, + "trigger": "minecraft:player_killed_entity" + }, + "minecraft:slime": { + "conditions": { + "entity": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type": "minecraft:slime" + } + } + ] + }, + "trigger": "minecraft:player_killed_entity" + }, + "minecraft:spider": { + "conditions": { + "entity": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type": "minecraft:spider" + } + } + ] + }, + "trigger": "minecraft:player_killed_entity" + }, + "minecraft:stray": { + "conditions": { + "entity": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type": "minecraft:stray" + } + } + ] + }, + "trigger": "minecraft:player_killed_entity" + }, + "minecraft:vex": { + "conditions": { + "entity": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type": "minecraft:vex" + } + } + ] + }, + "trigger": "minecraft:player_killed_entity" + }, + "minecraft:vindicator": { + "conditions": { + "entity": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type": "minecraft:vindicator" + } + } + ] + }, + "trigger": "minecraft:player_killed_entity" + }, + "minecraft:witch": { + "conditions": { + "entity": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type": "minecraft:witch" + } + } + ] + }, + "trigger": "minecraft:player_killed_entity" + }, + "minecraft:wither": { + "conditions": { + "entity": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type": "minecraft:wither" + } + } + ] + }, + "trigger": "minecraft:player_killed_entity" + }, + "minecraft:wither_skeleton": { + "conditions": { + "entity": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type": "minecraft:wither_skeleton" + } + } + ] + }, + "trigger": "minecraft:player_killed_entity" + }, + "minecraft:zoglin": { + "conditions": { + "entity": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type": "minecraft:zoglin" + } + } + ] + }, + "trigger": "minecraft:player_killed_entity" + }, + "minecraft:zombie": { + "conditions": { + "entity": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type": "minecraft:zombie" + } + } + ] + }, + "trigger": "minecraft:player_killed_entity" + }, + "minecraft:zombie_villager": { + "conditions": { + "entity": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type": "minecraft:zombie_villager" + } + } + ] + }, + "trigger": "minecraft:player_killed_entity" + }, + "minecraft:zombified_piglin": { + "conditions": { + "entity": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type": "minecraft:zombified_piglin" + } + } + ] + }, + "trigger": "minecraft:player_killed_entity" + } + }, + "display": { + "description": { + "translate": "advancements.adventure.kill_all_mobs.description" + }, + "frame": "challenge", + "icon": { + "count": 1, + "id": "minecraft:diamond_sword" + }, + "title": { + "translate": "advancements.adventure.kill_all_mobs.title" + } + }, + "requirements": [ + [ + "minecraft:blaze" + ], + [ + "minecraft:bogged" + ], + [ + "minecraft:breeze" + ], + [ + "minecraft:cave_spider" + ], + [ + "minecraft:creeper" + ], + [ + "minecraft:drowned" + ], + [ + "minecraft:elder_guardian" + ], + [ + "minecraft:ender_dragon" + ], + [ + "minecraft:enderman" + ], + [ + "minecraft:endermite" + ], + [ + "minecraft:evoker" + ], + [ + "minecraft:ghast" + ], + [ + "minecraft:guardian" + ], + [ + "minecraft:hoglin" + ], + [ + "minecraft:husk" + ], + [ + "minecraft:magma_cube" + ], + [ + "minecraft:phantom" + ], + [ + "minecraft:piglin" + ], + [ + "minecraft:piglin_brute" + ], + [ + "minecraft:pillager" + ], + [ + "minecraft:ravager" + ], + [ + "minecraft:shulker" + ], + [ + "minecraft:silverfish" + ], + [ + "minecraft:skeleton" + ], + [ + "minecraft:slime" + ], + [ + "minecraft:spider" + ], + [ + "minecraft:stray" + ], + [ + "minecraft:vex" + ], + [ + "minecraft:vindicator" + ], + [ + "minecraft:witch" + ], + [ + "minecraft:wither_skeleton" + ], + [ + "minecraft:wither" + ], + [ + "minecraft:zoglin" + ], + [ + "minecraft:zombie_villager" + ], + [ + "minecraft:zombie" + ], + [ + "minecraft:zombified_piglin" + ], + [ + "minecraft:creaking_transient" + ] + ], + "rewards": { + "experience": 100 + }, + "sends_telemetry_event": true +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/advancement/recipes/building_blocks/pale_oak_planks.json b/data/minecraft/datapacks/winter_drop/data/minecraft/advancement/recipes/building_blocks/pale_oak_planks.json new file mode 100644 index 00000000..7bcea532 --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/advancement/recipes/building_blocks/pale_oak_planks.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_log": { + "conditions": { + "items": [ + { + "items": "#minecraft:pale_oak_logs" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "minecraft:pale_oak_planks" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_log" + ] + ], + "rewards": { + "recipes": [ + "minecraft:pale_oak_planks" + ] + } +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/advancement/recipes/building_blocks/pale_oak_slab.json b/data/minecraft/datapacks/winter_drop/data/minecraft/advancement/recipes/building_blocks/pale_oak_slab.json new file mode 100644 index 00000000..c8f7d94e --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/advancement/recipes/building_blocks/pale_oak_slab.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_planks": { + "conditions": { + "items": [ + { + "items": "minecraft:pale_oak_planks" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "minecraft:pale_oak_slab" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_planks" + ] + ], + "rewards": { + "recipes": [ + "minecraft:pale_oak_slab" + ] + } +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/advancement/recipes/building_blocks/pale_oak_stairs.json b/data/minecraft/datapacks/winter_drop/data/minecraft/advancement/recipes/building_blocks/pale_oak_stairs.json new file mode 100644 index 00000000..8fed8cf9 --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/advancement/recipes/building_blocks/pale_oak_stairs.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_planks": { + "conditions": { + "items": [ + { + "items": "minecraft:pale_oak_planks" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "minecraft:pale_oak_stairs" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_planks" + ] + ], + "rewards": { + "recipes": [ + "minecraft:pale_oak_stairs" + ] + } +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/advancement/recipes/building_blocks/pale_oak_wood.json b/data/minecraft/datapacks/winter_drop/data/minecraft/advancement/recipes/building_blocks/pale_oak_wood.json new file mode 100644 index 00000000..f1f79a27 --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/advancement/recipes/building_blocks/pale_oak_wood.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_log": { + "conditions": { + "items": [ + { + "items": "minecraft:pale_oak_log" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "minecraft:pale_oak_wood" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_log" + ] + ], + "rewards": { + "recipes": [ + "minecraft:pale_oak_wood" + ] + } +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/advancement/recipes/building_blocks/stripped_pale_oak_wood.json b/data/minecraft/datapacks/winter_drop/data/minecraft/advancement/recipes/building_blocks/stripped_pale_oak_wood.json new file mode 100644 index 00000000..45a19e7e --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/advancement/recipes/building_blocks/stripped_pale_oak_wood.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_log": { + "conditions": { + "items": [ + { + "items": "minecraft:stripped_pale_oak_log" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "minecraft:stripped_pale_oak_wood" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_log" + ] + ], + "rewards": { + "recipes": [ + "minecraft:stripped_pale_oak_wood" + ] + } +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/advancement/recipes/decorations/pale_moss_carpet.json b/data/minecraft/datapacks/winter_drop/data/minecraft/advancement/recipes/decorations/pale_moss_carpet.json new file mode 100644 index 00000000..da87d689 --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/advancement/recipes/decorations/pale_moss_carpet.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_pale_moss_block": { + "conditions": { + "items": [ + { + "items": "minecraft:pale_moss_block" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "minecraft:pale_moss_carpet" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_pale_moss_block" + ] + ], + "rewards": { + "recipes": [ + "minecraft:pale_moss_carpet" + ] + } +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/advancement/recipes/decorations/pale_oak_fence.json b/data/minecraft/datapacks/winter_drop/data/minecraft/advancement/recipes/decorations/pale_oak_fence.json new file mode 100644 index 00000000..a42d55c3 --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/advancement/recipes/decorations/pale_oak_fence.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_planks": { + "conditions": { + "items": [ + { + "items": "minecraft:pale_oak_planks" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "minecraft:pale_oak_fence" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_planks" + ] + ], + "rewards": { + "recipes": [ + "minecraft:pale_oak_fence" + ] + } +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/advancement/recipes/decorations/pale_oak_hanging_sign.json b/data/minecraft/datapacks/winter_drop/data/minecraft/advancement/recipes/decorations/pale_oak_hanging_sign.json new file mode 100644 index 00000000..64a89bae --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/advancement/recipes/decorations/pale_oak_hanging_sign.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_stripped_logs": { + "conditions": { + "items": [ + { + "items": "minecraft:stripped_pale_oak_log" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "minecraft:pale_oak_hanging_sign" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_stripped_logs" + ] + ], + "rewards": { + "recipes": [ + "minecraft:pale_oak_hanging_sign" + ] + } +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/advancement/recipes/decorations/pale_oak_sign.json b/data/minecraft/datapacks/winter_drop/data/minecraft/advancement/recipes/decorations/pale_oak_sign.json new file mode 100644 index 00000000..6319907f --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/advancement/recipes/decorations/pale_oak_sign.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_planks": { + "conditions": { + "items": [ + { + "items": "minecraft:pale_oak_planks" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "minecraft:pale_oak_sign" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_planks" + ] + ], + "rewards": { + "recipes": [ + "minecraft:pale_oak_sign" + ] + } +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/advancement/recipes/redstone/pale_oak_button.json b/data/minecraft/datapacks/winter_drop/data/minecraft/advancement/recipes/redstone/pale_oak_button.json new file mode 100644 index 00000000..9789127a --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/advancement/recipes/redstone/pale_oak_button.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_planks": { + "conditions": { + "items": [ + { + "items": "minecraft:pale_oak_planks" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "minecraft:pale_oak_button" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_planks" + ] + ], + "rewards": { + "recipes": [ + "minecraft:pale_oak_button" + ] + } +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/advancement/recipes/redstone/pale_oak_door.json b/data/minecraft/datapacks/winter_drop/data/minecraft/advancement/recipes/redstone/pale_oak_door.json new file mode 100644 index 00000000..3185caa0 --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/advancement/recipes/redstone/pale_oak_door.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_planks": { + "conditions": { + "items": [ + { + "items": "minecraft:pale_oak_planks" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "minecraft:pale_oak_door" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_planks" + ] + ], + "rewards": { + "recipes": [ + "minecraft:pale_oak_door" + ] + } +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/advancement/recipes/redstone/pale_oak_fence_gate.json b/data/minecraft/datapacks/winter_drop/data/minecraft/advancement/recipes/redstone/pale_oak_fence_gate.json new file mode 100644 index 00000000..66a72265 --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/advancement/recipes/redstone/pale_oak_fence_gate.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_planks": { + "conditions": { + "items": [ + { + "items": "minecraft:pale_oak_planks" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "minecraft:pale_oak_fence_gate" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_planks" + ] + ], + "rewards": { + "recipes": [ + "minecraft:pale_oak_fence_gate" + ] + } +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/advancement/recipes/redstone/pale_oak_pressure_plate.json b/data/minecraft/datapacks/winter_drop/data/minecraft/advancement/recipes/redstone/pale_oak_pressure_plate.json new file mode 100644 index 00000000..953ddd67 --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/advancement/recipes/redstone/pale_oak_pressure_plate.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_planks": { + "conditions": { + "items": [ + { + "items": "minecraft:pale_oak_planks" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "minecraft:pale_oak_pressure_plate" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_planks" + ] + ], + "rewards": { + "recipes": [ + "minecraft:pale_oak_pressure_plate" + ] + } +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/advancement/recipes/redstone/pale_oak_trapdoor.json b/data/minecraft/datapacks/winter_drop/data/minecraft/advancement/recipes/redstone/pale_oak_trapdoor.json new file mode 100644 index 00000000..11749685 --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/advancement/recipes/redstone/pale_oak_trapdoor.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_planks": { + "conditions": { + "items": [ + { + "items": "minecraft:pale_oak_planks" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "minecraft:pale_oak_trapdoor" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_planks" + ] + ], + "rewards": { + "recipes": [ + "minecraft:pale_oak_trapdoor" + ] + } +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/advancement/recipes/transportation/pale_oak_boat.json b/data/minecraft/datapacks/winter_drop/data/minecraft/advancement/recipes/transportation/pale_oak_boat.json new file mode 100644 index 00000000..b060cc40 --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/advancement/recipes/transportation/pale_oak_boat.json @@ -0,0 +1,28 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_the_recipe": { + "conditions": { + "recipe": "minecraft:pale_oak_boat" + }, + "trigger": "minecraft:recipe_unlocked" + }, + "in_water": { + "conditions": { + "block": "minecraft:water" + }, + "trigger": "minecraft:enter_block" + } + }, + "requirements": [ + [ + "has_the_recipe", + "in_water" + ] + ], + "rewards": { + "recipes": [ + "minecraft:pale_oak_boat" + ] + } +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/advancement/recipes/transportation/pale_oak_chest_boat.json b/data/minecraft/datapacks/winter_drop/data/minecraft/advancement/recipes/transportation/pale_oak_chest_boat.json new file mode 100644 index 00000000..06846142 --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/advancement/recipes/transportation/pale_oak_chest_boat.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_boat": { + "conditions": { + "items": [ + { + "items": "#minecraft:boats" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "minecraft:pale_oak_chest_boat" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_boat" + ] + ], + "rewards": { + "recipes": [ + "minecraft:pale_oak_chest_boat" + ] + } +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/loot_table/blocks/creaking_heart.json b/data/minecraft/datapacks/winter_drop/data/minecraft/loot_table/blocks/creaking_heart.json new file mode 100644 index 00000000..0cd62c71 --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/loot_table/blocks/creaking_heart.json @@ -0,0 +1,33 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:match_tool", + "predicate": { + "predicates": { + "minecraft:enchantments": [ + { + "enchantments": "minecraft:silk_touch", + "levels": { + "min": 1 + } + } + ] + } + } + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "minecraft:creaking_heart" + } + ], + "rolls": 1.0 + } + ], + "random_sequence": "minecraft:blocks/creaking_heart" +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/loot_table/blocks/pale_hanging_moss.json b/data/minecraft/datapacks/winter_drop/data/minecraft/loot_table/blocks/pale_hanging_moss.json new file mode 100644 index 00000000..6f06ee04 --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/loot_table/blocks/pale_hanging_moss.json @@ -0,0 +1,44 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:any_of", + "terms": [ + { + "condition": "minecraft:match_tool", + "predicate": { + "items": "minecraft:shears" + } + }, + { + "condition": "minecraft:match_tool", + "predicate": { + "predicates": { + "minecraft:enchantments": [ + { + "enchantments": "minecraft:silk_touch", + "levels": { + "min": 1 + } + } + ] + } + } + } + ] + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "minecraft:pale_hanging_moss" + } + ], + "rolls": 1.0 + } + ], + "random_sequence": "minecraft:blocks/pale_hanging_moss" +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/loot_table/blocks/pale_moss_block.json b/data/minecraft/datapacks/winter_drop/data/minecraft/loot_table/blocks/pale_moss_block.json new file mode 100644 index 00000000..8a535930 --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/loot_table/blocks/pale_moss_block.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "minecraft:pale_moss_block" + } + ], + "rolls": 1.0 + } + ], + "random_sequence": "minecraft:blocks/pale_moss_block" +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/loot_table/blocks/pale_moss_carpet.json b/data/minecraft/datapacks/winter_drop/data/minecraft/loot_table/blocks/pale_moss_carpet.json new file mode 100644 index 00000000..609106a6 --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/loot_table/blocks/pale_moss_carpet.json @@ -0,0 +1,30 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "bonus_rolls": 0.0, + "entries": [ + { + "type": "minecraft:item", + "conditions": [ + { + "block": "minecraft:pale_moss_carpet", + "condition": "minecraft:block_state_property", + "properties": { + "bottom": "true" + } + } + ], + "functions": [ + { + "function": "minecraft:explosion_decay" + } + ], + "name": "minecraft:pale_moss_carpet" + } + ], + "rolls": 1.0 + } + ], + "random_sequence": "minecraft:blocks/pale_moss_carpet" +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/loot_table/blocks/pale_oak_button.json b/data/minecraft/datapacks/winter_drop/data/minecraft/loot_table/blocks/pale_oak_button.json new file mode 100644 index 00000000..3782634d --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/loot_table/blocks/pale_oak_button.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "minecraft:pale_oak_button" + } + ], + "rolls": 1.0 + } + ], + "random_sequence": "minecraft:blocks/pale_oak_button" +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/loot_table/blocks/pale_oak_door.json b/data/minecraft/datapacks/winter_drop/data/minecraft/loot_table/blocks/pale_oak_door.json new file mode 100644 index 00000000..e54f21a6 --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/loot_table/blocks/pale_oak_door.json @@ -0,0 +1,30 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ], + "entries": [ + { + "type": "minecraft:item", + "conditions": [ + { + "block": "minecraft:pale_oak_door", + "condition": "minecraft:block_state_property", + "properties": { + "half": "lower" + } + } + ], + "name": "minecraft:pale_oak_door" + } + ], + "rolls": 1.0 + } + ], + "random_sequence": "minecraft:blocks/pale_oak_door" +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/loot_table/blocks/pale_oak_fence.json b/data/minecraft/datapacks/winter_drop/data/minecraft/loot_table/blocks/pale_oak_fence.json new file mode 100644 index 00000000..443e0156 --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/loot_table/blocks/pale_oak_fence.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "minecraft:pale_oak_fence" + } + ], + "rolls": 1.0 + } + ], + "random_sequence": "minecraft:blocks/pale_oak_fence" +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/loot_table/blocks/pale_oak_fence_gate.json b/data/minecraft/datapacks/winter_drop/data/minecraft/loot_table/blocks/pale_oak_fence_gate.json new file mode 100644 index 00000000..7614cd5c --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/loot_table/blocks/pale_oak_fence_gate.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "minecraft:pale_oak_fence_gate" + } + ], + "rolls": 1.0 + } + ], + "random_sequence": "minecraft:blocks/pale_oak_fence_gate" +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/loot_table/blocks/pale_oak_hanging_sign.json b/data/minecraft/datapacks/winter_drop/data/minecraft/loot_table/blocks/pale_oak_hanging_sign.json new file mode 100644 index 00000000..93f5c08e --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/loot_table/blocks/pale_oak_hanging_sign.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "minecraft:pale_oak_hanging_sign" + } + ], + "rolls": 1.0 + } + ], + "random_sequence": "minecraft:blocks/pale_oak_hanging_sign" +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/loot_table/blocks/pale_oak_leaves.json b/data/minecraft/datapacks/winter_drop/data/minecraft/loot_table/blocks/pale_oak_leaves.json new file mode 100644 index 00000000..1122938a --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/loot_table/blocks/pale_oak_leaves.json @@ -0,0 +1,136 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "bonus_rolls": 0.0, + "entries": [ + { + "type": "minecraft:alternatives", + "children": [ + { + "type": "minecraft:item", + "conditions": [ + { + "condition": "minecraft:any_of", + "terms": [ + { + "condition": "minecraft:match_tool", + "predicate": { + "items": "minecraft:shears" + } + }, + { + "condition": "minecraft:match_tool", + "predicate": { + "predicates": { + "minecraft:enchantments": [ + { + "enchantments": "minecraft:silk_touch", + "levels": { + "min": 1 + } + } + ] + } + } + } + ] + } + ], + "name": "minecraft:pale_oak_leaves" + }, + { + "type": "minecraft:item", + "conditions": [ + { + "condition": "minecraft:survives_explosion" + }, + { + "chances": [ + 0.05, + 0.0625, + 0.083333336, + 0.1 + ], + "condition": "minecraft:table_bonus", + "enchantment": "minecraft:fortune" + } + ], + "name": "minecraft:pale_oak_sapling" + } + ] + } + ], + "rolls": 1.0 + }, + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:inverted", + "term": { + "condition": "minecraft:any_of", + "terms": [ + { + "condition": "minecraft:match_tool", + "predicate": { + "items": "minecraft:shears" + } + }, + { + "condition": "minecraft:match_tool", + "predicate": { + "predicates": { + "minecraft:enchantments": [ + { + "enchantments": "minecraft:silk_touch", + "levels": { + "min": 1 + } + } + ] + } + } + } + ] + } + } + ], + "entries": [ + { + "type": "minecraft:item", + "conditions": [ + { + "chances": [ + 0.02, + 0.022222223, + 0.025, + 0.033333335, + 0.1 + ], + "condition": "minecraft:table_bonus", + "enchantment": "minecraft:fortune" + } + ], + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 2.0, + "min": 1.0 + }, + "function": "minecraft:set_count" + }, + { + "function": "minecraft:explosion_decay" + } + ], + "name": "minecraft:stick" + } + ], + "rolls": 1.0 + } + ], + "random_sequence": "minecraft:blocks/pale_oak_leaves" +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/loot_table/blocks/pale_oak_log.json b/data/minecraft/datapacks/winter_drop/data/minecraft/loot_table/blocks/pale_oak_log.json new file mode 100644 index 00000000..4dc2e078 --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/loot_table/blocks/pale_oak_log.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "minecraft:pale_oak_log" + } + ], + "rolls": 1.0 + } + ], + "random_sequence": "minecraft:blocks/pale_oak_log" +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/loot_table/blocks/pale_oak_planks.json b/data/minecraft/datapacks/winter_drop/data/minecraft/loot_table/blocks/pale_oak_planks.json new file mode 100644 index 00000000..0097b5e0 --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/loot_table/blocks/pale_oak_planks.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "minecraft:pale_oak_planks" + } + ], + "rolls": 1.0 + } + ], + "random_sequence": "minecraft:blocks/pale_oak_planks" +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/loot_table/blocks/pale_oak_pressure_plate.json b/data/minecraft/datapacks/winter_drop/data/minecraft/loot_table/blocks/pale_oak_pressure_plate.json new file mode 100644 index 00000000..45f4fc49 --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/loot_table/blocks/pale_oak_pressure_plate.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "minecraft:pale_oak_pressure_plate" + } + ], + "rolls": 1.0 + } + ], + "random_sequence": "minecraft:blocks/pale_oak_pressure_plate" +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/loot_table/blocks/pale_oak_sapling.json b/data/minecraft/datapacks/winter_drop/data/minecraft/loot_table/blocks/pale_oak_sapling.json new file mode 100644 index 00000000..960d922b --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/loot_table/blocks/pale_oak_sapling.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "minecraft:pale_oak_sapling" + } + ], + "rolls": 1.0 + } + ], + "random_sequence": "minecraft:blocks/pale_oak_sapling" +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/loot_table/blocks/pale_oak_sign.json b/data/minecraft/datapacks/winter_drop/data/minecraft/loot_table/blocks/pale_oak_sign.json new file mode 100644 index 00000000..d46ce7a9 --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/loot_table/blocks/pale_oak_sign.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "minecraft:pale_oak_sign" + } + ], + "rolls": 1.0 + } + ], + "random_sequence": "minecraft:blocks/pale_oak_sign" +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/loot_table/blocks/pale_oak_slab.json b/data/minecraft/datapacks/winter_drop/data/minecraft/loot_table/blocks/pale_oak_slab.json new file mode 100644 index 00000000..6170569b --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/loot_table/blocks/pale_oak_slab.json @@ -0,0 +1,35 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "bonus_rolls": 0.0, + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "conditions": [ + { + "block": "minecraft:pale_oak_slab", + "condition": "minecraft:block_state_property", + "properties": { + "type": "double" + } + } + ], + "count": 2.0, + "function": "minecraft:set_count" + }, + { + "function": "minecraft:explosion_decay" + } + ], + "name": "minecraft:pale_oak_slab" + } + ], + "rolls": 1.0 + } + ], + "random_sequence": "minecraft:blocks/pale_oak_slab" +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/loot_table/blocks/pale_oak_stairs.json b/data/minecraft/datapacks/winter_drop/data/minecraft/loot_table/blocks/pale_oak_stairs.json new file mode 100644 index 00000000..d64c5bf7 --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/loot_table/blocks/pale_oak_stairs.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "minecraft:pale_oak_stairs" + } + ], + "rolls": 1.0 + } + ], + "random_sequence": "minecraft:blocks/pale_oak_stairs" +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/loot_table/blocks/pale_oak_trapdoor.json b/data/minecraft/datapacks/winter_drop/data/minecraft/loot_table/blocks/pale_oak_trapdoor.json new file mode 100644 index 00000000..9acb6ce1 --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/loot_table/blocks/pale_oak_trapdoor.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "minecraft:pale_oak_trapdoor" + } + ], + "rolls": 1.0 + } + ], + "random_sequence": "minecraft:blocks/pale_oak_trapdoor" +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/loot_table/blocks/pale_oak_wood.json b/data/minecraft/datapacks/winter_drop/data/minecraft/loot_table/blocks/pale_oak_wood.json new file mode 100644 index 00000000..128fc986 --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/loot_table/blocks/pale_oak_wood.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "minecraft:pale_oak_wood" + } + ], + "rolls": 1.0 + } + ], + "random_sequence": "minecraft:blocks/pale_oak_wood" +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/loot_table/blocks/potted_pale_oak_sapling.json b/data/minecraft/datapacks/winter_drop/data/minecraft/loot_table/blocks/potted_pale_oak_sapling.json new file mode 100644 index 00000000..7ebed877 --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/loot_table/blocks/potted_pale_oak_sapling.json @@ -0,0 +1,36 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "minecraft:flower_pot" + } + ], + "rolls": 1.0 + }, + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "minecraft:pale_oak_sapling" + } + ], + "rolls": 1.0 + } + ], + "random_sequence": "minecraft:blocks/potted_pale_oak_sapling" +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/loot_table/blocks/stripped_pale_oak_log.json b/data/minecraft/datapacks/winter_drop/data/minecraft/loot_table/blocks/stripped_pale_oak_log.json new file mode 100644 index 00000000..5254c198 --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/loot_table/blocks/stripped_pale_oak_log.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "minecraft:stripped_pale_oak_log" + } + ], + "rolls": 1.0 + } + ], + "random_sequence": "minecraft:blocks/stripped_pale_oak_log" +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/loot_table/blocks/stripped_pale_oak_wood.json b/data/minecraft/datapacks/winter_drop/data/minecraft/loot_table/blocks/stripped_pale_oak_wood.json new file mode 100644 index 00000000..ac053b60 --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/loot_table/blocks/stripped_pale_oak_wood.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "minecraft:stripped_pale_oak_wood" + } + ], + "rolls": 1.0 + } + ], + "random_sequence": "minecraft:blocks/stripped_pale_oak_wood" +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/recipe/pale_moss_carpet.json b/data/minecraft/datapacks/winter_drop/data/minecraft/recipe/pale_moss_carpet.json new file mode 100644 index 00000000..faa8d615 --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/recipe/pale_moss_carpet.json @@ -0,0 +1,15 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "misc", + "group": "carpet", + "key": { + "#": "minecraft:pale_moss_block" + }, + "pattern": [ + "##" + ], + "result": { + "count": 3, + "id": "minecraft:pale_moss_carpet" + } +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/recipe/pale_oak_boat.json b/data/minecraft/datapacks/winter_drop/data/minecraft/recipe/pale_oak_boat.json new file mode 100644 index 00000000..24144384 --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/recipe/pale_oak_boat.json @@ -0,0 +1,16 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "misc", + "group": "boat", + "key": { + "#": "minecraft:pale_oak_planks" + }, + "pattern": [ + "# #", + "###" + ], + "result": { + "count": 1, + "id": "minecraft:pale_oak_boat" + } +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/recipe/pale_oak_button.json b/data/minecraft/datapacks/winter_drop/data/minecraft/recipe/pale_oak_button.json new file mode 100644 index 00000000..bb2816d7 --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/recipe/pale_oak_button.json @@ -0,0 +1,12 @@ +{ + "type": "minecraft:crafting_shapeless", + "category": "redstone", + "group": "wooden_button", + "ingredients": [ + "minecraft:pale_oak_planks" + ], + "result": { + "count": 1, + "id": "minecraft:pale_oak_button" + } +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/recipe/pale_oak_chest_boat.json b/data/minecraft/datapacks/winter_drop/data/minecraft/recipe/pale_oak_chest_boat.json new file mode 100644 index 00000000..87b4ad77 --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/recipe/pale_oak_chest_boat.json @@ -0,0 +1,13 @@ +{ + "type": "minecraft:crafting_shapeless", + "category": "misc", + "group": "chest_boat", + "ingredients": [ + "minecraft:chest", + "minecraft:pale_oak_boat" + ], + "result": { + "count": 1, + "id": "minecraft:pale_oak_chest_boat" + } +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/recipe/pale_oak_door.json b/data/minecraft/datapacks/winter_drop/data/minecraft/recipe/pale_oak_door.json new file mode 100644 index 00000000..667a0fbb --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/recipe/pale_oak_door.json @@ -0,0 +1,17 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "redstone", + "group": "wooden_door", + "key": { + "#": "minecraft:pale_oak_planks" + }, + "pattern": [ + "##", + "##", + "##" + ], + "result": { + "count": 3, + "id": "minecraft:pale_oak_door" + } +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/recipe/pale_oak_fence.json b/data/minecraft/datapacks/winter_drop/data/minecraft/recipe/pale_oak_fence.json new file mode 100644 index 00000000..d7c1563d --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/recipe/pale_oak_fence.json @@ -0,0 +1,17 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "misc", + "group": "wooden_fence", + "key": { + "#": "minecraft:stick", + "W": "minecraft:pale_oak_planks" + }, + "pattern": [ + "W#W", + "W#W" + ], + "result": { + "count": 3, + "id": "minecraft:pale_oak_fence" + } +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/recipe/pale_oak_fence_gate.json b/data/minecraft/datapacks/winter_drop/data/minecraft/recipe/pale_oak_fence_gate.json new file mode 100644 index 00000000..17211df1 --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/recipe/pale_oak_fence_gate.json @@ -0,0 +1,17 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "redstone", + "group": "wooden_fence_gate", + "key": { + "#": "minecraft:stick", + "W": "minecraft:pale_oak_planks" + }, + "pattern": [ + "#W#", + "#W#" + ], + "result": { + "count": 1, + "id": "minecraft:pale_oak_fence_gate" + } +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/recipe/pale_oak_hanging_sign.json b/data/minecraft/datapacks/winter_drop/data/minecraft/recipe/pale_oak_hanging_sign.json new file mode 100644 index 00000000..98b16656 --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/recipe/pale_oak_hanging_sign.json @@ -0,0 +1,18 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "misc", + "group": "hanging_sign", + "key": { + "#": "minecraft:stripped_pale_oak_log", + "X": "minecraft:chain" + }, + "pattern": [ + "X X", + "###", + "###" + ], + "result": { + "count": 6, + "id": "minecraft:pale_oak_hanging_sign" + } +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/recipe/pale_oak_planks.json b/data/minecraft/datapacks/winter_drop/data/minecraft/recipe/pale_oak_planks.json new file mode 100644 index 00000000..f7829e5f --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/recipe/pale_oak_planks.json @@ -0,0 +1,12 @@ +{ + "type": "minecraft:crafting_shapeless", + "category": "building", + "group": "planks", + "ingredients": [ + "#minecraft:pale_oak_logs" + ], + "result": { + "count": 4, + "id": "minecraft:pale_oak_planks" + } +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/recipe/pale_oak_pressure_plate.json b/data/minecraft/datapacks/winter_drop/data/minecraft/recipe/pale_oak_pressure_plate.json new file mode 100644 index 00000000..7b15fe35 --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/recipe/pale_oak_pressure_plate.json @@ -0,0 +1,15 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "redstone", + "group": "wooden_pressure_plate", + "key": { + "#": "minecraft:pale_oak_planks" + }, + "pattern": [ + "##" + ], + "result": { + "count": 1, + "id": "minecraft:pale_oak_pressure_plate" + } +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/recipe/pale_oak_sign.json b/data/minecraft/datapacks/winter_drop/data/minecraft/recipe/pale_oak_sign.json new file mode 100644 index 00000000..e6166e9f --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/recipe/pale_oak_sign.json @@ -0,0 +1,18 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "misc", + "group": "wooden_sign", + "key": { + "#": "minecraft:pale_oak_planks", + "X": "minecraft:stick" + }, + "pattern": [ + "###", + "###", + " X " + ], + "result": { + "count": 3, + "id": "minecraft:pale_oak_sign" + } +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/recipe/pale_oak_slab.json b/data/minecraft/datapacks/winter_drop/data/minecraft/recipe/pale_oak_slab.json new file mode 100644 index 00000000..db6de77f --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/recipe/pale_oak_slab.json @@ -0,0 +1,15 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "building", + "group": "wooden_slab", + "key": { + "#": "minecraft:pale_oak_planks" + }, + "pattern": [ + "###" + ], + "result": { + "count": 6, + "id": "minecraft:pale_oak_slab" + } +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/recipe/pale_oak_stairs.json b/data/minecraft/datapacks/winter_drop/data/minecraft/recipe/pale_oak_stairs.json new file mode 100644 index 00000000..7c5baf2e --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/recipe/pale_oak_stairs.json @@ -0,0 +1,17 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "building", + "group": "wooden_stairs", + "key": { + "#": "minecraft:pale_oak_planks" + }, + "pattern": [ + "# ", + "## ", + "###" + ], + "result": { + "count": 4, + "id": "minecraft:pale_oak_stairs" + } +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/recipe/pale_oak_trapdoor.json b/data/minecraft/datapacks/winter_drop/data/minecraft/recipe/pale_oak_trapdoor.json new file mode 100644 index 00000000..5f17d759 --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/recipe/pale_oak_trapdoor.json @@ -0,0 +1,16 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "redstone", + "group": "wooden_trapdoor", + "key": { + "#": "minecraft:pale_oak_planks" + }, + "pattern": [ + "###", + "###" + ], + "result": { + "count": 2, + "id": "minecraft:pale_oak_trapdoor" + } +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/recipe/pale_oak_wood.json b/data/minecraft/datapacks/winter_drop/data/minecraft/recipe/pale_oak_wood.json new file mode 100644 index 00000000..e2acd099 --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/recipe/pale_oak_wood.json @@ -0,0 +1,16 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "building", + "group": "bark", + "key": { + "#": "minecraft:pale_oak_log" + }, + "pattern": [ + "##", + "##" + ], + "result": { + "count": 3, + "id": "minecraft:pale_oak_wood" + } +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/recipe/stripped_pale_oak_wood.json b/data/minecraft/datapacks/winter_drop/data/minecraft/recipe/stripped_pale_oak_wood.json new file mode 100644 index 00000000..b6169e2b --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/recipe/stripped_pale_oak_wood.json @@ -0,0 +1,16 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "building", + "group": "bark", + "key": { + "#": "minecraft:stripped_pale_oak_log" + }, + "pattern": [ + "##", + "##" + ], + "result": { + "count": 3, + "id": "minecraft:stripped_pale_oak_wood" + } +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/tags/block/ceiling_hanging_signs.json b/data/minecraft/datapacks/winter_drop/data/minecraft/tags/block/ceiling_hanging_signs.json new file mode 100644 index 00000000..b446dbd0 --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/tags/block/ceiling_hanging_signs.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:pale_oak_hanging_sign" + ] +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/tags/block/combination_step_sound_blocks.json b/data/minecraft/datapacks/winter_drop/data/minecraft/tags/block/combination_step_sound_blocks.json new file mode 100644 index 00000000..be02e6ad --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/tags/block/combination_step_sound_blocks.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:pale_moss_carpet" + ] +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/tags/block/dirt.json b/data/minecraft/datapacks/winter_drop/data/minecraft/tags/block/dirt.json new file mode 100644 index 00000000..39ea165c --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/tags/block/dirt.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:pale_moss_block" + ] +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/tags/block/fence_gates.json b/data/minecraft/datapacks/winter_drop/data/minecraft/tags/block/fence_gates.json new file mode 100644 index 00000000..3ff6469d --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/tags/block/fence_gates.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:pale_oak_fence_gate" + ] +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/tags/block/flower_pots.json b/data/minecraft/datapacks/winter_drop/data/minecraft/tags/block/flower_pots.json new file mode 100644 index 00000000..28754e83 --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/tags/block/flower_pots.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:potted_pale_oak_sapling" + ] +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/tags/block/leaves.json b/data/minecraft/datapacks/winter_drop/data/minecraft/tags/block/leaves.json new file mode 100644 index 00000000..8eee584d --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/tags/block/leaves.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:pale_oak_leaves" + ] +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/tags/block/logs_that_burn.json b/data/minecraft/datapacks/winter_drop/data/minecraft/tags/block/logs_that_burn.json new file mode 100644 index 00000000..9729f24d --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/tags/block/logs_that_burn.json @@ -0,0 +1,5 @@ +{ + "values": [ + "#minecraft:pale_oak_logs" + ] +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/tags/block/mineable/axe.json b/data/minecraft/datapacks/winter_drop/data/minecraft/tags/block/mineable/axe.json new file mode 100644 index 00000000..7c0cd811 --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/tags/block/mineable/axe.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:creaking_heart" + ] +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/tags/block/mineable/hoe.json b/data/minecraft/datapacks/winter_drop/data/minecraft/tags/block/mineable/hoe.json new file mode 100644 index 00000000..fb91ba32 --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/tags/block/mineable/hoe.json @@ -0,0 +1,7 @@ +{ + "values": [ + "minecraft:pale_oak_leaves", + "minecraft:pale_moss_block", + "minecraft:pale_moss_carpet" + ] +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/tags/block/overworld_natural_logs.json b/data/minecraft/datapacks/winter_drop/data/minecraft/tags/block/overworld_natural_logs.json new file mode 100644 index 00000000..50f65eb8 --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/tags/block/overworld_natural_logs.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:pale_oak_log" + ] +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/tags/block/pale_oak_logs.json b/data/minecraft/datapacks/winter_drop/data/minecraft/tags/block/pale_oak_logs.json new file mode 100644 index 00000000..928a458b --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/tags/block/pale_oak_logs.json @@ -0,0 +1,8 @@ +{ + "values": [ + "minecraft:pale_oak_log", + "minecraft:pale_oak_wood", + "minecraft:stripped_pale_oak_log", + "minecraft:stripped_pale_oak_wood" + ] +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/tags/block/planks.json b/data/minecraft/datapacks/winter_drop/data/minecraft/tags/block/planks.json new file mode 100644 index 00000000..8091821d --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/tags/block/planks.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:pale_oak_planks" + ] +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/tags/block/saplings.json b/data/minecraft/datapacks/winter_drop/data/minecraft/tags/block/saplings.json new file mode 100644 index 00000000..caa562a2 --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/tags/block/saplings.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:pale_oak_sapling" + ] +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/tags/block/standing_signs.json b/data/minecraft/datapacks/winter_drop/data/minecraft/tags/block/standing_signs.json new file mode 100644 index 00000000..2721611a --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/tags/block/standing_signs.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:pale_oak_sign" + ] +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/tags/block/sword_efficient.json b/data/minecraft/datapacks/winter_drop/data/minecraft/tags/block/sword_efficient.json new file mode 100644 index 00000000..be02e6ad --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/tags/block/sword_efficient.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:pale_moss_carpet" + ] +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/tags/block/wall_hanging_signs.json b/data/minecraft/datapacks/winter_drop/data/minecraft/tags/block/wall_hanging_signs.json new file mode 100644 index 00000000..f4a00a9f --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/tags/block/wall_hanging_signs.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:pale_oak_wall_hanging_sign" + ] +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/tags/block/wall_signs.json b/data/minecraft/datapacks/winter_drop/data/minecraft/tags/block/wall_signs.json new file mode 100644 index 00000000..37546445 --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/tags/block/wall_signs.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:pale_oak_wall_sign" + ] +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/tags/block/wooden_buttons.json b/data/minecraft/datapacks/winter_drop/data/minecraft/tags/block/wooden_buttons.json new file mode 100644 index 00000000..5bbbea72 --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/tags/block/wooden_buttons.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:pale_oak_button" + ] +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/tags/block/wooden_doors.json b/data/minecraft/datapacks/winter_drop/data/minecraft/tags/block/wooden_doors.json new file mode 100644 index 00000000..17036482 --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/tags/block/wooden_doors.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:pale_oak_door" + ] +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/tags/block/wooden_fences.json b/data/minecraft/datapacks/winter_drop/data/minecraft/tags/block/wooden_fences.json new file mode 100644 index 00000000..4010b73a --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/tags/block/wooden_fences.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:pale_oak_fence" + ] +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/tags/block/wooden_pressure_plates.json b/data/minecraft/datapacks/winter_drop/data/minecraft/tags/block/wooden_pressure_plates.json new file mode 100644 index 00000000..057d1bbc --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/tags/block/wooden_pressure_plates.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:pale_oak_pressure_plate" + ] +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/tags/block/wooden_slabs.json b/data/minecraft/datapacks/winter_drop/data/minecraft/tags/block/wooden_slabs.json new file mode 100644 index 00000000..5542b1d4 --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/tags/block/wooden_slabs.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:pale_oak_slab" + ] +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/tags/block/wooden_stairs.json b/data/minecraft/datapacks/winter_drop/data/minecraft/tags/block/wooden_stairs.json new file mode 100644 index 00000000..009f67b7 --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/tags/block/wooden_stairs.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:pale_oak_stairs" + ] +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/tags/block/wooden_trapdoors.json b/data/minecraft/datapacks/winter_drop/data/minecraft/tags/block/wooden_trapdoors.json new file mode 100644 index 00000000..cc39955f --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/tags/block/wooden_trapdoors.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:pale_oak_trapdoor" + ] +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/tags/entity_type/boat.json b/data/minecraft/datapacks/winter_drop/data/minecraft/tags/entity_type/boat.json new file mode 100644 index 00000000..78a3ec94 --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/tags/entity_type/boat.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:pale_oak_boat" + ] +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/tags/item/boats.json b/data/minecraft/datapacks/winter_drop/data/minecraft/tags/item/boats.json new file mode 100644 index 00000000..78a3ec94 --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/tags/item/boats.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:pale_oak_boat" + ] +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/tags/item/chest_boats.json b/data/minecraft/datapacks/winter_drop/data/minecraft/tags/item/chest_boats.json new file mode 100644 index 00000000..8b94bd21 --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/tags/item/chest_boats.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:pale_oak_chest_boat" + ] +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/tags/item/dirt.json b/data/minecraft/datapacks/winter_drop/data/minecraft/tags/item/dirt.json new file mode 100644 index 00000000..39ea165c --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/tags/item/dirt.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:pale_moss_block" + ] +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/tags/item/fence_gates.json b/data/minecraft/datapacks/winter_drop/data/minecraft/tags/item/fence_gates.json new file mode 100644 index 00000000..3ff6469d --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/tags/item/fence_gates.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:pale_oak_fence_gate" + ] +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/tags/item/hanging_signs.json b/data/minecraft/datapacks/winter_drop/data/minecraft/tags/item/hanging_signs.json new file mode 100644 index 00000000..b446dbd0 --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/tags/item/hanging_signs.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:pale_oak_hanging_sign" + ] +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/tags/item/leaves.json b/data/minecraft/datapacks/winter_drop/data/minecraft/tags/item/leaves.json new file mode 100644 index 00000000..8eee584d --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/tags/item/leaves.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:pale_oak_leaves" + ] +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/tags/item/logs_that_burn.json b/data/minecraft/datapacks/winter_drop/data/minecraft/tags/item/logs_that_burn.json new file mode 100644 index 00000000..9729f24d --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/tags/item/logs_that_burn.json @@ -0,0 +1,5 @@ +{ + "values": [ + "#minecraft:pale_oak_logs" + ] +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/tags/item/pale_oak_logs.json b/data/minecraft/datapacks/winter_drop/data/minecraft/tags/item/pale_oak_logs.json new file mode 100644 index 00000000..928a458b --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/tags/item/pale_oak_logs.json @@ -0,0 +1,8 @@ +{ + "values": [ + "minecraft:pale_oak_log", + "minecraft:pale_oak_wood", + "minecraft:stripped_pale_oak_log", + "minecraft:stripped_pale_oak_wood" + ] +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/tags/item/planks.json b/data/minecraft/datapacks/winter_drop/data/minecraft/tags/item/planks.json new file mode 100644 index 00000000..8091821d --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/tags/item/planks.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:pale_oak_planks" + ] +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/tags/item/saplings.json b/data/minecraft/datapacks/winter_drop/data/minecraft/tags/item/saplings.json new file mode 100644 index 00000000..caa562a2 --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/tags/item/saplings.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:pale_oak_sapling" + ] +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/tags/item/signs.json b/data/minecraft/datapacks/winter_drop/data/minecraft/tags/item/signs.json new file mode 100644 index 00000000..2721611a --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/tags/item/signs.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:pale_oak_sign" + ] +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/tags/item/wooden_buttons.json b/data/minecraft/datapacks/winter_drop/data/minecraft/tags/item/wooden_buttons.json new file mode 100644 index 00000000..5bbbea72 --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/tags/item/wooden_buttons.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:pale_oak_button" + ] +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/tags/item/wooden_doors.json b/data/minecraft/datapacks/winter_drop/data/minecraft/tags/item/wooden_doors.json new file mode 100644 index 00000000..17036482 --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/tags/item/wooden_doors.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:pale_oak_door" + ] +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/tags/item/wooden_fences.json b/data/minecraft/datapacks/winter_drop/data/minecraft/tags/item/wooden_fences.json new file mode 100644 index 00000000..4010b73a --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/tags/item/wooden_fences.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:pale_oak_fence" + ] +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/tags/item/wooden_pressure_plates.json b/data/minecraft/datapacks/winter_drop/data/minecraft/tags/item/wooden_pressure_plates.json new file mode 100644 index 00000000..057d1bbc --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/tags/item/wooden_pressure_plates.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:pale_oak_pressure_plate" + ] +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/tags/item/wooden_slabs.json b/data/minecraft/datapacks/winter_drop/data/minecraft/tags/item/wooden_slabs.json new file mode 100644 index 00000000..5542b1d4 --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/tags/item/wooden_slabs.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:pale_oak_slab" + ] +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/tags/item/wooden_stairs.json b/data/minecraft/datapacks/winter_drop/data/minecraft/tags/item/wooden_stairs.json new file mode 100644 index 00000000..009f67b7 --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/tags/item/wooden_stairs.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:pale_oak_stairs" + ] +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/tags/item/wooden_trapdoors.json b/data/minecraft/datapacks/winter_drop/data/minecraft/tags/item/wooden_trapdoors.json new file mode 100644 index 00000000..cc39955f --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/tags/item/wooden_trapdoors.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:pale_oak_trapdoor" + ] +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/tags/worldgen/biome/has_structure/trial_chambers.json b/data/minecraft/datapacks/winter_drop/data/minecraft/tags/worldgen/biome/has_structure/trial_chambers.json new file mode 100644 index 00000000..16abb77c --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/tags/worldgen/biome/has_structure/trial_chambers.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:pale_garden" + ] +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/tags/worldgen/biome/is_forest.json b/data/minecraft/datapacks/winter_drop/data/minecraft/tags/worldgen/biome/is_forest.json new file mode 100644 index 00000000..16abb77c --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/tags/worldgen/biome/is_forest.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:pale_garden" + ] +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/tags/worldgen/biome/is_overworld.json b/data/minecraft/datapacks/winter_drop/data/minecraft/tags/worldgen/biome/is_overworld.json new file mode 100644 index 00000000..16abb77c --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/tags/worldgen/biome/is_overworld.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:pale_garden" + ] +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/tags/worldgen/biome/stronghold_biased_to.json b/data/minecraft/datapacks/winter_drop/data/minecraft/tags/worldgen/biome/stronghold_biased_to.json new file mode 100644 index 00000000..16abb77c --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/tags/worldgen/biome/stronghold_biased_to.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:pale_garden" + ] +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/worldgen/biome/pale_garden.json b/data/minecraft/datapacks/winter_drop/data/minecraft/worldgen/biome/pale_garden.json new file mode 100644 index 00000000..1aa58bdc --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/worldgen/biome/pale_garden.json @@ -0,0 +1,166 @@ +{ + "carvers": [ + "minecraft:cave", + "minecraft:cave_extra_underground", + "minecraft:canyon" + ], + "downfall": 0.8, + "effects": { + "fog_color": 8484720, + "foliage_color": 8883574, + "grass_color": 7832178, + "mood_sound": { + "block_search_extent": 8, + "offset": 2.0, + "sound": "minecraft:ambient.cave", + "tick_delay": 6000 + }, + "music": { + "max_delay": 24000, + "min_delay": 12000, + "replace_current_music": false, + "sound": "minecraft:music.overworld.forest" + }, + "sky_color": 12171705, + "water_color": 7768221, + "water_fog_color": 5597568 + }, + "features": [ + [], + [ + "minecraft:lake_lava_underground", + "minecraft:lake_lava_surface" + ], + [ + "minecraft:amethyst_geode" + ], + [ + "minecraft:monster_room", + "minecraft:monster_room_deep" + ], + [], + [], + [ + "minecraft:ore_dirt", + "minecraft:ore_gravel", + "minecraft:ore_granite_upper", + "minecraft:ore_granite_lower", + "minecraft:ore_diorite_upper", + "minecraft:ore_diorite_lower", + "minecraft:ore_andesite_upper", + "minecraft:ore_andesite_lower", + "minecraft:ore_tuff", + "minecraft:ore_coal_upper", + "minecraft:ore_coal_lower", + "minecraft:ore_iron_upper", + "minecraft:ore_iron_middle", + "minecraft:ore_iron_small", + "minecraft:ore_gold", + "minecraft:ore_gold_lower", + "minecraft:ore_redstone", + "minecraft:ore_redstone_lower", + "minecraft:ore_diamond", + "minecraft:ore_diamond_medium", + "minecraft:ore_diamond_large", + "minecraft:ore_diamond_buried", + "minecraft:ore_lapis", + "minecraft:ore_lapis_buried", + "minecraft:ore_copper", + "minecraft:underwater_magma", + "minecraft:disk_sand", + "minecraft:disk_clay", + "minecraft:disk_gravel" + ], + [], + [ + "minecraft:spring_water", + "minecraft:spring_lava" + ], + [ + "minecraft:glow_lichen", + "minecraft:pale_garden_vegetation", + "minecraft:patch_grass_forest", + "minecraft:patch_sugar_cane", + "minecraft:patch_pumpkin" + ], + [ + "minecraft:freeze_top_layer" + ] + ], + "has_precipitation": true, + "spawn_costs": {}, + "spawners": { + "ambient": [ + { + "type": "minecraft:bat", + "maxCount": 8, + "minCount": 8, + "weight": 10 + } + ], + "axolotls": [], + "creature": [], + "misc": [], + "monster": [ + { + "type": "minecraft:spider", + "maxCount": 4, + "minCount": 4, + "weight": 100 + }, + { + "type": "minecraft:zombie", + "maxCount": 4, + "minCount": 4, + "weight": 95 + }, + { + "type": "minecraft:zombie_villager", + "maxCount": 1, + "minCount": 1, + "weight": 5 + }, + { + "type": "minecraft:skeleton", + "maxCount": 4, + "minCount": 4, + "weight": 100 + }, + { + "type": "minecraft:creeper", + "maxCount": 4, + "minCount": 4, + "weight": 100 + }, + { + "type": "minecraft:slime", + "maxCount": 4, + "minCount": 4, + "weight": 100 + }, + { + "type": "minecraft:enderman", + "maxCount": 4, + "minCount": 1, + "weight": 10 + }, + { + "type": "minecraft:witch", + "maxCount": 1, + "minCount": 1, + "weight": 5 + } + ], + "underground_water_creature": [ + { + "type": "minecraft:glow_squid", + "maxCount": 6, + "minCount": 4, + "weight": 10 + } + ], + "water_ambient": [], + "water_creature": [] + }, + "temperature": 0.7 +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/data/minecraft/worldgen/multi_noise_biome_source_parameter_list/overworld.json b/data/minecraft/datapacks/winter_drop/data/minecraft/worldgen/multi_noise_biome_source_parameter_list/overworld.json new file mode 100644 index 00000000..4acb5d56 --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/data/minecraft/worldgen/multi_noise_biome_source_parameter_list/overworld.json @@ -0,0 +1,3 @@ +{ + "preset": "minecraft:overworld_winter_drop" +} \ No newline at end of file diff --git a/data/minecraft/datapacks/winter_drop/pack.mcmeta b/data/minecraft/datapacks/winter_drop/pack.mcmeta new file mode 100644 index 00000000..cec534b4 --- /dev/null +++ b/data/minecraft/datapacks/winter_drop/pack.mcmeta @@ -0,0 +1,13 @@ +{ + "features": { + "enabled": [ + "minecraft:winter_drop" + ] + }, + "pack": { + "description": { + "translate": "dataPack.winter_drop.description" + }, + "pack_format": 57 + } +} \ No newline at end of file diff --git a/data/minecraft/enchantment/aqua_affinity.json b/data/minecraft/enchantment/aqua_affinity.json index 42c54611..ea88d33c 100644 --- a/data/minecraft/enchantment/aqua_affinity.json +++ b/data/minecraft/enchantment/aqua_affinity.json @@ -11,7 +11,7 @@ "base": 4.0, "per_level_above_first": 4.0 }, - "attribute": "minecraft:player.submerged_mining_speed", + "attribute": "minecraft:submerged_mining_speed", "id": "minecraft:enchantment.aqua_affinity", "operation": "add_multiplied_total" } diff --git a/data/minecraft/enchantment/blast_protection.json b/data/minecraft/enchantment/blast_protection.json index aa6d78fb..a8a036de 100644 --- a/data/minecraft/enchantment/blast_protection.json +++ b/data/minecraft/enchantment/blast_protection.json @@ -11,7 +11,7 @@ "base": 0.15, "per_level_above_first": 0.15 }, - "attribute": "minecraft:generic.explosion_knockback_resistance", + "attribute": "minecraft:explosion_knockback_resistance", "id": "minecraft:enchantment.blast_protection", "operation": "add_value" } diff --git a/data/minecraft/enchantment/depth_strider.json b/data/minecraft/enchantment/depth_strider.json index 02397701..a13601e5 100644 --- a/data/minecraft/enchantment/depth_strider.json +++ b/data/minecraft/enchantment/depth_strider.json @@ -11,7 +11,7 @@ "base": 0.33333334, "per_level_above_first": 0.33333334 }, - "attribute": "minecraft:generic.water_movement_efficiency", + "attribute": "minecraft:water_movement_efficiency", "id": "minecraft:enchantment.depth_strider", "operation": "add_value" } diff --git a/data/minecraft/enchantment/efficiency.json b/data/minecraft/enchantment/efficiency.json index 28ed6e76..749d701f 100644 --- a/data/minecraft/enchantment/efficiency.json +++ b/data/minecraft/enchantment/efficiency.json @@ -10,7 +10,7 @@ "type": "minecraft:levels_squared", "added": 1.0 }, - "attribute": "minecraft:player.mining_efficiency", + "attribute": "minecraft:mining_efficiency", "id": "minecraft:enchantment.efficiency", "operation": "add_value" } diff --git a/data/minecraft/enchantment/fire_protection.json b/data/minecraft/enchantment/fire_protection.json index 4769e89e..fc6e32e4 100644 --- a/data/minecraft/enchantment/fire_protection.json +++ b/data/minecraft/enchantment/fire_protection.json @@ -11,7 +11,7 @@ "base": -0.15, "per_level_above_first": -0.15 }, - "attribute": "minecraft:generic.burning_time", + "attribute": "minecraft:burning_time", "id": "minecraft:enchantment.fire_protection", "operation": "add_multiplied_base" } diff --git a/data/minecraft/enchantment/respiration.json b/data/minecraft/enchantment/respiration.json index 6447425d..9b7bf1c7 100644 --- a/data/minecraft/enchantment/respiration.json +++ b/data/minecraft/enchantment/respiration.json @@ -11,7 +11,7 @@ "base": 1.0, "per_level_above_first": 1.0 }, - "attribute": "minecraft:generic.oxygen_bonus", + "attribute": "minecraft:oxygen_bonus", "id": "minecraft:enchantment.respiration", "operation": "add_value" } diff --git a/data/minecraft/enchantment/soul_speed.json b/data/minecraft/enchantment/soul_speed.json index aac36c45..a0f59080 100644 --- a/data/minecraft/enchantment/soul_speed.json +++ b/data/minecraft/enchantment/soul_speed.json @@ -7,15 +7,27 @@ "minecraft:location_changed": [ { "effect": { - "type": "minecraft:attribute", - "amount": { - "type": "minecraft:linear", - "base": 0.0405, - "per_level_above_first": 0.0105 - }, - "attribute": "minecraft:generic.movement_speed", - "id": "minecraft:enchantment.soul_speed", - "operation": "add_value" + "type": "minecraft:all_of", + "effects": [ + { + "type": "minecraft:attribute", + "amount": { + "type": "minecraft:linear", + "base": 0.0405, + "per_level_above_first": 0.0105 + }, + "attribute": "minecraft:movement_speed", + "id": "minecraft:enchantment.soul_speed", + "operation": "add_value" + }, + { + "type": "minecraft:attribute", + "amount": 1.0, + "attribute": "minecraft:movement_efficiency", + "id": "minecraft:enchantment.soul_speed", + "operation": "add_value" + } + ] }, "requirements": { "condition": "minecraft:all_of", @@ -106,27 +118,7 @@ }, { "effect": { - "type": "minecraft:attribute", - "amount": 1.0, - "attribute": "minecraft:generic.movement_efficiency", - "id": "minecraft:enchantment.soul_speed", - "operation": "add_value" - }, - "requirements": { - "condition": "minecraft:entity_properties", - "entity": "this", - "predicate": { - "movement_affected_by": { - "block": { - "blocks": "#minecraft:soul_speed_blocks" - } - } - } - } - }, - { - "effect": { - "type": "minecraft:damage_item", + "type": "minecraft:change_item_damage", "amount": 1.0 }, "requirements": { diff --git a/data/minecraft/enchantment/sweeping_edge.json b/data/minecraft/enchantment/sweeping_edge.json index 708011c3..ea073351 100644 --- a/data/minecraft/enchantment/sweeping_edge.json +++ b/data/minecraft/enchantment/sweeping_edge.json @@ -19,7 +19,7 @@ "per_level_above_first": 1.0 } }, - "attribute": "minecraft:player.sweeping_damage_ratio", + "attribute": "minecraft:sweeping_damage_ratio", "id": "minecraft:enchantment.sweeping_edge", "operation": "add_value" } diff --git a/data/minecraft/enchantment/swift_sneak.json b/data/minecraft/enchantment/swift_sneak.json index 0809bb5d..7b4a36b6 100644 --- a/data/minecraft/enchantment/swift_sneak.json +++ b/data/minecraft/enchantment/swift_sneak.json @@ -11,7 +11,7 @@ "base": 0.15, "per_level_above_first": 0.15 }, - "attribute": "minecraft:player.sneaking_speed", + "attribute": "minecraft:sneaking_speed", "id": "minecraft:enchantment.swift_sneak", "operation": "add_value" } diff --git a/data/minecraft/enchantment/thorns.json b/data/minecraft/enchantment/thorns.json index 0f0d4c38..178396c5 100644 --- a/data/minecraft/enchantment/thorns.json +++ b/data/minecraft/enchantment/thorns.json @@ -17,7 +17,7 @@ "min_damage": 1.0 }, { - "type": "minecraft:damage_item", + "type": "minecraft:change_item_damage", "amount": 2.0 } ] diff --git a/data/minecraft/instrument/admire_goat_horn.json b/data/minecraft/instrument/admire_goat_horn.json new file mode 100644 index 00000000..62fbefe4 --- /dev/null +++ b/data/minecraft/instrument/admire_goat_horn.json @@ -0,0 +1,8 @@ +{ + "description": { + "translate": "instrument.minecraft.admire_goat_horn" + }, + "range": 256.0, + "sound_event": "minecraft:item.goat_horn.sound.4", + "use_duration": 7.0 +} \ No newline at end of file diff --git a/data/minecraft/instrument/call_goat_horn.json b/data/minecraft/instrument/call_goat_horn.json new file mode 100644 index 00000000..11894ccd --- /dev/null +++ b/data/minecraft/instrument/call_goat_horn.json @@ -0,0 +1,8 @@ +{ + "description": { + "translate": "instrument.minecraft.call_goat_horn" + }, + "range": 256.0, + "sound_event": "minecraft:item.goat_horn.sound.5", + "use_duration": 7.0 +} \ No newline at end of file diff --git a/data/minecraft/instrument/dream_goat_horn.json b/data/minecraft/instrument/dream_goat_horn.json new file mode 100644 index 00000000..b1379d31 --- /dev/null +++ b/data/minecraft/instrument/dream_goat_horn.json @@ -0,0 +1,8 @@ +{ + "description": { + "translate": "instrument.minecraft.dream_goat_horn" + }, + "range": 256.0, + "sound_event": "minecraft:item.goat_horn.sound.7", + "use_duration": 7.0 +} \ No newline at end of file diff --git a/data/minecraft/instrument/feel_goat_horn.json b/data/minecraft/instrument/feel_goat_horn.json new file mode 100644 index 00000000..09911ed6 --- /dev/null +++ b/data/minecraft/instrument/feel_goat_horn.json @@ -0,0 +1,8 @@ +{ + "description": { + "translate": "instrument.minecraft.feel_goat_horn" + }, + "range": 256.0, + "sound_event": "minecraft:item.goat_horn.sound.3", + "use_duration": 7.0 +} \ No newline at end of file diff --git a/data/minecraft/instrument/ponder_goat_horn.json b/data/minecraft/instrument/ponder_goat_horn.json new file mode 100644 index 00000000..ba0c285b --- /dev/null +++ b/data/minecraft/instrument/ponder_goat_horn.json @@ -0,0 +1,8 @@ +{ + "description": { + "translate": "instrument.minecraft.ponder_goat_horn" + }, + "range": 256.0, + "sound_event": "minecraft:item.goat_horn.sound.0", + "use_duration": 7.0 +} \ No newline at end of file diff --git a/data/minecraft/instrument/seek_goat_horn.json b/data/minecraft/instrument/seek_goat_horn.json new file mode 100644 index 00000000..d9c27978 --- /dev/null +++ b/data/minecraft/instrument/seek_goat_horn.json @@ -0,0 +1,8 @@ +{ + "description": { + "translate": "instrument.minecraft.seek_goat_horn" + }, + "range": 256.0, + "sound_event": "minecraft:item.goat_horn.sound.2", + "use_duration": 7.0 +} \ No newline at end of file diff --git a/data/minecraft/instrument/sing_goat_horn.json b/data/minecraft/instrument/sing_goat_horn.json new file mode 100644 index 00000000..0de5cf2f --- /dev/null +++ b/data/minecraft/instrument/sing_goat_horn.json @@ -0,0 +1,8 @@ +{ + "description": { + "translate": "instrument.minecraft.sing_goat_horn" + }, + "range": 256.0, + "sound_event": "minecraft:item.goat_horn.sound.1", + "use_duration": 7.0 +} \ No newline at end of file diff --git a/data/minecraft/instrument/yearn_goat_horn.json b/data/minecraft/instrument/yearn_goat_horn.json new file mode 100644 index 00000000..b562490d --- /dev/null +++ b/data/minecraft/instrument/yearn_goat_horn.json @@ -0,0 +1,8 @@ +{ + "description": { + "translate": "instrument.minecraft.yearn_goat_horn" + }, + "range": 256.0, + "sound_event": "minecraft:item.goat_horn.sound.6", + "use_duration": 7.0 +} \ No newline at end of file diff --git a/data/minecraft/loot_table/blocks/black_banner.json b/data/minecraft/loot_table/blocks/black_banner.json index 92892bd9..58bb186e 100644 --- a/data/minecraft/loot_table/blocks/black_banner.json +++ b/data/minecraft/loot_table/blocks/black_banner.json @@ -18,7 +18,8 @@ "minecraft:custom_name", "minecraft:item_name", "minecraft:hide_additional_tooltip", - "minecraft:banner_patterns" + "minecraft:banner_patterns", + "minecraft:rarity" ], "source": "block_entity" } diff --git a/data/minecraft/loot_table/blocks/blue_banner.json b/data/minecraft/loot_table/blocks/blue_banner.json index 9435fdeb..c5579a8a 100644 --- a/data/minecraft/loot_table/blocks/blue_banner.json +++ b/data/minecraft/loot_table/blocks/blue_banner.json @@ -18,7 +18,8 @@ "minecraft:custom_name", "minecraft:item_name", "minecraft:hide_additional_tooltip", - "minecraft:banner_patterns" + "minecraft:banner_patterns", + "minecraft:rarity" ], "source": "block_entity" } diff --git a/data/minecraft/loot_table/blocks/brown_banner.json b/data/minecraft/loot_table/blocks/brown_banner.json index e6da1203..36beb1fc 100644 --- a/data/minecraft/loot_table/blocks/brown_banner.json +++ b/data/minecraft/loot_table/blocks/brown_banner.json @@ -18,7 +18,8 @@ "minecraft:custom_name", "minecraft:item_name", "minecraft:hide_additional_tooltip", - "minecraft:banner_patterns" + "minecraft:banner_patterns", + "minecraft:rarity" ], "source": "block_entity" } diff --git a/data/minecraft/loot_table/blocks/creaking_heart.json b/data/minecraft/loot_table/blocks/creaking_heart.json new file mode 100644 index 00000000..3190c9a3 --- /dev/null +++ b/data/minecraft/loot_table/blocks/creaking_heart.json @@ -0,0 +1,4 @@ +{ + "type": "minecraft:block", + "random_sequence": "minecraft:blocks/creaking_heart" +} \ No newline at end of file diff --git a/data/minecraft/loot_table/blocks/cyan_banner.json b/data/minecraft/loot_table/blocks/cyan_banner.json index 77ab28ee..45c30619 100644 --- a/data/minecraft/loot_table/blocks/cyan_banner.json +++ b/data/minecraft/loot_table/blocks/cyan_banner.json @@ -18,7 +18,8 @@ "minecraft:custom_name", "minecraft:item_name", "minecraft:hide_additional_tooltip", - "minecraft:banner_patterns" + "minecraft:banner_patterns", + "minecraft:rarity" ], "source": "block_entity" } diff --git a/data/minecraft/loot_table/blocks/gray_banner.json b/data/minecraft/loot_table/blocks/gray_banner.json index 3a435453..bde4a17a 100644 --- a/data/minecraft/loot_table/blocks/gray_banner.json +++ b/data/minecraft/loot_table/blocks/gray_banner.json @@ -18,7 +18,8 @@ "minecraft:custom_name", "minecraft:item_name", "minecraft:hide_additional_tooltip", - "minecraft:banner_patterns" + "minecraft:banner_patterns", + "minecraft:rarity" ], "source": "block_entity" } diff --git a/data/minecraft/loot_table/blocks/green_banner.json b/data/minecraft/loot_table/blocks/green_banner.json index 20884f5e..f58d0453 100644 --- a/data/minecraft/loot_table/blocks/green_banner.json +++ b/data/minecraft/loot_table/blocks/green_banner.json @@ -18,7 +18,8 @@ "minecraft:custom_name", "minecraft:item_name", "minecraft:hide_additional_tooltip", - "minecraft:banner_patterns" + "minecraft:banner_patterns", + "minecraft:rarity" ], "source": "block_entity" } diff --git a/data/minecraft/loot_table/blocks/light_blue_banner.json b/data/minecraft/loot_table/blocks/light_blue_banner.json index 85a3075e..0c56fa54 100644 --- a/data/minecraft/loot_table/blocks/light_blue_banner.json +++ b/data/minecraft/loot_table/blocks/light_blue_banner.json @@ -18,7 +18,8 @@ "minecraft:custom_name", "minecraft:item_name", "minecraft:hide_additional_tooltip", - "minecraft:banner_patterns" + "minecraft:banner_patterns", + "minecraft:rarity" ], "source": "block_entity" } diff --git a/data/minecraft/loot_table/blocks/light_gray_banner.json b/data/minecraft/loot_table/blocks/light_gray_banner.json index 335bb6e1..9ca07510 100644 --- a/data/minecraft/loot_table/blocks/light_gray_banner.json +++ b/data/minecraft/loot_table/blocks/light_gray_banner.json @@ -18,7 +18,8 @@ "minecraft:custom_name", "minecraft:item_name", "minecraft:hide_additional_tooltip", - "minecraft:banner_patterns" + "minecraft:banner_patterns", + "minecraft:rarity" ], "source": "block_entity" } diff --git a/data/minecraft/loot_table/blocks/lime_banner.json b/data/minecraft/loot_table/blocks/lime_banner.json index 99027685..22be4355 100644 --- a/data/minecraft/loot_table/blocks/lime_banner.json +++ b/data/minecraft/loot_table/blocks/lime_banner.json @@ -18,7 +18,8 @@ "minecraft:custom_name", "minecraft:item_name", "minecraft:hide_additional_tooltip", - "minecraft:banner_patterns" + "minecraft:banner_patterns", + "minecraft:rarity" ], "source": "block_entity" } diff --git a/data/minecraft/loot_table/blocks/magenta_banner.json b/data/minecraft/loot_table/blocks/magenta_banner.json index 03c7dd02..3c293a83 100644 --- a/data/minecraft/loot_table/blocks/magenta_banner.json +++ b/data/minecraft/loot_table/blocks/magenta_banner.json @@ -18,7 +18,8 @@ "minecraft:custom_name", "minecraft:item_name", "minecraft:hide_additional_tooltip", - "minecraft:banner_patterns" + "minecraft:banner_patterns", + "minecraft:rarity" ], "source": "block_entity" } diff --git a/data/minecraft/loot_table/blocks/orange_banner.json b/data/minecraft/loot_table/blocks/orange_banner.json index 5abc5071..d47a7827 100644 --- a/data/minecraft/loot_table/blocks/orange_banner.json +++ b/data/minecraft/loot_table/blocks/orange_banner.json @@ -18,7 +18,8 @@ "minecraft:custom_name", "minecraft:item_name", "minecraft:hide_additional_tooltip", - "minecraft:banner_patterns" + "minecraft:banner_patterns", + "minecraft:rarity" ], "source": "block_entity" } diff --git a/data/minecraft/loot_table/blocks/pale_hanging_moss.json b/data/minecraft/loot_table/blocks/pale_hanging_moss.json new file mode 100644 index 00000000..34df4809 --- /dev/null +++ b/data/minecraft/loot_table/blocks/pale_hanging_moss.json @@ -0,0 +1,4 @@ +{ + "type": "minecraft:block", + "random_sequence": "minecraft:blocks/pale_hanging_moss" +} \ No newline at end of file diff --git a/data/minecraft/loot_table/blocks/pale_moss_block.json b/data/minecraft/loot_table/blocks/pale_moss_block.json new file mode 100644 index 00000000..2c6c2985 --- /dev/null +++ b/data/minecraft/loot_table/blocks/pale_moss_block.json @@ -0,0 +1,4 @@ +{ + "type": "minecraft:block", + "random_sequence": "minecraft:blocks/pale_moss_block" +} \ No newline at end of file diff --git a/data/minecraft/loot_table/blocks/pale_moss_carpet.json b/data/minecraft/loot_table/blocks/pale_moss_carpet.json new file mode 100644 index 00000000..11c440e7 --- /dev/null +++ b/data/minecraft/loot_table/blocks/pale_moss_carpet.json @@ -0,0 +1,4 @@ +{ + "type": "minecraft:block", + "random_sequence": "minecraft:blocks/pale_moss_carpet" +} \ No newline at end of file diff --git a/data/minecraft/loot_table/blocks/pale_oak_button.json b/data/minecraft/loot_table/blocks/pale_oak_button.json new file mode 100644 index 00000000..d74e70b3 --- /dev/null +++ b/data/minecraft/loot_table/blocks/pale_oak_button.json @@ -0,0 +1,4 @@ +{ + "type": "minecraft:block", + "random_sequence": "minecraft:blocks/pale_oak_button" +} \ No newline at end of file diff --git a/data/minecraft/loot_table/blocks/pale_oak_door.json b/data/minecraft/loot_table/blocks/pale_oak_door.json new file mode 100644 index 00000000..b5c2c624 --- /dev/null +++ b/data/minecraft/loot_table/blocks/pale_oak_door.json @@ -0,0 +1,4 @@ +{ + "type": "minecraft:block", + "random_sequence": "minecraft:blocks/pale_oak_door" +} \ No newline at end of file diff --git a/data/minecraft/loot_table/blocks/pale_oak_fence.json b/data/minecraft/loot_table/blocks/pale_oak_fence.json new file mode 100644 index 00000000..d4c2b074 --- /dev/null +++ b/data/minecraft/loot_table/blocks/pale_oak_fence.json @@ -0,0 +1,4 @@ +{ + "type": "minecraft:block", + "random_sequence": "minecraft:blocks/pale_oak_fence" +} \ No newline at end of file diff --git a/data/minecraft/loot_table/blocks/pale_oak_fence_gate.json b/data/minecraft/loot_table/blocks/pale_oak_fence_gate.json new file mode 100644 index 00000000..97468de5 --- /dev/null +++ b/data/minecraft/loot_table/blocks/pale_oak_fence_gate.json @@ -0,0 +1,4 @@ +{ + "type": "minecraft:block", + "random_sequence": "minecraft:blocks/pale_oak_fence_gate" +} \ No newline at end of file diff --git a/data/minecraft/loot_table/blocks/pale_oak_hanging_sign.json b/data/minecraft/loot_table/blocks/pale_oak_hanging_sign.json new file mode 100644 index 00000000..5d01eff3 --- /dev/null +++ b/data/minecraft/loot_table/blocks/pale_oak_hanging_sign.json @@ -0,0 +1,4 @@ +{ + "type": "minecraft:block", + "random_sequence": "minecraft:blocks/pale_oak_hanging_sign" +} \ No newline at end of file diff --git a/data/minecraft/loot_table/blocks/pale_oak_leaves.json b/data/minecraft/loot_table/blocks/pale_oak_leaves.json new file mode 100644 index 00000000..f5d266df --- /dev/null +++ b/data/minecraft/loot_table/blocks/pale_oak_leaves.json @@ -0,0 +1,4 @@ +{ + "type": "minecraft:block", + "random_sequence": "minecraft:blocks/pale_oak_leaves" +} \ No newline at end of file diff --git a/data/minecraft/loot_table/blocks/pale_oak_log.json b/data/minecraft/loot_table/blocks/pale_oak_log.json new file mode 100644 index 00000000..d6dda4c7 --- /dev/null +++ b/data/minecraft/loot_table/blocks/pale_oak_log.json @@ -0,0 +1,4 @@ +{ + "type": "minecraft:block", + "random_sequence": "minecraft:blocks/pale_oak_log" +} \ No newline at end of file diff --git a/data/minecraft/loot_table/blocks/pale_oak_planks.json b/data/minecraft/loot_table/blocks/pale_oak_planks.json new file mode 100644 index 00000000..4bdf975a --- /dev/null +++ b/data/minecraft/loot_table/blocks/pale_oak_planks.json @@ -0,0 +1,4 @@ +{ + "type": "minecraft:block", + "random_sequence": "minecraft:blocks/pale_oak_planks" +} \ No newline at end of file diff --git a/data/minecraft/loot_table/blocks/pale_oak_pressure_plate.json b/data/minecraft/loot_table/blocks/pale_oak_pressure_plate.json new file mode 100644 index 00000000..0868ed08 --- /dev/null +++ b/data/minecraft/loot_table/blocks/pale_oak_pressure_plate.json @@ -0,0 +1,4 @@ +{ + "type": "minecraft:block", + "random_sequence": "minecraft:blocks/pale_oak_pressure_plate" +} \ No newline at end of file diff --git a/data/minecraft/loot_table/blocks/pale_oak_sapling.json b/data/minecraft/loot_table/blocks/pale_oak_sapling.json new file mode 100644 index 00000000..6f40b964 --- /dev/null +++ b/data/minecraft/loot_table/blocks/pale_oak_sapling.json @@ -0,0 +1,4 @@ +{ + "type": "minecraft:block", + "random_sequence": "minecraft:blocks/pale_oak_sapling" +} \ No newline at end of file diff --git a/data/minecraft/loot_table/blocks/pale_oak_sign.json b/data/minecraft/loot_table/blocks/pale_oak_sign.json new file mode 100644 index 00000000..8ba6344a --- /dev/null +++ b/data/minecraft/loot_table/blocks/pale_oak_sign.json @@ -0,0 +1,4 @@ +{ + "type": "minecraft:block", + "random_sequence": "minecraft:blocks/pale_oak_sign" +} \ No newline at end of file diff --git a/data/minecraft/loot_table/blocks/pale_oak_slab.json b/data/minecraft/loot_table/blocks/pale_oak_slab.json new file mode 100644 index 00000000..4face22d --- /dev/null +++ b/data/minecraft/loot_table/blocks/pale_oak_slab.json @@ -0,0 +1,4 @@ +{ + "type": "minecraft:block", + "random_sequence": "minecraft:blocks/pale_oak_slab" +} \ No newline at end of file diff --git a/data/minecraft/loot_table/blocks/pale_oak_stairs.json b/data/minecraft/loot_table/blocks/pale_oak_stairs.json new file mode 100644 index 00000000..8fc8cc65 --- /dev/null +++ b/data/minecraft/loot_table/blocks/pale_oak_stairs.json @@ -0,0 +1,4 @@ +{ + "type": "minecraft:block", + "random_sequence": "minecraft:blocks/pale_oak_stairs" +} \ No newline at end of file diff --git a/data/minecraft/loot_table/blocks/pale_oak_trapdoor.json b/data/minecraft/loot_table/blocks/pale_oak_trapdoor.json new file mode 100644 index 00000000..048ff598 --- /dev/null +++ b/data/minecraft/loot_table/blocks/pale_oak_trapdoor.json @@ -0,0 +1,4 @@ +{ + "type": "minecraft:block", + "random_sequence": "minecraft:blocks/pale_oak_trapdoor" +} \ No newline at end of file diff --git a/data/minecraft/loot_table/blocks/pale_oak_wood.json b/data/minecraft/loot_table/blocks/pale_oak_wood.json new file mode 100644 index 00000000..487d4bd8 --- /dev/null +++ b/data/minecraft/loot_table/blocks/pale_oak_wood.json @@ -0,0 +1,4 @@ +{ + "type": "minecraft:block", + "random_sequence": "minecraft:blocks/pale_oak_wood" +} \ No newline at end of file diff --git a/data/minecraft/loot_table/blocks/pink_banner.json b/data/minecraft/loot_table/blocks/pink_banner.json index 4cfd11e9..6d5c95c4 100644 --- a/data/minecraft/loot_table/blocks/pink_banner.json +++ b/data/minecraft/loot_table/blocks/pink_banner.json @@ -18,7 +18,8 @@ "minecraft:custom_name", "minecraft:item_name", "minecraft:hide_additional_tooltip", - "minecraft:banner_patterns" + "minecraft:banner_patterns", + "minecraft:rarity" ], "source": "block_entity" } diff --git a/data/minecraft/loot_table/blocks/potted_pale_oak_sapling.json b/data/minecraft/loot_table/blocks/potted_pale_oak_sapling.json new file mode 100644 index 00000000..23fb62c3 --- /dev/null +++ b/data/minecraft/loot_table/blocks/potted_pale_oak_sapling.json @@ -0,0 +1,4 @@ +{ + "type": "minecraft:block", + "random_sequence": "minecraft:blocks/potted_pale_oak_sapling" +} \ No newline at end of file diff --git a/data/minecraft/loot_table/blocks/purple_banner.json b/data/minecraft/loot_table/blocks/purple_banner.json index e555c2f5..e0d11afb 100644 --- a/data/minecraft/loot_table/blocks/purple_banner.json +++ b/data/minecraft/loot_table/blocks/purple_banner.json @@ -18,7 +18,8 @@ "minecraft:custom_name", "minecraft:item_name", "minecraft:hide_additional_tooltip", - "minecraft:banner_patterns" + "minecraft:banner_patterns", + "minecraft:rarity" ], "source": "block_entity" } diff --git a/data/minecraft/loot_table/blocks/red_banner.json b/data/minecraft/loot_table/blocks/red_banner.json index 40ab74ae..dcc1323c 100644 --- a/data/minecraft/loot_table/blocks/red_banner.json +++ b/data/minecraft/loot_table/blocks/red_banner.json @@ -18,7 +18,8 @@ "minecraft:custom_name", "minecraft:item_name", "minecraft:hide_additional_tooltip", - "minecraft:banner_patterns" + "minecraft:banner_patterns", + "minecraft:rarity" ], "source": "block_entity" } diff --git a/data/minecraft/loot_table/blocks/stripped_pale_oak_log.json b/data/minecraft/loot_table/blocks/stripped_pale_oak_log.json new file mode 100644 index 00000000..4dc6cf4a --- /dev/null +++ b/data/minecraft/loot_table/blocks/stripped_pale_oak_log.json @@ -0,0 +1,4 @@ +{ + "type": "minecraft:block", + "random_sequence": "minecraft:blocks/stripped_pale_oak_log" +} \ No newline at end of file diff --git a/data/minecraft/loot_table/blocks/stripped_pale_oak_wood.json b/data/minecraft/loot_table/blocks/stripped_pale_oak_wood.json new file mode 100644 index 00000000..ff80a591 --- /dev/null +++ b/data/minecraft/loot_table/blocks/stripped_pale_oak_wood.json @@ -0,0 +1,4 @@ +{ + "type": "minecraft:block", + "random_sequence": "minecraft:blocks/stripped_pale_oak_wood" +} \ No newline at end of file diff --git a/data/minecraft/loot_table/blocks/white_banner.json b/data/minecraft/loot_table/blocks/white_banner.json index 5c3389fe..f6f334c2 100644 --- a/data/minecraft/loot_table/blocks/white_banner.json +++ b/data/minecraft/loot_table/blocks/white_banner.json @@ -18,7 +18,8 @@ "minecraft:custom_name", "minecraft:item_name", "minecraft:hide_additional_tooltip", - "minecraft:banner_patterns" + "minecraft:banner_patterns", + "minecraft:rarity" ], "source": "block_entity" } diff --git a/data/minecraft/loot_table/blocks/yellow_banner.json b/data/minecraft/loot_table/blocks/yellow_banner.json index 9265d859..7db122bd 100644 --- a/data/minecraft/loot_table/blocks/yellow_banner.json +++ b/data/minecraft/loot_table/blocks/yellow_banner.json @@ -18,7 +18,8 @@ "minecraft:custom_name", "minecraft:item_name", "minecraft:hide_additional_tooltip", - "minecraft:banner_patterns" + "minecraft:banner_patterns", + "minecraft:rarity" ], "source": "block_entity" } diff --git a/data/minecraft/loot_table/entities/creaking.json b/data/minecraft/loot_table/entities/creaking.json new file mode 100644 index 00000000..0e3c196f --- /dev/null +++ b/data/minecraft/loot_table/entities/creaking.json @@ -0,0 +1,4 @@ +{ + "type": "minecraft:entity", + "random_sequence": "minecraft:entities/creaking" +} \ No newline at end of file diff --git a/data/minecraft/loot_table/entities/creaking_transient.json b/data/minecraft/loot_table/entities/creaking_transient.json new file mode 100644 index 00000000..a318df2e --- /dev/null +++ b/data/minecraft/loot_table/entities/creaking_transient.json @@ -0,0 +1,4 @@ +{ + "type": "minecraft:entity", + "random_sequence": "minecraft:entities/creaking_transient" +} \ No newline at end of file diff --git a/data/minecraft/loot_table/entities/sheep.json b/data/minecraft/loot_table/entities/sheep.json index 9cb30577..fa39ae74 100644 --- a/data/minecraft/loot_table/entities/sheep.json +++ b/data/minecraft/loot_table/entities/sheep.json @@ -66,6 +66,289 @@ } ], "rolls": 1.0 + }, + { + "bonus_rolls": 0.0, + "entries": [ + { + "type": "minecraft:alternatives", + "children": [ + { + "type": "minecraft:loot_table", + "conditions": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type_specific": { + "type": "minecraft:sheep", + "color": "white", + "sheared": false + } + } + } + ], + "value": "minecraft:entities/sheep/white" + }, + { + "type": "minecraft:loot_table", + "conditions": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type_specific": { + "type": "minecraft:sheep", + "color": "orange", + "sheared": false + } + } + } + ], + "value": "minecraft:entities/sheep/orange" + }, + { + "type": "minecraft:loot_table", + "conditions": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type_specific": { + "type": "minecraft:sheep", + "color": "magenta", + "sheared": false + } + } + } + ], + "value": "minecraft:entities/sheep/magenta" + }, + { + "type": "minecraft:loot_table", + "conditions": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type_specific": { + "type": "minecraft:sheep", + "color": "light_blue", + "sheared": false + } + } + } + ], + "value": "minecraft:entities/sheep/light_blue" + }, + { + "type": "minecraft:loot_table", + "conditions": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type_specific": { + "type": "minecraft:sheep", + "color": "yellow", + "sheared": false + } + } + } + ], + "value": "minecraft:entities/sheep/yellow" + }, + { + "type": "minecraft:loot_table", + "conditions": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type_specific": { + "type": "minecraft:sheep", + "color": "lime", + "sheared": false + } + } + } + ], + "value": "minecraft:entities/sheep/lime" + }, + { + "type": "minecraft:loot_table", + "conditions": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type_specific": { + "type": "minecraft:sheep", + "color": "pink", + "sheared": false + } + } + } + ], + "value": "minecraft:entities/sheep/pink" + }, + { + "type": "minecraft:loot_table", + "conditions": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type_specific": { + "type": "minecraft:sheep", + "color": "gray", + "sheared": false + } + } + } + ], + "value": "minecraft:entities/sheep/gray" + }, + { + "type": "minecraft:loot_table", + "conditions": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type_specific": { + "type": "minecraft:sheep", + "color": "light_gray", + "sheared": false + } + } + } + ], + "value": "minecraft:entities/sheep/light_gray" + }, + { + "type": "minecraft:loot_table", + "conditions": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type_specific": { + "type": "minecraft:sheep", + "color": "cyan", + "sheared": false + } + } + } + ], + "value": "minecraft:entities/sheep/cyan" + }, + { + "type": "minecraft:loot_table", + "conditions": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type_specific": { + "type": "minecraft:sheep", + "color": "purple", + "sheared": false + } + } + } + ], + "value": "minecraft:entities/sheep/purple" + }, + { + "type": "minecraft:loot_table", + "conditions": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type_specific": { + "type": "minecraft:sheep", + "color": "blue", + "sheared": false + } + } + } + ], + "value": "minecraft:entities/sheep/blue" + }, + { + "type": "minecraft:loot_table", + "conditions": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type_specific": { + "type": "minecraft:sheep", + "color": "brown", + "sheared": false + } + } + } + ], + "value": "minecraft:entities/sheep/brown" + }, + { + "type": "minecraft:loot_table", + "conditions": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type_specific": { + "type": "minecraft:sheep", + "color": "green", + "sheared": false + } + } + } + ], + "value": "minecraft:entities/sheep/green" + }, + { + "type": "minecraft:loot_table", + "conditions": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type_specific": { + "type": "minecraft:sheep", + "color": "red", + "sheared": false + } + } + } + ], + "value": "minecraft:entities/sheep/red" + }, + { + "type": "minecraft:loot_table", + "conditions": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type_specific": { + "type": "minecraft:sheep", + "color": "black", + "sheared": false + } + } + } + ], + "value": "minecraft:entities/sheep/black" + } + ] + } + ], + "rolls": 1.0 } ], "random_sequence": "minecraft:entities/sheep" diff --git a/data/minecraft/loot_table/entities/sheep/black.json b/data/minecraft/loot_table/entities/sheep/black.json index 23810b2a..7e80cd55 100644 --- a/data/minecraft/loot_table/entities/sheep/black.json +++ b/data/minecraft/loot_table/entities/sheep/black.json @@ -10,16 +10,6 @@ } ], "rolls": 1.0 - }, - { - "bonus_rolls": 0.0, - "entries": [ - { - "type": "minecraft:loot_table", - "value": "minecraft:entities/sheep" - } - ], - "rolls": 1.0 } ], "random_sequence": "minecraft:entities/sheep/black" diff --git a/data/minecraft/loot_table/entities/sheep/blue.json b/data/minecraft/loot_table/entities/sheep/blue.json index 89c4a9a0..3eee5a16 100644 --- a/data/minecraft/loot_table/entities/sheep/blue.json +++ b/data/minecraft/loot_table/entities/sheep/blue.json @@ -10,16 +10,6 @@ } ], "rolls": 1.0 - }, - { - "bonus_rolls": 0.0, - "entries": [ - { - "type": "minecraft:loot_table", - "value": "minecraft:entities/sheep" - } - ], - "rolls": 1.0 } ], "random_sequence": "minecraft:entities/sheep/blue" diff --git a/data/minecraft/loot_table/entities/sheep/brown.json b/data/minecraft/loot_table/entities/sheep/brown.json index 6a6641bb..39dd224d 100644 --- a/data/minecraft/loot_table/entities/sheep/brown.json +++ b/data/minecraft/loot_table/entities/sheep/brown.json @@ -10,16 +10,6 @@ } ], "rolls": 1.0 - }, - { - "bonus_rolls": 0.0, - "entries": [ - { - "type": "minecraft:loot_table", - "value": "minecraft:entities/sheep" - } - ], - "rolls": 1.0 } ], "random_sequence": "minecraft:entities/sheep/brown" diff --git a/data/minecraft/loot_table/entities/sheep/cyan.json b/data/minecraft/loot_table/entities/sheep/cyan.json index 4e9e0f9e..e0edae83 100644 --- a/data/minecraft/loot_table/entities/sheep/cyan.json +++ b/data/minecraft/loot_table/entities/sheep/cyan.json @@ -10,16 +10,6 @@ } ], "rolls": 1.0 - }, - { - "bonus_rolls": 0.0, - "entries": [ - { - "type": "minecraft:loot_table", - "value": "minecraft:entities/sheep" - } - ], - "rolls": 1.0 } ], "random_sequence": "minecraft:entities/sheep/cyan" diff --git a/data/minecraft/loot_table/entities/sheep/gray.json b/data/minecraft/loot_table/entities/sheep/gray.json index 7744ec86..4caaae5c 100644 --- a/data/minecraft/loot_table/entities/sheep/gray.json +++ b/data/minecraft/loot_table/entities/sheep/gray.json @@ -10,16 +10,6 @@ } ], "rolls": 1.0 - }, - { - "bonus_rolls": 0.0, - "entries": [ - { - "type": "minecraft:loot_table", - "value": "minecraft:entities/sheep" - } - ], - "rolls": 1.0 } ], "random_sequence": "minecraft:entities/sheep/gray" diff --git a/data/minecraft/loot_table/entities/sheep/green.json b/data/minecraft/loot_table/entities/sheep/green.json index cbca2c39..6553d9c1 100644 --- a/data/minecraft/loot_table/entities/sheep/green.json +++ b/data/minecraft/loot_table/entities/sheep/green.json @@ -10,16 +10,6 @@ } ], "rolls": 1.0 - }, - { - "bonus_rolls": 0.0, - "entries": [ - { - "type": "minecraft:loot_table", - "value": "minecraft:entities/sheep" - } - ], - "rolls": 1.0 } ], "random_sequence": "minecraft:entities/sheep/green" diff --git a/data/minecraft/loot_table/entities/sheep/light_blue.json b/data/minecraft/loot_table/entities/sheep/light_blue.json index 59117347..ef4bddf5 100644 --- a/data/minecraft/loot_table/entities/sheep/light_blue.json +++ b/data/minecraft/loot_table/entities/sheep/light_blue.json @@ -10,16 +10,6 @@ } ], "rolls": 1.0 - }, - { - "bonus_rolls": 0.0, - "entries": [ - { - "type": "minecraft:loot_table", - "value": "minecraft:entities/sheep" - } - ], - "rolls": 1.0 } ], "random_sequence": "minecraft:entities/sheep/light_blue" diff --git a/data/minecraft/loot_table/entities/sheep/light_gray.json b/data/minecraft/loot_table/entities/sheep/light_gray.json index f0593201..d1ab7393 100644 --- a/data/minecraft/loot_table/entities/sheep/light_gray.json +++ b/data/minecraft/loot_table/entities/sheep/light_gray.json @@ -10,16 +10,6 @@ } ], "rolls": 1.0 - }, - { - "bonus_rolls": 0.0, - "entries": [ - { - "type": "minecraft:loot_table", - "value": "minecraft:entities/sheep" - } - ], - "rolls": 1.0 } ], "random_sequence": "minecraft:entities/sheep/light_gray" diff --git a/data/minecraft/loot_table/entities/sheep/lime.json b/data/minecraft/loot_table/entities/sheep/lime.json index 49ee18ec..4957506b 100644 --- a/data/minecraft/loot_table/entities/sheep/lime.json +++ b/data/minecraft/loot_table/entities/sheep/lime.json @@ -10,16 +10,6 @@ } ], "rolls": 1.0 - }, - { - "bonus_rolls": 0.0, - "entries": [ - { - "type": "minecraft:loot_table", - "value": "minecraft:entities/sheep" - } - ], - "rolls": 1.0 } ], "random_sequence": "minecraft:entities/sheep/lime" diff --git a/data/minecraft/loot_table/entities/sheep/magenta.json b/data/minecraft/loot_table/entities/sheep/magenta.json index 011f47d7..43710e76 100644 --- a/data/minecraft/loot_table/entities/sheep/magenta.json +++ b/data/minecraft/loot_table/entities/sheep/magenta.json @@ -10,16 +10,6 @@ } ], "rolls": 1.0 - }, - { - "bonus_rolls": 0.0, - "entries": [ - { - "type": "minecraft:loot_table", - "value": "minecraft:entities/sheep" - } - ], - "rolls": 1.0 } ], "random_sequence": "minecraft:entities/sheep/magenta" diff --git a/data/minecraft/loot_table/entities/sheep/orange.json b/data/minecraft/loot_table/entities/sheep/orange.json index 1e28c15e..ce3ca050 100644 --- a/data/minecraft/loot_table/entities/sheep/orange.json +++ b/data/minecraft/loot_table/entities/sheep/orange.json @@ -10,16 +10,6 @@ } ], "rolls": 1.0 - }, - { - "bonus_rolls": 0.0, - "entries": [ - { - "type": "minecraft:loot_table", - "value": "minecraft:entities/sheep" - } - ], - "rolls": 1.0 } ], "random_sequence": "minecraft:entities/sheep/orange" diff --git a/data/minecraft/loot_table/entities/sheep/pink.json b/data/minecraft/loot_table/entities/sheep/pink.json index a92cf924..135d57ba 100644 --- a/data/minecraft/loot_table/entities/sheep/pink.json +++ b/data/minecraft/loot_table/entities/sheep/pink.json @@ -10,16 +10,6 @@ } ], "rolls": 1.0 - }, - { - "bonus_rolls": 0.0, - "entries": [ - { - "type": "minecraft:loot_table", - "value": "minecraft:entities/sheep" - } - ], - "rolls": 1.0 } ], "random_sequence": "minecraft:entities/sheep/pink" diff --git a/data/minecraft/loot_table/entities/sheep/purple.json b/data/minecraft/loot_table/entities/sheep/purple.json index d217ba55..d806a96f 100644 --- a/data/minecraft/loot_table/entities/sheep/purple.json +++ b/data/minecraft/loot_table/entities/sheep/purple.json @@ -10,16 +10,6 @@ } ], "rolls": 1.0 - }, - { - "bonus_rolls": 0.0, - "entries": [ - { - "type": "minecraft:loot_table", - "value": "minecraft:entities/sheep" - } - ], - "rolls": 1.0 } ], "random_sequence": "minecraft:entities/sheep/purple" diff --git a/data/minecraft/loot_table/entities/sheep/red.json b/data/minecraft/loot_table/entities/sheep/red.json index 9bd709b6..624992ba 100644 --- a/data/minecraft/loot_table/entities/sheep/red.json +++ b/data/minecraft/loot_table/entities/sheep/red.json @@ -10,16 +10,6 @@ } ], "rolls": 1.0 - }, - { - "bonus_rolls": 0.0, - "entries": [ - { - "type": "minecraft:loot_table", - "value": "minecraft:entities/sheep" - } - ], - "rolls": 1.0 } ], "random_sequence": "minecraft:entities/sheep/red" diff --git a/data/minecraft/loot_table/entities/sheep/white.json b/data/minecraft/loot_table/entities/sheep/white.json index f4794dd3..2ba73e39 100644 --- a/data/minecraft/loot_table/entities/sheep/white.json +++ b/data/minecraft/loot_table/entities/sheep/white.json @@ -10,16 +10,6 @@ } ], "rolls": 1.0 - }, - { - "bonus_rolls": 0.0, - "entries": [ - { - "type": "minecraft:loot_table", - "value": "minecraft:entities/sheep" - } - ], - "rolls": 1.0 } ], "random_sequence": "minecraft:entities/sheep/white" diff --git a/data/minecraft/loot_table/entities/sheep/yellow.json b/data/minecraft/loot_table/entities/sheep/yellow.json index ebe39bcc..edb9ebf1 100644 --- a/data/minecraft/loot_table/entities/sheep/yellow.json +++ b/data/minecraft/loot_table/entities/sheep/yellow.json @@ -10,16 +10,6 @@ } ], "rolls": 1.0 - }, - { - "bonus_rolls": 0.0, - "entries": [ - { - "type": "minecraft:loot_table", - "value": "minecraft:entities/sheep" - } - ], - "rolls": 1.0 } ], "random_sequence": "minecraft:entities/sheep/yellow" diff --git a/data/minecraft/loot_table/gameplay/armadillo_shed.json b/data/minecraft/loot_table/gameplay/armadillo_shed.json new file mode 100644 index 00000000..aca0282d --- /dev/null +++ b/data/minecraft/loot_table/gameplay/armadillo_shed.json @@ -0,0 +1,16 @@ +{ + "type": "minecraft:gift", + "pools": [ + { + "bonus_rolls": 0.0, + "entries": [ + { + "type": "minecraft:item", + "name": "minecraft:armadillo_scute" + } + ], + "rolls": 1.0 + } + ], + "random_sequence": "minecraft:gameplay/armadillo_shed" +} \ No newline at end of file diff --git a/data/minecraft/loot_table/gameplay/chicken_lay.json b/data/minecraft/loot_table/gameplay/chicken_lay.json new file mode 100644 index 00000000..7c5b849d --- /dev/null +++ b/data/minecraft/loot_table/gameplay/chicken_lay.json @@ -0,0 +1,16 @@ +{ + "type": "minecraft:gift", + "pools": [ + { + "bonus_rolls": 0.0, + "entries": [ + { + "type": "minecraft:item", + "name": "minecraft:egg" + } + ], + "rolls": 1.0 + } + ], + "random_sequence": "minecraft:gameplay/chicken_lay" +} \ No newline at end of file diff --git a/data/minecraft/loot_table/gameplay/hero_of_the_village/baby_gift.json b/data/minecraft/loot_table/gameplay/hero_of_the_village/baby_gift.json new file mode 100644 index 00000000..62ec102f --- /dev/null +++ b/data/minecraft/loot_table/gameplay/hero_of_the_village/baby_gift.json @@ -0,0 +1,16 @@ +{ + "type": "minecraft:gift", + "pools": [ + { + "bonus_rolls": 0.0, + "entries": [ + { + "type": "minecraft:item", + "name": "minecraft:poppy" + } + ], + "rolls": 1.0 + } + ], + "random_sequence": "minecraft:gameplay/hero_of_the_village/baby_gift" +} \ No newline at end of file diff --git a/data/minecraft/loot_table/gameplay/hero_of_the_village/unemployed_gift.json b/data/minecraft/loot_table/gameplay/hero_of_the_village/unemployed_gift.json new file mode 100644 index 00000000..2ffcb47d --- /dev/null +++ b/data/minecraft/loot_table/gameplay/hero_of_the_village/unemployed_gift.json @@ -0,0 +1,16 @@ +{ + "type": "minecraft:gift", + "pools": [ + { + "bonus_rolls": 0.0, + "entries": [ + { + "type": "minecraft:item", + "name": "minecraft:wheat_seeds" + } + ], + "rolls": 1.0 + } + ], + "random_sequence": "minecraft:gameplay/hero_of_the_village/unemployed_gift" +} \ No newline at end of file diff --git a/data/minecraft/loot_table/shearing/mooshroom.json b/data/minecraft/loot_table/shearing/mooshroom.json new file mode 100644 index 00000000..85a56808 --- /dev/null +++ b/data/minecraft/loot_table/shearing/mooshroom.json @@ -0,0 +1,49 @@ +{ + "type": "minecraft:shearing", + "pools": [ + { + "bonus_rolls": 0.0, + "entries": [ + { + "type": "minecraft:alternatives", + "children": [ + { + "type": "minecraft:loot_table", + "conditions": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type_specific": { + "type": "minecraft:mooshroom", + "variant": "red" + } + } + } + ], + "value": "minecraft:shearing/mooshroom/red" + }, + { + "type": "minecraft:loot_table", + "conditions": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type_specific": { + "type": "minecraft:mooshroom", + "variant": "brown" + } + } + } + ], + "value": "minecraft:shearing/mooshroom/brown" + } + ] + } + ], + "rolls": 1.0 + } + ], + "random_sequence": "minecraft:shearing/mooshroom" +} \ No newline at end of file diff --git a/data/minecraft/loot_table/shearing/mooshroom/brown.json b/data/minecraft/loot_table/shearing/mooshroom/brown.json new file mode 100644 index 00000000..0110137a --- /dev/null +++ b/data/minecraft/loot_table/shearing/mooshroom/brown.json @@ -0,0 +1,16 @@ +{ + "type": "minecraft:shearing", + "pools": [ + { + "bonus_rolls": 0.0, + "entries": [ + { + "type": "minecraft:item", + "name": "minecraft:brown_mushroom" + } + ], + "rolls": 5.0 + } + ], + "random_sequence": "minecraft:shearing/mooshroom/brown" +} \ No newline at end of file diff --git a/data/minecraft/loot_table/shearing/mooshroom/red.json b/data/minecraft/loot_table/shearing/mooshroom/red.json new file mode 100644 index 00000000..cb88f481 --- /dev/null +++ b/data/minecraft/loot_table/shearing/mooshroom/red.json @@ -0,0 +1,16 @@ +{ + "type": "minecraft:shearing", + "pools": [ + { + "bonus_rolls": 0.0, + "entries": [ + { + "type": "minecraft:item", + "name": "minecraft:red_mushroom" + } + ], + "rolls": 5.0 + } + ], + "random_sequence": "minecraft:shearing/mooshroom/red" +} \ No newline at end of file diff --git a/data/minecraft/loot_table/shearing/sheep.json b/data/minecraft/loot_table/shearing/sheep.json new file mode 100644 index 00000000..684a083a --- /dev/null +++ b/data/minecraft/loot_table/shearing/sheep.json @@ -0,0 +1,289 @@ +{ + "type": "minecraft:shearing", + "pools": [ + { + "bonus_rolls": 0.0, + "entries": [ + { + "type": "minecraft:alternatives", + "children": [ + { + "type": "minecraft:loot_table", + "conditions": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type_specific": { + "type": "minecraft:sheep", + "color": "white", + "sheared": false + } + } + } + ], + "value": "minecraft:shearing/sheep/white" + }, + { + "type": "minecraft:loot_table", + "conditions": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type_specific": { + "type": "minecraft:sheep", + "color": "orange", + "sheared": false + } + } + } + ], + "value": "minecraft:shearing/sheep/orange" + }, + { + "type": "minecraft:loot_table", + "conditions": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type_specific": { + "type": "minecraft:sheep", + "color": "magenta", + "sheared": false + } + } + } + ], + "value": "minecraft:shearing/sheep/magenta" + }, + { + "type": "minecraft:loot_table", + "conditions": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type_specific": { + "type": "minecraft:sheep", + "color": "light_blue", + "sheared": false + } + } + } + ], + "value": "minecraft:shearing/sheep/light_blue" + }, + { + "type": "minecraft:loot_table", + "conditions": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type_specific": { + "type": "minecraft:sheep", + "color": "yellow", + "sheared": false + } + } + } + ], + "value": "minecraft:shearing/sheep/yellow" + }, + { + "type": "minecraft:loot_table", + "conditions": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type_specific": { + "type": "minecraft:sheep", + "color": "lime", + "sheared": false + } + } + } + ], + "value": "minecraft:shearing/sheep/lime" + }, + { + "type": "minecraft:loot_table", + "conditions": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type_specific": { + "type": "minecraft:sheep", + "color": "pink", + "sheared": false + } + } + } + ], + "value": "minecraft:shearing/sheep/pink" + }, + { + "type": "minecraft:loot_table", + "conditions": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type_specific": { + "type": "minecraft:sheep", + "color": "gray", + "sheared": false + } + } + } + ], + "value": "minecraft:shearing/sheep/gray" + }, + { + "type": "minecraft:loot_table", + "conditions": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type_specific": { + "type": "minecraft:sheep", + "color": "light_gray", + "sheared": false + } + } + } + ], + "value": "minecraft:shearing/sheep/light_gray" + }, + { + "type": "minecraft:loot_table", + "conditions": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type_specific": { + "type": "minecraft:sheep", + "color": "cyan", + "sheared": false + } + } + } + ], + "value": "minecraft:shearing/sheep/cyan" + }, + { + "type": "minecraft:loot_table", + "conditions": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type_specific": { + "type": "minecraft:sheep", + "color": "purple", + "sheared": false + } + } + } + ], + "value": "minecraft:shearing/sheep/purple" + }, + { + "type": "minecraft:loot_table", + "conditions": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type_specific": { + "type": "minecraft:sheep", + "color": "blue", + "sheared": false + } + } + } + ], + "value": "minecraft:shearing/sheep/blue" + }, + { + "type": "minecraft:loot_table", + "conditions": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type_specific": { + "type": "minecraft:sheep", + "color": "brown", + "sheared": false + } + } + } + ], + "value": "minecraft:shearing/sheep/brown" + }, + { + "type": "minecraft:loot_table", + "conditions": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type_specific": { + "type": "minecraft:sheep", + "color": "green", + "sheared": false + } + } + } + ], + "value": "minecraft:shearing/sheep/green" + }, + { + "type": "minecraft:loot_table", + "conditions": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type_specific": { + "type": "minecraft:sheep", + "color": "red", + "sheared": false + } + } + } + ], + "value": "minecraft:shearing/sheep/red" + }, + { + "type": "minecraft:loot_table", + "conditions": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type_specific": { + "type": "minecraft:sheep", + "color": "black", + "sheared": false + } + } + } + ], + "value": "minecraft:shearing/sheep/black" + } + ] + } + ], + "rolls": 1.0 + } + ], + "random_sequence": "minecraft:shearing/sheep" +} \ No newline at end of file diff --git a/data/minecraft/loot_table/shearing/sheep/black.json b/data/minecraft/loot_table/shearing/sheep/black.json new file mode 100644 index 00000000..42db5aa2 --- /dev/null +++ b/data/minecraft/loot_table/shearing/sheep/black.json @@ -0,0 +1,20 @@ +{ + "type": "minecraft:shearing", + "pools": [ + { + "bonus_rolls": 0.0, + "entries": [ + { + "type": "minecraft:item", + "name": "minecraft:black_wool" + } + ], + "rolls": { + "type": "minecraft:uniform", + "max": 3.0, + "min": 1.0 + } + } + ], + "random_sequence": "minecraft:shearing/sheep/black" +} \ No newline at end of file diff --git a/data/minecraft/loot_table/shearing/sheep/blue.json b/data/minecraft/loot_table/shearing/sheep/blue.json new file mode 100644 index 00000000..604d1ed2 --- /dev/null +++ b/data/minecraft/loot_table/shearing/sheep/blue.json @@ -0,0 +1,20 @@ +{ + "type": "minecraft:shearing", + "pools": [ + { + "bonus_rolls": 0.0, + "entries": [ + { + "type": "minecraft:item", + "name": "minecraft:blue_wool" + } + ], + "rolls": { + "type": "minecraft:uniform", + "max": 3.0, + "min": 1.0 + } + } + ], + "random_sequence": "minecraft:shearing/sheep/blue" +} \ No newline at end of file diff --git a/data/minecraft/loot_table/shearing/sheep/brown.json b/data/minecraft/loot_table/shearing/sheep/brown.json new file mode 100644 index 00000000..e6cf9a89 --- /dev/null +++ b/data/minecraft/loot_table/shearing/sheep/brown.json @@ -0,0 +1,20 @@ +{ + "type": "minecraft:shearing", + "pools": [ + { + "bonus_rolls": 0.0, + "entries": [ + { + "type": "minecraft:item", + "name": "minecraft:brown_wool" + } + ], + "rolls": { + "type": "minecraft:uniform", + "max": 3.0, + "min": 1.0 + } + } + ], + "random_sequence": "minecraft:shearing/sheep/brown" +} \ No newline at end of file diff --git a/data/minecraft/loot_table/shearing/sheep/cyan.json b/data/minecraft/loot_table/shearing/sheep/cyan.json new file mode 100644 index 00000000..e26e816f --- /dev/null +++ b/data/minecraft/loot_table/shearing/sheep/cyan.json @@ -0,0 +1,20 @@ +{ + "type": "minecraft:shearing", + "pools": [ + { + "bonus_rolls": 0.0, + "entries": [ + { + "type": "minecraft:item", + "name": "minecraft:cyan_wool" + } + ], + "rolls": { + "type": "minecraft:uniform", + "max": 3.0, + "min": 1.0 + } + } + ], + "random_sequence": "minecraft:shearing/sheep/cyan" +} \ No newline at end of file diff --git a/data/minecraft/loot_table/shearing/sheep/gray.json b/data/minecraft/loot_table/shearing/sheep/gray.json new file mode 100644 index 00000000..38b16d28 --- /dev/null +++ b/data/minecraft/loot_table/shearing/sheep/gray.json @@ -0,0 +1,20 @@ +{ + "type": "minecraft:shearing", + "pools": [ + { + "bonus_rolls": 0.0, + "entries": [ + { + "type": "minecraft:item", + "name": "minecraft:gray_wool" + } + ], + "rolls": { + "type": "minecraft:uniform", + "max": 3.0, + "min": 1.0 + } + } + ], + "random_sequence": "minecraft:shearing/sheep/gray" +} \ No newline at end of file diff --git a/data/minecraft/loot_table/shearing/sheep/green.json b/data/minecraft/loot_table/shearing/sheep/green.json new file mode 100644 index 00000000..5dbcb37a --- /dev/null +++ b/data/minecraft/loot_table/shearing/sheep/green.json @@ -0,0 +1,20 @@ +{ + "type": "minecraft:shearing", + "pools": [ + { + "bonus_rolls": 0.0, + "entries": [ + { + "type": "minecraft:item", + "name": "minecraft:green_wool" + } + ], + "rolls": { + "type": "minecraft:uniform", + "max": 3.0, + "min": 1.0 + } + } + ], + "random_sequence": "minecraft:shearing/sheep/green" +} \ No newline at end of file diff --git a/data/minecraft/loot_table/shearing/sheep/light_blue.json b/data/minecraft/loot_table/shearing/sheep/light_blue.json new file mode 100644 index 00000000..02993a97 --- /dev/null +++ b/data/minecraft/loot_table/shearing/sheep/light_blue.json @@ -0,0 +1,20 @@ +{ + "type": "minecraft:shearing", + "pools": [ + { + "bonus_rolls": 0.0, + "entries": [ + { + "type": "minecraft:item", + "name": "minecraft:light_blue_wool" + } + ], + "rolls": { + "type": "minecraft:uniform", + "max": 3.0, + "min": 1.0 + } + } + ], + "random_sequence": "minecraft:shearing/sheep/light_blue" +} \ No newline at end of file diff --git a/data/minecraft/loot_table/shearing/sheep/light_gray.json b/data/minecraft/loot_table/shearing/sheep/light_gray.json new file mode 100644 index 00000000..c0a91443 --- /dev/null +++ b/data/minecraft/loot_table/shearing/sheep/light_gray.json @@ -0,0 +1,20 @@ +{ + "type": "minecraft:shearing", + "pools": [ + { + "bonus_rolls": 0.0, + "entries": [ + { + "type": "minecraft:item", + "name": "minecraft:light_gray_wool" + } + ], + "rolls": { + "type": "minecraft:uniform", + "max": 3.0, + "min": 1.0 + } + } + ], + "random_sequence": "minecraft:shearing/sheep/light_gray" +} \ No newline at end of file diff --git a/data/minecraft/loot_table/shearing/sheep/lime.json b/data/minecraft/loot_table/shearing/sheep/lime.json new file mode 100644 index 00000000..08c14074 --- /dev/null +++ b/data/minecraft/loot_table/shearing/sheep/lime.json @@ -0,0 +1,20 @@ +{ + "type": "minecraft:shearing", + "pools": [ + { + "bonus_rolls": 0.0, + "entries": [ + { + "type": "minecraft:item", + "name": "minecraft:lime_wool" + } + ], + "rolls": { + "type": "minecraft:uniform", + "max": 3.0, + "min": 1.0 + } + } + ], + "random_sequence": "minecraft:shearing/sheep/lime" +} \ No newline at end of file diff --git a/data/minecraft/loot_table/shearing/sheep/magenta.json b/data/minecraft/loot_table/shearing/sheep/magenta.json new file mode 100644 index 00000000..66e4ad8b --- /dev/null +++ b/data/minecraft/loot_table/shearing/sheep/magenta.json @@ -0,0 +1,20 @@ +{ + "type": "minecraft:shearing", + "pools": [ + { + "bonus_rolls": 0.0, + "entries": [ + { + "type": "minecraft:item", + "name": "minecraft:magenta_wool" + } + ], + "rolls": { + "type": "minecraft:uniform", + "max": 3.0, + "min": 1.0 + } + } + ], + "random_sequence": "minecraft:shearing/sheep/magenta" +} \ No newline at end of file diff --git a/data/minecraft/loot_table/shearing/sheep/orange.json b/data/minecraft/loot_table/shearing/sheep/orange.json new file mode 100644 index 00000000..923cdfe6 --- /dev/null +++ b/data/minecraft/loot_table/shearing/sheep/orange.json @@ -0,0 +1,20 @@ +{ + "type": "minecraft:shearing", + "pools": [ + { + "bonus_rolls": 0.0, + "entries": [ + { + "type": "minecraft:item", + "name": "minecraft:orange_wool" + } + ], + "rolls": { + "type": "minecraft:uniform", + "max": 3.0, + "min": 1.0 + } + } + ], + "random_sequence": "minecraft:shearing/sheep/orange" +} \ No newline at end of file diff --git a/data/minecraft/loot_table/shearing/sheep/pink.json b/data/minecraft/loot_table/shearing/sheep/pink.json new file mode 100644 index 00000000..721234d6 --- /dev/null +++ b/data/minecraft/loot_table/shearing/sheep/pink.json @@ -0,0 +1,20 @@ +{ + "type": "minecraft:shearing", + "pools": [ + { + "bonus_rolls": 0.0, + "entries": [ + { + "type": "minecraft:item", + "name": "minecraft:pink_wool" + } + ], + "rolls": { + "type": "minecraft:uniform", + "max": 3.0, + "min": 1.0 + } + } + ], + "random_sequence": "minecraft:shearing/sheep/pink" +} \ No newline at end of file diff --git a/data/minecraft/loot_table/shearing/sheep/purple.json b/data/minecraft/loot_table/shearing/sheep/purple.json new file mode 100644 index 00000000..707becba --- /dev/null +++ b/data/minecraft/loot_table/shearing/sheep/purple.json @@ -0,0 +1,20 @@ +{ + "type": "minecraft:shearing", + "pools": [ + { + "bonus_rolls": 0.0, + "entries": [ + { + "type": "minecraft:item", + "name": "minecraft:purple_wool" + } + ], + "rolls": { + "type": "minecraft:uniform", + "max": 3.0, + "min": 1.0 + } + } + ], + "random_sequence": "minecraft:shearing/sheep/purple" +} \ No newline at end of file diff --git a/data/minecraft/loot_table/shearing/sheep/red.json b/data/minecraft/loot_table/shearing/sheep/red.json new file mode 100644 index 00000000..85df9c58 --- /dev/null +++ b/data/minecraft/loot_table/shearing/sheep/red.json @@ -0,0 +1,20 @@ +{ + "type": "minecraft:shearing", + "pools": [ + { + "bonus_rolls": 0.0, + "entries": [ + { + "type": "minecraft:item", + "name": "minecraft:red_wool" + } + ], + "rolls": { + "type": "minecraft:uniform", + "max": 3.0, + "min": 1.0 + } + } + ], + "random_sequence": "minecraft:shearing/sheep/red" +} \ No newline at end of file diff --git a/data/minecraft/loot_table/shearing/sheep/white.json b/data/minecraft/loot_table/shearing/sheep/white.json new file mode 100644 index 00000000..a14d9740 --- /dev/null +++ b/data/minecraft/loot_table/shearing/sheep/white.json @@ -0,0 +1,20 @@ +{ + "type": "minecraft:shearing", + "pools": [ + { + "bonus_rolls": 0.0, + "entries": [ + { + "type": "minecraft:item", + "name": "minecraft:white_wool" + } + ], + "rolls": { + "type": "minecraft:uniform", + "max": 3.0, + "min": 1.0 + } + } + ], + "random_sequence": "minecraft:shearing/sheep/white" +} \ No newline at end of file diff --git a/data/minecraft/loot_table/shearing/sheep/yellow.json b/data/minecraft/loot_table/shearing/sheep/yellow.json new file mode 100644 index 00000000..de15f5fb --- /dev/null +++ b/data/minecraft/loot_table/shearing/sheep/yellow.json @@ -0,0 +1,20 @@ +{ + "type": "minecraft:shearing", + "pools": [ + { + "bonus_rolls": 0.0, + "entries": [ + { + "type": "minecraft:item", + "name": "minecraft:yellow_wool" + } + ], + "rolls": { + "type": "minecraft:uniform", + "max": 3.0, + "min": 1.0 + } + } + ], + "random_sequence": "minecraft:shearing/sheep/yellow" +} \ No newline at end of file diff --git a/data/minecraft/loot_table/shearing/snow_golem.json b/data/minecraft/loot_table/shearing/snow_golem.json new file mode 100644 index 00000000..6e020599 --- /dev/null +++ b/data/minecraft/loot_table/shearing/snow_golem.json @@ -0,0 +1,16 @@ +{ + "type": "minecraft:shearing", + "pools": [ + { + "bonus_rolls": 0.0, + "entries": [ + { + "type": "minecraft:item", + "name": "minecraft:carved_pumpkin" + } + ], + "rolls": 1.0 + } + ], + "random_sequence": "minecraft:shearing/snow_golem" +} \ No newline at end of file diff --git a/data/minecraft/painting_variant/alban.json b/data/minecraft/painting_variant/alban.json index 255379be..39719caf 100644 --- a/data/minecraft/painting_variant/alban.json +++ b/data/minecraft/painting_variant/alban.json @@ -1,5 +1,13 @@ { "asset_id": "minecraft:alban", + "author": { + "color": "gray", + "translate": "painting.minecraft.alban.author" + }, "height": 1, + "title": { + "color": "yellow", + "translate": "painting.minecraft.alban.title" + }, "width": 1 } \ No newline at end of file diff --git a/data/minecraft/painting_variant/aztec.json b/data/minecraft/painting_variant/aztec.json index 4455e18e..40c37293 100644 --- a/data/minecraft/painting_variant/aztec.json +++ b/data/minecraft/painting_variant/aztec.json @@ -1,5 +1,13 @@ { "asset_id": "minecraft:aztec", + "author": { + "color": "gray", + "translate": "painting.minecraft.aztec.author" + }, "height": 1, + "title": { + "color": "yellow", + "translate": "painting.minecraft.aztec.title" + }, "width": 1 } \ No newline at end of file diff --git a/data/minecraft/painting_variant/aztec2.json b/data/minecraft/painting_variant/aztec2.json index 1d92296f..28a521fc 100644 --- a/data/minecraft/painting_variant/aztec2.json +++ b/data/minecraft/painting_variant/aztec2.json @@ -1,5 +1,13 @@ { "asset_id": "minecraft:aztec2", + "author": { + "color": "gray", + "translate": "painting.minecraft.aztec2.author" + }, "height": 1, + "title": { + "color": "yellow", + "translate": "painting.minecraft.aztec2.title" + }, "width": 1 } \ No newline at end of file diff --git a/data/minecraft/painting_variant/backyard.json b/data/minecraft/painting_variant/backyard.json index 6af19dae..cdd3fc32 100644 --- a/data/minecraft/painting_variant/backyard.json +++ b/data/minecraft/painting_variant/backyard.json @@ -1,5 +1,13 @@ { "asset_id": "minecraft:backyard", + "author": { + "color": "gray", + "translate": "painting.minecraft.backyard.author" + }, "height": 4, + "title": { + "color": "yellow", + "translate": "painting.minecraft.backyard.title" + }, "width": 3 } \ No newline at end of file diff --git a/data/minecraft/painting_variant/baroque.json b/data/minecraft/painting_variant/baroque.json index 2506d16e..3c593a1a 100644 --- a/data/minecraft/painting_variant/baroque.json +++ b/data/minecraft/painting_variant/baroque.json @@ -1,5 +1,13 @@ { "asset_id": "minecraft:baroque", + "author": { + "color": "gray", + "translate": "painting.minecraft.baroque.author" + }, "height": 2, + "title": { + "color": "yellow", + "translate": "painting.minecraft.baroque.title" + }, "width": 2 } \ No newline at end of file diff --git a/data/minecraft/painting_variant/bomb.json b/data/minecraft/painting_variant/bomb.json index e9e70fb1..ec784d2d 100644 --- a/data/minecraft/painting_variant/bomb.json +++ b/data/minecraft/painting_variant/bomb.json @@ -1,5 +1,13 @@ { "asset_id": "minecraft:bomb", + "author": { + "color": "gray", + "translate": "painting.minecraft.bomb.author" + }, "height": 1, + "title": { + "color": "yellow", + "translate": "painting.minecraft.bomb.title" + }, "width": 1 } \ No newline at end of file diff --git a/data/minecraft/painting_variant/bouquet.json b/data/minecraft/painting_variant/bouquet.json index 0ae5580a..1d8a4197 100644 --- a/data/minecraft/painting_variant/bouquet.json +++ b/data/minecraft/painting_variant/bouquet.json @@ -1,5 +1,13 @@ { "asset_id": "minecraft:bouquet", + "author": { + "color": "gray", + "translate": "painting.minecraft.bouquet.author" + }, "height": 3, + "title": { + "color": "yellow", + "translate": "painting.minecraft.bouquet.title" + }, "width": 3 } \ No newline at end of file diff --git a/data/minecraft/painting_variant/burning_skull.json b/data/minecraft/painting_variant/burning_skull.json index 87025297..5d28fe28 100644 --- a/data/minecraft/painting_variant/burning_skull.json +++ b/data/minecraft/painting_variant/burning_skull.json @@ -1,5 +1,13 @@ { "asset_id": "minecraft:burning_skull", + "author": { + "color": "gray", + "translate": "painting.minecraft.burning_skull.author" + }, "height": 4, + "title": { + "color": "yellow", + "translate": "painting.minecraft.burning_skull.title" + }, "width": 4 } \ No newline at end of file diff --git a/data/minecraft/painting_variant/bust.json b/data/minecraft/painting_variant/bust.json index 7e5751fa..4df7b603 100644 --- a/data/minecraft/painting_variant/bust.json +++ b/data/minecraft/painting_variant/bust.json @@ -1,5 +1,13 @@ { "asset_id": "minecraft:bust", + "author": { + "color": "gray", + "translate": "painting.minecraft.bust.author" + }, "height": 2, + "title": { + "color": "yellow", + "translate": "painting.minecraft.bust.title" + }, "width": 2 } \ No newline at end of file diff --git a/data/minecraft/painting_variant/cavebird.json b/data/minecraft/painting_variant/cavebird.json index 7de7284e..1ab7483e 100644 --- a/data/minecraft/painting_variant/cavebird.json +++ b/data/minecraft/painting_variant/cavebird.json @@ -1,5 +1,13 @@ { "asset_id": "minecraft:cavebird", + "author": { + "color": "gray", + "translate": "painting.minecraft.cavebird.author" + }, "height": 3, + "title": { + "color": "yellow", + "translate": "painting.minecraft.cavebird.title" + }, "width": 3 } \ No newline at end of file diff --git a/data/minecraft/painting_variant/changing.json b/data/minecraft/painting_variant/changing.json index 4c84b16c..4afe2442 100644 --- a/data/minecraft/painting_variant/changing.json +++ b/data/minecraft/painting_variant/changing.json @@ -1,5 +1,13 @@ { "asset_id": "minecraft:changing", + "author": { + "color": "gray", + "translate": "painting.minecraft.changing.author" + }, "height": 2, + "title": { + "color": "yellow", + "translate": "painting.minecraft.changing.title" + }, "width": 4 } \ No newline at end of file diff --git a/data/minecraft/painting_variant/cotan.json b/data/minecraft/painting_variant/cotan.json index eb2bfc41..067feffe 100644 --- a/data/minecraft/painting_variant/cotan.json +++ b/data/minecraft/painting_variant/cotan.json @@ -1,5 +1,13 @@ { "asset_id": "minecraft:cotan", + "author": { + "color": "gray", + "translate": "painting.minecraft.cotan.author" + }, "height": 3, + "title": { + "color": "yellow", + "translate": "painting.minecraft.cotan.title" + }, "width": 3 } \ No newline at end of file diff --git a/data/minecraft/painting_variant/courbet.json b/data/minecraft/painting_variant/courbet.json index 30b56b94..6cd1b831 100644 --- a/data/minecraft/painting_variant/courbet.json +++ b/data/minecraft/painting_variant/courbet.json @@ -1,5 +1,13 @@ { "asset_id": "minecraft:courbet", + "author": { + "color": "gray", + "translate": "painting.minecraft.courbet.author" + }, "height": 1, + "title": { + "color": "yellow", + "translate": "painting.minecraft.courbet.title" + }, "width": 2 } \ No newline at end of file diff --git a/data/minecraft/painting_variant/creebet.json b/data/minecraft/painting_variant/creebet.json index 2fa2c68e..69710652 100644 --- a/data/minecraft/painting_variant/creebet.json +++ b/data/minecraft/painting_variant/creebet.json @@ -1,5 +1,13 @@ { "asset_id": "minecraft:creebet", + "author": { + "color": "gray", + "translate": "painting.minecraft.creebet.author" + }, "height": 1, + "title": { + "color": "yellow", + "translate": "painting.minecraft.creebet.title" + }, "width": 2 } \ No newline at end of file diff --git a/data/minecraft/painting_variant/donkey_kong.json b/data/minecraft/painting_variant/donkey_kong.json index df7e4380..79ecbd00 100644 --- a/data/minecraft/painting_variant/donkey_kong.json +++ b/data/minecraft/painting_variant/donkey_kong.json @@ -1,5 +1,13 @@ { "asset_id": "minecraft:donkey_kong", + "author": { + "color": "gray", + "translate": "painting.minecraft.donkey_kong.author" + }, "height": 3, + "title": { + "color": "yellow", + "translate": "painting.minecraft.donkey_kong.title" + }, "width": 4 } \ No newline at end of file diff --git a/data/minecraft/painting_variant/earth.json b/data/minecraft/painting_variant/earth.json index 457074b3..d52b2366 100644 --- a/data/minecraft/painting_variant/earth.json +++ b/data/minecraft/painting_variant/earth.json @@ -1,5 +1,9 @@ { "asset_id": "minecraft:earth", "height": 2, + "title": { + "color": "yellow", + "translate": "painting.minecraft.earth.title" + }, "width": 2 } \ No newline at end of file diff --git a/data/minecraft/painting_variant/endboss.json b/data/minecraft/painting_variant/endboss.json index bae094f3..5d869183 100644 --- a/data/minecraft/painting_variant/endboss.json +++ b/data/minecraft/painting_variant/endboss.json @@ -1,5 +1,13 @@ { "asset_id": "minecraft:endboss", + "author": { + "color": "gray", + "translate": "painting.minecraft.endboss.author" + }, "height": 3, + "title": { + "color": "yellow", + "translate": "painting.minecraft.endboss.title" + }, "width": 3 } \ No newline at end of file diff --git a/data/minecraft/painting_variant/fern.json b/data/minecraft/painting_variant/fern.json index f2687008..49db47d8 100644 --- a/data/minecraft/painting_variant/fern.json +++ b/data/minecraft/painting_variant/fern.json @@ -1,5 +1,13 @@ { "asset_id": "minecraft:fern", + "author": { + "color": "gray", + "translate": "painting.minecraft.fern.author" + }, "height": 3, + "title": { + "color": "yellow", + "translate": "painting.minecraft.fern.title" + }, "width": 3 } \ No newline at end of file diff --git a/data/minecraft/painting_variant/fighters.json b/data/minecraft/painting_variant/fighters.json index 2815f0b7..091530d1 100644 --- a/data/minecraft/painting_variant/fighters.json +++ b/data/minecraft/painting_variant/fighters.json @@ -1,5 +1,13 @@ { "asset_id": "minecraft:fighters", + "author": { + "color": "gray", + "translate": "painting.minecraft.fighters.author" + }, "height": 2, + "title": { + "color": "yellow", + "translate": "painting.minecraft.fighters.title" + }, "width": 4 } \ No newline at end of file diff --git a/data/minecraft/painting_variant/finding.json b/data/minecraft/painting_variant/finding.json index ece67f72..235cb6b8 100644 --- a/data/minecraft/painting_variant/finding.json +++ b/data/minecraft/painting_variant/finding.json @@ -1,5 +1,13 @@ { "asset_id": "minecraft:finding", + "author": { + "color": "gray", + "translate": "painting.minecraft.finding.author" + }, "height": 2, + "title": { + "color": "yellow", + "translate": "painting.minecraft.finding.title" + }, "width": 4 } \ No newline at end of file diff --git a/data/minecraft/painting_variant/fire.json b/data/minecraft/painting_variant/fire.json index 470e511e..ff45c9ca 100644 --- a/data/minecraft/painting_variant/fire.json +++ b/data/minecraft/painting_variant/fire.json @@ -1,5 +1,9 @@ { "asset_id": "minecraft:fire", "height": 2, + "title": { + "color": "yellow", + "translate": "painting.minecraft.fire.title" + }, "width": 2 } \ No newline at end of file diff --git a/data/minecraft/painting_variant/graham.json b/data/minecraft/painting_variant/graham.json index fcee8cc1..c34738ed 100644 --- a/data/minecraft/painting_variant/graham.json +++ b/data/minecraft/painting_variant/graham.json @@ -1,5 +1,13 @@ { "asset_id": "minecraft:graham", + "author": { + "color": "gray", + "translate": "painting.minecraft.graham.author" + }, "height": 2, + "title": { + "color": "yellow", + "translate": "painting.minecraft.graham.title" + }, "width": 1 } \ No newline at end of file diff --git a/data/minecraft/painting_variant/humble.json b/data/minecraft/painting_variant/humble.json index 85e4247c..36343392 100644 --- a/data/minecraft/painting_variant/humble.json +++ b/data/minecraft/painting_variant/humble.json @@ -1,5 +1,13 @@ { "asset_id": "minecraft:humble", + "author": { + "color": "gray", + "translate": "painting.minecraft.humble.author" + }, "height": 2, + "title": { + "color": "yellow", + "translate": "painting.minecraft.humble.title" + }, "width": 2 } \ No newline at end of file diff --git a/data/minecraft/painting_variant/kebab.json b/data/minecraft/painting_variant/kebab.json index 3c11f259..bff9be3e 100644 --- a/data/minecraft/painting_variant/kebab.json +++ b/data/minecraft/painting_variant/kebab.json @@ -1,5 +1,13 @@ { "asset_id": "minecraft:kebab", + "author": { + "color": "gray", + "translate": "painting.minecraft.kebab.author" + }, "height": 1, + "title": { + "color": "yellow", + "translate": "painting.minecraft.kebab.title" + }, "width": 1 } \ No newline at end of file diff --git a/data/minecraft/painting_variant/lowmist.json b/data/minecraft/painting_variant/lowmist.json index cbff4a50..d052c782 100644 --- a/data/minecraft/painting_variant/lowmist.json +++ b/data/minecraft/painting_variant/lowmist.json @@ -1,5 +1,13 @@ { "asset_id": "minecraft:lowmist", + "author": { + "color": "gray", + "translate": "painting.minecraft.lowmist.author" + }, "height": 2, + "title": { + "color": "yellow", + "translate": "painting.minecraft.lowmist.title" + }, "width": 4 } \ No newline at end of file diff --git a/data/minecraft/painting_variant/match.json b/data/minecraft/painting_variant/match.json index f0307c03..477fd009 100644 --- a/data/minecraft/painting_variant/match.json +++ b/data/minecraft/painting_variant/match.json @@ -1,5 +1,13 @@ { "asset_id": "minecraft:match", + "author": { + "color": "gray", + "translate": "painting.minecraft.match.author" + }, "height": 2, + "title": { + "color": "yellow", + "translate": "painting.minecraft.match.title" + }, "width": 2 } \ No newline at end of file diff --git a/data/minecraft/painting_variant/meditative.json b/data/minecraft/painting_variant/meditative.json index 8310bca4..95b0559d 100644 --- a/data/minecraft/painting_variant/meditative.json +++ b/data/minecraft/painting_variant/meditative.json @@ -1,5 +1,13 @@ { "asset_id": "minecraft:meditative", + "author": { + "color": "gray", + "translate": "painting.minecraft.meditative.author" + }, "height": 1, + "title": { + "color": "yellow", + "translate": "painting.minecraft.meditative.title" + }, "width": 1 } \ No newline at end of file diff --git a/data/minecraft/painting_variant/orb.json b/data/minecraft/painting_variant/orb.json index d5fd196d..0095844d 100644 --- a/data/minecraft/painting_variant/orb.json +++ b/data/minecraft/painting_variant/orb.json @@ -1,5 +1,13 @@ { "asset_id": "minecraft:orb", + "author": { + "color": "gray", + "translate": "painting.minecraft.orb.author" + }, "height": 4, + "title": { + "color": "yellow", + "translate": "painting.minecraft.orb.title" + }, "width": 4 } \ No newline at end of file diff --git a/data/minecraft/painting_variant/owlemons.json b/data/minecraft/painting_variant/owlemons.json index 41840528..2909f999 100644 --- a/data/minecraft/painting_variant/owlemons.json +++ b/data/minecraft/painting_variant/owlemons.json @@ -1,5 +1,13 @@ { "asset_id": "minecraft:owlemons", + "author": { + "color": "gray", + "translate": "painting.minecraft.owlemons.author" + }, "height": 3, + "title": { + "color": "yellow", + "translate": "painting.minecraft.owlemons.title" + }, "width": 3 } \ No newline at end of file diff --git a/data/minecraft/painting_variant/passage.json b/data/minecraft/painting_variant/passage.json index d7b16539..dc50ade6 100644 --- a/data/minecraft/painting_variant/passage.json +++ b/data/minecraft/painting_variant/passage.json @@ -1,5 +1,13 @@ { "asset_id": "minecraft:passage", + "author": { + "color": "gray", + "translate": "painting.minecraft.passage.author" + }, "height": 2, + "title": { + "color": "yellow", + "translate": "painting.minecraft.passage.title" + }, "width": 4 } \ No newline at end of file diff --git a/data/minecraft/painting_variant/pigscene.json b/data/minecraft/painting_variant/pigscene.json index 04512352..b9701d6e 100644 --- a/data/minecraft/painting_variant/pigscene.json +++ b/data/minecraft/painting_variant/pigscene.json @@ -1,5 +1,13 @@ { "asset_id": "minecraft:pigscene", + "author": { + "color": "gray", + "translate": "painting.minecraft.pigscene.author" + }, "height": 4, + "title": { + "color": "yellow", + "translate": "painting.minecraft.pigscene.title" + }, "width": 4 } \ No newline at end of file diff --git a/data/minecraft/painting_variant/plant.json b/data/minecraft/painting_variant/plant.json index 306feb1c..35532b66 100644 --- a/data/minecraft/painting_variant/plant.json +++ b/data/minecraft/painting_variant/plant.json @@ -1,5 +1,13 @@ { "asset_id": "minecraft:plant", + "author": { + "color": "gray", + "translate": "painting.minecraft.plant.author" + }, "height": 1, + "title": { + "color": "yellow", + "translate": "painting.minecraft.plant.title" + }, "width": 1 } \ No newline at end of file diff --git a/data/minecraft/painting_variant/pointer.json b/data/minecraft/painting_variant/pointer.json index bedc8430..747ca76d 100644 --- a/data/minecraft/painting_variant/pointer.json +++ b/data/minecraft/painting_variant/pointer.json @@ -1,5 +1,13 @@ { "asset_id": "minecraft:pointer", + "author": { + "color": "gray", + "translate": "painting.minecraft.pointer.author" + }, "height": 4, + "title": { + "color": "yellow", + "translate": "painting.minecraft.pointer.title" + }, "width": 4 } \ No newline at end of file diff --git a/data/minecraft/painting_variant/pond.json b/data/minecraft/painting_variant/pond.json index 1a39b4ed..2aeccf97 100644 --- a/data/minecraft/painting_variant/pond.json +++ b/data/minecraft/painting_variant/pond.json @@ -1,5 +1,13 @@ { "asset_id": "minecraft:pond", + "author": { + "color": "gray", + "translate": "painting.minecraft.pond.author" + }, "height": 4, + "title": { + "color": "yellow", + "translate": "painting.minecraft.pond.title" + }, "width": 3 } \ No newline at end of file diff --git a/data/minecraft/painting_variant/pool.json b/data/minecraft/painting_variant/pool.json index b689482f..9fd50436 100644 --- a/data/minecraft/painting_variant/pool.json +++ b/data/minecraft/painting_variant/pool.json @@ -1,5 +1,13 @@ { "asset_id": "minecraft:pool", + "author": { + "color": "gray", + "translate": "painting.minecraft.pool.author" + }, "height": 1, + "title": { + "color": "yellow", + "translate": "painting.minecraft.pool.title" + }, "width": 2 } \ No newline at end of file diff --git a/data/minecraft/painting_variant/prairie_ride.json b/data/minecraft/painting_variant/prairie_ride.json index aefcc131..e7b73be3 100644 --- a/data/minecraft/painting_variant/prairie_ride.json +++ b/data/minecraft/painting_variant/prairie_ride.json @@ -1,5 +1,13 @@ { "asset_id": "minecraft:prairie_ride", + "author": { + "color": "gray", + "translate": "painting.minecraft.prairie_ride.author" + }, "height": 2, + "title": { + "color": "yellow", + "translate": "painting.minecraft.prairie_ride.title" + }, "width": 1 } \ No newline at end of file diff --git a/data/minecraft/painting_variant/sea.json b/data/minecraft/painting_variant/sea.json index 925c4289..43bd6880 100644 --- a/data/minecraft/painting_variant/sea.json +++ b/data/minecraft/painting_variant/sea.json @@ -1,5 +1,13 @@ { "asset_id": "minecraft:sea", + "author": { + "color": "gray", + "translate": "painting.minecraft.sea.author" + }, "height": 1, + "title": { + "color": "yellow", + "translate": "painting.minecraft.sea.title" + }, "width": 2 } \ No newline at end of file diff --git a/data/minecraft/painting_variant/skeleton.json b/data/minecraft/painting_variant/skeleton.json index d2ae4d60..cbf93d8e 100644 --- a/data/minecraft/painting_variant/skeleton.json +++ b/data/minecraft/painting_variant/skeleton.json @@ -1,5 +1,13 @@ { "asset_id": "minecraft:skeleton", + "author": { + "color": "gray", + "translate": "painting.minecraft.skeleton.author" + }, "height": 3, + "title": { + "color": "yellow", + "translate": "painting.minecraft.skeleton.title" + }, "width": 4 } \ No newline at end of file diff --git a/data/minecraft/painting_variant/skull_and_roses.json b/data/minecraft/painting_variant/skull_and_roses.json index 7ee8cbff..88cfc580 100644 --- a/data/minecraft/painting_variant/skull_and_roses.json +++ b/data/minecraft/painting_variant/skull_and_roses.json @@ -1,5 +1,13 @@ { "asset_id": "minecraft:skull_and_roses", + "author": { + "color": "gray", + "translate": "painting.minecraft.skull_and_roses.author" + }, "height": 2, + "title": { + "color": "yellow", + "translate": "painting.minecraft.skull_and_roses.title" + }, "width": 2 } \ No newline at end of file diff --git a/data/minecraft/painting_variant/stage.json b/data/minecraft/painting_variant/stage.json index 7998cd46..001e7a86 100644 --- a/data/minecraft/painting_variant/stage.json +++ b/data/minecraft/painting_variant/stage.json @@ -1,5 +1,13 @@ { "asset_id": "minecraft:stage", + "author": { + "color": "gray", + "translate": "painting.minecraft.stage.author" + }, "height": 2, + "title": { + "color": "yellow", + "translate": "painting.minecraft.stage.title" + }, "width": 2 } \ No newline at end of file diff --git a/data/minecraft/painting_variant/sunflowers.json b/data/minecraft/painting_variant/sunflowers.json index 2a29031b..837dd239 100644 --- a/data/minecraft/painting_variant/sunflowers.json +++ b/data/minecraft/painting_variant/sunflowers.json @@ -1,5 +1,13 @@ { "asset_id": "minecraft:sunflowers", + "author": { + "color": "gray", + "translate": "painting.minecraft.sunflowers.author" + }, "height": 3, + "title": { + "color": "yellow", + "translate": "painting.minecraft.sunflowers.title" + }, "width": 3 } \ No newline at end of file diff --git a/data/minecraft/painting_variant/sunset.json b/data/minecraft/painting_variant/sunset.json index 3a9350df..a2b4470d 100644 --- a/data/minecraft/painting_variant/sunset.json +++ b/data/minecraft/painting_variant/sunset.json @@ -1,5 +1,13 @@ { "asset_id": "minecraft:sunset", + "author": { + "color": "gray", + "translate": "painting.minecraft.sunset.author" + }, "height": 1, + "title": { + "color": "yellow", + "translate": "painting.minecraft.sunset.title" + }, "width": 2 } \ No newline at end of file diff --git a/data/minecraft/painting_variant/tides.json b/data/minecraft/painting_variant/tides.json index 488d37bc..c40d3b1b 100644 --- a/data/minecraft/painting_variant/tides.json +++ b/data/minecraft/painting_variant/tides.json @@ -1,5 +1,13 @@ { "asset_id": "minecraft:tides", + "author": { + "color": "gray", + "translate": "painting.minecraft.tides.author" + }, "height": 3, + "title": { + "color": "yellow", + "translate": "painting.minecraft.tides.title" + }, "width": 3 } \ No newline at end of file diff --git a/data/minecraft/painting_variant/unpacked.json b/data/minecraft/painting_variant/unpacked.json index 57c2b4ab..5a21cc02 100644 --- a/data/minecraft/painting_variant/unpacked.json +++ b/data/minecraft/painting_variant/unpacked.json @@ -1,5 +1,13 @@ { "asset_id": "minecraft:unpacked", + "author": { + "color": "gray", + "translate": "painting.minecraft.unpacked.author" + }, "height": 4, + "title": { + "color": "yellow", + "translate": "painting.minecraft.unpacked.title" + }, "width": 4 } \ No newline at end of file diff --git a/data/minecraft/painting_variant/void.json b/data/minecraft/painting_variant/void.json index 2bb9eb53..0ce54d48 100644 --- a/data/minecraft/painting_variant/void.json +++ b/data/minecraft/painting_variant/void.json @@ -1,5 +1,13 @@ { "asset_id": "minecraft:void", + "author": { + "color": "gray", + "translate": "painting.minecraft.void.author" + }, "height": 2, + "title": { + "color": "yellow", + "translate": "painting.minecraft.void.title" + }, "width": 2 } \ No newline at end of file diff --git a/data/minecraft/painting_variant/wanderer.json b/data/minecraft/painting_variant/wanderer.json index 21255776..c62b6b64 100644 --- a/data/minecraft/painting_variant/wanderer.json +++ b/data/minecraft/painting_variant/wanderer.json @@ -1,5 +1,13 @@ { "asset_id": "minecraft:wanderer", + "author": { + "color": "gray", + "translate": "painting.minecraft.wanderer.author" + }, "height": 2, + "title": { + "color": "yellow", + "translate": "painting.minecraft.wanderer.title" + }, "width": 1 } \ No newline at end of file diff --git a/data/minecraft/painting_variant/wasteland.json b/data/minecraft/painting_variant/wasteland.json index d873432e..a126eb24 100644 --- a/data/minecraft/painting_variant/wasteland.json +++ b/data/minecraft/painting_variant/wasteland.json @@ -1,5 +1,13 @@ { "asset_id": "minecraft:wasteland", + "author": { + "color": "gray", + "translate": "painting.minecraft.wasteland.author" + }, "height": 1, + "title": { + "color": "yellow", + "translate": "painting.minecraft.wasteland.title" + }, "width": 1 } \ No newline at end of file diff --git a/data/minecraft/painting_variant/water.json b/data/minecraft/painting_variant/water.json index f1fc49da..f358ae77 100644 --- a/data/minecraft/painting_variant/water.json +++ b/data/minecraft/painting_variant/water.json @@ -1,5 +1,9 @@ { "asset_id": "minecraft:water", "height": 2, + "title": { + "color": "yellow", + "translate": "painting.minecraft.water.title" + }, "width": 2 } \ No newline at end of file diff --git a/data/minecraft/painting_variant/wind.json b/data/minecraft/painting_variant/wind.json index b5c2c1de..6b836028 100644 --- a/data/minecraft/painting_variant/wind.json +++ b/data/minecraft/painting_variant/wind.json @@ -1,5 +1,9 @@ { "asset_id": "minecraft:wind", "height": 2, + "title": { + "color": "yellow", + "translate": "painting.minecraft.wind.title" + }, "width": 2 } \ No newline at end of file diff --git a/data/minecraft/painting_variant/wither.json b/data/minecraft/painting_variant/wither.json index 482ab3af..8ece65fd 100644 --- a/data/minecraft/painting_variant/wither.json +++ b/data/minecraft/painting_variant/wither.json @@ -1,5 +1,9 @@ { "asset_id": "minecraft:wither", "height": 2, + "title": { + "color": "yellow", + "translate": "painting.minecraft.wither.title" + }, "width": 2 } \ No newline at end of file diff --git a/data/minecraft/recipe/acacia_boat.json b/data/minecraft/recipe/acacia_boat.json index af9b2ec4..3fb1cd2a 100644 --- a/data/minecraft/recipe/acacia_boat.json +++ b/data/minecraft/recipe/acacia_boat.json @@ -3,9 +3,7 @@ "category": "misc", "group": "boat", "key": { - "#": { - "item": "minecraft:acacia_planks" - } + "#": "minecraft:acacia_planks" }, "pattern": [ "# #", diff --git a/data/minecraft/recipe/acacia_button.json b/data/minecraft/recipe/acacia_button.json index 429a654f..9d47c232 100644 --- a/data/minecraft/recipe/acacia_button.json +++ b/data/minecraft/recipe/acacia_button.json @@ -3,9 +3,7 @@ "category": "redstone", "group": "wooden_button", "ingredients": [ - { - "item": "minecraft:acacia_planks" - } + "minecraft:acacia_planks" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/acacia_chest_boat.json b/data/minecraft/recipe/acacia_chest_boat.json index aed352c2..bfa62482 100644 --- a/data/minecraft/recipe/acacia_chest_boat.json +++ b/data/minecraft/recipe/acacia_chest_boat.json @@ -3,12 +3,8 @@ "category": "misc", "group": "chest_boat", "ingredients": [ - { - "item": "minecraft:chest" - }, - { - "item": "minecraft:acacia_boat" - } + "minecraft:chest", + "minecraft:acacia_boat" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/acacia_door.json b/data/minecraft/recipe/acacia_door.json index fabf8764..77ad9700 100644 --- a/data/minecraft/recipe/acacia_door.json +++ b/data/minecraft/recipe/acacia_door.json @@ -3,9 +3,7 @@ "category": "redstone", "group": "wooden_door", "key": { - "#": { - "item": "minecraft:acacia_planks" - } + "#": "minecraft:acacia_planks" }, "pattern": [ "##", diff --git a/data/minecraft/recipe/acacia_fence.json b/data/minecraft/recipe/acacia_fence.json index 8ed3250e..9ea5963c 100644 --- a/data/minecraft/recipe/acacia_fence.json +++ b/data/minecraft/recipe/acacia_fence.json @@ -3,12 +3,8 @@ "category": "misc", "group": "wooden_fence", "key": { - "#": { - "item": "minecraft:stick" - }, - "W": { - "item": "minecraft:acacia_planks" - } + "#": "minecraft:stick", + "W": "minecraft:acacia_planks" }, "pattern": [ "W#W", diff --git a/data/minecraft/recipe/acacia_fence_gate.json b/data/minecraft/recipe/acacia_fence_gate.json index 4f50c164..86d47863 100644 --- a/data/minecraft/recipe/acacia_fence_gate.json +++ b/data/minecraft/recipe/acacia_fence_gate.json @@ -3,12 +3,8 @@ "category": "redstone", "group": "wooden_fence_gate", "key": { - "#": { - "item": "minecraft:stick" - }, - "W": { - "item": "minecraft:acacia_planks" - } + "#": "minecraft:stick", + "W": "minecraft:acacia_planks" }, "pattern": [ "#W#", diff --git a/data/minecraft/recipe/acacia_hanging_sign.json b/data/minecraft/recipe/acacia_hanging_sign.json index 1e485e81..d5d34145 100644 --- a/data/minecraft/recipe/acacia_hanging_sign.json +++ b/data/minecraft/recipe/acacia_hanging_sign.json @@ -3,12 +3,8 @@ "category": "misc", "group": "hanging_sign", "key": { - "#": { - "item": "minecraft:stripped_acacia_log" - }, - "X": { - "item": "minecraft:chain" - } + "#": "minecraft:stripped_acacia_log", + "X": "minecraft:chain" }, "pattern": [ "X X", diff --git a/data/minecraft/recipe/acacia_planks.json b/data/minecraft/recipe/acacia_planks.json index a02c8a62..11e6cdf1 100644 --- a/data/minecraft/recipe/acacia_planks.json +++ b/data/minecraft/recipe/acacia_planks.json @@ -3,9 +3,7 @@ "category": "building", "group": "planks", "ingredients": [ - { - "tag": "minecraft:acacia_logs" - } + "#minecraft:acacia_logs" ], "result": { "count": 4, diff --git a/data/minecraft/recipe/acacia_pressure_plate.json b/data/minecraft/recipe/acacia_pressure_plate.json index 318a7ac6..885f2976 100644 --- a/data/minecraft/recipe/acacia_pressure_plate.json +++ b/data/minecraft/recipe/acacia_pressure_plate.json @@ -3,9 +3,7 @@ "category": "redstone", "group": "wooden_pressure_plate", "key": { - "#": { - "item": "minecraft:acacia_planks" - } + "#": "minecraft:acacia_planks" }, "pattern": [ "##" diff --git a/data/minecraft/recipe/acacia_sign.json b/data/minecraft/recipe/acacia_sign.json index 64a56e98..4a895db2 100644 --- a/data/minecraft/recipe/acacia_sign.json +++ b/data/minecraft/recipe/acacia_sign.json @@ -3,12 +3,8 @@ "category": "misc", "group": "wooden_sign", "key": { - "#": { - "item": "minecraft:acacia_planks" - }, - "X": { - "item": "minecraft:stick" - } + "#": "minecraft:acacia_planks", + "X": "minecraft:stick" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/acacia_slab.json b/data/minecraft/recipe/acacia_slab.json index 6bff34fa..aab58b72 100644 --- a/data/minecraft/recipe/acacia_slab.json +++ b/data/minecraft/recipe/acacia_slab.json @@ -3,9 +3,7 @@ "category": "building", "group": "wooden_slab", "key": { - "#": { - "item": "minecraft:acacia_planks" - } + "#": "minecraft:acacia_planks" }, "pattern": [ "###" diff --git a/data/minecraft/recipe/acacia_stairs.json b/data/minecraft/recipe/acacia_stairs.json index c6997e65..dab8cea4 100644 --- a/data/minecraft/recipe/acacia_stairs.json +++ b/data/minecraft/recipe/acacia_stairs.json @@ -3,9 +3,7 @@ "category": "building", "group": "wooden_stairs", "key": { - "#": { - "item": "minecraft:acacia_planks" - } + "#": "minecraft:acacia_planks" }, "pattern": [ "# ", diff --git a/data/minecraft/recipe/acacia_trapdoor.json b/data/minecraft/recipe/acacia_trapdoor.json index bd2fe9bd..afd5eab3 100644 --- a/data/minecraft/recipe/acacia_trapdoor.json +++ b/data/minecraft/recipe/acacia_trapdoor.json @@ -3,9 +3,7 @@ "category": "redstone", "group": "wooden_trapdoor", "key": { - "#": { - "item": "minecraft:acacia_planks" - } + "#": "minecraft:acacia_planks" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/acacia_wood.json b/data/minecraft/recipe/acacia_wood.json index ad3287ee..91eba8b7 100644 --- a/data/minecraft/recipe/acacia_wood.json +++ b/data/minecraft/recipe/acacia_wood.json @@ -3,9 +3,7 @@ "category": "building", "group": "bark", "key": { - "#": { - "item": "minecraft:acacia_log" - } + "#": "minecraft:acacia_log" }, "pattern": [ "##", diff --git a/data/minecraft/recipe/activator_rail.json b/data/minecraft/recipe/activator_rail.json index 85b8295e..f876a587 100644 --- a/data/minecraft/recipe/activator_rail.json +++ b/data/minecraft/recipe/activator_rail.json @@ -2,15 +2,9 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "#": { - "item": "minecraft:redstone_torch" - }, - "S": { - "item": "minecraft:stick" - }, - "X": { - "item": "minecraft:iron_ingot" - } + "#": "minecraft:redstone_torch", + "S": "minecraft:stick", + "X": "minecraft:iron_ingot" }, "pattern": [ "XSX", diff --git a/data/minecraft/recipe/amethyst_block.json b/data/minecraft/recipe/amethyst_block.json index 50538e2d..084f9b5d 100644 --- a/data/minecraft/recipe/amethyst_block.json +++ b/data/minecraft/recipe/amethyst_block.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:amethyst_shard" - } + "#": "minecraft:amethyst_shard" }, "pattern": [ "##", diff --git a/data/minecraft/recipe/andesite.json b/data/minecraft/recipe/andesite.json index 58d75a7a..175f9782 100644 --- a/data/minecraft/recipe/andesite.json +++ b/data/minecraft/recipe/andesite.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shapeless", "category": "building", "ingredients": [ - { - "item": "minecraft:diorite" - }, - { - "item": "minecraft:cobblestone" - } + "minecraft:diorite", + "minecraft:cobblestone" ], "result": { "count": 2, diff --git a/data/minecraft/recipe/andesite_slab.json b/data/minecraft/recipe/andesite_slab.json index 9a47de00..8bfed611 100644 --- a/data/minecraft/recipe/andesite_slab.json +++ b/data/minecraft/recipe/andesite_slab.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:andesite" - } + "#": "minecraft:andesite" }, "pattern": [ "###" diff --git a/data/minecraft/recipe/andesite_slab_from_andesite_stonecutting.json b/data/minecraft/recipe/andesite_slab_from_andesite_stonecutting.json index 43a8d56b..532712b4 100644 --- a/data/minecraft/recipe/andesite_slab_from_andesite_stonecutting.json +++ b/data/minecraft/recipe/andesite_slab_from_andesite_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:andesite" - }, + "ingredient": "minecraft:andesite", "result": { "count": 2, "id": "minecraft:andesite_slab" diff --git a/data/minecraft/recipe/andesite_stairs.json b/data/minecraft/recipe/andesite_stairs.json index cbe289cc..2d01ba99 100644 --- a/data/minecraft/recipe/andesite_stairs.json +++ b/data/minecraft/recipe/andesite_stairs.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:andesite" - } + "#": "minecraft:andesite" }, "pattern": [ "# ", diff --git a/data/minecraft/recipe/andesite_stairs_from_andesite_stonecutting.json b/data/minecraft/recipe/andesite_stairs_from_andesite_stonecutting.json index 76b862de..68fb923f 100644 --- a/data/minecraft/recipe/andesite_stairs_from_andesite_stonecutting.json +++ b/data/minecraft/recipe/andesite_stairs_from_andesite_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:andesite" - }, + "ingredient": "minecraft:andesite", "result": { "count": 1, "id": "minecraft:andesite_stairs" diff --git a/data/minecraft/recipe/andesite_wall.json b/data/minecraft/recipe/andesite_wall.json index 4a9b1c62..d42c659a 100644 --- a/data/minecraft/recipe/andesite_wall.json +++ b/data/minecraft/recipe/andesite_wall.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "#": { - "item": "minecraft:andesite" - } + "#": "minecraft:andesite" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/andesite_wall_from_andesite_stonecutting.json b/data/minecraft/recipe/andesite_wall_from_andesite_stonecutting.json index 48018314..160bc6f7 100644 --- a/data/minecraft/recipe/andesite_wall_from_andesite_stonecutting.json +++ b/data/minecraft/recipe/andesite_wall_from_andesite_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:andesite" - }, + "ingredient": "minecraft:andesite", "result": { "count": 1, "id": "minecraft:andesite_wall" diff --git a/data/minecraft/recipe/anvil.json b/data/minecraft/recipe/anvil.json index e6323159..b436449c 100644 --- a/data/minecraft/recipe/anvil.json +++ b/data/minecraft/recipe/anvil.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "I": { - "item": "minecraft:iron_block" - }, - "i": { - "item": "minecraft:iron_ingot" - } + "I": "minecraft:iron_block", + "i": "minecraft:iron_ingot" }, "pattern": [ "III", diff --git a/data/minecraft/recipe/armor_stand.json b/data/minecraft/recipe/armor_stand.json index 6fa97a11..1741167b 100644 --- a/data/minecraft/recipe/armor_stand.json +++ b/data/minecraft/recipe/armor_stand.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "/": { - "item": "minecraft:stick" - }, - "_": { - "item": "minecraft:smooth_stone_slab" - } + "/": "minecraft:stick", + "_": "minecraft:smooth_stone_slab" }, "pattern": [ "///", diff --git a/data/minecraft/recipe/arrow.json b/data/minecraft/recipe/arrow.json index 01581a2a..9a34cf3a 100644 --- a/data/minecraft/recipe/arrow.json +++ b/data/minecraft/recipe/arrow.json @@ -2,15 +2,9 @@ "type": "minecraft:crafting_shaped", "category": "equipment", "key": { - "#": { - "item": "minecraft:stick" - }, - "X": { - "item": "minecraft:flint" - }, - "Y": { - "item": "minecraft:feather" - } + "#": "minecraft:stick", + "X": "minecraft:flint", + "Y": "minecraft:feather" }, "pattern": [ "X", diff --git a/data/minecraft/recipe/baked_potato.json b/data/minecraft/recipe/baked_potato.json index 291f378f..23a0bfb5 100644 --- a/data/minecraft/recipe/baked_potato.json +++ b/data/minecraft/recipe/baked_potato.json @@ -3,9 +3,7 @@ "category": "food", "cookingtime": 200, "experience": 0.35, - "ingredient": { - "item": "minecraft:potato" - }, + "ingredient": "minecraft:potato", "result": { "id": "minecraft:baked_potato" } diff --git a/data/minecraft/recipe/baked_potato_from_campfire_cooking.json b/data/minecraft/recipe/baked_potato_from_campfire_cooking.json index 60829f48..0264ae3c 100644 --- a/data/minecraft/recipe/baked_potato_from_campfire_cooking.json +++ b/data/minecraft/recipe/baked_potato_from_campfire_cooking.json @@ -3,9 +3,7 @@ "category": "food", "cookingtime": 600, "experience": 0.35, - "ingredient": { - "item": "minecraft:potato" - }, + "ingredient": "minecraft:potato", "result": { "id": "minecraft:baked_potato" } diff --git a/data/minecraft/recipe/baked_potato_from_smoking.json b/data/minecraft/recipe/baked_potato_from_smoking.json index 3355ccd8..8f7c140e 100644 --- a/data/minecraft/recipe/baked_potato_from_smoking.json +++ b/data/minecraft/recipe/baked_potato_from_smoking.json @@ -3,9 +3,7 @@ "category": "food", "cookingtime": 100, "experience": 0.35, - "ingredient": { - "item": "minecraft:potato" - }, + "ingredient": "minecraft:potato", "result": { "id": "minecraft:baked_potato" } diff --git a/data/minecraft/recipe/bamboo_block.json b/data/minecraft/recipe/bamboo_block.json index c07aa291..06e9629f 100644 --- a/data/minecraft/recipe/bamboo_block.json +++ b/data/minecraft/recipe/bamboo_block.json @@ -2,33 +2,15 @@ "type": "minecraft:crafting_shapeless", "category": "building", "ingredients": [ - { - "item": "minecraft:bamboo" - }, - { - "item": "minecraft:bamboo" - }, - { - "item": "minecraft:bamboo" - }, - { - "item": "minecraft:bamboo" - }, - { - "item": "minecraft:bamboo" - }, - { - "item": "minecraft:bamboo" - }, - { - "item": "minecraft:bamboo" - }, - { - "item": "minecraft:bamboo" - }, - { - "item": "minecraft:bamboo" - } + "minecraft:bamboo", + "minecraft:bamboo", + "minecraft:bamboo", + "minecraft:bamboo", + "minecraft:bamboo", + "minecraft:bamboo", + "minecraft:bamboo", + "minecraft:bamboo", + "minecraft:bamboo" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/bamboo_button.json b/data/minecraft/recipe/bamboo_button.json index 7cef3de8..0f708dad 100644 --- a/data/minecraft/recipe/bamboo_button.json +++ b/data/minecraft/recipe/bamboo_button.json @@ -3,9 +3,7 @@ "category": "redstone", "group": "wooden_button", "ingredients": [ - { - "item": "minecraft:bamboo_planks" - } + "minecraft:bamboo_planks" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/bamboo_chest_raft.json b/data/minecraft/recipe/bamboo_chest_raft.json index 8e89fca2..9c9787f7 100644 --- a/data/minecraft/recipe/bamboo_chest_raft.json +++ b/data/minecraft/recipe/bamboo_chest_raft.json @@ -3,12 +3,8 @@ "category": "misc", "group": "chest_boat", "ingredients": [ - { - "item": "minecraft:chest" - }, - { - "item": "minecraft:bamboo_raft" - } + "minecraft:chest", + "minecraft:bamboo_raft" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/bamboo_door.json b/data/minecraft/recipe/bamboo_door.json index b12cf0d3..b64b813d 100644 --- a/data/minecraft/recipe/bamboo_door.json +++ b/data/minecraft/recipe/bamboo_door.json @@ -3,9 +3,7 @@ "category": "redstone", "group": "wooden_door", "key": { - "#": { - "item": "minecraft:bamboo_planks" - } + "#": "minecraft:bamboo_planks" }, "pattern": [ "##", diff --git a/data/minecraft/recipe/bamboo_fence.json b/data/minecraft/recipe/bamboo_fence.json index 2d6538a5..41f01abd 100644 --- a/data/minecraft/recipe/bamboo_fence.json +++ b/data/minecraft/recipe/bamboo_fence.json @@ -3,12 +3,8 @@ "category": "misc", "group": "wooden_fence", "key": { - "#": { - "item": "minecraft:stick" - }, - "W": { - "item": "minecraft:bamboo_planks" - } + "#": "minecraft:stick", + "W": "minecraft:bamboo_planks" }, "pattern": [ "W#W", diff --git a/data/minecraft/recipe/bamboo_fence_gate.json b/data/minecraft/recipe/bamboo_fence_gate.json index 7533b94d..dd000e47 100644 --- a/data/minecraft/recipe/bamboo_fence_gate.json +++ b/data/minecraft/recipe/bamboo_fence_gate.json @@ -3,12 +3,8 @@ "category": "redstone", "group": "wooden_fence_gate", "key": { - "#": { - "item": "minecraft:stick" - }, - "W": { - "item": "minecraft:bamboo_planks" - } + "#": "minecraft:stick", + "W": "minecraft:bamboo_planks" }, "pattern": [ "#W#", diff --git a/data/minecraft/recipe/bamboo_hanging_sign.json b/data/minecraft/recipe/bamboo_hanging_sign.json index 405f59d4..202eb752 100644 --- a/data/minecraft/recipe/bamboo_hanging_sign.json +++ b/data/minecraft/recipe/bamboo_hanging_sign.json @@ -3,12 +3,8 @@ "category": "misc", "group": "hanging_sign", "key": { - "#": { - "item": "minecraft:stripped_bamboo_block" - }, - "X": { - "item": "minecraft:chain" - } + "#": "minecraft:stripped_bamboo_block", + "X": "minecraft:chain" }, "pattern": [ "X X", diff --git a/data/minecraft/recipe/bamboo_mosaic.json b/data/minecraft/recipe/bamboo_mosaic.json index 76d9c0ad..7783034d 100644 --- a/data/minecraft/recipe/bamboo_mosaic.json +++ b/data/minecraft/recipe/bamboo_mosaic.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "#": { - "item": "minecraft:bamboo_slab" - } + "#": "minecraft:bamboo_slab" }, "pattern": [ "#", diff --git a/data/minecraft/recipe/bamboo_mosaic_slab.json b/data/minecraft/recipe/bamboo_mosaic_slab.json index 750fe30c..2c38121b 100644 --- a/data/minecraft/recipe/bamboo_mosaic_slab.json +++ b/data/minecraft/recipe/bamboo_mosaic_slab.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:bamboo_mosaic" - } + "#": "minecraft:bamboo_mosaic" }, "pattern": [ "###" diff --git a/data/minecraft/recipe/bamboo_mosaic_stairs.json b/data/minecraft/recipe/bamboo_mosaic_stairs.json index 5216715b..bb31c264 100644 --- a/data/minecraft/recipe/bamboo_mosaic_stairs.json +++ b/data/minecraft/recipe/bamboo_mosaic_stairs.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:bamboo_mosaic" - } + "#": "minecraft:bamboo_mosaic" }, "pattern": [ "# ", diff --git a/data/minecraft/recipe/bamboo_planks.json b/data/minecraft/recipe/bamboo_planks.json index 1865e5a1..60bed79a 100644 --- a/data/minecraft/recipe/bamboo_planks.json +++ b/data/minecraft/recipe/bamboo_planks.json @@ -3,9 +3,7 @@ "category": "building", "group": "planks", "ingredients": [ - { - "tag": "minecraft:bamboo_blocks" - } + "#minecraft:bamboo_blocks" ], "result": { "count": 2, diff --git a/data/minecraft/recipe/bamboo_pressure_plate.json b/data/minecraft/recipe/bamboo_pressure_plate.json index 1ee940b0..42508582 100644 --- a/data/minecraft/recipe/bamboo_pressure_plate.json +++ b/data/minecraft/recipe/bamboo_pressure_plate.json @@ -3,9 +3,7 @@ "category": "redstone", "group": "wooden_pressure_plate", "key": { - "#": { - "item": "minecraft:bamboo_planks" - } + "#": "minecraft:bamboo_planks" }, "pattern": [ "##" diff --git a/data/minecraft/recipe/bamboo_raft.json b/data/minecraft/recipe/bamboo_raft.json index 7a115cac..206bc15d 100644 --- a/data/minecraft/recipe/bamboo_raft.json +++ b/data/minecraft/recipe/bamboo_raft.json @@ -3,9 +3,7 @@ "category": "misc", "group": "boat", "key": { - "#": { - "item": "minecraft:bamboo_planks" - } + "#": "minecraft:bamboo_planks" }, "pattern": [ "# #", diff --git a/data/minecraft/recipe/bamboo_sign.json b/data/minecraft/recipe/bamboo_sign.json index 7a58683f..3d4ade12 100644 --- a/data/minecraft/recipe/bamboo_sign.json +++ b/data/minecraft/recipe/bamboo_sign.json @@ -3,12 +3,8 @@ "category": "misc", "group": "wooden_sign", "key": { - "#": { - "item": "minecraft:bamboo_planks" - }, - "X": { - "item": "minecraft:stick" - } + "#": "minecraft:bamboo_planks", + "X": "minecraft:stick" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/bamboo_slab.json b/data/minecraft/recipe/bamboo_slab.json index c95cc19e..47fed4ed 100644 --- a/data/minecraft/recipe/bamboo_slab.json +++ b/data/minecraft/recipe/bamboo_slab.json @@ -3,9 +3,7 @@ "category": "building", "group": "wooden_slab", "key": { - "#": { - "item": "minecraft:bamboo_planks" - } + "#": "minecraft:bamboo_planks" }, "pattern": [ "###" diff --git a/data/minecraft/recipe/bamboo_stairs.json b/data/minecraft/recipe/bamboo_stairs.json index 8354e78c..afd3757a 100644 --- a/data/minecraft/recipe/bamboo_stairs.json +++ b/data/minecraft/recipe/bamboo_stairs.json @@ -3,9 +3,7 @@ "category": "building", "group": "wooden_stairs", "key": { - "#": { - "item": "minecraft:bamboo_planks" - } + "#": "minecraft:bamboo_planks" }, "pattern": [ "# ", diff --git a/data/minecraft/recipe/bamboo_trapdoor.json b/data/minecraft/recipe/bamboo_trapdoor.json index 96e39885..2e5286cc 100644 --- a/data/minecraft/recipe/bamboo_trapdoor.json +++ b/data/minecraft/recipe/bamboo_trapdoor.json @@ -3,9 +3,7 @@ "category": "redstone", "group": "wooden_trapdoor", "key": { - "#": { - "item": "minecraft:bamboo_planks" - } + "#": "minecraft:bamboo_planks" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/barrel.json b/data/minecraft/recipe/barrel.json index b5a53449..be09eebd 100644 --- a/data/minecraft/recipe/barrel.json +++ b/data/minecraft/recipe/barrel.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "P": { - "tag": "minecraft:planks" - }, - "S": { - "tag": "minecraft:wooden_slabs" - } + "P": "#minecraft:planks", + "S": "#minecraft:wooden_slabs" }, "pattern": [ "PSP", diff --git a/data/minecraft/recipe/beacon.json b/data/minecraft/recipe/beacon.json index 2ce02b92..c7cccaa1 100644 --- a/data/minecraft/recipe/beacon.json +++ b/data/minecraft/recipe/beacon.json @@ -2,15 +2,9 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "G": { - "item": "minecraft:glass" - }, - "O": { - "item": "minecraft:obsidian" - }, - "S": { - "item": "minecraft:nether_star" - } + "G": "minecraft:glass", + "O": "minecraft:obsidian", + "S": "minecraft:nether_star" }, "pattern": [ "GGG", diff --git a/data/minecraft/recipe/beehive.json b/data/minecraft/recipe/beehive.json index 39ea5ec6..61590622 100644 --- a/data/minecraft/recipe/beehive.json +++ b/data/minecraft/recipe/beehive.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "H": { - "item": "minecraft:honeycomb" - }, - "P": { - "tag": "minecraft:planks" - } + "H": "minecraft:honeycomb", + "P": "#minecraft:planks" }, "pattern": [ "PPP", diff --git a/data/minecraft/recipe/beetroot_soup.json b/data/minecraft/recipe/beetroot_soup.json index 2df230d9..593066be 100644 --- a/data/minecraft/recipe/beetroot_soup.json +++ b/data/minecraft/recipe/beetroot_soup.json @@ -2,27 +2,13 @@ "type": "minecraft:crafting_shapeless", "category": "misc", "ingredients": [ - { - "item": "minecraft:bowl" - }, - { - "item": "minecraft:beetroot" - }, - { - "item": "minecraft:beetroot" - }, - { - "item": "minecraft:beetroot" - }, - { - "item": "minecraft:beetroot" - }, - { - "item": "minecraft:beetroot" - }, - { - "item": "minecraft:beetroot" - } + "minecraft:bowl", + "minecraft:beetroot", + "minecraft:beetroot", + "minecraft:beetroot", + "minecraft:beetroot", + "minecraft:beetroot", + "minecraft:beetroot" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/birch_boat.json b/data/minecraft/recipe/birch_boat.json index 75c4c49f..e98106af 100644 --- a/data/minecraft/recipe/birch_boat.json +++ b/data/minecraft/recipe/birch_boat.json @@ -3,9 +3,7 @@ "category": "misc", "group": "boat", "key": { - "#": { - "item": "minecraft:birch_planks" - } + "#": "minecraft:birch_planks" }, "pattern": [ "# #", diff --git a/data/minecraft/recipe/birch_button.json b/data/minecraft/recipe/birch_button.json index 44558359..c3cab637 100644 --- a/data/minecraft/recipe/birch_button.json +++ b/data/minecraft/recipe/birch_button.json @@ -3,9 +3,7 @@ "category": "redstone", "group": "wooden_button", "ingredients": [ - { - "item": "minecraft:birch_planks" - } + "minecraft:birch_planks" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/birch_chest_boat.json b/data/minecraft/recipe/birch_chest_boat.json index 746f1418..bec04337 100644 --- a/data/minecraft/recipe/birch_chest_boat.json +++ b/data/minecraft/recipe/birch_chest_boat.json @@ -3,12 +3,8 @@ "category": "misc", "group": "chest_boat", "ingredients": [ - { - "item": "minecraft:chest" - }, - { - "item": "minecraft:birch_boat" - } + "minecraft:chest", + "minecraft:birch_boat" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/birch_door.json b/data/minecraft/recipe/birch_door.json index eb40d15d..0f0a8f5b 100644 --- a/data/minecraft/recipe/birch_door.json +++ b/data/minecraft/recipe/birch_door.json @@ -3,9 +3,7 @@ "category": "redstone", "group": "wooden_door", "key": { - "#": { - "item": "minecraft:birch_planks" - } + "#": "minecraft:birch_planks" }, "pattern": [ "##", diff --git a/data/minecraft/recipe/birch_fence.json b/data/minecraft/recipe/birch_fence.json index 0194b7a3..6e4d2bc9 100644 --- a/data/minecraft/recipe/birch_fence.json +++ b/data/minecraft/recipe/birch_fence.json @@ -3,12 +3,8 @@ "category": "misc", "group": "wooden_fence", "key": { - "#": { - "item": "minecraft:stick" - }, - "W": { - "item": "minecraft:birch_planks" - } + "#": "minecraft:stick", + "W": "minecraft:birch_planks" }, "pattern": [ "W#W", diff --git a/data/minecraft/recipe/birch_fence_gate.json b/data/minecraft/recipe/birch_fence_gate.json index e22154fd..0d914fd3 100644 --- a/data/minecraft/recipe/birch_fence_gate.json +++ b/data/minecraft/recipe/birch_fence_gate.json @@ -3,12 +3,8 @@ "category": "redstone", "group": "wooden_fence_gate", "key": { - "#": { - "item": "minecraft:stick" - }, - "W": { - "item": "minecraft:birch_planks" - } + "#": "minecraft:stick", + "W": "minecraft:birch_planks" }, "pattern": [ "#W#", diff --git a/data/minecraft/recipe/birch_hanging_sign.json b/data/minecraft/recipe/birch_hanging_sign.json index 41bd4b80..77f1dd14 100644 --- a/data/minecraft/recipe/birch_hanging_sign.json +++ b/data/minecraft/recipe/birch_hanging_sign.json @@ -3,12 +3,8 @@ "category": "misc", "group": "hanging_sign", "key": { - "#": { - "item": "minecraft:stripped_birch_log" - }, - "X": { - "item": "minecraft:chain" - } + "#": "minecraft:stripped_birch_log", + "X": "minecraft:chain" }, "pattern": [ "X X", diff --git a/data/minecraft/recipe/birch_planks.json b/data/minecraft/recipe/birch_planks.json index 43a42630..0921e692 100644 --- a/data/minecraft/recipe/birch_planks.json +++ b/data/minecraft/recipe/birch_planks.json @@ -3,9 +3,7 @@ "category": "building", "group": "planks", "ingredients": [ - { - "tag": "minecraft:birch_logs" - } + "#minecraft:birch_logs" ], "result": { "count": 4, diff --git a/data/minecraft/recipe/birch_pressure_plate.json b/data/minecraft/recipe/birch_pressure_plate.json index 1ee3ce37..efdaf27a 100644 --- a/data/minecraft/recipe/birch_pressure_plate.json +++ b/data/minecraft/recipe/birch_pressure_plate.json @@ -3,9 +3,7 @@ "category": "redstone", "group": "wooden_pressure_plate", "key": { - "#": { - "item": "minecraft:birch_planks" - } + "#": "minecraft:birch_planks" }, "pattern": [ "##" diff --git a/data/minecraft/recipe/birch_sign.json b/data/minecraft/recipe/birch_sign.json index 13062346..524bde5e 100644 --- a/data/minecraft/recipe/birch_sign.json +++ b/data/minecraft/recipe/birch_sign.json @@ -3,12 +3,8 @@ "category": "misc", "group": "wooden_sign", "key": { - "#": { - "item": "minecraft:birch_planks" - }, - "X": { - "item": "minecraft:stick" - } + "#": "minecraft:birch_planks", + "X": "minecraft:stick" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/birch_slab.json b/data/minecraft/recipe/birch_slab.json index 5e298a9a..87061e5a 100644 --- a/data/minecraft/recipe/birch_slab.json +++ b/data/minecraft/recipe/birch_slab.json @@ -3,9 +3,7 @@ "category": "building", "group": "wooden_slab", "key": { - "#": { - "item": "minecraft:birch_planks" - } + "#": "minecraft:birch_planks" }, "pattern": [ "###" diff --git a/data/minecraft/recipe/birch_stairs.json b/data/minecraft/recipe/birch_stairs.json index 6d410981..c2048596 100644 --- a/data/minecraft/recipe/birch_stairs.json +++ b/data/minecraft/recipe/birch_stairs.json @@ -3,9 +3,7 @@ "category": "building", "group": "wooden_stairs", "key": { - "#": { - "item": "minecraft:birch_planks" - } + "#": "minecraft:birch_planks" }, "pattern": [ "# ", diff --git a/data/minecraft/recipe/birch_trapdoor.json b/data/minecraft/recipe/birch_trapdoor.json index 4b9e9c5f..128944b2 100644 --- a/data/minecraft/recipe/birch_trapdoor.json +++ b/data/minecraft/recipe/birch_trapdoor.json @@ -3,9 +3,7 @@ "category": "redstone", "group": "wooden_trapdoor", "key": { - "#": { - "item": "minecraft:birch_planks" - } + "#": "minecraft:birch_planks" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/birch_wood.json b/data/minecraft/recipe/birch_wood.json index 30932771..4fddaabb 100644 --- a/data/minecraft/recipe/birch_wood.json +++ b/data/minecraft/recipe/birch_wood.json @@ -3,9 +3,7 @@ "category": "building", "group": "bark", "key": { - "#": { - "item": "minecraft:birch_log" - } + "#": "minecraft:birch_log" }, "pattern": [ "##", diff --git a/data/minecraft/recipe/black_banner.json b/data/minecraft/recipe/black_banner.json index e3b39d0a..41db6457 100644 --- a/data/minecraft/recipe/black_banner.json +++ b/data/minecraft/recipe/black_banner.json @@ -3,12 +3,8 @@ "category": "misc", "group": "banner", "key": { - "#": { - "item": "minecraft:black_wool" - }, - "|": { - "item": "minecraft:stick" - } + "#": "minecraft:black_wool", + "|": "minecraft:stick" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/black_bed.json b/data/minecraft/recipe/black_bed.json index 70fec921..d325a5d2 100644 --- a/data/minecraft/recipe/black_bed.json +++ b/data/minecraft/recipe/black_bed.json @@ -3,12 +3,8 @@ "category": "misc", "group": "bed", "key": { - "#": { - "item": "minecraft:black_wool" - }, - "X": { - "tag": "minecraft:planks" - } + "#": "minecraft:black_wool", + "X": "#minecraft:planks" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/black_bundle.json b/data/minecraft/recipe/black_bundle.json new file mode 100644 index 00000000..ef2f7f28 --- /dev/null +++ b/data/minecraft/recipe/black_bundle.json @@ -0,0 +1,8 @@ +{ + "type": "minecraft:crafting_transmute", + "category": "equipment", + "group": "bundle_dye", + "input": "#minecraft:bundles", + "material": "minecraft:black_dye", + "result": "minecraft:black_bundle" +} \ No newline at end of file diff --git a/data/minecraft/recipe/black_candle.json b/data/minecraft/recipe/black_candle.json index 8dcdb7d7..2d61f38d 100644 --- a/data/minecraft/recipe/black_candle.json +++ b/data/minecraft/recipe/black_candle.json @@ -3,12 +3,8 @@ "category": "misc", "group": "dyed_candle", "ingredients": [ - { - "item": "minecraft:candle" - }, - { - "item": "minecraft:black_dye" - } + "minecraft:candle", + "minecraft:black_dye" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/black_carpet.json b/data/minecraft/recipe/black_carpet.json index bd4f018b..18a1db63 100644 --- a/data/minecraft/recipe/black_carpet.json +++ b/data/minecraft/recipe/black_carpet.json @@ -3,9 +3,7 @@ "category": "misc", "group": "carpet", "key": { - "#": { - "item": "minecraft:black_wool" - } + "#": "minecraft:black_wool" }, "pattern": [ "##" diff --git a/data/minecraft/recipe/black_concrete_powder.json b/data/minecraft/recipe/black_concrete_powder.json index ba45d84d..cbde1f95 100644 --- a/data/minecraft/recipe/black_concrete_powder.json +++ b/data/minecraft/recipe/black_concrete_powder.json @@ -3,33 +3,15 @@ "category": "building", "group": "concrete_powder", "ingredients": [ - { - "item": "minecraft:black_dye" - }, - { - "item": "minecraft:sand" - }, - { - "item": "minecraft:sand" - }, - { - "item": "minecraft:sand" - }, - { - "item": "minecraft:sand" - }, - { - "item": "minecraft:gravel" - }, - { - "item": "minecraft:gravel" - }, - { - "item": "minecraft:gravel" - }, - { - "item": "minecraft:gravel" - } + "minecraft:black_dye", + "minecraft:sand", + "minecraft:sand", + "minecraft:sand", + "minecraft:sand", + "minecraft:gravel", + "minecraft:gravel", + "minecraft:gravel", + "minecraft:gravel" ], "result": { "count": 8, diff --git a/data/minecraft/recipe/black_dye.json b/data/minecraft/recipe/black_dye.json index b8818252..efbc2986 100644 --- a/data/minecraft/recipe/black_dye.json +++ b/data/minecraft/recipe/black_dye.json @@ -3,9 +3,7 @@ "category": "misc", "group": "black_dye", "ingredients": [ - { - "item": "minecraft:ink_sac" - } + "minecraft:ink_sac" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/black_dye_from_wither_rose.json b/data/minecraft/recipe/black_dye_from_wither_rose.json index 5717c97a..6b290130 100644 --- a/data/minecraft/recipe/black_dye_from_wither_rose.json +++ b/data/minecraft/recipe/black_dye_from_wither_rose.json @@ -3,9 +3,7 @@ "category": "misc", "group": "black_dye", "ingredients": [ - { - "item": "minecraft:wither_rose" - } + "minecraft:wither_rose" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/black_glazed_terracotta.json b/data/minecraft/recipe/black_glazed_terracotta.json index 74ae5d06..14ef27e5 100644 --- a/data/minecraft/recipe/black_glazed_terracotta.json +++ b/data/minecraft/recipe/black_glazed_terracotta.json @@ -3,9 +3,7 @@ "category": "blocks", "cookingtime": 200, "experience": 0.1, - "ingredient": { - "item": "minecraft:black_terracotta" - }, + "ingredient": "minecraft:black_terracotta", "result": { "id": "minecraft:black_glazed_terracotta" } diff --git a/data/minecraft/recipe/black_shulker_box.json b/data/minecraft/recipe/black_shulker_box.json new file mode 100644 index 00000000..ece44b36 --- /dev/null +++ b/data/minecraft/recipe/black_shulker_box.json @@ -0,0 +1,8 @@ +{ + "type": "minecraft:crafting_transmute", + "category": "misc", + "group": "shulker_box_dye", + "input": "#minecraft:shulker_boxes", + "material": "minecraft:black_dye", + "result": "minecraft:black_shulker_box" +} \ No newline at end of file diff --git a/data/minecraft/recipe/black_stained_glass.json b/data/minecraft/recipe/black_stained_glass.json index 9f85f0df..f60d0e81 100644 --- a/data/minecraft/recipe/black_stained_glass.json +++ b/data/minecraft/recipe/black_stained_glass.json @@ -3,12 +3,8 @@ "category": "building", "group": "stained_glass", "key": { - "#": { - "item": "minecraft:glass" - }, - "X": { - "item": "minecraft:black_dye" - } + "#": "minecraft:glass", + "X": "minecraft:black_dye" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/black_stained_glass_pane.json b/data/minecraft/recipe/black_stained_glass_pane.json index 09e3d2c4..df2b3879 100644 --- a/data/minecraft/recipe/black_stained_glass_pane.json +++ b/data/minecraft/recipe/black_stained_glass_pane.json @@ -3,9 +3,7 @@ "category": "misc", "group": "stained_glass_pane", "key": { - "#": { - "item": "minecraft:black_stained_glass" - } + "#": "minecraft:black_stained_glass" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/black_stained_glass_pane_from_glass_pane.json b/data/minecraft/recipe/black_stained_glass_pane_from_glass_pane.json index 967e886d..6155b273 100644 --- a/data/minecraft/recipe/black_stained_glass_pane_from_glass_pane.json +++ b/data/minecraft/recipe/black_stained_glass_pane_from_glass_pane.json @@ -3,12 +3,8 @@ "category": "misc", "group": "stained_glass_pane", "key": { - "#": { - "item": "minecraft:glass_pane" - }, - "$": { - "item": "minecraft:black_dye" - } + "#": "minecraft:glass_pane", + "$": "minecraft:black_dye" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/black_terracotta.json b/data/minecraft/recipe/black_terracotta.json index a0a4f4e6..ad7b8f0f 100644 --- a/data/minecraft/recipe/black_terracotta.json +++ b/data/minecraft/recipe/black_terracotta.json @@ -3,12 +3,8 @@ "category": "building", "group": "stained_terracotta", "key": { - "#": { - "item": "minecraft:terracotta" - }, - "X": { - "item": "minecraft:black_dye" - } + "#": "minecraft:terracotta", + "X": "minecraft:black_dye" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/blackstone_slab.json b/data/minecraft/recipe/blackstone_slab.json index 77d1adbd..b6addf2f 100644 --- a/data/minecraft/recipe/blackstone_slab.json +++ b/data/minecraft/recipe/blackstone_slab.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:blackstone" - } + "#": "minecraft:blackstone" }, "pattern": [ "###" diff --git a/data/minecraft/recipe/blackstone_slab_from_blackstone_stonecutting.json b/data/minecraft/recipe/blackstone_slab_from_blackstone_stonecutting.json index 6aa3117e..b2b835cf 100644 --- a/data/minecraft/recipe/blackstone_slab_from_blackstone_stonecutting.json +++ b/data/minecraft/recipe/blackstone_slab_from_blackstone_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:blackstone" - }, + "ingredient": "minecraft:blackstone", "result": { "count": 2, "id": "minecraft:blackstone_slab" diff --git a/data/minecraft/recipe/blackstone_stairs.json b/data/minecraft/recipe/blackstone_stairs.json index e3645e77..49ea27df 100644 --- a/data/minecraft/recipe/blackstone_stairs.json +++ b/data/minecraft/recipe/blackstone_stairs.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:blackstone" - } + "#": "minecraft:blackstone" }, "pattern": [ "# ", diff --git a/data/minecraft/recipe/blackstone_stairs_from_blackstone_stonecutting.json b/data/minecraft/recipe/blackstone_stairs_from_blackstone_stonecutting.json index 37a51b60..be15975f 100644 --- a/data/minecraft/recipe/blackstone_stairs_from_blackstone_stonecutting.json +++ b/data/minecraft/recipe/blackstone_stairs_from_blackstone_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:blackstone" - }, + "ingredient": "minecraft:blackstone", "result": { "count": 1, "id": "minecraft:blackstone_stairs" diff --git a/data/minecraft/recipe/blackstone_wall.json b/data/minecraft/recipe/blackstone_wall.json index 740a3bd8..a826c184 100644 --- a/data/minecraft/recipe/blackstone_wall.json +++ b/data/minecraft/recipe/blackstone_wall.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "#": { - "item": "minecraft:blackstone" - } + "#": "minecraft:blackstone" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/blackstone_wall_from_blackstone_stonecutting.json b/data/minecraft/recipe/blackstone_wall_from_blackstone_stonecutting.json index 3a48f655..6d5989b3 100644 --- a/data/minecraft/recipe/blackstone_wall_from_blackstone_stonecutting.json +++ b/data/minecraft/recipe/blackstone_wall_from_blackstone_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:blackstone" - }, + "ingredient": "minecraft:blackstone", "result": { "count": 1, "id": "minecraft:blackstone_wall" diff --git a/data/minecraft/recipe/blast_furnace.json b/data/minecraft/recipe/blast_furnace.json index e0614afc..85c0f021 100644 --- a/data/minecraft/recipe/blast_furnace.json +++ b/data/minecraft/recipe/blast_furnace.json @@ -2,15 +2,9 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "#": { - "item": "minecraft:smooth_stone" - }, - "I": { - "item": "minecraft:iron_ingot" - }, - "X": { - "item": "minecraft:furnace" - } + "#": "minecraft:smooth_stone", + "I": "minecraft:iron_ingot", + "X": "minecraft:furnace" }, "pattern": [ "III", diff --git a/data/minecraft/recipe/blaze_powder.json b/data/minecraft/recipe/blaze_powder.json index 3ebac89e..8019a3d5 100644 --- a/data/minecraft/recipe/blaze_powder.json +++ b/data/minecraft/recipe/blaze_powder.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shapeless", "category": "misc", "ingredients": [ - { - "item": "minecraft:blaze_rod" - } + "minecraft:blaze_rod" ], "result": { "count": 2, diff --git a/data/minecraft/recipe/blue_banner.json b/data/minecraft/recipe/blue_banner.json index a07ba372..2a6816a0 100644 --- a/data/minecraft/recipe/blue_banner.json +++ b/data/minecraft/recipe/blue_banner.json @@ -3,12 +3,8 @@ "category": "misc", "group": "banner", "key": { - "#": { - "item": "minecraft:blue_wool" - }, - "|": { - "item": "minecraft:stick" - } + "#": "minecraft:blue_wool", + "|": "minecraft:stick" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/blue_bed.json b/data/minecraft/recipe/blue_bed.json index 63596b8a..727c26a5 100644 --- a/data/minecraft/recipe/blue_bed.json +++ b/data/minecraft/recipe/blue_bed.json @@ -3,12 +3,8 @@ "category": "misc", "group": "bed", "key": { - "#": { - "item": "minecraft:blue_wool" - }, - "X": { - "tag": "minecraft:planks" - } + "#": "minecraft:blue_wool", + "X": "#minecraft:planks" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/blue_bundle.json b/data/minecraft/recipe/blue_bundle.json new file mode 100644 index 00000000..3269a4cb --- /dev/null +++ b/data/minecraft/recipe/blue_bundle.json @@ -0,0 +1,8 @@ +{ + "type": "minecraft:crafting_transmute", + "category": "equipment", + "group": "bundle_dye", + "input": "#minecraft:bundles", + "material": "minecraft:blue_dye", + "result": "minecraft:blue_bundle" +} \ No newline at end of file diff --git a/data/minecraft/recipe/blue_candle.json b/data/minecraft/recipe/blue_candle.json index 88560f0f..52b0487f 100644 --- a/data/minecraft/recipe/blue_candle.json +++ b/data/minecraft/recipe/blue_candle.json @@ -3,12 +3,8 @@ "category": "misc", "group": "dyed_candle", "ingredients": [ - { - "item": "minecraft:candle" - }, - { - "item": "minecraft:blue_dye" - } + "minecraft:candle", + "minecraft:blue_dye" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/blue_carpet.json b/data/minecraft/recipe/blue_carpet.json index fc3e3d2d..72978aae 100644 --- a/data/minecraft/recipe/blue_carpet.json +++ b/data/minecraft/recipe/blue_carpet.json @@ -3,9 +3,7 @@ "category": "misc", "group": "carpet", "key": { - "#": { - "item": "minecraft:blue_wool" - } + "#": "minecraft:blue_wool" }, "pattern": [ "##" diff --git a/data/minecraft/recipe/blue_concrete_powder.json b/data/minecraft/recipe/blue_concrete_powder.json index 0346eddf..14f989ea 100644 --- a/data/minecraft/recipe/blue_concrete_powder.json +++ b/data/minecraft/recipe/blue_concrete_powder.json @@ -3,33 +3,15 @@ "category": "building", "group": "concrete_powder", "ingredients": [ - { - "item": "minecraft:blue_dye" - }, - { - "item": "minecraft:sand" - }, - { - "item": "minecraft:sand" - }, - { - "item": "minecraft:sand" - }, - { - "item": "minecraft:sand" - }, - { - "item": "minecraft:gravel" - }, - { - "item": "minecraft:gravel" - }, - { - "item": "minecraft:gravel" - }, - { - "item": "minecraft:gravel" - } + "minecraft:blue_dye", + "minecraft:sand", + "minecraft:sand", + "minecraft:sand", + "minecraft:sand", + "minecraft:gravel", + "minecraft:gravel", + "minecraft:gravel", + "minecraft:gravel" ], "result": { "count": 8, diff --git a/data/minecraft/recipe/blue_dye.json b/data/minecraft/recipe/blue_dye.json index 76ac29da..16bc15de 100644 --- a/data/minecraft/recipe/blue_dye.json +++ b/data/minecraft/recipe/blue_dye.json @@ -3,9 +3,7 @@ "category": "misc", "group": "blue_dye", "ingredients": [ - { - "item": "minecraft:lapis_lazuli" - } + "minecraft:lapis_lazuli" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/blue_dye_from_cornflower.json b/data/minecraft/recipe/blue_dye_from_cornflower.json index 2dae90a5..5c30d176 100644 --- a/data/minecraft/recipe/blue_dye_from_cornflower.json +++ b/data/minecraft/recipe/blue_dye_from_cornflower.json @@ -3,9 +3,7 @@ "category": "misc", "group": "blue_dye", "ingredients": [ - { - "item": "minecraft:cornflower" - } + "minecraft:cornflower" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/blue_glazed_terracotta.json b/data/minecraft/recipe/blue_glazed_terracotta.json index 034595db..c4727d0d 100644 --- a/data/minecraft/recipe/blue_glazed_terracotta.json +++ b/data/minecraft/recipe/blue_glazed_terracotta.json @@ -3,9 +3,7 @@ "category": "blocks", "cookingtime": 200, "experience": 0.1, - "ingredient": { - "item": "minecraft:blue_terracotta" - }, + "ingredient": "minecraft:blue_terracotta", "result": { "id": "minecraft:blue_glazed_terracotta" } diff --git a/data/minecraft/recipe/blue_ice.json b/data/minecraft/recipe/blue_ice.json index dba4722b..d069827a 100644 --- a/data/minecraft/recipe/blue_ice.json +++ b/data/minecraft/recipe/blue_ice.json @@ -2,33 +2,15 @@ "type": "minecraft:crafting_shapeless", "category": "building", "ingredients": [ - { - "item": "minecraft:packed_ice" - }, - { - "item": "minecraft:packed_ice" - }, - { - "item": "minecraft:packed_ice" - }, - { - "item": "minecraft:packed_ice" - }, - { - "item": "minecraft:packed_ice" - }, - { - "item": "minecraft:packed_ice" - }, - { - "item": "minecraft:packed_ice" - }, - { - "item": "minecraft:packed_ice" - }, - { - "item": "minecraft:packed_ice" - } + "minecraft:packed_ice", + "minecraft:packed_ice", + "minecraft:packed_ice", + "minecraft:packed_ice", + "minecraft:packed_ice", + "minecraft:packed_ice", + "minecraft:packed_ice", + "minecraft:packed_ice", + "minecraft:packed_ice" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/blue_shulker_box.json b/data/minecraft/recipe/blue_shulker_box.json new file mode 100644 index 00000000..1d4637f6 --- /dev/null +++ b/data/minecraft/recipe/blue_shulker_box.json @@ -0,0 +1,8 @@ +{ + "type": "minecraft:crafting_transmute", + "category": "misc", + "group": "shulker_box_dye", + "input": "#minecraft:shulker_boxes", + "material": "minecraft:blue_dye", + "result": "minecraft:blue_shulker_box" +} \ No newline at end of file diff --git a/data/minecraft/recipe/blue_stained_glass.json b/data/minecraft/recipe/blue_stained_glass.json index 863ba708..ec0fce29 100644 --- a/data/minecraft/recipe/blue_stained_glass.json +++ b/data/minecraft/recipe/blue_stained_glass.json @@ -3,12 +3,8 @@ "category": "building", "group": "stained_glass", "key": { - "#": { - "item": "minecraft:glass" - }, - "X": { - "item": "minecraft:blue_dye" - } + "#": "minecraft:glass", + "X": "minecraft:blue_dye" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/blue_stained_glass_pane.json b/data/minecraft/recipe/blue_stained_glass_pane.json index f9cad906..09f06128 100644 --- a/data/minecraft/recipe/blue_stained_glass_pane.json +++ b/data/minecraft/recipe/blue_stained_glass_pane.json @@ -3,9 +3,7 @@ "category": "misc", "group": "stained_glass_pane", "key": { - "#": { - "item": "minecraft:blue_stained_glass" - } + "#": "minecraft:blue_stained_glass" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/blue_stained_glass_pane_from_glass_pane.json b/data/minecraft/recipe/blue_stained_glass_pane_from_glass_pane.json index fc04444b..b80c6325 100644 --- a/data/minecraft/recipe/blue_stained_glass_pane_from_glass_pane.json +++ b/data/minecraft/recipe/blue_stained_glass_pane_from_glass_pane.json @@ -3,12 +3,8 @@ "category": "misc", "group": "stained_glass_pane", "key": { - "#": { - "item": "minecraft:glass_pane" - }, - "$": { - "item": "minecraft:blue_dye" - } + "#": "minecraft:glass_pane", + "$": "minecraft:blue_dye" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/blue_terracotta.json b/data/minecraft/recipe/blue_terracotta.json index eb6291f3..4acaf66e 100644 --- a/data/minecraft/recipe/blue_terracotta.json +++ b/data/minecraft/recipe/blue_terracotta.json @@ -3,12 +3,8 @@ "category": "building", "group": "stained_terracotta", "key": { - "#": { - "item": "minecraft:terracotta" - }, - "X": { - "item": "minecraft:blue_dye" - } + "#": "minecraft:terracotta", + "X": "minecraft:blue_dye" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/bolt_armor_trim_smithing_template.json b/data/minecraft/recipe/bolt_armor_trim_smithing_template.json index 19cd9728..e09b4c59 100644 --- a/data/minecraft/recipe/bolt_armor_trim_smithing_template.json +++ b/data/minecraft/recipe/bolt_armor_trim_smithing_template.json @@ -2,20 +2,12 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "#": { - "item": "minecraft:diamond" - }, + "#": "minecraft:diamond", "C": [ - { - "item": "minecraft:copper_block" - }, - { - "item": "minecraft:waxed_copper_block" - } + "minecraft:copper_block", + "minecraft:waxed_copper_block" ], - "S": { - "item": "minecraft:bolt_armor_trim_smithing_template" - } + "S": "minecraft:bolt_armor_trim_smithing_template" }, "pattern": [ "#S#", diff --git a/data/minecraft/recipe/bolt_armor_trim_smithing_template_smithing_trim.json b/data/minecraft/recipe/bolt_armor_trim_smithing_template_smithing_trim.json index 6e240fa9..e50e010c 100644 --- a/data/minecraft/recipe/bolt_armor_trim_smithing_template_smithing_trim.json +++ b/data/minecraft/recipe/bolt_armor_trim_smithing_template_smithing_trim.json @@ -1,12 +1,6 @@ { "type": "minecraft:smithing_trim", - "addition": { - "tag": "minecraft:trim_materials" - }, - "base": { - "tag": "minecraft:trimmable_armor" - }, - "template": { - "item": "minecraft:bolt_armor_trim_smithing_template" - } + "addition": "#minecraft:trim_materials", + "base": "#minecraft:trimmable_armor", + "template": "minecraft:bolt_armor_trim_smithing_template" } \ No newline at end of file diff --git a/data/minecraft/recipe/bone_block.json b/data/minecraft/recipe/bone_block.json index bb28c593..f87ddb6a 100644 --- a/data/minecraft/recipe/bone_block.json +++ b/data/minecraft/recipe/bone_block.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:bone_meal" - } + "#": "minecraft:bone_meal" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/bone_meal.json b/data/minecraft/recipe/bone_meal.json index 5f75cb9c..2e4283df 100644 --- a/data/minecraft/recipe/bone_meal.json +++ b/data/minecraft/recipe/bone_meal.json @@ -3,9 +3,7 @@ "category": "misc", "group": "bonemeal", "ingredients": [ - { - "item": "minecraft:bone" - } + "minecraft:bone" ], "result": { "count": 3, diff --git a/data/minecraft/recipe/bone_meal_from_bone_block.json b/data/minecraft/recipe/bone_meal_from_bone_block.json index 28963915..cb1b5c11 100644 --- a/data/minecraft/recipe/bone_meal_from_bone_block.json +++ b/data/minecraft/recipe/bone_meal_from_bone_block.json @@ -3,9 +3,7 @@ "category": "misc", "group": "bonemeal", "ingredients": [ - { - "item": "minecraft:bone_block" - } + "minecraft:bone_block" ], "result": { "count": 9, diff --git a/data/minecraft/recipe/book.json b/data/minecraft/recipe/book.json index 572b563f..dad85f56 100644 --- a/data/minecraft/recipe/book.json +++ b/data/minecraft/recipe/book.json @@ -2,18 +2,10 @@ "type": "minecraft:crafting_shapeless", "category": "misc", "ingredients": [ - { - "item": "minecraft:paper" - }, - { - "item": "minecraft:paper" - }, - { - "item": "minecraft:paper" - }, - { - "item": "minecraft:leather" - } + "minecraft:paper", + "minecraft:paper", + "minecraft:paper", + "minecraft:leather" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/bookshelf.json b/data/minecraft/recipe/bookshelf.json index 8c75c1d5..ccfe74aa 100644 --- a/data/minecraft/recipe/bookshelf.json +++ b/data/minecraft/recipe/bookshelf.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "tag": "minecraft:planks" - }, - "X": { - "item": "minecraft:book" - } + "#": "#minecraft:planks", + "X": "minecraft:book" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/bordure_indented_banner_pattern.json b/data/minecraft/recipe/bordure_indented_banner_pattern.json new file mode 100644 index 00000000..a3446e8e --- /dev/null +++ b/data/minecraft/recipe/bordure_indented_banner_pattern.json @@ -0,0 +1,12 @@ +{ + "type": "minecraft:crafting_shapeless", + "category": "misc", + "ingredients": [ + "minecraft:paper", + "minecraft:vine" + ], + "result": { + "count": 1, + "id": "minecraft:bordure_indented_banner_pattern" + } +} \ No newline at end of file diff --git a/data/minecraft/recipe/bow.json b/data/minecraft/recipe/bow.json index 4e55549a..20082e0c 100644 --- a/data/minecraft/recipe/bow.json +++ b/data/minecraft/recipe/bow.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shaped", "category": "equipment", "key": { - "#": { - "item": "minecraft:stick" - }, - "X": { - "item": "minecraft:string" - } + "#": "minecraft:stick", + "X": "minecraft:string" }, "pattern": [ " #X", diff --git a/data/minecraft/recipe/bowl.json b/data/minecraft/recipe/bowl.json index 185891af..dfb5f497 100644 --- a/data/minecraft/recipe/bowl.json +++ b/data/minecraft/recipe/bowl.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "#": { - "tag": "minecraft:planks" - } + "#": "#minecraft:planks" }, "pattern": [ "# #", diff --git a/data/minecraft/recipe/bread.json b/data/minecraft/recipe/bread.json index de9a64c2..a422d1dc 100644 --- a/data/minecraft/recipe/bread.json +++ b/data/minecraft/recipe/bread.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "#": { - "item": "minecraft:wheat" - } + "#": "minecraft:wheat" }, "pattern": [ "###" diff --git a/data/minecraft/recipe/brewing_stand.json b/data/minecraft/recipe/brewing_stand.json index e606c08c..54d5bab5 100644 --- a/data/minecraft/recipe/brewing_stand.json +++ b/data/minecraft/recipe/brewing_stand.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "#": { - "tag": "minecraft:stone_crafting_materials" - }, - "B": { - "item": "minecraft:blaze_rod" - } + "#": "#minecraft:stone_crafting_materials", + "B": "minecraft:blaze_rod" }, "pattern": [ " B ", diff --git a/data/minecraft/recipe/brick.json b/data/minecraft/recipe/brick.json index dad8e717..c887e50c 100644 --- a/data/minecraft/recipe/brick.json +++ b/data/minecraft/recipe/brick.json @@ -3,9 +3,7 @@ "category": "misc", "cookingtime": 200, "experience": 0.3, - "ingredient": { - "item": "minecraft:clay_ball" - }, + "ingredient": "minecraft:clay_ball", "result": { "id": "minecraft:brick" } diff --git a/data/minecraft/recipe/brick_slab.json b/data/minecraft/recipe/brick_slab.json index 66acc205..d7d3d61e 100644 --- a/data/minecraft/recipe/brick_slab.json +++ b/data/minecraft/recipe/brick_slab.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:bricks" - } + "#": "minecraft:bricks" }, "pattern": [ "###" diff --git a/data/minecraft/recipe/brick_slab_from_bricks_stonecutting.json b/data/minecraft/recipe/brick_slab_from_bricks_stonecutting.json index 8de2143b..fa15f6e6 100644 --- a/data/minecraft/recipe/brick_slab_from_bricks_stonecutting.json +++ b/data/minecraft/recipe/brick_slab_from_bricks_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:bricks" - }, + "ingredient": "minecraft:bricks", "result": { "count": 2, "id": "minecraft:brick_slab" diff --git a/data/minecraft/recipe/brick_stairs.json b/data/minecraft/recipe/brick_stairs.json index 61fd3f2f..22edf6f6 100644 --- a/data/minecraft/recipe/brick_stairs.json +++ b/data/minecraft/recipe/brick_stairs.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:bricks" - } + "#": "minecraft:bricks" }, "pattern": [ "# ", diff --git a/data/minecraft/recipe/brick_stairs_from_bricks_stonecutting.json b/data/minecraft/recipe/brick_stairs_from_bricks_stonecutting.json index b2fb71a6..20e14a3e 100644 --- a/data/minecraft/recipe/brick_stairs_from_bricks_stonecutting.json +++ b/data/minecraft/recipe/brick_stairs_from_bricks_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:bricks" - }, + "ingredient": "minecraft:bricks", "result": { "count": 1, "id": "minecraft:brick_stairs" diff --git a/data/minecraft/recipe/brick_wall.json b/data/minecraft/recipe/brick_wall.json index cbd9f662..2002e1cb 100644 --- a/data/minecraft/recipe/brick_wall.json +++ b/data/minecraft/recipe/brick_wall.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "#": { - "item": "minecraft:bricks" - } + "#": "minecraft:bricks" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/brick_wall_from_bricks_stonecutting.json b/data/minecraft/recipe/brick_wall_from_bricks_stonecutting.json index d90aae9b..222d8031 100644 --- a/data/minecraft/recipe/brick_wall_from_bricks_stonecutting.json +++ b/data/minecraft/recipe/brick_wall_from_bricks_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:bricks" - }, + "ingredient": "minecraft:bricks", "result": { "count": 1, "id": "minecraft:brick_wall" diff --git a/data/minecraft/recipe/bricks.json b/data/minecraft/recipe/bricks.json index 19165285..920b0cf6 100644 --- a/data/minecraft/recipe/bricks.json +++ b/data/minecraft/recipe/bricks.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:brick" - } + "#": "minecraft:brick" }, "pattern": [ "##", diff --git a/data/minecraft/recipe/brown_banner.json b/data/minecraft/recipe/brown_banner.json index 82a27206..9c36f21d 100644 --- a/data/minecraft/recipe/brown_banner.json +++ b/data/minecraft/recipe/brown_banner.json @@ -3,12 +3,8 @@ "category": "misc", "group": "banner", "key": { - "#": { - "item": "minecraft:brown_wool" - }, - "|": { - "item": "minecraft:stick" - } + "#": "minecraft:brown_wool", + "|": "minecraft:stick" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/brown_bed.json b/data/minecraft/recipe/brown_bed.json index d612f1f7..21119b6b 100644 --- a/data/minecraft/recipe/brown_bed.json +++ b/data/minecraft/recipe/brown_bed.json @@ -3,12 +3,8 @@ "category": "misc", "group": "bed", "key": { - "#": { - "item": "minecraft:brown_wool" - }, - "X": { - "tag": "minecraft:planks" - } + "#": "minecraft:brown_wool", + "X": "#minecraft:planks" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/brown_bundle.json b/data/minecraft/recipe/brown_bundle.json new file mode 100644 index 00000000..dfa2a323 --- /dev/null +++ b/data/minecraft/recipe/brown_bundle.json @@ -0,0 +1,8 @@ +{ + "type": "minecraft:crafting_transmute", + "category": "equipment", + "group": "bundle_dye", + "input": "#minecraft:bundles", + "material": "minecraft:brown_dye", + "result": "minecraft:brown_bundle" +} \ No newline at end of file diff --git a/data/minecraft/recipe/brown_candle.json b/data/minecraft/recipe/brown_candle.json index 1cf5a551..e086a046 100644 --- a/data/minecraft/recipe/brown_candle.json +++ b/data/minecraft/recipe/brown_candle.json @@ -3,12 +3,8 @@ "category": "misc", "group": "dyed_candle", "ingredients": [ - { - "item": "minecraft:candle" - }, - { - "item": "minecraft:brown_dye" - } + "minecraft:candle", + "minecraft:brown_dye" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/brown_carpet.json b/data/minecraft/recipe/brown_carpet.json index 1593aab0..6001cac7 100644 --- a/data/minecraft/recipe/brown_carpet.json +++ b/data/minecraft/recipe/brown_carpet.json @@ -3,9 +3,7 @@ "category": "misc", "group": "carpet", "key": { - "#": { - "item": "minecraft:brown_wool" - } + "#": "minecraft:brown_wool" }, "pattern": [ "##" diff --git a/data/minecraft/recipe/brown_concrete_powder.json b/data/minecraft/recipe/brown_concrete_powder.json index c095f3fc..d370a314 100644 --- a/data/minecraft/recipe/brown_concrete_powder.json +++ b/data/minecraft/recipe/brown_concrete_powder.json @@ -3,33 +3,15 @@ "category": "building", "group": "concrete_powder", "ingredients": [ - { - "item": "minecraft:brown_dye" - }, - { - "item": "minecraft:sand" - }, - { - "item": "minecraft:sand" - }, - { - "item": "minecraft:sand" - }, - { - "item": "minecraft:sand" - }, - { - "item": "minecraft:gravel" - }, - { - "item": "minecraft:gravel" - }, - { - "item": "minecraft:gravel" - }, - { - "item": "minecraft:gravel" - } + "minecraft:brown_dye", + "minecraft:sand", + "minecraft:sand", + "minecraft:sand", + "minecraft:sand", + "minecraft:gravel", + "minecraft:gravel", + "minecraft:gravel", + "minecraft:gravel" ], "result": { "count": 8, diff --git a/data/minecraft/recipe/brown_dye.json b/data/minecraft/recipe/brown_dye.json index 4a7c8066..3cebfb97 100644 --- a/data/minecraft/recipe/brown_dye.json +++ b/data/minecraft/recipe/brown_dye.json @@ -3,9 +3,7 @@ "category": "misc", "group": "brown_dye", "ingredients": [ - { - "item": "minecraft:cocoa_beans" - } + "minecraft:cocoa_beans" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/brown_glazed_terracotta.json b/data/minecraft/recipe/brown_glazed_terracotta.json index 32e0a2a8..57d7d384 100644 --- a/data/minecraft/recipe/brown_glazed_terracotta.json +++ b/data/minecraft/recipe/brown_glazed_terracotta.json @@ -3,9 +3,7 @@ "category": "blocks", "cookingtime": 200, "experience": 0.1, - "ingredient": { - "item": "minecraft:brown_terracotta" - }, + "ingredient": "minecraft:brown_terracotta", "result": { "id": "minecraft:brown_glazed_terracotta" } diff --git a/data/minecraft/recipe/brown_shulker_box.json b/data/minecraft/recipe/brown_shulker_box.json new file mode 100644 index 00000000..344c6fc0 --- /dev/null +++ b/data/minecraft/recipe/brown_shulker_box.json @@ -0,0 +1,8 @@ +{ + "type": "minecraft:crafting_transmute", + "category": "misc", + "group": "shulker_box_dye", + "input": "#minecraft:shulker_boxes", + "material": "minecraft:brown_dye", + "result": "minecraft:brown_shulker_box" +} \ No newline at end of file diff --git a/data/minecraft/recipe/brown_stained_glass.json b/data/minecraft/recipe/brown_stained_glass.json index 5e2c4d07..4902e4a2 100644 --- a/data/minecraft/recipe/brown_stained_glass.json +++ b/data/minecraft/recipe/brown_stained_glass.json @@ -3,12 +3,8 @@ "category": "building", "group": "stained_glass", "key": { - "#": { - "item": "minecraft:glass" - }, - "X": { - "item": "minecraft:brown_dye" - } + "#": "minecraft:glass", + "X": "minecraft:brown_dye" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/brown_stained_glass_pane.json b/data/minecraft/recipe/brown_stained_glass_pane.json index 78322d2e..44e96ab6 100644 --- a/data/minecraft/recipe/brown_stained_glass_pane.json +++ b/data/minecraft/recipe/brown_stained_glass_pane.json @@ -3,9 +3,7 @@ "category": "misc", "group": "stained_glass_pane", "key": { - "#": { - "item": "minecraft:brown_stained_glass" - } + "#": "minecraft:brown_stained_glass" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/brown_stained_glass_pane_from_glass_pane.json b/data/minecraft/recipe/brown_stained_glass_pane_from_glass_pane.json index a417a55e..24ccc681 100644 --- a/data/minecraft/recipe/brown_stained_glass_pane_from_glass_pane.json +++ b/data/minecraft/recipe/brown_stained_glass_pane_from_glass_pane.json @@ -3,12 +3,8 @@ "category": "misc", "group": "stained_glass_pane", "key": { - "#": { - "item": "minecraft:glass_pane" - }, - "$": { - "item": "minecraft:brown_dye" - } + "#": "minecraft:glass_pane", + "$": "minecraft:brown_dye" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/brown_terracotta.json b/data/minecraft/recipe/brown_terracotta.json index a00181aa..f9a89784 100644 --- a/data/minecraft/recipe/brown_terracotta.json +++ b/data/minecraft/recipe/brown_terracotta.json @@ -3,12 +3,8 @@ "category": "building", "group": "stained_terracotta", "key": { - "#": { - "item": "minecraft:terracotta" - }, - "X": { - "item": "minecraft:brown_dye" - } + "#": "minecraft:terracotta", + "X": "minecraft:brown_dye" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/brush.json b/data/minecraft/recipe/brush.json index f94d9ccb..fe9c82b3 100644 --- a/data/minecraft/recipe/brush.json +++ b/data/minecraft/recipe/brush.json @@ -2,15 +2,9 @@ "type": "minecraft:crafting_shaped", "category": "equipment", "key": { - "#": { - "item": "minecraft:copper_ingot" - }, - "I": { - "item": "minecraft:stick" - }, - "X": { - "item": "minecraft:feather" - } + "#": "minecraft:copper_ingot", + "I": "minecraft:stick", + "X": "minecraft:feather" }, "pattern": [ "X", diff --git a/data/minecraft/recipe/bucket.json b/data/minecraft/recipe/bucket.json index d4192407..c91f28d0 100644 --- a/data/minecraft/recipe/bucket.json +++ b/data/minecraft/recipe/bucket.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "#": { - "item": "minecraft:iron_ingot" - } + "#": "minecraft:iron_ingot" }, "pattern": [ "# #", diff --git a/data/minecraft/datapacks/bundle/data/minecraft/recipe/bundle.json b/data/minecraft/recipe/bundle.json similarity index 54% rename from data/minecraft/datapacks/bundle/data/minecraft/recipe/bundle.json rename to data/minecraft/recipe/bundle.json index 12d21d7e..9b7a173c 100644 --- a/data/minecraft/datapacks/bundle/data/minecraft/recipe/bundle.json +++ b/data/minecraft/recipe/bundle.json @@ -2,17 +2,12 @@ "type": "minecraft:crafting_shaped", "category": "equipment", "key": { - "#": { - "item": "minecraft:rabbit_hide" - }, - "-": { - "item": "minecraft:string" - } + "#": "minecraft:leather", + "-": "minecraft:string" }, "pattern": [ - "-#-", - "# #", - "###" + "-", + "#" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/cake.json b/data/minecraft/recipe/cake.json index 428d11d2..b840c821 100644 --- a/data/minecraft/recipe/cake.json +++ b/data/minecraft/recipe/cake.json @@ -2,18 +2,10 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "A": { - "item": "minecraft:milk_bucket" - }, - "B": { - "item": "minecraft:sugar" - }, - "C": { - "item": "minecraft:wheat" - }, - "E": { - "item": "minecraft:egg" - } + "A": "minecraft:milk_bucket", + "B": "minecraft:sugar", + "C": "minecraft:wheat", + "E": "minecraft:egg" }, "pattern": [ "AAA", diff --git a/data/minecraft/recipe/calibrated_sculk_sensor.json b/data/minecraft/recipe/calibrated_sculk_sensor.json index 123d5953..bcc5e446 100644 --- a/data/minecraft/recipe/calibrated_sculk_sensor.json +++ b/data/minecraft/recipe/calibrated_sculk_sensor.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shaped", "category": "redstone", "key": { - "#": { - "item": "minecraft:amethyst_shard" - }, - "X": { - "item": "minecraft:sculk_sensor" - } + "#": "minecraft:amethyst_shard", + "X": "minecraft:sculk_sensor" }, "pattern": [ " # ", diff --git a/data/minecraft/recipe/campfire.json b/data/minecraft/recipe/campfire.json index 46fb4d1e..ec5d1ab3 100644 --- a/data/minecraft/recipe/campfire.json +++ b/data/minecraft/recipe/campfire.json @@ -2,15 +2,9 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "C": { - "tag": "minecraft:coals" - }, - "L": { - "tag": "minecraft:logs" - }, - "S": { - "item": "minecraft:stick" - } + "C": "#minecraft:coals", + "L": "#minecraft:logs", + "S": "minecraft:stick" }, "pattern": [ " S ", diff --git a/data/minecraft/recipe/candle.json b/data/minecraft/recipe/candle.json index 53a7be5a..0248f56d 100644 --- a/data/minecraft/recipe/candle.json +++ b/data/minecraft/recipe/candle.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "H": { - "item": "minecraft:honeycomb" - }, - "S": { - "item": "minecraft:string" - } + "H": "minecraft:honeycomb", + "S": "minecraft:string" }, "pattern": [ "S", diff --git a/data/minecraft/recipe/carrot_on_a_stick.json b/data/minecraft/recipe/carrot_on_a_stick.json index ca1a8136..b5f67e6c 100644 --- a/data/minecraft/recipe/carrot_on_a_stick.json +++ b/data/minecraft/recipe/carrot_on_a_stick.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "#": { - "item": "minecraft:fishing_rod" - }, - "X": { - "item": "minecraft:carrot" - } + "#": "minecraft:fishing_rod", + "X": "minecraft:carrot" }, "pattern": [ "# ", diff --git a/data/minecraft/recipe/cartography_table.json b/data/minecraft/recipe/cartography_table.json index f637ce61..0c014e3d 100644 --- a/data/minecraft/recipe/cartography_table.json +++ b/data/minecraft/recipe/cartography_table.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "#": { - "tag": "minecraft:planks" - }, - "@": { - "item": "minecraft:paper" - } + "#": "#minecraft:planks", + "@": "minecraft:paper" }, "pattern": [ "@@", diff --git a/data/minecraft/recipe/cauldron.json b/data/minecraft/recipe/cauldron.json index ecf7b6be..4325528b 100644 --- a/data/minecraft/recipe/cauldron.json +++ b/data/minecraft/recipe/cauldron.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "#": { - "item": "minecraft:iron_ingot" - } + "#": "minecraft:iron_ingot" }, "pattern": [ "# #", diff --git a/data/minecraft/recipe/chain.json b/data/minecraft/recipe/chain.json index c172cec1..223fb3f4 100644 --- a/data/minecraft/recipe/chain.json +++ b/data/minecraft/recipe/chain.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "I": { - "item": "minecraft:iron_ingot" - }, - "N": { - "item": "minecraft:iron_nugget" - } + "I": "minecraft:iron_ingot", + "N": "minecraft:iron_nugget" }, "pattern": [ "N", diff --git a/data/minecraft/recipe/charcoal.json b/data/minecraft/recipe/charcoal.json index 9c86f8af..f3ec3023 100644 --- a/data/minecraft/recipe/charcoal.json +++ b/data/minecraft/recipe/charcoal.json @@ -3,9 +3,7 @@ "category": "misc", "cookingtime": 200, "experience": 0.15, - "ingredient": { - "tag": "minecraft:logs_that_burn" - }, + "ingredient": "#minecraft:logs_that_burn", "result": { "id": "minecraft:charcoal" } diff --git a/data/minecraft/recipe/cherry_boat.json b/data/minecraft/recipe/cherry_boat.json index 8abaf02b..7591d073 100644 --- a/data/minecraft/recipe/cherry_boat.json +++ b/data/minecraft/recipe/cherry_boat.json @@ -3,9 +3,7 @@ "category": "misc", "group": "boat", "key": { - "#": { - "item": "minecraft:cherry_planks" - } + "#": "minecraft:cherry_planks" }, "pattern": [ "# #", diff --git a/data/minecraft/recipe/cherry_button.json b/data/minecraft/recipe/cherry_button.json index c5375419..e14abf94 100644 --- a/data/minecraft/recipe/cherry_button.json +++ b/data/minecraft/recipe/cherry_button.json @@ -3,9 +3,7 @@ "category": "redstone", "group": "wooden_button", "ingredients": [ - { - "item": "minecraft:cherry_planks" - } + "minecraft:cherry_planks" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/cherry_chest_boat.json b/data/minecraft/recipe/cherry_chest_boat.json index 46421dd6..30ce6df3 100644 --- a/data/minecraft/recipe/cherry_chest_boat.json +++ b/data/minecraft/recipe/cherry_chest_boat.json @@ -3,12 +3,8 @@ "category": "misc", "group": "chest_boat", "ingredients": [ - { - "item": "minecraft:chest" - }, - { - "item": "minecraft:cherry_boat" - } + "minecraft:chest", + "minecraft:cherry_boat" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/cherry_door.json b/data/minecraft/recipe/cherry_door.json index a3910b89..422fac0a 100644 --- a/data/minecraft/recipe/cherry_door.json +++ b/data/minecraft/recipe/cherry_door.json @@ -3,9 +3,7 @@ "category": "redstone", "group": "wooden_door", "key": { - "#": { - "item": "minecraft:cherry_planks" - } + "#": "minecraft:cherry_planks" }, "pattern": [ "##", diff --git a/data/minecraft/recipe/cherry_fence.json b/data/minecraft/recipe/cherry_fence.json index dae07298..b648fef0 100644 --- a/data/minecraft/recipe/cherry_fence.json +++ b/data/minecraft/recipe/cherry_fence.json @@ -3,12 +3,8 @@ "category": "misc", "group": "wooden_fence", "key": { - "#": { - "item": "minecraft:stick" - }, - "W": { - "item": "minecraft:cherry_planks" - } + "#": "minecraft:stick", + "W": "minecraft:cherry_planks" }, "pattern": [ "W#W", diff --git a/data/minecraft/recipe/cherry_fence_gate.json b/data/minecraft/recipe/cherry_fence_gate.json index c6cf9f96..350400ab 100644 --- a/data/minecraft/recipe/cherry_fence_gate.json +++ b/data/minecraft/recipe/cherry_fence_gate.json @@ -3,12 +3,8 @@ "category": "redstone", "group": "wooden_fence_gate", "key": { - "#": { - "item": "minecraft:stick" - }, - "W": { - "item": "minecraft:cherry_planks" - } + "#": "minecraft:stick", + "W": "minecraft:cherry_planks" }, "pattern": [ "#W#", diff --git a/data/minecraft/recipe/cherry_hanging_sign.json b/data/minecraft/recipe/cherry_hanging_sign.json index f957ef87..48b38899 100644 --- a/data/minecraft/recipe/cherry_hanging_sign.json +++ b/data/minecraft/recipe/cherry_hanging_sign.json @@ -3,12 +3,8 @@ "category": "misc", "group": "hanging_sign", "key": { - "#": { - "item": "minecraft:stripped_cherry_log" - }, - "X": { - "item": "minecraft:chain" - } + "#": "minecraft:stripped_cherry_log", + "X": "minecraft:chain" }, "pattern": [ "X X", diff --git a/data/minecraft/recipe/cherry_planks.json b/data/minecraft/recipe/cherry_planks.json index e14f33ba..c1b8483d 100644 --- a/data/minecraft/recipe/cherry_planks.json +++ b/data/minecraft/recipe/cherry_planks.json @@ -3,9 +3,7 @@ "category": "building", "group": "planks", "ingredients": [ - { - "tag": "minecraft:cherry_logs" - } + "#minecraft:cherry_logs" ], "result": { "count": 4, diff --git a/data/minecraft/recipe/cherry_pressure_plate.json b/data/minecraft/recipe/cherry_pressure_plate.json index 159c046d..83a9f0d0 100644 --- a/data/minecraft/recipe/cherry_pressure_plate.json +++ b/data/minecraft/recipe/cherry_pressure_plate.json @@ -3,9 +3,7 @@ "category": "redstone", "group": "wooden_pressure_plate", "key": { - "#": { - "item": "minecraft:cherry_planks" - } + "#": "minecraft:cherry_planks" }, "pattern": [ "##" diff --git a/data/minecraft/recipe/cherry_sign.json b/data/minecraft/recipe/cherry_sign.json index 969c6ec3..2aeb8d0c 100644 --- a/data/minecraft/recipe/cherry_sign.json +++ b/data/minecraft/recipe/cherry_sign.json @@ -3,12 +3,8 @@ "category": "misc", "group": "wooden_sign", "key": { - "#": { - "item": "minecraft:cherry_planks" - }, - "X": { - "item": "minecraft:stick" - } + "#": "minecraft:cherry_planks", + "X": "minecraft:stick" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/cherry_slab.json b/data/minecraft/recipe/cherry_slab.json index e3f6e5c3..60d8b1a3 100644 --- a/data/minecraft/recipe/cherry_slab.json +++ b/data/minecraft/recipe/cherry_slab.json @@ -3,9 +3,7 @@ "category": "building", "group": "wooden_slab", "key": { - "#": { - "item": "minecraft:cherry_planks" - } + "#": "minecraft:cherry_planks" }, "pattern": [ "###" diff --git a/data/minecraft/recipe/cherry_stairs.json b/data/minecraft/recipe/cherry_stairs.json index 15c114f6..de5e48ef 100644 --- a/data/minecraft/recipe/cherry_stairs.json +++ b/data/minecraft/recipe/cherry_stairs.json @@ -3,9 +3,7 @@ "category": "building", "group": "wooden_stairs", "key": { - "#": { - "item": "minecraft:cherry_planks" - } + "#": "minecraft:cherry_planks" }, "pattern": [ "# ", diff --git a/data/minecraft/recipe/cherry_trapdoor.json b/data/minecraft/recipe/cherry_trapdoor.json index 5a5412f9..e21ba1d5 100644 --- a/data/minecraft/recipe/cherry_trapdoor.json +++ b/data/minecraft/recipe/cherry_trapdoor.json @@ -3,9 +3,7 @@ "category": "redstone", "group": "wooden_trapdoor", "key": { - "#": { - "item": "minecraft:cherry_planks" - } + "#": "minecraft:cherry_planks" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/cherry_wood.json b/data/minecraft/recipe/cherry_wood.json index c968852c..307daa81 100644 --- a/data/minecraft/recipe/cherry_wood.json +++ b/data/minecraft/recipe/cherry_wood.json @@ -3,9 +3,7 @@ "category": "building", "group": "bark", "key": { - "#": { - "item": "minecraft:cherry_log" - } + "#": "minecraft:cherry_log" }, "pattern": [ "##", diff --git a/data/minecraft/recipe/chest.json b/data/minecraft/recipe/chest.json index 2eb5fe7d..a57c4724 100644 --- a/data/minecraft/recipe/chest.json +++ b/data/minecraft/recipe/chest.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "#": { - "tag": "minecraft:planks" - } + "#": "#minecraft:planks" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/chest_minecart.json b/data/minecraft/recipe/chest_minecart.json index a6e9a450..783d67e7 100644 --- a/data/minecraft/recipe/chest_minecart.json +++ b/data/minecraft/recipe/chest_minecart.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shapeless", "category": "misc", "ingredients": [ - { - "item": "minecraft:chest" - }, - { - "item": "minecraft:minecart" - } + "minecraft:chest", + "minecraft:minecart" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/chiseled_bookshelf.json b/data/minecraft/recipe/chiseled_bookshelf.json index b8646a23..2ead1524 100644 --- a/data/minecraft/recipe/chiseled_bookshelf.json +++ b/data/minecraft/recipe/chiseled_bookshelf.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "tag": "minecraft:planks" - }, - "X": { - "tag": "minecraft:wooden_slabs" - } + "#": "#minecraft:planks", + "X": "#minecraft:wooden_slabs" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/chiseled_copper.json b/data/minecraft/recipe/chiseled_copper.json index f8053a91..8faad745 100644 --- a/data/minecraft/recipe/chiseled_copper.json +++ b/data/minecraft/recipe/chiseled_copper.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:cut_copper_slab" - } + "#": "minecraft:cut_copper_slab" }, "pattern": [ "#", diff --git a/data/minecraft/recipe/chiseled_copper_from_copper_block_stonecutting.json b/data/minecraft/recipe/chiseled_copper_from_copper_block_stonecutting.json index e1ebf872..d73d3fe8 100644 --- a/data/minecraft/recipe/chiseled_copper_from_copper_block_stonecutting.json +++ b/data/minecraft/recipe/chiseled_copper_from_copper_block_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:copper_block" - }, + "ingredient": "minecraft:copper_block", "result": { "count": 4, "id": "minecraft:chiseled_copper" diff --git a/data/minecraft/recipe/chiseled_copper_from_cut_copper_stonecutting.json b/data/minecraft/recipe/chiseled_copper_from_cut_copper_stonecutting.json index e80592bb..2c4cd4c0 100644 --- a/data/minecraft/recipe/chiseled_copper_from_cut_copper_stonecutting.json +++ b/data/minecraft/recipe/chiseled_copper_from_cut_copper_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:cut_copper" - }, + "ingredient": "minecraft:cut_copper", "result": { "count": 1, "id": "minecraft:chiseled_copper" diff --git a/data/minecraft/recipe/chiseled_deepslate.json b/data/minecraft/recipe/chiseled_deepslate.json index 45718a70..4d1864c3 100644 --- a/data/minecraft/recipe/chiseled_deepslate.json +++ b/data/minecraft/recipe/chiseled_deepslate.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:cobbled_deepslate_slab" - } + "#": "minecraft:cobbled_deepslate_slab" }, "pattern": [ "#", diff --git a/data/minecraft/recipe/chiseled_deepslate_from_cobbled_deepslate_stonecutting.json b/data/minecraft/recipe/chiseled_deepslate_from_cobbled_deepslate_stonecutting.json index 15ed6dba..9208d488 100644 --- a/data/minecraft/recipe/chiseled_deepslate_from_cobbled_deepslate_stonecutting.json +++ b/data/minecraft/recipe/chiseled_deepslate_from_cobbled_deepslate_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:cobbled_deepslate" - }, + "ingredient": "minecraft:cobbled_deepslate", "result": { "count": 1, "id": "minecraft:chiseled_deepslate" diff --git a/data/minecraft/recipe/chiseled_nether_bricks.json b/data/minecraft/recipe/chiseled_nether_bricks.json index 00189323..ffac6be0 100644 --- a/data/minecraft/recipe/chiseled_nether_bricks.json +++ b/data/minecraft/recipe/chiseled_nether_bricks.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:nether_brick_slab" - } + "#": "minecraft:nether_brick_slab" }, "pattern": [ "#", diff --git a/data/minecraft/recipe/chiseled_nether_bricks_from_nether_bricks_stonecutting.json b/data/minecraft/recipe/chiseled_nether_bricks_from_nether_bricks_stonecutting.json index cf8bdf78..58f2ec26 100644 --- a/data/minecraft/recipe/chiseled_nether_bricks_from_nether_bricks_stonecutting.json +++ b/data/minecraft/recipe/chiseled_nether_bricks_from_nether_bricks_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:nether_bricks" - }, + "ingredient": "minecraft:nether_bricks", "result": { "count": 1, "id": "minecraft:chiseled_nether_bricks" diff --git a/data/minecraft/recipe/chiseled_polished_blackstone.json b/data/minecraft/recipe/chiseled_polished_blackstone.json index 16638f1b..5eec2aa4 100644 --- a/data/minecraft/recipe/chiseled_polished_blackstone.json +++ b/data/minecraft/recipe/chiseled_polished_blackstone.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:polished_blackstone_slab" - } + "#": "minecraft:polished_blackstone_slab" }, "pattern": [ "#", diff --git a/data/minecraft/recipe/chiseled_polished_blackstone_from_blackstone_stonecutting.json b/data/minecraft/recipe/chiseled_polished_blackstone_from_blackstone_stonecutting.json index 410433f1..6a9e23e3 100644 --- a/data/minecraft/recipe/chiseled_polished_blackstone_from_blackstone_stonecutting.json +++ b/data/minecraft/recipe/chiseled_polished_blackstone_from_blackstone_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:blackstone" - }, + "ingredient": "minecraft:blackstone", "result": { "count": 1, "id": "minecraft:chiseled_polished_blackstone" diff --git a/data/minecraft/recipe/chiseled_polished_blackstone_from_polished_blackstone_stonecutting.json b/data/minecraft/recipe/chiseled_polished_blackstone_from_polished_blackstone_stonecutting.json index 94ae36c9..81b0337c 100644 --- a/data/minecraft/recipe/chiseled_polished_blackstone_from_polished_blackstone_stonecutting.json +++ b/data/minecraft/recipe/chiseled_polished_blackstone_from_polished_blackstone_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:polished_blackstone" - }, + "ingredient": "minecraft:polished_blackstone", "result": { "count": 1, "id": "minecraft:chiseled_polished_blackstone" diff --git a/data/minecraft/recipe/chiseled_quartz_block.json b/data/minecraft/recipe/chiseled_quartz_block.json index ebe1f090..cfea98fe 100644 --- a/data/minecraft/recipe/chiseled_quartz_block.json +++ b/data/minecraft/recipe/chiseled_quartz_block.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:quartz_slab" - } + "#": "minecraft:quartz_slab" }, "pattern": [ "#", diff --git a/data/minecraft/recipe/chiseled_quartz_block_from_quartz_block_stonecutting.json b/data/minecraft/recipe/chiseled_quartz_block_from_quartz_block_stonecutting.json index fd32d3a0..eb131131 100644 --- a/data/minecraft/recipe/chiseled_quartz_block_from_quartz_block_stonecutting.json +++ b/data/minecraft/recipe/chiseled_quartz_block_from_quartz_block_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:quartz_block" - }, + "ingredient": "minecraft:quartz_block", "result": { "count": 1, "id": "minecraft:chiseled_quartz_block" diff --git a/data/minecraft/recipe/chiseled_red_sandstone.json b/data/minecraft/recipe/chiseled_red_sandstone.json index d7a0250f..be60fcc9 100644 --- a/data/minecraft/recipe/chiseled_red_sandstone.json +++ b/data/minecraft/recipe/chiseled_red_sandstone.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:red_sandstone_slab" - } + "#": "minecraft:red_sandstone_slab" }, "pattern": [ "#", diff --git a/data/minecraft/recipe/chiseled_red_sandstone_from_red_sandstone_stonecutting.json b/data/minecraft/recipe/chiseled_red_sandstone_from_red_sandstone_stonecutting.json index 507ecf30..33957428 100644 --- a/data/minecraft/recipe/chiseled_red_sandstone_from_red_sandstone_stonecutting.json +++ b/data/minecraft/recipe/chiseled_red_sandstone_from_red_sandstone_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:red_sandstone" - }, + "ingredient": "minecraft:red_sandstone", "result": { "count": 1, "id": "minecraft:chiseled_red_sandstone" diff --git a/data/minecraft/recipe/chiseled_sandstone.json b/data/minecraft/recipe/chiseled_sandstone.json index 747d28c6..86c14de3 100644 --- a/data/minecraft/recipe/chiseled_sandstone.json +++ b/data/minecraft/recipe/chiseled_sandstone.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:sandstone_slab" - } + "#": "minecraft:sandstone_slab" }, "pattern": [ "#", diff --git a/data/minecraft/recipe/chiseled_sandstone_from_sandstone_stonecutting.json b/data/minecraft/recipe/chiseled_sandstone_from_sandstone_stonecutting.json index 87fb84cb..86c99bc6 100644 --- a/data/minecraft/recipe/chiseled_sandstone_from_sandstone_stonecutting.json +++ b/data/minecraft/recipe/chiseled_sandstone_from_sandstone_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:sandstone" - }, + "ingredient": "minecraft:sandstone", "result": { "count": 1, "id": "minecraft:chiseled_sandstone" diff --git a/data/minecraft/recipe/chiseled_stone_bricks.json b/data/minecraft/recipe/chiseled_stone_bricks.json index 71d60520..9b57739e 100644 --- a/data/minecraft/recipe/chiseled_stone_bricks.json +++ b/data/minecraft/recipe/chiseled_stone_bricks.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:stone_brick_slab" - } + "#": "minecraft:stone_brick_slab" }, "pattern": [ "#", diff --git a/data/minecraft/recipe/chiseled_stone_bricks_from_stone_bricks_stonecutting.json b/data/minecraft/recipe/chiseled_stone_bricks_from_stone_bricks_stonecutting.json index 4e57e2dc..7abd4c3f 100644 --- a/data/minecraft/recipe/chiseled_stone_bricks_from_stone_bricks_stonecutting.json +++ b/data/minecraft/recipe/chiseled_stone_bricks_from_stone_bricks_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:stone_bricks" - }, + "ingredient": "minecraft:stone_bricks", "result": { "count": 1, "id": "minecraft:chiseled_stone_bricks" diff --git a/data/minecraft/recipe/chiseled_stone_bricks_stone_from_stonecutting.json b/data/minecraft/recipe/chiseled_stone_bricks_stone_from_stonecutting.json index fde8e896..505ea205 100644 --- a/data/minecraft/recipe/chiseled_stone_bricks_stone_from_stonecutting.json +++ b/data/minecraft/recipe/chiseled_stone_bricks_stone_from_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:stone" - }, + "ingredient": "minecraft:stone", "result": { "count": 1, "id": "minecraft:chiseled_stone_bricks" diff --git a/data/minecraft/recipe/chiseled_tuff.json b/data/minecraft/recipe/chiseled_tuff.json index ff495622..d046e761 100644 --- a/data/minecraft/recipe/chiseled_tuff.json +++ b/data/minecraft/recipe/chiseled_tuff.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:tuff_slab" - } + "#": "minecraft:tuff_slab" }, "pattern": [ "#", diff --git a/data/minecraft/recipe/chiseled_tuff_bricks.json b/data/minecraft/recipe/chiseled_tuff_bricks.json index e13ecdd5..5a76146d 100644 --- a/data/minecraft/recipe/chiseled_tuff_bricks.json +++ b/data/minecraft/recipe/chiseled_tuff_bricks.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:tuff_brick_slab" - } + "#": "minecraft:tuff_brick_slab" }, "pattern": [ "#", diff --git a/data/minecraft/recipe/chiseled_tuff_bricks_from_polished_tuff_stonecutting.json b/data/minecraft/recipe/chiseled_tuff_bricks_from_polished_tuff_stonecutting.json index 1d344cd6..d3857f5e 100644 --- a/data/minecraft/recipe/chiseled_tuff_bricks_from_polished_tuff_stonecutting.json +++ b/data/minecraft/recipe/chiseled_tuff_bricks_from_polished_tuff_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:polished_tuff" - }, + "ingredient": "minecraft:polished_tuff", "result": { "count": 1, "id": "minecraft:chiseled_tuff_bricks" diff --git a/data/minecraft/recipe/chiseled_tuff_bricks_from_tuff_bricks_stonecutting.json b/data/minecraft/recipe/chiseled_tuff_bricks_from_tuff_bricks_stonecutting.json index 5a609e6e..2cef4f35 100644 --- a/data/minecraft/recipe/chiseled_tuff_bricks_from_tuff_bricks_stonecutting.json +++ b/data/minecraft/recipe/chiseled_tuff_bricks_from_tuff_bricks_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:tuff_bricks" - }, + "ingredient": "minecraft:tuff_bricks", "result": { "count": 1, "id": "minecraft:chiseled_tuff_bricks" diff --git a/data/minecraft/recipe/chiseled_tuff_bricks_from_tuff_stonecutting.json b/data/minecraft/recipe/chiseled_tuff_bricks_from_tuff_stonecutting.json index a4beb79a..d0f27bda 100644 --- a/data/minecraft/recipe/chiseled_tuff_bricks_from_tuff_stonecutting.json +++ b/data/minecraft/recipe/chiseled_tuff_bricks_from_tuff_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:tuff" - }, + "ingredient": "minecraft:tuff", "result": { "count": 1, "id": "minecraft:chiseled_tuff_bricks" diff --git a/data/minecraft/recipe/chiseled_tuff_from_tuff_stonecutting.json b/data/minecraft/recipe/chiseled_tuff_from_tuff_stonecutting.json index 4bac996c..d2f32dc6 100644 --- a/data/minecraft/recipe/chiseled_tuff_from_tuff_stonecutting.json +++ b/data/minecraft/recipe/chiseled_tuff_from_tuff_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:tuff" - }, + "ingredient": "minecraft:tuff", "result": { "count": 1, "id": "minecraft:chiseled_tuff" diff --git a/data/minecraft/recipe/clay.json b/data/minecraft/recipe/clay.json index dce478ec..693969b9 100644 --- a/data/minecraft/recipe/clay.json +++ b/data/minecraft/recipe/clay.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:clay_ball" - } + "#": "minecraft:clay_ball" }, "pattern": [ "##", diff --git a/data/minecraft/recipe/clock.json b/data/minecraft/recipe/clock.json index e8f18ba8..996451c2 100644 --- a/data/minecraft/recipe/clock.json +++ b/data/minecraft/recipe/clock.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shaped", "category": "equipment", "key": { - "#": { - "item": "minecraft:gold_ingot" - }, - "X": { - "item": "minecraft:redstone" - } + "#": "minecraft:gold_ingot", + "X": "minecraft:redstone" }, "pattern": [ " # ", diff --git a/data/minecraft/recipe/coal.json b/data/minecraft/recipe/coal.json index 0fc3f677..e5d53eef 100644 --- a/data/minecraft/recipe/coal.json +++ b/data/minecraft/recipe/coal.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shapeless", "category": "misc", "ingredients": [ - { - "item": "minecraft:coal_block" - } + "minecraft:coal_block" ], "result": { "count": 9, diff --git a/data/minecraft/recipe/coal_block.json b/data/minecraft/recipe/coal_block.json index e3f7fc8a..9ed5d6ca 100644 --- a/data/minecraft/recipe/coal_block.json +++ b/data/minecraft/recipe/coal_block.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:coal" - } + "#": "minecraft:coal" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/coal_from_blasting_coal_ore.json b/data/minecraft/recipe/coal_from_blasting_coal_ore.json index 83faaa54..cb5d1560 100644 --- a/data/minecraft/recipe/coal_from_blasting_coal_ore.json +++ b/data/minecraft/recipe/coal_from_blasting_coal_ore.json @@ -4,9 +4,7 @@ "cookingtime": 100, "experience": 0.1, "group": "coal", - "ingredient": { - "item": "minecraft:coal_ore" - }, + "ingredient": "minecraft:coal_ore", "result": { "id": "minecraft:coal" } diff --git a/data/minecraft/recipe/coal_from_blasting_deepslate_coal_ore.json b/data/minecraft/recipe/coal_from_blasting_deepslate_coal_ore.json index 5eb60704..53bd19d9 100644 --- a/data/minecraft/recipe/coal_from_blasting_deepslate_coal_ore.json +++ b/data/minecraft/recipe/coal_from_blasting_deepslate_coal_ore.json @@ -4,9 +4,7 @@ "cookingtime": 100, "experience": 0.1, "group": "coal", - "ingredient": { - "item": "minecraft:deepslate_coal_ore" - }, + "ingredient": "minecraft:deepslate_coal_ore", "result": { "id": "minecraft:coal" } diff --git a/data/minecraft/recipe/coal_from_smelting_coal_ore.json b/data/minecraft/recipe/coal_from_smelting_coal_ore.json index 22be2a3c..28988317 100644 --- a/data/minecraft/recipe/coal_from_smelting_coal_ore.json +++ b/data/minecraft/recipe/coal_from_smelting_coal_ore.json @@ -4,9 +4,7 @@ "cookingtime": 200, "experience": 0.1, "group": "coal", - "ingredient": { - "item": "minecraft:coal_ore" - }, + "ingredient": "minecraft:coal_ore", "result": { "id": "minecraft:coal" } diff --git a/data/minecraft/recipe/coal_from_smelting_deepslate_coal_ore.json b/data/minecraft/recipe/coal_from_smelting_deepslate_coal_ore.json index f839b754..6d2de945 100644 --- a/data/minecraft/recipe/coal_from_smelting_deepslate_coal_ore.json +++ b/data/minecraft/recipe/coal_from_smelting_deepslate_coal_ore.json @@ -4,9 +4,7 @@ "cookingtime": 200, "experience": 0.1, "group": "coal", - "ingredient": { - "item": "minecraft:deepslate_coal_ore" - }, + "ingredient": "minecraft:deepslate_coal_ore", "result": { "id": "minecraft:coal" } diff --git a/data/minecraft/recipe/coarse_dirt.json b/data/minecraft/recipe/coarse_dirt.json index 8a325ade..8e405797 100644 --- a/data/minecraft/recipe/coarse_dirt.json +++ b/data/minecraft/recipe/coarse_dirt.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "D": { - "item": "minecraft:dirt" - }, - "G": { - "item": "minecraft:gravel" - } + "D": "minecraft:dirt", + "G": "minecraft:gravel" }, "pattern": [ "DG", diff --git a/data/minecraft/recipe/coast_armor_trim_smithing_template.json b/data/minecraft/recipe/coast_armor_trim_smithing_template.json index bfa8628f..33050a52 100644 --- a/data/minecraft/recipe/coast_armor_trim_smithing_template.json +++ b/data/minecraft/recipe/coast_armor_trim_smithing_template.json @@ -2,15 +2,9 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "#": { - "item": "minecraft:diamond" - }, - "C": { - "item": "minecraft:cobblestone" - }, - "S": { - "item": "minecraft:coast_armor_trim_smithing_template" - } + "#": "minecraft:diamond", + "C": "minecraft:cobblestone", + "S": "minecraft:coast_armor_trim_smithing_template" }, "pattern": [ "#S#", diff --git a/data/minecraft/recipe/coast_armor_trim_smithing_template_smithing_trim.json b/data/minecraft/recipe/coast_armor_trim_smithing_template_smithing_trim.json index fcd0c443..844df515 100644 --- a/data/minecraft/recipe/coast_armor_trim_smithing_template_smithing_trim.json +++ b/data/minecraft/recipe/coast_armor_trim_smithing_template_smithing_trim.json @@ -1,12 +1,6 @@ { "type": "minecraft:smithing_trim", - "addition": { - "tag": "minecraft:trim_materials" - }, - "base": { - "tag": "minecraft:trimmable_armor" - }, - "template": { - "item": "minecraft:coast_armor_trim_smithing_template" - } + "addition": "#minecraft:trim_materials", + "base": "#minecraft:trimmable_armor", + "template": "minecraft:coast_armor_trim_smithing_template" } \ No newline at end of file diff --git a/data/minecraft/recipe/cobbled_deepslate_slab.json b/data/minecraft/recipe/cobbled_deepslate_slab.json index f9f4b251..7a875cf2 100644 --- a/data/minecraft/recipe/cobbled_deepslate_slab.json +++ b/data/minecraft/recipe/cobbled_deepslate_slab.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:cobbled_deepslate" - } + "#": "minecraft:cobbled_deepslate" }, "pattern": [ "###" diff --git a/data/minecraft/recipe/cobbled_deepslate_slab_from_cobbled_deepslate_stonecutting.json b/data/minecraft/recipe/cobbled_deepslate_slab_from_cobbled_deepslate_stonecutting.json index 8140e2c2..997321b0 100644 --- a/data/minecraft/recipe/cobbled_deepslate_slab_from_cobbled_deepslate_stonecutting.json +++ b/data/minecraft/recipe/cobbled_deepslate_slab_from_cobbled_deepslate_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:cobbled_deepslate" - }, + "ingredient": "minecraft:cobbled_deepslate", "result": { "count": 2, "id": "minecraft:cobbled_deepslate_slab" diff --git a/data/minecraft/recipe/cobbled_deepslate_stairs.json b/data/minecraft/recipe/cobbled_deepslate_stairs.json index a20779b4..0bd3c041 100644 --- a/data/minecraft/recipe/cobbled_deepslate_stairs.json +++ b/data/minecraft/recipe/cobbled_deepslate_stairs.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:cobbled_deepslate" - } + "#": "minecraft:cobbled_deepslate" }, "pattern": [ "# ", diff --git a/data/minecraft/recipe/cobbled_deepslate_stairs_from_cobbled_deepslate_stonecutting.json b/data/minecraft/recipe/cobbled_deepslate_stairs_from_cobbled_deepslate_stonecutting.json index 2aab11ae..102b5db7 100644 --- a/data/minecraft/recipe/cobbled_deepslate_stairs_from_cobbled_deepslate_stonecutting.json +++ b/data/minecraft/recipe/cobbled_deepslate_stairs_from_cobbled_deepslate_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:cobbled_deepslate" - }, + "ingredient": "minecraft:cobbled_deepslate", "result": { "count": 1, "id": "minecraft:cobbled_deepslate_stairs" diff --git a/data/minecraft/recipe/cobbled_deepslate_wall.json b/data/minecraft/recipe/cobbled_deepslate_wall.json index e66d07ec..c91b7e33 100644 --- a/data/minecraft/recipe/cobbled_deepslate_wall.json +++ b/data/minecraft/recipe/cobbled_deepslate_wall.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "#": { - "item": "minecraft:cobbled_deepslate" - } + "#": "minecraft:cobbled_deepslate" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/cobbled_deepslate_wall_from_cobbled_deepslate_stonecutting.json b/data/minecraft/recipe/cobbled_deepslate_wall_from_cobbled_deepslate_stonecutting.json index 4a211bf3..6c1db014 100644 --- a/data/minecraft/recipe/cobbled_deepslate_wall_from_cobbled_deepslate_stonecutting.json +++ b/data/minecraft/recipe/cobbled_deepslate_wall_from_cobbled_deepslate_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:cobbled_deepslate" - }, + "ingredient": "minecraft:cobbled_deepslate", "result": { "count": 1, "id": "minecraft:cobbled_deepslate_wall" diff --git a/data/minecraft/recipe/cobblestone_slab.json b/data/minecraft/recipe/cobblestone_slab.json index 0fd8aabc..94545475 100644 --- a/data/minecraft/recipe/cobblestone_slab.json +++ b/data/minecraft/recipe/cobblestone_slab.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:cobblestone" - } + "#": "minecraft:cobblestone" }, "pattern": [ "###" diff --git a/data/minecraft/recipe/cobblestone_slab_from_cobblestone_stonecutting.json b/data/minecraft/recipe/cobblestone_slab_from_cobblestone_stonecutting.json index 103fef3a..b64c99ab 100644 --- a/data/minecraft/recipe/cobblestone_slab_from_cobblestone_stonecutting.json +++ b/data/minecraft/recipe/cobblestone_slab_from_cobblestone_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:cobblestone" - }, + "ingredient": "minecraft:cobblestone", "result": { "count": 2, "id": "minecraft:cobblestone_slab" diff --git a/data/minecraft/recipe/cobblestone_stairs.json b/data/minecraft/recipe/cobblestone_stairs.json index 2257ab76..e2455d0d 100644 --- a/data/minecraft/recipe/cobblestone_stairs.json +++ b/data/minecraft/recipe/cobblestone_stairs.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:cobblestone" - } + "#": "minecraft:cobblestone" }, "pattern": [ "# ", diff --git a/data/minecraft/recipe/cobblestone_stairs_from_cobblestone_stonecutting.json b/data/minecraft/recipe/cobblestone_stairs_from_cobblestone_stonecutting.json index d98aebce..7acc674f 100644 --- a/data/minecraft/recipe/cobblestone_stairs_from_cobblestone_stonecutting.json +++ b/data/minecraft/recipe/cobblestone_stairs_from_cobblestone_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:cobblestone" - }, + "ingredient": "minecraft:cobblestone", "result": { "count": 1, "id": "minecraft:cobblestone_stairs" diff --git a/data/minecraft/recipe/cobblestone_wall.json b/data/minecraft/recipe/cobblestone_wall.json index d15deeaa..5268e9f2 100644 --- a/data/minecraft/recipe/cobblestone_wall.json +++ b/data/minecraft/recipe/cobblestone_wall.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "#": { - "item": "minecraft:cobblestone" - } + "#": "minecraft:cobblestone" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/cobblestone_wall_from_cobblestone_stonecutting.json b/data/minecraft/recipe/cobblestone_wall_from_cobblestone_stonecutting.json index 5b3f95b8..04649ba5 100644 --- a/data/minecraft/recipe/cobblestone_wall_from_cobblestone_stonecutting.json +++ b/data/minecraft/recipe/cobblestone_wall_from_cobblestone_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:cobblestone" - }, + "ingredient": "minecraft:cobblestone", "result": { "count": 1, "id": "minecraft:cobblestone_wall" diff --git a/data/minecraft/recipe/comparator.json b/data/minecraft/recipe/comparator.json index a1a39fec..b4479ba9 100644 --- a/data/minecraft/recipe/comparator.json +++ b/data/minecraft/recipe/comparator.json @@ -2,15 +2,9 @@ "type": "minecraft:crafting_shaped", "category": "redstone", "key": { - "#": { - "item": "minecraft:redstone_torch" - }, - "I": { - "item": "minecraft:stone" - }, - "X": { - "item": "minecraft:quartz" - } + "#": "minecraft:redstone_torch", + "I": "minecraft:stone", + "X": "minecraft:quartz" }, "pattern": [ " # ", diff --git a/data/minecraft/recipe/compass.json b/data/minecraft/recipe/compass.json index ed14772b..0bc21df7 100644 --- a/data/minecraft/recipe/compass.json +++ b/data/minecraft/recipe/compass.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shaped", "category": "equipment", "key": { - "#": { - "item": "minecraft:iron_ingot" - }, - "X": { - "item": "minecraft:redstone" - } + "#": "minecraft:iron_ingot", + "X": "minecraft:redstone" }, "pattern": [ " # ", diff --git a/data/minecraft/recipe/composter.json b/data/minecraft/recipe/composter.json index 400cec92..45c66841 100644 --- a/data/minecraft/recipe/composter.json +++ b/data/minecraft/recipe/composter.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "#": { - "tag": "minecraft:wooden_slabs" - } + "#": "#minecraft:wooden_slabs" }, "pattern": [ "# #", diff --git a/data/minecraft/recipe/conduit.json b/data/minecraft/recipe/conduit.json index 8970a7cf..70822f3e 100644 --- a/data/minecraft/recipe/conduit.json +++ b/data/minecraft/recipe/conduit.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "#": { - "item": "minecraft:nautilus_shell" - }, - "X": { - "item": "minecraft:heart_of_the_sea" - } + "#": "minecraft:nautilus_shell", + "X": "minecraft:heart_of_the_sea" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/cooked_beef.json b/data/minecraft/recipe/cooked_beef.json index ba8ad9fa..e465e4b7 100644 --- a/data/minecraft/recipe/cooked_beef.json +++ b/data/minecraft/recipe/cooked_beef.json @@ -3,9 +3,7 @@ "category": "food", "cookingtime": 200, "experience": 0.35, - "ingredient": { - "item": "minecraft:beef" - }, + "ingredient": "minecraft:beef", "result": { "id": "minecraft:cooked_beef" } diff --git a/data/minecraft/recipe/cooked_beef_from_campfire_cooking.json b/data/minecraft/recipe/cooked_beef_from_campfire_cooking.json index c0e8a526..96a25f7b 100644 --- a/data/minecraft/recipe/cooked_beef_from_campfire_cooking.json +++ b/data/minecraft/recipe/cooked_beef_from_campfire_cooking.json @@ -3,9 +3,7 @@ "category": "food", "cookingtime": 600, "experience": 0.35, - "ingredient": { - "item": "minecraft:beef" - }, + "ingredient": "minecraft:beef", "result": { "id": "minecraft:cooked_beef" } diff --git a/data/minecraft/recipe/cooked_beef_from_smoking.json b/data/minecraft/recipe/cooked_beef_from_smoking.json index 7a3c5acb..b6081fc7 100644 --- a/data/minecraft/recipe/cooked_beef_from_smoking.json +++ b/data/minecraft/recipe/cooked_beef_from_smoking.json @@ -3,9 +3,7 @@ "category": "food", "cookingtime": 100, "experience": 0.35, - "ingredient": { - "item": "minecraft:beef" - }, + "ingredient": "minecraft:beef", "result": { "id": "minecraft:cooked_beef" } diff --git a/data/minecraft/recipe/cooked_chicken.json b/data/minecraft/recipe/cooked_chicken.json index f35ff527..9b2c42be 100644 --- a/data/minecraft/recipe/cooked_chicken.json +++ b/data/minecraft/recipe/cooked_chicken.json @@ -3,9 +3,7 @@ "category": "food", "cookingtime": 200, "experience": 0.35, - "ingredient": { - "item": "minecraft:chicken" - }, + "ingredient": "minecraft:chicken", "result": { "id": "minecraft:cooked_chicken" } diff --git a/data/minecraft/recipe/cooked_chicken_from_campfire_cooking.json b/data/minecraft/recipe/cooked_chicken_from_campfire_cooking.json index 8817dde3..90481c78 100644 --- a/data/minecraft/recipe/cooked_chicken_from_campfire_cooking.json +++ b/data/minecraft/recipe/cooked_chicken_from_campfire_cooking.json @@ -3,9 +3,7 @@ "category": "food", "cookingtime": 600, "experience": 0.35, - "ingredient": { - "item": "minecraft:chicken" - }, + "ingredient": "minecraft:chicken", "result": { "id": "minecraft:cooked_chicken" } diff --git a/data/minecraft/recipe/cooked_chicken_from_smoking.json b/data/minecraft/recipe/cooked_chicken_from_smoking.json index 5632323e..db5d9ff7 100644 --- a/data/minecraft/recipe/cooked_chicken_from_smoking.json +++ b/data/minecraft/recipe/cooked_chicken_from_smoking.json @@ -3,9 +3,7 @@ "category": "food", "cookingtime": 100, "experience": 0.35, - "ingredient": { - "item": "minecraft:chicken" - }, + "ingredient": "minecraft:chicken", "result": { "id": "minecraft:cooked_chicken" } diff --git a/data/minecraft/recipe/cooked_cod.json b/data/minecraft/recipe/cooked_cod.json index d6840add..760d95d2 100644 --- a/data/minecraft/recipe/cooked_cod.json +++ b/data/minecraft/recipe/cooked_cod.json @@ -3,9 +3,7 @@ "category": "food", "cookingtime": 200, "experience": 0.35, - "ingredient": { - "item": "minecraft:cod" - }, + "ingredient": "minecraft:cod", "result": { "id": "minecraft:cooked_cod" } diff --git a/data/minecraft/recipe/cooked_cod_from_campfire_cooking.json b/data/minecraft/recipe/cooked_cod_from_campfire_cooking.json index 817c686a..174914e6 100644 --- a/data/minecraft/recipe/cooked_cod_from_campfire_cooking.json +++ b/data/minecraft/recipe/cooked_cod_from_campfire_cooking.json @@ -3,9 +3,7 @@ "category": "food", "cookingtime": 600, "experience": 0.35, - "ingredient": { - "item": "minecraft:cod" - }, + "ingredient": "minecraft:cod", "result": { "id": "minecraft:cooked_cod" } diff --git a/data/minecraft/recipe/cooked_cod_from_smoking.json b/data/minecraft/recipe/cooked_cod_from_smoking.json index 92e7d9e0..e7f39ecd 100644 --- a/data/minecraft/recipe/cooked_cod_from_smoking.json +++ b/data/minecraft/recipe/cooked_cod_from_smoking.json @@ -3,9 +3,7 @@ "category": "food", "cookingtime": 100, "experience": 0.35, - "ingredient": { - "item": "minecraft:cod" - }, + "ingredient": "minecraft:cod", "result": { "id": "minecraft:cooked_cod" } diff --git a/data/minecraft/recipe/cooked_mutton.json b/data/minecraft/recipe/cooked_mutton.json index cdb4af58..301dc1c4 100644 --- a/data/minecraft/recipe/cooked_mutton.json +++ b/data/minecraft/recipe/cooked_mutton.json @@ -3,9 +3,7 @@ "category": "food", "cookingtime": 200, "experience": 0.35, - "ingredient": { - "item": "minecraft:mutton" - }, + "ingredient": "minecraft:mutton", "result": { "id": "minecraft:cooked_mutton" } diff --git a/data/minecraft/recipe/cooked_mutton_from_campfire_cooking.json b/data/minecraft/recipe/cooked_mutton_from_campfire_cooking.json index 4398f8c3..28cfb4b3 100644 --- a/data/minecraft/recipe/cooked_mutton_from_campfire_cooking.json +++ b/data/minecraft/recipe/cooked_mutton_from_campfire_cooking.json @@ -3,9 +3,7 @@ "category": "food", "cookingtime": 600, "experience": 0.35, - "ingredient": { - "item": "minecraft:mutton" - }, + "ingredient": "minecraft:mutton", "result": { "id": "minecraft:cooked_mutton" } diff --git a/data/minecraft/recipe/cooked_mutton_from_smoking.json b/data/minecraft/recipe/cooked_mutton_from_smoking.json index e3ce8380..286340a8 100644 --- a/data/minecraft/recipe/cooked_mutton_from_smoking.json +++ b/data/minecraft/recipe/cooked_mutton_from_smoking.json @@ -3,9 +3,7 @@ "category": "food", "cookingtime": 100, "experience": 0.35, - "ingredient": { - "item": "minecraft:mutton" - }, + "ingredient": "minecraft:mutton", "result": { "id": "minecraft:cooked_mutton" } diff --git a/data/minecraft/recipe/cooked_porkchop.json b/data/minecraft/recipe/cooked_porkchop.json index 42061aa8..8ff0ffbc 100644 --- a/data/minecraft/recipe/cooked_porkchop.json +++ b/data/minecraft/recipe/cooked_porkchop.json @@ -3,9 +3,7 @@ "category": "food", "cookingtime": 200, "experience": 0.35, - "ingredient": { - "item": "minecraft:porkchop" - }, + "ingredient": "minecraft:porkchop", "result": { "id": "minecraft:cooked_porkchop" } diff --git a/data/minecraft/recipe/cooked_porkchop_from_campfire_cooking.json b/data/minecraft/recipe/cooked_porkchop_from_campfire_cooking.json index 4956d7b5..ef7c6833 100644 --- a/data/minecraft/recipe/cooked_porkchop_from_campfire_cooking.json +++ b/data/minecraft/recipe/cooked_porkchop_from_campfire_cooking.json @@ -3,9 +3,7 @@ "category": "food", "cookingtime": 600, "experience": 0.35, - "ingredient": { - "item": "minecraft:porkchop" - }, + "ingredient": "minecraft:porkchop", "result": { "id": "minecraft:cooked_porkchop" } diff --git a/data/minecraft/recipe/cooked_porkchop_from_smoking.json b/data/minecraft/recipe/cooked_porkchop_from_smoking.json index 696383e0..8e9940b9 100644 --- a/data/minecraft/recipe/cooked_porkchop_from_smoking.json +++ b/data/minecraft/recipe/cooked_porkchop_from_smoking.json @@ -3,9 +3,7 @@ "category": "food", "cookingtime": 100, "experience": 0.35, - "ingredient": { - "item": "minecraft:porkchop" - }, + "ingredient": "minecraft:porkchop", "result": { "id": "minecraft:cooked_porkchop" } diff --git a/data/minecraft/recipe/cooked_rabbit.json b/data/minecraft/recipe/cooked_rabbit.json index a37de0dc..e486ece2 100644 --- a/data/minecraft/recipe/cooked_rabbit.json +++ b/data/minecraft/recipe/cooked_rabbit.json @@ -3,9 +3,7 @@ "category": "food", "cookingtime": 200, "experience": 0.35, - "ingredient": { - "item": "minecraft:rabbit" - }, + "ingredient": "minecraft:rabbit", "result": { "id": "minecraft:cooked_rabbit" } diff --git a/data/minecraft/recipe/cooked_rabbit_from_campfire_cooking.json b/data/minecraft/recipe/cooked_rabbit_from_campfire_cooking.json index 93199981..38f0ace8 100644 --- a/data/minecraft/recipe/cooked_rabbit_from_campfire_cooking.json +++ b/data/minecraft/recipe/cooked_rabbit_from_campfire_cooking.json @@ -3,9 +3,7 @@ "category": "food", "cookingtime": 600, "experience": 0.35, - "ingredient": { - "item": "minecraft:rabbit" - }, + "ingredient": "minecraft:rabbit", "result": { "id": "minecraft:cooked_rabbit" } diff --git a/data/minecraft/recipe/cooked_rabbit_from_smoking.json b/data/minecraft/recipe/cooked_rabbit_from_smoking.json index cf225ecb..a94cec5c 100644 --- a/data/minecraft/recipe/cooked_rabbit_from_smoking.json +++ b/data/minecraft/recipe/cooked_rabbit_from_smoking.json @@ -3,9 +3,7 @@ "category": "food", "cookingtime": 100, "experience": 0.35, - "ingredient": { - "item": "minecraft:rabbit" - }, + "ingredient": "minecraft:rabbit", "result": { "id": "minecraft:cooked_rabbit" } diff --git a/data/minecraft/recipe/cooked_salmon.json b/data/minecraft/recipe/cooked_salmon.json index 6891a551..a254f5aa 100644 --- a/data/minecraft/recipe/cooked_salmon.json +++ b/data/minecraft/recipe/cooked_salmon.json @@ -3,9 +3,7 @@ "category": "food", "cookingtime": 200, "experience": 0.35, - "ingredient": { - "item": "minecraft:salmon" - }, + "ingredient": "minecraft:salmon", "result": { "id": "minecraft:cooked_salmon" } diff --git a/data/minecraft/recipe/cooked_salmon_from_campfire_cooking.json b/data/minecraft/recipe/cooked_salmon_from_campfire_cooking.json index a13dbcd8..8bff9565 100644 --- a/data/minecraft/recipe/cooked_salmon_from_campfire_cooking.json +++ b/data/minecraft/recipe/cooked_salmon_from_campfire_cooking.json @@ -3,9 +3,7 @@ "category": "food", "cookingtime": 600, "experience": 0.35, - "ingredient": { - "item": "minecraft:salmon" - }, + "ingredient": "minecraft:salmon", "result": { "id": "minecraft:cooked_salmon" } diff --git a/data/minecraft/recipe/cooked_salmon_from_smoking.json b/data/minecraft/recipe/cooked_salmon_from_smoking.json index 932f1382..7b6c00c1 100644 --- a/data/minecraft/recipe/cooked_salmon_from_smoking.json +++ b/data/minecraft/recipe/cooked_salmon_from_smoking.json @@ -3,9 +3,7 @@ "category": "food", "cookingtime": 100, "experience": 0.35, - "ingredient": { - "item": "minecraft:salmon" - }, + "ingredient": "minecraft:salmon", "result": { "id": "minecraft:cooked_salmon" } diff --git a/data/minecraft/recipe/cookie.json b/data/minecraft/recipe/cookie.json index fb706e98..5d0a2316 100644 --- a/data/minecraft/recipe/cookie.json +++ b/data/minecraft/recipe/cookie.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "#": { - "item": "minecraft:wheat" - }, - "X": { - "item": "minecraft:cocoa_beans" - } + "#": "minecraft:wheat", + "X": "minecraft:cocoa_beans" }, "pattern": [ "#X#" diff --git a/data/minecraft/recipe/copper_block.json b/data/minecraft/recipe/copper_block.json index 80075d6a..51c66208 100644 --- a/data/minecraft/recipe/copper_block.json +++ b/data/minecraft/recipe/copper_block.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:copper_ingot" - } + "#": "minecraft:copper_ingot" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/copper_bulb.json b/data/minecraft/recipe/copper_bulb.json index 2f133457..02c0df5f 100644 --- a/data/minecraft/recipe/copper_bulb.json +++ b/data/minecraft/recipe/copper_bulb.json @@ -2,15 +2,9 @@ "type": "minecraft:crafting_shaped", "category": "redstone", "key": { - "B": { - "item": "minecraft:blaze_rod" - }, - "C": { - "item": "minecraft:copper_block" - }, - "R": { - "item": "minecraft:redstone" - } + "B": "minecraft:blaze_rod", + "C": "minecraft:copper_block", + "R": "minecraft:redstone" }, "pattern": [ " C ", diff --git a/data/minecraft/recipe/copper_door.json b/data/minecraft/recipe/copper_door.json index 33f66233..4d9770e3 100644 --- a/data/minecraft/recipe/copper_door.json +++ b/data/minecraft/recipe/copper_door.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "redstone", "key": { - "#": { - "item": "minecraft:copper_ingot" - } + "#": "minecraft:copper_ingot" }, "pattern": [ "##", diff --git a/data/minecraft/recipe/copper_grate.json b/data/minecraft/recipe/copper_grate.json index 13e9afea..73f8186b 100644 --- a/data/minecraft/recipe/copper_grate.json +++ b/data/minecraft/recipe/copper_grate.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "M": { - "item": "minecraft:copper_block" - } + "M": "minecraft:copper_block" }, "pattern": [ " M ", diff --git a/data/minecraft/recipe/copper_grate_from_copper_block_stonecutting.json b/data/minecraft/recipe/copper_grate_from_copper_block_stonecutting.json index 608a9134..fbe3826f 100644 --- a/data/minecraft/recipe/copper_grate_from_copper_block_stonecutting.json +++ b/data/minecraft/recipe/copper_grate_from_copper_block_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:copper_block" - }, + "ingredient": "minecraft:copper_block", "result": { "count": 4, "id": "minecraft:copper_grate" diff --git a/data/minecraft/recipe/copper_ingot.json b/data/minecraft/recipe/copper_ingot.json index 54f2b7a3..ba846cd9 100644 --- a/data/minecraft/recipe/copper_ingot.json +++ b/data/minecraft/recipe/copper_ingot.json @@ -3,9 +3,7 @@ "category": "misc", "group": "copper_ingot", "ingredients": [ - { - "item": "minecraft:copper_block" - } + "minecraft:copper_block" ], "result": { "count": 9, diff --git a/data/minecraft/recipe/copper_ingot_from_blasting_copper_ore.json b/data/minecraft/recipe/copper_ingot_from_blasting_copper_ore.json index 4a89ecd3..104ea714 100644 --- a/data/minecraft/recipe/copper_ingot_from_blasting_copper_ore.json +++ b/data/minecraft/recipe/copper_ingot_from_blasting_copper_ore.json @@ -4,9 +4,7 @@ "cookingtime": 100, "experience": 0.7, "group": "copper_ingot", - "ingredient": { - "item": "minecraft:copper_ore" - }, + "ingredient": "minecraft:copper_ore", "result": { "id": "minecraft:copper_ingot" } diff --git a/data/minecraft/recipe/copper_ingot_from_blasting_deepslate_copper_ore.json b/data/minecraft/recipe/copper_ingot_from_blasting_deepslate_copper_ore.json index 4f32bfdd..d930a559 100644 --- a/data/minecraft/recipe/copper_ingot_from_blasting_deepslate_copper_ore.json +++ b/data/minecraft/recipe/copper_ingot_from_blasting_deepslate_copper_ore.json @@ -4,9 +4,7 @@ "cookingtime": 100, "experience": 0.7, "group": "copper_ingot", - "ingredient": { - "item": "minecraft:deepslate_copper_ore" - }, + "ingredient": "minecraft:deepslate_copper_ore", "result": { "id": "minecraft:copper_ingot" } diff --git a/data/minecraft/recipe/copper_ingot_from_blasting_raw_copper.json b/data/minecraft/recipe/copper_ingot_from_blasting_raw_copper.json index ebe7f204..a3574517 100644 --- a/data/minecraft/recipe/copper_ingot_from_blasting_raw_copper.json +++ b/data/minecraft/recipe/copper_ingot_from_blasting_raw_copper.json @@ -4,9 +4,7 @@ "cookingtime": 100, "experience": 0.7, "group": "copper_ingot", - "ingredient": { - "item": "minecraft:raw_copper" - }, + "ingredient": "minecraft:raw_copper", "result": { "id": "minecraft:copper_ingot" } diff --git a/data/minecraft/recipe/copper_ingot_from_smelting_copper_ore.json b/data/minecraft/recipe/copper_ingot_from_smelting_copper_ore.json index a918ac61..87a19c0a 100644 --- a/data/minecraft/recipe/copper_ingot_from_smelting_copper_ore.json +++ b/data/minecraft/recipe/copper_ingot_from_smelting_copper_ore.json @@ -4,9 +4,7 @@ "cookingtime": 200, "experience": 0.7, "group": "copper_ingot", - "ingredient": { - "item": "minecraft:copper_ore" - }, + "ingredient": "minecraft:copper_ore", "result": { "id": "minecraft:copper_ingot" } diff --git a/data/minecraft/recipe/copper_ingot_from_smelting_deepslate_copper_ore.json b/data/minecraft/recipe/copper_ingot_from_smelting_deepslate_copper_ore.json index a451656c..e8e0ceb4 100644 --- a/data/minecraft/recipe/copper_ingot_from_smelting_deepslate_copper_ore.json +++ b/data/minecraft/recipe/copper_ingot_from_smelting_deepslate_copper_ore.json @@ -4,9 +4,7 @@ "cookingtime": 200, "experience": 0.7, "group": "copper_ingot", - "ingredient": { - "item": "minecraft:deepslate_copper_ore" - }, + "ingredient": "minecraft:deepslate_copper_ore", "result": { "id": "minecraft:copper_ingot" } diff --git a/data/minecraft/recipe/copper_ingot_from_smelting_raw_copper.json b/data/minecraft/recipe/copper_ingot_from_smelting_raw_copper.json index e98453e1..357795c5 100644 --- a/data/minecraft/recipe/copper_ingot_from_smelting_raw_copper.json +++ b/data/minecraft/recipe/copper_ingot_from_smelting_raw_copper.json @@ -4,9 +4,7 @@ "cookingtime": 200, "experience": 0.7, "group": "copper_ingot", - "ingredient": { - "item": "minecraft:raw_copper" - }, + "ingredient": "minecraft:raw_copper", "result": { "id": "minecraft:copper_ingot" } diff --git a/data/minecraft/recipe/copper_ingot_from_waxed_copper_block.json b/data/minecraft/recipe/copper_ingot_from_waxed_copper_block.json index cedcf144..038b3b72 100644 --- a/data/minecraft/recipe/copper_ingot_from_waxed_copper_block.json +++ b/data/minecraft/recipe/copper_ingot_from_waxed_copper_block.json @@ -3,9 +3,7 @@ "category": "misc", "group": "copper_ingot", "ingredients": [ - { - "item": "minecraft:waxed_copper_block" - } + "minecraft:waxed_copper_block" ], "result": { "count": 9, diff --git a/data/minecraft/recipe/copper_trapdoor.json b/data/minecraft/recipe/copper_trapdoor.json index c36fe8ec..54bf6d0e 100644 --- a/data/minecraft/recipe/copper_trapdoor.json +++ b/data/minecraft/recipe/copper_trapdoor.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "redstone", "key": { - "#": { - "item": "minecraft:copper_ingot" - } + "#": "minecraft:copper_ingot" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/cracked_deepslate_bricks.json b/data/minecraft/recipe/cracked_deepslate_bricks.json index f4fd4e3d..004100f4 100644 --- a/data/minecraft/recipe/cracked_deepslate_bricks.json +++ b/data/minecraft/recipe/cracked_deepslate_bricks.json @@ -3,9 +3,7 @@ "category": "blocks", "cookingtime": 200, "experience": 0.1, - "ingredient": { - "item": "minecraft:deepslate_bricks" - }, + "ingredient": "minecraft:deepslate_bricks", "result": { "id": "minecraft:cracked_deepslate_bricks" } diff --git a/data/minecraft/recipe/cracked_deepslate_tiles.json b/data/minecraft/recipe/cracked_deepslate_tiles.json index 38763484..2aae3f34 100644 --- a/data/minecraft/recipe/cracked_deepslate_tiles.json +++ b/data/minecraft/recipe/cracked_deepslate_tiles.json @@ -3,9 +3,7 @@ "category": "blocks", "cookingtime": 200, "experience": 0.1, - "ingredient": { - "item": "minecraft:deepslate_tiles" - }, + "ingredient": "minecraft:deepslate_tiles", "result": { "id": "minecraft:cracked_deepslate_tiles" } diff --git a/data/minecraft/recipe/cracked_nether_bricks.json b/data/minecraft/recipe/cracked_nether_bricks.json index cb6b5d3f..cd3903e9 100644 --- a/data/minecraft/recipe/cracked_nether_bricks.json +++ b/data/minecraft/recipe/cracked_nether_bricks.json @@ -3,9 +3,7 @@ "category": "blocks", "cookingtime": 200, "experience": 0.1, - "ingredient": { - "item": "minecraft:nether_bricks" - }, + "ingredient": "minecraft:nether_bricks", "result": { "id": "minecraft:cracked_nether_bricks" } diff --git a/data/minecraft/recipe/cracked_polished_blackstone_bricks.json b/data/minecraft/recipe/cracked_polished_blackstone_bricks.json index db40c1d5..b75fb6d6 100644 --- a/data/minecraft/recipe/cracked_polished_blackstone_bricks.json +++ b/data/minecraft/recipe/cracked_polished_blackstone_bricks.json @@ -3,9 +3,7 @@ "category": "blocks", "cookingtime": 200, "experience": 0.1, - "ingredient": { - "item": "minecraft:polished_blackstone_bricks" - }, + "ingredient": "minecraft:polished_blackstone_bricks", "result": { "id": "minecraft:cracked_polished_blackstone_bricks" } diff --git a/data/minecraft/recipe/cracked_stone_bricks.json b/data/minecraft/recipe/cracked_stone_bricks.json index 39dc2688..6e2dddb3 100644 --- a/data/minecraft/recipe/cracked_stone_bricks.json +++ b/data/minecraft/recipe/cracked_stone_bricks.json @@ -3,9 +3,7 @@ "category": "blocks", "cookingtime": 200, "experience": 0.1, - "ingredient": { - "item": "minecraft:stone_bricks" - }, + "ingredient": "minecraft:stone_bricks", "result": { "id": "minecraft:cracked_stone_bricks" } diff --git a/data/minecraft/recipe/crafter.json b/data/minecraft/recipe/crafter.json index 6c527b94..2846c94c 100644 --- a/data/minecraft/recipe/crafter.json +++ b/data/minecraft/recipe/crafter.json @@ -2,18 +2,10 @@ "type": "minecraft:crafting_shaped", "category": "redstone", "key": { - "#": { - "item": "minecraft:iron_ingot" - }, - "C": { - "item": "minecraft:crafting_table" - }, - "D": { - "item": "minecraft:dropper" - }, - "R": { - "item": "minecraft:redstone" - } + "#": "minecraft:iron_ingot", + "C": "minecraft:crafting_table", + "D": "minecraft:dropper", + "R": "minecraft:redstone" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/crafting_table.json b/data/minecraft/recipe/crafting_table.json index d6b719e2..e86d3469 100644 --- a/data/minecraft/recipe/crafting_table.json +++ b/data/minecraft/recipe/crafting_table.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "#": { - "tag": "minecraft:planks" - } + "#": "#minecraft:planks" }, "pattern": [ "##", diff --git a/data/minecraft/recipe/creeper_banner_pattern.json b/data/minecraft/recipe/creeper_banner_pattern.json index afb307d0..27487f0c 100644 --- a/data/minecraft/recipe/creeper_banner_pattern.json +++ b/data/minecraft/recipe/creeper_banner_pattern.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shapeless", "category": "misc", "ingredients": [ - { - "item": "minecraft:paper" - }, - { - "item": "minecraft:creeper_head" - } + "minecraft:paper", + "minecraft:creeper_head" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/crimson_button.json b/data/minecraft/recipe/crimson_button.json index 413c249c..4802f8a0 100644 --- a/data/minecraft/recipe/crimson_button.json +++ b/data/minecraft/recipe/crimson_button.json @@ -3,9 +3,7 @@ "category": "redstone", "group": "wooden_button", "ingredients": [ - { - "item": "minecraft:crimson_planks" - } + "minecraft:crimson_planks" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/crimson_door.json b/data/minecraft/recipe/crimson_door.json index cceaffca..475b6926 100644 --- a/data/minecraft/recipe/crimson_door.json +++ b/data/minecraft/recipe/crimson_door.json @@ -3,9 +3,7 @@ "category": "redstone", "group": "wooden_door", "key": { - "#": { - "item": "minecraft:crimson_planks" - } + "#": "minecraft:crimson_planks" }, "pattern": [ "##", diff --git a/data/minecraft/recipe/crimson_fence.json b/data/minecraft/recipe/crimson_fence.json index edb57d8b..4b7cd26e 100644 --- a/data/minecraft/recipe/crimson_fence.json +++ b/data/minecraft/recipe/crimson_fence.json @@ -3,12 +3,8 @@ "category": "misc", "group": "wooden_fence", "key": { - "#": { - "item": "minecraft:stick" - }, - "W": { - "item": "minecraft:crimson_planks" - } + "#": "minecraft:stick", + "W": "minecraft:crimson_planks" }, "pattern": [ "W#W", diff --git a/data/minecraft/recipe/crimson_fence_gate.json b/data/minecraft/recipe/crimson_fence_gate.json index 0a15dee5..d2f69a8d 100644 --- a/data/minecraft/recipe/crimson_fence_gate.json +++ b/data/minecraft/recipe/crimson_fence_gate.json @@ -3,12 +3,8 @@ "category": "redstone", "group": "wooden_fence_gate", "key": { - "#": { - "item": "minecraft:stick" - }, - "W": { - "item": "minecraft:crimson_planks" - } + "#": "minecraft:stick", + "W": "minecraft:crimson_planks" }, "pattern": [ "#W#", diff --git a/data/minecraft/recipe/crimson_hanging_sign.json b/data/minecraft/recipe/crimson_hanging_sign.json index 6958aaba..29f6dcef 100644 --- a/data/minecraft/recipe/crimson_hanging_sign.json +++ b/data/minecraft/recipe/crimson_hanging_sign.json @@ -3,12 +3,8 @@ "category": "misc", "group": "hanging_sign", "key": { - "#": { - "item": "minecraft:stripped_crimson_stem" - }, - "X": { - "item": "minecraft:chain" - } + "#": "minecraft:stripped_crimson_stem", + "X": "minecraft:chain" }, "pattern": [ "X X", diff --git a/data/minecraft/recipe/crimson_hyphae.json b/data/minecraft/recipe/crimson_hyphae.json index c3e51ae9..9091b85f 100644 --- a/data/minecraft/recipe/crimson_hyphae.json +++ b/data/minecraft/recipe/crimson_hyphae.json @@ -3,9 +3,7 @@ "category": "building", "group": "bark", "key": { - "#": { - "item": "minecraft:crimson_stem" - } + "#": "minecraft:crimson_stem" }, "pattern": [ "##", diff --git a/data/minecraft/recipe/crimson_planks.json b/data/minecraft/recipe/crimson_planks.json index 1639af4f..d2a238e3 100644 --- a/data/minecraft/recipe/crimson_planks.json +++ b/data/minecraft/recipe/crimson_planks.json @@ -3,9 +3,7 @@ "category": "building", "group": "planks", "ingredients": [ - { - "tag": "minecraft:crimson_stems" - } + "#minecraft:crimson_stems" ], "result": { "count": 4, diff --git a/data/minecraft/recipe/crimson_pressure_plate.json b/data/minecraft/recipe/crimson_pressure_plate.json index 6e7dade2..77292a2e 100644 --- a/data/minecraft/recipe/crimson_pressure_plate.json +++ b/data/minecraft/recipe/crimson_pressure_plate.json @@ -3,9 +3,7 @@ "category": "redstone", "group": "wooden_pressure_plate", "key": { - "#": { - "item": "minecraft:crimson_planks" - } + "#": "minecraft:crimson_planks" }, "pattern": [ "##" diff --git a/data/minecraft/recipe/crimson_sign.json b/data/minecraft/recipe/crimson_sign.json index e27808bf..1afaebe7 100644 --- a/data/minecraft/recipe/crimson_sign.json +++ b/data/minecraft/recipe/crimson_sign.json @@ -3,12 +3,8 @@ "category": "misc", "group": "wooden_sign", "key": { - "#": { - "item": "minecraft:crimson_planks" - }, - "X": { - "item": "minecraft:stick" - } + "#": "minecraft:crimson_planks", + "X": "minecraft:stick" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/crimson_slab.json b/data/minecraft/recipe/crimson_slab.json index ccb16234..6bc18ee5 100644 --- a/data/minecraft/recipe/crimson_slab.json +++ b/data/minecraft/recipe/crimson_slab.json @@ -3,9 +3,7 @@ "category": "building", "group": "wooden_slab", "key": { - "#": { - "item": "minecraft:crimson_planks" - } + "#": "minecraft:crimson_planks" }, "pattern": [ "###" diff --git a/data/minecraft/recipe/crimson_stairs.json b/data/minecraft/recipe/crimson_stairs.json index fa94b8ee..8ab8c9c9 100644 --- a/data/minecraft/recipe/crimson_stairs.json +++ b/data/minecraft/recipe/crimson_stairs.json @@ -3,9 +3,7 @@ "category": "building", "group": "wooden_stairs", "key": { - "#": { - "item": "minecraft:crimson_planks" - } + "#": "minecraft:crimson_planks" }, "pattern": [ "# ", diff --git a/data/minecraft/recipe/crimson_trapdoor.json b/data/minecraft/recipe/crimson_trapdoor.json index 1e23651e..ab1f1aca 100644 --- a/data/minecraft/recipe/crimson_trapdoor.json +++ b/data/minecraft/recipe/crimson_trapdoor.json @@ -3,9 +3,7 @@ "category": "redstone", "group": "wooden_trapdoor", "key": { - "#": { - "item": "minecraft:crimson_planks" - } + "#": "minecraft:crimson_planks" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/crossbow.json b/data/minecraft/recipe/crossbow.json index 62217c97..c10de497 100644 --- a/data/minecraft/recipe/crossbow.json +++ b/data/minecraft/recipe/crossbow.json @@ -2,18 +2,10 @@ "type": "minecraft:crafting_shaped", "category": "equipment", "key": { - "#": { - "item": "minecraft:stick" - }, - "$": { - "item": "minecraft:tripwire_hook" - }, - "&": { - "item": "minecraft:iron_ingot" - }, - "~": { - "item": "minecraft:string" - } + "#": "minecraft:stick", + "$": "minecraft:tripwire_hook", + "&": "minecraft:iron_ingot", + "~": "minecraft:string" }, "pattern": [ "#&#", diff --git a/data/minecraft/recipe/cut_copper.json b/data/minecraft/recipe/cut_copper.json index 0df2fa54..5f1f093f 100644 --- a/data/minecraft/recipe/cut_copper.json +++ b/data/minecraft/recipe/cut_copper.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:copper_block" - } + "#": "minecraft:copper_block" }, "pattern": [ "##", diff --git a/data/minecraft/recipe/cut_copper_from_copper_block_stonecutting.json b/data/minecraft/recipe/cut_copper_from_copper_block_stonecutting.json index 3a483ca4..1c1e2d5a 100644 --- a/data/minecraft/recipe/cut_copper_from_copper_block_stonecutting.json +++ b/data/minecraft/recipe/cut_copper_from_copper_block_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:copper_block" - }, + "ingredient": "minecraft:copper_block", "result": { "count": 4, "id": "minecraft:cut_copper" diff --git a/data/minecraft/recipe/cut_copper_slab.json b/data/minecraft/recipe/cut_copper_slab.json index 2683e54b..788fef16 100644 --- a/data/minecraft/recipe/cut_copper_slab.json +++ b/data/minecraft/recipe/cut_copper_slab.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:cut_copper" - } + "#": "minecraft:cut_copper" }, "pattern": [ "###" diff --git a/data/minecraft/recipe/cut_copper_slab_from_copper_block_stonecutting.json b/data/minecraft/recipe/cut_copper_slab_from_copper_block_stonecutting.json index 2d47bef7..b965be60 100644 --- a/data/minecraft/recipe/cut_copper_slab_from_copper_block_stonecutting.json +++ b/data/minecraft/recipe/cut_copper_slab_from_copper_block_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:copper_block" - }, + "ingredient": "minecraft:copper_block", "result": { "count": 8, "id": "minecraft:cut_copper_slab" diff --git a/data/minecraft/recipe/cut_copper_slab_from_cut_copper_stonecutting.json b/data/minecraft/recipe/cut_copper_slab_from_cut_copper_stonecutting.json index 8e97b4f7..bc8988a3 100644 --- a/data/minecraft/recipe/cut_copper_slab_from_cut_copper_stonecutting.json +++ b/data/minecraft/recipe/cut_copper_slab_from_cut_copper_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:cut_copper" - }, + "ingredient": "minecraft:cut_copper", "result": { "count": 2, "id": "minecraft:cut_copper_slab" diff --git a/data/minecraft/recipe/cut_copper_stairs.json b/data/minecraft/recipe/cut_copper_stairs.json index 42d7ebca..74f87bdb 100644 --- a/data/minecraft/recipe/cut_copper_stairs.json +++ b/data/minecraft/recipe/cut_copper_stairs.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:cut_copper" - } + "#": "minecraft:cut_copper" }, "pattern": [ "# ", diff --git a/data/minecraft/recipe/cut_copper_stairs_from_copper_block_stonecutting.json b/data/minecraft/recipe/cut_copper_stairs_from_copper_block_stonecutting.json index edb18a59..b6f93791 100644 --- a/data/minecraft/recipe/cut_copper_stairs_from_copper_block_stonecutting.json +++ b/data/minecraft/recipe/cut_copper_stairs_from_copper_block_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:copper_block" - }, + "ingredient": "minecraft:copper_block", "result": { "count": 4, "id": "minecraft:cut_copper_stairs" diff --git a/data/minecraft/recipe/cut_copper_stairs_from_cut_copper_stonecutting.json b/data/minecraft/recipe/cut_copper_stairs_from_cut_copper_stonecutting.json index 9d9f1eb8..dbc857fc 100644 --- a/data/minecraft/recipe/cut_copper_stairs_from_cut_copper_stonecutting.json +++ b/data/minecraft/recipe/cut_copper_stairs_from_cut_copper_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:cut_copper" - }, + "ingredient": "minecraft:cut_copper", "result": { "count": 1, "id": "minecraft:cut_copper_stairs" diff --git a/data/minecraft/recipe/cut_red_sandstone.json b/data/minecraft/recipe/cut_red_sandstone.json index eaac7e9e..793d99a3 100644 --- a/data/minecraft/recipe/cut_red_sandstone.json +++ b/data/minecraft/recipe/cut_red_sandstone.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:red_sandstone" - } + "#": "minecraft:red_sandstone" }, "pattern": [ "##", diff --git a/data/minecraft/recipe/cut_red_sandstone_from_red_sandstone_stonecutting.json b/data/minecraft/recipe/cut_red_sandstone_from_red_sandstone_stonecutting.json index 89207718..bbe23213 100644 --- a/data/minecraft/recipe/cut_red_sandstone_from_red_sandstone_stonecutting.json +++ b/data/minecraft/recipe/cut_red_sandstone_from_red_sandstone_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:red_sandstone" - }, + "ingredient": "minecraft:red_sandstone", "result": { "count": 1, "id": "minecraft:cut_red_sandstone" diff --git a/data/minecraft/recipe/cut_red_sandstone_slab.json b/data/minecraft/recipe/cut_red_sandstone_slab.json index 166f2386..e6e90d5b 100644 --- a/data/minecraft/recipe/cut_red_sandstone_slab.json +++ b/data/minecraft/recipe/cut_red_sandstone_slab.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:cut_red_sandstone" - } + "#": "minecraft:cut_red_sandstone" }, "pattern": [ "###" diff --git a/data/minecraft/recipe/cut_red_sandstone_slab_from_cut_red_sandstone_stonecutting.json b/data/minecraft/recipe/cut_red_sandstone_slab_from_cut_red_sandstone_stonecutting.json index 12f29447..c6d5b76f 100644 --- a/data/minecraft/recipe/cut_red_sandstone_slab_from_cut_red_sandstone_stonecutting.json +++ b/data/minecraft/recipe/cut_red_sandstone_slab_from_cut_red_sandstone_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:cut_red_sandstone" - }, + "ingredient": "minecraft:cut_red_sandstone", "result": { "count": 2, "id": "minecraft:cut_red_sandstone_slab" diff --git a/data/minecraft/recipe/cut_red_sandstone_slab_from_red_sandstone_stonecutting.json b/data/minecraft/recipe/cut_red_sandstone_slab_from_red_sandstone_stonecutting.json index f59ee401..ae87c3b0 100644 --- a/data/minecraft/recipe/cut_red_sandstone_slab_from_red_sandstone_stonecutting.json +++ b/data/minecraft/recipe/cut_red_sandstone_slab_from_red_sandstone_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:red_sandstone" - }, + "ingredient": "minecraft:red_sandstone", "result": { "count": 2, "id": "minecraft:cut_red_sandstone_slab" diff --git a/data/minecraft/recipe/cut_sandstone.json b/data/minecraft/recipe/cut_sandstone.json index a17b8085..3a25c26f 100644 --- a/data/minecraft/recipe/cut_sandstone.json +++ b/data/minecraft/recipe/cut_sandstone.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:sandstone" - } + "#": "minecraft:sandstone" }, "pattern": [ "##", diff --git a/data/minecraft/recipe/cut_sandstone_from_sandstone_stonecutting.json b/data/minecraft/recipe/cut_sandstone_from_sandstone_stonecutting.json index 25cb109b..3c972a69 100644 --- a/data/minecraft/recipe/cut_sandstone_from_sandstone_stonecutting.json +++ b/data/minecraft/recipe/cut_sandstone_from_sandstone_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:sandstone" - }, + "ingredient": "minecraft:sandstone", "result": { "count": 1, "id": "minecraft:cut_sandstone" diff --git a/data/minecraft/recipe/cut_sandstone_slab.json b/data/minecraft/recipe/cut_sandstone_slab.json index d6fc9a36..692c74a6 100644 --- a/data/minecraft/recipe/cut_sandstone_slab.json +++ b/data/minecraft/recipe/cut_sandstone_slab.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:cut_sandstone" - } + "#": "minecraft:cut_sandstone" }, "pattern": [ "###" diff --git a/data/minecraft/recipe/cut_sandstone_slab_from_cut_sandstone_stonecutting.json b/data/minecraft/recipe/cut_sandstone_slab_from_cut_sandstone_stonecutting.json index c1d13a3a..5b8fc198 100644 --- a/data/minecraft/recipe/cut_sandstone_slab_from_cut_sandstone_stonecutting.json +++ b/data/minecraft/recipe/cut_sandstone_slab_from_cut_sandstone_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:cut_sandstone" - }, + "ingredient": "minecraft:cut_sandstone", "result": { "count": 2, "id": "minecraft:cut_sandstone_slab" diff --git a/data/minecraft/recipe/cut_sandstone_slab_from_sandstone_stonecutting.json b/data/minecraft/recipe/cut_sandstone_slab_from_sandstone_stonecutting.json index 8836010a..b634422d 100644 --- a/data/minecraft/recipe/cut_sandstone_slab_from_sandstone_stonecutting.json +++ b/data/minecraft/recipe/cut_sandstone_slab_from_sandstone_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:sandstone" - }, + "ingredient": "minecraft:sandstone", "result": { "count": 2, "id": "minecraft:cut_sandstone_slab" diff --git a/data/minecraft/recipe/cyan_banner.json b/data/minecraft/recipe/cyan_banner.json index 335b28e4..3624bd0f 100644 --- a/data/minecraft/recipe/cyan_banner.json +++ b/data/minecraft/recipe/cyan_banner.json @@ -3,12 +3,8 @@ "category": "misc", "group": "banner", "key": { - "#": { - "item": "minecraft:cyan_wool" - }, - "|": { - "item": "minecraft:stick" - } + "#": "minecraft:cyan_wool", + "|": "minecraft:stick" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/cyan_bed.json b/data/minecraft/recipe/cyan_bed.json index b72f2e97..7e68ab2e 100644 --- a/data/minecraft/recipe/cyan_bed.json +++ b/data/minecraft/recipe/cyan_bed.json @@ -3,12 +3,8 @@ "category": "misc", "group": "bed", "key": { - "#": { - "item": "minecraft:cyan_wool" - }, - "X": { - "tag": "minecraft:planks" - } + "#": "minecraft:cyan_wool", + "X": "#minecraft:planks" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/cyan_bundle.json b/data/minecraft/recipe/cyan_bundle.json new file mode 100644 index 00000000..0f1c52ab --- /dev/null +++ b/data/minecraft/recipe/cyan_bundle.json @@ -0,0 +1,8 @@ +{ + "type": "minecraft:crafting_transmute", + "category": "equipment", + "group": "bundle_dye", + "input": "#minecraft:bundles", + "material": "minecraft:cyan_dye", + "result": "minecraft:cyan_bundle" +} \ No newline at end of file diff --git a/data/minecraft/recipe/cyan_candle.json b/data/minecraft/recipe/cyan_candle.json index 2c61aab0..32009d11 100644 --- a/data/minecraft/recipe/cyan_candle.json +++ b/data/minecraft/recipe/cyan_candle.json @@ -3,12 +3,8 @@ "category": "misc", "group": "dyed_candle", "ingredients": [ - { - "item": "minecraft:candle" - }, - { - "item": "minecraft:cyan_dye" - } + "minecraft:candle", + "minecraft:cyan_dye" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/cyan_carpet.json b/data/minecraft/recipe/cyan_carpet.json index f7838c8f..7d5ec327 100644 --- a/data/minecraft/recipe/cyan_carpet.json +++ b/data/minecraft/recipe/cyan_carpet.json @@ -3,9 +3,7 @@ "category": "misc", "group": "carpet", "key": { - "#": { - "item": "minecraft:cyan_wool" - } + "#": "minecraft:cyan_wool" }, "pattern": [ "##" diff --git a/data/minecraft/recipe/cyan_concrete_powder.json b/data/minecraft/recipe/cyan_concrete_powder.json index e3f2647e..609f185e 100644 --- a/data/minecraft/recipe/cyan_concrete_powder.json +++ b/data/minecraft/recipe/cyan_concrete_powder.json @@ -3,33 +3,15 @@ "category": "building", "group": "concrete_powder", "ingredients": [ - { - "item": "minecraft:cyan_dye" - }, - { - "item": "minecraft:sand" - }, - { - "item": "minecraft:sand" - }, - { - "item": "minecraft:sand" - }, - { - "item": "minecraft:sand" - }, - { - "item": "minecraft:gravel" - }, - { - "item": "minecraft:gravel" - }, - { - "item": "minecraft:gravel" - }, - { - "item": "minecraft:gravel" - } + "minecraft:cyan_dye", + "minecraft:sand", + "minecraft:sand", + "minecraft:sand", + "minecraft:sand", + "minecraft:gravel", + "minecraft:gravel", + "minecraft:gravel", + "minecraft:gravel" ], "result": { "count": 8, diff --git a/data/minecraft/recipe/cyan_dye.json b/data/minecraft/recipe/cyan_dye.json index 2ff7bfd0..139176a1 100644 --- a/data/minecraft/recipe/cyan_dye.json +++ b/data/minecraft/recipe/cyan_dye.json @@ -3,12 +3,8 @@ "category": "misc", "group": "cyan_dye", "ingredients": [ - { - "item": "minecraft:blue_dye" - }, - { - "item": "minecraft:green_dye" - } + "minecraft:blue_dye", + "minecraft:green_dye" ], "result": { "count": 2, diff --git a/data/minecraft/recipe/cyan_dye_from_pitcher_plant.json b/data/minecraft/recipe/cyan_dye_from_pitcher_plant.json index 71583631..51445377 100644 --- a/data/minecraft/recipe/cyan_dye_from_pitcher_plant.json +++ b/data/minecraft/recipe/cyan_dye_from_pitcher_plant.json @@ -3,9 +3,7 @@ "category": "misc", "group": "cyan_dye", "ingredients": [ - { - "item": "minecraft:pitcher_plant" - } + "minecraft:pitcher_plant" ], "result": { "count": 2, diff --git a/data/minecraft/recipe/cyan_glazed_terracotta.json b/data/minecraft/recipe/cyan_glazed_terracotta.json index bc6a3c5b..57961121 100644 --- a/data/minecraft/recipe/cyan_glazed_terracotta.json +++ b/data/minecraft/recipe/cyan_glazed_terracotta.json @@ -3,9 +3,7 @@ "category": "blocks", "cookingtime": 200, "experience": 0.1, - "ingredient": { - "item": "minecraft:cyan_terracotta" - }, + "ingredient": "minecraft:cyan_terracotta", "result": { "id": "minecraft:cyan_glazed_terracotta" } diff --git a/data/minecraft/recipe/cyan_shulker_box.json b/data/minecraft/recipe/cyan_shulker_box.json new file mode 100644 index 00000000..c45dbb68 --- /dev/null +++ b/data/minecraft/recipe/cyan_shulker_box.json @@ -0,0 +1,8 @@ +{ + "type": "minecraft:crafting_transmute", + "category": "misc", + "group": "shulker_box_dye", + "input": "#minecraft:shulker_boxes", + "material": "minecraft:cyan_dye", + "result": "minecraft:cyan_shulker_box" +} \ No newline at end of file diff --git a/data/minecraft/recipe/cyan_stained_glass.json b/data/minecraft/recipe/cyan_stained_glass.json index 1678ebe5..6274bbfe 100644 --- a/data/minecraft/recipe/cyan_stained_glass.json +++ b/data/minecraft/recipe/cyan_stained_glass.json @@ -3,12 +3,8 @@ "category": "building", "group": "stained_glass", "key": { - "#": { - "item": "minecraft:glass" - }, - "X": { - "item": "minecraft:cyan_dye" - } + "#": "minecraft:glass", + "X": "minecraft:cyan_dye" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/cyan_stained_glass_pane.json b/data/minecraft/recipe/cyan_stained_glass_pane.json index fd1b5dd2..3e26a6db 100644 --- a/data/minecraft/recipe/cyan_stained_glass_pane.json +++ b/data/minecraft/recipe/cyan_stained_glass_pane.json @@ -3,9 +3,7 @@ "category": "misc", "group": "stained_glass_pane", "key": { - "#": { - "item": "minecraft:cyan_stained_glass" - } + "#": "minecraft:cyan_stained_glass" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/cyan_stained_glass_pane_from_glass_pane.json b/data/minecraft/recipe/cyan_stained_glass_pane_from_glass_pane.json index 8fb88423..429ddb28 100644 --- a/data/minecraft/recipe/cyan_stained_glass_pane_from_glass_pane.json +++ b/data/minecraft/recipe/cyan_stained_glass_pane_from_glass_pane.json @@ -3,12 +3,8 @@ "category": "misc", "group": "stained_glass_pane", "key": { - "#": { - "item": "minecraft:glass_pane" - }, - "$": { - "item": "minecraft:cyan_dye" - } + "#": "minecraft:glass_pane", + "$": "minecraft:cyan_dye" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/cyan_terracotta.json b/data/minecraft/recipe/cyan_terracotta.json index 7c243c0f..0bb0ce11 100644 --- a/data/minecraft/recipe/cyan_terracotta.json +++ b/data/minecraft/recipe/cyan_terracotta.json @@ -3,12 +3,8 @@ "category": "building", "group": "stained_terracotta", "key": { - "#": { - "item": "minecraft:terracotta" - }, - "X": { - "item": "minecraft:cyan_dye" - } + "#": "minecraft:terracotta", + "X": "minecraft:cyan_dye" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/dark_oak_boat.json b/data/minecraft/recipe/dark_oak_boat.json index 18bc5067..e742dc79 100644 --- a/data/minecraft/recipe/dark_oak_boat.json +++ b/data/minecraft/recipe/dark_oak_boat.json @@ -3,9 +3,7 @@ "category": "misc", "group": "boat", "key": { - "#": { - "item": "minecraft:dark_oak_planks" - } + "#": "minecraft:dark_oak_planks" }, "pattern": [ "# #", diff --git a/data/minecraft/recipe/dark_oak_button.json b/data/minecraft/recipe/dark_oak_button.json index 19614762..958c1768 100644 --- a/data/minecraft/recipe/dark_oak_button.json +++ b/data/minecraft/recipe/dark_oak_button.json @@ -3,9 +3,7 @@ "category": "redstone", "group": "wooden_button", "ingredients": [ - { - "item": "minecraft:dark_oak_planks" - } + "minecraft:dark_oak_planks" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/dark_oak_chest_boat.json b/data/minecraft/recipe/dark_oak_chest_boat.json index a03aa27a..5df6c571 100644 --- a/data/minecraft/recipe/dark_oak_chest_boat.json +++ b/data/minecraft/recipe/dark_oak_chest_boat.json @@ -3,12 +3,8 @@ "category": "misc", "group": "chest_boat", "ingredients": [ - { - "item": "minecraft:chest" - }, - { - "item": "minecraft:dark_oak_boat" - } + "minecraft:chest", + "minecraft:dark_oak_boat" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/dark_oak_door.json b/data/minecraft/recipe/dark_oak_door.json index 1b08b883..13090a8e 100644 --- a/data/minecraft/recipe/dark_oak_door.json +++ b/data/minecraft/recipe/dark_oak_door.json @@ -3,9 +3,7 @@ "category": "redstone", "group": "wooden_door", "key": { - "#": { - "item": "minecraft:dark_oak_planks" - } + "#": "minecraft:dark_oak_planks" }, "pattern": [ "##", diff --git a/data/minecraft/recipe/dark_oak_fence.json b/data/minecraft/recipe/dark_oak_fence.json index e63b7998..3f53a601 100644 --- a/data/minecraft/recipe/dark_oak_fence.json +++ b/data/minecraft/recipe/dark_oak_fence.json @@ -3,12 +3,8 @@ "category": "misc", "group": "wooden_fence", "key": { - "#": { - "item": "minecraft:stick" - }, - "W": { - "item": "minecraft:dark_oak_planks" - } + "#": "minecraft:stick", + "W": "minecraft:dark_oak_planks" }, "pattern": [ "W#W", diff --git a/data/minecraft/recipe/dark_oak_fence_gate.json b/data/minecraft/recipe/dark_oak_fence_gate.json index 59d955ff..fabcceb7 100644 --- a/data/minecraft/recipe/dark_oak_fence_gate.json +++ b/data/minecraft/recipe/dark_oak_fence_gate.json @@ -3,12 +3,8 @@ "category": "redstone", "group": "wooden_fence_gate", "key": { - "#": { - "item": "minecraft:stick" - }, - "W": { - "item": "minecraft:dark_oak_planks" - } + "#": "minecraft:stick", + "W": "minecraft:dark_oak_planks" }, "pattern": [ "#W#", diff --git a/data/minecraft/recipe/dark_oak_hanging_sign.json b/data/minecraft/recipe/dark_oak_hanging_sign.json index 4aa49785..fb767460 100644 --- a/data/minecraft/recipe/dark_oak_hanging_sign.json +++ b/data/minecraft/recipe/dark_oak_hanging_sign.json @@ -3,12 +3,8 @@ "category": "misc", "group": "hanging_sign", "key": { - "#": { - "item": "minecraft:stripped_dark_oak_log" - }, - "X": { - "item": "minecraft:chain" - } + "#": "minecraft:stripped_dark_oak_log", + "X": "minecraft:chain" }, "pattern": [ "X X", diff --git a/data/minecraft/recipe/dark_oak_planks.json b/data/minecraft/recipe/dark_oak_planks.json index f9b85372..da387f3b 100644 --- a/data/minecraft/recipe/dark_oak_planks.json +++ b/data/minecraft/recipe/dark_oak_planks.json @@ -3,9 +3,7 @@ "category": "building", "group": "planks", "ingredients": [ - { - "tag": "minecraft:dark_oak_logs" - } + "#minecraft:dark_oak_logs" ], "result": { "count": 4, diff --git a/data/minecraft/recipe/dark_oak_pressure_plate.json b/data/minecraft/recipe/dark_oak_pressure_plate.json index 253e5f9c..75ffd223 100644 --- a/data/minecraft/recipe/dark_oak_pressure_plate.json +++ b/data/minecraft/recipe/dark_oak_pressure_plate.json @@ -3,9 +3,7 @@ "category": "redstone", "group": "wooden_pressure_plate", "key": { - "#": { - "item": "minecraft:dark_oak_planks" - } + "#": "minecraft:dark_oak_planks" }, "pattern": [ "##" diff --git a/data/minecraft/recipe/dark_oak_sign.json b/data/minecraft/recipe/dark_oak_sign.json index 9bde756b..2689bdd7 100644 --- a/data/minecraft/recipe/dark_oak_sign.json +++ b/data/minecraft/recipe/dark_oak_sign.json @@ -3,12 +3,8 @@ "category": "misc", "group": "wooden_sign", "key": { - "#": { - "item": "minecraft:dark_oak_planks" - }, - "X": { - "item": "minecraft:stick" - } + "#": "minecraft:dark_oak_planks", + "X": "minecraft:stick" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/dark_oak_slab.json b/data/minecraft/recipe/dark_oak_slab.json index eb527908..388fde03 100644 --- a/data/minecraft/recipe/dark_oak_slab.json +++ b/data/minecraft/recipe/dark_oak_slab.json @@ -3,9 +3,7 @@ "category": "building", "group": "wooden_slab", "key": { - "#": { - "item": "minecraft:dark_oak_planks" - } + "#": "minecraft:dark_oak_planks" }, "pattern": [ "###" diff --git a/data/minecraft/recipe/dark_oak_stairs.json b/data/minecraft/recipe/dark_oak_stairs.json index 6b801543..94049bb4 100644 --- a/data/minecraft/recipe/dark_oak_stairs.json +++ b/data/minecraft/recipe/dark_oak_stairs.json @@ -3,9 +3,7 @@ "category": "building", "group": "wooden_stairs", "key": { - "#": { - "item": "minecraft:dark_oak_planks" - } + "#": "minecraft:dark_oak_planks" }, "pattern": [ "# ", diff --git a/data/minecraft/recipe/dark_oak_trapdoor.json b/data/minecraft/recipe/dark_oak_trapdoor.json index 5f5cbb56..47358c38 100644 --- a/data/minecraft/recipe/dark_oak_trapdoor.json +++ b/data/minecraft/recipe/dark_oak_trapdoor.json @@ -3,9 +3,7 @@ "category": "redstone", "group": "wooden_trapdoor", "key": { - "#": { - "item": "minecraft:dark_oak_planks" - } + "#": "minecraft:dark_oak_planks" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/dark_oak_wood.json b/data/minecraft/recipe/dark_oak_wood.json index bdaf1f4c..ba9c3b81 100644 --- a/data/minecraft/recipe/dark_oak_wood.json +++ b/data/minecraft/recipe/dark_oak_wood.json @@ -3,9 +3,7 @@ "category": "building", "group": "bark", "key": { - "#": { - "item": "minecraft:dark_oak_log" - } + "#": "minecraft:dark_oak_log" }, "pattern": [ "##", diff --git a/data/minecraft/recipe/dark_prismarine.json b/data/minecraft/recipe/dark_prismarine.json index 57dd7cdc..4dd92cc6 100644 --- a/data/minecraft/recipe/dark_prismarine.json +++ b/data/minecraft/recipe/dark_prismarine.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "I": { - "item": "minecraft:black_dye" - }, - "S": { - "item": "minecraft:prismarine_shard" - } + "I": "minecraft:black_dye", + "S": "minecraft:prismarine_shard" }, "pattern": [ "SSS", diff --git a/data/minecraft/recipe/dark_prismarine_slab.json b/data/minecraft/recipe/dark_prismarine_slab.json index bce07b33..bccd936c 100644 --- a/data/minecraft/recipe/dark_prismarine_slab.json +++ b/data/minecraft/recipe/dark_prismarine_slab.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:dark_prismarine" - } + "#": "minecraft:dark_prismarine" }, "pattern": [ "###" diff --git a/data/minecraft/recipe/dark_prismarine_slab_from_dark_prismarine_stonecutting.json b/data/minecraft/recipe/dark_prismarine_slab_from_dark_prismarine_stonecutting.json index 4a8ce557..254edd3d 100644 --- a/data/minecraft/recipe/dark_prismarine_slab_from_dark_prismarine_stonecutting.json +++ b/data/minecraft/recipe/dark_prismarine_slab_from_dark_prismarine_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:dark_prismarine" - }, + "ingredient": "minecraft:dark_prismarine", "result": { "count": 2, "id": "minecraft:dark_prismarine_slab" diff --git a/data/minecraft/recipe/dark_prismarine_stairs.json b/data/minecraft/recipe/dark_prismarine_stairs.json index 39cde032..31657810 100644 --- a/data/minecraft/recipe/dark_prismarine_stairs.json +++ b/data/minecraft/recipe/dark_prismarine_stairs.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:dark_prismarine" - } + "#": "minecraft:dark_prismarine" }, "pattern": [ "# ", diff --git a/data/minecraft/recipe/dark_prismarine_stairs_from_dark_prismarine_stonecutting.json b/data/minecraft/recipe/dark_prismarine_stairs_from_dark_prismarine_stonecutting.json index 1bd7dfac..4a50baa3 100644 --- a/data/minecraft/recipe/dark_prismarine_stairs_from_dark_prismarine_stonecutting.json +++ b/data/minecraft/recipe/dark_prismarine_stairs_from_dark_prismarine_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:dark_prismarine" - }, + "ingredient": "minecraft:dark_prismarine", "result": { "count": 1, "id": "minecraft:dark_prismarine_stairs" diff --git a/data/minecraft/recipe/daylight_detector.json b/data/minecraft/recipe/daylight_detector.json index 6b55f908..1a86c9c0 100644 --- a/data/minecraft/recipe/daylight_detector.json +++ b/data/minecraft/recipe/daylight_detector.json @@ -2,15 +2,9 @@ "type": "minecraft:crafting_shaped", "category": "redstone", "key": { - "G": { - "item": "minecraft:glass" - }, - "Q": { - "item": "minecraft:quartz" - }, - "W": { - "tag": "minecraft:wooden_slabs" - } + "G": "minecraft:glass", + "Q": "minecraft:quartz", + "W": "#minecraft:wooden_slabs" }, "pattern": [ "GGG", diff --git a/data/minecraft/recipe/decorated_pot_simple.json b/data/minecraft/recipe/decorated_pot_simple.json index 44a336dc..e85a60b7 100644 --- a/data/minecraft/recipe/decorated_pot_simple.json +++ b/data/minecraft/recipe/decorated_pot_simple.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "#": { - "item": "minecraft:brick" - } + "#": "minecraft:brick" }, "pattern": [ " # ", diff --git a/data/minecraft/recipe/deepslate.json b/data/minecraft/recipe/deepslate.json index fb5e9276..38d18d19 100644 --- a/data/minecraft/recipe/deepslate.json +++ b/data/minecraft/recipe/deepslate.json @@ -3,9 +3,7 @@ "category": "blocks", "cookingtime": 200, "experience": 0.1, - "ingredient": { - "item": "minecraft:cobbled_deepslate" - }, + "ingredient": "minecraft:cobbled_deepslate", "result": { "id": "minecraft:deepslate" } diff --git a/data/minecraft/recipe/deepslate_brick_slab.json b/data/minecraft/recipe/deepslate_brick_slab.json index 1d0b1072..ee60ee70 100644 --- a/data/minecraft/recipe/deepslate_brick_slab.json +++ b/data/minecraft/recipe/deepslate_brick_slab.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:deepslate_bricks" - } + "#": "minecraft:deepslate_bricks" }, "pattern": [ "###" diff --git a/data/minecraft/recipe/deepslate_brick_slab_from_cobbled_deepslate_stonecutting.json b/data/minecraft/recipe/deepslate_brick_slab_from_cobbled_deepslate_stonecutting.json index 014b5c48..dd4cc679 100644 --- a/data/minecraft/recipe/deepslate_brick_slab_from_cobbled_deepslate_stonecutting.json +++ b/data/minecraft/recipe/deepslate_brick_slab_from_cobbled_deepslate_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:cobbled_deepslate" - }, + "ingredient": "minecraft:cobbled_deepslate", "result": { "count": 2, "id": "minecraft:deepslate_brick_slab" diff --git a/data/minecraft/recipe/deepslate_brick_slab_from_deepslate_bricks_stonecutting.json b/data/minecraft/recipe/deepslate_brick_slab_from_deepslate_bricks_stonecutting.json index 1caf1779..d7a925c6 100644 --- a/data/minecraft/recipe/deepslate_brick_slab_from_deepslate_bricks_stonecutting.json +++ b/data/minecraft/recipe/deepslate_brick_slab_from_deepslate_bricks_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:deepslate_bricks" - }, + "ingredient": "minecraft:deepslate_bricks", "result": { "count": 2, "id": "minecraft:deepslate_brick_slab" diff --git a/data/minecraft/recipe/deepslate_brick_slab_from_polished_deepslate_stonecutting.json b/data/minecraft/recipe/deepslate_brick_slab_from_polished_deepslate_stonecutting.json index 7f4e1084..96c33381 100644 --- a/data/minecraft/recipe/deepslate_brick_slab_from_polished_deepslate_stonecutting.json +++ b/data/minecraft/recipe/deepslate_brick_slab_from_polished_deepslate_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:polished_deepslate" - }, + "ingredient": "minecraft:polished_deepslate", "result": { "count": 2, "id": "minecraft:deepslate_brick_slab" diff --git a/data/minecraft/recipe/deepslate_brick_stairs.json b/data/minecraft/recipe/deepslate_brick_stairs.json index 4d754db7..65ee52e5 100644 --- a/data/minecraft/recipe/deepslate_brick_stairs.json +++ b/data/minecraft/recipe/deepslate_brick_stairs.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:deepslate_bricks" - } + "#": "minecraft:deepslate_bricks" }, "pattern": [ "# ", diff --git a/data/minecraft/recipe/deepslate_brick_stairs_from_cobbled_deepslate_stonecutting.json b/data/minecraft/recipe/deepslate_brick_stairs_from_cobbled_deepslate_stonecutting.json index 37b2a4f3..9c72f613 100644 --- a/data/minecraft/recipe/deepslate_brick_stairs_from_cobbled_deepslate_stonecutting.json +++ b/data/minecraft/recipe/deepslate_brick_stairs_from_cobbled_deepslate_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:cobbled_deepslate" - }, + "ingredient": "minecraft:cobbled_deepslate", "result": { "count": 1, "id": "minecraft:deepslate_brick_stairs" diff --git a/data/minecraft/recipe/deepslate_brick_stairs_from_deepslate_bricks_stonecutting.json b/data/minecraft/recipe/deepslate_brick_stairs_from_deepslate_bricks_stonecutting.json index 3cdd3fc3..6ba9870a 100644 --- a/data/minecraft/recipe/deepslate_brick_stairs_from_deepslate_bricks_stonecutting.json +++ b/data/minecraft/recipe/deepslate_brick_stairs_from_deepslate_bricks_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:deepslate_bricks" - }, + "ingredient": "minecraft:deepslate_bricks", "result": { "count": 1, "id": "minecraft:deepslate_brick_stairs" diff --git a/data/minecraft/recipe/deepslate_brick_stairs_from_polished_deepslate_stonecutting.json b/data/minecraft/recipe/deepslate_brick_stairs_from_polished_deepslate_stonecutting.json index e6bb4fec..b374fd39 100644 --- a/data/minecraft/recipe/deepslate_brick_stairs_from_polished_deepslate_stonecutting.json +++ b/data/minecraft/recipe/deepslate_brick_stairs_from_polished_deepslate_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:polished_deepslate" - }, + "ingredient": "minecraft:polished_deepslate", "result": { "count": 1, "id": "minecraft:deepslate_brick_stairs" diff --git a/data/minecraft/recipe/deepslate_brick_wall.json b/data/minecraft/recipe/deepslate_brick_wall.json index e25662ab..9c831eb2 100644 --- a/data/minecraft/recipe/deepslate_brick_wall.json +++ b/data/minecraft/recipe/deepslate_brick_wall.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "#": { - "item": "minecraft:deepslate_bricks" - } + "#": "minecraft:deepslate_bricks" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/deepslate_brick_wall_from_cobbled_deepslate_stonecutting.json b/data/minecraft/recipe/deepslate_brick_wall_from_cobbled_deepslate_stonecutting.json index 8338cda6..6a022688 100644 --- a/data/minecraft/recipe/deepslate_brick_wall_from_cobbled_deepslate_stonecutting.json +++ b/data/minecraft/recipe/deepslate_brick_wall_from_cobbled_deepslate_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:cobbled_deepslate" - }, + "ingredient": "minecraft:cobbled_deepslate", "result": { "count": 1, "id": "minecraft:deepslate_brick_wall" diff --git a/data/minecraft/recipe/deepslate_brick_wall_from_deepslate_bricks_stonecutting.json b/data/minecraft/recipe/deepslate_brick_wall_from_deepslate_bricks_stonecutting.json index a3612513..a90f27e2 100644 --- a/data/minecraft/recipe/deepslate_brick_wall_from_deepslate_bricks_stonecutting.json +++ b/data/minecraft/recipe/deepslate_brick_wall_from_deepslate_bricks_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:deepslate_bricks" - }, + "ingredient": "minecraft:deepslate_bricks", "result": { "count": 1, "id": "minecraft:deepslate_brick_wall" diff --git a/data/minecraft/recipe/deepslate_brick_wall_from_polished_deepslate_stonecutting.json b/data/minecraft/recipe/deepslate_brick_wall_from_polished_deepslate_stonecutting.json index fa56f5b2..ee29595c 100644 --- a/data/minecraft/recipe/deepslate_brick_wall_from_polished_deepslate_stonecutting.json +++ b/data/minecraft/recipe/deepslate_brick_wall_from_polished_deepslate_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:polished_deepslate" - }, + "ingredient": "minecraft:polished_deepslate", "result": { "count": 1, "id": "minecraft:deepslate_brick_wall" diff --git a/data/minecraft/recipe/deepslate_bricks.json b/data/minecraft/recipe/deepslate_bricks.json index b8a740a9..81febd31 100644 --- a/data/minecraft/recipe/deepslate_bricks.json +++ b/data/minecraft/recipe/deepslate_bricks.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "S": { - "item": "minecraft:polished_deepslate" - } + "S": "minecraft:polished_deepslate" }, "pattern": [ "SS", diff --git a/data/minecraft/recipe/deepslate_bricks_from_cobbled_deepslate_stonecutting.json b/data/minecraft/recipe/deepslate_bricks_from_cobbled_deepslate_stonecutting.json index e1617105..8b2546b9 100644 --- a/data/minecraft/recipe/deepslate_bricks_from_cobbled_deepslate_stonecutting.json +++ b/data/minecraft/recipe/deepslate_bricks_from_cobbled_deepslate_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:cobbled_deepslate" - }, + "ingredient": "minecraft:cobbled_deepslate", "result": { "count": 1, "id": "minecraft:deepslate_bricks" diff --git a/data/minecraft/recipe/deepslate_bricks_from_polished_deepslate_stonecutting.json b/data/minecraft/recipe/deepslate_bricks_from_polished_deepslate_stonecutting.json index 3eb3227e..9844bcd0 100644 --- a/data/minecraft/recipe/deepslate_bricks_from_polished_deepslate_stonecutting.json +++ b/data/minecraft/recipe/deepslate_bricks_from_polished_deepslate_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:polished_deepslate" - }, + "ingredient": "minecraft:polished_deepslate", "result": { "count": 1, "id": "minecraft:deepslate_bricks" diff --git a/data/minecraft/recipe/deepslate_tile_slab.json b/data/minecraft/recipe/deepslate_tile_slab.json index a36e736c..a2871d1d 100644 --- a/data/minecraft/recipe/deepslate_tile_slab.json +++ b/data/minecraft/recipe/deepslate_tile_slab.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:deepslate_tiles" - } + "#": "minecraft:deepslate_tiles" }, "pattern": [ "###" diff --git a/data/minecraft/recipe/deepslate_tile_slab_from_cobbled_deepslate_stonecutting.json b/data/minecraft/recipe/deepslate_tile_slab_from_cobbled_deepslate_stonecutting.json index 1abdd396..0974f9cc 100644 --- a/data/minecraft/recipe/deepslate_tile_slab_from_cobbled_deepslate_stonecutting.json +++ b/data/minecraft/recipe/deepslate_tile_slab_from_cobbled_deepslate_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:cobbled_deepslate" - }, + "ingredient": "minecraft:cobbled_deepslate", "result": { "count": 2, "id": "minecraft:deepslate_tile_slab" diff --git a/data/minecraft/recipe/deepslate_tile_slab_from_deepslate_bricks_stonecutting.json b/data/minecraft/recipe/deepslate_tile_slab_from_deepslate_bricks_stonecutting.json index bea1e154..793e3644 100644 --- a/data/minecraft/recipe/deepslate_tile_slab_from_deepslate_bricks_stonecutting.json +++ b/data/minecraft/recipe/deepslate_tile_slab_from_deepslate_bricks_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:deepslate_bricks" - }, + "ingredient": "minecraft:deepslate_bricks", "result": { "count": 2, "id": "minecraft:deepslate_tile_slab" diff --git a/data/minecraft/recipe/deepslate_tile_slab_from_deepslate_tiles_stonecutting.json b/data/minecraft/recipe/deepslate_tile_slab_from_deepslate_tiles_stonecutting.json index c4b17608..6b8a69c6 100644 --- a/data/minecraft/recipe/deepslate_tile_slab_from_deepslate_tiles_stonecutting.json +++ b/data/minecraft/recipe/deepslate_tile_slab_from_deepslate_tiles_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:deepslate_tiles" - }, + "ingredient": "minecraft:deepslate_tiles", "result": { "count": 2, "id": "minecraft:deepslate_tile_slab" diff --git a/data/minecraft/recipe/deepslate_tile_slab_from_polished_deepslate_stonecutting.json b/data/minecraft/recipe/deepslate_tile_slab_from_polished_deepslate_stonecutting.json index 4538cedc..ba8a074e 100644 --- a/data/minecraft/recipe/deepslate_tile_slab_from_polished_deepslate_stonecutting.json +++ b/data/minecraft/recipe/deepslate_tile_slab_from_polished_deepslate_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:polished_deepslate" - }, + "ingredient": "minecraft:polished_deepslate", "result": { "count": 2, "id": "minecraft:deepslate_tile_slab" diff --git a/data/minecraft/recipe/deepslate_tile_stairs.json b/data/minecraft/recipe/deepslate_tile_stairs.json index e5736ce8..7a463c80 100644 --- a/data/minecraft/recipe/deepslate_tile_stairs.json +++ b/data/minecraft/recipe/deepslate_tile_stairs.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:deepslate_tiles" - } + "#": "minecraft:deepslate_tiles" }, "pattern": [ "# ", diff --git a/data/minecraft/recipe/deepslate_tile_stairs_from_cobbled_deepslate_stonecutting.json b/data/minecraft/recipe/deepslate_tile_stairs_from_cobbled_deepslate_stonecutting.json index 16728940..565fb18d 100644 --- a/data/minecraft/recipe/deepslate_tile_stairs_from_cobbled_deepslate_stonecutting.json +++ b/data/minecraft/recipe/deepslate_tile_stairs_from_cobbled_deepslate_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:cobbled_deepslate" - }, + "ingredient": "minecraft:cobbled_deepslate", "result": { "count": 1, "id": "minecraft:deepslate_tile_stairs" diff --git a/data/minecraft/recipe/deepslate_tile_stairs_from_deepslate_bricks_stonecutting.json b/data/minecraft/recipe/deepslate_tile_stairs_from_deepslate_bricks_stonecutting.json index ca5dc60b..89ba3089 100644 --- a/data/minecraft/recipe/deepslate_tile_stairs_from_deepslate_bricks_stonecutting.json +++ b/data/minecraft/recipe/deepslate_tile_stairs_from_deepslate_bricks_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:deepslate_bricks" - }, + "ingredient": "minecraft:deepslate_bricks", "result": { "count": 1, "id": "minecraft:deepslate_tile_stairs" diff --git a/data/minecraft/recipe/deepslate_tile_stairs_from_deepslate_tiles_stonecutting.json b/data/minecraft/recipe/deepslate_tile_stairs_from_deepslate_tiles_stonecutting.json index 90d0e25d..5e47b1bc 100644 --- a/data/minecraft/recipe/deepslate_tile_stairs_from_deepslate_tiles_stonecutting.json +++ b/data/minecraft/recipe/deepslate_tile_stairs_from_deepslate_tiles_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:deepslate_tiles" - }, + "ingredient": "minecraft:deepslate_tiles", "result": { "count": 1, "id": "minecraft:deepslate_tile_stairs" diff --git a/data/minecraft/recipe/deepslate_tile_stairs_from_polished_deepslate_stonecutting.json b/data/minecraft/recipe/deepslate_tile_stairs_from_polished_deepslate_stonecutting.json index 46dfdb11..0c0e0045 100644 --- a/data/minecraft/recipe/deepslate_tile_stairs_from_polished_deepslate_stonecutting.json +++ b/data/minecraft/recipe/deepslate_tile_stairs_from_polished_deepslate_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:polished_deepslate" - }, + "ingredient": "minecraft:polished_deepslate", "result": { "count": 1, "id": "minecraft:deepslate_tile_stairs" diff --git a/data/minecraft/recipe/deepslate_tile_wall.json b/data/minecraft/recipe/deepslate_tile_wall.json index c90b3373..3e7f0141 100644 --- a/data/minecraft/recipe/deepslate_tile_wall.json +++ b/data/minecraft/recipe/deepslate_tile_wall.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "#": { - "item": "minecraft:deepslate_tiles" - } + "#": "minecraft:deepslate_tiles" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/deepslate_tile_wall_from_cobbled_deepslate_stonecutting.json b/data/minecraft/recipe/deepslate_tile_wall_from_cobbled_deepslate_stonecutting.json index d74d7975..1efbe082 100644 --- a/data/minecraft/recipe/deepslate_tile_wall_from_cobbled_deepslate_stonecutting.json +++ b/data/minecraft/recipe/deepslate_tile_wall_from_cobbled_deepslate_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:cobbled_deepslate" - }, + "ingredient": "minecraft:cobbled_deepslate", "result": { "count": 1, "id": "minecraft:deepslate_tile_wall" diff --git a/data/minecraft/recipe/deepslate_tile_wall_from_deepslate_bricks_stonecutting.json b/data/minecraft/recipe/deepslate_tile_wall_from_deepslate_bricks_stonecutting.json index 11a6a1ed..4abd21a4 100644 --- a/data/minecraft/recipe/deepslate_tile_wall_from_deepslate_bricks_stonecutting.json +++ b/data/minecraft/recipe/deepslate_tile_wall_from_deepslate_bricks_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:deepslate_bricks" - }, + "ingredient": "minecraft:deepslate_bricks", "result": { "count": 1, "id": "minecraft:deepslate_tile_wall" diff --git a/data/minecraft/recipe/deepslate_tile_wall_from_deepslate_tiles_stonecutting.json b/data/minecraft/recipe/deepslate_tile_wall_from_deepslate_tiles_stonecutting.json index c1f05b8f..099d4d7b 100644 --- a/data/minecraft/recipe/deepslate_tile_wall_from_deepslate_tiles_stonecutting.json +++ b/data/minecraft/recipe/deepslate_tile_wall_from_deepslate_tiles_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:deepslate_tiles" - }, + "ingredient": "minecraft:deepslate_tiles", "result": { "count": 1, "id": "minecraft:deepslate_tile_wall" diff --git a/data/minecraft/recipe/deepslate_tile_wall_from_polished_deepslate_stonecutting.json b/data/minecraft/recipe/deepslate_tile_wall_from_polished_deepslate_stonecutting.json index c3417c24..aed410f3 100644 --- a/data/minecraft/recipe/deepslate_tile_wall_from_polished_deepslate_stonecutting.json +++ b/data/minecraft/recipe/deepslate_tile_wall_from_polished_deepslate_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:polished_deepslate" - }, + "ingredient": "minecraft:polished_deepslate", "result": { "count": 1, "id": "minecraft:deepslate_tile_wall" diff --git a/data/minecraft/recipe/deepslate_tiles.json b/data/minecraft/recipe/deepslate_tiles.json index 28ad02d6..2ca6a000 100644 --- a/data/minecraft/recipe/deepslate_tiles.json +++ b/data/minecraft/recipe/deepslate_tiles.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "S": { - "item": "minecraft:deepslate_bricks" - } + "S": "minecraft:deepslate_bricks" }, "pattern": [ "SS", diff --git a/data/minecraft/recipe/deepslate_tiles_from_cobbled_deepslate_stonecutting.json b/data/minecraft/recipe/deepslate_tiles_from_cobbled_deepslate_stonecutting.json index e4be93e3..def50ec6 100644 --- a/data/minecraft/recipe/deepslate_tiles_from_cobbled_deepslate_stonecutting.json +++ b/data/minecraft/recipe/deepslate_tiles_from_cobbled_deepslate_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:cobbled_deepslate" - }, + "ingredient": "minecraft:cobbled_deepslate", "result": { "count": 1, "id": "minecraft:deepslate_tiles" diff --git a/data/minecraft/recipe/deepslate_tiles_from_deepslate_bricks_stonecutting.json b/data/minecraft/recipe/deepslate_tiles_from_deepslate_bricks_stonecutting.json index 06b12e68..683487f3 100644 --- a/data/minecraft/recipe/deepslate_tiles_from_deepslate_bricks_stonecutting.json +++ b/data/minecraft/recipe/deepslate_tiles_from_deepslate_bricks_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:deepslate_bricks" - }, + "ingredient": "minecraft:deepslate_bricks", "result": { "count": 1, "id": "minecraft:deepslate_tiles" diff --git a/data/minecraft/recipe/deepslate_tiles_from_polished_deepslate_stonecutting.json b/data/minecraft/recipe/deepslate_tiles_from_polished_deepslate_stonecutting.json index 1fc86bda..83fba88e 100644 --- a/data/minecraft/recipe/deepslate_tiles_from_polished_deepslate_stonecutting.json +++ b/data/minecraft/recipe/deepslate_tiles_from_polished_deepslate_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:polished_deepslate" - }, + "ingredient": "minecraft:polished_deepslate", "result": { "count": 1, "id": "minecraft:deepslate_tiles" diff --git a/data/minecraft/recipe/detector_rail.json b/data/minecraft/recipe/detector_rail.json index c4960407..26939514 100644 --- a/data/minecraft/recipe/detector_rail.json +++ b/data/minecraft/recipe/detector_rail.json @@ -2,15 +2,9 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "#": { - "item": "minecraft:stone_pressure_plate" - }, - "R": { - "item": "minecraft:redstone" - }, - "X": { - "item": "minecraft:iron_ingot" - } + "#": "minecraft:stone_pressure_plate", + "R": "minecraft:redstone", + "X": "minecraft:iron_ingot" }, "pattern": [ "X X", diff --git a/data/minecraft/recipe/diamond.json b/data/minecraft/recipe/diamond.json index 4745369f..9b201576 100644 --- a/data/minecraft/recipe/diamond.json +++ b/data/minecraft/recipe/diamond.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shapeless", "category": "misc", "ingredients": [ - { - "item": "minecraft:diamond_block" - } + "minecraft:diamond_block" ], "result": { "count": 9, diff --git a/data/minecraft/recipe/diamond_axe.json b/data/minecraft/recipe/diamond_axe.json index 650b85a9..40d1d4c6 100644 --- a/data/minecraft/recipe/diamond_axe.json +++ b/data/minecraft/recipe/diamond_axe.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shaped", "category": "equipment", "key": { - "#": { - "item": "minecraft:stick" - }, - "X": { - "item": "minecraft:diamond" - } + "#": "minecraft:stick", + "X": "#minecraft:diamond_tool_materials" }, "pattern": [ "XX", diff --git a/data/minecraft/recipe/diamond_block.json b/data/minecraft/recipe/diamond_block.json index a38ac05e..9f06de47 100644 --- a/data/minecraft/recipe/diamond_block.json +++ b/data/minecraft/recipe/diamond_block.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:diamond" - } + "#": "minecraft:diamond" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/diamond_boots.json b/data/minecraft/recipe/diamond_boots.json index 40735b4e..7b39b426 100644 --- a/data/minecraft/recipe/diamond_boots.json +++ b/data/minecraft/recipe/diamond_boots.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "equipment", "key": { - "X": { - "item": "minecraft:diamond" - } + "X": "minecraft:diamond" }, "pattern": [ "X X", diff --git a/data/minecraft/recipe/diamond_chestplate.json b/data/minecraft/recipe/diamond_chestplate.json index bfa03809..4abbba38 100644 --- a/data/minecraft/recipe/diamond_chestplate.json +++ b/data/minecraft/recipe/diamond_chestplate.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "equipment", "key": { - "X": { - "item": "minecraft:diamond" - } + "X": "minecraft:diamond" }, "pattern": [ "X X", diff --git a/data/minecraft/recipe/diamond_from_blasting_deepslate_diamond_ore.json b/data/minecraft/recipe/diamond_from_blasting_deepslate_diamond_ore.json index 09b7131e..d5a288a5 100644 --- a/data/minecraft/recipe/diamond_from_blasting_deepslate_diamond_ore.json +++ b/data/minecraft/recipe/diamond_from_blasting_deepslate_diamond_ore.json @@ -4,9 +4,7 @@ "cookingtime": 100, "experience": 1.0, "group": "diamond", - "ingredient": { - "item": "minecraft:deepslate_diamond_ore" - }, + "ingredient": "minecraft:deepslate_diamond_ore", "result": { "id": "minecraft:diamond" } diff --git a/data/minecraft/recipe/diamond_from_blasting_diamond_ore.json b/data/minecraft/recipe/diamond_from_blasting_diamond_ore.json index d53fd595..b773b202 100644 --- a/data/minecraft/recipe/diamond_from_blasting_diamond_ore.json +++ b/data/minecraft/recipe/diamond_from_blasting_diamond_ore.json @@ -4,9 +4,7 @@ "cookingtime": 100, "experience": 1.0, "group": "diamond", - "ingredient": { - "item": "minecraft:diamond_ore" - }, + "ingredient": "minecraft:diamond_ore", "result": { "id": "minecraft:diamond" } diff --git a/data/minecraft/recipe/diamond_from_smelting_deepslate_diamond_ore.json b/data/minecraft/recipe/diamond_from_smelting_deepslate_diamond_ore.json index 6aa47d2c..5ed0fdbf 100644 --- a/data/minecraft/recipe/diamond_from_smelting_deepslate_diamond_ore.json +++ b/data/minecraft/recipe/diamond_from_smelting_deepslate_diamond_ore.json @@ -4,9 +4,7 @@ "cookingtime": 200, "experience": 1.0, "group": "diamond", - "ingredient": { - "item": "minecraft:deepslate_diamond_ore" - }, + "ingredient": "minecraft:deepslate_diamond_ore", "result": { "id": "minecraft:diamond" } diff --git a/data/minecraft/recipe/diamond_from_smelting_diamond_ore.json b/data/minecraft/recipe/diamond_from_smelting_diamond_ore.json index 900b972c..85a13522 100644 --- a/data/minecraft/recipe/diamond_from_smelting_diamond_ore.json +++ b/data/minecraft/recipe/diamond_from_smelting_diamond_ore.json @@ -4,9 +4,7 @@ "cookingtime": 200, "experience": 1.0, "group": "diamond", - "ingredient": { - "item": "minecraft:diamond_ore" - }, + "ingredient": "minecraft:diamond_ore", "result": { "id": "minecraft:diamond" } diff --git a/data/minecraft/recipe/diamond_helmet.json b/data/minecraft/recipe/diamond_helmet.json index 76442c8d..883e7d81 100644 --- a/data/minecraft/recipe/diamond_helmet.json +++ b/data/minecraft/recipe/diamond_helmet.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "equipment", "key": { - "X": { - "item": "minecraft:diamond" - } + "X": "minecraft:diamond" }, "pattern": [ "XXX", diff --git a/data/minecraft/recipe/diamond_hoe.json b/data/minecraft/recipe/diamond_hoe.json index a62f0234..c41ef863 100644 --- a/data/minecraft/recipe/diamond_hoe.json +++ b/data/minecraft/recipe/diamond_hoe.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shaped", "category": "equipment", "key": { - "#": { - "item": "minecraft:stick" - }, - "X": { - "item": "minecraft:diamond" - } + "#": "minecraft:stick", + "X": "#minecraft:diamond_tool_materials" }, "pattern": [ "XX", diff --git a/data/minecraft/recipe/diamond_leggings.json b/data/minecraft/recipe/diamond_leggings.json index 4e2470a0..999f9cf9 100644 --- a/data/minecraft/recipe/diamond_leggings.json +++ b/data/minecraft/recipe/diamond_leggings.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "equipment", "key": { - "X": { - "item": "minecraft:diamond" - } + "X": "minecraft:diamond" }, "pattern": [ "XXX", diff --git a/data/minecraft/recipe/diamond_pickaxe.json b/data/minecraft/recipe/diamond_pickaxe.json index 2ea55f5b..c5b75b0c 100644 --- a/data/minecraft/recipe/diamond_pickaxe.json +++ b/data/minecraft/recipe/diamond_pickaxe.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shaped", "category": "equipment", "key": { - "#": { - "item": "minecraft:stick" - }, - "X": { - "item": "minecraft:diamond" - } + "#": "minecraft:stick", + "X": "#minecraft:diamond_tool_materials" }, "pattern": [ "XXX", diff --git a/data/minecraft/recipe/diamond_shovel.json b/data/minecraft/recipe/diamond_shovel.json index 37d7aa26..adff07f8 100644 --- a/data/minecraft/recipe/diamond_shovel.json +++ b/data/minecraft/recipe/diamond_shovel.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shaped", "category": "equipment", "key": { - "#": { - "item": "minecraft:stick" - }, - "X": { - "item": "minecraft:diamond" - } + "#": "minecraft:stick", + "X": "#minecraft:diamond_tool_materials" }, "pattern": [ "X", diff --git a/data/minecraft/recipe/diamond_sword.json b/data/minecraft/recipe/diamond_sword.json index 606a3414..5037c322 100644 --- a/data/minecraft/recipe/diamond_sword.json +++ b/data/minecraft/recipe/diamond_sword.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shaped", "category": "equipment", "key": { - "#": { - "item": "minecraft:stick" - }, - "X": { - "item": "minecraft:diamond" - } + "#": "minecraft:stick", + "X": "#minecraft:diamond_tool_materials" }, "pattern": [ "X", diff --git a/data/minecraft/recipe/diorite.json b/data/minecraft/recipe/diorite.json index 97289513..104eb5b4 100644 --- a/data/minecraft/recipe/diorite.json +++ b/data/minecraft/recipe/diorite.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "C": { - "item": "minecraft:cobblestone" - }, - "Q": { - "item": "minecraft:quartz" - } + "C": "minecraft:cobblestone", + "Q": "minecraft:quartz" }, "pattern": [ "CQ", diff --git a/data/minecraft/recipe/diorite_slab.json b/data/minecraft/recipe/diorite_slab.json index 2544657f..b54061da 100644 --- a/data/minecraft/recipe/diorite_slab.json +++ b/data/minecraft/recipe/diorite_slab.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:diorite" - } + "#": "minecraft:diorite" }, "pattern": [ "###" diff --git a/data/minecraft/recipe/diorite_slab_from_diorite_stonecutting.json b/data/minecraft/recipe/diorite_slab_from_diorite_stonecutting.json index 73d3e035..f1c9e846 100644 --- a/data/minecraft/recipe/diorite_slab_from_diorite_stonecutting.json +++ b/data/minecraft/recipe/diorite_slab_from_diorite_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:diorite" - }, + "ingredient": "minecraft:diorite", "result": { "count": 2, "id": "minecraft:diorite_slab" diff --git a/data/minecraft/recipe/diorite_stairs.json b/data/minecraft/recipe/diorite_stairs.json index e55ed1d8..6c64c2bb 100644 --- a/data/minecraft/recipe/diorite_stairs.json +++ b/data/minecraft/recipe/diorite_stairs.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:diorite" - } + "#": "minecraft:diorite" }, "pattern": [ "# ", diff --git a/data/minecraft/recipe/diorite_stairs_from_diorite_stonecutting.json b/data/minecraft/recipe/diorite_stairs_from_diorite_stonecutting.json index d9e034d3..b6ec2b0c 100644 --- a/data/minecraft/recipe/diorite_stairs_from_diorite_stonecutting.json +++ b/data/minecraft/recipe/diorite_stairs_from_diorite_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:diorite" - }, + "ingredient": "minecraft:diorite", "result": { "count": 1, "id": "minecraft:diorite_stairs" diff --git a/data/minecraft/recipe/diorite_wall.json b/data/minecraft/recipe/diorite_wall.json index 17d8f059..f72e3d0f 100644 --- a/data/minecraft/recipe/diorite_wall.json +++ b/data/minecraft/recipe/diorite_wall.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "#": { - "item": "minecraft:diorite" - } + "#": "minecraft:diorite" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/diorite_wall_from_diorite_stonecutting.json b/data/minecraft/recipe/diorite_wall_from_diorite_stonecutting.json index c6a3b258..36d77a18 100644 --- a/data/minecraft/recipe/diorite_wall_from_diorite_stonecutting.json +++ b/data/minecraft/recipe/diorite_wall_from_diorite_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:diorite" - }, + "ingredient": "minecraft:diorite", "result": { "count": 1, "id": "minecraft:diorite_wall" diff --git a/data/minecraft/recipe/dispenser.json b/data/minecraft/recipe/dispenser.json index a3e70a59..362449d0 100644 --- a/data/minecraft/recipe/dispenser.json +++ b/data/minecraft/recipe/dispenser.json @@ -2,15 +2,9 @@ "type": "minecraft:crafting_shaped", "category": "redstone", "key": { - "#": { - "item": "minecraft:cobblestone" - }, - "R": { - "item": "minecraft:redstone" - }, - "X": { - "item": "minecraft:bow" - } + "#": "minecraft:cobblestone", + "R": "minecraft:redstone", + "X": "minecraft:bow" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/dried_kelp.json b/data/minecraft/recipe/dried_kelp.json index ebd3e092..a963fbca 100644 --- a/data/minecraft/recipe/dried_kelp.json +++ b/data/minecraft/recipe/dried_kelp.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shapeless", "category": "misc", "ingredients": [ - { - "item": "minecraft:dried_kelp_block" - } + "minecraft:dried_kelp_block" ], "result": { "count": 9, diff --git a/data/minecraft/recipe/dried_kelp_block.json b/data/minecraft/recipe/dried_kelp_block.json index 494426b6..f4ed6284 100644 --- a/data/minecraft/recipe/dried_kelp_block.json +++ b/data/minecraft/recipe/dried_kelp_block.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:dried_kelp" - } + "#": "minecraft:dried_kelp" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/dried_kelp_from_campfire_cooking.json b/data/minecraft/recipe/dried_kelp_from_campfire_cooking.json index 40d46706..59eb4cb2 100644 --- a/data/minecraft/recipe/dried_kelp_from_campfire_cooking.json +++ b/data/minecraft/recipe/dried_kelp_from_campfire_cooking.json @@ -3,9 +3,7 @@ "category": "food", "cookingtime": 600, "experience": 0.1, - "ingredient": { - "item": "minecraft:kelp" - }, + "ingredient": "minecraft:kelp", "result": { "id": "minecraft:dried_kelp" } diff --git a/data/minecraft/recipe/dried_kelp_from_smelting.json b/data/minecraft/recipe/dried_kelp_from_smelting.json index 3f16c032..ad555409 100644 --- a/data/minecraft/recipe/dried_kelp_from_smelting.json +++ b/data/minecraft/recipe/dried_kelp_from_smelting.json @@ -3,9 +3,7 @@ "category": "food", "cookingtime": 200, "experience": 0.1, - "ingredient": { - "item": "minecraft:kelp" - }, + "ingredient": "minecraft:kelp", "result": { "id": "minecraft:dried_kelp" } diff --git a/data/minecraft/recipe/dried_kelp_from_smoking.json b/data/minecraft/recipe/dried_kelp_from_smoking.json index 3fa6fda8..4b3e1d72 100644 --- a/data/minecraft/recipe/dried_kelp_from_smoking.json +++ b/data/minecraft/recipe/dried_kelp_from_smoking.json @@ -3,9 +3,7 @@ "category": "food", "cookingtime": 100, "experience": 0.1, - "ingredient": { - "item": "minecraft:kelp" - }, + "ingredient": "minecraft:kelp", "result": { "id": "minecraft:dried_kelp" } diff --git a/data/minecraft/recipe/dripstone_block.json b/data/minecraft/recipe/dripstone_block.json index a1535327..bd083995 100644 --- a/data/minecraft/recipe/dripstone_block.json +++ b/data/minecraft/recipe/dripstone_block.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:pointed_dripstone" - } + "#": "minecraft:pointed_dripstone" }, "pattern": [ "##", diff --git a/data/minecraft/recipe/dropper.json b/data/minecraft/recipe/dropper.json index e32548ac..77078a80 100644 --- a/data/minecraft/recipe/dropper.json +++ b/data/minecraft/recipe/dropper.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shaped", "category": "redstone", "key": { - "#": { - "item": "minecraft:cobblestone" - }, - "R": { - "item": "minecraft:redstone" - } + "#": "minecraft:cobblestone", + "R": "minecraft:redstone" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/dune_armor_trim_smithing_template.json b/data/minecraft/recipe/dune_armor_trim_smithing_template.json index 05b01cb8..85d29c02 100644 --- a/data/minecraft/recipe/dune_armor_trim_smithing_template.json +++ b/data/minecraft/recipe/dune_armor_trim_smithing_template.json @@ -2,15 +2,9 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "#": { - "item": "minecraft:diamond" - }, - "C": { - "item": "minecraft:sandstone" - }, - "S": { - "item": "minecraft:dune_armor_trim_smithing_template" - } + "#": "minecraft:diamond", + "C": "minecraft:sandstone", + "S": "minecraft:dune_armor_trim_smithing_template" }, "pattern": [ "#S#", diff --git a/data/minecraft/recipe/dune_armor_trim_smithing_template_smithing_trim.json b/data/minecraft/recipe/dune_armor_trim_smithing_template_smithing_trim.json index 0e73e441..264a25f8 100644 --- a/data/minecraft/recipe/dune_armor_trim_smithing_template_smithing_trim.json +++ b/data/minecraft/recipe/dune_armor_trim_smithing_template_smithing_trim.json @@ -1,12 +1,6 @@ { "type": "minecraft:smithing_trim", - "addition": { - "tag": "minecraft:trim_materials" - }, - "base": { - "tag": "minecraft:trimmable_armor" - }, - "template": { - "item": "minecraft:dune_armor_trim_smithing_template" - } + "addition": "#minecraft:trim_materials", + "base": "#minecraft:trimmable_armor", + "template": "minecraft:dune_armor_trim_smithing_template" } \ No newline at end of file diff --git a/data/minecraft/recipe/dye_black_bed.json b/data/minecraft/recipe/dye_black_bed.json index e2fa9dc4..316585c3 100644 --- a/data/minecraft/recipe/dye_black_bed.json +++ b/data/minecraft/recipe/dye_black_bed.json @@ -3,55 +3,23 @@ "category": "building", "group": "bed", "ingredients": [ - { - "item": "minecraft:black_dye" - }, + "minecraft:black_dye", [ - { - "item": "minecraft:blue_bed" - }, - { - "item": "minecraft:brown_bed" - }, - { - "item": "minecraft:cyan_bed" - }, - { - "item": "minecraft:gray_bed" - }, - { - "item": "minecraft:green_bed" - }, - { - "item": "minecraft:light_blue_bed" - }, - { - "item": "minecraft:light_gray_bed" - }, - { - "item": "minecraft:lime_bed" - }, - { - "item": "minecraft:magenta_bed" - }, - { - "item": "minecraft:orange_bed" - }, - { - "item": "minecraft:pink_bed" - }, - { - "item": "minecraft:purple_bed" - }, - { - "item": "minecraft:red_bed" - }, - { - "item": "minecraft:yellow_bed" - }, - { - "item": "minecraft:white_bed" - } + "minecraft:blue_bed", + "minecraft:brown_bed", + "minecraft:cyan_bed", + "minecraft:gray_bed", + "minecraft:green_bed", + "minecraft:light_blue_bed", + "minecraft:light_gray_bed", + "minecraft:lime_bed", + "minecraft:magenta_bed", + "minecraft:orange_bed", + "minecraft:pink_bed", + "minecraft:purple_bed", + "minecraft:red_bed", + "minecraft:yellow_bed", + "minecraft:white_bed" ] ], "result": { diff --git a/data/minecraft/recipe/dye_black_carpet.json b/data/minecraft/recipe/dye_black_carpet.json index a3516cd6..42a2f2e3 100644 --- a/data/minecraft/recipe/dye_black_carpet.json +++ b/data/minecraft/recipe/dye_black_carpet.json @@ -3,55 +3,23 @@ "category": "building", "group": "carpet", "ingredients": [ - { - "item": "minecraft:black_dye" - }, + "minecraft:black_dye", [ - { - "item": "minecraft:blue_carpet" - }, - { - "item": "minecraft:brown_carpet" - }, - { - "item": "minecraft:cyan_carpet" - }, - { - "item": "minecraft:gray_carpet" - }, - { - "item": "minecraft:green_carpet" - }, - { - "item": "minecraft:light_blue_carpet" - }, - { - "item": "minecraft:light_gray_carpet" - }, - { - "item": "minecraft:lime_carpet" - }, - { - "item": "minecraft:magenta_carpet" - }, - { - "item": "minecraft:orange_carpet" - }, - { - "item": "minecraft:pink_carpet" - }, - { - "item": "minecraft:purple_carpet" - }, - { - "item": "minecraft:red_carpet" - }, - { - "item": "minecraft:yellow_carpet" - }, - { - "item": "minecraft:white_carpet" - } + "minecraft:blue_carpet", + "minecraft:brown_carpet", + "minecraft:cyan_carpet", + "minecraft:gray_carpet", + "minecraft:green_carpet", + "minecraft:light_blue_carpet", + "minecraft:light_gray_carpet", + "minecraft:lime_carpet", + "minecraft:magenta_carpet", + "minecraft:orange_carpet", + "minecraft:pink_carpet", + "minecraft:purple_carpet", + "minecraft:red_carpet", + "minecraft:yellow_carpet", + "minecraft:white_carpet" ] ], "result": { diff --git a/data/minecraft/recipe/dye_black_wool.json b/data/minecraft/recipe/dye_black_wool.json index e1df7fef..a0839182 100644 --- a/data/minecraft/recipe/dye_black_wool.json +++ b/data/minecraft/recipe/dye_black_wool.json @@ -3,55 +3,23 @@ "category": "building", "group": "wool", "ingredients": [ - { - "item": "minecraft:black_dye" - }, + "minecraft:black_dye", [ - { - "item": "minecraft:blue_wool" - }, - { - "item": "minecraft:brown_wool" - }, - { - "item": "minecraft:cyan_wool" - }, - { - "item": "minecraft:gray_wool" - }, - { - "item": "minecraft:green_wool" - }, - { - "item": "minecraft:light_blue_wool" - }, - { - "item": "minecraft:light_gray_wool" - }, - { - "item": "minecraft:lime_wool" - }, - { - "item": "minecraft:magenta_wool" - }, - { - "item": "minecraft:orange_wool" - }, - { - "item": "minecraft:pink_wool" - }, - { - "item": "minecraft:purple_wool" - }, - { - "item": "minecraft:red_wool" - }, - { - "item": "minecraft:yellow_wool" - }, - { - "item": "minecraft:white_wool" - } + "minecraft:blue_wool", + "minecraft:brown_wool", + "minecraft:cyan_wool", + "minecraft:gray_wool", + "minecraft:green_wool", + "minecraft:light_blue_wool", + "minecraft:light_gray_wool", + "minecraft:lime_wool", + "minecraft:magenta_wool", + "minecraft:orange_wool", + "minecraft:pink_wool", + "minecraft:purple_wool", + "minecraft:red_wool", + "minecraft:yellow_wool", + "minecraft:white_wool" ] ], "result": { diff --git a/data/minecraft/recipe/dye_blue_bed.json b/data/minecraft/recipe/dye_blue_bed.json index 98f5941b..5597e51b 100644 --- a/data/minecraft/recipe/dye_blue_bed.json +++ b/data/minecraft/recipe/dye_blue_bed.json @@ -3,55 +3,23 @@ "category": "building", "group": "bed", "ingredients": [ - { - "item": "minecraft:blue_dye" - }, + "minecraft:blue_dye", [ - { - "item": "minecraft:black_bed" - }, - { - "item": "minecraft:brown_bed" - }, - { - "item": "minecraft:cyan_bed" - }, - { - "item": "minecraft:gray_bed" - }, - { - "item": "minecraft:green_bed" - }, - { - "item": "minecraft:light_blue_bed" - }, - { - "item": "minecraft:light_gray_bed" - }, - { - "item": "minecraft:lime_bed" - }, - { - "item": "minecraft:magenta_bed" - }, - { - "item": "minecraft:orange_bed" - }, - { - "item": "minecraft:pink_bed" - }, - { - "item": "minecraft:purple_bed" - }, - { - "item": "minecraft:red_bed" - }, - { - "item": "minecraft:yellow_bed" - }, - { - "item": "minecraft:white_bed" - } + "minecraft:black_bed", + "minecraft:brown_bed", + "minecraft:cyan_bed", + "minecraft:gray_bed", + "minecraft:green_bed", + "minecraft:light_blue_bed", + "minecraft:light_gray_bed", + "minecraft:lime_bed", + "minecraft:magenta_bed", + "minecraft:orange_bed", + "minecraft:pink_bed", + "minecraft:purple_bed", + "minecraft:red_bed", + "minecraft:yellow_bed", + "minecraft:white_bed" ] ], "result": { diff --git a/data/minecraft/recipe/dye_blue_carpet.json b/data/minecraft/recipe/dye_blue_carpet.json index cdb18144..7d3eaa4f 100644 --- a/data/minecraft/recipe/dye_blue_carpet.json +++ b/data/minecraft/recipe/dye_blue_carpet.json @@ -3,55 +3,23 @@ "category": "building", "group": "carpet", "ingredients": [ - { - "item": "minecraft:blue_dye" - }, + "minecraft:blue_dye", [ - { - "item": "minecraft:black_carpet" - }, - { - "item": "minecraft:brown_carpet" - }, - { - "item": "minecraft:cyan_carpet" - }, - { - "item": "minecraft:gray_carpet" - }, - { - "item": "minecraft:green_carpet" - }, - { - "item": "minecraft:light_blue_carpet" - }, - { - "item": "minecraft:light_gray_carpet" - }, - { - "item": "minecraft:lime_carpet" - }, - { - "item": "minecraft:magenta_carpet" - }, - { - "item": "minecraft:orange_carpet" - }, - { - "item": "minecraft:pink_carpet" - }, - { - "item": "minecraft:purple_carpet" - }, - { - "item": "minecraft:red_carpet" - }, - { - "item": "minecraft:yellow_carpet" - }, - { - "item": "minecraft:white_carpet" - } + "minecraft:black_carpet", + "minecraft:brown_carpet", + "minecraft:cyan_carpet", + "minecraft:gray_carpet", + "minecraft:green_carpet", + "minecraft:light_blue_carpet", + "minecraft:light_gray_carpet", + "minecraft:lime_carpet", + "minecraft:magenta_carpet", + "minecraft:orange_carpet", + "minecraft:pink_carpet", + "minecraft:purple_carpet", + "minecraft:red_carpet", + "minecraft:yellow_carpet", + "minecraft:white_carpet" ] ], "result": { diff --git a/data/minecraft/recipe/dye_blue_wool.json b/data/minecraft/recipe/dye_blue_wool.json index fa36484b..1c64d359 100644 --- a/data/minecraft/recipe/dye_blue_wool.json +++ b/data/minecraft/recipe/dye_blue_wool.json @@ -3,55 +3,23 @@ "category": "building", "group": "wool", "ingredients": [ - { - "item": "minecraft:blue_dye" - }, + "minecraft:blue_dye", [ - { - "item": "minecraft:black_wool" - }, - { - "item": "minecraft:brown_wool" - }, - { - "item": "minecraft:cyan_wool" - }, - { - "item": "minecraft:gray_wool" - }, - { - "item": "minecraft:green_wool" - }, - { - "item": "minecraft:light_blue_wool" - }, - { - "item": "minecraft:light_gray_wool" - }, - { - "item": "minecraft:lime_wool" - }, - { - "item": "minecraft:magenta_wool" - }, - { - "item": "minecraft:orange_wool" - }, - { - "item": "minecraft:pink_wool" - }, - { - "item": "minecraft:purple_wool" - }, - { - "item": "minecraft:red_wool" - }, - { - "item": "minecraft:yellow_wool" - }, - { - "item": "minecraft:white_wool" - } + "minecraft:black_wool", + "minecraft:brown_wool", + "minecraft:cyan_wool", + "minecraft:gray_wool", + "minecraft:green_wool", + "minecraft:light_blue_wool", + "minecraft:light_gray_wool", + "minecraft:lime_wool", + "minecraft:magenta_wool", + "minecraft:orange_wool", + "minecraft:pink_wool", + "minecraft:purple_wool", + "minecraft:red_wool", + "minecraft:yellow_wool", + "minecraft:white_wool" ] ], "result": { diff --git a/data/minecraft/recipe/dye_brown_bed.json b/data/minecraft/recipe/dye_brown_bed.json index 1bdb8497..2ded199b 100644 --- a/data/minecraft/recipe/dye_brown_bed.json +++ b/data/minecraft/recipe/dye_brown_bed.json @@ -3,55 +3,23 @@ "category": "building", "group": "bed", "ingredients": [ - { - "item": "minecraft:brown_dye" - }, + "minecraft:brown_dye", [ - { - "item": "minecraft:black_bed" - }, - { - "item": "minecraft:blue_bed" - }, - { - "item": "minecraft:cyan_bed" - }, - { - "item": "minecraft:gray_bed" - }, - { - "item": "minecraft:green_bed" - }, - { - "item": "minecraft:light_blue_bed" - }, - { - "item": "minecraft:light_gray_bed" - }, - { - "item": "minecraft:lime_bed" - }, - { - "item": "minecraft:magenta_bed" - }, - { - "item": "minecraft:orange_bed" - }, - { - "item": "minecraft:pink_bed" - }, - { - "item": "minecraft:purple_bed" - }, - { - "item": "minecraft:red_bed" - }, - { - "item": "minecraft:yellow_bed" - }, - { - "item": "minecraft:white_bed" - } + "minecraft:black_bed", + "minecraft:blue_bed", + "minecraft:cyan_bed", + "minecraft:gray_bed", + "minecraft:green_bed", + "minecraft:light_blue_bed", + "minecraft:light_gray_bed", + "minecraft:lime_bed", + "minecraft:magenta_bed", + "minecraft:orange_bed", + "minecraft:pink_bed", + "minecraft:purple_bed", + "minecraft:red_bed", + "minecraft:yellow_bed", + "minecraft:white_bed" ] ], "result": { diff --git a/data/minecraft/recipe/dye_brown_carpet.json b/data/minecraft/recipe/dye_brown_carpet.json index fceb09bf..9040c26e 100644 --- a/data/minecraft/recipe/dye_brown_carpet.json +++ b/data/minecraft/recipe/dye_brown_carpet.json @@ -3,55 +3,23 @@ "category": "building", "group": "carpet", "ingredients": [ - { - "item": "minecraft:brown_dye" - }, + "minecraft:brown_dye", [ - { - "item": "minecraft:black_carpet" - }, - { - "item": "minecraft:blue_carpet" - }, - { - "item": "minecraft:cyan_carpet" - }, - { - "item": "minecraft:gray_carpet" - }, - { - "item": "minecraft:green_carpet" - }, - { - "item": "minecraft:light_blue_carpet" - }, - { - "item": "minecraft:light_gray_carpet" - }, - { - "item": "minecraft:lime_carpet" - }, - { - "item": "minecraft:magenta_carpet" - }, - { - "item": "minecraft:orange_carpet" - }, - { - "item": "minecraft:pink_carpet" - }, - { - "item": "minecraft:purple_carpet" - }, - { - "item": "minecraft:red_carpet" - }, - { - "item": "minecraft:yellow_carpet" - }, - { - "item": "minecraft:white_carpet" - } + "minecraft:black_carpet", + "minecraft:blue_carpet", + "minecraft:cyan_carpet", + "minecraft:gray_carpet", + "minecraft:green_carpet", + "minecraft:light_blue_carpet", + "minecraft:light_gray_carpet", + "minecraft:lime_carpet", + "minecraft:magenta_carpet", + "minecraft:orange_carpet", + "minecraft:pink_carpet", + "minecraft:purple_carpet", + "minecraft:red_carpet", + "minecraft:yellow_carpet", + "minecraft:white_carpet" ] ], "result": { diff --git a/data/minecraft/recipe/dye_brown_wool.json b/data/minecraft/recipe/dye_brown_wool.json index 9f214420..f9bf45d5 100644 --- a/data/minecraft/recipe/dye_brown_wool.json +++ b/data/minecraft/recipe/dye_brown_wool.json @@ -3,55 +3,23 @@ "category": "building", "group": "wool", "ingredients": [ - { - "item": "minecraft:brown_dye" - }, + "minecraft:brown_dye", [ - { - "item": "minecraft:black_wool" - }, - { - "item": "minecraft:blue_wool" - }, - { - "item": "minecraft:cyan_wool" - }, - { - "item": "minecraft:gray_wool" - }, - { - "item": "minecraft:green_wool" - }, - { - "item": "minecraft:light_blue_wool" - }, - { - "item": "minecraft:light_gray_wool" - }, - { - "item": "minecraft:lime_wool" - }, - { - "item": "minecraft:magenta_wool" - }, - { - "item": "minecraft:orange_wool" - }, - { - "item": "minecraft:pink_wool" - }, - { - "item": "minecraft:purple_wool" - }, - { - "item": "minecraft:red_wool" - }, - { - "item": "minecraft:yellow_wool" - }, - { - "item": "minecraft:white_wool" - } + "minecraft:black_wool", + "minecraft:blue_wool", + "minecraft:cyan_wool", + "minecraft:gray_wool", + "minecraft:green_wool", + "minecraft:light_blue_wool", + "minecraft:light_gray_wool", + "minecraft:lime_wool", + "minecraft:magenta_wool", + "minecraft:orange_wool", + "minecraft:pink_wool", + "minecraft:purple_wool", + "minecraft:red_wool", + "minecraft:yellow_wool", + "minecraft:white_wool" ] ], "result": { diff --git a/data/minecraft/recipe/dye_cyan_bed.json b/data/minecraft/recipe/dye_cyan_bed.json index 835ef9c9..ee083305 100644 --- a/data/minecraft/recipe/dye_cyan_bed.json +++ b/data/minecraft/recipe/dye_cyan_bed.json @@ -3,55 +3,23 @@ "category": "building", "group": "bed", "ingredients": [ - { - "item": "minecraft:cyan_dye" - }, + "minecraft:cyan_dye", [ - { - "item": "minecraft:black_bed" - }, - { - "item": "minecraft:blue_bed" - }, - { - "item": "minecraft:brown_bed" - }, - { - "item": "minecraft:gray_bed" - }, - { - "item": "minecraft:green_bed" - }, - { - "item": "minecraft:light_blue_bed" - }, - { - "item": "minecraft:light_gray_bed" - }, - { - "item": "minecraft:lime_bed" - }, - { - "item": "minecraft:magenta_bed" - }, - { - "item": "minecraft:orange_bed" - }, - { - "item": "minecraft:pink_bed" - }, - { - "item": "minecraft:purple_bed" - }, - { - "item": "minecraft:red_bed" - }, - { - "item": "minecraft:yellow_bed" - }, - { - "item": "minecraft:white_bed" - } + "minecraft:black_bed", + "minecraft:blue_bed", + "minecraft:brown_bed", + "minecraft:gray_bed", + "minecraft:green_bed", + "minecraft:light_blue_bed", + "minecraft:light_gray_bed", + "minecraft:lime_bed", + "minecraft:magenta_bed", + "minecraft:orange_bed", + "minecraft:pink_bed", + "minecraft:purple_bed", + "minecraft:red_bed", + "minecraft:yellow_bed", + "minecraft:white_bed" ] ], "result": { diff --git a/data/minecraft/recipe/dye_cyan_carpet.json b/data/minecraft/recipe/dye_cyan_carpet.json index 816ff391..7264bc00 100644 --- a/data/minecraft/recipe/dye_cyan_carpet.json +++ b/data/minecraft/recipe/dye_cyan_carpet.json @@ -3,55 +3,23 @@ "category": "building", "group": "carpet", "ingredients": [ - { - "item": "minecraft:cyan_dye" - }, + "minecraft:cyan_dye", [ - { - "item": "minecraft:black_carpet" - }, - { - "item": "minecraft:blue_carpet" - }, - { - "item": "minecraft:brown_carpet" - }, - { - "item": "minecraft:gray_carpet" - }, - { - "item": "minecraft:green_carpet" - }, - { - "item": "minecraft:light_blue_carpet" - }, - { - "item": "minecraft:light_gray_carpet" - }, - { - "item": "minecraft:lime_carpet" - }, - { - "item": "minecraft:magenta_carpet" - }, - { - "item": "minecraft:orange_carpet" - }, - { - "item": "minecraft:pink_carpet" - }, - { - "item": "minecraft:purple_carpet" - }, - { - "item": "minecraft:red_carpet" - }, - { - "item": "minecraft:yellow_carpet" - }, - { - "item": "minecraft:white_carpet" - } + "minecraft:black_carpet", + "minecraft:blue_carpet", + "minecraft:brown_carpet", + "minecraft:gray_carpet", + "minecraft:green_carpet", + "minecraft:light_blue_carpet", + "minecraft:light_gray_carpet", + "minecraft:lime_carpet", + "minecraft:magenta_carpet", + "minecraft:orange_carpet", + "minecraft:pink_carpet", + "minecraft:purple_carpet", + "minecraft:red_carpet", + "minecraft:yellow_carpet", + "minecraft:white_carpet" ] ], "result": { diff --git a/data/minecraft/recipe/dye_cyan_wool.json b/data/minecraft/recipe/dye_cyan_wool.json index 89e632f8..8b9e6738 100644 --- a/data/minecraft/recipe/dye_cyan_wool.json +++ b/data/minecraft/recipe/dye_cyan_wool.json @@ -3,55 +3,23 @@ "category": "building", "group": "wool", "ingredients": [ - { - "item": "minecraft:cyan_dye" - }, + "minecraft:cyan_dye", [ - { - "item": "minecraft:black_wool" - }, - { - "item": "minecraft:blue_wool" - }, - { - "item": "minecraft:brown_wool" - }, - { - "item": "minecraft:gray_wool" - }, - { - "item": "minecraft:green_wool" - }, - { - "item": "minecraft:light_blue_wool" - }, - { - "item": "minecraft:light_gray_wool" - }, - { - "item": "minecraft:lime_wool" - }, - { - "item": "minecraft:magenta_wool" - }, - { - "item": "minecraft:orange_wool" - }, - { - "item": "minecraft:pink_wool" - }, - { - "item": "minecraft:purple_wool" - }, - { - "item": "minecraft:red_wool" - }, - { - "item": "minecraft:yellow_wool" - }, - { - "item": "minecraft:white_wool" - } + "minecraft:black_wool", + "minecraft:blue_wool", + "minecraft:brown_wool", + "minecraft:gray_wool", + "minecraft:green_wool", + "minecraft:light_blue_wool", + "minecraft:light_gray_wool", + "minecraft:lime_wool", + "minecraft:magenta_wool", + "minecraft:orange_wool", + "minecraft:pink_wool", + "minecraft:purple_wool", + "minecraft:red_wool", + "minecraft:yellow_wool", + "minecraft:white_wool" ] ], "result": { diff --git a/data/minecraft/recipe/dye_gray_bed.json b/data/minecraft/recipe/dye_gray_bed.json index 631b3af9..234a725b 100644 --- a/data/minecraft/recipe/dye_gray_bed.json +++ b/data/minecraft/recipe/dye_gray_bed.json @@ -3,55 +3,23 @@ "category": "building", "group": "bed", "ingredients": [ - { - "item": "minecraft:gray_dye" - }, + "minecraft:gray_dye", [ - { - "item": "minecraft:black_bed" - }, - { - "item": "minecraft:blue_bed" - }, - { - "item": "minecraft:brown_bed" - }, - { - "item": "minecraft:cyan_bed" - }, - { - "item": "minecraft:green_bed" - }, - { - "item": "minecraft:light_blue_bed" - }, - { - "item": "minecraft:light_gray_bed" - }, - { - "item": "minecraft:lime_bed" - }, - { - "item": "minecraft:magenta_bed" - }, - { - "item": "minecraft:orange_bed" - }, - { - "item": "minecraft:pink_bed" - }, - { - "item": "minecraft:purple_bed" - }, - { - "item": "minecraft:red_bed" - }, - { - "item": "minecraft:yellow_bed" - }, - { - "item": "minecraft:white_bed" - } + "minecraft:black_bed", + "minecraft:blue_bed", + "minecraft:brown_bed", + "minecraft:cyan_bed", + "minecraft:green_bed", + "minecraft:light_blue_bed", + "minecraft:light_gray_bed", + "minecraft:lime_bed", + "minecraft:magenta_bed", + "minecraft:orange_bed", + "minecraft:pink_bed", + "minecraft:purple_bed", + "minecraft:red_bed", + "minecraft:yellow_bed", + "minecraft:white_bed" ] ], "result": { diff --git a/data/minecraft/recipe/dye_gray_carpet.json b/data/minecraft/recipe/dye_gray_carpet.json index 05c363af..033577ea 100644 --- a/data/minecraft/recipe/dye_gray_carpet.json +++ b/data/minecraft/recipe/dye_gray_carpet.json @@ -3,55 +3,23 @@ "category": "building", "group": "carpet", "ingredients": [ - { - "item": "minecraft:gray_dye" - }, + "minecraft:gray_dye", [ - { - "item": "minecraft:black_carpet" - }, - { - "item": "minecraft:blue_carpet" - }, - { - "item": "minecraft:brown_carpet" - }, - { - "item": "minecraft:cyan_carpet" - }, - { - "item": "minecraft:green_carpet" - }, - { - "item": "minecraft:light_blue_carpet" - }, - { - "item": "minecraft:light_gray_carpet" - }, - { - "item": "minecraft:lime_carpet" - }, - { - "item": "minecraft:magenta_carpet" - }, - { - "item": "minecraft:orange_carpet" - }, - { - "item": "minecraft:pink_carpet" - }, - { - "item": "minecraft:purple_carpet" - }, - { - "item": "minecraft:red_carpet" - }, - { - "item": "minecraft:yellow_carpet" - }, - { - "item": "minecraft:white_carpet" - } + "minecraft:black_carpet", + "minecraft:blue_carpet", + "minecraft:brown_carpet", + "minecraft:cyan_carpet", + "minecraft:green_carpet", + "minecraft:light_blue_carpet", + "minecraft:light_gray_carpet", + "minecraft:lime_carpet", + "minecraft:magenta_carpet", + "minecraft:orange_carpet", + "minecraft:pink_carpet", + "minecraft:purple_carpet", + "minecraft:red_carpet", + "minecraft:yellow_carpet", + "minecraft:white_carpet" ] ], "result": { diff --git a/data/minecraft/recipe/dye_gray_wool.json b/data/minecraft/recipe/dye_gray_wool.json index 3610ab21..f2ae0c86 100644 --- a/data/minecraft/recipe/dye_gray_wool.json +++ b/data/minecraft/recipe/dye_gray_wool.json @@ -3,55 +3,23 @@ "category": "building", "group": "wool", "ingredients": [ - { - "item": "minecraft:gray_dye" - }, + "minecraft:gray_dye", [ - { - "item": "minecraft:black_wool" - }, - { - "item": "minecraft:blue_wool" - }, - { - "item": "minecraft:brown_wool" - }, - { - "item": "minecraft:cyan_wool" - }, - { - "item": "minecraft:green_wool" - }, - { - "item": "minecraft:light_blue_wool" - }, - { - "item": "minecraft:light_gray_wool" - }, - { - "item": "minecraft:lime_wool" - }, - { - "item": "minecraft:magenta_wool" - }, - { - "item": "minecraft:orange_wool" - }, - { - "item": "minecraft:pink_wool" - }, - { - "item": "minecraft:purple_wool" - }, - { - "item": "minecraft:red_wool" - }, - { - "item": "minecraft:yellow_wool" - }, - { - "item": "minecraft:white_wool" - } + "minecraft:black_wool", + "minecraft:blue_wool", + "minecraft:brown_wool", + "minecraft:cyan_wool", + "minecraft:green_wool", + "minecraft:light_blue_wool", + "minecraft:light_gray_wool", + "minecraft:lime_wool", + "minecraft:magenta_wool", + "minecraft:orange_wool", + "minecraft:pink_wool", + "minecraft:purple_wool", + "minecraft:red_wool", + "minecraft:yellow_wool", + "minecraft:white_wool" ] ], "result": { diff --git a/data/minecraft/recipe/dye_green_bed.json b/data/minecraft/recipe/dye_green_bed.json index 4394e5bc..f49321a4 100644 --- a/data/minecraft/recipe/dye_green_bed.json +++ b/data/minecraft/recipe/dye_green_bed.json @@ -3,55 +3,23 @@ "category": "building", "group": "bed", "ingredients": [ - { - "item": "minecraft:green_dye" - }, + "minecraft:green_dye", [ - { - "item": "minecraft:black_bed" - }, - { - "item": "minecraft:blue_bed" - }, - { - "item": "minecraft:brown_bed" - }, - { - "item": "minecraft:cyan_bed" - }, - { - "item": "minecraft:gray_bed" - }, - { - "item": "minecraft:light_blue_bed" - }, - { - "item": "minecraft:light_gray_bed" - }, - { - "item": "minecraft:lime_bed" - }, - { - "item": "minecraft:magenta_bed" - }, - { - "item": "minecraft:orange_bed" - }, - { - "item": "minecraft:pink_bed" - }, - { - "item": "minecraft:purple_bed" - }, - { - "item": "minecraft:red_bed" - }, - { - "item": "minecraft:yellow_bed" - }, - { - "item": "minecraft:white_bed" - } + "minecraft:black_bed", + "minecraft:blue_bed", + "minecraft:brown_bed", + "minecraft:cyan_bed", + "minecraft:gray_bed", + "minecraft:light_blue_bed", + "minecraft:light_gray_bed", + "minecraft:lime_bed", + "minecraft:magenta_bed", + "minecraft:orange_bed", + "minecraft:pink_bed", + "minecraft:purple_bed", + "minecraft:red_bed", + "minecraft:yellow_bed", + "minecraft:white_bed" ] ], "result": { diff --git a/data/minecraft/recipe/dye_green_carpet.json b/data/minecraft/recipe/dye_green_carpet.json index 66b3f8fa..f1d9c80d 100644 --- a/data/minecraft/recipe/dye_green_carpet.json +++ b/data/minecraft/recipe/dye_green_carpet.json @@ -3,55 +3,23 @@ "category": "building", "group": "carpet", "ingredients": [ - { - "item": "minecraft:green_dye" - }, + "minecraft:green_dye", [ - { - "item": "minecraft:black_carpet" - }, - { - "item": "minecraft:blue_carpet" - }, - { - "item": "minecraft:brown_carpet" - }, - { - "item": "minecraft:cyan_carpet" - }, - { - "item": "minecraft:gray_carpet" - }, - { - "item": "minecraft:light_blue_carpet" - }, - { - "item": "minecraft:light_gray_carpet" - }, - { - "item": "minecraft:lime_carpet" - }, - { - "item": "minecraft:magenta_carpet" - }, - { - "item": "minecraft:orange_carpet" - }, - { - "item": "minecraft:pink_carpet" - }, - { - "item": "minecraft:purple_carpet" - }, - { - "item": "minecraft:red_carpet" - }, - { - "item": "minecraft:yellow_carpet" - }, - { - "item": "minecraft:white_carpet" - } + "minecraft:black_carpet", + "minecraft:blue_carpet", + "minecraft:brown_carpet", + "minecraft:cyan_carpet", + "minecraft:gray_carpet", + "minecraft:light_blue_carpet", + "minecraft:light_gray_carpet", + "minecraft:lime_carpet", + "minecraft:magenta_carpet", + "minecraft:orange_carpet", + "minecraft:pink_carpet", + "minecraft:purple_carpet", + "minecraft:red_carpet", + "minecraft:yellow_carpet", + "minecraft:white_carpet" ] ], "result": { diff --git a/data/minecraft/recipe/dye_green_wool.json b/data/minecraft/recipe/dye_green_wool.json index 0ba7c459..5742023d 100644 --- a/data/minecraft/recipe/dye_green_wool.json +++ b/data/minecraft/recipe/dye_green_wool.json @@ -3,55 +3,23 @@ "category": "building", "group": "wool", "ingredients": [ - { - "item": "minecraft:green_dye" - }, + "minecraft:green_dye", [ - { - "item": "minecraft:black_wool" - }, - { - "item": "minecraft:blue_wool" - }, - { - "item": "minecraft:brown_wool" - }, - { - "item": "minecraft:cyan_wool" - }, - { - "item": "minecraft:gray_wool" - }, - { - "item": "minecraft:light_blue_wool" - }, - { - "item": "minecraft:light_gray_wool" - }, - { - "item": "minecraft:lime_wool" - }, - { - "item": "minecraft:magenta_wool" - }, - { - "item": "minecraft:orange_wool" - }, - { - "item": "minecraft:pink_wool" - }, - { - "item": "minecraft:purple_wool" - }, - { - "item": "minecraft:red_wool" - }, - { - "item": "minecraft:yellow_wool" - }, - { - "item": "minecraft:white_wool" - } + "minecraft:black_wool", + "minecraft:blue_wool", + "minecraft:brown_wool", + "minecraft:cyan_wool", + "minecraft:gray_wool", + "minecraft:light_blue_wool", + "minecraft:light_gray_wool", + "minecraft:lime_wool", + "minecraft:magenta_wool", + "minecraft:orange_wool", + "minecraft:pink_wool", + "minecraft:purple_wool", + "minecraft:red_wool", + "minecraft:yellow_wool", + "minecraft:white_wool" ] ], "result": { diff --git a/data/minecraft/recipe/dye_light_blue_bed.json b/data/minecraft/recipe/dye_light_blue_bed.json index 78ca1e75..e8f8555a 100644 --- a/data/minecraft/recipe/dye_light_blue_bed.json +++ b/data/minecraft/recipe/dye_light_blue_bed.json @@ -3,55 +3,23 @@ "category": "building", "group": "bed", "ingredients": [ - { - "item": "minecraft:light_blue_dye" - }, + "minecraft:light_blue_dye", [ - { - "item": "minecraft:black_bed" - }, - { - "item": "minecraft:blue_bed" - }, - { - "item": "minecraft:brown_bed" - }, - { - "item": "minecraft:cyan_bed" - }, - { - "item": "minecraft:gray_bed" - }, - { - "item": "minecraft:green_bed" - }, - { - "item": "minecraft:light_gray_bed" - }, - { - "item": "minecraft:lime_bed" - }, - { - "item": "minecraft:magenta_bed" - }, - { - "item": "minecraft:orange_bed" - }, - { - "item": "minecraft:pink_bed" - }, - { - "item": "minecraft:purple_bed" - }, - { - "item": "minecraft:red_bed" - }, - { - "item": "minecraft:yellow_bed" - }, - { - "item": "minecraft:white_bed" - } + "minecraft:black_bed", + "minecraft:blue_bed", + "minecraft:brown_bed", + "minecraft:cyan_bed", + "minecraft:gray_bed", + "minecraft:green_bed", + "minecraft:light_gray_bed", + "minecraft:lime_bed", + "minecraft:magenta_bed", + "minecraft:orange_bed", + "minecraft:pink_bed", + "minecraft:purple_bed", + "minecraft:red_bed", + "minecraft:yellow_bed", + "minecraft:white_bed" ] ], "result": { diff --git a/data/minecraft/recipe/dye_light_blue_carpet.json b/data/minecraft/recipe/dye_light_blue_carpet.json index cf44faa3..201a234c 100644 --- a/data/minecraft/recipe/dye_light_blue_carpet.json +++ b/data/minecraft/recipe/dye_light_blue_carpet.json @@ -3,55 +3,23 @@ "category": "building", "group": "carpet", "ingredients": [ - { - "item": "minecraft:light_blue_dye" - }, + "minecraft:light_blue_dye", [ - { - "item": "minecraft:black_carpet" - }, - { - "item": "minecraft:blue_carpet" - }, - { - "item": "minecraft:brown_carpet" - }, - { - "item": "minecraft:cyan_carpet" - }, - { - "item": "minecraft:gray_carpet" - }, - { - "item": "minecraft:green_carpet" - }, - { - "item": "minecraft:light_gray_carpet" - }, - { - "item": "minecraft:lime_carpet" - }, - { - "item": "minecraft:magenta_carpet" - }, - { - "item": "minecraft:orange_carpet" - }, - { - "item": "minecraft:pink_carpet" - }, - { - "item": "minecraft:purple_carpet" - }, - { - "item": "minecraft:red_carpet" - }, - { - "item": "minecraft:yellow_carpet" - }, - { - "item": "minecraft:white_carpet" - } + "minecraft:black_carpet", + "minecraft:blue_carpet", + "minecraft:brown_carpet", + "minecraft:cyan_carpet", + "minecraft:gray_carpet", + "minecraft:green_carpet", + "minecraft:light_gray_carpet", + "minecraft:lime_carpet", + "minecraft:magenta_carpet", + "minecraft:orange_carpet", + "minecraft:pink_carpet", + "minecraft:purple_carpet", + "minecraft:red_carpet", + "minecraft:yellow_carpet", + "minecraft:white_carpet" ] ], "result": { diff --git a/data/minecraft/recipe/dye_light_blue_wool.json b/data/minecraft/recipe/dye_light_blue_wool.json index 6367dee7..35570958 100644 --- a/data/minecraft/recipe/dye_light_blue_wool.json +++ b/data/minecraft/recipe/dye_light_blue_wool.json @@ -3,55 +3,23 @@ "category": "building", "group": "wool", "ingredients": [ - { - "item": "minecraft:light_blue_dye" - }, + "minecraft:light_blue_dye", [ - { - "item": "minecraft:black_wool" - }, - { - "item": "minecraft:blue_wool" - }, - { - "item": "minecraft:brown_wool" - }, - { - "item": "minecraft:cyan_wool" - }, - { - "item": "minecraft:gray_wool" - }, - { - "item": "minecraft:green_wool" - }, - { - "item": "minecraft:light_gray_wool" - }, - { - "item": "minecraft:lime_wool" - }, - { - "item": "minecraft:magenta_wool" - }, - { - "item": "minecraft:orange_wool" - }, - { - "item": "minecraft:pink_wool" - }, - { - "item": "minecraft:purple_wool" - }, - { - "item": "minecraft:red_wool" - }, - { - "item": "minecraft:yellow_wool" - }, - { - "item": "minecraft:white_wool" - } + "minecraft:black_wool", + "minecraft:blue_wool", + "minecraft:brown_wool", + "minecraft:cyan_wool", + "minecraft:gray_wool", + "minecraft:green_wool", + "minecraft:light_gray_wool", + "minecraft:lime_wool", + "minecraft:magenta_wool", + "minecraft:orange_wool", + "minecraft:pink_wool", + "minecraft:purple_wool", + "minecraft:red_wool", + "minecraft:yellow_wool", + "minecraft:white_wool" ] ], "result": { diff --git a/data/minecraft/recipe/dye_light_gray_bed.json b/data/minecraft/recipe/dye_light_gray_bed.json index 26bf7ab3..00cfa5a5 100644 --- a/data/minecraft/recipe/dye_light_gray_bed.json +++ b/data/minecraft/recipe/dye_light_gray_bed.json @@ -3,55 +3,23 @@ "category": "building", "group": "bed", "ingredients": [ - { - "item": "minecraft:light_gray_dye" - }, + "minecraft:light_gray_dye", [ - { - "item": "minecraft:black_bed" - }, - { - "item": "minecraft:blue_bed" - }, - { - "item": "minecraft:brown_bed" - }, - { - "item": "minecraft:cyan_bed" - }, - { - "item": "minecraft:gray_bed" - }, - { - "item": "minecraft:green_bed" - }, - { - "item": "minecraft:light_blue_bed" - }, - { - "item": "minecraft:lime_bed" - }, - { - "item": "minecraft:magenta_bed" - }, - { - "item": "minecraft:orange_bed" - }, - { - "item": "minecraft:pink_bed" - }, - { - "item": "minecraft:purple_bed" - }, - { - "item": "minecraft:red_bed" - }, - { - "item": "minecraft:yellow_bed" - }, - { - "item": "minecraft:white_bed" - } + "minecraft:black_bed", + "minecraft:blue_bed", + "minecraft:brown_bed", + "minecraft:cyan_bed", + "minecraft:gray_bed", + "minecraft:green_bed", + "minecraft:light_blue_bed", + "minecraft:lime_bed", + "minecraft:magenta_bed", + "minecraft:orange_bed", + "minecraft:pink_bed", + "minecraft:purple_bed", + "minecraft:red_bed", + "minecraft:yellow_bed", + "minecraft:white_bed" ] ], "result": { diff --git a/data/minecraft/recipe/dye_light_gray_carpet.json b/data/minecraft/recipe/dye_light_gray_carpet.json index 1119a5a2..9836e6ea 100644 --- a/data/minecraft/recipe/dye_light_gray_carpet.json +++ b/data/minecraft/recipe/dye_light_gray_carpet.json @@ -3,55 +3,23 @@ "category": "building", "group": "carpet", "ingredients": [ - { - "item": "minecraft:light_gray_dye" - }, + "minecraft:light_gray_dye", [ - { - "item": "minecraft:black_carpet" - }, - { - "item": "minecraft:blue_carpet" - }, - { - "item": "minecraft:brown_carpet" - }, - { - "item": "minecraft:cyan_carpet" - }, - { - "item": "minecraft:gray_carpet" - }, - { - "item": "minecraft:green_carpet" - }, - { - "item": "minecraft:light_blue_carpet" - }, - { - "item": "minecraft:lime_carpet" - }, - { - "item": "minecraft:magenta_carpet" - }, - { - "item": "minecraft:orange_carpet" - }, - { - "item": "minecraft:pink_carpet" - }, - { - "item": "minecraft:purple_carpet" - }, - { - "item": "minecraft:red_carpet" - }, - { - "item": "minecraft:yellow_carpet" - }, - { - "item": "minecraft:white_carpet" - } + "minecraft:black_carpet", + "minecraft:blue_carpet", + "minecraft:brown_carpet", + "minecraft:cyan_carpet", + "minecraft:gray_carpet", + "minecraft:green_carpet", + "minecraft:light_blue_carpet", + "minecraft:lime_carpet", + "minecraft:magenta_carpet", + "minecraft:orange_carpet", + "minecraft:pink_carpet", + "minecraft:purple_carpet", + "minecraft:red_carpet", + "minecraft:yellow_carpet", + "minecraft:white_carpet" ] ], "result": { diff --git a/data/minecraft/recipe/dye_light_gray_wool.json b/data/minecraft/recipe/dye_light_gray_wool.json index 7d0be1ea..360bfcd4 100644 --- a/data/minecraft/recipe/dye_light_gray_wool.json +++ b/data/minecraft/recipe/dye_light_gray_wool.json @@ -3,55 +3,23 @@ "category": "building", "group": "wool", "ingredients": [ - { - "item": "minecraft:light_gray_dye" - }, + "minecraft:light_gray_dye", [ - { - "item": "minecraft:black_wool" - }, - { - "item": "minecraft:blue_wool" - }, - { - "item": "minecraft:brown_wool" - }, - { - "item": "minecraft:cyan_wool" - }, - { - "item": "minecraft:gray_wool" - }, - { - "item": "minecraft:green_wool" - }, - { - "item": "minecraft:light_blue_wool" - }, - { - "item": "minecraft:lime_wool" - }, - { - "item": "minecraft:magenta_wool" - }, - { - "item": "minecraft:orange_wool" - }, - { - "item": "minecraft:pink_wool" - }, - { - "item": "minecraft:purple_wool" - }, - { - "item": "minecraft:red_wool" - }, - { - "item": "minecraft:yellow_wool" - }, - { - "item": "minecraft:white_wool" - } + "minecraft:black_wool", + "minecraft:blue_wool", + "minecraft:brown_wool", + "minecraft:cyan_wool", + "minecraft:gray_wool", + "minecraft:green_wool", + "minecraft:light_blue_wool", + "minecraft:lime_wool", + "minecraft:magenta_wool", + "minecraft:orange_wool", + "minecraft:pink_wool", + "minecraft:purple_wool", + "minecraft:red_wool", + "minecraft:yellow_wool", + "minecraft:white_wool" ] ], "result": { diff --git a/data/minecraft/recipe/dye_lime_bed.json b/data/minecraft/recipe/dye_lime_bed.json index 1daff444..1afd7aff 100644 --- a/data/minecraft/recipe/dye_lime_bed.json +++ b/data/minecraft/recipe/dye_lime_bed.json @@ -3,55 +3,23 @@ "category": "building", "group": "bed", "ingredients": [ - { - "item": "minecraft:lime_dye" - }, + "minecraft:lime_dye", [ - { - "item": "minecraft:black_bed" - }, - { - "item": "minecraft:blue_bed" - }, - { - "item": "minecraft:brown_bed" - }, - { - "item": "minecraft:cyan_bed" - }, - { - "item": "minecraft:gray_bed" - }, - { - "item": "minecraft:green_bed" - }, - { - "item": "minecraft:light_blue_bed" - }, - { - "item": "minecraft:light_gray_bed" - }, - { - "item": "minecraft:magenta_bed" - }, - { - "item": "minecraft:orange_bed" - }, - { - "item": "minecraft:pink_bed" - }, - { - "item": "minecraft:purple_bed" - }, - { - "item": "minecraft:red_bed" - }, - { - "item": "minecraft:yellow_bed" - }, - { - "item": "minecraft:white_bed" - } + "minecraft:black_bed", + "minecraft:blue_bed", + "minecraft:brown_bed", + "minecraft:cyan_bed", + "minecraft:gray_bed", + "minecraft:green_bed", + "minecraft:light_blue_bed", + "minecraft:light_gray_bed", + "minecraft:magenta_bed", + "minecraft:orange_bed", + "minecraft:pink_bed", + "minecraft:purple_bed", + "minecraft:red_bed", + "minecraft:yellow_bed", + "minecraft:white_bed" ] ], "result": { diff --git a/data/minecraft/recipe/dye_lime_carpet.json b/data/minecraft/recipe/dye_lime_carpet.json index 7a290806..0d4e4a38 100644 --- a/data/minecraft/recipe/dye_lime_carpet.json +++ b/data/minecraft/recipe/dye_lime_carpet.json @@ -3,55 +3,23 @@ "category": "building", "group": "carpet", "ingredients": [ - { - "item": "minecraft:lime_dye" - }, + "minecraft:lime_dye", [ - { - "item": "minecraft:black_carpet" - }, - { - "item": "minecraft:blue_carpet" - }, - { - "item": "minecraft:brown_carpet" - }, - { - "item": "minecraft:cyan_carpet" - }, - { - "item": "minecraft:gray_carpet" - }, - { - "item": "minecraft:green_carpet" - }, - { - "item": "minecraft:light_blue_carpet" - }, - { - "item": "minecraft:light_gray_carpet" - }, - { - "item": "minecraft:magenta_carpet" - }, - { - "item": "minecraft:orange_carpet" - }, - { - "item": "minecraft:pink_carpet" - }, - { - "item": "minecraft:purple_carpet" - }, - { - "item": "minecraft:red_carpet" - }, - { - "item": "minecraft:yellow_carpet" - }, - { - "item": "minecraft:white_carpet" - } + "minecraft:black_carpet", + "minecraft:blue_carpet", + "minecraft:brown_carpet", + "minecraft:cyan_carpet", + "minecraft:gray_carpet", + "minecraft:green_carpet", + "minecraft:light_blue_carpet", + "minecraft:light_gray_carpet", + "minecraft:magenta_carpet", + "minecraft:orange_carpet", + "minecraft:pink_carpet", + "minecraft:purple_carpet", + "minecraft:red_carpet", + "minecraft:yellow_carpet", + "minecraft:white_carpet" ] ], "result": { diff --git a/data/minecraft/recipe/dye_lime_wool.json b/data/minecraft/recipe/dye_lime_wool.json index 25c2e277..dac9d0ae 100644 --- a/data/minecraft/recipe/dye_lime_wool.json +++ b/data/minecraft/recipe/dye_lime_wool.json @@ -3,55 +3,23 @@ "category": "building", "group": "wool", "ingredients": [ - { - "item": "minecraft:lime_dye" - }, + "minecraft:lime_dye", [ - { - "item": "minecraft:black_wool" - }, - { - "item": "minecraft:blue_wool" - }, - { - "item": "minecraft:brown_wool" - }, - { - "item": "minecraft:cyan_wool" - }, - { - "item": "minecraft:gray_wool" - }, - { - "item": "minecraft:green_wool" - }, - { - "item": "minecraft:light_blue_wool" - }, - { - "item": "minecraft:light_gray_wool" - }, - { - "item": "minecraft:magenta_wool" - }, - { - "item": "minecraft:orange_wool" - }, - { - "item": "minecraft:pink_wool" - }, - { - "item": "minecraft:purple_wool" - }, - { - "item": "minecraft:red_wool" - }, - { - "item": "minecraft:yellow_wool" - }, - { - "item": "minecraft:white_wool" - } + "minecraft:black_wool", + "minecraft:blue_wool", + "minecraft:brown_wool", + "minecraft:cyan_wool", + "minecraft:gray_wool", + "minecraft:green_wool", + "minecraft:light_blue_wool", + "minecraft:light_gray_wool", + "minecraft:magenta_wool", + "minecraft:orange_wool", + "minecraft:pink_wool", + "minecraft:purple_wool", + "minecraft:red_wool", + "minecraft:yellow_wool", + "minecraft:white_wool" ] ], "result": { diff --git a/data/minecraft/recipe/dye_magenta_bed.json b/data/minecraft/recipe/dye_magenta_bed.json index 7e4db1f9..ae2db60d 100644 --- a/data/minecraft/recipe/dye_magenta_bed.json +++ b/data/minecraft/recipe/dye_magenta_bed.json @@ -3,55 +3,23 @@ "category": "building", "group": "bed", "ingredients": [ - { - "item": "minecraft:magenta_dye" - }, + "minecraft:magenta_dye", [ - { - "item": "minecraft:black_bed" - }, - { - "item": "minecraft:blue_bed" - }, - { - "item": "minecraft:brown_bed" - }, - { - "item": "minecraft:cyan_bed" - }, - { - "item": "minecraft:gray_bed" - }, - { - "item": "minecraft:green_bed" - }, - { - "item": "minecraft:light_blue_bed" - }, - { - "item": "minecraft:light_gray_bed" - }, - { - "item": "minecraft:lime_bed" - }, - { - "item": "minecraft:orange_bed" - }, - { - "item": "minecraft:pink_bed" - }, - { - "item": "minecraft:purple_bed" - }, - { - "item": "minecraft:red_bed" - }, - { - "item": "minecraft:yellow_bed" - }, - { - "item": "minecraft:white_bed" - } + "minecraft:black_bed", + "minecraft:blue_bed", + "minecraft:brown_bed", + "minecraft:cyan_bed", + "minecraft:gray_bed", + "minecraft:green_bed", + "minecraft:light_blue_bed", + "minecraft:light_gray_bed", + "minecraft:lime_bed", + "minecraft:orange_bed", + "minecraft:pink_bed", + "minecraft:purple_bed", + "minecraft:red_bed", + "minecraft:yellow_bed", + "minecraft:white_bed" ] ], "result": { diff --git a/data/minecraft/recipe/dye_magenta_carpet.json b/data/minecraft/recipe/dye_magenta_carpet.json index 57e326bc..a161f330 100644 --- a/data/minecraft/recipe/dye_magenta_carpet.json +++ b/data/minecraft/recipe/dye_magenta_carpet.json @@ -3,55 +3,23 @@ "category": "building", "group": "carpet", "ingredients": [ - { - "item": "minecraft:magenta_dye" - }, + "minecraft:magenta_dye", [ - { - "item": "minecraft:black_carpet" - }, - { - "item": "minecraft:blue_carpet" - }, - { - "item": "minecraft:brown_carpet" - }, - { - "item": "minecraft:cyan_carpet" - }, - { - "item": "minecraft:gray_carpet" - }, - { - "item": "minecraft:green_carpet" - }, - { - "item": "minecraft:light_blue_carpet" - }, - { - "item": "minecraft:light_gray_carpet" - }, - { - "item": "minecraft:lime_carpet" - }, - { - "item": "minecraft:orange_carpet" - }, - { - "item": "minecraft:pink_carpet" - }, - { - "item": "minecraft:purple_carpet" - }, - { - "item": "minecraft:red_carpet" - }, - { - "item": "minecraft:yellow_carpet" - }, - { - "item": "minecraft:white_carpet" - } + "minecraft:black_carpet", + "minecraft:blue_carpet", + "minecraft:brown_carpet", + "minecraft:cyan_carpet", + "minecraft:gray_carpet", + "minecraft:green_carpet", + "minecraft:light_blue_carpet", + "minecraft:light_gray_carpet", + "minecraft:lime_carpet", + "minecraft:orange_carpet", + "minecraft:pink_carpet", + "minecraft:purple_carpet", + "minecraft:red_carpet", + "minecraft:yellow_carpet", + "minecraft:white_carpet" ] ], "result": { diff --git a/data/minecraft/recipe/dye_magenta_wool.json b/data/minecraft/recipe/dye_magenta_wool.json index e75cc70f..a58ce2d1 100644 --- a/data/minecraft/recipe/dye_magenta_wool.json +++ b/data/minecraft/recipe/dye_magenta_wool.json @@ -3,55 +3,23 @@ "category": "building", "group": "wool", "ingredients": [ - { - "item": "minecraft:magenta_dye" - }, + "minecraft:magenta_dye", [ - { - "item": "minecraft:black_wool" - }, - { - "item": "minecraft:blue_wool" - }, - { - "item": "minecraft:brown_wool" - }, - { - "item": "minecraft:cyan_wool" - }, - { - "item": "minecraft:gray_wool" - }, - { - "item": "minecraft:green_wool" - }, - { - "item": "minecraft:light_blue_wool" - }, - { - "item": "minecraft:light_gray_wool" - }, - { - "item": "minecraft:lime_wool" - }, - { - "item": "minecraft:orange_wool" - }, - { - "item": "minecraft:pink_wool" - }, - { - "item": "minecraft:purple_wool" - }, - { - "item": "minecraft:red_wool" - }, - { - "item": "minecraft:yellow_wool" - }, - { - "item": "minecraft:white_wool" - } + "minecraft:black_wool", + "minecraft:blue_wool", + "minecraft:brown_wool", + "minecraft:cyan_wool", + "minecraft:gray_wool", + "minecraft:green_wool", + "minecraft:light_blue_wool", + "minecraft:light_gray_wool", + "minecraft:lime_wool", + "minecraft:orange_wool", + "minecraft:pink_wool", + "minecraft:purple_wool", + "minecraft:red_wool", + "minecraft:yellow_wool", + "minecraft:white_wool" ] ], "result": { diff --git a/data/minecraft/recipe/dye_orange_bed.json b/data/minecraft/recipe/dye_orange_bed.json index e24318a0..fd5a35b6 100644 --- a/data/minecraft/recipe/dye_orange_bed.json +++ b/data/minecraft/recipe/dye_orange_bed.json @@ -3,55 +3,23 @@ "category": "building", "group": "bed", "ingredients": [ - { - "item": "minecraft:orange_dye" - }, + "minecraft:orange_dye", [ - { - "item": "minecraft:black_bed" - }, - { - "item": "minecraft:blue_bed" - }, - { - "item": "minecraft:brown_bed" - }, - { - "item": "minecraft:cyan_bed" - }, - { - "item": "minecraft:gray_bed" - }, - { - "item": "minecraft:green_bed" - }, - { - "item": "minecraft:light_blue_bed" - }, - { - "item": "minecraft:light_gray_bed" - }, - { - "item": "minecraft:lime_bed" - }, - { - "item": "minecraft:magenta_bed" - }, - { - "item": "minecraft:pink_bed" - }, - { - "item": "minecraft:purple_bed" - }, - { - "item": "minecraft:red_bed" - }, - { - "item": "minecraft:yellow_bed" - }, - { - "item": "minecraft:white_bed" - } + "minecraft:black_bed", + "minecraft:blue_bed", + "minecraft:brown_bed", + "minecraft:cyan_bed", + "minecraft:gray_bed", + "minecraft:green_bed", + "minecraft:light_blue_bed", + "minecraft:light_gray_bed", + "minecraft:lime_bed", + "minecraft:magenta_bed", + "minecraft:pink_bed", + "minecraft:purple_bed", + "minecraft:red_bed", + "minecraft:yellow_bed", + "minecraft:white_bed" ] ], "result": { diff --git a/data/minecraft/recipe/dye_orange_carpet.json b/data/minecraft/recipe/dye_orange_carpet.json index 3ce816fe..5d09cc91 100644 --- a/data/minecraft/recipe/dye_orange_carpet.json +++ b/data/minecraft/recipe/dye_orange_carpet.json @@ -3,55 +3,23 @@ "category": "building", "group": "carpet", "ingredients": [ - { - "item": "minecraft:orange_dye" - }, + "minecraft:orange_dye", [ - { - "item": "minecraft:black_carpet" - }, - { - "item": "minecraft:blue_carpet" - }, - { - "item": "minecraft:brown_carpet" - }, - { - "item": "minecraft:cyan_carpet" - }, - { - "item": "minecraft:gray_carpet" - }, - { - "item": "minecraft:green_carpet" - }, - { - "item": "minecraft:light_blue_carpet" - }, - { - "item": "minecraft:light_gray_carpet" - }, - { - "item": "minecraft:lime_carpet" - }, - { - "item": "minecraft:magenta_carpet" - }, - { - "item": "minecraft:pink_carpet" - }, - { - "item": "minecraft:purple_carpet" - }, - { - "item": "minecraft:red_carpet" - }, - { - "item": "minecraft:yellow_carpet" - }, - { - "item": "minecraft:white_carpet" - } + "minecraft:black_carpet", + "minecraft:blue_carpet", + "minecraft:brown_carpet", + "minecraft:cyan_carpet", + "minecraft:gray_carpet", + "minecraft:green_carpet", + "minecraft:light_blue_carpet", + "minecraft:light_gray_carpet", + "minecraft:lime_carpet", + "minecraft:magenta_carpet", + "minecraft:pink_carpet", + "minecraft:purple_carpet", + "minecraft:red_carpet", + "minecraft:yellow_carpet", + "minecraft:white_carpet" ] ], "result": { diff --git a/data/minecraft/recipe/dye_orange_wool.json b/data/minecraft/recipe/dye_orange_wool.json index 6bab1aa9..9a925f2f 100644 --- a/data/minecraft/recipe/dye_orange_wool.json +++ b/data/minecraft/recipe/dye_orange_wool.json @@ -3,55 +3,23 @@ "category": "building", "group": "wool", "ingredients": [ - { - "item": "minecraft:orange_dye" - }, + "minecraft:orange_dye", [ - { - "item": "minecraft:black_wool" - }, - { - "item": "minecraft:blue_wool" - }, - { - "item": "minecraft:brown_wool" - }, - { - "item": "minecraft:cyan_wool" - }, - { - "item": "minecraft:gray_wool" - }, - { - "item": "minecraft:green_wool" - }, - { - "item": "minecraft:light_blue_wool" - }, - { - "item": "minecraft:light_gray_wool" - }, - { - "item": "minecraft:lime_wool" - }, - { - "item": "minecraft:magenta_wool" - }, - { - "item": "minecraft:pink_wool" - }, - { - "item": "minecraft:purple_wool" - }, - { - "item": "minecraft:red_wool" - }, - { - "item": "minecraft:yellow_wool" - }, - { - "item": "minecraft:white_wool" - } + "minecraft:black_wool", + "minecraft:blue_wool", + "minecraft:brown_wool", + "minecraft:cyan_wool", + "minecraft:gray_wool", + "minecraft:green_wool", + "minecraft:light_blue_wool", + "minecraft:light_gray_wool", + "minecraft:lime_wool", + "minecraft:magenta_wool", + "minecraft:pink_wool", + "minecraft:purple_wool", + "minecraft:red_wool", + "minecraft:yellow_wool", + "minecraft:white_wool" ] ], "result": { diff --git a/data/minecraft/recipe/dye_pink_bed.json b/data/minecraft/recipe/dye_pink_bed.json index c76dd903..638186c8 100644 --- a/data/minecraft/recipe/dye_pink_bed.json +++ b/data/minecraft/recipe/dye_pink_bed.json @@ -3,55 +3,23 @@ "category": "building", "group": "bed", "ingredients": [ - { - "item": "minecraft:pink_dye" - }, + "minecraft:pink_dye", [ - { - "item": "minecraft:black_bed" - }, - { - "item": "minecraft:blue_bed" - }, - { - "item": "minecraft:brown_bed" - }, - { - "item": "minecraft:cyan_bed" - }, - { - "item": "minecraft:gray_bed" - }, - { - "item": "minecraft:green_bed" - }, - { - "item": "minecraft:light_blue_bed" - }, - { - "item": "minecraft:light_gray_bed" - }, - { - "item": "minecraft:lime_bed" - }, - { - "item": "minecraft:magenta_bed" - }, - { - "item": "minecraft:orange_bed" - }, - { - "item": "minecraft:purple_bed" - }, - { - "item": "minecraft:red_bed" - }, - { - "item": "minecraft:yellow_bed" - }, - { - "item": "minecraft:white_bed" - } + "minecraft:black_bed", + "minecraft:blue_bed", + "minecraft:brown_bed", + "minecraft:cyan_bed", + "minecraft:gray_bed", + "minecraft:green_bed", + "minecraft:light_blue_bed", + "minecraft:light_gray_bed", + "minecraft:lime_bed", + "minecraft:magenta_bed", + "minecraft:orange_bed", + "minecraft:purple_bed", + "minecraft:red_bed", + "minecraft:yellow_bed", + "minecraft:white_bed" ] ], "result": { diff --git a/data/minecraft/recipe/dye_pink_carpet.json b/data/minecraft/recipe/dye_pink_carpet.json index 48b9222d..7c7cfa0c 100644 --- a/data/minecraft/recipe/dye_pink_carpet.json +++ b/data/minecraft/recipe/dye_pink_carpet.json @@ -3,55 +3,23 @@ "category": "building", "group": "carpet", "ingredients": [ - { - "item": "minecraft:pink_dye" - }, + "minecraft:pink_dye", [ - { - "item": "minecraft:black_carpet" - }, - { - "item": "minecraft:blue_carpet" - }, - { - "item": "minecraft:brown_carpet" - }, - { - "item": "minecraft:cyan_carpet" - }, - { - "item": "minecraft:gray_carpet" - }, - { - "item": "minecraft:green_carpet" - }, - { - "item": "minecraft:light_blue_carpet" - }, - { - "item": "minecraft:light_gray_carpet" - }, - { - "item": "minecraft:lime_carpet" - }, - { - "item": "minecraft:magenta_carpet" - }, - { - "item": "minecraft:orange_carpet" - }, - { - "item": "minecraft:purple_carpet" - }, - { - "item": "minecraft:red_carpet" - }, - { - "item": "minecraft:yellow_carpet" - }, - { - "item": "minecraft:white_carpet" - } + "minecraft:black_carpet", + "minecraft:blue_carpet", + "minecraft:brown_carpet", + "minecraft:cyan_carpet", + "minecraft:gray_carpet", + "minecraft:green_carpet", + "minecraft:light_blue_carpet", + "minecraft:light_gray_carpet", + "minecraft:lime_carpet", + "minecraft:magenta_carpet", + "minecraft:orange_carpet", + "minecraft:purple_carpet", + "minecraft:red_carpet", + "minecraft:yellow_carpet", + "minecraft:white_carpet" ] ], "result": { diff --git a/data/minecraft/recipe/dye_pink_wool.json b/data/minecraft/recipe/dye_pink_wool.json index 59bedba0..09a9e2d3 100644 --- a/data/minecraft/recipe/dye_pink_wool.json +++ b/data/minecraft/recipe/dye_pink_wool.json @@ -3,55 +3,23 @@ "category": "building", "group": "wool", "ingredients": [ - { - "item": "minecraft:pink_dye" - }, + "minecraft:pink_dye", [ - { - "item": "minecraft:black_wool" - }, - { - "item": "minecraft:blue_wool" - }, - { - "item": "minecraft:brown_wool" - }, - { - "item": "minecraft:cyan_wool" - }, - { - "item": "minecraft:gray_wool" - }, - { - "item": "minecraft:green_wool" - }, - { - "item": "minecraft:light_blue_wool" - }, - { - "item": "minecraft:light_gray_wool" - }, - { - "item": "minecraft:lime_wool" - }, - { - "item": "minecraft:magenta_wool" - }, - { - "item": "minecraft:orange_wool" - }, - { - "item": "minecraft:purple_wool" - }, - { - "item": "minecraft:red_wool" - }, - { - "item": "minecraft:yellow_wool" - }, - { - "item": "minecraft:white_wool" - } + "minecraft:black_wool", + "minecraft:blue_wool", + "minecraft:brown_wool", + "minecraft:cyan_wool", + "minecraft:gray_wool", + "minecraft:green_wool", + "minecraft:light_blue_wool", + "minecraft:light_gray_wool", + "minecraft:lime_wool", + "minecraft:magenta_wool", + "minecraft:orange_wool", + "minecraft:purple_wool", + "minecraft:red_wool", + "minecraft:yellow_wool", + "minecraft:white_wool" ] ], "result": { diff --git a/data/minecraft/recipe/dye_purple_bed.json b/data/minecraft/recipe/dye_purple_bed.json index 49b2b4ef..219a474f 100644 --- a/data/minecraft/recipe/dye_purple_bed.json +++ b/data/minecraft/recipe/dye_purple_bed.json @@ -3,55 +3,23 @@ "category": "building", "group": "bed", "ingredients": [ - { - "item": "minecraft:purple_dye" - }, + "minecraft:purple_dye", [ - { - "item": "minecraft:black_bed" - }, - { - "item": "minecraft:blue_bed" - }, - { - "item": "minecraft:brown_bed" - }, - { - "item": "minecraft:cyan_bed" - }, - { - "item": "minecraft:gray_bed" - }, - { - "item": "minecraft:green_bed" - }, - { - "item": "minecraft:light_blue_bed" - }, - { - "item": "minecraft:light_gray_bed" - }, - { - "item": "minecraft:lime_bed" - }, - { - "item": "minecraft:magenta_bed" - }, - { - "item": "minecraft:orange_bed" - }, - { - "item": "minecraft:pink_bed" - }, - { - "item": "minecraft:red_bed" - }, - { - "item": "minecraft:yellow_bed" - }, - { - "item": "minecraft:white_bed" - } + "minecraft:black_bed", + "minecraft:blue_bed", + "minecraft:brown_bed", + "minecraft:cyan_bed", + "minecraft:gray_bed", + "minecraft:green_bed", + "minecraft:light_blue_bed", + "minecraft:light_gray_bed", + "minecraft:lime_bed", + "minecraft:magenta_bed", + "minecraft:orange_bed", + "minecraft:pink_bed", + "minecraft:red_bed", + "minecraft:yellow_bed", + "minecraft:white_bed" ] ], "result": { diff --git a/data/minecraft/recipe/dye_purple_carpet.json b/data/minecraft/recipe/dye_purple_carpet.json index d94688ea..ce58865c 100644 --- a/data/minecraft/recipe/dye_purple_carpet.json +++ b/data/minecraft/recipe/dye_purple_carpet.json @@ -3,55 +3,23 @@ "category": "building", "group": "carpet", "ingredients": [ - { - "item": "minecraft:purple_dye" - }, + "minecraft:purple_dye", [ - { - "item": "minecraft:black_carpet" - }, - { - "item": "minecraft:blue_carpet" - }, - { - "item": "minecraft:brown_carpet" - }, - { - "item": "minecraft:cyan_carpet" - }, - { - "item": "minecraft:gray_carpet" - }, - { - "item": "minecraft:green_carpet" - }, - { - "item": "minecraft:light_blue_carpet" - }, - { - "item": "minecraft:light_gray_carpet" - }, - { - "item": "minecraft:lime_carpet" - }, - { - "item": "minecraft:magenta_carpet" - }, - { - "item": "minecraft:orange_carpet" - }, - { - "item": "minecraft:pink_carpet" - }, - { - "item": "minecraft:red_carpet" - }, - { - "item": "minecraft:yellow_carpet" - }, - { - "item": "minecraft:white_carpet" - } + "minecraft:black_carpet", + "minecraft:blue_carpet", + "minecraft:brown_carpet", + "minecraft:cyan_carpet", + "minecraft:gray_carpet", + "minecraft:green_carpet", + "minecraft:light_blue_carpet", + "minecraft:light_gray_carpet", + "minecraft:lime_carpet", + "minecraft:magenta_carpet", + "minecraft:orange_carpet", + "minecraft:pink_carpet", + "minecraft:red_carpet", + "minecraft:yellow_carpet", + "minecraft:white_carpet" ] ], "result": { diff --git a/data/minecraft/recipe/dye_purple_wool.json b/data/minecraft/recipe/dye_purple_wool.json index 22691ef8..7aab76af 100644 --- a/data/minecraft/recipe/dye_purple_wool.json +++ b/data/minecraft/recipe/dye_purple_wool.json @@ -3,55 +3,23 @@ "category": "building", "group": "wool", "ingredients": [ - { - "item": "minecraft:purple_dye" - }, + "minecraft:purple_dye", [ - { - "item": "minecraft:black_wool" - }, - { - "item": "minecraft:blue_wool" - }, - { - "item": "minecraft:brown_wool" - }, - { - "item": "minecraft:cyan_wool" - }, - { - "item": "minecraft:gray_wool" - }, - { - "item": "minecraft:green_wool" - }, - { - "item": "minecraft:light_blue_wool" - }, - { - "item": "minecraft:light_gray_wool" - }, - { - "item": "minecraft:lime_wool" - }, - { - "item": "minecraft:magenta_wool" - }, - { - "item": "minecraft:orange_wool" - }, - { - "item": "minecraft:pink_wool" - }, - { - "item": "minecraft:red_wool" - }, - { - "item": "minecraft:yellow_wool" - }, - { - "item": "minecraft:white_wool" - } + "minecraft:black_wool", + "minecraft:blue_wool", + "minecraft:brown_wool", + "minecraft:cyan_wool", + "minecraft:gray_wool", + "minecraft:green_wool", + "minecraft:light_blue_wool", + "minecraft:light_gray_wool", + "minecraft:lime_wool", + "minecraft:magenta_wool", + "minecraft:orange_wool", + "minecraft:pink_wool", + "minecraft:red_wool", + "minecraft:yellow_wool", + "minecraft:white_wool" ] ], "result": { diff --git a/data/minecraft/recipe/dye_red_bed.json b/data/minecraft/recipe/dye_red_bed.json index aedc9b8a..2f89edc5 100644 --- a/data/minecraft/recipe/dye_red_bed.json +++ b/data/minecraft/recipe/dye_red_bed.json @@ -3,55 +3,23 @@ "category": "building", "group": "bed", "ingredients": [ - { - "item": "minecraft:red_dye" - }, + "minecraft:red_dye", [ - { - "item": "minecraft:black_bed" - }, - { - "item": "minecraft:blue_bed" - }, - { - "item": "minecraft:brown_bed" - }, - { - "item": "minecraft:cyan_bed" - }, - { - "item": "minecraft:gray_bed" - }, - { - "item": "minecraft:green_bed" - }, - { - "item": "minecraft:light_blue_bed" - }, - { - "item": "minecraft:light_gray_bed" - }, - { - "item": "minecraft:lime_bed" - }, - { - "item": "minecraft:magenta_bed" - }, - { - "item": "minecraft:orange_bed" - }, - { - "item": "minecraft:pink_bed" - }, - { - "item": "minecraft:purple_bed" - }, - { - "item": "minecraft:yellow_bed" - }, - { - "item": "minecraft:white_bed" - } + "minecraft:black_bed", + "minecraft:blue_bed", + "minecraft:brown_bed", + "minecraft:cyan_bed", + "minecraft:gray_bed", + "minecraft:green_bed", + "minecraft:light_blue_bed", + "minecraft:light_gray_bed", + "minecraft:lime_bed", + "minecraft:magenta_bed", + "minecraft:orange_bed", + "minecraft:pink_bed", + "minecraft:purple_bed", + "minecraft:yellow_bed", + "minecraft:white_bed" ] ], "result": { diff --git a/data/minecraft/recipe/dye_red_carpet.json b/data/minecraft/recipe/dye_red_carpet.json index 17a0bfb0..f675d58b 100644 --- a/data/minecraft/recipe/dye_red_carpet.json +++ b/data/minecraft/recipe/dye_red_carpet.json @@ -3,55 +3,23 @@ "category": "building", "group": "carpet", "ingredients": [ - { - "item": "minecraft:red_dye" - }, + "minecraft:red_dye", [ - { - "item": "minecraft:black_carpet" - }, - { - "item": "minecraft:blue_carpet" - }, - { - "item": "minecraft:brown_carpet" - }, - { - "item": "minecraft:cyan_carpet" - }, - { - "item": "minecraft:gray_carpet" - }, - { - "item": "minecraft:green_carpet" - }, - { - "item": "minecraft:light_blue_carpet" - }, - { - "item": "minecraft:light_gray_carpet" - }, - { - "item": "minecraft:lime_carpet" - }, - { - "item": "minecraft:magenta_carpet" - }, - { - "item": "minecraft:orange_carpet" - }, - { - "item": "minecraft:pink_carpet" - }, - { - "item": "minecraft:purple_carpet" - }, - { - "item": "minecraft:yellow_carpet" - }, - { - "item": "minecraft:white_carpet" - } + "minecraft:black_carpet", + "minecraft:blue_carpet", + "minecraft:brown_carpet", + "minecraft:cyan_carpet", + "minecraft:gray_carpet", + "minecraft:green_carpet", + "minecraft:light_blue_carpet", + "minecraft:light_gray_carpet", + "minecraft:lime_carpet", + "minecraft:magenta_carpet", + "minecraft:orange_carpet", + "minecraft:pink_carpet", + "minecraft:purple_carpet", + "minecraft:yellow_carpet", + "minecraft:white_carpet" ] ], "result": { diff --git a/data/minecraft/recipe/dye_red_wool.json b/data/minecraft/recipe/dye_red_wool.json index 09fffff0..4914bb76 100644 --- a/data/minecraft/recipe/dye_red_wool.json +++ b/data/minecraft/recipe/dye_red_wool.json @@ -3,55 +3,23 @@ "category": "building", "group": "wool", "ingredients": [ - { - "item": "minecraft:red_dye" - }, + "minecraft:red_dye", [ - { - "item": "minecraft:black_wool" - }, - { - "item": "minecraft:blue_wool" - }, - { - "item": "minecraft:brown_wool" - }, - { - "item": "minecraft:cyan_wool" - }, - { - "item": "minecraft:gray_wool" - }, - { - "item": "minecraft:green_wool" - }, - { - "item": "minecraft:light_blue_wool" - }, - { - "item": "minecraft:light_gray_wool" - }, - { - "item": "minecraft:lime_wool" - }, - { - "item": "minecraft:magenta_wool" - }, - { - "item": "minecraft:orange_wool" - }, - { - "item": "minecraft:pink_wool" - }, - { - "item": "minecraft:purple_wool" - }, - { - "item": "minecraft:yellow_wool" - }, - { - "item": "minecraft:white_wool" - } + "minecraft:black_wool", + "minecraft:blue_wool", + "minecraft:brown_wool", + "minecraft:cyan_wool", + "minecraft:gray_wool", + "minecraft:green_wool", + "minecraft:light_blue_wool", + "minecraft:light_gray_wool", + "minecraft:lime_wool", + "minecraft:magenta_wool", + "minecraft:orange_wool", + "minecraft:pink_wool", + "minecraft:purple_wool", + "minecraft:yellow_wool", + "minecraft:white_wool" ] ], "result": { diff --git a/data/minecraft/recipe/dye_white_bed.json b/data/minecraft/recipe/dye_white_bed.json index 887ce0a5..8a8289db 100644 --- a/data/minecraft/recipe/dye_white_bed.json +++ b/data/minecraft/recipe/dye_white_bed.json @@ -3,55 +3,23 @@ "category": "building", "group": "bed", "ingredients": [ - { - "item": "minecraft:white_dye" - }, + "minecraft:white_dye", [ - { - "item": "minecraft:black_bed" - }, - { - "item": "minecraft:blue_bed" - }, - { - "item": "minecraft:brown_bed" - }, - { - "item": "minecraft:cyan_bed" - }, - { - "item": "minecraft:gray_bed" - }, - { - "item": "minecraft:green_bed" - }, - { - "item": "minecraft:light_blue_bed" - }, - { - "item": "minecraft:light_gray_bed" - }, - { - "item": "minecraft:lime_bed" - }, - { - "item": "minecraft:magenta_bed" - }, - { - "item": "minecraft:orange_bed" - }, - { - "item": "minecraft:pink_bed" - }, - { - "item": "minecraft:purple_bed" - }, - { - "item": "minecraft:red_bed" - }, - { - "item": "minecraft:yellow_bed" - } + "minecraft:black_bed", + "minecraft:blue_bed", + "minecraft:brown_bed", + "minecraft:cyan_bed", + "minecraft:gray_bed", + "minecraft:green_bed", + "minecraft:light_blue_bed", + "minecraft:light_gray_bed", + "minecraft:lime_bed", + "minecraft:magenta_bed", + "minecraft:orange_bed", + "minecraft:pink_bed", + "minecraft:purple_bed", + "minecraft:red_bed", + "minecraft:yellow_bed" ] ], "result": { diff --git a/data/minecraft/recipe/dye_white_carpet.json b/data/minecraft/recipe/dye_white_carpet.json index 3b367585..7d838bf0 100644 --- a/data/minecraft/recipe/dye_white_carpet.json +++ b/data/minecraft/recipe/dye_white_carpet.json @@ -3,55 +3,23 @@ "category": "building", "group": "carpet", "ingredients": [ - { - "item": "minecraft:white_dye" - }, + "minecraft:white_dye", [ - { - "item": "minecraft:black_carpet" - }, - { - "item": "minecraft:blue_carpet" - }, - { - "item": "minecraft:brown_carpet" - }, - { - "item": "minecraft:cyan_carpet" - }, - { - "item": "minecraft:gray_carpet" - }, - { - "item": "minecraft:green_carpet" - }, - { - "item": "minecraft:light_blue_carpet" - }, - { - "item": "minecraft:light_gray_carpet" - }, - { - "item": "minecraft:lime_carpet" - }, - { - "item": "minecraft:magenta_carpet" - }, - { - "item": "minecraft:orange_carpet" - }, - { - "item": "minecraft:pink_carpet" - }, - { - "item": "minecraft:purple_carpet" - }, - { - "item": "minecraft:red_carpet" - }, - { - "item": "minecraft:yellow_carpet" - } + "minecraft:black_carpet", + "minecraft:blue_carpet", + "minecraft:brown_carpet", + "minecraft:cyan_carpet", + "minecraft:gray_carpet", + "minecraft:green_carpet", + "minecraft:light_blue_carpet", + "minecraft:light_gray_carpet", + "minecraft:lime_carpet", + "minecraft:magenta_carpet", + "minecraft:orange_carpet", + "minecraft:pink_carpet", + "minecraft:purple_carpet", + "minecraft:red_carpet", + "minecraft:yellow_carpet" ] ], "result": { diff --git a/data/minecraft/recipe/dye_white_wool.json b/data/minecraft/recipe/dye_white_wool.json index c8aa58d9..5afd8c7b 100644 --- a/data/minecraft/recipe/dye_white_wool.json +++ b/data/minecraft/recipe/dye_white_wool.json @@ -3,55 +3,23 @@ "category": "building", "group": "wool", "ingredients": [ - { - "item": "minecraft:white_dye" - }, + "minecraft:white_dye", [ - { - "item": "minecraft:black_wool" - }, - { - "item": "minecraft:blue_wool" - }, - { - "item": "minecraft:brown_wool" - }, - { - "item": "minecraft:cyan_wool" - }, - { - "item": "minecraft:gray_wool" - }, - { - "item": "minecraft:green_wool" - }, - { - "item": "minecraft:light_blue_wool" - }, - { - "item": "minecraft:light_gray_wool" - }, - { - "item": "minecraft:lime_wool" - }, - { - "item": "minecraft:magenta_wool" - }, - { - "item": "minecraft:orange_wool" - }, - { - "item": "minecraft:pink_wool" - }, - { - "item": "minecraft:purple_wool" - }, - { - "item": "minecraft:red_wool" - }, - { - "item": "minecraft:yellow_wool" - } + "minecraft:black_wool", + "minecraft:blue_wool", + "minecraft:brown_wool", + "minecraft:cyan_wool", + "minecraft:gray_wool", + "minecraft:green_wool", + "minecraft:light_blue_wool", + "minecraft:light_gray_wool", + "minecraft:lime_wool", + "minecraft:magenta_wool", + "minecraft:orange_wool", + "minecraft:pink_wool", + "minecraft:purple_wool", + "minecraft:red_wool", + "minecraft:yellow_wool" ] ], "result": { diff --git a/data/minecraft/recipe/dye_yellow_bed.json b/data/minecraft/recipe/dye_yellow_bed.json index ab03d535..43fe9ea1 100644 --- a/data/minecraft/recipe/dye_yellow_bed.json +++ b/data/minecraft/recipe/dye_yellow_bed.json @@ -3,55 +3,23 @@ "category": "building", "group": "bed", "ingredients": [ - { - "item": "minecraft:yellow_dye" - }, + "minecraft:yellow_dye", [ - { - "item": "minecraft:black_bed" - }, - { - "item": "minecraft:blue_bed" - }, - { - "item": "minecraft:brown_bed" - }, - { - "item": "minecraft:cyan_bed" - }, - { - "item": "minecraft:gray_bed" - }, - { - "item": "minecraft:green_bed" - }, - { - "item": "minecraft:light_blue_bed" - }, - { - "item": "minecraft:light_gray_bed" - }, - { - "item": "minecraft:lime_bed" - }, - { - "item": "minecraft:magenta_bed" - }, - { - "item": "minecraft:orange_bed" - }, - { - "item": "minecraft:pink_bed" - }, - { - "item": "minecraft:purple_bed" - }, - { - "item": "minecraft:red_bed" - }, - { - "item": "minecraft:white_bed" - } + "minecraft:black_bed", + "minecraft:blue_bed", + "minecraft:brown_bed", + "minecraft:cyan_bed", + "minecraft:gray_bed", + "minecraft:green_bed", + "minecraft:light_blue_bed", + "minecraft:light_gray_bed", + "minecraft:lime_bed", + "minecraft:magenta_bed", + "minecraft:orange_bed", + "minecraft:pink_bed", + "minecraft:purple_bed", + "minecraft:red_bed", + "minecraft:white_bed" ] ], "result": { diff --git a/data/minecraft/recipe/dye_yellow_carpet.json b/data/minecraft/recipe/dye_yellow_carpet.json index 5aa13b3b..8c0c3198 100644 --- a/data/minecraft/recipe/dye_yellow_carpet.json +++ b/data/minecraft/recipe/dye_yellow_carpet.json @@ -3,55 +3,23 @@ "category": "building", "group": "carpet", "ingredients": [ - { - "item": "minecraft:yellow_dye" - }, + "minecraft:yellow_dye", [ - { - "item": "minecraft:black_carpet" - }, - { - "item": "minecraft:blue_carpet" - }, - { - "item": "minecraft:brown_carpet" - }, - { - "item": "minecraft:cyan_carpet" - }, - { - "item": "minecraft:gray_carpet" - }, - { - "item": "minecraft:green_carpet" - }, - { - "item": "minecraft:light_blue_carpet" - }, - { - "item": "minecraft:light_gray_carpet" - }, - { - "item": "minecraft:lime_carpet" - }, - { - "item": "minecraft:magenta_carpet" - }, - { - "item": "minecraft:orange_carpet" - }, - { - "item": "minecraft:pink_carpet" - }, - { - "item": "minecraft:purple_carpet" - }, - { - "item": "minecraft:red_carpet" - }, - { - "item": "minecraft:white_carpet" - } + "minecraft:black_carpet", + "minecraft:blue_carpet", + "minecraft:brown_carpet", + "minecraft:cyan_carpet", + "minecraft:gray_carpet", + "minecraft:green_carpet", + "minecraft:light_blue_carpet", + "minecraft:light_gray_carpet", + "minecraft:lime_carpet", + "minecraft:magenta_carpet", + "minecraft:orange_carpet", + "minecraft:pink_carpet", + "minecraft:purple_carpet", + "minecraft:red_carpet", + "minecraft:white_carpet" ] ], "result": { diff --git a/data/minecraft/recipe/dye_yellow_wool.json b/data/minecraft/recipe/dye_yellow_wool.json index 55a3889c..4c17a7c6 100644 --- a/data/minecraft/recipe/dye_yellow_wool.json +++ b/data/minecraft/recipe/dye_yellow_wool.json @@ -3,55 +3,23 @@ "category": "building", "group": "wool", "ingredients": [ - { - "item": "minecraft:yellow_dye" - }, + "minecraft:yellow_dye", [ - { - "item": "minecraft:black_wool" - }, - { - "item": "minecraft:blue_wool" - }, - { - "item": "minecraft:brown_wool" - }, - { - "item": "minecraft:cyan_wool" - }, - { - "item": "minecraft:gray_wool" - }, - { - "item": "minecraft:green_wool" - }, - { - "item": "minecraft:light_blue_wool" - }, - { - "item": "minecraft:light_gray_wool" - }, - { - "item": "minecraft:lime_wool" - }, - { - "item": "minecraft:magenta_wool" - }, - { - "item": "minecraft:orange_wool" - }, - { - "item": "minecraft:pink_wool" - }, - { - "item": "minecraft:purple_wool" - }, - { - "item": "minecraft:red_wool" - }, - { - "item": "minecraft:white_wool" - } + "minecraft:black_wool", + "minecraft:blue_wool", + "minecraft:brown_wool", + "minecraft:cyan_wool", + "minecraft:gray_wool", + "minecraft:green_wool", + "minecraft:light_blue_wool", + "minecraft:light_gray_wool", + "minecraft:lime_wool", + "minecraft:magenta_wool", + "minecraft:orange_wool", + "minecraft:pink_wool", + "minecraft:purple_wool", + "minecraft:red_wool", + "minecraft:white_wool" ] ], "result": { diff --git a/data/minecraft/recipe/emerald.json b/data/minecraft/recipe/emerald.json index 96f03835..d73d37b3 100644 --- a/data/minecraft/recipe/emerald.json +++ b/data/minecraft/recipe/emerald.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shapeless", "category": "misc", "ingredients": [ - { - "item": "minecraft:emerald_block" - } + "minecraft:emerald_block" ], "result": { "count": 9, diff --git a/data/minecraft/recipe/emerald_block.json b/data/minecraft/recipe/emerald_block.json index b68f0c32..6677b29a 100644 --- a/data/minecraft/recipe/emerald_block.json +++ b/data/minecraft/recipe/emerald_block.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:emerald" - } + "#": "minecraft:emerald" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/emerald_from_blasting_deepslate_emerald_ore.json b/data/minecraft/recipe/emerald_from_blasting_deepslate_emerald_ore.json index ecb1180c..c23b739c 100644 --- a/data/minecraft/recipe/emerald_from_blasting_deepslate_emerald_ore.json +++ b/data/minecraft/recipe/emerald_from_blasting_deepslate_emerald_ore.json @@ -4,9 +4,7 @@ "cookingtime": 100, "experience": 1.0, "group": "emerald", - "ingredient": { - "item": "minecraft:deepslate_emerald_ore" - }, + "ingredient": "minecraft:deepslate_emerald_ore", "result": { "id": "minecraft:emerald" } diff --git a/data/minecraft/recipe/emerald_from_blasting_emerald_ore.json b/data/minecraft/recipe/emerald_from_blasting_emerald_ore.json index dcc6df66..d04d4c14 100644 --- a/data/minecraft/recipe/emerald_from_blasting_emerald_ore.json +++ b/data/minecraft/recipe/emerald_from_blasting_emerald_ore.json @@ -4,9 +4,7 @@ "cookingtime": 100, "experience": 1.0, "group": "emerald", - "ingredient": { - "item": "minecraft:emerald_ore" - }, + "ingredient": "minecraft:emerald_ore", "result": { "id": "minecraft:emerald" } diff --git a/data/minecraft/recipe/emerald_from_smelting_deepslate_emerald_ore.json b/data/minecraft/recipe/emerald_from_smelting_deepslate_emerald_ore.json index d50d58a4..4b0405a8 100644 --- a/data/minecraft/recipe/emerald_from_smelting_deepslate_emerald_ore.json +++ b/data/minecraft/recipe/emerald_from_smelting_deepslate_emerald_ore.json @@ -4,9 +4,7 @@ "cookingtime": 200, "experience": 1.0, "group": "emerald", - "ingredient": { - "item": "minecraft:deepslate_emerald_ore" - }, + "ingredient": "minecraft:deepslate_emerald_ore", "result": { "id": "minecraft:emerald" } diff --git a/data/minecraft/recipe/emerald_from_smelting_emerald_ore.json b/data/minecraft/recipe/emerald_from_smelting_emerald_ore.json index fe932fd2..83165dcd 100644 --- a/data/minecraft/recipe/emerald_from_smelting_emerald_ore.json +++ b/data/minecraft/recipe/emerald_from_smelting_emerald_ore.json @@ -4,9 +4,7 @@ "cookingtime": 200, "experience": 1.0, "group": "emerald", - "ingredient": { - "item": "minecraft:emerald_ore" - }, + "ingredient": "minecraft:emerald_ore", "result": { "id": "minecraft:emerald" } diff --git a/data/minecraft/recipe/enchanting_table.json b/data/minecraft/recipe/enchanting_table.json index bc62b875..37a48880 100644 --- a/data/minecraft/recipe/enchanting_table.json +++ b/data/minecraft/recipe/enchanting_table.json @@ -2,15 +2,9 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "#": { - "item": "minecraft:obsidian" - }, - "B": { - "item": "minecraft:book" - }, - "D": { - "item": "minecraft:diamond" - } + "#": "minecraft:obsidian", + "B": "minecraft:book", + "D": "minecraft:diamond" }, "pattern": [ " B ", diff --git a/data/minecraft/recipe/end_crystal.json b/data/minecraft/recipe/end_crystal.json index a438d41f..cb5eea90 100644 --- a/data/minecraft/recipe/end_crystal.json +++ b/data/minecraft/recipe/end_crystal.json @@ -2,15 +2,9 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "E": { - "item": "minecraft:ender_eye" - }, - "G": { - "item": "minecraft:glass" - }, - "T": { - "item": "minecraft:ghast_tear" - } + "E": "minecraft:ender_eye", + "G": "minecraft:glass", + "T": "minecraft:ghast_tear" }, "pattern": [ "GGG", diff --git a/data/minecraft/recipe/end_rod.json b/data/minecraft/recipe/end_rod.json index f66dc895..853da087 100644 --- a/data/minecraft/recipe/end_rod.json +++ b/data/minecraft/recipe/end_rod.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "#": { - "item": "minecraft:popped_chorus_fruit" - }, - "/": { - "item": "minecraft:blaze_rod" - } + "#": "minecraft:popped_chorus_fruit", + "/": "minecraft:blaze_rod" }, "pattern": [ "/", diff --git a/data/minecraft/recipe/end_stone_brick_slab.json b/data/minecraft/recipe/end_stone_brick_slab.json index 01d42ea1..e34cc9a5 100644 --- a/data/minecraft/recipe/end_stone_brick_slab.json +++ b/data/minecraft/recipe/end_stone_brick_slab.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:end_stone_bricks" - } + "#": "minecraft:end_stone_bricks" }, "pattern": [ "###" diff --git a/data/minecraft/recipe/end_stone_brick_slab_from_end_stone_brick_stonecutting.json b/data/minecraft/recipe/end_stone_brick_slab_from_end_stone_brick_stonecutting.json index 05464868..c2b8d7eb 100644 --- a/data/minecraft/recipe/end_stone_brick_slab_from_end_stone_brick_stonecutting.json +++ b/data/minecraft/recipe/end_stone_brick_slab_from_end_stone_brick_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:end_stone_bricks" - }, + "ingredient": "minecraft:end_stone_bricks", "result": { "count": 2, "id": "minecraft:end_stone_brick_slab" diff --git a/data/minecraft/recipe/end_stone_brick_slab_from_end_stone_stonecutting.json b/data/minecraft/recipe/end_stone_brick_slab_from_end_stone_stonecutting.json index 497b74bd..ac14a317 100644 --- a/data/minecraft/recipe/end_stone_brick_slab_from_end_stone_stonecutting.json +++ b/data/minecraft/recipe/end_stone_brick_slab_from_end_stone_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:end_stone" - }, + "ingredient": "minecraft:end_stone", "result": { "count": 2, "id": "minecraft:end_stone_brick_slab" diff --git a/data/minecraft/recipe/end_stone_brick_stairs.json b/data/minecraft/recipe/end_stone_brick_stairs.json index cd33f7d5..ca477374 100644 --- a/data/minecraft/recipe/end_stone_brick_stairs.json +++ b/data/minecraft/recipe/end_stone_brick_stairs.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:end_stone_bricks" - } + "#": "minecraft:end_stone_bricks" }, "pattern": [ "# ", diff --git a/data/minecraft/recipe/end_stone_brick_stairs_from_end_stone_brick_stonecutting.json b/data/minecraft/recipe/end_stone_brick_stairs_from_end_stone_brick_stonecutting.json index 1fd9a2cc..326e62e0 100644 --- a/data/minecraft/recipe/end_stone_brick_stairs_from_end_stone_brick_stonecutting.json +++ b/data/minecraft/recipe/end_stone_brick_stairs_from_end_stone_brick_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:end_stone_bricks" - }, + "ingredient": "minecraft:end_stone_bricks", "result": { "count": 1, "id": "minecraft:end_stone_brick_stairs" diff --git a/data/minecraft/recipe/end_stone_brick_stairs_from_end_stone_stonecutting.json b/data/minecraft/recipe/end_stone_brick_stairs_from_end_stone_stonecutting.json index 334b5b97..4ec28d0f 100644 --- a/data/minecraft/recipe/end_stone_brick_stairs_from_end_stone_stonecutting.json +++ b/data/minecraft/recipe/end_stone_brick_stairs_from_end_stone_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:end_stone" - }, + "ingredient": "minecraft:end_stone", "result": { "count": 1, "id": "minecraft:end_stone_brick_stairs" diff --git a/data/minecraft/recipe/end_stone_brick_wall.json b/data/minecraft/recipe/end_stone_brick_wall.json index e91612b8..2ab3a52b 100644 --- a/data/minecraft/recipe/end_stone_brick_wall.json +++ b/data/minecraft/recipe/end_stone_brick_wall.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "#": { - "item": "minecraft:end_stone_bricks" - } + "#": "minecraft:end_stone_bricks" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/end_stone_brick_wall_from_end_stone_brick_stonecutting.json b/data/minecraft/recipe/end_stone_brick_wall_from_end_stone_brick_stonecutting.json index e7b8011f..acdcb24a 100644 --- a/data/minecraft/recipe/end_stone_brick_wall_from_end_stone_brick_stonecutting.json +++ b/data/minecraft/recipe/end_stone_brick_wall_from_end_stone_brick_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:end_stone_bricks" - }, + "ingredient": "minecraft:end_stone_bricks", "result": { "count": 1, "id": "minecraft:end_stone_brick_wall" diff --git a/data/minecraft/recipe/end_stone_brick_wall_from_end_stone_stonecutting.json b/data/minecraft/recipe/end_stone_brick_wall_from_end_stone_stonecutting.json index e8bbff83..2851f15c 100644 --- a/data/minecraft/recipe/end_stone_brick_wall_from_end_stone_stonecutting.json +++ b/data/minecraft/recipe/end_stone_brick_wall_from_end_stone_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:end_stone" - }, + "ingredient": "minecraft:end_stone", "result": { "count": 1, "id": "minecraft:end_stone_brick_wall" diff --git a/data/minecraft/recipe/end_stone_bricks.json b/data/minecraft/recipe/end_stone_bricks.json index bafeb98f..91c83005 100644 --- a/data/minecraft/recipe/end_stone_bricks.json +++ b/data/minecraft/recipe/end_stone_bricks.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:end_stone" - } + "#": "minecraft:end_stone" }, "pattern": [ "##", diff --git a/data/minecraft/recipe/end_stone_bricks_from_end_stone_stonecutting.json b/data/minecraft/recipe/end_stone_bricks_from_end_stone_stonecutting.json index bd26ec4e..ab4887bf 100644 --- a/data/minecraft/recipe/end_stone_bricks_from_end_stone_stonecutting.json +++ b/data/minecraft/recipe/end_stone_bricks_from_end_stone_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:end_stone" - }, + "ingredient": "minecraft:end_stone", "result": { "count": 1, "id": "minecraft:end_stone_bricks" diff --git a/data/minecraft/recipe/ender_chest.json b/data/minecraft/recipe/ender_chest.json index d6cb47ff..ba649c56 100644 --- a/data/minecraft/recipe/ender_chest.json +++ b/data/minecraft/recipe/ender_chest.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "#": { - "item": "minecraft:obsidian" - }, - "E": { - "item": "minecraft:ender_eye" - } + "#": "minecraft:obsidian", + "E": "minecraft:ender_eye" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/ender_eye.json b/data/minecraft/recipe/ender_eye.json index 264e5200..9e8bdfc1 100644 --- a/data/minecraft/recipe/ender_eye.json +++ b/data/minecraft/recipe/ender_eye.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shapeless", "category": "misc", "ingredients": [ - { - "item": "minecraft:ender_pearl" - }, - { - "item": "minecraft:blaze_powder" - } + "minecraft:ender_pearl", + "minecraft:blaze_powder" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/exposed_chiseled_copper.json b/data/minecraft/recipe/exposed_chiseled_copper.json index d1a9ece3..bb5b36f8 100644 --- a/data/minecraft/recipe/exposed_chiseled_copper.json +++ b/data/minecraft/recipe/exposed_chiseled_copper.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:exposed_cut_copper_slab" - } + "#": "minecraft:exposed_cut_copper_slab" }, "pattern": [ "#", diff --git a/data/minecraft/recipe/exposed_chiseled_copper_from_exposed_copper_stonecutting.json b/data/minecraft/recipe/exposed_chiseled_copper_from_exposed_copper_stonecutting.json index 1c6a3337..6c5e9236 100644 --- a/data/minecraft/recipe/exposed_chiseled_copper_from_exposed_copper_stonecutting.json +++ b/data/minecraft/recipe/exposed_chiseled_copper_from_exposed_copper_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:exposed_copper" - }, + "ingredient": "minecraft:exposed_copper", "result": { "count": 4, "id": "minecraft:exposed_chiseled_copper" diff --git a/data/minecraft/recipe/exposed_chiseled_copper_from_exposed_cut_copper_stonecutting.json b/data/minecraft/recipe/exposed_chiseled_copper_from_exposed_cut_copper_stonecutting.json index 38fca63e..73cbe9d3 100644 --- a/data/minecraft/recipe/exposed_chiseled_copper_from_exposed_cut_copper_stonecutting.json +++ b/data/minecraft/recipe/exposed_chiseled_copper_from_exposed_cut_copper_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:exposed_cut_copper" - }, + "ingredient": "minecraft:exposed_cut_copper", "result": { "count": 1, "id": "minecraft:exposed_chiseled_copper" diff --git a/data/minecraft/recipe/exposed_copper_bulb.json b/data/minecraft/recipe/exposed_copper_bulb.json index 93088c50..16a5d41c 100644 --- a/data/minecraft/recipe/exposed_copper_bulb.json +++ b/data/minecraft/recipe/exposed_copper_bulb.json @@ -2,15 +2,9 @@ "type": "minecraft:crafting_shaped", "category": "redstone", "key": { - "B": { - "item": "minecraft:blaze_rod" - }, - "C": { - "item": "minecraft:exposed_copper" - }, - "R": { - "item": "minecraft:redstone" - } + "B": "minecraft:blaze_rod", + "C": "minecraft:exposed_copper", + "R": "minecraft:redstone" }, "pattern": [ " C ", diff --git a/data/minecraft/recipe/exposed_copper_grate.json b/data/minecraft/recipe/exposed_copper_grate.json index e880d4a7..8d3472da 100644 --- a/data/minecraft/recipe/exposed_copper_grate.json +++ b/data/minecraft/recipe/exposed_copper_grate.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "M": { - "item": "minecraft:exposed_copper" - } + "M": "minecraft:exposed_copper" }, "pattern": [ " M ", diff --git a/data/minecraft/recipe/exposed_copper_grate_from_exposed_copper_stonecutting.json b/data/minecraft/recipe/exposed_copper_grate_from_exposed_copper_stonecutting.json index fd3ea731..bb6b55e8 100644 --- a/data/minecraft/recipe/exposed_copper_grate_from_exposed_copper_stonecutting.json +++ b/data/minecraft/recipe/exposed_copper_grate_from_exposed_copper_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:exposed_copper" - }, + "ingredient": "minecraft:exposed_copper", "result": { "count": 4, "id": "minecraft:exposed_copper_grate" diff --git a/data/minecraft/recipe/exposed_cut_copper.json b/data/minecraft/recipe/exposed_cut_copper.json index eb84db91..df84550f 100644 --- a/data/minecraft/recipe/exposed_cut_copper.json +++ b/data/minecraft/recipe/exposed_cut_copper.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:exposed_copper" - } + "#": "minecraft:exposed_copper" }, "pattern": [ "##", diff --git a/data/minecraft/recipe/exposed_cut_copper_from_exposed_copper_stonecutting.json b/data/minecraft/recipe/exposed_cut_copper_from_exposed_copper_stonecutting.json index 7d98a7bc..8f5084fd 100644 --- a/data/minecraft/recipe/exposed_cut_copper_from_exposed_copper_stonecutting.json +++ b/data/minecraft/recipe/exposed_cut_copper_from_exposed_copper_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:exposed_copper" - }, + "ingredient": "minecraft:exposed_copper", "result": { "count": 4, "id": "minecraft:exposed_cut_copper" diff --git a/data/minecraft/recipe/exposed_cut_copper_slab.json b/data/minecraft/recipe/exposed_cut_copper_slab.json index 0f3f9531..34e6c7fd 100644 --- a/data/minecraft/recipe/exposed_cut_copper_slab.json +++ b/data/minecraft/recipe/exposed_cut_copper_slab.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:exposed_cut_copper" - } + "#": "minecraft:exposed_cut_copper" }, "pattern": [ "###" diff --git a/data/minecraft/recipe/exposed_cut_copper_slab_from_exposed_copper_stonecutting.json b/data/minecraft/recipe/exposed_cut_copper_slab_from_exposed_copper_stonecutting.json index 02ecce16..640c73f0 100644 --- a/data/minecraft/recipe/exposed_cut_copper_slab_from_exposed_copper_stonecutting.json +++ b/data/minecraft/recipe/exposed_cut_copper_slab_from_exposed_copper_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:exposed_copper" - }, + "ingredient": "minecraft:exposed_copper", "result": { "count": 8, "id": "minecraft:exposed_cut_copper_slab" diff --git a/data/minecraft/recipe/exposed_cut_copper_slab_from_exposed_cut_copper_stonecutting.json b/data/minecraft/recipe/exposed_cut_copper_slab_from_exposed_cut_copper_stonecutting.json index 8cf8e026..c1980128 100644 --- a/data/minecraft/recipe/exposed_cut_copper_slab_from_exposed_cut_copper_stonecutting.json +++ b/data/minecraft/recipe/exposed_cut_copper_slab_from_exposed_cut_copper_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:exposed_cut_copper" - }, + "ingredient": "minecraft:exposed_cut_copper", "result": { "count": 2, "id": "minecraft:exposed_cut_copper_slab" diff --git a/data/minecraft/recipe/exposed_cut_copper_stairs.json b/data/minecraft/recipe/exposed_cut_copper_stairs.json index 3626f56d..7e775ef5 100644 --- a/data/minecraft/recipe/exposed_cut_copper_stairs.json +++ b/data/minecraft/recipe/exposed_cut_copper_stairs.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:exposed_cut_copper" - } + "#": "minecraft:exposed_cut_copper" }, "pattern": [ "# ", diff --git a/data/minecraft/recipe/exposed_cut_copper_stairs_from_exposed_copper_stonecutting.json b/data/minecraft/recipe/exposed_cut_copper_stairs_from_exposed_copper_stonecutting.json index dbef92ba..8ca343e0 100644 --- a/data/minecraft/recipe/exposed_cut_copper_stairs_from_exposed_copper_stonecutting.json +++ b/data/minecraft/recipe/exposed_cut_copper_stairs_from_exposed_copper_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:exposed_copper" - }, + "ingredient": "minecraft:exposed_copper", "result": { "count": 4, "id": "minecraft:exposed_cut_copper_stairs" diff --git a/data/minecraft/recipe/exposed_cut_copper_stairs_from_exposed_cut_copper_stonecutting.json b/data/minecraft/recipe/exposed_cut_copper_stairs_from_exposed_cut_copper_stonecutting.json index 8a7c5245..b9993f76 100644 --- a/data/minecraft/recipe/exposed_cut_copper_stairs_from_exposed_cut_copper_stonecutting.json +++ b/data/minecraft/recipe/exposed_cut_copper_stairs_from_exposed_cut_copper_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:exposed_cut_copper" - }, + "ingredient": "minecraft:exposed_cut_copper", "result": { "count": 1, "id": "minecraft:exposed_cut_copper_stairs" diff --git a/data/minecraft/recipe/eye_armor_trim_smithing_template.json b/data/minecraft/recipe/eye_armor_trim_smithing_template.json index 79ab628a..778df4fe 100644 --- a/data/minecraft/recipe/eye_armor_trim_smithing_template.json +++ b/data/minecraft/recipe/eye_armor_trim_smithing_template.json @@ -2,15 +2,9 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "#": { - "item": "minecraft:diamond" - }, - "C": { - "item": "minecraft:end_stone" - }, - "S": { - "item": "minecraft:eye_armor_trim_smithing_template" - } + "#": "minecraft:diamond", + "C": "minecraft:end_stone", + "S": "minecraft:eye_armor_trim_smithing_template" }, "pattern": [ "#S#", diff --git a/data/minecraft/recipe/eye_armor_trim_smithing_template_smithing_trim.json b/data/minecraft/recipe/eye_armor_trim_smithing_template_smithing_trim.json index 0358a6cd..a7d5d3e8 100644 --- a/data/minecraft/recipe/eye_armor_trim_smithing_template_smithing_trim.json +++ b/data/minecraft/recipe/eye_armor_trim_smithing_template_smithing_trim.json @@ -1,12 +1,6 @@ { "type": "minecraft:smithing_trim", - "addition": { - "tag": "minecraft:trim_materials" - }, - "base": { - "tag": "minecraft:trimmable_armor" - }, - "template": { - "item": "minecraft:eye_armor_trim_smithing_template" - } + "addition": "#minecraft:trim_materials", + "base": "#minecraft:trimmable_armor", + "template": "minecraft:eye_armor_trim_smithing_template" } \ No newline at end of file diff --git a/data/minecraft/recipe/fermented_spider_eye.json b/data/minecraft/recipe/fermented_spider_eye.json index 52bbb138..37107da8 100644 --- a/data/minecraft/recipe/fermented_spider_eye.json +++ b/data/minecraft/recipe/fermented_spider_eye.json @@ -2,15 +2,9 @@ "type": "minecraft:crafting_shapeless", "category": "misc", "ingredients": [ - { - "item": "minecraft:spider_eye" - }, - { - "item": "minecraft:brown_mushroom" - }, - { - "item": "minecraft:sugar" - } + "minecraft:spider_eye", + "minecraft:brown_mushroom", + "minecraft:sugar" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/field_masoned_banner_pattern.json b/data/minecraft/recipe/field_masoned_banner_pattern.json new file mode 100644 index 00000000..779f5082 --- /dev/null +++ b/data/minecraft/recipe/field_masoned_banner_pattern.json @@ -0,0 +1,12 @@ +{ + "type": "minecraft:crafting_shapeless", + "category": "misc", + "ingredients": [ + "minecraft:paper", + "minecraft:bricks" + ], + "result": { + "count": 1, + "id": "minecraft:field_masoned_banner_pattern" + } +} \ No newline at end of file diff --git a/data/minecraft/recipe/fire_charge.json b/data/minecraft/recipe/fire_charge.json index bcf2bcf3..cde6577d 100644 --- a/data/minecraft/recipe/fire_charge.json +++ b/data/minecraft/recipe/fire_charge.json @@ -2,19 +2,11 @@ "type": "minecraft:crafting_shapeless", "category": "misc", "ingredients": [ - { - "item": "minecraft:gunpowder" - }, - { - "item": "minecraft:blaze_powder" - }, + "minecraft:gunpowder", + "minecraft:blaze_powder", [ - { - "item": "minecraft:coal" - }, - { - "item": "minecraft:charcoal" - } + "minecraft:coal", + "minecraft:charcoal" ] ], "result": { diff --git a/data/minecraft/recipe/firework_rocket_simple.json b/data/minecraft/recipe/firework_rocket_simple.json index 0374704a..af8dfcbe 100644 --- a/data/minecraft/recipe/firework_rocket_simple.json +++ b/data/minecraft/recipe/firework_rocket_simple.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shapeless", "category": "misc", "ingredients": [ - { - "item": "minecraft:gunpowder" - }, - { - "item": "minecraft:paper" - } + "minecraft:gunpowder", + "minecraft:paper" ], "result": { "count": 3, diff --git a/data/minecraft/recipe/fishing_rod.json b/data/minecraft/recipe/fishing_rod.json index 7cdb02c7..41b479b0 100644 --- a/data/minecraft/recipe/fishing_rod.json +++ b/data/minecraft/recipe/fishing_rod.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shaped", "category": "equipment", "key": { - "#": { - "item": "minecraft:stick" - }, - "X": { - "item": "minecraft:string" - } + "#": "minecraft:stick", + "X": "minecraft:string" }, "pattern": [ " #", diff --git a/data/minecraft/recipe/fletching_table.json b/data/minecraft/recipe/fletching_table.json index bbfb856a..2987e9f8 100644 --- a/data/minecraft/recipe/fletching_table.json +++ b/data/minecraft/recipe/fletching_table.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "#": { - "tag": "minecraft:planks" - }, - "@": { - "item": "minecraft:flint" - } + "#": "#minecraft:planks", + "@": "minecraft:flint" }, "pattern": [ "@@", diff --git a/data/minecraft/recipe/flint_and_steel.json b/data/minecraft/recipe/flint_and_steel.json index 55001252..4661477f 100644 --- a/data/minecraft/recipe/flint_and_steel.json +++ b/data/minecraft/recipe/flint_and_steel.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shapeless", "category": "equipment", "ingredients": [ - { - "item": "minecraft:iron_ingot" - }, - { - "item": "minecraft:flint" - } + "minecraft:iron_ingot", + "minecraft:flint" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/flow_armor_trim_smithing_template.json b/data/minecraft/recipe/flow_armor_trim_smithing_template.json index 6295e847..e6e33919 100644 --- a/data/minecraft/recipe/flow_armor_trim_smithing_template.json +++ b/data/minecraft/recipe/flow_armor_trim_smithing_template.json @@ -2,15 +2,9 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "#": { - "item": "minecraft:diamond" - }, - "C": { - "item": "minecraft:breeze_rod" - }, - "S": { - "item": "minecraft:flow_armor_trim_smithing_template" - } + "#": "minecraft:diamond", + "C": "minecraft:breeze_rod", + "S": "minecraft:flow_armor_trim_smithing_template" }, "pattern": [ "#S#", diff --git a/data/minecraft/recipe/flow_armor_trim_smithing_template_smithing_trim.json b/data/minecraft/recipe/flow_armor_trim_smithing_template_smithing_trim.json index acbdc95e..aa07def2 100644 --- a/data/minecraft/recipe/flow_armor_trim_smithing_template_smithing_trim.json +++ b/data/minecraft/recipe/flow_armor_trim_smithing_template_smithing_trim.json @@ -1,12 +1,6 @@ { "type": "minecraft:smithing_trim", - "addition": { - "tag": "minecraft:trim_materials" - }, - "base": { - "tag": "minecraft:trimmable_armor" - }, - "template": { - "item": "minecraft:flow_armor_trim_smithing_template" - } + "addition": "#minecraft:trim_materials", + "base": "#minecraft:trimmable_armor", + "template": "minecraft:flow_armor_trim_smithing_template" } \ No newline at end of file diff --git a/data/minecraft/recipe/flower_banner_pattern.json b/data/minecraft/recipe/flower_banner_pattern.json index be72848a..6bc4bdc7 100644 --- a/data/minecraft/recipe/flower_banner_pattern.json +++ b/data/minecraft/recipe/flower_banner_pattern.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shapeless", "category": "misc", "ingredients": [ - { - "item": "minecraft:paper" - }, - { - "item": "minecraft:oxeye_daisy" - } + "minecraft:paper", + "minecraft:oxeye_daisy" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/flower_pot.json b/data/minecraft/recipe/flower_pot.json index 70ea1292..7c06377b 100644 --- a/data/minecraft/recipe/flower_pot.json +++ b/data/minecraft/recipe/flower_pot.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "#": { - "item": "minecraft:brick" - } + "#": "minecraft:brick" }, "pattern": [ "# #", diff --git a/data/minecraft/recipe/furnace.json b/data/minecraft/recipe/furnace.json index 64c766d5..63c54ae3 100644 --- a/data/minecraft/recipe/furnace.json +++ b/data/minecraft/recipe/furnace.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "#": { - "tag": "minecraft:stone_crafting_materials" - } + "#": "#minecraft:stone_crafting_materials" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/furnace_minecart.json b/data/minecraft/recipe/furnace_minecart.json index 2f5f2feb..e58358e1 100644 --- a/data/minecraft/recipe/furnace_minecart.json +++ b/data/minecraft/recipe/furnace_minecart.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shapeless", "category": "misc", "ingredients": [ - { - "item": "minecraft:furnace" - }, - { - "item": "minecraft:minecart" - } + "minecraft:furnace", + "minecraft:minecart" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/glass.json b/data/minecraft/recipe/glass.json index da3ffa4c..2d4a6dcb 100644 --- a/data/minecraft/recipe/glass.json +++ b/data/minecraft/recipe/glass.json @@ -3,9 +3,7 @@ "category": "blocks", "cookingtime": 200, "experience": 0.1, - "ingredient": { - "tag": "minecraft:smelts_to_glass" - }, + "ingredient": "#minecraft:smelts_to_glass", "result": { "id": "minecraft:glass" } diff --git a/data/minecraft/recipe/glass_bottle.json b/data/minecraft/recipe/glass_bottle.json index e13b0698..a06285ae 100644 --- a/data/minecraft/recipe/glass_bottle.json +++ b/data/minecraft/recipe/glass_bottle.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "#": { - "item": "minecraft:glass" - } + "#": "minecraft:glass" }, "pattern": [ "# #", diff --git a/data/minecraft/recipe/glass_pane.json b/data/minecraft/recipe/glass_pane.json index 1ed154bd..aa0cbbfb 100644 --- a/data/minecraft/recipe/glass_pane.json +++ b/data/minecraft/recipe/glass_pane.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "#": { - "item": "minecraft:glass" - } + "#": "minecraft:glass" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/glistering_melon_slice.json b/data/minecraft/recipe/glistering_melon_slice.json index 6834e757..f388f83f 100644 --- a/data/minecraft/recipe/glistering_melon_slice.json +++ b/data/minecraft/recipe/glistering_melon_slice.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "#": { - "item": "minecraft:gold_nugget" - }, - "X": { - "item": "minecraft:melon_slice" - } + "#": "minecraft:gold_nugget", + "X": "minecraft:melon_slice" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/glow_item_frame.json b/data/minecraft/recipe/glow_item_frame.json index de684759..feb5ae2f 100644 --- a/data/minecraft/recipe/glow_item_frame.json +++ b/data/minecraft/recipe/glow_item_frame.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shapeless", "category": "misc", "ingredients": [ - { - "item": "minecraft:item_frame" - }, - { - "item": "minecraft:glow_ink_sac" - } + "minecraft:item_frame", + "minecraft:glow_ink_sac" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/glowstone.json b/data/minecraft/recipe/glowstone.json index 46069cd8..8d659f3d 100644 --- a/data/minecraft/recipe/glowstone.json +++ b/data/minecraft/recipe/glowstone.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:glowstone_dust" - } + "#": "minecraft:glowstone_dust" }, "pattern": [ "##", diff --git a/data/minecraft/recipe/gold_block.json b/data/minecraft/recipe/gold_block.json index 5de5ef16..152031b3 100644 --- a/data/minecraft/recipe/gold_block.json +++ b/data/minecraft/recipe/gold_block.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:gold_ingot" - } + "#": "minecraft:gold_ingot" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/gold_ingot_from_blasting_deepslate_gold_ore.json b/data/minecraft/recipe/gold_ingot_from_blasting_deepslate_gold_ore.json index 649c8c3a..0410017f 100644 --- a/data/minecraft/recipe/gold_ingot_from_blasting_deepslate_gold_ore.json +++ b/data/minecraft/recipe/gold_ingot_from_blasting_deepslate_gold_ore.json @@ -4,9 +4,7 @@ "cookingtime": 100, "experience": 1.0, "group": "gold_ingot", - "ingredient": { - "item": "minecraft:deepslate_gold_ore" - }, + "ingredient": "minecraft:deepslate_gold_ore", "result": { "id": "minecraft:gold_ingot" } diff --git a/data/minecraft/recipe/gold_ingot_from_blasting_gold_ore.json b/data/minecraft/recipe/gold_ingot_from_blasting_gold_ore.json index d2300b66..c8b61a23 100644 --- a/data/minecraft/recipe/gold_ingot_from_blasting_gold_ore.json +++ b/data/minecraft/recipe/gold_ingot_from_blasting_gold_ore.json @@ -4,9 +4,7 @@ "cookingtime": 100, "experience": 1.0, "group": "gold_ingot", - "ingredient": { - "item": "minecraft:gold_ore" - }, + "ingredient": "minecraft:gold_ore", "result": { "id": "minecraft:gold_ingot" } diff --git a/data/minecraft/recipe/gold_ingot_from_blasting_nether_gold_ore.json b/data/minecraft/recipe/gold_ingot_from_blasting_nether_gold_ore.json index 8175c7e2..2959687a 100644 --- a/data/minecraft/recipe/gold_ingot_from_blasting_nether_gold_ore.json +++ b/data/minecraft/recipe/gold_ingot_from_blasting_nether_gold_ore.json @@ -4,9 +4,7 @@ "cookingtime": 100, "experience": 1.0, "group": "gold_ingot", - "ingredient": { - "item": "minecraft:nether_gold_ore" - }, + "ingredient": "minecraft:nether_gold_ore", "result": { "id": "minecraft:gold_ingot" } diff --git a/data/minecraft/recipe/gold_ingot_from_blasting_raw_gold.json b/data/minecraft/recipe/gold_ingot_from_blasting_raw_gold.json index 35d02d82..29ab0275 100644 --- a/data/minecraft/recipe/gold_ingot_from_blasting_raw_gold.json +++ b/data/minecraft/recipe/gold_ingot_from_blasting_raw_gold.json @@ -4,9 +4,7 @@ "cookingtime": 100, "experience": 1.0, "group": "gold_ingot", - "ingredient": { - "item": "minecraft:raw_gold" - }, + "ingredient": "minecraft:raw_gold", "result": { "id": "minecraft:gold_ingot" } diff --git a/data/minecraft/recipe/gold_ingot_from_gold_block.json b/data/minecraft/recipe/gold_ingot_from_gold_block.json index 46a7af5d..e52ae56d 100644 --- a/data/minecraft/recipe/gold_ingot_from_gold_block.json +++ b/data/minecraft/recipe/gold_ingot_from_gold_block.json @@ -3,9 +3,7 @@ "category": "misc", "group": "gold_ingot", "ingredients": [ - { - "item": "minecraft:gold_block" - } + "minecraft:gold_block" ], "result": { "count": 9, diff --git a/data/minecraft/recipe/gold_ingot_from_nuggets.json b/data/minecraft/recipe/gold_ingot_from_nuggets.json index 7a144c31..48534d69 100644 --- a/data/minecraft/recipe/gold_ingot_from_nuggets.json +++ b/data/minecraft/recipe/gold_ingot_from_nuggets.json @@ -3,9 +3,7 @@ "category": "misc", "group": "gold_ingot", "key": { - "#": { - "item": "minecraft:gold_nugget" - } + "#": "minecraft:gold_nugget" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/gold_ingot_from_smelting_deepslate_gold_ore.json b/data/minecraft/recipe/gold_ingot_from_smelting_deepslate_gold_ore.json index 06c91f70..828e8c7e 100644 --- a/data/minecraft/recipe/gold_ingot_from_smelting_deepslate_gold_ore.json +++ b/data/minecraft/recipe/gold_ingot_from_smelting_deepslate_gold_ore.json @@ -4,9 +4,7 @@ "cookingtime": 200, "experience": 1.0, "group": "gold_ingot", - "ingredient": { - "item": "minecraft:deepslate_gold_ore" - }, + "ingredient": "minecraft:deepslate_gold_ore", "result": { "id": "minecraft:gold_ingot" } diff --git a/data/minecraft/recipe/gold_ingot_from_smelting_gold_ore.json b/data/minecraft/recipe/gold_ingot_from_smelting_gold_ore.json index 21ec609c..500b47ec 100644 --- a/data/minecraft/recipe/gold_ingot_from_smelting_gold_ore.json +++ b/data/minecraft/recipe/gold_ingot_from_smelting_gold_ore.json @@ -4,9 +4,7 @@ "cookingtime": 200, "experience": 1.0, "group": "gold_ingot", - "ingredient": { - "item": "minecraft:gold_ore" - }, + "ingredient": "minecraft:gold_ore", "result": { "id": "minecraft:gold_ingot" } diff --git a/data/minecraft/recipe/gold_ingot_from_smelting_nether_gold_ore.json b/data/minecraft/recipe/gold_ingot_from_smelting_nether_gold_ore.json index e0d84cdc..9fc83af7 100644 --- a/data/minecraft/recipe/gold_ingot_from_smelting_nether_gold_ore.json +++ b/data/minecraft/recipe/gold_ingot_from_smelting_nether_gold_ore.json @@ -4,9 +4,7 @@ "cookingtime": 200, "experience": 1.0, "group": "gold_ingot", - "ingredient": { - "item": "minecraft:nether_gold_ore" - }, + "ingredient": "minecraft:nether_gold_ore", "result": { "id": "minecraft:gold_ingot" } diff --git a/data/minecraft/recipe/gold_ingot_from_smelting_raw_gold.json b/data/minecraft/recipe/gold_ingot_from_smelting_raw_gold.json index efa4057a..f603d223 100644 --- a/data/minecraft/recipe/gold_ingot_from_smelting_raw_gold.json +++ b/data/minecraft/recipe/gold_ingot_from_smelting_raw_gold.json @@ -4,9 +4,7 @@ "cookingtime": 200, "experience": 1.0, "group": "gold_ingot", - "ingredient": { - "item": "minecraft:raw_gold" - }, + "ingredient": "minecraft:raw_gold", "result": { "id": "minecraft:gold_ingot" } diff --git a/data/minecraft/recipe/gold_nugget.json b/data/minecraft/recipe/gold_nugget.json index 88249012..1059455e 100644 --- a/data/minecraft/recipe/gold_nugget.json +++ b/data/minecraft/recipe/gold_nugget.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shapeless", "category": "misc", "ingredients": [ - { - "item": "minecraft:gold_ingot" - } + "minecraft:gold_ingot" ], "result": { "count": 9, diff --git a/data/minecraft/recipe/gold_nugget_from_blasting.json b/data/minecraft/recipe/gold_nugget_from_blasting.json index 32ee594e..89ec3006 100644 --- a/data/minecraft/recipe/gold_nugget_from_blasting.json +++ b/data/minecraft/recipe/gold_nugget_from_blasting.json @@ -4,36 +4,16 @@ "cookingtime": 100, "experience": 0.1, "ingredient": [ - { - "item": "minecraft:golden_pickaxe" - }, - { - "item": "minecraft:golden_shovel" - }, - { - "item": "minecraft:golden_axe" - }, - { - "item": "minecraft:golden_hoe" - }, - { - "item": "minecraft:golden_sword" - }, - { - "item": "minecraft:golden_helmet" - }, - { - "item": "minecraft:golden_chestplate" - }, - { - "item": "minecraft:golden_leggings" - }, - { - "item": "minecraft:golden_boots" - }, - { - "item": "minecraft:golden_horse_armor" - } + "minecraft:golden_pickaxe", + "minecraft:golden_shovel", + "minecraft:golden_axe", + "minecraft:golden_hoe", + "minecraft:golden_sword", + "minecraft:golden_helmet", + "minecraft:golden_chestplate", + "minecraft:golden_leggings", + "minecraft:golden_boots", + "minecraft:golden_horse_armor" ], "result": { "id": "minecraft:gold_nugget" diff --git a/data/minecraft/recipe/gold_nugget_from_smelting.json b/data/minecraft/recipe/gold_nugget_from_smelting.json index 7a9efdef..9b6ec73d 100644 --- a/data/minecraft/recipe/gold_nugget_from_smelting.json +++ b/data/minecraft/recipe/gold_nugget_from_smelting.json @@ -4,36 +4,16 @@ "cookingtime": 200, "experience": 0.1, "ingredient": [ - { - "item": "minecraft:golden_pickaxe" - }, - { - "item": "minecraft:golden_shovel" - }, - { - "item": "minecraft:golden_axe" - }, - { - "item": "minecraft:golden_hoe" - }, - { - "item": "minecraft:golden_sword" - }, - { - "item": "minecraft:golden_helmet" - }, - { - "item": "minecraft:golden_chestplate" - }, - { - "item": "minecraft:golden_leggings" - }, - { - "item": "minecraft:golden_boots" - }, - { - "item": "minecraft:golden_horse_armor" - } + "minecraft:golden_pickaxe", + "minecraft:golden_shovel", + "minecraft:golden_axe", + "minecraft:golden_hoe", + "minecraft:golden_sword", + "minecraft:golden_helmet", + "minecraft:golden_chestplate", + "minecraft:golden_leggings", + "minecraft:golden_boots", + "minecraft:golden_horse_armor" ], "result": { "id": "minecraft:gold_nugget" diff --git a/data/minecraft/recipe/golden_apple.json b/data/minecraft/recipe/golden_apple.json index e391be59..03816258 100644 --- a/data/minecraft/recipe/golden_apple.json +++ b/data/minecraft/recipe/golden_apple.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "#": { - "item": "minecraft:gold_ingot" - }, - "X": { - "item": "minecraft:apple" - } + "#": "minecraft:gold_ingot", + "X": "minecraft:apple" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/golden_axe.json b/data/minecraft/recipe/golden_axe.json index a2d569c4..8314a715 100644 --- a/data/minecraft/recipe/golden_axe.json +++ b/data/minecraft/recipe/golden_axe.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shaped", "category": "equipment", "key": { - "#": { - "item": "minecraft:stick" - }, - "X": { - "item": "minecraft:gold_ingot" - } + "#": "minecraft:stick", + "X": "#minecraft:gold_tool_materials" }, "pattern": [ "XX", diff --git a/data/minecraft/recipe/golden_boots.json b/data/minecraft/recipe/golden_boots.json index 0ef11308..c843132b 100644 --- a/data/minecraft/recipe/golden_boots.json +++ b/data/minecraft/recipe/golden_boots.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "equipment", "key": { - "X": { - "item": "minecraft:gold_ingot" - } + "X": "minecraft:gold_ingot" }, "pattern": [ "X X", diff --git a/data/minecraft/recipe/golden_carrot.json b/data/minecraft/recipe/golden_carrot.json index 553a5c63..95566bd2 100644 --- a/data/minecraft/recipe/golden_carrot.json +++ b/data/minecraft/recipe/golden_carrot.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "#": { - "item": "minecraft:gold_nugget" - }, - "X": { - "item": "minecraft:carrot" - } + "#": "minecraft:gold_nugget", + "X": "minecraft:carrot" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/golden_chestplate.json b/data/minecraft/recipe/golden_chestplate.json index 9a4d4c80..7f4b1f48 100644 --- a/data/minecraft/recipe/golden_chestplate.json +++ b/data/minecraft/recipe/golden_chestplate.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "equipment", "key": { - "X": { - "item": "minecraft:gold_ingot" - } + "X": "minecraft:gold_ingot" }, "pattern": [ "X X", diff --git a/data/minecraft/recipe/golden_helmet.json b/data/minecraft/recipe/golden_helmet.json index 7fa84a9a..e05c6254 100644 --- a/data/minecraft/recipe/golden_helmet.json +++ b/data/minecraft/recipe/golden_helmet.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "equipment", "key": { - "X": { - "item": "minecraft:gold_ingot" - } + "X": "minecraft:gold_ingot" }, "pattern": [ "XXX", diff --git a/data/minecraft/recipe/golden_hoe.json b/data/minecraft/recipe/golden_hoe.json index 2979c915..5ac8fd06 100644 --- a/data/minecraft/recipe/golden_hoe.json +++ b/data/minecraft/recipe/golden_hoe.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shaped", "category": "equipment", "key": { - "#": { - "item": "minecraft:stick" - }, - "X": { - "item": "minecraft:gold_ingot" - } + "#": "minecraft:stick", + "X": "#minecraft:gold_tool_materials" }, "pattern": [ "XX", diff --git a/data/minecraft/recipe/golden_leggings.json b/data/minecraft/recipe/golden_leggings.json index ccf22dcb..5ba795b6 100644 --- a/data/minecraft/recipe/golden_leggings.json +++ b/data/minecraft/recipe/golden_leggings.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "equipment", "key": { - "X": { - "item": "minecraft:gold_ingot" - } + "X": "minecraft:gold_ingot" }, "pattern": [ "XXX", diff --git a/data/minecraft/recipe/golden_pickaxe.json b/data/minecraft/recipe/golden_pickaxe.json index 998acc7d..f29f0733 100644 --- a/data/minecraft/recipe/golden_pickaxe.json +++ b/data/minecraft/recipe/golden_pickaxe.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shaped", "category": "equipment", "key": { - "#": { - "item": "minecraft:stick" - }, - "X": { - "item": "minecraft:gold_ingot" - } + "#": "minecraft:stick", + "X": "#minecraft:gold_tool_materials" }, "pattern": [ "XXX", diff --git a/data/minecraft/recipe/golden_shovel.json b/data/minecraft/recipe/golden_shovel.json index d386a8b7..b1ce8c06 100644 --- a/data/minecraft/recipe/golden_shovel.json +++ b/data/minecraft/recipe/golden_shovel.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shaped", "category": "equipment", "key": { - "#": { - "item": "minecraft:stick" - }, - "X": { - "item": "minecraft:gold_ingot" - } + "#": "minecraft:stick", + "X": "#minecraft:gold_tool_materials" }, "pattern": [ "X", diff --git a/data/minecraft/recipe/golden_sword.json b/data/minecraft/recipe/golden_sword.json index 837b89b7..157b76d4 100644 --- a/data/minecraft/recipe/golden_sword.json +++ b/data/minecraft/recipe/golden_sword.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shaped", "category": "equipment", "key": { - "#": { - "item": "minecraft:stick" - }, - "X": { - "item": "minecraft:gold_ingot" - } + "#": "minecraft:stick", + "X": "#minecraft:gold_tool_materials" }, "pattern": [ "X", diff --git a/data/minecraft/recipe/granite.json b/data/minecraft/recipe/granite.json index b65cf324..7a1419a9 100644 --- a/data/minecraft/recipe/granite.json +++ b/data/minecraft/recipe/granite.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shapeless", "category": "building", "ingredients": [ - { - "item": "minecraft:diorite" - }, - { - "item": "minecraft:quartz" - } + "minecraft:diorite", + "minecraft:quartz" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/granite_slab.json b/data/minecraft/recipe/granite_slab.json index e69d72a8..b37f8d5d 100644 --- a/data/minecraft/recipe/granite_slab.json +++ b/data/minecraft/recipe/granite_slab.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:granite" - } + "#": "minecraft:granite" }, "pattern": [ "###" diff --git a/data/minecraft/recipe/granite_slab_from_granite_stonecutting.json b/data/minecraft/recipe/granite_slab_from_granite_stonecutting.json index 05ad0930..5d67cee5 100644 --- a/data/minecraft/recipe/granite_slab_from_granite_stonecutting.json +++ b/data/minecraft/recipe/granite_slab_from_granite_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:granite" - }, + "ingredient": "minecraft:granite", "result": { "count": 2, "id": "minecraft:granite_slab" diff --git a/data/minecraft/recipe/granite_stairs.json b/data/minecraft/recipe/granite_stairs.json index 9eed8e99..3d29b6f2 100644 --- a/data/minecraft/recipe/granite_stairs.json +++ b/data/minecraft/recipe/granite_stairs.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:granite" - } + "#": "minecraft:granite" }, "pattern": [ "# ", diff --git a/data/minecraft/recipe/granite_stairs_from_granite_stonecutting.json b/data/minecraft/recipe/granite_stairs_from_granite_stonecutting.json index 29d520aa..dfbfd97b 100644 --- a/data/minecraft/recipe/granite_stairs_from_granite_stonecutting.json +++ b/data/minecraft/recipe/granite_stairs_from_granite_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:granite" - }, + "ingredient": "minecraft:granite", "result": { "count": 1, "id": "minecraft:granite_stairs" diff --git a/data/minecraft/recipe/granite_wall.json b/data/minecraft/recipe/granite_wall.json index f1cbff7a..eadea89c 100644 --- a/data/minecraft/recipe/granite_wall.json +++ b/data/minecraft/recipe/granite_wall.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "#": { - "item": "minecraft:granite" - } + "#": "minecraft:granite" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/granite_wall_from_granite_stonecutting.json b/data/minecraft/recipe/granite_wall_from_granite_stonecutting.json index 8aa4af61..8f9adc5c 100644 --- a/data/minecraft/recipe/granite_wall_from_granite_stonecutting.json +++ b/data/minecraft/recipe/granite_wall_from_granite_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:granite" - }, + "ingredient": "minecraft:granite", "result": { "count": 1, "id": "minecraft:granite_wall" diff --git a/data/minecraft/recipe/gray_banner.json b/data/minecraft/recipe/gray_banner.json index af97a4de..e3b00fac 100644 --- a/data/minecraft/recipe/gray_banner.json +++ b/data/minecraft/recipe/gray_banner.json @@ -3,12 +3,8 @@ "category": "misc", "group": "banner", "key": { - "#": { - "item": "minecraft:gray_wool" - }, - "|": { - "item": "minecraft:stick" - } + "#": "minecraft:gray_wool", + "|": "minecraft:stick" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/gray_bed.json b/data/minecraft/recipe/gray_bed.json index fa9bb5a5..78677853 100644 --- a/data/minecraft/recipe/gray_bed.json +++ b/data/minecraft/recipe/gray_bed.json @@ -3,12 +3,8 @@ "category": "misc", "group": "bed", "key": { - "#": { - "item": "minecraft:gray_wool" - }, - "X": { - "tag": "minecraft:planks" - } + "#": "minecraft:gray_wool", + "X": "#minecraft:planks" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/gray_bundle.json b/data/minecraft/recipe/gray_bundle.json new file mode 100644 index 00000000..4220bb8b --- /dev/null +++ b/data/minecraft/recipe/gray_bundle.json @@ -0,0 +1,8 @@ +{ + "type": "minecraft:crafting_transmute", + "category": "equipment", + "group": "bundle_dye", + "input": "#minecraft:bundles", + "material": "minecraft:gray_dye", + "result": "minecraft:gray_bundle" +} \ No newline at end of file diff --git a/data/minecraft/recipe/gray_candle.json b/data/minecraft/recipe/gray_candle.json index 249a3c88..ba025711 100644 --- a/data/minecraft/recipe/gray_candle.json +++ b/data/minecraft/recipe/gray_candle.json @@ -3,12 +3,8 @@ "category": "misc", "group": "dyed_candle", "ingredients": [ - { - "item": "minecraft:candle" - }, - { - "item": "minecraft:gray_dye" - } + "minecraft:candle", + "minecraft:gray_dye" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/gray_carpet.json b/data/minecraft/recipe/gray_carpet.json index b305806a..f6c47a30 100644 --- a/data/minecraft/recipe/gray_carpet.json +++ b/data/minecraft/recipe/gray_carpet.json @@ -3,9 +3,7 @@ "category": "misc", "group": "carpet", "key": { - "#": { - "item": "minecraft:gray_wool" - } + "#": "minecraft:gray_wool" }, "pattern": [ "##" diff --git a/data/minecraft/recipe/gray_concrete_powder.json b/data/minecraft/recipe/gray_concrete_powder.json index cb3b0cf9..ae886e7e 100644 --- a/data/minecraft/recipe/gray_concrete_powder.json +++ b/data/minecraft/recipe/gray_concrete_powder.json @@ -3,33 +3,15 @@ "category": "building", "group": "concrete_powder", "ingredients": [ - { - "item": "minecraft:gray_dye" - }, - { - "item": "minecraft:sand" - }, - { - "item": "minecraft:sand" - }, - { - "item": "minecraft:sand" - }, - { - "item": "minecraft:sand" - }, - { - "item": "minecraft:gravel" - }, - { - "item": "minecraft:gravel" - }, - { - "item": "minecraft:gravel" - }, - { - "item": "minecraft:gravel" - } + "minecraft:gray_dye", + "minecraft:sand", + "minecraft:sand", + "minecraft:sand", + "minecraft:sand", + "minecraft:gravel", + "minecraft:gravel", + "minecraft:gravel", + "minecraft:gravel" ], "result": { "count": 8, diff --git a/data/minecraft/recipe/gray_dye.json b/data/minecraft/recipe/gray_dye.json index d61ff807..91fa51bd 100644 --- a/data/minecraft/recipe/gray_dye.json +++ b/data/minecraft/recipe/gray_dye.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shapeless", "category": "misc", "ingredients": [ - { - "item": "minecraft:black_dye" - }, - { - "item": "minecraft:white_dye" - } + "minecraft:black_dye", + "minecraft:white_dye" ], "result": { "count": 2, diff --git a/data/minecraft/recipe/gray_glazed_terracotta.json b/data/minecraft/recipe/gray_glazed_terracotta.json index 92a4e96d..7ea93a93 100644 --- a/data/minecraft/recipe/gray_glazed_terracotta.json +++ b/data/minecraft/recipe/gray_glazed_terracotta.json @@ -3,9 +3,7 @@ "category": "blocks", "cookingtime": 200, "experience": 0.1, - "ingredient": { - "item": "minecraft:gray_terracotta" - }, + "ingredient": "minecraft:gray_terracotta", "result": { "id": "minecraft:gray_glazed_terracotta" } diff --git a/data/minecraft/recipe/gray_shulker_box.json b/data/minecraft/recipe/gray_shulker_box.json new file mode 100644 index 00000000..d3eccbb0 --- /dev/null +++ b/data/minecraft/recipe/gray_shulker_box.json @@ -0,0 +1,8 @@ +{ + "type": "minecraft:crafting_transmute", + "category": "misc", + "group": "shulker_box_dye", + "input": "#minecraft:shulker_boxes", + "material": "minecraft:gray_dye", + "result": "minecraft:gray_shulker_box" +} \ No newline at end of file diff --git a/data/minecraft/recipe/gray_stained_glass.json b/data/minecraft/recipe/gray_stained_glass.json index 77881e3c..7246f264 100644 --- a/data/minecraft/recipe/gray_stained_glass.json +++ b/data/minecraft/recipe/gray_stained_glass.json @@ -3,12 +3,8 @@ "category": "building", "group": "stained_glass", "key": { - "#": { - "item": "minecraft:glass" - }, - "X": { - "item": "minecraft:gray_dye" - } + "#": "minecraft:glass", + "X": "minecraft:gray_dye" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/gray_stained_glass_pane.json b/data/minecraft/recipe/gray_stained_glass_pane.json index 9c9e9b40..0b229b01 100644 --- a/data/minecraft/recipe/gray_stained_glass_pane.json +++ b/data/minecraft/recipe/gray_stained_glass_pane.json @@ -3,9 +3,7 @@ "category": "misc", "group": "stained_glass_pane", "key": { - "#": { - "item": "minecraft:gray_stained_glass" - } + "#": "minecraft:gray_stained_glass" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/gray_stained_glass_pane_from_glass_pane.json b/data/minecraft/recipe/gray_stained_glass_pane_from_glass_pane.json index f811b93a..ffb8ef49 100644 --- a/data/minecraft/recipe/gray_stained_glass_pane_from_glass_pane.json +++ b/data/minecraft/recipe/gray_stained_glass_pane_from_glass_pane.json @@ -3,12 +3,8 @@ "category": "misc", "group": "stained_glass_pane", "key": { - "#": { - "item": "minecraft:glass_pane" - }, - "$": { - "item": "minecraft:gray_dye" - } + "#": "minecraft:glass_pane", + "$": "minecraft:gray_dye" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/gray_terracotta.json b/data/minecraft/recipe/gray_terracotta.json index 6db6f6fb..2662e238 100644 --- a/data/minecraft/recipe/gray_terracotta.json +++ b/data/minecraft/recipe/gray_terracotta.json @@ -3,12 +3,8 @@ "category": "building", "group": "stained_terracotta", "key": { - "#": { - "item": "minecraft:terracotta" - }, - "X": { - "item": "minecraft:gray_dye" - } + "#": "minecraft:terracotta", + "X": "minecraft:gray_dye" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/green_banner.json b/data/minecraft/recipe/green_banner.json index d18c734d..71cc2249 100644 --- a/data/minecraft/recipe/green_banner.json +++ b/data/minecraft/recipe/green_banner.json @@ -3,12 +3,8 @@ "category": "misc", "group": "banner", "key": { - "#": { - "item": "minecraft:green_wool" - }, - "|": { - "item": "minecraft:stick" - } + "#": "minecraft:green_wool", + "|": "minecraft:stick" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/green_bed.json b/data/minecraft/recipe/green_bed.json index 946f86c2..23af099b 100644 --- a/data/minecraft/recipe/green_bed.json +++ b/data/minecraft/recipe/green_bed.json @@ -3,12 +3,8 @@ "category": "misc", "group": "bed", "key": { - "#": { - "item": "minecraft:green_wool" - }, - "X": { - "tag": "minecraft:planks" - } + "#": "minecraft:green_wool", + "X": "#minecraft:planks" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/green_bundle.json b/data/minecraft/recipe/green_bundle.json new file mode 100644 index 00000000..f2cf2689 --- /dev/null +++ b/data/minecraft/recipe/green_bundle.json @@ -0,0 +1,8 @@ +{ + "type": "minecraft:crafting_transmute", + "category": "equipment", + "group": "bundle_dye", + "input": "#minecraft:bundles", + "material": "minecraft:green_dye", + "result": "minecraft:green_bundle" +} \ No newline at end of file diff --git a/data/minecraft/recipe/green_candle.json b/data/minecraft/recipe/green_candle.json index fe0e6c61..3a991390 100644 --- a/data/minecraft/recipe/green_candle.json +++ b/data/minecraft/recipe/green_candle.json @@ -3,12 +3,8 @@ "category": "misc", "group": "dyed_candle", "ingredients": [ - { - "item": "minecraft:candle" - }, - { - "item": "minecraft:green_dye" - } + "minecraft:candle", + "minecraft:green_dye" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/green_carpet.json b/data/minecraft/recipe/green_carpet.json index cb094fe1..a6734f37 100644 --- a/data/minecraft/recipe/green_carpet.json +++ b/data/minecraft/recipe/green_carpet.json @@ -3,9 +3,7 @@ "category": "misc", "group": "carpet", "key": { - "#": { - "item": "minecraft:green_wool" - } + "#": "minecraft:green_wool" }, "pattern": [ "##" diff --git a/data/minecraft/recipe/green_concrete_powder.json b/data/minecraft/recipe/green_concrete_powder.json index f314e2b5..ee3d8f2e 100644 --- a/data/minecraft/recipe/green_concrete_powder.json +++ b/data/minecraft/recipe/green_concrete_powder.json @@ -3,33 +3,15 @@ "category": "building", "group": "concrete_powder", "ingredients": [ - { - "item": "minecraft:green_dye" - }, - { - "item": "minecraft:sand" - }, - { - "item": "minecraft:sand" - }, - { - "item": "minecraft:sand" - }, - { - "item": "minecraft:sand" - }, - { - "item": "minecraft:gravel" - }, - { - "item": "minecraft:gravel" - }, - { - "item": "minecraft:gravel" - }, - { - "item": "minecraft:gravel" - } + "minecraft:green_dye", + "minecraft:sand", + "minecraft:sand", + "minecraft:sand", + "minecraft:sand", + "minecraft:gravel", + "minecraft:gravel", + "minecraft:gravel", + "minecraft:gravel" ], "result": { "count": 8, diff --git a/data/minecraft/recipe/green_dye.json b/data/minecraft/recipe/green_dye.json index 645248d2..3fa65ba4 100644 --- a/data/minecraft/recipe/green_dye.json +++ b/data/minecraft/recipe/green_dye.json @@ -3,9 +3,7 @@ "category": "misc", "cookingtime": 200, "experience": 1.0, - "ingredient": { - "item": "minecraft:cactus" - }, + "ingredient": "minecraft:cactus", "result": { "id": "minecraft:green_dye" } diff --git a/data/minecraft/recipe/green_glazed_terracotta.json b/data/minecraft/recipe/green_glazed_terracotta.json index ad81e60e..7478830e 100644 --- a/data/minecraft/recipe/green_glazed_terracotta.json +++ b/data/minecraft/recipe/green_glazed_terracotta.json @@ -3,9 +3,7 @@ "category": "blocks", "cookingtime": 200, "experience": 0.1, - "ingredient": { - "item": "minecraft:green_terracotta" - }, + "ingredient": "minecraft:green_terracotta", "result": { "id": "minecraft:green_glazed_terracotta" } diff --git a/data/minecraft/recipe/green_shulker_box.json b/data/minecraft/recipe/green_shulker_box.json new file mode 100644 index 00000000..cc9b6d72 --- /dev/null +++ b/data/minecraft/recipe/green_shulker_box.json @@ -0,0 +1,8 @@ +{ + "type": "minecraft:crafting_transmute", + "category": "misc", + "group": "shulker_box_dye", + "input": "#minecraft:shulker_boxes", + "material": "minecraft:green_dye", + "result": "minecraft:green_shulker_box" +} \ No newline at end of file diff --git a/data/minecraft/recipe/green_stained_glass.json b/data/minecraft/recipe/green_stained_glass.json index 2ee5b6b1..ef6b87ac 100644 --- a/data/minecraft/recipe/green_stained_glass.json +++ b/data/minecraft/recipe/green_stained_glass.json @@ -3,12 +3,8 @@ "category": "building", "group": "stained_glass", "key": { - "#": { - "item": "minecraft:glass" - }, - "X": { - "item": "minecraft:green_dye" - } + "#": "minecraft:glass", + "X": "minecraft:green_dye" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/green_stained_glass_pane.json b/data/minecraft/recipe/green_stained_glass_pane.json index 774bfc22..e34f8705 100644 --- a/data/minecraft/recipe/green_stained_glass_pane.json +++ b/data/minecraft/recipe/green_stained_glass_pane.json @@ -3,9 +3,7 @@ "category": "misc", "group": "stained_glass_pane", "key": { - "#": { - "item": "minecraft:green_stained_glass" - } + "#": "minecraft:green_stained_glass" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/green_stained_glass_pane_from_glass_pane.json b/data/minecraft/recipe/green_stained_glass_pane_from_glass_pane.json index 89189e3c..1a7b4bcf 100644 --- a/data/minecraft/recipe/green_stained_glass_pane_from_glass_pane.json +++ b/data/minecraft/recipe/green_stained_glass_pane_from_glass_pane.json @@ -3,12 +3,8 @@ "category": "misc", "group": "stained_glass_pane", "key": { - "#": { - "item": "minecraft:glass_pane" - }, - "$": { - "item": "minecraft:green_dye" - } + "#": "minecraft:glass_pane", + "$": "minecraft:green_dye" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/green_terracotta.json b/data/minecraft/recipe/green_terracotta.json index 5149f6c2..8864bbed 100644 --- a/data/minecraft/recipe/green_terracotta.json +++ b/data/minecraft/recipe/green_terracotta.json @@ -3,12 +3,8 @@ "category": "building", "group": "stained_terracotta", "key": { - "#": { - "item": "minecraft:terracotta" - }, - "X": { - "item": "minecraft:green_dye" - } + "#": "minecraft:terracotta", + "X": "minecraft:green_dye" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/grindstone.json b/data/minecraft/recipe/grindstone.json index 5f7c4dd7..2cf3b14f 100644 --- a/data/minecraft/recipe/grindstone.json +++ b/data/minecraft/recipe/grindstone.json @@ -2,15 +2,9 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "#": { - "tag": "minecraft:planks" - }, - "-": { - "item": "minecraft:stone_slab" - }, - "I": { - "item": "minecraft:stick" - } + "#": "#minecraft:planks", + "-": "minecraft:stone_slab", + "I": "minecraft:stick" }, "pattern": [ "I-I", diff --git a/data/minecraft/recipe/hay_block.json b/data/minecraft/recipe/hay_block.json index 6b00af3e..ae0fb53a 100644 --- a/data/minecraft/recipe/hay_block.json +++ b/data/minecraft/recipe/hay_block.json @@ -2,33 +2,15 @@ "type": "minecraft:crafting_shapeless", "category": "building", "ingredients": [ - { - "item": "minecraft:wheat" - }, - { - "item": "minecraft:wheat" - }, - { - "item": "minecraft:wheat" - }, - { - "item": "minecraft:wheat" - }, - { - "item": "minecraft:wheat" - }, - { - "item": "minecraft:wheat" - }, - { - "item": "minecraft:wheat" - }, - { - "item": "minecraft:wheat" - }, - { - "item": "minecraft:wheat" - } + "minecraft:wheat", + "minecraft:wheat", + "minecraft:wheat", + "minecraft:wheat", + "minecraft:wheat", + "minecraft:wheat", + "minecraft:wheat", + "minecraft:wheat", + "minecraft:wheat" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/heavy_weighted_pressure_plate.json b/data/minecraft/recipe/heavy_weighted_pressure_plate.json index aef3960a..5fa4b737 100644 --- a/data/minecraft/recipe/heavy_weighted_pressure_plate.json +++ b/data/minecraft/recipe/heavy_weighted_pressure_plate.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "redstone", "key": { - "#": { - "item": "minecraft:iron_ingot" - } + "#": "minecraft:iron_ingot" }, "pattern": [ "##" diff --git a/data/minecraft/recipe/honey_block.json b/data/minecraft/recipe/honey_block.json index 2d4874f1..fbedddaf 100644 --- a/data/minecraft/recipe/honey_block.json +++ b/data/minecraft/recipe/honey_block.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "redstone", "key": { - "#": { - "item": "minecraft:honey_bottle" - } + "#": "minecraft:honey_bottle" }, "pattern": [ "##", diff --git a/data/minecraft/recipe/honey_bottle.json b/data/minecraft/recipe/honey_bottle.json index 928f2910..1700eee6 100644 --- a/data/minecraft/recipe/honey_bottle.json +++ b/data/minecraft/recipe/honey_bottle.json @@ -2,21 +2,11 @@ "type": "minecraft:crafting_shapeless", "category": "misc", "ingredients": [ - { - "item": "minecraft:honey_block" - }, - { - "item": "minecraft:glass_bottle" - }, - { - "item": "minecraft:glass_bottle" - }, - { - "item": "minecraft:glass_bottle" - }, - { - "item": "minecraft:glass_bottle" - } + "minecraft:honey_block", + "minecraft:glass_bottle", + "minecraft:glass_bottle", + "minecraft:glass_bottle", + "minecraft:glass_bottle" ], "result": { "count": 4, diff --git a/data/minecraft/recipe/honeycomb_block.json b/data/minecraft/recipe/honeycomb_block.json index 22382d06..212c9dd0 100644 --- a/data/minecraft/recipe/honeycomb_block.json +++ b/data/minecraft/recipe/honeycomb_block.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "#": { - "item": "minecraft:honeycomb" - } + "#": "minecraft:honeycomb" }, "pattern": [ "##", diff --git a/data/minecraft/recipe/hopper.json b/data/minecraft/recipe/hopper.json index 8fee6063..6e7c0ad4 100644 --- a/data/minecraft/recipe/hopper.json +++ b/data/minecraft/recipe/hopper.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shaped", "category": "redstone", "key": { - "C": { - "item": "minecraft:chest" - }, - "I": { - "item": "minecraft:iron_ingot" - } + "C": "minecraft:chest", + "I": "minecraft:iron_ingot" }, "pattern": [ "I I", diff --git a/data/minecraft/recipe/hopper_minecart.json b/data/minecraft/recipe/hopper_minecart.json index 4fff8f93..f3f63858 100644 --- a/data/minecraft/recipe/hopper_minecart.json +++ b/data/minecraft/recipe/hopper_minecart.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shapeless", "category": "misc", "ingredients": [ - { - "item": "minecraft:hopper" - }, - { - "item": "minecraft:minecart" - } + "minecraft:hopper", + "minecraft:minecart" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/host_armor_trim_smithing_template.json b/data/minecraft/recipe/host_armor_trim_smithing_template.json index a1f371c4..eeb3a026 100644 --- a/data/minecraft/recipe/host_armor_trim_smithing_template.json +++ b/data/minecraft/recipe/host_armor_trim_smithing_template.json @@ -2,15 +2,9 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "#": { - "item": "minecraft:diamond" - }, - "C": { - "item": "minecraft:terracotta" - }, - "S": { - "item": "minecraft:host_armor_trim_smithing_template" - } + "#": "minecraft:diamond", + "C": "minecraft:terracotta", + "S": "minecraft:host_armor_trim_smithing_template" }, "pattern": [ "#S#", diff --git a/data/minecraft/recipe/host_armor_trim_smithing_template_smithing_trim.json b/data/minecraft/recipe/host_armor_trim_smithing_template_smithing_trim.json index 0e6e1816..0609cebb 100644 --- a/data/minecraft/recipe/host_armor_trim_smithing_template_smithing_trim.json +++ b/data/minecraft/recipe/host_armor_trim_smithing_template_smithing_trim.json @@ -1,12 +1,6 @@ { "type": "minecraft:smithing_trim", - "addition": { - "tag": "minecraft:trim_materials" - }, - "base": { - "tag": "minecraft:trimmable_armor" - }, - "template": { - "item": "minecraft:host_armor_trim_smithing_template" - } + "addition": "#minecraft:trim_materials", + "base": "#minecraft:trimmable_armor", + "template": "minecraft:host_armor_trim_smithing_template" } \ No newline at end of file diff --git a/data/minecraft/recipe/iron_axe.json b/data/minecraft/recipe/iron_axe.json index 10e03a02..a06f6eff 100644 --- a/data/minecraft/recipe/iron_axe.json +++ b/data/minecraft/recipe/iron_axe.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shaped", "category": "equipment", "key": { - "#": { - "item": "minecraft:stick" - }, - "X": { - "item": "minecraft:iron_ingot" - } + "#": "minecraft:stick", + "X": "#minecraft:iron_tool_materials" }, "pattern": [ "XX", diff --git a/data/minecraft/recipe/iron_bars.json b/data/minecraft/recipe/iron_bars.json index 1d0be1f9..f5b830e7 100644 --- a/data/minecraft/recipe/iron_bars.json +++ b/data/minecraft/recipe/iron_bars.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "#": { - "item": "minecraft:iron_ingot" - } + "#": "minecraft:iron_ingot" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/iron_block.json b/data/minecraft/recipe/iron_block.json index 576df075..2a68560f 100644 --- a/data/minecraft/recipe/iron_block.json +++ b/data/minecraft/recipe/iron_block.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:iron_ingot" - } + "#": "minecraft:iron_ingot" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/iron_boots.json b/data/minecraft/recipe/iron_boots.json index 46262248..b5596c28 100644 --- a/data/minecraft/recipe/iron_boots.json +++ b/data/minecraft/recipe/iron_boots.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "equipment", "key": { - "X": { - "item": "minecraft:iron_ingot" - } + "X": "minecraft:iron_ingot" }, "pattern": [ "X X", diff --git a/data/minecraft/recipe/iron_chestplate.json b/data/minecraft/recipe/iron_chestplate.json index 66295050..17244f2b 100644 --- a/data/minecraft/recipe/iron_chestplate.json +++ b/data/minecraft/recipe/iron_chestplate.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "equipment", "key": { - "X": { - "item": "minecraft:iron_ingot" - } + "X": "minecraft:iron_ingot" }, "pattern": [ "X X", diff --git a/data/minecraft/recipe/iron_door.json b/data/minecraft/recipe/iron_door.json index b2740681..e7abab48 100644 --- a/data/minecraft/recipe/iron_door.json +++ b/data/minecraft/recipe/iron_door.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "redstone", "key": { - "#": { - "item": "minecraft:iron_ingot" - } + "#": "minecraft:iron_ingot" }, "pattern": [ "##", diff --git a/data/minecraft/recipe/iron_helmet.json b/data/minecraft/recipe/iron_helmet.json index b4ae4872..58ddcb9e 100644 --- a/data/minecraft/recipe/iron_helmet.json +++ b/data/minecraft/recipe/iron_helmet.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "equipment", "key": { - "X": { - "item": "minecraft:iron_ingot" - } + "X": "minecraft:iron_ingot" }, "pattern": [ "XXX", diff --git a/data/minecraft/recipe/iron_hoe.json b/data/minecraft/recipe/iron_hoe.json index 3e1a829e..0fbe0148 100644 --- a/data/minecraft/recipe/iron_hoe.json +++ b/data/minecraft/recipe/iron_hoe.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shaped", "category": "equipment", "key": { - "#": { - "item": "minecraft:stick" - }, - "X": { - "item": "minecraft:iron_ingot" - } + "#": "minecraft:stick", + "X": "#minecraft:iron_tool_materials" }, "pattern": [ "XX", diff --git a/data/minecraft/recipe/iron_ingot_from_blasting_deepslate_iron_ore.json b/data/minecraft/recipe/iron_ingot_from_blasting_deepslate_iron_ore.json index 90516673..ce5872c5 100644 --- a/data/minecraft/recipe/iron_ingot_from_blasting_deepslate_iron_ore.json +++ b/data/minecraft/recipe/iron_ingot_from_blasting_deepslate_iron_ore.json @@ -4,9 +4,7 @@ "cookingtime": 100, "experience": 0.7, "group": "iron_ingot", - "ingredient": { - "item": "minecraft:deepslate_iron_ore" - }, + "ingredient": "minecraft:deepslate_iron_ore", "result": { "id": "minecraft:iron_ingot" } diff --git a/data/minecraft/recipe/iron_ingot_from_blasting_iron_ore.json b/data/minecraft/recipe/iron_ingot_from_blasting_iron_ore.json index 6fd59d78..e130fd11 100644 --- a/data/minecraft/recipe/iron_ingot_from_blasting_iron_ore.json +++ b/data/minecraft/recipe/iron_ingot_from_blasting_iron_ore.json @@ -4,9 +4,7 @@ "cookingtime": 100, "experience": 0.7, "group": "iron_ingot", - "ingredient": { - "item": "minecraft:iron_ore" - }, + "ingredient": "minecraft:iron_ore", "result": { "id": "minecraft:iron_ingot" } diff --git a/data/minecraft/recipe/iron_ingot_from_blasting_raw_iron.json b/data/minecraft/recipe/iron_ingot_from_blasting_raw_iron.json index 7e30b960..922e5715 100644 --- a/data/minecraft/recipe/iron_ingot_from_blasting_raw_iron.json +++ b/data/minecraft/recipe/iron_ingot_from_blasting_raw_iron.json @@ -4,9 +4,7 @@ "cookingtime": 100, "experience": 0.7, "group": "iron_ingot", - "ingredient": { - "item": "minecraft:raw_iron" - }, + "ingredient": "minecraft:raw_iron", "result": { "id": "minecraft:iron_ingot" } diff --git a/data/minecraft/recipe/iron_ingot_from_iron_block.json b/data/minecraft/recipe/iron_ingot_from_iron_block.json index 41969df9..d7d84499 100644 --- a/data/minecraft/recipe/iron_ingot_from_iron_block.json +++ b/data/minecraft/recipe/iron_ingot_from_iron_block.json @@ -3,9 +3,7 @@ "category": "misc", "group": "iron_ingot", "ingredients": [ - { - "item": "minecraft:iron_block" - } + "minecraft:iron_block" ], "result": { "count": 9, diff --git a/data/minecraft/recipe/iron_ingot_from_nuggets.json b/data/minecraft/recipe/iron_ingot_from_nuggets.json index 2ffbc7d3..a4360d8d 100644 --- a/data/minecraft/recipe/iron_ingot_from_nuggets.json +++ b/data/minecraft/recipe/iron_ingot_from_nuggets.json @@ -3,9 +3,7 @@ "category": "misc", "group": "iron_ingot", "key": { - "#": { - "item": "minecraft:iron_nugget" - } + "#": "minecraft:iron_nugget" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/iron_ingot_from_smelting_deepslate_iron_ore.json b/data/minecraft/recipe/iron_ingot_from_smelting_deepslate_iron_ore.json index 4fbd9f4e..c1a8271e 100644 --- a/data/minecraft/recipe/iron_ingot_from_smelting_deepslate_iron_ore.json +++ b/data/minecraft/recipe/iron_ingot_from_smelting_deepslate_iron_ore.json @@ -4,9 +4,7 @@ "cookingtime": 200, "experience": 0.7, "group": "iron_ingot", - "ingredient": { - "item": "minecraft:deepslate_iron_ore" - }, + "ingredient": "minecraft:deepslate_iron_ore", "result": { "id": "minecraft:iron_ingot" } diff --git a/data/minecraft/recipe/iron_ingot_from_smelting_iron_ore.json b/data/minecraft/recipe/iron_ingot_from_smelting_iron_ore.json index 5fd408c0..8c82f70c 100644 --- a/data/minecraft/recipe/iron_ingot_from_smelting_iron_ore.json +++ b/data/minecraft/recipe/iron_ingot_from_smelting_iron_ore.json @@ -4,9 +4,7 @@ "cookingtime": 200, "experience": 0.7, "group": "iron_ingot", - "ingredient": { - "item": "minecraft:iron_ore" - }, + "ingredient": "minecraft:iron_ore", "result": { "id": "minecraft:iron_ingot" } diff --git a/data/minecraft/recipe/iron_ingot_from_smelting_raw_iron.json b/data/minecraft/recipe/iron_ingot_from_smelting_raw_iron.json index 294b245c..0cd30a54 100644 --- a/data/minecraft/recipe/iron_ingot_from_smelting_raw_iron.json +++ b/data/minecraft/recipe/iron_ingot_from_smelting_raw_iron.json @@ -4,9 +4,7 @@ "cookingtime": 200, "experience": 0.7, "group": "iron_ingot", - "ingredient": { - "item": "minecraft:raw_iron" - }, + "ingredient": "minecraft:raw_iron", "result": { "id": "minecraft:iron_ingot" } diff --git a/data/minecraft/recipe/iron_leggings.json b/data/minecraft/recipe/iron_leggings.json index 0b248191..804b2252 100644 --- a/data/minecraft/recipe/iron_leggings.json +++ b/data/minecraft/recipe/iron_leggings.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "equipment", "key": { - "X": { - "item": "minecraft:iron_ingot" - } + "X": "minecraft:iron_ingot" }, "pattern": [ "XXX", diff --git a/data/minecraft/recipe/iron_nugget.json b/data/minecraft/recipe/iron_nugget.json index d2077648..a46715b2 100644 --- a/data/minecraft/recipe/iron_nugget.json +++ b/data/minecraft/recipe/iron_nugget.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shapeless", "category": "misc", "ingredients": [ - { - "item": "minecraft:iron_ingot" - } + "minecraft:iron_ingot" ], "result": { "count": 9, diff --git a/data/minecraft/recipe/iron_nugget_from_blasting.json b/data/minecraft/recipe/iron_nugget_from_blasting.json index 6226b652..5cce3c2b 100644 --- a/data/minecraft/recipe/iron_nugget_from_blasting.json +++ b/data/minecraft/recipe/iron_nugget_from_blasting.json @@ -4,48 +4,20 @@ "cookingtime": 100, "experience": 0.1, "ingredient": [ - { - "item": "minecraft:iron_pickaxe" - }, - { - "item": "minecraft:iron_shovel" - }, - { - "item": "minecraft:iron_axe" - }, - { - "item": "minecraft:iron_hoe" - }, - { - "item": "minecraft:iron_sword" - }, - { - "item": "minecraft:iron_helmet" - }, - { - "item": "minecraft:iron_chestplate" - }, - { - "item": "minecraft:iron_leggings" - }, - { - "item": "minecraft:iron_boots" - }, - { - "item": "minecraft:iron_horse_armor" - }, - { - "item": "minecraft:chainmail_helmet" - }, - { - "item": "minecraft:chainmail_chestplate" - }, - { - "item": "minecraft:chainmail_leggings" - }, - { - "item": "minecraft:chainmail_boots" - } + "minecraft:iron_pickaxe", + "minecraft:iron_shovel", + "minecraft:iron_axe", + "minecraft:iron_hoe", + "minecraft:iron_sword", + "minecraft:iron_helmet", + "minecraft:iron_chestplate", + "minecraft:iron_leggings", + "minecraft:iron_boots", + "minecraft:iron_horse_armor", + "minecraft:chainmail_helmet", + "minecraft:chainmail_chestplate", + "minecraft:chainmail_leggings", + "minecraft:chainmail_boots" ], "result": { "id": "minecraft:iron_nugget" diff --git a/data/minecraft/recipe/iron_nugget_from_smelting.json b/data/minecraft/recipe/iron_nugget_from_smelting.json index 6e2e3b0b..c7a4c340 100644 --- a/data/minecraft/recipe/iron_nugget_from_smelting.json +++ b/data/minecraft/recipe/iron_nugget_from_smelting.json @@ -4,48 +4,20 @@ "cookingtime": 200, "experience": 0.1, "ingredient": [ - { - "item": "minecraft:iron_pickaxe" - }, - { - "item": "minecraft:iron_shovel" - }, - { - "item": "minecraft:iron_axe" - }, - { - "item": "minecraft:iron_hoe" - }, - { - "item": "minecraft:iron_sword" - }, - { - "item": "minecraft:iron_helmet" - }, - { - "item": "minecraft:iron_chestplate" - }, - { - "item": "minecraft:iron_leggings" - }, - { - "item": "minecraft:iron_boots" - }, - { - "item": "minecraft:iron_horse_armor" - }, - { - "item": "minecraft:chainmail_helmet" - }, - { - "item": "minecraft:chainmail_chestplate" - }, - { - "item": "minecraft:chainmail_leggings" - }, - { - "item": "minecraft:chainmail_boots" - } + "minecraft:iron_pickaxe", + "minecraft:iron_shovel", + "minecraft:iron_axe", + "minecraft:iron_hoe", + "minecraft:iron_sword", + "minecraft:iron_helmet", + "minecraft:iron_chestplate", + "minecraft:iron_leggings", + "minecraft:iron_boots", + "minecraft:iron_horse_armor", + "minecraft:chainmail_helmet", + "minecraft:chainmail_chestplate", + "minecraft:chainmail_leggings", + "minecraft:chainmail_boots" ], "result": { "id": "minecraft:iron_nugget" diff --git a/data/minecraft/recipe/iron_pickaxe.json b/data/minecraft/recipe/iron_pickaxe.json index dc34f99a..611aeab2 100644 --- a/data/minecraft/recipe/iron_pickaxe.json +++ b/data/minecraft/recipe/iron_pickaxe.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shaped", "category": "equipment", "key": { - "#": { - "item": "minecraft:stick" - }, - "X": { - "item": "minecraft:iron_ingot" - } + "#": "minecraft:stick", + "X": "#minecraft:iron_tool_materials" }, "pattern": [ "XXX", diff --git a/data/minecraft/recipe/iron_shovel.json b/data/minecraft/recipe/iron_shovel.json index d9100ef3..9f00b05b 100644 --- a/data/minecraft/recipe/iron_shovel.json +++ b/data/minecraft/recipe/iron_shovel.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shaped", "category": "equipment", "key": { - "#": { - "item": "minecraft:stick" - }, - "X": { - "item": "minecraft:iron_ingot" - } + "#": "minecraft:stick", + "X": "#minecraft:iron_tool_materials" }, "pattern": [ "X", diff --git a/data/minecraft/recipe/iron_sword.json b/data/minecraft/recipe/iron_sword.json index 9525e0d8..ee639ff3 100644 --- a/data/minecraft/recipe/iron_sword.json +++ b/data/minecraft/recipe/iron_sword.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shaped", "category": "equipment", "key": { - "#": { - "item": "minecraft:stick" - }, - "X": { - "item": "minecraft:iron_ingot" - } + "#": "minecraft:stick", + "X": "#minecraft:iron_tool_materials" }, "pattern": [ "X", diff --git a/data/minecraft/recipe/iron_trapdoor.json b/data/minecraft/recipe/iron_trapdoor.json index 075241ba..e556393f 100644 --- a/data/minecraft/recipe/iron_trapdoor.json +++ b/data/minecraft/recipe/iron_trapdoor.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "redstone", "key": { - "#": { - "item": "minecraft:iron_ingot" - } + "#": "minecraft:iron_ingot" }, "pattern": [ "##", diff --git a/data/minecraft/recipe/item_frame.json b/data/minecraft/recipe/item_frame.json index a98aacf8..5dad6298 100644 --- a/data/minecraft/recipe/item_frame.json +++ b/data/minecraft/recipe/item_frame.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "#": { - "item": "minecraft:stick" - }, - "X": { - "item": "minecraft:leather" - } + "#": "minecraft:stick", + "X": "minecraft:leather" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/jack_o_lantern.json b/data/minecraft/recipe/jack_o_lantern.json index e1a83be8..ac4fdcb6 100644 --- a/data/minecraft/recipe/jack_o_lantern.json +++ b/data/minecraft/recipe/jack_o_lantern.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "A": { - "item": "minecraft:carved_pumpkin" - }, - "B": { - "item": "minecraft:torch" - } + "A": "minecraft:carved_pumpkin", + "B": "minecraft:torch" }, "pattern": [ "A", diff --git a/data/minecraft/recipe/jukebox.json b/data/minecraft/recipe/jukebox.json index e655b5e1..cf590829 100644 --- a/data/minecraft/recipe/jukebox.json +++ b/data/minecraft/recipe/jukebox.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "#": { - "tag": "minecraft:planks" - }, - "X": { - "item": "minecraft:diamond" - } + "#": "#minecraft:planks", + "X": "minecraft:diamond" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/jungle_boat.json b/data/minecraft/recipe/jungle_boat.json index e2511c89..521c8528 100644 --- a/data/minecraft/recipe/jungle_boat.json +++ b/data/minecraft/recipe/jungle_boat.json @@ -3,9 +3,7 @@ "category": "misc", "group": "boat", "key": { - "#": { - "item": "minecraft:jungle_planks" - } + "#": "minecraft:jungle_planks" }, "pattern": [ "# #", diff --git a/data/minecraft/recipe/jungle_button.json b/data/minecraft/recipe/jungle_button.json index d1d16acb..b6022354 100644 --- a/data/minecraft/recipe/jungle_button.json +++ b/data/minecraft/recipe/jungle_button.json @@ -3,9 +3,7 @@ "category": "redstone", "group": "wooden_button", "ingredients": [ - { - "item": "minecraft:jungle_planks" - } + "minecraft:jungle_planks" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/jungle_chest_boat.json b/data/minecraft/recipe/jungle_chest_boat.json index df5ebea1..ff28fe6f 100644 --- a/data/minecraft/recipe/jungle_chest_boat.json +++ b/data/minecraft/recipe/jungle_chest_boat.json @@ -3,12 +3,8 @@ "category": "misc", "group": "chest_boat", "ingredients": [ - { - "item": "minecraft:chest" - }, - { - "item": "minecraft:jungle_boat" - } + "minecraft:chest", + "minecraft:jungle_boat" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/jungle_door.json b/data/minecraft/recipe/jungle_door.json index 7e343e19..0a989a29 100644 --- a/data/minecraft/recipe/jungle_door.json +++ b/data/minecraft/recipe/jungle_door.json @@ -3,9 +3,7 @@ "category": "redstone", "group": "wooden_door", "key": { - "#": { - "item": "minecraft:jungle_planks" - } + "#": "minecraft:jungle_planks" }, "pattern": [ "##", diff --git a/data/minecraft/recipe/jungle_fence.json b/data/minecraft/recipe/jungle_fence.json index f4ed1231..1de0f5bb 100644 --- a/data/minecraft/recipe/jungle_fence.json +++ b/data/minecraft/recipe/jungle_fence.json @@ -3,12 +3,8 @@ "category": "misc", "group": "wooden_fence", "key": { - "#": { - "item": "minecraft:stick" - }, - "W": { - "item": "minecraft:jungle_planks" - } + "#": "minecraft:stick", + "W": "minecraft:jungle_planks" }, "pattern": [ "W#W", diff --git a/data/minecraft/recipe/jungle_fence_gate.json b/data/minecraft/recipe/jungle_fence_gate.json index 4f91ccd9..8bd1c8f8 100644 --- a/data/minecraft/recipe/jungle_fence_gate.json +++ b/data/minecraft/recipe/jungle_fence_gate.json @@ -3,12 +3,8 @@ "category": "redstone", "group": "wooden_fence_gate", "key": { - "#": { - "item": "minecraft:stick" - }, - "W": { - "item": "minecraft:jungle_planks" - } + "#": "minecraft:stick", + "W": "minecraft:jungle_planks" }, "pattern": [ "#W#", diff --git a/data/minecraft/recipe/jungle_hanging_sign.json b/data/minecraft/recipe/jungle_hanging_sign.json index d003664a..6706ac23 100644 --- a/data/minecraft/recipe/jungle_hanging_sign.json +++ b/data/minecraft/recipe/jungle_hanging_sign.json @@ -3,12 +3,8 @@ "category": "misc", "group": "hanging_sign", "key": { - "#": { - "item": "minecraft:stripped_jungle_log" - }, - "X": { - "item": "minecraft:chain" - } + "#": "minecraft:stripped_jungle_log", + "X": "minecraft:chain" }, "pattern": [ "X X", diff --git a/data/minecraft/recipe/jungle_planks.json b/data/minecraft/recipe/jungle_planks.json index 67f1f919..a5ced331 100644 --- a/data/minecraft/recipe/jungle_planks.json +++ b/data/minecraft/recipe/jungle_planks.json @@ -3,9 +3,7 @@ "category": "building", "group": "planks", "ingredients": [ - { - "tag": "minecraft:jungle_logs" - } + "#minecraft:jungle_logs" ], "result": { "count": 4, diff --git a/data/minecraft/recipe/jungle_pressure_plate.json b/data/minecraft/recipe/jungle_pressure_plate.json index e75ee512..ac72d29b 100644 --- a/data/minecraft/recipe/jungle_pressure_plate.json +++ b/data/minecraft/recipe/jungle_pressure_plate.json @@ -3,9 +3,7 @@ "category": "redstone", "group": "wooden_pressure_plate", "key": { - "#": { - "item": "minecraft:jungle_planks" - } + "#": "minecraft:jungle_planks" }, "pattern": [ "##" diff --git a/data/minecraft/recipe/jungle_sign.json b/data/minecraft/recipe/jungle_sign.json index cf8da545..dd5e3ad2 100644 --- a/data/minecraft/recipe/jungle_sign.json +++ b/data/minecraft/recipe/jungle_sign.json @@ -3,12 +3,8 @@ "category": "misc", "group": "wooden_sign", "key": { - "#": { - "item": "minecraft:jungle_planks" - }, - "X": { - "item": "minecraft:stick" - } + "#": "minecraft:jungle_planks", + "X": "minecraft:stick" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/jungle_slab.json b/data/minecraft/recipe/jungle_slab.json index d1f33536..cd6ace80 100644 --- a/data/minecraft/recipe/jungle_slab.json +++ b/data/minecraft/recipe/jungle_slab.json @@ -3,9 +3,7 @@ "category": "building", "group": "wooden_slab", "key": { - "#": { - "item": "minecraft:jungle_planks" - } + "#": "minecraft:jungle_planks" }, "pattern": [ "###" diff --git a/data/minecraft/recipe/jungle_stairs.json b/data/minecraft/recipe/jungle_stairs.json index 53a7b3cf..194f3e98 100644 --- a/data/minecraft/recipe/jungle_stairs.json +++ b/data/minecraft/recipe/jungle_stairs.json @@ -3,9 +3,7 @@ "category": "building", "group": "wooden_stairs", "key": { - "#": { - "item": "minecraft:jungle_planks" - } + "#": "minecraft:jungle_planks" }, "pattern": [ "# ", diff --git a/data/minecraft/recipe/jungle_trapdoor.json b/data/minecraft/recipe/jungle_trapdoor.json index 048194a3..f63d5277 100644 --- a/data/minecraft/recipe/jungle_trapdoor.json +++ b/data/minecraft/recipe/jungle_trapdoor.json @@ -3,9 +3,7 @@ "category": "redstone", "group": "wooden_trapdoor", "key": { - "#": { - "item": "minecraft:jungle_planks" - } + "#": "minecraft:jungle_planks" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/jungle_wood.json b/data/minecraft/recipe/jungle_wood.json index ee41aca3..699c943f 100644 --- a/data/minecraft/recipe/jungle_wood.json +++ b/data/minecraft/recipe/jungle_wood.json @@ -3,9 +3,7 @@ "category": "building", "group": "bark", "key": { - "#": { - "item": "minecraft:jungle_log" - } + "#": "minecraft:jungle_log" }, "pattern": [ "##", diff --git a/data/minecraft/recipe/ladder.json b/data/minecraft/recipe/ladder.json index 103c56cc..cbfba8ee 100644 --- a/data/minecraft/recipe/ladder.json +++ b/data/minecraft/recipe/ladder.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "#": { - "item": "minecraft:stick" - } + "#": "minecraft:stick" }, "pattern": [ "# #", diff --git a/data/minecraft/recipe/lantern.json b/data/minecraft/recipe/lantern.json index e4c39240..33f259cf 100644 --- a/data/minecraft/recipe/lantern.json +++ b/data/minecraft/recipe/lantern.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "#": { - "item": "minecraft:torch" - }, - "X": { - "item": "minecraft:iron_nugget" - } + "#": "minecraft:torch", + "X": "minecraft:iron_nugget" }, "pattern": [ "XXX", diff --git a/data/minecraft/recipe/lapis_block.json b/data/minecraft/recipe/lapis_block.json index f31c939f..36539437 100644 --- a/data/minecraft/recipe/lapis_block.json +++ b/data/minecraft/recipe/lapis_block.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:lapis_lazuli" - } + "#": "minecraft:lapis_lazuli" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/lapis_lazuli.json b/data/minecraft/recipe/lapis_lazuli.json index 55a30a11..4aece460 100644 --- a/data/minecraft/recipe/lapis_lazuli.json +++ b/data/minecraft/recipe/lapis_lazuli.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shapeless", "category": "misc", "ingredients": [ - { - "item": "minecraft:lapis_block" - } + "minecraft:lapis_block" ], "result": { "count": 9, diff --git a/data/minecraft/recipe/lapis_lazuli_from_blasting_deepslate_lapis_ore.json b/data/minecraft/recipe/lapis_lazuli_from_blasting_deepslate_lapis_ore.json index 8697d73f..f329523c 100644 --- a/data/minecraft/recipe/lapis_lazuli_from_blasting_deepslate_lapis_ore.json +++ b/data/minecraft/recipe/lapis_lazuli_from_blasting_deepslate_lapis_ore.json @@ -4,9 +4,7 @@ "cookingtime": 100, "experience": 0.2, "group": "lapis_lazuli", - "ingredient": { - "item": "minecraft:deepslate_lapis_ore" - }, + "ingredient": "minecraft:deepslate_lapis_ore", "result": { "id": "minecraft:lapis_lazuli" } diff --git a/data/minecraft/recipe/lapis_lazuli_from_blasting_lapis_ore.json b/data/minecraft/recipe/lapis_lazuli_from_blasting_lapis_ore.json index 1f244b48..b88b70f2 100644 --- a/data/minecraft/recipe/lapis_lazuli_from_blasting_lapis_ore.json +++ b/data/minecraft/recipe/lapis_lazuli_from_blasting_lapis_ore.json @@ -4,9 +4,7 @@ "cookingtime": 100, "experience": 0.2, "group": "lapis_lazuli", - "ingredient": { - "item": "minecraft:lapis_ore" - }, + "ingredient": "minecraft:lapis_ore", "result": { "id": "minecraft:lapis_lazuli" } diff --git a/data/minecraft/recipe/lapis_lazuli_from_smelting_deepslate_lapis_ore.json b/data/minecraft/recipe/lapis_lazuli_from_smelting_deepslate_lapis_ore.json index af2bbe4e..9493969d 100644 --- a/data/minecraft/recipe/lapis_lazuli_from_smelting_deepslate_lapis_ore.json +++ b/data/minecraft/recipe/lapis_lazuli_from_smelting_deepslate_lapis_ore.json @@ -4,9 +4,7 @@ "cookingtime": 200, "experience": 0.2, "group": "lapis_lazuli", - "ingredient": { - "item": "minecraft:deepslate_lapis_ore" - }, + "ingredient": "minecraft:deepslate_lapis_ore", "result": { "id": "minecraft:lapis_lazuli" } diff --git a/data/minecraft/recipe/lapis_lazuli_from_smelting_lapis_ore.json b/data/minecraft/recipe/lapis_lazuli_from_smelting_lapis_ore.json index 40102488..2ff1bf54 100644 --- a/data/minecraft/recipe/lapis_lazuli_from_smelting_lapis_ore.json +++ b/data/minecraft/recipe/lapis_lazuli_from_smelting_lapis_ore.json @@ -4,9 +4,7 @@ "cookingtime": 200, "experience": 0.2, "group": "lapis_lazuli", - "ingredient": { - "item": "minecraft:lapis_ore" - }, + "ingredient": "minecraft:lapis_ore", "result": { "id": "minecraft:lapis_lazuli" } diff --git a/data/minecraft/recipe/lead.json b/data/minecraft/recipe/lead.json index 803e8b3c..647426d6 100644 --- a/data/minecraft/recipe/lead.json +++ b/data/minecraft/recipe/lead.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shaped", "category": "equipment", "key": { - "O": { - "item": "minecraft:slime_ball" - }, - "~": { - "item": "minecraft:string" - } + "O": "minecraft:slime_ball", + "~": "minecraft:string" }, "pattern": [ "~~ ", diff --git a/data/minecraft/recipe/leather.json b/data/minecraft/recipe/leather.json index 2ebd711b..bf8ea7dd 100644 --- a/data/minecraft/recipe/leather.json +++ b/data/minecraft/recipe/leather.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "#": { - "item": "minecraft:rabbit_hide" - } + "#": "minecraft:rabbit_hide" }, "pattern": [ "##", diff --git a/data/minecraft/recipe/leather_boots.json b/data/minecraft/recipe/leather_boots.json index 8141c0bc..81213956 100644 --- a/data/minecraft/recipe/leather_boots.json +++ b/data/minecraft/recipe/leather_boots.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "equipment", "key": { - "X": { - "item": "minecraft:leather" - } + "X": "minecraft:leather" }, "pattern": [ "X X", diff --git a/data/minecraft/recipe/leather_chestplate.json b/data/minecraft/recipe/leather_chestplate.json index a32f9ef1..6c44c2bd 100644 --- a/data/minecraft/recipe/leather_chestplate.json +++ b/data/minecraft/recipe/leather_chestplate.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "equipment", "key": { - "X": { - "item": "minecraft:leather" - } + "X": "minecraft:leather" }, "pattern": [ "X X", diff --git a/data/minecraft/recipe/leather_helmet.json b/data/minecraft/recipe/leather_helmet.json index 6295fe83..2767ae5e 100644 --- a/data/minecraft/recipe/leather_helmet.json +++ b/data/minecraft/recipe/leather_helmet.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "equipment", "key": { - "X": { - "item": "minecraft:leather" - } + "X": "minecraft:leather" }, "pattern": [ "XXX", diff --git a/data/minecraft/recipe/leather_horse_armor.json b/data/minecraft/recipe/leather_horse_armor.json index cd82c8a0..b7cbccf1 100644 --- a/data/minecraft/recipe/leather_horse_armor.json +++ b/data/minecraft/recipe/leather_horse_armor.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "X": { - "item": "minecraft:leather" - } + "X": "minecraft:leather" }, "pattern": [ "X X", diff --git a/data/minecraft/recipe/leather_leggings.json b/data/minecraft/recipe/leather_leggings.json index 550dd310..23f5397e 100644 --- a/data/minecraft/recipe/leather_leggings.json +++ b/data/minecraft/recipe/leather_leggings.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "equipment", "key": { - "X": { - "item": "minecraft:leather" - } + "X": "minecraft:leather" }, "pattern": [ "XXX", diff --git a/data/minecraft/recipe/lectern.json b/data/minecraft/recipe/lectern.json index 720c9a89..47c874e2 100644 --- a/data/minecraft/recipe/lectern.json +++ b/data/minecraft/recipe/lectern.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shaped", "category": "redstone", "key": { - "B": { - "item": "minecraft:bookshelf" - }, - "S": { - "tag": "minecraft:wooden_slabs" - } + "B": "minecraft:bookshelf", + "S": "#minecraft:wooden_slabs" }, "pattern": [ "SSS", diff --git a/data/minecraft/recipe/lever.json b/data/minecraft/recipe/lever.json index d4250e9b..2e2a1abb 100644 --- a/data/minecraft/recipe/lever.json +++ b/data/minecraft/recipe/lever.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shaped", "category": "redstone", "key": { - "#": { - "item": "minecraft:cobblestone" - }, - "X": { - "item": "minecraft:stick" - } + "#": "minecraft:cobblestone", + "X": "minecraft:stick" }, "pattern": [ "X", diff --git a/data/minecraft/recipe/light_blue_banner.json b/data/minecraft/recipe/light_blue_banner.json index 35f1f284..f6173cc3 100644 --- a/data/minecraft/recipe/light_blue_banner.json +++ b/data/minecraft/recipe/light_blue_banner.json @@ -3,12 +3,8 @@ "category": "misc", "group": "banner", "key": { - "#": { - "item": "minecraft:light_blue_wool" - }, - "|": { - "item": "minecraft:stick" - } + "#": "minecraft:light_blue_wool", + "|": "minecraft:stick" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/light_blue_bed.json b/data/minecraft/recipe/light_blue_bed.json index c82e0c03..cd3ea952 100644 --- a/data/minecraft/recipe/light_blue_bed.json +++ b/data/minecraft/recipe/light_blue_bed.json @@ -3,12 +3,8 @@ "category": "misc", "group": "bed", "key": { - "#": { - "item": "minecraft:light_blue_wool" - }, - "X": { - "tag": "minecraft:planks" - } + "#": "minecraft:light_blue_wool", + "X": "#minecraft:planks" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/light_blue_bundle.json b/data/minecraft/recipe/light_blue_bundle.json new file mode 100644 index 00000000..a0a105d9 --- /dev/null +++ b/data/minecraft/recipe/light_blue_bundle.json @@ -0,0 +1,8 @@ +{ + "type": "minecraft:crafting_transmute", + "category": "equipment", + "group": "bundle_dye", + "input": "#minecraft:bundles", + "material": "minecraft:light_blue_dye", + "result": "minecraft:light_blue_bundle" +} \ No newline at end of file diff --git a/data/minecraft/recipe/light_blue_candle.json b/data/minecraft/recipe/light_blue_candle.json index fc6d5815..1af95c6d 100644 --- a/data/minecraft/recipe/light_blue_candle.json +++ b/data/minecraft/recipe/light_blue_candle.json @@ -3,12 +3,8 @@ "category": "misc", "group": "dyed_candle", "ingredients": [ - { - "item": "minecraft:candle" - }, - { - "item": "minecraft:light_blue_dye" - } + "minecraft:candle", + "minecraft:light_blue_dye" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/light_blue_carpet.json b/data/minecraft/recipe/light_blue_carpet.json index bd55bb14..a313438a 100644 --- a/data/minecraft/recipe/light_blue_carpet.json +++ b/data/minecraft/recipe/light_blue_carpet.json @@ -3,9 +3,7 @@ "category": "misc", "group": "carpet", "key": { - "#": { - "item": "minecraft:light_blue_wool" - } + "#": "minecraft:light_blue_wool" }, "pattern": [ "##" diff --git a/data/minecraft/recipe/light_blue_concrete_powder.json b/data/minecraft/recipe/light_blue_concrete_powder.json index 21a2d119..f3b8aa64 100644 --- a/data/minecraft/recipe/light_blue_concrete_powder.json +++ b/data/minecraft/recipe/light_blue_concrete_powder.json @@ -3,33 +3,15 @@ "category": "building", "group": "concrete_powder", "ingredients": [ - { - "item": "minecraft:light_blue_dye" - }, - { - "item": "minecraft:sand" - }, - { - "item": "minecraft:sand" - }, - { - "item": "minecraft:sand" - }, - { - "item": "minecraft:sand" - }, - { - "item": "minecraft:gravel" - }, - { - "item": "minecraft:gravel" - }, - { - "item": "minecraft:gravel" - }, - { - "item": "minecraft:gravel" - } + "minecraft:light_blue_dye", + "minecraft:sand", + "minecraft:sand", + "minecraft:sand", + "minecraft:sand", + "minecraft:gravel", + "minecraft:gravel", + "minecraft:gravel", + "minecraft:gravel" ], "result": { "count": 8, diff --git a/data/minecraft/recipe/light_blue_dye_from_blue_orchid.json b/data/minecraft/recipe/light_blue_dye_from_blue_orchid.json index b310c040..b4a70c38 100644 --- a/data/minecraft/recipe/light_blue_dye_from_blue_orchid.json +++ b/data/minecraft/recipe/light_blue_dye_from_blue_orchid.json @@ -3,9 +3,7 @@ "category": "misc", "group": "light_blue_dye", "ingredients": [ - { - "item": "minecraft:blue_orchid" - } + "minecraft:blue_orchid" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/light_blue_dye_from_blue_white_dye.json b/data/minecraft/recipe/light_blue_dye_from_blue_white_dye.json index eb2e6a32..8bba37bb 100644 --- a/data/minecraft/recipe/light_blue_dye_from_blue_white_dye.json +++ b/data/minecraft/recipe/light_blue_dye_from_blue_white_dye.json @@ -3,12 +3,8 @@ "category": "misc", "group": "light_blue_dye", "ingredients": [ - { - "item": "minecraft:blue_dye" - }, - { - "item": "minecraft:white_dye" - } + "minecraft:blue_dye", + "minecraft:white_dye" ], "result": { "count": 2, diff --git a/data/minecraft/recipe/light_blue_glazed_terracotta.json b/data/minecraft/recipe/light_blue_glazed_terracotta.json index e3528c4c..febbbf52 100644 --- a/data/minecraft/recipe/light_blue_glazed_terracotta.json +++ b/data/minecraft/recipe/light_blue_glazed_terracotta.json @@ -3,9 +3,7 @@ "category": "blocks", "cookingtime": 200, "experience": 0.1, - "ingredient": { - "item": "minecraft:light_blue_terracotta" - }, + "ingredient": "minecraft:light_blue_terracotta", "result": { "id": "minecraft:light_blue_glazed_terracotta" } diff --git a/data/minecraft/recipe/light_blue_shulker_box.json b/data/minecraft/recipe/light_blue_shulker_box.json new file mode 100644 index 00000000..53604ac0 --- /dev/null +++ b/data/minecraft/recipe/light_blue_shulker_box.json @@ -0,0 +1,8 @@ +{ + "type": "minecraft:crafting_transmute", + "category": "misc", + "group": "shulker_box_dye", + "input": "#minecraft:shulker_boxes", + "material": "minecraft:light_blue_dye", + "result": "minecraft:light_blue_shulker_box" +} \ No newline at end of file diff --git a/data/minecraft/recipe/light_blue_stained_glass.json b/data/minecraft/recipe/light_blue_stained_glass.json index 437113c5..a657c4e6 100644 --- a/data/minecraft/recipe/light_blue_stained_glass.json +++ b/data/minecraft/recipe/light_blue_stained_glass.json @@ -3,12 +3,8 @@ "category": "building", "group": "stained_glass", "key": { - "#": { - "item": "minecraft:glass" - }, - "X": { - "item": "minecraft:light_blue_dye" - } + "#": "minecraft:glass", + "X": "minecraft:light_blue_dye" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/light_blue_stained_glass_pane.json b/data/minecraft/recipe/light_blue_stained_glass_pane.json index 6644cfcb..3ee4022a 100644 --- a/data/minecraft/recipe/light_blue_stained_glass_pane.json +++ b/data/minecraft/recipe/light_blue_stained_glass_pane.json @@ -3,9 +3,7 @@ "category": "misc", "group": "stained_glass_pane", "key": { - "#": { - "item": "minecraft:light_blue_stained_glass" - } + "#": "minecraft:light_blue_stained_glass" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/light_blue_stained_glass_pane_from_glass_pane.json b/data/minecraft/recipe/light_blue_stained_glass_pane_from_glass_pane.json index c88b2fe1..76306fa9 100644 --- a/data/minecraft/recipe/light_blue_stained_glass_pane_from_glass_pane.json +++ b/data/minecraft/recipe/light_blue_stained_glass_pane_from_glass_pane.json @@ -3,12 +3,8 @@ "category": "misc", "group": "stained_glass_pane", "key": { - "#": { - "item": "minecraft:glass_pane" - }, - "$": { - "item": "minecraft:light_blue_dye" - } + "#": "minecraft:glass_pane", + "$": "minecraft:light_blue_dye" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/light_blue_terracotta.json b/data/minecraft/recipe/light_blue_terracotta.json index 8dd86951..2254c062 100644 --- a/data/minecraft/recipe/light_blue_terracotta.json +++ b/data/minecraft/recipe/light_blue_terracotta.json @@ -3,12 +3,8 @@ "category": "building", "group": "stained_terracotta", "key": { - "#": { - "item": "minecraft:terracotta" - }, - "X": { - "item": "minecraft:light_blue_dye" - } + "#": "minecraft:terracotta", + "X": "minecraft:light_blue_dye" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/light_gray_banner.json b/data/minecraft/recipe/light_gray_banner.json index 0797185f..98857d79 100644 --- a/data/minecraft/recipe/light_gray_banner.json +++ b/data/minecraft/recipe/light_gray_banner.json @@ -3,12 +3,8 @@ "category": "misc", "group": "banner", "key": { - "#": { - "item": "minecraft:light_gray_wool" - }, - "|": { - "item": "minecraft:stick" - } + "#": "minecraft:light_gray_wool", + "|": "minecraft:stick" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/light_gray_bed.json b/data/minecraft/recipe/light_gray_bed.json index 5cd91070..0e694b6b 100644 --- a/data/minecraft/recipe/light_gray_bed.json +++ b/data/minecraft/recipe/light_gray_bed.json @@ -3,12 +3,8 @@ "category": "misc", "group": "bed", "key": { - "#": { - "item": "minecraft:light_gray_wool" - }, - "X": { - "tag": "minecraft:planks" - } + "#": "minecraft:light_gray_wool", + "X": "#minecraft:planks" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/light_gray_bundle.json b/data/minecraft/recipe/light_gray_bundle.json new file mode 100644 index 00000000..6e416c06 --- /dev/null +++ b/data/minecraft/recipe/light_gray_bundle.json @@ -0,0 +1,8 @@ +{ + "type": "minecraft:crafting_transmute", + "category": "equipment", + "group": "bundle_dye", + "input": "#minecraft:bundles", + "material": "minecraft:light_gray_dye", + "result": "minecraft:light_gray_bundle" +} \ No newline at end of file diff --git a/data/minecraft/recipe/light_gray_candle.json b/data/minecraft/recipe/light_gray_candle.json index 60750af9..c685b289 100644 --- a/data/minecraft/recipe/light_gray_candle.json +++ b/data/minecraft/recipe/light_gray_candle.json @@ -3,12 +3,8 @@ "category": "misc", "group": "dyed_candle", "ingredients": [ - { - "item": "minecraft:candle" - }, - { - "item": "minecraft:light_gray_dye" - } + "minecraft:candle", + "minecraft:light_gray_dye" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/light_gray_carpet.json b/data/minecraft/recipe/light_gray_carpet.json index 41e26b4c..9f53678e 100644 --- a/data/minecraft/recipe/light_gray_carpet.json +++ b/data/minecraft/recipe/light_gray_carpet.json @@ -3,9 +3,7 @@ "category": "misc", "group": "carpet", "key": { - "#": { - "item": "minecraft:light_gray_wool" - } + "#": "minecraft:light_gray_wool" }, "pattern": [ "##" diff --git a/data/minecraft/recipe/light_gray_concrete_powder.json b/data/minecraft/recipe/light_gray_concrete_powder.json index 05c63572..3af569d5 100644 --- a/data/minecraft/recipe/light_gray_concrete_powder.json +++ b/data/minecraft/recipe/light_gray_concrete_powder.json @@ -3,33 +3,15 @@ "category": "building", "group": "concrete_powder", "ingredients": [ - { - "item": "minecraft:light_gray_dye" - }, - { - "item": "minecraft:sand" - }, - { - "item": "minecraft:sand" - }, - { - "item": "minecraft:sand" - }, - { - "item": "minecraft:sand" - }, - { - "item": "minecraft:gravel" - }, - { - "item": "minecraft:gravel" - }, - { - "item": "minecraft:gravel" - }, - { - "item": "minecraft:gravel" - } + "minecraft:light_gray_dye", + "minecraft:sand", + "minecraft:sand", + "minecraft:sand", + "minecraft:sand", + "minecraft:gravel", + "minecraft:gravel", + "minecraft:gravel", + "minecraft:gravel" ], "result": { "count": 8, diff --git a/data/minecraft/recipe/light_gray_dye_from_azure_bluet.json b/data/minecraft/recipe/light_gray_dye_from_azure_bluet.json index 4bb0f1fb..0f526554 100644 --- a/data/minecraft/recipe/light_gray_dye_from_azure_bluet.json +++ b/data/minecraft/recipe/light_gray_dye_from_azure_bluet.json @@ -3,9 +3,7 @@ "category": "misc", "group": "light_gray_dye", "ingredients": [ - { - "item": "minecraft:azure_bluet" - } + "minecraft:azure_bluet" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/light_gray_dye_from_black_white_dye.json b/data/minecraft/recipe/light_gray_dye_from_black_white_dye.json index 55df87c6..2e0e91fd 100644 --- a/data/minecraft/recipe/light_gray_dye_from_black_white_dye.json +++ b/data/minecraft/recipe/light_gray_dye_from_black_white_dye.json @@ -3,15 +3,9 @@ "category": "misc", "group": "light_gray_dye", "ingredients": [ - { - "item": "minecraft:black_dye" - }, - { - "item": "minecraft:white_dye" - }, - { - "item": "minecraft:white_dye" - } + "minecraft:black_dye", + "minecraft:white_dye", + "minecraft:white_dye" ], "result": { "count": 3, diff --git a/data/minecraft/recipe/light_gray_dye_from_gray_white_dye.json b/data/minecraft/recipe/light_gray_dye_from_gray_white_dye.json index 69a30475..3b975a27 100644 --- a/data/minecraft/recipe/light_gray_dye_from_gray_white_dye.json +++ b/data/minecraft/recipe/light_gray_dye_from_gray_white_dye.json @@ -3,12 +3,8 @@ "category": "misc", "group": "light_gray_dye", "ingredients": [ - { - "item": "minecraft:gray_dye" - }, - { - "item": "minecraft:white_dye" - } + "minecraft:gray_dye", + "minecraft:white_dye" ], "result": { "count": 2, diff --git a/data/minecraft/recipe/light_gray_dye_from_oxeye_daisy.json b/data/minecraft/recipe/light_gray_dye_from_oxeye_daisy.json index 34f3b4fe..cdd811cc 100644 --- a/data/minecraft/recipe/light_gray_dye_from_oxeye_daisy.json +++ b/data/minecraft/recipe/light_gray_dye_from_oxeye_daisy.json @@ -3,9 +3,7 @@ "category": "misc", "group": "light_gray_dye", "ingredients": [ - { - "item": "minecraft:oxeye_daisy" - } + "minecraft:oxeye_daisy" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/light_gray_dye_from_white_tulip.json b/data/minecraft/recipe/light_gray_dye_from_white_tulip.json index 8d5cbd94..3c97376d 100644 --- a/data/minecraft/recipe/light_gray_dye_from_white_tulip.json +++ b/data/minecraft/recipe/light_gray_dye_from_white_tulip.json @@ -3,9 +3,7 @@ "category": "misc", "group": "light_gray_dye", "ingredients": [ - { - "item": "minecraft:white_tulip" - } + "minecraft:white_tulip" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/light_gray_glazed_terracotta.json b/data/minecraft/recipe/light_gray_glazed_terracotta.json index 01b9bfbd..3b5ce20c 100644 --- a/data/minecraft/recipe/light_gray_glazed_terracotta.json +++ b/data/minecraft/recipe/light_gray_glazed_terracotta.json @@ -3,9 +3,7 @@ "category": "blocks", "cookingtime": 200, "experience": 0.1, - "ingredient": { - "item": "minecraft:light_gray_terracotta" - }, + "ingredient": "minecraft:light_gray_terracotta", "result": { "id": "minecraft:light_gray_glazed_terracotta" } diff --git a/data/minecraft/recipe/light_gray_shulker_box.json b/data/minecraft/recipe/light_gray_shulker_box.json new file mode 100644 index 00000000..3921cf87 --- /dev/null +++ b/data/minecraft/recipe/light_gray_shulker_box.json @@ -0,0 +1,8 @@ +{ + "type": "minecraft:crafting_transmute", + "category": "misc", + "group": "shulker_box_dye", + "input": "#minecraft:shulker_boxes", + "material": "minecraft:light_gray_dye", + "result": "minecraft:light_gray_shulker_box" +} \ No newline at end of file diff --git a/data/minecraft/recipe/light_gray_stained_glass.json b/data/minecraft/recipe/light_gray_stained_glass.json index e43a5eb3..cd8d1a8e 100644 --- a/data/minecraft/recipe/light_gray_stained_glass.json +++ b/data/minecraft/recipe/light_gray_stained_glass.json @@ -3,12 +3,8 @@ "category": "building", "group": "stained_glass", "key": { - "#": { - "item": "minecraft:glass" - }, - "X": { - "item": "minecraft:light_gray_dye" - } + "#": "minecraft:glass", + "X": "minecraft:light_gray_dye" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/light_gray_stained_glass_pane.json b/data/minecraft/recipe/light_gray_stained_glass_pane.json index e25f68f8..9adb8cdb 100644 --- a/data/minecraft/recipe/light_gray_stained_glass_pane.json +++ b/data/minecraft/recipe/light_gray_stained_glass_pane.json @@ -3,9 +3,7 @@ "category": "misc", "group": "stained_glass_pane", "key": { - "#": { - "item": "minecraft:light_gray_stained_glass" - } + "#": "minecraft:light_gray_stained_glass" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/light_gray_stained_glass_pane_from_glass_pane.json b/data/minecraft/recipe/light_gray_stained_glass_pane_from_glass_pane.json index 21e1fc19..697b8309 100644 --- a/data/minecraft/recipe/light_gray_stained_glass_pane_from_glass_pane.json +++ b/data/minecraft/recipe/light_gray_stained_glass_pane_from_glass_pane.json @@ -3,12 +3,8 @@ "category": "misc", "group": "stained_glass_pane", "key": { - "#": { - "item": "minecraft:glass_pane" - }, - "$": { - "item": "minecraft:light_gray_dye" - } + "#": "minecraft:glass_pane", + "$": "minecraft:light_gray_dye" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/light_gray_terracotta.json b/data/minecraft/recipe/light_gray_terracotta.json index 72a9c906..b24d944e 100644 --- a/data/minecraft/recipe/light_gray_terracotta.json +++ b/data/minecraft/recipe/light_gray_terracotta.json @@ -3,12 +3,8 @@ "category": "building", "group": "stained_terracotta", "key": { - "#": { - "item": "minecraft:terracotta" - }, - "X": { - "item": "minecraft:light_gray_dye" - } + "#": "minecraft:terracotta", + "X": "minecraft:light_gray_dye" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/light_weighted_pressure_plate.json b/data/minecraft/recipe/light_weighted_pressure_plate.json index eb602d1a..d21041d9 100644 --- a/data/minecraft/recipe/light_weighted_pressure_plate.json +++ b/data/minecraft/recipe/light_weighted_pressure_plate.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "redstone", "key": { - "#": { - "item": "minecraft:gold_ingot" - } + "#": "minecraft:gold_ingot" }, "pattern": [ "##" diff --git a/data/minecraft/recipe/lightning_rod.json b/data/minecraft/recipe/lightning_rod.json index 4d362327..9d5ed186 100644 --- a/data/minecraft/recipe/lightning_rod.json +++ b/data/minecraft/recipe/lightning_rod.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "redstone", "key": { - "#": { - "item": "minecraft:copper_ingot" - } + "#": "minecraft:copper_ingot" }, "pattern": [ "#", diff --git a/data/minecraft/recipe/lime_banner.json b/data/minecraft/recipe/lime_banner.json index 374aa2ba..a6187fbd 100644 --- a/data/minecraft/recipe/lime_banner.json +++ b/data/minecraft/recipe/lime_banner.json @@ -3,12 +3,8 @@ "category": "misc", "group": "banner", "key": { - "#": { - "item": "minecraft:lime_wool" - }, - "|": { - "item": "minecraft:stick" - } + "#": "minecraft:lime_wool", + "|": "minecraft:stick" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/lime_bed.json b/data/minecraft/recipe/lime_bed.json index 5ca298d8..283e7e61 100644 --- a/data/minecraft/recipe/lime_bed.json +++ b/data/minecraft/recipe/lime_bed.json @@ -3,12 +3,8 @@ "category": "misc", "group": "bed", "key": { - "#": { - "item": "minecraft:lime_wool" - }, - "X": { - "tag": "minecraft:planks" - } + "#": "minecraft:lime_wool", + "X": "#minecraft:planks" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/lime_bundle.json b/data/minecraft/recipe/lime_bundle.json new file mode 100644 index 00000000..6c1a2969 --- /dev/null +++ b/data/minecraft/recipe/lime_bundle.json @@ -0,0 +1,8 @@ +{ + "type": "minecraft:crafting_transmute", + "category": "equipment", + "group": "bundle_dye", + "input": "#minecraft:bundles", + "material": "minecraft:lime_dye", + "result": "minecraft:lime_bundle" +} \ No newline at end of file diff --git a/data/minecraft/recipe/lime_candle.json b/data/minecraft/recipe/lime_candle.json index bc843899..4081cf8a 100644 --- a/data/minecraft/recipe/lime_candle.json +++ b/data/minecraft/recipe/lime_candle.json @@ -3,12 +3,8 @@ "category": "misc", "group": "dyed_candle", "ingredients": [ - { - "item": "minecraft:candle" - }, - { - "item": "minecraft:lime_dye" - } + "minecraft:candle", + "minecraft:lime_dye" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/lime_carpet.json b/data/minecraft/recipe/lime_carpet.json index 04e1f9ad..5f1d63c6 100644 --- a/data/minecraft/recipe/lime_carpet.json +++ b/data/minecraft/recipe/lime_carpet.json @@ -3,9 +3,7 @@ "category": "misc", "group": "carpet", "key": { - "#": { - "item": "minecraft:lime_wool" - } + "#": "minecraft:lime_wool" }, "pattern": [ "##" diff --git a/data/minecraft/recipe/lime_concrete_powder.json b/data/minecraft/recipe/lime_concrete_powder.json index 50789d54..ac507482 100644 --- a/data/minecraft/recipe/lime_concrete_powder.json +++ b/data/minecraft/recipe/lime_concrete_powder.json @@ -3,33 +3,15 @@ "category": "building", "group": "concrete_powder", "ingredients": [ - { - "item": "minecraft:lime_dye" - }, - { - "item": "minecraft:sand" - }, - { - "item": "minecraft:sand" - }, - { - "item": "minecraft:sand" - }, - { - "item": "minecraft:sand" - }, - { - "item": "minecraft:gravel" - }, - { - "item": "minecraft:gravel" - }, - { - "item": "minecraft:gravel" - }, - { - "item": "minecraft:gravel" - } + "minecraft:lime_dye", + "minecraft:sand", + "minecraft:sand", + "minecraft:sand", + "minecraft:sand", + "minecraft:gravel", + "minecraft:gravel", + "minecraft:gravel", + "minecraft:gravel" ], "result": { "count": 8, diff --git a/data/minecraft/recipe/lime_dye.json b/data/minecraft/recipe/lime_dye.json index 103319d0..2024624b 100644 --- a/data/minecraft/recipe/lime_dye.json +++ b/data/minecraft/recipe/lime_dye.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shapeless", "category": "misc", "ingredients": [ - { - "item": "minecraft:green_dye" - }, - { - "item": "minecraft:white_dye" - } + "minecraft:green_dye", + "minecraft:white_dye" ], "result": { "count": 2, diff --git a/data/minecraft/recipe/lime_dye_from_smelting.json b/data/minecraft/recipe/lime_dye_from_smelting.json index 58fd175a..65a548ca 100644 --- a/data/minecraft/recipe/lime_dye_from_smelting.json +++ b/data/minecraft/recipe/lime_dye_from_smelting.json @@ -3,9 +3,7 @@ "category": "misc", "cookingtime": 200, "experience": 0.1, - "ingredient": { - "item": "minecraft:sea_pickle" - }, + "ingredient": "minecraft:sea_pickle", "result": { "id": "minecraft:lime_dye" } diff --git a/data/minecraft/recipe/lime_glazed_terracotta.json b/data/minecraft/recipe/lime_glazed_terracotta.json index 3274152c..4996e3f3 100644 --- a/data/minecraft/recipe/lime_glazed_terracotta.json +++ b/data/minecraft/recipe/lime_glazed_terracotta.json @@ -3,9 +3,7 @@ "category": "blocks", "cookingtime": 200, "experience": 0.1, - "ingredient": { - "item": "minecraft:lime_terracotta" - }, + "ingredient": "minecraft:lime_terracotta", "result": { "id": "minecraft:lime_glazed_terracotta" } diff --git a/data/minecraft/recipe/lime_shulker_box.json b/data/minecraft/recipe/lime_shulker_box.json new file mode 100644 index 00000000..5ca80d9c --- /dev/null +++ b/data/minecraft/recipe/lime_shulker_box.json @@ -0,0 +1,8 @@ +{ + "type": "minecraft:crafting_transmute", + "category": "misc", + "group": "shulker_box_dye", + "input": "#minecraft:shulker_boxes", + "material": "minecraft:lime_dye", + "result": "minecraft:lime_shulker_box" +} \ No newline at end of file diff --git a/data/minecraft/recipe/lime_stained_glass.json b/data/minecraft/recipe/lime_stained_glass.json index 0de0b387..4f5cee1f 100644 --- a/data/minecraft/recipe/lime_stained_glass.json +++ b/data/minecraft/recipe/lime_stained_glass.json @@ -3,12 +3,8 @@ "category": "building", "group": "stained_glass", "key": { - "#": { - "item": "minecraft:glass" - }, - "X": { - "item": "minecraft:lime_dye" - } + "#": "minecraft:glass", + "X": "minecraft:lime_dye" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/lime_stained_glass_pane.json b/data/minecraft/recipe/lime_stained_glass_pane.json index 55e3872d..d81b5f71 100644 --- a/data/minecraft/recipe/lime_stained_glass_pane.json +++ b/data/minecraft/recipe/lime_stained_glass_pane.json @@ -3,9 +3,7 @@ "category": "misc", "group": "stained_glass_pane", "key": { - "#": { - "item": "minecraft:lime_stained_glass" - } + "#": "minecraft:lime_stained_glass" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/lime_stained_glass_pane_from_glass_pane.json b/data/minecraft/recipe/lime_stained_glass_pane_from_glass_pane.json index a53b73d8..69999a75 100644 --- a/data/minecraft/recipe/lime_stained_glass_pane_from_glass_pane.json +++ b/data/minecraft/recipe/lime_stained_glass_pane_from_glass_pane.json @@ -3,12 +3,8 @@ "category": "misc", "group": "stained_glass_pane", "key": { - "#": { - "item": "minecraft:glass_pane" - }, - "$": { - "item": "minecraft:lime_dye" - } + "#": "minecraft:glass_pane", + "$": "minecraft:lime_dye" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/lime_terracotta.json b/data/minecraft/recipe/lime_terracotta.json index 62941cdd..996cff11 100644 --- a/data/minecraft/recipe/lime_terracotta.json +++ b/data/minecraft/recipe/lime_terracotta.json @@ -3,12 +3,8 @@ "category": "building", "group": "stained_terracotta", "key": { - "#": { - "item": "minecraft:terracotta" - }, - "X": { - "item": "minecraft:lime_dye" - } + "#": "minecraft:terracotta", + "X": "minecraft:lime_dye" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/lodestone.json b/data/minecraft/recipe/lodestone.json index 6709adc5..a83c3091 100644 --- a/data/minecraft/recipe/lodestone.json +++ b/data/minecraft/recipe/lodestone.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "#": { - "item": "minecraft:netherite_ingot" - }, - "S": { - "item": "minecraft:chiseled_stone_bricks" - } + "#": "minecraft:netherite_ingot", + "S": "minecraft:chiseled_stone_bricks" }, "pattern": [ "SSS", diff --git a/data/minecraft/recipe/loom.json b/data/minecraft/recipe/loom.json index 6bc34305..a715fc45 100644 --- a/data/minecraft/recipe/loom.json +++ b/data/minecraft/recipe/loom.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "#": { - "tag": "minecraft:planks" - }, - "@": { - "item": "minecraft:string" - } + "#": "#minecraft:planks", + "@": "minecraft:string" }, "pattern": [ "@@", diff --git a/data/minecraft/recipe/mace.json b/data/minecraft/recipe/mace.json index 32e8e6dd..564bb1b5 100644 --- a/data/minecraft/recipe/mace.json +++ b/data/minecraft/recipe/mace.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shaped", "category": "equipment", "key": { - "#": { - "item": "minecraft:heavy_core" - }, - "I": { - "item": "minecraft:breeze_rod" - } + "#": "minecraft:heavy_core", + "I": "minecraft:breeze_rod" }, "pattern": [ " # ", diff --git a/data/minecraft/recipe/magenta_banner.json b/data/minecraft/recipe/magenta_banner.json index a0991a0d..9018e142 100644 --- a/data/minecraft/recipe/magenta_banner.json +++ b/data/minecraft/recipe/magenta_banner.json @@ -3,12 +3,8 @@ "category": "misc", "group": "banner", "key": { - "#": { - "item": "minecraft:magenta_wool" - }, - "|": { - "item": "minecraft:stick" - } + "#": "minecraft:magenta_wool", + "|": "minecraft:stick" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/magenta_bed.json b/data/minecraft/recipe/magenta_bed.json index e39410c8..ea122685 100644 --- a/data/minecraft/recipe/magenta_bed.json +++ b/data/minecraft/recipe/magenta_bed.json @@ -3,12 +3,8 @@ "category": "misc", "group": "bed", "key": { - "#": { - "item": "minecraft:magenta_wool" - }, - "X": { - "tag": "minecraft:planks" - } + "#": "minecraft:magenta_wool", + "X": "#minecraft:planks" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/magenta_bundle.json b/data/minecraft/recipe/magenta_bundle.json new file mode 100644 index 00000000..4283ad14 --- /dev/null +++ b/data/minecraft/recipe/magenta_bundle.json @@ -0,0 +1,8 @@ +{ + "type": "minecraft:crafting_transmute", + "category": "equipment", + "group": "bundle_dye", + "input": "#minecraft:bundles", + "material": "minecraft:magenta_dye", + "result": "minecraft:magenta_bundle" +} \ No newline at end of file diff --git a/data/minecraft/recipe/magenta_candle.json b/data/minecraft/recipe/magenta_candle.json index 4189b814..24b5dcb1 100644 --- a/data/minecraft/recipe/magenta_candle.json +++ b/data/minecraft/recipe/magenta_candle.json @@ -3,12 +3,8 @@ "category": "misc", "group": "dyed_candle", "ingredients": [ - { - "item": "minecraft:candle" - }, - { - "item": "minecraft:magenta_dye" - } + "minecraft:candle", + "minecraft:magenta_dye" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/magenta_carpet.json b/data/minecraft/recipe/magenta_carpet.json index 53369607..197c1ec5 100644 --- a/data/minecraft/recipe/magenta_carpet.json +++ b/data/minecraft/recipe/magenta_carpet.json @@ -3,9 +3,7 @@ "category": "misc", "group": "carpet", "key": { - "#": { - "item": "minecraft:magenta_wool" - } + "#": "minecraft:magenta_wool" }, "pattern": [ "##" diff --git a/data/minecraft/recipe/magenta_concrete_powder.json b/data/minecraft/recipe/magenta_concrete_powder.json index 8f4d0fea..275bc0b1 100644 --- a/data/minecraft/recipe/magenta_concrete_powder.json +++ b/data/minecraft/recipe/magenta_concrete_powder.json @@ -3,33 +3,15 @@ "category": "building", "group": "concrete_powder", "ingredients": [ - { - "item": "minecraft:magenta_dye" - }, - { - "item": "minecraft:sand" - }, - { - "item": "minecraft:sand" - }, - { - "item": "minecraft:sand" - }, - { - "item": "minecraft:sand" - }, - { - "item": "minecraft:gravel" - }, - { - "item": "minecraft:gravel" - }, - { - "item": "minecraft:gravel" - }, - { - "item": "minecraft:gravel" - } + "minecraft:magenta_dye", + "minecraft:sand", + "minecraft:sand", + "minecraft:sand", + "minecraft:sand", + "minecraft:gravel", + "minecraft:gravel", + "minecraft:gravel", + "minecraft:gravel" ], "result": { "count": 8, diff --git a/data/minecraft/recipe/magenta_dye_from_allium.json b/data/minecraft/recipe/magenta_dye_from_allium.json index 6e217976..dbceb9ab 100644 --- a/data/minecraft/recipe/magenta_dye_from_allium.json +++ b/data/minecraft/recipe/magenta_dye_from_allium.json @@ -3,9 +3,7 @@ "category": "misc", "group": "magenta_dye", "ingredients": [ - { - "item": "minecraft:allium" - } + "minecraft:allium" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/magenta_dye_from_blue_red_pink.json b/data/minecraft/recipe/magenta_dye_from_blue_red_pink.json index 3d58b3d8..cee64c26 100644 --- a/data/minecraft/recipe/magenta_dye_from_blue_red_pink.json +++ b/data/minecraft/recipe/magenta_dye_from_blue_red_pink.json @@ -3,15 +3,9 @@ "category": "misc", "group": "magenta_dye", "ingredients": [ - { - "item": "minecraft:blue_dye" - }, - { - "item": "minecraft:red_dye" - }, - { - "item": "minecraft:pink_dye" - } + "minecraft:blue_dye", + "minecraft:red_dye", + "minecraft:pink_dye" ], "result": { "count": 3, diff --git a/data/minecraft/recipe/magenta_dye_from_blue_red_white_dye.json b/data/minecraft/recipe/magenta_dye_from_blue_red_white_dye.json index d8fe2b66..dd591a84 100644 --- a/data/minecraft/recipe/magenta_dye_from_blue_red_white_dye.json +++ b/data/minecraft/recipe/magenta_dye_from_blue_red_white_dye.json @@ -3,18 +3,10 @@ "category": "misc", "group": "magenta_dye", "ingredients": [ - { - "item": "minecraft:blue_dye" - }, - { - "item": "minecraft:red_dye" - }, - { - "item": "minecraft:red_dye" - }, - { - "item": "minecraft:white_dye" - } + "minecraft:blue_dye", + "minecraft:red_dye", + "minecraft:red_dye", + "minecraft:white_dye" ], "result": { "count": 4, diff --git a/data/minecraft/recipe/magenta_dye_from_lilac.json b/data/minecraft/recipe/magenta_dye_from_lilac.json index 54120494..2a19765e 100644 --- a/data/minecraft/recipe/magenta_dye_from_lilac.json +++ b/data/minecraft/recipe/magenta_dye_from_lilac.json @@ -3,9 +3,7 @@ "category": "misc", "group": "magenta_dye", "ingredients": [ - { - "item": "minecraft:lilac" - } + "minecraft:lilac" ], "result": { "count": 2, diff --git a/data/minecraft/recipe/magenta_dye_from_purple_and_pink.json b/data/minecraft/recipe/magenta_dye_from_purple_and_pink.json index 6fa2c933..851b9081 100644 --- a/data/minecraft/recipe/magenta_dye_from_purple_and_pink.json +++ b/data/minecraft/recipe/magenta_dye_from_purple_and_pink.json @@ -3,12 +3,8 @@ "category": "misc", "group": "magenta_dye", "ingredients": [ - { - "item": "minecraft:purple_dye" - }, - { - "item": "minecraft:pink_dye" - } + "minecraft:purple_dye", + "minecraft:pink_dye" ], "result": { "count": 2, diff --git a/data/minecraft/recipe/magenta_glazed_terracotta.json b/data/minecraft/recipe/magenta_glazed_terracotta.json index b58ff651..3b098c29 100644 --- a/data/minecraft/recipe/magenta_glazed_terracotta.json +++ b/data/minecraft/recipe/magenta_glazed_terracotta.json @@ -3,9 +3,7 @@ "category": "blocks", "cookingtime": 200, "experience": 0.1, - "ingredient": { - "item": "minecraft:magenta_terracotta" - }, + "ingredient": "minecraft:magenta_terracotta", "result": { "id": "minecraft:magenta_glazed_terracotta" } diff --git a/data/minecraft/recipe/magenta_shulker_box.json b/data/minecraft/recipe/magenta_shulker_box.json new file mode 100644 index 00000000..f3542475 --- /dev/null +++ b/data/minecraft/recipe/magenta_shulker_box.json @@ -0,0 +1,8 @@ +{ + "type": "minecraft:crafting_transmute", + "category": "misc", + "group": "shulker_box_dye", + "input": "#minecraft:shulker_boxes", + "material": "minecraft:magenta_dye", + "result": "minecraft:magenta_shulker_box" +} \ No newline at end of file diff --git a/data/minecraft/recipe/magenta_stained_glass.json b/data/minecraft/recipe/magenta_stained_glass.json index 1583b801..6b70363e 100644 --- a/data/minecraft/recipe/magenta_stained_glass.json +++ b/data/minecraft/recipe/magenta_stained_glass.json @@ -3,12 +3,8 @@ "category": "building", "group": "stained_glass", "key": { - "#": { - "item": "minecraft:glass" - }, - "X": { - "item": "minecraft:magenta_dye" - } + "#": "minecraft:glass", + "X": "minecraft:magenta_dye" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/magenta_stained_glass_pane.json b/data/minecraft/recipe/magenta_stained_glass_pane.json index 5c69f0c1..9bb1fbdf 100644 --- a/data/minecraft/recipe/magenta_stained_glass_pane.json +++ b/data/minecraft/recipe/magenta_stained_glass_pane.json @@ -3,9 +3,7 @@ "category": "misc", "group": "stained_glass_pane", "key": { - "#": { - "item": "minecraft:magenta_stained_glass" - } + "#": "minecraft:magenta_stained_glass" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/magenta_stained_glass_pane_from_glass_pane.json b/data/minecraft/recipe/magenta_stained_glass_pane_from_glass_pane.json index a6ad8a97..8f8f8254 100644 --- a/data/minecraft/recipe/magenta_stained_glass_pane_from_glass_pane.json +++ b/data/minecraft/recipe/magenta_stained_glass_pane_from_glass_pane.json @@ -3,12 +3,8 @@ "category": "misc", "group": "stained_glass_pane", "key": { - "#": { - "item": "minecraft:glass_pane" - }, - "$": { - "item": "minecraft:magenta_dye" - } + "#": "minecraft:glass_pane", + "$": "minecraft:magenta_dye" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/magenta_terracotta.json b/data/minecraft/recipe/magenta_terracotta.json index 880e1c6c..64a94c61 100644 --- a/data/minecraft/recipe/magenta_terracotta.json +++ b/data/minecraft/recipe/magenta_terracotta.json @@ -3,12 +3,8 @@ "category": "building", "group": "stained_terracotta", "key": { - "#": { - "item": "minecraft:terracotta" - }, - "X": { - "item": "minecraft:magenta_dye" - } + "#": "minecraft:terracotta", + "X": "minecraft:magenta_dye" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/magma_block.json b/data/minecraft/recipe/magma_block.json index 8d9bf414..b8804619 100644 --- a/data/minecraft/recipe/magma_block.json +++ b/data/minecraft/recipe/magma_block.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:magma_cream" - } + "#": "minecraft:magma_cream" }, "pattern": [ "##", diff --git a/data/minecraft/recipe/magma_cream.json b/data/minecraft/recipe/magma_cream.json index 9ba59605..b10b8b73 100644 --- a/data/minecraft/recipe/magma_cream.json +++ b/data/minecraft/recipe/magma_cream.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shapeless", "category": "misc", "ingredients": [ - { - "item": "minecraft:blaze_powder" - }, - { - "item": "minecraft:slime_ball" - } + "minecraft:blaze_powder", + "minecraft:slime_ball" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/mangrove_boat.json b/data/minecraft/recipe/mangrove_boat.json index 727137ee..391d90ea 100644 --- a/data/minecraft/recipe/mangrove_boat.json +++ b/data/minecraft/recipe/mangrove_boat.json @@ -3,9 +3,7 @@ "category": "misc", "group": "boat", "key": { - "#": { - "item": "minecraft:mangrove_planks" - } + "#": "minecraft:mangrove_planks" }, "pattern": [ "# #", diff --git a/data/minecraft/recipe/mangrove_button.json b/data/minecraft/recipe/mangrove_button.json index 23c09f52..8f01128d 100644 --- a/data/minecraft/recipe/mangrove_button.json +++ b/data/minecraft/recipe/mangrove_button.json @@ -3,9 +3,7 @@ "category": "redstone", "group": "wooden_button", "ingredients": [ - { - "item": "minecraft:mangrove_planks" - } + "minecraft:mangrove_planks" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/mangrove_chest_boat.json b/data/minecraft/recipe/mangrove_chest_boat.json index 46915434..95fec44d 100644 --- a/data/minecraft/recipe/mangrove_chest_boat.json +++ b/data/minecraft/recipe/mangrove_chest_boat.json @@ -3,12 +3,8 @@ "category": "misc", "group": "chest_boat", "ingredients": [ - { - "item": "minecraft:chest" - }, - { - "item": "minecraft:mangrove_boat" - } + "minecraft:chest", + "minecraft:mangrove_boat" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/mangrove_door.json b/data/minecraft/recipe/mangrove_door.json index 55392409..cbcbe305 100644 --- a/data/minecraft/recipe/mangrove_door.json +++ b/data/minecraft/recipe/mangrove_door.json @@ -3,9 +3,7 @@ "category": "redstone", "group": "wooden_door", "key": { - "#": { - "item": "minecraft:mangrove_planks" - } + "#": "minecraft:mangrove_planks" }, "pattern": [ "##", diff --git a/data/minecraft/recipe/mangrove_fence.json b/data/minecraft/recipe/mangrove_fence.json index 00403079..14279f99 100644 --- a/data/minecraft/recipe/mangrove_fence.json +++ b/data/minecraft/recipe/mangrove_fence.json @@ -3,12 +3,8 @@ "category": "misc", "group": "wooden_fence", "key": { - "#": { - "item": "minecraft:stick" - }, - "W": { - "item": "minecraft:mangrove_planks" - } + "#": "minecraft:stick", + "W": "minecraft:mangrove_planks" }, "pattern": [ "W#W", diff --git a/data/minecraft/recipe/mangrove_fence_gate.json b/data/minecraft/recipe/mangrove_fence_gate.json index 4e9979c5..43d1c460 100644 --- a/data/minecraft/recipe/mangrove_fence_gate.json +++ b/data/minecraft/recipe/mangrove_fence_gate.json @@ -3,12 +3,8 @@ "category": "redstone", "group": "wooden_fence_gate", "key": { - "#": { - "item": "minecraft:stick" - }, - "W": { - "item": "minecraft:mangrove_planks" - } + "#": "minecraft:stick", + "W": "minecraft:mangrove_planks" }, "pattern": [ "#W#", diff --git a/data/minecraft/recipe/mangrove_hanging_sign.json b/data/minecraft/recipe/mangrove_hanging_sign.json index d78d5b08..fee95a8e 100644 --- a/data/minecraft/recipe/mangrove_hanging_sign.json +++ b/data/minecraft/recipe/mangrove_hanging_sign.json @@ -3,12 +3,8 @@ "category": "misc", "group": "hanging_sign", "key": { - "#": { - "item": "minecraft:stripped_mangrove_log" - }, - "X": { - "item": "minecraft:chain" - } + "#": "minecraft:stripped_mangrove_log", + "X": "minecraft:chain" }, "pattern": [ "X X", diff --git a/data/minecraft/recipe/mangrove_planks.json b/data/minecraft/recipe/mangrove_planks.json index 6a394ba4..70ed9700 100644 --- a/data/minecraft/recipe/mangrove_planks.json +++ b/data/minecraft/recipe/mangrove_planks.json @@ -3,9 +3,7 @@ "category": "building", "group": "planks", "ingredients": [ - { - "tag": "minecraft:mangrove_logs" - } + "#minecraft:mangrove_logs" ], "result": { "count": 4, diff --git a/data/minecraft/recipe/mangrove_pressure_plate.json b/data/minecraft/recipe/mangrove_pressure_plate.json index 9cdda39b..5b861406 100644 --- a/data/minecraft/recipe/mangrove_pressure_plate.json +++ b/data/minecraft/recipe/mangrove_pressure_plate.json @@ -3,9 +3,7 @@ "category": "redstone", "group": "wooden_pressure_plate", "key": { - "#": { - "item": "minecraft:mangrove_planks" - } + "#": "minecraft:mangrove_planks" }, "pattern": [ "##" diff --git a/data/minecraft/recipe/mangrove_sign.json b/data/minecraft/recipe/mangrove_sign.json index d18e84f1..548f282d 100644 --- a/data/minecraft/recipe/mangrove_sign.json +++ b/data/minecraft/recipe/mangrove_sign.json @@ -3,12 +3,8 @@ "category": "misc", "group": "wooden_sign", "key": { - "#": { - "item": "minecraft:mangrove_planks" - }, - "X": { - "item": "minecraft:stick" - } + "#": "minecraft:mangrove_planks", + "X": "minecraft:stick" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/mangrove_slab.json b/data/minecraft/recipe/mangrove_slab.json index baa9cb8f..4dd22f2a 100644 --- a/data/minecraft/recipe/mangrove_slab.json +++ b/data/minecraft/recipe/mangrove_slab.json @@ -3,9 +3,7 @@ "category": "building", "group": "wooden_slab", "key": { - "#": { - "item": "minecraft:mangrove_planks" - } + "#": "minecraft:mangrove_planks" }, "pattern": [ "###" diff --git a/data/minecraft/recipe/mangrove_stairs.json b/data/minecraft/recipe/mangrove_stairs.json index 41341066..14e80386 100644 --- a/data/minecraft/recipe/mangrove_stairs.json +++ b/data/minecraft/recipe/mangrove_stairs.json @@ -3,9 +3,7 @@ "category": "building", "group": "wooden_stairs", "key": { - "#": { - "item": "minecraft:mangrove_planks" - } + "#": "minecraft:mangrove_planks" }, "pattern": [ "# ", diff --git a/data/minecraft/recipe/mangrove_trapdoor.json b/data/minecraft/recipe/mangrove_trapdoor.json index a51766c2..d7dacadf 100644 --- a/data/minecraft/recipe/mangrove_trapdoor.json +++ b/data/minecraft/recipe/mangrove_trapdoor.json @@ -3,9 +3,7 @@ "category": "redstone", "group": "wooden_trapdoor", "key": { - "#": { - "item": "minecraft:mangrove_planks" - } + "#": "minecraft:mangrove_planks" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/mangrove_wood.json b/data/minecraft/recipe/mangrove_wood.json index c8c830e7..15628e8a 100644 --- a/data/minecraft/recipe/mangrove_wood.json +++ b/data/minecraft/recipe/mangrove_wood.json @@ -3,9 +3,7 @@ "category": "building", "group": "bark", "key": { - "#": { - "item": "minecraft:mangrove_log" - } + "#": "minecraft:mangrove_log" }, "pattern": [ "##", diff --git a/data/minecraft/recipe/map.json b/data/minecraft/recipe/map.json index e364fc5b..20bedd3c 100644 --- a/data/minecraft/recipe/map.json +++ b/data/minecraft/recipe/map.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "#": { - "item": "minecraft:paper" - }, - "X": { - "item": "minecraft:compass" - } + "#": "minecraft:paper", + "X": "minecraft:compass" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/melon.json b/data/minecraft/recipe/melon.json index 6a6fea7b..ae83fe05 100644 --- a/data/minecraft/recipe/melon.json +++ b/data/minecraft/recipe/melon.json @@ -2,33 +2,15 @@ "type": "minecraft:crafting_shapeless", "category": "building", "ingredients": [ - { - "item": "minecraft:melon_slice" - }, - { - "item": "minecraft:melon_slice" - }, - { - "item": "minecraft:melon_slice" - }, - { - "item": "minecraft:melon_slice" - }, - { - "item": "minecraft:melon_slice" - }, - { - "item": "minecraft:melon_slice" - }, - { - "item": "minecraft:melon_slice" - }, - { - "item": "minecraft:melon_slice" - }, - { - "item": "minecraft:melon_slice" - } + "minecraft:melon_slice", + "minecraft:melon_slice", + "minecraft:melon_slice", + "minecraft:melon_slice", + "minecraft:melon_slice", + "minecraft:melon_slice", + "minecraft:melon_slice", + "minecraft:melon_slice", + "minecraft:melon_slice" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/melon_seeds.json b/data/minecraft/recipe/melon_seeds.json index 092f2465..96d9034f 100644 --- a/data/minecraft/recipe/melon_seeds.json +++ b/data/minecraft/recipe/melon_seeds.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shapeless", "category": "misc", "ingredients": [ - { - "item": "minecraft:melon_slice" - } + "minecraft:melon_slice" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/minecart.json b/data/minecraft/recipe/minecart.json index 3cc6602a..bd0d5dbc 100644 --- a/data/minecraft/recipe/minecart.json +++ b/data/minecraft/recipe/minecart.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "#": { - "item": "minecraft:iron_ingot" - } + "#": "minecraft:iron_ingot" }, "pattern": [ "# #", diff --git a/data/minecraft/recipe/mojang_banner_pattern.json b/data/minecraft/recipe/mojang_banner_pattern.json index 823f6208..e2b9a759 100644 --- a/data/minecraft/recipe/mojang_banner_pattern.json +++ b/data/minecraft/recipe/mojang_banner_pattern.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shapeless", "category": "misc", "ingredients": [ - { - "item": "minecraft:paper" - }, - { - "item": "minecraft:enchanted_golden_apple" - } + "minecraft:paper", + "minecraft:enchanted_golden_apple" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/moss_carpet.json b/data/minecraft/recipe/moss_carpet.json index 5c21671e..0bfff4c0 100644 --- a/data/minecraft/recipe/moss_carpet.json +++ b/data/minecraft/recipe/moss_carpet.json @@ -3,9 +3,7 @@ "category": "misc", "group": "carpet", "key": { - "#": { - "item": "minecraft:moss_block" - } + "#": "minecraft:moss_block" }, "pattern": [ "##" diff --git a/data/minecraft/recipe/mossy_cobblestone_from_moss_block.json b/data/minecraft/recipe/mossy_cobblestone_from_moss_block.json index 9c79741e..3043d434 100644 --- a/data/minecraft/recipe/mossy_cobblestone_from_moss_block.json +++ b/data/minecraft/recipe/mossy_cobblestone_from_moss_block.json @@ -3,12 +3,8 @@ "category": "building", "group": "mossy_cobblestone", "ingredients": [ - { - "item": "minecraft:cobblestone" - }, - { - "item": "minecraft:moss_block" - } + "minecraft:cobblestone", + "minecraft:moss_block" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/mossy_cobblestone_from_vine.json b/data/minecraft/recipe/mossy_cobblestone_from_vine.json index 8cc6fdac..a9d42a9d 100644 --- a/data/minecraft/recipe/mossy_cobblestone_from_vine.json +++ b/data/minecraft/recipe/mossy_cobblestone_from_vine.json @@ -3,12 +3,8 @@ "category": "building", "group": "mossy_cobblestone", "ingredients": [ - { - "item": "minecraft:cobblestone" - }, - { - "item": "minecraft:vine" - } + "minecraft:cobblestone", + "minecraft:vine" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/mossy_cobblestone_slab.json b/data/minecraft/recipe/mossy_cobblestone_slab.json index 57479c27..f7a925dd 100644 --- a/data/minecraft/recipe/mossy_cobblestone_slab.json +++ b/data/minecraft/recipe/mossy_cobblestone_slab.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:mossy_cobblestone" - } + "#": "minecraft:mossy_cobblestone" }, "pattern": [ "###" diff --git a/data/minecraft/recipe/mossy_cobblestone_slab_from_mossy_cobblestone_stonecutting.json b/data/minecraft/recipe/mossy_cobblestone_slab_from_mossy_cobblestone_stonecutting.json index 1628de59..6f95da18 100644 --- a/data/minecraft/recipe/mossy_cobblestone_slab_from_mossy_cobblestone_stonecutting.json +++ b/data/minecraft/recipe/mossy_cobblestone_slab_from_mossy_cobblestone_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:mossy_cobblestone" - }, + "ingredient": "minecraft:mossy_cobblestone", "result": { "count": 2, "id": "minecraft:mossy_cobblestone_slab" diff --git a/data/minecraft/recipe/mossy_cobblestone_stairs.json b/data/minecraft/recipe/mossy_cobblestone_stairs.json index 13957195..a895c592 100644 --- a/data/minecraft/recipe/mossy_cobblestone_stairs.json +++ b/data/minecraft/recipe/mossy_cobblestone_stairs.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:mossy_cobblestone" - } + "#": "minecraft:mossy_cobblestone" }, "pattern": [ "# ", diff --git a/data/minecraft/recipe/mossy_cobblestone_stairs_from_mossy_cobblestone_stonecutting.json b/data/minecraft/recipe/mossy_cobblestone_stairs_from_mossy_cobblestone_stonecutting.json index 62ca71dd..5d8f9be8 100644 --- a/data/minecraft/recipe/mossy_cobblestone_stairs_from_mossy_cobblestone_stonecutting.json +++ b/data/minecraft/recipe/mossy_cobblestone_stairs_from_mossy_cobblestone_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:mossy_cobblestone" - }, + "ingredient": "minecraft:mossy_cobblestone", "result": { "count": 1, "id": "minecraft:mossy_cobblestone_stairs" diff --git a/data/minecraft/recipe/mossy_cobblestone_wall.json b/data/minecraft/recipe/mossy_cobblestone_wall.json index 6d84af0c..5b06dd65 100644 --- a/data/minecraft/recipe/mossy_cobblestone_wall.json +++ b/data/minecraft/recipe/mossy_cobblestone_wall.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "#": { - "item": "minecraft:mossy_cobblestone" - } + "#": "minecraft:mossy_cobblestone" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/mossy_cobblestone_wall_from_mossy_cobblestone_stonecutting.json b/data/minecraft/recipe/mossy_cobblestone_wall_from_mossy_cobblestone_stonecutting.json index 3d97d583..6956bc0c 100644 --- a/data/minecraft/recipe/mossy_cobblestone_wall_from_mossy_cobblestone_stonecutting.json +++ b/data/minecraft/recipe/mossy_cobblestone_wall_from_mossy_cobblestone_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:mossy_cobblestone" - }, + "ingredient": "minecraft:mossy_cobblestone", "result": { "count": 1, "id": "minecraft:mossy_cobblestone_wall" diff --git a/data/minecraft/recipe/mossy_stone_brick_slab.json b/data/minecraft/recipe/mossy_stone_brick_slab.json index 38b9ea7f..5d404242 100644 --- a/data/minecraft/recipe/mossy_stone_brick_slab.json +++ b/data/minecraft/recipe/mossy_stone_brick_slab.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:mossy_stone_bricks" - } + "#": "minecraft:mossy_stone_bricks" }, "pattern": [ "###" diff --git a/data/minecraft/recipe/mossy_stone_brick_slab_from_mossy_stone_brick_stonecutting.json b/data/minecraft/recipe/mossy_stone_brick_slab_from_mossy_stone_brick_stonecutting.json index 5dc89f2e..ac79fae5 100644 --- a/data/minecraft/recipe/mossy_stone_brick_slab_from_mossy_stone_brick_stonecutting.json +++ b/data/minecraft/recipe/mossy_stone_brick_slab_from_mossy_stone_brick_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:mossy_stone_bricks" - }, + "ingredient": "minecraft:mossy_stone_bricks", "result": { "count": 2, "id": "minecraft:mossy_stone_brick_slab" diff --git a/data/minecraft/recipe/mossy_stone_brick_stairs.json b/data/minecraft/recipe/mossy_stone_brick_stairs.json index fbf71364..c4c90779 100644 --- a/data/minecraft/recipe/mossy_stone_brick_stairs.json +++ b/data/minecraft/recipe/mossy_stone_brick_stairs.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:mossy_stone_bricks" - } + "#": "minecraft:mossy_stone_bricks" }, "pattern": [ "# ", diff --git a/data/minecraft/recipe/mossy_stone_brick_stairs_from_mossy_stone_brick_stonecutting.json b/data/minecraft/recipe/mossy_stone_brick_stairs_from_mossy_stone_brick_stonecutting.json index aea88ed4..23b81dc7 100644 --- a/data/minecraft/recipe/mossy_stone_brick_stairs_from_mossy_stone_brick_stonecutting.json +++ b/data/minecraft/recipe/mossy_stone_brick_stairs_from_mossy_stone_brick_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:mossy_stone_bricks" - }, + "ingredient": "minecraft:mossy_stone_bricks", "result": { "count": 1, "id": "minecraft:mossy_stone_brick_stairs" diff --git a/data/minecraft/recipe/mossy_stone_brick_wall.json b/data/minecraft/recipe/mossy_stone_brick_wall.json index a586bd6d..c72649b0 100644 --- a/data/minecraft/recipe/mossy_stone_brick_wall.json +++ b/data/minecraft/recipe/mossy_stone_brick_wall.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "#": { - "item": "minecraft:mossy_stone_bricks" - } + "#": "minecraft:mossy_stone_bricks" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/mossy_stone_brick_wall_from_mossy_stone_brick_stonecutting.json b/data/minecraft/recipe/mossy_stone_brick_wall_from_mossy_stone_brick_stonecutting.json index 60cabe8d..bdb8febb 100644 --- a/data/minecraft/recipe/mossy_stone_brick_wall_from_mossy_stone_brick_stonecutting.json +++ b/data/minecraft/recipe/mossy_stone_brick_wall_from_mossy_stone_brick_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:mossy_stone_bricks" - }, + "ingredient": "minecraft:mossy_stone_bricks", "result": { "count": 1, "id": "minecraft:mossy_stone_brick_wall" diff --git a/data/minecraft/recipe/mossy_stone_bricks_from_moss_block.json b/data/minecraft/recipe/mossy_stone_bricks_from_moss_block.json index 3cfa67d2..ccba9ec7 100644 --- a/data/minecraft/recipe/mossy_stone_bricks_from_moss_block.json +++ b/data/minecraft/recipe/mossy_stone_bricks_from_moss_block.json @@ -3,12 +3,8 @@ "category": "building", "group": "mossy_stone_bricks", "ingredients": [ - { - "item": "minecraft:stone_bricks" - }, - { - "item": "minecraft:moss_block" - } + "minecraft:stone_bricks", + "minecraft:moss_block" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/mossy_stone_bricks_from_vine.json b/data/minecraft/recipe/mossy_stone_bricks_from_vine.json index a09452c8..e5eb22d4 100644 --- a/data/minecraft/recipe/mossy_stone_bricks_from_vine.json +++ b/data/minecraft/recipe/mossy_stone_bricks_from_vine.json @@ -3,12 +3,8 @@ "category": "building", "group": "mossy_stone_bricks", "ingredients": [ - { - "item": "minecraft:stone_bricks" - }, - { - "item": "minecraft:vine" - } + "minecraft:stone_bricks", + "minecraft:vine" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/mud_brick_slab.json b/data/minecraft/recipe/mud_brick_slab.json index 7bbd7f9a..d05d34ae 100644 --- a/data/minecraft/recipe/mud_brick_slab.json +++ b/data/minecraft/recipe/mud_brick_slab.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:mud_bricks" - } + "#": "minecraft:mud_bricks" }, "pattern": [ "###" diff --git a/data/minecraft/recipe/mud_brick_slab_from_mud_bricks_stonecutting.json b/data/minecraft/recipe/mud_brick_slab_from_mud_bricks_stonecutting.json index eca88a0f..91844f76 100644 --- a/data/minecraft/recipe/mud_brick_slab_from_mud_bricks_stonecutting.json +++ b/data/minecraft/recipe/mud_brick_slab_from_mud_bricks_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:mud_bricks" - }, + "ingredient": "minecraft:mud_bricks", "result": { "count": 2, "id": "minecraft:mud_brick_slab" diff --git a/data/minecraft/recipe/mud_brick_stairs.json b/data/minecraft/recipe/mud_brick_stairs.json index 21e063cb..bf88a09d 100644 --- a/data/minecraft/recipe/mud_brick_stairs.json +++ b/data/minecraft/recipe/mud_brick_stairs.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:mud_bricks" - } + "#": "minecraft:mud_bricks" }, "pattern": [ "# ", diff --git a/data/minecraft/recipe/mud_brick_stairs_from_mud_bricks_stonecutting.json b/data/minecraft/recipe/mud_brick_stairs_from_mud_bricks_stonecutting.json index 60af8a3d..245f6268 100644 --- a/data/minecraft/recipe/mud_brick_stairs_from_mud_bricks_stonecutting.json +++ b/data/minecraft/recipe/mud_brick_stairs_from_mud_bricks_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:mud_bricks" - }, + "ingredient": "minecraft:mud_bricks", "result": { "count": 1, "id": "minecraft:mud_brick_stairs" diff --git a/data/minecraft/recipe/mud_brick_wall.json b/data/minecraft/recipe/mud_brick_wall.json index 72780084..3cbb232c 100644 --- a/data/minecraft/recipe/mud_brick_wall.json +++ b/data/minecraft/recipe/mud_brick_wall.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "#": { - "item": "minecraft:mud_bricks" - } + "#": "minecraft:mud_bricks" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/mud_brick_wall_from_mud_bricks_stonecutting.json b/data/minecraft/recipe/mud_brick_wall_from_mud_bricks_stonecutting.json index 14b680f7..8f904488 100644 --- a/data/minecraft/recipe/mud_brick_wall_from_mud_bricks_stonecutting.json +++ b/data/minecraft/recipe/mud_brick_wall_from_mud_bricks_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:mud_bricks" - }, + "ingredient": "minecraft:mud_bricks", "result": { "count": 1, "id": "minecraft:mud_brick_wall" diff --git a/data/minecraft/recipe/mud_bricks.json b/data/minecraft/recipe/mud_bricks.json index ea53bc07..2432d904 100644 --- a/data/minecraft/recipe/mud_bricks.json +++ b/data/minecraft/recipe/mud_bricks.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:packed_mud" - } + "#": "minecraft:packed_mud" }, "pattern": [ "##", diff --git a/data/minecraft/recipe/muddy_mangrove_roots.json b/data/minecraft/recipe/muddy_mangrove_roots.json index 8412f23f..d03d6d78 100644 --- a/data/minecraft/recipe/muddy_mangrove_roots.json +++ b/data/minecraft/recipe/muddy_mangrove_roots.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shapeless", "category": "building", "ingredients": [ - { - "item": "minecraft:mud" - }, - { - "item": "minecraft:mangrove_roots" - } + "minecraft:mud", + "minecraft:mangrove_roots" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/mushroom_stew.json b/data/minecraft/recipe/mushroom_stew.json index 34dc6cab..e6a2a710 100644 --- a/data/minecraft/recipe/mushroom_stew.json +++ b/data/minecraft/recipe/mushroom_stew.json @@ -2,15 +2,9 @@ "type": "minecraft:crafting_shapeless", "category": "misc", "ingredients": [ - { - "item": "minecraft:brown_mushroom" - }, - { - "item": "minecraft:red_mushroom" - }, - { - "item": "minecraft:bowl" - } + "minecraft:brown_mushroom", + "minecraft:red_mushroom", + "minecraft:bowl" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/music_disc_5.json b/data/minecraft/recipe/music_disc_5.json index 4cee6a31..fc6826f5 100644 --- a/data/minecraft/recipe/music_disc_5.json +++ b/data/minecraft/recipe/music_disc_5.json @@ -2,33 +2,15 @@ "type": "minecraft:crafting_shapeless", "category": "misc", "ingredients": [ - { - "item": "minecraft:disc_fragment_5" - }, - { - "item": "minecraft:disc_fragment_5" - }, - { - "item": "minecraft:disc_fragment_5" - }, - { - "item": "minecraft:disc_fragment_5" - }, - { - "item": "minecraft:disc_fragment_5" - }, - { - "item": "minecraft:disc_fragment_5" - }, - { - "item": "minecraft:disc_fragment_5" - }, - { - "item": "minecraft:disc_fragment_5" - }, - { - "item": "minecraft:disc_fragment_5" - } + "minecraft:disc_fragment_5", + "minecraft:disc_fragment_5", + "minecraft:disc_fragment_5", + "minecraft:disc_fragment_5", + "minecraft:disc_fragment_5", + "minecraft:disc_fragment_5", + "minecraft:disc_fragment_5", + "minecraft:disc_fragment_5", + "minecraft:disc_fragment_5" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/nether_brick.json b/data/minecraft/recipe/nether_brick.json index 1a0cb2f6..5361e868 100644 --- a/data/minecraft/recipe/nether_brick.json +++ b/data/minecraft/recipe/nether_brick.json @@ -3,9 +3,7 @@ "category": "misc", "cookingtime": 200, "experience": 0.1, - "ingredient": { - "item": "minecraft:netherrack" - }, + "ingredient": "minecraft:netherrack", "result": { "id": "minecraft:nether_brick" } diff --git a/data/minecraft/recipe/nether_brick_fence.json b/data/minecraft/recipe/nether_brick_fence.json index 95cb4c47..e3ffb98e 100644 --- a/data/minecraft/recipe/nether_brick_fence.json +++ b/data/minecraft/recipe/nether_brick_fence.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "#": { - "item": "minecraft:nether_brick" - }, - "W": { - "item": "minecraft:nether_bricks" - } + "#": "minecraft:nether_brick", + "W": "minecraft:nether_bricks" }, "pattern": [ "W#W", diff --git a/data/minecraft/recipe/nether_brick_slab.json b/data/minecraft/recipe/nether_brick_slab.json index ce44030f..bb01455f 100644 --- a/data/minecraft/recipe/nether_brick_slab.json +++ b/data/minecraft/recipe/nether_brick_slab.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:nether_bricks" - } + "#": "minecraft:nether_bricks" }, "pattern": [ "###" diff --git a/data/minecraft/recipe/nether_brick_slab_from_nether_bricks_stonecutting.json b/data/minecraft/recipe/nether_brick_slab_from_nether_bricks_stonecutting.json index d13c18cb..3a20a6b4 100644 --- a/data/minecraft/recipe/nether_brick_slab_from_nether_bricks_stonecutting.json +++ b/data/minecraft/recipe/nether_brick_slab_from_nether_bricks_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:nether_bricks" - }, + "ingredient": "minecraft:nether_bricks", "result": { "count": 2, "id": "minecraft:nether_brick_slab" diff --git a/data/minecraft/recipe/nether_brick_stairs.json b/data/minecraft/recipe/nether_brick_stairs.json index bb2ec08f..92ddfef2 100644 --- a/data/minecraft/recipe/nether_brick_stairs.json +++ b/data/minecraft/recipe/nether_brick_stairs.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:nether_bricks" - } + "#": "minecraft:nether_bricks" }, "pattern": [ "# ", diff --git a/data/minecraft/recipe/nether_brick_stairs_from_nether_bricks_stonecutting.json b/data/minecraft/recipe/nether_brick_stairs_from_nether_bricks_stonecutting.json index c0d05028..540fbdfe 100644 --- a/data/minecraft/recipe/nether_brick_stairs_from_nether_bricks_stonecutting.json +++ b/data/minecraft/recipe/nether_brick_stairs_from_nether_bricks_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:nether_bricks" - }, + "ingredient": "minecraft:nether_bricks", "result": { "count": 1, "id": "minecraft:nether_brick_stairs" diff --git a/data/minecraft/recipe/nether_brick_wall.json b/data/minecraft/recipe/nether_brick_wall.json index c8f756a7..7612e590 100644 --- a/data/minecraft/recipe/nether_brick_wall.json +++ b/data/minecraft/recipe/nether_brick_wall.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "#": { - "item": "minecraft:nether_bricks" - } + "#": "minecraft:nether_bricks" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/nether_brick_wall_from_nether_bricks_stonecutting.json b/data/minecraft/recipe/nether_brick_wall_from_nether_bricks_stonecutting.json index 518ada42..072b064d 100644 --- a/data/minecraft/recipe/nether_brick_wall_from_nether_bricks_stonecutting.json +++ b/data/minecraft/recipe/nether_brick_wall_from_nether_bricks_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:nether_bricks" - }, + "ingredient": "minecraft:nether_bricks", "result": { "count": 1, "id": "minecraft:nether_brick_wall" diff --git a/data/minecraft/recipe/nether_bricks.json b/data/minecraft/recipe/nether_bricks.json index 50a2b1f7..204504f8 100644 --- a/data/minecraft/recipe/nether_bricks.json +++ b/data/minecraft/recipe/nether_bricks.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:nether_brick" - } + "#": "minecraft:nether_brick" }, "pattern": [ "##", diff --git a/data/minecraft/recipe/nether_wart_block.json b/data/minecraft/recipe/nether_wart_block.json index c445e07a..f44f85f3 100644 --- a/data/minecraft/recipe/nether_wart_block.json +++ b/data/minecraft/recipe/nether_wart_block.json @@ -2,33 +2,15 @@ "type": "minecraft:crafting_shapeless", "category": "building", "ingredients": [ - { - "item": "minecraft:nether_wart" - }, - { - "item": "minecraft:nether_wart" - }, - { - "item": "minecraft:nether_wart" - }, - { - "item": "minecraft:nether_wart" - }, - { - "item": "minecraft:nether_wart" - }, - { - "item": "minecraft:nether_wart" - }, - { - "item": "minecraft:nether_wart" - }, - { - "item": "minecraft:nether_wart" - }, - { - "item": "minecraft:nether_wart" - } + "minecraft:nether_wart", + "minecraft:nether_wart", + "minecraft:nether_wart", + "minecraft:nether_wart", + "minecraft:nether_wart", + "minecraft:nether_wart", + "minecraft:nether_wart", + "minecraft:nether_wart", + "minecraft:nether_wart" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/netherite_axe_smithing.json b/data/minecraft/recipe/netherite_axe_smithing.json index 2cb2af38..29c79980 100644 --- a/data/minecraft/recipe/netherite_axe_smithing.json +++ b/data/minecraft/recipe/netherite_axe_smithing.json @@ -1,16 +1,10 @@ { "type": "minecraft:smithing_transform", - "addition": { - "item": "minecraft:netherite_ingot" - }, - "base": { - "item": "minecraft:diamond_axe" - }, + "addition": "#minecraft:netherite_tool_materials", + "base": "minecraft:diamond_axe", "result": { "count": 1, "id": "minecraft:netherite_axe" }, - "template": { - "item": "minecraft:netherite_upgrade_smithing_template" - } + "template": "minecraft:netherite_upgrade_smithing_template" } \ No newline at end of file diff --git a/data/minecraft/recipe/netherite_block.json b/data/minecraft/recipe/netherite_block.json index 05f294cb..353d323a 100644 --- a/data/minecraft/recipe/netherite_block.json +++ b/data/minecraft/recipe/netherite_block.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:netherite_ingot" - } + "#": "minecraft:netherite_ingot" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/netherite_boots_smithing.json b/data/minecraft/recipe/netherite_boots_smithing.json index 8e4694b1..da3c3f16 100644 --- a/data/minecraft/recipe/netherite_boots_smithing.json +++ b/data/minecraft/recipe/netherite_boots_smithing.json @@ -1,16 +1,10 @@ { "type": "minecraft:smithing_transform", - "addition": { - "item": "minecraft:netherite_ingot" - }, - "base": { - "item": "minecraft:diamond_boots" - }, + "addition": "#minecraft:netherite_tool_materials", + "base": "minecraft:diamond_boots", "result": { "count": 1, "id": "minecraft:netherite_boots" }, - "template": { - "item": "minecraft:netherite_upgrade_smithing_template" - } + "template": "minecraft:netherite_upgrade_smithing_template" } \ No newline at end of file diff --git a/data/minecraft/recipe/netherite_chestplate_smithing.json b/data/minecraft/recipe/netherite_chestplate_smithing.json index 9eaada2f..75c82ec2 100644 --- a/data/minecraft/recipe/netherite_chestplate_smithing.json +++ b/data/minecraft/recipe/netherite_chestplate_smithing.json @@ -1,16 +1,10 @@ { "type": "minecraft:smithing_transform", - "addition": { - "item": "minecraft:netherite_ingot" - }, - "base": { - "item": "minecraft:diamond_chestplate" - }, + "addition": "#minecraft:netherite_tool_materials", + "base": "minecraft:diamond_chestplate", "result": { "count": 1, "id": "minecraft:netherite_chestplate" }, - "template": { - "item": "minecraft:netherite_upgrade_smithing_template" - } + "template": "minecraft:netherite_upgrade_smithing_template" } \ No newline at end of file diff --git a/data/minecraft/recipe/netherite_helmet_smithing.json b/data/minecraft/recipe/netherite_helmet_smithing.json index 16450464..23eff34f 100644 --- a/data/minecraft/recipe/netherite_helmet_smithing.json +++ b/data/minecraft/recipe/netherite_helmet_smithing.json @@ -1,16 +1,10 @@ { "type": "minecraft:smithing_transform", - "addition": { - "item": "minecraft:netherite_ingot" - }, - "base": { - "item": "minecraft:diamond_helmet" - }, + "addition": "#minecraft:netherite_tool_materials", + "base": "minecraft:diamond_helmet", "result": { "count": 1, "id": "minecraft:netherite_helmet" }, - "template": { - "item": "minecraft:netherite_upgrade_smithing_template" - } + "template": "minecraft:netherite_upgrade_smithing_template" } \ No newline at end of file diff --git a/data/minecraft/recipe/netherite_hoe_smithing.json b/data/minecraft/recipe/netherite_hoe_smithing.json index da0690f9..702edabe 100644 --- a/data/minecraft/recipe/netherite_hoe_smithing.json +++ b/data/minecraft/recipe/netherite_hoe_smithing.json @@ -1,16 +1,10 @@ { "type": "minecraft:smithing_transform", - "addition": { - "item": "minecraft:netherite_ingot" - }, - "base": { - "item": "minecraft:diamond_hoe" - }, + "addition": "#minecraft:netherite_tool_materials", + "base": "minecraft:diamond_hoe", "result": { "count": 1, "id": "minecraft:netherite_hoe" }, - "template": { - "item": "minecraft:netherite_upgrade_smithing_template" - } + "template": "minecraft:netherite_upgrade_smithing_template" } \ No newline at end of file diff --git a/data/minecraft/recipe/netherite_ingot.json b/data/minecraft/recipe/netherite_ingot.json index 75756891..feb66b80 100644 --- a/data/minecraft/recipe/netherite_ingot.json +++ b/data/minecraft/recipe/netherite_ingot.json @@ -3,30 +3,14 @@ "category": "misc", "group": "netherite_ingot", "ingredients": [ - { - "item": "minecraft:netherite_scrap" - }, - { - "item": "minecraft:netherite_scrap" - }, - { - "item": "minecraft:netherite_scrap" - }, - { - "item": "minecraft:netherite_scrap" - }, - { - "item": "minecraft:gold_ingot" - }, - { - "item": "minecraft:gold_ingot" - }, - { - "item": "minecraft:gold_ingot" - }, - { - "item": "minecraft:gold_ingot" - } + "minecraft:netherite_scrap", + "minecraft:netherite_scrap", + "minecraft:netherite_scrap", + "minecraft:netherite_scrap", + "minecraft:gold_ingot", + "minecraft:gold_ingot", + "minecraft:gold_ingot", + "minecraft:gold_ingot" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/netherite_ingot_from_netherite_block.json b/data/minecraft/recipe/netherite_ingot_from_netherite_block.json index 0b82b5d9..67fa9e62 100644 --- a/data/minecraft/recipe/netherite_ingot_from_netherite_block.json +++ b/data/minecraft/recipe/netherite_ingot_from_netherite_block.json @@ -3,9 +3,7 @@ "category": "misc", "group": "netherite_ingot", "ingredients": [ - { - "item": "minecraft:netherite_block" - } + "minecraft:netherite_block" ], "result": { "count": 9, diff --git a/data/minecraft/recipe/netherite_leggings_smithing.json b/data/minecraft/recipe/netherite_leggings_smithing.json index feb9759a..c1400d30 100644 --- a/data/minecraft/recipe/netherite_leggings_smithing.json +++ b/data/minecraft/recipe/netherite_leggings_smithing.json @@ -1,16 +1,10 @@ { "type": "minecraft:smithing_transform", - "addition": { - "item": "minecraft:netherite_ingot" - }, - "base": { - "item": "minecraft:diamond_leggings" - }, + "addition": "#minecraft:netherite_tool_materials", + "base": "minecraft:diamond_leggings", "result": { "count": 1, "id": "minecraft:netherite_leggings" }, - "template": { - "item": "minecraft:netherite_upgrade_smithing_template" - } + "template": "minecraft:netherite_upgrade_smithing_template" } \ No newline at end of file diff --git a/data/minecraft/recipe/netherite_pickaxe_smithing.json b/data/minecraft/recipe/netherite_pickaxe_smithing.json index 7e1f2cae..60b64e89 100644 --- a/data/minecraft/recipe/netherite_pickaxe_smithing.json +++ b/data/minecraft/recipe/netherite_pickaxe_smithing.json @@ -1,16 +1,10 @@ { "type": "minecraft:smithing_transform", - "addition": { - "item": "minecraft:netherite_ingot" - }, - "base": { - "item": "minecraft:diamond_pickaxe" - }, + "addition": "#minecraft:netherite_tool_materials", + "base": "minecraft:diamond_pickaxe", "result": { "count": 1, "id": "minecraft:netherite_pickaxe" }, - "template": { - "item": "minecraft:netherite_upgrade_smithing_template" - } + "template": "minecraft:netherite_upgrade_smithing_template" } \ No newline at end of file diff --git a/data/minecraft/recipe/netherite_scrap.json b/data/minecraft/recipe/netherite_scrap.json index a94d9e42..5eb36904 100644 --- a/data/minecraft/recipe/netherite_scrap.json +++ b/data/minecraft/recipe/netherite_scrap.json @@ -3,9 +3,7 @@ "category": "misc", "cookingtime": 200, "experience": 2.0, - "ingredient": { - "item": "minecraft:ancient_debris" - }, + "ingredient": "minecraft:ancient_debris", "result": { "id": "minecraft:netherite_scrap" } diff --git a/data/minecraft/recipe/netherite_scrap_from_blasting.json b/data/minecraft/recipe/netherite_scrap_from_blasting.json index 483f5e45..86e9958e 100644 --- a/data/minecraft/recipe/netherite_scrap_from_blasting.json +++ b/data/minecraft/recipe/netherite_scrap_from_blasting.json @@ -3,9 +3,7 @@ "category": "misc", "cookingtime": 100, "experience": 2.0, - "ingredient": { - "item": "minecraft:ancient_debris" - }, + "ingredient": "minecraft:ancient_debris", "result": { "id": "minecraft:netherite_scrap" } diff --git a/data/minecraft/recipe/netherite_shovel_smithing.json b/data/minecraft/recipe/netherite_shovel_smithing.json index 34648509..01ce41ed 100644 --- a/data/minecraft/recipe/netherite_shovel_smithing.json +++ b/data/minecraft/recipe/netherite_shovel_smithing.json @@ -1,16 +1,10 @@ { "type": "minecraft:smithing_transform", - "addition": { - "item": "minecraft:netherite_ingot" - }, - "base": { - "item": "minecraft:diamond_shovel" - }, + "addition": "#minecraft:netherite_tool_materials", + "base": "minecraft:diamond_shovel", "result": { "count": 1, "id": "minecraft:netherite_shovel" }, - "template": { - "item": "minecraft:netherite_upgrade_smithing_template" - } + "template": "minecraft:netherite_upgrade_smithing_template" } \ No newline at end of file diff --git a/data/minecraft/recipe/netherite_sword_smithing.json b/data/minecraft/recipe/netherite_sword_smithing.json index 009425c4..86a8e7ab 100644 --- a/data/minecraft/recipe/netherite_sword_smithing.json +++ b/data/minecraft/recipe/netherite_sword_smithing.json @@ -1,16 +1,10 @@ { "type": "minecraft:smithing_transform", - "addition": { - "item": "minecraft:netherite_ingot" - }, - "base": { - "item": "minecraft:diamond_sword" - }, + "addition": "#minecraft:netherite_tool_materials", + "base": "minecraft:diamond_sword", "result": { "count": 1, "id": "minecraft:netherite_sword" }, - "template": { - "item": "minecraft:netherite_upgrade_smithing_template" - } + "template": "minecraft:netherite_upgrade_smithing_template" } \ No newline at end of file diff --git a/data/minecraft/recipe/netherite_upgrade_smithing_template.json b/data/minecraft/recipe/netherite_upgrade_smithing_template.json index ff57f7d1..25e4311f 100644 --- a/data/minecraft/recipe/netherite_upgrade_smithing_template.json +++ b/data/minecraft/recipe/netherite_upgrade_smithing_template.json @@ -2,15 +2,9 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "#": { - "item": "minecraft:diamond" - }, - "C": { - "item": "minecraft:netherrack" - }, - "S": { - "item": "minecraft:netherite_upgrade_smithing_template" - } + "#": "minecraft:diamond", + "C": "minecraft:netherrack", + "S": "minecraft:netherite_upgrade_smithing_template" }, "pattern": [ "#S#", diff --git a/data/minecraft/recipe/note_block.json b/data/minecraft/recipe/note_block.json index 41776f7f..b63f67c3 100644 --- a/data/minecraft/recipe/note_block.json +++ b/data/minecraft/recipe/note_block.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shaped", "category": "redstone", "key": { - "#": { - "tag": "minecraft:planks" - }, - "X": { - "item": "minecraft:redstone" - } + "#": "#minecraft:planks", + "X": "minecraft:redstone" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/oak_boat.json b/data/minecraft/recipe/oak_boat.json index 44c2f68e..23e63fb3 100644 --- a/data/minecraft/recipe/oak_boat.json +++ b/data/minecraft/recipe/oak_boat.json @@ -3,9 +3,7 @@ "category": "misc", "group": "boat", "key": { - "#": { - "item": "minecraft:oak_planks" - } + "#": "minecraft:oak_planks" }, "pattern": [ "# #", diff --git a/data/minecraft/recipe/oak_button.json b/data/minecraft/recipe/oak_button.json index aeeef07e..34432d2e 100644 --- a/data/minecraft/recipe/oak_button.json +++ b/data/minecraft/recipe/oak_button.json @@ -3,9 +3,7 @@ "category": "redstone", "group": "wooden_button", "ingredients": [ - { - "item": "minecraft:oak_planks" - } + "minecraft:oak_planks" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/oak_chest_boat.json b/data/minecraft/recipe/oak_chest_boat.json index 7b3d727f..75508ca9 100644 --- a/data/minecraft/recipe/oak_chest_boat.json +++ b/data/minecraft/recipe/oak_chest_boat.json @@ -3,12 +3,8 @@ "category": "misc", "group": "chest_boat", "ingredients": [ - { - "item": "minecraft:chest" - }, - { - "item": "minecraft:oak_boat" - } + "minecraft:chest", + "minecraft:oak_boat" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/oak_door.json b/data/minecraft/recipe/oak_door.json index 2b4514f0..d93c7d98 100644 --- a/data/minecraft/recipe/oak_door.json +++ b/data/minecraft/recipe/oak_door.json @@ -3,9 +3,7 @@ "category": "redstone", "group": "wooden_door", "key": { - "#": { - "item": "minecraft:oak_planks" - } + "#": "minecraft:oak_planks" }, "pattern": [ "##", diff --git a/data/minecraft/recipe/oak_fence.json b/data/minecraft/recipe/oak_fence.json index c4fe6c5f..c5793495 100644 --- a/data/minecraft/recipe/oak_fence.json +++ b/data/minecraft/recipe/oak_fence.json @@ -3,12 +3,8 @@ "category": "misc", "group": "wooden_fence", "key": { - "#": { - "item": "minecraft:stick" - }, - "W": { - "item": "minecraft:oak_planks" - } + "#": "minecraft:stick", + "W": "minecraft:oak_planks" }, "pattern": [ "W#W", diff --git a/data/minecraft/recipe/oak_fence_gate.json b/data/minecraft/recipe/oak_fence_gate.json index 5f90202e..acba178b 100644 --- a/data/minecraft/recipe/oak_fence_gate.json +++ b/data/minecraft/recipe/oak_fence_gate.json @@ -3,12 +3,8 @@ "category": "redstone", "group": "wooden_fence_gate", "key": { - "#": { - "item": "minecraft:stick" - }, - "W": { - "item": "minecraft:oak_planks" - } + "#": "minecraft:stick", + "W": "minecraft:oak_planks" }, "pattern": [ "#W#", diff --git a/data/minecraft/recipe/oak_hanging_sign.json b/data/minecraft/recipe/oak_hanging_sign.json index 2c3e6a1f..7e0d4754 100644 --- a/data/minecraft/recipe/oak_hanging_sign.json +++ b/data/minecraft/recipe/oak_hanging_sign.json @@ -3,12 +3,8 @@ "category": "misc", "group": "hanging_sign", "key": { - "#": { - "item": "minecraft:stripped_oak_log" - }, - "X": { - "item": "minecraft:chain" - } + "#": "minecraft:stripped_oak_log", + "X": "minecraft:chain" }, "pattern": [ "X X", diff --git a/data/minecraft/recipe/oak_planks.json b/data/minecraft/recipe/oak_planks.json index 3ac125dc..113883bf 100644 --- a/data/minecraft/recipe/oak_planks.json +++ b/data/minecraft/recipe/oak_planks.json @@ -3,9 +3,7 @@ "category": "building", "group": "planks", "ingredients": [ - { - "tag": "minecraft:oak_logs" - } + "#minecraft:oak_logs" ], "result": { "count": 4, diff --git a/data/minecraft/recipe/oak_pressure_plate.json b/data/minecraft/recipe/oak_pressure_plate.json index d3d5205c..ff195571 100644 --- a/data/minecraft/recipe/oak_pressure_plate.json +++ b/data/minecraft/recipe/oak_pressure_plate.json @@ -3,9 +3,7 @@ "category": "redstone", "group": "wooden_pressure_plate", "key": { - "#": { - "item": "minecraft:oak_planks" - } + "#": "minecraft:oak_planks" }, "pattern": [ "##" diff --git a/data/minecraft/recipe/oak_sign.json b/data/minecraft/recipe/oak_sign.json index 825cdf5b..820f3d90 100644 --- a/data/minecraft/recipe/oak_sign.json +++ b/data/minecraft/recipe/oak_sign.json @@ -3,12 +3,8 @@ "category": "misc", "group": "wooden_sign", "key": { - "#": { - "item": "minecraft:oak_planks" - }, - "X": { - "item": "minecraft:stick" - } + "#": "minecraft:oak_planks", + "X": "minecraft:stick" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/oak_slab.json b/data/minecraft/recipe/oak_slab.json index 05698632..5cb7f02d 100644 --- a/data/minecraft/recipe/oak_slab.json +++ b/data/minecraft/recipe/oak_slab.json @@ -3,9 +3,7 @@ "category": "building", "group": "wooden_slab", "key": { - "#": { - "item": "minecraft:oak_planks" - } + "#": "minecraft:oak_planks" }, "pattern": [ "###" diff --git a/data/minecraft/recipe/oak_stairs.json b/data/minecraft/recipe/oak_stairs.json index 59f7b68d..b24521c6 100644 --- a/data/minecraft/recipe/oak_stairs.json +++ b/data/minecraft/recipe/oak_stairs.json @@ -3,9 +3,7 @@ "category": "building", "group": "wooden_stairs", "key": { - "#": { - "item": "minecraft:oak_planks" - } + "#": "minecraft:oak_planks" }, "pattern": [ "# ", diff --git a/data/minecraft/recipe/oak_trapdoor.json b/data/minecraft/recipe/oak_trapdoor.json index 24d53d79..be5450d4 100644 --- a/data/minecraft/recipe/oak_trapdoor.json +++ b/data/minecraft/recipe/oak_trapdoor.json @@ -3,9 +3,7 @@ "category": "redstone", "group": "wooden_trapdoor", "key": { - "#": { - "item": "minecraft:oak_planks" - } + "#": "minecraft:oak_planks" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/oak_wood.json b/data/minecraft/recipe/oak_wood.json index 8a6d5e47..d902ffcb 100644 --- a/data/minecraft/recipe/oak_wood.json +++ b/data/minecraft/recipe/oak_wood.json @@ -3,9 +3,7 @@ "category": "building", "group": "bark", "key": { - "#": { - "item": "minecraft:oak_log" - } + "#": "minecraft:oak_log" }, "pattern": [ "##", diff --git a/data/minecraft/recipe/observer.json b/data/minecraft/recipe/observer.json index 65f83168..289cd630 100644 --- a/data/minecraft/recipe/observer.json +++ b/data/minecraft/recipe/observer.json @@ -2,15 +2,9 @@ "type": "minecraft:crafting_shaped", "category": "redstone", "key": { - "#": { - "item": "minecraft:cobblestone" - }, - "Q": { - "item": "minecraft:quartz" - }, - "R": { - "item": "minecraft:redstone" - } + "#": "minecraft:cobblestone", + "Q": "minecraft:quartz", + "R": "minecraft:redstone" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/orange_banner.json b/data/minecraft/recipe/orange_banner.json index 230fa931..7337b8b1 100644 --- a/data/minecraft/recipe/orange_banner.json +++ b/data/minecraft/recipe/orange_banner.json @@ -3,12 +3,8 @@ "category": "misc", "group": "banner", "key": { - "#": { - "item": "minecraft:orange_wool" - }, - "|": { - "item": "minecraft:stick" - } + "#": "minecraft:orange_wool", + "|": "minecraft:stick" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/orange_bed.json b/data/minecraft/recipe/orange_bed.json index 67026e36..53f7fbb5 100644 --- a/data/minecraft/recipe/orange_bed.json +++ b/data/minecraft/recipe/orange_bed.json @@ -3,12 +3,8 @@ "category": "misc", "group": "bed", "key": { - "#": { - "item": "minecraft:orange_wool" - }, - "X": { - "tag": "minecraft:planks" - } + "#": "minecraft:orange_wool", + "X": "#minecraft:planks" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/orange_bundle.json b/data/minecraft/recipe/orange_bundle.json new file mode 100644 index 00000000..4aa80ccc --- /dev/null +++ b/data/minecraft/recipe/orange_bundle.json @@ -0,0 +1,8 @@ +{ + "type": "minecraft:crafting_transmute", + "category": "equipment", + "group": "bundle_dye", + "input": "#minecraft:bundles", + "material": "minecraft:orange_dye", + "result": "minecraft:orange_bundle" +} \ No newline at end of file diff --git a/data/minecraft/recipe/orange_candle.json b/data/minecraft/recipe/orange_candle.json index ec2bcc44..0c0846ea 100644 --- a/data/minecraft/recipe/orange_candle.json +++ b/data/minecraft/recipe/orange_candle.json @@ -3,12 +3,8 @@ "category": "misc", "group": "dyed_candle", "ingredients": [ - { - "item": "minecraft:candle" - }, - { - "item": "minecraft:orange_dye" - } + "minecraft:candle", + "minecraft:orange_dye" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/orange_carpet.json b/data/minecraft/recipe/orange_carpet.json index aae0e0ff..8a71c405 100644 --- a/data/minecraft/recipe/orange_carpet.json +++ b/data/minecraft/recipe/orange_carpet.json @@ -3,9 +3,7 @@ "category": "misc", "group": "carpet", "key": { - "#": { - "item": "minecraft:orange_wool" - } + "#": "minecraft:orange_wool" }, "pattern": [ "##" diff --git a/data/minecraft/recipe/orange_concrete_powder.json b/data/minecraft/recipe/orange_concrete_powder.json index 61e7cd1b..4ca5831d 100644 --- a/data/minecraft/recipe/orange_concrete_powder.json +++ b/data/minecraft/recipe/orange_concrete_powder.json @@ -3,33 +3,15 @@ "category": "building", "group": "concrete_powder", "ingredients": [ - { - "item": "minecraft:orange_dye" - }, - { - "item": "minecraft:sand" - }, - { - "item": "minecraft:sand" - }, - { - "item": "minecraft:sand" - }, - { - "item": "minecraft:sand" - }, - { - "item": "minecraft:gravel" - }, - { - "item": "minecraft:gravel" - }, - { - "item": "minecraft:gravel" - }, - { - "item": "minecraft:gravel" - } + "minecraft:orange_dye", + "minecraft:sand", + "minecraft:sand", + "minecraft:sand", + "minecraft:sand", + "minecraft:gravel", + "minecraft:gravel", + "minecraft:gravel", + "minecraft:gravel" ], "result": { "count": 8, diff --git a/data/minecraft/recipe/orange_dye_from_orange_tulip.json b/data/minecraft/recipe/orange_dye_from_orange_tulip.json index 940a2918..ec1ad8b7 100644 --- a/data/minecraft/recipe/orange_dye_from_orange_tulip.json +++ b/data/minecraft/recipe/orange_dye_from_orange_tulip.json @@ -3,9 +3,7 @@ "category": "misc", "group": "orange_dye", "ingredients": [ - { - "item": "minecraft:orange_tulip" - } + "minecraft:orange_tulip" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/orange_dye_from_red_yellow.json b/data/minecraft/recipe/orange_dye_from_red_yellow.json index 1a4616ff..32a5a5de 100644 --- a/data/minecraft/recipe/orange_dye_from_red_yellow.json +++ b/data/minecraft/recipe/orange_dye_from_red_yellow.json @@ -3,12 +3,8 @@ "category": "misc", "group": "orange_dye", "ingredients": [ - { - "item": "minecraft:red_dye" - }, - { - "item": "minecraft:yellow_dye" - } + "minecraft:red_dye", + "minecraft:yellow_dye" ], "result": { "count": 2, diff --git a/data/minecraft/recipe/orange_dye_from_torchflower.json b/data/minecraft/recipe/orange_dye_from_torchflower.json index 4a4ebfa8..8b6e7193 100644 --- a/data/minecraft/recipe/orange_dye_from_torchflower.json +++ b/data/minecraft/recipe/orange_dye_from_torchflower.json @@ -3,9 +3,7 @@ "category": "misc", "group": "orange_dye", "ingredients": [ - { - "item": "minecraft:torchflower" - } + "minecraft:torchflower" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/orange_glazed_terracotta.json b/data/minecraft/recipe/orange_glazed_terracotta.json index eaf02c17..e3a0dacf 100644 --- a/data/minecraft/recipe/orange_glazed_terracotta.json +++ b/data/minecraft/recipe/orange_glazed_terracotta.json @@ -3,9 +3,7 @@ "category": "blocks", "cookingtime": 200, "experience": 0.1, - "ingredient": { - "item": "minecraft:orange_terracotta" - }, + "ingredient": "minecraft:orange_terracotta", "result": { "id": "minecraft:orange_glazed_terracotta" } diff --git a/data/minecraft/recipe/orange_shulker_box.json b/data/minecraft/recipe/orange_shulker_box.json new file mode 100644 index 00000000..203f8eeb --- /dev/null +++ b/data/minecraft/recipe/orange_shulker_box.json @@ -0,0 +1,8 @@ +{ + "type": "minecraft:crafting_transmute", + "category": "misc", + "group": "shulker_box_dye", + "input": "#minecraft:shulker_boxes", + "material": "minecraft:orange_dye", + "result": "minecraft:orange_shulker_box" +} \ No newline at end of file diff --git a/data/minecraft/recipe/orange_stained_glass.json b/data/minecraft/recipe/orange_stained_glass.json index 4aecd84e..f096ea55 100644 --- a/data/minecraft/recipe/orange_stained_glass.json +++ b/data/minecraft/recipe/orange_stained_glass.json @@ -3,12 +3,8 @@ "category": "building", "group": "stained_glass", "key": { - "#": { - "item": "minecraft:glass" - }, - "X": { - "item": "minecraft:orange_dye" - } + "#": "minecraft:glass", + "X": "minecraft:orange_dye" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/orange_stained_glass_pane.json b/data/minecraft/recipe/orange_stained_glass_pane.json index 8c5fa980..a3d8d192 100644 --- a/data/minecraft/recipe/orange_stained_glass_pane.json +++ b/data/minecraft/recipe/orange_stained_glass_pane.json @@ -3,9 +3,7 @@ "category": "misc", "group": "stained_glass_pane", "key": { - "#": { - "item": "minecraft:orange_stained_glass" - } + "#": "minecraft:orange_stained_glass" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/orange_stained_glass_pane_from_glass_pane.json b/data/minecraft/recipe/orange_stained_glass_pane_from_glass_pane.json index 0c83fcde..87f3d7db 100644 --- a/data/minecraft/recipe/orange_stained_glass_pane_from_glass_pane.json +++ b/data/minecraft/recipe/orange_stained_glass_pane_from_glass_pane.json @@ -3,12 +3,8 @@ "category": "misc", "group": "stained_glass_pane", "key": { - "#": { - "item": "minecraft:glass_pane" - }, - "$": { - "item": "minecraft:orange_dye" - } + "#": "minecraft:glass_pane", + "$": "minecraft:orange_dye" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/orange_terracotta.json b/data/minecraft/recipe/orange_terracotta.json index 96bb9dea..ed1a411d 100644 --- a/data/minecraft/recipe/orange_terracotta.json +++ b/data/minecraft/recipe/orange_terracotta.json @@ -3,12 +3,8 @@ "category": "building", "group": "stained_terracotta", "key": { - "#": { - "item": "minecraft:terracotta" - }, - "X": { - "item": "minecraft:orange_dye" - } + "#": "minecraft:terracotta", + "X": "minecraft:orange_dye" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/oxidized_chiseled_copper.json b/data/minecraft/recipe/oxidized_chiseled_copper.json index a8b40d7a..bb40a302 100644 --- a/data/minecraft/recipe/oxidized_chiseled_copper.json +++ b/data/minecraft/recipe/oxidized_chiseled_copper.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:oxidized_cut_copper_slab" - } + "#": "minecraft:oxidized_cut_copper_slab" }, "pattern": [ "#", diff --git a/data/minecraft/recipe/oxidized_chiseled_copper_from_oxidized_copper_stonecutting.json b/data/minecraft/recipe/oxidized_chiseled_copper_from_oxidized_copper_stonecutting.json index 2c4e1c23..a31541c1 100644 --- a/data/minecraft/recipe/oxidized_chiseled_copper_from_oxidized_copper_stonecutting.json +++ b/data/minecraft/recipe/oxidized_chiseled_copper_from_oxidized_copper_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:oxidized_copper" - }, + "ingredient": "minecraft:oxidized_copper", "result": { "count": 4, "id": "minecraft:oxidized_chiseled_copper" diff --git a/data/minecraft/recipe/oxidized_chiseled_copper_from_oxidized_cut_copper_stonecutting.json b/data/minecraft/recipe/oxidized_chiseled_copper_from_oxidized_cut_copper_stonecutting.json index c8468440..24b24a73 100644 --- a/data/minecraft/recipe/oxidized_chiseled_copper_from_oxidized_cut_copper_stonecutting.json +++ b/data/minecraft/recipe/oxidized_chiseled_copper_from_oxidized_cut_copper_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:oxidized_cut_copper" - }, + "ingredient": "minecraft:oxidized_cut_copper", "result": { "count": 1, "id": "minecraft:oxidized_chiseled_copper" diff --git a/data/minecraft/recipe/oxidized_copper_bulb.json b/data/minecraft/recipe/oxidized_copper_bulb.json index 069634c2..742e22c2 100644 --- a/data/minecraft/recipe/oxidized_copper_bulb.json +++ b/data/minecraft/recipe/oxidized_copper_bulb.json @@ -2,15 +2,9 @@ "type": "minecraft:crafting_shaped", "category": "redstone", "key": { - "B": { - "item": "minecraft:blaze_rod" - }, - "C": { - "item": "minecraft:oxidized_copper" - }, - "R": { - "item": "minecraft:redstone" - } + "B": "minecraft:blaze_rod", + "C": "minecraft:oxidized_copper", + "R": "minecraft:redstone" }, "pattern": [ " C ", diff --git a/data/minecraft/recipe/oxidized_copper_grate.json b/data/minecraft/recipe/oxidized_copper_grate.json index 0ecfbc6b..c43d513b 100644 --- a/data/minecraft/recipe/oxidized_copper_grate.json +++ b/data/minecraft/recipe/oxidized_copper_grate.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "M": { - "item": "minecraft:oxidized_copper" - } + "M": "minecraft:oxidized_copper" }, "pattern": [ " M ", diff --git a/data/minecraft/recipe/oxidized_copper_grate_from_oxidized_copper_stonecutting.json b/data/minecraft/recipe/oxidized_copper_grate_from_oxidized_copper_stonecutting.json index a816c127..4503dff8 100644 --- a/data/minecraft/recipe/oxidized_copper_grate_from_oxidized_copper_stonecutting.json +++ b/data/minecraft/recipe/oxidized_copper_grate_from_oxidized_copper_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:oxidized_copper" - }, + "ingredient": "minecraft:oxidized_copper", "result": { "count": 4, "id": "minecraft:oxidized_copper_grate" diff --git a/data/minecraft/recipe/oxidized_cut_copper.json b/data/minecraft/recipe/oxidized_cut_copper.json index 855b71f4..256da0d7 100644 --- a/data/minecraft/recipe/oxidized_cut_copper.json +++ b/data/minecraft/recipe/oxidized_cut_copper.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:oxidized_copper" - } + "#": "minecraft:oxidized_copper" }, "pattern": [ "##", diff --git a/data/minecraft/recipe/oxidized_cut_copper_from_oxidized_copper_stonecutting.json b/data/minecraft/recipe/oxidized_cut_copper_from_oxidized_copper_stonecutting.json index 6182576e..2dc6f40e 100644 --- a/data/minecraft/recipe/oxidized_cut_copper_from_oxidized_copper_stonecutting.json +++ b/data/minecraft/recipe/oxidized_cut_copper_from_oxidized_copper_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:oxidized_copper" - }, + "ingredient": "minecraft:oxidized_copper", "result": { "count": 4, "id": "minecraft:oxidized_cut_copper" diff --git a/data/minecraft/recipe/oxidized_cut_copper_slab.json b/data/minecraft/recipe/oxidized_cut_copper_slab.json index 75d5c201..cbe8cf54 100644 --- a/data/minecraft/recipe/oxidized_cut_copper_slab.json +++ b/data/minecraft/recipe/oxidized_cut_copper_slab.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:oxidized_cut_copper" - } + "#": "minecraft:oxidized_cut_copper" }, "pattern": [ "###" diff --git a/data/minecraft/recipe/oxidized_cut_copper_slab_from_oxidized_copper_stonecutting.json b/data/minecraft/recipe/oxidized_cut_copper_slab_from_oxidized_copper_stonecutting.json index 965aeaa6..4a7bce20 100644 --- a/data/minecraft/recipe/oxidized_cut_copper_slab_from_oxidized_copper_stonecutting.json +++ b/data/minecraft/recipe/oxidized_cut_copper_slab_from_oxidized_copper_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:oxidized_copper" - }, + "ingredient": "minecraft:oxidized_copper", "result": { "count": 8, "id": "minecraft:oxidized_cut_copper_slab" diff --git a/data/minecraft/recipe/oxidized_cut_copper_slab_from_oxidized_cut_copper_stonecutting.json b/data/minecraft/recipe/oxidized_cut_copper_slab_from_oxidized_cut_copper_stonecutting.json index 84945651..29a84bb4 100644 --- a/data/minecraft/recipe/oxidized_cut_copper_slab_from_oxidized_cut_copper_stonecutting.json +++ b/data/minecraft/recipe/oxidized_cut_copper_slab_from_oxidized_cut_copper_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:oxidized_cut_copper" - }, + "ingredient": "minecraft:oxidized_cut_copper", "result": { "count": 2, "id": "minecraft:oxidized_cut_copper_slab" diff --git a/data/minecraft/recipe/oxidized_cut_copper_stairs.json b/data/minecraft/recipe/oxidized_cut_copper_stairs.json index 27c84fa5..e7728465 100644 --- a/data/minecraft/recipe/oxidized_cut_copper_stairs.json +++ b/data/minecraft/recipe/oxidized_cut_copper_stairs.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:oxidized_cut_copper" - } + "#": "minecraft:oxidized_cut_copper" }, "pattern": [ "# ", diff --git a/data/minecraft/recipe/oxidized_cut_copper_stairs_from_oxidized_copper_stonecutting.json b/data/minecraft/recipe/oxidized_cut_copper_stairs_from_oxidized_copper_stonecutting.json index 9e36f1c2..6b6596b5 100644 --- a/data/minecraft/recipe/oxidized_cut_copper_stairs_from_oxidized_copper_stonecutting.json +++ b/data/minecraft/recipe/oxidized_cut_copper_stairs_from_oxidized_copper_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:oxidized_copper" - }, + "ingredient": "minecraft:oxidized_copper", "result": { "count": 4, "id": "minecraft:oxidized_cut_copper_stairs" diff --git a/data/minecraft/recipe/oxidized_cut_copper_stairs_from_oxidized_cut_copper_stonecutting.json b/data/minecraft/recipe/oxidized_cut_copper_stairs_from_oxidized_cut_copper_stonecutting.json index b45096c4..d3c027f8 100644 --- a/data/minecraft/recipe/oxidized_cut_copper_stairs_from_oxidized_cut_copper_stonecutting.json +++ b/data/minecraft/recipe/oxidized_cut_copper_stairs_from_oxidized_cut_copper_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:oxidized_cut_copper" - }, + "ingredient": "minecraft:oxidized_cut_copper", "result": { "count": 1, "id": "minecraft:oxidized_cut_copper_stairs" diff --git a/data/minecraft/recipe/packed_ice.json b/data/minecraft/recipe/packed_ice.json index fa647b7c..e9364eae 100644 --- a/data/minecraft/recipe/packed_ice.json +++ b/data/minecraft/recipe/packed_ice.json @@ -2,33 +2,15 @@ "type": "minecraft:crafting_shapeless", "category": "building", "ingredients": [ - { - "item": "minecraft:ice" - }, - { - "item": "minecraft:ice" - }, - { - "item": "minecraft:ice" - }, - { - "item": "minecraft:ice" - }, - { - "item": "minecraft:ice" - }, - { - "item": "minecraft:ice" - }, - { - "item": "minecraft:ice" - }, - { - "item": "minecraft:ice" - }, - { - "item": "minecraft:ice" - } + "minecraft:ice", + "minecraft:ice", + "minecraft:ice", + "minecraft:ice", + "minecraft:ice", + "minecraft:ice", + "minecraft:ice", + "minecraft:ice", + "minecraft:ice" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/packed_mud.json b/data/minecraft/recipe/packed_mud.json index 4944d15d..155458fc 100644 --- a/data/minecraft/recipe/packed_mud.json +++ b/data/minecraft/recipe/packed_mud.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shapeless", "category": "building", "ingredients": [ - { - "item": "minecraft:mud" - }, - { - "item": "minecraft:wheat" - } + "minecraft:mud", + "minecraft:wheat" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/painting.json b/data/minecraft/recipe/painting.json index c88f5272..17551dc7 100644 --- a/data/minecraft/recipe/painting.json +++ b/data/minecraft/recipe/painting.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "#": { - "item": "minecraft:stick" - }, - "X": { - "tag": "minecraft:wool" - } + "#": "minecraft:stick", + "X": "#minecraft:wool" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/paper.json b/data/minecraft/recipe/paper.json index f768457b..9aaf61bc 100644 --- a/data/minecraft/recipe/paper.json +++ b/data/minecraft/recipe/paper.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "#": { - "item": "minecraft:sugar_cane" - } + "#": "minecraft:sugar_cane" }, "pattern": [ "###" diff --git a/data/minecraft/recipe/pink_banner.json b/data/minecraft/recipe/pink_banner.json index 9f4b4441..cf203300 100644 --- a/data/minecraft/recipe/pink_banner.json +++ b/data/minecraft/recipe/pink_banner.json @@ -3,12 +3,8 @@ "category": "misc", "group": "banner", "key": { - "#": { - "item": "minecraft:pink_wool" - }, - "|": { - "item": "minecraft:stick" - } + "#": "minecraft:pink_wool", + "|": "minecraft:stick" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/pink_bed.json b/data/minecraft/recipe/pink_bed.json index f98c1e8b..e6cc88b1 100644 --- a/data/minecraft/recipe/pink_bed.json +++ b/data/minecraft/recipe/pink_bed.json @@ -3,12 +3,8 @@ "category": "misc", "group": "bed", "key": { - "#": { - "item": "minecraft:pink_wool" - }, - "X": { - "tag": "minecraft:planks" - } + "#": "minecraft:pink_wool", + "X": "#minecraft:planks" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/pink_bundle.json b/data/minecraft/recipe/pink_bundle.json new file mode 100644 index 00000000..f08dafbb --- /dev/null +++ b/data/minecraft/recipe/pink_bundle.json @@ -0,0 +1,8 @@ +{ + "type": "minecraft:crafting_transmute", + "category": "equipment", + "group": "bundle_dye", + "input": "#minecraft:bundles", + "material": "minecraft:pink_dye", + "result": "minecraft:pink_bundle" +} \ No newline at end of file diff --git a/data/minecraft/recipe/pink_candle.json b/data/minecraft/recipe/pink_candle.json index 2c6ea76b..df7ed084 100644 --- a/data/minecraft/recipe/pink_candle.json +++ b/data/minecraft/recipe/pink_candle.json @@ -3,12 +3,8 @@ "category": "misc", "group": "dyed_candle", "ingredients": [ - { - "item": "minecraft:candle" - }, - { - "item": "minecraft:pink_dye" - } + "minecraft:candle", + "minecraft:pink_dye" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/pink_carpet.json b/data/minecraft/recipe/pink_carpet.json index cd828567..590da03a 100644 --- a/data/minecraft/recipe/pink_carpet.json +++ b/data/minecraft/recipe/pink_carpet.json @@ -3,9 +3,7 @@ "category": "misc", "group": "carpet", "key": { - "#": { - "item": "minecraft:pink_wool" - } + "#": "minecraft:pink_wool" }, "pattern": [ "##" diff --git a/data/minecraft/recipe/pink_concrete_powder.json b/data/minecraft/recipe/pink_concrete_powder.json index 22198acf..744debd5 100644 --- a/data/minecraft/recipe/pink_concrete_powder.json +++ b/data/minecraft/recipe/pink_concrete_powder.json @@ -3,33 +3,15 @@ "category": "building", "group": "concrete_powder", "ingredients": [ - { - "item": "minecraft:pink_dye" - }, - { - "item": "minecraft:sand" - }, - { - "item": "minecraft:sand" - }, - { - "item": "minecraft:sand" - }, - { - "item": "minecraft:sand" - }, - { - "item": "minecraft:gravel" - }, - { - "item": "minecraft:gravel" - }, - { - "item": "minecraft:gravel" - }, - { - "item": "minecraft:gravel" - } + "minecraft:pink_dye", + "minecraft:sand", + "minecraft:sand", + "minecraft:sand", + "minecraft:sand", + "minecraft:gravel", + "minecraft:gravel", + "minecraft:gravel", + "minecraft:gravel" ], "result": { "count": 8, diff --git a/data/minecraft/recipe/pink_dye_from_peony.json b/data/minecraft/recipe/pink_dye_from_peony.json index 1cbe8a9c..cdec7649 100644 --- a/data/minecraft/recipe/pink_dye_from_peony.json +++ b/data/minecraft/recipe/pink_dye_from_peony.json @@ -3,9 +3,7 @@ "category": "misc", "group": "pink_dye", "ingredients": [ - { - "item": "minecraft:peony" - } + "minecraft:peony" ], "result": { "count": 2, diff --git a/data/minecraft/recipe/pink_dye_from_pink_petals.json b/data/minecraft/recipe/pink_dye_from_pink_petals.json index a69e6570..2f817ae5 100644 --- a/data/minecraft/recipe/pink_dye_from_pink_petals.json +++ b/data/minecraft/recipe/pink_dye_from_pink_petals.json @@ -3,9 +3,7 @@ "category": "misc", "group": "pink_dye", "ingredients": [ - { - "item": "minecraft:pink_petals" - } + "minecraft:pink_petals" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/pink_dye_from_pink_tulip.json b/data/minecraft/recipe/pink_dye_from_pink_tulip.json index 492737d4..5615b699 100644 --- a/data/minecraft/recipe/pink_dye_from_pink_tulip.json +++ b/data/minecraft/recipe/pink_dye_from_pink_tulip.json @@ -3,9 +3,7 @@ "category": "misc", "group": "pink_dye", "ingredients": [ - { - "item": "minecraft:pink_tulip" - } + "minecraft:pink_tulip" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/pink_dye_from_red_white_dye.json b/data/minecraft/recipe/pink_dye_from_red_white_dye.json index d0be92ae..e281d060 100644 --- a/data/minecraft/recipe/pink_dye_from_red_white_dye.json +++ b/data/minecraft/recipe/pink_dye_from_red_white_dye.json @@ -3,12 +3,8 @@ "category": "misc", "group": "pink_dye", "ingredients": [ - { - "item": "minecraft:red_dye" - }, - { - "item": "minecraft:white_dye" - } + "minecraft:red_dye", + "minecraft:white_dye" ], "result": { "count": 2, diff --git a/data/minecraft/recipe/pink_glazed_terracotta.json b/data/minecraft/recipe/pink_glazed_terracotta.json index 2b82ea41..71d642f3 100644 --- a/data/minecraft/recipe/pink_glazed_terracotta.json +++ b/data/minecraft/recipe/pink_glazed_terracotta.json @@ -3,9 +3,7 @@ "category": "blocks", "cookingtime": 200, "experience": 0.1, - "ingredient": { - "item": "minecraft:pink_terracotta" - }, + "ingredient": "minecraft:pink_terracotta", "result": { "id": "minecraft:pink_glazed_terracotta" } diff --git a/data/minecraft/recipe/pink_shulker_box.json b/data/minecraft/recipe/pink_shulker_box.json new file mode 100644 index 00000000..3916f886 --- /dev/null +++ b/data/minecraft/recipe/pink_shulker_box.json @@ -0,0 +1,8 @@ +{ + "type": "minecraft:crafting_transmute", + "category": "misc", + "group": "shulker_box_dye", + "input": "#minecraft:shulker_boxes", + "material": "minecraft:pink_dye", + "result": "minecraft:pink_shulker_box" +} \ No newline at end of file diff --git a/data/minecraft/recipe/pink_stained_glass.json b/data/minecraft/recipe/pink_stained_glass.json index 82c30891..f5c03d00 100644 --- a/data/minecraft/recipe/pink_stained_glass.json +++ b/data/minecraft/recipe/pink_stained_glass.json @@ -3,12 +3,8 @@ "category": "building", "group": "stained_glass", "key": { - "#": { - "item": "minecraft:glass" - }, - "X": { - "item": "minecraft:pink_dye" - } + "#": "minecraft:glass", + "X": "minecraft:pink_dye" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/pink_stained_glass_pane.json b/data/minecraft/recipe/pink_stained_glass_pane.json index 51aefbf2..235bda58 100644 --- a/data/minecraft/recipe/pink_stained_glass_pane.json +++ b/data/minecraft/recipe/pink_stained_glass_pane.json @@ -3,9 +3,7 @@ "category": "misc", "group": "stained_glass_pane", "key": { - "#": { - "item": "minecraft:pink_stained_glass" - } + "#": "minecraft:pink_stained_glass" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/pink_stained_glass_pane_from_glass_pane.json b/data/minecraft/recipe/pink_stained_glass_pane_from_glass_pane.json index ac57a21a..14927823 100644 --- a/data/minecraft/recipe/pink_stained_glass_pane_from_glass_pane.json +++ b/data/minecraft/recipe/pink_stained_glass_pane_from_glass_pane.json @@ -3,12 +3,8 @@ "category": "misc", "group": "stained_glass_pane", "key": { - "#": { - "item": "minecraft:glass_pane" - }, - "$": { - "item": "minecraft:pink_dye" - } + "#": "minecraft:glass_pane", + "$": "minecraft:pink_dye" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/pink_terracotta.json b/data/minecraft/recipe/pink_terracotta.json index 942fad44..c72f6240 100644 --- a/data/minecraft/recipe/pink_terracotta.json +++ b/data/minecraft/recipe/pink_terracotta.json @@ -3,12 +3,8 @@ "category": "building", "group": "stained_terracotta", "key": { - "#": { - "item": "minecraft:terracotta" - }, - "X": { - "item": "minecraft:pink_dye" - } + "#": "minecraft:terracotta", + "X": "minecraft:pink_dye" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/piston.json b/data/minecraft/recipe/piston.json index 344dcedc..38d52962 100644 --- a/data/minecraft/recipe/piston.json +++ b/data/minecraft/recipe/piston.json @@ -2,18 +2,10 @@ "type": "minecraft:crafting_shaped", "category": "redstone", "key": { - "#": { - "item": "minecraft:cobblestone" - }, - "R": { - "item": "minecraft:redstone" - }, - "T": { - "tag": "minecraft:planks" - }, - "X": { - "item": "minecraft:iron_ingot" - } + "#": "minecraft:cobblestone", + "R": "minecraft:redstone", + "T": "#minecraft:planks", + "X": "minecraft:iron_ingot" }, "pattern": [ "TTT", diff --git a/data/minecraft/recipe/polished_andesite.json b/data/minecraft/recipe/polished_andesite.json index a42a7fe1..38a6b28d 100644 --- a/data/minecraft/recipe/polished_andesite.json +++ b/data/minecraft/recipe/polished_andesite.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "S": { - "item": "minecraft:andesite" - } + "S": "minecraft:andesite" }, "pattern": [ "SS", diff --git a/data/minecraft/recipe/polished_andesite_from_andesite_stonecutting.json b/data/minecraft/recipe/polished_andesite_from_andesite_stonecutting.json index b55e151d..b58bcc2c 100644 --- a/data/minecraft/recipe/polished_andesite_from_andesite_stonecutting.json +++ b/data/minecraft/recipe/polished_andesite_from_andesite_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:andesite" - }, + "ingredient": "minecraft:andesite", "result": { "count": 1, "id": "minecraft:polished_andesite" diff --git a/data/minecraft/recipe/polished_andesite_slab.json b/data/minecraft/recipe/polished_andesite_slab.json index b0df8270..fbd7ebe6 100644 --- a/data/minecraft/recipe/polished_andesite_slab.json +++ b/data/minecraft/recipe/polished_andesite_slab.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:polished_andesite" - } + "#": "minecraft:polished_andesite" }, "pattern": [ "###" diff --git a/data/minecraft/recipe/polished_andesite_slab_from_andesite_stonecutting.json b/data/minecraft/recipe/polished_andesite_slab_from_andesite_stonecutting.json index 618d18ab..a843726d 100644 --- a/data/minecraft/recipe/polished_andesite_slab_from_andesite_stonecutting.json +++ b/data/minecraft/recipe/polished_andesite_slab_from_andesite_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:andesite" - }, + "ingredient": "minecraft:andesite", "result": { "count": 2, "id": "minecraft:polished_andesite_slab" diff --git a/data/minecraft/recipe/polished_andesite_slab_from_polished_andesite_stonecutting.json b/data/minecraft/recipe/polished_andesite_slab_from_polished_andesite_stonecutting.json index 054e57d8..9331172e 100644 --- a/data/minecraft/recipe/polished_andesite_slab_from_polished_andesite_stonecutting.json +++ b/data/minecraft/recipe/polished_andesite_slab_from_polished_andesite_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:polished_andesite" - }, + "ingredient": "minecraft:polished_andesite", "result": { "count": 2, "id": "minecraft:polished_andesite_slab" diff --git a/data/minecraft/recipe/polished_andesite_stairs.json b/data/minecraft/recipe/polished_andesite_stairs.json index 11ef91c5..101def14 100644 --- a/data/minecraft/recipe/polished_andesite_stairs.json +++ b/data/minecraft/recipe/polished_andesite_stairs.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:polished_andesite" - } + "#": "minecraft:polished_andesite" }, "pattern": [ "# ", diff --git a/data/minecraft/recipe/polished_andesite_stairs_from_andesite_stonecutting.json b/data/minecraft/recipe/polished_andesite_stairs_from_andesite_stonecutting.json index a861458e..6fd76fd0 100644 --- a/data/minecraft/recipe/polished_andesite_stairs_from_andesite_stonecutting.json +++ b/data/minecraft/recipe/polished_andesite_stairs_from_andesite_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:andesite" - }, + "ingredient": "minecraft:andesite", "result": { "count": 1, "id": "minecraft:polished_andesite_stairs" diff --git a/data/minecraft/recipe/polished_andesite_stairs_from_polished_andesite_stonecutting.json b/data/minecraft/recipe/polished_andesite_stairs_from_polished_andesite_stonecutting.json index 4caa3fd4..919b2b1f 100644 --- a/data/minecraft/recipe/polished_andesite_stairs_from_polished_andesite_stonecutting.json +++ b/data/minecraft/recipe/polished_andesite_stairs_from_polished_andesite_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:polished_andesite" - }, + "ingredient": "minecraft:polished_andesite", "result": { "count": 1, "id": "minecraft:polished_andesite_stairs" diff --git a/data/minecraft/recipe/polished_basalt.json b/data/minecraft/recipe/polished_basalt.json index 5da8b1bb..97db5f25 100644 --- a/data/minecraft/recipe/polished_basalt.json +++ b/data/minecraft/recipe/polished_basalt.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "S": { - "item": "minecraft:basalt" - } + "S": "minecraft:basalt" }, "pattern": [ "SS", diff --git a/data/minecraft/recipe/polished_basalt_from_basalt_stonecutting.json b/data/minecraft/recipe/polished_basalt_from_basalt_stonecutting.json index 550d9534..81f99a88 100644 --- a/data/minecraft/recipe/polished_basalt_from_basalt_stonecutting.json +++ b/data/minecraft/recipe/polished_basalt_from_basalt_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:basalt" - }, + "ingredient": "minecraft:basalt", "result": { "count": 1, "id": "minecraft:polished_basalt" diff --git a/data/minecraft/recipe/polished_blackstone.json b/data/minecraft/recipe/polished_blackstone.json index 93610533..a55e7f08 100644 --- a/data/minecraft/recipe/polished_blackstone.json +++ b/data/minecraft/recipe/polished_blackstone.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "S": { - "item": "minecraft:blackstone" - } + "S": "minecraft:blackstone" }, "pattern": [ "SS", diff --git a/data/minecraft/recipe/polished_blackstone_brick_slab.json b/data/minecraft/recipe/polished_blackstone_brick_slab.json index 82f09e49..e4007231 100644 --- a/data/minecraft/recipe/polished_blackstone_brick_slab.json +++ b/data/minecraft/recipe/polished_blackstone_brick_slab.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:polished_blackstone_bricks" - } + "#": "minecraft:polished_blackstone_bricks" }, "pattern": [ "###" diff --git a/data/minecraft/recipe/polished_blackstone_brick_slab_from_blackstone_stonecutting.json b/data/minecraft/recipe/polished_blackstone_brick_slab_from_blackstone_stonecutting.json index a78c0cbb..a92231f8 100644 --- a/data/minecraft/recipe/polished_blackstone_brick_slab_from_blackstone_stonecutting.json +++ b/data/minecraft/recipe/polished_blackstone_brick_slab_from_blackstone_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:blackstone" - }, + "ingredient": "minecraft:blackstone", "result": { "count": 2, "id": "minecraft:polished_blackstone_brick_slab" diff --git a/data/minecraft/recipe/polished_blackstone_brick_slab_from_polished_blackstone_bricks_stonecutting.json b/data/minecraft/recipe/polished_blackstone_brick_slab_from_polished_blackstone_bricks_stonecutting.json index de1d6d23..96ef7798 100644 --- a/data/minecraft/recipe/polished_blackstone_brick_slab_from_polished_blackstone_bricks_stonecutting.json +++ b/data/minecraft/recipe/polished_blackstone_brick_slab_from_polished_blackstone_bricks_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:polished_blackstone_bricks" - }, + "ingredient": "minecraft:polished_blackstone_bricks", "result": { "count": 2, "id": "minecraft:polished_blackstone_brick_slab" diff --git a/data/minecraft/recipe/polished_blackstone_brick_slab_from_polished_blackstone_stonecutting.json b/data/minecraft/recipe/polished_blackstone_brick_slab_from_polished_blackstone_stonecutting.json index bc4aba35..0dc33f1d 100644 --- a/data/minecraft/recipe/polished_blackstone_brick_slab_from_polished_blackstone_stonecutting.json +++ b/data/minecraft/recipe/polished_blackstone_brick_slab_from_polished_blackstone_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:polished_blackstone" - }, + "ingredient": "minecraft:polished_blackstone", "result": { "count": 2, "id": "minecraft:polished_blackstone_brick_slab" diff --git a/data/minecraft/recipe/polished_blackstone_brick_stairs.json b/data/minecraft/recipe/polished_blackstone_brick_stairs.json index 41a80c7e..8d523c58 100644 --- a/data/minecraft/recipe/polished_blackstone_brick_stairs.json +++ b/data/minecraft/recipe/polished_blackstone_brick_stairs.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:polished_blackstone_bricks" - } + "#": "minecraft:polished_blackstone_bricks" }, "pattern": [ "# ", diff --git a/data/minecraft/recipe/polished_blackstone_brick_stairs_from_blackstone_stonecutting.json b/data/minecraft/recipe/polished_blackstone_brick_stairs_from_blackstone_stonecutting.json index 9f075c83..578debac 100644 --- a/data/minecraft/recipe/polished_blackstone_brick_stairs_from_blackstone_stonecutting.json +++ b/data/minecraft/recipe/polished_blackstone_brick_stairs_from_blackstone_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:blackstone" - }, + "ingredient": "minecraft:blackstone", "result": { "count": 1, "id": "minecraft:polished_blackstone_brick_stairs" diff --git a/data/minecraft/recipe/polished_blackstone_brick_stairs_from_polished_blackstone_bricks_stonecutting.json b/data/minecraft/recipe/polished_blackstone_brick_stairs_from_polished_blackstone_bricks_stonecutting.json index 19aa960c..fb7e92ca 100644 --- a/data/minecraft/recipe/polished_blackstone_brick_stairs_from_polished_blackstone_bricks_stonecutting.json +++ b/data/minecraft/recipe/polished_blackstone_brick_stairs_from_polished_blackstone_bricks_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:polished_blackstone_bricks" - }, + "ingredient": "minecraft:polished_blackstone_bricks", "result": { "count": 1, "id": "minecraft:polished_blackstone_brick_stairs" diff --git a/data/minecraft/recipe/polished_blackstone_brick_stairs_from_polished_blackstone_stonecutting.json b/data/minecraft/recipe/polished_blackstone_brick_stairs_from_polished_blackstone_stonecutting.json index 0a31755d..19175d1c 100644 --- a/data/minecraft/recipe/polished_blackstone_brick_stairs_from_polished_blackstone_stonecutting.json +++ b/data/minecraft/recipe/polished_blackstone_brick_stairs_from_polished_blackstone_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:polished_blackstone" - }, + "ingredient": "minecraft:polished_blackstone", "result": { "count": 1, "id": "minecraft:polished_blackstone_brick_stairs" diff --git a/data/minecraft/recipe/polished_blackstone_brick_wall.json b/data/minecraft/recipe/polished_blackstone_brick_wall.json index 8d2fa78a..41ff85de 100644 --- a/data/minecraft/recipe/polished_blackstone_brick_wall.json +++ b/data/minecraft/recipe/polished_blackstone_brick_wall.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "#": { - "item": "minecraft:polished_blackstone_bricks" - } + "#": "minecraft:polished_blackstone_bricks" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/polished_blackstone_brick_wall_from_blackstone_stonecutting.json b/data/minecraft/recipe/polished_blackstone_brick_wall_from_blackstone_stonecutting.json index 293beaa5..a766f87f 100644 --- a/data/minecraft/recipe/polished_blackstone_brick_wall_from_blackstone_stonecutting.json +++ b/data/minecraft/recipe/polished_blackstone_brick_wall_from_blackstone_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:blackstone" - }, + "ingredient": "minecraft:blackstone", "result": { "count": 1, "id": "minecraft:polished_blackstone_brick_wall" diff --git a/data/minecraft/recipe/polished_blackstone_brick_wall_from_polished_blackstone_bricks_stonecutting.json b/data/minecraft/recipe/polished_blackstone_brick_wall_from_polished_blackstone_bricks_stonecutting.json index fad519fe..42db67a7 100644 --- a/data/minecraft/recipe/polished_blackstone_brick_wall_from_polished_blackstone_bricks_stonecutting.json +++ b/data/minecraft/recipe/polished_blackstone_brick_wall_from_polished_blackstone_bricks_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:polished_blackstone_bricks" - }, + "ingredient": "minecraft:polished_blackstone_bricks", "result": { "count": 1, "id": "minecraft:polished_blackstone_brick_wall" diff --git a/data/minecraft/recipe/polished_blackstone_brick_wall_from_polished_blackstone_stonecutting.json b/data/minecraft/recipe/polished_blackstone_brick_wall_from_polished_blackstone_stonecutting.json index 5da029e8..31a1c529 100644 --- a/data/minecraft/recipe/polished_blackstone_brick_wall_from_polished_blackstone_stonecutting.json +++ b/data/minecraft/recipe/polished_blackstone_brick_wall_from_polished_blackstone_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:polished_blackstone" - }, + "ingredient": "minecraft:polished_blackstone", "result": { "count": 1, "id": "minecraft:polished_blackstone_brick_wall" diff --git a/data/minecraft/recipe/polished_blackstone_bricks.json b/data/minecraft/recipe/polished_blackstone_bricks.json index 826d1f98..eae47b53 100644 --- a/data/minecraft/recipe/polished_blackstone_bricks.json +++ b/data/minecraft/recipe/polished_blackstone_bricks.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "S": { - "item": "minecraft:polished_blackstone" - } + "S": "minecraft:polished_blackstone" }, "pattern": [ "SS", diff --git a/data/minecraft/recipe/polished_blackstone_bricks_from_blackstone_stonecutting.json b/data/minecraft/recipe/polished_blackstone_bricks_from_blackstone_stonecutting.json index 47d9e1db..a24a4203 100644 --- a/data/minecraft/recipe/polished_blackstone_bricks_from_blackstone_stonecutting.json +++ b/data/minecraft/recipe/polished_blackstone_bricks_from_blackstone_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:blackstone" - }, + "ingredient": "minecraft:blackstone", "result": { "count": 1, "id": "minecraft:polished_blackstone_bricks" diff --git a/data/minecraft/recipe/polished_blackstone_bricks_from_polished_blackstone_stonecutting.json b/data/minecraft/recipe/polished_blackstone_bricks_from_polished_blackstone_stonecutting.json index 56e8678e..f4643db4 100644 --- a/data/minecraft/recipe/polished_blackstone_bricks_from_polished_blackstone_stonecutting.json +++ b/data/minecraft/recipe/polished_blackstone_bricks_from_polished_blackstone_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:polished_blackstone" - }, + "ingredient": "minecraft:polished_blackstone", "result": { "count": 1, "id": "minecraft:polished_blackstone_bricks" diff --git a/data/minecraft/recipe/polished_blackstone_button.json b/data/minecraft/recipe/polished_blackstone_button.json index 4f065021..71fb8062 100644 --- a/data/minecraft/recipe/polished_blackstone_button.json +++ b/data/minecraft/recipe/polished_blackstone_button.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shapeless", "category": "redstone", "ingredients": [ - { - "item": "minecraft:polished_blackstone" - } + "minecraft:polished_blackstone" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/polished_blackstone_from_blackstone_stonecutting.json b/data/minecraft/recipe/polished_blackstone_from_blackstone_stonecutting.json index f1528a47..889ea886 100644 --- a/data/minecraft/recipe/polished_blackstone_from_blackstone_stonecutting.json +++ b/data/minecraft/recipe/polished_blackstone_from_blackstone_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:blackstone" - }, + "ingredient": "minecraft:blackstone", "result": { "count": 1, "id": "minecraft:polished_blackstone" diff --git a/data/minecraft/recipe/polished_blackstone_pressure_plate.json b/data/minecraft/recipe/polished_blackstone_pressure_plate.json index c4ecdd9a..a4f277c3 100644 --- a/data/minecraft/recipe/polished_blackstone_pressure_plate.json +++ b/data/minecraft/recipe/polished_blackstone_pressure_plate.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "redstone", "key": { - "#": { - "item": "minecraft:polished_blackstone" - } + "#": "minecraft:polished_blackstone" }, "pattern": [ "##" diff --git a/data/minecraft/recipe/polished_blackstone_slab.json b/data/minecraft/recipe/polished_blackstone_slab.json index 1b1b88b3..b491d691 100644 --- a/data/minecraft/recipe/polished_blackstone_slab.json +++ b/data/minecraft/recipe/polished_blackstone_slab.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:polished_blackstone" - } + "#": "minecraft:polished_blackstone" }, "pattern": [ "###" diff --git a/data/minecraft/recipe/polished_blackstone_slab_from_blackstone_stonecutting.json b/data/minecraft/recipe/polished_blackstone_slab_from_blackstone_stonecutting.json index 7911f422..8668e2d4 100644 --- a/data/minecraft/recipe/polished_blackstone_slab_from_blackstone_stonecutting.json +++ b/data/minecraft/recipe/polished_blackstone_slab_from_blackstone_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:blackstone" - }, + "ingredient": "minecraft:blackstone", "result": { "count": 2, "id": "minecraft:polished_blackstone_slab" diff --git a/data/minecraft/recipe/polished_blackstone_slab_from_polished_blackstone_stonecutting.json b/data/minecraft/recipe/polished_blackstone_slab_from_polished_blackstone_stonecutting.json index 09b14566..0ba84ac1 100644 --- a/data/minecraft/recipe/polished_blackstone_slab_from_polished_blackstone_stonecutting.json +++ b/data/minecraft/recipe/polished_blackstone_slab_from_polished_blackstone_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:polished_blackstone" - }, + "ingredient": "minecraft:polished_blackstone", "result": { "count": 2, "id": "minecraft:polished_blackstone_slab" diff --git a/data/minecraft/recipe/polished_blackstone_stairs.json b/data/minecraft/recipe/polished_blackstone_stairs.json index d9284d0a..ecb24692 100644 --- a/data/minecraft/recipe/polished_blackstone_stairs.json +++ b/data/minecraft/recipe/polished_blackstone_stairs.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:polished_blackstone" - } + "#": "minecraft:polished_blackstone" }, "pattern": [ "# ", diff --git a/data/minecraft/recipe/polished_blackstone_stairs_from_blackstone_stonecutting.json b/data/minecraft/recipe/polished_blackstone_stairs_from_blackstone_stonecutting.json index 9902df47..2382dfbc 100644 --- a/data/minecraft/recipe/polished_blackstone_stairs_from_blackstone_stonecutting.json +++ b/data/minecraft/recipe/polished_blackstone_stairs_from_blackstone_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:blackstone" - }, + "ingredient": "minecraft:blackstone", "result": { "count": 1, "id": "minecraft:polished_blackstone_stairs" diff --git a/data/minecraft/recipe/polished_blackstone_stairs_from_polished_blackstone_stonecutting.json b/data/minecraft/recipe/polished_blackstone_stairs_from_polished_blackstone_stonecutting.json index 215dc98b..d2a7829f 100644 --- a/data/minecraft/recipe/polished_blackstone_stairs_from_polished_blackstone_stonecutting.json +++ b/data/minecraft/recipe/polished_blackstone_stairs_from_polished_blackstone_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:polished_blackstone" - }, + "ingredient": "minecraft:polished_blackstone", "result": { "count": 1, "id": "minecraft:polished_blackstone_stairs" diff --git a/data/minecraft/recipe/polished_blackstone_wall.json b/data/minecraft/recipe/polished_blackstone_wall.json index ae15cfa5..91b0684b 100644 --- a/data/minecraft/recipe/polished_blackstone_wall.json +++ b/data/minecraft/recipe/polished_blackstone_wall.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "#": { - "item": "minecraft:polished_blackstone" - } + "#": "minecraft:polished_blackstone" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/polished_blackstone_wall_from_blackstone_stonecutting.json b/data/minecraft/recipe/polished_blackstone_wall_from_blackstone_stonecutting.json index 77294a3b..2eee0fa2 100644 --- a/data/minecraft/recipe/polished_blackstone_wall_from_blackstone_stonecutting.json +++ b/data/minecraft/recipe/polished_blackstone_wall_from_blackstone_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:blackstone" - }, + "ingredient": "minecraft:blackstone", "result": { "count": 1, "id": "minecraft:polished_blackstone_wall" diff --git a/data/minecraft/recipe/polished_blackstone_wall_from_polished_blackstone_stonecutting.json b/data/minecraft/recipe/polished_blackstone_wall_from_polished_blackstone_stonecutting.json index 332318ad..0363b2bc 100644 --- a/data/minecraft/recipe/polished_blackstone_wall_from_polished_blackstone_stonecutting.json +++ b/data/minecraft/recipe/polished_blackstone_wall_from_polished_blackstone_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:polished_blackstone" - }, + "ingredient": "minecraft:polished_blackstone", "result": { "count": 1, "id": "minecraft:polished_blackstone_wall" diff --git a/data/minecraft/recipe/polished_deepslate.json b/data/minecraft/recipe/polished_deepslate.json index 45449199..bc6a2367 100644 --- a/data/minecraft/recipe/polished_deepslate.json +++ b/data/minecraft/recipe/polished_deepslate.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "S": { - "item": "minecraft:cobbled_deepslate" - } + "S": "minecraft:cobbled_deepslate" }, "pattern": [ "SS", diff --git a/data/minecraft/recipe/polished_deepslate_from_cobbled_deepslate_stonecutting.json b/data/minecraft/recipe/polished_deepslate_from_cobbled_deepslate_stonecutting.json index 3a26ce6e..1571226b 100644 --- a/data/minecraft/recipe/polished_deepslate_from_cobbled_deepslate_stonecutting.json +++ b/data/minecraft/recipe/polished_deepslate_from_cobbled_deepslate_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:cobbled_deepslate" - }, + "ingredient": "minecraft:cobbled_deepslate", "result": { "count": 1, "id": "minecraft:polished_deepslate" diff --git a/data/minecraft/recipe/polished_deepslate_slab.json b/data/minecraft/recipe/polished_deepslate_slab.json index d1f4ece1..cea0c023 100644 --- a/data/minecraft/recipe/polished_deepslate_slab.json +++ b/data/minecraft/recipe/polished_deepslate_slab.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:polished_deepslate" - } + "#": "minecraft:polished_deepslate" }, "pattern": [ "###" diff --git a/data/minecraft/recipe/polished_deepslate_slab_from_cobbled_deepslate_stonecutting.json b/data/minecraft/recipe/polished_deepslate_slab_from_cobbled_deepslate_stonecutting.json index a73cf719..10344a9a 100644 --- a/data/minecraft/recipe/polished_deepslate_slab_from_cobbled_deepslate_stonecutting.json +++ b/data/minecraft/recipe/polished_deepslate_slab_from_cobbled_deepslate_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:cobbled_deepslate" - }, + "ingredient": "minecraft:cobbled_deepslate", "result": { "count": 2, "id": "minecraft:polished_deepslate_slab" diff --git a/data/minecraft/recipe/polished_deepslate_slab_from_polished_deepslate_stonecutting.json b/data/minecraft/recipe/polished_deepslate_slab_from_polished_deepslate_stonecutting.json index 8f33a41c..61a5826b 100644 --- a/data/minecraft/recipe/polished_deepslate_slab_from_polished_deepslate_stonecutting.json +++ b/data/minecraft/recipe/polished_deepslate_slab_from_polished_deepslate_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:polished_deepslate" - }, + "ingredient": "minecraft:polished_deepslate", "result": { "count": 2, "id": "minecraft:polished_deepslate_slab" diff --git a/data/minecraft/recipe/polished_deepslate_stairs.json b/data/minecraft/recipe/polished_deepslate_stairs.json index 54244fe7..c2d15f0f 100644 --- a/data/minecraft/recipe/polished_deepslate_stairs.json +++ b/data/minecraft/recipe/polished_deepslate_stairs.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:polished_deepslate" - } + "#": "minecraft:polished_deepslate" }, "pattern": [ "# ", diff --git a/data/minecraft/recipe/polished_deepslate_stairs_from_cobbled_deepslate_stonecutting.json b/data/minecraft/recipe/polished_deepslate_stairs_from_cobbled_deepslate_stonecutting.json index 891d3141..1c5fed60 100644 --- a/data/minecraft/recipe/polished_deepslate_stairs_from_cobbled_deepslate_stonecutting.json +++ b/data/minecraft/recipe/polished_deepslate_stairs_from_cobbled_deepslate_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:cobbled_deepslate" - }, + "ingredient": "minecraft:cobbled_deepslate", "result": { "count": 1, "id": "minecraft:polished_deepslate_stairs" diff --git a/data/minecraft/recipe/polished_deepslate_stairs_from_polished_deepslate_stonecutting.json b/data/minecraft/recipe/polished_deepslate_stairs_from_polished_deepslate_stonecutting.json index 5e32210e..2c054a60 100644 --- a/data/minecraft/recipe/polished_deepslate_stairs_from_polished_deepslate_stonecutting.json +++ b/data/minecraft/recipe/polished_deepslate_stairs_from_polished_deepslate_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:polished_deepslate" - }, + "ingredient": "minecraft:polished_deepslate", "result": { "count": 1, "id": "minecraft:polished_deepslate_stairs" diff --git a/data/minecraft/recipe/polished_deepslate_wall.json b/data/minecraft/recipe/polished_deepslate_wall.json index b9260a87..0f7f394a 100644 --- a/data/minecraft/recipe/polished_deepslate_wall.json +++ b/data/minecraft/recipe/polished_deepslate_wall.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "#": { - "item": "minecraft:polished_deepslate" - } + "#": "minecraft:polished_deepslate" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/polished_deepslate_wall_from_cobbled_deepslate_stonecutting.json b/data/minecraft/recipe/polished_deepslate_wall_from_cobbled_deepslate_stonecutting.json index 371a2ea6..8ec6dfdc 100644 --- a/data/minecraft/recipe/polished_deepslate_wall_from_cobbled_deepslate_stonecutting.json +++ b/data/minecraft/recipe/polished_deepslate_wall_from_cobbled_deepslate_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:cobbled_deepslate" - }, + "ingredient": "minecraft:cobbled_deepslate", "result": { "count": 1, "id": "minecraft:polished_deepslate_wall" diff --git a/data/minecraft/recipe/polished_deepslate_wall_from_polished_deepslate_stonecutting.json b/data/minecraft/recipe/polished_deepslate_wall_from_polished_deepslate_stonecutting.json index 98a39b8f..15b41f40 100644 --- a/data/minecraft/recipe/polished_deepslate_wall_from_polished_deepslate_stonecutting.json +++ b/data/minecraft/recipe/polished_deepslate_wall_from_polished_deepslate_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:polished_deepslate" - }, + "ingredient": "minecraft:polished_deepslate", "result": { "count": 1, "id": "minecraft:polished_deepslate_wall" diff --git a/data/minecraft/recipe/polished_diorite.json b/data/minecraft/recipe/polished_diorite.json index ea1f2ba4..c9322e9a 100644 --- a/data/minecraft/recipe/polished_diorite.json +++ b/data/minecraft/recipe/polished_diorite.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "S": { - "item": "minecraft:diorite" - } + "S": "minecraft:diorite" }, "pattern": [ "SS", diff --git a/data/minecraft/recipe/polished_diorite_from_diorite_stonecutting.json b/data/minecraft/recipe/polished_diorite_from_diorite_stonecutting.json index d9eb266f..919330b4 100644 --- a/data/minecraft/recipe/polished_diorite_from_diorite_stonecutting.json +++ b/data/minecraft/recipe/polished_diorite_from_diorite_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:diorite" - }, + "ingredient": "minecraft:diorite", "result": { "count": 1, "id": "minecraft:polished_diorite" diff --git a/data/minecraft/recipe/polished_diorite_slab.json b/data/minecraft/recipe/polished_diorite_slab.json index 6669c741..bdf849d0 100644 --- a/data/minecraft/recipe/polished_diorite_slab.json +++ b/data/minecraft/recipe/polished_diorite_slab.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:polished_diorite" - } + "#": "minecraft:polished_diorite" }, "pattern": [ "###" diff --git a/data/minecraft/recipe/polished_diorite_slab_from_diorite_stonecutting.json b/data/minecraft/recipe/polished_diorite_slab_from_diorite_stonecutting.json index 51f52d94..c8fe760c 100644 --- a/data/minecraft/recipe/polished_diorite_slab_from_diorite_stonecutting.json +++ b/data/minecraft/recipe/polished_diorite_slab_from_diorite_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:diorite" - }, + "ingredient": "minecraft:diorite", "result": { "count": 2, "id": "minecraft:polished_diorite_slab" diff --git a/data/minecraft/recipe/polished_diorite_slab_from_polished_diorite_stonecutting.json b/data/minecraft/recipe/polished_diorite_slab_from_polished_diorite_stonecutting.json index 27a5cec1..b9564eb5 100644 --- a/data/minecraft/recipe/polished_diorite_slab_from_polished_diorite_stonecutting.json +++ b/data/minecraft/recipe/polished_diorite_slab_from_polished_diorite_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:polished_diorite" - }, + "ingredient": "minecraft:polished_diorite", "result": { "count": 2, "id": "minecraft:polished_diorite_slab" diff --git a/data/minecraft/recipe/polished_diorite_stairs.json b/data/minecraft/recipe/polished_diorite_stairs.json index 73be0400..1a5a0748 100644 --- a/data/minecraft/recipe/polished_diorite_stairs.json +++ b/data/minecraft/recipe/polished_diorite_stairs.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:polished_diorite" - } + "#": "minecraft:polished_diorite" }, "pattern": [ "# ", diff --git a/data/minecraft/recipe/polished_diorite_stairs_from_diorite_stonecutting.json b/data/minecraft/recipe/polished_diorite_stairs_from_diorite_stonecutting.json index 8c2fc3f8..58b90166 100644 --- a/data/minecraft/recipe/polished_diorite_stairs_from_diorite_stonecutting.json +++ b/data/minecraft/recipe/polished_diorite_stairs_from_diorite_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:diorite" - }, + "ingredient": "minecraft:diorite", "result": { "count": 1, "id": "minecraft:polished_diorite_stairs" diff --git a/data/minecraft/recipe/polished_diorite_stairs_from_polished_diorite_stonecutting.json b/data/minecraft/recipe/polished_diorite_stairs_from_polished_diorite_stonecutting.json index 67f548b6..7cfe7c88 100644 --- a/data/minecraft/recipe/polished_diorite_stairs_from_polished_diorite_stonecutting.json +++ b/data/minecraft/recipe/polished_diorite_stairs_from_polished_diorite_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:polished_diorite" - }, + "ingredient": "minecraft:polished_diorite", "result": { "count": 1, "id": "minecraft:polished_diorite_stairs" diff --git a/data/minecraft/recipe/polished_granite.json b/data/minecraft/recipe/polished_granite.json index 09b4dd99..01148e11 100644 --- a/data/minecraft/recipe/polished_granite.json +++ b/data/minecraft/recipe/polished_granite.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "S": { - "item": "minecraft:granite" - } + "S": "minecraft:granite" }, "pattern": [ "SS", diff --git a/data/minecraft/recipe/polished_granite_from_granite_stonecutting.json b/data/minecraft/recipe/polished_granite_from_granite_stonecutting.json index 6e7a751f..fd886435 100644 --- a/data/minecraft/recipe/polished_granite_from_granite_stonecutting.json +++ b/data/minecraft/recipe/polished_granite_from_granite_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:granite" - }, + "ingredient": "minecraft:granite", "result": { "count": 1, "id": "minecraft:polished_granite" diff --git a/data/minecraft/recipe/polished_granite_slab.json b/data/minecraft/recipe/polished_granite_slab.json index 3c130c54..5ca500f6 100644 --- a/data/minecraft/recipe/polished_granite_slab.json +++ b/data/minecraft/recipe/polished_granite_slab.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:polished_granite" - } + "#": "minecraft:polished_granite" }, "pattern": [ "###" diff --git a/data/minecraft/recipe/polished_granite_slab_from_granite_stonecutting.json b/data/minecraft/recipe/polished_granite_slab_from_granite_stonecutting.json index d8aa01b6..05aab260 100644 --- a/data/minecraft/recipe/polished_granite_slab_from_granite_stonecutting.json +++ b/data/minecraft/recipe/polished_granite_slab_from_granite_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:granite" - }, + "ingredient": "minecraft:granite", "result": { "count": 2, "id": "minecraft:polished_granite_slab" diff --git a/data/minecraft/recipe/polished_granite_slab_from_polished_granite_stonecutting.json b/data/minecraft/recipe/polished_granite_slab_from_polished_granite_stonecutting.json index a0c39f79..81a606d2 100644 --- a/data/minecraft/recipe/polished_granite_slab_from_polished_granite_stonecutting.json +++ b/data/minecraft/recipe/polished_granite_slab_from_polished_granite_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:polished_granite" - }, + "ingredient": "minecraft:polished_granite", "result": { "count": 2, "id": "minecraft:polished_granite_slab" diff --git a/data/minecraft/recipe/polished_granite_stairs.json b/data/minecraft/recipe/polished_granite_stairs.json index 8abed9b1..0fe57435 100644 --- a/data/minecraft/recipe/polished_granite_stairs.json +++ b/data/minecraft/recipe/polished_granite_stairs.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:polished_granite" - } + "#": "minecraft:polished_granite" }, "pattern": [ "# ", diff --git a/data/minecraft/recipe/polished_granite_stairs_from_granite_stonecutting.json b/data/minecraft/recipe/polished_granite_stairs_from_granite_stonecutting.json index 0bc3fbaf..7c6f06ae 100644 --- a/data/minecraft/recipe/polished_granite_stairs_from_granite_stonecutting.json +++ b/data/minecraft/recipe/polished_granite_stairs_from_granite_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:granite" - }, + "ingredient": "minecraft:granite", "result": { "count": 1, "id": "minecraft:polished_granite_stairs" diff --git a/data/minecraft/recipe/polished_granite_stairs_from_polished_granite_stonecutting.json b/data/minecraft/recipe/polished_granite_stairs_from_polished_granite_stonecutting.json index c33b8177..8e02951c 100644 --- a/data/minecraft/recipe/polished_granite_stairs_from_polished_granite_stonecutting.json +++ b/data/minecraft/recipe/polished_granite_stairs_from_polished_granite_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:polished_granite" - }, + "ingredient": "minecraft:polished_granite", "result": { "count": 1, "id": "minecraft:polished_granite_stairs" diff --git a/data/minecraft/recipe/polished_tuff.json b/data/minecraft/recipe/polished_tuff.json index bbc9c60f..1c54af6a 100644 --- a/data/minecraft/recipe/polished_tuff.json +++ b/data/minecraft/recipe/polished_tuff.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "S": { - "item": "minecraft:tuff" - } + "S": "minecraft:tuff" }, "pattern": [ "SS", diff --git a/data/minecraft/recipe/polished_tuff_from_tuff_stonecutting.json b/data/minecraft/recipe/polished_tuff_from_tuff_stonecutting.json index 2d37b14d..cb8b7cd5 100644 --- a/data/minecraft/recipe/polished_tuff_from_tuff_stonecutting.json +++ b/data/minecraft/recipe/polished_tuff_from_tuff_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:tuff" - }, + "ingredient": "minecraft:tuff", "result": { "count": 1, "id": "minecraft:polished_tuff" diff --git a/data/minecraft/recipe/polished_tuff_slab.json b/data/minecraft/recipe/polished_tuff_slab.json index 4ac967e3..ba95b194 100644 --- a/data/minecraft/recipe/polished_tuff_slab.json +++ b/data/minecraft/recipe/polished_tuff_slab.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:polished_tuff" - } + "#": "minecraft:polished_tuff" }, "pattern": [ "###" diff --git a/data/minecraft/recipe/polished_tuff_slab_from_polished_tuff_stonecutting.json b/data/minecraft/recipe/polished_tuff_slab_from_polished_tuff_stonecutting.json index 1c99b3ff..b8ae0df2 100644 --- a/data/minecraft/recipe/polished_tuff_slab_from_polished_tuff_stonecutting.json +++ b/data/minecraft/recipe/polished_tuff_slab_from_polished_tuff_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:polished_tuff" - }, + "ingredient": "minecraft:polished_tuff", "result": { "count": 2, "id": "minecraft:polished_tuff_slab" diff --git a/data/minecraft/recipe/polished_tuff_slab_from_tuff_stonecutting.json b/data/minecraft/recipe/polished_tuff_slab_from_tuff_stonecutting.json index bd746a4a..b9c0f38c 100644 --- a/data/minecraft/recipe/polished_tuff_slab_from_tuff_stonecutting.json +++ b/data/minecraft/recipe/polished_tuff_slab_from_tuff_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:tuff" - }, + "ingredient": "minecraft:tuff", "result": { "count": 2, "id": "minecraft:polished_tuff_slab" diff --git a/data/minecraft/recipe/polished_tuff_stairs.json b/data/minecraft/recipe/polished_tuff_stairs.json index f27f854b..214b0fb7 100644 --- a/data/minecraft/recipe/polished_tuff_stairs.json +++ b/data/minecraft/recipe/polished_tuff_stairs.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:polished_tuff" - } + "#": "minecraft:polished_tuff" }, "pattern": [ "# ", diff --git a/data/minecraft/recipe/polished_tuff_stairs_from_polished_tuff_stonecutting.json b/data/minecraft/recipe/polished_tuff_stairs_from_polished_tuff_stonecutting.json index 5e5297ee..69782626 100644 --- a/data/minecraft/recipe/polished_tuff_stairs_from_polished_tuff_stonecutting.json +++ b/data/minecraft/recipe/polished_tuff_stairs_from_polished_tuff_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:polished_tuff" - }, + "ingredient": "minecraft:polished_tuff", "result": { "count": 1, "id": "minecraft:polished_tuff_stairs" diff --git a/data/minecraft/recipe/polished_tuff_stairs_from_tuff_stonecutting.json b/data/minecraft/recipe/polished_tuff_stairs_from_tuff_stonecutting.json index ad98d4f7..b9593809 100644 --- a/data/minecraft/recipe/polished_tuff_stairs_from_tuff_stonecutting.json +++ b/data/minecraft/recipe/polished_tuff_stairs_from_tuff_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:tuff" - }, + "ingredient": "minecraft:tuff", "result": { "count": 1, "id": "minecraft:polished_tuff_stairs" diff --git a/data/minecraft/recipe/polished_tuff_wall.json b/data/minecraft/recipe/polished_tuff_wall.json index 15f98fae..be4b9bff 100644 --- a/data/minecraft/recipe/polished_tuff_wall.json +++ b/data/minecraft/recipe/polished_tuff_wall.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "#": { - "item": "minecraft:polished_tuff" - } + "#": "minecraft:polished_tuff" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/polished_tuff_wall_from_polished_tuff_stonecutting.json b/data/minecraft/recipe/polished_tuff_wall_from_polished_tuff_stonecutting.json index 6f179470..23ac6dcf 100644 --- a/data/minecraft/recipe/polished_tuff_wall_from_polished_tuff_stonecutting.json +++ b/data/minecraft/recipe/polished_tuff_wall_from_polished_tuff_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:polished_tuff" - }, + "ingredient": "minecraft:polished_tuff", "result": { "count": 1, "id": "minecraft:polished_tuff_wall" diff --git a/data/minecraft/recipe/polished_tuff_wall_from_tuff_stonecutting.json b/data/minecraft/recipe/polished_tuff_wall_from_tuff_stonecutting.json index 3a2e5338..854a64a9 100644 --- a/data/minecraft/recipe/polished_tuff_wall_from_tuff_stonecutting.json +++ b/data/minecraft/recipe/polished_tuff_wall_from_tuff_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:tuff" - }, + "ingredient": "minecraft:tuff", "result": { "count": 1, "id": "minecraft:polished_tuff_wall" diff --git a/data/minecraft/recipe/popped_chorus_fruit.json b/data/minecraft/recipe/popped_chorus_fruit.json index ec043bcf..01524b06 100644 --- a/data/minecraft/recipe/popped_chorus_fruit.json +++ b/data/minecraft/recipe/popped_chorus_fruit.json @@ -3,9 +3,7 @@ "category": "misc", "cookingtime": 200, "experience": 0.1, - "ingredient": { - "item": "minecraft:chorus_fruit" - }, + "ingredient": "minecraft:chorus_fruit", "result": { "id": "minecraft:popped_chorus_fruit" } diff --git a/data/minecraft/recipe/powered_rail.json b/data/minecraft/recipe/powered_rail.json index eb53d700..91330259 100644 --- a/data/minecraft/recipe/powered_rail.json +++ b/data/minecraft/recipe/powered_rail.json @@ -2,15 +2,9 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "#": { - "item": "minecraft:stick" - }, - "R": { - "item": "minecraft:redstone" - }, - "X": { - "item": "minecraft:gold_ingot" - } + "#": "minecraft:stick", + "R": "minecraft:redstone", + "X": "minecraft:gold_ingot" }, "pattern": [ "X X", diff --git a/data/minecraft/recipe/prismarine.json b/data/minecraft/recipe/prismarine.json index acebd914..4da8f711 100644 --- a/data/minecraft/recipe/prismarine.json +++ b/data/minecraft/recipe/prismarine.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:prismarine_shard" - } + "#": "minecraft:prismarine_shard" }, "pattern": [ "##", diff --git a/data/minecraft/recipe/prismarine_brick_slab.json b/data/minecraft/recipe/prismarine_brick_slab.json index 896d9d5f..2073653b 100644 --- a/data/minecraft/recipe/prismarine_brick_slab.json +++ b/data/minecraft/recipe/prismarine_brick_slab.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:prismarine_bricks" - } + "#": "minecraft:prismarine_bricks" }, "pattern": [ "###" diff --git a/data/minecraft/recipe/prismarine_brick_slab_from_prismarine_stonecutting.json b/data/minecraft/recipe/prismarine_brick_slab_from_prismarine_stonecutting.json index cf6cfc2b..01912408 100644 --- a/data/minecraft/recipe/prismarine_brick_slab_from_prismarine_stonecutting.json +++ b/data/minecraft/recipe/prismarine_brick_slab_from_prismarine_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:prismarine_bricks" - }, + "ingredient": "minecraft:prismarine_bricks", "result": { "count": 2, "id": "minecraft:prismarine_brick_slab" diff --git a/data/minecraft/recipe/prismarine_brick_stairs.json b/data/minecraft/recipe/prismarine_brick_stairs.json index 2be6b898..4ad3edb8 100644 --- a/data/minecraft/recipe/prismarine_brick_stairs.json +++ b/data/minecraft/recipe/prismarine_brick_stairs.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:prismarine_bricks" - } + "#": "minecraft:prismarine_bricks" }, "pattern": [ "# ", diff --git a/data/minecraft/recipe/prismarine_brick_stairs_from_prismarine_stonecutting.json b/data/minecraft/recipe/prismarine_brick_stairs_from_prismarine_stonecutting.json index 447d843a..cb07f885 100644 --- a/data/minecraft/recipe/prismarine_brick_stairs_from_prismarine_stonecutting.json +++ b/data/minecraft/recipe/prismarine_brick_stairs_from_prismarine_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:prismarine_bricks" - }, + "ingredient": "minecraft:prismarine_bricks", "result": { "count": 1, "id": "minecraft:prismarine_brick_stairs" diff --git a/data/minecraft/recipe/prismarine_bricks.json b/data/minecraft/recipe/prismarine_bricks.json index e11198a5..f4a7a111 100644 --- a/data/minecraft/recipe/prismarine_bricks.json +++ b/data/minecraft/recipe/prismarine_bricks.json @@ -2,33 +2,15 @@ "type": "minecraft:crafting_shapeless", "category": "building", "ingredients": [ - { - "item": "minecraft:prismarine_shard" - }, - { - "item": "minecraft:prismarine_shard" - }, - { - "item": "minecraft:prismarine_shard" - }, - { - "item": "minecraft:prismarine_shard" - }, - { - "item": "minecraft:prismarine_shard" - }, - { - "item": "minecraft:prismarine_shard" - }, - { - "item": "minecraft:prismarine_shard" - }, - { - "item": "minecraft:prismarine_shard" - }, - { - "item": "minecraft:prismarine_shard" - } + "minecraft:prismarine_shard", + "minecraft:prismarine_shard", + "minecraft:prismarine_shard", + "minecraft:prismarine_shard", + "minecraft:prismarine_shard", + "minecraft:prismarine_shard", + "minecraft:prismarine_shard", + "minecraft:prismarine_shard", + "minecraft:prismarine_shard" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/prismarine_slab.json b/data/minecraft/recipe/prismarine_slab.json index 4969ffe0..67584b85 100644 --- a/data/minecraft/recipe/prismarine_slab.json +++ b/data/minecraft/recipe/prismarine_slab.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:prismarine" - } + "#": "minecraft:prismarine" }, "pattern": [ "###" diff --git a/data/minecraft/recipe/prismarine_slab_from_prismarine_stonecutting.json b/data/minecraft/recipe/prismarine_slab_from_prismarine_stonecutting.json index a0d9acad..0087e234 100644 --- a/data/minecraft/recipe/prismarine_slab_from_prismarine_stonecutting.json +++ b/data/minecraft/recipe/prismarine_slab_from_prismarine_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:prismarine" - }, + "ingredient": "minecraft:prismarine", "result": { "count": 2, "id": "minecraft:prismarine_slab" diff --git a/data/minecraft/recipe/prismarine_stairs.json b/data/minecraft/recipe/prismarine_stairs.json index 5b9b6128..653edc4c 100644 --- a/data/minecraft/recipe/prismarine_stairs.json +++ b/data/minecraft/recipe/prismarine_stairs.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:prismarine" - } + "#": "minecraft:prismarine" }, "pattern": [ "# ", diff --git a/data/minecraft/recipe/prismarine_stairs_from_prismarine_stonecutting.json b/data/minecraft/recipe/prismarine_stairs_from_prismarine_stonecutting.json index 4127ebe9..dcf35d7d 100644 --- a/data/minecraft/recipe/prismarine_stairs_from_prismarine_stonecutting.json +++ b/data/minecraft/recipe/prismarine_stairs_from_prismarine_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:prismarine" - }, + "ingredient": "minecraft:prismarine", "result": { "count": 1, "id": "minecraft:prismarine_stairs" diff --git a/data/minecraft/recipe/prismarine_wall.json b/data/minecraft/recipe/prismarine_wall.json index 6712d7de..7bf904e1 100644 --- a/data/minecraft/recipe/prismarine_wall.json +++ b/data/minecraft/recipe/prismarine_wall.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "#": { - "item": "minecraft:prismarine" - } + "#": "minecraft:prismarine" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/prismarine_wall_from_prismarine_stonecutting.json b/data/minecraft/recipe/prismarine_wall_from_prismarine_stonecutting.json index 503e3c8e..41fead5e 100644 --- a/data/minecraft/recipe/prismarine_wall_from_prismarine_stonecutting.json +++ b/data/minecraft/recipe/prismarine_wall_from_prismarine_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:prismarine" - }, + "ingredient": "minecraft:prismarine", "result": { "count": 1, "id": "minecraft:prismarine_wall" diff --git a/data/minecraft/recipe/pumpkin_pie.json b/data/minecraft/recipe/pumpkin_pie.json index b7ad3776..2f1064c4 100644 --- a/data/minecraft/recipe/pumpkin_pie.json +++ b/data/minecraft/recipe/pumpkin_pie.json @@ -2,15 +2,9 @@ "type": "minecraft:crafting_shapeless", "category": "misc", "ingredients": [ - { - "item": "minecraft:pumpkin" - }, - { - "item": "minecraft:sugar" - }, - { - "item": "minecraft:egg" - } + "minecraft:pumpkin", + "minecraft:sugar", + "minecraft:egg" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/pumpkin_seeds.json b/data/minecraft/recipe/pumpkin_seeds.json index 5fc91e8d..236a4c63 100644 --- a/data/minecraft/recipe/pumpkin_seeds.json +++ b/data/minecraft/recipe/pumpkin_seeds.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shapeless", "category": "misc", "ingredients": [ - { - "item": "minecraft:pumpkin" - } + "minecraft:pumpkin" ], "result": { "count": 4, diff --git a/data/minecraft/recipe/purple_banner.json b/data/minecraft/recipe/purple_banner.json index e2dfb3f6..506813c7 100644 --- a/data/minecraft/recipe/purple_banner.json +++ b/data/minecraft/recipe/purple_banner.json @@ -3,12 +3,8 @@ "category": "misc", "group": "banner", "key": { - "#": { - "item": "minecraft:purple_wool" - }, - "|": { - "item": "minecraft:stick" - } + "#": "minecraft:purple_wool", + "|": "minecraft:stick" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/purple_bed.json b/data/minecraft/recipe/purple_bed.json index 8c3a311b..cff24f70 100644 --- a/data/minecraft/recipe/purple_bed.json +++ b/data/minecraft/recipe/purple_bed.json @@ -3,12 +3,8 @@ "category": "misc", "group": "bed", "key": { - "#": { - "item": "minecraft:purple_wool" - }, - "X": { - "tag": "minecraft:planks" - } + "#": "minecraft:purple_wool", + "X": "#minecraft:planks" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/purple_bundle.json b/data/minecraft/recipe/purple_bundle.json new file mode 100644 index 00000000..41875b1e --- /dev/null +++ b/data/minecraft/recipe/purple_bundle.json @@ -0,0 +1,8 @@ +{ + "type": "minecraft:crafting_transmute", + "category": "equipment", + "group": "bundle_dye", + "input": "#minecraft:bundles", + "material": "minecraft:purple_dye", + "result": "minecraft:purple_bundle" +} \ No newline at end of file diff --git a/data/minecraft/recipe/purple_candle.json b/data/minecraft/recipe/purple_candle.json index efbed25f..176b833c 100644 --- a/data/minecraft/recipe/purple_candle.json +++ b/data/minecraft/recipe/purple_candle.json @@ -3,12 +3,8 @@ "category": "misc", "group": "dyed_candle", "ingredients": [ - { - "item": "minecraft:candle" - }, - { - "item": "minecraft:purple_dye" - } + "minecraft:candle", + "minecraft:purple_dye" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/purple_carpet.json b/data/minecraft/recipe/purple_carpet.json index 1f5962ad..7dc7735c 100644 --- a/data/minecraft/recipe/purple_carpet.json +++ b/data/minecraft/recipe/purple_carpet.json @@ -3,9 +3,7 @@ "category": "misc", "group": "carpet", "key": { - "#": { - "item": "minecraft:purple_wool" - } + "#": "minecraft:purple_wool" }, "pattern": [ "##" diff --git a/data/minecraft/recipe/purple_concrete_powder.json b/data/minecraft/recipe/purple_concrete_powder.json index e044c3b9..29bfc094 100644 --- a/data/minecraft/recipe/purple_concrete_powder.json +++ b/data/minecraft/recipe/purple_concrete_powder.json @@ -3,33 +3,15 @@ "category": "building", "group": "concrete_powder", "ingredients": [ - { - "item": "minecraft:purple_dye" - }, - { - "item": "minecraft:sand" - }, - { - "item": "minecraft:sand" - }, - { - "item": "minecraft:sand" - }, - { - "item": "minecraft:sand" - }, - { - "item": "minecraft:gravel" - }, - { - "item": "minecraft:gravel" - }, - { - "item": "minecraft:gravel" - }, - { - "item": "minecraft:gravel" - } + "minecraft:purple_dye", + "minecraft:sand", + "minecraft:sand", + "minecraft:sand", + "minecraft:sand", + "minecraft:gravel", + "minecraft:gravel", + "minecraft:gravel", + "minecraft:gravel" ], "result": { "count": 8, diff --git a/data/minecraft/recipe/purple_dye.json b/data/minecraft/recipe/purple_dye.json index ff658287..555b7d1e 100644 --- a/data/minecraft/recipe/purple_dye.json +++ b/data/minecraft/recipe/purple_dye.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shapeless", "category": "misc", "ingredients": [ - { - "item": "minecraft:blue_dye" - }, - { - "item": "minecraft:red_dye" - } + "minecraft:blue_dye", + "minecraft:red_dye" ], "result": { "count": 2, diff --git a/data/minecraft/recipe/purple_glazed_terracotta.json b/data/minecraft/recipe/purple_glazed_terracotta.json index da71ab71..68893d49 100644 --- a/data/minecraft/recipe/purple_glazed_terracotta.json +++ b/data/minecraft/recipe/purple_glazed_terracotta.json @@ -3,9 +3,7 @@ "category": "blocks", "cookingtime": 200, "experience": 0.1, - "ingredient": { - "item": "minecraft:purple_terracotta" - }, + "ingredient": "minecraft:purple_terracotta", "result": { "id": "minecraft:purple_glazed_terracotta" } diff --git a/data/minecraft/recipe/purple_shulker_box.json b/data/minecraft/recipe/purple_shulker_box.json new file mode 100644 index 00000000..1fdcc2af --- /dev/null +++ b/data/minecraft/recipe/purple_shulker_box.json @@ -0,0 +1,8 @@ +{ + "type": "minecraft:crafting_transmute", + "category": "misc", + "group": "shulker_box_dye", + "input": "#minecraft:shulker_boxes", + "material": "minecraft:purple_dye", + "result": "minecraft:purple_shulker_box" +} \ No newline at end of file diff --git a/data/minecraft/recipe/purple_stained_glass.json b/data/minecraft/recipe/purple_stained_glass.json index e2d03c56..d50dde72 100644 --- a/data/minecraft/recipe/purple_stained_glass.json +++ b/data/minecraft/recipe/purple_stained_glass.json @@ -3,12 +3,8 @@ "category": "building", "group": "stained_glass", "key": { - "#": { - "item": "minecraft:glass" - }, - "X": { - "item": "minecraft:purple_dye" - } + "#": "minecraft:glass", + "X": "minecraft:purple_dye" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/purple_stained_glass_pane.json b/data/minecraft/recipe/purple_stained_glass_pane.json index a2fe4255..094cd037 100644 --- a/data/minecraft/recipe/purple_stained_glass_pane.json +++ b/data/minecraft/recipe/purple_stained_glass_pane.json @@ -3,9 +3,7 @@ "category": "misc", "group": "stained_glass_pane", "key": { - "#": { - "item": "minecraft:purple_stained_glass" - } + "#": "minecraft:purple_stained_glass" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/purple_stained_glass_pane_from_glass_pane.json b/data/minecraft/recipe/purple_stained_glass_pane_from_glass_pane.json index 06325967..9381864b 100644 --- a/data/minecraft/recipe/purple_stained_glass_pane_from_glass_pane.json +++ b/data/minecraft/recipe/purple_stained_glass_pane_from_glass_pane.json @@ -3,12 +3,8 @@ "category": "misc", "group": "stained_glass_pane", "key": { - "#": { - "item": "minecraft:glass_pane" - }, - "$": { - "item": "minecraft:purple_dye" - } + "#": "minecraft:glass_pane", + "$": "minecraft:purple_dye" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/purple_terracotta.json b/data/minecraft/recipe/purple_terracotta.json index ab1eb35c..1690e20e 100644 --- a/data/minecraft/recipe/purple_terracotta.json +++ b/data/minecraft/recipe/purple_terracotta.json @@ -3,12 +3,8 @@ "category": "building", "group": "stained_terracotta", "key": { - "#": { - "item": "minecraft:terracotta" - }, - "X": { - "item": "minecraft:purple_dye" - } + "#": "minecraft:terracotta", + "X": "minecraft:purple_dye" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/purpur_block.json b/data/minecraft/recipe/purpur_block.json index 6f90c2a0..830aca69 100644 --- a/data/minecraft/recipe/purpur_block.json +++ b/data/minecraft/recipe/purpur_block.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "F": { - "item": "minecraft:popped_chorus_fruit" - } + "F": "minecraft:popped_chorus_fruit" }, "pattern": [ "FF", diff --git a/data/minecraft/recipe/purpur_pillar.json b/data/minecraft/recipe/purpur_pillar.json index 9d68b8d8..98e66d54 100644 --- a/data/minecraft/recipe/purpur_pillar.json +++ b/data/minecraft/recipe/purpur_pillar.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:purpur_slab" - } + "#": "minecraft:purpur_slab" }, "pattern": [ "#", diff --git a/data/minecraft/recipe/purpur_pillar_from_purpur_block_stonecutting.json b/data/minecraft/recipe/purpur_pillar_from_purpur_block_stonecutting.json index c9bf1cc7..7ff031f3 100644 --- a/data/minecraft/recipe/purpur_pillar_from_purpur_block_stonecutting.json +++ b/data/minecraft/recipe/purpur_pillar_from_purpur_block_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:purpur_block" - }, + "ingredient": "minecraft:purpur_block", "result": { "count": 1, "id": "minecraft:purpur_pillar" diff --git a/data/minecraft/recipe/purpur_slab.json b/data/minecraft/recipe/purpur_slab.json index 1345b04c..f7e1952e 100644 --- a/data/minecraft/recipe/purpur_slab.json +++ b/data/minecraft/recipe/purpur_slab.json @@ -3,12 +3,8 @@ "category": "building", "key": { "#": [ - { - "item": "minecraft:purpur_block" - }, - { - "item": "minecraft:purpur_pillar" - } + "minecraft:purpur_block", + "minecraft:purpur_pillar" ] }, "pattern": [ diff --git a/data/minecraft/recipe/purpur_slab_from_purpur_block_stonecutting.json b/data/minecraft/recipe/purpur_slab_from_purpur_block_stonecutting.json index 7e865be5..0512b5ef 100644 --- a/data/minecraft/recipe/purpur_slab_from_purpur_block_stonecutting.json +++ b/data/minecraft/recipe/purpur_slab_from_purpur_block_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:purpur_block" - }, + "ingredient": "minecraft:purpur_block", "result": { "count": 2, "id": "minecraft:purpur_slab" diff --git a/data/minecraft/recipe/purpur_stairs.json b/data/minecraft/recipe/purpur_stairs.json index 31ccb4ba..8a3452d2 100644 --- a/data/minecraft/recipe/purpur_stairs.json +++ b/data/minecraft/recipe/purpur_stairs.json @@ -3,12 +3,8 @@ "category": "building", "key": { "#": [ - { - "item": "minecraft:purpur_block" - }, - { - "item": "minecraft:purpur_pillar" - } + "minecraft:purpur_block", + "minecraft:purpur_pillar" ] }, "pattern": [ diff --git a/data/minecraft/recipe/purpur_stairs_from_purpur_block_stonecutting.json b/data/minecraft/recipe/purpur_stairs_from_purpur_block_stonecutting.json index eae1dd9c..0d349f23 100644 --- a/data/minecraft/recipe/purpur_stairs_from_purpur_block_stonecutting.json +++ b/data/minecraft/recipe/purpur_stairs_from_purpur_block_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:purpur_block" - }, + "ingredient": "minecraft:purpur_block", "result": { "count": 1, "id": "minecraft:purpur_stairs" diff --git a/data/minecraft/recipe/quartz.json b/data/minecraft/recipe/quartz.json index 4bc5b63a..35e2438a 100644 --- a/data/minecraft/recipe/quartz.json +++ b/data/minecraft/recipe/quartz.json @@ -3,9 +3,7 @@ "category": "misc", "cookingtime": 200, "experience": 0.2, - "ingredient": { - "item": "minecraft:nether_quartz_ore" - }, + "ingredient": "minecraft:nether_quartz_ore", "result": { "id": "minecraft:quartz" } diff --git a/data/minecraft/recipe/quartz_block.json b/data/minecraft/recipe/quartz_block.json index f0d16a0b..ba44769c 100644 --- a/data/minecraft/recipe/quartz_block.json +++ b/data/minecraft/recipe/quartz_block.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:quartz" - } + "#": "minecraft:quartz" }, "pattern": [ "##", diff --git a/data/minecraft/recipe/quartz_bricks.json b/data/minecraft/recipe/quartz_bricks.json index 23a8b5f3..cabc969d 100644 --- a/data/minecraft/recipe/quartz_bricks.json +++ b/data/minecraft/recipe/quartz_bricks.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:quartz_block" - } + "#": "minecraft:quartz_block" }, "pattern": [ "##", diff --git a/data/minecraft/recipe/quartz_bricks_from_quartz_block_stonecutting.json b/data/minecraft/recipe/quartz_bricks_from_quartz_block_stonecutting.json index 0e426a3a..b0dad059 100644 --- a/data/minecraft/recipe/quartz_bricks_from_quartz_block_stonecutting.json +++ b/data/minecraft/recipe/quartz_bricks_from_quartz_block_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:quartz_block" - }, + "ingredient": "minecraft:quartz_block", "result": { "count": 1, "id": "minecraft:quartz_bricks" diff --git a/data/minecraft/recipe/quartz_from_blasting.json b/data/minecraft/recipe/quartz_from_blasting.json index 275f30ec..7bbee6ba 100644 --- a/data/minecraft/recipe/quartz_from_blasting.json +++ b/data/minecraft/recipe/quartz_from_blasting.json @@ -3,9 +3,7 @@ "category": "misc", "cookingtime": 100, "experience": 0.2, - "ingredient": { - "item": "minecraft:nether_quartz_ore" - }, + "ingredient": "minecraft:nether_quartz_ore", "result": { "id": "minecraft:quartz" } diff --git a/data/minecraft/recipe/quartz_pillar.json b/data/minecraft/recipe/quartz_pillar.json index 3e3c9a05..fec403cc 100644 --- a/data/minecraft/recipe/quartz_pillar.json +++ b/data/minecraft/recipe/quartz_pillar.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:quartz_block" - } + "#": "minecraft:quartz_block" }, "pattern": [ "#", diff --git a/data/minecraft/recipe/quartz_pillar_from_quartz_block_stonecutting.json b/data/minecraft/recipe/quartz_pillar_from_quartz_block_stonecutting.json index cc38e9da..359d94ee 100644 --- a/data/minecraft/recipe/quartz_pillar_from_quartz_block_stonecutting.json +++ b/data/minecraft/recipe/quartz_pillar_from_quartz_block_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:quartz_block" - }, + "ingredient": "minecraft:quartz_block", "result": { "count": 1, "id": "minecraft:quartz_pillar" diff --git a/data/minecraft/recipe/quartz_slab.json b/data/minecraft/recipe/quartz_slab.json index 6ead9ead..ddea46a6 100644 --- a/data/minecraft/recipe/quartz_slab.json +++ b/data/minecraft/recipe/quartz_slab.json @@ -3,15 +3,9 @@ "category": "building", "key": { "#": [ - { - "item": "minecraft:chiseled_quartz_block" - }, - { - "item": "minecraft:quartz_block" - }, - { - "item": "minecraft:quartz_pillar" - } + "minecraft:chiseled_quartz_block", + "minecraft:quartz_block", + "minecraft:quartz_pillar" ] }, "pattern": [ diff --git a/data/minecraft/recipe/quartz_slab_from_stonecutting.json b/data/minecraft/recipe/quartz_slab_from_stonecutting.json index 8c869615..e1646a9a 100644 --- a/data/minecraft/recipe/quartz_slab_from_stonecutting.json +++ b/data/minecraft/recipe/quartz_slab_from_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:quartz_block" - }, + "ingredient": "minecraft:quartz_block", "result": { "count": 2, "id": "minecraft:quartz_slab" diff --git a/data/minecraft/recipe/quartz_stairs.json b/data/minecraft/recipe/quartz_stairs.json index 366d2b64..2b3fdbbe 100644 --- a/data/minecraft/recipe/quartz_stairs.json +++ b/data/minecraft/recipe/quartz_stairs.json @@ -3,15 +3,9 @@ "category": "building", "key": { "#": [ - { - "item": "minecraft:chiseled_quartz_block" - }, - { - "item": "minecraft:quartz_block" - }, - { - "item": "minecraft:quartz_pillar" - } + "minecraft:chiseled_quartz_block", + "minecraft:quartz_block", + "minecraft:quartz_pillar" ] }, "pattern": [ diff --git a/data/minecraft/recipe/quartz_stairs_from_quartz_block_stonecutting.json b/data/minecraft/recipe/quartz_stairs_from_quartz_block_stonecutting.json index 7de49c20..4b7706b4 100644 --- a/data/minecraft/recipe/quartz_stairs_from_quartz_block_stonecutting.json +++ b/data/minecraft/recipe/quartz_stairs_from_quartz_block_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:quartz_block" - }, + "ingredient": "minecraft:quartz_block", "result": { "count": 1, "id": "minecraft:quartz_stairs" diff --git a/data/minecraft/recipe/rabbit_stew_from_brown_mushroom.json b/data/minecraft/recipe/rabbit_stew_from_brown_mushroom.json index 834a3cfd..8fb58165 100644 --- a/data/minecraft/recipe/rabbit_stew_from_brown_mushroom.json +++ b/data/minecraft/recipe/rabbit_stew_from_brown_mushroom.json @@ -3,21 +3,11 @@ "category": "misc", "group": "rabbit_stew", "ingredients": [ - { - "item": "minecraft:baked_potato" - }, - { - "item": "minecraft:cooked_rabbit" - }, - { - "item": "minecraft:bowl" - }, - { - "item": "minecraft:carrot" - }, - { - "item": "minecraft:brown_mushroom" - } + "minecraft:baked_potato", + "minecraft:cooked_rabbit", + "minecraft:bowl", + "minecraft:carrot", + "minecraft:brown_mushroom" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/rabbit_stew_from_red_mushroom.json b/data/minecraft/recipe/rabbit_stew_from_red_mushroom.json index 31f1ed24..1c5a0b60 100644 --- a/data/minecraft/recipe/rabbit_stew_from_red_mushroom.json +++ b/data/minecraft/recipe/rabbit_stew_from_red_mushroom.json @@ -3,21 +3,11 @@ "category": "misc", "group": "rabbit_stew", "ingredients": [ - { - "item": "minecraft:baked_potato" - }, - { - "item": "minecraft:cooked_rabbit" - }, - { - "item": "minecraft:bowl" - }, - { - "item": "minecraft:carrot" - }, - { - "item": "minecraft:red_mushroom" - } + "minecraft:baked_potato", + "minecraft:cooked_rabbit", + "minecraft:bowl", + "minecraft:carrot", + "minecraft:red_mushroom" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/rail.json b/data/minecraft/recipe/rail.json index 68ce7fae..806e4bef 100644 --- a/data/minecraft/recipe/rail.json +++ b/data/minecraft/recipe/rail.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "#": { - "item": "minecraft:stick" - }, - "X": { - "item": "minecraft:iron_ingot" - } + "#": "minecraft:stick", + "X": "minecraft:iron_ingot" }, "pattern": [ "X X", diff --git a/data/minecraft/recipe/raiser_armor_trim_smithing_template.json b/data/minecraft/recipe/raiser_armor_trim_smithing_template.json index 043eb56f..ae32315a 100644 --- a/data/minecraft/recipe/raiser_armor_trim_smithing_template.json +++ b/data/minecraft/recipe/raiser_armor_trim_smithing_template.json @@ -2,15 +2,9 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "#": { - "item": "minecraft:diamond" - }, - "C": { - "item": "minecraft:terracotta" - }, - "S": { - "item": "minecraft:raiser_armor_trim_smithing_template" - } + "#": "minecraft:diamond", + "C": "minecraft:terracotta", + "S": "minecraft:raiser_armor_trim_smithing_template" }, "pattern": [ "#S#", diff --git a/data/minecraft/recipe/raiser_armor_trim_smithing_template_smithing_trim.json b/data/minecraft/recipe/raiser_armor_trim_smithing_template_smithing_trim.json index 25250bec..1ad65dd0 100644 --- a/data/minecraft/recipe/raiser_armor_trim_smithing_template_smithing_trim.json +++ b/data/minecraft/recipe/raiser_armor_trim_smithing_template_smithing_trim.json @@ -1,12 +1,6 @@ { "type": "minecraft:smithing_trim", - "addition": { - "tag": "minecraft:trim_materials" - }, - "base": { - "tag": "minecraft:trimmable_armor" - }, - "template": { - "item": "minecraft:raiser_armor_trim_smithing_template" - } + "addition": "#minecraft:trim_materials", + "base": "#minecraft:trimmable_armor", + "template": "minecraft:raiser_armor_trim_smithing_template" } \ No newline at end of file diff --git a/data/minecraft/recipe/raw_copper.json b/data/minecraft/recipe/raw_copper.json index 9f549193..74057fe3 100644 --- a/data/minecraft/recipe/raw_copper.json +++ b/data/minecraft/recipe/raw_copper.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shapeless", "category": "misc", "ingredients": [ - { - "item": "minecraft:raw_copper_block" - } + "minecraft:raw_copper_block" ], "result": { "count": 9, diff --git a/data/minecraft/recipe/raw_copper_block.json b/data/minecraft/recipe/raw_copper_block.json index de0cc1d1..5fa3ece4 100644 --- a/data/minecraft/recipe/raw_copper_block.json +++ b/data/minecraft/recipe/raw_copper_block.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:raw_copper" - } + "#": "minecraft:raw_copper" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/raw_gold.json b/data/minecraft/recipe/raw_gold.json index d8cd5646..d899f262 100644 --- a/data/minecraft/recipe/raw_gold.json +++ b/data/minecraft/recipe/raw_gold.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shapeless", "category": "misc", "ingredients": [ - { - "item": "minecraft:raw_gold_block" - } + "minecraft:raw_gold_block" ], "result": { "count": 9, diff --git a/data/minecraft/recipe/raw_gold_block.json b/data/minecraft/recipe/raw_gold_block.json index f3b42df8..4a3572c0 100644 --- a/data/minecraft/recipe/raw_gold_block.json +++ b/data/minecraft/recipe/raw_gold_block.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:raw_gold" - } + "#": "minecraft:raw_gold" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/raw_iron.json b/data/minecraft/recipe/raw_iron.json index 18c818ff..abd7e72d 100644 --- a/data/minecraft/recipe/raw_iron.json +++ b/data/minecraft/recipe/raw_iron.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shapeless", "category": "misc", "ingredients": [ - { - "item": "minecraft:raw_iron_block" - } + "minecraft:raw_iron_block" ], "result": { "count": 9, diff --git a/data/minecraft/recipe/raw_iron_block.json b/data/minecraft/recipe/raw_iron_block.json index ea81aa8d..a99a22b8 100644 --- a/data/minecraft/recipe/raw_iron_block.json +++ b/data/minecraft/recipe/raw_iron_block.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:raw_iron" - } + "#": "minecraft:raw_iron" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/recovery_compass.json b/data/minecraft/recipe/recovery_compass.json index 952af391..d7ef2aed 100644 --- a/data/minecraft/recipe/recovery_compass.json +++ b/data/minecraft/recipe/recovery_compass.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shaped", "category": "equipment", "key": { - "C": { - "item": "minecraft:compass" - }, - "S": { - "item": "minecraft:echo_shard" - } + "C": "minecraft:compass", + "S": "minecraft:echo_shard" }, "pattern": [ "SSS", diff --git a/data/minecraft/recipe/red_banner.json b/data/minecraft/recipe/red_banner.json index 6d31bd01..a5c67ed4 100644 --- a/data/minecraft/recipe/red_banner.json +++ b/data/minecraft/recipe/red_banner.json @@ -3,12 +3,8 @@ "category": "misc", "group": "banner", "key": { - "#": { - "item": "minecraft:red_wool" - }, - "|": { - "item": "minecraft:stick" - } + "#": "minecraft:red_wool", + "|": "minecraft:stick" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/red_bed.json b/data/minecraft/recipe/red_bed.json index 5974e230..09a21ee4 100644 --- a/data/minecraft/recipe/red_bed.json +++ b/data/minecraft/recipe/red_bed.json @@ -3,12 +3,8 @@ "category": "misc", "group": "bed", "key": { - "#": { - "item": "minecraft:red_wool" - }, - "X": { - "tag": "minecraft:planks" - } + "#": "minecraft:red_wool", + "X": "#minecraft:planks" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/red_bundle.json b/data/minecraft/recipe/red_bundle.json new file mode 100644 index 00000000..8f066354 --- /dev/null +++ b/data/minecraft/recipe/red_bundle.json @@ -0,0 +1,8 @@ +{ + "type": "minecraft:crafting_transmute", + "category": "equipment", + "group": "bundle_dye", + "input": "#minecraft:bundles", + "material": "minecraft:red_dye", + "result": "minecraft:red_bundle" +} \ No newline at end of file diff --git a/data/minecraft/recipe/red_candle.json b/data/minecraft/recipe/red_candle.json index 04c581de..83596fa2 100644 --- a/data/minecraft/recipe/red_candle.json +++ b/data/minecraft/recipe/red_candle.json @@ -3,12 +3,8 @@ "category": "misc", "group": "dyed_candle", "ingredients": [ - { - "item": "minecraft:candle" - }, - { - "item": "minecraft:red_dye" - } + "minecraft:candle", + "minecraft:red_dye" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/red_carpet.json b/data/minecraft/recipe/red_carpet.json index 456e9ddb..2e64ba01 100644 --- a/data/minecraft/recipe/red_carpet.json +++ b/data/minecraft/recipe/red_carpet.json @@ -3,9 +3,7 @@ "category": "misc", "group": "carpet", "key": { - "#": { - "item": "minecraft:red_wool" - } + "#": "minecraft:red_wool" }, "pattern": [ "##" diff --git a/data/minecraft/recipe/red_concrete_powder.json b/data/minecraft/recipe/red_concrete_powder.json index 8d243a88..d5e88d6c 100644 --- a/data/minecraft/recipe/red_concrete_powder.json +++ b/data/minecraft/recipe/red_concrete_powder.json @@ -3,33 +3,15 @@ "category": "building", "group": "concrete_powder", "ingredients": [ - { - "item": "minecraft:red_dye" - }, - { - "item": "minecraft:sand" - }, - { - "item": "minecraft:sand" - }, - { - "item": "minecraft:sand" - }, - { - "item": "minecraft:sand" - }, - { - "item": "minecraft:gravel" - }, - { - "item": "minecraft:gravel" - }, - { - "item": "minecraft:gravel" - }, - { - "item": "minecraft:gravel" - } + "minecraft:red_dye", + "minecraft:sand", + "minecraft:sand", + "minecraft:sand", + "minecraft:sand", + "minecraft:gravel", + "minecraft:gravel", + "minecraft:gravel", + "minecraft:gravel" ], "result": { "count": 8, diff --git a/data/minecraft/recipe/red_dye_from_beetroot.json b/data/minecraft/recipe/red_dye_from_beetroot.json index b4e98b8c..7eda431b 100644 --- a/data/minecraft/recipe/red_dye_from_beetroot.json +++ b/data/minecraft/recipe/red_dye_from_beetroot.json @@ -3,9 +3,7 @@ "category": "misc", "group": "red_dye", "ingredients": [ - { - "item": "minecraft:beetroot" - } + "minecraft:beetroot" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/red_dye_from_poppy.json b/data/minecraft/recipe/red_dye_from_poppy.json index 2d8b3910..f4093507 100644 --- a/data/minecraft/recipe/red_dye_from_poppy.json +++ b/data/minecraft/recipe/red_dye_from_poppy.json @@ -3,9 +3,7 @@ "category": "misc", "group": "red_dye", "ingredients": [ - { - "item": "minecraft:poppy" - } + "minecraft:poppy" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/red_dye_from_rose_bush.json b/data/minecraft/recipe/red_dye_from_rose_bush.json index 7575482d..cfa85a05 100644 --- a/data/minecraft/recipe/red_dye_from_rose_bush.json +++ b/data/minecraft/recipe/red_dye_from_rose_bush.json @@ -3,9 +3,7 @@ "category": "misc", "group": "red_dye", "ingredients": [ - { - "item": "minecraft:rose_bush" - } + "minecraft:rose_bush" ], "result": { "count": 2, diff --git a/data/minecraft/recipe/red_dye_from_tulip.json b/data/minecraft/recipe/red_dye_from_tulip.json index 295a0fb0..6f815eaa 100644 --- a/data/minecraft/recipe/red_dye_from_tulip.json +++ b/data/minecraft/recipe/red_dye_from_tulip.json @@ -3,9 +3,7 @@ "category": "misc", "group": "red_dye", "ingredients": [ - { - "item": "minecraft:red_tulip" - } + "minecraft:red_tulip" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/red_glazed_terracotta.json b/data/minecraft/recipe/red_glazed_terracotta.json index 4d111f4b..622c1560 100644 --- a/data/minecraft/recipe/red_glazed_terracotta.json +++ b/data/minecraft/recipe/red_glazed_terracotta.json @@ -3,9 +3,7 @@ "category": "blocks", "cookingtime": 200, "experience": 0.1, - "ingredient": { - "item": "minecraft:red_terracotta" - }, + "ingredient": "minecraft:red_terracotta", "result": { "id": "minecraft:red_glazed_terracotta" } diff --git a/data/minecraft/recipe/red_nether_brick_slab.json b/data/minecraft/recipe/red_nether_brick_slab.json index d0c178c3..84665125 100644 --- a/data/minecraft/recipe/red_nether_brick_slab.json +++ b/data/minecraft/recipe/red_nether_brick_slab.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:red_nether_bricks" - } + "#": "minecraft:red_nether_bricks" }, "pattern": [ "###" diff --git a/data/minecraft/recipe/red_nether_brick_slab_from_red_nether_bricks_stonecutting.json b/data/minecraft/recipe/red_nether_brick_slab_from_red_nether_bricks_stonecutting.json index 81095bb7..edbdbf76 100644 --- a/data/minecraft/recipe/red_nether_brick_slab_from_red_nether_bricks_stonecutting.json +++ b/data/minecraft/recipe/red_nether_brick_slab_from_red_nether_bricks_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:red_nether_bricks" - }, + "ingredient": "minecraft:red_nether_bricks", "result": { "count": 2, "id": "minecraft:red_nether_brick_slab" diff --git a/data/minecraft/recipe/red_nether_brick_stairs.json b/data/minecraft/recipe/red_nether_brick_stairs.json index aadd6066..4999a589 100644 --- a/data/minecraft/recipe/red_nether_brick_stairs.json +++ b/data/minecraft/recipe/red_nether_brick_stairs.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:red_nether_bricks" - } + "#": "minecraft:red_nether_bricks" }, "pattern": [ "# ", diff --git a/data/minecraft/recipe/red_nether_brick_stairs_from_red_nether_bricks_stonecutting.json b/data/minecraft/recipe/red_nether_brick_stairs_from_red_nether_bricks_stonecutting.json index 823c38bf..c0537f63 100644 --- a/data/minecraft/recipe/red_nether_brick_stairs_from_red_nether_bricks_stonecutting.json +++ b/data/minecraft/recipe/red_nether_brick_stairs_from_red_nether_bricks_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:red_nether_bricks" - }, + "ingredient": "minecraft:red_nether_bricks", "result": { "count": 1, "id": "minecraft:red_nether_brick_stairs" diff --git a/data/minecraft/recipe/red_nether_brick_wall.json b/data/minecraft/recipe/red_nether_brick_wall.json index f3f083be..671393f6 100644 --- a/data/minecraft/recipe/red_nether_brick_wall.json +++ b/data/minecraft/recipe/red_nether_brick_wall.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "#": { - "item": "minecraft:red_nether_bricks" - } + "#": "minecraft:red_nether_bricks" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/red_nether_brick_wall_from_red_nether_bricks_stonecutting.json b/data/minecraft/recipe/red_nether_brick_wall_from_red_nether_bricks_stonecutting.json index d7a465cc..ee564561 100644 --- a/data/minecraft/recipe/red_nether_brick_wall_from_red_nether_bricks_stonecutting.json +++ b/data/minecraft/recipe/red_nether_brick_wall_from_red_nether_bricks_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:red_nether_bricks" - }, + "ingredient": "minecraft:red_nether_bricks", "result": { "count": 1, "id": "minecraft:red_nether_brick_wall" diff --git a/data/minecraft/recipe/red_nether_bricks.json b/data/minecraft/recipe/red_nether_bricks.json index 4a85f40c..0c7a0273 100644 --- a/data/minecraft/recipe/red_nether_bricks.json +++ b/data/minecraft/recipe/red_nether_bricks.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "N": { - "item": "minecraft:nether_brick" - }, - "W": { - "item": "minecraft:nether_wart" - } + "N": "minecraft:nether_brick", + "W": "minecraft:nether_wart" }, "pattern": [ "NW", diff --git a/data/minecraft/recipe/red_sandstone.json b/data/minecraft/recipe/red_sandstone.json index ad04e67f..4618e767 100644 --- a/data/minecraft/recipe/red_sandstone.json +++ b/data/minecraft/recipe/red_sandstone.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:red_sand" - } + "#": "minecraft:red_sand" }, "pattern": [ "##", diff --git a/data/minecraft/recipe/red_sandstone_slab.json b/data/minecraft/recipe/red_sandstone_slab.json index 3687a5a4..34d6a4a8 100644 --- a/data/minecraft/recipe/red_sandstone_slab.json +++ b/data/minecraft/recipe/red_sandstone_slab.json @@ -3,12 +3,8 @@ "category": "building", "key": { "#": [ - { - "item": "minecraft:red_sandstone" - }, - { - "item": "minecraft:chiseled_red_sandstone" - } + "minecraft:red_sandstone", + "minecraft:chiseled_red_sandstone" ] }, "pattern": [ diff --git a/data/minecraft/recipe/red_sandstone_slab_from_red_sandstone_stonecutting.json b/data/minecraft/recipe/red_sandstone_slab_from_red_sandstone_stonecutting.json index c9e77aec..41fd49ac 100644 --- a/data/minecraft/recipe/red_sandstone_slab_from_red_sandstone_stonecutting.json +++ b/data/minecraft/recipe/red_sandstone_slab_from_red_sandstone_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:red_sandstone" - }, + "ingredient": "minecraft:red_sandstone", "result": { "count": 2, "id": "minecraft:red_sandstone_slab" diff --git a/data/minecraft/recipe/red_sandstone_stairs.json b/data/minecraft/recipe/red_sandstone_stairs.json index 5f936bae..e36fa307 100644 --- a/data/minecraft/recipe/red_sandstone_stairs.json +++ b/data/minecraft/recipe/red_sandstone_stairs.json @@ -3,15 +3,9 @@ "category": "building", "key": { "#": [ - { - "item": "minecraft:red_sandstone" - }, - { - "item": "minecraft:chiseled_red_sandstone" - }, - { - "item": "minecraft:cut_red_sandstone" - } + "minecraft:red_sandstone", + "minecraft:chiseled_red_sandstone", + "minecraft:cut_red_sandstone" ] }, "pattern": [ diff --git a/data/minecraft/recipe/red_sandstone_stairs_from_red_sandstone_stonecutting.json b/data/minecraft/recipe/red_sandstone_stairs_from_red_sandstone_stonecutting.json index 50035c62..78e234a3 100644 --- a/data/minecraft/recipe/red_sandstone_stairs_from_red_sandstone_stonecutting.json +++ b/data/minecraft/recipe/red_sandstone_stairs_from_red_sandstone_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:red_sandstone" - }, + "ingredient": "minecraft:red_sandstone", "result": { "count": 1, "id": "minecraft:red_sandstone_stairs" diff --git a/data/minecraft/recipe/red_sandstone_wall.json b/data/minecraft/recipe/red_sandstone_wall.json index d8fc1373..e8050338 100644 --- a/data/minecraft/recipe/red_sandstone_wall.json +++ b/data/minecraft/recipe/red_sandstone_wall.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "#": { - "item": "minecraft:red_sandstone" - } + "#": "minecraft:red_sandstone" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/red_sandstone_wall_from_red_sandstone_stonecutting.json b/data/minecraft/recipe/red_sandstone_wall_from_red_sandstone_stonecutting.json index 98d391e9..b5ef4a23 100644 --- a/data/minecraft/recipe/red_sandstone_wall_from_red_sandstone_stonecutting.json +++ b/data/minecraft/recipe/red_sandstone_wall_from_red_sandstone_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:red_sandstone" - }, + "ingredient": "minecraft:red_sandstone", "result": { "count": 1, "id": "minecraft:red_sandstone_wall" diff --git a/data/minecraft/recipe/red_shulker_box.json b/data/minecraft/recipe/red_shulker_box.json new file mode 100644 index 00000000..7ffeeefa --- /dev/null +++ b/data/minecraft/recipe/red_shulker_box.json @@ -0,0 +1,8 @@ +{ + "type": "minecraft:crafting_transmute", + "category": "misc", + "group": "shulker_box_dye", + "input": "#minecraft:shulker_boxes", + "material": "minecraft:red_dye", + "result": "minecraft:red_shulker_box" +} \ No newline at end of file diff --git a/data/minecraft/recipe/red_stained_glass.json b/data/minecraft/recipe/red_stained_glass.json index 11e393b7..d9e4e67e 100644 --- a/data/minecraft/recipe/red_stained_glass.json +++ b/data/minecraft/recipe/red_stained_glass.json @@ -3,12 +3,8 @@ "category": "building", "group": "stained_glass", "key": { - "#": { - "item": "minecraft:glass" - }, - "X": { - "item": "minecraft:red_dye" - } + "#": "minecraft:glass", + "X": "minecraft:red_dye" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/red_stained_glass_pane.json b/data/minecraft/recipe/red_stained_glass_pane.json index e2b9fa18..5f8d94a3 100644 --- a/data/minecraft/recipe/red_stained_glass_pane.json +++ b/data/minecraft/recipe/red_stained_glass_pane.json @@ -3,9 +3,7 @@ "category": "misc", "group": "stained_glass_pane", "key": { - "#": { - "item": "minecraft:red_stained_glass" - } + "#": "minecraft:red_stained_glass" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/red_stained_glass_pane_from_glass_pane.json b/data/minecraft/recipe/red_stained_glass_pane_from_glass_pane.json index 9bba70da..778f01da 100644 --- a/data/minecraft/recipe/red_stained_glass_pane_from_glass_pane.json +++ b/data/minecraft/recipe/red_stained_glass_pane_from_glass_pane.json @@ -3,12 +3,8 @@ "category": "misc", "group": "stained_glass_pane", "key": { - "#": { - "item": "minecraft:glass_pane" - }, - "$": { - "item": "minecraft:red_dye" - } + "#": "minecraft:glass_pane", + "$": "minecraft:red_dye" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/red_terracotta.json b/data/minecraft/recipe/red_terracotta.json index 49560234..2065d366 100644 --- a/data/minecraft/recipe/red_terracotta.json +++ b/data/minecraft/recipe/red_terracotta.json @@ -3,12 +3,8 @@ "category": "building", "group": "stained_terracotta", "key": { - "#": { - "item": "minecraft:terracotta" - }, - "X": { - "item": "minecraft:red_dye" - } + "#": "minecraft:terracotta", + "X": "minecraft:red_dye" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/redstone.json b/data/minecraft/recipe/redstone.json index 36ff3aa0..6125720a 100644 --- a/data/minecraft/recipe/redstone.json +++ b/data/minecraft/recipe/redstone.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shapeless", "category": "redstone", "ingredients": [ - { - "item": "minecraft:redstone_block" - } + "minecraft:redstone_block" ], "result": { "count": 9, diff --git a/data/minecraft/recipe/redstone_block.json b/data/minecraft/recipe/redstone_block.json index d3d71a16..0d534838 100644 --- a/data/minecraft/recipe/redstone_block.json +++ b/data/minecraft/recipe/redstone_block.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "redstone", "key": { - "#": { - "item": "minecraft:redstone" - } + "#": "minecraft:redstone" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/redstone_from_blasting_deepslate_redstone_ore.json b/data/minecraft/recipe/redstone_from_blasting_deepslate_redstone_ore.json index 58ee2a5a..c5c3299b 100644 --- a/data/minecraft/recipe/redstone_from_blasting_deepslate_redstone_ore.json +++ b/data/minecraft/recipe/redstone_from_blasting_deepslate_redstone_ore.json @@ -4,9 +4,7 @@ "cookingtime": 100, "experience": 0.7, "group": "redstone", - "ingredient": { - "item": "minecraft:deepslate_redstone_ore" - }, + "ingredient": "minecraft:deepslate_redstone_ore", "result": { "id": "minecraft:redstone" } diff --git a/data/minecraft/recipe/redstone_from_blasting_redstone_ore.json b/data/minecraft/recipe/redstone_from_blasting_redstone_ore.json index 83973044..11056b65 100644 --- a/data/minecraft/recipe/redstone_from_blasting_redstone_ore.json +++ b/data/minecraft/recipe/redstone_from_blasting_redstone_ore.json @@ -4,9 +4,7 @@ "cookingtime": 100, "experience": 0.7, "group": "redstone", - "ingredient": { - "item": "minecraft:redstone_ore" - }, + "ingredient": "minecraft:redstone_ore", "result": { "id": "minecraft:redstone" } diff --git a/data/minecraft/recipe/redstone_from_smelting_deepslate_redstone_ore.json b/data/minecraft/recipe/redstone_from_smelting_deepslate_redstone_ore.json index ae7989ea..421aa153 100644 --- a/data/minecraft/recipe/redstone_from_smelting_deepslate_redstone_ore.json +++ b/data/minecraft/recipe/redstone_from_smelting_deepslate_redstone_ore.json @@ -4,9 +4,7 @@ "cookingtime": 200, "experience": 0.7, "group": "redstone", - "ingredient": { - "item": "minecraft:deepslate_redstone_ore" - }, + "ingredient": "minecraft:deepslate_redstone_ore", "result": { "id": "minecraft:redstone" } diff --git a/data/minecraft/recipe/redstone_from_smelting_redstone_ore.json b/data/minecraft/recipe/redstone_from_smelting_redstone_ore.json index 25de9eed..d72d81e5 100644 --- a/data/minecraft/recipe/redstone_from_smelting_redstone_ore.json +++ b/data/minecraft/recipe/redstone_from_smelting_redstone_ore.json @@ -4,9 +4,7 @@ "cookingtime": 200, "experience": 0.7, "group": "redstone", - "ingredient": { - "item": "minecraft:redstone_ore" - }, + "ingredient": "minecraft:redstone_ore", "result": { "id": "minecraft:redstone" } diff --git a/data/minecraft/recipe/redstone_lamp.json b/data/minecraft/recipe/redstone_lamp.json index 1a335b1e..214f811a 100644 --- a/data/minecraft/recipe/redstone_lamp.json +++ b/data/minecraft/recipe/redstone_lamp.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shaped", "category": "redstone", "key": { - "G": { - "item": "minecraft:glowstone" - }, - "R": { - "item": "minecraft:redstone" - } + "G": "minecraft:glowstone", + "R": "minecraft:redstone" }, "pattern": [ " R ", diff --git a/data/minecraft/recipe/redstone_torch.json b/data/minecraft/recipe/redstone_torch.json index 84be789a..5811bdcc 100644 --- a/data/minecraft/recipe/redstone_torch.json +++ b/data/minecraft/recipe/redstone_torch.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shaped", "category": "redstone", "key": { - "#": { - "item": "minecraft:stick" - }, - "X": { - "item": "minecraft:redstone" - } + "#": "minecraft:stick", + "X": "minecraft:redstone" }, "pattern": [ "X", diff --git a/data/minecraft/recipe/repeater.json b/data/minecraft/recipe/repeater.json index 1821c255..6e00b8c8 100644 --- a/data/minecraft/recipe/repeater.json +++ b/data/minecraft/recipe/repeater.json @@ -2,15 +2,9 @@ "type": "minecraft:crafting_shaped", "category": "redstone", "key": { - "#": { - "item": "minecraft:redstone_torch" - }, - "I": { - "item": "minecraft:stone" - }, - "X": { - "item": "minecraft:redstone" - } + "#": "minecraft:redstone_torch", + "I": "minecraft:stone", + "X": "minecraft:redstone" }, "pattern": [ "#X#", diff --git a/data/minecraft/recipe/respawn_anchor.json b/data/minecraft/recipe/respawn_anchor.json index 26e570a3..dc080973 100644 --- a/data/minecraft/recipe/respawn_anchor.json +++ b/data/minecraft/recipe/respawn_anchor.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "G": { - "item": "minecraft:glowstone" - }, - "O": { - "item": "minecraft:crying_obsidian" - } + "G": "minecraft:glowstone", + "O": "minecraft:crying_obsidian" }, "pattern": [ "OOO", diff --git a/data/minecraft/recipe/rib_armor_trim_smithing_template.json b/data/minecraft/recipe/rib_armor_trim_smithing_template.json index 3cd0e67d..ab053904 100644 --- a/data/minecraft/recipe/rib_armor_trim_smithing_template.json +++ b/data/minecraft/recipe/rib_armor_trim_smithing_template.json @@ -2,15 +2,9 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "#": { - "item": "minecraft:diamond" - }, - "C": { - "item": "minecraft:netherrack" - }, - "S": { - "item": "minecraft:rib_armor_trim_smithing_template" - } + "#": "minecraft:diamond", + "C": "minecraft:netherrack", + "S": "minecraft:rib_armor_trim_smithing_template" }, "pattern": [ "#S#", diff --git a/data/minecraft/recipe/rib_armor_trim_smithing_template_smithing_trim.json b/data/minecraft/recipe/rib_armor_trim_smithing_template_smithing_trim.json index 2ec1b6a9..cb18a0e3 100644 --- a/data/minecraft/recipe/rib_armor_trim_smithing_template_smithing_trim.json +++ b/data/minecraft/recipe/rib_armor_trim_smithing_template_smithing_trim.json @@ -1,12 +1,6 @@ { "type": "minecraft:smithing_trim", - "addition": { - "tag": "minecraft:trim_materials" - }, - "base": { - "tag": "minecraft:trimmable_armor" - }, - "template": { - "item": "minecraft:rib_armor_trim_smithing_template" - } + "addition": "#minecraft:trim_materials", + "base": "#minecraft:trimmable_armor", + "template": "minecraft:rib_armor_trim_smithing_template" } \ No newline at end of file diff --git a/data/minecraft/recipe/sandstone.json b/data/minecraft/recipe/sandstone.json index f907bd1d..9063abf4 100644 --- a/data/minecraft/recipe/sandstone.json +++ b/data/minecraft/recipe/sandstone.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:sand" - } + "#": "minecraft:sand" }, "pattern": [ "##", diff --git a/data/minecraft/recipe/sandstone_slab.json b/data/minecraft/recipe/sandstone_slab.json index 4e27d957..2e841bf8 100644 --- a/data/minecraft/recipe/sandstone_slab.json +++ b/data/minecraft/recipe/sandstone_slab.json @@ -3,12 +3,8 @@ "category": "building", "key": { "#": [ - { - "item": "minecraft:sandstone" - }, - { - "item": "minecraft:chiseled_sandstone" - } + "minecraft:sandstone", + "minecraft:chiseled_sandstone" ] }, "pattern": [ diff --git a/data/minecraft/recipe/sandstone_slab_from_sandstone_stonecutting.json b/data/minecraft/recipe/sandstone_slab_from_sandstone_stonecutting.json index 0eaed176..3a336412 100644 --- a/data/minecraft/recipe/sandstone_slab_from_sandstone_stonecutting.json +++ b/data/minecraft/recipe/sandstone_slab_from_sandstone_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:sandstone" - }, + "ingredient": "minecraft:sandstone", "result": { "count": 2, "id": "minecraft:sandstone_slab" diff --git a/data/minecraft/recipe/sandstone_stairs.json b/data/minecraft/recipe/sandstone_stairs.json index 5606110c..d04adb8c 100644 --- a/data/minecraft/recipe/sandstone_stairs.json +++ b/data/minecraft/recipe/sandstone_stairs.json @@ -3,15 +3,9 @@ "category": "building", "key": { "#": [ - { - "item": "minecraft:sandstone" - }, - { - "item": "minecraft:chiseled_sandstone" - }, - { - "item": "minecraft:cut_sandstone" - } + "minecraft:sandstone", + "minecraft:chiseled_sandstone", + "minecraft:cut_sandstone" ] }, "pattern": [ diff --git a/data/minecraft/recipe/sandstone_stairs_from_sandstone_stonecutting.json b/data/minecraft/recipe/sandstone_stairs_from_sandstone_stonecutting.json index a6ad01e2..be9483d0 100644 --- a/data/minecraft/recipe/sandstone_stairs_from_sandstone_stonecutting.json +++ b/data/minecraft/recipe/sandstone_stairs_from_sandstone_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:sandstone" - }, + "ingredient": "minecraft:sandstone", "result": { "count": 1, "id": "minecraft:sandstone_stairs" diff --git a/data/minecraft/recipe/sandstone_wall.json b/data/minecraft/recipe/sandstone_wall.json index e056bd75..2944dd02 100644 --- a/data/minecraft/recipe/sandstone_wall.json +++ b/data/minecraft/recipe/sandstone_wall.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "#": { - "item": "minecraft:sandstone" - } + "#": "minecraft:sandstone" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/sandstone_wall_from_sandstone_stonecutting.json b/data/minecraft/recipe/sandstone_wall_from_sandstone_stonecutting.json index 0fa3ef98..72e71b70 100644 --- a/data/minecraft/recipe/sandstone_wall_from_sandstone_stonecutting.json +++ b/data/minecraft/recipe/sandstone_wall_from_sandstone_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:sandstone" - }, + "ingredient": "minecraft:sandstone", "result": { "count": 1, "id": "minecraft:sandstone_wall" diff --git a/data/minecraft/recipe/scaffolding.json b/data/minecraft/recipe/scaffolding.json index b63af0c4..27126292 100644 --- a/data/minecraft/recipe/scaffolding.json +++ b/data/minecraft/recipe/scaffolding.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "I": { - "item": "minecraft:bamboo" - }, - "~": { - "item": "minecraft:string" - } + "I": "minecraft:bamboo", + "~": "minecraft:string" }, "pattern": [ "I~I", diff --git a/data/minecraft/recipe/sea_lantern.json b/data/minecraft/recipe/sea_lantern.json index c9ecf071..e75e1f74 100644 --- a/data/minecraft/recipe/sea_lantern.json +++ b/data/minecraft/recipe/sea_lantern.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "C": { - "item": "minecraft:prismarine_crystals" - }, - "S": { - "item": "minecraft:prismarine_shard" - } + "C": "minecraft:prismarine_crystals", + "S": "minecraft:prismarine_shard" }, "pattern": [ "SCS", diff --git a/data/minecraft/recipe/sentry_armor_trim_smithing_template.json b/data/minecraft/recipe/sentry_armor_trim_smithing_template.json index e6e6dee7..b2793bec 100644 --- a/data/minecraft/recipe/sentry_armor_trim_smithing_template.json +++ b/data/minecraft/recipe/sentry_armor_trim_smithing_template.json @@ -2,15 +2,9 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "#": { - "item": "minecraft:diamond" - }, - "C": { - "item": "minecraft:cobblestone" - }, - "S": { - "item": "minecraft:sentry_armor_trim_smithing_template" - } + "#": "minecraft:diamond", + "C": "minecraft:cobblestone", + "S": "minecraft:sentry_armor_trim_smithing_template" }, "pattern": [ "#S#", diff --git a/data/minecraft/recipe/sentry_armor_trim_smithing_template_smithing_trim.json b/data/minecraft/recipe/sentry_armor_trim_smithing_template_smithing_trim.json index 5099fe1a..a3472bdf 100644 --- a/data/minecraft/recipe/sentry_armor_trim_smithing_template_smithing_trim.json +++ b/data/minecraft/recipe/sentry_armor_trim_smithing_template_smithing_trim.json @@ -1,12 +1,6 @@ { "type": "minecraft:smithing_trim", - "addition": { - "tag": "minecraft:trim_materials" - }, - "base": { - "tag": "minecraft:trimmable_armor" - }, - "template": { - "item": "minecraft:sentry_armor_trim_smithing_template" - } + "addition": "#minecraft:trim_materials", + "base": "#minecraft:trimmable_armor", + "template": "minecraft:sentry_armor_trim_smithing_template" } \ No newline at end of file diff --git a/data/minecraft/recipe/shaper_armor_trim_smithing_template.json b/data/minecraft/recipe/shaper_armor_trim_smithing_template.json index b785a45e..b1ae3a52 100644 --- a/data/minecraft/recipe/shaper_armor_trim_smithing_template.json +++ b/data/minecraft/recipe/shaper_armor_trim_smithing_template.json @@ -2,15 +2,9 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "#": { - "item": "minecraft:diamond" - }, - "C": { - "item": "minecraft:terracotta" - }, - "S": { - "item": "minecraft:shaper_armor_trim_smithing_template" - } + "#": "minecraft:diamond", + "C": "minecraft:terracotta", + "S": "minecraft:shaper_armor_trim_smithing_template" }, "pattern": [ "#S#", diff --git a/data/minecraft/recipe/shaper_armor_trim_smithing_template_smithing_trim.json b/data/minecraft/recipe/shaper_armor_trim_smithing_template_smithing_trim.json index 8adf0be5..2f9b1ab6 100644 --- a/data/minecraft/recipe/shaper_armor_trim_smithing_template_smithing_trim.json +++ b/data/minecraft/recipe/shaper_armor_trim_smithing_template_smithing_trim.json @@ -1,12 +1,6 @@ { "type": "minecraft:smithing_trim", - "addition": { - "tag": "minecraft:trim_materials" - }, - "base": { - "tag": "minecraft:trimmable_armor" - }, - "template": { - "item": "minecraft:shaper_armor_trim_smithing_template" - } + "addition": "#minecraft:trim_materials", + "base": "#minecraft:trimmable_armor", + "template": "minecraft:shaper_armor_trim_smithing_template" } \ No newline at end of file diff --git a/data/minecraft/recipe/shears.json b/data/minecraft/recipe/shears.json index b66335ca..2e91a294 100644 --- a/data/minecraft/recipe/shears.json +++ b/data/minecraft/recipe/shears.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "equipment", "key": { - "#": { - "item": "minecraft:iron_ingot" - } + "#": "minecraft:iron_ingot" }, "pattern": [ " #", diff --git a/data/minecraft/recipe/shield.json b/data/minecraft/recipe/shield.json index 9a7a82cb..0892c7b0 100644 --- a/data/minecraft/recipe/shield.json +++ b/data/minecraft/recipe/shield.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shaped", "category": "equipment", "key": { - "W": { - "tag": "minecraft:planks" - }, - "o": { - "item": "minecraft:iron_ingot" - } + "W": "#minecraft:wooden_tool_materials", + "o": "minecraft:iron_ingot" }, "pattern": [ "WoW", diff --git a/data/minecraft/recipe/shulker_box.json b/data/minecraft/recipe/shulker_box.json index ae36ba9d..c7e9b4ca 100644 --- a/data/minecraft/recipe/shulker_box.json +++ b/data/minecraft/recipe/shulker_box.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "#": { - "item": "minecraft:chest" - }, - "-": { - "item": "minecraft:shulker_shell" - } + "#": "minecraft:chest", + "-": "minecraft:shulker_shell" }, "pattern": [ "-", diff --git a/data/minecraft/recipe/shulker_box_coloring.json b/data/minecraft/recipe/shulker_box_coloring.json deleted file mode 100644 index 21d4783c..00000000 --- a/data/minecraft/recipe/shulker_box_coloring.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "type": "minecraft:crafting_special_shulkerboxcoloring", - "category": "misc" -} \ No newline at end of file diff --git a/data/minecraft/recipe/silence_armor_trim_smithing_template.json b/data/minecraft/recipe/silence_armor_trim_smithing_template.json index f05d33ac..3b0d9079 100644 --- a/data/minecraft/recipe/silence_armor_trim_smithing_template.json +++ b/data/minecraft/recipe/silence_armor_trim_smithing_template.json @@ -2,15 +2,9 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "#": { - "item": "minecraft:diamond" - }, - "C": { - "item": "minecraft:cobbled_deepslate" - }, - "S": { - "item": "minecraft:silence_armor_trim_smithing_template" - } + "#": "minecraft:diamond", + "C": "minecraft:cobbled_deepslate", + "S": "minecraft:silence_armor_trim_smithing_template" }, "pattern": [ "#S#", diff --git a/data/minecraft/recipe/silence_armor_trim_smithing_template_smithing_trim.json b/data/minecraft/recipe/silence_armor_trim_smithing_template_smithing_trim.json index 0ca3d145..8917ace5 100644 --- a/data/minecraft/recipe/silence_armor_trim_smithing_template_smithing_trim.json +++ b/data/minecraft/recipe/silence_armor_trim_smithing_template_smithing_trim.json @@ -1,12 +1,6 @@ { "type": "minecraft:smithing_trim", - "addition": { - "tag": "minecraft:trim_materials" - }, - "base": { - "tag": "minecraft:trimmable_armor" - }, - "template": { - "item": "minecraft:silence_armor_trim_smithing_template" - } + "addition": "#minecraft:trim_materials", + "base": "#minecraft:trimmable_armor", + "template": "minecraft:silence_armor_trim_smithing_template" } \ No newline at end of file diff --git a/data/minecraft/recipe/skull_banner_pattern.json b/data/minecraft/recipe/skull_banner_pattern.json index 135f9a1b..1903d7ba 100644 --- a/data/minecraft/recipe/skull_banner_pattern.json +++ b/data/minecraft/recipe/skull_banner_pattern.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shapeless", "category": "misc", "ingredients": [ - { - "item": "minecraft:paper" - }, - { - "item": "minecraft:wither_skeleton_skull" - } + "minecraft:paper", + "minecraft:wither_skeleton_skull" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/slime_ball.json b/data/minecraft/recipe/slime_ball.json index fb3c0a3e..56993784 100644 --- a/data/minecraft/recipe/slime_ball.json +++ b/data/minecraft/recipe/slime_ball.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shapeless", "category": "misc", "ingredients": [ - { - "item": "minecraft:slime_block" - } + "minecraft:slime_block" ], "result": { "count": 9, diff --git a/data/minecraft/recipe/slime_block.json b/data/minecraft/recipe/slime_block.json index ba2d3be3..b044b2d7 100644 --- a/data/minecraft/recipe/slime_block.json +++ b/data/minecraft/recipe/slime_block.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "redstone", "key": { - "#": { - "item": "minecraft:slime_ball" - } + "#": "minecraft:slime_ball" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/smithing_table.json b/data/minecraft/recipe/smithing_table.json index 5be9a218..c1097ab3 100644 --- a/data/minecraft/recipe/smithing_table.json +++ b/data/minecraft/recipe/smithing_table.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "#": { - "tag": "minecraft:planks" - }, - "@": { - "item": "minecraft:iron_ingot" - } + "#": "#minecraft:planks", + "@": "minecraft:iron_ingot" }, "pattern": [ "@@", diff --git a/data/minecraft/recipe/smoker.json b/data/minecraft/recipe/smoker.json index a9966241..01661284 100644 --- a/data/minecraft/recipe/smoker.json +++ b/data/minecraft/recipe/smoker.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "#": { - "tag": "minecraft:logs" - }, - "X": { - "item": "minecraft:furnace" - } + "#": "#minecraft:logs", + "X": "minecraft:furnace" }, "pattern": [ " # ", diff --git a/data/minecraft/recipe/smooth_basalt.json b/data/minecraft/recipe/smooth_basalt.json index f594a027..614a592d 100644 --- a/data/minecraft/recipe/smooth_basalt.json +++ b/data/minecraft/recipe/smooth_basalt.json @@ -3,9 +3,7 @@ "category": "blocks", "cookingtime": 200, "experience": 0.1, - "ingredient": { - "item": "minecraft:basalt" - }, + "ingredient": "minecraft:basalt", "result": { "id": "minecraft:smooth_basalt" } diff --git a/data/minecraft/recipe/smooth_quartz.json b/data/minecraft/recipe/smooth_quartz.json index 003ca9af..3acfacc4 100644 --- a/data/minecraft/recipe/smooth_quartz.json +++ b/data/minecraft/recipe/smooth_quartz.json @@ -3,9 +3,7 @@ "category": "blocks", "cookingtime": 200, "experience": 0.1, - "ingredient": { - "item": "minecraft:quartz_block" - }, + "ingredient": "minecraft:quartz_block", "result": { "id": "minecraft:smooth_quartz" } diff --git a/data/minecraft/recipe/smooth_quartz_slab.json b/data/minecraft/recipe/smooth_quartz_slab.json index ff491613..afa8ab60 100644 --- a/data/minecraft/recipe/smooth_quartz_slab.json +++ b/data/minecraft/recipe/smooth_quartz_slab.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:smooth_quartz" - } + "#": "minecraft:smooth_quartz" }, "pattern": [ "###" diff --git a/data/minecraft/recipe/smooth_quartz_slab_from_smooth_quartz_stonecutting.json b/data/minecraft/recipe/smooth_quartz_slab_from_smooth_quartz_stonecutting.json index 8c7279be..9bbbee7c 100644 --- a/data/minecraft/recipe/smooth_quartz_slab_from_smooth_quartz_stonecutting.json +++ b/data/minecraft/recipe/smooth_quartz_slab_from_smooth_quartz_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:smooth_quartz" - }, + "ingredient": "minecraft:smooth_quartz", "result": { "count": 2, "id": "minecraft:smooth_quartz_slab" diff --git a/data/minecraft/recipe/smooth_quartz_stairs.json b/data/minecraft/recipe/smooth_quartz_stairs.json index c862c4ba..6c654436 100644 --- a/data/minecraft/recipe/smooth_quartz_stairs.json +++ b/data/minecraft/recipe/smooth_quartz_stairs.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:smooth_quartz" - } + "#": "minecraft:smooth_quartz" }, "pattern": [ "# ", diff --git a/data/minecraft/recipe/smooth_quartz_stairs_from_smooth_quartz_stonecutting.json b/data/minecraft/recipe/smooth_quartz_stairs_from_smooth_quartz_stonecutting.json index 1fa8bfc6..d4977e81 100644 --- a/data/minecraft/recipe/smooth_quartz_stairs_from_smooth_quartz_stonecutting.json +++ b/data/minecraft/recipe/smooth_quartz_stairs_from_smooth_quartz_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:smooth_quartz" - }, + "ingredient": "minecraft:smooth_quartz", "result": { "count": 1, "id": "minecraft:smooth_quartz_stairs" diff --git a/data/minecraft/recipe/smooth_red_sandstone.json b/data/minecraft/recipe/smooth_red_sandstone.json index c42c175e..bce6c3e1 100644 --- a/data/minecraft/recipe/smooth_red_sandstone.json +++ b/data/minecraft/recipe/smooth_red_sandstone.json @@ -3,9 +3,7 @@ "category": "blocks", "cookingtime": 200, "experience": 0.1, - "ingredient": { - "item": "minecraft:red_sandstone" - }, + "ingredient": "minecraft:red_sandstone", "result": { "id": "minecraft:smooth_red_sandstone" } diff --git a/data/minecraft/recipe/smooth_red_sandstone_slab.json b/data/minecraft/recipe/smooth_red_sandstone_slab.json index 71c1b318..5cfb7c92 100644 --- a/data/minecraft/recipe/smooth_red_sandstone_slab.json +++ b/data/minecraft/recipe/smooth_red_sandstone_slab.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:smooth_red_sandstone" - } + "#": "minecraft:smooth_red_sandstone" }, "pattern": [ "###" diff --git a/data/minecraft/recipe/smooth_red_sandstone_slab_from_smooth_red_sandstone_stonecutting.json b/data/minecraft/recipe/smooth_red_sandstone_slab_from_smooth_red_sandstone_stonecutting.json index 4883035a..3393a8b1 100644 --- a/data/minecraft/recipe/smooth_red_sandstone_slab_from_smooth_red_sandstone_stonecutting.json +++ b/data/minecraft/recipe/smooth_red_sandstone_slab_from_smooth_red_sandstone_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:smooth_red_sandstone" - }, + "ingredient": "minecraft:smooth_red_sandstone", "result": { "count": 2, "id": "minecraft:smooth_red_sandstone_slab" diff --git a/data/minecraft/recipe/smooth_red_sandstone_stairs.json b/data/minecraft/recipe/smooth_red_sandstone_stairs.json index 3712cec8..d8c67687 100644 --- a/data/minecraft/recipe/smooth_red_sandstone_stairs.json +++ b/data/minecraft/recipe/smooth_red_sandstone_stairs.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:smooth_red_sandstone" - } + "#": "minecraft:smooth_red_sandstone" }, "pattern": [ "# ", diff --git a/data/minecraft/recipe/smooth_red_sandstone_stairs_from_smooth_red_sandstone_stonecutting.json b/data/minecraft/recipe/smooth_red_sandstone_stairs_from_smooth_red_sandstone_stonecutting.json index 3fc8f25b..90b36e0f 100644 --- a/data/minecraft/recipe/smooth_red_sandstone_stairs_from_smooth_red_sandstone_stonecutting.json +++ b/data/minecraft/recipe/smooth_red_sandstone_stairs_from_smooth_red_sandstone_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:smooth_red_sandstone" - }, + "ingredient": "minecraft:smooth_red_sandstone", "result": { "count": 1, "id": "minecraft:smooth_red_sandstone_stairs" diff --git a/data/minecraft/recipe/smooth_sandstone.json b/data/minecraft/recipe/smooth_sandstone.json index fe4cc526..59690697 100644 --- a/data/minecraft/recipe/smooth_sandstone.json +++ b/data/minecraft/recipe/smooth_sandstone.json @@ -3,9 +3,7 @@ "category": "blocks", "cookingtime": 200, "experience": 0.1, - "ingredient": { - "item": "minecraft:sandstone" - }, + "ingredient": "minecraft:sandstone", "result": { "id": "minecraft:smooth_sandstone" } diff --git a/data/minecraft/recipe/smooth_sandstone_slab.json b/data/minecraft/recipe/smooth_sandstone_slab.json index 17e6bf5d..0ea7133e 100644 --- a/data/minecraft/recipe/smooth_sandstone_slab.json +++ b/data/minecraft/recipe/smooth_sandstone_slab.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:smooth_sandstone" - } + "#": "minecraft:smooth_sandstone" }, "pattern": [ "###" diff --git a/data/minecraft/recipe/smooth_sandstone_slab_from_smooth_sandstone_stonecutting.json b/data/minecraft/recipe/smooth_sandstone_slab_from_smooth_sandstone_stonecutting.json index 7ce33786..7caa3aec 100644 --- a/data/minecraft/recipe/smooth_sandstone_slab_from_smooth_sandstone_stonecutting.json +++ b/data/minecraft/recipe/smooth_sandstone_slab_from_smooth_sandstone_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:smooth_sandstone" - }, + "ingredient": "minecraft:smooth_sandstone", "result": { "count": 2, "id": "minecraft:smooth_sandstone_slab" diff --git a/data/minecraft/recipe/smooth_sandstone_stairs.json b/data/minecraft/recipe/smooth_sandstone_stairs.json index 32b7b6d3..0d45df20 100644 --- a/data/minecraft/recipe/smooth_sandstone_stairs.json +++ b/data/minecraft/recipe/smooth_sandstone_stairs.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:smooth_sandstone" - } + "#": "minecraft:smooth_sandstone" }, "pattern": [ "# ", diff --git a/data/minecraft/recipe/smooth_sandstone_stairs_from_smooth_sandstone_stonecutting.json b/data/minecraft/recipe/smooth_sandstone_stairs_from_smooth_sandstone_stonecutting.json index 18ed9bdd..938176a2 100644 --- a/data/minecraft/recipe/smooth_sandstone_stairs_from_smooth_sandstone_stonecutting.json +++ b/data/minecraft/recipe/smooth_sandstone_stairs_from_smooth_sandstone_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:smooth_sandstone" - }, + "ingredient": "minecraft:smooth_sandstone", "result": { "count": 1, "id": "minecraft:smooth_sandstone_stairs" diff --git a/data/minecraft/recipe/smooth_stone.json b/data/minecraft/recipe/smooth_stone.json index 16782810..50bccf73 100644 --- a/data/minecraft/recipe/smooth_stone.json +++ b/data/minecraft/recipe/smooth_stone.json @@ -3,9 +3,7 @@ "category": "blocks", "cookingtime": 200, "experience": 0.1, - "ingredient": { - "item": "minecraft:stone" - }, + "ingredient": "minecraft:stone", "result": { "id": "minecraft:smooth_stone" } diff --git a/data/minecraft/recipe/smooth_stone_slab.json b/data/minecraft/recipe/smooth_stone_slab.json index 641a012b..d1ea0a20 100644 --- a/data/minecraft/recipe/smooth_stone_slab.json +++ b/data/minecraft/recipe/smooth_stone_slab.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:smooth_stone" - } + "#": "minecraft:smooth_stone" }, "pattern": [ "###" diff --git a/data/minecraft/recipe/smooth_stone_slab_from_smooth_stone_stonecutting.json b/data/minecraft/recipe/smooth_stone_slab_from_smooth_stone_stonecutting.json index 01e6876b..e375f2b4 100644 --- a/data/minecraft/recipe/smooth_stone_slab_from_smooth_stone_stonecutting.json +++ b/data/minecraft/recipe/smooth_stone_slab_from_smooth_stone_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:smooth_stone" - }, + "ingredient": "minecraft:smooth_stone", "result": { "count": 2, "id": "minecraft:smooth_stone_slab" diff --git a/data/minecraft/recipe/snout_armor_trim_smithing_template.json b/data/minecraft/recipe/snout_armor_trim_smithing_template.json index 711ae3c5..2a7d4c6f 100644 --- a/data/minecraft/recipe/snout_armor_trim_smithing_template.json +++ b/data/minecraft/recipe/snout_armor_trim_smithing_template.json @@ -2,15 +2,9 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "#": { - "item": "minecraft:diamond" - }, - "C": { - "item": "minecraft:blackstone" - }, - "S": { - "item": "minecraft:snout_armor_trim_smithing_template" - } + "#": "minecraft:diamond", + "C": "minecraft:blackstone", + "S": "minecraft:snout_armor_trim_smithing_template" }, "pattern": [ "#S#", diff --git a/data/minecraft/recipe/snout_armor_trim_smithing_template_smithing_trim.json b/data/minecraft/recipe/snout_armor_trim_smithing_template_smithing_trim.json index 8450f8f5..88d0dd13 100644 --- a/data/minecraft/recipe/snout_armor_trim_smithing_template_smithing_trim.json +++ b/data/minecraft/recipe/snout_armor_trim_smithing_template_smithing_trim.json @@ -1,12 +1,6 @@ { "type": "minecraft:smithing_trim", - "addition": { - "tag": "minecraft:trim_materials" - }, - "base": { - "tag": "minecraft:trimmable_armor" - }, - "template": { - "item": "minecraft:snout_armor_trim_smithing_template" - } + "addition": "#minecraft:trim_materials", + "base": "#minecraft:trimmable_armor", + "template": "minecraft:snout_armor_trim_smithing_template" } \ No newline at end of file diff --git a/data/minecraft/recipe/snow.json b/data/minecraft/recipe/snow.json index ea033ff8..81172bb6 100644 --- a/data/minecraft/recipe/snow.json +++ b/data/minecraft/recipe/snow.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "#": { - "item": "minecraft:snow_block" - } + "#": "minecraft:snow_block" }, "pattern": [ "###" diff --git a/data/minecraft/recipe/snow_block.json b/data/minecraft/recipe/snow_block.json index 10b6d1fe..6d469274 100644 --- a/data/minecraft/recipe/snow_block.json +++ b/data/minecraft/recipe/snow_block.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:snowball" - } + "#": "minecraft:snowball" }, "pattern": [ "##", diff --git a/data/minecraft/recipe/soul_campfire.json b/data/minecraft/recipe/soul_campfire.json index aab9e25b..b520e49e 100644 --- a/data/minecraft/recipe/soul_campfire.json +++ b/data/minecraft/recipe/soul_campfire.json @@ -2,15 +2,9 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "#": { - "tag": "minecraft:soul_fire_base_blocks" - }, - "L": { - "tag": "minecraft:logs" - }, - "S": { - "item": "minecraft:stick" - } + "#": "#minecraft:soul_fire_base_blocks", + "L": "#minecraft:logs", + "S": "minecraft:stick" }, "pattern": [ " S ", diff --git a/data/minecraft/recipe/soul_lantern.json b/data/minecraft/recipe/soul_lantern.json index e3bfc790..1ff55f4c 100644 --- a/data/minecraft/recipe/soul_lantern.json +++ b/data/minecraft/recipe/soul_lantern.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "#": { - "item": "minecraft:soul_torch" - }, - "X": { - "item": "minecraft:iron_nugget" - } + "#": "minecraft:soul_torch", + "X": "minecraft:iron_nugget" }, "pattern": [ "XXX", diff --git a/data/minecraft/recipe/soul_torch.json b/data/minecraft/recipe/soul_torch.json index f61013f5..4dace025 100644 --- a/data/minecraft/recipe/soul_torch.json +++ b/data/minecraft/recipe/soul_torch.json @@ -2,19 +2,11 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "#": { - "item": "minecraft:stick" - }, - "S": { - "tag": "minecraft:soul_fire_base_blocks" - }, + "#": "minecraft:stick", + "S": "#minecraft:soul_fire_base_blocks", "X": [ - { - "item": "minecraft:coal" - }, - { - "item": "minecraft:charcoal" - } + "minecraft:coal", + "minecraft:charcoal" ] }, "pattern": [ diff --git a/data/minecraft/recipe/spectral_arrow.json b/data/minecraft/recipe/spectral_arrow.json index 5e6eabe1..99d9dfb0 100644 --- a/data/minecraft/recipe/spectral_arrow.json +++ b/data/minecraft/recipe/spectral_arrow.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shaped", "category": "equipment", "key": { - "#": { - "item": "minecraft:glowstone_dust" - }, - "X": { - "item": "minecraft:arrow" - } + "#": "minecraft:glowstone_dust", + "X": "minecraft:arrow" }, "pattern": [ " # ", diff --git a/data/minecraft/recipe/spire_armor_trim_smithing_template.json b/data/minecraft/recipe/spire_armor_trim_smithing_template.json index 698ce6f7..e31c2323 100644 --- a/data/minecraft/recipe/spire_armor_trim_smithing_template.json +++ b/data/minecraft/recipe/spire_armor_trim_smithing_template.json @@ -2,15 +2,9 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "#": { - "item": "minecraft:diamond" - }, - "C": { - "item": "minecraft:purpur_block" - }, - "S": { - "item": "minecraft:spire_armor_trim_smithing_template" - } + "#": "minecraft:diamond", + "C": "minecraft:purpur_block", + "S": "minecraft:spire_armor_trim_smithing_template" }, "pattern": [ "#S#", diff --git a/data/minecraft/recipe/spire_armor_trim_smithing_template_smithing_trim.json b/data/minecraft/recipe/spire_armor_trim_smithing_template_smithing_trim.json index c3ce1c5c..628e1720 100644 --- a/data/minecraft/recipe/spire_armor_trim_smithing_template_smithing_trim.json +++ b/data/minecraft/recipe/spire_armor_trim_smithing_template_smithing_trim.json @@ -1,12 +1,6 @@ { "type": "minecraft:smithing_trim", - "addition": { - "tag": "minecraft:trim_materials" - }, - "base": { - "tag": "minecraft:trimmable_armor" - }, - "template": { - "item": "minecraft:spire_armor_trim_smithing_template" - } + "addition": "#minecraft:trim_materials", + "base": "#minecraft:trimmable_armor", + "template": "minecraft:spire_armor_trim_smithing_template" } \ No newline at end of file diff --git a/data/minecraft/recipe/sponge.json b/data/minecraft/recipe/sponge.json index 5ace4580..3f555745 100644 --- a/data/minecraft/recipe/sponge.json +++ b/data/minecraft/recipe/sponge.json @@ -3,9 +3,7 @@ "category": "blocks", "cookingtime": 200, "experience": 0.15, - "ingredient": { - "item": "minecraft:wet_sponge" - }, + "ingredient": "minecraft:wet_sponge", "result": { "id": "minecraft:sponge" } diff --git a/data/minecraft/recipe/spruce_boat.json b/data/minecraft/recipe/spruce_boat.json index d7b1e8b5..865acfd3 100644 --- a/data/minecraft/recipe/spruce_boat.json +++ b/data/minecraft/recipe/spruce_boat.json @@ -3,9 +3,7 @@ "category": "misc", "group": "boat", "key": { - "#": { - "item": "minecraft:spruce_planks" - } + "#": "minecraft:spruce_planks" }, "pattern": [ "# #", diff --git a/data/minecraft/recipe/spruce_button.json b/data/minecraft/recipe/spruce_button.json index f4312533..825156d9 100644 --- a/data/minecraft/recipe/spruce_button.json +++ b/data/minecraft/recipe/spruce_button.json @@ -3,9 +3,7 @@ "category": "redstone", "group": "wooden_button", "ingredients": [ - { - "item": "minecraft:spruce_planks" - } + "minecraft:spruce_planks" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/spruce_chest_boat.json b/data/minecraft/recipe/spruce_chest_boat.json index 21e5d4f5..b4667d86 100644 --- a/data/minecraft/recipe/spruce_chest_boat.json +++ b/data/minecraft/recipe/spruce_chest_boat.json @@ -3,12 +3,8 @@ "category": "misc", "group": "chest_boat", "ingredients": [ - { - "item": "minecraft:chest" - }, - { - "item": "minecraft:spruce_boat" - } + "minecraft:chest", + "minecraft:spruce_boat" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/spruce_door.json b/data/minecraft/recipe/spruce_door.json index ccb9a390..0022b71e 100644 --- a/data/minecraft/recipe/spruce_door.json +++ b/data/minecraft/recipe/spruce_door.json @@ -3,9 +3,7 @@ "category": "redstone", "group": "wooden_door", "key": { - "#": { - "item": "minecraft:spruce_planks" - } + "#": "minecraft:spruce_planks" }, "pattern": [ "##", diff --git a/data/minecraft/recipe/spruce_fence.json b/data/minecraft/recipe/spruce_fence.json index c6b37439..b6707eb7 100644 --- a/data/minecraft/recipe/spruce_fence.json +++ b/data/minecraft/recipe/spruce_fence.json @@ -3,12 +3,8 @@ "category": "misc", "group": "wooden_fence", "key": { - "#": { - "item": "minecraft:stick" - }, - "W": { - "item": "minecraft:spruce_planks" - } + "#": "minecraft:stick", + "W": "minecraft:spruce_planks" }, "pattern": [ "W#W", diff --git a/data/minecraft/recipe/spruce_fence_gate.json b/data/minecraft/recipe/spruce_fence_gate.json index 2320f30e..45f81259 100644 --- a/data/minecraft/recipe/spruce_fence_gate.json +++ b/data/minecraft/recipe/spruce_fence_gate.json @@ -3,12 +3,8 @@ "category": "redstone", "group": "wooden_fence_gate", "key": { - "#": { - "item": "minecraft:stick" - }, - "W": { - "item": "minecraft:spruce_planks" - } + "#": "minecraft:stick", + "W": "minecraft:spruce_planks" }, "pattern": [ "#W#", diff --git a/data/minecraft/recipe/spruce_hanging_sign.json b/data/minecraft/recipe/spruce_hanging_sign.json index 5a7029a7..6a4a655c 100644 --- a/data/minecraft/recipe/spruce_hanging_sign.json +++ b/data/minecraft/recipe/spruce_hanging_sign.json @@ -3,12 +3,8 @@ "category": "misc", "group": "hanging_sign", "key": { - "#": { - "item": "minecraft:stripped_spruce_log" - }, - "X": { - "item": "minecraft:chain" - } + "#": "minecraft:stripped_spruce_log", + "X": "minecraft:chain" }, "pattern": [ "X X", diff --git a/data/minecraft/recipe/spruce_planks.json b/data/minecraft/recipe/spruce_planks.json index d5277931..3609f5fd 100644 --- a/data/minecraft/recipe/spruce_planks.json +++ b/data/minecraft/recipe/spruce_planks.json @@ -3,9 +3,7 @@ "category": "building", "group": "planks", "ingredients": [ - { - "tag": "minecraft:spruce_logs" - } + "#minecraft:spruce_logs" ], "result": { "count": 4, diff --git a/data/minecraft/recipe/spruce_pressure_plate.json b/data/minecraft/recipe/spruce_pressure_plate.json index 7d7626c5..cce768b5 100644 --- a/data/minecraft/recipe/spruce_pressure_plate.json +++ b/data/minecraft/recipe/spruce_pressure_plate.json @@ -3,9 +3,7 @@ "category": "redstone", "group": "wooden_pressure_plate", "key": { - "#": { - "item": "minecraft:spruce_planks" - } + "#": "minecraft:spruce_planks" }, "pattern": [ "##" diff --git a/data/minecraft/recipe/spruce_sign.json b/data/minecraft/recipe/spruce_sign.json index 0e06445d..b12bc5ab 100644 --- a/data/minecraft/recipe/spruce_sign.json +++ b/data/minecraft/recipe/spruce_sign.json @@ -3,12 +3,8 @@ "category": "misc", "group": "wooden_sign", "key": { - "#": { - "item": "minecraft:spruce_planks" - }, - "X": { - "item": "minecraft:stick" - } + "#": "minecraft:spruce_planks", + "X": "minecraft:stick" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/spruce_slab.json b/data/minecraft/recipe/spruce_slab.json index 3b4fcaa4..abe2810c 100644 --- a/data/minecraft/recipe/spruce_slab.json +++ b/data/minecraft/recipe/spruce_slab.json @@ -3,9 +3,7 @@ "category": "building", "group": "wooden_slab", "key": { - "#": { - "item": "minecraft:spruce_planks" - } + "#": "minecraft:spruce_planks" }, "pattern": [ "###" diff --git a/data/minecraft/recipe/spruce_stairs.json b/data/minecraft/recipe/spruce_stairs.json index 19d9d0c0..b8e08cee 100644 --- a/data/minecraft/recipe/spruce_stairs.json +++ b/data/minecraft/recipe/spruce_stairs.json @@ -3,9 +3,7 @@ "category": "building", "group": "wooden_stairs", "key": { - "#": { - "item": "minecraft:spruce_planks" - } + "#": "minecraft:spruce_planks" }, "pattern": [ "# ", diff --git a/data/minecraft/recipe/spruce_trapdoor.json b/data/minecraft/recipe/spruce_trapdoor.json index 124e3d9c..ec878a63 100644 --- a/data/minecraft/recipe/spruce_trapdoor.json +++ b/data/minecraft/recipe/spruce_trapdoor.json @@ -3,9 +3,7 @@ "category": "redstone", "group": "wooden_trapdoor", "key": { - "#": { - "item": "minecraft:spruce_planks" - } + "#": "minecraft:spruce_planks" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/spruce_wood.json b/data/minecraft/recipe/spruce_wood.json index 1bb2dc4b..406d0f36 100644 --- a/data/minecraft/recipe/spruce_wood.json +++ b/data/minecraft/recipe/spruce_wood.json @@ -3,9 +3,7 @@ "category": "building", "group": "bark", "key": { - "#": { - "item": "minecraft:spruce_log" - } + "#": "minecraft:spruce_log" }, "pattern": [ "##", diff --git a/data/minecraft/recipe/spyglass.json b/data/minecraft/recipe/spyglass.json index 79d1ab2c..51bddbef 100644 --- a/data/minecraft/recipe/spyglass.json +++ b/data/minecraft/recipe/spyglass.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shaped", "category": "equipment", "key": { - "#": { - "item": "minecraft:amethyst_shard" - }, - "X": { - "item": "minecraft:copper_ingot" - } + "#": "minecraft:amethyst_shard", + "X": "minecraft:copper_ingot" }, "pattern": [ " # ", diff --git a/data/minecraft/recipe/stick.json b/data/minecraft/recipe/stick.json index cae5e52a..601a1fb4 100644 --- a/data/minecraft/recipe/stick.json +++ b/data/minecraft/recipe/stick.json @@ -3,9 +3,7 @@ "category": "misc", "group": "sticks", "key": { - "#": { - "tag": "minecraft:planks" - } + "#": "#minecraft:planks" }, "pattern": [ "#", diff --git a/data/minecraft/recipe/stick_from_bamboo_item.json b/data/minecraft/recipe/stick_from_bamboo_item.json index 8bd43124..7500b440 100644 --- a/data/minecraft/recipe/stick_from_bamboo_item.json +++ b/data/minecraft/recipe/stick_from_bamboo_item.json @@ -3,9 +3,7 @@ "category": "misc", "group": "sticks", "key": { - "#": { - "item": "minecraft:bamboo" - } + "#": "minecraft:bamboo" }, "pattern": [ "#", diff --git a/data/minecraft/recipe/sticky_piston.json b/data/minecraft/recipe/sticky_piston.json index a24955ff..fa9a643d 100644 --- a/data/minecraft/recipe/sticky_piston.json +++ b/data/minecraft/recipe/sticky_piston.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shaped", "category": "redstone", "key": { - "P": { - "item": "minecraft:piston" - }, - "S": { - "item": "minecraft:slime_ball" - } + "P": "minecraft:piston", + "S": "minecraft:slime_ball" }, "pattern": [ "S", diff --git a/data/minecraft/recipe/stone.json b/data/minecraft/recipe/stone.json index e16a0d0a..39e4d276 100644 --- a/data/minecraft/recipe/stone.json +++ b/data/minecraft/recipe/stone.json @@ -3,9 +3,7 @@ "category": "blocks", "cookingtime": 200, "experience": 0.1, - "ingredient": { - "item": "minecraft:cobblestone" - }, + "ingredient": "minecraft:cobblestone", "result": { "id": "minecraft:stone" } diff --git a/data/minecraft/recipe/stone_axe.json b/data/minecraft/recipe/stone_axe.json index 1de18e38..d2e49c27 100644 --- a/data/minecraft/recipe/stone_axe.json +++ b/data/minecraft/recipe/stone_axe.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shaped", "category": "equipment", "key": { - "#": { - "item": "minecraft:stick" - }, - "X": { - "tag": "minecraft:stone_tool_materials" - } + "#": "minecraft:stick", + "X": "#minecraft:stone_tool_materials" }, "pattern": [ "XX", diff --git a/data/minecraft/recipe/stone_brick_slab.json b/data/minecraft/recipe/stone_brick_slab.json index 24819921..e5d8e454 100644 --- a/data/minecraft/recipe/stone_brick_slab.json +++ b/data/minecraft/recipe/stone_brick_slab.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:stone_bricks" - } + "#": "minecraft:stone_bricks" }, "pattern": [ "###" diff --git a/data/minecraft/recipe/stone_brick_slab_from_stone_bricks_stonecutting.json b/data/minecraft/recipe/stone_brick_slab_from_stone_bricks_stonecutting.json index e56107e0..705c851b 100644 --- a/data/minecraft/recipe/stone_brick_slab_from_stone_bricks_stonecutting.json +++ b/data/minecraft/recipe/stone_brick_slab_from_stone_bricks_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:stone_bricks" - }, + "ingredient": "minecraft:stone_bricks", "result": { "count": 2, "id": "minecraft:stone_brick_slab" diff --git a/data/minecraft/recipe/stone_brick_slab_from_stone_stonecutting.json b/data/minecraft/recipe/stone_brick_slab_from_stone_stonecutting.json index 7a34cb85..50a0a49a 100644 --- a/data/minecraft/recipe/stone_brick_slab_from_stone_stonecutting.json +++ b/data/minecraft/recipe/stone_brick_slab_from_stone_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:stone" - }, + "ingredient": "minecraft:stone", "result": { "count": 2, "id": "minecraft:stone_brick_slab" diff --git a/data/minecraft/recipe/stone_brick_stairs.json b/data/minecraft/recipe/stone_brick_stairs.json index 9c9ba7f9..f903839c 100644 --- a/data/minecraft/recipe/stone_brick_stairs.json +++ b/data/minecraft/recipe/stone_brick_stairs.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:stone_bricks" - } + "#": "minecraft:stone_bricks" }, "pattern": [ "# ", diff --git a/data/minecraft/recipe/stone_brick_stairs_from_stone_bricks_stonecutting.json b/data/minecraft/recipe/stone_brick_stairs_from_stone_bricks_stonecutting.json index bba72b15..d7d64576 100644 --- a/data/minecraft/recipe/stone_brick_stairs_from_stone_bricks_stonecutting.json +++ b/data/minecraft/recipe/stone_brick_stairs_from_stone_bricks_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:stone_bricks" - }, + "ingredient": "minecraft:stone_bricks", "result": { "count": 1, "id": "minecraft:stone_brick_stairs" diff --git a/data/minecraft/recipe/stone_brick_stairs_from_stone_stonecutting.json b/data/minecraft/recipe/stone_brick_stairs_from_stone_stonecutting.json index a640ba4e..fb2e2b85 100644 --- a/data/minecraft/recipe/stone_brick_stairs_from_stone_stonecutting.json +++ b/data/minecraft/recipe/stone_brick_stairs_from_stone_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:stone" - }, + "ingredient": "minecraft:stone", "result": { "count": 1, "id": "minecraft:stone_brick_stairs" diff --git a/data/minecraft/recipe/stone_brick_wall.json b/data/minecraft/recipe/stone_brick_wall.json index de144c56..c24f8ee5 100644 --- a/data/minecraft/recipe/stone_brick_wall.json +++ b/data/minecraft/recipe/stone_brick_wall.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "#": { - "item": "minecraft:stone_bricks" - } + "#": "minecraft:stone_bricks" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/stone_brick_wall_from_stone_bricks_stonecutting.json b/data/minecraft/recipe/stone_brick_wall_from_stone_bricks_stonecutting.json index b36f84d1..2d7d3eec 100644 --- a/data/minecraft/recipe/stone_brick_wall_from_stone_bricks_stonecutting.json +++ b/data/minecraft/recipe/stone_brick_wall_from_stone_bricks_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:stone_bricks" - }, + "ingredient": "minecraft:stone_bricks", "result": { "count": 1, "id": "minecraft:stone_brick_wall" diff --git a/data/minecraft/recipe/stone_brick_walls_from_stone_stonecutting.json b/data/minecraft/recipe/stone_brick_walls_from_stone_stonecutting.json index 9d2a2ce9..034df199 100644 --- a/data/minecraft/recipe/stone_brick_walls_from_stone_stonecutting.json +++ b/data/minecraft/recipe/stone_brick_walls_from_stone_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:stone" - }, + "ingredient": "minecraft:stone", "result": { "count": 1, "id": "minecraft:stone_brick_wall" diff --git a/data/minecraft/recipe/stone_bricks.json b/data/minecraft/recipe/stone_bricks.json index 3dfbecac..d665b2b3 100644 --- a/data/minecraft/recipe/stone_bricks.json +++ b/data/minecraft/recipe/stone_bricks.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:stone" - } + "#": "minecraft:stone" }, "pattern": [ "##", diff --git a/data/minecraft/recipe/stone_bricks_from_stone_stonecutting.json b/data/minecraft/recipe/stone_bricks_from_stone_stonecutting.json index 8a9567e0..fb762b47 100644 --- a/data/minecraft/recipe/stone_bricks_from_stone_stonecutting.json +++ b/data/minecraft/recipe/stone_bricks_from_stone_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:stone" - }, + "ingredient": "minecraft:stone", "result": { "count": 1, "id": "minecraft:stone_bricks" diff --git a/data/minecraft/recipe/stone_button.json b/data/minecraft/recipe/stone_button.json index 69f3d243..83409fef 100644 --- a/data/minecraft/recipe/stone_button.json +++ b/data/minecraft/recipe/stone_button.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shapeless", "category": "redstone", "ingredients": [ - { - "item": "minecraft:stone" - } + "minecraft:stone" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/stone_hoe.json b/data/minecraft/recipe/stone_hoe.json index 87391a19..e8d18bdc 100644 --- a/data/minecraft/recipe/stone_hoe.json +++ b/data/minecraft/recipe/stone_hoe.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shaped", "category": "equipment", "key": { - "#": { - "item": "minecraft:stick" - }, - "X": { - "tag": "minecraft:stone_tool_materials" - } + "#": "minecraft:stick", + "X": "#minecraft:stone_tool_materials" }, "pattern": [ "XX", diff --git a/data/minecraft/recipe/stone_pickaxe.json b/data/minecraft/recipe/stone_pickaxe.json index f86f2076..04581b82 100644 --- a/data/minecraft/recipe/stone_pickaxe.json +++ b/data/minecraft/recipe/stone_pickaxe.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shaped", "category": "equipment", "key": { - "#": { - "item": "minecraft:stick" - }, - "X": { - "tag": "minecraft:stone_tool_materials" - } + "#": "minecraft:stick", + "X": "#minecraft:stone_tool_materials" }, "pattern": [ "XXX", diff --git a/data/minecraft/recipe/stone_pressure_plate.json b/data/minecraft/recipe/stone_pressure_plate.json index 5ed08a50..879a7210 100644 --- a/data/minecraft/recipe/stone_pressure_plate.json +++ b/data/minecraft/recipe/stone_pressure_plate.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "redstone", "key": { - "#": { - "item": "minecraft:stone" - } + "#": "minecraft:stone" }, "pattern": [ "##" diff --git a/data/minecraft/recipe/stone_shovel.json b/data/minecraft/recipe/stone_shovel.json index f2eb9d66..57a49e4c 100644 --- a/data/minecraft/recipe/stone_shovel.json +++ b/data/minecraft/recipe/stone_shovel.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shaped", "category": "equipment", "key": { - "#": { - "item": "minecraft:stick" - }, - "X": { - "tag": "minecraft:stone_tool_materials" - } + "#": "minecraft:stick", + "X": "#minecraft:stone_tool_materials" }, "pattern": [ "X", diff --git a/data/minecraft/recipe/stone_slab.json b/data/minecraft/recipe/stone_slab.json index faf55c2f..a806dd95 100644 --- a/data/minecraft/recipe/stone_slab.json +++ b/data/minecraft/recipe/stone_slab.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:stone" - } + "#": "minecraft:stone" }, "pattern": [ "###" diff --git a/data/minecraft/recipe/stone_slab_from_stone_stonecutting.json b/data/minecraft/recipe/stone_slab_from_stone_stonecutting.json index 3542f7c1..930b82dc 100644 --- a/data/minecraft/recipe/stone_slab_from_stone_stonecutting.json +++ b/data/minecraft/recipe/stone_slab_from_stone_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:stone" - }, + "ingredient": "minecraft:stone", "result": { "count": 2, "id": "minecraft:stone_slab" diff --git a/data/minecraft/recipe/stone_stairs.json b/data/minecraft/recipe/stone_stairs.json index 1012f5cd..9303ad94 100644 --- a/data/minecraft/recipe/stone_stairs.json +++ b/data/minecraft/recipe/stone_stairs.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:stone" - } + "#": "minecraft:stone" }, "pattern": [ "# ", diff --git a/data/minecraft/recipe/stone_stairs_from_stone_stonecutting.json b/data/minecraft/recipe/stone_stairs_from_stone_stonecutting.json index d7ae1ccf..fa19fe51 100644 --- a/data/minecraft/recipe/stone_stairs_from_stone_stonecutting.json +++ b/data/minecraft/recipe/stone_stairs_from_stone_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:stone" - }, + "ingredient": "minecraft:stone", "result": { "count": 1, "id": "minecraft:stone_stairs" diff --git a/data/minecraft/recipe/stone_sword.json b/data/minecraft/recipe/stone_sword.json index 73fa937d..86362a09 100644 --- a/data/minecraft/recipe/stone_sword.json +++ b/data/minecraft/recipe/stone_sword.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shaped", "category": "equipment", "key": { - "#": { - "item": "minecraft:stick" - }, - "X": { - "tag": "minecraft:stone_tool_materials" - } + "#": "minecraft:stick", + "X": "#minecraft:stone_tool_materials" }, "pattern": [ "X", diff --git a/data/minecraft/recipe/stonecutter.json b/data/minecraft/recipe/stonecutter.json index dabaafe5..baab6de8 100644 --- a/data/minecraft/recipe/stonecutter.json +++ b/data/minecraft/recipe/stonecutter.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "#": { - "item": "minecraft:stone" - }, - "I": { - "item": "minecraft:iron_ingot" - } + "#": "minecraft:stone", + "I": "minecraft:iron_ingot" }, "pattern": [ " I ", diff --git a/data/minecraft/recipe/stripped_acacia_wood.json b/data/minecraft/recipe/stripped_acacia_wood.json index 6e983d7d..5c2d6c30 100644 --- a/data/minecraft/recipe/stripped_acacia_wood.json +++ b/data/minecraft/recipe/stripped_acacia_wood.json @@ -3,9 +3,7 @@ "category": "building", "group": "bark", "key": { - "#": { - "item": "minecraft:stripped_acacia_log" - } + "#": "minecraft:stripped_acacia_log" }, "pattern": [ "##", diff --git a/data/minecraft/recipe/stripped_birch_wood.json b/data/minecraft/recipe/stripped_birch_wood.json index 780e818f..c8e20c51 100644 --- a/data/minecraft/recipe/stripped_birch_wood.json +++ b/data/minecraft/recipe/stripped_birch_wood.json @@ -3,9 +3,7 @@ "category": "building", "group": "bark", "key": { - "#": { - "item": "minecraft:stripped_birch_log" - } + "#": "minecraft:stripped_birch_log" }, "pattern": [ "##", diff --git a/data/minecraft/recipe/stripped_cherry_wood.json b/data/minecraft/recipe/stripped_cherry_wood.json index 2d2c53b7..bd09789f 100644 --- a/data/minecraft/recipe/stripped_cherry_wood.json +++ b/data/minecraft/recipe/stripped_cherry_wood.json @@ -3,9 +3,7 @@ "category": "building", "group": "bark", "key": { - "#": { - "item": "minecraft:stripped_cherry_log" - } + "#": "minecraft:stripped_cherry_log" }, "pattern": [ "##", diff --git a/data/minecraft/recipe/stripped_crimson_hyphae.json b/data/minecraft/recipe/stripped_crimson_hyphae.json index dc4eecb8..4fd4c73b 100644 --- a/data/minecraft/recipe/stripped_crimson_hyphae.json +++ b/data/minecraft/recipe/stripped_crimson_hyphae.json @@ -3,9 +3,7 @@ "category": "building", "group": "bark", "key": { - "#": { - "item": "minecraft:stripped_crimson_stem" - } + "#": "minecraft:stripped_crimson_stem" }, "pattern": [ "##", diff --git a/data/minecraft/recipe/stripped_dark_oak_wood.json b/data/minecraft/recipe/stripped_dark_oak_wood.json index a59037ec..57bd48d5 100644 --- a/data/minecraft/recipe/stripped_dark_oak_wood.json +++ b/data/minecraft/recipe/stripped_dark_oak_wood.json @@ -3,9 +3,7 @@ "category": "building", "group": "bark", "key": { - "#": { - "item": "minecraft:stripped_dark_oak_log" - } + "#": "minecraft:stripped_dark_oak_log" }, "pattern": [ "##", diff --git a/data/minecraft/recipe/stripped_jungle_wood.json b/data/minecraft/recipe/stripped_jungle_wood.json index a238dc42..f555d670 100644 --- a/data/minecraft/recipe/stripped_jungle_wood.json +++ b/data/minecraft/recipe/stripped_jungle_wood.json @@ -3,9 +3,7 @@ "category": "building", "group": "bark", "key": { - "#": { - "item": "minecraft:stripped_jungle_log" - } + "#": "minecraft:stripped_jungle_log" }, "pattern": [ "##", diff --git a/data/minecraft/recipe/stripped_mangrove_wood.json b/data/minecraft/recipe/stripped_mangrove_wood.json index 2c46cf28..ffae85f8 100644 --- a/data/minecraft/recipe/stripped_mangrove_wood.json +++ b/data/minecraft/recipe/stripped_mangrove_wood.json @@ -3,9 +3,7 @@ "category": "building", "group": "bark", "key": { - "#": { - "item": "minecraft:stripped_mangrove_log" - } + "#": "minecraft:stripped_mangrove_log" }, "pattern": [ "##", diff --git a/data/minecraft/recipe/stripped_oak_wood.json b/data/minecraft/recipe/stripped_oak_wood.json index 0b7ce6d5..04844761 100644 --- a/data/minecraft/recipe/stripped_oak_wood.json +++ b/data/minecraft/recipe/stripped_oak_wood.json @@ -3,9 +3,7 @@ "category": "building", "group": "bark", "key": { - "#": { - "item": "minecraft:stripped_oak_log" - } + "#": "minecraft:stripped_oak_log" }, "pattern": [ "##", diff --git a/data/minecraft/recipe/stripped_spruce_wood.json b/data/minecraft/recipe/stripped_spruce_wood.json index ce9a7496..6829fc6f 100644 --- a/data/minecraft/recipe/stripped_spruce_wood.json +++ b/data/minecraft/recipe/stripped_spruce_wood.json @@ -3,9 +3,7 @@ "category": "building", "group": "bark", "key": { - "#": { - "item": "minecraft:stripped_spruce_log" - } + "#": "minecraft:stripped_spruce_log" }, "pattern": [ "##", diff --git a/data/minecraft/recipe/stripped_warped_hyphae.json b/data/minecraft/recipe/stripped_warped_hyphae.json index 8b64f662..0efb427b 100644 --- a/data/minecraft/recipe/stripped_warped_hyphae.json +++ b/data/minecraft/recipe/stripped_warped_hyphae.json @@ -3,9 +3,7 @@ "category": "building", "group": "bark", "key": { - "#": { - "item": "minecraft:stripped_warped_stem" - } + "#": "minecraft:stripped_warped_stem" }, "pattern": [ "##", diff --git a/data/minecraft/recipe/sugar_from_honey_bottle.json b/data/minecraft/recipe/sugar_from_honey_bottle.json index cc050f1a..5f80f223 100644 --- a/data/minecraft/recipe/sugar_from_honey_bottle.json +++ b/data/minecraft/recipe/sugar_from_honey_bottle.json @@ -3,9 +3,7 @@ "category": "misc", "group": "sugar", "ingredients": [ - { - "item": "minecraft:honey_bottle" - } + "minecraft:honey_bottle" ], "result": { "count": 3, diff --git a/data/minecraft/recipe/sugar_from_sugar_cane.json b/data/minecraft/recipe/sugar_from_sugar_cane.json index 51f85370..541485f2 100644 --- a/data/minecraft/recipe/sugar_from_sugar_cane.json +++ b/data/minecraft/recipe/sugar_from_sugar_cane.json @@ -3,9 +3,7 @@ "category": "misc", "group": "sugar", "ingredients": [ - { - "item": "minecraft:sugar_cane" - } + "minecraft:sugar_cane" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/suspicious_stew.json b/data/minecraft/recipe/suspicious_stew.json deleted file mode 100644 index 31eddde0..00000000 --- a/data/minecraft/recipe/suspicious_stew.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "type": "minecraft:crafting_special_suspiciousstew", - "category": "misc" -} \ No newline at end of file diff --git a/data/minecraft/recipe/suspicious_stew_from_allium.json b/data/minecraft/recipe/suspicious_stew_from_allium.json new file mode 100644 index 00000000..a1a74114 --- /dev/null +++ b/data/minecraft/recipe/suspicious_stew_from_allium.json @@ -0,0 +1,23 @@ +{ + "type": "minecraft:crafting_shapeless", + "category": "misc", + "group": "suspicious_stew", + "ingredients": [ + "minecraft:bowl", + "minecraft:brown_mushroom", + "minecraft:red_mushroom", + "minecraft:allium" + ], + "result": { + "components": { + "minecraft:suspicious_stew_effects": [ + { + "duration": 80, + "id": "minecraft:fire_resistance" + } + ] + }, + "count": 1, + "id": "minecraft:suspicious_stew" + } +} \ No newline at end of file diff --git a/data/minecraft/recipe/suspicious_stew_from_azure_bluet.json b/data/minecraft/recipe/suspicious_stew_from_azure_bluet.json new file mode 100644 index 00000000..8d7a4cd7 --- /dev/null +++ b/data/minecraft/recipe/suspicious_stew_from_azure_bluet.json @@ -0,0 +1,22 @@ +{ + "type": "minecraft:crafting_shapeless", + "category": "misc", + "group": "suspicious_stew", + "ingredients": [ + "minecraft:bowl", + "minecraft:brown_mushroom", + "minecraft:red_mushroom", + "minecraft:azure_bluet" + ], + "result": { + "components": { + "minecraft:suspicious_stew_effects": [ + { + "id": "minecraft:blindness" + } + ] + }, + "count": 1, + "id": "minecraft:suspicious_stew" + } +} \ No newline at end of file diff --git a/data/minecraft/recipe/suspicious_stew_from_blue_orchid.json b/data/minecraft/recipe/suspicious_stew_from_blue_orchid.json new file mode 100644 index 00000000..d76d46c1 --- /dev/null +++ b/data/minecraft/recipe/suspicious_stew_from_blue_orchid.json @@ -0,0 +1,23 @@ +{ + "type": "minecraft:crafting_shapeless", + "category": "misc", + "group": "suspicious_stew", + "ingredients": [ + "minecraft:bowl", + "minecraft:brown_mushroom", + "minecraft:red_mushroom", + "minecraft:blue_orchid" + ], + "result": { + "components": { + "minecraft:suspicious_stew_effects": [ + { + "duration": 7, + "id": "minecraft:saturation" + } + ] + }, + "count": 1, + "id": "minecraft:suspicious_stew" + } +} \ No newline at end of file diff --git a/data/minecraft/recipe/suspicious_stew_from_cornflower.json b/data/minecraft/recipe/suspicious_stew_from_cornflower.json new file mode 100644 index 00000000..22f6e150 --- /dev/null +++ b/data/minecraft/recipe/suspicious_stew_from_cornflower.json @@ -0,0 +1,23 @@ +{ + "type": "minecraft:crafting_shapeless", + "category": "misc", + "group": "suspicious_stew", + "ingredients": [ + "minecraft:bowl", + "minecraft:brown_mushroom", + "minecraft:red_mushroom", + "minecraft:cornflower" + ], + "result": { + "components": { + "minecraft:suspicious_stew_effects": [ + { + "duration": 120, + "id": "minecraft:jump_boost" + } + ] + }, + "count": 1, + "id": "minecraft:suspicious_stew" + } +} \ No newline at end of file diff --git a/data/minecraft/recipe/suspicious_stew_from_dandelion.json b/data/minecraft/recipe/suspicious_stew_from_dandelion.json new file mode 100644 index 00000000..73e35fcf --- /dev/null +++ b/data/minecraft/recipe/suspicious_stew_from_dandelion.json @@ -0,0 +1,23 @@ +{ + "type": "minecraft:crafting_shapeless", + "category": "misc", + "group": "suspicious_stew", + "ingredients": [ + "minecraft:bowl", + "minecraft:brown_mushroom", + "minecraft:red_mushroom", + "minecraft:dandelion" + ], + "result": { + "components": { + "minecraft:suspicious_stew_effects": [ + { + "duration": 7, + "id": "minecraft:saturation" + } + ] + }, + "count": 1, + "id": "minecraft:suspicious_stew" + } +} \ No newline at end of file diff --git a/data/minecraft/recipe/suspicious_stew_from_lily_of_the_valley.json b/data/minecraft/recipe/suspicious_stew_from_lily_of_the_valley.json new file mode 100644 index 00000000..44e0dad1 --- /dev/null +++ b/data/minecraft/recipe/suspicious_stew_from_lily_of_the_valley.json @@ -0,0 +1,23 @@ +{ + "type": "minecraft:crafting_shapeless", + "category": "misc", + "group": "suspicious_stew", + "ingredients": [ + "minecraft:bowl", + "minecraft:brown_mushroom", + "minecraft:red_mushroom", + "minecraft:lily_of_the_valley" + ], + "result": { + "components": { + "minecraft:suspicious_stew_effects": [ + { + "duration": 240, + "id": "minecraft:poison" + } + ] + }, + "count": 1, + "id": "minecraft:suspicious_stew" + } +} \ No newline at end of file diff --git a/data/minecraft/recipe/suspicious_stew_from_orange_tulip.json b/data/minecraft/recipe/suspicious_stew_from_orange_tulip.json new file mode 100644 index 00000000..2188593b --- /dev/null +++ b/data/minecraft/recipe/suspicious_stew_from_orange_tulip.json @@ -0,0 +1,23 @@ +{ + "type": "minecraft:crafting_shapeless", + "category": "misc", + "group": "suspicious_stew", + "ingredients": [ + "minecraft:bowl", + "minecraft:brown_mushroom", + "minecraft:red_mushroom", + "minecraft:orange_tulip" + ], + "result": { + "components": { + "minecraft:suspicious_stew_effects": [ + { + "duration": 180, + "id": "minecraft:weakness" + } + ] + }, + "count": 1, + "id": "minecraft:suspicious_stew" + } +} \ No newline at end of file diff --git a/data/minecraft/recipe/suspicious_stew_from_oxeye_daisy.json b/data/minecraft/recipe/suspicious_stew_from_oxeye_daisy.json new file mode 100644 index 00000000..b1d419af --- /dev/null +++ b/data/minecraft/recipe/suspicious_stew_from_oxeye_daisy.json @@ -0,0 +1,22 @@ +{ + "type": "minecraft:crafting_shapeless", + "category": "misc", + "group": "suspicious_stew", + "ingredients": [ + "minecraft:bowl", + "minecraft:brown_mushroom", + "minecraft:red_mushroom", + "minecraft:oxeye_daisy" + ], + "result": { + "components": { + "minecraft:suspicious_stew_effects": [ + { + "id": "minecraft:regeneration" + } + ] + }, + "count": 1, + "id": "minecraft:suspicious_stew" + } +} \ No newline at end of file diff --git a/data/minecraft/recipe/suspicious_stew_from_pink_tulip.json b/data/minecraft/recipe/suspicious_stew_from_pink_tulip.json new file mode 100644 index 00000000..173ecec6 --- /dev/null +++ b/data/minecraft/recipe/suspicious_stew_from_pink_tulip.json @@ -0,0 +1,23 @@ +{ + "type": "minecraft:crafting_shapeless", + "category": "misc", + "group": "suspicious_stew", + "ingredients": [ + "minecraft:bowl", + "minecraft:brown_mushroom", + "minecraft:red_mushroom", + "minecraft:pink_tulip" + ], + "result": { + "components": { + "minecraft:suspicious_stew_effects": [ + { + "duration": 180, + "id": "minecraft:weakness" + } + ] + }, + "count": 1, + "id": "minecraft:suspicious_stew" + } +} \ No newline at end of file diff --git a/data/minecraft/recipe/suspicious_stew_from_poppy.json b/data/minecraft/recipe/suspicious_stew_from_poppy.json new file mode 100644 index 00000000..3b54476b --- /dev/null +++ b/data/minecraft/recipe/suspicious_stew_from_poppy.json @@ -0,0 +1,23 @@ +{ + "type": "minecraft:crafting_shapeless", + "category": "misc", + "group": "suspicious_stew", + "ingredients": [ + "minecraft:bowl", + "minecraft:brown_mushroom", + "minecraft:red_mushroom", + "minecraft:poppy" + ], + "result": { + "components": { + "minecraft:suspicious_stew_effects": [ + { + "duration": 100, + "id": "minecraft:night_vision" + } + ] + }, + "count": 1, + "id": "minecraft:suspicious_stew" + } +} \ No newline at end of file diff --git a/data/minecraft/recipe/suspicious_stew_from_red_tulip.json b/data/minecraft/recipe/suspicious_stew_from_red_tulip.json new file mode 100644 index 00000000..72f6eec6 --- /dev/null +++ b/data/minecraft/recipe/suspicious_stew_from_red_tulip.json @@ -0,0 +1,23 @@ +{ + "type": "minecraft:crafting_shapeless", + "category": "misc", + "group": "suspicious_stew", + "ingredients": [ + "minecraft:bowl", + "minecraft:brown_mushroom", + "minecraft:red_mushroom", + "minecraft:red_tulip" + ], + "result": { + "components": { + "minecraft:suspicious_stew_effects": [ + { + "duration": 180, + "id": "minecraft:weakness" + } + ] + }, + "count": 1, + "id": "minecraft:suspicious_stew" + } +} \ No newline at end of file diff --git a/data/minecraft/recipe/suspicious_stew_from_torchflower.json b/data/minecraft/recipe/suspicious_stew_from_torchflower.json new file mode 100644 index 00000000..666e2736 --- /dev/null +++ b/data/minecraft/recipe/suspicious_stew_from_torchflower.json @@ -0,0 +1,23 @@ +{ + "type": "minecraft:crafting_shapeless", + "category": "misc", + "group": "suspicious_stew", + "ingredients": [ + "minecraft:bowl", + "minecraft:brown_mushroom", + "minecraft:red_mushroom", + "minecraft:torchflower" + ], + "result": { + "components": { + "minecraft:suspicious_stew_effects": [ + { + "duration": 100, + "id": "minecraft:night_vision" + } + ] + }, + "count": 1, + "id": "minecraft:suspicious_stew" + } +} \ No newline at end of file diff --git a/data/minecraft/recipe/suspicious_stew_from_white_tulip.json b/data/minecraft/recipe/suspicious_stew_from_white_tulip.json new file mode 100644 index 00000000..fc056df2 --- /dev/null +++ b/data/minecraft/recipe/suspicious_stew_from_white_tulip.json @@ -0,0 +1,23 @@ +{ + "type": "minecraft:crafting_shapeless", + "category": "misc", + "group": "suspicious_stew", + "ingredients": [ + "minecraft:bowl", + "minecraft:brown_mushroom", + "minecraft:red_mushroom", + "minecraft:white_tulip" + ], + "result": { + "components": { + "minecraft:suspicious_stew_effects": [ + { + "duration": 180, + "id": "minecraft:weakness" + } + ] + }, + "count": 1, + "id": "minecraft:suspicious_stew" + } +} \ No newline at end of file diff --git a/data/minecraft/recipe/suspicious_stew_from_wither_rose.json b/data/minecraft/recipe/suspicious_stew_from_wither_rose.json new file mode 100644 index 00000000..256de104 --- /dev/null +++ b/data/minecraft/recipe/suspicious_stew_from_wither_rose.json @@ -0,0 +1,22 @@ +{ + "type": "minecraft:crafting_shapeless", + "category": "misc", + "group": "suspicious_stew", + "ingredients": [ + "minecraft:bowl", + "minecraft:brown_mushroom", + "minecraft:red_mushroom", + "minecraft:wither_rose" + ], + "result": { + "components": { + "minecraft:suspicious_stew_effects": [ + { + "id": "minecraft:wither" + } + ] + }, + "count": 1, + "id": "minecraft:suspicious_stew" + } +} \ No newline at end of file diff --git a/data/minecraft/recipe/target.json b/data/minecraft/recipe/target.json index 2c7c6359..55cf3548 100644 --- a/data/minecraft/recipe/target.json +++ b/data/minecraft/recipe/target.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shaped", "category": "redstone", "key": { - "H": { - "item": "minecraft:hay_block" - }, - "R": { - "item": "minecraft:redstone" - } + "H": "minecraft:hay_block", + "R": "minecraft:redstone" }, "pattern": [ " R ", diff --git a/data/minecraft/recipe/terracotta.json b/data/minecraft/recipe/terracotta.json index 6834b820..540beb57 100644 --- a/data/minecraft/recipe/terracotta.json +++ b/data/minecraft/recipe/terracotta.json @@ -3,9 +3,7 @@ "category": "blocks", "cookingtime": 200, "experience": 0.35, - "ingredient": { - "item": "minecraft:clay" - }, + "ingredient": "minecraft:clay", "result": { "id": "minecraft:terracotta" } diff --git a/data/minecraft/recipe/tide_armor_trim_smithing_template.json b/data/minecraft/recipe/tide_armor_trim_smithing_template.json index a7d608a0..1a0ae384 100644 --- a/data/minecraft/recipe/tide_armor_trim_smithing_template.json +++ b/data/minecraft/recipe/tide_armor_trim_smithing_template.json @@ -2,15 +2,9 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "#": { - "item": "minecraft:diamond" - }, - "C": { - "item": "minecraft:prismarine" - }, - "S": { - "item": "minecraft:tide_armor_trim_smithing_template" - } + "#": "minecraft:diamond", + "C": "minecraft:prismarine", + "S": "minecraft:tide_armor_trim_smithing_template" }, "pattern": [ "#S#", diff --git a/data/minecraft/recipe/tide_armor_trim_smithing_template_smithing_trim.json b/data/minecraft/recipe/tide_armor_trim_smithing_template_smithing_trim.json index 13f6f020..f34049a3 100644 --- a/data/minecraft/recipe/tide_armor_trim_smithing_template_smithing_trim.json +++ b/data/minecraft/recipe/tide_armor_trim_smithing_template_smithing_trim.json @@ -1,12 +1,6 @@ { "type": "minecraft:smithing_trim", - "addition": { - "tag": "minecraft:trim_materials" - }, - "base": { - "tag": "minecraft:trimmable_armor" - }, - "template": { - "item": "minecraft:tide_armor_trim_smithing_template" - } + "addition": "#minecraft:trim_materials", + "base": "#minecraft:trimmable_armor", + "template": "minecraft:tide_armor_trim_smithing_template" } \ No newline at end of file diff --git a/data/minecraft/recipe/tinted_glass.json b/data/minecraft/recipe/tinted_glass.json index 8b5c13e4..22d60265 100644 --- a/data/minecraft/recipe/tinted_glass.json +++ b/data/minecraft/recipe/tinted_glass.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "G": { - "item": "minecraft:glass" - }, - "S": { - "item": "minecraft:amethyst_shard" - } + "G": "minecraft:glass", + "S": "minecraft:amethyst_shard" }, "pattern": [ " S ", diff --git a/data/minecraft/recipe/tnt.json b/data/minecraft/recipe/tnt.json index ad347c65..ec375032 100644 --- a/data/minecraft/recipe/tnt.json +++ b/data/minecraft/recipe/tnt.json @@ -3,16 +3,10 @@ "category": "redstone", "key": { "#": [ - { - "item": "minecraft:sand" - }, - { - "item": "minecraft:red_sand" - } + "minecraft:sand", + "minecraft:red_sand" ], - "X": { - "item": "minecraft:gunpowder" - } + "X": "minecraft:gunpowder" }, "pattern": [ "X#X", diff --git a/data/minecraft/recipe/tnt_minecart.json b/data/minecraft/recipe/tnt_minecart.json index eded95d4..0d20a091 100644 --- a/data/minecraft/recipe/tnt_minecart.json +++ b/data/minecraft/recipe/tnt_minecart.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shapeless", "category": "misc", "ingredients": [ - { - "item": "minecraft:tnt" - }, - { - "item": "minecraft:minecart" - } + "minecraft:tnt", + "minecraft:minecart" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/torch.json b/data/minecraft/recipe/torch.json index 1dd3833d..dfb19cb6 100644 --- a/data/minecraft/recipe/torch.json +++ b/data/minecraft/recipe/torch.json @@ -2,16 +2,10 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "#": { - "item": "minecraft:stick" - }, + "#": "minecraft:stick", "X": [ - { - "item": "minecraft:coal" - }, - { - "item": "minecraft:charcoal" - } + "minecraft:coal", + "minecraft:charcoal" ] }, "pattern": [ diff --git a/data/minecraft/recipe/trapped_chest.json b/data/minecraft/recipe/trapped_chest.json index 5d0e395b..5576c5af 100644 --- a/data/minecraft/recipe/trapped_chest.json +++ b/data/minecraft/recipe/trapped_chest.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shapeless", "category": "redstone", "ingredients": [ - { - "item": "minecraft:chest" - }, - { - "item": "minecraft:tripwire_hook" - } + "minecraft:chest", + "minecraft:tripwire_hook" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/tripwire_hook.json b/data/minecraft/recipe/tripwire_hook.json index 6b027fdf..517cb480 100644 --- a/data/minecraft/recipe/tripwire_hook.json +++ b/data/minecraft/recipe/tripwire_hook.json @@ -2,15 +2,9 @@ "type": "minecraft:crafting_shaped", "category": "redstone", "key": { - "#": { - "tag": "minecraft:planks" - }, - "I": { - "item": "minecraft:iron_ingot" - }, - "S": { - "item": "minecraft:stick" - } + "#": "#minecraft:planks", + "I": "minecraft:iron_ingot", + "S": "minecraft:stick" }, "pattern": [ "I", diff --git a/data/minecraft/recipe/tuff_brick_slab.json b/data/minecraft/recipe/tuff_brick_slab.json index fc288dad..1594434c 100644 --- a/data/minecraft/recipe/tuff_brick_slab.json +++ b/data/minecraft/recipe/tuff_brick_slab.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:tuff_bricks" - } + "#": "minecraft:tuff_bricks" }, "pattern": [ "###" diff --git a/data/minecraft/recipe/tuff_brick_slab_from_polished_tuff_stonecutting.json b/data/minecraft/recipe/tuff_brick_slab_from_polished_tuff_stonecutting.json index 0360fe66..03be0abc 100644 --- a/data/minecraft/recipe/tuff_brick_slab_from_polished_tuff_stonecutting.json +++ b/data/minecraft/recipe/tuff_brick_slab_from_polished_tuff_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:polished_tuff" - }, + "ingredient": "minecraft:polished_tuff", "result": { "count": 2, "id": "minecraft:tuff_brick_slab" diff --git a/data/minecraft/recipe/tuff_brick_slab_from_tuff_bricks_stonecutting.json b/data/minecraft/recipe/tuff_brick_slab_from_tuff_bricks_stonecutting.json index 85cf98fd..89a7e7dc 100644 --- a/data/minecraft/recipe/tuff_brick_slab_from_tuff_bricks_stonecutting.json +++ b/data/minecraft/recipe/tuff_brick_slab_from_tuff_bricks_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:tuff_bricks" - }, + "ingredient": "minecraft:tuff_bricks", "result": { "count": 2, "id": "minecraft:tuff_brick_slab" diff --git a/data/minecraft/recipe/tuff_brick_slab_from_tuff_stonecutting.json b/data/minecraft/recipe/tuff_brick_slab_from_tuff_stonecutting.json index 8a033380..fb0aef07 100644 --- a/data/minecraft/recipe/tuff_brick_slab_from_tuff_stonecutting.json +++ b/data/minecraft/recipe/tuff_brick_slab_from_tuff_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:tuff" - }, + "ingredient": "minecraft:tuff", "result": { "count": 2, "id": "minecraft:tuff_brick_slab" diff --git a/data/minecraft/recipe/tuff_brick_stairs.json b/data/minecraft/recipe/tuff_brick_stairs.json index 0cb44456..cb9371b3 100644 --- a/data/minecraft/recipe/tuff_brick_stairs.json +++ b/data/minecraft/recipe/tuff_brick_stairs.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:tuff_bricks" - } + "#": "minecraft:tuff_bricks" }, "pattern": [ "# ", diff --git a/data/minecraft/recipe/tuff_brick_stairs_from_polished_tuff_stonecutting.json b/data/minecraft/recipe/tuff_brick_stairs_from_polished_tuff_stonecutting.json index 697f4f19..26a62298 100644 --- a/data/minecraft/recipe/tuff_brick_stairs_from_polished_tuff_stonecutting.json +++ b/data/minecraft/recipe/tuff_brick_stairs_from_polished_tuff_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:polished_tuff" - }, + "ingredient": "minecraft:polished_tuff", "result": { "count": 1, "id": "minecraft:tuff_brick_stairs" diff --git a/data/minecraft/recipe/tuff_brick_stairs_from_tuff_bricks_stonecutting.json b/data/minecraft/recipe/tuff_brick_stairs_from_tuff_bricks_stonecutting.json index 7978e054..f18fac6c 100644 --- a/data/minecraft/recipe/tuff_brick_stairs_from_tuff_bricks_stonecutting.json +++ b/data/minecraft/recipe/tuff_brick_stairs_from_tuff_bricks_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:tuff_bricks" - }, + "ingredient": "minecraft:tuff_bricks", "result": { "count": 1, "id": "minecraft:tuff_brick_stairs" diff --git a/data/minecraft/recipe/tuff_brick_stairs_from_tuff_stonecutting.json b/data/minecraft/recipe/tuff_brick_stairs_from_tuff_stonecutting.json index 3d2bff0e..8554f996 100644 --- a/data/minecraft/recipe/tuff_brick_stairs_from_tuff_stonecutting.json +++ b/data/minecraft/recipe/tuff_brick_stairs_from_tuff_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:tuff" - }, + "ingredient": "minecraft:tuff", "result": { "count": 1, "id": "minecraft:tuff_brick_stairs" diff --git a/data/minecraft/recipe/tuff_brick_wall.json b/data/minecraft/recipe/tuff_brick_wall.json index de614891..a7d06ef1 100644 --- a/data/minecraft/recipe/tuff_brick_wall.json +++ b/data/minecraft/recipe/tuff_brick_wall.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "#": { - "item": "minecraft:tuff_bricks" - } + "#": "minecraft:tuff_bricks" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/tuff_brick_wall_from_polished_tuff_stonecutting.json b/data/minecraft/recipe/tuff_brick_wall_from_polished_tuff_stonecutting.json index bfc66879..8b26a24f 100644 --- a/data/minecraft/recipe/tuff_brick_wall_from_polished_tuff_stonecutting.json +++ b/data/minecraft/recipe/tuff_brick_wall_from_polished_tuff_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:polished_tuff" - }, + "ingredient": "minecraft:polished_tuff", "result": { "count": 1, "id": "minecraft:tuff_brick_wall" diff --git a/data/minecraft/recipe/tuff_brick_wall_from_tuff_bricks_stonecutting.json b/data/minecraft/recipe/tuff_brick_wall_from_tuff_bricks_stonecutting.json index 674b561e..85e8bea3 100644 --- a/data/minecraft/recipe/tuff_brick_wall_from_tuff_bricks_stonecutting.json +++ b/data/minecraft/recipe/tuff_brick_wall_from_tuff_bricks_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:tuff_bricks" - }, + "ingredient": "minecraft:tuff_bricks", "result": { "count": 1, "id": "minecraft:tuff_brick_wall" diff --git a/data/minecraft/recipe/tuff_brick_wall_from_tuff_stonecutting.json b/data/minecraft/recipe/tuff_brick_wall_from_tuff_stonecutting.json index 81ebddcf..d3ac3fa6 100644 --- a/data/minecraft/recipe/tuff_brick_wall_from_tuff_stonecutting.json +++ b/data/minecraft/recipe/tuff_brick_wall_from_tuff_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:tuff" - }, + "ingredient": "minecraft:tuff", "result": { "count": 1, "id": "minecraft:tuff_brick_wall" diff --git a/data/minecraft/recipe/tuff_bricks.json b/data/minecraft/recipe/tuff_bricks.json index 192fd9f9..077dcd43 100644 --- a/data/minecraft/recipe/tuff_bricks.json +++ b/data/minecraft/recipe/tuff_bricks.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "S": { - "item": "minecraft:polished_tuff" - } + "S": "minecraft:polished_tuff" }, "pattern": [ "SS", diff --git a/data/minecraft/recipe/tuff_bricks_from_polished_tuff_stonecutting.json b/data/minecraft/recipe/tuff_bricks_from_polished_tuff_stonecutting.json index 9645585b..45e19952 100644 --- a/data/minecraft/recipe/tuff_bricks_from_polished_tuff_stonecutting.json +++ b/data/minecraft/recipe/tuff_bricks_from_polished_tuff_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:polished_tuff" - }, + "ingredient": "minecraft:polished_tuff", "result": { "count": 1, "id": "minecraft:tuff_bricks" diff --git a/data/minecraft/recipe/tuff_bricks_from_tuff_stonecutting.json b/data/minecraft/recipe/tuff_bricks_from_tuff_stonecutting.json index 2a834983..32b24ef3 100644 --- a/data/minecraft/recipe/tuff_bricks_from_tuff_stonecutting.json +++ b/data/minecraft/recipe/tuff_bricks_from_tuff_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:tuff" - }, + "ingredient": "minecraft:tuff", "result": { "count": 1, "id": "minecraft:tuff_bricks" diff --git a/data/minecraft/recipe/tuff_slab.json b/data/minecraft/recipe/tuff_slab.json index cfae773b..23b2d28b 100644 --- a/data/minecraft/recipe/tuff_slab.json +++ b/data/minecraft/recipe/tuff_slab.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:tuff" - } + "#": "minecraft:tuff" }, "pattern": [ "###" diff --git a/data/minecraft/recipe/tuff_slab_from_tuff_stonecutting.json b/data/minecraft/recipe/tuff_slab_from_tuff_stonecutting.json index 448cb918..8f5f7264 100644 --- a/data/minecraft/recipe/tuff_slab_from_tuff_stonecutting.json +++ b/data/minecraft/recipe/tuff_slab_from_tuff_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:tuff" - }, + "ingredient": "minecraft:tuff", "result": { "count": 2, "id": "minecraft:tuff_slab" diff --git a/data/minecraft/recipe/tuff_stairs.json b/data/minecraft/recipe/tuff_stairs.json index a188ae4f..bb88093d 100644 --- a/data/minecraft/recipe/tuff_stairs.json +++ b/data/minecraft/recipe/tuff_stairs.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:tuff" - } + "#": "minecraft:tuff" }, "pattern": [ "# ", diff --git a/data/minecraft/recipe/tuff_stairs_from_tuff_stonecutting.json b/data/minecraft/recipe/tuff_stairs_from_tuff_stonecutting.json index 714fb327..0002036a 100644 --- a/data/minecraft/recipe/tuff_stairs_from_tuff_stonecutting.json +++ b/data/minecraft/recipe/tuff_stairs_from_tuff_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:tuff" - }, + "ingredient": "minecraft:tuff", "result": { "count": 1, "id": "minecraft:tuff_stairs" diff --git a/data/minecraft/recipe/tuff_wall.json b/data/minecraft/recipe/tuff_wall.json index 3ceda908..851357e5 100644 --- a/data/minecraft/recipe/tuff_wall.json +++ b/data/minecraft/recipe/tuff_wall.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "#": { - "item": "minecraft:tuff" - } + "#": "minecraft:tuff" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/tuff_wall_from_tuff_stonecutting.json b/data/minecraft/recipe/tuff_wall_from_tuff_stonecutting.json index 9c282d18..297b1ba2 100644 --- a/data/minecraft/recipe/tuff_wall_from_tuff_stonecutting.json +++ b/data/minecraft/recipe/tuff_wall_from_tuff_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:tuff" - }, + "ingredient": "minecraft:tuff", "result": { "count": 1, "id": "minecraft:tuff_wall" diff --git a/data/minecraft/recipe/turtle_helmet.json b/data/minecraft/recipe/turtle_helmet.json index 31096350..67d61fb4 100644 --- a/data/minecraft/recipe/turtle_helmet.json +++ b/data/minecraft/recipe/turtle_helmet.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "equipment", "key": { - "X": { - "item": "minecraft:turtle_scute" - } + "X": "minecraft:turtle_scute" }, "pattern": [ "XXX", diff --git a/data/minecraft/recipe/vex_armor_trim_smithing_template.json b/data/minecraft/recipe/vex_armor_trim_smithing_template.json index 12f3e924..ca64664d 100644 --- a/data/minecraft/recipe/vex_armor_trim_smithing_template.json +++ b/data/minecraft/recipe/vex_armor_trim_smithing_template.json @@ -2,15 +2,9 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "#": { - "item": "minecraft:diamond" - }, - "C": { - "item": "minecraft:cobblestone" - }, - "S": { - "item": "minecraft:vex_armor_trim_smithing_template" - } + "#": "minecraft:diamond", + "C": "minecraft:cobblestone", + "S": "minecraft:vex_armor_trim_smithing_template" }, "pattern": [ "#S#", diff --git a/data/minecraft/recipe/vex_armor_trim_smithing_template_smithing_trim.json b/data/minecraft/recipe/vex_armor_trim_smithing_template_smithing_trim.json index 26537323..f54e11a5 100644 --- a/data/minecraft/recipe/vex_armor_trim_smithing_template_smithing_trim.json +++ b/data/minecraft/recipe/vex_armor_trim_smithing_template_smithing_trim.json @@ -1,12 +1,6 @@ { "type": "minecraft:smithing_trim", - "addition": { - "tag": "minecraft:trim_materials" - }, - "base": { - "tag": "minecraft:trimmable_armor" - }, - "template": { - "item": "minecraft:vex_armor_trim_smithing_template" - } + "addition": "#minecraft:trim_materials", + "base": "#minecraft:trimmable_armor", + "template": "minecraft:vex_armor_trim_smithing_template" } \ No newline at end of file diff --git a/data/minecraft/recipe/ward_armor_trim_smithing_template.json b/data/minecraft/recipe/ward_armor_trim_smithing_template.json index 3cea4234..d417cd22 100644 --- a/data/minecraft/recipe/ward_armor_trim_smithing_template.json +++ b/data/minecraft/recipe/ward_armor_trim_smithing_template.json @@ -2,15 +2,9 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "#": { - "item": "minecraft:diamond" - }, - "C": { - "item": "minecraft:cobbled_deepslate" - }, - "S": { - "item": "minecraft:ward_armor_trim_smithing_template" - } + "#": "minecraft:diamond", + "C": "minecraft:cobbled_deepslate", + "S": "minecraft:ward_armor_trim_smithing_template" }, "pattern": [ "#S#", diff --git a/data/minecraft/recipe/ward_armor_trim_smithing_template_smithing_trim.json b/data/minecraft/recipe/ward_armor_trim_smithing_template_smithing_trim.json index eb8d7982..4da4029c 100644 --- a/data/minecraft/recipe/ward_armor_trim_smithing_template_smithing_trim.json +++ b/data/minecraft/recipe/ward_armor_trim_smithing_template_smithing_trim.json @@ -1,12 +1,6 @@ { "type": "minecraft:smithing_trim", - "addition": { - "tag": "minecraft:trim_materials" - }, - "base": { - "tag": "minecraft:trimmable_armor" - }, - "template": { - "item": "minecraft:ward_armor_trim_smithing_template" - } + "addition": "#minecraft:trim_materials", + "base": "#minecraft:trimmable_armor", + "template": "minecraft:ward_armor_trim_smithing_template" } \ No newline at end of file diff --git a/data/minecraft/recipe/warped_button.json b/data/minecraft/recipe/warped_button.json index b918ed9b..673bee6e 100644 --- a/data/minecraft/recipe/warped_button.json +++ b/data/minecraft/recipe/warped_button.json @@ -3,9 +3,7 @@ "category": "redstone", "group": "wooden_button", "ingredients": [ - { - "item": "minecraft:warped_planks" - } + "minecraft:warped_planks" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/warped_door.json b/data/minecraft/recipe/warped_door.json index 6500490d..f2af5905 100644 --- a/data/minecraft/recipe/warped_door.json +++ b/data/minecraft/recipe/warped_door.json @@ -3,9 +3,7 @@ "category": "redstone", "group": "wooden_door", "key": { - "#": { - "item": "minecraft:warped_planks" - } + "#": "minecraft:warped_planks" }, "pattern": [ "##", diff --git a/data/minecraft/recipe/warped_fence.json b/data/minecraft/recipe/warped_fence.json index a3c235a0..e7349bdf 100644 --- a/data/minecraft/recipe/warped_fence.json +++ b/data/minecraft/recipe/warped_fence.json @@ -3,12 +3,8 @@ "category": "misc", "group": "wooden_fence", "key": { - "#": { - "item": "minecraft:stick" - }, - "W": { - "item": "minecraft:warped_planks" - } + "#": "minecraft:stick", + "W": "minecraft:warped_planks" }, "pattern": [ "W#W", diff --git a/data/minecraft/recipe/warped_fence_gate.json b/data/minecraft/recipe/warped_fence_gate.json index 0c3cec38..fb06c524 100644 --- a/data/minecraft/recipe/warped_fence_gate.json +++ b/data/minecraft/recipe/warped_fence_gate.json @@ -3,12 +3,8 @@ "category": "redstone", "group": "wooden_fence_gate", "key": { - "#": { - "item": "minecraft:stick" - }, - "W": { - "item": "minecraft:warped_planks" - } + "#": "minecraft:stick", + "W": "minecraft:warped_planks" }, "pattern": [ "#W#", diff --git a/data/minecraft/recipe/warped_fungus_on_a_stick.json b/data/minecraft/recipe/warped_fungus_on_a_stick.json index b73bf4aa..05dbe6b0 100644 --- a/data/minecraft/recipe/warped_fungus_on_a_stick.json +++ b/data/minecraft/recipe/warped_fungus_on_a_stick.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "#": { - "item": "minecraft:fishing_rod" - }, - "X": { - "item": "minecraft:warped_fungus" - } + "#": "minecraft:fishing_rod", + "X": "minecraft:warped_fungus" }, "pattern": [ "# ", diff --git a/data/minecraft/recipe/warped_hanging_sign.json b/data/minecraft/recipe/warped_hanging_sign.json index 0af96cca..775753cb 100644 --- a/data/minecraft/recipe/warped_hanging_sign.json +++ b/data/minecraft/recipe/warped_hanging_sign.json @@ -3,12 +3,8 @@ "category": "misc", "group": "hanging_sign", "key": { - "#": { - "item": "minecraft:stripped_warped_stem" - }, - "X": { - "item": "minecraft:chain" - } + "#": "minecraft:stripped_warped_stem", + "X": "minecraft:chain" }, "pattern": [ "X X", diff --git a/data/minecraft/recipe/warped_hyphae.json b/data/minecraft/recipe/warped_hyphae.json index 88cbce77..753a67e3 100644 --- a/data/minecraft/recipe/warped_hyphae.json +++ b/data/minecraft/recipe/warped_hyphae.json @@ -3,9 +3,7 @@ "category": "building", "group": "bark", "key": { - "#": { - "item": "minecraft:warped_stem" - } + "#": "minecraft:warped_stem" }, "pattern": [ "##", diff --git a/data/minecraft/recipe/warped_planks.json b/data/minecraft/recipe/warped_planks.json index 6554b485..95c3c1af 100644 --- a/data/minecraft/recipe/warped_planks.json +++ b/data/minecraft/recipe/warped_planks.json @@ -3,9 +3,7 @@ "category": "building", "group": "planks", "ingredients": [ - { - "tag": "minecraft:warped_stems" - } + "#minecraft:warped_stems" ], "result": { "count": 4, diff --git a/data/minecraft/recipe/warped_pressure_plate.json b/data/minecraft/recipe/warped_pressure_plate.json index ab8dd686..009ebecc 100644 --- a/data/minecraft/recipe/warped_pressure_plate.json +++ b/data/minecraft/recipe/warped_pressure_plate.json @@ -3,9 +3,7 @@ "category": "redstone", "group": "wooden_pressure_plate", "key": { - "#": { - "item": "minecraft:warped_planks" - } + "#": "minecraft:warped_planks" }, "pattern": [ "##" diff --git a/data/minecraft/recipe/warped_sign.json b/data/minecraft/recipe/warped_sign.json index 0efb0f31..a1e2e44a 100644 --- a/data/minecraft/recipe/warped_sign.json +++ b/data/minecraft/recipe/warped_sign.json @@ -3,12 +3,8 @@ "category": "misc", "group": "wooden_sign", "key": { - "#": { - "item": "minecraft:warped_planks" - }, - "X": { - "item": "minecraft:stick" - } + "#": "minecraft:warped_planks", + "X": "minecraft:stick" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/warped_slab.json b/data/minecraft/recipe/warped_slab.json index 1002459b..0c3566d6 100644 --- a/data/minecraft/recipe/warped_slab.json +++ b/data/minecraft/recipe/warped_slab.json @@ -3,9 +3,7 @@ "category": "building", "group": "wooden_slab", "key": { - "#": { - "item": "minecraft:warped_planks" - } + "#": "minecraft:warped_planks" }, "pattern": [ "###" diff --git a/data/minecraft/recipe/warped_stairs.json b/data/minecraft/recipe/warped_stairs.json index 57b5202d..29328430 100644 --- a/data/minecraft/recipe/warped_stairs.json +++ b/data/minecraft/recipe/warped_stairs.json @@ -3,9 +3,7 @@ "category": "building", "group": "wooden_stairs", "key": { - "#": { - "item": "minecraft:warped_planks" - } + "#": "minecraft:warped_planks" }, "pattern": [ "# ", diff --git a/data/minecraft/recipe/warped_trapdoor.json b/data/minecraft/recipe/warped_trapdoor.json index 2d85de09..05bff88b 100644 --- a/data/minecraft/recipe/warped_trapdoor.json +++ b/data/minecraft/recipe/warped_trapdoor.json @@ -3,9 +3,7 @@ "category": "redstone", "group": "wooden_trapdoor", "key": { - "#": { - "item": "minecraft:warped_planks" - } + "#": "minecraft:warped_planks" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/waxed_chiseled_copper.json b/data/minecraft/recipe/waxed_chiseled_copper.json index 4f24c78f..5e983c04 100644 --- a/data/minecraft/recipe/waxed_chiseled_copper.json +++ b/data/minecraft/recipe/waxed_chiseled_copper.json @@ -3,9 +3,7 @@ "category": "building", "group": "waxed_cut_copper_chiseled", "key": { - "#": { - "item": "minecraft:waxed_cut_copper_slab" - } + "#": "minecraft:waxed_cut_copper_slab" }, "pattern": [ "#", diff --git a/data/minecraft/recipe/waxed_chiseled_copper_from_honeycomb.json b/data/minecraft/recipe/waxed_chiseled_copper_from_honeycomb.json index 5f857637..22c83e95 100644 --- a/data/minecraft/recipe/waxed_chiseled_copper_from_honeycomb.json +++ b/data/minecraft/recipe/waxed_chiseled_copper_from_honeycomb.json @@ -3,12 +3,8 @@ "category": "building", "group": "waxed_chiseled_copper", "ingredients": [ - { - "item": "minecraft:chiseled_copper" - }, - { - "item": "minecraft:honeycomb" - } + "minecraft:chiseled_copper", + "minecraft:honeycomb" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/waxed_chiseled_copper_from_waxed_copper_block_stonecutting.json b/data/minecraft/recipe/waxed_chiseled_copper_from_waxed_copper_block_stonecutting.json index 6917e602..a9fe4a86 100644 --- a/data/minecraft/recipe/waxed_chiseled_copper_from_waxed_copper_block_stonecutting.json +++ b/data/minecraft/recipe/waxed_chiseled_copper_from_waxed_copper_block_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:waxed_copper_block" - }, + "ingredient": "minecraft:waxed_copper_block", "result": { "count": 4, "id": "minecraft:waxed_chiseled_copper" diff --git a/data/minecraft/recipe/waxed_chiseled_copper_from_waxed_cut_copper_stonecutting.json b/data/minecraft/recipe/waxed_chiseled_copper_from_waxed_cut_copper_stonecutting.json index 7c2a43a9..cb06640b 100644 --- a/data/minecraft/recipe/waxed_chiseled_copper_from_waxed_cut_copper_stonecutting.json +++ b/data/minecraft/recipe/waxed_chiseled_copper_from_waxed_cut_copper_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:waxed_cut_copper" - }, + "ingredient": "minecraft:waxed_cut_copper", "result": { "count": 1, "id": "minecraft:waxed_chiseled_copper" diff --git a/data/minecraft/recipe/waxed_copper_block_from_honeycomb.json b/data/minecraft/recipe/waxed_copper_block_from_honeycomb.json index 7283829b..2c4146b2 100644 --- a/data/minecraft/recipe/waxed_copper_block_from_honeycomb.json +++ b/data/minecraft/recipe/waxed_copper_block_from_honeycomb.json @@ -3,12 +3,8 @@ "category": "building", "group": "waxed_copper_block", "ingredients": [ - { - "item": "minecraft:copper_block" - }, - { - "item": "minecraft:honeycomb" - } + "minecraft:copper_block", + "minecraft:honeycomb" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/waxed_copper_bulb.json b/data/minecraft/recipe/waxed_copper_bulb.json index 728b47bf..81a3e9f5 100644 --- a/data/minecraft/recipe/waxed_copper_bulb.json +++ b/data/minecraft/recipe/waxed_copper_bulb.json @@ -2,15 +2,9 @@ "type": "minecraft:crafting_shaped", "category": "redstone", "key": { - "B": { - "item": "minecraft:blaze_rod" - }, - "C": { - "item": "minecraft:waxed_copper_block" - }, - "R": { - "item": "minecraft:redstone" - } + "B": "minecraft:blaze_rod", + "C": "minecraft:waxed_copper_block", + "R": "minecraft:redstone" }, "pattern": [ " C ", diff --git a/data/minecraft/recipe/waxed_copper_bulb_from_honeycomb.json b/data/minecraft/recipe/waxed_copper_bulb_from_honeycomb.json index c11cea6b..cfd4788c 100644 --- a/data/minecraft/recipe/waxed_copper_bulb_from_honeycomb.json +++ b/data/minecraft/recipe/waxed_copper_bulb_from_honeycomb.json @@ -3,12 +3,8 @@ "category": "building", "group": "waxed_copper_bulb", "ingredients": [ - { - "item": "minecraft:copper_bulb" - }, - { - "item": "minecraft:honeycomb" - } + "minecraft:copper_bulb", + "minecraft:honeycomb" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/waxed_copper_door_from_honeycomb.json b/data/minecraft/recipe/waxed_copper_door_from_honeycomb.json index fa8c6881..0e51b7f2 100644 --- a/data/minecraft/recipe/waxed_copper_door_from_honeycomb.json +++ b/data/minecraft/recipe/waxed_copper_door_from_honeycomb.json @@ -3,12 +3,8 @@ "category": "building", "group": "waxed_copper_door", "ingredients": [ - { - "item": "minecraft:copper_door" - }, - { - "item": "minecraft:honeycomb" - } + "minecraft:copper_door", + "minecraft:honeycomb" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/waxed_copper_grate.json b/data/minecraft/recipe/waxed_copper_grate.json index 2f0b68c0..069caa74 100644 --- a/data/minecraft/recipe/waxed_copper_grate.json +++ b/data/minecraft/recipe/waxed_copper_grate.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "M": { - "item": "minecraft:waxed_copper_block" - } + "M": "minecraft:waxed_copper_block" }, "pattern": [ " M ", diff --git a/data/minecraft/recipe/waxed_copper_grate_from_honeycomb.json b/data/minecraft/recipe/waxed_copper_grate_from_honeycomb.json index 5af0d233..bcb33e75 100644 --- a/data/minecraft/recipe/waxed_copper_grate_from_honeycomb.json +++ b/data/minecraft/recipe/waxed_copper_grate_from_honeycomb.json @@ -3,12 +3,8 @@ "category": "building", "group": "waxed_copper_grate", "ingredients": [ - { - "item": "minecraft:copper_grate" - }, - { - "item": "minecraft:honeycomb" - } + "minecraft:copper_grate", + "minecraft:honeycomb" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/waxed_copper_grate_from_waxed_copper_block_stonecutting.json b/data/minecraft/recipe/waxed_copper_grate_from_waxed_copper_block_stonecutting.json index b46052cf..a2a1232a 100644 --- a/data/minecraft/recipe/waxed_copper_grate_from_waxed_copper_block_stonecutting.json +++ b/data/minecraft/recipe/waxed_copper_grate_from_waxed_copper_block_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:waxed_copper_block" - }, + "ingredient": "minecraft:waxed_copper_block", "result": { "count": 4, "id": "minecraft:waxed_copper_grate" diff --git a/data/minecraft/recipe/waxed_copper_trapdoor_from_honeycomb.json b/data/minecraft/recipe/waxed_copper_trapdoor_from_honeycomb.json index 7d765e7a..dc8f63bd 100644 --- a/data/minecraft/recipe/waxed_copper_trapdoor_from_honeycomb.json +++ b/data/minecraft/recipe/waxed_copper_trapdoor_from_honeycomb.json @@ -3,12 +3,8 @@ "category": "building", "group": "waxed_copper_trapdoor", "ingredients": [ - { - "item": "minecraft:copper_trapdoor" - }, - { - "item": "minecraft:honeycomb" - } + "minecraft:copper_trapdoor", + "minecraft:honeycomb" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/waxed_cut_copper.json b/data/minecraft/recipe/waxed_cut_copper.json index db468a04..9d050bd8 100644 --- a/data/minecraft/recipe/waxed_cut_copper.json +++ b/data/minecraft/recipe/waxed_cut_copper.json @@ -3,9 +3,7 @@ "category": "building", "group": "waxed_cut_copper", "key": { - "#": { - "item": "minecraft:waxed_copper_block" - } + "#": "minecraft:waxed_copper_block" }, "pattern": [ "##", diff --git a/data/minecraft/recipe/waxed_cut_copper_from_honeycomb.json b/data/minecraft/recipe/waxed_cut_copper_from_honeycomb.json index 82bf9872..0b8f93c3 100644 --- a/data/minecraft/recipe/waxed_cut_copper_from_honeycomb.json +++ b/data/minecraft/recipe/waxed_cut_copper_from_honeycomb.json @@ -3,12 +3,8 @@ "category": "building", "group": "waxed_cut_copper", "ingredients": [ - { - "item": "minecraft:cut_copper" - }, - { - "item": "minecraft:honeycomb" - } + "minecraft:cut_copper", + "minecraft:honeycomb" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/waxed_cut_copper_from_waxed_copper_block_stonecutting.json b/data/minecraft/recipe/waxed_cut_copper_from_waxed_copper_block_stonecutting.json index 3df438a4..7b4d8421 100644 --- a/data/minecraft/recipe/waxed_cut_copper_from_waxed_copper_block_stonecutting.json +++ b/data/minecraft/recipe/waxed_cut_copper_from_waxed_copper_block_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:waxed_copper_block" - }, + "ingredient": "minecraft:waxed_copper_block", "result": { "count": 4, "id": "minecraft:waxed_cut_copper" diff --git a/data/minecraft/recipe/waxed_cut_copper_slab.json b/data/minecraft/recipe/waxed_cut_copper_slab.json index d39cdbe8..a5c962d2 100644 --- a/data/minecraft/recipe/waxed_cut_copper_slab.json +++ b/data/minecraft/recipe/waxed_cut_copper_slab.json @@ -3,9 +3,7 @@ "category": "building", "group": "waxed_cut_copper_slab", "key": { - "#": { - "item": "minecraft:waxed_cut_copper" - } + "#": "minecraft:waxed_cut_copper" }, "pattern": [ "###" diff --git a/data/minecraft/recipe/waxed_cut_copper_slab_from_honeycomb.json b/data/minecraft/recipe/waxed_cut_copper_slab_from_honeycomb.json index 0b8addee..948a6ca2 100644 --- a/data/minecraft/recipe/waxed_cut_copper_slab_from_honeycomb.json +++ b/data/minecraft/recipe/waxed_cut_copper_slab_from_honeycomb.json @@ -3,12 +3,8 @@ "category": "building", "group": "waxed_cut_copper_slab", "ingredients": [ - { - "item": "minecraft:cut_copper_slab" - }, - { - "item": "minecraft:honeycomb" - } + "minecraft:cut_copper_slab", + "minecraft:honeycomb" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/waxed_cut_copper_slab_from_waxed_copper_block_stonecutting.json b/data/minecraft/recipe/waxed_cut_copper_slab_from_waxed_copper_block_stonecutting.json index edb1fe90..e98500cb 100644 --- a/data/minecraft/recipe/waxed_cut_copper_slab_from_waxed_copper_block_stonecutting.json +++ b/data/minecraft/recipe/waxed_cut_copper_slab_from_waxed_copper_block_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:waxed_copper_block" - }, + "ingredient": "minecraft:waxed_copper_block", "result": { "count": 8, "id": "minecraft:waxed_cut_copper_slab" diff --git a/data/minecraft/recipe/waxed_cut_copper_slab_from_waxed_cut_copper_stonecutting.json b/data/minecraft/recipe/waxed_cut_copper_slab_from_waxed_cut_copper_stonecutting.json index b3b360d5..e38ac369 100644 --- a/data/minecraft/recipe/waxed_cut_copper_slab_from_waxed_cut_copper_stonecutting.json +++ b/data/minecraft/recipe/waxed_cut_copper_slab_from_waxed_cut_copper_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:waxed_cut_copper" - }, + "ingredient": "minecraft:waxed_cut_copper", "result": { "count": 2, "id": "minecraft:waxed_cut_copper_slab" diff --git a/data/minecraft/recipe/waxed_cut_copper_stairs.json b/data/minecraft/recipe/waxed_cut_copper_stairs.json index e32d34b5..3af584eb 100644 --- a/data/minecraft/recipe/waxed_cut_copper_stairs.json +++ b/data/minecraft/recipe/waxed_cut_copper_stairs.json @@ -3,9 +3,7 @@ "category": "building", "group": "waxed_cut_copper_stairs", "key": { - "#": { - "item": "minecraft:waxed_cut_copper" - } + "#": "minecraft:waxed_cut_copper" }, "pattern": [ "# ", diff --git a/data/minecraft/recipe/waxed_cut_copper_stairs_from_honeycomb.json b/data/minecraft/recipe/waxed_cut_copper_stairs_from_honeycomb.json index 77233fe5..d56298fe 100644 --- a/data/minecraft/recipe/waxed_cut_copper_stairs_from_honeycomb.json +++ b/data/minecraft/recipe/waxed_cut_copper_stairs_from_honeycomb.json @@ -3,12 +3,8 @@ "category": "building", "group": "waxed_cut_copper_stairs", "ingredients": [ - { - "item": "minecraft:cut_copper_stairs" - }, - { - "item": "minecraft:honeycomb" - } + "minecraft:cut_copper_stairs", + "minecraft:honeycomb" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/waxed_cut_copper_stairs_from_waxed_copper_block_stonecutting.json b/data/minecraft/recipe/waxed_cut_copper_stairs_from_waxed_copper_block_stonecutting.json index f0347bd0..af106046 100644 --- a/data/minecraft/recipe/waxed_cut_copper_stairs_from_waxed_copper_block_stonecutting.json +++ b/data/minecraft/recipe/waxed_cut_copper_stairs_from_waxed_copper_block_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:waxed_copper_block" - }, + "ingredient": "minecraft:waxed_copper_block", "result": { "count": 4, "id": "minecraft:waxed_cut_copper_stairs" diff --git a/data/minecraft/recipe/waxed_cut_copper_stairs_from_waxed_cut_copper_stonecutting.json b/data/minecraft/recipe/waxed_cut_copper_stairs_from_waxed_cut_copper_stonecutting.json index 1d38e466..1fe9d384 100644 --- a/data/minecraft/recipe/waxed_cut_copper_stairs_from_waxed_cut_copper_stonecutting.json +++ b/data/minecraft/recipe/waxed_cut_copper_stairs_from_waxed_cut_copper_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:waxed_cut_copper" - }, + "ingredient": "minecraft:waxed_cut_copper", "result": { "count": 1, "id": "minecraft:waxed_cut_copper_stairs" diff --git a/data/minecraft/recipe/waxed_exposed_chiseled_copper.json b/data/minecraft/recipe/waxed_exposed_chiseled_copper.json index dd330e18..b09220ff 100644 --- a/data/minecraft/recipe/waxed_exposed_chiseled_copper.json +++ b/data/minecraft/recipe/waxed_exposed_chiseled_copper.json @@ -3,9 +3,7 @@ "category": "building", "group": "waxed_exposed_cut_copper_chiseled", "key": { - "#": { - "item": "minecraft:waxed_exposed_cut_copper_slab" - } + "#": "minecraft:waxed_exposed_cut_copper_slab" }, "pattern": [ "#", diff --git a/data/minecraft/recipe/waxed_exposed_chiseled_copper_from_honeycomb.json b/data/minecraft/recipe/waxed_exposed_chiseled_copper_from_honeycomb.json index aeae63ee..186b6039 100644 --- a/data/minecraft/recipe/waxed_exposed_chiseled_copper_from_honeycomb.json +++ b/data/minecraft/recipe/waxed_exposed_chiseled_copper_from_honeycomb.json @@ -3,12 +3,8 @@ "category": "building", "group": "waxed_exposed_chiseled_copper", "ingredients": [ - { - "item": "minecraft:exposed_chiseled_copper" - }, - { - "item": "minecraft:honeycomb" - } + "minecraft:exposed_chiseled_copper", + "minecraft:honeycomb" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/waxed_exposed_chiseled_copper_from_waxed_exposed_copper_stonecutting.json b/data/minecraft/recipe/waxed_exposed_chiseled_copper_from_waxed_exposed_copper_stonecutting.json index 1fc745b9..535527dd 100644 --- a/data/minecraft/recipe/waxed_exposed_chiseled_copper_from_waxed_exposed_copper_stonecutting.json +++ b/data/minecraft/recipe/waxed_exposed_chiseled_copper_from_waxed_exposed_copper_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:waxed_exposed_copper" - }, + "ingredient": "minecraft:waxed_exposed_copper", "result": { "count": 4, "id": "minecraft:waxed_exposed_chiseled_copper" diff --git a/data/minecraft/recipe/waxed_exposed_chiseled_copper_from_waxed_exposed_cut_copper_stonecutting.json b/data/minecraft/recipe/waxed_exposed_chiseled_copper_from_waxed_exposed_cut_copper_stonecutting.json index 928a4c19..75f20597 100644 --- a/data/minecraft/recipe/waxed_exposed_chiseled_copper_from_waxed_exposed_cut_copper_stonecutting.json +++ b/data/minecraft/recipe/waxed_exposed_chiseled_copper_from_waxed_exposed_cut_copper_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:waxed_exposed_cut_copper" - }, + "ingredient": "minecraft:waxed_exposed_cut_copper", "result": { "count": 1, "id": "minecraft:waxed_exposed_chiseled_copper" diff --git a/data/minecraft/recipe/waxed_exposed_copper_bulb.json b/data/minecraft/recipe/waxed_exposed_copper_bulb.json index 85e5e307..d268067d 100644 --- a/data/minecraft/recipe/waxed_exposed_copper_bulb.json +++ b/data/minecraft/recipe/waxed_exposed_copper_bulb.json @@ -2,15 +2,9 @@ "type": "minecraft:crafting_shaped", "category": "redstone", "key": { - "B": { - "item": "minecraft:blaze_rod" - }, - "C": { - "item": "minecraft:waxed_exposed_copper" - }, - "R": { - "item": "minecraft:redstone" - } + "B": "minecraft:blaze_rod", + "C": "minecraft:waxed_exposed_copper", + "R": "minecraft:redstone" }, "pattern": [ " C ", diff --git a/data/minecraft/recipe/waxed_exposed_copper_bulb_from_honeycomb.json b/data/minecraft/recipe/waxed_exposed_copper_bulb_from_honeycomb.json index d000c530..fcba6f6a 100644 --- a/data/minecraft/recipe/waxed_exposed_copper_bulb_from_honeycomb.json +++ b/data/minecraft/recipe/waxed_exposed_copper_bulb_from_honeycomb.json @@ -3,12 +3,8 @@ "category": "building", "group": "waxed_exposed_copper_bulb", "ingredients": [ - { - "item": "minecraft:exposed_copper_bulb" - }, - { - "item": "minecraft:honeycomb" - } + "minecraft:exposed_copper_bulb", + "minecraft:honeycomb" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/waxed_exposed_copper_door_from_honeycomb.json b/data/minecraft/recipe/waxed_exposed_copper_door_from_honeycomb.json index 3f062454..5bc1f64a 100644 --- a/data/minecraft/recipe/waxed_exposed_copper_door_from_honeycomb.json +++ b/data/minecraft/recipe/waxed_exposed_copper_door_from_honeycomb.json @@ -3,12 +3,8 @@ "category": "building", "group": "waxed_exposed_copper_door", "ingredients": [ - { - "item": "minecraft:exposed_copper_door" - }, - { - "item": "minecraft:honeycomb" - } + "minecraft:exposed_copper_door", + "minecraft:honeycomb" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/waxed_exposed_copper_from_honeycomb.json b/data/minecraft/recipe/waxed_exposed_copper_from_honeycomb.json index 00a7f70c..a04ce0c6 100644 --- a/data/minecraft/recipe/waxed_exposed_copper_from_honeycomb.json +++ b/data/minecraft/recipe/waxed_exposed_copper_from_honeycomb.json @@ -3,12 +3,8 @@ "category": "building", "group": "waxed_exposed_copper", "ingredients": [ - { - "item": "minecraft:exposed_copper" - }, - { - "item": "minecraft:honeycomb" - } + "minecraft:exposed_copper", + "minecraft:honeycomb" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/waxed_exposed_copper_grate.json b/data/minecraft/recipe/waxed_exposed_copper_grate.json index bcdfad73..73b396b7 100644 --- a/data/minecraft/recipe/waxed_exposed_copper_grate.json +++ b/data/minecraft/recipe/waxed_exposed_copper_grate.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "M": { - "item": "minecraft:waxed_exposed_copper" - } + "M": "minecraft:waxed_exposed_copper" }, "pattern": [ " M ", diff --git a/data/minecraft/recipe/waxed_exposed_copper_grate_from_honeycomb.json b/data/minecraft/recipe/waxed_exposed_copper_grate_from_honeycomb.json index a295cd51..653d4c7d 100644 --- a/data/minecraft/recipe/waxed_exposed_copper_grate_from_honeycomb.json +++ b/data/minecraft/recipe/waxed_exposed_copper_grate_from_honeycomb.json @@ -3,12 +3,8 @@ "category": "building", "group": "waxed_exposed_copper_grate", "ingredients": [ - { - "item": "minecraft:exposed_copper_grate" - }, - { - "item": "minecraft:honeycomb" - } + "minecraft:exposed_copper_grate", + "minecraft:honeycomb" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/waxed_exposed_copper_grate_from_waxed_exposed_copper_stonecutting.json b/data/minecraft/recipe/waxed_exposed_copper_grate_from_waxed_exposed_copper_stonecutting.json index f66a4932..ecc67bde 100644 --- a/data/minecraft/recipe/waxed_exposed_copper_grate_from_waxed_exposed_copper_stonecutting.json +++ b/data/minecraft/recipe/waxed_exposed_copper_grate_from_waxed_exposed_copper_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:waxed_exposed_copper" - }, + "ingredient": "minecraft:waxed_exposed_copper", "result": { "count": 4, "id": "minecraft:waxed_exposed_copper_grate" diff --git a/data/minecraft/recipe/waxed_exposed_copper_trapdoor_from_honeycomb.json b/data/minecraft/recipe/waxed_exposed_copper_trapdoor_from_honeycomb.json index 47533b0f..0b3bd385 100644 --- a/data/minecraft/recipe/waxed_exposed_copper_trapdoor_from_honeycomb.json +++ b/data/minecraft/recipe/waxed_exposed_copper_trapdoor_from_honeycomb.json @@ -3,12 +3,8 @@ "category": "building", "group": "waxed_exposed_copper_trapdoor", "ingredients": [ - { - "item": "minecraft:exposed_copper_trapdoor" - }, - { - "item": "minecraft:honeycomb" - } + "minecraft:exposed_copper_trapdoor", + "minecraft:honeycomb" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/waxed_exposed_cut_copper.json b/data/minecraft/recipe/waxed_exposed_cut_copper.json index a4c1ada6..1c59d4ad 100644 --- a/data/minecraft/recipe/waxed_exposed_cut_copper.json +++ b/data/minecraft/recipe/waxed_exposed_cut_copper.json @@ -3,9 +3,7 @@ "category": "building", "group": "waxed_exposed_cut_copper", "key": { - "#": { - "item": "minecraft:waxed_exposed_copper" - } + "#": "minecraft:waxed_exposed_copper" }, "pattern": [ "##", diff --git a/data/minecraft/recipe/waxed_exposed_cut_copper_from_honeycomb.json b/data/minecraft/recipe/waxed_exposed_cut_copper_from_honeycomb.json index 66a70c93..b62052e4 100644 --- a/data/minecraft/recipe/waxed_exposed_cut_copper_from_honeycomb.json +++ b/data/minecraft/recipe/waxed_exposed_cut_copper_from_honeycomb.json @@ -3,12 +3,8 @@ "category": "building", "group": "waxed_exposed_cut_copper", "ingredients": [ - { - "item": "minecraft:exposed_cut_copper" - }, - { - "item": "minecraft:honeycomb" - } + "minecraft:exposed_cut_copper", + "minecraft:honeycomb" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/waxed_exposed_cut_copper_from_waxed_exposed_copper_stonecutting.json b/data/minecraft/recipe/waxed_exposed_cut_copper_from_waxed_exposed_copper_stonecutting.json index 679e1707..e4b608aa 100644 --- a/data/minecraft/recipe/waxed_exposed_cut_copper_from_waxed_exposed_copper_stonecutting.json +++ b/data/minecraft/recipe/waxed_exposed_cut_copper_from_waxed_exposed_copper_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:waxed_exposed_copper" - }, + "ingredient": "minecraft:waxed_exposed_copper", "result": { "count": 4, "id": "minecraft:waxed_exposed_cut_copper" diff --git a/data/minecraft/recipe/waxed_exposed_cut_copper_slab.json b/data/minecraft/recipe/waxed_exposed_cut_copper_slab.json index 664394ff..177a4b6e 100644 --- a/data/minecraft/recipe/waxed_exposed_cut_copper_slab.json +++ b/data/minecraft/recipe/waxed_exposed_cut_copper_slab.json @@ -3,9 +3,7 @@ "category": "building", "group": "waxed_exposed_cut_copper_slab", "key": { - "#": { - "item": "minecraft:waxed_exposed_cut_copper" - } + "#": "minecraft:waxed_exposed_cut_copper" }, "pattern": [ "###" diff --git a/data/minecraft/recipe/waxed_exposed_cut_copper_slab_from_honeycomb.json b/data/minecraft/recipe/waxed_exposed_cut_copper_slab_from_honeycomb.json index 17ff8089..f9f43cb1 100644 --- a/data/minecraft/recipe/waxed_exposed_cut_copper_slab_from_honeycomb.json +++ b/data/minecraft/recipe/waxed_exposed_cut_copper_slab_from_honeycomb.json @@ -3,12 +3,8 @@ "category": "building", "group": "waxed_exposed_cut_copper_slab", "ingredients": [ - { - "item": "minecraft:exposed_cut_copper_slab" - }, - { - "item": "minecraft:honeycomb" - } + "minecraft:exposed_cut_copper_slab", + "minecraft:honeycomb" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/waxed_exposed_cut_copper_slab_from_waxed_exposed_copper_stonecutting.json b/data/minecraft/recipe/waxed_exposed_cut_copper_slab_from_waxed_exposed_copper_stonecutting.json index ee82afcf..f5e37d2c 100644 --- a/data/minecraft/recipe/waxed_exposed_cut_copper_slab_from_waxed_exposed_copper_stonecutting.json +++ b/data/minecraft/recipe/waxed_exposed_cut_copper_slab_from_waxed_exposed_copper_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:waxed_exposed_copper" - }, + "ingredient": "minecraft:waxed_exposed_copper", "result": { "count": 8, "id": "minecraft:waxed_exposed_cut_copper_slab" diff --git a/data/minecraft/recipe/waxed_exposed_cut_copper_slab_from_waxed_exposed_cut_copper_stonecutting.json b/data/minecraft/recipe/waxed_exposed_cut_copper_slab_from_waxed_exposed_cut_copper_stonecutting.json index f134671a..cc39ee9d 100644 --- a/data/minecraft/recipe/waxed_exposed_cut_copper_slab_from_waxed_exposed_cut_copper_stonecutting.json +++ b/data/minecraft/recipe/waxed_exposed_cut_copper_slab_from_waxed_exposed_cut_copper_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:waxed_exposed_cut_copper" - }, + "ingredient": "minecraft:waxed_exposed_cut_copper", "result": { "count": 2, "id": "minecraft:waxed_exposed_cut_copper_slab" diff --git a/data/minecraft/recipe/waxed_exposed_cut_copper_stairs.json b/data/minecraft/recipe/waxed_exposed_cut_copper_stairs.json index bff1e305..1fe5d859 100644 --- a/data/minecraft/recipe/waxed_exposed_cut_copper_stairs.json +++ b/data/minecraft/recipe/waxed_exposed_cut_copper_stairs.json @@ -3,9 +3,7 @@ "category": "building", "group": "waxed_exposed_cut_copper_stairs", "key": { - "#": { - "item": "minecraft:waxed_exposed_cut_copper" - } + "#": "minecraft:waxed_exposed_cut_copper" }, "pattern": [ "# ", diff --git a/data/minecraft/recipe/waxed_exposed_cut_copper_stairs_from_honeycomb.json b/data/minecraft/recipe/waxed_exposed_cut_copper_stairs_from_honeycomb.json index bb22cbc4..25d76e6e 100644 --- a/data/minecraft/recipe/waxed_exposed_cut_copper_stairs_from_honeycomb.json +++ b/data/minecraft/recipe/waxed_exposed_cut_copper_stairs_from_honeycomb.json @@ -3,12 +3,8 @@ "category": "building", "group": "waxed_exposed_cut_copper_stairs", "ingredients": [ - { - "item": "minecraft:exposed_cut_copper_stairs" - }, - { - "item": "minecraft:honeycomb" - } + "minecraft:exposed_cut_copper_stairs", + "minecraft:honeycomb" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/waxed_exposed_cut_copper_stairs_from_waxed_exposed_copper_stonecutting.json b/data/minecraft/recipe/waxed_exposed_cut_copper_stairs_from_waxed_exposed_copper_stonecutting.json index 1f1f1ac8..d2ab1991 100644 --- a/data/minecraft/recipe/waxed_exposed_cut_copper_stairs_from_waxed_exposed_copper_stonecutting.json +++ b/data/minecraft/recipe/waxed_exposed_cut_copper_stairs_from_waxed_exposed_copper_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:waxed_exposed_copper" - }, + "ingredient": "minecraft:waxed_exposed_copper", "result": { "count": 4, "id": "minecraft:waxed_exposed_cut_copper_stairs" diff --git a/data/minecraft/recipe/waxed_exposed_cut_copper_stairs_from_waxed_exposed_cut_copper_stonecutting.json b/data/minecraft/recipe/waxed_exposed_cut_copper_stairs_from_waxed_exposed_cut_copper_stonecutting.json index abe95bdc..ce3f0e55 100644 --- a/data/minecraft/recipe/waxed_exposed_cut_copper_stairs_from_waxed_exposed_cut_copper_stonecutting.json +++ b/data/minecraft/recipe/waxed_exposed_cut_copper_stairs_from_waxed_exposed_cut_copper_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:waxed_exposed_cut_copper" - }, + "ingredient": "minecraft:waxed_exposed_cut_copper", "result": { "count": 1, "id": "minecraft:waxed_exposed_cut_copper_stairs" diff --git a/data/minecraft/recipe/waxed_oxidized_chiseled_copper.json b/data/minecraft/recipe/waxed_oxidized_chiseled_copper.json index 48d56c7b..b02468c7 100644 --- a/data/minecraft/recipe/waxed_oxidized_chiseled_copper.json +++ b/data/minecraft/recipe/waxed_oxidized_chiseled_copper.json @@ -3,9 +3,7 @@ "category": "building", "group": "waxed_oxidized_cut_copper_chiseled", "key": { - "#": { - "item": "minecraft:waxed_oxidized_cut_copper_slab" - } + "#": "minecraft:waxed_oxidized_cut_copper_slab" }, "pattern": [ "#", diff --git a/data/minecraft/recipe/waxed_oxidized_chiseled_copper_from_honeycomb.json b/data/minecraft/recipe/waxed_oxidized_chiseled_copper_from_honeycomb.json index 5f9ffbae..3ce0cae3 100644 --- a/data/minecraft/recipe/waxed_oxidized_chiseled_copper_from_honeycomb.json +++ b/data/minecraft/recipe/waxed_oxidized_chiseled_copper_from_honeycomb.json @@ -3,12 +3,8 @@ "category": "building", "group": "waxed_oxidized_chiseled_copper", "ingredients": [ - { - "item": "minecraft:oxidized_chiseled_copper" - }, - { - "item": "minecraft:honeycomb" - } + "minecraft:oxidized_chiseled_copper", + "minecraft:honeycomb" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/waxed_oxidized_chiseled_copper_from_waxed_oxidized_copper_stonecutting.json b/data/minecraft/recipe/waxed_oxidized_chiseled_copper_from_waxed_oxidized_copper_stonecutting.json index f041db0d..7f5720ad 100644 --- a/data/minecraft/recipe/waxed_oxidized_chiseled_copper_from_waxed_oxidized_copper_stonecutting.json +++ b/data/minecraft/recipe/waxed_oxidized_chiseled_copper_from_waxed_oxidized_copper_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:waxed_oxidized_copper" - }, + "ingredient": "minecraft:waxed_oxidized_copper", "result": { "count": 4, "id": "minecraft:waxed_oxidized_chiseled_copper" diff --git a/data/minecraft/recipe/waxed_oxidized_chiseled_copper_from_waxed_oxidized_cut_copper_stonecutting.json b/data/minecraft/recipe/waxed_oxidized_chiseled_copper_from_waxed_oxidized_cut_copper_stonecutting.json index 3c440e01..b8367fa6 100644 --- a/data/minecraft/recipe/waxed_oxidized_chiseled_copper_from_waxed_oxidized_cut_copper_stonecutting.json +++ b/data/minecraft/recipe/waxed_oxidized_chiseled_copper_from_waxed_oxidized_cut_copper_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:waxed_oxidized_cut_copper" - }, + "ingredient": "minecraft:waxed_oxidized_cut_copper", "result": { "count": 1, "id": "minecraft:waxed_oxidized_chiseled_copper" diff --git a/data/minecraft/recipe/waxed_oxidized_copper_bulb.json b/data/minecraft/recipe/waxed_oxidized_copper_bulb.json index 452a0056..829ca338 100644 --- a/data/minecraft/recipe/waxed_oxidized_copper_bulb.json +++ b/data/minecraft/recipe/waxed_oxidized_copper_bulb.json @@ -2,15 +2,9 @@ "type": "minecraft:crafting_shaped", "category": "redstone", "key": { - "B": { - "item": "minecraft:blaze_rod" - }, - "C": { - "item": "minecraft:waxed_oxidized_copper" - }, - "R": { - "item": "minecraft:redstone" - } + "B": "minecraft:blaze_rod", + "C": "minecraft:waxed_oxidized_copper", + "R": "minecraft:redstone" }, "pattern": [ " C ", diff --git a/data/minecraft/recipe/waxed_oxidized_copper_bulb_from_honeycomb.json b/data/minecraft/recipe/waxed_oxidized_copper_bulb_from_honeycomb.json index c1f9818a..7c82feb1 100644 --- a/data/minecraft/recipe/waxed_oxidized_copper_bulb_from_honeycomb.json +++ b/data/minecraft/recipe/waxed_oxidized_copper_bulb_from_honeycomb.json @@ -3,12 +3,8 @@ "category": "building", "group": "waxed_oxidized_copper_bulb", "ingredients": [ - { - "item": "minecraft:oxidized_copper_bulb" - }, - { - "item": "minecraft:honeycomb" - } + "minecraft:oxidized_copper_bulb", + "minecraft:honeycomb" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/waxed_oxidized_copper_door_from_honeycomb.json b/data/minecraft/recipe/waxed_oxidized_copper_door_from_honeycomb.json index c1c90f36..075e8854 100644 --- a/data/minecraft/recipe/waxed_oxidized_copper_door_from_honeycomb.json +++ b/data/minecraft/recipe/waxed_oxidized_copper_door_from_honeycomb.json @@ -3,12 +3,8 @@ "category": "building", "group": "waxed_oxidized_copper_door", "ingredients": [ - { - "item": "minecraft:oxidized_copper_door" - }, - { - "item": "minecraft:honeycomb" - } + "minecraft:oxidized_copper_door", + "minecraft:honeycomb" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/waxed_oxidized_copper_from_honeycomb.json b/data/minecraft/recipe/waxed_oxidized_copper_from_honeycomb.json index 9b6a5fff..78c628cd 100644 --- a/data/minecraft/recipe/waxed_oxidized_copper_from_honeycomb.json +++ b/data/minecraft/recipe/waxed_oxidized_copper_from_honeycomb.json @@ -3,12 +3,8 @@ "category": "building", "group": "waxed_oxidized_copper", "ingredients": [ - { - "item": "minecraft:oxidized_copper" - }, - { - "item": "minecraft:honeycomb" - } + "minecraft:oxidized_copper", + "minecraft:honeycomb" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/waxed_oxidized_copper_grate.json b/data/minecraft/recipe/waxed_oxidized_copper_grate.json index 5a92b806..cd0be4f2 100644 --- a/data/minecraft/recipe/waxed_oxidized_copper_grate.json +++ b/data/minecraft/recipe/waxed_oxidized_copper_grate.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "M": { - "item": "minecraft:waxed_oxidized_copper" - } + "M": "minecraft:waxed_oxidized_copper" }, "pattern": [ " M ", diff --git a/data/minecraft/recipe/waxed_oxidized_copper_grate_from_honeycomb.json b/data/minecraft/recipe/waxed_oxidized_copper_grate_from_honeycomb.json index a9b7ab59..3146b553 100644 --- a/data/minecraft/recipe/waxed_oxidized_copper_grate_from_honeycomb.json +++ b/data/minecraft/recipe/waxed_oxidized_copper_grate_from_honeycomb.json @@ -3,12 +3,8 @@ "category": "building", "group": "waxed_oxidized_copper_grate", "ingredients": [ - { - "item": "minecraft:oxidized_copper_grate" - }, - { - "item": "minecraft:honeycomb" - } + "minecraft:oxidized_copper_grate", + "minecraft:honeycomb" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/waxed_oxidized_copper_grate_from_waxed_oxidized_copper_stonecutting.json b/data/minecraft/recipe/waxed_oxidized_copper_grate_from_waxed_oxidized_copper_stonecutting.json index f2170694..3c40d15b 100644 --- a/data/minecraft/recipe/waxed_oxidized_copper_grate_from_waxed_oxidized_copper_stonecutting.json +++ b/data/minecraft/recipe/waxed_oxidized_copper_grate_from_waxed_oxidized_copper_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:waxed_oxidized_copper" - }, + "ingredient": "minecraft:waxed_oxidized_copper", "result": { "count": 4, "id": "minecraft:waxed_oxidized_copper_grate" diff --git a/data/minecraft/recipe/waxed_oxidized_copper_trapdoor_from_honeycomb.json b/data/minecraft/recipe/waxed_oxidized_copper_trapdoor_from_honeycomb.json index 4203a7cc..cf643827 100644 --- a/data/minecraft/recipe/waxed_oxidized_copper_trapdoor_from_honeycomb.json +++ b/data/minecraft/recipe/waxed_oxidized_copper_trapdoor_from_honeycomb.json @@ -3,12 +3,8 @@ "category": "building", "group": "waxed_oxidized_copper_trapdoor", "ingredients": [ - { - "item": "minecraft:oxidized_copper_trapdoor" - }, - { - "item": "minecraft:honeycomb" - } + "minecraft:oxidized_copper_trapdoor", + "minecraft:honeycomb" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/waxed_oxidized_cut_copper.json b/data/minecraft/recipe/waxed_oxidized_cut_copper.json index 32d57daa..2493f0c2 100644 --- a/data/minecraft/recipe/waxed_oxidized_cut_copper.json +++ b/data/minecraft/recipe/waxed_oxidized_cut_copper.json @@ -3,9 +3,7 @@ "category": "building", "group": "waxed_oxidized_cut_copper", "key": { - "#": { - "item": "minecraft:waxed_oxidized_copper" - } + "#": "minecraft:waxed_oxidized_copper" }, "pattern": [ "##", diff --git a/data/minecraft/recipe/waxed_oxidized_cut_copper_from_honeycomb.json b/data/minecraft/recipe/waxed_oxidized_cut_copper_from_honeycomb.json index 65bf655c..6d57b850 100644 --- a/data/minecraft/recipe/waxed_oxidized_cut_copper_from_honeycomb.json +++ b/data/minecraft/recipe/waxed_oxidized_cut_copper_from_honeycomb.json @@ -3,12 +3,8 @@ "category": "building", "group": "waxed_oxidized_cut_copper", "ingredients": [ - { - "item": "minecraft:oxidized_cut_copper" - }, - { - "item": "minecraft:honeycomb" - } + "minecraft:oxidized_cut_copper", + "minecraft:honeycomb" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/waxed_oxidized_cut_copper_from_waxed_oxidized_copper_stonecutting.json b/data/minecraft/recipe/waxed_oxidized_cut_copper_from_waxed_oxidized_copper_stonecutting.json index ec6d2ddc..73581a1f 100644 --- a/data/minecraft/recipe/waxed_oxidized_cut_copper_from_waxed_oxidized_copper_stonecutting.json +++ b/data/minecraft/recipe/waxed_oxidized_cut_copper_from_waxed_oxidized_copper_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:waxed_oxidized_copper" - }, + "ingredient": "minecraft:waxed_oxidized_copper", "result": { "count": 4, "id": "minecraft:waxed_oxidized_cut_copper" diff --git a/data/minecraft/recipe/waxed_oxidized_cut_copper_slab.json b/data/minecraft/recipe/waxed_oxidized_cut_copper_slab.json index dc24a34d..9f39f48b 100644 --- a/data/minecraft/recipe/waxed_oxidized_cut_copper_slab.json +++ b/data/minecraft/recipe/waxed_oxidized_cut_copper_slab.json @@ -3,9 +3,7 @@ "category": "building", "group": "waxed_oxidized_cut_copper_slab", "key": { - "#": { - "item": "minecraft:waxed_oxidized_cut_copper" - } + "#": "minecraft:waxed_oxidized_cut_copper" }, "pattern": [ "###" diff --git a/data/minecraft/recipe/waxed_oxidized_cut_copper_slab_from_honeycomb.json b/data/minecraft/recipe/waxed_oxidized_cut_copper_slab_from_honeycomb.json index 0ebbb41e..043fd5e9 100644 --- a/data/minecraft/recipe/waxed_oxidized_cut_copper_slab_from_honeycomb.json +++ b/data/minecraft/recipe/waxed_oxidized_cut_copper_slab_from_honeycomb.json @@ -3,12 +3,8 @@ "category": "building", "group": "waxed_oxidized_cut_copper_slab", "ingredients": [ - { - "item": "minecraft:oxidized_cut_copper_slab" - }, - { - "item": "minecraft:honeycomb" - } + "minecraft:oxidized_cut_copper_slab", + "minecraft:honeycomb" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/waxed_oxidized_cut_copper_slab_from_waxed_oxidized_copper_stonecutting.json b/data/minecraft/recipe/waxed_oxidized_cut_copper_slab_from_waxed_oxidized_copper_stonecutting.json index fc029be8..d6e7f51e 100644 --- a/data/minecraft/recipe/waxed_oxidized_cut_copper_slab_from_waxed_oxidized_copper_stonecutting.json +++ b/data/minecraft/recipe/waxed_oxidized_cut_copper_slab_from_waxed_oxidized_copper_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:waxed_oxidized_copper" - }, + "ingredient": "minecraft:waxed_oxidized_copper", "result": { "count": 8, "id": "minecraft:waxed_oxidized_cut_copper_slab" diff --git a/data/minecraft/recipe/waxed_oxidized_cut_copper_slab_from_waxed_oxidized_cut_copper_stonecutting.json b/data/minecraft/recipe/waxed_oxidized_cut_copper_slab_from_waxed_oxidized_cut_copper_stonecutting.json index bf039613..cbde8f7c 100644 --- a/data/minecraft/recipe/waxed_oxidized_cut_copper_slab_from_waxed_oxidized_cut_copper_stonecutting.json +++ b/data/minecraft/recipe/waxed_oxidized_cut_copper_slab_from_waxed_oxidized_cut_copper_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:waxed_oxidized_cut_copper" - }, + "ingredient": "minecraft:waxed_oxidized_cut_copper", "result": { "count": 2, "id": "minecraft:waxed_oxidized_cut_copper_slab" diff --git a/data/minecraft/recipe/waxed_oxidized_cut_copper_stairs.json b/data/minecraft/recipe/waxed_oxidized_cut_copper_stairs.json index e9a67202..729c4f25 100644 --- a/data/minecraft/recipe/waxed_oxidized_cut_copper_stairs.json +++ b/data/minecraft/recipe/waxed_oxidized_cut_copper_stairs.json @@ -3,9 +3,7 @@ "category": "building", "group": "waxed_oxidized_cut_copper_stairs", "key": { - "#": { - "item": "minecraft:waxed_oxidized_cut_copper" - } + "#": "minecraft:waxed_oxidized_cut_copper" }, "pattern": [ "# ", diff --git a/data/minecraft/recipe/waxed_oxidized_cut_copper_stairs_from_honeycomb.json b/data/minecraft/recipe/waxed_oxidized_cut_copper_stairs_from_honeycomb.json index 4f0fe722..bc3158e8 100644 --- a/data/minecraft/recipe/waxed_oxidized_cut_copper_stairs_from_honeycomb.json +++ b/data/minecraft/recipe/waxed_oxidized_cut_copper_stairs_from_honeycomb.json @@ -3,12 +3,8 @@ "category": "building", "group": "waxed_oxidized_cut_copper_stairs", "ingredients": [ - { - "item": "minecraft:oxidized_cut_copper_stairs" - }, - { - "item": "minecraft:honeycomb" - } + "minecraft:oxidized_cut_copper_stairs", + "minecraft:honeycomb" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/waxed_oxidized_cut_copper_stairs_from_waxed_oxidized_copper_stonecutting.json b/data/minecraft/recipe/waxed_oxidized_cut_copper_stairs_from_waxed_oxidized_copper_stonecutting.json index 0d19d4ee..45625cd5 100644 --- a/data/minecraft/recipe/waxed_oxidized_cut_copper_stairs_from_waxed_oxidized_copper_stonecutting.json +++ b/data/minecraft/recipe/waxed_oxidized_cut_copper_stairs_from_waxed_oxidized_copper_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:waxed_oxidized_copper" - }, + "ingredient": "minecraft:waxed_oxidized_copper", "result": { "count": 4, "id": "minecraft:waxed_oxidized_cut_copper_stairs" diff --git a/data/minecraft/recipe/waxed_oxidized_cut_copper_stairs_from_waxed_oxidized_cut_copper_stonecutting.json b/data/minecraft/recipe/waxed_oxidized_cut_copper_stairs_from_waxed_oxidized_cut_copper_stonecutting.json index 477c99a2..9ae24c66 100644 --- a/data/minecraft/recipe/waxed_oxidized_cut_copper_stairs_from_waxed_oxidized_cut_copper_stonecutting.json +++ b/data/minecraft/recipe/waxed_oxidized_cut_copper_stairs_from_waxed_oxidized_cut_copper_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:waxed_oxidized_cut_copper" - }, + "ingredient": "minecraft:waxed_oxidized_cut_copper", "result": { "count": 1, "id": "minecraft:waxed_oxidized_cut_copper_stairs" diff --git a/data/minecraft/recipe/waxed_weathered_chiseled_copper.json b/data/minecraft/recipe/waxed_weathered_chiseled_copper.json index 53242cc3..9ffcdadc 100644 --- a/data/minecraft/recipe/waxed_weathered_chiseled_copper.json +++ b/data/minecraft/recipe/waxed_weathered_chiseled_copper.json @@ -3,9 +3,7 @@ "category": "building", "group": "waxed_weathered_cut_copper_chiseled", "key": { - "#": { - "item": "minecraft:waxed_weathered_cut_copper_slab" - } + "#": "minecraft:waxed_weathered_cut_copper_slab" }, "pattern": [ "#", diff --git a/data/minecraft/recipe/waxed_weathered_chiseled_copper_from_honeycomb.json b/data/minecraft/recipe/waxed_weathered_chiseled_copper_from_honeycomb.json index 03d442ed..63737931 100644 --- a/data/minecraft/recipe/waxed_weathered_chiseled_copper_from_honeycomb.json +++ b/data/minecraft/recipe/waxed_weathered_chiseled_copper_from_honeycomb.json @@ -3,12 +3,8 @@ "category": "building", "group": "waxed_weathered_chiseled_copper", "ingredients": [ - { - "item": "minecraft:weathered_chiseled_copper" - }, - { - "item": "minecraft:honeycomb" - } + "minecraft:weathered_chiseled_copper", + "minecraft:honeycomb" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/waxed_weathered_chiseled_copper_from_waxed_weathered_copper_stonecutting.json b/data/minecraft/recipe/waxed_weathered_chiseled_copper_from_waxed_weathered_copper_stonecutting.json index 0a836383..c3a57f8b 100644 --- a/data/minecraft/recipe/waxed_weathered_chiseled_copper_from_waxed_weathered_copper_stonecutting.json +++ b/data/minecraft/recipe/waxed_weathered_chiseled_copper_from_waxed_weathered_copper_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:waxed_weathered_copper" - }, + "ingredient": "minecraft:waxed_weathered_copper", "result": { "count": 4, "id": "minecraft:waxed_weathered_chiseled_copper" diff --git a/data/minecraft/recipe/waxed_weathered_chiseled_copper_from_waxed_weathered_cut_copper_stonecutting.json b/data/minecraft/recipe/waxed_weathered_chiseled_copper_from_waxed_weathered_cut_copper_stonecutting.json index a081489f..44a9b926 100644 --- a/data/minecraft/recipe/waxed_weathered_chiseled_copper_from_waxed_weathered_cut_copper_stonecutting.json +++ b/data/minecraft/recipe/waxed_weathered_chiseled_copper_from_waxed_weathered_cut_copper_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:waxed_weathered_cut_copper" - }, + "ingredient": "minecraft:waxed_weathered_cut_copper", "result": { "count": 1, "id": "minecraft:waxed_weathered_chiseled_copper" diff --git a/data/minecraft/recipe/waxed_weathered_copper_bulb.json b/data/minecraft/recipe/waxed_weathered_copper_bulb.json index 0da99b4b..6a9b13cc 100644 --- a/data/minecraft/recipe/waxed_weathered_copper_bulb.json +++ b/data/minecraft/recipe/waxed_weathered_copper_bulb.json @@ -2,15 +2,9 @@ "type": "minecraft:crafting_shaped", "category": "redstone", "key": { - "B": { - "item": "minecraft:blaze_rod" - }, - "C": { - "item": "minecraft:waxed_weathered_copper" - }, - "R": { - "item": "minecraft:redstone" - } + "B": "minecraft:blaze_rod", + "C": "minecraft:waxed_weathered_copper", + "R": "minecraft:redstone" }, "pattern": [ " C ", diff --git a/data/minecraft/recipe/waxed_weathered_copper_bulb_from_honeycomb.json b/data/minecraft/recipe/waxed_weathered_copper_bulb_from_honeycomb.json index d3421d3e..fff7370a 100644 --- a/data/minecraft/recipe/waxed_weathered_copper_bulb_from_honeycomb.json +++ b/data/minecraft/recipe/waxed_weathered_copper_bulb_from_honeycomb.json @@ -3,12 +3,8 @@ "category": "building", "group": "waxed_weathered_copper_bulb", "ingredients": [ - { - "item": "minecraft:weathered_copper_bulb" - }, - { - "item": "minecraft:honeycomb" - } + "minecraft:weathered_copper_bulb", + "minecraft:honeycomb" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/waxed_weathered_copper_door_from_honeycomb.json b/data/minecraft/recipe/waxed_weathered_copper_door_from_honeycomb.json index a0e7cfff..e6e1b253 100644 --- a/data/minecraft/recipe/waxed_weathered_copper_door_from_honeycomb.json +++ b/data/minecraft/recipe/waxed_weathered_copper_door_from_honeycomb.json @@ -3,12 +3,8 @@ "category": "building", "group": "waxed_weathered_copper_door", "ingredients": [ - { - "item": "minecraft:weathered_copper_door" - }, - { - "item": "minecraft:honeycomb" - } + "minecraft:weathered_copper_door", + "minecraft:honeycomb" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/waxed_weathered_copper_from_honeycomb.json b/data/minecraft/recipe/waxed_weathered_copper_from_honeycomb.json index 42550f29..800e8945 100644 --- a/data/minecraft/recipe/waxed_weathered_copper_from_honeycomb.json +++ b/data/minecraft/recipe/waxed_weathered_copper_from_honeycomb.json @@ -3,12 +3,8 @@ "category": "building", "group": "waxed_weathered_copper", "ingredients": [ - { - "item": "minecraft:weathered_copper" - }, - { - "item": "minecraft:honeycomb" - } + "minecraft:weathered_copper", + "minecraft:honeycomb" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/waxed_weathered_copper_grate.json b/data/minecraft/recipe/waxed_weathered_copper_grate.json index 9f20d5c5..51f480a9 100644 --- a/data/minecraft/recipe/waxed_weathered_copper_grate.json +++ b/data/minecraft/recipe/waxed_weathered_copper_grate.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "M": { - "item": "minecraft:waxed_weathered_copper" - } + "M": "minecraft:waxed_weathered_copper" }, "pattern": [ " M ", diff --git a/data/minecraft/recipe/waxed_weathered_copper_grate_from_honeycomb.json b/data/minecraft/recipe/waxed_weathered_copper_grate_from_honeycomb.json index 59704e07..c97f42bb 100644 --- a/data/minecraft/recipe/waxed_weathered_copper_grate_from_honeycomb.json +++ b/data/minecraft/recipe/waxed_weathered_copper_grate_from_honeycomb.json @@ -3,12 +3,8 @@ "category": "building", "group": "waxed_weathered_copper_grate", "ingredients": [ - { - "item": "minecraft:weathered_copper_grate" - }, - { - "item": "minecraft:honeycomb" - } + "minecraft:weathered_copper_grate", + "minecraft:honeycomb" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/waxed_weathered_copper_grate_from_waxed_weathered_copper_stonecutting.json b/data/minecraft/recipe/waxed_weathered_copper_grate_from_waxed_weathered_copper_stonecutting.json index e77620cc..58c276dd 100644 --- a/data/minecraft/recipe/waxed_weathered_copper_grate_from_waxed_weathered_copper_stonecutting.json +++ b/data/minecraft/recipe/waxed_weathered_copper_grate_from_waxed_weathered_copper_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:waxed_weathered_copper" - }, + "ingredient": "minecraft:waxed_weathered_copper", "result": { "count": 4, "id": "minecraft:waxed_weathered_copper_grate" diff --git a/data/minecraft/recipe/waxed_weathered_copper_trapdoor_from_honeycomb.json b/data/minecraft/recipe/waxed_weathered_copper_trapdoor_from_honeycomb.json index 265bf3cb..d2a9ce07 100644 --- a/data/minecraft/recipe/waxed_weathered_copper_trapdoor_from_honeycomb.json +++ b/data/minecraft/recipe/waxed_weathered_copper_trapdoor_from_honeycomb.json @@ -3,12 +3,8 @@ "category": "building", "group": "waxed_weathered_copper_trapdoor", "ingredients": [ - { - "item": "minecraft:weathered_copper_trapdoor" - }, - { - "item": "minecraft:honeycomb" - } + "minecraft:weathered_copper_trapdoor", + "minecraft:honeycomb" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/waxed_weathered_cut_copper.json b/data/minecraft/recipe/waxed_weathered_cut_copper.json index a07b669a..3974f10a 100644 --- a/data/minecraft/recipe/waxed_weathered_cut_copper.json +++ b/data/minecraft/recipe/waxed_weathered_cut_copper.json @@ -3,9 +3,7 @@ "category": "building", "group": "waxed_weathered_cut_copper", "key": { - "#": { - "item": "minecraft:waxed_weathered_copper" - } + "#": "minecraft:waxed_weathered_copper" }, "pattern": [ "##", diff --git a/data/minecraft/recipe/waxed_weathered_cut_copper_from_honeycomb.json b/data/minecraft/recipe/waxed_weathered_cut_copper_from_honeycomb.json index 27f4ea09..ff81a1b0 100644 --- a/data/minecraft/recipe/waxed_weathered_cut_copper_from_honeycomb.json +++ b/data/minecraft/recipe/waxed_weathered_cut_copper_from_honeycomb.json @@ -3,12 +3,8 @@ "category": "building", "group": "waxed_weathered_cut_copper", "ingredients": [ - { - "item": "minecraft:weathered_cut_copper" - }, - { - "item": "minecraft:honeycomb" - } + "minecraft:weathered_cut_copper", + "minecraft:honeycomb" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/waxed_weathered_cut_copper_from_waxed_weathered_copper_stonecutting.json b/data/minecraft/recipe/waxed_weathered_cut_copper_from_waxed_weathered_copper_stonecutting.json index 9ae8af09..41b85441 100644 --- a/data/minecraft/recipe/waxed_weathered_cut_copper_from_waxed_weathered_copper_stonecutting.json +++ b/data/minecraft/recipe/waxed_weathered_cut_copper_from_waxed_weathered_copper_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:waxed_weathered_copper" - }, + "ingredient": "minecraft:waxed_weathered_copper", "result": { "count": 4, "id": "minecraft:waxed_weathered_cut_copper" diff --git a/data/minecraft/recipe/waxed_weathered_cut_copper_slab.json b/data/minecraft/recipe/waxed_weathered_cut_copper_slab.json index 421b4820..0657aee7 100644 --- a/data/minecraft/recipe/waxed_weathered_cut_copper_slab.json +++ b/data/minecraft/recipe/waxed_weathered_cut_copper_slab.json @@ -3,9 +3,7 @@ "category": "building", "group": "waxed_weathered_cut_copper_slab", "key": { - "#": { - "item": "minecraft:waxed_weathered_cut_copper" - } + "#": "minecraft:waxed_weathered_cut_copper" }, "pattern": [ "###" diff --git a/data/minecraft/recipe/waxed_weathered_cut_copper_slab_from_honeycomb.json b/data/minecraft/recipe/waxed_weathered_cut_copper_slab_from_honeycomb.json index 768e3e2a..d366839f 100644 --- a/data/minecraft/recipe/waxed_weathered_cut_copper_slab_from_honeycomb.json +++ b/data/minecraft/recipe/waxed_weathered_cut_copper_slab_from_honeycomb.json @@ -3,12 +3,8 @@ "category": "building", "group": "waxed_weathered_cut_copper_slab", "ingredients": [ - { - "item": "minecraft:weathered_cut_copper_slab" - }, - { - "item": "minecraft:honeycomb" - } + "minecraft:weathered_cut_copper_slab", + "minecraft:honeycomb" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/waxed_weathered_cut_copper_slab_from_waxed_weathered_copper_stonecutting.json b/data/minecraft/recipe/waxed_weathered_cut_copper_slab_from_waxed_weathered_copper_stonecutting.json index a5e9acd9..daf8caf9 100644 --- a/data/minecraft/recipe/waxed_weathered_cut_copper_slab_from_waxed_weathered_copper_stonecutting.json +++ b/data/minecraft/recipe/waxed_weathered_cut_copper_slab_from_waxed_weathered_copper_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:waxed_weathered_copper" - }, + "ingredient": "minecraft:waxed_weathered_copper", "result": { "count": 8, "id": "minecraft:waxed_weathered_cut_copper_slab" diff --git a/data/minecraft/recipe/waxed_weathered_cut_copper_slab_from_waxed_weathered_cut_copper_stonecutting.json b/data/minecraft/recipe/waxed_weathered_cut_copper_slab_from_waxed_weathered_cut_copper_stonecutting.json index d4319792..6b4e5915 100644 --- a/data/minecraft/recipe/waxed_weathered_cut_copper_slab_from_waxed_weathered_cut_copper_stonecutting.json +++ b/data/minecraft/recipe/waxed_weathered_cut_copper_slab_from_waxed_weathered_cut_copper_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:waxed_weathered_cut_copper" - }, + "ingredient": "minecraft:waxed_weathered_cut_copper", "result": { "count": 2, "id": "minecraft:waxed_weathered_cut_copper_slab" diff --git a/data/minecraft/recipe/waxed_weathered_cut_copper_stairs.json b/data/minecraft/recipe/waxed_weathered_cut_copper_stairs.json index 26cee52b..6b5b79f2 100644 --- a/data/minecraft/recipe/waxed_weathered_cut_copper_stairs.json +++ b/data/minecraft/recipe/waxed_weathered_cut_copper_stairs.json @@ -3,9 +3,7 @@ "category": "building", "group": "waxed_weathered_cut_copper_stairs", "key": { - "#": { - "item": "minecraft:waxed_weathered_cut_copper" - } + "#": "minecraft:waxed_weathered_cut_copper" }, "pattern": [ "# ", diff --git a/data/minecraft/recipe/waxed_weathered_cut_copper_stairs_from_honeycomb.json b/data/minecraft/recipe/waxed_weathered_cut_copper_stairs_from_honeycomb.json index 618de31e..ea07717b 100644 --- a/data/minecraft/recipe/waxed_weathered_cut_copper_stairs_from_honeycomb.json +++ b/data/minecraft/recipe/waxed_weathered_cut_copper_stairs_from_honeycomb.json @@ -3,12 +3,8 @@ "category": "building", "group": "waxed_weathered_cut_copper_stairs", "ingredients": [ - { - "item": "minecraft:weathered_cut_copper_stairs" - }, - { - "item": "minecraft:honeycomb" - } + "minecraft:weathered_cut_copper_stairs", + "minecraft:honeycomb" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/waxed_weathered_cut_copper_stairs_from_waxed_weathered_copper_stonecutting.json b/data/minecraft/recipe/waxed_weathered_cut_copper_stairs_from_waxed_weathered_copper_stonecutting.json index 5a4c8784..95d35a7a 100644 --- a/data/minecraft/recipe/waxed_weathered_cut_copper_stairs_from_waxed_weathered_copper_stonecutting.json +++ b/data/minecraft/recipe/waxed_weathered_cut_copper_stairs_from_waxed_weathered_copper_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:waxed_weathered_copper" - }, + "ingredient": "minecraft:waxed_weathered_copper", "result": { "count": 4, "id": "minecraft:waxed_weathered_cut_copper_stairs" diff --git a/data/minecraft/recipe/waxed_weathered_cut_copper_stairs_from_waxed_weathered_cut_copper_stonecutting.json b/data/minecraft/recipe/waxed_weathered_cut_copper_stairs_from_waxed_weathered_cut_copper_stonecutting.json index 9f419def..ba55fdd8 100644 --- a/data/minecraft/recipe/waxed_weathered_cut_copper_stairs_from_waxed_weathered_cut_copper_stonecutting.json +++ b/data/minecraft/recipe/waxed_weathered_cut_copper_stairs_from_waxed_weathered_cut_copper_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:waxed_weathered_cut_copper" - }, + "ingredient": "minecraft:waxed_weathered_cut_copper", "result": { "count": 1, "id": "minecraft:waxed_weathered_cut_copper_stairs" diff --git a/data/minecraft/recipe/wayfinder_armor_trim_smithing_template.json b/data/minecraft/recipe/wayfinder_armor_trim_smithing_template.json index 223f3036..e3d61c49 100644 --- a/data/minecraft/recipe/wayfinder_armor_trim_smithing_template.json +++ b/data/minecraft/recipe/wayfinder_armor_trim_smithing_template.json @@ -2,15 +2,9 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "#": { - "item": "minecraft:diamond" - }, - "C": { - "item": "minecraft:terracotta" - }, - "S": { - "item": "minecraft:wayfinder_armor_trim_smithing_template" - } + "#": "minecraft:diamond", + "C": "minecraft:terracotta", + "S": "minecraft:wayfinder_armor_trim_smithing_template" }, "pattern": [ "#S#", diff --git a/data/minecraft/recipe/wayfinder_armor_trim_smithing_template_smithing_trim.json b/data/minecraft/recipe/wayfinder_armor_trim_smithing_template_smithing_trim.json index 4e0387ac..073870fc 100644 --- a/data/minecraft/recipe/wayfinder_armor_trim_smithing_template_smithing_trim.json +++ b/data/minecraft/recipe/wayfinder_armor_trim_smithing_template_smithing_trim.json @@ -1,12 +1,6 @@ { "type": "minecraft:smithing_trim", - "addition": { - "tag": "minecraft:trim_materials" - }, - "base": { - "tag": "minecraft:trimmable_armor" - }, - "template": { - "item": "minecraft:wayfinder_armor_trim_smithing_template" - } + "addition": "#minecraft:trim_materials", + "base": "#minecraft:trimmable_armor", + "template": "minecraft:wayfinder_armor_trim_smithing_template" } \ No newline at end of file diff --git a/data/minecraft/recipe/weathered_chiseled_copper.json b/data/minecraft/recipe/weathered_chiseled_copper.json index 74e7f0d2..d36f9890 100644 --- a/data/minecraft/recipe/weathered_chiseled_copper.json +++ b/data/minecraft/recipe/weathered_chiseled_copper.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:weathered_cut_copper_slab" - } + "#": "minecraft:weathered_cut_copper_slab" }, "pattern": [ "#", diff --git a/data/minecraft/recipe/weathered_chiseled_copper_from_weathered_copper_stonecutting.json b/data/minecraft/recipe/weathered_chiseled_copper_from_weathered_copper_stonecutting.json index c5875afe..3b68dd6d 100644 --- a/data/minecraft/recipe/weathered_chiseled_copper_from_weathered_copper_stonecutting.json +++ b/data/minecraft/recipe/weathered_chiseled_copper_from_weathered_copper_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:weathered_copper" - }, + "ingredient": "minecraft:weathered_copper", "result": { "count": 4, "id": "minecraft:weathered_chiseled_copper" diff --git a/data/minecraft/recipe/weathered_chiseled_copper_from_weathered_cut_copper_stonecutting.json b/data/minecraft/recipe/weathered_chiseled_copper_from_weathered_cut_copper_stonecutting.json index 2bfb2bef..96105143 100644 --- a/data/minecraft/recipe/weathered_chiseled_copper_from_weathered_cut_copper_stonecutting.json +++ b/data/minecraft/recipe/weathered_chiseled_copper_from_weathered_cut_copper_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:weathered_cut_copper" - }, + "ingredient": "minecraft:weathered_cut_copper", "result": { "count": 1, "id": "minecraft:weathered_chiseled_copper" diff --git a/data/minecraft/recipe/weathered_copper_bulb.json b/data/minecraft/recipe/weathered_copper_bulb.json index 18b1f05d..265c3000 100644 --- a/data/minecraft/recipe/weathered_copper_bulb.json +++ b/data/minecraft/recipe/weathered_copper_bulb.json @@ -2,15 +2,9 @@ "type": "minecraft:crafting_shaped", "category": "redstone", "key": { - "B": { - "item": "minecraft:blaze_rod" - }, - "C": { - "item": "minecraft:weathered_copper" - }, - "R": { - "item": "minecraft:redstone" - } + "B": "minecraft:blaze_rod", + "C": "minecraft:weathered_copper", + "R": "minecraft:redstone" }, "pattern": [ " C ", diff --git a/data/minecraft/recipe/weathered_copper_grate.json b/data/minecraft/recipe/weathered_copper_grate.json index 198acad9..cd47a15a 100644 --- a/data/minecraft/recipe/weathered_copper_grate.json +++ b/data/minecraft/recipe/weathered_copper_grate.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "M": { - "item": "minecraft:weathered_copper" - } + "M": "minecraft:weathered_copper" }, "pattern": [ " M ", diff --git a/data/minecraft/recipe/weathered_copper_grate_from_weathered_copper_stonecutting.json b/data/minecraft/recipe/weathered_copper_grate_from_weathered_copper_stonecutting.json index 419531a8..3c9d3c1b 100644 --- a/data/minecraft/recipe/weathered_copper_grate_from_weathered_copper_stonecutting.json +++ b/data/minecraft/recipe/weathered_copper_grate_from_weathered_copper_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:weathered_copper" - }, + "ingredient": "minecraft:weathered_copper", "result": { "count": 4, "id": "minecraft:weathered_copper_grate" diff --git a/data/minecraft/recipe/weathered_cut_copper.json b/data/minecraft/recipe/weathered_cut_copper.json index 1a5c81f2..d913d794 100644 --- a/data/minecraft/recipe/weathered_cut_copper.json +++ b/data/minecraft/recipe/weathered_cut_copper.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:weathered_copper" - } + "#": "minecraft:weathered_copper" }, "pattern": [ "##", diff --git a/data/minecraft/recipe/weathered_cut_copper_from_weathered_copper_stonecutting.json b/data/minecraft/recipe/weathered_cut_copper_from_weathered_copper_stonecutting.json index 05a5beb2..ef41a497 100644 --- a/data/minecraft/recipe/weathered_cut_copper_from_weathered_copper_stonecutting.json +++ b/data/minecraft/recipe/weathered_cut_copper_from_weathered_copper_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:weathered_copper" - }, + "ingredient": "minecraft:weathered_copper", "result": { "count": 4, "id": "minecraft:weathered_cut_copper" diff --git a/data/minecraft/recipe/weathered_cut_copper_slab.json b/data/minecraft/recipe/weathered_cut_copper_slab.json index 347bbb38..f6ff1164 100644 --- a/data/minecraft/recipe/weathered_cut_copper_slab.json +++ b/data/minecraft/recipe/weathered_cut_copper_slab.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:weathered_cut_copper" - } + "#": "minecraft:weathered_cut_copper" }, "pattern": [ "###" diff --git a/data/minecraft/recipe/weathered_cut_copper_slab_from_weathered_copper_stonecutting.json b/data/minecraft/recipe/weathered_cut_copper_slab_from_weathered_copper_stonecutting.json index a006d0d7..083c1792 100644 --- a/data/minecraft/recipe/weathered_cut_copper_slab_from_weathered_copper_stonecutting.json +++ b/data/minecraft/recipe/weathered_cut_copper_slab_from_weathered_copper_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:weathered_copper" - }, + "ingredient": "minecraft:weathered_copper", "result": { "count": 8, "id": "minecraft:weathered_cut_copper_slab" diff --git a/data/minecraft/recipe/weathered_cut_copper_slab_from_weathered_cut_copper_stonecutting.json b/data/minecraft/recipe/weathered_cut_copper_slab_from_weathered_cut_copper_stonecutting.json index 658418f6..ce786304 100644 --- a/data/minecraft/recipe/weathered_cut_copper_slab_from_weathered_cut_copper_stonecutting.json +++ b/data/minecraft/recipe/weathered_cut_copper_slab_from_weathered_cut_copper_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:weathered_cut_copper" - }, + "ingredient": "minecraft:weathered_cut_copper", "result": { "count": 2, "id": "minecraft:weathered_cut_copper_slab" diff --git a/data/minecraft/recipe/weathered_cut_copper_stairs.json b/data/minecraft/recipe/weathered_cut_copper_stairs.json index cab7fef9..2cae1b28 100644 --- a/data/minecraft/recipe/weathered_cut_copper_stairs.json +++ b/data/minecraft/recipe/weathered_cut_copper_stairs.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:weathered_cut_copper" - } + "#": "minecraft:weathered_cut_copper" }, "pattern": [ "# ", diff --git a/data/minecraft/recipe/weathered_cut_copper_stairs_from_weathered_copper_stonecutting.json b/data/minecraft/recipe/weathered_cut_copper_stairs_from_weathered_copper_stonecutting.json index a9a7586a..8bb49f88 100644 --- a/data/minecraft/recipe/weathered_cut_copper_stairs_from_weathered_copper_stonecutting.json +++ b/data/minecraft/recipe/weathered_cut_copper_stairs_from_weathered_copper_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:weathered_copper" - }, + "ingredient": "minecraft:weathered_copper", "result": { "count": 4, "id": "minecraft:weathered_cut_copper_stairs" diff --git a/data/minecraft/recipe/weathered_cut_copper_stairs_from_weathered_cut_copper_stonecutting.json b/data/minecraft/recipe/weathered_cut_copper_stairs_from_weathered_cut_copper_stonecutting.json index 37765040..08d5196f 100644 --- a/data/minecraft/recipe/weathered_cut_copper_stairs_from_weathered_cut_copper_stonecutting.json +++ b/data/minecraft/recipe/weathered_cut_copper_stairs_from_weathered_cut_copper_stonecutting.json @@ -1,8 +1,6 @@ { "type": "minecraft:stonecutting", - "ingredient": { - "item": "minecraft:weathered_cut_copper" - }, + "ingredient": "minecraft:weathered_cut_copper", "result": { "count": 1, "id": "minecraft:weathered_cut_copper_stairs" diff --git a/data/minecraft/recipe/wheat.json b/data/minecraft/recipe/wheat.json index 57fa4c38..eb28811d 100644 --- a/data/minecraft/recipe/wheat.json +++ b/data/minecraft/recipe/wheat.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shapeless", "category": "misc", "ingredients": [ - { - "item": "minecraft:hay_block" - } + "minecraft:hay_block" ], "result": { "count": 9, diff --git a/data/minecraft/recipe/white_banner.json b/data/minecraft/recipe/white_banner.json index b82105db..2032700d 100644 --- a/data/minecraft/recipe/white_banner.json +++ b/data/minecraft/recipe/white_banner.json @@ -3,12 +3,8 @@ "category": "misc", "group": "banner", "key": { - "#": { - "item": "minecraft:white_wool" - }, - "|": { - "item": "minecraft:stick" - } + "#": "minecraft:white_wool", + "|": "minecraft:stick" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/white_bed.json b/data/minecraft/recipe/white_bed.json index 87ff4d30..3778004a 100644 --- a/data/minecraft/recipe/white_bed.json +++ b/data/minecraft/recipe/white_bed.json @@ -3,12 +3,8 @@ "category": "misc", "group": "bed", "key": { - "#": { - "item": "minecraft:white_wool" - }, - "X": { - "tag": "minecraft:planks" - } + "#": "minecraft:white_wool", + "X": "#minecraft:planks" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/white_bundle.json b/data/minecraft/recipe/white_bundle.json new file mode 100644 index 00000000..7a533375 --- /dev/null +++ b/data/minecraft/recipe/white_bundle.json @@ -0,0 +1,8 @@ +{ + "type": "minecraft:crafting_transmute", + "category": "equipment", + "group": "bundle_dye", + "input": "#minecraft:bundles", + "material": "minecraft:white_dye", + "result": "minecraft:white_bundle" +} \ No newline at end of file diff --git a/data/minecraft/recipe/white_candle.json b/data/minecraft/recipe/white_candle.json index f62fe8fc..7af1746c 100644 --- a/data/minecraft/recipe/white_candle.json +++ b/data/minecraft/recipe/white_candle.json @@ -3,12 +3,8 @@ "category": "misc", "group": "dyed_candle", "ingredients": [ - { - "item": "minecraft:candle" - }, - { - "item": "minecraft:white_dye" - } + "minecraft:candle", + "minecraft:white_dye" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/white_carpet.json b/data/minecraft/recipe/white_carpet.json index 2ebc01bd..edd930e3 100644 --- a/data/minecraft/recipe/white_carpet.json +++ b/data/minecraft/recipe/white_carpet.json @@ -3,9 +3,7 @@ "category": "misc", "group": "carpet", "key": { - "#": { - "item": "minecraft:white_wool" - } + "#": "minecraft:white_wool" }, "pattern": [ "##" diff --git a/data/minecraft/recipe/white_concrete_powder.json b/data/minecraft/recipe/white_concrete_powder.json index fd4a9017..83ca1693 100644 --- a/data/minecraft/recipe/white_concrete_powder.json +++ b/data/minecraft/recipe/white_concrete_powder.json @@ -3,33 +3,15 @@ "category": "building", "group": "concrete_powder", "ingredients": [ - { - "item": "minecraft:white_dye" - }, - { - "item": "minecraft:sand" - }, - { - "item": "minecraft:sand" - }, - { - "item": "minecraft:sand" - }, - { - "item": "minecraft:sand" - }, - { - "item": "minecraft:gravel" - }, - { - "item": "minecraft:gravel" - }, - { - "item": "minecraft:gravel" - }, - { - "item": "minecraft:gravel" - } + "minecraft:white_dye", + "minecraft:sand", + "minecraft:sand", + "minecraft:sand", + "minecraft:sand", + "minecraft:gravel", + "minecraft:gravel", + "minecraft:gravel", + "minecraft:gravel" ], "result": { "count": 8, diff --git a/data/minecraft/recipe/white_dye.json b/data/minecraft/recipe/white_dye.json index 9a1bdaa5..d56ec982 100644 --- a/data/minecraft/recipe/white_dye.json +++ b/data/minecraft/recipe/white_dye.json @@ -3,9 +3,7 @@ "category": "misc", "group": "white_dye", "ingredients": [ - { - "item": "minecraft:bone_meal" - } + "minecraft:bone_meal" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/white_dye_from_lily_of_the_valley.json b/data/minecraft/recipe/white_dye_from_lily_of_the_valley.json index e33d2cfc..46f154d4 100644 --- a/data/minecraft/recipe/white_dye_from_lily_of_the_valley.json +++ b/data/minecraft/recipe/white_dye_from_lily_of_the_valley.json @@ -3,9 +3,7 @@ "category": "misc", "group": "white_dye", "ingredients": [ - { - "item": "minecraft:lily_of_the_valley" - } + "minecraft:lily_of_the_valley" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/white_glazed_terracotta.json b/data/minecraft/recipe/white_glazed_terracotta.json index 69fb56bd..2c660119 100644 --- a/data/minecraft/recipe/white_glazed_terracotta.json +++ b/data/minecraft/recipe/white_glazed_terracotta.json @@ -3,9 +3,7 @@ "category": "blocks", "cookingtime": 200, "experience": 0.1, - "ingredient": { - "item": "minecraft:white_terracotta" - }, + "ingredient": "minecraft:white_terracotta", "result": { "id": "minecraft:white_glazed_terracotta" } diff --git a/data/minecraft/recipe/white_shulker_box.json b/data/minecraft/recipe/white_shulker_box.json new file mode 100644 index 00000000..5c7cbd79 --- /dev/null +++ b/data/minecraft/recipe/white_shulker_box.json @@ -0,0 +1,8 @@ +{ + "type": "minecraft:crafting_transmute", + "category": "misc", + "group": "shulker_box_dye", + "input": "#minecraft:shulker_boxes", + "material": "minecraft:white_dye", + "result": "minecraft:white_shulker_box" +} \ No newline at end of file diff --git a/data/minecraft/recipe/white_stained_glass.json b/data/minecraft/recipe/white_stained_glass.json index e333eacc..269dc640 100644 --- a/data/minecraft/recipe/white_stained_glass.json +++ b/data/minecraft/recipe/white_stained_glass.json @@ -3,12 +3,8 @@ "category": "building", "group": "stained_glass", "key": { - "#": { - "item": "minecraft:glass" - }, - "X": { - "item": "minecraft:white_dye" - } + "#": "minecraft:glass", + "X": "minecraft:white_dye" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/white_stained_glass_pane.json b/data/minecraft/recipe/white_stained_glass_pane.json index 80215a9a..40313a09 100644 --- a/data/minecraft/recipe/white_stained_glass_pane.json +++ b/data/minecraft/recipe/white_stained_glass_pane.json @@ -3,9 +3,7 @@ "category": "misc", "group": "stained_glass_pane", "key": { - "#": { - "item": "minecraft:white_stained_glass" - } + "#": "minecraft:white_stained_glass" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/white_stained_glass_pane_from_glass_pane.json b/data/minecraft/recipe/white_stained_glass_pane_from_glass_pane.json index 283f1c70..680b4231 100644 --- a/data/minecraft/recipe/white_stained_glass_pane_from_glass_pane.json +++ b/data/minecraft/recipe/white_stained_glass_pane_from_glass_pane.json @@ -3,12 +3,8 @@ "category": "misc", "group": "stained_glass_pane", "key": { - "#": { - "item": "minecraft:glass_pane" - }, - "$": { - "item": "minecraft:white_dye" - } + "#": "minecraft:glass_pane", + "$": "minecraft:white_dye" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/white_terracotta.json b/data/minecraft/recipe/white_terracotta.json index ad08fc5e..e131d52f 100644 --- a/data/minecraft/recipe/white_terracotta.json +++ b/data/minecraft/recipe/white_terracotta.json @@ -3,12 +3,8 @@ "category": "building", "group": "stained_terracotta", "key": { - "#": { - "item": "minecraft:terracotta" - }, - "X": { - "item": "minecraft:white_dye" - } + "#": "minecraft:terracotta", + "X": "minecraft:white_dye" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/white_wool_from_string.json b/data/minecraft/recipe/white_wool_from_string.json index efecc096..4a29fc32 100644 --- a/data/minecraft/recipe/white_wool_from_string.json +++ b/data/minecraft/recipe/white_wool_from_string.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "#": { - "item": "minecraft:string" - } + "#": "minecraft:string" }, "pattern": [ "##", diff --git a/data/minecraft/recipe/wild_armor_trim_smithing_template.json b/data/minecraft/recipe/wild_armor_trim_smithing_template.json index 52aa4a6e..b3c23142 100644 --- a/data/minecraft/recipe/wild_armor_trim_smithing_template.json +++ b/data/minecraft/recipe/wild_armor_trim_smithing_template.json @@ -2,15 +2,9 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "#": { - "item": "minecraft:diamond" - }, - "C": { - "item": "minecraft:mossy_cobblestone" - }, - "S": { - "item": "minecraft:wild_armor_trim_smithing_template" - } + "#": "minecraft:diamond", + "C": "minecraft:mossy_cobblestone", + "S": "minecraft:wild_armor_trim_smithing_template" }, "pattern": [ "#S#", diff --git a/data/minecraft/recipe/wild_armor_trim_smithing_template_smithing_trim.json b/data/minecraft/recipe/wild_armor_trim_smithing_template_smithing_trim.json index 97055818..14d650ea 100644 --- a/data/minecraft/recipe/wild_armor_trim_smithing_template_smithing_trim.json +++ b/data/minecraft/recipe/wild_armor_trim_smithing_template_smithing_trim.json @@ -1,12 +1,6 @@ { "type": "minecraft:smithing_trim", - "addition": { - "tag": "minecraft:trim_materials" - }, - "base": { - "tag": "minecraft:trimmable_armor" - }, - "template": { - "item": "minecraft:wild_armor_trim_smithing_template" - } + "addition": "#minecraft:trim_materials", + "base": "#minecraft:trimmable_armor", + "template": "minecraft:wild_armor_trim_smithing_template" } \ No newline at end of file diff --git a/data/minecraft/recipe/wind_charge.json b/data/minecraft/recipe/wind_charge.json index 9668aee0..ac342dc5 100644 --- a/data/minecraft/recipe/wind_charge.json +++ b/data/minecraft/recipe/wind_charge.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shapeless", "category": "misc", "ingredients": [ - { - "item": "minecraft:breeze_rod" - } + "minecraft:breeze_rod" ], "result": { "count": 4, diff --git a/data/minecraft/recipe/wolf_armor.json b/data/minecraft/recipe/wolf_armor.json index ca407094..2114f12c 100644 --- a/data/minecraft/recipe/wolf_armor.json +++ b/data/minecraft/recipe/wolf_armor.json @@ -2,9 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "equipment", "key": { - "X": { - "item": "minecraft:armadillo_scute" - } + "X": "minecraft:armadillo_scute" }, "pattern": [ "X ", diff --git a/data/minecraft/recipe/wooden_axe.json b/data/minecraft/recipe/wooden_axe.json index 018e4e0c..43803098 100644 --- a/data/minecraft/recipe/wooden_axe.json +++ b/data/minecraft/recipe/wooden_axe.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shaped", "category": "equipment", "key": { - "#": { - "item": "minecraft:stick" - }, - "X": { - "tag": "minecraft:planks" - } + "#": "minecraft:stick", + "X": "#minecraft:wooden_tool_materials" }, "pattern": [ "XX", diff --git a/data/minecraft/recipe/wooden_hoe.json b/data/minecraft/recipe/wooden_hoe.json index 8f239bee..40d3a6ea 100644 --- a/data/minecraft/recipe/wooden_hoe.json +++ b/data/minecraft/recipe/wooden_hoe.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shaped", "category": "equipment", "key": { - "#": { - "item": "minecraft:stick" - }, - "X": { - "tag": "minecraft:planks" - } + "#": "minecraft:stick", + "X": "#minecraft:wooden_tool_materials" }, "pattern": [ "XX", diff --git a/data/minecraft/recipe/wooden_pickaxe.json b/data/minecraft/recipe/wooden_pickaxe.json index a5eb5169..43f9fd7a 100644 --- a/data/minecraft/recipe/wooden_pickaxe.json +++ b/data/minecraft/recipe/wooden_pickaxe.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shaped", "category": "equipment", "key": { - "#": { - "item": "minecraft:stick" - }, - "X": { - "tag": "minecraft:planks" - } + "#": "minecraft:stick", + "X": "#minecraft:wooden_tool_materials" }, "pattern": [ "XXX", diff --git a/data/minecraft/recipe/wooden_shovel.json b/data/minecraft/recipe/wooden_shovel.json index 3aa856e9..866cb64b 100644 --- a/data/minecraft/recipe/wooden_shovel.json +++ b/data/minecraft/recipe/wooden_shovel.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shaped", "category": "equipment", "key": { - "#": { - "item": "minecraft:stick" - }, - "X": { - "tag": "minecraft:planks" - } + "#": "minecraft:stick", + "X": "#minecraft:wooden_tool_materials" }, "pattern": [ "X", diff --git a/data/minecraft/recipe/wooden_sword.json b/data/minecraft/recipe/wooden_sword.json index 6fef69e5..279fb917 100644 --- a/data/minecraft/recipe/wooden_sword.json +++ b/data/minecraft/recipe/wooden_sword.json @@ -2,12 +2,8 @@ "type": "minecraft:crafting_shaped", "category": "equipment", "key": { - "#": { - "item": "minecraft:stick" - }, - "X": { - "tag": "minecraft:planks" - } + "#": "minecraft:stick", + "X": "#minecraft:wooden_tool_materials" }, "pattern": [ "X", diff --git a/data/minecraft/recipe/writable_book.json b/data/minecraft/recipe/writable_book.json index e89c5818..d934282e 100644 --- a/data/minecraft/recipe/writable_book.json +++ b/data/minecraft/recipe/writable_book.json @@ -2,15 +2,9 @@ "type": "minecraft:crafting_shapeless", "category": "misc", "ingredients": [ - { - "item": "minecraft:book" - }, - { - "item": "minecraft:ink_sac" - }, - { - "item": "minecraft:feather" - } + "minecraft:book", + "minecraft:ink_sac", + "minecraft:feather" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/yellow_banner.json b/data/minecraft/recipe/yellow_banner.json index 4e3a8311..ce76ef9a 100644 --- a/data/minecraft/recipe/yellow_banner.json +++ b/data/minecraft/recipe/yellow_banner.json @@ -3,12 +3,8 @@ "category": "misc", "group": "banner", "key": { - "#": { - "item": "minecraft:yellow_wool" - }, - "|": { - "item": "minecraft:stick" - } + "#": "minecraft:yellow_wool", + "|": "minecraft:stick" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/yellow_bed.json b/data/minecraft/recipe/yellow_bed.json index 3781df2c..81be40c9 100644 --- a/data/minecraft/recipe/yellow_bed.json +++ b/data/minecraft/recipe/yellow_bed.json @@ -3,12 +3,8 @@ "category": "misc", "group": "bed", "key": { - "#": { - "item": "minecraft:yellow_wool" - }, - "X": { - "tag": "minecraft:planks" - } + "#": "minecraft:yellow_wool", + "X": "#minecraft:planks" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/yellow_bundle.json b/data/minecraft/recipe/yellow_bundle.json new file mode 100644 index 00000000..47536709 --- /dev/null +++ b/data/minecraft/recipe/yellow_bundle.json @@ -0,0 +1,8 @@ +{ + "type": "minecraft:crafting_transmute", + "category": "equipment", + "group": "bundle_dye", + "input": "#minecraft:bundles", + "material": "minecraft:yellow_dye", + "result": "minecraft:yellow_bundle" +} \ No newline at end of file diff --git a/data/minecraft/recipe/yellow_candle.json b/data/minecraft/recipe/yellow_candle.json index f377b4ce..6ff24992 100644 --- a/data/minecraft/recipe/yellow_candle.json +++ b/data/minecraft/recipe/yellow_candle.json @@ -3,12 +3,8 @@ "category": "misc", "group": "dyed_candle", "ingredients": [ - { - "item": "minecraft:candle" - }, - { - "item": "minecraft:yellow_dye" - } + "minecraft:candle", + "minecraft:yellow_dye" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/yellow_carpet.json b/data/minecraft/recipe/yellow_carpet.json index 7a8c3685..04a9fc6b 100644 --- a/data/minecraft/recipe/yellow_carpet.json +++ b/data/minecraft/recipe/yellow_carpet.json @@ -3,9 +3,7 @@ "category": "misc", "group": "carpet", "key": { - "#": { - "item": "minecraft:yellow_wool" - } + "#": "minecraft:yellow_wool" }, "pattern": [ "##" diff --git a/data/minecraft/recipe/yellow_concrete_powder.json b/data/minecraft/recipe/yellow_concrete_powder.json index 07546643..fb5b5357 100644 --- a/data/minecraft/recipe/yellow_concrete_powder.json +++ b/data/minecraft/recipe/yellow_concrete_powder.json @@ -3,33 +3,15 @@ "category": "building", "group": "concrete_powder", "ingredients": [ - { - "item": "minecraft:yellow_dye" - }, - { - "item": "minecraft:sand" - }, - { - "item": "minecraft:sand" - }, - { - "item": "minecraft:sand" - }, - { - "item": "minecraft:sand" - }, - { - "item": "minecraft:gravel" - }, - { - "item": "minecraft:gravel" - }, - { - "item": "minecraft:gravel" - }, - { - "item": "minecraft:gravel" - } + "minecraft:yellow_dye", + "minecraft:sand", + "minecraft:sand", + "minecraft:sand", + "minecraft:sand", + "minecraft:gravel", + "minecraft:gravel", + "minecraft:gravel", + "minecraft:gravel" ], "result": { "count": 8, diff --git a/data/minecraft/recipe/yellow_dye_from_dandelion.json b/data/minecraft/recipe/yellow_dye_from_dandelion.json index 19b0b932..5c781998 100644 --- a/data/minecraft/recipe/yellow_dye_from_dandelion.json +++ b/data/minecraft/recipe/yellow_dye_from_dandelion.json @@ -3,9 +3,7 @@ "category": "misc", "group": "yellow_dye", "ingredients": [ - { - "item": "minecraft:dandelion" - } + "minecraft:dandelion" ], "result": { "count": 1, diff --git a/data/minecraft/recipe/yellow_dye_from_sunflower.json b/data/minecraft/recipe/yellow_dye_from_sunflower.json index 879e7ebb..8ab1263d 100644 --- a/data/minecraft/recipe/yellow_dye_from_sunflower.json +++ b/data/minecraft/recipe/yellow_dye_from_sunflower.json @@ -3,9 +3,7 @@ "category": "misc", "group": "yellow_dye", "ingredients": [ - { - "item": "minecraft:sunflower" - } + "minecraft:sunflower" ], "result": { "count": 2, diff --git a/data/minecraft/recipe/yellow_glazed_terracotta.json b/data/minecraft/recipe/yellow_glazed_terracotta.json index d0fe4da2..3313497b 100644 --- a/data/minecraft/recipe/yellow_glazed_terracotta.json +++ b/data/minecraft/recipe/yellow_glazed_terracotta.json @@ -3,9 +3,7 @@ "category": "blocks", "cookingtime": 200, "experience": 0.1, - "ingredient": { - "item": "minecraft:yellow_terracotta" - }, + "ingredient": "minecraft:yellow_terracotta", "result": { "id": "minecraft:yellow_glazed_terracotta" } diff --git a/data/minecraft/recipe/yellow_shulker_box.json b/data/minecraft/recipe/yellow_shulker_box.json new file mode 100644 index 00000000..0506c068 --- /dev/null +++ b/data/minecraft/recipe/yellow_shulker_box.json @@ -0,0 +1,8 @@ +{ + "type": "minecraft:crafting_transmute", + "category": "misc", + "group": "shulker_box_dye", + "input": "#minecraft:shulker_boxes", + "material": "minecraft:yellow_dye", + "result": "minecraft:yellow_shulker_box" +} \ No newline at end of file diff --git a/data/minecraft/recipe/yellow_stained_glass.json b/data/minecraft/recipe/yellow_stained_glass.json index 2f18ee03..14284408 100644 --- a/data/minecraft/recipe/yellow_stained_glass.json +++ b/data/minecraft/recipe/yellow_stained_glass.json @@ -3,12 +3,8 @@ "category": "building", "group": "stained_glass", "key": { - "#": { - "item": "minecraft:glass" - }, - "X": { - "item": "minecraft:yellow_dye" - } + "#": "minecraft:glass", + "X": "minecraft:yellow_dye" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/yellow_stained_glass_pane.json b/data/minecraft/recipe/yellow_stained_glass_pane.json index f8fb7afc..6cd256d8 100644 --- a/data/minecraft/recipe/yellow_stained_glass_pane.json +++ b/data/minecraft/recipe/yellow_stained_glass_pane.json @@ -3,9 +3,7 @@ "category": "misc", "group": "stained_glass_pane", "key": { - "#": { - "item": "minecraft:yellow_stained_glass" - } + "#": "minecraft:yellow_stained_glass" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/yellow_stained_glass_pane_from_glass_pane.json b/data/minecraft/recipe/yellow_stained_glass_pane_from_glass_pane.json index 7c60d55e..e832f35b 100644 --- a/data/minecraft/recipe/yellow_stained_glass_pane_from_glass_pane.json +++ b/data/minecraft/recipe/yellow_stained_glass_pane_from_glass_pane.json @@ -3,12 +3,8 @@ "category": "misc", "group": "stained_glass_pane", "key": { - "#": { - "item": "minecraft:glass_pane" - }, - "$": { - "item": "minecraft:yellow_dye" - } + "#": "minecraft:glass_pane", + "$": "minecraft:yellow_dye" }, "pattern": [ "###", diff --git a/data/minecraft/recipe/yellow_terracotta.json b/data/minecraft/recipe/yellow_terracotta.json index add1de3e..1f48893a 100644 --- a/data/minecraft/recipe/yellow_terracotta.json +++ b/data/minecraft/recipe/yellow_terracotta.json @@ -3,12 +3,8 @@ "category": "building", "group": "stained_terracotta", "key": { - "#": { - "item": "minecraft:terracotta" - }, - "X": { - "item": "minecraft:yellow_dye" - } + "#": "minecraft:terracotta", + "X": "minecraft:yellow_dye" }, "pattern": [ "###", diff --git a/data/minecraft/structure/ancient_city/city/entrance/entrance_connector.nbt b/data/minecraft/structure/ancient_city/city/entrance/entrance_connector.nbt index 7a958f0d..2502f2d2 100644 --- a/data/minecraft/structure/ancient_city/city/entrance/entrance_connector.nbt +++ b/data/minecraft/structure/ancient_city/city/entrance/entrance_connector.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e2728b3383dcecbfd884da89a85b91321f0666f55e5623c62a5a0df4ead24117 -size 9414 +oid sha256:3a8dc7d2ae760a953cd8a30c67e79a4b9aeb7d5bf3d16e04f021f81402a86a6a +size 9417 diff --git a/data/minecraft/structure/ancient_city/city/entrance/entrance_path_1.nbt b/data/minecraft/structure/ancient_city/city/entrance/entrance_path_1.nbt index b85ae9ec..586aadfe 100644 --- a/data/minecraft/structure/ancient_city/city/entrance/entrance_path_1.nbt +++ b/data/minecraft/structure/ancient_city/city/entrance/entrance_path_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:76ab4244ea26e9d93059d421aab94d9d4c73a0e4a522ff3b2cbae600c6c054e2 -size 9746 +oid sha256:212589fe67f54a249fcbeaab1fba2916ac399f2e57fa8975db17955822da5dca +size 9752 diff --git a/data/minecraft/structure/ancient_city/city/entrance/entrance_path_2.nbt b/data/minecraft/structure/ancient_city/city/entrance/entrance_path_2.nbt index a18e72b2..c2f1149a 100644 --- a/data/minecraft/structure/ancient_city/city/entrance/entrance_path_2.nbt +++ b/data/minecraft/structure/ancient_city/city/entrance/entrance_path_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ac4c0e66c03e0c9cb7a80192037eb9240946a4eefe075c69446a610841ce0e40 -size 13774 +oid sha256:d133b97be9b950ae96db7187f9b74ca33354d017d6fa8f4687293a6830d08761 +size 13778 diff --git a/data/minecraft/structure/ancient_city/city/entrance/entrance_path_3.nbt b/data/minecraft/structure/ancient_city/city/entrance/entrance_path_3.nbt index f67cc9a6..7c51382b 100644 --- a/data/minecraft/structure/ancient_city/city/entrance/entrance_path_3.nbt +++ b/data/minecraft/structure/ancient_city/city/entrance/entrance_path_3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5d90b43cfee1ff30c211eedab24fdfdebb48f9079d491d3a814de63324e7edda -size 12151 +oid sha256:7d024160bbea6f2a11d57f3b84c00051869275472134fc8f6a37addcd27322e9 +size 12154 diff --git a/data/minecraft/structure/ancient_city/city/entrance/entrance_path_4.nbt b/data/minecraft/structure/ancient_city/city/entrance/entrance_path_4.nbt index 978e5cc3..a8b5c533 100644 --- a/data/minecraft/structure/ancient_city/city/entrance/entrance_path_4.nbt +++ b/data/minecraft/structure/ancient_city/city/entrance/entrance_path_4.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4c2a2e10c1616808f7d7f4f19c1c38e52b6ce3d6f79b49dc7dc561eb0e189e19 -size 11785 +oid sha256:c6daab3606fb82a241c6ab704ce4e2c46d716e10b5dca4cee4aa10ead2725591 +size 11789 diff --git a/data/minecraft/structure/ancient_city/city/entrance/entrance_path_5.nbt b/data/minecraft/structure/ancient_city/city/entrance/entrance_path_5.nbt index 1884669e..45830bdb 100644 --- a/data/minecraft/structure/ancient_city/city/entrance/entrance_path_5.nbt +++ b/data/minecraft/structure/ancient_city/city/entrance/entrance_path_5.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:53255d065aa22b4edf83524beaaab392c8d95205f4480c6a78a4882d685652f7 -size 9066 +oid sha256:dc5920a054f2bd5076224984115dd574486769cff6219c044bffa911cda38fa9 +size 9069 diff --git a/data/minecraft/structure/ancient_city/city_center/city_center_1.nbt b/data/minecraft/structure/ancient_city/city_center/city_center_1.nbt index f2ad4c96..73736cea 100644 --- a/data/minecraft/structure/ancient_city/city_center/city_center_1.nbt +++ b/data/minecraft/structure/ancient_city/city_center/city_center_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f7e42d24322eb30f91f3760c18a11149b28ffd2f16ef59e4ffb89e1fd01f74bb -size 26259 +oid sha256:a26019bf220aec44430ca94df8e1c378b132b25aa60b0df75630ecf44db9bb8e +size 26261 diff --git a/data/minecraft/structure/ancient_city/city_center/city_center_2.nbt b/data/minecraft/structure/ancient_city/city_center/city_center_2.nbt index 185425a9..d4fa16de 100644 --- a/data/minecraft/structure/ancient_city/city_center/city_center_2.nbt +++ b/data/minecraft/structure/ancient_city/city_center/city_center_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:63a3231697aa716e486a53b4635875579ac360981003e906d12942a35e28e726 -size 26653 +oid sha256:f39c9896ed2ce61d72abf397741aa5f1f6c3d96dfed63125017046b846ef801c +size 26656 diff --git a/data/minecraft/structure/ancient_city/city_center/city_center_3.nbt b/data/minecraft/structure/ancient_city/city_center/city_center_3.nbt index 289d983a..2fdcc801 100644 --- a/data/minecraft/structure/ancient_city/city_center/city_center_3.nbt +++ b/data/minecraft/structure/ancient_city/city_center/city_center_3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2677e158bb805ecf14f60bd59a54e447a00f9ef140642abcf35a69ad3ca85705 -size 26122 +oid sha256:5298327fe66c0c11b302bb1075373c66a15270122050ce04a0229d9cec844b36 +size 26124 diff --git a/data/minecraft/structure/ancient_city/city_center/walls/bottom_1.nbt b/data/minecraft/structure/ancient_city/city_center/walls/bottom_1.nbt index e1969f53..a42116f9 100644 --- a/data/minecraft/structure/ancient_city/city_center/walls/bottom_1.nbt +++ b/data/minecraft/structure/ancient_city/city_center/walls/bottom_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:92b9974bb5687cbadf36795e6b5fa85be5afb1790a88f536fc8e3d1a33ea6311 -size 7470 +oid sha256:0615b616738ecb279338e23a1b6a59633e7892ec8d4420699077f24573ddc7c0 +size 7473 diff --git a/data/minecraft/structure/ancient_city/city_center/walls/bottom_2.nbt b/data/minecraft/structure/ancient_city/city_center/walls/bottom_2.nbt index a2a79358..8da0c701 100644 --- a/data/minecraft/structure/ancient_city/city_center/walls/bottom_2.nbt +++ b/data/minecraft/structure/ancient_city/city_center/walls/bottom_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ff7534164864cb424e135dc8634843769269284ff15b6ae2ac007d100271df39 -size 6999 +oid sha256:c705fd6347bb71a50f5b76a5a413503f393049ea9c4ae2c94e53553833b436fc +size 7002 diff --git a/data/minecraft/structure/ancient_city/city_center/walls/bottom_left_corner.nbt b/data/minecraft/structure/ancient_city/city_center/walls/bottom_left_corner.nbt index a36da910..1c5667b0 100644 --- a/data/minecraft/structure/ancient_city/city_center/walls/bottom_left_corner.nbt +++ b/data/minecraft/structure/ancient_city/city_center/walls/bottom_left_corner.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:50ed1fa17907366aab1fd03f722bf39396366acd82b4cdb3da73c95237ec63f4 -size 2610 +oid sha256:64fcb02fd4b1fe0ac087d53e68f910b4726e18e06371bc514824529141346e38 +size 2612 diff --git a/data/minecraft/structure/ancient_city/city_center/walls/bottom_right_corner.nbt b/data/minecraft/structure/ancient_city/city_center/walls/bottom_right_corner.nbt index 8bc294ef..d7bb095b 100644 --- a/data/minecraft/structure/ancient_city/city_center/walls/bottom_right_corner.nbt +++ b/data/minecraft/structure/ancient_city/city_center/walls/bottom_right_corner.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c9586807c0b4cc40493ae8e2d2d6f6d6e1e9f9114ffc80870ed797e1263cc3f0 -size 3045 +oid sha256:61a6b3de519f234fd78cd0309922979c95c989279a0ce6979fdafabf3afb32b0 +size 3048 diff --git a/data/minecraft/structure/ancient_city/city_center/walls/bottom_right_corner_1.nbt b/data/minecraft/structure/ancient_city/city_center/walls/bottom_right_corner_1.nbt index 5aaa3b8a..a71098bb 100644 --- a/data/minecraft/structure/ancient_city/city_center/walls/bottom_right_corner_1.nbt +++ b/data/minecraft/structure/ancient_city/city_center/walls/bottom_right_corner_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:777ff9307ae9ff84b329a8fafe25621cd894a70ea1e7efdba25abf4fd9742106 -size 2594 +oid sha256:f6cb4bf2743d71bcc65f4fb2faddcf144f57243696d9666ed68f9bf8a2f16481 +size 2597 diff --git a/data/minecraft/structure/ancient_city/city_center/walls/bottom_right_corner_2.nbt b/data/minecraft/structure/ancient_city/city_center/walls/bottom_right_corner_2.nbt index 258441dc..bd790581 100644 --- a/data/minecraft/structure/ancient_city/city_center/walls/bottom_right_corner_2.nbt +++ b/data/minecraft/structure/ancient_city/city_center/walls/bottom_right_corner_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6b73c10c96975229df36b3d806235f0f853c80a224a843a9d4693df70db3683c -size 2665 +oid sha256:2d5bbbb6420c5aea54ff81029ab4c3ca737269098df1bb3f4490400c87e09fc2 +size 2668 diff --git a/data/minecraft/structure/ancient_city/city_center/walls/left.nbt b/data/minecraft/structure/ancient_city/city_center/walls/left.nbt index 60c69c8f..b6e8e8d2 100644 --- a/data/minecraft/structure/ancient_city/city_center/walls/left.nbt +++ b/data/minecraft/structure/ancient_city/city_center/walls/left.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:781a577d849610d95e018ea41d43cf5b8ed8d903910d3757b36e6ea034185773 -size 3181 +oid sha256:e14c7f5142707fcfdceceb3b32c659bd78d5ed6d88edb23e6181f9307f1804b1 +size 3183 diff --git a/data/minecraft/structure/ancient_city/city_center/walls/right.nbt b/data/minecraft/structure/ancient_city/city_center/walls/right.nbt index a749e0ca..b8708c73 100644 --- a/data/minecraft/structure/ancient_city/city_center/walls/right.nbt +++ b/data/minecraft/structure/ancient_city/city_center/walls/right.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b6164a092f4c50c60f463e099128b1a4a4e6b40401edae51373b4a934c228eeb -size 3175 +oid sha256:103468df5068cf6ea91dbe2a239c6f723feb245605fcadd9b66b7cdd2c0f48b7 +size 3178 diff --git a/data/minecraft/structure/ancient_city/city_center/walls/top.nbt b/data/minecraft/structure/ancient_city/city_center/walls/top.nbt index 959a252a..179e1525 100644 --- a/data/minecraft/structure/ancient_city/city_center/walls/top.nbt +++ b/data/minecraft/structure/ancient_city/city_center/walls/top.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:88aa1b956a1a8f0d0be6d08eb87fd062cb3ca2b8fa8032b944abfb34e3aaf84f -size 7117 +oid sha256:3f3d8632638d2cefffd5638367be21ffda5ca0cdeab183145a8403cda913eec9 +size 7119 diff --git a/data/minecraft/structure/ancient_city/city_center/walls/top_left_corner.nbt b/data/minecraft/structure/ancient_city/city_center/walls/top_left_corner.nbt index ac85462d..46af2ffb 100644 --- a/data/minecraft/structure/ancient_city/city_center/walls/top_left_corner.nbt +++ b/data/minecraft/structure/ancient_city/city_center/walls/top_left_corner.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3563e9df3d125630c237934049504afd7dbc76665ece1f8e18d750e6a27d6aa5 -size 2596 +oid sha256:729a5a5ba8563947fcc8f27148597662d848f6121d5225a4f24741e0388917b4 +size 2598 diff --git a/data/minecraft/structure/ancient_city/city_center/walls/top_right_corner.nbt b/data/minecraft/structure/ancient_city/city_center/walls/top_right_corner.nbt index c07ba686..cfce6b3c 100644 --- a/data/minecraft/structure/ancient_city/city_center/walls/top_right_corner.nbt +++ b/data/minecraft/structure/ancient_city/city_center/walls/top_right_corner.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6cc6d45b8226f2343bdaadf82131f2796fe9811d592280a4a40a98ab69f97a99 -size 2641 +oid sha256:23d883dae1dc8a3ec222c6cf86283c2b2043a9e29399459b3dbda9c3a3a79a4d +size 2644 diff --git a/data/minecraft/structure/ancient_city/structures/barracks.nbt b/data/minecraft/structure/ancient_city/structures/barracks.nbt index a6f5dd3e..ffe1778d 100644 --- a/data/minecraft/structure/ancient_city/structures/barracks.nbt +++ b/data/minecraft/structure/ancient_city/structures/barracks.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2c316c4971840086bb1d1432ca2dfc62ce958755c9785980729f75f882cfd95b -size 5631 +oid sha256:538c882144edc446b9714131f2e70729e912faa98160dce95e09390ae5417ebe +size 5634 diff --git a/data/minecraft/structure/ancient_city/structures/camp_1.nbt b/data/minecraft/structure/ancient_city/structures/camp_1.nbt index e67bff45..65983352 100644 --- a/data/minecraft/structure/ancient_city/structures/camp_1.nbt +++ b/data/minecraft/structure/ancient_city/structures/camp_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a20f3da4ea7e1720bcc0d3e8e1f5d1bf4e353615488a2268f415e506d8dd8f1f -size 1163 +oid sha256:18d92cc2111559cab840f63e224ad6d747fb2a302c23752b2e9171a95cd186a3 +size 1164 diff --git a/data/minecraft/structure/ancient_city/structures/camp_2.nbt b/data/minecraft/structure/ancient_city/structures/camp_2.nbt index 70b1167d..66b69329 100644 --- a/data/minecraft/structure/ancient_city/structures/camp_2.nbt +++ b/data/minecraft/structure/ancient_city/structures/camp_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8887ec22d4a42c45c977855720315be600d462529783350e237789d9644510e8 -size 1271 +oid sha256:08db6bfad499ccb7116e76b69c96b398879731892ce746d0aa80f5047d10b3e5 +size 1274 diff --git a/data/minecraft/structure/ancient_city/structures/camp_3.nbt b/data/minecraft/structure/ancient_city/structures/camp_3.nbt index 0a4a43f8..be8e5e82 100644 --- a/data/minecraft/structure/ancient_city/structures/camp_3.nbt +++ b/data/minecraft/structure/ancient_city/structures/camp_3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d62089cafc86cb948062235951248f10b61bc4e2ad14b582bc0e54d390654d50 -size 1015 +oid sha256:2a6c6defffdec1ab26f5d07035b129ea459659d425b9c9029170403710f98c7f +size 1017 diff --git a/data/minecraft/structure/ancient_city/structures/chamber_1.nbt b/data/minecraft/structure/ancient_city/structures/chamber_1.nbt index 5b181c49..5c3eeb60 100644 --- a/data/minecraft/structure/ancient_city/structures/chamber_1.nbt +++ b/data/minecraft/structure/ancient_city/structures/chamber_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f449163ebabe172c2f77a0c0239b354ceb3b057984caf5199eeab9678fa6277d -size 2533 +oid sha256:6d22560aa348d1abea8647443a9ebfa2e3e0a9bf15799ec0d3e6e2e0141e19b7 +size 2536 diff --git a/data/minecraft/structure/ancient_city/structures/chamber_2.nbt b/data/minecraft/structure/ancient_city/structures/chamber_2.nbt index 0974cb80..aee4a8ab 100644 --- a/data/minecraft/structure/ancient_city/structures/chamber_2.nbt +++ b/data/minecraft/structure/ancient_city/structures/chamber_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:03a2341cfa1355bbbb06d9160463ec5039f77910e00bb6f1ce32f9e4688c3888 -size 1310 +oid sha256:533090f11703e44574da05d0c9bcfe2f03edc2938e418d53210d287ca40be331 +size 1312 diff --git a/data/minecraft/structure/ancient_city/structures/chamber_3.nbt b/data/minecraft/structure/ancient_city/structures/chamber_3.nbt index a1efbf62..86576460 100644 --- a/data/minecraft/structure/ancient_city/structures/chamber_3.nbt +++ b/data/minecraft/structure/ancient_city/structures/chamber_3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:fb39c5f593417a57d090d3731e72f1799ce31fe10a9be0f5dc07cf21066b5077 -size 1098 +oid sha256:d8a203549665f7aeda4bc1ce0c74b10dfee643e7be074437ff235102f61cee21 +size 1101 diff --git a/data/minecraft/structure/ancient_city/structures/ice_box_1.nbt b/data/minecraft/structure/ancient_city/structures/ice_box_1.nbt index 6d8cb648..bf2d95e0 100644 --- a/data/minecraft/structure/ancient_city/structures/ice_box_1.nbt +++ b/data/minecraft/structure/ancient_city/structures/ice_box_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9f33fafb4594aafe7d5e806fdff3c0b3f6f202b6ef79043e15adf827a4148a78 -size 3905 +oid sha256:8f5797e22cb822cc01e0f62477cfe74a507ae77e912d6b886999d671cc14a360 +size 3908 diff --git a/data/minecraft/structure/ancient_city/structures/large_pillar_1.nbt b/data/minecraft/structure/ancient_city/structures/large_pillar_1.nbt index 585a4bb3..3421f6e4 100644 --- a/data/minecraft/structure/ancient_city/structures/large_pillar_1.nbt +++ b/data/minecraft/structure/ancient_city/structures/large_pillar_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6826e85c165676a575533f6a374a4623c7bdba0a659b6828235f3614651126e6 -size 1475 +oid sha256:ccf193403b7e5a55e43045068758acd8dcff67dd05c3e5a996ac4f047434f814 +size 1477 diff --git a/data/minecraft/structure/ancient_city/structures/large_ruin_1.nbt b/data/minecraft/structure/ancient_city/structures/large_ruin_1.nbt index 2052bac1..7709a6c6 100644 --- a/data/minecraft/structure/ancient_city/structures/large_ruin_1.nbt +++ b/data/minecraft/structure/ancient_city/structures/large_ruin_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:001dc2aced09de145f27d4f93cf0acd07c224f57240a44cf0b4b950f7b6e7b56 -size 395 +oid sha256:db384e446acf117589e1d8ff9cefc7507cc8ca8077af05013e4280341bcfa8d0 +size 398 diff --git a/data/minecraft/structure/ancient_city/structures/medium_pillar_1.nbt b/data/minecraft/structure/ancient_city/structures/medium_pillar_1.nbt index 4cc40302..b9fec710 100644 --- a/data/minecraft/structure/ancient_city/structures/medium_pillar_1.nbt +++ b/data/minecraft/structure/ancient_city/structures/medium_pillar_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a66d7c52e599108d4e75bb6a0fe411d6e0a12976e3a4a83642ec2ce54c3be746 -size 958 +oid sha256:59dd3b75ca061f24017f5f6256b7fce8f61f30546ec3e0d2383aefa41d50ea92 +size 960 diff --git a/data/minecraft/structure/ancient_city/structures/medium_ruin_1.nbt b/data/minecraft/structure/ancient_city/structures/medium_ruin_1.nbt index 9f872d6a..0712acc9 100644 --- a/data/minecraft/structure/ancient_city/structures/medium_ruin_1.nbt +++ b/data/minecraft/structure/ancient_city/structures/medium_ruin_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:bf04deb9e0983ac7816bf774f54ef898c0d406bda58555aca30286c2c0c5c908 -size 325 +oid sha256:ef3b08752e6de7321dfd27453933053ec0e7ad8624373685fead4479ee732cc1 +size 327 diff --git a/data/minecraft/structure/ancient_city/structures/medium_ruin_2.nbt b/data/minecraft/structure/ancient_city/structures/medium_ruin_2.nbt index 25362841..cff9b0ad 100644 --- a/data/minecraft/structure/ancient_city/structures/medium_ruin_2.nbt +++ b/data/minecraft/structure/ancient_city/structures/medium_ruin_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f4bf9b3af3cb764297b333375755a78f2efb077839b864040bcadd6d0d17a1ac -size 351 +oid sha256:e17787440c7a453b96a416ab4ad209af4f1e453233e61545478b4431aba94443 +size 353 diff --git a/data/minecraft/structure/ancient_city/structures/sauna_1.nbt b/data/minecraft/structure/ancient_city/structures/sauna_1.nbt index 59a14f8e..841d9181 100644 --- a/data/minecraft/structure/ancient_city/structures/sauna_1.nbt +++ b/data/minecraft/structure/ancient_city/structures/sauna_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7a7752e57ed49930124f224f2424aad5df8d0cfa2e79961c94d248b1743c809e -size 6955 +oid sha256:d59cdc72d05d33ea6e1899f00495521dce7427c6c92be0a026ae8005d5699a50 +size 6958 diff --git a/data/minecraft/structure/ancient_city/structures/small_ruin_1.nbt b/data/minecraft/structure/ancient_city/structures/small_ruin_1.nbt index 69ff5ea5..d9b89bd1 100644 --- a/data/minecraft/structure/ancient_city/structures/small_ruin_1.nbt +++ b/data/minecraft/structure/ancient_city/structures/small_ruin_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2adbd215c1e2173f170b2352f62b65cf4168152a9aa975154a5d4f271ca331cd -size 313 +oid sha256:691d8032a3fc1f297c41377402cec123cc27ef110a30b5ef9a8cfb9497392448 +size 315 diff --git a/data/minecraft/structure/ancient_city/structures/small_ruin_2.nbt b/data/minecraft/structure/ancient_city/structures/small_ruin_2.nbt index 13b206ff..8e362e71 100644 --- a/data/minecraft/structure/ancient_city/structures/small_ruin_2.nbt +++ b/data/minecraft/structure/ancient_city/structures/small_ruin_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ee24efaee3aab340f730124a530bd48058ef43de2eeefb888946bba4e6223b0c -size 308 +oid sha256:89e0b66cac952002ed0df1566d3b7db25878ce702f68c34000a5cc8306da7bbb +size 310 diff --git a/data/minecraft/structure/ancient_city/structures/small_statue.nbt b/data/minecraft/structure/ancient_city/structures/small_statue.nbt index 732bc281..810e6079 100644 --- a/data/minecraft/structure/ancient_city/structures/small_statue.nbt +++ b/data/minecraft/structure/ancient_city/structures/small_statue.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d91aa1bfd3e0803ff45748ec605d148a012bf9ca7e62494ad8781511e159851a -size 890 +oid sha256:e9dd6bb02db736e9539c866377e86e3cee0d72a46cf8ec57cc9e8469ab79e68b +size 893 diff --git a/data/minecraft/structure/ancient_city/structures/tall_ruin_1.nbt b/data/minecraft/structure/ancient_city/structures/tall_ruin_1.nbt index 3ac64045..7844e702 100644 --- a/data/minecraft/structure/ancient_city/structures/tall_ruin_1.nbt +++ b/data/minecraft/structure/ancient_city/structures/tall_ruin_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:67971b4d66749fa1bca5a46048018982b21e6dc137ab3625038e2243e399d5d3 -size 2790 +oid sha256:610e82982eb72c0a523e331d009ff7cf939866176aaaac1a5c26cf427f8d68bb +size 2794 diff --git a/data/minecraft/structure/ancient_city/structures/tall_ruin_2.nbt b/data/minecraft/structure/ancient_city/structures/tall_ruin_2.nbt index 6f728831..7ceb7a6a 100644 --- a/data/minecraft/structure/ancient_city/structures/tall_ruin_2.nbt +++ b/data/minecraft/structure/ancient_city/structures/tall_ruin_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9758ed8f86dbfb81758139f32aa267fd32142ac122fcde1e718d8a3bf9898fd0 -size 3484 +oid sha256:8fd7fcab134a3f573023b91cb206235cd068efc3a9d17f16e32b2261deb82eef +size 3487 diff --git a/data/minecraft/structure/ancient_city/structures/tall_ruin_3.nbt b/data/minecraft/structure/ancient_city/structures/tall_ruin_3.nbt index fc667032..6dbc71bc 100644 --- a/data/minecraft/structure/ancient_city/structures/tall_ruin_3.nbt +++ b/data/minecraft/structure/ancient_city/structures/tall_ruin_3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5f987f87ffe4f4f600e06305a088f36f0bc3cb5b7469115ca49fe1fc342ef7a4 -size 1520 +oid sha256:7638bcb62df47ad050b7025dd056b8694be77b769529086ce557f887adc89670 +size 1522 diff --git a/data/minecraft/structure/ancient_city/structures/tall_ruin_4.nbt b/data/minecraft/structure/ancient_city/structures/tall_ruin_4.nbt index b77cc6bb..c6bfcfc1 100644 --- a/data/minecraft/structure/ancient_city/structures/tall_ruin_4.nbt +++ b/data/minecraft/structure/ancient_city/structures/tall_ruin_4.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:eef9be7372a464739d469e05e2760141703d2ed47f3573bd8be98a41b31848c5 -size 2294 +oid sha256:b151e9f7f356811578eca7a3a496061383008ffc34cd60238dac7a0dc269ab2c +size 2297 diff --git a/data/minecraft/structure/ancient_city/walls/intact_corner_wall_1.nbt b/data/minecraft/structure/ancient_city/walls/intact_corner_wall_1.nbt index 3053d5a5..2fd6f659 100644 --- a/data/minecraft/structure/ancient_city/walls/intact_corner_wall_1.nbt +++ b/data/minecraft/structure/ancient_city/walls/intact_corner_wall_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f09b9e861b06d6db4a4abc40ed08c731a13dec1a0ae150b6c71061a87cefde01 -size 3835 +oid sha256:1673359af62b6e022db108cd638aa19174d89acade6f9619d23c093e862a31c9 +size 3838 diff --git a/data/minecraft/structure/ancient_city/walls/intact_horizontal_wall_1.nbt b/data/minecraft/structure/ancient_city/walls/intact_horizontal_wall_1.nbt index 7cfbc24c..699199dc 100644 --- a/data/minecraft/structure/ancient_city/walls/intact_horizontal_wall_1.nbt +++ b/data/minecraft/structure/ancient_city/walls/intact_horizontal_wall_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:30fbc1ebdc4463a923cf74271201c9bbaa5e2e6bc3482ca2171b26f3acd0a1bf -size 2024 +oid sha256:841b590a3dd2ca6ea9b9ef706dfe443c3e409f20791d623df9c8e3b6264a0159 +size 2027 diff --git a/data/minecraft/structure/ancient_city/walls/intact_horizontal_wall_2.nbt b/data/minecraft/structure/ancient_city/walls/intact_horizontal_wall_2.nbt index 706434f4..9e9e01db 100644 --- a/data/minecraft/structure/ancient_city/walls/intact_horizontal_wall_2.nbt +++ b/data/minecraft/structure/ancient_city/walls/intact_horizontal_wall_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:738f57e0e9049b23f3c062b2b7db1ee78d174c85828fb845e754081c8e5c3b5b -size 2004 +oid sha256:07c405ad7be3156d5bcab4f564427cbf5f9dda6270fc65f77804480b54bd4151 +size 2006 diff --git a/data/minecraft/structure/ancient_city/walls/intact_horizontal_wall_bridge.nbt b/data/minecraft/structure/ancient_city/walls/intact_horizontal_wall_bridge.nbt index dd8ad72a..83a8bb2a 100644 --- a/data/minecraft/structure/ancient_city/walls/intact_horizontal_wall_bridge.nbt +++ b/data/minecraft/structure/ancient_city/walls/intact_horizontal_wall_bridge.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:701802407bf0864112d1eff9e1496fb6a057b1620b0d5205198e84cd26ce8663 -size 2719 +oid sha256:bb8c7714770976cf2dac81b8bab0777198d43a52801dfa634bd9a75131f0e2df +size 2721 diff --git a/data/minecraft/structure/ancient_city/walls/intact_horizontal_wall_passage_1.nbt b/data/minecraft/structure/ancient_city/walls/intact_horizontal_wall_passage_1.nbt index 4bf39e57..acdf100d 100644 --- a/data/minecraft/structure/ancient_city/walls/intact_horizontal_wall_passage_1.nbt +++ b/data/minecraft/structure/ancient_city/walls/intact_horizontal_wall_passage_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:43e2b7d7c3b264fce5cc95bdbacfffdfc9642519d6c9f5b4c1ecca69a1bb8bdb -size 1660 +oid sha256:49ae7a45313edf3daf5a5a1292d348d98091ba42a03551b52250be7f0c4ffdb7 +size 1662 diff --git a/data/minecraft/structure/ancient_city/walls/intact_horizontal_wall_stairs_1.nbt b/data/minecraft/structure/ancient_city/walls/intact_horizontal_wall_stairs_1.nbt index 96c433a9..0dc5ddd9 100644 --- a/data/minecraft/structure/ancient_city/walls/intact_horizontal_wall_stairs_1.nbt +++ b/data/minecraft/structure/ancient_city/walls/intact_horizontal_wall_stairs_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ee6ef134b0f9a39f3191a27b5d63d3011d0c09536884803ea6565938c343ca14 -size 2116 +oid sha256:fc951430505705617358df9e3431a51bb5d179ebabfba28f45f092429c26b6b0 +size 2119 diff --git a/data/minecraft/structure/ancient_city/walls/intact_horizontal_wall_stairs_2.nbt b/data/minecraft/structure/ancient_city/walls/intact_horizontal_wall_stairs_2.nbt index f114fec6..1f080f6a 100644 --- a/data/minecraft/structure/ancient_city/walls/intact_horizontal_wall_stairs_2.nbt +++ b/data/minecraft/structure/ancient_city/walls/intact_horizontal_wall_stairs_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2295dd1972b8d457aa09c8c02a0bf2beb5e239d69b60493ccfe81340750f0fed -size 2166 +oid sha256:63b387223d829b4d9134333b965a1b65cd8a702ce4a605e392cf2ff062a81e8b +size 2170 diff --git a/data/minecraft/structure/ancient_city/walls/intact_horizontal_wall_stairs_3.nbt b/data/minecraft/structure/ancient_city/walls/intact_horizontal_wall_stairs_3.nbt index c22b6934..d30b6615 100644 --- a/data/minecraft/structure/ancient_city/walls/intact_horizontal_wall_stairs_3.nbt +++ b/data/minecraft/structure/ancient_city/walls/intact_horizontal_wall_stairs_3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e4221bee85021fe50c090c9780e6f65c9f453725133d2903a58d0db85a7abfec -size 2154 +oid sha256:30535dcae9136523835d56c80ddba1c9fd274b446f598b2f70eaf2574cbd2309 +size 2157 diff --git a/data/minecraft/structure/ancient_city/walls/intact_horizontal_wall_stairs_4.nbt b/data/minecraft/structure/ancient_city/walls/intact_horizontal_wall_stairs_4.nbt index 54fec139..f277990d 100644 --- a/data/minecraft/structure/ancient_city/walls/intact_horizontal_wall_stairs_4.nbt +++ b/data/minecraft/structure/ancient_city/walls/intact_horizontal_wall_stairs_4.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2efd77e647d0761104e63afff39a93757b23a0662626d9b752e1cdb69b464e3f -size 2052 +oid sha256:c8c379f4868ea677c7374893a678cdeb584ed9826af232f140a74dbe52170d75 +size 2055 diff --git a/data/minecraft/structure/ancient_city/walls/intact_intersection_wall_1.nbt b/data/minecraft/structure/ancient_city/walls/intact_intersection_wall_1.nbt index f49782a7..75f20619 100644 --- a/data/minecraft/structure/ancient_city/walls/intact_intersection_wall_1.nbt +++ b/data/minecraft/structure/ancient_city/walls/intact_intersection_wall_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b82faccc6e7498a19a9e29cf62ffa34498b8f49acb1f8ef0a5b77f8f44bbf8ae -size 3123 +oid sha256:92b5dbcd0a2342e0b1d519bf8cedeada73dbf30fc1bf762e9af74a1bf1667c15 +size 3126 diff --git a/data/minecraft/structure/ancient_city/walls/intact_lshape_wall_1.nbt b/data/minecraft/structure/ancient_city/walls/intact_lshape_wall_1.nbt index 166496dc..ca793fee 100644 --- a/data/minecraft/structure/ancient_city/walls/intact_lshape_wall_1.nbt +++ b/data/minecraft/structure/ancient_city/walls/intact_lshape_wall_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2da2a8c3a4f0adc25058dd9bc641adf01a6b4f95f72fbeae4142bedfffd2e70f -size 2382 +oid sha256:f52d66185b20bcb50052d25cd190b496cb60e3b40c9003be9fc421a17c9a76c2 +size 2385 diff --git a/data/minecraft/structure/ancient_city/walls/ruined_corner_wall_1.nbt b/data/minecraft/structure/ancient_city/walls/ruined_corner_wall_1.nbt index e868a77b..713d3ef1 100644 --- a/data/minecraft/structure/ancient_city/walls/ruined_corner_wall_1.nbt +++ b/data/minecraft/structure/ancient_city/walls/ruined_corner_wall_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c67b9848d98a7cf0cfe24c95665eec66b6a86ed25910959aa734cdaf267ecd54 -size 4167 +oid sha256:c35f6cd9c7ef484d5aa90e3c678b83372b1403bca8793d5fcb6568a48d975c00 +size 4171 diff --git a/data/minecraft/structure/ancient_city/walls/ruined_corner_wall_2.nbt b/data/minecraft/structure/ancient_city/walls/ruined_corner_wall_2.nbt index 69590b4d..65833e29 100644 --- a/data/minecraft/structure/ancient_city/walls/ruined_corner_wall_2.nbt +++ b/data/minecraft/structure/ancient_city/walls/ruined_corner_wall_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0b6084279aab3271960c202ee0bb20d1fd6a2a54a2d2addc9fba8193afa1eff0 -size 3301 +oid sha256:84df0e62da6018e8ccd65ba7e28cddd5b726408668b7de963ec2c456043aa35f +size 3305 diff --git a/data/minecraft/structure/ancient_city/walls/ruined_horizontal_wall_stairs_1.nbt b/data/minecraft/structure/ancient_city/walls/ruined_horizontal_wall_stairs_1.nbt index ec8135ae..22f64e58 100644 --- a/data/minecraft/structure/ancient_city/walls/ruined_horizontal_wall_stairs_1.nbt +++ b/data/minecraft/structure/ancient_city/walls/ruined_horizontal_wall_stairs_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e8504ef02f3751d70a4989c76ef7d1e7400f9fa3927e504701c394a9bb2bff51 -size 1488 +oid sha256:45abd5154777de99296df9af58eb46381da8a82d89735712980c53ac8b68b679 +size 1491 diff --git a/data/minecraft/structure/ancient_city/walls/ruined_horizontal_wall_stairs_2.nbt b/data/minecraft/structure/ancient_city/walls/ruined_horizontal_wall_stairs_2.nbt index 3712b7b8..1b3b60be 100644 --- a/data/minecraft/structure/ancient_city/walls/ruined_horizontal_wall_stairs_2.nbt +++ b/data/minecraft/structure/ancient_city/walls/ruined_horizontal_wall_stairs_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e21ce6e71e10d7d5135caa5eba05a1890e2c22268195791c49f0c147359dd3e5 -size 1973 +oid sha256:0b321db3740964570125145db8e808717560814a9b9a4c1c391705cf5ffffd2a +size 1976 diff --git a/data/minecraft/structure/ancient_city/walls/ruined_horizontal_wall_stairs_3.nbt b/data/minecraft/structure/ancient_city/walls/ruined_horizontal_wall_stairs_3.nbt index 36cb87aa..932c558c 100644 --- a/data/minecraft/structure/ancient_city/walls/ruined_horizontal_wall_stairs_3.nbt +++ b/data/minecraft/structure/ancient_city/walls/ruined_horizontal_wall_stairs_3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c5e359c96d8db2cd25e677579246ded8badd27cb2dbe83498f1f9bc8a1898163 -size 1383 +oid sha256:c93cbf0d5b9173ef5d52875bc3b01d21f0144da1fa558ab8064fed68b90aeee6 +size 1386 diff --git a/data/minecraft/structure/ancient_city/walls/ruined_horizontal_wall_stairs_4.nbt b/data/minecraft/structure/ancient_city/walls/ruined_horizontal_wall_stairs_4.nbt index 4dee6875..3acfeb89 100644 --- a/data/minecraft/structure/ancient_city/walls/ruined_horizontal_wall_stairs_4.nbt +++ b/data/minecraft/structure/ancient_city/walls/ruined_horizontal_wall_stairs_4.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b2e39ed7fd2021dfe553e837cc7a1587db3b58b9d477228d3fa06f95f34a2fb5 -size 1338 +oid sha256:822bafb0bda1e34de196bb327380d6ff1df4465eec53eb238ab0327b8e34b8f0 +size 1341 diff --git a/data/minecraft/structure/bastion/blocks/air.nbt b/data/minecraft/structure/bastion/blocks/air.nbt index 88055775..6973ed4e 100644 --- a/data/minecraft/structure/bastion/blocks/air.nbt +++ b/data/minecraft/structure/bastion/blocks/air.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:cd0a2439716616388058ecf3094b27df0fdc9c6ddf1217764e9fbb6e2a7191b5 -size 226 +oid sha256:2b05f3935e9f480ba3c89f013dfb635b73eccab9439438555e3c612afe24f028 +size 228 diff --git a/data/minecraft/structure/bastion/blocks/gold.nbt b/data/minecraft/structure/bastion/blocks/gold.nbt index 30f1fbf9..0e1bd5df 100644 --- a/data/minecraft/structure/bastion/blocks/gold.nbt +++ b/data/minecraft/structure/bastion/blocks/gold.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d0d7b5d4ff4e68ec313f6b8dd5cec6a4a1908a5cddf9d7db86d5bd471db1f248 -size 231 +oid sha256:09be59c40f4a031f97c1998ee1e3559e93c72873a97df209869fb05963573297 +size 233 diff --git a/data/minecraft/structure/bastion/bridge/bridge_pieces/bridge.nbt b/data/minecraft/structure/bastion/bridge/bridge_pieces/bridge.nbt index 75cfac3e..5b70f546 100644 --- a/data/minecraft/structure/bastion/bridge/bridge_pieces/bridge.nbt +++ b/data/minecraft/structure/bastion/bridge/bridge_pieces/bridge.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a161a95dc6d9de7dc27c1f1cc2b55e6998ad6ee77e58984dc43b77139ad1ed57 -size 15685 +oid sha256:4f78d052c573805a0f9752e657abdc6ba5391a72cdb071d1240fc6fe4baa2bdd +size 15687 diff --git a/data/minecraft/structure/bastion/bridge/connectors/back_bridge_bottom.nbt b/data/minecraft/structure/bastion/bridge/connectors/back_bridge_bottom.nbt index 87e2b900..fbcf6c35 100644 --- a/data/minecraft/structure/bastion/bridge/connectors/back_bridge_bottom.nbt +++ b/data/minecraft/structure/bastion/bridge/connectors/back_bridge_bottom.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5815427f464cee60cd2cf41707ce3e9612d6acaab8929764f82ff54d5cbf3f98 -size 1426 +oid sha256:edf1e4a057710d5a05796231d412ffccb7a7b9f0c1d72d82c3fdaccf560ead18 +size 1428 diff --git a/data/minecraft/structure/bastion/bridge/connectors/back_bridge_top.nbt b/data/minecraft/structure/bastion/bridge/connectors/back_bridge_top.nbt index e981420b..4e414bf4 100644 --- a/data/minecraft/structure/bastion/bridge/connectors/back_bridge_top.nbt +++ b/data/minecraft/structure/bastion/bridge/connectors/back_bridge_top.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:82fe66eece6e6bee7b95e892d260437bb534e54b7edb44f4a494fd6bf428821d -size 1372 +oid sha256:44bcda96d03c4b2b5a4719993876610a207eff62cd962ca12ebf81716b6a69ef +size 1375 diff --git a/data/minecraft/structure/bastion/bridge/legs/leg_0.nbt b/data/minecraft/structure/bastion/bridge/legs/leg_0.nbt index f284b57a..773b050f 100644 --- a/data/minecraft/structure/bastion/bridge/legs/leg_0.nbt +++ b/data/minecraft/structure/bastion/bridge/legs/leg_0.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1b632d6820f1430f2bec7b34d704968d46fd9155246612b2de8dbf3e90c2aa10 -size 705 +oid sha256:82b2e7744ad0647d62bfc46c2b562794726c3b06d788b54437cf84142dc0160e +size 708 diff --git a/data/minecraft/structure/bastion/bridge/legs/leg_1.nbt b/data/minecraft/structure/bastion/bridge/legs/leg_1.nbt index f2659350..5dac4d3c 100644 --- a/data/minecraft/structure/bastion/bridge/legs/leg_1.nbt +++ b/data/minecraft/structure/bastion/bridge/legs/leg_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:876f3dfcb157cfad3b48e01a6e2d142f5c28c97a3d99d3f1bc8046cfd1c97e3c -size 737 +oid sha256:cfcafded8afeded2039b3e8a4452df463a59e40ab58792b98bdae9c5093a2f7d +size 739 diff --git a/data/minecraft/structure/bastion/bridge/rampart_plates/plate_0.nbt b/data/minecraft/structure/bastion/bridge/rampart_plates/plate_0.nbt index a2570901..df355974 100644 --- a/data/minecraft/structure/bastion/bridge/rampart_plates/plate_0.nbt +++ b/data/minecraft/structure/bastion/bridge/rampart_plates/plate_0.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:51b152e50af08574989e3973955a32d2edddda02c57f5be999a879de6bcd0500 -size 2052 +oid sha256:eb4692cb5bff03d922d95f913296286db4e497f202b47c3c3c657f2d5a1dd09a +size 2055 diff --git a/data/minecraft/structure/bastion/bridge/ramparts/rampart_0.nbt b/data/minecraft/structure/bastion/bridge/ramparts/rampart_0.nbt index 31fa3bfb..9f20df81 100644 --- a/data/minecraft/structure/bastion/bridge/ramparts/rampart_0.nbt +++ b/data/minecraft/structure/bastion/bridge/ramparts/rampart_0.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:18edc14c5826c184b5ff0f85dd9b98b9c42f6f6defe64bf090637c2cdf7b092f -size 12576 +oid sha256:adc70786165af13c35ddcf59dc2f605b556f6067fa86eea794a13e58722bee1d +size 12579 diff --git a/data/minecraft/structure/bastion/bridge/ramparts/rampart_1.nbt b/data/minecraft/structure/bastion/bridge/ramparts/rampart_1.nbt index dfb71188..b8711a8b 100644 --- a/data/minecraft/structure/bastion/bridge/ramparts/rampart_1.nbt +++ b/data/minecraft/structure/bastion/bridge/ramparts/rampart_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a4a3512dc4fe718894d30f483ce02a0f6f6ee087dd17718d642b322bc3e214de -size 19407 +oid sha256:7b72d40571179a940c7e51a065fdec37b85797feee6bb69e3d2a87810d2cec15 +size 19410 diff --git a/data/minecraft/structure/bastion/bridge/starting_pieces/entrance.nbt b/data/minecraft/structure/bastion/bridge/starting_pieces/entrance.nbt index 8a4bfc67..f0afcdb5 100644 --- a/data/minecraft/structure/bastion/bridge/starting_pieces/entrance.nbt +++ b/data/minecraft/structure/bastion/bridge/starting_pieces/entrance.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:95af7aaae1af7a1e65b2ded0b2226d418c55496bdc29f43c59af9cb6a897c10c -size 41135 +oid sha256:b50261a5469ecc46709f82d19cbc6adee6d8f88650e8cbb02c57ea559db4c46b +size 41138 diff --git a/data/minecraft/structure/bastion/bridge/starting_pieces/entrance_base.nbt b/data/minecraft/structure/bastion/bridge/starting_pieces/entrance_base.nbt index 607023ec..8f96a5d6 100644 --- a/data/minecraft/structure/bastion/bridge/starting_pieces/entrance_base.nbt +++ b/data/minecraft/structure/bastion/bridge/starting_pieces/entrance_base.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:977c448039e71e8b513b0856c678c8e4e2e7a9b516954b1948fee53b406a082d -size 45583 +oid sha256:5b86f53bf39dd9c986edc189c58ceaa5273b042734810ecd61e5ec9fbe034fa7 +size 45585 diff --git a/data/minecraft/structure/bastion/bridge/starting_pieces/entrance_face.nbt b/data/minecraft/structure/bastion/bridge/starting_pieces/entrance_face.nbt index e4d980e4..32adaea0 100644 --- a/data/minecraft/structure/bastion/bridge/starting_pieces/entrance_face.nbt +++ b/data/minecraft/structure/bastion/bridge/starting_pieces/entrance_face.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e373f84d145565cbdf4cd4bd0edde8a56ad84b0591f1efc86636f1db091221c6 -size 2736 +oid sha256:8996947d054729ab4ec35f00157216e066d237430a617aa5ebe3180adc8524d5 +size 2739 diff --git a/data/minecraft/structure/bastion/bridge/walls/wall_base_0.nbt b/data/minecraft/structure/bastion/bridge/walls/wall_base_0.nbt index 4d89adb1..58fcbab4 100644 --- a/data/minecraft/structure/bastion/bridge/walls/wall_base_0.nbt +++ b/data/minecraft/structure/bastion/bridge/walls/wall_base_0.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8e029a57932d3cdb04f320ad1d88c5c405896a5658c9fbaafe5be987496106ee -size 17430 +oid sha256:a7e09633271176cb1a292fe2f73a5a6eabfbbe691be4d11e39569578fc4a1d22 +size 17433 diff --git a/data/minecraft/structure/bastion/bridge/walls/wall_base_1.nbt b/data/minecraft/structure/bastion/bridge/walls/wall_base_1.nbt index f7241898..0e92c121 100644 --- a/data/minecraft/structure/bastion/bridge/walls/wall_base_1.nbt +++ b/data/minecraft/structure/bastion/bridge/walls/wall_base_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8dd39cebfd4d47da897b8a3ff3aec1fe8ff27c7d0ed0cf233804f1d1c62da7f0 -size 17257 +oid sha256:d50b1b188442cd6d94097736ffb2ed40c8673489add2ab21efdc597770a92292 +size 17260 diff --git a/data/minecraft/structure/bastion/hoglin_stable/air_base.nbt b/data/minecraft/structure/bastion/hoglin_stable/air_base.nbt index 97b54eb1..46729992 100644 --- a/data/minecraft/structure/bastion/hoglin_stable/air_base.nbt +++ b/data/minecraft/structure/bastion/hoglin_stable/air_base.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:206b6c7da357f49f828eef94b6f7215f26a62ccc0051c267b11e1479230ee3a7 -size 80378 +oid sha256:d1e79fae16de00ed11555449053504c2809b0de854590f2ae7f425381f63079d +size 80384 diff --git a/data/minecraft/structure/bastion/hoglin_stable/connectors/end_post_connector.nbt b/data/minecraft/structure/bastion/hoglin_stable/connectors/end_post_connector.nbt index 51629fb2..40272814 100644 --- a/data/minecraft/structure/bastion/hoglin_stable/connectors/end_post_connector.nbt +++ b/data/minecraft/structure/bastion/hoglin_stable/connectors/end_post_connector.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a1932d09fc43bb8230fcd39fd09b00ed11386369cdc95c7bef665cd911e2f47f -size 286 +oid sha256:7265e6ad8056e1cf960c468031066e7354e53269fa10e639de767b59d7081d14 +size 288 diff --git a/data/minecraft/structure/bastion/hoglin_stable/large_stables/inner_0.nbt b/data/minecraft/structure/bastion/hoglin_stable/large_stables/inner_0.nbt index 5a9ac011..895a1f16 100644 --- a/data/minecraft/structure/bastion/hoglin_stable/large_stables/inner_0.nbt +++ b/data/minecraft/structure/bastion/hoglin_stable/large_stables/inner_0.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d1aee607de3ba426cbf20b09211227c1feb399b945b2e9c0384031488841a032 -size 1877 +oid sha256:aeff3e7cc4b8a6db18dd91048d5d053582fc3b9f07c3b036a137c301636801b5 +size 1880 diff --git a/data/minecraft/structure/bastion/hoglin_stable/large_stables/inner_1.nbt b/data/minecraft/structure/bastion/hoglin_stable/large_stables/inner_1.nbt index b943d476..d3d3a5c7 100644 --- a/data/minecraft/structure/bastion/hoglin_stable/large_stables/inner_1.nbt +++ b/data/minecraft/structure/bastion/hoglin_stable/large_stables/inner_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a9ddcf45b4f289115b4d2694da03407af9b035f88fa398b405eaf73fae655149 -size 2074 +oid sha256:a96b010f118b4da7bff6627c3271e850ca3615d92fb8560e5e5b5e5e378c7a73 +size 2076 diff --git a/data/minecraft/structure/bastion/hoglin_stable/large_stables/inner_2.nbt b/data/minecraft/structure/bastion/hoglin_stable/large_stables/inner_2.nbt index f8b1ffca..5ef69bc6 100644 --- a/data/minecraft/structure/bastion/hoglin_stable/large_stables/inner_2.nbt +++ b/data/minecraft/structure/bastion/hoglin_stable/large_stables/inner_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:fe1ef24cfca84ea6e6ce95389de2a270aeab84e1628a026ea93dd18afbdb0dfc -size 2350 +oid sha256:1813829832fd5c1a913bedc42d3bdaffc9cb43ed1e630c9d6206623aa0a91561 +size 2353 diff --git a/data/minecraft/structure/bastion/hoglin_stable/large_stables/inner_3.nbt b/data/minecraft/structure/bastion/hoglin_stable/large_stables/inner_3.nbt index 9be3d148..39802ec2 100644 --- a/data/minecraft/structure/bastion/hoglin_stable/large_stables/inner_3.nbt +++ b/data/minecraft/structure/bastion/hoglin_stable/large_stables/inner_3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:148f4d8c83271c1c33ad901172800f974383bab12380cbbdc43081f8b9ade7fc -size 2397 +oid sha256:fa8cb9f4e9b154f07ffe1b7a57ce97e45698ae594bb6edd6dee4dcc51680ef71 +size 2399 diff --git a/data/minecraft/structure/bastion/hoglin_stable/large_stables/inner_4.nbt b/data/minecraft/structure/bastion/hoglin_stable/large_stables/inner_4.nbt index bf5c247c..c23fcfb4 100644 --- a/data/minecraft/structure/bastion/hoglin_stable/large_stables/inner_4.nbt +++ b/data/minecraft/structure/bastion/hoglin_stable/large_stables/inner_4.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4cfa4fe5b1521a92ba359ac4b5897dd4dd5faba629d9203a42f7108bc41e2c5a -size 2144 +oid sha256:13fe683e9074a3294a32faf94276b6d42c84c0efa1a0a4bb2bbefa28c640e082 +size 2147 diff --git a/data/minecraft/structure/bastion/hoglin_stable/large_stables/outer_0.nbt b/data/minecraft/structure/bastion/hoglin_stable/large_stables/outer_0.nbt index 9e362fd3..5455d144 100644 --- a/data/minecraft/structure/bastion/hoglin_stable/large_stables/outer_0.nbt +++ b/data/minecraft/structure/bastion/hoglin_stable/large_stables/outer_0.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:fbebb56594472f14d51132868126878c0c8e326eef3c7be84ce7671292f45204 -size 1963 +oid sha256:ba37acd5a9f2c8287a9982c824ebb9ff4c70317b96d0dbec094c73f53aa8e162 +size 1965 diff --git a/data/minecraft/structure/bastion/hoglin_stable/large_stables/outer_1.nbt b/data/minecraft/structure/bastion/hoglin_stable/large_stables/outer_1.nbt index 4b7c0651..60b8df4f 100644 --- a/data/minecraft/structure/bastion/hoglin_stable/large_stables/outer_1.nbt +++ b/data/minecraft/structure/bastion/hoglin_stable/large_stables/outer_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d37085d65a9a6020fdddbee26f8250d11749b015e4a5bca9662e3349b66daae1 -size 2316 +oid sha256:3cb059ffd5a17639230efd878697e344b8ba63a5e668b2700a7f585517015156 +size 2319 diff --git a/data/minecraft/structure/bastion/hoglin_stable/large_stables/outer_2.nbt b/data/minecraft/structure/bastion/hoglin_stable/large_stables/outer_2.nbt index 7ce7a5c7..9d1939e9 100644 --- a/data/minecraft/structure/bastion/hoglin_stable/large_stables/outer_2.nbt +++ b/data/minecraft/structure/bastion/hoglin_stable/large_stables/outer_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5eb2342c60e7dd3dcbd9b0254ac153c2dcd748bebcea65e3987902d1f69aece0 -size 2553 +oid sha256:c7565b970aa9108f101fa05df1539b5c0c9ddfbbd9801798bb84deb3f280c4d2 +size 2555 diff --git a/data/minecraft/structure/bastion/hoglin_stable/large_stables/outer_3.nbt b/data/minecraft/structure/bastion/hoglin_stable/large_stables/outer_3.nbt index 700aba02..20d09fd7 100644 --- a/data/minecraft/structure/bastion/hoglin_stable/large_stables/outer_3.nbt +++ b/data/minecraft/structure/bastion/hoglin_stable/large_stables/outer_3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:edc4dd445ebb11a1a03442f18b182a519a2519674102d4e7d7dd7ed4a9591c26 -size 2451 +oid sha256:53a7f7c9c00efc645559f57bbaf2b70aced6e3f813a5883e76dcd7e3cd7883dc +size 2454 diff --git a/data/minecraft/structure/bastion/hoglin_stable/large_stables/outer_4.nbt b/data/minecraft/structure/bastion/hoglin_stable/large_stables/outer_4.nbt index 9789dd90..6b50dd17 100644 --- a/data/minecraft/structure/bastion/hoglin_stable/large_stables/outer_4.nbt +++ b/data/minecraft/structure/bastion/hoglin_stable/large_stables/outer_4.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e703f274fdd2881e920b1bc61bf01e4dc79be724b58a50eed3b9dd5bdcf340d0 -size 2395 +oid sha256:9d83cf2e57c53f9b0622eca6794dd26495b0f3a5d4186a7d45abb7202a8ab55e +size 2398 diff --git a/data/minecraft/structure/bastion/hoglin_stable/posts/end_post.nbt b/data/minecraft/structure/bastion/hoglin_stable/posts/end_post.nbt index 2b6157ea..66c4e97b 100644 --- a/data/minecraft/structure/bastion/hoglin_stable/posts/end_post.nbt +++ b/data/minecraft/structure/bastion/hoglin_stable/posts/end_post.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3047fc9c64bd6ede35df47d5f4698f28e2e8fc6a7a941e66b74510335cc3069f -size 528 +oid sha256:03cc3895c82bc709a5b63c1e14e5c6b35f33c468e2cb26438660dc831a2a5dc4 +size 530 diff --git a/data/minecraft/structure/bastion/hoglin_stable/posts/stair_post.nbt b/data/minecraft/structure/bastion/hoglin_stable/posts/stair_post.nbt index 9d4d9bae..0176bd01 100644 --- a/data/minecraft/structure/bastion/hoglin_stable/posts/stair_post.nbt +++ b/data/minecraft/structure/bastion/hoglin_stable/posts/stair_post.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:08a5c32a4f6ec23eb7dd8ab2745bf51366b5ddf64cbbaa428ea6044fbfe1740c -size 1164 +oid sha256:0caf2f0fbf7729fa77db0b18ccd09b8e3f44d5bc31b0375945cc6c91dda63955 +size 1168 diff --git a/data/minecraft/structure/bastion/hoglin_stable/rampart_plates/rampart_plate_1.nbt b/data/minecraft/structure/bastion/hoglin_stable/rampart_plates/rampart_plate_1.nbt index 3ee01717..0346dc5b 100644 --- a/data/minecraft/structure/bastion/hoglin_stable/rampart_plates/rampart_plate_1.nbt +++ b/data/minecraft/structure/bastion/hoglin_stable/rampart_plates/rampart_plate_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5909e11fc091dab4bfeed1b7bddd95692f98345d80711df1fa6f4a5683df4093 -size 2177 +oid sha256:50f5009854c323adedbb59c482357d8923ba598acea76cc6d93f18061ed4c105 +size 2179 diff --git a/data/minecraft/structure/bastion/hoglin_stable/ramparts/ramparts_1.nbt b/data/minecraft/structure/bastion/hoglin_stable/ramparts/ramparts_1.nbt index 928a7936..4d517020 100644 --- a/data/minecraft/structure/bastion/hoglin_stable/ramparts/ramparts_1.nbt +++ b/data/minecraft/structure/bastion/hoglin_stable/ramparts/ramparts_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6e9e5eec38c4cb8318a06b0babac1c82f3629579748730e94251ca6b9a81b54d -size 19107 +oid sha256:a8b3bb6dc9c75cdf282c72283fa6309d4b0e447901fbc62c44b5ff25b396dfc6 +size 19110 diff --git a/data/minecraft/structure/bastion/hoglin_stable/ramparts/ramparts_2.nbt b/data/minecraft/structure/bastion/hoglin_stable/ramparts/ramparts_2.nbt index 50f450d3..5fb01b98 100644 --- a/data/minecraft/structure/bastion/hoglin_stable/ramparts/ramparts_2.nbt +++ b/data/minecraft/structure/bastion/hoglin_stable/ramparts/ramparts_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1604b73eec9ba8761f43f8eee560e0c5479c4c0438ac5a92a5a18b802a189a4d -size 12205 +oid sha256:4609ea588fde147d5e1135d75aba663570522299b17711e5a18775ae7b2f6d98 +size 12207 diff --git a/data/minecraft/structure/bastion/hoglin_stable/ramparts/ramparts_3.nbt b/data/minecraft/structure/bastion/hoglin_stable/ramparts/ramparts_3.nbt index 9f47f04d..1352f6b8 100644 --- a/data/minecraft/structure/bastion/hoglin_stable/ramparts/ramparts_3.nbt +++ b/data/minecraft/structure/bastion/hoglin_stable/ramparts/ramparts_3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b5f28066fadfa4825742adaedfedcffbab051094aab778500b8cae4acdf7a250 -size 6387 +oid sha256:4984fe2c4f064062514e7a49bbf9d9320c1c8a8f3ee9cf0ea8a2d3606047036e +size 6390 diff --git a/data/minecraft/structure/bastion/hoglin_stable/small_stables/inner_0.nbt b/data/minecraft/structure/bastion/hoglin_stable/small_stables/inner_0.nbt index dd552320..df1e33af 100644 --- a/data/minecraft/structure/bastion/hoglin_stable/small_stables/inner_0.nbt +++ b/data/minecraft/structure/bastion/hoglin_stable/small_stables/inner_0.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9d67ea01735eff0fdab842651fc84f9187add4a3d272836039169197875e8b5d -size 1895 +oid sha256:4787f0ed568d9fa2acf59226c0d31bedaa6fb34b9c3c06930fd59b9ab05862ff +size 1898 diff --git a/data/minecraft/structure/bastion/hoglin_stable/small_stables/inner_1.nbt b/data/minecraft/structure/bastion/hoglin_stable/small_stables/inner_1.nbt index ab127bd6..e9e0e628 100644 --- a/data/minecraft/structure/bastion/hoglin_stable/small_stables/inner_1.nbt +++ b/data/minecraft/structure/bastion/hoglin_stable/small_stables/inner_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3ed5e38cfeb22baffd1a4dd13a0ec629e606203b65ca21f881d8ac8cc67f9e74 -size 1978 +oid sha256:9652b90a721db558c43b332b56276e0753e3f9bd6772a45d489f0b71bb922fba +size 1980 diff --git a/data/minecraft/structure/bastion/hoglin_stable/small_stables/inner_2.nbt b/data/minecraft/structure/bastion/hoglin_stable/small_stables/inner_2.nbt index 4379f118..92c4ba98 100644 --- a/data/minecraft/structure/bastion/hoglin_stable/small_stables/inner_2.nbt +++ b/data/minecraft/structure/bastion/hoglin_stable/small_stables/inner_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:614ddf7f0d18a1ca111b46f15323aeff7bcd7fb46aa40a491fd4fcd880767f4e -size 2208 +oid sha256:c173100e6a8fa26413a1ffb4c9f9b32f89439df4caf881fa8f923eb53563cb35 +size 2211 diff --git a/data/minecraft/structure/bastion/hoglin_stable/small_stables/inner_3.nbt b/data/minecraft/structure/bastion/hoglin_stable/small_stables/inner_3.nbt index d7f2ff9b..dc25b681 100644 --- a/data/minecraft/structure/bastion/hoglin_stable/small_stables/inner_3.nbt +++ b/data/minecraft/structure/bastion/hoglin_stable/small_stables/inner_3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e735456a78e7d0313f4611852e7272b25ae4c41bc1f61df74cab0a6bf313b9f8 -size 1679 +oid sha256:c123cd7a8c54b9b049ac5b85d76678c03529d55395a3dc76e7b35ac5038098eb +size 1681 diff --git a/data/minecraft/structure/bastion/hoglin_stable/small_stables/outer_0.nbt b/data/minecraft/structure/bastion/hoglin_stable/small_stables/outer_0.nbt index 0fb6dfec..a1cf74d4 100644 --- a/data/minecraft/structure/bastion/hoglin_stable/small_stables/outer_0.nbt +++ b/data/minecraft/structure/bastion/hoglin_stable/small_stables/outer_0.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:41e58d58a57bc6cc1b2b9804cefe55e9b01e139ac1236c57ea9319b79da74166 -size 2135 +oid sha256:886db72c0e6ee85e40ef16c9f233167875523e53dd3f80b9cc56525e832e1467 +size 2138 diff --git a/data/minecraft/structure/bastion/hoglin_stable/small_stables/outer_1.nbt b/data/minecraft/structure/bastion/hoglin_stable/small_stables/outer_1.nbt index b9ac2b58..c41e85ad 100644 --- a/data/minecraft/structure/bastion/hoglin_stable/small_stables/outer_1.nbt +++ b/data/minecraft/structure/bastion/hoglin_stable/small_stables/outer_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2a35c0b45190d5aaf2e2deaa194ff4e9d211bb8ffe97d762883d8dd47606b702 -size 2062 +oid sha256:aaf58989a9323ffcc4f880eed522d97ee5257f86f2ef48d7afc1c1ce867ffe9d +size 2065 diff --git a/data/minecraft/structure/bastion/hoglin_stable/small_stables/outer_2.nbt b/data/minecraft/structure/bastion/hoglin_stable/small_stables/outer_2.nbt index 8de74ce7..1fdfa35d 100644 --- a/data/minecraft/structure/bastion/hoglin_stable/small_stables/outer_2.nbt +++ b/data/minecraft/structure/bastion/hoglin_stable/small_stables/outer_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9a81378a7f567c19c7b85c82e8ae392038f8cc0f8b83c0078c3db41f38a6aa53 -size 2147 +oid sha256:17f406705642921c11bb9a1711848ba617d80ec57664b5e194ffc63cb8d6d517 +size 2149 diff --git a/data/minecraft/structure/bastion/hoglin_stable/small_stables/outer_3.nbt b/data/minecraft/structure/bastion/hoglin_stable/small_stables/outer_3.nbt index 037aa01e..3b15971b 100644 --- a/data/minecraft/structure/bastion/hoglin_stable/small_stables/outer_3.nbt +++ b/data/minecraft/structure/bastion/hoglin_stable/small_stables/outer_3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a97ad77442d8b63476fc8ef37af72dbc2e54ed523560ee59871a51af59513478 -size 1848 +oid sha256:64364fe40ff64943c8f9f6b6a5c503f61141e96823d144601bb6a3ac4a00e526 +size 1850 diff --git a/data/minecraft/structure/bastion/hoglin_stable/stairs/stairs_1_0.nbt b/data/minecraft/structure/bastion/hoglin_stable/stairs/stairs_1_0.nbt index 44f715bd..157d0949 100644 --- a/data/minecraft/structure/bastion/hoglin_stable/stairs/stairs_1_0.nbt +++ b/data/minecraft/structure/bastion/hoglin_stable/stairs/stairs_1_0.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:24796ae8cfdb9fea82e25de56b76e1dbfa38f1f5aef8e1fe7afa33f961ac3ed9 -size 4463 +oid sha256:6a98b82616d5c011db943d2b3fb74315b6ee6b74d3815d485c11b4fb94365873 +size 4466 diff --git a/data/minecraft/structure/bastion/hoglin_stable/stairs/stairs_1_1.nbt b/data/minecraft/structure/bastion/hoglin_stable/stairs/stairs_1_1.nbt index 5ace3182..c0facb57 100644 --- a/data/minecraft/structure/bastion/hoglin_stable/stairs/stairs_1_1.nbt +++ b/data/minecraft/structure/bastion/hoglin_stable/stairs/stairs_1_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:12eed7b69071b590eedc4ea5e1ba2cacfc0e8256f2cc2b77374851cf8ff470c6 -size 4273 +oid sha256:a8c9b1303c49c6ea1d9e56d1fb88282bd2bf6880c6ae10009901c1c0c0246848 +size 4275 diff --git a/data/minecraft/structure/bastion/hoglin_stable/stairs/stairs_1_2.nbt b/data/minecraft/structure/bastion/hoglin_stable/stairs/stairs_1_2.nbt index 0d2c69e1..04d56fe1 100644 --- a/data/minecraft/structure/bastion/hoglin_stable/stairs/stairs_1_2.nbt +++ b/data/minecraft/structure/bastion/hoglin_stable/stairs/stairs_1_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:37e9f645efdbd5b43b2b847f8683f2728169d7af8d44a1eb8053747be5835443 -size 4336 +oid sha256:1766a908b58da341bb91adbdf6734a1b14c0aec1a3e0f5d80a3ef5470facd724 +size 4338 diff --git a/data/minecraft/structure/bastion/hoglin_stable/stairs/stairs_1_3.nbt b/data/minecraft/structure/bastion/hoglin_stable/stairs/stairs_1_3.nbt index 7ba35db0..8e5b7b95 100644 --- a/data/minecraft/structure/bastion/hoglin_stable/stairs/stairs_1_3.nbt +++ b/data/minecraft/structure/bastion/hoglin_stable/stairs/stairs_1_3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b761a8c70527c2812dc8fc695b5b42595de11976f0b965c7efa78c8ae10f330c -size 4495 +oid sha256:0c090705f69e8d32ab8805e9c2d7dca4e2a7efc41f4cf04b217f8b52711fbe48 +size 4498 diff --git a/data/minecraft/structure/bastion/hoglin_stable/stairs/stairs_1_4.nbt b/data/minecraft/structure/bastion/hoglin_stable/stairs/stairs_1_4.nbt index 4b9225f1..d0a7b789 100644 --- a/data/minecraft/structure/bastion/hoglin_stable/stairs/stairs_1_4.nbt +++ b/data/minecraft/structure/bastion/hoglin_stable/stairs/stairs_1_4.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0f50c7c7f44b6cc56fdf77ca42f9a125e4063191a84e05f9cf0808451bdafc00 -size 4436 +oid sha256:8567906b01bf44e67376c29be3687bf110ee9ee2e5159d0884195d51bc15786a +size 4439 diff --git a/data/minecraft/structure/bastion/hoglin_stable/stairs/stairs_2_0.nbt b/data/minecraft/structure/bastion/hoglin_stable/stairs/stairs_2_0.nbt index fd89ea52..f8720dce 100644 --- a/data/minecraft/structure/bastion/hoglin_stable/stairs/stairs_2_0.nbt +++ b/data/minecraft/structure/bastion/hoglin_stable/stairs/stairs_2_0.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f64bcb02eeaead3e2afa80fae47cbea3154b3f3f76145693c57b0d36d1e76681 -size 4411 +oid sha256:f4111280792d05ae7d694d7f4923e7b7dae19ccc6f6ffb53116a26708854cfd7 +size 4412 diff --git a/data/minecraft/structure/bastion/hoglin_stable/stairs/stairs_2_1.nbt b/data/minecraft/structure/bastion/hoglin_stable/stairs/stairs_2_1.nbt index 2ce02b3a..c61d5286 100644 --- a/data/minecraft/structure/bastion/hoglin_stable/stairs/stairs_2_1.nbt +++ b/data/minecraft/structure/bastion/hoglin_stable/stairs/stairs_2_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9e54d5c845832d863826b6e3b589734cbf0f72b67358673ab855b83167942f08 -size 4331 +oid sha256:d980374ae884d414c90aa786efac0588a7b015af3fb79c63b3660c0d7cf8fc1c +size 4334 diff --git a/data/minecraft/structure/bastion/hoglin_stable/stairs/stairs_2_2.nbt b/data/minecraft/structure/bastion/hoglin_stable/stairs/stairs_2_2.nbt index b881292b..e480a002 100644 --- a/data/minecraft/structure/bastion/hoglin_stable/stairs/stairs_2_2.nbt +++ b/data/minecraft/structure/bastion/hoglin_stable/stairs/stairs_2_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3711b310dc230950c3e8f47afaf2639d830eb41c05d2f4aebac307556fa941fc -size 4117 +oid sha256:2cc1f38ba017ba1e58df688314a1492c29bf6b0bcf6028f50e46ec6a7300652e +size 4119 diff --git a/data/minecraft/structure/bastion/hoglin_stable/stairs/stairs_2_3.nbt b/data/minecraft/structure/bastion/hoglin_stable/stairs/stairs_2_3.nbt index 9ce37aca..a0eb9eb4 100644 --- a/data/minecraft/structure/bastion/hoglin_stable/stairs/stairs_2_3.nbt +++ b/data/minecraft/structure/bastion/hoglin_stable/stairs/stairs_2_3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c152010c7b59d2dac3025d851bf43e95671389335e580f0635044028b44a7fa7 -size 3300 +oid sha256:2ac32aff9f5498587d861aacdfcc87fc39351a4c78f716be8439b5977a538e0f +size 3303 diff --git a/data/minecraft/structure/bastion/hoglin_stable/stairs/stairs_2_4.nbt b/data/minecraft/structure/bastion/hoglin_stable/stairs/stairs_2_4.nbt index 9b66c948..6aa3d892 100644 --- a/data/minecraft/structure/bastion/hoglin_stable/stairs/stairs_2_4.nbt +++ b/data/minecraft/structure/bastion/hoglin_stable/stairs/stairs_2_4.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:aafd651e4263a000f760df47c2e48bfc50e4dce48a08c2528b33b4ed48720562 -size 4376 +oid sha256:32ccb18742b5fa0199697d178d021b9630c59c441b9f57689b6a2bf6eefff9db +size 4378 diff --git a/data/minecraft/structure/bastion/hoglin_stable/stairs/stairs_3_0.nbt b/data/minecraft/structure/bastion/hoglin_stable/stairs/stairs_3_0.nbt index f05ce601..b677b62c 100644 --- a/data/minecraft/structure/bastion/hoglin_stable/stairs/stairs_3_0.nbt +++ b/data/minecraft/structure/bastion/hoglin_stable/stairs/stairs_3_0.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ed3ff547a6fcb05ff667458242ae85a6dae3ff121d83d57664662143fd5ced60 -size 4018 +oid sha256:273ea124c22b1079f84de1eb6a58180147069964a236fdaf337d0286458ed3bd +size 4021 diff --git a/data/minecraft/structure/bastion/hoglin_stable/stairs/stairs_3_1.nbt b/data/minecraft/structure/bastion/hoglin_stable/stairs/stairs_3_1.nbt index ceb6155b..c471a5ca 100644 --- a/data/minecraft/structure/bastion/hoglin_stable/stairs/stairs_3_1.nbt +++ b/data/minecraft/structure/bastion/hoglin_stable/stairs/stairs_3_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:fb694189f6de3c45dd1358f7b0e04f536e47cf769282f2bb26cc09f6730828bf -size 4003 +oid sha256:c093866d7dd956dc80f8457cf9b317312c932d918850633be92f29647380f969 +size 4005 diff --git a/data/minecraft/structure/bastion/hoglin_stable/stairs/stairs_3_2.nbt b/data/minecraft/structure/bastion/hoglin_stable/stairs/stairs_3_2.nbt index aed8345f..99581a89 100644 --- a/data/minecraft/structure/bastion/hoglin_stable/stairs/stairs_3_2.nbt +++ b/data/minecraft/structure/bastion/hoglin_stable/stairs/stairs_3_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:09b094b0922eaba75edfa0682d619d8c388a8e0f3ef00e744f93b08111c4cf6f -size 4207 +oid sha256:8e51adc245f34cbab85f33c19a85f4f05483ce2738e9c709522af1a06f71370d +size 4210 diff --git a/data/minecraft/structure/bastion/hoglin_stable/stairs/stairs_3_3.nbt b/data/minecraft/structure/bastion/hoglin_stable/stairs/stairs_3_3.nbt index 9ae2362b..c0dc41a0 100644 --- a/data/minecraft/structure/bastion/hoglin_stable/stairs/stairs_3_3.nbt +++ b/data/minecraft/structure/bastion/hoglin_stable/stairs/stairs_3_3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:02ef3657b75c4dc679e753b974f193684f901e7afdcbb1924d17974fbc085b4e -size 4320 +oid sha256:4f4f5eb3397d95a6addb0ea49bd0bd0107d3e9972810ef6d3584507862b45511 +size 4322 diff --git a/data/minecraft/structure/bastion/hoglin_stable/stairs/stairs_3_4.nbt b/data/minecraft/structure/bastion/hoglin_stable/stairs/stairs_3_4.nbt index e95214e3..4655aa9a 100644 --- a/data/minecraft/structure/bastion/hoglin_stable/stairs/stairs_3_4.nbt +++ b/data/minecraft/structure/bastion/hoglin_stable/stairs/stairs_3_4.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:02f6273eecf7cce50fd22c7dfd8feb083f7d344e8d2f9f10124d948de3149ac0 -size 2776 +oid sha256:176dde7abab63e15d49fa9b1229fea65252e190e3a11471f185f839ce5d0ec44 +size 2779 diff --git a/data/minecraft/structure/bastion/hoglin_stable/starting_pieces/stairs_0_mirrored.nbt b/data/minecraft/structure/bastion/hoglin_stable/starting_pieces/stairs_0_mirrored.nbt index 5f233d5d..5725d1cb 100644 --- a/data/minecraft/structure/bastion/hoglin_stable/starting_pieces/stairs_0_mirrored.nbt +++ b/data/minecraft/structure/bastion/hoglin_stable/starting_pieces/stairs_0_mirrored.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ab35577bf04c99eaf190f2480f27d42b1510d40cf881505a84d9651ff78f9801 -size 4609 +oid sha256:2f536334277ded594392845d179a0077862e486a52b7233c9bc1b1bc570883c7 +size 4612 diff --git a/data/minecraft/structure/bastion/hoglin_stable/starting_pieces/stairs_1_mirrored.nbt b/data/minecraft/structure/bastion/hoglin_stable/starting_pieces/stairs_1_mirrored.nbt index 0c2bff86..3a2b376c 100644 --- a/data/minecraft/structure/bastion/hoglin_stable/starting_pieces/stairs_1_mirrored.nbt +++ b/data/minecraft/structure/bastion/hoglin_stable/starting_pieces/stairs_1_mirrored.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:256c374fea5a4d602c51201d661cb4fb40e8fffad45e5ec47693dd820744592f -size 4624 +oid sha256:5d03448ac05bacbb9bba0bea6b6ff551ee1bd3aae7c5340bf5a68e1f89df39b1 +size 4626 diff --git a/data/minecraft/structure/bastion/hoglin_stable/starting_pieces/stairs_2_mirrored.nbt b/data/minecraft/structure/bastion/hoglin_stable/starting_pieces/stairs_2_mirrored.nbt index 851fab30..c7339b1b 100644 --- a/data/minecraft/structure/bastion/hoglin_stable/starting_pieces/stairs_2_mirrored.nbt +++ b/data/minecraft/structure/bastion/hoglin_stable/starting_pieces/stairs_2_mirrored.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c0b02348a1eb5cbd4e64f9c7e9b716e8655380b389fac4ac993f911ee0a0340e -size 4541 +oid sha256:5ab4d04649084e9cf2a1df0acf3bf8a0b13ebf31923b673bda49fad611f0cbf3 +size 4543 diff --git a/data/minecraft/structure/bastion/hoglin_stable/starting_pieces/stairs_3_mirrored.nbt b/data/minecraft/structure/bastion/hoglin_stable/starting_pieces/stairs_3_mirrored.nbt index 3753edde..394a53e9 100644 --- a/data/minecraft/structure/bastion/hoglin_stable/starting_pieces/stairs_3_mirrored.nbt +++ b/data/minecraft/structure/bastion/hoglin_stable/starting_pieces/stairs_3_mirrored.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6540aebd8cf9d0f4d198741655fd71f973b0a49bf4ec79bdf638f83f5203dd00 -size 4739 +oid sha256:8663e1a3c573a2719844fbe0015b2ccba3f329222c90cd3af149f22e2b5c9811 +size 4742 diff --git a/data/minecraft/structure/bastion/hoglin_stable/starting_pieces/stairs_4_mirrored.nbt b/data/minecraft/structure/bastion/hoglin_stable/starting_pieces/stairs_4_mirrored.nbt index c21968a7..fdc1504e 100644 --- a/data/minecraft/structure/bastion/hoglin_stable/starting_pieces/stairs_4_mirrored.nbt +++ b/data/minecraft/structure/bastion/hoglin_stable/starting_pieces/stairs_4_mirrored.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b909becc1851739ac5542a92b8c5b92cd5e315e6fd2be40c370ea52f5e49098c -size 4588 +oid sha256:6b350c661fcb9a9a8a6a54faea0f3533dd0d3afa3f2eb03a846f37d5dbdeb371 +size 4591 diff --git a/data/minecraft/structure/bastion/hoglin_stable/starting_pieces/starting_stairs_0.nbt b/data/minecraft/structure/bastion/hoglin_stable/starting_pieces/starting_stairs_0.nbt index 1c008107..7753ff4b 100644 --- a/data/minecraft/structure/bastion/hoglin_stable/starting_pieces/starting_stairs_0.nbt +++ b/data/minecraft/structure/bastion/hoglin_stable/starting_pieces/starting_stairs_0.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:37b5d7e3b4353214f407abbc64f0b65aed309012506d78f7440299e1bb811525 -size 4624 +oid sha256:2c83ae0a6a3eddb437d576946859dfcba5390b73bc17d6799410378d41e591a1 +size 4627 diff --git a/data/minecraft/structure/bastion/hoglin_stable/starting_pieces/starting_stairs_1.nbt b/data/minecraft/structure/bastion/hoglin_stable/starting_pieces/starting_stairs_1.nbt index d4b30e6a..9ea5810a 100644 --- a/data/minecraft/structure/bastion/hoglin_stable/starting_pieces/starting_stairs_1.nbt +++ b/data/minecraft/structure/bastion/hoglin_stable/starting_pieces/starting_stairs_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7f31549b820e31462f61b8a5c9127223fb74596ab8cf6ff1e66518c163c955ed -size 4908 +oid sha256:eb9ebcc43874cf61d15c44ac5e7c577b7e05ea818f3db5376b3c23f864ed4008 +size 4911 diff --git a/data/minecraft/structure/bastion/hoglin_stable/starting_pieces/starting_stairs_2.nbt b/data/minecraft/structure/bastion/hoglin_stable/starting_pieces/starting_stairs_2.nbt index f4274a70..cfdd292e 100644 --- a/data/minecraft/structure/bastion/hoglin_stable/starting_pieces/starting_stairs_2.nbt +++ b/data/minecraft/structure/bastion/hoglin_stable/starting_pieces/starting_stairs_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:629837246cd59f569dbb0b67d199f7638d5c7920f97e4ff849c6f5f8f0c8f0b3 -size 4907 +oid sha256:f9f8509fc0b9f17fbe0abaf31cf0b737db43ad00e896e9053fbcfc571d434b5e +size 4910 diff --git a/data/minecraft/structure/bastion/hoglin_stable/starting_pieces/starting_stairs_3.nbt b/data/minecraft/structure/bastion/hoglin_stable/starting_pieces/starting_stairs_3.nbt index 7624b379..1caa2620 100644 --- a/data/minecraft/structure/bastion/hoglin_stable/starting_pieces/starting_stairs_3.nbt +++ b/data/minecraft/structure/bastion/hoglin_stable/starting_pieces/starting_stairs_3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9f77df5b1a7057b68ffbd7c2921f263a49798cb6044fabf73bb4c851482d47a8 -size 4914 +oid sha256:d9dcf01aece7eea38ff2ee4dbbedc797359293e8f819c6b30aa93786bd96d863 +size 4917 diff --git a/data/minecraft/structure/bastion/hoglin_stable/starting_pieces/starting_stairs_4.nbt b/data/minecraft/structure/bastion/hoglin_stable/starting_pieces/starting_stairs_4.nbt index 08566e5a..47620fa4 100644 --- a/data/minecraft/structure/bastion/hoglin_stable/starting_pieces/starting_stairs_4.nbt +++ b/data/minecraft/structure/bastion/hoglin_stable/starting_pieces/starting_stairs_4.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:69c422109255d7eaf2f6d7ef87faa49baf6f25ba68f5d987935691759ef4fff1 -size 4583 +oid sha256:e6025cbb952cba9c338b33be4f5a4775b43cecbe1bb1a01adc43b7c985c70c00 +size 4585 diff --git a/data/minecraft/structure/bastion/hoglin_stable/walls/side_wall_0.nbt b/data/minecraft/structure/bastion/hoglin_stable/walls/side_wall_0.nbt index 90663b38..e2fa1995 100644 --- a/data/minecraft/structure/bastion/hoglin_stable/walls/side_wall_0.nbt +++ b/data/minecraft/structure/bastion/hoglin_stable/walls/side_wall_0.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8cdbafa370c994a5e9f32e693b3768021510efead055f1c08a260c2291ee264a -size 16615 +oid sha256:fe6f5d25d97aa90a9024bb30fbc4306bbc2e7f0bb13ef1a93fdbdd7cea069401 +size 16617 diff --git a/data/minecraft/structure/bastion/hoglin_stable/walls/side_wall_1.nbt b/data/minecraft/structure/bastion/hoglin_stable/walls/side_wall_1.nbt index 7b97c2f6..a1256722 100644 --- a/data/minecraft/structure/bastion/hoglin_stable/walls/side_wall_1.nbt +++ b/data/minecraft/structure/bastion/hoglin_stable/walls/side_wall_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c04ab612f943bbbe4e26f640ebffb3428e62e8f98aec0f9f7de17de25ef765a1 -size 17024 +oid sha256:c8bd47bfa730f384bfb2a7dd14f3b86bc9d50bed6c5db47c71a2eb9ef609ca29 +size 17027 diff --git a/data/minecraft/structure/bastion/hoglin_stable/walls/wall_base.nbt b/data/minecraft/structure/bastion/hoglin_stable/walls/wall_base.nbt index 1cc4838d..35a52afb 100644 --- a/data/minecraft/structure/bastion/hoglin_stable/walls/wall_base.nbt +++ b/data/minecraft/structure/bastion/hoglin_stable/walls/wall_base.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c7a0cfaed6f66bd1fa328c5ee3d1717a06850f2fe20aa6afe7c56e34ccc18866 -size 16412 +oid sha256:72a1289e00fd2c63b51154670ec1e9cc5ce2c75a980bb17e310ebad6edb995c0 +size 16415 diff --git a/data/minecraft/structure/bastion/mobs/crossbow_piglin.nbt b/data/minecraft/structure/bastion/mobs/crossbow_piglin.nbt index cbf5842f..d941ca9d 100644 --- a/data/minecraft/structure/bastion/mobs/crossbow_piglin.nbt +++ b/data/minecraft/structure/bastion/mobs/crossbow_piglin.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:dcf377d3af45ca6ab93828b6f5ea0ad3009dcdfa1336b499c955f22c881a32c9 -size 694 +oid sha256:59e310a91611d63e7d413a54dccacf4ebf3469da57283537cd801ab2e3c6138a +size 695 diff --git a/data/minecraft/structure/bastion/mobs/empty.nbt b/data/minecraft/structure/bastion/mobs/empty.nbt index d6f05692..3d055807 100644 --- a/data/minecraft/structure/bastion/mobs/empty.nbt +++ b/data/minecraft/structure/bastion/mobs/empty.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:28a4bbd9dacf8d69162fa4c26b7afd8adbfb0b6ac134ca2cac01c44022bf6499 -size 226 +oid sha256:a1ac46d90d13a3b39f34ab8629e40844a496775a44bde7d02006cca777117fb2 +size 229 diff --git a/data/minecraft/structure/bastion/mobs/hoglin.nbt b/data/minecraft/structure/bastion/mobs/hoglin.nbt index 29a67be5..8c8307ae 100644 --- a/data/minecraft/structure/bastion/mobs/hoglin.nbt +++ b/data/minecraft/structure/bastion/mobs/hoglin.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b58921025ec3c28b25fa8da6d002941565e17de3e2ca868825507b22f966ef09 -size 737 +oid sha256:7207a3e993e5d06c625bc5dc9cea94a92db0680c3529eec5d0243ceba551584a +size 738 diff --git a/data/minecraft/structure/bastion/mobs/melee_piglin.nbt b/data/minecraft/structure/bastion/mobs/melee_piglin.nbt index 2e91120e..1aabba1c 100644 --- a/data/minecraft/structure/bastion/mobs/melee_piglin.nbt +++ b/data/minecraft/structure/bastion/mobs/melee_piglin.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e4d29344b91b4b9c0f2eb4e16d4b52753a16701acd5371cd70d51f75a4a932ad -size 681 +oid sha256:b868f0965813d904a90bf199053b9d5d4dda83a423efa23fad1b7ab331f76a57 +size 682 diff --git a/data/minecraft/structure/bastion/mobs/melee_piglin_always.nbt b/data/minecraft/structure/bastion/mobs/melee_piglin_always.nbt index 48b24848..430b3b3a 100644 --- a/data/minecraft/structure/bastion/mobs/melee_piglin_always.nbt +++ b/data/minecraft/structure/bastion/mobs/melee_piglin_always.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f5907374e855606737e7951b9d787ab3f27ef2b794f6ef78f7ff135e0799fd92 +oid sha256:5d7fcb9686b8fd0d9a13749d29acaed288535ae41518ea0c71b95ea372b75760 size 674 diff --git a/data/minecraft/structure/bastion/mobs/sword_piglin.nbt b/data/minecraft/structure/bastion/mobs/sword_piglin.nbt index 02150395..60ed4711 100644 --- a/data/minecraft/structure/bastion/mobs/sword_piglin.nbt +++ b/data/minecraft/structure/bastion/mobs/sword_piglin.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4a1b91ff8501ccfb5898c87055000a946096b31023882131410294077cf98f5f +oid sha256:269f93517cf1907b1ba8e7cd4b3182ef9125658538feeabcaf451d5490746d04 size 701 diff --git a/data/minecraft/structure/bastion/treasure/bases/centers/center_0.nbt b/data/minecraft/structure/bastion/treasure/bases/centers/center_0.nbt index aa61532f..623fbd3b 100644 --- a/data/minecraft/structure/bastion/treasure/bases/centers/center_0.nbt +++ b/data/minecraft/structure/bastion/treasure/bases/centers/center_0.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:cc0f458ebf8ee8d55f6fd89203015743a4b1fced53bc425c94a8ffa556dabeba -size 1022 +oid sha256:572919fe5e0a5844c30c01729e228acc443b72b4e5091caf22f0e2f3a128a21f +size 1025 diff --git a/data/minecraft/structure/bastion/treasure/bases/centers/center_1.nbt b/data/minecraft/structure/bastion/treasure/bases/centers/center_1.nbt index 77a9a041..7eb27ab7 100644 --- a/data/minecraft/structure/bastion/treasure/bases/centers/center_1.nbt +++ b/data/minecraft/structure/bastion/treasure/bases/centers/center_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:55000d2a132f5d05acb4cfb9dea235ed4644b44d104632e637c89c9b5524bd61 -size 957 +oid sha256:b3cea215e23b27664c5339412ccee6a75bfe390c541c546d1f6541df04646f05 +size 960 diff --git a/data/minecraft/structure/bastion/treasure/bases/centers/center_2.nbt b/data/minecraft/structure/bastion/treasure/bases/centers/center_2.nbt index 6f60f055..a0f7f186 100644 --- a/data/minecraft/structure/bastion/treasure/bases/centers/center_2.nbt +++ b/data/minecraft/structure/bastion/treasure/bases/centers/center_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:11815d9fd8680ac34895d006ff1b1c93b0f228e9bf859f6d5f987ff5b59e7537 -size 1073 +oid sha256:245ce7b574f5ed5191c8a76c35584872c28ac404d43861074bbff4c4413d5af8 +size 1076 diff --git a/data/minecraft/structure/bastion/treasure/bases/centers/center_3.nbt b/data/minecraft/structure/bastion/treasure/bases/centers/center_3.nbt index 09224086..6db4fb1f 100644 --- a/data/minecraft/structure/bastion/treasure/bases/centers/center_3.nbt +++ b/data/minecraft/structure/bastion/treasure/bases/centers/center_3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:20aaa0ab92fba75ea31116d3e2a5047b097221dff99a64742442d1e91d634d27 -size 734 +oid sha256:628d578e18b03f16dbf1e693b38708fac7fd21a730f43921ae2d56c730ca453c +size 736 diff --git a/data/minecraft/structure/bastion/treasure/bases/lava_basin.nbt b/data/minecraft/structure/bastion/treasure/bases/lava_basin.nbt index e1755128..5afcd1a0 100644 --- a/data/minecraft/structure/bastion/treasure/bases/lava_basin.nbt +++ b/data/minecraft/structure/bastion/treasure/bases/lava_basin.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3cb1c8cf7f32c62609c4c55b1f20c7d1fffafd557385370bec5b12fe5d98d95b -size 6582 +oid sha256:25aeda0fd17e6b9432165ee82be9451b328de877c56aa38971ff4461bd96c918 +size 6585 diff --git a/data/minecraft/structure/bastion/treasure/big_air_full.nbt b/data/minecraft/structure/bastion/treasure/big_air_full.nbt index b99da862..c873cb7f 100644 --- a/data/minecraft/structure/bastion/treasure/big_air_full.nbt +++ b/data/minecraft/structure/bastion/treasure/big_air_full.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:764c03b7eea7d49de541e1fcb66b21388d5a57ce7fea1c83f805603c7944965c -size 69672 +oid sha256:7dafc0538777311bf7eb427ef9660761db49ebea4647c81ce230626e5dde94f1 +size 69674 diff --git a/data/minecraft/structure/bastion/treasure/brains/center_brain.nbt b/data/minecraft/structure/bastion/treasure/brains/center_brain.nbt index 137b22d3..1d2cda8d 100644 --- a/data/minecraft/structure/bastion/treasure/brains/center_brain.nbt +++ b/data/minecraft/structure/bastion/treasure/brains/center_brain.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:92ebe907f4cc5249f618e0065637100fae7d29b7949db15d30eee0cb55839f1d -size 414 +oid sha256:e9abf8bca57c21cbfb53b871f98717c9d40c82989997afe94c679a0866b22f62 +size 416 diff --git a/data/minecraft/structure/bastion/treasure/connectors/center_to_wall_middle.nbt b/data/minecraft/structure/bastion/treasure/connectors/center_to_wall_middle.nbt index cfea4dbf..57228754 100644 --- a/data/minecraft/structure/bastion/treasure/connectors/center_to_wall_middle.nbt +++ b/data/minecraft/structure/bastion/treasure/connectors/center_to_wall_middle.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c41d11e15bccc002800f8aa475f46a413c63ed3938c9ac1a898dc1681c91ff75 -size 285 +oid sha256:b33363830a30ba03eb9881d96fc221b947a4f609feeceee3e5ad685df3a2ddcb +size 288 diff --git a/data/minecraft/structure/bastion/treasure/connectors/center_to_wall_top.nbt b/data/minecraft/structure/bastion/treasure/connectors/center_to_wall_top.nbt index 23022e74..bd5316a3 100644 --- a/data/minecraft/structure/bastion/treasure/connectors/center_to_wall_top.nbt +++ b/data/minecraft/structure/bastion/treasure/connectors/center_to_wall_top.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ce941a2c6275206b4c16a8c30f2d5e9f1edccf38652ba135a29daa4ddfce1f82 -size 285 +oid sha256:e3a7b53d8a76805cf27d6d261fd3964527c646fc532dd60971c558e1309f158c +size 287 diff --git a/data/minecraft/structure/bastion/treasure/connectors/center_to_wall_top_entrance.nbt b/data/minecraft/structure/bastion/treasure/connectors/center_to_wall_top_entrance.nbt index 12c0f935..6f00a1c4 100644 --- a/data/minecraft/structure/bastion/treasure/connectors/center_to_wall_top_entrance.nbt +++ b/data/minecraft/structure/bastion/treasure/connectors/center_to_wall_top_entrance.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:39374c9da967f5e84abbc681a693f3c28c94b86216189b940022cab3e21b2c3e -size 289 +oid sha256:68734164025f609e28e081df84b7b32ccda828ff0bcbdb3d1a662838c553e501 +size 292 diff --git a/data/minecraft/structure/bastion/treasure/corners/bottom/corner_0.nbt b/data/minecraft/structure/bastion/treasure/corners/bottom/corner_0.nbt index b5143722..3467b1fd 100644 --- a/data/minecraft/structure/bastion/treasure/corners/bottom/corner_0.nbt +++ b/data/minecraft/structure/bastion/treasure/corners/bottom/corner_0.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1afd34d69dc2fd7b0cc31cd1b28845b156007fd3badbf1f8ea5706bd66f87f20 -size 1682 +oid sha256:ca6bd98db274f9c3ed83bb391eaab03bbf1f5fc6f4e4a61d5e170fd5672448bb +size 1685 diff --git a/data/minecraft/structure/bastion/treasure/corners/bottom/corner_1.nbt b/data/minecraft/structure/bastion/treasure/corners/bottom/corner_1.nbt index 63524214..731029c3 100644 --- a/data/minecraft/structure/bastion/treasure/corners/bottom/corner_1.nbt +++ b/data/minecraft/structure/bastion/treasure/corners/bottom/corner_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9fd1faf80335ea7a4fd70a35010f943e268d24a2896aa00d3f02dd86adcdd02f -size 1679 +oid sha256:9690a1c0b68cdc27efd081f57576d07faad1995d5c4bfdf06dc7eb774794930f +size 1680 diff --git a/data/minecraft/structure/bastion/treasure/corners/edges/bottom.nbt b/data/minecraft/structure/bastion/treasure/corners/edges/bottom.nbt index c66232b0..010cc20b 100644 --- a/data/minecraft/structure/bastion/treasure/corners/edges/bottom.nbt +++ b/data/minecraft/structure/bastion/treasure/corners/edges/bottom.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:de24cff5f3823fce2f5281d7fd62f33804974bf955275a6a886b9c62e6aac4a0 -size 448 +oid sha256:962ed6b2628fb4df254f8de780157a9ab803bb5b9098d8cf663c5fc9245e77bf +size 451 diff --git a/data/minecraft/structure/bastion/treasure/corners/edges/middle.nbt b/data/minecraft/structure/bastion/treasure/corners/edges/middle.nbt index 361b7733..436458f8 100644 --- a/data/minecraft/structure/bastion/treasure/corners/edges/middle.nbt +++ b/data/minecraft/structure/bastion/treasure/corners/edges/middle.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:81813f7e9278cde7055e369ae38ad69f3fc506380d4cfdc99562848802677f63 -size 438 +oid sha256:ec951a995851e20f8182ff620c3e2c56d79b1b73ddc2d0c5a41e7702885836d1 +size 440 diff --git a/data/minecraft/structure/bastion/treasure/corners/edges/top.nbt b/data/minecraft/structure/bastion/treasure/corners/edges/top.nbt index f6dc2936..4dc3fcfd 100644 --- a/data/minecraft/structure/bastion/treasure/corners/edges/top.nbt +++ b/data/minecraft/structure/bastion/treasure/corners/edges/top.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ae50772d621ca910d35e4dcee5372dcf9df29e059faeb0c2be9fa6da73973f59 -size 455 +oid sha256:cbd65ef6b698a5093e31ae695758d2eb685a023b896dd657c286f0d0a584e490 +size 457 diff --git a/data/minecraft/structure/bastion/treasure/corners/middle/corner_0.nbt b/data/minecraft/structure/bastion/treasure/corners/middle/corner_0.nbt index 13b7f92c..63a3a15b 100644 --- a/data/minecraft/structure/bastion/treasure/corners/middle/corner_0.nbt +++ b/data/minecraft/structure/bastion/treasure/corners/middle/corner_0.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9735e7b323540085d2cf36bd1467dabd1652a462dcd4b620736c5d8a63c9b08e -size 1583 +oid sha256:3c63ac591d6bbdbea51f75179ac92b2945099d28ed08abc83382c2bbad6bebd4 +size 1586 diff --git a/data/minecraft/structure/bastion/treasure/corners/middle/corner_1.nbt b/data/minecraft/structure/bastion/treasure/corners/middle/corner_1.nbt index e1ad269b..40cb75d0 100644 --- a/data/minecraft/structure/bastion/treasure/corners/middle/corner_1.nbt +++ b/data/minecraft/structure/bastion/treasure/corners/middle/corner_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:820de9e199568f90d78bec260501f33ee93f468aa4c4715c9fc38299aea864b7 -size 1537 +oid sha256:c243ef2e525c2b8e4111c3615c8b2f82e02b348b77c8ccc60a62407788aa616d +size 1539 diff --git a/data/minecraft/structure/bastion/treasure/corners/top/corner_0.nbt b/data/minecraft/structure/bastion/treasure/corners/top/corner_0.nbt index 2a566844..ad3c248d 100644 --- a/data/minecraft/structure/bastion/treasure/corners/top/corner_0.nbt +++ b/data/minecraft/structure/bastion/treasure/corners/top/corner_0.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e57458ae97aceb33af25bb33987497c522eed65c106ead740f1295ad517dfdb0 -size 1551 +oid sha256:ea14ff4c67e866e8ff9da3923232aaad6d9162b5d85df6f8d2d2bd01cd3a4784 +size 1553 diff --git a/data/minecraft/structure/bastion/treasure/corners/top/corner_1.nbt b/data/minecraft/structure/bastion/treasure/corners/top/corner_1.nbt index dbff5cac..8e256278 100644 --- a/data/minecraft/structure/bastion/treasure/corners/top/corner_1.nbt +++ b/data/minecraft/structure/bastion/treasure/corners/top/corner_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:50744cfb466d2720f52cda1419307db8c4c01396f191c6c63bd8500423c53aad -size 1571 +oid sha256:6218c9a73b238aeca40c2923fce95ea457ca08848477c0c910f76924c12bc103 +size 1573 diff --git a/data/minecraft/structure/bastion/treasure/entrances/entrance_0.nbt b/data/minecraft/structure/bastion/treasure/entrances/entrance_0.nbt index bea5ee8c..321ed943 100644 --- a/data/minecraft/structure/bastion/treasure/entrances/entrance_0.nbt +++ b/data/minecraft/structure/bastion/treasure/entrances/entrance_0.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5a70794ce3a33c558227abcb5c8ff8d3b8e04c40cc4ce6baecc948e1a05c8ce3 -size 11195 +oid sha256:26e06e99dd87f881ec3ac7004d755358821d47107b55331d956d004923992d12 +size 11197 diff --git a/data/minecraft/structure/bastion/treasure/extensions/empty.nbt b/data/minecraft/structure/bastion/treasure/extensions/empty.nbt index 40ccf6da..ad005599 100644 --- a/data/minecraft/structure/bastion/treasure/extensions/empty.nbt +++ b/data/minecraft/structure/bastion/treasure/extensions/empty.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c0eee62109c85124f69fb0e8efb4baaf7b30b2fc166da1c2cc7c2a61a8456f4e -size 230 +oid sha256:af02479287b00608e23524e9b3ba5898cbde71a5eaf0da0a7864fe1a274f8b72 +size 233 diff --git a/data/minecraft/structure/bastion/treasure/extensions/fire_room.nbt b/data/minecraft/structure/bastion/treasure/extensions/fire_room.nbt index 22274312..bd3fda8c 100644 --- a/data/minecraft/structure/bastion/treasure/extensions/fire_room.nbt +++ b/data/minecraft/structure/bastion/treasure/extensions/fire_room.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:91a5aa1cde11f2eaff46838eb432bb943b99e8476ab808474868a2345c7569eb -size 1864 +oid sha256:d497659a9a4d02b4b23afffbb349f31e7ced7f0d557871462e28e140f97288d2 +size 1867 diff --git a/data/minecraft/structure/bastion/treasure/extensions/house_0.nbt b/data/minecraft/structure/bastion/treasure/extensions/house_0.nbt index 0db34e65..4bf9d089 100644 --- a/data/minecraft/structure/bastion/treasure/extensions/house_0.nbt +++ b/data/minecraft/structure/bastion/treasure/extensions/house_0.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6ec939c9d7b145f50d2ecd86ccf0e85d47eb4c8fa4144311f3380fb10dff52f6 -size 2075 +oid sha256:1889bae944963ccc69c2f07d2db5601a0e9e173c745963f31085819ebe898b12 +size 2078 diff --git a/data/minecraft/structure/bastion/treasure/extensions/house_1.nbt b/data/minecraft/structure/bastion/treasure/extensions/house_1.nbt index 7c479915..7be8f8ef 100644 --- a/data/minecraft/structure/bastion/treasure/extensions/house_1.nbt +++ b/data/minecraft/structure/bastion/treasure/extensions/house_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d47006195be7f852b0083a4ba6ca926663ab8c3b4cf13a8ea7ad6e5357cec541 -size 2157 +oid sha256:dde687ec4291d15630ff93d38863e7fc9f96e21deadb4ac2610f3c527f60a2ec +size 2160 diff --git a/data/minecraft/structure/bastion/treasure/extensions/large_bridge_0.nbt b/data/minecraft/structure/bastion/treasure/extensions/large_bridge_0.nbt index 430397ed..67e6d711 100644 --- a/data/minecraft/structure/bastion/treasure/extensions/large_bridge_0.nbt +++ b/data/minecraft/structure/bastion/treasure/extensions/large_bridge_0.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6212c7b10218cf493a48f14d394392d1301cb459dbb6d956ea4a1932fef315f9 -size 452 +oid sha256:8d2c1255eb07e94f9759587d3230e9ce133dc1ee79060e1f90bd154e426ba5b9 +size 455 diff --git a/data/minecraft/structure/bastion/treasure/extensions/large_bridge_1.nbt b/data/minecraft/structure/bastion/treasure/extensions/large_bridge_1.nbt index ed27da6d..8f771436 100644 --- a/data/minecraft/structure/bastion/treasure/extensions/large_bridge_1.nbt +++ b/data/minecraft/structure/bastion/treasure/extensions/large_bridge_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5ba789bc064452c799ee1018752f00123bd96561ea68e3b87ed098e6feb0b493 -size 416 +oid sha256:2f25e301cb70eab5f2af5b552d1efe3b0db36ce34a49717e31a73f7e6cd7bbc3 +size 418 diff --git a/data/minecraft/structure/bastion/treasure/extensions/large_bridge_2.nbt b/data/minecraft/structure/bastion/treasure/extensions/large_bridge_2.nbt index 90ed7980..d56936d1 100644 --- a/data/minecraft/structure/bastion/treasure/extensions/large_bridge_2.nbt +++ b/data/minecraft/structure/bastion/treasure/extensions/large_bridge_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f24bc3f8c4cde18b524e7fba85fe775ba84cb9dbf528514aa7cacad0bf63b7af -size 536 +oid sha256:20f79344e6f73165aea7edb45d1b0a7a6d36d47774cd41632081b55e8e0014fd +size 539 diff --git a/data/minecraft/structure/bastion/treasure/extensions/large_bridge_3.nbt b/data/minecraft/structure/bastion/treasure/extensions/large_bridge_3.nbt index f9b4d95b..7eb09dff 100644 --- a/data/minecraft/structure/bastion/treasure/extensions/large_bridge_3.nbt +++ b/data/minecraft/structure/bastion/treasure/extensions/large_bridge_3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:cc471747da7da8e48d29d7041ced2d225cce13a78cdbc73cac3c8486629f4151 -size 613 +oid sha256:94a2f1457426794af2c40e14e9fb2c773bc23035f6f41f851d0d4a8527727e8f +size 616 diff --git a/data/minecraft/structure/bastion/treasure/extensions/roofed_bridge.nbt b/data/minecraft/structure/bastion/treasure/extensions/roofed_bridge.nbt index 4bf3ded3..03719e0b 100644 --- a/data/minecraft/structure/bastion/treasure/extensions/roofed_bridge.nbt +++ b/data/minecraft/structure/bastion/treasure/extensions/roofed_bridge.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9a9c43ca856e672d35cb919f39c06b795c852493c70dd62c0fdada57e2ef9b07 -size 640 +oid sha256:514d067c7b03d70e985e3885fe089d59e0ebc53fed92bd55db79478c79cceaaa +size 642 diff --git a/data/minecraft/structure/bastion/treasure/extensions/small_bridge_0.nbt b/data/minecraft/structure/bastion/treasure/extensions/small_bridge_0.nbt index e65a1060..e607f1ea 100644 --- a/data/minecraft/structure/bastion/treasure/extensions/small_bridge_0.nbt +++ b/data/minecraft/structure/bastion/treasure/extensions/small_bridge_0.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:75a1948e268112adb89501bd555f7889f417c3abde7a3c81619123ee3bf3ed5f -size 318 +oid sha256:024d32fccdffdef6650ed3df422ce6ee85746e9d49431c27e91a6a7972ec7fdb +size 320 diff --git a/data/minecraft/structure/bastion/treasure/extensions/small_bridge_1.nbt b/data/minecraft/structure/bastion/treasure/extensions/small_bridge_1.nbt index 267bee1e..69932928 100644 --- a/data/minecraft/structure/bastion/treasure/extensions/small_bridge_1.nbt +++ b/data/minecraft/structure/bastion/treasure/extensions/small_bridge_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:839a7bf4559bd3ede1a57cb1fe11b57c84a591b6cf4c584573be3d527387ede4 -size 388 +oid sha256:bbc6739794eb240c53220e7cb694ed603f619a5512d45a22174d682ac99ab988 +size 390 diff --git a/data/minecraft/structure/bastion/treasure/extensions/small_bridge_2.nbt b/data/minecraft/structure/bastion/treasure/extensions/small_bridge_2.nbt index a9759fe3..ae432625 100644 --- a/data/minecraft/structure/bastion/treasure/extensions/small_bridge_2.nbt +++ b/data/minecraft/structure/bastion/treasure/extensions/small_bridge_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c1c1f5f371a4b8a0a2a7a7ad16e0502b097fb4bfe033f910c25d6489ed17d835 -size 347 +oid sha256:8f75876cdb14d342e8d743e9036fdb9c5fc46eec52c2961867e56b56f5b10dcf +size 349 diff --git a/data/minecraft/structure/bastion/treasure/extensions/small_bridge_3.nbt b/data/minecraft/structure/bastion/treasure/extensions/small_bridge_3.nbt index 9d070d24..1980a4fe 100644 --- a/data/minecraft/structure/bastion/treasure/extensions/small_bridge_3.nbt +++ b/data/minecraft/structure/bastion/treasure/extensions/small_bridge_3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ba7e0f7446861edd73e4c20fad84e7a454029e75962771679a18a05b2433751a -size 478 +oid sha256:d10d301f5bcb6cbbd79ee90fe591fe97c7b1ac087c38e210a5de1fb46bc545ff +size 480 diff --git a/data/minecraft/structure/bastion/treasure/ramparts/bottom_wall_0.nbt b/data/minecraft/structure/bastion/treasure/ramparts/bottom_wall_0.nbt index 95ac780f..89b97072 100644 --- a/data/minecraft/structure/bastion/treasure/ramparts/bottom_wall_0.nbt +++ b/data/minecraft/structure/bastion/treasure/ramparts/bottom_wall_0.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b21b8de47ccae7d0f050b4c2268471a8dc94396ca06843992a1ed8539d9eac81 -size 11778 +oid sha256:295a3c08a645a1c4a6d267b65166c8a67566ef340b0b0d4522d9d466b3bf0041 +size 11780 diff --git a/data/minecraft/structure/bastion/treasure/ramparts/lava_basin_main.nbt b/data/minecraft/structure/bastion/treasure/ramparts/lava_basin_main.nbt index e738ad1f..0b2a9456 100644 --- a/data/minecraft/structure/bastion/treasure/ramparts/lava_basin_main.nbt +++ b/data/minecraft/structure/bastion/treasure/ramparts/lava_basin_main.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:017e19f4d775e035fd5f3658a0bd29dbdfc71f15aa0540dd7d235ef92c2e28de -size 24167 +oid sha256:3774d1d4037858e5a8c88a610d2ab35c2a4b88083547f6218ce6ace0b1e0559c +size 24170 diff --git a/data/minecraft/structure/bastion/treasure/ramparts/lava_basin_side.nbt b/data/minecraft/structure/bastion/treasure/ramparts/lava_basin_side.nbt index 8037f77f..b6529b48 100644 --- a/data/minecraft/structure/bastion/treasure/ramparts/lava_basin_side.nbt +++ b/data/minecraft/structure/bastion/treasure/ramparts/lava_basin_side.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:00b123187c367eaa18ba4eb3c4ba7621f783f041eac7320c24984c2f619c7329 -size 23966 +oid sha256:2d1ead462ef615a9cc62db1a112fc5371880e80fac74d0a145356ef90e1621ad +size 23969 diff --git a/data/minecraft/structure/bastion/treasure/ramparts/mid_wall_main.nbt b/data/minecraft/structure/bastion/treasure/ramparts/mid_wall_main.nbt index 049a2571..1a0fb518 100644 --- a/data/minecraft/structure/bastion/treasure/ramparts/mid_wall_main.nbt +++ b/data/minecraft/structure/bastion/treasure/ramparts/mid_wall_main.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:de4b107b72a29da37aa8514784d0eeef081179fb3564524b38545ae0694d62ba -size 18996 +oid sha256:078d8777bdbe96f1702b4af150fd94a28a8b6e9c04075255e998e9e10523969c +size 18999 diff --git a/data/minecraft/structure/bastion/treasure/ramparts/mid_wall_side.nbt b/data/minecraft/structure/bastion/treasure/ramparts/mid_wall_side.nbt index a54f0952..34d2beaf 100644 --- a/data/minecraft/structure/bastion/treasure/ramparts/mid_wall_side.nbt +++ b/data/minecraft/structure/bastion/treasure/ramparts/mid_wall_side.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b1b25fd8a8920caa87a1de35faa611007b089843279625e8d92200672762609c -size 18144 +oid sha256:566a5a46c4e33219d1fc7d0ad2f7a94fc835bc4a78809196b8a9441434ae8959 +size 18147 diff --git a/data/minecraft/structure/bastion/treasure/ramparts/top_wall.nbt b/data/minecraft/structure/bastion/treasure/ramparts/top_wall.nbt index 3c93d1f7..5fc931bc 100644 --- a/data/minecraft/structure/bastion/treasure/ramparts/top_wall.nbt +++ b/data/minecraft/structure/bastion/treasure/ramparts/top_wall.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9461ad6935e482fed62c1abe677a82200861eabebb07872df676d94f707d07f8 -size 9858 +oid sha256:b079025959deec452180f74b0695bd4bb52a48250da6c1d037169fd1ca77f79b +size 9861 diff --git a/data/minecraft/structure/bastion/treasure/roofs/center_roof.nbt b/data/minecraft/structure/bastion/treasure/roofs/center_roof.nbt index c7d0a732..5a585a86 100644 --- a/data/minecraft/structure/bastion/treasure/roofs/center_roof.nbt +++ b/data/minecraft/structure/bastion/treasure/roofs/center_roof.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5144762cb24b42be41ac06153f061d1c546b53088b2d9650551cbc4735a053b1 -size 3446 +oid sha256:b11473629a7bb4decf429dbea4ddb9810f916932b64cff41e8a8203e4fa0e93b +size 3448 diff --git a/data/minecraft/structure/bastion/treasure/roofs/corner_roof.nbt b/data/minecraft/structure/bastion/treasure/roofs/corner_roof.nbt index 31fdc269..68c50de5 100644 --- a/data/minecraft/structure/bastion/treasure/roofs/corner_roof.nbt +++ b/data/minecraft/structure/bastion/treasure/roofs/corner_roof.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:20d66fd113a802c338c030785e5b3570f77f4b979709eb6898c1bdaf6fb28c75 -size 423 +oid sha256:e95aa2d1f78ecace9005014d17ab336a359b6adbbe1576053e0de519b3e0bcfc +size 425 diff --git a/data/minecraft/structure/bastion/treasure/roofs/wall_roof.nbt b/data/minecraft/structure/bastion/treasure/roofs/wall_roof.nbt index 1fd2a8ea..f7e13444 100644 --- a/data/minecraft/structure/bastion/treasure/roofs/wall_roof.nbt +++ b/data/minecraft/structure/bastion/treasure/roofs/wall_roof.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f108dbd8ce287ea58079b872c2c9cf518acf1fec9a18ea9ac0fca2f625513602 +oid sha256:55e9745a31ebebd5dc4e260488c8b180698683c570a2fff1dc9e900128446249 size 990 diff --git a/data/minecraft/structure/bastion/treasure/stairs/lower_stairs.nbt b/data/minecraft/structure/bastion/treasure/stairs/lower_stairs.nbt index b25fe088..dd0686c5 100644 --- a/data/minecraft/structure/bastion/treasure/stairs/lower_stairs.nbt +++ b/data/minecraft/structure/bastion/treasure/stairs/lower_stairs.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:12a22329f893482ddcba4607c388ed508d96e6b6fc3e5913e3e364a0e822f6f2 -size 445 +oid sha256:d44fe057c935dfeb54d679920f5e8047ef1e50fd80f53d4d2d1322bfccd46415 +size 447 diff --git a/data/minecraft/structure/bastion/treasure/walls/bottom/wall_0.nbt b/data/minecraft/structure/bastion/treasure/walls/bottom/wall_0.nbt index ab67f351..cce4cf5b 100644 --- a/data/minecraft/structure/bastion/treasure/walls/bottom/wall_0.nbt +++ b/data/minecraft/structure/bastion/treasure/walls/bottom/wall_0.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c18d085667d46fea5c95106d9d2a5f12f151d84070bc46f11e22858b65254b55 -size 6610 +oid sha256:3c64bc5aac601d929e9a8b18a3ce16c68383e3b594d729b4675b741e7145de1b +size 6613 diff --git a/data/minecraft/structure/bastion/treasure/walls/bottom/wall_1.nbt b/data/minecraft/structure/bastion/treasure/walls/bottom/wall_1.nbt index c1181882..fe4f6f50 100644 --- a/data/minecraft/structure/bastion/treasure/walls/bottom/wall_1.nbt +++ b/data/minecraft/structure/bastion/treasure/walls/bottom/wall_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d55b14f10edde3edd18dbbaf298581069e9508f407c23a2ea437d8a666218077 -size 6497 +oid sha256:6bf2a9e539e077a0a9dcac379775c9f5f9ce139643b7ee185d4ace5f0750e621 +size 6500 diff --git a/data/minecraft/structure/bastion/treasure/walls/bottom/wall_2.nbt b/data/minecraft/structure/bastion/treasure/walls/bottom/wall_2.nbt index 4779d756..fb13da2a 100644 --- a/data/minecraft/structure/bastion/treasure/walls/bottom/wall_2.nbt +++ b/data/minecraft/structure/bastion/treasure/walls/bottom/wall_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:31a733019eebb05054bc0d401236fb0efccd274ba7e81c2551dec0c908891f1a -size 6440 +oid sha256:fd1b9401b55dafd2c15b607359020ca805084583b7e4eff4f9739080ccc88d2a +size 6443 diff --git a/data/minecraft/structure/bastion/treasure/walls/bottom/wall_3.nbt b/data/minecraft/structure/bastion/treasure/walls/bottom/wall_3.nbt index c9338980..7a952500 100644 --- a/data/minecraft/structure/bastion/treasure/walls/bottom/wall_3.nbt +++ b/data/minecraft/structure/bastion/treasure/walls/bottom/wall_3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3073930a517dd50182913277818fc19e631749c56946d65f3c221fc36db20820 -size 6488 +oid sha256:4e02c7e1f0b2dc5dab1a715ebba2c432425fc5e4a3c355ce96acb3d9cc33b32b +size 6491 diff --git a/data/minecraft/structure/bastion/treasure/walls/entrance_wall.nbt b/data/minecraft/structure/bastion/treasure/walls/entrance_wall.nbt index 52eb3688..f56b468a 100644 --- a/data/minecraft/structure/bastion/treasure/walls/entrance_wall.nbt +++ b/data/minecraft/structure/bastion/treasure/walls/entrance_wall.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0e664ac995fe845c96c5bd3e4c22ebbc510be214f45cebb0c0884f1fd539f45e -size 2676 +oid sha256:37c36a65b8bf9d9a709df73ba46fd0d570464f65cc25dc3daaa103ade2027175 +size 2679 diff --git a/data/minecraft/structure/bastion/treasure/walls/lava_wall.nbt b/data/minecraft/structure/bastion/treasure/walls/lava_wall.nbt index 06772982..c2a34f5c 100644 --- a/data/minecraft/structure/bastion/treasure/walls/lava_wall.nbt +++ b/data/minecraft/structure/bastion/treasure/walls/lava_wall.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4e81df88d87e9b94f37b875db676eece9883a65cb0234a25231ab4eef3a0bd81 +oid sha256:69a860e4a1b29541959c449391485b3d04ee5c8dfee4073be7e4c9d51794bd80 size 2797 diff --git a/data/minecraft/structure/bastion/treasure/walls/mid/wall_0.nbt b/data/minecraft/structure/bastion/treasure/walls/mid/wall_0.nbt index bb660d60..12875960 100644 --- a/data/minecraft/structure/bastion/treasure/walls/mid/wall_0.nbt +++ b/data/minecraft/structure/bastion/treasure/walls/mid/wall_0.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c383d1c1e20cc2eb49968494ca388b701af3f08cac0a95886640a565b20a633d -size 6294 +oid sha256:850664d56ff311dca04374125a789dcb40bb8af065f571d3cead3f53b21cafff +size 6297 diff --git a/data/minecraft/structure/bastion/treasure/walls/mid/wall_1.nbt b/data/minecraft/structure/bastion/treasure/walls/mid/wall_1.nbt index 2486138b..7921a752 100644 --- a/data/minecraft/structure/bastion/treasure/walls/mid/wall_1.nbt +++ b/data/minecraft/structure/bastion/treasure/walls/mid/wall_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:07339e3ed9d519a52f0ded08dffc5895ef1fa299723d1db51b97f290abef4b2e -size 6150 +oid sha256:0ec4533d9866699b57efd69ae0a2541110092d814a4490c23109784f4192166e +size 6153 diff --git a/data/minecraft/structure/bastion/treasure/walls/mid/wall_2.nbt b/data/minecraft/structure/bastion/treasure/walls/mid/wall_2.nbt index 8f227dd8..a675d30d 100644 --- a/data/minecraft/structure/bastion/treasure/walls/mid/wall_2.nbt +++ b/data/minecraft/structure/bastion/treasure/walls/mid/wall_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0ddc7ec187ccb4f6ce4abd92455ce1c5b46a60a08eb594c6d8d9a4d4a9e908d7 -size 6172 +oid sha256:3a039ae72b7b7879c688e58b592fdeabc2a5db6e14b2f032a49bee0a9a06e15b +size 6175 diff --git a/data/minecraft/structure/bastion/treasure/walls/outer/bottom_corner.nbt b/data/minecraft/structure/bastion/treasure/walls/outer/bottom_corner.nbt index fc26e4ad..01a6ad49 100644 --- a/data/minecraft/structure/bastion/treasure/walls/outer/bottom_corner.nbt +++ b/data/minecraft/structure/bastion/treasure/walls/outer/bottom_corner.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8e7cd14256fb725b2e750a60e089de59f3967c033df43cf4f64934b3deed593b -size 779 +oid sha256:94f3e6d212cb8829448c3d3917c988a29ee3be01230dce207c34e08b0c8e321e +size 782 diff --git a/data/minecraft/structure/bastion/treasure/walls/outer/medium_outer_wall.nbt b/data/minecraft/structure/bastion/treasure/walls/outer/medium_outer_wall.nbt index fac86a2d..06d57b6d 100644 --- a/data/minecraft/structure/bastion/treasure/walls/outer/medium_outer_wall.nbt +++ b/data/minecraft/structure/bastion/treasure/walls/outer/medium_outer_wall.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:fc4d7b6b7cb9de3e02ee2fd5b36b260ddae0d8405021787ac232e86c7892c2a2 -size 2331 +oid sha256:ac7fad35a17bd62fdb38e702be2bc9f05de9f9eb53f64edb19f5ac9a890e3166 +size 2333 diff --git a/data/minecraft/structure/bastion/treasure/walls/outer/mid_corner.nbt b/data/minecraft/structure/bastion/treasure/walls/outer/mid_corner.nbt index a49fddbc..df6160b4 100644 --- a/data/minecraft/structure/bastion/treasure/walls/outer/mid_corner.nbt +++ b/data/minecraft/structure/bastion/treasure/walls/outer/mid_corner.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:db49ae98c19c55b4d8bf4cf372a0e097c666fc6a969a85a7d9c49f1bebb83652 -size 712 +oid sha256:992abcc36bf082e7f851c229dae915b4b3e2f9b22ad17b985675f1ba0c9e20a1 +size 714 diff --git a/data/minecraft/structure/bastion/treasure/walls/outer/outer_wall.nbt b/data/minecraft/structure/bastion/treasure/walls/outer/outer_wall.nbt index 592064e4..eba73edc 100644 --- a/data/minecraft/structure/bastion/treasure/walls/outer/outer_wall.nbt +++ b/data/minecraft/structure/bastion/treasure/walls/outer/outer_wall.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c7e93ece62d62e3c0725ac497e4e24ea950ee9115fd6c9337720042358029dc0 -size 2203 +oid sha256:0214c68ce80ee0edb82c5bac120417444ed641d03640e328eed49e76dfac57d1 +size 2206 diff --git a/data/minecraft/structure/bastion/treasure/walls/outer/tall_outer_wall.nbt b/data/minecraft/structure/bastion/treasure/walls/outer/tall_outer_wall.nbt index 24d4f013..08369fae 100644 --- a/data/minecraft/structure/bastion/treasure/walls/outer/tall_outer_wall.nbt +++ b/data/minecraft/structure/bastion/treasure/walls/outer/tall_outer_wall.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7efa41ed0d5c8c6a185df2234cbf3c561da9e496ee6f1fee04e3ac762adad882 -size 2447 +oid sha256:4f53da9e73b30b7428b0fc776f359eb47429d876ccd594683546ba457dae4013 +size 2449 diff --git a/data/minecraft/structure/bastion/treasure/walls/outer/top_corner.nbt b/data/minecraft/structure/bastion/treasure/walls/outer/top_corner.nbt index 517900fc..bdaa62bd 100644 --- a/data/minecraft/structure/bastion/treasure/walls/outer/top_corner.nbt +++ b/data/minecraft/structure/bastion/treasure/walls/outer/top_corner.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9e9f310ea9243481387881ff6db3a0aa6d7015df4de829b9bf5ea717138aab40 -size 804 +oid sha256:09dc80f38b78a76bb817ccdcb9b744d2156eca5c1e454e582f537b01657391e7 +size 806 diff --git a/data/minecraft/structure/bastion/treasure/walls/top/main_entrance.nbt b/data/minecraft/structure/bastion/treasure/walls/top/main_entrance.nbt index 2f704382..b43fb428 100644 --- a/data/minecraft/structure/bastion/treasure/walls/top/main_entrance.nbt +++ b/data/minecraft/structure/bastion/treasure/walls/top/main_entrance.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:51693531ebe2bd224a969c2ac8d5db0555843c5b943ad20e7237f88785ad20da -size 6217 +oid sha256:6dc875ebbee6df0611627b3bf1d6b76d84f3f39abaad2d75ddb254014cda6f6a +size 6220 diff --git a/data/minecraft/structure/bastion/treasure/walls/top/wall_0.nbt b/data/minecraft/structure/bastion/treasure/walls/top/wall_0.nbt index 99c43cf0..a7b3fced 100644 --- a/data/minecraft/structure/bastion/treasure/walls/top/wall_0.nbt +++ b/data/minecraft/structure/bastion/treasure/walls/top/wall_0.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4da69f079405ab1f6987dd15230d993c5172488b5204cca84498e3ebc672a9f7 -size 6223 +oid sha256:855ddd7be7cc57b4b0e98d1c89d6156e78a02f3b9a734d67ccfe2381a0cd4bc3 +size 6226 diff --git a/data/minecraft/structure/bastion/treasure/walls/top/wall_1.nbt b/data/minecraft/structure/bastion/treasure/walls/top/wall_1.nbt index a4d4625d..17cbb62d 100644 --- a/data/minecraft/structure/bastion/treasure/walls/top/wall_1.nbt +++ b/data/minecraft/structure/bastion/treasure/walls/top/wall_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9e3959fa7803d5bd6beec2ca1d2855da54a2d56f7583d9d7f01702b87a0cb470 -size 6216 +oid sha256:8d90dc447db143512d3f0f56fa2e5d8a198c22007b8d73df125a1e0139840b97 +size 6219 diff --git a/data/minecraft/structure/bastion/units/air_base.nbt b/data/minecraft/structure/bastion/units/air_base.nbt index 59a7bba6..f74cea70 100644 --- a/data/minecraft/structure/bastion/units/air_base.nbt +++ b/data/minecraft/structure/bastion/units/air_base.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e82159c55e5172558d0d2ad5646c9974c575fd226f240ad229aa5c9304a75a60 -size 63630 +oid sha256:2d52b352a937fe010a1b4867ccaaaa0ad98a3acff347ef738d021cf23c741f8e +size 63633 diff --git a/data/minecraft/structure/bastion/units/center_pieces/center_0.nbt b/data/minecraft/structure/bastion/units/center_pieces/center_0.nbt index d475a784..c363154c 100644 --- a/data/minecraft/structure/bastion/units/center_pieces/center_0.nbt +++ b/data/minecraft/structure/bastion/units/center_pieces/center_0.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e7efb8bd28cfb0fb9e027437a591a8ae0656c93dfb26d557403e8f1b1699ae4d -size 3080 +oid sha256:453c7ed1f19728c95afb7f759b5c5ebac374ab02a10c1a1a47ac1399c496a0bd +size 3083 diff --git a/data/minecraft/structure/bastion/units/center_pieces/center_1.nbt b/data/minecraft/structure/bastion/units/center_pieces/center_1.nbt index f3186545..6fb4768f 100644 --- a/data/minecraft/structure/bastion/units/center_pieces/center_1.nbt +++ b/data/minecraft/structure/bastion/units/center_pieces/center_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ddd7c86a83e8c563218c919886e139d53869454fa93b60e887a0ddeef5eb0a4f -size 3291 +oid sha256:c25f7cb8f18dfbd6a055d9862f3c45b52af8d835f4eab55ca412015057cbb446 +size 3293 diff --git a/data/minecraft/structure/bastion/units/center_pieces/center_2.nbt b/data/minecraft/structure/bastion/units/center_pieces/center_2.nbt index f2fa687c..02cda297 100644 --- a/data/minecraft/structure/bastion/units/center_pieces/center_2.nbt +++ b/data/minecraft/structure/bastion/units/center_pieces/center_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2a31776c9307a9a1f7c8b5779ba21219c806f4f3c340e9a2882fb2ac4b414059 -size 3356 +oid sha256:2c7d79cdca8c4726f883a621e36ede1e4b54243780a8417bbcf54788320ad5db +size 3359 diff --git a/data/minecraft/structure/bastion/units/edges/edge_0.nbt b/data/minecraft/structure/bastion/units/edges/edge_0.nbt index c858c1c7..67caee93 100644 --- a/data/minecraft/structure/bastion/units/edges/edge_0.nbt +++ b/data/minecraft/structure/bastion/units/edges/edge_0.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:dd2d03e58f230c30ea2c708f147c56efae4aebe604a4cc24d36bf3fab9451323 -size 2380 +oid sha256:786c017fae4a2680d6cbc8ac98f2918ad1507adc012dac10fe3e49fb87908a12 +size 2382 diff --git a/data/minecraft/structure/bastion/units/fillers/stage_0.nbt b/data/minecraft/structure/bastion/units/fillers/stage_0.nbt index ca1f40d4..3ff87cf0 100644 --- a/data/minecraft/structure/bastion/units/fillers/stage_0.nbt +++ b/data/minecraft/structure/bastion/units/fillers/stage_0.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2f018e5179abb9f4aa84c4bde27592c815c9e3ee81dbe8b8839d12493f447d3d -size 2451 +oid sha256:43ac9b2da1a2e6a528df2e24007d87e72e8dc22a5536c571d5ea129c755e29b0 +size 2454 diff --git a/data/minecraft/structure/bastion/units/pathways/pathway_0.nbt b/data/minecraft/structure/bastion/units/pathways/pathway_0.nbt index 88d60c34..13b2c07b 100644 --- a/data/minecraft/structure/bastion/units/pathways/pathway_0.nbt +++ b/data/minecraft/structure/bastion/units/pathways/pathway_0.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c8ec58cacd7c1b599cc4619b875d9e6796d9af9cd6240c1c5731231e885bd65d -size 353 +oid sha256:8c9446ec238661b37990fe2827ff98baee4690689d850f138d5d685afea36cd6 +size 355 diff --git a/data/minecraft/structure/bastion/units/pathways/pathway_wall_0.nbt b/data/minecraft/structure/bastion/units/pathways/pathway_wall_0.nbt index d914c9b4..d4c6addf 100644 --- a/data/minecraft/structure/bastion/units/pathways/pathway_wall_0.nbt +++ b/data/minecraft/structure/bastion/units/pathways/pathway_wall_0.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ee79ed846920a4cce54ade4f770db240905855a6f9ed22aa02abfabba1d539cc -size 352 +oid sha256:40077c471ff44b8b24a55be0e317cf3ac01892a8cf1e736b0545ca7768cddfd2 +size 355 diff --git a/data/minecraft/structure/bastion/units/rampart_plates/plate_0.nbt b/data/minecraft/structure/bastion/units/rampart_plates/plate_0.nbt index 9eabfe59..abac55a5 100644 --- a/data/minecraft/structure/bastion/units/rampart_plates/plate_0.nbt +++ b/data/minecraft/structure/bastion/units/rampart_plates/plate_0.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a2d2147ca093506d77bec05d61d71be98d867509092476648b03615d74518aea -size 3654 +oid sha256:94420d04a87eec15293beee1be11286ebf9fcc2b316b0181d598237016932e82 +size 3657 diff --git a/data/minecraft/structure/bastion/units/ramparts/ramparts_0.nbt b/data/minecraft/structure/bastion/units/ramparts/ramparts_0.nbt index 60310d78..53dd5d66 100644 --- a/data/minecraft/structure/bastion/units/ramparts/ramparts_0.nbt +++ b/data/minecraft/structure/bastion/units/ramparts/ramparts_0.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:34ba5fca2d92c48c19d8e61431a7851534b92c6e6a669ca9eb2036e1b272b082 -size 23658 +oid sha256:be054d5eab347979d3f12914e8b4835f9711af528352986b4b83211061314aea +size 23660 diff --git a/data/minecraft/structure/bastion/units/ramparts/ramparts_1.nbt b/data/minecraft/structure/bastion/units/ramparts/ramparts_1.nbt index 2a36a8fa..fa8975e3 100644 --- a/data/minecraft/structure/bastion/units/ramparts/ramparts_1.nbt +++ b/data/minecraft/structure/bastion/units/ramparts/ramparts_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ca7f813efe24c0d286317c398f08aa5d6b3569b957a1721457686b164d01b225 -size 11768 +oid sha256:33ab5f505d4dee8d7ea89822ea296acee98b89ab61cde0f3de3548b06eea0fff +size 11771 diff --git a/data/minecraft/structure/bastion/units/ramparts/ramparts_2.nbt b/data/minecraft/structure/bastion/units/ramparts/ramparts_2.nbt index 90a80ede..370ad11b 100644 --- a/data/minecraft/structure/bastion/units/ramparts/ramparts_2.nbt +++ b/data/minecraft/structure/bastion/units/ramparts/ramparts_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f31e3d26dfece9a8f348588215c01b2da626e80cc3da6be013d9856e3a354601 -size 6939 +oid sha256:52884b0f4f3e7f512ba8effa90a219f0e20a92112e5fb1ec527403f9cde4e414 +size 6942 diff --git a/data/minecraft/structure/bastion/units/stages/rot/stage_1_0.nbt b/data/minecraft/structure/bastion/units/stages/rot/stage_1_0.nbt index f8928104..4916fe61 100644 --- a/data/minecraft/structure/bastion/units/stages/rot/stage_1_0.nbt +++ b/data/minecraft/structure/bastion/units/stages/rot/stage_1_0.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0696c4b6ecdc89ce5648c8be9f2b31858bce9fac2bc4735765a1e27c3ed8d316 -size 2398 +oid sha256:dd9281ecdc9b9142f87d44158b855b97212a009cf65119e003a57807edbf025e +size 2401 diff --git a/data/minecraft/structure/bastion/units/stages/stage_0_0.nbt b/data/minecraft/structure/bastion/units/stages/stage_0_0.nbt index dc0feaf1..3f165a26 100644 --- a/data/minecraft/structure/bastion/units/stages/stage_0_0.nbt +++ b/data/minecraft/structure/bastion/units/stages/stage_0_0.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ec9a7c3d59ed72f17dd177755ff14d8fd9fd0a6b8f53d88a2d855afa66c646a7 -size 2546 +oid sha256:3b49b88e2d1377a781ab15f5155efe5ff1142b638a0847fc11f78f79585c3d9e +size 2549 diff --git a/data/minecraft/structure/bastion/units/stages/stage_0_1.nbt b/data/minecraft/structure/bastion/units/stages/stage_0_1.nbt index ed74a837..47e95094 100644 --- a/data/minecraft/structure/bastion/units/stages/stage_0_1.nbt +++ b/data/minecraft/structure/bastion/units/stages/stage_0_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ea1927cda64b1c0bd6901c231a9c052c8ae0a9c6ede71c54bb81b58aeab2d8a6 -size 2610 +oid sha256:6a1bd5bb6edab8a52ca4f7f07a27701a12463af1aa06585948a0a6dce1a5fd03 +size 2613 diff --git a/data/minecraft/structure/bastion/units/stages/stage_0_2.nbt b/data/minecraft/structure/bastion/units/stages/stage_0_2.nbt index 36b97018..c9695186 100644 --- a/data/minecraft/structure/bastion/units/stages/stage_0_2.nbt +++ b/data/minecraft/structure/bastion/units/stages/stage_0_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4f38567d3709281fe6938fc1b2a6166ae56d5e0cadd6bd410103b8eeaa85892c -size 2701 +oid sha256:373f0346f0e46b666347067b943138718d7ec14cc62e811ecf3626d174ecaa8c +size 2705 diff --git a/data/minecraft/structure/bastion/units/stages/stage_0_3.nbt b/data/minecraft/structure/bastion/units/stages/stage_0_3.nbt index 50e5d85b..e82ef61d 100644 --- a/data/minecraft/structure/bastion/units/stages/stage_0_3.nbt +++ b/data/minecraft/structure/bastion/units/stages/stage_0_3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:dea467593cc784f0f4df9cf3462abd1a8a39370c1eb5f3edffda8cbdb4cd8593 -size 2504 +oid sha256:1290c10d97ea115b568b46704929d236b9f4a689268ff0d4de9c49e2f02c41dd +size 2507 diff --git a/data/minecraft/structure/bastion/units/stages/stage_1_0.nbt b/data/minecraft/structure/bastion/units/stages/stage_1_0.nbt index 76e3c191..b918f494 100644 --- a/data/minecraft/structure/bastion/units/stages/stage_1_0.nbt +++ b/data/minecraft/structure/bastion/units/stages/stage_1_0.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:bf6f1d59e44114f45df668818082cb3388843d571cc14b39be3fc1fd441c054f -size 2439 +oid sha256:39e9324614338341e9564e2f5a0d134c032923b7c02ae93ed1450da937c9233a +size 2442 diff --git a/data/minecraft/structure/bastion/units/stages/stage_1_1.nbt b/data/minecraft/structure/bastion/units/stages/stage_1_1.nbt index 49d60071..6cd151f3 100644 --- a/data/minecraft/structure/bastion/units/stages/stage_1_1.nbt +++ b/data/minecraft/structure/bastion/units/stages/stage_1_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1ae9dc23e94a3b71d4183b9b64ed7c6be0de280b2b60ed1f7f5e8b29efd2c045 -size 2419 +oid sha256:fefdf7c2c4856052de2086b218378cfef62ccd07fab253fe2283b3645f7b236c +size 2422 diff --git a/data/minecraft/structure/bastion/units/stages/stage_1_2.nbt b/data/minecraft/structure/bastion/units/stages/stage_1_2.nbt index 5b307302..5f43cabc 100644 --- a/data/minecraft/structure/bastion/units/stages/stage_1_2.nbt +++ b/data/minecraft/structure/bastion/units/stages/stage_1_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9b720ffe7fd3f7e89ff8b2eaf17f306bdd9c585cc6eb81d17846facb247ed635 -size 2508 +oid sha256:ebce140cf69b762ed132409b79dd8991275e2c3e6c52f3e912a183e78b464b85 +size 2510 diff --git a/data/minecraft/structure/bastion/units/stages/stage_1_3.nbt b/data/minecraft/structure/bastion/units/stages/stage_1_3.nbt index 4497e5b2..d11763c2 100644 --- a/data/minecraft/structure/bastion/units/stages/stage_1_3.nbt +++ b/data/minecraft/structure/bastion/units/stages/stage_1_3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9bff46a2bf3a4e30595adb35219ccbc760c8d49679dbeaac082e0b25caeca71d -size 2483 +oid sha256:1a4baf957da5830ab023d560308bc5223ee8bb3d08a35d869fabf2ebfee65dbb +size 2486 diff --git a/data/minecraft/structure/bastion/units/stages/stage_2_0.nbt b/data/minecraft/structure/bastion/units/stages/stage_2_0.nbt index 3a65c726..63fe27d5 100644 --- a/data/minecraft/structure/bastion/units/stages/stage_2_0.nbt +++ b/data/minecraft/structure/bastion/units/stages/stage_2_0.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d149165f383b705fd565b3c78a9fcd9cbc2c6f03dbbfdc46271a1ae02376e397 -size 2421 +oid sha256:e0282e5c86f6672375f0c8e799e571f5e0de84f9c18a7e179a7d0408e4dda0b2 +size 2423 diff --git a/data/minecraft/structure/bastion/units/stages/stage_2_1.nbt b/data/minecraft/structure/bastion/units/stages/stage_2_1.nbt index 567dc085..977e9e0d 100644 --- a/data/minecraft/structure/bastion/units/stages/stage_2_1.nbt +++ b/data/minecraft/structure/bastion/units/stages/stage_2_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ba3d63a97c27902ed7a38d97e662157606b60d1f7118c55ec0ea18029b2a5265 -size 2458 +oid sha256:032fbd84e2eb264524bdbb528798643209c9be6452a76a6551a20581bd7b211b +size 2461 diff --git a/data/minecraft/structure/bastion/units/stages/stage_3_0.nbt b/data/minecraft/structure/bastion/units/stages/stage_3_0.nbt index 79390b1b..a000c2b7 100644 --- a/data/minecraft/structure/bastion/units/stages/stage_3_0.nbt +++ b/data/minecraft/structure/bastion/units/stages/stage_3_0.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4ee8c5c23ccd082ced1ed7e3d9a563b3b3572d3720bea47fb2a30b0d10131957 -size 631 +oid sha256:1a3ba0c9f9ea4f58d00e64caa37a71d61b5e074fbe3bff952f27cec0a6e23594 +size 633 diff --git a/data/minecraft/structure/bastion/units/stages/stage_3_1.nbt b/data/minecraft/structure/bastion/units/stages/stage_3_1.nbt index 707a4be3..45639f72 100644 --- a/data/minecraft/structure/bastion/units/stages/stage_3_1.nbt +++ b/data/minecraft/structure/bastion/units/stages/stage_3_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8729cf138d23919ca2b76128bca435bc460a8f1e4a3f199621cd14417a063684 -size 688 +oid sha256:1c066fc2c7915e4b7bc0890d442c3a5467637be3fe1d60a54e5b351a9f7f4618 +size 690 diff --git a/data/minecraft/structure/bastion/units/stages/stage_3_2.nbt b/data/minecraft/structure/bastion/units/stages/stage_3_2.nbt index d2d549e3..b3b8dfeb 100644 --- a/data/minecraft/structure/bastion/units/stages/stage_3_2.nbt +++ b/data/minecraft/structure/bastion/units/stages/stage_3_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8bae110a5cb758aafe0b573fc41982276e3edc8c116597914857ee7894156c86 -size 626 +oid sha256:b3be666d479c1b728506fcdc649db31f0f2bd2f4d5dd2d2429203409e26df815 +size 629 diff --git a/data/minecraft/structure/bastion/units/stages/stage_3_3.nbt b/data/minecraft/structure/bastion/units/stages/stage_3_3.nbt index 7e669c02..2bb41318 100644 --- a/data/minecraft/structure/bastion/units/stages/stage_3_3.nbt +++ b/data/minecraft/structure/bastion/units/stages/stage_3_3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e251ef226dabaefa06cc19e4cf5f53a187bf843781692374663ee3668933688b -size 653 +oid sha256:ef8853229f229bd6c9e0f6b30e3d437891c6a2c4e0b8ae911a2d7f9b70a9d82b +size 656 diff --git a/data/minecraft/structure/bastion/units/wall_units/edge_0_large.nbt b/data/minecraft/structure/bastion/units/wall_units/edge_0_large.nbt index 1a9a7431..36225a3b 100644 --- a/data/minecraft/structure/bastion/units/wall_units/edge_0_large.nbt +++ b/data/minecraft/structure/bastion/units/wall_units/edge_0_large.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:229ba1be3d79cc2cf2192e891e8533eeb26ab79777234df9d09acaede41c4773 -size 2819 +oid sha256:627e9fc5c9e678b39174071b6994ce74f75a9547a6c33fd8f96b140c3c106936 +size 2821 diff --git a/data/minecraft/structure/bastion/units/wall_units/unit_0.nbt b/data/minecraft/structure/bastion/units/wall_units/unit_0.nbt index 25a9b4a4..78fdfd44 100644 --- a/data/minecraft/structure/bastion/units/wall_units/unit_0.nbt +++ b/data/minecraft/structure/bastion/units/wall_units/unit_0.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:92ae2f64d9d0970f051e84698ad0e5bbd7fb11ca71501190edc0bf4f313b2959 -size 2498 +oid sha256:d0657d71ee6a551f55384e7f5cc118510e299a46415f3647d61c29fb3964b3d2 +size 2500 diff --git a/data/minecraft/structure/bastion/units/walls/connected_wall.nbt b/data/minecraft/structure/bastion/units/walls/connected_wall.nbt index 09277fdb..b94b3696 100644 --- a/data/minecraft/structure/bastion/units/walls/connected_wall.nbt +++ b/data/minecraft/structure/bastion/units/walls/connected_wall.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:386e0587644a95a7256d36bf453fc02eaa1b7fcd8a4dc0ef5a62268f3307262a -size 15614 +oid sha256:86351901fd9a1545631d568343254d3fdf85e1ac288a7354681663915fdefd04 +size 15616 diff --git a/data/minecraft/structure/bastion/units/walls/wall_base.nbt b/data/minecraft/structure/bastion/units/walls/wall_base.nbt index 4fd25181..71fd4de6 100644 --- a/data/minecraft/structure/bastion/units/walls/wall_base.nbt +++ b/data/minecraft/structure/bastion/units/walls/wall_base.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0ae83e0e12c05e48a20b2efc79f088b41e677afe230f89fe19fbd03f5df3d5b6 -size 16900 +oid sha256:b358d44fdd4f7caae900a6bea9d7a4e7e3ce0eba3f6d4c0c2bdb0fe002dbe172 +size 16904 diff --git a/data/minecraft/structure/end_city/base_floor.nbt b/data/minecraft/structure/end_city/base_floor.nbt index 8cbff57a..29ae5b2f 100644 --- a/data/minecraft/structure/end_city/base_floor.nbt +++ b/data/minecraft/structure/end_city/base_floor.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c8f14c60531fc857f5677989f72cabe0cf23369193c801fb42a0f4c80d6051ed -size 1683 +oid sha256:f73f14beb56a6e547b5f77a0ac2f8b4ecba308af1c89b50b0fc1d66509d761ff +size 1686 diff --git a/data/minecraft/structure/end_city/base_roof.nbt b/data/minecraft/structure/end_city/base_roof.nbt index 5df2293c..e32cf519 100644 --- a/data/minecraft/structure/end_city/base_roof.nbt +++ b/data/minecraft/structure/end_city/base_roof.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e6ee7cee198efb9bd76ec2ba814172921f84685d28211870c0bfc0feb2eef142 -size 1178 +oid sha256:114249f428665f22339775eac92ef47eb4ef5203a71062db9fc652f78d6545c1 +size 1180 diff --git a/data/minecraft/structure/end_city/bridge_end.nbt b/data/minecraft/structure/end_city/bridge_end.nbt index b44fc36d..d4d4ace7 100644 --- a/data/minecraft/structure/end_city/bridge_end.nbt +++ b/data/minecraft/structure/end_city/bridge_end.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:72d8df6548af43aa6e0e3ba52a8be57fdb4dc94645b26b4225ff53ee75ef3e33 -size 473 +oid sha256:05e0e71d7860375b6a9620e1b2b178fdf770cafd57b43daa61cb33302f0b2b88 +size 475 diff --git a/data/minecraft/structure/end_city/bridge_gentle_stairs.nbt b/data/minecraft/structure/end_city/bridge_gentle_stairs.nbt index 2a770b1b..9b7d7424 100644 --- a/data/minecraft/structure/end_city/bridge_gentle_stairs.nbt +++ b/data/minecraft/structure/end_city/bridge_gentle_stairs.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:63dea728bce0236fda8cbb742933d4c8249c2766ecb0a15b78011dde5ac4392a -size 1140 +oid sha256:5ca99c4fb7a87ffc397e3bebcce7633d38503054b6c44e5807f1c5d8d686f0da +size 1142 diff --git a/data/minecraft/structure/end_city/bridge_piece.nbt b/data/minecraft/structure/end_city/bridge_piece.nbt index 09908907..06f63093 100644 --- a/data/minecraft/structure/end_city/bridge_piece.nbt +++ b/data/minecraft/structure/end_city/bridge_piece.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:91081e87bf5a3a1ff5d1c1359b4b7cb04f5e2e6c8bf3c6b1071edced41ff772c -size 596 +oid sha256:ac92987005fc3f4db328692d050b012796ada361af2df85a045769fa9850089e +size 599 diff --git a/data/minecraft/structure/end_city/bridge_steep_stairs.nbt b/data/minecraft/structure/end_city/bridge_steep_stairs.nbt index 898adf77..8e44acbd 100644 --- a/data/minecraft/structure/end_city/bridge_steep_stairs.nbt +++ b/data/minecraft/structure/end_city/bridge_steep_stairs.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b45c378f8e04a80ddaefcb15001d108dc3a8e89529bd8c90170ab185dd86b9be -size 712 +oid sha256:c262c8a1c9156d1636b7b88c4a2f2fa71dd1bad44a3a5b98fc079e9a036f2ac3 +size 714 diff --git a/data/minecraft/structure/end_city/fat_tower_base.nbt b/data/minecraft/structure/end_city/fat_tower_base.nbt index 8d3bd869..c4eab369 100644 --- a/data/minecraft/structure/end_city/fat_tower_base.nbt +++ b/data/minecraft/structure/end_city/fat_tower_base.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:da76f0b036d4e6bb90d48bc7f58b41e683390423aa2b53e36c3f0d6c9c48f0ee -size 2335 +oid sha256:277190e1112861d4de008c6fdfa50b3262cbef03116104af40f5115af35f5abe +size 2338 diff --git a/data/minecraft/structure/end_city/fat_tower_middle.nbt b/data/minecraft/structure/end_city/fat_tower_middle.nbt index ae98c4cd..16ef60b5 100644 --- a/data/minecraft/structure/end_city/fat_tower_middle.nbt +++ b/data/minecraft/structure/end_city/fat_tower_middle.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:11fb8b6a25f11027a289f9fe31f9b195f084b988636f00949c5b9f720bd06d98 -size 4466 +oid sha256:d38e4f20b54cd09770993234554f4b6a8c519eb00a82508a67b516aeada35a24 +size 4468 diff --git a/data/minecraft/structure/end_city/fat_tower_top.nbt b/data/minecraft/structure/end_city/fat_tower_top.nbt index c463d164..c12c25e0 100644 --- a/data/minecraft/structure/end_city/fat_tower_top.nbt +++ b/data/minecraft/structure/end_city/fat_tower_top.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d019e5d41f9269b6b14ef1ba32286d7070c9decf4c1057b1b764d7decaaf3ba2 -size 5957 +oid sha256:fd3863e0cd4b9880d97a923616b5535d2b662404501f14e93cf7d6824e21c235 +size 5959 diff --git a/data/minecraft/structure/end_city/second_floor_1.nbt b/data/minecraft/structure/end_city/second_floor_1.nbt index 62f11973..6d6c1b56 100644 --- a/data/minecraft/structure/end_city/second_floor_1.nbt +++ b/data/minecraft/structure/end_city/second_floor_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d943fe5ebf6ac65937e5a3243143e1c7522813633af3a39fdf43433d26c86a8e -size 3714 +oid sha256:49162dc106c7daa10ee941ea2bee1961cc265f2d6d7a5a94e64ed167abf61eb1 +size 3716 diff --git a/data/minecraft/structure/end_city/second_floor_2.nbt b/data/minecraft/structure/end_city/second_floor_2.nbt index ffb0ef23..433ef919 100644 --- a/data/minecraft/structure/end_city/second_floor_2.nbt +++ b/data/minecraft/structure/end_city/second_floor_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:fde90b4ed80931566c81cc3af649112f366d182ee842c21b71e932d77f3534f1 -size 3968 +oid sha256:7763c508c3cac924b56b034f8d7d83ebc7a19de8ca2697d1ea6a27a775738cf3 +size 3970 diff --git a/data/minecraft/structure/end_city/second_roof.nbt b/data/minecraft/structure/end_city/second_roof.nbt index 53d4c280..5faf84b2 100644 --- a/data/minecraft/structure/end_city/second_roof.nbt +++ b/data/minecraft/structure/end_city/second_roof.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:211c8493f091b1d2dfb8b041674dfbe29b3d7ca6846e6e43b51d62721bbb3370 -size 1424 +oid sha256:1d1b55c6b93b0272d2c7ddbebdd9769d684507cea22fd6de9162b2c7e570517a +size 1426 diff --git a/data/minecraft/structure/end_city/ship.nbt b/data/minecraft/structure/end_city/ship.nbt index 873a8387..666ba3b4 100644 --- a/data/minecraft/structure/end_city/ship.nbt +++ b/data/minecraft/structure/end_city/ship.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b4a10cd0c6a495d96726c09713d7ec42ef991858cd4af6ebd86522ab45d78147 -size 26442 +oid sha256:5a10cd74d81a6c78c028efabe783cf733f24607256a98b495a960657716a2fbd +size 26445 diff --git a/data/minecraft/structure/end_city/third_floor_1.nbt b/data/minecraft/structure/end_city/third_floor_1.nbt index fc645e43..1be6c846 100644 --- a/data/minecraft/structure/end_city/third_floor_1.nbt +++ b/data/minecraft/structure/end_city/third_floor_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b4f54717617df1fe70951e5f71d9472b46b92891555840cb3f174ebfc1853a36 -size 4784 +oid sha256:d85e1023a0af383345755f2e690f33fa1eeb8a88ee9915fb4fa98d989890813c +size 4787 diff --git a/data/minecraft/structure/end_city/third_floor_2.nbt b/data/minecraft/structure/end_city/third_floor_2.nbt index 658d999b..dbbc0010 100644 --- a/data/minecraft/structure/end_city/third_floor_2.nbt +++ b/data/minecraft/structure/end_city/third_floor_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:fc381cd0dd93d1c36e50571763fa0a296922550180acf052ca151f15019cf21e -size 5156 +oid sha256:041362b9408406912e823120389c7de998fd47f36fee67aa2d51e4095939acbd +size 5159 diff --git a/data/minecraft/structure/end_city/third_roof.nbt b/data/minecraft/structure/end_city/third_roof.nbt index 982497d2..56a51d32 100644 --- a/data/minecraft/structure/end_city/third_roof.nbt +++ b/data/minecraft/structure/end_city/third_roof.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ee9b89f7c45d331f88ada41a3be5dedf0361bef03e17d352e635baaae8d580b5 -size 1829 +oid sha256:c78151fb7e1102ed45ee4c8b0d7103e7d31a56031d78de2f4d16ad14f5354d81 +size 1831 diff --git a/data/minecraft/structure/end_city/tower_base.nbt b/data/minecraft/structure/end_city/tower_base.nbt index 97941625..c77157a2 100644 --- a/data/minecraft/structure/end_city/tower_base.nbt +++ b/data/minecraft/structure/end_city/tower_base.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:437eebc31c5a3773c23de1d1fc2ba3d31be7f9ae796ac20287cb6c6a4dfc55ed -size 931 +oid sha256:3ce5bec94eaf36e8cb938a4401a9d1357e2b2885c3a2c46d5caeaa1a363b35cf +size 934 diff --git a/data/minecraft/structure/end_city/tower_floor.nbt b/data/minecraft/structure/end_city/tower_floor.nbt index 0d0362b3..613de52a 100644 --- a/data/minecraft/structure/end_city/tower_floor.nbt +++ b/data/minecraft/structure/end_city/tower_floor.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d8bc3f535d91843edc76800fa1403b823a0d6b22af9b2f304a221dd43efcbe9a -size 977 +oid sha256:cb7818af19334c7f9abc4977ee913b74379587c0c25489549eb0e0a28a0b6d21 +size 980 diff --git a/data/minecraft/structure/end_city/tower_piece.nbt b/data/minecraft/structure/end_city/tower_piece.nbt index 1992b7e3..45eeb142 100644 --- a/data/minecraft/structure/end_city/tower_piece.nbt +++ b/data/minecraft/structure/end_city/tower_piece.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:09d6465a3b6f128edb29a6c85ab8a310f29747ae2ff7be85e01e471140b435ac -size 896 +oid sha256:a48880980182ea7961a89aaf5e861ff374b0738966e80eba06368b03d3e81997 +size 898 diff --git a/data/minecraft/structure/end_city/tower_top.nbt b/data/minecraft/structure/end_city/tower_top.nbt index 7d6758de..173b1cc7 100644 --- a/data/minecraft/structure/end_city/tower_top.nbt +++ b/data/minecraft/structure/end_city/tower_top.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3474d9692bbbd635538c05150af0220ff2089235f3977a14acc918205989fbd4 -size 2033 +oid sha256:1805a17a265d4bb3a192cd483bfc172ee92f524cc56ebba112f9b343ef4063c6 +size 2036 diff --git a/data/minecraft/structure/fossil/skull_1.nbt b/data/minecraft/structure/fossil/skull_1.nbt index 3efb913c..33c96b19 100644 --- a/data/minecraft/structure/fossil/skull_1.nbt +++ b/data/minecraft/structure/fossil/skull_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7d9e667d3a24bfbf5e73be37df4ce03136e8074ba1559d3a6673ec80422140b0 -size 440 +oid sha256:e45e8819923b7f13518ec19fdfd6c27e4febf4ea2e1d8076525a18d0f4107711 +size 442 diff --git a/data/minecraft/structure/fossil/skull_1_coal.nbt b/data/minecraft/structure/fossil/skull_1_coal.nbt index 45498543..b12c4b7d 100644 --- a/data/minecraft/structure/fossil/skull_1_coal.nbt +++ b/data/minecraft/structure/fossil/skull_1_coal.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3cf0c47cd2017dde456d644b62696bd563f275f86f46368d2b824a159954a1f9 -size 394 +oid sha256:c30316d9a9ed59ff913e316961dbffd049c44fa6c1028fc76ea9b11bd1b6baca +size 397 diff --git a/data/minecraft/structure/fossil/skull_2.nbt b/data/minecraft/structure/fossil/skull_2.nbt index e4c2db52..65baf570 100644 --- a/data/minecraft/structure/fossil/skull_2.nbt +++ b/data/minecraft/structure/fossil/skull_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:87f14e46b5fd356dd0872535c510c28c2e16adf8364712436906910da3d7d6a9 -size 396 +oid sha256:5d780f145b5758d32b9445bada31d4fb68b94c9b34849e56c71df8f59927f514 +size 398 diff --git a/data/minecraft/structure/fossil/skull_2_coal.nbt b/data/minecraft/structure/fossil/skull_2_coal.nbt index a3ac9c48..756348dd 100644 --- a/data/minecraft/structure/fossil/skull_2_coal.nbt +++ b/data/minecraft/structure/fossil/skull_2_coal.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:cd3d8d895c069861d010ec9816073f3b3e048bb829e358cc193899679ff19d40 -size 344 +oid sha256:fb8c4f64e70f878c39cb037be6114e8d1582f531e30c153eb9b1a97e25828c86 +size 346 diff --git a/data/minecraft/structure/fossil/skull_3.nbt b/data/minecraft/structure/fossil/skull_3.nbt index ee2dce0b..1e8901fb 100644 --- a/data/minecraft/structure/fossil/skull_3.nbt +++ b/data/minecraft/structure/fossil/skull_3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:41f06601cfe38dccca7a7a45a044062e06fc2603d2e002c64de98c985708f252 -size 346 +oid sha256:edcf23bb1204af42c739452df2ec0434adb2fd5e393c05902b2bd6853130a766 +size 348 diff --git a/data/minecraft/structure/fossil/skull_3_coal.nbt b/data/minecraft/structure/fossil/skull_3_coal.nbt index a27c1ac2..6e6e0d9a 100644 --- a/data/minecraft/structure/fossil/skull_3_coal.nbt +++ b/data/minecraft/structure/fossil/skull_3_coal.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1a3c063f17ffa3bc27289db2f3d9add857c8a4daf8885e4f43d6cc06d8cdc075 -size 315 +oid sha256:53b722d72a42e8b604512b55f3e14cbfeed3dd8339f53194664ba765ff9ccfc8 +size 318 diff --git a/data/minecraft/structure/fossil/skull_4.nbt b/data/minecraft/structure/fossil/skull_4.nbt index f1b279b6..fa8b71f3 100644 --- a/data/minecraft/structure/fossil/skull_4.nbt +++ b/data/minecraft/structure/fossil/skull_4.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ce003806d22baa85b645965041a2fd5bf5bd0689ff72a7d95f7de38ed1c18298 -size 268 +oid sha256:15d7121bdcc368c203a98a91521f3e30b0307405227794de488ad055fdac4bc4 +size 270 diff --git a/data/minecraft/structure/fossil/skull_4_coal.nbt b/data/minecraft/structure/fossil/skull_4_coal.nbt index 28b74b78..545cfbf4 100644 --- a/data/minecraft/structure/fossil/skull_4_coal.nbt +++ b/data/minecraft/structure/fossil/skull_4_coal.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:01d4a4f6000196a903eaadeebf2463f6501fc6b6ff08a423be906b831c2c0d8c -size 234 +oid sha256:83e99cc11abe3cd079f3adc645cff4c524fe6e0c5e5ab804e2697a75a8d2f06c +size 236 diff --git a/data/minecraft/structure/fossil/spine_1.nbt b/data/minecraft/structure/fossil/spine_1.nbt index 3fa4f4aa..a844b8c0 100644 --- a/data/minecraft/structure/fossil/spine_1.nbt +++ b/data/minecraft/structure/fossil/spine_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5568815508e9f6cc9ef9277431a213ab92e6f49f64b92dbd0e64c5d3da986f15 -size 270 +oid sha256:7d7fc20618d688ebdc753c60aeae011ebe4eba480aead161c99bd6b5512c7e38 +size 272 diff --git a/data/minecraft/structure/fossil/spine_1_coal.nbt b/data/minecraft/structure/fossil/spine_1_coal.nbt index 581b1bbb..f985fdd7 100644 --- a/data/minecraft/structure/fossil/spine_1_coal.nbt +++ b/data/minecraft/structure/fossil/spine_1_coal.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f19e68d1dc16254503f7eccbf6aacbdea58785032faab8fbff68e2340624125a -size 249 +oid sha256:bf320d380148dc42f05f29359ef8de68e89ec67d31e506ef4077e5016d4fd5d8 +size 252 diff --git a/data/minecraft/structure/fossil/spine_2.nbt b/data/minecraft/structure/fossil/spine_2.nbt index db2f36a2..ad12c3e7 100644 --- a/data/minecraft/structure/fossil/spine_2.nbt +++ b/data/minecraft/structure/fossil/spine_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:edff3b6cb45ed7a6912d633da9596e67328a472a78a0810d6f2ab35d20632190 -size 359 +oid sha256:932c29607194dfcf1209ecf8a921e379bbb2f0546b2461278b7fcf2554e6f195 +size 361 diff --git a/data/minecraft/structure/fossil/spine_2_coal.nbt b/data/minecraft/structure/fossil/spine_2_coal.nbt index 1c1ed36a..962d9a2c 100644 --- a/data/minecraft/structure/fossil/spine_2_coal.nbt +++ b/data/minecraft/structure/fossil/spine_2_coal.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:17b4b27be79443a39dc3d8fe5bd6fa3ad834678bbc14ec47df3c659f68639b8c -size 323 +oid sha256:1e9241eb4a07580ea4d4d8e653fb1937c0a7125ec8ea50dbc9c345d86d8cf1cb +size 325 diff --git a/data/minecraft/structure/fossil/spine_3.nbt b/data/minecraft/structure/fossil/spine_3.nbt index b1d6b848..4db1b9ee 100644 --- a/data/minecraft/structure/fossil/spine_3.nbt +++ b/data/minecraft/structure/fossil/spine_3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1d8c8e7fb8c79f7dec148edf29e20c1a70b33e15d1b319c451742d79e81c896e -size 454 +oid sha256:69d4c4a009c977a440e8869f58e326e37cef1cffff5d865b0b98e4a77b6954a6 +size 457 diff --git a/data/minecraft/structure/fossil/spine_3_coal.nbt b/data/minecraft/structure/fossil/spine_3_coal.nbt index 3d508862..8407d37d 100644 --- a/data/minecraft/structure/fossil/spine_3_coal.nbt +++ b/data/minecraft/structure/fossil/spine_3_coal.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:68126ef58bbd96ac54e0495ddb17c0087710b573c258e2ffcc784ee14631b017 -size 435 +oid sha256:df04841de7c3fce88bd401735bf06a607a90f78edfd3bdf3a6e7b0456a8b74a4 +size 437 diff --git a/data/minecraft/structure/fossil/spine_4.nbt b/data/minecraft/structure/fossil/spine_4.nbt index 7a6a0560..49ed0606 100644 --- a/data/minecraft/structure/fossil/spine_4.nbt +++ b/data/minecraft/structure/fossil/spine_4.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b30791c15635b7cfab89c1863ff485630273488b8f1acc0407b3e23b50be5da5 -size 526 +oid sha256:cfa80c34058c03ac3c7d68072c98ad06ebf617e0d645dd1856f107954d4d8ecd +size 529 diff --git a/data/minecraft/structure/fossil/spine_4_coal.nbt b/data/minecraft/structure/fossil/spine_4_coal.nbt index 4d8e1866..cb3e6598 100644 --- a/data/minecraft/structure/fossil/spine_4_coal.nbt +++ b/data/minecraft/structure/fossil/spine_4_coal.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:43d28e976377b95681ed9e66019e81f5e445c13a0a4ac369b7c6ab12cbff7aee -size 480 +oid sha256:d4b201b8e7c22ac4e51e84805cf86ddb3e44025c47add361e7f2520e1fffc605 +size 482 diff --git a/data/minecraft/structure/igloo/bottom.nbt b/data/minecraft/structure/igloo/bottom.nbt index 89c2288a..21c1bca0 100644 --- a/data/minecraft/structure/igloo/bottom.nbt +++ b/data/minecraft/structure/igloo/bottom.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a799e9b3a52c4958c8f071af3948d9056ce065b4569a4d9fb8f493ed403b12ad -size 2782 +oid sha256:0553c38640e4a323ebe05adb56d8785eb3865d170ac4b642ddbaf7ca06a34c8c +size 2772 diff --git a/data/minecraft/structure/igloo/middle.nbt b/data/minecraft/structure/igloo/middle.nbt index cd1d2e82..95e2b05c 100644 --- a/data/minecraft/structure/igloo/middle.nbt +++ b/data/minecraft/structure/igloo/middle.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:90f4044c307946c8c76d833417f96bed17f61a752cf9b69af48c39f46afcc553 -size 235 +oid sha256:f7b140192bc7718cd4b522dc41a868ad2c3c36ba9703f894b76b620be7cdd72b +size 237 diff --git a/data/minecraft/structure/igloo/top.nbt b/data/minecraft/structure/igloo/top.nbt index b7da4b5e..dc88c5e3 100644 --- a/data/minecraft/structure/igloo/top.nbt +++ b/data/minecraft/structure/igloo/top.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:986b92dfef282b5d6f6fcbf414dccdc3c7d4e8e7a31956483dfed33d506fab31 -size 907 +oid sha256:dd7f5cf13ded12f99e50a8473aa96c0dcce74c65ec902910f78fa24be660a650 +size 910 diff --git a/data/minecraft/structure/nether_fossils/fossil_1.nbt b/data/minecraft/structure/nether_fossils/fossil_1.nbt index bf57eb9c..eac0e128 100644 --- a/data/minecraft/structure/nether_fossils/fossil_1.nbt +++ b/data/minecraft/structure/nether_fossils/fossil_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:00c6e9663a775a84b03fedec06988b371cac1ee617b525946f1aa6541447a6c1 -size 395 +oid sha256:885a4c20cf9b8cce25fc8e23a93102c38eea7ac8e14630e0779dcc21f40c027d +size 398 diff --git a/data/minecraft/structure/nether_fossils/fossil_10.nbt b/data/minecraft/structure/nether_fossils/fossil_10.nbt index 324c3ba7..377536bf 100644 --- a/data/minecraft/structure/nether_fossils/fossil_10.nbt +++ b/data/minecraft/structure/nether_fossils/fossil_10.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:04da081a2d3f1f76610653b69ed1e0dd90401a85273a6accf91cb0e14cd9021a -size 236 +oid sha256:776de632ae2c92821da9ed99c86870b6b9c36befb94b3dace94a754d9ecff821 +size 238 diff --git a/data/minecraft/structure/nether_fossils/fossil_11.nbt b/data/minecraft/structure/nether_fossils/fossil_11.nbt index 6df01d9b..2211814f 100644 --- a/data/minecraft/structure/nether_fossils/fossil_11.nbt +++ b/data/minecraft/structure/nether_fossils/fossil_11.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a07bdc251d014a01f6092d40d3f1f05a11541e1f288373c56785c98a37157b67 -size 672 +oid sha256:d9dd1caf1f1d422080f25942cc3384f00edd2dac18724229460ff10bcfb95ab3 +size 675 diff --git a/data/minecraft/structure/nether_fossils/fossil_12.nbt b/data/minecraft/structure/nether_fossils/fossil_12.nbt index cc9d0a23..7ade2895 100644 --- a/data/minecraft/structure/nether_fossils/fossil_12.nbt +++ b/data/minecraft/structure/nether_fossils/fossil_12.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c8e875cc118174f6a9a15d4cbcb18fa8eecc936d78564f1b894914e733f50bec -size 315 +oid sha256:ac034a97f757949982aab1b94feb6e578be87055f00f970473b04b83c1cb6b04 +size 317 diff --git a/data/minecraft/structure/nether_fossils/fossil_13.nbt b/data/minecraft/structure/nether_fossils/fossil_13.nbt index 87be8ba0..c74e6036 100644 --- a/data/minecraft/structure/nether_fossils/fossil_13.nbt +++ b/data/minecraft/structure/nether_fossils/fossil_13.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7bb1127c50803668356b5b6c70bf832c0bcb54f6d7663f7b3c88467305ea789e -size 522 +oid sha256:ab5084703dc40d8d5c38735b6bdc3d2e14f9b9812228baf36389fa2b509bb99b +size 525 diff --git a/data/minecraft/structure/nether_fossils/fossil_14.nbt b/data/minecraft/structure/nether_fossils/fossil_14.nbt index a6582f2f..9401d05d 100644 --- a/data/minecraft/structure/nether_fossils/fossil_14.nbt +++ b/data/minecraft/structure/nether_fossils/fossil_14.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b0574ebe29d27cfc1969d4e5a9388d3ddcced722385fb90c40975a99371127cd +oid sha256:9ecb7b50c8ac9ad2657ff5c9f5d712bdc6fdf896d7b022c716204a7b8dd57697 size 938 diff --git a/data/minecraft/structure/nether_fossils/fossil_2.nbt b/data/minecraft/structure/nether_fossils/fossil_2.nbt index acb4d82b..2cf985a0 100644 --- a/data/minecraft/structure/nether_fossils/fossil_2.nbt +++ b/data/minecraft/structure/nether_fossils/fossil_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ae6bb616f3821492f2d5cd4f075f35398eaafcd09312b8e1943cad0b877c7c2a -size 257 +oid sha256:993781e7acd89b2dc1c0ca8495cdb7161e2cd604e02ddad5e7abefcf8fb5ade0 +size 259 diff --git a/data/minecraft/structure/nether_fossils/fossil_3.nbt b/data/minecraft/structure/nether_fossils/fossil_3.nbt index 37b4ccc5..ade5edfa 100644 --- a/data/minecraft/structure/nether_fossils/fossil_3.nbt +++ b/data/minecraft/structure/nether_fossils/fossil_3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:502389b527b26f07a56dfa210db47439eb907a7195479c21749e13bc123603fd -size 248 +oid sha256:78c8a34c0af74b4db78b62e601206ba7084c948126de66ce4793c0571eebc527 +size 249 diff --git a/data/minecraft/structure/nether_fossils/fossil_4.nbt b/data/minecraft/structure/nether_fossils/fossil_4.nbt index d1361e7f..ecb611e6 100644 --- a/data/minecraft/structure/nether_fossils/fossil_4.nbt +++ b/data/minecraft/structure/nether_fossils/fossil_4.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b4df84349a8708397ceb9d10370fec88fa87681d73da547e4744af955b10e731 -size 210 +oid sha256:220cd5a5bddc97e2d2b263d117deec210f981fff9531880a6a64cbb76bc0b6d9 +size 212 diff --git a/data/minecraft/structure/nether_fossils/fossil_5.nbt b/data/minecraft/structure/nether_fossils/fossil_5.nbt index 47d21498..84a0310d 100644 --- a/data/minecraft/structure/nether_fossils/fossil_5.nbt +++ b/data/minecraft/structure/nether_fossils/fossil_5.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8267b5faffd71de2b7c90c6110473b58360cb51855e25ab128b54400ead806d9 -size 204 +oid sha256:cad31cc1b3a0c3e5c074ac5d7639e2a337df915da104fc92ec12bb9896445d7c +size 206 diff --git a/data/minecraft/structure/nether_fossils/fossil_6.nbt b/data/minecraft/structure/nether_fossils/fossil_6.nbt index 9e240fc1..6fd6d3f9 100644 --- a/data/minecraft/structure/nether_fossils/fossil_6.nbt +++ b/data/minecraft/structure/nether_fossils/fossil_6.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c544dc9b1ca7cc19899156085490d52b72592d7196de3f7093eec713111edf47 -size 628 +oid sha256:cdc4021b10937c8671cfdd1942b39dc1ae164397dff812072af73c095ecd8380 +size 631 diff --git a/data/minecraft/structure/nether_fossils/fossil_7.nbt b/data/minecraft/structure/nether_fossils/fossil_7.nbt index 83f29673..c4c77e74 100644 --- a/data/minecraft/structure/nether_fossils/fossil_7.nbt +++ b/data/minecraft/structure/nether_fossils/fossil_7.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:cc22c27614e5a0db044fb5f05cdaa750ae5bf8e6d360ba43b72b6be51fb092b0 -size 508 +oid sha256:cf85f1cfd170bb4f152d849739d2ec8a8bf402983010610ec5048795a798d6be +size 510 diff --git a/data/minecraft/structure/nether_fossils/fossil_8.nbt b/data/minecraft/structure/nether_fossils/fossil_8.nbt index be07bf29..de952158 100644 --- a/data/minecraft/structure/nether_fossils/fossil_8.nbt +++ b/data/minecraft/structure/nether_fossils/fossil_8.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:85af074acf7b0e85ffab4080d8a7c5739ddf24c4bcb80bf69181b60c88ccffbf -size 218 +oid sha256:ecdbd74f846c00f11a5fbdef57939ddbda643a6bfe7e2db7c4e0ed0177da7cbb +size 221 diff --git a/data/minecraft/structure/nether_fossils/fossil_9.nbt b/data/minecraft/structure/nether_fossils/fossil_9.nbt index 9d1d782d..6e70d1c9 100644 --- a/data/minecraft/structure/nether_fossils/fossil_9.nbt +++ b/data/minecraft/structure/nether_fossils/fossil_9.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:bae457798c992d14de0ef74b1ebb6d5ad50b1700b62deaa83cfa680a166d23c5 -size 392 +oid sha256:06ddb89e9e305d6d98e2f429fbfe2640a2c2cd0b4613c36b1dbeb115fb0eb3e7 +size 395 diff --git a/data/minecraft/structure/pillager_outpost/base_plate.nbt b/data/minecraft/structure/pillager_outpost/base_plate.nbt index f9ad4505..31caf654 100644 --- a/data/minecraft/structure/pillager_outpost/base_plate.nbt +++ b/data/minecraft/structure/pillager_outpost/base_plate.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3ba9eaa699159639b430aac3d2b5c539c22139be0cc2134d8dfb67cd02c65b70 -size 19279 +oid sha256:87e5ec2601bdb6ad40bffb02e1ad0189c5f8699546ad71c36d9b7045a31c8155 +size 19282 diff --git a/data/minecraft/structure/pillager_outpost/feature_cage1.nbt b/data/minecraft/structure/pillager_outpost/feature_cage1.nbt index 003f6b3d..eddddc4c 100644 --- a/data/minecraft/structure/pillager_outpost/feature_cage1.nbt +++ b/data/minecraft/structure/pillager_outpost/feature_cage1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f9df6cd633c520dbe8c7ad975712a2da01113465c2e1d605e97fb7a85b533a35 -size 1671 +oid sha256:5677da0753b82e02497960d3d41f95b1cbd11d8421b3a1670705f2cfb67a5a17 +size 1666 diff --git a/data/minecraft/structure/pillager_outpost/feature_cage2.nbt b/data/minecraft/structure/pillager_outpost/feature_cage2.nbt index 06741e8e..e437c8b6 100644 --- a/data/minecraft/structure/pillager_outpost/feature_cage2.nbt +++ b/data/minecraft/structure/pillager_outpost/feature_cage2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b1a7a5a24c9ab71fbd2ffd18d79fd64fc44396f66bf078396eba9d7b9dc15ec1 -size 1030 +oid sha256:204e2c021427d2872d29bb75840e4729ad36a5ad51575db0750f9c62b9b885cc +size 1032 diff --git a/data/minecraft/structure/pillager_outpost/feature_cage_with_allays.nbt b/data/minecraft/structure/pillager_outpost/feature_cage_with_allays.nbt index 0ca5abbf..a4e00855 100644 --- a/data/minecraft/structure/pillager_outpost/feature_cage_with_allays.nbt +++ b/data/minecraft/structure/pillager_outpost/feature_cage_with_allays.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:97b948c11a141a3de3db8b968f7d260848f98938d829c84eee09c79669a33b9c -size 1797 +oid sha256:2917a5ec67e9a8af746e40e81d933b6a7eb80919129d3259a0efe7f1d95aed06 +size 1791 diff --git a/data/minecraft/structure/pillager_outpost/feature_logs.nbt b/data/minecraft/structure/pillager_outpost/feature_logs.nbt index abc636c9..c1540d27 100644 --- a/data/minecraft/structure/pillager_outpost/feature_logs.nbt +++ b/data/minecraft/structure/pillager_outpost/feature_logs.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ec753eedf767c1468b9087b18b311380c175aa2afa3f30f53abaf5aaeedd00d7 -size 657 +oid sha256:7fc3a2746ea19a737a0506b8f1d750a10f6a4c3f9fc46a3df9d8afd736b686af +size 659 diff --git a/data/minecraft/structure/pillager_outpost/feature_plate.nbt b/data/minecraft/structure/pillager_outpost/feature_plate.nbt index a93ae2c6..1e89b4a1 100644 --- a/data/minecraft/structure/pillager_outpost/feature_plate.nbt +++ b/data/minecraft/structure/pillager_outpost/feature_plate.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9ed6c2975d26b1702504318bdd540c5a11ed6ec8a16bb38cfb54cb10ff1513b7 -size 6037 +oid sha256:16f769a977f8cae5ab50e37ea487a9e4dc267ae8f08458692db0af53520038d8 +size 6039 diff --git a/data/minecraft/structure/pillager_outpost/feature_targets.nbt b/data/minecraft/structure/pillager_outpost/feature_targets.nbt index ab73ac1d..7681b9ce 100644 --- a/data/minecraft/structure/pillager_outpost/feature_targets.nbt +++ b/data/minecraft/structure/pillager_outpost/feature_targets.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a7a276f64c14600f4cf472c7aae43c349f2671d5857855c1154be1e973f5fefe -size 576 +oid sha256:110d83625e62674990558c0beca0a9ecdba545b4e0843644871f50e5a5af1640 +size 579 diff --git a/data/minecraft/structure/pillager_outpost/feature_tent1.nbt b/data/minecraft/structure/pillager_outpost/feature_tent1.nbt index 43117cfe..0f14e8e0 100644 --- a/data/minecraft/structure/pillager_outpost/feature_tent1.nbt +++ b/data/minecraft/structure/pillager_outpost/feature_tent1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:43ca33a68d2976f807369a4991c573fbfdf3931f26a25034c8b4022f9a30e2b9 -size 855 +oid sha256:89a56119aa0d491c8b8146248e81547a4c1ff39c7435a7a2bf14f1b1aebae65d +size 858 diff --git a/data/minecraft/structure/pillager_outpost/feature_tent2.nbt b/data/minecraft/structure/pillager_outpost/feature_tent2.nbt index 7d78ba33..6873eff6 100644 --- a/data/minecraft/structure/pillager_outpost/feature_tent2.nbt +++ b/data/minecraft/structure/pillager_outpost/feature_tent2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:56f214123dc036de4900736f832edc2ca555f20c49f3afed981b50156772fc00 -size 866 +oid sha256:0a48fe62baf5a0e2a168c7c5892b3f08466f457d98ea7c7a8fb601d19902d4eb +size 869 diff --git a/data/minecraft/structure/pillager_outpost/watchtower.nbt b/data/minecraft/structure/pillager_outpost/watchtower.nbt index 1565afc1..3c848e88 100644 --- a/data/minecraft/structure/pillager_outpost/watchtower.nbt +++ b/data/minecraft/structure/pillager_outpost/watchtower.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:22f9051676b3923126d99f85ddf95e715ff19a82f88995d2a9a8ea66bbbb0006 -size 14621 +oid sha256:b4e2620c18527936ba2e2c6cec9368d8e3155c1b330ce7e0b4c156caff6bd5da +size 14626 diff --git a/data/minecraft/structure/pillager_outpost/watchtower_overgrown.nbt b/data/minecraft/structure/pillager_outpost/watchtower_overgrown.nbt index e8b22b23..77bccaa0 100644 --- a/data/minecraft/structure/pillager_outpost/watchtower_overgrown.nbt +++ b/data/minecraft/structure/pillager_outpost/watchtower_overgrown.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ed4cd89d70a03dbcae19c4e099f36042b37eb3cedbb30a74d38f6f4ea3d03445 -size 16060 +oid sha256:80e18cf7f882ccba80ebfc7bfc6e0133ea8e8151054036d0ea4c3525f12f225a +size 16066 diff --git a/data/minecraft/structure/ruined_portal/giant_portal_1.nbt b/data/minecraft/structure/ruined_portal/giant_portal_1.nbt index d3bfc3c9..b0183310 100644 --- a/data/minecraft/structure/ruined_portal/giant_portal_1.nbt +++ b/data/minecraft/structure/ruined_portal/giant_portal_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9d6358a0fc661bc1b184d6311e9dd3717e757f4b293653393184f02f6fc3acde -size 7197 +oid sha256:5aec7645e05d67657f6bb88a22c4546af54b4f9b9339501efa2218dc96969199 +size 7200 diff --git a/data/minecraft/structure/ruined_portal/giant_portal_2.nbt b/data/minecraft/structure/ruined_portal/giant_portal_2.nbt index 004c4d68..937ae692 100644 --- a/data/minecraft/structure/ruined_portal/giant_portal_2.nbt +++ b/data/minecraft/structure/ruined_portal/giant_portal_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1bd4ad999de435fbb22fb371f414a9c89084202e978f3e52e68b9000ba853cb9 -size 6836 +oid sha256:aa1c69163523762d422ddadeb4a5b814a81f7c0e2ba6f62ce83d0c8a4d03a0d9 +size 6839 diff --git a/data/minecraft/structure/ruined_portal/giant_portal_3.nbt b/data/minecraft/structure/ruined_portal/giant_portal_3.nbt index 025e934c..45af5ea5 100644 --- a/data/minecraft/structure/ruined_portal/giant_portal_3.nbt +++ b/data/minecraft/structure/ruined_portal/giant_portal_3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c7caac76603871f7824ee6d97a346e1f290554d306584afc56f8c294f904f888 -size 9896 +oid sha256:b0d9c8665f70f51a76ff99bcaaffbdd5c9ff131ffb5a7c9dc4f17c234f3bfc00 +size 9899 diff --git a/data/minecraft/structure/ruined_portal/portal_1.nbt b/data/minecraft/structure/ruined_portal/portal_1.nbt index 2fca851c..143a1a78 100644 --- a/data/minecraft/structure/ruined_portal/portal_1.nbt +++ b/data/minecraft/structure/ruined_portal/portal_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:80e0369368524c4ec1d832fd763626c76daf245f899bcbf9dee9b4f26b90807d -size 1429 +oid sha256:66359653058b61ded78b6a2cb795fed0106d5e31ba430137adf6f2ec16184d95 +size 1431 diff --git a/data/minecraft/structure/ruined_portal/portal_10.nbt b/data/minecraft/structure/ruined_portal/portal_10.nbt index cf3db8b6..3f406e2f 100644 --- a/data/minecraft/structure/ruined_portal/portal_10.nbt +++ b/data/minecraft/structure/ruined_portal/portal_10.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6ba95496e4a0fd9f197b3bf42f79284396bbd6560958e1693500fef9cfc11940 -size 2877 +oid sha256:8473c776d52707a1c25dbaf2a49f19f4beed16ca5536a375f3fbcb880de5337a +size 2879 diff --git a/data/minecraft/structure/ruined_portal/portal_2.nbt b/data/minecraft/structure/ruined_portal/portal_2.nbt index 5078fa34..661a6892 100644 --- a/data/minecraft/structure/ruined_portal/portal_2.nbt +++ b/data/minecraft/structure/ruined_portal/portal_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:21c3dc179fef8eec0e52806b8309f2a4b172c8fff18189550e9fd9c439f66442 -size 2760 +oid sha256:29fcae023d173c2241f3eee0d6953af2f7679c483574a96943d1cab43905cd99 +size 2762 diff --git a/data/minecraft/structure/ruined_portal/portal_3.nbt b/data/minecraft/structure/ruined_portal/portal_3.nbt index e625ec6e..d80e87f1 100644 --- a/data/minecraft/structure/ruined_portal/portal_3.nbt +++ b/data/minecraft/structure/ruined_portal/portal_3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:36023274285864b9f47b3265047bc41a3687d9b2e6a5dd91f2a81e24c0454356 -size 1992 +oid sha256:3eed0bd38681390c5018d4a47fd30813cb30ad83ec56d6b945a8d8297755f6f3 +size 1994 diff --git a/data/minecraft/structure/ruined_portal/portal_4.nbt b/data/minecraft/structure/ruined_portal/portal_4.nbt index 6b70461b..2808ee59 100644 --- a/data/minecraft/structure/ruined_portal/portal_4.nbt +++ b/data/minecraft/structure/ruined_portal/portal_4.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c9c10fff406611b0e1fe8ecf17aeb4a2ea1b670dfc18d4dffd461cce86ff2473 -size 1883 +oid sha256:4242a7ba8beb240579f42955753f87a10b2e1e1b8bcc3d7f2a1c353934b67a18 +size 1885 diff --git a/data/minecraft/structure/ruined_portal/portal_5.nbt b/data/minecraft/structure/ruined_portal/portal_5.nbt index 12a0a90e..2e08707d 100644 --- a/data/minecraft/structure/ruined_portal/portal_5.nbt +++ b/data/minecraft/structure/ruined_portal/portal_5.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:82ed9fa9595521f6306140b0954a5372914fd0817ef69501dbfb2470031233b6 -size 2213 +oid sha256:279b8efa013905bfc4782f34c40fb7d349ffdfa8056bb64ecd17a68c7102313c +size 2217 diff --git a/data/minecraft/structure/ruined_portal/portal_6.nbt b/data/minecraft/structure/ruined_portal/portal_6.nbt index 8915037d..0f325db2 100644 --- a/data/minecraft/structure/ruined_portal/portal_6.nbt +++ b/data/minecraft/structure/ruined_portal/portal_6.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d41ad34a05ff892c12c0c011c7a33c0b5d647a5d4e26ba73c1bf4ba473ade957 +oid sha256:70776096dd098a0b4c1a9a7c7b0f410256f77d079e3ca0d967580afe9b95bfd5 size 984 diff --git a/data/minecraft/structure/ruined_portal/portal_7.nbt b/data/minecraft/structure/ruined_portal/portal_7.nbt index 4f360872..490dfb7a 100644 --- a/data/minecraft/structure/ruined_portal/portal_7.nbt +++ b/data/minecraft/structure/ruined_portal/portal_7.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a42d0136e729fec126e5166578c53c44a55b36779feee4b3ab3cd8f3dc35b635 -size 1828 +oid sha256:8ae1f49cd84e692d9f0120fa1f32c563f1212acedfce4c887fb44427126b745e +size 1831 diff --git a/data/minecraft/structure/ruined_portal/portal_8.nbt b/data/minecraft/structure/ruined_portal/portal_8.nbt index 5095cfef..c723d07f 100644 --- a/data/minecraft/structure/ruined_portal/portal_8.nbt +++ b/data/minecraft/structure/ruined_portal/portal_8.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:99e58bc1a986394191192db21bb022dd94ca3150dcd387b815ad4cef402a5bd2 -size 3405 +oid sha256:454312234476a36a69fa3bd46f1107b3bd639ee8ea39f87682aa4decb15f2c4d +size 3408 diff --git a/data/minecraft/structure/ruined_portal/portal_9.nbt b/data/minecraft/structure/ruined_portal/portal_9.nbt index 099a0c28..9bb2363e 100644 --- a/data/minecraft/structure/ruined_portal/portal_9.nbt +++ b/data/minecraft/structure/ruined_portal/portal_9.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ee0f94870664d8e618f90f8559b56015779e27f417679434054d481208b6b0e3 -size 2167 +oid sha256:33636d20c75fb1ca0d04ced5d345c9247839cb7a31b2a479b7a8e44e4cc8823c +size 2169 diff --git a/data/minecraft/structure/shipwreck/rightsideup_backhalf.nbt b/data/minecraft/structure/shipwreck/rightsideup_backhalf.nbt index 7ee5ec82..dc353774 100644 --- a/data/minecraft/structure/shipwreck/rightsideup_backhalf.nbt +++ b/data/minecraft/structure/shipwreck/rightsideup_backhalf.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4ceb5e48ba9b06acfa30e2832b154e7175e25302733a7ce8be43a82bc93ac920 -size 2709 +oid sha256:88ac75c02db5a341dd65a233a7e47e12d5c5296d103e87328e34fc8377dfafad +size 2712 diff --git a/data/minecraft/structure/shipwreck/rightsideup_backhalf_degraded.nbt b/data/minecraft/structure/shipwreck/rightsideup_backhalf_degraded.nbt index 6018880b..6a1476f3 100644 --- a/data/minecraft/structure/shipwreck/rightsideup_backhalf_degraded.nbt +++ b/data/minecraft/structure/shipwreck/rightsideup_backhalf_degraded.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7bd1cb7d765bef1ae2c490b551441218545f4f09b0b7a5f5acce8566e76006e7 -size 2567 +oid sha256:ee0c3127f499ff07041bdd3b12e51eeeb2e46f248bb34542a34b56c070c6c40d +size 2570 diff --git a/data/minecraft/structure/shipwreck/rightsideup_fronthalf.nbt b/data/minecraft/structure/shipwreck/rightsideup_fronthalf.nbt index 6f0854bb..e1862594 100644 --- a/data/minecraft/structure/shipwreck/rightsideup_fronthalf.nbt +++ b/data/minecraft/structure/shipwreck/rightsideup_fronthalf.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b92b44f9969d7ae9a69a899ba236ef8fd4c0bdc4fe8874ff543a74b81a0d5abc -size 2473 +oid sha256:539b49257e1a140d99f8e77193c6c3ab9c25e2c47d0502277e1b3bd2a6abfbc6 +size 2476 diff --git a/data/minecraft/structure/shipwreck/rightsideup_fronthalf_degraded.nbt b/data/minecraft/structure/shipwreck/rightsideup_fronthalf_degraded.nbt index c9f25281..098e3ad4 100644 --- a/data/minecraft/structure/shipwreck/rightsideup_fronthalf_degraded.nbt +++ b/data/minecraft/structure/shipwreck/rightsideup_fronthalf_degraded.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3614b9d4d0933e22c6e3db71893f84e76e416209cacce9ea999de7a5ce7fcd66 -size 2250 +oid sha256:74f419cd0690ac8fadc4f79dded031f1171e248530a18b02bfdd6d486fc4fc2f +size 2253 diff --git a/data/minecraft/structure/shipwreck/rightsideup_full.nbt b/data/minecraft/structure/shipwreck/rightsideup_full.nbt index 0d1c0bf5..db47574e 100644 --- a/data/minecraft/structure/shipwreck/rightsideup_full.nbt +++ b/data/minecraft/structure/shipwreck/rightsideup_full.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:658e6f11d94c84e6dfda7eb2241d1f37714df4ff45c7cd8bd234d5ea5d0e1134 -size 3752 +oid sha256:7873a21c71f6cc441134c443d989f4fd8be8f24ff76f1d1f1c8d89c729ce9a4a +size 3755 diff --git a/data/minecraft/structure/shipwreck/rightsideup_full_degraded.nbt b/data/minecraft/structure/shipwreck/rightsideup_full_degraded.nbt index 4c8a4645..1ffbdd26 100644 --- a/data/minecraft/structure/shipwreck/rightsideup_full_degraded.nbt +++ b/data/minecraft/structure/shipwreck/rightsideup_full_degraded.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c0570068d927be89c94677201e5fd3afcf7e0929e73c127351913db817828cf9 -size 3525 +oid sha256:ae69adfc712e81a136c05257a7aa7982616b89ab844e1e20b33e7fbb30c36fbd +size 3528 diff --git a/data/minecraft/structure/shipwreck/sideways_backhalf.nbt b/data/minecraft/structure/shipwreck/sideways_backhalf.nbt index ecf6ded5..162274ea 100644 --- a/data/minecraft/structure/shipwreck/sideways_backhalf.nbt +++ b/data/minecraft/structure/shipwreck/sideways_backhalf.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b52014d8b73682ba721caba7918212e8e996d87ed6a819348a57186934c5a108 -size 2433 +oid sha256:245eca5ad3787717caf98fccdda617608cdd6db4583be4941a62985259a773c0 +size 2436 diff --git a/data/minecraft/structure/shipwreck/sideways_backhalf_degraded.nbt b/data/minecraft/structure/shipwreck/sideways_backhalf_degraded.nbt index 2e710fb8..09583499 100644 --- a/data/minecraft/structure/shipwreck/sideways_backhalf_degraded.nbt +++ b/data/minecraft/structure/shipwreck/sideways_backhalf_degraded.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a8ecbca559f7fa7131aa8a656028c867c25848b3c596c8f282ca2adfcde633d0 -size 2256 +oid sha256:b0b110521e4868bea2008d0385f7c7c91bd4c8275c1eac056cc2411510347bd0 +size 2259 diff --git a/data/minecraft/structure/shipwreck/sideways_fronthalf.nbt b/data/minecraft/structure/shipwreck/sideways_fronthalf.nbt index fda90d11..c9a73324 100644 --- a/data/minecraft/structure/shipwreck/sideways_fronthalf.nbt +++ b/data/minecraft/structure/shipwreck/sideways_fronthalf.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:24805522fe1613e94f5521080edd148131326cffd2d7d2d7d48643b9085d2b07 -size 2201 +oid sha256:320a906908bd0ceeeb27fa63be8abaa679c278bdda95fb94c2eeb2705f782625 +size 2204 diff --git a/data/minecraft/structure/shipwreck/sideways_fronthalf_degraded.nbt b/data/minecraft/structure/shipwreck/sideways_fronthalf_degraded.nbt index 0ca1e371..6b043990 100644 --- a/data/minecraft/structure/shipwreck/sideways_fronthalf_degraded.nbt +++ b/data/minecraft/structure/shipwreck/sideways_fronthalf_degraded.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b9bc932567e6f00788944b8cdfc32f7a5eadc2c16974020fe46e22d181af14e8 -size 1911 +oid sha256:e1071bd76e0453ec0304bbb9263a27e97364b104827553308be657a0db7e7057 +size 1913 diff --git a/data/minecraft/structure/shipwreck/sideways_full.nbt b/data/minecraft/structure/shipwreck/sideways_full.nbt index d6b0c882..2fe4ef48 100644 --- a/data/minecraft/structure/shipwreck/sideways_full.nbt +++ b/data/minecraft/structure/shipwreck/sideways_full.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:75471c1314d2322bbecfbe7b43b52d14af8d8800f21fd11f1c45060f8b1c1305 -size 3509 +oid sha256:0efee48ff10ef300700ba824d48dbcdce85cfcfb2c54ea9f14a9aaae3472bc52 +size 3512 diff --git a/data/minecraft/structure/shipwreck/sideways_full_degraded.nbt b/data/minecraft/structure/shipwreck/sideways_full_degraded.nbt index db2f8834..f4f7bd51 100644 --- a/data/minecraft/structure/shipwreck/sideways_full_degraded.nbt +++ b/data/minecraft/structure/shipwreck/sideways_full_degraded.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:83d6c0b59f9678530785cdfc21b17438ae3e105d9f3b94c7e4ecce1d157a4312 -size 3305 +oid sha256:abf88ff5d1619de3615d3db0823c0fcb5ec336fe9c7e2bd153970dd891ddf6b1 +size 3309 diff --git a/data/minecraft/structure/shipwreck/upsidedown_backhalf.nbt b/data/minecraft/structure/shipwreck/upsidedown_backhalf.nbt index 524c927b..d72c3f19 100644 --- a/data/minecraft/structure/shipwreck/upsidedown_backhalf.nbt +++ b/data/minecraft/structure/shipwreck/upsidedown_backhalf.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d9b2599a3492122bacc438358dd0c1fa3ffc93f201ba38daf08ed530f17997ac -size 2515 +oid sha256:14f4d1ef0b7903be093c2ef8208a182955c0806b419dd486ff3aaf2f68bb1de7 +size 2518 diff --git a/data/minecraft/structure/shipwreck/upsidedown_backhalf_degraded.nbt b/data/minecraft/structure/shipwreck/upsidedown_backhalf_degraded.nbt index 8cf7f3be..5cce7760 100644 --- a/data/minecraft/structure/shipwreck/upsidedown_backhalf_degraded.nbt +++ b/data/minecraft/structure/shipwreck/upsidedown_backhalf_degraded.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:569339d0f2c3ed7afbdd0dfc948dc0111e7c6c4c322138f84604451dd982d68b -size 2386 +oid sha256:2d2be47ff0a4ffa094a347e22c2366cd48e4bf830c418361da02bb9fc607580e +size 2388 diff --git a/data/minecraft/structure/shipwreck/upsidedown_fronthalf.nbt b/data/minecraft/structure/shipwreck/upsidedown_fronthalf.nbt index 7f54672e..6a52c50a 100644 --- a/data/minecraft/structure/shipwreck/upsidedown_fronthalf.nbt +++ b/data/minecraft/structure/shipwreck/upsidedown_fronthalf.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:183b4507bdd0113fb44b4f18cca2dac6ac610cc9f0cfaa0560d5aa3c1a03f824 -size 2321 +oid sha256:012872e09bfffd5c5ecd05c1eacb04e9933087e76eb391f359debbbb567fb866 +size 2325 diff --git a/data/minecraft/structure/shipwreck/upsidedown_fronthalf_degraded.nbt b/data/minecraft/structure/shipwreck/upsidedown_fronthalf_degraded.nbt index 0f666cfc..522fdcce 100644 --- a/data/minecraft/structure/shipwreck/upsidedown_fronthalf_degraded.nbt +++ b/data/minecraft/structure/shipwreck/upsidedown_fronthalf_degraded.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:26edbc604dd8a58ddc9ee04d72e8d8e112be9c4041587dbac253012d35bf3d88 -size 2208 +oid sha256:9c72716f64d6d9be3a4d9654373a4935de470149ed1a27c890d7049ca2611c75 +size 2210 diff --git a/data/minecraft/structure/shipwreck/upsidedown_full.nbt b/data/minecraft/structure/shipwreck/upsidedown_full.nbt index f5557119..d698fa45 100644 --- a/data/minecraft/structure/shipwreck/upsidedown_full.nbt +++ b/data/minecraft/structure/shipwreck/upsidedown_full.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1c3108d9c2e056eb17b1afa4815ddac5eadc83130f2c1221dc9c574ae83da825 -size 3468 +oid sha256:9a2d2b84dd5d5be4d2ae8a1856061c15c29be67e7b61b0e0847be9f785cbb460 +size 3470 diff --git a/data/minecraft/structure/shipwreck/upsidedown_full_degraded.nbt b/data/minecraft/structure/shipwreck/upsidedown_full_degraded.nbt index 143d2528..ad8bedd8 100644 --- a/data/minecraft/structure/shipwreck/upsidedown_full_degraded.nbt +++ b/data/minecraft/structure/shipwreck/upsidedown_full_degraded.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:416d66e0f2abc6ef2c7cc23eebf3df09d6038e2fdb8bdb2cb8a798375921c86f -size 3297 +oid sha256:0228e0006dbf04684f7a694eaef7d1154992e064de52c9fb668c07492f1a5fb3 +size 3299 diff --git a/data/minecraft/structure/shipwreck/with_mast.nbt b/data/minecraft/structure/shipwreck/with_mast.nbt index 23e733de..7dc37d88 100644 --- a/data/minecraft/structure/shipwreck/with_mast.nbt +++ b/data/minecraft/structure/shipwreck/with_mast.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8fd6bf17d16fcf0ef07a3cb702e461eaff3db624e68c158e654255491a6f644e -size 3958 +oid sha256:11d225fbdf2a1e809eb34642de546ad9189f011ecf821f7600d1979bccea7e7b +size 3960 diff --git a/data/minecraft/structure/shipwreck/with_mast_degraded.nbt b/data/minecraft/structure/shipwreck/with_mast_degraded.nbt index bb3bb9a6..2bb3b272 100644 --- a/data/minecraft/structure/shipwreck/with_mast_degraded.nbt +++ b/data/minecraft/structure/shipwreck/with_mast_degraded.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:76b167f884cac949ec25f5be5ac8bbad33ef6b01627a3d6508c302385dd29e8d -size 3683 +oid sha256:b8b9afe9a2e87a269bd10c0f054ce14719e084053120707d09532c58dfedadea +size 3686 diff --git a/data/minecraft/structure/trail_ruins/buildings/group_full_1.nbt b/data/minecraft/structure/trail_ruins/buildings/group_full_1.nbt index 337e24b0..28e71fde 100644 --- a/data/minecraft/structure/trail_ruins/buildings/group_full_1.nbt +++ b/data/minecraft/structure/trail_ruins/buildings/group_full_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5694dccc2d70ac01208b3f842784ec592954fb751408d4b3f332f47256bb579a -size 1337 +oid sha256:f3edabd8ead989d7c3629133f00db13f7d3d0acfa2540e867afa64249679eab2 +size 1339 diff --git a/data/minecraft/structure/trail_ruins/buildings/group_full_2.nbt b/data/minecraft/structure/trail_ruins/buildings/group_full_2.nbt index 395b4869..aef238aa 100644 --- a/data/minecraft/structure/trail_ruins/buildings/group_full_2.nbt +++ b/data/minecraft/structure/trail_ruins/buildings/group_full_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3d80f6256dea8379cde9a2aa6c1bac56c1d3db0d01a4402518e9690dc81dfa65 -size 1278 +oid sha256:8c003c228001b636753fdb4156e6964033835caebf4ad70e08f13cc4e4533e93 +size 1281 diff --git a/data/minecraft/structure/trail_ruins/buildings/group_full_3.nbt b/data/minecraft/structure/trail_ruins/buildings/group_full_3.nbt index 522185ba..905ed84e 100644 --- a/data/minecraft/structure/trail_ruins/buildings/group_full_3.nbt +++ b/data/minecraft/structure/trail_ruins/buildings/group_full_3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:cce5f26d5de9e1439f0fb928f64ec87f00214966b02a17577eb5d886f21d16db -size 1297 +oid sha256:438615c7934b0d68e5ed9cbb95867f3deb7846d3d548280f2296ccca4563503f +size 1299 diff --git a/data/minecraft/structure/trail_ruins/buildings/group_full_4.nbt b/data/minecraft/structure/trail_ruins/buildings/group_full_4.nbt index 0ad3e02b..6ede56f3 100644 --- a/data/minecraft/structure/trail_ruins/buildings/group_full_4.nbt +++ b/data/minecraft/structure/trail_ruins/buildings/group_full_4.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:907f7c73a07b176446fee144b2c2a9128041d87473172e1e7306497836802412 -size 1261 +oid sha256:a6f69e09c60138eac1f0be174ba2cb55267b51303e9be4b3bca266e8be0c8258 +size 1263 diff --git a/data/minecraft/structure/trail_ruins/buildings/group_full_5.nbt b/data/minecraft/structure/trail_ruins/buildings/group_full_5.nbt index 1361ba89..f074a890 100644 --- a/data/minecraft/structure/trail_ruins/buildings/group_full_5.nbt +++ b/data/minecraft/structure/trail_ruins/buildings/group_full_5.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:49204fa8b222e08543fe35385359fbcb4cfa442f1c4e5d7669fda287950be742 -size 1258 +oid sha256:3691f0371bacb18fe24d33e0dea328ac77f491a3beca964c1162e10f0476c2b4 +size 1261 diff --git a/data/minecraft/structure/trail_ruins/buildings/group_hall_1.nbt b/data/minecraft/structure/trail_ruins/buildings/group_hall_1.nbt index 1922e21f..2954532b 100644 --- a/data/minecraft/structure/trail_ruins/buildings/group_hall_1.nbt +++ b/data/minecraft/structure/trail_ruins/buildings/group_hall_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7aebd7e2df970d4aa2f02084956ed6af5507e896bd92e2ab8977e49611ce709b -size 1515 +oid sha256:36475fcebdbe45514f016d93bcf6d6a4a2e2d5ef5ac9abd6db0a602392f24069 +size 1517 diff --git a/data/minecraft/structure/trail_ruins/buildings/group_hall_2.nbt b/data/minecraft/structure/trail_ruins/buildings/group_hall_2.nbt index 3418893f..64b0a779 100644 --- a/data/minecraft/structure/trail_ruins/buildings/group_hall_2.nbt +++ b/data/minecraft/structure/trail_ruins/buildings/group_hall_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d223c75cb4fd71d81332e67a6b4b490f78562258236c99eb4cb99fd4cafffab0 -size 1614 +oid sha256:ad82c6edf89dc42c5a3f184c03de1ac789e6bc1d9483b706320ef6e3c72ce58c +size 1616 diff --git a/data/minecraft/structure/trail_ruins/buildings/group_hall_3.nbt b/data/minecraft/structure/trail_ruins/buildings/group_hall_3.nbt index 716518ae..e32baca8 100644 --- a/data/minecraft/structure/trail_ruins/buildings/group_hall_3.nbt +++ b/data/minecraft/structure/trail_ruins/buildings/group_hall_3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ec5f3687a2249ee5c5446f25f2d3703b0b19a9abbb99587137137e8abf33a22d -size 1713 +oid sha256:8541c43e4a230ef0c31f7e874f762c2b51aaed55f20a85d23edbadf004efbcd7 +size 1716 diff --git a/data/minecraft/structure/trail_ruins/buildings/group_hall_4.nbt b/data/minecraft/structure/trail_ruins/buildings/group_hall_4.nbt index b408e324..1fd53eca 100644 --- a/data/minecraft/structure/trail_ruins/buildings/group_hall_4.nbt +++ b/data/minecraft/structure/trail_ruins/buildings/group_hall_4.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ecb3626ddc4f593f7a7842c4dfb80420f49ad2f50be437c56da95baefb6ce737 -size 1638 +oid sha256:a056698d9ec7de4eece376d5b5a1e2d490cf5d048f9d08a6d363c76560ff3399 +size 1640 diff --git a/data/minecraft/structure/trail_ruins/buildings/group_hall_5.nbt b/data/minecraft/structure/trail_ruins/buildings/group_hall_5.nbt index 52e1cf12..dd71bbd2 100644 --- a/data/minecraft/structure/trail_ruins/buildings/group_hall_5.nbt +++ b/data/minecraft/structure/trail_ruins/buildings/group_hall_5.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b60214a842c97b8e378ee05a8244ca7801b8e47842f978bba0d5df97bc6d82c1 -size 1524 +oid sha256:be8af6356ce8acf414b9f10fc9b83e675d68ee862501454c36fa7358027ccd00 +size 1526 diff --git a/data/minecraft/structure/trail_ruins/buildings/group_lower_1.nbt b/data/minecraft/structure/trail_ruins/buildings/group_lower_1.nbt index 5fe0183b..c28be45e 100644 --- a/data/minecraft/structure/trail_ruins/buildings/group_lower_1.nbt +++ b/data/minecraft/structure/trail_ruins/buildings/group_lower_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e66d2f805cd02435c4943eca55bbae8fcf5db2b025a11f91f537f7cb28415930 -size 1045 +oid sha256:e9cc573070490282a4bc7152afad5b497d7faa4056329f1c51a0ac92505ab653 +size 1047 diff --git a/data/minecraft/structure/trail_ruins/buildings/group_lower_2.nbt b/data/minecraft/structure/trail_ruins/buildings/group_lower_2.nbt index 963a0ca5..56883d54 100644 --- a/data/minecraft/structure/trail_ruins/buildings/group_lower_2.nbt +++ b/data/minecraft/structure/trail_ruins/buildings/group_lower_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0abaa48794ca30460957a1bf5d7771dd0e94d0ae05a20dd31677aa68c7ca7fa8 -size 1041 +oid sha256:e85bc96cffa3bbbbcecae2504bd3be4a342a85e1d44ea2288596f1861fb0d674 +size 1044 diff --git a/data/minecraft/structure/trail_ruins/buildings/group_lower_3.nbt b/data/minecraft/structure/trail_ruins/buildings/group_lower_3.nbt index 93702091..4b35716e 100644 --- a/data/minecraft/structure/trail_ruins/buildings/group_lower_3.nbt +++ b/data/minecraft/structure/trail_ruins/buildings/group_lower_3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d7b294a93f6ae7bb92935b93e54fe50f80cefa0d29879bc2108664e119a2ab5b -size 1045 +oid sha256:a0653956c74e4b9b9ed1c5003e1b27afaa22a130e85bd0b8e3ba347caf5e5427 +size 1047 diff --git a/data/minecraft/structure/trail_ruins/buildings/group_lower_4.nbt b/data/minecraft/structure/trail_ruins/buildings/group_lower_4.nbt index fb15b980..8f9ed81f 100644 --- a/data/minecraft/structure/trail_ruins/buildings/group_lower_4.nbt +++ b/data/minecraft/structure/trail_ruins/buildings/group_lower_4.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:59f33c6071141ba25746b05a9a481628bf3ae24f15608bebe31bea435c631b7c -size 972 +oid sha256:e22de6478d1ed7f7942f85342aac24fdaf57baf0f21b143ebad96fbd2c1ba75b +size 975 diff --git a/data/minecraft/structure/trail_ruins/buildings/group_lower_5.nbt b/data/minecraft/structure/trail_ruins/buildings/group_lower_5.nbt index 82120c61..abe38373 100644 --- a/data/minecraft/structure/trail_ruins/buildings/group_lower_5.nbt +++ b/data/minecraft/structure/trail_ruins/buildings/group_lower_5.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2e07a2d65b925b6f29927026614bd2f5df533cbf23acc20bd499fb89dfba454f -size 970 +oid sha256:6f8c2d9955cad333f69dfb57d2edfe73a7caa0bf8d27b85d66f7effa89d4b963 +size 973 diff --git a/data/minecraft/structure/trail_ruins/buildings/group_room_1.nbt b/data/minecraft/structure/trail_ruins/buildings/group_room_1.nbt index 467a2a58..0b7a6c8a 100644 --- a/data/minecraft/structure/trail_ruins/buildings/group_room_1.nbt +++ b/data/minecraft/structure/trail_ruins/buildings/group_room_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:eb6c3957364350cd85de83a6166db5752af561db344882ce36449083023996cd -size 779 +oid sha256:3165636202d2fc5fa974a7412f5177a05cddf0ecb3a268c45aad5a6e9f795dcf +size 781 diff --git a/data/minecraft/structure/trail_ruins/buildings/group_room_2.nbt b/data/minecraft/structure/trail_ruins/buildings/group_room_2.nbt index 604c4517..6dd10933 100644 --- a/data/minecraft/structure/trail_ruins/buildings/group_room_2.nbt +++ b/data/minecraft/structure/trail_ruins/buildings/group_room_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5941896aa814e6dff3925331d6ff7dcd3b160b5983e4342673b01effeb81b162 -size 861 +oid sha256:9a0890b3d99730e53f876591c365a64aac51e9dad94e1b282fc1e5ca768e5742 +size 864 diff --git a/data/minecraft/structure/trail_ruins/buildings/group_room_3.nbt b/data/minecraft/structure/trail_ruins/buildings/group_room_3.nbt index 85e7ee81..51a07e8e 100644 --- a/data/minecraft/structure/trail_ruins/buildings/group_room_3.nbt +++ b/data/minecraft/structure/trail_ruins/buildings/group_room_3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:037cc654832dd7649d1e972d69179e24082661e26dadd52809cbe30016954731 -size 845 +oid sha256:5424c2e01e59600ae617999d8853aca452ca616041d400784a0fb27d5002bcf3 +size 848 diff --git a/data/minecraft/structure/trail_ruins/buildings/group_room_4.nbt b/data/minecraft/structure/trail_ruins/buildings/group_room_4.nbt index 6c9824df..f2a30a73 100644 --- a/data/minecraft/structure/trail_ruins/buildings/group_room_4.nbt +++ b/data/minecraft/structure/trail_ruins/buildings/group_room_4.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:28c580547a260d45125368966c9fb1ae46c965cfd17ccb99580d0bd11ebf654a -size 778 +oid sha256:62a35bcd7981d08b0038721080ff534215bb56e70eb909248e741c26cc6c2f9f +size 781 diff --git a/data/minecraft/structure/trail_ruins/buildings/group_room_5.nbt b/data/minecraft/structure/trail_ruins/buildings/group_room_5.nbt index 1dfa1c71..b0ef6047 100644 --- a/data/minecraft/structure/trail_ruins/buildings/group_room_5.nbt +++ b/data/minecraft/structure/trail_ruins/buildings/group_room_5.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:43ce99c2d7c7792673fb290c0f688aad7adaa127ff5b43fd976ec712b4d0c31e -size 777 +oid sha256:48ffa595e5c35216675d00f6a05869b26380e37ed22696f10d22605420fa899a +size 779 diff --git a/data/minecraft/structure/trail_ruins/buildings/group_upper_1.nbt b/data/minecraft/structure/trail_ruins/buildings/group_upper_1.nbt index 3c67aa7e..8dc2fe70 100644 --- a/data/minecraft/structure/trail_ruins/buildings/group_upper_1.nbt +++ b/data/minecraft/structure/trail_ruins/buildings/group_upper_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0b054dba6e09c6d95a3af05f437a50fc3ecbbadb6904998b2e623c80b319a2f1 -size 1267 +oid sha256:ebfee836ac50c4eb0cc307c7f16a6e5aeb0f5e41bfe02ee5bb7c6c825eb5afd6 +size 1270 diff --git a/data/minecraft/structure/trail_ruins/buildings/group_upper_2.nbt b/data/minecraft/structure/trail_ruins/buildings/group_upper_2.nbt index ab685b2f..6f6f984d 100644 --- a/data/minecraft/structure/trail_ruins/buildings/group_upper_2.nbt +++ b/data/minecraft/structure/trail_ruins/buildings/group_upper_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ca70f2b42c70915797cad742e982e69c0b16e558e45d9cf33d3c81e64655d336 -size 1260 +oid sha256:3fd6ece105a9be8263da1f38387117879f9b7b827f310d3aee58fa0bdcb1ca1e +size 1263 diff --git a/data/minecraft/structure/trail_ruins/buildings/group_upper_3.nbt b/data/minecraft/structure/trail_ruins/buildings/group_upper_3.nbt index a9eec5fa..97c3d2db 100644 --- a/data/minecraft/structure/trail_ruins/buildings/group_upper_3.nbt +++ b/data/minecraft/structure/trail_ruins/buildings/group_upper_3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:515fff79be642284fb2c98f6749a746cdbac7fd5c3d40904ca737074d3686984 -size 1271 +oid sha256:5784082cb0405d6d26f66d25178f4609f4a377ac54921588afc75747867b892d +size 1274 diff --git a/data/minecraft/structure/trail_ruins/buildings/group_upper_4.nbt b/data/minecraft/structure/trail_ruins/buildings/group_upper_4.nbt index 5b872f25..fb4a6dce 100644 --- a/data/minecraft/structure/trail_ruins/buildings/group_upper_4.nbt +++ b/data/minecraft/structure/trail_ruins/buildings/group_upper_4.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:60527a7cc510f7e780440e9f61560346bde58293e6149bcaf2283abef612ac25 -size 1179 +oid sha256:dfecef9d196b528eaecbc41aafb7cd162c39b3df35f111bd79dfc9e59c3989a0 +size 1182 diff --git a/data/minecraft/structure/trail_ruins/buildings/group_upper_5.nbt b/data/minecraft/structure/trail_ruins/buildings/group_upper_5.nbt index 40499103..c743f68f 100644 --- a/data/minecraft/structure/trail_ruins/buildings/group_upper_5.nbt +++ b/data/minecraft/structure/trail_ruins/buildings/group_upper_5.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8b126a666cb09b7a7a39a58421ba4254c03f18ce12292675c5bc05790ef20808 -size 1175 +oid sha256:ea7b6ea7a8c3f67c7845cef122053d3d463607222f030f823660ba701e9fbb90 +size 1178 diff --git a/data/minecraft/structure/trail_ruins/buildings/large_room_1.nbt b/data/minecraft/structure/trail_ruins/buildings/large_room_1.nbt index ec53d1b3..b96c27d6 100644 --- a/data/minecraft/structure/trail_ruins/buildings/large_room_1.nbt +++ b/data/minecraft/structure/trail_ruins/buildings/large_room_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9724a1edc4b42e6f0af3926282a3a8ee5d678b0fa60f9c5bfd9548dd455a1b04 -size 1925 +oid sha256:a1afaf95c454362cf4de5154d9d97843e7ca63553e91cfb0fa21ba5f04d5c7c6 +size 1928 diff --git a/data/minecraft/structure/trail_ruins/buildings/large_room_2.nbt b/data/minecraft/structure/trail_ruins/buildings/large_room_2.nbt index 2835b65e..d3de89e0 100644 --- a/data/minecraft/structure/trail_ruins/buildings/large_room_2.nbt +++ b/data/minecraft/structure/trail_ruins/buildings/large_room_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:eb2846f0a413e59ff0049c2fdceeff3f34cf4ec50ec70777b2e3bf571ba12001 -size 1655 +oid sha256:68efceceefc9133ef1e57087b1f45643fdf3fafeb242b0c372c54b68f3c8a74e +size 1658 diff --git a/data/minecraft/structure/trail_ruins/buildings/large_room_3.nbt b/data/minecraft/structure/trail_ruins/buildings/large_room_3.nbt index 7f4107e3..ff920d79 100644 --- a/data/minecraft/structure/trail_ruins/buildings/large_room_3.nbt +++ b/data/minecraft/structure/trail_ruins/buildings/large_room_3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8ab7faa0ec8bf83f7d824e3c0f99646fd3ff612aac143186853e14c8447775a4 -size 2706 +oid sha256:91c408cb19abe729e0c78223f01463c355090b19be9c023a44fe8ab23662dc6a +size 2707 diff --git a/data/minecraft/structure/trail_ruins/buildings/large_room_4.nbt b/data/minecraft/structure/trail_ruins/buildings/large_room_4.nbt index 54930320..d3266518 100644 --- a/data/minecraft/structure/trail_ruins/buildings/large_room_4.nbt +++ b/data/minecraft/structure/trail_ruins/buildings/large_room_4.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3d4a9fc07ab51e3659b33517007ab4dd0b5bbd605984656f2fd130eb71d1388c -size 1561 +oid sha256:8fffddd073b88b1807771a6ff0456f51f2f6cc29124d37c2796c6e6bda911961 +size 1564 diff --git a/data/minecraft/structure/trail_ruins/buildings/large_room_5.nbt b/data/minecraft/structure/trail_ruins/buildings/large_room_5.nbt index 8d398723..8fc34aa1 100644 --- a/data/minecraft/structure/trail_ruins/buildings/large_room_5.nbt +++ b/data/minecraft/structure/trail_ruins/buildings/large_room_5.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:603a3ecfdf4c3f9e89b75a8ad96af48fd739427524c3dc7573c080b703633a71 -size 3196 +oid sha256:ac39c94083e29df0fbbda812de93eb12b60d4cf23446f33571b7ddc9c7d2fa86 +size 3199 diff --git a/data/minecraft/structure/trail_ruins/buildings/one_room_1.nbt b/data/minecraft/structure/trail_ruins/buildings/one_room_1.nbt index 77bad8fc..4855e7e3 100644 --- a/data/minecraft/structure/trail_ruins/buildings/one_room_1.nbt +++ b/data/minecraft/structure/trail_ruins/buildings/one_room_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:72b600d280149b479fe3208a239f22387aa62d697a6eea25c09bd5d5bd6f2176 -size 1003 +oid sha256:3d21369a613e160ac3a27ca026ee17425a8ff24db6f0b59222376bd4a8d22980 +size 1005 diff --git a/data/minecraft/structure/trail_ruins/buildings/one_room_2.nbt b/data/minecraft/structure/trail_ruins/buildings/one_room_2.nbt index bf503949..82bea60f 100644 --- a/data/minecraft/structure/trail_ruins/buildings/one_room_2.nbt +++ b/data/minecraft/structure/trail_ruins/buildings/one_room_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9790a3fb9896c90e861529114d210c87811a0c0270396516c4b18350f8eedc42 -size 1084 +oid sha256:683fe1a6e7b91d96867b8e56451f57e45f5b9173af0f24f38db386401706199a +size 1087 diff --git a/data/minecraft/structure/trail_ruins/buildings/one_room_3.nbt b/data/minecraft/structure/trail_ruins/buildings/one_room_3.nbt index 5ded186d..70d7b9e6 100644 --- a/data/minecraft/structure/trail_ruins/buildings/one_room_3.nbt +++ b/data/minecraft/structure/trail_ruins/buildings/one_room_3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9e9fe585fad27a3f44f3f09faa9dc093db94a94c3d17b5086949e152585a9b2b -size 1103 +oid sha256:651193f6d36f41c46edc28e8d49ec8d5a63fcb72765a48be6f9b954c417fe275 +size 1105 diff --git a/data/minecraft/structure/trail_ruins/buildings/one_room_4.nbt b/data/minecraft/structure/trail_ruins/buildings/one_room_4.nbt index 81f494ec..ca3dccaf 100644 --- a/data/minecraft/structure/trail_ruins/buildings/one_room_4.nbt +++ b/data/minecraft/structure/trail_ruins/buildings/one_room_4.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:cbb71d2ed348e2158142b567e51f1f60e3a39f75f6f0869c423303e69d7e44dd -size 1450 +oid sha256:b22122fd210fe470d98ec477825e02a3c7151c922891e62eda19cb552e642d38 +size 1452 diff --git a/data/minecraft/structure/trail_ruins/buildings/one_room_5.nbt b/data/minecraft/structure/trail_ruins/buildings/one_room_5.nbt index 7c055aed..30077168 100644 --- a/data/minecraft/structure/trail_ruins/buildings/one_room_5.nbt +++ b/data/minecraft/structure/trail_ruins/buildings/one_room_5.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d1e373bb61f2e6533d708609eaf0e122851593a0f9583e93834fc810e580d62c -size 971 +oid sha256:efaa6df0e7c3db1fe9c96bd54b90c6d4cde6184058f1e37efa6c725fc25033a5 +size 973 diff --git a/data/minecraft/structure/trail_ruins/decor/decor_1.nbt b/data/minecraft/structure/trail_ruins/decor/decor_1.nbt index 32294520..72802846 100644 --- a/data/minecraft/structure/trail_ruins/decor/decor_1.nbt +++ b/data/minecraft/structure/trail_ruins/decor/decor_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:aefcd9e00a2d8fbdbe2d533370bb8a4213fbdd5b1d776867c538a6181e234cbf -size 486 +oid sha256:8b147857f6327e5c672634165709f8b14706248d09537f0847c7fcfac96c3a7c +size 489 diff --git a/data/minecraft/structure/trail_ruins/decor/decor_2.nbt b/data/minecraft/structure/trail_ruins/decor/decor_2.nbt index 7a86f739..4b2c0f8f 100644 --- a/data/minecraft/structure/trail_ruins/decor/decor_2.nbt +++ b/data/minecraft/structure/trail_ruins/decor/decor_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:866386ca12ec591433a6c2d56c3e8969b9f4d2218ef96d05482497d6ea216e9c -size 469 +oid sha256:e586b4fc874c807f15c91b93cbae0b52336fa638b1a29afc3a675305d05d2516 +size 471 diff --git a/data/minecraft/structure/trail_ruins/decor/decor_3.nbt b/data/minecraft/structure/trail_ruins/decor/decor_3.nbt index 7d6a72ca..60fcc3af 100644 --- a/data/minecraft/structure/trail_ruins/decor/decor_3.nbt +++ b/data/minecraft/structure/trail_ruins/decor/decor_3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b8ca685ce79cfb5bedbd8c42175fcd918acb5bfe3b6102ef4e5e58abc74fdd44 -size 374 +oid sha256:f32bbd04e258bb633271fb072e2ed0b52b1c7aecedc4d8eb28c820204ee3ad52 +size 377 diff --git a/data/minecraft/structure/trail_ruins/decor/decor_4.nbt b/data/minecraft/structure/trail_ruins/decor/decor_4.nbt index 04fc8d53..1077065e 100644 --- a/data/minecraft/structure/trail_ruins/decor/decor_4.nbt +++ b/data/minecraft/structure/trail_ruins/decor/decor_4.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d380bc8332444ed9e94b7cbc6a8c7ee9b244d22372812e94c74565bc7a26d298 -size 414 +oid sha256:36610ed70289460a5386883304a774b1959db7bedb70438022edf791ed42227a +size 417 diff --git a/data/minecraft/structure/trail_ruins/decor/decor_5.nbt b/data/minecraft/structure/trail_ruins/decor/decor_5.nbt index 6a9f1c82..594e3a6a 100644 --- a/data/minecraft/structure/trail_ruins/decor/decor_5.nbt +++ b/data/minecraft/structure/trail_ruins/decor/decor_5.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1f9c80da1ff81fa61e507af2ba9b8d70308114a2599a144bbc20921871bec870 -size 490 +oid sha256:3d0a3dd73f46ad4a3ef9e1050e05cbbecf24ab420a54d4c56b98fc3f18cf8e3e +size 492 diff --git a/data/minecraft/structure/trail_ruins/decor/decor_6.nbt b/data/minecraft/structure/trail_ruins/decor/decor_6.nbt index 1c8d09f3..205bf275 100644 --- a/data/minecraft/structure/trail_ruins/decor/decor_6.nbt +++ b/data/minecraft/structure/trail_ruins/decor/decor_6.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d41924cec1c8f1671720b94c6700946543ad1837d878c4c133ba3a6dfa075b53 -size 504 +oid sha256:f2f0aeac0871a754c077135ae64ea9b95d9417183f73721fde72d3ee598e7422 +size 506 diff --git a/data/minecraft/structure/trail_ruins/decor/decor_7.nbt b/data/minecraft/structure/trail_ruins/decor/decor_7.nbt index 56a74fc3..72591c84 100644 --- a/data/minecraft/structure/trail_ruins/decor/decor_7.nbt +++ b/data/minecraft/structure/trail_ruins/decor/decor_7.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c7264bb5abe0d87c099cde3fdd58d85789d242f1f9431892317d84bae90a09fb -size 629 +oid sha256:377ac91e2cff0c3172502a8b0ea9cbfc438ad36d376ef1c3c3f85f088fae15e9 +size 632 diff --git a/data/minecraft/structure/trail_ruins/roads/long_road_end.nbt b/data/minecraft/structure/trail_ruins/roads/long_road_end.nbt index ae42a740..4eaadb1c 100644 --- a/data/minecraft/structure/trail_ruins/roads/long_road_end.nbt +++ b/data/minecraft/structure/trail_ruins/roads/long_road_end.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5a966e879b9015b4e59066a22dca3d5f2c91270d7424aa97ffcc6e2136470d40 -size 856 +oid sha256:dca45e7d1e6535476b49886f4248a2b71344146efd952e019878d53a6f871c27 +size 858 diff --git a/data/minecraft/structure/trail_ruins/roads/road_end_1.nbt b/data/minecraft/structure/trail_ruins/roads/road_end_1.nbt index 24958fbd..83a2c9ef 100644 --- a/data/minecraft/structure/trail_ruins/roads/road_end_1.nbt +++ b/data/minecraft/structure/trail_ruins/roads/road_end_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8d90b0c54711f8410d6821e9a98d1995cce41bec3e1125c75f89d4733276fbd1 -size 465 +oid sha256:0f2b46fcc91199ad929cf471b6dcb58d4e275ed6c1b079eb35a44111559515fc +size 468 diff --git a/data/minecraft/structure/trail_ruins/roads/road_section_1.nbt b/data/minecraft/structure/trail_ruins/roads/road_section_1.nbt index 450059e6..ed623d31 100644 --- a/data/minecraft/structure/trail_ruins/roads/road_section_1.nbt +++ b/data/minecraft/structure/trail_ruins/roads/road_section_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f8a760cb13d3185cffdd62a1d3a4a9f496bfd848a450406d146fc75cc98677cd -size 703 +oid sha256:1492feecddaa0236730eef288a4eff0c8ecda8e44fd6362e12b80c64780ccc0d +size 706 diff --git a/data/minecraft/structure/trail_ruins/roads/road_section_2.nbt b/data/minecraft/structure/trail_ruins/roads/road_section_2.nbt index 2ca6f579..4944ce25 100644 --- a/data/minecraft/structure/trail_ruins/roads/road_section_2.nbt +++ b/data/minecraft/structure/trail_ruins/roads/road_section_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8d45c3936a141f4db899f5962f3dea51e24ac159727a68464152894a62804b8f -size 717 +oid sha256:8e8a215faaa740f0e8ca7a92f8c94c6628576581ef260c169c86cd01bdeb35a1 +size 719 diff --git a/data/minecraft/structure/trail_ruins/roads/road_section_3.nbt b/data/minecraft/structure/trail_ruins/roads/road_section_3.nbt index bb465ec9..af06bf60 100644 --- a/data/minecraft/structure/trail_ruins/roads/road_section_3.nbt +++ b/data/minecraft/structure/trail_ruins/roads/road_section_3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:61f74848a8cefd45eb7d8574e24c53dab512f9091aba5503d99a2607be76a9d4 -size 754 +oid sha256:36cfaca0741570d9c0eb99e3b3f276f5c865c2185d840b1ac9df4bfd4308360b +size 757 diff --git a/data/minecraft/structure/trail_ruins/roads/road_section_4.nbt b/data/minecraft/structure/trail_ruins/roads/road_section_4.nbt index 3b62830b..f39f853e 100644 --- a/data/minecraft/structure/trail_ruins/roads/road_section_4.nbt +++ b/data/minecraft/structure/trail_ruins/roads/road_section_4.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:705ff6d8227e7e180b61dab2b1e63c0ae019eaec3c81a59cd4e7c37fc7939194 -size 770 +oid sha256:4c64d05c3eaf10c9ee5390b427b5cb6ddfd7e05761e2b66e806ecb092a0af79c +size 772 diff --git a/data/minecraft/structure/trail_ruins/roads/road_spacer_1.nbt b/data/minecraft/structure/trail_ruins/roads/road_spacer_1.nbt index ec2eb7df..dd3dea2c 100644 --- a/data/minecraft/structure/trail_ruins/roads/road_spacer_1.nbt +++ b/data/minecraft/structure/trail_ruins/roads/road_spacer_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:bdf532687a61ad6de63f9b32f237eb8f99f5412bb71e170f7498f86b7e597cc0 -size 642 +oid sha256:c1f5a573000214408c12c708f66863492cfdb9ebaaa0a16828e704848f53a0d2 +size 644 diff --git a/data/minecraft/structure/trail_ruins/tower/hall_1.nbt b/data/minecraft/structure/trail_ruins/tower/hall_1.nbt index 0b69fe38..eab86fb6 100644 --- a/data/minecraft/structure/trail_ruins/tower/hall_1.nbt +++ b/data/minecraft/structure/trail_ruins/tower/hall_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:309de3d6f954222f9c10dfe493b3f492d5e67dfcc37e1e7007543e9b297264cd -size 1517 +oid sha256:aace8db0442daa2d89ed43fee3379c62fda25b41e3a7991ca16aeffe06d60445 +size 1519 diff --git a/data/minecraft/structure/trail_ruins/tower/hall_2.nbt b/data/minecraft/structure/trail_ruins/tower/hall_2.nbt index ae0249bc..3b3d210b 100644 --- a/data/minecraft/structure/trail_ruins/tower/hall_2.nbt +++ b/data/minecraft/structure/trail_ruins/tower/hall_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f59be9c23f07db3d3bd5b81f1782ea4c53467e771905051ba1649297ea987e64 -size 1891 +oid sha256:0d50170661cfc0b4ff856d6f475dd0164f35bb816c76b70d73a5ae82b146d4e5 +size 1894 diff --git a/data/minecraft/structure/trail_ruins/tower/hall_3.nbt b/data/minecraft/structure/trail_ruins/tower/hall_3.nbt index 9acbb1eb..5567cf9b 100644 --- a/data/minecraft/structure/trail_ruins/tower/hall_3.nbt +++ b/data/minecraft/structure/trail_ruins/tower/hall_3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d06bf4888ef013229b544e4a601d55247428e1cf9728368fdfb12a7c94a30179 -size 2137 +oid sha256:925eb81a5777401ff36cb893a3ed13a3327021ecee64aaec181a259dee563d82 +size 2140 diff --git a/data/minecraft/structure/trail_ruins/tower/hall_4.nbt b/data/minecraft/structure/trail_ruins/tower/hall_4.nbt index c64e81a2..ef4f1d68 100644 --- a/data/minecraft/structure/trail_ruins/tower/hall_4.nbt +++ b/data/minecraft/structure/trail_ruins/tower/hall_4.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:61a5cd35d212794307a4aa0e04269552d0e8dd0267b114b6caefe83d0b8dcb09 -size 2029 +oid sha256:f8b9a56ee7f0c1a773e6b420e8895c60d32b7e7400d55123027b1deff9242504 +size 2031 diff --git a/data/minecraft/structure/trail_ruins/tower/hall_5.nbt b/data/minecraft/structure/trail_ruins/tower/hall_5.nbt index ce6a439c..97dd6c22 100644 --- a/data/minecraft/structure/trail_ruins/tower/hall_5.nbt +++ b/data/minecraft/structure/trail_ruins/tower/hall_5.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:bf49a4c1d7c5f38b7d25ea0c7d98de0d9efb5f92e1997eff3e57879ca58216e8 -size 1870 +oid sha256:352e10ed0ed5c1dcbeaaf2b55ef5a00a45cb7b672f23f99bd2570249b60fb2d6 +size 1873 diff --git a/data/minecraft/structure/trail_ruins/tower/large_hall_1.nbt b/data/minecraft/structure/trail_ruins/tower/large_hall_1.nbt index c9138f2e..a710b4b8 100644 --- a/data/minecraft/structure/trail_ruins/tower/large_hall_1.nbt +++ b/data/minecraft/structure/trail_ruins/tower/large_hall_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c377c3b6169686bfcee832d78c635bd808c2fc03b4536caff9e10801640d450b -size 2022 +oid sha256:c00396a61ba4eb4f64885e330b205db5e762f2b4996203c65c0d5ed8e4daf47b +size 2024 diff --git a/data/minecraft/structure/trail_ruins/tower/large_hall_2.nbt b/data/minecraft/structure/trail_ruins/tower/large_hall_2.nbt index fb59132e..08e28ca6 100644 --- a/data/minecraft/structure/trail_ruins/tower/large_hall_2.nbt +++ b/data/minecraft/structure/trail_ruins/tower/large_hall_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5df4b8ec47564065376d35c3fb7e741c37c3538a91653b8b8434610fdcaeaf6c -size 1963 +oid sha256:99938bd044f2d3596435dc9d03fe5e4e33c53c5ec46cec13caec6fedd81a9198 +size 1966 diff --git a/data/minecraft/structure/trail_ruins/tower/large_hall_3.nbt b/data/minecraft/structure/trail_ruins/tower/large_hall_3.nbt index 5f904a1e..36a4e2f0 100644 --- a/data/minecraft/structure/trail_ruins/tower/large_hall_3.nbt +++ b/data/minecraft/structure/trail_ruins/tower/large_hall_3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4234a1dee901fff39155ecd7d5cb0d61f91af41d27c95b22dccfe6724b0a66bb -size 2022 +oid sha256:d34575e59737ae33fd67f0888aa63cc62eddb7ed907c907f397d85b37af63f5b +size 2023 diff --git a/data/minecraft/structure/trail_ruins/tower/large_hall_4.nbt b/data/minecraft/structure/trail_ruins/tower/large_hall_4.nbt index 56cbf672..74fda1d0 100644 --- a/data/minecraft/structure/trail_ruins/tower/large_hall_4.nbt +++ b/data/minecraft/structure/trail_ruins/tower/large_hall_4.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:24c7d98cc4d069bc2c521cd798eb73d0423765ae577359ab4eecff93cb92e2aa -size 1805 +oid sha256:8c23690f9b443fbe8fed3e84e56f91aeb49f06a7430cd28796cb9e27a546ec47 +size 1807 diff --git a/data/minecraft/structure/trail_ruins/tower/large_hall_5.nbt b/data/minecraft/structure/trail_ruins/tower/large_hall_5.nbt index 720a5854..5e71ff51 100644 --- a/data/minecraft/structure/trail_ruins/tower/large_hall_5.nbt +++ b/data/minecraft/structure/trail_ruins/tower/large_hall_5.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:751ee154833ad83c3291ee9da37674aaeea6a73970aee45de74c336fe0d639c0 -size 2000 +oid sha256:e8e82b81f437fc18ff4740fc35ba3426453c260cb2d2ce5a6f42eb519af58b28 +size 2003 diff --git a/data/minecraft/structure/trail_ruins/tower/one_room_1.nbt b/data/minecraft/structure/trail_ruins/tower/one_room_1.nbt index 6d01488a..d885bd90 100644 --- a/data/minecraft/structure/trail_ruins/tower/one_room_1.nbt +++ b/data/minecraft/structure/trail_ruins/tower/one_room_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:aa0004c3b26eda9f9d449ee665e6c7793b12511eca3377ec5c29da250feaa685 -size 647 +oid sha256:3f6b85c2011c20f586298f3d2064db0b5883087332c90d68a3ba716dc7f577e2 +size 649 diff --git a/data/minecraft/structure/trail_ruins/tower/one_room_2.nbt b/data/minecraft/structure/trail_ruins/tower/one_room_2.nbt index b20940ae..6c28bc65 100644 --- a/data/minecraft/structure/trail_ruins/tower/one_room_2.nbt +++ b/data/minecraft/structure/trail_ruins/tower/one_room_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b69a3f51a664de8ab647c58c0bad99d0934b1a272aee97df13647b1cae82719f -size 716 +oid sha256:4634937ae75f450a8810f5ec929c3c8d9edb2873ae14fda0ccfab29087b6612a +size 718 diff --git a/data/minecraft/structure/trail_ruins/tower/one_room_3.nbt b/data/minecraft/structure/trail_ruins/tower/one_room_3.nbt index 51984eab..714be720 100644 --- a/data/minecraft/structure/trail_ruins/tower/one_room_3.nbt +++ b/data/minecraft/structure/trail_ruins/tower/one_room_3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1a62a554209647fff12b4422d483c35f596d8fa38fe0a9308a592ef157ff492f -size 620 +oid sha256:9f97da7e7c81e0ce2e2f72865f8cbf32bad5882622122affb02d8ba20060c918 +size 624 diff --git a/data/minecraft/structure/trail_ruins/tower/one_room_4.nbt b/data/minecraft/structure/trail_ruins/tower/one_room_4.nbt index f1b3289a..082ed204 100644 --- a/data/minecraft/structure/trail_ruins/tower/one_room_4.nbt +++ b/data/minecraft/structure/trail_ruins/tower/one_room_4.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3c2e455f165ee7525a23d234d218cd3507db2ed6984d58917b225783484c1758 -size 613 +oid sha256:272de34f8545f76fe7e68a4c7918f957b595d4184960f582ad1df219620389b3 +size 615 diff --git a/data/minecraft/structure/trail_ruins/tower/one_room_5.nbt b/data/minecraft/structure/trail_ruins/tower/one_room_5.nbt index 91ed9d9a..05801f82 100644 --- a/data/minecraft/structure/trail_ruins/tower/one_room_5.nbt +++ b/data/minecraft/structure/trail_ruins/tower/one_room_5.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:12edb0a26f69c09dcc839cb37187d19480583030bd62abcf9e2ef9cb396435dc -size 635 +oid sha256:4ee260eb8905f93145dfb730061eb05e2d3769d86e528cb329d2e4d4a3dc70a5 +size 637 diff --git a/data/minecraft/structure/trail_ruins/tower/platform_1.nbt b/data/minecraft/structure/trail_ruins/tower/platform_1.nbt index b31fd123..dab628f1 100644 --- a/data/minecraft/structure/trail_ruins/tower/platform_1.nbt +++ b/data/minecraft/structure/trail_ruins/tower/platform_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3ce733f20a68da103ee7334485aad794d77d78d4753b49bb85057df69e7a3a07 -size 1194 +oid sha256:1d69da5aeb753f8d513d4e1c8ab3527d6807c0b29559f09ad41957b31b88aaad +size 1197 diff --git a/data/minecraft/structure/trail_ruins/tower/platform_2.nbt b/data/minecraft/structure/trail_ruins/tower/platform_2.nbt index 83a8f499..f87b812d 100644 --- a/data/minecraft/structure/trail_ruins/tower/platform_2.nbt +++ b/data/minecraft/structure/trail_ruins/tower/platform_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4dff8277725b934fd2185a01fff933ab61aa8bde4db25abab29b852a11b67251 -size 1133 +oid sha256:3a44f3833df783a910392e769776d0e6298b7c0a3a31dab47ca1ff66246d771f +size 1135 diff --git a/data/minecraft/structure/trail_ruins/tower/platform_3.nbt b/data/minecraft/structure/trail_ruins/tower/platform_3.nbt index 9d5a850b..cfde8ab6 100644 --- a/data/minecraft/structure/trail_ruins/tower/platform_3.nbt +++ b/data/minecraft/structure/trail_ruins/tower/platform_3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c3da28a857a1dfd99dd719303c2be537e20b8e5b449b135f60de9cf7476778bd -size 857 +oid sha256:6ba1d9240132316d3f47c3eb8dc9449208f51b017680a07dd7f15ff7bcba29ff +size 859 diff --git a/data/minecraft/structure/trail_ruins/tower/platform_4.nbt b/data/minecraft/structure/trail_ruins/tower/platform_4.nbt index e71c6e5d..0e25a545 100644 --- a/data/minecraft/structure/trail_ruins/tower/platform_4.nbt +++ b/data/minecraft/structure/trail_ruins/tower/platform_4.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:12716f68b8ba0a540529ada952277ca100d00f9a96d4f7f29d2680f401d16f5d -size 1204 +oid sha256:d197dbc9355625237ca90712b23dc95267222a72bf79420f7db0885450d4b4c4 +size 1205 diff --git a/data/minecraft/structure/trail_ruins/tower/platform_5.nbt b/data/minecraft/structure/trail_ruins/tower/platform_5.nbt index 08d374e1..74443e74 100644 --- a/data/minecraft/structure/trail_ruins/tower/platform_5.nbt +++ b/data/minecraft/structure/trail_ruins/tower/platform_5.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:584472f8b22adf6eb232d34d2d9605bb8c0f57372460e6bf9bc01fc44a4e5194 -size 1145 +oid sha256:76b88e5aa700b5cabfcb5591121d08db89d697286f182ba5cef8fa5ba463c49b +size 1146 diff --git a/data/minecraft/structure/trail_ruins/tower/stable_1.nbt b/data/minecraft/structure/trail_ruins/tower/stable_1.nbt index 67ff075a..92a1f16a 100644 --- a/data/minecraft/structure/trail_ruins/tower/stable_1.nbt +++ b/data/minecraft/structure/trail_ruins/tower/stable_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c07e0029f27cccd1417ca56794d04a8fc4916920b0dbec66d56ddfe1124bf476 -size 1271 +oid sha256:357a59e54f2b1d613fc28fb9aba5612e4493811d555edf387811ccd5bf643175 +size 1274 diff --git a/data/minecraft/structure/trail_ruins/tower/stable_2.nbt b/data/minecraft/structure/trail_ruins/tower/stable_2.nbt index d7aa2fbd..9f137543 100644 --- a/data/minecraft/structure/trail_ruins/tower/stable_2.nbt +++ b/data/minecraft/structure/trail_ruins/tower/stable_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:dc3cd00bc5b57da3344f42bab69254f99a5f0d96ef72170159ecf49338af1404 -size 1289 +oid sha256:5a67e42ed23734b3eb3b4883cda95faa35e29b08678e69043db14d5158a91931 +size 1292 diff --git a/data/minecraft/structure/trail_ruins/tower/stable_3.nbt b/data/minecraft/structure/trail_ruins/tower/stable_3.nbt index d43b8ab4..6ca7eac9 100644 --- a/data/minecraft/structure/trail_ruins/tower/stable_3.nbt +++ b/data/minecraft/structure/trail_ruins/tower/stable_3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:de267c5a88f7eec0c861ac408d5b3deca8b3850c5d3ffe6060afcbf118eb345a -size 1254 +oid sha256:a88920dade946166e332738f4c7c422b0885145a635edf3d54219ee7542799ae +size 1256 diff --git a/data/minecraft/structure/trail_ruins/tower/stable_4.nbt b/data/minecraft/structure/trail_ruins/tower/stable_4.nbt index 9eae4ff3..7b07269c 100644 --- a/data/minecraft/structure/trail_ruins/tower/stable_4.nbt +++ b/data/minecraft/structure/trail_ruins/tower/stable_4.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2d505f964a594c83527a7366efa2c503bdb0af95899ccf7800824427605e351a -size 1288 +oid sha256:b620e45a7078427155bf427432f324474600a05107833ff125b97e8fc909834a +size 1290 diff --git a/data/minecraft/structure/trail_ruins/tower/stable_5.nbt b/data/minecraft/structure/trail_ruins/tower/stable_5.nbt index 550c0b7d..05be770c 100644 --- a/data/minecraft/structure/trail_ruins/tower/stable_5.nbt +++ b/data/minecraft/structure/trail_ruins/tower/stable_5.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f7aad2bdac11efc3ce5b4fd3687f6421cdc7e15b88684eaad74d12c87a75730b +oid sha256:3742859d85fd5e501d0df1e3dd38e9eed147de3ef7385a4a951704e936f34713 size 1034 diff --git a/data/minecraft/structure/trail_ruins/tower/tower_1.nbt b/data/minecraft/structure/trail_ruins/tower/tower_1.nbt index 7619c8aa..4cefeabb 100644 --- a/data/minecraft/structure/trail_ruins/tower/tower_1.nbt +++ b/data/minecraft/structure/trail_ruins/tower/tower_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f006f8ec97ca2c35ed73028f1466c944d6db20842a7fae6c2399972adf4e8abe -size 1583 +oid sha256:42263a978250b817ab6e037be24a749227a7f8404be35534e637a0c851f285a8 +size 1585 diff --git a/data/minecraft/structure/trail_ruins/tower/tower_2.nbt b/data/minecraft/structure/trail_ruins/tower/tower_2.nbt index 596650c6..2a88cd5f 100644 --- a/data/minecraft/structure/trail_ruins/tower/tower_2.nbt +++ b/data/minecraft/structure/trail_ruins/tower/tower_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7dd28532ffaaaa76555f777f6ed2bfb4fe232fdac67784bcad3a2988c2465d31 -size 1615 +oid sha256:e5a8a2fcfe0efd23767590f8d3236caf7bb8418a9f38150b973297a83c035a9e +size 1619 diff --git a/data/minecraft/structure/trail_ruins/tower/tower_3.nbt b/data/minecraft/structure/trail_ruins/tower/tower_3.nbt index 31f53bf9..3fc9d606 100644 --- a/data/minecraft/structure/trail_ruins/tower/tower_3.nbt +++ b/data/minecraft/structure/trail_ruins/tower/tower_3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e104b857ba6ac8122ede6cec9ab72068548daf3a0a5d6bd1bd8d6f0594e1daa9 -size 2226 +oid sha256:dbb878bbf5fd0e5d4bf0d568a22ee4cb1723ec62667a7a8d71f10f3e36bc6125 +size 2229 diff --git a/data/minecraft/structure/trail_ruins/tower/tower_4.nbt b/data/minecraft/structure/trail_ruins/tower/tower_4.nbt index 699f238d..e2396cd2 100644 --- a/data/minecraft/structure/trail_ruins/tower/tower_4.nbt +++ b/data/minecraft/structure/trail_ruins/tower/tower_4.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e488721e3f2be0f1d46febd701fd029668d18d06b277bf080fd0c2bd67ef3e65 -size 2088 +oid sha256:5bdb66ec8d6ba254463a32ab21e638b1cc0f59d8123e802a6780e2e251c307d3 +size 2091 diff --git a/data/minecraft/structure/trail_ruins/tower/tower_5.nbt b/data/minecraft/structure/trail_ruins/tower/tower_5.nbt index 4c307f36..d7a6d0f0 100644 --- a/data/minecraft/structure/trail_ruins/tower/tower_5.nbt +++ b/data/minecraft/structure/trail_ruins/tower/tower_5.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3dc4b1c37654092b92bb14080488cfa3da9848adb0269cac580cff574a151011 -size 2059 +oid sha256:e9c3311b0426f052c65885a8e9dcd7054e6a1356b416231920126610df3b5212 +size 2062 diff --git a/data/minecraft/structure/trail_ruins/tower/tower_top_1.nbt b/data/minecraft/structure/trail_ruins/tower/tower_top_1.nbt index a1b88fdd..1e6e9681 100644 --- a/data/minecraft/structure/trail_ruins/tower/tower_top_1.nbt +++ b/data/minecraft/structure/trail_ruins/tower/tower_top_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0275764dffbe40c7c0431559016db0d24744f89c539a9fac2cf9a503d1c4e3d4 -size 503 +oid sha256:43cd70527a2dc69b41521cb1b45169eb287d1cd96a270cdd5e219192dccfb7dc +size 505 diff --git a/data/minecraft/structure/trail_ruins/tower/tower_top_2.nbt b/data/minecraft/structure/trail_ruins/tower/tower_top_2.nbt index 81d3b425..11196131 100644 --- a/data/minecraft/structure/trail_ruins/tower/tower_top_2.nbt +++ b/data/minecraft/structure/trail_ruins/tower/tower_top_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:473ad87edca1fd2e87f0010e53e2dddee89581892a20a1551b4b18e1e914b70f -size 519 +oid sha256:cf28cb465323d8c894289a03d7adcfaf6db09ed3948d78ab11a83dd9ed067d83 +size 522 diff --git a/data/minecraft/structure/trail_ruins/tower/tower_top_3.nbt b/data/minecraft/structure/trail_ruins/tower/tower_top_3.nbt index 73dce7da..0c7e757e 100644 --- a/data/minecraft/structure/trail_ruins/tower/tower_top_3.nbt +++ b/data/minecraft/structure/trail_ruins/tower/tower_top_3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3f24118296eb8ef87f8d40949c050ddf675b36ee4711bb93b3bebb4d963d0047 -size 499 +oid sha256:1aac2bb990b5f11706340a670ce625efc7ace5ac92c17a29eb00589268ba4188 +size 501 diff --git a/data/minecraft/structure/trail_ruins/tower/tower_top_4.nbt b/data/minecraft/structure/trail_ruins/tower/tower_top_4.nbt index cffd3d50..e36d08b3 100644 --- a/data/minecraft/structure/trail_ruins/tower/tower_top_4.nbt +++ b/data/minecraft/structure/trail_ruins/tower/tower_top_4.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b7ad466a2bf452784baa43dd834b92f9f7fd6685696b9b10a92947058b7f7f26 -size 478 +oid sha256:cad2083c9a62a6b90bcfa8446c33b5b94449db811dfd837d22ffe07a1105bc70 +size 481 diff --git a/data/minecraft/structure/trail_ruins/tower/tower_top_5.nbt b/data/minecraft/structure/trail_ruins/tower/tower_top_5.nbt index a989d481..5aa37363 100644 --- a/data/minecraft/structure/trail_ruins/tower/tower_top_5.nbt +++ b/data/minecraft/structure/trail_ruins/tower/tower_top_5.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:198c3d6e40b1a1054c3e93041de3bb3a42a965539d11a2d76502d4cd783f1824 -size 404 +oid sha256:bfe534512a0b25a6b6f5c6b94d1f604ea6f875ef58f7427349dfbd4f97ca7748 +size 406 diff --git a/data/minecraft/structure/trial_chambers/chamber/addon/c1_breeze.nbt b/data/minecraft/structure/trial_chambers/chamber/addon/c1_breeze.nbt index 730477d0..30850f90 100644 --- a/data/minecraft/structure/trial_chambers/chamber/addon/c1_breeze.nbt +++ b/data/minecraft/structure/trial_chambers/chamber/addon/c1_breeze.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e9640e3fd73aaa8f224b3d8666da697f2e8247e4b2f5c76c5d384fa590c1bde9 -size 1692 +oid sha256:b2f0956554d743f89db96537185b5c2c735502b91327a76c24359f5b0d83b406 +size 1695 diff --git a/data/minecraft/structure/trial_chambers/chamber/addon/full_corner_column.nbt b/data/minecraft/structure/trial_chambers/chamber/addon/full_corner_column.nbt index 75d4ebfa..1ee47e68 100644 --- a/data/minecraft/structure/trial_chambers/chamber/addon/full_corner_column.nbt +++ b/data/minecraft/structure/trial_chambers/chamber/addon/full_corner_column.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d59c1ad9c73ed1520390bc046d016c08af445dd50289f691433f7e15344efe12 -size 4097 +oid sha256:cfe5634dd5566284cb4154d8f892ecde7f290169ee7217fb840bd460b2c5da8e +size 4157 diff --git a/data/minecraft/structure/trial_chambers/chamber/addon/full_stacked_walkway.nbt b/data/minecraft/structure/trial_chambers/chamber/addon/full_stacked_walkway.nbt index d68d367b..06646a4e 100644 --- a/data/minecraft/structure/trial_chambers/chamber/addon/full_stacked_walkway.nbt +++ b/data/minecraft/structure/trial_chambers/chamber/addon/full_stacked_walkway.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:02ed7f1fb651ce011cb116c96773420d1a7f8b8e66742f3f203169c7e8a4699b -size 4266 +oid sha256:4e0b29781cf75dcb4e27481fa69b8314089ba0bf1d9e4cd4755108d8b024da9f +size 4337 diff --git a/data/minecraft/structure/trial_chambers/chamber/addon/full_stacked_walkway_2.nbt b/data/minecraft/structure/trial_chambers/chamber/addon/full_stacked_walkway_2.nbt index 8e8bb9c6..15a4e8f6 100644 --- a/data/minecraft/structure/trial_chambers/chamber/addon/full_stacked_walkway_2.nbt +++ b/data/minecraft/structure/trial_chambers/chamber/addon/full_stacked_walkway_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e92cd010f01c397eb350ae42bd4aea870eeb797acb4ebf5d068ae83b18b790eb -size 4277 +oid sha256:73f3041c520eae198d3a87c133d4c598b33313f23afda5180bfd526490d9fe11 +size 4281 diff --git a/data/minecraft/structure/trial_chambers/chamber/addon/grate_bridge.nbt b/data/minecraft/structure/trial_chambers/chamber/addon/grate_bridge.nbt index 16c3cb94..55d41ef1 100644 --- a/data/minecraft/structure/trial_chambers/chamber/addon/grate_bridge.nbt +++ b/data/minecraft/structure/trial_chambers/chamber/addon/grate_bridge.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:78775c5108040ebd3c67040fe256531627443932bfda05321d59f27493365afb -size 1751 +oid sha256:f87cefb2ad2ad4e122037708a67ccd3bc47ddb7c913ce6f647e13bba3f9bf6c6 +size 1754 diff --git a/data/minecraft/structure/trial_chambers/chamber/addon/hanging_platform.nbt b/data/minecraft/structure/trial_chambers/chamber/addon/hanging_platform.nbt index 5943ca53..f5125b74 100644 --- a/data/minecraft/structure/trial_chambers/chamber/addon/hanging_platform.nbt +++ b/data/minecraft/structure/trial_chambers/chamber/addon/hanging_platform.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f20e69834e9299b59187bc7b9600551230dfd4c5885100e7e477ea120d765c1e -size 485 +oid sha256:45c8c8fb9b5d0c883ef2c89969cc4cb7a56e9c55c77c2e3cb5e8045290d49ef9 +size 488 diff --git a/data/minecraft/structure/trial_chambers/chamber/addon/lower_staircase_down.nbt b/data/minecraft/structure/trial_chambers/chamber/addon/lower_staircase_down.nbt index d6120c33..1931d6fa 100644 --- a/data/minecraft/structure/trial_chambers/chamber/addon/lower_staircase_down.nbt +++ b/data/minecraft/structure/trial_chambers/chamber/addon/lower_staircase_down.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5cc0f33b135b3c62e7ef6332a76e7018747f2087bcd94efadec2c149eac8f5ee -size 427 +oid sha256:9cf3420592c60b1c121d1c39c80644082544d9643864e6acf28bd3d50b8f26ca +size 429 diff --git a/data/minecraft/structure/trial_chambers/chamber/addon/short_grate_platform.nbt b/data/minecraft/structure/trial_chambers/chamber/addon/short_grate_platform.nbt index 989f48a5..aadc1e1f 100644 --- a/data/minecraft/structure/trial_chambers/chamber/addon/short_grate_platform.nbt +++ b/data/minecraft/structure/trial_chambers/chamber/addon/short_grate_platform.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7de0d3f387b1a446b4c1a1de9759a2803ebeb4d7d469ac065c5657583a6ed161 -size 798 +oid sha256:e4c0f9d681b317cf9d13aa41fa6634451890bc76ca513f3d8beb0afe62328aed +size 800 diff --git a/data/minecraft/structure/trial_chambers/chamber/addon/short_platform.nbt b/data/minecraft/structure/trial_chambers/chamber/addon/short_platform.nbt index 2a3b0c4e..80035461 100644 --- a/data/minecraft/structure/trial_chambers/chamber/addon/short_platform.nbt +++ b/data/minecraft/structure/trial_chambers/chamber/addon/short_platform.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:983b234f1da406b55cc8e0dd3181263243547fc72239e0ceb2cbefad4a3b5b90 -size 582 +oid sha256:56033368149e989bc32f03c453143770d94500d1a915fd32f9eed014dec73dab +size 585 diff --git a/data/minecraft/structure/trial_chambers/chamber/addon/walkway_with_bridge_1.nbt b/data/minecraft/structure/trial_chambers/chamber/addon/walkway_with_bridge_1.nbt index c242aeb2..5b4c2833 100644 --- a/data/minecraft/structure/trial_chambers/chamber/addon/walkway_with_bridge_1.nbt +++ b/data/minecraft/structure/trial_chambers/chamber/addon/walkway_with_bridge_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ccced75b1b2ad08ff56f4734141c2c948b77ac649c2e0e566010990b677c6854 -size 6219 +oid sha256:eacbcc5b3014b64b2d264f5222a372a8090005e9e829e8bbc761c455b4a9bc56 +size 6221 diff --git a/data/minecraft/structure/trial_chambers/chamber/assembly.nbt b/data/minecraft/structure/trial_chambers/chamber/assembly.nbt index a6ac47bd..4f51d409 100644 --- a/data/minecraft/structure/trial_chambers/chamber/assembly.nbt +++ b/data/minecraft/structure/trial_chambers/chamber/assembly.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:aff59223a6db7d39bf5f1e47c1470c220053eaf51f9792fea7ae1150d41404b8 -size 54428 +oid sha256:7d1ee1233406632af692b79334a39e249694f4460fa215061ce6b719b3229c6e +size 54409 diff --git a/data/minecraft/structure/trial_chambers/chamber/assembly/cover_1.nbt b/data/minecraft/structure/trial_chambers/chamber/assembly/cover_1.nbt index bc6b20b2..508954ca 100644 --- a/data/minecraft/structure/trial_chambers/chamber/assembly/cover_1.nbt +++ b/data/minecraft/structure/trial_chambers/chamber/assembly/cover_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:59a521e0ed43600667aa6bc8c3bd8bc920180a76c2d16c675b9fa54dfc5ad20b -size 955 +oid sha256:3810610a9224353718222a0f9d8c88573925baeeaeab02be5029984b48210660 +size 957 diff --git a/data/minecraft/structure/trial_chambers/chamber/assembly/cover_2.nbt b/data/minecraft/structure/trial_chambers/chamber/assembly/cover_2.nbt index 3d3bcbba..f01a56e1 100644 --- a/data/minecraft/structure/trial_chambers/chamber/assembly/cover_2.nbt +++ b/data/minecraft/structure/trial_chambers/chamber/assembly/cover_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b8a739026203e8ab69478814c8e9861d48515db04717891ccfc67df68d11f163 -size 948 +oid sha256:3f77cf5791f97af8b448400a7f9a8aead7aebaaae3598699d1364cf9e6d20558 +size 950 diff --git a/data/minecraft/structure/trial_chambers/chamber/assembly/cover_3.nbt b/data/minecraft/structure/trial_chambers/chamber/assembly/cover_3.nbt index f2f5b4e0..80ba4f99 100644 --- a/data/minecraft/structure/trial_chambers/chamber/assembly/cover_3.nbt +++ b/data/minecraft/structure/trial_chambers/chamber/assembly/cover_3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:fb9f804a4a314d8c46e770b5889a4f84d39e03683ab2e065fd47c3f35fb5b248 -size 955 +oid sha256:9a3d06a2646f96a7c8e3cf41d37c7cb4ea4cac75dbde6d4219d6c81f79ebb10e +size 957 diff --git a/data/minecraft/structure/trial_chambers/chamber/assembly/cover_4.nbt b/data/minecraft/structure/trial_chambers/chamber/assembly/cover_4.nbt index a98dda4b..4f455f49 100644 --- a/data/minecraft/structure/trial_chambers/chamber/assembly/cover_4.nbt +++ b/data/minecraft/structure/trial_chambers/chamber/assembly/cover_4.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ee8e29e36e03c6907cec00b6cc64008711f4741073d09d9257a97e3c2fb498d9 -size 951 +oid sha256:fbbc8541aa65ca67224cfb6debf8b6a59fa14219c6177499e39e27dcf88c6c78 +size 953 diff --git a/data/minecraft/structure/trial_chambers/chamber/assembly/cover_5.nbt b/data/minecraft/structure/trial_chambers/chamber/assembly/cover_5.nbt index c95eccd1..20842998 100644 --- a/data/minecraft/structure/trial_chambers/chamber/assembly/cover_5.nbt +++ b/data/minecraft/structure/trial_chambers/chamber/assembly/cover_5.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5a74907f41842182af978f31508f5a324df3f4a20c83eec2a380f822a9bf2e00 -size 1022 +oid sha256:4ff8ed33855a91d0661781bc5b73e047a106d8d78b398ebb962cd71a172dd1b4 +size 1025 diff --git a/data/minecraft/structure/trial_chambers/chamber/assembly/cover_6.nbt b/data/minecraft/structure/trial_chambers/chamber/assembly/cover_6.nbt index 8653cba5..fda36062 100644 --- a/data/minecraft/structure/trial_chambers/chamber/assembly/cover_6.nbt +++ b/data/minecraft/structure/trial_chambers/chamber/assembly/cover_6.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a7af97b66e20d281cfa460fd22d7aeb86c0902248c954c526d1c833447765e21 -size 1020 +oid sha256:98b0767de4b5641d8232071ec255a1f136a39a65c33cb47aa76b8f1e06d59d7d +size 1022 diff --git a/data/minecraft/structure/trial_chambers/chamber/assembly/cover_7.nbt b/data/minecraft/structure/trial_chambers/chamber/assembly/cover_7.nbt index 39105cb0..d4f5e395 100644 --- a/data/minecraft/structure/trial_chambers/chamber/assembly/cover_7.nbt +++ b/data/minecraft/structure/trial_chambers/chamber/assembly/cover_7.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:84413b96c7458ec254fce1e7653da39c5148ef761e4240a95d2a5dd8800dab27 -size 753 +oid sha256:538aa063c74803efa924a14d426a75f3e697f13041ee84d24081f8b1127517ef +size 756 diff --git a/data/minecraft/structure/trial_chambers/chamber/assembly/full_column.nbt b/data/minecraft/structure/trial_chambers/chamber/assembly/full_column.nbt index ef60eb33..4dc61efc 100644 --- a/data/minecraft/structure/trial_chambers/chamber/assembly/full_column.nbt +++ b/data/minecraft/structure/trial_chambers/chamber/assembly/full_column.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:80566975ab9cf003e43665e95f51cd5d547c1501a556e0993615e376a85f760b -size 659 +oid sha256:241144093a2dcf3ad1703265d75b156f797e32df87cacc745728007edbd9dc51 +size 661 diff --git a/data/minecraft/structure/trial_chambers/chamber/assembly/hanging_1.nbt b/data/minecraft/structure/trial_chambers/chamber/assembly/hanging_1.nbt index 27c99ed2..c05d9ea9 100644 --- a/data/minecraft/structure/trial_chambers/chamber/assembly/hanging_1.nbt +++ b/data/minecraft/structure/trial_chambers/chamber/assembly/hanging_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:045fc1c5ceb37a97b6c27a698df6e87d929068456d8696d497249e59489d6bfc -size 584 +oid sha256:1512506a345701a1685d2862d28dad50f135b0b452c0198122243f45a3f75932 +size 587 diff --git a/data/minecraft/structure/trial_chambers/chamber/assembly/hanging_2.nbt b/data/minecraft/structure/trial_chambers/chamber/assembly/hanging_2.nbt index 2065fac5..14d149d5 100644 --- a/data/minecraft/structure/trial_chambers/chamber/assembly/hanging_2.nbt +++ b/data/minecraft/structure/trial_chambers/chamber/assembly/hanging_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6fbed8179e786b5c76386148c77fbc2e7d86605b5f2ba1f2093e66191ea51acb -size 866 +oid sha256:0b32a947d9f82c550716d48b3751bfe55585d422cc3b328506bf2d6d365d1f56 +size 869 diff --git a/data/minecraft/structure/trial_chambers/chamber/assembly/hanging_3.nbt b/data/minecraft/structure/trial_chambers/chamber/assembly/hanging_3.nbt index 2a071175..288947a0 100644 --- a/data/minecraft/structure/trial_chambers/chamber/assembly/hanging_3.nbt +++ b/data/minecraft/structure/trial_chambers/chamber/assembly/hanging_3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3901f7a1870ce979d39a89883cc3841a7b1de32917aa86773b4be559adb2abdd -size 534 +oid sha256:6fabe194f39f4b2749c6f7e151d6466b37e4001ce5cdbde063f32966862f0d18 +size 537 diff --git a/data/minecraft/structure/trial_chambers/chamber/assembly/hanging_4.nbt b/data/minecraft/structure/trial_chambers/chamber/assembly/hanging_4.nbt index 40a8adb7..20245879 100644 --- a/data/minecraft/structure/trial_chambers/chamber/assembly/hanging_4.nbt +++ b/data/minecraft/structure/trial_chambers/chamber/assembly/hanging_4.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9d7220ef0586723dbfe131db0bcb49c0f44282faaee9873ea997a5125ff89eac -size 636 +oid sha256:fd230d3c8078ddab68087c7a9bdb7221d9d57dec779fd72314c988adcafe6a1a +size 639 diff --git a/data/minecraft/structure/trial_chambers/chamber/assembly/hanging_5.nbt b/data/minecraft/structure/trial_chambers/chamber/assembly/hanging_5.nbt index 4ca9f81f..eec768a4 100644 --- a/data/minecraft/structure/trial_chambers/chamber/assembly/hanging_5.nbt +++ b/data/minecraft/structure/trial_chambers/chamber/assembly/hanging_5.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ec67e8e617124be5abec79cb6d1ed31f12cc277dd0b1b2628f4a7c3d89060984 -size 338 +oid sha256:4042f8fbb059c16d3a8dc5af1612296bb3c1c5863f6c9c0f13899dce7793c25f +size 340 diff --git a/data/minecraft/structure/trial_chambers/chamber/assembly/left_staircase_1.nbt b/data/minecraft/structure/trial_chambers/chamber/assembly/left_staircase_1.nbt index 7e009125..c5f222f0 100644 --- a/data/minecraft/structure/trial_chambers/chamber/assembly/left_staircase_1.nbt +++ b/data/minecraft/structure/trial_chambers/chamber/assembly/left_staircase_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5a794a02f0cb59e258e4dcef74c48c367f82b2dd4df1d998bf657ea44ce74ad7 -size 2460 +oid sha256:1f2eace4851db415b9bf08c49f9ecde8891f59bedf3f278b3138c8a16877bdca +size 2462 diff --git a/data/minecraft/structure/trial_chambers/chamber/assembly/left_staircase_2.nbt b/data/minecraft/structure/trial_chambers/chamber/assembly/left_staircase_2.nbt index 0f725ae1..a6de9e25 100644 --- a/data/minecraft/structure/trial_chambers/chamber/assembly/left_staircase_2.nbt +++ b/data/minecraft/structure/trial_chambers/chamber/assembly/left_staircase_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ebcb10b98ef883216f7b26216ba9bee1a6079bfdd8da6f21a9db961152370442 -size 2493 +oid sha256:0674606e7d7f8b04f1ab28dfe1989208ea0ebeaaf96c0650e30b0a7ccf099736 +size 2495 diff --git a/data/minecraft/structure/trial_chambers/chamber/assembly/left_staircase_3.nbt b/data/minecraft/structure/trial_chambers/chamber/assembly/left_staircase_3.nbt index d74bf930..286b12bc 100644 --- a/data/minecraft/structure/trial_chambers/chamber/assembly/left_staircase_3.nbt +++ b/data/minecraft/structure/trial_chambers/chamber/assembly/left_staircase_3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1b9c9ed7f500b256e2f53bd692b6d49c79647a7aa3f9f1d004f3a0b1acd9aa66 -size 2508 +oid sha256:ea0bef588da86156910905fc5ce36699ed6a060c23ff0c4a7507c6456c531923 +size 2511 diff --git a/data/minecraft/structure/trial_chambers/chamber/assembly/platform_1.nbt b/data/minecraft/structure/trial_chambers/chamber/assembly/platform_1.nbt index b7503cb9..b666623d 100644 --- a/data/minecraft/structure/trial_chambers/chamber/assembly/platform_1.nbt +++ b/data/minecraft/structure/trial_chambers/chamber/assembly/platform_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c8301d93f413582627fb1f0ae875f6f212cbb1c33e7393afdded6d0bb0d5ffff -size 470 +oid sha256:c7b84f7e55090144c2f4c185c40e1d8550d65c145672b698427b3fce6a88f6af +size 473 diff --git a/data/minecraft/structure/trial_chambers/chamber/assembly/right_staircase_1.nbt b/data/minecraft/structure/trial_chambers/chamber/assembly/right_staircase_1.nbt index c50acd1d..75c5b030 100644 --- a/data/minecraft/structure/trial_chambers/chamber/assembly/right_staircase_1.nbt +++ b/data/minecraft/structure/trial_chambers/chamber/assembly/right_staircase_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8a4ed86bbf0798d7237a1332c705fa3ed748977b8a7f8030534c6642b1bc5f35 -size 2422 +oid sha256:0d6beda9742fd4bc6fad82af2689cad9fa684a3ae13ec11a42f8335adf02316d +size 2424 diff --git a/data/minecraft/structure/trial_chambers/chamber/assembly/right_staircase_2.nbt b/data/minecraft/structure/trial_chambers/chamber/assembly/right_staircase_2.nbt index d75c4000..0cbd771b 100644 --- a/data/minecraft/structure/trial_chambers/chamber/assembly/right_staircase_2.nbt +++ b/data/minecraft/structure/trial_chambers/chamber/assembly/right_staircase_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:edf026e59381e54320706144442330393090685110b8d1f5421058596fb497b8 -size 2548 +oid sha256:5df577e61b422f187ae24ba6400c5dceb4c4321d6c768d131412e93a4db64cdc +size 2551 diff --git a/data/minecraft/structure/trial_chambers/chamber/assembly/right_staircase_3.nbt b/data/minecraft/structure/trial_chambers/chamber/assembly/right_staircase_3.nbt index 7eeb7d62..2423fce2 100644 --- a/data/minecraft/structure/trial_chambers/chamber/assembly/right_staircase_3.nbt +++ b/data/minecraft/structure/trial_chambers/chamber/assembly/right_staircase_3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7b617eec15c70505466564d3c9777deb39872cbc28cc7686ce5d4d06d1cc31de -size 2555 +oid sha256:22d67f95cd6c9c54ec20c30082e6fb7ce441b3672c5c17a297c40337b3d2f09d +size 2558 diff --git a/data/minecraft/structure/trial_chambers/chamber/assembly/spawner_1.nbt b/data/minecraft/structure/trial_chambers/chamber/assembly/spawner_1.nbt index d04aec49..820abfef 100644 --- a/data/minecraft/structure/trial_chambers/chamber/assembly/spawner_1.nbt +++ b/data/minecraft/structure/trial_chambers/chamber/assembly/spawner_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:dac61922a3aed8516606e81a61cc2c3df9a611dd21c464b6a6e2c5917528cfa7 -size 914 +oid sha256:4537d03d038bf10035e3d514a34c5767f4bde97bae2d2e2a85d2fc817828a2dc +size 916 diff --git a/data/minecraft/structure/trial_chambers/chamber/chamber_1.nbt b/data/minecraft/structure/trial_chambers/chamber/chamber_1.nbt index 19f7d962..713bdac8 100644 --- a/data/minecraft/structure/trial_chambers/chamber/chamber_1.nbt +++ b/data/minecraft/structure/trial_chambers/chamber/chamber_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4175455e9392c722733f1a4d6539d1ffa7ed9f2ede1f1e18d6c5a460ec7fc5c0 -size 38693 +oid sha256:5a091a01b3ac2cba4cc547896f4939ff64c35e68c7c5e314afaf4feec75c8d00 +size 38589 diff --git a/data/minecraft/structure/trial_chambers/chamber/chamber_2.nbt b/data/minecraft/structure/trial_chambers/chamber/chamber_2.nbt index a5b9d631..364dd19a 100644 --- a/data/minecraft/structure/trial_chambers/chamber/chamber_2.nbt +++ b/data/minecraft/structure/trial_chambers/chamber/chamber_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e723618b1c3ec47708f3646fc254c2a4724813b05f1724f933ab2ed3c5b45593 -size 39046 +oid sha256:be25827df5872b607a061d90bb02045407aa9d535bb1116c3d6cb11ba3c90a5b +size 38938 diff --git a/data/minecraft/structure/trial_chambers/chamber/chamber_4.nbt b/data/minecraft/structure/trial_chambers/chamber/chamber_4.nbt index 53d48dc4..5fdcdc5a 100644 --- a/data/minecraft/structure/trial_chambers/chamber/chamber_4.nbt +++ b/data/minecraft/structure/trial_chambers/chamber/chamber_4.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2e6cea895dedf7f0d5b8236be170e04ceadb616c8c14eb158b04a98a4e2d980e -size 24476 +oid sha256:b946fb4a4dc6f017a062931719b69c1340f0b71e25760b1aa31b52e79ed3c2f3 +size 24479 diff --git a/data/minecraft/structure/trial_chambers/chamber/chamber_8.nbt b/data/minecraft/structure/trial_chambers/chamber/chamber_8.nbt index 0d313ca5..d9cf5473 100644 --- a/data/minecraft/structure/trial_chambers/chamber/chamber_8.nbt +++ b/data/minecraft/structure/trial_chambers/chamber/chamber_8.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:03fd4daae2ea92c57c51a212abd8ef22d0ce5dc49f91d1b22c2fda83c5b5d161 -size 19216 +oid sha256:066a0f15b3df058a0db7bcedb321d8a3d2a3dd38e5de1eac307a3c88fcb13014 +size 19203 diff --git a/data/minecraft/structure/trial_chambers/chamber/entrance_cap.nbt b/data/minecraft/structure/trial_chambers/chamber/entrance_cap.nbt index 5955693d..23c23cc4 100644 --- a/data/minecraft/structure/trial_chambers/chamber/entrance_cap.nbt +++ b/data/minecraft/structure/trial_chambers/chamber/entrance_cap.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9b0d052726976a12e2d0e1007f7759ce49ec769d54309dff92efe7cf55e81194 -size 381 +oid sha256:4eaac92ebab4121ba67a01cb2f27a99a87a191383a39154a81bc0741ff1251d0 +size 384 diff --git a/data/minecraft/structure/trial_chambers/chamber/eruption.nbt b/data/minecraft/structure/trial_chambers/chamber/eruption.nbt index 7aef111a..34783f37 100644 --- a/data/minecraft/structure/trial_chambers/chamber/eruption.nbt +++ b/data/minecraft/structure/trial_chambers/chamber/eruption.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:708a810850ac0ff7434d5ec62281c197143d36b37a5c79af2a6e08c2b567a74f -size 31848 +oid sha256:44397910225539d7bac7de5993d92b6851ad0ce21d7e449aeb68829deed1a95e +size 31897 diff --git a/data/minecraft/structure/trial_chambers/chamber/eruption/breeze_slice_1.nbt b/data/minecraft/structure/trial_chambers/chamber/eruption/breeze_slice_1.nbt index 2b4036b4..46db16f6 100644 --- a/data/minecraft/structure/trial_chambers/chamber/eruption/breeze_slice_1.nbt +++ b/data/minecraft/structure/trial_chambers/chamber/eruption/breeze_slice_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:75c8e116d47099547f6da75aca5f825e2a7d3b72c9dda8916136e6d916c7c988 -size 2591 +oid sha256:4c4e7ecc5832cef4fd134735a651a9504b3c2069668140ffbeab0265ce4c6bbb +size 2594 diff --git a/data/minecraft/structure/trial_chambers/chamber/eruption/center_1.nbt b/data/minecraft/structure/trial_chambers/chamber/eruption/center_1.nbt index 5b4d9338..00bdb970 100644 --- a/data/minecraft/structure/trial_chambers/chamber/eruption/center_1.nbt +++ b/data/minecraft/structure/trial_chambers/chamber/eruption/center_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f1322853653d4c2f433ea130f81f0926cb9d7c905de8191d931d33b38c9d650a -size 1534 +oid sha256:2551487353c160925ddcad7df99e219ca6a8a77067396ea341f96eb25ff42701 +size 1537 diff --git a/data/minecraft/structure/trial_chambers/chamber/eruption/quadrant_1.nbt b/data/minecraft/structure/trial_chambers/chamber/eruption/quadrant_1.nbt index 844cedcf..d213f9c6 100644 --- a/data/minecraft/structure/trial_chambers/chamber/eruption/quadrant_1.nbt +++ b/data/minecraft/structure/trial_chambers/chamber/eruption/quadrant_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:89e1caf267abfa91d9a7efa109517ba52a6fbb89c25a3c8fb90bbaf45b4cf2e1 -size 4435 +oid sha256:efccf81bba8e705b773467310bff1a3d57265e11e001f7997282384cdfa489d9 +size 4438 diff --git a/data/minecraft/structure/trial_chambers/chamber/eruption/quadrant_2.nbt b/data/minecraft/structure/trial_chambers/chamber/eruption/quadrant_2.nbt index cb9d5149..02f4bea3 100644 --- a/data/minecraft/structure/trial_chambers/chamber/eruption/quadrant_2.nbt +++ b/data/minecraft/structure/trial_chambers/chamber/eruption/quadrant_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8b6c7860174d023bb6eb869b85f967895ed928ff0e98f650f759c6189ba41ec1 -size 4599 +oid sha256:f153f33d6c7e1041202addac8ec0cc425557926fde8e4c8763d1ab7b4a7ae0f8 +size 4602 diff --git a/data/minecraft/structure/trial_chambers/chamber/eruption/quadrant_3.nbt b/data/minecraft/structure/trial_chambers/chamber/eruption/quadrant_3.nbt index fadf0db7..59e85ec0 100644 --- a/data/minecraft/structure/trial_chambers/chamber/eruption/quadrant_3.nbt +++ b/data/minecraft/structure/trial_chambers/chamber/eruption/quadrant_3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:482ec3ea85c008dbadea9c70c79992b24f3267c5b6dcbe070b2150a213cb9c7e -size 4685 +oid sha256:670ab8acab5295f46696d7d66878e149c368edd3becdb79baaa747f027ccbc2a +size 4684 diff --git a/data/minecraft/structure/trial_chambers/chamber/eruption/quadrant_4.nbt b/data/minecraft/structure/trial_chambers/chamber/eruption/quadrant_4.nbt index b254ac0e..f313f8e5 100644 --- a/data/minecraft/structure/trial_chambers/chamber/eruption/quadrant_4.nbt +++ b/data/minecraft/structure/trial_chambers/chamber/eruption/quadrant_4.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:857dfc877e278b79fdb6c219fc1fe089e8f89447174310abb69d907712914c6a -size 4832 +oid sha256:3d4f8d3c8036ef82d01a2e5f610cf2869a398a4c636408b1e62606ba91297c0b +size 4835 diff --git a/data/minecraft/structure/trial_chambers/chamber/eruption/quadrant_5.nbt b/data/minecraft/structure/trial_chambers/chamber/eruption/quadrant_5.nbt index 33621a1b..eb3e147e 100644 --- a/data/minecraft/structure/trial_chambers/chamber/eruption/quadrant_5.nbt +++ b/data/minecraft/structure/trial_chambers/chamber/eruption/quadrant_5.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:576e06b903b7fac90bd2917d33246b3227d164c97c84e044e33c329716d804d9 -size 4788 +oid sha256:ee09bf406257af5e01615daedc538580c7249ff42f965f87be66ed79f1e00089 +size 4787 diff --git a/data/minecraft/structure/trial_chambers/chamber/eruption/slice_1.nbt b/data/minecraft/structure/trial_chambers/chamber/eruption/slice_1.nbt index b6176c33..5f758932 100644 --- a/data/minecraft/structure/trial_chambers/chamber/eruption/slice_1.nbt +++ b/data/minecraft/structure/trial_chambers/chamber/eruption/slice_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4e9a4b0233502512d360f1819cc548b94e4f7ac1166b83f6cfa36f8ee27e25c1 -size 2503 +oid sha256:4ded6f9964bdbc73521dcfb3288f9d2754c7260888061136f40dec2ead5de9b1 +size 2506 diff --git a/data/minecraft/structure/trial_chambers/chamber/eruption/slice_2.nbt b/data/minecraft/structure/trial_chambers/chamber/eruption/slice_2.nbt index fa1c21a1..6b6651aa 100644 --- a/data/minecraft/structure/trial_chambers/chamber/eruption/slice_2.nbt +++ b/data/minecraft/structure/trial_chambers/chamber/eruption/slice_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3070d028073c2c508779fd2badeb1d94e6bcc047b6896138059d7df32ab1a450 -size 2480 +oid sha256:af1c3fefa118954a0e4c74cd82064ffcc4086e4641a2ed942a4a981cfa40ae1c +size 2483 diff --git a/data/minecraft/structure/trial_chambers/chamber/eruption/slice_3.nbt b/data/minecraft/structure/trial_chambers/chamber/eruption/slice_3.nbt index dc5446c9..84fbe875 100644 --- a/data/minecraft/structure/trial_chambers/chamber/eruption/slice_3.nbt +++ b/data/minecraft/structure/trial_chambers/chamber/eruption/slice_3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:31902dfeaa2080243e563111d74e04e1756420ac6fc33cec077b1691186e2e2d -size 2471 +oid sha256:198af57e07c59ea1d6250aca410eb39a5de6de255a14ab81b2286bd1689fe647 +size 2476 diff --git a/data/minecraft/structure/trial_chambers/chamber/pedestal.nbt b/data/minecraft/structure/trial_chambers/chamber/pedestal.nbt index 73b71d05..647fe206 100644 --- a/data/minecraft/structure/trial_chambers/chamber/pedestal.nbt +++ b/data/minecraft/structure/trial_chambers/chamber/pedestal.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:42601c3592ed01f9ba69e150716351274fe5712ee40f4d11f2c6dcb6645265e8 -size 47446 +oid sha256:f6c90eb77d3d240ec989d253fd5bd1227bb2ece6b30dc2dfa1fc6d41eae0e4a7 +size 47359 diff --git a/data/minecraft/structure/trial_chambers/chamber/pedestal/center_1.nbt b/data/minecraft/structure/trial_chambers/chamber/pedestal/center_1.nbt index 9f4f616c..6a97f678 100644 --- a/data/minecraft/structure/trial_chambers/chamber/pedestal/center_1.nbt +++ b/data/minecraft/structure/trial_chambers/chamber/pedestal/center_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8570ece2521d80f4d43fafc9f6dc54c058409975f90bebdc6afce8c79d14eda8 -size 3673 +oid sha256:1e2307ce7a59ffea8281559e2924620b9d96d1e8111b69c5d7673e7f8a33afd2 +size 3678 diff --git a/data/minecraft/structure/trial_chambers/chamber/pedestal/ominous_slice_1.nbt b/data/minecraft/structure/trial_chambers/chamber/pedestal/ominous_slice_1.nbt index 28d273fa..74ebd6d9 100644 --- a/data/minecraft/structure/trial_chambers/chamber/pedestal/ominous_slice_1.nbt +++ b/data/minecraft/structure/trial_chambers/chamber/pedestal/ominous_slice_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:cb16e8c15e62426e7795e0b97aace1dfb4a5be560b25a6f68f25a2c7dc6015d7 -size 1917 +oid sha256:10d1bbf8c6c1be13894006dee85a750aeb6f445b8637ee88ceede62d771cb703 +size 1919 diff --git a/data/minecraft/structure/trial_chambers/chamber/pedestal/quadrant_1.nbt b/data/minecraft/structure/trial_chambers/chamber/pedestal/quadrant_1.nbt index 0668fd5a..05c8e618 100644 --- a/data/minecraft/structure/trial_chambers/chamber/pedestal/quadrant_1.nbt +++ b/data/minecraft/structure/trial_chambers/chamber/pedestal/quadrant_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e710cf13da4fb4a7e46b43df972cd9fdf7a018df635c47631a509ab8492a9a37 -size 3460 +oid sha256:d99f3729a5550076f7f216aa8e16dee7b44cab1e3df5c15abbe969fbe2381c37 +size 3462 diff --git a/data/minecraft/structure/trial_chambers/chamber/pedestal/quadrant_2.nbt b/data/minecraft/structure/trial_chambers/chamber/pedestal/quadrant_2.nbt index 80321d15..b84d382f 100644 --- a/data/minecraft/structure/trial_chambers/chamber/pedestal/quadrant_2.nbt +++ b/data/minecraft/structure/trial_chambers/chamber/pedestal/quadrant_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1d2e5ba5f7e187c73f7b1cdc7f842d20ba128a073282c6b08002dc107f7e4d1c -size 3323 +oid sha256:e389b2ccca38a6eba76ee4813be8cef8b625eb26b0bbc9e89ab30ef3e13a232f +size 3326 diff --git a/data/minecraft/structure/trial_chambers/chamber/pedestal/quadrant_3.nbt b/data/minecraft/structure/trial_chambers/chamber/pedestal/quadrant_3.nbt index 69ccb89b..a21a9040 100644 --- a/data/minecraft/structure/trial_chambers/chamber/pedestal/quadrant_3.nbt +++ b/data/minecraft/structure/trial_chambers/chamber/pedestal/quadrant_3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6dcffc04a7bc53ea757eb606e1753d15f42cea30079e52fbe9c8c3460cecc03f -size 3907 +oid sha256:44e576b4f0c30a2c338ae8c9d9453cebe498c1f25485a5ca841ba749a9e51a60 +size 3910 diff --git a/data/minecraft/structure/trial_chambers/chamber/pedestal/slice_1.nbt b/data/minecraft/structure/trial_chambers/chamber/pedestal/slice_1.nbt index 3109bb87..0190c0cc 100644 --- a/data/minecraft/structure/trial_chambers/chamber/pedestal/slice_1.nbt +++ b/data/minecraft/structure/trial_chambers/chamber/pedestal/slice_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:40875e9b7fde8efb0a5e7fb38e69dba7a25f7536f486604db2c0c231fbfca811 -size 1920 +oid sha256:32d874fdd14fde834041e57b6a62999a7ad863c86b951abf9240d424a704e1dc +size 1922 diff --git a/data/minecraft/structure/trial_chambers/chamber/pedestal/slice_2.nbt b/data/minecraft/structure/trial_chambers/chamber/pedestal/slice_2.nbt index f340aa03..37cf3d78 100644 --- a/data/minecraft/structure/trial_chambers/chamber/pedestal/slice_2.nbt +++ b/data/minecraft/structure/trial_chambers/chamber/pedestal/slice_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:bab18c50c9f103be312c5d771f652bd97d590c83a6c1ce0ba9a21637f8202ebb -size 1962 +oid sha256:659e592a32a2d946c5d28385d79761b7eb7206eeb0efee434c63343e6366fd08 +size 1964 diff --git a/data/minecraft/structure/trial_chambers/chamber/pedestal/slice_3.nbt b/data/minecraft/structure/trial_chambers/chamber/pedestal/slice_3.nbt index 7044070c..eba3675a 100644 --- a/data/minecraft/structure/trial_chambers/chamber/pedestal/slice_3.nbt +++ b/data/minecraft/structure/trial_chambers/chamber/pedestal/slice_3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1e3efd335f648f58c149ee8d4a6d111d5cb167729a3bdf543922293cc541a625 -size 2009 +oid sha256:22eb83cfae554185dc33b0b766bcd98792bbdace8fc4b27b45296cf689b149d3 +size 2010 diff --git a/data/minecraft/structure/trial_chambers/chamber/pedestal/slice_4.nbt b/data/minecraft/structure/trial_chambers/chamber/pedestal/slice_4.nbt index 19de499d..dc11c4e9 100644 --- a/data/minecraft/structure/trial_chambers/chamber/pedestal/slice_4.nbt +++ b/data/minecraft/structure/trial_chambers/chamber/pedestal/slice_4.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c3a8ce86cc7b386c10f7a4cdd16c0433fa2ed9fe42e05b7d6e4eb0610b63ce4c -size 2016 +oid sha256:f7a1084cdef63c23ade8a77d8d873ef413e5ab8861aa3a09612f261d8a23098a +size 2018 diff --git a/data/minecraft/structure/trial_chambers/chamber/pedestal/slice_5.nbt b/data/minecraft/structure/trial_chambers/chamber/pedestal/slice_5.nbt index 0572117b..4569b8dd 100644 --- a/data/minecraft/structure/trial_chambers/chamber/pedestal/slice_5.nbt +++ b/data/minecraft/structure/trial_chambers/chamber/pedestal/slice_5.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:998097cc52ab448b49b4085260e85f093f4cf3beed80bf9407c0e6f3c8e6af2c -size 1968 +oid sha256:b3a5b7c27176f72d3071ca67e20a0ec1fcad587ec12852bec4166643e8618d2b +size 1970 diff --git a/data/minecraft/structure/trial_chambers/chamber/slanted.nbt b/data/minecraft/structure/trial_chambers/chamber/slanted.nbt index 392a0250..410f2bc0 100644 --- a/data/minecraft/structure/trial_chambers/chamber/slanted.nbt +++ b/data/minecraft/structure/trial_chambers/chamber/slanted.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:09c62624dcdc866e1c4af54668eea558f5001e640b44c83b5c7495f7d6ced029 -size 34554 +oid sha256:57ae185c36323272fdf4824a4644b40077914dd123fc8a532ad44c94a908a371 +size 34273 diff --git a/data/minecraft/structure/trial_chambers/chamber/slanted/center.nbt b/data/minecraft/structure/trial_chambers/chamber/slanted/center.nbt index 933a8836..24b98668 100644 --- a/data/minecraft/structure/trial_chambers/chamber/slanted/center.nbt +++ b/data/minecraft/structure/trial_chambers/chamber/slanted/center.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e45b5e0695069eaf7a033318622aa2b514d1596612b18dbca485699c65d844b5 -size 1274 +oid sha256:f587a442880f769edb976dda861337c9bed6796920fd4ba3869577e3fdd799a9 +size 1276 diff --git a/data/minecraft/structure/trial_chambers/chamber/slanted/hallway_1.nbt b/data/minecraft/structure/trial_chambers/chamber/slanted/hallway_1.nbt index 528e412f..f5d16d5b 100644 --- a/data/minecraft/structure/trial_chambers/chamber/slanted/hallway_1.nbt +++ b/data/minecraft/structure/trial_chambers/chamber/slanted/hallway_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5fa79386e4a7a2d3a2b52669f69df76e37051dbea43e62853baf8b1b16d7bfac -size 1006 +oid sha256:12cf1626813b71377f42156c6a32c1d49bfae456c07051565216d7afad5f42d4 +size 1008 diff --git a/data/minecraft/structure/trial_chambers/chamber/slanted/hallway_2.nbt b/data/minecraft/structure/trial_chambers/chamber/slanted/hallway_2.nbt index a0581418..ddd45e99 100644 --- a/data/minecraft/structure/trial_chambers/chamber/slanted/hallway_2.nbt +++ b/data/minecraft/structure/trial_chambers/chamber/slanted/hallway_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d0249407d4c7ac4521846c16740e54f076ee0794a826b1a383ec71c7fe66ade6 -size 1155 +oid sha256:c7be51e10e30388d4db19d9991badd14234fdae4a141cbe1612d941213964c7c +size 1133 diff --git a/data/minecraft/structure/trial_chambers/chamber/slanted/hallway_3.nbt b/data/minecraft/structure/trial_chambers/chamber/slanted/hallway_3.nbt index a141cadd..62c8e47f 100644 --- a/data/minecraft/structure/trial_chambers/chamber/slanted/hallway_3.nbt +++ b/data/minecraft/structure/trial_chambers/chamber/slanted/hallway_3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8ab59ee9cfe74f9e452a48bb57f1f2da1afafc5a107d7b2344b1438d46f48938 -size 987 +oid sha256:5098afbecae1ffa7d25bda8aaf28e9920763f4060adeb461bc5856af66a58811 +size 1059 diff --git a/data/minecraft/structure/trial_chambers/chamber/slanted/hallway_4.nbt b/data/minecraft/structure/trial_chambers/chamber/slanted/hallway_4.nbt deleted file mode 100644 index ce0af160..00000000 --- a/data/minecraft/structure/trial_chambers/chamber/slanted/hallway_4.nbt +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:b9d09449979a61274e38de012b0bf8bb8e83f0f5ca6f803c740d070a98abc387 -size 986 diff --git a/data/minecraft/structure/trial_chambers/chamber/slanted/hallway_5.nbt b/data/minecraft/structure/trial_chambers/chamber/slanted/hallway_5.nbt deleted file mode 100644 index 937d1d0d..00000000 --- a/data/minecraft/structure/trial_chambers/chamber/slanted/hallway_5.nbt +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:d5ecd83b05a69d981f71adf573751fe666f33e3ee4b4f5f3d4ff934056688a6b -size 1003 diff --git a/data/minecraft/structure/trial_chambers/chamber/slanted/ominous_upper_arm_1.nbt b/data/minecraft/structure/trial_chambers/chamber/slanted/ominous_upper_arm_1.nbt index bc34c0a9..b971089a 100644 --- a/data/minecraft/structure/trial_chambers/chamber/slanted/ominous_upper_arm_1.nbt +++ b/data/minecraft/structure/trial_chambers/chamber/slanted/ominous_upper_arm_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b2bd5d598c35829f626acee57520123d715af20713fc1dd5fad5ff741933da6b -size 1341 +oid sha256:a735f3e2bd42c6d38a0e4ef2d88fbe85319d00782ccd541e45f66d53db4d7aad +size 1344 diff --git a/data/minecraft/structure/trial_chambers/chamber/slanted/quadrant_1.nbt b/data/minecraft/structure/trial_chambers/chamber/slanted/quadrant_1.nbt index c224379d..4555f991 100644 --- a/data/minecraft/structure/trial_chambers/chamber/slanted/quadrant_1.nbt +++ b/data/minecraft/structure/trial_chambers/chamber/slanted/quadrant_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6381158b23bcc650ca181235f8b82a4e973969f436acd4643049abb62b80b62e -size 3508 +oid sha256:3146631df0e4e2f47271646c64135f8a35bd275c0ba19431631fef20a77d386d +size 3429 diff --git a/data/minecraft/structure/trial_chambers/chamber/slanted/quadrant_2.nbt b/data/minecraft/structure/trial_chambers/chamber/slanted/quadrant_2.nbt index 878c1e7f..220f81dc 100644 --- a/data/minecraft/structure/trial_chambers/chamber/slanted/quadrant_2.nbt +++ b/data/minecraft/structure/trial_chambers/chamber/slanted/quadrant_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d221734e38fceacb1a4684337f8d41d48d642b67db057b50d20d12613695d009 -size 3487 +oid sha256:59921203f532e49be7f910155a9e2f53a6d127c41bdd3861d435e6aba1d763db +size 3445 diff --git a/data/minecraft/structure/trial_chambers/chamber/slanted/quadrant_3.nbt b/data/minecraft/structure/trial_chambers/chamber/slanted/quadrant_3.nbt index 4bf89605..f6e2e7fb 100644 --- a/data/minecraft/structure/trial_chambers/chamber/slanted/quadrant_3.nbt +++ b/data/minecraft/structure/trial_chambers/chamber/slanted/quadrant_3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f4bb0743bec4833fd55b0ed5421c3ced2640d132860635fff02f80a2fb390404 -size 3451 +oid sha256:027c76a88f0444eced0e4810b8af736064717393ddf4a20d71362d7bf5af3e75 +size 3435 diff --git a/data/minecraft/structure/trial_chambers/chamber/slanted/quadrant_4.nbt b/data/minecraft/structure/trial_chambers/chamber/slanted/quadrant_4.nbt index 26958474..761ed433 100644 --- a/data/minecraft/structure/trial_chambers/chamber/slanted/quadrant_4.nbt +++ b/data/minecraft/structure/trial_chambers/chamber/slanted/quadrant_4.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9245d5908f5462e89f4e2b81f5f893acfd845c4ad7f4b51f9e23d7ef8fb1622f -size 3386 +oid sha256:8b16d49123611df697df463ecf2f407d70ec52a2ed1f58f1b3aebeffc9eef165 +size 4325 diff --git a/data/minecraft/structure/trial_chambers/chamber/slanted/ramp_1.nbt b/data/minecraft/structure/trial_chambers/chamber/slanted/ramp_1.nbt index 0dc37d93..73bd1ab6 100644 --- a/data/minecraft/structure/trial_chambers/chamber/slanted/ramp_1.nbt +++ b/data/minecraft/structure/trial_chambers/chamber/slanted/ramp_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0b7a9a15e1ba6950361b307b9f38d78d065192d724bb37cc6b6d4449ec5c0486 -size 1322 +oid sha256:9e5af4d88daa129f168ae23ca7a418d1666966eccd68eb8a99570dae693d2bf6 +size 1324 diff --git a/data/minecraft/structure/trial_chambers/chamber/slanted/ramp_2.nbt b/data/minecraft/structure/trial_chambers/chamber/slanted/ramp_2.nbt index f6766932..c15047ef 100644 --- a/data/minecraft/structure/trial_chambers/chamber/slanted/ramp_2.nbt +++ b/data/minecraft/structure/trial_chambers/chamber/slanted/ramp_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d7ad28f2c07d878a115baf820143a9bd085a4c1fcbee30f5bcd9ce5a47f738b9 -size 1316 +oid sha256:30a017e6ccf2f5e78b430501598c613be84d646e4e70887cade74abc849f2141 +size 1319 diff --git a/data/minecraft/structure/trial_chambers/chamber/slanted/ramp_3.nbt b/data/minecraft/structure/trial_chambers/chamber/slanted/ramp_3.nbt index d2874e96..c9f48154 100644 --- a/data/minecraft/structure/trial_chambers/chamber/slanted/ramp_3.nbt +++ b/data/minecraft/structure/trial_chambers/chamber/slanted/ramp_3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ee1c3adfb146f0fdd683c6241c4cca93cbc2b6aebeb159946bc40c5f4dc72dd0 -size 1450 +oid sha256:959a04b61033cab7afa2f3fa0862728bcda29341b5b2f69a792269042e659b7b +size 1453 diff --git a/data/minecraft/structure/trial_chambers/chamber/slanted/ramp_4.nbt b/data/minecraft/structure/trial_chambers/chamber/slanted/ramp_4.nbt index ec6d849b..bacccc6e 100644 --- a/data/minecraft/structure/trial_chambers/chamber/slanted/ramp_4.nbt +++ b/data/minecraft/structure/trial_chambers/chamber/slanted/ramp_4.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:69ba7c23d77b731f5ddcf2727880a600edfd17834d67860cc41ba17f94f79d16 -size 1230 +oid sha256:18185bdc4453a3b6ff681fbd86e3db7541a88b8a82f253a17e07dace94ddbb2b +size 1232 diff --git a/data/minecraft/structure/trial_chambers/chests/connectors/supply.nbt b/data/minecraft/structure/trial_chambers/chests/connectors/supply.nbt index 45cc690a..60f31d7e 100644 --- a/data/minecraft/structure/trial_chambers/chests/connectors/supply.nbt +++ b/data/minecraft/structure/trial_chambers/chests/connectors/supply.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:520270bde8ae87e357eb35743c70525d2f446bdab92572194332abebf47b1e4c -size 352 +oid sha256:ad3b7c2ab4fc19417ba5be38a5e685433b0f9c3c049cdabdd6fc731262026e77 +size 355 diff --git a/data/minecraft/structure/trial_chambers/chests/supply.nbt b/data/minecraft/structure/trial_chambers/chests/supply.nbt index 3fea0fe9..6d111275 100644 --- a/data/minecraft/structure/trial_chambers/chests/supply.nbt +++ b/data/minecraft/structure/trial_chambers/chests/supply.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:460465eb29d9fe0483c7d1711cd23f30c743d62104a4cd8daf96ff6651cca7ba -size 438 +oid sha256:0db2cc83d2f5f83f5a628abb4fd6f4bb5b8f1e93619ebc5ac4302f59e720efce +size 440 diff --git a/data/minecraft/structure/trial_chambers/corridor/addon/arrow_dispenser.nbt b/data/minecraft/structure/trial_chambers/corridor/addon/arrow_dispenser.nbt index 2a63fe19..0b52034c 100644 --- a/data/minecraft/structure/trial_chambers/corridor/addon/arrow_dispenser.nbt +++ b/data/minecraft/structure/trial_chambers/corridor/addon/arrow_dispenser.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9c96ed32b58ad4485fad5c700600c948f98091fb99ad84e72a27f1c9b7c6672d -size 832 +oid sha256:27965c8ae8e5c83c8d58b36e26848db52409fd11af5a57c4d969ca3e2a2d1250 +size 835 diff --git a/data/minecraft/structure/trial_chambers/corridor/addon/bridge_lower.nbt b/data/minecraft/structure/trial_chambers/corridor/addon/bridge_lower.nbt index 8b8c67e0..206eec26 100644 --- a/data/minecraft/structure/trial_chambers/corridor/addon/bridge_lower.nbt +++ b/data/minecraft/structure/trial_chambers/corridor/addon/bridge_lower.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7cda5ba059867f415e087bf82dc81e5f065a4ad5416240f4c095ffbf7a258e80 -size 696 +oid sha256:b62944d0c74fcc67e2a8fd8bf9c49c836ed48423f498da3a4955aba03c0b942d +size 698 diff --git a/data/minecraft/structure/trial_chambers/corridor/addon/chandelier_upper.nbt b/data/minecraft/structure/trial_chambers/corridor/addon/chandelier_upper.nbt index 6bd66a23..e8af54c3 100644 --- a/data/minecraft/structure/trial_chambers/corridor/addon/chandelier_upper.nbt +++ b/data/minecraft/structure/trial_chambers/corridor/addon/chandelier_upper.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9156955d441a900c4694320df64955b71acc5dba28bb326ed346d8c9fc8f8bc9 -size 512 +oid sha256:1d60d29a17c4312446bbda182669825511916c093c3b6aa12b1b4b287870f05c +size 514 diff --git a/data/minecraft/structure/trial_chambers/corridor/addon/decoration_upper.nbt b/data/minecraft/structure/trial_chambers/corridor/addon/decoration_upper.nbt index 8dc5f5ac..40448bea 100644 --- a/data/minecraft/structure/trial_chambers/corridor/addon/decoration_upper.nbt +++ b/data/minecraft/structure/trial_chambers/corridor/addon/decoration_upper.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:cf409e8f2d473f628920de9db0ff27684aa8027f1a54cb15a806a147b972a17f -size 512 +oid sha256:1a9a2bf6f59b0760685bd4965b8e4c5f7afceb7e4b3ae592b3ef2ce9b179c613 +size 514 diff --git a/data/minecraft/structure/trial_chambers/corridor/addon/display_1.nbt b/data/minecraft/structure/trial_chambers/corridor/addon/display_1.nbt index 7826a233..6eb40515 100644 --- a/data/minecraft/structure/trial_chambers/corridor/addon/display_1.nbt +++ b/data/minecraft/structure/trial_chambers/corridor/addon/display_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5a2ecfaa4d361376fe79fa82a1eea89d4367ba1b138a9ec69dc5242c5fe8b3f6 -size 899 +oid sha256:73c2c265f458b3f17f52650d6bbfef544e22d8833bc43d6921f8bb7734511425 +size 901 diff --git a/data/minecraft/structure/trial_chambers/corridor/addon/display_2.nbt b/data/minecraft/structure/trial_chambers/corridor/addon/display_2.nbt index ab2b5d38..8d64d997 100644 --- a/data/minecraft/structure/trial_chambers/corridor/addon/display_2.nbt +++ b/data/minecraft/structure/trial_chambers/corridor/addon/display_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:108eb368fa25bd1f4bb5208340be244c8c3f29169c53b78e8528bc9c3accc4e2 -size 1526 +oid sha256:0e3d171963dcd7075227c2b1274ab00214546f28577c7dc0f148dc1f86e8a708 +size 1529 diff --git a/data/minecraft/structure/trial_chambers/corridor/addon/display_3.nbt b/data/minecraft/structure/trial_chambers/corridor/addon/display_3.nbt index f65ef8d3..294a50ab 100644 --- a/data/minecraft/structure/trial_chambers/corridor/addon/display_3.nbt +++ b/data/minecraft/structure/trial_chambers/corridor/addon/display_3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:831ed83525bd554c09840a397bdf47cad378537ef40957b4e425660bcfc4ff5e -size 809 +oid sha256:b736f5bc1cd14eb16b2e83a6fa662c1c2a47cc95784b019e11f8e01ffb224cd5 +size 812 diff --git a/data/minecraft/structure/trial_chambers/corridor/addon/head_upper.nbt b/data/minecraft/structure/trial_chambers/corridor/addon/head_upper.nbt index 3c15c1b4..17bf5c6f 100644 --- a/data/minecraft/structure/trial_chambers/corridor/addon/head_upper.nbt +++ b/data/minecraft/structure/trial_chambers/corridor/addon/head_upper.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:30d4b7cef7090ea41f6b47aa13a2d1f98c73c182d22cb221be76dc06fc86980e -size 524 +oid sha256:ef1a149452b122213324623394f3299cccc3e048a51627775605720be9964301 +size 526 diff --git a/data/minecraft/structure/trial_chambers/corridor/addon/ladder_to_middle.nbt b/data/minecraft/structure/trial_chambers/corridor/addon/ladder_to_middle.nbt index 0c4dfb76..8cb9e2e2 100644 --- a/data/minecraft/structure/trial_chambers/corridor/addon/ladder_to_middle.nbt +++ b/data/minecraft/structure/trial_chambers/corridor/addon/ladder_to_middle.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:126bf6e76712598c09e05022ca4510f302be5455f7b05f637bd87ab637b5718f -size 667 +oid sha256:7328ac4c87d0a9019a44da1bda372fd37f14313f3a9f52ee39140836c55d6d3b +size 670 diff --git a/data/minecraft/structure/trial_chambers/corridor/addon/open_walkway.nbt b/data/minecraft/structure/trial_chambers/corridor/addon/open_walkway.nbt index 0410b7cf..57e8f01d 100644 --- a/data/minecraft/structure/trial_chambers/corridor/addon/open_walkway.nbt +++ b/data/minecraft/structure/trial_chambers/corridor/addon/open_walkway.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6fec942238050f473bf9ad55165bb198da3f22d1d2f3898da791b4748ee747af -size 1158 +oid sha256:c449abb6b97e4c2d123a8837bf5da38c6926adf37f7afeb43732db6c3f057f17 +size 1160 diff --git a/data/minecraft/structure/trial_chambers/corridor/addon/open_walkway_upper.nbt b/data/minecraft/structure/trial_chambers/corridor/addon/open_walkway_upper.nbt index 9dd22bc0..5a24fbc5 100644 --- a/data/minecraft/structure/trial_chambers/corridor/addon/open_walkway_upper.nbt +++ b/data/minecraft/structure/trial_chambers/corridor/addon/open_walkway_upper.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e11ad0923a2eca9279a4432b46f9dc28ac028503ca0386a5bc4d89fa38a3a822 -size 582 +oid sha256:a7eedd338ed7ad7929023741db77faad1e65731c7cbe919a49baac521841b8c1 +size 587 diff --git a/data/minecraft/structure/trial_chambers/corridor/addon/reward_upper.nbt b/data/minecraft/structure/trial_chambers/corridor/addon/reward_upper.nbt index 590964f2..f952bfd9 100644 --- a/data/minecraft/structure/trial_chambers/corridor/addon/reward_upper.nbt +++ b/data/minecraft/structure/trial_chambers/corridor/addon/reward_upper.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a7d43de7c073994dcacb67cd0e976535cee7896a9657432efcc974bd3d0dc532 -size 548 +oid sha256:a7183ae027e2b6afba1628e55379ad872d405d69b7000a4b57386ae03266d20e +size 590 diff --git a/data/minecraft/structure/trial_chambers/corridor/addon/staircase.nbt b/data/minecraft/structure/trial_chambers/corridor/addon/staircase.nbt index 8a6543ea..fba12151 100644 --- a/data/minecraft/structure/trial_chambers/corridor/addon/staircase.nbt +++ b/data/minecraft/structure/trial_chambers/corridor/addon/staircase.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:eb65ec51f90a8cbc42d002f564925bb0aa58f4f1ce64baa912200ded6696a1b1 -size 455 +oid sha256:5955eb46c9a56ed3c228623ebe93ffd8aff7e8bb793106a08e8b0ca62a4ccfeb +size 457 diff --git a/data/minecraft/structure/trial_chambers/corridor/addon/wall.nbt b/data/minecraft/structure/trial_chambers/corridor/addon/wall.nbt index d89f88e5..7b1e86a6 100644 --- a/data/minecraft/structure/trial_chambers/corridor/addon/wall.nbt +++ b/data/minecraft/structure/trial_chambers/corridor/addon/wall.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ac203bc35c4d94d3beee606f22ca531276d53921d6374f5bfc884bf83549e273 -size 907 +oid sha256:fd0433ccee2c1e52f5354007eca73f2355a3759348337886ce4404a6d12f1bc1 +size 909 diff --git a/data/minecraft/structure/trial_chambers/corridor/addon/walled_walkway.nbt b/data/minecraft/structure/trial_chambers/corridor/addon/walled_walkway.nbt index ede9d39f..875f835c 100644 --- a/data/minecraft/structure/trial_chambers/corridor/addon/walled_walkway.nbt +++ b/data/minecraft/structure/trial_chambers/corridor/addon/walled_walkway.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6dd20f0d14587a7288a0ce050aad9661437eb2c346a94f55daef911a5b101680 -size 1184 +oid sha256:7a9684eb51c257d5a6da2930b7615fd69d6e7448d081476838b34074c69bf2c7 +size 1186 diff --git a/data/minecraft/structure/trial_chambers/corridor/atrium/bogged_relief.nbt b/data/minecraft/structure/trial_chambers/corridor/atrium/bogged_relief.nbt index cb9bacdd..c3e60b11 100644 --- a/data/minecraft/structure/trial_chambers/corridor/atrium/bogged_relief.nbt +++ b/data/minecraft/structure/trial_chambers/corridor/atrium/bogged_relief.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ba8767bf5bd0fdc6a13f83d72247c720149ef39c98806990a49187630816bc09 -size 3242 +oid sha256:7748e85f7cf23c9e74a16e4311e8826fa52469714acbc6b02a85232a06e23b6c +size 3245 diff --git a/data/minecraft/structure/trial_chambers/corridor/atrium/breeze_relief.nbt b/data/minecraft/structure/trial_chambers/corridor/atrium/breeze_relief.nbt index 9a04fbd7..4dd1fd48 100644 --- a/data/minecraft/structure/trial_chambers/corridor/atrium/breeze_relief.nbt +++ b/data/minecraft/structure/trial_chambers/corridor/atrium/breeze_relief.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4c2d1376d038367de06fd1cd6d90881dd733956f5387c8f2876dbea50a8f7f45 -size 3221 +oid sha256:349a0c4f68c84b9dcd5626310deb7a01e2ab651ec1a89f47e15f630a307d9c41 +size 3224 diff --git a/data/minecraft/structure/trial_chambers/corridor/atrium/grand_staircase_1.nbt b/data/minecraft/structure/trial_chambers/corridor/atrium/grand_staircase_1.nbt index 0202f574..a5fb66d7 100644 --- a/data/minecraft/structure/trial_chambers/corridor/atrium/grand_staircase_1.nbt +++ b/data/minecraft/structure/trial_chambers/corridor/atrium/grand_staircase_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:43615f53db63277c3c9cae58ea451652f54000e93e0597e2ec9f68205945576d -size 2881 +oid sha256:b94015a2594bf308dec6bd87176b6a25b6d3baf5862ab8ca6166aef17d01198b +size 2884 diff --git a/data/minecraft/structure/trial_chambers/corridor/atrium/grand_staircase_2.nbt b/data/minecraft/structure/trial_chambers/corridor/atrium/grand_staircase_2.nbt index 55ef0669..dbbb4c6d 100644 --- a/data/minecraft/structure/trial_chambers/corridor/atrium/grand_staircase_2.nbt +++ b/data/minecraft/structure/trial_chambers/corridor/atrium/grand_staircase_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4981171562bb7bde82b45889064608d95862973c7a46d7ceeccdf0f348d6eebc -size 2818 +oid sha256:82ac04293bef439c3b81c465716d3e4c799c58c13ada5d9c9cd27b5af89774fa +size 2821 diff --git a/data/minecraft/structure/trial_chambers/corridor/atrium/grand_staircase_3.nbt b/data/minecraft/structure/trial_chambers/corridor/atrium/grand_staircase_3.nbt index 5d7aeb2c..d2d67c5c 100644 --- a/data/minecraft/structure/trial_chambers/corridor/atrium/grand_staircase_3.nbt +++ b/data/minecraft/structure/trial_chambers/corridor/atrium/grand_staircase_3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:eedd8aec3926c2cab3271cefc59267aae42d9623433582c32f62a0773dfa3c99 -size 2828 +oid sha256:460796015519f9db455de201fbf9de08a75a80c15bfec91b169f302bf697a6ea +size 2831 diff --git a/data/minecraft/structure/trial_chambers/corridor/atrium/spider_relief.nbt b/data/minecraft/structure/trial_chambers/corridor/atrium/spider_relief.nbt index 083d85be..9c09cb51 100644 --- a/data/minecraft/structure/trial_chambers/corridor/atrium/spider_relief.nbt +++ b/data/minecraft/structure/trial_chambers/corridor/atrium/spider_relief.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f99165b9fe3df39bc21103502aba1c75a3057ce374bf7b9f4b14a88f3f98be79 -size 3847 +oid sha256:b400142c1f72decdf285d43313a2ccacd02728e47563d61f755abb857e97c1d7 +size 3849 diff --git a/data/minecraft/structure/trial_chambers/corridor/atrium/spiral_relief.nbt b/data/minecraft/structure/trial_chambers/corridor/atrium/spiral_relief.nbt index 98e4c769..4ffc7f44 100644 --- a/data/minecraft/structure/trial_chambers/corridor/atrium/spiral_relief.nbt +++ b/data/minecraft/structure/trial_chambers/corridor/atrium/spiral_relief.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6fe080bcbda49d0ba44735e3cf0af48b98f55cd5df21b60d399f2b101279088e -size 3315 +oid sha256:57b7d6a7e5ab9cb9517fc7142347ead6ce548596be1b9c45e26acfdab6d75616 +size 3317 diff --git a/data/minecraft/structure/trial_chambers/corridor/atrium_1.nbt b/data/minecraft/structure/trial_chambers/corridor/atrium_1.nbt index 38ff1673..b74ae7fe 100644 --- a/data/minecraft/structure/trial_chambers/corridor/atrium_1.nbt +++ b/data/minecraft/structure/trial_chambers/corridor/atrium_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8bf5044f98b3e7f0bf4d55029fbf0f5eb47f51f8206fd5fc525217b209106154 -size 23436 +oid sha256:e3f42ade7a43a78e3f92e4f6a94ed483ae759e7daea124cb7627d591d1aac531 +size 23427 diff --git a/data/minecraft/structure/trial_chambers/corridor/end_1.nbt b/data/minecraft/structure/trial_chambers/corridor/end_1.nbt index 7c56330c..ff0c0b77 100644 --- a/data/minecraft/structure/trial_chambers/corridor/end_1.nbt +++ b/data/minecraft/structure/trial_chambers/corridor/end_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f70412c99563c76f5e5be5661ec676f897abab8aa25a8b76edfdea8a5b880094 -size 21443 +oid sha256:266fcd75f4ee415d16f2f426c660c2fdc6218cd8efab39d76f0416afec466b3f +size 21446 diff --git a/data/minecraft/structure/trial_chambers/corridor/end_2.nbt b/data/minecraft/structure/trial_chambers/corridor/end_2.nbt index 2f646db7..a0a9b3e7 100644 --- a/data/minecraft/structure/trial_chambers/corridor/end_2.nbt +++ b/data/minecraft/structure/trial_chambers/corridor/end_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:71db7eff49d2e7ccea8a741d3ae45d781b0737853adc04a429fcb5a7d3930b46 -size 21930 +oid sha256:2959440499ce11730c79bb1b11dd1ad7bef139764dbd2ae811a5b59c38b613ff +size 21889 diff --git a/data/minecraft/structure/trial_chambers/corridor/entrance_1.nbt b/data/minecraft/structure/trial_chambers/corridor/entrance_1.nbt index 1663a48b..535f78e0 100644 --- a/data/minecraft/structure/trial_chambers/corridor/entrance_1.nbt +++ b/data/minecraft/structure/trial_chambers/corridor/entrance_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c1fcd6088c9d222b84f617dd1d69eedc857062cfe301bb8fe570ed12335856f5 -size 22135 +oid sha256:134f786c95e43a9f942a3c496fe2bd0b294ed98ee9970a022cad91ad1d75aca0 +size 22026 diff --git a/data/minecraft/structure/trial_chambers/corridor/entrance_2.nbt b/data/minecraft/structure/trial_chambers/corridor/entrance_2.nbt index e970ecbc..fe5dc3e2 100644 --- a/data/minecraft/structure/trial_chambers/corridor/entrance_2.nbt +++ b/data/minecraft/structure/trial_chambers/corridor/entrance_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ea17143a716aaf0650f04967c41ed6ec5e5e90ccb10e10f40f59a02537277189 -size 21598 +oid sha256:bb71681fbcc000740999b838b288ac49a58d011b396b43dce296caff85371c91 +size 21600 diff --git a/data/minecraft/structure/trial_chambers/corridor/entrance_3.nbt b/data/minecraft/structure/trial_chambers/corridor/entrance_3.nbt index 924b0b9c..cd3c31ca 100644 --- a/data/minecraft/structure/trial_chambers/corridor/entrance_3.nbt +++ b/data/minecraft/structure/trial_chambers/corridor/entrance_3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5fc745e287ea1fb060ba78a27e2aba23fd541f36c9c47115fa63ae776ed8e185 -size 24028 +oid sha256:f66d749481a4399cc80ea67d0241438797f65c920ce47e883673034e3080b08b +size 24031 diff --git a/data/minecraft/structure/trial_chambers/corridor/first_plate.nbt b/data/minecraft/structure/trial_chambers/corridor/first_plate.nbt index 84384ba7..16b5fb69 100644 --- a/data/minecraft/structure/trial_chambers/corridor/first_plate.nbt +++ b/data/minecraft/structure/trial_chambers/corridor/first_plate.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0ec176e402a52111201a67b8666a697e42374117b5dfb5fbe7b435c15bfd5ecc -size 1471 +oid sha256:106d9ef484311d65ea35259a853c2862fc6dbccf5878c3b4e3928a4fd5245a3a +size 1473 diff --git a/data/minecraft/structure/trial_chambers/corridor/second_plate.nbt b/data/minecraft/structure/trial_chambers/corridor/second_plate.nbt index b5e5b750..34a69cfc 100644 --- a/data/minecraft/structure/trial_chambers/corridor/second_plate.nbt +++ b/data/minecraft/structure/trial_chambers/corridor/second_plate.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ccc0cd4570a36e83a92836e3b028c6c8d48ef8be0fe69e992b70cdd07b44f01f -size 1475 +oid sha256:6cbcfcd481fa5c7528af69a3d4eeede0c76e0311d716ea9f7a1bebd5b27bcbe7 +size 1478 diff --git a/data/minecraft/structure/trial_chambers/corridor/straight_1.nbt b/data/minecraft/structure/trial_chambers/corridor/straight_1.nbt index 0a054cb4..e7fcb332 100644 --- a/data/minecraft/structure/trial_chambers/corridor/straight_1.nbt +++ b/data/minecraft/structure/trial_chambers/corridor/straight_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a35f6e1a517b1c647fef321fe15d00aec8a6bc6eaee29142583c9588adf876c7 -size 5670 +oid sha256:b0944582de23e4acc1a450fc393c1cde1899c2c2186fae4e36199bda3a0a9283 +size 5672 diff --git a/data/minecraft/structure/trial_chambers/corridor/straight_2.nbt b/data/minecraft/structure/trial_chambers/corridor/straight_2.nbt index 8a6a7c18..4aa32e41 100644 --- a/data/minecraft/structure/trial_chambers/corridor/straight_2.nbt +++ b/data/minecraft/structure/trial_chambers/corridor/straight_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:986ee99af73f12583128675f5fe13431ea1410c260af95659e5a8b6f7355af68 -size 5846 +oid sha256:4ec3478d919a5bc0c95706525ae04e52c39d681efa45148f27dbca8d01b19e73 +size 5848 diff --git a/data/minecraft/structure/trial_chambers/corridor/straight_3.nbt b/data/minecraft/structure/trial_chambers/corridor/straight_3.nbt index bfde3681..07f7e05b 100644 --- a/data/minecraft/structure/trial_chambers/corridor/straight_3.nbt +++ b/data/minecraft/structure/trial_chambers/corridor/straight_3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:47fb3c93ad6e4d4c97bbb380989ceec0ca2602fbc0119fa1ec5d41da945de9d9 -size 5818 +oid sha256:cf8733c20534181fde972c2e25f2a3207b08f81e312a07d2c1e6478091dc639f +size 5821 diff --git a/data/minecraft/structure/trial_chambers/corridor/straight_4.nbt b/data/minecraft/structure/trial_chambers/corridor/straight_4.nbt index 13ac2da9..ded51f5a 100644 --- a/data/minecraft/structure/trial_chambers/corridor/straight_4.nbt +++ b/data/minecraft/structure/trial_chambers/corridor/straight_4.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:20182b75dee12a6edb5e9d2e7f47a1ed505a5cfa6f836410e869d949ca2936f3 -size 5812 +oid sha256:97867a7d0ccc3fba3fda9a8d2a3d413c43be7f23ebd1d0c0e356122e3c47629e +size 5815 diff --git a/data/minecraft/structure/trial_chambers/corridor/straight_5.nbt b/data/minecraft/structure/trial_chambers/corridor/straight_5.nbt index 09a80d22..99a2c2af 100644 --- a/data/minecraft/structure/trial_chambers/corridor/straight_5.nbt +++ b/data/minecraft/structure/trial_chambers/corridor/straight_5.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ef1e508418373233b8e6d86be1b5c77496e176ac5ac76de35b9cd54349c2c42a -size 5820 +oid sha256:e5016424d227a3066e9e421c4382c4e7f72a31a282cb0ee910dd72a8a150296a +size 5822 diff --git a/data/minecraft/structure/trial_chambers/corridor/straight_6.nbt b/data/minecraft/structure/trial_chambers/corridor/straight_6.nbt index ab5a0293..14677715 100644 --- a/data/minecraft/structure/trial_chambers/corridor/straight_6.nbt +++ b/data/minecraft/structure/trial_chambers/corridor/straight_6.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3c12c075f79eb741932bc7a726ab2af0bc81525037927f0baae18ad16cb79805 -size 5775 +oid sha256:417e7366ebcc3db3a65697bd4e76d27d5f5c8279b4d13e097a4e3c3f9ec93a89 +size 5788 diff --git a/data/minecraft/structure/trial_chambers/corridor/straight_7.nbt b/data/minecraft/structure/trial_chambers/corridor/straight_7.nbt index 77567324..d4bbe26c 100644 --- a/data/minecraft/structure/trial_chambers/corridor/straight_7.nbt +++ b/data/minecraft/structure/trial_chambers/corridor/straight_7.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3faef9d2166e598be9315bcfadb1fd1c80715424358112feb7ac8e7d66cf7131 -size 5775 +oid sha256:5541e8101938f4c4326f97525ff0599ba7f22f5eed00161bf23f846181e5adc6 +size 5777 diff --git a/data/minecraft/structure/trial_chambers/corridor/straight_8.nbt b/data/minecraft/structure/trial_chambers/corridor/straight_8.nbt index d47f39a8..67d2ecd3 100644 --- a/data/minecraft/structure/trial_chambers/corridor/straight_8.nbt +++ b/data/minecraft/structure/trial_chambers/corridor/straight_8.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b953e267c12d51c418ec649d7822900fdf52e7465fd5e2bc82372bf95ac1a3a3 -size 5560 +oid sha256:ff514c0730fd62dc6eb728ac255040bcd3d38fff6203a3ec68c6e60402271816 +size 5562 diff --git a/data/minecraft/structure/trial_chambers/decor/barrel.nbt b/data/minecraft/structure/trial_chambers/decor/barrel.nbt index 13bc6284..77697b26 100644 --- a/data/minecraft/structure/trial_chambers/decor/barrel.nbt +++ b/data/minecraft/structure/trial_chambers/decor/barrel.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0e1a0824298257cde1c990995798ad92e55584bd44e17ffadce709628cb98e75 -size 335 +oid sha256:3e933bc1212db348dfad0acaa74a0e75057df8e3afb147c995c16f236765766f +size 337 diff --git a/data/minecraft/structure/trial_chambers/decor/black_bed.nbt b/data/minecraft/structure/trial_chambers/decor/black_bed.nbt new file mode 100644 index 00000000..ed576c26 --- /dev/null +++ b/data/minecraft/structure/trial_chambers/decor/black_bed.nbt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:696f4e7f7c53b066ed233bc15c93409a9138d50066584c1937d6b32687e64e6f +size 327 diff --git a/data/minecraft/structure/trial_chambers/decor/blue_bed.nbt b/data/minecraft/structure/trial_chambers/decor/blue_bed.nbt new file mode 100644 index 00000000..e7d9f765 --- /dev/null +++ b/data/minecraft/structure/trial_chambers/decor/blue_bed.nbt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a294b92349680ce4d13acd6586d01820b35aff9a02f3eb2f48d5e1823cfc686b +size 325 diff --git a/data/minecraft/structure/trial_chambers/decor/brown_bed.nbt b/data/minecraft/structure/trial_chambers/decor/brown_bed.nbt new file mode 100644 index 00000000..daaec739 --- /dev/null +++ b/data/minecraft/structure/trial_chambers/decor/brown_bed.nbt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ef4a59d532829d98428401f36b0a86f74c58c72d592468508502ad84cdd583af +size 327 diff --git a/data/minecraft/structure/trial_chambers/decor/candle_1.nbt b/data/minecraft/structure/trial_chambers/decor/candle_1.nbt index d8d53c17..4c913385 100644 --- a/data/minecraft/structure/trial_chambers/decor/candle_1.nbt +++ b/data/minecraft/structure/trial_chambers/decor/candle_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:bc4982b38311d45f1a64d974f01b0e29f663cbdc6d4e61718e5f076d329418e2 -size 305 +oid sha256:5b18fd01d6ee24f7316c91ccce3c285bc525a825afd67a1827ede7fd81ff5401 +size 307 diff --git a/data/minecraft/structure/trial_chambers/decor/candle_2.nbt b/data/minecraft/structure/trial_chambers/decor/candle_2.nbt index 3fca6bdd..0170e3f1 100644 --- a/data/minecraft/structure/trial_chambers/decor/candle_2.nbt +++ b/data/minecraft/structure/trial_chambers/decor/candle_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6b8807d40b6fd0ea31ad53762dca7e1111031940796c3f9832ae5792def6bc56 -size 305 +oid sha256:35222b83e494ef9888b54a238a4540d2d806c88948d0119c75f4159f7dfce782 +size 307 diff --git a/data/minecraft/structure/trial_chambers/decor/candle_3.nbt b/data/minecraft/structure/trial_chambers/decor/candle_3.nbt index d70df56a..690a78a2 100644 --- a/data/minecraft/structure/trial_chambers/decor/candle_3.nbt +++ b/data/minecraft/structure/trial_chambers/decor/candle_3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c3637e57b22ff9b168b13e6b29083baf258e4d2a1a1771dcb6114038308b3170 -size 305 +oid sha256:6c4ada4ecaca30af141166637a2a63c81934dd7fb40ab28339d269c670f66394 +size 307 diff --git a/data/minecraft/structure/trial_chambers/decor/candle_4.nbt b/data/minecraft/structure/trial_chambers/decor/candle_4.nbt index 7ee2d2f5..409feaaa 100644 --- a/data/minecraft/structure/trial_chambers/decor/candle_4.nbt +++ b/data/minecraft/structure/trial_chambers/decor/candle_4.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:92cd2b29a3f0880926f9efad72ee9378b4c215dc1e3189d83cd8cd9ae0e4e227 -size 305 +oid sha256:aa44843870c01663d75d1ab8616562b4571273b862d49236f9c5c7fd12005bc0 +size 307 diff --git a/data/minecraft/structure/trial_chambers/decor/cyan_bed.nbt b/data/minecraft/structure/trial_chambers/decor/cyan_bed.nbt new file mode 100644 index 00000000..9a3e08cb --- /dev/null +++ b/data/minecraft/structure/trial_chambers/decor/cyan_bed.nbt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8d2b2c538661c52c6420b689500a06bb914ab7b8959582cedb4f813de2727f5a +size 325 diff --git a/data/minecraft/structure/trial_chambers/decor/dead_bush_pot.nbt b/data/minecraft/structure/trial_chambers/decor/dead_bush_pot.nbt index 4dc43888..50ac2be4 100644 --- a/data/minecraft/structure/trial_chambers/decor/dead_bush_pot.nbt +++ b/data/minecraft/structure/trial_chambers/decor/dead_bush_pot.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c77fc4b7e2785e6a5db392ae2410de9583919dbc8d13f4fc396808fb91a777c2 -size 287 +oid sha256:926f22a3195e286a99f6a68de64925bb61b93c740628de27264f03a8645af9bd +size 290 diff --git a/data/minecraft/structure/trial_chambers/decor/disposal.nbt b/data/minecraft/structure/trial_chambers/decor/disposal.nbt new file mode 100644 index 00000000..12bbb22d --- /dev/null +++ b/data/minecraft/structure/trial_chambers/decor/disposal.nbt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:30385c4ea432a34d3b36444c2c424d69f72a99ee0ddc999711046245931cae98 +size 516 diff --git a/data/minecraft/structure/trial_chambers/decor/empty_pot.nbt b/data/minecraft/structure/trial_chambers/decor/empty_pot.nbt index 60681b84..d006200a 100644 --- a/data/minecraft/structure/trial_chambers/decor/empty_pot.nbt +++ b/data/minecraft/structure/trial_chambers/decor/empty_pot.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0c4157e1075081e7ae837b7e6e408a5ee6eaa2d31398f2766e817ea99f0c9ebb -size 284 +oid sha256:e02070da095d7db4f05c50f6f14b3f82bd704bf612c7541780fe9435f5094348 +size 286 diff --git a/data/minecraft/structure/trial_chambers/decor/flow_pot.nbt b/data/minecraft/structure/trial_chambers/decor/flow_pot.nbt index f259154a..6f8c9617 100644 --- a/data/minecraft/structure/trial_chambers/decor/flow_pot.nbt +++ b/data/minecraft/structure/trial_chambers/decor/flow_pot.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:126b42da19845ff0fa23fe6f812f232ad4cb2666205133dea2ba51d812586cd2 -size 385 +oid sha256:eee033b84df4626084b85c09d23790312bfa05ec94fb1e23012f4922c7396eb1 +size 388 diff --git a/data/minecraft/structure/trial_chambers/decor/gray_bed.nbt b/data/minecraft/structure/trial_chambers/decor/gray_bed.nbt new file mode 100644 index 00000000..cf7e54b9 --- /dev/null +++ b/data/minecraft/structure/trial_chambers/decor/gray_bed.nbt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:93df09f2eec452961222c9070ddbb926e6da57fbf13eea610d445774112f5829 +size 326 diff --git a/data/minecraft/structure/trial_chambers/decor/green_bed.nbt b/data/minecraft/structure/trial_chambers/decor/green_bed.nbt new file mode 100644 index 00000000..c0766ddb --- /dev/null +++ b/data/minecraft/structure/trial_chambers/decor/green_bed.nbt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:364e6b862f8277f668a9be85c744c38707a3b4fcec23595307d7bbef0aaa670e +size 327 diff --git a/data/minecraft/structure/trial_chambers/decor/guster_pot.nbt b/data/minecraft/structure/trial_chambers/decor/guster_pot.nbt index b62d4888..bc22f4d5 100644 --- a/data/minecraft/structure/trial_chambers/decor/guster_pot.nbt +++ b/data/minecraft/structure/trial_chambers/decor/guster_pot.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6d90f49590c798a080190603c8ed8bdf843894cc83c98300ea744951418a7d08 -size 383 +oid sha256:2f80be1dd69a5cb452d0a6283edf8961bde5a8e09d0e6d54cd8dca882ab70da1 +size 385 diff --git a/data/minecraft/structure/trial_chambers/decor/light_blue_bed.nbt b/data/minecraft/structure/trial_chambers/decor/light_blue_bed.nbt new file mode 100644 index 00000000..7373e18a --- /dev/null +++ b/data/minecraft/structure/trial_chambers/decor/light_blue_bed.nbt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c35a771a3757c3df791e1fab53c5755dfcf0a9721fbfe213f845b0c8c4d7a72f +size 331 diff --git a/data/minecraft/structure/trial_chambers/decor/light_gray_bed.nbt b/data/minecraft/structure/trial_chambers/decor/light_gray_bed.nbt new file mode 100644 index 00000000..b4662de4 --- /dev/null +++ b/data/minecraft/structure/trial_chambers/decor/light_gray_bed.nbt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e81d3ca8ad54da837013414d9f80b560bff5f05fabc7c95d62013406e9a8b104 +size 331 diff --git a/data/minecraft/structure/trial_chambers/decor/lime_bed.nbt b/data/minecraft/structure/trial_chambers/decor/lime_bed.nbt new file mode 100644 index 00000000..28a4280d --- /dev/null +++ b/data/minecraft/structure/trial_chambers/decor/lime_bed.nbt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:deebd9331005a03542fb31ef265aed9327b08fdcee6fb9abca5e0905537e50ca +size 325 diff --git a/data/minecraft/structure/trial_chambers/decor/magenta_bed.nbt b/data/minecraft/structure/trial_chambers/decor/magenta_bed.nbt new file mode 100644 index 00000000..1641762a --- /dev/null +++ b/data/minecraft/structure/trial_chambers/decor/magenta_bed.nbt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:561e51f4047c4cb8b6f5c3213210ab5ae8b250504cb48f66ebe27151c46d5c03 +size 328 diff --git a/data/minecraft/structure/trial_chambers/decor/orange_bed.nbt b/data/minecraft/structure/trial_chambers/decor/orange_bed.nbt new file mode 100644 index 00000000..6408af62 --- /dev/null +++ b/data/minecraft/structure/trial_chambers/decor/orange_bed.nbt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3ec1d6ad6b01239c76c74f2167e7ef8859466f366cd32278e89e23c9b2e0f9c1 +size 328 diff --git a/data/minecraft/structure/trial_chambers/decor/pink_bed.nbt b/data/minecraft/structure/trial_chambers/decor/pink_bed.nbt new file mode 100644 index 00000000..2bcce0d0 --- /dev/null +++ b/data/minecraft/structure/trial_chambers/decor/pink_bed.nbt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:eccda93a1ee818f9d458b1837f1d4ef99ef5bfc4923c1608fc9921888d625a31 +size 325 diff --git a/data/minecraft/structure/trial_chambers/decor/purple_bed.nbt b/data/minecraft/structure/trial_chambers/decor/purple_bed.nbt new file mode 100644 index 00000000..c35d8c33 --- /dev/null +++ b/data/minecraft/structure/trial_chambers/decor/purple_bed.nbt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:800dba76e678c8899cf85dc6950e1e4a815865dc5f2a2ea21331acd13bdfa729 +size 328 diff --git a/data/minecraft/structure/trial_chambers/decor/red_bed.nbt b/data/minecraft/structure/trial_chambers/decor/red_bed.nbt new file mode 100644 index 00000000..265430ca --- /dev/null +++ b/data/minecraft/structure/trial_chambers/decor/red_bed.nbt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:50008f2e8c8eb04eb9ea2481b1e499933bf5df66327af5a2e27249d642134ac9 +size 324 diff --git a/data/minecraft/structure/trial_chambers/decor/scrape_pot.nbt b/data/minecraft/structure/trial_chambers/decor/scrape_pot.nbt index 847c3b5f..9eee2b89 100644 --- a/data/minecraft/structure/trial_chambers/decor/scrape_pot.nbt +++ b/data/minecraft/structure/trial_chambers/decor/scrape_pot.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6757e0001e3bbb59af7725609333a553f515433875409059a29ab9ccc53af9c3 -size 382 +oid sha256:d2074d292315fb6701f9bbfddf95c13e13bcc6191c9ca08cead74780a4a2bd5e +size 384 diff --git a/data/minecraft/structure/trial_chambers/decor/undecorated_pot.nbt b/data/minecraft/structure/trial_chambers/decor/undecorated_pot.nbt index 3a8235dd..1ba61ffd 100644 --- a/data/minecraft/structure/trial_chambers/decor/undecorated_pot.nbt +++ b/data/minecraft/structure/trial_chambers/decor/undecorated_pot.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f066cab1251bb9acf08fc717f1cc2aa6b6edaf7f8814604e2a5383fc88d883e7 -size 350 +oid sha256:62fc268533e8cc20c54856abdedb42b5238583417ab8403a357211b3835cfc84 +size 353 diff --git a/data/minecraft/structure/trial_chambers/decor/white_bed.nbt b/data/minecraft/structure/trial_chambers/decor/white_bed.nbt new file mode 100644 index 00000000..7a6336d8 --- /dev/null +++ b/data/minecraft/structure/trial_chambers/decor/white_bed.nbt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c33c83750c9838d29c6c00e9211d132de0d33caf7321179f1a40cfbab35022b6 +size 327 diff --git a/data/minecraft/structure/trial_chambers/decor/yellow_bed.nbt b/data/minecraft/structure/trial_chambers/decor/yellow_bed.nbt new file mode 100644 index 00000000..53b7a7ce --- /dev/null +++ b/data/minecraft/structure/trial_chambers/decor/yellow_bed.nbt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:77bede75328695c77794d33e61fe0bbd7637aafd82b7fb0761cb37816cd8aee7 +size 328 diff --git a/data/minecraft/structure/trial_chambers/dispensers/chamber.nbt b/data/minecraft/structure/trial_chambers/dispensers/chamber.nbt index 3946011d..0652c129 100644 --- a/data/minecraft/structure/trial_chambers/dispensers/chamber.nbt +++ b/data/minecraft/structure/trial_chambers/dispensers/chamber.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:eb7ac79cdfbb0de16e68084a0dfe917ad4f66e99c34ab5ca9ad8d8bba932d64f -size 383 +oid sha256:05e30cbb19f3112cfe18b65e91022933c82254b7408d4c2e7ee4ccb1d9fe3684 +size 384 diff --git a/data/minecraft/structure/trial_chambers/dispensers/floor_dispenser.nbt b/data/minecraft/structure/trial_chambers/dispensers/floor_dispenser.nbt index b2fc00cd..d8961fd0 100644 --- a/data/minecraft/structure/trial_chambers/dispensers/floor_dispenser.nbt +++ b/data/minecraft/structure/trial_chambers/dispensers/floor_dispenser.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:61831b5be335f5d24627054321055511839347190dbe8ca40f15e59ef5296de2 -size 355 +oid sha256:62fce59fb6b6ac926fa795126dd8b3f73ad421fda5e60d9da2cd8465a91d3756 +size 358 diff --git a/data/minecraft/structure/trial_chambers/dispensers/wall_dispenser.nbt b/data/minecraft/structure/trial_chambers/dispensers/wall_dispenser.nbt index bfe3e7ea..d5574b8a 100644 --- a/data/minecraft/structure/trial_chambers/dispensers/wall_dispenser.nbt +++ b/data/minecraft/structure/trial_chambers/dispensers/wall_dispenser.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e5b633594aab1db266b797e01edaea6352fbd35a031ff3dd3e366be2934ed331 -size 411 +oid sha256:65a140bbb0ed5d939af25d64c0babf0be3a7fa5460285576edcb96878511d4c0 +size 414 diff --git a/data/minecraft/structure/trial_chambers/hallway/cache_1.nbt b/data/minecraft/structure/trial_chambers/hallway/cache_1.nbt index 4f54f433..64402a6d 100644 --- a/data/minecraft/structure/trial_chambers/hallway/cache_1.nbt +++ b/data/minecraft/structure/trial_chambers/hallway/cache_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2d851ace422124d25bfd32b971b36dcea53249743783d1b26eac8d66589a7dae -size 2706 +oid sha256:9d1e6db09be197e553f4a88eeeb0f46cd263cd0e578730afde2cb6a35761dc35 +size 2709 diff --git a/data/minecraft/structure/trial_chambers/hallway/corner_staircase.nbt b/data/minecraft/structure/trial_chambers/hallway/corner_staircase.nbt index 8f4c400d..982a9db8 100644 --- a/data/minecraft/structure/trial_chambers/hallway/corner_staircase.nbt +++ b/data/minecraft/structure/trial_chambers/hallway/corner_staircase.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b9cc5677ddace49e0ac573b3f05f55cc34df61e7fb79aeb3813bba7c2343c40a -size 1436 +oid sha256:af854868cab8866de827b54efb8da593b111043ac0e0dcf9b3b39b4974b98814 +size 1435 diff --git a/data/minecraft/structure/trial_chambers/hallway/corner_staircase_down.nbt b/data/minecraft/structure/trial_chambers/hallway/corner_staircase_down.nbt index 4e6fd243..cdad9ea8 100644 --- a/data/minecraft/structure/trial_chambers/hallway/corner_staircase_down.nbt +++ b/data/minecraft/structure/trial_chambers/hallway/corner_staircase_down.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7aea926ae3cb6e5c938d0b8ab6ca60b97b4d1ef38a6aa1766221c3ba4498cd7e -size 1439 +oid sha256:317228f4ba7a1283080951f1d80a9003da513de25123dc3c2749e0638565d997 +size 1438 diff --git a/data/minecraft/structure/trial_chambers/hallway/corridor_connector_1.nbt b/data/minecraft/structure/trial_chambers/hallway/corridor_connector_1.nbt index c69ae34c..9726c85a 100644 --- a/data/minecraft/structure/trial_chambers/hallway/corridor_connector_1.nbt +++ b/data/minecraft/structure/trial_chambers/hallway/corridor_connector_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9f7aadb7fb499f10fc512642bccafba975e7561fd246b61e173da938038e180e -size 687 +oid sha256:272362ffb8e7d730ad659b0971fe84db15553ab7ae7bd5a116f99159154beec6 +size 689 diff --git a/data/minecraft/structure/trial_chambers/hallway/encounter_1.nbt b/data/minecraft/structure/trial_chambers/hallway/encounter_1.nbt new file mode 100644 index 00000000..1e7889d0 --- /dev/null +++ b/data/minecraft/structure/trial_chambers/hallway/encounter_1.nbt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:68e2852f7279c291f9cd544e751ff1bc337b0770db59c62472855cef0faca54d +size 7351 diff --git a/data/minecraft/structure/trial_chambers/hallway/encounter_2.nbt b/data/minecraft/structure/trial_chambers/hallway/encounter_2.nbt new file mode 100644 index 00000000..71058b0f --- /dev/null +++ b/data/minecraft/structure/trial_chambers/hallway/encounter_2.nbt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:edd4ae40d1c58177e08d24de157a8f594767e31f11939364248d8b6d33668eaf +size 6705 diff --git a/data/minecraft/structure/trial_chambers/hallway/encounter_3.nbt b/data/minecraft/structure/trial_chambers/hallway/encounter_3.nbt new file mode 100644 index 00000000..498b1178 --- /dev/null +++ b/data/minecraft/structure/trial_chambers/hallway/encounter_3.nbt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ab3cc7fb6e82b254570739a7dda6c647547a9274d3804a1d3f7f10258363fe3d +size 5627 diff --git a/data/minecraft/structure/trial_chambers/hallway/encounter_4.nbt b/data/minecraft/structure/trial_chambers/hallway/encounter_4.nbt new file mode 100644 index 00000000..c1a88568 --- /dev/null +++ b/data/minecraft/structure/trial_chambers/hallway/encounter_4.nbt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f09de2ff257f8830eb6060bedaaf11af2111728b888376ede154eabb151fc6b8 +size 17907 diff --git a/data/minecraft/structure/trial_chambers/hallway/encounter_5.nbt b/data/minecraft/structure/trial_chambers/hallway/encounter_5.nbt new file mode 100644 index 00000000..78958a85 --- /dev/null +++ b/data/minecraft/structure/trial_chambers/hallway/encounter_5.nbt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:429024043424740e34f3b20f61ea3f28faf5ee94166f81a2482224dc1a48d39c +size 14324 diff --git a/data/minecraft/structure/trial_chambers/hallway/left_corner.nbt b/data/minecraft/structure/trial_chambers/hallway/left_corner.nbt index d01e7e4f..90908f8a 100644 --- a/data/minecraft/structure/trial_chambers/hallway/left_corner.nbt +++ b/data/minecraft/structure/trial_chambers/hallway/left_corner.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:01271de6f1af015792d3061fa3b30dcf04e4422766939866b95ec1563096d243 -size 896 +oid sha256:31f31cdeedb9a19ab16369cb01e88e582be10f06cdf8689e612e1b53a00b81b6 +size 938 diff --git a/data/minecraft/structure/trial_chambers/hallway/long_straight_staircase.nbt b/data/minecraft/structure/trial_chambers/hallway/long_straight_staircase.nbt index bb34ad83..eb95c657 100644 --- a/data/minecraft/structure/trial_chambers/hallway/long_straight_staircase.nbt +++ b/data/minecraft/structure/trial_chambers/hallway/long_straight_staircase.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:23e66111cb651f3ec8ed9e5e51afaf428cc5641fd2c0256ccb8ffd042ccf5961 -size 2591 +oid sha256:2af413a97cf10c26de442d704389602a161bc2fd37b85b56006ebad754b9024c +size 2593 diff --git a/data/minecraft/structure/trial_chambers/hallway/long_straight_staircase_down.nbt b/data/minecraft/structure/trial_chambers/hallway/long_straight_staircase_down.nbt index 04a576b8..39eb19b1 100644 --- a/data/minecraft/structure/trial_chambers/hallway/long_straight_staircase_down.nbt +++ b/data/minecraft/structure/trial_chambers/hallway/long_straight_staircase_down.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2bb8a843e1f83b088f0966f386188dc4b584de4c2e89a723d15a879d876e732c -size 2591 +oid sha256:43411feacf86b393665fedc1a662ccd00e04cba4205a3e58874fd6b5451f896b +size 2594 diff --git a/data/minecraft/structure/trial_chambers/hallway/lower_hallway_connector.nbt b/data/minecraft/structure/trial_chambers/hallway/lower_hallway_connector.nbt index 9693ac53..2a3d0baa 100644 --- a/data/minecraft/structure/trial_chambers/hallway/lower_hallway_connector.nbt +++ b/data/minecraft/structure/trial_chambers/hallway/lower_hallway_connector.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:620f32e60fc493e4a25e73554eb0b006f6bf75771e810d0b3b7af08d2a17d2ce -size 3183 +oid sha256:0a1cf5ba3d40a53aede13f920a6b88b925f9a2805bee12d3ba73e1ae9118e2ee +size 3186 diff --git a/data/minecraft/structure/trial_chambers/hallway/right_corner.nbt b/data/minecraft/structure/trial_chambers/hallway/right_corner.nbt index d0c8e0ba..4bb4ca34 100644 --- a/data/minecraft/structure/trial_chambers/hallway/right_corner.nbt +++ b/data/minecraft/structure/trial_chambers/hallway/right_corner.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2f669e3464be044c6d116d23caad00e505e7f854ae6de5a8af428ce05e5902c6 -size 872 +oid sha256:c5b48ad1bb613f6c6bd97564bcff27f3e0dceb6a9dc3da3344e78802205a0e9f +size 945 diff --git a/data/minecraft/structure/trial_chambers/hallway/rubble.nbt b/data/minecraft/structure/trial_chambers/hallway/rubble.nbt index ba393a83..41595e3e 100644 --- a/data/minecraft/structure/trial_chambers/hallway/rubble.nbt +++ b/data/minecraft/structure/trial_chambers/hallway/rubble.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b8e3abb77b23b6d66291752732db9ae02bbc59bcbd48fe339f2e5b2844b6ea19 -size 933 +oid sha256:48bc137a467729d67a8f276fe75d962bcc24bbc1134c83924a2db7d8ab63e5fb +size 936 diff --git a/data/minecraft/structure/trial_chambers/hallway/rubble_chamber.nbt b/data/minecraft/structure/trial_chambers/hallway/rubble_chamber.nbt index 79620891..f419c2ba 100644 --- a/data/minecraft/structure/trial_chambers/hallway/rubble_chamber.nbt +++ b/data/minecraft/structure/trial_chambers/hallway/rubble_chamber.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9b46d2ecc3c7bf767da8dd2bdd909af527e92b794120d459fcdef56b74e3f3c5 -size 924 +oid sha256:1923e0823b06802c2c5f2451d919c500c4fe68ce9e8dcbeae7c7eeb05ecc91eb +size 926 diff --git a/data/minecraft/structure/trial_chambers/hallway/rubble_chamber_thin.nbt b/data/minecraft/structure/trial_chambers/hallway/rubble_chamber_thin.nbt index 41d91500..8e53c780 100644 --- a/data/minecraft/structure/trial_chambers/hallway/rubble_chamber_thin.nbt +++ b/data/minecraft/structure/trial_chambers/hallway/rubble_chamber_thin.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ffd05de3d868420a58acdf83fa5450d3b9a351924944c20bbe3fd45c172e3791 -size 469 +oid sha256:de1a88b20c679493b93adbbd52b9a398ba9cd504ad407a2899030d2ec9f5e760 +size 471 diff --git a/data/minecraft/structure/trial_chambers/hallway/rubble_thin.nbt b/data/minecraft/structure/trial_chambers/hallway/rubble_thin.nbt index 41d91500..8e53c780 100644 --- a/data/minecraft/structure/trial_chambers/hallway/rubble_thin.nbt +++ b/data/minecraft/structure/trial_chambers/hallway/rubble_thin.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ffd05de3d868420a58acdf83fa5450d3b9a351924944c20bbe3fd45c172e3791 -size 469 +oid sha256:de1a88b20c679493b93adbbd52b9a398ba9cd504ad407a2899030d2ec9f5e760 +size 471 diff --git a/data/minecraft/structure/trial_chambers/hallway/straight.nbt b/data/minecraft/structure/trial_chambers/hallway/straight.nbt index 959aea3a..4788f4d7 100644 --- a/data/minecraft/structure/trial_chambers/hallway/straight.nbt +++ b/data/minecraft/structure/trial_chambers/hallway/straight.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:bba2f59fb52a208b5dc5911e882c238507b5155bfde9bd0f014c0e11fb2ed377 -size 930 +oid sha256:6e78c5e58d30d83fc34247146a60c56c14f1b84307f921e28fe3c9453ab57602 +size 932 diff --git a/data/minecraft/structure/trial_chambers/hallway/straight_staircase.nbt b/data/minecraft/structure/trial_chambers/hallway/straight_staircase.nbt index 9b4f9c12..397b8c81 100644 --- a/data/minecraft/structure/trial_chambers/hallway/straight_staircase.nbt +++ b/data/minecraft/structure/trial_chambers/hallway/straight_staircase.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c06df5fc8e96ea6a7f0bb7532fc427387b51b5a28f19aa15b76cdc9f3b0be51b -size 1177 +oid sha256:c3c67bffe44294ca263ace58b3de100abb63f7ed6c4d8423238e0567d41dc168 +size 1178 diff --git a/data/minecraft/structure/trial_chambers/hallway/straight_staircase_down.nbt b/data/minecraft/structure/trial_chambers/hallway/straight_staircase_down.nbt index 78b38f92..1baf003b 100644 --- a/data/minecraft/structure/trial_chambers/hallway/straight_staircase_down.nbt +++ b/data/minecraft/structure/trial_chambers/hallway/straight_staircase_down.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ccc9674ecbab2b7cce69ce89fcbd22bb2ff4eb0716be17d875226eefbd1e88c8 -size 1175 +oid sha256:d52dffbac590b63fa0ae1ad4b3015ee150654f2949e6ba53c9007a69abaec3e8 +size 1177 diff --git a/data/minecraft/structure/trial_chambers/hallway/trapped_staircase.nbt b/data/minecraft/structure/trial_chambers/hallway/trapped_staircase.nbt new file mode 100644 index 00000000..dc011ed7 --- /dev/null +++ b/data/minecraft/structure/trial_chambers/hallway/trapped_staircase.nbt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ce085df4a5091a9fd38014c04260d9c42dec6897dc3acccd22b35a48154a1c72 +size 3613 diff --git a/data/minecraft/structure/trial_chambers/hallway/upper_hallway_connector.nbt b/data/minecraft/structure/trial_chambers/hallway/upper_hallway_connector.nbt index 8ed4b88f..f535bf20 100644 --- a/data/minecraft/structure/trial_chambers/hallway/upper_hallway_connector.nbt +++ b/data/minecraft/structure/trial_chambers/hallway/upper_hallway_connector.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:bc3a72824ffe8ba2ff0a56d3bb13317526908eb363775a7c77c080601ef261ab -size 2698 +oid sha256:2a37179366cf289b191ec9e9caba20a7eae9bcdcd8efeda17f66cb0bc1f4f338 +size 2700 diff --git a/data/minecraft/structure/trial_chambers/intersection/intersection_1.nbt b/data/minecraft/structure/trial_chambers/intersection/intersection_1.nbt index cf8543d2..8da146ef 100644 --- a/data/minecraft/structure/trial_chambers/intersection/intersection_1.nbt +++ b/data/minecraft/structure/trial_chambers/intersection/intersection_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:898d8c0e056bffb32da1087f187359747b3d31ccd95d8300a0919dcf437ffabc -size 29464 +oid sha256:88cb188e2bd55f043a1d95c44e7e7f2f8d9d4b7beea5ab2f7367ff034b1ccf92 +size 29422 diff --git a/data/minecraft/structure/trial_chambers/intersection/intersection_2.nbt b/data/minecraft/structure/trial_chambers/intersection/intersection_2.nbt index 4714eb7f..1149d57c 100644 --- a/data/minecraft/structure/trial_chambers/intersection/intersection_2.nbt +++ b/data/minecraft/structure/trial_chambers/intersection/intersection_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c9a695b541aa6340893726411e41b31c253ebfab33d8ecbe527e7aff61fd6683 -size 30384 +oid sha256:89a26dcac4eb71552cbdad6fc3652b6588a21ba8066134b270cb21b12160099c +size 30344 diff --git a/data/minecraft/structure/trial_chambers/intersection/intersection_3.nbt b/data/minecraft/structure/trial_chambers/intersection/intersection_3.nbt index f2ef9aaa..82a059e3 100644 --- a/data/minecraft/structure/trial_chambers/intersection/intersection_3.nbt +++ b/data/minecraft/structure/trial_chambers/intersection/intersection_3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:11fa505c32584b1182a3cac9dfce8837d5c52ac22dc8db5715efd0ffb9cd1531 -size 49426 +oid sha256:e67de627a5a6415a5e892668befb7e85df483c6550c5549c5517ddf8f89c9b9e +size 49356 diff --git a/data/minecraft/structure/trial_chambers/reward/ominous_vault.nbt b/data/minecraft/structure/trial_chambers/reward/ominous_vault.nbt index 40826934..716a6c9b 100644 --- a/data/minecraft/structure/trial_chambers/reward/ominous_vault.nbt +++ b/data/minecraft/structure/trial_chambers/reward/ominous_vault.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3489817bc22b31d794fdb7198b4dedea94bb9e0cda96880077047e062ff9b129 -size 688 +oid sha256:4884221d7773efd9e487ab2920bdda99c93a19ed399fa20ce8b419a93a47fffe +size 690 diff --git a/data/minecraft/structure/trial_chambers/reward/vault.nbt b/data/minecraft/structure/trial_chambers/reward/vault.nbt index 26c67535..6cd242d9 100644 --- a/data/minecraft/structure/trial_chambers/reward/vault.nbt +++ b/data/minecraft/structure/trial_chambers/reward/vault.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d946d8abec5ea5177ace67924c5b7a389fa1013a920c4a562f06981df8e5ab48 -size 502 +oid sha256:075feb4aed9b164b0bdaf22d24c2402ca98de5bef5844d79383126b5deecbc8d +size 504 diff --git a/data/minecraft/structure/trial_chambers/spawner/breeze/breeze.nbt b/data/minecraft/structure/trial_chambers/spawner/breeze/breeze.nbt index 6e694325..c0b8cdfc 100644 --- a/data/minecraft/structure/trial_chambers/spawner/breeze/breeze.nbt +++ b/data/minecraft/structure/trial_chambers/spawner/breeze/breeze.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8c40c320c361a5bd744a11726e62641dfa9760ee633e3498e1e1be3d77a988ff -size 613 +oid sha256:735e95bf2477bd31efa5c69daa8160e2c1293a813348aa542e41a2c8b814c8bb +size 469 diff --git a/data/minecraft/structure/trial_chambers/spawner/connectors/breeze.nbt b/data/minecraft/structure/trial_chambers/spawner/connectors/breeze.nbt index 70184842..5082ab6b 100644 --- a/data/minecraft/structure/trial_chambers/spawner/connectors/breeze.nbt +++ b/data/minecraft/structure/trial_chambers/spawner/connectors/breeze.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d04cf1dae8d6d21e9da74ac4b55e53acfe80e82b8cba1150f40ddce703a18621 -size 325 +oid sha256:b2008c7d1dbbdd20879b0556afec59a8055fdd42f2b727823fab76d0fe605ef8 +size 328 diff --git a/data/minecraft/structure/trial_chambers/spawner/connectors/melee.nbt b/data/minecraft/structure/trial_chambers/spawner/connectors/melee.nbt index 2f435e8f..ea3534f8 100644 --- a/data/minecraft/structure/trial_chambers/spawner/connectors/melee.nbt +++ b/data/minecraft/structure/trial_chambers/spawner/connectors/melee.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:da5a0796de48ffac7c646b38c3f505fe9a9e33b965d87983f8d40c6cd92b09d3 -size 325 +oid sha256:3da4f0d57072cc69d44a520acd86fda3d79b1a46bb02c26453770b8a4d02b2bc +size 327 diff --git a/data/minecraft/structure/trial_chambers/spawner/connectors/ranged.nbt b/data/minecraft/structure/trial_chambers/spawner/connectors/ranged.nbt index c2a5daf0..8ef56c25 100644 --- a/data/minecraft/structure/trial_chambers/spawner/connectors/ranged.nbt +++ b/data/minecraft/structure/trial_chambers/spawner/connectors/ranged.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:935bb2c5a8e625853a7d9779db6e75c6dfa7ccb7d3abbadea0c391b034fcce65 -size 325 +oid sha256:d82b3966eed727e52995437b5df9d17ff6f4b16ddacf9efcc65160e7d34a17cb +size 327 diff --git a/data/minecraft/structure/trial_chambers/spawner/connectors/slow_ranged.nbt b/data/minecraft/structure/trial_chambers/spawner/connectors/slow_ranged.nbt index 0451c5ab..40647b35 100644 --- a/data/minecraft/structure/trial_chambers/spawner/connectors/slow_ranged.nbt +++ b/data/minecraft/structure/trial_chambers/spawner/connectors/slow_ranged.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b61e955802b1693e1b4b03cc75a5534e65ec95078bd07ed49ca761cfddf65aa8 -size 329 +oid sha256:754bca2af1597953ad00b480f0f47b92881d4f332cac6a0e0275e8e00eebe916 +size 331 diff --git a/data/minecraft/structure/trial_chambers/spawner/connectors/small_melee.nbt b/data/minecraft/structure/trial_chambers/spawner/connectors/small_melee.nbt index c8a5147e..ae8a13b5 100644 --- a/data/minecraft/structure/trial_chambers/spawner/connectors/small_melee.nbt +++ b/data/minecraft/structure/trial_chambers/spawner/connectors/small_melee.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5dbd03ab7fbe6235608449e3e3fb139869b66e4d5f0302bf48811d13cec65f41 -size 328 +oid sha256:0a96408a7dae012a70c6cef2590114a786ef9566878c52f09517f1d298d7f55b +size 330 diff --git a/data/minecraft/structure/trial_chambers/spawner/melee/husk.nbt b/data/minecraft/structure/trial_chambers/spawner/melee/husk.nbt index 771d6795..f9d84275 100644 --- a/data/minecraft/structure/trial_chambers/spawner/melee/husk.nbt +++ b/data/minecraft/structure/trial_chambers/spawner/melee/husk.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:54033754ff22d1150ba39980bf02da9e5d95caf51f57cb9caf286669d30f7979 -size 638 +oid sha256:c61c571d9a59548b1ed05fdc99d486dbdbecf711ca01ac282817d1ceea3e1283 +size 473 diff --git a/data/minecraft/structure/trial_chambers/spawner/melee/spider.nbt b/data/minecraft/structure/trial_chambers/spawner/melee/spider.nbt index e078af0f..3660cae0 100644 --- a/data/minecraft/structure/trial_chambers/spawner/melee/spider.nbt +++ b/data/minecraft/structure/trial_chambers/spawner/melee/spider.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:97816c297fc09cb0282677af71682f0bdf047d703f07beff4f69c7dcfa9aca03 -size 613 +oid sha256:fa9b6f64a0261dbeb65aad2ce15b1580b89efe00955a09ab9be80e9ba796336b +size 481 diff --git a/data/minecraft/structure/trial_chambers/spawner/melee/zombie.nbt b/data/minecraft/structure/trial_chambers/spawner/melee/zombie.nbt index 9c1748b5..923a02ad 100644 --- a/data/minecraft/structure/trial_chambers/spawner/melee/zombie.nbt +++ b/data/minecraft/structure/trial_chambers/spawner/melee/zombie.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:cab73bc721410fbbe31fa6022a9b5da35c5f45f6a66804241bf8172fc218aaa8 -size 640 +oid sha256:fee380edfe800aa2173b0632feab28d76c668f987a8f861b10dee4d56c5cd693 +size 480 diff --git a/data/minecraft/structure/trial_chambers/spawner/ranged/poison_skeleton.nbt b/data/minecraft/structure/trial_chambers/spawner/ranged/poison_skeleton.nbt index 23bc1259..c8ad7d90 100644 --- a/data/minecraft/structure/trial_chambers/spawner/ranged/poison_skeleton.nbt +++ b/data/minecraft/structure/trial_chambers/spawner/ranged/poison_skeleton.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c56554fc6e4fb9b0f6aaf5e2d3f8235fe7af9200126d38062282c71710229fa0 -size 681 +oid sha256:0145ddd0a84d72f91561d227fce42470042e44e63dfdc8c619e4d10b4cb1095d +size 524 diff --git a/data/minecraft/structure/trial_chambers/spawner/ranged/skeleton.nbt b/data/minecraft/structure/trial_chambers/spawner/ranged/skeleton.nbt index 12efc45d..4407adcf 100644 --- a/data/minecraft/structure/trial_chambers/spawner/ranged/skeleton.nbt +++ b/data/minecraft/structure/trial_chambers/spawner/ranged/skeleton.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f2efff47d561c5c4911e29375ae5c05561383d83a0c538212ef2d1cecf64461f -size 645 +oid sha256:f0f1a7d2e81efb1304343f7adfa311a2bb3d5c153f8acd68ea7120a7a0091dfe +size 480 diff --git a/data/minecraft/structure/trial_chambers/spawner/ranged/stray.nbt b/data/minecraft/structure/trial_chambers/spawner/ranged/stray.nbt index 645db6a5..8469451e 100644 --- a/data/minecraft/structure/trial_chambers/spawner/ranged/stray.nbt +++ b/data/minecraft/structure/trial_chambers/spawner/ranged/stray.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4fc8e524723d6ddf55ec9d5c5879757f54fedaccb2bb8904e4e92c1f2be89eae -size 638 +oid sha256:9f2a9207d369ea7442ec1b4927fe3599f4f57898952d41533080401b0f09dbc0 +size 476 diff --git a/data/minecraft/structure/trial_chambers/spawner/slow_ranged/poison_skeleton.nbt b/data/minecraft/structure/trial_chambers/spawner/slow_ranged/poison_skeleton.nbt index 1a33fd85..294d7272 100644 --- a/data/minecraft/structure/trial_chambers/spawner/slow_ranged/poison_skeleton.nbt +++ b/data/minecraft/structure/trial_chambers/spawner/slow_ranged/poison_skeleton.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b42e053e9793d466cc5a1ef1ede6b80f33b4a85cb61cd1fe55cb2a0485713434 -size 684 +oid sha256:c57ec721a495343bb7c5fd1c74dcd9cee602ae4582f0fe876dbc5640352636c5 +size 527 diff --git a/data/minecraft/structure/trial_chambers/spawner/slow_ranged/skeleton.nbt b/data/minecraft/structure/trial_chambers/spawner/slow_ranged/skeleton.nbt index 423a13f6..d0882938 100644 --- a/data/minecraft/structure/trial_chambers/spawner/slow_ranged/skeleton.nbt +++ b/data/minecraft/structure/trial_chambers/spawner/slow_ranged/skeleton.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:bf52cb3c12f19f2d35cdc51226c031507a3afa7b72132feb0acd65c8c7d9f754 -size 648 +oid sha256:a1cbb3fedfd65c38e8717e8d01222d9ce3041e7eb3cb5c50bf192f960098ed86 +size 485 diff --git a/data/minecraft/structure/trial_chambers/spawner/slow_ranged/stray.nbt b/data/minecraft/structure/trial_chambers/spawner/slow_ranged/stray.nbt index c5c3fecb..ebb59e3f 100644 --- a/data/minecraft/structure/trial_chambers/spawner/slow_ranged/stray.nbt +++ b/data/minecraft/structure/trial_chambers/spawner/slow_ranged/stray.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:684bc5099aeb55b403be1af890e3753dc41e8350b9a20bc0d99427af79823ba2 -size 642 +oid sha256:97c5398536469f8a178037546b34f0f38519fbcec152fed44dc5478787c15812 +size 479 diff --git a/data/minecraft/structure/trial_chambers/spawner/small_melee/baby_zombie.nbt b/data/minecraft/structure/trial_chambers/spawner/small_melee/baby_zombie.nbt index 314292f4..82d9c1ca 100644 --- a/data/minecraft/structure/trial_chambers/spawner/small_melee/baby_zombie.nbt +++ b/data/minecraft/structure/trial_chambers/spawner/small_melee/baby_zombie.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:34fab2d1b729ab02bef289c0ef1e9fc837b936e35e1d7e3c876a40ca52fd17cb -size 662 +oid sha256:71949f72692573c8d041f2d8e6f3ac7cc431c332db71360851eca57c79e2e0fd +size 499 diff --git a/data/minecraft/structure/trial_chambers/spawner/small_melee/cave_spider.nbt b/data/minecraft/structure/trial_chambers/spawner/small_melee/cave_spider.nbt index 48b48d4c..aac9b275 100644 --- a/data/minecraft/structure/trial_chambers/spawner/small_melee/cave_spider.nbt +++ b/data/minecraft/structure/trial_chambers/spawner/small_melee/cave_spider.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f763628d33bcee59e9bff5faaf96767807dfd5cde74449a395ae796ce7812cf5 -size 658 +oid sha256:e79ab405d514d5dbd596150e532101c1c76c4e65514c195eb20dc9a640f3e565 +size 523 diff --git a/data/minecraft/structure/trial_chambers/spawner/small_melee/silverfish.nbt b/data/minecraft/structure/trial_chambers/spawner/small_melee/silverfish.nbt index 07c46a1e..bf54ac14 100644 --- a/data/minecraft/structure/trial_chambers/spawner/small_melee/silverfish.nbt +++ b/data/minecraft/structure/trial_chambers/spawner/small_melee/silverfish.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c4f7d5d26f30edcf5bfec61d5afddf6a1bf8ece05375118693e1371f78bd2eac -size 613 +oid sha256:f8044ed8454b70f2b375ad13d2621ca714beecb0feebf872ca017cf88bb37034 +size 483 diff --git a/data/minecraft/structure/trial_chambers/spawner/small_melee/slime.nbt b/data/minecraft/structure/trial_chambers/spawner/small_melee/slime.nbt index a52af1d0..6814a048 100644 --- a/data/minecraft/structure/trial_chambers/spawner/small_melee/slime.nbt +++ b/data/minecraft/structure/trial_chambers/spawner/small_melee/slime.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e8d2ca631091f544cca2ede7d50e4dd18c236ce4210b1c98c155f11c27689d28 -size 619 +oid sha256:9434a7143e9465de2e927d3594107447fe527c8fa9948cc8d2d7b86005888f4f +size 473 diff --git a/data/minecraft/structure/underwater_ruin/big_brick_1.nbt b/data/minecraft/structure/underwater_ruin/big_brick_1.nbt index 7fc23f53..61d8c918 100644 --- a/data/minecraft/structure/underwater_ruin/big_brick_1.nbt +++ b/data/minecraft/structure/underwater_ruin/big_brick_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:156eb9740e4bde8117487991baba3617bb5b53780004f35d6602e223ada1d62c -size 11111 +oid sha256:99c82d8fb2e6921f0978ceaddcd9b55dd5311e120fab99932a4beb695e673e38 +size 11114 diff --git a/data/minecraft/structure/underwater_ruin/big_brick_2.nbt b/data/minecraft/structure/underwater_ruin/big_brick_2.nbt index ab8b5ff3..35e26792 100644 --- a/data/minecraft/structure/underwater_ruin/big_brick_2.nbt +++ b/data/minecraft/structure/underwater_ruin/big_brick_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1ff8e70b0e29b91a688ed462974e3d596a57a385e345cdcb867f5b9925a571a3 -size 11458 +oid sha256:3ea3da26692dfc2e14367d0a8fa855191e2f084ebf17a02c63df29aff45bf781 +size 11461 diff --git a/data/minecraft/structure/underwater_ruin/big_brick_3.nbt b/data/minecraft/structure/underwater_ruin/big_brick_3.nbt index a9b315b3..97b5ce6a 100644 --- a/data/minecraft/structure/underwater_ruin/big_brick_3.nbt +++ b/data/minecraft/structure/underwater_ruin/big_brick_3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f54c795ad9e540b67dceaa75c4089d119b3dd9711bbc6407e4ab67fd770105ef -size 11629 +oid sha256:6c3a29698d1b2f5a3e1d5a24d17839520529b6a010002cf7f339972d0c09417f +size 11632 diff --git a/data/minecraft/structure/underwater_ruin/big_brick_8.nbt b/data/minecraft/structure/underwater_ruin/big_brick_8.nbt index 87b198ee..16f49f57 100644 --- a/data/minecraft/structure/underwater_ruin/big_brick_8.nbt +++ b/data/minecraft/structure/underwater_ruin/big_brick_8.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0d7a02bae80e99916a2eed01f4dfa23ca20c080ed66af331b31884d7403873c1 -size 11011 +oid sha256:fdf2524fd72c578fc2898e014e8d37a0fabe1eff7219c50ac539d1b28bd059f8 +size 11014 diff --git a/data/minecraft/structure/underwater_ruin/big_cracked_1.nbt b/data/minecraft/structure/underwater_ruin/big_cracked_1.nbt index 1bca3fdf..989cc098 100644 --- a/data/minecraft/structure/underwater_ruin/big_cracked_1.nbt +++ b/data/minecraft/structure/underwater_ruin/big_cracked_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:20a08eabf4625893e10056ffaf42d955e2e6918d33a8a0aacab60dcdd5573a39 -size 11094 +oid sha256:e72f478573fee6c741d7659c270eb19aab8402dfff61a9820b738585c7adcb62 +size 11096 diff --git a/data/minecraft/structure/underwater_ruin/big_cracked_2.nbt b/data/minecraft/structure/underwater_ruin/big_cracked_2.nbt index 415a7bad..cb935eca 100644 --- a/data/minecraft/structure/underwater_ruin/big_cracked_2.nbt +++ b/data/minecraft/structure/underwater_ruin/big_cracked_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1d6ce7e48eff4488ee85a8d5b6219df59a8649baa3ce96d891339d97f54b2b1c -size 11501 +oid sha256:24c28b9e1520fc0744405c9d97debf1ab990c7dd905591e032088c46361be268 +size 11505 diff --git a/data/minecraft/structure/underwater_ruin/big_cracked_3.nbt b/data/minecraft/structure/underwater_ruin/big_cracked_3.nbt index 4875310d..7fab1335 100644 --- a/data/minecraft/structure/underwater_ruin/big_cracked_3.nbt +++ b/data/minecraft/structure/underwater_ruin/big_cracked_3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1b8beb4d2a39d6328e3691dc398d095209a7d694961bd7e5057ceef7ba1c2822 -size 11618 +oid sha256:964fa1fe8181fcf51a7287f40ec84c46189a95391eee0e06f15bc95dcf5b3739 +size 11622 diff --git a/data/minecraft/structure/underwater_ruin/big_cracked_8.nbt b/data/minecraft/structure/underwater_ruin/big_cracked_8.nbt index 3dea9461..d6159b4d 100644 --- a/data/minecraft/structure/underwater_ruin/big_cracked_8.nbt +++ b/data/minecraft/structure/underwater_ruin/big_cracked_8.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3317d63338dad2c1c3abbf8826c841b386f37b4fbb268330f3d5868b319bfde5 -size 11021 +oid sha256:0c0317734f912369daf267249600804658e88607d48ed009937acb4aab85f007 +size 11024 diff --git a/data/minecraft/structure/underwater_ruin/big_mossy_1.nbt b/data/minecraft/structure/underwater_ruin/big_mossy_1.nbt index f4607c0c..f32b179d 100644 --- a/data/minecraft/structure/underwater_ruin/big_mossy_1.nbt +++ b/data/minecraft/structure/underwater_ruin/big_mossy_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:46270f76fde3adc5dfb2971880917367746595b400fc4cb933b23a251fd93147 -size 11093 +oid sha256:8770da915ae094de0f0b5d476d63598ea7f0416e195cfd763d00cb0f2914b85b +size 11096 diff --git a/data/minecraft/structure/underwater_ruin/big_mossy_2.nbt b/data/minecraft/structure/underwater_ruin/big_mossy_2.nbt index b0931bd3..9a38ad40 100644 --- a/data/minecraft/structure/underwater_ruin/big_mossy_2.nbt +++ b/data/minecraft/structure/underwater_ruin/big_mossy_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2a83df5d3133da5804fb9d70bd4ba00eb8c8f73fd8d40d34b92c3b9b95edc3bf -size 11501 +oid sha256:53c9ed99ca52bea13f351b7d8e5144f42414fd0311afa23ee6b07404e4f23e4c +size 11504 diff --git a/data/minecraft/structure/underwater_ruin/big_mossy_3.nbt b/data/minecraft/structure/underwater_ruin/big_mossy_3.nbt index 3a488f73..75cdd5b7 100644 --- a/data/minecraft/structure/underwater_ruin/big_mossy_3.nbt +++ b/data/minecraft/structure/underwater_ruin/big_mossy_3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f52dfd0c1f3cf93ee3aeffe0db5459273418614563b612722b895de063505df9 -size 11629 +oid sha256:a1956778ae53129fff2e58e9ac4a5381870935c629bb87a48d61957ef546f4e1 +size 11632 diff --git a/data/minecraft/structure/underwater_ruin/big_mossy_8.nbt b/data/minecraft/structure/underwater_ruin/big_mossy_8.nbt index aa7655fd..a3d41f41 100644 --- a/data/minecraft/structure/underwater_ruin/big_mossy_8.nbt +++ b/data/minecraft/structure/underwater_ruin/big_mossy_8.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7a7de5d82f606e8cf721265929b3fab58cc7a0ceda2980dcc46b5f33dce983ae -size 11042 +oid sha256:1bf6259130065da6aa778a59fbff03834d8e587f346ce8f99df212d5cc1b888c +size 11045 diff --git a/data/minecraft/structure/underwater_ruin/big_warm_4.nbt b/data/minecraft/structure/underwater_ruin/big_warm_4.nbt index 7bf83f83..30647101 100644 --- a/data/minecraft/structure/underwater_ruin/big_warm_4.nbt +++ b/data/minecraft/structure/underwater_ruin/big_warm_4.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:76b549e439104a6080460ab097602588b8a28cb209be8b99aff4532bd434052e -size 11263 +oid sha256:1f983adacea640b6162815a5f9956f767ba610e959ff2d810f06e5114d2f9969 +size 11266 diff --git a/data/minecraft/structure/underwater_ruin/big_warm_5.nbt b/data/minecraft/structure/underwater_ruin/big_warm_5.nbt index e042218f..aa312205 100644 --- a/data/minecraft/structure/underwater_ruin/big_warm_5.nbt +++ b/data/minecraft/structure/underwater_ruin/big_warm_5.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8d02acf7c22bb9844bfef110af7b29907b1e6a4d7389d4bd9809bab8b014cbae -size 11030 +oid sha256:5858bcf81d2849d4b8edec3ff5a03de2a1449f6150017c53ba402866f61d6d75 +size 11032 diff --git a/data/minecraft/structure/underwater_ruin/big_warm_6.nbt b/data/minecraft/structure/underwater_ruin/big_warm_6.nbt index 0237e151..1622714b 100644 --- a/data/minecraft/structure/underwater_ruin/big_warm_6.nbt +++ b/data/minecraft/structure/underwater_ruin/big_warm_6.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1e36279e46eba623250cd6a3ee2dfe46fa7103b87bca20a80e79d8e745a61917 -size 11103 +oid sha256:8fb3e2aee56ae2579c0627cada16f3e9179a3d7c880173d5f9bbec3143bfede5 +size 11106 diff --git a/data/minecraft/structure/underwater_ruin/big_warm_7.nbt b/data/minecraft/structure/underwater_ruin/big_warm_7.nbt index 509d6dae..a1cf2fa7 100644 --- a/data/minecraft/structure/underwater_ruin/big_warm_7.nbt +++ b/data/minecraft/structure/underwater_ruin/big_warm_7.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7e9aaab44dd6297dcaead6d3f888dd4b423a55086ba8822c7aa35114ae8dc4e1 -size 11137 +oid sha256:72e2068259bbd6c3706c80869451f0bd213262325654e5006302caf276babc1e +size 11140 diff --git a/data/minecraft/structure/underwater_ruin/brick_1.nbt b/data/minecraft/structure/underwater_ruin/brick_1.nbt index 94db3421..8b46f551 100644 --- a/data/minecraft/structure/underwater_ruin/brick_1.nbt +++ b/data/minecraft/structure/underwater_ruin/brick_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3763314b671f923fe83f32844304db72222bdc4867fad25d37dc1fcb7ed33d7d -size 1267 +oid sha256:4592b7f1afa1321566776be7e87e25c25c9ff8db1673c73ec0ec07a88ad2f900 +size 1270 diff --git a/data/minecraft/structure/underwater_ruin/brick_2.nbt b/data/minecraft/structure/underwater_ruin/brick_2.nbt index 0870b8cc..0ba96dfd 100644 --- a/data/minecraft/structure/underwater_ruin/brick_2.nbt +++ b/data/minecraft/structure/underwater_ruin/brick_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:45aba2f186289411622c1414a25a1a74caf7e93f1b1eaf97cfd82d1e73ec10c3 -size 1257 +oid sha256:421164a00567f6e60e596e220411f4dc6df0545885da277ff37fece2a08ce912 +size 1260 diff --git a/data/minecraft/structure/underwater_ruin/brick_3.nbt b/data/minecraft/structure/underwater_ruin/brick_3.nbt index 08b6c91e..c64427f8 100644 --- a/data/minecraft/structure/underwater_ruin/brick_3.nbt +++ b/data/minecraft/structure/underwater_ruin/brick_3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f72069a93219676df664f9523434b71d75b87b7a3d2bb1f217cf60a0890bfdf8 -size 1317 +oid sha256:f6e78fe570d1e2cd50d3c7ba6cf79ec156a34aadc2dcf87b9f1eb0cdbad4844e +size 1319 diff --git a/data/minecraft/structure/underwater_ruin/brick_4.nbt b/data/minecraft/structure/underwater_ruin/brick_4.nbt index 003b45c4..7cef6b39 100644 --- a/data/minecraft/structure/underwater_ruin/brick_4.nbt +++ b/data/minecraft/structure/underwater_ruin/brick_4.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:070ad2d3fd2d7c45094fcb6e6cfd97874d405b8397078d4a9f6a37648badc706 -size 1293 +oid sha256:a53a04c4a0ebcafc342577c1b10824cc0939e547c6eaa144f6b78d70969fb752 +size 1296 diff --git a/data/minecraft/structure/underwater_ruin/brick_5.nbt b/data/minecraft/structure/underwater_ruin/brick_5.nbt index 16eeb3d8..d4b15917 100644 --- a/data/minecraft/structure/underwater_ruin/brick_5.nbt +++ b/data/minecraft/structure/underwater_ruin/brick_5.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8cf72345e74a3136c27dfdd9a53cbe78572f82c4c8e27111acca92c7643d9d10 -size 1274 +oid sha256:6604f99e4288d75cfb3a44182ceffdc9c26514a4c53477a42873ba2642956c99 +size 1277 diff --git a/data/minecraft/structure/underwater_ruin/brick_6.nbt b/data/minecraft/structure/underwater_ruin/brick_6.nbt index 07053169..779ab908 100644 --- a/data/minecraft/structure/underwater_ruin/brick_6.nbt +++ b/data/minecraft/structure/underwater_ruin/brick_6.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7db6515336b83d95fe528cc205d6f575ab18c2044086f7a664c000702c0a9218 -size 1465 +oid sha256:0bfb90321b7894e81a5a63c75f283311c0323854cb5883797864cdb3fd791564 +size 1468 diff --git a/data/minecraft/structure/underwater_ruin/brick_7.nbt b/data/minecraft/structure/underwater_ruin/brick_7.nbt index bc4c24b0..4fd6ff46 100644 --- a/data/minecraft/structure/underwater_ruin/brick_7.nbt +++ b/data/minecraft/structure/underwater_ruin/brick_7.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e90e2f7b6950400c32a28ae320641be15212567f531e1f8e7f80da0ebc631f8a -size 1290 +oid sha256:cf9e640b38f07cacd546f715654d0f2e5a86489c61dd7e331138dc3259020cf3 +size 1293 diff --git a/data/minecraft/structure/underwater_ruin/brick_8.nbt b/data/minecraft/structure/underwater_ruin/brick_8.nbt index 15b4664e..49d77e8e 100644 --- a/data/minecraft/structure/underwater_ruin/brick_8.nbt +++ b/data/minecraft/structure/underwater_ruin/brick_8.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:35275700587e59dfd3d59150d15b71deea518492e1fe5ff74021693976730306 -size 1303 +oid sha256:534a7c94c9bd642486f841113d56132dccd92cc28f70939566e21c5e021c6f8e +size 1306 diff --git a/data/minecraft/structure/underwater_ruin/cracked_1.nbt b/data/minecraft/structure/underwater_ruin/cracked_1.nbt index 4206a3c4..8bf72d32 100644 --- a/data/minecraft/structure/underwater_ruin/cracked_1.nbt +++ b/data/minecraft/structure/underwater_ruin/cracked_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6686b1a35c9be0797ece601a1d005eb8bfaecfef308e493edb8f2964c26b5acf -size 1263 +oid sha256:5d502418decfe6b82d7cbea8b848a564f9c7f82070a1a1f3eeb060549780af0c +size 1266 diff --git a/data/minecraft/structure/underwater_ruin/cracked_2.nbt b/data/minecraft/structure/underwater_ruin/cracked_2.nbt index 3be70624..24d14a3f 100644 --- a/data/minecraft/structure/underwater_ruin/cracked_2.nbt +++ b/data/minecraft/structure/underwater_ruin/cracked_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:55c570c21b6bb93a50b9427f0daf195b16447259d34654c5f69bc9097415da63 -size 1256 +oid sha256:cf73bc4c99499f507d3b095c88ec5afdfacd0fb23fc2bea69580e1f16a85f4eb +size 1258 diff --git a/data/minecraft/structure/underwater_ruin/cracked_3.nbt b/data/minecraft/structure/underwater_ruin/cracked_3.nbt index 0e89343c..2d0450be 100644 --- a/data/minecraft/structure/underwater_ruin/cracked_3.nbt +++ b/data/minecraft/structure/underwater_ruin/cracked_3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5e0c548ce4c60c653978d36aa346c51e87a053552aac9fc804e384bfcbac510a -size 1345 +oid sha256:6864f2ca493618ac46f9ff94963fabee3057db6ff2532ca3328ef9e50886a3f1 +size 1348 diff --git a/data/minecraft/structure/underwater_ruin/cracked_4.nbt b/data/minecraft/structure/underwater_ruin/cracked_4.nbt index 2dbff30b..5e914138 100644 --- a/data/minecraft/structure/underwater_ruin/cracked_4.nbt +++ b/data/minecraft/structure/underwater_ruin/cracked_4.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:05834e2307e8605a254c0ec743b768a97202dfdea4d3f186b5dca23f26fbe79c -size 1254 +oid sha256:1af16b31b66ca2fe3c18a4c3ad7d8e5e985455757a368aee0b10a64f87bd0551 +size 1257 diff --git a/data/minecraft/structure/underwater_ruin/cracked_5.nbt b/data/minecraft/structure/underwater_ruin/cracked_5.nbt index 5b713e42..080bb5b7 100644 --- a/data/minecraft/structure/underwater_ruin/cracked_5.nbt +++ b/data/minecraft/structure/underwater_ruin/cracked_5.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a596435e23678fb3c7896e9b9e05cd8b02faf1ec8a102e189fc867e4e0051381 -size 1279 +oid sha256:bce9c88a1ae5344829a18a1ff0f9a157661aca0edfa2a849b962b76cfc16c067 +size 1282 diff --git a/data/minecraft/structure/underwater_ruin/cracked_6.nbt b/data/minecraft/structure/underwater_ruin/cracked_6.nbt index 9fb7dec0..272c2608 100644 --- a/data/minecraft/structure/underwater_ruin/cracked_6.nbt +++ b/data/minecraft/structure/underwater_ruin/cracked_6.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:12180bc01dbaf065e4baddaa6fb8610239f0f8db7250bdb1e98861e7b49d63d7 -size 1406 +oid sha256:51462571fb070af39b92bb1d724b70aefc2c24eb56490a06a84bc7517b0b17d7 +size 1410 diff --git a/data/minecraft/structure/underwater_ruin/cracked_7.nbt b/data/minecraft/structure/underwater_ruin/cracked_7.nbt index 58d60395..c70abd4b 100644 --- a/data/minecraft/structure/underwater_ruin/cracked_7.nbt +++ b/data/minecraft/structure/underwater_ruin/cracked_7.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7718e3abc7bf7596fe4b46f917a4a4909ac19d8141c12ab66699808daf69af1b -size 1312 +oid sha256:cb29d0b94ff74ba6d4c5a6a85c4b4c49e607f868eeabec0224070b2c5ba112ab +size 1314 diff --git a/data/minecraft/structure/underwater_ruin/cracked_8.nbt b/data/minecraft/structure/underwater_ruin/cracked_8.nbt index 7715b7e0..76ad35e0 100644 --- a/data/minecraft/structure/underwater_ruin/cracked_8.nbt +++ b/data/minecraft/structure/underwater_ruin/cracked_8.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b4f34c0748596d932ecef2af370336579cdc2e8595351568e270974f8532c174 -size 1291 +oid sha256:89fd5af54c9141586ba81bfaa116de6c02cd81b2bec009db4455b74bab3dc681 +size 1294 diff --git a/data/minecraft/structure/underwater_ruin/mossy_1.nbt b/data/minecraft/structure/underwater_ruin/mossy_1.nbt index cf880d1d..e2d0024d 100644 --- a/data/minecraft/structure/underwater_ruin/mossy_1.nbt +++ b/data/minecraft/structure/underwater_ruin/mossy_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c8d80b194908c424d477918ee3fe31e024a63845d321f2aa412acc062e7e3c24 -size 1276 +oid sha256:e574f29779f4b0beef08e8b0dce7610f1e5f6d632304beb2973f4c8182c89a1e +size 1279 diff --git a/data/minecraft/structure/underwater_ruin/mossy_2.nbt b/data/minecraft/structure/underwater_ruin/mossy_2.nbt index fad8abb2..37604777 100644 --- a/data/minecraft/structure/underwater_ruin/mossy_2.nbt +++ b/data/minecraft/structure/underwater_ruin/mossy_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:fe78aafd99fec705d613a3e1914b96c0345bb714b4b7cbb46fcc07c2cb30d51b -size 1231 +oid sha256:7bad743ef5e94a1979e09ea31a69e6e66c7854b4e9c45e8e27e35ffcfe8955dd +size 1233 diff --git a/data/minecraft/structure/underwater_ruin/mossy_3.nbt b/data/minecraft/structure/underwater_ruin/mossy_3.nbt index fdae8596..de226dc5 100644 --- a/data/minecraft/structure/underwater_ruin/mossy_3.nbt +++ b/data/minecraft/structure/underwater_ruin/mossy_3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7a46e2750f419948734e16742e358204adf2c236c0a10443f2fb75f82ffb52b6 -size 1320 +oid sha256:03de01ae377fbc7a0164176b244d6d17c5c94daa126781c77b05f66e3edf178c +size 1323 diff --git a/data/minecraft/structure/underwater_ruin/mossy_4.nbt b/data/minecraft/structure/underwater_ruin/mossy_4.nbt index 514bc6f6..2f656b39 100644 --- a/data/minecraft/structure/underwater_ruin/mossy_4.nbt +++ b/data/minecraft/structure/underwater_ruin/mossy_4.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1413956a0eec04689c974aecd5806e5a2c81293e07254b2f83b1a2a2e3d25a72 -size 1279 +oid sha256:9647b26df01e63caa2e9ef5059726e1f0deeef79f39d550ad151fb6161540ad9 +size 1282 diff --git a/data/minecraft/structure/underwater_ruin/mossy_5.nbt b/data/minecraft/structure/underwater_ruin/mossy_5.nbt index 3306bcc3..62aa8b5b 100644 --- a/data/minecraft/structure/underwater_ruin/mossy_5.nbt +++ b/data/minecraft/structure/underwater_ruin/mossy_5.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:38a346a555aa50cf35ec43530693e45600297fa424dfe480591e1e4559c60e4d -size 1297 +oid sha256:a45a3396b0eeaa4bc27fbe1cd4217916eade481193b8420fd3ea621a738a5335 +size 1300 diff --git a/data/minecraft/structure/underwater_ruin/mossy_6.nbt b/data/minecraft/structure/underwater_ruin/mossy_6.nbt index 5bfd6a57..bdd9e3a2 100644 --- a/data/minecraft/structure/underwater_ruin/mossy_6.nbt +++ b/data/minecraft/structure/underwater_ruin/mossy_6.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:584d19961eb70a6aea9c095e8c60d582f8ac5f53d032464b64a3fe6be9403c58 -size 1449 +oid sha256:6a7aa8e2a6a9cca5f7d76ce91068fb8a0d9b5b5b964c1126ad178a58fc99a9d9 +size 1452 diff --git a/data/minecraft/structure/underwater_ruin/mossy_7.nbt b/data/minecraft/structure/underwater_ruin/mossy_7.nbt index 0a3a7408..8227bf50 100644 --- a/data/minecraft/structure/underwater_ruin/mossy_7.nbt +++ b/data/minecraft/structure/underwater_ruin/mossy_7.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2f22543c92c0cc99a3ef1866efb32b5d30f6dafa07c958bd98c4cbb6908d4b93 -size 1306 +oid sha256:f38b823603895267f33acf2fb33a5c5120d991fe8ddba40aacbedda2a0ca9b65 +size 1310 diff --git a/data/minecraft/structure/underwater_ruin/mossy_8.nbt b/data/minecraft/structure/underwater_ruin/mossy_8.nbt index e347bf5e..a0403d4c 100644 --- a/data/minecraft/structure/underwater_ruin/mossy_8.nbt +++ b/data/minecraft/structure/underwater_ruin/mossy_8.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ca65a89da3535c80d5f9e523996e2eef773930941fb5f9e9ff3ace4999416b7b -size 1320 +oid sha256:7bd214dd82ba03f176a34e86060527a38f2180d76aa439af3928bef1ef6572c4 +size 1322 diff --git a/data/minecraft/structure/underwater_ruin/warm_1.nbt b/data/minecraft/structure/underwater_ruin/warm_1.nbt index a18447c4..8cdfa6a5 100644 --- a/data/minecraft/structure/underwater_ruin/warm_1.nbt +++ b/data/minecraft/structure/underwater_ruin/warm_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ba4890875b444b697fafd7577ce7eda6fed89466e60a1093b60993bc1bdd2b27 -size 1265 +oid sha256:fb0185cb5c65aa1855b5c0b201647accaa03f5c79f4c6ac7b3029f5fd77fba74 +size 1269 diff --git a/data/minecraft/structure/underwater_ruin/warm_2.nbt b/data/minecraft/structure/underwater_ruin/warm_2.nbt index a1ce8c1d..17e233ee 100644 --- a/data/minecraft/structure/underwater_ruin/warm_2.nbt +++ b/data/minecraft/structure/underwater_ruin/warm_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ac9d94d5112d972a85e2d83002444e33c6545b22f0d39431238bdcd0b9967aca -size 1296 +oid sha256:a02698f6956b10def8ca416ef442baed825b215f3c98dab789b31ae17daaa1fb +size 1298 diff --git a/data/minecraft/structure/underwater_ruin/warm_3.nbt b/data/minecraft/structure/underwater_ruin/warm_3.nbt index 2056a7d3..d9b8f725 100644 --- a/data/minecraft/structure/underwater_ruin/warm_3.nbt +++ b/data/minecraft/structure/underwater_ruin/warm_3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:44c07d0f5454755271ff24b7e54c12175aad59412c4e94ece67d6233fba62760 -size 1269 +oid sha256:f849dff94463e7ea576dbea9faa5314eb005094a65b3590455307e82dd6e69a0 +size 1272 diff --git a/data/minecraft/structure/underwater_ruin/warm_4.nbt b/data/minecraft/structure/underwater_ruin/warm_4.nbt index 070f3248..c35a07d0 100644 --- a/data/minecraft/structure/underwater_ruin/warm_4.nbt +++ b/data/minecraft/structure/underwater_ruin/warm_4.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e06f1ee6b65fa2bde7505174bf67af970fbea560341b44babd1cd5a5c78d449f -size 1345 +oid sha256:cd398f44200c3170d83a3f038b20929fac9887ef1b86cf0f7ac01ad697a94edb +size 1348 diff --git a/data/minecraft/structure/underwater_ruin/warm_5.nbt b/data/minecraft/structure/underwater_ruin/warm_5.nbt index 1c0e614c..a244a0bd 100644 --- a/data/minecraft/structure/underwater_ruin/warm_5.nbt +++ b/data/minecraft/structure/underwater_ruin/warm_5.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:00e86868cbf1d2a83078136eb1f6164cfb9f353cc848d60e58c12efcdb6b0093 -size 1223 +oid sha256:22fd38e1b4a787075d5309fa70f93e4298cce7939ae2637f95aee6f5031dac6a +size 1226 diff --git a/data/minecraft/structure/underwater_ruin/warm_6.nbt b/data/minecraft/structure/underwater_ruin/warm_6.nbt index b1725617..ba5252db 100644 --- a/data/minecraft/structure/underwater_ruin/warm_6.nbt +++ b/data/minecraft/structure/underwater_ruin/warm_6.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d614532b2a39ea1389176dab2252bece3d1e1704d508fa272702d69c40485674 -size 1268 +oid sha256:f2958eec6a10e32956681dc1c55ba2988655e052dd93c36174327cfdfb99078d +size 1271 diff --git a/data/minecraft/structure/underwater_ruin/warm_7.nbt b/data/minecraft/structure/underwater_ruin/warm_7.nbt index 29cb8520..3741b948 100644 --- a/data/minecraft/structure/underwater_ruin/warm_7.nbt +++ b/data/minecraft/structure/underwater_ruin/warm_7.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:71cbc35df66902585c949eb868ac6dfbc9c104400fd1c99b765607a16f18cfa6 -size 1207 +oid sha256:9b5c91f2115b7e60dd5b548daaf8fc994019a1c6a1fa000755d46003e7700f92 +size 1211 diff --git a/data/minecraft/structure/underwater_ruin/warm_8.nbt b/data/minecraft/structure/underwater_ruin/warm_8.nbt index d1a73244..dad8f035 100644 --- a/data/minecraft/structure/underwater_ruin/warm_8.nbt +++ b/data/minecraft/structure/underwater_ruin/warm_8.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1ea1fe23d7a1e46ecbb466981870f58728cd2748db4d01c3c75697d6215a1d6f -size 1336 +oid sha256:4e15c1dddba1446e6c005038d1708bc25734422b5bbd083fc784008daf12f59e +size 1339 diff --git a/data/minecraft/structure/village/common/animals/cat_black.nbt b/data/minecraft/structure/village/common/animals/cat_black.nbt index ec421777..994bcf60 100644 --- a/data/minecraft/structure/village/common/animals/cat_black.nbt +++ b/data/minecraft/structure/village/common/animals/cat_black.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ce1c642a4a009ecf94fd2f0c93dfe7ea9cbc1b266ada6916fa2edbd82fde178e -size 928 +oid sha256:e56e34ef63e5f6fdd74a4e96b61c85000d59aaff999854cfdc3f9a6276ff0c17 +size 924 diff --git a/data/minecraft/structure/village/common/animals/cat_british.nbt b/data/minecraft/structure/village/common/animals/cat_british.nbt index 60e83a2e..5911e3af 100644 --- a/data/minecraft/structure/village/common/animals/cat_british.nbt +++ b/data/minecraft/structure/village/common/animals/cat_british.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:256c5bac85a6ac921257a8d7c39cb480cb0e23d2ad166ce803f473b430c428a7 -size 934 +oid sha256:34a14a9c6ca6fff0eb8945fde7f12c4b3fdb66495a6d0b3cb8e87204d308f3ca +size 931 diff --git a/data/minecraft/structure/village/common/animals/cat_calico.nbt b/data/minecraft/structure/village/common/animals/cat_calico.nbt index 0c557d3a..63d9cefb 100644 --- a/data/minecraft/structure/village/common/animals/cat_calico.nbt +++ b/data/minecraft/structure/village/common/animals/cat_calico.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:bf9ea82c019d9e83ac2c47108b689737a1b7a73bd1b11c9ed48744b7db90a273 -size 859 +oid sha256:f05e58dd8f03137eed0b9b6775034940758b7819e2ee8e23d4a1282dc67f8797 +size 855 diff --git a/data/minecraft/structure/village/common/animals/cat_jellie.nbt b/data/minecraft/structure/village/common/animals/cat_jellie.nbt index 211175fa..b7629e8e 100644 --- a/data/minecraft/structure/village/common/animals/cat_jellie.nbt +++ b/data/minecraft/structure/village/common/animals/cat_jellie.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:31ae6850c9c75d0626f3b8fc14027b3bc1906ab0d14201101a67250835aec847 -size 932 +oid sha256:d0887b44081b16913cde01753e92fb07a8230414649bebfbb528a4906018ff6b +size 926 diff --git a/data/minecraft/structure/village/common/animals/cat_persian.nbt b/data/minecraft/structure/village/common/animals/cat_persian.nbt index 82803e6d..430f9c99 100644 --- a/data/minecraft/structure/village/common/animals/cat_persian.nbt +++ b/data/minecraft/structure/village/common/animals/cat_persian.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:be7ee0101982cfc5374215e566d7282280ef5122cd351874310cd911e58c5271 -size 860 +oid sha256:b83b6664bcc3bd85ddbf5feda87223ea5ff2bb91b3e3143b0f97851a44b1b95a +size 857 diff --git a/data/minecraft/structure/village/common/animals/cat_ragdoll.nbt b/data/minecraft/structure/village/common/animals/cat_ragdoll.nbt index fe2ca4b5..91aaf0e0 100644 --- a/data/minecraft/structure/village/common/animals/cat_ragdoll.nbt +++ b/data/minecraft/structure/village/common/animals/cat_ragdoll.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:14d14c7039371b4f08a0360eb6b5611029fb6d577a3e532f53c70d1b7a4779bd -size 926 +oid sha256:521eae96900bb7af677e1030fd5330eaa521b426395a876872d2ddf9beb831e5 +size 923 diff --git a/data/minecraft/structure/village/common/animals/cat_red.nbt b/data/minecraft/structure/village/common/animals/cat_red.nbt index f57e0ce4..a2628741 100644 --- a/data/minecraft/structure/village/common/animals/cat_red.nbt +++ b/data/minecraft/structure/village/common/animals/cat_red.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d9523300a7a0cf0611562771490f3a11429d1f72dec987a88dea6538da8aed00 -size 842 +oid sha256:8e8bef215d0e5a1f9f78dc4dc2cafe2a7b9af4d98f0853efde1da76f69f646b0 +size 839 diff --git a/data/minecraft/structure/village/common/animals/cat_siamese.nbt b/data/minecraft/structure/village/common/animals/cat_siamese.nbt index 15a1f41b..99e0c427 100644 --- a/data/minecraft/structure/village/common/animals/cat_siamese.nbt +++ b/data/minecraft/structure/village/common/animals/cat_siamese.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:30ca3860e4c19669f380c5b5e01adb91112be60698c4cebd3cd94e3e391f0e9b -size 851 +oid sha256:1d2162a0c5d361c9da182d376f8ed5b817a0d7d4952936955dfd765e0e6ec790 +size 845 diff --git a/data/minecraft/structure/village/common/animals/cat_tabby.nbt b/data/minecraft/structure/village/common/animals/cat_tabby.nbt index 49c47492..3ee1de21 100644 --- a/data/minecraft/structure/village/common/animals/cat_tabby.nbt +++ b/data/minecraft/structure/village/common/animals/cat_tabby.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5a9800b43db9ebc3a0811e03d43ab7183110c32f76e727bee2bd24e387161880 -size 923 +oid sha256:b3a6a5f4c20528bdd3f0d43dbbaa5cdb15fa841b2c19d4592cfe342dc94a8502 +size 919 diff --git a/data/minecraft/structure/village/common/animals/cat_white.nbt b/data/minecraft/structure/village/common/animals/cat_white.nbt index a86283c6..7b63f854 100644 --- a/data/minecraft/structure/village/common/animals/cat_white.nbt +++ b/data/minecraft/structure/village/common/animals/cat_white.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:81f96e424ee2856a15a9d6e235af3a3ca7a39b839bdbfbedf44162d29fb3cbf2 -size 918 +oid sha256:5c6f9330c8c7b1bac1c6dc9f621ec7ba3c237422bdd8974347515938cda94ac8 +size 915 diff --git a/data/minecraft/structure/village/common/animals/cows_1.nbt b/data/minecraft/structure/village/common/animals/cows_1.nbt index 30ffa159..954ef08f 100644 --- a/data/minecraft/structure/village/common/animals/cows_1.nbt +++ b/data/minecraft/structure/village/common/animals/cows_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:63d8be6cd462de280d66a7082295ef2c1ac7159c2cf08d5965f56d808ff1acb4 -size 964 +oid sha256:9c4cb690f930064657cd8ec3b2cf68edf94fca39615cd77b154b85601296c391 +size 960 diff --git a/data/minecraft/structure/village/common/animals/horses_1.nbt b/data/minecraft/structure/village/common/animals/horses_1.nbt index 3751df59..6c9e23fa 100644 --- a/data/minecraft/structure/village/common/animals/horses_1.nbt +++ b/data/minecraft/structure/village/common/animals/horses_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d798bc54c5147208a6e3bb4a5974ff93b53dfe1e5f91a345dac709c32a1b7b58 -size 927 +oid sha256:a52d61a94c7869c086e58319d1c75f44935c10fae2b9b96caddff6d8e77c9631 +size 920 diff --git a/data/minecraft/structure/village/common/animals/horses_2.nbt b/data/minecraft/structure/village/common/animals/horses_2.nbt index a06f1aa0..3baf21f9 100644 --- a/data/minecraft/structure/village/common/animals/horses_2.nbt +++ b/data/minecraft/structure/village/common/animals/horses_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8cfa146c915f1b394a380a065a967b6337abf8300c2926ee450811465707f979 -size 1043 +oid sha256:28f097817289a0206edfef332272789b3ae47a18c61de4cc36fd9fadc107ac88 +size 1035 diff --git a/data/minecraft/structure/village/common/animals/horses_3.nbt b/data/minecraft/structure/village/common/animals/horses_3.nbt index 5ade954c..091449b3 100644 --- a/data/minecraft/structure/village/common/animals/horses_3.nbt +++ b/data/minecraft/structure/village/common/animals/horses_3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:58d6f05872a834dfb11ee200ec70581ce282499e383bed9c2fd3d6686c4f4e86 -size 1050 +oid sha256:ad5e0d92235dc9ab38a8b2f365fe7ce7dbba7561a137504db43e048c8d2d10a5 +size 1043 diff --git a/data/minecraft/structure/village/common/animals/horses_4.nbt b/data/minecraft/structure/village/common/animals/horses_4.nbt index 6066af2d..27745877 100644 --- a/data/minecraft/structure/village/common/animals/horses_4.nbt +++ b/data/minecraft/structure/village/common/animals/horses_4.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0d2dc90a883ceae56a28bdee98f7e4e819961c32ca8f61e22e69d2dbe51e3434 -size 921 +oid sha256:b831b6074247a43545f6ca4cbb06619b1add465504c94e92fd6061010f140b0d +size 915 diff --git a/data/minecraft/structure/village/common/animals/horses_5.nbt b/data/minecraft/structure/village/common/animals/horses_5.nbt index 72a2dbff..4cbf99bb 100644 --- a/data/minecraft/structure/village/common/animals/horses_5.nbt +++ b/data/minecraft/structure/village/common/animals/horses_5.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ab6eaec53d16b32089c6789aca1e1eb35adb4df2cdeee3a700581eff686ee630 -size 942 +oid sha256:debf6de217bee4111372c4364e011f60341937d9d54f690f5804fe20c521348b +size 936 diff --git a/data/minecraft/structure/village/common/animals/pigs_1.nbt b/data/minecraft/structure/village/common/animals/pigs_1.nbt index bca243ec..5dff0116 100644 --- a/data/minecraft/structure/village/common/animals/pigs_1.nbt +++ b/data/minecraft/structure/village/common/animals/pigs_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4d23107e72af2d0bf6f43dd8955df80e39af92fc0108d748f27e9455b2fe21c3 -size 973 +oid sha256:a1ef17d8a4b1e15226d117d664818fb981cbe86d83f500fb7490787d672d3c7f +size 968 diff --git a/data/minecraft/structure/village/common/animals/sheep_1.nbt b/data/minecraft/structure/village/common/animals/sheep_1.nbt index 6a0eb59e..397438e7 100644 --- a/data/minecraft/structure/village/common/animals/sheep_1.nbt +++ b/data/minecraft/structure/village/common/animals/sheep_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:939217712dd53f3f84b16767a9897d05a6ae0a713d80b184249159001bb22d26 -size 986 +oid sha256:d0db880b596fcac5e5270d17d24029a2c2c697899dd1cf94bd9e20102ae229d3 +size 982 diff --git a/data/minecraft/structure/village/common/animals/sheep_2.nbt b/data/minecraft/structure/village/common/animals/sheep_2.nbt index f8dd113a..847ba201 100644 --- a/data/minecraft/structure/village/common/animals/sheep_2.nbt +++ b/data/minecraft/structure/village/common/animals/sheep_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:19b95821d3785c63aaea5ad6fc342be8444717103505817392b01096d47cf1d9 -size 985 +oid sha256:fd0158f2e56fac26848ad7db38489dbb0b4758b2f211f81f1cc5d0c8bf336ce4 +size 981 diff --git a/data/minecraft/structure/village/common/iron_golem.nbt b/data/minecraft/structure/village/common/iron_golem.nbt index e0a2b21b..8c902762 100644 --- a/data/minecraft/structure/village/common/iron_golem.nbt +++ b/data/minecraft/structure/village/common/iron_golem.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4e0c8c2fb1a5d7aa45e4918003cca74991f02ffa21284f341468d28d8db402fa -size 862 +oid sha256:8c005e44fdf79db36feabdafeed010f1d425a00bfca156ff775a9a7687aae8ec +size 855 diff --git a/data/minecraft/structure/village/common/well_bottom.nbt b/data/minecraft/structure/village/common/well_bottom.nbt index 2686008c..fa113451 100644 --- a/data/minecraft/structure/village/common/well_bottom.nbt +++ b/data/minecraft/structure/village/common/well_bottom.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b1743e6f375fd082c9781897569bcceb70dbb711ec9b860e27ebf21f7dd91d0b -size 425 +oid sha256:48cc5521beb415880504cdb09a5526c377899f4abb33ca8bc21004d7ec1266cd +size 427 diff --git a/data/minecraft/structure/village/decays/grass_11x13.nbt b/data/minecraft/structure/village/decays/grass_11x13.nbt index 987be141..e321b60a 100644 --- a/data/minecraft/structure/village/decays/grass_11x13.nbt +++ b/data/minecraft/structure/village/decays/grass_11x13.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c253451b9336cae7b7a5cc7673af01dd9eced03cbc7b9d21d239639a68875cf1 -size 556 +oid sha256:9906336706bffdb7aa737b65cbe50fe02bac7c2993bd18dba8109bf5b03fde7a +size 558 diff --git a/data/minecraft/structure/village/decays/grass_16x16.nbt b/data/minecraft/structure/village/decays/grass_16x16.nbt index 82dc1305..df5a0fde 100644 --- a/data/minecraft/structure/village/decays/grass_16x16.nbt +++ b/data/minecraft/structure/village/decays/grass_16x16.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0c6bdfa08d0de27218c72759157d3f72b75726b4f109ab4ea377cbc13af507b0 -size 872 +oid sha256:a9f7dac4f6e44abeda6ff3a7af4f2809d733d6d50cd148254ef8abb28ba10ff9 +size 874 diff --git a/data/minecraft/structure/village/decays/grass_9x9.nbt b/data/minecraft/structure/village/decays/grass_9x9.nbt index 37f032c9..d62a05eb 100644 --- a/data/minecraft/structure/village/decays/grass_9x9.nbt +++ b/data/minecraft/structure/village/decays/grass_9x9.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:99a7ddf18fa908097833dcb02f92ab15afa80582a24d7ddc4a0923d135da730f -size 391 +oid sha256:06d634c5a4f31ee66c87ccabeb30d32ff83bae640314b89cb9e971a0871d418e +size 393 diff --git a/data/minecraft/structure/village/desert/camel_spawn.nbt b/data/minecraft/structure/village/desert/camel_spawn.nbt index 8d31fb1b..6cb24a90 100644 --- a/data/minecraft/structure/village/desert/camel_spawn.nbt +++ b/data/minecraft/structure/village/desert/camel_spawn.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:bd44a868e22f90212ebaee100713b2c5435fcbeda98a7bff8536fa20014ec95b -size 281 +oid sha256:4d384d61ec082f7ca5b7f7191956deae6b401b5425e45cb1d61899425511f628 +size 283 diff --git a/data/minecraft/structure/village/desert/desert_lamp_1.nbt b/data/minecraft/structure/village/desert/desert_lamp_1.nbt index 9822e9cb..08efac95 100644 --- a/data/minecraft/structure/village/desert/desert_lamp_1.nbt +++ b/data/minecraft/structure/village/desert/desert_lamp_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a205228ccce4dd3c6dc2a57f91be4c355b137bf17ead2c5ff3e916d694f9e07c -size 277 +oid sha256:31870bbf83937fac2c9ad0f8641532ea2bb21faef0c77ba25f0fa457ec31353c +size 279 diff --git a/data/minecraft/structure/village/desert/houses/desert_animal_pen_1.nbt b/data/minecraft/structure/village/desert/houses/desert_animal_pen_1.nbt index 8f75ff8e..fb43bb2c 100644 --- a/data/minecraft/structure/village/desert/houses/desert_animal_pen_1.nbt +++ b/data/minecraft/structure/village/desert/houses/desert_animal_pen_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d209c5f02424b74bb835ab88682ebc1a107b0b9fb3f221d8965795e93a85bb14 -size 1687 +oid sha256:e485644b6fda3d177aa994991766a35a71e201dde7a36777ebaf8ed52d818443 +size 1690 diff --git a/data/minecraft/structure/village/desert/houses/desert_animal_pen_2.nbt b/data/minecraft/structure/village/desert/houses/desert_animal_pen_2.nbt index 01726238..e0169e9e 100644 --- a/data/minecraft/structure/village/desert/houses/desert_animal_pen_2.nbt +++ b/data/minecraft/structure/village/desert/houses/desert_animal_pen_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:853b3fd9712d04ae04d22259c95873d682bb25c573f0792c8f5bca23de14c23f -size 1862 +oid sha256:04ce299b3d07a76e9a5d72dc554e949ceac834242df85b712cbe0e9589d3eb6d +size 1864 diff --git a/data/minecraft/structure/village/desert/houses/desert_armorer_1.nbt b/data/minecraft/structure/village/desert/houses/desert_armorer_1.nbt index f8ea9196..0a994323 100644 --- a/data/minecraft/structure/village/desert/houses/desert_armorer_1.nbt +++ b/data/minecraft/structure/village/desert/houses/desert_armorer_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1e02ba30ebbb09d0e50d12961da91cb529ff5fd58a23fefd011325480240cae7 -size 1744 +oid sha256:705a89e8a130634f708e895d5abfd161152fa39c2b940a0521d82750538bd717 +size 1746 diff --git a/data/minecraft/structure/village/desert/houses/desert_butcher_shop_1.nbt b/data/minecraft/structure/village/desert/houses/desert_butcher_shop_1.nbt index 8f205037..f10c54d4 100644 --- a/data/minecraft/structure/village/desert/houses/desert_butcher_shop_1.nbt +++ b/data/minecraft/structure/village/desert/houses/desert_butcher_shop_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9b338438065ce27c05cb4d00f294b58c2c2d9ccdd2c2bf6a9e2ba27b3bedfb43 -size 1777 +oid sha256:73a66fc7243b7aa0db4f580568bc83622cb6ee15d63d48949c739ec934bae8ff +size 1779 diff --git a/data/minecraft/structure/village/desert/houses/desert_cartographer_house_1.nbt b/data/minecraft/structure/village/desert/houses/desert_cartographer_house_1.nbt index 97d1849f..eaf2f01d 100644 --- a/data/minecraft/structure/village/desert/houses/desert_cartographer_house_1.nbt +++ b/data/minecraft/structure/village/desert/houses/desert_cartographer_house_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5accd2bb98222425c0c9a1095c0701754b453f114e963ebe8def1aa7bc713962 -size 1674 +oid sha256:071bd1262d1b132ccf5f0d92ac6c322eb87c19487967fe7eae04ff5bf8e742bc +size 1677 diff --git a/data/minecraft/structure/village/desert/houses/desert_farm_1.nbt b/data/minecraft/structure/village/desert/houses/desert_farm_1.nbt index 095ad00b..1327aa06 100644 --- a/data/minecraft/structure/village/desert/houses/desert_farm_1.nbt +++ b/data/minecraft/structure/village/desert/houses/desert_farm_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:47d5e70524c19d0f7abb85ddd0bec31548589aad7e1127447ce4f2ca107e1ea4 -size 712 +oid sha256:2030ff71c975128b7fff9261185d40c1e489c0fe155a50feeb79b5faf78330e4 +size 715 diff --git a/data/minecraft/structure/village/desert/houses/desert_farm_2.nbt b/data/minecraft/structure/village/desert/houses/desert_farm_2.nbt index 3cd92b11..e43f426a 100644 --- a/data/minecraft/structure/village/desert/houses/desert_farm_2.nbt +++ b/data/minecraft/structure/village/desert/houses/desert_farm_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e4e7926cd68ec8f354eb05b1538b4664eadc1c307e6a3f122797c79de80b5e02 -size 885 +oid sha256:fd58d708919825c80a5484ce582b5a20a55430063af66d6f8aae3b84884918b0 +size 887 diff --git a/data/minecraft/structure/village/desert/houses/desert_fisher_1.nbt b/data/minecraft/structure/village/desert/houses/desert_fisher_1.nbt index 21d8e666..9423cedf 100644 --- a/data/minecraft/structure/village/desert/houses/desert_fisher_1.nbt +++ b/data/minecraft/structure/village/desert/houses/desert_fisher_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:637bfcc1b11d57642ebb470a096c5f6f1a629ba139f8be25702de6fcd8b17a15 -size 2283 +oid sha256:b42963a7da75d841f3a7e7b8a41f1aae8207fe7c52088ed5255c9e033a29b37c +size 2286 diff --git a/data/minecraft/structure/village/desert/houses/desert_fletcher_house_1.nbt b/data/minecraft/structure/village/desert/houses/desert_fletcher_house_1.nbt index 99e491be..bec7bf8a 100644 --- a/data/minecraft/structure/village/desert/houses/desert_fletcher_house_1.nbt +++ b/data/minecraft/structure/village/desert/houses/desert_fletcher_house_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d6ddbf3fcbf8c5cc839cdb4ab59327afce613e05e7eac7ae4027807e1ddb6200 -size 3093 +oid sha256:e62f71e265471dcdeaa4d2c7bd135ab83845739a6b82881440a944227c800b8c +size 3096 diff --git a/data/minecraft/structure/village/desert/houses/desert_large_farm_1.nbt b/data/minecraft/structure/village/desert/houses/desert_large_farm_1.nbt index 13380234..281e733b 100644 --- a/data/minecraft/structure/village/desert/houses/desert_large_farm_1.nbt +++ b/data/minecraft/structure/village/desert/houses/desert_large_farm_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:95707e99946ded972d02d7dbbf7f84b2a134a7a9a2481b585cf99eb40cd4b783 -size 1619 +oid sha256:9d626ff6ecc55e1cc4c15e5480b209703659bb9bd902fb69244989f5cb6882ae +size 1623 diff --git a/data/minecraft/structure/village/desert/houses/desert_library_1.nbt b/data/minecraft/structure/village/desert/houses/desert_library_1.nbt index 0d4ea070..a9d771fc 100644 --- a/data/minecraft/structure/village/desert/houses/desert_library_1.nbt +++ b/data/minecraft/structure/village/desert/houses/desert_library_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:81cf4e52477619488c39c35b34990a4e469c3774dd972c5675805141bbd785f1 -size 1536 +oid sha256:3b90b9849ee20bee2a5f3fd0d60b1a7086cec602628b6179e321f0d735d3735a +size 1539 diff --git a/data/minecraft/structure/village/desert/houses/desert_mason_1.nbt b/data/minecraft/structure/village/desert/houses/desert_mason_1.nbt index d2eb63e5..2aafed5f 100644 --- a/data/minecraft/structure/village/desert/houses/desert_mason_1.nbt +++ b/data/minecraft/structure/village/desert/houses/desert_mason_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5702b84d392fe1848a0354424273cdddcddbb255fca4545f7bcabd0853635653 -size 1440 +oid sha256:2474eeb51242929ffc7cc69b3f17351fe76ec4693f46efe17ecc64aa9ffd033e +size 1442 diff --git a/data/minecraft/structure/village/desert/houses/desert_medium_house_1.nbt b/data/minecraft/structure/village/desert/houses/desert_medium_house_1.nbt index 2283c4c2..87fdaa72 100644 --- a/data/minecraft/structure/village/desert/houses/desert_medium_house_1.nbt +++ b/data/minecraft/structure/village/desert/houses/desert_medium_house_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3311beb91757b94069307294cd1fa176bc559d918d4deb7c3e5482f017050d41 -size 1439 +oid sha256:5d25a0c0a5fac1555e419bf7e1d286496aa9925fa3361a7b5d7f96d6ab37a613 +size 1441 diff --git a/data/minecraft/structure/village/desert/houses/desert_medium_house_2.nbt b/data/minecraft/structure/village/desert/houses/desert_medium_house_2.nbt index 0f80f724..d6a811d3 100644 --- a/data/minecraft/structure/village/desert/houses/desert_medium_house_2.nbt +++ b/data/minecraft/structure/village/desert/houses/desert_medium_house_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6f452f2a983acb8a09050dcc6c04c0562ab49ae8a19fdd3642fefa08a56b51e8 -size 2836 +oid sha256:5e62f8ad463405560b70fa742f953669c316b934a933da2c136ac6f46c85207a +size 2838 diff --git a/data/minecraft/structure/village/desert/houses/desert_shepherd_house_1.nbt b/data/minecraft/structure/village/desert/houses/desert_shepherd_house_1.nbt index 34307526..0921a174 100644 --- a/data/minecraft/structure/village/desert/houses/desert_shepherd_house_1.nbt +++ b/data/minecraft/structure/village/desert/houses/desert_shepherd_house_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:17303402a17835b6d173f20dcb64c9e694189a50dbfd1c0305b3c539cfa7e3d8 -size 1564 +oid sha256:f79b861a27aa53d88fc774444e2221966aba6b2c7c40f61666d652005e1948f7 +size 1567 diff --git a/data/minecraft/structure/village/desert/houses/desert_small_house_1.nbt b/data/minecraft/structure/village/desert/houses/desert_small_house_1.nbt index 5efbfba6..fc66ab9c 100644 --- a/data/minecraft/structure/village/desert/houses/desert_small_house_1.nbt +++ b/data/minecraft/structure/village/desert/houses/desert_small_house_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f99975c26c69a886c5eba89a979d7a0cf9bae5e5900bfb4b71169c9f95d7d086 -size 1177 +oid sha256:f9a15921147906138c175120962d09ecd758032b8ecfbc702802f0856a8eb78b +size 1180 diff --git a/data/minecraft/structure/village/desert/houses/desert_small_house_2.nbt b/data/minecraft/structure/village/desert/houses/desert_small_house_2.nbt index b686415c..852b97fb 100644 --- a/data/minecraft/structure/village/desert/houses/desert_small_house_2.nbt +++ b/data/minecraft/structure/village/desert/houses/desert_small_house_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:990b990197b828930d5dac5a14eb4736549590a625cd995e7fa69cbbff674e2f -size 1311 +oid sha256:f6f5102c21c5dc7787616d44a9b1aa01b820bd8415e5cd8deb17bf8d750976d5 +size 1314 diff --git a/data/minecraft/structure/village/desert/houses/desert_small_house_3.nbt b/data/minecraft/structure/village/desert/houses/desert_small_house_3.nbt index b3ced975..212dcef8 100644 --- a/data/minecraft/structure/village/desert/houses/desert_small_house_3.nbt +++ b/data/minecraft/structure/village/desert/houses/desert_small_house_3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e7de43a47f0c3dd12b163f346171d2e58b90bfd07b4f8e630cc42f872f452878 -size 1129 +oid sha256:176c359db6c71029d16e73d3998be647fe9d8f7eb75fdb4b2918100757132bfb +size 1132 diff --git a/data/minecraft/structure/village/desert/houses/desert_small_house_4.nbt b/data/minecraft/structure/village/desert/houses/desert_small_house_4.nbt index 1108f998..ace3a51a 100644 --- a/data/minecraft/structure/village/desert/houses/desert_small_house_4.nbt +++ b/data/minecraft/structure/village/desert/houses/desert_small_house_4.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d039f2025f941937493527ca8b60c09f2ae2edf4d8f1469d6c6ecaa6a00ca6b4 -size 1052 +oid sha256:0295a6fe5d66a6fd1eba8796b970c735f42cd77556e8550e377d44eef0dc6c4b +size 1055 diff --git a/data/minecraft/structure/village/desert/houses/desert_small_house_5.nbt b/data/minecraft/structure/village/desert/houses/desert_small_house_5.nbt index 84b4da15..bbff13e9 100644 --- a/data/minecraft/structure/village/desert/houses/desert_small_house_5.nbt +++ b/data/minecraft/structure/village/desert/houses/desert_small_house_5.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:51bbde454dd75fc615666bd5cc03720b652498742868093cf00daf09b2d2ee69 -size 1105 +oid sha256:d0d98afd7b3f3feb803af2ce7a8a996921b5e39241b2b9022041f3dce48a33db +size 1108 diff --git a/data/minecraft/structure/village/desert/houses/desert_small_house_6.nbt b/data/minecraft/structure/village/desert/houses/desert_small_house_6.nbt index 4f7147af..81ddd77d 100644 --- a/data/minecraft/structure/village/desert/houses/desert_small_house_6.nbt +++ b/data/minecraft/structure/village/desert/houses/desert_small_house_6.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:432f9b6208c2e795aa926c28732504c5824148fe8a7f31373f866b7261079230 -size 2291 +oid sha256:21217fa23e697ccf10632940adcf225c2755bf5f353926d2c703286714e2a446 +size 2293 diff --git a/data/minecraft/structure/village/desert/houses/desert_small_house_7.nbt b/data/minecraft/structure/village/desert/houses/desert_small_house_7.nbt index 0e9b4c33..0551cb8d 100644 --- a/data/minecraft/structure/village/desert/houses/desert_small_house_7.nbt +++ b/data/minecraft/structure/village/desert/houses/desert_small_house_7.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:84fcd8c558a927cf5ca193a59b8bb12d3f7ce217b89f68c88ba4612431c2ef86 -size 1597 +oid sha256:d7816d1b146333536bd0c627333d83d5197d90a2fbf891d6bf3aa6bf4e335b60 +size 1600 diff --git a/data/minecraft/structure/village/desert/houses/desert_small_house_8.nbt b/data/minecraft/structure/village/desert/houses/desert_small_house_8.nbt index 9c498436..5d9433b3 100644 --- a/data/minecraft/structure/village/desert/houses/desert_small_house_8.nbt +++ b/data/minecraft/structure/village/desert/houses/desert_small_house_8.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9e343442c2ad3016e43a279bc40bbe4dd5a81868b991a66ba9a2fd0572ef7822 -size 1023 +oid sha256:1f1f6deaad5c47669c0631a66770c66c7d6df95c9560cd50ca45f4f7c00cb002 +size 1026 diff --git a/data/minecraft/structure/village/desert/houses/desert_tannery_1.nbt b/data/minecraft/structure/village/desert/houses/desert_tannery_1.nbt index 7be08ce7..59004a4f 100644 --- a/data/minecraft/structure/village/desert/houses/desert_tannery_1.nbt +++ b/data/minecraft/structure/village/desert/houses/desert_tannery_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:21a6d2c6331ab9048812a78529126bcf04d5dfba76a4eb7a7f50f01601111f91 -size 1834 +oid sha256:5d413a2c9a85337a876c1a77e084c25948b9639cebe175c9e8c25ec07e2d5799 +size 1836 diff --git a/data/minecraft/structure/village/desert/houses/desert_temple_1.nbt b/data/minecraft/structure/village/desert/houses/desert_temple_1.nbt index 4190e3ba..8c87ad6d 100644 --- a/data/minecraft/structure/village/desert/houses/desert_temple_1.nbt +++ b/data/minecraft/structure/village/desert/houses/desert_temple_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4c5919f9d59876895259fc7a31d57495020761c7d66e9edfd88ae452d0f22729 -size 2997 +oid sha256:2c4e1c881cde884dbad3b9d89bb1755576e55fadfb68a80b8e6151718d7b780c +size 2999 diff --git a/data/minecraft/structure/village/desert/houses/desert_temple_2.nbt b/data/minecraft/structure/village/desert/houses/desert_temple_2.nbt index b9d223af..656d37d7 100644 --- a/data/minecraft/structure/village/desert/houses/desert_temple_2.nbt +++ b/data/minecraft/structure/village/desert/houses/desert_temple_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e63e3433eea9acd9b6310c69b0906dcf4eea50745644591aca763be646367620 -size 2879 +oid sha256:e1ef234745dc762fbb4317c78bd9249bf38d3ee87dba320caa2843f1972756f3 +size 2881 diff --git a/data/minecraft/structure/village/desert/houses/desert_tool_smith_1.nbt b/data/minecraft/structure/village/desert/houses/desert_tool_smith_1.nbt index 8ddacf6d..08d41651 100644 --- a/data/minecraft/structure/village/desert/houses/desert_tool_smith_1.nbt +++ b/data/minecraft/structure/village/desert/houses/desert_tool_smith_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c7426f3ce56909f06aa03d240679ec3de4dbe897332dab3ca2fe30c374a2cf9d -size 2960 +oid sha256:481aaf68b187ff78ea658127baebdf499005ffab34f06aa11112d9e7a685b30d +size 2961 diff --git a/data/minecraft/structure/village/desert/houses/desert_weaponsmith_1.nbt b/data/minecraft/structure/village/desert/houses/desert_weaponsmith_1.nbt index b6bc1e44..9c3fa4fa 100644 --- a/data/minecraft/structure/village/desert/houses/desert_weaponsmith_1.nbt +++ b/data/minecraft/structure/village/desert/houses/desert_weaponsmith_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:dd36d169d2e60a74b1d7fe67b77e17cc5e5c28da9e3f3fadfe3e8e58297994b7 -size 2063 +oid sha256:df85de65bdde9461eb8a08d8bf35ee0650036376267c270d3a4bf06785e108c2 +size 2066 diff --git a/data/minecraft/structure/village/desert/streets/corner_01.nbt b/data/minecraft/structure/village/desert/streets/corner_01.nbt index 1b9a68b2..0d92ee06 100644 --- a/data/minecraft/structure/village/desert/streets/corner_01.nbt +++ b/data/minecraft/structure/village/desert/streets/corner_01.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:35beaab576af0bd5615f5defb2042376e0d16c533fef94a794a2a4259745861d -size 747 +oid sha256:4a5b5775f03abea9dd102d4c905a163fbc95c2d0b9cd3ca9554bbdf363ab5a02 +size 749 diff --git a/data/minecraft/structure/village/desert/streets/corner_02.nbt b/data/minecraft/structure/village/desert/streets/corner_02.nbt index 28569ec1..f053a870 100644 --- a/data/minecraft/structure/village/desert/streets/corner_02.nbt +++ b/data/minecraft/structure/village/desert/streets/corner_02.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c54b4c7970d3b9636ca7b7d21db7ae675169f411e687355530fa51d9db5ca67f -size 467 +oid sha256:a94f97ef94ca2533bc8c1842216cda7f34f201cbcabccdef786936373cb78c0c +size 469 diff --git a/data/minecraft/structure/village/desert/streets/crossroad_01.nbt b/data/minecraft/structure/village/desert/streets/crossroad_01.nbt index 213aa9c6..d9e22adb 100644 --- a/data/minecraft/structure/village/desert/streets/crossroad_01.nbt +++ b/data/minecraft/structure/village/desert/streets/crossroad_01.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4163177bc0fd45c35d30ecfb1a074a64a6ecf5931bb9ad8929abf8defffe22d4 -size 1270 +oid sha256:ce3b8d3e27ecaded2480b395e84cb184c575160c8652729f63e1c059f535bcbf +size 1273 diff --git a/data/minecraft/structure/village/desert/streets/crossroad_02.nbt b/data/minecraft/structure/village/desert/streets/crossroad_02.nbt index bc51e2b9..5301b659 100644 --- a/data/minecraft/structure/village/desert/streets/crossroad_02.nbt +++ b/data/minecraft/structure/village/desert/streets/crossroad_02.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:62ff4ece5bdef0d645fb1447d7296aeeadb70682cd9dc4c4732ed66a3d69b15c -size 780 +oid sha256:8ea98a0062e99924966ee69591753561f68f3515e758360027875216d22987be +size 783 diff --git a/data/minecraft/structure/village/desert/streets/crossroad_03.nbt b/data/minecraft/structure/village/desert/streets/crossroad_03.nbt index 4f71d98a..5cc42c80 100644 --- a/data/minecraft/structure/village/desert/streets/crossroad_03.nbt +++ b/data/minecraft/structure/village/desert/streets/crossroad_03.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5365526999e359ae3a67f02f0dc91ed2456c0a8d161286d346abfef29e8f5f13 -size 441 +oid sha256:5dd4dae918e9e14f7c91348ca59239a1fa3e18dfc701eee1eec087a35c4c8bc4 +size 444 diff --git a/data/minecraft/structure/village/desert/streets/square_01.nbt b/data/minecraft/structure/village/desert/streets/square_01.nbt index cb15ed45..c8b73619 100644 --- a/data/minecraft/structure/village/desert/streets/square_01.nbt +++ b/data/minecraft/structure/village/desert/streets/square_01.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:539c4c927d7b019230d26c2693cf098cdd53d705a08b1463003a4710fafe03e0 -size 1580 +oid sha256:a207db394f84ba861a238b2b0f7ab8decedec935e56a025d078301ba61dc9eff +size 1582 diff --git a/data/minecraft/structure/village/desert/streets/square_02.nbt b/data/minecraft/structure/village/desert/streets/square_02.nbt index 33e3aceb..7fd60ec0 100644 --- a/data/minecraft/structure/village/desert/streets/square_02.nbt +++ b/data/minecraft/structure/village/desert/streets/square_02.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:483b5f538b980dcc2bae1f6c4f6873c79617cab400f6fe10e2657711dcc5298f -size 1309 +oid sha256:e69bbd3cc7ef8afdb6e37e25c8093d6dd6d85b007c3cfb2527f5f701027af1d9 +size 1311 diff --git a/data/minecraft/structure/village/desert/streets/straight_01.nbt b/data/minecraft/structure/village/desert/streets/straight_01.nbt index c66741a9..c19be8ad 100644 --- a/data/minecraft/structure/village/desert/streets/straight_01.nbt +++ b/data/minecraft/structure/village/desert/streets/straight_01.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:35da2a04c957e82da7e650c6bf0a47839d4d95866b12dbdc8506fc3430c03da1 -size 982 +oid sha256:7c6bd4ce7821a837ef73f907dbd406647557488034b6fcbc0bce8afa27110867 +size 985 diff --git a/data/minecraft/structure/village/desert/streets/straight_02.nbt b/data/minecraft/structure/village/desert/streets/straight_02.nbt index 5c4b8cfb..34892dfe 100644 --- a/data/minecraft/structure/village/desert/streets/straight_02.nbt +++ b/data/minecraft/structure/village/desert/streets/straight_02.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5f54e776653e7d1a512efa9130524445980f7a48f7b7ae16845459c9a3df6ac5 -size 1228 +oid sha256:d53ded7e12570d788e5c06646489f33038ccd13a04f7c623e2f29578c471a680 +size 1230 diff --git a/data/minecraft/structure/village/desert/streets/straight_03.nbt b/data/minecraft/structure/village/desert/streets/straight_03.nbt index 26715cf0..930fb805 100644 --- a/data/minecraft/structure/village/desert/streets/straight_03.nbt +++ b/data/minecraft/structure/village/desert/streets/straight_03.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3451f7bc9932299feed868cac447fb354421f23537e0ae7a1f923ba89435c868 -size 320 +oid sha256:ea32a269ad883d81ccaeeb99ac2cab972b8dffe6e3c67ae35081a372e2eb24eb +size 323 diff --git a/data/minecraft/structure/village/desert/streets/turn_01.nbt b/data/minecraft/structure/village/desert/streets/turn_01.nbt index e41ce194..c0a012da 100644 --- a/data/minecraft/structure/village/desert/streets/turn_01.nbt +++ b/data/minecraft/structure/village/desert/streets/turn_01.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:cda38dace4693fb5170f4efb2f2d1be7b9a83e12f40ee4118a4ce47c723a3ab2 -size 399 +oid sha256:247531b7ac0ae6b4dc6dd7cebc3478df66663b3120ad2f0883d4974b12f5b021 +size 402 diff --git a/data/minecraft/structure/village/desert/terminators/terminator_01.nbt b/data/minecraft/structure/village/desert/terminators/terminator_01.nbt index 53fe2ab7..03050eb1 100644 --- a/data/minecraft/structure/village/desert/terminators/terminator_01.nbt +++ b/data/minecraft/structure/village/desert/terminators/terminator_01.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e965f02e3b447035a6617aafbeb80aa7481bb4051d171fab48c376a188d412ca -size 291 +oid sha256:5eee3b61e7496c478d344b88e4c130398f0934a750fdb31d83e379e240f6da42 +size 294 diff --git a/data/minecraft/structure/village/desert/terminators/terminator_02.nbt b/data/minecraft/structure/village/desert/terminators/terminator_02.nbt index e4d6439e..8be92d3a 100644 --- a/data/minecraft/structure/village/desert/terminators/terminator_02.nbt +++ b/data/minecraft/structure/village/desert/terminators/terminator_02.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7329acf0df2ffee243985a25aa09a765960abdacd057c34b3190db11b0b1ebf5 -size 370 +oid sha256:510ddfd23846bc9532edb44354aa1b132422006693d8d06084d5b8db977b7f8b +size 373 diff --git a/data/minecraft/structure/village/desert/town_centers/desert_meeting_point_1.nbt b/data/minecraft/structure/village/desert/town_centers/desert_meeting_point_1.nbt index cd7226ed..d528a9bd 100644 --- a/data/minecraft/structure/village/desert/town_centers/desert_meeting_point_1.nbt +++ b/data/minecraft/structure/village/desert/town_centers/desert_meeting_point_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:52050f2b855ed6692c4bd890c3df3d01124736729da035829eeac5ae5faf62ed -size 1013 +oid sha256:d45220adda6987be9549303df20067417d4418387390bd3c325018429aab5890 +size 1016 diff --git a/data/minecraft/structure/village/desert/town_centers/desert_meeting_point_2.nbt b/data/minecraft/structure/village/desert/town_centers/desert_meeting_point_2.nbt index 65df908a..c5e2ccac 100644 --- a/data/minecraft/structure/village/desert/town_centers/desert_meeting_point_2.nbt +++ b/data/minecraft/structure/village/desert/town_centers/desert_meeting_point_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6e03d146fd3b24d72a269b8209b4c7a43c690950718af40bcc5e86bf4a6e46fb -size 1832 +oid sha256:2a469ddea02c6b702ddc82573f5b21b265b9bfde69112110b510bcb4cc48e520 +size 1835 diff --git a/data/minecraft/structure/village/desert/town_centers/desert_meeting_point_3.nbt b/data/minecraft/structure/village/desert/town_centers/desert_meeting_point_3.nbt index 9f1c7aa7..1c4be53d 100644 --- a/data/minecraft/structure/village/desert/town_centers/desert_meeting_point_3.nbt +++ b/data/minecraft/structure/village/desert/town_centers/desert_meeting_point_3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5e6aea37657945bb15c8f204cc493c74a7fdd39cb8b271bc1af8e59dc95218ba -size 1896 +oid sha256:34de3d1666c32e3f09957e8534bb4f07f00b36be40b69fc5346b5390ac64b52e +size 1899 diff --git a/data/minecraft/structure/village/desert/villagers/baby.nbt b/data/minecraft/structure/village/desert/villagers/baby.nbt index 73cf63de..0f6ebc71 100644 --- a/data/minecraft/structure/village/desert/villagers/baby.nbt +++ b/data/minecraft/structure/village/desert/villagers/baby.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2dadd00da8300565daf2bd929630d6b86c18a93359384012c8d820a25d7cd43a +oid sha256:526c3b4ddddc8568ee8f56e887a24cf2c52dfd08e01a95172e288306ad555529 size 750 diff --git a/data/minecraft/structure/village/desert/villagers/nitwit.nbt b/data/minecraft/structure/village/desert/villagers/nitwit.nbt index aabdca39..3f22b1be 100644 --- a/data/minecraft/structure/village/desert/villagers/nitwit.nbt +++ b/data/minecraft/structure/village/desert/villagers/nitwit.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6252ceca78d5df5076f3f3a7dc8980d325edd12cfbfd0616b47f3408206b3b0a +oid sha256:4199b395986ccbd545f793fb223bc2788cd3d7a622abfb660c8ce92ecedfdb6e size 750 diff --git a/data/minecraft/structure/village/desert/villagers/unemployed.nbt b/data/minecraft/structure/village/desert/villagers/unemployed.nbt index e38c3ab0..e67002c1 100644 --- a/data/minecraft/structure/village/desert/villagers/unemployed.nbt +++ b/data/minecraft/structure/village/desert/villagers/unemployed.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3d31e152bf63ceabd98c604ace96a8133389ba6f4e9fe3b0f1a135913142a5ac -size 749 +oid sha256:703cab74f98beaa1e0d190e71b48234ab377452805765560f8837ff87e1e04c6 +size 750 diff --git a/data/minecraft/structure/village/desert/zombie/houses/desert_medium_house_1.nbt b/data/minecraft/structure/village/desert/zombie/houses/desert_medium_house_1.nbt index 55bce4c8..4e986263 100644 --- a/data/minecraft/structure/village/desert/zombie/houses/desert_medium_house_1.nbt +++ b/data/minecraft/structure/village/desert/zombie/houses/desert_medium_house_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9302ddcbda343937293ce939cd33eb795b5baa79afe633bac762f1a17ab244f6 -size 1447 +oid sha256:b73bd48dfea5bba165851d6d59186326d3e627d12c51eeb7b75659770eb50238 +size 1449 diff --git a/data/minecraft/structure/village/desert/zombie/houses/desert_medium_house_2.nbt b/data/minecraft/structure/village/desert/zombie/houses/desert_medium_house_2.nbt index 3a2eac8c..1a6fe6e1 100644 --- a/data/minecraft/structure/village/desert/zombie/houses/desert_medium_house_2.nbt +++ b/data/minecraft/structure/village/desert/zombie/houses/desert_medium_house_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7dcc84aadc363dc0c9b2067f61508281e45464d258b2270709272baaeb5c8e9a -size 2843 +oid sha256:044902782035fed7a7c4ad494f7a83f5f35300d247bca4ec87e89246c8eb54a6 +size 2846 diff --git a/data/minecraft/structure/village/desert/zombie/houses/desert_small_house_1.nbt b/data/minecraft/structure/village/desert/zombie/houses/desert_small_house_1.nbt index b5b89a3f..4c607af0 100644 --- a/data/minecraft/structure/village/desert/zombie/houses/desert_small_house_1.nbt +++ b/data/minecraft/structure/village/desert/zombie/houses/desert_small_house_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:bdfb2a66b2784334f9140f0136f4366f889e5ddd93d6bee8114b26ff50945340 -size 1184 +oid sha256:db2d5443c5c7afa9c936e07021a2b29d3e4b8b7b79bc507a8b5b1c93ebfad72d +size 1186 diff --git a/data/minecraft/structure/village/desert/zombie/houses/desert_small_house_2.nbt b/data/minecraft/structure/village/desert/zombie/houses/desert_small_house_2.nbt index 5309cc69..691c1bbf 100644 --- a/data/minecraft/structure/village/desert/zombie/houses/desert_small_house_2.nbt +++ b/data/minecraft/structure/village/desert/zombie/houses/desert_small_house_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:029c9e17f6707c7ffe3e9a22ed240bbf07ba3fe6d390e1f0ca0db38cd89d838e -size 1317 +oid sha256:9ba42ab2b00b3c8847a8dd07444f685bf2020eec9e735826a638259f46350672 +size 1319 diff --git a/data/minecraft/structure/village/desert/zombie/houses/desert_small_house_3.nbt b/data/minecraft/structure/village/desert/zombie/houses/desert_small_house_3.nbt index 2d919a75..c7d76418 100644 --- a/data/minecraft/structure/village/desert/zombie/houses/desert_small_house_3.nbt +++ b/data/minecraft/structure/village/desert/zombie/houses/desert_small_house_3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7948d7875f886d20c2b92a46a8eed8411eae397706c8ec9dc7f0b3c59943fe1c -size 1135 +oid sha256:55cb4570ea3c264f27bc0e04a46af98ea4c5f08da448f5233eb975f7c86f465a +size 1138 diff --git a/data/minecraft/structure/village/desert/zombie/houses/desert_small_house_4.nbt b/data/minecraft/structure/village/desert/zombie/houses/desert_small_house_4.nbt index c0e81fe8..7d5432cb 100644 --- a/data/minecraft/structure/village/desert/zombie/houses/desert_small_house_4.nbt +++ b/data/minecraft/structure/village/desert/zombie/houses/desert_small_house_4.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5ad77a20c8209c365129330f07b9ec5df5be8926b991b676032131d882420b63 -size 1059 +oid sha256:8ea5f721eba285438780b3c7f0ea14e7686e0cea7f098ef472b5b0fe0095710b +size 1062 diff --git a/data/minecraft/structure/village/desert/zombie/houses/desert_small_house_5.nbt b/data/minecraft/structure/village/desert/zombie/houses/desert_small_house_5.nbt index 7d402c7e..5e5128dd 100644 --- a/data/minecraft/structure/village/desert/zombie/houses/desert_small_house_5.nbt +++ b/data/minecraft/structure/village/desert/zombie/houses/desert_small_house_5.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:eb4a3405d6013b5d19d80994ae9779cd9f3b03e2e725703dd848dd3523d09fa5 -size 1111 +oid sha256:6749d6250164c5cf9f93e1e6cb3aafd41b1818c2aad6a929bff178c72d062cc8 +size 1114 diff --git a/data/minecraft/structure/village/desert/zombie/houses/desert_small_house_6.nbt b/data/minecraft/structure/village/desert/zombie/houses/desert_small_house_6.nbt index 590bb21f..3525a0c2 100644 --- a/data/minecraft/structure/village/desert/zombie/houses/desert_small_house_6.nbt +++ b/data/minecraft/structure/village/desert/zombie/houses/desert_small_house_6.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7840ef0ce691eaf740416c9823cf26ed0193f9c74276b0ba25f345707a2a061a -size 1962 +oid sha256:0db9175f1cb88bbcd02b3ce028306bd49194e9dcfe66c09f1632d7850918261d +size 1964 diff --git a/data/minecraft/structure/village/desert/zombie/houses/desert_small_house_7.nbt b/data/minecraft/structure/village/desert/zombie/houses/desert_small_house_7.nbt index c29de41c..f196f7c7 100644 --- a/data/minecraft/structure/village/desert/zombie/houses/desert_small_house_7.nbt +++ b/data/minecraft/structure/village/desert/zombie/houses/desert_small_house_7.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f0ceb5ccff205b23d81bd7c472e4d2ce6e4c5af9df6141f81d530fbd4562e447 -size 1603 +oid sha256:c82b44e79add36caa6566addb0b5688f89c825bf0d8e065c6795274325c7ae3f +size 1606 diff --git a/data/minecraft/structure/village/desert/zombie/houses/desert_small_house_8.nbt b/data/minecraft/structure/village/desert/zombie/houses/desert_small_house_8.nbt index af5f55bd..4649eeb5 100644 --- a/data/minecraft/structure/village/desert/zombie/houses/desert_small_house_8.nbt +++ b/data/minecraft/structure/village/desert/zombie/houses/desert_small_house_8.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:32acb2931a4100e208d75f987990cfaabcae6fb8ab969df8992357294170fa4e -size 1029 +oid sha256:3bfe9c8c6352195a6e918030fa6fee9f9e411f9f870e77113b59a3a3a39e0cb2 +size 1031 diff --git a/data/minecraft/structure/village/desert/zombie/streets/corner_01.nbt b/data/minecraft/structure/village/desert/zombie/streets/corner_01.nbt index 85b1efff..40428c41 100644 --- a/data/minecraft/structure/village/desert/zombie/streets/corner_01.nbt +++ b/data/minecraft/structure/village/desert/zombie/streets/corner_01.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7340e5f42bfcd011527c249e521f736c2cede5dba1192bf483f4dfff5b04b95e -size 751 +oid sha256:297cd0f1bb642021f4bc200c467c6c5d46894bb8414d345f85edc9b2350344a5 +size 754 diff --git a/data/minecraft/structure/village/desert/zombie/streets/corner_02.nbt b/data/minecraft/structure/village/desert/zombie/streets/corner_02.nbt index 13c4e66b..432fc3bd 100644 --- a/data/minecraft/structure/village/desert/zombie/streets/corner_02.nbt +++ b/data/minecraft/structure/village/desert/zombie/streets/corner_02.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:10238b3a18e8ca1692271d4066fed5b1da04ff5acc93c92827fec190842754b1 -size 470 +oid sha256:10009a70ac04930984cbfb9d9fa923b844420c9695521d3ede14010838072e5b +size 473 diff --git a/data/minecraft/structure/village/desert/zombie/streets/crossroad_01.nbt b/data/minecraft/structure/village/desert/zombie/streets/crossroad_01.nbt index 2bf8e7e3..5eced4a6 100644 --- a/data/minecraft/structure/village/desert/zombie/streets/crossroad_01.nbt +++ b/data/minecraft/structure/village/desert/zombie/streets/crossroad_01.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:dfed31f134b9536028b1ebc191888b2ccfa68aea051857fcd2bc4e307085e439 -size 1276 +oid sha256:5293580ba6bc939879c8299f13d7c5c78fcfc350bb0395928ca0cbfce3ee4f4c +size 1279 diff --git a/data/minecraft/structure/village/desert/zombie/streets/crossroad_02.nbt b/data/minecraft/structure/village/desert/zombie/streets/crossroad_02.nbt index 10f92c13..df93ab41 100644 --- a/data/minecraft/structure/village/desert/zombie/streets/crossroad_02.nbt +++ b/data/minecraft/structure/village/desert/zombie/streets/crossroad_02.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d51c68e4ce5d47c5e033918306610a62466146786e70972d668ff8674147a25d -size 785 +oid sha256:12ff49fd84b0ea80a8c0670ec08aba8823bd8f26f3242d35b29e9b355fdf199c +size 787 diff --git a/data/minecraft/structure/village/desert/zombie/streets/crossroad_03.nbt b/data/minecraft/structure/village/desert/zombie/streets/crossroad_03.nbt index 5e27de89..6a8b43e8 100644 --- a/data/minecraft/structure/village/desert/zombie/streets/crossroad_03.nbt +++ b/data/minecraft/structure/village/desert/zombie/streets/crossroad_03.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:192dddc5d9c33bd71e0fe3fab28b521af6cbac6ed788f30d266421bbb57c96c4 -size 447 +oid sha256:ade8f3528e257cfba17a7e5ec9cfed7f4bdbf769c3a0623741257ee56d43e703 +size 450 diff --git a/data/minecraft/structure/village/desert/zombie/streets/square_01.nbt b/data/minecraft/structure/village/desert/zombie/streets/square_01.nbt index ea05cca3..ebc98156 100644 --- a/data/minecraft/structure/village/desert/zombie/streets/square_01.nbt +++ b/data/minecraft/structure/village/desert/zombie/streets/square_01.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4c01990f52c72a7ab2a15c88aee8853e087408acb0569cf5b37c246bd537b5b9 -size 1584 +oid sha256:52e7eb6e4b2994a94d59b28422f20fe0933761b9faea83b76f341cf607b1b4ac +size 1587 diff --git a/data/minecraft/structure/village/desert/zombie/streets/square_02.nbt b/data/minecraft/structure/village/desert/zombie/streets/square_02.nbt index faf2c721..971e291d 100644 --- a/data/minecraft/structure/village/desert/zombie/streets/square_02.nbt +++ b/data/minecraft/structure/village/desert/zombie/streets/square_02.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3bd16ca0aad302a82afc289823c915f33c0b84bfbac24e21d4b88cc4896385ec -size 1313 +oid sha256:5d15c95b54a8353a63dca6d91c80b702b22a9af09c3bcf0ddce2648b0e4544b5 +size 1315 diff --git a/data/minecraft/structure/village/desert/zombie/streets/straight_01.nbt b/data/minecraft/structure/village/desert/zombie/streets/straight_01.nbt index e2ebd3d9..103fc35e 100644 --- a/data/minecraft/structure/village/desert/zombie/streets/straight_01.nbt +++ b/data/minecraft/structure/village/desert/zombie/streets/straight_01.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4861f60415fab95c944bc2cd176292599e3b6e387273ab4ef48474e5691bce9e -size 987 +oid sha256:0daca19ee1b5d33c6d5d6ddc8b1525d2c21751b7dd7fcbbfdd75db58a1377f7f +size 989 diff --git a/data/minecraft/structure/village/desert/zombie/streets/straight_02.nbt b/data/minecraft/structure/village/desert/zombie/streets/straight_02.nbt index 3b3062ed..bb4a9cca 100644 --- a/data/minecraft/structure/village/desert/zombie/streets/straight_02.nbt +++ b/data/minecraft/structure/village/desert/zombie/streets/straight_02.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0158dd35441116563e7516e0b36fd0bdefe5e8a719563b40f0cdee745c73f408 -size 1232 +oid sha256:5ebe155574ff2d4a51db04a512577d43b5ff23896449a332b41d36e6793d2213 +size 1234 diff --git a/data/minecraft/structure/village/desert/zombie/streets/straight_03.nbt b/data/minecraft/structure/village/desert/zombie/streets/straight_03.nbt index 21d3e585..e8fc699c 100644 --- a/data/minecraft/structure/village/desert/zombie/streets/straight_03.nbt +++ b/data/minecraft/structure/village/desert/zombie/streets/straight_03.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:521866c2c8e87bca4ace1e7b5e0831d15ce655408d27620babf3ce80673d2cb7 -size 326 +oid sha256:1b5f9d2dc8ed0bf0b37087a5af7ab013a64fdef4dcebc44afa39a5689a1d8ebc +size 328 diff --git a/data/minecraft/structure/village/desert/zombie/streets/turn_01.nbt b/data/minecraft/structure/village/desert/zombie/streets/turn_01.nbt index a5ff0bb9..7eea96d2 100644 --- a/data/minecraft/structure/village/desert/zombie/streets/turn_01.nbt +++ b/data/minecraft/structure/village/desert/zombie/streets/turn_01.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b12f55ddac37b34c9a5cc804f6ddeadd67fd998a276b2da69f12f83853f5f8da -size 403 +oid sha256:091be914da64c8f3e27df4810425fd1bc3e711b75209af7c2c80ef2a012c0abd +size 406 diff --git a/data/minecraft/structure/village/desert/zombie/terminators/terminator_02.nbt b/data/minecraft/structure/village/desert/zombie/terminators/terminator_02.nbt index 0252ca7d..72bb8e40 100644 --- a/data/minecraft/structure/village/desert/zombie/terminators/terminator_02.nbt +++ b/data/minecraft/structure/village/desert/zombie/terminators/terminator_02.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:547f065de167ce38b0aeb00e79d1608b5630918b50e04baa3f3647f8512bd2ce -size 374 +oid sha256:a365459182cad25b5d2c101295fbadb8212a9a783c8697d097720c361b2a1fa8 +size 377 diff --git a/data/minecraft/structure/village/desert/zombie/town_centers/desert_meeting_point_1.nbt b/data/minecraft/structure/village/desert/zombie/town_centers/desert_meeting_point_1.nbt index d97f488f..f4ea4d7a 100644 --- a/data/minecraft/structure/village/desert/zombie/town_centers/desert_meeting_point_1.nbt +++ b/data/minecraft/structure/village/desert/zombie/town_centers/desert_meeting_point_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:61d775febe437ea6017aad2137aa59e688122d1afc1020a8dbbc82a461fd5240 -size 1126 +oid sha256:1cc6554827086187937f439bfa5a8a0e66e64304d9b92144ca127289d0caf5d7 +size 1128 diff --git a/data/minecraft/structure/village/desert/zombie/town_centers/desert_meeting_point_2.nbt b/data/minecraft/structure/village/desert/zombie/town_centers/desert_meeting_point_2.nbt index defdafec..6c2a16c3 100644 --- a/data/minecraft/structure/village/desert/zombie/town_centers/desert_meeting_point_2.nbt +++ b/data/minecraft/structure/village/desert/zombie/town_centers/desert_meeting_point_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:810db4e980cb2962cc2ca1449e38145116d0cfae93180a0083b5d069e9f9ca11 -size 2310 +oid sha256:d20d0fe65d898b800aab1c648409511e91c9cf643cc6518127d43827231fc729 +size 2313 diff --git a/data/minecraft/structure/village/desert/zombie/town_centers/desert_meeting_point_3.nbt b/data/minecraft/structure/village/desert/zombie/town_centers/desert_meeting_point_3.nbt index 033202b8..5f3abf34 100644 --- a/data/minecraft/structure/village/desert/zombie/town_centers/desert_meeting_point_3.nbt +++ b/data/minecraft/structure/village/desert/zombie/town_centers/desert_meeting_point_3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f10baa54761c967febe1cf8d7e9c0bfde03480311ecd58d4dfe01b4d45c99747 -size 4578 +oid sha256:755cb959d568a61248b188596da7757e7ae8718d7b1f8f9c836740cd8e631ff0 +size 4580 diff --git a/data/minecraft/structure/village/desert/zombie/villagers/nitwit.nbt b/data/minecraft/structure/village/desert/zombie/villagers/nitwit.nbt index 5e5f4e24..249eee17 100644 --- a/data/minecraft/structure/village/desert/zombie/villagers/nitwit.nbt +++ b/data/minecraft/structure/village/desert/zombie/villagers/nitwit.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:78427e1e584ae9ad6b4656c0675d5a3e5ba757e341019eb601f9a157d098e6c6 +oid sha256:3e7c6f233f3e8049b4927725a9f4b7f781577830a6b9eac909051f6337e1ccb2 size 755 diff --git a/data/minecraft/structure/village/desert/zombie/villagers/unemployed.nbt b/data/minecraft/structure/village/desert/zombie/villagers/unemployed.nbt index bb50c31f..be3292d3 100644 --- a/data/minecraft/structure/village/desert/zombie/villagers/unemployed.nbt +++ b/data/minecraft/structure/village/desert/zombie/villagers/unemployed.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3f7e6d729ff893e79592e0453b19afb1947bf6e8a9eeb0e25306d0402eaf0b1d -size 754 +oid sha256:76a825a3ee6fc49073aa757f71bbcbb9fa8ff6cc836d558a8e537d447e87f5a1 +size 755 diff --git a/data/minecraft/structure/village/plains/houses/plains_accessory_1.nbt b/data/minecraft/structure/village/plains/houses/plains_accessory_1.nbt index dcce2e15..cd97770f 100644 --- a/data/minecraft/structure/village/plains/houses/plains_accessory_1.nbt +++ b/data/minecraft/structure/village/plains/houses/plains_accessory_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:411706128ff0993c570ffd01d798af8d4308b36864541c530b1423464148ef22 -size 521 +oid sha256:aaa4baa94be88bb1fcca55c2be2a2bdae1d1faa59019c5734df9929d91797177 +size 523 diff --git a/data/minecraft/structure/village/plains/houses/plains_animal_pen_1.nbt b/data/minecraft/structure/village/plains/houses/plains_animal_pen_1.nbt index 58be91d2..6a791a93 100644 --- a/data/minecraft/structure/village/plains/houses/plains_animal_pen_1.nbt +++ b/data/minecraft/structure/village/plains/houses/plains_animal_pen_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:95b4eff030d98a77366f5d28687f97c2401de94d21490ac82ea1f2daced2caa6 -size 723 +oid sha256:e6532c98c416a8bddc16622ebbcc458b031bf9710ecba46dc32bf482c82ea5c8 +size 726 diff --git a/data/minecraft/structure/village/plains/houses/plains_animal_pen_2.nbt b/data/minecraft/structure/village/plains/houses/plains_animal_pen_2.nbt index 766cde59..e8a79c13 100644 --- a/data/minecraft/structure/village/plains/houses/plains_animal_pen_2.nbt +++ b/data/minecraft/structure/village/plains/houses/plains_animal_pen_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:824da09301da85e115249a15ce0add6dab8753e9bd83fa24ef3b1e8c77c19dbc -size 1010 +oid sha256:160141275d60f836f0c9ba7d8e2739b4ce6249feec74fece1fc6ce06450ebf1b +size 1013 diff --git a/data/minecraft/structure/village/plains/houses/plains_animal_pen_3.nbt b/data/minecraft/structure/village/plains/houses/plains_animal_pen_3.nbt index 7531ad41..7a08e6f8 100644 --- a/data/minecraft/structure/village/plains/houses/plains_animal_pen_3.nbt +++ b/data/minecraft/structure/village/plains/houses/plains_animal_pen_3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:849e03318fbc19bbfe7508a54bc3f4c78f37941e16857139c5b2cb40018464d8 -size 1352 +oid sha256:331a2103bf3c1a18ed1aa080aace9cfacd20e2b8095b9bbd3ced3e62bccb95fa +size 1355 diff --git a/data/minecraft/structure/village/plains/houses/plains_armorer_house_1.nbt b/data/minecraft/structure/village/plains/houses/plains_armorer_house_1.nbt index f8700ed8..29db27d9 100644 --- a/data/minecraft/structure/village/plains/houses/plains_armorer_house_1.nbt +++ b/data/minecraft/structure/village/plains/houses/plains_armorer_house_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1d860fea6a650f0babab0588ac6bc45651ce407e769b26204bde2c74f8575f10 -size 2609 +oid sha256:fe82998c0a704e9d8446aa3fd2aa1abd6985da8152867b4ad98d04c66850a9e1 +size 2612 diff --git a/data/minecraft/structure/village/plains/houses/plains_big_house_1.nbt b/data/minecraft/structure/village/plains/houses/plains_big_house_1.nbt index f54ba1b1..1e24dad1 100644 --- a/data/minecraft/structure/village/plains/houses/plains_big_house_1.nbt +++ b/data/minecraft/structure/village/plains/houses/plains_big_house_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5f606fd3d3b81f7edaf5b8de6535193c4fe6e9a009b75a6727523552d7faad3f -size 3261 +oid sha256:4aef50989cd0ac17a91b82a656d529a664a78eac3364731063d93a9f409bc2a6 +size 3263 diff --git a/data/minecraft/structure/village/plains/houses/plains_butcher_shop_1.nbt b/data/minecraft/structure/village/plains/houses/plains_butcher_shop_1.nbt index f80ed80e..940fee45 100644 --- a/data/minecraft/structure/village/plains/houses/plains_butcher_shop_1.nbt +++ b/data/minecraft/structure/village/plains/houses/plains_butcher_shop_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f1f31b213117fe54ad062ea01b48c40ccf3ca7eb243c7d2cadadbb78b353095d -size 4163 +oid sha256:41db86d3187d6453912c8985a04188aa4b90bd760f700be7f8e346aa7b9b7462 +size 4166 diff --git a/data/minecraft/structure/village/plains/houses/plains_butcher_shop_2.nbt b/data/minecraft/structure/village/plains/houses/plains_butcher_shop_2.nbt index 30a51f04..77d6a863 100644 --- a/data/minecraft/structure/village/plains/houses/plains_butcher_shop_2.nbt +++ b/data/minecraft/structure/village/plains/houses/plains_butcher_shop_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0dc7d583572334da74c5b4ce9dd94fff45fc1a16286515fd6fa771fbba385aaf -size 4557 +oid sha256:f1e8e0e1c7fb81565bbeac00a32871058d8cc07eecee675628064df5660c2bc1 +size 4561 diff --git a/data/minecraft/structure/village/plains/houses/plains_cartographer_1.nbt b/data/minecraft/structure/village/plains/houses/plains_cartographer_1.nbt index c77a399b..b68ab171 100644 --- a/data/minecraft/structure/village/plains/houses/plains_cartographer_1.nbt +++ b/data/minecraft/structure/village/plains/houses/plains_cartographer_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:196c51b5abcf417f2ffcbce7eb96ad3451c031a644e8ad35a1e334190d1f4306 -size 2390 +oid sha256:c44dd872a33aab5c36777fdf5c34acab87905ba54a2a704104b9e04649529171 +size 2393 diff --git a/data/minecraft/structure/village/plains/houses/plains_fisher_cottage_1.nbt b/data/minecraft/structure/village/plains/houses/plains_fisher_cottage_1.nbt index ea645625..e69d104e 100644 --- a/data/minecraft/structure/village/plains/houses/plains_fisher_cottage_1.nbt +++ b/data/minecraft/structure/village/plains/houses/plains_fisher_cottage_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:68ed4c4a21e441038b31d6bac5761983a5006c1fa0b501e99707845effb76bd5 -size 3524 +oid sha256:505fdcdff3d92a217da835370f379d06f71c78b8bd69ae436a17bbaf5a5daa68 +size 3527 diff --git a/data/minecraft/structure/village/plains/houses/plains_fletcher_house_1.nbt b/data/minecraft/structure/village/plains/houses/plains_fletcher_house_1.nbt index 625870a8..a6c7b2d1 100644 --- a/data/minecraft/structure/village/plains/houses/plains_fletcher_house_1.nbt +++ b/data/minecraft/structure/village/plains/houses/plains_fletcher_house_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:12e3190933fb34bc8eab18c78101ae8d3a3975efc2fd792bada0366c687e268c -size 2912 +oid sha256:02adc07872c4e4819c88653b2134d531edfb6d25ea95a85cdd237595e2952afa +size 2914 diff --git a/data/minecraft/structure/village/plains/houses/plains_large_farm_1.nbt b/data/minecraft/structure/village/plains/houses/plains_large_farm_1.nbt index 402fc0d5..732f93a2 100644 --- a/data/minecraft/structure/village/plains/houses/plains_large_farm_1.nbt +++ b/data/minecraft/structure/village/plains/houses/plains_large_farm_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c8a0808d8a2072dd9fdfa01cca9fa0d7c29705f5e7c039415371ce110ab8f8c4 -size 1155 +oid sha256:455825490e9aa8a7a9c31d570e1aa9ed2e0b457a183bc1ea1c97d0a5b07c3050 +size 1157 diff --git a/data/minecraft/structure/village/plains/houses/plains_library_1.nbt b/data/minecraft/structure/village/plains/houses/plains_library_1.nbt index 6b1ac221..1e778f48 100644 --- a/data/minecraft/structure/village/plains/houses/plains_library_1.nbt +++ b/data/minecraft/structure/village/plains/houses/plains_library_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a5df61b5a12ad97ef3c8a9ceacbf6326af97867d2a1663933d02469498c215f3 -size 6513 +oid sha256:bf15744c0bee6ade6ee7a6d0b2d19a7a0404269c8489cbaa703271eed6dba602 +size 6515 diff --git a/data/minecraft/structure/village/plains/houses/plains_library_2.nbt b/data/minecraft/structure/village/plains/houses/plains_library_2.nbt index 11077aae..fde35355 100644 --- a/data/minecraft/structure/village/plains/houses/plains_library_2.nbt +++ b/data/minecraft/structure/village/plains/houses/plains_library_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7efa249faf1a8d9496709bfd639c0a10d5cc6c27c0cdb1a9f9a1a58989c53018 -size 2915 +oid sha256:0bb5e5ca53405b860303706d5bff7b72e04c587802b2a2d8f37e65dc1e3632c2 +size 2917 diff --git a/data/minecraft/structure/village/plains/houses/plains_masons_house_1.nbt b/data/minecraft/structure/village/plains/houses/plains_masons_house_1.nbt index 89bc4883..2532543f 100644 --- a/data/minecraft/structure/village/plains/houses/plains_masons_house_1.nbt +++ b/data/minecraft/structure/village/plains/houses/plains_masons_house_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:39f7af35cdff35376b64e7f94adf342f0657a7a4b8c86d9d8c9d834a9eb82fe0 -size 2294 +oid sha256:6e9b7e07396f55a3007235ffd66b173c7c8e07b3b07cdf791c31d6f79e3bfda3 +size 2296 diff --git a/data/minecraft/structure/village/plains/houses/plains_medium_house_1.nbt b/data/minecraft/structure/village/plains/houses/plains_medium_house_1.nbt index f9bf872b..46d134ac 100644 --- a/data/minecraft/structure/village/plains/houses/plains_medium_house_1.nbt +++ b/data/minecraft/structure/village/plains/houses/plains_medium_house_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e0368702b9668e0307173ebda442bb66e75bd24bca5d417de5d6aa7d429b8ca7 -size 4239 +oid sha256:64f6fe9ba6f2cdc0dd5f32ae0a1e7c2d0675d3eef9396ba9abc5b0a537f56c9e +size 4241 diff --git a/data/minecraft/structure/village/plains/houses/plains_medium_house_2.nbt b/data/minecraft/structure/village/plains/houses/plains_medium_house_2.nbt index 4f338ed5..baebda0f 100644 --- a/data/minecraft/structure/village/plains/houses/plains_medium_house_2.nbt +++ b/data/minecraft/structure/village/plains/houses/plains_medium_house_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:082e3e64163157aa03ebe073d67b53f5b3f43eb68a038a92562ad80010069c84 -size 2539 +oid sha256:1e22bde22d97248d760f19d9e3b0cde7a63d86b9de5c60008ea4263bddc7eb89 +size 2543 diff --git a/data/minecraft/structure/village/plains/houses/plains_meeting_point_4.nbt b/data/minecraft/structure/village/plains/houses/plains_meeting_point_4.nbt index e09a97a4..9704cb6b 100644 --- a/data/minecraft/structure/village/plains/houses/plains_meeting_point_4.nbt +++ b/data/minecraft/structure/village/plains/houses/plains_meeting_point_4.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6744c9c80b39172884fd360b22d9f4decc23afa1eb3f37614ea13643cebfe1e4 -size 3903 +oid sha256:54a6b09df3fb6825a38cafc97bc1f34a3c8af57a30e4a52890353ebd2bbfc182 +size 3906 diff --git a/data/minecraft/structure/village/plains/houses/plains_meeting_point_5.nbt b/data/minecraft/structure/village/plains/houses/plains_meeting_point_5.nbt index f5b0da97..62b870d8 100644 --- a/data/minecraft/structure/village/plains/houses/plains_meeting_point_5.nbt +++ b/data/minecraft/structure/village/plains/houses/plains_meeting_point_5.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:14553b6684afa87c3ac6c4995f68a38d834ea6b92ab8254e963dd1cad472452a -size 2650 +oid sha256:dfa5b9923a6bc8a5d8a737b7c2e45b2f6c70ecf4b64e0931865f6f118742355e +size 2652 diff --git a/data/minecraft/structure/village/plains/houses/plains_shepherds_house_1.nbt b/data/minecraft/structure/village/plains/houses/plains_shepherds_house_1.nbt index 51f070ef..7f6f94ed 100644 --- a/data/minecraft/structure/village/plains/houses/plains_shepherds_house_1.nbt +++ b/data/minecraft/structure/village/plains/houses/plains_shepherds_house_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1e25108cb11542f449556cc520f1f0fe6ee7cbdc8ffceb62144e040e8e0500b0 -size 2913 +oid sha256:aaaa768a8d0733e412c10bf3c9c862f89ddd5f1934f3fab80485c519385cb60f +size 2915 diff --git a/data/minecraft/structure/village/plains/houses/plains_small_farm_1.nbt b/data/minecraft/structure/village/plains/houses/plains_small_farm_1.nbt index b1b76d74..93b90432 100644 --- a/data/minecraft/structure/village/plains/houses/plains_small_farm_1.nbt +++ b/data/minecraft/structure/village/plains/houses/plains_small_farm_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7413ba52f6ee9a8e398450e12fe70fc6dfa351351a76c6c926e3d7d25700e3fe -size 771 +oid sha256:eb26343ba5b66b929a99671ed0307e6aa984c88c6f6093aa26a0365d112e2702 +size 773 diff --git a/data/minecraft/structure/village/plains/houses/plains_small_house_1.nbt b/data/minecraft/structure/village/plains/houses/plains_small_house_1.nbt index 84cc4e11..763c6fd2 100644 --- a/data/minecraft/structure/village/plains/houses/plains_small_house_1.nbt +++ b/data/minecraft/structure/village/plains/houses/plains_small_house_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0b81243ffc93fa65a644cb36c9b02ee2cb0a8bff5977242f71fc0c523f21c6a3 -size 1807 +oid sha256:e1e1be82ae0c4962aa93a0eeb1fcc1304d89359c2dd3f3c5cb1527f010246b92 +size 1809 diff --git a/data/minecraft/structure/village/plains/houses/plains_small_house_2.nbt b/data/minecraft/structure/village/plains/houses/plains_small_house_2.nbt index 33822dfc..a04a6e23 100644 --- a/data/minecraft/structure/village/plains/houses/plains_small_house_2.nbt +++ b/data/minecraft/structure/village/plains/houses/plains_small_house_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e495977fbbdb0360c2f020d83fe6205b12b466564ef093ae7ab64e1ff7b413e9 -size 1698 +oid sha256:ee14384c558940679b1e948f4842477bb9508e55eb68d4585ebe414ed883a409 +size 1700 diff --git a/data/minecraft/structure/village/plains/houses/plains_small_house_3.nbt b/data/minecraft/structure/village/plains/houses/plains_small_house_3.nbt index e055cf95..164a3b98 100644 --- a/data/minecraft/structure/village/plains/houses/plains_small_house_3.nbt +++ b/data/minecraft/structure/village/plains/houses/plains_small_house_3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b1cd7750649b8ae0788454a08bec414c373c920c2f21e97ca4f89eaa164cc673 -size 1800 +oid sha256:e88ff690cdce006dbef6211841269dd6c8ece5686b7ff747de3644379ba0eb8c +size 1803 diff --git a/data/minecraft/structure/village/plains/houses/plains_small_house_4.nbt b/data/minecraft/structure/village/plains/houses/plains_small_house_4.nbt index c5d70bb9..24d4f81b 100644 --- a/data/minecraft/structure/village/plains/houses/plains_small_house_4.nbt +++ b/data/minecraft/structure/village/plains/houses/plains_small_house_4.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:65d20c9cbf05e6c86e17d2698df2a994ebec1632ae747fb78e2913cbacfd0877 -size 1723 +oid sha256:d3a75866af6e400976c1af644a9e9118fdbe763ff10ccb9d79f9eea78d950a2e +size 1726 diff --git a/data/minecraft/structure/village/plains/houses/plains_small_house_5.nbt b/data/minecraft/structure/village/plains/houses/plains_small_house_5.nbt index 6d215c82..e9bef0ee 100644 --- a/data/minecraft/structure/village/plains/houses/plains_small_house_5.nbt +++ b/data/minecraft/structure/village/plains/houses/plains_small_house_5.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7ad1f54252673fe0f3d6c8fb86791f955229f38fae8512cb34ec2a9dba6bca46 -size 3488 +oid sha256:dc6247121a26b57d40e6162af5134eb0b9f90cdcc61dae949ba143ca7e810d47 +size 3491 diff --git a/data/minecraft/structure/village/plains/houses/plains_small_house_6.nbt b/data/minecraft/structure/village/plains/houses/plains_small_house_6.nbt index 32254563..7e957bcc 100644 --- a/data/minecraft/structure/village/plains/houses/plains_small_house_6.nbt +++ b/data/minecraft/structure/village/plains/houses/plains_small_house_6.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:322a593b019b6d3da92f0c9d211bbbb70d9d06de993e44c7131943f09c8ec208 -size 1772 +oid sha256:13840a845a286888d1887f3a20829efb5dcb5a51cfd72859824158c93babe65d +size 1775 diff --git a/data/minecraft/structure/village/plains/houses/plains_small_house_7.nbt b/data/minecraft/structure/village/plains/houses/plains_small_house_7.nbt index a39d3542..68cfd468 100644 --- a/data/minecraft/structure/village/plains/houses/plains_small_house_7.nbt +++ b/data/minecraft/structure/village/plains/houses/plains_small_house_7.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0bb0a46fbddce98c8811b7f0a1d3d518a854c268fd9f6c034a4a866138f6d463 -size 2033 +oid sha256:5c41d15ec12b10b89e01d3a6f4d68b519bc06414c531e4c0135bcc35605d594a +size 2036 diff --git a/data/minecraft/structure/village/plains/houses/plains_small_house_8.nbt b/data/minecraft/structure/village/plains/houses/plains_small_house_8.nbt index 9634e0da..18d8521d 100644 --- a/data/minecraft/structure/village/plains/houses/plains_small_house_8.nbt +++ b/data/minecraft/structure/village/plains/houses/plains_small_house_8.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:49fb37527eff49e0c1c829ff02ca004a6d5f46381a71787d2416282e66eb1e19 -size 2681 +oid sha256:0b494280cf0b3e426dd78e191281a8b221511bd7c0700a378fc75c665536d283 +size 2683 diff --git a/data/minecraft/structure/village/plains/houses/plains_stable_1.nbt b/data/minecraft/structure/village/plains/houses/plains_stable_1.nbt index 8e31f9b8..9756e889 100644 --- a/data/minecraft/structure/village/plains/houses/plains_stable_1.nbt +++ b/data/minecraft/structure/village/plains/houses/plains_stable_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8b5bdc945d17ef47d4a1f0e5284c18c3a66379cc92f0837a795c7fc960bb8c51 -size 3776 +oid sha256:8d4469c9746f7195a8cf703eaf4ab6a2fbb0748b2bbfd868f04ce90613bcdb08 +size 3779 diff --git a/data/minecraft/structure/village/plains/houses/plains_stable_2.nbt b/data/minecraft/structure/village/plains/houses/plains_stable_2.nbt index 4fb06e8e..406df3d3 100644 --- a/data/minecraft/structure/village/plains/houses/plains_stable_2.nbt +++ b/data/minecraft/structure/village/plains/houses/plains_stable_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7d390993a7686aac9e68414d2faaededaee542786ef7668294b63a747c106959 -size 3069 +oid sha256:01117ea15b3000379b18c3d9371a0dc10d10568334720ec18f65ca84db7b69ec +size 3072 diff --git a/data/minecraft/structure/village/plains/houses/plains_tannery_1.nbt b/data/minecraft/structure/village/plains/houses/plains_tannery_1.nbt index 2f661ee8..4a7d88d8 100644 --- a/data/minecraft/structure/village/plains/houses/plains_tannery_1.nbt +++ b/data/minecraft/structure/village/plains/houses/plains_tannery_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a8d17896b37ea9250181510b4cd9361cb2168a31acbe79db00e56c7a87bd806b -size 2500 +oid sha256:072d3a77cc918295cac3de5da887f1ff39ad1614dff30fca2d5940c1f602921f +size 2502 diff --git a/data/minecraft/structure/village/plains/houses/plains_temple_3.nbt b/data/minecraft/structure/village/plains/houses/plains_temple_3.nbt index b89f74a5..19145139 100644 --- a/data/minecraft/structure/village/plains/houses/plains_temple_3.nbt +++ b/data/minecraft/structure/village/plains/houses/plains_temple_3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:64a93805c1b809b8d47f225d25fa7c4f8892ea4ae261a12dd502bb4efbe05a68 -size 2489 +oid sha256:232ae84a1256abcb3829268c7dafb51a034cf38b294972cfdd5802058128c884 +size 2493 diff --git a/data/minecraft/structure/village/plains/houses/plains_temple_4.nbt b/data/minecraft/structure/village/plains/houses/plains_temple_4.nbt index 0d849643..81277c20 100644 --- a/data/minecraft/structure/village/plains/houses/plains_temple_4.nbt +++ b/data/minecraft/structure/village/plains/houses/plains_temple_4.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ff6d8c8681eac32bd7f5c6f96383411a32feae6505f73a46069c124a4a5cc094 -size 3208 +oid sha256:b85903eb06da353179011035385d9e234a3c02cc880a25d12098380f74f6c786 +size 3211 diff --git a/data/minecraft/structure/village/plains/houses/plains_tool_smith_1.nbt b/data/minecraft/structure/village/plains/houses/plains_tool_smith_1.nbt index 60450669..177a55e3 100644 --- a/data/minecraft/structure/village/plains/houses/plains_tool_smith_1.nbt +++ b/data/minecraft/structure/village/plains/houses/plains_tool_smith_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c6dadec52ff122fcf414871b50ee5f08616002a14973c71c22ae21a6b46e411a -size 2672 +oid sha256:7a78dca8aad121187ffda67b7192b0c640c512fea59118cd54c7d193f9c2c9ce +size 2675 diff --git a/data/minecraft/structure/village/plains/houses/plains_weaponsmith_1.nbt b/data/minecraft/structure/village/plains/houses/plains_weaponsmith_1.nbt index 0cbeb013..1475bb21 100644 --- a/data/minecraft/structure/village/plains/houses/plains_weaponsmith_1.nbt +++ b/data/minecraft/structure/village/plains/houses/plains_weaponsmith_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:393191017f580e96a3b979ba6dbdcc1f0bdba7dd7a0a10de5e77dc3df78931a1 -size 3339 +oid sha256:b53b6eb3e45dca7a9b5ecab3d03d14c41cd3c2c7c482447f65769cd98af6de15 +size 3342 diff --git a/data/minecraft/structure/village/plains/plains_lamp_1.nbt b/data/minecraft/structure/village/plains/plains_lamp_1.nbt index dd882423..0901a4df 100644 --- a/data/minecraft/structure/village/plains/plains_lamp_1.nbt +++ b/data/minecraft/structure/village/plains/plains_lamp_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5e564c7b327a4e038156e9eca7c30c8106e3d0a18323f8f9817c53216a4e35ff -size 467 +oid sha256:1778d887f9015b0a332ff94a5eb4f8a345c4af1f24f8391372db03551be912bd +size 470 diff --git a/data/minecraft/structure/village/plains/streets/corner_01.nbt b/data/minecraft/structure/village/plains/streets/corner_01.nbt index abcecf3a..d061a609 100644 --- a/data/minecraft/structure/village/plains/streets/corner_01.nbt +++ b/data/minecraft/structure/village/plains/streets/corner_01.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:65c6fc5bdded5d7fc8bd7e526e609116e658103d8209b5a5fa23eb8779d1da53 -size 1180 +oid sha256:01305baf5f12a739d22e0ae10dcd1480c4bfe2befeb367d70d67f86bb9a0c36a +size 1183 diff --git a/data/minecraft/structure/village/plains/streets/corner_02.nbt b/data/minecraft/structure/village/plains/streets/corner_02.nbt index 6ad08198..3d7dac13 100644 --- a/data/minecraft/structure/village/plains/streets/corner_02.nbt +++ b/data/minecraft/structure/village/plains/streets/corner_02.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e1edeaebdbd0121a3ded284f1f4bd84843dd87c0aa1c229b9b25b441d048240c -size 1107 +oid sha256:30d06708a5c944b939d40fca1fdeeb028f1c6459d67d95819af756e113463bff +size 1110 diff --git a/data/minecraft/structure/village/plains/streets/corner_03.nbt b/data/minecraft/structure/village/plains/streets/corner_03.nbt index 69193961..2e47d7f6 100644 --- a/data/minecraft/structure/village/plains/streets/corner_03.nbt +++ b/data/minecraft/structure/village/plains/streets/corner_03.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c617d72db59926fbdc3e91106ba2cc4019e024307546509fcf0cb7a2c5189892 -size 349 +oid sha256:6618f8e135e94f9032216d36d5940d185a3679eb89a104a599615261b8a91b77 +size 352 diff --git a/data/minecraft/structure/village/plains/streets/crossroad_01.nbt b/data/minecraft/structure/village/plains/streets/crossroad_01.nbt index be3db3fe..b2afc1b3 100644 --- a/data/minecraft/structure/village/plains/streets/crossroad_01.nbt +++ b/data/minecraft/structure/village/plains/streets/crossroad_01.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8953c13a0d73aebf55420d1ab0b657cdd960cec94c75d05fbe299c5e0dc039c2 -size 1213 +oid sha256:73a8e60802a46aa8d23a9470028c10e3c6c0c52b94446ce978dbd224eb46cace +size 1216 diff --git a/data/minecraft/structure/village/plains/streets/crossroad_02.nbt b/data/minecraft/structure/village/plains/streets/crossroad_02.nbt index 22efb3d8..3a4e22b5 100644 --- a/data/minecraft/structure/village/plains/streets/crossroad_02.nbt +++ b/data/minecraft/structure/village/plains/streets/crossroad_02.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8742afd673f34ba1b97b99b916c36406e1a0578b936ba27d1cb9cf6502f0e24d -size 1158 +oid sha256:b97ab71db36ecfbdd6160336994ced34c8b6deee80ff403607310beef2b8c49a +size 1161 diff --git a/data/minecraft/structure/village/plains/streets/crossroad_03.nbt b/data/minecraft/structure/village/plains/streets/crossroad_03.nbt index 179bf5bc..3a0ab588 100644 --- a/data/minecraft/structure/village/plains/streets/crossroad_03.nbt +++ b/data/minecraft/structure/village/plains/streets/crossroad_03.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0445e9affc0eec94a5884ad51a006f3ca65a49484965198d69c53ace2c4d9bad -size 1202 +oid sha256:b6058e9554eb26ec6c7c1779937041dff3a3762bf1b3004305a01f5221801e8e +size 1205 diff --git a/data/minecraft/structure/village/plains/streets/crossroad_04.nbt b/data/minecraft/structure/village/plains/streets/crossroad_04.nbt index 95d1d73c..789cd666 100644 --- a/data/minecraft/structure/village/plains/streets/crossroad_04.nbt +++ b/data/minecraft/structure/village/plains/streets/crossroad_04.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:fa862f7d78cab2cea2a14072aaa97d03981247ef1fe13d7703246f26aa2cc8e0 -size 377 +oid sha256:9ac1745ee49e27373bf26f45414b1c958c77733aec718a849786aa7976dac42b +size 378 diff --git a/data/minecraft/structure/village/plains/streets/crossroad_05.nbt b/data/minecraft/structure/village/plains/streets/crossroad_05.nbt index 337fba89..8c38ff9d 100644 --- a/data/minecraft/structure/village/plains/streets/crossroad_05.nbt +++ b/data/minecraft/structure/village/plains/streets/crossroad_05.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d7cae18471ff319612992322e21f96e6c38fd00994d1d242d50de3c5d6e5703b -size 408 +oid sha256:864bdf0390f2854a96d549ef44e99a2e55977631bf45f1c8cf0ca8b137ebc859 +size 410 diff --git a/data/minecraft/structure/village/plains/streets/crossroad_06.nbt b/data/minecraft/structure/village/plains/streets/crossroad_06.nbt index acfa9069..0e6f0c79 100644 --- a/data/minecraft/structure/village/plains/streets/crossroad_06.nbt +++ b/data/minecraft/structure/village/plains/streets/crossroad_06.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9c16de135bb6e3d46a92e417a2165b0bcc84e6d92ff28fdeb256b6031f4c6672 -size 469 +oid sha256:a671b622bd10d8b7775debad11d979b1e33c375c2fd6a6e82f43656f3d50419e +size 472 diff --git a/data/minecraft/structure/village/plains/streets/straight_01.nbt b/data/minecraft/structure/village/plains/streets/straight_01.nbt index e4154877..a72ab7b3 100644 --- a/data/minecraft/structure/village/plains/streets/straight_01.nbt +++ b/data/minecraft/structure/village/plains/streets/straight_01.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:39279700bf6eecd85ceb2ed1f50296c166d6d0027d07117225fd469be2112c30 -size 1130 +oid sha256:c34355585083681868bb21cf3638f9f37adf26a97597f21a1caad0969aac31b7 +size 1132 diff --git a/data/minecraft/structure/village/plains/streets/straight_02.nbt b/data/minecraft/structure/village/plains/streets/straight_02.nbt index d471c877..150076eb 100644 --- a/data/minecraft/structure/village/plains/streets/straight_02.nbt +++ b/data/minecraft/structure/village/plains/streets/straight_02.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:60beaca62660043cf971f4a0b5549c7990ef56b76c6d88039ee330fa28fd1959 -size 1082 +oid sha256:7a114e39384e8e3a758f996d69811d5b1b5baef0b8e2135d3e326ad626250b2b +size 1085 diff --git a/data/minecraft/structure/village/plains/streets/straight_03.nbt b/data/minecraft/structure/village/plains/streets/straight_03.nbt index c71dec27..d5c74e45 100644 --- a/data/minecraft/structure/village/plains/streets/straight_03.nbt +++ b/data/minecraft/structure/village/plains/streets/straight_03.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a76c28273abfaa3fa096c9ecd338260a65b864fbfc2b31173436830f723355f2 -size 775 +oid sha256:111fb1bb1df390b75360ebe6ab1898ed93d451f446d8a88e445fd8441fe15006 +size 778 diff --git a/data/minecraft/structure/village/plains/streets/straight_04.nbt b/data/minecraft/structure/village/plains/streets/straight_04.nbt index 0a277758..8aa00433 100644 --- a/data/minecraft/structure/village/plains/streets/straight_04.nbt +++ b/data/minecraft/structure/village/plains/streets/straight_04.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:610d8fc5ca28b8deadf654fb5566b4214e5bd9b70d5af7e7783c13273c067f98 -size 632 +oid sha256:bdba6232c08a59bcf3f81f7f86242478a891d6072502ae5d97a2207b2f291ee0 +size 635 diff --git a/data/minecraft/structure/village/plains/streets/straight_05.nbt b/data/minecraft/structure/village/plains/streets/straight_05.nbt index bf73ecb6..ea3f9411 100644 --- a/data/minecraft/structure/village/plains/streets/straight_05.nbt +++ b/data/minecraft/structure/village/plains/streets/straight_05.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b275da4e63e103b0307cdf42860747539a6a254fd7806463393f7eadfe56f7af -size 1327 +oid sha256:f60d43ef3f8f749802146937224857958da8fc52fac44a27403fcb504c29851c +size 1330 diff --git a/data/minecraft/structure/village/plains/streets/straight_06.nbt b/data/minecraft/structure/village/plains/streets/straight_06.nbt index 218a6b7c..89ed5732 100644 --- a/data/minecraft/structure/village/plains/streets/straight_06.nbt +++ b/data/minecraft/structure/village/plains/streets/straight_06.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2b1d0ca168dd42a0d11a6b5d14ed142fa62fd5dc6da6e845a042aea87644a1f1 -size 1701 +oid sha256:e7d0a2399ad2d8637b6141ed833e319a147748fc31262db5f7cf0f0976d6cbd3 +size 1704 diff --git a/data/minecraft/structure/village/plains/streets/turn_01.nbt b/data/minecraft/structure/village/plains/streets/turn_01.nbt index 8e09f9c6..125caefd 100644 --- a/data/minecraft/structure/village/plains/streets/turn_01.nbt +++ b/data/minecraft/structure/village/plains/streets/turn_01.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:071dff4a0c7005ca83c46b235aaba74001fce06f5545191e7653d559e448c490 -size 788 +oid sha256:634aaae75e0d07e6048081b50537a32bae0cb7c176e649f7fb1678f59aabc986 +size 790 diff --git a/data/minecraft/structure/village/plains/terminators/terminator_01.nbt b/data/minecraft/structure/village/plains/terminators/terminator_01.nbt index bc8b00ec..5fa45c05 100644 --- a/data/minecraft/structure/village/plains/terminators/terminator_01.nbt +++ b/data/minecraft/structure/village/plains/terminators/terminator_01.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:83a4a39318248a20a1fbbe709f8377ff03cb79d661fdd150c9427d15a7917e65 -size 282 +oid sha256:c5a54418efe9c561d8e3443fcc7bd66886688a70d71d68f8b81e3ddae3a6076e +size 285 diff --git a/data/minecraft/structure/village/plains/terminators/terminator_02.nbt b/data/minecraft/structure/village/plains/terminators/terminator_02.nbt index f2f42cfc..f28945aa 100644 --- a/data/minecraft/structure/village/plains/terminators/terminator_02.nbt +++ b/data/minecraft/structure/village/plains/terminators/terminator_02.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:95628c917fd31b833172f3bada6dc885ff3c48b98442b9c3a607d9a749762735 -size 249 +oid sha256:ba9fb7cbc06385dc7bc5d39ce7d2c199f3d276ab7037790688263b52a234f138 +size 251 diff --git a/data/minecraft/structure/village/plains/terminators/terminator_03.nbt b/data/minecraft/structure/village/plains/terminators/terminator_03.nbt index 1d45b9ca..adcbf838 100644 --- a/data/minecraft/structure/village/plains/terminators/terminator_03.nbt +++ b/data/minecraft/structure/village/plains/terminators/terminator_03.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c8a55845998e8a6d64edc3747b85c63b2d0783af0a449e03f0bf4defa9b303ad -size 290 +oid sha256:3d9808bf798da49a9c93735be19f371d565ac9af754ee4280f61055c8d2bc27c +size 292 diff --git a/data/minecraft/structure/village/plains/terminators/terminator_04.nbt b/data/minecraft/structure/village/plains/terminators/terminator_04.nbt index d7891ce1..98f03a3f 100644 --- a/data/minecraft/structure/village/plains/terminators/terminator_04.nbt +++ b/data/minecraft/structure/village/plains/terminators/terminator_04.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1bf511b31291ad653ded951a3f41ed9e90878dc350cec6c0bfdfac90bd62f823 -size 319 +oid sha256:14b8f9a3a60f446efc6b891ac911f918153e72f241f67d337031dcf89a4abbd2 +size 322 diff --git a/data/minecraft/structure/village/plains/town_centers/plains_fountain_01.nbt b/data/minecraft/structure/village/plains/town_centers/plains_fountain_01.nbt index 1f7b1921..b67df07c 100644 --- a/data/minecraft/structure/village/plains/town_centers/plains_fountain_01.nbt +++ b/data/minecraft/structure/village/plains/town_centers/plains_fountain_01.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b999c8517bd95cab9efe26c94f378af38693d5a0ef65edbfd346166f6b18b7bc -size 956 +oid sha256:eb957f3c85d6411eb16ea1e5c3782fef5cb75647c240cc2c576a5ef2d7514015 +size 957 diff --git a/data/minecraft/structure/village/plains/town_centers/plains_meeting_point_1.nbt b/data/minecraft/structure/village/plains/town_centers/plains_meeting_point_1.nbt index 0e3e830b..d3de886a 100644 --- a/data/minecraft/structure/village/plains/town_centers/plains_meeting_point_1.nbt +++ b/data/minecraft/structure/village/plains/town_centers/plains_meeting_point_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:adb8a34c983fdfdc4736ba0fa56def51301a7a982eb367352155da33c0cae687 -size 1049 +oid sha256:de4092b166d4c932962baf08a270f1bb58af6f5f3ddfc0b83c7c090be9661f05 +size 1052 diff --git a/data/minecraft/structure/village/plains/town_centers/plains_meeting_point_2.nbt b/data/minecraft/structure/village/plains/town_centers/plains_meeting_point_2.nbt index ed9f9418..63939190 100644 --- a/data/minecraft/structure/village/plains/town_centers/plains_meeting_point_2.nbt +++ b/data/minecraft/structure/village/plains/town_centers/plains_meeting_point_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f908332b27d4ace965c6a5cf48f3d39e4bd46560c3d55500ae3feea63b508d35 -size 2538 +oid sha256:8197afd6589070a47d67b362c11e80d2a87e660a1af51b3dae4f96497f7ea601 +size 2540 diff --git a/data/minecraft/structure/village/plains/town_centers/plains_meeting_point_3.nbt b/data/minecraft/structure/village/plains/town_centers/plains_meeting_point_3.nbt index a5933069..e04bab83 100644 --- a/data/minecraft/structure/village/plains/town_centers/plains_meeting_point_3.nbt +++ b/data/minecraft/structure/village/plains/town_centers/plains_meeting_point_3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:46e891f1bceb5908fbd0e212bf5e6f5f03a02931a9847b38291796a5c64aa03c -size 1584 +oid sha256:5f53c1015240a4ee548be648375b9cfc3391d79b34f738c410d517dd8562e412 +size 1586 diff --git a/data/minecraft/structure/village/plains/villagers/baby.nbt b/data/minecraft/structure/village/plains/villagers/baby.nbt index 4336fcc2..59d1e0a8 100644 --- a/data/minecraft/structure/village/plains/villagers/baby.nbt +++ b/data/minecraft/structure/village/plains/villagers/baby.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:53c1e3594bd22fd05fa5f939b6a235f77076963f7bb5c6dc5eb413b237564afd -size 749 +oid sha256:a783d3e056a62527372d7e82065dc5a43bd1b171a66ca68d5812087135c31f8d +size 750 diff --git a/data/minecraft/structure/village/plains/villagers/nitwit.nbt b/data/minecraft/structure/village/plains/villagers/nitwit.nbt index f9ea85c7..e814977c 100644 --- a/data/minecraft/structure/village/plains/villagers/nitwit.nbt +++ b/data/minecraft/structure/village/plains/villagers/nitwit.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4c7d496e0a4b22d93211626dd01742a93aa7a922c6498f42476bb958e1902e56 +oid sha256:1cb215803777dcd0e114041ccfff259ee2b542165f946dec77a5b9066c685ee0 size 749 diff --git a/data/minecraft/structure/village/plains/villagers/unemployed.nbt b/data/minecraft/structure/village/plains/villagers/unemployed.nbt index 6389bab0..a1d25bc3 100644 --- a/data/minecraft/structure/village/plains/villagers/unemployed.nbt +++ b/data/minecraft/structure/village/plains/villagers/unemployed.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:66b346caffa98caec6425b3f5529f3bc1802121f4c7d651320111fb186e5ffd1 +oid sha256:4a5dcc6243031b474d12d3d3578af026510b6844637ecc157c0be55e9b9d923e size 749 diff --git a/data/minecraft/structure/village/plains/zombie/houses/plains_animal_pen_3.nbt b/data/minecraft/structure/village/plains/zombie/houses/plains_animal_pen_3.nbt index f271f452..e1a843ed 100644 --- a/data/minecraft/structure/village/plains/zombie/houses/plains_animal_pen_3.nbt +++ b/data/minecraft/structure/village/plains/zombie/houses/plains_animal_pen_3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:58ae6d9bfb7605c153398b7ca1bc02b7e8a9360142d0afbf0ea2267f75436bc9 -size 1359 +oid sha256:cffef7763e54f35ab60231b0e0f96d099bba40d5b5bc5dce93fc51f5ba0d04d9 +size 1362 diff --git a/data/minecraft/structure/village/plains/zombie/houses/plains_big_house_1.nbt b/data/minecraft/structure/village/plains/zombie/houses/plains_big_house_1.nbt index 7bd8e229..92221263 100644 --- a/data/minecraft/structure/village/plains/zombie/houses/plains_big_house_1.nbt +++ b/data/minecraft/structure/village/plains/zombie/houses/plains_big_house_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a64d65dc265bb0706718cfa73b0f300cfd4c2febb5dcd626bb24f2c5bec0e301 -size 3269 +oid sha256:4cd72bf090d57db276cac363b62b8c57c68fad99695bf4b82a48d9bb8b2bcdcc +size 3272 diff --git a/data/minecraft/structure/village/plains/zombie/houses/plains_butcher_shop_2.nbt b/data/minecraft/structure/village/plains/zombie/houses/plains_butcher_shop_2.nbt index 55a6e6a2..28e1375c 100644 --- a/data/minecraft/structure/village/plains/zombie/houses/plains_butcher_shop_2.nbt +++ b/data/minecraft/structure/village/plains/zombie/houses/plains_butcher_shop_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:751e1240c362b975b9ac48112544197e9c9496bb3e48dc231873c354c84fabb5 -size 4640 +oid sha256:17a0ea7f3a651c0b5eda06788232ac165fe092e5cf7c1206a7106b942232dfa8 +size 4644 diff --git a/data/minecraft/structure/village/plains/zombie/houses/plains_fletcher_house_1.nbt b/data/minecraft/structure/village/plains/zombie/houses/plains_fletcher_house_1.nbt index faa6c0cc..6fab6c9b 100644 --- a/data/minecraft/structure/village/plains/zombie/houses/plains_fletcher_house_1.nbt +++ b/data/minecraft/structure/village/plains/zombie/houses/plains_fletcher_house_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c43afce4f2193c41d01736cb7db376ab644a003325d9710fb5b27fcb73060af2 -size 2903 +oid sha256:f635ca4e0bbba90637618a0e25269237da5f3de6ef54f62b6d3f76def40e1fe1 +size 2912 diff --git a/data/minecraft/structure/village/plains/zombie/houses/plains_medium_house_1.nbt b/data/minecraft/structure/village/plains/zombie/houses/plains_medium_house_1.nbt index 2b0e8679..231228b7 100644 --- a/data/minecraft/structure/village/plains/zombie/houses/plains_medium_house_1.nbt +++ b/data/minecraft/structure/village/plains/zombie/houses/plains_medium_house_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f1acef7c35b75cdab6719ac9db9f8ce076068923415a14295fa0297eb70bb3eb -size 4246 +oid sha256:7a4f85020029993e6bc8507eb2cb15b6ee6005645e55e799177c29d9e9e43a0e +size 4248 diff --git a/data/minecraft/structure/village/plains/zombie/houses/plains_medium_house_2.nbt b/data/minecraft/structure/village/plains/zombie/houses/plains_medium_house_2.nbt index b11ea59e..114bfd03 100644 --- a/data/minecraft/structure/village/plains/zombie/houses/plains_medium_house_2.nbt +++ b/data/minecraft/structure/village/plains/zombie/houses/plains_medium_house_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2ab04a9fd602f38b5190de9a93202663602dbbf0e3040c643b92db039a09fee7 -size 2539 +oid sha256:e8b4af1462f5d6a837714b2f320a422d8cab271704a038b6f38904ff247768da +size 2541 diff --git a/data/minecraft/structure/village/plains/zombie/houses/plains_meeting_point_4.nbt b/data/minecraft/structure/village/plains/zombie/houses/plains_meeting_point_4.nbt index 98310c83..00d5024c 100644 --- a/data/minecraft/structure/village/plains/zombie/houses/plains_meeting_point_4.nbt +++ b/data/minecraft/structure/village/plains/zombie/houses/plains_meeting_point_4.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:80981c1cbe6be35dd245b8083b1feac05f005eba2c175dfa1a45cda6a98fc8a7 -size 3916 +oid sha256:5d959c3fd4cfb4c00d86b66c4db9565344234f3c7f0e76cd87e4bea5d9d6631e +size 3919 diff --git a/data/minecraft/structure/village/plains/zombie/houses/plains_meeting_point_5.nbt b/data/minecraft/structure/village/plains/zombie/houses/plains_meeting_point_5.nbt index 95fd1dbc..0754570e 100644 --- a/data/minecraft/structure/village/plains/zombie/houses/plains_meeting_point_5.nbt +++ b/data/minecraft/structure/village/plains/zombie/houses/plains_meeting_point_5.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:21af79339fc57a06ea0781356c36bebe7bdb2ed9fe29c19b981040a3bf16339a -size 2595 +oid sha256:46a6b8b5915d988ea86b0ae228a35d777de0847636c476247a59100fcc4cb7d0 +size 2598 diff --git a/data/minecraft/structure/village/plains/zombie/houses/plains_shepherds_house_1.nbt b/data/minecraft/structure/village/plains/zombie/houses/plains_shepherds_house_1.nbt index 36fd4506..16cca1dc 100644 --- a/data/minecraft/structure/village/plains/zombie/houses/plains_shepherds_house_1.nbt +++ b/data/minecraft/structure/village/plains/zombie/houses/plains_shepherds_house_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5399ab4266466cce808266b594a6486452ab32701e66e556d5d0b0420f61eed4 -size 2922 +oid sha256:ab4486b11c586ad2f16c69dddeff550972602a1d930ddfcbab021e465ac9a73d +size 2924 diff --git a/data/minecraft/structure/village/plains/zombie/houses/plains_small_house_1.nbt b/data/minecraft/structure/village/plains/zombie/houses/plains_small_house_1.nbt index 3d1d3f6c..cf713c7b 100644 --- a/data/minecraft/structure/village/plains/zombie/houses/plains_small_house_1.nbt +++ b/data/minecraft/structure/village/plains/zombie/houses/plains_small_house_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0499897ab37f730ceb0b720c0b17d5d29bb3e81cdcaab60a24651e59cf2ea7c1 -size 1807 +oid sha256:3dcbfc37b3c7a6792b14f7aea9554253bc90cf87090cdfc52821f0dacddf15ff +size 1810 diff --git a/data/minecraft/structure/village/plains/zombie/houses/plains_small_house_2.nbt b/data/minecraft/structure/village/plains/zombie/houses/plains_small_house_2.nbt index 95164101..3674df6a 100644 --- a/data/minecraft/structure/village/plains/zombie/houses/plains_small_house_2.nbt +++ b/data/minecraft/structure/village/plains/zombie/houses/plains_small_house_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:fc56a5e25c6f7da1b93726d8d43d3866d33948673bb69de4cad4bc215d53a3ae -size 1705 +oid sha256:c6bfce7dcb03647ac53ca039c57f39ae5884ef1d965a1d0c09aa3a8e6e779898 +size 1707 diff --git a/data/minecraft/structure/village/plains/zombie/houses/plains_small_house_3.nbt b/data/minecraft/structure/village/plains/zombie/houses/plains_small_house_3.nbt index aad5e2a3..a1e3ec2b 100644 --- a/data/minecraft/structure/village/plains/zombie/houses/plains_small_house_3.nbt +++ b/data/minecraft/structure/village/plains/zombie/houses/plains_small_house_3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:336b5cf78a418f60af1964881b8883889d02bb866ef8e148cd31d53a047d0fda -size 1807 +oid sha256:fa43b01d9769c678478c01344ec88a9d4693aa53b5343b6b3186b18848328b91 +size 1810 diff --git a/data/minecraft/structure/village/plains/zombie/houses/plains_small_house_4.nbt b/data/minecraft/structure/village/plains/zombie/houses/plains_small_house_4.nbt index 824f1338..98527aa7 100644 --- a/data/minecraft/structure/village/plains/zombie/houses/plains_small_house_4.nbt +++ b/data/minecraft/structure/village/plains/zombie/houses/plains_small_house_4.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:97d9226ca53e9e2f2372a06baf52dec23ab4a784d78d5cbf3d7725b06c4b46af -size 1780 +oid sha256:0f24ab9470433ce7258234e4bf3a84129814e091bf8386739042ad20c4068fc0 +size 1783 diff --git a/data/minecraft/structure/village/plains/zombie/houses/plains_small_house_5.nbt b/data/minecraft/structure/village/plains/zombie/houses/plains_small_house_5.nbt index 882a1b8c..4b673d71 100644 --- a/data/minecraft/structure/village/plains/zombie/houses/plains_small_house_5.nbt +++ b/data/minecraft/structure/village/plains/zombie/houses/plains_small_house_5.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4de2bcb31f8cec030690815aa425fe986d91b3907be330abf4b3801a9f868b91 -size 3492 +oid sha256:a015bd278dda535bb4ccbde2f2f971616f1e0b98e4ff7244392b73706d411f32 +size 3494 diff --git a/data/minecraft/structure/village/plains/zombie/houses/plains_small_house_6.nbt b/data/minecraft/structure/village/plains/zombie/houses/plains_small_house_6.nbt index 621bdcf0..d381e361 100644 --- a/data/minecraft/structure/village/plains/zombie/houses/plains_small_house_6.nbt +++ b/data/minecraft/structure/village/plains/zombie/houses/plains_small_house_6.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8c8a86c33127079091b82559ed9ea0cc51d3c6108e80a705ea5d3d03c64b8ddf -size 1764 +oid sha256:4acea5de12367dd5ede54b2c6e0f71b52fec51669b69bd1d378047725109af97 +size 1767 diff --git a/data/minecraft/structure/village/plains/zombie/houses/plains_small_house_7.nbt b/data/minecraft/structure/village/plains/zombie/houses/plains_small_house_7.nbt index 429c8972..e487563e 100644 --- a/data/minecraft/structure/village/plains/zombie/houses/plains_small_house_7.nbt +++ b/data/minecraft/structure/village/plains/zombie/houses/plains_small_house_7.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:40289c5f8f01a92dfdf6942727ac46aa07a21c51c249180b801f774bbe4e12d6 -size 2031 +oid sha256:ae2840d82c2e49c85c0f153f457a74e9f316765a74975795e46fee6d2482da82 +size 2034 diff --git a/data/minecraft/structure/village/plains/zombie/houses/plains_small_house_8.nbt b/data/minecraft/structure/village/plains/zombie/houses/plains_small_house_8.nbt index 42b8a26b..4c089675 100644 --- a/data/minecraft/structure/village/plains/zombie/houses/plains_small_house_8.nbt +++ b/data/minecraft/structure/village/plains/zombie/houses/plains_small_house_8.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8d6e120f138a4c96d2891d008e69004d2a2792d2311650461b4d9be944ce18a2 -size 2688 +oid sha256:62fd264ae4dc978f614cd2f431063a001f58d2c772ebe4f46837cdfadb60b808 +size 2691 diff --git a/data/minecraft/structure/village/plains/zombie/houses/plains_stable_1.nbt b/data/minecraft/structure/village/plains/zombie/houses/plains_stable_1.nbt index 4a807471..5f96340e 100644 --- a/data/minecraft/structure/village/plains/zombie/houses/plains_stable_1.nbt +++ b/data/minecraft/structure/village/plains/zombie/houses/plains_stable_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9f751a690e65d46156ceac4ba5558fe9006ecac4059bd0e57f5ab60254e3d1c6 +oid sha256:ce8d9350166cccd3c11219598102f388e79998e30d42b3f014f4ae6721d85e5c size 3859 diff --git a/data/minecraft/structure/village/plains/zombie/streets/corner_01.nbt b/data/minecraft/structure/village/plains/zombie/streets/corner_01.nbt index 1159848f..8a7eea11 100644 --- a/data/minecraft/structure/village/plains/zombie/streets/corner_01.nbt +++ b/data/minecraft/structure/village/plains/zombie/streets/corner_01.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7ccd0e8e34b984f5b5165b5c402c69cd3d8bec62a598ea040032daad0f1126c6 -size 1185 +oid sha256:01ba5bd6e3920dc1b3e08e147ec918099e73fa469fa4d5e53bc3ca5145a5d4f1 +size 1188 diff --git a/data/minecraft/structure/village/plains/zombie/streets/corner_02.nbt b/data/minecraft/structure/village/plains/zombie/streets/corner_02.nbt index cbe00051..b544cf64 100644 --- a/data/minecraft/structure/village/plains/zombie/streets/corner_02.nbt +++ b/data/minecraft/structure/village/plains/zombie/streets/corner_02.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3140da3af58321a65b0aeb1046f090c067d259ca9cf95c3470187064a9aa2de5 -size 1113 +oid sha256:7c7b5d2a0ba8bc64fd42eaef1d2b2ff2339d704ba2035c373a0aaaf6995c858d +size 1116 diff --git a/data/minecraft/structure/village/plains/zombie/streets/corner_03.nbt b/data/minecraft/structure/village/plains/zombie/streets/corner_03.nbt index ab76e504..d774a9b7 100644 --- a/data/minecraft/structure/village/plains/zombie/streets/corner_03.nbt +++ b/data/minecraft/structure/village/plains/zombie/streets/corner_03.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a2054e26d32cfba6790f3d1ad932620542c05f9f34d9ef632da3a6f058d5fc39 -size 354 +oid sha256:4aed22283bcb4c95522e4d47498846fc0943710339ed1d99f5c85fbf7ac24d75 +size 357 diff --git a/data/minecraft/structure/village/plains/zombie/streets/crossroad_01.nbt b/data/minecraft/structure/village/plains/zombie/streets/crossroad_01.nbt index 001156e7..ab535feb 100644 --- a/data/minecraft/structure/village/plains/zombie/streets/crossroad_01.nbt +++ b/data/minecraft/structure/village/plains/zombie/streets/crossroad_01.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c9697aa04a4f0fb5200aa1b6b01fd2c72669669c3c669b8b6753dc79b80007d2 -size 1219 +oid sha256:9cf412b4e635107d8545103fcc7409bbbcc0d2b71793c38de4acd33d20406f88 +size 1221 diff --git a/data/minecraft/structure/village/plains/zombie/streets/crossroad_02.nbt b/data/minecraft/structure/village/plains/zombie/streets/crossroad_02.nbt index 4e19ad49..2c9c86c8 100644 --- a/data/minecraft/structure/village/plains/zombie/streets/crossroad_02.nbt +++ b/data/minecraft/structure/village/plains/zombie/streets/crossroad_02.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8d054f692bf57a4f1bab758238634918c44ef982cab4b898573be84971838a6d -size 1163 +oid sha256:ec032aa26736ea1ac7c91505f380c3fad212bb5920b7b0e4380b72ae02064c14 +size 1166 diff --git a/data/minecraft/structure/village/plains/zombie/streets/crossroad_03.nbt b/data/minecraft/structure/village/plains/zombie/streets/crossroad_03.nbt index 59de277e..9275dd1d 100644 --- a/data/minecraft/structure/village/plains/zombie/streets/crossroad_03.nbt +++ b/data/minecraft/structure/village/plains/zombie/streets/crossroad_03.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d07a94dc66376aab7b4a95f5305b832f0e82ee2bf652377a0824875445bb69c7 -size 1206 +oid sha256:6f72db504ce27e6972873bf418393e0cabba12f4fb1f3a32cb833912709532a8 +size 1209 diff --git a/data/minecraft/structure/village/plains/zombie/streets/crossroad_04.nbt b/data/minecraft/structure/village/plains/zombie/streets/crossroad_04.nbt index f6cb9ca6..3fc74082 100644 --- a/data/minecraft/structure/village/plains/zombie/streets/crossroad_04.nbt +++ b/data/minecraft/structure/village/plains/zombie/streets/crossroad_04.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:10cd8c0b9eb5d883e4cfa1959c30568f4b2622b2d961c5c28e70c8b77c37c010 -size 381 +oid sha256:e366fd0c7fd02b4ef4300cc42850da58f7a92e2c5d09d7f6c312a04b114bcf78 +size 383 diff --git a/data/minecraft/structure/village/plains/zombie/streets/crossroad_05.nbt b/data/minecraft/structure/village/plains/zombie/streets/crossroad_05.nbt index 37963d52..42104fae 100644 --- a/data/minecraft/structure/village/plains/zombie/streets/crossroad_05.nbt +++ b/data/minecraft/structure/village/plains/zombie/streets/crossroad_05.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2a305983d044baeb091b5ad1f0c6309083e52b74f68c9f2e8cdf57cd15cbc333 -size 412 +oid sha256:8032fbcb89e62fc2c3db0c5f60f6e9375ec3c3629605087ffbb9c11055480bcb +size 415 diff --git a/data/minecraft/structure/village/plains/zombie/streets/crossroad_06.nbt b/data/minecraft/structure/village/plains/zombie/streets/crossroad_06.nbt index 9778c5ed..30aed354 100644 --- a/data/minecraft/structure/village/plains/zombie/streets/crossroad_06.nbt +++ b/data/minecraft/structure/village/plains/zombie/streets/crossroad_06.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:09c2dcda95ffbef6f3c3e6a0aa9ff23df9d215ff8de34c894f04123cbbe501ea -size 475 +oid sha256:84ba47f947c6530d4332deb9bff8e9dd7c7f804d9dfc704c12e69c7819b6103b +size 476 diff --git a/data/minecraft/structure/village/plains/zombie/streets/straight_01.nbt b/data/minecraft/structure/village/plains/zombie/streets/straight_01.nbt index cb0636c5..5dd8b84c 100644 --- a/data/minecraft/structure/village/plains/zombie/streets/straight_01.nbt +++ b/data/minecraft/structure/village/plains/zombie/streets/straight_01.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:625d142630fb8928a86bb3fbaae1a87ba857f524091a655b55d5ead66b70a4e3 -size 1135 +oid sha256:c57dbc1fe4e9e8a242aa7a07d384027f2a1f6bf68a2c98821ca95638b3c66a41 +size 1137 diff --git a/data/minecraft/structure/village/plains/zombie/streets/straight_02.nbt b/data/minecraft/structure/village/plains/zombie/streets/straight_02.nbt index 6935ef2d..8ddda641 100644 --- a/data/minecraft/structure/village/plains/zombie/streets/straight_02.nbt +++ b/data/minecraft/structure/village/plains/zombie/streets/straight_02.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:552c55df3d74ffaad75f6f0c3847ad24b363f36fef83e6aff6c366cd2a8b9e30 -size 1088 +oid sha256:8c085bd6dc9bd6e9e2786932e13d8f42cbaa489418d3f2c6f70f253fe4fdd9ed +size 1091 diff --git a/data/minecraft/structure/village/plains/zombie/streets/straight_03.nbt b/data/minecraft/structure/village/plains/zombie/streets/straight_03.nbt index a36ddd9c..42cdf78c 100644 --- a/data/minecraft/structure/village/plains/zombie/streets/straight_03.nbt +++ b/data/minecraft/structure/village/plains/zombie/streets/straight_03.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:dea192d61a829c51abb31605b8dd471a1a60c10f062f47c38ba11d00d1ad83fb -size 780 +oid sha256:677ecb33d46d32e5640d1f21847acae245e3a681279c376f61c4ae6aa76751b2 +size 783 diff --git a/data/minecraft/structure/village/plains/zombie/streets/straight_04.nbt b/data/minecraft/structure/village/plains/zombie/streets/straight_04.nbt index b8c93a9d..b6f016f2 100644 --- a/data/minecraft/structure/village/plains/zombie/streets/straight_04.nbt +++ b/data/minecraft/structure/village/plains/zombie/streets/straight_04.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a36998db00f94b5d3171f31ee60aed5cf8a0519720bf64134e54694c48e98a40 -size 637 +oid sha256:13b0e1555ab079cc31a390ac79107657abfeb69368099d1148b95d748704f769 +size 640 diff --git a/data/minecraft/structure/village/plains/zombie/streets/straight_05.nbt b/data/minecraft/structure/village/plains/zombie/streets/straight_05.nbt index 773b92f3..20c87609 100644 --- a/data/minecraft/structure/village/plains/zombie/streets/straight_05.nbt +++ b/data/minecraft/structure/village/plains/zombie/streets/straight_05.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e3796fc6caafa659fe14ce1570679f189e17d53a4390dd923353c688e20b682a -size 1331 +oid sha256:5529314ebcd18eadfdd83704d2c72113bfdb464e2ce1a487e1e46fcdf951cf48 +size 1334 diff --git a/data/minecraft/structure/village/plains/zombie/streets/straight_06.nbt b/data/minecraft/structure/village/plains/zombie/streets/straight_06.nbt index 74f66633..e0729a92 100644 --- a/data/minecraft/structure/village/plains/zombie/streets/straight_06.nbt +++ b/data/minecraft/structure/village/plains/zombie/streets/straight_06.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2a9b3d3faf1158a2c910568235a71ef0eb579ddacfaad3e7e13e49c3c0a3f92c -size 1706 +oid sha256:b69c7de84434e1affabc39b4ebc96afc65dac6c4e20b0746215c6e616c40cd21 +size 1709 diff --git a/data/minecraft/structure/village/plains/zombie/streets/turn_01.nbt b/data/minecraft/structure/village/plains/zombie/streets/turn_01.nbt index 41fbe36d..9a7d8979 100644 --- a/data/minecraft/structure/village/plains/zombie/streets/turn_01.nbt +++ b/data/minecraft/structure/village/plains/zombie/streets/turn_01.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4bf0b70fbf19ce6c35fa2b0c3434d53c540b2a31fbfc2ab1642d4400292b9d9b -size 792 +oid sha256:37fcb421a006aeffc0ce2d38240d8ea6394e7d7dd2a43fd9ef2f57f6561387a3 +size 795 diff --git a/data/minecraft/structure/village/plains/zombie/town_centers/plains_fountain_01.nbt b/data/minecraft/structure/village/plains/zombie/town_centers/plains_fountain_01.nbt index 8f42931b..87ee3552 100644 --- a/data/minecraft/structure/village/plains/zombie/town_centers/plains_fountain_01.nbt +++ b/data/minecraft/structure/village/plains/zombie/town_centers/plains_fountain_01.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0a31f3c3e7ef035a031d657c63e999a01ab53d768d8ca4d1cbb0deb547449ea2 -size 930 +oid sha256:8366aaff51bb87350bbf9d962d8a16d8329d07d8f8d11b9e055cc3e8a5ac69fe +size 933 diff --git a/data/minecraft/structure/village/plains/zombie/town_centers/plains_meeting_point_1.nbt b/data/minecraft/structure/village/plains/zombie/town_centers/plains_meeting_point_1.nbt index e97ac1f8..7ccf47d0 100644 --- a/data/minecraft/structure/village/plains/zombie/town_centers/plains_meeting_point_1.nbt +++ b/data/minecraft/structure/village/plains/zombie/town_centers/plains_meeting_point_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ca8fb5f86ae60e43344c51746742c295547d96a51af06f4a4c3b6ddf5b375e20 -size 991 +oid sha256:63ae352b6df9e4847c9a4d29f21da3e110fac8eaca31a32384669ec4bfb28378 +size 994 diff --git a/data/minecraft/structure/village/plains/zombie/town_centers/plains_meeting_point_2.nbt b/data/minecraft/structure/village/plains/zombie/town_centers/plains_meeting_point_2.nbt index dc81726a..32985caa 100644 --- a/data/minecraft/structure/village/plains/zombie/town_centers/plains_meeting_point_2.nbt +++ b/data/minecraft/structure/village/plains/zombie/town_centers/plains_meeting_point_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9a28c3ebd3feb47a53dedc7c1a58f3fb796c2a420255c4e0dfe4b324079d67f2 -size 2481 +oid sha256:68cb8404438239a596947503a2d8ebd6e451b229e5dac5b732486647c56f5257 +size 2485 diff --git a/data/minecraft/structure/village/plains/zombie/town_centers/plains_meeting_point_3.nbt b/data/minecraft/structure/village/plains/zombie/town_centers/plains_meeting_point_3.nbt index 4008835f..c00598f7 100644 --- a/data/minecraft/structure/village/plains/zombie/town_centers/plains_meeting_point_3.nbt +++ b/data/minecraft/structure/village/plains/zombie/town_centers/plains_meeting_point_3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:fa7542fb7aca2ca45a62346ff0e50888286cbe8715c99697bef5cd704e165fda -size 1525 +oid sha256:d5af6d20750f6498fa21fd882c7cb5d125c73ad87f84b57f0a9b861fbcf8aa38 +size 1528 diff --git a/data/minecraft/structure/village/plains/zombie/villagers/nitwit.nbt b/data/minecraft/structure/village/plains/zombie/villagers/nitwit.nbt index 13e5a8a8..9d0caabc 100644 --- a/data/minecraft/structure/village/plains/zombie/villagers/nitwit.nbt +++ b/data/minecraft/structure/village/plains/zombie/villagers/nitwit.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:55e7fbe5c353a5342ee634c5b1e9d1fcb9f792a1c5d0625c5f8c0f35288c6e90 -size 754 +oid sha256:4e71cbd6eb143c5735c16bb8b60de1c74839a88c52e77d90ca23bc774b448bfa +size 755 diff --git a/data/minecraft/structure/village/plains/zombie/villagers/unemployed.nbt b/data/minecraft/structure/village/plains/zombie/villagers/unemployed.nbt index 2b1b6915..586926c6 100644 --- a/data/minecraft/structure/village/plains/zombie/villagers/unemployed.nbt +++ b/data/minecraft/structure/village/plains/zombie/villagers/unemployed.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3532b170c4b5a1cd7b72343db92ba8e1290b7cc5478512595ed6c63a7cd08385 +oid sha256:1ea66e508a59b25877f38984724608244cbf18d0c43453d34aef491f8681a522 size 755 diff --git a/data/minecraft/structure/village/savanna/houses/savanna_animal_pen_1.nbt b/data/minecraft/structure/village/savanna/houses/savanna_animal_pen_1.nbt index df6b8dda..3a9491ed 100644 --- a/data/minecraft/structure/village/savanna/houses/savanna_animal_pen_1.nbt +++ b/data/minecraft/structure/village/savanna/houses/savanna_animal_pen_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3d2f0d010ae4983c17d90f2fb0aba22de212422b1a2c39f8e59bd682633fa0f7 -size 1858 +oid sha256:f0ad337a1cb292f975afc81b548c414d4a101fae0bc74149b3f0c450c730e612 +size 1861 diff --git a/data/minecraft/structure/village/savanna/houses/savanna_animal_pen_2.nbt b/data/minecraft/structure/village/savanna/houses/savanna_animal_pen_2.nbt index 401aeadb..d39787e7 100644 --- a/data/minecraft/structure/village/savanna/houses/savanna_animal_pen_2.nbt +++ b/data/minecraft/structure/village/savanna/houses/savanna_animal_pen_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8c2aa65e5ca18a02107a44af3cd17e41ffc20175c5fac2528fb89e9db1b8fa10 -size 3472 +oid sha256:63be1f6923c39e6ccb4d03c501de885241097164f39d4380106784e0d4a810e1 +size 3473 diff --git a/data/minecraft/structure/village/savanna/houses/savanna_animal_pen_3.nbt b/data/minecraft/structure/village/savanna/houses/savanna_animal_pen_3.nbt index 9ed7b99d..8276993c 100644 --- a/data/minecraft/structure/village/savanna/houses/savanna_animal_pen_3.nbt +++ b/data/minecraft/structure/village/savanna/houses/savanna_animal_pen_3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:63093b21fd982493bedd3651e5bd8eba7fb903f9024abc107720b2cd131c3961 -size 1657 +oid sha256:dc2ebe8ef9ced8b5e2a5124ca07eefbf783bfa5afd713c70b50c70c7f38ba97d +size 1660 diff --git a/data/minecraft/structure/village/savanna/houses/savanna_armorer_1.nbt b/data/minecraft/structure/village/savanna/houses/savanna_armorer_1.nbt index bb2d4b7b..b867fce6 100644 --- a/data/minecraft/structure/village/savanna/houses/savanna_armorer_1.nbt +++ b/data/minecraft/structure/village/savanna/houses/savanna_armorer_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:61fa2b36e7a13915fc852a4168218f0d7c73e11762f85729aa7826af67a17b45 -size 1703 +oid sha256:142b25fb1d5a80a1918aea6d2770299a9dcdeee7c4c8d1f8dad0e51332edba3c +size 1706 diff --git a/data/minecraft/structure/village/savanna/houses/savanna_butchers_shop_1.nbt b/data/minecraft/structure/village/savanna/houses/savanna_butchers_shop_1.nbt index 5859ad40..10cf26e6 100644 --- a/data/minecraft/structure/village/savanna/houses/savanna_butchers_shop_1.nbt +++ b/data/minecraft/structure/village/savanna/houses/savanna_butchers_shop_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d7eddcd351cd3a6adf01a6b3829f7a12663ed881ae746244b9ae24fd4ffcebb4 -size 3919 +oid sha256:8cf4b588c66deb0d31bb3c0e2cf3d08811abb2d8def5fc711fd1683f15271224 +size 3922 diff --git a/data/minecraft/structure/village/savanna/houses/savanna_butchers_shop_2.nbt b/data/minecraft/structure/village/savanna/houses/savanna_butchers_shop_2.nbt index 682c0049..26cc3d49 100644 --- a/data/minecraft/structure/village/savanna/houses/savanna_butchers_shop_2.nbt +++ b/data/minecraft/structure/village/savanna/houses/savanna_butchers_shop_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b0aaede7c321116237a37f0d5d3b17558022046ce65751fdc15c2e28e40322af -size 2067 +oid sha256:f52a26d0ff538f130c9a51e95a5c7f0c9567dcf92af7c76f788827627aaa4779 +size 2068 diff --git a/data/minecraft/structure/village/savanna/houses/savanna_cartographer_1.nbt b/data/minecraft/structure/village/savanna/houses/savanna_cartographer_1.nbt index 7b2b1d88..2f1f5160 100644 --- a/data/minecraft/structure/village/savanna/houses/savanna_cartographer_1.nbt +++ b/data/minecraft/structure/village/savanna/houses/savanna_cartographer_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:690f81b132161eaaebd80f6afc983139bbd69f38cd189e33dfc285fac7250b0c -size 2641 +oid sha256:56e60f63661a0d8517006b03ced2f86957a663cddb1d46424b6aa7529b375fd4 +size 2644 diff --git a/data/minecraft/structure/village/savanna/houses/savanna_fisher_cottage_1.nbt b/data/minecraft/structure/village/savanna/houses/savanna_fisher_cottage_1.nbt index 7819df31..f802d6de 100644 --- a/data/minecraft/structure/village/savanna/houses/savanna_fisher_cottage_1.nbt +++ b/data/minecraft/structure/village/savanna/houses/savanna_fisher_cottage_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a930405ce3ecf8dfff7b4a69107560fd7cfc94161a9a7c92ebbbd801df3a56ba -size 3177 +oid sha256:554c15e17438afd491ab92eb516c3d0ff2b86bdc946965dde1fc3c985030fc3c +size 3180 diff --git a/data/minecraft/structure/village/savanna/houses/savanna_fletcher_house_1.nbt b/data/minecraft/structure/village/savanna/houses/savanna_fletcher_house_1.nbt index f9a17bb1..985966d0 100644 --- a/data/minecraft/structure/village/savanna/houses/savanna_fletcher_house_1.nbt +++ b/data/minecraft/structure/village/savanna/houses/savanna_fletcher_house_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:559795e3c30032ba6e0cb5d48123b6edac30d74653eba25c2a60b926ad92b707 -size 3034 +oid sha256:f73251f2b626363c01929ecf659c36b693a331baa6743c781eb9f31f762101a2 +size 3036 diff --git a/data/minecraft/structure/village/savanna/houses/savanna_large_farm_1.nbt b/data/minecraft/structure/village/savanna/houses/savanna_large_farm_1.nbt index cf93132e..64e1e162 100644 --- a/data/minecraft/structure/village/savanna/houses/savanna_large_farm_1.nbt +++ b/data/minecraft/structure/village/savanna/houses/savanna_large_farm_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4760bbcf3acca433aaf8fc967a698f89f7289b31cccdd27e2881cb19950d4f3c -size 1243 +oid sha256:9e28b93ce5df13dd9263ea742d4bcc8bb087186b32b68b07a16b31da8fa3b8c4 +size 1245 diff --git a/data/minecraft/structure/village/savanna/houses/savanna_large_farm_2.nbt b/data/minecraft/structure/village/savanna/houses/savanna_large_farm_2.nbt index 2b4261ec..f5d58fdd 100644 --- a/data/minecraft/structure/village/savanna/houses/savanna_large_farm_2.nbt +++ b/data/minecraft/structure/village/savanna/houses/savanna_large_farm_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c763b3299052af62b7dba24617d7c603b834285362cbe3f0bf99344392eff3d1 -size 2150 +oid sha256:7a2e980c6f1f449d1934c46541914dfba841312fc2df8ba93abf4bf1aeed0aaa +size 2153 diff --git a/data/minecraft/structure/village/savanna/houses/savanna_library_1.nbt b/data/minecraft/structure/village/savanna/houses/savanna_library_1.nbt index 90f0944e..522a8fba 100644 --- a/data/minecraft/structure/village/savanna/houses/savanna_library_1.nbt +++ b/data/minecraft/structure/village/savanna/houses/savanna_library_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1409ea4862ea6f65fb2b4bb1d44f13adc3546f8cfd431abc17dc5d99846333f1 -size 2769 +oid sha256:d9bb502d0bf2e1dad7b36c48beba418a5ce7001af770afc143f403a3c9bde460 +size 2770 diff --git a/data/minecraft/structure/village/savanna/houses/savanna_mason_1.nbt b/data/minecraft/structure/village/savanna/houses/savanna_mason_1.nbt index 5df0bd06..d514f4a4 100644 --- a/data/minecraft/structure/village/savanna/houses/savanna_mason_1.nbt +++ b/data/minecraft/structure/village/savanna/houses/savanna_mason_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3f371bff374f843a294994f1aa11bc5cc2616e20b4886fca9971ead306b3ef89 -size 2517 +oid sha256:6945fd3b4d8d9af59ef58dfae72fbbd012a5ed8cf32ed1e0f130cbd12b9bca9e +size 2520 diff --git a/data/minecraft/structure/village/savanna/houses/savanna_medium_house_1.nbt b/data/minecraft/structure/village/savanna/houses/savanna_medium_house_1.nbt index 4a32b710..bae2e521 100644 --- a/data/minecraft/structure/village/savanna/houses/savanna_medium_house_1.nbt +++ b/data/minecraft/structure/village/savanna/houses/savanna_medium_house_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e9c1f1d5ad80f09819cd1c92d499c155cccedcacca54261465a315d6d29310fd -size 3639 +oid sha256:462d22ab8568d0c76fefe3ff3c18fb4a3d9eb682e08c48978e9000068e256387 +size 3642 diff --git a/data/minecraft/structure/village/savanna/houses/savanna_medium_house_2.nbt b/data/minecraft/structure/village/savanna/houses/savanna_medium_house_2.nbt index d334d856..9714985b 100644 --- a/data/minecraft/structure/village/savanna/houses/savanna_medium_house_2.nbt +++ b/data/minecraft/structure/village/savanna/houses/savanna_medium_house_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:de3fb164fd81cc242e2453661a91a40a7e42335006dfad671a3cfab22e8cfcdf -size 1857 +oid sha256:68bd758666579dcdfc8a7f80fce219f04993c7db2c7a474f2006893756d153b2 +size 1859 diff --git a/data/minecraft/structure/village/savanna/houses/savanna_shepherd_1.nbt b/data/minecraft/structure/village/savanna/houses/savanna_shepherd_1.nbt index cd3215cd..1e95415d 100644 --- a/data/minecraft/structure/village/savanna/houses/savanna_shepherd_1.nbt +++ b/data/minecraft/structure/village/savanna/houses/savanna_shepherd_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d0e2b00f5161310b7763bffce1a3a17f772458cfeca589be36f61714f02c7349 -size 6324 +oid sha256:334ef13bafd270fd5d325b94fad1d21c1e0498356cc706504deb0c99f19224d4 +size 6327 diff --git a/data/minecraft/structure/village/savanna/houses/savanna_small_farm.nbt b/data/minecraft/structure/village/savanna/houses/savanna_small_farm.nbt index d1376f58..5458722a 100644 --- a/data/minecraft/structure/village/savanna/houses/savanna_small_farm.nbt +++ b/data/minecraft/structure/village/savanna/houses/savanna_small_farm.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:da37095b70942f7db6a8829101e1410d5c8c6bdb27ef98ae863a346312a94a76 -size 1136 +oid sha256:6d09251a855daaf1c101e24dac3b9241e6c27259290388a3eeb8423c7b4d5c6c +size 1138 diff --git a/data/minecraft/structure/village/savanna/houses/savanna_small_house_1.nbt b/data/minecraft/structure/village/savanna/houses/savanna_small_house_1.nbt index 7cc59325..5091197b 100644 --- a/data/minecraft/structure/village/savanna/houses/savanna_small_house_1.nbt +++ b/data/minecraft/structure/village/savanna/houses/savanna_small_house_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:fa9bfa22af1c69af254368a70a3f6391f2a3d7452f6a56378a020a2e60f5886e -size 1848 +oid sha256:e10811f4639e517807867bf5428bbf4372c802a11a97d40e583b16a92084abbc +size 1851 diff --git a/data/minecraft/structure/village/savanna/houses/savanna_small_house_2.nbt b/data/minecraft/structure/village/savanna/houses/savanna_small_house_2.nbt index 4fa3cf04..a24ce10d 100644 --- a/data/minecraft/structure/village/savanna/houses/savanna_small_house_2.nbt +++ b/data/minecraft/structure/village/savanna/houses/savanna_small_house_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0a23f16598e03f6848fe8a8429fc536c911a17d718942421c1f2d62d50cb7956 -size 1857 +oid sha256:3ee7b778572184b989476fa0394ffbfae05d96c423bc97db5ef69ddfd6c6c518 +size 1860 diff --git a/data/minecraft/structure/village/savanna/houses/savanna_small_house_3.nbt b/data/minecraft/structure/village/savanna/houses/savanna_small_house_3.nbt index 89445621..706441a5 100644 --- a/data/minecraft/structure/village/savanna/houses/savanna_small_house_3.nbt +++ b/data/minecraft/structure/village/savanna/houses/savanna_small_house_3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c9fbb52869428841b71689d7ab5ecc87b77b79dfd1217481d3a4eed3d3d6f993 -size 1810 +oid sha256:611c9ba94295e1e34053bfae7392797c14a26f673fae3e439fc2fa407bfba936 +size 1812 diff --git a/data/minecraft/structure/village/savanna/houses/savanna_small_house_4.nbt b/data/minecraft/structure/village/savanna/houses/savanna_small_house_4.nbt index cacc98a5..40bfde83 100644 --- a/data/minecraft/structure/village/savanna/houses/savanna_small_house_4.nbt +++ b/data/minecraft/structure/village/savanna/houses/savanna_small_house_4.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9a143e0fd1cac1bef2f969c7198f83acf076becd59a1567a2c08f3a16a1db43b -size 2703 +oid sha256:77e722219280294336a208bcfeef8d531220eb874c143082993f4cf0b57ed98b +size 2707 diff --git a/data/minecraft/structure/village/savanna/houses/savanna_small_house_5.nbt b/data/minecraft/structure/village/savanna/houses/savanna_small_house_5.nbt index 40103ef1..23219fd3 100644 --- a/data/minecraft/structure/village/savanna/houses/savanna_small_house_5.nbt +++ b/data/minecraft/structure/village/savanna/houses/savanna_small_house_5.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c8760c9799e2a9b374e6c435ce715fb300a532d2999e6635bb824fd20bfba6d6 -size 2372 +oid sha256:b804264189bb88f5de7ef4d3da6880d32616b114f02b342d1420601635f96cf6 +size 2374 diff --git a/data/minecraft/structure/village/savanna/houses/savanna_small_house_6.nbt b/data/minecraft/structure/village/savanna/houses/savanna_small_house_6.nbt index 3012dec5..e9121ab1 100644 --- a/data/minecraft/structure/village/savanna/houses/savanna_small_house_6.nbt +++ b/data/minecraft/structure/village/savanna/houses/savanna_small_house_6.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ecd79c53544caaed1f4173e39294d827f2599a8e4412f962f3a815baf64546e8 -size 1784 +oid sha256:5a39655cda8edf9ad699f69ff808e8e7a791563248be141744efdb5a2419fac5 +size 1786 diff --git a/data/minecraft/structure/village/savanna/houses/savanna_small_house_7.nbt b/data/minecraft/structure/village/savanna/houses/savanna_small_house_7.nbt index 444d50a4..751aa8bb 100644 --- a/data/minecraft/structure/village/savanna/houses/savanna_small_house_7.nbt +++ b/data/minecraft/structure/village/savanna/houses/savanna_small_house_7.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:70017d19f897c7373fd3e452d6e098013f445238132b3ea6b72cbb6f33e57fe9 -size 1880 +oid sha256:2590505da90431cedf361bf2abf894a5fc054ede666a45cb80e27522539af466 +size 1883 diff --git a/data/minecraft/structure/village/savanna/houses/savanna_small_house_8.nbt b/data/minecraft/structure/village/savanna/houses/savanna_small_house_8.nbt index ebfa0ebd..964ce2cd 100644 --- a/data/minecraft/structure/village/savanna/houses/savanna_small_house_8.nbt +++ b/data/minecraft/structure/village/savanna/houses/savanna_small_house_8.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:cf1931be785070c453fef803c9b5e7f457e33747e1ff220a67335e17b7459560 -size 1544 +oid sha256:926afbc3fc8fc907a690e146a152c2be6fd7dfc192dcb47f0c04b3d9ab3287f4 +size 1546 diff --git a/data/minecraft/structure/village/savanna/houses/savanna_tannery_1.nbt b/data/minecraft/structure/village/savanna/houses/savanna_tannery_1.nbt index f0058315..7fc543ca 100644 --- a/data/minecraft/structure/village/savanna/houses/savanna_tannery_1.nbt +++ b/data/minecraft/structure/village/savanna/houses/savanna_tannery_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2a493d3e5a7939e009982cf85acf557bfe7a911c01da613ca62d8de1dc13d885 -size 2129 +oid sha256:b0141c393963a6d72a59c2ab4a7521eef007d4ab71a9943a739af5f259ca7b5e +size 2132 diff --git a/data/minecraft/structure/village/savanna/houses/savanna_temple_1.nbt b/data/minecraft/structure/village/savanna/houses/savanna_temple_1.nbt index 16e90617..7f3d6211 100644 --- a/data/minecraft/structure/village/savanna/houses/savanna_temple_1.nbt +++ b/data/minecraft/structure/village/savanna/houses/savanna_temple_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:78b164cbdcd1aca715abbf923581e904c3cf57107e52dfbf420e2b041536ae0f -size 3627 +oid sha256:57ad05a36946686ca39f483fd014307c7cf6b89dff12851cfcb24ead349d0495 +size 3629 diff --git a/data/minecraft/structure/village/savanna/houses/savanna_temple_2.nbt b/data/minecraft/structure/village/savanna/houses/savanna_temple_2.nbt index 7c07b8bb..bea02215 100644 --- a/data/minecraft/structure/village/savanna/houses/savanna_temple_2.nbt +++ b/data/minecraft/structure/village/savanna/houses/savanna_temple_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f0ddf8c5eb56206a2e03fb4582243e33b1781957b90970bb6fb67b73eaf4d5a3 -size 2023 +oid sha256:5b51ac7fb049fabf822f49c3f196d7a7c4a05ee4fd92717d703645df5f4205e9 +size 2026 diff --git a/data/minecraft/structure/village/savanna/houses/savanna_tool_smith_1.nbt b/data/minecraft/structure/village/savanna/houses/savanna_tool_smith_1.nbt index 9955b505..bc5875bb 100644 --- a/data/minecraft/structure/village/savanna/houses/savanna_tool_smith_1.nbt +++ b/data/minecraft/structure/village/savanna/houses/savanna_tool_smith_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0d99376a0dfaa4b4e5a3501b712ad2e8f752ec3c0998717182129c8e8c6eeb22 -size 2460 +oid sha256:ea94b23e42cd25f00beb179d05c6364da429953883980c836e5e51548d380d2f +size 2461 diff --git a/data/minecraft/structure/village/savanna/houses/savanna_weaponsmith_1.nbt b/data/minecraft/structure/village/savanna/houses/savanna_weaponsmith_1.nbt index ad31886a..172e5dc1 100644 --- a/data/minecraft/structure/village/savanna/houses/savanna_weaponsmith_1.nbt +++ b/data/minecraft/structure/village/savanna/houses/savanna_weaponsmith_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ce9813383b957de4afb29cc8b39e670c8d1d874da38a44305b5e818552ea457a -size 2077 +oid sha256:ef4253e2827c07321ca8ae1195e5866226abffaa728982434e1b067770747546 +size 2079 diff --git a/data/minecraft/structure/village/savanna/houses/savanna_weaponsmith_2.nbt b/data/minecraft/structure/village/savanna/houses/savanna_weaponsmith_2.nbt index 797e59d7..6b9fc6a2 100644 --- a/data/minecraft/structure/village/savanna/houses/savanna_weaponsmith_2.nbt +++ b/data/minecraft/structure/village/savanna/houses/savanna_weaponsmith_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d5ed721c6a47a31dee943947f1b7fc0382114d94f855df81b6220fd886c66452 -size 2196 +oid sha256:1d5cde489b76d55151b86855d45895f1c692be335abd23c865c4e5e5f71d1451 +size 2199 diff --git a/data/minecraft/structure/village/savanna/savanna_lamp_post_01.nbt b/data/minecraft/structure/village/savanna/savanna_lamp_post_01.nbt index 0a30d7c9..82d58439 100644 --- a/data/minecraft/structure/village/savanna/savanna_lamp_post_01.nbt +++ b/data/minecraft/structure/village/savanna/savanna_lamp_post_01.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:13ed37abb3ec86ccbcbbae00ddd7c894f2e9182e62b1eb3618c83a810d6721f8 -size 281 +oid sha256:706f09f338ec1f9ef91026816ae6236c1ac1ed5906fb87297bf151feceda71a0 +size 284 diff --git a/data/minecraft/structure/village/savanna/streets/corner_01.nbt b/data/minecraft/structure/village/savanna/streets/corner_01.nbt index c90f5c08..648d8794 100644 --- a/data/minecraft/structure/village/savanna/streets/corner_01.nbt +++ b/data/minecraft/structure/village/savanna/streets/corner_01.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9a4035ee8d43c4319b7e7ed9c95c4030c5114ac38bb32dca6191deadce99f71d -size 1196 +oid sha256:78e1e188bc4c82933920ca9077836fb90df808ef574749138a27ba6b91a99777 +size 1198 diff --git a/data/minecraft/structure/village/savanna/streets/corner_03.nbt b/data/minecraft/structure/village/savanna/streets/corner_03.nbt index d1f8afd2..d1495bcb 100644 --- a/data/minecraft/structure/village/savanna/streets/corner_03.nbt +++ b/data/minecraft/structure/village/savanna/streets/corner_03.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3b70f0c55fb538fdebeb83a35fc6a3c782eb4891d9481229e64b241a9e0aead2 -size 349 +oid sha256:3ac7ca47515fd51e9ebf9291d3129dee00b87813f072653949a7d7f2b569f8af +size 352 diff --git a/data/minecraft/structure/village/savanna/streets/crossroad_02.nbt b/data/minecraft/structure/village/savanna/streets/crossroad_02.nbt index e8d01cde..aeaac5d5 100644 --- a/data/minecraft/structure/village/savanna/streets/crossroad_02.nbt +++ b/data/minecraft/structure/village/savanna/streets/crossroad_02.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:630ad9731b7fce44cb449657a2ba76a25ed660683a1b36679a9538f03633fb74 -size 625 +oid sha256:c24c679c48af59f629d3a1d2b23baf129af73bb0206404ef910ddba594e18e39 +size 628 diff --git a/data/minecraft/structure/village/savanna/streets/crossroad_03.nbt b/data/minecraft/structure/village/savanna/streets/crossroad_03.nbt index 4c7f2bee..7b2ba786 100644 --- a/data/minecraft/structure/village/savanna/streets/crossroad_03.nbt +++ b/data/minecraft/structure/village/savanna/streets/crossroad_03.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ad580c3a432b06a5926267b9bfffe2155ee69f0e6ec9f938a0c1335f246bb91f -size 1224 +oid sha256:6f7c599b8602cdc7a78efae9a031fc43f6e9f246b5dfb3ec9e247185b007db65 +size 1227 diff --git a/data/minecraft/structure/village/savanna/streets/crossroad_04.nbt b/data/minecraft/structure/village/savanna/streets/crossroad_04.nbt index e5690fbe..9b991301 100644 --- a/data/minecraft/structure/village/savanna/streets/crossroad_04.nbt +++ b/data/minecraft/structure/village/savanna/streets/crossroad_04.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9607fa7b76602f7d3e39cf97a1d977b28b940c13a5c43c295183e4e1ac06eeff -size 378 +oid sha256:b9f2347f4aee6ddc4e8c29ebae841e6b0679640061128b14ca1f435fc17e913d +size 380 diff --git a/data/minecraft/structure/village/savanna/streets/crossroad_05.nbt b/data/minecraft/structure/village/savanna/streets/crossroad_05.nbt index c6f02a01..844cd31c 100644 --- a/data/minecraft/structure/village/savanna/streets/crossroad_05.nbt +++ b/data/minecraft/structure/village/savanna/streets/crossroad_05.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:68afa8583498ff9d5ced1627d4fab59e7705ecff3a1bb455d10f19b17cd0749a -size 409 +oid sha256:62fa4d1a1a6e8cdf5722b19483603804f028d1cb2be7d8f9348f169a4153c91a +size 411 diff --git a/data/minecraft/structure/village/savanna/streets/crossroad_06.nbt b/data/minecraft/structure/village/savanna/streets/crossroad_06.nbt index b57c696e..9157bdcf 100644 --- a/data/minecraft/structure/village/savanna/streets/crossroad_06.nbt +++ b/data/minecraft/structure/village/savanna/streets/crossroad_06.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:65ba0dbc1eee935a803c856a660d4e778a53c9a5a6e6f25e8e501e3282c4e129 -size 466 +oid sha256:ea123af2e9f8c8ce8d8937b74bc4f9b92247df4d3d49394c58fa5ae1cb1af221 +size 468 diff --git a/data/minecraft/structure/village/savanna/streets/crossroad_07.nbt b/data/minecraft/structure/village/savanna/streets/crossroad_07.nbt index 9e113f84..d54dcf06 100644 --- a/data/minecraft/structure/village/savanna/streets/crossroad_07.nbt +++ b/data/minecraft/structure/village/savanna/streets/crossroad_07.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c07e05dfc534a16ee5a971b014cd442a5eda2c91c566ed5c495c7ee83e25ff54 -size 1379 +oid sha256:9c2e2ceb32f708b6e903017ebc7ed5888888a41f78cc90c7f5980f8ab558974c +size 1382 diff --git a/data/minecraft/structure/village/savanna/streets/split_01.nbt b/data/minecraft/structure/village/savanna/streets/split_01.nbt index 8d334dda..ab9d32e1 100644 --- a/data/minecraft/structure/village/savanna/streets/split_01.nbt +++ b/data/minecraft/structure/village/savanna/streets/split_01.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:af8d49ec5d1d7ab4370f0ab5a7ff13c1ab68ebef15feee6c3ae41e5cec3c66a1 -size 523 +oid sha256:1a8b5571e4a5cace831049f78ae0312e2aa6a7ac4ae456cd846b25dfcdba42e0 +size 525 diff --git a/data/minecraft/structure/village/savanna/streets/split_02.nbt b/data/minecraft/structure/village/savanna/streets/split_02.nbt index c602d0dd..82e93ddd 100644 --- a/data/minecraft/structure/village/savanna/streets/split_02.nbt +++ b/data/minecraft/structure/village/savanna/streets/split_02.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:69d7ba02e5fa3445d13b285fe8efb84de99aec460e2adeb5148d26940cd1bda6 -size 734 +oid sha256:55569b25b03845d31fb282eca47b560c0e5d72096649d06936e49f9ede9d3a76 +size 737 diff --git a/data/minecraft/structure/village/savanna/streets/straight_02.nbt b/data/minecraft/structure/village/savanna/streets/straight_02.nbt index a4e4c672..09610aee 100644 --- a/data/minecraft/structure/village/savanna/streets/straight_02.nbt +++ b/data/minecraft/structure/village/savanna/streets/straight_02.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a9d9ec5c625975f77d6f7dbac1a0742ecc860a47cb4142a281edf53c9db4c7cb -size 1122 +oid sha256:5cc2461c85a73aa219eb3866f2947bcef4b98fa60575559d2932978e4d148955 +size 1125 diff --git a/data/minecraft/structure/village/savanna/streets/straight_04.nbt b/data/minecraft/structure/village/savanna/streets/straight_04.nbt index ef005c2b..db91d745 100644 --- a/data/minecraft/structure/village/savanna/streets/straight_04.nbt +++ b/data/minecraft/structure/village/savanna/streets/straight_04.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a68a7a4d301442ed6111b80c3c0f4845667985c30196291ea81be4c1bdd0cc1b -size 639 +oid sha256:97c138b267b293b5a3d3b0737399f6f1ec1514f8b00e7def0c91dd21cc98f1f6 +size 641 diff --git a/data/minecraft/structure/village/savanna/streets/straight_05.nbt b/data/minecraft/structure/village/savanna/streets/straight_05.nbt index 1d40b84d..453c86ad 100644 --- a/data/minecraft/structure/village/savanna/streets/straight_05.nbt +++ b/data/minecraft/structure/village/savanna/streets/straight_05.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:409602f2139fd160f8a0bf4108a6fc1314c2bd64097648830381e48d54e74eb3 -size 1928 +oid sha256:52a33200929a76035d5e3a2ffb140b829826bbde2c890c15cfd6a14f7e8c184b +size 1931 diff --git a/data/minecraft/structure/village/savanna/streets/straight_06.nbt b/data/minecraft/structure/village/savanna/streets/straight_06.nbt index 4284f7fa..da1b833d 100644 --- a/data/minecraft/structure/village/savanna/streets/straight_06.nbt +++ b/data/minecraft/structure/village/savanna/streets/straight_06.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:27897c533de7afe9ae241b40a3614f43f3111bbbbfb4e944f9beeae97c499658 -size 1086 +oid sha256:6afa6eb4989b7c94d50921204836b113333f9b928eec08ac2a9c4febb70418d7 +size 1088 diff --git a/data/minecraft/structure/village/savanna/streets/straight_08.nbt b/data/minecraft/structure/village/savanna/streets/straight_08.nbt index 9f884a46..260dac61 100644 --- a/data/minecraft/structure/village/savanna/streets/straight_08.nbt +++ b/data/minecraft/structure/village/savanna/streets/straight_08.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1a76ff1d05d252af86fa0b34fa6d9efa4c458ab6bedb63cceb767eaa9f41fd66 -size 937 +oid sha256:d1090098ae8d6b2ee25f6454bc69a66e846e4c034a89f3c83cc5a826627000dd +size 940 diff --git a/data/minecraft/structure/village/savanna/streets/straight_09.nbt b/data/minecraft/structure/village/savanna/streets/straight_09.nbt index 2d0891d4..82aab733 100644 --- a/data/minecraft/structure/village/savanna/streets/straight_09.nbt +++ b/data/minecraft/structure/village/savanna/streets/straight_09.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e3f80cedbcb969f285c41d01011ec91517404063c9ebf044f7d50929bec4a413 -size 1520 +oid sha256:7c2b849c1251812eb01705e7b922ae0c3b09217513c60d4621431ee71a68fda3 +size 1523 diff --git a/data/minecraft/structure/village/savanna/streets/straight_10.nbt b/data/minecraft/structure/village/savanna/streets/straight_10.nbt index abb3e1d3..d1ae6003 100644 --- a/data/minecraft/structure/village/savanna/streets/straight_10.nbt +++ b/data/minecraft/structure/village/savanna/streets/straight_10.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:545a53dc55ff0ac968a5d1759b3c250e8a724903101ac77a36952bdc69e4da99 -size 521 +oid sha256:541474ae86ef535febc67b0ac7ac85eb4006655499776ac63c54da0ab6c4c8de +size 524 diff --git a/data/minecraft/structure/village/savanna/streets/straight_11.nbt b/data/minecraft/structure/village/savanna/streets/straight_11.nbt index 997b3c01..82292c19 100644 --- a/data/minecraft/structure/village/savanna/streets/straight_11.nbt +++ b/data/minecraft/structure/village/savanna/streets/straight_11.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5393750239f17cc56bbafddcfcd814659d6eee29190fbbde97bf18c023e890bd -size 1559 +oid sha256:175d421f7b74289c37343db9bcd285cc85446288c704f9cc021960eb40b1f662 +size 1561 diff --git a/data/minecraft/structure/village/savanna/streets/turn_01.nbt b/data/minecraft/structure/village/savanna/streets/turn_01.nbt index 7a06b667..7b09208c 100644 --- a/data/minecraft/structure/village/savanna/streets/turn_01.nbt +++ b/data/minecraft/structure/village/savanna/streets/turn_01.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:709131c11803910a6e166507a6607d90dd91d2f4005fb5af032714f77eb23779 -size 1156 +oid sha256:3ce1e5e4087c180952a7f2df92cd57736d58493fef8b992d9693bb792942d233 +size 1159 diff --git a/data/minecraft/structure/village/savanna/terminators/terminator_05.nbt b/data/minecraft/structure/village/savanna/terminators/terminator_05.nbt index bdfe7cd3..aedc5069 100644 --- a/data/minecraft/structure/village/savanna/terminators/terminator_05.nbt +++ b/data/minecraft/structure/village/savanna/terminators/terminator_05.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8bcf39a1a43782ee5f688d26240a325dad37f6002f3eac2c00b0dfef63880cfb -size 1188 +oid sha256:28e406f0da73ae76f9e92c2692e7801bfadbb3728627882ecf64bdc76e99539c +size 1191 diff --git a/data/minecraft/structure/village/savanna/town_centers/savanna_meeting_point_1.nbt b/data/minecraft/structure/village/savanna/town_centers/savanna_meeting_point_1.nbt index 715ac7c7..6c5ea384 100644 --- a/data/minecraft/structure/village/savanna/town_centers/savanna_meeting_point_1.nbt +++ b/data/minecraft/structure/village/savanna/town_centers/savanna_meeting_point_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:38fe378a87da4cdd16ae5eeea6d78879467cfff1b70e7d091f8219faca7434a2 -size 3284 +oid sha256:6164c4390471727f0a3368691fc67d02bb167399da9b529aa8e3fd858012038b +size 3287 diff --git a/data/minecraft/structure/village/savanna/town_centers/savanna_meeting_point_2.nbt b/data/minecraft/structure/village/savanna/town_centers/savanna_meeting_point_2.nbt index 6725add3..d948c838 100644 --- a/data/minecraft/structure/village/savanna/town_centers/savanna_meeting_point_2.nbt +++ b/data/minecraft/structure/village/savanna/town_centers/savanna_meeting_point_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0b0c489527f4ed57887a26d184aee19c85f23f7bb489aeda20718ac3dfc4d637 -size 1116 +oid sha256:a262e1373286b070bc45ae2e426986949dbfabb62d21184265ea94eacd35d7f6 +size 1119 diff --git a/data/minecraft/structure/village/savanna/town_centers/savanna_meeting_point_3.nbt b/data/minecraft/structure/village/savanna/town_centers/savanna_meeting_point_3.nbt index f7794fb4..ec1d63bc 100644 --- a/data/minecraft/structure/village/savanna/town_centers/savanna_meeting_point_3.nbt +++ b/data/minecraft/structure/village/savanna/town_centers/savanna_meeting_point_3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2517e025f607fcee60868a9df1e64f08bef518c4816aefdd139256c4bba9cf19 -size 979 +oid sha256:d233742739c65db2784b5bf3e4139c767f0e810961f232df8c3e734aa11da1bf +size 981 diff --git a/data/minecraft/structure/village/savanna/town_centers/savanna_meeting_point_4.nbt b/data/minecraft/structure/village/savanna/town_centers/savanna_meeting_point_4.nbt index 37f6e6d2..94eb7806 100644 --- a/data/minecraft/structure/village/savanna/town_centers/savanna_meeting_point_4.nbt +++ b/data/minecraft/structure/village/savanna/town_centers/savanna_meeting_point_4.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:412b044abe04f46c5241a1988d405780fad873266f2a732197ae5c8ef9177e63 -size 1184 +oid sha256:345d89699572b6814a4c96321c3d1e9cdbe933edda6b330b2311ab6ad3322933 +size 1187 diff --git a/data/minecraft/structure/village/savanna/villagers/baby.nbt b/data/minecraft/structure/village/savanna/villagers/baby.nbt index a8a269a5..12ff3848 100644 --- a/data/minecraft/structure/village/savanna/villagers/baby.nbt +++ b/data/minecraft/structure/village/savanna/villagers/baby.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:41261f51b67496056ff978b01bdb2f36cfd8dcbb58351c98549440f343089015 +oid sha256:9825050ac92a7464a8cba7bf3e4d60fe5e9b9c5a33e5c053cf2c765b4ff281a4 size 752 diff --git a/data/minecraft/structure/village/savanna/villagers/nitwit.nbt b/data/minecraft/structure/village/savanna/villagers/nitwit.nbt index 407c647c..818b52fa 100644 --- a/data/minecraft/structure/village/savanna/villagers/nitwit.nbt +++ b/data/minecraft/structure/village/savanna/villagers/nitwit.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:bff45d66b72e2f85144748394ef2fb2e5f7867865073c2f77fc9ac08ec267824 -size 752 +oid sha256:a94e63aaf97cb039108e90edf58a84c26427708895816f2be1e686949ec9193d +size 751 diff --git a/data/minecraft/structure/village/savanna/villagers/unemployed.nbt b/data/minecraft/structure/village/savanna/villagers/unemployed.nbt index 9efe9b1e..ddf7b90b 100644 --- a/data/minecraft/structure/village/savanna/villagers/unemployed.nbt +++ b/data/minecraft/structure/village/savanna/villagers/unemployed.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c91d2b38fd1c0a3d927247fa3a407a01b51d62cd637277d2c31ea66355a5b9a3 +oid sha256:6da3825c339c8f76748c16873d3b145dd171f10b168ee41728b32a85ced981ba size 750 diff --git a/data/minecraft/structure/village/savanna/zombie/houses/savanna_animal_pen_2.nbt b/data/minecraft/structure/village/savanna/zombie/houses/savanna_animal_pen_2.nbt index 2157d396..5cd839d8 100644 --- a/data/minecraft/structure/village/savanna/zombie/houses/savanna_animal_pen_2.nbt +++ b/data/minecraft/structure/village/savanna/zombie/houses/savanna_animal_pen_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e7bbd45cd738bb9299010991b6133cfddce4406821e91f7b5dfb05312baa6af7 -size 3480 +oid sha256:bbf7cec33e85d6fc3b3353b785b30c072dde4bb996eb196504762f31aee192a3 +size 3481 diff --git a/data/minecraft/structure/village/savanna/zombie/houses/savanna_animal_pen_3.nbt b/data/minecraft/structure/village/savanna/zombie/houses/savanna_animal_pen_3.nbt index 61b7c24a..fe1d0760 100644 --- a/data/minecraft/structure/village/savanna/zombie/houses/savanna_animal_pen_3.nbt +++ b/data/minecraft/structure/village/savanna/zombie/houses/savanna_animal_pen_3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:93b6e650fd25c70ae118e00b304e3fe29780f18b5eea7d2494def540c6a8fbad -size 1664 +oid sha256:0adce5cb570bb68ebcdb4eb2747281c014a5504dd6d81f79de94b89b0dadb849 +size 1666 diff --git a/data/minecraft/structure/village/savanna/zombie/houses/savanna_large_farm_2.nbt b/data/minecraft/structure/village/savanna/zombie/houses/savanna_large_farm_2.nbt index b040955c..bfa9f49b 100644 --- a/data/minecraft/structure/village/savanna/zombie/houses/savanna_large_farm_2.nbt +++ b/data/minecraft/structure/village/savanna/zombie/houses/savanna_large_farm_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:89091e3cb9aab6c21f2b691ab1438038bdc348e8874393aef773008551c29d92 -size 2159 +oid sha256:c758c887bf0f8e48b76c6ebceab9331c58f0a5599e866d34c05d9660cda9a6b0 +size 2162 diff --git a/data/minecraft/structure/village/savanna/zombie/houses/savanna_medium_house_1.nbt b/data/minecraft/structure/village/savanna/zombie/houses/savanna_medium_house_1.nbt index 95d23943..a9c02460 100644 --- a/data/minecraft/structure/village/savanna/zombie/houses/savanna_medium_house_1.nbt +++ b/data/minecraft/structure/village/savanna/zombie/houses/savanna_medium_house_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:da7bec517aa1b2173cac6852de11de65c89400e0e409d14f61fec98cbac9a166 -size 3642 +oid sha256:f511e47931adcae254a418a13b53925ebfd260158093d8b3de379f17d5b65ccd +size 3645 diff --git a/data/minecraft/structure/village/savanna/zombie/houses/savanna_medium_house_2.nbt b/data/minecraft/structure/village/savanna/zombie/houses/savanna_medium_house_2.nbt index 5d8cb1bb..da69a401 100644 --- a/data/minecraft/structure/village/savanna/zombie/houses/savanna_medium_house_2.nbt +++ b/data/minecraft/structure/village/savanna/zombie/houses/savanna_medium_house_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e463424ada656a71c7321fd6ab3b7251387bf35e59b52c75faf544b775683b49 -size 1864 +oid sha256:98494c035c348eb4d114d4e6b6567b10e2609007c599dbf7087102f7ad35490c +size 1866 diff --git a/data/minecraft/structure/village/savanna/zombie/houses/savanna_small_house_1.nbt b/data/minecraft/structure/village/savanna/zombie/houses/savanna_small_house_1.nbt index a89945bd..f9fb58ea 100644 --- a/data/minecraft/structure/village/savanna/zombie/houses/savanna_small_house_1.nbt +++ b/data/minecraft/structure/village/savanna/zombie/houses/savanna_small_house_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a7428ed3cfa0c95826bb98bd9371855d27d6b746eb4a0a306278ff7b3d35e07f -size 1877 +oid sha256:814b61e5ff11a1e42073fecf422eab68f2ec9a2f8fe00e534cfdaa6c26db094e +size 1880 diff --git a/data/minecraft/structure/village/savanna/zombie/houses/savanna_small_house_2.nbt b/data/minecraft/structure/village/savanna/zombie/houses/savanna_small_house_2.nbt index 63f2c7f1..66bb97ad 100644 --- a/data/minecraft/structure/village/savanna/zombie/houses/savanna_small_house_2.nbt +++ b/data/minecraft/structure/village/savanna/zombie/houses/savanna_small_house_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4033571908a20b9a198546c39b1e122f8fef1455022231904a4f2cc4fffad3b7 -size 1874 +oid sha256:a41ad602a66f7e5ec0fb79cf613d1398f9101fb5d814cf641e62dfe47eaec93d +size 1877 diff --git a/data/minecraft/structure/village/savanna/zombie/houses/savanna_small_house_3.nbt b/data/minecraft/structure/village/savanna/zombie/houses/savanna_small_house_3.nbt index 8462858d..66cf76ff 100644 --- a/data/minecraft/structure/village/savanna/zombie/houses/savanna_small_house_3.nbt +++ b/data/minecraft/structure/village/savanna/zombie/houses/savanna_small_house_3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:fa497155bd6eeaf04d4e540817522fcbd6b59a590b052e2fd32f4710350166b2 -size 1827 +oid sha256:1b7a842475f7d10e52a192ba4ba12ec4e2c3f0fe55945ee63404b695eb144927 +size 1829 diff --git a/data/minecraft/structure/village/savanna/zombie/houses/savanna_small_house_4.nbt b/data/minecraft/structure/village/savanna/zombie/houses/savanna_small_house_4.nbt index 12c29ea6..0a8da6e4 100644 --- a/data/minecraft/structure/village/savanna/zombie/houses/savanna_small_house_4.nbt +++ b/data/minecraft/structure/village/savanna/zombie/houses/savanna_small_house_4.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:56e9fb3509da96c94e940430118a26d90a8c8995f28f24e82597ffb36629de0f -size 2706 +oid sha256:925733470cf77d10ac48fee3079fc5078ee160bdb98c00ff5f5c35c93c2176a9 +size 2710 diff --git a/data/minecraft/structure/village/savanna/zombie/houses/savanna_small_house_5.nbt b/data/minecraft/structure/village/savanna/zombie/houses/savanna_small_house_5.nbt index d5a1ff91..59cd4304 100644 --- a/data/minecraft/structure/village/savanna/zombie/houses/savanna_small_house_5.nbt +++ b/data/minecraft/structure/village/savanna/zombie/houses/savanna_small_house_5.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e62fbc62fd2c09d47c90718bb3cbd666e9e97272df8ee57d52b2e18c3340d812 -size 2392 +oid sha256:9d0648364639516f167d62ca35da85b873c25d0832021e3d2ac20398f88fb9fb +size 2395 diff --git a/data/minecraft/structure/village/savanna/zombie/houses/savanna_small_house_6.nbt b/data/minecraft/structure/village/savanna/zombie/houses/savanna_small_house_6.nbt index f88f1d81..853c2fdf 100644 --- a/data/minecraft/structure/village/savanna/zombie/houses/savanna_small_house_6.nbt +++ b/data/minecraft/structure/village/savanna/zombie/houses/savanna_small_house_6.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:339ed736fa56006bb4baefc1b21c69a9ca900d048977ac4d330053b02ec9293a -size 1790 +oid sha256:ef78adda83ccff6016f83d3572f072e96fcead381300d5b994e73563b4dffb05 +size 1793 diff --git a/data/minecraft/structure/village/savanna/zombie/houses/savanna_small_house_7.nbt b/data/minecraft/structure/village/savanna/zombie/houses/savanna_small_house_7.nbt index 5df0df79..5e5060df 100644 --- a/data/minecraft/structure/village/savanna/zombie/houses/savanna_small_house_7.nbt +++ b/data/minecraft/structure/village/savanna/zombie/houses/savanna_small_house_7.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8e5ac40a716ad172b1a4eea506bca3339bab94bda12d006afe6183d241b4b889 -size 1907 +oid sha256:9cd3be418eeb6ef06ebd4389c4607466317003dc351d083ddbee4346a6abb034 +size 1909 diff --git a/data/minecraft/structure/village/savanna/zombie/houses/savanna_small_house_8.nbt b/data/minecraft/structure/village/savanna/zombie/houses/savanna_small_house_8.nbt index 34f1fbca..96387759 100644 --- a/data/minecraft/structure/village/savanna/zombie/houses/savanna_small_house_8.nbt +++ b/data/minecraft/structure/village/savanna/zombie/houses/savanna_small_house_8.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c1172ac8d74f1507fddb48a82292fbc737b5a409e26ca6fc038583aa316b1d90 -size 1549 +oid sha256:44b9eedab2e555be4ae2549d7ce9593ce09db473824c17f95f208adeaae1f6b5 +size 1552 diff --git a/data/minecraft/structure/village/savanna/zombie/streets/corner_01.nbt b/data/minecraft/structure/village/savanna/zombie/streets/corner_01.nbt index c1dea7e9..f8ebc0cf 100644 --- a/data/minecraft/structure/village/savanna/zombie/streets/corner_01.nbt +++ b/data/minecraft/structure/village/savanna/zombie/streets/corner_01.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7a7e5ec506ca43d40e48a3a5449352d7c086e4684057f5db4ddb76d097f82bfb -size 1201 +oid sha256:9cb3e32f7e09bc67749b1d5650faedccf8877b586cad93c44cb3d2dcdf1d59e2 +size 1204 diff --git a/data/minecraft/structure/village/savanna/zombie/streets/corner_03.nbt b/data/minecraft/structure/village/savanna/zombie/streets/corner_03.nbt index acf8edc6..7ccb8839 100644 --- a/data/minecraft/structure/village/savanna/zombie/streets/corner_03.nbt +++ b/data/minecraft/structure/village/savanna/zombie/streets/corner_03.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5c48ba169fe2ff8973a610f3bac8a504725604f5804bf16b3834d782b65da72b -size 355 +oid sha256:9643e85ae60f06afffe100a70500fed9e1eddd6144e4964d1cd978749dcd2157 +size 357 diff --git a/data/minecraft/structure/village/savanna/zombie/streets/crossroad_02.nbt b/data/minecraft/structure/village/savanna/zombie/streets/crossroad_02.nbt index 18fca19e..3a548396 100644 --- a/data/minecraft/structure/village/savanna/zombie/streets/crossroad_02.nbt +++ b/data/minecraft/structure/village/savanna/zombie/streets/crossroad_02.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:66dd431ee2c61fe531185085c0f36907028b2b7fb883c690cc30c8047caf54c5 -size 630 +oid sha256:1e990e60af33e07ab69767f4509e943f7bcdf891ac0a223070361e14dcdb8eeb +size 632 diff --git a/data/minecraft/structure/village/savanna/zombie/streets/crossroad_03.nbt b/data/minecraft/structure/village/savanna/zombie/streets/crossroad_03.nbt index 5cb803e4..603fbcd6 100644 --- a/data/minecraft/structure/village/savanna/zombie/streets/crossroad_03.nbt +++ b/data/minecraft/structure/village/savanna/zombie/streets/crossroad_03.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:660250c679e96390275abfa1cd272c83aa8d47e1535a0fbd6a86fc765c276b82 -size 1228 +oid sha256:8a36f2f331ab3e050b6f502f4c03de8e903702548a9f389b20a8622673e9d9e7 +size 1231 diff --git a/data/minecraft/structure/village/savanna/zombie/streets/crossroad_04.nbt b/data/minecraft/structure/village/savanna/zombie/streets/crossroad_04.nbt index 87c76e32..b156168a 100644 --- a/data/minecraft/structure/village/savanna/zombie/streets/crossroad_04.nbt +++ b/data/minecraft/structure/village/savanna/zombie/streets/crossroad_04.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:639603abb3cb6bcf93e8a2c4449c35066d4a611a501d8ba5dcda47c1c2a399d0 -size 382 +oid sha256:5a3736190a189fab68857f98ddaeca18a346505559c7f3fb30c74b634b11fb8f +size 384 diff --git a/data/minecraft/structure/village/savanna/zombie/streets/crossroad_05.nbt b/data/minecraft/structure/village/savanna/zombie/streets/crossroad_05.nbt index 897b503f..26862b4f 100644 --- a/data/minecraft/structure/village/savanna/zombie/streets/crossroad_05.nbt +++ b/data/minecraft/structure/village/savanna/zombie/streets/crossroad_05.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c01d8f4812d3df5f595ddc8579b4fc21db2c03823dfb5f451774d0b5fe8b49c8 -size 413 +oid sha256:0dd37e551f074821db95dd0f2cd91393ff3b6a0218534a68a0585424f34d6bfa +size 416 diff --git a/data/minecraft/structure/village/savanna/zombie/streets/crossroad_06.nbt b/data/minecraft/structure/village/savanna/zombie/streets/crossroad_06.nbt index 05c1bc57..59843529 100644 --- a/data/minecraft/structure/village/savanna/zombie/streets/crossroad_06.nbt +++ b/data/minecraft/structure/village/savanna/zombie/streets/crossroad_06.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6a8cba8e1bb9a6db39210c21828a1c377542319666e6e893c51916e70926b629 -size 471 +oid sha256:ce743ea18e2a0861abba7ffd5aad0c3f801c0ed69aa0933307acb2b176135d76 +size 473 diff --git a/data/minecraft/structure/village/savanna/zombie/streets/crossroad_07.nbt b/data/minecraft/structure/village/savanna/zombie/streets/crossroad_07.nbt index a5cb89d8..cbc990d8 100644 --- a/data/minecraft/structure/village/savanna/zombie/streets/crossroad_07.nbt +++ b/data/minecraft/structure/village/savanna/zombie/streets/crossroad_07.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6002f2ae8f48231d32f89d4ac2cfd95fbd67eeab46e61d7b754c40626287e252 -size 1383 +oid sha256:8645c0d4c9aa995305537084e436f0dd48ad734c0c30b48daba5472293827265 +size 1385 diff --git a/data/minecraft/structure/village/savanna/zombie/streets/split_01.nbt b/data/minecraft/structure/village/savanna/zombie/streets/split_01.nbt index 4f1f2a1c..89cf110d 100644 --- a/data/minecraft/structure/village/savanna/zombie/streets/split_01.nbt +++ b/data/minecraft/structure/village/savanna/zombie/streets/split_01.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8bc9162c03ec81384b1c78e60e1c43b7952f45084c27cd163f2328f1c3e523a1 -size 528 +oid sha256:7dafd4cab125657a6fb6a3947b4bddc38750659e3111a9cf0fae90032228ff0c +size 531 diff --git a/data/minecraft/structure/village/savanna/zombie/streets/split_02.nbt b/data/minecraft/structure/village/savanna/zombie/streets/split_02.nbt index 7dbb1cc7..744c9706 100644 --- a/data/minecraft/structure/village/savanna/zombie/streets/split_02.nbt +++ b/data/minecraft/structure/village/savanna/zombie/streets/split_02.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1615dec0ff82fdcb237e7b3f3d64e54b612c5a84d8a6720138ac5c50b52d3c00 -size 741 +oid sha256:0f0a5010bdd0da85564eba1679b2acf7e4c8add42eb09b2f89b3135b1f5bcd20 +size 744 diff --git a/data/minecraft/structure/village/savanna/zombie/streets/straight_02.nbt b/data/minecraft/structure/village/savanna/zombie/streets/straight_02.nbt index 46c9b290..c9e0776e 100644 --- a/data/minecraft/structure/village/savanna/zombie/streets/straight_02.nbt +++ b/data/minecraft/structure/village/savanna/zombie/streets/straight_02.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6051533647be0dca700e42c6b988223c19a373c937699876bf3950bb7ac3b805 -size 1128 +oid sha256:52ff6d04c317cf645c75b8951eb193915ba8cd729f933838bef3582168b3dbcf +size 1131 diff --git a/data/minecraft/structure/village/savanna/zombie/streets/straight_04.nbt b/data/minecraft/structure/village/savanna/zombie/streets/straight_04.nbt index 35756467..1ec010c3 100644 --- a/data/minecraft/structure/village/savanna/zombie/streets/straight_04.nbt +++ b/data/minecraft/structure/village/savanna/zombie/streets/straight_04.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6ba7dd32243aaab3eb905c68a42e989a24dbab238d679616634d68a13b1e3194 -size 645 +oid sha256:da0e80068a2eccc63226728e4bcada60b26930fb457000a618518340ff3d7fdf +size 646 diff --git a/data/minecraft/structure/village/savanna/zombie/streets/straight_05.nbt b/data/minecraft/structure/village/savanna/zombie/streets/straight_05.nbt index 86952a6b..041d0dbb 100644 --- a/data/minecraft/structure/village/savanna/zombie/streets/straight_05.nbt +++ b/data/minecraft/structure/village/savanna/zombie/streets/straight_05.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1a83f24ac28ceb4305d5f285b3cf142b4c7f8b8b8b7a0f2ca807fb0df8589c9b -size 1935 +oid sha256:eb42a4bf867ad920bdffc005a630606755dd2f8fca297e318764034f232685c3 +size 1938 diff --git a/data/minecraft/structure/village/savanna/zombie/streets/straight_06.nbt b/data/minecraft/structure/village/savanna/zombie/streets/straight_06.nbt index 7ba4916b..35172dc7 100644 --- a/data/minecraft/structure/village/savanna/zombie/streets/straight_06.nbt +++ b/data/minecraft/structure/village/savanna/zombie/streets/straight_06.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ade1f52119f199d1e018075efb68b83ca57254362c9200f5491f0e97099fa26a +oid sha256:d3466ea81c25418440786900552f07de8d9b3257e1336a73c75e6818994ca0e1 size 1094 diff --git a/data/minecraft/structure/village/savanna/zombie/streets/straight_08.nbt b/data/minecraft/structure/village/savanna/zombie/streets/straight_08.nbt index 44c07f78..aa165544 100644 --- a/data/minecraft/structure/village/savanna/zombie/streets/straight_08.nbt +++ b/data/minecraft/structure/village/savanna/zombie/streets/straight_08.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:cc1533d4441901a89a2add7534d9e25dee360bc4b131875b48670af01060b138 -size 942 +oid sha256:e63a3e6b46282d3c59209e95e6c5bc29f1d1300472527aef1fe85535dc358a7f +size 945 diff --git a/data/minecraft/structure/village/savanna/zombie/streets/straight_09.nbt b/data/minecraft/structure/village/savanna/zombie/streets/straight_09.nbt index a7b4914d..f9b8d79d 100644 --- a/data/minecraft/structure/village/savanna/zombie/streets/straight_09.nbt +++ b/data/minecraft/structure/village/savanna/zombie/streets/straight_09.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ce9f8726e97fb911174665615b30f5ef52720d780cecae52f283c15284a8f299 -size 1525 +oid sha256:856582c95ca89a20d0a28526197974aff19e374c35e4570247a2d24f7eb99eaf +size 1527 diff --git a/data/minecraft/structure/village/savanna/zombie/streets/straight_10.nbt b/data/minecraft/structure/village/savanna/zombie/streets/straight_10.nbt index fa1b9a9a..df91fad4 100644 --- a/data/minecraft/structure/village/savanna/zombie/streets/straight_10.nbt +++ b/data/minecraft/structure/village/savanna/zombie/streets/straight_10.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0b8c59713eb657fb2241d1a9bbb9d234766b6d0e9db4f627cb4027136437157a -size 527 +oid sha256:724bfdce0ecd80799404b0109413e1d080776ffad5f78ac339786dc29df4a9cc +size 530 diff --git a/data/minecraft/structure/village/savanna/zombie/streets/straight_11.nbt b/data/minecraft/structure/village/savanna/zombie/streets/straight_11.nbt index 60a9f758..04835362 100644 --- a/data/minecraft/structure/village/savanna/zombie/streets/straight_11.nbt +++ b/data/minecraft/structure/village/savanna/zombie/streets/straight_11.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e62696cf5a6cda7c2b75e1da40e745e69eda9d34a3227fe12a8edb8b7922080f -size 1566 +oid sha256:ad27edd971edf075bdf7fbabe76ae9e7038267295a591ec7080b288baf86ba31 +size 1569 diff --git a/data/minecraft/structure/village/savanna/zombie/streets/turn_01.nbt b/data/minecraft/structure/village/savanna/zombie/streets/turn_01.nbt index f354ecba..3dd59663 100644 --- a/data/minecraft/structure/village/savanna/zombie/streets/turn_01.nbt +++ b/data/minecraft/structure/village/savanna/zombie/streets/turn_01.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:53b600669b384450de11708334c4581581a6a90dc9bec64e33acefa15ed43e8b -size 1164 +oid sha256:626d484ae958ddf262288ecc4916b6ed339c5cbce789d3407896a7b37369884c +size 1167 diff --git a/data/minecraft/structure/village/savanna/zombie/terminators/terminator_05.nbt b/data/minecraft/structure/village/savanna/zombie/terminators/terminator_05.nbt index 85d57b45..fa5ff868 100644 --- a/data/minecraft/structure/village/savanna/zombie/terminators/terminator_05.nbt +++ b/data/minecraft/structure/village/savanna/zombie/terminators/terminator_05.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:667010e53f99d12d3701cc3244f13e1ae630060b2f88741d327e0cb2713bd727 -size 1190 +oid sha256:ccfe5d1e1a82dbdb57225ecccaf1951170be43ab716d2ee3491c2f2554f3e8cd +size 1193 diff --git a/data/minecraft/structure/village/savanna/zombie/town_centers/savanna_meeting_point_1.nbt b/data/minecraft/structure/village/savanna/zombie/town_centers/savanna_meeting_point_1.nbt index 2bd91184..5c0f7970 100644 --- a/data/minecraft/structure/village/savanna/zombie/town_centers/savanna_meeting_point_1.nbt +++ b/data/minecraft/structure/village/savanna/zombie/town_centers/savanna_meeting_point_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:153672b5f786bef33f85277a25dd81302fa6a46db34855be8cb6cb1a4cc9cfe7 -size 3182 +oid sha256:1636499ed0bf541f6183d6880a008764896c9939630133715e7917bdf2d8f057 +size 3185 diff --git a/data/minecraft/structure/village/savanna/zombie/town_centers/savanna_meeting_point_2.nbt b/data/minecraft/structure/village/savanna/zombie/town_centers/savanna_meeting_point_2.nbt index 3e554f0b..34c110b4 100644 --- a/data/minecraft/structure/village/savanna/zombie/town_centers/savanna_meeting_point_2.nbt +++ b/data/minecraft/structure/village/savanna/zombie/town_centers/savanna_meeting_point_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d9a9cd0c8c2f82d4f525a6b16bdc21893ce841ab9a0f90390f7a49cc83bbddbc -size 2710 +oid sha256:597ed883515bdf5146561d7f235aa5b3dc53d1577f4a8b0017e761a8dda4428c +size 2713 diff --git a/data/minecraft/structure/village/savanna/zombie/town_centers/savanna_meeting_point_3.nbt b/data/minecraft/structure/village/savanna/zombie/town_centers/savanna_meeting_point_3.nbt index 02aca015..e5f075ce 100644 --- a/data/minecraft/structure/village/savanna/zombie/town_centers/savanna_meeting_point_3.nbt +++ b/data/minecraft/structure/village/savanna/zombie/town_centers/savanna_meeting_point_3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5a23f24f054a5bfe01ecfc45f17d2662654aa72054b2d8b54a798a0bb0b5e089 -size 916 +oid sha256:b462fe9f448e20f5ea455e1fdf9668590482a3af58f7ed8a4c82c7688c4f2003 +size 919 diff --git a/data/minecraft/structure/village/savanna/zombie/town_centers/savanna_meeting_point_4.nbt b/data/minecraft/structure/village/savanna/zombie/town_centers/savanna_meeting_point_4.nbt index 3d7ac2c1..8ce0f668 100644 --- a/data/minecraft/structure/village/savanna/zombie/town_centers/savanna_meeting_point_4.nbt +++ b/data/minecraft/structure/village/savanna/zombie/town_centers/savanna_meeting_point_4.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3621b17242913a9c7e218b043063f7e6f35f6f46bfa1a0c543ab549687259e8d -size 1144 +oid sha256:b9f78e5753115b19ba68c289e440177aa96b7532bf9bdf8d784351584c6c1fc6 +size 1146 diff --git a/data/minecraft/structure/village/savanna/zombie/villagers/nitwit.nbt b/data/minecraft/structure/village/savanna/zombie/villagers/nitwit.nbt index 88525e80..17373ed9 100644 --- a/data/minecraft/structure/village/savanna/zombie/villagers/nitwit.nbt +++ b/data/minecraft/structure/village/savanna/zombie/villagers/nitwit.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:015f3c71972002e8d2c227b11d09ce4c0f60ce14933bc6fae4b2ca89edf9f78e +oid sha256:b7f27c0ce8e339e6b2d36ed6c5f5490108c63658b4d243ba4db068c501976c89 size 758 diff --git a/data/minecraft/structure/village/savanna/zombie/villagers/unemployed.nbt b/data/minecraft/structure/village/savanna/zombie/villagers/unemployed.nbt index 254fe52f..9ce3280d 100644 --- a/data/minecraft/structure/village/savanna/zombie/villagers/unemployed.nbt +++ b/data/minecraft/structure/village/savanna/zombie/villagers/unemployed.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:004e2004140b0475f862281a5437d8053754b88226c0f3a95a32c64e1514d22f +oid sha256:7d2700173e247cd00f53cdea2426305c47cb04be93e6ad8314abac45e7bf8f75 size 756 diff --git a/data/minecraft/structure/village/snowy/houses/snowy_animal_pen_1.nbt b/data/minecraft/structure/village/snowy/houses/snowy_animal_pen_1.nbt index fe9a002b..b6b318af 100644 --- a/data/minecraft/structure/village/snowy/houses/snowy_animal_pen_1.nbt +++ b/data/minecraft/structure/village/snowy/houses/snowy_animal_pen_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:dc8162c238d796e8becf33d2eae808947a96d7621ece0d7f38c345e87c93dd7a -size 1618 +oid sha256:ad23252a4c5207b15bcfe485952ca4c5b87b7f6adb2390319c6ad60eae5f4c06 +size 1622 diff --git a/data/minecraft/structure/village/snowy/houses/snowy_animal_pen_2.nbt b/data/minecraft/structure/village/snowy/houses/snowy_animal_pen_2.nbt index 964d6e1c..a22d6602 100644 --- a/data/minecraft/structure/village/snowy/houses/snowy_animal_pen_2.nbt +++ b/data/minecraft/structure/village/snowy/houses/snowy_animal_pen_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:05de525dd2e7a0e1aa72e01ac705c0eff7deba7dfbe50b4388774aaa8c74326e -size 1259 +oid sha256:da42285c7ddf8f5577c543714641dd693763e9d8ce24f8c0de686e7a3f01de80 +size 1262 diff --git a/data/minecraft/structure/village/snowy/houses/snowy_armorer_house_1.nbt b/data/minecraft/structure/village/snowy/houses/snowy_armorer_house_1.nbt index f67482e3..ee5fa0be 100644 --- a/data/minecraft/structure/village/snowy/houses/snowy_armorer_house_1.nbt +++ b/data/minecraft/structure/village/snowy/houses/snowy_armorer_house_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9174dc4dc5e38877027986129f756932c320abcdb97866926d445dcdad1d4df6 -size 2169 +oid sha256:8c7fc784f41d503fdc1afbba22b1080bf5a43190d9d951f93dbf08d0c2696c80 +size 2172 diff --git a/data/minecraft/structure/village/snowy/houses/snowy_armorer_house_2.nbt b/data/minecraft/structure/village/snowy/houses/snowy_armorer_house_2.nbt index 59a6f7b7..58b840b5 100644 --- a/data/minecraft/structure/village/snowy/houses/snowy_armorer_house_2.nbt +++ b/data/minecraft/structure/village/snowy/houses/snowy_armorer_house_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f9d9385b02f02c473c94e3810e7744e25ad8feb593aac11d6702abd3d60e1518 -size 2050 +oid sha256:34656879eab6c965517b2c01ca51a5b5b39db12b27ddc5e925e75cbd97ef6a99 +size 2052 diff --git a/data/minecraft/structure/village/snowy/houses/snowy_butchers_shop_1.nbt b/data/minecraft/structure/village/snowy/houses/snowy_butchers_shop_1.nbt index 59c47b7f..90833062 100644 --- a/data/minecraft/structure/village/snowy/houses/snowy_butchers_shop_1.nbt +++ b/data/minecraft/structure/village/snowy/houses/snowy_butchers_shop_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:bd9cd187d96c121717f284e20e2ae7ddec002169951a016e712d3720f9eec317 -size 2546 +oid sha256:35a990bc1930ec8ce6e6ac92e1767a277ba684ddad374235431140bb3d077eab +size 2548 diff --git a/data/minecraft/structure/village/snowy/houses/snowy_butchers_shop_2.nbt b/data/minecraft/structure/village/snowy/houses/snowy_butchers_shop_2.nbt index 0b9788ac..3d8bbaeb 100644 --- a/data/minecraft/structure/village/snowy/houses/snowy_butchers_shop_2.nbt +++ b/data/minecraft/structure/village/snowy/houses/snowy_butchers_shop_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d7af7d7cb53075babd8b1e294034b45fa623d64566ef410d8fb70f231fbc6c05 -size 1443 +oid sha256:b7227d95a67c8c9505f8c0fa41f25bf91847a8816efee228ee582c795133bcc8 +size 1446 diff --git a/data/minecraft/structure/village/snowy/houses/snowy_cartographer_house_1.nbt b/data/minecraft/structure/village/snowy/houses/snowy_cartographer_house_1.nbt index be147b80..49ec9e0c 100644 --- a/data/minecraft/structure/village/snowy/houses/snowy_cartographer_house_1.nbt +++ b/data/minecraft/structure/village/snowy/houses/snowy_cartographer_house_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:fabe9fdd9a57589404c3355f831df012875468c1cde9d02179f4910e970f43b7 -size 2359 +oid sha256:c5a3da406bfa2acd2bb343d35678b1b06e64e63fcd630700bfb298110be6d815 +size 2362 diff --git a/data/minecraft/structure/village/snowy/houses/snowy_farm_1.nbt b/data/minecraft/structure/village/snowy/houses/snowy_farm_1.nbt index 2510968a..1ee93662 100644 --- a/data/minecraft/structure/village/snowy/houses/snowy_farm_1.nbt +++ b/data/minecraft/structure/village/snowy/houses/snowy_farm_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6c4f8c4a3c534a09cdac0c2d5d4137ba0523be4503e31a5947a1266ee8c1a52c -size 1251 +oid sha256:9d52e350178dc443f15b6c3dcfa251b40f832929553013bf28d63dbae28685a1 +size 1254 diff --git a/data/minecraft/structure/village/snowy/houses/snowy_farm_2.nbt b/data/minecraft/structure/village/snowy/houses/snowy_farm_2.nbt index 3561e1ae..ad4d6d92 100644 --- a/data/minecraft/structure/village/snowy/houses/snowy_farm_2.nbt +++ b/data/minecraft/structure/village/snowy/houses/snowy_farm_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:fa3935fcd9069f406d1d7edcf3eda490b114aa792edd67092130d1b681f8d854 -size 1073 +oid sha256:b592315705480f21cd7475336c19b42b8846572cd335b62ade35afacfbba6f27 +size 1076 diff --git a/data/minecraft/structure/village/snowy/houses/snowy_fisher_cottage.nbt b/data/minecraft/structure/village/snowy/houses/snowy_fisher_cottage.nbt index 5499ed0d..bed4113b 100644 --- a/data/minecraft/structure/village/snowy/houses/snowy_fisher_cottage.nbt +++ b/data/minecraft/structure/village/snowy/houses/snowy_fisher_cottage.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f0db8e77743a74f616f8887b5c4993ad3c3e21731eac820da1099664aea17cf5 -size 2235 +oid sha256:1283a0ec170aae180cc8c7b0ef217ee43847febb5a2005cf1adaf10bffaaba33 +size 2236 diff --git a/data/minecraft/structure/village/snowy/houses/snowy_fletcher_house_1.nbt b/data/minecraft/structure/village/snowy/houses/snowy_fletcher_house_1.nbt index ffccbbe3..d08a0fdc 100644 --- a/data/minecraft/structure/village/snowy/houses/snowy_fletcher_house_1.nbt +++ b/data/minecraft/structure/village/snowy/houses/snowy_fletcher_house_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:821b10acf0ed79f909f8e9d42148e7af7045b15783d5623ac4d913bf562e96ac -size 2119 +oid sha256:3173c04f63fe027114292bbb44ecc66cbac3029c192e9971c9c1582e49ab5139 +size 2121 diff --git a/data/minecraft/structure/village/snowy/houses/snowy_library_1.nbt b/data/minecraft/structure/village/snowy/houses/snowy_library_1.nbt index 1a9631c9..d5d00d98 100644 --- a/data/minecraft/structure/village/snowy/houses/snowy_library_1.nbt +++ b/data/minecraft/structure/village/snowy/houses/snowy_library_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:973fcaaf063444d04e70885c620ce6d9b9d43fad45e0f4bf3f31aef978297546 -size 3445 +oid sha256:8e5a7c96af3d7512dbd6cd95b4d14fd1a373d008c7408a3d54784041343181b8 +size 3447 diff --git a/data/minecraft/structure/village/snowy/houses/snowy_masons_house_1.nbt b/data/minecraft/structure/village/snowy/houses/snowy_masons_house_1.nbt index 220ce9e6..12356be2 100644 --- a/data/minecraft/structure/village/snowy/houses/snowy_masons_house_1.nbt +++ b/data/minecraft/structure/village/snowy/houses/snowy_masons_house_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:859052b68ac759324579c13caeee85ed501499c0d882ba9cd5aa83dd22c82c6a -size 2977 +oid sha256:a6057acf76c399084aec183fae41692660df1af4d80da938bee86b2955d1f69c +size 2980 diff --git a/data/minecraft/structure/village/snowy/houses/snowy_masons_house_2.nbt b/data/minecraft/structure/village/snowy/houses/snowy_masons_house_2.nbt index 02c74250..6d931751 100644 --- a/data/minecraft/structure/village/snowy/houses/snowy_masons_house_2.nbt +++ b/data/minecraft/structure/village/snowy/houses/snowy_masons_house_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b6f009eff9e5822fdc1d8c4271d960e4415dbe1a45f171723c189a734fe9168e -size 3163 +oid sha256:9b96da83f9ef15ab919e6b56d80ed48824555a4286d9bc31044f351bd44f6e76 +size 3166 diff --git a/data/minecraft/structure/village/snowy/houses/snowy_medium_house_1.nbt b/data/minecraft/structure/village/snowy/houses/snowy_medium_house_1.nbt index f079017c..bbf60b43 100644 --- a/data/minecraft/structure/village/snowy/houses/snowy_medium_house_1.nbt +++ b/data/minecraft/structure/village/snowy/houses/snowy_medium_house_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7edff67dd49fd94c6e86701ff46b42320711f2a3f85dda5eff41e7e3e2108682 -size 1592 +oid sha256:34c949b3b741f25a2b57ebbf1592392d5cc84397790542e37fddd1f88322eab1 +size 1595 diff --git a/data/minecraft/structure/village/snowy/houses/snowy_medium_house_2.nbt b/data/minecraft/structure/village/snowy/houses/snowy_medium_house_2.nbt index e004f3ea..b94c5aaf 100644 --- a/data/minecraft/structure/village/snowy/houses/snowy_medium_house_2.nbt +++ b/data/minecraft/structure/village/snowy/houses/snowy_medium_house_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:97b52a8d94795786d9c64b178305547785ff1919fba3824e3164826fcd19f5de -size 3509 +oid sha256:868298b28be108c67f4e1a935e5c2437084736f44e404b218ed6b5203f9f31b7 +size 3511 diff --git a/data/minecraft/structure/village/snowy/houses/snowy_medium_house_3.nbt b/data/minecraft/structure/village/snowy/houses/snowy_medium_house_3.nbt index 9b926083..ecc31ece 100644 --- a/data/minecraft/structure/village/snowy/houses/snowy_medium_house_3.nbt +++ b/data/minecraft/structure/village/snowy/houses/snowy_medium_house_3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ab22179236268d2aaae1831c4b86cd951e831aafe55fb9625d6e9592bc91f177 -size 1186 +oid sha256:ac3b162dfe2de736d12a9fb9c6d7fc97239f60be309d4264436d4b6be0468615 +size 1189 diff --git a/data/minecraft/structure/village/snowy/houses/snowy_shepherds_house_1.nbt b/data/minecraft/structure/village/snowy/houses/snowy_shepherds_house_1.nbt index a26a3dfc..07754ee1 100644 --- a/data/minecraft/structure/village/snowy/houses/snowy_shepherds_house_1.nbt +++ b/data/minecraft/structure/village/snowy/houses/snowy_shepherds_house_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:aaa8899cebe94e8564648224ea79c080bf35f7ff6fce332707285ac62da0938b -size 2165 +oid sha256:79364888344951a70fe4861a94cfa8740f246dad0b0b4fa85a49d16e7a29a037 +size 2167 diff --git a/data/minecraft/structure/village/snowy/houses/snowy_small_house_1.nbt b/data/minecraft/structure/village/snowy/houses/snowy_small_house_1.nbt index 36ca7c08..691c100e 100644 --- a/data/minecraft/structure/village/snowy/houses/snowy_small_house_1.nbt +++ b/data/minecraft/structure/village/snowy/houses/snowy_small_house_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9ac50121a1750554406e920d79221baca94c461c514baea38108cd21545da0bc -size 1315 +oid sha256:3339eebfce39168ae582f6573ddf45107f18b2ce01800a9439b42f889b653cc1 +size 1318 diff --git a/data/minecraft/structure/village/snowy/houses/snowy_small_house_2.nbt b/data/minecraft/structure/village/snowy/houses/snowy_small_house_2.nbt index f7729903..bac00356 100644 --- a/data/minecraft/structure/village/snowy/houses/snowy_small_house_2.nbt +++ b/data/minecraft/structure/village/snowy/houses/snowy_small_house_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a06e96f38ae83436e2dc9ee822afe2f70673a328f81b51d96dbb9aeb61eda6e4 -size 2097 +oid sha256:f96a7f9ff9db90d708993fa68f63d6c35776913d2d2120bbce8103f5979a0399 +size 2100 diff --git a/data/minecraft/structure/village/snowy/houses/snowy_small_house_3.nbt b/data/minecraft/structure/village/snowy/houses/snowy_small_house_3.nbt index 9767c74d..2a9d7232 100644 --- a/data/minecraft/structure/village/snowy/houses/snowy_small_house_3.nbt +++ b/data/minecraft/structure/village/snowy/houses/snowy_small_house_3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:54508c4183cda61fd772d89c0cdd5b657d9d28cd6a429c819b44199d00677ff9 -size 1734 +oid sha256:0ef06b099a3b90bc86792053f43ceacacc567d054ac94060c450b86d826ca8de +size 1738 diff --git a/data/minecraft/structure/village/snowy/houses/snowy_small_house_4.nbt b/data/minecraft/structure/village/snowy/houses/snowy_small_house_4.nbt index 3dddd8e4..db018ea0 100644 --- a/data/minecraft/structure/village/snowy/houses/snowy_small_house_4.nbt +++ b/data/minecraft/structure/village/snowy/houses/snowy_small_house_4.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:fdae2b061fd54884a427b7e41f2b959246f981035f3e89c8825ad8fd4c607558 -size 1583 +oid sha256:cf742a0337473d282ee4a70ae3860c0c307415e2cb34d5cac0c89f111af4404e +size 1586 diff --git a/data/minecraft/structure/village/snowy/houses/snowy_small_house_5.nbt b/data/minecraft/structure/village/snowy/houses/snowy_small_house_5.nbt index a6fc92eb..9dee0fa5 100644 --- a/data/minecraft/structure/village/snowy/houses/snowy_small_house_5.nbt +++ b/data/minecraft/structure/village/snowy/houses/snowy_small_house_5.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f56b7af7f379cf24c77cd0d59248de81ca63802a03bf40aa822cc235ef2cd494 -size 1138 +oid sha256:f2e07129854a4d284a735da25d1f1f5d3274b8d8a86841d2a72c05e51157b2c0 +size 1141 diff --git a/data/minecraft/structure/village/snowy/houses/snowy_small_house_6.nbt b/data/minecraft/structure/village/snowy/houses/snowy_small_house_6.nbt index 1cc03699..deeb16de 100644 --- a/data/minecraft/structure/village/snowy/houses/snowy_small_house_6.nbt +++ b/data/minecraft/structure/village/snowy/houses/snowy_small_house_6.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:29b823eddad8f7bf1f7878afa00c2e3db6c6c9a78fcbd563406ee9240a387e53 -size 2195 +oid sha256:d3df9fb0ad74631c02efa1f0c8caaee5470f436d30665c369b1485a05810c72d +size 2198 diff --git a/data/minecraft/structure/village/snowy/houses/snowy_small_house_7.nbt b/data/minecraft/structure/village/snowy/houses/snowy_small_house_7.nbt index 7b2f94ec..9b25e480 100644 --- a/data/minecraft/structure/village/snowy/houses/snowy_small_house_7.nbt +++ b/data/minecraft/structure/village/snowy/houses/snowy_small_house_7.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b82b215a03f99e9e5398230d946995a4c7e2d9a395b01a616c46eae1bafdb2d8 -size 1616 +oid sha256:6268bcc456cca495216b8bb2ec8a9cae8c700b9a8b3d5b3623059544ff4cc663 +size 1619 diff --git a/data/minecraft/structure/village/snowy/houses/snowy_small_house_8.nbt b/data/minecraft/structure/village/snowy/houses/snowy_small_house_8.nbt index 46d1dfb1..586acd31 100644 --- a/data/minecraft/structure/village/snowy/houses/snowy_small_house_8.nbt +++ b/data/minecraft/structure/village/snowy/houses/snowy_small_house_8.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a19ed091f59636399f8598da7eaa5474bce527ab38fb5da4d44c6fb67bc9560b -size 1018 +oid sha256:8c9e654969daa241f4c32de4bebac99bffe7d90e20c6213913afca7436875dba +size 1021 diff --git a/data/minecraft/structure/village/snowy/houses/snowy_tannery_1.nbt b/data/minecraft/structure/village/snowy/houses/snowy_tannery_1.nbt index 8c0f6e7c..7d22649d 100644 --- a/data/minecraft/structure/village/snowy/houses/snowy_tannery_1.nbt +++ b/data/minecraft/structure/village/snowy/houses/snowy_tannery_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:65c9666fe07c16858f24c455026652a7eb72383ebc938df7bdf584c316cbe485 -size 2954 +oid sha256:d464b230fd6decf0b5ae5989c54b56aa8eda22740c2fddb0b0b7448de7917748 +size 2956 diff --git a/data/minecraft/structure/village/snowy/houses/snowy_temple_1.nbt b/data/minecraft/structure/village/snowy/houses/snowy_temple_1.nbt index f22ca23b..4ad56561 100644 --- a/data/minecraft/structure/village/snowy/houses/snowy_temple_1.nbt +++ b/data/minecraft/structure/village/snowy/houses/snowy_temple_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d496e505997013934881d5a3c427823658ca686f3499c30a897f7e0312de28f3 -size 3571 +oid sha256:54cbe0b0823f126fef1b1a2c2da2d159733a4e0292dc17ae4d3ffb13978e3278 +size 3574 diff --git a/data/minecraft/structure/village/snowy/houses/snowy_tool_smith_1.nbt b/data/minecraft/structure/village/snowy/houses/snowy_tool_smith_1.nbt index 388206e6..53b4a3f0 100644 --- a/data/minecraft/structure/village/snowy/houses/snowy_tool_smith_1.nbt +++ b/data/minecraft/structure/village/snowy/houses/snowy_tool_smith_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:91f32d5d778958e1c4ae2dd45280f4ae29e1c0b7d688050d9cd87e98581acb5c -size 1913 +oid sha256:5bd84e2a28ba765a786daf64ed2c7509cc337b7ffb7d80fc156f37295265e727 +size 1915 diff --git a/data/minecraft/structure/village/snowy/houses/snowy_weapon_smith_1.nbt b/data/minecraft/structure/village/snowy/houses/snowy_weapon_smith_1.nbt index dafe4b86..d59b498b 100644 --- a/data/minecraft/structure/village/snowy/houses/snowy_weapon_smith_1.nbt +++ b/data/minecraft/structure/village/snowy/houses/snowy_weapon_smith_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c7a2196beffcd772a6fb2cabafd0ff39bee3baea8842177b10c17d6ec3067a10 -size 2754 +oid sha256:231d642dae849d30cac0b2a3527c0279d6f44d6de55f11994e9c03b8fe31c00c +size 2757 diff --git a/data/minecraft/structure/village/snowy/snowy_lamp_post_01.nbt b/data/minecraft/structure/village/snowy/snowy_lamp_post_01.nbt index ce1b2c84..2dced28b 100644 --- a/data/minecraft/structure/village/snowy/snowy_lamp_post_01.nbt +++ b/data/minecraft/structure/village/snowy/snowy_lamp_post_01.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:99b4a3c0dfba2af45d11d32fd1d105c2949370edf9852d8b65594db7f5449b5b -size 377 +oid sha256:f3153cab3ce3c6bf4908fd30f939a3f7007a18ae64650d09d6f92b4c8f5c7514 +size 380 diff --git a/data/minecraft/structure/village/snowy/snowy_lamp_post_02.nbt b/data/minecraft/structure/village/snowy/snowy_lamp_post_02.nbt index debf4a86..c3016553 100644 --- a/data/minecraft/structure/village/snowy/snowy_lamp_post_02.nbt +++ b/data/minecraft/structure/village/snowy/snowy_lamp_post_02.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2f4dd91c051ffe787a8b414090c341f87a8c4427d1c2d9b36fc93c9cc44e2f4d -size 354 +oid sha256:2c293433294bf01d4fde845c1745aa4ee475761894bb220470d2281bb8ac37fc +size 357 diff --git a/data/minecraft/structure/village/snowy/snowy_lamp_post_03.nbt b/data/minecraft/structure/village/snowy/snowy_lamp_post_03.nbt index 7b00d085..ea90388a 100644 --- a/data/minecraft/structure/village/snowy/snowy_lamp_post_03.nbt +++ b/data/minecraft/structure/village/snowy/snowy_lamp_post_03.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c5d8837ba6df0d03d50051dfe1dd503089c5d31094c943a57aab2070ca150627 -size 501 +oid sha256:9fdf1ec3c188289198ef37bdda308af1d492e560fef77be09b6539c5a51e3379 +size 504 diff --git a/data/minecraft/structure/village/snowy/streets/corner_01.nbt b/data/minecraft/structure/village/snowy/streets/corner_01.nbt index 7e59a426..805a8977 100644 --- a/data/minecraft/structure/village/snowy/streets/corner_01.nbt +++ b/data/minecraft/structure/village/snowy/streets/corner_01.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:00969e44fb279c7bdc63cf1b6705f1773ea2fad39344221d1f72e27c5935bf41 -size 1096 +oid sha256:b94fbdadd3294956220932ea70f551f991a6df456d04307a19ad1664d986cde8 +size 1098 diff --git a/data/minecraft/structure/village/snowy/streets/corner_02.nbt b/data/minecraft/structure/village/snowy/streets/corner_02.nbt index c138fd3d..470d2b6d 100644 --- a/data/minecraft/structure/village/snowy/streets/corner_02.nbt +++ b/data/minecraft/structure/village/snowy/streets/corner_02.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:073c21732e11e5826d7528dc4829574cb0e88712a38f1d7614bed3676724401e -size 1806 +oid sha256:dd0183f117ccf684fb05fdd01146da5b2a16e13da5833eb8d38ff3a042982328 +size 1809 diff --git a/data/minecraft/structure/village/snowy/streets/corner_03.nbt b/data/minecraft/structure/village/snowy/streets/corner_03.nbt index 197caff0..aa4f3123 100644 --- a/data/minecraft/structure/village/snowy/streets/corner_03.nbt +++ b/data/minecraft/structure/village/snowy/streets/corner_03.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1a3b4c1b85279bfc1e6b420683c6210548d5df4993daf11781dc8ec9544bb17b -size 393 +oid sha256:fc8c3f05ea3417f8874d30c9f8884054058105417e7227bb6e26dde4e5227f68 +size 395 diff --git a/data/minecraft/structure/village/snowy/streets/crossroad_01.nbt b/data/minecraft/structure/village/snowy/streets/crossroad_01.nbt index ec612d05..76d0f9a2 100644 --- a/data/minecraft/structure/village/snowy/streets/crossroad_01.nbt +++ b/data/minecraft/structure/village/snowy/streets/crossroad_01.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1ffdf8c623ebb56b02efc27ef039f0ec0b0ade297c9789cfa6c12055c3500913 -size 1918 +oid sha256:36b1578eb2197d6b99095f43e92bc65a44da2aeeb32aeef9f9ba7bb7c15172d6 +size 1920 diff --git a/data/minecraft/structure/village/snowy/streets/crossroad_02.nbt b/data/minecraft/structure/village/snowy/streets/crossroad_02.nbt index 4b759a60..a5a8e24d 100644 --- a/data/minecraft/structure/village/snowy/streets/crossroad_02.nbt +++ b/data/minecraft/structure/village/snowy/streets/crossroad_02.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e427b67568c12c09738d58b641eb5fbba0a72bcb4493f5b50b433ae102c3366a -size 1956 +oid sha256:d12eba346fcc0ed34d5370ecbadceeb0b8ccb26ae54200607fe4a293996684b2 +size 1958 diff --git a/data/minecraft/structure/village/snowy/streets/crossroad_03.nbt b/data/minecraft/structure/village/snowy/streets/crossroad_03.nbt index 1ade625d..c30f938a 100644 --- a/data/minecraft/structure/village/snowy/streets/crossroad_03.nbt +++ b/data/minecraft/structure/village/snowy/streets/crossroad_03.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5b2583310bd6d9ad9a6d85e1b98ce2b07da54ed32f2c3909795ecdb652195749 -size 2022 +oid sha256:6d6792e6d01552dfeb8270e389f50b833612b537108acbf5bea07b7b755b550e +size 2024 diff --git a/data/minecraft/structure/village/snowy/streets/crossroad_04.nbt b/data/minecraft/structure/village/snowy/streets/crossroad_04.nbt index f616a7db..c1a6d194 100644 --- a/data/minecraft/structure/village/snowy/streets/crossroad_04.nbt +++ b/data/minecraft/structure/village/snowy/streets/crossroad_04.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:31882b3d0777c21339ad61ac268de31231fcfb5482454697b03a2c6503b784c2 -size 429 +oid sha256:ddbd805cea45a6662a21a6f620279f6825ee2a34cfd116a32d41572e1a86f74a +size 432 diff --git a/data/minecraft/structure/village/snowy/streets/crossroad_05.nbt b/data/minecraft/structure/village/snowy/streets/crossroad_05.nbt index 413c9e34..3fa6e39c 100644 --- a/data/minecraft/structure/village/snowy/streets/crossroad_05.nbt +++ b/data/minecraft/structure/village/snowy/streets/crossroad_05.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b62afd2496bc379daf63cc40eed60ebe0f7d19759cb62ebe06a61df736923cdb -size 471 +oid sha256:5da0d8f93104867604d7b62762c32c2a2a14c18c391f7af7c1a792888510f32d +size 474 diff --git a/data/minecraft/structure/village/snowy/streets/crossroad_06.nbt b/data/minecraft/structure/village/snowy/streets/crossroad_06.nbt index 3d015392..b9ee8e21 100644 --- a/data/minecraft/structure/village/snowy/streets/crossroad_06.nbt +++ b/data/minecraft/structure/village/snowy/streets/crossroad_06.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c6b50e4bef31502745ae61c7a38916fd03b3ee37ed55b69a551fad0e5136cffe -size 527 +oid sha256:91c7eba4c197d201d9ce984374f5d99d832dd8a204cfacadebc83ffcac219b97 +size 529 diff --git a/data/minecraft/structure/village/snowy/streets/square_01.nbt b/data/minecraft/structure/village/snowy/streets/square_01.nbt index 12d43306..b316c34f 100644 --- a/data/minecraft/structure/village/snowy/streets/square_01.nbt +++ b/data/minecraft/structure/village/snowy/streets/square_01.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d1180cdb279d5fea67226609c8eef230c67bfd2dc65dc854759b0bdac8b6972b -size 1508 +oid sha256:bb2d1ecbbbbcc6b54e04d27c2f53c8ccf3d362b705502a75a468d1416a7ebcad +size 1511 diff --git a/data/minecraft/structure/village/snowy/streets/straight_01.nbt b/data/minecraft/structure/village/snowy/streets/straight_01.nbt index 035ca001..1245b597 100644 --- a/data/minecraft/structure/village/snowy/streets/straight_01.nbt +++ b/data/minecraft/structure/village/snowy/streets/straight_01.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ffd1fae4b08b9f7764ead70f43eb8be5e7c9738a3df35d006e984fb045eed8a4 -size 1850 +oid sha256:34f51a3366b3abdb54379024f51c6caee6989be24c77008b8be6ced1834965cd +size 1852 diff --git a/data/minecraft/structure/village/snowy/streets/straight_02.nbt b/data/minecraft/structure/village/snowy/streets/straight_02.nbt index 7d590e2e..749846b7 100644 --- a/data/minecraft/structure/village/snowy/streets/straight_02.nbt +++ b/data/minecraft/structure/village/snowy/streets/straight_02.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9180493c57a94c2a518e48ae19fa25d860eb7499dc1ab7d9af427e6025bf6a20 -size 1772 +oid sha256:2114008987ba7512bdd169b1f6f21b430c71206fefbb0d9cc8e0ba018cb31d65 +size 1775 diff --git a/data/minecraft/structure/village/snowy/streets/straight_03.nbt b/data/minecraft/structure/village/snowy/streets/straight_03.nbt index 71526297..a2c302cf 100644 --- a/data/minecraft/structure/village/snowy/streets/straight_03.nbt +++ b/data/minecraft/structure/village/snowy/streets/straight_03.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b93c4aeb881ad5af1711449e40b2fed717a90a652af9617ffd3a4e76d7dfd088 -size 1217 +oid sha256:bf8e847f3da24e4c347f0b59fb02b4cfad990b4a858959b7a4c247e12868f5f4 +size 1220 diff --git a/data/minecraft/structure/village/snowy/streets/straight_04.nbt b/data/minecraft/structure/village/snowy/streets/straight_04.nbt index 7027b44a..0d34c5cc 100644 --- a/data/minecraft/structure/village/snowy/streets/straight_04.nbt +++ b/data/minecraft/structure/village/snowy/streets/straight_04.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7825491c22a04876184b52094491c933c91c445bd06b78ef808ae156d17abc72 -size 707 +oid sha256:a5504039a0209346913db528b40ab8a022942e3e1e3440c00b9c6deb96242467 +size 710 diff --git a/data/minecraft/structure/village/snowy/streets/straight_06.nbt b/data/minecraft/structure/village/snowy/streets/straight_06.nbt index a36dc6d8..6dd0110c 100644 --- a/data/minecraft/structure/village/snowy/streets/straight_06.nbt +++ b/data/minecraft/structure/village/snowy/streets/straight_06.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:eed5f4247fc65a34bce2d74c328c8a0a02fb88b086ac8b7782b7e2265a0468fe -size 2617 +oid sha256:64b5d02af3386133a4f96bc0aee30303b61689f993ca592a868c476b17da52fb +size 2618 diff --git a/data/minecraft/structure/village/snowy/streets/straight_08.nbt b/data/minecraft/structure/village/snowy/streets/straight_08.nbt index 3a09d694..0350b9c5 100644 --- a/data/minecraft/structure/village/snowy/streets/straight_08.nbt +++ b/data/minecraft/structure/village/snowy/streets/straight_08.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:612c98cf6f8e741b671c59a29dbfd607019a6443c33a8954657cdf3c8270408e -size 1940 +oid sha256:ee1a58d06350e0d8cf1a1961760ff944a0e48cbda2a2bd0250be42b18719ca40 +size 1943 diff --git a/data/minecraft/structure/village/snowy/streets/turn_01.nbt b/data/minecraft/structure/village/snowy/streets/turn_01.nbt index 8d431a85..46b69070 100644 --- a/data/minecraft/structure/village/snowy/streets/turn_01.nbt +++ b/data/minecraft/structure/village/snowy/streets/turn_01.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:fbf12e1d4b8350fac7890c3b2c640aa8d2850a7d52c57a61a63a6d033879aafe -size 1232 +oid sha256:b2df93d57f554465a5635d3153233726ee7b869ef93064d4529451370fbf923f +size 1234 diff --git a/data/minecraft/structure/village/snowy/town_centers/snowy_meeting_point_1.nbt b/data/minecraft/structure/village/snowy/town_centers/snowy_meeting_point_1.nbt index 631d086b..7aa6aeca 100644 --- a/data/minecraft/structure/village/snowy/town_centers/snowy_meeting_point_1.nbt +++ b/data/minecraft/structure/village/snowy/town_centers/snowy_meeting_point_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ce8333e28c7ea69272cefeccaa07ed06bcee5f8d0d8db539f353ecbcdfb7097b -size 2732 +oid sha256:7a32967ff6ca05595c6392729a1f5ba5933108ca8c0a2853d9a8673f4d66e5ae +size 2734 diff --git a/data/minecraft/structure/village/snowy/town_centers/snowy_meeting_point_2.nbt b/data/minecraft/structure/village/snowy/town_centers/snowy_meeting_point_2.nbt index 94f710c4..8d91ed12 100644 --- a/data/minecraft/structure/village/snowy/town_centers/snowy_meeting_point_2.nbt +++ b/data/minecraft/structure/village/snowy/town_centers/snowy_meeting_point_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:457eda3c506e3290224f798bd62bf3ddbfde1372fca5cc39c6dc7d09d19ee22a -size 1034 +oid sha256:5c80e5168685dfe4a2779e60f07e85b7f175e7dae29a2b08c884d3bf4499828a +size 1036 diff --git a/data/minecraft/structure/village/snowy/town_centers/snowy_meeting_point_3.nbt b/data/minecraft/structure/village/snowy/town_centers/snowy_meeting_point_3.nbt index 7fcdcf11..8a5621b1 100644 --- a/data/minecraft/structure/village/snowy/town_centers/snowy_meeting_point_3.nbt +++ b/data/minecraft/structure/village/snowy/town_centers/snowy_meeting_point_3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:689acd74685d149c277751e074bb360af9212e9837dcefd4e79d711c1e50ffc0 -size 849 +oid sha256:637d174c10d9661c21f72a3f3a84b1c97c3cd3e2ba2bf044234282c8cf226d71 +size 852 diff --git a/data/minecraft/structure/village/snowy/villagers/baby.nbt b/data/minecraft/structure/village/snowy/villagers/baby.nbt index 1e7a5e5a..cc239641 100644 --- a/data/minecraft/structure/village/snowy/villagers/baby.nbt +++ b/data/minecraft/structure/village/snowy/villagers/baby.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f658cbde896e832ff463ade1986aaa46392144857e4bdaa9d66926eb65f5e22f -size 748 +oid sha256:a8bab00d84f4addc699abe94843344b5a6a4a8ed51845247ca04d501e5e5303a +size 749 diff --git a/data/minecraft/structure/village/snowy/villagers/nitwit.nbt b/data/minecraft/structure/village/snowy/villagers/nitwit.nbt index a091204c..524fbadb 100644 --- a/data/minecraft/structure/village/snowy/villagers/nitwit.nbt +++ b/data/minecraft/structure/village/snowy/villagers/nitwit.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:cbc027548b06292979fce65dbdca3e6466a940a0009f83351c58afe956f0999a +oid sha256:ef8f517553c3917e8cdd2ad5af94da21dff70d9f7b0431b9fd57f40f99d06eab size 749 diff --git a/data/minecraft/structure/village/snowy/villagers/unemployed.nbt b/data/minecraft/structure/village/snowy/villagers/unemployed.nbt index c3ba61ab..0edae8ba 100644 --- a/data/minecraft/structure/village/snowy/villagers/unemployed.nbt +++ b/data/minecraft/structure/village/snowy/villagers/unemployed.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1fb33cdd42343034840f7aa13abc43bc84ab9b7f4650fe7a577bcf0636c06254 +oid sha256:5802d07fca4c0af185d3023642f3435250a82cb89472caf400316fda898cd74a size 746 diff --git a/data/minecraft/structure/village/snowy/zombie/houses/snowy_medium_house_1.nbt b/data/minecraft/structure/village/snowy/zombie/houses/snowy_medium_house_1.nbt index f894e3d8..10c8fee7 100644 --- a/data/minecraft/structure/village/snowy/zombie/houses/snowy_medium_house_1.nbt +++ b/data/minecraft/structure/village/snowy/zombie/houses/snowy_medium_house_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:36c8c07183f7110c5b61394b4241de90a244145b49e3aacd3822878bdbc1140a -size 1598 +oid sha256:f062b4272b1483365c75f6bd03dafc66215de19a51a97b8f2b797addc59f3f76 +size 1601 diff --git a/data/minecraft/structure/village/snowy/zombie/houses/snowy_medium_house_2.nbt b/data/minecraft/structure/village/snowy/zombie/houses/snowy_medium_house_2.nbt index 709f60c8..62ad0e22 100644 --- a/data/minecraft/structure/village/snowy/zombie/houses/snowy_medium_house_2.nbt +++ b/data/minecraft/structure/village/snowy/zombie/houses/snowy_medium_house_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3263e79a993ade1c14b72f81e0c6678867f82c0e91d4a6429239b43ed9b6f226 -size 3557 +oid sha256:8165f2b0f6991d0635ee585eed9b2badf0c3c621b832fc050bdcb4f819a69b35 +size 3559 diff --git a/data/minecraft/structure/village/snowy/zombie/houses/snowy_medium_house_3.nbt b/data/minecraft/structure/village/snowy/zombie/houses/snowy_medium_house_3.nbt index 22e6c384..9ed1c536 100644 --- a/data/minecraft/structure/village/snowy/zombie/houses/snowy_medium_house_3.nbt +++ b/data/minecraft/structure/village/snowy/zombie/houses/snowy_medium_house_3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f3a2160ae0a9261662a443a86266e8bb2a5d9ae4d66873e6151997778139e9f0 -size 1192 +oid sha256:5773f82030227c269a3b95e4f632c84104ef467950183f3fcb16fda3d4f8ab39 +size 1195 diff --git a/data/minecraft/structure/village/snowy/zombie/houses/snowy_small_house_1.nbt b/data/minecraft/structure/village/snowy/zombie/houses/snowy_small_house_1.nbt index 769585bd..078e3650 100644 --- a/data/minecraft/structure/village/snowy/zombie/houses/snowy_small_house_1.nbt +++ b/data/minecraft/structure/village/snowy/zombie/houses/snowy_small_house_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:367d8de27204ff4b31faa99fa91ec7cebbcd5f8b93d0e529fb9566cae8ff7c25 -size 1321 +oid sha256:f59d98cb392d950a4ad4dbd6995e6053af336412547321f70535a8f3956a1d01 +size 1323 diff --git a/data/minecraft/structure/village/snowy/zombie/houses/snowy_small_house_2.nbt b/data/minecraft/structure/village/snowy/zombie/houses/snowy_small_house_2.nbt index 5b020c21..4176f32b 100644 --- a/data/minecraft/structure/village/snowy/zombie/houses/snowy_small_house_2.nbt +++ b/data/minecraft/structure/village/snowy/zombie/houses/snowy_small_house_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8b2ff07a33d0e72684c4c5285173550dcc9256b6840744b57fd938184290c0c0 -size 2119 +oid sha256:c3a3aacf88ce1886305c3542cd63a04d16aba89a5b761fdf08934d33a450140e +size 2121 diff --git a/data/minecraft/structure/village/snowy/zombie/houses/snowy_small_house_3.nbt b/data/minecraft/structure/village/snowy/zombie/houses/snowy_small_house_3.nbt index 98620ee0..3446e4bf 100644 --- a/data/minecraft/structure/village/snowy/zombie/houses/snowy_small_house_3.nbt +++ b/data/minecraft/structure/village/snowy/zombie/houses/snowy_small_house_3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:623ce250d2ea08609f56f81565be08961f1846ebf4c324d739fd0c903cfcac47 -size 1793 +oid sha256:976eb9916bf6edf7cd071291ca9852cccf10ec718fe1fc55e6a3eb8fef5febe8 +size 1796 diff --git a/data/minecraft/structure/village/snowy/zombie/houses/snowy_small_house_4.nbt b/data/minecraft/structure/village/snowy/zombie/houses/snowy_small_house_4.nbt index 2ea68ff5..ec85cc9c 100644 --- a/data/minecraft/structure/village/snowy/zombie/houses/snowy_small_house_4.nbt +++ b/data/minecraft/structure/village/snowy/zombie/houses/snowy_small_house_4.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:01f0e8283773bfdabed061c5e126e14f08a936bd08f8f6708a83b8db70cd83ad -size 1590 +oid sha256:20efe4ebbe8c471cd437467213f811c6e64aeb6483ab03fe47e6b82a0bd434df +size 1592 diff --git a/data/minecraft/structure/village/snowy/zombie/houses/snowy_small_house_5.nbt b/data/minecraft/structure/village/snowy/zombie/houses/snowy_small_house_5.nbt index 95bdee7e..34e54191 100644 --- a/data/minecraft/structure/village/snowy/zombie/houses/snowy_small_house_5.nbt +++ b/data/minecraft/structure/village/snowy/zombie/houses/snowy_small_house_5.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5ee3b819b96c4a4541530a6f944cafb312af7d0114accd038ee84a56f79d8237 -size 1146 +oid sha256:286a3de3644dfabf1ca00852ad6e5c8daa20a5de0b69fd11036744aec3afac05 +size 1148 diff --git a/data/minecraft/structure/village/snowy/zombie/houses/snowy_small_house_6.nbt b/data/minecraft/structure/village/snowy/zombie/houses/snowy_small_house_6.nbt index 5a54b776..18e8ea05 100644 --- a/data/minecraft/structure/village/snowy/zombie/houses/snowy_small_house_6.nbt +++ b/data/minecraft/structure/village/snowy/zombie/houses/snowy_small_house_6.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:fdcfd0fe01be65edca2a941b7714faaeae4285bbbe13a8c81a3f7011b927cd6b -size 2203 +oid sha256:c435a808d793f915755f42dd98739e96eea9f6bf7b65429f6824dd37a583f6f4 +size 2206 diff --git a/data/minecraft/structure/village/snowy/zombie/houses/snowy_small_house_7.nbt b/data/minecraft/structure/village/snowy/zombie/houses/snowy_small_house_7.nbt index 136a8e34..f1e78f88 100644 --- a/data/minecraft/structure/village/snowy/zombie/houses/snowy_small_house_7.nbt +++ b/data/minecraft/structure/village/snowy/zombie/houses/snowy_small_house_7.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7ede458a8a21e4e0786b5fc4500877ba129e5be81cf85ad2d50d34ac1cace38f -size 1623 +oid sha256:fc76b8bd9ecccb97111957fd932c037ba05e385bfd28c0a94c2d122708c44e77 +size 1625 diff --git a/data/minecraft/structure/village/snowy/zombie/houses/snowy_small_house_8.nbt b/data/minecraft/structure/village/snowy/zombie/houses/snowy_small_house_8.nbt index 32120426..7b6362b7 100644 --- a/data/minecraft/structure/village/snowy/zombie/houses/snowy_small_house_8.nbt +++ b/data/minecraft/structure/village/snowy/zombie/houses/snowy_small_house_8.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:485a424f607f70a234059ed1a90cbdaa6511e9a171cbdad5651649996ca908c2 -size 857 +oid sha256:e2ddc530b007b2ce48c7f2855cb10837488f8c88771d5a10a465a992d0b02524 +size 860 diff --git a/data/minecraft/structure/village/snowy/zombie/streets/corner_01.nbt b/data/minecraft/structure/village/snowy/zombie/streets/corner_01.nbt index 366d2a5e..82ccdb50 100644 --- a/data/minecraft/structure/village/snowy/zombie/streets/corner_01.nbt +++ b/data/minecraft/structure/village/snowy/zombie/streets/corner_01.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1fc4402b0877127515f843b849872bc2fb370d82e279b9eb40cd36d0535f545b -size 1105 +oid sha256:573716f57ce0fa6fe575b200285be027929bad8a4f03d7794ff1e5e3244bb708 +size 1108 diff --git a/data/minecraft/structure/village/snowy/zombie/streets/corner_02.nbt b/data/minecraft/structure/village/snowy/zombie/streets/corner_02.nbt index aa550f02..30fa41a7 100644 --- a/data/minecraft/structure/village/snowy/zombie/streets/corner_02.nbt +++ b/data/minecraft/structure/village/snowy/zombie/streets/corner_02.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8782f1228773e9620ff1d523c882f14e5d34da8a1047bee8be8ffb85d693dcc2 -size 1813 +oid sha256:b5b3516263c69581a52c144714ae751a87e48719352987aaf78a086219e854ed +size 1816 diff --git a/data/minecraft/structure/village/snowy/zombie/streets/corner_03.nbt b/data/minecraft/structure/village/snowy/zombie/streets/corner_03.nbt index 9cc3294a..47f79568 100644 --- a/data/minecraft/structure/village/snowy/zombie/streets/corner_03.nbt +++ b/data/minecraft/structure/village/snowy/zombie/streets/corner_03.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:867e8fdbef2ea60b404e279537d30b1f34e0a4829d5d7d9d8c31d6067a9f53e4 -size 398 +oid sha256:0a17b95b8f1606f27bfbc5e46955c16149d62a68f1b5ea8df0422bd2b717e1ec +size 400 diff --git a/data/minecraft/structure/village/snowy/zombie/streets/crossroad_01.nbt b/data/minecraft/structure/village/snowy/zombie/streets/crossroad_01.nbt index 22c0c2e9..200720a4 100644 --- a/data/minecraft/structure/village/snowy/zombie/streets/crossroad_01.nbt +++ b/data/minecraft/structure/village/snowy/zombie/streets/crossroad_01.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:63096b0c9b52b3eff60f124f969bce9ab5ff86f3e1f322ba25dcfa2b2351c87d -size 1923 +oid sha256:4864e0821364f0fd85371fdf06aef9b2d9f2c3b7de302a4c504a397566be36e7 +size 1925 diff --git a/data/minecraft/structure/village/snowy/zombie/streets/crossroad_02.nbt b/data/minecraft/structure/village/snowy/zombie/streets/crossroad_02.nbt index 7b268405..723a1226 100644 --- a/data/minecraft/structure/village/snowy/zombie/streets/crossroad_02.nbt +++ b/data/minecraft/structure/village/snowy/zombie/streets/crossroad_02.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:cf8f8ad1781177ea6c5427b364b08059059ad20f6d2900ab8d40c23dacc5db2d -size 1960 +oid sha256:38a1387994e1efe11280fc4c4182aedf21efd3ccd0bd05f351a79ee640c9b4ab +size 1963 diff --git a/data/minecraft/structure/village/snowy/zombie/streets/crossroad_03.nbt b/data/minecraft/structure/village/snowy/zombie/streets/crossroad_03.nbt index 6c726304..b86fc93e 100644 --- a/data/minecraft/structure/village/snowy/zombie/streets/crossroad_03.nbt +++ b/data/minecraft/structure/village/snowy/zombie/streets/crossroad_03.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:bdaf5f9886a8a59856340310ee0f89ef900ee63ec8a043eac9cf14af3d30c23f -size 2027 +oid sha256:af198796b7beb4aa7939238ccea531f1908ce49ece25260f4126ba0b3fd8e103 +size 2030 diff --git a/data/minecraft/structure/village/snowy/zombie/streets/crossroad_04.nbt b/data/minecraft/structure/village/snowy/zombie/streets/crossroad_04.nbt index 2b01855f..f39e892a 100644 --- a/data/minecraft/structure/village/snowy/zombie/streets/crossroad_04.nbt +++ b/data/minecraft/structure/village/snowy/zombie/streets/crossroad_04.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:81b81ee81185fc08052bbfb48724b1c629f2a1fea95501a8562687a94d71a57b -size 434 +oid sha256:083f9c3bfeb77fb7ce2d8d469ae97fe1ddf000ad4f5b26f72777a383c8c4095c +size 436 diff --git a/data/minecraft/structure/village/snowy/zombie/streets/crossroad_05.nbt b/data/minecraft/structure/village/snowy/zombie/streets/crossroad_05.nbt index d2cae4a5..3510b434 100644 --- a/data/minecraft/structure/village/snowy/zombie/streets/crossroad_05.nbt +++ b/data/minecraft/structure/village/snowy/zombie/streets/crossroad_05.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f6408b56fa759b452f5e2e2caf72496d3150c395d44705095a87439f1cd9223b -size 476 +oid sha256:bf3665c54d861c6d34e0880682b1e08d40b56ad7acd9b61a7af5f40aee4afbc5 +size 478 diff --git a/data/minecraft/structure/village/snowy/zombie/streets/crossroad_06.nbt b/data/minecraft/structure/village/snowy/zombie/streets/crossroad_06.nbt index 90154cf5..cd12950e 100644 --- a/data/minecraft/structure/village/snowy/zombie/streets/crossroad_06.nbt +++ b/data/minecraft/structure/village/snowy/zombie/streets/crossroad_06.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ffa9dceff918a85a750cb07803e5bb8f103edefebf4bb74cce10485d728f03f6 -size 530 +oid sha256:30f7893b6fce7a39b8e6ed752d6da7a63548fd7af6f2a740af525939e8705cca +size 533 diff --git a/data/minecraft/structure/village/snowy/zombie/streets/square_01.nbt b/data/minecraft/structure/village/snowy/zombie/streets/square_01.nbt index 4f50dc18..61cec6f1 100644 --- a/data/minecraft/structure/village/snowy/zombie/streets/square_01.nbt +++ b/data/minecraft/structure/village/snowy/zombie/streets/square_01.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b40f81c186ed512c67523152af191b9cc861c4cf4139970e0c573656c371cebb -size 1514 +oid sha256:cfe5ae39303a84935c0ddc9f8989144eaa8b64a3c3bdd25c16ac0d06763ed750 +size 1517 diff --git a/data/minecraft/structure/village/snowy/zombie/streets/straight_01.nbt b/data/minecraft/structure/village/snowy/zombie/streets/straight_01.nbt index bcd65c72..d0d16319 100644 --- a/data/minecraft/structure/village/snowy/zombie/streets/straight_01.nbt +++ b/data/minecraft/structure/village/snowy/zombie/streets/straight_01.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:92ccc76970cd8ec874b868baa5510a9790dc7677cc6a179ea12b8ca994b245f4 -size 1854 +oid sha256:3e048e5aebd7ffa8169367dedd1326a4780702e518d84877042eb8d4a075902a +size 1857 diff --git a/data/minecraft/structure/village/snowy/zombie/streets/straight_02.nbt b/data/minecraft/structure/village/snowy/zombie/streets/straight_02.nbt index 82810109..ba634dae 100644 --- a/data/minecraft/structure/village/snowy/zombie/streets/straight_02.nbt +++ b/data/minecraft/structure/village/snowy/zombie/streets/straight_02.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f36df1c6c77d9a8999e2799f318082ea1cf57726653548b3bd6ea3cc326c9161 -size 1779 +oid sha256:f4b61d4f18a7cc0dd5494c823b0f487e05ccd9fa4a7a78187db6eef6246dc771 +size 1782 diff --git a/data/minecraft/structure/village/snowy/zombie/streets/straight_03.nbt b/data/minecraft/structure/village/snowy/zombie/streets/straight_03.nbt index 1235d678..c4872199 100644 --- a/data/minecraft/structure/village/snowy/zombie/streets/straight_03.nbt +++ b/data/minecraft/structure/village/snowy/zombie/streets/straight_03.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:72a4edf20c1ab4cb748bf18da7cf855458731105dc373874a90c95983e06afdf -size 1222 +oid sha256:25e6587c801b5dbf1915edac5274db90ff55ed014ae2e72ac3f9208db29079fa +size 1225 diff --git a/data/minecraft/structure/village/snowy/zombie/streets/straight_04.nbt b/data/minecraft/structure/village/snowy/zombie/streets/straight_04.nbt index a682a250..567ae77c 100644 --- a/data/minecraft/structure/village/snowy/zombie/streets/straight_04.nbt +++ b/data/minecraft/structure/village/snowy/zombie/streets/straight_04.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d918590f0af897fb66f1064946ee2327ebd43321444c43e008463fba839420b2 -size 717 +oid sha256:ddab494b52339f38501cf51e4506b4072c4eaea5fa8cd8624dc615911f697857 +size 719 diff --git a/data/minecraft/structure/village/snowy/zombie/streets/straight_06.nbt b/data/minecraft/structure/village/snowy/zombie/streets/straight_06.nbt index 0ea4e2d1..8b42d18f 100644 --- a/data/minecraft/structure/village/snowy/zombie/streets/straight_06.nbt +++ b/data/minecraft/structure/village/snowy/zombie/streets/straight_06.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:10184839906fd2f6d3b9012d75a1e503f50768bc8a9f153e14856523d340f7f4 -size 2621 +oid sha256:3521fbab3994eef1f8e5c96a4939209dfdc7329bb213b5e67a0987bbe556df4f +size 2624 diff --git a/data/minecraft/structure/village/snowy/zombie/streets/straight_08.nbt b/data/minecraft/structure/village/snowy/zombie/streets/straight_08.nbt index 2b996fab..c92a0ed8 100644 --- a/data/minecraft/structure/village/snowy/zombie/streets/straight_08.nbt +++ b/data/minecraft/structure/village/snowy/zombie/streets/straight_08.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a77382622af450eb1dbcaf726e35e131a95984e1543288f44adcb70f60739193 -size 1945 +oid sha256:0a2404963f730682474ae3e0ed95e50aefc3cd394bc162a74be51f502f8155a7 +size 1948 diff --git a/data/minecraft/structure/village/snowy/zombie/streets/turn_01.nbt b/data/minecraft/structure/village/snowy/zombie/streets/turn_01.nbt index b646fd26..c733b554 100644 --- a/data/minecraft/structure/village/snowy/zombie/streets/turn_01.nbt +++ b/data/minecraft/structure/village/snowy/zombie/streets/turn_01.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:14e51a5be4dd8d0e1087c6a8355bcd633089cf726712bc1851c05f3485313a58 -size 1236 +oid sha256:132f4350c5de1369c4a23b63d4e19b0f648b5def54f835cdae68c06873c2cbd6 +size 1239 diff --git a/data/minecraft/structure/village/snowy/zombie/town_centers/snowy_meeting_point_1.nbt b/data/minecraft/structure/village/snowy/zombie/town_centers/snowy_meeting_point_1.nbt index 12ab6286..8255abcf 100644 --- a/data/minecraft/structure/village/snowy/zombie/town_centers/snowy_meeting_point_1.nbt +++ b/data/minecraft/structure/village/snowy/zombie/town_centers/snowy_meeting_point_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:51fc1af34f16373cc88c3a6658077f29af727161e839a546bbe797076c1d0583 -size 2692 +oid sha256:1573670191b0d531d46ec11e3a533c3137bc3784ce23412682cdedb659646bf0 +size 2694 diff --git a/data/minecraft/structure/village/snowy/zombie/town_centers/snowy_meeting_point_2.nbt b/data/minecraft/structure/village/snowy/zombie/town_centers/snowy_meeting_point_2.nbt index fb307242..dca146fb 100644 --- a/data/minecraft/structure/village/snowy/zombie/town_centers/snowy_meeting_point_2.nbt +++ b/data/minecraft/structure/village/snowy/zombie/town_centers/snowy_meeting_point_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c3f935dead2625ca86d3bee0b4d03af5300c16d9c6696f9b5b5e2f8060264ef0 -size 989 +oid sha256:f0f94812df36a36e911341cfb8a59f617b952b40bc3a5747e94a703a308f0ac7 +size 991 diff --git a/data/minecraft/structure/village/snowy/zombie/town_centers/snowy_meeting_point_3.nbt b/data/minecraft/structure/village/snowy/zombie/town_centers/snowy_meeting_point_3.nbt index 6a28c20a..922d57b3 100644 --- a/data/minecraft/structure/village/snowy/zombie/town_centers/snowy_meeting_point_3.nbt +++ b/data/minecraft/structure/village/snowy/zombie/town_centers/snowy_meeting_point_3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:669e8cd02ee36ee0ceccdba1746176017e6bc8bb937df91eab9eeb06684015e2 -size 815 +oid sha256:082c2bee707a5bc76402431831b26b7353fbb5adcb6a937e6b6193f39b06e5d3 +size 817 diff --git a/data/minecraft/structure/village/snowy/zombie/villagers/nitwit.nbt b/data/minecraft/structure/village/snowy/zombie/villagers/nitwit.nbt index 0aff9235..6db90263 100644 --- a/data/minecraft/structure/village/snowy/zombie/villagers/nitwit.nbt +++ b/data/minecraft/structure/village/snowy/zombie/villagers/nitwit.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:67ef838ae7c6603f386bd0a64c0d2c636d8ff9fc18fe443372d22ccbd5c85714 +oid sha256:f8103d404eabe5c87d6a789c3306dbe50edf94ac30c35d6124c64a8263eb8872 size 755 diff --git a/data/minecraft/structure/village/snowy/zombie/villagers/unemployed.nbt b/data/minecraft/structure/village/snowy/zombie/villagers/unemployed.nbt index 7bbd907f..b278091e 100644 --- a/data/minecraft/structure/village/snowy/zombie/villagers/unemployed.nbt +++ b/data/minecraft/structure/village/snowy/zombie/villagers/unemployed.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f806875a6af5ed9facdf030387bfd4178c1b4d43de047f1999f2e2087424cc89 +oid sha256:ad573ccd0ccf1ad4e537a3014934aaa0f2e40d04113566ede87e9e1888a8051b size 752 diff --git a/data/minecraft/structure/village/taiga/houses/taiga_animal_pen_1.nbt b/data/minecraft/structure/village/taiga/houses/taiga_animal_pen_1.nbt index e156f528..99041526 100644 --- a/data/minecraft/structure/village/taiga/houses/taiga_animal_pen_1.nbt +++ b/data/minecraft/structure/village/taiga/houses/taiga_animal_pen_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:cb0fbc489e327523024a7227f3b10f6835509e78270ac701a2f27e676233f51b -size 2088 +oid sha256:dc5029b59e5626012fbd7f58e870f47e25a2fd772a58368b3d6c9667e7530b23 +size 2091 diff --git a/data/minecraft/structure/village/taiga/houses/taiga_armorer_2.nbt b/data/minecraft/structure/village/taiga/houses/taiga_armorer_2.nbt index bb8d8623..3eec9307 100644 --- a/data/minecraft/structure/village/taiga/houses/taiga_armorer_2.nbt +++ b/data/minecraft/structure/village/taiga/houses/taiga_armorer_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8ec832f801f06fdd804cfab4bda99ea4ea2ce2968f94ba07a84ef69f7997992a -size 2531 +oid sha256:b05dff6a165cf1f8966897d31f39ccf0e02ea5d895c3a404a9689c90a3138abd +size 2528 diff --git a/data/minecraft/structure/village/taiga/houses/taiga_armorer_house_1.nbt b/data/minecraft/structure/village/taiga/houses/taiga_armorer_house_1.nbt index fc171c1a..8070d9c9 100644 --- a/data/minecraft/structure/village/taiga/houses/taiga_armorer_house_1.nbt +++ b/data/minecraft/structure/village/taiga/houses/taiga_armorer_house_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e7400f08a1f41c8b36c6194c37e63627732295cbcffa76184301cece4a9f9ff7 -size 2055 +oid sha256:2249e45864ba8bad34d427018f353cff04a0f08d51c1998c0821058f6f7e0a03 +size 2058 diff --git a/data/minecraft/structure/village/taiga/houses/taiga_butcher_shop_1.nbt b/data/minecraft/structure/village/taiga/houses/taiga_butcher_shop_1.nbt index e9363044..1430b63d 100644 --- a/data/minecraft/structure/village/taiga/houses/taiga_butcher_shop_1.nbt +++ b/data/minecraft/structure/village/taiga/houses/taiga_butcher_shop_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:edfcadd7306e265f13e5a5a1a828c8b8eee9eaeb1fe48e0bc374658e6d3ef159 -size 3277 +oid sha256:7f4e3ee6c69c4a32017940d87958c6fea7f2f6afef8d0c89f8a091b5aaa3cf0e +size 3279 diff --git a/data/minecraft/structure/village/taiga/houses/taiga_cartographer_house_1.nbt b/data/minecraft/structure/village/taiga/houses/taiga_cartographer_house_1.nbt index d2635caf..f183c3a7 100644 --- a/data/minecraft/structure/village/taiga/houses/taiga_cartographer_house_1.nbt +++ b/data/minecraft/structure/village/taiga/houses/taiga_cartographer_house_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:59661ea9f1f89c053eb751aec4b08523b62ff7dac4e35f2aa04913ef3f2e8242 -size 2603 +oid sha256:859475e5edc4e8dd06d93dbe75adfcf761dd2098cd9070276d622d36213e6e6c +size 2607 diff --git a/data/minecraft/structure/village/taiga/houses/taiga_fisher_cottage_1.nbt b/data/minecraft/structure/village/taiga/houses/taiga_fisher_cottage_1.nbt index 2a8f320f..eea13209 100644 --- a/data/minecraft/structure/village/taiga/houses/taiga_fisher_cottage_1.nbt +++ b/data/minecraft/structure/village/taiga/houses/taiga_fisher_cottage_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ec0bb08577e26bc1419ff0a1657cb82daca557f6e187d054738e6635ee794802 -size 3652 +oid sha256:ac850024212d94f96b2fde65c09a0927459c5927d25d811a507cee2ab34415d2 +size 3655 diff --git a/data/minecraft/structure/village/taiga/houses/taiga_fletcher_house_1.nbt b/data/minecraft/structure/village/taiga/houses/taiga_fletcher_house_1.nbt index 3252667d..ef71237d 100644 --- a/data/minecraft/structure/village/taiga/houses/taiga_fletcher_house_1.nbt +++ b/data/minecraft/structure/village/taiga/houses/taiga_fletcher_house_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:615e01179c181497381d70e119aa069bf995d52cd5f91fe5ed6d6b261f0199e9 -size 2765 +oid sha256:e15e5e497ade629bd5287612b5f0cd391b1906c7c0d4fc0b1a3ffe0ceb8a9478 +size 2768 diff --git a/data/minecraft/structure/village/taiga/houses/taiga_large_farm_1.nbt b/data/minecraft/structure/village/taiga/houses/taiga_large_farm_1.nbt index 6b989965..d91f19f5 100644 --- a/data/minecraft/structure/village/taiga/houses/taiga_large_farm_1.nbt +++ b/data/minecraft/structure/village/taiga/houses/taiga_large_farm_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:bbdb49d30d339339eb8f9a9fb479304e5283fc00c638039c2ef208dcbacbb111 -size 2211 +oid sha256:0516f275702d9317ff6024b97b9c3023c50647d8db80cf845ea2e9fe9a850d6b +size 2213 diff --git a/data/minecraft/structure/village/taiga/houses/taiga_large_farm_2.nbt b/data/minecraft/structure/village/taiga/houses/taiga_large_farm_2.nbt index 1e7e19b6..9fe1e352 100644 --- a/data/minecraft/structure/village/taiga/houses/taiga_large_farm_2.nbt +++ b/data/minecraft/structure/village/taiga/houses/taiga_large_farm_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:22c5a7b4961995b06f48ff71ebda30b8697821425ca6cf73d82496331481cbe3 -size 1598 +oid sha256:ee588b5e828787941c21f89186a889880975430c70d59f849fca08b58194bd88 +size 1601 diff --git a/data/minecraft/structure/village/taiga/houses/taiga_library_1.nbt b/data/minecraft/structure/village/taiga/houses/taiga_library_1.nbt index aeaa20ae..056c0459 100644 --- a/data/minecraft/structure/village/taiga/houses/taiga_library_1.nbt +++ b/data/minecraft/structure/village/taiga/houses/taiga_library_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6dcb93dd7bc70de09f418b2554db5c99e87a4e7ee93ade2f6bdbe8b14ef960ca -size 3446 +oid sha256:2a58a79b0e379f68549fc2e4386b5a6f3604eca8b42103f27880a59fe3af7842 +size 3449 diff --git a/data/minecraft/structure/village/taiga/houses/taiga_masons_house_1.nbt b/data/minecraft/structure/village/taiga/houses/taiga_masons_house_1.nbt index 1cee31f4..deddc30a 100644 --- a/data/minecraft/structure/village/taiga/houses/taiga_masons_house_1.nbt +++ b/data/minecraft/structure/village/taiga/houses/taiga_masons_house_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:676f930415617dbaf5b82ca85d036bd331e0746e3b96be968b8a7368334cb9c9 -size 2189 +oid sha256:d6225df2d12f025a3317f29ac5c92a24bb26d6dc7e477a07a46437d0c6fd59ac +size 2191 diff --git a/data/minecraft/structure/village/taiga/houses/taiga_medium_house_1.nbt b/data/minecraft/structure/village/taiga/houses/taiga_medium_house_1.nbt index c098e0ec..aca0dfeb 100644 --- a/data/minecraft/structure/village/taiga/houses/taiga_medium_house_1.nbt +++ b/data/minecraft/structure/village/taiga/houses/taiga_medium_house_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d8bf69e8766c65491031e9c0388235c69791e7f6abcee4486b2deac4490e172f -size 2834 +oid sha256:c8a1092d36e98bb3297847266d26269322c55e1f5c0bb3ff0579594e085752b2 +size 2837 diff --git a/data/minecraft/structure/village/taiga/houses/taiga_medium_house_2.nbt b/data/minecraft/structure/village/taiga/houses/taiga_medium_house_2.nbt index 8b2a7224..ecfa1f7d 100644 --- a/data/minecraft/structure/village/taiga/houses/taiga_medium_house_2.nbt +++ b/data/minecraft/structure/village/taiga/houses/taiga_medium_house_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:36413eacaa63cba7fb201d1806f55771830ddaeea5857a609c4c20c6692af899 -size 2608 +oid sha256:57ded897464d0050436976d30335dff66a2317b9c9bf431b9f7f8fba2f0da47b +size 2610 diff --git a/data/minecraft/structure/village/taiga/houses/taiga_medium_house_3.nbt b/data/minecraft/structure/village/taiga/houses/taiga_medium_house_3.nbt index 7f847b23..59755fc2 100644 --- a/data/minecraft/structure/village/taiga/houses/taiga_medium_house_3.nbt +++ b/data/minecraft/structure/village/taiga/houses/taiga_medium_house_3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ffb9ce01ef8f1c54270a37b75c943cf5713efa252b6984264953184e03239fcd -size 3064 +oid sha256:765a8364da1f6a8347188b6ee189238be4828f789ba95ac13b4c29a9d96132a7 +size 3066 diff --git a/data/minecraft/structure/village/taiga/houses/taiga_medium_house_4.nbt b/data/minecraft/structure/village/taiga/houses/taiga_medium_house_4.nbt index c4b2d414..ae30bab3 100644 --- a/data/minecraft/structure/village/taiga/houses/taiga_medium_house_4.nbt +++ b/data/minecraft/structure/village/taiga/houses/taiga_medium_house_4.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8b2ce0e2ea01e78da45a10d38caa49321f8ede9c46f0ce536958f849359518ac -size 2751 +oid sha256:909b5fecf3c7855b23e71f9ad0eb6350714d8bffb26cbc682eec5b84f22b1f0b +size 2754 diff --git a/data/minecraft/structure/village/taiga/houses/taiga_shepherds_house_1.nbt b/data/minecraft/structure/village/taiga/houses/taiga_shepherds_house_1.nbt index b46521d7..3c5c72a7 100644 --- a/data/minecraft/structure/village/taiga/houses/taiga_shepherds_house_1.nbt +++ b/data/minecraft/structure/village/taiga/houses/taiga_shepherds_house_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:98676a9972696daa3f810759d213d2283881c00c4feb5b24f6dca4eff4187279 -size 3015 +oid sha256:f09002f7be0cb974bf955648992f45ed6b4d499f479822c35c16f3763305f588 +size 3017 diff --git a/data/minecraft/structure/village/taiga/houses/taiga_small_farm_1.nbt b/data/minecraft/structure/village/taiga/houses/taiga_small_farm_1.nbt index 8a9fafc6..1f6f7cb7 100644 --- a/data/minecraft/structure/village/taiga/houses/taiga_small_farm_1.nbt +++ b/data/minecraft/structure/village/taiga/houses/taiga_small_farm_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:cb138b660df5c8dcfdda545a05e8f75c170da10851c6fe35f21f6a9b8ef9ec5f -size 1256 +oid sha256:18f1ca6d2e0854f03f15a46ade04c3b914ceb2f7e27713ebc73b6e1e9f1db462 +size 1258 diff --git a/data/minecraft/structure/village/taiga/houses/taiga_small_house_1.nbt b/data/minecraft/structure/village/taiga/houses/taiga_small_house_1.nbt index 2a92925c..862e8e60 100644 --- a/data/minecraft/structure/village/taiga/houses/taiga_small_house_1.nbt +++ b/data/minecraft/structure/village/taiga/houses/taiga_small_house_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6f9bfa522df8f723fbc9fee70c0be1ff4f0fc8bb46dce8246a719d1d72150ad9 -size 2383 +oid sha256:1832b84e50b850a90c05ae0065668a22404067398baefe107f33b3cbc9398ecb +size 2386 diff --git a/data/minecraft/structure/village/taiga/houses/taiga_small_house_2.nbt b/data/minecraft/structure/village/taiga/houses/taiga_small_house_2.nbt index 6f10e04e..f878edec 100644 --- a/data/minecraft/structure/village/taiga/houses/taiga_small_house_2.nbt +++ b/data/minecraft/structure/village/taiga/houses/taiga_small_house_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7e7f1250ae4004f79b30ed4829234aa2da801dad53cee157e0cacc4601686edf -size 1774 +oid sha256:6c2cafb702f45db9406484af468911d12e8bbbb60a84b3a29e0d6317e375627d +size 1777 diff --git a/data/minecraft/structure/village/taiga/houses/taiga_small_house_3.nbt b/data/minecraft/structure/village/taiga/houses/taiga_small_house_3.nbt index eb519617..bd738ce7 100644 --- a/data/minecraft/structure/village/taiga/houses/taiga_small_house_3.nbt +++ b/data/minecraft/structure/village/taiga/houses/taiga_small_house_3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4cd4e260a0bd83fefbc4ea69de8eda888bfbccb27aaed34c54c3f5483c59ab5d -size 1869 +oid sha256:48fa0825fc1c765e8bf5b2a4c7790d7ba179a21fe949b63abe0fc336c16100a7 +size 1871 diff --git a/data/minecraft/structure/village/taiga/houses/taiga_small_house_4.nbt b/data/minecraft/structure/village/taiga/houses/taiga_small_house_4.nbt index 31d3eaaf..ad92ed51 100644 --- a/data/minecraft/structure/village/taiga/houses/taiga_small_house_4.nbt +++ b/data/minecraft/structure/village/taiga/houses/taiga_small_house_4.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:102b7a47dd5ae5169415cac205560ae6d3480a26516d7e1d308f582e3a72fdd4 -size 1606 +oid sha256:7789a648fa932595427ca3ebdb03178e515257f47aa4f967097fe2b860e3c3d3 +size 1609 diff --git a/data/minecraft/structure/village/taiga/houses/taiga_small_house_5.nbt b/data/minecraft/structure/village/taiga/houses/taiga_small_house_5.nbt index db48f703..628eeb4f 100644 --- a/data/minecraft/structure/village/taiga/houses/taiga_small_house_5.nbt +++ b/data/minecraft/structure/village/taiga/houses/taiga_small_house_5.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0340898a9cbdb3b57d68e246a4a1fadd3c416e584d45863e08cb0d46e32af944 -size 2039 +oid sha256:3e07df1b14a05c4f0205919787666248c610662d470c6e7531deb906251858df +size 2042 diff --git a/data/minecraft/structure/village/taiga/houses/taiga_tannery_1.nbt b/data/minecraft/structure/village/taiga/houses/taiga_tannery_1.nbt index fdd1020e..a420d103 100644 --- a/data/minecraft/structure/village/taiga/houses/taiga_tannery_1.nbt +++ b/data/minecraft/structure/village/taiga/houses/taiga_tannery_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:848d9c513369e184f2dbe9fe6a51b6551717e3a302f70c5e2160a3d6db474748 -size 2154 +oid sha256:b91acb7c9df8f3ab0dbc07953fb1009e90b4201bd41b9518e519796285574259 +size 2156 diff --git a/data/minecraft/structure/village/taiga/houses/taiga_temple_1.nbt b/data/minecraft/structure/village/taiga/houses/taiga_temple_1.nbt index a4a13cf8..33af7939 100644 --- a/data/minecraft/structure/village/taiga/houses/taiga_temple_1.nbt +++ b/data/minecraft/structure/village/taiga/houses/taiga_temple_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3ad6ef6eeb6564147bcd27353080c105598ef547394f2e817d00fc8b753f9f9c -size 6642 +oid sha256:24463bee6a4467c302d1bf17beddd55c03fa870ee3d876fc12f9c52bdbb354c8 +size 6643 diff --git a/data/minecraft/structure/village/taiga/houses/taiga_tool_smith_1.nbt b/data/minecraft/structure/village/taiga/houses/taiga_tool_smith_1.nbt index f62034f2..34ad8d64 100644 --- a/data/minecraft/structure/village/taiga/houses/taiga_tool_smith_1.nbt +++ b/data/minecraft/structure/village/taiga/houses/taiga_tool_smith_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:84ef9fa550e5c0df5b0177119f5db76a3d10ad2933e6075fe5327863f3a05084 -size 2163 +oid sha256:2dc3a88132b5636b8970fcd2b715d94a450e4fab5336822e7b134bb5af5a46a9 +size 2165 diff --git a/data/minecraft/structure/village/taiga/houses/taiga_weaponsmith_1.nbt b/data/minecraft/structure/village/taiga/houses/taiga_weaponsmith_1.nbt index b0b6d144..80396a81 100644 --- a/data/minecraft/structure/village/taiga/houses/taiga_weaponsmith_1.nbt +++ b/data/minecraft/structure/village/taiga/houses/taiga_weaponsmith_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:32ee3790b183209d251227286ed31cab8ab60fc0dd0b4e96f09031d254d573c7 -size 2075 +oid sha256:41ae05da1727fc31c9fbfdee59927d15f2a8e6b0de645ca8fd01c102f60360ec +size 2077 diff --git a/data/minecraft/structure/village/taiga/houses/taiga_weaponsmith_2.nbt b/data/minecraft/structure/village/taiga/houses/taiga_weaponsmith_2.nbt index 5957f8a2..c4c7581e 100644 --- a/data/minecraft/structure/village/taiga/houses/taiga_weaponsmith_2.nbt +++ b/data/minecraft/structure/village/taiga/houses/taiga_weaponsmith_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2450f0c023084c6dc21cabe61d1d2f200dc63c53e95d05e49712e93b963b7938 -size 1186 +oid sha256:9e0094a7fcad47b66cad8a4d46b15679135d0b4b882f5c8763c180ebce5cb30e +size 1189 diff --git a/data/minecraft/structure/village/taiga/streets/corner_01.nbt b/data/minecraft/structure/village/taiga/streets/corner_01.nbt index 197b5d95..e58ac225 100644 --- a/data/minecraft/structure/village/taiga/streets/corner_01.nbt +++ b/data/minecraft/structure/village/taiga/streets/corner_01.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7644bd8a9403b2fff543c985f0d11022ad93794c68ec41301e531d9a3d9795cd -size 1180 +oid sha256:4eb49e6994ec55caf7c499fddb62961e3de389cb1094c712b2b4c506ef55d406 +size 1182 diff --git a/data/minecraft/structure/village/taiga/streets/corner_02.nbt b/data/minecraft/structure/village/taiga/streets/corner_02.nbt index 4b54594c..b6b4ed29 100644 --- a/data/minecraft/structure/village/taiga/streets/corner_02.nbt +++ b/data/minecraft/structure/village/taiga/streets/corner_02.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d7776a3ffddb0a1bb84ca150b735d2e67e9dbe7072acce9d0b7f883ee30077c8 -size 1182 +oid sha256:2f43169b99fd8f1368fb04c7958a14fe20fde0dab8a7ac60878824e2357cd708 +size 1184 diff --git a/data/minecraft/structure/village/taiga/streets/corner_03.nbt b/data/minecraft/structure/village/taiga/streets/corner_03.nbt index 2c2394b1..c25d41ce 100644 --- a/data/minecraft/structure/village/taiga/streets/corner_03.nbt +++ b/data/minecraft/structure/village/taiga/streets/corner_03.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:cfbc9775bdde07cd36aa1b78349c5d2ece6fe904cc559bc0f5d76e29c7274038 -size 348 +oid sha256:2d43b1fe4209ab4c4711cd1169810e458428371c7d6e555e5ed5cd47c9206645 +size 351 diff --git a/data/minecraft/structure/village/taiga/streets/crossroad_01.nbt b/data/minecraft/structure/village/taiga/streets/crossroad_01.nbt index c607d69d..51a0ba46 100644 --- a/data/minecraft/structure/village/taiga/streets/crossroad_01.nbt +++ b/data/minecraft/structure/village/taiga/streets/crossroad_01.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:cfa1c1492a50dcf3f96736f43dbf4974e124cead89410a655669aaa724aa6e3c -size 1212 +oid sha256:32c74360f6e1e02fcdb6e8ad647b38ca68fffa30d377d3cf2b6b3ea095f49cb8 +size 1214 diff --git a/data/minecraft/structure/village/taiga/streets/crossroad_02.nbt b/data/minecraft/structure/village/taiga/streets/crossroad_02.nbt index 984d7183..8c61f368 100644 --- a/data/minecraft/structure/village/taiga/streets/crossroad_02.nbt +++ b/data/minecraft/structure/village/taiga/streets/crossroad_02.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5a78f44bc4b9bcd38e2e66350942a92dd885eb5caee3fdc4db0772370a2d0e65 -size 1158 +oid sha256:003b336210355ff6b39c60d4b3c3923c70a0e4e1e25917823d6dbbfd83dbaf5e +size 1160 diff --git a/data/minecraft/structure/village/taiga/streets/crossroad_03.nbt b/data/minecraft/structure/village/taiga/streets/crossroad_03.nbt index fb994bad..c6cba0aa 100644 --- a/data/minecraft/structure/village/taiga/streets/crossroad_03.nbt +++ b/data/minecraft/structure/village/taiga/streets/crossroad_03.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f9e3d2c4176482985d5edc28b8e7d1169e0cfe5850a899639efb60ede45c6c2c -size 1200 +oid sha256:cbe4a5821af32b8c87c125785a71f488fcf6b77ab8346ffbbefdfbc0ca7966c5 +size 1203 diff --git a/data/minecraft/structure/village/taiga/streets/crossroad_04.nbt b/data/minecraft/structure/village/taiga/streets/crossroad_04.nbt index c688f20f..62caa556 100644 --- a/data/minecraft/structure/village/taiga/streets/crossroad_04.nbt +++ b/data/minecraft/structure/village/taiga/streets/crossroad_04.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8b125ebc510dd4cae4afb14dc99f79f00014fd83f60fa2b9b95d093ccabde793 -size 435 +oid sha256:a754cc0eab20eb45a21dd8439fb7c84dfd4222ebb07d5f2cc8f3271b05ea619e +size 437 diff --git a/data/minecraft/structure/village/taiga/streets/crossroad_05.nbt b/data/minecraft/structure/village/taiga/streets/crossroad_05.nbt index 7242f9cd..683e23b8 100644 --- a/data/minecraft/structure/village/taiga/streets/crossroad_05.nbt +++ b/data/minecraft/structure/village/taiga/streets/crossroad_05.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b18985a8612ff0acf324aa9206141fed0a79d01770c0df7929cc3c54e646b4a9 -size 407 +oid sha256:7a2c315b874157261af303e0282c8716357d5d2d5324a2f9dd19c7eabe6d9ebc +size 410 diff --git a/data/minecraft/structure/village/taiga/streets/crossroad_06.nbt b/data/minecraft/structure/village/taiga/streets/crossroad_06.nbt index 835cfb20..032e12da 100644 --- a/data/minecraft/structure/village/taiga/streets/crossroad_06.nbt +++ b/data/minecraft/structure/village/taiga/streets/crossroad_06.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:77c9b6598f2de5b18e8886fbeb6d83b9948d0e5f36131a63609ca698124ed8ed -size 468 +oid sha256:6b23a398e2289ce9b28b87c44419bbd65c951e258d94f96a77f8b33434968b78 +size 472 diff --git a/data/minecraft/structure/village/taiga/streets/straight_01.nbt b/data/minecraft/structure/village/taiga/streets/straight_01.nbt index 6bcc7bc8..8ec9c67e 100644 --- a/data/minecraft/structure/village/taiga/streets/straight_01.nbt +++ b/data/minecraft/structure/village/taiga/streets/straight_01.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:419003cad83c9e0b2c41cf34f1c6904dfb18cc78758de029cf4dab356163a5af -size 1129 +oid sha256:f14e7ad2eb8a9b744ee473673ecb7a37c5cfb53d6289292f3a6d494257afa22f +size 1131 diff --git a/data/minecraft/structure/village/taiga/streets/straight_02.nbt b/data/minecraft/structure/village/taiga/streets/straight_02.nbt index 9d152df5..e5472154 100644 --- a/data/minecraft/structure/village/taiga/streets/straight_02.nbt +++ b/data/minecraft/structure/village/taiga/streets/straight_02.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1596670ea12fc175890514e999ab8e84c8492b0849bf8bedb9019bfd29be1c47 -size 1144 +oid sha256:cc7596811940ea5285983c1c95c40ed4a8afd88b30f71d9592e405cdf42e7881 +size 1147 diff --git a/data/minecraft/structure/village/taiga/streets/straight_03.nbt b/data/minecraft/structure/village/taiga/streets/straight_03.nbt index 4961dbd2..b754bcb6 100644 --- a/data/minecraft/structure/village/taiga/streets/straight_03.nbt +++ b/data/minecraft/structure/village/taiga/streets/straight_03.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:11b41abfbb7dfbe6ce6492084b350bf6e91db33bb66a719b4e244f642940ad3c -size 774 +oid sha256:da26b0f57dc1dff3f28f1d4e8246707ea83e0c903690c021856888ad4ecae282 +size 777 diff --git a/data/minecraft/structure/village/taiga/streets/straight_04.nbt b/data/minecraft/structure/village/taiga/streets/straight_04.nbt index 6d8cf1df..3b4326ad 100644 --- a/data/minecraft/structure/village/taiga/streets/straight_04.nbt +++ b/data/minecraft/structure/village/taiga/streets/straight_04.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a3c6697579c818324f18ac74c36199341eede34f6c19bced7b0e83987e23153f -size 684 +oid sha256:54f45fa8e9195c3958052ef86556914278a422ca6e199e0bf1114d3161f05503 +size 687 diff --git a/data/minecraft/structure/village/taiga/streets/straight_05.nbt b/data/minecraft/structure/village/taiga/streets/straight_05.nbt index 60fe21e2..00f23bc2 100644 --- a/data/minecraft/structure/village/taiga/streets/straight_05.nbt +++ b/data/minecraft/structure/village/taiga/streets/straight_05.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b7d349e8067126df65a22e91f211f0cca63fe00fb93b7d13a21009b784116798 -size 1388 +oid sha256:5c8cd504e934ff6c2d753ade58faf85cc190fe18ff0e5248eba5450d21d81c2f +size 1390 diff --git a/data/minecraft/structure/village/taiga/streets/straight_06.nbt b/data/minecraft/structure/village/taiga/streets/straight_06.nbt index 829fc21d..94ddc316 100644 --- a/data/minecraft/structure/village/taiga/streets/straight_06.nbt +++ b/data/minecraft/structure/village/taiga/streets/straight_06.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:549592e25dc0a05ec3a297549874585d75247d08006b3499da75d6fe440ee3c8 -size 1700 +oid sha256:4fdbae73062f4996d0849b2464ed2bd1262f5b77c9ede0d6b3c91d389ed247ff +size 1703 diff --git a/data/minecraft/structure/village/taiga/streets/turn_01.nbt b/data/minecraft/structure/village/taiga/streets/turn_01.nbt index 24944159..187aab47 100644 --- a/data/minecraft/structure/village/taiga/streets/turn_01.nbt +++ b/data/minecraft/structure/village/taiga/streets/turn_01.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:38fb4e8846fe7b8c6846d25d16f59bc6d978bbb2269b927f84f3b030e4563699 -size 788 +oid sha256:32222705e00ba5ad13fe436f884e634f61ad115ad0507235fee7de7d33fbf4cb +size 790 diff --git a/data/minecraft/structure/village/taiga/taiga_decoration_1.nbt b/data/minecraft/structure/village/taiga/taiga_decoration_1.nbt index f5094847..a97a8dd7 100644 --- a/data/minecraft/structure/village/taiga/taiga_decoration_1.nbt +++ b/data/minecraft/structure/village/taiga/taiga_decoration_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:22d2e0c3b607a966657c003609c095e74bb6bc983af741c6f6be4a1666a2adfd -size 420 +oid sha256:83a0c4fdeebb69c48f0410bdcdca9fd579d1bf90d830e8d9695b4d0d5bb704b6 +size 423 diff --git a/data/minecraft/structure/village/taiga/taiga_decoration_2.nbt b/data/minecraft/structure/village/taiga/taiga_decoration_2.nbt index 35a5ec9f..bbdb40ae 100644 --- a/data/minecraft/structure/village/taiga/taiga_decoration_2.nbt +++ b/data/minecraft/structure/village/taiga/taiga_decoration_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a158653891f113d2ea755c5419343fe8e09b8b379258d112d791c37781cdef70 -size 366 +oid sha256:48ea26a3f72a73639e538bf4c3e5834d67cda5ab6e058f207652d7b461376494 +size 368 diff --git a/data/minecraft/structure/village/taiga/taiga_decoration_3.nbt b/data/minecraft/structure/village/taiga/taiga_decoration_3.nbt index 6f43fe63..5b1490a2 100644 --- a/data/minecraft/structure/village/taiga/taiga_decoration_3.nbt +++ b/data/minecraft/structure/village/taiga/taiga_decoration_3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:585d26cb41c209bf9aec1f74c2b19dc10df3876d6a511d08f3cf896d933459c6 -size 351 +oid sha256:8ece4aa3f6b5e5e8241bb0ec6581ab94b18b207cfce9319da56ed8d452bad137 +size 354 diff --git a/data/minecraft/structure/village/taiga/taiga_decoration_4.nbt b/data/minecraft/structure/village/taiga/taiga_decoration_4.nbt index ba9e193f..a4046b38 100644 --- a/data/minecraft/structure/village/taiga/taiga_decoration_4.nbt +++ b/data/minecraft/structure/village/taiga/taiga_decoration_4.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d37e97e55cae1db113d4bba7bd81f24bf8d4fcf4cfb7f7adbfce41344dae40a5 -size 321 +oid sha256:d9468f63ef62542502c4c9cfb32a6f1eb29505250fca4eac8de9ec44bf618677 +size 323 diff --git a/data/minecraft/structure/village/taiga/taiga_decoration_5.nbt b/data/minecraft/structure/village/taiga/taiga_decoration_5.nbt index b8442a5d..e84cf9cb 100644 --- a/data/minecraft/structure/village/taiga/taiga_decoration_5.nbt +++ b/data/minecraft/structure/village/taiga/taiga_decoration_5.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:21c8d46a4f4eec02a1c8b1ab72129fec096d9269e8dbd6b64adba86554b37f95 -size 248 +oid sha256:d5330ecd5ec82f9641ab61ff3dede4bfc6c226337e4d32c04ed4e3ac37ac208d +size 250 diff --git a/data/minecraft/structure/village/taiga/taiga_decoration_6.nbt b/data/minecraft/structure/village/taiga/taiga_decoration_6.nbt index 0c5d5b50..f1ddb286 100644 --- a/data/minecraft/structure/village/taiga/taiga_decoration_6.nbt +++ b/data/minecraft/structure/village/taiga/taiga_decoration_6.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:478d897388fa7438245fc4e4d88fc2c87d7067ba0c2e8bc5f7561b51673e104f -size 469 +oid sha256:1093485ea375b9633c36abdde907be6e42f8fff8e0f31a2e0ae107b76f5ed241 +size 471 diff --git a/data/minecraft/structure/village/taiga/taiga_lamp_post_1.nbt b/data/minecraft/structure/village/taiga/taiga_lamp_post_1.nbt index 9c7d13a0..426bbdc1 100644 --- a/data/minecraft/structure/village/taiga/taiga_lamp_post_1.nbt +++ b/data/minecraft/structure/village/taiga/taiga_lamp_post_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:dd24591bb5c66d8ef3c6c83f02b61f73427ac970c3918a40eb79ea68a3685fff -size 250 +oid sha256:a475b7e5146166a8bf3dcb53086253d1412f6529372e67997a146791b0c336c1 +size 252 diff --git a/data/minecraft/structure/village/taiga/town_centers/taiga_meeting_point_1.nbt b/data/minecraft/structure/village/taiga/town_centers/taiga_meeting_point_1.nbt index a777ab02..e502c1b8 100644 --- a/data/minecraft/structure/village/taiga/town_centers/taiga_meeting_point_1.nbt +++ b/data/minecraft/structure/village/taiga/town_centers/taiga_meeting_point_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:66e8f0b45b6e5f0f786cce1ea92eae92c4f3c651b624b5c2e34d26aa92690892 -size 3944 +oid sha256:785d5f03843d5d2a6ae30926f3a2de599ea50b1829e4ceb024514d6a1b6d72a4 +size 3947 diff --git a/data/minecraft/structure/village/taiga/town_centers/taiga_meeting_point_2.nbt b/data/minecraft/structure/village/taiga/town_centers/taiga_meeting_point_2.nbt index 822a771d..1daf1b34 100644 --- a/data/minecraft/structure/village/taiga/town_centers/taiga_meeting_point_2.nbt +++ b/data/minecraft/structure/village/taiga/town_centers/taiga_meeting_point_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:65727f96af4c9d0348bc3f8158b8bc94f3b34be8b6d3f09daa03b29cf6beb1b9 -size 2269 +oid sha256:06148974d8da96089b228e860299b7a211346cb900995c53e5e2baae00eeec11 +size 2272 diff --git a/data/minecraft/structure/village/taiga/villagers/baby.nbt b/data/minecraft/structure/village/taiga/villagers/baby.nbt index 8daf7541..3c62e6b8 100644 --- a/data/minecraft/structure/village/taiga/villagers/baby.nbt +++ b/data/minecraft/structure/village/taiga/villagers/baby.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:071bad58fb289b9b3d361e55aa1504c290ac34569a97ff00e730dea6685c4c8f -size 749 +oid sha256:efdb6334cba16c7a5839f1de2e559fc82f9f79f4e11569cd6500c5698393bf96 +size 750 diff --git a/data/minecraft/structure/village/taiga/villagers/nitwit.nbt b/data/minecraft/structure/village/taiga/villagers/nitwit.nbt index 07afac26..f00d6e60 100644 --- a/data/minecraft/structure/village/taiga/villagers/nitwit.nbt +++ b/data/minecraft/structure/village/taiga/villagers/nitwit.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a5a7e442e9c35389e2ee3ea02a35ef49622b52c44ac518aaf16e584dde88acd2 -size 749 +oid sha256:7b848aa30dcba4e7a080042cc68bf23ce8c06246a3f45cf80d768df4eabfc7cf +size 750 diff --git a/data/minecraft/structure/village/taiga/villagers/unemployed.nbt b/data/minecraft/structure/village/taiga/villagers/unemployed.nbt index 9d5848d4..20fd7a42 100644 --- a/data/minecraft/structure/village/taiga/villagers/unemployed.nbt +++ b/data/minecraft/structure/village/taiga/villagers/unemployed.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6dcc371a6906cb511809401a1b30ec9a3bbcac0f287cad1d2eba480854b68654 +oid sha256:2717e902a833f7bf2ff8970211a7a13f1bf101a1d74bf53112e60b9b5ba08767 size 748 diff --git a/data/minecraft/structure/village/taiga/zombie/houses/taiga_cartographer_house_1.nbt b/data/minecraft/structure/village/taiga/zombie/houses/taiga_cartographer_house_1.nbt index 2ebd5710..a3e2ac2d 100644 --- a/data/minecraft/structure/village/taiga/zombie/houses/taiga_cartographer_house_1.nbt +++ b/data/minecraft/structure/village/taiga/zombie/houses/taiga_cartographer_house_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:89997e44fd148da1020708136ed3edb32b181d0811a5128dc78d79d4a37fa437 -size 2611 +oid sha256:75e13d74dc26fb67e2cebd2c9905bcb946a794e1dd62a7144c1dc341f1d46c21 +size 2613 diff --git a/data/minecraft/structure/village/taiga/zombie/houses/taiga_fisher_cottage_1.nbt b/data/minecraft/structure/village/taiga/zombie/houses/taiga_fisher_cottage_1.nbt index 4c151624..14e0ef60 100644 --- a/data/minecraft/structure/village/taiga/zombie/houses/taiga_fisher_cottage_1.nbt +++ b/data/minecraft/structure/village/taiga/zombie/houses/taiga_fisher_cottage_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:764751e77a3c269f6710e11d48d113bd17d0cc40010192a70d48a12cd7fb6657 -size 3664 +oid sha256:e72619ce34ee7a436ba0c3d62ec8e0d1e99196a86df8ad51c55234c424350ce1 +size 3666 diff --git a/data/minecraft/structure/village/taiga/zombie/houses/taiga_large_farm_2.nbt b/data/minecraft/structure/village/taiga/zombie/houses/taiga_large_farm_2.nbt index 595287da..f1f8bd22 100644 --- a/data/minecraft/structure/village/taiga/zombie/houses/taiga_large_farm_2.nbt +++ b/data/minecraft/structure/village/taiga/zombie/houses/taiga_large_farm_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0b9bffeb1bf52bb4ca0c7db76d755a91ae8554f2293079df6c321f6155ad627b -size 1604 +oid sha256:525fdadd347ae65784f4e885b7cf07e5836778e244ce4fb33720afaaa60ca4ff +size 1607 diff --git a/data/minecraft/structure/village/taiga/zombie/houses/taiga_library_1.nbt b/data/minecraft/structure/village/taiga/zombie/houses/taiga_library_1.nbt index 293df5d4..82427773 100644 --- a/data/minecraft/structure/village/taiga/zombie/houses/taiga_library_1.nbt +++ b/data/minecraft/structure/village/taiga/zombie/houses/taiga_library_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:14bc92a7f67942b046ec915c69f8902792085f96dbd86833243d9a4dbe00aff3 -size 3457 +oid sha256:2e77464afbbc4d11db500e00b3ce0b40db51034762d8a05d39b5fb28bdb309d4 +size 3460 diff --git a/data/minecraft/structure/village/taiga/zombie/houses/taiga_medium_house_1.nbt b/data/minecraft/structure/village/taiga/zombie/houses/taiga_medium_house_1.nbt index 73ba8550..33c77ff1 100644 --- a/data/minecraft/structure/village/taiga/zombie/houses/taiga_medium_house_1.nbt +++ b/data/minecraft/structure/village/taiga/zombie/houses/taiga_medium_house_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e35ab2ae3733de7f9b4d8b737c00319246100d00aedda320bcd7c6201cdc77b6 -size 2786 +oid sha256:348f1c1faa52c42402d8807839eba0dfce2e4e16a5fab32e2bb859045371592e +size 2790 diff --git a/data/minecraft/structure/village/taiga/zombie/houses/taiga_medium_house_2.nbt b/data/minecraft/structure/village/taiga/zombie/houses/taiga_medium_house_2.nbt index ea666003..d1fe319a 100644 --- a/data/minecraft/structure/village/taiga/zombie/houses/taiga_medium_house_2.nbt +++ b/data/minecraft/structure/village/taiga/zombie/houses/taiga_medium_house_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:01e588d6eff429a51d76cb8b06c276d22146f11dfc3b01c0fe398ddd4ffa957d -size 2604 +oid sha256:46cac63c9e53fec5c24d7bd5cc0aed5618358f93f27d282b676b2cac7086fc01 +size 2607 diff --git a/data/minecraft/structure/village/taiga/zombie/houses/taiga_medium_house_3.nbt b/data/minecraft/structure/village/taiga/zombie/houses/taiga_medium_house_3.nbt index 64dd1616..745a5c05 100644 --- a/data/minecraft/structure/village/taiga/zombie/houses/taiga_medium_house_3.nbt +++ b/data/minecraft/structure/village/taiga/zombie/houses/taiga_medium_house_3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:09d8879f6525155e948e6c999d2df6982af5c8bfdbfa3c1ed64e22ed11e43ced -size 3068 +oid sha256:c31c10e88eef1862051dc7812de9dad6a1604a9cc1faec704d110eda89d02e83 +size 3070 diff --git a/data/minecraft/structure/village/taiga/zombie/houses/taiga_medium_house_4.nbt b/data/minecraft/structure/village/taiga/zombie/houses/taiga_medium_house_4.nbt index 6497bfbd..6e05333d 100644 --- a/data/minecraft/structure/village/taiga/zombie/houses/taiga_medium_house_4.nbt +++ b/data/minecraft/structure/village/taiga/zombie/houses/taiga_medium_house_4.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:450d3576082890f316596d42b0c994ff37cb19f9459cdd9d5754629f887a6536 -size 2689 +oid sha256:fa06522f1feae0c5ec5e8d0d6b8c67fb129a0ca4a4e5432fa3296578557c41e7 +size 2692 diff --git a/data/minecraft/structure/village/taiga/zombie/houses/taiga_shepherds_house_1.nbt b/data/minecraft/structure/village/taiga/zombie/houses/taiga_shepherds_house_1.nbt index 5fd63129..333c5a98 100644 --- a/data/minecraft/structure/village/taiga/zombie/houses/taiga_shepherds_house_1.nbt +++ b/data/minecraft/structure/village/taiga/zombie/houses/taiga_shepherds_house_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4e11fdfe55a34c2f1b4e8f90ef1ab1129782920d4d4af202720bf59a6d61462f -size 3039 +oid sha256:323c6ac3ee89249bf433f56889854a1711898bd14995329e137bc243fef02d48 +size 3041 diff --git a/data/minecraft/structure/village/taiga/zombie/houses/taiga_small_house_1.nbt b/data/minecraft/structure/village/taiga/zombie/houses/taiga_small_house_1.nbt index 98d4532c..957da1df 100644 --- a/data/minecraft/structure/village/taiga/zombie/houses/taiga_small_house_1.nbt +++ b/data/minecraft/structure/village/taiga/zombie/houses/taiga_small_house_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:621ca13a13e6e78bb002e136974361432716ef948d6c57905fc10271fd03b5f5 -size 2390 +oid sha256:583c166e7e3ec4561751c0896ba8e2c0769dbd9fd52b9c00292f80e859aa750c +size 2392 diff --git a/data/minecraft/structure/village/taiga/zombie/houses/taiga_small_house_2.nbt b/data/minecraft/structure/village/taiga/zombie/houses/taiga_small_house_2.nbt index 92a1e835..57f56860 100644 --- a/data/minecraft/structure/village/taiga/zombie/houses/taiga_small_house_2.nbt +++ b/data/minecraft/structure/village/taiga/zombie/houses/taiga_small_house_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1d83e620283d61100b0236764010f6e9b31e4e23541858f58f5269bb3470c646 -size 1794 +oid sha256:a27cfeadaf80060680b00f918138ee7467a8815bb267c4a2c27358e6ca1f25dc +size 1796 diff --git a/data/minecraft/structure/village/taiga/zombie/houses/taiga_small_house_3.nbt b/data/minecraft/structure/village/taiga/zombie/houses/taiga_small_house_3.nbt index 980c3d5c..fe1cb0df 100644 --- a/data/minecraft/structure/village/taiga/zombie/houses/taiga_small_house_3.nbt +++ b/data/minecraft/structure/village/taiga/zombie/houses/taiga_small_house_3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:397d1299d4f0e286cf958ee5e4ae98c619fd295bd4f41af9722db91751ec5d41 -size 1885 +oid sha256:5ee926f94da52eeb8a47bdf42373b4aa29378068b3e0cb49ec49b0b105f4fc92 +size 1887 diff --git a/data/minecraft/structure/village/taiga/zombie/houses/taiga_small_house_4.nbt b/data/minecraft/structure/village/taiga/zombie/houses/taiga_small_house_4.nbt index ca6f04a7..83c100c2 100644 --- a/data/minecraft/structure/village/taiga/zombie/houses/taiga_small_house_4.nbt +++ b/data/minecraft/structure/village/taiga/zombie/houses/taiga_small_house_4.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c8d155ca53c6bb79e6a8a5cc21b54563aadf4ee5f5d76a53c9d0dd50b52b76ff -size 1612 +oid sha256:4f362621612a22e0863df3b175f52015926f0f9ae3c2bc1ed075213a6d7649ad +size 1615 diff --git a/data/minecraft/structure/village/taiga/zombie/houses/taiga_small_house_5.nbt b/data/minecraft/structure/village/taiga/zombie/houses/taiga_small_house_5.nbt index 269c456f..dba55a68 100644 --- a/data/minecraft/structure/village/taiga/zombie/houses/taiga_small_house_5.nbt +++ b/data/minecraft/structure/village/taiga/zombie/houses/taiga_small_house_5.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:22531aaad6b1539fecc2388d628f7e28a036db8259a3483249b189de57421491 -size 2046 +oid sha256:5b2388207ee8320de185d4623a3f5525854d09d9de5bbcf756755d910db9c55f +size 2049 diff --git a/data/minecraft/structure/village/taiga/zombie/houses/taiga_temple_1.nbt b/data/minecraft/structure/village/taiga/zombie/houses/taiga_temple_1.nbt index a4a13cf8..33af7939 100644 --- a/data/minecraft/structure/village/taiga/zombie/houses/taiga_temple_1.nbt +++ b/data/minecraft/structure/village/taiga/zombie/houses/taiga_temple_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3ad6ef6eeb6564147bcd27353080c105598ef547394f2e817d00fc8b753f9f9c -size 6642 +oid sha256:24463bee6a4467c302d1bf17beddd55c03fa870ee3d876fc12f9c52bdbb354c8 +size 6643 diff --git a/data/minecraft/structure/village/taiga/zombie/houses/taiga_tool_smith_1.nbt b/data/minecraft/structure/village/taiga/zombie/houses/taiga_tool_smith_1.nbt index 9d35d013..0378fc7e 100644 --- a/data/minecraft/structure/village/taiga/zombie/houses/taiga_tool_smith_1.nbt +++ b/data/minecraft/structure/village/taiga/zombie/houses/taiga_tool_smith_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f2fbeff93befe6cbe24cb71b31c06cd7a24e1d0c0d3fc18c51ea8944081bbeb1 -size 2173 +oid sha256:a2e02b9b67d64956d99d6fa6a6778a7aa3babad15cde194838b885fac0f16dca +size 2175 diff --git a/data/minecraft/structure/village/taiga/zombie/houses/taiga_weaponsmith_2.nbt b/data/minecraft/structure/village/taiga/zombie/houses/taiga_weaponsmith_2.nbt index 47deb02d..023f98e7 100644 --- a/data/minecraft/structure/village/taiga/zombie/houses/taiga_weaponsmith_2.nbt +++ b/data/minecraft/structure/village/taiga/zombie/houses/taiga_weaponsmith_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:10a080fccd3458863c8a4f1438cb042909096d1d9a28fe19681c4d475a784159 -size 1192 +oid sha256:8d8cec3c367018acdb2c8754e3508372138ceac022fb0d1f82f154e6f7a5fdc1 +size 1194 diff --git a/data/minecraft/structure/village/taiga/zombie/streets/corner_01.nbt b/data/minecraft/structure/village/taiga/zombie/streets/corner_01.nbt index 8be7a39f..3893345f 100644 --- a/data/minecraft/structure/village/taiga/zombie/streets/corner_01.nbt +++ b/data/minecraft/structure/village/taiga/zombie/streets/corner_01.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:95bcae8cbcc63f865b182d776e0e9070f5454b5beebb31851810b86e4fe20cb8 -size 1184 +oid sha256:cdab1ada9cda40822f4b2747fddccad23641771138d1ac79e03930ea070e6bbc +size 1187 diff --git a/data/minecraft/structure/village/taiga/zombie/streets/corner_02.nbt b/data/minecraft/structure/village/taiga/zombie/streets/corner_02.nbt index ae6b1293..ec01df14 100644 --- a/data/minecraft/structure/village/taiga/zombie/streets/corner_02.nbt +++ b/data/minecraft/structure/village/taiga/zombie/streets/corner_02.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:08f3af97002b77cd4632874e88b9030d5c8b6d438c472661ca1d2c3d68c9b8a8 -size 1188 +oid sha256:f4ad952d8cc438f2591dc3277f901ad903fb3b472ab01202316f7e4105aeb8f9 +size 1191 diff --git a/data/minecraft/structure/village/taiga/zombie/streets/corner_03.nbt b/data/minecraft/structure/village/taiga/zombie/streets/corner_03.nbt index 0d99241d..71322151 100644 --- a/data/minecraft/structure/village/taiga/zombie/streets/corner_03.nbt +++ b/data/minecraft/structure/village/taiga/zombie/streets/corner_03.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1427f35a71666985a03799a79ad9a87b036c3b915914dffc961cdc0a8b34709b -size 353 +oid sha256:852fc709d79297a9bfc7af9093c2c6db89928ccc6f0f5c300eb7790cb1b032f8 +size 356 diff --git a/data/minecraft/structure/village/taiga/zombie/streets/crossroad_01.nbt b/data/minecraft/structure/village/taiga/zombie/streets/crossroad_01.nbt index 8e3eee0c..767f73f2 100644 --- a/data/minecraft/structure/village/taiga/zombie/streets/crossroad_01.nbt +++ b/data/minecraft/structure/village/taiga/zombie/streets/crossroad_01.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0a5eed880f3a62cce0ecf0617a22937b0c91248dfe72da29eefbd625acdd7754 -size 1217 +oid sha256:b18932e9c07f3a0ff6b0ab33333e95c6e353ebcc7fd00414fd092602b7ba807a +size 1221 diff --git a/data/minecraft/structure/village/taiga/zombie/streets/crossroad_02.nbt b/data/minecraft/structure/village/taiga/zombie/streets/crossroad_02.nbt index 35f69d99..324a7ae3 100644 --- a/data/minecraft/structure/village/taiga/zombie/streets/crossroad_02.nbt +++ b/data/minecraft/structure/village/taiga/zombie/streets/crossroad_02.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:af96f44e6ecb9715008c1bfe94327ca27599a321846269d26c7b63913ae54321 -size 1162 +oid sha256:1f1af214a727d746d8e450463a88ae901dbd61dae6948f0520ea72b1f33e550a +size 1165 diff --git a/data/minecraft/structure/village/taiga/zombie/streets/crossroad_03.nbt b/data/minecraft/structure/village/taiga/zombie/streets/crossroad_03.nbt index c564449c..cd64f0af 100644 --- a/data/minecraft/structure/village/taiga/zombie/streets/crossroad_03.nbt +++ b/data/minecraft/structure/village/taiga/zombie/streets/crossroad_03.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:043595fc6a005108adaf077860da5f570cb75a30d76f4cf0ba39e7f0ff9cb293 -size 1205 +oid sha256:f8b51c5ac9b5ee24c55fbcbc0173aa041b1b7dcc9612e51b1b4dc4ad5130b943 +size 1208 diff --git a/data/minecraft/structure/village/taiga/zombie/streets/crossroad_04.nbt b/data/minecraft/structure/village/taiga/zombie/streets/crossroad_04.nbt index 30616667..b8c58110 100644 --- a/data/minecraft/structure/village/taiga/zombie/streets/crossroad_04.nbt +++ b/data/minecraft/structure/village/taiga/zombie/streets/crossroad_04.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:32ed7c0d638a85e8fea2589398eb1e06b89ee2af9663e36b957097ce37c75255 -size 443 +oid sha256:e5af4724bc63ff19ae1a7e1bc3bdd520cfe44b46590ff51c0e0a46145e0e5983 +size 445 diff --git a/data/minecraft/structure/village/taiga/zombie/streets/crossroad_05.nbt b/data/minecraft/structure/village/taiga/zombie/streets/crossroad_05.nbt index ca4e592e..ad88e5d6 100644 --- a/data/minecraft/structure/village/taiga/zombie/streets/crossroad_05.nbt +++ b/data/minecraft/structure/village/taiga/zombie/streets/crossroad_05.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:507b4944513d66f45e668571df94174bcfac56f94feb3cd7539e843a868ee944 -size 412 +oid sha256:622b3ce9aeb05db0c95f44fad5e75eb5e5241a11523617748f907efb0c75b348 +size 414 diff --git a/data/minecraft/structure/village/taiga/zombie/streets/crossroad_06.nbt b/data/minecraft/structure/village/taiga/zombie/streets/crossroad_06.nbt index 81027b0e..18fa6909 100644 --- a/data/minecraft/structure/village/taiga/zombie/streets/crossroad_06.nbt +++ b/data/minecraft/structure/village/taiga/zombie/streets/crossroad_06.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d40a65f70c527b7fde2d42dbc282f75fd5c6120793d73f713bec237338a0e0ef -size 474 +oid sha256:1a6871e21c50977990de8a4c2f496c85913cd8d8c9481661c70cfed4ad19ce7c +size 476 diff --git a/data/minecraft/structure/village/taiga/zombie/streets/straight_01.nbt b/data/minecraft/structure/village/taiga/zombie/streets/straight_01.nbt index cab235f2..16374dd4 100644 --- a/data/minecraft/structure/village/taiga/zombie/streets/straight_01.nbt +++ b/data/minecraft/structure/village/taiga/zombie/streets/straight_01.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:96bab60798d0ed3a8e4e8385d89331420af2660d70c6e029c49f6efdfa76f1fa -size 1133 +oid sha256:eb5c5dd113d8c31a83c39f2c3126b5728627dd0329bc8e676a7fd6fddcf8e8fd +size 1135 diff --git a/data/minecraft/structure/village/taiga/zombie/streets/straight_02.nbt b/data/minecraft/structure/village/taiga/zombie/streets/straight_02.nbt index 0e2e55c2..bc5120e6 100644 --- a/data/minecraft/structure/village/taiga/zombie/streets/straight_02.nbt +++ b/data/minecraft/structure/village/taiga/zombie/streets/straight_02.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9a31e2c0c03d2f1445ea691fefb7a2d289446db18c03d673da5bfe94df5f8a60 -size 1149 +oid sha256:1d71da2038edd208157e6a3287a5323e185663b361e61d3506ab17009804956f +size 1152 diff --git a/data/minecraft/structure/village/taiga/zombie/streets/straight_03.nbt b/data/minecraft/structure/village/taiga/zombie/streets/straight_03.nbt index 42fcd19b..62fd7106 100644 --- a/data/minecraft/structure/village/taiga/zombie/streets/straight_03.nbt +++ b/data/minecraft/structure/village/taiga/zombie/streets/straight_03.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:eaf4cdb329562a85e87d30cbf21e06732d98036ae89fe5b979ebe3511239c9c5 -size 779 +oid sha256:fe60f5d746e15a9688759a3c5650742f86b433f57e19f112175618c52723f1e7 +size 781 diff --git a/data/minecraft/structure/village/taiga/zombie/streets/straight_04.nbt b/data/minecraft/structure/village/taiga/zombie/streets/straight_04.nbt index 0e05556e..ed37d916 100644 --- a/data/minecraft/structure/village/taiga/zombie/streets/straight_04.nbt +++ b/data/minecraft/structure/village/taiga/zombie/streets/straight_04.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:aac4aba3c19d915427d2332122963e156bccce5862309585f6e55bdfde5a5963 -size 690 +oid sha256:509c796355bb4ddeb2999bf8e7f864ee4f95de233ec4d5f8f1453031c99df6e0 +size 693 diff --git a/data/minecraft/structure/village/taiga/zombie/streets/straight_05.nbt b/data/minecraft/structure/village/taiga/zombie/streets/straight_05.nbt index 09752b0e..cec2daf6 100644 --- a/data/minecraft/structure/village/taiga/zombie/streets/straight_05.nbt +++ b/data/minecraft/structure/village/taiga/zombie/streets/straight_05.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:91c5872d925d96751c3a1472d6af82232a4e764298c066714e8ee1f1592a1b78 -size 1393 +oid sha256:2c98a9c5fb44f0a83bf20a8dd67f140bac4ea58823f5509ee01b2256b0e18e38 +size 1395 diff --git a/data/minecraft/structure/village/taiga/zombie/streets/straight_06.nbt b/data/minecraft/structure/village/taiga/zombie/streets/straight_06.nbt index 225811e5..b4f2fefa 100644 --- a/data/minecraft/structure/village/taiga/zombie/streets/straight_06.nbt +++ b/data/minecraft/structure/village/taiga/zombie/streets/straight_06.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ec3bbb2b0accfcca54778a0d1ead85e156fbaeac464e25cfb2a5dec4ad53cf61 -size 1705 +oid sha256:cf51f44e2c0415650300a16f84e80213c87bbd7896bcc92eac7ff9acfde927bb +size 1708 diff --git a/data/minecraft/structure/village/taiga/zombie/streets/turn_01.nbt b/data/minecraft/structure/village/taiga/zombie/streets/turn_01.nbt index c14e2fa8..7ef73265 100644 --- a/data/minecraft/structure/village/taiga/zombie/streets/turn_01.nbt +++ b/data/minecraft/structure/village/taiga/zombie/streets/turn_01.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:14b7b4fb59f5dae970bb80567a923e06c337b0268cdae8476ba61f169644f18a -size 791 +oid sha256:9958c4ff80acba3c97ec5a7e8ba020bf53ead5541831aec25005d82a9e81a2e4 +size 794 diff --git a/data/minecraft/structure/village/taiga/zombie/town_centers/taiga_meeting_point_1.nbt b/data/minecraft/structure/village/taiga/zombie/town_centers/taiga_meeting_point_1.nbt index 13fe4716..49ef014f 100644 --- a/data/minecraft/structure/village/taiga/zombie/town_centers/taiga_meeting_point_1.nbt +++ b/data/minecraft/structure/village/taiga/zombie/town_centers/taiga_meeting_point_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:281b3119a098e8bd6dd3d1b6a0a2035b2f8e5dabdf035a45c196ce4c895c6b7c -size 1847 +oid sha256:f59b35eee0ff776e53fa4996b6c2d2d50197bc20709e5ce4df3861ec6c80e89f +size 1849 diff --git a/data/minecraft/structure/village/taiga/zombie/town_centers/taiga_meeting_point_2.nbt b/data/minecraft/structure/village/taiga/zombie/town_centers/taiga_meeting_point_2.nbt index 3df5f32e..139871f0 100644 --- a/data/minecraft/structure/village/taiga/zombie/town_centers/taiga_meeting_point_2.nbt +++ b/data/minecraft/structure/village/taiga/zombie/town_centers/taiga_meeting_point_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:dcee089351a8412cfbcaa2bb2ec49ab2912148d0777bd13be66f9cbba748613d -size 2255 +oid sha256:5d9b656d28cddd5db7b519da2f76588417c27e881bd9d2ba5ad89e77b50f85b7 +size 2258 diff --git a/data/minecraft/structure/village/taiga/zombie/villagers/nitwit.nbt b/data/minecraft/structure/village/taiga/zombie/villagers/nitwit.nbt index cd0a924b..7b17973a 100644 --- a/data/minecraft/structure/village/taiga/zombie/villagers/nitwit.nbt +++ b/data/minecraft/structure/village/taiga/zombie/villagers/nitwit.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:573ce539f96abd747e1de0e4f0a49eb3e0284cc68739bab1b312ff7a415067d5 -size 755 +oid sha256:649c74cfdb25c49939e184b0d98638b6d593e606389a71b4375910dde0872add +size 756 diff --git a/data/minecraft/structure/village/taiga/zombie/villagers/unemployed.nbt b/data/minecraft/structure/village/taiga/zombie/villagers/unemployed.nbt index 0cb50c22..ffb8c4ee 100644 --- a/data/minecraft/structure/village/taiga/zombie/villagers/unemployed.nbt +++ b/data/minecraft/structure/village/taiga/zombie/villagers/unemployed.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3486d8369277470f90352a62e7e4f2426d9c086d135a518caed3291f7226a33c -size 753 +oid sha256:2b537090ec1feef7aa2ce9482a70589678a0588628c9e110df4e1541f7e77fa5 +size 754 diff --git a/data/minecraft/structure/woodland_mansion/1x1_a1.nbt b/data/minecraft/structure/woodland_mansion/1x1_a1.nbt index d65394c8..d3eaaa8f 100644 --- a/data/minecraft/structure/woodland_mansion/1x1_a1.nbt +++ b/data/minecraft/structure/woodland_mansion/1x1_a1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:181d39a4a447ec21486d8e947076e4c7959c38fff42e420d1ac0ff2ebd9b015b -size 1431 +oid sha256:5bcff5f6884f99472202e84173278d0fccdf66e8f69ec174968eebb3acd96d8d +size 1434 diff --git a/data/minecraft/structure/woodland_mansion/1x1_a2.nbt b/data/minecraft/structure/woodland_mansion/1x1_a2.nbt index 16d12542..7d86523b 100644 --- a/data/minecraft/structure/woodland_mansion/1x1_a2.nbt +++ b/data/minecraft/structure/woodland_mansion/1x1_a2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4f72699a28cd6283280c1b2fac7167adc276842350eaed2d4bc1bdf1a6e1a45d -size 1526 +oid sha256:1d4c11f01f73ba94cf1ff0b384d98612a37c8dfb1b2db6ec41a437cb2e9bf18e +size 1529 diff --git a/data/minecraft/structure/woodland_mansion/1x1_a3.nbt b/data/minecraft/structure/woodland_mansion/1x1_a3.nbt index 740baa4d..b12c48f8 100644 --- a/data/minecraft/structure/woodland_mansion/1x1_a3.nbt +++ b/data/minecraft/structure/woodland_mansion/1x1_a3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:686b0f1e605533925a46d1e798f3a253b89abcd02c7a7a3ec384e449f367c4c8 -size 1414 +oid sha256:dbb50521b7b6aa1523d0ff99f0836a9b7eebc491614ec05c6a18f0211cc7e357 +size 1417 diff --git a/data/minecraft/structure/woodland_mansion/1x1_a4.nbt b/data/minecraft/structure/woodland_mansion/1x1_a4.nbt index 4ba15279..a5bca5f8 100644 --- a/data/minecraft/structure/woodland_mansion/1x1_a4.nbt +++ b/data/minecraft/structure/woodland_mansion/1x1_a4.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9597a6a8128b523a0d41c6a75f601118991406b09276ebde1542989dfd35dc97 -size 1681 +oid sha256:b8a474656eeb60f01ba9e8a65454e0092eeb2798f6a5337e01e489f13c33f4bd +size 1684 diff --git a/data/minecraft/structure/woodland_mansion/1x1_a5.nbt b/data/minecraft/structure/woodland_mansion/1x1_a5.nbt index 98787f0d..ec952d13 100644 --- a/data/minecraft/structure/woodland_mansion/1x1_a5.nbt +++ b/data/minecraft/structure/woodland_mansion/1x1_a5.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a123b050670f1e43916d6d6f61afb4e8083624768b1b4d8488a4e7001cc3f6cb -size 1489 +oid sha256:7a700605cb4c40bbcad5d1ae450919d253322515a470429158a3b943bcfad949 +size 1492 diff --git a/data/minecraft/structure/woodland_mansion/1x1_as1.nbt b/data/minecraft/structure/woodland_mansion/1x1_as1.nbt index 719c8559..33a20913 100644 --- a/data/minecraft/structure/woodland_mansion/1x1_as1.nbt +++ b/data/minecraft/structure/woodland_mansion/1x1_as1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:381ca61a90ea92c3e3b3c7552a46f9a924a85104bbafdfaefa8c6ea9046ec07a -size 1483 +oid sha256:d9692fff774ec11e226f50ee574f485b472c2221af0e4240db830da16493c85e +size 1486 diff --git a/data/minecraft/structure/woodland_mansion/1x1_as2.nbt b/data/minecraft/structure/woodland_mansion/1x1_as2.nbt index 4f01ad41..94e99b34 100644 --- a/data/minecraft/structure/woodland_mansion/1x1_as2.nbt +++ b/data/minecraft/structure/woodland_mansion/1x1_as2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:cdadf63ed2c755b0f906d9d94f3f9d4937cd6ba5ca5a7547ebf331aae93199c6 -size 1454 +oid sha256:1dd221728766602fc3518b13ec680c22cdb6d1d31faf6fedaeefb38e3356fc30 +size 1457 diff --git a/data/minecraft/structure/woodland_mansion/1x1_as3.nbt b/data/minecraft/structure/woodland_mansion/1x1_as3.nbt index 4f24f486..aee77612 100644 --- a/data/minecraft/structure/woodland_mansion/1x1_as3.nbt +++ b/data/minecraft/structure/woodland_mansion/1x1_as3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:219b80dc7ada7560ebfddfb622a075317105c1bcf4db04e7cee492e2f27679cc -size 1210 +oid sha256:721f72374b71a205e62913098b34d588ed5e98dc16b000fe3aa3981f1dd6f3b1 +size 1212 diff --git a/data/minecraft/structure/woodland_mansion/1x1_as4.nbt b/data/minecraft/structure/woodland_mansion/1x1_as4.nbt index 28d0b344..17add9e9 100644 --- a/data/minecraft/structure/woodland_mansion/1x1_as4.nbt +++ b/data/minecraft/structure/woodland_mansion/1x1_as4.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:eda5341f48146bb5be97b9ef7a8dc6d71cae5fa9263de2e654e68456b5f46566 -size 1210 +oid sha256:8dc96fd9f45d004a1221edb4dc13911b48a3f989c876682d7ac4664a6142fbea +size 1211 diff --git a/data/minecraft/structure/woodland_mansion/1x1_b1.nbt b/data/minecraft/structure/woodland_mansion/1x1_b1.nbt index e4587bae..5073e1ca 100644 --- a/data/minecraft/structure/woodland_mansion/1x1_b1.nbt +++ b/data/minecraft/structure/woodland_mansion/1x1_b1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f07c26f15da1504ad7a0b904755ed6f5560ac37b281b2a2409e42c220743f94b -size 1924 +oid sha256:a287922d83f57d0e3ec7d206129a6cce1c49464a6512b34e735167b80d58be7c +size 1925 diff --git a/data/minecraft/structure/woodland_mansion/1x1_b2.nbt b/data/minecraft/structure/woodland_mansion/1x1_b2.nbt index 92aa7628..b59b75b6 100644 --- a/data/minecraft/structure/woodland_mansion/1x1_b2.nbt +++ b/data/minecraft/structure/woodland_mansion/1x1_b2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b7445f76205e00df98811be2e1aaf9dcf7e95b3b3947808492052fede2f5b91c -size 1863 +oid sha256:3e5cbd3384f5111fc96e6a6a1163c619e9700a53e19b989b21998595671dcda1 +size 1865 diff --git a/data/minecraft/structure/woodland_mansion/1x1_b3.nbt b/data/minecraft/structure/woodland_mansion/1x1_b3.nbt index b2f61c45..5b58e396 100644 --- a/data/minecraft/structure/woodland_mansion/1x1_b3.nbt +++ b/data/minecraft/structure/woodland_mansion/1x1_b3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0795671f720a016d406d0b34444638bd641216973c09faef0b505480a5b519c4 -size 1802 +oid sha256:bf54056a70523d8f5ee565094450cfcd90bd4b0e47bc95b537515e2a316a9b43 +size 1808 diff --git a/data/minecraft/structure/woodland_mansion/1x1_b4.nbt b/data/minecraft/structure/woodland_mansion/1x1_b4.nbt index f76e5cda..335c2942 100644 --- a/data/minecraft/structure/woodland_mansion/1x1_b4.nbt +++ b/data/minecraft/structure/woodland_mansion/1x1_b4.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2a4566ac45ba456a8ed78f531b70a10d4162a6e292994738dbe6aad4a723c335 -size 1829 +oid sha256:2ba4814f805e1358977c65d9b3031b6826126addcc778728b5bd4d2a24a7a174 +size 1832 diff --git a/data/minecraft/structure/woodland_mansion/1x1_b5.nbt b/data/minecraft/structure/woodland_mansion/1x1_b5.nbt index d1ee2849..c070ee73 100644 --- a/data/minecraft/structure/woodland_mansion/1x1_b5.nbt +++ b/data/minecraft/structure/woodland_mansion/1x1_b5.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c66645c46e38928a4c40bdc197228d3c3d13f69ccd5bf22e1f523abc279a476d -size 1920 +oid sha256:2ec85edf2327a66e7cd2ba766e6e8a804483fb9f09f3bfd3a3f5079f722943d0 +size 1923 diff --git a/data/minecraft/structure/woodland_mansion/1x2_a1.nbt b/data/minecraft/structure/woodland_mansion/1x2_a1.nbt index e834a371..47f4488e 100644 --- a/data/minecraft/structure/woodland_mansion/1x2_a1.nbt +++ b/data/minecraft/structure/woodland_mansion/1x2_a1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5585e982882b014b9396b1465e3e8d9efa339b1e8bffb85ae06780fee6ef46d7 -size 2934 +oid sha256:78264377f00db6add122663e985a93586b4dc3c594d42c4559924dbe03792b0c +size 2938 diff --git a/data/minecraft/structure/woodland_mansion/1x2_a2.nbt b/data/minecraft/structure/woodland_mansion/1x2_a2.nbt index 97a93244..9be8664f 100644 --- a/data/minecraft/structure/woodland_mansion/1x2_a2.nbt +++ b/data/minecraft/structure/woodland_mansion/1x2_a2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:61fa11d527c56cf4ca4366aa245df62f98513cbffa3322c2113bb0f546279c48 -size 2827 +oid sha256:08aa3f4c48652e0986369f0ba8c862d60bc5b9209f59105f61e8082be5bcae43 +size 2829 diff --git a/data/minecraft/structure/woodland_mansion/1x2_a3.nbt b/data/minecraft/structure/woodland_mansion/1x2_a3.nbt index 1b93a05d..1a95f824 100644 --- a/data/minecraft/structure/woodland_mansion/1x2_a3.nbt +++ b/data/minecraft/structure/woodland_mansion/1x2_a3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:bb0bed0cccac0a98e48b672ef1fdaa2a9078698b79ef16387fb8cad83431a928 -size 2948 +oid sha256:bf6d06a43f0e5a50e2530bcf616d071c0ffec08a7bb0172f129f2a7b94f93419 +size 2951 diff --git a/data/minecraft/structure/woodland_mansion/1x2_a4.nbt b/data/minecraft/structure/woodland_mansion/1x2_a4.nbt index ed7afb8b..83c7482f 100644 --- a/data/minecraft/structure/woodland_mansion/1x2_a4.nbt +++ b/data/minecraft/structure/woodland_mansion/1x2_a4.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:50a47220b2861304fb320d7a8c2dc604b29e9b0291d591c1580acdc381129834 -size 2895 +oid sha256:80e65988d90780c4b57fad008540d5e21ff3b87f1df91cd4b989002249d7ef5c +size 2898 diff --git a/data/minecraft/structure/woodland_mansion/1x2_a5.nbt b/data/minecraft/structure/woodland_mansion/1x2_a5.nbt index af5bce82..766a7534 100644 --- a/data/minecraft/structure/woodland_mansion/1x2_a5.nbt +++ b/data/minecraft/structure/woodland_mansion/1x2_a5.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6b45d904fc2e2307629ba4d8017d0aad125ccef3005a8c2256e90a5dee1b7471 -size 2569 +oid sha256:d67792282b4b0be293da3e96cd8fdf58200fae1fa9a09916cc3346199f7774cf +size 2571 diff --git a/data/minecraft/structure/woodland_mansion/1x2_a6.nbt b/data/minecraft/structure/woodland_mansion/1x2_a6.nbt index 672fe62b..08d4478a 100644 --- a/data/minecraft/structure/woodland_mansion/1x2_a6.nbt +++ b/data/minecraft/structure/woodland_mansion/1x2_a6.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:268cbce423b2f8c389e4630f16490b45ef3690788326e176f7f555cf2a2beade -size 2813 +oid sha256:912d5d6f4957fc39e05097d5a767f426c0f9ce820fde525e7902d26386952571 +size 2815 diff --git a/data/minecraft/structure/woodland_mansion/1x2_a7.nbt b/data/minecraft/structure/woodland_mansion/1x2_a7.nbt index b27b241f..3089d1fd 100644 --- a/data/minecraft/structure/woodland_mansion/1x2_a7.nbt +++ b/data/minecraft/structure/woodland_mansion/1x2_a7.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b2ea269f33af5569ffbfba515836586821a638a352b1d1a951a71b7ead628db3 -size 2946 +oid sha256:c8e7acf1ade7da83a2d465999fcbab8d32294b0fadf60aaca05b2386e34af6ba +size 2949 diff --git a/data/minecraft/structure/woodland_mansion/1x2_a8.nbt b/data/minecraft/structure/woodland_mansion/1x2_a8.nbt index 48d10618..1975c11b 100644 --- a/data/minecraft/structure/woodland_mansion/1x2_a8.nbt +++ b/data/minecraft/structure/woodland_mansion/1x2_a8.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:47a253a5e094b95c4901699c183cd30200dc329fb3c9980f3619d188ae2ad587 -size 3188 +oid sha256:5fca6e6725cc0d824eb913ace2ad0f333a2c8d7dab4b76ecd61e66cd890bef88 +size 3191 diff --git a/data/minecraft/structure/woodland_mansion/1x2_a9.nbt b/data/minecraft/structure/woodland_mansion/1x2_a9.nbt index 22ecce1d..69acbede 100644 --- a/data/minecraft/structure/woodland_mansion/1x2_a9.nbt +++ b/data/minecraft/structure/woodland_mansion/1x2_a9.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:81fe773b1dff8c80c3f60f357f281cd30463ef4e2f830eb12468fc8dea018aa0 -size 3093 +oid sha256:712c8e76de3327c395fd95a49853b0d13c97573d553e270adc6a7381d9f8d722 +size 3096 diff --git a/data/minecraft/structure/woodland_mansion/1x2_b1.nbt b/data/minecraft/structure/woodland_mansion/1x2_b1.nbt index cf7fe881..baeb0d69 100644 --- a/data/minecraft/structure/woodland_mansion/1x2_b1.nbt +++ b/data/minecraft/structure/woodland_mansion/1x2_b1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:47eee2007c80d8072f3d1627d52d754b8bd52e32d8e7d82c7a530e6c5f07e7d4 -size 3276 +oid sha256:96572d83bc1f7641daa7840d75f77888f72d2dbcb1792d64b3a7d3066fea0a0a +size 3279 diff --git a/data/minecraft/structure/woodland_mansion/1x2_b2.nbt b/data/minecraft/structure/woodland_mansion/1x2_b2.nbt index 3ea63337..ae686ef6 100644 --- a/data/minecraft/structure/woodland_mansion/1x2_b2.nbt +++ b/data/minecraft/structure/woodland_mansion/1x2_b2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b7e2d8f612d7b3c51d0489568ceba9f9a7c287b64456c0d1f8354c39de4c64b1 -size 3133 +oid sha256:b03406fa1703969463026ba1b6d19ea548324e7182aafd022e8bda5a11004018 +size 3135 diff --git a/data/minecraft/structure/woodland_mansion/1x2_b3.nbt b/data/minecraft/structure/woodland_mansion/1x2_b3.nbt index e823a9ef..a305af37 100644 --- a/data/minecraft/structure/woodland_mansion/1x2_b3.nbt +++ b/data/minecraft/structure/woodland_mansion/1x2_b3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8528b2a00e683506ed625076f91da34037ace329d9839f00b7c59795687510fd -size 2791 +oid sha256:ba6dad0270419c831e790cd0558217cc94457ff3265481d9d90e23b51fedd7ab +size 2794 diff --git a/data/minecraft/structure/woodland_mansion/1x2_b4.nbt b/data/minecraft/structure/woodland_mansion/1x2_b4.nbt index 2be684ee..fb69d0f7 100644 --- a/data/minecraft/structure/woodland_mansion/1x2_b4.nbt +++ b/data/minecraft/structure/woodland_mansion/1x2_b4.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9d0a92775593ac096a0b631167b406168ab6beb40f1088d54933c35b84cb6e87 -size 2962 +oid sha256:d0222a2e37e902edabbb2211ae6ce50f2c1da81d3181f3493c7292c27b0c3423 +size 2965 diff --git a/data/minecraft/structure/woodland_mansion/1x2_b5.nbt b/data/minecraft/structure/woodland_mansion/1x2_b5.nbt index 51d81f77..e960575a 100644 --- a/data/minecraft/structure/woodland_mansion/1x2_b5.nbt +++ b/data/minecraft/structure/woodland_mansion/1x2_b5.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b885be131a4f2e47e4b34b96e037df0869fb4a157b155cd0afff5b22bf732a07 -size 2406 +oid sha256:8f0f108f43cad31535e007a713eca359213190cdbf9cc52bfe8ff5ea07319cdd +size 2409 diff --git a/data/minecraft/structure/woodland_mansion/1x2_c1.nbt b/data/minecraft/structure/woodland_mansion/1x2_c1.nbt index a38fb3d3..5e915502 100644 --- a/data/minecraft/structure/woodland_mansion/1x2_c1.nbt +++ b/data/minecraft/structure/woodland_mansion/1x2_c1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b62354b4a3835c119e1ab7a57f31db7d88e38d87bba5b9ade06f1b10466b69a9 -size 3546 +oid sha256:8d74e5a919d621122874c0eaad9b988a137ce934c39659222c4957dfe6273c61 +size 3548 diff --git a/data/minecraft/structure/woodland_mansion/1x2_c2.nbt b/data/minecraft/structure/woodland_mansion/1x2_c2.nbt index 64837bcc..3d91189b 100644 --- a/data/minecraft/structure/woodland_mansion/1x2_c2.nbt +++ b/data/minecraft/structure/woodland_mansion/1x2_c2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1eca716a45ff2fa53ff4b38cd1f87a0809fd3d26ef803979f12da88ce7f89ab2 -size 3346 +oid sha256:0830302037c66b1a2a40a5d0b6188deab13d9326bb82aff404368a8809c0b22d +size 3349 diff --git a/data/minecraft/structure/woodland_mansion/1x2_c3.nbt b/data/minecraft/structure/woodland_mansion/1x2_c3.nbt index e9e26c92..5705c738 100644 --- a/data/minecraft/structure/woodland_mansion/1x2_c3.nbt +++ b/data/minecraft/structure/woodland_mansion/1x2_c3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a1378e083c5d83f85d611749359fcf99c28fc91a9010a13b1a21fc709f1add4e -size 3614 +oid sha256:68cc99109345d8bea9c031e3a0ab3f44a952b145ee783fb5e83084d7f092d115 +size 3618 diff --git a/data/minecraft/structure/woodland_mansion/1x2_c4.nbt b/data/minecraft/structure/woodland_mansion/1x2_c4.nbt index 9f9e296e..50865390 100644 --- a/data/minecraft/structure/woodland_mansion/1x2_c4.nbt +++ b/data/minecraft/structure/woodland_mansion/1x2_c4.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0d1f6c811714f88af9d7eddfc2e5b2a59e11f7d1a8b8e1a2ec482bf4b18f2c60 -size 3618 +oid sha256:f108a626aae2403b1eb2db4fd362557bb00cf11be2b24eae8b38c432b16b9161 +size 3621 diff --git a/data/minecraft/structure/woodland_mansion/1x2_c_stairs.nbt b/data/minecraft/structure/woodland_mansion/1x2_c_stairs.nbt index e8a48cb8..343bc1db 100644 --- a/data/minecraft/structure/woodland_mansion/1x2_c_stairs.nbt +++ b/data/minecraft/structure/woodland_mansion/1x2_c_stairs.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2d02b2e76337940284e81a56ec0dc8f0f81aaacc8601f77081c1f19f023ca3ed -size 6729 +oid sha256:662e9334a931214a4b3167de06e3dd3ec9885fb76fb04bc5e3bca9fc36e6490d +size 6731 diff --git a/data/minecraft/structure/woodland_mansion/1x2_d1.nbt b/data/minecraft/structure/woodland_mansion/1x2_d1.nbt index 8bca96c4..c8969539 100644 --- a/data/minecraft/structure/woodland_mansion/1x2_d1.nbt +++ b/data/minecraft/structure/woodland_mansion/1x2_d1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2c1f9e82acea1d0fc695ede7ddd69b9bf1e1ddc03ed237e160148d3c711badb4 -size 3732 +oid sha256:0ac1fc9933aa82ff218e16c7fa463de48f4a1a50d935374edd4eb7c6f2ac2c9a +size 3735 diff --git a/data/minecraft/structure/woodland_mansion/1x2_d2.nbt b/data/minecraft/structure/woodland_mansion/1x2_d2.nbt index 80a33476..6358268d 100644 --- a/data/minecraft/structure/woodland_mansion/1x2_d2.nbt +++ b/data/minecraft/structure/woodland_mansion/1x2_d2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5b772e3331ab9f6c30d3f6ed10bb5ae0316bb8e7081d60a4b864f57b77033a68 -size 3904 +oid sha256:b0d9080c7b08705dcab4161b2a14c57f5b16f73a7ab06b297adb58300b962c5a +size 3906 diff --git a/data/minecraft/structure/woodland_mansion/1x2_d3.nbt b/data/minecraft/structure/woodland_mansion/1x2_d3.nbt index bb31f81e..8dcabbe9 100644 --- a/data/minecraft/structure/woodland_mansion/1x2_d3.nbt +++ b/data/minecraft/structure/woodland_mansion/1x2_d3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9a6cd023a34b1ad5cb99017d5c77b5b40a5d313cf46e6acb6508846f5e11e810 -size 3842 +oid sha256:e7a1ad87f3f6a63a058eebdb3f577239fb614dcd53c6352c0ba67ec85c46a95f +size 3844 diff --git a/data/minecraft/structure/woodland_mansion/1x2_d4.nbt b/data/minecraft/structure/woodland_mansion/1x2_d4.nbt index e0e6ac0f..17d8a350 100644 --- a/data/minecraft/structure/woodland_mansion/1x2_d4.nbt +++ b/data/minecraft/structure/woodland_mansion/1x2_d4.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1858d06878081ec0a18964d59312cf988d97a9fc457d9f8503061fb1e9c4f20a -size 3407 +oid sha256:1a9b53a66e3c1a5d4ba5c29ae68916b01e7595a799c71ea87b0a8faebfaa58f6 +size 3409 diff --git a/data/minecraft/structure/woodland_mansion/1x2_d5.nbt b/data/minecraft/structure/woodland_mansion/1x2_d5.nbt index 83eedfd8..18449746 100644 --- a/data/minecraft/structure/woodland_mansion/1x2_d5.nbt +++ b/data/minecraft/structure/woodland_mansion/1x2_d5.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3a4a5fd6549030e1df1d6bf04abe0044714bc6948a108ba407091e14af817d06 -size 3371 +oid sha256:8f38ab49d83b6855eb3b7f044ffb796c44d19a397dcd47a8c9fcecde66f58d3d +size 3374 diff --git a/data/minecraft/structure/woodland_mansion/1x2_d_stairs.nbt b/data/minecraft/structure/woodland_mansion/1x2_d_stairs.nbt index e9bfd3d7..259fb413 100644 --- a/data/minecraft/structure/woodland_mansion/1x2_d_stairs.nbt +++ b/data/minecraft/structure/woodland_mansion/1x2_d_stairs.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6429638d959a39f6caa92cee638ed913920e56a3ee51d8fbfd6332d8df046713 -size 6624 +oid sha256:f79f688776622c0ec3369a16a19e40d61c3f2a8e62bc540fc740b078a135417c +size 6626 diff --git a/data/minecraft/structure/woodland_mansion/1x2_s1.nbt b/data/minecraft/structure/woodland_mansion/1x2_s1.nbt index b7b462c1..01a2b8d5 100644 --- a/data/minecraft/structure/woodland_mansion/1x2_s1.nbt +++ b/data/minecraft/structure/woodland_mansion/1x2_s1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2b862f2da0c6b906b8d691a8601097f9e833658f9a4dfa1ceb0e8f3978d122a0 -size 2685 +oid sha256:ac0c253807b7e5dc03974cd87a5ceee9f0ce8f2138176c7c7233b488710d48bd +size 2687 diff --git a/data/minecraft/structure/woodland_mansion/1x2_s2.nbt b/data/minecraft/structure/woodland_mansion/1x2_s2.nbt index fd7f8473..69e0c72c 100644 --- a/data/minecraft/structure/woodland_mansion/1x2_s2.nbt +++ b/data/minecraft/structure/woodland_mansion/1x2_s2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:fa07df1cfedeff103d3f0f33277c05676f5e568f5ef85e19fce79ec28ab90463 -size 2729 +oid sha256:45b474f03dd27c58fe1417eb719c0109199533cd32d32f7c72326e5a73c6d741 +size 2733 diff --git a/data/minecraft/structure/woodland_mansion/1x2_se1.nbt b/data/minecraft/structure/woodland_mansion/1x2_se1.nbt index d4c40272..3fa84c35 100644 --- a/data/minecraft/structure/woodland_mansion/1x2_se1.nbt +++ b/data/minecraft/structure/woodland_mansion/1x2_se1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d23d8d738639544d0dc167b31b53adfd2ac254db7f2d634c953c8f5af3fabce3 -size 3881 +oid sha256:a7c9c736347ee6466cbe7375d0009dd5aef659eac6a5df4a1583f11ced7628ac +size 3885 diff --git a/data/minecraft/structure/woodland_mansion/2x2_a1.nbt b/data/minecraft/structure/woodland_mansion/2x2_a1.nbt index 98af0a26..80ae343e 100644 --- a/data/minecraft/structure/woodland_mansion/2x2_a1.nbt +++ b/data/minecraft/structure/woodland_mansion/2x2_a1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:633ec4afc71873a1c05bd02419371fe8001aa4dfae930f7ed93de01bc496eaa6 -size 6287 +oid sha256:5964e71ed7ddbb9507ffaa6be6f1373398a6d94591c6390e63af6a9ee9075e4a +size 6290 diff --git a/data/minecraft/structure/woodland_mansion/2x2_a2.nbt b/data/minecraft/structure/woodland_mansion/2x2_a2.nbt index bb2e1d2a..a093bec8 100644 --- a/data/minecraft/structure/woodland_mansion/2x2_a2.nbt +++ b/data/minecraft/structure/woodland_mansion/2x2_a2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9102d0f9281d632346e2493ce86e90959e9b103adddc556883b5a2696bea7583 -size 5632 +oid sha256:593d43b2f003a1e8498b3b6a43993e10c07d2993c7929b244bf4cd0c02486954 +size 5634 diff --git a/data/minecraft/structure/woodland_mansion/2x2_a3.nbt b/data/minecraft/structure/woodland_mansion/2x2_a3.nbt index 7e2b345b..22730733 100644 --- a/data/minecraft/structure/woodland_mansion/2x2_a3.nbt +++ b/data/minecraft/structure/woodland_mansion/2x2_a3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5a801881381be173a04cdc4639505eb9f21364e6c508a4ff46abbb9903eb2e23 -size 5212 +oid sha256:6ce03b05bdd3be8b1c45f12644f081c92a142d8e1c5d11dd4e1f030100fb1758 +size 5214 diff --git a/data/minecraft/structure/woodland_mansion/2x2_a4.nbt b/data/minecraft/structure/woodland_mansion/2x2_a4.nbt index 42187e83..43984bca 100644 --- a/data/minecraft/structure/woodland_mansion/2x2_a4.nbt +++ b/data/minecraft/structure/woodland_mansion/2x2_a4.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b130d0d8f80fc9e5d1ea089b12014ffff3e9e236159ea7213d795c196f1af8fa -size 5407 +oid sha256:ea821132effecdb4987599c2ed3b737d515a15517157e9e7c1938225fed9f6a4 +size 5410 diff --git a/data/minecraft/structure/woodland_mansion/2x2_b1.nbt b/data/minecraft/structure/woodland_mansion/2x2_b1.nbt index 956bf621..8f29a5ba 100644 --- a/data/minecraft/structure/woodland_mansion/2x2_b1.nbt +++ b/data/minecraft/structure/woodland_mansion/2x2_b1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d81f888d71b859617fa2ec1af418a855e4f13731c7af3edb51dbb8dbb44bfdf4 -size 7312 +oid sha256:50958acfab6a25af02f261266f0586019bc7b6d106b8c76c2dca830ecfd173ca +size 7314 diff --git a/data/minecraft/structure/woodland_mansion/2x2_b2.nbt b/data/minecraft/structure/woodland_mansion/2x2_b2.nbt index 46901d3d..b37f0ef1 100644 --- a/data/minecraft/structure/woodland_mansion/2x2_b2.nbt +++ b/data/minecraft/structure/woodland_mansion/2x2_b2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:90f9371c1f4660255161d2590d681863fb5b2eb38e57a352eb0cc41e5bb4a39f -size 7298 +oid sha256:3a3c253a191fb69aaa998ce21f5cd8a9847e7eb82247b953b947f2e1fc64b152 +size 7300 diff --git a/data/minecraft/structure/woodland_mansion/2x2_b3.nbt b/data/minecraft/structure/woodland_mansion/2x2_b3.nbt index 4498344d..3f1d3a68 100644 --- a/data/minecraft/structure/woodland_mansion/2x2_b3.nbt +++ b/data/minecraft/structure/woodland_mansion/2x2_b3.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4d0aaa7b76488a28b91277333909415a0811ee4c14ef862294197a060012042d -size 7103 +oid sha256:c714e55801e66bcb36100818e6a8154a56be7643b0249d40e61876c9bd32623f +size 7105 diff --git a/data/minecraft/structure/woodland_mansion/2x2_b4.nbt b/data/minecraft/structure/woodland_mansion/2x2_b4.nbt index b8742c9f..9ff35662 100644 --- a/data/minecraft/structure/woodland_mansion/2x2_b4.nbt +++ b/data/minecraft/structure/woodland_mansion/2x2_b4.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:61f9cbadd0b6ae3331a7f4be7b0deb72e97981838d4cce9f85b0c76bac62361b -size 7240 +oid sha256:d394e9e9ce1cae422a5531288155284a36e79fea67135c4e6ee1e982fe426ce2 +size 7242 diff --git a/data/minecraft/structure/woodland_mansion/2x2_b5.nbt b/data/minecraft/structure/woodland_mansion/2x2_b5.nbt index 8d3288ab..cb567f59 100644 --- a/data/minecraft/structure/woodland_mansion/2x2_b5.nbt +++ b/data/minecraft/structure/woodland_mansion/2x2_b5.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:66aa9d58f12314ee3240d9d50a9f81efd35f9e4eea03f7b75401d694bc32f636 -size 7542 +oid sha256:2bb4c0ad8735901846eb7d99677c4dbc0240c412ea08fc51a6ea2fa811416ba8 +size 7544 diff --git a/data/minecraft/structure/woodland_mansion/2x2_s1.nbt b/data/minecraft/structure/woodland_mansion/2x2_s1.nbt index c38a1dd8..1fdfee3f 100644 --- a/data/minecraft/structure/woodland_mansion/2x2_s1.nbt +++ b/data/minecraft/structure/woodland_mansion/2x2_s1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:fc94a5981350a79e370478c2bcd754918457c31826596c56ad0b4efd0bb262f1 -size 6792 +oid sha256:86c01d9d5f23ada403d73af03fc11227240dc7091f4ab35c8444eeeaa6c2551f +size 6794 diff --git a/data/minecraft/structure/woodland_mansion/carpet_east.nbt b/data/minecraft/structure/woodland_mansion/carpet_east.nbt index 107b7cd1..3e945d38 100644 --- a/data/minecraft/structure/woodland_mansion/carpet_east.nbt +++ b/data/minecraft/structure/woodland_mansion/carpet_east.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:030cf23bf0ff5de8a15a59e1b8cffe7aec4761ae28ff91edacfb3d3c885375bd -size 177 +oid sha256:794930ad8b32763243d572fb9e9e05e455868be494415e1902958b0a4d3f77af +size 180 diff --git a/data/minecraft/structure/woodland_mansion/carpet_north.nbt b/data/minecraft/structure/woodland_mansion/carpet_north.nbt index 35f3e04a..ce3d1aa5 100644 --- a/data/minecraft/structure/woodland_mansion/carpet_north.nbt +++ b/data/minecraft/structure/woodland_mansion/carpet_north.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d6d3d1d4b9b0dac8290ea98e75891a7751abee1744beefb3e58894053c8781ed -size 176 +oid sha256:246977ec788298c4af0ff4fe06a9606f46d4a69582fd1ec9460acfef0e2ce6ce +size 178 diff --git a/data/minecraft/structure/woodland_mansion/carpet_south_1.nbt b/data/minecraft/structure/woodland_mansion/carpet_south_1.nbt index b066c668..a72fe644 100644 --- a/data/minecraft/structure/woodland_mansion/carpet_south_1.nbt +++ b/data/minecraft/structure/woodland_mansion/carpet_south_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a42d1c3cf5be606ad9014068a8c8d33883f85e271518cd6df1b4095c03fc6aab -size 718 +oid sha256:4e8a0d3a7d5d10a10a83b351f5cbc9f44e0298daf53824e8fa4a55042fd2ad07 +size 721 diff --git a/data/minecraft/structure/woodland_mansion/carpet_south_2.nbt b/data/minecraft/structure/woodland_mansion/carpet_south_2.nbt index 3505636c..4893d44e 100644 --- a/data/minecraft/structure/woodland_mansion/carpet_south_2.nbt +++ b/data/minecraft/structure/woodland_mansion/carpet_south_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4ee4efe78bc43bbae5cba75092895d329e1873cc2c4ad11ef4dfa2351054c1ba -size 927 +oid sha256:fec55c09ac61385babe21daf873dd0fc4068c0fb0f3ab7e3edb782bf7aae42b4 +size 928 diff --git a/data/minecraft/structure/woodland_mansion/carpet_west_1.nbt b/data/minecraft/structure/woodland_mansion/carpet_west_1.nbt index a3a73ef0..70001260 100644 --- a/data/minecraft/structure/woodland_mansion/carpet_west_1.nbt +++ b/data/minecraft/structure/woodland_mansion/carpet_west_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:619073c729cced0ca06bf95e556e93f79705e114b10cc6dce9bfd96c51dae6cd -size 791 +oid sha256:b477b37942d323d95cfe36238c64179c0969fa1ede01eadd7c62c14328f79876 +size 793 diff --git a/data/minecraft/structure/woodland_mansion/carpet_west_2.nbt b/data/minecraft/structure/woodland_mansion/carpet_west_2.nbt index 88cfa22b..ca763844 100644 --- a/data/minecraft/structure/woodland_mansion/carpet_west_2.nbt +++ b/data/minecraft/structure/woodland_mansion/carpet_west_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f1c7f1429713e981546f64f9244afe4b20d02da3fd70fbbf2452443d0e3e52ec -size 1018 +oid sha256:078c8d4ae3dbd41c85bca104e66b25eff2d547c96c00e5a0208a81f9350c4fc9 +size 1019 diff --git a/data/minecraft/structure/woodland_mansion/corridor_floor.nbt b/data/minecraft/structure/woodland_mansion/corridor_floor.nbt index ab1f06c3..0d2598ca 100644 --- a/data/minecraft/structure/woodland_mansion/corridor_floor.nbt +++ b/data/minecraft/structure/woodland_mansion/corridor_floor.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:fb89cb4b7379760d1046f3edc93e05cf1872a01bb153de6aaba8cca50e0fa1ae -size 1169 +oid sha256:ff15125e022eac7d1e0c0534c054199b250b1c6eabb513578450083c2e3059d6 +size 1172 diff --git a/data/minecraft/structure/woodland_mansion/entrance.nbt b/data/minecraft/structure/woodland_mansion/entrance.nbt index e2d60d48..4c6a13bd 100644 --- a/data/minecraft/structure/woodland_mansion/entrance.nbt +++ b/data/minecraft/structure/woodland_mansion/entrance.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:761cc945f1dddce4b4a269fab788d05ed46e4de833743e6f49c75db844f68254 -size 18252 +oid sha256:1825946a75b08630adad6c0131205b12e43031c8f8b4bfd8fed0981b9e0bd09a +size 18256 diff --git a/data/minecraft/structure/woodland_mansion/indoors_door_1.nbt b/data/minecraft/structure/woodland_mansion/indoors_door_1.nbt index d1d7eac9..7cf90228 100644 --- a/data/minecraft/structure/woodland_mansion/indoors_door_1.nbt +++ b/data/minecraft/structure/woodland_mansion/indoors_door_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:22cef53f7b5e9bad12983f045fbdc774b184be26e39a09db756accfd42e3d5d5 -size 407 +oid sha256:c558dc510da0aaa0b5c7d75aeaaf228dc2356c87a49476459b7d1a7fd3515130 +size 410 diff --git a/data/minecraft/structure/woodland_mansion/indoors_door_2.nbt b/data/minecraft/structure/woodland_mansion/indoors_door_2.nbt index a1c74e5b..40ef0505 100644 --- a/data/minecraft/structure/woodland_mansion/indoors_door_2.nbt +++ b/data/minecraft/structure/woodland_mansion/indoors_door_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b7400b42f7f4006a607ed39b2b79e917fe822e4f112e51f6678462568d29635c -size 502 +oid sha256:17adfe2577e314d0704a2603d60e2fbe4f2e7189ef000b4b9057a5081db019e6 +size 505 diff --git a/data/minecraft/structure/woodland_mansion/indoors_wall_1.nbt b/data/minecraft/structure/woodland_mansion/indoors_wall_1.nbt index bb5aa0e9..41d72da1 100644 --- a/data/minecraft/structure/woodland_mansion/indoors_wall_1.nbt +++ b/data/minecraft/structure/woodland_mansion/indoors_wall_1.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:007bf75cc3a3fb4dda0237692dff022bea598bdca81d62436371e28fddc5d194 -size 363 +oid sha256:c03649c1ec72dfd9f6d940cbd935072212c502f92f9dc37eb8a87386a5d2a260 +size 366 diff --git a/data/minecraft/structure/woodland_mansion/indoors_wall_2.nbt b/data/minecraft/structure/woodland_mansion/indoors_wall_2.nbt index a82dca1a..a204b058 100644 --- a/data/minecraft/structure/woodland_mansion/indoors_wall_2.nbt +++ b/data/minecraft/structure/woodland_mansion/indoors_wall_2.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:40ae34678323e0e47d0bec668f158b05cbedab4d972b01a1243124c5cbae26a9 -size 440 +oid sha256:e67a98670c2304179e0d9225e15b724f49ea8fda43798c788d26479e6e77d469 +size 442 diff --git a/data/minecraft/structure/woodland_mansion/roof.nbt b/data/minecraft/structure/woodland_mansion/roof.nbt index 6129ac9e..e81f2916 100644 --- a/data/minecraft/structure/woodland_mansion/roof.nbt +++ b/data/minecraft/structure/woodland_mansion/roof.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c4536a8584d35124c3ee01509febdc21b0f8625a184870f234d89702e1ce5ea4 -size 330 +oid sha256:492273453228dbfd1e579553c6f4530ecef4f83cbe4f39aff46d3b244184c088 +size 333 diff --git a/data/minecraft/structure/woodland_mansion/roof_corner.nbt b/data/minecraft/structure/woodland_mansion/roof_corner.nbt index 58b8e0e6..652be511 100644 --- a/data/minecraft/structure/woodland_mansion/roof_corner.nbt +++ b/data/minecraft/structure/woodland_mansion/roof_corner.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4c23c8ba774bd7bfe5a9b26035e0312a42bb486c335a2236e674bf4b64dbe08b -size 447 +oid sha256:72b7908140f837fe427f612ea4e8a3d7617597b0f579335b17847940644cac9d +size 450 diff --git a/data/minecraft/structure/woodland_mansion/roof_front.nbt b/data/minecraft/structure/woodland_mansion/roof_front.nbt index e2ca5258..e5fceeb4 100644 --- a/data/minecraft/structure/woodland_mansion/roof_front.nbt +++ b/data/minecraft/structure/woodland_mansion/roof_front.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:44be601e6cc5da953b1df90bc211de23fecee06bce1c3622a322d8068ca1229e -size 633 +oid sha256:7bdbbd0ebc792c716649a8c026ea87ab3a53da02c165d8429f6c5cb4d86b5699 +size 636 diff --git a/data/minecraft/structure/woodland_mansion/roof_inner_corner.nbt b/data/minecraft/structure/woodland_mansion/roof_inner_corner.nbt index f59eaa27..60461142 100644 --- a/data/minecraft/structure/woodland_mansion/roof_inner_corner.nbt +++ b/data/minecraft/structure/woodland_mansion/roof_inner_corner.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c3b6b92876a737ec251c710ebd0b9c86bb8371e7428bd343185720949f426599 -size 443 +oid sha256:0bc4ca3bf3dbda73c0846cf7f58c89df5f4395f2075ffbf80d29dcc58f750f8d +size 445 diff --git a/data/minecraft/structure/woodland_mansion/small_wall.nbt b/data/minecraft/structure/woodland_mansion/small_wall.nbt index 26f80f7f..ead6d458 100644 --- a/data/minecraft/structure/woodland_mansion/small_wall.nbt +++ b/data/minecraft/structure/woodland_mansion/small_wall.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ae829869eee59855421fce87611f9bd1f46a0fe7802db597f67ddfcac46a2b48 -size 509 +oid sha256:a126a11dabe46c248dca27bb11b9668ccc6e53472f27135f61959bc29c46310e +size 511 diff --git a/data/minecraft/structure/woodland_mansion/small_wall_corner.nbt b/data/minecraft/structure/woodland_mansion/small_wall_corner.nbt index 7b2cab4e..83179e33 100644 --- a/data/minecraft/structure/woodland_mansion/small_wall_corner.nbt +++ b/data/minecraft/structure/woodland_mansion/small_wall_corner.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7336091e2796b1d29766aef0a01986c4806fb31aa7eaf85f86c079c4cb3f22e7 -size 259 +oid sha256:007847ff4b54346856bf7da822860ba7bc2853a73ce9b7a5fb85dac6e1adb240 +size 262 diff --git a/data/minecraft/structure/woodland_mansion/wall_corner.nbt b/data/minecraft/structure/woodland_mansion/wall_corner.nbt index 565d28f0..41096edb 100644 --- a/data/minecraft/structure/woodland_mansion/wall_corner.nbt +++ b/data/minecraft/structure/woodland_mansion/wall_corner.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:397db5d27b367a0a26c13f08c8545a698650a56d96ab832e25804763ea698a09 -size 306 +oid sha256:eee3c7058ba4bfdb79424d7972215d3ad438722bdc1cd90ebfc5024d330b360c +size 308 diff --git a/data/minecraft/structure/woodland_mansion/wall_flat.nbt b/data/minecraft/structure/woodland_mansion/wall_flat.nbt index abc935db..662e690a 100644 --- a/data/minecraft/structure/woodland_mansion/wall_flat.nbt +++ b/data/minecraft/structure/woodland_mansion/wall_flat.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e1394bf614ce1738c16cc096ce7cf39ca9494c13897fd91f0f64506df329ceb1 -size 724 +oid sha256:1338f6702ff83000e79287157dc348197be30edcde3b020cea8c1381c8b53a10 +size 727 diff --git a/data/minecraft/structure/woodland_mansion/wall_window.nbt b/data/minecraft/structure/woodland_mansion/wall_window.nbt index c9bd6680..b6859e0f 100644 --- a/data/minecraft/structure/woodland_mansion/wall_window.nbt +++ b/data/minecraft/structure/woodland_mansion/wall_window.nbt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:036bc2bcf6a7687f300503af5e4101547d89d9c22065cc9484a6c5030de92a18 -size 828 +oid sha256:f8e74e985ae8b79d398e0beefeca06232fe4a89645a351a5fb27a8d987ca3a5e +size 831 diff --git a/data/minecraft/tags/banner_pattern/no_item_required.json b/data/minecraft/tags/banner_pattern/no_item_required.json index 3cc5a9f2..301d4e8d 100644 --- a/data/minecraft/tags/banner_pattern/no_item_required.json +++ b/data/minecraft/tags/banner_pattern/no_item_required.json @@ -30,9 +30,7 @@ "minecraft:half_vertical_right", "minecraft:half_horizontal_bottom", "minecraft:border", - "minecraft:curly_border", "minecraft:gradient", - "minecraft:gradient_up", - "minecraft:bricks" + "minecraft:gradient_up" ] } \ No newline at end of file diff --git a/data/minecraft/tags/banner_pattern/pattern_item/bordure_indented.json b/data/minecraft/tags/banner_pattern/pattern_item/bordure_indented.json new file mode 100644 index 00000000..f0386070 --- /dev/null +++ b/data/minecraft/tags/banner_pattern/pattern_item/bordure_indented.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:curly_border" + ] +} \ No newline at end of file diff --git a/data/minecraft/tags/banner_pattern/pattern_item/field_masoned.json b/data/minecraft/tags/banner_pattern/pattern_item/field_masoned.json new file mode 100644 index 00000000..e7d8939e --- /dev/null +++ b/data/minecraft/tags/banner_pattern/pattern_item/field_masoned.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:bricks" + ] +} \ No newline at end of file diff --git a/data/minecraft/tags/block/bats_spawnable_on.json b/data/minecraft/tags/block/bats_spawnable_on.json new file mode 100644 index 00000000..511ad97c --- /dev/null +++ b/data/minecraft/tags/block/bats_spawnable_on.json @@ -0,0 +1,5 @@ +{ + "values": [ + "#minecraft:base_stone_overworld" + ] +} \ No newline at end of file diff --git a/data/minecraft/tags/damage_type/bypasses_armor.json b/data/minecraft/tags/damage_type/bypasses_armor.json index 6803d2b3..03637734 100644 --- a/data/minecraft/tags/damage_type/bypasses_armor.json +++ b/data/minecraft/tags/damage_type/bypasses_armor.json @@ -10,6 +10,7 @@ "minecraft:dragon_breath", "minecraft:starve", "minecraft:fall", + "minecraft:ender_pearl", "minecraft:freeze", "minecraft:stalagmite", "minecraft:magic", diff --git a/data/minecraft/tags/damage_type/can_break_armor_stand.json b/data/minecraft/tags/damage_type/can_break_armor_stand.json index 2bc997da..edabbaaf 100644 --- a/data/minecraft/tags/damage_type/can_break_armor_stand.json +++ b/data/minecraft/tags/damage_type/can_break_armor_stand.json @@ -1,6 +1,6 @@ { "values": [ - "minecraft:player_attack", - "minecraft:player_explosion" + "minecraft:player_explosion", + "#minecraft:is_player_attack" ] } \ No newline at end of file diff --git a/data/minecraft/tags/damage_type/is_fall.json b/data/minecraft/tags/damage_type/is_fall.json index bc462617..fbbb7938 100644 --- a/data/minecraft/tags/damage_type/is_fall.json +++ b/data/minecraft/tags/damage_type/is_fall.json @@ -1,6 +1,7 @@ { "values": [ "minecraft:fall", + "minecraft:ender_pearl", "minecraft:stalagmite" ] } \ No newline at end of file diff --git a/data/minecraft/tags/damage_type/is_player_attack.json b/data/minecraft/tags/damage_type/is_player_attack.json index 5531338d..55b0aeb3 100644 --- a/data/minecraft/tags/damage_type/is_player_attack.json +++ b/data/minecraft/tags/damage_type/is_player_attack.json @@ -1,5 +1,6 @@ { "values": [ - "minecraft:player_attack" + "minecraft:player_attack", + "minecraft:mace_smash" ] } \ No newline at end of file diff --git a/data/minecraft/tags/damage_type/mace_smash.json b/data/minecraft/tags/damage_type/mace_smash.json new file mode 100644 index 00000000..66e2ac15 --- /dev/null +++ b/data/minecraft/tags/damage_type/mace_smash.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:mace_smash" + ] +} \ No newline at end of file diff --git a/data/minecraft/tags/damage_type/no_knockback.json b/data/minecraft/tags/damage_type/no_knockback.json index 383180f6..b0c8fa58 100644 --- a/data/minecraft/tags/damage_type/no_knockback.json +++ b/data/minecraft/tags/damage_type/no_knockback.json @@ -14,6 +14,7 @@ "minecraft:starve", "minecraft:cactus", "minecraft:fall", + "minecraft:ender_pearl", "minecraft:fly_into_wall", "minecraft:out_of_world", "minecraft:generic", diff --git a/data/minecraft/tags/damage_type/panic_causes.json b/data/minecraft/tags/damage_type/panic_causes.json index bb9c5934..8114375d 100644 --- a/data/minecraft/tags/damage_type/panic_causes.json +++ b/data/minecraft/tags/damage_type/panic_causes.json @@ -10,7 +10,6 @@ "minecraft:magic", "minecraft:mob_attack", "minecraft:mob_projectile", - "minecraft:player_attack", "minecraft:player_explosion", "minecraft:sonic_boom", "minecraft:sting", @@ -19,6 +18,7 @@ "minecraft:unattributed_fireball", "minecraft:wind_charge", "minecraft:wither", - "minecraft:wither_skull" + "minecraft:wither_skull", + "#minecraft:is_player_attack" ] } \ No newline at end of file diff --git a/data/minecraft/tags/entity_type/boat.json b/data/minecraft/tags/entity_type/boat.json new file mode 100644 index 00000000..bd774486 --- /dev/null +++ b/data/minecraft/tags/entity_type/boat.json @@ -0,0 +1,13 @@ +{ + "values": [ + "minecraft:oak_boat", + "minecraft:spruce_boat", + "minecraft:birch_boat", + "minecraft:jungle_boat", + "minecraft:acacia_boat", + "minecraft:cherry_boat", + "minecraft:dark_oak_boat", + "minecraft:mangrove_boat", + "minecraft:bamboo_raft" + ] +} \ No newline at end of file diff --git a/data/minecraft/tags/item/brewing_fuel.json b/data/minecraft/tags/item/brewing_fuel.json new file mode 100644 index 00000000..10d5c868 --- /dev/null +++ b/data/minecraft/tags/item/brewing_fuel.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:blaze_powder" + ] +} \ No newline at end of file diff --git a/data/minecraft/tags/item/bundles.json b/data/minecraft/tags/item/bundles.json new file mode 100644 index 00000000..b59d1468 --- /dev/null +++ b/data/minecraft/tags/item/bundles.json @@ -0,0 +1,21 @@ +{ + "values": [ + "minecraft:bundle", + "minecraft:black_bundle", + "minecraft:blue_bundle", + "minecraft:brown_bundle", + "minecraft:cyan_bundle", + "minecraft:gray_bundle", + "minecraft:green_bundle", + "minecraft:light_blue_bundle", + "minecraft:light_gray_bundle", + "minecraft:lime_bundle", + "minecraft:magenta_bundle", + "minecraft:orange_bundle", + "minecraft:pink_bundle", + "minecraft:purple_bundle", + "minecraft:red_bundle", + "minecraft:yellow_bundle", + "minecraft:white_bundle" + ] +} \ No newline at end of file diff --git a/data/minecraft/tags/item/diamond_tool_materials.json b/data/minecraft/tags/item/diamond_tool_materials.json new file mode 100644 index 00000000..f44f30dd --- /dev/null +++ b/data/minecraft/tags/item/diamond_tool_materials.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:diamond" + ] +} \ No newline at end of file diff --git a/data/minecraft/tags/item/duplicates_allays.json b/data/minecraft/tags/item/duplicates_allays.json new file mode 100644 index 00000000..742ef896 --- /dev/null +++ b/data/minecraft/tags/item/duplicates_allays.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:amethyst_shard" + ] +} \ No newline at end of file diff --git a/data/minecraft/tags/item/furnace_minecart_fuel.json b/data/minecraft/tags/item/furnace_minecart_fuel.json new file mode 100644 index 00000000..43868c8e --- /dev/null +++ b/data/minecraft/tags/item/furnace_minecart_fuel.json @@ -0,0 +1,6 @@ +{ + "values": [ + "minecraft:coal", + "minecraft:charcoal" + ] +} \ No newline at end of file diff --git a/data/minecraft/tags/item/gaze_disguise_equipment.json b/data/minecraft/tags/item/gaze_disguise_equipment.json new file mode 100644 index 00000000..1a0f6d39 --- /dev/null +++ b/data/minecraft/tags/item/gaze_disguise_equipment.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:carved_pumpkin" + ] +} \ No newline at end of file diff --git a/data/minecraft/tags/item/gold_tool_materials.json b/data/minecraft/tags/item/gold_tool_materials.json new file mode 100644 index 00000000..07e9f66a --- /dev/null +++ b/data/minecraft/tags/item/gold_tool_materials.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:gold_ingot" + ] +} \ No newline at end of file diff --git a/data/minecraft/tags/item/iron_tool_materials.json b/data/minecraft/tags/item/iron_tool_materials.json new file mode 100644 index 00000000..c656021b --- /dev/null +++ b/data/minecraft/tags/item/iron_tool_materials.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:iron_ingot" + ] +} \ No newline at end of file diff --git a/data/minecraft/tags/item/map_invisibility_equipment.json b/data/minecraft/tags/item/map_invisibility_equipment.json new file mode 100644 index 00000000..1a0f6d39 --- /dev/null +++ b/data/minecraft/tags/item/map_invisibility_equipment.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:carved_pumpkin" + ] +} \ No newline at end of file diff --git a/data/minecraft/tags/item/netherite_tool_materials.json b/data/minecraft/tags/item/netherite_tool_materials.json new file mode 100644 index 00000000..bd6929df --- /dev/null +++ b/data/minecraft/tags/item/netherite_tool_materials.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:netherite_ingot" + ] +} \ No newline at end of file diff --git a/data/minecraft/tags/item/panda_eats_from_ground.json b/data/minecraft/tags/item/panda_eats_from_ground.json new file mode 100644 index 00000000..421a2fc2 --- /dev/null +++ b/data/minecraft/tags/item/panda_eats_from_ground.json @@ -0,0 +1,6 @@ +{ + "values": [ + "#minecraft:panda_food", + "minecraft:cake" + ] +} \ No newline at end of file diff --git a/data/minecraft/tags/item/piglin_safe_armor.json b/data/minecraft/tags/item/piglin_safe_armor.json new file mode 100644 index 00000000..656c3b2b --- /dev/null +++ b/data/minecraft/tags/item/piglin_safe_armor.json @@ -0,0 +1,8 @@ +{ + "values": [ + "minecraft:golden_helmet", + "minecraft:golden_chestplate", + "minecraft:golden_leggings", + "minecraft:golden_boots" + ] +} \ No newline at end of file diff --git a/data/minecraft/tags/item/repairs_chain_armor.json b/data/minecraft/tags/item/repairs_chain_armor.json new file mode 100644 index 00000000..c656021b --- /dev/null +++ b/data/minecraft/tags/item/repairs_chain_armor.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:iron_ingot" + ] +} \ No newline at end of file diff --git a/data/minecraft/tags/item/repairs_diamond_armor.json b/data/minecraft/tags/item/repairs_diamond_armor.json new file mode 100644 index 00000000..f44f30dd --- /dev/null +++ b/data/minecraft/tags/item/repairs_diamond_armor.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:diamond" + ] +} \ No newline at end of file diff --git a/data/minecraft/tags/item/repairs_gold_armor.json b/data/minecraft/tags/item/repairs_gold_armor.json new file mode 100644 index 00000000..07e9f66a --- /dev/null +++ b/data/minecraft/tags/item/repairs_gold_armor.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:gold_ingot" + ] +} \ No newline at end of file diff --git a/data/minecraft/tags/item/repairs_iron_armor.json b/data/minecraft/tags/item/repairs_iron_armor.json new file mode 100644 index 00000000..c656021b --- /dev/null +++ b/data/minecraft/tags/item/repairs_iron_armor.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:iron_ingot" + ] +} \ No newline at end of file diff --git a/data/minecraft/tags/item/repairs_leather_armor.json b/data/minecraft/tags/item/repairs_leather_armor.json new file mode 100644 index 00000000..71b797d3 --- /dev/null +++ b/data/minecraft/tags/item/repairs_leather_armor.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:leather" + ] +} \ No newline at end of file diff --git a/data/minecraft/tags/item/repairs_netherite_armor.json b/data/minecraft/tags/item/repairs_netherite_armor.json new file mode 100644 index 00000000..bd6929df --- /dev/null +++ b/data/minecraft/tags/item/repairs_netherite_armor.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:netherite_ingot" + ] +} \ No newline at end of file diff --git a/data/minecraft/tags/item/repairs_turtle_helmet.json b/data/minecraft/tags/item/repairs_turtle_helmet.json new file mode 100644 index 00000000..d1d4c27f --- /dev/null +++ b/data/minecraft/tags/item/repairs_turtle_helmet.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:turtle_scute" + ] +} \ No newline at end of file diff --git a/data/minecraft/tags/item/repairs_wolf_armor.json b/data/minecraft/tags/item/repairs_wolf_armor.json new file mode 100644 index 00000000..ad5988f5 --- /dev/null +++ b/data/minecraft/tags/item/repairs_wolf_armor.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:armadillo_scute" + ] +} \ No newline at end of file diff --git a/data/minecraft/tags/item/shulker_boxes.json b/data/minecraft/tags/item/shulker_boxes.json new file mode 100644 index 00000000..525e33e9 --- /dev/null +++ b/data/minecraft/tags/item/shulker_boxes.json @@ -0,0 +1,21 @@ +{ + "values": [ + "minecraft:shulker_box", + "minecraft:black_shulker_box", + "minecraft:blue_shulker_box", + "minecraft:brown_shulker_box", + "minecraft:cyan_shulker_box", + "minecraft:gray_shulker_box", + "minecraft:green_shulker_box", + "minecraft:light_blue_shulker_box", + "minecraft:light_gray_shulker_box", + "minecraft:lime_shulker_box", + "minecraft:magenta_shulker_box", + "minecraft:orange_shulker_box", + "minecraft:pink_shulker_box", + "minecraft:purple_shulker_box", + "minecraft:red_shulker_box", + "minecraft:white_shulker_box", + "minecraft:yellow_shulker_box" + ] +} \ No newline at end of file diff --git a/data/minecraft/tags/item/villager_picks_up.json b/data/minecraft/tags/item/villager_picks_up.json new file mode 100644 index 00000000..24e9da32 --- /dev/null +++ b/data/minecraft/tags/item/villager_picks_up.json @@ -0,0 +1,8 @@ +{ + "values": [ + "#minecraft:villager_plantable_seeds", + "minecraft:bread", + "minecraft:wheat", + "minecraft:beetroot" + ] +} \ No newline at end of file diff --git a/data/minecraft/tags/item/wolf_food.json b/data/minecraft/tags/item/wolf_food.json index 072676b6..2dfd95a2 100644 --- a/data/minecraft/tags/item/wolf_food.json +++ b/data/minecraft/tags/item/wolf_food.json @@ -1,5 +1,12 @@ { "values": [ - "#minecraft:meat" + "#minecraft:meat", + "minecraft:cod", + "minecraft:cooked_cod", + "minecraft:salmon", + "minecraft:cooked_salmon", + "minecraft:tropical_fish", + "minecraft:pufferfish", + "minecraft:rabbit_stew" ] } \ No newline at end of file diff --git a/data/minecraft/tags/item/wooden_tool_materials.json b/data/minecraft/tags/item/wooden_tool_materials.json new file mode 100644 index 00000000..97fee2c0 --- /dev/null +++ b/data/minecraft/tags/item/wooden_tool_materials.json @@ -0,0 +1,5 @@ +{ + "values": [ + "#minecraft:planks" + ] +} \ No newline at end of file diff --git a/data/minecraft/trial_spawner/trial_chamber/breeze/normal.json b/data/minecraft/trial_spawner/trial_chamber/breeze/normal.json new file mode 100644 index 00000000..d2d070c7 --- /dev/null +++ b/data/minecraft/trial_spawner/trial_chamber/breeze/normal.json @@ -0,0 +1,17 @@ +{ + "simultaneous_mobs": 1.0, + "simultaneous_mobs_added_per_player": 0.5, + "spawn_potentials": [ + { + "data": { + "entity": { + "id": "minecraft:breeze" + } + }, + "weight": 1 + } + ], + "ticks_between_spawn": 20, + "total_mobs": 2.0, + "total_mobs_added_per_player": 1.0 +} \ No newline at end of file diff --git a/data/minecraft/trial_spawner/trial_chamber/breeze/ominous.json b/data/minecraft/trial_spawner/trial_chamber/breeze/ominous.json new file mode 100644 index 00000000..2ae41412 --- /dev/null +++ b/data/minecraft/trial_spawner/trial_chamber/breeze/ominous.json @@ -0,0 +1,26 @@ +{ + "loot_tables_to_eject": [ + { + "data": "minecraft:spawners/ominous/trial_chamber/key", + "weight": 3 + }, + { + "data": "minecraft:spawners/ominous/trial_chamber/consumables", + "weight": 7 + } + ], + "simultaneous_mobs_added_per_player": 0.5, + "spawn_potentials": [ + { + "data": { + "entity": { + "id": "minecraft:breeze" + } + }, + "weight": 1 + } + ], + "ticks_between_spawn": 20, + "total_mobs": 4.0, + "total_mobs_added_per_player": 1.0 +} \ No newline at end of file diff --git a/data/minecraft/trial_spawner/trial_chamber/melee/husk/normal.json b/data/minecraft/trial_spawner/trial_chamber/melee/husk/normal.json new file mode 100644 index 00000000..fdb89086 --- /dev/null +++ b/data/minecraft/trial_spawner/trial_chamber/melee/husk/normal.json @@ -0,0 +1,15 @@ +{ + "simultaneous_mobs": 3.0, + "simultaneous_mobs_added_per_player": 0.5, + "spawn_potentials": [ + { + "data": { + "entity": { + "id": "minecraft:husk" + } + }, + "weight": 1 + } + ], + "ticks_between_spawn": 20 +} \ No newline at end of file diff --git a/data/minecraft/trial_spawner/trial_chamber/melee/husk/ominous.json b/data/minecraft/trial_spawner/trial_chamber/melee/husk/ominous.json new file mode 100644 index 00000000..19af8a68 --- /dev/null +++ b/data/minecraft/trial_spawner/trial_chamber/melee/husk/ominous.json @@ -0,0 +1,29 @@ +{ + "loot_tables_to_eject": [ + { + "data": "minecraft:spawners/ominous/trial_chamber/key", + "weight": 3 + }, + { + "data": "minecraft:spawners/ominous/trial_chamber/consumables", + "weight": 7 + } + ], + "simultaneous_mobs": 3.0, + "simultaneous_mobs_added_per_player": 0.5, + "spawn_potentials": [ + { + "data": { + "entity": { + "id": "minecraft:husk" + }, + "equipment": { + "loot_table": "minecraft:equipment/trial_chamber_melee", + "slot_drop_chances": 0.0 + } + }, + "weight": 1 + } + ], + "ticks_between_spawn": 20 +} \ No newline at end of file diff --git a/data/minecraft/trial_spawner/trial_chamber/melee/spider/normal.json b/data/minecraft/trial_spawner/trial_chamber/melee/spider/normal.json new file mode 100644 index 00000000..429a8c0d --- /dev/null +++ b/data/minecraft/trial_spawner/trial_chamber/melee/spider/normal.json @@ -0,0 +1,15 @@ +{ + "simultaneous_mobs": 3.0, + "simultaneous_mobs_added_per_player": 0.5, + "spawn_potentials": [ + { + "data": { + "entity": { + "id": "minecraft:spider" + } + }, + "weight": 1 + } + ], + "ticks_between_spawn": 20 +} \ No newline at end of file diff --git a/data/minecraft/trial_spawner/trial_chamber/melee/spider/ominous.json b/data/minecraft/trial_spawner/trial_chamber/melee/spider/ominous.json new file mode 100644 index 00000000..7cf6a6d6 --- /dev/null +++ b/data/minecraft/trial_spawner/trial_chamber/melee/spider/ominous.json @@ -0,0 +1,26 @@ +{ + "loot_tables_to_eject": [ + { + "data": "minecraft:spawners/ominous/trial_chamber/key", + "weight": 3 + }, + { + "data": "minecraft:spawners/ominous/trial_chamber/consumables", + "weight": 7 + } + ], + "simultaneous_mobs": 4.0, + "simultaneous_mobs_added_per_player": 0.5, + "spawn_potentials": [ + { + "data": { + "entity": { + "id": "minecraft:spider" + } + }, + "weight": 1 + } + ], + "ticks_between_spawn": 20, + "total_mobs": 12.0 +} \ No newline at end of file diff --git a/data/minecraft/trial_spawner/trial_chamber/melee/zombie/normal.json b/data/minecraft/trial_spawner/trial_chamber/melee/zombie/normal.json new file mode 100644 index 00000000..c57d6b63 --- /dev/null +++ b/data/minecraft/trial_spawner/trial_chamber/melee/zombie/normal.json @@ -0,0 +1,15 @@ +{ + "simultaneous_mobs": 3.0, + "simultaneous_mobs_added_per_player": 0.5, + "spawn_potentials": [ + { + "data": { + "entity": { + "id": "minecraft:zombie" + } + }, + "weight": 1 + } + ], + "ticks_between_spawn": 20 +} \ No newline at end of file diff --git a/data/minecraft/trial_spawner/trial_chamber/melee/zombie/ominous.json b/data/minecraft/trial_spawner/trial_chamber/melee/zombie/ominous.json new file mode 100644 index 00000000..e5a1ca28 --- /dev/null +++ b/data/minecraft/trial_spawner/trial_chamber/melee/zombie/ominous.json @@ -0,0 +1,29 @@ +{ + "loot_tables_to_eject": [ + { + "data": "minecraft:spawners/ominous/trial_chamber/key", + "weight": 3 + }, + { + "data": "minecraft:spawners/ominous/trial_chamber/consumables", + "weight": 7 + } + ], + "simultaneous_mobs": 3.0, + "simultaneous_mobs_added_per_player": 0.5, + "spawn_potentials": [ + { + "data": { + "entity": { + "id": "minecraft:zombie" + }, + "equipment": { + "loot_table": "minecraft:equipment/trial_chamber_melee", + "slot_drop_chances": 0.0 + } + }, + "weight": 1 + } + ], + "ticks_between_spawn": 20 +} \ No newline at end of file diff --git a/data/minecraft/trial_spawner/trial_chamber/ranged/poison_skeleton/normal.json b/data/minecraft/trial_spawner/trial_chamber/ranged/poison_skeleton/normal.json new file mode 100644 index 00000000..3b1fc126 --- /dev/null +++ b/data/minecraft/trial_spawner/trial_chamber/ranged/poison_skeleton/normal.json @@ -0,0 +1,15 @@ +{ + "simultaneous_mobs": 3.0, + "simultaneous_mobs_added_per_player": 0.5, + "spawn_potentials": [ + { + "data": { + "entity": { + "id": "minecraft:bogged" + } + }, + "weight": 1 + } + ], + "ticks_between_spawn": 20 +} \ No newline at end of file diff --git a/data/minecraft/trial_spawner/trial_chamber/ranged/poison_skeleton/ominous.json b/data/minecraft/trial_spawner/trial_chamber/ranged/poison_skeleton/ominous.json new file mode 100644 index 00000000..2ae8933a --- /dev/null +++ b/data/minecraft/trial_spawner/trial_chamber/ranged/poison_skeleton/ominous.json @@ -0,0 +1,29 @@ +{ + "loot_tables_to_eject": [ + { + "data": "minecraft:spawners/ominous/trial_chamber/key", + "weight": 3 + }, + { + "data": "minecraft:spawners/ominous/trial_chamber/consumables", + "weight": 7 + } + ], + "simultaneous_mobs": 3.0, + "simultaneous_mobs_added_per_player": 0.5, + "spawn_potentials": [ + { + "data": { + "entity": { + "id": "minecraft:bogged" + }, + "equipment": { + "loot_table": "minecraft:equipment/trial_chamber_ranged", + "slot_drop_chances": 0.0 + } + }, + "weight": 1 + } + ], + "ticks_between_spawn": 20 +} \ No newline at end of file diff --git a/data/minecraft/trial_spawner/trial_chamber/ranged/skeleton/normal.json b/data/minecraft/trial_spawner/trial_chamber/ranged/skeleton/normal.json new file mode 100644 index 00000000..29c9a1b8 --- /dev/null +++ b/data/minecraft/trial_spawner/trial_chamber/ranged/skeleton/normal.json @@ -0,0 +1,15 @@ +{ + "simultaneous_mobs": 3.0, + "simultaneous_mobs_added_per_player": 0.5, + "spawn_potentials": [ + { + "data": { + "entity": { + "id": "minecraft:skeleton" + } + }, + "weight": 1 + } + ], + "ticks_between_spawn": 20 +} \ No newline at end of file diff --git a/data/minecraft/trial_spawner/trial_chamber/ranged/skeleton/ominous.json b/data/minecraft/trial_spawner/trial_chamber/ranged/skeleton/ominous.json new file mode 100644 index 00000000..5a06ca59 --- /dev/null +++ b/data/minecraft/trial_spawner/trial_chamber/ranged/skeleton/ominous.json @@ -0,0 +1,29 @@ +{ + "loot_tables_to_eject": [ + { + "data": "minecraft:spawners/ominous/trial_chamber/key", + "weight": 3 + }, + { + "data": "minecraft:spawners/ominous/trial_chamber/consumables", + "weight": 7 + } + ], + "simultaneous_mobs": 3.0, + "simultaneous_mobs_added_per_player": 0.5, + "spawn_potentials": [ + { + "data": { + "entity": { + "id": "minecraft:skeleton" + }, + "equipment": { + "loot_table": "minecraft:equipment/trial_chamber_ranged", + "slot_drop_chances": 0.0 + } + }, + "weight": 1 + } + ], + "ticks_between_spawn": 20 +} \ No newline at end of file diff --git a/data/minecraft/trial_spawner/trial_chamber/ranged/stray/normal.json b/data/minecraft/trial_spawner/trial_chamber/ranged/stray/normal.json new file mode 100644 index 00000000..4a0e90ce --- /dev/null +++ b/data/minecraft/trial_spawner/trial_chamber/ranged/stray/normal.json @@ -0,0 +1,15 @@ +{ + "simultaneous_mobs": 3.0, + "simultaneous_mobs_added_per_player": 0.5, + "spawn_potentials": [ + { + "data": { + "entity": { + "id": "minecraft:stray" + } + }, + "weight": 1 + } + ], + "ticks_between_spawn": 20 +} \ No newline at end of file diff --git a/data/minecraft/trial_spawner/trial_chamber/ranged/stray/ominous.json b/data/minecraft/trial_spawner/trial_chamber/ranged/stray/ominous.json new file mode 100644 index 00000000..f4dc8840 --- /dev/null +++ b/data/minecraft/trial_spawner/trial_chamber/ranged/stray/ominous.json @@ -0,0 +1,29 @@ +{ + "loot_tables_to_eject": [ + { + "data": "minecraft:spawners/ominous/trial_chamber/key", + "weight": 3 + }, + { + "data": "minecraft:spawners/ominous/trial_chamber/consumables", + "weight": 7 + } + ], + "simultaneous_mobs": 3.0, + "simultaneous_mobs_added_per_player": 0.5, + "spawn_potentials": [ + { + "data": { + "entity": { + "id": "minecraft:stray" + }, + "equipment": { + "loot_table": "minecraft:equipment/trial_chamber_ranged", + "slot_drop_chances": 0.0 + } + }, + "weight": 1 + } + ], + "ticks_between_spawn": 20 +} \ No newline at end of file diff --git a/data/minecraft/trial_spawner/trial_chamber/slow_ranged/poison_skeleton/normal.json b/data/minecraft/trial_spawner/trial_chamber/slow_ranged/poison_skeleton/normal.json new file mode 100644 index 00000000..a8c39b00 --- /dev/null +++ b/data/minecraft/trial_spawner/trial_chamber/slow_ranged/poison_skeleton/normal.json @@ -0,0 +1,15 @@ +{ + "simultaneous_mobs": 4.0, + "simultaneous_mobs_added_per_player": 2.0, + "spawn_potentials": [ + { + "data": { + "entity": { + "id": "minecraft:bogged" + } + }, + "weight": 1 + } + ], + "ticks_between_spawn": 160 +} \ No newline at end of file diff --git a/data/minecraft/trial_spawner/trial_chamber/slow_ranged/poison_skeleton/ominous.json b/data/minecraft/trial_spawner/trial_chamber/slow_ranged/poison_skeleton/ominous.json new file mode 100644 index 00000000..6ecc76c5 --- /dev/null +++ b/data/minecraft/trial_spawner/trial_chamber/slow_ranged/poison_skeleton/ominous.json @@ -0,0 +1,29 @@ +{ + "loot_tables_to_eject": [ + { + "data": "minecraft:spawners/ominous/trial_chamber/key", + "weight": 3 + }, + { + "data": "minecraft:spawners/ominous/trial_chamber/consumables", + "weight": 7 + } + ], + "simultaneous_mobs": 4.0, + "simultaneous_mobs_added_per_player": 2.0, + "spawn_potentials": [ + { + "data": { + "entity": { + "id": "minecraft:bogged" + }, + "equipment": { + "loot_table": "minecraft:equipment/trial_chamber_ranged", + "slot_drop_chances": 0.0 + } + }, + "weight": 1 + } + ], + "ticks_between_spawn": 160 +} \ No newline at end of file diff --git a/data/minecraft/trial_spawner/trial_chamber/slow_ranged/skeleton/normal.json b/data/minecraft/trial_spawner/trial_chamber/slow_ranged/skeleton/normal.json new file mode 100644 index 00000000..212d4f3c --- /dev/null +++ b/data/minecraft/trial_spawner/trial_chamber/slow_ranged/skeleton/normal.json @@ -0,0 +1,15 @@ +{ + "simultaneous_mobs": 4.0, + "simultaneous_mobs_added_per_player": 2.0, + "spawn_potentials": [ + { + "data": { + "entity": { + "id": "minecraft:skeleton" + } + }, + "weight": 1 + } + ], + "ticks_between_spawn": 160 +} \ No newline at end of file diff --git a/data/minecraft/trial_spawner/trial_chamber/slow_ranged/skeleton/ominous.json b/data/minecraft/trial_spawner/trial_chamber/slow_ranged/skeleton/ominous.json new file mode 100644 index 00000000..97b42e47 --- /dev/null +++ b/data/minecraft/trial_spawner/trial_chamber/slow_ranged/skeleton/ominous.json @@ -0,0 +1,29 @@ +{ + "loot_tables_to_eject": [ + { + "data": "minecraft:spawners/ominous/trial_chamber/key", + "weight": 3 + }, + { + "data": "minecraft:spawners/ominous/trial_chamber/consumables", + "weight": 7 + } + ], + "simultaneous_mobs": 4.0, + "simultaneous_mobs_added_per_player": 2.0, + "spawn_potentials": [ + { + "data": { + "entity": { + "id": "minecraft:skeleton" + }, + "equipment": { + "loot_table": "minecraft:equipment/trial_chamber_ranged", + "slot_drop_chances": 0.0 + } + }, + "weight": 1 + } + ], + "ticks_between_spawn": 160 +} \ No newline at end of file diff --git a/data/minecraft/trial_spawner/trial_chamber/slow_ranged/stray/normal.json b/data/minecraft/trial_spawner/trial_chamber/slow_ranged/stray/normal.json new file mode 100644 index 00000000..37fdcc10 --- /dev/null +++ b/data/minecraft/trial_spawner/trial_chamber/slow_ranged/stray/normal.json @@ -0,0 +1,15 @@ +{ + "simultaneous_mobs": 4.0, + "simultaneous_mobs_added_per_player": 2.0, + "spawn_potentials": [ + { + "data": { + "entity": { + "id": "minecraft:stray" + } + }, + "weight": 1 + } + ], + "ticks_between_spawn": 160 +} \ No newline at end of file diff --git a/data/minecraft/trial_spawner/trial_chamber/slow_ranged/stray/ominous.json b/data/minecraft/trial_spawner/trial_chamber/slow_ranged/stray/ominous.json new file mode 100644 index 00000000..5fef6aeb --- /dev/null +++ b/data/minecraft/trial_spawner/trial_chamber/slow_ranged/stray/ominous.json @@ -0,0 +1,29 @@ +{ + "loot_tables_to_eject": [ + { + "data": "minecraft:spawners/ominous/trial_chamber/key", + "weight": 3 + }, + { + "data": "minecraft:spawners/ominous/trial_chamber/consumables", + "weight": 7 + } + ], + "simultaneous_mobs": 4.0, + "simultaneous_mobs_added_per_player": 2.0, + "spawn_potentials": [ + { + "data": { + "entity": { + "id": "minecraft:stray" + }, + "equipment": { + "loot_table": "minecraft:equipment/trial_chamber_ranged", + "slot_drop_chances": 0.0 + } + }, + "weight": 1 + } + ], + "ticks_between_spawn": 160 +} \ No newline at end of file diff --git a/data/minecraft/trial_spawner/trial_chamber/small_melee/baby_zombie/normal.json b/data/minecraft/trial_spawner/trial_chamber/small_melee/baby_zombie/normal.json new file mode 100644 index 00000000..23712fd5 --- /dev/null +++ b/data/minecraft/trial_spawner/trial_chamber/small_melee/baby_zombie/normal.json @@ -0,0 +1,15 @@ +{ + "simultaneous_mobs_added_per_player": 0.5, + "spawn_potentials": [ + { + "data": { + "entity": { + "IsBaby": 1, + "id": "minecraft:zombie" + } + }, + "weight": 1 + } + ], + "ticks_between_spawn": 20 +} \ No newline at end of file diff --git a/data/minecraft/trial_spawner/trial_chamber/small_melee/baby_zombie/ominous.json b/data/minecraft/trial_spawner/trial_chamber/small_melee/baby_zombie/ominous.json new file mode 100644 index 00000000..5870dcf6 --- /dev/null +++ b/data/minecraft/trial_spawner/trial_chamber/small_melee/baby_zombie/ominous.json @@ -0,0 +1,29 @@ +{ + "loot_tables_to_eject": [ + { + "data": "minecraft:spawners/ominous/trial_chamber/key", + "weight": 3 + }, + { + "data": "minecraft:spawners/ominous/trial_chamber/consumables", + "weight": 7 + } + ], + "simultaneous_mobs_added_per_player": 0.5, + "spawn_potentials": [ + { + "data": { + "entity": { + "IsBaby": 1, + "id": "minecraft:zombie" + }, + "equipment": { + "loot_table": "minecraft:equipment/trial_chamber_melee", + "slot_drop_chances": 0.0 + } + }, + "weight": 1 + } + ], + "ticks_between_spawn": 20 +} \ No newline at end of file diff --git a/data/minecraft/trial_spawner/trial_chamber/small_melee/cave_spider/normal.json b/data/minecraft/trial_spawner/trial_chamber/small_melee/cave_spider/normal.json new file mode 100644 index 00000000..5fb31836 --- /dev/null +++ b/data/minecraft/trial_spawner/trial_chamber/small_melee/cave_spider/normal.json @@ -0,0 +1,15 @@ +{ + "simultaneous_mobs": 3.0, + "simultaneous_mobs_added_per_player": 0.5, + "spawn_potentials": [ + { + "data": { + "entity": { + "id": "minecraft:cave_spider" + } + }, + "weight": 1 + } + ], + "ticks_between_spawn": 20 +} \ No newline at end of file diff --git a/data/minecraft/trial_spawner/trial_chamber/small_melee/cave_spider/ominous.json b/data/minecraft/trial_spawner/trial_chamber/small_melee/cave_spider/ominous.json new file mode 100644 index 00000000..040a6755 --- /dev/null +++ b/data/minecraft/trial_spawner/trial_chamber/small_melee/cave_spider/ominous.json @@ -0,0 +1,26 @@ +{ + "loot_tables_to_eject": [ + { + "data": "minecraft:spawners/ominous/trial_chamber/key", + "weight": 3 + }, + { + "data": "minecraft:spawners/ominous/trial_chamber/consumables", + "weight": 7 + } + ], + "simultaneous_mobs": 4.0, + "simultaneous_mobs_added_per_player": 0.5, + "spawn_potentials": [ + { + "data": { + "entity": { + "id": "minecraft:cave_spider" + } + }, + "weight": 1 + } + ], + "ticks_between_spawn": 20, + "total_mobs": 12.0 +} \ No newline at end of file diff --git a/data/minecraft/trial_spawner/trial_chamber/small_melee/silverfish/normal.json b/data/minecraft/trial_spawner/trial_chamber/small_melee/silverfish/normal.json new file mode 100644 index 00000000..b7c75408 --- /dev/null +++ b/data/minecraft/trial_spawner/trial_chamber/small_melee/silverfish/normal.json @@ -0,0 +1,15 @@ +{ + "simultaneous_mobs": 3.0, + "simultaneous_mobs_added_per_player": 0.5, + "spawn_potentials": [ + { + "data": { + "entity": { + "id": "minecraft:silverfish" + } + }, + "weight": 1 + } + ], + "ticks_between_spawn": 20 +} \ No newline at end of file diff --git a/data/minecraft/trial_spawner/trial_chamber/small_melee/silverfish/ominous.json b/data/minecraft/trial_spawner/trial_chamber/small_melee/silverfish/ominous.json new file mode 100644 index 00000000..7441b4c1 --- /dev/null +++ b/data/minecraft/trial_spawner/trial_chamber/small_melee/silverfish/ominous.json @@ -0,0 +1,26 @@ +{ + "loot_tables_to_eject": [ + { + "data": "minecraft:spawners/ominous/trial_chamber/key", + "weight": 3 + }, + { + "data": "minecraft:spawners/ominous/trial_chamber/consumables", + "weight": 7 + } + ], + "simultaneous_mobs": 4.0, + "simultaneous_mobs_added_per_player": 0.5, + "spawn_potentials": [ + { + "data": { + "entity": { + "id": "minecraft:silverfish" + } + }, + "weight": 1 + } + ], + "ticks_between_spawn": 20, + "total_mobs": 12.0 +} \ No newline at end of file diff --git a/data/minecraft/trial_spawner/trial_chamber/small_melee/slime/normal.json b/data/minecraft/trial_spawner/trial_chamber/small_melee/slime/normal.json new file mode 100644 index 00000000..24c0f956 --- /dev/null +++ b/data/minecraft/trial_spawner/trial_chamber/small_melee/slime/normal.json @@ -0,0 +1,25 @@ +{ + "simultaneous_mobs": 3.0, + "simultaneous_mobs_added_per_player": 0.5, + "spawn_potentials": [ + { + "data": { + "entity": { + "Size": 1, + "id": "minecraft:slime" + } + }, + "weight": 3 + }, + { + "data": { + "entity": { + "Size": 2, + "id": "minecraft:slime" + } + }, + "weight": 1 + } + ], + "ticks_between_spawn": 20 +} \ No newline at end of file diff --git a/data/minecraft/trial_spawner/trial_chamber/small_melee/slime/ominous.json b/data/minecraft/trial_spawner/trial_chamber/small_melee/slime/ominous.json new file mode 100644 index 00000000..eadafd86 --- /dev/null +++ b/data/minecraft/trial_spawner/trial_chamber/small_melee/slime/ominous.json @@ -0,0 +1,36 @@ +{ + "loot_tables_to_eject": [ + { + "data": "minecraft:spawners/ominous/trial_chamber/key", + "weight": 3 + }, + { + "data": "minecraft:spawners/ominous/trial_chamber/consumables", + "weight": 7 + } + ], + "simultaneous_mobs": 4.0, + "simultaneous_mobs_added_per_player": 0.5, + "spawn_potentials": [ + { + "data": { + "entity": { + "Size": 1, + "id": "minecraft:slime" + } + }, + "weight": 3 + }, + { + "data": { + "entity": { + "Size": 2, + "id": "minecraft:slime" + } + }, + "weight": 1 + } + ], + "ticks_between_spawn": 20, + "total_mobs": 12.0 +} \ No newline at end of file diff --git a/data/minecraft/worldgen/biome/badlands.json b/data/minecraft/worldgen/biome/badlands.json index e629c60f..910c3af3 100644 --- a/data/minecraft/worldgen/biome/badlands.json +++ b/data/minecraft/worldgen/biome/badlands.json @@ -1,11 +1,9 @@ { - "carvers": { - "air": [ - "minecraft:cave", - "minecraft:cave_extra_underground", - "minecraft:canyon" - ] - }, + "carvers": [ + "minecraft:cave", + "minecraft:cave_extra_underground", + "minecraft:canyon" + ], "creature_spawn_probability": 0.03, "downfall": 0.0, "effects": { diff --git a/data/minecraft/worldgen/biome/bamboo_jungle.json b/data/minecraft/worldgen/biome/bamboo_jungle.json index 23422fcc..67f8168a 100644 --- a/data/minecraft/worldgen/biome/bamboo_jungle.json +++ b/data/minecraft/worldgen/biome/bamboo_jungle.json @@ -1,11 +1,9 @@ { - "carvers": { - "air": [ - "minecraft:cave", - "minecraft:cave_extra_underground", - "minecraft:canyon" - ] - }, + "carvers": [ + "minecraft:cave", + "minecraft:cave_extra_underground", + "minecraft:canyon" + ], "downfall": 0.9, "effects": { "fog_color": 12638463, diff --git a/data/minecraft/worldgen/biome/basalt_deltas.json b/data/minecraft/worldgen/biome/basalt_deltas.json index e062aa66..e73087b0 100644 --- a/data/minecraft/worldgen/biome/basalt_deltas.json +++ b/data/minecraft/worldgen/biome/basalt_deltas.json @@ -1,7 +1,5 @@ { - "carvers": { - "air": "minecraft:nether_cave" - }, + "carvers": "minecraft:nether_cave", "downfall": 0.0, "effects": { "additions_sound": { diff --git a/data/minecraft/worldgen/biome/beach.json b/data/minecraft/worldgen/biome/beach.json index 38afdc66..9d426677 100644 --- a/data/minecraft/worldgen/biome/beach.json +++ b/data/minecraft/worldgen/biome/beach.json @@ -1,11 +1,9 @@ { - "carvers": { - "air": [ - "minecraft:cave", - "minecraft:cave_extra_underground", - "minecraft:canyon" - ] - }, + "carvers": [ + "minecraft:cave", + "minecraft:cave_extra_underground", + "minecraft:canyon" + ], "downfall": 0.4, "effects": { "fog_color": 12638463, diff --git a/data/minecraft/worldgen/biome/birch_forest.json b/data/minecraft/worldgen/biome/birch_forest.json index 6338abf6..f733f137 100644 --- a/data/minecraft/worldgen/biome/birch_forest.json +++ b/data/minecraft/worldgen/biome/birch_forest.json @@ -1,11 +1,9 @@ { - "carvers": { - "air": [ - "minecraft:cave", - "minecraft:cave_extra_underground", - "minecraft:canyon" - ] - }, + "carvers": [ + "minecraft:cave", + "minecraft:cave_extra_underground", + "minecraft:canyon" + ], "downfall": 0.6, "effects": { "fog_color": 12638463, diff --git a/data/minecraft/worldgen/biome/cherry_grove.json b/data/minecraft/worldgen/biome/cherry_grove.json index f96b6a3a..649251d1 100644 --- a/data/minecraft/worldgen/biome/cherry_grove.json +++ b/data/minecraft/worldgen/biome/cherry_grove.json @@ -1,11 +1,9 @@ { - "carvers": { - "air": [ - "minecraft:cave", - "minecraft:cave_extra_underground", - "minecraft:canyon" - ] - }, + "carvers": [ + "minecraft:cave", + "minecraft:cave_extra_underground", + "minecraft:canyon" + ], "downfall": 0.8, "effects": { "fog_color": 12638463, diff --git a/data/minecraft/worldgen/biome/cold_ocean.json b/data/minecraft/worldgen/biome/cold_ocean.json index cb5835ef..03c21cf3 100644 --- a/data/minecraft/worldgen/biome/cold_ocean.json +++ b/data/minecraft/worldgen/biome/cold_ocean.json @@ -1,11 +1,9 @@ { - "carvers": { - "air": [ - "minecraft:cave", - "minecraft:cave_extra_underground", - "minecraft:canyon" - ] - }, + "carvers": [ + "minecraft:cave", + "minecraft:cave_extra_underground", + "minecraft:canyon" + ], "downfall": 0.5, "effects": { "fog_color": 12638463, @@ -80,7 +78,6 @@ "minecraft:patch_sugar_cane", "minecraft:patch_pumpkin", "minecraft:seagrass_cold", - "minecraft:seagrass_simple", "minecraft:kelp_cold" ], [ diff --git a/data/minecraft/worldgen/biome/crimson_forest.json b/data/minecraft/worldgen/biome/crimson_forest.json index 32460a81..6ee72b45 100644 --- a/data/minecraft/worldgen/biome/crimson_forest.json +++ b/data/minecraft/worldgen/biome/crimson_forest.json @@ -1,7 +1,5 @@ { - "carvers": { - "air": "minecraft:nether_cave" - }, + "carvers": "minecraft:nether_cave", "downfall": 0.0, "effects": { "additions_sound": { diff --git a/data/minecraft/worldgen/biome/dark_forest.json b/data/minecraft/worldgen/biome/dark_forest.json index 678b0eb4..51a8b331 100644 --- a/data/minecraft/worldgen/biome/dark_forest.json +++ b/data/minecraft/worldgen/biome/dark_forest.json @@ -1,11 +1,9 @@ { - "carvers": { - "air": [ - "minecraft:cave", - "minecraft:cave_extra_underground", - "minecraft:canyon" - ] - }, + "carvers": [ + "minecraft:cave", + "minecraft:cave_extra_underground", + "minecraft:canyon" + ], "downfall": 0.8, "effects": { "fog_color": 12638463, diff --git a/data/minecraft/worldgen/biome/deep_cold_ocean.json b/data/minecraft/worldgen/biome/deep_cold_ocean.json index 9850e3ec..62fa3cea 100644 --- a/data/minecraft/worldgen/biome/deep_cold_ocean.json +++ b/data/minecraft/worldgen/biome/deep_cold_ocean.json @@ -1,11 +1,9 @@ { - "carvers": { - "air": [ - "minecraft:cave", - "minecraft:cave_extra_underground", - "minecraft:canyon" - ] - }, + "carvers": [ + "minecraft:cave", + "minecraft:cave_extra_underground", + "minecraft:canyon" + ], "downfall": 0.5, "effects": { "fog_color": 12638463, @@ -80,7 +78,6 @@ "minecraft:patch_sugar_cane", "minecraft:patch_pumpkin", "minecraft:seagrass_deep_cold", - "minecraft:seagrass_simple", "minecraft:kelp_cold" ], [ diff --git a/data/minecraft/worldgen/biome/deep_dark.json b/data/minecraft/worldgen/biome/deep_dark.json index d9ee2b77..ede56265 100644 --- a/data/minecraft/worldgen/biome/deep_dark.json +++ b/data/minecraft/worldgen/biome/deep_dark.json @@ -1,11 +1,9 @@ { - "carvers": { - "air": [ - "minecraft:cave", - "minecraft:cave_extra_underground", - "minecraft:canyon" - ] - }, + "carvers": [ + "minecraft:cave", + "minecraft:cave_extra_underground", + "minecraft:canyon" + ], "downfall": 0.4, "effects": { "fog_color": 12638463, diff --git a/data/minecraft/worldgen/biome/deep_frozen_ocean.json b/data/minecraft/worldgen/biome/deep_frozen_ocean.json index 72409540..5f7894b9 100644 --- a/data/minecraft/worldgen/biome/deep_frozen_ocean.json +++ b/data/minecraft/worldgen/biome/deep_frozen_ocean.json @@ -1,11 +1,9 @@ { - "carvers": { - "air": [ - "minecraft:cave", - "minecraft:cave_extra_underground", - "minecraft:canyon" - ] - }, + "carvers": [ + "minecraft:cave", + "minecraft:cave_extra_underground", + "minecraft:canyon" + ], "downfall": 0.5, "effects": { "fog_color": 12638463, diff --git a/data/minecraft/worldgen/biome/deep_lukewarm_ocean.json b/data/minecraft/worldgen/biome/deep_lukewarm_ocean.json index 413f8109..8e476c1e 100644 --- a/data/minecraft/worldgen/biome/deep_lukewarm_ocean.json +++ b/data/minecraft/worldgen/biome/deep_lukewarm_ocean.json @@ -1,11 +1,9 @@ { - "carvers": { - "air": [ - "minecraft:cave", - "minecraft:cave_extra_underground", - "minecraft:canyon" - ] - }, + "carvers": [ + "minecraft:cave", + "minecraft:cave_extra_underground", + "minecraft:canyon" + ], "downfall": 0.5, "effects": { "fog_color": 12638463, @@ -80,7 +78,6 @@ "minecraft:patch_sugar_cane", "minecraft:patch_pumpkin", "minecraft:seagrass_deep_warm", - "minecraft:seagrass_simple", "minecraft:kelp_warm" ], [ diff --git a/data/minecraft/worldgen/biome/deep_ocean.json b/data/minecraft/worldgen/biome/deep_ocean.json index 56e5219b..aa977575 100644 --- a/data/minecraft/worldgen/biome/deep_ocean.json +++ b/data/minecraft/worldgen/biome/deep_ocean.json @@ -1,11 +1,9 @@ { - "carvers": { - "air": [ - "minecraft:cave", - "minecraft:cave_extra_underground", - "minecraft:canyon" - ] - }, + "carvers": [ + "minecraft:cave", + "minecraft:cave_extra_underground", + "minecraft:canyon" + ], "downfall": 0.5, "effects": { "fog_color": 12638463, @@ -80,7 +78,6 @@ "minecraft:patch_sugar_cane", "minecraft:patch_pumpkin", "minecraft:seagrass_deep", - "minecraft:seagrass_simple", "minecraft:kelp_cold" ], [ diff --git a/data/minecraft/worldgen/biome/desert.json b/data/minecraft/worldgen/biome/desert.json index 395a3692..2e8eaa08 100644 --- a/data/minecraft/worldgen/biome/desert.json +++ b/data/minecraft/worldgen/biome/desert.json @@ -1,11 +1,9 @@ { - "carvers": { - "air": [ - "minecraft:cave", - "minecraft:cave_extra_underground", - "minecraft:canyon" - ] - }, + "carvers": [ + "minecraft:cave", + "minecraft:cave_extra_underground", + "minecraft:canyon" + ], "downfall": 0.0, "effects": { "fog_color": 12638463, diff --git a/data/minecraft/worldgen/biome/dripstone_caves.json b/data/minecraft/worldgen/biome/dripstone_caves.json index 6eaaa571..a314172f 100644 --- a/data/minecraft/worldgen/biome/dripstone_caves.json +++ b/data/minecraft/worldgen/biome/dripstone_caves.json @@ -1,11 +1,9 @@ { - "carvers": { - "air": [ - "minecraft:cave", - "minecraft:cave_extra_underground", - "minecraft:canyon" - ] - }, + "carvers": [ + "minecraft:cave", + "minecraft:cave_extra_underground", + "minecraft:canyon" + ], "downfall": 0.4, "effects": { "fog_color": 12638463, diff --git a/data/minecraft/worldgen/biome/end_barrens.json b/data/minecraft/worldgen/biome/end_barrens.json index 1d07576b..06dc9809 100644 --- a/data/minecraft/worldgen/biome/end_barrens.json +++ b/data/minecraft/worldgen/biome/end_barrens.json @@ -1,5 +1,5 @@ { - "carvers": {}, + "carvers": [], "downfall": 0.5, "effects": { "fog_color": 10518688, diff --git a/data/minecraft/worldgen/biome/end_highlands.json b/data/minecraft/worldgen/biome/end_highlands.json index 05f13807..9f326274 100644 --- a/data/minecraft/worldgen/biome/end_highlands.json +++ b/data/minecraft/worldgen/biome/end_highlands.json @@ -1,5 +1,5 @@ { - "carvers": {}, + "carvers": [], "downfall": 0.5, "effects": { "fog_color": 10518688, diff --git a/data/minecraft/worldgen/biome/end_midlands.json b/data/minecraft/worldgen/biome/end_midlands.json index 1d07576b..06dc9809 100644 --- a/data/minecraft/worldgen/biome/end_midlands.json +++ b/data/minecraft/worldgen/biome/end_midlands.json @@ -1,5 +1,5 @@ { - "carvers": {}, + "carvers": [], "downfall": 0.5, "effects": { "fog_color": 10518688, diff --git a/data/minecraft/worldgen/biome/eroded_badlands.json b/data/minecraft/worldgen/biome/eroded_badlands.json index e629c60f..910c3af3 100644 --- a/data/minecraft/worldgen/biome/eroded_badlands.json +++ b/data/minecraft/worldgen/biome/eroded_badlands.json @@ -1,11 +1,9 @@ { - "carvers": { - "air": [ - "minecraft:cave", - "minecraft:cave_extra_underground", - "minecraft:canyon" - ] - }, + "carvers": [ + "minecraft:cave", + "minecraft:cave_extra_underground", + "minecraft:canyon" + ], "creature_spawn_probability": 0.03, "downfall": 0.0, "effects": { diff --git a/data/minecraft/worldgen/biome/flower_forest.json b/data/minecraft/worldgen/biome/flower_forest.json index d45edd25..785bd11d 100644 --- a/data/minecraft/worldgen/biome/flower_forest.json +++ b/data/minecraft/worldgen/biome/flower_forest.json @@ -1,11 +1,9 @@ { - "carvers": { - "air": [ - "minecraft:cave", - "minecraft:cave_extra_underground", - "minecraft:canyon" - ] - }, + "carvers": [ + "minecraft:cave", + "minecraft:cave_extra_underground", + "minecraft:canyon" + ], "downfall": 0.8, "effects": { "fog_color": 12638463, diff --git a/data/minecraft/worldgen/biome/forest.json b/data/minecraft/worldgen/biome/forest.json index d81b3554..3ab14a6a 100644 --- a/data/minecraft/worldgen/biome/forest.json +++ b/data/minecraft/worldgen/biome/forest.json @@ -1,11 +1,9 @@ { - "carvers": { - "air": [ - "minecraft:cave", - "minecraft:cave_extra_underground", - "minecraft:canyon" - ] - }, + "carvers": [ + "minecraft:cave", + "minecraft:cave_extra_underground", + "minecraft:canyon" + ], "downfall": 0.8, "effects": { "fog_color": 12638463, diff --git a/data/minecraft/worldgen/biome/frozen_ocean.json b/data/minecraft/worldgen/biome/frozen_ocean.json index 2b9a2ae1..cf476e5e 100644 --- a/data/minecraft/worldgen/biome/frozen_ocean.json +++ b/data/minecraft/worldgen/biome/frozen_ocean.json @@ -1,11 +1,9 @@ { - "carvers": { - "air": [ - "minecraft:cave", - "minecraft:cave_extra_underground", - "minecraft:canyon" - ] - }, + "carvers": [ + "minecraft:cave", + "minecraft:cave_extra_underground", + "minecraft:canyon" + ], "downfall": 0.5, "effects": { "fog_color": 12638463, diff --git a/data/minecraft/worldgen/biome/frozen_peaks.json b/data/minecraft/worldgen/biome/frozen_peaks.json index 6f06b574..c90f1926 100644 --- a/data/minecraft/worldgen/biome/frozen_peaks.json +++ b/data/minecraft/worldgen/biome/frozen_peaks.json @@ -1,11 +1,9 @@ { - "carvers": { - "air": [ - "minecraft:cave", - "minecraft:cave_extra_underground", - "minecraft:canyon" - ] - }, + "carvers": [ + "minecraft:cave", + "minecraft:cave_extra_underground", + "minecraft:canyon" + ], "downfall": 0.9, "effects": { "fog_color": 12638463, diff --git a/data/minecraft/worldgen/biome/frozen_river.json b/data/minecraft/worldgen/biome/frozen_river.json index 5bc38324..aa571080 100644 --- a/data/minecraft/worldgen/biome/frozen_river.json +++ b/data/minecraft/worldgen/biome/frozen_river.json @@ -1,11 +1,9 @@ { - "carvers": { - "air": [ - "minecraft:cave", - "minecraft:cave_extra_underground", - "minecraft:canyon" - ] - }, + "carvers": [ + "minecraft:cave", + "minecraft:cave_extra_underground", + "minecraft:canyon" + ], "downfall": 0.5, "effects": { "fog_color": 12638463, diff --git a/data/minecraft/worldgen/biome/grove.json b/data/minecraft/worldgen/biome/grove.json index e5c46d43..f6c2c49b 100644 --- a/data/minecraft/worldgen/biome/grove.json +++ b/data/minecraft/worldgen/biome/grove.json @@ -1,11 +1,9 @@ { - "carvers": { - "air": [ - "minecraft:cave", - "minecraft:cave_extra_underground", - "minecraft:canyon" - ] - }, + "carvers": [ + "minecraft:cave", + "minecraft:cave_extra_underground", + "minecraft:canyon" + ], "downfall": 0.8, "effects": { "fog_color": 12638463, diff --git a/data/minecraft/worldgen/biome/ice_spikes.json b/data/minecraft/worldgen/biome/ice_spikes.json index a034b3d9..a67947e6 100644 --- a/data/minecraft/worldgen/biome/ice_spikes.json +++ b/data/minecraft/worldgen/biome/ice_spikes.json @@ -1,11 +1,9 @@ { - "carvers": { - "air": [ - "minecraft:cave", - "minecraft:cave_extra_underground", - "minecraft:canyon" - ] - }, + "carvers": [ + "minecraft:cave", + "minecraft:cave_extra_underground", + "minecraft:canyon" + ], "creature_spawn_probability": 0.07, "downfall": 0.5, "effects": { diff --git a/data/minecraft/worldgen/biome/jagged_peaks.json b/data/minecraft/worldgen/biome/jagged_peaks.json index 15a76969..9628eb1a 100644 --- a/data/minecraft/worldgen/biome/jagged_peaks.json +++ b/data/minecraft/worldgen/biome/jagged_peaks.json @@ -1,11 +1,9 @@ { - "carvers": { - "air": [ - "minecraft:cave", - "minecraft:cave_extra_underground", - "minecraft:canyon" - ] - }, + "carvers": [ + "minecraft:cave", + "minecraft:cave_extra_underground", + "minecraft:canyon" + ], "downfall": 0.9, "effects": { "fog_color": 12638463, diff --git a/data/minecraft/worldgen/biome/jungle.json b/data/minecraft/worldgen/biome/jungle.json index 2c805572..64360910 100644 --- a/data/minecraft/worldgen/biome/jungle.json +++ b/data/minecraft/worldgen/biome/jungle.json @@ -1,11 +1,9 @@ { - "carvers": { - "air": [ - "minecraft:cave", - "minecraft:cave_extra_underground", - "minecraft:canyon" - ] - }, + "carvers": [ + "minecraft:cave", + "minecraft:cave_extra_underground", + "minecraft:canyon" + ], "downfall": 0.9, "effects": { "fog_color": 12638463, diff --git a/data/minecraft/worldgen/biome/lukewarm_ocean.json b/data/minecraft/worldgen/biome/lukewarm_ocean.json index 9a259fe3..adc1e79b 100644 --- a/data/minecraft/worldgen/biome/lukewarm_ocean.json +++ b/data/minecraft/worldgen/biome/lukewarm_ocean.json @@ -1,11 +1,9 @@ { - "carvers": { - "air": [ - "minecraft:cave", - "minecraft:cave_extra_underground", - "minecraft:canyon" - ] - }, + "carvers": [ + "minecraft:cave", + "minecraft:cave_extra_underground", + "minecraft:canyon" + ], "downfall": 0.5, "effects": { "fog_color": 12638463, diff --git a/data/minecraft/worldgen/biome/lush_caves.json b/data/minecraft/worldgen/biome/lush_caves.json index b3aef76a..4a3875c5 100644 --- a/data/minecraft/worldgen/biome/lush_caves.json +++ b/data/minecraft/worldgen/biome/lush_caves.json @@ -1,11 +1,9 @@ { - "carvers": { - "air": [ - "minecraft:cave", - "minecraft:cave_extra_underground", - "minecraft:canyon" - ] - }, + "carvers": [ + "minecraft:cave", + "minecraft:cave_extra_underground", + "minecraft:canyon" + ], "downfall": 0.5, "effects": { "fog_color": 12638463, diff --git a/data/minecraft/worldgen/biome/mangrove_swamp.json b/data/minecraft/worldgen/biome/mangrove_swamp.json index bc4aa912..cbf0f6c2 100644 --- a/data/minecraft/worldgen/biome/mangrove_swamp.json +++ b/data/minecraft/worldgen/biome/mangrove_swamp.json @@ -1,11 +1,9 @@ { - "carvers": { - "air": [ - "minecraft:cave", - "minecraft:cave_extra_underground", - "minecraft:canyon" - ] - }, + "carvers": [ + "minecraft:cave", + "minecraft:cave_extra_underground", + "minecraft:canyon" + ], "downfall": 0.9, "effects": { "fog_color": 12638463, diff --git a/data/minecraft/worldgen/biome/meadow.json b/data/minecraft/worldgen/biome/meadow.json index 4f2ec95d..818a2df6 100644 --- a/data/minecraft/worldgen/biome/meadow.json +++ b/data/minecraft/worldgen/biome/meadow.json @@ -1,11 +1,9 @@ { - "carvers": { - "air": [ - "minecraft:cave", - "minecraft:cave_extra_underground", - "minecraft:canyon" - ] - }, + "carvers": [ + "minecraft:cave", + "minecraft:cave_extra_underground", + "minecraft:canyon" + ], "downfall": 0.8, "effects": { "fog_color": 12638463, diff --git a/data/minecraft/worldgen/biome/mushroom_fields.json b/data/minecraft/worldgen/biome/mushroom_fields.json index e8a21c1e..75943d09 100644 --- a/data/minecraft/worldgen/biome/mushroom_fields.json +++ b/data/minecraft/worldgen/biome/mushroom_fields.json @@ -1,11 +1,9 @@ { - "carvers": { - "air": [ - "minecraft:cave", - "minecraft:cave_extra_underground", - "minecraft:canyon" - ] - }, + "carvers": [ + "minecraft:cave", + "minecraft:cave_extra_underground", + "minecraft:canyon" + ], "downfall": 1.0, "effects": { "fog_color": 12638463, diff --git a/data/minecraft/worldgen/biome/nether_wastes.json b/data/minecraft/worldgen/biome/nether_wastes.json index d0e13f09..31572625 100644 --- a/data/minecraft/worldgen/biome/nether_wastes.json +++ b/data/minecraft/worldgen/biome/nether_wastes.json @@ -1,7 +1,5 @@ { - "carvers": { - "air": "minecraft:nether_cave" - }, + "carvers": "minecraft:nether_cave", "downfall": 0.0, "effects": { "additions_sound": { diff --git a/data/minecraft/worldgen/biome/ocean.json b/data/minecraft/worldgen/biome/ocean.json index 32b74be8..26ca1b73 100644 --- a/data/minecraft/worldgen/biome/ocean.json +++ b/data/minecraft/worldgen/biome/ocean.json @@ -1,11 +1,9 @@ { - "carvers": { - "air": [ - "minecraft:cave", - "minecraft:cave_extra_underground", - "minecraft:canyon" - ] - }, + "carvers": [ + "minecraft:cave", + "minecraft:cave_extra_underground", + "minecraft:canyon" + ], "downfall": 0.5, "effects": { "fog_color": 12638463, @@ -80,7 +78,6 @@ "minecraft:patch_sugar_cane", "minecraft:patch_pumpkin", "minecraft:seagrass_normal", - "minecraft:seagrass_simple", "minecraft:kelp_cold" ], [ diff --git a/data/minecraft/worldgen/biome/old_growth_birch_forest.json b/data/minecraft/worldgen/biome/old_growth_birch_forest.json index eb2da855..ea998ab3 100644 --- a/data/minecraft/worldgen/biome/old_growth_birch_forest.json +++ b/data/minecraft/worldgen/biome/old_growth_birch_forest.json @@ -1,11 +1,9 @@ { - "carvers": { - "air": [ - "minecraft:cave", - "minecraft:cave_extra_underground", - "minecraft:canyon" - ] - }, + "carvers": [ + "minecraft:cave", + "minecraft:cave_extra_underground", + "minecraft:canyon" + ], "downfall": 0.6, "effects": { "fog_color": 12638463, diff --git a/data/minecraft/worldgen/biome/old_growth_pine_taiga.json b/data/minecraft/worldgen/biome/old_growth_pine_taiga.json index 4618b800..b46f36e6 100644 --- a/data/minecraft/worldgen/biome/old_growth_pine_taiga.json +++ b/data/minecraft/worldgen/biome/old_growth_pine_taiga.json @@ -1,11 +1,9 @@ { - "carvers": { - "air": [ - "minecraft:cave", - "minecraft:cave_extra_underground", - "minecraft:canyon" - ] - }, + "carvers": [ + "minecraft:cave", + "minecraft:cave_extra_underground", + "minecraft:canyon" + ], "downfall": 0.8, "effects": { "fog_color": 12638463, diff --git a/data/minecraft/worldgen/biome/old_growth_spruce_taiga.json b/data/minecraft/worldgen/biome/old_growth_spruce_taiga.json index d51fde7e..890145e7 100644 --- a/data/minecraft/worldgen/biome/old_growth_spruce_taiga.json +++ b/data/minecraft/worldgen/biome/old_growth_spruce_taiga.json @@ -1,11 +1,9 @@ { - "carvers": { - "air": [ - "minecraft:cave", - "minecraft:cave_extra_underground", - "minecraft:canyon" - ] - }, + "carvers": [ + "minecraft:cave", + "minecraft:cave_extra_underground", + "minecraft:canyon" + ], "downfall": 0.8, "effects": { "fog_color": 12638463, diff --git a/data/minecraft/worldgen/biome/plains.json b/data/minecraft/worldgen/biome/plains.json index a223a716..55e186a7 100644 --- a/data/minecraft/worldgen/biome/plains.json +++ b/data/minecraft/worldgen/biome/plains.json @@ -1,11 +1,9 @@ { - "carvers": { - "air": [ - "minecraft:cave", - "minecraft:cave_extra_underground", - "minecraft:canyon" - ] - }, + "carvers": [ + "minecraft:cave", + "minecraft:cave_extra_underground", + "minecraft:canyon" + ], "downfall": 0.4, "effects": { "fog_color": 12638463, diff --git a/data/minecraft/worldgen/biome/river.json b/data/minecraft/worldgen/biome/river.json index bce49abb..71ab8f27 100644 --- a/data/minecraft/worldgen/biome/river.json +++ b/data/minecraft/worldgen/biome/river.json @@ -1,11 +1,9 @@ { - "carvers": { - "air": [ - "minecraft:cave", - "minecraft:cave_extra_underground", - "minecraft:canyon" - ] - }, + "carvers": [ + "minecraft:cave", + "minecraft:cave_extra_underground", + "minecraft:canyon" + ], "downfall": 0.5, "effects": { "fog_color": 12638463, diff --git a/data/minecraft/worldgen/biome/savanna.json b/data/minecraft/worldgen/biome/savanna.json index c357a3b7..d2b5a1cb 100644 --- a/data/minecraft/worldgen/biome/savanna.json +++ b/data/minecraft/worldgen/biome/savanna.json @@ -1,11 +1,9 @@ { - "carvers": { - "air": [ - "minecraft:cave", - "minecraft:cave_extra_underground", - "minecraft:canyon" - ] - }, + "carvers": [ + "minecraft:cave", + "minecraft:cave_extra_underground", + "minecraft:canyon" + ], "downfall": 0.0, "effects": { "fog_color": 12638463, diff --git a/data/minecraft/worldgen/biome/savanna_plateau.json b/data/minecraft/worldgen/biome/savanna_plateau.json index d1bd9db3..1fd89b88 100644 --- a/data/minecraft/worldgen/biome/savanna_plateau.json +++ b/data/minecraft/worldgen/biome/savanna_plateau.json @@ -1,11 +1,9 @@ { - "carvers": { - "air": [ - "minecraft:cave", - "minecraft:cave_extra_underground", - "minecraft:canyon" - ] - }, + "carvers": [ + "minecraft:cave", + "minecraft:cave_extra_underground", + "minecraft:canyon" + ], "downfall": 0.0, "effects": { "fog_color": 12638463, diff --git a/data/minecraft/worldgen/biome/small_end_islands.json b/data/minecraft/worldgen/biome/small_end_islands.json index c9e4887d..fca51ade 100644 --- a/data/minecraft/worldgen/biome/small_end_islands.json +++ b/data/minecraft/worldgen/biome/small_end_islands.json @@ -1,5 +1,5 @@ { - "carvers": {}, + "carvers": [], "downfall": 0.5, "effects": { "fog_color": 10518688, diff --git a/data/minecraft/worldgen/biome/snowy_beach.json b/data/minecraft/worldgen/biome/snowy_beach.json index 8814e77e..134689df 100644 --- a/data/minecraft/worldgen/biome/snowy_beach.json +++ b/data/minecraft/worldgen/biome/snowy_beach.json @@ -1,11 +1,9 @@ { - "carvers": { - "air": [ - "minecraft:cave", - "minecraft:cave_extra_underground", - "minecraft:canyon" - ] - }, + "carvers": [ + "minecraft:cave", + "minecraft:cave_extra_underground", + "minecraft:canyon" + ], "downfall": 0.3, "effects": { "fog_color": 12638463, diff --git a/data/minecraft/worldgen/biome/snowy_plains.json b/data/minecraft/worldgen/biome/snowy_plains.json index 8d635339..8f009acf 100644 --- a/data/minecraft/worldgen/biome/snowy_plains.json +++ b/data/minecraft/worldgen/biome/snowy_plains.json @@ -1,11 +1,9 @@ { - "carvers": { - "air": [ - "minecraft:cave", - "minecraft:cave_extra_underground", - "minecraft:canyon" - ] - }, + "carvers": [ + "minecraft:cave", + "minecraft:cave_extra_underground", + "minecraft:canyon" + ], "creature_spawn_probability": 0.07, "downfall": 0.5, "effects": { diff --git a/data/minecraft/worldgen/biome/snowy_slopes.json b/data/minecraft/worldgen/biome/snowy_slopes.json index fb9dc704..4a4e75e4 100644 --- a/data/minecraft/worldgen/biome/snowy_slopes.json +++ b/data/minecraft/worldgen/biome/snowy_slopes.json @@ -1,11 +1,9 @@ { - "carvers": { - "air": [ - "minecraft:cave", - "minecraft:cave_extra_underground", - "minecraft:canyon" - ] - }, + "carvers": [ + "minecraft:cave", + "minecraft:cave_extra_underground", + "minecraft:canyon" + ], "downfall": 0.9, "effects": { "fog_color": 12638463, diff --git a/data/minecraft/worldgen/biome/snowy_taiga.json b/data/minecraft/worldgen/biome/snowy_taiga.json index 9dd36242..baedf4ca 100644 --- a/data/minecraft/worldgen/biome/snowy_taiga.json +++ b/data/minecraft/worldgen/biome/snowy_taiga.json @@ -1,11 +1,9 @@ { - "carvers": { - "air": [ - "minecraft:cave", - "minecraft:cave_extra_underground", - "minecraft:canyon" - ] - }, + "carvers": [ + "minecraft:cave", + "minecraft:cave_extra_underground", + "minecraft:canyon" + ], "downfall": 0.4, "effects": { "fog_color": 12638463, diff --git a/data/minecraft/worldgen/biome/soul_sand_valley.json b/data/minecraft/worldgen/biome/soul_sand_valley.json index efa00435..5bdb7227 100644 --- a/data/minecraft/worldgen/biome/soul_sand_valley.json +++ b/data/minecraft/worldgen/biome/soul_sand_valley.json @@ -1,7 +1,5 @@ { - "carvers": { - "air": "minecraft:nether_cave" - }, + "carvers": "minecraft:nether_cave", "downfall": 0.0, "effects": { "additions_sound": { diff --git a/data/minecraft/worldgen/biome/sparse_jungle.json b/data/minecraft/worldgen/biome/sparse_jungle.json index 629e5cc5..c7a88d43 100644 --- a/data/minecraft/worldgen/biome/sparse_jungle.json +++ b/data/minecraft/worldgen/biome/sparse_jungle.json @@ -1,11 +1,9 @@ { - "carvers": { - "air": [ - "minecraft:cave", - "minecraft:cave_extra_underground", - "minecraft:canyon" - ] - }, + "carvers": [ + "minecraft:cave", + "minecraft:cave_extra_underground", + "minecraft:canyon" + ], "downfall": 0.8, "effects": { "fog_color": 12638463, diff --git a/data/minecraft/worldgen/biome/stony_peaks.json b/data/minecraft/worldgen/biome/stony_peaks.json index e7605b5d..4ae7dcae 100644 --- a/data/minecraft/worldgen/biome/stony_peaks.json +++ b/data/minecraft/worldgen/biome/stony_peaks.json @@ -1,11 +1,9 @@ { - "carvers": { - "air": [ - "minecraft:cave", - "minecraft:cave_extra_underground", - "minecraft:canyon" - ] - }, + "carvers": [ + "minecraft:cave", + "minecraft:cave_extra_underground", + "minecraft:canyon" + ], "downfall": 0.3, "effects": { "fog_color": 12638463, diff --git a/data/minecraft/worldgen/biome/stony_shore.json b/data/minecraft/worldgen/biome/stony_shore.json index f4d44286..0e9b0862 100644 --- a/data/minecraft/worldgen/biome/stony_shore.json +++ b/data/minecraft/worldgen/biome/stony_shore.json @@ -1,11 +1,9 @@ { - "carvers": { - "air": [ - "minecraft:cave", - "minecraft:cave_extra_underground", - "minecraft:canyon" - ] - }, + "carvers": [ + "minecraft:cave", + "minecraft:cave_extra_underground", + "minecraft:canyon" + ], "downfall": 0.3, "effects": { "fog_color": 12638463, diff --git a/data/minecraft/worldgen/biome/sunflower_plains.json b/data/minecraft/worldgen/biome/sunflower_plains.json index d365e37c..3a1a8bd7 100644 --- a/data/minecraft/worldgen/biome/sunflower_plains.json +++ b/data/minecraft/worldgen/biome/sunflower_plains.json @@ -1,11 +1,9 @@ { - "carvers": { - "air": [ - "minecraft:cave", - "minecraft:cave_extra_underground", - "minecraft:canyon" - ] - }, + "carvers": [ + "minecraft:cave", + "minecraft:cave_extra_underground", + "minecraft:canyon" + ], "downfall": 0.4, "effects": { "fog_color": 12638463, diff --git a/data/minecraft/worldgen/biome/swamp.json b/data/minecraft/worldgen/biome/swamp.json index 1f67a8ff..7b3b9321 100644 --- a/data/minecraft/worldgen/biome/swamp.json +++ b/data/minecraft/worldgen/biome/swamp.json @@ -1,11 +1,9 @@ { - "carvers": { - "air": [ - "minecraft:cave", - "minecraft:cave_extra_underground", - "minecraft:canyon" - ] - }, + "carvers": [ + "minecraft:cave", + "minecraft:cave_extra_underground", + "minecraft:canyon" + ], "downfall": 0.9, "effects": { "fog_color": 12638463, diff --git a/data/minecraft/worldgen/biome/taiga.json b/data/minecraft/worldgen/biome/taiga.json index 24c600b6..ebbb1ba1 100644 --- a/data/minecraft/worldgen/biome/taiga.json +++ b/data/minecraft/worldgen/biome/taiga.json @@ -1,11 +1,9 @@ { - "carvers": { - "air": [ - "minecraft:cave", - "minecraft:cave_extra_underground", - "minecraft:canyon" - ] - }, + "carvers": [ + "minecraft:cave", + "minecraft:cave_extra_underground", + "minecraft:canyon" + ], "downfall": 0.8, "effects": { "fog_color": 12638463, diff --git a/data/minecraft/worldgen/biome/the_end.json b/data/minecraft/worldgen/biome/the_end.json index 616acd85..58085833 100644 --- a/data/minecraft/worldgen/biome/the_end.json +++ b/data/minecraft/worldgen/biome/the_end.json @@ -1,5 +1,5 @@ { - "carvers": {}, + "carvers": [], "downfall": 0.5, "effects": { "fog_color": 10518688, diff --git a/data/minecraft/worldgen/biome/the_void.json b/data/minecraft/worldgen/biome/the_void.json index 49d0cca5..1fd87f5e 100644 --- a/data/minecraft/worldgen/biome/the_void.json +++ b/data/minecraft/worldgen/biome/the_void.json @@ -1,5 +1,5 @@ { - "carvers": {}, + "carvers": [], "downfall": 0.5, "effects": { "fog_color": 12638463, diff --git a/data/minecraft/worldgen/biome/warm_ocean.json b/data/minecraft/worldgen/biome/warm_ocean.json index b1e1da65..a2d17353 100644 --- a/data/minecraft/worldgen/biome/warm_ocean.json +++ b/data/minecraft/worldgen/biome/warm_ocean.json @@ -1,11 +1,9 @@ { - "carvers": { - "air": [ - "minecraft:cave", - "minecraft:cave_extra_underground", - "minecraft:canyon" - ] - }, + "carvers": [ + "minecraft:cave", + "minecraft:cave_extra_underground", + "minecraft:canyon" + ], "downfall": 0.5, "effects": { "fog_color": 12638463, diff --git a/data/minecraft/worldgen/biome/warped_forest.json b/data/minecraft/worldgen/biome/warped_forest.json index 4e462ac5..c040ec34 100644 --- a/data/minecraft/worldgen/biome/warped_forest.json +++ b/data/minecraft/worldgen/biome/warped_forest.json @@ -1,7 +1,5 @@ { - "carvers": { - "air": "minecraft:nether_cave" - }, + "carvers": "minecraft:nether_cave", "downfall": 0.0, "effects": { "additions_sound": { diff --git a/data/minecraft/worldgen/biome/windswept_forest.json b/data/minecraft/worldgen/biome/windswept_forest.json index 2949efc6..79df5cd2 100644 --- a/data/minecraft/worldgen/biome/windswept_forest.json +++ b/data/minecraft/worldgen/biome/windswept_forest.json @@ -1,11 +1,9 @@ { - "carvers": { - "air": [ - "minecraft:cave", - "minecraft:cave_extra_underground", - "minecraft:canyon" - ] - }, + "carvers": [ + "minecraft:cave", + "minecraft:cave_extra_underground", + "minecraft:canyon" + ], "downfall": 0.3, "effects": { "fog_color": 12638463, diff --git a/data/minecraft/worldgen/biome/windswept_gravelly_hills.json b/data/minecraft/worldgen/biome/windswept_gravelly_hills.json index bf891177..504f3ca9 100644 --- a/data/minecraft/worldgen/biome/windswept_gravelly_hills.json +++ b/data/minecraft/worldgen/biome/windswept_gravelly_hills.json @@ -1,11 +1,9 @@ { - "carvers": { - "air": [ - "minecraft:cave", - "minecraft:cave_extra_underground", - "minecraft:canyon" - ] - }, + "carvers": [ + "minecraft:cave", + "minecraft:cave_extra_underground", + "minecraft:canyon" + ], "downfall": 0.3, "effects": { "fog_color": 12638463, diff --git a/data/minecraft/worldgen/biome/windswept_hills.json b/data/minecraft/worldgen/biome/windswept_hills.json index bf891177..504f3ca9 100644 --- a/data/minecraft/worldgen/biome/windswept_hills.json +++ b/data/minecraft/worldgen/biome/windswept_hills.json @@ -1,11 +1,9 @@ { - "carvers": { - "air": [ - "minecraft:cave", - "minecraft:cave_extra_underground", - "minecraft:canyon" - ] - }, + "carvers": [ + "minecraft:cave", + "minecraft:cave_extra_underground", + "minecraft:canyon" + ], "downfall": 0.3, "effects": { "fog_color": 12638463, diff --git a/data/minecraft/worldgen/biome/windswept_savanna.json b/data/minecraft/worldgen/biome/windswept_savanna.json index 522fafd6..caad9671 100644 --- a/data/minecraft/worldgen/biome/windswept_savanna.json +++ b/data/minecraft/worldgen/biome/windswept_savanna.json @@ -1,11 +1,9 @@ { - "carvers": { - "air": [ - "minecraft:cave", - "minecraft:cave_extra_underground", - "minecraft:canyon" - ] - }, + "carvers": [ + "minecraft:cave", + "minecraft:cave_extra_underground", + "minecraft:canyon" + ], "downfall": 0.0, "effects": { "fog_color": 12638463, diff --git a/data/minecraft/worldgen/biome/wooded_badlands.json b/data/minecraft/worldgen/biome/wooded_badlands.json index 54909712..52f7fc2b 100644 --- a/data/minecraft/worldgen/biome/wooded_badlands.json +++ b/data/minecraft/worldgen/biome/wooded_badlands.json @@ -1,11 +1,9 @@ { - "carvers": { - "air": [ - "minecraft:cave", - "minecraft:cave_extra_underground", - "minecraft:canyon" - ] - }, + "carvers": [ + "minecraft:cave", + "minecraft:cave_extra_underground", + "minecraft:canyon" + ], "creature_spawn_probability": 0.04, "downfall": 0.0, "effects": { diff --git a/data/minecraft/worldgen/configured_feature/crimson_fungus.json b/data/minecraft/worldgen/configured_feature/crimson_fungus.json index c69bc1e7..451af841 100644 --- a/data/minecraft/worldgen/configured_feature/crimson_fungus.json +++ b/data/minecraft/worldgen/configured_feature/crimson_fungus.json @@ -18,6 +18,7 @@ "minecraft:acacia_sapling", "minecraft:cherry_sapling", "minecraft:dark_oak_sapling", + "minecraft:pale_oak_sapling", "minecraft:mangrove_propagule", "minecraft:dandelion", "minecraft:torchflower", diff --git a/data/minecraft/worldgen/configured_feature/crimson_fungus_planted.json b/data/minecraft/worldgen/configured_feature/crimson_fungus_planted.json index a9c15cfe..2d67804b 100644 --- a/data/minecraft/worldgen/configured_feature/crimson_fungus_planted.json +++ b/data/minecraft/worldgen/configured_feature/crimson_fungus_planted.json @@ -18,6 +18,7 @@ "minecraft:acacia_sapling", "minecraft:cherry_sapling", "minecraft:dark_oak_sapling", + "minecraft:pale_oak_sapling", "minecraft:mangrove_propagule", "minecraft:dandelion", "minecraft:torchflower", diff --git a/data/minecraft/worldgen/configured_feature/pale_garden_vegetation.json b/data/minecraft/worldgen/configured_feature/pale_garden_vegetation.json new file mode 100644 index 00000000..8bb4b6f2 --- /dev/null +++ b/data/minecraft/worldgen/configured_feature/pale_garden_vegetation.json @@ -0,0 +1,16 @@ +{ + "type": "minecraft:random_selector", + "config": { + "default": "minecraft:pale_oak_checked", + "features": [ + { + "chance": 0.2, + "feature": "minecraft:pale_oak_creaking_checked" + }, + { + "chance": 0.8, + "feature": "minecraft:pale_oak_checked" + } + ] + } +} \ No newline at end of file diff --git a/data/minecraft/worldgen/configured_feature/pale_moss_patch_bonemeal.json b/data/minecraft/worldgen/configured_feature/pale_moss_patch_bonemeal.json new file mode 100644 index 00000000..7cc05b58 --- /dev/null +++ b/data/minecraft/worldgen/configured_feature/pale_moss_patch_bonemeal.json @@ -0,0 +1,27 @@ +{ + "type": "minecraft:vegetation_patch", + "config": { + "depth": 1, + "extra_bottom_block_chance": 0.0, + "extra_edge_column_chance": 0.75, + "ground_state": { + "type": "minecraft:simple_state_provider", + "state": { + "Name": "minecraft:pale_moss_block" + } + }, + "replaceable": "#minecraft:moss_replaceable", + "surface": "floor", + "vegetation_chance": 0.6, + "vegetation_feature": { + "feature": "minecraft:pale_moss_vegetation", + "placement": [] + }, + "vertical_range": 5, + "xz_radius": { + "type": "minecraft:uniform", + "max_inclusive": 2, + "min_inclusive": 1 + } + } +} \ No newline at end of file diff --git a/data/minecraft/worldgen/configured_feature/pale_moss_vegetation.json b/data/minecraft/worldgen/configured_feature/pale_moss_vegetation.json new file mode 100644 index 00000000..2a23ec54 --- /dev/null +++ b/data/minecraft/worldgen/configured_feature/pale_moss_vegetation.json @@ -0,0 +1,38 @@ +{ + "type": "minecraft:simple_block", + "config": { + "to_place": { + "type": "minecraft:weighted_state_provider", + "entries": [ + { + "data": { + "Name": "minecraft:pale_moss_carpet", + "Properties": { + "bottom": "true", + "east": "none", + "north": "none", + "south": "none", + "west": "none" + } + }, + "weight": 25 + }, + { + "data": { + "Name": "minecraft:short_grass" + }, + "weight": 50 + }, + { + "data": { + "Name": "minecraft:tall_grass", + "Properties": { + "half": "lower" + } + }, + "weight": 10 + } + ] + } + } +} \ No newline at end of file diff --git a/data/minecraft/worldgen/configured_feature/pale_oak.json b/data/minecraft/worldgen/configured_feature/pale_oak.json new file mode 100644 index 00000000..0b62d717 --- /dev/null +++ b/data/minecraft/worldgen/configured_feature/pale_oak.json @@ -0,0 +1,60 @@ +{ + "type": "minecraft:tree", + "config": { + "decorators": [ + { + "type": "minecraft:pale_moss", + "ground_probability": 0.8, + "leaves_probability": 0.15, + "trunk_probability": 0.4 + } + ], + "dirt_provider": { + "type": "minecraft:simple_state_provider", + "state": { + "Name": "minecraft:dirt" + } + }, + "foliage_placer": { + "type": "minecraft:dark_oak_foliage_placer", + "offset": 0, + "radius": 0 + }, + "foliage_provider": { + "type": "minecraft:simple_state_provider", + "state": { + "Name": "minecraft:pale_oak_leaves", + "Properties": { + "distance": "7", + "persistent": "false", + "waterlogged": "false" + } + } + }, + "force_dirt": false, + "ignore_vines": true, + "minimum_size": { + "type": "minecraft:three_layers_feature_size", + "limit": 1, + "lower_size": 0, + "middle_size": 1, + "upper_limit": 1, + "upper_size": 2 + }, + "trunk_placer": { + "type": "minecraft:dark_oak_trunk_placer", + "base_height": 6, + "height_rand_a": 2, + "height_rand_b": 1 + }, + "trunk_provider": { + "type": "minecraft:simple_state_provider", + "state": { + "Name": "minecraft:pale_oak_log", + "Properties": { + "axis": "y" + } + } + } + } +} \ No newline at end of file diff --git a/data/minecraft/worldgen/configured_feature/pale_oak_creaking.json b/data/minecraft/worldgen/configured_feature/pale_oak_creaking.json new file mode 100644 index 00000000..5ed7089c --- /dev/null +++ b/data/minecraft/worldgen/configured_feature/pale_oak_creaking.json @@ -0,0 +1,64 @@ +{ + "type": "minecraft:tree", + "config": { + "decorators": [ + { + "type": "minecraft:pale_moss", + "ground_probability": 0.8, + "leaves_probability": 0.15, + "trunk_probability": 0.4 + }, + { + "type": "minecraft:creaking_heart", + "probability": 1.0 + } + ], + "dirt_provider": { + "type": "minecraft:simple_state_provider", + "state": { + "Name": "minecraft:dirt" + } + }, + "foliage_placer": { + "type": "minecraft:dark_oak_foliage_placer", + "offset": 0, + "radius": 0 + }, + "foliage_provider": { + "type": "minecraft:simple_state_provider", + "state": { + "Name": "minecraft:pale_oak_leaves", + "Properties": { + "distance": "7", + "persistent": "false", + "waterlogged": "false" + } + } + }, + "force_dirt": false, + "ignore_vines": true, + "minimum_size": { + "type": "minecraft:three_layers_feature_size", + "limit": 1, + "lower_size": 0, + "middle_size": 1, + "upper_limit": 1, + "upper_size": 2 + }, + "trunk_placer": { + "type": "minecraft:dark_oak_trunk_placer", + "base_height": 6, + "height_rand_a": 2, + "height_rand_b": 1 + }, + "trunk_provider": { + "type": "minecraft:simple_state_provider", + "state": { + "Name": "minecraft:pale_oak_log", + "Properties": { + "axis": "y" + } + } + } + } +} \ No newline at end of file diff --git a/data/minecraft/worldgen/configured_feature/seagrass_simple.json b/data/minecraft/worldgen/configured_feature/seagrass_simple.json deleted file mode 100644 index 1566bec8..00000000 --- a/data/minecraft/worldgen/configured_feature/seagrass_simple.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "type": "minecraft:simple_block", - "config": { - "to_place": { - "type": "minecraft:simple_state_provider", - "state": { - "Name": "minecraft:seagrass" - } - } - } -} \ No newline at end of file diff --git a/data/minecraft/worldgen/configured_feature/warped_fungus.json b/data/minecraft/worldgen/configured_feature/warped_fungus.json index fb6339c1..000e8682 100644 --- a/data/minecraft/worldgen/configured_feature/warped_fungus.json +++ b/data/minecraft/worldgen/configured_feature/warped_fungus.json @@ -18,6 +18,7 @@ "minecraft:acacia_sapling", "minecraft:cherry_sapling", "minecraft:dark_oak_sapling", + "minecraft:pale_oak_sapling", "minecraft:mangrove_propagule", "minecraft:dandelion", "minecraft:torchflower", diff --git a/data/minecraft/worldgen/configured_feature/warped_fungus_planted.json b/data/minecraft/worldgen/configured_feature/warped_fungus_planted.json index 053b0e63..e2391974 100644 --- a/data/minecraft/worldgen/configured_feature/warped_fungus_planted.json +++ b/data/minecraft/worldgen/configured_feature/warped_fungus_planted.json @@ -18,6 +18,7 @@ "minecraft:acacia_sapling", "minecraft:cherry_sapling", "minecraft:dark_oak_sapling", + "minecraft:pale_oak_sapling", "minecraft:mangrove_propagule", "minecraft:dandelion", "minecraft:torchflower", diff --git a/data/minecraft/worldgen/placed_feature/pale_garden_vegetation.json b/data/minecraft/worldgen/placed_feature/pale_garden_vegetation.json new file mode 100644 index 00000000..9542b328 --- /dev/null +++ b/data/minecraft/worldgen/placed_feature/pale_garden_vegetation.json @@ -0,0 +1,23 @@ +{ + "feature": "minecraft:pale_garden_vegetation", + "placement": [ + { + "type": "minecraft:count", + "count": 16 + }, + { + "type": "minecraft:in_square" + }, + { + "type": "minecraft:surface_water_depth_filter", + "max_water_depth": 0 + }, + { + "type": "minecraft:heightmap", + "heightmap": "OCEAN_FLOOR" + }, + { + "type": "minecraft:biome" + } + ] +} \ No newline at end of file diff --git a/data/minecraft/worldgen/placed_feature/pale_oak_checked.json b/data/minecraft/worldgen/placed_feature/pale_oak_checked.json new file mode 100644 index 00000000..5cfab029 --- /dev/null +++ b/data/minecraft/worldgen/placed_feature/pale_oak_checked.json @@ -0,0 +1,17 @@ +{ + "feature": "minecraft:pale_oak", + "placement": [ + { + "type": "minecraft:block_predicate_filter", + "predicate": { + "type": "minecraft:would_survive", + "state": { + "Name": "minecraft:pale_oak_sapling", + "Properties": { + "stage": "0" + } + } + } + } + ] +} \ No newline at end of file diff --git a/data/minecraft/worldgen/placed_feature/pale_oak_creaking_checked.json b/data/minecraft/worldgen/placed_feature/pale_oak_creaking_checked.json new file mode 100644 index 00000000..32422f5b --- /dev/null +++ b/data/minecraft/worldgen/placed_feature/pale_oak_creaking_checked.json @@ -0,0 +1,17 @@ +{ + "feature": "minecraft:pale_oak_creaking", + "placement": [ + { + "type": "minecraft:block_predicate_filter", + "predicate": { + "type": "minecraft:would_survive", + "state": { + "Name": "minecraft:pale_oak_sapling", + "Properties": { + "stage": "0" + } + } + } + } + ] +} \ No newline at end of file diff --git a/data/minecraft/worldgen/placed_feature/seagrass_simple.json b/data/minecraft/worldgen/placed_feature/seagrass_simple.json deleted file mode 100644 index 218418bd..00000000 --- a/data/minecraft/worldgen/placed_feature/seagrass_simple.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "feature": "minecraft:seagrass_simple", - "placement": [ - { - "type": "minecraft:carving_mask", - "step": "liquid" - }, - { - "type": "minecraft:rarity_filter", - "chance": 10 - }, - { - "type": "minecraft:block_predicate_filter", - "predicate": { - "type": "minecraft:all_of", - "predicates": [ - { - "type": "minecraft:matching_blocks", - "blocks": "minecraft:stone", - "offset": [ - 0, - -1, - 0 - ] - }, - { - "type": "minecraft:matching_blocks", - "blocks": "minecraft:water" - }, - { - "type": "minecraft:matching_blocks", - "blocks": "minecraft:water", - "offset": [ - 0, - 1, - 0 - ] - } - ] - } - }, - { - "type": "minecraft:biome" - } - ] -} \ No newline at end of file diff --git a/data/minecraft/worldgen/template_pool/trial_chambers/chamber/entrance_cap.json b/data/minecraft/worldgen/template_pool/trial_chambers/chamber/entrance_cap.json index bc4657bd..74f5ca94 100644 --- a/data/minecraft/worldgen/template_pool/trial_chambers/chamber/entrance_cap.json +++ b/data/minecraft/worldgen/template_pool/trial_chambers/chamber/entrance_cap.json @@ -10,5 +10,5 @@ "weight": 1 } ], - "fallback": "minecraft:trial_chambers/chamber/entrance_cap" + "fallback": "minecraft:empty" } \ No newline at end of file diff --git a/data/minecraft/worldgen/template_pool/trial_chambers/chamber/slanted.json b/data/minecraft/worldgen/template_pool/trial_chambers/chamber/slanted.json index f7027638..c1ebb836 100644 --- a/data/minecraft/worldgen/template_pool/trial_chambers/chamber/slanted.json +++ b/data/minecraft/worldgen/template_pool/trial_chambers/chamber/slanted.json @@ -44,28 +44,6 @@ }, "weight": 1 }, - { - "element": { - "element_type": "minecraft:single_pool_element", - "location": "minecraft:trial_chambers/chamber/slanted/hallway_4", - "processors": { - "processors": [] - }, - "projection": "rigid" - }, - "weight": 1 - }, - { - "element": { - "element_type": "minecraft:single_pool_element", - "location": "minecraft:trial_chambers/chamber/slanted/hallway_5", - "processors": { - "processors": [] - }, - "projection": "rigid" - }, - "weight": 1 - }, { "element": { "element_type": "minecraft:single_pool_element", diff --git a/data/minecraft/worldgen/template_pool/trial_chambers/decor/bed.json b/data/minecraft/worldgen/template_pool/trial_chambers/decor/bed.json new file mode 100644 index 00000000..0e705777 --- /dev/null +++ b/data/minecraft/worldgen/template_pool/trial_chambers/decor/bed.json @@ -0,0 +1,181 @@ +{ + "elements": [ + { + "element": { + "element_type": "minecraft:single_pool_element", + "location": "minecraft:trial_chambers/decor/white_bed", + "processors": { + "processors": [] + }, + "projection": "rigid" + }, + "weight": 3 + }, + { + "element": { + "element_type": "minecraft:single_pool_element", + "location": "minecraft:trial_chambers/decor/light_gray_bed", + "processors": { + "processors": [] + }, + "projection": "rigid" + }, + "weight": 3 + }, + { + "element": { + "element_type": "minecraft:single_pool_element", + "location": "minecraft:trial_chambers/decor/gray_bed", + "processors": { + "processors": [] + }, + "projection": "rigid" + }, + "weight": 3 + }, + { + "element": { + "element_type": "minecraft:single_pool_element", + "location": "minecraft:trial_chambers/decor/black_bed", + "processors": { + "processors": [] + }, + "projection": "rigid" + }, + "weight": 3 + }, + { + "element": { + "element_type": "minecraft:single_pool_element", + "location": "minecraft:trial_chambers/decor/brown_bed", + "processors": { + "processors": [] + }, + "projection": "rigid" + }, + "weight": 3 + }, + { + "element": { + "element_type": "minecraft:single_pool_element", + "location": "minecraft:trial_chambers/decor/red_bed", + "processors": { + "processors": [] + }, + "projection": "rigid" + }, + "weight": 3 + }, + { + "element": { + "element_type": "minecraft:single_pool_element", + "location": "minecraft:trial_chambers/decor/orange_bed", + "processors": { + "processors": [] + }, + "projection": "rigid" + }, + "weight": 3 + }, + { + "element": { + "element_type": "minecraft:single_pool_element", + "location": "minecraft:trial_chambers/decor/yellow_bed", + "processors": { + "processors": [] + }, + "projection": "rigid" + }, + "weight": 3 + }, + { + "element": { + "element_type": "minecraft:single_pool_element", + "location": "minecraft:trial_chambers/decor/lime_bed", + "processors": { + "processors": [] + }, + "projection": "rigid" + }, + "weight": 3 + }, + { + "element": { + "element_type": "minecraft:single_pool_element", + "location": "minecraft:trial_chambers/decor/green_bed", + "processors": { + "processors": [] + }, + "projection": "rigid" + }, + "weight": 3 + }, + { + "element": { + "element_type": "minecraft:single_pool_element", + "location": "minecraft:trial_chambers/decor/cyan_bed", + "processors": { + "processors": [] + }, + "projection": "rigid" + }, + "weight": 3 + }, + { + "element": { + "element_type": "minecraft:single_pool_element", + "location": "minecraft:trial_chambers/decor/light_blue_bed", + "processors": { + "processors": [] + }, + "projection": "rigid" + }, + "weight": 3 + }, + { + "element": { + "element_type": "minecraft:single_pool_element", + "location": "minecraft:trial_chambers/decor/blue_bed", + "processors": { + "processors": [] + }, + "projection": "rigid" + }, + "weight": 3 + }, + { + "element": { + "element_type": "minecraft:single_pool_element", + "location": "minecraft:trial_chambers/decor/purple_bed", + "processors": { + "processors": [] + }, + "projection": "rigid" + }, + "weight": 3 + }, + { + "element": { + "element_type": "minecraft:single_pool_element", + "location": "minecraft:trial_chambers/decor/magenta_bed", + "processors": { + "processors": [] + }, + "projection": "rigid" + }, + "weight": 3 + }, + { + "element": { + "element_type": "minecraft:single_pool_element", + "location": "minecraft:trial_chambers/decor/pink_bed", + "processors": { + "processors": [] + }, + "projection": "rigid" + }, + "weight": 1 + } + ], + "fallback": "minecraft:empty" +} \ No newline at end of file diff --git a/data/minecraft/worldgen/template_pool/trial_chambers/decor/disposal.json b/data/minecraft/worldgen/template_pool/trial_chambers/decor/disposal.json new file mode 100644 index 00000000..aeb21958 --- /dev/null +++ b/data/minecraft/worldgen/template_pool/trial_chambers/decor/disposal.json @@ -0,0 +1,16 @@ +{ + "elements": [ + { + "element": { + "element_type": "minecraft:single_pool_element", + "location": "minecraft:trial_chambers/decor/disposal", + "processors": { + "processors": [] + }, + "projection": "rigid" + }, + "weight": 1 + } + ], + "fallback": "minecraft:empty" +} \ No newline at end of file diff --git a/data/minecraft/worldgen/template_pool/trial_chambers/hallway.json b/data/minecraft/worldgen/template_pool/trial_chambers/hallway.json index 3938fcc1..75f08818 100644 --- a/data/minecraft/worldgen/template_pool/trial_chambers/hallway.json +++ b/data/minecraft/worldgen/template_pool/trial_chambers/hallway.json @@ -219,6 +219,60 @@ "projection": "rigid" }, "weight": 1 + }, + { + "element": { + "element_type": "minecraft:single_pool_element", + "location": "minecraft:trial_chambers/hallway/trapped_staircase", + "processors": "minecraft:trial_chambers_copper_bulb_degradation", + "projection": "rigid" + }, + "weight": 1 + }, + { + "element": { + "element_type": "minecraft:single_pool_element", + "location": "minecraft:trial_chambers/hallway/encounter_1", + "processors": "minecraft:trial_chambers_copper_bulb_degradation", + "projection": "rigid" + }, + "weight": 1 + }, + { + "element": { + "element_type": "minecraft:single_pool_element", + "location": "minecraft:trial_chambers/hallway/encounter_2", + "processors": "minecraft:trial_chambers_copper_bulb_degradation", + "projection": "rigid" + }, + "weight": 1 + }, + { + "element": { + "element_type": "minecraft:single_pool_element", + "location": "minecraft:trial_chambers/hallway/encounter_3", + "processors": "minecraft:trial_chambers_copper_bulb_degradation", + "projection": "rigid" + }, + "weight": 1 + }, + { + "element": { + "element_type": "minecraft:single_pool_element", + "location": "minecraft:trial_chambers/hallway/encounter_4", + "processors": "minecraft:trial_chambers_copper_bulb_degradation", + "projection": "rigid" + }, + "weight": 1 + }, + { + "element": { + "element_type": "minecraft:single_pool_element", + "location": "minecraft:trial_chambers/hallway/encounter_5", + "processors": "minecraft:trial_chambers_copper_bulb_degradation", + "projection": "rigid" + }, + "weight": 1 } ], "fallback": "minecraft:trial_chambers/hallway/fallback" diff --git a/net/minecraft/CrashReportCategory.java b/net/minecraft/CrashReportCategory.java index 47e9ff46..7ce60a93 100644 --- a/net/minecraft/CrashReportCategory.java +++ b/net/minecraft/CrashReportCategory.java @@ -45,10 +45,10 @@ public class CrashReportCategory { int m = y & 15; int n = z & 15; int o = SectionPos.sectionToBlockCoord(i); - int p = levelHeightAccess.getMinBuildHeight(); + int p = levelHeightAccess.getMinY(); int q = SectionPos.sectionToBlockCoord(k); int r = SectionPos.sectionToBlockCoord(i + 1) - 1; - int s = levelHeightAccess.getMaxBuildHeight() - 1; + int s = levelHeightAccess.getMaxY(); int t = SectionPos.sectionToBlockCoord(k + 1) - 1; stringBuilder.append( String.format(Locale.ROOT, "Section: (at %d,%d,%d in %d,%d,%d; chunk contains blocks %d,%d,%d to %d,%d,%d)", l, m, n, i, j, k, o, p, q, r, s, t) @@ -67,10 +67,10 @@ public class CrashReportCategory { int m = (i + 1 << 5) - 1; int n = (j + 1 << 5) - 1; int o = i << 9; - int p = levelHeightAccess.getMinBuildHeight(); + int p = levelHeightAccess.getMinY(); int q = j << 9; int r = (i + 1 << 9) - 1; - int s = levelHeightAccess.getMaxBuildHeight() - 1; + int s = levelHeightAccess.getMaxY(); int t = (j + 1 << 9) - 1; stringBuilder.append( String.format(Locale.ROOT, "Region: (%d,%d; contains chunks %d,%d to %d,%d, blocks %d,%d,%d to %d,%d,%d)", i, j, k, l, m, n, o, p, q, r, s, t) diff --git a/net/minecraft/DetectedVersion.java b/net/minecraft/DetectedVersion.java index f67ca2e2..a92156a0 100644 --- a/net/minecraft/DetectedVersion.java +++ b/net/minecraft/DetectedVersion.java @@ -28,12 +28,12 @@ public class DetectedVersion implements WorldVersion { private DetectedVersion() { this.id = UUID.randomUUID().toString().replaceAll("-", ""); - this.name = "1.21.1"; + this.name = "1.21.2"; this.stable = true; - this.worldVersion = new DataVersion(3955, "main"); + this.worldVersion = new DataVersion(4080, "main"); this.protocolVersion = SharedConstants.getProtocolVersion(); - this.resourcePackVersion = 34; - this.dataPackVersion = 48; + this.resourcePackVersion = 42; + this.dataPackVersion = 57; this.buildTime = new Date(); } diff --git a/net/minecraft/Optionull.java b/net/minecraft/Optionull.java index f0b2f26b..3f1b5146 100644 --- a/net/minecraft/Optionull.java +++ b/net/minecraft/Optionull.java @@ -2,11 +2,17 @@ package net.minecraft; import java.util.Collection; import java.util.Iterator; +import java.util.Objects; import java.util.function.Function; import java.util.function.Supplier; import org.jetbrains.annotations.Nullable; public class Optionull { + @Deprecated + public static T orElse(@Nullable T object, T object2) { + return (T)Objects.requireNonNullElse(object, object2); + } + @Nullable public static R map(@Nullable T value, Function mapper) { return (R)(value == null ? null : mapper.apply(value)); diff --git a/net/minecraft/SharedConstants.java b/net/minecraft/SharedConstants.java index 2ecc8976..a20160bc 100644 --- a/net/minecraft/SharedConstants.java +++ b/net/minecraft/SharedConstants.java @@ -34,7 +34,7 @@ public class SharedConstants { * @deprecated Use {@link #getCurrentVersion()} and {@link com.mojang.bridge.game.GameVersion#getWorldVersion()} instead. */ @Deprecated - public static final int WORLD_VERSION = 3955; + public static final int WORLD_VERSION = 4080; @Deprecated public static final String SERIES = "main"; /** @@ -44,7 +44,7 @@ public class SharedConstants { * @deprecated Use {@link #getCurrentVersion()} and {@link com.mojang.bridge.game.GameVersion#getName()} instead. */ @Deprecated - public static final String VERSION_STRING = "1.21.1"; + public static final String VERSION_STRING = "1.21.2"; /** * The numeric format number for the networking protocol used by the release target of this game version. * @@ -54,7 +54,7 @@ public class SharedConstants { * @deprecated Use {@link #getProtocolVersion()} instead. */ @Deprecated - public static final int RELEASE_NETWORK_PROTOCOL_VERSION = 767; + public static final int RELEASE_NETWORK_PROTOCOL_VERSION = 768; /** * The numeric format number for the networking protocol used by the snapshot of this game version. * @@ -66,8 +66,8 @@ public class SharedConstants { * @deprecated Use {@link #getProtocolVersion()} instead. */ @Deprecated - public static final int SNAPSHOT_NETWORK_PROTOCOL_VERSION = 204; - public static final int SNBT_NAG_VERSION = 3937; + public static final int SNAPSHOT_NETWORK_PROTOCOL_VERSION = 219; + public static final int SNBT_NAG_VERSION = 4053; /** * The bit in the networking protocol version for denoting {@linkplain #SNAPSHOT snapshot versions}. * @@ -82,7 +82,7 @@ public class SharedConstants { * @deprecated Use {@link #getCurrentVersion()}, {@link com.mojang.bridge.game.GameVersion#com.mojang.bridge.game.GameVersion#getPackVersion(com.mojang.bridge.game.PackType)}, and com.mojang.bridge.game.PackType#RESOURCE instead. */ @Deprecated - public static final int RESOURCE_PACK_FORMAT = 34; + public static final int RESOURCE_PACK_FORMAT = 42; /** * The format of the data packs used by this game version. Data packs contain server-side data such as recipes, loot tables, and tags. * @@ -90,7 +90,7 @@ public class SharedConstants { * @deprecated Use {@link #getCurrentVersion()}, {@link com.mojang.bridge.game.GameVersion#com.mojang.bridge.game.GameVersion#getPackVersion(com.mojang.bridge.game.PackType)}, and com.mojang.bridge.game.PackType#DATA instead. */ @Deprecated - public static final int DATA_PACK_FORMAT = 48; + public static final int DATA_PACK_FORMAT = 57; @Deprecated public static final int LANGUAGE_FORMAT = 1; public static final int REPORT_FORMAT_VERSION = 1; @@ -118,6 +118,7 @@ public class SharedConstants { public static final boolean DEBUG_SUPPORT_BLOCKS = false; public static final boolean DEBUG_SHAPES = false; public static final boolean DEBUG_NEIGHBORSUPDATE = false; + public static final boolean DEBUG_EXPERIMENTAL_REDSTONEWIRE_UPDATE_ORDER = false; public static final boolean DEBUG_STRUCTURES = false; public static final boolean DEBUG_LIGHT = false; public static final boolean DEBUG_SKY_LIGHT_SECTIONS = false; @@ -138,7 +139,6 @@ public class SharedConstants { public static final boolean DEBUG_BEES = false; public static final boolean DEBUG_RAIDS = false; public static final boolean DEBUG_BLOCK_BREAK = false; - public static final boolean DEBUG_RESOURCE_LOAD_TIMES = false; public static final boolean DEBUG_MONITOR_TICK_TIMES = false; public static final boolean DEBUG_KEEP_JIGSAW_BLOCKS_DURING_STRUCTURE_GEN = false; public static final boolean DEBUG_DONT_SAVE_WORLD = false; @@ -178,7 +178,6 @@ public class SharedConstants { * @see https://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xhtml?&page=128 Internet Assigned Numbers Authority, Internet Service Name and Transport Protocol Port Number Registry */ public static final int DEFAULT_MINECRAFT_PORT = 25565; - public static final boolean INGAME_DEBUG_OUTPUT = false; public static final boolean DEBUG_SUBTITLES = false; public static final int FAKE_MS_LATENCY = 0; public static final int FAKE_MS_JITTER = 0; @@ -278,7 +277,7 @@ public class SharedConstants { *

For releases, this will be equivalent to {@link #RELEASE_NETWORK_PROTOCOL_VERSION}. For snapshot versions, this will be the combination (bitwise OR) of {@link #SNAPSHOT_NETWORK_PROTOCOL_VERSION} and the bit marked by {@link #SNAPSHOT_PROTOCOL_BIT}.

*/ public static int getProtocolVersion() { - return 767; + return 768; } public static boolean debugVoidTerrain(ChunkPos chunkPos) { diff --git a/net/minecraft/TracingExecutor.java b/net/minecraft/TracingExecutor.java new file mode 100644 index 00000000..f689e327 --- /dev/null +++ b/net/minecraft/TracingExecutor.java @@ -0,0 +1,58 @@ +package net.minecraft; + +import com.mojang.jtracy.TracyClient; +import com.mojang.jtracy.Zone; +import java.util.concurrent.Executor; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.TimeUnit; + +public record TracingExecutor(ExecutorService service) implements Executor { + public Executor forName(String string) { + if (SharedConstants.IS_RUNNING_IN_IDE) { + return runnable -> this.service.execute(() -> { + Thread thread = Thread.currentThread(); + String string2 = thread.getName(); + thread.setName(string); + + try (Zone zone = TracyClient.beginZone(string, SharedConstants.IS_RUNNING_IN_IDE)) { + runnable.run(); + } finally { + thread.setName(string2); + } + }); + } else { + return (Executor)(TracyClient.isAvailable() ? runnable -> this.service.execute(() -> { + try (Zone zone = TracyClient.beginZone(string, SharedConstants.IS_RUNNING_IN_IDE)) { + runnable.run(); + } + }) : this.service); + } + } + + public void execute(Runnable runnable) { + this.service.execute(wrapUnnamed(runnable)); + } + + public void shutdownAndAwait(long l, TimeUnit timeUnit) { + this.service.shutdown(); + + boolean bl; + try { + bl = this.service.awaitTermination(l, timeUnit); + } catch (InterruptedException var6) { + bl = false; + } + + if (!bl) { + this.service.shutdownNow(); + } + } + + private static Runnable wrapUnnamed(Runnable runnable) { + return !TracyClient.isAvailable() ? runnable : () -> { + try (Zone zone = TracyClient.beginZone("task", SharedConstants.IS_RUNNING_IN_IDE)) { + runnable.run(); + } + }; + } +} diff --git a/net/minecraft/Util.java b/net/minecraft/Util.java index 8ac2b57e..0a268ae1 100644 --- a/net/minecraft/Util.java +++ b/net/minecraft/Util.java @@ -11,6 +11,8 @@ import com.mojang.datafixers.Typed; import com.mojang.datafixers.DSL.TypeReference; import com.mojang.datafixers.types.Type; import com.mojang.datafixers.util.Pair; +import com.mojang.jtracy.TracyClient; +import com.mojang.jtracy.Zone; import com.mojang.logging.LogUtils; import com.mojang.serialization.DataResult; import com.mojang.serialization.Dynamic; @@ -39,6 +41,7 @@ import java.time.Instant; import java.time.ZonedDateTime; import java.time.format.DateTimeFormatter; import java.util.Arrays; +import java.util.EnumMap; import java.util.Iterator; import java.util.List; import java.util.Locale; @@ -78,7 +81,7 @@ import net.minecraft.server.Bootstrap; import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; import net.minecraft.util.SingleKeyCache; -import net.minecraft.util.TimeSource; +import net.minecraft.util.TimeSource.NanoTimeSource; import net.minecraft.util.datafix.DataFixers; import net.minecraft.world.level.block.state.properties.Property; import org.jetbrains.annotations.Nullable; @@ -89,14 +92,14 @@ public class Util { private static final int DEFAULT_MAX_THREADS = 255; private static final int DEFAULT_SAFE_FILE_OPERATION_RETRIES = 10; private static final String MAX_THREADS_SYSTEM_PROPERTY = "max.bg.threads"; - private static final ExecutorService BACKGROUND_EXECUTOR = makeExecutor("Main"); - private static final ExecutorService IO_POOL = makeIoExecutor("IO-Worker-", false); - private static final ExecutorService DOWNLOAD_POOL = makeIoExecutor("Download-", true); + private static final TracingExecutor BACKGROUND_EXECUTOR = makeExecutor("Main"); + private static final TracingExecutor IO_POOL = makeIoExecutor("IO-Worker-", false); + private static final TracingExecutor DOWNLOAD_POOL = makeIoExecutor("Download-", true); private static final DateTimeFormatter FILENAME_DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd_HH.mm.ss", Locale.ROOT); public static final int LINEAR_LOOKUP_THRESHOLD = 8; private static final Set ALLOWED_UNTRUSTED_LINK_PROTOCOLS = Set.of("http", "https"); public static final long NANOS_PER_MILLI = 1000000L; - public static TimeSource.NanoTimeSource timeSource = System::nanoTime; + public static NanoTimeSource timeSource = System::nanoTime; public static final Ticker TICKER = new Ticker() { @Override public long read() { @@ -143,7 +146,7 @@ public class Util { return FILENAME_DATE_TIME_FORMATTER.format(ZonedDateTime.now()); } - private static ExecutorService makeExecutor(String serviceName) { + private static TracingExecutor makeExecutor(String string) { int i = Mth.clamp(Runtime.getRuntime().availableProcessors() - 1, 1, getMaxThreads()); ExecutorService executorService; if (i <= 0) { @@ -151,7 +154,13 @@ public class Util { } else { AtomicInteger atomicInteger = new AtomicInteger(1); executorService = new ForkJoinPool(i, forkJoinPool -> { + final String string2 = "Worker-" + string + "-" + atomicInteger.getAndIncrement(); ForkJoinWorkerThread forkJoinWorkerThread = new ForkJoinWorkerThread(forkJoinPool) { + protected void onStart() { + TracyClient.setThreadName(string2, string.hashCode()); + super.onStart(); + } + protected void onTermination(Throwable throwable) { if (throwable != null) { Util.LOGGER.warn("{} died", this.getName(), throwable); @@ -162,12 +171,12 @@ public class Util { super.onTermination(throwable); } }; - forkJoinWorkerThread.setName("Worker-" + serviceName + "-" + atomicInteger.getAndIncrement()); + forkJoinWorkerThread.setName(string2); return forkJoinWorkerThread; }, Util::onThreadException, true); } - return executorService; + return new TracingExecutor(executorService); } private static int getMaxThreads() { @@ -188,47 +197,34 @@ public class Util { return 255; } - public static ExecutorService backgroundExecutor() { + public static TracingExecutor backgroundExecutor() { return BACKGROUND_EXECUTOR; } - public static ExecutorService ioPool() { + public static TracingExecutor ioPool() { return IO_POOL; } - public static ExecutorService nonCriticalIoPool() { + public static TracingExecutor nonCriticalIoPool() { return DOWNLOAD_POOL; } public static void shutdownExecutors() { - shutdownExecutor(BACKGROUND_EXECUTOR); - shutdownExecutor(IO_POOL); + BACKGROUND_EXECUTOR.shutdownAndAwait(3L, TimeUnit.SECONDS); + IO_POOL.shutdownAndAwait(3L, TimeUnit.SECONDS); } - private static void shutdownExecutor(ExecutorService service) { - service.shutdown(); - - boolean bl; - try { - bl = service.awaitTermination(3L, TimeUnit.SECONDS); - } catch (InterruptedException var3) { - bl = false; - } - - if (!bl) { - service.shutdownNow(); - } - } - - private static ExecutorService makeIoExecutor(String name, boolean daemon) { + private static TracingExecutor makeIoExecutor(String string, boolean bl) { AtomicInteger atomicInteger = new AtomicInteger(1); - return Executors.newCachedThreadPool(runnable -> { + return new TracingExecutor(Executors.newCachedThreadPool(runnable -> { Thread thread = new Thread(runnable); - thread.setName(name + atomicInteger.getAndIncrement()); - thread.setDaemon(daemon); + String string2 = string + atomicInteger.getAndIncrement(); + TracyClient.setThreadName(string2, string.hashCode()); + thread.setName(string2); + thread.setDaemon(bl); thread.setUncaughtExceptionHandler(Util::onThreadException); return thread; - }); + })); } public static void throwAsRuntime(Throwable throwable) { @@ -272,35 +268,22 @@ public class Util { return type2; } - public static Runnable wrapThreadWithTaskName(String name, Runnable task) { - return SharedConstants.IS_RUNNING_IN_IDE ? () -> { + public static void runNamed(Runnable runnable, String string) { + if (SharedConstants.IS_RUNNING_IN_IDE) { Thread thread = Thread.currentThread(); String string2 = thread.getName(); - thread.setName(name); + thread.setName(string); - try { - task.run(); + try (Zone zone = TracyClient.beginZone(string, SharedConstants.IS_RUNNING_IN_IDE)) { + runnable.run(); } finally { thread.setName(string2); } - } : task; - } - - public static Supplier wrapThreadWithTaskName(String name, Supplier task) { - return SharedConstants.IS_RUNNING_IN_IDE ? () -> { - Thread thread = Thread.currentThread(); - String string2 = thread.getName(); - thread.setName(name); - - Object var4; - try { - var4 = task.get(); - } finally { - thread.setName(string2); + } else { + try (Zone zone2 = TracyClient.beginZone(string, SharedConstants.IS_RUNNING_IN_IDE)) { + runnable.run(); } - - return var4; - } : task; + } } public static String getRegisteredName(Registry registry, T value) { @@ -308,42 +291,144 @@ public class Util { return resourceLocation == null ? "[unregistered]" : resourceLocation.toString(); } - public static Predicate allOf(List> predicates) { - return switch (predicates.size()) { - case 0 -> object -> true; - case 1 -> (Predicate)predicates.get(0); - case 2 -> ((Predicate)predicates.get(0)).and((Predicate)predicates.get(1)); - default -> { - Predicate[] predicates2 = (Predicate[])predicates.toArray(Predicate[]::new); - yield object -> { - for (Predicate predicate : predicates2) { - if (!predicate.test(object)) { - return false; - } - } + public static Predicate allOf() { + return object -> true; + } - return true; - }; + public static Predicate allOf(Predicate predicate) { + return (Predicate)predicate; + } + + public static Predicate allOf(Predicate predicate, Predicate predicate2) { + return object -> predicate.test(object) && predicate2.test(object); + } + + public static Predicate allOf(Predicate predicate, Predicate predicate2, Predicate predicate3) { + return object -> predicate.test(object) && predicate2.test(object) && predicate3.test(object); + } + + public static Predicate allOf( + Predicate predicate, Predicate predicate2, Predicate predicate3, Predicate predicate4 + ) { + return object -> predicate.test(object) && predicate2.test(object) && predicate3.test(object) && predicate4.test(object); + } + + public static Predicate allOf( + Predicate predicate, + Predicate predicate2, + Predicate predicate3, + Predicate predicate4, + Predicate predicate5 + ) { + return object -> predicate.test(object) && predicate2.test(object) && predicate3.test(object) && predicate4.test(object) && predicate5.test(object); + } + + @SafeVarargs + public static Predicate allOf(Predicate... predicates) { + return object -> { + for (Predicate predicate : predicates) { + if (!predicate.test(object)) { + return false; + } + } + + return true; + }; + } + + public static Predicate allOf(List> predicates) { + return switch (predicates.size()) { + case 0 -> allOf(); + case 1 -> allOf((Predicate)predicates.get(0)); + case 2 -> allOf((Predicate)predicates.get(0), (Predicate)predicates.get(1)); + case 3 -> allOf((Predicate)predicates.get(0), (Predicate)predicates.get(1), (Predicate)predicates.get(2)); + case 4 -> allOf( + (Predicate)predicates.get(0), + (Predicate)predicates.get(1), + (Predicate)predicates.get(2), + (Predicate)predicates.get(3) + ); + case 5 -> allOf( + (Predicate)predicates.get(0), + (Predicate)predicates.get(1), + (Predicate)predicates.get(2), + (Predicate)predicates.get(3), + (Predicate)predicates.get(4) + ); + default -> { + Predicate[] predicates2 = (Predicate[])predicates.toArray(Predicate[]::new); + yield allOf(predicates2); } }; } - public static Predicate anyOf(List> predicates) { - return switch (predicates.size()) { - case 0 -> object -> false; - case 1 -> (Predicate)predicates.get(0); - case 2 -> ((Predicate)predicates.get(0)).or((Predicate)predicates.get(1)); - default -> { - Predicate[] predicates2 = (Predicate[])predicates.toArray(Predicate[]::new); - yield object -> { - for (Predicate predicate : predicates2) { - if (predicate.test(object)) { - return true; - } - } + public static Predicate anyOf() { + return object -> false; + } - return false; - }; + public static Predicate anyOf(Predicate predicate) { + return (Predicate)predicate; + } + + public static Predicate anyOf(Predicate predicate, Predicate predicate2) { + return object -> predicate.test(object) || predicate2.test(object); + } + + public static Predicate anyOf(Predicate predicate, Predicate predicate2, Predicate predicate3) { + return object -> predicate.test(object) || predicate2.test(object) || predicate3.test(object); + } + + public static Predicate anyOf( + Predicate predicate, Predicate predicate2, Predicate predicate3, Predicate predicate4 + ) { + return object -> predicate.test(object) || predicate2.test(object) || predicate3.test(object) || predicate4.test(object); + } + + public static Predicate anyOf( + Predicate predicate, + Predicate predicate2, + Predicate predicate3, + Predicate predicate4, + Predicate predicate5 + ) { + return object -> predicate.test(object) || predicate2.test(object) || predicate3.test(object) || predicate4.test(object) || predicate5.test(object); + } + + @SafeVarargs + public static Predicate anyOf(Predicate... predicates) { + return object -> { + for (Predicate predicate : predicates) { + if (predicate.test(object)) { + return true; + } + } + + return false; + }; + } + + public static Predicate anyOf(List> predicates) { + return switch (predicates.size()) { + case 0 -> anyOf(); + case 1 -> anyOf((Predicate)predicates.get(0)); + case 2 -> anyOf((Predicate)predicates.get(0), (Predicate)predicates.get(1)); + case 3 -> anyOf((Predicate)predicates.get(0), (Predicate)predicates.get(1), (Predicate)predicates.get(2)); + case 4 -> anyOf( + (Predicate)predicates.get(0), + (Predicate)predicates.get(1), + (Predicate)predicates.get(2), + (Predicate)predicates.get(3) + ); + case 5 -> anyOf( + (Predicate)predicates.get(0), + (Predicate)predicates.get(1), + (Predicate)predicates.get(2), + (Predicate)predicates.get(3), + (Predicate)predicates.get(4) + ); + default -> { + Predicate[] predicates2 = (Predicate[])predicates.toArray(Predicate[]::new); + yield anyOf(predicates2); } }; } @@ -458,6 +543,16 @@ public class Util { return object; } + public static , V> EnumMap makeEnumMap(Class class_, Function function) { + EnumMap enumMap = new EnumMap(class_); + + for (K enum_ : (Enum[])class_.getEnumConstants()) { + enumMap.put(enum_, function.apply(enum_)); + } + + return enumMap; + } + /** * Takes a list of futures and returns a future of list that completes when all of them succeed or any of them error, */ @@ -941,18 +1036,8 @@ public class Util { public static enum OS { LINUX("linux"), SOLARIS("solaris"), - WINDOWS("windows") { - @Override - protected String[] getOpenUriArguments(URI uri) { - return new String[]{"rundll32", "url.dll,FileProtocolHandler", uri.toString()}; - } - }, - OSX("mac") { - @Override - protected String[] getOpenUriArguments(URI uri) { - return new String[]{"open", uri.toString()}; - } - }, + WINDOWS("WINDOWS", 2, "windows"), + OSX("OSX", 3, "mac"), UNKNOWN("unknown"); private final String telemetryName; diff --git a/net/minecraft/advancements/AdvancementRewards.java b/net/minecraft/advancements/AdvancementRewards.java index 4320b17d..bb3b1fbc 100644 --- a/net/minecraft/advancements/AdvancementRewards.java +++ b/net/minecraft/advancements/AdvancementRewards.java @@ -15,17 +15,18 @@ import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; import net.minecraft.world.entity.item.ItemEntity; import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.Recipe; import net.minecraft.world.level.storage.loot.LootParams; import net.minecraft.world.level.storage.loot.LootTable; import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets; import net.minecraft.world.level.storage.loot.parameters.LootContextParams; -public record AdvancementRewards(int experience, List> loot, List recipes, Optional function) { +public record AdvancementRewards(int experience, List> loot, List>> recipes, Optional function) { public static final Codec CODEC = RecordCodecBuilder.create( instance -> instance.group( Codec.INT.optionalFieldOf("experience", 0).forGetter(AdvancementRewards::experience), ResourceKey.codec(Registries.LOOT_TABLE).listOf().optionalFieldOf("loot", List.of()).forGetter(AdvancementRewards::loot), - ResourceLocation.CODEC.listOf().optionalFieldOf("recipes", List.of()).forGetter(AdvancementRewards::recipes), + ResourceKey.codec(Registries.RECIPE).listOf().optionalFieldOf("recipes", List.of()).forGetter(AdvancementRewards::recipes), CacheableFunction.CODEC.optionalFieldOf("function").forGetter(AdvancementRewards::function) ) .apply(instance, AdvancementRewards::new) @@ -84,7 +85,7 @@ public record AdvancementRewards(int experience, List> lo public static class Builder { private int experience; private final ImmutableList.Builder> loot = ImmutableList.builder(); - private final ImmutableList.Builder recipes = ImmutableList.builder(); + private final ImmutableList.Builder>> recipes = ImmutableList.builder(); private Optional function = Optional.empty(); /** @@ -111,18 +112,12 @@ public record AdvancementRewards(int experience, List> lo return this; } - /** - * Creates a new builder with the given recipe as a reward. - */ - public static AdvancementRewards.Builder recipe(ResourceLocation recipeId) { - return new AdvancementRewards.Builder().addRecipe(recipeId); + public static AdvancementRewards.Builder recipe(ResourceKey> resourceKey) { + return new AdvancementRewards.Builder().addRecipe(resourceKey); } - /** - * Adds the given recipe to the rewards. - */ - public AdvancementRewards.Builder addRecipe(ResourceLocation recipeId) { - this.recipes.add(recipeId); + public AdvancementRewards.Builder addRecipe(ResourceKey> resourceKey) { + this.recipes.add(resourceKey); return this; } diff --git a/net/minecraft/advancements/CriteriaTriggers.java b/net/minecraft/advancements/CriteriaTriggers.java index 1a86f6c9..d3ca76c3 100644 --- a/net/minecraft/advancements/CriteriaTriggers.java +++ b/net/minecraft/advancements/CriteriaTriggers.java @@ -23,7 +23,7 @@ import net.minecraft.advancements.critereon.ImpossibleTrigger; import net.minecraft.advancements.critereon.InventoryChangeTrigger; import net.minecraft.advancements.critereon.ItemDurabilityTrigger; import net.minecraft.advancements.critereon.ItemUsedOnLocationTrigger; -import net.minecraft.advancements.critereon.KilledByCrossbowTrigger; +import net.minecraft.advancements.critereon.KilledByArrowTrigger; import net.minecraft.advancements.critereon.KilledTrigger; import net.minecraft.advancements.critereon.LevitationTrigger; import net.minecraft.advancements.critereon.LightningStrikeTrigger; @@ -81,7 +81,7 @@ public class CriteriaTriggers { public static final FishingRodHookedTrigger FISHING_ROD_HOOKED = register("fishing_rod_hooked", new FishingRodHookedTrigger()); public static final ChanneledLightningTrigger CHANNELED_LIGHTNING = register("channeled_lightning", new ChanneledLightningTrigger()); public static final ShotCrossbowTrigger SHOT_CROSSBOW = register("shot_crossbow", new ShotCrossbowTrigger()); - public static final KilledByCrossbowTrigger KILLED_BY_CROSSBOW = register("killed_by_crossbow", new KilledByCrossbowTrigger()); + public static final KilledByArrowTrigger KILLED_BY_ARROW = register("killed_by_arrow", new KilledByArrowTrigger()); public static final PlayerTrigger RAID_WIN = register("hero_of_the_village", new PlayerTrigger()); public static final PlayerTrigger RAID_OMEN = register("voluntary_exile", new PlayerTrigger()); public static final SlideDownBlockTrigger HONEY_BLOCK_SLIDE = register("slide_down_block", new SlideDownBlockTrigger()); diff --git a/net/minecraft/advancements/critereon/AnyBlockInteractionTrigger.java b/net/minecraft/advancements/critereon/AnyBlockInteractionTrigger.java index 9b0606f4..2adb9f60 100644 --- a/net/minecraft/advancements/critereon/AnyBlockInteractionTrigger.java +++ b/net/minecraft/advancements/critereon/AnyBlockInteractionTrigger.java @@ -3,6 +3,7 @@ package net.minecraft.advancements.critereon; import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; import java.util.Optional; +import net.minecraft.advancements.critereon.SimpleCriterionTrigger.SimpleInstance; import net.minecraft.core.BlockPos; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; @@ -32,8 +33,7 @@ public class AnyBlockInteractionTrigger extends SimpleCriterionTrigger triggerInstance.matches(lootContext)); } - public record TriggerInstance(Optional player, Optional location) - implements SimpleCriterionTrigger.SimpleInstance { + public record TriggerInstance(Optional player, Optional location) implements SimpleInstance { public static final Codec CODEC = RecordCodecBuilder.create( instance -> instance.group( EntityPredicate.ADVANCEMENT_CODEC.optionalFieldOf("player").forGetter(AnyBlockInteractionTrigger.TriggerInstance::player), @@ -48,7 +48,7 @@ public class AnyBlockInteractionTrigger extends SimpleCriterionTrigger validator.validate(contextAwarePredicate, LootContextParamSets.ADVANCEMENT_LOCATION, ".location")); } } diff --git a/net/minecraft/advancements/critereon/BlockPredicate.java b/net/minecraft/advancements/critereon/BlockPredicate.java index 603be9bf..58e0468e 100644 --- a/net/minecraft/advancements/critereon/BlockPredicate.java +++ b/net/minecraft/advancements/critereon/BlockPredicate.java @@ -2,12 +2,13 @@ package net.minecraft.advancements.critereon; import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; +import java.util.Arrays; import java.util.Collection; import java.util.Optional; import net.minecraft.core.BlockPos; +import net.minecraft.core.HolderGetter; import net.minecraft.core.HolderSet; import net.minecraft.core.RegistryCodecs; -import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.core.registries.Registries; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.RegistryFriendlyByteBuf; @@ -83,18 +84,17 @@ public record BlockPredicate(Optional> blocks, Optional holderGetter, Block... blocks) { + return this.of(holderGetter, Arrays.asList(blocks)); + } + + public BlockPredicate.Builder of(HolderGetter holderGetter, Collection collection) { + this.blocks = Optional.of(HolderSet.direct(Block::builtInRegistryHolder, collection)); return this; } - public BlockPredicate.Builder of(Collection blocks) { - this.blocks = Optional.of(HolderSet.direct(Block::builtInRegistryHolder, blocks)); - return this; - } - - public BlockPredicate.Builder of(TagKey tag) { - this.blocks = Optional.of(BuiltInRegistries.BLOCK.getOrCreateTag(tag)); + public BlockPredicate.Builder of(HolderGetter holderGetter, TagKey tagKey) { + this.blocks = Optional.of(holderGetter.getOrThrow(tagKey)); return this; } diff --git a/net/minecraft/advancements/critereon/ConsumeItemTrigger.java b/net/minecraft/advancements/critereon/ConsumeItemTrigger.java index 7e7c537f..48b73ccb 100644 --- a/net/minecraft/advancements/critereon/ConsumeItemTrigger.java +++ b/net/minecraft/advancements/critereon/ConsumeItemTrigger.java @@ -5,7 +5,10 @@ import com.mojang.serialization.codecs.RecordCodecBuilder; import java.util.Optional; import net.minecraft.advancements.CriteriaTriggers; import net.minecraft.advancements.Criterion; +import net.minecraft.advancements.critereon.SimpleCriterionTrigger.SimpleInstance; +import net.minecraft.core.HolderGetter; import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.ItemLike; @@ -19,7 +22,7 @@ public class ConsumeItemTrigger extends SimpleCriterionTrigger triggerInstance.matches(item)); } - public record TriggerInstance(Optional player, Optional item) implements SimpleCriterionTrigger.SimpleInstance { + public record TriggerInstance(Optional player, Optional item) implements SimpleInstance { public static final Codec CODEC = RecordCodecBuilder.create( instance -> instance.group( EntityPredicate.ADVANCEMENT_CODEC.optionalFieldOf("player").forGetter(ConsumeItemTrigger.TriggerInstance::player), @@ -32,8 +35,8 @@ public class ConsumeItemTrigger extends SimpleCriterionTrigger usedItem(ItemLike item) { - return usedItem(ItemPredicate.Builder.item().of(item.asItem())); + public static Criterion usedItem(HolderGetter holderGetter, ItemLike itemLike) { + return usedItem(ItemPredicate.Builder.item().of(holderGetter, itemLike.asItem())); } public static Criterion usedItem(ItemPredicate.Builder item) { diff --git a/net/minecraft/advancements/critereon/CriterionValidator.java b/net/minecraft/advancements/critereon/CriterionValidator.java index 113dd019..7e534614 100644 --- a/net/minecraft/advancements/critereon/CriterionValidator.java +++ b/net/minecraft/advancements/critereon/CriterionValidator.java @@ -4,8 +4,8 @@ import java.util.List; import java.util.Optional; import net.minecraft.core.HolderGetter; import net.minecraft.util.ProblemReporter; +import net.minecraft.util.context.ContextKeySet; import net.minecraft.world.level.storage.loot.ValidationContext; -import net.minecraft.world.level.storage.loot.parameters.LootContextParamSet; import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets; public class CriterionValidator { @@ -29,14 +29,14 @@ public class CriterionValidator { this.validate(entity, LootContextParamSets.ADVANCEMENT_ENTITY, name); } - public void validate(ContextAwarePredicate entity, LootContextParamSet contextParams, String name) { - entity.validate(new ValidationContext(this.reporter.forChild(name), contextParams, this.lootData)); + public void validate(ContextAwarePredicate contextAwarePredicate, ContextKeySet contextKeySet, String string) { + contextAwarePredicate.validate(new ValidationContext(this.reporter.forChild(string), contextKeySet, this.lootData)); } - public void validate(List entities, LootContextParamSet contextParams, String name) { - for (int i = 0; i < entities.size(); i++) { - ContextAwarePredicate contextAwarePredicate = (ContextAwarePredicate)entities.get(i); - contextAwarePredicate.validate(new ValidationContext(this.reporter.forChild(name + "[" + i + "]"), contextParams, this.lootData)); + public void validate(List list, ContextKeySet contextKeySet, String string) { + for (int i = 0; i < list.size(); i++) { + ContextAwarePredicate contextAwarePredicate = (ContextAwarePredicate)list.get(i); + contextAwarePredicate.validate(new ValidationContext(this.reporter.forChild(string + "[" + i + "]"), contextKeySet, this.lootData)); } } } diff --git a/net/minecraft/advancements/critereon/DefaultBlockInteractionTrigger.java b/net/minecraft/advancements/critereon/DefaultBlockInteractionTrigger.java index c8c35245..a8d36a58 100644 --- a/net/minecraft/advancements/critereon/DefaultBlockInteractionTrigger.java +++ b/net/minecraft/advancements/critereon/DefaultBlockInteractionTrigger.java @@ -3,6 +3,7 @@ package net.minecraft.advancements.critereon; import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; import java.util.Optional; +import net.minecraft.advancements.critereon.SimpleCriterionTrigger.SimpleInstance; import net.minecraft.core.BlockPos; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; @@ -30,8 +31,7 @@ public class DefaultBlockInteractionTrigger extends SimpleCriterionTrigger triggerInstance.matches(lootContext)); } - public record TriggerInstance(Optional player, Optional location) - implements SimpleCriterionTrigger.SimpleInstance { + public record TriggerInstance(Optional player, Optional location) implements SimpleInstance { public static final Codec CODEC = RecordCodecBuilder.create( instance -> instance.group( EntityPredicate.ADVANCEMENT_CODEC.optionalFieldOf("player").forGetter(DefaultBlockInteractionTrigger.TriggerInstance::player), @@ -46,7 +46,7 @@ public class DefaultBlockInteractionTrigger extends SimpleCriterionTrigger validator.validate(contextAwarePredicate, LootContextParamSets.BLOCK_USE, ".location")); } } diff --git a/net/minecraft/advancements/critereon/EntityEquipmentPredicate.java b/net/minecraft/advancements/critereon/EntityEquipmentPredicate.java index 0393b8fa..a89c81bf 100644 --- a/net/minecraft/advancements/critereon/EntityEquipmentPredicate.java +++ b/net/minecraft/advancements/critereon/EntityEquipmentPredicate.java @@ -5,10 +5,12 @@ import com.mojang.serialization.codecs.RecordCodecBuilder; import java.util.Optional; import net.minecraft.core.HolderGetter; import net.minecraft.core.component.DataComponentPredicate; +import net.minecraft.core.component.DataComponents; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.raid.Raid; +import net.minecraft.world.item.Item; import net.minecraft.world.item.Items; import net.minecraft.world.level.block.entity.BannerPattern; import org.jetbrains.annotations.Nullable; @@ -35,12 +37,14 @@ public record EntityEquipmentPredicate( .apply(instance, EntityEquipmentPredicate::new) ); - public static EntityEquipmentPredicate captainPredicate(HolderGetter patternRegistry) { + public static EntityEquipmentPredicate captainPredicate(HolderGetter holderGetter, HolderGetter holderGetter2) { return EntityEquipmentPredicate.Builder.equipment() .head( ItemPredicate.Builder.item() - .of(Items.WHITE_BANNER) - .hasComponents(DataComponentPredicate.allOf(Raid.getLeaderBannerInstance(patternRegistry).getComponents())) + .of(holderGetter, Items.WHITE_BANNER) + .hasComponents( + DataComponentPredicate.someOf(Raid.getOminousBannerInstance(holderGetter2).getComponents(), DataComponents.BANNER_PATTERNS, DataComponents.ITEM_NAME) + ) ) .build(); } diff --git a/net/minecraft/advancements/critereon/EntityPredicate.java b/net/minecraft/advancements/critereon/EntityPredicate.java index 46930dce..a25dbd31 100644 --- a/net/minecraft/advancements/critereon/EntityPredicate.java +++ b/net/minecraft/advancements/critereon/EntityPredicate.java @@ -6,6 +6,7 @@ import com.mojang.serialization.codecs.RecordCodecBuilder; import java.util.List; import java.util.Optional; import java.util.stream.Stream; +import net.minecraft.core.HolderGetter; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.tags.TagKey; @@ -171,9 +172,7 @@ public record EntityPredicate( public static class Builder { private Optional entityType = Optional.empty(); private Optional distanceToPlayer = Optional.empty(); - private Optional fallDistance = Optional.empty(); private Optional movement = Optional.empty(); - private Optional location = Optional.empty(); private Optional located = Optional.empty(); private Optional steppingOnLocation = Optional.empty(); private Optional movementAffectedBy = Optional.empty(); @@ -193,13 +192,13 @@ public record EntityPredicate( return new EntityPredicate.Builder(); } - public EntityPredicate.Builder of(EntityType entityType) { - this.entityType = Optional.of(EntityTypePredicate.of(entityType)); + public EntityPredicate.Builder of(HolderGetter> holderGetter, EntityType entityType) { + this.entityType = Optional.of(EntityTypePredicate.of(holderGetter, entityType)); return this; } - public EntityPredicate.Builder of(TagKey> entityTypeTag) { - this.entityType = Optional.of(EntityTypePredicate.of(entityTypeTag)); + public EntityPredicate.Builder of(HolderGetter> holderGetter, TagKey> tagKey) { + this.entityType = Optional.of(EntityTypePredicate.of(holderGetter, tagKey)); return this; } diff --git a/net/minecraft/advancements/critereon/EntitySubPredicates.java b/net/minecraft/advancements/critereon/EntitySubPredicates.java index 908be306..deff8c76 100644 --- a/net/minecraft/advancements/critereon/EntitySubPredicates.java +++ b/net/minecraft/advancements/critereon/EntitySubPredicates.java @@ -5,6 +5,7 @@ import com.mojang.serialization.MapCodec; import com.mojang.serialization.codecs.RecordCodecBuilder; import java.util.Optional; import java.util.function.Function; +import net.minecraft.advancements.critereon.EntitySubPredicates.EntityHolderVariantPredicateType.Instance; import net.minecraft.core.Holder; import net.minecraft.core.HolderSet; import net.minecraft.core.Registry; @@ -12,7 +13,6 @@ import net.minecraft.core.RegistryCodecs; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.core.registries.Registries; import net.minecraft.resources.ResourceKey; -import net.minecraft.server.level.ServerLevel; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.animal.Cat; import net.minecraft.world.entity.animal.CatVariant; @@ -21,6 +21,7 @@ import net.minecraft.world.entity.animal.FrogVariant; import net.minecraft.world.entity.animal.MushroomCow; import net.minecraft.world.entity.animal.Parrot; import net.minecraft.world.entity.animal.Rabbit; +import net.minecraft.world.entity.animal.Salmon; import net.minecraft.world.entity.animal.TropicalFish; import net.minecraft.world.entity.animal.Wolf; import net.minecraft.world.entity.animal.WolfVariant; @@ -33,9 +34,6 @@ import net.minecraft.world.entity.decoration.Painting; import net.minecraft.world.entity.decoration.PaintingVariant; import net.minecraft.world.entity.npc.VillagerDataHolder; import net.minecraft.world.entity.npc.VillagerType; -import net.minecraft.world.entity.vehicle.Boat; -import net.minecraft.world.phys.Vec3; -import org.jetbrains.annotations.Nullable; public class EntitySubPredicates { public static final MapCodec LIGHTNING = register("lightning", LightningBoltPredicate.CODEC); @@ -43,26 +41,23 @@ public class EntitySubPredicates { public static final MapCodec PLAYER = register("player", PlayerPredicate.CODEC); public static final MapCodec SLIME = register("slime", SlimePredicate.CODEC); public static final MapCodec RAIDER = register("raider", RaiderPredicate.CODEC); + public static final MapCodec SHEEP = register("sheep", SheepPredicate.CODEC); public static final EntitySubPredicates.EntityVariantPredicateType AXOLOTL = register( "axolotl", EntitySubPredicates.EntityVariantPredicateType.create( Axolotl.Variant.CODEC, entity -> entity instanceof Axolotl axolotl ? Optional.of(axolotl.getVariant()) : Optional.empty() ) ); - public static final EntitySubPredicates.EntityVariantPredicateType BOAT = register( - "boat", + public static final EntitySubPredicates.EntityVariantPredicateType FOX = register( + "fox", EntitySubPredicates.EntityVariantPredicateType.create( - Boat.Type.CODEC, entity -> entity instanceof Boat boat ? Optional.of(boat.getVariant()) : Optional.empty() + Fox.Variant.CODEC, entity -> entity instanceof Fox fox ? Optional.of(fox.getVariant()) : Optional.empty() ) ); - public static final EntitySubPredicates.EntityVariantPredicateType FOX = register( - "fox", - EntitySubPredicates.EntityVariantPredicateType.create(Fox.Type.CODEC, entity -> entity instanceof Fox fox ? Optional.of(fox.getVariant()) : Optional.empty()) - ); - public static final EntitySubPredicates.EntityVariantPredicateType MOOSHROOM = register( + public static final EntitySubPredicates.EntityVariantPredicateType MOOSHROOM = register( "mooshroom", EntitySubPredicates.EntityVariantPredicateType.create( - MushroomCow.MushroomType.CODEC, entity -> entity instanceof MushroomCow mushroomCow ? Optional.of(mushroomCow.getVariant()) : Optional.empty() + MushroomCow.Variant.CODEC, entity -> entity instanceof MushroomCow mushroomCow ? Optional.of(mushroomCow.getVariant()) : Optional.empty() ) ); public static final EntitySubPredicates.EntityVariantPredicateType RABBIT = register( @@ -96,6 +91,12 @@ public class EntitySubPredicates { Parrot.Variant.CODEC, entity -> entity instanceof Parrot parrot ? Optional.of(parrot.getVariant()) : Optional.empty() ) ); + public static final EntitySubPredicates.EntityVariantPredicateType SALMON = register( + "salmon", + EntitySubPredicates.EntityVariantPredicateType.create( + Salmon.Variant.CODEC, entity -> entity instanceof Salmon salmon ? Optional.of(salmon.getVariant()) : Optional.empty() + ) + ); public static final EntitySubPredicates.EntityVariantPredicateType TROPICAL_FISH = register( "tropical_fish", EntitySubPredicates.EntityVariantPredicateType.create( @@ -173,30 +174,12 @@ public class EntitySubPredicates { this.getter = getter; this.codec = RecordCodecBuilder.mapCodec( instance -> instance.group(RegistryCodecs.homogeneousList(registryKey).fieldOf("variant").forGetter(instancex -> instancex.variants)) - .apply(instance, holderSet -> new EntitySubPredicates.EntityHolderVariantPredicateType.Instance(holderSet)) + .apply(instance, holderSet -> new Instance(this, holderSet)) ); } public EntitySubPredicate createPredicate(HolderSet variants) { - return new EntitySubPredicates.EntityHolderVariantPredicateType.Instance(variants); - } - - class Instance implements EntitySubPredicate { - final HolderSet variants; - - Instance(final HolderSet variants) { - this.variants = variants; - } - - @Override - public MapCodec.Instance> codec() { - return EntityHolderVariantPredicateType.this.codec; - } - - @Override - public boolean matches(Entity entity, ServerLevel level, @Nullable Vec3 position) { - return ((Optional)EntityHolderVariantPredicateType.this.getter.apply(entity)).filter(this.variants::contains).isPresent(); - } + return new Instance(this, variants); } } @@ -216,30 +199,12 @@ public class EntitySubPredicates { this.getter = getter; this.codec = RecordCodecBuilder.mapCodec( instance -> instance.group(codec.fieldOf("variant").forGetter(instancex -> instancex.variant)) - .apply(instance, object -> new EntitySubPredicates.EntityVariantPredicateType.Instance(object)) + .apply(instance, object -> new net.minecraft.advancements.critereon.EntitySubPredicates.EntityVariantPredicateType.Instance(this, object)) ); } public EntitySubPredicate createPredicate(V variant) { - return new EntitySubPredicates.EntityVariantPredicateType.Instance(variant); - } - - class Instance implements EntitySubPredicate { - final V variant; - - Instance(final V variant) { - this.variant = variant; - } - - @Override - public MapCodec.Instance> codec() { - return EntityVariantPredicateType.this.codec; - } - - @Override - public boolean matches(Entity entity, ServerLevel level, @Nullable Vec3 position) { - return ((Optional)EntityVariantPredicateType.this.getter.apply(entity)).filter(this.variant::equals).isPresent(); - } + return new net.minecraft.advancements.critereon.EntitySubPredicates.EntityVariantPredicateType.Instance(this, variant); } } } diff --git a/net/minecraft/advancements/critereon/EntityTypePredicate.java b/net/minecraft/advancements/critereon/EntityTypePredicate.java index 932c0f96..a4e89be7 100644 --- a/net/minecraft/advancements/critereon/EntityTypePredicate.java +++ b/net/minecraft/advancements/critereon/EntityTypePredicate.java @@ -1,9 +1,9 @@ package net.minecraft.advancements.critereon; import com.mojang.serialization.Codec; +import net.minecraft.core.HolderGetter; import net.minecraft.core.HolderSet; import net.minecraft.core.RegistryCodecs; -import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.core.registries.Registries; import net.minecraft.tags.TagKey; import net.minecraft.world.entity.EntityType; @@ -12,12 +12,12 @@ public record EntityTypePredicate(HolderSet> types) { public static final Codec CODEC = RegistryCodecs.homogeneousList(Registries.ENTITY_TYPE) .xmap(EntityTypePredicate::new, EntityTypePredicate::types); - public static EntityTypePredicate of(EntityType type) { - return new EntityTypePredicate(HolderSet.direct(type.builtInRegistryHolder())); + public static EntityTypePredicate of(HolderGetter> holderGetter, EntityType entityType) { + return new EntityTypePredicate(HolderSet.direct(entityType.builtInRegistryHolder())); } - public static EntityTypePredicate of(TagKey> tag) { - return new EntityTypePredicate(BuiltInRegistries.ENTITY_TYPE.getOrCreateTag(tag)); + public static EntityTypePredicate of(HolderGetter> holderGetter, TagKey> tagKey) { + return new EntityTypePredicate(holderGetter.getOrThrow(tagKey)); } public boolean matches(EntityType type) { diff --git a/net/minecraft/advancements/critereon/FishingRodHookedTrigger.java b/net/minecraft/advancements/critereon/FishingRodHookedTrigger.java index f592aaa1..45e09511 100644 --- a/net/minecraft/advancements/critereon/FishingRodHookedTrigger.java +++ b/net/minecraft/advancements/critereon/FishingRodHookedTrigger.java @@ -6,6 +6,7 @@ import java.util.Collection; import java.util.Optional; import net.minecraft.advancements.CriteriaTriggers; import net.minecraft.advancements.Criterion; +import net.minecraft.advancements.critereon.SimpleCriterionTrigger.SimpleInstance; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.item.ItemEntity; @@ -27,7 +28,7 @@ public class FishingRodHookedTrigger extends SimpleCriterionTrigger player, Optional rod, Optional entity, Optional item - ) implements SimpleCriterionTrigger.SimpleInstance { + ) implements SimpleInstance { public static final Codec CODEC = RecordCodecBuilder.create( instance -> instance.group( EntityPredicate.ADVANCEMENT_CODEC.optionalFieldOf("player").forGetter(FishingRodHookedTrigger.TriggerInstance::player), @@ -53,7 +54,7 @@ public class FishingRodHookedTrigger extends SimpleCriterionTrigger forward, + Optional backward, + Optional left, + Optional right, + Optional jump, + Optional sneak, + Optional sprint +) { + public static final Codec CODEC = RecordCodecBuilder.create( + instance -> instance.group( + Codec.BOOL.optionalFieldOf("forward").forGetter(InputPredicate::forward), + Codec.BOOL.optionalFieldOf("backward").forGetter(InputPredicate::backward), + Codec.BOOL.optionalFieldOf("left").forGetter(InputPredicate::left), + Codec.BOOL.optionalFieldOf("right").forGetter(InputPredicate::right), + Codec.BOOL.optionalFieldOf("jump").forGetter(InputPredicate::jump), + Codec.BOOL.optionalFieldOf("sneak").forGetter(InputPredicate::sneak), + Codec.BOOL.optionalFieldOf("sprint").forGetter(InputPredicate::sprint) + ) + .apply(instance, InputPredicate::new) + ); + + public boolean matches(Input input) { + return this.matches(this.forward, input.forward()) + && this.matches(this.backward, input.backward()) + && this.matches(this.left, input.left()) + && this.matches(this.right, input.right()) + && this.matches(this.jump, input.jump()) + && this.matches(this.sneak, input.shift()) + && this.matches(this.sprint, input.sprint()); + } + + private boolean matches(Optional optional, boolean bl) { + return (Boolean)optional.map(boolean_ -> boolean_ == bl).orElse(true); + } +} diff --git a/net/minecraft/advancements/critereon/ItemPredicate.java b/net/minecraft/advancements/critereon/ItemPredicate.java index 99e63586..f5d533ab 100644 --- a/net/minecraft/advancements/critereon/ItemPredicate.java +++ b/net/minecraft/advancements/critereon/ItemPredicate.java @@ -6,24 +6,25 @@ import com.mojang.serialization.codecs.RecordCodecBuilder; import java.util.Map; import java.util.Optional; import java.util.function.Predicate; +import net.minecraft.advancements.critereon.ItemSubPredicate.Type; +import net.minecraft.advancements.critereon.MinMaxBounds.Ints; +import net.minecraft.core.HolderGetter; import net.minecraft.core.HolderSet; import net.minecraft.core.RegistryCodecs; import net.minecraft.core.component.DataComponentHolder; import net.minecraft.core.component.DataComponentPredicate; -import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.core.registries.Registries; import net.minecraft.tags.TagKey; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.ItemLike; -public record ItemPredicate( - Optional> items, MinMaxBounds.Ints count, DataComponentPredicate components, Map, ItemSubPredicate> subPredicates -) implements Predicate { +public record ItemPredicate(Optional> items, Ints count, DataComponentPredicate components, Map, ItemSubPredicate> subPredicates) + implements Predicate { public static final Codec CODEC = RecordCodecBuilder.create( instance -> instance.group( RegistryCodecs.homogeneousList(Registries.ITEM).optionalFieldOf("items").forGetter(ItemPredicate::items), - MinMaxBounds.Ints.CODEC.optionalFieldOf("count", MinMaxBounds.Ints.ANY).forGetter(ItemPredicate::count), + Ints.CODEC.optionalFieldOf("count", Ints.ANY).forGetter(ItemPredicate::count), DataComponentPredicate.CODEC.optionalFieldOf("components", DataComponentPredicate.EMPTY).forGetter(ItemPredicate::components), ItemSubPredicate.CODEC.optionalFieldOf("predicates", Map.of()).forGetter(ItemPredicate::subPredicates) ) @@ -50,9 +51,9 @@ public record ItemPredicate( public static class Builder { private Optional> items = Optional.empty(); - private MinMaxBounds.Ints count = MinMaxBounds.Ints.ANY; + private Ints count = Ints.ANY; private DataComponentPredicate components = DataComponentPredicate.EMPTY; - private final ImmutableMap.Builder, ItemSubPredicate> subPredicates = ImmutableMap.builder(); + private final ImmutableMap.Builder, ItemSubPredicate> subPredicates = ImmutableMap.builder(); private Builder() { } @@ -61,22 +62,22 @@ public record ItemPredicate( return new ItemPredicate.Builder(); } - public ItemPredicate.Builder of(ItemLike... items) { - this.items = Optional.of(HolderSet.direct(itemLike -> itemLike.asItem().builtInRegistryHolder(), items)); + public ItemPredicate.Builder of(HolderGetter holderGetter, ItemLike... itemLikes) { + this.items = Optional.of(HolderSet.direct(itemLike -> itemLike.asItem().builtInRegistryHolder(), itemLikes)); return this; } - public ItemPredicate.Builder of(TagKey tag) { - this.items = Optional.of(BuiltInRegistries.ITEM.getOrCreateTag(tag)); + public ItemPredicate.Builder of(HolderGetter holderGetter, TagKey tagKey) { + this.items = Optional.of(holderGetter.getOrThrow(tagKey)); return this; } - public ItemPredicate.Builder withCount(MinMaxBounds.Ints count) { + public ItemPredicate.Builder withCount(Ints count) { this.count = count; return this; } - public ItemPredicate.Builder withSubPredicate(ItemSubPredicate.Type type, T itemSubPredicate) { + public ItemPredicate.Builder withSubPredicate(Type type, T itemSubPredicate) { this.subPredicates.put(type, itemSubPredicate); return this; } diff --git a/net/minecraft/advancements/critereon/ItemTrimPredicate.java b/net/minecraft/advancements/critereon/ItemTrimPredicate.java index fbaefcdd..eb3230c9 100644 --- a/net/minecraft/advancements/critereon/ItemTrimPredicate.java +++ b/net/minecraft/advancements/critereon/ItemTrimPredicate.java @@ -9,9 +9,9 @@ import net.minecraft.core.component.DataComponentType; import net.minecraft.core.component.DataComponents; import net.minecraft.core.registries.Registries; import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.armortrim.ArmorTrim; -import net.minecraft.world.item.armortrim.TrimMaterial; -import net.minecraft.world.item.armortrim.TrimPattern; +import net.minecraft.world.item.equipment.trim.ArmorTrim; +import net.minecraft.world.item.equipment.trim.TrimMaterial; +import net.minecraft.world.item.equipment.trim.TrimPattern; public record ItemTrimPredicate(Optional> material, Optional> pattern) implements SingleComponentItemPredicate { @@ -28,9 +28,9 @@ public record ItemTrimPredicate(Optional> material, Opti return DataComponents.TRIM; } - public boolean matches(ItemStack stack, ArmorTrim value) { - return this.material.isPresent() && !((HolderSet)this.material.get()).contains(value.material()) + public boolean matches(ItemStack itemStack, ArmorTrim armorTrim) { + return this.material.isPresent() && !((HolderSet)this.material.get()).contains(armorTrim.material()) ? false - : !this.pattern.isPresent() || ((HolderSet)this.pattern.get()).contains(value.pattern()); + : !this.pattern.isPresent() || ((HolderSet)this.pattern.get()).contains(armorTrim.pattern()); } } diff --git a/net/minecraft/advancements/critereon/ItemUsedOnLocationTrigger.java b/net/minecraft/advancements/critereon/ItemUsedOnLocationTrigger.java index da9cefb6..e1a11891 100644 --- a/net/minecraft/advancements/critereon/ItemUsedOnLocationTrigger.java +++ b/net/minecraft/advancements/critereon/ItemUsedOnLocationTrigger.java @@ -6,6 +6,8 @@ import java.util.Arrays; import java.util.Optional; import net.minecraft.advancements.CriteriaTriggers; import net.minecraft.advancements.Criterion; +import net.minecraft.advancements.critereon.LocationPredicate.Builder; +import net.minecraft.advancements.critereon.SimpleCriterionTrigger.SimpleInstance; import net.minecraft.core.BlockPos; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; @@ -40,8 +42,7 @@ public class ItemUsedOnLocationTrigger extends SimpleCriterionTrigger triggerInstance.matches(lootContext)); } - public record TriggerInstance(Optional player, Optional location) - implements SimpleCriterionTrigger.SimpleInstance { + public record TriggerInstance(Optional player, Optional location) implements SimpleInstance { public static final Codec CODEC = RecordCodecBuilder.create( instance -> instance.group( EntityPredicate.ADVANCEMENT_CODEC.optionalFieldOf("player").forGetter(ItemUsedOnLocationTrigger.TriggerInstance::player), @@ -62,18 +63,18 @@ public class ItemUsedOnLocationTrigger extends SimpleCriterionTrigger itemUsedOnBlock(LocationPredicate.Builder location, ItemPredicate.Builder tool) { + public static Criterion itemUsedOnBlock(Builder location, ItemPredicate.Builder tool) { return CriteriaTriggers.ITEM_USED_ON_BLOCK.createCriterion(itemUsedOnLocation(location, tool)); } - public static Criterion allayDropItemOnBlock(LocationPredicate.Builder location, ItemPredicate.Builder tool) { + public static Criterion allayDropItemOnBlock(Builder location, ItemPredicate.Builder tool) { return CriteriaTriggers.ALLAY_DROP_ITEM_ON_BLOCK.createCriterion(itemUsedOnLocation(location, tool)); } @@ -83,7 +84,7 @@ public class ItemUsedOnLocationTrigger extends SimpleCriterionTrigger validator.validate(contextAwarePredicate, LootContextParamSets.ADVANCEMENT_LOCATION, ".location")); } } diff --git a/net/minecraft/advancements/critereon/KilledByArrowTrigger.java b/net/minecraft/advancements/critereon/KilledByArrowTrigger.java new file mode 100644 index 00000000..31b6b2ef --- /dev/null +++ b/net/minecraft/advancements/critereon/KilledByArrowTrigger.java @@ -0,0 +1,111 @@ +package net.minecraft.advancements.critereon; + +import com.google.common.collect.Lists; +import com.google.common.collect.Sets; +import com.mojang.serialization.Codec; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import java.util.Collection; +import java.util.Iterator; +import java.util.List; +import java.util.Optional; +import java.util.Set; +import net.minecraft.advancements.CriteriaTriggers; +import net.minecraft.advancements.Criterion; +import net.minecraft.advancements.critereon.MinMaxBounds.Ints; +import net.minecraft.advancements.critereon.SimpleCriterionTrigger.SimpleInstance; +import net.minecraft.core.HolderGetter; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.world.level.storage.loot.LootContext; +import org.jetbrains.annotations.Nullable; + +public class KilledByArrowTrigger extends SimpleCriterionTrigger { + @Override + public Codec codec() { + return KilledByArrowTrigger.TriggerInstance.CODEC; + } + + public void trigger(ServerPlayer serverPlayer, Collection collection, @Nullable ItemStack itemStack) { + List list = Lists.newArrayList(); + Set> set = Sets.>newHashSet(); + + for (Entity entity : collection) { + set.add(entity.getType()); + list.add(EntityPredicate.createContext(serverPlayer, entity)); + } + + this.trigger(serverPlayer, triggerInstance -> triggerInstance.matches(list, set.size(), itemStack)); + } + + public record TriggerInstance( + Optional player, List victims, Ints uniqueEntityTypes, Optional firedFromWeapon + ) implements SimpleInstance { + public static final Codec CODEC = RecordCodecBuilder.create( + instance -> instance.group( + EntityPredicate.ADVANCEMENT_CODEC.optionalFieldOf("player").forGetter(KilledByArrowTrigger.TriggerInstance::player), + EntityPredicate.ADVANCEMENT_CODEC.listOf().optionalFieldOf("victims", List.of()).forGetter(KilledByArrowTrigger.TriggerInstance::victims), + Ints.CODEC.optionalFieldOf("unique_entity_types", Ints.ANY).forGetter(KilledByArrowTrigger.TriggerInstance::uniqueEntityTypes), + ItemPredicate.CODEC.optionalFieldOf("fired_from_weapon").forGetter(KilledByArrowTrigger.TriggerInstance::firedFromWeapon) + ) + .apply(instance, KilledByArrowTrigger.TriggerInstance::new) + ); + + public static Criterion crossbowKilled(HolderGetter holderGetter, EntityPredicate.Builder... builders) { + return CriteriaTriggers.KILLED_BY_ARROW + .createCriterion( + new KilledByArrowTrigger.TriggerInstance( + Optional.empty(), EntityPredicate.wrap(builders), Ints.ANY, Optional.of(ItemPredicate.Builder.item().of(holderGetter, Items.CROSSBOW).build()) + ) + ); + } + + public static Criterion crossbowKilled(HolderGetter holderGetter, Ints ints) { + return CriteriaTriggers.KILLED_BY_ARROW + .createCriterion( + new KilledByArrowTrigger.TriggerInstance( + Optional.empty(), List.of(), ints, Optional.of(ItemPredicate.Builder.item().of(holderGetter, Items.CROSSBOW).build()) + ) + ); + } + + public boolean matches(Collection collection, int i, @Nullable ItemStack itemStack) { + if (!this.firedFromWeapon.isPresent() || itemStack != null && ((ItemPredicate)this.firedFromWeapon.get()).test(itemStack)) { + if (!this.victims.isEmpty()) { + List list = Lists.newArrayList(collection); + + for (ContextAwarePredicate contextAwarePredicate : this.victims) { + boolean bl = false; + Iterator iterator = list.iterator(); + + while (iterator.hasNext()) { + LootContext lootContext = (LootContext)iterator.next(); + if (contextAwarePredicate.matches(lootContext)) { + iterator.remove(); + bl = true; + break; + } + } + + if (!bl) { + return false; + } + } + } + + return this.uniqueEntityTypes.matches(i); + } else { + return false; + } + } + + @Override + public void validate(CriterionValidator validator) { + SimpleInstance.super.validate(validator); + validator.validateEntities(this.victims, ".victims"); + } + } +} diff --git a/net/minecraft/advancements/critereon/KilledByCrossbowTrigger.java b/net/minecraft/advancements/critereon/KilledByCrossbowTrigger.java deleted file mode 100644 index d7471242..00000000 --- a/net/minecraft/advancements/critereon/KilledByCrossbowTrigger.java +++ /dev/null @@ -1,91 +0,0 @@ -package net.minecraft.advancements.critereon; - -import com.google.common.collect.Lists; -import com.google.common.collect.Sets; -import com.mojang.serialization.Codec; -import com.mojang.serialization.codecs.RecordCodecBuilder; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; -import java.util.Optional; -import java.util.Set; -import net.minecraft.advancements.CriteriaTriggers; -import net.minecraft.advancements.Criterion; -import net.minecraft.server.level.ServerPlayer; -import net.minecraft.world.entity.Entity; -import net.minecraft.world.entity.EntityType; -import net.minecraft.world.level.storage.loot.LootContext; - -public class KilledByCrossbowTrigger extends SimpleCriterionTrigger { - @Override - public Codec codec() { - return KilledByCrossbowTrigger.TriggerInstance.CODEC; - } - - public void trigger(ServerPlayer player, Collection entities) { - List list = Lists.newArrayList(); - Set> set = Sets.>newHashSet(); - - for (Entity entity : entities) { - set.add(entity.getType()); - list.add(EntityPredicate.createContext(player, entity)); - } - - this.trigger(player, triggerInstance -> triggerInstance.matches(list, set.size())); - } - - public record TriggerInstance(Optional player, List victims, MinMaxBounds.Ints uniqueEntityTypes) - implements SimpleCriterionTrigger.SimpleInstance { - public static final Codec CODEC = RecordCodecBuilder.create( - instance -> instance.group( - EntityPredicate.ADVANCEMENT_CODEC.optionalFieldOf("player").forGetter(KilledByCrossbowTrigger.TriggerInstance::player), - EntityPredicate.ADVANCEMENT_CODEC.listOf().optionalFieldOf("victims", List.of()).forGetter(KilledByCrossbowTrigger.TriggerInstance::victims), - MinMaxBounds.Ints.CODEC - .optionalFieldOf("unique_entity_types", MinMaxBounds.Ints.ANY) - .forGetter(KilledByCrossbowTrigger.TriggerInstance::uniqueEntityTypes) - ) - .apply(instance, KilledByCrossbowTrigger.TriggerInstance::new) - ); - - public static Criterion crossbowKilled(EntityPredicate.Builder... victims) { - return CriteriaTriggers.KILLED_BY_CROSSBOW - .createCriterion(new KilledByCrossbowTrigger.TriggerInstance(Optional.empty(), EntityPredicate.wrap(victims), MinMaxBounds.Ints.ANY)); - } - - public static Criterion crossbowKilled(MinMaxBounds.Ints uniqueEntityTypes) { - return CriteriaTriggers.KILLED_BY_CROSSBOW.createCriterion(new KilledByCrossbowTrigger.TriggerInstance(Optional.empty(), List.of(), uniqueEntityTypes)); - } - - public boolean matches(Collection contexts, int bounds) { - if (!this.victims.isEmpty()) { - List list = Lists.newArrayList(contexts); - - for (ContextAwarePredicate contextAwarePredicate : this.victims) { - boolean bl = false; - Iterator iterator = list.iterator(); - - while (iterator.hasNext()) { - LootContext lootContext = (LootContext)iterator.next(); - if (contextAwarePredicate.matches(lootContext)) { - iterator.remove(); - bl = true; - break; - } - } - - if (!bl) { - return false; - } - } - } - - return this.uniqueEntityTypes.matches(bounds); - } - - @Override - public void validate(CriterionValidator validator) { - SimpleCriterionTrigger.SimpleInstance.super.validate(validator); - validator.validateEntities(this.victims, ".victims"); - } - } -} diff --git a/net/minecraft/advancements/critereon/LootTableTrigger.java b/net/minecraft/advancements/critereon/LootTableTrigger.java index 519ad795..ae1050d0 100644 --- a/net/minecraft/advancements/critereon/LootTableTrigger.java +++ b/net/minecraft/advancements/critereon/LootTableTrigger.java @@ -5,6 +5,7 @@ import com.mojang.serialization.codecs.RecordCodecBuilder; import java.util.Optional; import net.minecraft.advancements.CriteriaTriggers; import net.minecraft.advancements.Criterion; +import net.minecraft.advancements.critereon.SimpleCriterionTrigger.SimpleInstance; import net.minecraft.core.registries.Registries; import net.minecraft.resources.ResourceKey; import net.minecraft.server.level.ServerPlayer; @@ -20,7 +21,7 @@ public class LootTableTrigger extends SimpleCriterionTrigger triggerInstance.matches(lootTable)); } - public record TriggerInstance(Optional player, ResourceKey lootTable) implements SimpleCriterionTrigger.SimpleInstance { + public record TriggerInstance(Optional player, ResourceKey lootTable) implements SimpleInstance { public static final Codec CODEC = RecordCodecBuilder.create( instance -> instance.group( EntityPredicate.ADVANCEMENT_CODEC.optionalFieldOf("player").forGetter(LootTableTrigger.TriggerInstance::player), diff --git a/net/minecraft/advancements/critereon/PlayerPredicate.java b/net/minecraft/advancements/critereon/PlayerPredicate.java index 00fecef0..1bb2fc1b 100644 --- a/net/minecraft/advancements/critereon/PlayerPredicate.java +++ b/net/minecraft/advancements/critereon/PlayerPredicate.java @@ -19,45 +19,53 @@ import java.util.function.Supplier; import net.minecraft.advancements.AdvancementHolder; import net.minecraft.advancements.AdvancementProgress; import net.minecraft.advancements.CriterionProgress; +import net.minecraft.advancements.critereon.MinMaxBounds.Ints; import net.minecraft.core.Holder; import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.core.registries.Registries; +import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.PlayerAdvancements; import net.minecraft.server.ServerAdvancementManager; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; -import net.minecraft.stats.RecipeBook; +import net.minecraft.stats.ServerRecipeBook; import net.minecraft.stats.Stat; import net.minecraft.stats.StatType; import net.minecraft.stats.StatsCounter; import net.minecraft.util.ExtraCodecs; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.projectile.ProjectileUtil; +import net.minecraft.world.item.crafting.Recipe; import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.EntityHitResult; -import net.minecraft.world.phys.HitResult; import net.minecraft.world.phys.Vec3; +import net.minecraft.world.phys.HitResult.Type; import org.jetbrains.annotations.Nullable; public record PlayerPredicate( - MinMaxBounds.Ints level, + Ints level, GameTypePredicate gameType, List> stats, - Object2BooleanMap recipes, + Object2BooleanMap>> recipes, Map advancements, - Optional lookingAt + Optional lookingAt, + Optional input ) implements EntitySubPredicate { public static final int LOOKING_AT_RANGE = 100; public static final MapCodec CODEC = RecordCodecBuilder.mapCodec( instance -> instance.group( - MinMaxBounds.Ints.CODEC.optionalFieldOf("level", MinMaxBounds.Ints.ANY).forGetter(PlayerPredicate::level), + Ints.CODEC.optionalFieldOf("level", Ints.ANY).forGetter(PlayerPredicate::level), GameTypePredicate.CODEC.optionalFieldOf("gamemode", GameTypePredicate.ANY).forGetter(PlayerPredicate::gameType), PlayerPredicate.StatMatcher.CODEC.listOf().optionalFieldOf("stats", List.of()).forGetter(PlayerPredicate::stats), - ExtraCodecs.object2BooleanMap(ResourceLocation.CODEC).optionalFieldOf("recipes", Object2BooleanMaps.emptyMap()).forGetter(PlayerPredicate::recipes), + ExtraCodecs.object2BooleanMap(ResourceKey.codec(Registries.RECIPE)) + .optionalFieldOf("recipes", Object2BooleanMaps.emptyMap()) + .forGetter(PlayerPredicate::recipes), Codec.unboundedMap(ResourceLocation.CODEC, PlayerPredicate.AdvancementPredicate.CODEC) .optionalFieldOf("advancements", Map.of()) .forGetter(PlayerPredicate::advancements), - EntityPredicate.CODEC.optionalFieldOf("looking_at").forGetter(PlayerPredicate::lookingAt) + EntityPredicate.CODEC.optionalFieldOf("looking_at").forGetter(PlayerPredicate::lookingAt), + InputPredicate.CODEC.optionalFieldOf("input").forGetter(PlayerPredicate::input) ) .apply(instance, PlayerPredicate::new) ); @@ -79,10 +87,10 @@ public record PlayerPredicate( } } - RecipeBook recipeBook = serverPlayer.getRecipeBook(); + ServerRecipeBook serverRecipeBook = serverPlayer.getRecipeBook(); - for (Entry entry : this.recipes.object2BooleanEntrySet()) { - if (recipeBook.contains((ResourceLocation)entry.getKey()) != entry.getBooleanValue()) { + for (Entry>> entry : this.recipes.object2BooleanEntrySet()) { + if (serverRecipeBook.contains((ResourceKey>)entry.getKey()) != entry.getBooleanValue()) { return false; } } @@ -108,7 +116,7 @@ public record PlayerPredicate( EntityHitResult entityHitResult = ProjectileUtil.getEntityHitResult( serverPlayer.level(), serverPlayer, vec3, vec33, new AABB(vec3, vec33).inflate(1.0), entityx -> !entityx.isSpectator(), 0.0F ); - if (entityHitResult == null || entityHitResult.getType() != HitResult.Type.ENTITY) { + if (entityHitResult == null || entityHitResult.getType() != Type.ENTITY) { return false; } @@ -118,7 +126,7 @@ public record PlayerPredicate( } } - return true; + return !this.input.isPresent() || ((InputPredicate)this.input.get()).matches(serverPlayer.getLastClientInput()); } } @@ -168,29 +176,30 @@ public record PlayerPredicate( } public static class Builder { - private MinMaxBounds.Ints level = MinMaxBounds.Ints.ANY; + private Ints level = Ints.ANY; private GameTypePredicate gameType = GameTypePredicate.ANY; private final ImmutableList.Builder> stats = ImmutableList.builder(); - private final Object2BooleanMap recipes = new Object2BooleanOpenHashMap<>(); + private final Object2BooleanMap>> recipes = new Object2BooleanOpenHashMap<>(); private final Map advancements = Maps.newHashMap(); private Optional lookingAt = Optional.empty(); + private Optional input = Optional.empty(); public static PlayerPredicate.Builder player() { return new PlayerPredicate.Builder(); } - public PlayerPredicate.Builder setLevel(MinMaxBounds.Ints level) { + public PlayerPredicate.Builder setLevel(Ints level) { this.level = level; return this; } - public PlayerPredicate.Builder addStat(StatType type, Holder.Reference value, MinMaxBounds.Ints range) { + public PlayerPredicate.Builder addStat(StatType type, Holder.Reference value, Ints range) { this.stats.add(new PlayerPredicate.StatMatcher<>(type, value, range)); return this; } - public PlayerPredicate.Builder addRecipe(ResourceLocation recipe, boolean unlocked) { - this.recipes.put(recipe, unlocked); + public PlayerPredicate.Builder addRecipe(ResourceKey> resourceKey, boolean bl) { + this.recipes.put(resourceKey, bl); return this; } @@ -214,17 +223,22 @@ public record PlayerPredicate( return this; } + public PlayerPredicate.Builder hasInput(InputPredicate inputPredicate) { + this.input = Optional.of(inputPredicate); + return this; + } + public PlayerPredicate build() { - return new PlayerPredicate(this.level, this.gameType, this.stats.build(), this.recipes, this.advancements, this.lookingAt); + return new PlayerPredicate(this.level, this.gameType, this.stats.build(), this.recipes, this.advancements, this.lookingAt, this.input); } } - record StatMatcher(StatType type, Holder value, MinMaxBounds.Ints range, Supplier> stat) { + record StatMatcher(StatType type, Holder value, Ints range, Supplier> stat) { public static final Codec> CODEC = BuiltInRegistries.STAT_TYPE .byNameCodec() .dispatch(PlayerPredicate.StatMatcher::type, PlayerPredicate.StatMatcher::createTypedCodec); - public StatMatcher(StatType type, Holder value, MinMaxBounds.Ints range) { + public StatMatcher(StatType type, Holder value, Ints range) { this(type, value, range, Suppliers.memoize(() -> type.get(value.value()))); } @@ -232,7 +246,7 @@ public record PlayerPredicate( return RecordCodecBuilder.mapCodec( instance -> instance.group( statType.getRegistry().holderByNameCodec().fieldOf("stat").forGetter(PlayerPredicate.StatMatcher::value), - MinMaxBounds.Ints.CODEC.optionalFieldOf("value", MinMaxBounds.Ints.ANY).forGetter(PlayerPredicate.StatMatcher::range) + Ints.CODEC.optionalFieldOf("value", Ints.ANY).forGetter(PlayerPredicate.StatMatcher::range) ) .apply(instance, (holder, ints) -> new PlayerPredicate.StatMatcher<>(statType, holder, ints)) ); diff --git a/net/minecraft/advancements/critereon/PlayerTrigger.java b/net/minecraft/advancements/critereon/PlayerTrigger.java index 8b7d53a9..95d0a395 100644 --- a/net/minecraft/advancements/critereon/PlayerTrigger.java +++ b/net/minecraft/advancements/critereon/PlayerTrigger.java @@ -5,6 +5,9 @@ import com.mojang.serialization.codecs.RecordCodecBuilder; import java.util.Optional; import net.minecraft.advancements.CriteriaTriggers; import net.minecraft.advancements.Criterion; +import net.minecraft.advancements.critereon.LocationPredicate.Builder; +import net.minecraft.advancements.critereon.SimpleCriterionTrigger.SimpleInstance; +import net.minecraft.core.HolderGetter; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.item.Item; import net.minecraft.world.level.block.Block; @@ -19,13 +22,13 @@ public class PlayerTrigger extends SimpleCriterionTrigger true); } - public record TriggerInstance(Optional player) implements SimpleCriterionTrigger.SimpleInstance { + public record TriggerInstance(Optional player) implements SimpleInstance { public static final Codec CODEC = RecordCodecBuilder.create( instance -> instance.group(EntityPredicate.ADVANCEMENT_CODEC.optionalFieldOf("player").forGetter(PlayerTrigger.TriggerInstance::player)) .apply(instance, PlayerTrigger.TriggerInstance::new) ); - public static Criterion located(LocationPredicate.Builder location) { + public static Criterion located(Builder location) { return CriteriaTriggers.LOCATION .createCriterion(new PlayerTrigger.TriggerInstance(Optional.of(EntityPredicate.wrap(EntityPredicate.Builder.entity().located(location))))); } @@ -54,11 +57,13 @@ public class PlayerTrigger extends SimpleCriterionTrigger walkOnBlockWithEquipment(Block block, Item equipment) { + public static Criterion walkOnBlockWithEquipment( + HolderGetter holderGetter, HolderGetter holderGetter2, Block block, Item item + ) { return located( EntityPredicate.Builder.entity() - .equipment(EntityEquipmentPredicate.Builder.equipment().feet(ItemPredicate.Builder.item().of(equipment))) - .steppingOn(LocationPredicate.Builder.location().setBlock(BlockPredicate.Builder.block().of(block))) + .equipment(EntityEquipmentPredicate.Builder.equipment().feet(ItemPredicate.Builder.item().of(holderGetter2, item))) + .steppingOn(Builder.location().setBlock(BlockPredicate.Builder.block().of(holderGetter, block))) ); } } diff --git a/net/minecraft/advancements/critereon/RecipeCraftedTrigger.java b/net/minecraft/advancements/critereon/RecipeCraftedTrigger.java index 712f3327..ba65159a 100644 --- a/net/minecraft/advancements/critereon/RecipeCraftedTrigger.java +++ b/net/minecraft/advancements/critereon/RecipeCraftedTrigger.java @@ -8,9 +8,12 @@ import java.util.List; import java.util.Optional; import net.minecraft.advancements.CriteriaTriggers; import net.minecraft.advancements.Criterion; -import net.minecraft.resources.ResourceLocation; +import net.minecraft.advancements.critereon.SimpleCriterionTrigger.SimpleInstance; +import net.minecraft.core.registries.Registries; +import net.minecraft.resources.ResourceKey; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.Recipe; public class RecipeCraftedTrigger extends SimpleCriterionTrigger { @Override @@ -18,43 +21,43 @@ public class RecipeCraftedTrigger extends SimpleCriterionTrigger items) { - this.trigger(player, triggerInstance -> triggerInstance.matches(recipeId, items)); + public void trigger(ServerPlayer serverPlayer, ResourceKey> resourceKey, List list) { + this.trigger(serverPlayer, triggerInstance -> triggerInstance.matches(resourceKey, list)); } - public record TriggerInstance(Optional player, ResourceLocation recipeId, List ingredients) - implements SimpleCriterionTrigger.SimpleInstance { + public record TriggerInstance(Optional player, ResourceKey> recipeId, List ingredients) + implements SimpleInstance { public static final Codec CODEC = RecordCodecBuilder.create( instance -> instance.group( EntityPredicate.ADVANCEMENT_CODEC.optionalFieldOf("player").forGetter(RecipeCraftedTrigger.TriggerInstance::player), - ResourceLocation.CODEC.fieldOf("recipe_id").forGetter(RecipeCraftedTrigger.TriggerInstance::recipeId), + ResourceKey.codec(Registries.RECIPE).fieldOf("recipe_id").forGetter(RecipeCraftedTrigger.TriggerInstance::recipeId), ItemPredicate.CODEC.listOf().optionalFieldOf("ingredients", List.of()).forGetter(RecipeCraftedTrigger.TriggerInstance::ingredients) ) .apply(instance, RecipeCraftedTrigger.TriggerInstance::new) ); - public static Criterion craftedItem(ResourceLocation recipeId, List ingredients) { + public static Criterion craftedItem(ResourceKey> resourceKey, List list) { return CriteriaTriggers.RECIPE_CRAFTED - .createCriterion(new RecipeCraftedTrigger.TriggerInstance(Optional.empty(), recipeId, ingredients.stream().map(ItemPredicate.Builder::build).toList())); + .createCriterion(new RecipeCraftedTrigger.TriggerInstance(Optional.empty(), resourceKey, list.stream().map(ItemPredicate.Builder::build).toList())); } - public static Criterion craftedItem(ResourceLocation recipeId) { - return CriteriaTriggers.RECIPE_CRAFTED.createCriterion(new RecipeCraftedTrigger.TriggerInstance(Optional.empty(), recipeId, List.of())); + public static Criterion craftedItem(ResourceKey> resourceKey) { + return CriteriaTriggers.RECIPE_CRAFTED.createCriterion(new RecipeCraftedTrigger.TriggerInstance(Optional.empty(), resourceKey, List.of())); } - public static Criterion crafterCraftedItem(ResourceLocation recipeId) { - return CriteriaTriggers.CRAFTER_RECIPE_CRAFTED.createCriterion(new RecipeCraftedTrigger.TriggerInstance(Optional.empty(), recipeId, List.of())); + public static Criterion crafterCraftedItem(ResourceKey> resourceKey) { + return CriteriaTriggers.CRAFTER_RECIPE_CRAFTED.createCriterion(new RecipeCraftedTrigger.TriggerInstance(Optional.empty(), resourceKey, List.of())); } - boolean matches(ResourceLocation recipeId, List items) { - if (!recipeId.equals(this.recipeId)) { + boolean matches(ResourceKey> resourceKey, List list) { + if (resourceKey != this.recipeId) { return false; } else { - List list = new ArrayList(items); + List list2 = new ArrayList(list); for (ItemPredicate itemPredicate : this.ingredients) { boolean bl = false; - Iterator iterator = list.iterator(); + Iterator iterator = list2.iterator(); while (iterator.hasNext()) { if (itemPredicate.test((ItemStack)iterator.next())) { diff --git a/net/minecraft/advancements/critereon/RecipeUnlockedTrigger.java b/net/minecraft/advancements/critereon/RecipeUnlockedTrigger.java index fe20bb84..db5857d8 100644 --- a/net/minecraft/advancements/critereon/RecipeUnlockedTrigger.java +++ b/net/minecraft/advancements/critereon/RecipeUnlockedTrigger.java @@ -5,8 +5,11 @@ import com.mojang.serialization.codecs.RecordCodecBuilder; import java.util.Optional; import net.minecraft.advancements.CriteriaTriggers; import net.minecraft.advancements.Criterion; -import net.minecraft.resources.ResourceLocation; +import net.minecraft.advancements.critereon.SimpleCriterionTrigger.SimpleInstance; +import net.minecraft.core.registries.Registries; +import net.minecraft.resources.ResourceKey; import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.item.crafting.Recipe; import net.minecraft.world.item.crafting.RecipeHolder; public class RecipeUnlockedTrigger extends SimpleCriterionTrigger { @@ -19,21 +22,21 @@ public class RecipeUnlockedTrigger extends SimpleCriterionTrigger triggerInstance.matches(recipe)); } - public static Criterion unlocked(ResourceLocation recipeId) { - return CriteriaTriggers.RECIPE_UNLOCKED.createCriterion(new RecipeUnlockedTrigger.TriggerInstance(Optional.empty(), recipeId)); + public static Criterion unlocked(ResourceKey> resourceKey) { + return CriteriaTriggers.RECIPE_UNLOCKED.createCriterion(new RecipeUnlockedTrigger.TriggerInstance(Optional.empty(), resourceKey)); } - public record TriggerInstance(Optional player, ResourceLocation recipe) implements SimpleCriterionTrigger.SimpleInstance { + public record TriggerInstance(Optional player, ResourceKey> recipe) implements SimpleInstance { public static final Codec CODEC = RecordCodecBuilder.create( instance -> instance.group( EntityPredicate.ADVANCEMENT_CODEC.optionalFieldOf("player").forGetter(RecipeUnlockedTrigger.TriggerInstance::player), - ResourceLocation.CODEC.fieldOf("recipe").forGetter(RecipeUnlockedTrigger.TriggerInstance::recipe) + ResourceKey.codec(Registries.RECIPE).fieldOf("recipe").forGetter(RecipeUnlockedTrigger.TriggerInstance::recipe) ) .apply(instance, RecipeUnlockedTrigger.TriggerInstance::new) ); public boolean matches(RecipeHolder recipe) { - return this.recipe.equals(recipe.id()); + return this.recipe == recipe.id(); } } } diff --git a/net/minecraft/advancements/critereon/SheepPredicate.java b/net/minecraft/advancements/critereon/SheepPredicate.java new file mode 100644 index 00000000..466a438c --- /dev/null +++ b/net/minecraft/advancements/critereon/SheepPredicate.java @@ -0,0 +1,39 @@ +package net.minecraft.advancements.critereon; + +import com.mojang.serialization.Codec; +import com.mojang.serialization.MapCodec; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import java.util.Optional; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.animal.Sheep; +import net.minecraft.world.item.DyeColor; +import net.minecraft.world.phys.Vec3; +import org.jetbrains.annotations.Nullable; + +public record SheepPredicate(Optional sheared, Optional color) implements EntitySubPredicate { + public static final MapCodec CODEC = RecordCodecBuilder.mapCodec( + instance -> instance.group( + Codec.BOOL.optionalFieldOf("sheared").forGetter(SheepPredicate::sheared), DyeColor.CODEC.optionalFieldOf("color").forGetter(SheepPredicate::color) + ) + .apply(instance, SheepPredicate::new) + ); + + @Override + public MapCodec codec() { + return EntitySubPredicates.SHEEP; + } + + @Override + public boolean matches(Entity entity, ServerLevel level, @Nullable Vec3 position) { + if (entity instanceof Sheep sheep) { + return this.sheared.isPresent() && sheep.isSheared() != this.sheared.get() ? false : !this.color.isPresent() || sheep.getColor() == this.color.get(); + } else { + return false; + } + } + + public static SheepPredicate hasWool(DyeColor dyeColor) { + return new SheepPredicate(Optional.of(false), Optional.of(dyeColor)); + } +} diff --git a/net/minecraft/advancements/critereon/ShotCrossbowTrigger.java b/net/minecraft/advancements/critereon/ShotCrossbowTrigger.java index c7c13ca0..2874c44f 100644 --- a/net/minecraft/advancements/critereon/ShotCrossbowTrigger.java +++ b/net/minecraft/advancements/critereon/ShotCrossbowTrigger.java @@ -5,7 +5,10 @@ import com.mojang.serialization.codecs.RecordCodecBuilder; import java.util.Optional; import net.minecraft.advancements.CriteriaTriggers; import net.minecraft.advancements.Criterion; +import net.minecraft.advancements.critereon.SimpleCriterionTrigger.SimpleInstance; +import net.minecraft.core.HolderGetter; import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.ItemLike; @@ -19,7 +22,7 @@ public class ShotCrossbowTrigger extends SimpleCriterionTrigger triggerInstance.matches(stack)); } - public record TriggerInstance(Optional player, Optional item) implements SimpleCriterionTrigger.SimpleInstance { + public record TriggerInstance(Optional player, Optional item) implements SimpleInstance { public static final Codec CODEC = RecordCodecBuilder.create( instance -> instance.group( EntityPredicate.ADVANCEMENT_CODEC.optionalFieldOf("player").forGetter(ShotCrossbowTrigger.TriggerInstance::player), @@ -32,9 +35,9 @@ public class ShotCrossbowTrigger extends SimpleCriterionTrigger shotCrossbow(ItemLike item) { + public static Criterion shotCrossbow(HolderGetter holderGetter, ItemLike itemLike) { return CriteriaTriggers.SHOT_CROSSBOW - .createCriterion(new ShotCrossbowTrigger.TriggerInstance(Optional.empty(), Optional.of(ItemPredicate.Builder.item().of(item).build()))); + .createCriterion(new ShotCrossbowTrigger.TriggerInstance(Optional.empty(), Optional.of(ItemPredicate.Builder.item().of(holderGetter, itemLike).build()))); } public boolean matches(ItemStack item) { diff --git a/net/minecraft/advancements/critereon/UsedTotemTrigger.java b/net/minecraft/advancements/critereon/UsedTotemTrigger.java index 4ce94eea..f3b03f9f 100644 --- a/net/minecraft/advancements/critereon/UsedTotemTrigger.java +++ b/net/minecraft/advancements/critereon/UsedTotemTrigger.java @@ -5,7 +5,10 @@ import com.mojang.serialization.codecs.RecordCodecBuilder; import java.util.Optional; import net.minecraft.advancements.CriteriaTriggers; import net.minecraft.advancements.Criterion; +import net.minecraft.advancements.critereon.SimpleCriterionTrigger.SimpleInstance; +import net.minecraft.core.HolderGetter; import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.ItemLike; @@ -19,7 +22,7 @@ public class UsedTotemTrigger extends SimpleCriterionTrigger triggerInstance.matches(item)); } - public record TriggerInstance(Optional player, Optional item) implements SimpleCriterionTrigger.SimpleInstance { + public record TriggerInstance(Optional player, Optional item) implements SimpleInstance { public static final Codec CODEC = RecordCodecBuilder.create( instance -> instance.group( EntityPredicate.ADVANCEMENT_CODEC.optionalFieldOf("player").forGetter(UsedTotemTrigger.TriggerInstance::player), @@ -32,9 +35,9 @@ public class UsedTotemTrigger extends SimpleCriterionTrigger usedTotem(ItemLike item) { + public static Criterion usedTotem(HolderGetter holderGetter, ItemLike itemLike) { return CriteriaTriggers.USED_TOTEM - .createCriterion(new UsedTotemTrigger.TriggerInstance(Optional.empty(), Optional.of(ItemPredicate.Builder.item().of(item).build()))); + .createCriterion(new UsedTotemTrigger.TriggerInstance(Optional.empty(), Optional.of(ItemPredicate.Builder.item().of(holderGetter, itemLike).build()))); } public boolean matches(ItemStack item) { diff --git a/net/minecraft/client/Camera.java b/net/minecraft/client/Camera.java index e1de3c12..93612f71 100644 --- a/net/minecraft/client/Camera.java +++ b/net/minecraft/client/Camera.java @@ -9,14 +9,19 @@ import net.minecraft.tags.FluidTags; import net.minecraft.util.Mth; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.vehicle.Minecart; +import net.minecraft.world.entity.vehicle.NewMinecartBehavior; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.ClipContext; +import net.minecraft.world.level.ClipContext.Block; +import net.minecraft.world.level.ClipContext.Fluid; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.material.FluidState; import net.minecraft.world.level.material.FogType; import net.minecraft.world.phys.HitResult; import net.minecraft.world.phys.Vec3; +import net.minecraft.world.phys.HitResult.Type; import org.joml.Quaternionf; import org.joml.Vector3f; @@ -49,12 +54,25 @@ public class Camera { this.entity = entity; this.detached = detached; this.partialTickTime = partialTick; - this.setRotation(entity.getViewYRot(partialTick), entity.getViewXRot(partialTick)); - this.setPosition( - Mth.lerp((double)partialTick, entity.xo, entity.getX()), - Mth.lerp((double)partialTick, entity.yo, entity.getY()) + Mth.lerp(partialTick, this.eyeHeightOld, this.eyeHeight), - Mth.lerp((double)partialTick, entity.zo, entity.getZ()) - ); + if (entity.isPassenger() + && entity.getVehicle() instanceof Minecart minecart + && minecart.getBehavior() instanceof NewMinecartBehavior newMinecartBehavior + && newMinecartBehavior.cartHasPosRotLerp()) { + Vec3 vec3 = minecart.getPassengerRidingPosition(entity) + .subtract(minecart.position()) + .subtract(entity.getVehicleAttachmentPoint(minecart)) + .add(new Vec3(0.0, Mth.lerp(partialTick, this.eyeHeightOld, this.eyeHeight), 0.0)); + this.setRotation(entity.getViewYRot(partialTick), entity.getViewXRot(partialTick)); + this.setPosition(newMinecartBehavior.getCartLerpPosition(partialTick).add(vec3)); + } else { + this.setRotation(entity.getViewYRot(partialTick), entity.getViewXRot(partialTick)); + this.setPosition( + Mth.lerp((double)partialTick, entity.xo, entity.getX()), + Mth.lerp((double)partialTick, entity.yo, entity.getY()) + Mth.lerp(partialTick, this.eyeHeightOld, this.eyeHeight), + Mth.lerp((double)partialTick, entity.zo, entity.getZ()) + ); + } + if (detached) { if (thirdPersonReverse) { this.setRotation(this.yRot + 180.0F, -this.xRot); @@ -85,8 +103,8 @@ public class Camera { float j = (i >> 2 & 1) * 2 - 1; Vec3 vec3 = this.position.add(g * 0.1F, h * 0.1F, j * 0.1F); Vec3 vec32 = vec3.add(new Vec3(this.forwards).scale(-maxZoom)); - HitResult hitResult = this.level.clip(new ClipContext(vec3, vec32, ClipContext.Block.VISUAL, ClipContext.Fluid.NONE, this.entity)); - if (hitResult.getType() != HitResult.Type.MISS) { + HitResult hitResult = this.level.clip(new ClipContext(vec3, vec32, Block.VISUAL, Fluid.NONE, this.entity)); + if (hitResult.getType() != Type.MISS) { float k = (float)hitResult.getLocation().distanceToSqr(this.position); if (k < Mth.square(maxZoom)) { maxZoom = Mth.sqrt(k); diff --git a/net/minecraft/client/ClientRecipeBook.java b/net/minecraft/client/ClientRecipeBook.java index ba3e01d5..fceec1c3 100644 --- a/net/minecraft/client/ClientRecipeBook.java +++ b/net/minecraft/client/ClientRecipeBook.java @@ -2,135 +2,112 @@ package net.minecraft.client; import com.google.common.collect.HashBasedTable; import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.Lists; -import com.google.common.collect.Maps; import com.google.common.collect.Table; import com.google.common.collect.ImmutableList.Builder; -import com.mojang.logging.LogUtils; +import java.util.ArrayList; import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.OptionalInt; +import java.util.Set; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.gui.screens.recipebook.RecipeCollection; -import net.minecraft.core.RegistryAccess; -import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.client.gui.screens.recipebook.SearchRecipeBookCategory; import net.minecraft.stats.RecipeBook; -import net.minecraft.world.item.crafting.AbstractCookingRecipe; -import net.minecraft.world.item.crafting.CookingBookCategory; -import net.minecraft.world.item.crafting.CraftingRecipe; -import net.minecraft.world.item.crafting.Recipe; -import net.minecraft.world.item.crafting.RecipeHolder; -import net.minecraft.world.item.crafting.RecipeType; -import org.slf4j.Logger; +import net.minecraft.world.item.crafting.ExtendedRecipeBookCategory; +import net.minecraft.world.item.crafting.RecipeBookCategory; +import net.minecraft.world.item.crafting.display.RecipeDisplayEntry; +import net.minecraft.world.item.crafting.display.RecipeDisplayId; @Environment(EnvType.CLIENT) public class ClientRecipeBook extends RecipeBook { - private static final Logger LOGGER = LogUtils.getLogger(); - private Map> collectionsByTab = ImmutableMap.of(); - private List allCollections = ImmutableList.of(); + private final Map known = new HashMap(); + private final Set highlight = new HashSet(); + private Map> collectionsByTab = Map.of(); + private List allCollections = List.of(); - public void setupCollections(Iterable> recipes, RegistryAccess registryAccess) { - Map>>> map = categorizeAndGroupRecipes(recipes); - Map> map2 = Maps.>newHashMap(); + public void add(RecipeDisplayEntry recipeDisplayEntry) { + this.known.put(recipeDisplayEntry.id(), recipeDisplayEntry); + } + + public void remove(RecipeDisplayId recipeDisplayId) { + this.known.remove(recipeDisplayId); + this.highlight.remove(recipeDisplayId); + } + + public void clear() { + this.known.clear(); + this.highlight.clear(); + } + + public boolean willHighlight(RecipeDisplayId recipeDisplayId) { + return this.highlight.contains(recipeDisplayId); + } + + public void removeHighlight(RecipeDisplayId recipeDisplayId) { + this.highlight.remove(recipeDisplayId); + } + + public void addHighlight(RecipeDisplayId recipeDisplayId) { + this.highlight.add(recipeDisplayId); + } + + public void rebuildCollections() { + Map>> map = categorizeAndGroupRecipes(this.known.values()); + Map> map2 = new HashMap(); Builder builder = ImmutableList.builder(); map.forEach( - (recipeBookCategories, list) -> map2.put( - recipeBookCategories, - (List)list.stream().map(listx -> new RecipeCollection(registryAccess, listx)).peek(builder::add).collect(ImmutableList.toImmutableList()) + (recipeBookCategory, list) -> map2.put( + recipeBookCategory, (List)list.stream().map(RecipeCollection::new).peek(builder::add).collect(ImmutableList.toImmutableList()) ) ); - RecipeBookCategories.AGGREGATE_CATEGORIES - .forEach( - (recipeBookCategories, list) -> map2.put( - recipeBookCategories, - (List)list.stream() - .flatMap(recipeBookCategoriesx -> ((List)map2.getOrDefault(recipeBookCategoriesx, ImmutableList.of())).stream()) - .collect(ImmutableList.toImmutableList()) - ) + + for (SearchRecipeBookCategory searchRecipeBookCategory : SearchRecipeBookCategory.values()) { + map2.put( + searchRecipeBookCategory, + (List)searchRecipeBookCategory.includedCategories() + .stream() + .flatMap(recipeBookCategory -> ((List)map2.getOrDefault(recipeBookCategory, List.of())).stream()) + .collect(ImmutableList.toImmutableList()) ); - this.collectionsByTab = ImmutableMap.copyOf(map2); + } + + this.collectionsByTab = Map.copyOf(map2); this.allCollections = builder.build(); } - private static Map>>> categorizeAndGroupRecipes(Iterable> recipes) { - Map>>> map = Maps.>>>newHashMap(); - Table>> table = HashBasedTable.create(); + private static Map>> categorizeAndGroupRecipes(Iterable recipes) { + Map>> map = new HashMap(); + Table> table = HashBasedTable.create(); - for (RecipeHolder recipeHolder : recipes) { - Recipe recipe = recipeHolder.value(); - if (!recipe.isSpecial() && !recipe.isIncomplete()) { - RecipeBookCategories recipeBookCategories = getCategory(recipeHolder); - String string = recipe.getGroup(); - if (string.isEmpty()) { - ((List)map.computeIfAbsent(recipeBookCategories, recipeBookCategoriesx -> Lists.newArrayList())).add(ImmutableList.of(recipeHolder)); - } else { - List> list = table.get(recipeBookCategories, string); - if (list == null) { - list = Lists.>newArrayList(); - table.put(recipeBookCategories, string, list); - ((List)map.computeIfAbsent(recipeBookCategories, recipeBookCategoriesx -> Lists.newArrayList())).add(list); - } - - list.add(recipeHolder); + for (RecipeDisplayEntry recipeDisplayEntry : recipes) { + RecipeBookCategory recipeBookCategory = recipeDisplayEntry.category(); + OptionalInt optionalInt = recipeDisplayEntry.group(); + if (optionalInt.isEmpty()) { + ((List)map.computeIfAbsent(recipeBookCategory, recipeBookCategoryx -> new ArrayList())).add(List.of(recipeDisplayEntry)); + } else { + List list = table.get(recipeBookCategory, optionalInt.getAsInt()); + if (list == null) { + list = new ArrayList(); + table.put(recipeBookCategory, optionalInt.getAsInt(), list); + ((List)map.computeIfAbsent(recipeBookCategory, recipeBookCategoryx -> new ArrayList())).add(list); } + + list.add(recipeDisplayEntry); } } return map; } - private static RecipeBookCategories getCategory(RecipeHolder recipe) { - Recipe recipe2 = recipe.value(); - if (recipe2 instanceof CraftingRecipe craftingRecipe) { - return switch (craftingRecipe.category()) { - case BUILDING -> RecipeBookCategories.CRAFTING_BUILDING_BLOCKS; - case EQUIPMENT -> RecipeBookCategories.CRAFTING_EQUIPMENT; - case REDSTONE -> RecipeBookCategories.CRAFTING_REDSTONE; - case MISC -> RecipeBookCategories.CRAFTING_MISC; - }; - } else { - RecipeType recipeType = recipe2.getType(); - if (recipe2 instanceof AbstractCookingRecipe abstractCookingRecipe) { - CookingBookCategory cookingBookCategory = abstractCookingRecipe.category(); - if (recipeType == RecipeType.SMELTING) { - return switch (cookingBookCategory) { - case BLOCKS -> RecipeBookCategories.FURNACE_BLOCKS; - case FOOD -> RecipeBookCategories.FURNACE_FOOD; - case MISC -> RecipeBookCategories.FURNACE_MISC; - }; - } - - if (recipeType == RecipeType.BLASTING) { - return cookingBookCategory == CookingBookCategory.BLOCKS ? RecipeBookCategories.BLAST_FURNACE_BLOCKS : RecipeBookCategories.BLAST_FURNACE_MISC; - } - - if (recipeType == RecipeType.SMOKING) { - return RecipeBookCategories.SMOKER_FOOD; - } - - if (recipeType == RecipeType.CAMPFIRE_COOKING) { - return RecipeBookCategories.CAMPFIRE; - } - } - - if (recipeType == RecipeType.STONECUTTING) { - return RecipeBookCategories.STONECUTTER; - } else if (recipeType == RecipeType.SMITHING) { - return RecipeBookCategories.SMITHING; - } else { - LOGGER.warn("Unknown recipe category: {}/{}", LogUtils.defer(() -> BuiltInRegistries.RECIPE_TYPE.getKey(recipe2.getType())), LogUtils.defer(recipe::id)); - return RecipeBookCategories.UNKNOWN; - } - } - } - public List getCollections() { return this.allCollections; } - public List getCollection(RecipeBookCategories categories) { - return (List)this.collectionsByTab.getOrDefault(categories, Collections.emptyList()); + public List getCollection(ExtendedRecipeBookCategory extendedRecipeBookCategory) { + return (List)this.collectionsByTab.getOrDefault(extendedRecipeBookCategory, Collections.emptyList()); } } diff --git a/net/minecraft/client/GameNarrator.java b/net/minecraft/client/GameNarrator.java index 053e3ebe..483b2c29 100644 --- a/net/minecraft/client/GameNarrator.java +++ b/net/minecraft/client/GameNarrator.java @@ -6,7 +6,7 @@ import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.SharedConstants; import net.minecraft.client.gui.components.toasts.SystemToast; -import net.minecraft.client.gui.components.toasts.ToastComponent; +import net.minecraft.client.gui.components.toasts.ToastManager; import net.minecraft.client.main.SilentInitException; import net.minecraft.network.chat.CommonComponents; import net.minecraft.network.chat.Component; @@ -67,16 +67,16 @@ public class GameNarrator { public void updateNarratorStatus(NarratorStatus status) { this.clear(); this.narrator.say(Component.translatable("options.narrator").append(" : ").append(status.getName()).getString(), true); - ToastComponent toastComponent = Minecraft.getInstance().getToasts(); + ToastManager toastManager = Minecraft.getInstance().getToastManager(); if (this.narrator.active()) { if (status == NarratorStatus.OFF) { - SystemToast.addOrUpdate(toastComponent, SystemToast.SystemToastId.NARRATOR_TOGGLE, Component.translatable("narrator.toast.disabled"), null); + SystemToast.addOrUpdate(toastManager, SystemToast.SystemToastId.NARRATOR_TOGGLE, Component.translatable("narrator.toast.disabled"), null); } else { - SystemToast.addOrUpdate(toastComponent, SystemToast.SystemToastId.NARRATOR_TOGGLE, Component.translatable("narrator.toast.enabled"), status.getName()); + SystemToast.addOrUpdate(toastManager, SystemToast.SystemToastId.NARRATOR_TOGGLE, Component.translatable("narrator.toast.enabled"), status.getName()); } } else { SystemToast.addOrUpdate( - toastComponent, + toastManager, SystemToast.SystemToastId.NARRATOR_TOGGLE, Component.translatable("narrator.toast.disabled"), Component.translatable("options.narrator.notavailable") diff --git a/net/minecraft/client/GuiMessageTag.java b/net/minecraft/client/GuiMessageTag.java index b61b887b..fa387420 100644 --- a/net/minecraft/client/GuiMessageTag.java +++ b/net/minecraft/client/GuiMessageTag.java @@ -4,6 +4,7 @@ import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.ChatFormatting; import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.renderer.RenderType; import net.minecraft.network.chat.CommonComponents; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; @@ -60,7 +61,7 @@ public record GuiMessageTag(int indicatorColor, @Nullable GuiMessageTag.Icon ico } public void draw(GuiGraphics guiGraphics, int x, int y) { - guiGraphics.blitSprite(this.sprite, x, y, this.width, this.height); + guiGraphics.blitSprite(RenderType::guiTextured, this.sprite, x, y, this.width, this.height); } } } diff --git a/net/minecraft/client/InactivityFpsLimit.java b/net/minecraft/client/InactivityFpsLimit.java new file mode 100644 index 00000000..294a571f --- /dev/null +++ b/net/minecraft/client/InactivityFpsLimit.java @@ -0,0 +1,39 @@ +package net.minecraft.client; + +import com.mojang.serialization.Codec; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.util.OptionEnum; +import net.minecraft.util.StringRepresentable; + +@Environment(EnvType.CLIENT) +public enum InactivityFpsLimit implements OptionEnum, StringRepresentable { + MINIMIZED(0, "minimized", "options.inactivityFpsLimit.minimized"), + AFK(1, "afk", "options.inactivityFpsLimit.afk"); + + public static final Codec CODEC = StringRepresentable.fromEnum(InactivityFpsLimit::values); + private final int id; + private final String serializedName; + private final String key; + + private InactivityFpsLimit(final int j, final String string2, final String string3) { + this.id = j; + this.serializedName = string2; + this.key = string3; + } + + @Override + public int getId() { + return this.id; + } + + @Override + public String getKey() { + return this.key; + } + + @Override + public String getSerializedName() { + return this.serializedName; + } +} diff --git a/net/minecraft/client/KeyboardHandler.java b/net/minecraft/client/KeyboardHandler.java index 5ea5b40b..b90a48b1 100644 --- a/net/minecraft/client/KeyboardHandler.java +++ b/net/minecraft/client/KeyboardHandler.java @@ -5,6 +5,7 @@ import com.mojang.blaze3d.Blaze3D; import com.mojang.blaze3d.platform.ClipboardManager; import com.mojang.blaze3d.platform.InputConstants; import com.mojang.blaze3d.platform.TextureUtil; +import com.mojang.blaze3d.platform.InputConstants.Key; import java.nio.file.Path; import java.text.MessageFormat; import java.util.Locale; @@ -17,13 +18,13 @@ import net.minecraft.ReportedException; import net.minecraft.Util; import net.minecraft.client.gui.components.ChatComponent; import net.minecraft.client.gui.components.EditBox; -import net.minecraft.client.gui.components.events.GuiEventListener; import net.minecraft.client.gui.screens.PauseScreen; import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.gui.screens.debug.GameModeSwitcherScreen; import net.minecraft.client.gui.screens.options.controls.KeyBindsScreen; import net.minecraft.client.multiplayer.ClientPacketListener; import net.minecraft.client.player.LocalPlayer; +import net.minecraft.client.renderer.FogRenderer; import net.minecraft.commands.arguments.blocks.BlockStateParser; import net.minecraft.core.BlockPos; import net.minecraft.core.registries.BuiltInRegistries; @@ -66,10 +67,32 @@ public class KeyboardHandler { this.minecraft.sectionPath = !this.minecraft.sectionPath; this.debugFeedback("SectionPath: {0}", this.minecraft.sectionPath ? "shown" : "hidden"); return true; + case 70: + boolean bl2 = FogRenderer.toggleFog(); + this.debugFeedback("Fog: {0}", bl2 ? "enabled" : "disabled"); + return true; + case 71: + case 72: + case 73: + case 74: + case 75: + case 77: + case 78: + case 80: + case 81: + case 82: + case 83: + case 84: + default: + return false; case 76: this.minecraft.smartCull = !this.minecraft.smartCull; this.debugFeedback("SmartCull: {0}", this.minecraft.smartCull ? "enabled" : "disabled"); return true; + case 79: + boolean bl = this.minecraft.debugRenderer.toggleRenderOctree(); + this.debugFeedback("Frustum culling Octree: {0}", bl ? "enabled" : "disabled"); + return true; case 85: if (Screen.hasShiftDown()) { this.minecraft.levelRenderer.killFrustum(); @@ -88,8 +111,6 @@ public class KeyboardHandler { this.minecraft.wireframe = !this.minecraft.wireframe; this.debugFeedback("WireFrame: {0}", this.minecraft.wireframe ? "enabled" : "disabled"); return true; - default: - return false; } } @@ -330,6 +351,7 @@ public class KeyboardHandler { public void keyPress(long windowPointer, int key, int scanCode, int action, int modifiers) { if (windowPointer == this.minecraft.getWindow().getWindow()) { + this.minecraft.getFramerateLimitTracker().onInputReceived(); boolean bl = InputConstants.isKeyDown(Minecraft.getInstance().getWindow().getWindow(), 292); if (this.debugCrashKeyTime > 0L) { if (!InputConstants.isKeyDown(Minecraft.getInstance().getWindow().getWindow(), 67) || !bl) { @@ -397,21 +419,29 @@ public class KeyboardHandler { } if (screen != null) { - boolean[] bls = new boolean[]{false}; - Screen.wrapScreenError(() -> { - if (action == 1 || action == 2) { + try { + if (action != 1 && action != 2) { + if (action == 0 && screen.keyReleased(key, scanCode, modifiers)) { + return; + } + } else { screen.afterKeyboardAction(); - bls[0] = screen.keyPressed(key, scanCode, modifiers); - } else if (action == 0) { - bls[0] = screen.keyReleased(key, scanCode, modifiers); + if (screen.keyPressed(key, scanCode, modifiers)) { + return; + } } - }, "keyPressed event handler", screen.getClass().getCanonicalName()); - if (bls[0]) { - return; + } catch (Throwable var14) { + CrashReport crashReport = CrashReport.forThrowable(var14, "keyPressed event handler"); + screen.fillCrashDetails(crashReport); + CrashReportCategory crashReportCategory = crashReport.addCategory("Key"); + crashReportCategory.setDetail("Key", key); + crashReportCategory.setDetail("Scancode", scanCode); + crashReportCategory.setDetail("Mods", modifiers); + throw new ReportedException(crashReport); } } - InputConstants.Key key2 = InputConstants.getKey(key, scanCode); + Key key2 = InputConstants.getKey(key, scanCode); boolean bl3 = this.minecraft.screen == null; boolean bl4 = bl3 || this.minecraft.screen instanceof PauseScreen pauseScreen && !pauseScreen.showsPauseMenu(); if (action == 0) { @@ -442,7 +472,7 @@ public class KeyboardHandler { } if (this.minecraft.getDebugOverlay().showProfilerChart() && !bl && key >= 48 && key <= 57) { - this.minecraft.debugFpsMeterKeyPress(key - 48); + this.minecraft.getDebugOverlay().getProfilerPieChart().profilerPieChartKeyPress(key - 48); } } @@ -460,16 +490,22 @@ public class KeyboardHandler { private void charTyped(long windowPointer, int codePoint, int modifiers) { if (windowPointer == this.minecraft.getWindow().getWindow()) { - GuiEventListener guiEventListener = this.minecraft.screen; - if (guiEventListener != null && this.minecraft.getOverlay() == null) { - if (Character.charCount(codePoint) == 1) { - Screen.wrapScreenError( - () -> guiEventListener.charTyped((char)codePoint, modifiers), "charTyped event handler", guiEventListener.getClass().getCanonicalName() - ); - } else { - for (char c : Character.toChars(codePoint)) { - Screen.wrapScreenError(() -> guiEventListener.charTyped(c, modifiers), "charTyped event handler", guiEventListener.getClass().getCanonicalName()); + Screen screen = this.minecraft.screen; + if (screen != null && this.minecraft.getOverlay() == null) { + try { + if (Character.isBmpCodePoint(codePoint)) { + screen.charTyped((char)codePoint, modifiers); + } else if (Character.isValidCodePoint(codePoint)) { + screen.charTyped(Character.highSurrogate(codePoint), modifiers); + screen.charTyped(Character.lowSurrogate(codePoint), modifiers); } + } catch (Throwable var9) { + CrashReport crashReport = CrashReport.forThrowable(var9, "charTyped event handler"); + screen.fillCrashDetails(crashReport); + CrashReportCategory crashReportCategory = crashReport.addCategory("Key"); + crashReportCategory.setDetail("Codepoint", codePoint); + crashReportCategory.setDetail("Mods", modifiers); + throw new ReportedException(crashReport); } } } diff --git a/net/minecraft/client/Minecraft.java b/net/minecraft/client/Minecraft.java index 63fe4699..2d6ef240 100644 --- a/net/minecraft/client/Minecraft.java +++ b/net/minecraft/client/Minecraft.java @@ -14,10 +14,12 @@ import com.mojang.authlib.yggdrasil.ProfileActionType; import com.mojang.authlib.yggdrasil.ProfileResult; import com.mojang.authlib.yggdrasil.ServicesKeyType; import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService; +import com.mojang.blaze3d.TracyFrameCapture; import com.mojang.blaze3d.pipeline.MainTarget; import com.mojang.blaze3d.pipeline.RenderTarget; -import com.mojang.blaze3d.pipeline.TextureTarget; +import com.mojang.blaze3d.platform.ClientShutdownWatchdog; import com.mojang.blaze3d.platform.DisplayData; +import com.mojang.blaze3d.platform.FramerateLimitTracker; import com.mojang.blaze3d.platform.GlDebug; import com.mojang.blaze3d.platform.GlUtil; import com.mojang.blaze3d.platform.IconSet; @@ -25,14 +27,12 @@ import com.mojang.blaze3d.platform.Window; import com.mojang.blaze3d.platform.WindowEventHandler; import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.systems.TimerQuery; -import com.mojang.blaze3d.vertex.BufferBuilder; +import com.mojang.blaze3d.systems.TimerQuery.FrameProfile; import com.mojang.blaze3d.vertex.BufferUploader; -import com.mojang.blaze3d.vertex.DefaultVertexFormat; -import com.mojang.blaze3d.vertex.MeshData; import com.mojang.blaze3d.vertex.Tesselator; -import com.mojang.blaze3d.vertex.VertexFormat; -import com.mojang.blaze3d.vertex.VertexSorting; import com.mojang.datafixers.DataFixer; +import com.mojang.jtracy.DiscontinuousFrame; +import com.mojang.jtracy.TracyClient; import com.mojang.logging.LogUtils; import com.mojang.realmsclient.client.RealmsClient; import com.mojang.realmsclient.gui.RealmsDataFetcher; @@ -45,8 +45,6 @@ import java.net.SocketAddress; import java.nio.ByteBuffer; import java.nio.file.Path; import java.nio.file.Paths; -import java.text.DecimalFormat; -import java.text.DecimalFormatSymbols; import java.time.Duration; import java.time.Instant; import java.util.ArrayList; @@ -75,15 +73,18 @@ import net.minecraft.ReportedException; import net.minecraft.SharedConstants; import net.minecraft.SystemReport; import net.minecraft.Util; +import net.minecraft.client.DeltaTracker.Timer; +import net.minecraft.client.ResourceLoadStateTracker.ReloadReason; +import net.minecraft.client.User.Type; import net.minecraft.client.color.block.BlockColors; import net.minecraft.client.color.item.ItemColors; import net.minecraft.client.gui.Font; import net.minecraft.client.gui.Gui; -import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.GuiSpriteManager; import net.minecraft.client.gui.components.DebugScreenOverlay; +import net.minecraft.client.gui.components.debugchart.ProfilerPieChart; import net.minecraft.client.gui.components.toasts.SystemToast; -import net.minecraft.client.gui.components.toasts.ToastComponent; +import net.minecraft.client.gui.components.toasts.ToastManager; import net.minecraft.client.gui.components.toasts.TutorialToast; import net.minecraft.client.gui.font.FontManager; import net.minecraft.client.gui.font.providers.FreeTypeUtil; @@ -128,11 +129,13 @@ import net.minecraft.client.profiling.ClientMetricsSamplersProvider; import net.minecraft.client.quickplay.QuickPlay; import net.minecraft.client.quickplay.QuickPlayLog; import net.minecraft.client.renderer.BlockEntityWithoutLevelRenderer; -import net.minecraft.client.renderer.FogRenderer; +import net.minecraft.client.renderer.FogParameters; import net.minecraft.client.renderer.GameRenderer; import net.minecraft.client.renderer.GpuWarnlistManager; import net.minecraft.client.renderer.LevelRenderer; +import net.minecraft.client.renderer.MapRenderer; import net.minecraft.client.renderer.RenderBuffers; +import net.minecraft.client.renderer.ShaderManager; import net.minecraft.client.renderer.VirtualScreen; import net.minecraft.client.renderer.block.BlockModelShaper; import net.minecraft.client.renderer.block.BlockRenderDispatcher; @@ -148,6 +151,7 @@ import net.minecraft.client.resources.ClientPackSource; import net.minecraft.client.resources.FoliageColorReloadListener; import net.minecraft.client.resources.GrassColorReloadListener; import net.minecraft.client.resources.MapDecorationTextureManager; +import net.minecraft.client.resources.MapTextureManager; import net.minecraft.client.resources.MobEffectTextureManager; import net.minecraft.client.resources.PaintingTextureManager; import net.minecraft.client.resources.SkinManager; @@ -155,6 +159,7 @@ import net.minecraft.client.resources.SplashManager; import net.minecraft.client.resources.language.I18n; import net.minecraft.client.resources.language.LanguageManager; import net.minecraft.client.resources.model.BakedModel; +import net.minecraft.client.resources.model.EquipmentModelSet; import net.minecraft.client.resources.model.ModelManager; import net.minecraft.client.resources.server.DownloadedPackSource; import net.minecraft.client.server.IntegratedServer; @@ -176,7 +181,9 @@ import net.minecraft.network.chat.CommonComponents; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.MutableComponent; import net.minecraft.network.chat.contents.KeybindResolver; +import net.minecraft.network.protocol.game.ServerboundClientTickEndPacket; import net.minecraft.network.protocol.game.ServerboundPlayerActionPacket; +import net.minecraft.network.protocol.game.ServerboundPlayerActionPacket.Action; import net.minecraft.network.protocol.login.ServerboundHelloPacket; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.Bootstrap; @@ -200,11 +207,9 @@ import net.minecraft.sounds.Music; import net.minecraft.sounds.Musics; import net.minecraft.tags.BiomeTags; import net.minecraft.util.CommonLinks; -import net.minecraft.util.FastColor; import net.minecraft.util.FileZipper; import net.minecraft.util.MemoryReserve; import net.minecraft.util.ModCheck; -import net.minecraft.util.Mth; import net.minecraft.util.SignatureValidator; import net.minecraft.util.TimeUtil; import net.minecraft.util.Unit; @@ -213,9 +218,10 @@ import net.minecraft.util.profiling.ContinuousProfiler; import net.minecraft.util.profiling.EmptyProfileResults; import net.minecraft.util.profiling.InactiveProfiler; import net.minecraft.util.profiling.ProfileResults; +import net.minecraft.util.profiling.Profiler; import net.minecraft.util.profiling.ProfilerFiller; -import net.minecraft.util.profiling.ResultField; import net.minecraft.util.profiling.SingleTickProfiler; +import net.minecraft.util.profiling.Zone; import net.minecraft.util.profiling.metrics.profiling.ActiveMetricsRecorder; import net.minecraft.util.profiling.metrics.profiling.InactiveMetricsRecorder; import net.minecraft.util.profiling.metrics.profiling.MetricsRecorder; @@ -245,8 +251,6 @@ import net.minecraft.world.phys.EntityHitResult; import net.minecraft.world.phys.HitResult; import org.apache.commons.io.FileUtils; import org.jetbrains.annotations.Nullable; -import org.joml.Matrix4f; -import org.joml.Matrix4fStack; import org.lwjgl.util.tinyfd.TinyFileDialogs; import org.slf4j.Logger; @@ -267,14 +271,16 @@ public class Minecraft extends ReentrantBlockableEventLoop implements private final Path resourcePackDirectory; private final CompletableFuture profileFuture; private final TextureManager textureManager; + private final ShaderManager shaderManager; private final DataFixer fixerUpper; private final VirtualScreen virtualScreen; private final Window window; - private final DeltaTracker.Timer timer = new DeltaTracker.Timer(20.0F, 0L, this::getTickTargetMillis); + private final Timer deltaTracker = new Timer(20.0F, 0L, this::getTickTargetMillis); private final RenderBuffers renderBuffers; public final LevelRenderer levelRenderer; private final EntityRenderDispatcher entityRenderDispatcher; private final ItemRenderer itemRenderer; + private final MapRenderer mapRenderer; public final ParticleEngine particleEngine; private final User user; public final Font font; @@ -304,6 +310,8 @@ public class Minecraft extends ReentrantBlockableEventLoop implements private final BlockColors blockColors; private final ItemColors itemColors; private final RenderTarget mainRenderTarget; + @Nullable + private final TracyFrameCapture tracyFrameCapture; private final SoundManager soundManager; private final MusicManager musicManager; private final FontManager fontManager; @@ -320,11 +328,13 @@ public class Minecraft extends ReentrantBlockableEventLoop implements * The BlockRenderDispatcher instance that will be used based off gamesettings */ private final BlockRenderDispatcher blockRenderer; + private final EquipmentModelSet equipmentModels; private final PaintingTextureManager paintingTextures; private final MobEffectTextureManager mobEffectTextures; + private final MapTextureManager mapTextureManager; private final MapDecorationTextureManager mapDecorationTextures; private final GuiSpriteManager guiSprites; - private final ToastComponent toast; + private final ToastManager toastManager; private final Tutorial tutorial; private final PlayerSocialManager playerSocialManager; private final EntityModelSet entityModels; @@ -365,13 +375,14 @@ public class Minecraft extends ReentrantBlockableEventLoop implements @Nullable private Overlay overlay; private boolean clientLevelTeardownInProgress; - private Thread gameThread; + Thread gameThread; private volatile boolean running; @Nullable private Supplier delayedCrash; private static int fps; public String fpsString = ""; private long frameTimeNs; + private final FramerateLimitTracker framerateLimitTracker; public boolean wireframe; public boolean sectionPath; public boolean sectionVisibility; @@ -382,17 +393,14 @@ public class Minecraft extends ReentrantBlockableEventLoop implements private CompletableFuture pendingReload; @Nullable private TutorialToast socialInteractionsToast; - private ProfilerFiller profiler = InactiveProfiler.INSTANCE; private int fpsPieRenderTicks; private final ContinuousProfiler fpsPieProfiler = new ContinuousProfiler(Util.timeSource, () -> this.fpsPieRenderTicks); - @Nullable - private ProfileResults fpsPieResults; private MetricsRecorder metricsRecorder = InactiveMetricsRecorder.INSTANCE; private final ResourceLoadStateTracker reloadStateTracker = new ResourceLoadStateTracker(); private long savedCpuDuration; private double gpuUtilization; @Nullable - private TimerQuery.FrameProfile currentFrameProfile; + private FrameProfile currentFrameProfile; private final GameNarrator narrator; private final ChatListener chatListener; private ReportingContext reportingContext; @@ -401,7 +409,6 @@ public class Minecraft extends ReentrantBlockableEventLoop implements private boolean gameLoadFinished; private final long clientStartTimeMs; private long clientTickCount; - private String debugPath = "root"; public Minecraft(GameConfig gameConfig) { super("Client"); @@ -443,7 +450,7 @@ public class Minecraft extends ReentrantBlockableEventLoop implements this.singleplayerServer = null; KeybindResolver.setKeyResolver(KeyMapping::createNameSupplier); this.fixerUpper = DataFixers.getDataFixer(); - this.toast = new ToastComponent(this); + this.toastManager = new ToastManager(this); this.gameThread = Thread.currentThread(); this.options = new Options(this, this.gameDirectory); RenderSystem.setShaderGlintAlpha(this.options.glintStrength().get()); @@ -468,6 +475,16 @@ public class Minecraft extends ReentrantBlockableEventLoop implements this.virtualScreen = new VirtualScreen(this); this.window = this.virtualScreen.newWindow(displayData, this.options.fullscreenVideoModeString, this.createTitle()); this.setWindowActive(true); + this.window.setWindowCloseCallback(new Runnable() { + private boolean threadStarted; + + public void run() { + if (!this.threadStarted) { + this.threadStarted = true; + ClientShutdownWatchdog.startShutdownWatchdog(gameConfig.location.gameDirectory, Minecraft.this.gameThread.threadId()); + } + } + }); GameLoadTimesEvent.INSTANCE.endStep(TelemetryProperty.LOAD_TIME_PRE_WINDOW_MS); try { @@ -476,7 +493,6 @@ public class Minecraft extends ReentrantBlockableEventLoop implements LOGGER.error("Couldn't set icon", (Throwable)var13); } - this.window.setFramerateLimit(this.options.framerateLimit().get()); this.mouseHandler = new MouseHandler(this); this.mouseHandler.setup(this.window.getWindow()); this.keyboardHandler = new KeyboardHandler(this); @@ -484,7 +500,7 @@ public class Minecraft extends ReentrantBlockableEventLoop implements RenderSystem.initRenderer(this.options.glDebugVerbosity, false); this.mainRenderTarget = new MainTarget(this.window.getWidth(), this.window.getHeight()); this.mainRenderTarget.setClearColor(0.0F, 0.0F, 0.0F, 0.0F); - this.mainRenderTarget.clear(ON_OSX); + this.mainRenderTarget.clear(); this.resourceManager = new ReloadableResourceManager(PackType.CLIENT_RESOURCES); this.resourcePackRepository.reload(); this.options.loadSelectedResourcePacks(this.resourcePackRepository); @@ -496,6 +512,8 @@ public class Minecraft extends ReentrantBlockableEventLoop implements this.resourceManager.registerReloadListener(this.languageManager); this.textureManager = new TextureManager(this.resourceManager); this.resourceManager.registerReloadListener(this.textureManager); + this.shaderManager = new ShaderManager(this.textureManager, this::triggerResourcePackRecovery); + this.resourceManager.registerReloadListener(this.shaderManager); this.skinManager = new SkinManager(this.textureManager, file.toPath().resolve("skins"), this.minecraftSessionService, this); this.levelSource = new LevelStorageSource(path.resolve("saves"), path.resolve("backups"), this.directoryValidator, this.fixerUpper); this.commandHistory = new CommandHistory(path); @@ -520,14 +538,20 @@ public class Minecraft extends ReentrantBlockableEventLoop implements this.resourceManager.registerReloadListener(this.modelManager); this.entityModels = new EntityModelSet(); this.resourceManager.registerReloadListener(this.entityModels); + this.equipmentModels = new EquipmentModelSet(); + this.resourceManager.registerReloadListener(this.equipmentModels); this.blockEntityRenderDispatcher = new BlockEntityRenderDispatcher( this.font, this.entityModels, this::getBlockRenderer, this::getItemRenderer, this::getEntityRenderDispatcher ); this.resourceManager.registerReloadListener(this.blockEntityRenderDispatcher); BlockEntityWithoutLevelRenderer blockEntityWithoutLevelRenderer = new BlockEntityWithoutLevelRenderer(this.blockEntityRenderDispatcher, this.entityModels); this.resourceManager.registerReloadListener(blockEntityWithoutLevelRenderer); - this.itemRenderer = new ItemRenderer(this, this.textureManager, this.modelManager, this.itemColors, blockEntityWithoutLevelRenderer); + this.itemRenderer = new ItemRenderer(this.modelManager, this.itemColors, blockEntityWithoutLevelRenderer); this.resourceManager.registerReloadListener(this.itemRenderer); + this.mapTextureManager = new MapTextureManager(this.textureManager); + this.mapDecorationTextures = new MapDecorationTextureManager(this.textureManager); + this.resourceManager.registerReloadListener(this.mapDecorationTextures); + this.mapRenderer = new MapRenderer(this.mapDecorationTextures, this.mapTextureManager); try { int i = Runtime.getRuntime().availableProcessors(); @@ -549,7 +573,7 @@ public class Minecraft extends ReentrantBlockableEventLoop implements this.blockRenderer = new BlockRenderDispatcher(this.modelManager.getBlockModelShaper(), blockEntityWithoutLevelRenderer, this.blockColors); this.resourceManager.registerReloadListener(this.blockRenderer); this.entityRenderDispatcher = new EntityRenderDispatcher( - this, this.textureManager, this.itemRenderer, this.blockRenderer, this.font, this.options, this.entityModels + this, this.textureManager, this.itemRenderer, this.mapRenderer, this.blockRenderer, this.font, this.options, this.entityModels, this.equipmentModels ); this.resourceManager.registerReloadListener(this.entityRenderDispatcher); this.particleEngine = new ParticleEngine(this.level, this.textureManager); @@ -558,14 +582,12 @@ public class Minecraft extends ReentrantBlockableEventLoop implements this.resourceManager.registerReloadListener(this.paintingTextures); this.mobEffectTextures = new MobEffectTextureManager(this.textureManager); this.resourceManager.registerReloadListener(this.mobEffectTextures); - this.mapDecorationTextures = new MapDecorationTextureManager(this.textureManager); - this.resourceManager.registerReloadListener(this.mapDecorationTextures); this.guiSprites = new GuiSpriteManager(this.textureManager); this.resourceManager.registerReloadListener(this.guiSprites); this.gameRenderer = new GameRenderer(this, this.entityRenderDispatcher.getItemInHandRenderer(), this.resourceManager, this.renderBuffers); - this.resourceManager.registerReloadListener(this.gameRenderer.createReloadListener()); this.levelRenderer = new LevelRenderer(this, this.entityRenderDispatcher, this.blockEntityRenderDispatcher, this.renderBuffers); this.resourceManager.registerReloadListener(this.levelRenderer); + this.resourceManager.registerReloadListener(this.levelRenderer.getCloudRenderer()); this.gpuWarnlistManager = new GpuWarnlistManager(); this.resourceManager.registerReloadListener(this.gpuWarnlistManager); this.resourceManager.registerReloadListener(this.regionalCompliancies); @@ -608,8 +630,9 @@ public class Minecraft extends ReentrantBlockableEventLoop implements LoadingOverlay.registerTextures(this); this.setScreen(new GenericMessageScreen(Component.translatable("gui.loadingMinecraft"))); List list = this.resourcePackRepository.openAllSelected(); - this.reloadStateTracker.startReload(ResourceLoadStateTracker.ReloadReason.INITIAL, list); - ReloadInstance reloadInstance = this.resourceManager.createReload(Util.backgroundExecutor(), this, RESOURCE_RELOAD_INITIAL_TASK, list); + this.reloadStateTracker.startReload(ReloadReason.INITIAL, list); + ReloadInstance reloadInstance = this.resourceManager + .createReload(Util.backgroundExecutor().forName("resourceLoad"), this, RESOURCE_RELOAD_INITIAL_TASK, list); GameLoadTimesEvent.INSTANCE.beginStep(TelemetryProperty.LOAD_TIME_LOADING_OVERLAY_MS); Minecraft.GameLoadCookie gameLoadCookie = new Minecraft.GameLoadCookie(realmsClient, gameConfig.quickPlay); this.setOverlay( @@ -623,6 +646,12 @@ public class Minecraft extends ReentrantBlockableEventLoop implements }), false) ); this.quickPlayLog = QuickPlayLog.of(gameConfig.quickPlay.path()); + this.framerateLimitTracker = new FramerateLimitTracker(this.options, this); + if (TracyClient.isAvailable() && gameConfig.game.captureTracyImages) { + this.tracyFrameCapture = new TracyFrameCapture(); + } else { + this.tracyFrameCapture = null; + } } private void onResourceLoadFinished(@Nullable Minecraft.GameLoadCookie gameLoadCookie) { @@ -732,7 +761,7 @@ public class Minecraft extends ReentrantBlockableEventLoop implements } private UserApiService createUserApiService(YggdrasilAuthenticationService authenticationService, GameConfig gameConfig) { - return gameConfig.user.user.getType() != User.Type.MSA + return gameConfig.user.user.getType() != Type.MSA ? UserApiService.OFFLINE : authenticationService.createUserApiService(gameConfig.user.user.getAccessToken()); } @@ -772,8 +801,21 @@ public class Minecraft extends ReentrantBlockableEventLoop implements } private void addResourcePackLoadFailToast(@Nullable Component message) { - ToastComponent toastComponent = this.getToasts(); - SystemToast.addOrUpdate(toastComponent, SystemToast.SystemToastId.PACK_LOAD_FAILURE, Component.translatable("resourcePack.load_fail"), message); + ToastManager toastManager = this.getToastManager(); + SystemToast.addOrUpdate(toastManager, SystemToast.SystemToastId.PACK_LOAD_FAILURE, Component.translatable("resourcePack.load_fail"), message); + } + + public void triggerResourcePackRecovery(Exception exception) { + if (!this.resourcePackRepository.isAbleToClearAnyPack()) { + if (this.resourcePackRepository.getSelectedIds().size() <= 1) { + LOGGER.error(LogUtils.FATAL_MARKER, exception.getMessage(), (Throwable)exception); + this.emergencySaveAndCrash(new CrashReport(exception.getMessage(), exception)); + } else { + this.schedule(this::abortResourcePackRecovery); + } + } else { + this.clearResourcePacksOnError(exception, Component.translatable("resourcePack.runtime_failure"), null); + } } public void run() { @@ -782,6 +824,8 @@ public class Minecraft extends ReentrantBlockableEventLoop implements this.gameThread.setPriority(10); } + DiscontinuousFrame discontinuousFrame = TracyClient.createDiscontinuousFrame("Client Tick"); + try { boolean bl = false; @@ -791,31 +835,34 @@ public class Minecraft extends ReentrantBlockableEventLoop implements try { SingleTickProfiler singleTickProfiler = SingleTickProfiler.createTickProfiler("Renderer"); boolean bl2 = this.getDebugOverlay().showProfilerChart(); - this.profiler = this.constructProfiler(bl2, singleTickProfiler); - this.profiler.startTick(); - this.metricsRecorder.startTick(); - this.runTick(!bl); - this.metricsRecorder.endTick(); - this.profiler.endTick(); + + try (Profiler.Scope scope = Profiler.use(this.constructProfiler(bl2, singleTickProfiler))) { + this.metricsRecorder.startTick(); + discontinuousFrame.start(); + this.runTick(!bl); + discontinuousFrame.end(); + this.metricsRecorder.endTick(); + } + this.finishProfilers(bl2, singleTickProfiler); - } catch (OutOfMemoryError var4) { + } catch (OutOfMemoryError var10) { if (bl) { - throw var4; + throw var10; } this.emergencySave(); this.setScreen(new OutOfMemoryScreen()); System.gc(); - LOGGER.error(LogUtils.FATAL_MARKER, "Out of memory", (Throwable)var4); + LOGGER.error(LogUtils.FATAL_MARKER, "Out of memory", (Throwable)var10); bl = true; } } - } catch (ReportedException var5) { - LOGGER.error(LogUtils.FATAL_MARKER, "Reported exception thrown!", (Throwable)var5); - this.emergencySaveAndCrash(var5.getReport()); - } catch (Throwable var6) { - LOGGER.error(LogUtils.FATAL_MARKER, "Unreported exception thrown!", var6); - this.emergencySaveAndCrash(new CrashReport("Unexpected error", var6)); + } catch (ReportedException var11) { + LOGGER.error(LogUtils.FATAL_MARKER, "Reported exception thrown!", (Throwable)var11); + this.emergencySaveAndCrash(var11.getReport()); + } catch (Throwable var12) { + LOGGER.error(LogUtils.FATAL_MARKER, "Unreported exception thrown!", var12); + this.emergencySaveAndCrash(new CrashReport("Unexpected error", var12)); } } @@ -861,29 +908,35 @@ public class Minecraft extends ReentrantBlockableEventLoop implements } public void emergencySaveAndCrash(CrashReport crashReport) { + MemoryReserve.release(); CrashReport crashReport2 = this.fillReport(crashReport); this.emergencySave(); crash(this, this.gameDirectory, crashReport2); } - public static void crash(@Nullable Minecraft minecraft, File gameDirectory, CrashReport crashReport) { - Path path = gameDirectory.toPath().resolve("crash-reports"); + public static int saveReport(File file, CrashReport crashReport) { + Path path = file.toPath().resolve("crash-reports"); Path path2 = path.resolve("crash-" + Util.getFilenameFormattedDateTime() + "-client.txt"); Bootstrap.realStdoutPrintln(crashReport.getFriendlyReport(ReportType.CRASH)); + if (crashReport.getSaveFile() != null) { + Bootstrap.realStdoutPrintln("#@!@# Game crashed! Crash report saved to: #@!@# " + crashReport.getSaveFile().toAbsolutePath()); + return -1; + } else if (crashReport.saveToFile(path2, ReportType.CRASH)) { + Bootstrap.realStdoutPrintln("#@!@# Game crashed! Crash report saved to: #@!@# " + path2.toAbsolutePath()); + return -1; + } else { + Bootstrap.realStdoutPrintln("#@?@# Game crashed! Crash report could not be saved. #@?@#"); + return -2; + } + } + + public static void crash(@Nullable Minecraft minecraft, File gameDirectory, CrashReport crashReport) { + int i = saveReport(gameDirectory, crashReport); if (minecraft != null) { minecraft.soundManager.emergencyShutdown(); } - if (crashReport.getSaveFile() != null) { - Bootstrap.realStdoutPrintln("#@!@# Game crashed! Crash report saved to: #@!@# " + crashReport.getSaveFile().toAbsolutePath()); - System.exit(-1); - } else if (crashReport.saveToFile(path2, ReportType.CRASH)) { - Bootstrap.realStdoutPrintln("#@!@# Game crashed! Crash report saved to: #@!@# " + path2.toAbsolutePath()); - System.exit(-1); - } else { - Bootstrap.realStdoutPrintln("#@?@# Game crashed! Crash report could not be saved. #@?@#"); - System.exit(-2); - } + System.exit(i); } public boolean isEnforceUnicode() { @@ -906,13 +959,13 @@ public class Minecraft extends ReentrantBlockableEventLoop implements this.resourcePackRepository.reload(); List list = this.resourcePackRepository.openAllSelected(); if (!error) { - this.reloadStateTracker.startReload(ResourceLoadStateTracker.ReloadReason.MANUAL, list); + this.reloadStateTracker.startReload(ReloadReason.MANUAL, list); } this.setOverlay( new LoadingOverlay( this, - this.resourceManager.createReload(Util.backgroundExecutor(), this, RESOURCE_RELOAD_INITIAL_TASK, list), + this.resourceManager.createReload(Util.backgroundExecutor().forName("resourceLoad"), this, RESOURCE_RELOAD_INITIAL_TASK, list), optional -> Util.ifElse(optional, throwable -> { if (error) { this.downloadedPackSource.onRecoveryFailure(); @@ -963,15 +1016,14 @@ public class Minecraft extends ReentrantBlockableEventLoop implements } } - for (Item item : BuiltInRegistries.ITEM) { - ItemStack itemStack = item.getDefaultInstance(); - String string = itemStack.getDescriptionId(); + BuiltInRegistries.ITEM.listElements().forEach(reference -> { + Item item = (Item)reference.value(); + String string = item.getDescriptionId(); String string2 = Component.translatable(string).getString(); if (string2.toLowerCase(Locale.ROOT).equals(item.getDescriptionId())) { - LOGGER.debug("Missing translation for: {} {} {}", itemStack, string, item); + LOGGER.debug("Missing translation for: {} {} {}", reference.key().location(), string, item); } - } - + }); bl |= MenuScreens.selfTest(); bl |= EntityRenderers.validateRegistrations(); if (bl) { @@ -1103,6 +1155,7 @@ public class Minecraft extends ReentrantBlockableEventLoop implements this.modelManager.close(); this.fontManager.close(); this.gameRenderer.close(); + this.shaderManager.close(); this.levelRenderer.close(); this.soundManager.destroy(); this.particleEngine.close(); @@ -1110,8 +1163,13 @@ public class Minecraft extends ReentrantBlockableEventLoop implements this.paintingTextures.close(); this.mapDecorationTextures.close(); this.guiSprites.close(); + this.mapTextureManager.close(); this.textureManager.close(); this.resourceManager.close(); + if (this.tracyFrameCapture != null) { + this.tracyFrameCapture.close(); + } + FreeTypeUtil.destroy(); Util.shutdownExecutors(); } catch (Throwable var5) { @@ -1140,26 +1198,28 @@ public class Minecraft extends ReentrantBlockableEventLoop implements runnable.run(); } - int i = this.timer.advanceTime(Util.getMillis(), renderLevel); + int i = this.deltaTracker.advanceTime(Util.getMillis(), renderLevel); + ProfilerFiller profilerFiller = Profiler.get(); if (renderLevel) { - this.profiler.push("scheduledExecutables"); + profilerFiller.push("scheduledExecutables"); this.runAllTasks(); - this.profiler.pop(); - this.profiler.push("tick"); + profilerFiller.pop(); + profilerFiller.push("tick"); for (int j = 0; j < Math.min(10, i); j++) { - this.profiler.incrementCounter("clientTick"); + profilerFiller.incrementCounter("clientTick"); this.tick(); } - this.profiler.pop(); + profilerFiller.pop(); } this.window.setErrorSection("Render"); - this.profiler.push("sound"); + profilerFiller.push("sound"); this.soundManager.updateSource(this.gameRenderer.getMainCamera()); - this.profiler.pop(); - this.profiler.push("render"); + profilerFiller.popPush("toasts"); + this.toastManager.update(); + profilerFiller.popPush("render"); long l = Util.getNanos(); boolean bl; if (!this.getDebugOverlay().showDebugScreen() && !this.metricsRecorder.isRecording()) { @@ -1172,29 +1232,21 @@ public class Minecraft extends ReentrantBlockableEventLoop implements } } - RenderSystem.clear(16640, ON_OSX); + RenderSystem.clear(16640); this.mainRenderTarget.bindWrite(true); - FogRenderer.setupNoFog(); - this.profiler.push("display"); + RenderSystem.setShaderFog(FogParameters.NO_FOG); + profilerFiller.push("display"); RenderSystem.enableCull(); - this.profiler.popPush("mouse"); + profilerFiller.popPush("mouse"); this.mouseHandler.handleAccumulatedMovement(); - this.profiler.pop(); + profilerFiller.pop(); if (!this.noRender) { - this.profiler.popPush("gameRenderer"); - this.gameRenderer.render(this.timer, renderLevel); - this.profiler.pop(); + profilerFiller.popPush("gameRenderer"); + this.gameRenderer.render(this.deltaTracker, renderLevel); + profilerFiller.pop(); } - if (this.fpsPieResults != null) { - this.profiler.push("fpsPie"); - GuiGraphics guiGraphics = new GuiGraphics(this, this.renderBuffers.bufferSource()); - this.renderFpsMeter(guiGraphics, this.fpsPieResults); - guiGraphics.flush(); - this.profiler.pop(); - } - - this.profiler.push("blit"); + profilerFiller.push("blit"); this.mainRenderTarget.unbindWrite(); this.mainRenderTarget.blitToScreen(this.window.getWidth(), this.window.getHeight()); this.frameTimeNs = Util.getNanos() - l; @@ -1202,23 +1254,28 @@ public class Minecraft extends ReentrantBlockableEventLoop implements TimerQuery.getInstance().ifPresent(timerQuery -> this.currentFrameProfile = timerQuery.endProfile()); } - this.profiler.popPush("updateDisplay"); - this.window.updateDisplay(); - int k = this.getFramerateLimit(); + profilerFiller.popPush("updateDisplay"); + if (this.tracyFrameCapture != null) { + this.tracyFrameCapture.upload(); + this.tracyFrameCapture.capture(this.mainRenderTarget); + } + + this.window.updateDisplay(this.tracyFrameCapture); + int k = this.framerateLimitTracker.getFramerateLimit(); if (k < 260) { RenderSystem.limitDisplayFPS(k); } - this.profiler.popPush("yield"); + profilerFiller.popPush("yield"); Thread.yield(); - this.profiler.pop(); + profilerFiller.pop(); this.window.setErrorSection("Post render"); this.frames++; this.pause = this.hasSingleplayerServer() && (this.screen != null && this.screen.isPauseScreen() || this.overlay != null && this.overlay.isPauseScreen()) && !this.singleplayerServer.isPublished(); - this.timer.updatePauseState(this.pause); - this.timer.updateFrozenState(!this.isLevelRunningNormally()); + this.deltaTracker.updatePauseState(this.pause); + this.deltaTracker.updateFrozenState(!this.isLevelRunningNormally()); long m = Util.getNanos(); long n = m - this.lastNanoTime; if (bl) { @@ -1227,7 +1284,7 @@ public class Minecraft extends ReentrantBlockableEventLoop implements this.getDebugOverlay().logFrameDuration(n); this.lastNanoTime = m; - this.profiler.push("fpsUpdate"); + profilerFiller.push("fpsUpdate"); if (this.currentFrameProfile != null && this.currentFrameProfile.isDone()) { this.gpuUtilization = this.currentFrameProfile.get() * 100.0 / this.savedCpuDuration; } @@ -1256,7 +1313,7 @@ public class Minecraft extends ReentrantBlockableEventLoop implements this.frames = 0; } - this.profiler.pop(); + profilerFiller.pop(); } private ProfilerFiller constructProfiler(boolean renderFpsPie, @Nullable SingleTickProfiler singleTickProfiler) { @@ -1281,7 +1338,7 @@ public class Minecraft extends ReentrantBlockableEventLoop implements } if (this.metricsRecorder.isRecording()) { - profilerFiller = ProfilerFiller.tee(profilerFiller, this.metricsRecorder.getProfiler()); + profilerFiller = ProfilerFiller.combine(profilerFiller, this.metricsRecorder.getProfiler()); } return SingleTickProfiler.decorateFiller(profilerFiller, singleTickProfiler); @@ -1292,13 +1349,12 @@ public class Minecraft extends ReentrantBlockableEventLoop implements profiler.endTick(); } + ProfilerPieChart profilerPieChart = this.getDebugOverlay().getProfilerPieChart(); if (renderFpsPie) { - this.fpsPieResults = this.fpsPieProfiler.getResults(); + profilerPieChart.setPieChartResults(this.fpsPieProfiler.getResults()); } else { - this.fpsPieResults = null; + profilerPieChart.setPieChartResults(null); } - - this.profiler = this.fpsPieProfiler.getFiller(); } @Override @@ -1310,7 +1366,7 @@ public class Minecraft extends ReentrantBlockableEventLoop implements } RenderTarget renderTarget = this.getMainRenderTarget(); - renderTarget.resize(this.window.getWidth(), this.window.getHeight(), ON_OSX); + renderTarget.resize(this.window.getWidth(), this.window.getHeight()); this.gameRenderer.resize(this.window.getWidth(), this.window.getHeight()); this.mouseHandler.setIgnoreFirstMove(); } @@ -1328,22 +1384,13 @@ public class Minecraft extends ReentrantBlockableEventLoop implements return this.frameTimeNs; } - private int getFramerateLimit() { - return this.level != null || this.screen == null && this.overlay == null ? this.window.getFramerateLimit() : 60; - } - /** * Attempts to free as much memory as possible, including leaving the world and running the garbage collector. */ private void emergencySave() { - try { - MemoryReserve.release(); - this.levelRenderer.clear(); - } catch (Throwable var3) { - } + MemoryReserve.release(); try { - System.gc(); if (this.isLocalServer && this.singleplayerServer != null) { this.singleplayerServer.halt(true); } @@ -1466,127 +1513,6 @@ public class Minecraft extends ReentrantBlockableEventLoop implements return path; } - /** - * Update debugProfilerName in response to number keys in debug screen - */ - public void debugFpsMeterKeyPress(int keyCount) { - if (this.fpsPieResults != null) { - List list = this.fpsPieResults.getTimes(this.debugPath); - if (!list.isEmpty()) { - ResultField resultField = (ResultField)list.remove(0); - if (keyCount == 0) { - if (!resultField.name.isEmpty()) { - int i = this.debugPath.lastIndexOf(30); - if (i >= 0) { - this.debugPath = this.debugPath.substring(0, i); - } - } - } else { - keyCount--; - if (keyCount < list.size() && !"unspecified".equals(((ResultField)list.get(keyCount)).name)) { - if (!this.debugPath.isEmpty()) { - this.debugPath = this.debugPath + "\u001e"; - } - - this.debugPath = this.debugPath + ((ResultField)list.get(keyCount)).name; - } - } - } - } - } - - private void renderFpsMeter(GuiGraphics guiGraphics, ProfileResults profileResults) { - List list = profileResults.getTimes(this.debugPath); - ResultField resultField = (ResultField)list.removeFirst(); - RenderSystem.clear(256, ON_OSX); - RenderSystem.setShader(GameRenderer::getPositionColorShader); - Matrix4f matrix4f = new Matrix4f().setOrtho(0.0F, this.window.getWidth(), this.window.getHeight(), 0.0F, 1000.0F, 3000.0F); - RenderSystem.setProjectionMatrix(matrix4f, VertexSorting.ORTHOGRAPHIC_Z); - Tesselator tesselator = Tesselator.getInstance(); - Matrix4fStack matrix4fStack = RenderSystem.getModelViewStack(); - matrix4fStack.pushMatrix(); - matrix4fStack.translation(0.0F, 0.0F, -2000.0F); - RenderSystem.applyModelViewMatrix(); - int i = 160; - int j = this.window.getWidth() - 160 - 10; - int k = this.window.getHeight() - 320; - double d = 0.0; - - for (ResultField resultField2 : list) { - int l = Mth.floor(resultField2.percentage / 4.0) + 1; - BufferBuilder bufferBuilder = tesselator.begin(VertexFormat.Mode.TRIANGLE_FAN, DefaultVertexFormat.POSITION_COLOR); - int m = FastColor.ARGB32.opaque(resultField2.getColor()); - int n = FastColor.ARGB32.multiply(m, -8355712); - bufferBuilder.addVertex(j, k, 0.0F).setColor(m); - - for (int o = l; o >= 0; o--) { - float f = (float)((d + resultField2.percentage * o / l) * (float) (Math.PI * 2) / 100.0); - float g = Mth.sin(f) * 160.0F; - float h = Mth.cos(f) * 160.0F * 0.5F; - bufferBuilder.addVertex(j + g, k - h, 0.0F).setColor(m); - } - - BufferUploader.drawWithShader(bufferBuilder.buildOrThrow()); - bufferBuilder = tesselator.begin(VertexFormat.Mode.TRIANGLE_STRIP, DefaultVertexFormat.POSITION_COLOR); - - for (int o = l; o >= 0; o--) { - float f = (float)((d + resultField2.percentage * o / l) * (float) (Math.PI * 2) / 100.0); - float g = Mth.sin(f) * 160.0F; - float h = Mth.cos(f) * 160.0F * 0.5F; - if (!(h > 0.0F)) { - bufferBuilder.addVertex(j + g, k - h, 0.0F).setColor(n); - bufferBuilder.addVertex(j + g, k - h + 10.0F, 0.0F).setColor(n); - } - } - - MeshData meshData = bufferBuilder.build(); - if (meshData != null) { - BufferUploader.drawWithShader(meshData); - } - - d += resultField2.percentage; - } - - DecimalFormat decimalFormat = new DecimalFormat("##0.00"); - decimalFormat.setDecimalFormatSymbols(DecimalFormatSymbols.getInstance(Locale.ROOT)); - String string = ProfileResults.demanglePath(resultField.name); - String string2 = ""; - if (!"unspecified".equals(string)) { - string2 = string2 + "[0] "; - } - - if (string.isEmpty()) { - string2 = string2 + "ROOT "; - } else { - string2 = string2 + string + " "; - } - - int p = 16777215; - guiGraphics.drawString(this.font, string2, j - 160, k - 80 - 16, 16777215); - string2 = decimalFormat.format(resultField.globalPercentage) + "%"; - guiGraphics.drawString(this.font, string2, j + 160 - this.font.width(string2), k - 80 - 16, 16777215); - - for (int q = 0; q < list.size(); q++) { - ResultField resultField3 = (ResultField)list.get(q); - StringBuilder stringBuilder = new StringBuilder(); - if ("unspecified".equals(resultField3.name)) { - stringBuilder.append("[?] "); - } else { - stringBuilder.append("[").append(q + 1).append("] "); - } - - String string3 = stringBuilder.append(resultField3.name).toString(); - guiGraphics.drawString(this.font, string3, j - 160, k + 80 + q * 8 + 20, resultField3.getColor()); - string3 = decimalFormat.format(resultField3.percentage) + "%"; - guiGraphics.drawString(this.font, string3, j + 160 - 50 - this.font.width(string3), k + 80 + q * 8 + 20, resultField3.getColor()); - string3 = decimalFormat.format(resultField3.globalPercentage) + "%"; - guiGraphics.drawString(this.font, string3, j + 160 - this.font.width(string3), k + 80 + q * 8 + 20, resultField3.getColor()); - } - - matrix4fStack.popMatrix(); - RenderSystem.applyModelViewMatrix(); - } - /** * Called when the window is closing. Sets 'running' to false which allows the game loop to exit cleanly. */ @@ -1619,7 +1545,7 @@ public class Minecraft extends ReentrantBlockableEventLoop implements } if (this.missTime <= 0 && !this.player.isUsingItem()) { - if (leftClick && this.hitResult != null && this.hitResult.getType() == HitResult.Type.BLOCK) { + if (leftClick && this.hitResult != null && this.hitResult.getType() == net.minecraft.world.phys.HitResult.Type.BLOCK) { BlockHitResult blockHitResult = (BlockHitResult)this.hitResult; BlockPos blockPos = blockHitResult.getBlockPos(); if (!this.level.getBlockState(blockPos).isAir()) { @@ -1712,8 +1638,8 @@ public class Minecraft extends ReentrantBlockableEventLoop implements interactionResult = this.gameMode.interact(this.player, entity, interactionHand); } - if (interactionResult.consumesAction()) { - if (interactionResult.shouldSwing()) { + if (interactionResult instanceof InteractionResult.Success success) { + if (success.swingSource() == InteractionResult.SwingSource.CLIENT) { this.player.swing(interactionHand); } @@ -1724,8 +1650,8 @@ public class Minecraft extends ReentrantBlockableEventLoop implements BlockHitResult blockHitResult = (BlockHitResult)this.hitResult; int i = itemStack.getCount(); InteractionResult interactionResult2 = this.gameMode.useItemOn(this.player, interactionHand, blockHitResult); - if (interactionResult2.consumesAction()) { - if (interactionResult2.shouldSwing()) { + if (interactionResult2 instanceof InteractionResult.Success success2) { + if (success2.swingSource() == InteractionResult.SwingSource.CLIENT) { this.player.swing(interactionHand); if (!itemStack.isEmpty() && (itemStack.getCount() != i || this.gameMode.hasInfiniteItems())) { this.gameRenderer.itemInHandRenderer.itemUsed(interactionHand); @@ -1735,22 +1661,19 @@ public class Minecraft extends ReentrantBlockableEventLoop implements return; } - if (interactionResult2 == InteractionResult.FAIL) { + if (interactionResult2 instanceof InteractionResult.Fail) { return; } } } - if (!itemStack.isEmpty()) { - InteractionResult interactionResult3 = this.gameMode.useItem(this.player, interactionHand); - if (interactionResult3.consumesAction()) { - if (interactionResult3.shouldSwing()) { - this.player.swing(interactionHand); - } - - this.gameRenderer.itemInHandRenderer.itemUsed(interactionHand); - return; + if (!itemStack.isEmpty() && this.gameMode.useItem(this.player, interactionHand) instanceof InteractionResult.Success success3) { + if (success3.swingSource() == InteractionResult.SwingSource.CLIENT) { + this.player.swing(interactionHand); } + + this.gameRenderer.itemInHandRenderer.itemUsed(interactionHand); + return; } } } @@ -1777,18 +1700,19 @@ public class Minecraft extends ReentrantBlockableEventLoop implements this.rightClickDelay--; } - this.profiler.push("gui"); + ProfilerFiller profilerFiller = Profiler.get(); + profilerFiller.push("gui"); this.chatListener.tick(); this.gui.tick(this.pause); - this.profiler.pop(); + profilerFiller.pop(); this.gameRenderer.pick(1.0F); this.tutorial.onLookAt(this.level, this.hitResult); - this.profiler.push("gameMode"); + profilerFiller.push("gameMode"); if (!this.pause && this.level != null) { this.gameMode.tick(); } - this.profiler.popPush("textures"); + profilerFiller.popPush("textures"); if (this.isLevelRunningNormally()) { this.textureManager.tick(); } @@ -1808,7 +1732,13 @@ public class Minecraft extends ReentrantBlockableEventLoop implements } if (this.screen != null) { - Screen.wrapScreenError(() -> this.screen.tick(), "Ticking screen", this.screen.getClass().getCanonicalName()); + try { + this.screen.tick(); + } catch (Throwable var5) { + CrashReport crashReport = CrashReport.forThrowable(var5, "Ticking screen"); + this.screen.fillCrashDetails(crashReport); + throw new ReportedException(crashReport); + } } if (!this.getDebugOverlay().showDebugScreen()) { @@ -1816,7 +1746,7 @@ public class Minecraft extends ReentrantBlockableEventLoop implements } if (this.overlay == null && this.screen == null) { - this.profiler.popPush("Keybindings"); + profilerFiller.popPush("Keybindings"); this.handleKeybinds(); if (this.missTime > 0) { this.missTime--; @@ -1824,22 +1754,22 @@ public class Minecraft extends ReentrantBlockableEventLoop implements } if (this.level != null) { - this.profiler.popPush("gameRenderer"); + profilerFiller.popPush("gameRenderer"); if (!this.pause) { this.gameRenderer.tick(); } - this.profiler.popPush("levelRenderer"); + profilerFiller.popPush("levelRenderer"); if (!this.pause) { this.levelRenderer.tick(); } - this.profiler.popPush("level"); + profilerFiller.popPush("level"); if (!this.pause) { this.level.tickEntities(); } - } else if (this.gameRenderer.currentEffect() != null) { - this.gameRenderer.shutdownEffect(); + } else if (this.gameRenderer.currentPostEffect() != null) { + this.gameRenderer.clearPostEffect(); } if (!this.pause) { @@ -1852,8 +1782,8 @@ public class Minecraft extends ReentrantBlockableEventLoop implements if (!this.options.joinedFirstServer && this.isMultiplayerServer()) { Component component = Component.translatable("tutorial.socialInteractions.title"); Component component2 = Component.translatable("tutorial.socialInteractions.description", Tutorial.key("socialInteractions")); - this.socialInteractionsToast = new TutorialToast(TutorialToast.Icons.SOCIAL_INTERACTIONS, component, component2, true); - this.tutorial.addTimedToast(this.socialInteractionsToast, 160); + this.socialInteractionsToast = new TutorialToast(TutorialToast.Icons.SOCIAL_INTERACTIONS, component, component2, true, 8000); + this.toastManager.addToast(this.socialInteractionsToast); this.options.joinedFirstServer = true; this.options.save(); } @@ -1862,8 +1792,8 @@ public class Minecraft extends ReentrantBlockableEventLoop implements try { this.level.tick(() -> true); - } catch (Throwable var4) { - CrashReport crashReport = CrashReport.forThrowable(var4, "Exception in world tick"); + } catch (Throwable var6) { + CrashReport crashReport = CrashReport.forThrowable(var6, "Exception in world tick"); if (this.level == null) { CrashReportCategory crashReportCategory = crashReport.addCategory("Affected level"); crashReportCategory.setDetail("Problem", "Level is null!"); @@ -1875,23 +1805,28 @@ public class Minecraft extends ReentrantBlockableEventLoop implements } } - this.profiler.popPush("animateTick"); + profilerFiller.popPush("animateTick"); if (!this.pause && this.isLevelRunningNormally()) { this.level.animateTick(this.player.getBlockX(), this.player.getBlockY(), this.player.getBlockZ()); } - this.profiler.popPush("particles"); + profilerFiller.popPush("particles"); if (!this.pause && this.isLevelRunningNormally()) { this.particleEngine.tick(); } + + ClientPacketListener clientPacketListener = this.getConnection(); + if (clientPacketListener != null && !this.pause) { + clientPacketListener.send(ServerboundClientTickEndPacket.INSTANCE); + } } else if (this.pendingConnection != null) { - this.profiler.popPush("pendingConnection"); + profilerFiller.popPush("pendingConnection"); this.pendingConnection.tick(); } - this.profiler.popPush("keyboard"); + profilerFiller.popPush("keyboard"); this.keyboardHandler.tick(); - this.profiler.pop(); + profilerFiller.pop(); } private boolean isLevelRunningNormally() { @@ -1937,7 +1872,7 @@ public class Minecraft extends ReentrantBlockableEventLoop implements this.narrator.sayNow(SOCIAL_INTERACTIONS_NOT_AVAILABLE); } else { if (this.socialInteractionsToast != null) { - this.tutorial.removeTimedToast(this.socialInteractionsToast); + this.socialInteractionsToast.hide(); this.socialInteractionsToast = null; } @@ -1960,7 +1895,7 @@ public class Minecraft extends ReentrantBlockableEventLoop implements while (this.options.keySwapOffhand.consumeClick()) { if (!this.player.isSpectator()) { - this.getConnection().send(new ServerboundPlayerActionPacket(ServerboundPlayerActionPacket.Action.SWAP_ITEM_WITH_OFFHAND, BlockPos.ZERO, Direction.DOWN)); + this.getConnection().send(new ServerboundPlayerActionPacket(Action.SWAP_ITEM_WITH_OFFHAND, BlockPos.ZERO, Direction.DOWN)); } } @@ -2048,8 +1983,8 @@ public class Minecraft extends ReentrantBlockableEventLoop implements this.isLocalServer = true; this.updateReportEnvironment(ReportEnvironment.local()); this.quickPlayLog.setWorldData(QuickPlayLog.Type.SINGLEPLAYER, levelStorage.getLevelId(), worldStem.worldData().getLevelName()); - } catch (Throwable var11) { - CrashReport crashReport = CrashReport.forThrowable(var11, "Starting integrated server"); + } catch (Throwable var12) { + CrashReport crashReport = CrashReport.forThrowable(var12, "Starting integrated server"); CrashReportCategory crashReportCategory = crashReport.addCategory("Starting integrated server"); crashReportCategory.setDetail("Level ID", levelStorage.getLevelId()); crashReportCategory.setDetail("Level Name", (CrashReportDetail)(() -> worldStem.worldData().getLevelName())); @@ -2061,8 +1996,9 @@ public class Minecraft extends ReentrantBlockableEventLoop implements } LevelLoadingScreen levelLoadingScreen = new LevelLoadingScreen((StoringChunkProgressListener)this.progressListener.get()); + ProfilerFiller profilerFiller = Profiler.get(); this.setScreen(levelLoadingScreen); - this.profiler.push("waitForServer"); + profilerFiller.push("waitForServer"); for (; !this.singleplayerServer.isReady() || this.overlay != null; this.handleDelayedCrash()) { levelLoadingScreen.tick(); @@ -2070,11 +2006,11 @@ public class Minecraft extends ReentrantBlockableEventLoop implements try { Thread.sleep(16L); - } catch (InterruptedException var10) { + } catch (InterruptedException var11) { } } - this.profiler.pop(); + profilerFiller.pop(); Duration duration = Duration.between(instant, Instant.now()); SocketAddress socketAddress = this.singleplayerServer.getConnection().startMemoryChannel(); Connection connection = Connection.connectToLocalServer(socketAddress); @@ -2131,13 +2067,14 @@ public class Minecraft extends ReentrantBlockableEventLoop implements this.updateScreenAndTick(nextScreen); if (this.level != null) { if (integratedServer != null) { - this.profiler.push("waitForServer"); + ProfilerFiller profilerFiller = Profiler.get(); + profilerFiller.push("waitForServer"); while (!integratedServer.isShutdown()) { this.runTick(false); } - this.profiler.pop(); + profilerFiller.pop(); } this.gui.onDisconnected(); @@ -2188,20 +2125,21 @@ public class Minecraft extends ReentrantBlockableEventLoop implements } private void updateScreenAndTick(Screen screen) { - this.profiler.push("forcedTick"); + ProfilerFiller profilerFiller = Profiler.get(); + profilerFiller.push("forcedTick"); this.soundManager.stop(); this.cameraEntity = null; this.pendingConnection = null; this.setScreen(screen); this.runTick(false); - this.profiler.pop(); + profilerFiller.pop(); } public void forceSetScreen(Screen screen) { - this.profiler.push("forcedTick"); - this.setScreen(screen); - this.runTick(false); - this.profiler.pop(); + try (Zone zone = Profiler.get().zone("forcedTick")) { + this.setScreen(screen); + this.runTick(false); + } } private void updateLevelInEngines(@Nullable ClientLevel level) { @@ -2296,12 +2234,12 @@ public class Minecraft extends ReentrantBlockableEventLoop implements * Called when user clicked he's mouse middle button (pick block) */ private void pickBlock() { - if (this.hitResult != null && this.hitResult.getType() != HitResult.Type.MISS) { + if (this.hitResult != null && this.hitResult.getType() != net.minecraft.world.phys.HitResult.Type.MISS) { boolean bl = this.player.getAbilities().instabuild; BlockEntity blockEntity = null; - HitResult.Type type = this.hitResult.getType(); + net.minecraft.world.phys.HitResult.Type type = this.hitResult.getType(); ItemStack itemStack; - if (type == HitResult.Type.BLOCK) { + if (type == net.minecraft.world.phys.HitResult.Type.BLOCK) { BlockPos blockPos = ((BlockHitResult)this.hitResult).getBlockPos(); BlockState blockState = this.level.getBlockState(blockPos); if (blockState.isAir()) { @@ -2318,7 +2256,7 @@ public class Minecraft extends ReentrantBlockableEventLoop implements blockEntity = this.level.getBlockEntity(blockPos); } } else { - if (type != HitResult.Type.ENTITY || !bl) { + if (type != net.minecraft.world.phys.HitResult.Type.ENTITY || !bl) { return; } @@ -2331,9 +2269,9 @@ public class Minecraft extends ReentrantBlockableEventLoop implements if (itemStack.isEmpty()) { String string = ""; - if (type == HitResult.Type.BLOCK) { + if (type == net.minecraft.world.phys.HitResult.Type.BLOCK) { string = BuiltInRegistries.BLOCK.getKey(this.level.getBlockState(((BlockHitResult)this.hitResult).getBlockPos()).getBlock()).toString(); - } else if (type == HitResult.Type.ENTITY) { + } else if (type == net.minecraft.world.phys.HitResult.Type.ENTITY) { string = BuiltInRegistries.ENTITY_TYPE.getKey(((EntityHitResult)this.hitResult).getEntity().getType()).toString(); } @@ -2371,17 +2309,23 @@ public class Minecraft extends ReentrantBlockableEventLoop implements */ public CrashReport fillReport(CrashReport theCrash) { SystemReport systemReport = theCrash.getSystemReport(); - fillSystemReport(systemReport, this, this.languageManager, this.launchedVersion, this.options); - this.fillUptime(theCrash.addCategory("Uptime")); - if (this.level != null) { - this.level.fillReportDetails(theCrash); + + try { + fillSystemReport(systemReport, this, this.languageManager, this.launchedVersion, this.options); + this.fillUptime(theCrash.addCategory("Uptime")); + if (this.level != null) { + this.level.fillReportDetails(theCrash); + } + + if (this.singleplayerServer != null) { + this.singleplayerServer.fillSystemReport(systemReport); + } + + this.reloadStateTracker.fillCrashReport(theCrash); + } catch (Throwable var4) { + LOGGER.error("Failed to collect details", var4); } - if (this.singleplayerServer != null) { - this.singleplayerServer.fillSystemReport(systemReport); - } - - this.reloadStateTracker.fillCrashReport(theCrash); return theCrash; } @@ -2521,6 +2465,10 @@ public class Minecraft extends ReentrantBlockableEventLoop implements return this.textureManager; } + public ShaderManager getShaderManager() { + return this.shaderManager; + } + public ResourceManager getResourceManager() { return this.resourceManager; } @@ -2612,7 +2560,7 @@ public class Minecraft extends ReentrantBlockableEventLoop implements } @Override - protected Runnable wrapRunnable(Runnable runnable) { + public Runnable wrapRunnable(Runnable runnable) { return runnable; } @@ -2637,12 +2585,16 @@ public class Minecraft extends ReentrantBlockableEventLoop implements return this.itemRenderer; } + public MapRenderer getMapRenderer() { + return this.mapRenderer; + } + public DataFixer getFixerUpper() { return this.fixerUpper; } - public DeltaTracker getTimer() { - return this.timer; + public DeltaTracker getDeltaTracker() { + return this.deltaTracker; } public BlockColors getBlockColors() { @@ -2656,8 +2608,8 @@ public class Minecraft extends ReentrantBlockableEventLoop implements return this.player != null && this.player.isReducedDebugInfo() || this.options.reducedDebugInfo().get(); } - public ToastComponent getToasts() { - return this.toast; + public ToastManager getToastManager() { + return this.toastManager; } public Tutorial getTutorial() { @@ -2690,6 +2642,10 @@ public class Minecraft extends ReentrantBlockableEventLoop implements return this.mobEffectTextures; } + public MapTextureManager getMapTextureManager() { + return this.mapTextureManager; + } + public MapDecorationTextureManager getMapDecorationTextures() { return this.mapDecorationTextures; } @@ -2706,7 +2662,7 @@ public class Minecraft extends ReentrantBlockableEventLoop implements public Component grabPanoramixScreenshot(File gameDirectory, int width, int height) { int i = this.window.getWidth(); int j = this.window.getHeight(); - RenderTarget renderTarget = new TextureTarget(width, height, true, ON_OSX); + RenderTarget renderTarget = this.getMainRenderTarget(); float f = this.player.getXRot(); float g = this.player.getYRot(); float h = this.player.xRotO; @@ -2716,9 +2672,9 @@ public class Minecraft extends ReentrantBlockableEventLoop implements MutableComponent var12; try { this.gameRenderer.setPanoramicMode(true); - this.levelRenderer.graphicsChanged(); this.window.setWidth(width); this.window.setHeight(height); + renderTarget.resize(width, height); for (int l = 0; l < 6; l++) { switch (l) { @@ -2776,9 +2732,8 @@ public class Minecraft extends ReentrantBlockableEventLoop implements this.gameRenderer.setRenderBlockOutline(true); this.window.setWidth(i); this.window.setHeight(j); - renderTarget.destroyBuffers(); + renderTarget.resize(i, j); this.gameRenderer.setPanoramicMode(false); - this.levelRenderer.graphicsChanged(); this.getMainRenderTarget().bindWrite(true); } @@ -2823,10 +2778,6 @@ public class Minecraft extends ReentrantBlockableEventLoop implements } } - public ProfilerFiller getProfiler() { - return this.profiler; - } - @Nullable public StoringChunkProgressListener getProgressListener() { return (StoringChunkProgressListener)this.progressListener.get(); @@ -2849,6 +2800,10 @@ public class Minecraft extends ReentrantBlockableEventLoop implements return this.window; } + public FramerateLimitTracker getFramerateLimitTracker() { + return this.framerateLimitTracker; + } + public DebugScreenOverlay getDebugOverlay() { return this.gui.getDebugOverlay(); } @@ -2865,6 +2820,10 @@ public class Minecraft extends ReentrantBlockableEventLoop implements return this.entityModels; } + public EquipmentModelSet getEquipmentModels() { + return this.equipmentModels; + } + public boolean isTextFilteringEnabled() { return this.userProperties().flag(UserFlag.PROFANITY_FILTER_ENABLED); } @@ -2937,32 +2896,14 @@ public class Minecraft extends ReentrantBlockableEventLoop implements @Environment(EnvType.CLIENT) public static enum ChatStatus { - ENABLED(CommonComponents.EMPTY) { - @Override - public boolean isChatAllowed(boolean isLocalServer) { - return true; - } - }, - DISABLED_BY_OPTIONS(Component.translatable("chat.disabled.options").withStyle(ChatFormatting.RED)) { - @Override - public boolean isChatAllowed(boolean isLocalServer) { - return false; - } - }, - DISABLED_BY_LAUNCHER(Component.translatable("chat.disabled.launcher").withStyle(ChatFormatting.RED)) { - @Override - public boolean isChatAllowed(boolean isLocalServer) { - return isLocalServer; - } - }, + ENABLED("ENABLED", 0, CommonComponents.EMPTY), + DISABLED_BY_OPTIONS("DISABLED_BY_OPTIONS", 1, Component.translatable("chat.disabled.options").withStyle(ChatFormatting.RED)), + DISABLED_BY_LAUNCHER("DISABLED_BY_LAUNCHER", 2, Component.translatable("chat.disabled.launcher").withStyle(ChatFormatting.RED)), DISABLED_BY_PROFILE( + "DISABLED_BY_PROFILE", + 3, Component.translatable("chat.disabled.profile", Component.keybind(Minecraft.instance.options.keyChat.getName())).withStyle(ChatFormatting.RED) - ) { - @Override - public boolean isChatAllowed(boolean isLocalServer) { - return isLocalServer; - } - }; + ); static final Component INFO_DISABLED_BY_PROFILE = Component.translatable("chat.disabled.profile.moreInfo"); private final Component message; diff --git a/net/minecraft/client/MouseHandler.java b/net/minecraft/client/MouseHandler.java index 206c3c00..d88fd7ba 100644 --- a/net/minecraft/client/MouseHandler.java +++ b/net/minecraft/client/MouseHandler.java @@ -2,6 +2,7 @@ package net.minecraft.client; import com.mojang.blaze3d.Blaze3D; import com.mojang.blaze3d.platform.InputConstants; +import com.mojang.blaze3d.platform.InputConstants.Type; import com.mojang.logging.LogUtils; import java.nio.file.InvalidPathException; import java.nio.file.Path; @@ -10,10 +11,15 @@ import java.util.ArrayList; import java.util.List; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; +import net.minecraft.CrashReport; +import net.minecraft.CrashReportCategory; +import net.minecraft.ReportedException; import net.minecraft.client.gui.components.toasts.SystemToast; import net.minecraft.client.gui.screens.Screen; import net.minecraft.util.Mth; import net.minecraft.util.SmoothDouble; +import net.minecraft.world.entity.player.Inventory; +import org.joml.Vector2i; import org.lwjgl.glfw.GLFWDropCallback; import org.slf4j.Logger; @@ -35,13 +41,13 @@ public class MouseHandler { private final SmoothDouble smoothTurnY = new SmoothDouble(); private double accumulatedDX; private double accumulatedDY; - private double accumulatedScrollX; - private double accumulatedScrollY; + private final ScrollWheelHandler scrollWheelHandler; private double lastHandleMovementTime = Double.MIN_VALUE; private boolean mouseGrabbed; public MouseHandler(Minecraft minecraft) { this.minecraft = minecraft; + this.scrollWheelHandler = new ScrollWheelHandler(); } /** @@ -51,6 +57,7 @@ public class MouseHandler { */ private void onPress(long windowPointer, int button, int action, int modifiers) { if (windowPointer == this.minecraft.getWindow().getWindow()) { + this.minecraft.getFramerateLimitTracker().onInputReceived(); if (this.minecraft.screen != null) { this.minecraft.setLastInputType(InputType.MOUSE); } @@ -74,7 +81,7 @@ public class MouseHandler { return; } - this.activeButton = i; + this.activeButton = button; this.mousePressedTime = Blaze3D.getTime(); } else if (this.activeButton != -1) { if (this.minecraft.options.touchscreen().get() && --this.clickDepth > 0) { @@ -84,7 +91,6 @@ public class MouseHandler { this.activeButton = -1; } - boolean[] bls = new boolean[]{false}; if (this.minecraft.getOverlay() == null) { if (this.minecraft.screen == null) { if (!this.mouseGrabbed && bl) { @@ -96,28 +102,53 @@ public class MouseHandler { Screen screen = this.minecraft.screen; if (bl) { screen.afterMouseAction(); - Screen.wrapScreenError(() -> bls[0] = screen.mouseClicked(d, e, i), "mouseClicked event handler", screen.getClass().getCanonicalName()); + + try { + if (screen.mouseClicked(d, e, i)) { + return; + } + } catch (Throwable var17) { + CrashReport crashReport = CrashReport.forThrowable(var17, "mouseClicked event handler"); + screen.fillCrashDetails(crashReport); + CrashReportCategory crashReportCategory = crashReport.addCategory("Mouse"); + crashReportCategory.setDetail("Scaled X", d); + crashReportCategory.setDetail("Scaled Y", e); + crashReportCategory.setDetail("Button", button); + throw new ReportedException(crashReport); + } } else { - Screen.wrapScreenError(() -> bls[0] = screen.mouseReleased(d, e, i), "mouseReleased event handler", screen.getClass().getCanonicalName()); + try { + if (screen.mouseReleased(d, e, i)) { + return; + } + } catch (Throwable var16) { + CrashReport crashReport = CrashReport.forThrowable(var16, "mouseReleased event handler"); + screen.fillCrashDetails(crashReport); + CrashReportCategory crashReportCategory = crashReport.addCategory("Mouse"); + crashReportCategory.setDetail("Scaled X", d); + crashReportCategory.setDetail("Scaled Y", e); + crashReportCategory.setDetail("Button", button); + throw new ReportedException(crashReport); + } } } } - if (!bls[0] && this.minecraft.screen == null && this.minecraft.getOverlay() == null) { - if (i == 0) { + if (this.minecraft.screen == null && this.minecraft.getOverlay() == null) { + if (button == 0) { this.isLeftPressed = bl; - } else if (i == 2) { + } else if (button == 2) { this.isMiddlePressed = bl; - } else if (i == 1) { + } else if (button == 1) { this.isRightPressed = bl; } - KeyMapping.set(InputConstants.Type.MOUSE.getOrCreate(i), bl); + KeyMapping.set(Type.MOUSE.getOrCreate(button), bl); if (bl) { - if (this.minecraft.player.isSpectator() && i == 2) { + if (this.minecraft.player.isSpectator() && button == 2) { this.minecraft.gui.getSpectatorGui().onMouseMiddleClick(); } else { - KeyMapping.click(InputConstants.Type.MOUSE.getOrCreate(i)); + KeyMapping.click(Type.MOUSE.getOrCreate(button)); } } } @@ -131,6 +162,7 @@ public class MouseHandler { */ private void onScroll(long windowPointer, double xOffset, double yOffset) { if (windowPointer == Minecraft.getInstance().getWindow().getWindow()) { + this.minecraft.getFramerateLimitTracker().onInputReceived(); boolean bl = this.minecraft.options.discreteMouseScroll().get(); double d = this.minecraft.options.mouseWheelSensitivity().get(); double e = (bl ? Math.signum(xOffset) : xOffset) * d; @@ -142,34 +174,22 @@ public class MouseHandler { this.minecraft.screen.mouseScrolled(g, h, e, f); this.minecraft.screen.afterMouseAction(); } else if (this.minecraft.player != null) { - if (this.accumulatedScrollX != 0.0 && Math.signum(e) != Math.signum(this.accumulatedScrollX)) { - this.accumulatedScrollX = 0.0; - } - - if (this.accumulatedScrollY != 0.0 && Math.signum(f) != Math.signum(this.accumulatedScrollY)) { - this.accumulatedScrollY = 0.0; - } - - this.accumulatedScrollX += e; - this.accumulatedScrollY += f; - int i = (int)this.accumulatedScrollX; - int j = (int)this.accumulatedScrollY; - if (i == 0 && j == 0) { + Vector2i vector2i = this.scrollWheelHandler.onMouseScroll(e, f); + if (vector2i.x == 0 && vector2i.y == 0) { return; } - this.accumulatedScrollX -= i; - this.accumulatedScrollY -= j; - int k = j == 0 ? -i : j; + int i = vector2i.y == 0 ? -vector2i.x : vector2i.y; if (this.minecraft.player.isSpectator()) { if (this.minecraft.gui.getSpectatorGui().isMenuActive()) { - this.minecraft.gui.getSpectatorGui().onMouseScrolled(-k); + this.minecraft.gui.getSpectatorGui().onMouseScrolled(-i); } else { - float l = Mth.clamp(this.minecraft.player.getAbilities().getFlyingSpeed() + j * 0.005F, 0.0F, 0.2F); - this.minecraft.player.getAbilities().setFlyingSpeed(l); + float j = Mth.clamp(this.minecraft.player.getAbilities().getFlyingSpeed() + vector2i.y * 0.005F, 0.0F, 0.2F); + this.minecraft.player.getAbilities().setFlyingSpeed(j); } } else { - this.minecraft.player.getInventory().swapPaint(k); + Inventory inventory = this.minecraft.player.getInventory(); + inventory.setSelectedHotbarSlot(ScrollWheelHandler.getNextScrollWheelSelection(i, inventory.selected, Inventory.getSelectionSize())); } } } @@ -177,6 +197,7 @@ public class MouseHandler { } private void onDrop(long windowPointer, List files, int failedFiles) { + this.minecraft.getFramerateLimitTracker().onInputReceived(); if (this.minecraft.screen != null) { this.minecraft.screen.onFilesDrop(files); } @@ -246,14 +267,40 @@ public class MouseHandler { this.lastHandleMovementTime = d; if (this.minecraft.isWindowActive()) { Screen screen = this.minecraft.screen; - if (screen != null && this.minecraft.getOverlay() == null && (this.accumulatedDX != 0.0 || this.accumulatedDY != 0.0)) { + boolean bl = this.accumulatedDX != 0.0 || this.accumulatedDY != 0.0; + if (bl) { + this.minecraft.getFramerateLimitTracker().onInputReceived(); + } + + if (screen != null && this.minecraft.getOverlay() == null && bl) { double f = this.xpos * this.minecraft.getWindow().getGuiScaledWidth() / this.minecraft.getWindow().getScreenWidth(); double g = this.ypos * this.minecraft.getWindow().getGuiScaledHeight() / this.minecraft.getWindow().getScreenHeight(); - Screen.wrapScreenError(() -> screen.mouseMoved(f, g), "mouseMoved event handler", screen.getClass().getCanonicalName()); + + try { + screen.mouseMoved(f, g); + } catch (Throwable var19) { + CrashReport crashReport = CrashReport.forThrowable(var19, "mouseMoved event handler"); + screen.fillCrashDetails(crashReport); + CrashReportCategory crashReportCategory = crashReport.addCategory("Mouse"); + crashReportCategory.setDetail("Scaled X", f); + crashReportCategory.setDetail("Scaled Y", g); + throw new ReportedException(crashReport); + } + if (this.activeButton != -1 && this.mousePressedTime > 0.0) { double h = this.accumulatedDX * this.minecraft.getWindow().getGuiScaledWidth() / this.minecraft.getWindow().getScreenWidth(); double i = this.accumulatedDY * this.minecraft.getWindow().getGuiScaledHeight() / this.minecraft.getWindow().getScreenHeight(); - Screen.wrapScreenError(() -> screen.mouseDragged(f, g, this.activeButton, h, i), "mouseDragged event handler", screen.getClass().getCanonicalName()); + + try { + screen.mouseDragged(f, g, this.activeButton, h, i); + } catch (Throwable var18) { + CrashReport crashReport2 = CrashReport.forThrowable(var18, "mouseDragged event handler"); + screen.fillCrashDetails(crashReport2); + CrashReportCategory crashReportCategory2 = crashReport2.addCategory("Mouse"); + crashReportCategory2.setDetail("Scaled X", f); + crashReportCategory2.setDetail("Scaled Y", g); + throw new ReportedException(crashReport2); + } } screen.afterMouseMove(); diff --git a/net/minecraft/client/OptionInstance.java b/net/minecraft/client/OptionInstance.java index eec3be47..b8491b9f 100644 --- a/net/minecraft/client/OptionInstance.java +++ b/net/minecraft/client/OptionInstance.java @@ -21,6 +21,8 @@ import java.util.stream.IntStream; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.Util; +import net.minecraft.client.OptionInstance.CycleableValueSet.ValueSetter; +import net.minecraft.client.OptionInstance.IntRangeBase.1; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.AbstractOptionSliderButton; import net.minecraft.client.gui.components.AbstractWidget; @@ -163,9 +165,8 @@ public final class OptionInstance { } @Environment(EnvType.CLIENT) - public record AltEnum( - List values, List altValues, BooleanSupplier altCondition, OptionInstance.CycleableValueSet.ValueSetter valueSetter, Codec codec - ) implements OptionInstance.CycleableValueSet { + public record AltEnum(List values, List altValues, BooleanSupplier altCondition, ValueSetter valueSetter, Codec codec) + implements OptionInstance.CycleableValueSet { @Override public CycleButton.ValueListSupplier valueListSupplier() { return CycleButton.ValueListSupplier.create(this.altCondition, this.values, this.altValues); @@ -223,7 +224,7 @@ public final class OptionInstance { interface CycleableValueSet extends OptionInstance.ValueSet { CycleButton.ValueListSupplier valueListSupplier(); - default OptionInstance.CycleableValueSet.ValueSetter valueSetter() { + default ValueSetter valueSetter() { return OptionInstance::set; } @@ -241,11 +242,6 @@ public final class OptionInstance { onValueChanged.accept(object); }); } - - @Environment(EnvType.CLIENT) - public interface ValueSetter { - void set(OptionInstance optionInstance, T object); - } } @Environment(EnvType.CLIENT) @@ -300,27 +296,7 @@ public final class OptionInstance { } default OptionInstance.SliderableValueSet xmap(IntFunction to, ToIntFunction from) { - return new OptionInstance.SliderableValueSet() { - @Override - public Optional validateValue(R value) { - return IntRangeBase.this.validateValue(from.applyAsInt(value)).map(to::apply); - } - - @Override - public double toSliderValue(R value) { - return IntRangeBase.this.toSliderValue(from.applyAsInt(value)); - } - - @Override - public R fromSliderValue(double value) { - return (R)to.apply(IntRangeBase.this.fromSliderValue(value)); - } - - @Override - public Codec codec() { - return IntRangeBase.this.codec().xmap(to::apply, from::applyAsInt); - } - }; + return new 1(this, from, to); } } @@ -387,7 +363,6 @@ public final class OptionInstance { N object = this.values.fromSliderValue(this.value); if (!Objects.equals(object, this.instance.get())) { this.instance.set(object); - this.options.save(); this.onValueChanged.accept(this.instance.get()); } } @@ -460,27 +435,7 @@ public final class OptionInstance { } public OptionInstance.SliderableValueSet xmap(DoubleFunction encoder, ToDoubleFunction decoder) { - return new OptionInstance.SliderableValueSet() { - @Override - public Optional validateValue(R value) { - return UnitDouble.this.validateValue(decoder.applyAsDouble(value)).map(encoder::apply); - } - - @Override - public double toSliderValue(R value) { - return UnitDouble.this.toSliderValue(decoder.applyAsDouble(value)); - } - - @Override - public R fromSliderValue(double value) { - return (R)encoder.apply(UnitDouble.this.fromSliderValue(value)); - } - - @Override - public Codec codec() { - return UnitDouble.this.codec().xmap(encoder::apply, decoder::applyAsDouble); - } - }; + return new net.minecraft.client.OptionInstance.UnitDouble.1(this, decoder, encoder); } @Override diff --git a/net/minecraft/client/Options.java b/net/minecraft/client/Options.java index e4881184..0300716c 100644 --- a/net/minecraft/client/Options.java +++ b/net/minecraft/client/Options.java @@ -12,10 +12,10 @@ import com.google.gson.JsonElement; import com.google.gson.JsonParser; import com.google.gson.reflect.TypeToken; import com.google.gson.stream.JsonReader; -import com.mojang.blaze3d.pipeline.RenderTarget; import com.mojang.blaze3d.platform.InputConstants; import com.mojang.blaze3d.platform.VideoMode; import com.mojang.blaze3d.platform.Window; +import com.mojang.blaze3d.platform.InputConstants.Type; import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.datafixers.util.Pair; import com.mojang.logging.LogUtils; @@ -60,12 +60,13 @@ import net.minecraft.nbt.CompoundTag; import net.minecraft.network.chat.CommonComponents; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.MutableComponent; -import net.minecraft.network.protocol.common.ServerboundClientInformationPacket; import net.minecraft.server.level.ClientInformation; +import net.minecraft.server.level.ParticleStatus; import net.minecraft.server.packs.repository.Pack; import net.minecraft.server.packs.repository.PackRepository; import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; +import net.minecraft.util.ARGB; import net.minecraft.util.GsonHelper; import net.minecraft.util.Mth; import net.minecraft.util.datafix.DataFixTypes; @@ -130,7 +131,22 @@ public class Options { new OptionInstance.IntRange(1, 26).xmap(i -> i * 10, integer -> integer / 10), Codec.intRange(10, 260), 120, - integer -> Minecraft.getInstance().getWindow().setFramerateLimit(integer) + integer -> Minecraft.getInstance().getFramerateLimitTracker().setFramerateLimit(integer) + ); + private static final Component INACTIVITY_FPS_LIMIT_TOOLTIP_MINIMIZED = Component.translatable("options.inactivityFpsLimit.minimized.tooltip"); + private static final Component INACTIVITY_FPS_LIMIT_TOOLTIP_AFK = Component.translatable("options.inactivityFpsLimit.afk.tooltip"); + private final OptionInstance inactivityFpsLimit = new OptionInstance<>( + "options.inactivityFpsLimit", + inactivityFpsLimit -> { + return switch (inactivityFpsLimit) { + case MINIMIZED -> Tooltip.create(INACTIVITY_FPS_LIMIT_TOOLTIP_MINIMIZED); + case AFK -> Tooltip.create(INACTIVITY_FPS_LIMIT_TOOLTIP_AFK); + }; + }, + OptionInstance.forOptionEnum(), + new OptionInstance.Enum<>(Arrays.asList(InactivityFpsLimit.values()), InactivityFpsLimit.CODEC), + InactivityFpsLimit.AFK, + inactivityFpsLimit -> {} ); private final OptionInstance cloudStatus = new OptionInstance<>( "options.renderClouds", @@ -140,14 +156,7 @@ public class Options { Arrays.asList(CloudStatus.values()), Codec.withAlternative(CloudStatus.CODEC, Codec.BOOL, boolean_ -> boolean_ ? CloudStatus.FANCY : CloudStatus.OFF) ), CloudStatus.FANCY, - cloudStatus -> { - if (Minecraft.useShaderTransparency()) { - RenderTarget renderTarget = Minecraft.getInstance().levelRenderer.getCloudsTarget(); - if (renderTarget != null) { - renderTarget.clear(Minecraft.ON_OSX); - } - } - } + cloudStatus -> {} ); private static final Component GRAPHICS_TOOLTIP_FAST = Component.translatable("options.graphics.fast.tooltip"); private static final Component GRAPHICS_TOOLTIP_FABULOUS = Component.translatable( @@ -262,6 +271,10 @@ public class Options { } } ); + private static final Component HIGH_CONTRAST_BLOCK_OUTLINE_TOOLTIP = Component.translatable("options.accessibility.high_contrast_block_outline.tooltip"); + private final OptionInstance highContrastBlockOutline = OptionInstance.createBoolean( + "options.accessibility.high_contrast_block_outline", OptionInstance.cachedConstantTooltip(HIGH_CONTRAST_BLOCK_OUTLINE_TOOLTIP), false + ); private final OptionInstance narratorHotkey = OptionInstance.createBoolean( "options.accessibility.narrator_hotkey", OptionInstance.cachedConstantTooltip( @@ -283,7 +296,7 @@ public class Options { OptionInstance.forOptionEnum(), new OptionInstance.Enum<>(Arrays.asList(HumanoidArm.values()), HumanoidArm.CODEC), HumanoidArm.RIGHT, - humanoidArm -> this.broadcastOptions() + humanoidArm -> {} ); public int overrideWidth; public int overrideHeight; @@ -359,7 +372,6 @@ public class Options { ); public TutorialSteps tutorialStep = TutorialSteps.MOVEMENT; public boolean joinedFirstServer = false; - public boolean hideBundleTutorial = false; private final OptionInstance biomeBlendRadius = new OptionInstance<>( "options.biomeBlendRadius", OptionInstance.noTooltip(), (component, integer) -> { int i = integer * 2 + 1; @@ -383,6 +395,10 @@ public class Options { }); public int glDebugVerbosity = 1; private final OptionInstance autoJump = OptionInstance.createBoolean("options.autoJump", false); + private static final Component ACCESSIBILITY_TOOLTIP_ROTATE_WITH_MINECART = Component.translatable("options.rotateWithMinecart.tooltip"); + private final OptionInstance rotateWithMinecart = OptionInstance.createBoolean( + "options.rotateWithMinecart", OptionInstance.cachedConstantTooltip(ACCESSIBILITY_TOOLTIP_ROTATE_WITH_MINECART), false + ); private final OptionInstance operatorItemsTab = OptionInstance.createBoolean("options.operatorItemsTab", false); private final OptionInstance autoSuggestions = OptionInstance.createBoolean("options.autoSuggestCommands", true); private final OptionInstance chatColors = OptionInstance.createBoolean("options.chat.color", true); @@ -409,7 +425,7 @@ public class Options { ); private static final Component ALLOW_SERVER_LISTING_TOOLTIP = Component.translatable("options.allowServerListing.tooltip"); private final OptionInstance allowServerListing = OptionInstance.createBoolean( - "options.allowServerListing", OptionInstance.cachedConstantTooltip(ALLOW_SERVER_LISTING_TOOLTIP), true, boolean_ -> this.broadcastOptions() + "options.allowServerListing", OptionInstance.cachedConstantTooltip(ALLOW_SERVER_LISTING_TOOLTIP), true, boolean_ -> {} ); private final OptionInstance reducedDebugInfo = OptionInstance.createBoolean("options.reducedDebugInfo", false); private final Map> soundSourceVolumes = Util.make(new EnumMap(SoundSource.class), enumMap -> { @@ -487,9 +503,9 @@ public class Options { public final KeyMapping keyInventory = new KeyMapping("key.inventory", 69, "key.categories.inventory"); public final KeyMapping keySwapOffhand = new KeyMapping("key.swapOffhand", 70, "key.categories.inventory"); public final KeyMapping keyDrop = new KeyMapping("key.drop", 81, "key.categories.inventory"); - public final KeyMapping keyUse = new KeyMapping("key.use", InputConstants.Type.MOUSE, 1, "key.categories.gameplay"); - public final KeyMapping keyAttack = new KeyMapping("key.attack", InputConstants.Type.MOUSE, 0, "key.categories.gameplay"); - public final KeyMapping keyPickItem = new KeyMapping("key.pickItem", InputConstants.Type.MOUSE, 2, "key.categories.gameplay"); + public final KeyMapping keyUse = new KeyMapping("key.use", Type.MOUSE, 1, "key.categories.gameplay"); + public final KeyMapping keyAttack = new KeyMapping("key.attack", Type.MOUSE, 0, "key.categories.gameplay"); + public final KeyMapping keyPickItem = new KeyMapping("key.pickItem", Type.MOUSE, 2, "key.categories.gameplay"); public final KeyMapping keyChat = new KeyMapping("key.chat", 84, "key.categories.multiplayer"); public final KeyMapping keyPlayerList = new KeyMapping("key.playerlist", 258, "key.categories.multiplayer"); public final KeyMapping keyCommand = new KeyMapping("key.command", 47, "key.categories.multiplayer"); @@ -739,6 +755,10 @@ public class Options { return this.framerateLimit; } + public OptionInstance inactivityFpsLimit() { + return this.inactivityFpsLimit; + } + public OptionInstance cloudStatus() { return this.cloudStatus; } @@ -808,6 +828,10 @@ public class Options { return this.highContrast; } + public OptionInstance highContrastBlockOutline() { + return this.highContrastBlockOutline; + } + public OptionInstance narratorHotkey() { return this.narratorHotkey; } @@ -872,6 +896,10 @@ public class Options { return this.autoJump; } + public OptionInstance rotateWithMinecart() { + return this.rotateWithMinecart; + } + public OptionInstance operatorItemsTab() { return this.operatorItemsTab; } @@ -1089,16 +1117,11 @@ public class Options { } public int getBackgroundColor(float opacity) { - return (int)(this.getBackgroundOpacity(opacity) * 255.0F) << 24 & 0xFF000000; + return ARGB.colorFromFloat(this.getBackgroundOpacity(opacity), 0.0F, 0.0F, 0.0F); } public int getBackgroundColor(int chatColor) { - return this.backgroundForChatOnly.get() ? chatColor : (int)(this.textBackgroundOpacity.get() * 255.0) << 24 & 0xFF000000; - } - - public void setKey(KeyMapping keyBinding, InputConstants.Key input) { - keyBinding.setKey(input); - this.save(); + return this.backgroundForChatOnly.get() ? chatColor : ARGB.colorFromFloat(this.textBackgroundOpacity.get().floatValue(), 0.0F, 0.0F, 0.0F); } private void processDumpedOptions(Options.OptionAccess optionAccess) { @@ -1120,6 +1143,7 @@ public class Options { optionAccess.process("graphicsMode", this.graphicsMode); optionAccess.process("guiScale", this.guiScale); optionAccess.process("maxFps", this.framerateLimit); + optionAccess.process("inactivityFpsLimit", this.inactivityFpsLimit); optionAccess.process("mipmapLevels", this.mipmapLevels); optionAccess.process("narrator", this.narrator); optionAccess.process("particles", this.particles); @@ -1134,6 +1158,7 @@ public class Options { private void processOptions(Options.FieldAccess accessor) { this.processDumpedOptions(accessor); accessor.process("autoJump", this.autoJump); + accessor.process("rotateWithMinecart", this.rotateWithMinecart); accessor.process("operatorItemsTab", this.operatorItemsTab); accessor.process("autoSuggestions", this.autoSuggestions); accessor.process("chatColors", this.chatColors); @@ -1154,6 +1179,7 @@ public class Options { accessor.process("mouseSensitivity", this.sensitivity); accessor.process("damageTiltStrength", this.damageTiltStrength); accessor.process("highContrast", this.highContrast); + accessor.process("highContrastBlockOutline", this.highContrastBlockOutline); accessor.process("narratorHotkey", this.narratorHotkey); this.resourcePacks = accessor.process("resourcePacks", this.resourcePacks, Options::readListOfStrings, GSON::toJson); this.incompatibleResourcePacks = accessor.process("incompatibleResourcePacks", this.incompatibleResourcePacks, Options::readListOfStrings, GSON::toJson); @@ -1185,7 +1211,6 @@ public class Options { this.skipMultiplayerWarning = accessor.process("skipMultiplayerWarning", this.skipMultiplayerWarning); accessor.process("hideMatchedNames", this.hideMatchedNames); this.joinedFirstServer = accessor.process("joinedFirstServer", this.joinedFirstServer); - this.hideBundleTutorial = accessor.process("hideBundleTutorial", this.hideBundleTutorial); this.syncWrites = accessor.process("syncChunkWrites", this.syncWrites); accessor.process("showAutosaveIndicator", this.showAutosaveIndicator); accessor.process("allowServerListing", this.allowServerListing); @@ -1334,10 +1359,6 @@ public class Options { this.fullscreenVideoModeString = compoundTag2.getString("fullscreenResolution"); } - if (this.minecraft.getWindow() != null) { - this.minecraft.getWindow().setFramerateLimit(this.framerateLimit.get()); - } - KeyMapping.resetMapping(); } catch (Exception var7) { LOGGER.error("Failed to load options", (Throwable)var7); @@ -1462,7 +1483,8 @@ public class Options { i, this.mainHand.get(), this.minecraft.isTextFilteringEnabled(), - this.allowServerListing.get() + this.allowServerListing.get(), + this.particles.get() ); } @@ -1471,11 +1493,11 @@ public class Options { */ public void broadcastOptions() { if (this.minecraft.player != null) { - this.minecraft.player.connection.send(new ServerboundClientInformationPacket(this.buildPlayerInformation())); + this.minecraft.player.connection.broadcastClientInformation(this.buildPlayerInformation()); } } - private void setModelPart(PlayerModelPart modelPart, boolean enable) { + public void setModelPart(PlayerModelPart modelPart, boolean enable) { if (enable) { this.modelParts.add(modelPart); } else { @@ -1487,11 +1509,6 @@ public class Options { return this.modelParts.contains(playerModelPart); } - public void toggleModelPart(PlayerModelPart playerModelPart, boolean enable) { - this.setModelPart(playerModelPart, enable); - this.broadcastOptions(); - } - public CloudStatus getCloudsType() { return this.getEffectiveRenderDistance() >= 4 ? this.cloudStatus.get() : CloudStatus.OFF; } diff --git a/net/minecraft/client/PeriodicNotificationManager.java b/net/minecraft/client/PeriodicNotificationManager.java index 028cbaa5..2635e6b1 100644 --- a/net/minecraft/client/PeriodicNotificationManager.java +++ b/net/minecraft/client/PeriodicNotificationManager.java @@ -184,7 +184,7 @@ public class PeriodicNotificationManager this.minecraft .execute( () -> SystemToast.add( - Minecraft.getInstance().getToasts(), + Minecraft.getInstance().getToastManager(), SystemToast.SystemToastId.PERIODIC_NOTIFICATION, Component.translatable(notification.title, n), Component.translatable(notification.message, n) diff --git a/net/minecraft/client/RecipeBookCategories.java b/net/minecraft/client/RecipeBookCategories.java deleted file mode 100644 index a02334f6..00000000 --- a/net/minecraft/client/RecipeBookCategories.java +++ /dev/null @@ -1,69 +0,0 @@ -package net.minecraft.client; - -import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableMap; -import java.util.List; -import java.util.Map; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.world.inventory.RecipeBookType; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.Items; -import net.minecraft.world.level.block.Blocks; - -@Environment(EnvType.CLIENT) -public enum RecipeBookCategories { - CRAFTING_SEARCH(new ItemStack(Items.COMPASS)), - CRAFTING_BUILDING_BLOCKS(new ItemStack(Blocks.BRICKS)), - CRAFTING_REDSTONE(new ItemStack(Items.REDSTONE)), - CRAFTING_EQUIPMENT(new ItemStack(Items.IRON_AXE), new ItemStack(Items.GOLDEN_SWORD)), - CRAFTING_MISC(new ItemStack(Items.LAVA_BUCKET), new ItemStack(Items.APPLE)), - FURNACE_SEARCH(new ItemStack(Items.COMPASS)), - FURNACE_FOOD(new ItemStack(Items.PORKCHOP)), - FURNACE_BLOCKS(new ItemStack(Blocks.STONE)), - FURNACE_MISC(new ItemStack(Items.LAVA_BUCKET), new ItemStack(Items.EMERALD)), - BLAST_FURNACE_SEARCH(new ItemStack(Items.COMPASS)), - BLAST_FURNACE_BLOCKS(new ItemStack(Blocks.REDSTONE_ORE)), - BLAST_FURNACE_MISC(new ItemStack(Items.IRON_SHOVEL), new ItemStack(Items.GOLDEN_LEGGINGS)), - SMOKER_SEARCH(new ItemStack(Items.COMPASS)), - SMOKER_FOOD(new ItemStack(Items.PORKCHOP)), - STONECUTTER(new ItemStack(Items.CHISELED_STONE_BRICKS)), - SMITHING(new ItemStack(Items.NETHERITE_CHESTPLATE)), - CAMPFIRE(new ItemStack(Items.PORKCHOP)), - UNKNOWN(new ItemStack(Items.BARRIER)); - - public static final List SMOKER_CATEGORIES = ImmutableList.of(SMOKER_SEARCH, SMOKER_FOOD); - public static final List BLAST_FURNACE_CATEGORIES = ImmutableList.of(BLAST_FURNACE_SEARCH, BLAST_FURNACE_BLOCKS, BLAST_FURNACE_MISC); - public static final List FURNACE_CATEGORIES = ImmutableList.of(FURNACE_SEARCH, FURNACE_FOOD, FURNACE_BLOCKS, FURNACE_MISC); - public static final List CRAFTING_CATEGORIES = ImmutableList.of( - CRAFTING_SEARCH, CRAFTING_EQUIPMENT, CRAFTING_BUILDING_BLOCKS, CRAFTING_MISC, CRAFTING_REDSTONE - ); - public static final Map> AGGREGATE_CATEGORIES = ImmutableMap.of( - CRAFTING_SEARCH, - ImmutableList.of(CRAFTING_EQUIPMENT, CRAFTING_BUILDING_BLOCKS, CRAFTING_MISC, CRAFTING_REDSTONE), - FURNACE_SEARCH, - ImmutableList.of(FURNACE_FOOD, FURNACE_BLOCKS, FURNACE_MISC), - BLAST_FURNACE_SEARCH, - ImmutableList.of(BLAST_FURNACE_BLOCKS, BLAST_FURNACE_MISC), - SMOKER_SEARCH, - ImmutableList.of(SMOKER_FOOD) - ); - private final List itemIcons; - - private RecipeBookCategories(final ItemStack... itemIcons) { - this.itemIcons = ImmutableList.copyOf(itemIcons); - } - - public static List getCategories(RecipeBookType recipeBookType) { - return switch (recipeBookType) { - case CRAFTING -> CRAFTING_CATEGORIES; - case FURNACE -> FURNACE_CATEGORIES; - case BLAST_FURNACE -> BLAST_FURNACE_CATEGORIES; - case SMOKER -> SMOKER_CATEGORIES; - }; - } - - public List getIconItems() { - return this.itemIcons; - } -} diff --git a/net/minecraft/client/ScrollWheelHandler.java b/net/minecraft/client/ScrollWheelHandler.java new file mode 100644 index 00000000..a98cf163 --- /dev/null +++ b/net/minecraft/client/ScrollWheelHandler.java @@ -0,0 +1,49 @@ +package net.minecraft.client; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import org.joml.Vector2i; + +@Environment(EnvType.CLIENT) +public class ScrollWheelHandler { + private double accumulatedScrollX; + private double accumulatedScrollY; + + public Vector2i onMouseScroll(double d, double e) { + if (this.accumulatedScrollX != 0.0 && Math.signum(d) != Math.signum(this.accumulatedScrollX)) { + this.accumulatedScrollX = 0.0; + } + + if (this.accumulatedScrollY != 0.0 && Math.signum(e) != Math.signum(this.accumulatedScrollY)) { + this.accumulatedScrollY = 0.0; + } + + this.accumulatedScrollX += d; + this.accumulatedScrollY += e; + int i = (int)this.accumulatedScrollX; + int j = (int)this.accumulatedScrollY; + if (i == 0 && j == 0) { + return new Vector2i(0, 0); + } else { + this.accumulatedScrollX -= i; + this.accumulatedScrollY -= j; + return new Vector2i(i, j); + } + } + + public static int getNextScrollWheelSelection(double d, int i, int j) { + int k = (int)Math.signum(d); + i -= k; + i = Math.max(-1, i); + + while (i < 0) { + i += j; + } + + while (i >= j) { + i -= j; + } + + return i; + } +} diff --git a/net/minecraft/client/animation/KeyframeAnimations.java b/net/minecraft/client/animation/KeyframeAnimations.java index c1b3f080..8c3669cb 100644 --- a/net/minecraft/client/animation/KeyframeAnimations.java +++ b/net/minecraft/client/animation/KeyframeAnimations.java @@ -5,26 +5,26 @@ import java.util.Optional; import java.util.Map.Entry; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; -import net.minecraft.client.model.HierarchicalModel; +import net.minecraft.client.model.Model; import net.minecraft.client.model.geom.ModelPart; import net.minecraft.util.Mth; import org.joml.Vector3f; @Environment(EnvType.CLIENT) public class KeyframeAnimations { - public static void animate(HierarchicalModel model, AnimationDefinition animationDefinition, long accumulatedTime, float scale, Vector3f animationVecCache) { - float f = getElapsedSeconds(animationDefinition, accumulatedTime); + public static void animate(Model model, AnimationDefinition animationDefinition, long l, float f, Vector3f vector3f) { + float g = getElapsedSeconds(animationDefinition, l); for (Entry> entry : animationDefinition.boneAnimations().entrySet()) { Optional optional = model.getAnyDescendantWithName((String)entry.getKey()); List list = (List)entry.getValue(); optional.ifPresent(modelPart -> list.forEach(animationChannel -> { Keyframe[] keyframes = animationChannel.keyframes(); - int i = Math.max(0, Mth.binarySearch(0, keyframes.length, ix -> f <= keyframes[ix].timestamp()) - 1); + int i = Math.max(0, Mth.binarySearch(0, keyframes.length, ix -> g <= keyframes[ix].timestamp()) - 1); int j = Math.min(keyframes.length - 1, i + 1); Keyframe keyframe = keyframes[i]; Keyframe keyframe2 = keyframes[j]; - float h = f - keyframe.timestamp(); + float h = g - keyframe.timestamp(); float k; if (j != i) { k = Mth.clamp(h / (keyframe2.timestamp() - keyframe.timestamp()), 0.0F, 1.0F); @@ -32,8 +32,8 @@ public class KeyframeAnimations { k = 0.0F; } - keyframe2.interpolation().apply(animationVecCache, k, keyframes, i, j, scale); - animationChannel.target().apply(modelPart, animationVecCache); + keyframe2.interpolation().apply(vector3f, k, keyframes, i, j, f); + animationChannel.target().apply(modelPart, vector3f); })); } } diff --git a/net/minecraft/client/animation/definitions/BreezeAnimation.java b/net/minecraft/client/animation/definitions/BreezeAnimation.java index 12c240a5..cb56282f 100644 --- a/net/minecraft/client/animation/definitions/BreezeAnimation.java +++ b/net/minecraft/client/animation/definitions/BreezeAnimation.java @@ -6,265 +6,390 @@ import net.minecraft.client.animation.AnimationChannel; import net.minecraft.client.animation.AnimationDefinition; import net.minecraft.client.animation.Keyframe; import net.minecraft.client.animation.KeyframeAnimations; +import net.minecraft.client.animation.AnimationChannel.Interpolations; +import net.minecraft.client.animation.AnimationChannel.Targets; +import net.minecraft.client.animation.AnimationDefinition.Builder; @Environment(EnvType.CLIENT) public class BreezeAnimation { - public static final AnimationDefinition SHOOT = AnimationDefinition.Builder.withLength(1.125F) + public static final AnimationDefinition IDLE = Builder.withLength(2.0F) + .looping() .addAnimation( - "head", + "wind_top", new AnimationChannel( - AnimationChannel.Targets.ROTATION, - new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), - new Keyframe(0.25F, KeyframeAnimations.degreeVec(-12.5F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), - new Keyframe(0.75F, KeyframeAnimations.degreeVec(-12.5F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), - new Keyframe(0.9167F, KeyframeAnimations.degreeVec(5.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), - new Keyframe(1.125F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR) - ) - ) - .addAnimation( - "head", - new AnimationChannel( - AnimationChannel.Targets.POSITION, - new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), - new Keyframe(0.25F, KeyframeAnimations.posVec(0.0F, -2.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), - new Keyframe(0.7917F, KeyframeAnimations.posVec(0.0F, -1.0F, 2.0F), AnimationChannel.Interpolations.LINEAR), - new Keyframe(0.9583F, KeyframeAnimations.posVec(0.0F, -1.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), - new Keyframe(1.125F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR) - ) - ) - .addAnimation( - "wind_bottom", - new AnimationChannel( - AnimationChannel.Targets.ROTATION, new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR) + Targets.POSITION, + new Keyframe(0.0F, KeyframeAnimations.posVec(0.5F, 0.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(0.25F, KeyframeAnimations.posVec(0.5F, 0.0F, -0.5F), Interpolations.LINEAR), + new Keyframe(0.75F, KeyframeAnimations.posVec(-0.5F, 0.0F, -0.5F), Interpolations.LINEAR), + new Keyframe(1.25F, KeyframeAnimations.posVec(-0.5F, 0.0F, 0.5F), Interpolations.LINEAR), + new Keyframe(1.75F, KeyframeAnimations.posVec(0.5F, 0.0F, 0.5F), Interpolations.LINEAR), + new Keyframe(2.0F, KeyframeAnimations.posVec(0.5F, 0.0F, 0.0F), Interpolations.LINEAR) ) ) .addAnimation( "wind_mid", new AnimationChannel( - AnimationChannel.Targets.ROTATION, - new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), - new Keyframe(0.25F, KeyframeAnimations.degreeVec(12.5F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), - new Keyframe(0.75F, KeyframeAnimations.degreeVec(12.5F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), - new Keyframe(0.9167F, KeyframeAnimations.degreeVec(-10.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), - new Keyframe(1.125F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR) + Targets.POSITION, + new Keyframe(0.0F, KeyframeAnimations.posVec(0.5F, 0.0F, -0.5F), Interpolations.LINEAR), + new Keyframe(0.5F, KeyframeAnimations.posVec(-0.5F, 0.0F, -0.5F), Interpolations.LINEAR), + new Keyframe(1.0F, KeyframeAnimations.posVec(-0.5F, 0.0F, 0.5F), Interpolations.LINEAR), + new Keyframe(1.5F, KeyframeAnimations.posVec(0.5F, 0.0F, 0.5F), Interpolations.LINEAR), + new Keyframe(2.0F, KeyframeAnimations.posVec(0.5F, 0.0F, -0.5F), Interpolations.LINEAR) ) ) .addAnimation( - "wind_mid", + "head", new AnimationChannel( - AnimationChannel.Targets.POSITION, - new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), - new Keyframe(0.25F, KeyframeAnimations.posVec(0.0F, 0.0F, 5.0F), AnimationChannel.Interpolations.LINEAR), - new Keyframe(0.75F, KeyframeAnimations.posVec(0.0F, 0.0F, 6.0F), AnimationChannel.Interpolations.LINEAR), - new Keyframe(0.9167F, KeyframeAnimations.posVec(0.0F, 0.0F, -2.0F), AnimationChannel.Interpolations.LINEAR), - new Keyframe(1.125F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR) - ) - ) - .addAnimation( - "wind_top", - new AnimationChannel( - AnimationChannel.Targets.ROTATION, - new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), - new Keyframe(0.25F, KeyframeAnimations.degreeVec(15.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), - new Keyframe(0.75F, KeyframeAnimations.degreeVec(15.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), - new Keyframe(0.9167F, KeyframeAnimations.degreeVec(-10.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), - new Keyframe(1.125F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR) - ) - ) - .addAnimation( - "wind_top", - new AnimationChannel( - AnimationChannel.Targets.POSITION, - new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), - new Keyframe(0.25F, KeyframeAnimations.posVec(0.0F, 0.0F, 3.0F), AnimationChannel.Interpolations.LINEAR), - new Keyframe(0.8333F, KeyframeAnimations.posVec(0.0F, 0.0F, 4.0F), AnimationChannel.Interpolations.LINEAR), - new Keyframe(0.9583F, KeyframeAnimations.posVec(0.0F, 0.0F, -2.0F), AnimationChannel.Interpolations.LINEAR), - new Keyframe(1.125F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR) - ) - ) - .addAnimation( - "body", - new AnimationChannel( - AnimationChannel.Targets.ROTATION, - new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), - new Keyframe(0.25F, KeyframeAnimations.degreeVec(12.5F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), - new Keyframe(0.75F, KeyframeAnimations.degreeVec(12.5F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), - new Keyframe(0.9167F, KeyframeAnimations.degreeVec(-2.5F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), - new Keyframe(1.125F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR) - ) - ) - .addAnimation( - "body", - new AnimationChannel( - AnimationChannel.Targets.POSITION, - new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), - new Keyframe(0.25F, KeyframeAnimations.posVec(0.0F, 3.0F, 5.0F), AnimationChannel.Interpolations.LINEAR), - new Keyframe(0.8333F, KeyframeAnimations.posVec(0.0F, 3.0F, 6.0F), AnimationChannel.Interpolations.LINEAR), - new Keyframe(0.9583F, KeyframeAnimations.posVec(0.0F, 3.0F, -1.0F), AnimationChannel.Interpolations.LINEAR), - new Keyframe(1.125F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR) + Targets.POSITION, + new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), Interpolations.CATMULLROM), + new Keyframe(1.0F, KeyframeAnimations.posVec(0.0F, 1.0F, 0.0F), Interpolations.CATMULLROM), + new Keyframe(2.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), Interpolations.CATMULLROM) ) ) .addAnimation( "rods", new AnimationChannel( - AnimationChannel.Targets.ROTATION, - new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), - new Keyframe(1.0F, KeyframeAnimations.degreeVec(0.0F, 360.0F, 0.0F), AnimationChannel.Interpolations.LINEAR) + Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(2.0F, KeyframeAnimations.degreeVec(0.0F, 1080.0F, 0.0F), Interpolations.LINEAR) + ) + ) + .addAnimation( + "rods", + new AnimationChannel( + Targets.POSITION, + new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(1.0F, KeyframeAnimations.posVec(0.0F, -1.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(2.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), Interpolations.LINEAR) ) ) .build(); - public static final AnimationDefinition JUMP = AnimationDefinition.Builder.withLength(1.125F) + public static final AnimationDefinition SHOOT = Builder.withLength(1.125F) .addAnimation( - "body", + "head", new AnimationChannel( - AnimationChannel.Targets.POSITION, - new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), - new Keyframe(0.5F, KeyframeAnimations.posVec(0.0F, -10.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), - new Keyframe(0.625F, KeyframeAnimations.posVec(0.0F, -10.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), - new Keyframe(0.75F, KeyframeAnimations.posVec(0.0F, 11.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), - new Keyframe(1.125F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR) + Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(0.25F, KeyframeAnimations.degreeVec(-12.5F, 0.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(0.75F, KeyframeAnimations.degreeVec(-12.5F, 0.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(0.9167F, KeyframeAnimations.degreeVec(5.0F, 0.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(1.125F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), Interpolations.LINEAR) ) ) .addAnimation( "head", new AnimationChannel( - AnimationChannel.Targets.ROTATION, - new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), - new Keyframe(0.5F, KeyframeAnimations.degreeVec(22.5F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), - new Keyframe(0.625F, KeyframeAnimations.degreeVec(22.5F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), - new Keyframe(0.8333F, KeyframeAnimations.degreeVec(-19.25F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), - new Keyframe(1.125F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR) + Targets.POSITION, + new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(0.25F, KeyframeAnimations.posVec(0.0F, -2.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(0.7917F, KeyframeAnimations.posVec(0.0F, -1.0F, 2.0F), Interpolations.LINEAR), + new Keyframe(0.9583F, KeyframeAnimations.posVec(0.0F, -1.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(1.125F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), Interpolations.LINEAR) + ) + ) + .addAnimation( + "wind_bottom", new AnimationChannel(Targets.ROTATION, new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), Interpolations.LINEAR)) + ) + .addAnimation( + "wind_mid", + new AnimationChannel( + Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(0.25F, KeyframeAnimations.degreeVec(12.5F, 0.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(0.75F, KeyframeAnimations.degreeVec(12.5F, 0.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(0.9167F, KeyframeAnimations.degreeVec(-10.0F, 0.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(1.125F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), Interpolations.LINEAR) + ) + ) + .addAnimation( + "wind_mid", + new AnimationChannel( + Targets.POSITION, + new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(0.25F, KeyframeAnimations.posVec(0.0F, 0.0F, 5.0F), Interpolations.LINEAR), + new Keyframe(0.75F, KeyframeAnimations.posVec(0.0F, 0.0F, 6.0F), Interpolations.LINEAR), + new Keyframe(0.9167F, KeyframeAnimations.posVec(0.0F, 0.0F, -2.0F), Interpolations.LINEAR), + new Keyframe(1.125F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), Interpolations.LINEAR) + ) + ) + .addAnimation( + "wind_top", + new AnimationChannel( + Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(0.25F, KeyframeAnimations.degreeVec(15.0F, 0.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(0.75F, KeyframeAnimations.degreeVec(15.0F, 0.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(0.9167F, KeyframeAnimations.degreeVec(-10.0F, 0.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(1.125F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), Interpolations.LINEAR) + ) + ) + .addAnimation( + "wind_top", + new AnimationChannel( + Targets.POSITION, + new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(0.25F, KeyframeAnimations.posVec(0.0F, 0.0F, 3.0F), Interpolations.LINEAR), + new Keyframe(0.8333F, KeyframeAnimations.posVec(0.0F, 0.0F, 4.0F), Interpolations.LINEAR), + new Keyframe(0.9583F, KeyframeAnimations.posVec(0.0F, 0.0F, -2.0F), Interpolations.LINEAR), + new Keyframe(1.125F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), Interpolations.LINEAR) + ) + ) + .addAnimation( + "body", + new AnimationChannel( + Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(0.25F, KeyframeAnimations.degreeVec(12.5F, 0.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(0.75F, KeyframeAnimations.degreeVec(12.5F, 0.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(0.9167F, KeyframeAnimations.degreeVec(-2.5F, 0.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(1.125F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), Interpolations.LINEAR) + ) + ) + .addAnimation( + "body", + new AnimationChannel( + Targets.POSITION, + new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(0.25F, KeyframeAnimations.posVec(0.0F, 3.0F, 5.0F), Interpolations.LINEAR), + new Keyframe(0.8333F, KeyframeAnimations.posVec(0.0F, 3.0F, 6.0F), Interpolations.LINEAR), + new Keyframe(0.9583F, KeyframeAnimations.posVec(0.0F, 3.0F, -1.0F), Interpolations.LINEAR), + new Keyframe(1.125F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), Interpolations.LINEAR) + ) + ) + .addAnimation( + "rods", + new AnimationChannel( + Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(1.0F, KeyframeAnimations.degreeVec(0.0F, 360.0F, 0.0F), Interpolations.LINEAR) + ) + ) + .build(); + public static final AnimationDefinition JUMP = Builder.withLength(0.5F) + .addAnimation( + "body", + new AnimationChannel( + Targets.POSITION, + new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, -10.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(0.125F, KeyframeAnimations.posVec(0.0F, 11.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(0.5F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), Interpolations.LINEAR) + ) + ) + .addAnimation( + "head", + new AnimationChannel( + Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(22.5F, 0.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(0.2083F, KeyframeAnimations.degreeVec(-19.25F, 0.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(0.5F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), Interpolations.LINEAR) ) ) .addAnimation( "wind_body", new AnimationChannel( - AnimationChannel.Targets.SCALE, - new Keyframe(0.0F, KeyframeAnimations.scaleVec(1.0, 1.0, 1.0), AnimationChannel.Interpolations.LINEAR), - new Keyframe(0.5F, KeyframeAnimations.scaleVec(1.0, 1.0, 1.0), AnimationChannel.Interpolations.LINEAR), - new Keyframe(0.625F, KeyframeAnimations.scaleVec(1.0, 1.0, 1.0), AnimationChannel.Interpolations.LINEAR), - new Keyframe(0.75F, KeyframeAnimations.scaleVec(1.0, 1.3F, 1.0), AnimationChannel.Interpolations.LINEAR), - new Keyframe(1.125F, KeyframeAnimations.scaleVec(1.0, 1.0, 1.0), AnimationChannel.Interpolations.LINEAR) + Targets.SCALE, + new Keyframe(0.0F, KeyframeAnimations.scaleVec(1.0, 1.0, 1.0), Interpolations.LINEAR), + new Keyframe(0.125F, KeyframeAnimations.scaleVec(1.0, 1.3F, 1.0), Interpolations.LINEAR), + new Keyframe(0.5F, KeyframeAnimations.scaleVec(1.0, 1.0, 1.0), Interpolations.LINEAR) ) ) .addAnimation( "wind_bottom", new AnimationChannel( - AnimationChannel.Targets.ROTATION, - new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), - new Keyframe(0.625F, KeyframeAnimations.degreeVec(0.0F, 90.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), - new Keyframe(1.125F, KeyframeAnimations.degreeVec(0.0F, 360.0F, 0.0F), AnimationChannel.Interpolations.LINEAR) + Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 90.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(0.5F, KeyframeAnimations.degreeVec(0.0F, 360.0F, 0.0F), Interpolations.LINEAR) ) ) .addAnimation( "wind_bottom", new AnimationChannel( - AnimationChannel.Targets.SCALE, - new Keyframe(0.0F, KeyframeAnimations.scaleVec(1.0, 1.0, 1.0), AnimationChannel.Interpolations.LINEAR), - new Keyframe(0.5F, KeyframeAnimations.scaleVec(1.0, 1.0, 1.0), AnimationChannel.Interpolations.LINEAR), - new Keyframe(0.625F, KeyframeAnimations.scaleVec(1.0, 1.0, 1.0), AnimationChannel.Interpolations.LINEAR), - new Keyframe(0.75F, KeyframeAnimations.scaleVec(1.0, 1.1F, 1.0), AnimationChannel.Interpolations.LINEAR), - new Keyframe(1.125F, KeyframeAnimations.scaleVec(1.0, 1.0, 1.0), AnimationChannel.Interpolations.LINEAR) + Targets.SCALE, + new Keyframe(0.0F, KeyframeAnimations.scaleVec(1.0, 1.0, 1.0), Interpolations.LINEAR), + new Keyframe(0.125F, KeyframeAnimations.scaleVec(1.0, 1.1F, 1.0), Interpolations.LINEAR), + new Keyframe(0.5F, KeyframeAnimations.scaleVec(1.0, 1.0, 1.0), Interpolations.LINEAR) ) ) .addAnimation( "wind_mid", new AnimationChannel( - AnimationChannel.Targets.ROTATION, - new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), - new Keyframe(0.625F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), - new Keyframe(1.125F, KeyframeAnimations.degreeVec(0.0F, 180.0F, 0.0F), AnimationChannel.Interpolations.LINEAR) + Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(0.5F, KeyframeAnimations.degreeVec(0.0F, 180.0F, 0.0F), Interpolations.LINEAR) ) ) .addAnimation( "wind_mid", new AnimationChannel( - AnimationChannel.Targets.POSITION, - new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), - new Keyframe(0.5F, KeyframeAnimations.posVec(0.0F, -6.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), - new Keyframe(0.625F, KeyframeAnimations.posVec(0.0F, -6.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), - new Keyframe(0.75F, KeyframeAnimations.posVec(0.0F, 2.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), - new Keyframe(1.125F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR) + Targets.POSITION, + new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, -6.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(0.125F, KeyframeAnimations.posVec(0.0F, 2.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(0.5F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), Interpolations.LINEAR) ) ) .addAnimation( "wind_top", new AnimationChannel( - AnimationChannel.Targets.ROTATION, - new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), - new Keyframe(0.625F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), - new Keyframe(1.125F, KeyframeAnimations.degreeVec(0.0F, 90.0F, 0.0F), AnimationChannel.Interpolations.LINEAR) + Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(0.5F, KeyframeAnimations.degreeVec(0.0F, 90.0F, 0.0F), Interpolations.LINEAR) ) ) .addAnimation( "wind_top", new AnimationChannel( - AnimationChannel.Targets.POSITION, - new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), - new Keyframe(0.5F, KeyframeAnimations.posVec(0.0F, -5.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), - new Keyframe(0.625F, KeyframeAnimations.posVec(0.0F, -5.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), - new Keyframe(0.75F, KeyframeAnimations.posVec(0.0F, 2.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), - new Keyframe(1.125F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR) + Targets.POSITION, + new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, -5.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(0.125F, KeyframeAnimations.posVec(0.0F, 2.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(0.5F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), Interpolations.LINEAR) ) ) .addAnimation( "rods", new AnimationChannel( - AnimationChannel.Targets.ROTATION, - new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), - new Keyframe(0.8333F, KeyframeAnimations.degreeVec(0.0F, 360.0F, 0.0F), AnimationChannel.Interpolations.LINEAR) + Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(0.5F, KeyframeAnimations.degreeVec(0.0F, 360.0F, 0.0F), Interpolations.LINEAR) ) ) .build(); - public static final AnimationDefinition SLIDE = AnimationDefinition.Builder.withLength(0.2F) + public static final AnimationDefinition INHALE = Builder.withLength(2.0F) .addAnimation( "body", new AnimationChannel( - AnimationChannel.Targets.POSITION, - new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), - new Keyframe(0.2F, KeyframeAnimations.posVec(0.0F, 0.0F, -6.0F), AnimationChannel.Interpolations.LINEAR) + Targets.POSITION, + new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(0.5F, KeyframeAnimations.posVec(0.0F, -10.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(0.625F, KeyframeAnimations.posVec(0.0F, -10.0F, 0.0F), Interpolations.LINEAR) + ) + ) + .addAnimation( + "head", + new AnimationChannel( + Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(0.5F, KeyframeAnimations.degreeVec(22.5F, 0.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(0.625F, KeyframeAnimations.degreeVec(22.5F, 0.0F, 0.0F), Interpolations.LINEAR) + ) + ) + .addAnimation( + "wind_body", + new AnimationChannel( + Targets.SCALE, + new Keyframe(0.0F, KeyframeAnimations.scaleVec(1.0, 1.0, 1.0), Interpolations.LINEAR), + new Keyframe(0.5F, KeyframeAnimations.scaleVec(1.0, 1.0, 1.0), Interpolations.LINEAR), + new Keyframe(0.625F, KeyframeAnimations.scaleVec(1.0, 1.0, 1.0), Interpolations.LINEAR) + ) + ) + .addAnimation( + "wind_bottom", + new AnimationChannel( + Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(0.625F, KeyframeAnimations.degreeVec(0.0F, 90.0F, 0.0F), Interpolations.LINEAR) + ) + ) + .addAnimation( + "wind_bottom", + new AnimationChannel( + Targets.SCALE, + new Keyframe(0.0F, KeyframeAnimations.scaleVec(1.0, 1.0, 1.0), Interpolations.LINEAR), + new Keyframe(0.5F, KeyframeAnimations.scaleVec(1.0, 1.0, 1.0), Interpolations.LINEAR), + new Keyframe(0.625F, KeyframeAnimations.scaleVec(1.0, 1.0, 1.0), Interpolations.LINEAR) ) ) .addAnimation( "wind_mid", new AnimationChannel( - AnimationChannel.Targets.POSITION, - new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), - new Keyframe(0.2F, KeyframeAnimations.posVec(0.0F, 0.0F, -3.0F), AnimationChannel.Interpolations.LINEAR) - ) - ) - .addAnimation( - "wind_top", - new AnimationChannel( - AnimationChannel.Targets.POSITION, - new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), - new Keyframe(0.2F, KeyframeAnimations.posVec(0.0F, 0.0F, -2.0F), AnimationChannel.Interpolations.LINEAR) - ) - ) - .build(); - public static final AnimationDefinition SLIDE_BACK = AnimationDefinition.Builder.withLength(0.1F) - .addAnimation( - "body", - new AnimationChannel( - AnimationChannel.Targets.POSITION, - new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 0.0F, -6.0F), AnimationChannel.Interpolations.LINEAR), - new Keyframe(0.1F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR) + Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(0.625F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), Interpolations.LINEAR) ) ) .addAnimation( "wind_mid", new AnimationChannel( - AnimationChannel.Targets.POSITION, - new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 0.0F, -3.0F), AnimationChannel.Interpolations.LINEAR), - new Keyframe(0.1F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR) + Targets.POSITION, + new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(0.5F, KeyframeAnimations.posVec(0.0F, -6.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(0.625F, KeyframeAnimations.posVec(0.0F, -6.0F, 0.0F), Interpolations.LINEAR) ) ) .addAnimation( "wind_top", new AnimationChannel( - AnimationChannel.Targets.POSITION, - new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 0.0F, -2.0F), AnimationChannel.Interpolations.LINEAR), - new Keyframe(0.1F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR) + Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(0.625F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), Interpolations.LINEAR) + ) + ) + .addAnimation( + "wind_top", + new AnimationChannel( + Targets.POSITION, + new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(0.5F, KeyframeAnimations.posVec(0.0F, -5.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(0.625F, KeyframeAnimations.posVec(0.0F, -5.0F, 0.0F), Interpolations.LINEAR) + ) + ) + .addAnimation( + "rods", + new AnimationChannel( + Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(0.625F, KeyframeAnimations.degreeVec(0.0F, 360.0F, 0.0F), Interpolations.LINEAR) + ) + ) + .build(); + public static final AnimationDefinition SLIDE = Builder.withLength(0.2F) + .addAnimation( + "body", + new AnimationChannel( + Targets.POSITION, + new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(0.2F, KeyframeAnimations.posVec(0.0F, 0.0F, -6.0F), Interpolations.LINEAR) + ) + ) + .addAnimation( + "wind_mid", + new AnimationChannel( + Targets.POSITION, + new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(0.2F, KeyframeAnimations.posVec(0.0F, 0.0F, -3.0F), Interpolations.LINEAR) + ) + ) + .addAnimation( + "wind_top", + new AnimationChannel( + Targets.POSITION, + new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(0.2F, KeyframeAnimations.posVec(0.0F, 0.0F, -2.0F), Interpolations.LINEAR) + ) + ) + .build(); + public static final AnimationDefinition SLIDE_BACK = Builder.withLength(0.1F) + .addAnimation( + "body", + new AnimationChannel( + Targets.POSITION, + new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 0.0F, -6.0F), Interpolations.LINEAR), + new Keyframe(0.1F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), Interpolations.LINEAR) + ) + ) + .addAnimation( + "wind_mid", + new AnimationChannel( + Targets.POSITION, + new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 0.0F, -3.0F), Interpolations.LINEAR), + new Keyframe(0.1F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), Interpolations.LINEAR) + ) + ) + .addAnimation( + "wind_top", + new AnimationChannel( + Targets.POSITION, + new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 0.0F, -2.0F), Interpolations.LINEAR), + new Keyframe(0.1F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), Interpolations.LINEAR) ) ) .build(); diff --git a/net/minecraft/client/animation/definitions/CreakingAnimation.java b/net/minecraft/client/animation/definitions/CreakingAnimation.java new file mode 100644 index 00000000..c54feda7 --- /dev/null +++ b/net/minecraft/client/animation/definitions/CreakingAnimation.java @@ -0,0 +1,238 @@ +package net.minecraft.client.animation.definitions; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.client.animation.AnimationChannel; +import net.minecraft.client.animation.AnimationDefinition; +import net.minecraft.client.animation.Keyframe; +import net.minecraft.client.animation.KeyframeAnimations; +import net.minecraft.client.animation.AnimationChannel.Interpolations; +import net.minecraft.client.animation.AnimationChannel.Targets; +import net.minecraft.client.animation.AnimationDefinition.Builder; + +@Environment(EnvType.CLIENT) +public class CreakingAnimation { + public static final AnimationDefinition CREAKING_WALK = Builder.withLength(1.5F) + .looping() + .addAnimation("head", new AnimationChannel(Targets.POSITION, new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), Interpolations.LINEAR))) + .addAnimation("body", new AnimationChannel(Targets.POSITION, new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 0.0F, -1.0F), Interpolations.LINEAR))) + .addAnimation( + "right_arm", + new AnimationChannel( + Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(10.0F, 0.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(0.25F, KeyframeAnimations.degreeVec(-7.5F, 0.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(0.4167F, KeyframeAnimations.degreeVec(7.5F, 0.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(0.9167F, KeyframeAnimations.degreeVec(-10.0F, 0.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(1.0833F, KeyframeAnimations.degreeVec(-22.5F, 0.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(1.3333F, KeyframeAnimations.degreeVec(10.0F, 0.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(1.5F, KeyframeAnimations.degreeVec(10.0F, 0.0F, 0.0F), Interpolations.LINEAR) + ) + ) + .addAnimation( + "right_arm", + new AnimationChannel( + Targets.POSITION, + new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(1.5F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), Interpolations.LINEAR) + ) + ) + .addAnimation( + "left_arm", + new AnimationChannel( + Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(-22.5F, 0.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(0.25F, KeyframeAnimations.degreeVec(17.5F, 0.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(0.4167F, KeyframeAnimations.degreeVec(-10.0F, 0.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(0.9167F, KeyframeAnimations.degreeVec(17.5F, 0.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(1.0833F, KeyframeAnimations.degreeVec(30.0F, 0.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(1.3333F, KeyframeAnimations.degreeVec(-30.0F, 0.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(1.5F, KeyframeAnimations.degreeVec(-22.5F, 0.0F, 0.0F), Interpolations.LINEAR) + ) + ) + .addAnimation( + "left_arm", + new AnimationChannel( + Targets.POSITION, + new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(1.5F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), Interpolations.LINEAR) + ) + ) + .addAnimation( + "left_leg", + new AnimationChannel( + Targets.ROTATION, + new Keyframe(0.3333F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(0.5F, KeyframeAnimations.degreeVec(40.0F, 0.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(0.6667F, KeyframeAnimations.degreeVec(60.0F, 0.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(0.8333F, KeyframeAnimations.degreeVec(22.5F, 0.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(1.0F, KeyframeAnimations.degreeVec(-50.0F, 0.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(1.1667F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(1.3333F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(1.5F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), Interpolations.LINEAR) + ) + ) + .addAnimation( + "left_leg", + new AnimationChannel( + Targets.POSITION, + new Keyframe(0.3333F, KeyframeAnimations.posVec(0.0F, 0.0F, 2.0F), Interpolations.LINEAR), + new Keyframe(0.5F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.5F), Interpolations.LINEAR), + new Keyframe(0.6667F, KeyframeAnimations.posVec(0.0F, 0.0F, -1.0F), Interpolations.LINEAR), + new Keyframe(0.8333F, KeyframeAnimations.posVec(0.0F, 2.0F, -3.5F), Interpolations.LINEAR), + new Keyframe(1.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(1.1667F, KeyframeAnimations.posVec(0.0F, 0.0F, -2.0F), Interpolations.LINEAR), + new Keyframe(1.3333F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(1.5F, KeyframeAnimations.posVec(0.0F, 0.0F, 2.0F), Interpolations.LINEAR) + ) + ) + .addAnimation( + "right_leg", + new AnimationChannel( + Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(22.5F, 0.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(0.1667F, KeyframeAnimations.degreeVec(-50.0F, 0.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(0.3333F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(0.5F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(0.6667F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(1.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(1.1667F, KeyframeAnimations.degreeVec(40.0F, 0.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(1.3333F, KeyframeAnimations.degreeVec(60.0F, 0.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(1.5F, KeyframeAnimations.degreeVec(22.5F, 0.0F, 0.0F), Interpolations.LINEAR) + ) + ) + .addAnimation( + "right_leg", + new AnimationChannel( + Targets.POSITION, + new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 2.0F, -3.5F), Interpolations.LINEAR), + new Keyframe(0.1667F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(0.3333F, KeyframeAnimations.posVec(0.0F, 0.0F, -2.0F), Interpolations.LINEAR), + new Keyframe(0.5F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(0.6667F, KeyframeAnimations.posVec(0.0F, 0.0F, 2.0F), Interpolations.LINEAR), + new Keyframe(1.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 2.0F), Interpolations.LINEAR), + new Keyframe(1.1667F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.5F), Interpolations.LINEAR), + new Keyframe(1.3333F, KeyframeAnimations.posVec(0.0F, 0.0F, -1.0F), Interpolations.LINEAR), + new Keyframe(1.5F, KeyframeAnimations.posVec(0.0F, 2.0F, -3.5F), Interpolations.LINEAR) + ) + ) + .addAnimation( + "upper_body", + new AnimationChannel( + Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(5.0F, 0.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(0.25F, KeyframeAnimations.degreeVec(-7.5F, 0.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(0.6667F, KeyframeAnimations.degreeVec(5.0F, 0.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(0.8333F, KeyframeAnimations.degreeVec(5.0F, 0.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(1.0833F, KeyframeAnimations.degreeVec(-7.5F, 0.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(1.3333F, KeyframeAnimations.degreeVec(5.0F, 0.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(1.5F, KeyframeAnimations.degreeVec(5.0F, 0.0F, 0.0F), Interpolations.LINEAR) + ) + ) + .addAnimation( + "upper_body", + new AnimationChannel( + Targets.POSITION, + new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(0.25F, KeyframeAnimations.posVec(0.0F, 0.0F, 1.0F), Interpolations.LINEAR), + new Keyframe(0.6667F, KeyframeAnimations.posVec(0.0F, 0.0F, 1.0F), Interpolations.LINEAR), + new Keyframe(0.8333F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(1.0833F, KeyframeAnimations.posVec(0.0F, 0.0F, 1.0F), Interpolations.LINEAR), + new Keyframe(1.3333F, KeyframeAnimations.posVec(0.0F, 0.0F, 1.0F), Interpolations.LINEAR), + new Keyframe(1.5F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), Interpolations.LINEAR) + ) + ) + .build(); + public static final AnimationDefinition CREAKING_ATTACK = Builder.withLength(0.375F) + .addAnimation( + "right_arm", + new AnimationChannel( + Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(21.1693F, 37.7555F, 122.3122F), Interpolations.LINEAR), + new Keyframe(0.125F, KeyframeAnimations.degreeVec(-60.349F, -31.3213F, -16.4846F), Interpolations.LINEAR), + new Keyframe(0.25F, KeyframeAnimations.degreeVec(-54.3924F, -22.7992F, -27.3049F), Interpolations.LINEAR), + new Keyframe(0.2917F, KeyframeAnimations.degreeVec(-53.0231F, -26.8304F, -30.5649F), Interpolations.LINEAR), + new Keyframe(0.375F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), Interpolations.LINEAR) + ) + ) + .addAnimation( + "left_arm", + new AnimationChannel( + Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(15.0F, 0.0F, -10.0F), Interpolations.LINEAR), + new Keyframe(0.125F, KeyframeAnimations.degreeVec(22.4229F, 1.9113F, -14.6211F), Interpolations.LINEAR), + new Keyframe(0.25F, KeyframeAnimations.degreeVec(38.9206F, -9.562F, -4.6084F), Interpolations.LINEAR), + new Keyframe(0.2917F, KeyframeAnimations.degreeVec(51.4206F, -9.562F, -4.6084F), Interpolations.LINEAR), + new Keyframe(0.375F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), Interpolations.LINEAR) + ) + ) + .addAnimation( + "upper_body", + new AnimationChannel( + Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(-12.5F, 0.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(0.125F, KeyframeAnimations.degreeVec(11.1575F, 0.2125F, -2.2036F), Interpolations.LINEAR), + new Keyframe(0.25F, KeyframeAnimations.degreeVec(22.5F, 0.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(0.2917F, KeyframeAnimations.degreeVec(25.0F, 0.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(0.375F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), Interpolations.LINEAR) + ) + ) + .build(); + public static final AnimationDefinition CREAKING_INVULNERABLE = Builder.withLength(0.2917F) + .addAnimation( + "upper_body", + new AnimationChannel( + Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(0.0833F, KeyframeAnimations.degreeVec(-5.0F, 0.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(0.1667F, KeyframeAnimations.degreeVec(5.0F, 0.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(0.25F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), Interpolations.LINEAR) + ) + ) + .addAnimation( + "upper_body", + new AnimationChannel( + Targets.POSITION, + new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(0.0833F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(0.25F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), Interpolations.LINEAR) + ) + ) + .addAnimation( + "right_arm", + new AnimationChannel( + Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(0.0833F, KeyframeAnimations.degreeVec(17.5F, 0.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(0.1667F, KeyframeAnimations.degreeVec(-15.0F, 0.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(0.25F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), Interpolations.LINEAR) + ) + ) + .addAnimation( + "right_arm", + new AnimationChannel( + Targets.POSITION, + new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(0.25F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), Interpolations.LINEAR) + ) + ) + .addAnimation( + "left_arm", + new AnimationChannel( + Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(0.0833F, KeyframeAnimations.degreeVec(20.0F, 0.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(0.1667F, KeyframeAnimations.degreeVec(-15.0F, 0.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(0.25F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), Interpolations.LINEAR) + ) + ) + .addAnimation( + "left_arm", + new AnimationChannel( + Targets.POSITION, + new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), Interpolations.LINEAR), + new Keyframe(0.25F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), Interpolations.LINEAR) + ) + ) + .build(); +} diff --git a/net/minecraft/client/color/block/BlockColors.java b/net/minecraft/client/color/block/BlockColors.java index a576ca53..9c9ed41b 100644 --- a/net/minecraft/client/color/block/BlockColors.java +++ b/net/minecraft/client/color/block/BlockColors.java @@ -10,7 +10,7 @@ import net.minecraft.client.renderer.BiomeColors; import net.minecraft.core.BlockPos; import net.minecraft.core.IdMapper; import net.minecraft.core.registries.BuiltInRegistries; -import net.minecraft.util.FastColor; +import net.minecraft.util.ARGB; import net.minecraft.world.level.BlockAndTintGetter; import net.minecraft.world.level.FoliageColor; import net.minecraft.world.level.GrassColor; @@ -93,7 +93,7 @@ public class BlockColors { blockColors.register((blockState, blockAndTintGetter, blockPos, i) -> -2046180, Blocks.ATTACHED_MELON_STEM, Blocks.ATTACHED_PUMPKIN_STEM); blockColors.register((blockState, blockAndTintGetter, blockPos, i) -> { int j = (Integer)blockState.getValue(StemBlock.AGE); - return FastColor.ARGB32.color(j * 32, 255 - j * 8, j * 4); + return ARGB.color(j * 32, 255 - j * 8, j * 4); }, Blocks.MELON_STEM, Blocks.PUMPKIN_STEM); blockColors.addColoringState(StemBlock.AGE, Blocks.MELON_STEM, Blocks.PUMPKIN_STEM); blockColors.register((blockState, blockAndTintGetter, blockPos, i) -> blockAndTintGetter != null && blockPos != null ? -14647248 : -9321636, Blocks.LILY_PAD); diff --git a/net/minecraft/client/color/item/ItemColors.java b/net/minecraft/client/color/item/ItemColors.java index 44c8375a..0872701f 100644 --- a/net/minecraft/client/color/item/ItemColors.java +++ b/net/minecraft/client/color/item/ItemColors.java @@ -7,7 +7,7 @@ import net.minecraft.client.color.block.BlockColors; import net.minecraft.core.IdMapper; import net.minecraft.core.component.DataComponents; import net.minecraft.core.registries.BuiltInRegistries; -import net.minecraft.util.FastColor; +import net.minecraft.util.ARGB; import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; @@ -50,7 +50,7 @@ public class ItemColors { if (j == 0) { return -7697782; } else if (j == 1) { - return FastColor.ARGB32.opaque(intList.getInt(0)); + return ARGB.opaque(intList.getInt(0)); } else { int k = 0; int l = 0; @@ -58,17 +58,17 @@ public class ItemColors { for (int n = 0; n < j; n++) { int o = intList.getInt(n); - k += FastColor.ARGB32.red(o); - l += FastColor.ARGB32.green(o); - m += FastColor.ARGB32.blue(o); + k += ARGB.red(o); + l += ARGB.green(o); + m += ARGB.blue(o); } - return FastColor.ARGB32.color(k / j, l / j, m / j); + return ARGB.color(k / j, l / j, m / j); } } }, Items.FIREWORK_STAR); itemColors.register( - (itemStack, i) -> i > 0 ? -1 : FastColor.ARGB32.opaque(itemStack.getOrDefault(DataComponents.POTION_CONTENTS, PotionContents.EMPTY).getColor()), + (itemStack, i) -> i > 0 ? -1 : ARGB.opaque(itemStack.getOrDefault(DataComponents.POTION_CONTENTS, PotionContents.EMPTY).getColor()), Items.POTION, Items.SPLASH_POTION, Items.LINGERING_POTION, @@ -76,7 +76,7 @@ public class ItemColors { ); for (SpawnEggItem spawnEggItem : SpawnEggItem.eggs()) { - itemColors.register((itemStack, i) -> FastColor.ARGB32.opaque(spawnEggItem.getColor(i)), spawnEggItem); + itemColors.register((itemStack, i) -> ARGB.opaque(spawnEggItem.getColor(i)), spawnEggItem); } itemColors.register( @@ -98,7 +98,7 @@ public class ItemColors { ); itemColors.register((itemStack, i) -> FoliageColor.getMangroveColor(), Blocks.MANGROVE_LEAVES); itemColors.register( - (itemStack, i) -> i == 0 ? -1 : FastColor.ARGB32.opaque(itemStack.getOrDefault(DataComponents.MAP_COLOR, MapItemColor.DEFAULT).rgb()), Items.FILLED_MAP + (itemStack, i) -> i == 0 ? -1 : ARGB.opaque(itemStack.getOrDefault(DataComponents.MAP_COLOR, MapItemColor.DEFAULT).rgb()), Items.FILLED_MAP ); return itemColors; } diff --git a/net/minecraft/client/gui/BundleMouseActions.java b/net/minecraft/client/gui/BundleMouseActions.java new file mode 100644 index 00000000..a3cadbb0 --- /dev/null +++ b/net/minecraft/client/gui/BundleMouseActions.java @@ -0,0 +1,74 @@ +package net.minecraft.client.gui; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.client.Minecraft; +import net.minecraft.client.ScrollWheelHandler; +import net.minecraft.client.multiplayer.ClientPacketListener; +import net.minecraft.network.protocol.game.ServerboundSelectBundleItemPacket; +import net.minecraft.tags.ItemTags; +import net.minecraft.world.inventory.ClickType; +import net.minecraft.world.inventory.Slot; +import net.minecraft.world.item.BundleItem; +import net.minecraft.world.item.ItemStack; +import org.joml.Vector2i; + +@Environment(EnvType.CLIENT) +public class BundleMouseActions implements ItemSlotMouseAction { + private final Minecraft minecraft; + private final ScrollWheelHandler scrollWheelHandler; + + public BundleMouseActions(Minecraft minecraft) { + this.minecraft = minecraft; + this.scrollWheelHandler = new ScrollWheelHandler(); + } + + @Override + public boolean matches(Slot slot) { + return slot.getItem().is(ItemTags.BUNDLES); + } + + @Override + public boolean onMouseScrolled(double d, double e, int i, ItemStack itemStack) { + int j = BundleItem.getNumberOfItemsToShow(itemStack); + if (j == 0) { + return false; + } else { + Vector2i vector2i = this.scrollWheelHandler.onMouseScroll(d, e); + int k = vector2i.y == 0 ? -vector2i.x : vector2i.y; + if (k != 0) { + int l = BundleItem.getSelectedItem(itemStack); + int m = ScrollWheelHandler.getNextScrollWheelSelection(k, l, j); + if (l != m) { + this.toggleSelectedBundleItem(itemStack, i, m); + } + } + + return true; + } + } + + @Override + public void onStopHovering(Slot slot) { + this.unselectedBundleItem(slot.getItem(), slot.index); + } + + @Override + public void onSlotClicked(Slot slot, ClickType clickType) { + if (clickType == ClickType.QUICK_MOVE || clickType == ClickType.SWAP) { + this.unselectedBundleItem(slot.getItem(), slot.index); + } + } + + private void toggleSelectedBundleItem(ItemStack itemStack, int i, int j) { + if (this.minecraft.getConnection() != null && j < BundleItem.getNumberOfItemsToShow(itemStack)) { + ClientPacketListener clientPacketListener = this.minecraft.getConnection(); + BundleItem.toggleSelectedItem(itemStack, j); + clientPacketListener.send(new ServerboundSelectBundleItemPacket(i, j)); + } + } + + public void unselectedBundleItem(ItemStack itemStack, int i) { + this.toggleSelectedBundleItem(itemStack, i, -1); + } +} diff --git a/net/minecraft/client/gui/Font.java b/net/minecraft/client/gui/Font.java index 8d25e4fd..27b8ea4c 100644 --- a/net/minecraft/client/gui/Font.java +++ b/net/minecraft/client/gui/Font.java @@ -6,6 +6,7 @@ import com.ibm.icu.text.ArabicShapingException; import com.ibm.icu.text.Bidi; import com.mojang.blaze3d.font.GlyphInfo; import com.mojang.blaze3d.vertex.VertexConsumer; +import java.util.ArrayList; import java.util.List; import java.util.function.Function; import net.fabricmc.api.EnvType; @@ -21,6 +22,7 @@ import net.minecraft.network.chat.FormattedText; import net.minecraft.network.chat.Style; import net.minecraft.network.chat.TextColor; import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.ARGB; import net.minecraft.util.FormattedCharSequence; import net.minecraft.util.FormattedCharSink; import net.minecraft.util.Mth; @@ -76,23 +78,11 @@ public class Font { int backgroundColor, int packedLightCoords ) { - return this.drawInBatch(text, x, y, color, dropShadow, matrix, buffer, displayMode, backgroundColor, packedLightCoords, this.isBidirectional()); - } + if (this.isBidirectional()) { + text = this.bidirectionalShaping(text); + } - public int drawInBatch( - String text, - float x, - float y, - int color, - boolean dropShadow, - Matrix4f matrix, - MultiBufferSource buffer, - Font.DisplayMode displayMode, - int backgroundColor, - int packedLightCoords, - boolean bidirectional - ) { - return this.drawInternal(text, x, y, color, dropShadow, matrix, buffer, displayMode, backgroundColor, packedLightCoords, bidirectional); + return this.drawInternal(text, x, y, color, dropShadow, matrix, buffer, displayMode, backgroundColor, packedLightCoords, true); } public int drawInBatch( @@ -107,7 +97,23 @@ public class Font { int backgroundColor, int packedLightCoords ) { - return this.drawInBatch(text.getVisualOrderText(), x, y, color, dropShadow, matrix, buffer, displayMode, backgroundColor, packedLightCoords); + return this.drawInBatch(text, x, y, color, dropShadow, matrix, buffer, displayMode, backgroundColor, packedLightCoords, true); + } + + public int drawInBatch( + Component component, + float f, + float g, + int i, + boolean bl, + Matrix4f matrix4f, + MultiBufferSource multiBufferSource, + Font.DisplayMode displayMode, + int j, + int k, + boolean bl2 + ) { + return this.drawInternal(component.getVisualOrderText(), f, g, i, bl, matrix4f, multiBufferSource, displayMode, j, k, bl2); } public int drawInBatch( @@ -122,7 +128,7 @@ public class Font { int backgroundColor, int packedLightCoords ) { - return this.drawInternal(text, x, y, color, dropShadow, matrix, buffer, displayMode, backgroundColor, packedLightCoords); + return this.drawInternal(text, x, y, color, dropShadow, matrix, buffer, displayMode, backgroundColor, packedLightCoords, true); } public void drawInBatch8xOutline( @@ -152,15 +158,16 @@ public class Font { } } + stringRenderOutput.renderCharacters(); Font.StringRenderOutput stringRenderOutput2 = new Font.StringRenderOutput( bufferSource, x, y, adjustColor(color), false, matrix, Font.DisplayMode.POLYGON_OFFSET, packedLightCoords ); text.accept(stringRenderOutput2); - stringRenderOutput2.finish(0, x); + stringRenderOutput2.finish(x); } private static int adjustColor(int color) { - return (color & -67108864) == 0 ? color | 0xFF000000 : color; + return (color & -67108864) == 0 ? ARGB.opaque(color) : color; } private int drawInternal( @@ -176,97 +183,75 @@ public class Font { int packedLightCoords, boolean bidirectional ) { - if (bidirectional) { - text = this.bidirectionalShaping(text); - } - color = adjustColor(color); Matrix4f matrix4f = new Matrix4f(matrix); if (dropShadow) { - this.renderText(text, x, y, color, true, matrix, buffer, displayMode, backgroundColor, packedLightCoords); + this.renderText(text, x, y, color, true, matrix, buffer, displayMode, backgroundColor, packedLightCoords, bidirectional); matrix4f.translate(SHADOW_OFFSET); } - x = this.renderText(text, x, y, color, false, matrix4f, buffer, displayMode, backgroundColor, packedLightCoords); + x = this.renderText(text, x, y, color, false, matrix4f, buffer, displayMode, backgroundColor, packedLightCoords, bidirectional); return (int)x + (dropShadow ? 1 : 0); } private int drawInternal( - FormattedCharSequence text, - float x, - float y, - int color, - boolean dropShadow, - Matrix4f matrix, - MultiBufferSource buffer, + FormattedCharSequence formattedCharSequence, + float f, + float g, + int i, + boolean bl, + Matrix4f matrix4f, + MultiBufferSource multiBufferSource, Font.DisplayMode displayMode, - int backgroundColor, - int packedLightCoords + int j, + int k, + boolean bl2 ) { - color = adjustColor(color); - Matrix4f matrix4f = new Matrix4f(matrix); - if (dropShadow) { - this.renderText(text, x, y, color, true, matrix, buffer, displayMode, backgroundColor, packedLightCoords); - matrix4f.translate(SHADOW_OFFSET); + i = adjustColor(i); + Matrix4f matrix4f2 = new Matrix4f(matrix4f); + if (bl) { + this.renderText(formattedCharSequence, f, g, i, true, matrix4f, multiBufferSource, displayMode, j, k, bl2); + matrix4f2.translate(SHADOW_OFFSET); } - x = this.renderText(text, x, y, color, false, matrix4f, buffer, displayMode, backgroundColor, packedLightCoords); - return (int)x + (dropShadow ? 1 : 0); + f = this.renderText(formattedCharSequence, f, g, i, false, matrix4f2, multiBufferSource, displayMode, j, k, bl2); + return (int)f + (bl ? 1 : 0); } private float renderText( - String text, - float x, - float y, - int color, - boolean dropShadow, - Matrix4f matrix, - MultiBufferSource buffer, + String string, + float f, + float g, + int i, + boolean bl, + Matrix4f matrix4f, + MultiBufferSource multiBufferSource, Font.DisplayMode displayMode, - int backgroundColor, - int packedLightCoords + int j, + int k, + boolean bl2 ) { - Font.StringRenderOutput stringRenderOutput = new Font.StringRenderOutput(buffer, x, y, color, dropShadow, matrix, displayMode, packedLightCoords); - StringDecomposer.iterateFormatted(text, Style.EMPTY, stringRenderOutput); - return stringRenderOutput.finish(backgroundColor, x); + Font.StringRenderOutput stringRenderOutput = new Font.StringRenderOutput(multiBufferSource, f, g, i, j, bl, matrix4f, displayMode, k, bl2); + StringDecomposer.iterateFormatted(string, Style.EMPTY, stringRenderOutput); + return stringRenderOutput.finish(f); } private float renderText( - FormattedCharSequence text, - float x, - float y, - int color, - boolean dropShadow, - Matrix4f matrix, - MultiBufferSource buffer, + FormattedCharSequence formattedCharSequence, + float f, + float g, + int i, + boolean bl, + Matrix4f matrix4f, + MultiBufferSource multiBufferSource, Font.DisplayMode displayMode, - int backgroundColor, - int packedLightCoords + int j, + int k, + boolean bl2 ) { - Font.StringRenderOutput stringRenderOutput = new Font.StringRenderOutput(buffer, x, y, color, dropShadow, matrix, displayMode, packedLightCoords); - text.accept(stringRenderOutput); - return stringRenderOutput.finish(backgroundColor, x); - } - - void renderChar( - BakedGlyph glyph, - boolean bold, - boolean italic, - float boldOffset, - float x, - float y, - Matrix4f matrix, - VertexConsumer buffer, - float red, - float green, - float blue, - float alpha, - int packedLight - ) { - glyph.render(italic, x, y, matrix, buffer, red, green, blue, alpha, packedLight); - if (bold) { - glyph.render(italic, x + boldOffset, y, matrix, buffer, red, green, blue, alpha, packedLight); - } + Font.StringRenderOutput stringRenderOutput = new Font.StringRenderOutput(multiBufferSource, f, g, i, j, bl, matrix4f, displayMode, k, bl2); + formattedCharSequence.accept(stringRenderOutput); + return stringRenderOutput.finish(f); } /** @@ -334,15 +319,15 @@ public class Font { final MultiBufferSource bufferSource; private final boolean dropShadow; private final float dimFactor; - private final float r; - private final float g; - private final float b; - private final float a; + private final int color; + private final int backgroundColor; private final Matrix4f pose; private final Font.DisplayMode mode; private final int packedLightCoords; + private final boolean inverseDepth; float x; float y; + private final List glyphInstances = new ArrayList(); @Nullable private List effects; @@ -364,18 +349,32 @@ public class Font { final Font.DisplayMode mode, final int packedLightCoords ) { - this.bufferSource = bufferSource; - this.x = x; - this.y = y; - this.dropShadow = dropShadow; - this.dimFactor = dropShadow ? 0.25F : 1.0F; - this.r = (color >> 16 & 0xFF) / 255.0F * this.dimFactor; - this.g = (color >> 8 & 0xFF) / 255.0F * this.dimFactor; - this.b = (color & 0xFF) / 255.0F * this.dimFactor; - this.a = (color >> 24 & 0xFF) / 255.0F; - this.pose = pose; - this.mode = mode; - this.packedLightCoords = packedLightCoords; + this(bufferSource, x, y, color, 0, dropShadow, pose, mode, packedLightCoords, true); + } + + public StringRenderOutput( + final MultiBufferSource multiBufferSource, + final float f, + final float g, + final int i, + final int j, + final boolean bl, + final Matrix4f matrix4f, + final Font.DisplayMode displayMode, + final int k, + final boolean bl2 + ) { + this.bufferSource = multiBufferSource; + this.x = f; + this.y = g; + this.dropShadow = bl; + this.dimFactor = bl ? 0.25F : 1.0F; + this.color = ARGB.scaleRGB(i, this.dimFactor); + this.backgroundColor = j; + this.pose = matrix4f; + this.mode = displayMode; + this.packedLightCoords = k; + this.inverseDepth = bl2; } @Override @@ -384,62 +383,68 @@ public class Font { GlyphInfo glyphInfo = fontSet.getGlyphInfo(j, Font.this.filterFishyGlyphs); BakedGlyph bakedGlyph = style.isObfuscated() && j != 32 ? fontSet.getRandomGlyph(glyphInfo) : fontSet.getGlyph(j); boolean bl = style.isBold(); - float f = this.a; TextColor textColor = style.getColor(); - float g; - float h; - float l; - if (textColor != null) { - int k = textColor.getValue(); - g = (k >> 16 & 0xFF) / 255.0F * this.dimFactor; - h = (k >> 8 & 0xFF) / 255.0F * this.dimFactor; - l = (k & 0xFF) / 255.0F * this.dimFactor; - } else { - g = this.r; - h = this.g; - l = this.b; - } - + int k = textColor != null ? ARGB.color(ARGB.alpha(this.color), ARGB.scaleRGB(textColor.getValue(), this.dimFactor)) : this.color; + float f = glyphInfo.getAdvance(bl); + float g = i == 0 ? this.x - 1.0F : this.x; if (!(bakedGlyph instanceof EmptyGlyph)) { - float m = bl ? glyphInfo.getBoldOffset() : 0.0F; - float n = this.dropShadow ? glyphInfo.getShadowOffset() : 0.0F; - VertexConsumer vertexConsumer = this.bufferSource.getBuffer(bakedGlyph.renderType(this.mode)); - Font.this.renderChar(bakedGlyph, bl, style.isItalic(), m, this.x + n, this.y + n, this.pose, vertexConsumer, g, h, l, f, this.packedLightCoords); + float h = bl ? glyphInfo.getBoldOffset() : 0.0F; + float l = this.dropShadow ? glyphInfo.getShadowOffset() : 0.0F; + this.glyphInstances.add(new BakedGlyph.GlyphInstance(this.x + l, this.y + l, k, bakedGlyph, style, h)); } - float m = glyphInfo.getAdvance(bl); - float n = this.dropShadow ? 1.0F : 0.0F; + float h = this.dropShadow ? 1.0F : 0.0F; if (style.isStrikethrough()) { - this.addEffect(new BakedGlyph.Effect(this.x + n - 1.0F, this.y + n + 4.5F, this.x + n + m, this.y + n + 4.5F - 1.0F, 0.01F, g, h, l, f)); + this.addEffect(new BakedGlyph.Effect(g + h, this.y + h + 4.5F, this.x + h + f, this.y + h + 4.5F - 1.0F, this.getOverTextEffectDepth(), k)); } if (style.isUnderlined()) { - this.addEffect(new BakedGlyph.Effect(this.x + n - 1.0F, this.y + n + 9.0F, this.x + n + m, this.y + n + 9.0F - 1.0F, 0.01F, g, h, l, f)); + this.addEffect(new BakedGlyph.Effect(g + h, this.y + h + 9.0F, this.x + h + f, this.y + h + 9.0F - 1.0F, this.getOverTextEffectDepth(), k)); } - this.x += m; + this.x += f; return true; } - public float finish(int backgroundColor, float x) { - if (backgroundColor != 0) { - float f = (backgroundColor >> 24 & 0xFF) / 255.0F; - float g = (backgroundColor >> 16 & 0xFF) / 255.0F; - float h = (backgroundColor >> 8 & 0xFF) / 255.0F; - float i = (backgroundColor & 0xFF) / 255.0F; - this.addEffect(new BakedGlyph.Effect(x - 1.0F, this.y + 9.0F, this.x + 1.0F, this.y - 1.0F, 0.01F, g, h, i, f)); + float finish(float f) { + BakedGlyph bakedGlyph = null; + if (this.backgroundColor != 0) { + BakedGlyph.Effect effect = new BakedGlyph.Effect(f - 1.0F, this.y + 9.0F, this.x, this.y - 1.0F, this.getUnderTextEffectDepth(), this.backgroundColor); + bakedGlyph = Font.this.getFontSet(Style.DEFAULT_FONT).whiteGlyph(); + VertexConsumer vertexConsumer = this.bufferSource.getBuffer(bakedGlyph.renderType(this.mode)); + bakedGlyph.renderEffect(effect, this.pose, vertexConsumer, this.packedLightCoords); } + this.renderCharacters(); if (this.effects != null) { - BakedGlyph bakedGlyph = Font.this.getFontSet(Style.DEFAULT_FONT).whiteGlyph(); - VertexConsumer vertexConsumer = this.bufferSource.getBuffer(bakedGlyph.renderType(this.mode)); + if (bakedGlyph == null) { + bakedGlyph = Font.this.getFontSet(Style.DEFAULT_FONT).whiteGlyph(); + } - for (BakedGlyph.Effect effect : this.effects) { - bakedGlyph.renderEffect(effect, this.pose, vertexConsumer, this.packedLightCoords); + VertexConsumer vertexConsumer2 = this.bufferSource.getBuffer(bakedGlyph.renderType(this.mode)); + + for (BakedGlyph.Effect effect2 : this.effects) { + bakedGlyph.renderEffect(effect2, this.pose, vertexConsumer2, this.packedLightCoords); } } return this.x; } + + void renderCharacters() { + for (BakedGlyph.GlyphInstance glyphInstance : this.glyphInstances) { + BakedGlyph bakedGlyph = glyphInstance.glyph(); + VertexConsumer vertexConsumer = this.bufferSource.getBuffer(bakedGlyph.renderType(this.mode)); + bakedGlyph.renderChar(glyphInstance, this.pose, vertexConsumer, this.packedLightCoords); + } + } + + private float getOverTextEffectDepth() { + return this.inverseDepth ? 0.01F : -0.01F; + } + + private float getUnderTextEffectDepth() { + return this.inverseDepth ? -0.01F : 0.01F; + } } } diff --git a/net/minecraft/client/gui/Gui.java b/net/minecraft/client/gui/Gui.java index 801211bb..87554588 100644 --- a/net/minecraft/client/gui/Gui.java +++ b/net/minecraft/client/gui/Gui.java @@ -2,12 +2,12 @@ package net.minecraft.client.gui; import com.google.common.collect.Lists; import com.google.common.collect.Ordering; -import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.platform.Window; import com.mojang.blaze3d.systems.RenderSystem; import java.util.Collection; import java.util.Comparator; import java.util.List; +import java.util.function.UnaryOperator; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.ChatFormatting; @@ -23,7 +23,6 @@ import net.minecraft.client.gui.components.DebugScreenOverlay; import net.minecraft.client.gui.components.PlayerTabOverlay; import net.minecraft.client.gui.components.SubtitleOverlay; import net.minecraft.client.gui.components.spectator.SpectatorGui; -import net.minecraft.client.gui.screens.inventory.EffectRenderingInventoryScreen; import net.minecraft.client.renderer.LightTexture; import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.texture.TextureAtlasSprite; @@ -37,16 +36,19 @@ import net.minecraft.network.chat.numbers.NumberFormat; import net.minecraft.network.chat.numbers.StyledFormat; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.MinecraftServer; +import net.minecraft.sounds.SoundEvents; import net.minecraft.tags.FluidTags; -import net.minecraft.util.FastColor; +import net.minecraft.util.ARGB; import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; import net.minecraft.util.StringUtil; +import net.minecraft.util.profiling.Profiler; import net.minecraft.world.MenuProvider; import net.minecraft.world.effect.MobEffect; import net.minecraft.world.effect.MobEffectInstance; import net.minecraft.world.effect.MobEffects; import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.HumanoidArm; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.PlayerRideableJumping; @@ -54,6 +56,7 @@ import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.entity.player.Player; import net.minecraft.world.food.FoodData; import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.equipment.Equippable; import net.minecraft.world.level.GameType; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Blocks; @@ -61,6 +64,7 @@ import net.minecraft.world.level.border.WorldBorder; import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.EntityHitResult; import net.minecraft.world.phys.HitResult; +import net.minecraft.world.phys.HitResult.Type; import net.minecraft.world.scores.DisplaySlot; import net.minecraft.world.scores.Objective; import net.minecraft.world.scores.PlayerScoreEntry; @@ -104,12 +108,13 @@ public class Gui { private static final ResourceLocation FOOD_HALF_SPRITE = ResourceLocation.withDefaultNamespace("hud/food_half"); private static final ResourceLocation FOOD_FULL_SPRITE = ResourceLocation.withDefaultNamespace("hud/food_full"); private static final ResourceLocation AIR_SPRITE = ResourceLocation.withDefaultNamespace("hud/air"); - private static final ResourceLocation AIR_BURSTING_SPRITE = ResourceLocation.withDefaultNamespace("hud/air_bursting"); + private static final ResourceLocation AIR_POPPING_SPRITE = ResourceLocation.withDefaultNamespace("hud/air_bursting"); + private static final ResourceLocation AIR_EMPTY_SPRITE = ResourceLocation.withDefaultNamespace("hud/air_empty"); private static final ResourceLocation HEART_VEHICLE_CONTAINER_SPRITE = ResourceLocation.withDefaultNamespace("hud/heart/vehicle_container"); private static final ResourceLocation HEART_VEHICLE_FULL_SPRITE = ResourceLocation.withDefaultNamespace("hud/heart/vehicle_full"); private static final ResourceLocation HEART_VEHICLE_HALF_SPRITE = ResourceLocation.withDefaultNamespace("hud/heart/vehicle_half"); private static final ResourceLocation VIGNETTE_LOCATION = ResourceLocation.withDefaultNamespace("textures/misc/vignette.png"); - private static final ResourceLocation PUMPKIN_BLUR_LOCATION = ResourceLocation.withDefaultNamespace("textures/misc/pumpkinblur.png"); + public static final ResourceLocation NAUSEA_LOCATION = ResourceLocation.withDefaultNamespace("textures/misc/nausea.png"); private static final ResourceLocation SPYGLASS_SCOPE_LOCATION = ResourceLocation.withDefaultNamespace("textures/misc/spyglass_scope.png"); private static final ResourceLocation POWDER_SNOW_OUTLINE_LOCATION = ResourceLocation.withDefaultNamespace("textures/misc/powder_snow_outline.png"); private static final Comparator SCORE_DISPLAY_ORDER = Comparator.comparing(PlayerScoreEntry::value) @@ -124,7 +129,20 @@ public class Gui { private static final float PORTAL_OVERLAY_ALPHA_MIN = 0.2F; private static final int HEART_SIZE = 9; private static final int HEART_SEPARATION = 8; + private static final int NUM_AIR_BUBBLES = 10; + private static final int AIR_BUBBLE_SIZE = 9; + private static final int AIR_BUBBLE_SEPERATION = 8; + private static final int AIR_BUBBLE_POPPING_DURATION = 2; + private static final int EMPTY_AIR_BUBBLE_DELAY_DURATION = 4; + private static final float AIR_BUBBLE_POP_SOUND_VOLUME_BASE = 0.5F; + private static final float AIR_BUBBLE_POP_SOUND_VOLUME_INCREMENT = 0.1F; + private static final float AIR_BUBBLE_POP_SOUND_PITCH_BASE = 1.0F; + private static final float AIR_BUBBLE_POP_SOUND_PITCH_INCREMENT = 0.1F; + private static final int NUM_AIR_BUBBLE_POPPED_BEFORE_SOUND_VOLUME_INCREASE = 3; + private static final int NUM_AIR_BUBBLE_POPPED_BEFORE_SOUND_PITCH_INCREASE = 5; private static final float AUTOSAVE_FADE_SPEED_FACTOR = 0.2F; + private static final int SAVING_INDICATOR_WIDTH_PADDING_RIGHT = 5; + private static final int SAVING_INDICATOR_HEIGHT_PADDING_BOTTOM = 5; private final RandomSource random = RandomSource.create(); private final Minecraft minecraft; private final ChatComponent chat; @@ -181,6 +199,7 @@ public class Gui { * Used with updateCounter to make the heart bar flash */ private long healthBlinkTime; + private int lastBubblePopSoundPlayed; private float autosaveIndicatorValue; private float lastAutosaveIndicatorValue; private final LayeredDraw layers = new LayeredDraw(); @@ -228,9 +247,7 @@ public class Gui { } public void render(GuiGraphics guiGraphics, DeltaTracker deltaTracker) { - RenderSystem.enableDepthTest(); this.layers.render(guiGraphics, deltaTracker); - RenderSystem.disableDepthTest(); } private void renderCameraOverlays(GuiGraphics guiGraphics, DeltaTracker deltaTracker) { @@ -245,9 +262,15 @@ public class Gui { this.renderSpyglassOverlay(guiGraphics, this.scopeScale); } else { this.scopeScale = 0.5F; - ItemStack itemStack = this.minecraft.player.getInventory().getArmor(3); - if (itemStack.is(Blocks.CARVED_PUMPKIN.asItem())) { - this.renderTextureOverlay(guiGraphics, PUMPKIN_BLUR_LOCATION, 1.0F); + + for (EquipmentSlot equipmentSlot : EquipmentSlot.values()) { + ItemStack itemStack = this.minecraft.player.getItemBySlot(equipmentSlot); + Equippable equippable = itemStack.get(DataComponents.EQUIPPABLE); + if (equippable != null && equippable.slot() == equipmentSlot && equippable.cameraOverlay().isPresent()) { + this.renderTextureOverlay( + guiGraphics, ((ResourceLocation)equippable.cameraOverlay().get()).withPath((UnaryOperator)(string -> "textures/" + string + ".png")), 1.0F + ); + } } } } @@ -259,14 +282,22 @@ public class Gui { float g = Mth.lerp( deltaTracker.getGameTimeDeltaPartialTick(false), this.minecraft.player.oSpinningEffectIntensity, this.minecraft.player.spinningEffectIntensity ); - if (g > 0.0F && !this.minecraft.player.hasEffect(MobEffects.CONFUSION)) { - this.renderPortalOverlay(guiGraphics, g); + if (g > 0.0F) { + if (!this.minecraft.player.hasEffect(MobEffects.CONFUSION)) { + this.renderPortalOverlay(guiGraphics, g); + } else { + float h = this.minecraft.options.screenEffectScale().get().floatValue(); + if (h < 1.0F) { + float i = g * (1.0F - h); + this.renderConfusionOverlay(guiGraphics, i); + } + } } } private void renderSleepOverlay(GuiGraphics guiGraphics, DeltaTracker deltaTracker) { if (this.minecraft.player.getSleepTimer() > 0) { - this.minecraft.getProfiler().push("sleep"); + Profiler.get().push("sleep"); float f = this.minecraft.player.getSleepTimer(); float g = f / 100.0F; if (g > 1.0F) { @@ -275,14 +306,14 @@ public class Gui { int i = (int)(220.0F * g) << 24 | 1052704; guiGraphics.fill(RenderType.guiOverlay(), 0, 0, guiGraphics.guiWidth(), guiGraphics.guiHeight(), i); - this.minecraft.getProfiler().pop(); + Profiler.get().pop(); } } private void renderOverlayMessage(GuiGraphics guiGraphics, DeltaTracker deltaTracker) { Font font = this.getFont(); if (this.overlayMessageString != null && this.overlayMessageTime > 0) { - this.minecraft.getProfiler().push("overlayMessage"); + Profiler.get().push("overlayMessage"); float f = this.overlayMessageTime - deltaTracker.getGameTimeDeltaPartialTick(false); int i = (int)(f * 255.0F / 20.0F); if (i > 255) { @@ -296,7 +327,7 @@ public class Gui { if (this.animateOverlayMessageColor) { j = Mth.hsvToArgb(f / 50.0F, 0.7F, 0.6F, i); } else { - j = FastColor.ARGB32.color(i, -1); + j = ARGB.color(i, -1); } int k = font.width(this.overlayMessageString); @@ -304,14 +335,14 @@ public class Gui { guiGraphics.pose().popPose(); } - this.minecraft.getProfiler().pop(); + Profiler.get().pop(); } } private void renderTitle(GuiGraphics guiGraphics, DeltaTracker deltaTracker) { if (this.title != null && this.titleTime > 0) { Font font = this.getFont(); - this.minecraft.getProfiler().push("titleAndSubtitle"); + Profiler.get().push("titleAndSubtitle"); float f = this.titleTime - deltaTracker.getGameTimeDeltaPartialTick(false); int i = 255; if (this.titleTime > this.titleFadeOutTime + this.titleStayTime) { @@ -330,7 +361,7 @@ public class Gui { guiGraphics.pose().pushPose(); guiGraphics.pose().scale(4.0F, 4.0F, 4.0F); int j = font.width(this.title); - int k = FastColor.ARGB32.color(i, -1); + int k = ARGB.color(i, -1); guiGraphics.drawStringWithBackdrop(font, this.title, -j / 2, -10, j, k); guiGraphics.pose().popPose(); if (this.subtitle != null) { @@ -344,7 +375,7 @@ public class Gui { guiGraphics.pose().popPose(); } - this.minecraft.getProfiler().pop(); + Profiler.get().pop(); } } @@ -390,7 +421,6 @@ public class Gui { Options options = this.minecraft.options; if (options.getCameraType().isFirstPerson()) { if (this.minecraft.gameMode.getPlayerMode() != GameType.SPECTATOR || this.canRenderCrosshairForSpectator(this.minecraft.hitResult)) { - RenderSystem.enableBlend(); if (this.debugOverlay.showDebugScreen() && !this.minecraft.player.isReducedDebugInfo() && !options.reducedDebugInfo().get()) { Camera camera = this.minecraft.gameRenderer.getMainCamera(); Matrix4fStack matrix4fStack = RenderSystem.getModelViewStack(); @@ -400,19 +430,11 @@ public class Gui { matrix4fStack.rotateX(-camera.getXRot() * (float) (Math.PI / 180.0)); matrix4fStack.rotateY(camera.getYRot() * (float) (Math.PI / 180.0)); matrix4fStack.scale(-1.0F, -1.0F, -1.0F); - RenderSystem.applyModelViewMatrix(); RenderSystem.renderCrosshair(10); matrix4fStack.popMatrix(); - RenderSystem.applyModelViewMatrix(); } else { - RenderSystem.blendFuncSeparate( - GlStateManager.SourceFactor.ONE_MINUS_DST_COLOR, - GlStateManager.DestFactor.ONE_MINUS_SRC_COLOR, - GlStateManager.SourceFactor.ONE, - GlStateManager.DestFactor.ZERO - ); int i = 15; - guiGraphics.blitSprite(CROSSHAIR_SPRITE, (guiGraphics.guiWidth() - 15) / 2, (guiGraphics.guiHeight() - 15) / 2, 15, 15); + guiGraphics.blitSprite(RenderType::crosshair, CROSSHAIR_SPRITE, (guiGraphics.guiWidth() - 15) / 2, (guiGraphics.guiHeight() - 15) / 2, 15, 15); if (this.minecraft.options.attackIndicator().get() == AttackIndicatorStatus.CROSSHAIR) { float f = this.minecraft.player.getAttackStrengthScale(0.0F); boolean bl = false; @@ -424,18 +446,14 @@ public class Gui { int j = guiGraphics.guiHeight() / 2 - 7 + 16; int k = guiGraphics.guiWidth() / 2 - 8; if (bl) { - guiGraphics.blitSprite(CROSSHAIR_ATTACK_INDICATOR_FULL_SPRITE, k, j, 16, 16); + guiGraphics.blitSprite(RenderType::crosshair, CROSSHAIR_ATTACK_INDICATOR_FULL_SPRITE, k, j, 16, 16); } else if (f < 1.0F) { int l = (int)(f * 17.0F); - guiGraphics.blitSprite(CROSSHAIR_ATTACK_INDICATOR_BACKGROUND_SPRITE, k, j, 16, 4); - guiGraphics.blitSprite(CROSSHAIR_ATTACK_INDICATOR_PROGRESS_SPRITE, 16, 4, 0, 0, k, j, l, 4); + guiGraphics.blitSprite(RenderType::crosshair, CROSSHAIR_ATTACK_INDICATOR_BACKGROUND_SPRITE, k, j, 16, 4); + guiGraphics.blitSprite(RenderType::crosshair, CROSSHAIR_ATTACK_INDICATOR_PROGRESS_SPRITE, 16, 4, 0, 0, k, j, l, 4); } } - - RenderSystem.defaultBlendFunc(); } - - RenderSystem.disableBlend(); } } } @@ -450,9 +468,9 @@ public class Gui { private boolean canRenderCrosshairForSpectator(@Nullable HitResult rayTrace) { if (rayTrace == null) { return false; - } else if (rayTrace.getType() == HitResult.Type.ENTITY) { + } else if (rayTrace.getType() == Type.ENTITY) { return ((EntityHitResult)rayTrace).getEntity() instanceof MenuProvider; - } else if (rayTrace.getType() == HitResult.Type.BLOCK) { + } else if (rayTrace.getType() == Type.BLOCK) { BlockPos blockPos = ((BlockHitResult)rayTrace).getBlockPos(); Level level = this.minecraft.level; return level.getBlockState(blockPos).getMenuProvider(level, blockPos) != null; @@ -463,9 +481,7 @@ public class Gui { private void renderEffects(GuiGraphics guiGraphics, DeltaTracker deltaTracker) { Collection collection = this.minecraft.player.getActiveEffects(); - if (!collection.isEmpty() - && !(this.minecraft.screen instanceof EffectRenderingInventoryScreen effectRenderingInventoryScreen && effectRenderingInventoryScreen.canSeeEffects())) { - RenderSystem.enableBlend(); + if (!collection.isEmpty() && (this.minecraft.screen == null || !this.minecraft.screen.showsActiveEffects())) { int i = 0; int j = 0; MobEffectTextureManager mobEffectTextureManager = this.minecraft.getMobEffectTextures(); @@ -491,13 +507,14 @@ public class Gui { float f = 1.0F; if (mobEffectInstance.isAmbient()) { - guiGraphics.blitSprite(EFFECT_BACKGROUND_AMBIENT_SPRITE, k, l, 24, 24); + guiGraphics.blitSprite(RenderType::guiTextured, EFFECT_BACKGROUND_AMBIENT_SPRITE, k, l, 24, 24); } else { - guiGraphics.blitSprite(EFFECT_BACKGROUND_SPRITE, k, l, 24, 24); + guiGraphics.blitSprite(RenderType::guiTextured, EFFECT_BACKGROUND_SPRITE, k, l, 24, 24); if (mobEffectInstance.endsWithin(200)) { int m = mobEffectInstance.getDuration(); int n = 10 - m / 20; f = Mth.clamp(m / 10.0F / 5.0F * 0.5F, 0.0F, 0.5F) + Mth.cos(m * (float) Math.PI / 5.0F) * Mth.clamp(n / 10.0F * 0.25F, 0.0F, 0.25F); + f = Mth.clamp(f, 0.0F, 1.0F); } } @@ -506,15 +523,13 @@ public class Gui { int o = l; float g = f; list.add((Runnable)() -> { - guiGraphics.setColor(1.0F, 1.0F, 1.0F, g); - guiGraphics.blit(n + 3, o + 3, 0, 18, 18, textureAtlasSprite); - guiGraphics.setColor(1.0F, 1.0F, 1.0F, 1.0F); + int kx = ARGB.white(g); + guiGraphics.blitSprite(RenderType::guiTextured, textureAtlasSprite, n + 3, o + 3, 18, 18, kx); }); } } list.forEach(Runnable::run); - RenderSystem.disableBlend(); } } @@ -553,21 +568,21 @@ public class Gui { int i = guiGraphics.guiWidth() / 2; int j = 182; int k = 91; - RenderSystem.enableBlend(); guiGraphics.pose().pushPose(); guiGraphics.pose().translate(0.0F, 0.0F, -90.0F); - guiGraphics.blitSprite(HOTBAR_SPRITE, i - 91, guiGraphics.guiHeight() - 22, 182, 22); - guiGraphics.blitSprite(HOTBAR_SELECTION_SPRITE, i - 91 - 1 + player.getInventory().selected * 20, guiGraphics.guiHeight() - 22 - 1, 24, 23); + guiGraphics.blitSprite(RenderType::guiTextured, HOTBAR_SPRITE, i - 91, guiGraphics.guiHeight() - 22, 182, 22); + guiGraphics.blitSprite( + RenderType::guiTextured, HOTBAR_SELECTION_SPRITE, i - 91 - 1 + player.getInventory().selected * 20, guiGraphics.guiHeight() - 22 - 1, 24, 23 + ); if (!itemStack.isEmpty()) { if (humanoidArm == HumanoidArm.LEFT) { - guiGraphics.blitSprite(HOTBAR_OFFHAND_LEFT_SPRITE, i - 91 - 29, guiGraphics.guiHeight() - 23, 29, 24); + guiGraphics.blitSprite(RenderType::guiTextured, HOTBAR_OFFHAND_LEFT_SPRITE, i - 91 - 29, guiGraphics.guiHeight() - 23, 29, 24); } else { - guiGraphics.blitSprite(HOTBAR_OFFHAND_RIGHT_SPRITE, i + 91, guiGraphics.guiHeight() - 23, 29, 24); + guiGraphics.blitSprite(RenderType::guiTextured, HOTBAR_OFFHAND_RIGHT_SPRITE, i + 91, guiGraphics.guiHeight() - 23, 29, 24); } } guiGraphics.pose().popPose(); - RenderSystem.disableBlend(); int l = 1; for (int m = 0; m < 9; m++) { @@ -586,7 +601,6 @@ public class Gui { } if (this.minecraft.options.attackIndicator().get() == AttackIndicatorStatus.HOTBAR) { - RenderSystem.enableBlend(); float f = this.minecraft.player.getAttackStrengthScale(0.0F); if (f < 1.0F) { int n = guiGraphics.guiHeight() - 20; @@ -596,11 +610,9 @@ public class Gui { } int p = (int)(f * 19.0F); - guiGraphics.blitSprite(HOTBAR_ATTACK_INDICATOR_BACKGROUND_SPRITE, o, n, 18, 18); - guiGraphics.blitSprite(HOTBAR_ATTACK_INDICATOR_PROGRESS_SPRITE, 18, 18, 0, 18 - p, o, n + 18 - p, 18, p); + guiGraphics.blitSprite(RenderType::guiTextured, HOTBAR_ATTACK_INDICATOR_BACKGROUND_SPRITE, o, n, 18, 18); + guiGraphics.blitSprite(RenderType::guiTextured, HOTBAR_ATTACK_INDICATOR_PROGRESS_SPRITE, 18, 18, 0, 18 - p, o, n + 18 - p, 18, p); } - - RenderSystem.disableBlend(); } } } @@ -613,21 +625,19 @@ public class Gui { * @param x the x-coordinate for rendering the jump meter. */ private void renderJumpMeter(PlayerRideableJumping rideable, GuiGraphics guiGraphics, int x) { - this.minecraft.getProfiler().push("jumpBar"); + Profiler.get().push("jumpBar"); float f = this.minecraft.player.getJumpRidingScale(); int i = 182; int j = (int)(f * 183.0F); int k = guiGraphics.guiHeight() - 32 + 3; - RenderSystem.enableBlend(); - guiGraphics.blitSprite(JUMP_BAR_BACKGROUND_SPRITE, x, k, 182, 5); + guiGraphics.blitSprite(RenderType::guiTextured, JUMP_BAR_BACKGROUND_SPRITE, x, k, 182, 5); if (rideable.getJumpCooldown() > 0) { - guiGraphics.blitSprite(JUMP_BAR_COOLDOWN_SPRITE, x, k, 182, 5); + guiGraphics.blitSprite(RenderType::guiTextured, JUMP_BAR_COOLDOWN_SPRITE, x, k, 182, 5); } else if (j > 0) { - guiGraphics.blitSprite(JUMP_BAR_PROGRESS_SPRITE, 182, 5, 0, 0, x, k, j, 5); + guiGraphics.blitSprite(RenderType::guiTextured, JUMP_BAR_PROGRESS_SPRITE, 182, 5, 0, 0, x, k, j, 5); } - RenderSystem.disableBlend(); - this.minecraft.getProfiler().pop(); + Profiler.get().pop(); } /** @@ -637,28 +647,25 @@ public class Gui { * @param x the x-coordinate for rendering the experience bar. */ private void renderExperienceBar(GuiGraphics guiGraphics, int x) { - this.minecraft.getProfiler().push("expBar"); + Profiler.get().push("expBar"); int i = this.minecraft.player.getXpNeededForNextLevel(); if (i > 0) { int j = 182; int k = (int)(this.minecraft.player.experienceProgress * 183.0F); int l = guiGraphics.guiHeight() - 32 + 3; - RenderSystem.enableBlend(); - guiGraphics.blitSprite(EXPERIENCE_BAR_BACKGROUND_SPRITE, x, l, 182, 5); + guiGraphics.blitSprite(RenderType::guiTextured, EXPERIENCE_BAR_BACKGROUND_SPRITE, x, l, 182, 5); if (k > 0) { - guiGraphics.blitSprite(EXPERIENCE_BAR_PROGRESS_SPRITE, 182, 5, 0, 0, x, l, k, 5); + guiGraphics.blitSprite(RenderType::guiTextured, EXPERIENCE_BAR_PROGRESS_SPRITE, 182, 5, 0, 0, x, l, k, 5); } - - RenderSystem.disableBlend(); } - this.minecraft.getProfiler().pop(); + Profiler.get().pop(); } private void renderExperienceLevel(GuiGraphics guiGraphics, DeltaTracker deltaTracker) { int i = this.minecraft.player.experienceLevel; if (this.isExperienceBarVisible() && i > 0) { - this.minecraft.getProfiler().push("expLevel"); + Profiler.get().push("expLevel"); String string = i + ""; int j = (guiGraphics.guiWidth() - this.getFont().width(string)) / 2; int k = guiGraphics.guiHeight() - 31 - 4; @@ -667,7 +674,7 @@ public class Gui { guiGraphics.drawString(this.getFont(), string, j, k + 1, 0, false); guiGraphics.drawString(this.getFont(), string, j, k - 1, 0, false); guiGraphics.drawString(this.getFont(), string, j, k, 8453920, false); - this.minecraft.getProfiler().pop(); + Profiler.get().pop(); } } @@ -681,7 +688,7 @@ public class Gui { * @param guiGraphics the GuiGraphics object used for rendering. */ private void renderSelectedItemName(GuiGraphics guiGraphics) { - this.minecraft.getProfiler().push("selectedItemName"); + Profiler.get().push("selectedItemName"); if (this.toolHighlightTimer > 0 && !this.lastToolHighlight.isEmpty()) { MutableComponent mutableComponent = Component.empty().append(this.lastToolHighlight.getHoverName()).withStyle(this.lastToolHighlight.getRarity().color()); if (this.lastToolHighlight.has(DataComponents.CUSTOM_NAME)) { @@ -701,16 +708,16 @@ public class Gui { } if (l > 0) { - guiGraphics.drawStringWithBackdrop(this.getFont(), mutableComponent, j, k, i, FastColor.ARGB32.color(l, -1)); + guiGraphics.drawStringWithBackdrop(this.getFont(), mutableComponent, j, k, i, ARGB.color(l, -1)); } } - this.minecraft.getProfiler().pop(); + Profiler.get().pop(); } private void renderDemoOverlay(GuiGraphics guiGraphics, DeltaTracker deltaTracker) { if (this.minecraft.isDemo()) { - this.minecraft.getProfiler().push("demo"); + Profiler.get().push("demo"); Component component; if (this.minecraft.level.getGameTime() >= 120500L) { component = DEMO_EXPIRED_TEXT; @@ -725,7 +732,7 @@ public class Gui { int j = guiGraphics.guiWidth() - i - 10; int k = 5; guiGraphics.drawStringWithBackdrop(this.getFont(), component, j, 5, i, -1); - this.minecraft.getProfiler().pop(); + Profiler.get().pop(); } } @@ -766,28 +773,25 @@ public class Gui { j = Math.max(j, this.getFont().width(lv.name) + (lv.scoreWidth > 0 ? k + lv.scoreWidth : 0)); } - int l = j; - guiGraphics.drawManaged(() -> { - int kx = lvs.length; - int lx = kx * 9; - int m = guiGraphics.guiHeight() / 2 + lx / 3; - int n = 3; - int o = guiGraphics.guiWidth() - l - 3; - int p = guiGraphics.guiWidth() - 3 + 2; - int q = this.minecraft.options.getBackgroundColor(0.3F); - int r = this.minecraft.options.getBackgroundColor(0.4F); - int s = m - kx * 9; - guiGraphics.fill(o - 2, s - 9 - 1, p, s - 1, r); - guiGraphics.fill(o - 2, s - 1, p, m, q); - guiGraphics.drawString(this.getFont(), component, o + l / 2 - i / 2, s - 9, -1, false); + int m = lvs.length; + int n = m * 9; + int o = guiGraphics.guiHeight() / 2 + n / 3; + int p = 3; + int q = guiGraphics.guiWidth() - j - 3; + int r = guiGraphics.guiWidth() - 3 + 2; + int s = this.minecraft.options.getBackgroundColor(0.3F); + int t = this.minecraft.options.getBackgroundColor(0.4F); + int u = o - m * 9; + guiGraphics.fill(q - 2, u - 9 - 1, r, u - 1, t); + guiGraphics.fill(q - 2, u - 1, r, o, s); + guiGraphics.drawString(this.getFont(), component, q + j / 2 - i / 2, u - 9, -1, false); - for (int t = 0; t < kx; t++) { - DisplayEntry lvx = lvs[t]; - int u = m - (kx - t) * 9; - guiGraphics.drawString(this.getFont(), lvx.name, o, u, -1, false); - guiGraphics.drawString(this.getFont(), lvx.score, p - lvx.scoreWidth, u, -1, false); - } - }); + for (int v = 0; v < m; v++) { + DisplayEntry lv2 = lvs[v]; + int w = o - (m - v) * 9; + guiGraphics.drawString(this.getFont(), lv2.name, q, w, -1, false); + guiGraphics.drawString(this.getFont(), lv2.score, r - lv2.scoreWidth, w, -1, false); + } } /** @@ -874,7 +878,6 @@ public class Gui { } if (l - this.lastHealthTime > 1000L) { - this.lastHealth = i; this.displayHealth = i; this.lastHealthTime = l; } @@ -895,65 +898,43 @@ public class Gui { s = this.tickCount % Mth.ceil(f + 5.0F); } - this.minecraft.getProfiler().push("armor"); + Profiler.get().push("armor"); renderArmor(guiGraphics, player, n, p, q, k); - this.minecraft.getProfiler().popPush("health"); + Profiler.get().popPush("health"); this.renderHearts(guiGraphics, player, k, n, q, s, f, i, j, o, bl); LivingEntity livingEntity = this.getPlayerVehicleWithHealth(); int t = this.getVehicleMaxHearts(livingEntity); if (t == 0) { - this.minecraft.getProfiler().popPush("food"); + Profiler.get().popPush("food"); this.renderFood(guiGraphics, player, n, m); r -= 10; } - this.minecraft.getProfiler().popPush("air"); - int u = player.getMaxAirSupply(); - int v = Math.min(player.getAirSupply(), u); - if (player.isEyeInFluid(FluidTags.WATER) || v < u) { - int w = this.getVisibleVehicleHeartRows(t) - 1; - r -= w * 10; - int x = Mth.ceil((v - 2) * 10.0 / u); - int y = Mth.ceil(v * 10.0 / u) - x; - RenderSystem.enableBlend(); - - for (int z = 0; z < x + y; z++) { - if (z < x) { - guiGraphics.blitSprite(AIR_SPRITE, m - z * 8 - 9, r, 9, 9); - } else { - guiGraphics.blitSprite(AIR_BURSTING_SPRITE, m - z * 8 - 9, r, 9, 9); - } - } - - RenderSystem.disableBlend(); - } - - this.minecraft.getProfiler().pop(); + Profiler.get().popPush("air"); + this.renderAirBubbles(guiGraphics, player, t, r, m); + Profiler.get().pop(); } } private static void renderArmor(GuiGraphics guiGraphics, Player player, int y, int heartRows, int height, int x) { int i = player.getArmorValue(); if (i > 0) { - RenderSystem.enableBlend(); int j = y - (heartRows - 1) * height - 10; for (int k = 0; k < 10; k++) { int l = x + k * 8; if (k * 2 + 1 < i) { - guiGraphics.blitSprite(ARMOR_FULL_SPRITE, l, j, 9, 9); + guiGraphics.blitSprite(RenderType::guiTextured, ARMOR_FULL_SPRITE, l, j, 9, 9); } if (k * 2 + 1 == i) { - guiGraphics.blitSprite(ARMOR_HALF_SPRITE, l, j, 9, 9); + guiGraphics.blitSprite(RenderType::guiTextured, ARMOR_HALF_SPRITE, l, j, 9, 9); } if (k * 2 + 1 > i) { - guiGraphics.blitSprite(ARMOR_EMPTY_SPRITE, l, j, 9, 9); + guiGraphics.blitSprite(RenderType::guiTextured, ARMOR_EMPTY_SPRITE, l, j, 9, 9); } } - - RenderSystem.disableBlend(); } } @@ -1028,15 +1009,63 @@ public class Gui { } private void renderHeart(GuiGraphics guiGraphics, Gui.HeartType heartType, int x, int y, boolean hardcore, boolean halfHeart, boolean blinking) { - RenderSystem.enableBlend(); - guiGraphics.blitSprite(heartType.getSprite(hardcore, blinking, halfHeart), x, y, 9, 9); - RenderSystem.disableBlend(); + guiGraphics.blitSprite(RenderType::guiTextured, heartType.getSprite(hardcore, blinking, halfHeart), x, y, 9, 9); + } + + private void renderAirBubbles(GuiGraphics guiGraphics, Player player, int i, int j, int k) { + int l = player.getMaxAirSupply(); + int m = Math.clamp(player.getAirSupply(), 0, l); + boolean bl = player.isEyeInFluid(FluidTags.WATER); + if (bl || m < l) { + j = this.getAirBubbleYLine(i, j); + int n = getCurrentAirSupplyBubble(m, l, -2); + int o = getCurrentAirSupplyBubble(m, l, 0); + int p = 10 - getCurrentAirSupplyBubble(m, l, getEmptyBubbleDelayDuration(m, bl)); + boolean bl2 = n != o; + if (!bl) { + this.lastBubblePopSoundPlayed = 0; + } + + for (int q = 1; q <= 10; q++) { + int r = k - (q - 1) * 8 - 9; + if (q <= n) { + guiGraphics.blitSprite(RenderType::guiTextured, AIR_SPRITE, r, j, 9, 9); + } else if (bl2 && q == o && bl) { + guiGraphics.blitSprite(RenderType::guiTextured, AIR_POPPING_SPRITE, r, j, 9, 9); + this.playAirBubblePoppedSound(q, player, p); + } else if (q > 10 - p) { + int s = p == 10 && this.tickCount % 2 == 0 ? this.random.nextInt(2) : 0; + guiGraphics.blitSprite(RenderType::guiTextured, AIR_EMPTY_SPRITE, r, j + s, 9, 9); + } + } + } + } + + private int getAirBubbleYLine(int i, int j) { + int k = this.getVisibleVehicleHeartRows(i) - 1; + return j - k * 10; + } + + private static int getCurrentAirSupplyBubble(int i, int j, int k) { + return Mth.ceil((float)((i + k) * 10) / j); + } + + private static int getEmptyBubbleDelayDuration(int i, boolean bl) { + return i != 0 && bl ? 4 : 0; + } + + private void playAirBubblePoppedSound(int i, Player player, int j) { + if (this.lastBubblePopSoundPlayed != i) { + float f = 0.5F + 0.1F * Math.max(0, j - 3 + 1); + float g = 1.0F + 0.1F * Math.max(0, j - 5 + 1); + player.playSound(SoundEvents.BUBBLE_POP, f, g); + this.lastBubblePopSoundPlayed = i; + } } private void renderFood(GuiGraphics guiGraphics, Player player, int y, int x) { FoodData foodData = player.getFoodData(); int i = foodData.getFoodLevel(); - RenderSystem.enableBlend(); for (int j = 0; j < 10; j++) { int k = y; @@ -1058,17 +1087,15 @@ public class Gui { } int l = x - j * 8 - 9; - guiGraphics.blitSprite(resourceLocation, l, k, 9, 9); + guiGraphics.blitSprite(RenderType::guiTextured, resourceLocation, l, k, 9, 9); if (j * 2 + 1 < i) { - guiGraphics.blitSprite(resourceLocation3, l, k, 9, 9); + guiGraphics.blitSprite(RenderType::guiTextured, resourceLocation3, l, k, 9, 9); } if (j * 2 + 1 == i) { - guiGraphics.blitSprite(resourceLocation2, l, k, 9, 9); + guiGraphics.blitSprite(RenderType::guiTextured, resourceLocation2, l, k, 9, 9); } } - - RenderSystem.disableBlend(); } /** @@ -1082,34 +1109,29 @@ public class Gui { int i = this.getVehicleMaxHearts(livingEntity); if (i != 0) { int j = (int)Math.ceil(livingEntity.getHealth()); - this.minecraft.getProfiler().popPush("mountHealth"); + Profiler.get().popPush("mountHealth"); int k = guiGraphics.guiHeight() - 39; int l = guiGraphics.guiWidth() / 2 + 91; int m = k; - int n = 0; - RenderSystem.enableBlend(); - while (i > 0) { + for (int n = 0; i > 0; n += 20) { int o = Math.min(i, 10); i -= o; for (int p = 0; p < o; p++) { int q = l - p * 8 - 9; - guiGraphics.blitSprite(HEART_VEHICLE_CONTAINER_SPRITE, q, m, 9, 9); + guiGraphics.blitSprite(RenderType::guiTextured, HEART_VEHICLE_CONTAINER_SPRITE, q, m, 9, 9); if (p * 2 + 1 + n < j) { - guiGraphics.blitSprite(HEART_VEHICLE_FULL_SPRITE, q, m, 9, 9); + guiGraphics.blitSprite(RenderType::guiTextured, HEART_VEHICLE_FULL_SPRITE, q, m, 9, 9); } if (p * 2 + 1 + n == j) { - guiGraphics.blitSprite(HEART_VEHICLE_HALF_SPRITE, q, m, 9, 9); + guiGraphics.blitSprite(RenderType::guiTextured, HEART_VEHICLE_HALF_SPRITE, q, m, 9, 9); } } m -= 10; - n += 20; } - - RenderSystem.disableBlend(); } } } @@ -1122,15 +1144,20 @@ public class Gui { * @param alpha the alpha value to apply to the overlay. */ private void renderTextureOverlay(GuiGraphics guiGraphics, ResourceLocation shaderLocation, float alpha) { - RenderSystem.disableDepthTest(); - RenderSystem.depthMask(false); - RenderSystem.enableBlend(); - guiGraphics.setColor(1.0F, 1.0F, 1.0F, alpha); - guiGraphics.blit(shaderLocation, 0, 0, -90, 0.0F, 0.0F, guiGraphics.guiWidth(), guiGraphics.guiHeight(), guiGraphics.guiWidth(), guiGraphics.guiHeight()); - RenderSystem.disableBlend(); - RenderSystem.depthMask(true); - RenderSystem.enableDepthTest(); - guiGraphics.setColor(1.0F, 1.0F, 1.0F, 1.0F); + int i = ARGB.white(alpha); + guiGraphics.blit( + RenderType::guiTexturedOverlay, + shaderLocation, + 0, + 0, + 0.0F, + 0.0F, + guiGraphics.guiWidth(), + guiGraphics.guiHeight(), + guiGraphics.guiWidth(), + guiGraphics.guiHeight(), + i + ); } /** @@ -1148,9 +1175,7 @@ public class Gui { int l = (guiGraphics.guiHeight() - j) / 2; int m = k + i; int n = l + j; - RenderSystem.enableBlend(); - guiGraphics.blit(SPYGLASS_SCOPE_LOCATION, k, l, -90, 0.0F, 0.0F, i, j, i, j); - RenderSystem.disableBlend(); + guiGraphics.blit(RenderType::guiTextured, SPYGLASS_SCOPE_LOCATION, k, l, 0.0F, 0.0F, i, j, i, j); guiGraphics.fill(RenderType.guiOverlay(), 0, n, guiGraphics.guiWidth(), guiGraphics.guiHeight(), -90, -16777216); guiGraphics.fill(RenderType.guiOverlay(), 0, 0, guiGraphics.guiWidth(), l, -90, -16777216); guiGraphics.fill(RenderType.guiOverlay(), 0, l, k, n, -90, -16777216); @@ -1187,27 +1212,29 @@ public class Gui { } } - RenderSystem.disableDepthTest(); - RenderSystem.depthMask(false); - RenderSystem.enableBlend(); - RenderSystem.blendFuncSeparate( - GlStateManager.SourceFactor.ZERO, GlStateManager.DestFactor.ONE_MINUS_SRC_COLOR, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO - ); + int i; if (f > 0.0F) { f = Mth.clamp(f, 0.0F, 1.0F); - guiGraphics.setColor(0.0F, f, f, 1.0F); + i = ARGB.colorFromFloat(1.0F, 0.0F, f, f); } else { - float g = this.vignetteBrightness; - g = Mth.clamp(g, 0.0F, 1.0F); - guiGraphics.setColor(g, g, g, 1.0F); + float h = this.vignetteBrightness; + h = Mth.clamp(h, 0.0F, 1.0F); + i = ARGB.colorFromFloat(1.0F, h, h, h); } - guiGraphics.blit(VIGNETTE_LOCATION, 0, 0, -90, 0.0F, 0.0F, guiGraphics.guiWidth(), guiGraphics.guiHeight(), guiGraphics.guiWidth(), guiGraphics.guiHeight()); - RenderSystem.depthMask(true); - RenderSystem.enableDepthTest(); - guiGraphics.setColor(1.0F, 1.0F, 1.0F, 1.0F); - RenderSystem.defaultBlendFunc(); - RenderSystem.disableBlend(); + guiGraphics.blit( + RenderType::vignette, + VIGNETTE_LOCATION, + 0, + 0, + 0.0F, + 0.0F, + guiGraphics.guiWidth(), + guiGraphics.guiHeight(), + guiGraphics.guiWidth(), + guiGraphics.guiHeight(), + i + ); } /** @@ -1223,16 +1250,24 @@ public class Gui { alpha = alpha * 0.8F + 0.2F; } - RenderSystem.disableDepthTest(); - RenderSystem.depthMask(false); - RenderSystem.enableBlend(); - guiGraphics.setColor(1.0F, 1.0F, 1.0F, alpha); + int i = ARGB.white(alpha); TextureAtlasSprite textureAtlasSprite = this.minecraft.getBlockRenderer().getBlockModelShaper().getParticleIcon(Blocks.NETHER_PORTAL.defaultBlockState()); - guiGraphics.blit(0, 0, -90, guiGraphics.guiWidth(), guiGraphics.guiHeight(), textureAtlasSprite); - RenderSystem.disableBlend(); - RenderSystem.depthMask(true); - RenderSystem.enableDepthTest(); - guiGraphics.setColor(1.0F, 1.0F, 1.0F, 1.0F); + guiGraphics.blitSprite(RenderType::guiTexturedOverlay, textureAtlasSprite, 0, 0, guiGraphics.guiWidth(), guiGraphics.guiHeight(), i); + } + + private void renderConfusionOverlay(GuiGraphics guiGraphics, float f) { + int i = guiGraphics.guiWidth(); + int j = guiGraphics.guiHeight(); + guiGraphics.pose().pushPose(); + float g = Mth.lerp(f, 2.0F, 1.0F); + guiGraphics.pose().translate(i / 2.0F, j / 2.0F, 0.0F); + guiGraphics.pose().scale(g, g, g); + guiGraphics.pose().translate(-i / 2.0F, -j / 2.0F, 0.0F); + float h = 0.2F * f; + float k = 0.4F * f; + float l = 0.2F * f; + guiGraphics.blit(resourceLocation -> RenderType.guiNauseaOverlay(), NAUSEA_LOCATION, 0, 0, 0.0F, 0.0F, i, j, i, j, ARGB.colorFromFloat(1.0F, h, k, l)); + guiGraphics.pose().popPose(); } private void renderSlot(GuiGraphics guiGraphics, int x, int y, DeltaTracker deltaTracker, Player player, ItemStack stack, int seed) { @@ -1448,7 +1483,7 @@ public class Gui { public void onDisconnected() { this.tabList.reset(); this.bossOverlay.reset(); - this.minecraft.getToasts().clear(); + this.minecraft.getToastManager().clear(); this.debugOverlay.reset(); this.chat.clearMessages(true); } @@ -1479,9 +1514,9 @@ public class Gui { if (i > 8) { Font font = this.getFont(); int j = font.width(SAVING_TEXT); - int k = FastColor.ARGB32.color(i, -1); - int l = guiGraphics.guiWidth() - j - 2; - int m = guiGraphics.guiHeight() - 35; + int k = ARGB.color(i, -1); + int l = guiGraphics.guiWidth() - j - 5; + int m = guiGraphics.guiHeight() - 9 - 5; guiGraphics.drawStringWithBackdrop(font, SAVING_TEXT, l, m, j, k); } } diff --git a/net/minecraft/client/gui/GuiGraphics.java b/net/minecraft/client/gui/GuiGraphics.java index dae77038..c43f71fb 100644 --- a/net/minecraft/client/gui/GuiGraphics.java +++ b/net/minecraft/client/gui/GuiGraphics.java @@ -1,21 +1,17 @@ package net.minecraft.client.gui; -import com.google.common.collect.Lists; import com.mojang.blaze3d.platform.Lighting; import com.mojang.blaze3d.platform.Window; import com.mojang.blaze3d.systems.RenderSystem; -import com.mojang.blaze3d.vertex.BufferBuilder; -import com.mojang.blaze3d.vertex.BufferUploader; -import com.mojang.blaze3d.vertex.DefaultVertexFormat; import com.mojang.blaze3d.vertex.PoseStack; -import com.mojang.blaze3d.vertex.Tesselator; import com.mojang.blaze3d.vertex.VertexConsumer; -import com.mojang.blaze3d.vertex.VertexFormat; import java.util.ArrayDeque; import java.util.Deque; import java.util.List; import java.util.Objects; import java.util.Optional; +import java.util.function.Consumer; +import java.util.function.Function; import java.util.stream.Collectors; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; @@ -32,19 +28,21 @@ import net.minecraft.client.gui.screens.inventory.tooltip.ClientTooltipPositione import net.minecraft.client.gui.screens.inventory.tooltip.DefaultTooltipPositioner; import net.minecraft.client.gui.screens.inventory.tooltip.TooltipRenderUtil; import net.minecraft.client.player.LocalPlayer; -import net.minecraft.client.renderer.GameRenderer; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.resources.metadata.gui.GuiSpriteScaling; +import net.minecraft.client.resources.metadata.gui.GuiSpriteScaling.NineSlice.Border; import net.minecraft.client.resources.model.BakedModel; +import net.minecraft.core.component.DataComponents; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.FormattedText; import net.minecraft.network.chat.HoverEvent; import net.minecraft.network.chat.Style; import net.minecraft.resources.ResourceLocation; -import net.minecraft.util.FastColor; +import net.minecraft.tags.ItemTags; +import net.minecraft.util.ARGB; import net.minecraft.util.FormattedCharSequence; import net.minecraft.util.Mth; import net.minecraft.world.entity.LivingEntity; @@ -66,7 +64,6 @@ public class GuiGraphics { private final MultiBufferSource.BufferSource bufferSource; private final GuiGraphics.ScissorStack scissorStack = new GuiGraphics.ScissorStack(); private final GuiSpriteManager sprites; - private boolean managed; private GuiGraphics(Minecraft minecraft, PoseStack pose, MultiBufferSource.BufferSource bufferSource) { this.minecraft = minecraft; @@ -79,42 +76,6 @@ public class GuiGraphics { this(minecraft, new PoseStack(), bufferSource); } - /** - * Executes a runnable while managing the render state. The render state is flushed before and after executing the runnable. - * - * @param runnable the runnable to execute. - */ - @Deprecated - public void drawManaged(Runnable runnable) { - this.flush(); - this.managed = true; - runnable.run(); - this.managed = false; - this.flush(); - } - - /** - * Flushes the render state if it is not managed. - * @deprecated This method is deprecated. - */ - @Deprecated - private void flushIfUnmanaged() { - if (!this.managed) { - this.flush(); - } - } - - /** - * Flushes the render state if it is managed. - * @deprecated This method is deprecated. - */ - @Deprecated - private void flushIfManaged() { - if (this.managed) { - this.flush(); - } - } - /** * {@return returns the width of the GUI screen in pixels} */ @@ -136,20 +97,11 @@ public class GuiGraphics { return this.pose; } - /** - * {@return returns the buffer source for rendering.} - */ - public MultiBufferSource.BufferSource bufferSource() { - return this.bufferSource; - } - /** * Flushes the render state, ending the current batch and enabling depth testing. */ public void flush() { - RenderSystem.disableDepthTest(); this.bufferSource.endBatch(); - RenderSystem.enableDepthTest(); } /** @@ -243,7 +195,7 @@ public class GuiGraphics { * @param rectangle the screen rectangle to apply scissoring with. Can be null to disable scissoring. */ private void applyScissor(@Nullable ScreenRectangle rectangle) { - this.flushIfManaged(); + this.flush(); if (rectangle != null) { Window window = Minecraft.getInstance().getWindow(); int i = window.getHeight(); @@ -258,19 +210,6 @@ public class GuiGraphics { } } - /** - * Sets the current rendering color. - * - * @param red the red component of the color. - * @param green the green component of the color. - * @param blue the blue component of the color. - * @param alpha the alpha component of the color. - */ - public void setColor(float red, float green, float blue, float alpha) { - this.flushIfManaged(); - RenderSystem.setShaderColor(red, green, blue, alpha); - } - /** * Fills a rectangle with the specified color using the given coordinates as the boundaries. * @@ -342,7 +281,6 @@ public class GuiGraphics { vertexConsumer.addVertex(matrix4f, (float)minX, (float)maxY, (float)z).setColor(color); vertexConsumer.addVertex(matrix4f, (float)maxX, (float)maxY, (float)z).setColor(color); vertexConsumer.addVertex(matrix4f, (float)maxX, (float)minY, (float)z).setColor(color); - this.flushIfUnmanaged(); } /** @@ -389,7 +327,6 @@ public class GuiGraphics { public void fillGradient(RenderType renderType, int x1, int y1, int x2, int y2, int colorFrom, int colorTo, int z) { VertexConsumer vertexConsumer = this.bufferSource.getBuffer(renderType); this.fillGradient(vertexConsumer, x1, y1, x2, y2, z, colorFrom, colorTo); - this.flushIfUnmanaged(); } /** @@ -421,7 +358,6 @@ public class GuiGraphics { vertexConsumer.addVertex(matrix4f, (float)x1, (float)y2, (float)z); vertexConsumer.addVertex(matrix4f, (float)x2, (float)y2, (float)z); vertexConsumer.addVertex(matrix4f, (float)x2, (float)y1, (float)z); - this.flushIfUnmanaged(); } /** @@ -492,15 +428,9 @@ public class GuiGraphics { * @param dropShadow whether to apply a drop shadow to the string. */ public int drawString(Font font, @Nullable String text, int x, int y, int color, boolean dropShadow) { - if (text == null) { - return 0; - } else { - int i = font.drawInBatch( - text, x, y, color, dropShadow, this.pose.last().pose(), this.bufferSource, Font.DisplayMode.NORMAL, 0, 15728880, font.isBidirectional() - ); - this.flushIfUnmanaged(); - return i; - } + return text == null + ? 0 + : font.drawInBatch(text, (float)x, (float)y, color, dropShadow, this.pose.last().pose(), this.bufferSource, Font.DisplayMode.NORMAL, 0, 15728880); } /** @@ -531,9 +461,7 @@ public class GuiGraphics { * @param dropShadow whether to apply a drop shadow to the string. */ public int drawString(Font font, FormattedCharSequence text, int x, int y, int color, boolean dropShadow) { - int i = font.drawInBatch(text, (float)x, (float)y, color, dropShadow, this.pose.last().pose(), this.bufferSource, Font.DisplayMode.NORMAL, 0, 15728880); - this.flushIfUnmanaged(); - return i; + return font.drawInBatch(text, (float)x, (float)y, color, dropShadow, this.pose.last().pose(), this.bufferSource, Font.DisplayMode.NORMAL, 0, 15728880); } /** @@ -588,46 +516,12 @@ public class GuiGraphics { int i = this.minecraft.options.getBackgroundColor(0.0F); if (i != 0) { int j = 2; - this.fill(x - 2, y - 2, x + xOffset + 2, y + 9 + 2, FastColor.ARGB32.multiply(i, color)); + this.fill(x - 2, y - 2, x + xOffset + 2, y + 9 + 2, ARGB.multiply(i, color)); } return this.drawString(font, text, x, y, color, true); } - /** - * Blits a portion of the specified texture atlas sprite onto the screen at the given coordinates. - * - * @param x the x-coordinate of the blit position. - * @param y the y-coordinate of the blit position. - * @param blitOffset the z-level offset for rendering order. - * @param width the width of the blitted portion. - * @param height the height of the blitted portion. - * @param sprite the texture atlas sprite to blit. - */ - public void blit(int x, int y, int blitOffset, int width, int height, TextureAtlasSprite sprite) { - this.blitSprite(sprite, x, y, blitOffset, width, height); - } - - /** - * Blits a portion of the specified texture atlas sprite onto the screen at the given coordinates with a color tint. - * - * @param x the x-coordinate of the blit position. - * @param y the y-coordinate of the blit position. - * @param blitOffset the z-level offset for rendering order. - * @param width the width of the blitted portion. - * @param height the height of the blitted portion. - * @param sprite the texture atlas sprite to blit. - * @param red the red component of the color tint. - * @param green the green component of the color tint. - * @param blue the blue component of the color tint. - * @param alpha the alpha component of the color tint. - */ - public void blit(int x, int y, int blitOffset, int width, int height, TextureAtlasSprite sprite, float red, float green, float blue, float alpha) { - this.innerBlit( - sprite.atlasLocation(), x, x + width, y, y + height, blitOffset, sprite.getU0(), sprite.getU1(), sprite.getV0(), sprite.getV1(), red, green, blue, alpha - ); - } - /** * Renders an outline rectangle on the screen with the specified color. * @@ -644,345 +538,311 @@ public class GuiGraphics { this.fill(x + width - 1, y + 1, x + width, y + height - 1, color); } - public void blitSprite(ResourceLocation sprite, int x, int y, int width, int height) { - this.blitSprite(sprite, x, y, 0, width, height); + public void blitSprite(Function function, ResourceLocation resourceLocation, int i, int j, int k, int l) { + this.blitSprite(function, resourceLocation, i, j, k, l, -1); } - public void blitSprite(ResourceLocation sprite, int x, int y, int blitOffset, int width, int height) { - TextureAtlasSprite textureAtlasSprite = this.sprites.getSprite(sprite); + public void blitSprite(Function function, ResourceLocation resourceLocation, int i, int j, int k, int l, int m) { + TextureAtlasSprite textureAtlasSprite = this.sprites.getSprite(resourceLocation); GuiSpriteScaling guiSpriteScaling = this.sprites.getSpriteScaling(textureAtlasSprite); if (guiSpriteScaling instanceof GuiSpriteScaling.Stretch) { - this.blitSprite(textureAtlasSprite, x, y, blitOffset, width, height); + this.blitSprite(function, textureAtlasSprite, i, j, k, l, m); } else if (guiSpriteScaling instanceof GuiSpriteScaling.Tile tile) { - this.blitTiledSprite(textureAtlasSprite, x, y, blitOffset, width, height, 0, 0, tile.width(), tile.height(), tile.width(), tile.height()); + this.blitTiledSprite(function, textureAtlasSprite, i, j, k, l, 0, 0, tile.width(), tile.height(), tile.width(), tile.height(), m); } else if (guiSpriteScaling instanceof GuiSpriteScaling.NineSlice nineSlice) { - this.blitNineSlicedSprite(textureAtlasSprite, nineSlice, x, y, blitOffset, width, height); + this.blitNineSlicedSprite(function, textureAtlasSprite, nineSlice, i, j, k, l, m); } } - public void blitSprite(ResourceLocation sprite, int textureWidth, int textureHeight, int uPosition, int vPosition, int x, int y, int uWidth, int vHeight) { - this.blitSprite(sprite, textureWidth, textureHeight, uPosition, vPosition, x, y, 0, uWidth, vHeight); - } - public void blitSprite( - ResourceLocation sprite, int textureWidth, int textureHeight, int uPosition, int vPosition, int x, int y, int blitOffset, int uWidth, int vHeight + Function function, ResourceLocation resourceLocation, int i, int j, int k, int l, int m, int n, int o, int p ) { - TextureAtlasSprite textureAtlasSprite = this.sprites.getSprite(sprite); + TextureAtlasSprite textureAtlasSprite = this.sprites.getSprite(resourceLocation); GuiSpriteScaling guiSpriteScaling = this.sprites.getSpriteScaling(textureAtlasSprite); if (guiSpriteScaling instanceof GuiSpriteScaling.Stretch) { - this.blitSprite(textureAtlasSprite, textureWidth, textureHeight, uPosition, vPosition, x, y, blitOffset, uWidth, vHeight); + this.blitSprite(function, textureAtlasSprite, i, j, k, l, m, n, o, p, -1); } else { - this.blitSprite(textureAtlasSprite, x, y, blitOffset, uWidth, vHeight); + this.blitSprite(function, textureAtlasSprite, m, n, o, p); + } + } + + public void blitSprite(Function function, TextureAtlasSprite textureAtlasSprite, int i, int j, int k, int l) { + this.blitSprite(function, textureAtlasSprite, i, j, k, l, -1); + } + + public void blitSprite(Function function, TextureAtlasSprite textureAtlasSprite, int i, int j, int k, int l, int m) { + if (k != 0 && l != 0) { + this.innerBlit( + function, + textureAtlasSprite.atlasLocation(), + i, + i + k, + j, + j + l, + textureAtlasSprite.getU0(), + textureAtlasSprite.getU1(), + textureAtlasSprite.getV0(), + textureAtlasSprite.getV1(), + m + ); } } private void blitSprite( - TextureAtlasSprite sprite, int textureWidth, int textureHeight, int uPosition, int vPosition, int x, int y, int blitOffset, int uWidth, int vHeight + Function function, TextureAtlasSprite textureAtlasSprite, int i, int j, int k, int l, int m, int n, int o, int p, int q ) { - if (uWidth != 0 && vHeight != 0) { + if (o != 0 && p != 0) { this.innerBlit( - sprite.atlasLocation(), - x, - x + uWidth, - y, - y + vHeight, - blitOffset, - sprite.getU((float)uPosition / textureWidth), - sprite.getU((float)(uPosition + uWidth) / textureWidth), - sprite.getV((float)vPosition / textureHeight), - sprite.getV((float)(vPosition + vHeight) / textureHeight) + function, + textureAtlasSprite.atlasLocation(), + m, + m + o, + n, + n + p, + textureAtlasSprite.getU((float)k / i), + textureAtlasSprite.getU((float)(k + o) / i), + textureAtlasSprite.getV((float)l / j), + textureAtlasSprite.getV((float)(l + p) / j), + q ); } } - private void blitSprite(TextureAtlasSprite sprite, int x, int y, int blitOffset, int width, int height) { - if (width != 0 && height != 0) { - this.innerBlit(sprite.atlasLocation(), x, x + width, y, y + height, blitOffset, sprite.getU0(), sprite.getU1(), sprite.getV0(), sprite.getV1()); - } - } - - /** - * Blits a portion of the texture specified by the atlas location onto the screen at the given coordinates. - * - * @param atlasLocation the location of the texture atlas. - * @param x the x-coordinate of the blit position. - * @param y the y-coordinate of the blit position. - * @param uOffset the horizontal texture coordinate offset. - * @param vOffset the vertical texture coordinate offset. - * @param uWidth the width of the blitted portion in texture coordinates. - * @param vHeight the height of the blitted portion in texture coordinates. - */ - public void blit(ResourceLocation atlasLocation, int x, int y, int uOffset, int vOffset, int uWidth, int vHeight) { - this.blit(atlasLocation, x, y, 0, uOffset, vOffset, uWidth, vHeight, 256, 256); - } - - /** - * Blits a portion of the texture specified by the atlas location onto the screen at the given coordinates with a blit offset and texture coordinates. - * - * @param atlasLocation the location of the texture atlas. - * @param x the x-coordinate of the blit position. - * @param y the y-coordinate of the blit position. - * @param blitOffset the z-level offset for rendering order. - * @param uOffset the horizontal texture coordinate offset. - * @param vOffset the vertical texture coordinate offset. - * @param uWidth the width of the blitted portion in texture coordinates. - * @param vHeight the height of the blitted portion in texture coordinates. - * @param textureWidth the width of the texture. - * @param textureHeight the height of the texture. - */ - public void blit( - ResourceLocation atlasLocation, int x, int y, int blitOffset, float uOffset, float vOffset, int uWidth, int vHeight, int textureWidth, int textureHeight + private void blitNineSlicedSprite( + Function function, + TextureAtlasSprite textureAtlasSprite, + GuiSpriteScaling.NineSlice nineSlice, + int i, + int j, + int k, + int l, + int m ) { - this.blit(atlasLocation, x, x + uWidth, y, y + vHeight, blitOffset, uWidth, vHeight, uOffset, vOffset, textureWidth, textureHeight); - } - - /** - * Blits a portion of the texture specified by the atlas location onto the screen at the given position and dimensions with texture coordinates. - * - * @param atlasLocation the location of the texture atlas. - * @param x the x-coordinate of the top-left corner of the blit position. - * @param y the y-coordinate of the top-left corner of the blit position. - * @param width the width of the blitted portion. - * @param height the height of the blitted portion. - * @param uOffset the horizontal texture coordinate offset. - * @param vOffset the vertical texture coordinate offset. - * @param uWidth the width of the blitted portion in texture coordinates. - * @param vHeight the height of the blitted portion in texture coordinates. - * @param textureWidth the width of the texture. - * @param textureHeight the height of the texture. - */ - public void blit( - ResourceLocation atlasLocation, - int x, - int y, - int width, - int height, - float uOffset, - float vOffset, - int uWidth, - int vHeight, - int textureWidth, - int textureHeight - ) { - this.blit(atlasLocation, x, x + width, y, y + height, 0, uWidth, vHeight, uOffset, vOffset, textureWidth, textureHeight); - } - - /** - * Blits a portion of the texture specified by the atlas location onto the screen at the given position and dimensions with texture coordinates. - * - * @param atlasLocation the location of the texture atlas. - * @param x the x-coordinate of the top-left corner of the blit position. - * @param y the y-coordinate of the top-left corner of the blit position. - * @param uOffset the horizontal texture coordinate offset. - * @param vOffset the vertical texture coordinate offset. - * @param width the width of the blitted portion. - * @param height the height of the blitted portion. - * @param textureWidth the width of the texture. - * @param textureHeight the height of the texture. - */ - public void blit(ResourceLocation atlasLocation, int x, int y, float uOffset, float vOffset, int width, int height, int textureWidth, int textureHeight) { - this.blit(atlasLocation, x, y, width, height, uOffset, vOffset, width, height, textureWidth, textureHeight); - } - - /** - * Performs the inner blit operation for rendering a texture with the specified coordinates and texture coordinates. - * - * @param atlasLocation the location of the texture atlas. - * @param x1 the x-coordinate of the first corner of the blit position. - * @param x2 the x-coordinate of the second corner of the blit position. - * @param y1 the y-coordinate of the first corner of the blit position. - * @param y2 the y-coordinate of the second corner of the blit position. - * @param blitOffset the z-level offset for rendering order. - * @param uWidth the width of the blitted portion in texture coordinates. - * @param vHeight the height of the blitted portion in texture coordinates. - * @param uOffset the horizontal texture coordinate offset. - * @param vOffset the vertical texture coordinate offset. - * @param textureWidth the width of the texture. - * @param textureHeight the height of the texture. - */ - void blit( - ResourceLocation atlasLocation, - int x1, - int x2, - int y1, - int y2, - int blitOffset, - int uWidth, - int vHeight, - float uOffset, - float vOffset, - int textureWidth, - int textureHeight - ) { - this.innerBlit( - atlasLocation, - x1, - x2, - y1, - y2, - blitOffset, - (uOffset + 0.0F) / textureWidth, - (uOffset + uWidth) / textureWidth, - (vOffset + 0.0F) / textureHeight, - (vOffset + vHeight) / textureHeight - ); - } - - /** - * Performs the inner blit operation for rendering a texture with the specified coordinates and texture coordinates without color tinting. - * - * @param atlasLocation the location of the texture atlas. - * @param x1 the x-coordinate of the first corner of the blit position. - * @param x2 the x-coordinate of the second corner of the blit position. - * @param y1 the y-coordinate of the first corner of the blit position. - * @param y2 the y-coordinate of the second corner of the blit position. - * @param blitOffset the z-level offset for rendering order. - * @param minU the minimum horizontal texture coordinate. - * @param maxU the maximum horizontal texture coordinate. - * @param minV the minimum vertical texture coordinate. - * @param maxV the maximum vertical texture coordinate. - */ - void innerBlit(ResourceLocation atlasLocation, int x1, int x2, int y1, int y2, int blitOffset, float minU, float maxU, float minV, float maxV) { - RenderSystem.setShaderTexture(0, atlasLocation); - RenderSystem.setShader(GameRenderer::getPositionTexShader); - Matrix4f matrix4f = this.pose.last().pose(); - BufferBuilder bufferBuilder = Tesselator.getInstance().begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX); - bufferBuilder.addVertex(matrix4f, x1, y1, blitOffset).setUv(minU, minV); - bufferBuilder.addVertex(matrix4f, x1, y2, blitOffset).setUv(minU, maxV); - bufferBuilder.addVertex(matrix4f, x2, y2, blitOffset).setUv(maxU, maxV); - bufferBuilder.addVertex(matrix4f, x2, y1, blitOffset).setUv(maxU, minV); - BufferUploader.drawWithShader(bufferBuilder.buildOrThrow()); - } - - /** - * Performs the inner blit operation for rendering a texture with the specified coordinates, texture coordinates, and color tint. - * - * @param atlasLocation the location of the texture atlas. - * @param x1 the x-coordinate of the first corner of the blit position. - * @param x2 the x-coordinate of the second corner of the blit position. - * @param y1 the y-coordinate of the first corner of the blit position. - * @param y2 the y-coordinate of the second corner of the blit position. - * @param blitOffset the z-level offset for rendering order. - * @param minU the minimum horizontal texture coordinate. - * @param maxU the maximum horizontal texture coordinate. - * @param minV the minimum vertical texture coordinate. - * @param maxV the maximum vertical texture coordinate. - * @param red the red component of the color tint. - * @param green the green component of the color tint. - * @param blue the blue component of the color tint. - * @param alpha the alpha component of the color tint. - */ - void innerBlit( - ResourceLocation atlasLocation, - int x1, - int x2, - int y1, - int y2, - int blitOffset, - float minU, - float maxU, - float minV, - float maxV, - float red, - float green, - float blue, - float alpha - ) { - RenderSystem.setShaderTexture(0, atlasLocation); - RenderSystem.setShader(GameRenderer::getPositionTexColorShader); - RenderSystem.enableBlend(); - Matrix4f matrix4f = this.pose.last().pose(); - BufferBuilder bufferBuilder = Tesselator.getInstance().begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX_COLOR); - bufferBuilder.addVertex(matrix4f, x1, y1, blitOffset).setUv(minU, minV).setColor(red, green, blue, alpha); - bufferBuilder.addVertex(matrix4f, x1, y2, blitOffset).setUv(minU, maxV).setColor(red, green, blue, alpha); - bufferBuilder.addVertex(matrix4f, x2, y2, blitOffset).setUv(maxU, maxV).setColor(red, green, blue, alpha); - bufferBuilder.addVertex(matrix4f, x2, y1, blitOffset).setUv(maxU, minV).setColor(red, green, blue, alpha); - BufferUploader.drawWithShader(bufferBuilder.buildOrThrow()); - RenderSystem.disableBlend(); - } - - private void blitNineSlicedSprite(TextureAtlasSprite sprite, GuiSpriteScaling.NineSlice nineSlice, int x, int y, int blitOffset, int width, int height) { - GuiSpriteScaling.NineSlice.Border border = nineSlice.border(); - int i = Math.min(border.left(), width / 2); - int j = Math.min(border.right(), width / 2); - int k = Math.min(border.top(), height / 2); - int l = Math.min(border.bottom(), height / 2); - if (width == nineSlice.width() && height == nineSlice.height()) { - this.blitSprite(sprite, nineSlice.width(), nineSlice.height(), 0, 0, x, y, blitOffset, width, height); - } else if (height == nineSlice.height()) { - this.blitSprite(sprite, nineSlice.width(), nineSlice.height(), 0, 0, x, y, blitOffset, i, height); - this.blitTiledSprite( - sprite, x + i, y, blitOffset, width - j - i, height, i, 0, nineSlice.width() - j - i, nineSlice.height(), nineSlice.width(), nineSlice.height() + Border border = nineSlice.border(); + int n = Math.min(border.left(), k / 2); + int o = Math.min(border.right(), k / 2); + int p = Math.min(border.top(), l / 2); + int q = Math.min(border.bottom(), l / 2); + if (k == nineSlice.width() && l == nineSlice.height()) { + this.blitSprite(function, textureAtlasSprite, nineSlice.width(), nineSlice.height(), 0, 0, i, j, k, l, m); + } else if (l == nineSlice.height()) { + this.blitSprite(function, textureAtlasSprite, nineSlice.width(), nineSlice.height(), 0, 0, i, j, n, l, m); + this.blitNineSliceInnerSegment( + function, + nineSlice, + textureAtlasSprite, + i + n, + j, + k - o - n, + l, + n, + 0, + nineSlice.width() - o - n, + nineSlice.height(), + nineSlice.width(), + nineSlice.height(), + m ); - this.blitSprite(sprite, nineSlice.width(), nineSlice.height(), nineSlice.width() - j, 0, x + width - j, y, blitOffset, j, height); - } else if (width == nineSlice.width()) { - this.blitSprite(sprite, nineSlice.width(), nineSlice.height(), 0, 0, x, y, blitOffset, width, k); - this.blitTiledSprite( - sprite, x, y + k, blitOffset, width, height - l - k, 0, k, nineSlice.width(), nineSlice.height() - l - k, nineSlice.width(), nineSlice.height() + this.blitSprite(function, textureAtlasSprite, nineSlice.width(), nineSlice.height(), nineSlice.width() - o, 0, i + k - o, j, o, l, m); + } else if (k == nineSlice.width()) { + this.blitSprite(function, textureAtlasSprite, nineSlice.width(), nineSlice.height(), 0, 0, i, j, k, p, m); + this.blitNineSliceInnerSegment( + function, + nineSlice, + textureAtlasSprite, + i, + j + p, + k, + l - q - p, + 0, + p, + nineSlice.width(), + nineSlice.height() - q - p, + nineSlice.width(), + nineSlice.height(), + m ); - this.blitSprite(sprite, nineSlice.width(), nineSlice.height(), 0, nineSlice.height() - l, x, y + height - l, blitOffset, width, l); + this.blitSprite(function, textureAtlasSprite, nineSlice.width(), nineSlice.height(), 0, nineSlice.height() - q, i, j + l - q, k, q, m); } else { - this.blitSprite(sprite, nineSlice.width(), nineSlice.height(), 0, 0, x, y, blitOffset, i, k); - this.blitTiledSprite(sprite, x + i, y, blitOffset, width - j - i, k, i, 0, nineSlice.width() - j - i, k, nineSlice.width(), nineSlice.height()); - this.blitSprite(sprite, nineSlice.width(), nineSlice.height(), nineSlice.width() - j, 0, x + width - j, y, blitOffset, j, k); - this.blitSprite(sprite, nineSlice.width(), nineSlice.height(), 0, nineSlice.height() - l, x, y + height - l, blitOffset, i, l); - this.blitTiledSprite( - sprite, x + i, y + height - l, blitOffset, width - j - i, l, i, nineSlice.height() - l, nineSlice.width() - j - i, l, nineSlice.width(), nineSlice.height() + this.blitSprite(function, textureAtlasSprite, nineSlice.width(), nineSlice.height(), 0, 0, i, j, n, p, m); + this.blitNineSliceInnerSegment( + function, nineSlice, textureAtlasSprite, i + n, j, k - o - n, p, n, 0, nineSlice.width() - o - n, p, nineSlice.width(), nineSlice.height(), m + ); + this.blitSprite(function, textureAtlasSprite, nineSlice.width(), nineSlice.height(), nineSlice.width() - o, 0, i + k - o, j, o, p, m); + this.blitSprite(function, textureAtlasSprite, nineSlice.width(), nineSlice.height(), 0, nineSlice.height() - q, i, j + l - q, n, q, m); + this.blitNineSliceInnerSegment( + function, + nineSlice, + textureAtlasSprite, + i + n, + j + l - q, + k - o - n, + q, + n, + nineSlice.height() - q, + nineSlice.width() - o - n, + q, + nineSlice.width(), + nineSlice.height(), + m ); this.blitSprite( - sprite, nineSlice.width(), nineSlice.height(), nineSlice.width() - j, nineSlice.height() - l, x + width - j, y + height - l, blitOffset, j, l + function, textureAtlasSprite, nineSlice.width(), nineSlice.height(), nineSlice.width() - o, nineSlice.height() - q, i + k - o, j + l - q, o, q, m ); - this.blitTiledSprite(sprite, x, y + k, blitOffset, i, height - l - k, 0, k, i, nineSlice.height() - l - k, nineSlice.width(), nineSlice.height()); - this.blitTiledSprite( - sprite, - x + i, - y + k, - blitOffset, - width - j - i, - height - l - k, - i, - k, - nineSlice.width() - j - i, - nineSlice.height() - l - k, + this.blitNineSliceInnerSegment( + function, nineSlice, textureAtlasSprite, i, j + p, n, l - q - p, 0, p, n, nineSlice.height() - q - p, nineSlice.width(), nineSlice.height(), m + ); + this.blitNineSliceInnerSegment( + function, + nineSlice, + textureAtlasSprite, + i + n, + j + p, + k - o - n, + l - q - p, + n, + p, + nineSlice.width() - o - n, + nineSlice.height() - q - p, nineSlice.width(), - nineSlice.height() + nineSlice.height(), + m ); - this.blitTiledSprite( - sprite, x + width - j, y + k, blitOffset, i, height - l - k, nineSlice.width() - j, k, j, nineSlice.height() - l - k, nineSlice.width(), nineSlice.height() + this.blitNineSliceInnerSegment( + function, + nineSlice, + textureAtlasSprite, + i + k - o, + j + p, + n, + l - q - p, + nineSlice.width() - o, + p, + o, + nineSlice.height() - q - p, + nineSlice.width(), + nineSlice.height(), + m ); } } + private void blitNineSliceInnerSegment( + Function function, + GuiSpriteScaling.NineSlice nineSlice, + TextureAtlasSprite textureAtlasSprite, + int i, + int j, + int k, + int l, + int m, + int n, + int o, + int p, + int q, + int r, + int s + ) { + if (k > 0 && l > 0) { + if (nineSlice.stretchInner()) { + this.innerBlit( + function, + textureAtlasSprite.atlasLocation(), + i, + i + k, + j, + j + l, + textureAtlasSprite.getU((float)m / q), + textureAtlasSprite.getU((float)(m + o) / q), + textureAtlasSprite.getV((float)n / r), + textureAtlasSprite.getV((float)(n + p) / r), + s + ); + } else { + this.blitTiledSprite(function, textureAtlasSprite, i, j, k, l, m, n, o, p, q, r, s); + } + } + } + private void blitTiledSprite( - TextureAtlasSprite sprite, - int x, - int y, - int blitOffset, - int width, - int height, - int uPosition, - int vPosition, - int spriteWidth, - int spriteHeight, - int nineSliceWidth, - int nineSliceHeight + Function function, + TextureAtlasSprite textureAtlasSprite, + int i, + int j, + int k, + int l, + int m, + int n, + int o, + int p, + int q, + int r, + int s ) { - if (width > 0 && height > 0) { - if (spriteWidth > 0 && spriteHeight > 0) { - for (int i = 0; i < width; i += spriteWidth) { - int j = Math.min(spriteWidth, width - i); + if (k > 0 && l > 0) { + if (o > 0 && p > 0) { + for (int t = 0; t < k; t += o) { + int u = Math.min(o, k - t); - for (int k = 0; k < height; k += spriteHeight) { - int l = Math.min(spriteHeight, height - k); - this.blitSprite(sprite, nineSliceWidth, nineSliceHeight, uPosition, vPosition, x + i, y + k, blitOffset, j, l); + for (int v = 0; v < l; v += p) { + int w = Math.min(p, l - v); + this.blitSprite(function, textureAtlasSprite, q, r, m, n, i + t, j + v, u, w, s); } } } else { - throw new IllegalArgumentException("Tiled sprite texture size must be positive, got " + spriteWidth + "x" + spriteHeight); + throw new IllegalArgumentException("Tiled sprite texture size must be positive, got " + o + "x" + p); } } } + public void blit( + Function function, ResourceLocation resourceLocation, int i, int j, float f, float g, int k, int l, int m, int n, int o + ) { + this.blit(function, resourceLocation, i, j, f, g, k, l, k, l, m, n, o); + } + + public void blit( + Function function, ResourceLocation resourceLocation, int i, int j, float f, float g, int k, int l, int m, int n + ) { + this.blit(function, resourceLocation, i, j, f, g, k, l, k, l, m, n); + } + + public void blit( + Function function, ResourceLocation resourceLocation, int i, int j, float f, float g, int k, int l, int m, int n, int o, int p + ) { + this.blit(function, resourceLocation, i, j, f, g, k, l, m, n, o, p, -1); + } + + public void blit( + Function function, + ResourceLocation resourceLocation, + int i, + int j, + float f, + float g, + int k, + int l, + int m, + int n, + int o, + int p, + int q + ) { + this.innerBlit(function, resourceLocation, i, i + k, j, j + l, (f + 0.0F) / o, (f + m) / o, (g + 0.0F) / p, (g + n) / p, q); + } + + private void innerBlit( + Function function, ResourceLocation resourceLocation, int i, int j, int k, int l, float f, float g, float h, float m, int n + ) { + RenderType renderType = (RenderType)function.apply(resourceLocation); + Matrix4f matrix4f = this.pose.last().pose(); + VertexConsumer vertexConsumer = this.bufferSource.getBuffer(renderType); + vertexConsumer.addVertex(matrix4f, (float)i, (float)k, 0.0F).setUv(f, h).setColor(n); + vertexConsumer.addVertex(matrix4f, (float)i, (float)l, 0.0F).setUv(f, m).setColor(n); + vertexConsumer.addVertex(matrix4f, (float)j, (float)l, 0.0F).setUv(g, m).setColor(n); + vertexConsumer.addVertex(matrix4f, (float)j, (float)k, 0.0F).setUv(g, h).setColor(n); + } + /** * Renders an item stack at the specified coordinates. * @@ -1082,12 +942,22 @@ public class GuiGraphics { this.pose.scale(16.0F, -16.0F, 16.0F); boolean bl = !bakedModel.usesBlockLight(); if (bl) { + this.flush(); Lighting.setupForFlatItems(); } - this.minecraft - .getItemRenderer() - .render(stack, ItemDisplayContext.GUI, false, this.pose, this.bufferSource(), 15728880, OverlayTexture.NO_OVERLAY, bakedModel); + if (stack.is(ItemTags.BUNDLES)) { + this.minecraft + .getItemRenderer() + .renderBundleItem( + stack, ItemDisplayContext.GUI, false, this.pose, this.bufferSource, 15728880, OverlayTexture.NO_OVERLAY, bakedModel, level, entity, seed + ); + } else { + this.minecraft + .getItemRenderer() + .render(stack, ItemDisplayContext.GUI, false, this.pose, this.bufferSource, 15728880, OverlayTexture.NO_OVERLAY, bakedModel); + } + this.flush(); if (bl) { Lighting.setupFor3DItems(); @@ -1129,31 +999,9 @@ public class GuiGraphics { public void renderItemDecorations(Font font, ItemStack stack, int x, int y, @Nullable String text) { if (!stack.isEmpty()) { this.pose.pushPose(); - if (stack.getCount() != 1 || text != null) { - String string = text == null ? String.valueOf(stack.getCount()) : text; - this.pose.translate(0.0F, 0.0F, 200.0F); - this.drawString(font, string, x + 19 - 2 - font.width(string), y + 6 + 3, 16777215, true); - } - - if (stack.isBarVisible()) { - int i = stack.getBarWidth(); - int j = stack.getBarColor(); - int k = x + 2; - int l = y + 13; - this.fill(RenderType.guiOverlay(), k, l, k + 13, l + 2, -16777216); - this.fill(RenderType.guiOverlay(), k, l, k + i, l + 1, j | 0xFF000000); - } - - LocalPlayer localPlayer = this.minecraft.player; - float f = localPlayer == null - ? 0.0F - : localPlayer.getCooldowns().getCooldownPercent(stack.getItem(), this.minecraft.getTimer().getGameTimeDeltaPartialTick(true)); - if (f > 0.0F) { - int k = y + Mth.floor(16.0F * (1.0F - f)); - int l = k + Mth.ceil(16.0F * f); - this.fill(RenderType.guiOverlay(), x, k, x + 16, l, Integer.MAX_VALUE); - } - + this.renderItemBar(stack, x, y); + this.renderItemCount(font, stack, x, y, text); + this.renderItemCooldown(stack, x, y); this.pose.popPose(); } } @@ -1167,7 +1015,7 @@ public class GuiGraphics { * @param mouseY the y-coordinate of the mouse position. */ public void renderTooltip(Font font, ItemStack stack, int mouseX, int mouseY) { - this.renderTooltip(font, Screen.getTooltipFromItem(this.minecraft, stack), stack.getTooltipImage(), mouseX, mouseY); + this.renderTooltip(font, Screen.getTooltipFromItem(this.minecraft, stack), stack.getTooltipImage(), mouseX, mouseY, stack.get(DataComponents.TOOLTIP_STYLE)); } /** @@ -1180,12 +1028,16 @@ public class GuiGraphics { * @param mouseY the y-coordinate of the mouse position. */ public void renderTooltip(Font font, List tooltipLines, Optional visualTooltipComponent, int mouseX, int mouseY) { - List list = (List)tooltipLines.stream() + this.renderTooltip(font, tooltipLines, visualTooltipComponent, mouseX, mouseY, null); + } + + public void renderTooltip(Font font, List list, Optional optional, int i, int j, @Nullable ResourceLocation resourceLocation) { + List list2 = (List)list.stream() .map(Component::getVisualOrderText) .map(ClientTooltipComponent::create) .collect(Util.toMutableList()); - visualTooltipComponent.ifPresent(tooltipComponent -> list.add(list.isEmpty() ? 0 : 1, ClientTooltipComponent.create(tooltipComponent))); - this.renderTooltipInternal(font, list, mouseX, mouseY, DefaultTooltipPositioner.INSTANCE); + optional.ifPresent(tooltipComponent -> list2.add(list2.isEmpty() ? 0 : 1, ClientTooltipComponent.create(tooltipComponent))); + this.renderTooltipInternal(font, list2, i, j, DefaultTooltipPositioner.INSTANCE, resourceLocation); } /** @@ -1197,7 +1049,11 @@ public class GuiGraphics { * @param mouseY the y-coordinate of the mouse position. */ public void renderTooltip(Font font, Component text, int mouseX, int mouseY) { - this.renderTooltip(font, List.of(text.getVisualOrderText()), mouseX, mouseY); + this.renderTooltip(font, text, mouseX, mouseY, null); + } + + public void renderTooltip(Font font, Component component, int i, int j, @Nullable ResourceLocation resourceLocation) { + this.renderTooltip(font, List.of(component.getVisualOrderText()), i, j, resourceLocation); } /** @@ -1209,7 +1065,18 @@ public class GuiGraphics { * @param mouseY the y-coordinate of the mouse position. */ public void renderComponentTooltip(Font font, List tooltipLines, int mouseX, int mouseY) { - this.renderTooltip(font, Lists.transform(tooltipLines, Component::getVisualOrderText), mouseX, mouseY); + this.renderComponentTooltip(font, tooltipLines, mouseX, mouseY, null); + } + + public void renderComponentTooltip(Font font, List list, int i, int j, @Nullable ResourceLocation resourceLocation) { + this.renderTooltipInternal( + font, + list.stream().map(Component::getVisualOrderText).map(ClientTooltipComponent::create).toList(), + i, + j, + DefaultTooltipPositioner.INSTANCE, + resourceLocation + ); } /** @@ -1221,12 +1088,17 @@ public class GuiGraphics { * @param mouseY the y-coordinate of the mouse position. */ public void renderTooltip(Font font, List tooltipLines, int mouseX, int mouseY) { + this.renderTooltip(font, tooltipLines, mouseX, mouseY, null); + } + + public void renderTooltip(Font font, List list, int i, int j, @Nullable ResourceLocation resourceLocation) { this.renderTooltipInternal( font, - (List)tooltipLines.stream().map(ClientTooltipComponent::create).collect(Collectors.toList()), - mouseX, - mouseY, - DefaultTooltipPositioner.INSTANCE + (List)list.stream().map(ClientTooltipComponent::create).collect(Collectors.toList()), + i, + j, + DefaultTooltipPositioner.INSTANCE, + resourceLocation ); } @@ -1245,62 +1117,87 @@ public class GuiGraphics { (List)tooltipLines.stream().map(ClientTooltipComponent::create).collect(Collectors.toList()), mouseX, mouseY, - tooltipPositioner + tooltipPositioner, + null ); } - /** - * Renders an internal tooltip with customizable tooltip components at the specified mouse coordinates using a tooltip positioner. - * - * @param font the font used for rendering text. - * @param components the tooltip components to render. - * @param mouseX the x-coordinate of the mouse position. - * @param mouseY the y-coordinate of the mouse position. - * @param tooltipPositioner the positioner to determine the tooltip's position. - */ - private void renderTooltipInternal(Font font, List components, int mouseX, int mouseY, ClientTooltipPositioner tooltipPositioner) { - if (!components.isEmpty()) { - int i = 0; - int j = components.size() == 1 ? -2 : 0; + private void renderTooltipInternal( + Font font, List list, int i, int j, ClientTooltipPositioner clientTooltipPositioner, @Nullable ResourceLocation resourceLocation + ) { + if (!list.isEmpty()) { + int k = 0; + int l = list.size() == 1 ? -2 : 0; - for (ClientTooltipComponent clientTooltipComponent : components) { - int k = clientTooltipComponent.getWidth(font); - if (k > i) { - i = k; + for (ClientTooltipComponent clientTooltipComponent : list) { + int m = clientTooltipComponent.getWidth(font); + if (m > k) { + k = m; } - j += clientTooltipComponent.getHeight(); + l += clientTooltipComponent.getHeight(font); } - int l = i; - int m = j; - Vector2ic vector2ic = tooltipPositioner.positionTooltip(this.guiWidth(), this.guiHeight(), mouseX, mouseY, l, m); - int n = vector2ic.x(); - int o = vector2ic.y(); + int n = k; + int o = l; + Vector2ic vector2ic = clientTooltipPositioner.positionTooltip(this.guiWidth(), this.guiHeight(), i, j, k, l); + int p = vector2ic.x(); + int q = vector2ic.y(); this.pose.pushPose(); - int p = 400; - this.drawManaged(() -> TooltipRenderUtil.renderTooltipBackground(this, n, o, l, m, 400)); + int r = 400; + TooltipRenderUtil.renderTooltipBackground(this, p, q, k, l, 400, resourceLocation); this.pose.translate(0.0F, 0.0F, 400.0F); - int q = o; + int s = q; - for (int r = 0; r < components.size(); r++) { - ClientTooltipComponent clientTooltipComponent2 = (ClientTooltipComponent)components.get(r); - clientTooltipComponent2.renderText(font, n, q, this.pose.last().pose(), this.bufferSource); - q += clientTooltipComponent2.getHeight() + (r == 0 ? 2 : 0); + for (int t = 0; t < list.size(); t++) { + ClientTooltipComponent clientTooltipComponent2 = (ClientTooltipComponent)list.get(t); + clientTooltipComponent2.renderText(font, p, s, this.pose.last().pose(), this.bufferSource); + s += clientTooltipComponent2.getHeight(font) + (t == 0 ? 2 : 0); } - q = o; + s = q; - for (int r = 0; r < components.size(); r++) { - ClientTooltipComponent clientTooltipComponent2 = (ClientTooltipComponent)components.get(r); - clientTooltipComponent2.renderImage(font, n, q, this); - q += clientTooltipComponent2.getHeight() + (r == 0 ? 2 : 0); + for (int t = 0; t < list.size(); t++) { + ClientTooltipComponent clientTooltipComponent2 = (ClientTooltipComponent)list.get(t); + clientTooltipComponent2.renderImage(font, p, s, n, o, this); + s += clientTooltipComponent2.getHeight(font) + (t == 0 ? 2 : 0); } this.pose.popPose(); } } + private void renderItemBar(ItemStack itemStack, int i, int j) { + if (itemStack.isBarVisible()) { + int k = i + 2; + int l = j + 13; + this.fill(RenderType.gui(), k, l, k + 13, l + 2, 200, -16777216); + this.fill(RenderType.gui(), k, l, k + itemStack.getBarWidth(), l + 1, 200, ARGB.opaque(itemStack.getBarColor())); + } + } + + private void renderItemCount(Font font, ItemStack itemStack, int i, int j, @Nullable String string) { + if (itemStack.getCount() != 1 || string != null) { + String string2 = string == null ? String.valueOf(itemStack.getCount()) : string; + this.pose.pushPose(); + this.pose.translate(0.0F, 0.0F, 200.0F); + this.drawString(font, string2, i + 19 - 2 - font.width(string2), j + 6 + 3, -1, true); + this.pose.popPose(); + } + } + + private void renderItemCooldown(ItemStack itemStack, int i, int j) { + LocalPlayer localPlayer = this.minecraft.player; + float f = localPlayer == null + ? 0.0F + : localPlayer.getCooldowns().getCooldownPercent(itemStack, this.minecraft.getDeltaTracker().getGameTimeDeltaPartialTick(true)); + if (f > 0.0F) { + int k = j + Mth.floor(16.0F * (1.0F - f)); + int l = k + Mth.ceil(16.0F * f); + this.fill(RenderType.gui(), i, k, i + 16, l, 200, Integer.MAX_VALUE); + } + } + /** * Renders a hover effect for a text component at the specified mouse coordinates. * @@ -1331,6 +1228,11 @@ public class GuiGraphics { } } + public void drawSpecial(Consumer consumer) { + consumer.accept(this.bufferSource); + this.bufferSource.endBatch(); + } + /** * A utility class for managing a stack of screen rectangles for scissoring. */ diff --git a/net/minecraft/client/gui/ItemSlotMouseAction.java b/net/minecraft/client/gui/ItemSlotMouseAction.java new file mode 100644 index 00000000..822e17d8 --- /dev/null +++ b/net/minecraft/client/gui/ItemSlotMouseAction.java @@ -0,0 +1,18 @@ +package net.minecraft.client.gui; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.world.inventory.ClickType; +import net.minecraft.world.inventory.Slot; +import net.minecraft.world.item.ItemStack; + +@Environment(EnvType.CLIENT) +public interface ItemSlotMouseAction { + boolean matches(Slot slot); + + boolean onMouseScrolled(double d, double e, int i, ItemStack itemStack); + + void onStopHovering(Slot slot); + + void onSlotClicked(Slot slot, ClickType clickType); +} diff --git a/net/minecraft/client/gui/MapRenderer.java b/net/minecraft/client/gui/MapRenderer.java deleted file mode 100644 index 36e89c3a..00000000 --- a/net/minecraft/client/gui/MapRenderer.java +++ /dev/null @@ -1,170 +0,0 @@ -package net.minecraft.client.gui; - -import com.mojang.blaze3d.vertex.PoseStack; -import com.mojang.blaze3d.vertex.VertexConsumer; -import com.mojang.math.Axis; -import it.unimi.dsi.fastutil.ints.Int2ObjectMap; -import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.MultiBufferSource; -import net.minecraft.client.renderer.RenderType; -import net.minecraft.client.renderer.texture.DynamicTexture; -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.client.renderer.texture.TextureManager; -import net.minecraft.client.resources.MapDecorationTextureManager; -import net.minecraft.network.chat.Component; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.util.Mth; -import net.minecraft.world.level.material.MapColor; -import net.minecraft.world.level.saveddata.maps.MapDecoration; -import net.minecraft.world.level.saveddata.maps.MapId; -import net.minecraft.world.level.saveddata.maps.MapItemSavedData; -import org.joml.Matrix4f; - -@Environment(EnvType.CLIENT) -public class MapRenderer implements AutoCloseable { - private static final int WIDTH = 128; - private static final int HEIGHT = 128; - final TextureManager textureManager; - final MapDecorationTextureManager decorationTextures; - private final Int2ObjectMap maps = new Int2ObjectOpenHashMap<>(); - - public MapRenderer(TextureManager textureManager, MapDecorationTextureManager decorationTextures) { - this.textureManager = textureManager; - this.decorationTextures = decorationTextures; - } - - public void update(MapId mapId, MapItemSavedData mapData) { - this.getOrCreateMapInstance(mapId, mapData).forceUpload(); - } - - public void render(PoseStack poseStack, MultiBufferSource buffer, MapId mapId, MapItemSavedData mapData, boolean active, int packedLight) { - this.getOrCreateMapInstance(mapId, mapData).draw(poseStack, buffer, active, packedLight); - } - - private MapRenderer.MapInstance getOrCreateMapInstance(MapId mapId, MapItemSavedData mapData) { - return this.maps.compute(mapId.id(), (integer, mapInstance) -> { - if (mapInstance == null) { - return new MapRenderer.MapInstance(integer, mapData); - } else { - mapInstance.replaceMapData(mapData); - return mapInstance; - } - }); - } - - /** - * Clears the currently loaded maps and removes their corresponding textures - */ - public void resetData() { - for (MapRenderer.MapInstance mapInstance : this.maps.values()) { - mapInstance.close(); - } - - this.maps.clear(); - } - - public void close() { - this.resetData(); - } - - @Environment(EnvType.CLIENT) - class MapInstance implements AutoCloseable { - private MapItemSavedData data; - private final DynamicTexture texture; - private final RenderType renderType; - private boolean requiresUpload = true; - - MapInstance(final int id, final MapItemSavedData data) { - this.data = data; - this.texture = new DynamicTexture(128, 128, true); - ResourceLocation resourceLocation = MapRenderer.this.textureManager.register("map/" + id, this.texture); - this.renderType = RenderType.text(resourceLocation); - } - - void replaceMapData(MapItemSavedData data) { - boolean bl = this.data != data; - this.data = data; - this.requiresUpload |= bl; - } - - public void forceUpload() { - this.requiresUpload = true; - } - - /** - * Updates a map texture. - */ - private void updateTexture() { - for (int i = 0; i < 128; i++) { - for (int j = 0; j < 128; j++) { - int k = j + i * 128; - this.texture.getPixels().setPixelRGBA(j, i, MapColor.getColorFromPackedId(this.data.colors[k])); - } - } - - this.texture.upload(); - } - - void draw(PoseStack poseStack, MultiBufferSource bufferSource, boolean active, int packedLight) { - if (this.requiresUpload) { - this.updateTexture(); - this.requiresUpload = false; - } - - int i = 0; - int j = 0; - float f = 0.0F; - Matrix4f matrix4f = poseStack.last().pose(); - VertexConsumer vertexConsumer = bufferSource.getBuffer(this.renderType); - vertexConsumer.addVertex(matrix4f, 0.0F, 128.0F, -0.01F).setColor(-1).setUv(0.0F, 1.0F).setLight(packedLight); - vertexConsumer.addVertex(matrix4f, 128.0F, 128.0F, -0.01F).setColor(-1).setUv(1.0F, 1.0F).setLight(packedLight); - vertexConsumer.addVertex(matrix4f, 128.0F, 0.0F, -0.01F).setColor(-1).setUv(1.0F, 0.0F).setLight(packedLight); - vertexConsumer.addVertex(matrix4f, 0.0F, 0.0F, -0.01F).setColor(-1).setUv(0.0F, 0.0F).setLight(packedLight); - int k = 0; - - for (MapDecoration mapDecoration : this.data.getDecorations()) { - if (!active || mapDecoration.renderOnFrame()) { - poseStack.pushPose(); - poseStack.translate(0.0F + mapDecoration.x() / 2.0F + 64.0F, 0.0F + mapDecoration.y() / 2.0F + 64.0F, -0.02F); - poseStack.mulPose(Axis.ZP.rotationDegrees(mapDecoration.rot() * 360 / 16.0F)); - poseStack.scale(4.0F, 4.0F, 3.0F); - poseStack.translate(-0.125F, 0.125F, 0.0F); - Matrix4f matrix4f2 = poseStack.last().pose(); - float g = -0.001F; - TextureAtlasSprite textureAtlasSprite = MapRenderer.this.decorationTextures.get(mapDecoration); - float h = textureAtlasSprite.getU0(); - float l = textureAtlasSprite.getV0(); - float m = textureAtlasSprite.getU1(); - float n = textureAtlasSprite.getV1(); - VertexConsumer vertexConsumer2 = bufferSource.getBuffer(RenderType.text(textureAtlasSprite.atlasLocation())); - vertexConsumer2.addVertex(matrix4f2, -1.0F, 1.0F, k * -0.001F).setColor(-1).setUv(h, l).setLight(packedLight); - vertexConsumer2.addVertex(matrix4f2, 1.0F, 1.0F, k * -0.001F).setColor(-1).setUv(m, l).setLight(packedLight); - vertexConsumer2.addVertex(matrix4f2, 1.0F, -1.0F, k * -0.001F).setColor(-1).setUv(m, n).setLight(packedLight); - vertexConsumer2.addVertex(matrix4f2, -1.0F, -1.0F, k * -0.001F).setColor(-1).setUv(h, n).setLight(packedLight); - poseStack.popPose(); - if (mapDecoration.name().isPresent()) { - Font font = Minecraft.getInstance().font; - Component component = (Component)mapDecoration.name().get(); - float o = font.width(component); - float p = Mth.clamp(25.0F / o, 0.0F, 6.0F / 9.0F); - poseStack.pushPose(); - poseStack.translate(0.0F + mapDecoration.x() / 2.0F + 64.0F - o * p / 2.0F, 0.0F + mapDecoration.y() / 2.0F + 64.0F + 4.0F, -0.025F); - poseStack.scale(p, p, 1.0F); - poseStack.translate(0.0F, 0.0F, -0.1F); - font.drawInBatch(component, 0.0F, 0.0F, -1, false, poseStack.last().pose(), bufferSource, Font.DisplayMode.NORMAL, Integer.MIN_VALUE, packedLight); - poseStack.popPose(); - } - - k++; - } - } - } - - public void close() { - this.texture.close(); - } - } -} diff --git a/net/minecraft/client/gui/components/AbstractButton.java b/net/minecraft/client/gui/components/AbstractButton.java index 93092678..203661d8 100644 --- a/net/minecraft/client/gui/components/AbstractButton.java +++ b/net/minecraft/client/gui/components/AbstractButton.java @@ -1,14 +1,15 @@ package net.minecraft.client.gui.components; -import com.mojang.blaze3d.systems.RenderSystem; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Font; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.navigation.CommonInputs; +import net.minecraft.client.renderer.RenderType; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.ARGB; import net.minecraft.util.Mth; @Environment(EnvType.CLIENT) @@ -29,11 +30,15 @@ public abstract class AbstractButton extends AbstractWidget { @Override protected void renderWidget(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) { Minecraft minecraft = Minecraft.getInstance(); - guiGraphics.setColor(1.0F, 1.0F, 1.0F, this.alpha); - RenderSystem.enableBlend(); - RenderSystem.enableDepthTest(); - guiGraphics.blitSprite(SPRITES.get(this.active, this.isHoveredOrFocused()), this.getX(), this.getY(), this.getWidth(), this.getHeight()); - guiGraphics.setColor(1.0F, 1.0F, 1.0F, 1.0F); + guiGraphics.blitSprite( + RenderType::guiTextured, + SPRITES.get(this.active, this.isHoveredOrFocused()), + this.getX(), + this.getY(), + this.getWidth(), + this.getHeight(), + ARGB.white(this.alpha) + ); int i = this.active ? 16777215 : 10526880; this.renderString(guiGraphics, minecraft.font, i | Mth.ceil(this.alpha * 255.0F) << 24); } diff --git a/net/minecraft/client/gui/components/AbstractScrollWidget.java b/net/minecraft/client/gui/components/AbstractScrollWidget.java index 503e8d9e..f8c22ce7 100644 --- a/net/minecraft/client/gui/components/AbstractScrollWidget.java +++ b/net/minecraft/client/gui/components/AbstractScrollWidget.java @@ -1,16 +1,15 @@ package net.minecraft.client.gui.components; -import com.mojang.blaze3d.systems.RenderSystem; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.gui.GuiGraphics; -import net.minecraft.client.gui.components.events.GuiEventListener; +import net.minecraft.client.renderer.RenderType; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; import net.minecraft.util.Mth; @Environment(EnvType.CLIENT) -public abstract class AbstractScrollWidget extends AbstractWidget implements Renderable, GuiEventListener { +public abstract class AbstractScrollWidget extends AbstractWidget { private static final WidgetSprites BACKGROUND_SPRITES = new WidgetSprites( ResourceLocation.withDefaultNamespace("widget/text_field"), ResourceLocation.withDefaultNamespace("widget/text_field_highlighted") ); @@ -151,16 +150,14 @@ public abstract class AbstractScrollWidget extends AbstractWidget implements Ren protected void renderBorder(GuiGraphics guiGraphics, int x, int y, int width, int height) { ResourceLocation resourceLocation = BACKGROUND_SPRITES.get(this.isActive(), this.isFocused()); - guiGraphics.blitSprite(resourceLocation, x, y, width, height); + guiGraphics.blitSprite(RenderType::guiTextured, resourceLocation, x, y, width, height); } private void renderScrollBar(GuiGraphics guiGraphics) { int i = this.getScrollBarHeight(); int j = this.getX() + this.width; int k = Math.max(this.getY(), (int)this.scrollAmount * (this.height - i) / this.getMaxScrollAmount() + this.getY()); - RenderSystem.enableBlend(); - guiGraphics.blitSprite(SCROLLER_SPRITE, j, k, 8, i); - RenderSystem.disableBlend(); + guiGraphics.blitSprite(RenderType::guiTextured, SCROLLER_SPRITE, j, k, 8, i); } protected boolean withinContentAreaTopBottom(int top, int bottom) { diff --git a/net/minecraft/client/gui/components/AbstractSelectionList.java b/net/minecraft/client/gui/components/AbstractSelectionList.java index 071a88ef..9dc80c06 100644 --- a/net/minecraft/client/gui/components/AbstractSelectionList.java +++ b/net/minecraft/client/gui/components/AbstractSelectionList.java @@ -1,7 +1,6 @@ package net.minecraft.client.gui.components; import com.google.common.collect.Lists; -import com.mojang.blaze3d.systems.RenderSystem; import java.util.AbstractList; import java.util.Collection; import java.util.List; @@ -14,11 +13,12 @@ import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.events.ContainerEventHandler; import net.minecraft.client.gui.components.events.GuiEventListener; import net.minecraft.client.gui.layouts.HeaderAndFooterLayout; -import net.minecraft.client.gui.narration.NarratableEntry; import net.minecraft.client.gui.narration.NarratedElementType; import net.minecraft.client.gui.narration.NarrationElementOutput; +import net.minecraft.client.gui.narration.NarratableEntry.NarrationPriority; import net.minecraft.client.gui.navigation.ScreenDirection; import net.minecraft.client.gui.screens.Screen; +import net.minecraft.client.renderer.RenderType; import net.minecraft.network.chat.CommonComponents; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; @@ -59,15 +59,19 @@ public abstract class AbstractSelectionList entries) { + public void replaceEntries(Collection entries) { this.clearEntries(); this.children.addAll(entries); } @@ -187,14 +191,11 @@ public abstract class AbstractSelectionList trimmedMessages = Lists.newArrayList(); + private final List trimmedMessages = Lists.newArrayList(); private int chatScrollbarPos; private boolean newMessageSinceScroll; private final List messageDeletionQueue = new ArrayList(); @@ -68,7 +71,8 @@ public class ChatComponent { int i = this.getLinesPerPage(); int j = this.trimmedMessages.size(); if (j > 0) { - this.minecraft.getProfiler().push("chat"); + ProfilerFiller profilerFiller = Profiler.get(); + profilerFiller.push("chat"); float f = (float)this.getScale(); int k = Mth.ceil(this.getWidth() / f); int l = guiGraphics.guiHeight(); @@ -86,7 +90,7 @@ public class ChatComponent { for (int r = 0; r + this.chatScrollbarPos < this.trimmedMessages.size() && r < i; r++) { int s = r + this.chatScrollbarPos; - GuiMessage.Line line = (GuiMessage.Line)this.trimmedMessages.get(s); + Line line = (Line)this.trimmedMessages.get(s); if (line != null) { int t = tickCount - line.addedTime(); if (t < 200 || focused) { @@ -147,7 +151,7 @@ public class ChatComponent { } guiGraphics.pose().popPose(); - this.minecraft.getProfiler().pop(); + profilerFiller.pop(); } } } @@ -157,7 +161,7 @@ public class ChatComponent { tagIcon.draw(guiGraphics, left, i); } - private int getTagIconLeft(GuiMessage.Line line) { + private int getTagIconLeft(Line line) { return this.minecraft.font.width(line.content()) + 4; } @@ -228,7 +232,7 @@ public class ChatComponent { } boolean bl2 = j == list.size() - 1; - this.trimmedMessages.add(0, new GuiMessage.Line(message.addedTime(), formattedCharSequence, message.tag(), bl2)); + this.trimmedMessages.add(0, new Line(message.addedTime(), formattedCharSequence, message.tag(), bl2)); } while (this.trimmedMessages.size() > 100) { @@ -366,7 +370,7 @@ public class ChatComponent { double e = this.screenToChatY(mouseY); int i = this.getMessageLineIndexAt(d, e); if (i >= 0 && i < this.trimmedMessages.size()) { - GuiMessage.Line line = (GuiMessage.Line)this.trimmedMessages.get(i); + Line line = (Line)this.trimmedMessages.get(i); return this.minecraft.font.getSplitter().componentStyleAtWidth(line.content(), Mth.floor(d)); } else { return null; @@ -379,7 +383,7 @@ public class ChatComponent { double e = this.screenToChatY(mouseY); int i = this.getMessageEndIndexAt(d, e); if (i >= 0 && i < this.trimmedMessages.size()) { - GuiMessage.Line line = (GuiMessage.Line)this.trimmedMessages.get(i); + Line line = (Line)this.trimmedMessages.get(i); GuiMessageTag guiMessageTag = line.tag(); if (guiMessageTag != null && this.hasSelectedMessageTag(d, line, guiMessageTag)) { return guiMessageTag; @@ -389,7 +393,7 @@ public class ChatComponent { return null; } - private boolean hasSelectedMessageTag(double x, GuiMessage.Line line, GuiMessageTag tag) { + private boolean hasSelectedMessageTag(double x, Line line, GuiMessageTag tag) { if (x < 0.0) { return true; } else { @@ -419,7 +423,7 @@ public class ChatComponent { return -1; } else { while (i >= 0) { - if (((GuiMessage.Line)this.trimmedMessages.get(i)).endOfEntry()) { + if (((Line)this.trimmedMessages.get(i)).endOfEntry()) { return i; } diff --git a/net/minecraft/client/gui/components/Checkbox.java b/net/minecraft/client/gui/components/Checkbox.java index 27d29b4a..d66a5cfd 100644 --- a/net/minecraft/client/gui/components/Checkbox.java +++ b/net/minecraft/client/gui/components/Checkbox.java @@ -1,6 +1,5 @@ package net.minecraft.client.gui.components; -import com.mojang.blaze3d.systems.RenderSystem; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.Minecraft; @@ -9,8 +8,10 @@ import net.minecraft.client.gui.Font; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.narration.NarratedElementType; import net.minecraft.client.gui.narration.NarrationElementOutput; +import net.minecraft.client.renderer.RenderType; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.ARGB; import org.jetbrains.annotations.Nullable; @Environment(EnvType.CLIENT) @@ -80,10 +81,7 @@ public class Checkbox extends AbstractButton { @Override public void renderWidget(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) { Minecraft minecraft = Minecraft.getInstance(); - RenderSystem.enableDepthTest(); Font font = minecraft.font; - guiGraphics.setColor(1.0F, 1.0F, 1.0F, this.alpha); - RenderSystem.enableBlend(); ResourceLocation resourceLocation; if (this.selected) { resourceLocation = this.isFocused() ? CHECKBOX_SELECTED_HIGHLIGHTED_SPRITE : CHECKBOX_SELECTED_SPRITE; @@ -92,7 +90,7 @@ public class Checkbox extends AbstractButton { } int i = getBoxSize(font); - guiGraphics.blitSprite(resourceLocation, this.getX(), this.getY(), i, i); + guiGraphics.blitSprite(RenderType::guiTextured, resourceLocation, this.getX(), this.getY(), i, i, ARGB.white(this.alpha)); int j = this.getX() + i + 4; int k = this.getY() + i / 2 - this.textWidget.getHeight() / 2; this.textWidget.setPosition(j, k); diff --git a/net/minecraft/client/gui/components/ContainerObjectSelectionList.java b/net/minecraft/client/gui/components/ContainerObjectSelectionList.java index b3081ecd..510ca089 100644 --- a/net/minecraft/client/gui/components/ContainerObjectSelectionList.java +++ b/net/minecraft/client/gui/components/ContainerObjectSelectionList.java @@ -10,9 +10,11 @@ import net.minecraft.client.gui.components.events.GuiEventListener; import net.minecraft.client.gui.narration.NarratableEntry; import net.minecraft.client.gui.narration.NarratedElementType; import net.minecraft.client.gui.narration.NarrationElementOutput; +import net.minecraft.client.gui.narration.NarratableEntry.NarrationPriority; import net.minecraft.client.gui.navigation.FocusNavigationEvent; import net.minecraft.client.gui.navigation.ScreenAxis; import net.minecraft.client.gui.navigation.ScreenDirection; +import net.minecraft.client.gui.navigation.FocusNavigationEvent.ArrowNavigation; import net.minecraft.client.gui.screens.Screen; import net.minecraft.network.chat.Component; import net.minecraft.util.Mth; @@ -29,7 +31,7 @@ public abstract class ContainerObjectSelectionList -1; case RIGHT -> 1; @@ -204,7 +206,7 @@ public abstract class ContainerObjectSelectionList extends AbstractButton { List getDefaultList(); static CycleButton.ValueListSupplier create(Collection values) { - final List list = ImmutableList.copyOf(values); - return new CycleButton.ValueListSupplier() { - @Override - public List getSelectedList() { - return list; - } - - @Override - public List getDefaultList() { - return list; - } - }; + List list = ImmutableList.copyOf(values); + return new 1(list); } static CycleButton.ValueListSupplier create(BooleanSupplier altListSelector, List defaultList, List selectedList) { - final List list = ImmutableList.copyOf(defaultList); - final List list2 = ImmutableList.copyOf(selectedList); - return new CycleButton.ValueListSupplier() { - @Override - public List getSelectedList() { - return altListSelector.getAsBoolean() ? list2 : list; - } - - @Override - public List getDefaultList() { - return list; - } - }; + List list = ImmutableList.copyOf(defaultList); + List list2 = ImmutableList.copyOf(selectedList); + return new 2(altListSelector, list2, list); } } } diff --git a/net/minecraft/client/gui/components/DebugScreenOverlay.java b/net/minecraft/client/gui/components/DebugScreenOverlay.java index ef354fc1..4db0cafe 100644 --- a/net/minecraft/client/gui/components/DebugScreenOverlay.java +++ b/net/minecraft/client/gui/components/DebugScreenOverlay.java @@ -32,9 +32,9 @@ import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.debugchart.BandwidthDebugChart; import net.minecraft.client.gui.components.debugchart.FpsDebugChart; import net.minecraft.client.gui.components.debugchart.PingDebugChart; +import net.minecraft.client.gui.components.debugchart.ProfilerPieChart; import net.minecraft.client.gui.components.debugchart.TpsDebugChart; import net.minecraft.client.multiplayer.ClientPacketListener; -import net.minecraft.client.renderer.PostChain; import net.minecraft.client.server.IntegratedServer; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -42,6 +42,7 @@ import net.minecraft.core.Holder; import net.minecraft.core.SectionPos; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.network.Connection; +import net.minecraft.resources.ResourceLocation; import net.minecraft.server.ServerTickRateManager; import net.minecraft.server.level.ServerChunkCache; import net.minecraft.server.level.ServerLevel; @@ -49,6 +50,9 @@ import net.minecraft.util.Mth; import net.minecraft.util.debugchart.LocalSampleLogger; import net.minecraft.util.debugchart.RemoteDebugSampleType; import net.minecraft.util.debugchart.TpsDebugDimensions; +import net.minecraft.util.profiling.Profiler; +import net.minecraft.util.profiling.ProfilerFiller; +import net.minecraft.util.profiling.Zone; import net.minecraft.world.DifficultyInstance; import net.minecraft.world.TickRateManager; import net.minecraft.world.entity.Entity; @@ -70,6 +74,7 @@ import net.minecraft.world.level.levelgen.RandomState; import net.minecraft.world.level.material.FluidState; import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.HitResult; +import net.minecraft.world.phys.HitResult.Type; import org.jetbrains.annotations.Nullable; @Environment(EnvType.CLIENT) @@ -110,6 +115,7 @@ public class DebugScreenOverlay { private final TpsDebugChart tpsChart; private final PingDebugChart pingChart; private final BandwidthDebugChart bandwidthChart; + private final ProfilerPieChart profilerPieChart; public DebugScreenOverlay(Minecraft minecraft) { this.minecraft = minecraft; @@ -119,6 +125,7 @@ public class DebugScreenOverlay { this.tpsChart = new TpsDebugChart(this.font, this.tickTimeLogger, () -> minecraft.level.tickRateManager().millisecondsPerTick()); this.pingChart = new PingDebugChart(this.font, this.pingLogger); this.bandwidthChart = new BandwidthDebugChart(this.font, this.bandwidthLogger); + this.profilerPieChart = new ProfilerPieChart(this.font); } public void clearChunkCache() { @@ -127,35 +134,43 @@ public class DebugScreenOverlay { } public void render(GuiGraphics guiGraphics) { - this.minecraft.getProfiler().push("debug"); + ProfilerFiller profilerFiller = Profiler.get(); + profilerFiller.push("debug"); Entity entity = this.minecraft.getCameraEntity(); this.block = entity.pick(20.0, 0.0F, false); this.liquid = entity.pick(20.0, 0.0F, true); - guiGraphics.drawManaged(() -> { - this.drawGameInformation(guiGraphics); - this.drawSystemInformation(guiGraphics); - if (this.renderFpsCharts) { - int i = guiGraphics.guiWidth(); - int j = i / 2; - this.fpsChart.drawChart(guiGraphics, 0, this.fpsChart.getWidth(j)); - if (this.tickTimeLogger.size() > 0) { - int k = this.tpsChart.getWidth(j); - this.tpsChart.drawChart(guiGraphics, i - k, k); - } + this.drawGameInformation(guiGraphics); + this.drawSystemInformation(guiGraphics); + this.profilerPieChart.setBottomOffset(10); + if (this.renderFpsCharts) { + int i = guiGraphics.guiWidth(); + int j = i / 2; + this.fpsChart.drawChart(guiGraphics, 0, this.fpsChart.getWidth(j)); + if (this.tickTimeLogger.size() > 0) { + int k = this.tpsChart.getWidth(j); + this.tpsChart.drawChart(guiGraphics, i - k, k); } - if (this.renderNetworkCharts) { - int i = guiGraphics.guiWidth(); - int j = i / 2; - if (!this.minecraft.isLocalServer()) { - this.bandwidthChart.drawChart(guiGraphics, 0, this.bandwidthChart.getWidth(j)); - } + this.profilerPieChart.setBottomOffset(this.tpsChart.getFullHeight()); + } - int k = this.pingChart.getWidth(j); - this.pingChart.drawChart(guiGraphics, i - k, k); + if (this.renderNetworkCharts) { + int i = guiGraphics.guiWidth(); + int j = i / 2; + if (!this.minecraft.isLocalServer()) { + this.bandwidthChart.drawChart(guiGraphics, 0, this.bandwidthChart.getWidth(j)); } - }); - this.minecraft.getProfiler().pop(); + + int k = this.pingChart.getWidth(j); + this.pingChart.drawChart(guiGraphics, i - k, k); + this.profilerPieChart.setBottomOffset(this.pingChart.getFullHeight()); + } + + try (Zone zone = profilerFiller.zone("profilerPie")) { + this.profilerPieChart.render(guiGraphics); + } + + profilerFiller.pop(); } protected void drawGameInformation(GuiGraphics guiGraphics) { @@ -368,7 +383,7 @@ public class DebugScreenOverlay { } list.add(stringBuilder.toString()); - if (blockPos.getY() >= this.minecraft.level.getMinBuildHeight() && blockPos.getY() < this.minecraft.level.getMaxBuildHeight()) { + if (this.minecraft.level.isInsideBuildHeight(blockPos.getY())) { list.add("Biome: " + printBiome(this.minecraft.level.getBiome(blockPos))); if (levelChunk2 != null) { float h = level.getMoonBrightness(); @@ -419,9 +434,9 @@ public class DebugScreenOverlay { } } - PostChain postChain = this.minecraft.gameRenderer.currentEffect(); - if (postChain != null) { - list.add("Shader: " + postChain.getName()); + ResourceLocation resourceLocation = this.minecraft.gameRenderer.currentPostEffect(); + if (resourceLocation != null) { + list.add("Post: " + resourceLocation); } list.add( @@ -501,7 +516,7 @@ public class DebugScreenOverlay { if (this.minecraft.showOnlyReducedInfo()) { return list; } else { - if (this.block.getType() == HitResult.Type.BLOCK) { + if (this.block.getType() == Type.BLOCK) { BlockPos blockPos = ((BlockHitResult)this.block).getBlockPos(); BlockState blockState = this.minecraft.level.getBlockState(blockPos); list.add(""); @@ -515,7 +530,7 @@ public class DebugScreenOverlay { blockState.getTags().map(tagKey -> "#" + tagKey.location()).forEach(list::add); } - if (this.liquid.getType() == HitResult.Type.BLOCK) { + if (this.liquid.getType() == Type.BLOCK) { BlockPos blockPos = ((BlockHitResult)this.liquid).getBlockPos(); FluidState fluidState = this.minecraft.level.getFluidState(blockPos); list.add(""); @@ -616,6 +631,10 @@ public class DebugScreenOverlay { return this.bandwidthLogger; } + public ProfilerPieChart getProfilerPieChart() { + return this.profilerPieChart; + } + public void logRemoteSample(long[] sample, RemoteDebugSampleType sampleType) { LocalSampleLogger localSampleLogger = (LocalSampleLogger)this.remoteSupportingLoggers.get(sampleType); if (localSampleLogger != null) { diff --git a/net/minecraft/client/gui/components/EditBox.java b/net/minecraft/client/gui/components/EditBox.java index 922ad5ee..f984d4fd 100644 --- a/net/minecraft/client/gui/components/EditBox.java +++ b/net/minecraft/client/gui/components/EditBox.java @@ -25,7 +25,7 @@ import net.minecraft.util.StringUtil; import org.jetbrains.annotations.Nullable; @Environment(EnvType.CLIENT) -public class EditBox extends AbstractWidget implements Renderable { +public class EditBox extends AbstractWidget { private static final WidgetSprites SPRITES = new WidgetSprites( ResourceLocation.withDefaultNamespace("widget/text_field"), ResourceLocation.withDefaultNamespace("widget/text_field_highlighted") ); @@ -414,7 +414,7 @@ public class EditBox extends AbstractWidget implements Renderable { if (this.isVisible()) { if (this.isBordered()) { ResourceLocation resourceLocation = SPRITES.get(this.isActive(), this.isFocused()); - guiGraphics.blitSprite(resourceLocation, this.getX(), this.getY(), this.getWidth(), this.getHeight()); + guiGraphics.blitSprite(RenderType::guiTextured, resourceLocation, this.getX(), this.getY(), this.getWidth(), this.getHeight()); } int i = this.isEditable ? this.textColor : this.textColorUneditable; diff --git a/net/minecraft/client/gui/components/ImageButton.java b/net/minecraft/client/gui/components/ImageButton.java index 4a4bf8f1..8d0edd96 100644 --- a/net/minecraft/client/gui/components/ImageButton.java +++ b/net/minecraft/client/gui/components/ImageButton.java @@ -3,6 +3,7 @@ package net.minecraft.client.gui.components; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.renderer.RenderType; import net.minecraft.network.chat.CommonComponents; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; @@ -27,6 +28,6 @@ public class ImageButton extends Button { @Override public void renderWidget(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) { ResourceLocation resourceLocation = this.sprites.get(this.isActive(), this.isHoveredOrFocused()); - guiGraphics.blitSprite(resourceLocation, this.getX(), this.getY(), this.width, this.height); + guiGraphics.blitSprite(RenderType::guiTextured, resourceLocation, this.getX(), this.getY(), this.width, this.height); } } diff --git a/net/minecraft/client/gui/components/ImageWidget.java b/net/minecraft/client/gui/components/ImageWidget.java index 1051f679..1ebd7683 100644 --- a/net/minecraft/client/gui/components/ImageWidget.java +++ b/net/minecraft/client/gui/components/ImageWidget.java @@ -6,6 +6,7 @@ import net.minecraft.client.gui.ComponentPath; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.narration.NarrationElementOutput; import net.minecraft.client.gui.navigation.FocusNavigationEvent; +import net.minecraft.client.renderer.RenderType; import net.minecraft.client.sounds.SoundManager; import net.minecraft.network.chat.CommonComponents; import net.minecraft.resources.ResourceLocation; @@ -55,7 +56,7 @@ public abstract class ImageWidget extends AbstractWidget { @Override public void renderWidget(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) { - guiGraphics.blitSprite(this.sprite, this.getX(), this.getY(), this.getWidth(), this.getHeight()); + guiGraphics.blitSprite(RenderType::guiTextured, this.sprite, this.getX(), this.getY(), this.getWidth(), this.getHeight()); } } @@ -75,17 +76,7 @@ public abstract class ImageWidget extends AbstractWidget { @Override protected void renderWidget(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) { guiGraphics.blit( - this.texture, - this.getX(), - this.getY(), - this.getWidth(), - this.getHeight(), - 0.0F, - 0.0F, - this.getWidth(), - this.getHeight(), - this.textureWidth, - this.textureHeight + RenderType::guiTextured, this.texture, this.getX(), this.getY(), 0.0F, 0.0F, this.getWidth(), this.getHeight(), this.textureWidth, this.textureHeight ); } } diff --git a/net/minecraft/client/gui/components/LockIconButton.java b/net/minecraft/client/gui/components/LockIconButton.java index e4b22563..e1fab6ad 100644 --- a/net/minecraft/client/gui/components/LockIconButton.java +++ b/net/minecraft/client/gui/components/LockIconButton.java @@ -3,6 +3,7 @@ package net.minecraft.client.gui.components; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.renderer.RenderType; import net.minecraft.network.chat.CommonComponents; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.MutableComponent; @@ -43,7 +44,7 @@ public class LockIconButton extends Button { icon = this.locked ? LockIconButton.Icon.LOCKED : LockIconButton.Icon.UNLOCKED; } - guiGraphics.blitSprite(icon.sprite, this.getX(), this.getY(), this.width, this.height); + guiGraphics.blitSprite(RenderType::guiTextured, icon.sprite, this.getX(), this.getY(), this.width, this.height); } @Environment(EnvType.CLIENT) diff --git a/net/minecraft/client/gui/components/LogoRenderer.java b/net/minecraft/client/gui/components/LogoRenderer.java index 8ddf1316..e90b1a81 100644 --- a/net/minecraft/client/gui/components/LogoRenderer.java +++ b/net/minecraft/client/gui/components/LogoRenderer.java @@ -1,10 +1,11 @@ package net.minecraft.client.gui.components; -import com.mojang.blaze3d.systems.RenderSystem; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.renderer.RenderType; import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.ARGB; import net.minecraft.util.RandomSource; @Environment(EnvType.CLIENT) @@ -34,14 +35,12 @@ public class LogoRenderer { } public void renderLogo(GuiGraphics guiGraphics, int screenWidth, float transparency, int height) { - guiGraphics.setColor(1.0F, 1.0F, 1.0F, this.keepLogoThroughFade ? 1.0F : transparency); - RenderSystem.enableBlend(); int i = screenWidth / 2 - 128; - guiGraphics.blit(this.showEasterEgg ? EASTER_EGG_LOGO : MINECRAFT_LOGO, i, height, 0.0F, 0.0F, 256, 44, 256, 64); - int j = screenWidth / 2 - 64; - int k = height + 44 - 7; - guiGraphics.blit(MINECRAFT_EDITION, j, k, 0.0F, 0.0F, 128, 14, 128, 16); - guiGraphics.setColor(1.0F, 1.0F, 1.0F, 1.0F); - RenderSystem.disableBlend(); + float f = this.keepLogoThroughFade ? 1.0F : transparency; + int j = ARGB.white(f); + guiGraphics.blit(RenderType::guiTextured, this.showEasterEgg ? EASTER_EGG_LOGO : MINECRAFT_LOGO, i, height, 0.0F, 0.0F, 256, 44, 256, 64, j); + int k = screenWidth / 2 - 64; + int l = height + 44 - 7; + guiGraphics.blit(RenderType::guiTextured, MINECRAFT_EDITION, k, l, 0.0F, 0.0F, 128, 14, 128, 16, j); } } diff --git a/net/minecraft/client/gui/components/MultiLineEditBox.java b/net/minecraft/client/gui/components/MultiLineEditBox.java index 8fb8151c..00a574a7 100644 --- a/net/minecraft/client/gui/components/MultiLineEditBox.java +++ b/net/minecraft/client/gui/components/MultiLineEditBox.java @@ -6,6 +6,7 @@ import net.fabricmc.api.Environment; import net.minecraft.Util; import net.minecraft.client.gui.Font; import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.components.MultilineTextField.StringView; import net.minecraft.client.gui.narration.NarratedElementType; import net.minecraft.client.gui.narration.NarrationElementOutput; import net.minecraft.client.gui.screens.Screen; @@ -110,7 +111,7 @@ public class MultiLineEditBox extends AbstractScrollWidget { int k = 0; int l = this.getY() + this.innerPadding(); - for (MultilineTextField.StringView stringView : this.textField.iterateLines()) { + for (StringView stringView : this.textField.iterateLines()) { boolean bl3 = this.withinContentAreaTopBottom(l, l + 9); if (bl && bl2 && i >= stringView.beginIndex() && i <= stringView.endIndex()) { if (bl3) { @@ -135,11 +136,11 @@ public class MultiLineEditBox extends AbstractScrollWidget { } if (this.textField.hasSelection()) { - MultilineTextField.StringView stringView2 = this.textField.getSelected(); + StringView stringView2 = this.textField.getSelected(); int m = this.getX() + this.innerPadding(); l = this.getY() + this.innerPadding(); - for (MultilineTextField.StringView stringView3 : this.textField.iterateLines()) { + for (StringView stringView3 : this.textField.iterateLines()) { if (stringView2.beginIndex() > stringView3.endIndex()) { l += 9; } else { @@ -197,11 +198,11 @@ public class MultiLineEditBox extends AbstractScrollWidget { private void scrollToCursor() { double d = this.scrollAmount(); - MultilineTextField.StringView stringView = this.textField.getLineView((int)(d / 9.0)); + StringView stringView = this.textField.getLineView((int)(d / 9.0)); if (this.textField.cursor() <= stringView.beginIndex()) { d = this.textField.getLineAtCursor() * 9; } else { - MultilineTextField.StringView stringView2 = this.textField.getLineView((int)((d + this.height) / 9.0) - 1); + StringView stringView2 = this.textField.getLineView((int)((d + this.height) / 9.0) - 1); if (this.textField.cursor() > stringView2.endIndex()) { d = this.textField.getLineAtCursor() * 9 - this.height + 9 + this.totalInnerPadding(); } diff --git a/net/minecraft/client/gui/components/ObjectSelectionList.java b/net/minecraft/client/gui/components/ObjectSelectionList.java index 96388d09..242b058c 100644 --- a/net/minecraft/client/gui/components/ObjectSelectionList.java +++ b/net/minecraft/client/gui/components/ObjectSelectionList.java @@ -8,6 +8,7 @@ import net.minecraft.client.gui.narration.NarratedElementType; import net.minecraft.client.gui.narration.NarrationElementOutput; import net.minecraft.client.gui.narration.NarrationSupplier; import net.minecraft.client.gui.navigation.FocusNavigationEvent; +import net.minecraft.client.gui.navigation.FocusNavigationEvent.ArrowNavigation; import net.minecraft.network.chat.Component; import org.jetbrains.annotations.Nullable; @@ -24,7 +25,7 @@ public abstract class ObjectSelectionList public ComponentPath nextFocusPath(FocusNavigationEvent event) { if (this.getItemCount() == 0) { return null; - } else if (this.isFocused() && event instanceof FocusNavigationEvent.ArrowNavigation arrowNavigation) { + } else if (this.isFocused() && event instanceof ArrowNavigation arrowNavigation) { E entry = this.nextEntry(arrowNavigation.direction()); return entry != null ? ComponentPath.path(this, ComponentPath.leaf(entry)) : null; } else if (!this.isFocused()) { diff --git a/net/minecraft/client/gui/components/PlayerFaceRenderer.java b/net/minecraft/client/gui/components/PlayerFaceRenderer.java index 181dc593..b034fc3c 100644 --- a/net/minecraft/client/gui/components/PlayerFaceRenderer.java +++ b/net/minecraft/client/gui/components/PlayerFaceRenderer.java @@ -1,9 +1,9 @@ package net.minecraft.client.gui.components; -import com.mojang.blaze3d.systems.RenderSystem; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.renderer.RenderType; import net.minecraft.client.resources.PlayerSkin; import net.minecraft.resources.ResourceLocation; @@ -21,27 +21,25 @@ public class PlayerFaceRenderer { public static final int SKIN_TEX_HEIGHT = 64; public static void draw(GuiGraphics guiGraphics, PlayerSkin skin, int x, int y, int size) { - draw(guiGraphics, skin.texture(), x, y, size); + draw(guiGraphics, skin, x, y, size, -1); } - public static void draw(GuiGraphics guiGraphics, ResourceLocation atlasLocation, int x, int y, int size) { - draw(guiGraphics, atlasLocation, x, y, size, true, false); + public static void draw(GuiGraphics guiGraphics, PlayerSkin playerSkin, int i, int j, int k, int l) { + draw(guiGraphics, playerSkin.texture(), i, j, k, true, false, l); } - public static void draw(GuiGraphics guiGraphics, ResourceLocation atlasLocation, int x, int y, int size, boolean drawHat, boolean upsideDown) { - int i = 8 + (upsideDown ? 8 : 0); - int j = 8 * (upsideDown ? -1 : 1); - guiGraphics.blit(atlasLocation, x, y, size, size, 8.0F, i, 8, j, 64, 64); - if (drawHat) { - drawHat(guiGraphics, atlasLocation, x, y, size, upsideDown); + public static void draw(GuiGraphics guiGraphics, ResourceLocation resourceLocation, int i, int j, int k, boolean bl, boolean bl2, int l) { + int m = 8 + (bl2 ? 8 : 0); + int n = 8 * (bl2 ? -1 : 1); + guiGraphics.blit(RenderType::guiTextured, resourceLocation, i, j, 8.0F, m, k, k, 8, n, 64, 64, l); + if (bl) { + drawHat(guiGraphics, resourceLocation, i, j, k, bl2, l); } } - private static void drawHat(GuiGraphics guiGraphics, ResourceLocation atlasLocation, int x, int y, int size, boolean upsideDown) { - int i = 8 + (upsideDown ? 8 : 0); - int j = 8 * (upsideDown ? -1 : 1); - RenderSystem.enableBlend(); - guiGraphics.blit(atlasLocation, x, y, size, size, 40.0F, i, 8, j, 64, 64); - RenderSystem.disableBlend(); + private static void drawHat(GuiGraphics guiGraphics, ResourceLocation resourceLocation, int i, int j, int k, boolean bl, int l) { + int m = 8 + (bl ? 8 : 0); + int n = 8 * (bl ? -1 : 1); + guiGraphics.blit(RenderType::guiTextured, resourceLocation, i, j, 40.0F, m, k, k, 8, n, 64, 64, l); } } diff --git a/net/minecraft/client/gui/components/PlayerSkinWidget.java b/net/minecraft/client/gui/components/PlayerSkinWidget.java index f7624d8d..1fd4cc3e 100644 --- a/net/minecraft/client/gui/components/PlayerSkinWidget.java +++ b/net/minecraft/client/gui/components/PlayerSkinWidget.java @@ -83,22 +83,22 @@ public class PlayerSkinWidget extends AbstractWidget { } @Environment(EnvType.CLIENT) - record Model(PlayerModel wideModel, PlayerModel slimModel) { + record Model(PlayerModel wideModel, PlayerModel slimModel) { public static PlayerSkinWidget.Model bake(EntityModelSet model) { - PlayerModel playerModel = new PlayerModel(model.bakeLayer(ModelLayers.PLAYER), false); - PlayerModel playerModel2 = new PlayerModel(model.bakeLayer(ModelLayers.PLAYER_SLIM), true); - playerModel.young = false; - playerModel2.young = false; + PlayerModel playerModel = new PlayerModel(model.bakeLayer(ModelLayers.PLAYER), false); + PlayerModel playerModel2 = new PlayerModel(model.bakeLayer(ModelLayers.PLAYER_SLIM), true); return new PlayerSkinWidget.Model(playerModel, playerModel2); } public void render(GuiGraphics guiGraphics, PlayerSkin skin) { guiGraphics.pose().pushPose(); guiGraphics.pose().scale(1.0F, 1.0F, -1.0F); - guiGraphics.pose().translate(0.0F, -1.5F, 0.0F); - PlayerModel playerModel = skin.model() == PlayerSkin.Model.SLIM ? this.slimModel : this.wideModel; + guiGraphics.pose().translate(0.0F, -1.501F, 0.0F); + PlayerModel playerModel = skin.model() == PlayerSkin.Model.SLIM ? this.slimModel : this.wideModel; RenderType renderType = playerModel.renderType(skin.texture()); - playerModel.renderToBuffer(guiGraphics.pose(), guiGraphics.bufferSource().getBuffer(renderType), 15728880, OverlayTexture.NO_OVERLAY); + guiGraphics.drawSpecial( + multiBufferSource -> playerModel.renderToBuffer(guiGraphics.pose(), multiBufferSource.getBuffer(renderType), 15728880, OverlayTexture.NO_OVERLAY) + ); guiGraphics.pose().popPose(); } } diff --git a/net/minecraft/client/gui/components/PlayerTabOverlay.java b/net/minecraft/client/gui/components/PlayerTabOverlay.java index b9b85d69..2aa65532 100644 --- a/net/minecraft/client/gui/components/PlayerTabOverlay.java +++ b/net/minecraft/client/gui/components/PlayerTabOverlay.java @@ -1,7 +1,6 @@ package net.minecraft.client.gui.components; import com.mojang.authlib.GameProfile; -import com.mojang.blaze3d.systems.RenderSystem; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import java.util.ArrayList; import java.util.Comparator; @@ -18,6 +17,7 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.multiplayer.PlayerInfo; +import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.entity.LivingEntityRenderer; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.ComponentUtils; @@ -54,7 +54,8 @@ public class PlayerTabOverlay { private static final ResourceLocation HEART_FULL_SPRITE = ResourceLocation.withDefaultNamespace("hud/heart/full"); private static final ResourceLocation HEART_ABSORBING_HALF_BLINKING_SPRITE = ResourceLocation.withDefaultNamespace("hud/heart/absorbing_half_blinking"); private static final ResourceLocation HEART_HALF_SPRITE = ResourceLocation.withDefaultNamespace("hud/heart/half"); - private static final Comparator PLAYER_COMPARATOR = Comparator.comparingInt(playerInfo -> playerInfo.getGameMode() == GameType.SPECTATOR ? 1 : 0) + private static final Comparator PLAYER_COMPARATOR = Comparator.comparingInt(playerInfo -> -playerInfo.getTabListOrder()) + .thenComparingInt(playerInfo -> playerInfo.getGameMode() == GameType.SPECTATOR ? 1 : 0) .thenComparing(playerInfo -> Optionull.mapOrDefault(playerInfo.getTeam(), PlayerTeam::getName, "")) .thenComparing(playerInfo -> playerInfo.getProfile().getName(), String::compareToIgnoreCase); public static final int MAX_ROWS_PER_COL = 20; @@ -202,7 +203,6 @@ public class PlayerTabOverlay { int y = r + u * m + u * 5; int z = s + x * 9; guiGraphics.fill(y, z, y + m, z + 8, v); - RenderSystem.enableBlend(); if (w < list.size()) { PlayerInfo playerInfo2 = (PlayerInfo)list.get(w); PlayerTabOverlay.ScoreDisplayEntry scoreDisplayEntry = (PlayerTabOverlay.ScoreDisplayEntry)list2.get(w); @@ -211,7 +211,7 @@ public class PlayerTabOverlay { Player player = this.minecraft.level.getPlayerByUUID(gameProfile.getId()); boolean bl2 = player != null && LivingEntityRenderer.isEntityUpsideDown(player); boolean bl3 = player != null && player.isModelPartShown(PlayerModelPart.HAT); - PlayerFaceRenderer.draw(guiGraphics, playerInfo2.getSkin().texture(), y, z, 8, bl3, bl2); + PlayerFaceRenderer.draw(guiGraphics, playerInfo2.getSkin().texture(), y, z, 8, bl3, bl2, -1); y += 9; } @@ -258,7 +258,7 @@ public class PlayerTabOverlay { guiGraphics.pose().pushPose(); guiGraphics.pose().translate(0.0F, 0.0F, 100.0F); - guiGraphics.blitSprite(resourceLocation, x + width - 11, y, 10, 8); + guiGraphics.blitSprite(RenderType::guiTextured, resourceLocation, x + width - 11, y, 10, 8); guiGraphics.pose().popPose(); } @@ -298,27 +298,27 @@ public class PlayerTabOverlay { ResourceLocation resourceLocation = bl ? HEART_CONTAINER_BLINKING_SPRITE : HEART_CONTAINER_SPRITE; for (int l = i; l < j; l++) { - guiGraphics.blitSprite(resourceLocation, minX + l * k, y, 9, 9); + guiGraphics.blitSprite(RenderType::guiTextured, resourceLocation, minX + l * k, y, 9, 9); } for (int l = 0; l < i; l++) { - guiGraphics.blitSprite(resourceLocation, minX + l * k, y, 9, 9); + guiGraphics.blitSprite(RenderType::guiTextured, resourceLocation, minX + l * k, y, 9, 9); if (bl) { if (l * 2 + 1 < healthState.displayedValue()) { - guiGraphics.blitSprite(HEART_FULL_BLINKING_SPRITE, minX + l * k, y, 9, 9); + guiGraphics.blitSprite(RenderType::guiTextured, HEART_FULL_BLINKING_SPRITE, minX + l * k, y, 9, 9); } if (l * 2 + 1 == healthState.displayedValue()) { - guiGraphics.blitSprite(HEART_HALF_BLINKING_SPRITE, minX + l * k, y, 9, 9); + guiGraphics.blitSprite(RenderType::guiTextured, HEART_HALF_BLINKING_SPRITE, minX + l * k, y, 9, 9); } } if (l * 2 + 1 < health) { - guiGraphics.blitSprite(l >= 10 ? HEART_ABSORBING_FULL_BLINKING_SPRITE : HEART_FULL_SPRITE, minX + l * k, y, 9, 9); + guiGraphics.blitSprite(RenderType::guiTextured, l >= 10 ? HEART_ABSORBING_FULL_BLINKING_SPRITE : HEART_FULL_SPRITE, minX + l * k, y, 9, 9); } if (l * 2 + 1 == health) { - guiGraphics.blitSprite(l >= 10 ? HEART_ABSORBING_HALF_BLINKING_SPRITE : HEART_HALF_SPRITE, minX + l * k, y, 9, 9); + guiGraphics.blitSprite(RenderType::guiTextured, l >= 10 ? HEART_ABSORBING_HALF_BLINKING_SPRITE : HEART_HALF_SPRITE, minX + l * k, y, 9, 9); } } } diff --git a/net/minecraft/client/gui/components/PopupScreen.java b/net/minecraft/client/gui/components/PopupScreen.java index 071862a3..170a3449 100644 --- a/net/minecraft/client/gui/components/PopupScreen.java +++ b/net/minecraft/client/gui/components/PopupScreen.java @@ -7,11 +7,11 @@ import java.util.function.Consumer; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.ChatFormatting; -import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.layouts.FrameLayout; import net.minecraft.client.gui.layouts.LinearLayout; import net.minecraft.client.gui.screens.Screen; +import net.minecraft.client.renderer.RenderType; import net.minecraft.network.chat.CommonComponents; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; @@ -101,9 +101,11 @@ public class PopupScreen extends Screen { public void renderBackground(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) { this.backgroundScreen.render(guiGraphics, -1, -1, partialTick); guiGraphics.flush(); - RenderSystem.clear(256, Minecraft.ON_OSX); + RenderSystem.clear(256); this.renderTransparentBackground(guiGraphics); - guiGraphics.blitSprite(BACKGROUND_SPRITE, this.layout.getX() - 18, this.layout.getY() - 18, this.layout.getWidth() + 36, this.layout.getHeight() + 36); + guiGraphics.blitSprite( + RenderType::guiTextured, BACKGROUND_SPRITE, this.layout.getX() - 18, this.layout.getY() - 18, this.layout.getWidth() + 36, this.layout.getHeight() + 36 + ); } @Override diff --git a/net/minecraft/client/gui/components/SpriteIconButton.java b/net/minecraft/client/gui/components/SpriteIconButton.java index eb33af6f..fb2ffad7 100644 --- a/net/minecraft/client/gui/components/SpriteIconButton.java +++ b/net/minecraft/client/gui/components/SpriteIconButton.java @@ -4,6 +4,7 @@ import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.gui.Font; import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.renderer.RenderType; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; import org.jetbrains.annotations.Nullable; @@ -101,7 +102,7 @@ public abstract class SpriteIconButton extends Button { super.renderWidget(guiGraphics, mouseX, mouseY, partialTick); int i = this.getX() + this.getWidth() / 2 - this.spriteWidth / 2; int j = this.getY() + this.getHeight() / 2 - this.spriteHeight / 2; - guiGraphics.blitSprite(this.sprite, i, j, this.spriteWidth, this.spriteHeight); + guiGraphics.blitSprite(RenderType::guiTextured, this.sprite, i, j, this.spriteWidth, this.spriteHeight); } @Override @@ -122,7 +123,7 @@ public abstract class SpriteIconButton extends Button { super.renderWidget(guiGraphics, mouseX, mouseY, partialTick); int i = this.getX() + this.getWidth() - this.spriteWidth - 2; int j = this.getY() + this.getHeight() / 2 - this.spriteHeight / 2; - guiGraphics.blitSprite(this.sprite, i, j, this.spriteWidth, this.spriteHeight); + guiGraphics.blitSprite(RenderType::guiTextured, this.sprite, i, j, this.spriteWidth, this.spriteHeight); } @Override diff --git a/net/minecraft/client/gui/components/StateSwitchingButton.java b/net/minecraft/client/gui/components/StateSwitchingButton.java index 24dc4150..409c9623 100644 --- a/net/minecraft/client/gui/components/StateSwitchingButton.java +++ b/net/minecraft/client/gui/components/StateSwitchingButton.java @@ -1,10 +1,10 @@ package net.minecraft.client.gui.components; -import com.mojang.blaze3d.systems.RenderSystem; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.narration.NarrationElementOutput; +import net.minecraft.client.renderer.RenderType; import net.minecraft.network.chat.CommonComponents; import org.jetbrains.annotations.Nullable; @@ -39,9 +39,9 @@ public class StateSwitchingButton extends AbstractWidget { @Override public void renderWidget(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) { if (this.sprites != null) { - RenderSystem.disableDepthTest(); - guiGraphics.blitSprite(this.sprites.get(this.isStateTriggered, this.isHoveredOrFocused()), this.getX(), this.getY(), this.width, this.height); - RenderSystem.enableDepthTest(); + guiGraphics.blitSprite( + RenderType::guiTextured, this.sprites.get(this.isStateTriggered, this.isHoveredOrFocused()), this.getX(), this.getY(), this.width, this.height + ); } } } diff --git a/net/minecraft/client/gui/components/SubtitleOverlay.java b/net/minecraft/client/gui/components/SubtitleOverlay.java index c22d7c11..bbe63613 100644 --- a/net/minecraft/client/gui/components/SubtitleOverlay.java +++ b/net/minecraft/client/gui/components/SubtitleOverlay.java @@ -16,6 +16,7 @@ import net.minecraft.client.sounds.SoundEventListener; import net.minecraft.client.sounds.SoundManager; import net.minecraft.client.sounds.WeighedSoundEvents; import net.minecraft.network.chat.Component; +import net.minecraft.util.ARGB; import net.minecraft.util.Mth; import net.minecraft.world.phys.Vec3; import org.jetbrains.annotations.Nullable; @@ -88,21 +89,20 @@ public class SubtitleOverlay implements SoundEventListener { float g = 1.0F; int o = this.minecraft.font.width(component); int p = Mth.floor(Mth.clampedLerp(255.0F, 75.0F, (float)(Util.getMillis() - soundPlayedAt.time) / (float)(3000.0 * d))); - int q = p << 16 | p << 8 | p; guiGraphics.pose().pushPose(); guiGraphics.pose().translate(guiGraphics.guiWidth() - l * 1.0F - 2.0F, guiGraphics.guiHeight() - 35 - i * (m + 1) * 1.0F, 0.0F); guiGraphics.pose().scale(1.0F, 1.0F, 1.0F); guiGraphics.fill(-l - 1, -n - 1, l + 1, n + 1, this.minecraft.options.getBackgroundColor(0.8F)); - int r = q + -16777216; + int q = ARGB.color(255, p, p, p); if (!bl) { if (e > 0.0) { - guiGraphics.drawString(this.minecraft.font, ">", l - this.minecraft.font.width(">"), -n, r); + guiGraphics.drawString(this.minecraft.font, ">", l - this.minecraft.font.width(">"), -n, q); } else if (e < 0.0) { - guiGraphics.drawString(this.minecraft.font, "<", -l, -n, r); + guiGraphics.drawString(this.minecraft.font, "<", -l, -n, q); } } - guiGraphics.drawString(this.minecraft.font, component, -o / 2, -n, r); + guiGraphics.drawString(this.minecraft.font, component, -o / 2, -n, q); guiGraphics.pose().popPose(); i++; } diff --git a/net/minecraft/client/gui/components/TabButton.java b/net/minecraft/client/gui/components/TabButton.java index 644f89b4..bfa26676 100644 --- a/net/minecraft/client/gui/components/TabButton.java +++ b/net/minecraft/client/gui/components/TabButton.java @@ -1,6 +1,5 @@ package net.minecraft.client.gui.components; -import com.mojang.blaze3d.systems.RenderSystem; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.Minecraft; @@ -11,6 +10,7 @@ import net.minecraft.client.gui.components.tabs.TabManager; import net.minecraft.client.gui.narration.NarratedElementType; import net.minecraft.client.gui.narration.NarrationElementOutput; import net.minecraft.client.gui.screens.Screen; +import net.minecraft.client.renderer.RenderType; import net.minecraft.client.sounds.SoundManager; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; @@ -39,9 +39,7 @@ public class TabButton extends AbstractWidget { @Override public void renderWidget(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) { - RenderSystem.enableBlend(); - guiGraphics.blitSprite(SPRITES.get(this.isSelected(), this.isHoveredOrFocused()), this.getX(), this.getY(), this.width, this.height); - RenderSystem.disableBlend(); + guiGraphics.blitSprite(RenderType::guiTextured, SPRITES.get(this.isSelected(), this.isHoveredOrFocused()), this.getX(), this.getY(), this.width, this.height); Font font = Minecraft.getInstance().font; int i = this.active ? -1 : -6250336; this.renderString(guiGraphics, font, i); diff --git a/net/minecraft/client/gui/components/debugchart/AbstractDebugChart.java b/net/minecraft/client/gui/components/debugchart/AbstractDebugChart.java index c0ee2d2f..964d4be0 100644 --- a/net/minecraft/client/gui/components/debugchart/AbstractDebugChart.java +++ b/net/minecraft/client/gui/components/debugchart/AbstractDebugChart.java @@ -5,7 +5,7 @@ import net.fabricmc.api.Environment; import net.minecraft.client.gui.Font; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.renderer.RenderType; -import net.minecraft.util.FastColor; +import net.minecraft.util.ARGB; import net.minecraft.util.Mth; import net.minecraft.util.debugchart.SampleStorage; @@ -26,6 +26,10 @@ public abstract class AbstractDebugChart { return Math.min(this.sampleStorage.capacity() + 2, maxWidth); } + public int getFullHeight() { + return 60 + 9; + } + public void drawChart(GuiGraphics guiGraphics, int x, int width) { int i = guiGraphics.guiHeight(); guiGraphics.fill(RenderType.guiOverlay(), x, i - 60, x + width, i, -1873784752); @@ -97,7 +101,7 @@ public abstract class AbstractDebugChart { protected int getSampleColor(double value, double minPosition, int minColor, double midPosition, int midColor, double maxPosition, int guiGraphics) { value = Mth.clamp(value, minPosition, maxPosition); return value < midPosition - ? FastColor.ARGB32.lerp((float)((value - minPosition) / (midPosition - minPosition)), minColor, midColor) - : FastColor.ARGB32.lerp((float)((value - midPosition) / (maxPosition - midPosition)), midColor, guiGraphics); + ? ARGB.lerp((float)((value - minPosition) / (midPosition - minPosition)), minColor, midColor) + : ARGB.lerp((float)((value - midPosition) / (maxPosition - midPosition)), midColor, guiGraphics); } } diff --git a/net/minecraft/client/gui/components/debugchart/FpsDebugChart.java b/net/minecraft/client/gui/components/debugchart/FpsDebugChart.java index 663ac69b..124bc496 100644 --- a/net/minecraft/client/gui/components/debugchart/FpsDebugChart.java +++ b/net/minecraft/client/gui/components/debugchart/FpsDebugChart.java @@ -11,9 +11,6 @@ import net.minecraft.util.debugchart.SampleStorage; @Environment(EnvType.CLIENT) public class FpsDebugChart extends AbstractDebugChart { - private static final int RED = -65536; - private static final int YELLOW = -256; - private static final int GREEN = -16711936; private static final int CHART_TOP_FPS = 30; private static final double CHART_TOP_VALUE = 33.333333333333336; diff --git a/net/minecraft/client/gui/components/debugchart/PingDebugChart.java b/net/minecraft/client/gui/components/debugchart/PingDebugChart.java index 34092f62..c7e459ea 100644 --- a/net/minecraft/client/gui/components/debugchart/PingDebugChart.java +++ b/net/minecraft/client/gui/components/debugchart/PingDebugChart.java @@ -9,9 +9,6 @@ import net.minecraft.util.debugchart.SampleStorage; @Environment(EnvType.CLIENT) public class PingDebugChart extends AbstractDebugChart { - private static final int RED = -65536; - private static final int YELLOW = -256; - private static final int GREEN = -16711936; private static final int CHART_TOP_VALUE = 500; public PingDebugChart(Font font, SampleStorage sampleStorage) { diff --git a/net/minecraft/client/gui/components/debugchart/ProfilerPieChart.java b/net/minecraft/client/gui/components/debugchart/ProfilerPieChart.java new file mode 100644 index 00000000..10a487dc --- /dev/null +++ b/net/minecraft/client/gui/components/debugchart/ProfilerPieChart.java @@ -0,0 +1,159 @@ +package net.minecraft.client.gui.components.debugchart; + +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; +import java.text.DecimalFormat; +import java.text.DecimalFormatSymbols; +import java.util.List; +import java.util.Locale; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.client.gui.Font; +import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.util.ARGB; +import net.minecraft.util.Mth; +import net.minecraft.util.profiling.ProfileResults; +import net.minecraft.util.profiling.ResultField; +import org.jetbrains.annotations.Nullable; + +@Environment(EnvType.CLIENT) +public class ProfilerPieChart { + private static final int RADIUS = 105; + private static final int MARGIN = 5; + private static final int CHART_Z_OFFSET = 10; + private final Font font; + @Nullable + private ProfileResults profilerPieChartResults; + private String profilerTreePath = "root"; + private int bottomOffset = 0; + + public ProfilerPieChart(Font font) { + this.font = font; + } + + public void setPieChartResults(@Nullable ProfileResults profileResults) { + this.profilerPieChartResults = profileResults; + } + + public void setBottomOffset(int i) { + this.bottomOffset = i; + } + + public void render(GuiGraphics guiGraphics) { + if (this.profilerPieChartResults != null) { + List list = this.profilerPieChartResults.getTimes(this.profilerTreePath); + ResultField resultField = (ResultField)list.removeFirst(); + int i = guiGraphics.guiWidth() - 105 - 10; + int j = i - 105; + int k = i + 105; + int l = list.size() * 9; + int m = guiGraphics.guiHeight() - this.bottomOffset - 5; + int n = m - l; + int o = 62; + int p = n - 62 - 5; + guiGraphics.fill(j - 5, p - 62 - 5, k + 5, m + 5, -1873784752); + guiGraphics.drawSpecial(multiBufferSource -> { + double d = 0.0; + + for (ResultField resultFieldx : list) { + int kx = Mth.floor(resultFieldx.percentage / 4.0) + 1; + VertexConsumer vertexConsumer = multiBufferSource.getBuffer(RenderType.debugTriangleFan()); + int lx = ARGB.opaque(resultFieldx.getColor()); + int mx = ARGB.multiply(lx, -8355712); + PoseStack.Pose pose = guiGraphics.pose().last(); + vertexConsumer.addVertex(pose, (float)i, (float)p, 10.0F).setColor(lx); + + for (int nxx = kx; nxx >= 0; nxx--) { + float f = (float)((d + resultFieldx.percentage * nxx / kx) * (float) (Math.PI * 2) / 100.0); + float g = Mth.sin(f) * 105.0F; + float h = Mth.cos(f) * 105.0F * 0.5F; + vertexConsumer.addVertex(pose, i + g, p - h, 10.0F).setColor(lx); + } + + vertexConsumer = multiBufferSource.getBuffer(RenderType.debugQuads()); + + for (int nx = kx; nx > 0; nx--) { + float f = (float)((d + resultFieldx.percentage * nx / kx) * (float) (Math.PI * 2) / 100.0); + float g = Mth.sin(f) * 105.0F; + float h = Mth.cos(f) * 105.0F * 0.5F; + float ox = (float)((d + resultFieldx.percentage * (nx - 1) / kx) * (float) (Math.PI * 2) / 100.0); + float px = Mth.sin(ox) * 105.0F; + float qx = Mth.cos(ox) * 105.0F * 0.5F; + if (!((h + qx) / 2.0F > 0.0F)) { + vertexConsumer.addVertex(pose, i + g, p - h, 10.0F).setColor(mx); + vertexConsumer.addVertex(pose, i + g, p - h + 10.0F, 10.0F).setColor(mx); + vertexConsumer.addVertex(pose, i + px, p - qx + 10.0F, 10.0F).setColor(mx); + vertexConsumer.addVertex(pose, i + px, p - qx, 10.0F).setColor(mx); + } + } + + d += resultFieldx.percentage; + } + }); + DecimalFormat decimalFormat = new DecimalFormat("##0.00"); + decimalFormat.setDecimalFormatSymbols(DecimalFormatSymbols.getInstance(Locale.ROOT)); + String string = ProfileResults.demanglePath(resultField.name); + String string2 = ""; + if (!"unspecified".equals(string)) { + string2 = string2 + "[0] "; + } + + if (string.isEmpty()) { + string2 = string2 + "ROOT "; + } else { + string2 = string2 + string + " "; + } + + int q = 16777215; + int r = p - 62; + guiGraphics.drawString(this.font, string2, j, r, 16777215); + string2 = decimalFormat.format(resultField.globalPercentage) + "%"; + guiGraphics.drawString(this.font, string2, k - this.font.width(string2), r, 16777215); + + for (int s = 0; s < list.size(); s++) { + ResultField resultField2 = (ResultField)list.get(s); + StringBuilder stringBuilder = new StringBuilder(); + if ("unspecified".equals(resultField2.name)) { + stringBuilder.append("[?] "); + } else { + stringBuilder.append("[").append(s + 1).append("] "); + } + + String string3 = stringBuilder.append(resultField2.name).toString(); + int t = n + s * 9; + guiGraphics.drawString(this.font, string3, j, t, resultField2.getColor()); + string3 = decimalFormat.format(resultField2.percentage) + "%"; + guiGraphics.drawString(this.font, string3, k - 50 - this.font.width(string3), t, resultField2.getColor()); + string3 = decimalFormat.format(resultField2.globalPercentage) + "%"; + guiGraphics.drawString(this.font, string3, k - this.font.width(string3), t, resultField2.getColor()); + } + } + } + + public void profilerPieChartKeyPress(int i) { + if (this.profilerPieChartResults != null) { + List list = this.profilerPieChartResults.getTimes(this.profilerTreePath); + if (!list.isEmpty()) { + ResultField resultField = (ResultField)list.remove(0); + if (i == 0) { + if (!resultField.name.isEmpty()) { + int j = this.profilerTreePath.lastIndexOf(30); + if (j >= 0) { + this.profilerTreePath = this.profilerTreePath.substring(0, j); + } + } + } else { + i--; + if (i < list.size() && !"unspecified".equals(((ResultField)list.get(i)).name)) { + if (!this.profilerTreePath.isEmpty()) { + this.profilerTreePath = this.profilerTreePath + "\u001e"; + } + + this.profilerTreePath = this.profilerTreePath + ((ResultField)list.get(i)).name; + } + } + } + } + } +} diff --git a/net/minecraft/client/gui/components/debugchart/TpsDebugChart.java b/net/minecraft/client/gui/components/debugchart/TpsDebugChart.java index f9e47e26..4d9297d0 100644 --- a/net/minecraft/client/gui/components/debugchart/TpsDebugChart.java +++ b/net/minecraft/client/gui/components/debugchart/TpsDebugChart.java @@ -13,9 +13,6 @@ import net.minecraft.util.debugchart.TpsDebugDimensions; @Environment(EnvType.CLIENT) public class TpsDebugChart extends AbstractDebugChart { - private static final int RED = -65536; - private static final int YELLOW = -256; - private static final int GREEN = -16711936; private static final int TICK_METHOD_COLOR = -6745839; private static final int TASK_COLOR = -4548257; private static final int OTHER_COLOR = -10547572; @@ -29,7 +26,7 @@ public class TpsDebugChart extends AbstractDebugChart { @Override protected void renderAdditionalLinesAndLabels(GuiGraphics guiGraphics, int x, int width, int height) { float f = (float)TimeUtil.MILLISECONDS_PER_SECOND / (Float)this.msptSupplier.get(); - this.drawStringWithShade(guiGraphics, String.format("%.1f TPS", f), x + 1, height - 60 + 1); + this.drawStringWithShade(guiGraphics, String.format(Locale.ROOT, "%.1f TPS", f), x + 1, height - 60 + 1); } @Override diff --git a/net/minecraft/client/gui/components/spectator/SpectatorGui.java b/net/minecraft/client/gui/components/spectator/SpectatorGui.java index 878a6b41..a59cfb62 100644 --- a/net/minecraft/client/gui/components/spectator/SpectatorGui.java +++ b/net/minecraft/client/gui/components/spectator/SpectatorGui.java @@ -1,6 +1,5 @@ package net.minecraft.client.gui.components.spectator; -import com.mojang.blaze3d.systems.RenderSystem; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.Util; @@ -10,9 +9,10 @@ import net.minecraft.client.gui.spectator.SpectatorMenu; import net.minecraft.client.gui.spectator.SpectatorMenuItem; import net.minecraft.client.gui.spectator.SpectatorMenuListener; import net.minecraft.client.gui.spectator.categories.SpectatorPage; +import net.minecraft.client.renderer.RenderType; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; -import net.minecraft.util.FastColor; +import net.minecraft.util.ARGB; import net.minecraft.util.Mth; import org.jetbrains.annotations.Nullable; @@ -63,32 +63,25 @@ public class SpectatorGui implements SpectatorMenuListener { } protected void renderPage(GuiGraphics guiGraphics, float alpha, int x, int y, SpectatorPage spectatorPage) { - RenderSystem.enableBlend(); - guiGraphics.setColor(1.0F, 1.0F, 1.0F, alpha); - guiGraphics.blitSprite(HOTBAR_SPRITE, x - 91, y, 182, 22); + int i = ARGB.white(alpha); + guiGraphics.blitSprite(RenderType::guiTextured, HOTBAR_SPRITE, x - 91, y, 182, 22, i); if (spectatorPage.getSelectedSlot() >= 0) { - guiGraphics.blitSprite(HOTBAR_SELECTION_SPRITE, x - 91 - 1 + spectatorPage.getSelectedSlot() * 20, y - 1, 24, 23); + guiGraphics.blitSprite(RenderType::guiTextured, HOTBAR_SELECTION_SPRITE, x - 91 - 1 + spectatorPage.getSelectedSlot() * 20, y - 1, 24, 23, i); } - guiGraphics.setColor(1.0F, 1.0F, 1.0F, 1.0F); - - for (int i = 0; i < 9; i++) { - this.renderSlot(guiGraphics, i, guiGraphics.guiWidth() / 2 - 90 + i * 20 + 2, y + 3, alpha, spectatorPage.getItem(i)); + for (int j = 0; j < 9; j++) { + this.renderSlot(guiGraphics, j, guiGraphics.guiWidth() / 2 - 90 + j * 20 + 2, y + 3, alpha, spectatorPage.getItem(j)); } - - RenderSystem.disableBlend(); } private void renderSlot(GuiGraphics guiGraphics, int slot, int x, float y, float alpha, SpectatorMenuItem spectatorMenuItem) { if (spectatorMenuItem != SpectatorMenu.EMPTY_SLOT) { - int i = (int)(alpha * 255.0F); guiGraphics.pose().pushPose(); guiGraphics.pose().translate((float)x, y, 0.0F); float f = spectatorMenuItem.isEnabled() ? 1.0F : 0.25F; - guiGraphics.setColor(f, f, f, alpha); - spectatorMenuItem.renderIcon(guiGraphics, f, i); - guiGraphics.setColor(1.0F, 1.0F, 1.0F, 1.0F); + spectatorMenuItem.renderIcon(guiGraphics, f, alpha); guiGraphics.pose().popPose(); + int i = (int)(alpha * 255.0F); if (i > 3 && spectatorMenuItem.isEnabled()) { Component component = this.minecraft.options.keyHotbarSlots[slot].getTranslatedKeyMessage(); guiGraphics.drawString(this.minecraft.font, component, x + 19 - 2 - this.minecraft.font.width(component), (int)y + 6 + 3, 16777215 + (i << 24)); @@ -105,7 +98,7 @@ public class SpectatorGui implements SpectatorMenuListener { int j = this.minecraft.font.width(component); int k = (guiGraphics.guiWidth() - j) / 2; int l = guiGraphics.guiHeight() - 35; - guiGraphics.drawStringWithBackdrop(this.minecraft.font, component, k, l, j, FastColor.ARGB32.color(i, -1)); + guiGraphics.drawStringWithBackdrop(this.minecraft.font, component, k, l, j, ARGB.color(i, -1)); } } } diff --git a/net/minecraft/client/gui/components/tabs/TabNavigationBar.java b/net/minecraft/client/gui/components/tabs/TabNavigationBar.java index f5f60ab4..d5c0c29c 100644 --- a/net/minecraft/client/gui/components/tabs/TabNavigationBar.java +++ b/net/minecraft/client/gui/components/tabs/TabNavigationBar.java @@ -1,7 +1,6 @@ package net.minecraft.client.gui.components.tabs; import com.google.common.collect.ImmutableList; -import com.mojang.blaze3d.systems.RenderSystem; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; @@ -20,9 +19,12 @@ import net.minecraft.client.gui.layouts.LinearLayout; import net.minecraft.client.gui.narration.NarratableEntry; import net.minecraft.client.gui.narration.NarratedElementType; import net.minecraft.client.gui.narration.NarrationElementOutput; +import net.minecraft.client.gui.narration.NarratableEntry.NarrationPriority; import net.minecraft.client.gui.navigation.FocusNavigationEvent; import net.minecraft.client.gui.navigation.ScreenRectangle; +import net.minecraft.client.gui.navigation.FocusNavigationEvent.TabNavigation; import net.minecraft.client.gui.screens.Screen; +import net.minecraft.client.renderer.RenderType; import net.minecraft.network.chat.Component; import net.minecraft.util.Mth; import org.jetbrains.annotations.Nullable; @@ -88,7 +90,7 @@ public class TabNavigationBar extends AbstractContainerEventHandler implements R } } - return event instanceof FocusNavigationEvent.TabNavigation ? null : super.nextFocusPath(event); + return event instanceof TabNavigation ? null : super.nextFocusPath(event); } @Override @@ -97,12 +99,8 @@ public class TabNavigationBar extends AbstractContainerEventHandler implements R } @Override - public NarratableEntry.NarrationPriority narrationPriority() { - return (NarratableEntry.NarrationPriority)this.tabButtons - .stream() - .map(AbstractWidget::narrationPriority) - .max(Comparator.naturalOrder()) - .orElse(NarratableEntry.NarrationPriority.NONE); + public NarrationPriority narrationPriority() { + return (NarrationPriority)this.tabButtons.stream().map(AbstractWidget::narrationPriority).max(Comparator.naturalOrder()).orElse(NarrationPriority.NONE); } @Override @@ -134,13 +132,20 @@ public class TabNavigationBar extends AbstractContainerEventHandler implements R @Override public void render(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) { - RenderSystem.enableBlend(); guiGraphics.blit( - Screen.HEADER_SEPARATOR, 0, this.layout.getY() + this.layout.getHeight() - 2, 0.0F, 0.0F, ((TabButton)this.tabButtons.get(0)).getX(), 2, 32, 2 + RenderType::guiTextured, + Screen.HEADER_SEPARATOR, + 0, + this.layout.getY() + this.layout.getHeight() - 2, + 0.0F, + 0.0F, + ((TabButton)this.tabButtons.get(0)).getX(), + 2, + 32, + 2 ); int i = ((TabButton)this.tabButtons.get(this.tabButtons.size() - 1)).getRight(); - guiGraphics.blit(Screen.HEADER_SEPARATOR, i, this.layout.getY() + this.layout.getHeight() - 2, 0.0F, 0.0F, this.width, 2, 32, 2); - RenderSystem.disableBlend(); + guiGraphics.blit(RenderType::guiTextured, Screen.HEADER_SEPARATOR, i, this.layout.getY() + this.layout.getHeight() - 2, 0.0F, 0.0F, this.width, 2, 32, 2); for (TabButton tabButton : this.tabButtons) { tabButton.render(guiGraphics, mouseX, mouseY, partialTick); diff --git a/net/minecraft/client/gui/components/toasts/AdvancementToast.java b/net/minecraft/client/gui/components/toasts/AdvancementToast.java index 5ec1c9bc..f8b2ffd3 100644 --- a/net/minecraft/client/gui/components/toasts/AdvancementToast.java +++ b/net/minecraft/client/gui/components/toasts/AdvancementToast.java @@ -6,7 +6,9 @@ import net.fabricmc.api.Environment; import net.minecraft.advancements.AdvancementHolder; import net.minecraft.advancements.AdvancementType; import net.minecraft.advancements.DisplayInfo; +import net.minecraft.client.gui.Font; import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.renderer.RenderType; import net.minecraft.client.resources.sounds.SimpleSoundInstance; import net.minecraft.resources.ResourceLocation; import net.minecraft.sounds.SoundEvents; @@ -19,49 +21,62 @@ public class AdvancementToast implements Toast { public static final int DISPLAY_TIME = 5000; private final AdvancementHolder advancement; private boolean playedSound; + private Toast.Visibility wantedVisibility = Toast.Visibility.HIDE; public AdvancementToast(AdvancementHolder advancement) { this.advancement = advancement; } @Override - public Toast.Visibility render(GuiGraphics guiGraphics, ToastComponent toastComponent, long timeSinceLastVisible) { + public Toast.Visibility getWantedVisibility() { + return this.wantedVisibility; + } + + @Override + public void update(ToastManager toastManager, long l) { DisplayInfo displayInfo = (DisplayInfo)this.advancement.value().display().orElse(null); - guiGraphics.blitSprite(BACKGROUND_SPRITE, 0, 0, this.width(), this.height()); + if (displayInfo == null) { + this.wantedVisibility = Toast.Visibility.HIDE; + } else { + if (!this.playedSound && l > 0L) { + this.playedSound = true; + if (displayInfo.getType() == AdvancementType.CHALLENGE) { + toastManager.getMinecraft().getSoundManager().play(SimpleSoundInstance.forUI(SoundEvents.UI_TOAST_CHALLENGE_COMPLETE, 1.0F, 1.0F)); + } + } + + this.wantedVisibility = l >= 5000.0 * toastManager.getNotificationDisplayTimeMultiplier() ? Toast.Visibility.HIDE : Toast.Visibility.SHOW; + } + } + + @Override + public void render(GuiGraphics guiGraphics, Font font, long l) { + DisplayInfo displayInfo = (DisplayInfo)this.advancement.value().display().orElse(null); + guiGraphics.blitSprite(RenderType::guiTextured, BACKGROUND_SPRITE, 0, 0, this.width(), this.height()); if (displayInfo != null) { - List list = toastComponent.getMinecraft().font.split(displayInfo.getTitle(), 125); - int i = displayInfo.getType() == AdvancementType.CHALLENGE ? 16746751 : 16776960; + List list = font.split(displayInfo.getTitle(), 125); + int i = displayInfo.getType() == AdvancementType.CHALLENGE ? -30465 : -256; if (list.size() == 1) { - guiGraphics.drawString(toastComponent.getMinecraft().font, displayInfo.getType().getDisplayName(), 30, 7, i | 0xFF000000, false); - guiGraphics.drawString(toastComponent.getMinecraft().font, (FormattedCharSequence)list.get(0), 30, 18, -1, false); + guiGraphics.drawString(font, displayInfo.getType().getDisplayName(), 30, 7, i, false); + guiGraphics.drawString(font, (FormattedCharSequence)list.get(0), 30, 18, -1, false); } else { int j = 1500; float f = 300.0F; - if (timeSinceLastVisible < 1500L) { - int k = Mth.floor(Mth.clamp((float)(1500L - timeSinceLastVisible) / 300.0F, 0.0F, 1.0F) * 255.0F) << 24 | 67108864; - guiGraphics.drawString(toastComponent.getMinecraft().font, displayInfo.getType().getDisplayName(), 30, 11, i | k, false); + if (l < 1500L) { + int k = Mth.floor(Mth.clamp((float)(1500L - l) / 300.0F, 0.0F, 1.0F) * 255.0F) << 24 | 67108864; + guiGraphics.drawString(font, displayInfo.getType().getDisplayName(), 30, 11, i | k, false); } else { - int k = Mth.floor(Mth.clamp((float)(timeSinceLastVisible - 1500L) / 300.0F, 0.0F, 1.0F) * 252.0F) << 24 | 67108864; - int l = this.height() / 2 - list.size() * 9 / 2; + int k = Mth.floor(Mth.clamp((float)(l - 1500L) / 300.0F, 0.0F, 1.0F) * 252.0F) << 24 | 67108864; + int m = this.height() / 2 - list.size() * 9 / 2; for (FormattedCharSequence formattedCharSequence : list) { - guiGraphics.drawString(toastComponent.getMinecraft().font, formattedCharSequence, 30, l, 16777215 | k, false); - l += 9; + guiGraphics.drawString(font, formattedCharSequence, 30, m, 16777215 | k, false); + m += 9; } } } - if (!this.playedSound && timeSinceLastVisible > 0L) { - this.playedSound = true; - if (displayInfo.getType() == AdvancementType.CHALLENGE) { - toastComponent.getMinecraft().getSoundManager().play(SimpleSoundInstance.forUI(SoundEvents.UI_TOAST_CHALLENGE_COMPLETE, 1.0F, 1.0F)); - } - } - guiGraphics.renderFakeItem(displayInfo.getIcon(), 8, 8); - return timeSinceLastVisible >= 5000.0 * toastComponent.getNotificationDisplayTimeMultiplier() ? Toast.Visibility.HIDE : Toast.Visibility.SHOW; - } else { - return Toast.Visibility.HIDE; } } } diff --git a/net/minecraft/client/gui/components/toasts/RecipeToast.java b/net/minecraft/client/gui/components/toasts/RecipeToast.java index 30a828d0..3ea5f8d7 100644 --- a/net/minecraft/client/gui/components/toasts/RecipeToast.java +++ b/net/minecraft/client/gui/components/toasts/RecipeToast.java @@ -1,14 +1,18 @@ package net.minecraft.client.gui.components.toasts; -import com.google.common.collect.Lists; +import java.util.ArrayList; import java.util.List; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; +import net.minecraft.client.gui.Font; import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.renderer.RenderType; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.context.ContextMap; import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.crafting.RecipeHolder; +import net.minecraft.world.item.crafting.display.RecipeDisplay; +import net.minecraft.world.item.crafting.display.SlotDisplayContext; @Environment(EnvType.CLIENT) public class RecipeToast implements Toast { @@ -16,54 +20,70 @@ public class RecipeToast implements Toast { private static final long DISPLAY_TIME = 5000L; private static final Component TITLE_TEXT = Component.translatable("recipe.toast.title"); private static final Component DESCRIPTION_TEXT = Component.translatable("recipe.toast.description"); - private final List> recipes = Lists.>newArrayList(); + private final List recipeItems = new ArrayList(); private long lastChanged; private boolean changed; + private Toast.Visibility wantedVisibility = Toast.Visibility.HIDE; + private int displayedRecipeIndex; - public RecipeToast(RecipeHolder recipe) { - this.recipes.add(recipe); + private RecipeToast() { } @Override - public Toast.Visibility render(GuiGraphics guiGraphics, ToastComponent toastComponent, long timeSinceLastVisible) { + public Toast.Visibility getWantedVisibility() { + return this.wantedVisibility; + } + + @Override + public void update(ToastManager toastManager, long l) { if (this.changed) { - this.lastChanged = timeSinceLastVisible; + this.lastChanged = l; this.changed = false; } - if (this.recipes.isEmpty()) { - return Toast.Visibility.HIDE; + if (this.recipeItems.isEmpty()) { + this.wantedVisibility = Toast.Visibility.HIDE; } else { - guiGraphics.blitSprite(BACKGROUND_SPRITE, 0, 0, this.width(), this.height()); - guiGraphics.drawString(toastComponent.getMinecraft().font, TITLE_TEXT, 30, 7, -11534256, false); - guiGraphics.drawString(toastComponent.getMinecraft().font, DESCRIPTION_TEXT, 30, 18, -16777216, false); - RecipeHolder recipeHolder = (RecipeHolder)this.recipes - .get( - (int)(timeSinceLastVisible / Math.max(1.0, 5000.0 * toastComponent.getNotificationDisplayTimeMultiplier() / this.recipes.size()) % this.recipes.size()) - ); - ItemStack itemStack = recipeHolder.value().getToastSymbol(); - guiGraphics.pose().pushPose(); - guiGraphics.pose().scale(0.6F, 0.6F, 1.0F); - guiGraphics.renderFakeItem(itemStack, 3, 3); - guiGraphics.pose().popPose(); - guiGraphics.renderFakeItem(recipeHolder.value().getResultItem(toastComponent.getMinecraft().level.registryAccess()), 8, 8); - return timeSinceLastVisible - this.lastChanged >= 5000.0 * toastComponent.getNotificationDisplayTimeMultiplier() - ? Toast.Visibility.HIDE - : Toast.Visibility.SHOW; + this.wantedVisibility = l - this.lastChanged >= 5000.0 * toastManager.getNotificationDisplayTimeMultiplier() ? Toast.Visibility.HIDE : Toast.Visibility.SHOW; } + + this.displayedRecipeIndex = (int)( + l / Math.max(1.0, 5000.0 * toastManager.getNotificationDisplayTimeMultiplier() / this.recipeItems.size()) % this.recipeItems.size() + ); } - private void addItem(RecipeHolder recipe) { - this.recipes.add(recipe); + @Override + public void render(GuiGraphics guiGraphics, Font font, long l) { + guiGraphics.blitSprite(RenderType::guiTextured, BACKGROUND_SPRITE, 0, 0, this.width(), this.height()); + guiGraphics.drawString(font, TITLE_TEXT, 30, 7, -11534256, false); + guiGraphics.drawString(font, DESCRIPTION_TEXT, 30, 18, -16777216, false); + RecipeToast.Entry entry = (RecipeToast.Entry)this.recipeItems.get(this.displayedRecipeIndex); + guiGraphics.pose().pushPose(); + guiGraphics.pose().scale(0.6F, 0.6F, 1.0F); + guiGraphics.renderFakeItem(entry.categoryItem(), 3, 3); + guiGraphics.pose().popPose(); + guiGraphics.renderFakeItem(entry.unlockedItem(), 8, 8); + } + + private void addItem(ItemStack itemStack, ItemStack itemStack2) { + this.recipeItems.add(new RecipeToast.Entry(itemStack, itemStack2)); this.changed = true; } - public static void addOrUpdate(ToastComponent toastComponent, RecipeHolder recipe) { - RecipeToast recipeToast = toastComponent.getToast(RecipeToast.class, NO_TOKEN); + public static void addOrUpdate(ToastManager toastManager, RecipeDisplay recipeDisplay) { + RecipeToast recipeToast = toastManager.getToast(RecipeToast.class, NO_TOKEN); if (recipeToast == null) { - toastComponent.addToast(new RecipeToast(recipe)); - } else { - recipeToast.addItem(recipe); + recipeToast = new RecipeToast(); + toastManager.addToast(recipeToast); } + + ContextMap contextMap = SlotDisplayContext.fromLevel(toastManager.getMinecraft().level); + ItemStack itemStack = recipeDisplay.craftingStation().resolveForFirstStack(contextMap); + ItemStack itemStack2 = recipeDisplay.result().resolveForFirstStack(contextMap); + recipeToast.addItem(itemStack, itemStack2); + } + + @Environment(EnvType.CLIENT) + record Entry(ItemStack categoryItem, ItemStack unlockedItem) { } } diff --git a/net/minecraft/client/gui/components/toasts/SystemToast.java b/net/minecraft/client/gui/components/toasts/SystemToast.java index 7644a588..c7f1cb6c 100644 --- a/net/minecraft/client/gui/components/toasts/SystemToast.java +++ b/net/minecraft/client/gui/components/toasts/SystemToast.java @@ -8,6 +8,7 @@ import net.minecraft.ChatFormatting; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Font; import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.renderer.RenderType; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; import net.minecraft.util.FormattedCharSequence; @@ -27,6 +28,7 @@ public class SystemToast implements Toast { private boolean changed; private final int width; private boolean forceHide; + private Toast.Visibility wantedVisibility = Toast.Visibility.HIDE; public SystemToast(SystemToast.SystemToastId id, Component title, @Nullable Component message) { this( @@ -70,54 +72,62 @@ public class SystemToast implements Toast { } @Override - public Toast.Visibility render(GuiGraphics guiGraphics, ToastComponent toastComponent, long timeSinceLastVisible) { + public Toast.Visibility getWantedVisibility() { + return this.wantedVisibility; + } + + @Override + public void update(ToastManager toastManager, long l) { if (this.changed) { - this.lastChanged = timeSinceLastVisible; + this.lastChanged = l; this.changed = false; } + double d = this.id.displayTime * toastManager.getNotificationDisplayTimeMultiplier(); + long m = l - this.lastChanged; + this.wantedVisibility = !this.forceHide && m < d ? Toast.Visibility.SHOW : Toast.Visibility.HIDE; + } + + @Override + public void render(GuiGraphics guiGraphics, Font font, long l) { int i = this.width(); if (i == 160 && this.messageLines.size() <= 1) { - guiGraphics.blitSprite(BACKGROUND_SPRITE, 0, 0, i, this.height()); + guiGraphics.blitSprite(RenderType::guiTextured, BACKGROUND_SPRITE, 0, 0, i, this.height()); } else { int j = this.height(); int k = 28; - int l = Math.min(4, j - 28); + int m = Math.min(4, j - 28); this.renderBackgroundRow(guiGraphics, i, 0, 0, 28); - for (int m = 28; m < j - l; m += 10) { - this.renderBackgroundRow(guiGraphics, i, 16, m, Math.min(16, j - m - l)); + for (int n = 28; n < j - m; n += 10) { + this.renderBackgroundRow(guiGraphics, i, 16, n, Math.min(16, j - n - m)); } - this.renderBackgroundRow(guiGraphics, i, 32 - l, j - l, l); + this.renderBackgroundRow(guiGraphics, i, 32 - m, j - m, m); } if (this.messageLines.isEmpty()) { - guiGraphics.drawString(toastComponent.getMinecraft().font, this.title, 18, 12, -256, false); + guiGraphics.drawString(font, this.title, 18, 12, -256, false); } else { - guiGraphics.drawString(toastComponent.getMinecraft().font, this.title, 18, 7, -256, false); + guiGraphics.drawString(font, this.title, 18, 7, -256, false); for (int j = 0; j < this.messageLines.size(); j++) { - guiGraphics.drawString(toastComponent.getMinecraft().font, (FormattedCharSequence)this.messageLines.get(j), 18, 18 + j * 12, -1, false); + guiGraphics.drawString(font, (FormattedCharSequence)this.messageLines.get(j), 18, 18 + j * 12, -1, false); } } - - double d = this.id.displayTime * toastComponent.getNotificationDisplayTimeMultiplier(); - long n = timeSinceLastVisible - this.lastChanged; - return !this.forceHide && n < d ? Toast.Visibility.SHOW : Toast.Visibility.HIDE; } private void renderBackgroundRow(GuiGraphics guiGraphics, int width, int vOffset, int y, int height) { int i = vOffset == 0 ? 20 : 5; int j = Math.min(60, width - i); ResourceLocation resourceLocation = BACKGROUND_SPRITE; - guiGraphics.blitSprite(resourceLocation, 160, 32, 0, vOffset, 0, y, i, height); + guiGraphics.blitSprite(RenderType::guiTextured, resourceLocation, 160, 32, 0, vOffset, 0, y, i, height); for (int k = i; k < width - j; k += 64) { - guiGraphics.blitSprite(resourceLocation, 160, 32, 32, vOffset, k, y, Math.min(64, width - k - j), height); + guiGraphics.blitSprite(RenderType::guiTextured, resourceLocation, 160, 32, 32, vOffset, k, y, Math.min(64, width - k - j), height); } - guiGraphics.blitSprite(resourceLocation, 160, 32, 160 - j, vOffset, width - j, y, j, height); + guiGraphics.blitSprite(RenderType::guiTextured, resourceLocation, 160, 32, 160 - j, vOffset, width - j, y, j, height); } public void reset(Component title, @Nullable Component message) { @@ -130,41 +140,51 @@ public class SystemToast implements Toast { return this.id; } - public static void add(ToastComponent toastComponent, SystemToast.SystemToastId id, Component title, @Nullable Component message) { - toastComponent.addToast(new SystemToast(id, title, message)); + public static void add(ToastManager toastManager, SystemToast.SystemToastId systemToastId, Component component, @Nullable Component component2) { + toastManager.addToast(new SystemToast(systemToastId, component, component2)); } - public static void addOrUpdate(ToastComponent toastComponent, SystemToast.SystemToastId id, Component title, @Nullable Component message) { - SystemToast systemToast = toastComponent.getToast(SystemToast.class, id); + public static void addOrUpdate(ToastManager toastManager, SystemToast.SystemToastId systemToastId, Component component, @Nullable Component component2) { + SystemToast systemToast = toastManager.getToast(SystemToast.class, systemToastId); if (systemToast == null) { - add(toastComponent, id, title, message); + add(toastManager, systemToastId, component, component2); } else { - systemToast.reset(title, message); + systemToast.reset(component, component2); } } - public static void forceHide(ToastComponent toastComponent, SystemToast.SystemToastId id) { - SystemToast systemToast = toastComponent.getToast(SystemToast.class, id); + public static void forceHide(ToastManager toastManager, SystemToast.SystemToastId systemToastId) { + SystemToast systemToast = toastManager.getToast(SystemToast.class, systemToastId); if (systemToast != null) { systemToast.forceHide(); } } public static void onWorldAccessFailure(Minecraft minecraft, String message) { - add(minecraft.getToasts(), SystemToast.SystemToastId.WORLD_ACCESS_FAILURE, Component.translatable("selectWorld.access_failure"), Component.literal(message)); + add( + minecraft.getToastManager(), + SystemToast.SystemToastId.WORLD_ACCESS_FAILURE, + Component.translatable("selectWorld.access_failure"), + Component.literal(message) + ); } public static void onWorldDeleteFailure(Minecraft minecraft, String message) { - add(minecraft.getToasts(), SystemToast.SystemToastId.WORLD_ACCESS_FAILURE, Component.translatable("selectWorld.delete_failure"), Component.literal(message)); + add( + minecraft.getToastManager(), + SystemToast.SystemToastId.WORLD_ACCESS_FAILURE, + Component.translatable("selectWorld.delete_failure"), + Component.literal(message) + ); } public static void onPackCopyFailure(Minecraft minecraft, String message) { - add(minecraft.getToasts(), SystemToast.SystemToastId.PACK_COPY_FAILURE, Component.translatable("pack.copyFailure"), Component.literal(message)); + add(minecraft.getToastManager(), SystemToast.SystemToastId.PACK_COPY_FAILURE, Component.translatable("pack.copyFailure"), Component.literal(message)); } public static void onFileDropFailure(Minecraft minecraft, int failedFileCount) { add( - minecraft.getToasts(), + minecraft.getToastManager(), SystemToast.SystemToastId.FILE_DROP_FAILURE, Component.translatable("gui.fileDropFailure.title"), Component.translatable("gui.fileDropFailure.detail", failedFileCount) @@ -173,7 +193,7 @@ public class SystemToast implements Toast { public static void onLowDiskSpace(Minecraft minecraft) { addOrUpdate( - minecraft.getToasts(), + minecraft.getToastManager(), SystemToast.SystemToastId.LOW_DISK_SPACE, Component.translatable("chunk.toast.lowDiskSpace"), Component.translatable("chunk.toast.lowDiskSpace.description") @@ -182,7 +202,7 @@ public class SystemToast implements Toast { public static void onChunkLoadFailure(Minecraft minecraft, ChunkPos chunkPos) { addOrUpdate( - minecraft.getToasts(), + minecraft.getToastManager(), SystemToast.SystemToastId.CHUNK_LOAD_FAILURE, Component.translatable("chunk.toast.loadFailure", Component.translationArg(chunkPos)).withStyle(ChatFormatting.RED), Component.translatable("chunk.toast.checkLog") @@ -191,7 +211,7 @@ public class SystemToast implements Toast { public static void onChunkSaveFailure(Minecraft minecraft, ChunkPos chunkPos) { addOrUpdate( - minecraft.getToasts(), + minecraft.getToastManager(), SystemToast.SystemToastId.CHUNK_SAVE_FAILURE, Component.translatable("chunk.toast.saveFailure", Component.translationArg(chunkPos)).withStyle(ChatFormatting.RED), Component.translatable("chunk.toast.checkLog") diff --git a/net/minecraft/client/gui/components/toasts/Toast.java b/net/minecraft/client/gui/components/toasts/Toast.java index ee3927f1..63c3f7bf 100644 --- a/net/minecraft/client/gui/components/toasts/Toast.java +++ b/net/minecraft/client/gui/components/toasts/Toast.java @@ -2,6 +2,7 @@ package net.minecraft.client.gui.components.toasts; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; +import net.minecraft.client.gui.Font; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.resources.sounds.SimpleSoundInstance; import net.minecraft.client.sounds.SoundManager; @@ -12,9 +13,14 @@ import net.minecraft.util.Mth; @Environment(EnvType.CLIENT) public interface Toast { Object NO_TOKEN = new Object(); + int DEFAULT_WIDTH = 160; int SLOT_HEIGHT = 32; - Toast.Visibility render(GuiGraphics guiGraphics, ToastComponent toastComponent, long timeSinceLastVisible); + Toast.Visibility getWantedVisibility(); + + void update(ToastManager toastManager, long l); + + void render(GuiGraphics guiGraphics, Font font, long l); default Object getToken() { return NO_TOKEN; @@ -28,7 +34,7 @@ public interface Toast { return 32; } - default int slotCount() { + default int occcupiedSlotCount() { return Mth.positiveCeilDiv(this.height(), 32); } diff --git a/net/minecraft/client/gui/components/toasts/ToastComponent.java b/net/minecraft/client/gui/components/toasts/ToastComponent.java deleted file mode 100644 index e423744c..00000000 --- a/net/minecraft/client/gui/components/toasts/ToastComponent.java +++ /dev/null @@ -1,161 +0,0 @@ -package net.minecraft.client.gui.components.toasts; - -import com.google.common.collect.Queues; -import java.util.ArrayList; -import java.util.BitSet; -import java.util.Deque; -import java.util.List; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.Util; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.GuiGraphics; -import net.minecraft.util.Mth; -import org.jetbrains.annotations.Nullable; - -@Environment(EnvType.CLIENT) -public class ToastComponent { - private static final int SLOT_COUNT = 5; - private static final int NO_SPACE = -1; - final Minecraft minecraft; - private final List> visible = new ArrayList(); - private final BitSet occupiedSlots = new BitSet(5); - private final Deque queued = Queues.newArrayDeque(); - - public ToastComponent(Minecraft minecraft) { - this.minecraft = minecraft; - } - - public void render(GuiGraphics guiGraphics) { - if (!this.minecraft.options.hideGui) { - int i = guiGraphics.guiWidth(); - this.visible.removeIf(toastInstance -> { - if (toastInstance != null && toastInstance.render(i, guiGraphics)) { - this.occupiedSlots.clear(toastInstance.index, toastInstance.index + toastInstance.slotCount); - return true; - } else { - return false; - } - }); - if (!this.queued.isEmpty() && this.freeSlots() > 0) { - this.queued.removeIf(toast -> { - int ix = toast.slotCount(); - int j = this.findFreeIndex(ix); - if (j != -1) { - this.visible.add(new ToastComponent.ToastInstance<>(toast, j, ix)); - this.occupiedSlots.set(j, j + ix); - return true; - } else { - return false; - } - }); - } - } - } - - private int findFreeIndex(int slotCount) { - if (this.freeSlots() >= slotCount) { - int i = 0; - - for (int j = 0; j < 5; j++) { - if (this.occupiedSlots.get(j)) { - i = 0; - } else if (++i == slotCount) { - return j + 1 - i; - } - } - } - - return -1; - } - - private int freeSlots() { - return 5 - this.occupiedSlots.cardinality(); - } - - @Nullable - public T getToast(Class toastClass, Object token) { - for (ToastComponent.ToastInstance toastInstance : this.visible) { - if (toastInstance != null && toastClass.isAssignableFrom(toastInstance.getToast().getClass()) && toastInstance.getToast().getToken().equals(token)) { - return (T)toastInstance.getToast(); - } - } - - for (Toast toast : this.queued) { - if (toastClass.isAssignableFrom(toast.getClass()) && toast.getToken().equals(token)) { - return (T)toast; - } - } - - return null; - } - - public void clear() { - this.occupiedSlots.clear(); - this.visible.clear(); - this.queued.clear(); - } - - public void addToast(Toast toast) { - this.queued.add(toast); - } - - public Minecraft getMinecraft() { - return this.minecraft; - } - - public double getNotificationDisplayTimeMultiplier() { - return this.minecraft.options.notificationDisplayTime().get(); - } - - @Environment(EnvType.CLIENT) - class ToastInstance { - private static final long ANIMATION_TIME = 600L; - private final T toast; - final int index; - final int slotCount; - private long animationTime = -1L; - private long visibleTime = -1L; - private Toast.Visibility visibility = Toast.Visibility.SHOW; - - ToastInstance(final T toast, final int index, final int slotCount) { - this.toast = toast; - this.index = index; - this.slotCount = slotCount; - } - - public T getToast() { - return this.toast; - } - - private float getVisibility(long time) { - float f = Mth.clamp((float)(time - this.animationTime) / 600.0F, 0.0F, 1.0F); - f *= f; - return this.visibility == Toast.Visibility.HIDE ? 1.0F - f : f; - } - - public boolean render(int screenWidth, GuiGraphics guiGraphics) { - long l = Util.getMillis(); - if (this.animationTime == -1L) { - this.animationTime = l; - this.visibility.playSound(ToastComponent.this.minecraft.getSoundManager()); - } - - if (this.visibility == Toast.Visibility.SHOW && l - this.animationTime <= 600L) { - this.visibleTime = l; - } - - guiGraphics.pose().pushPose(); - guiGraphics.pose().translate(screenWidth - this.toast.width() * this.getVisibility(l), (float)(this.index * 32), 800.0F); - Toast.Visibility visibility = this.toast.render(guiGraphics, ToastComponent.this, l - this.visibleTime); - guiGraphics.pose().popPose(); - if (visibility != this.visibility) { - this.animationTime = l - (int)((1.0F - this.getVisibility(l)) * 600.0F); - this.visibility = visibility; - this.visibility.playSound(ToastComponent.this.minecraft.getSoundManager()); - } - - return this.visibility == Toast.Visibility.HIDE && l - this.animationTime > 600L; - } - } -} diff --git a/net/minecraft/client/gui/components/toasts/ToastManager.java b/net/minecraft/client/gui/components/toasts/ToastManager.java new file mode 100644 index 00000000..e501d72b --- /dev/null +++ b/net/minecraft/client/gui/components/toasts/ToastManager.java @@ -0,0 +1,187 @@ +package net.minecraft.client.gui.components.toasts; + +import com.google.common.collect.Queues; +import java.util.ArrayList; +import java.util.BitSet; +import java.util.Deque; +import java.util.List; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.Util; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.util.Mth; +import org.jetbrains.annotations.Nullable; + +@Environment(EnvType.CLIENT) +public class ToastManager { + private static final int SLOT_COUNT = 5; + private static final int ALL_SLOTS_OCCUPIED = -1; + final Minecraft minecraft; + private final List> visibleToasts = new ArrayList(); + private final BitSet occupiedSlots = new BitSet(5); + private final Deque queued = Queues.newArrayDeque(); + + public ToastManager(Minecraft minecraft) { + this.minecraft = minecraft; + } + + public void update() { + this.visibleToasts.removeIf(toastInstance -> { + toastInstance.update(); + if (toastInstance.hasFinishedRendering()) { + this.occupiedSlots.clear(toastInstance.firstSlotIndex, toastInstance.firstSlotIndex + toastInstance.occupiedSlotCount); + return true; + } else { + return false; + } + }); + if (!this.queued.isEmpty() && this.freeSlotCount() > 0) { + this.queued.removeIf(toast -> { + int i = toast.occcupiedSlotCount(); + int j = this.findFreeSlotsIndex(i); + if (j == -1) { + return false; + } else { + this.visibleToasts.add(new ToastManager.ToastInstance<>(toast, j, i)); + this.occupiedSlots.set(j, j + i); + return true; + } + }); + } + } + + public void render(GuiGraphics guiGraphics) { + if (!this.minecraft.options.hideGui) { + int i = guiGraphics.guiWidth(); + + for (ToastManager.ToastInstance toastInstance : this.visibleToasts) { + toastInstance.render(guiGraphics, i); + } + } + } + + private int findFreeSlotsIndex(int i) { + if (this.freeSlotCount() >= i) { + int j = 0; + + for (int k = 0; k < 5; k++) { + if (this.occupiedSlots.get(k)) { + j = 0; + } else if (++j == i) { + return k + 1 - j; + } + } + } + + return -1; + } + + private int freeSlotCount() { + return 5 - this.occupiedSlots.cardinality(); + } + + @Nullable + public T getToast(Class class_, Object object) { + for (ToastManager.ToastInstance toastInstance : this.visibleToasts) { + if (toastInstance != null && class_.isAssignableFrom(toastInstance.getToast().getClass()) && toastInstance.getToast().getToken().equals(object)) { + return (T)toastInstance.getToast(); + } + } + + for (Toast toast : this.queued) { + if (class_.isAssignableFrom(toast.getClass()) && toast.getToken().equals(object)) { + return (T)toast; + } + } + + return null; + } + + public void clear() { + this.occupiedSlots.clear(); + this.visibleToasts.clear(); + this.queued.clear(); + } + + public void addToast(Toast toast) { + this.queued.add(toast); + } + + public Minecraft getMinecraft() { + return this.minecraft; + } + + public double getNotificationDisplayTimeMultiplier() { + return this.minecraft.options.notificationDisplayTime().get(); + } + + @Environment(EnvType.CLIENT) + class ToastInstance { + private static final long SLIDE_ANIMATION_DURATION_MS = 600L; + private final T toast; + final int firstSlotIndex; + final int occupiedSlotCount; + private long animationStartTime = -1L; + private long becameFullyVisibleAt = -1L; + private Toast.Visibility visibility = Toast.Visibility.SHOW; + private long fullyVisibleFor; + private float visiblePortion; + private boolean hasFinishedRendering; + + ToastInstance(final T toast, final int i, final int j) { + this.toast = toast; + this.firstSlotIndex = i; + this.occupiedSlotCount = j; + } + + public T getToast() { + return this.toast; + } + + public boolean hasFinishedRendering() { + return this.hasFinishedRendering; + } + + private void calculateVisiblePortion(long l) { + float f = Mth.clamp((float)(l - this.animationStartTime) / 600.0F, 0.0F, 1.0F); + f *= f; + if (this.visibility == Toast.Visibility.HIDE) { + this.visiblePortion = 1.0F - f; + } else { + this.visiblePortion = f; + } + } + + public void update() { + long l = Util.getMillis(); + if (this.animationStartTime == -1L) { + this.animationStartTime = l; + this.visibility.playSound(ToastManager.this.minecraft.getSoundManager()); + } + + if (this.visibility == Toast.Visibility.SHOW && l - this.animationStartTime <= 600L) { + this.becameFullyVisibleAt = l; + } + + this.fullyVisibleFor = l - this.becameFullyVisibleAt; + this.calculateVisiblePortion(l); + this.toast.update(ToastManager.this, this.fullyVisibleFor); + Toast.Visibility visibility = this.toast.getWantedVisibility(); + if (visibility != this.visibility) { + this.animationStartTime = l - (int)((1.0F - this.visiblePortion) * 600.0F); + this.visibility = visibility; + this.visibility.playSound(ToastManager.this.minecraft.getSoundManager()); + } + + this.hasFinishedRendering = this.visibility == Toast.Visibility.HIDE && l - this.animationStartTime > 600L; + } + + public void render(GuiGraphics guiGraphics, int i) { + guiGraphics.pose().pushPose(); + guiGraphics.pose().translate(i - this.toast.width() * this.visiblePortion, (float)(this.firstSlotIndex * 32), 800.0F); + this.toast.render(guiGraphics, ToastManager.this.minecraft.font, this.fullyVisibleFor); + guiGraphics.pose().popPose(); + } + } +} diff --git a/net/minecraft/client/gui/components/toasts/TutorialToast.java b/net/minecraft/client/gui/components/toasts/TutorialToast.java index 09529846..7180ec23 100644 --- a/net/minecraft/client/gui/components/toasts/TutorialToast.java +++ b/net/minecraft/client/gui/components/toasts/TutorialToast.java @@ -1,9 +1,10 @@ package net.minecraft.client.gui.components.toasts; -import com.mojang.blaze3d.systems.RenderSystem; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; +import net.minecraft.client.gui.Font; import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.renderer.RenderType; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; import net.minecraft.util.Mth; @@ -21,45 +22,66 @@ public class TutorialToast implements Toast { @Nullable private final Component message; private Toast.Visibility visibility = Toast.Visibility.SHOW; - private long lastProgressTime; - private float lastProgress; + private long lastSmoothingTime; + private float smoothedProgress; private float progress; private final boolean progressable; + private final int timeToDisplayMs; + + public TutorialToast(TutorialToast.Icons icons, Component component, @Nullable Component component2, boolean bl, int i) { + this.icon = icons; + this.title = component; + this.message = component2; + this.progressable = bl; + this.timeToDisplayMs = i; + } public TutorialToast(TutorialToast.Icons icon, Component title, @Nullable Component message, boolean progressable) { - this.icon = icon; - this.title = title; - this.message = message; - this.progressable = progressable; + this(icon, title, message, progressable, 0); } @Override - public Toast.Visibility render(GuiGraphics guiGraphics, ToastComponent toastComponent, long timeSinceLastVisible) { - guiGraphics.blitSprite(BACKGROUND_SPRITE, 0, 0, this.width(), this.height()); + public Toast.Visibility getWantedVisibility() { + return this.visibility; + } + + @Override + public void update(ToastManager toastManager, long l) { + if (this.timeToDisplayMs > 0) { + this.progress = Math.min((float)l / this.timeToDisplayMs, 1.0F); + this.smoothedProgress = this.progress; + this.lastSmoothingTime = l; + if (l > this.timeToDisplayMs) { + this.hide(); + } + } else if (this.progressable) { + this.smoothedProgress = Mth.clampedLerp(this.smoothedProgress, this.progress, (float)(l - this.lastSmoothingTime) / 100.0F); + this.lastSmoothingTime = l; + } + } + + @Override + public void render(GuiGraphics guiGraphics, Font font, long l) { + guiGraphics.blitSprite(RenderType::guiTextured, BACKGROUND_SPRITE, 0, 0, this.width(), this.height()); this.icon.render(guiGraphics, 6, 6); if (this.message == null) { - guiGraphics.drawString(toastComponent.getMinecraft().font, this.title, 30, 12, -11534256, false); + guiGraphics.drawString(font, this.title, 30, 12, -11534256, false); } else { - guiGraphics.drawString(toastComponent.getMinecraft().font, this.title, 30, 7, -11534256, false); - guiGraphics.drawString(toastComponent.getMinecraft().font, this.message, 30, 18, -16777216, false); + guiGraphics.drawString(font, this.title, 30, 7, -11534256, false); + guiGraphics.drawString(font, this.message, 30, 18, -16777216, false); } if (this.progressable) { guiGraphics.fill(3, 28, 157, 29, -1); - float f = Mth.clampedLerp(this.lastProgress, this.progress, (float)(timeSinceLastVisible - this.lastProgressTime) / 100.0F); int i; - if (this.progress >= this.lastProgress) { + if (this.progress >= this.smoothedProgress) { i = -16755456; } else { i = -11206656; } - guiGraphics.fill(3, 28, (int)(3.0F + 154.0F * f), 29, i); - this.lastProgress = f; - this.lastProgressTime = timeSinceLastVisible; + guiGraphics.fill(3, 28, (int)(3.0F + 154.0F * this.smoothedProgress), 29, i); } - - return this.visibility; } public void hide() { @@ -87,8 +109,7 @@ public class TutorialToast implements Toast { } public void render(GuiGraphics guiGraphics, int x, int y) { - RenderSystem.enableBlend(); - guiGraphics.blitSprite(this.sprite, x, y, 20, 20); + guiGraphics.blitSprite(RenderType::guiTextured, this.sprite, x, y, 20, 20); } } } diff --git a/net/minecraft/client/gui/font/FontManager.java b/net/minecraft/client/gui/font/FontManager.java index 843af700..9048e780 100644 --- a/net/minecraft/client/gui/font/FontManager.java +++ b/net/minecraft/client/gui/font/FontManager.java @@ -6,6 +6,7 @@ import com.google.gson.GsonBuilder; import com.google.gson.JsonElement; import com.google.gson.JsonParseException; import com.mojang.blaze3d.font.GlyphProvider; +import com.mojang.blaze3d.font.GlyphProvider.Conditional; import com.mojang.datafixers.util.Either; import com.mojang.datafixers.util.Pair; import com.mojang.logging.LogUtils; @@ -36,7 +37,8 @@ import net.minecraft.Util; import net.minecraft.client.Minecraft; import net.minecraft.client.Options; import net.minecraft.client.gui.Font; -import net.minecraft.client.gui.font.providers.GlyphProviderDefinition; +import net.minecraft.client.gui.font.providers.GlyphProviderDefinition.Loader; +import net.minecraft.client.gui.font.providers.GlyphProviderDefinition.Reference; import net.minecraft.client.renderer.texture.TextureManager; import net.minecraft.resources.FileToIdConverter; import net.minecraft.resources.ResourceLocation; @@ -44,6 +46,7 @@ import net.minecraft.server.packs.resources.PreparableReloadListener; import net.minecraft.server.packs.resources.Resource; import net.minecraft.server.packs.resources.ResourceManager; import net.minecraft.util.DependencySorter; +import net.minecraft.util.profiling.Profiler; import net.minecraft.util.profiling.ProfilerFiller; import org.jetbrains.annotations.Nullable; import org.slf4j.Logger; @@ -67,24 +70,17 @@ public class FontManager implements PreparableReloadListener, AutoCloseable { this.missingFontSet = Util.make(new FontSet(textureManager, MISSING_FONT), fontSet -> fontSet.reload(List.of(createFallbackProvider()), Set.of())); } - private static GlyphProvider.Conditional createFallbackProvider() { - return new GlyphProvider.Conditional(new AllMissingGlyphProvider(), FontOption.Filter.ALWAYS_PASS); + private static Conditional createFallbackProvider() { + return new Conditional(new AllMissingGlyphProvider(), FontOption.Filter.ALWAYS_PASS); } @Override public CompletableFuture reload( - PreparableReloadListener.PreparationBarrier preparationBarrier, - ResourceManager resourceManager, - ProfilerFiller preparationsProfiler, - ProfilerFiller reloadProfiler, - Executor backgroundExecutor, - Executor gameExecutor + PreparableReloadListener.PreparationBarrier preparationBarrier, ResourceManager resourceManager, Executor executor, Executor executor2 ) { - preparationsProfiler.startTick(); - preparationsProfiler.endTick(); - return this.prepare(resourceManager, backgroundExecutor) + return this.prepare(resourceManager, executor) .thenCompose(preparationBarrier::wait) - .thenAcceptAsync(preparation -> this.apply(preparation, reloadProfiler), gameExecutor); + .thenAcceptAsync(preparation -> this.apply(preparation, Profiler.get()), executor2); } private CompletableFuture prepare(ResourceManager resourceManager, Executor executor) { @@ -92,21 +88,28 @@ public class FontManager implements PreparableReloadListener, AutoCloseable { for (Entry> entry : FONT_DEFINITIONS.listMatchingResourceStacks(resourceManager).entrySet()) { ResourceLocation resourceLocation = FONT_DEFINITIONS.fileToId((ResourceLocation)entry.getKey()); - list.add(CompletableFuture.supplyAsync(() -> { - List> listx = loadResourceStack((List)entry.getValue(), resourceLocation); - FontManager.UnresolvedBuilderBundle unresolvedBuilderBundle = new FontManager.UnresolvedBuilderBundle(resourceLocation); + list.add( + CompletableFuture.supplyAsync( + () -> { + List> listx = loadResourceStack( + (List)entry.getValue(), resourceLocation + ); + FontManager.UnresolvedBuilderBundle unresolvedBuilderBundle = new FontManager.UnresolvedBuilderBundle(resourceLocation); - for (Pair pair : listx) { - FontManager.BuilderId builderId = pair.getFirst(); - FontOption.Filter filter = pair.getSecond().filter(); - pair.getSecond().definition().unpack().ifLeft(loader -> { - CompletableFuture> completableFuture = this.safeLoad(builderId, loader, resourceManager, executor); - unresolvedBuilderBundle.add(builderId, filter, completableFuture); - }).ifRight(reference -> unresolvedBuilderBundle.add(builderId, filter, reference)); - } + for (Pair pair : listx) { + FontManager.BuilderId builderId = pair.getFirst(); + FontOption.Filter filter = pair.getSecond().filter(); + pair.getSecond().definition().unpack().ifLeft(loader -> { + CompletableFuture> completableFuture = this.safeLoad(builderId, loader, resourceManager, executor); + unresolvedBuilderBundle.add(builderId, filter, completableFuture); + }).ifRight(reference -> unresolvedBuilderBundle.add(builderId, filter, reference)); + } - return unresolvedBuilderBundle; - }, executor)); + return unresolvedBuilderBundle; + }, + executor + ) + ); } return Util.sequence(list) @@ -115,12 +118,12 @@ public class FontManager implements PreparableReloadListener, AutoCloseable { List>> list2 = (List>>)listx.stream() .flatMap(FontManager.UnresolvedBuilderBundle::listBuilders) .collect(Util.toMutableList()); - GlyphProvider.Conditional conditional = createFallbackProvider(); + Conditional conditional = createFallbackProvider(); list2.add(CompletableFuture.completedFuture(Optional.of(conditional.provider()))); return Util.sequence(list2) .thenCompose( list2x -> { - Map> map = this.resolveProviders(listx); + Map> map = this.resolveProviders(listx); CompletableFuture[] completableFutures = (CompletableFuture[])map.values() .stream() .map(listxxx -> CompletableFuture.runAsync(() -> this.finalizeProviderLoading(listxxx, conditional), executor)) @@ -135,9 +138,7 @@ public class FontManager implements PreparableReloadListener, AutoCloseable { ); } - private CompletableFuture> safeLoad( - FontManager.BuilderId builderId, GlyphProviderDefinition.Loader loader, ResourceManager resourceManager, Executor executor - ) { + private CompletableFuture> safeLoad(FontManager.BuilderId builderId, Loader loader, ResourceManager resourceManager, Executor executor) { return CompletableFuture.supplyAsync(() -> { try { return Optional.of(loader.load(resourceManager)); @@ -148,8 +149,8 @@ public class FontManager implements PreparableReloadListener, AutoCloseable { }, executor); } - private Map> resolveProviders(List unresolvedBuilderBundles) { - Map> map = new HashMap(); + private Map> resolveProviders(List unresolvedBuilderBundles) { + Map> map = new HashMap(); DependencySorter dependencySorter = new DependencySorter<>(); unresolvedBuilderBundles.forEach(unresolvedBuilderBundle -> dependencySorter.addEntry(unresolvedBuilderBundle.fontId, unresolvedBuilderBundle)); dependencySorter.orderByDependencies( @@ -158,17 +159,17 @@ public class FontManager implements PreparableReloadListener, AutoCloseable { return map; } - private void finalizeProviderLoading(List providers, GlyphProvider.Conditional fallbackProvider) { + private void finalizeProviderLoading(List providers, Conditional fallbackProvider) { providers.add(0, fallbackProvider); IntSet intSet = new IntOpenHashSet(); - for (GlyphProvider.Conditional conditional : providers) { + for (Conditional conditional : providers) { intSet.addAll(conditional.provider().getSupportedGlyphs()); } intSet.forEach(i -> { if (i != 32) { - for (GlyphProvider.Conditional conditionalx : Lists.reverse(providers)) { + for (Conditional conditionalx : Lists.reverse(providers)) { if (conditionalx.provider().getGlyph(i) != null) { break; } @@ -191,7 +192,6 @@ public class FontManager implements PreparableReloadListener, AutoCloseable { } private void apply(FontManager.Preparation preperation, ProfilerFiller profiler) { - profiler.startTick(); profiler.push("closing"); this.lastFontSetCache = null; this.fontSets.values().forEach(FontSet::close); @@ -207,7 +207,6 @@ public class FontManager implements PreparableReloadListener, AutoCloseable { }); this.providersToClose.addAll(preperation.allProviders); profiler.pop(); - profiler.endTick(); if (!this.fontSets.containsKey(Minecraft.DEFAULT_FONT)) { throw new IllegalStateException("Default font failed to load"); } @@ -221,8 +220,10 @@ public class FontManager implements PreparableReloadListener, AutoCloseable { } } - private static List> loadResourceStack(List resources, ResourceLocation fontId) { - List> list = new ArrayList(); + private static List> loadResourceStack( + List resources, ResourceLocation fontId + ) { + List> list = new ArrayList(); for (Resource resource : resources) { try { @@ -233,11 +234,11 @@ public class FontManager implements PreparableReloadListener, AutoCloseable { FontManager.FontDefinitionFile fontDefinitionFile = FontManager.FontDefinitionFile.CODEC .parse(JsonOps.INSTANCE, jsonElement) .getOrThrow(JsonParseException::new); - List list2 = fontDefinitionFile.providers; + List list2 = fontDefinitionFile.providers; for (int i = list2.size() - 1; i >= 0; i--) { FontManager.BuilderId builderId = new FontManager.BuilderId(fontId, resource.sourcePackId(), i); - list.add(Pair.of(builderId, (GlyphProviderDefinition.Conditional)list2.get(i))); + list.add(Pair.of(builderId, (net.minecraft.client.gui.font.providers.GlyphProviderDefinition.Conditional)list2.get(i))); } } catch (Throwable var12) { if (reader != null) { @@ -301,12 +302,12 @@ public class FontManager implements PreparableReloadListener, AutoCloseable { @Environment(EnvType.CLIENT) record BuilderResult(FontManager.BuilderId id, FontOption.Filter filter, Either>, ResourceLocation> result) { - public Optional> resolve(Function> providerResolver) { + public Optional> resolve(Function> providerResolver) { return this.result .map( - completableFuture -> ((Optional)completableFuture.join()).map(glyphProvider -> List.of(new GlyphProvider.Conditional(glyphProvider, this.filter))), + completableFuture -> ((Optional)completableFuture.join()).map(glyphProvider -> List.of(new Conditional(glyphProvider, this.filter))), resourceLocation -> { - List list = (List)providerResolver.apply(resourceLocation); + List list = (List)providerResolver.apply(resourceLocation); if (list == null) { FontManager.LOGGER .warn("Can't find font {} referenced by builder {}, either because it's missing, failed to load or is part of loading cycle", resourceLocation, this.id); @@ -318,32 +319,37 @@ public class FontManager implements PreparableReloadListener, AutoCloseable { ); } - private GlyphProvider.Conditional mergeFilters(GlyphProvider.Conditional conditional) { - return new GlyphProvider.Conditional(conditional.provider(), this.filter.merge(conditional.filter())); + private Conditional mergeFilters(Conditional conditional) { + return new Conditional(conditional.provider(), this.filter.merge(conditional.filter())); } } @Environment(EnvType.CLIENT) - record FontDefinitionFile(List providers) { + record FontDefinitionFile(List providers) { public static final Codec CODEC = RecordCodecBuilder.create( - instance -> instance.group(GlyphProviderDefinition.Conditional.CODEC.listOf().fieldOf("providers").forGetter(FontManager.FontDefinitionFile::providers)) + instance -> instance.group( + net.minecraft.client.gui.font.providers.GlyphProviderDefinition.Conditional.CODEC + .listOf() + .fieldOf("providers") + .forGetter(FontManager.FontDefinitionFile::providers) + ) .apply(instance, FontManager.FontDefinitionFile::new) ); } @Environment(EnvType.CLIENT) - record Preparation(Map> fontSets, List allProviders) { + record Preparation(Map> fontSets, List allProviders) { } @Environment(EnvType.CLIENT) record UnresolvedBuilderBundle(ResourceLocation fontId, List builders, Set dependencies) - implements DependencySorter.Entry { + implements net.minecraft.util.DependencySorter.Entry { public UnresolvedBuilderBundle(ResourceLocation fontId) { this(fontId, new ArrayList(), new HashSet()); } - public void add(FontManager.BuilderId builderId, FontOption.Filter filter, GlyphProviderDefinition.Reference glyphProvider) { + public void add(FontManager.BuilderId builderId, FontOption.Filter filter, Reference glyphProvider) { this.builders.add(new FontManager.BuilderResult(builderId, filter, Either.right(glyphProvider.id()))); this.dependencies.add(glyphProvider.id()); } @@ -356,11 +362,11 @@ public class FontManager implements PreparableReloadListener, AutoCloseable { return this.builders.stream().flatMap(builderResult -> builderResult.result.left().stream()); } - public Optional> resolve(Function> providerResolver) { - List list = new ArrayList(); + public Optional> resolve(Function> providerResolver) { + List list = new ArrayList(); for (FontManager.BuilderResult builderResult : this.builders) { - Optional> optional = builderResult.resolve(providerResolver); + Optional> optional = builderResult.resolve(providerResolver); if (!optional.isPresent()) { return Optional.empty(); } diff --git a/net/minecraft/client/gui/font/FontSet.java b/net/minecraft/client/gui/font/FontSet.java index ceb4adbf..c5176947 100644 --- a/net/minecraft/client/gui/font/FontSet.java +++ b/net/minecraft/client/gui/font/FontSet.java @@ -5,6 +5,8 @@ import com.google.common.collect.Sets; import com.mojang.blaze3d.font.GlyphInfo; import com.mojang.blaze3d.font.GlyphProvider; import com.mojang.blaze3d.font.SheetGlyphInfo; +import com.mojang.blaze3d.font.GlyphProvider.Conditional; +import com.mojang.logging.LogUtils; import it.unimi.dsi.fastutil.ints.Int2ObjectFunction; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; @@ -15,6 +17,7 @@ import it.unimi.dsi.fastutil.ints.IntSet; import java.util.ArrayList; import java.util.List; import java.util.Set; +import java.util.function.IntFunction; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.gui.font.glyphs.BakedGlyph; @@ -23,28 +26,32 @@ import net.minecraft.client.renderer.texture.TextureManager; import net.minecraft.resources.ResourceLocation; import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; +import org.slf4j.Logger; @Environment(EnvType.CLIENT) public class FontSet implements AutoCloseable { + private static final Logger LOGGER = LogUtils.getLogger(); private static final RandomSource RANDOM = RandomSource.create(); private static final float LARGE_FORWARD_ADVANCE = 32.0F; private final TextureManager textureManager; private final ResourceLocation name; private BakedGlyph missingGlyph; private BakedGlyph whiteGlyph; - private List allProviders = List.of(); + private List allProviders = List.of(); private List activeProviders = List.of(); private final CodepointMap glyphs = new CodepointMap<>(BakedGlyph[]::new, BakedGlyph[][]::new); private final CodepointMap glyphInfos = new CodepointMap<>(FontSet.GlyphInfoFilter[]::new, FontSet.GlyphInfoFilter[][]::new); private final Int2ObjectMap glyphsByWidth = new Int2ObjectOpenHashMap<>(); private final List textures = Lists.newArrayList(); + private final IntFunction glyphInfoGetter = this::computeGlyphInfo; + private final IntFunction glyphGetter = this::computeBakedGlyph; public FontSet(TextureManager textureManager, ResourceLocation name) { this.textureManager = textureManager; this.name = name; } - public void reload(List allProviders, Set options) { + public void reload(List allProviders, Set options) { this.allProviders = allProviders; this.reload(options); } @@ -64,11 +71,11 @@ public class FontSet implements AutoCloseable { this.whiteGlyph = SpecialGlyphs.WHITE.bake(this::stitch); } - private List selectProviders(List providers, Set options) { + private List selectProviders(List providers, Set options) { IntSet intSet = new IntOpenHashSet(); List list = new ArrayList(); - for (GlyphProvider.Conditional conditional : providers) { + for (Conditional conditional : providers) { if (conditional.filter().apply(options)) { list.add(conditional.provider()); intSet.addAll(conditional.provider().getSupportedGlyphs()); @@ -133,7 +140,7 @@ public class FontSet implements AutoCloseable { } public GlyphInfo getGlyphInfo(int character, boolean filterFishyGlyphs) { - return this.glyphInfos.computeIfAbsent(character, this::computeGlyphInfo).select(filterFishyGlyphs); + return this.glyphInfos.computeIfAbsent(character, this.glyphInfoGetter).select(filterFishyGlyphs); } private BakedGlyph computeBakedGlyph(int character) { @@ -144,11 +151,12 @@ public class FontSet implements AutoCloseable { } } + LOGGER.warn("Couldn't find glyph for character {} (\\u{})", Character.toString(character), String.format("%04x", character)); return this.missingGlyph; } public BakedGlyph getGlyph(int character) { - return this.glyphs.computeIfAbsent(character, this::computeBakedGlyph); + return this.glyphs.computeIfAbsent(character, this.glyphGetter); } private BakedGlyph stitch(SheetGlyphInfo glyphInfo) { diff --git a/net/minecraft/client/gui/font/glyphs/BakedGlyph.java b/net/minecraft/client/gui/font/glyphs/BakedGlyph.java index e1650bed..14db93c2 100644 --- a/net/minecraft/client/gui/font/glyphs/BakedGlyph.java +++ b/net/minecraft/client/gui/font/glyphs/BakedGlyph.java @@ -6,6 +6,7 @@ import net.fabricmc.api.Environment; import net.minecraft.client.gui.Font; import net.minecraft.client.gui.font.GlyphRenderTypes; import net.minecraft.client.renderer.RenderType; +import net.minecraft.network.chat.Style; import org.joml.Matrix4f; @Environment(EnvType.CLIENT) @@ -32,24 +33,36 @@ public class BakedGlyph { this.down = down; } - public void render(boolean italic, float x, float y, Matrix4f matrix, VertexConsumer buffer, float red, float green, float blue, float alpha, int packedLight) { - float f = x + this.left; - float g = x + this.right; - float h = y + this.up; - float i = y + this.down; - float j = italic ? 1.0F - 0.25F * this.up : 0.0F; - float k = italic ? 1.0F - 0.25F * this.down : 0.0F; - buffer.addVertex(matrix, f + j, h, 0.0F).setColor(red, green, blue, alpha).setUv(this.u0, this.v0).setLight(packedLight); - buffer.addVertex(matrix, f + k, i, 0.0F).setColor(red, green, blue, alpha).setUv(this.u0, this.v1).setLight(packedLight); - buffer.addVertex(matrix, g + k, i, 0.0F).setColor(red, green, blue, alpha).setUv(this.u1, this.v1).setLight(packedLight); - buffer.addVertex(matrix, g + j, h, 0.0F).setColor(red, green, blue, alpha).setUv(this.u1, this.v0).setLight(packedLight); + public void renderChar(BakedGlyph.GlyphInstance glyphInstance, Matrix4f matrix4f, VertexConsumer vertexConsumer, int i) { + Style style = glyphInstance.style(); + boolean bl = style.isItalic(); + float f = glyphInstance.x(); + float g = glyphInstance.y(); + int j = glyphInstance.color(); + this.render(bl, f, g, matrix4f, vertexConsumer, j, i); + if (style.isBold()) { + this.render(bl, f + glyphInstance.boldOffset(), g, matrix4f, vertexConsumer, j, i); + } + } + + private void render(boolean bl, float f, float g, Matrix4f matrix4f, VertexConsumer vertexConsumer, int i, int j) { + float h = f + this.left; + float k = f + this.right; + float l = g + this.up; + float m = g + this.down; + float n = bl ? 1.0F - 0.25F * this.up : 0.0F; + float o = bl ? 1.0F - 0.25F * this.down : 0.0F; + vertexConsumer.addVertex(matrix4f, h + n, l, 0.0F).setColor(i).setUv(this.u0, this.v0).setLight(j); + vertexConsumer.addVertex(matrix4f, h + o, m, 0.0F).setColor(i).setUv(this.u0, this.v1).setLight(j); + vertexConsumer.addVertex(matrix4f, k + o, m, 0.0F).setColor(i).setUv(this.u1, this.v1).setLight(j); + vertexConsumer.addVertex(matrix4f, k + n, l, 0.0F).setColor(i).setUv(this.u1, this.v0).setLight(j); } public void renderEffect(BakedGlyph.Effect effect, Matrix4f matrix, VertexConsumer buffer, int packedLight) { - buffer.addVertex(matrix, effect.x0, effect.y0, effect.depth).setColor(effect.r, effect.g, effect.b, effect.a).setUv(this.u0, this.v0).setLight(packedLight); - buffer.addVertex(matrix, effect.x1, effect.y0, effect.depth).setColor(effect.r, effect.g, effect.b, effect.a).setUv(this.u0, this.v1).setLight(packedLight); - buffer.addVertex(matrix, effect.x1, effect.y1, effect.depth).setColor(effect.r, effect.g, effect.b, effect.a).setUv(this.u1, this.v1).setLight(packedLight); - buffer.addVertex(matrix, effect.x0, effect.y1, effect.depth).setColor(effect.r, effect.g, effect.b, effect.a).setUv(this.u1, this.v0).setLight(packedLight); + buffer.addVertex(matrix, effect.x0, effect.y0, effect.depth).setColor(effect.color).setUv(this.u0, this.v0).setLight(packedLight); + buffer.addVertex(matrix, effect.x1, effect.y0, effect.depth).setColor(effect.color).setUv(this.u0, this.v1).setLight(packedLight); + buffer.addVertex(matrix, effect.x1, effect.y1, effect.depth).setColor(effect.color).setUv(this.u1, this.v1).setLight(packedLight); + buffer.addVertex(matrix, effect.x0, effect.y1, effect.depth).setColor(effect.color).setUv(this.u1, this.v0).setLight(packedLight); } public RenderType renderType(Font.DisplayMode displayMode) { @@ -57,27 +70,10 @@ public class BakedGlyph { } @Environment(EnvType.CLIENT) - public static class Effect { - protected final float x0; - protected final float y0; - protected final float x1; - protected final float y1; - protected final float depth; - protected final float r; - protected final float g; - protected final float b; - protected final float a; + public record Effect(float x0, float y0, float x1, float y1, float depth, int color) { + } - public Effect(float x0, float y0, float x1, float y1, float depth, float r, float g, float b, float a) { - this.x0 = x0; - this.y0 = y0; - this.x1 = x1; - this.y1 = y1; - this.depth = depth; - this.r = r; - this.g = g; - this.b = b; - this.a = a; - } + @Environment(EnvType.CLIENT) + public record GlyphInstance(float x, float y, int color, BakedGlyph glyph, Style style, float boldOffset) { } } diff --git a/net/minecraft/client/gui/font/glyphs/EmptyGlyph.java b/net/minecraft/client/gui/font/glyphs/EmptyGlyph.java index d3ecf446..0ddb6f5f 100644 --- a/net/minecraft/client/gui/font/glyphs/EmptyGlyph.java +++ b/net/minecraft/client/gui/font/glyphs/EmptyGlyph.java @@ -16,6 +16,6 @@ public class EmptyGlyph extends BakedGlyph { } @Override - public void render(boolean italic, float x, float y, Matrix4f matrix, VertexConsumer buffer, float red, float green, float blue, float alpha, int packedLight) { + public void renderChar(BakedGlyph.GlyphInstance glyphInstance, Matrix4f matrix4f, VertexConsumer vertexConsumer, int i) { } } diff --git a/net/minecraft/client/gui/font/glyphs/SpecialGlyphs.java b/net/minecraft/client/gui/font/glyphs/SpecialGlyphs.java index 48cfe043..7fdf5aa4 100644 --- a/net/minecraft/client/gui/font/glyphs/SpecialGlyphs.java +++ b/net/minecraft/client/gui/font/glyphs/SpecialGlyphs.java @@ -27,7 +27,7 @@ public enum SpecialGlyphs implements GlyphInfo { for (int i = 0; i < height; i++) { for (int j = 0; j < width; j++) { - nativeImage.setPixelRGBA(j, i, pixelProvider.getColor(j, i)); + nativeImage.setPixel(j, i, pixelProvider.getColor(j, i)); } } diff --git a/net/minecraft/client/gui/font/providers/GlyphProviderType.java b/net/minecraft/client/gui/font/providers/GlyphProviderType.java index 8c0917be..ad4acc18 100644 --- a/net/minecraft/client/gui/font/providers/GlyphProviderType.java +++ b/net/minecraft/client/gui/font/providers/GlyphProviderType.java @@ -1,18 +1,18 @@ package net.minecraft.client.gui.font.providers; -import com.mojang.blaze3d.font.SpaceProvider; import com.mojang.serialization.Codec; import com.mojang.serialization.MapCodec; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; +import net.minecraft.client.gui.font.providers.BitmapProvider.Definition; import net.minecraft.util.StringRepresentable; @Environment(EnvType.CLIENT) public enum GlyphProviderType implements StringRepresentable { - BITMAP("bitmap", BitmapProvider.Definition.CODEC), + BITMAP("bitmap", Definition.CODEC), TTF("ttf", TrueTypeGlyphProviderDefinition.CODEC), - SPACE("space", SpaceProvider.Definition.CODEC), - UNIHEX("unihex", UnihexProvider.Definition.CODEC), + SPACE("space", com.mojang.blaze3d.font.SpaceProvider.Definition.CODEC), + UNIHEX("unihex", net.minecraft.client.gui.font.providers.UnihexProvider.Definition.CODEC), REFERENCE("reference", ProviderReferenceDefinition.CODEC); public static final Codec CODEC = StringRepresentable.fromEnum(GlyphProviderType::values); diff --git a/net/minecraft/client/gui/screens/BackupConfirmScreen.java b/net/minecraft/client/gui/screens/BackupConfirmScreen.java index 33a628b8..e96975cc 100644 --- a/net/minecraft/client/gui/screens/BackupConfirmScreen.java +++ b/net/minecraft/client/gui/screens/BackupConfirmScreen.java @@ -11,20 +11,30 @@ import net.minecraft.network.chat.Component; @Environment(EnvType.CLIENT) public class BackupConfirmScreen extends Screen { + private static final Component SKIP_AND_JOIN = Component.translatable("selectWorld.backupJoinSkipButton"); + public static final Component BACKUP_AND_JOIN = Component.translatable("selectWorld.backupJoinConfirmButton"); private final Runnable onCancel; protected final BackupConfirmScreen.Listener onProceed; private final Component description; private final boolean promptForCacheErase; private MultiLineLabel message = MultiLineLabel.EMPTY; + final Component confirmation; protected int id; private Checkbox eraseCache; public BackupConfirmScreen(Runnable onCancel, BackupConfirmScreen.Listener onProceed, Component title, Component description, boolean promptForCacheErase) { - super(title); - this.onCancel = onCancel; - this.onProceed = onProceed; - this.description = description; - this.promptForCacheErase = promptForCacheErase; + this(onCancel, onProceed, title, description, BACKUP_AND_JOIN, promptForCacheErase); + } + + public BackupConfirmScreen( + Runnable runnable, BackupConfirmScreen.Listener listener, Component component, Component component2, Component component3, boolean bl + ) { + super(component); + this.onCancel = runnable; + this.onProceed = listener; + this.description = component2; + this.promptForCacheErase = bl; + this.confirmation = component3; } @Override @@ -32,23 +42,22 @@ public class BackupConfirmScreen extends Screen { super.init(); this.message = MultiLineLabel.create(this.font, this.description, this.width - 50); int i = (this.message.getLineCount() + 1) * 9; + this.eraseCache = Checkbox.builder(Component.translatable("selectWorld.backupEraseCache"), this.font).pos(this.width / 2 - 155 + 80, 76 + i).build(); + if (this.promptForCacheErase) { + this.addRenderableWidget(this.eraseCache); + } + this.addRenderableWidget( - Button.builder(Component.translatable("selectWorld.backupJoinConfirmButton"), button -> this.onProceed.proceed(true, this.eraseCache.selected())) - .bounds(this.width / 2 - 155, 100 + i, 150, 20) - .build() + Button.builder(this.confirmation, button -> this.onProceed.proceed(true, this.eraseCache.selected())).bounds(this.width / 2 - 155, 100 + i, 150, 20).build() ); this.addRenderableWidget( - Button.builder(Component.translatable("selectWorld.backupJoinSkipButton"), button -> this.onProceed.proceed(false, this.eraseCache.selected())) + Button.builder(SKIP_AND_JOIN, button -> this.onProceed.proceed(false, this.eraseCache.selected())) .bounds(this.width / 2 - 155 + 160, 100 + i, 150, 20) .build() ); this.addRenderableWidget( Button.builder(CommonComponents.GUI_CANCEL, button -> this.onCancel.run()).bounds(this.width / 2 - 155 + 80, 124 + i, 150, 20).build() ); - this.eraseCache = Checkbox.builder(Component.translatable("selectWorld.backupEraseCache"), this.font).pos(this.width / 2 - 155 + 80, 76 + i).build(); - if (this.promptForCacheErase) { - this.addRenderableWidget(this.eraseCache); - } } @Override diff --git a/net/minecraft/client/gui/screens/ConnectScreen.java b/net/minecraft/client/gui/screens/ConnectScreen.java index 956d4f13..1c134006 100644 --- a/net/minecraft/client/gui/screens/ConnectScreen.java +++ b/net/minecraft/client/gui/screens/ConnectScreen.java @@ -22,7 +22,7 @@ import net.minecraft.client.multiplayer.resolver.ServerAddress; import net.minecraft.client.multiplayer.resolver.ServerNameResolver; import net.minecraft.client.quickplay.QuickPlay; import net.minecraft.client.quickplay.QuickPlayLog; -import net.minecraft.client.resources.server.ServerPackManager; +import net.minecraft.client.resources.server.ServerPackManager.PackPromptStatus; import net.minecraft.network.Connection; import net.minecraft.network.chat.CommonComponents; import net.minecraft.network.chat.Component; @@ -168,11 +168,11 @@ public class ConnectScreen extends Screen { } } - private static ServerPackManager.PackPromptStatus convertPackStatus(ServerData.ServerPackStatus packStatus) { + private static PackPromptStatus convertPackStatus(ServerData.ServerPackStatus packStatus) { return switch (packStatus) { - case ENABLED -> ServerPackManager.PackPromptStatus.ALLOWED; - case DISABLED -> ServerPackManager.PackPromptStatus.DECLINED; - case PROMPT -> ServerPackManager.PackPromptStatus.PENDING; + case ENABLED -> PackPromptStatus.ALLOWED; + case DISABLED -> PackPromptStatus.DECLINED; + case PROMPT -> PackPromptStatus.PENDING; }; } }; diff --git a/net/minecraft/client/gui/screens/CreateBuffetWorldScreen.java b/net/minecraft/client/gui/screens/CreateBuffetWorldScreen.java index 3759e143..e03e3c43 100644 --- a/net/minecraft/client/gui/screens/CreateBuffetWorldScreen.java +++ b/net/minecraft/client/gui/screens/CreateBuffetWorldScreen.java @@ -7,20 +7,18 @@ import java.util.Objects; import java.util.function.Consumer; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; -import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.Button; import net.minecraft.client.gui.components.ObjectSelectionList; import net.minecraft.client.gui.components.StringWidget; import net.minecraft.client.gui.layouts.HeaderAndFooterLayout; import net.minecraft.client.gui.layouts.LinearLayout; +import net.minecraft.client.gui.screens.CreateBuffetWorldScreen.BiomeList.Entry; import net.minecraft.client.gui.screens.worldselection.WorldCreationContext; import net.minecraft.core.Holder; import net.minecraft.core.Registry; import net.minecraft.core.registries.Registries; -import net.minecraft.locale.Language; import net.minecraft.network.chat.CommonComponents; import net.minecraft.network.chat.Component; -import net.minecraft.resources.ResourceLocation; import net.minecraft.world.level.biome.Biome; import net.minecraft.world.level.biome.Biomes; import org.jetbrains.annotations.Nullable; @@ -41,8 +39,8 @@ public class CreateBuffetWorldScreen extends Screen { super(Component.translatable("createWorld.customize.buffet.title")); this.parent = parent; this.applySettings = applySettings; - this.biomes = context.worldgenLoadContext().registryOrThrow(Registries.BIOME); - Holder holder = (Holder)this.biomes.getHolder(Biomes.PLAINS).or(() -> this.biomes.holders().findAny()).orElseThrow(); + this.biomes = context.worldgenLoadContext().lookupOrThrow(Registries.BIOME); + Holder holder = (Holder)this.biomes.get(Biomes.PLAINS).or(() -> this.biomes.listElements().findAny()).orElseThrow(); this.biome = (Holder)context.selectedDimensions().overworld().getBiomeSource().possibleBiomes().stream().findFirst().orElse(holder); } @@ -64,10 +62,7 @@ public class CreateBuffetWorldScreen extends Screen { this.onClose(); }).build()); linearLayout2.addChild(Button.builder(CommonComponents.GUI_CANCEL, button -> this.onClose()).build()); - this.list - .setSelected( - (CreateBuffetWorldScreen.BiomeList.Entry)this.list.children().stream().filter(entry -> Objects.equals(entry.biome, this.biome)).findFirst().orElse(null) - ); + this.list.setSelected((Entry)this.list.children().stream().filter(entry -> Objects.equals(entry.biome, this.biome)).findFirst().orElse(null)); this.layout.visitWidgets(this::addRenderableWidget); this.repositionElements(); } @@ -83,18 +78,18 @@ public class CreateBuffetWorldScreen extends Screen { } @Environment(EnvType.CLIENT) - class BiomeList extends ObjectSelectionList { + class BiomeList extends ObjectSelectionList { BiomeList() { super(CreateBuffetWorldScreen.this.minecraft, CreateBuffetWorldScreen.this.width, CreateBuffetWorldScreen.this.height - 77, 40, 16); Collator collator = Collator.getInstance(Locale.getDefault()); CreateBuffetWorldScreen.this.biomes - .holders() - .map(reference -> new CreateBuffetWorldScreen.BiomeList.Entry(reference)) + .listElements() + .map(reference -> new net.minecraft.client.gui.screens.CreateBuffetWorldScreen.BiomeList.Entry(this, reference)) .sorted(Comparator.comparing(entry -> entry.name.getString(), collator)) .forEach(entry -> this.addEntry(entry)); } - public void setSelected(@Nullable CreateBuffetWorldScreen.BiomeList.Entry entry) { + public void setSelected(@Nullable net.minecraft.client.gui.screens.CreateBuffetWorldScreen.BiomeList.Entry entry) { super.setSelected(entry); if (entry != null) { CreateBuffetWorldScreen.this.biome = entry.biome; @@ -102,38 +97,5 @@ public class CreateBuffetWorldScreen extends Screen { CreateBuffetWorldScreen.this.updateButtonValidity(); } - - @Environment(EnvType.CLIENT) - class Entry extends ObjectSelectionList.Entry { - final Holder.Reference biome; - final Component name; - - public Entry(final Holder.Reference biome) { - this.biome = biome; - ResourceLocation resourceLocation = biome.key().location(); - String string = resourceLocation.toLanguageKey("biome"); - if (Language.getInstance().has(string)) { - this.name = Component.translatable(string); - } else { - this.name = Component.literal(resourceLocation.toString()); - } - } - - @Override - public Component getNarration() { - return Component.translatable("narrator.select", this.name); - } - - @Override - public void render(GuiGraphics guiGraphics, int index, int top, int left, int width, int height, int mouseX, int mouseY, boolean hovering, float partialTick) { - guiGraphics.drawString(CreateBuffetWorldScreen.this.font, this.name, left + 5, top + 2, 16777215); - } - - @Override - public boolean mouseClicked(double mouseX, double mouseY, int button) { - BiomeList.this.setSelected(this); - return super.mouseClicked(mouseX, mouseY, button); - } - } } } diff --git a/net/minecraft/client/gui/screens/CreateFlatWorldScreen.java b/net/minecraft/client/gui/screens/CreateFlatWorldScreen.java index 43cad44b..cde5e71e 100644 --- a/net/minecraft/client/gui/screens/CreateFlatWorldScreen.java +++ b/net/minecraft/client/gui/screens/CreateFlatWorldScreen.java @@ -7,15 +7,11 @@ import net.fabricmc.api.Environment; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.Button; import net.minecraft.client.gui.components.ObjectSelectionList; +import net.minecraft.client.gui.screens.CreateFlatWorldScreen.DetailsList.Entry; import net.minecraft.client.gui.screens.worldselection.CreateWorldScreen; import net.minecraft.network.chat.CommonComponents; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.item.Item; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.Items; -import net.minecraft.world.level.block.Blocks; -import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.levelgen.flat.FlatLayerInfo; import net.minecraft.world.level.levelgen.flat.FlatLevelGeneratorSettings; import org.jetbrains.annotations.Nullable; @@ -72,7 +68,7 @@ public class CreateFlatWorldScreen extends Screen { int i = this.list.children().indexOf(this.list.getSelected()); int j = list.size() - i - 1; list.remove(j); - this.list.setSelected(list.isEmpty() ? null : (CreateFlatWorldScreen.DetailsList.Entry)this.list.children().get(Math.min(i, list.size() - 1))); + this.list.setSelected(list.isEmpty() ? null : (Entry)this.list.children().get(Math.min(i, list.size() - 1))); this.generator.updateLayers(); this.list.resetRows(); this.updateButtonValidity(); @@ -125,16 +121,16 @@ public class CreateFlatWorldScreen extends Screen { } @Environment(EnvType.CLIENT) - class DetailsList extends ObjectSelectionList { + class DetailsList extends ObjectSelectionList { public DetailsList() { super(CreateFlatWorldScreen.this.minecraft, CreateFlatWorldScreen.this.width, CreateFlatWorldScreen.this.height - 103, 43, 24); for (int i = 0; i < CreateFlatWorldScreen.this.generator.getLayersInfo().size(); i++) { - this.addEntry(new CreateFlatWorldScreen.DetailsList.Entry()); + this.addEntry(new net.minecraft.client.gui.screens.CreateFlatWorldScreen.DetailsList.Entry(this)); } } - public void setSelected(@Nullable CreateFlatWorldScreen.DetailsList.Entry entry) { + public void setSelected(@Nullable net.minecraft.client.gui.screens.CreateFlatWorldScreen.DetailsList.Entry entry) { super.setSelected(entry); CreateFlatWorldScreen.this.updateButtonValidity(); } @@ -144,77 +140,12 @@ public class CreateFlatWorldScreen extends Screen { this.clearEntries(); for (int j = 0; j < CreateFlatWorldScreen.this.generator.getLayersInfo().size(); j++) { - this.addEntry(new CreateFlatWorldScreen.DetailsList.Entry()); + this.addEntry(new net.minecraft.client.gui.screens.CreateFlatWorldScreen.DetailsList.Entry(this)); } - List list = this.children(); + List list = this.children(); if (i >= 0 && i < list.size()) { - this.setSelected((CreateFlatWorldScreen.DetailsList.Entry)list.get(i)); - } - } - - @Environment(EnvType.CLIENT) - class Entry extends ObjectSelectionList.Entry { - @Override - public void render(GuiGraphics guiGraphics, int index, int top, int left, int width, int height, int mouseX, int mouseY, boolean hovering, float partialTick) { - FlatLayerInfo flatLayerInfo = (FlatLayerInfo)CreateFlatWorldScreen.this.generator - .getLayersInfo() - .get(CreateFlatWorldScreen.this.generator.getLayersInfo().size() - index - 1); - BlockState blockState = flatLayerInfo.getBlockState(); - ItemStack itemStack = this.getDisplayItem(blockState); - this.blitSlot(guiGraphics, left, top, itemStack); - guiGraphics.drawString(CreateFlatWorldScreen.this.font, itemStack.getHoverName(), left + 18 + 5, top + 3, 16777215, false); - Component component; - if (index == 0) { - component = Component.translatable("createWorld.customize.flat.layer.top", flatLayerInfo.getHeight()); - } else if (index == CreateFlatWorldScreen.this.generator.getLayersInfo().size() - 1) { - component = Component.translatable("createWorld.customize.flat.layer.bottom", flatLayerInfo.getHeight()); - } else { - component = Component.translatable("createWorld.customize.flat.layer", flatLayerInfo.getHeight()); - } - - guiGraphics.drawString( - CreateFlatWorldScreen.this.font, component, left + 2 + 213 - CreateFlatWorldScreen.this.font.width(component), top + 3, 16777215, false - ); - } - - private ItemStack getDisplayItem(BlockState state) { - Item item = state.getBlock().asItem(); - if (item == Items.AIR) { - if (state.is(Blocks.WATER)) { - item = Items.WATER_BUCKET; - } else if (state.is(Blocks.LAVA)) { - item = Items.LAVA_BUCKET; - } - } - - return new ItemStack(item); - } - - @Override - public Component getNarration() { - FlatLayerInfo flatLayerInfo = (FlatLayerInfo)CreateFlatWorldScreen.this.generator - .getLayersInfo() - .get(CreateFlatWorldScreen.this.generator.getLayersInfo().size() - DetailsList.this.children().indexOf(this) - 1); - ItemStack itemStack = this.getDisplayItem(flatLayerInfo.getBlockState()); - return (Component)(!itemStack.isEmpty() ? Component.translatable("narrator.select", itemStack.getHoverName()) : CommonComponents.EMPTY); - } - - @Override - public boolean mouseClicked(double mouseX, double mouseY, int button) { - DetailsList.this.setSelected(this); - return super.mouseClicked(mouseX, mouseY, button); - } - - private void blitSlot(GuiGraphics guiGraphics, int x, int y, ItemStack stack) { - this.blitSlotBg(guiGraphics, x + 1, y + 1); - if (!stack.isEmpty()) { - guiGraphics.renderFakeItem(stack, x + 2, y + 2); - } - } - - private void blitSlotBg(GuiGraphics guiGraphics, int x, int y) { - guiGraphics.blitSprite(CreateFlatWorldScreen.SLOT_SPRITE, x, y, 0, 18, 18); + this.setSelected((net.minecraft.client.gui.screens.CreateFlatWorldScreen.DetailsList.Entry)list.get(i)); } } } diff --git a/net/minecraft/client/gui/screens/DeathScreen.java b/net/minecraft/client/gui/screens/DeathScreen.java index 6cb80ae4..8fd39a16 100644 --- a/net/minecraft/client/gui/screens/DeathScreen.java +++ b/net/minecraft/client/gui/screens/DeathScreen.java @@ -8,6 +8,7 @@ import net.fabricmc.api.Environment; import net.minecraft.ChatFormatting; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.Button; +import net.minecraft.client.renderer.RenderType; import net.minecraft.network.chat.ClickEvent; import net.minecraft.network.chat.CommonComponents; import net.minecraft.network.chat.Component; @@ -115,7 +116,12 @@ public class DeathScreen extends Screen { if (this.exitToTitleButton != null && this.minecraft.getReportingContext().hasDraftReport()) { guiGraphics.blitSprite( - DRAFT_REPORT_SPRITE, this.exitToTitleButton.getX() + this.exitToTitleButton.getWidth() - 17, this.exitToTitleButton.getY() + 3, 15, 15 + RenderType::guiTextured, + DRAFT_REPORT_SPRITE, + this.exitToTitleButton.getX() + this.exitToTitleButton.getWidth() - 17, + this.exitToTitleButton.getY() + 3, + 15, + 15 ); } } diff --git a/net/minecraft/client/gui/screens/DemoIntroScreen.java b/net/minecraft/client/gui/screens/DemoIntroScreen.java index cc92a1f5..2a564732 100644 --- a/net/minecraft/client/gui/screens/DemoIntroScreen.java +++ b/net/minecraft/client/gui/screens/DemoIntroScreen.java @@ -7,6 +7,7 @@ import net.minecraft.client.Options; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.Button; import net.minecraft.client.gui.components.MultiLineLabel; +import net.minecraft.client.renderer.RenderType; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; import net.minecraft.util.CommonLinks; @@ -14,6 +15,8 @@ import net.minecraft.util.CommonLinks; @Environment(EnvType.CLIENT) public class DemoIntroScreen extends Screen { private static final ResourceLocation DEMO_BACKGROUND_LOCATION = ResourceLocation.withDefaultNamespace("textures/gui/demo_background.png"); + private static final int BACKGROUND_TEXTURE_WIDTH = 256; + private static final int BACKGROUND_TEXTURE_HEIGHT = 256; private MultiLineLabel movementMessage = MultiLineLabel.EMPTY; private MultiLineLabel durationMessage = MultiLineLabel.EMPTY; @@ -54,7 +57,7 @@ public class DemoIntroScreen extends Screen { super.renderBackground(guiGraphics, mouseX, mouseY, partialTick); int i = (this.width - 248) / 2; int j = (this.height - 166) / 2; - guiGraphics.blit(DEMO_BACKGROUND_LOCATION, i, j, 0, 0, 248, 166); + guiGraphics.blit(RenderType::guiTextured, DEMO_BACKGROUND_LOCATION, i, j, 0.0F, 0.0F, 248, 166, 256, 256); } @Override diff --git a/net/minecraft/client/gui/screens/GenericMessageScreen.java b/net/minecraft/client/gui/screens/GenericMessageScreen.java index a6b6262d..99441c4f 100644 --- a/net/minecraft/client/gui/screens/GenericMessageScreen.java +++ b/net/minecraft/client/gui/screens/GenericMessageScreen.java @@ -43,7 +43,7 @@ public class GenericMessageScreen extends Screen { @Override public void renderBackground(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) { this.renderPanorama(guiGraphics, partialTick); - this.renderBlurredBackground(partialTick); + this.renderBlurredBackground(); this.renderMenuBackground(guiGraphics); } } diff --git a/net/minecraft/client/gui/screens/LevelLoadingScreen.java b/net/minecraft/client/gui/screens/LevelLoadingScreen.java index 1e3e62f5..8b107b00 100644 --- a/net/minecraft/client/gui/screens/LevelLoadingScreen.java +++ b/net/minecraft/client/gui/screens/LevelLoadingScreen.java @@ -11,6 +11,7 @@ import net.minecraft.client.gui.narration.NarratedElementType; import net.minecraft.client.gui.narration.NarrationElementOutput; import net.minecraft.network.chat.Component; import net.minecraft.server.level.progress.StoringChunkProgressListener; +import net.minecraft.util.ARGB; import net.minecraft.util.Mth; import net.minecraft.world.level.chunk.status.ChunkStatus; @@ -96,22 +97,20 @@ public class LevelLoadingScreen extends Screen { int q = y - o / 2; int r = m / 2 + 1; int s = -16772609; - guiGraphics.drawManaged(() -> { - if (j != 0) { - guiGraphics.fill(x - r, y - r, x - r + 1, y + r, -16772609); - guiGraphics.fill(x + r - 1, y - r, x + r, y + r, -16772609); - guiGraphics.fill(x - r, y - r, x + r, y - r + 1, -16772609); - guiGraphics.fill(x - r, y + r - 1, x + r, y + r, -16772609); - } + if (j != 0) { + guiGraphics.fill(x - r, y - r, x - r + 1, y + r, -16772609); + guiGraphics.fill(x + r - 1, y - r, x + r, y + r, -16772609); + guiGraphics.fill(x - r, y - r, x + r, y - r + 1, -16772609); + guiGraphics.fill(x - r, y + r - 1, x + r, y + r, -16772609); + } - for (int rx = 0; rx < n; rx++) { - for (int sx = 0; sx < n; sx++) { - ChunkStatus chunkStatus = progressListener.getStatus(rx, sx); - int t = p + rx * k; - int u = q + sx * k; - guiGraphics.fill(t, u, t + i, u + i, COLORS.getInt(chunkStatus) | 0xFF000000); - } + for (int t = 0; t < n; t++) { + for (int u = 0; u < n; u++) { + ChunkStatus chunkStatus = progressListener.getStatus(t, u); + int v = p + t * k; + int w = q + u * k; + guiGraphics.fill(v, w, v + i, w + i, ARGB.opaque(COLORS.getInt(chunkStatus))); } - }); + } } } diff --git a/net/minecraft/client/gui/screens/LoadingOverlay.java b/net/minecraft/client/gui/screens/LoadingOverlay.java index bc3cb3a1..b2f8f9db 100644 --- a/net/minecraft/client/gui/screens/LoadingOverlay.java +++ b/net/minecraft/client/gui/screens/LoadingOverlay.java @@ -2,7 +2,6 @@ package net.minecraft.client.gui.screens; import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.platform.NativeImage; -import com.mojang.blaze3d.systems.RenderSystem; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; @@ -23,14 +22,14 @@ import net.minecraft.server.packs.VanillaPackResources; import net.minecraft.server.packs.resources.IoSupplier; import net.minecraft.server.packs.resources.ReloadInstance; import net.minecraft.server.packs.resources.ResourceManager; -import net.minecraft.util.FastColor; +import net.minecraft.util.ARGB; import net.minecraft.util.Mth; @Environment(EnvType.CLIENT) public class LoadingOverlay extends Overlay { - static final ResourceLocation MOJANG_STUDIOS_LOGO_LOCATION = ResourceLocation.withDefaultNamespace("textures/gui/title/mojangstudios.png"); - private static final int LOGO_BACKGROUND_COLOR = FastColor.ARGB32.color(255, 239, 50, 61); - private static final int LOGO_BACKGROUND_COLOR_DARK = FastColor.ARGB32.color(255, 0, 0, 0); + public static final ResourceLocation MOJANG_STUDIOS_LOGO_LOCATION = ResourceLocation.withDefaultNamespace("textures/gui/title/mojangstudios.png"); + private static final int LOGO_BACKGROUND_COLOR = ARGB.color(255, 239, 50, 61); + private static final int LOGO_BACKGROUND_COLOR_DARK = ARGB.color(255, 0, 0, 0); private static final IntSupplier BRAND_BACKGROUND = () -> Minecraft.getInstance().options.darkMojangStudiosBackground().get() ? LOGO_BACKGROUND_COLOR_DARK : LOGO_BACKGROUND_COLOR; @@ -99,7 +98,7 @@ public class LoadingOverlay extends Overlay { float n = (k >> 8 & 0xFF) / 255.0F; float o = (k & 0xFF) / 255.0F; GlStateManager._clearColor(m, n, o, 1.0F); - GlStateManager._clear(16384, Minecraft.ON_OSX); + GlStateManager._clear(16384); h = 1.0F; } @@ -109,23 +108,14 @@ public class LoadingOverlay extends Overlay { int q = (int)(d * 0.5); double e = d * 4.0; int r = (int)(e * 0.5); - RenderSystem.disableDepthTest(); - RenderSystem.depthMask(false); - RenderSystem.enableBlend(); - RenderSystem.blendFunc(770, 1); - guiGraphics.setColor(1.0F, 1.0F, 1.0F, h); - guiGraphics.blit(MOJANG_STUDIOS_LOGO_LOCATION, k - r, p - q, r, (int)d, -0.0625F, 0.0F, 120, 60, 120, 120); - guiGraphics.blit(MOJANG_STUDIOS_LOGO_LOCATION, k, p - q, r, (int)d, 0.0625F, 60.0F, 120, 60, 120, 120); - guiGraphics.setColor(1.0F, 1.0F, 1.0F, 1.0F); - RenderSystem.defaultBlendFunc(); - RenderSystem.disableBlend(); - RenderSystem.depthMask(true); - RenderSystem.enableDepthTest(); - int s = (int)(guiGraphics.guiHeight() * 0.8325); - float t = this.reload.getActualProgress(); - this.currentProgress = Mth.clamp(this.currentProgress * 0.95F + t * 0.050000012F, 0.0F, 1.0F); + int s = ARGB.white(h); + guiGraphics.blit(resourceLocation -> RenderType.mojangLogo(), MOJANG_STUDIOS_LOGO_LOCATION, k - r, p - q, -0.0625F, 0.0F, r, (int)d, 120, 60, 120, 120, s); + guiGraphics.blit(resourceLocation -> RenderType.mojangLogo(), MOJANG_STUDIOS_LOGO_LOCATION, k, p - q, 0.0625F, 60.0F, r, (int)d, 120, 60, 120, 120, s); + int t = (int)(guiGraphics.guiHeight() * 0.8325); + float u = this.reload.getActualProgress(); + this.currentProgress = Mth.clamp(this.currentProgress * 0.95F + u * 0.050000012F, 0.0F, 1.0F); if (f < 1.0F) { - this.drawProgressBar(guiGraphics, i / 2 - r, s - 5, i / 2 + r, s + 5, 1.0F - Mth.clamp(f, 0.0F, 1.0F)); + this.drawProgressBar(guiGraphics, i / 2 - r, t - 5, i / 2 + r, t + 5, 1.0F - Mth.clamp(f, 0.0F, 1.0F)); } if (f >= 2.0F) { @@ -136,8 +126,8 @@ public class LoadingOverlay extends Overlay { try { this.reload.checkExceptions(); this.onFinish.accept(Optional.empty()); - } catch (Throwable var23) { - this.onFinish.accept(Optional.of(var23)); + } catch (Throwable var24) { + this.onFinish.accept(Optional.of(var24)); } this.fadeOutStart = Util.getMillis(); @@ -150,7 +140,7 @@ public class LoadingOverlay extends Overlay { private void drawProgressBar(GuiGraphics guiGraphics, int minX, int minY, int maxX, int maxY, float partialTick) { int i = Mth.ceil((maxX - minX - 2) * this.currentProgress); int j = Math.round(partialTick * 255.0F); - int k = FastColor.ARGB32.color(j, 255, 255, 255); + int k = ARGB.color(j, 255, 255, 255); guiGraphics.fill(minX + 2, minY + 2, minX + i, maxY - 2, k); guiGraphics.fill(minX + 1, minY, maxX - 1, minY + 1, k); guiGraphics.fill(minX + 1, maxY, maxX - 1, maxY - 1, k); diff --git a/net/minecraft/client/gui/screens/NoticeWithLinkScreen.java b/net/minecraft/client/gui/screens/NoticeWithLinkScreen.java index 1ae6b299..1b98aa62 100644 --- a/net/minecraft/client/gui/screens/NoticeWithLinkScreen.java +++ b/net/minecraft/client/gui/screens/NoticeWithLinkScreen.java @@ -10,6 +10,7 @@ import net.minecraft.client.gui.components.MultiLineTextWidget; import net.minecraft.client.gui.components.StringWidget; import net.minecraft.client.gui.layouts.FrameLayout; import net.minecraft.client.gui.layouts.GridLayout; +import net.minecraft.client.gui.layouts.GridLayout.RowHelper; import net.minecraft.network.chat.CommonComponents; import net.minecraft.network.chat.Component; import net.minecraft.util.CommonLinks; @@ -48,12 +49,12 @@ public class NoticeWithLinkScreen extends Screen { protected void init() { super.init(); this.layout.defaultCellSetting().alignHorizontallyCenter(); - GridLayout.RowHelper rowHelper = this.layout.createRowHelper(1); + RowHelper rowHelper = this.layout.createRowHelper(1); rowHelper.addChild(new StringWidget(this.title, this.font)); rowHelper.addChild(new MultiLineTextWidget(this.message, this.font).setMaxWidth(this.width - 50).setCentered(true)); int i = 120; GridLayout gridLayout = new GridLayout().columnSpacing(5); - GridLayout.RowHelper rowHelper2 = gridLayout.createRowHelper(3); + RowHelper rowHelper2 = gridLayout.createRowHelper(3); rowHelper2.addChild(Button.builder(CommonComponents.GUI_OPEN_IN_BROWSER, button -> Util.getPlatform().openUri(this.uri)).size(120, 20).build()); rowHelper2.addChild( Button.builder(CommonComponents.GUI_COPY_LINK_TO_CLIPBOARD, button -> this.minecraft.keyboardHandler.setClipboard(this.uri.toString())) diff --git a/net/minecraft/client/gui/screens/PauseScreen.java b/net/minecraft/client/gui/screens/PauseScreen.java index a348c33e..b7934027 100644 --- a/net/minecraft/client/gui/screens/PauseScreen.java +++ b/net/minecraft/client/gui/screens/PauseScreen.java @@ -12,6 +12,7 @@ import net.minecraft.client.gui.components.StringWidget; import net.minecraft.client.gui.layouts.FrameLayout; import net.minecraft.client.gui.layouts.GridLayout; import net.minecraft.client.gui.layouts.HeaderAndFooterLayout; +import net.minecraft.client.gui.layouts.GridLayout.RowHelper; import net.minecraft.client.gui.screens.achievement.StatsScreen; import net.minecraft.client.gui.screens.advancements.AdvancementsScreen; import net.minecraft.client.gui.screens.multiplayer.JoinMultiplayerScreen; @@ -19,6 +20,7 @@ import net.minecraft.client.gui.screens.multiplayer.ServerLinksScreen; import net.minecraft.client.gui.screens.options.OptionsScreen; import net.minecraft.client.gui.screens.social.SocialInteractionsScreen; import net.minecraft.client.multiplayer.ServerData; +import net.minecraft.client.renderer.RenderType; import net.minecraft.network.chat.CommonComponents; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; @@ -73,7 +75,7 @@ public class PauseScreen extends Screen { private void createPauseMenu() { GridLayout gridLayout = new GridLayout(); gridLayout.defaultCellSetting().padding(4, 4, 4, 0); - GridLayout.RowHelper rowHelper = gridLayout.createRowHelper(2); + RowHelper rowHelper = gridLayout.createRowHelper(2); rowHelper.addChild(Button.builder(RETURN_TO_GAME, button -> { this.minecraft.setScreen(null); this.minecraft.mouseHandler.grabMouse(); @@ -105,7 +107,7 @@ public class PauseScreen extends Screen { gridLayout.visitWidgets(this::addRenderableWidget); } - static void addFeedbackButtons(Screen lastScreen, GridLayout.RowHelper rowHelper) { + static void addFeedbackButtons(Screen lastScreen, RowHelper rowHelper) { rowHelper.addChild( openLinkButton(lastScreen, SEND_FEEDBACK, SharedConstants.getCurrentVersion().isStable() ? CommonLinks.RELEASE_FEEDBACK : CommonLinks.SNAPSHOT_FEEDBACK) ); @@ -143,7 +145,14 @@ public class PauseScreen extends Screen { public void render(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) { super.render(guiGraphics, mouseX, mouseY, partialTick); if (this.showPauseMenu && this.minecraft != null && this.minecraft.getReportingContext().hasDraftReport() && this.disconnectButton != null) { - guiGraphics.blitSprite(DRAFT_REPORT_SPRITE, this.disconnectButton.getX() + this.disconnectButton.getWidth() - 17, this.disconnectButton.getY() + 3, 15, 15); + guiGraphics.blitSprite( + RenderType::guiTextured, + DRAFT_REPORT_SPRITE, + this.disconnectButton.getX() + this.disconnectButton.getWidth() - 17, + this.disconnectButton.getY() + 3, + 15, + 15 + ); } } @@ -178,7 +187,7 @@ public class PauseScreen extends Screen { this.layout.addTitleHeader(TITLE, this.font); GridLayout gridLayout = this.layout.addToContents(new GridLayout()); gridLayout.defaultCellSetting().padding(4, 4, 4, 0); - GridLayout.RowHelper rowHelper = gridLayout.createRowHelper(2); + RowHelper rowHelper = gridLayout.createRowHelper(2); PauseScreen.addFeedbackButtons(this, rowHelper); this.layout.addToFooter(Button.builder(CommonComponents.GUI_BACK, button -> this.onClose()).width(200).build()); this.layout.visitWidgets(this::addRenderableWidget); diff --git a/net/minecraft/client/gui/screens/PresetFlatWorldScreen.java b/net/minecraft/client/gui/screens/PresetFlatWorldScreen.java index 3d52394e..daaed80e 100644 --- a/net/minecraft/client/gui/screens/PresetFlatWorldScreen.java +++ b/net/minecraft/client/gui/screens/PresetFlatWorldScreen.java @@ -28,8 +28,6 @@ import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.FlatLevelGeneratorPresetTags; import net.minecraft.world.flag.FeatureFlagSet; -import net.minecraft.world.item.Item; -import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.biome.Biome; import net.minecraft.world.level.biome.Biomes; import net.minecraft.world.level.block.Block; @@ -249,11 +247,11 @@ public class PresetFlatWorldScreen extends Screen { } @Environment(EnvType.CLIENT) - class PresetsList extends ObjectSelectionList { + class PresetsList extends ObjectSelectionList { public PresetsList(final RegistryAccess registryAccess, final FeatureFlagSet flags) { super(PresetFlatWorldScreen.this.minecraft, PresetFlatWorldScreen.this.width, PresetFlatWorldScreen.this.height - 117, 80, 24); - for (Holder holder : registryAccess.registryOrThrow(Registries.FLAT_LEVEL_GENERATOR_PRESET) + for (Holder holder : registryAccess.lookupOrThrow(Registries.FLAT_LEVEL_GENERATOR_PRESET) .getTagOrEmpty(FlatLevelGeneratorPresetTags.VISIBLE)) { Set set = (Set)holder.value() .settings() @@ -270,12 +268,12 @@ public class PresetFlatWorldScreen extends Screen { set ); } else { - this.addEntry(new PresetFlatWorldScreen.PresetsList.Entry(holder)); + this.addEntry(new net.minecraft.client.gui.screens.PresetFlatWorldScreen.PresetsList.Entry(this, holder)); } } } - public void setSelected(@Nullable PresetFlatWorldScreen.PresetsList.Entry entry) { + public void setSelected(@Nullable net.minecraft.client.gui.screens.PresetFlatWorldScreen.PresetsList.Entry entry) { super.setSelected(entry); PresetFlatWorldScreen.this.updateButtonValidity(entry != null); } @@ -292,52 +290,5 @@ public class PresetFlatWorldScreen extends Screen { return false; } } - - @Environment(EnvType.CLIENT) - public class Entry extends ObjectSelectionList.Entry { - private static final ResourceLocation STATS_ICON_LOCATION = ResourceLocation.withDefaultNamespace("textures/gui/container/stats_icons.png"); - private final FlatLevelGeneratorPreset preset; - private final Component name; - - public Entry(final Holder presetHolder) { - this.preset = presetHolder.value(); - this.name = (Component)presetHolder.unwrapKey() - .map(resourceKey -> Component.translatable(resourceKey.location().toLanguageKey("flat_world_preset"))) - .orElse(PresetFlatWorldScreen.UNKNOWN_PRESET); - } - - @Override - public void render(GuiGraphics guiGraphics, int index, int top, int left, int width, int height, int mouseX, int mouseY, boolean hovering, float partialTick) { - this.blitSlot(guiGraphics, left, top, this.preset.displayItem().value()); - guiGraphics.drawString(PresetFlatWorldScreen.this.font, this.name, left + 18 + 5, top + 6, 16777215, false); - } - - @Override - public boolean mouseClicked(double mouseX, double mouseY, int button) { - this.select(); - return super.mouseClicked(mouseX, mouseY, button); - } - - void select() { - PresetsList.this.setSelected(this); - PresetFlatWorldScreen.this.settings = this.preset.settings(); - PresetFlatWorldScreen.this.export.setValue(PresetFlatWorldScreen.save(PresetFlatWorldScreen.this.settings)); - PresetFlatWorldScreen.this.export.moveCursorToStart(false); - } - - private void blitSlot(GuiGraphics guiGraphics, int x, int y, Item item) { - this.blitSlotBg(guiGraphics, x + 1, y + 1); - guiGraphics.renderFakeItem(new ItemStack(item), x + 2, y + 2); - } - - private void blitSlotBg(GuiGraphics guiGraphics, int x, int y) { - guiGraphics.blitSprite(PresetFlatWorldScreen.SLOT_SPRITE, x, y, 0, 18, 18); - } - - @Override - public Component getNarration() { - return Component.translatable("narrator.select", this.name); - } - } } } diff --git a/net/minecraft/client/gui/screens/ReceivingLevelScreen.java b/net/minecraft/client/gui/screens/ReceivingLevelScreen.java index a0b79ea0..01de3711 100644 --- a/net/minecraft/client/gui/screens/ReceivingLevelScreen.java +++ b/net/minecraft/client/gui/screens/ReceivingLevelScreen.java @@ -3,6 +3,7 @@ package net.minecraft.client.gui.screens; import java.util.function.BooleanSupplier; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; +import net.minecraft.Util; import net.minecraft.client.GameNarrator; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.renderer.RenderType; @@ -25,7 +26,7 @@ public class ReceivingLevelScreen extends Screen { super(GameNarrator.NO_TITLE); this.levelReceived = levelReceived; this.reason = reason; - this.createdAt = System.currentTimeMillis(); + this.createdAt = Util.getMillis(); } @Override @@ -41,21 +42,21 @@ public class ReceivingLevelScreen extends Screen { @Override public void render(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) { super.render(guiGraphics, mouseX, mouseY, partialTick); - guiGraphics.drawCenteredString(this.font, DOWNLOADING_TERRAIN_TEXT, this.width / 2, this.height / 2 - 50, 16777215); + guiGraphics.drawCenteredString(this.font, DOWNLOADING_TERRAIN_TEXT, this.width / 2, this.height / 2 - 50, -1); } @Override public void renderBackground(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) { switch (this.reason) { case NETHER_PORTAL: - guiGraphics.blit(0, 0, -90, guiGraphics.guiWidth(), guiGraphics.guiHeight(), this.getNetherPortalSprite()); + guiGraphics.blitSprite(RenderType::guiOpaqueTexturedBackground, this.getNetherPortalSprite(), 0, 0, guiGraphics.guiWidth(), guiGraphics.guiHeight()); break; case END_PORTAL: guiGraphics.fillRenderType(RenderType.endPortal(), 0, 0, this.width, this.height, 0); break; case OTHER: this.renderPanorama(guiGraphics, partialTick); - this.renderBlurredBackground(partialTick); + this.renderBlurredBackground(); this.renderMenuBackground(guiGraphics); } } @@ -71,7 +72,7 @@ public class ReceivingLevelScreen extends Screen { @Override public void tick() { - if (this.levelReceived.getAsBoolean() || System.currentTimeMillis() > this.createdAt + 30000L) { + if (this.levelReceived.getAsBoolean() || Util.getMillis() > this.createdAt + 30000L) { this.onClose(); } } diff --git a/net/minecraft/client/gui/screens/Screen.java b/net/minecraft/client/gui/screens/Screen.java index a29a78e8..c8b8745b 100644 --- a/net/minecraft/client/gui/screens/Screen.java +++ b/net/minecraft/client/gui/screens/Screen.java @@ -3,7 +3,6 @@ package net.minecraft.client.gui.screens; import com.google.common.annotations.VisibleForTesting; import com.google.common.collect.Lists; import com.mojang.blaze3d.platform.InputConstants; -import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.logging.LogUtils; import java.io.File; import java.net.URI; @@ -18,7 +17,6 @@ import net.fabricmc.api.Environment; import net.minecraft.CrashReport; import net.minecraft.CrashReportCategory; import net.minecraft.CrashReportDetail; -import net.minecraft.ReportedException; import net.minecraft.Util; import net.minecraft.client.Minecraft; import net.minecraft.client.NarratorStatus; @@ -35,13 +33,18 @@ import net.minecraft.client.gui.narration.NarratableEntry; import net.minecraft.client.gui.narration.NarratedElementType; import net.minecraft.client.gui.narration.NarrationElementOutput; import net.minecraft.client.gui.narration.ScreenNarrationCollector; +import net.minecraft.client.gui.narration.NarratableEntry.NarrationPriority; import net.minecraft.client.gui.navigation.FocusNavigationEvent; import net.minecraft.client.gui.navigation.ScreenDirection; import net.minecraft.client.gui.navigation.ScreenRectangle; +import net.minecraft.client.gui.navigation.FocusNavigationEvent.ArrowNavigation; +import net.minecraft.client.gui.navigation.FocusNavigationEvent.InitialFocus; +import net.minecraft.client.gui.navigation.FocusNavigationEvent.TabNavigation; import net.minecraft.client.gui.screens.inventory.tooltip.ClientTooltipPositioner; import net.minecraft.client.gui.screens.inventory.tooltip.DefaultTooltipPositioner; import net.minecraft.client.renderer.CubeMap; import net.minecraft.client.renderer.PanoramaRenderer; +import net.minecraft.client.renderer.RenderType; import net.minecraft.network.chat.ClickEvent; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Style; @@ -51,7 +54,7 @@ import net.minecraft.util.FormattedCharSequence; import net.minecraft.util.StringUtil; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.TooltipFlag; +import net.minecraft.world.item.TooltipFlag.Default; import org.jetbrains.annotations.Nullable; import org.slf4j.Logger; @@ -144,7 +147,7 @@ public abstract class Screen extends AbstractContainerEventHandler implements Re }); if (focusNavigationEvent != null) { ComponentPath componentPath = super.nextFocusPath(focusNavigationEvent); - if (componentPath == null && focusNavigationEvent instanceof FocusNavigationEvent.TabNavigation) { + if (componentPath == null && focusNavigationEvent instanceof TabNavigation) { this.clearFocus(); componentPath = super.nextFocusPath(focusNavigationEvent); } @@ -158,18 +161,18 @@ public abstract class Screen extends AbstractContainerEventHandler implements Re } } - private FocusNavigationEvent.TabNavigation createTabEvent() { + private TabNavigation createTabEvent() { boolean bl = !hasShiftDown(); - return new FocusNavigationEvent.TabNavigation(bl); + return new TabNavigation(bl); } - private FocusNavigationEvent.ArrowNavigation createArrowEvent(ScreenDirection direction) { - return new FocusNavigationEvent.ArrowNavigation(direction); + private ArrowNavigation createArrowEvent(ScreenDirection direction) { + return new ArrowNavigation(direction); } protected void setInitialFocus() { if (this.minecraft.getLastInputType().isKeyboard()) { - FocusNavigationEvent.TabNavigation tabNavigation = new FocusNavigationEvent.TabNavigation(true); + TabNavigation tabNavigation = new TabNavigation(true); ComponentPath componentPath = super.nextFocusPath(tabNavigation); if (componentPath != null) { this.changeFocus(componentPath); @@ -178,7 +181,7 @@ public abstract class Screen extends AbstractContainerEventHandler implements Re } protected void setInitialFocus(GuiEventListener listener) { - ComponentPath componentPath = ComponentPath.path(this, listener.nextFocusPath(new FocusNavigationEvent.InitialFocus())); + ComponentPath componentPath = ComponentPath.path(this, listener.nextFocusPath(new InitialFocus())); if (componentPath != null) { this.changeFocus(componentPath); } @@ -241,9 +244,7 @@ public abstract class Screen extends AbstractContainerEventHandler implements Re public static List getTooltipFromItem(Minecraft minecraft, ItemStack item) { return item.getTooltipLines( - Item.TooltipContext.of(minecraft.level), - minecraft.player, - minecraft.options.advancedItemTooltips ? TooltipFlag.Default.ADVANCED : TooltipFlag.Default.NORMAL + Item.TooltipContext.of(minecraft.level), minecraft.player, minecraft.options.advancedItemTooltips ? Default.ADVANCED : Default.NORMAL ); } @@ -353,12 +354,12 @@ public abstract class Screen extends AbstractContainerEventHandler implements Re this.renderPanorama(guiGraphics, partialTick); } - this.renderBlurredBackground(partialTick); + this.renderBlurredBackground(); this.renderMenuBackground(guiGraphics); } - protected void renderBlurredBackground(float partialTick) { - this.minecraft.gameRenderer.processBlurEffect(partialTick); + protected void renderBlurredBackground() { + this.minecraft.gameRenderer.processBlurEffect(); this.minecraft.getMainRenderTarget().bindWrite(false); } @@ -378,9 +379,7 @@ public abstract class Screen extends AbstractContainerEventHandler implements Re GuiGraphics guiGraphics, ResourceLocation texture, int x, int y, float uOffset, float vOffset, int width, int height ) { int i = 32; - RenderSystem.enableBlend(); - guiGraphics.blit(texture, x, y, 0, uOffset, vOffset, width, height, 32, 32); - RenderSystem.disableBlend(); + guiGraphics.blit(RenderType::guiTextured, texture, x, y, uOffset, vOffset, width, height, 32, 32); } public void renderTransparentBackground(GuiGraphics guiGraphics) { @@ -435,15 +434,9 @@ public abstract class Screen extends AbstractContainerEventHandler implements Re this.repositionElements(); } - public static void wrapScreenError(Runnable action, String errorDesc, String screenName) { - try { - action.run(); - } catch (Throwable var6) { - CrashReport crashReport = CrashReport.forThrowable(var6, errorDesc); - CrashReportCategory crashReportCategory = crashReport.addCategory("Affected screen"); - crashReportCategory.setDetail("Screen name", (CrashReportDetail)(() -> screenName)); - throw new ReportedException(crashReport); - } + public void fillCrashDetails(CrashReport crashReport) { + CrashReportCategory crashReportCategory = crashReport.addCategory("Affected screen", 1); + crashReportCategory.setDetail("Screen name", (CrashReportDetail)(() -> this.getClass().getCanonicalName())); } protected boolean isValidCharacterForName(String text, char charTyped, int cursorPos) { @@ -544,7 +537,7 @@ public abstract class Screen extends AbstractContainerEventHandler implements Re if (list.size() > 1) { narrationElementOutput.add(NarratedElementType.POSITION, Component.translatable("narrator.position.screen", narratableSearchResult.index + 1, list.size())); - if (narratableSearchResult.priority == NarratableEntry.NarrationPriority.FOCUSED) { + if (narratableSearchResult.priority == NarrationPriority.FOCUSED) { narrationElementOutput.add(NarratedElementType.USAGE, this.getUsageNarration()); } } @@ -565,14 +558,14 @@ public abstract class Screen extends AbstractContainerEventHandler implements Re for (int j = entries.size(); i < j; i++) { NarratableEntry narratableEntry = (NarratableEntry)entries.get(i); - NarratableEntry.NarrationPriority narrationPriority = narratableEntry.narrationPriority(); + NarrationPriority narrationPriority = narratableEntry.narrationPriority(); if (narrationPriority.isTerminal()) { if (narratableEntry != target) { return new Screen.NarratableSearchResult(narratableEntry, i, narrationPriority); } narratableSearchResult2 = new Screen.NarratableSearchResult(narratableEntry, i, narrationPriority); - } else if (narrationPriority.compareTo(narratableSearchResult != null ? narratableSearchResult.priority : NarratableEntry.NarrationPriority.NONE) > 0) { + } else if (narrationPriority.compareTo(narratableSearchResult != null ? narratableSearchResult.priority : NarrationPriority.NONE) > 0) { narratableSearchResult = new Screen.NarratableSearchResult(narratableEntry, i, narrationPriority); } } @@ -612,6 +605,14 @@ public abstract class Screen extends AbstractContainerEventHandler implements Re this.setTooltipForNextRenderPass(tooltip.toCharSequence(this.minecraft), positioner, override); } + public Font getFont() { + return this.font; + } + + public boolean showsActiveEffects() { + return false; + } + @Override public ScreenRectangle getRectangle() { return new ScreenRectangle(0, 0, this.width, this.height); @@ -630,9 +631,9 @@ public abstract class Screen extends AbstractContainerEventHandler implements Re public static class NarratableSearchResult { public final NarratableEntry entry; public final int index; - public final NarratableEntry.NarrationPriority priority; + public final NarrationPriority priority; - public NarratableSearchResult(NarratableEntry entry, int index, NarratableEntry.NarrationPriority priority) { + public NarratableSearchResult(NarratableEntry entry, int index, NarrationPriority priority) { this.entry = entry; this.index = index; this.priority = priority; diff --git a/net/minecraft/client/gui/screens/ShareToLanScreen.java b/net/minecraft/client/gui/screens/ShareToLanScreen.java index 3de65dce..960928a2 100644 --- a/net/minecraft/client/gui/screens/ShareToLanScreen.java +++ b/net/minecraft/client/gui/screens/ShareToLanScreen.java @@ -20,12 +20,12 @@ import org.jetbrains.annotations.Nullable; public class ShareToLanScreen extends Screen { private static final int PORT_LOWER_BOUND = 1024; private static final int PORT_HIGHER_BOUND = 65535; - private static final Component ALLOW_COMMANDS_LABEL = Component.translatable("selectWorld.allowCommands.new"); + private static final Component ALLOW_COMMANDS_LABEL = Component.translatable("selectWorld.allowCommands"); private static final Component GAME_MODE_LABEL = Component.translatable("selectWorld.gameMode"); private static final Component INFO_TEXT = Component.translatable("lanServer.otherPlayers"); private static final Component PORT_INFO_TEXT = Component.translatable("lanServer.port"); - private static final Component PORT_UNAVAILABLE = Component.translatable("lanServer.port.unavailable.new", 1024, 65535); - private static final Component INVALID_PORT = Component.translatable("lanServer.port.invalid.new", 1024, 65535); + private static final Component PORT_UNAVAILABLE = Component.translatable("lanServer.port.unavailable", 1024, 65535); + private static final Component INVALID_PORT = Component.translatable("lanServer.port.invalid", 1024, 65535); private static final int INVALID_PORT_COLOR = 16733525; private final Screen lastScreen; private GameType gameMode = GameType.SURVIVAL; diff --git a/net/minecraft/client/gui/screens/TitleScreen.java b/net/minecraft/client/gui/screens/TitleScreen.java index e06904af..2157ee44 100644 --- a/net/minecraft/client/gui/screens/TitleScreen.java +++ b/net/minecraft/client/gui/screens/TitleScreen.java @@ -1,7 +1,6 @@ package net.minecraft.client.gui.screens; import com.mojang.authlib.minecraft.BanDetails; -import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.logging.LogUtils; import com.mojang.realmsclient.RealmsMainScreen; import com.mojang.realmsclient.gui.screens.RealmsNotificationsScreen; @@ -30,6 +29,7 @@ import net.minecraft.client.gui.screens.multiplayer.SafetyScreen; import net.minecraft.client.gui.screens.options.AccessibilityOptionsScreen; import net.minecraft.client.gui.screens.options.LanguageSelectScreen; import net.minecraft.client.gui.screens.options.OptionsScreen; +import net.minecraft.client.gui.screens.worldselection.CreateWorldScreen; import net.minecraft.client.gui.screens.worldselection.SelectWorldScreen; import net.minecraft.client.renderer.PanoramaRenderer; import net.minecraft.client.renderer.texture.TextureManager; @@ -122,29 +122,30 @@ public class TitleScreen extends Screen { int k = 24; int l = this.height / 4 + 48; if (this.minecraft.isDemo()) { - this.createDemoMenuOptions(l, 24); + l = this.createDemoMenuOptions(l, 24); } else { - this.createNormalMenuOptions(l, 24); + l = this.createNormalMenuOptions(l, 24); } + l = this.createTestWorldButton(l, 24); SpriteIconButton spriteIconButton = this.addRenderableWidget( CommonButtons.language( 20, button -> this.minecraft.setScreen(new LanguageSelectScreen(this, this.minecraft.options, this.minecraft.getLanguageManager())), true ) ); - spriteIconButton.setPosition(this.width / 2 - 124, l + 72 + 12); + int var10001 = this.width / 2 - 124; + l += 36; + spriteIconButton.setPosition(var10001, l); this.addRenderableWidget( Button.builder(Component.translatable("menu.options"), button -> this.minecraft.setScreen(new OptionsScreen(this, this.minecraft.options))) - .bounds(this.width / 2 - 100, l + 72 + 12, 98, 20) + .bounds(this.width / 2 - 100, l, 98, 20) .build() ); - this.addRenderableWidget( - Button.builder(Component.translatable("menu.quit"), button -> this.minecraft.stop()).bounds(this.width / 2 + 2, l + 72 + 12, 98, 20).build() - ); + this.addRenderableWidget(Button.builder(Component.translatable("menu.quit"), button -> this.minecraft.stop()).bounds(this.width / 2 + 2, l, 98, 20).build()); SpriteIconButton spriteIconButton2 = this.addRenderableWidget( CommonButtons.accessibility(20, button -> this.minecraft.setScreen(new AccessibilityOptionsScreen(this, this.minecraft.options)), true) ); - spriteIconButton2.setPosition(this.width / 2 + 104, l + 72 + 12); + spriteIconButton2.setPosition(this.width / 2 + 104, l); this.addRenderableWidget( new PlainTextButton(j, this.height - 10, i, 10, COPYRIGHT_TEXT, button -> this.minecraft.setScreen(new CreditsAndAttributionScreen(this)), this.font) ); @@ -157,29 +158,40 @@ public class TitleScreen extends Screen { } } - /** - * Adds Singleplayer and Multiplayer buttons on Main Menu for players who have bought the game. - */ - private void createNormalMenuOptions(int y, int rowHeight) { + private int createTestWorldButton(int i, int j) { + if (SharedConstants.IS_RUNNING_IN_IDE) { + this.addRenderableWidget( + Button.builder(Component.literal("Create Test World"), button -> CreateWorldScreen.testWorld(this.minecraft, this)) + .bounds(this.width / 2 - 100, i += j, 200, 20) + .build() + ); + } + + return i; + } + + private int createNormalMenuOptions(int i, int j) { this.addRenderableWidget( Button.builder(Component.translatable("menu.singleplayer"), button -> this.minecraft.setScreen(new SelectWorldScreen(this))) - .bounds(this.width / 2 - 100, y, 200, 20) + .bounds(this.width / 2 - 100, i, 200, 20) .build() ); Component component = this.getMultiplayerDisabledReason(); boolean bl = component == null; Tooltip tooltip = component != null ? Tooltip.create(component) : null; + int var6; this.addRenderableWidget(Button.builder(Component.translatable("menu.multiplayer"), button -> { Screen screen = (Screen)(this.minecraft.options.skipMultiplayerWarning ? new JoinMultiplayerScreen(this) : new SafetyScreen(this)); this.minecraft.setScreen(screen); - }).bounds(this.width / 2 - 100, y + rowHeight * 1, 200, 20).tooltip(tooltip).build()).active = bl; + }).bounds(this.width / 2 - 100, var6 = i + j, 200, 20).tooltip(tooltip).build()).active = bl; this.addRenderableWidget( Button.builder(Component.translatable("menu.online"), button -> this.minecraft.setScreen(new RealmsMainScreen(this))) - .bounds(this.width / 2 - 100, y + rowHeight * 2, 200, 20) + .bounds(this.width / 2 - 100, i = var6 + j, 200, 20) .tooltip(tooltip) .build() ) .active = bl; + return i; } @Nullable @@ -200,10 +212,7 @@ public class TitleScreen extends Screen { } } - /** - * Adds Demo buttons on Main Menu for players who are playing Demo. - */ - private void createDemoMenuOptions(int y, int rowHeight) { + private int createDemoMenuOptions(int i, int j) { boolean bl = this.checkDemoWorldPresence(); this.addRenderableWidget( Button.builder( @@ -218,9 +227,10 @@ public class TitleScreen extends Screen { } } ) - .bounds(this.width / 2 - 100, y, 200, 20) + .bounds(this.width / 2 - 100, i, 200, 20) .build() ); + int var4; this.resetDemoButton = this.addRenderableWidget( Button.builder( Component.translatable("menu.resetdemo"), @@ -246,10 +256,11 @@ public class TitleScreen extends Screen { } } ) - .bounds(this.width / 2 - 100, y + rowHeight * 1, 200, 20) + .bounds(this.width / 2 - 100, var4 = i + j, 200, 20) .build() ); this.resetDemoButton.active = bl; + return var4; } private boolean checkDemoWorldPresence() { @@ -310,7 +321,6 @@ public class TitleScreen extends Screen { guiGraphics.drawString(this.font, string, 2, this.height - 10, 16777215 | i); if (this.realmsNotificationsEnabled() && f >= 1.0F) { - RenderSystem.enableDepthTest(); this.realmsNotificationsScreen.render(guiGraphics, mouseX, mouseY, partialTick); } } diff --git a/net/minecraft/client/gui/screens/WinScreen.java b/net/minecraft/client/gui/screens/WinScreen.java index 4e51267b..d172e9e0 100644 --- a/net/minecraft/client/gui/screens/WinScreen.java +++ b/net/minecraft/client/gui/screens/WinScreen.java @@ -4,8 +4,6 @@ import com.google.common.collect.Lists; import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.mojang.blaze3d.platform.GlStateManager; -import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.logging.LogUtils; import it.unimi.dsi.fastutil.ints.IntOpenHashSet; import it.unimi.dsi.fastutil.ints.IntSet; @@ -32,8 +30,8 @@ import org.slf4j.Logger; @Environment(EnvType.CLIENT) public class WinScreen extends Screen { - private static final Logger LOGGER = LogUtils.getLogger(); private static final ResourceLocation VIGNETTE_LOCATION = ResourceLocation.withDefaultNamespace("textures/misc/credits_vignette.png"); + private static final Logger LOGGER = LogUtils.getLogger(); private static final Component SECTION_HEADING = Component.literal("============").withStyle(ChatFormatting.WHITE); private static final String NAME_PREFIX = " "; private static final String OBFUSCATE_TOKEN = "" + ChatFormatting.WHITE + ChatFormatting.OBFUSCATED + ChatFormatting.GREEN + ChatFormatting.AQUA; @@ -282,11 +280,7 @@ public class WinScreen extends Screen { } private void renderVignette(GuiGraphics guiGraphics) { - RenderSystem.enableBlend(); - RenderSystem.blendFunc(GlStateManager.SourceFactor.ZERO, GlStateManager.DestFactor.ONE_MINUS_SRC_COLOR); - guiGraphics.blit(VIGNETTE_LOCATION, 0, 0, 0, 0.0F, 0.0F, this.width, this.height, this.width, this.height); - RenderSystem.disableBlend(); - RenderSystem.defaultBlendFunc(); + guiGraphics.blit(RenderType::vignette, VIGNETTE_LOCATION, 0, 0, 0.0F, 0.0F, this.width, this.height, this.width, this.height); } @Override diff --git a/net/minecraft/client/gui/screens/achievement/StatsScreen.java b/net/minecraft/client/gui/screens/achievement/StatsScreen.java index 8b3eec8d..5820d452 100644 --- a/net/minecraft/client/gui/screens/achievement/StatsScreen.java +++ b/net/minecraft/client/gui/screens/achievement/StatsScreen.java @@ -17,12 +17,18 @@ import net.minecraft.client.gui.components.ObjectSelectionList; import net.minecraft.client.gui.layouts.HeaderAndFooterLayout; import net.minecraft.client.gui.layouts.LinearLayout; import net.minecraft.client.gui.screens.Screen; +import net.minecraft.client.gui.screens.achievement.StatsScreen.ItemStatisticsList.ItemRow; +import net.minecraft.client.gui.screens.achievement.StatsScreen.ItemStatisticsList.ItemRowComparator; +import net.minecraft.client.gui.screens.achievement.StatsScreen.MobsStatisticsList.MobRow; +import net.minecraft.client.renderer.RenderType; import net.minecraft.client.resources.language.I18n; import net.minecraft.client.resources.sounds.SimpleSoundInstance; +import net.minecraft.core.component.DataComponents; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.network.chat.CommonComponents; import net.minecraft.network.chat.Component; import net.minecraft.network.protocol.game.ServerboundClientCommandPacket; +import net.minecraft.network.protocol.game.ServerboundClientCommandPacket.Action; import net.minecraft.resources.ResourceLocation; import net.minecraft.sounds.SoundEvents; import net.minecraft.stats.Stat; @@ -30,7 +36,6 @@ import net.minecraft.stats.StatType; import net.minecraft.stats.Stats; import net.minecraft.stats.StatsCounter; import net.minecraft.world.entity.EntityType; -import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.Item; import net.minecraft.world.item.Items; import net.minecraft.world.level.block.Block; @@ -76,7 +81,7 @@ public class StatsScreen extends Screen { @Override protected void init() { this.layout.addToContents(new LoadingDotsWidget(this.font, PENDING_TEXT)); - this.minecraft.getConnection().send(new ServerboundClientCommandPacket(ServerboundClientCommandPacket.Action.REQUEST_STATS)); + this.minecraft.getConnection().send(new ServerboundClientCommandPacket(Action.REQUEST_STATS)); } public void initLists() { @@ -155,14 +160,14 @@ public class StatsScreen extends Screen { } @Environment(EnvType.CLIENT) - class GeneralStatisticsList extends ObjectSelectionList { + class GeneralStatisticsList extends ObjectSelectionList { public GeneralStatisticsList(final Minecraft minecraft) { super(minecraft, StatsScreen.this.width, StatsScreen.this.height - 33 - 58, 33, 14); ObjectArrayList> objectArrayList = new ObjectArrayList<>(Stats.CUSTOM.iterator()); objectArrayList.sort(Comparator.comparing(statx -> I18n.get(StatsScreen.getTranslationKey(statx)))); for (Stat stat : objectArrayList) { - this.addEntry(new StatsScreen.GeneralStatisticsList.Entry(stat)); + this.addEntry(new net.minecraft.client.gui.screens.achievement.StatsScreen.GeneralStatisticsList.Entry(this, stat)); } } @@ -170,39 +175,10 @@ public class StatsScreen extends Screen { public int getRowWidth() { return 280; } - - @Environment(EnvType.CLIENT) - class Entry extends ObjectSelectionList.Entry { - private final Stat stat; - private final Component statDisplay; - - Entry(final Stat stat) { - this.stat = stat; - this.statDisplay = Component.translatable(StatsScreen.getTranslationKey(stat)); - } - - private String getValueText() { - return this.stat.format(StatsScreen.this.stats.getValue(this.stat)); - } - - @Override - public void render(GuiGraphics guiGraphics, int index, int top, int left, int width, int height, int mouseX, int mouseY, boolean hovering, float partialTick) { - int i = top + height / 2 - 9 / 2; - int j = index % 2 == 0 ? -1 : -4539718; - guiGraphics.drawString(StatsScreen.this.font, this.statDisplay, left + 2, i, j); - String string = this.getValueText(); - guiGraphics.drawString(StatsScreen.this.font, string, left + width - StatsScreen.this.font.width(string) - 4, i, j); - } - - @Override - public Component getNarration() { - return Component.translatable("narrator.select", Component.empty().append(this.statDisplay).append(CommonComponents.SPACE).append(this.getValueText())); - } - } } @Environment(EnvType.CLIENT) - class ItemStatisticsList extends ObjectSelectionList { + class ItemStatisticsList extends ObjectSelectionList { private static final int SLOT_BG_SIZE = 18; private static final int SLOT_STAT_HEIGHT = 22; private static final int SLOT_BG_Y = 1; @@ -219,7 +195,7 @@ public class StatsScreen extends Screen { }; protected final List> blockColumns; protected final List> itemColumns; - protected final Comparator itemStatSorter = new StatsScreen.ItemStatisticsList.ItemRowComparator(); + protected final Comparator itemStatSorter = new ItemRowComparator(this); @Nullable protected StatType sortColumn; protected int headerPressed = -1; @@ -264,7 +240,7 @@ public class StatsScreen extends Screen { set.remove(Items.AIR); for (Item item : set) { - this.addEntry(new StatsScreen.ItemStatisticsList.ItemRow(item)); + this.addEntry(new ItemRow(this, item)); } } @@ -280,18 +256,18 @@ public class StatsScreen extends Screen { for (int i = 0; i < this.iconSprites.length; i++) { ResourceLocation resourceLocation = this.headerPressed == i ? StatsScreen.SLOT_SPRITE : StatsScreen.HEADER_SPRITE; - guiGraphics.blitSprite(resourceLocation, x + this.getColumnX(i) - 18, y + 1, 0, 18, 18); + guiGraphics.blitSprite(RenderType::guiTextured, resourceLocation, x + this.getColumnX(i) - 18, y + 1, 18, 18); } if (this.sortColumn != null) { int i = this.getColumnX(this.getColumnIndex(this.sortColumn)) - 36; ResourceLocation resourceLocation = this.sortOrder == 1 ? StatsScreen.SORT_UP_SPRITE : StatsScreen.SORT_DOWN_SPRITE; - guiGraphics.blitSprite(resourceLocation, x + i, y + 1, 0, 18, 18); + guiGraphics.blitSprite(RenderType::guiTextured, resourceLocation, x + i, y + 1, 18, 18); } for (int i = 0; i < this.iconSprites.length; i++) { int j = this.headerPressed == i ? 1 : 0; - guiGraphics.blitSprite(this.iconSprites[i], x + this.getColumnX(i) - 18 + j, y + 1 + j, 0, 18, 18); + guiGraphics.blitSprite(RenderType::guiTextured, this.iconSprites[i], x + this.getColumnX(i) - 18 + j, y + 1 + j, 18, 18); } } @@ -338,7 +314,7 @@ public class StatsScreen extends Screen { @Override protected void renderDecorations(GuiGraphics guiGraphics, int mouseX, int mouseY) { if (mouseY >= this.getY() && mouseY <= this.getBottom()) { - StatsScreen.ItemStatisticsList.ItemRow itemRow = this.getHovered(); + ItemRow itemRow = this.getHovered(); int i = this.getRowLeft(); if (itemRow != null) { if (mouseX < i || mouseX > i + 18) { @@ -346,7 +322,7 @@ public class StatsScreen extends Screen { } Item item = itemRow.getItem(); - guiGraphics.renderTooltip(StatsScreen.this.font, item.getDescription(), mouseX, mouseY); + guiGraphics.renderTooltip(StatsScreen.this.font, item.getName(), mouseX, mouseY, item.components().get(DataComponents.TOOLTIP_STYLE)); } else { Component component = null; int j = mouseX - i; @@ -379,87 +355,10 @@ public class StatsScreen extends Screen { this.children().sort(this.itemStatSorter); } - - @Environment(EnvType.CLIENT) - class ItemRow extends ObjectSelectionList.Entry { - private final Item item; - - ItemRow(final Item item) { - this.item = item; - } - - public Item getItem() { - return this.item; - } - - @Override - public void render(GuiGraphics guiGraphics, int index, int top, int left, int width, int height, int mouseX, int mouseY, boolean hovering, float partialTick) { - guiGraphics.blitSprite(StatsScreen.SLOT_SPRITE, left, top, 0, 18, 18); - guiGraphics.renderFakeItem(this.item.getDefaultInstance(), left + 1, top + 1); - if (StatsScreen.this.itemStatsList != null) { - for (int i = 0; i < StatsScreen.this.itemStatsList.blockColumns.size(); i++) { - Stat stat; - if (this.item instanceof BlockItem blockItem) { - stat = ((StatType)StatsScreen.this.itemStatsList.blockColumns.get(i)).get(blockItem.getBlock()); - } else { - stat = null; - } - - this.renderStat(guiGraphics, stat, left + ItemStatisticsList.this.getColumnX(i), top + height / 2 - 9 / 2, index % 2 == 0); - } - - for (int i = 0; i < StatsScreen.this.itemStatsList.itemColumns.size(); i++) { - this.renderStat( - guiGraphics, - ((StatType)StatsScreen.this.itemStatsList.itemColumns.get(i)).get(this.item), - left + ItemStatisticsList.this.getColumnX(i + StatsScreen.this.itemStatsList.blockColumns.size()), - top + height / 2 - 9 / 2, - index % 2 == 0 - ); - } - } - } - - protected void renderStat(GuiGraphics guiGraphics, @Nullable Stat stat, int x, int y, boolean evenRow) { - Component component = (Component)(stat == null ? StatsScreen.NO_VALUE_DISPLAY : Component.literal(stat.format(StatsScreen.this.stats.getValue(stat)))); - guiGraphics.drawString(StatsScreen.this.font, component, x - StatsScreen.this.font.width(component), y, evenRow ? -1 : -4539718); - } - - @Override - public Component getNarration() { - return Component.translatable("narrator.select", this.item.getDescription()); - } - } - - @Environment(EnvType.CLIENT) - class ItemRowComparator implements Comparator { - public int compare(StatsScreen.ItemStatisticsList.ItemRow row1, StatsScreen.ItemStatisticsList.ItemRow row2) { - Item item = row1.getItem(); - Item item2 = row2.getItem(); - int i; - int j; - if (ItemStatisticsList.this.sortColumn == null) { - i = 0; - j = 0; - } else if (ItemStatisticsList.this.blockColumns.contains(ItemStatisticsList.this.sortColumn)) { - StatType statType = (StatType)ItemStatisticsList.this.sortColumn; - i = item instanceof BlockItem ? StatsScreen.this.stats.getValue(statType, ((BlockItem)item).getBlock()) : -1; - j = item2 instanceof BlockItem ? StatsScreen.this.stats.getValue(statType, ((BlockItem)item2).getBlock()) : -1; - } else { - StatType statType = (StatType)ItemStatisticsList.this.sortColumn; - i = StatsScreen.this.stats.getValue(statType, item); - j = StatsScreen.this.stats.getValue(statType, item2); - } - - return i == j - ? ItemStatisticsList.this.sortOrder * Integer.compare(Item.getId(item), Item.getId(item2)) - : ItemStatisticsList.this.sortOrder * Integer.compare(i, j); - } - } } @Environment(EnvType.CLIENT) - class MobsStatisticsList extends ObjectSelectionList { + class MobsStatisticsList extends ObjectSelectionList { public MobsStatisticsList(final Minecraft minecraft) { super(minecraft, StatsScreen.this.width, StatsScreen.this.height - 33 - 58, 33, 9 * 4); @@ -467,7 +366,7 @@ public class StatsScreen extends Screen { if (StatsScreen.this.stats.getValue(Stats.ENTITY_KILLED.get(entityType)) > 0 || StatsScreen.this.stats.getValue(Stats.ENTITY_KILLED_BY.get(entityType)) > 0 ) { - this.addEntry(new StatsScreen.MobsStatisticsList.MobRow(entityType)); + this.addEntry(new MobRow(this, entityType)); } } } @@ -476,47 +375,5 @@ public class StatsScreen extends Screen { public int getRowWidth() { return 280; } - - @Environment(EnvType.CLIENT) - class MobRow extends ObjectSelectionList.Entry { - private final Component mobName; - private final Component kills; - private final Component killedBy; - private final boolean hasKills; - private final boolean wasKilledBy; - - public MobRow(final EntityType entityType) { - this.mobName = entityType.getDescription(); - int i = StatsScreen.this.stats.getValue(Stats.ENTITY_KILLED.get(entityType)); - if (i == 0) { - this.kills = Component.translatable("stat_type.minecraft.killed.none", this.mobName); - this.hasKills = false; - } else { - this.kills = Component.translatable("stat_type.minecraft.killed", i, this.mobName); - this.hasKills = true; - } - - int j = StatsScreen.this.stats.getValue(Stats.ENTITY_KILLED_BY.get(entityType)); - if (j == 0) { - this.killedBy = Component.translatable("stat_type.minecraft.killed_by.none", this.mobName); - this.wasKilledBy = false; - } else { - this.killedBy = Component.translatable("stat_type.minecraft.killed_by", this.mobName, j); - this.wasKilledBy = true; - } - } - - @Override - public void render(GuiGraphics guiGraphics, int index, int top, int left, int width, int height, int mouseX, int mouseY, boolean hovering, float partialTick) { - guiGraphics.drawString(StatsScreen.this.font, this.mobName, left + 2, top + 1, -1); - guiGraphics.drawString(StatsScreen.this.font, this.kills, left + 2 + 10, top + 1 + 9, this.hasKills ? -4539718 : -8355712); - guiGraphics.drawString(StatsScreen.this.font, this.killedBy, left + 2 + 10, top + 1 + 9 * 2, this.wasKilledBy ? -4539718 : -8355712); - } - - @Override - public Component getNarration() { - return Component.translatable("narrator.select", CommonComponents.joinForNarration(this.kills, this.killedBy)); - } - } } } diff --git a/net/minecraft/client/gui/screens/advancements/AdvancementTab.java b/net/minecraft/client/gui/screens/advancements/AdvancementTab.java index 129c7b7d..10f67c0e 100644 --- a/net/minecraft/client/gui/screens/advancements/AdvancementTab.java +++ b/net/minecraft/client/gui/screens/advancements/AdvancementTab.java @@ -10,6 +10,7 @@ import net.minecraft.advancements.AdvancementNode; import net.minecraft.advancements.DisplayInfo; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.texture.TextureManager; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; @@ -97,7 +98,7 @@ public class AdvancementTab { for (int m = -1; m <= 15; m++) { for (int n = -1; n <= 8; n++) { - guiGraphics.blit(resourceLocation, k + 16 * m, l + 16 * n, 0.0F, 0.0F, 16, 16, 16, 16); + guiGraphics.blit(RenderType::guiTextured, resourceLocation, k + 16 * m, l + 16 * n, 0.0F, 0.0F, 16, 16, 16, 16); } } diff --git a/net/minecraft/client/gui/screens/advancements/AdvancementTabType.java b/net/minecraft/client/gui/screens/advancements/AdvancementTabType.java index 50676b22..58fa92c2 100644 --- a/net/minecraft/client/gui/screens/advancements/AdvancementTabType.java +++ b/net/minecraft/client/gui/screens/advancements/AdvancementTabType.java @@ -3,6 +3,7 @@ package net.minecraft.client.gui.screens.advancements; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.renderer.RenderType; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.ItemStack; @@ -100,7 +101,7 @@ enum AdvancementTabType { resourceLocation = sprites.middle(); } - guiGraphics.blitSprite(resourceLocation, offsetX + this.getX(index), offsetY + this.getY(index), this.width, this.height); + guiGraphics.blitSprite(RenderType::guiTextured, resourceLocation, offsetX + this.getX(index), offsetY + this.getY(index), this.width, this.height); } public void drawIcon(GuiGraphics guiGraphics, int offsetX, int offsetY, int index, ItemStack stack) { diff --git a/net/minecraft/client/gui/screens/advancements/AdvancementWidget.java b/net/minecraft/client/gui/screens/advancements/AdvancementWidget.java index 3f0e5003..5622970a 100644 --- a/net/minecraft/client/gui/screens/advancements/AdvancementWidget.java +++ b/net/minecraft/client/gui/screens/advancements/AdvancementWidget.java @@ -1,7 +1,6 @@ package net.minecraft.client.gui.screens.advancements; import com.google.common.collect.Lists; -import com.mojang.blaze3d.systems.RenderSystem; import java.util.List; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; @@ -11,6 +10,7 @@ import net.minecraft.advancements.DisplayInfo; import net.minecraft.client.Minecraft; import net.minecraft.client.StringSplitter; import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.renderer.RenderType; import net.minecraft.locale.Language; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.ComponentUtils; @@ -158,7 +158,7 @@ public class AdvancementWidget { advancementWidgetType = AdvancementWidgetType.UNOBTAINED; } - guiGraphics.blitSprite(advancementWidgetType.frameSprite(this.display.getType()), x + this.x + 3, y + this.y, 26, 26); + guiGraphics.blitSprite(RenderType::guiTextured, advancementWidgetType.frameSprite(this.display.getType()), x + this.x + 3, y + this.y, 26, 26); guiGraphics.renderFakeItem(this.display.getIcon(), x + this.x + 8, y + this.y + 5); } @@ -211,7 +211,6 @@ public class AdvancementWidget { } int k = this.width - j; - RenderSystem.enableBlend(); int l = y + this.y; int m; if (bl) { @@ -223,15 +222,15 @@ public class AdvancementWidget { int n = 32 + this.description.size() * 9; if (!this.description.isEmpty()) { if (bl2) { - guiGraphics.blitSprite(TITLE_BOX_SPRITE, m, l + 26 - n, this.width, n); + guiGraphics.blitSprite(RenderType::guiTextured, TITLE_BOX_SPRITE, m, l + 26 - n, this.width, n); } else { - guiGraphics.blitSprite(TITLE_BOX_SPRITE, m, l, this.width, n); + guiGraphics.blitSprite(RenderType::guiTextured, TITLE_BOX_SPRITE, m, l, this.width, n); } } - guiGraphics.blitSprite(advancementWidgetType.boxSprite(), 200, 26, 0, 0, m, l, j, 26); - guiGraphics.blitSprite(advancementWidgetType2.boxSprite(), 200, 26, 200 - k, 0, m + j, l, k, 26); - guiGraphics.blitSprite(advancementWidgetType3.frameSprite(this.display.getType()), x + this.x + 3, y + this.y, 26, 26); + guiGraphics.blitSprite(RenderType::guiTextured, advancementWidgetType.boxSprite(), 200, 26, 0, 0, m, l, j, 26); + guiGraphics.blitSprite(RenderType::guiTextured, advancementWidgetType2.boxSprite(), 200, 26, 200 - k, 0, m + j, l, k, 26); + guiGraphics.blitSprite(RenderType::guiTextured, advancementWidgetType3.frameSprite(this.display.getType()), x + this.x + 3, y + this.y, 26, 26); if (bl) { guiGraphics.drawString(this.minecraft.font, this.title, m + 5, y + this.y + 9, -1); if (component != null) { diff --git a/net/minecraft/client/gui/screens/advancements/AdvancementsScreen.java b/net/minecraft/client/gui/screens/advancements/AdvancementsScreen.java index 21207e4b..debfbae4 100644 --- a/net/minecraft/client/gui/screens/advancements/AdvancementsScreen.java +++ b/net/minecraft/client/gui/screens/advancements/AdvancementsScreen.java @@ -1,7 +1,6 @@ package net.minecraft.client.gui.screens.advancements; import com.google.common.collect.Maps; -import com.mojang.blaze3d.systems.RenderSystem; import java.util.Map; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; @@ -15,6 +14,7 @@ import net.minecraft.client.gui.layouts.HeaderAndFooterLayout; import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.multiplayer.ClientAdvancements; import net.minecraft.client.multiplayer.ClientPacketListener; +import net.minecraft.client.renderer.RenderType; import net.minecraft.network.chat.CommonComponents; import net.minecraft.network.chat.Component; import net.minecraft.network.protocol.game.ServerboundSeenAdvancementsPacket; @@ -32,6 +32,8 @@ public class AdvancementsScreen extends Screen implements ClientAdvancements.Lis public static final int WINDOW_INSIDE_HEIGHT = 113; private static final int WINDOW_TITLE_X = 8; private static final int WINDOW_TITLE_Y = 6; + private static final int BACKGROUND_TEXTURE_WIDTH = 256; + private static final int BACKGROUND_TEXTURE_HEIGHT = 256; public static final int BACKGROUND_TILE_WIDTH = 16; public static final int BACKGROUND_TILE_HEIGHT = 16; public static final int BACKGROUND_TILE_COUNT_X = 14; @@ -175,8 +177,7 @@ public class AdvancementsScreen extends Screen implements ClientAdvancements.Lis } public void renderWindow(GuiGraphics guiGraphics, int offsetX, int offsetY) { - RenderSystem.enableBlend(); - guiGraphics.blit(WINDOW_LOCATION, offsetX, offsetY, 0, 0, 252, 140); + guiGraphics.blit(RenderType::guiTextured, WINDOW_LOCATION, offsetX, offsetY, 0.0F, 0.0F, 252, 140, 256, 256); if (this.tabs.size() > 1) { for (AdvancementTab advancementTab : this.tabs.values()) { advancementTab.drawTab(guiGraphics, offsetX, offsetY, advancementTab == this.selectedTab); @@ -194,9 +195,7 @@ public class AdvancementsScreen extends Screen implements ClientAdvancements.Lis if (this.selectedTab != null) { guiGraphics.pose().pushPose(); guiGraphics.pose().translate((float)(offsetX + 9), (float)(offsetY + 18), 400.0F); - RenderSystem.enableDepthTest(); this.selectedTab.drawTooltips(guiGraphics, mouseX - offsetX - 9, mouseY - offsetY - 18, offsetX, offsetY); - RenderSystem.disableDepthTest(); guiGraphics.pose().popPose(); } diff --git a/net/minecraft/client/gui/screens/debug/GameModeSwitcherScreen.java b/net/minecraft/client/gui/screens/debug/GameModeSwitcherScreen.java index 5230b399..5cf46157 100644 --- a/net/minecraft/client/gui/screens/debug/GameModeSwitcherScreen.java +++ b/net/minecraft/client/gui/screens/debug/GameModeSwitcherScreen.java @@ -2,7 +2,6 @@ package net.minecraft.client.gui.screens.debug; import com.google.common.collect.Lists; import com.mojang.blaze3d.platform.InputConstants; -import com.mojang.blaze3d.systems.RenderSystem; import java.util.List; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; @@ -14,6 +13,7 @@ import net.minecraft.client.gui.components.AbstractWidget; import net.minecraft.client.gui.narration.NarrationElementOutput; import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.multiplayer.MultiPlayerGameMode; +import net.minecraft.client.renderer.RenderType; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.ItemStack; @@ -74,10 +74,9 @@ public class GameModeSwitcherScreen extends Screen { public void render(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) { if (!this.checkToClose()) { guiGraphics.pose().pushPose(); - RenderSystem.enableBlend(); int i = this.width / 2 - 62; int j = this.height / 2 - 31 - 27; - guiGraphics.blit(GAMEMODE_SWITCHER_LOCATION, i, j, 0.0F, 0.0F, 125, 75, 128, 128); + guiGraphics.blit(RenderType::guiTextured, GAMEMODE_SWITCHER_LOCATION, i, j, 0.0F, 0.0F, 125, 75, 128, 128); guiGraphics.pose().popPose(); super.render(guiGraphics, mouseX, mouseY, partialTick); guiGraphics.drawCenteredString(this.font, this.currentlyHovered.getName(), this.width / 2, this.height / 2 - 31 - 20, -1); @@ -228,11 +227,11 @@ public class GameModeSwitcherScreen extends Screen { } private void drawSlot(GuiGraphics guiGraphics) { - guiGraphics.blitSprite(GameModeSwitcherScreen.SLOT_SPRITE, this.getX(), this.getY(), 26, 26); + guiGraphics.blitSprite(RenderType::guiTextured, GameModeSwitcherScreen.SLOT_SPRITE, this.getX(), this.getY(), 26, 26); } private void drawSelection(GuiGraphics guiGraphics) { - guiGraphics.blitSprite(GameModeSwitcherScreen.SELECTION_SPRITE, this.getX(), this.getY(), 26, 26); + guiGraphics.blitSprite(RenderType::guiTextured, GameModeSwitcherScreen.SELECTION_SPRITE, this.getX(), this.getY(), 26, 26); } } } diff --git a/net/minecraft/client/gui/screens/inventory/AbstractContainerScreen.java b/net/minecraft/client/gui/screens/inventory/AbstractContainerScreen.java index 4d202316..b2e52353 100644 --- a/net/minecraft/client/gui/screens/inventory/AbstractContainerScreen.java +++ b/net/minecraft/client/gui/screens/inventory/AbstractContainerScreen.java @@ -2,8 +2,8 @@ package net.minecraft.client.gui.screens.inventory; import com.google.common.collect.Sets; import com.mojang.blaze3d.platform.InputConstants; -import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.datafixers.util.Pair; +import java.util.ArrayList; import java.util.List; import java.util.Set; import net.fabricmc.api.EnvType; @@ -11,10 +11,14 @@ import net.fabricmc.api.Environment; import net.minecraft.ChatFormatting; import net.minecraft.Util; import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.BundleMouseActions; import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.ItemSlotMouseAction; import net.minecraft.client.gui.screens.Screen; +import net.minecraft.client.gui.screens.inventory.tooltip.ClientTooltipComponent; import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.core.component.DataComponents; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; import net.minecraft.util.Mth; @@ -31,6 +35,10 @@ public abstract class AbstractContainerScreen e * The location of the inventory background texture */ public static final ResourceLocation INVENTORY_LOCATION = ResourceLocation.withDefaultNamespace("textures/gui/container/inventory.png"); + private static final ResourceLocation SLOT_HIGHLIGHT_BACK_SPRITE = ResourceLocation.withDefaultNamespace("container/slot_highlight_back"); + private static final ResourceLocation SLOT_HIGHLIGHT_FRONT_SPRITE = ResourceLocation.withDefaultNamespace("container/slot_highlight_front"); + protected static final int BACKGROUND_TEXTURE_WIDTH = 256; + protected static final int BACKGROUND_TEXTURE_HEIGHT = 256; private static final float SNAPBACK_SPEED = 100.0F; private static final int QUICKDROP_DELAY = 500; public static final int SLOT_ITEM_BLIT_OFFSET = 100; @@ -47,6 +55,7 @@ public abstract class AbstractContainerScreen e protected int titleLabelY; protected int inventoryLabelX; protected int inventoryLabelY; + private final List itemSlotMouseActions; /** * A list of the players inventory slots */ @@ -112,12 +121,19 @@ public abstract class AbstractContainerScreen e this.titleLabelY = 6; this.inventoryLabelX = 8; this.inventoryLabelY = this.imageHeight - 94; + this.itemSlotMouseActions = new ArrayList(); } @Override protected void init() { this.leftPos = (this.width - this.imageWidth) / 2; this.topPos = (this.height - this.imageHeight) / 2; + this.itemSlotMouseActions.clear(); + this.addItemSlotMouseAction(new BundleMouseActions(this.minecraft)); + } + + protected void addItemSlotMouseAction(ItemSlotMouseAction itemSlotMouseAction) { + this.itemSlotMouseActions.add(itemSlotMouseAction); } @Override @@ -125,31 +141,21 @@ public abstract class AbstractContainerScreen e int i = this.leftPos; int j = this.topPos; super.render(guiGraphics, mouseX, mouseY, partialTick); - RenderSystem.disableDepthTest(); guiGraphics.pose().pushPose(); guiGraphics.pose().translate((float)i, (float)j, 0.0F); - this.hoveredSlot = null; - - for (int k = 0; k < this.menu.slots.size(); k++) { - Slot slot = this.menu.slots.get(k); - if (slot.isActive()) { - this.renderSlot(guiGraphics, slot); - } - - if (this.isHovering(slot, mouseX, mouseY) && slot.isActive()) { - this.hoveredSlot = slot; - int l = slot.x; - int m = slot.y; - if (this.hoveredSlot.isHighlightable()) { - renderSlotHighlight(guiGraphics, l, m, 0); - } - } + Slot slot = this.hoveredSlot; + this.hoveredSlot = this.getHoveredSlot(mouseX, mouseY); + this.renderSlotHighlightBack(guiGraphics); + this.renderSlots(guiGraphics); + this.renderSlotHighlightFront(guiGraphics); + if (slot != null && slot != this.hoveredSlot) { + this.onStopHovering(slot); } this.renderLabels(guiGraphics, mouseX, mouseY); ItemStack itemStack = this.draggingItem.isEmpty() ? this.menu.getCarried() : this.draggingItem; if (!itemStack.isEmpty()) { - int n = 8; + int k = 8; int l = this.draggingItem.isEmpty() ? 8 : 16; String string = null; if (!this.draggingItem.isEmpty() && this.isSplittingStack) { @@ -173,13 +179,20 @@ public abstract class AbstractContainerScreen e int l = this.snapbackEnd.x - this.snapbackStartX; int m = this.snapbackEnd.y - this.snapbackStartY; - int o = this.snapbackStartX + (int)(l * f); - int p = this.snapbackStartY + (int)(m * f); - this.renderFloatingItem(guiGraphics, this.snapbackItem, o, p, null); + int n = this.snapbackStartX + (int)(l * f); + int o = this.snapbackStartY + (int)(m * f); + this.renderFloatingItem(guiGraphics, this.snapbackItem, n, o, null); } guiGraphics.pose().popPose(); - RenderSystem.enableDepthTest(); + } + + protected void renderSlots(GuiGraphics guiGraphics) { + for (Slot slot : this.menu.slots) { + if (slot.isActive()) { + this.renderSlot(guiGraphics, slot); + } + } } @Override @@ -188,22 +201,52 @@ public abstract class AbstractContainerScreen e this.renderBg(guiGraphics, partialTick, mouseX, mouseY); } - public static void renderSlotHighlight(GuiGraphics guiGraphics, int x, int y, int blitOffset) { - guiGraphics.fillGradient(RenderType.guiOverlay(), x, y, x + 16, y + 16, -2130706433, -2130706433, blitOffset); + @Override + public boolean mouseScrolled(double mouseX, double mouseY, double scrollX, double scrollY) { + if (this.hoveredSlot != null && this.hoveredSlot.hasItem()) { + for (ItemSlotMouseAction itemSlotMouseAction : this.itemSlotMouseActions) { + if (itemSlotMouseAction.matches(this.hoveredSlot) + && itemSlotMouseAction.onMouseScrolled(scrollX, scrollY, this.hoveredSlot.index, this.hoveredSlot.getItem())) { + return true; + } + } + } + + return false; + } + + private void renderSlotHighlightBack(GuiGraphics guiGraphics) { + if (this.hoveredSlot != null && this.hoveredSlot.isHighlightable()) { + guiGraphics.blitSprite(RenderType::guiTextured, SLOT_HIGHLIGHT_BACK_SPRITE, this.hoveredSlot.x - 4, this.hoveredSlot.y - 4, 24, 24); + } + } + + private void renderSlotHighlightFront(GuiGraphics guiGraphics) { + if (this.hoveredSlot != null && this.hoveredSlot.isHighlightable()) { + guiGraphics.blitSprite(RenderType::guiTexturedOverlay, SLOT_HIGHLIGHT_FRONT_SPRITE, this.hoveredSlot.x - 4, this.hoveredSlot.y - 4, 24, 24); + } } protected void renderTooltip(GuiGraphics guiGraphics, int x, int y) { - if (this.menu.getCarried().isEmpty() && this.hoveredSlot != null && this.hoveredSlot.hasItem()) { + if (this.hoveredSlot != null && this.hoveredSlot.hasItem()) { ItemStack itemStack = this.hoveredSlot.getItem(); - guiGraphics.renderTooltip(this.font, this.getTooltipFromContainerItem(itemStack), itemStack.getTooltipImage(), x, y); + if (this.menu.getCarried().isEmpty() || this.showTooltipWithItemInHand(itemStack)) { + guiGraphics.renderTooltip( + this.font, this.getTooltipFromContainerItem(itemStack), itemStack.getTooltipImage(), x, y, itemStack.get(DataComponents.TOOLTIP_STYLE) + ); + } } } + private boolean showTooltipWithItemInHand(ItemStack itemStack) { + return (Boolean)itemStack.getTooltipImage().map(ClientTooltipComponent::create).map(ClientTooltipComponent::showTooltipWithItemInHand).orElse(false); + } + protected List getTooltipFromContainerItem(ItemStack stack) { return getTooltipFromItem(this.minecraft, stack); } - private void renderFloatingItem(GuiGraphics guiGraphics, ItemStack stack, int x, int y, String text) { + private void renderFloatingItem(GuiGraphics guiGraphics, ItemStack stack, int x, int y, @Nullable String text) { guiGraphics.pose().pushPose(); guiGraphics.pose().translate(0.0F, 0.0F, 232.0F); guiGraphics.renderItem(stack, x, y); @@ -256,7 +299,7 @@ public abstract class AbstractContainerScreen e Pair pair = slot.getNoItemIcon(); if (pair != null) { TextureAtlasSprite textureAtlasSprite = (TextureAtlasSprite)this.minecraft.getTextureAtlas(pair.getFirst()).apply(pair.getSecond()); - guiGraphics.blit(i, j, 0, 16, 16, textureAtlasSprite); + guiGraphics.blitSprite(RenderType::guiTextured, textureAtlasSprite, i, j, 16, 16); bl2 = true; } } @@ -299,10 +342,9 @@ public abstract class AbstractContainerScreen e } @Nullable - private Slot findSlot(double mouseX, double mouseY) { - for (int i = 0; i < this.menu.slots.size(); i++) { - Slot slot = this.menu.slots.get(i); - if (this.isHovering(slot, mouseX, mouseY) && slot.isActive()) { + private Slot getHoveredSlot(double d, double e) { + for (Slot slot : this.menu.slots) { + if (slot.isActive() && this.isHovering(slot, d, e)) { return slot; } } @@ -316,7 +358,7 @@ public abstract class AbstractContainerScreen e return true; } else { boolean bl = this.minecraft.options.keyPickItem.matchesMouse(button) && this.minecraft.gameMode.hasInfiniteItems(); - Slot slot = this.findSlot(mouseX, mouseY); + Slot slot = this.getHoveredSlot(mouseX, mouseY); long l = Util.getMillis(); this.doubleclick = this.lastClickSlot == slot && l - this.lastClickTime < 250L && this.lastClickButton == button; this.skipNextRelease = false; @@ -415,7 +457,7 @@ public abstract class AbstractContainerScreen e @Override public boolean mouseDragged(double mouseX, double mouseY, int button, double dragX, double dragY) { - Slot slot = this.findSlot(mouseX, mouseY); + Slot slot = this.getHoveredSlot(mouseX, mouseY); ItemStack itemStack = this.menu.getCarried(); if (this.clickedSlot != null && this.minecraft.options.touchscreen().get()) { if (button == 0 || button == 1) { @@ -455,7 +497,7 @@ public abstract class AbstractContainerScreen e @Override public boolean mouseReleased(double mouseX, double mouseY, int button) { - Slot slot = this.findSlot(mouseX, mouseY); + Slot slot = this.getHoveredSlot(mouseX, mouseY); int i = this.leftPos; int j = this.topPos; boolean bl = this.hasClickedOutside(mouseX, mouseY, i, j, button); @@ -581,6 +623,16 @@ public abstract class AbstractContainerScreen e return mouseX >= x - 1 && mouseX < x + width + 1 && mouseY >= y - 1 && mouseY < y + height + 1; } + private void onStopHovering(Slot slot) { + if (slot.hasItem()) { + for (ItemSlotMouseAction itemSlotMouseAction : this.itemSlotMouseActions) { + if (itemSlotMouseAction.matches(slot)) { + itemSlotMouseAction.onStopHovering(slot); + } + } + } + } + /** * Called when the mouse is clicked over a slot or outside the gui. */ @@ -589,9 +641,20 @@ public abstract class AbstractContainerScreen e slotId = slot.index; } + this.onMouseClickAction(slot, type); this.minecraft.gameMode.handleInventoryMouseClick(this.menu.containerId, slotId, mouseButton, type, this.minecraft.player); } + void onMouseClickAction(@Nullable Slot slot, ClickType clickType) { + if (slot != null && slot.hasItem()) { + for (ItemSlotMouseAction itemSlotMouseAction : this.itemSlotMouseActions) { + if (itemSlotMouseAction.matches(slot)) { + itemSlotMouseAction.onSlotClicked(slot, clickType); + } + } + } + } + protected void handleSlotStateChanged(int slotId, int containerId, boolean newState) { this.minecraft.gameMode.handleSlotStateChanged(slotId, containerId, newState); } @@ -668,6 +731,10 @@ public abstract class AbstractContainerScreen e @Override public void onClose() { this.minecraft.player.closeContainer(); + if (this.hoveredSlot != null) { + this.onStopHovering(this.hoveredSlot); + } + super.onClose(); } } diff --git a/net/minecraft/client/gui/screens/inventory/AbstractFurnaceScreen.java b/net/minecraft/client/gui/screens/inventory/AbstractFurnaceScreen.java index d4aa970b..7721f922 100644 --- a/net/minecraft/client/gui/screens/inventory/AbstractFurnaceScreen.java +++ b/net/minecraft/client/gui/screens/inventory/AbstractFurnaceScreen.java @@ -1,133 +1,65 @@ package net.minecraft.client.gui.screens.inventory; +import java.util.List; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.gui.GuiGraphics; -import net.minecraft.client.gui.components.ImageButton; -import net.minecraft.client.gui.screens.recipebook.AbstractFurnaceRecipeBookComponent; +import net.minecraft.client.gui.navigation.ScreenPosition; +import net.minecraft.client.gui.screens.recipebook.FurnaceRecipeBookComponent; import net.minecraft.client.gui.screens.recipebook.RecipeBookComponent; -import net.minecraft.client.gui.screens.recipebook.RecipeUpdateListener; +import net.minecraft.client.renderer.RenderType; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; import net.minecraft.util.Mth; import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.inventory.AbstractFurnaceMenu; -import net.minecraft.world.inventory.ClickType; -import net.minecraft.world.inventory.Slot; @Environment(EnvType.CLIENT) -public abstract class AbstractFurnaceScreen extends AbstractContainerScreen implements RecipeUpdateListener { - public final AbstractFurnaceRecipeBookComponent recipeBookComponent; - private boolean widthTooNarrow; +public abstract class AbstractFurnaceScreen extends AbstractRecipeBookScreen { private final ResourceLocation texture; private final ResourceLocation litProgressSprite; private final ResourceLocation burnProgressSprite; public AbstractFurnaceScreen( - T menu, - AbstractFurnaceRecipeBookComponent recipeBookComponent, - Inventory playerInventory, - Component title, - ResourceLocation texture, - ResourceLocation listProgressSprite, - ResourceLocation burnProgressSprite + T abstractFurnaceMenu, + Inventory inventory, + Component component, + Component component2, + ResourceLocation resourceLocation, + ResourceLocation resourceLocation2, + ResourceLocation resourceLocation3, + List list ) { - super(menu, playerInventory, title); - this.recipeBookComponent = recipeBookComponent; - this.texture = texture; - this.litProgressSprite = listProgressSprite; - this.burnProgressSprite = burnProgressSprite; + super(abstractFurnaceMenu, new FurnaceRecipeBookComponent(abstractFurnaceMenu, component2, list), inventory, component); + this.texture = resourceLocation; + this.litProgressSprite = resourceLocation2; + this.burnProgressSprite = resourceLocation3; } @Override public void init() { super.init(); - this.widthTooNarrow = this.width < 379; - this.recipeBookComponent.init(this.width, this.height, this.minecraft, this.widthTooNarrow, this.menu); - this.leftPos = this.recipeBookComponent.updateScreenPosition(this.width, this.imageWidth); - this.addRenderableWidget(new ImageButton(this.leftPos + 20, this.height / 2 - 49, 20, 18, RecipeBookComponent.RECIPE_BUTTON_SPRITES, button -> { - this.recipeBookComponent.toggleVisibility(); - this.leftPos = this.recipeBookComponent.updateScreenPosition(this.width, this.imageWidth); - button.setPosition(this.leftPos + 20, this.height / 2 - 49); - })); this.titleLabelX = (this.imageWidth - this.font.width(this.title)) / 2; } @Override - public void containerTick() { - super.containerTick(); - this.recipeBookComponent.tick(); - } - - @Override - public void render(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) { - if (this.recipeBookComponent.isVisible() && this.widthTooNarrow) { - this.renderBackground(guiGraphics, mouseX, mouseY, partialTick); - this.recipeBookComponent.render(guiGraphics, mouseX, mouseY, partialTick); - } else { - super.render(guiGraphics, mouseX, mouseY, partialTick); - this.recipeBookComponent.render(guiGraphics, mouseX, mouseY, partialTick); - this.recipeBookComponent.renderGhostRecipe(guiGraphics, this.leftPos, this.topPos, true, partialTick); - } - - this.renderTooltip(guiGraphics, mouseX, mouseY); - this.recipeBookComponent.renderTooltip(guiGraphics, this.leftPos, this.topPos, mouseX, mouseY); + protected ScreenPosition getRecipeBookButtonPosition() { + return new ScreenPosition(this.leftPos + 20, this.height / 2 - 49); } @Override protected void renderBg(GuiGraphics guiGraphics, float partialTick, int mouseX, int mouseY) { int i = this.leftPos; int j = this.topPos; - guiGraphics.blit(this.texture, i, j, 0, 0, this.imageWidth, this.imageHeight); + guiGraphics.blit(RenderType::guiTextured, this.texture, i, j, 0.0F, 0.0F, this.imageWidth, this.imageHeight, 256, 256); if (this.menu.isLit()) { int k = 14; int l = Mth.ceil(this.menu.getLitProgress() * 13.0F) + 1; - guiGraphics.blitSprite(this.litProgressSprite, 14, 14, 0, 14 - l, i + 56, j + 36 + 14 - l, 14, l); + guiGraphics.blitSprite(RenderType::guiTextured, this.litProgressSprite, 14, 14, 0, 14 - l, i + 56, j + 36 + 14 - l, 14, l); } int k = 24; int l = Mth.ceil(this.menu.getBurnProgress() * 24.0F); - guiGraphics.blitSprite(this.burnProgressSprite, 24, 16, 0, 0, i + 79, j + 34, l, 16); - } - - @Override - public boolean mouseClicked(double mouseX, double mouseY, int button) { - if (this.recipeBookComponent.mouseClicked(mouseX, mouseY, button)) { - return true; - } else { - return this.widthTooNarrow && this.recipeBookComponent.isVisible() ? true : super.mouseClicked(mouseX, mouseY, button); - } - } - - @Override - protected void slotClicked(Slot slot, int slotId, int mouseButton, ClickType type) { - super.slotClicked(slot, slotId, mouseButton, type); - this.recipeBookComponent.slotClicked(slot); - } - - @Override - public boolean keyPressed(int keyCode, int scanCode, int modifiers) { - return this.recipeBookComponent.keyPressed(keyCode, scanCode, modifiers) ? true : super.keyPressed(keyCode, scanCode, modifiers); - } - - @Override - protected boolean hasClickedOutside(double mouseX, double mouseY, int guiLeft, int guiTop, int mouseButton) { - boolean bl = mouseX < guiLeft || mouseY < guiTop || mouseX >= guiLeft + this.imageWidth || mouseY >= guiTop + this.imageHeight; - return this.recipeBookComponent.hasClickedOutside(mouseX, mouseY, this.leftPos, this.topPos, this.imageWidth, this.imageHeight, mouseButton) && bl; - } - - @Override - public boolean charTyped(char codePoint, int modifiers) { - return this.recipeBookComponent.charTyped(codePoint, modifiers) ? true : super.charTyped(codePoint, modifiers); - } - - @Override - public void recipesUpdated() { - this.recipeBookComponent.recipesUpdated(); - } - - @Override - public RecipeBookComponent getRecipeBookComponent() { - return this.recipeBookComponent; + guiGraphics.blitSprite(RenderType::guiTextured, this.burnProgressSprite, 24, 16, 0, 0, i + 79, j + 34, l, 16); } } diff --git a/net/minecraft/client/gui/screens/inventory/AbstractRecipeBookScreen.java b/net/minecraft/client/gui/screens/inventory/AbstractRecipeBookScreen.java new file mode 100644 index 00000000..cd6ea562 --- /dev/null +++ b/net/minecraft/client/gui/screens/inventory/AbstractRecipeBookScreen.java @@ -0,0 +1,128 @@ +package net.minecraft.client.gui.screens.inventory; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.components.ImageButton; +import net.minecraft.client.gui.navigation.ScreenPosition; +import net.minecraft.client.gui.screens.recipebook.RecipeBookComponent; +import net.minecraft.client.gui.screens.recipebook.RecipeUpdateListener; +import net.minecraft.network.chat.Component; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.inventory.ClickType; +import net.minecraft.world.inventory.RecipeBookMenu; +import net.minecraft.world.inventory.Slot; +import net.minecraft.world.item.crafting.display.RecipeDisplay; + +@Environment(EnvType.CLIENT) +public abstract class AbstractRecipeBookScreen extends AbstractContainerScreen implements RecipeUpdateListener { + private final RecipeBookComponent recipeBookComponent; + private boolean widthTooNarrow; + + public AbstractRecipeBookScreen(T recipeBookMenu, RecipeBookComponent recipeBookComponent, Inventory inventory, Component component) { + super(recipeBookMenu, inventory, component); + this.recipeBookComponent = recipeBookComponent; + } + + @Override + protected void init() { + super.init(); + this.widthTooNarrow = this.width < 379; + this.recipeBookComponent.init(this.width, this.height, this.minecraft, this.widthTooNarrow); + this.leftPos = this.recipeBookComponent.updateScreenPosition(this.width, this.imageWidth); + this.initButton(); + } + + protected abstract ScreenPosition getRecipeBookButtonPosition(); + + private void initButton() { + ScreenPosition screenPosition = this.getRecipeBookButtonPosition(); + this.addRenderableWidget(new ImageButton(screenPosition.x(), screenPosition.y(), 20, 18, RecipeBookComponent.RECIPE_BUTTON_SPRITES, button -> { + this.recipeBookComponent.toggleVisibility(); + this.leftPos = this.recipeBookComponent.updateScreenPosition(this.width, this.imageWidth); + ScreenPosition screenPositionx = this.getRecipeBookButtonPosition(); + button.setPosition(screenPositionx.x(), screenPositionx.y()); + this.onRecipeBookButtonClick(); + })); + this.addWidget(this.recipeBookComponent); + } + + protected void onRecipeBookButtonClick() { + } + + @Override + public void render(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) { + if (this.recipeBookComponent.isVisible() && this.widthTooNarrow) { + this.renderBackground(guiGraphics, mouseX, mouseY, partialTick); + } else { + super.render(guiGraphics, mouseX, mouseY, partialTick); + } + + this.recipeBookComponent.render(guiGraphics, mouseX, mouseY, partialTick); + this.renderTooltip(guiGraphics, mouseX, mouseY); + this.recipeBookComponent.renderTooltip(guiGraphics, mouseX, mouseY, this.hoveredSlot); + } + + @Override + protected void renderSlots(GuiGraphics guiGraphics) { + super.renderSlots(guiGraphics); + this.recipeBookComponent.renderGhostRecipe(guiGraphics, this.isBiggerResultSlot()); + } + + protected boolean isBiggerResultSlot() { + return true; + } + + @Override + public boolean charTyped(char codePoint, int modifiers) { + return this.recipeBookComponent.charTyped(codePoint, modifiers) ? true : super.charTyped(codePoint, modifiers); + } + + @Override + public boolean keyPressed(int keyCode, int scanCode, int modifiers) { + return this.recipeBookComponent.keyPressed(keyCode, scanCode, modifiers) ? true : super.keyPressed(keyCode, scanCode, modifiers); + } + + @Override + public boolean mouseClicked(double mouseX, double mouseY, int button) { + if (this.recipeBookComponent.mouseClicked(mouseX, mouseY, button)) { + this.setFocused(this.recipeBookComponent); + return true; + } else { + return this.widthTooNarrow && this.recipeBookComponent.isVisible() ? true : super.mouseClicked(mouseX, mouseY, button); + } + } + + @Override + protected boolean isHovering(int x, int y, int width, int height, double mouseX, double mouseY) { + return (!this.widthTooNarrow || !this.recipeBookComponent.isVisible()) && super.isHovering(x, y, width, height, mouseX, mouseY); + } + + @Override + protected boolean hasClickedOutside(double mouseX, double mouseY, int guiLeft, int guiTop, int mouseButton) { + boolean bl = mouseX < guiLeft || mouseY < guiTop || mouseX >= guiLeft + this.imageWidth || mouseY >= guiTop + this.imageHeight; + return this.recipeBookComponent.hasClickedOutside(mouseX, mouseY, this.leftPos, this.topPos, this.imageWidth, this.imageHeight, mouseButton) && bl; + } + + @Override + protected void slotClicked(Slot slot, int slotId, int mouseButton, ClickType type) { + super.slotClicked(slot, slotId, mouseButton, type); + this.recipeBookComponent.slotClicked(slot); + } + + @Override + public void containerTick() { + super.containerTick(); + this.recipeBookComponent.tick(); + } + + @Override + public void recipesUpdated() { + this.recipeBookComponent.recipesUpdated(); + } + + @Override + public void fillGhostRecipe(RecipeDisplay recipeDisplay) { + this.recipeBookComponent.fillGhostRecipe(recipeDisplay); + } +} diff --git a/net/minecraft/client/gui/screens/inventory/AbstractSignEditScreen.java b/net/minecraft/client/gui/screens/inventory/AbstractSignEditScreen.java index acd96279..8fa494af 100644 --- a/net/minecraft/client/gui/screens/inventory/AbstractSignEditScreen.java +++ b/net/minecraft/client/gui/screens/inventory/AbstractSignEditScreen.java @@ -14,6 +14,7 @@ import net.minecraft.client.renderer.blockentity.SignRenderer; import net.minecraft.network.chat.CommonComponents; import net.minecraft.network.chat.Component; import net.minecraft.network.protocol.game.ServerboundSignUpdatePacket; +import net.minecraft.util.ARGB; import net.minecraft.world.level.block.SignBlock; import net.minecraft.world.level.block.entity.SignBlockEntity; import net.minecraft.world.level.block.entity.SignText; @@ -27,7 +28,7 @@ public abstract class AbstractSignEditScreen extends Screen { /** * Reference to the sign object. */ - private final SignBlockEntity sign; + protected final SignBlockEntity sign; private SignText text; private final String[] messages; private final boolean isFrontText; @@ -109,9 +110,11 @@ public abstract class AbstractSignEditScreen extends Screen { @Override public void render(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) { super.render(guiGraphics, mouseX, mouseY, partialTick); + guiGraphics.flush(); Lighting.setupForFlatItems(); guiGraphics.drawCenteredString(this.font, this.title, this.width / 2, 40, 16777215); this.renderSign(guiGraphics); + guiGraphics.flush(); Lighting.setupFor3DItems(); } @@ -140,7 +143,7 @@ public abstract class AbstractSignEditScreen extends Screen { return false; } - protected abstract void renderSignBackground(GuiGraphics guiGraphics, BlockState state); + protected abstract void renderSignBackground(GuiGraphics guiGraphics); protected abstract Vector3f getSignTextScale(); @@ -149,11 +152,10 @@ public abstract class AbstractSignEditScreen extends Screen { } private void renderSign(GuiGraphics guiGraphics) { - BlockState blockState = this.sign.getBlockState(); guiGraphics.pose().pushPose(); - this.offsetSign(guiGraphics, blockState); + this.offsetSign(guiGraphics, this.sign.getBlockState()); guiGraphics.pose().pushPose(); - this.renderSignBackground(guiGraphics, blockState); + this.renderSignBackground(guiGraphics); guiGraphics.pose().popPose(); this.renderSignText(guiGraphics); guiGraphics.pose().popPose(); @@ -195,7 +197,7 @@ public abstract class AbstractSignEditScreen extends Screen { int o = this.font.width(string.substring(0, Math.max(Math.min(j, string.length()), 0))); int p = o - this.font.width(string) / 2; if (bl && j < string.length()) { - guiGraphics.fill(p, m - 1, p + 1, m + this.sign.getTextLineHeight(), 0xFF000000 | i); + guiGraphics.fill(p, m - 1, p + 1, m + this.sign.getTextLineHeight(), ARGB.opaque(i)); } if (k != j) { diff --git a/net/minecraft/client/gui/screens/inventory/AnvilScreen.java b/net/minecraft/client/gui/screens/inventory/AnvilScreen.java index 654ad06a..7ba548a1 100644 --- a/net/minecraft/client/gui/screens/inventory/AnvilScreen.java +++ b/net/minecraft/client/gui/screens/inventory/AnvilScreen.java @@ -5,6 +5,7 @@ import net.fabricmc.api.Environment; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.EditBox; +import net.minecraft.client.renderer.RenderType; import net.minecraft.core.component.DataComponents; import net.minecraft.network.chat.Component; import net.minecraft.network.protocol.game.ServerboundRenameItemPacket; @@ -114,7 +115,9 @@ public class AnvilScreen extends ItemCombinerScreen { @Override protected void renderBg(GuiGraphics guiGraphics, float partialTick, int mouseX, int mouseY) { super.renderBg(guiGraphics, partialTick, mouseX, mouseY); - guiGraphics.blitSprite(this.menu.getSlot(0).hasItem() ? TEXT_FIELD_SPRITE : TEXT_FIELD_DISABLED_SPRITE, this.leftPos + 59, this.topPos + 20, 110, 16); + guiGraphics.blitSprite( + RenderType::guiTextured, this.menu.getSlot(0).hasItem() ? TEXT_FIELD_SPRITE : TEXT_FIELD_DISABLED_SPRITE, this.leftPos + 59, this.topPos + 20, 110, 16 + ); } @Override @@ -125,7 +128,7 @@ public class AnvilScreen extends ItemCombinerScreen { @Override protected void renderErrorIcon(GuiGraphics guiGraphics, int x, int y) { if ((this.menu.getSlot(0).hasItem() || this.menu.getSlot(1).hasItem()) && !this.menu.getSlot(this.menu.getResultSlot()).hasItem()) { - guiGraphics.blitSprite(ERROR_SPRITE, x + 99, y + 45, 28, 21); + guiGraphics.blitSprite(RenderType::guiTextured, ERROR_SPRITE, x + 99, y + 45, 28, 21); } } diff --git a/net/minecraft/client/gui/screens/inventory/BeaconScreen.java b/net/minecraft/client/gui/screens/inventory/BeaconScreen.java index 7ed406a4..6bd23e03 100644 --- a/net/minecraft/client/gui/screens/inventory/BeaconScreen.java +++ b/net/minecraft/client/gui/screens/inventory/BeaconScreen.java @@ -11,6 +11,7 @@ import net.minecraft.client.gui.components.AbstractButton; import net.minecraft.client.gui.components.AbstractWidget; import net.minecraft.client.gui.components.Tooltip; import net.minecraft.client.gui.narration.NarrationElementOutput; +import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.core.Holder; import net.minecraft.network.chat.CommonComponents; @@ -130,7 +131,7 @@ public class BeaconScreen extends AbstractContainerScreen { protected void renderBg(GuiGraphics guiGraphics, float partialTick, int mouseX, int mouseY) { int i = (this.width - this.imageWidth) / 2; int j = (this.height - this.imageHeight) / 2; - guiGraphics.blit(BEACON_LOCATION, i, j, 0, 0, this.imageWidth, this.imageHeight); + guiGraphics.blit(RenderType::guiTextured, BEACON_LOCATION, i, j, 0.0F, 0.0F, this.imageWidth, this.imageHeight, 256, 256); guiGraphics.pose().pushPose(); guiGraphics.pose().translate(0.0F, 0.0F, 100.0F); guiGraphics.renderItem(new ItemStack(Items.NETHERITE_INGOT), i + 20, j + 109); @@ -227,7 +228,7 @@ public class BeaconScreen extends AbstractContainerScreen { @Override protected void renderIcon(GuiGraphics guiGraphics) { - guiGraphics.blit(this.getX() + 2, this.getY() + 2, 0, 18, 18, this.sprite); + guiGraphics.blitSprite(RenderType::guiTextured, this.sprite, this.getX() + 2, this.getY() + 2, 18, 18); } @Override @@ -267,7 +268,7 @@ public class BeaconScreen extends AbstractContainerScreen { resourceLocation = BeaconScreen.BUTTON_SPRITE; } - guiGraphics.blitSprite(resourceLocation, this.getX(), this.getY(), this.width, this.height); + guiGraphics.blitSprite(RenderType::guiTextured, resourceLocation, this.getX(), this.getY(), this.width, this.height); this.renderIcon(guiGraphics); } @@ -298,7 +299,7 @@ public class BeaconScreen extends AbstractContainerScreen { @Override protected void renderIcon(GuiGraphics guiGraphics) { - guiGraphics.blitSprite(this.sprite, this.getX() + 2, this.getY() + 2, 18, 18); + guiGraphics.blitSprite(RenderType::guiTextured, this.sprite, this.getX() + 2, this.getY() + 2, 18, 18); } } diff --git a/net/minecraft/client/gui/screens/inventory/BlastFurnaceScreen.java b/net/minecraft/client/gui/screens/inventory/BlastFurnaceScreen.java index 02cac978..20ef81cc 100644 --- a/net/minecraft/client/gui/screens/inventory/BlastFurnaceScreen.java +++ b/net/minecraft/client/gui/screens/inventory/BlastFurnaceScreen.java @@ -1,20 +1,30 @@ package net.minecraft.client.gui.screens.inventory; +import java.util.List; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; -import net.minecraft.client.gui.screens.recipebook.BlastingRecipeBookComponent; +import net.minecraft.client.gui.screens.recipebook.RecipeBookComponent; +import net.minecraft.client.gui.screens.recipebook.SearchRecipeBookCategory; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.inventory.BlastFurnaceMenu; +import net.minecraft.world.item.Items; +import net.minecraft.world.item.crafting.RecipeBookCategories; @Environment(EnvType.CLIENT) public class BlastFurnaceScreen extends AbstractFurnaceScreen { private static final ResourceLocation LIT_PROGRESS_SPRITE = ResourceLocation.withDefaultNamespace("container/blast_furnace/lit_progress"); private static final ResourceLocation BURN_PROGRESS_SPRITE = ResourceLocation.withDefaultNamespace("container/blast_furnace/burn_progress"); private static final ResourceLocation TEXTURE = ResourceLocation.withDefaultNamespace("textures/gui/container/blast_furnace.png"); + private static final Component FILTER_NAME = Component.translatable("gui.recipebook.toggleRecipes.blastable"); + private static final List TABS = List.of( + new RecipeBookComponent.TabInfo(SearchRecipeBookCategory.BLAST_FURNACE), + new RecipeBookComponent.TabInfo(Items.REDSTONE_ORE, RecipeBookCategories.BLAST_FURNACE_BLOCKS), + new RecipeBookComponent.TabInfo(Items.IRON_SHOVEL, Items.GOLDEN_LEGGINGS, RecipeBookCategories.BLAST_FURNACE_MISC) + ); public BlastFurnaceScreen(BlastFurnaceMenu menu, Inventory playerInventory, Component title) { - super(menu, new BlastingRecipeBookComponent(), playerInventory, title, TEXTURE, LIT_PROGRESS_SPRITE, BURN_PROGRESS_SPRITE); + super(menu, playerInventory, title, FILTER_NAME, TEXTURE, LIT_PROGRESS_SPRITE, BURN_PROGRESS_SPRITE, TABS); } } diff --git a/net/minecraft/client/gui/screens/inventory/BookEditScreen.java b/net/minecraft/client/gui/screens/inventory/BookEditScreen.java index f0808301..d1b9e54c 100644 --- a/net/minecraft/client/gui/screens/inventory/BookEditScreen.java +++ b/net/minecraft/client/gui/screens/inventory/BookEditScreen.java @@ -18,6 +18,7 @@ import net.minecraft.client.gui.Font; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.Button; import net.minecraft.client.gui.font.TextFieldHelper; +import net.minecraft.client.gui.font.TextFieldHelper.CursorStep; import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.renderer.Rect2i; import net.minecraft.client.renderer.RenderType; @@ -44,6 +45,8 @@ public class BookEditScreen extends Screen { private static final int TEXT_HEIGHT = 128; private static final int IMAGE_WIDTH = 192; private static final int IMAGE_HEIGHT = 192; + private static final int BACKGROUND_TEXTURE_WIDTH = 256; + private static final int BACKGROUND_TEXTURE_HEIGHT = 256; private static final Component EDIT_TITLE_LABEL = Component.translatable("book.editTitle"); private static final Component FINALIZE_WARNING_LABEL = Component.translatable("book.finalizeWarning"); private static final FormattedCharSequence BLACK_CURSOR = FormattedCharSequence.forward("_", Style.EMPTY.withColor(ChatFormatting.BLACK)); @@ -92,21 +95,17 @@ public class BookEditScreen extends Screen { private Component pageMsg = CommonComponents.EMPTY; private final Component ownerText; - public BookEditScreen(Player owner, ItemStack book, InteractionHand hand) { + public BookEditScreen(Player player, ItemStack itemStack, InteractionHand interactionHand, WritableBookContent writableBookContent) { super(GameNarrator.NO_TITLE); - this.owner = owner; - this.book = book; - this.hand = hand; - WritableBookContent writableBookContent = book.get(DataComponents.WRITABLE_BOOK_CONTENT); - if (writableBookContent != null) { - writableBookContent.getPages(Minecraft.getInstance().isTextFilteringEnabled()).forEach(this.pages::add); - } - + this.owner = player; + this.book = itemStack; + this.hand = interactionHand; + writableBookContent.getPages(Minecraft.getInstance().isTextFilteringEnabled()).forEach(this.pages::add); if (this.pages.isEmpty()) { this.pages.add(""); } - this.ownerText = Component.translatable("book.byAuthor", owner.getName()).withStyle(ChatFormatting.DARK_GRAY); + this.ownerText = Component.translatable("book.byAuthor", player.getName()).withStyle(ChatFormatting.DARK_GRAY); } private void setClipboard(String clipboardValue) { @@ -292,7 +291,7 @@ public class BookEditScreen extends Screen { this.pageEdit.cut(); return true; } else { - TextFieldHelper.CursorStep cursorStep = Screen.hasControlDown() ? TextFieldHelper.CursorStep.WORD : TextFieldHelper.CursorStep.CHARACTER; + CursorStep cursorStep = Screen.hasControlDown() ? CursorStep.WORD : CursorStep.CHARACTER; switch (keyCode) { case 257: case 335: @@ -442,7 +441,7 @@ public class BookEditScreen extends Screen { @Override public void renderBackground(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) { this.renderTransparentBackground(guiGraphics); - guiGraphics.blit(BookViewScreen.BOOK_LOCATION, (this.width - 192) / 2, 2, 0, 0, 192, 192); + guiGraphics.blit(RenderType::guiTextured, BookViewScreen.BOOK_LOCATION, (this.width - 192) / 2, 2, 0.0F, 0.0F, 192, 192, 256, 256); } private void renderCursor(GuiGraphics guiGraphics, BookEditScreen.Pos2i cursorPos, boolean isEndOfText) { diff --git a/net/minecraft/client/gui/screens/inventory/BookViewScreen.java b/net/minecraft/client/gui/screens/inventory/BookViewScreen.java index 13c40d5c..2abcea1a 100644 --- a/net/minecraft/client/gui/screens/inventory/BookViewScreen.java +++ b/net/minecraft/client/gui/screens/inventory/BookViewScreen.java @@ -9,6 +9,7 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.Button; import net.minecraft.client.gui.screens.Screen; +import net.minecraft.client.renderer.RenderType; import net.minecraft.core.component.DataComponents; import net.minecraft.network.chat.ClickEvent; import net.minecraft.network.chat.CommonComponents; @@ -28,6 +29,8 @@ public class BookViewScreen extends Screen { public static final int PAGE_INDICATOR_TEXT_Y_OFFSET = 16; public static final int PAGE_TEXT_X_OFFSET = 36; public static final int PAGE_TEXT_Y_OFFSET = 30; + private static final int BACKGROUND_TEXTURE_WIDTH = 256; + private static final int BACKGROUND_TEXTURE_HEIGHT = 256; public static final BookViewScreen.BookAccess EMPTY_ACCESS = new BookViewScreen.BookAccess(List.of()); public static final ResourceLocation BOOK_LOCATION = ResourceLocation.withDefaultNamespace("textures/gui/book.png"); protected static final int TEXT_WIDTH = 114; @@ -189,7 +192,7 @@ public class BookViewScreen extends Screen { @Override public void renderBackground(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) { this.renderTransparentBackground(guiGraphics); - guiGraphics.blit(BOOK_LOCATION, (this.width - 192) / 2, 2, 0, 0, 192, 192); + guiGraphics.blit(RenderType::guiTextured, BOOK_LOCATION, (this.width - 192) / 2, 2, 0.0F, 0.0F, 192, 192, 256, 256); } @Override diff --git a/net/minecraft/client/gui/screens/inventory/BrewingStandScreen.java b/net/minecraft/client/gui/screens/inventory/BrewingStandScreen.java index aff89513..6346a5d2 100644 --- a/net/minecraft/client/gui/screens/inventory/BrewingStandScreen.java +++ b/net/minecraft/client/gui/screens/inventory/BrewingStandScreen.java @@ -3,6 +3,7 @@ package net.minecraft.client.gui.screens.inventory; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.renderer.RenderType; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; import net.minecraft.util.Mth; @@ -37,23 +38,23 @@ public class BrewingStandScreen extends AbstractContainerScreen 0) { - guiGraphics.blitSprite(FUEL_LENGTH_SPRITE, 18, 4, 0, 0, i + 60, j + 44, l, 4); + guiGraphics.blitSprite(RenderType::guiTextured, FUEL_LENGTH_SPRITE, 18, 4, 0, 0, i + 60, j + 44, l, 4); } int m = this.menu.getBrewingTicks(); if (m > 0) { int n = (int)(28.0F * (1.0F - m / 400.0F)); if (n > 0) { - guiGraphics.blitSprite(BREW_PROGRESS_SPRITE, 9, 28, 0, 0, i + 97, j + 16, 9, n); + guiGraphics.blitSprite(RenderType::guiTextured, BREW_PROGRESS_SPRITE, 9, 28, 0, 0, i + 97, j + 16, 9, n); } n = BUBBLELENGTHS[m / 2 % 7]; if (n > 0) { - guiGraphics.blitSprite(BUBBLES_SPRITE, 12, 29, 0, 29 - n, i + 63, j + 14 + 29 - n, 12, n); + guiGraphics.blitSprite(RenderType::guiTextured, BUBBLES_SPRITE, 12, 29, 0, 29 - n, i + 63, j + 14 + 29 - n, 12, n); } } } diff --git a/net/minecraft/client/gui/screens/inventory/CartographyTableScreen.java b/net/minecraft/client/gui/screens/inventory/CartographyTableScreen.java index aca4986f..83b6e5fe 100644 --- a/net/minecraft/client/gui/screens/inventory/CartographyTableScreen.java +++ b/net/minecraft/client/gui/screens/inventory/CartographyTableScreen.java @@ -3,6 +3,9 @@ package net.minecraft.client.gui.screens.inventory; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.renderer.MapRenderer; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.state.MapRenderState; import net.minecraft.core.component.DataComponents; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; @@ -23,6 +26,7 @@ public class CartographyTableScreen extends AbstractContainerScreen= 4) { bl4 = true; - guiGraphics.blitSprite(ERROR_SPRITE, i + 35, j + 31, 28, 21); + guiGraphics.blitSprite(RenderType::guiTextured, ERROR_SPRITE, i + 35, j + 31, 28, 21); } } } else { @@ -76,25 +80,25 @@ public class CartographyTableScreen extends AbstractContainerScreen mapRenderer.render(this.mapRenderState, guiGraphics.pose(), multiBufferSource, true, 15728880)); guiGraphics.pose().popPose(); } } diff --git a/net/minecraft/client/gui/screens/inventory/ContainerScreen.java b/net/minecraft/client/gui/screens/inventory/ContainerScreen.java index d5675a30..04af7811 100644 --- a/net/minecraft/client/gui/screens/inventory/ContainerScreen.java +++ b/net/minecraft/client/gui/screens/inventory/ContainerScreen.java @@ -3,13 +3,14 @@ package net.minecraft.client.gui.screens.inventory; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.renderer.RenderType; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.inventory.ChestMenu; @Environment(EnvType.CLIENT) -public class ContainerScreen extends AbstractContainerScreen implements MenuAccess { +public class ContainerScreen extends AbstractContainerScreen { /** * The ResourceLocation containing the chest GUI texture. */ @@ -38,7 +39,7 @@ public class ContainerScreen extends AbstractContainerScreen implemen protected void renderBg(GuiGraphics guiGraphics, float partialTick, int mouseX, int mouseY) { int i = (this.width - this.imageWidth) / 2; int j = (this.height - this.imageHeight) / 2; - guiGraphics.blit(CONTAINER_BACKGROUND, i, j, 0, 0, this.imageWidth, this.containerRows * 18 + 17); - guiGraphics.blit(CONTAINER_BACKGROUND, i, j + this.containerRows * 18 + 17, 0, 126, this.imageWidth, 96); + guiGraphics.blit(RenderType::guiTextured, CONTAINER_BACKGROUND, i, j, 0.0F, 0.0F, this.imageWidth, this.containerRows * 18 + 17, 256, 256); + guiGraphics.blit(RenderType::guiTextured, CONTAINER_BACKGROUND, i, j + this.containerRows * 18 + 17, 0.0F, 126.0F, this.imageWidth, 96, 256, 256); } } diff --git a/net/minecraft/client/gui/screens/inventory/CrafterScreen.java b/net/minecraft/client/gui/screens/inventory/CrafterScreen.java index a9aa0dfb..972b825f 100644 --- a/net/minecraft/client/gui/screens/inventory/CrafterScreen.java +++ b/net/minecraft/client/gui/screens/inventory/CrafterScreen.java @@ -3,6 +3,7 @@ package net.minecraft.client.gui.screens.inventory; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.renderer.RenderType; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; import net.minecraft.sounds.SoundEvents; @@ -81,7 +82,7 @@ public class CrafterScreen extends AbstractContainerScreen { } private void renderDisabledSlot(GuiGraphics guiGraphics, CrafterSlot slot) { - guiGraphics.blitSprite(DISABLED_SLOT_LOCATION_SPRITE, slot.x - 1, slot.y - 1, 18, 18); + guiGraphics.blitSprite(RenderType::guiTextured, DISABLED_SLOT_LOCATION_SPRITE, slot.x - 1, slot.y - 1, 18, 18); } @Override @@ -108,13 +109,13 @@ public class CrafterScreen extends AbstractContainerScreen { resourceLocation = UNPOWERED_REDSTONE_LOCATION_SPRITE; } - guiGraphics.blitSprite(resourceLocation, i, j, 16, 16); + guiGraphics.blitSprite(RenderType::guiTextured, resourceLocation, i, j, 16, 16); } @Override protected void renderBg(GuiGraphics guiGraphics, float partialTick, int mouseX, int mouseY) { int i = (this.width - this.imageWidth) / 2; int j = (this.height - this.imageHeight) / 2; - guiGraphics.blit(CONTAINER_LOCATION, i, j, 0, 0, this.imageWidth, this.imageHeight); + guiGraphics.blit(RenderType::guiTextured, CONTAINER_LOCATION, i, j, 0.0F, 0.0F, this.imageWidth, this.imageHeight, 256, 256); } } diff --git a/net/minecraft/client/gui/screens/inventory/CraftingScreen.java b/net/minecraft/client/gui/screens/inventory/CraftingScreen.java index 7cb0643f..f245126c 100644 --- a/net/minecraft/client/gui/screens/inventory/CraftingScreen.java +++ b/net/minecraft/client/gui/screens/inventory/CraftingScreen.java @@ -3,113 +3,37 @@ package net.minecraft.client.gui.screens.inventory; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.gui.GuiGraphics; -import net.minecraft.client.gui.components.ImageButton; -import net.minecraft.client.gui.screens.recipebook.RecipeBookComponent; -import net.minecraft.client.gui.screens.recipebook.RecipeUpdateListener; +import net.minecraft.client.gui.navigation.ScreenPosition; +import net.minecraft.client.gui.screens.recipebook.CraftingRecipeBookComponent; +import net.minecraft.client.renderer.RenderType; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.player.Inventory; -import net.minecraft.world.inventory.ClickType; import net.minecraft.world.inventory.CraftingMenu; -import net.minecraft.world.inventory.Slot; @Environment(EnvType.CLIENT) -public class CraftingScreen extends AbstractContainerScreen implements RecipeUpdateListener { +public class CraftingScreen extends AbstractRecipeBookScreen { private static final ResourceLocation CRAFTING_TABLE_LOCATION = ResourceLocation.withDefaultNamespace("textures/gui/container/crafting_table.png"); - private final RecipeBookComponent recipeBookComponent = new RecipeBookComponent(); - private boolean widthTooNarrow; public CraftingScreen(CraftingMenu menu, Inventory playerInventory, Component title) { - super(menu, playerInventory, title); + super(menu, new CraftingRecipeBookComponent(menu), playerInventory, title); } @Override protected void init() { super.init(); - this.widthTooNarrow = this.width < 379; - this.recipeBookComponent.init(this.width, this.height, this.minecraft, this.widthTooNarrow, this.menu); - this.leftPos = this.recipeBookComponent.updateScreenPosition(this.width, this.imageWidth); - this.addRenderableWidget(new ImageButton(this.leftPos + 5, this.height / 2 - 49, 20, 18, RecipeBookComponent.RECIPE_BUTTON_SPRITES, button -> { - this.recipeBookComponent.toggleVisibility(); - this.leftPos = this.recipeBookComponent.updateScreenPosition(this.width, this.imageWidth); - button.setPosition(this.leftPos + 5, this.height / 2 - 49); - })); - this.addWidget(this.recipeBookComponent); this.titleLabelX = 29; } @Override - public void containerTick() { - super.containerTick(); - this.recipeBookComponent.tick(); - } - - @Override - public void render(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) { - if (this.recipeBookComponent.isVisible() && this.widthTooNarrow) { - this.renderBackground(guiGraphics, mouseX, mouseY, partialTick); - this.recipeBookComponent.render(guiGraphics, mouseX, mouseY, partialTick); - } else { - super.render(guiGraphics, mouseX, mouseY, partialTick); - this.recipeBookComponent.render(guiGraphics, mouseX, mouseY, partialTick); - this.recipeBookComponent.renderGhostRecipe(guiGraphics, this.leftPos, this.topPos, true, partialTick); - } - - this.renderTooltip(guiGraphics, mouseX, mouseY); - this.recipeBookComponent.renderTooltip(guiGraphics, this.leftPos, this.topPos, mouseX, mouseY); + protected ScreenPosition getRecipeBookButtonPosition() { + return new ScreenPosition(this.leftPos + 5, this.height / 2 - 49); } @Override protected void renderBg(GuiGraphics guiGraphics, float partialTick, int mouseX, int mouseY) { int i = this.leftPos; int j = (this.height - this.imageHeight) / 2; - guiGraphics.blit(CRAFTING_TABLE_LOCATION, i, j, 0, 0, this.imageWidth, this.imageHeight); - } - - @Override - public boolean keyPressed(int keyCode, int scanCode, int modifiers) { - return this.recipeBookComponent.keyPressed(keyCode, scanCode, modifiers) ? true : super.keyPressed(keyCode, scanCode, modifiers); - } - - @Override - public boolean charTyped(char codePoint, int modifiers) { - return this.recipeBookComponent.charTyped(codePoint, modifiers) ? true : super.charTyped(codePoint, modifiers); - } - - @Override - protected boolean isHovering(int x, int y, int width, int height, double mouseX, double mouseY) { - return (!this.widthTooNarrow || !this.recipeBookComponent.isVisible()) && super.isHovering(x, y, width, height, mouseX, mouseY); - } - - @Override - public boolean mouseClicked(double mouseX, double mouseY, int button) { - if (this.recipeBookComponent.mouseClicked(mouseX, mouseY, button)) { - this.setFocused(this.recipeBookComponent); - return true; - } else { - return this.widthTooNarrow && this.recipeBookComponent.isVisible() ? true : super.mouseClicked(mouseX, mouseY, button); - } - } - - @Override - protected boolean hasClickedOutside(double mouseX, double mouseY, int guiLeft, int guiTop, int mouseButton) { - boolean bl = mouseX < guiLeft || mouseY < guiTop || mouseX >= guiLeft + this.imageWidth || mouseY >= guiTop + this.imageHeight; - return this.recipeBookComponent.hasClickedOutside(mouseX, mouseY, this.leftPos, this.topPos, this.imageWidth, this.imageHeight, mouseButton) && bl; - } - - @Override - protected void slotClicked(Slot slot, int slotId, int mouseButton, ClickType type) { - super.slotClicked(slot, slotId, mouseButton, type); - this.recipeBookComponent.slotClicked(slot); - } - - @Override - public void recipesUpdated() { - this.recipeBookComponent.recipesUpdated(); - } - - @Override - public RecipeBookComponent getRecipeBookComponent() { - return this.recipeBookComponent; + guiGraphics.blit(RenderType::guiTextured, CRAFTING_TABLE_LOCATION, i, j, 0.0F, 0.0F, this.imageWidth, this.imageHeight, 256, 256); } } diff --git a/net/minecraft/client/gui/screens/inventory/CreativeModeInventoryScreen.java b/net/minecraft/client/gui/screens/inventory/CreativeModeInventoryScreen.java index 5d6eaa65..2145ffbd 100644 --- a/net/minecraft/client/gui/screens/inventory/CreativeModeInventoryScreen.java +++ b/net/minecraft/client/gui/screens/inventory/CreativeModeInventoryScreen.java @@ -22,8 +22,10 @@ import net.minecraft.client.multiplayer.ClientPacketListener; import net.minecraft.client.multiplayer.SessionSearchTrees; import net.minecraft.client.player.LocalPlayer; import net.minecraft.client.player.inventory.Hotbar; +import net.minecraft.client.renderer.RenderType; import net.minecraft.client.searchtree.SearchTree; import net.minecraft.core.HolderLookup; +import net.minecraft.core.HolderSet; import net.minecraft.core.NonNullList; import net.minecraft.core.RegistryAccess; import net.minecraft.core.component.DataComponents; @@ -48,10 +50,13 @@ import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.item.TooltipFlag; +import net.minecraft.world.item.CreativeModeTab.Row; +import net.minecraft.world.item.CreativeModeTab.Type; +import net.minecraft.world.item.TooltipFlag.Default; import org.jetbrains.annotations.Nullable; @Environment(EnvType.CLIENT) -public class CreativeModeInventoryScreen extends EffectRenderingInventoryScreen { +public class CreativeModeInventoryScreen extends AbstractContainerScreen { private static final ResourceLocation SCROLLER_SPRITE = ResourceLocation.withDefaultNamespace("container/creative_inventory/scroller"); private static final ResourceLocation SCROLLER_DISABLED_SPRITE = ResourceLocation.withDefaultNamespace("container/creative_inventory/scroller_disabled"); private static final ResourceLocation[] UNSELECTED_TOP_TABS = new ResourceLocation[]{ @@ -121,6 +126,7 @@ public class CreativeModeInventoryScreen extends EffectRenderingInventoryScreen< private boolean hasClickedOutside; private final Set> visibleTags = new HashSet(); private final boolean displayOperatorCreativeTab; + private final EffectsInInventory effects; public CreativeModeInventoryScreen(LocalPlayer player, FeatureFlagSet enabledFeatures, boolean displayOperatorCreativeTab) { super(new CreativeModeInventoryScreen.ItemPickerMenu(player), player.getInventory(), CommonComponents.EMPTY); @@ -129,6 +135,7 @@ public class CreativeModeInventoryScreen extends EffectRenderingInventoryScreen< this.imageWidth = 195; this.displayOperatorCreativeTab = displayOperatorCreativeTab; this.tryRebuildTabContents(player.connection.searchTrees(), enabledFeatures, this.hasPermissions(player), player.level().registryAccess()); + this.effects = new EffectsInInventory(this); } private boolean hasPermissions(Player player) { @@ -141,7 +148,7 @@ public class CreativeModeInventoryScreen extends EffectRenderingInventoryScreen< for (CreativeModeTab creativeModeTab : CreativeModeTabs.allTabs()) { Collection collection = creativeModeTab.getDisplayItems(); if (creativeModeTab == selectedTab) { - if (creativeModeTab.getType() == CreativeModeTab.Type.CATEGORY && collection.isEmpty()) { + if (creativeModeTab.getType() == Type.CATEGORY && collection.isEmpty()) { this.selectTab(CreativeModeTabs.getDefaultTab()); } else { this.refreshCurrentTabContents(collection); @@ -170,7 +177,7 @@ public class CreativeModeInventoryScreen extends EffectRenderingInventoryScreen< private void refreshCurrentTabContents(Collection items) { int i = this.menu.getRowIndexForScroll(this.scrollOffs); this.menu.items.clear(); - if (selectedTab.getType() == CreativeModeTab.Type.SEARCH) { + if (selectedTab.getType() == Type.SEARCH) { this.refreshSearchResults(); } else { this.menu.items.addAll(items); @@ -205,118 +212,123 @@ public class CreativeModeInventoryScreen extends EffectRenderingInventoryScreen< boolean bl = type == ClickType.QUICK_MOVE; type = slotId == -999 && type == ClickType.PICKUP ? ClickType.THROW : type; - if (slot == null && selectedTab.getType() != CreativeModeTab.Type.INVENTORY && type != ClickType.QUICK_CRAFT) { - if (!this.menu.getCarried().isEmpty() && this.hasClickedOutside) { - if (mouseButton == 0) { - this.minecraft.player.drop(this.menu.getCarried(), true); - this.minecraft.gameMode.handleCreativeModeItemDrop(this.menu.getCarried()); - this.menu.setCarried(ItemStack.EMPTY); + if (type != ClickType.THROW || this.minecraft.player.canDropItems()) { + this.onMouseClickAction(slot, type); + if (slot == null && selectedTab.getType() != Type.INVENTORY && type != ClickType.QUICK_CRAFT) { + if (!this.menu.getCarried().isEmpty() && this.hasClickedOutside) { + if (!this.minecraft.player.canDropItems()) { + return; + } + + if (mouseButton == 0) { + this.minecraft.player.drop(this.menu.getCarried(), true); + this.minecraft.gameMode.handleCreativeModeItemDrop(this.menu.getCarried()); + this.menu.setCarried(ItemStack.EMPTY); + } + + if (mouseButton == 1) { + ItemStack itemStack = this.menu.getCarried().split(1); + this.minecraft.player.drop(itemStack, true); + this.minecraft.gameMode.handleCreativeModeItemDrop(itemStack); + } + } + } else { + if (slot != null && !slot.mayPickup(this.minecraft.player)) { + return; } - if (mouseButton == 1) { - ItemStack itemStack = this.menu.getCarried().split(1); - this.minecraft.player.drop(itemStack, true); - this.minecraft.gameMode.handleCreativeModeItemDrop(itemStack); - } - } - } else { - if (slot != null && !slot.mayPickup(this.minecraft.player)) { - return; - } - - if (slot == this.destroyItemSlot && bl) { - for (int i = 0; i < this.minecraft.player.inventoryMenu.getItems().size(); i++) { - this.minecraft.gameMode.handleCreativeModeItemAdd(ItemStack.EMPTY, i); - } - } else if (selectedTab.getType() == CreativeModeTab.Type.INVENTORY) { - if (slot == this.destroyItemSlot) { - this.menu.setCarried(ItemStack.EMPTY); - } else if (type == ClickType.THROW && slot != null && slot.hasItem()) { - ItemStack itemStack = slot.remove(mouseButton == 0 ? 1 : slot.getItem().getMaxStackSize()); - ItemStack itemStack2 = slot.getItem(); - this.minecraft.player.drop(itemStack, true); - this.minecraft.gameMode.handleCreativeModeItemDrop(itemStack); - this.minecraft.gameMode.handleCreativeModeItemAdd(itemStack2, ((CreativeModeInventoryScreen.SlotWrapper)slot).target.index); - } else if (type == ClickType.THROW && !this.menu.getCarried().isEmpty()) { - this.minecraft.player.drop(this.menu.getCarried(), true); - this.minecraft.gameMode.handleCreativeModeItemDrop(this.menu.getCarried()); - this.menu.setCarried(ItemStack.EMPTY); - } else { - this.minecraft - .player - .inventoryMenu - .clicked(slot == null ? slotId : ((CreativeModeInventoryScreen.SlotWrapper)slot).target.index, mouseButton, type, this.minecraft.player); - this.minecraft.player.inventoryMenu.broadcastChanges(); - } - } else if (type != ClickType.QUICK_CRAFT && slot.container == CONTAINER) { - ItemStack itemStack = this.menu.getCarried(); - ItemStack itemStack2 = slot.getItem(); - if (type == ClickType.SWAP) { - if (!itemStack2.isEmpty()) { - this.minecraft.player.getInventory().setItem(mouseButton, itemStack2.copyWithCount(itemStack2.getMaxStackSize())); + if (slot == this.destroyItemSlot && bl) { + for (int i = 0; i < this.minecraft.player.inventoryMenu.getItems().size(); i++) { + this.minecraft.player.inventoryMenu.getSlot(i).set(ItemStack.EMPTY); + this.minecraft.gameMode.handleCreativeModeItemAdd(ItemStack.EMPTY, i); + } + } else if (selectedTab.getType() == Type.INVENTORY) { + if (slot == this.destroyItemSlot) { + this.menu.setCarried(ItemStack.EMPTY); + } else if (type == ClickType.THROW && slot != null && slot.hasItem()) { + ItemStack itemStack = slot.remove(mouseButton == 0 ? 1 : slot.getItem().getMaxStackSize()); + ItemStack itemStack2 = slot.getItem(); + this.minecraft.player.drop(itemStack, true); + this.minecraft.gameMode.handleCreativeModeItemDrop(itemStack); + this.minecraft.gameMode.handleCreativeModeItemAdd(itemStack2, ((CreativeModeInventoryScreen.SlotWrapper)slot).target.index); + } else if (type == ClickType.THROW && slotId == -999 && !this.menu.getCarried().isEmpty()) { + this.minecraft.player.drop(this.menu.getCarried(), true); + this.minecraft.gameMode.handleCreativeModeItemDrop(this.menu.getCarried()); + this.menu.setCarried(ItemStack.EMPTY); + } else { + this.minecraft + .player + .inventoryMenu + .clicked(slot == null ? slotId : ((CreativeModeInventoryScreen.SlotWrapper)slot).target.index, mouseButton, type, this.minecraft.player); this.minecraft.player.inventoryMenu.broadcastChanges(); } - - return; - } - - if (type == ClickType.CLONE) { - if (this.menu.getCarried().isEmpty() && slot.hasItem()) { - ItemStack itemStack3 = slot.getItem(); - this.menu.setCarried(itemStack3.copyWithCount(itemStack3.getMaxStackSize())); - } - - return; - } - - if (type == ClickType.THROW) { - if (!itemStack2.isEmpty()) { - ItemStack itemStack3 = itemStack2.copyWithCount(mouseButton == 0 ? 1 : itemStack2.getMaxStackSize()); - this.minecraft.player.drop(itemStack3, true); - this.minecraft.gameMode.handleCreativeModeItemDrop(itemStack3); - } - - return; - } - - if (!itemStack.isEmpty() && !itemStack2.isEmpty() && ItemStack.isSameItemSameComponents(itemStack, itemStack2)) { - if (mouseButton == 0) { - if (bl) { - itemStack.setCount(itemStack.getMaxStackSize()); - } else if (itemStack.getCount() < itemStack.getMaxStackSize()) { - itemStack.grow(1); - } - } else { - itemStack.shrink(1); - } - } else if (!itemStack2.isEmpty() && itemStack.isEmpty()) { - int j = bl ? itemStack2.getMaxStackSize() : itemStack2.getCount(); - this.menu.setCarried(itemStack2.copyWithCount(j)); - } else if (mouseButton == 0) { - this.menu.setCarried(ItemStack.EMPTY); - } else if (!this.menu.getCarried().isEmpty()) { - this.menu.getCarried().shrink(1); - } - } else if (this.menu != null) { - ItemStack itemStackx = slot == null ? ItemStack.EMPTY : this.menu.getSlot(slot.index).getItem(); - this.menu.clicked(slot == null ? slotId : slot.index, mouseButton, type, this.minecraft.player); - if (AbstractContainerMenu.getQuickcraftHeader(mouseButton) == 2) { - for (int k = 0; k < 9; k++) { - this.minecraft.gameMode.handleCreativeModeItemAdd(this.menu.getSlot(45 + k).getItem(), 36 + k); - } - } else if (slot != null) { - ItemStack itemStack2x = this.menu.getSlot(slot.index).getItem(); - this.minecraft.gameMode.handleCreativeModeItemAdd(itemStack2x, slot.index - this.menu.slots.size() + 9 + 36); - int j = 45 + mouseButton; + } else if (type != ClickType.QUICK_CRAFT && slot.container == CONTAINER) { + ItemStack itemStack = this.menu.getCarried(); + ItemStack itemStack2 = slot.getItem(); if (type == ClickType.SWAP) { - this.minecraft.gameMode.handleCreativeModeItemAdd(itemStackx, j - this.menu.slots.size() + 9 + 36); - } else if (type == ClickType.THROW && !itemStackx.isEmpty()) { - ItemStack itemStack4 = itemStackx.copyWithCount(mouseButton == 0 ? 1 : itemStackx.getMaxStackSize()); - this.minecraft.player.drop(itemStack4, true); - this.minecraft.gameMode.handleCreativeModeItemDrop(itemStack4); + if (!itemStack2.isEmpty()) { + this.minecraft.player.getInventory().setItem(mouseButton, itemStack2.copyWithCount(itemStack2.getMaxStackSize())); + this.minecraft.player.inventoryMenu.broadcastChanges(); + } + + return; } - this.minecraft.player.inventoryMenu.broadcastChanges(); + if (type == ClickType.CLONE) { + if (this.menu.getCarried().isEmpty() && slot.hasItem()) { + ItemStack itemStack3 = slot.getItem(); + this.menu.setCarried(itemStack3.copyWithCount(itemStack3.getMaxStackSize())); + } + + return; + } + + if (type == ClickType.THROW) { + if (!itemStack2.isEmpty()) { + ItemStack itemStack3 = itemStack2.copyWithCount(mouseButton == 0 ? 1 : itemStack2.getMaxStackSize()); + this.minecraft.player.drop(itemStack3, true); + this.minecraft.gameMode.handleCreativeModeItemDrop(itemStack3); + } + + return; + } + + if (!itemStack.isEmpty() && !itemStack2.isEmpty() && ItemStack.isSameItemSameComponents(itemStack, itemStack2)) { + if (mouseButton == 0) { + if (bl) { + itemStack.setCount(itemStack.getMaxStackSize()); + } else if (itemStack.getCount() < itemStack.getMaxStackSize()) { + itemStack.grow(1); + } + } else { + itemStack.shrink(1); + } + } else if (!itemStack2.isEmpty() && itemStack.isEmpty()) { + int j = bl ? itemStack2.getMaxStackSize() : itemStack2.getCount(); + this.menu.setCarried(itemStack2.copyWithCount(j)); + } else if (mouseButton == 0) { + this.menu.setCarried(ItemStack.EMPTY); + } else if (!this.menu.getCarried().isEmpty()) { + this.menu.getCarried().shrink(1); + } + } else if (this.menu != null) { + ItemStack itemStackx = slot == null ? ItemStack.EMPTY : this.menu.getSlot(slot.index).getItem(); + this.menu.clicked(slot == null ? slotId : slot.index, mouseButton, type, this.minecraft.player); + if (AbstractContainerMenu.getQuickcraftHeader(mouseButton) == 2) { + for (int k = 0; k < 9; k++) { + this.minecraft.gameMode.handleCreativeModeItemAdd(this.menu.getSlot(45 + k).getItem(), 36 + k); + } + } else if (slot != null && Inventory.isHotbarSlot(slot.getContainerSlot()) && selectedTab.getType() != Type.INVENTORY) { + if (type == ClickType.THROW && !itemStackx.isEmpty() && !this.menu.getCarried().isEmpty()) { + int k = mouseButton == 0 ? 1 : itemStackx.getCount(); + ItemStack itemStack3 = itemStackx.copyWithCount(k); + itemStackx.shrink(k); + this.minecraft.player.drop(itemStack3, true); + this.minecraft.gameMode.handleCreativeModeItemDrop(itemStack3); + } + + this.minecraft.player.inventoryMenu.broadcastChanges(); + } } } } @@ -376,7 +388,7 @@ public class CreativeModeInventoryScreen extends EffectRenderingInventoryScreen< public boolean charTyped(char codePoint, int modifiers) { if (this.ignoreTextInput) { return false; - } else if (selectedTab.getType() != CreativeModeTab.Type.SEARCH) { + } else if (selectedTab.getType() != Type.SEARCH) { return false; } else { String string = this.searchBox.getValue(); @@ -395,7 +407,7 @@ public class CreativeModeInventoryScreen extends EffectRenderingInventoryScreen< @Override public boolean keyPressed(int keyCode, int scanCode, int modifiers) { this.ignoreTextInput = false; - if (selectedTab.getType() != CreativeModeTab.Type.SEARCH) { + if (selectedTab.getType() != Type.SEARCH) { if (this.minecraft.options.keyChat.matches(keyCode, scanCode)) { this.ignoreTextInput = true; this.selectTab(CreativeModeTabs.searchTab()); @@ -468,7 +480,7 @@ public class CreativeModeInventoryScreen extends EffectRenderingInventoryScreen< predicate = resourceLocation -> resourceLocation.getNamespace().contains(string) && resourceLocation.getPath().contains(string2); } - BuiltInRegistries.ITEM.getTagNames().filter(tagKey -> predicate.test(tagKey.location())).forEach(this.visibleTags::add); + BuiltInRegistries.ITEM.getTags().map(HolderSet.Named::key).filter(tagKey -> predicate.test(tagKey.location())).forEach(this.visibleTags::add); } @Override @@ -490,7 +502,7 @@ public class CreativeModeInventoryScreen extends EffectRenderingInventoryScreen< } } - if (selectedTab.getType() != CreativeModeTab.Type.INVENTORY && this.insideScrollbar(mouseX, mouseY)) { + if (selectedTab.getType() != Type.INVENTORY && this.insideScrollbar(mouseX, mouseY)) { this.scrolling = this.canScroll(); return true; } @@ -533,7 +545,7 @@ public class CreativeModeInventoryScreen extends EffectRenderingInventoryScreen< this.quickCraftSlots.clear(); this.menu.items.clear(); this.clearDraggingState(); - if (selectedTab.getType() == CreativeModeTab.Type.HOTBAR) { + if (selectedTab.getType() == Type.HOTBAR) { HotbarManager hotbarManager = this.minecraft.getHotbarManager(); for (int i = 0; i < 9; i++) { @@ -555,11 +567,11 @@ public class CreativeModeInventoryScreen extends EffectRenderingInventoryScreen< this.menu.items.addAll(hotbar.load(this.minecraft.level.registryAccess())); } } - } else if (selectedTab.getType() == CreativeModeTab.Type.CATEGORY) { + } else if (selectedTab.getType() == Type.CATEGORY) { this.menu.items.addAll(selectedTab.getDisplayItems()); } - if (selectedTab.getType() == CreativeModeTab.Type.INVENTORY) { + if (selectedTab.getType() == Type.INVENTORY) { AbstractContainerMenu abstractContainerMenu = this.minecraft.player.inventoryMenu; if (this.originalSlots == null) { this.originalSlots = ImmutableList.copyOf(this.menu.slots); @@ -600,13 +612,13 @@ public class CreativeModeInventoryScreen extends EffectRenderingInventoryScreen< this.destroyItemSlot = new Slot(CONTAINER, 0, 173, 112); this.menu.slots.add(this.destroyItemSlot); - } else if (creativeModeTab.getType() == CreativeModeTab.Type.INVENTORY) { + } else if (creativeModeTab.getType() == Type.INVENTORY) { this.menu.slots.clear(); this.menu.slots.addAll(this.originalSlots); this.originalSlots = null; } - if (selectedTab.getType() == CreativeModeTab.Type.SEARCH) { + if (selectedTab.getType() == Type.SEARCH) { this.searchBox.setVisible(true); this.searchBox.setCanLoseFocus(false); this.searchBox.setFocused(true); @@ -628,7 +640,9 @@ public class CreativeModeInventoryScreen extends EffectRenderingInventoryScreen< @Override public boolean mouseScrolled(double mouseX, double mouseY, double scrollX, double scrollY) { - if (!this.canScroll()) { + if (super.mouseScrolled(mouseX, mouseY, scrollX, scrollY)) { + return true; + } else if (!this.canScroll()) { return false; } else { this.scrollOffs = this.menu.subtractInputFromScroll(this.scrollOffs, scrollY); @@ -671,6 +685,7 @@ public class CreativeModeInventoryScreen extends EffectRenderingInventoryScreen< @Override public void render(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) { super.render(guiGraphics, mouseX, mouseY, partialTick); + this.effects.render(guiGraphics, mouseX, mouseY, partialTick); for (CreativeModeTab creativeModeTab : CreativeModeTabs.tabs()) { if (this.checkTabHovering(guiGraphics, creativeModeTab, mouseX, mouseY)) { @@ -679,7 +694,7 @@ public class CreativeModeInventoryScreen extends EffectRenderingInventoryScreen< } if (this.destroyItemSlot != null - && selectedTab.getType() == CreativeModeTab.Type.INVENTORY + && selectedTab.getType() == Type.INVENTORY && this.isHovering(this.destroyItemSlot.x, this.destroyItemSlot.y, 16, 16, mouseX, mouseY)) { guiGraphics.renderTooltip(this.font, TRASH_SLOT_TOOLTIP, mouseX, mouseY); } @@ -687,12 +702,17 @@ public class CreativeModeInventoryScreen extends EffectRenderingInventoryScreen< this.renderTooltip(guiGraphics, mouseX, mouseY); } + @Override + public boolean showsActiveEffects() { + return this.effects.canSeeEffects(); + } + @Override public List getTooltipFromContainerItem(ItemStack stack) { boolean bl = this.hoveredSlot != null && this.hoveredSlot instanceof CreativeModeInventoryScreen.CustomCreativeSlot; - boolean bl2 = selectedTab.getType() == CreativeModeTab.Type.CATEGORY; - boolean bl3 = selectedTab.getType() == CreativeModeTab.Type.SEARCH; - TooltipFlag.Default default_ = this.minecraft.options.advancedItemTooltips ? TooltipFlag.Default.ADVANCED : TooltipFlag.Default.NORMAL; + boolean bl2 = selectedTab.getType() == Type.CATEGORY; + boolean bl3 = selectedTab.getType() == Type.SEARCH; + Default default_ = this.minecraft.options.advancedItemTooltips ? Default.ADVANCED : Default.NORMAL; TooltipFlag tooltipFlag = bl ? default_.asCreative() : default_; List list = stack.getTooltipLines(Item.TooltipContext.of(this.minecraft.level), this.minecraft.player, tooltipFlag); if (bl2 && bl) { @@ -710,7 +730,7 @@ public class CreativeModeInventoryScreen extends EffectRenderingInventoryScreen< int i = 1; for (CreativeModeTab creativeModeTab : CreativeModeTabs.tabs()) { - if (creativeModeTab.getType() != CreativeModeTab.Type.SEARCH && creativeModeTab.contains(stack)) { + if (creativeModeTab.getType() != Type.SEARCH && creativeModeTab.contains(stack)) { list2.add(i++, creativeModeTab.getDisplayName().copy().withStyle(ChatFormatting.BLUE)); } } @@ -727,18 +747,20 @@ public class CreativeModeInventoryScreen extends EffectRenderingInventoryScreen< } } - guiGraphics.blit(selectedTab.getBackgroundTexture(), this.leftPos, this.topPos, 0, 0, this.imageWidth, this.imageHeight); + guiGraphics.blit( + RenderType::guiTextured, selectedTab.getBackgroundTexture(), this.leftPos, this.topPos, 0.0F, 0.0F, this.imageWidth, this.imageHeight, 256, 256 + ); this.searchBox.render(guiGraphics, mouseX, mouseY, partialTick); int i = this.leftPos + 175; int j = this.topPos + 18; int k = j + 112; if (selectedTab.canScroll()) { ResourceLocation resourceLocation = this.canScroll() ? SCROLLER_SPRITE : SCROLLER_DISABLED_SPRITE; - guiGraphics.blitSprite(resourceLocation, i, j + (int)((k - j - 17) * this.scrollOffs), 12, 15); + guiGraphics.blitSprite(RenderType::guiTextured, resourceLocation, i, j + (int)((k - j - 17) * this.scrollOffs), 12, 15); } this.renderTabButton(guiGraphics, selectedTab); - if (selectedTab.getType() == CreativeModeTab.Type.INVENTORY) { + if (selectedTab.getType() == Type.INVENTORY) { InventoryScreen.renderEntityInInventoryFollowsMouse( guiGraphics, this.leftPos + 73, this.topPos + 6, this.leftPos + 105, this.topPos + 49, 20, 0.0625F, mouseX, mouseY, this.minecraft.player ); @@ -758,7 +780,7 @@ public class CreativeModeInventoryScreen extends EffectRenderingInventoryScreen< private int getTabY(CreativeModeTab tab) { int i = 0; - if (tab.row() == CreativeModeTab.Row.TOP) { + if (tab.row() == Row.TOP) { i -= 32; } else { i += this.imageHeight; @@ -786,7 +808,7 @@ public class CreativeModeInventoryScreen extends EffectRenderingInventoryScreen< protected void renderTabButton(GuiGraphics guiGraphics, CreativeModeTab creativeModeTab) { boolean bl = creativeModeTab == selectedTab; - boolean bl2 = creativeModeTab.row() == CreativeModeTab.Row.TOP; + boolean bl2 = creativeModeTab.row() == Row.TOP; int i = creativeModeTab.column(); int j = this.leftPos + this.getTabX(creativeModeTab); int k = this.topPos - (bl2 ? 28 : -(this.imageHeight - 4)); @@ -797,7 +819,7 @@ public class CreativeModeInventoryScreen extends EffectRenderingInventoryScreen< resourceLocations = bl ? SELECTED_BOTTOM_TABS : UNSELECTED_BOTTOM_TABS; } - guiGraphics.blitSprite(resourceLocations[Mth.clamp(i, 0, resourceLocations.length)], j, k, 26, 32); + guiGraphics.blitSprite(RenderType::guiTextured, resourceLocations[Mth.clamp(i, 0, resourceLocations.length)], j, k, 26, 32); guiGraphics.pose().pushPose(); guiGraphics.pose().translate(0.0F, 0.0F, 100.0F); j += 5; @@ -809,7 +831,7 @@ public class CreativeModeInventoryScreen extends EffectRenderingInventoryScreen< } public boolean isInventoryOpen() { - return selectedTab.getType() == CreativeModeTab.Type.INVENTORY; + return selectedTab.getType() == Type.INVENTORY; } public static void handleHotbarLoadOrSave(Minecraft client, int index, boolean load, boolean save) { @@ -872,10 +894,7 @@ public class CreativeModeInventoryScreen extends EffectRenderingInventoryScreen< } } - for (int i = 0; i < 9; i++) { - this.addSlot(new Slot(inventory, i, 9 + i * 18, 112)); - } - + this.addInventoryHotbarSlots(inventory, 9, 112); this.scrollTo(0.0F); } diff --git a/net/minecraft/client/gui/screens/inventory/CyclingSlotBackground.java b/net/minecraft/client/gui/screens/inventory/CyclingSlotBackground.java index f8372f54..476e5595 100644 --- a/net/minecraft/client/gui/screens/inventory/CyclingSlotBackground.java +++ b/net/minecraft/client/gui/screens/inventory/CyclingSlotBackground.java @@ -5,9 +5,11 @@ import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.texture.TextureAtlas; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.ARGB; import net.minecraft.world.inventory.AbstractContainerMenu; import net.minecraft.world.inventory.Slot; @@ -52,7 +54,7 @@ public class CyclingSlotBackground { private void renderIcon(Slot slot, ResourceLocation icon, float alpha, GuiGraphics guiGraphics, int x, int y) { TextureAtlasSprite textureAtlasSprite = (TextureAtlasSprite)Minecraft.getInstance().getTextureAtlas(TextureAtlas.LOCATION_BLOCKS).apply(icon); - guiGraphics.blit(x + slot.x, y + slot.y, 0, 16, 16, textureAtlasSprite, 1.0F, 1.0F, 1.0F, alpha); + guiGraphics.blitSprite(RenderType::guiTextured, textureAtlasSprite, x + slot.x, y + slot.y, 16, 16, ARGB.white(alpha)); } private float getIconTransitionTransparency(float partialTick) { diff --git a/net/minecraft/client/gui/screens/inventory/DispenserScreen.java b/net/minecraft/client/gui/screens/inventory/DispenserScreen.java index ad6e8cf1..ee3fe48c 100644 --- a/net/minecraft/client/gui/screens/inventory/DispenserScreen.java +++ b/net/minecraft/client/gui/screens/inventory/DispenserScreen.java @@ -3,6 +3,7 @@ package net.minecraft.client.gui.screens.inventory; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.renderer.RenderType; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.player.Inventory; @@ -32,6 +33,6 @@ public class DispenserScreen extends AbstractContainerScreen { protected void renderBg(GuiGraphics guiGraphics, float partialTick, int mouseX, int mouseY) { int i = (this.width - this.imageWidth) / 2; int j = (this.height - this.imageHeight) / 2; - guiGraphics.blit(CONTAINER_LOCATION, i, j, 0, 0, this.imageWidth, this.imageHeight); + guiGraphics.blit(RenderType::guiTextured, CONTAINER_LOCATION, i, j, 0.0F, 0.0F, this.imageWidth, this.imageHeight, 256, 256); } } diff --git a/net/minecraft/client/gui/screens/inventory/EffectRenderingInventoryScreen.java b/net/minecraft/client/gui/screens/inventory/EffectRenderingInventoryScreen.java deleted file mode 100644 index 3cb7b847..00000000 --- a/net/minecraft/client/gui/screens/inventory/EffectRenderingInventoryScreen.java +++ /dev/null @@ -1,128 +0,0 @@ -package net.minecraft.client.gui.screens.inventory; - -import com.google.common.collect.Ordering; -import java.util.Collection; -import java.util.List; -import java.util.Optional; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.client.gui.GuiGraphics; -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.client.resources.MobEffectTextureManager; -import net.minecraft.core.Holder; -import net.minecraft.network.chat.CommonComponents; -import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.MutableComponent; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.effect.MobEffect; -import net.minecraft.world.effect.MobEffectInstance; -import net.minecraft.world.effect.MobEffectUtil; -import net.minecraft.world.entity.player.Inventory; -import net.minecraft.world.inventory.AbstractContainerMenu; - -@Environment(EnvType.CLIENT) -public abstract class EffectRenderingInventoryScreen extends AbstractContainerScreen { - private static final ResourceLocation EFFECT_BACKGROUND_LARGE_SPRITE = ResourceLocation.withDefaultNamespace("container/inventory/effect_background_large"); - private static final ResourceLocation EFFECT_BACKGROUND_SMALL_SPRITE = ResourceLocation.withDefaultNamespace("container/inventory/effect_background_small"); - - public EffectRenderingInventoryScreen(T menu, Inventory playerInventory, Component title) { - super(menu, playerInventory, title); - } - - @Override - public void render(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) { - super.render(guiGraphics, mouseX, mouseY, partialTick); - this.renderEffects(guiGraphics, mouseX, mouseY); - } - - public boolean canSeeEffects() { - int i = this.leftPos + this.imageWidth + 2; - int j = this.width - i; - return j >= 32; - } - - private void renderEffects(GuiGraphics guiGraphics, int mouseX, int mouseY) { - int i = this.leftPos + this.imageWidth + 2; - int j = this.width - i; - Collection collection = this.minecraft.player.getActiveEffects(); - if (!collection.isEmpty() && j >= 32) { - boolean bl = j >= 120; - int k = 33; - if (collection.size() > 5) { - k = 132 / (collection.size() - 1); - } - - Iterable iterable = Ordering.natural().sortedCopy(collection); - this.renderBackgrounds(guiGraphics, i, k, iterable, bl); - this.renderIcons(guiGraphics, i, k, iterable, bl); - if (bl) { - this.renderLabels(guiGraphics, i, k, iterable); - } else if (mouseX >= i && mouseX <= i + 33) { - int l = this.topPos; - MobEffectInstance mobEffectInstance = null; - - for (MobEffectInstance mobEffectInstance2 : iterable) { - if (mouseY >= l && mouseY <= l + k) { - mobEffectInstance = mobEffectInstance2; - } - - l += k; - } - - if (mobEffectInstance != null) { - List list = List.of( - this.getEffectName(mobEffectInstance), MobEffectUtil.formatDuration(mobEffectInstance, 1.0F, this.minecraft.level.tickRateManager().tickrate()) - ); - guiGraphics.renderTooltip(this.font, list, Optional.empty(), mouseX, mouseY); - } - } - } - } - - private void renderBackgrounds(GuiGraphics guiGraphics, int renderX, int yOffset, Iterable effects, boolean isSmall) { - int i = this.topPos; - - for (MobEffectInstance mobEffectInstance : effects) { - if (isSmall) { - guiGraphics.blitSprite(EFFECT_BACKGROUND_LARGE_SPRITE, renderX, i, 120, 32); - } else { - guiGraphics.blitSprite(EFFECT_BACKGROUND_SMALL_SPRITE, renderX, i, 32, 32); - } - - i += yOffset; - } - } - - private void renderIcons(GuiGraphics guiGraphics, int renderX, int yOffset, Iterable effects, boolean isSmall) { - MobEffectTextureManager mobEffectTextureManager = this.minecraft.getMobEffectTextures(); - int i = this.topPos; - - for (MobEffectInstance mobEffectInstance : effects) { - Holder holder = mobEffectInstance.getEffect(); - TextureAtlasSprite textureAtlasSprite = mobEffectTextureManager.get(holder); - guiGraphics.blit(renderX + (isSmall ? 6 : 7), i + 7, 0, 18, 18, textureAtlasSprite); - i += yOffset; - } - } - - private void renderLabels(GuiGraphics guiGraphics, int renderX, int yOffset, Iterable effects) { - int i = this.topPos; - - for (MobEffectInstance mobEffectInstance : effects) { - Component component = this.getEffectName(mobEffectInstance); - guiGraphics.drawString(this.font, component, renderX + 10 + 18, i + 6, 16777215); - Component component2 = MobEffectUtil.formatDuration(mobEffectInstance, 1.0F, this.minecraft.level.tickRateManager().tickrate()); - guiGraphics.drawString(this.font, component2, renderX + 10 + 18, i + 6 + 10, 8355711); - i += yOffset; - } - } - - private Component getEffectName(MobEffectInstance effect) { - MutableComponent mutableComponent = effect.getEffect().value().getDisplayName().copy(); - if (effect.getAmplifier() >= 1 && effect.getAmplifier() <= 9) { - mutableComponent.append(CommonComponents.SPACE).append(Component.translatable("enchantment.level." + (effect.getAmplifier() + 1))); - } - - return mutableComponent; - } -} diff --git a/net/minecraft/client/gui/screens/inventory/EffectsInInventory.java b/net/minecraft/client/gui/screens/inventory/EffectsInInventory.java new file mode 100644 index 00000000..869cbb9c --- /dev/null +++ b/net/minecraft/client/gui/screens/inventory/EffectsInInventory.java @@ -0,0 +1,129 @@ +package net.minecraft.client.gui.screens.inventory; + +import com.google.common.collect.Ordering; +import java.util.Collection; +import java.util.List; +import java.util.Optional; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.resources.MobEffectTextureManager; +import net.minecraft.core.Holder; +import net.minecraft.network.chat.CommonComponents; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.MutableComponent; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.effect.MobEffect; +import net.minecraft.world.effect.MobEffectInstance; +import net.minecraft.world.effect.MobEffectUtil; + +@Environment(EnvType.CLIENT) +public class EffectsInInventory { + private static final ResourceLocation EFFECT_BACKGROUND_LARGE_SPRITE = ResourceLocation.withDefaultNamespace("container/inventory/effect_background_large"); + private static final ResourceLocation EFFECT_BACKGROUND_SMALL_SPRITE = ResourceLocation.withDefaultNamespace("container/inventory/effect_background_small"); + private final AbstractContainerScreen screen; + private final Minecraft minecraft; + + public EffectsInInventory(AbstractContainerScreen abstractContainerScreen) { + this.screen = abstractContainerScreen; + this.minecraft = Minecraft.getInstance(); + } + + public void render(GuiGraphics guiGraphics, int i, int j, float f) { + this.renderEffects(guiGraphics, i, j); + } + + public boolean canSeeEffects() { + int i = this.screen.leftPos + this.screen.imageWidth + 2; + int j = this.screen.width - i; + return j >= 32; + } + + private void renderEffects(GuiGraphics guiGraphics, int i, int j) { + int k = this.screen.leftPos + this.screen.imageWidth + 2; + int l = this.screen.width - k; + Collection collection = this.minecraft.player.getActiveEffects(); + if (!collection.isEmpty() && l >= 32) { + boolean bl = l >= 120; + int m = 33; + if (collection.size() > 5) { + m = 132 / (collection.size() - 1); + } + + Iterable iterable = Ordering.natural().sortedCopy(collection); + this.renderBackgrounds(guiGraphics, k, m, iterable, bl); + this.renderIcons(guiGraphics, k, m, iterable, bl); + if (bl) { + this.renderLabels(guiGraphics, k, m, iterable); + } else if (i >= k && i <= k + 33) { + int n = this.screen.topPos; + MobEffectInstance mobEffectInstance = null; + + for (MobEffectInstance mobEffectInstance2 : iterable) { + if (j >= n && j <= n + m) { + mobEffectInstance = mobEffectInstance2; + } + + n += m; + } + + if (mobEffectInstance != null) { + List list = List.of( + this.getEffectName(mobEffectInstance), MobEffectUtil.formatDuration(mobEffectInstance, 1.0F, this.minecraft.level.tickRateManager().tickrate()) + ); + guiGraphics.renderTooltip(this.screen.getFont(), list, Optional.empty(), i, j); + } + } + } + } + + private void renderBackgrounds(GuiGraphics guiGraphics, int i, int j, Iterable iterable, boolean bl) { + int k = this.screen.topPos; + + for (MobEffectInstance mobEffectInstance : iterable) { + if (bl) { + guiGraphics.blitSprite(RenderType::guiTextured, EFFECT_BACKGROUND_LARGE_SPRITE, i, k, 120, 32); + } else { + guiGraphics.blitSprite(RenderType::guiTextured, EFFECT_BACKGROUND_SMALL_SPRITE, i, k, 32, 32); + } + + k += j; + } + } + + private void renderIcons(GuiGraphics guiGraphics, int i, int j, Iterable iterable, boolean bl) { + MobEffectTextureManager mobEffectTextureManager = this.minecraft.getMobEffectTextures(); + int k = this.screen.topPos; + + for (MobEffectInstance mobEffectInstance : iterable) { + Holder holder = mobEffectInstance.getEffect(); + TextureAtlasSprite textureAtlasSprite = mobEffectTextureManager.get(holder); + guiGraphics.blitSprite(RenderType::guiTextured, textureAtlasSprite, i + (bl ? 6 : 7), k + 7, 18, 18); + k += j; + } + } + + private void renderLabels(GuiGraphics guiGraphics, int i, int j, Iterable iterable) { + int k = this.screen.topPos; + + for (MobEffectInstance mobEffectInstance : iterable) { + Component component = this.getEffectName(mobEffectInstance); + guiGraphics.drawString(this.screen.getFont(), component, i + 10 + 18, k + 6, 16777215); + Component component2 = MobEffectUtil.formatDuration(mobEffectInstance, 1.0F, this.minecraft.level.tickRateManager().tickrate()); + guiGraphics.drawString(this.screen.getFont(), component2, i + 10 + 18, k + 6 + 10, 8355711); + k += j; + } + } + + private Component getEffectName(MobEffectInstance mobEffectInstance) { + MutableComponent mutableComponent = mobEffectInstance.getEffect().value().getDisplayName().copy(); + if (mobEffectInstance.getAmplifier() >= 1 && mobEffectInstance.getAmplifier() <= 9) { + mutableComponent.append(CommonComponents.SPACE).append(Component.translatable("enchantment.level." + (mobEffectInstance.getAmplifier() + 1))); + } + + return mutableComponent; + } +} diff --git a/net/minecraft/client/gui/screens/inventory/EnchantmentScreen.java b/net/minecraft/client/gui/screens/inventory/EnchantmentScreen.java index fd05b900..9e653c49 100644 --- a/net/minecraft/client/gui/screens/inventory/EnchantmentScreen.java +++ b/net/minecraft/client/gui/screens/inventory/EnchantmentScreen.java @@ -2,7 +2,6 @@ package net.minecraft.client.gui.screens.inventory; import com.google.common.collect.Lists; import com.mojang.blaze3d.platform.Lighting; -import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.VertexConsumer; import com.mojang.math.Axis; import java.util.List; @@ -13,6 +12,7 @@ import net.minecraft.ChatFormatting; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.model.BookModel; import net.minecraft.client.model.geom.ModelLayers; +import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.core.Holder; import net.minecraft.core.registries.Registries; @@ -60,7 +60,6 @@ public class EnchantmentScreen extends AbstractContainerScreen */ private final RandomSource random = RandomSource.create(); private BookModel bookModel; - public int time; public float flip; public float oFlip; public float flipT; @@ -106,7 +105,7 @@ public class EnchantmentScreen extends AbstractContainerScreen protected void renderBg(GuiGraphics guiGraphics, float partialTick, int mouseX, int mouseY) { int i = (this.width - this.imageWidth) / 2; int j = (this.height - this.imageHeight) / 2; - guiGraphics.blit(ENCHANTING_TABLE_LOCATION, i, j, 0, 0, this.imageWidth, this.imageHeight); + guiGraphics.blit(RenderType::guiTextured, ENCHANTING_TABLE_LOCATION, i, j, 0.0F, 0.0F, this.imageWidth, this.imageHeight, 256, 256); this.renderBook(guiGraphics, i, j, partialTick); EnchantmentNames.getInstance().initSeed(this.menu.getEnchantmentSeed()); int k = this.menu.getGoldCount(); @@ -116,34 +115,28 @@ public class EnchantmentScreen extends AbstractContainerScreen int n = m + 20; int o = this.menu.costs[l]; if (o == 0) { - RenderSystem.enableBlend(); - guiGraphics.blitSprite(ENCHANTMENT_SLOT_DISABLED_SPRITE, m, j + 14 + 19 * l, 108, 19); - RenderSystem.disableBlend(); + guiGraphics.blitSprite(RenderType::guiTextured, ENCHANTMENT_SLOT_DISABLED_SPRITE, m, j + 14 + 19 * l, 108, 19); } else { String string = o + ""; int p = 86 - this.font.width(string); FormattedText formattedText = EnchantmentNames.getInstance().getRandomName(this.font, p); int q = 6839882; if ((k < l + 1 || this.minecraft.player.experienceLevel < o) && !this.minecraft.player.getAbilities().instabuild) { - RenderSystem.enableBlend(); - guiGraphics.blitSprite(ENCHANTMENT_SLOT_DISABLED_SPRITE, m, j + 14 + 19 * l, 108, 19); - guiGraphics.blitSprite(DISABLED_LEVEL_SPRITES[l], m + 1, j + 15 + 19 * l, 16, 16); - RenderSystem.disableBlend(); + guiGraphics.blitSprite(RenderType::guiTextured, ENCHANTMENT_SLOT_DISABLED_SPRITE, m, j + 14 + 19 * l, 108, 19); + guiGraphics.blitSprite(RenderType::guiTextured, DISABLED_LEVEL_SPRITES[l], m + 1, j + 15 + 19 * l, 16, 16); guiGraphics.drawWordWrap(this.font, formattedText, n, j + 16 + 19 * l, p, (q & 16711422) >> 1); q = 4226832; } else { int r = mouseX - (i + 60); int s = mouseY - (j + 14 + 19 * l); - RenderSystem.enableBlend(); if (r >= 0 && s >= 0 && r < 108 && s < 19) { - guiGraphics.blitSprite(ENCHANTMENT_SLOT_HIGHLIGHTED_SPRITE, m, j + 14 + 19 * l, 108, 19); + guiGraphics.blitSprite(RenderType::guiTextured, ENCHANTMENT_SLOT_HIGHLIGHTED_SPRITE, m, j + 14 + 19 * l, 108, 19); q = 16777088; } else { - guiGraphics.blitSprite(ENCHANTMENT_SLOT_SPRITE, m, j + 14 + 19 * l, 108, 19); + guiGraphics.blitSprite(RenderType::guiTextured, ENCHANTMENT_SLOT_SPRITE, m, j + 14 + 19 * l, 108, 19); } - guiGraphics.blitSprite(ENABLED_LEVEL_SPRITES[l], m + 1, j + 15 + 19 * l, 16, 16); - RenderSystem.disableBlend(); + guiGraphics.blitSprite(RenderType::guiTextured, ENABLED_LEVEL_SPRITES[l], m + 1, j + 15 + 19 * l, 16, 16); guiGraphics.drawWordWrap(this.font, formattedText, n, j + 16 + 19 * l, p, q); q = 8453920; } @@ -156,6 +149,7 @@ public class EnchantmentScreen extends AbstractContainerScreen private void renderBook(GuiGraphics guiGraphics, int x, int y, float partialTick) { float f = Mth.lerp(partialTick, this.oOpen, this.open); float g = Mth.lerp(partialTick, this.oFlip, this.flip); + guiGraphics.flush(); Lighting.setupForEntityInInventory(); guiGraphics.pose().pushPose(); guiGraphics.pose().translate(x + 33.0F, y + 31.0F, 100.0F); @@ -169,8 +163,10 @@ public class EnchantmentScreen extends AbstractContainerScreen float j = Mth.clamp(Mth.frac(g + 0.25F) * 1.6F - 0.3F, 0.0F, 1.0F); float k = Mth.clamp(Mth.frac(g + 0.75F) * 1.6F - 0.3F, 0.0F, 1.0F); this.bookModel.setupAnim(0.0F, j, k, f); - VertexConsumer vertexConsumer = guiGraphics.bufferSource().getBuffer(this.bookModel.renderType(ENCHANTING_BOOK_LOCATION)); - this.bookModel.renderToBuffer(guiGraphics.pose(), vertexConsumer, 15728880, OverlayTexture.NO_OVERLAY); + guiGraphics.drawSpecial(multiBufferSource -> { + VertexConsumer vertexConsumer = multiBufferSource.getBuffer(this.bookModel.renderType(ENCHANTING_BOOK_LOCATION)); + this.bookModel.renderToBuffer(guiGraphics.pose(), vertexConsumer, 15728880, OverlayTexture.NO_OVERLAY); + }); guiGraphics.flush(); guiGraphics.pose().popPose(); Lighting.setupFor3DItems(); @@ -178,18 +174,15 @@ public class EnchantmentScreen extends AbstractContainerScreen @Override public void render(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) { - super.render(guiGraphics, mouseX, mouseY, partialTick); + float f = this.minecraft.getDeltaTracker().getGameTimeDeltaPartialTick(false); + super.render(guiGraphics, mouseX, mouseY, f); this.renderTooltip(guiGraphics, mouseX, mouseY); boolean bl = this.minecraft.player.getAbilities().instabuild; int i = this.menu.getGoldCount(); for (int j = 0; j < 3; j++) { int k = this.menu.costs[j]; - Optional> optional = this.minecraft - .level - .registryAccess() - .registryOrThrow(Registries.ENCHANTMENT) - .getHolder(this.menu.enchantClue[j]); + Optional> optional = this.minecraft.level.registryAccess().lookupOrThrow(Registries.ENCHANTMENT).get(this.menu.enchantClue[j]); if (!optional.isEmpty()) { int l = this.menu.levelClue[j]; int m = j + 1; @@ -237,7 +230,6 @@ public class EnchantmentScreen extends AbstractContainerScreen } while (this.flip <= this.flipT + 1.0F && this.flip >= this.flipT - 1.0F); } - this.time++; this.oFlip = this.flip; this.oOpen = this.open; boolean bl = false; diff --git a/net/minecraft/client/gui/screens/inventory/FurnaceScreen.java b/net/minecraft/client/gui/screens/inventory/FurnaceScreen.java index a66f375a..57f34f2b 100644 --- a/net/minecraft/client/gui/screens/inventory/FurnaceScreen.java +++ b/net/minecraft/client/gui/screens/inventory/FurnaceScreen.java @@ -1,20 +1,31 @@ package net.minecraft.client.gui.screens.inventory; +import java.util.List; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; -import net.minecraft.client.gui.screens.recipebook.SmeltingRecipeBookComponent; +import net.minecraft.client.gui.screens.recipebook.RecipeBookComponent; +import net.minecraft.client.gui.screens.recipebook.SearchRecipeBookCategory; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.inventory.FurnaceMenu; +import net.minecraft.world.item.Items; +import net.minecraft.world.item.crafting.RecipeBookCategories; @Environment(EnvType.CLIENT) public class FurnaceScreen extends AbstractFurnaceScreen { private static final ResourceLocation LIT_PROGRESS_SPRITE = ResourceLocation.withDefaultNamespace("container/furnace/lit_progress"); private static final ResourceLocation BURN_PROGRESS_SPRITE = ResourceLocation.withDefaultNamespace("container/furnace/burn_progress"); private static final ResourceLocation TEXTURE = ResourceLocation.withDefaultNamespace("textures/gui/container/furnace.png"); + private static final Component FILTER_NAME = Component.translatable("gui.recipebook.toggleRecipes.smeltable"); + private static final List TABS = List.of( + new RecipeBookComponent.TabInfo(SearchRecipeBookCategory.FURNACE), + new RecipeBookComponent.TabInfo(Items.PORKCHOP, RecipeBookCategories.FURNACE_FOOD), + new RecipeBookComponent.TabInfo(Items.STONE, RecipeBookCategories.FURNACE_BLOCKS), + new RecipeBookComponent.TabInfo(Items.LAVA_BUCKET, Items.EMERALD, RecipeBookCategories.FURNACE_MISC) + ); public FurnaceScreen(FurnaceMenu menu, Inventory playerInventory, Component title) { - super(menu, new SmeltingRecipeBookComponent(), playerInventory, title, TEXTURE, LIT_PROGRESS_SPRITE, BURN_PROGRESS_SPRITE); + super(menu, playerInventory, title, FILTER_NAME, TEXTURE, LIT_PROGRESS_SPRITE, BURN_PROGRESS_SPRITE, TABS); } } diff --git a/net/minecraft/client/gui/screens/inventory/GrindstoneScreen.java b/net/minecraft/client/gui/screens/inventory/GrindstoneScreen.java index 8e7ef610..d9a1fbc7 100644 --- a/net/minecraft/client/gui/screens/inventory/GrindstoneScreen.java +++ b/net/minecraft/client/gui/screens/inventory/GrindstoneScreen.java @@ -3,6 +3,7 @@ package net.minecraft.client.gui.screens.inventory; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.renderer.RenderType; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.player.Inventory; @@ -27,9 +28,9 @@ public class GrindstoneScreen extends AbstractContainerScreen { protected void renderBg(GuiGraphics guiGraphics, float partialTick, int mouseX, int mouseY) { int i = (this.width - this.imageWidth) / 2; int j = (this.height - this.imageHeight) / 2; - guiGraphics.blit(GRINDSTONE_LOCATION, i, j, 0, 0, this.imageWidth, this.imageHeight); + guiGraphics.blit(RenderType::guiTextured, GRINDSTONE_LOCATION, i, j, 0.0F, 0.0F, this.imageWidth, this.imageHeight, 256, 256); if ((this.menu.getSlot(0).hasItem() || this.menu.getSlot(1).hasItem()) && !this.menu.getSlot(2).hasItem()) { - guiGraphics.blitSprite(ERROR_SPRITE, i + 92, j + 31, 28, 21); + guiGraphics.blitSprite(RenderType::guiTextured, ERROR_SPRITE, i + 92, j + 31, 28, 21); } } } diff --git a/net/minecraft/client/gui/screens/inventory/HangingSignEditScreen.java b/net/minecraft/client/gui/screens/inventory/HangingSignEditScreen.java index a5ebdcd6..479593c0 100644 --- a/net/minecraft/client/gui/screens/inventory/HangingSignEditScreen.java +++ b/net/minecraft/client/gui/screens/inventory/HangingSignEditScreen.java @@ -3,6 +3,7 @@ package net.minecraft.client.gui.screens.inventory; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.renderer.RenderType; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.level.block.entity.SignBlockEntity; @@ -27,10 +28,10 @@ public class HangingSignEditScreen extends AbstractSignEditScreen { } @Override - protected void renderSignBackground(GuiGraphics guiGraphics, BlockState state) { + protected void renderSignBackground(GuiGraphics guiGraphics) { guiGraphics.pose().translate(0.0F, -13.0F, 0.0F); guiGraphics.pose().scale(4.5F, 4.5F, 1.0F); - guiGraphics.blit(this.texture, -8, -8, 0.0F, 0.0F, 16, 16, 16, 16); + guiGraphics.blit(RenderType::guiTextured, this.texture, -8, -8, 0.0F, 0.0F, 16, 16, 16, 16); } @Override diff --git a/net/minecraft/client/gui/screens/inventory/HopperScreen.java b/net/minecraft/client/gui/screens/inventory/HopperScreen.java index a85dd77c..466ba739 100644 --- a/net/minecraft/client/gui/screens/inventory/HopperScreen.java +++ b/net/minecraft/client/gui/screens/inventory/HopperScreen.java @@ -3,6 +3,7 @@ package net.minecraft.client.gui.screens.inventory; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.renderer.RenderType; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.player.Inventory; @@ -31,6 +32,6 @@ public class HopperScreen extends AbstractContainerScreen { protected void renderBg(GuiGraphics guiGraphics, float partialTick, int mouseX, int mouseY) { int i = (this.width - this.imageWidth) / 2; int j = (this.height - this.imageHeight) / 2; - guiGraphics.blit(HOPPER_LOCATION, i, j, 0, 0, this.imageWidth, this.imageHeight); + guiGraphics.blit(RenderType::guiTextured, HOPPER_LOCATION, i, j, 0.0F, 0.0F, this.imageWidth, this.imageHeight, 256, 256); } } diff --git a/net/minecraft/client/gui/screens/inventory/HorseInventoryScreen.java b/net/minecraft/client/gui/screens/inventory/HorseInventoryScreen.java index 4960f11b..15e65117 100644 --- a/net/minecraft/client/gui/screens/inventory/HorseInventoryScreen.java +++ b/net/minecraft/client/gui/screens/inventory/HorseInventoryScreen.java @@ -3,6 +3,7 @@ package net.minecraft.client.gui.screens.inventory; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.renderer.RenderType; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.animal.horse.AbstractHorse; @@ -41,20 +42,20 @@ public class HorseInventoryScreen extends AbstractContainerScreen 0) { - guiGraphics.blitSprite(CHEST_SLOTS_SPRITE, 90, 54, 0, 0, i + 79, j + 17, this.inventoryColumns * 18, 54); + guiGraphics.blitSprite(RenderType::guiTextured, CHEST_SLOTS_SPRITE, 90, 54, 0, 0, i + 79, j + 17, this.inventoryColumns * 18, 54); } if (this.horse.isSaddleable()) { - guiGraphics.blitSprite(SADDLE_SLOT_SPRITE, i + 7, j + 35 - 18, 18, 18); + guiGraphics.blitSprite(RenderType::guiTextured, SADDLE_SLOT_SPRITE, i + 7, j + 35 - 18, 18, 18); } if (this.horse.canUseSlot(EquipmentSlot.BODY)) { if (this.horse instanceof Llama) { - guiGraphics.blitSprite(LLAMA_ARMOR_SLOT_SPRITE, i + 7, j + 35, 18, 18); + guiGraphics.blitSprite(RenderType::guiTextured, LLAMA_ARMOR_SLOT_SPRITE, i + 7, j + 35, 18, 18); } else { - guiGraphics.blitSprite(ARMOR_SLOT_SPRITE, i + 7, j + 35, 18, 18); + guiGraphics.blitSprite(RenderType::guiTextured, ARMOR_SLOT_SPRITE, i + 7, j + 35, 18, 18); } } diff --git a/net/minecraft/client/gui/screens/inventory/InventoryScreen.java b/net/minecraft/client/gui/screens/inventory/InventoryScreen.java index 0418d88a..09621d06 100644 --- a/net/minecraft/client/gui/screens/inventory/InventoryScreen.java +++ b/net/minecraft/client/gui/screens/inventory/InventoryScreen.java @@ -1,27 +1,24 @@ package net.minecraft.client.gui.screens.inventory; import com.mojang.blaze3d.platform.Lighting; -import com.mojang.blaze3d.systems.RenderSystem; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiGraphics; -import net.minecraft.client.gui.components.ImageButton; -import net.minecraft.client.gui.screens.recipebook.RecipeBookComponent; -import net.minecraft.client.gui.screens.recipebook.RecipeUpdateListener; +import net.minecraft.client.gui.navigation.ScreenPosition; +import net.minecraft.client.gui.screens.recipebook.CraftingRecipeBookComponent; +import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.entity.EntityRenderDispatcher; import net.minecraft.network.chat.Component; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.player.Player; -import net.minecraft.world.inventory.ClickType; import net.minecraft.world.inventory.InventoryMenu; -import net.minecraft.world.inventory.Slot; import org.jetbrains.annotations.Nullable; import org.joml.Quaternionf; import org.joml.Vector3f; @Environment(EnvType.CLIENT) -public class InventoryScreen extends EffectRenderingInventoryScreen implements RecipeUpdateListener { +public class InventoryScreen extends AbstractRecipeBookScreen { /** * The old x position of the mouse pointer */ @@ -30,24 +27,23 @@ public class InventoryScreen extends EffectRenderingInventoryScreen { - this.recipeBookComponent.toggleVisibility(); - this.leftPos = this.recipeBookComponent.updateScreenPosition(this.width, this.imageWidth); - button.setPosition(this.leftPos + 104, this.height / 2 - 22); - this.buttonClicked = true; - })); - this.addWidget(this.recipeBookComponent); } } + @Override + protected ScreenPosition getRecipeBookButtonPosition() { + return new ScreenPosition(this.leftPos + 104, this.height / 2 - 22); + } + + @Override + protected void onRecipeBookButtonClick() { + this.buttonClicked = true; + } + @Override protected void renderLabels(GuiGraphics guiGraphics, int mouseX, int mouseY) { guiGraphics.drawString(this.font, this.title, this.titleLabelX, this.titleLabelY, 4210752, false); @@ -80,26 +76,27 @@ public class InventoryScreen extends EffectRenderingInventoryScreen entityRenderDispatcher.render(entity, 0.0, 0.0, 0.0, 0.0F, 1.0F, guiGraphics.pose(), guiGraphics.bufferSource(), 15728880)); + guiGraphics.drawSpecial(multiBufferSource -> entityRenderDispatcher.render(entity, 0.0, 0.0, 0.0, 1.0F, guiGraphics.pose(), multiBufferSource, 15728880)); guiGraphics.flush(); entityRenderDispatcher.setRenderShadow(true); guiGraphics.pose().popPose(); Lighting.setupFor3DItems(); } - @Override - public boolean keyPressed(int keyCode, int scanCode, int modifiers) { - return this.recipeBookComponent.keyPressed(keyCode, scanCode, modifiers) ? true : super.keyPressed(keyCode, scanCode, modifiers); - } - - @Override - public boolean charTyped(char codePoint, int modifiers) { - return this.recipeBookComponent.charTyped(codePoint, modifiers) ? true : super.charTyped(codePoint, modifiers); - } - - @Override - protected boolean isHovering(int x, int y, int width, int height, double mouseX, double mouseY) { - return (!this.widthTooNarrow || !this.recipeBookComponent.isVisible()) && super.isHovering(x, y, width, height, mouseX, mouseY); - } - - @Override - public boolean mouseClicked(double mouseX, double mouseY, int button) { - if (this.recipeBookComponent.mouseClicked(mouseX, mouseY, button)) { - this.setFocused(this.recipeBookComponent); - return true; - } else { - return this.widthTooNarrow && this.recipeBookComponent.isVisible() ? false : super.mouseClicked(mouseX, mouseY, button); - } - } - @Override public boolean mouseReleased(double mouseX, double mouseY, int button) { if (this.buttonClicked) { @@ -192,26 +165,4 @@ public class InventoryScreen extends EffectRenderingInventoryScreen= guiLeft + this.imageWidth || mouseY >= guiTop + this.imageHeight; - return this.recipeBookComponent.hasClickedOutside(mouseX, mouseY, this.leftPos, this.topPos, this.imageWidth, this.imageHeight, mouseButton) && bl; - } - - @Override - protected void slotClicked(Slot slot, int slotId, int mouseButton, ClickType type) { - super.slotClicked(slot, slotId, mouseButton, type); - this.recipeBookComponent.slotClicked(slot); - } - - @Override - public void recipesUpdated() { - this.recipeBookComponent.recipesUpdated(); - } - - @Override - public RecipeBookComponent getRecipeBookComponent() { - return this.recipeBookComponent; - } } diff --git a/net/minecraft/client/gui/screens/inventory/ItemCombinerScreen.java b/net/minecraft/client/gui/screens/inventory/ItemCombinerScreen.java index 640ffa38..9af0a41f 100644 --- a/net/minecraft/client/gui/screens/inventory/ItemCombinerScreen.java +++ b/net/minecraft/client/gui/screens/inventory/ItemCombinerScreen.java @@ -3,6 +3,7 @@ package net.minecraft.client.gui.screens.inventory; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.renderer.RenderType; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.player.Inventory; @@ -48,7 +49,7 @@ public abstract class ItemCombinerScreen extends Abs @Override protected void renderBg(GuiGraphics guiGraphics, float partialTick, int mouseX, int mouseY) { - guiGraphics.blit(this.menuResource, this.leftPos, this.topPos, 0, 0, this.imageWidth, this.imageHeight); + guiGraphics.blit(RenderType::guiTextured, this.menuResource, this.leftPos, this.topPos, 0.0F, 0.0F, this.imageWidth, this.imageHeight, 256, 256); this.renderErrorIcon(guiGraphics, this.leftPos, this.topPos); } diff --git a/net/minecraft/client/gui/screens/inventory/LoomScreen.java b/net/minecraft/client/gui/screens/inventory/LoomScreen.java index 458e9ba6..d1cb79b2 100644 --- a/net/minecraft/client/gui/screens/inventory/LoomScreen.java +++ b/net/minecraft/client/gui/screens/inventory/LoomScreen.java @@ -9,6 +9,7 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.model.geom.ModelLayers; import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.blockentity.BannerRenderer; import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.client.resources.model.ModelBakery; @@ -27,6 +28,7 @@ import net.minecraft.world.item.DyeColor; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.block.entity.BannerPattern; import net.minecraft.world.level.block.entity.BannerPatternLayers; +import net.minecraft.world.level.block.entity.BannerPatternLayers.Builder; import org.jetbrains.annotations.Nullable; @Environment(EnvType.CLIENT) @@ -87,26 +89,27 @@ public class LoomScreen extends AbstractContainerScreen { protected void renderBg(GuiGraphics guiGraphics, float partialTick, int mouseX, int mouseY) { int i = this.leftPos; int j = this.topPos; - guiGraphics.blit(BG_LOCATION, i, j, 0, 0, this.imageWidth, this.imageHeight); + guiGraphics.blit(RenderType::guiTextured, BG_LOCATION, i, j, 0.0F, 0.0F, this.imageWidth, this.imageHeight, 256, 256); Slot slot = this.menu.getBannerSlot(); Slot slot2 = this.menu.getDyeSlot(); Slot slot3 = this.menu.getPatternSlot(); Slot slot4 = this.menu.getResultSlot(); if (!slot.hasItem()) { - guiGraphics.blitSprite(BANNER_SLOT_SPRITE, i + slot.x, j + slot.y, 16, 16); + guiGraphics.blitSprite(RenderType::guiTextured, BANNER_SLOT_SPRITE, i + slot.x, j + slot.y, 16, 16); } if (!slot2.hasItem()) { - guiGraphics.blitSprite(DYE_SLOT_SPRITE, i + slot2.x, j + slot2.y, 16, 16); + guiGraphics.blitSprite(RenderType::guiTextured, DYE_SLOT_SPRITE, i + slot2.x, j + slot2.y, 16, 16); } if (!slot3.hasItem()) { - guiGraphics.blitSprite(PATTERN_SLOT_SPRITE, i + slot3.x, j + slot3.y, 16, 16); + guiGraphics.blitSprite(RenderType::guiTextured, PATTERN_SLOT_SPRITE, i + slot3.x, j + slot3.y, 16, 16); } int k = (int)(41.0F * this.scrollOffs); ResourceLocation resourceLocation = this.displayPatterns ? SCROLLER_SPRITE : SCROLLER_DISABLED_SPRITE; - guiGraphics.blitSprite(resourceLocation, i + 119, j + 13 + k, 12, 15); + guiGraphics.blitSprite(RenderType::guiTextured, resourceLocation, i + 119, j + 13 + k, 12, 15); + guiGraphics.flush(); Lighting.setupForFlatItems(); if (this.resultBannerPatterns != null && !this.hasMaxPatterns) { guiGraphics.pose().pushPose(); @@ -118,21 +121,14 @@ public class LoomScreen extends AbstractContainerScreen { this.flag.xRot = 0.0F; this.flag.y = -32.0F; DyeColor dyeColor = ((BannerItem)slot4.getItem().getItem()).getColor(); - BannerRenderer.renderPatterns( - guiGraphics.pose(), - guiGraphics.bufferSource(), - 15728880, - OverlayTexture.NO_OVERLAY, - this.flag, - ModelBakery.BANNER_BASE, - true, - dyeColor, - this.resultBannerPatterns + guiGraphics.drawSpecial( + multiBufferSource -> BannerRenderer.renderPatterns( + guiGraphics.pose(), multiBufferSource, 15728880, OverlayTexture.NO_OVERLAY, this.flag, ModelBakery.BANNER_BASE, true, dyeColor, this.resultBannerPatterns + ) ); guiGraphics.pose().popPose(); - guiGraphics.flush(); } else if (this.hasMaxPatterns) { - guiGraphics.blitSprite(ERROR_SPRITE, i + slot4.x - 5, j + slot4.y - 5, 26, 26); + guiGraphics.blitSprite(RenderType::guiTextured, ERROR_SPRITE, i + slot4.x - 5, j + slot4.y - 5, 26, 26); } if (this.displayPatterns) { @@ -161,12 +157,13 @@ public class LoomScreen extends AbstractContainerScreen { resourceLocation2 = PATTERN_SPRITE; } - guiGraphics.blitSprite(resourceLocation2, r, s, 14, 14); + guiGraphics.blitSprite(RenderType::guiTextured, resourceLocation2, r, s, 14, 14); this.renderPattern(guiGraphics, (Holder)list.get(q), r, s); } } } + guiGraphics.flush(); Lighting.setupFor3DItems(); } @@ -181,9 +178,11 @@ public class LoomScreen extends AbstractContainerScreen { poseStack.scale(0.6666667F, -0.6666667F, -0.6666667F); this.flag.xRot = 0.0F; this.flag.y = -32.0F; - BannerPatternLayers bannerPatternLayers = new BannerPatternLayers.Builder().add(patern, DyeColor.WHITE).build(); - BannerRenderer.renderPatterns( - poseStack, guiGraphics.bufferSource(), 15728880, OverlayTexture.NO_OVERLAY, this.flag, ModelBakery.BANNER_BASE, true, DyeColor.GRAY, bannerPatternLayers + BannerPatternLayers bannerPatternLayers = new Builder().add(patern, DyeColor.WHITE).build(); + guiGraphics.drawSpecial( + multiBufferSource -> BannerRenderer.renderPatterns( + poseStack, multiBufferSource, 15728880, OverlayTexture.NO_OVERLAY, this.flag, ModelBakery.BANNER_BASE, true, DyeColor.GRAY, bannerPatternLayers + ) ); poseStack.popPose(); guiGraphics.flush(); @@ -237,14 +236,18 @@ public class LoomScreen extends AbstractContainerScreen { @Override public boolean mouseScrolled(double mouseX, double mouseY, double scrollX, double scrollY) { - int i = this.totalRowCount() - 4; - if (this.displayPatterns && i > 0) { - float f = (float)scrollY / i; - this.scrollOffs = Mth.clamp(this.scrollOffs - f, 0.0F, 1.0F); - this.startRow = Math.max((int)(this.scrollOffs * i + 0.5F), 0); - } + if (super.mouseScrolled(mouseX, mouseY, scrollX, scrollY)) { + return true; + } else { + int i = this.totalRowCount() - 4; + if (this.displayPatterns && i > 0) { + float f = (float)scrollY / i; + this.scrollOffs = Mth.clamp(this.scrollOffs - f, 0.0F, 1.0F); + this.startRow = Math.max((int)(this.scrollOffs * i + 0.5F), 0); + } - return true; + return true; + } } @Override diff --git a/net/minecraft/client/gui/screens/inventory/MerchantScreen.java b/net/minecraft/client/gui/screens/inventory/MerchantScreen.java index 0ab19429..46b3d2af 100644 --- a/net/minecraft/client/gui/screens/inventory/MerchantScreen.java +++ b/net/minecraft/client/gui/screens/inventory/MerchantScreen.java @@ -1,10 +1,10 @@ package net.minecraft.client.gui.screens.inventory; -import com.mojang.blaze3d.systems.RenderSystem; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.Button; +import net.minecraft.client.renderer.RenderType; import net.minecraft.network.chat.CommonComponents; import net.minecraft.network.chat.Component; import net.minecraft.network.protocol.game.ServerboundSelectTradePacket; @@ -111,7 +111,7 @@ public class MerchantScreen extends AbstractContainerScreen { protected void renderBg(GuiGraphics guiGraphics, float partialTick, int mouseX, int mouseY) { int i = (this.width - this.imageWidth) / 2; int j = (this.height - this.imageHeight) / 2; - guiGraphics.blit(VILLAGER_LOCATION, i, j, 0, 0.0F, 0.0F, this.imageWidth, this.imageHeight, 512, 256); + guiGraphics.blit(RenderType::guiTextured, VILLAGER_LOCATION, i, j, 0.0F, 0.0F, this.imageWidth, this.imageHeight, 512, 256); MerchantOffers merchantOffers = this.menu.getOffers(); if (!merchantOffers.isEmpty()) { int k = this.shopItem; @@ -121,7 +121,7 @@ public class MerchantScreen extends AbstractContainerScreen { MerchantOffer merchantOffer = (MerchantOffer)merchantOffers.get(k); if (merchantOffer.isOutOfStock()) { - guiGraphics.blitSprite(OUT_OF_STOCK_SPRITE, this.leftPos + 83 + 99, this.topPos + 35, 0, 28, 21); + guiGraphics.blitSprite(RenderType::guiTextured, OUT_OF_STOCK_SPRITE, this.leftPos + 83 + 99, this.topPos + 35, 28, 21); } } } @@ -130,17 +130,17 @@ public class MerchantScreen extends AbstractContainerScreen { int i = this.menu.getTraderLevel(); int j = this.menu.getTraderXp(); if (i < 5) { - guiGraphics.blitSprite(EXPERIENCE_BAR_BACKGROUND_SPRITE, posX + 136, posY + 16, 0, 102, 5); + guiGraphics.blitSprite(RenderType::guiTextured, EXPERIENCE_BAR_BACKGROUND_SPRITE, posX + 136, posY + 16, 102, 5); int k = VillagerData.getMinXpPerLevel(i); if (j >= k && VillagerData.canLevelUp(i)) { int l = 102; float f = 102.0F / (VillagerData.getMaxXpPerLevel(i) - k); int m = Math.min(Mth.floor(f * (j - k)), 102); - guiGraphics.blitSprite(EXPERIENCE_BAR_CURRENT_SPRITE, 102, 5, 0, 0, posX + 136, posY + 16, 0, m, 5); + guiGraphics.blitSprite(RenderType::guiTextured, EXPERIENCE_BAR_CURRENT_SPRITE, 102, 5, 0, 0, posX + 136, posY + 16, m, 5); int n = this.menu.getFutureTraderXp(); if (n > 0) { int o = Math.min(Mth.floor(n * f), 102 - m); - guiGraphics.blitSprite(EXPERIENCE_BAR_RESULT_SPRITE, 102, 5, m, 0, posX + 136 + m, posY + 16, 0, o, 5); + guiGraphics.blitSprite(RenderType::guiTextured, EXPERIENCE_BAR_RESULT_SPRITE, 102, 5, m, 0, posX + 136 + m, posY + 16, o, 5); } } } @@ -157,9 +157,9 @@ public class MerchantScreen extends AbstractContainerScreen { m = 113; } - guiGraphics.blitSprite(SCROLLER_SPRITE, posX + 94, posY + 18 + m, 0, 6, 27); + guiGraphics.blitSprite(RenderType::guiTextured, SCROLLER_SPRITE, posX + 94, posY + 18 + m, 6, 27); } else { - guiGraphics.blitSprite(SCROLLER_DISABLED_SPRITE, posX + 94, posY + 18, 0, 6, 27); + guiGraphics.blitSprite(RenderType::guiTextured, SCROLLER_DISABLED_SPRITE, posX + 94, posY + 18, 6, 27); } } @@ -218,19 +218,16 @@ public class MerchantScreen extends AbstractContainerScreen { tradeOfferButton.visible = tradeOfferButton.index < this.menu.getOffers().size(); } - - RenderSystem.enableDepthTest(); } this.renderTooltip(guiGraphics, mouseX, mouseY); } private void renderButtonArrows(GuiGraphics guiGraphics, MerchantOffer merchantOffers, int posX, int posY) { - RenderSystem.enableBlend(); if (merchantOffers.isOutOfStock()) { - guiGraphics.blitSprite(TRADE_ARROW_OUT_OF_STOCK_SPRITE, posX + 5 + 35 + 20, posY + 3, 0, 10, 9); + guiGraphics.blitSprite(RenderType::guiTextured, TRADE_ARROW_OUT_OF_STOCK_SPRITE, posX + 5 + 35 + 20, posY + 3, 10, 9); } else { - guiGraphics.blitSprite(TRADE_ARROW_SPRITE, posX + 5 + 35 + 20, posY + 3, 0, 10, 9); + guiGraphics.blitSprite(RenderType::guiTextured, TRADE_ARROW_SPRITE, posX + 5 + 35 + 20, posY + 3, 10, 9); } } @@ -243,7 +240,7 @@ public class MerchantScreen extends AbstractContainerScreen { guiGraphics.renderItemDecorations(this.font, realCost, x + 14, y, realCost.getCount() == 1 ? "1" : null); guiGraphics.pose().pushPose(); guiGraphics.pose().translate(0.0F, 0.0F, 300.0F); - guiGraphics.blitSprite(DISCOUNT_STRIKETHRUOGH_SPRITE, x + 7, y + 12, 0, 9, 2); + guiGraphics.blitSprite(RenderType::guiTextured, DISCOUNT_STRIKETHRUOGH_SPRITE, x + 7, y + 12, 9, 2); guiGraphics.pose().popPose(); } } @@ -254,13 +251,17 @@ public class MerchantScreen extends AbstractContainerScreen { @Override public boolean mouseScrolled(double mouseX, double mouseY, double scrollX, double scrollY) { - int i = this.menu.getOffers().size(); - if (this.canScroll(i)) { - int j = i - 7; - this.scrollOff = Mth.clamp((int)(this.scrollOff - scrollY), 0, j); - } + if (super.mouseScrolled(mouseX, mouseY, scrollX, scrollY)) { + return true; + } else { + int i = this.menu.getOffers().size(); + if (this.canScroll(i)) { + int j = i - 7; + this.scrollOff = Mth.clamp((int)(this.scrollOff - scrollY), 0, j); + } - return true; + return true; + } } @Override diff --git a/net/minecraft/client/gui/screens/inventory/PageButton.java b/net/minecraft/client/gui/screens/inventory/PageButton.java index 6f96918b..3c0aa224 100644 --- a/net/minecraft/client/gui/screens/inventory/PageButton.java +++ b/net/minecraft/client/gui/screens/inventory/PageButton.java @@ -4,6 +4,7 @@ import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.Button; +import net.minecraft.client.renderer.RenderType; import net.minecraft.client.resources.sounds.SimpleSoundInstance; import net.minecraft.client.sounds.SoundManager; import net.minecraft.network.chat.CommonComponents; @@ -34,7 +35,7 @@ public class PageButton extends Button { resourceLocation = this.isHoveredOrFocused() ? PAGE_BACKWARD_HIGHLIGHTED_SPRITE : PAGE_BACKWARD_SPRITE; } - guiGraphics.blitSprite(resourceLocation, this.getX(), this.getY(), 23, 13); + guiGraphics.blitSprite(RenderType::guiTextured, resourceLocation, this.getX(), this.getY(), 23, 13); } @Override diff --git a/net/minecraft/client/gui/screens/inventory/ShulkerBoxScreen.java b/net/minecraft/client/gui/screens/inventory/ShulkerBoxScreen.java index d17b0d4b..f07876e9 100644 --- a/net/minecraft/client/gui/screens/inventory/ShulkerBoxScreen.java +++ b/net/minecraft/client/gui/screens/inventory/ShulkerBoxScreen.java @@ -3,6 +3,7 @@ package net.minecraft.client.gui.screens.inventory; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.renderer.RenderType; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.player.Inventory; @@ -27,6 +28,6 @@ public class ShulkerBoxScreen extends AbstractContainerScreen { protected void renderBg(GuiGraphics guiGraphics, float partialTick, int mouseX, int mouseY) { int i = (this.width - this.imageWidth) / 2; int j = (this.height - this.imageHeight) / 2; - guiGraphics.blit(CONTAINER_TEXTURE, i, j, 0, 0, this.imageWidth, this.imageHeight); + guiGraphics.blit(RenderType::guiTextured, CONTAINER_TEXTURE, i, j, 0.0F, 0.0F, this.imageWidth, this.imageHeight, 256, 256); } } diff --git a/net/minecraft/client/gui/screens/inventory/SignEditScreen.java b/net/minecraft/client/gui/screens/inventory/SignEditScreen.java index 35274a8c..bdcf061f 100644 --- a/net/minecraft/client/gui/screens/inventory/SignEditScreen.java +++ b/net/minecraft/client/gui/screens/inventory/SignEditScreen.java @@ -4,6 +4,7 @@ import com.mojang.blaze3d.vertex.VertexConsumer; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.model.Model; import net.minecraft.client.renderer.Sheets; import net.minecraft.client.renderer.blockentity.SignRenderer; import net.minecraft.client.renderer.texture.OverlayTexture; @@ -20,7 +21,7 @@ public class SignEditScreen extends AbstractSignEditScreen { public static final float MAGIC_TEXT_SCALE = 0.9765628F; private static final Vector3f TEXT_SCALE = new Vector3f(0.9765628F, 0.9765628F, 0.9765628F); @Nullable - private SignRenderer.SignModel signModel; + private Model signModel; public SignEditScreen(SignBlockEntity signBlockEntity, boolean bl, boolean bl2) { super(signBlockEntity, bl, bl2); @@ -29,7 +30,8 @@ public class SignEditScreen extends AbstractSignEditScreen { @Override protected void init() { super.init(); - this.signModel = SignRenderer.createSignModel(this.minecraft.getEntityModels(), this.woodType); + boolean bl = this.sign.getBlockState().getBlock() instanceof StandingSignBlock; + this.signModel = SignRenderer.createSignModel(this.minecraft.getEntityModels(), this.woodType, bl); } @Override @@ -42,15 +44,15 @@ public class SignEditScreen extends AbstractSignEditScreen { } @Override - protected void renderSignBackground(GuiGraphics guiGraphics, BlockState state) { + protected void renderSignBackground(GuiGraphics guiGraphics) { if (this.signModel != null) { - boolean bl = state.getBlock() instanceof StandingSignBlock; guiGraphics.pose().translate(0.0F, 31.0F, 0.0F); guiGraphics.pose().scale(62.500004F, 62.500004F, -62.500004F); - Material material = Sheets.getSignMaterial(this.woodType); - VertexConsumer vertexConsumer = material.buffer(guiGraphics.bufferSource(), this.signModel::renderType); - this.signModel.stick.visible = bl; - this.signModel.root.render(guiGraphics.pose(), vertexConsumer, 15728880, OverlayTexture.NO_OVERLAY); + guiGraphics.drawSpecial(multiBufferSource -> { + Material material = Sheets.getSignMaterial(this.woodType); + VertexConsumer vertexConsumer = material.buffer(multiBufferSource, this.signModel::renderType); + this.signModel.renderToBuffer(guiGraphics.pose(), vertexConsumer, 15728880, OverlayTexture.NO_OVERLAY); + }); } } diff --git a/net/minecraft/client/gui/screens/inventory/SmithingScreen.java b/net/minecraft/client/gui/screens/inventory/SmithingScreen.java index 4bba692a..279420d1 100644 --- a/net/minecraft/client/gui/screens/inventory/SmithingScreen.java +++ b/net/minecraft/client/gui/screens/inventory/SmithingScreen.java @@ -5,6 +5,8 @@ import java.util.Optional; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.core.component.DataComponents; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.EquipmentSlot; @@ -12,9 +14,9 @@ import net.minecraft.world.entity.decoration.ArmorStand; import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.inventory.AbstractContainerMenu; import net.minecraft.world.inventory.SmithingMenu; -import net.minecraft.world.item.ArmorItem; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.SmithingTemplateItem; +import net.minecraft.world.item.equipment.Equippable; import org.jetbrains.annotations.Nullable; import org.joml.Quaternionf; import org.joml.Vector3f; @@ -113,17 +115,14 @@ public class SmithingScreen extends ItemCombinerScreen { private void updateArmorStandPreview(ItemStack stack) { if (this.armorStandPreview != null) { - for (EquipmentSlot equipmentSlot : EquipmentSlot.values()) { + for (EquipmentSlot equipmentSlot : EquipmentSlot.VALUES) { this.armorStandPreview.setItemSlot(equipmentSlot, ItemStack.EMPTY); } if (!stack.isEmpty()) { - ItemStack itemStack = stack.copy(); - if (stack.getItem() instanceof ArmorItem armorItem) { - this.armorStandPreview.setItemSlot(armorItem.getEquipmentSlot(), itemStack); - } else { - this.armorStandPreview.setItemSlot(EquipmentSlot.OFFHAND, itemStack); - } + Equippable equippable = stack.get(DataComponents.EQUIPPABLE); + EquipmentSlot equipmentSlot = equippable != null ? equippable.slot() : EquipmentSlot.OFFHAND; + this.armorStandPreview.setItemSlot(equipmentSlot, stack.copy()); } } } @@ -131,7 +130,7 @@ public class SmithingScreen extends ItemCombinerScreen { @Override protected void renderErrorIcon(GuiGraphics guiGraphics, int x, int y) { if (this.hasRecipeError()) { - guiGraphics.blitSprite(ERROR_SPRITE, x + 65, y + 46, 28, 21); + guiGraphics.blitSprite(RenderType::guiTextured, ERROR_SPRITE, x + 65, y + 46, 28, 21); } } @@ -161,9 +160,6 @@ public class SmithingScreen extends ItemCombinerScreen { } private boolean hasRecipeError() { - return this.menu.getSlot(0).hasItem() - && this.menu.getSlot(1).hasItem() - && this.menu.getSlot(2).hasItem() - && !this.menu.getSlot(this.menu.getResultSlot()).hasItem(); + return this.menu.hasRecipeError(); } } diff --git a/net/minecraft/client/gui/screens/inventory/SmokerScreen.java b/net/minecraft/client/gui/screens/inventory/SmokerScreen.java index faa25a0c..9237f8df 100644 --- a/net/minecraft/client/gui/screens/inventory/SmokerScreen.java +++ b/net/minecraft/client/gui/screens/inventory/SmokerScreen.java @@ -1,20 +1,28 @@ package net.minecraft.client.gui.screens.inventory; +import java.util.List; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; -import net.minecraft.client.gui.screens.recipebook.SmokingRecipeBookComponent; +import net.minecraft.client.gui.screens.recipebook.RecipeBookComponent; +import net.minecraft.client.gui.screens.recipebook.SearchRecipeBookCategory; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.inventory.SmokerMenu; +import net.minecraft.world.item.Items; +import net.minecraft.world.item.crafting.RecipeBookCategories; @Environment(EnvType.CLIENT) public class SmokerScreen extends AbstractFurnaceScreen { private static final ResourceLocation LIT_PROGRESS_SPRITE = ResourceLocation.withDefaultNamespace("container/smoker/lit_progress"); private static final ResourceLocation BURN_PROGRESS_SPRITE = ResourceLocation.withDefaultNamespace("container/smoker/burn_progress"); private static final ResourceLocation TEXTURE = ResourceLocation.withDefaultNamespace("textures/gui/container/smoker.png"); + private static final Component FILTER_NAME = Component.translatable("gui.recipebook.toggleRecipes.smokable"); + private static final List TABS = List.of( + new RecipeBookComponent.TabInfo(SearchRecipeBookCategory.SMOKER), new RecipeBookComponent.TabInfo(Items.PORKCHOP, RecipeBookCategories.SMOKER_FOOD) + ); public SmokerScreen(SmokerMenu menu, Inventory playerInventory, Component title) { - super(menu, new SmokingRecipeBookComponent(), playerInventory, title, TEXTURE, LIT_PROGRESS_SPRITE, BURN_PROGRESS_SPRITE); + super(menu, playerInventory, title, FILTER_NAME, TEXTURE, LIT_PROGRESS_SPRITE, BURN_PROGRESS_SPRITE, TABS); } } diff --git a/net/minecraft/client/gui/screens/inventory/StonecutterScreen.java b/net/minecraft/client/gui/screens/inventory/StonecutterScreen.java index 389f4537..caf6d0b9 100644 --- a/net/minecraft/client/gui/screens/inventory/StonecutterScreen.java +++ b/net/minecraft/client/gui/screens/inventory/StonecutterScreen.java @@ -1,19 +1,22 @@ package net.minecraft.client.gui.screens.inventory; -import java.util.List; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.renderer.RenderType; import net.minecraft.client.resources.sounds.SimpleSoundInstance; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; import net.minecraft.sounds.SoundEvents; import net.minecraft.util.Mth; +import net.minecraft.util.context.ContextMap; import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.inventory.StonecutterMenu; -import net.minecraft.world.item.crafting.RecipeHolder; +import net.minecraft.world.item.crafting.SelectableRecipe; import net.minecraft.world.item.crafting.StonecutterRecipe; +import net.minecraft.world.item.crafting.display.SlotDisplay; +import net.minecraft.world.item.crafting.display.SlotDisplayContext; @Environment(EnvType.CLIENT) public class StonecutterScreen extends AbstractContainerScreen { @@ -60,10 +63,10 @@ public class StonecutterScreen extends AbstractContainerScreen protected void renderBg(GuiGraphics guiGraphics, float partialTick, int mouseX, int mouseY) { int i = this.leftPos; int j = this.topPos; - guiGraphics.blit(BG_LOCATION, i, j, 0, 0, this.imageWidth, this.imageHeight); + guiGraphics.blit(RenderType::guiTextured, BG_LOCATION, i, j, 0.0F, 0.0F, this.imageWidth, this.imageHeight, 256, 256); int k = (int)(41.0F * this.scrollOffs); ResourceLocation resourceLocation = this.isScrollBarActive() ? SCROLLER_SPRITE : SCROLLER_DISABLED_SPRITE; - guiGraphics.blitSprite(resourceLocation, i + 119, j + 15 + k, 12, 15); + guiGraphics.blitSprite(RenderType::guiTextured, resourceLocation, i + 119, j + 15 + k, 12, 15); int l = this.leftPos + 52; int m = this.topPos + 14; int n = this.startIndex + 12; @@ -78,21 +81,23 @@ public class StonecutterScreen extends AbstractContainerScreen int i = this.leftPos + 52; int j = this.topPos + 14; int k = this.startIndex + 12; - List> list = this.menu.getRecipes(); + SelectableRecipe.SingleInputSet singleInputSet = this.menu.getVisibleRecipes(); - for (int l = this.startIndex; l < k && l < this.menu.getNumRecipes(); l++) { + for (int l = this.startIndex; l < k && l < singleInputSet.size(); l++) { int m = l - this.startIndex; int n = i + m % 4 * 16; int o = j + m / 4 * 18 + 2; if (x >= n && x < n + 16 && y >= o && y < o + 18) { - guiGraphics.renderTooltip(this.font, ((StonecutterRecipe)((RecipeHolder)list.get(l)).value()).getResultItem(this.minecraft.level.registryAccess()), x, y); + ContextMap contextMap = SlotDisplayContext.fromLevel(this.minecraft.level); + SlotDisplay slotDisplay = ((SelectableRecipe.SingleInputEntry)singleInputSet.entries().get(l)).recipe().optionDisplay(); + guiGraphics.renderTooltip(this.font, slotDisplay.resolveForFirstStack(contextMap), x, y); } } } } private void renderButtons(GuiGraphics guiGraphics, int mouseX, int mouseY, int x, int y, int lastVisibleElementIndex) { - for (int i = this.startIndex; i < lastVisibleElementIndex && i < this.menu.getNumRecipes(); i++) { + for (int i = this.startIndex; i < lastVisibleElementIndex && i < this.menu.getNumberOfVisibleRecipes(); i++) { int j = i - this.startIndex; int k = x + j % 4 * 16; int l = j / 4; @@ -106,19 +111,21 @@ public class StonecutterScreen extends AbstractContainerScreen resourceLocation = RECIPE_SPRITE; } - guiGraphics.blitSprite(resourceLocation, k, m - 1, 16, 18); + guiGraphics.blitSprite(RenderType::guiTextured, resourceLocation, k, m - 1, 16, 18); } } private void renderRecipes(GuiGraphics guiGraphics, int x, int y, int startIndex) { - List> list = this.menu.getRecipes(); + SelectableRecipe.SingleInputSet singleInputSet = this.menu.getVisibleRecipes(); + ContextMap contextMap = SlotDisplayContext.fromLevel(this.minecraft.level); - for (int i = this.startIndex; i < startIndex && i < this.menu.getNumRecipes(); i++) { + for (int i = this.startIndex; i < startIndex && i < singleInputSet.size(); i++) { int j = i - this.startIndex; int k = x + j % 4 * 16; int l = j / 4; int m = y + l * 18 + 2; - guiGraphics.renderItem(((StonecutterRecipe)((RecipeHolder)list.get(i)).value()).getResultItem(this.minecraft.level.registryAccess()), k, m); + SlotDisplay slotDisplay = ((SelectableRecipe.SingleInputEntry)singleInputSet.entries().get(i)).recipe().optionDisplay(); + guiGraphics.renderItem(slotDisplay.resolveForFirstStack(contextMap), k, m); } } @@ -167,22 +174,26 @@ public class StonecutterScreen extends AbstractContainerScreen @Override public boolean mouseScrolled(double mouseX, double mouseY, double scrollX, double scrollY) { - if (this.isScrollBarActive()) { - int i = this.getOffscreenRows(); - float f = (float)scrollY / i; - this.scrollOffs = Mth.clamp(this.scrollOffs - f, 0.0F, 1.0F); - this.startIndex = (int)(this.scrollOffs * i + 0.5) * 4; - } + if (super.mouseScrolled(mouseX, mouseY, scrollX, scrollY)) { + return true; + } else { + if (this.isScrollBarActive()) { + int i = this.getOffscreenRows(); + float f = (float)scrollY / i; + this.scrollOffs = Mth.clamp(this.scrollOffs - f, 0.0F, 1.0F); + this.startIndex = (int)(this.scrollOffs * i + 0.5) * 4; + } - return true; + return true; + } } private boolean isScrollBarActive() { - return this.displayRecipes && this.menu.getNumRecipes() > 12; + return this.displayRecipes && this.menu.getNumberOfVisibleRecipes() > 12; } protected int getOffscreenRows() { - return (this.menu.getNumRecipes() + 4 - 1) / 4 - 3; + return (this.menu.getNumberOfVisibleRecipes() + 4 - 1) / 4 - 3; } /** diff --git a/net/minecraft/client/gui/screens/inventory/tooltip/ClientActivePlayersTooltip.java b/net/minecraft/client/gui/screens/inventory/tooltip/ClientActivePlayersTooltip.java index 86501c80..3da1768e 100644 --- a/net/minecraft/client/gui/screens/inventory/tooltip/ClientActivePlayersTooltip.java +++ b/net/minecraft/client/gui/screens/inventory/tooltip/ClientActivePlayersTooltip.java @@ -21,7 +21,7 @@ public class ClientActivePlayersTooltip implements ClientTooltipComponent { } @Override - public int getHeight() { + public int getHeight(Font font) { return this.activePlayers.size() * 12 + 2; } @@ -40,12 +40,12 @@ public class ClientActivePlayersTooltip implements ClientTooltipComponent { } @Override - public void renderImage(Font font, int x, int y, GuiGraphics guiGraphics) { - for (int i = 0; i < this.activePlayers.size(); i++) { - ProfileResult profileResult = (ProfileResult)this.activePlayers.get(i); - int j = y + 2 + i * 12; - PlayerFaceRenderer.draw(guiGraphics, Minecraft.getInstance().getSkinManager().getInsecureSkin(profileResult.profile()), x + 2, j, 10); - guiGraphics.drawString(font, profileResult.profile().getName(), x + 10 + 4, j + 2, -1); + public void renderImage(Font font, int i, int j, int k, int l, GuiGraphics guiGraphics) { + for (int m = 0; m < this.activePlayers.size(); m++) { + ProfileResult profileResult = (ProfileResult)this.activePlayers.get(m); + int n = j + 2 + m * 12; + PlayerFaceRenderer.draw(guiGraphics, Minecraft.getInstance().getSkinManager().getInsecureSkin(profileResult.profile()), i + 2, n, 10); + guiGraphics.drawString(font, profileResult.profile().getName(), i + 10 + 4, n + 2, -1); } } diff --git a/net/minecraft/client/gui/screens/inventory/tooltip/ClientBundleTooltip.java b/net/minecraft/client/gui/screens/inventory/tooltip/ClientBundleTooltip.java index 849c25bc..3aa631b6 100644 --- a/net/minecraft/client/gui/screens/inventory/tooltip/ClientBundleTooltip.java +++ b/net/minecraft/client/gui/screens/inventory/tooltip/ClientBundleTooltip.java @@ -1,22 +1,39 @@ package net.minecraft.client.gui.screens.inventory.tooltip; +import java.util.List; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.gui.Font; import net.minecraft.client.gui.GuiGraphics; -import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.core.component.DataComponents; +import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.Mth; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.component.BundleContents; import org.apache.commons.lang3.math.Fraction; +import org.jetbrains.annotations.Nullable; @Environment(EnvType.CLIENT) public class ClientBundleTooltip implements ClientTooltipComponent { - private static final ResourceLocation BACKGROUND_SPRITE = ResourceLocation.withDefaultNamespace("container/bundle/background"); - private static final int MARGIN_Y = 4; - private static final int BORDER_WIDTH = 1; - private static final int SLOT_SIZE_X = 18; - private static final int SLOT_SIZE_Y = 20; + private static final ResourceLocation PROGRESSBAR_BORDER_SPRITE = ResourceLocation.withDefaultNamespace("container/bundle/bundle_progressbar_border"); + private static final ResourceLocation PROGRESSBAR_FILL_SPRITE = ResourceLocation.withDefaultNamespace("container/bundle/bundle_progressbar_fill"); + private static final ResourceLocation PROGRESSBAR_FULL_SPRITE = ResourceLocation.withDefaultNamespace("container/bundle/bundle_progressbar_full"); + private static final ResourceLocation SLOT_HIGHLIGHT_BACK_SPRITE = ResourceLocation.withDefaultNamespace("container/bundle/slot_highlight_back"); + private static final ResourceLocation SLOT_HIGHLIGHT_FRONT_SPRITE = ResourceLocation.withDefaultNamespace("container/bundle/slot_highlight_front"); + private static final ResourceLocation SLOT_BACKGROUND_SPRITE = ResourceLocation.withDefaultNamespace("container/bundle/slot_background"); + private static final int SLOT_MARGIN = 4; + private static final int SLOT_SIZE = 24; + private static final int GRID_WIDTH = 96; + private static final int PROGRESSBAR_HEIGHT = 13; + private static final int PROGRESSBAR_WIDTH = 96; + private static final int PROGRESSBAR_BORDER = 1; + private static final int PROGRESSBAR_FILL_MAX = 94; + private static final int PROGRESSBAR_MARGIN_Y = 4; + private static final Component BUNDLE_FULL_TEXT = Component.translatable("item.minecraft.bundle.full"); + private static final Component BUNDLE_EMPTY_TEXT = Component.translatable("item.minecraft.bundle.empty"); + private static final Component BUNDLE_EMPTY_DESCRIPTION = Component.translatable("item.minecraft.bundle.empty.description"); private final BundleContents contents; public ClientBundleTooltip(BundleContents contents) { @@ -24,79 +41,161 @@ public class ClientBundleTooltip implements ClientTooltipComponent { } @Override - public int getHeight() { - return this.backgroundHeight() + 4; + public int getHeight(Font font) { + return this.contents.isEmpty() ? getEmptyBundleBackgroundHeight(font) : this.backgroundHeight(); } @Override public int getWidth(Font font) { - return this.backgroundWidth(); - } - - private int backgroundWidth() { - return this.gridSizeX() * 18 + 2; - } - - private int backgroundHeight() { - return this.gridSizeY() * 20 + 2; + return 96; } @Override - public void renderImage(Font font, int x, int y, GuiGraphics guiGraphics) { - int i = this.gridSizeX(); - int j = this.gridSizeY(); - guiGraphics.blitSprite(BACKGROUND_SPRITE, x, y, this.backgroundWidth(), this.backgroundHeight()); - boolean bl = this.contents.weight().compareTo(Fraction.ONE) >= 0; - int k = 0; - - for (int l = 0; l < j; l++) { - for (int m = 0; m < i; m++) { - int n = x + m * 18 + 1; - int o = y + l * 20 + 1; - this.renderSlot(n, o, k++, bl, guiGraphics, font); - } - } + public boolean showTooltipWithItemInHand() { + return true; } - private void renderSlot(int x, int y, int itemIndex, boolean isBundleFull, GuiGraphics guiGraphics, Font font) { - if (itemIndex >= this.contents.size()) { - this.blit(guiGraphics, x, y, isBundleFull ? ClientBundleTooltip.Texture.BLOCKED_SLOT : ClientBundleTooltip.Texture.SLOT); - } else { - ItemStack itemStack = this.contents.getItemUnsafe(itemIndex); - this.blit(guiGraphics, x, y, ClientBundleTooltip.Texture.SLOT); - guiGraphics.renderItem(itemStack, x + 1, y + 1, itemIndex); - guiGraphics.renderItemDecorations(font, itemStack, x + 1, y + 1); - if (itemIndex == 0) { - AbstractContainerScreen.renderSlotHighlight(guiGraphics, x + 1, y + 1, 0); - } - } + private static int getEmptyBundleBackgroundHeight(Font font) { + return getEmptyBundleDescriptionTextHeight(font) + 13 + 8; } - private void blit(GuiGraphics guiGraphics, int x, int y, ClientBundleTooltip.Texture texture) { - guiGraphics.blitSprite(texture.sprite, x, y, 0, texture.w, texture.h); + private int backgroundHeight() { + return this.itemGridHeight() + 13 + 8; } - private int gridSizeX() { - return Math.max(2, (int)Math.ceil(Math.sqrt(this.contents.size() + 1.0))); + private int itemGridHeight() { + return this.gridSizeY() * 24; + } + + private int getContentXOffset(int i) { + return (i - 96) / 2; } private int gridSizeY() { - return (int)Math.ceil((this.contents.size() + 1.0) / this.gridSizeX()); + return Mth.positiveCeilDiv(this.slotCount(), 4); } - @Environment(EnvType.CLIENT) - static enum Texture { - BLOCKED_SLOT(ResourceLocation.withDefaultNamespace("container/bundle/blocked_slot"), 18, 20), - SLOT(ResourceLocation.withDefaultNamespace("container/bundle/slot"), 18, 20); + private int slotCount() { + return Math.min(12, this.contents.size()); + } - public final ResourceLocation sprite; - public final int w; - public final int h; + @Override + public void renderImage(Font font, int i, int j, int k, int l, GuiGraphics guiGraphics) { + if (this.contents.isEmpty()) { + this.renderEmptyBundleTooltip(font, i, j, k, l, guiGraphics); + } else { + this.renderBundleWithItemsTooltip(font, i, j, k, l, guiGraphics); + } + } - private Texture(final ResourceLocation sprite, final int w, final int h) { - this.sprite = sprite; - this.w = w; - this.h = h; + private void renderEmptyBundleTooltip(Font font, int i, int j, int k, int l, GuiGraphics guiGraphics) { + drawEmptyBundleDescriptionText(i + this.getContentXOffset(k), j, font, guiGraphics); + this.drawProgressbar(i + this.getContentXOffset(k), j + getEmptyBundleDescriptionTextHeight(font) + 4, font, guiGraphics); + } + + private void renderBundleWithItemsTooltip(Font font, int i, int j, int k, int l, GuiGraphics guiGraphics) { + boolean bl = this.contents.size() > 12; + List list = this.getShownItems(this.contents.getNumberOfItemsToShow()); + int m = i + this.getContentXOffset(k) + 96; + int n = j + this.gridSizeY() * 24; + int o = 1; + + for (int p = 1; p <= this.gridSizeY(); p++) { + for (int q = 1; q <= 4; q++) { + int r = m - q * 24; + int s = n - p * 24; + if (shouldRenderSurplusText(bl, q, p)) { + renderCount(r, s, this.getAmountOfHiddenItems(list), font, guiGraphics); + } else if (shouldRenderItemSlot(list, o)) { + this.renderSlot(o, r, s, list, o, font, guiGraphics); + o++; + } + } + } + + this.drawSelectedItemTooltip(font, guiGraphics, i, j, k); + this.drawProgressbar(i + this.getContentXOffset(k), j + this.itemGridHeight() + 4, font, guiGraphics); + } + + private List getShownItems(int i) { + int j = Math.min(this.contents.size(), i); + return this.contents.itemCopyStream().toList().subList(0, j); + } + + private static boolean shouldRenderSurplusText(boolean bl, int i, int j) { + return bl && i * j == 1; + } + + private static boolean shouldRenderItemSlot(List list, int i) { + return list.size() >= i; + } + + private int getAmountOfHiddenItems(List list) { + return this.contents.itemCopyStream().skip(list.size()).mapToInt(ItemStack::getCount).sum(); + } + + private void renderSlot(int i, int j, int k, List list, int l, Font font, GuiGraphics guiGraphics) { + int m = list.size() - i; + boolean bl = m == this.contents.getSelectedItem(); + ItemStack itemStack = (ItemStack)list.get(m); + if (bl) { + guiGraphics.blitSprite(RenderType::guiTextured, SLOT_HIGHLIGHT_BACK_SPRITE, j, k, 24, 24); + } else { + guiGraphics.blitSprite(RenderType::guiTextured, SLOT_BACKGROUND_SPRITE, j, k, 24, 24); + } + + guiGraphics.renderItem(itemStack, j + 4, k + 4, l); + guiGraphics.renderItemDecorations(font, itemStack, j + 4, k + 4); + if (bl) { + guiGraphics.blitSprite(RenderType::guiTexturedOverlay, SLOT_HIGHLIGHT_FRONT_SPRITE, j, k, 24, 24); + } + } + + private static void renderCount(int i, int j, int k, Font font, GuiGraphics guiGraphics) { + guiGraphics.drawCenteredString(font, "+" + k, i + 12, j + 10, 16777215); + } + + private void drawSelectedItemTooltip(Font font, GuiGraphics guiGraphics, int i, int j, int k) { + if (this.contents.hasSelectedItem()) { + ItemStack itemStack = this.contents.getItemUnsafe(this.contents.getSelectedItem()); + Component component = itemStack.getStyledHoverName(); + int l = font.width(component.getVisualOrderText()); + int m = i + k / 2 - 12; + guiGraphics.renderTooltip(font, component, m - l / 2, j - 15, itemStack.get(DataComponents.TOOLTIP_STYLE)); + } + } + + private void drawProgressbar(int i, int j, Font font, GuiGraphics guiGraphics) { + guiGraphics.blitSprite(RenderType::guiTextured, this.getProgressBarTexture(), i + 1, j, this.getProgressBarFill(), 13); + guiGraphics.blitSprite(RenderType::guiTextured, PROGRESSBAR_BORDER_SPRITE, i, j, 96, 13); + Component component = this.getProgressBarFillText(); + if (component != null) { + guiGraphics.drawCenteredString(font, component, i + 48, j + 3, 16777215); + } + } + + private static void drawEmptyBundleDescriptionText(int i, int j, Font font, GuiGraphics guiGraphics) { + guiGraphics.drawWordWrap(font, BUNDLE_EMPTY_DESCRIPTION, i, j, 96, 11184810); + } + + private static int getEmptyBundleDescriptionTextHeight(Font font) { + return font.split(BUNDLE_EMPTY_DESCRIPTION, 96).size() * 9; + } + + private int getProgressBarFill() { + return Mth.clamp(Mth.mulAndTruncate(this.contents.weight(), 94), 0, 94); + } + + private ResourceLocation getProgressBarTexture() { + return this.contents.weight().compareTo(Fraction.ONE) >= 0 ? PROGRESSBAR_FULL_SPRITE : PROGRESSBAR_FILL_SPRITE; + } + + @Nullable + private Component getProgressBarFillText() { + if (this.contents.isEmpty()) { + return BUNDLE_EMPTY_TEXT; + } else { + return this.contents.weight().compareTo(Fraction.ONE) >= 0 ? BUNDLE_FULL_TEXT : null; } } } diff --git a/net/minecraft/client/gui/screens/inventory/tooltip/ClientTextTooltip.java b/net/minecraft/client/gui/screens/inventory/tooltip/ClientTextTooltip.java index 682c857b..7ca1ba41 100644 --- a/net/minecraft/client/gui/screens/inventory/tooltip/ClientTextTooltip.java +++ b/net/minecraft/client/gui/screens/inventory/tooltip/ClientTextTooltip.java @@ -21,7 +21,7 @@ public class ClientTextTooltip implements ClientTooltipComponent { } @Override - public int getHeight() { + public int getHeight(Font font) { return 10; } diff --git a/net/minecraft/client/gui/screens/inventory/tooltip/ClientTooltipComponent.java b/net/minecraft/client/gui/screens/inventory/tooltip/ClientTooltipComponent.java index e16b9047..f49f2581 100644 --- a/net/minecraft/client/gui/screens/inventory/tooltip/ClientTooltipComponent.java +++ b/net/minecraft/client/gui/screens/inventory/tooltip/ClientTooltipComponent.java @@ -17,22 +17,24 @@ public interface ClientTooltipComponent { } static ClientTooltipComponent create(TooltipComponent visualTooltipComponent) { - if (visualTooltipComponent instanceof BundleTooltip bundleTooltip) { - return new ClientBundleTooltip(bundleTooltip.contents()); - } else if (visualTooltipComponent instanceof ClientActivePlayersTooltip.ActivePlayersTooltip activePlayersTooltip) { - return new ClientActivePlayersTooltip(activePlayersTooltip); - } else { - throw new IllegalArgumentException("Unknown TooltipComponent"); - } + return (ClientTooltipComponent)(switch (visualTooltipComponent) { + case BundleTooltip bundleTooltip -> new ClientBundleTooltip(bundleTooltip.contents()); + case ClientActivePlayersTooltip.ActivePlayersTooltip activePlayersTooltip -> new ClientActivePlayersTooltip(activePlayersTooltip); + default -> throw new IllegalArgumentException("Unknown TooltipComponent"); + }); } - int getHeight(); + int getHeight(Font font); int getWidth(Font font); + default boolean showTooltipWithItemInHand() { + return false; + } + default void renderText(Font font, int mouseX, int mouseY, Matrix4f matrix, MultiBufferSource.BufferSource bufferSource) { } - default void renderImage(Font font, int x, int y, GuiGraphics guiGraphics) { + default void renderImage(Font font, int i, int j, int k, int l, GuiGraphics guiGraphics) { } } diff --git a/net/minecraft/client/gui/screens/inventory/tooltip/TooltipRenderUtil.java b/net/minecraft/client/gui/screens/inventory/tooltip/TooltipRenderUtil.java index 145c2d02..ed79e697 100644 --- a/net/minecraft/client/gui/screens/inventory/tooltip/TooltipRenderUtil.java +++ b/net/minecraft/client/gui/screens/inventory/tooltip/TooltipRenderUtil.java @@ -1,54 +1,42 @@ package net.minecraft.client.gui.screens.inventory.tooltip; +import java.util.function.UnaryOperator; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.resources.ResourceLocation; +import org.jetbrains.annotations.Nullable; @Environment(EnvType.CLIENT) public class TooltipRenderUtil { + private static final ResourceLocation BACKGROUND_SPRITE = ResourceLocation.withDefaultNamespace("tooltip/background"); + private static final ResourceLocation FRAME_SPRITE = ResourceLocation.withDefaultNamespace("tooltip/frame"); public static final int MOUSE_OFFSET = 12; private static final int PADDING = 3; public static final int PADDING_LEFT = 3; public static final int PADDING_RIGHT = 3; public static final int PADDING_TOP = 3; public static final int PADDING_BOTTOM = 3; - private static final int BACKGROUND_COLOR = -267386864; - private static final int BORDER_COLOR_TOP = 1347420415; - private static final int BORDER_COLOR_BOTTOM = 1344798847; + private static final int MARGIN = 9; - public static void renderTooltipBackground(GuiGraphics guiGraphics, int x, int y, int width, int height, int z) { - int i = x - 3; - int j = y - 3; - int k = width + 3 + 3; - int l = height + 3 + 3; - renderHorizontalLine(guiGraphics, i, j - 1, k, z, -267386864); - renderHorizontalLine(guiGraphics, i, j + l, k, z, -267386864); - renderRectangle(guiGraphics, i, j, k, l, z, -267386864); - renderVerticalLine(guiGraphics, i - 1, j, l, z, -267386864); - renderVerticalLine(guiGraphics, i + k, j, l, z, -267386864); - renderFrameGradient(guiGraphics, i, j + 1, k, l, z, 1347420415, 1344798847); + public static void renderTooltipBackground(GuiGraphics guiGraphics, int i, int j, int k, int l, int m, @Nullable ResourceLocation resourceLocation) { + int n = i - 3 - 9; + int o = j - 3 - 9; + int p = k + 3 + 3 + 18; + int q = l + 3 + 3 + 18; + guiGraphics.pose().pushPose(); + guiGraphics.pose().translate(0.0F, 0.0F, (float)m); + guiGraphics.blitSprite(RenderType::guiTextured, getBackgroundSprite(resourceLocation), n, o, p, q); + guiGraphics.blitSprite(RenderType::guiTextured, getFrameSprite(resourceLocation), n, o, p, q); + guiGraphics.pose().popPose(); } - private static void renderFrameGradient(GuiGraphics guiGraphics, int x, int y, int width, int height, int z, int topColor, int bottomColor) { - renderVerticalLineGradient(guiGraphics, x, y, height - 2, z, topColor, bottomColor); - renderVerticalLineGradient(guiGraphics, x + width - 1, y, height - 2, z, topColor, bottomColor); - renderHorizontalLine(guiGraphics, x, y - 1, width, z, topColor); - renderHorizontalLine(guiGraphics, x, y - 1 + height - 1, width, z, bottomColor); + private static ResourceLocation getBackgroundSprite(@Nullable ResourceLocation resourceLocation) { + return resourceLocation == null ? BACKGROUND_SPRITE : resourceLocation.withPath((UnaryOperator)(string -> "tooltip/" + string + "_background")); } - private static void renderVerticalLine(GuiGraphics guiGraphics, int x, int y, int length, int z, int color) { - guiGraphics.fill(x, y, x + 1, y + length, z, color); - } - - private static void renderVerticalLineGradient(GuiGraphics guiGraphics, int x, int y, int length, int z, int topColor, int bottomColor) { - guiGraphics.fillGradient(x, y, x + 1, y + length, z, topColor, bottomColor); - } - - private static void renderHorizontalLine(GuiGraphics guiGraphics, int x, int y, int length, int z, int color) { - guiGraphics.fill(x, y, x + length, y + 1, z, color); - } - - private static void renderRectangle(GuiGraphics guiGraphics, int x, int y, int width, int height, int z, int color) { - guiGraphics.fill(x, y, x + width, y + height, z, color); + private static ResourceLocation getFrameSprite(@Nullable ResourceLocation resourceLocation) { + return resourceLocation == null ? FRAME_SPRITE : resourceLocation.withPath((UnaryOperator)(string -> "tooltip/" + string + "_frame")); } } diff --git a/net/minecraft/client/gui/screens/multiplayer/JoinMultiplayerScreen.java b/net/minecraft/client/gui/screens/multiplayer/JoinMultiplayerScreen.java index ce410b7c..b67ceb95 100644 --- a/net/minecraft/client/gui/screens/multiplayer/JoinMultiplayerScreen.java +++ b/net/minecraft/client/gui/screens/multiplayer/JoinMultiplayerScreen.java @@ -10,6 +10,7 @@ import net.minecraft.client.gui.layouts.EqualSpacingLayout; import net.minecraft.client.gui.layouts.FrameLayout; import net.minecraft.client.gui.layouts.LinearLayout; import net.minecraft.client.gui.layouts.SpacerElement; +import net.minecraft.client.gui.layouts.EqualSpacingLayout.Orientation; import net.minecraft.client.gui.navigation.CommonInputs; import net.minecraft.client.gui.screens.ConfirmScreen; import net.minecraft.client.gui.screens.ConnectScreen; @@ -22,7 +23,8 @@ import net.minecraft.client.multiplayer.ServerStatusPinger; import net.minecraft.client.multiplayer.resolver.ServerAddress; import net.minecraft.client.resources.language.I18n; import net.minecraft.client.server.LanServer; -import net.minecraft.client.server.LanServerDetection; +import net.minecraft.client.server.LanServerDetection.LanServerDetector; +import net.minecraft.client.server.LanServerDetection.LanServerList; import net.minecraft.network.chat.CommonComponents; import net.minecraft.network.chat.Component; import org.jetbrains.annotations.Nullable; @@ -43,9 +45,9 @@ public class JoinMultiplayerScreen extends Screen { private Button selectButton; private Button deleteButton; private ServerData editingServer; - private LanServerDetection.LanServerList lanServerList; + private LanServerList lanServerList; @Nullable - private LanServerDetection.LanServerDetector lanServerDetector; + private LanServerDetector lanServerDetector; private boolean initedOnce; public JoinMultiplayerScreen(Screen lastScreen) { @@ -61,10 +63,10 @@ public class JoinMultiplayerScreen extends Screen { this.initedOnce = true; this.servers = new ServerList(this.minecraft); this.servers.load(); - this.lanServerList = new LanServerDetection.LanServerList(); + this.lanServerList = new LanServerList(); try { - this.lanServerDetector = new LanServerDetection.LanServerDetector(this.lanServerList); + this.lanServerDetector = new LanServerDetector(this.lanServerList); this.lanServerDetector.start(); } catch (Exception var8) { LOGGER.warn("Unable to start LAN server detection: {}", var8.getMessage()); @@ -113,12 +115,12 @@ public class JoinMultiplayerScreen extends Screen { ); Button button4 = this.addRenderableWidget(Button.builder(CommonComponents.GUI_BACK, buttonx -> this.onClose()).width(74).build()); LinearLayout linearLayout = LinearLayout.vertical(); - EqualSpacingLayout equalSpacingLayout = linearLayout.addChild(new EqualSpacingLayout(308, 20, EqualSpacingLayout.Orientation.HORIZONTAL)); + EqualSpacingLayout equalSpacingLayout = linearLayout.addChild(new EqualSpacingLayout(308, 20, Orientation.HORIZONTAL)); equalSpacingLayout.addChild(this.selectButton); equalSpacingLayout.addChild(button); equalSpacingLayout.addChild(button2); linearLayout.addChild(SpacerElement.height(4)); - EqualSpacingLayout equalSpacingLayout2 = linearLayout.addChild(new EqualSpacingLayout(308, 20, EqualSpacingLayout.Orientation.HORIZONTAL)); + EqualSpacingLayout equalSpacingLayout2 = linearLayout.addChild(new EqualSpacingLayout(308, 20, Orientation.HORIZONTAL)); equalSpacingLayout2.addChild(this.editButton); equalSpacingLayout2.addChild(this.deleteButton); equalSpacingLayout2.addChild(button3); diff --git a/net/minecraft/client/gui/screens/multiplayer/ServerLinksScreen.java b/net/minecraft/client/gui/screens/multiplayer/ServerLinksScreen.java index ae9bc848..23b1d7a4 100644 --- a/net/minecraft/client/gui/screens/multiplayer/ServerLinksScreen.java +++ b/net/minecraft/client/gui/screens/multiplayer/ServerLinksScreen.java @@ -16,6 +16,7 @@ import net.minecraft.client.gui.screens.Screen; import net.minecraft.network.chat.CommonComponents; import net.minecraft.network.chat.Component; import net.minecraft.server.ServerLinks; +import net.minecraft.server.ServerLinks.Entry; import org.jetbrains.annotations.Nullable; @Environment(EnvType.CLIENT) @@ -83,7 +84,7 @@ public class ServerLinksScreen extends Screen { static class LinkListEntry extends ContainerObjectSelectionList.Entry { final AbstractWidget button; - LinkListEntry(Screen screen, ServerLinks.Entry entry) { + LinkListEntry(Screen screen, Entry entry) { this.button = Button.builder(entry.displayName(), ConfirmLinkScreen.confirmLink(screen, entry.link(), false)).width(310).build(); } diff --git a/net/minecraft/client/gui/screens/multiplayer/ServerSelectionList.java b/net/minecraft/client/gui/screens/multiplayer/ServerSelectionList.java index 2803a89f..6641b498 100644 --- a/net/minecraft/client/gui/screens/multiplayer/ServerSelectionList.java +++ b/net/minecraft/client/gui/screens/multiplayer/ServerSelectionList.java @@ -3,7 +3,6 @@ package net.minecraft.client.gui.screens.multiplayer; import com.google.common.collect.Lists; import com.google.common.util.concurrent.ThreadFactoryBuilder; import com.mojang.blaze3d.platform.NativeImage; -import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.logging.LogUtils; import java.net.UnknownHostException; import java.util.Arrays; @@ -24,6 +23,7 @@ import net.minecraft.client.gui.screens.LoadingDotsText; import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.multiplayer.ServerData; import net.minecraft.client.multiplayer.ServerList; +import net.minecraft.client.renderer.RenderType; import net.minecraft.client.server.LanServer; import net.minecraft.network.chat.CommonComponents; import net.minecraft.network.chat.Component; @@ -309,7 +309,7 @@ public class ServerSelectionList extends ObjectSelectionList 16) { - guiGraphics.blitSprite(ServerSelectionList.JOIN_HIGHLIGHTED_SPRITE, left, top, 32, 32); + guiGraphics.blitSprite(RenderType::guiTextured, ServerSelectionList.JOIN_HIGHLIGHTED_SPRITE, left, top, 32, 32); } else { - guiGraphics.blitSprite(ServerSelectionList.JOIN_SPRITE, left, top, 32, 32); + guiGraphics.blitSprite(RenderType::guiTextured, ServerSelectionList.JOIN_SPRITE, left, top, 32, 32); } } if (index > 0) { if (l < 16 && m < 16) { - guiGraphics.blitSprite(ServerSelectionList.MOVE_UP_HIGHLIGHTED_SPRITE, left, top, 32, 32); + guiGraphics.blitSprite(RenderType::guiTextured, ServerSelectionList.MOVE_UP_HIGHLIGHTED_SPRITE, left, top, 32, 32); } else { - guiGraphics.blitSprite(ServerSelectionList.MOVE_UP_SPRITE, left, top, 32, 32); + guiGraphics.blitSprite(RenderType::guiTextured, ServerSelectionList.MOVE_UP_SPRITE, left, top, 32, 32); } } if (index < this.screen.getServers().size() - 1) { if (l < 16 && m > 16) { - guiGraphics.blitSprite(ServerSelectionList.MOVE_DOWN_HIGHLIGHTED_SPRITE, left, top, 32, 32); + guiGraphics.blitSprite(RenderType::guiTextured, ServerSelectionList.MOVE_DOWN_HIGHLIGHTED_SPRITE, left, top, 32, 32); } else { - guiGraphics.blitSprite(ServerSelectionList.MOVE_DOWN_SPRITE, left, top, 32, 32); + guiGraphics.blitSprite(RenderType::guiTextured, ServerSelectionList.MOVE_DOWN_SPRITE, left, top, 32, 32); } } } @@ -404,9 +404,7 @@ public class ServerSelectionList extends ObjectSelectionList this.minecraft.setScreen(this.lastScreen)).build()); } + + private boolean isMinecartOptionEnabled() { + return this.minecraft.level != null && this.minecraft.level.enabledFeatures().contains(FeatureFlags.MINECART_IMPROVEMENTS); + } } diff --git a/net/minecraft/client/gui/screens/options/OptionsScreen.java b/net/minecraft/client/gui/screens/options/OptionsScreen.java index dba0cf59..3f0ce203 100644 --- a/net/minecraft/client/gui/screens/options/OptionsScreen.java +++ b/net/minecraft/client/gui/screens/options/OptionsScreen.java @@ -17,6 +17,8 @@ import net.minecraft.client.gui.layouts.HeaderAndFooterLayout; import net.minecraft.client.gui.layouts.LayoutElement; import net.minecraft.client.gui.layouts.LayoutSettings; import net.minecraft.client.gui.layouts.LinearLayout; +import net.minecraft.client.gui.layouts.EqualSpacingLayout.Orientation; +import net.minecraft.client.gui.layouts.GridLayout.RowHelper; import net.minecraft.client.gui.screens.ConfirmScreen; import net.minecraft.client.gui.screens.CreditsAndAttributionScreen; import net.minecraft.client.gui.screens.Screen; @@ -69,7 +71,7 @@ public class OptionsScreen extends Screen { linearLayout2.addChild(this.createOnlineButton()); GridLayout gridLayout = new GridLayout(); gridLayout.defaultCellSetting().paddingHorizontal(4).paddingBottom(4).alignHorizontallyCenter(); - GridLayout.RowHelper rowHelper = gridLayout.createRowHelper(2); + RowHelper rowHelper = gridLayout.createRowHelper(2); rowHelper.addChild(this.openScreenButton(SKIN_CUSTOMIZATION, () -> new SkinCustomizationScreen(this, this.options))); rowHelper.addChild(this.openScreenButton(SOUNDS, () -> new SoundOptionsScreen(this, this.options))); rowHelper.addChild(this.openScreenButton(VIDEO, () -> new VideoSettingsScreen(this, this.minecraft, this.options))); @@ -135,7 +137,7 @@ public class OptionsScreen extends Screen { this.lockButton.setLocked(this.minecraft.level.getLevelData().isDifficultyLocked()); this.lockButton.active = !this.lockButton.isLocked(); this.difficultyButton.active = !this.lockButton.isLocked(); - EqualSpacingLayout equalSpacingLayout = new EqualSpacingLayout(150, 0, EqualSpacingLayout.Orientation.HORIZONTAL); + EqualSpacingLayout equalSpacingLayout = new EqualSpacingLayout(150, 0, Orientation.HORIZONTAL); equalSpacingLayout.addChild(this.difficultyButton); equalSpacingLayout.addChild(this.lockButton); return equalSpacingLayout; diff --git a/net/minecraft/client/gui/screens/options/SkinCustomizationScreen.java b/net/minecraft/client/gui/screens/options/SkinCustomizationScreen.java index 82e5fa58..eba4103e 100644 --- a/net/minecraft/client/gui/screens/options/SkinCustomizationScreen.java +++ b/net/minecraft/client/gui/screens/options/SkinCustomizationScreen.java @@ -26,7 +26,7 @@ public class SkinCustomizationScreen extends OptionsSubScreen { for (PlayerModelPart playerModelPart : PlayerModelPart.values()) { list.add( CycleButton.onOffBuilder(this.options.isModelPartEnabled(playerModelPart)) - .create(playerModelPart.getName(), (cycleButton, boolean_) -> this.options.toggleModelPart(playerModelPart, boolean_)) + .create(playerModelPart.getName(), (cycleButton, boolean_) -> this.options.setModelPart(playerModelPart, boolean_)) ); } diff --git a/net/minecraft/client/gui/screens/options/VideoSettingsScreen.java b/net/minecraft/client/gui/screens/options/VideoSettingsScreen.java index baf46bfb..c9db6a25 100644 --- a/net/minecraft/client/gui/screens/options/VideoSettingsScreen.java +++ b/net/minecraft/client/gui/screens/options/VideoSettingsScreen.java @@ -40,7 +40,7 @@ public class VideoSettingsScreen extends OptionsSubScreen { options.ambientOcclusion(), options.framerateLimit(), options.enableVsync(), - options.bobView(), + options.inactivityFpsLimit(), options.guiScale(), options.attackIndicator(), options.gamma(), @@ -55,7 +55,8 @@ public class VideoSettingsScreen extends OptionsSubScreen { options.showAutosaveIndicator(), options.glintSpeed(), options.glintStrength(), - options.menuBackgroundBlurriness() + options.menuBackgroundBlurriness(), + options.bobView() }; } diff --git a/net/minecraft/client/gui/screens/options/controls/KeyBindsList.java b/net/minecraft/client/gui/screens/options/controls/KeyBindsList.java index f796d22a..6bb1602c 100644 --- a/net/minecraft/client/gui/screens/options/controls/KeyBindsList.java +++ b/net/minecraft/client/gui/screens/options/controls/KeyBindsList.java @@ -16,9 +16,8 @@ import net.minecraft.client.gui.components.ContainerObjectSelectionList; import net.minecraft.client.gui.components.Tooltip; import net.minecraft.client.gui.components.events.GuiEventListener; import net.minecraft.client.gui.narration.NarratableEntry; -import net.minecraft.client.gui.narration.NarratedElementType; -import net.minecraft.client.gui.narration.NarrationElementOutput; import net.minecraft.client.gui.navigation.FocusNavigationEvent; +import net.minecraft.client.gui.screens.options.controls.KeyBindsList.CategoryEntry.1; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.MutableComponent; import org.apache.commons.lang3.ArrayUtils; @@ -96,17 +95,7 @@ public class KeyBindsList extends ContainerObjectSelectionList narratables() { - return ImmutableList.of(new NarratableEntry() { - @Override - public NarratableEntry.NarrationPriority narrationPriority() { - return NarratableEntry.NarrationPriority.HOVERED; - } - - @Override - public void updateNarration(NarrationElementOutput narrationElementOutput) { - narrationElementOutput.add(NarratedElementType.TITLE, CategoryEntry.this.name); - } - }); + return ImmutableList.of(new 1(this)); } @Override @@ -144,7 +133,7 @@ public class KeyBindsList extends ContainerObjectSelectionList { - KeyBindsList.this.minecraft.options.setKey(key, key.getDefaultKey()); + key.setKey(key.getDefaultKey()); KeyBindsList.this.resetMappingAndUpdateButtons(); }).bounds(0, 0, 50, 20).createNarration(supplier -> Component.translatable("narrator.controls.reset", name)).build(); this.refreshEntry(); diff --git a/net/minecraft/client/gui/screens/options/controls/KeyBindsScreen.java b/net/minecraft/client/gui/screens/options/controls/KeyBindsScreen.java index 1434cb44..c9a265c1 100644 --- a/net/minecraft/client/gui/screens/options/controls/KeyBindsScreen.java +++ b/net/minecraft/client/gui/screens/options/controls/KeyBindsScreen.java @@ -1,6 +1,7 @@ package net.minecraft.client.gui.screens.options.controls; import com.mojang.blaze3d.platform.InputConstants; +import com.mojang.blaze3d.platform.InputConstants.Type; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.Util; @@ -60,7 +61,7 @@ public class KeyBindsScreen extends OptionsSubScreen { @Override public boolean mouseClicked(double mouseX, double mouseY, int button) { if (this.selectedKey != null) { - this.options.setKey(this.selectedKey, InputConstants.Type.MOUSE.getOrCreate(button)); + this.selectedKey.setKey(Type.MOUSE.getOrCreate(button)); this.selectedKey = null; this.keyBindsList.resetMappingAndUpdateButtons(); return true; @@ -73,9 +74,9 @@ public class KeyBindsScreen extends OptionsSubScreen { public boolean keyPressed(int keyCode, int scanCode, int modifiers) { if (this.selectedKey != null) { if (keyCode == 256) { - this.options.setKey(this.selectedKey, InputConstants.UNKNOWN); + this.selectedKey.setKey(InputConstants.UNKNOWN); } else { - this.options.setKey(this.selectedKey, InputConstants.getKey(keyCode, scanCode)); + this.selectedKey.setKey(InputConstants.getKey(keyCode, scanCode)); } this.selectedKey = null; diff --git a/net/minecraft/client/gui/screens/packs/PackSelectionScreen.java b/net/minecraft/client/gui/screens/packs/PackSelectionScreen.java index 0553540e..735dc3a3 100644 --- a/net/minecraft/client/gui/screens/packs/PackSelectionScreen.java +++ b/net/minecraft/client/gui/screens/packs/PackSelectionScreen.java @@ -40,6 +40,7 @@ import net.minecraft.client.gui.screens.AlertScreen; import net.minecraft.client.gui.screens.ConfirmScreen; import net.minecraft.client.gui.screens.NoticeWithLinkScreen; import net.minecraft.client.gui.screens.Screen; +import net.minecraft.client.gui.screens.packs.PackSelectionModel.Entry; import net.minecraft.client.renderer.texture.DynamicTexture; import net.minecraft.client.renderer.texture.TextureManager; import net.minecraft.network.chat.CommonComponents; @@ -153,7 +154,7 @@ public class PackSelectionScreen extends Screen { this.doneButton.active = !this.selectedPackList.children().isEmpty(); } - private void updateList(TransferableSelectionList selection, Stream models) { + private void updateList(TransferableSelectionList selection, Stream models) { selection.children().clear(); TransferableSelectionList.PackEntry packEntry = selection.getSelected(); String string = packEntry == null ? "" : packEntry.getPackId(); diff --git a/net/minecraft/client/gui/screens/packs/TransferableSelectionList.java b/net/minecraft/client/gui/screens/packs/TransferableSelectionList.java index 43cf9563..eba3bb67 100644 --- a/net/minecraft/client/gui/screens/packs/TransferableSelectionList.java +++ b/net/minecraft/client/gui/screens/packs/TransferableSelectionList.java @@ -9,6 +9,7 @@ import net.minecraft.client.gui.components.MultiLineLabel; import net.minecraft.client.gui.components.ObjectSelectionList; import net.minecraft.client.gui.screens.ConfirmScreen; import net.minecraft.client.gui.screens.Screen; +import net.minecraft.client.renderer.RenderType; import net.minecraft.locale.Language; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.FormattedText; @@ -145,7 +146,7 @@ public class TransferableSelectionList extends ObjectSelectionList 16 && k < 16) { - guiGraphics.blitSprite(TransferableSelectionList.MOVE_UP_HIGHLIGHTED_SPRITE, left, top, 32, 32); + guiGraphics.blitSprite(RenderType::guiTextured, TransferableSelectionList.MOVE_UP_HIGHLIGHTED_SPRITE, left, top, 32, 32); } else { - guiGraphics.blitSprite(TransferableSelectionList.MOVE_UP_SPRITE, left, top, 32, 32); + guiGraphics.blitSprite(RenderType::guiTextured, TransferableSelectionList.MOVE_UP_SPRITE, left, top, 32, 32); } } if (this.pack.canMoveDown()) { if (j < 32 && j > 16 && k > 16) { - guiGraphics.blitSprite(TransferableSelectionList.MOVE_DOWN_HIGHLIGHTED_SPRITE, left, top, 32, 32); + guiGraphics.blitSprite(RenderType::guiTextured, TransferableSelectionList.MOVE_DOWN_HIGHLIGHTED_SPRITE, left, top, 32, 32); } else { - guiGraphics.blitSprite(TransferableSelectionList.MOVE_DOWN_SPRITE, left, top, 32, 32); + guiGraphics.blitSprite(RenderType::guiTextured, TransferableSelectionList.MOVE_DOWN_SPRITE, left, top, 32, 32); } } } diff --git a/net/minecraft/client/gui/screens/recipebook/AbstractFurnaceRecipeBookComponent.java b/net/minecraft/client/gui/screens/recipebook/AbstractFurnaceRecipeBookComponent.java deleted file mode 100644 index 954ed8d4..00000000 --- a/net/minecraft/client/gui/screens/recipebook/AbstractFurnaceRecipeBookComponent.java +++ /dev/null @@ -1,73 +0,0 @@ -package net.minecraft.client.gui.screens.recipebook; - -import java.util.Iterator; -import java.util.List; -import java.util.Set; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.client.gui.components.WidgetSprites; -import net.minecraft.core.NonNullList; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.inventory.Slot; -import net.minecraft.world.item.Item; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.crafting.Ingredient; -import net.minecraft.world.item.crafting.RecipeHolder; -import org.jetbrains.annotations.Nullable; - -@Environment(EnvType.CLIENT) -public abstract class AbstractFurnaceRecipeBookComponent extends RecipeBookComponent { - private static final WidgetSprites FILTER_SPRITES = new WidgetSprites( - ResourceLocation.withDefaultNamespace("recipe_book/furnace_filter_enabled"), - ResourceLocation.withDefaultNamespace("recipe_book/furnace_filter_disabled"), - ResourceLocation.withDefaultNamespace("recipe_book/furnace_filter_enabled_highlighted"), - ResourceLocation.withDefaultNamespace("recipe_book/furnace_filter_disabled_highlighted") - ); - @Nullable - private Ingredient fuels; - - @Override - protected void initFilterButtonTextures() { - this.filterButton.initTextureValues(FILTER_SPRITES); - } - - @Override - public void slotClicked(@Nullable Slot slot) { - super.slotClicked(slot); - if (slot != null && slot.index < this.menu.getSize()) { - this.ghostRecipe.clear(); - } - } - - @Override - public void setupGhostRecipe(RecipeHolder recipe, List slots) { - ItemStack itemStack = recipe.value().getResultItem(this.minecraft.level.registryAccess()); - this.ghostRecipe.setRecipe(recipe); - this.ghostRecipe.addIngredient(Ingredient.of(itemStack), ((Slot)slots.get(2)).x, ((Slot)slots.get(2)).y); - NonNullList nonNullList = recipe.value().getIngredients(); - Slot slot = (Slot)slots.get(1); - if (slot.getItem().isEmpty()) { - if (this.fuels == null) { - this.fuels = Ingredient.of(this.getFuelItems().stream().filter(item -> item.isEnabled(this.minecraft.level.enabledFeatures())).map(ItemStack::new)); - } - - this.ghostRecipe.addIngredient(this.fuels, slot.x, slot.y); - } - - Iterator iterator = nonNullList.iterator(); - - for (int i = 0; i < 2; i++) { - if (!iterator.hasNext()) { - return; - } - - Ingredient ingredient = (Ingredient)iterator.next(); - if (!ingredient.isEmpty()) { - Slot slot2 = (Slot)slots.get(i); - this.ghostRecipe.addIngredient(ingredient, slot2.x, slot2.y); - } - } - } - - protected abstract Set getFuelItems(); -} diff --git a/net/minecraft/client/gui/screens/recipebook/BlastingRecipeBookComponent.java b/net/minecraft/client/gui/screens/recipebook/BlastingRecipeBookComponent.java deleted file mode 100644 index 2eaf0dd2..00000000 --- a/net/minecraft/client/gui/screens/recipebook/BlastingRecipeBookComponent.java +++ /dev/null @@ -1,23 +0,0 @@ -package net.minecraft.client.gui.screens.recipebook; - -import java.util.Set; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.network.chat.Component; -import net.minecraft.world.item.Item; -import net.minecraft.world.level.block.entity.AbstractFurnaceBlockEntity; - -@Environment(EnvType.CLIENT) -public class BlastingRecipeBookComponent extends AbstractFurnaceRecipeBookComponent { - private static final Component FILTER_NAME = Component.translatable("gui.recipebook.toggleRecipes.blastable"); - - @Override - protected Component getRecipeFilterName() { - return FILTER_NAME; - } - - @Override - protected Set getFuelItems() { - return AbstractFurnaceBlockEntity.getFuel().keySet(); - } -} diff --git a/net/minecraft/client/gui/screens/recipebook/CraftingRecipeBookComponent.java b/net/minecraft/client/gui/screens/recipebook/CraftingRecipeBookComponent.java new file mode 100644 index 00000000..b7050919 --- /dev/null +++ b/net/minecraft/client/gui/screens/recipebook/CraftingRecipeBookComponent.java @@ -0,0 +1,104 @@ +package net.minecraft.client.gui.screens.recipebook; + +import java.util.List; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.client.gui.components.WidgetSprites; +import net.minecraft.network.chat.Component; +import net.minecraft.recipebook.PlaceRecipeHelper; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.context.ContextMap; +import net.minecraft.world.entity.player.StackedItemContents; +import net.minecraft.world.inventory.AbstractCraftingMenu; +import net.minecraft.world.inventory.Slot; +import net.minecraft.world.item.Items; +import net.minecraft.world.item.crafting.RecipeBookCategories; +import net.minecraft.world.item.crafting.display.RecipeDisplay; +import net.minecraft.world.item.crafting.display.ShapedCraftingRecipeDisplay; +import net.minecraft.world.item.crafting.display.ShapelessCraftingRecipeDisplay; +import net.minecraft.world.item.crafting.display.SlotDisplay; + +@Environment(EnvType.CLIENT) +public class CraftingRecipeBookComponent extends RecipeBookComponent { + private static final WidgetSprites FILTER_BUTTON_SPRITES = new WidgetSprites( + ResourceLocation.withDefaultNamespace("recipe_book/filter_enabled"), + ResourceLocation.withDefaultNamespace("recipe_book/filter_disabled"), + ResourceLocation.withDefaultNamespace("recipe_book/filter_enabled_highlighted"), + ResourceLocation.withDefaultNamespace("recipe_book/filter_disabled_highlighted") + ); + private static final Component ONLY_CRAFTABLES_TOOLTIP = Component.translatable("gui.recipebook.toggleRecipes.craftable"); + private static final List TABS = List.of( + new RecipeBookComponent.TabInfo(SearchRecipeBookCategory.CRAFTING), + new RecipeBookComponent.TabInfo(Items.IRON_AXE, Items.GOLDEN_SWORD, RecipeBookCategories.CRAFTING_EQUIPMENT), + new RecipeBookComponent.TabInfo(Items.BRICKS, RecipeBookCategories.CRAFTING_BUILDING_BLOCKS), + new RecipeBookComponent.TabInfo(Items.LAVA_BUCKET, Items.APPLE, RecipeBookCategories.CRAFTING_MISC), + new RecipeBookComponent.TabInfo(Items.REDSTONE, RecipeBookCategories.CRAFTING_REDSTONE) + ); + + public CraftingRecipeBookComponent(AbstractCraftingMenu abstractCraftingMenu) { + super(abstractCraftingMenu, TABS); + } + + @Override + protected boolean isCraftingSlot(Slot slot) { + return this.menu.getResultSlot() == slot || this.menu.getInputGridSlots().contains(slot); + } + + private boolean canDisplay(RecipeDisplay recipeDisplay) { + int i = this.menu.getGridWidth(); + int j = this.menu.getGridHeight(); + + return switch (recipeDisplay) { + case ShapedCraftingRecipeDisplay shapedCraftingRecipeDisplay -> i >= shapedCraftingRecipeDisplay.width() && j >= shapedCraftingRecipeDisplay.height(); + case ShapelessCraftingRecipeDisplay shapelessCraftingRecipeDisplay -> i * j >= shapelessCraftingRecipeDisplay.ingredients().size(); + default -> false; + }; + } + + @Override + protected void fillGhostRecipe(GhostSlots ghostSlots, RecipeDisplay recipeDisplay, ContextMap contextMap) { + ghostSlots.setResult(this.menu.getResultSlot(), contextMap, recipeDisplay.result()); + switch (recipeDisplay) { + case ShapedCraftingRecipeDisplay shapedCraftingRecipeDisplay: + List list = this.menu.getInputGridSlots(); + PlaceRecipeHelper.placeRecipe( + this.menu.getGridWidth(), + this.menu.getGridHeight(), + shapedCraftingRecipeDisplay.width(), + shapedCraftingRecipeDisplay.height(), + shapedCraftingRecipeDisplay.ingredients(), + (slotDisplay, ix, jx, k) -> { + Slot slot = (Slot)list.get(ix); + ghostSlots.setInput(slot, contextMap, slotDisplay); + } + ); + break; + case ShapelessCraftingRecipeDisplay shapelessCraftingRecipeDisplay: + label15: { + List list2 = this.menu.getInputGridSlots(); + int i = Math.min(shapelessCraftingRecipeDisplay.ingredients().size(), list2.size()); + + for (int j = 0; j < i; j++) { + ghostSlots.setInput((Slot)list2.get(j), contextMap, (SlotDisplay)shapelessCraftingRecipeDisplay.ingredients().get(j)); + } + break label15; + } + default: + } + } + + @Override + protected void initFilterButtonTextures() { + this.filterButton.initTextureValues(FILTER_BUTTON_SPRITES); + } + + @Override + protected Component getRecipeFilterName() { + return ONLY_CRAFTABLES_TOOLTIP; + } + + @Override + protected void selectMatchingRecipes(RecipeCollection recipeCollection, StackedItemContents stackedItemContents) { + recipeCollection.selectRecipes(stackedItemContents, this::canDisplay); + } +} diff --git a/net/minecraft/client/gui/screens/recipebook/FurnaceRecipeBookComponent.java b/net/minecraft/client/gui/screens/recipebook/FurnaceRecipeBookComponent.java new file mode 100644 index 00000000..1bec7452 --- /dev/null +++ b/net/minecraft/client/gui/screens/recipebook/FurnaceRecipeBookComponent.java @@ -0,0 +1,65 @@ +package net.minecraft.client.gui.screens.recipebook; + +import java.util.List; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.client.gui.components.WidgetSprites; +import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.context.ContextMap; +import net.minecraft.world.entity.player.StackedItemContents; +import net.minecraft.world.inventory.AbstractFurnaceMenu; +import net.minecraft.world.inventory.Slot; +import net.minecraft.world.item.crafting.display.FurnaceRecipeDisplay; +import net.minecraft.world.item.crafting.display.RecipeDisplay; + +@Environment(EnvType.CLIENT) +public class FurnaceRecipeBookComponent extends RecipeBookComponent { + private static final WidgetSprites FILTER_SPRITES = new WidgetSprites( + ResourceLocation.withDefaultNamespace("recipe_book/furnace_filter_enabled"), + ResourceLocation.withDefaultNamespace("recipe_book/furnace_filter_disabled"), + ResourceLocation.withDefaultNamespace("recipe_book/furnace_filter_enabled_highlighted"), + ResourceLocation.withDefaultNamespace("recipe_book/furnace_filter_disabled_highlighted") + ); + private final Component recipeFilterName; + + public FurnaceRecipeBookComponent(AbstractFurnaceMenu abstractFurnaceMenu, Component component, List list) { + super(abstractFurnaceMenu, list); + this.recipeFilterName = component; + } + + @Override + protected void initFilterButtonTextures() { + this.filterButton.initTextureValues(FILTER_SPRITES); + } + + @Override + protected boolean isCraftingSlot(Slot slot) { + return switch (slot.index) { + case 0, 1, 2 -> true; + default -> false; + }; + } + + @Override + protected void fillGhostRecipe(GhostSlots ghostSlots, RecipeDisplay recipeDisplay, ContextMap contextMap) { + ghostSlots.setResult(this.menu.getResultSlot(), contextMap, recipeDisplay.result()); + if (recipeDisplay instanceof FurnaceRecipeDisplay furnaceRecipeDisplay) { + ghostSlots.setInput(this.menu.slots.get(0), contextMap, furnaceRecipeDisplay.ingredient()); + Slot slot = this.menu.slots.get(1); + if (slot.getItem().isEmpty()) { + ghostSlots.setInput(slot, contextMap, furnaceRecipeDisplay.fuel()); + } + } + } + + @Override + protected Component getRecipeFilterName() { + return this.recipeFilterName; + } + + @Override + protected void selectMatchingRecipes(RecipeCollection recipeCollection, StackedItemContents stackedItemContents) { + recipeCollection.selectRecipes(stackedItemContents, recipeDisplay -> recipeDisplay instanceof FurnaceRecipeDisplay); + } +} diff --git a/net/minecraft/client/gui/screens/recipebook/GhostRecipe.java b/net/minecraft/client/gui/screens/recipebook/GhostRecipe.java deleted file mode 100644 index 8def098b..00000000 --- a/net/minecraft/client/gui/screens/recipebook/GhostRecipe.java +++ /dev/null @@ -1,100 +0,0 @@ -package net.minecraft.client.gui.screens.recipebook; - -import com.google.common.collect.Lists; -import java.util.List; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.GuiGraphics; -import net.minecraft.client.gui.screens.Screen; -import net.minecraft.client.renderer.RenderType; -import net.minecraft.util.Mth; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.crafting.Ingredient; -import net.minecraft.world.item.crafting.RecipeHolder; -import org.jetbrains.annotations.Nullable; - -@Environment(EnvType.CLIENT) -public class GhostRecipe { - @Nullable - private RecipeHolder recipe; - private final List ingredients = Lists.newArrayList(); - float time; - - public void clear() { - this.recipe = null; - this.ingredients.clear(); - this.time = 0.0F; - } - - public void addIngredient(Ingredient ingredient, int x, int y) { - this.ingredients.add(new GhostRecipe.GhostIngredient(ingredient, x, y)); - } - - public GhostRecipe.GhostIngredient get(int index) { - return (GhostRecipe.GhostIngredient)this.ingredients.get(index); - } - - public int size() { - return this.ingredients.size(); - } - - @Nullable - public RecipeHolder getRecipe() { - return this.recipe; - } - - public void setRecipe(RecipeHolder recipe) { - this.recipe = recipe; - } - - public void render(GuiGraphics guiGraphics, Minecraft minecraft, int leftPos, int topPos, boolean offset, float partialTick) { - if (!Screen.hasControlDown()) { - this.time += partialTick; - } - - for (int i = 0; i < this.ingredients.size(); i++) { - GhostRecipe.GhostIngredient ghostIngredient = (GhostRecipe.GhostIngredient)this.ingredients.get(i); - int j = ghostIngredient.getX() + leftPos; - int k = ghostIngredient.getY() + topPos; - if (i == 0 && offset) { - guiGraphics.fill(j - 4, k - 4, j + 20, k + 20, 822018048); - } else { - guiGraphics.fill(j, k, j + 16, k + 16, 822018048); - } - - ItemStack itemStack = ghostIngredient.getItem(); - guiGraphics.renderFakeItem(itemStack, j, k); - guiGraphics.fill(RenderType.guiGhostRecipeOverlay(), j, k, j + 16, k + 16, 822083583); - if (i == 0) { - guiGraphics.renderItemDecorations(minecraft.font, itemStack, j, k); - } - } - } - - @Environment(EnvType.CLIENT) - public class GhostIngredient { - private final Ingredient ingredient; - private final int x; - private final int y; - - public GhostIngredient(final Ingredient ingredient, final int x, final int y) { - this.ingredient = ingredient; - this.x = x; - this.y = y; - } - - public int getX() { - return this.x; - } - - public int getY() { - return this.y; - } - - public ItemStack getItem() { - ItemStack[] itemStacks = this.ingredient.getItems(); - return itemStacks.length == 0 ? ItemStack.EMPTY : itemStacks[Mth.floor(GhostRecipe.this.time / 30.0F) % itemStacks.length]; - } - } -} diff --git a/net/minecraft/client/gui/screens/recipebook/GhostSlots.java b/net/minecraft/client/gui/screens/recipebook/GhostSlots.java new file mode 100644 index 00000000..a4c713ef --- /dev/null +++ b/net/minecraft/client/gui/screens/recipebook/GhostSlots.java @@ -0,0 +1,84 @@ +package net.minecraft.client.gui.screens.recipebook; + +import it.unimi.dsi.fastutil.objects.Reference2ObjectArrayMap; +import it.unimi.dsi.fastutil.objects.Reference2ObjectMap; +import java.util.List; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.screens.Screen; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.core.component.DataComponents; +import net.minecraft.util.context.ContextMap; +import net.minecraft.world.inventory.Slot; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.display.SlotDisplay; +import org.jetbrains.annotations.Nullable; + +@Environment(EnvType.CLIENT) +public class GhostSlots { + private final Reference2ObjectMap ingredients = new Reference2ObjectArrayMap<>(); + private final SlotSelectTime slotSelectTime; + + public GhostSlots(SlotSelectTime slotSelectTime) { + this.slotSelectTime = slotSelectTime; + } + + public void clear() { + this.ingredients.clear(); + } + + private void setSlot(Slot slot, ContextMap contextMap, SlotDisplay slotDisplay, boolean bl) { + List list = slotDisplay.resolveForStacks(contextMap); + if (!list.isEmpty()) { + this.ingredients.put(slot, new GhostSlots.GhostSlot(list, bl)); + } + } + + protected void setInput(Slot slot, ContextMap contextMap, SlotDisplay slotDisplay) { + this.setSlot(slot, contextMap, slotDisplay, false); + } + + protected void setResult(Slot slot, ContextMap contextMap, SlotDisplay slotDisplay) { + this.setSlot(slot, contextMap, slotDisplay, true); + } + + public void render(GuiGraphics guiGraphics, Minecraft minecraft, boolean bl) { + this.ingredients.forEach((slot, ghostSlot) -> { + int i = slot.x; + int j = slot.y; + if (ghostSlot.isResultSlot && bl) { + guiGraphics.fill(i - 4, j - 4, i + 20, j + 20, 822018048); + } else { + guiGraphics.fill(i, j, i + 16, j + 16, 822018048); + } + + ItemStack itemStack = ghostSlot.getItem(this.slotSelectTime.currentIndex()); + guiGraphics.renderFakeItem(itemStack, i, j); + guiGraphics.fill(RenderType.guiGhostRecipeOverlay(), i, j, i + 16, j + 16, 822083583); + if (ghostSlot.isResultSlot) { + guiGraphics.renderItemDecorations(minecraft.font, itemStack, i, j); + } + }); + } + + public void renderTooltip(GuiGraphics guiGraphics, Minecraft minecraft, int i, int j, @Nullable Slot slot) { + if (slot != null) { + GhostSlots.GhostSlot ghostSlot = this.ingredients.get(slot); + if (ghostSlot != null) { + ItemStack itemStack = ghostSlot.getItem(this.slotSelectTime.currentIndex()); + guiGraphics.renderComponentTooltip(minecraft.font, Screen.getTooltipFromItem(minecraft, itemStack), i, j, itemStack.get(DataComponents.TOOLTIP_STYLE)); + } + } + } + + @Environment(EnvType.CLIENT) + record GhostSlot(List items, boolean isResultSlot) { + + public ItemStack getItem(int i) { + int j = this.items.size(); + return j == 0 ? ItemStack.EMPTY : (ItemStack)this.items.get(i % j); + } + } +} diff --git a/net/minecraft/client/gui/screens/recipebook/OverlayRecipeComponent.java b/net/minecraft/client/gui/screens/recipebook/OverlayRecipeComponent.java index 06c7d8e4..0d3fde2a 100644 --- a/net/minecraft/client/gui/screens/recipebook/OverlayRecipeComponent.java +++ b/net/minecraft/client/gui/screens/recipebook/OverlayRecipeComponent.java @@ -1,43 +1,36 @@ package net.minecraft.client.gui.screens.recipebook; import com.google.common.collect.Lists; -import com.mojang.blaze3d.systems.RenderSystem; +import java.util.ArrayList; import java.util.Collections; import java.util.List; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; -import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.AbstractWidget; import net.minecraft.client.gui.components.Renderable; import net.minecraft.client.gui.components.events.GuiEventListener; import net.minecraft.client.gui.narration.NarrationElementOutput; +import net.minecraft.client.gui.screens.recipebook.OverlayRecipeComponent.OverlayRecipeButton.Pos; +import net.minecraft.client.renderer.RenderType; import net.minecraft.network.chat.CommonComponents; -import net.minecraft.recipebook.PlaceRecipe; +import net.minecraft.recipebook.PlaceRecipeHelper; import net.minecraft.resources.ResourceLocation; import net.minecraft.util.Mth; -import net.minecraft.world.inventory.AbstractFurnaceMenu; -import net.minecraft.world.inventory.RecipeBookMenu; +import net.minecraft.util.context.ContextMap; import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.crafting.Ingredient; -import net.minecraft.world.item.crafting.RecipeHolder; +import net.minecraft.world.item.crafting.display.FurnaceRecipeDisplay; +import net.minecraft.world.item.crafting.display.RecipeDisplay; +import net.minecraft.world.item.crafting.display.RecipeDisplayEntry; +import net.minecraft.world.item.crafting.display.RecipeDisplayId; +import net.minecraft.world.item.crafting.display.ShapedCraftingRecipeDisplay; +import net.minecraft.world.item.crafting.display.ShapelessCraftingRecipeDisplay; +import net.minecraft.world.item.crafting.display.SlotDisplay; import org.jetbrains.annotations.Nullable; @Environment(EnvType.CLIENT) public class OverlayRecipeComponent implements Renderable, GuiEventListener { private static final ResourceLocation OVERLAY_RECIPE_SPRITE = ResourceLocation.withDefaultNamespace("recipe_book/overlay_recipe"); - static final ResourceLocation FURNACE_OVERLAY_HIGHLIGHTED_SPRITE = ResourceLocation.withDefaultNamespace("recipe_book/furnace_overlay_highlighted"); - static final ResourceLocation FURNACE_OVERLAY_SPRITE = ResourceLocation.withDefaultNamespace("recipe_book/furnace_overlay"); - static final ResourceLocation CRAFTING_OVERLAY_HIGHLIGHTED_SPRITE = ResourceLocation.withDefaultNamespace("recipe_book/crafting_overlay_highlighted"); - static final ResourceLocation CRAFTING_OVERLAY_SPRITE = ResourceLocation.withDefaultNamespace("recipe_book/crafting_overlay"); - static final ResourceLocation FURNACE_OVERLAY_DISABLED_HIGHLIGHTED_SPRITE = ResourceLocation.withDefaultNamespace( - "recipe_book/furnace_overlay_disabled_highlighted" - ); - static final ResourceLocation FURNACE_OVERLAY_DISABLED_SPRITE = ResourceLocation.withDefaultNamespace("recipe_book/furnace_overlay_disabled"); - static final ResourceLocation CRAFTING_OVERLAY_DISABLED_HIGHLIGHTED_SPRITE = ResourceLocation.withDefaultNamespace( - "recipe_book/crafting_overlay_disabled_highlighted" - ); - static final ResourceLocation CRAFTING_OVERLAY_DISABLED_SPRITE = ResourceLocation.withDefaultNamespace("recipe_book/crafting_overlay_disabled"); private static final int MAX_ROW = 4; private static final int MAX_ROW_LARGE = 5; private static final float ITEM_RENDER_SCALE = 0.375F; @@ -46,59 +39,59 @@ public class OverlayRecipeComponent implements Renderable, GuiEventListener { private boolean isVisible; private int x; private int y; - private Minecraft minecraft; private RecipeCollection collection; @Nullable - private RecipeHolder lastRecipeClicked; - float time; - boolean isFurnaceMenu; + private RecipeDisplayId lastRecipeClicked; + final SlotSelectTime slotSelectTime; + private final boolean isFurnaceMenu; - public void init(Minecraft minecraft, RecipeCollection collection, int x, int y, int i, int j, float f) { - this.minecraft = minecraft; - this.collection = collection; - if (minecraft.player.containerMenu instanceof AbstractFurnaceMenu) { - this.isFurnaceMenu = true; - } + public OverlayRecipeComponent(SlotSelectTime slotSelectTime, boolean bl) { + this.slotSelectTime = slotSelectTime; + this.isFurnaceMenu = bl; + } - boolean bl = minecraft.player.getRecipeBook().isFiltering((RecipeBookMenu)minecraft.player.containerMenu); - List> list = collection.getDisplayRecipes(true); - List> list2 = bl ? Collections.emptyList() : collection.getDisplayRecipes(false); - int k = list.size(); - int l = k + list2.size(); - int m = l <= 16 ? 4 : 5; - int n = (int)Math.ceil((float)l / m); - this.x = x; - this.y = y; - float g = this.x + Math.min(l, m) * 25; - float h = i + 50; + public void init(RecipeCollection recipeCollection, ContextMap contextMap, boolean bl, int i, int j, int k, int l, float f) { + this.collection = recipeCollection; + List list = recipeCollection.getSelectedRecipes(RecipeCollection.CraftableStatus.CRAFTABLE); + List list2 = bl ? Collections.emptyList() : recipeCollection.getSelectedRecipes(RecipeCollection.CraftableStatus.NOT_CRAFTABLE); + int m = list.size(); + int n = m + list2.size(); + int o = n <= 16 ? 4 : 5; + int p = (int)Math.ceil((float)n / o); + this.x = i; + this.y = j; + float g = this.x + Math.min(n, o) * 25; + float h = k + 50; if (g > h) { this.x = (int)(this.x - f * (int)((g - h) / f)); } - float o = this.y + n * 25; - float p = j + 50; - if (o > p) { - this.y = (int)(this.y - f * Mth.ceil((o - p) / f)); + float q = this.y + p * 25; + float r = l + 50; + if (q > r) { + this.y = (int)(this.y - f * Mth.ceil((q - r) / f)); } - float q = this.y; - float r = j - 100; - if (q < r) { - this.y = (int)(this.y - f * Mth.ceil((q - r) / f)); + float s = this.y; + float t = l - 100; + if (s < t) { + this.y = (int)(this.y - f * Mth.ceil((s - t) / f)); } this.isVisible = true; this.recipeButtons.clear(); - for (int s = 0; s < l; s++) { - boolean bl2 = s < k; - RecipeHolder recipeHolder = bl2 ? (RecipeHolder)list.get(s) : (RecipeHolder)list2.get(s - k); - int t = this.x + 4 + 25 * (s % m); - int u = this.y + 5 + 25 * (s / m); + for (int u = 0; u < n; u++) { + boolean bl2 = u < m; + RecipeDisplayEntry recipeDisplayEntry = bl2 ? (RecipeDisplayEntry)list.get(u) : (RecipeDisplayEntry)list2.get(u - m); + int v = this.x + 4 + 25 * (u % o); + int w = this.y + 5 + 25 * (u / o); if (this.isFurnaceMenu) { - this.recipeButtons.add(new OverlayRecipeComponent.OverlaySmeltingRecipeButton(t, u, recipeHolder, bl2)); + this.recipeButtons + .add(new OverlayRecipeComponent.OverlaySmeltingRecipeButton(v, w, recipeDisplayEntry.id(), recipeDisplayEntry.display(), contextMap, bl2)); } else { - this.recipeButtons.add(new OverlayRecipeComponent.OverlayRecipeButton(t, u, recipeHolder, bl2)); + this.recipeButtons + .add(new OverlayRecipeComponent.OverlayCraftingRecipeButton(v, w, recipeDisplayEntry.id(), recipeDisplayEntry.display(), contextMap, bl2)); } } @@ -110,7 +103,7 @@ public class OverlayRecipeComponent implements Renderable, GuiEventListener { } @Nullable - public RecipeHolder getLastRecipeClicked() { + public RecipeDisplayId getLastRecipeClicked() { return this.lastRecipeClicked; } @@ -138,16 +131,13 @@ public class OverlayRecipeComponent implements Renderable, GuiEventListener { @Override public void render(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) { if (this.isVisible) { - this.time += partialTick; - RenderSystem.enableBlend(); guiGraphics.pose().pushPose(); guiGraphics.pose().translate(0.0F, 0.0F, 1000.0F); int i = this.recipeButtons.size() <= 16 ? 4 : 5; int j = Math.min(this.recipeButtons.size(), i); int k = Mth.ceil((float)this.recipeButtons.size() / i); int l = 4; - guiGraphics.blitSprite(OVERLAY_RECIPE_SPRITE, this.x, this.y, j * 25 + 8, k * 25 + 8); - RenderSystem.disableBlend(); + guiGraphics.blitSprite(RenderType::guiTextured, OVERLAY_RECIPE_SPRITE, this.x, this.y, j * 25 + 8, k * 25 + 8); for (OverlayRecipeComponent.OverlayRecipeButton overlayRecipeButton : this.recipeButtons) { overlayRecipeButton.render(guiGraphics, mouseX, mouseY, partialTick); @@ -175,99 +165,134 @@ public class OverlayRecipeComponent implements Renderable, GuiEventListener { } @Environment(EnvType.CLIENT) - class OverlayRecipeButton extends AbstractWidget implements PlaceRecipe { - final RecipeHolder recipe; + class OverlayCraftingRecipeButton extends OverlayRecipeComponent.OverlayRecipeButton { + private static final ResourceLocation ENABLED_SPRITE = ResourceLocation.withDefaultNamespace("recipe_book/crafting_overlay"); + private static final ResourceLocation HIGHLIGHTED_ENABLED_SPRITE = ResourceLocation.withDefaultNamespace("recipe_book/crafting_overlay_highlighted"); + private static final ResourceLocation DISABLED_SPRITE = ResourceLocation.withDefaultNamespace("recipe_book/crafting_overlay_disabled"); + private static final ResourceLocation HIGHLIGHTED_DISABLED_SPRITE = ResourceLocation.withDefaultNamespace("recipe_book/crafting_overlay_disabled_highlighted"); + private static final int GRID_WIDTH = 3; + private static final int GRID_HEIGHT = 3; + + public OverlayCraftingRecipeButton( + final int i, final int j, final RecipeDisplayId recipeDisplayId, final RecipeDisplay recipeDisplay, final ContextMap contextMap, final boolean bl + ) { + super(i, j, recipeDisplayId, bl, calculateIngredientsPositions(recipeDisplay, contextMap)); + } + + private static List calculateIngredientsPositions(RecipeDisplay recipeDisplay, ContextMap contextMap) { + List list = new ArrayList(); + switch (recipeDisplay) { + case ShapedCraftingRecipeDisplay shapedCraftingRecipeDisplay: + PlaceRecipeHelper.placeRecipe( + 3, 3, shapedCraftingRecipeDisplay.width(), shapedCraftingRecipeDisplay.height(), shapedCraftingRecipeDisplay.ingredients(), (slotDisplay, ix, j, k) -> { + List list2x = slotDisplay.resolveForStacks(contextMap); + if (!list2x.isEmpty()) { + list.add(createGridPos(j, k, list2x)); + } + } + ); + break; + case ShapelessCraftingRecipeDisplay shapelessCraftingRecipeDisplay: + label19: { + List list2 = shapelessCraftingRecipeDisplay.ingredients(); + + for (int i = 0; i < list2.size(); i++) { + List list3 = ((SlotDisplay)list2.get(i)).resolveForStacks(contextMap); + if (!list3.isEmpty()) { + list.add(createGridPos(i % 3, i / 3, list3)); + } + } + break label19; + } + default: + } + + return list; + } + + @Override + protected ResourceLocation getSprite(boolean bl) { + if (bl) { + return this.isHoveredOrFocused() ? HIGHLIGHTED_ENABLED_SPRITE : ENABLED_SPRITE; + } else { + return this.isHoveredOrFocused() ? HIGHLIGHTED_DISABLED_SPRITE : DISABLED_SPRITE; + } + } + } + + @Environment(EnvType.CLIENT) + abstract class OverlayRecipeButton extends AbstractWidget { + final RecipeDisplayId recipe; private final boolean isCraftable; - protected final List ingredientPos = Lists.newArrayList(); + private final List slots; - public OverlayRecipeButton(final int x, final int y, final RecipeHolder recipe, final boolean isCraftable) { - super(x, y, 200, 20, CommonComponents.EMPTY); - this.width = 24; - this.height = 24; - this.recipe = recipe; - this.isCraftable = isCraftable; - this.calculateIngredientsPositions(recipe); + public OverlayRecipeButton(final int i, final int j, final RecipeDisplayId recipeDisplayId, final boolean bl, final List list) { + super(i, j, 24, 24, CommonComponents.EMPTY); + this.slots = list; + this.recipe = recipeDisplayId; + this.isCraftable = bl; } - protected void calculateIngredientsPositions(RecipeHolder recipe) { - this.placeRecipe(3, 3, -1, recipe, recipe.value().getIngredients().iterator(), 0); + protected static Pos createGridPos(int i, int j, List list) { + return new Pos(3 + i * 7, 3 + j * 7, list); } + protected abstract ResourceLocation getSprite(boolean bl); + @Override public void updateWidgetNarration(NarrationElementOutput narrationElementOutput) { this.defaultButtonNarrationText(narrationElementOutput); } - public void addItemToSlot(Ingredient item, int slot, int maxAmount, int x, int y) { - ItemStack[] itemStacks = item.getItems(); - if (itemStacks.length != 0) { - this.ingredientPos.add(new OverlayRecipeComponent.OverlayRecipeButton.Pos(3 + x * 7, 3 + y * 7, itemStacks)); - } - } - @Override public void renderWidget(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) { - ResourceLocation resourceLocation; - if (this.isCraftable) { - if (OverlayRecipeComponent.this.isFurnaceMenu) { - resourceLocation = this.isHoveredOrFocused() ? OverlayRecipeComponent.FURNACE_OVERLAY_HIGHLIGHTED_SPRITE : OverlayRecipeComponent.FURNACE_OVERLAY_SPRITE; - } else { - resourceLocation = this.isHoveredOrFocused() ? OverlayRecipeComponent.CRAFTING_OVERLAY_HIGHLIGHTED_SPRITE : OverlayRecipeComponent.CRAFTING_OVERLAY_SPRITE; - } - } else if (OverlayRecipeComponent.this.isFurnaceMenu) { - resourceLocation = this.isHoveredOrFocused() - ? OverlayRecipeComponent.FURNACE_OVERLAY_DISABLED_HIGHLIGHTED_SPRITE - : OverlayRecipeComponent.FURNACE_OVERLAY_DISABLED_SPRITE; - } else { - resourceLocation = this.isHoveredOrFocused() - ? OverlayRecipeComponent.CRAFTING_OVERLAY_DISABLED_HIGHLIGHTED_SPRITE - : OverlayRecipeComponent.CRAFTING_OVERLAY_DISABLED_SPRITE; - } + guiGraphics.blitSprite(RenderType::guiTextured, this.getSprite(this.isCraftable), this.getX(), this.getY(), this.width, this.height); + float f = this.getX() + 2; + float g = this.getY() + 2; + float h = 150.0F; - guiGraphics.blitSprite(resourceLocation, this.getX(), this.getY(), this.width, this.height); - guiGraphics.pose().pushPose(); - guiGraphics.pose().translate((double)(this.getX() + 2), (double)(this.getY() + 2), 150.0); - - for (OverlayRecipeComponent.OverlayRecipeButton.Pos pos : this.ingredientPos) { + for (Pos pos : this.slots) { guiGraphics.pose().pushPose(); - guiGraphics.pose().translate((double)pos.x, (double)pos.y, 0.0); + guiGraphics.pose().translate(f + pos.x, g + pos.y, 150.0F); guiGraphics.pose().scale(0.375F, 0.375F, 1.0F); - guiGraphics.pose().translate(-8.0, -8.0, 0.0); - if (pos.ingredients.length > 0) { - guiGraphics.renderItem(pos.ingredients[Mth.floor(OverlayRecipeComponent.this.time / 30.0F) % pos.ingredients.length], 0, 0); - } - + guiGraphics.pose().translate(-8.0F, -8.0F, 0.0F); + guiGraphics.renderItem(pos.selectIngredient(OverlayRecipeComponent.this.slotSelectTime.currentIndex()), 0, 0); guiGraphics.pose().popPose(); } - - guiGraphics.pose().popPose(); - } - - @Environment(EnvType.CLIENT) - protected class Pos { - public final ItemStack[] ingredients; - public final int x; - public final int y; - - public Pos(final int x, final int y, final ItemStack[] ingredients) { - this.x = x; - this.y = y; - this.ingredients = ingredients; - } } } @Environment(EnvType.CLIENT) class OverlaySmeltingRecipeButton extends OverlayRecipeComponent.OverlayRecipeButton { - public OverlaySmeltingRecipeButton(final int i, final int j, final RecipeHolder recipeHolder, final boolean bl) { - super(i, j, recipeHolder, bl); + private static final ResourceLocation ENABLED_SPRITE = ResourceLocation.withDefaultNamespace("recipe_book/furnace_overlay"); + private static final ResourceLocation HIGHLIGHTED_ENABLED_SPRITE = ResourceLocation.withDefaultNamespace("recipe_book/furnace_overlay_highlighted"); + private static final ResourceLocation DISABLED_SPRITE = ResourceLocation.withDefaultNamespace("recipe_book/furnace_overlay_disabled"); + private static final ResourceLocation HIGHLIGHTED_DISABLED_SPRITE = ResourceLocation.withDefaultNamespace("recipe_book/furnace_overlay_disabled_highlighted"); + + public OverlaySmeltingRecipeButton( + final int i, final int j, final RecipeDisplayId recipeDisplayId, final RecipeDisplay recipeDisplay, final ContextMap contextMap, final boolean bl + ) { + super(i, j, recipeDisplayId, bl, calculateIngredientsPositions(recipeDisplay, contextMap)); + } + + private static List calculateIngredientsPositions(RecipeDisplay recipeDisplay, ContextMap contextMap) { + if (recipeDisplay instanceof FurnaceRecipeDisplay furnaceRecipeDisplay) { + List list = furnaceRecipeDisplay.ingredient().resolveForStacks(contextMap); + if (!list.isEmpty()) { + return List.of(createGridPos(1, 1, list)); + } + } + + return List.of(); } @Override - protected void calculateIngredientsPositions(RecipeHolder recipe) { - Ingredient ingredient = recipe.value().getIngredients().get(0); - ItemStack[] itemStacks = ingredient.getItems(); - this.ingredientPos.add(new OverlayRecipeComponent.OverlayRecipeButton.Pos(10, 10, itemStacks)); + protected ResourceLocation getSprite(boolean bl) { + if (bl) { + return this.isHoveredOrFocused() ? HIGHLIGHTED_ENABLED_SPRITE : ENABLED_SPRITE; + } else { + return this.isHoveredOrFocused() ? HIGHLIGHTED_DISABLED_SPRITE : DISABLED_SPRITE; + } } } } diff --git a/net/minecraft/client/gui/screens/recipebook/RecipeBookComponent.java b/net/minecraft/client/gui/screens/recipebook/RecipeBookComponent.java index 0074888e..9e9f577f 100644 --- a/net/minecraft/client/gui/screens/recipebook/RecipeBookComponent.java +++ b/net/minecraft/client/gui/screens/recipebook/RecipeBookComponent.java @@ -5,13 +5,15 @@ import it.unimi.dsi.fastutil.objects.ObjectLinkedOpenHashSet; import it.unimi.dsi.fastutil.objects.ObjectSet; import java.util.List; import java.util.Locale; +import java.util.Objects; +import java.util.Optional; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.ChatFormatting; import net.minecraft.client.ClientRecipeBook; import net.minecraft.client.Minecraft; -import net.minecraft.client.RecipeBookCategories; import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.components.AbstractWidget; import net.minecraft.client.gui.components.EditBox; import net.minecraft.client.gui.components.Renderable; import net.minecraft.client.gui.components.StateSwitchingButton; @@ -20,71 +22,97 @@ import net.minecraft.client.gui.components.WidgetSprites; import net.minecraft.client.gui.components.events.GuiEventListener; import net.minecraft.client.gui.narration.NarratableEntry; import net.minecraft.client.gui.narration.NarrationElementOutput; +import net.minecraft.client.gui.narration.NarratableEntry.NarrationPriority; +import net.minecraft.client.gui.navigation.CommonInputs; +import net.minecraft.client.gui.navigation.ScreenAxis; +import net.minecraft.client.gui.navigation.ScreenRectangle; import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.multiplayer.ClientPacketListener; +import net.minecraft.client.renderer.RenderType; import net.minecraft.client.resources.language.LanguageInfo; import net.minecraft.client.resources.language.LanguageManager; import net.minecraft.network.chat.Component; import net.minecraft.network.protocol.game.ServerboundRecipeBookChangeSettingsPacket; -import net.minecraft.recipebook.PlaceRecipe; import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.entity.player.StackedContents; +import net.minecraft.util.Mth; +import net.minecraft.util.context.ContextMap; +import net.minecraft.world.entity.player.StackedItemContents; +import net.minecraft.world.inventory.AbstractFurnaceMenu; import net.minecraft.world.inventory.RecipeBookMenu; import net.minecraft.world.inventory.RecipeBookType; import net.minecraft.world.inventory.Slot; +import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.crafting.Ingredient; -import net.minecraft.world.item.crafting.RecipeHolder; +import net.minecraft.world.item.Items; +import net.minecraft.world.item.crafting.ExtendedRecipeBookCategory; +import net.minecraft.world.item.crafting.RecipeBookCategory; +import net.minecraft.world.item.crafting.display.RecipeDisplay; +import net.minecraft.world.item.crafting.display.RecipeDisplayId; +import net.minecraft.world.item.crafting.display.SlotDisplayContext; +import net.minecraft.world.level.Level; import org.jetbrains.annotations.Nullable; @Environment(EnvType.CLIENT) -public class RecipeBookComponent implements PlaceRecipe, Renderable, GuiEventListener, NarratableEntry, RecipeShownListener { +public abstract class RecipeBookComponent implements Renderable, GuiEventListener, NarratableEntry { public static final WidgetSprites RECIPE_BUTTON_SPRITES = new WidgetSprites( ResourceLocation.withDefaultNamespace("recipe_book/button"), ResourceLocation.withDefaultNamespace("recipe_book/button_highlighted") ); - private static final WidgetSprites FILTER_BUTTON_SPRITES = new WidgetSprites( - ResourceLocation.withDefaultNamespace("recipe_book/filter_enabled"), - ResourceLocation.withDefaultNamespace("recipe_book/filter_disabled"), - ResourceLocation.withDefaultNamespace("recipe_book/filter_enabled_highlighted"), - ResourceLocation.withDefaultNamespace("recipe_book/filter_disabled_highlighted") - ); protected static final ResourceLocation RECIPE_BOOK_LOCATION = ResourceLocation.withDefaultNamespace("textures/gui/recipe_book.png"); + private static final int BACKGROUND_TEXTURE_WIDTH = 256; + private static final int BACKGROUND_TEXTURE_HEIGHT = 256; private static final Component SEARCH_HINT = Component.translatable("gui.recipebook.search_hint") .withStyle(ChatFormatting.ITALIC) .withStyle(ChatFormatting.GRAY); public static final int IMAGE_WIDTH = 147; public static final int IMAGE_HEIGHT = 166; private static final int OFFSET_X_POSITION = 86; - private static final Component ONLY_CRAFTABLES_TOOLTIP = Component.translatable("gui.recipebook.toggleRecipes.craftable"); + private static final int BORDER_WIDTH = 8; private static final Component ALL_RECIPES_TOOLTIP = Component.translatable("gui.recipebook.toggleRecipes.all"); + private static final int TICKS_TO_SWAP_SLOT = 30; private int xOffset; private int width; private int height; - protected final GhostRecipe ghostRecipe = new GhostRecipe(); + private float time; + @Nullable + private RecipeDisplayId lastPlacedRecipe; + private final GhostSlots ghostSlots; private final List tabButtons = Lists.newArrayList(); @Nullable private RecipeBookTabButton selectedTab; protected StateSwitchingButton filterButton; - protected RecipeBookMenu menu; + protected final T menu; protected Minecraft minecraft; @Nullable private EditBox searchBox; private String lastSearch = ""; + private final List tabInfos; private ClientRecipeBook book; - private final RecipeBookPage recipeBookPage = new RecipeBookPage(); - private final StackedContents stackedContents = new StackedContents(); + private final RecipeBookPage recipeBookPage; + @Nullable + private RecipeDisplayId lastRecipe; + @Nullable + private RecipeCollection lastRecipeCollection; + private final StackedItemContents stackedContents = new StackedItemContents(); private int timesInventoryChanged; private boolean ignoreTextInput; private boolean visible; private boolean widthTooNarrow; + @Nullable + private ScreenRectangle magnifierIconPlacement; - public void init(int width, int height, Minecraft minecraft, boolean widthTooNarrow, RecipeBookMenu menu) { + public RecipeBookComponent(T recipeBookMenu, List list) { + this.menu = recipeBookMenu; + this.tabInfos = list; + SlotSelectTime slotSelectTime = () -> Mth.floor(this.time / 30.0F); + this.ghostSlots = new GhostSlots(slotSelectTime); + this.recipeBookPage = new RecipeBookPage(this, slotSelectTime, recipeBookMenu instanceof AbstractFurnaceMenu); + } + + public void init(int i, int j, Minecraft minecraft, boolean bl) { this.minecraft = minecraft; - this.width = width; - this.height = height; - this.menu = menu; - this.widthTooNarrow = widthTooNarrow; - minecraft.player.containerMenu = menu; + this.width = i; + this.height = j; + this.widthTooNarrow = bl; this.book = minecraft.player.getRecipeBook(); this.timesInventoryChanged = minecraft.player.getInventory().getTimesChanged(); this.visible = this.isVisibleAccordingToBookData(); @@ -93,10 +121,11 @@ public class RecipeBookComponent implements PlaceRecipe, Renderable, } } - public void initVisuals() { + private void initVisuals() { + boolean bl = this.isFiltering(); this.xOffset = this.widthTooNarrow ? 0 : 86; - int i = (this.width - 147) / 2 - this.xOffset; - int j = (this.height - 166) / 2; + int i = this.getXOrigin(); + int j = this.getYOrigin(); this.stackedContents.clear(); this.minecraft.player.getInventory().fillStackedContents(this.stackedContents); this.menu.fillCraftSlotsStackedContents(this.stackedContents); @@ -107,15 +136,17 @@ public class RecipeBookComponent implements PlaceRecipe, Renderable, this.searchBox.setTextColor(16777215); this.searchBox.setValue(string); this.searchBox.setHint(SEARCH_HINT); + this.magnifierIconPlacement = ScreenRectangle.of( + ScreenAxis.HORIZONTAL, i + 8, this.searchBox.getY(), this.searchBox.getX() - this.getXOrigin(), this.searchBox.getHeight() + ); this.recipeBookPage.init(this.minecraft, i, j); - this.recipeBookPage.addListener(this); - this.filterButton = new StateSwitchingButton(i + 110, j + 12, 26, 16, this.book.isFiltering(this.menu)); + this.filterButton = new StateSwitchingButton(i + 110, j + 12, 26, 16, bl); this.updateFilterButtonTooltip(); this.initFilterButtonTextures(); this.tabButtons.clear(); - for (RecipeBookCategories recipeBookCategories : RecipeBookCategories.getCategories(this.menu.getRecipeBookType())) { - this.tabButtons.add(new RecipeBookTabButton(recipeBookCategories)); + for (RecipeBookComponent.TabInfo tabInfo : this.tabInfos) { + this.tabButtons.add(new RecipeBookTabButton(tabInfo)); } if (this.selectedTab != null) { @@ -131,17 +162,24 @@ public class RecipeBookComponent implements PlaceRecipe, Renderable, } this.selectedTab.setStateTriggered(true); - this.updateCollections(false); - this.updateTabs(); + this.selectMatchingRecipes(); + this.updateTabs(bl); + this.updateCollections(false, bl); + } + + private int getYOrigin() { + return (this.height - 166) / 2; + } + + private int getXOrigin() { + return (this.width - 147) / 2 - this.xOffset; } private void updateFilterButtonTooltip() { this.filterButton.setTooltip(this.filterButton.isStateTriggered() ? Tooltip.create(this.getRecipeFilterName()) : Tooltip.create(ALL_RECIPES_TOOLTIP)); } - protected void initFilterButtonTextures() { - this.filterButton.initTextureValues(FILTER_BUTTON_SPRITES); - } + protected abstract void initFilterButtonTextures(); public int updateScreenPosition(int width, int imageWidth) { int i; @@ -180,21 +218,32 @@ public class RecipeBookComponent implements PlaceRecipe, Renderable, this.sendUpdateSettings(); } + protected abstract boolean isCraftingSlot(Slot slot); + public void slotClicked(@Nullable Slot slot) { - if (slot != null && slot.index < this.menu.getSize()) { - this.ghostRecipe.clear(); + if (slot != null && this.isCraftingSlot(slot)) { + this.lastPlacedRecipe = null; + this.ghostSlots.clear(); if (this.isVisible()) { this.updateStackedContents(); } } } - private void updateCollections(boolean resetPageNumber) { + private void selectMatchingRecipes() { + for (RecipeBookComponent.TabInfo tabInfo : this.tabInfos) { + for (RecipeCollection recipeCollection : this.book.getCollection(tabInfo.category())) { + this.selectMatchingRecipes(recipeCollection, this.stackedContents); + } + } + } + + protected abstract void selectMatchingRecipes(RecipeCollection recipeCollection, StackedItemContents stackedItemContents); + + private void updateCollections(boolean bl, boolean bl2) { List list = this.book.getCollection(this.selectedTab.getCategory()); - list.forEach(recipeCollection -> recipeCollection.canCraft(this.stackedContents, this.menu.getGridWidth(), this.menu.getGridHeight(), this.book)); List list2 = Lists.newArrayList(list); - list2.removeIf(recipeCollection -> !recipeCollection.hasKnownRecipes()); - list2.removeIf(recipeCollection -> !recipeCollection.hasFitting()); + list2.removeIf(recipeCollection -> !recipeCollection.hasAnySelected()); String string = this.searchBox.getValue(); if (!string.isEmpty()) { ClientPacketListener clientPacketListener = this.minecraft.getConnection(); @@ -204,27 +253,27 @@ public class RecipeBookComponent implements PlaceRecipe, Renderable, } } - if (this.book.isFiltering(this.menu)) { + if (bl2) { list2.removeIf(recipeCollection -> !recipeCollection.hasCraftable()); } - this.recipeBookPage.updateCollections(list2, resetPageNumber); + this.recipeBookPage.updateCollections(list2, bl, bl2); } - private void updateTabs() { + private void updateTabs(boolean bl) { int i = (this.width - 147) / 2 - this.xOffset - 30; int j = (this.height - 166) / 2 + 3; int k = 27; int l = 0; for (RecipeBookTabButton recipeBookTabButton : this.tabButtons) { - RecipeBookCategories recipeBookCategories = recipeBookTabButton.getCategory(); - if (recipeBookCategories == RecipeBookCategories.CRAFTING_SEARCH || recipeBookCategories == RecipeBookCategories.FURNACE_SEARCH) { + ExtendedRecipeBookCategory extendedRecipeBookCategory = recipeBookTabButton.getCategory(); + if (extendedRecipeBookCategory instanceof SearchRecipeBookCategory) { recipeBookTabButton.visible = true; recipeBookTabButton.setPosition(i, j + 27 * l++); } else if (recipeBookTabButton.updateVisibility(this.book)) { recipeBookTabButton.setPosition(i, j + 27 * l++); - recipeBookTabButton.startAnimation(this.minecraft); + recipeBookTabButton.startAnimation(this.book, bl); } } } @@ -247,17 +296,26 @@ public class RecipeBookComponent implements PlaceRecipe, Renderable, this.stackedContents.clear(); this.minecraft.player.getInventory().fillStackedContents(this.stackedContents); this.menu.fillCraftSlotsStackedContents(this.stackedContents); - this.updateCollections(false); + this.selectMatchingRecipes(); + this.updateCollections(false, this.isFiltering()); + } + + private boolean isFiltering() { + return this.book.isFiltering(this.menu.getRecipeBookType()); } @Override public void render(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) { if (this.isVisible()) { + if (!Screen.hasControlDown()) { + this.time += partialTick; + } + guiGraphics.pose().pushPose(); guiGraphics.pose().translate(0.0F, 0.0F, 100.0F); - int i = (this.width - 147) / 2 - this.xOffset; - int j = (this.height - 166) / 2; - guiGraphics.blit(RECIPE_BOOK_LOCATION, i, j, 1, 1, 147, 166); + int i = this.getXOrigin(); + int j = this.getYOrigin(); + guiGraphics.blit(RenderType::guiTextured, RECIPE_BOOK_LOCATION, i, j, 1.0F, 1.0F, 147, 166, 256, 256); this.searchBox.render(guiGraphics, mouseX, mouseY, partialTick); for (RecipeBookTabButton recipeBookTabButton : this.tabButtons) { @@ -270,68 +328,55 @@ public class RecipeBookComponent implements PlaceRecipe, Renderable, } } - public void renderTooltip(GuiGraphics guiGraphics, int renderX, int renderY, int mouseX, int mouseY) { + public void renderTooltip(GuiGraphics guiGraphics, int i, int j, @Nullable Slot slot) { if (this.isVisible()) { - this.recipeBookPage.renderTooltip(guiGraphics, mouseX, mouseY); - this.renderGhostRecipeTooltip(guiGraphics, renderX, renderY, mouseX, mouseY); + this.recipeBookPage.renderTooltip(guiGraphics, i, j); + this.ghostSlots.renderTooltip(guiGraphics, this.minecraft, i, j, slot); } } - protected Component getRecipeFilterName() { - return ONLY_CRAFTABLES_TOOLTIP; - } + protected abstract Component getRecipeFilterName(); - private void renderGhostRecipeTooltip(GuiGraphics guiGraphics, int x, int y, int mouseX, int mouseY) { - ItemStack itemStack = null; - - for (int i = 0; i < this.ghostRecipe.size(); i++) { - GhostRecipe.GhostIngredient ghostIngredient = this.ghostRecipe.get(i); - int j = ghostIngredient.getX() + x; - int k = ghostIngredient.getY() + y; - if (mouseX >= j && mouseY >= k && mouseX < j + 16 && mouseY < k + 16) { - itemStack = ghostIngredient.getItem(); - } - } - - if (itemStack != null && this.minecraft.screen != null) { - guiGraphics.renderComponentTooltip(this.minecraft.font, Screen.getTooltipFromItem(this.minecraft, itemStack), mouseX, mouseY); - } - } - - public void renderGhostRecipe(GuiGraphics guiGraphics, int leftPos, int topPos, boolean bl, float partialTick) { - this.ghostRecipe.render(guiGraphics, this.minecraft, leftPos, topPos, bl, partialTick); + public void renderGhostRecipe(GuiGraphics guiGraphics, boolean bl) { + this.ghostSlots.render(guiGraphics, this.minecraft, bl); } @Override public boolean mouseClicked(double mouseX, double mouseY, int button) { if (this.isVisible() && !this.minecraft.player.isSpectator()) { - if (this.recipeBookPage.mouseClicked(mouseX, mouseY, button, (this.width - 147) / 2 - this.xOffset, (this.height - 166) / 2, 147, 166)) { - RecipeHolder recipeHolder = this.recipeBookPage.getLastClickedRecipe(); + if (this.recipeBookPage.mouseClicked(mouseX, mouseY, button, this.getXOrigin(), this.getYOrigin(), 147, 166)) { + RecipeDisplayId recipeDisplayId = this.recipeBookPage.getLastClickedRecipe(); RecipeCollection recipeCollection = this.recipeBookPage.getLastClickedRecipeCollection(); - if (recipeHolder != null && recipeCollection != null) { - if (!recipeCollection.isCraftable(recipeHolder) && this.ghostRecipe.getRecipe() == recipeHolder) { + if (recipeDisplayId != null && recipeCollection != null) { + if (!this.tryPlaceRecipe(recipeCollection, recipeDisplayId)) { return false; } - this.ghostRecipe.clear(); - this.minecraft.gameMode.handlePlaceRecipe(this.minecraft.player.containerMenu.containerId, recipeHolder, Screen.hasShiftDown()); + this.lastRecipeCollection = recipeCollection; + this.lastRecipe = recipeDisplayId; if (!this.isOffsetNextToMainGUI()) { this.setVisible(false); } } - return true; - } else if (this.searchBox.mouseClicked(mouseX, mouseY, button)) { - this.searchBox.setFocused(true); return true; } else { - this.searchBox.setFocused(false); + if (this.searchBox != null) { + boolean bl = this.magnifierIconPlacement != null && this.magnifierIconPlacement.containsPoint(Mth.floor(mouseX), Mth.floor(mouseY)); + if (bl || this.searchBox.mouseClicked(mouseX, mouseY, button)) { + this.searchBox.setFocused(true); + return true; + } + + this.searchBox.setFocused(false); + } + if (this.filterButton.mouseClicked(mouseX, mouseY, button)) { boolean bl = this.toggleFiltering(); this.filterButton.setStateTriggered(bl); this.updateFilterButtonTooltip(); this.sendUpdateSettings(); - this.updateCollections(false); + this.updateCollections(false, bl); return true; } else { for (RecipeBookTabButton recipeBookTabButton : this.tabButtons) { @@ -343,7 +388,7 @@ public class RecipeBookComponent implements PlaceRecipe, Renderable, this.selectedTab = recipeBookTabButton; this.selectedTab.setStateTriggered(true); - this.updateCollections(true); + this.updateCollections(true, this.isFiltering()); } return true; @@ -358,6 +403,17 @@ public class RecipeBookComponent implements PlaceRecipe, Renderable, } } + private boolean tryPlaceRecipe(RecipeCollection recipeCollection, RecipeDisplayId recipeDisplayId) { + if (!recipeCollection.isCraftable(recipeDisplayId) && recipeDisplayId.equals(this.lastPlacedRecipe)) { + return false; + } else { + this.lastPlacedRecipe = recipeDisplayId; + this.ghostSlots.clear(); + this.minecraft.gameMode.handlePlaceRecipe(this.minecraft.player.containerMenu.containerId, recipeDisplayId, Screen.hasShiftDown()); + return true; + } + } + private boolean toggleFiltering() { RecipeBookType recipeBookType = this.menu.getRecipeBookType(); boolean bl = !this.book.isFiltering(recipeBookType); @@ -392,6 +448,9 @@ public class RecipeBookComponent implements PlaceRecipe, Renderable, this.ignoreTextInput = true; this.searchBox.setFocused(true); return true; + } else if (CommonInputs.selected(keyCode) && this.lastRecipeCollection != null && this.lastRecipe != null) { + AbstractWidget.playButtonClickSound(Minecraft.getInstance().getSoundManager()); + return this.tryPlaceRecipe(this.lastRecipeCollection, this.lastRecipe); } else { return false; } @@ -435,7 +494,7 @@ public class RecipeBookComponent implements PlaceRecipe, Renderable, String string = this.searchBox.getValue().toLowerCase(Locale.ROOT); this.pirateSpeechForThePeople(string); if (!string.equals(this.lastSearch)) { - this.updateCollections(false); + this.updateCollections(false, this.isFiltering()); this.lastSearch = string; } } @@ -464,32 +523,24 @@ public class RecipeBookComponent implements PlaceRecipe, Renderable, } public void recipesUpdated() { - this.updateTabs(); + this.selectMatchingRecipes(); + this.updateTabs(this.isFiltering()); if (this.isVisible()) { - this.updateCollections(false); + this.updateCollections(false, this.isFiltering()); } } - @Override - public void recipesShown(List> recipes) { - for (RecipeHolder recipeHolder : recipes) { - this.minecraft.player.removeRecipeHighlight(recipeHolder); - } + public void recipeShown(RecipeDisplayId recipeDisplayId) { + this.minecraft.player.removeRecipeHighlight(recipeDisplayId); } - public void setupGhostRecipe(RecipeHolder recipe, List slots) { - ItemStack itemStack = recipe.value().getResultItem(this.minecraft.level.registryAccess()); - this.ghostRecipe.setRecipe(recipe); - this.ghostRecipe.addIngredient(Ingredient.of(itemStack), ((Slot)slots.get(0)).x, ((Slot)slots.get(0)).y); - this.placeRecipe(this.menu.getGridWidth(), this.menu.getGridHeight(), this.menu.getResultSlotIndex(), recipe, recipe.value().getIngredients().iterator(), 0); + public void fillGhostRecipe(RecipeDisplay recipeDisplay) { + this.ghostSlots.clear(); + ContextMap contextMap = SlotDisplayContext.fromLevel((Level)Objects.requireNonNull(this.minecraft.level)); + this.fillGhostRecipe(this.ghostSlots, recipeDisplay, contextMap); } - public void addItemToSlot(Ingredient item, int slot, int maxAmount, int x, int y) { - if (!item.isEmpty()) { - Slot slot2 = this.menu.slots.get(slot); - this.ghostRecipe.addIngredient(item, slot2.x, slot2.y); - } - } + protected abstract void fillGhostRecipe(GhostSlots ghostSlots, RecipeDisplay recipeDisplay, ContextMap contextMap); protected void sendUpdateSettings() { if (this.minecraft.getConnection() != null) { @@ -501,8 +552,8 @@ public class RecipeBookComponent implements PlaceRecipe, Renderable, } @Override - public NarratableEntry.NarrationPriority narrationPriority() { - return this.visible ? NarratableEntry.NarrationPriority.HOVERED : NarratableEntry.NarrationPriority.NONE; + public NarrationPriority narrationPriority() { + return this.visible ? NarrationPriority.HOVERED : NarrationPriority.NONE; } @Override @@ -521,4 +572,19 @@ public class RecipeBookComponent implements PlaceRecipe, Renderable, narratableSearchResult.entry.updateNarration(narrationElementOutput.nest()); } } + + @Environment(EnvType.CLIENT) + public record TabInfo(ItemStack primaryIcon, Optional secondaryIcon, ExtendedRecipeBookCategory category) { + public TabInfo(SearchRecipeBookCategory searchRecipeBookCategory) { + this(new ItemStack(Items.COMPASS), Optional.empty(), searchRecipeBookCategory); + } + + public TabInfo(Item item, RecipeBookCategory recipeBookCategory) { + this(new ItemStack(item), Optional.empty(), recipeBookCategory); + } + + public TabInfo(Item item, Item item2, RecipeBookCategory recipeBookCategory) { + this(new ItemStack(item), Optional.of(new ItemStack(item2)), recipeBookCategory); + } + } } diff --git a/net/minecraft/client/gui/screens/recipebook/RecipeBookPage.java b/net/minecraft/client/gui/screens/recipebook/RecipeBookPage.java index 46640037..de1849c0 100644 --- a/net/minecraft/client/gui/screens/recipebook/RecipeBookPage.java +++ b/net/minecraft/client/gui/screens/recipebook/RecipeBookPage.java @@ -6,15 +6,19 @@ import java.util.List; import java.util.function.Consumer; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; +import net.minecraft.client.ClientRecipeBook; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.AbstractWidget; import net.minecraft.client.gui.components.StateSwitchingButton; import net.minecraft.client.gui.components.WidgetSprites; +import net.minecraft.core.component.DataComponents; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; -import net.minecraft.stats.RecipeBook; -import net.minecraft.world.item.crafting.RecipeHolder; +import net.minecraft.util.context.ContextMap; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.display.RecipeDisplayId; +import net.minecraft.world.item.crafting.display.SlotDisplayContext; import org.jetbrains.annotations.Nullable; @Environment(EnvType.CLIENT) @@ -29,23 +33,27 @@ public class RecipeBookPage { private final List buttons = Lists.newArrayListWithCapacity(20); @Nullable private RecipeButton hoveredButton; - private final OverlayRecipeComponent overlay = new OverlayRecipeComponent(); + private final OverlayRecipeComponent overlay; private Minecraft minecraft; - private final List showListeners = Lists.newArrayList(); + private final RecipeBookComponent parent; private List recipeCollections = ImmutableList.of(); private StateSwitchingButton forwardButton; private StateSwitchingButton backButton; private int totalPages; private int currentPage; - private RecipeBook recipeBook; + private ClientRecipeBook recipeBook; @Nullable - private RecipeHolder lastClickedRecipe; + private RecipeDisplayId lastClickedRecipe; @Nullable private RecipeCollection lastClickedRecipeCollection; + private boolean isFiltering; + + public RecipeBookPage(RecipeBookComponent recipeBookComponent, SlotSelectTime slotSelectTime, boolean bl) { + this.parent = recipeBookComponent; + this.overlay = new OverlayRecipeComponent(slotSelectTime, bl); - public RecipeBookPage() { for (int i = 0; i < 20; i++) { - this.buttons.add(new RecipeButton()); + this.buttons.add(new RecipeButton(slotSelectTime)); } } @@ -63,15 +71,11 @@ public class RecipeBookPage { this.backButton.initTextureValues(PAGE_BACKWARD_SPRITES); } - public void addListener(RecipeBookComponent listener) { - this.showListeners.remove(listener); - this.showListeners.add(listener); - } - - public void updateCollections(List recipeCollections, boolean resetPageNumber) { - this.recipeCollections = recipeCollections; - this.totalPages = (int)Math.ceil(recipeCollections.size() / 20.0); - if (this.totalPages <= this.currentPage || resetPageNumber) { + public void updateCollections(List list, boolean bl, boolean bl2) { + this.recipeCollections = list; + this.isFiltering = bl2; + this.totalPages = (int)Math.ceil(list.size() / 20.0); + if (this.totalPages <= this.currentPage || bl) { this.currentPage = 0; } @@ -80,12 +84,13 @@ public class RecipeBookPage { private void updateButtonsForPage() { int i = 20 * this.currentPage; + ContextMap contextMap = SlotDisplayContext.fromLevel(this.minecraft.level); for (int j = 0; j < this.buttons.size(); j++) { RecipeButton recipeButton = (RecipeButton)this.buttons.get(j); if (i + j < this.recipeCollections.size()) { RecipeCollection recipeCollection = (RecipeCollection)this.recipeCollections.get(i + j); - recipeButton.init(recipeCollection, this); + recipeButton.init(recipeCollection, this.isFiltering, this, contextMap); recipeButton.visible = true; } else { recipeButton.visible = false; @@ -123,12 +128,14 @@ public class RecipeBookPage { public void renderTooltip(GuiGraphics guiGraphics, int x, int y) { if (this.minecraft.screen != null && this.hoveredButton != null && !this.overlay.isVisible()) { - guiGraphics.renderComponentTooltip(this.minecraft.font, this.hoveredButton.getTooltipText(), x, y); + ItemStack itemStack = this.hoveredButton.getDisplayStack(); + ResourceLocation resourceLocation = itemStack.get(DataComponents.TOOLTIP_STYLE); + guiGraphics.renderComponentTooltip(this.minecraft.font, this.hoveredButton.getTooltipText(itemStack), x, y, resourceLocation); } } @Nullable - public RecipeHolder getLastClickedRecipe() { + public RecipeDisplayId getLastClickedRecipe() { return this.lastClickedRecipe; } @@ -162,14 +169,25 @@ public class RecipeBookPage { this.updateButtonsForPage(); return true; } else { + ContextMap contextMap = SlotDisplayContext.fromLevel(this.minecraft.level); + for (RecipeButton recipeButton : this.buttons) { if (recipeButton.mouseClicked(mouseX, mouseY, button)) { if (button == 0) { - this.lastClickedRecipe = recipeButton.getRecipe(); + this.lastClickedRecipe = recipeButton.getCurrentRecipe(); this.lastClickedRecipeCollection = recipeButton.getCollection(); } else if (button == 1 && !this.overlay.isVisible() && !recipeButton.isOnlyOption()) { this.overlay - .init(this.minecraft, recipeButton.getCollection(), recipeButton.getX(), recipeButton.getY(), i + k / 2, j + 13 + l / 2, recipeButton.getWidth()); + .init( + recipeButton.getCollection(), + contextMap, + this.isFiltering, + recipeButton.getX(), + recipeButton.getY(), + i + k / 2, + j + 13 + l / 2, + recipeButton.getWidth() + ); } return true; @@ -180,17 +198,11 @@ public class RecipeBookPage { } } - public void recipesShown(List> recipes) { - for (RecipeShownListener recipeShownListener : this.showListeners) { - recipeShownListener.recipesShown(recipes); - } + public void recipeShown(RecipeDisplayId recipeDisplayId) { + this.parent.recipeShown(recipeDisplayId); } - public Minecraft getMinecraft() { - return this.minecraft; - } - - public RecipeBook getRecipeBook() { + public ClientRecipeBook getRecipeBook() { return this.recipeBook; } diff --git a/net/minecraft/client/gui/screens/recipebook/RecipeBookTabButton.java b/net/minecraft/client/gui/screens/recipebook/RecipeBookTabButton.java index 2b985d95..8829b607 100644 --- a/net/minecraft/client/gui/screens/recipebook/RecipeBookTabButton.java +++ b/net/minecraft/client/gui/screens/recipebook/RecipeBookTabButton.java @@ -1,46 +1,41 @@ package net.minecraft.client.gui.screens.recipebook; -import com.mojang.blaze3d.systems.RenderSystem; import java.util.List; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.ClientRecipeBook; -import net.minecraft.client.Minecraft; -import net.minecraft.client.RecipeBookCategories; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.StateSwitchingButton; import net.minecraft.client.gui.components.WidgetSprites; -import net.minecraft.client.renderer.entity.ItemRenderer; +import net.minecraft.client.renderer.RenderType; import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.inventory.RecipeBookMenu; import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.crafting.RecipeHolder; +import net.minecraft.world.item.crafting.ExtendedRecipeBookCategory; +import net.minecraft.world.item.crafting.display.RecipeDisplayEntry; @Environment(EnvType.CLIENT) public class RecipeBookTabButton extends StateSwitchingButton { private static final WidgetSprites SPRITES = new WidgetSprites( ResourceLocation.withDefaultNamespace("recipe_book/tab"), ResourceLocation.withDefaultNamespace("recipe_book/tab_selected") ); - private final RecipeBookCategories category; + private final RecipeBookComponent.TabInfo tabInfo; private static final float ANIMATION_TIME = 15.0F; private float animationTime; - public RecipeBookTabButton(RecipeBookCategories category) { + public RecipeBookTabButton(RecipeBookComponent.TabInfo tabInfo) { super(0, 0, 35, 27, false); - this.category = category; + this.tabInfo = tabInfo; this.initTextureValues(SPRITES); } - public void startAnimation(Minecraft minecraft) { - ClientRecipeBook clientRecipeBook = minecraft.player.getRecipeBook(); - List list = clientRecipeBook.getCollection(this.category); - if (minecraft.player.containerMenu instanceof RecipeBookMenu) { - for (RecipeCollection recipeCollection : list) { - for (RecipeHolder recipeHolder : recipeCollection.getRecipes(clientRecipeBook.isFiltering((RecipeBookMenu)minecraft.player.containerMenu))) { - if (clientRecipeBook.willHighlight(recipeHolder)) { - this.animationTime = 15.0F; - return; - } + public void startAnimation(ClientRecipeBook clientRecipeBook, boolean bl) { + RecipeCollection.CraftableStatus craftableStatus = bl ? RecipeCollection.CraftableStatus.CRAFTABLE : RecipeCollection.CraftableStatus.ANY; + + for (RecipeCollection recipeCollection : clientRecipeBook.getCollection(this.tabInfo.category())) { + for (RecipeDisplayEntry recipeDisplayEntry : recipeCollection.getSelectedRecipes(craftableStatus)) { + if (clientRecipeBook.willHighlight(recipeDisplayEntry.id())) { + this.animationTime = 15.0F; + return; } } } @@ -57,17 +52,14 @@ public class RecipeBookTabButton extends StateSwitchingButton { guiGraphics.pose().translate((float)(-(this.getX() + 8)), (float)(-(this.getY() + 12)), 0.0F); } - Minecraft minecraft = Minecraft.getInstance(); - RenderSystem.disableDepthTest(); ResourceLocation resourceLocation = this.sprites.get(true, this.isStateTriggered); int i = this.getX(); if (this.isStateTriggered) { i -= 2; } - guiGraphics.blitSprite(resourceLocation, i, this.getY(), this.width, this.height); - RenderSystem.enableDepthTest(); - this.renderIcon(guiGraphics, minecraft.getItemRenderer()); + guiGraphics.blitSprite(RenderType::guiTextured, resourceLocation, i, this.getY(), this.width, this.height); + this.renderIcon(guiGraphics); if (this.animationTime > 0.0F) { guiGraphics.pose().popPose(); this.animationTime -= partialTick; @@ -75,30 +67,28 @@ public class RecipeBookTabButton extends StateSwitchingButton { } } - private void renderIcon(GuiGraphics guiGraphics, ItemRenderer itemRenderer) { - List list = this.category.getIconItems(); + private void renderIcon(GuiGraphics guiGraphics) { int i = this.isStateTriggered ? -2 : 0; - if (list.size() == 1) { - guiGraphics.renderFakeItem((ItemStack)list.get(0), this.getX() + 9 + i, this.getY() + 5); - } else if (list.size() == 2) { - guiGraphics.renderFakeItem((ItemStack)list.get(0), this.getX() + 3 + i, this.getY() + 5); - guiGraphics.renderFakeItem((ItemStack)list.get(1), this.getX() + 14 + i, this.getY() + 5); + if (this.tabInfo.secondaryIcon().isPresent()) { + guiGraphics.renderFakeItem(this.tabInfo.primaryIcon(), this.getX() + 3 + i, this.getY() + 5); + guiGraphics.renderFakeItem((ItemStack)this.tabInfo.secondaryIcon().get(), this.getX() + 14 + i, this.getY() + 5); + } else { + guiGraphics.renderFakeItem(this.tabInfo.primaryIcon(), this.getX() + 9 + i, this.getY() + 5); } } - public RecipeBookCategories getCategory() { - return this.category; + public ExtendedRecipeBookCategory getCategory() { + return this.tabInfo.category(); } public boolean updateVisibility(ClientRecipeBook recipeBook) { - List list = recipeBook.getCollection(this.category); + List list = recipeBook.getCollection(this.tabInfo.category()); this.visible = false; - if (list != null) { - for (RecipeCollection recipeCollection : list) { - if (recipeCollection.hasKnownRecipes() && recipeCollection.hasFitting()) { - this.visible = true; - break; - } + + for (RecipeCollection recipeCollection : list) { + if (recipeCollection.hasAnySelected()) { + this.visible = true; + break; } } diff --git a/net/minecraft/client/gui/screens/recipebook/RecipeButton.java b/net/minecraft/client/gui/screens/recipebook/RecipeButton.java index bc6c7798..d5d244e8 100644 --- a/net/minecraft/client/gui/screens/recipebook/RecipeButton.java +++ b/net/minecraft/client/gui/screens/recipebook/RecipeButton.java @@ -1,6 +1,6 @@ package net.minecraft.client.gui.screens.recipebook; -import com.google.common.collect.Lists; +import java.util.ArrayList; import java.util.List; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; @@ -10,14 +10,14 @@ import net.minecraft.client.gui.components.AbstractWidget; import net.minecraft.client.gui.narration.NarratedElementType; import net.minecraft.client.gui.narration.NarrationElementOutput; import net.minecraft.client.gui.screens.Screen; +import net.minecraft.client.renderer.RenderType; import net.minecraft.network.chat.CommonComponents; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; -import net.minecraft.stats.RecipeBook; -import net.minecraft.util.Mth; -import net.minecraft.world.inventory.RecipeBookMenu; +import net.minecraft.util.context.ContextMap; import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.crafting.RecipeHolder; +import net.minecraft.world.item.crafting.display.RecipeDisplayEntry; +import net.minecraft.world.item.crafting.display.RecipeDisplayId; @Environment(EnvType.CLIENT) public class RecipeButton extends AbstractWidget { @@ -27,31 +27,27 @@ public class RecipeButton extends AbstractWidget { private static final ResourceLocation SLOT_UNCRAFTABLE_SPRITE = ResourceLocation.withDefaultNamespace("recipe_book/slot_uncraftable"); private static final float ANIMATION_TIME = 15.0F; private static final int BACKGROUND_SIZE = 25; - public static final int TICKS_TO_SWAP = 30; private static final Component MORE_RECIPES_TOOLTIP = Component.translatable("gui.recipebook.moreRecipes"); - private RecipeBookMenu menu; - private RecipeBook book; private RecipeCollection collection; - private float time; + private List selectedEntries = List.of(); + private final SlotSelectTime slotSelectTime; private float animationTime; - private int currentIndex; - public RecipeButton() { + public RecipeButton(SlotSelectTime slotSelectTime) { super(0, 0, 25, 25, CommonComponents.EMPTY); + this.slotSelectTime = slotSelectTime; } - public void init(RecipeCollection collection, RecipeBookPage recipeBookPage) { - this.collection = collection; - this.menu = (RecipeBookMenu)recipeBookPage.getMinecraft().player.containerMenu; - this.book = recipeBookPage.getRecipeBook(); - List> list = collection.getRecipes(this.book.isFiltering(this.menu)); - - for (RecipeHolder recipeHolder : list) { - if (this.book.willHighlight(recipeHolder)) { - recipeBookPage.recipesShown(list); - this.animationTime = 15.0F; - break; - } + public void init(RecipeCollection recipeCollection, boolean bl, RecipeBookPage recipeBookPage, ContextMap contextMap) { + this.collection = recipeCollection; + List list = recipeCollection.getSelectedRecipes(bl ? RecipeCollection.CraftableStatus.CRAFTABLE : RecipeCollection.CraftableStatus.ANY); + this.selectedEntries = list.stream() + .map(recipeDisplayEntry -> new RecipeButton.ResolvedEntry(recipeDisplayEntry.id(), recipeDisplayEntry.resultItems(contextMap))) + .toList(); + List list2 = list.stream().map(RecipeDisplayEntry::id).filter(recipeBookPage.getRecipeBook()::willHighlight).toList(); + if (!list2.isEmpty()) { + list2.forEach(recipeBookPage::recipeShown); + this.animationTime = 15.0F; } } @@ -61,18 +57,14 @@ public class RecipeButton extends AbstractWidget { @Override public void renderWidget(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) { - if (!Screen.hasControlDown()) { - this.time += partialTick; - } - ResourceLocation resourceLocation; if (this.collection.hasCraftable()) { - if (this.collection.getRecipes(this.book.isFiltering(this.menu)).size() > 1) { + if (this.hasMultipleRecipes()) { resourceLocation = SLOT_MANY_CRAFTABLE_SPRITE; } else { resourceLocation = SLOT_CRAFTABLE_SPRITE; } - } else if (this.collection.getRecipes(this.book.isFiltering(this.menu)).size() > 1) { + } else if (this.hasMultipleRecipes()) { resourceLocation = SLOT_MANY_UNCRAFTABLE_SPRITE; } else { resourceLocation = SLOT_UNCRAFTABLE_SPRITE; @@ -88,12 +80,10 @@ public class RecipeButton extends AbstractWidget { this.animationTime -= partialTick; } - guiGraphics.blitSprite(resourceLocation, this.getX(), this.getY(), this.width, this.height); - List> list = this.getOrderedRecipes(); - this.currentIndex = Mth.floor(this.time / 30.0F) % list.size(); - ItemStack itemStack = ((RecipeHolder)list.get(this.currentIndex)).value().getResultItem(this.collection.registryAccess()); + guiGraphics.blitSprite(RenderType::guiTextured, resourceLocation, this.getX(), this.getY(), this.width, this.height); + ItemStack itemStack = this.getDisplayStack(); int i = 4; - if (this.collection.hasSingleResultItem() && this.getOrderedRecipes().size() > 1) { + if (this.collection.hasSingleResultItem() && this.hasMultipleRecipes()) { guiGraphics.renderItem(itemStack, this.getX() + i + 1, this.getY() + i + 1, 0, 10); i--; } @@ -104,28 +94,30 @@ public class RecipeButton extends AbstractWidget { } } - private List> getOrderedRecipes() { - List> list = this.collection.getDisplayRecipes(true); - if (!this.book.isFiltering(this.menu)) { - list.addAll(this.collection.getDisplayRecipes(false)); - } - - return list; + private boolean hasMultipleRecipes() { + return this.selectedEntries.size() > 1; } public boolean isOnlyOption() { - return this.getOrderedRecipes().size() == 1; + return this.selectedEntries.size() == 1; } - public RecipeHolder getRecipe() { - List> list = this.getOrderedRecipes(); - return (RecipeHolder)list.get(this.currentIndex); + public RecipeDisplayId getCurrentRecipe() { + int i = this.slotSelectTime.currentIndex() % this.selectedEntries.size(); + return ((RecipeButton.ResolvedEntry)this.selectedEntries.get(i)).id; } - public List getTooltipText() { - ItemStack itemStack = ((RecipeHolder)this.getOrderedRecipes().get(this.currentIndex)).value().getResultItem(this.collection.registryAccess()); - List list = Lists.newArrayList(Screen.getTooltipFromItem(Minecraft.getInstance(), itemStack)); - if (this.collection.getRecipes(this.book.isFiltering(this.menu)).size() > 1) { + public ItemStack getDisplayStack() { + int i = this.slotSelectTime.currentIndex(); + int j = this.selectedEntries.size(); + int k = i / j; + int l = i - j * k; + return ((RecipeButton.ResolvedEntry)this.selectedEntries.get(l)).selectItem(k); + } + + public List getTooltipText(ItemStack itemStack) { + List list = new ArrayList(Screen.getTooltipFromItem(Minecraft.getInstance(), itemStack)); + if (this.hasMultipleRecipes()) { list.add(MORE_RECIPES_TOOLTIP); } @@ -134,9 +126,8 @@ public class RecipeButton extends AbstractWidget { @Override public void updateWidgetNarration(NarrationElementOutput narrationElementOutput) { - ItemStack itemStack = ((RecipeHolder)this.getOrderedRecipes().get(this.currentIndex)).value().getResultItem(this.collection.registryAccess()); - narrationElementOutput.add(NarratedElementType.TITLE, Component.translatable("narration.recipe", itemStack.getHoverName())); - if (this.collection.getRecipes(this.book.isFiltering(this.menu)).size() > 1) { + narrationElementOutput.add(NarratedElementType.TITLE, Component.translatable("narration.recipe", this.getDisplayStack().getHoverName())); + if (this.hasMultipleRecipes()) { narrationElementOutput.add( NarratedElementType.USAGE, Component.translatable("narration.button.usage.hovered"), Component.translatable("narration.recipe.usage.more") ); @@ -154,4 +145,17 @@ public class RecipeButton extends AbstractWidget { protected boolean isValidClickButton(int button) { return button == 0 || button == 1; } + + @Environment(EnvType.CLIENT) + record ResolvedEntry(RecipeDisplayId id, List displayItems) { + + public ItemStack selectItem(int i) { + if (this.displayItems.isEmpty()) { + return ItemStack.EMPTY; + } else { + int j = i % this.displayItems.size(); + return (ItemStack)this.displayItems.get(j); + } + } + } } diff --git a/net/minecraft/client/gui/screens/recipebook/RecipeCollection.java b/net/minecraft/client/gui/screens/recipebook/RecipeCollection.java index d7e3249f..dad3941b 100644 --- a/net/minecraft/client/gui/screens/recipebook/RecipeCollection.java +++ b/net/minecraft/client/gui/screens/recipebook/RecipeCollection.java @@ -1,44 +1,41 @@ package net.minecraft.client.gui.screens.recipebook; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.Lists; -import com.google.common.collect.Sets; +import java.util.ArrayList; +import java.util.HashSet; import java.util.List; import java.util.Set; +import java.util.function.Predicate; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; -import net.minecraft.core.RegistryAccess; -import net.minecraft.stats.RecipeBook; -import net.minecraft.world.entity.player.StackedContents; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.crafting.RecipeHolder; +import net.minecraft.world.entity.player.StackedItemContents; +import net.minecraft.world.item.crafting.display.RecipeDisplay; +import net.minecraft.world.item.crafting.display.RecipeDisplayEntry; +import net.minecraft.world.item.crafting.display.RecipeDisplayId; +import net.minecraft.world.item.crafting.display.SlotDisplay; @Environment(EnvType.CLIENT) public class RecipeCollection { - private final RegistryAccess registryAccess; - private final List> recipes; + private final List entries; private final boolean singleResultItem; - private final Set> craftable = Sets.>newHashSet(); - private final Set> fitsDimensions = Sets.>newHashSet(); - private final Set> known = Sets.>newHashSet(); + private final Set craftable = new HashSet(); + private final Set selected = new HashSet(); - public RecipeCollection(RegistryAccess registryAccess, List> recipes) { - this.registryAccess = registryAccess; - this.recipes = ImmutableList.copyOf(recipes); - if (recipes.size() <= 1) { + public RecipeCollection(List list) { + this.entries = list; + if (list.size() <= 1) { this.singleResultItem = true; } else { - this.singleResultItem = allRecipesHaveSameResult(registryAccess, recipes); + this.singleResultItem = allRecipesHaveSameResult(this.entries); } } - private static boolean allRecipesHaveSameResult(RegistryAccess registryAccess, List> recipes) { - int i = recipes.size(); - ItemStack itemStack = ((RecipeHolder)recipes.get(0)).value().getResultItem(registryAccess); + private static boolean allRecipesHaveSameResult(List list) { + int i = list.size(); + SlotDisplay slotDisplay = ((RecipeDisplayEntry)list.getFirst()).display().result(); for (int j = 1; j < i; j++) { - ItemStack itemStack2 = ((RecipeHolder)recipes.get(j)).value().getResultItem(registryAccess); - if (!ItemStack.isSameItemSameComponents(itemStack, itemStack2)) { + SlotDisplay slotDisplay2 = ((RecipeDisplayEntry)list.get(j)).display().result(); + if (!slotDisplay2.equals(slotDisplay)) { return false; } } @@ -46,80 +43,50 @@ public class RecipeCollection { return true; } - public RegistryAccess registryAccess() { - return this.registryAccess; - } - - /** - * Checks if recipebook is not empty - */ - public boolean hasKnownRecipes() { - return !this.known.isEmpty(); - } - - public void updateKnownRecipes(RecipeBook book) { - for (RecipeHolder recipeHolder : this.recipes) { - if (book.contains(recipeHolder)) { - this.known.add(recipeHolder); - } - } - } - - public void canCraft(StackedContents handler, int width, int height, RecipeBook book) { - for (RecipeHolder recipeHolder : this.recipes) { - boolean bl = recipeHolder.value().canCraftInDimensions(width, height) && book.contains(recipeHolder); + public void selectRecipes(StackedItemContents stackedItemContents, Predicate predicate) { + for (RecipeDisplayEntry recipeDisplayEntry : this.entries) { + boolean bl = predicate.test(recipeDisplayEntry.display()); if (bl) { - this.fitsDimensions.add(recipeHolder); + this.selected.add(recipeDisplayEntry.id()); } else { - this.fitsDimensions.remove(recipeHolder); + this.selected.remove(recipeDisplayEntry.id()); } - if (bl && handler.canCraft(recipeHolder.value(), null)) { - this.craftable.add(recipeHolder); + if (bl && recipeDisplayEntry.canCraft(stackedItemContents)) { + this.craftable.add(recipeDisplayEntry.id()); } else { - this.craftable.remove(recipeHolder); + this.craftable.remove(recipeDisplayEntry.id()); } } } - public boolean isCraftable(RecipeHolder recipe) { - return this.craftable.contains(recipe); + public boolean isCraftable(RecipeDisplayId recipeDisplayId) { + return this.craftable.contains(recipeDisplayId); } public boolean hasCraftable() { return !this.craftable.isEmpty(); } - public boolean hasFitting() { - return !this.fitsDimensions.isEmpty(); + public boolean hasAnySelected() { + return !this.selected.isEmpty(); } - public List> getRecipes() { - return this.recipes; + public List getRecipes() { + return this.entries; } - public List> getRecipes(boolean onlyCraftable) { - List> list = Lists.>newArrayList(); - Set> set = onlyCraftable ? this.craftable : this.fitsDimensions; + public List getSelectedRecipes(RecipeCollection.CraftableStatus craftableStatus) { + Predicate predicate = switch (craftableStatus) { + case ANY -> this.selected::contains; + case CRAFTABLE -> this.craftable::contains; + case NOT_CRAFTABLE -> recipeDisplayId -> this.selected.contains(recipeDisplayId) && !this.craftable.contains(recipeDisplayId); + }; + List list = new ArrayList(); - for (RecipeHolder recipeHolder : this.recipes) { - if (set.contains(recipeHolder)) { - list.add(recipeHolder); - } - } - - return list; - } - - /** - * @param craftable If true, this method will only return craftable recipes. If false, this method will only return uncraftable recipes. - */ - public List> getDisplayRecipes(boolean craftable) { - List> list = Lists.>newArrayList(); - - for (RecipeHolder recipeHolder : this.recipes) { - if (this.fitsDimensions.contains(recipeHolder) && this.craftable.contains(recipeHolder) == craftable) { - list.add(recipeHolder); + for (RecipeDisplayEntry recipeDisplayEntry : this.entries) { + if (predicate.test(recipeDisplayEntry.id())) { + list.add(recipeDisplayEntry); } } @@ -129,4 +96,11 @@ public class RecipeCollection { public boolean hasSingleResultItem() { return this.singleResultItem; } + + @Environment(EnvType.CLIENT) + public static enum CraftableStatus { + ANY, + CRAFTABLE, + NOT_CRAFTABLE; + } } diff --git a/net/minecraft/client/gui/screens/recipebook/RecipeShownListener.java b/net/minecraft/client/gui/screens/recipebook/RecipeShownListener.java deleted file mode 100644 index 1e3ee483..00000000 --- a/net/minecraft/client/gui/screens/recipebook/RecipeShownListener.java +++ /dev/null @@ -1,11 +0,0 @@ -package net.minecraft.client.gui.screens.recipebook; - -import java.util.List; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.world.item.crafting.RecipeHolder; - -@Environment(EnvType.CLIENT) -public interface RecipeShownListener { - void recipesShown(List> recipes); -} diff --git a/net/minecraft/client/gui/screens/recipebook/RecipeUpdateListener.java b/net/minecraft/client/gui/screens/recipebook/RecipeUpdateListener.java index 525719c8..c0f4eb9a 100644 --- a/net/minecraft/client/gui/screens/recipebook/RecipeUpdateListener.java +++ b/net/minecraft/client/gui/screens/recipebook/RecipeUpdateListener.java @@ -2,10 +2,11 @@ package net.minecraft.client.gui.screens.recipebook; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; +import net.minecraft.world.item.crafting.display.RecipeDisplay; @Environment(EnvType.CLIENT) public interface RecipeUpdateListener { void recipesUpdated(); - RecipeBookComponent getRecipeBookComponent(); + void fillGhostRecipe(RecipeDisplay recipeDisplay); } diff --git a/net/minecraft/client/gui/screens/recipebook/SearchRecipeBookCategory.java b/net/minecraft/client/gui/screens/recipebook/SearchRecipeBookCategory.java new file mode 100644 index 00000000..dd34ae4d --- /dev/null +++ b/net/minecraft/client/gui/screens/recipebook/SearchRecipeBookCategory.java @@ -0,0 +1,31 @@ +package net.minecraft.client.gui.screens.recipebook; + +import java.util.List; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.world.item.crafting.ExtendedRecipeBookCategory; +import net.minecraft.world.item.crafting.RecipeBookCategories; +import net.minecraft.world.item.crafting.RecipeBookCategory; + +@Environment(EnvType.CLIENT) +public enum SearchRecipeBookCategory implements ExtendedRecipeBookCategory { + CRAFTING( + RecipeBookCategories.CRAFTING_EQUIPMENT, + RecipeBookCategories.CRAFTING_BUILDING_BLOCKS, + RecipeBookCategories.CRAFTING_MISC, + RecipeBookCategories.CRAFTING_REDSTONE + ), + FURNACE(RecipeBookCategories.FURNACE_FOOD, RecipeBookCategories.FURNACE_BLOCKS, RecipeBookCategories.FURNACE_MISC), + BLAST_FURNACE(RecipeBookCategories.BLAST_FURNACE_BLOCKS, RecipeBookCategories.BLAST_FURNACE_MISC), + SMOKER(RecipeBookCategories.SMOKER_FOOD); + + private final List includedCategories; + + private SearchRecipeBookCategory(final RecipeBookCategory... recipeBookCategorys) { + this.includedCategories = List.of(recipeBookCategorys); + } + + public List includedCategories() { + return this.includedCategories; + } +} diff --git a/net/minecraft/client/gui/screens/recipebook/SlotSelectTime.java b/net/minecraft/client/gui/screens/recipebook/SlotSelectTime.java new file mode 100644 index 00000000..1026a45e --- /dev/null +++ b/net/minecraft/client/gui/screens/recipebook/SlotSelectTime.java @@ -0,0 +1,10 @@ +package net.minecraft.client.gui.screens.recipebook; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; + +@FunctionalInterface +@Environment(EnvType.CLIENT) +public interface SlotSelectTime { + int currentIndex(); +} diff --git a/net/minecraft/client/gui/screens/recipebook/SmeltingRecipeBookComponent.java b/net/minecraft/client/gui/screens/recipebook/SmeltingRecipeBookComponent.java deleted file mode 100644 index 3dd1b3b6..00000000 --- a/net/minecraft/client/gui/screens/recipebook/SmeltingRecipeBookComponent.java +++ /dev/null @@ -1,23 +0,0 @@ -package net.minecraft.client.gui.screens.recipebook; - -import java.util.Set; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.network.chat.Component; -import net.minecraft.world.item.Item; -import net.minecraft.world.level.block.entity.AbstractFurnaceBlockEntity; - -@Environment(EnvType.CLIENT) -public class SmeltingRecipeBookComponent extends AbstractFurnaceRecipeBookComponent { - private static final Component FILTER_NAME = Component.translatable("gui.recipebook.toggleRecipes.smeltable"); - - @Override - protected Component getRecipeFilterName() { - return FILTER_NAME; - } - - @Override - protected Set getFuelItems() { - return AbstractFurnaceBlockEntity.getFuel().keySet(); - } -} diff --git a/net/minecraft/client/gui/screens/recipebook/SmokingRecipeBookComponent.java b/net/minecraft/client/gui/screens/recipebook/SmokingRecipeBookComponent.java deleted file mode 100644 index a113b58f..00000000 --- a/net/minecraft/client/gui/screens/recipebook/SmokingRecipeBookComponent.java +++ /dev/null @@ -1,23 +0,0 @@ -package net.minecraft.client.gui.screens.recipebook; - -import java.util.Set; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.network.chat.Component; -import net.minecraft.world.item.Item; -import net.minecraft.world.level.block.entity.AbstractFurnaceBlockEntity; - -@Environment(EnvType.CLIENT) -public class SmokingRecipeBookComponent extends AbstractFurnaceRecipeBookComponent { - private static final Component FILTER_NAME = Component.translatable("gui.recipebook.toggleRecipes.smokable"); - - @Override - protected Component getRecipeFilterName() { - return FILTER_NAME; - } - - @Override - protected Set getFuelItems() { - return AbstractFurnaceBlockEntity.getFuel().keySet(); - } -} diff --git a/net/minecraft/client/gui/screens/reporting/AbstractReportScreen.java b/net/minecraft/client/gui/screens/reporting/AbstractReportScreen.java index 6200251a..0ead86f1 100644 --- a/net/minecraft/client/gui/screens/reporting/AbstractReportScreen.java +++ b/net/minecraft/client/gui/screens/reporting/AbstractReportScreen.java @@ -20,15 +20,16 @@ import net.minecraft.client.gui.layouts.LinearLayout; import net.minecraft.client.gui.screens.GenericWaitingScreen; import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.gui.screens.multiplayer.WarningScreen; -import net.minecraft.client.multiplayer.chat.report.Report; import net.minecraft.client.multiplayer.chat.report.ReportingContext; +import net.minecraft.client.multiplayer.chat.report.Report.Builder; +import net.minecraft.client.multiplayer.chat.report.Report.CannotBuildReason; import net.minecraft.network.chat.CommonComponents; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.ThrowingComponent; import org.slf4j.Logger; @Environment(EnvType.CLIENT) -public abstract class AbstractReportScreen> extends Screen { +public abstract class AbstractReportScreen> extends Screen { private static final Component REPORT_SENT_MESSAGE = Component.translatable("gui.abuseReport.report_sent_msg"); private static final Component REPORT_SENDING_TITLE = Component.translatable("gui.abuseReport.sending.title").withStyle(ChatFormatting.BOLD); private static final Component REPORT_SENT_TITLE = Component.translatable("gui.abuseReport.sent.title").withStyle(ChatFormatting.BOLD); @@ -100,9 +101,9 @@ public abstract class AbstractReportScreen> extends } protected void onReportChanged() { - Report.CannotBuildReason cannotBuildReason = this.reportBuilder.checkBuildable(); + CannotBuildReason cannotBuildReason = this.reportBuilder.checkBuildable(); this.sendButton.active = cannotBuildReason == null && this.attestation.selected(); - this.sendButton.setTooltip(Optionull.map(cannotBuildReason, Report.CannotBuildReason::tooltip)); + this.sendButton.setTooltip(Optionull.map(cannotBuildReason, CannotBuildReason::tooltip)); } @Override diff --git a/net/minecraft/client/gui/screens/reporting/ChatReportScreen.java b/net/minecraft/client/gui/screens/reporting/ChatReportScreen.java index df1d1149..5564da76 100644 --- a/net/minecraft/client/gui/screens/reporting/ChatReportScreen.java +++ b/net/minecraft/client/gui/screens/reporting/ChatReportScreen.java @@ -10,27 +10,29 @@ import net.minecraft.client.gui.layouts.CommonLayouts; import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.multiplayer.chat.report.ChatReport; import net.minecraft.client.multiplayer.chat.report.ReportReason; +import net.minecraft.client.multiplayer.chat.report.ReportType; import net.minecraft.client.multiplayer.chat.report.ReportingContext; +import net.minecraft.client.multiplayer.chat.report.ChatReport.Builder; import net.minecraft.network.chat.Component; @Environment(EnvType.CLIENT) -public class ChatReportScreen extends AbstractReportScreen { +public class ChatReportScreen extends AbstractReportScreen { private static final Component TITLE = Component.translatable("gui.chatReport.title"); private static final Component SELECT_CHAT_MESSAGE = Component.translatable("gui.chatReport.select_chat"); private MultiLineEditBox commentBox; private Button selectMessagesButton; private Button selectReasonButton; - private ChatReportScreen(Screen lastScreen, ReportingContext reportingContext, ChatReport.Builder reportBuilder) { + private ChatReportScreen(Screen lastScreen, ReportingContext reportingContext, Builder reportBuilder) { super(TITLE, lastScreen, reportingContext, reportBuilder); } public ChatReportScreen(Screen lastScreen, ReportingContext reportingContext, UUID reportId) { - this(lastScreen, reportingContext, new ChatReport.Builder(reportId, reportingContext.sender().reportLimits())); + this(lastScreen, reportingContext, new Builder(reportId, reportingContext.sender().reportLimits())); } public ChatReportScreen(Screen lastScreen, ReportingContext reportContext, ChatReport report) { - this(lastScreen, reportContext, new ChatReport.Builder(report, reportContext.sender().reportLimits())); + this(lastScreen, reportContext, new Builder(report, reportContext.sender().reportLimits())); } @Override @@ -47,7 +49,7 @@ public class ChatReportScreen extends AbstractReportScreen { .build() ); this.selectReasonButton = Button.builder( - SELECT_REASON, button -> this.minecraft.setScreen(new ReportReasonSelectionScreen(this, this.reportBuilder.reason(), reportReason -> { + SELECT_REASON, button -> this.minecraft.setScreen(new ReportReasonSelectionScreen(this, this.reportBuilder.reason(), ReportType.CHAT, reportReason -> { this.reportBuilder.setReason(reportReason); this.onReportChanged(); })) diff --git a/net/minecraft/client/gui/screens/reporting/ChatSelectionScreen.java b/net/minecraft/client/gui/screens/reporting/ChatSelectionScreen.java index 2f1b7b77..242531ae 100644 --- a/net/minecraft/client/gui/screens/reporting/ChatSelectionScreen.java +++ b/net/minecraft/client/gui/screens/reporting/ChatSelectionScreen.java @@ -1,36 +1,31 @@ package net.minecraft.client.gui.screens.reporting; -import com.mojang.authlib.GameProfile; import com.mojang.authlib.minecraft.report.AbuseReportLimits; -import com.mojang.blaze3d.systems.RenderSystem; -import java.util.List; -import java.util.UUID; import java.util.function.Consumer; -import java.util.function.Supplier; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; -import net.minecraft.Optionull; import net.minecraft.client.GuiMessageTag; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.Button; import net.minecraft.client.gui.components.MultiLineLabel; import net.minecraft.client.gui.components.ObjectSelectionList; -import net.minecraft.client.gui.components.PlayerFaceRenderer; -import net.minecraft.client.gui.navigation.CommonInputs; import net.minecraft.client.gui.navigation.ScreenDirection; import net.minecraft.client.gui.screens.Screen; +import net.minecraft.client.gui.screens.reporting.ChatSelectionLogFiller.Output; +import net.minecraft.client.gui.screens.reporting.ChatSelectionScreen.ChatSelectionList.DividerEntry; +import net.minecraft.client.gui.screens.reporting.ChatSelectionScreen.ChatSelectionList.Heading; +import net.minecraft.client.gui.screens.reporting.ChatSelectionScreen.ChatSelectionList.MessageEntry; +import net.minecraft.client.gui.screens.reporting.ChatSelectionScreen.ChatSelectionList.MessageHeadingEntry; +import net.minecraft.client.gui.screens.reporting.ChatSelectionScreen.ChatSelectionList.PaddingEntry; import net.minecraft.client.multiplayer.chat.ChatTrustLevel; import net.minecraft.client.multiplayer.chat.LoggedChatMessage; -import net.minecraft.client.multiplayer.chat.report.ChatReport; +import net.minecraft.client.multiplayer.chat.LoggedChatMessage.Player; import net.minecraft.client.multiplayer.chat.report.ReportingContext; -import net.minecraft.client.resources.PlayerSkin; -import net.minecraft.locale.Language; +import net.minecraft.client.multiplayer.chat.report.ChatReport.Builder; import net.minecraft.network.chat.CommonComponents; import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.FormattedText; import net.minecraft.resources.ResourceLocation; -import net.minecraft.util.FormattedCharSequence; import net.minecraft.util.Mth; import org.jetbrains.annotations.Nullable; @@ -46,11 +41,11 @@ public class ChatSelectionScreen extends Screen { private MultiLineLabel contextInfoLabel; @Nullable private ChatSelectionScreen.ChatSelectionList chatSelectionList; - final ChatReport.Builder report; - private final Consumer onSelected; + final Builder report; + private final Consumer onSelected; private ChatSelectionLogFiller chatLogFiller; - public ChatSelectionScreen(@Nullable Screen lastScreen, ReportingContext reportingContext, ChatReport.Builder report, Consumer onSelected) { + public ChatSelectionScreen(@Nullable Screen lastScreen, ReportingContext reportingContext, Builder report, Consumer onSelected) { super(TITLE); this.lastScreen = lastScreen; this.reportingContext = reportingContext; @@ -113,9 +108,11 @@ public class ChatSelectionScreen extends Screen { } @Environment(EnvType.CLIENT) - public class ChatSelectionList extends ObjectSelectionList implements ChatSelectionLogFiller.Output { + public class ChatSelectionList + extends ObjectSelectionList + implements Output { @Nullable - private ChatSelectionScreen.ChatSelectionList.Heading previousHeading; + private Heading previousHeading; public ChatSelectionList(final Minecraft minecraft, final int height) { super(minecraft, ChatSelectionScreen.this.width, ChatSelectionScreen.this.height - height - 80, 40, 16); @@ -131,23 +128,23 @@ public class ChatSelectionScreen extends Screen { } @Override - public void acceptMessage(int chatId, LoggedChatMessage.Player playerMessage) { + public void acceptMessage(int chatId, Player playerMessage) { boolean bl = playerMessage.canReport(ChatSelectionScreen.this.report.reportedProfileId()); ChatTrustLevel chatTrustLevel = playerMessage.trustLevel(); GuiMessageTag guiMessageTag = chatTrustLevel.createTag(playerMessage.message()); - ChatSelectionScreen.ChatSelectionList.Entry entry = new ChatSelectionScreen.ChatSelectionList.MessageEntry( - chatId, playerMessage.toContentComponent(), playerMessage.toNarrationComponent(), guiMessageTag, bl, true + net.minecraft.client.gui.screens.reporting.ChatSelectionScreen.ChatSelectionList.Entry entry = new MessageEntry( + this, chatId, playerMessage.toContentComponent(), playerMessage.toNarrationComponent(), guiMessageTag, bl, true ); this.addEntryToTop(entry); this.updateHeading(playerMessage, bl); } - private void updateHeading(LoggedChatMessage.Player loggedPlayerChatMessage, boolean canReport) { - ChatSelectionScreen.ChatSelectionList.Entry entry = new ChatSelectionScreen.ChatSelectionList.MessageHeadingEntry( - loggedPlayerChatMessage.profile(), loggedPlayerChatMessage.toHeadingComponent(), canReport + private void updateHeading(Player loggedPlayerChatMessage, boolean canReport) { + net.minecraft.client.gui.screens.reporting.ChatSelectionScreen.ChatSelectionList.Entry entry = new MessageHeadingEntry( + this, loggedPlayerChatMessage.profile(), loggedPlayerChatMessage.toHeadingComponent(), canReport ); this.addEntryToTop(entry); - ChatSelectionScreen.ChatSelectionList.Heading heading = new ChatSelectionScreen.ChatSelectionList.Heading(loggedPlayerChatMessage.profileId(), entry); + Heading heading = new Heading(loggedPlayerChatMessage.profileId(), entry); if (this.previousHeading != null && this.previousHeading.canCombine(heading)) { this.removeEntryFromTop(this.previousHeading.entry()); } @@ -157,9 +154,9 @@ public class ChatSelectionScreen extends Screen { @Override public void acceptDivider(Component text) { - this.addEntryToTop(new ChatSelectionScreen.ChatSelectionList.PaddingEntry()); - this.addEntryToTop(new ChatSelectionScreen.ChatSelectionList.DividerEntry(text)); - this.addEntryToTop(new ChatSelectionScreen.ChatSelectionList.PaddingEntry()); + this.addEntryToTop(new PaddingEntry(this)); + this.addEntryToTop(new DividerEntry(this, text)); + this.addEntryToTop(new PaddingEntry(this)); this.previousHeading = null; } @@ -174,7 +171,7 @@ public class ChatSelectionScreen extends Screen { @Override protected void renderItem(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick, int index, int left, int top, int width, int height) { - ChatSelectionScreen.ChatSelectionList.Entry entry = this.getEntry(index); + net.minecraft.client.gui.screens.reporting.ChatSelectionScreen.ChatSelectionList.Entry entry = this.getEntry(index); if (this.shouldHighlightEntry(entry)) { boolean bl = this.getSelected() == entry; int i = this.isFocused() && bl ? -1 : -8355712; @@ -184,7 +181,7 @@ public class ChatSelectionScreen extends Screen { entry.render(guiGraphics, index, top, left, width, height, mouseX, mouseY, this.getHovered() == entry, partialTick); } - private boolean shouldHighlightEntry(ChatSelectionScreen.ChatSelectionList.Entry entry) { + private boolean shouldHighlightEntry(net.minecraft.client.gui.screens.reporting.ChatSelectionScreen.ChatSelectionList.Entry entry) { if (entry.canSelect()) { boolean bl = this.getSelected() == entry; boolean bl2 = this.getSelected() == null; @@ -196,13 +193,13 @@ public class ChatSelectionScreen extends Screen { } @Nullable - protected ChatSelectionScreen.ChatSelectionList.Entry nextEntry(ScreenDirection direction) { - return this.nextEntry(direction, ChatSelectionScreen.ChatSelectionList.Entry::canSelect); + protected net.minecraft.client.gui.screens.reporting.ChatSelectionScreen.ChatSelectionList.Entry nextEntry(ScreenDirection direction) { + return this.nextEntry(direction, net.minecraft.client.gui.screens.reporting.ChatSelectionScreen.ChatSelectionList.Entry::canSelect); } - public void setSelected(@Nullable ChatSelectionScreen.ChatSelectionList.Entry selected) { + public void setSelected(@Nullable net.minecraft.client.gui.screens.reporting.ChatSelectionScreen.ChatSelectionList.Entry selected) { super.setSelected(selected); - ChatSelectionScreen.ChatSelectionList.Entry entry = this.nextEntry(ScreenDirection.UP); + net.minecraft.client.gui.screens.reporting.ChatSelectionScreen.ChatSelectionList.Entry entry = this.nextEntry(ScreenDirection.UP); if (entry == null) { ChatSelectionScreen.this.onReachedScrollTop(); } @@ -210,226 +207,12 @@ public class ChatSelectionScreen extends Screen { @Override public boolean keyPressed(int keyCode, int scanCode, int modifiers) { - ChatSelectionScreen.ChatSelectionList.Entry entry = this.getSelected(); + net.minecraft.client.gui.screens.reporting.ChatSelectionScreen.ChatSelectionList.Entry entry = this.getSelected(); return entry != null && entry.keyPressed(keyCode, scanCode, modifiers) ? true : super.keyPressed(keyCode, scanCode, modifiers); } public int getFooterTop() { return this.getBottom() + 9; } - - @Environment(EnvType.CLIENT) - public class DividerEntry extends ChatSelectionScreen.ChatSelectionList.Entry { - private static final int COLOR = -6250336; - private final Component text; - - public DividerEntry(final Component text) { - this.text = text; - } - - @Override - public void render(GuiGraphics guiGraphics, int index, int top, int left, int width, int height, int mouseX, int mouseY, boolean hovering, float partialTick) { - int i = top + height / 2; - int j = left + width - 8; - int k = ChatSelectionScreen.this.font.width(this.text); - int l = (left + j - k) / 2; - int m = i - 9 / 2; - guiGraphics.drawString(ChatSelectionScreen.this.font, this.text, l, m, -6250336); - } - - @Override - public Component getNarration() { - return this.text; - } - } - - @Environment(EnvType.CLIENT) - public abstract class Entry extends ObjectSelectionList.Entry { - @Override - public Component getNarration() { - return CommonComponents.EMPTY; - } - - public boolean isSelected() { - return false; - } - - public boolean canSelect() { - return false; - } - - public boolean canReport() { - return this.canSelect(); - } - } - - @Environment(EnvType.CLIENT) - record Heading(UUID sender, ChatSelectionScreen.ChatSelectionList.Entry entry) { - public boolean canCombine(ChatSelectionScreen.ChatSelectionList.Heading other) { - return other.sender.equals(this.sender); - } - } - - @Environment(EnvType.CLIENT) - public class MessageEntry extends ChatSelectionScreen.ChatSelectionList.Entry { - private static final int CHECKMARK_WIDTH = 9; - private static final int CHECKMARK_HEIGHT = 8; - private static final int INDENT_AMOUNT = 11; - private static final int TAG_MARGIN_LEFT = 4; - private final int chatId; - private final FormattedText text; - private final Component narration; - @Nullable - private final List hoverText; - @Nullable - private final GuiMessageTag.Icon tagIcon; - @Nullable - private final List tagHoverText; - private final boolean canReport; - private final boolean playerMessage; - - public MessageEntry( - final int chatId, - final Component text, - final Component narration, - @Nullable final GuiMessageTag tagIcon, - final boolean canReport, - final boolean playerMessage - ) { - this.chatId = chatId; - this.tagIcon = Optionull.map(tagIcon, GuiMessageTag::icon); - this.tagHoverText = tagIcon != null && tagIcon.text() != null - ? ChatSelectionScreen.this.font.split(tagIcon.text(), ChatSelectionList.this.getRowWidth()) - : null; - this.canReport = canReport; - this.playerMessage = playerMessage; - FormattedText formattedText = ChatSelectionScreen.this.font - .substrByWidth(text, this.getMaximumTextWidth() - ChatSelectionScreen.this.font.width(CommonComponents.ELLIPSIS)); - if (text != formattedText) { - this.text = FormattedText.composite(formattedText, CommonComponents.ELLIPSIS); - this.hoverText = ChatSelectionScreen.this.font.split(text, ChatSelectionList.this.getRowWidth()); - } else { - this.text = text; - this.hoverText = null; - } - - this.narration = narration; - } - - @Override - public void render(GuiGraphics guiGraphics, int index, int top, int left, int width, int height, int mouseX, int mouseY, boolean hovering, float partialTick) { - if (this.isSelected() && this.canReport) { - this.renderSelectedCheckmark(guiGraphics, top, left, height); - } - - int i = left + this.getTextIndent(); - int j = top + 1 + (height - 9) / 2; - guiGraphics.drawString(ChatSelectionScreen.this.font, Language.getInstance().getVisualOrder(this.text), i, j, this.canReport ? -1 : -1593835521); - if (this.hoverText != null && hovering) { - ChatSelectionScreen.this.setTooltipForNextRenderPass(this.hoverText); - } - - int k = ChatSelectionScreen.this.font.width(this.text); - this.renderTag(guiGraphics, i + k + 4, top, height, mouseX, mouseY); - } - - private void renderTag(GuiGraphics guiGraphics, int x, int y, int height, int mouseX, int mouseY) { - if (this.tagIcon != null) { - int i = y + (height - this.tagIcon.height) / 2; - this.tagIcon.draw(guiGraphics, x, i); - if (this.tagHoverText != null && mouseX >= x && mouseX <= x + this.tagIcon.width && mouseY >= i && mouseY <= i + this.tagIcon.height) { - ChatSelectionScreen.this.setTooltipForNextRenderPass(this.tagHoverText); - } - } - } - - private void renderSelectedCheckmark(GuiGraphics guiGraphics, int top, int left, int height) { - int j = top + (height - 8) / 2; - RenderSystem.enableBlend(); - guiGraphics.blitSprite(ChatSelectionScreen.CHECKMARK_SPRITE, left, j, 9, 8); - RenderSystem.disableBlend(); - } - - private int getMaximumTextWidth() { - int i = this.tagIcon != null ? this.tagIcon.width + 4 : 0; - return ChatSelectionList.this.getRowWidth() - this.getTextIndent() - 4 - i; - } - - private int getTextIndent() { - return this.playerMessage ? 11 : 0; - } - - @Override - public Component getNarration() { - return (Component)(this.isSelected() ? Component.translatable("narrator.select", this.narration) : this.narration); - } - - @Override - public boolean mouseClicked(double mouseX, double mouseY, int button) { - ChatSelectionList.this.setSelected(null); - return this.toggleReport(); - } - - @Override - public boolean keyPressed(int keyCode, int scanCode, int modifiers) { - return CommonInputs.selected(keyCode) ? this.toggleReport() : false; - } - - @Override - public boolean isSelected() { - return ChatSelectionScreen.this.report.isReported(this.chatId); - } - - @Override - public boolean canSelect() { - return true; - } - - @Override - public boolean canReport() { - return this.canReport; - } - - private boolean toggleReport() { - if (this.canReport) { - ChatSelectionScreen.this.report.toggleReported(this.chatId); - ChatSelectionScreen.this.updateConfirmSelectedButton(); - return true; - } else { - return false; - } - } - } - - @Environment(EnvType.CLIENT) - public class MessageHeadingEntry extends ChatSelectionScreen.ChatSelectionList.Entry { - private static final int FACE_SIZE = 12; - private static final int PADDING = 4; - private final Component heading; - private final Supplier skin; - private final boolean canReport; - - public MessageHeadingEntry(final GameProfile profile, final Component heading, final boolean canReport) { - this.heading = heading; - this.canReport = canReport; - this.skin = ChatSelectionList.this.minecraft.getSkinManager().lookupInsecure(profile); - } - - @Override - public void render(GuiGraphics guiGraphics, int index, int top, int left, int width, int height, int mouseX, int mouseY, boolean hovering, float partialTick) { - int i = left - 12 + 4; - int j = top + (height - 12) / 2; - PlayerFaceRenderer.draw(guiGraphics, (PlayerSkin)this.skin.get(), i, j, 12); - int k = top + 1 + (height - 9) / 2; - guiGraphics.drawString(ChatSelectionScreen.this.font, this.heading, i + 12 + 4, k, this.canReport ? -1 : -1593835521); - } - } - - @Environment(EnvType.CLIENT) - public class PaddingEntry extends ChatSelectionScreen.ChatSelectionList.Entry { - @Override - public void render(GuiGraphics guiGraphics, int index, int top, int left, int width, int height, int mouseX, int mouseY, boolean hovering, float partialTick) { - } - } } } diff --git a/net/minecraft/client/gui/screens/reporting/NameReportScreen.java b/net/minecraft/client/gui/screens/reporting/NameReportScreen.java index 80928b79..56518766 100644 --- a/net/minecraft/client/gui/screens/reporting/NameReportScreen.java +++ b/net/minecraft/client/gui/screens/reporting/NameReportScreen.java @@ -10,23 +10,27 @@ import net.minecraft.client.gui.layouts.CommonLayouts; import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.multiplayer.chat.report.NameReport; import net.minecraft.client.multiplayer.chat.report.ReportingContext; +import net.minecraft.client.multiplayer.chat.report.NameReport.Builder; import net.minecraft.network.chat.Component; +import org.jetbrains.annotations.Nullable; @Environment(EnvType.CLIENT) -public class NameReportScreen extends AbstractReportScreen { +public class NameReportScreen extends AbstractReportScreen { private static final Component TITLE = Component.translatable("gui.abuseReport.name.title"); + private static final Component COMMENT_BOX_LABEL = Component.translatable("gui.abuseReport.name.comment_box_label"); + @Nullable private MultiLineEditBox commentBox; - private NameReportScreen(Screen lastScreen, ReportingContext reportingContext, NameReport.Builder reportBuilder) { + private NameReportScreen(Screen lastScreen, ReportingContext reportingContext, Builder reportBuilder) { super(TITLE, lastScreen, reportingContext, reportBuilder); } public NameReportScreen(Screen lastScreen, ReportingContext reportingContext, UUID reportedProfileId, String reportedName) { - this(lastScreen, reportingContext, new NameReport.Builder(reportedProfileId, reportedName, reportingContext.sender().reportLimits())); + this(lastScreen, reportingContext, new Builder(reportedProfileId, reportedName, reportingContext.sender().reportLimits())); } public NameReportScreen(Screen lastScreen, ReportingContext reportingContext, NameReport report) { - this(lastScreen, reportingContext, new NameReport.Builder(report, reportingContext.sender().reportLimits())); + this(lastScreen, reportingContext, new Builder(report, reportingContext.sender().reportLimits())); } @Override @@ -35,17 +39,21 @@ public class NameReportScreen extends AbstractReportScreen { this.layout .addChild( new StringWidget(Component.translatable("gui.abuseReport.name.reporting", component), this.font), - layoutSettings -> layoutSettings.alignHorizontallyLeft().padding(0, 8) + layoutSettings -> layoutSettings.alignHorizontallyCenter().padding(0, 8) ); this.commentBox = this.createCommentBox(280, 9 * 8, string -> { this.reportBuilder.setComments(string); this.onReportChanged(); }); - this.layout.addChild(CommonLayouts.labeledElement(this.font, this.commentBox, MORE_COMMENTS_LABEL, layoutSettings -> layoutSettings.paddingBottom(12))); + this.layout.addChild(CommonLayouts.labeledElement(this.font, this.commentBox, COMMENT_BOX_LABEL, layoutSettings -> layoutSettings.paddingBottom(12))); } @Override public boolean mouseReleased(double mouseX, double mouseY, int button) { - return super.mouseReleased(mouseX, mouseY, button) ? true : this.commentBox.mouseReleased(mouseX, mouseY, button); + if (super.mouseReleased(mouseX, mouseY, button)) { + return true; + } else { + return this.commentBox != null ? this.commentBox.mouseReleased(mouseX, mouseY, button) : false; + } } } diff --git a/net/minecraft/client/gui/screens/reporting/ReportReasonSelectionScreen.java b/net/minecraft/client/gui/screens/reporting/ReportReasonSelectionScreen.java index eadfca99..42190354 100644 --- a/net/minecraft/client/gui/screens/reporting/ReportReasonSelectionScreen.java +++ b/net/minecraft/client/gui/screens/reporting/ReportReasonSelectionScreen.java @@ -14,7 +14,9 @@ import net.minecraft.client.gui.layouts.LinearLayout; import net.minecraft.client.gui.layouts.SpacerElement; import net.minecraft.client.gui.screens.ConfirmLinkScreen; import net.minecraft.client.gui.screens.Screen; +import net.minecraft.client.gui.screens.reporting.ReportReasonSelectionScreen.ReasonSelectionList.Entry; import net.minecraft.client.multiplayer.chat.report.ReportReason; +import net.minecraft.client.multiplayer.chat.report.ReportType; import net.minecraft.network.chat.CommonComponents; import net.minecraft.network.chat.Component; import net.minecraft.util.CommonLinks; @@ -36,12 +38,14 @@ public class ReportReasonSelectionScreen extends Screen { ReportReason currentlySelectedReason; private final Consumer onSelectedReason; final HeaderAndFooterLayout layout = new HeaderAndFooterLayout(this); + final ReportType reportType; - public ReportReasonSelectionScreen(@Nullable Screen lastScreen, @Nullable ReportReason currentlySelectedReason, Consumer onSelectedReason) { + public ReportReasonSelectionScreen(@Nullable Screen screen, @Nullable ReportReason reportReason, ReportType reportType, Consumer consumer) { super(REASON_TITLE); - this.lastScreen = lastScreen; - this.currentlySelectedReason = currentlySelectedReason; - this.onSelectedReason = onSelectedReason; + this.lastScreen = screen; + this.currentlySelectedReason = reportReason; + this.onSelectedReason = consumer; + this.reportType = reportType; } @Override @@ -49,13 +53,13 @@ public class ReportReasonSelectionScreen extends Screen { this.layout.addTitleHeader(REASON_TITLE, this.font); LinearLayout linearLayout = this.layout.addToContents(LinearLayout.vertical().spacing(4)); this.reasonSelectionList = linearLayout.addChild(new ReportReasonSelectionScreen.ReasonSelectionList(this.minecraft)); - ReportReasonSelectionScreen.ReasonSelectionList.Entry entry = Optionull.map(this.currentlySelectedReason, this.reasonSelectionList::findEntry); + Entry entry = Optionull.map(this.currentlySelectedReason, this.reasonSelectionList::findEntry); this.reasonSelectionList.setSelected(entry); linearLayout.addChild(SpacerElement.height(this.descriptionHeight())); LinearLayout linearLayout2 = this.layout.addToFooter(LinearLayout.horizontal().spacing(8)); linearLayout2.addChild(Button.builder(READ_INFO_LABEL, ConfirmLinkScreen.confirmLink(this, CommonLinks.REPORTING_HELP)).build()); linearLayout2.addChild(Button.builder(CommonComponents.GUI_DONE, button -> { - ReportReasonSelectionScreen.ReasonSelectionList.Entry entryx = this.reasonSelectionList.getSelected(); + Entry entryx = this.reasonSelectionList.getSelected(); if (entryx != null) { this.onSelectedReason.accept(entryx.getReason()); } @@ -82,7 +86,7 @@ public class ReportReasonSelectionScreen extends Screen { guiGraphics.fill(this.descriptionLeft(), this.descriptionTop(), this.descriptionRight(), this.descriptionBottom(), -16777216); guiGraphics.renderOutline(this.descriptionLeft(), this.descriptionTop(), this.descriptionWidth(), this.descriptionHeight(), -1); guiGraphics.drawString(this.font, REASON_DESCRIPTION, this.descriptionLeft() + 4, this.descriptionTop() + 4, -1); - ReportReasonSelectionScreen.ReasonSelectionList.Entry entry = this.reasonSelectionList.getSelected(); + Entry entry = this.reasonSelectionList.getSelected(); if (entry != null) { int i = this.descriptionLeft() + 4 + 16; int j = this.descriptionRight() - 4; @@ -129,7 +133,7 @@ public class ReportReasonSelectionScreen extends Screen { } @Environment(EnvType.CLIENT) - public class ReasonSelectionList extends ObjectSelectionList { + public class ReasonSelectionList extends ObjectSelectionList { public ReasonSelectionList(final Minecraft minecraft) { super( minecraft, @@ -140,13 +144,19 @@ public class ReportReasonSelectionScreen extends Screen { ); for (ReportReason reportReason : ReportReason.values()) { - this.addEntry(new ReportReasonSelectionScreen.ReasonSelectionList.Entry(reportReason)); + if (!ReportReason.getIncompatibleCategories(ReportReasonSelectionScreen.this.reportType).contains(reportReason)) { + this.addEntry(new net.minecraft.client.gui.screens.reporting.ReportReasonSelectionScreen.ReasonSelectionList.Entry(this, reportReason)); + } } } @Nullable - public ReportReasonSelectionScreen.ReasonSelectionList.Entry findEntry(ReportReason reason) { - return (ReportReasonSelectionScreen.ReasonSelectionList.Entry)this.children().stream().filter(entry -> entry.reason == reason).findFirst().orElse(null); + public net.minecraft.client.gui.screens.reporting.ReportReasonSelectionScreen.ReasonSelectionList.Entry findEntry(ReportReason reason) { + return (net.minecraft.client.gui.screens.reporting.ReportReasonSelectionScreen.ReasonSelectionList.Entry)this.children() + .stream() + .filter(entry -> entry.reason == reason) + .findFirst() + .orElse(null); } @Override @@ -154,40 +164,9 @@ public class ReportReasonSelectionScreen extends Screen { return 320; } - public void setSelected(@Nullable ReportReasonSelectionScreen.ReasonSelectionList.Entry selected) { + public void setSelected(@Nullable net.minecraft.client.gui.screens.reporting.ReportReasonSelectionScreen.ReasonSelectionList.Entry selected) { super.setSelected(selected); ReportReasonSelectionScreen.this.currentlySelectedReason = selected != null ? selected.getReason() : null; } - - @Environment(EnvType.CLIENT) - public class Entry extends ObjectSelectionList.Entry { - final ReportReason reason; - - public Entry(final ReportReason reason) { - this.reason = reason; - } - - @Override - public void render(GuiGraphics guiGraphics, int index, int top, int left, int width, int height, int mouseX, int mouseY, boolean hovering, float partialTick) { - int i = left + 1; - int j = top + (height - 9) / 2 + 1; - guiGraphics.drawString(ReportReasonSelectionScreen.this.font, this.reason.title(), i, j, -1); - } - - @Override - public Component getNarration() { - return Component.translatable("gui.abuseReport.reason.narration", this.reason.title(), this.reason.description()); - } - - @Override - public boolean mouseClicked(double mouseX, double mouseY, int button) { - ReasonSelectionList.this.setSelected(this); - return super.mouseClicked(mouseX, mouseY, button); - } - - public ReportReason getReason() { - return this.reason; - } - } } } diff --git a/net/minecraft/client/gui/screens/reporting/SkinReportScreen.java b/net/minecraft/client/gui/screens/reporting/SkinReportScreen.java index aac707f1..e286829b 100644 --- a/net/minecraft/client/gui/screens/reporting/SkinReportScreen.java +++ b/net/minecraft/client/gui/screens/reporting/SkinReportScreen.java @@ -11,29 +11,31 @@ import net.minecraft.client.gui.layouts.CommonLayouts; import net.minecraft.client.gui.layouts.LinearLayout; import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.multiplayer.chat.report.ReportReason; +import net.minecraft.client.multiplayer.chat.report.ReportType; import net.minecraft.client.multiplayer.chat.report.ReportingContext; import net.minecraft.client.multiplayer.chat.report.SkinReport; +import net.minecraft.client.multiplayer.chat.report.SkinReport.Builder; import net.minecraft.client.resources.PlayerSkin; import net.minecraft.network.chat.Component; @Environment(EnvType.CLIENT) -public class SkinReportScreen extends AbstractReportScreen { +public class SkinReportScreen extends AbstractReportScreen { private static final int SKIN_WIDTH = 85; private static final int FORM_WIDTH = 178; private static final Component TITLE = Component.translatable("gui.abuseReport.skin.title"); private MultiLineEditBox commentBox; private Button selectReasonButton; - private SkinReportScreen(Screen lastScreen, ReportingContext reportingContext, SkinReport.Builder reportBuilder) { + private SkinReportScreen(Screen lastScreen, ReportingContext reportingContext, Builder reportBuilder) { super(TITLE, lastScreen, reportingContext, reportBuilder); } public SkinReportScreen(Screen lastScreen, ReportingContext reportingContext, UUID reportId, Supplier skinGetter) { - this(lastScreen, reportingContext, new SkinReport.Builder(reportId, skinGetter, reportingContext.sender().reportLimits())); + this(lastScreen, reportingContext, new Builder(reportId, skinGetter, reportingContext.sender().reportLimits())); } public SkinReportScreen(Screen lastScreen, ReportingContext reportingContext, SkinReport report) { - this(lastScreen, reportingContext, new SkinReport.Builder(report, reportingContext.sender().reportLimits())); + this(lastScreen, reportingContext, new Builder(report, reportingContext.sender().reportLimits())); } @Override @@ -43,7 +45,7 @@ public class SkinReportScreen extends AbstractReportScreen { linearLayout.addChild(new PlayerSkinWidget(85, 120, this.minecraft.getEntityModels(), this.reportBuilder.report().getSkinGetter())); LinearLayout linearLayout2 = linearLayout.addChild(LinearLayout.vertical().spacing(8)); this.selectReasonButton = Button.builder( - SELECT_REASON, button -> this.minecraft.setScreen(new ReportReasonSelectionScreen(this, this.reportBuilder.reason(), reportReason -> { + SELECT_REASON, button -> this.minecraft.setScreen(new ReportReasonSelectionScreen(this, this.reportBuilder.reason(), ReportType.SKIN, reportReason -> { this.reportBuilder.setReason(reportReason); this.onReportChanged(); })) diff --git a/net/minecraft/client/gui/screens/social/PlayerEntry.java b/net/minecraft/client/gui/screens/social/PlayerEntry.java index 5342b017..6acdb050 100644 --- a/net/minecraft/client/gui/screens/social/PlayerEntry.java +++ b/net/minecraft/client/gui/screens/social/PlayerEntry.java @@ -22,12 +22,13 @@ import net.minecraft.client.gui.components.events.GuiEventListener; import net.minecraft.client.gui.narration.NarratableEntry; import net.minecraft.client.gui.screens.reporting.ReportPlayerScreen; import net.minecraft.client.multiplayer.chat.report.ReportingContext; +import net.minecraft.client.renderer.RenderType; import net.minecraft.client.resources.PlayerSkin; import net.minecraft.network.chat.CommonComponents; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.MutableComponent; import net.minecraft.resources.ResourceLocation; -import net.minecraft.util.FastColor; +import net.minecraft.util.ARGB; import org.jetbrains.annotations.Nullable; @Environment(EnvType.CLIENT) @@ -75,12 +76,12 @@ public class PlayerEntry extends ContainerObjectSelectionList.Entry private static final Component REPORT_PLAYER_TOOLTIP = Component.translatable("gui.socialInteractions.tooltip.report"); private static final int SKIN_SIZE = 24; private static final int PADDING = 4; - public static final int SKIN_SHADE = FastColor.ARGB32.color(190, 0, 0, 0); + public static final int SKIN_SHADE = ARGB.color(190, 0, 0, 0); private static final int CHAT_TOGGLE_ICON_SIZE = 20; - public static final int BG_FILL = FastColor.ARGB32.color(255, 74, 74, 74); - public static final int BG_FILL_REMOVED = FastColor.ARGB32.color(255, 48, 48, 48); - public static final int PLAYERNAME_COLOR = FastColor.ARGB32.color(255, 255, 255, 255); - public static final int PLAYER_STATUS_COLOR = FastColor.ARGB32.color(140, 255, 255, 255); + public static final int BG_FILL = ARGB.color(255, 74, 74, 74); + public static final int BG_FILL_REMOVED = ARGB.color(255, 48, 48, 48); + public static final int PLAYERNAME_COLOR = ARGB.color(255, 255, 255, 255); + public static final int PLAYER_STATUS_COLOR = ARGB.color(140, 255, 255, 255); public PlayerEntry( Minecraft minecraft, SocialInteractionsScreen socialInteractionsScreen, UUID id, String playerName, Supplier skinGetter, boolean playerReportable @@ -194,7 +195,7 @@ public class PlayerEntry extends ContainerObjectSelectionList.Entry } if (this.hasDraftReport && this.reportButton != null) { - guiGraphics.blitSprite(DRAFT_REPORT_SPRITE, this.reportButton.getX() + 5, this.reportButton.getY() + 1, 15, 15); + guiGraphics.blitSprite(RenderType::guiTextured, DRAFT_REPORT_SPRITE, this.reportButton.getX() + 5, this.reportButton.getY() + 1, 15, 15); } } diff --git a/net/minecraft/client/gui/screens/social/SocialInteractionsScreen.java b/net/minecraft/client/gui/screens/social/SocialInteractionsScreen.java index 8ac0bd6b..3efe6186 100644 --- a/net/minecraft/client/gui/screens/social/SocialInteractionsScreen.java +++ b/net/minecraft/client/gui/screens/social/SocialInteractionsScreen.java @@ -19,6 +19,7 @@ import net.minecraft.client.gui.screens.ConfirmLinkScreen; import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.multiplayer.PlayerInfo; import net.minecraft.client.multiplayer.ServerData; +import net.minecraft.client.renderer.RenderType; import net.minecraft.network.chat.CommonComponents; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.MutableComponent; @@ -211,8 +212,8 @@ public class SocialInteractionsScreen extends Screen { public void renderBackground(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) { super.renderBackground(guiGraphics, mouseX, mouseY, partialTick); int i = this.marginX() + 3; - guiGraphics.blitSprite(BACKGROUND_SPRITE, i, 64, 236, this.windowHeight() + 16); - guiGraphics.blitSprite(SEARCH_SPRITE, i + 10, 76, 12, 12); + guiGraphics.blitSprite(RenderType::guiTextured, BACKGROUND_SPRITE, i, 64, 236, this.windowHeight() + 16); + guiGraphics.blitSprite(RenderType::guiTextured, SEARCH_SPRITE, i + 10, 76, 12, 12); } @Override diff --git a/net/minecraft/client/gui/screens/worldselection/ConfirmExperimentalFeaturesScreen.java b/net/minecraft/client/gui/screens/worldselection/ConfirmExperimentalFeaturesScreen.java index b9e7fcc2..af73907d 100644 --- a/net/minecraft/client/gui/screens/worldselection/ConfirmExperimentalFeaturesScreen.java +++ b/net/minecraft/client/gui/screens/worldselection/ConfirmExperimentalFeaturesScreen.java @@ -4,25 +4,20 @@ import it.unimi.dsi.fastutil.booleans.BooleanConsumer; import java.util.Collection; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.AbstractWidget; import net.minecraft.client.gui.components.Button; -import net.minecraft.client.gui.components.MultiLineLabel; import net.minecraft.client.gui.components.MultiLineTextWidget; -import net.minecraft.client.gui.components.ObjectSelectionList; import net.minecraft.client.gui.components.StringWidget; import net.minecraft.client.gui.layouts.FrameLayout; import net.minecraft.client.gui.layouts.GridLayout; import net.minecraft.client.gui.layouts.HeaderAndFooterLayout; import net.minecraft.client.gui.layouts.LayoutSettings; +import net.minecraft.client.gui.layouts.GridLayout.RowHelper; import net.minecraft.client.gui.screens.Screen; +import net.minecraft.client.gui.screens.worldselection.ConfirmExperimentalFeaturesScreen.DetailsScreen.PackList; import net.minecraft.network.chat.CommonComponents; import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.ComponentUtils; -import net.minecraft.network.chat.Style; import net.minecraft.server.packs.repository.Pack; -import net.minecraft.world.flag.FeatureFlags; import org.jetbrains.annotations.Nullable; @Environment(EnvType.CLIENT) @@ -50,7 +45,7 @@ public class ConfirmExperimentalFeaturesScreen extends Screen { @Override protected void init() { super.init(); - GridLayout.RowHelper rowHelper = this.layout.createRowHelper(2); + RowHelper rowHelper = this.layout.createRowHelper(2); LayoutSettings layoutSettings = rowHelper.newCellSettings().alignHorizontallyCenter(); rowHelper.addChild(new StringWidget(this.title, this.font), 2, layoutSettings); MultiLineTextWidget multiLineTextWidget = rowHelper.addChild(new MultiLineTextWidget(MESSAGE, this.font).setCentered(true), 2, layoutSettings); @@ -84,7 +79,7 @@ public class ConfirmExperimentalFeaturesScreen extends Screen { private static final Component TITLE = Component.translatable("selectWorld.experimental.details.title"); final HeaderAndFooterLayout layout = new HeaderAndFooterLayout(this); @Nullable - private ConfirmExperimentalFeaturesScreen.DetailsScreen.PackList list; + private PackList list; DetailsScreen() { super(TITLE); @@ -93,8 +88,7 @@ public class ConfirmExperimentalFeaturesScreen extends Screen { @Override protected void init() { this.layout.addTitleHeader(TITLE, this.font); - this.list = this.layout - .addToContents(new ConfirmExperimentalFeaturesScreen.DetailsScreen.PackList(this.minecraft, ConfirmExperimentalFeaturesScreen.this.enabledPacks)); + this.list = this.layout.addToContents(new PackList(this, this.minecraft, ConfirmExperimentalFeaturesScreen.this.enabledPacks)); this.layout.addToFooter(Button.builder(CommonComponents.GUI_BACK, button -> this.onClose()).build()); this.layout.visitWidgets(guiEventListener -> { AbstractWidget var10000 = this.addRenderableWidget(guiEventListener); @@ -115,50 +109,5 @@ public class ConfirmExperimentalFeaturesScreen extends Screen { public void onClose() { this.minecraft.setScreen(ConfirmExperimentalFeaturesScreen.this); } - - @Environment(EnvType.CLIENT) - class PackList extends ObjectSelectionList { - public PackList(final Minecraft minecraft, final Collection enabledPacks) { - super(minecraft, DetailsScreen.this.width, DetailsScreen.this.layout.getContentHeight(), DetailsScreen.this.layout.getHeaderHeight(), (9 + 2) * 3); - - for (Pack pack : enabledPacks) { - String string = FeatureFlags.printMissingFlags(FeatureFlags.VANILLA_SET, pack.getRequestedFeatures()); - if (!string.isEmpty()) { - Component component = ComponentUtils.mergeStyles(pack.getTitle().copy(), Style.EMPTY.withBold(true)); - Component component2 = Component.translatable("selectWorld.experimental.details.entry", string); - this.addEntry(DetailsScreen.this.new PackListEntry(component, component2, MultiLineLabel.create(DetailsScreen.this.font, component2, this.getRowWidth()))); - } - } - } - - @Override - public int getRowWidth() { - return this.width * 3 / 4; - } - } - - @Environment(EnvType.CLIENT) - class PackListEntry extends ObjectSelectionList.Entry { - private final Component packId; - private final Component message; - private final MultiLineLabel splitMessage; - - PackListEntry(final Component packId, final Component message, final MultiLineLabel splitMessage) { - this.packId = packId; - this.message = message; - this.splitMessage = splitMessage; - } - - @Override - public void render(GuiGraphics guiGraphics, int index, int top, int left, int width, int height, int mouseX, int mouseY, boolean hovering, float partialTick) { - guiGraphics.drawString(DetailsScreen.this.minecraft.font, this.packId, left, top, -1); - this.splitMessage.renderLeftAligned(guiGraphics, left, top + 12, 9, -1); - } - - @Override - public Component getNarration() { - return Component.translatable("narrator.select", CommonComponents.joinForNarration(this.packId, this.message)); - } - } } } diff --git a/net/minecraft/client/gui/screens/worldselection/CreateWorldCallback.java b/net/minecraft/client/gui/screens/worldselection/CreateWorldCallback.java new file mode 100644 index 00000000..598b2d2d --- /dev/null +++ b/net/minecraft/client/gui/screens/worldselection/CreateWorldCallback.java @@ -0,0 +1,17 @@ +package net.minecraft.client.gui.screens.worldselection; + +import java.nio.file.Path; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.core.LayeredRegistryAccess; +import net.minecraft.server.RegistryLayer; +import net.minecraft.world.level.storage.PrimaryLevelData; +import org.jetbrains.annotations.Nullable; + +@FunctionalInterface +@Environment(EnvType.CLIENT) +public interface CreateWorldCallback { + boolean create( + CreateWorldScreen createWorldScreen, LayeredRegistryAccess layeredRegistryAccess, PrimaryLevelData primaryLevelData, @Nullable Path path + ); +} diff --git a/net/minecraft/client/gui/screens/worldselection/CreateWorldScreen.java b/net/minecraft/client/gui/screens/worldselection/CreateWorldScreen.java index f8363d29..12835789 100644 --- a/net/minecraft/client/gui/screens/worldselection/CreateWorldScreen.java +++ b/net/minecraft/client/gui/screens/worldselection/CreateWorldScreen.java @@ -2,7 +2,6 @@ package net.minecraft.client.gui.screens.worldselection; import com.google.common.collect.ImmutableList; import com.google.gson.JsonElement; -import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.datafixers.util.Pair; import com.mojang.logging.LogUtils; import com.mojang.serialization.DataResult; @@ -12,13 +11,16 @@ import com.mojang.serialization.Lifecycle; import java.io.IOException; import java.io.UncheckedIOException; import java.nio.file.Files; +import java.nio.file.LinkOption; import java.nio.file.Path; import java.util.Comparator; import java.util.List; import java.util.Optional; import java.util.OptionalLong; +import java.util.Set; import java.util.concurrent.CompletableFuture; import java.util.function.Consumer; +import java.util.function.Function; import java.util.stream.Stream; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; @@ -39,16 +41,20 @@ import net.minecraft.client.gui.components.tabs.TabManager; import net.minecraft.client.gui.components.tabs.TabNavigationBar; import net.minecraft.client.gui.components.toasts.SystemToast; import net.minecraft.client.gui.layouts.CommonLayouts; -import net.minecraft.client.gui.layouts.GridLayout; import net.minecraft.client.gui.layouts.HeaderAndFooterLayout; import net.minecraft.client.gui.layouts.LayoutSettings; import net.minecraft.client.gui.layouts.LinearLayout; +import net.minecraft.client.gui.layouts.GridLayout.RowHelper; import net.minecraft.client.gui.narration.NarratableEntry; import net.minecraft.client.gui.navigation.ScreenRectangle; import net.minecraft.client.gui.screens.ConfirmScreen; import net.minecraft.client.gui.screens.GenericMessageScreen; import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.gui.screens.packs.PackSelectionScreen; +import net.minecraft.client.gui.screens.worldselection.CreateWorldScreen.WorldTab.1; +import net.minecraft.client.gui.screens.worldselection.CreateWorldScreen.WorldTab.2; +import net.minecraft.client.gui.screens.worldselection.SwitchGrid.Builder; +import net.minecraft.client.renderer.RenderType; import net.minecraft.commands.Commands; import net.minecraft.core.LayeredRegistryAccess; import net.minecraft.core.registries.Registries; @@ -72,6 +78,7 @@ import net.minecraft.world.level.WorldDataConfiguration; import net.minecraft.world.level.levelgen.WorldDimensions; import net.minecraft.world.level.levelgen.WorldGenSettings; import net.minecraft.world.level.levelgen.WorldOptions; +import net.minecraft.world.level.levelgen.flat.FlatLevelGeneratorPresets; import net.minecraft.world.level.levelgen.presets.WorldPreset; import net.minecraft.world.level.levelgen.presets.WorldPresets; import net.minecraft.world.level.storage.LevelResource; @@ -102,6 +109,7 @@ public class CreateWorldScreen extends Screen { private final TabManager tabManager = new TabManager(this::addRenderableWidget, guiEventListener -> this.removeWidget(guiEventListener)); private boolean recreated; private final DirectoryValidator packValidator; + private final CreateWorldCallback createWorldCallback; @Nullable private final Screen lastScreen; @Nullable @@ -112,30 +120,75 @@ public class CreateWorldScreen extends Screen { private TabNavigationBar tabNavigationBar; public static void openFresh(Minecraft minecraft, @Nullable Screen lastScreen) { + openFresh( + minecraft, + lastScreen, + (createWorldScreen, layeredRegistryAccess, primaryLevelData, path) -> createWorldScreen.createNewWorld(layeredRegistryAccess, primaryLevelData) + ); + } + + public static void openFresh(Minecraft minecraft, @Nullable Screen screen, CreateWorldCallback createWorldCallback) { + WorldCreationContextMapper worldCreationContextMapper = (reloadableServerResources, layeredRegistryAccess, dataPackReloadCookie) -> new WorldCreationContext( + dataPackReloadCookie.worldGenSettings(), layeredRegistryAccess, reloadableServerResources, dataPackReloadCookie.dataConfiguration() + ); + Function function = dataLoadContext -> new WorldGenSettings( + WorldOptions.defaultWithRandomSeed(), WorldPresets.createNormalWorldDimensions(dataLoadContext.datapackWorldgen()) + ); + openCreateWorldScreen(minecraft, screen, function, worldCreationContextMapper, WorldPresets.NORMAL, createWorldCallback); + } + + public static void testWorld(Minecraft minecraft, @Nullable Screen screen) { + WorldCreationContextMapper worldCreationContextMapper = (reloadableServerResources, layeredRegistryAccess, dataPackReloadCookie) -> new WorldCreationContext( + dataPackReloadCookie.worldGenSettings().options(), + dataPackReloadCookie.worldGenSettings().dimensions(), + layeredRegistryAccess, + reloadableServerResources, + dataPackReloadCookie.dataConfiguration(), + new InitialWorldCreationOptions( + WorldCreationUiState.SelectedGameMode.CREATIVE, + Set.of(GameRules.RULE_DAYLIGHT, GameRules.RULE_WEATHER_CYCLE, GameRules.RULE_DOMOBSPAWNING), + FlatLevelGeneratorPresets.REDSTONE_READY + ) + ); + Function function = dataLoadContext -> new WorldGenSettings( + WorldOptions.testWorldWithRandomSeed(), WorldPresets.createFlatWorldDimensions(dataLoadContext.datapackWorldgen()) + ); + openCreateWorldScreen( + minecraft, + screen, + function, + worldCreationContextMapper, + WorldPresets.FLAT, + (createWorldScreen, layeredRegistryAccess, primaryLevelData, path) -> createWorldScreen.createNewWorld(layeredRegistryAccess, primaryLevelData) + ); + } + + private static void openCreateWorldScreen( + Minecraft minecraft, + @Nullable Screen screen, + Function function, + WorldCreationContextMapper worldCreationContextMapper, + ResourceKey resourceKey, + CreateWorldCallback createWorldCallback + ) { queueLoadScreen(minecraft, PREPARING_WORLD_DATA); PackRepository packRepository = new PackRepository(new ServerPacksSource(minecraft.directoryValidator())); WorldLoader.InitConfig initConfig = createDefaultLoadConfig(packRepository, WorldDataConfiguration.DEFAULT); CompletableFuture completableFuture = WorldLoader.load( initConfig, dataLoadContext -> new WorldLoader.DataLoadOutput<>( - new CreateWorldScreen.DataPackReloadCookie( - new WorldGenSettings(WorldOptions.defaultWithRandomSeed(), WorldPresets.createNormalWorldDimensions(dataLoadContext.datapackWorldgen())), - dataLoadContext.dataConfiguration() - ), - dataLoadContext.datapackDimensions() + new DataPackReloadCookie((WorldGenSettings)function.apply(dataLoadContext), dataLoadContext.dataConfiguration()), dataLoadContext.datapackDimensions() ), (closeableResourceManager, reloadableServerResources, layeredRegistryAccess, dataPackReloadCookie) -> { closeableResourceManager.close(); - return new WorldCreationContext( - dataPackReloadCookie.worldGenSettings(), layeredRegistryAccess, reloadableServerResources, dataPackReloadCookie.dataConfiguration() - ); + return worldCreationContextMapper.apply(reloadableServerResources, layeredRegistryAccess, dataPackReloadCookie); }, Util.backgroundExecutor(), minecraft ); minecraft.managedBlock(completableFuture::isDone); minecraft.setScreen( - new CreateWorldScreen(minecraft, lastScreen, (WorldCreationContext)completableFuture.join(), Optional.of(WorldPresets.NORMAL), OptionalLong.empty()) + new CreateWorldScreen(minecraft, screen, (WorldCreationContext)completableFuture.join(), Optional.of(resourceKey), OptionalLong.empty(), createWorldCallback) ); } @@ -143,7 +196,12 @@ public class CreateWorldScreen extends Screen { Minecraft minecraft, @Nullable Screen lastScreen, LevelSettings levelSettings, WorldCreationContext settings, @Nullable Path tempDataPackDir ) { CreateWorldScreen createWorldScreen = new CreateWorldScreen( - minecraft, lastScreen, settings, WorldPresets.fromSettings(settings.selectedDimensions()), OptionalLong.of(settings.options().seed()) + minecraft, + lastScreen, + settings, + WorldPresets.fromSettings(settings.selectedDimensions()), + OptionalLong.of(settings.options().seed()), + (createWorldScreenx, layeredRegistryAccess, primaryLevelData, path) -> createWorldScreenx.createNewWorld(layeredRegistryAccess, primaryLevelData) ); createWorldScreen.recreated = true; createWorldScreen.uiState.setName(levelSettings.levelName()); @@ -163,12 +221,18 @@ public class CreateWorldScreen extends Screen { } private CreateWorldScreen( - Minecraft minecraft, @Nullable Screen lastScreen, WorldCreationContext settings, Optional> preset, OptionalLong seed + Minecraft minecraft, + @Nullable Screen screen, + WorldCreationContext worldCreationContext, + Optional> optional, + OptionalLong optionalLong, + CreateWorldCallback createWorldCallback ) { super(Component.translatable("selectWorld.create")); - this.lastScreen = lastScreen; + this.lastScreen = screen; this.packValidator = minecraft.directoryValidator(); - this.uiState = new WorldCreationUiState(minecraft.getLevelSource().getBaseDir(), settings, preset, seed); + this.createWorldCallback = createWorldCallback; + this.uiState = new WorldCreationUiState(minecraft.getLevelSource().getBaseDir(), worldCreationContext, optional, optionalLong); } public WorldCreationUiState getUiState() { @@ -223,34 +287,41 @@ public class CreateWorldScreen extends Screen { Lifecycle lifecycle2 = layeredRegistryAccess.compositeAccess().allRegistriesLifecycle(); Lifecycle lifecycle3 = lifecycle2.add(lifecycle); boolean bl = !this.recreated && lifecycle2 == Lifecycle.stable(); - WorldOpenFlows.confirmWorldCreation( - this.minecraft, this, lifecycle3, () -> this.createNewWorld(complete.specialWorldProperty(), layeredRegistryAccess, lifecycle3), bl - ); + LevelSettings levelSettings = this.createLevelSettings(complete.specialWorldProperty() == PrimaryLevelData.SpecialWorldProperty.DEBUG); + PrimaryLevelData primaryLevelData = new PrimaryLevelData(levelSettings, this.uiState.getSettings().options(), complete.specialWorldProperty(), lifecycle3); + WorldOpenFlows.confirmWorldCreation(this.minecraft, this, lifecycle3, () -> this.createWorldAndCleanup(layeredRegistryAccess, primaryLevelData), bl); } - private void createNewWorld( - PrimaryLevelData.SpecialWorldProperty specialWorldProperty, LayeredRegistryAccess layeredRegistryAccess, Lifecycle worldGenSettingsLifecycle - ) { + private void createWorldAndCleanup(LayeredRegistryAccess layeredRegistryAccess, PrimaryLevelData primaryLevelData) { + boolean bl = this.createWorldCallback.create(this, layeredRegistryAccess, primaryLevelData, this.tempDataPackDir); + this.removeTempDataPackDir(); + if (!bl) { + this.popScreen(); + } + } + + private boolean createNewWorld(LayeredRegistryAccess layeredRegistryAccess, WorldData worldData) { + String string = this.uiState.getTargetFolder(); + WorldCreationContext worldCreationContext = this.uiState.getSettings(); queueLoadScreen(this.minecraft, PREPARING_WORLD_DATA); - Optional optional = this.createNewWorldDirectory(); - if (!optional.isEmpty()) { - this.removeTempDataPackDir(); - boolean bl = specialWorldProperty == PrimaryLevelData.SpecialWorldProperty.DEBUG; - WorldCreationContext worldCreationContext = this.uiState.getSettings(); - LevelSettings levelSettings = this.createLevelSettings(bl); - WorldData worldData = new PrimaryLevelData(levelSettings, worldCreationContext.options(), specialWorldProperty, worldGenSettingsLifecycle); + Optional optional = createNewWorldDirectory(this.minecraft, string, this.tempDataPackDir); + if (optional.isEmpty()) { + SystemToast.onPackCopyFailure(this.minecraft, string); + return false; + } else { this.minecraft .createWorldOpenFlows() .createLevelFromExistingSettings( (LevelStorageSource.LevelStorageAccess)optional.get(), worldCreationContext.dataPackResources(), layeredRegistryAccess, worldData ); + return true; } } private LevelSettings createLevelSettings(boolean debug) { String string = this.uiState.getName().trim(); if (debug) { - GameRules gameRules = new GameRules(); + GameRules gameRules = new GameRules(WorldDataConfiguration.DEFAULT.enabledFeatures()); gameRules.getRule(GameRules.RULE_DAYLIGHT).set(false, null); return new LevelSettings(string, GameType.SPECTATOR, false, Difficulty.PEACEFUL, true, gameRules, WorldDataConfiguration.DEFAULT); } else { @@ -293,14 +364,12 @@ public class CreateWorldScreen extends Screen { @Override public void render(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) { super.render(guiGraphics, mouseX, mouseY, partialTick); - RenderSystem.enableBlend(); - guiGraphics.blit(Screen.FOOTER_SEPARATOR, 0, this.height - this.layout.getFooterHeight() - 2, 0.0F, 0.0F, this.width, 2, 32, 2); - RenderSystem.disableBlend(); + guiGraphics.blit(RenderType::guiTextured, Screen.FOOTER_SEPARATOR, 0, this.height - this.layout.getFooterHeight() - 2, 0.0F, 0.0F, this.width, 2, 32, 2); } @Override protected void renderMenuBackground(GuiGraphics partialTick) { - partialTick.blit(TAB_HEADER_BACKGROUND, 0, 0, 0.0F, 0.0F, this.width, this.layout.getHeaderHeight(), 16, 16); + partialTick.blit(RenderType::guiTextured, TAB_HEADER_BACKGROUND, 0, 0, 0.0F, 0.0F, this.width, this.layout.getHeaderHeight(), 16, 16); this.renderMenuBackground(partialTick, 0, this.layout.getHeaderHeight(), this.width, this.height); } @@ -315,7 +384,7 @@ public class CreateWorldScreen extends Screen { } @Nullable - private Path getTempDataPackDir() { + private Path getOrCreateTempDataPackDir() { if (this.tempDataPackDir == null) { try { this.tempDataPackDir = Files.createTempDirectory("mcworld-"); @@ -382,12 +451,12 @@ public class CreateWorldScreen extends Screen { private void applyNewPackConfig(PackRepository packRepository, WorldDataConfiguration worldDataConfiguration, Consumer consumer) { this.minecraft.forceSetScreen(new GenericMessageScreen(Component.translatable("dataPack.validation.working"))); WorldLoader.InitConfig initConfig = createDefaultLoadConfig(packRepository, worldDataConfiguration); - WorldLoader.load( + WorldLoader.load( initConfig, dataLoadContext -> { - if (dataLoadContext.datapackWorldgen().registryOrThrow(Registries.WORLD_PRESET).size() == 0) { + if (dataLoadContext.datapackWorldgen().lookupOrThrow(Registries.WORLD_PRESET).listElements().findAny().isEmpty()) { throw new IllegalStateException("Needs at least one world preset to continue"); - } else if (dataLoadContext.datapackWorldgen().registryOrThrow(Registries.BIOME).size() == 0) { + } else if (dataLoadContext.datapackWorldgen().lookupOrThrow(Registries.BIOME).listElements().findAny().isEmpty()) { throw new IllegalStateException("Needs at least one biome continue"); } else { WorldCreationContext worldCreationContext = this.uiState.getSettings(); @@ -398,7 +467,7 @@ public class CreateWorldScreen extends Screen { WorldGenSettings worldGenSettings = dataResult.flatMap(jsonElement -> WorldGenSettings.CODEC.parse(dynamicOps2, jsonElement)) .getOrThrow(string -> new IllegalStateException("Error parsing worldgen settings after loading data packs: " + string)); return new WorldLoader.DataLoadOutput<>( - new CreateWorldScreen.DataPackReloadCookie(worldGenSettings, dataLoadContext.dataConfiguration()), dataLoadContext.datapackDimensions() + new DataPackReloadCookie(worldGenSettings, dataLoadContext.dataConfiguration()), dataLoadContext.datapackDimensions() ); } }, @@ -452,7 +521,7 @@ public class CreateWorldScreen extends Screen { } private void removeTempDataPackDir() { - if (this.tempDataPackDir != null) { + if (this.tempDataPackDir != null && Files.exists(this.tempDataPackDir, new LinkOption[0])) { try { Stream stream = Files.walk(this.tempDataPackDir); @@ -482,9 +551,9 @@ public class CreateWorldScreen extends Screen { } catch (IOException var6) { LOGGER.warn("Failed to list temporary dir {}", this.tempDataPackDir); } - - this.tempDataPackDir = null; } + + this.tempDataPackDir = null; } private static void copyBetweenDirs(Path fromDir, Path toDir, Path filePath) { @@ -496,51 +565,47 @@ public class CreateWorldScreen extends Screen { } } - private Optional createNewWorldDirectory() { - String string = this.uiState.getTargetFolder(); - + private static Optional createNewWorldDirectory(Minecraft minecraft, String string, @Nullable Path path) { try { - LevelStorageSource.LevelStorageAccess levelStorageAccess = this.minecraft.getLevelSource().createAccess(string); - if (this.tempDataPackDir == null) { + LevelStorageSource.LevelStorageAccess levelStorageAccess = minecraft.getLevelSource().createAccess(string); + if (path == null) { return Optional.of(levelStorageAccess); } try { - Stream stream = Files.walk(this.tempDataPackDir); + Stream stream = Files.walk(path); - Optional var5; + Optional var6; try { - Path path = levelStorageAccess.getLevelPath(LevelResource.DATAPACK_DIR); - FileUtil.createDirectoriesSafe(path); - stream.filter(pathx -> !pathx.equals(this.tempDataPackDir)).forEach(path2 -> copyBetweenDirs(this.tempDataPackDir, path, path2)); - var5 = Optional.of(levelStorageAccess); - } catch (Throwable var7) { + Path path2 = levelStorageAccess.getLevelPath(LevelResource.DATAPACK_DIR); + FileUtil.createDirectoriesSafe(path2); + stream.filter(path2x -> !path2x.equals(path)).forEach(path3 -> copyBetweenDirs(path, path2, path3)); + var6 = Optional.of(levelStorageAccess); + } catch (Throwable var8) { if (stream != null) { try { stream.close(); - } catch (Throwable var6) { - var7.addSuppressed(var6); + } catch (Throwable var7) { + var8.addSuppressed(var7); } } - throw var7; + throw var8; } if (stream != null) { stream.close(); } - return var5; - } catch (UncheckedIOException | IOException var8) { - LOGGER.warn("Failed to copy datapacks to world {}", string, var8); + return var6; + } catch (UncheckedIOException | IOException var9) { + LOGGER.warn("Failed to copy datapacks to world {}", string, var9); levelStorageAccess.close(); } - } catch (UncheckedIOException | IOException var9) { - LOGGER.warn("Failed to create access for {}", string, var9); + } catch (UncheckedIOException | IOException var10) { + LOGGER.warn("Failed to create access for {}", string, var10); } - SystemToast.onPackCopyFailure(this.minecraft, string); - this.popScreen(); return Optional.empty(); } @@ -593,7 +658,7 @@ public class CreateWorldScreen extends Screen { @Nullable private Pair getDataPackSelectionSettings(WorldDataConfiguration worldDataConfiguration) { - Path path = this.getTempDataPackDir(); + Path path = this.getOrCreateTempDataPackDir(); if (path != null) { if (this.tempDataPackRepository == null) { this.tempDataPackRepository = ServerPacksSource.createPackRepository(path, this.packValidator); @@ -607,19 +672,15 @@ public class CreateWorldScreen extends Screen { } } - @Environment(EnvType.CLIENT) - record DataPackReloadCookie(WorldGenSettings worldGenSettings, WorldDataConfiguration dataConfiguration) { - } - @Environment(EnvType.CLIENT) class GameTab extends GridLayoutTab { private static final Component TITLE = Component.translatable("createWorld.tab.game.title"); - private static final Component ALLOW_COMMANDS = Component.translatable("selectWorld.allowCommands.new"); + private static final Component ALLOW_COMMANDS = Component.translatable("selectWorld.allowCommands"); private final EditBox nameEdit; GameTab() { super(TITLE); - GridLayout.RowHelper rowHelper = this.layout.rowSpacing(8).createRowHelper(1); + RowHelper rowHelper = this.layout.rowSpacing(8).createRowHelper(1); LayoutSettings layoutSettings = rowHelper.newCellSettings(); this.nameEdit = new EditBox(CreateWorldScreen.this.font, 208, 20, Component.translatable("selectWorld.enterName")); this.nameEdit.setValue(CreateWorldScreen.this.uiState.getName()); @@ -694,7 +755,7 @@ public class CreateWorldScreen extends Screen { MoreTab() { super(TITLE); - GridLayout.RowHelper rowHelper = this.layout.rowSpacing(8).createRowHelper(1); + RowHelper rowHelper = this.layout.rowSpacing(8).createRowHelper(1); rowHelper.addChild(Button.builder(GAME_RULES_LABEL, button -> this.openGameRulesScreen()).width(210).build()); rowHelper.addChild( Button.builder( @@ -714,10 +775,15 @@ public class CreateWorldScreen extends Screen { } private void openGameRulesScreen() { - CreateWorldScreen.this.minecraft.setScreen(new EditGameRulesScreen(CreateWorldScreen.this.uiState.getGameRules().copy(), optional -> { - CreateWorldScreen.this.minecraft.setScreen(CreateWorldScreen.this); - optional.ifPresent(CreateWorldScreen.this.uiState::setGameRules); - })); + CreateWorldScreen.this.minecraft + .setScreen( + new EditGameRulesScreen( + CreateWorldScreen.this.uiState.getGameRules().copy(CreateWorldScreen.this.uiState.getSettings().dataConfiguration().enabledFeatures()), optional -> { + CreateWorldScreen.this.minecraft.setScreen(CreateWorldScreen.this); + optional.ifPresent(CreateWorldScreen.this.uiState::setGameRules); + } + ) + ); } } @@ -736,7 +802,7 @@ public class CreateWorldScreen extends Screen { WorldTab() { super(TITLE); - GridLayout.RowHelper rowHelper = this.layout.columnSpacing(10).rowSpacing(8).createRowHelper(2); + RowHelper rowHelper = this.layout.columnSpacing(10).rowSpacing(8).createRowHelper(2); CycleButton cycleButton = rowHelper.addChild( CycleButton.builder(WorldCreationUiState.WorldTypeEntry::describePreset) .withValues(this.createWorldTypeValueSupplier()) @@ -765,17 +831,12 @@ public class CreateWorldScreen extends Screen { this.customizeTypeButton = rowHelper.addChild(Button.builder(Component.translatable("selectWorld.customizeType"), button -> this.openPresetEditor()).build()); CreateWorldScreen.this.uiState .addListener(worldCreationUiState -> this.customizeTypeButton.active = !worldCreationUiState.isDebug() && worldCreationUiState.getPresetEditor() != null); - this.seedEdit = new EditBox(CreateWorldScreen.this.font, 308, 20, Component.translatable("selectWorld.enterSeed")) { - @Override - protected MutableComponent createNarrationMessage() { - return super.createNarrationMessage().append(CommonComponents.NARRATION_SEPARATOR).append(CreateWorldScreen.WorldTab.SEED_EMPTY_HINT); - } - }; + this.seedEdit = new 1(this, CreateWorldScreen.this.font, 308, 20, Component.translatable("selectWorld.enterSeed"), CreateWorldScreen.this); this.seedEdit.setHint(SEED_EMPTY_HINT); this.seedEdit.setValue(CreateWorldScreen.this.uiState.getSeed()); this.seedEdit.setResponder(string -> CreateWorldScreen.this.uiState.setSeed(this.seedEdit.getValue())); rowHelper.addChild(CommonLayouts.labeledElement(CreateWorldScreen.this.font, this.seedEdit, SEED_LABEL), 2); - SwitchGrid.Builder builder = SwitchGrid.builder(310); + Builder builder = SwitchGrid.builder(310); builder.addSwitch(GENERATE_STRUCTURES, CreateWorldScreen.this.uiState::isGenerateStructures, CreateWorldScreen.this.uiState::setGenerateStructures) .withIsActiveCondition(() -> !CreateWorldScreen.this.uiState.isDebug()) .withInfo(GENERATE_STRUCTURES_INFO); @@ -793,19 +854,7 @@ public class CreateWorldScreen extends Screen { } private CycleButton.ValueListSupplier createWorldTypeValueSupplier() { - return new CycleButton.ValueListSupplier() { - @Override - public List getSelectedList() { - return CycleButton.DEFAULT_ALT_LIST_SELECTOR.getAsBoolean() - ? CreateWorldScreen.this.uiState.getAltPresetList() - : CreateWorldScreen.this.uiState.getNormalPresetList(); - } - - @Override - public List getDefaultList() { - return CreateWorldScreen.this.uiState.getNormalPresetList(); - } - }; + return new 2(this); } private static MutableComponent createTypeButtonNarration(CycleButton button) { diff --git a/net/minecraft/client/gui/screens/worldselection/DataPackReloadCookie.java b/net/minecraft/client/gui/screens/worldselection/DataPackReloadCookie.java new file mode 100644 index 00000000..8b7f456d --- /dev/null +++ b/net/minecraft/client/gui/screens/worldselection/DataPackReloadCookie.java @@ -0,0 +1,10 @@ +package net.minecraft.client.gui.screens.worldselection; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.world.level.WorldDataConfiguration; +import net.minecraft.world.level.levelgen.WorldGenSettings; + +@Environment(EnvType.CLIENT) +public record DataPackReloadCookie(WorldGenSettings worldGenSettings, WorldDataConfiguration dataConfiguration) { +} diff --git a/net/minecraft/client/gui/screens/worldselection/EditGameRulesScreen.java b/net/minecraft/client/gui/screens/worldselection/EditGameRulesScreen.java index 00066af6..f71e0f04 100644 --- a/net/minecraft/client/gui/screens/worldselection/EditGameRulesScreen.java +++ b/net/minecraft/client/gui/screens/worldselection/EditGameRulesScreen.java @@ -4,7 +4,6 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.google.common.collect.Sets; -import com.google.common.collect.ImmutableList.Builder; import java.util.Comparator; import java.util.List; import java.util.Map; @@ -25,10 +24,8 @@ import net.minecraft.client.gui.components.events.GuiEventListener; import net.minecraft.client.gui.layouts.HeaderAndFooterLayout; import net.minecraft.client.gui.layouts.LinearLayout; import net.minecraft.client.gui.narration.NarratableEntry; -import net.minecraft.client.gui.narration.NarratedElementType; -import net.minecraft.client.gui.narration.NarrationElementOutput; import net.minecraft.client.gui.screens.Screen; -import net.minecraft.client.resources.language.I18n; +import net.minecraft.client.gui.screens.worldselection.EditGameRulesScreen.CategoryRuleEntry.1; import net.minecraft.network.chat.CommonComponents; import net.minecraft.network.chat.Component; import net.minecraft.util.FormattedCharSequence; @@ -139,17 +136,7 @@ public class EditGameRulesScreen extends Screen { @Override public List narratables() { - return ImmutableList.of(new NarratableEntry() { - @Override - public NarratableEntry.NarrationPriority narrationPriority() { - return NarratableEntry.NarrationPriority.HOVERED; - } - - @Override - public void updateNarration(NarrationElementOutput narrationElementOutput) { - narrationElementOutput.add(NarratedElementType.TITLE, CategoryRuleEntry.this.label); - } - }); + return ImmutableList.of(new 1(this)); } } @@ -240,41 +227,10 @@ public class EditGameRulesScreen extends Screen { EditGameRulesScreen.this.layout.getHeaderHeight(), 24 ); - final Map, EditGameRulesScreen.RuleEntry>> map = Maps., EditGameRulesScreen.RuleEntry>>newHashMap(); - GameRules.visitGameRuleTypes(new GameRules.GameRuleTypeVisitor() { - @Override - public void visitBoolean(GameRules.Key key, GameRules.Type type) { - this.addEntry(key, (component, list, string, booleanValue) -> EditGameRulesScreen.this.new BooleanRuleEntry(component, list, string, booleanValue)); - } - - @Override - public void visitInteger(GameRules.Key key, GameRules.Type type) { - this.addEntry(key, (component, list, string, integerValue) -> EditGameRulesScreen.this.new IntegerRuleEntry(component, list, string, integerValue)); - } - - private > void addEntry(GameRules.Key key, EditGameRulesScreen.EntryFactory factory) { - Component component = Component.translatable(key.getDescriptionId()); - Component component2 = Component.literal(key.getId()).withStyle(ChatFormatting.YELLOW); - T value = gameRules.getRule(key); - String string = value.serialize(); - Component component3 = Component.translatable("editGamerule.default", Component.literal(string)).withStyle(ChatFormatting.GRAY); - String string2 = key.getDescriptionId() + ".description"; - List list; - String string3; - if (I18n.exists(string2)) { - Builder builder = ImmutableList.builder().add(component2.getVisualOrderText()); - Component component4 = Component.translatable(string2); - EditGameRulesScreen.this.font.split(component4, 150).forEach(builder::add); - list = builder.add(component3.getVisualOrderText()).build(); - string3 = component4.getString() + "\n" + component3.getString(); - } else { - list = ImmutableList.of(component2.getVisualOrderText(), component3.getVisualOrderText()); - string3 = component3.getString(); - } - - ((Map)map.computeIfAbsent(key.getCategory(), category -> Maps.newHashMap())).put(key, factory.create(component, list, string3, value)); - } - }); + Map, EditGameRulesScreen.RuleEntry>> map = Maps., EditGameRulesScreen.RuleEntry>>newHashMap(); + gameRules.visitGameRuleTypes( + new net.minecraft.client.gui.screens.worldselection.EditGameRulesScreen.RuleList.1(this, EditGameRulesScreen.this, gameRules, map) + ); map.entrySet() .stream() .sorted(java.util.Map.Entry.comparingByKey()) diff --git a/net/minecraft/client/gui/screens/worldselection/EditWorldScreen.java b/net/minecraft/client/gui/screens/worldselection/EditWorldScreen.java index b5486d47..998adbdc 100644 --- a/net/minecraft/client/gui/screens/worldselection/EditWorldScreen.java +++ b/net/minecraft/client/gui/screens/worldselection/EditWorldScreen.java @@ -47,6 +47,7 @@ public class EditWorldScreen extends Screen { private static final Component OPTIMIZE_BUTTON = Component.translatable("selectWorld.edit.optimize"); private static final Component OPTIMIZE_TITLE = Component.translatable("optimizeWorld.confirm.title"); private static final Component OPTIMIIZE_DESCRIPTION = Component.translatable("optimizeWorld.confirm.description"); + private static final Component OPTIMIIZE_CONFIRMATION = Component.translatable("optimizeWorld.confirm.proceed"); private static final Component SAVE_BUTTON = Component.translatable("selectWorld.edit.save"); private static final int DEFAULT_WIDTH = 200; private static final int VERTICAL_SPACING = 4; @@ -101,7 +102,7 @@ public class EditWorldScreen extends Screen { } minecraft.setScreen(OptimizeWorldScreen.create(minecraft, this.callback, minecraft.getFixerUpper(), levelAccess, bl2)); - }, OPTIMIZE_TITLE, OPTIMIIZE_DESCRIPTION, true))).width(200).build()); + }, OPTIMIZE_TITLE, OPTIMIIZE_DESCRIPTION, OPTIMIIZE_CONFIRMATION, true))).width(200).build()); this.layout.addChild(new SpacerElement(200, 20)); this.layout.addChild(linearLayout); this.layout.visitWidgets(guiEventListener -> { @@ -154,12 +155,12 @@ public class EditWorldScreen extends Screen { if (iOException != null) { Component component = Component.translatable("selectWorld.edit.backupFailed"); Component component2 = Component.literal(iOException.getMessage()); - Minecraft.getInstance().getToasts().addToast(new SystemToast(SystemToast.SystemToastId.WORLD_BACKUP, component, component2)); + Minecraft.getInstance().getToastManager().addToast(new SystemToast(SystemToast.SystemToastId.WORLD_BACKUP, component, component2)); return false; } else { Component component = Component.translatable("selectWorld.edit.backupCreated", levelAccess.getLevelId()); Component component2 = Component.translatable("selectWorld.edit.backupSize", Mth.ceil(l / 1048576.0)); - Minecraft.getInstance().getToasts().addToast(new SystemToast(SystemToast.SystemToastId.WORLD_BACKUP, component, component2)); + Minecraft.getInstance().getToastManager().addToast(new SystemToast(SystemToast.SystemToastId.WORLD_BACKUP, component, component2)); return true; } } diff --git a/net/minecraft/client/gui/screens/worldselection/ExperimentsScreen.java b/net/minecraft/client/gui/screens/worldselection/ExperimentsScreen.java index d887f986..2419ff38 100644 --- a/net/minecraft/client/gui/screens/worldselection/ExperimentsScreen.java +++ b/net/minecraft/client/gui/screens/worldselection/ExperimentsScreen.java @@ -15,6 +15,7 @@ import net.minecraft.client.gui.components.MultiLineTextWidget; import net.minecraft.client.gui.layouts.HeaderAndFooterLayout; import net.minecraft.client.gui.layouts.LinearLayout; import net.minecraft.client.gui.screens.Screen; +import net.minecraft.client.gui.screens.worldselection.SwitchGrid.Builder; import net.minecraft.client.resources.language.I18n; import net.minecraft.network.chat.CommonComponents; import net.minecraft.network.chat.Component; @@ -51,7 +52,7 @@ public class ExperimentsScreen extends Screen { this.layout.addTitleHeader(TITLE, this.font); LinearLayout linearLayout = this.layout.addToContents(LinearLayout.vertical()); linearLayout.addChild(new MultiLineTextWidget(INFO, this.font).setMaxWidth(310), layoutSettings -> layoutSettings.paddingBottom(15)); - SwitchGrid.Builder builder = SwitchGrid.builder(310).withInfoUnderneath(2, true).withRowSpacing(4); + Builder builder = SwitchGrid.builder(310).withInfoUnderneath(2, true).withRowSpacing(4); this.packs .forEach( (pack, boolean_) -> builder.addSwitch( diff --git a/net/minecraft/client/gui/screens/worldselection/InitialWorldCreationOptions.java b/net/minecraft/client/gui/screens/worldselection/InitialWorldCreationOptions.java new file mode 100644 index 00000000..eeaf5216 --- /dev/null +++ b/net/minecraft/client/gui/screens/worldselection/InitialWorldCreationOptions.java @@ -0,0 +1,17 @@ +package net.minecraft.client.gui.screens.worldselection; + +import java.util.Set; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.resources.ResourceKey; +import net.minecraft.world.level.GameRules; +import net.minecraft.world.level.levelgen.flat.FlatLevelGeneratorPreset; +import org.jetbrains.annotations.Nullable; + +@Environment(EnvType.CLIENT) +public record InitialWorldCreationOptions( + WorldCreationUiState.SelectedGameMode selectedGameMode, + Set> disabledGameRules, + @Nullable ResourceKey flatLevelPreset +) { +} diff --git a/net/minecraft/client/gui/screens/worldselection/OptimizeWorldScreen.java b/net/minecraft/client/gui/screens/worldselection/OptimizeWorldScreen.java index 29c46d11..b2cad3a0 100644 --- a/net/minecraft/client/gui/screens/worldselection/OptimizeWorldScreen.java +++ b/net/minecraft/client/gui/screens/worldselection/OptimizeWorldScreen.java @@ -100,6 +100,7 @@ public class OptimizeWorldScreen extends Screen { @Override public void removed() { this.upgrader.cancel(); + this.upgrader.close(); } @Override diff --git a/net/minecraft/client/gui/screens/worldselection/PresetEditor.java b/net/minecraft/client/gui/screens/worldselection/PresetEditor.java index 0da2e4d6..c9bcb3d4 100644 --- a/net/minecraft/client/gui/screens/worldselection/PresetEditor.java +++ b/net/minecraft/client/gui/screens/worldselection/PresetEditor.java @@ -52,7 +52,7 @@ public interface PresetEditor { Screen createEditScreen(CreateWorldScreen createWorldScreen, WorldCreationContext worldCreationContext); - private static WorldCreationContext.DimensionsUpdater flatWorldConfigurator(FlatLevelGeneratorSettings settings) { + static WorldCreationContext.DimensionsUpdater flatWorldConfigurator(FlatLevelGeneratorSettings settings) { return (frozen, worldDimensions) -> { ChunkGenerator chunkGenerator = new FlatLevelSource(settings); return worldDimensions.replaceOverworldGenerator(frozen, chunkGenerator); @@ -61,8 +61,8 @@ public interface PresetEditor { private static WorldCreationContext.DimensionsUpdater fixedBiomeConfigurator(Holder biome) { return (frozen, worldDimensions) -> { - Registry registry = frozen.registryOrThrow(Registries.NOISE_SETTINGS); - Holder holder2 = registry.getHolderOrThrow(NoiseGeneratorSettings.OVERWORLD); + Registry registry = frozen.lookupOrThrow(Registries.NOISE_SETTINGS); + Holder holder2 = registry.getOrThrow(NoiseGeneratorSettings.OVERWORLD); BiomeSource biomeSource = new FixedBiomeSource(biome); ChunkGenerator chunkGenerator = new NoiseBasedChunkGenerator(biomeSource, holder2); return worldDimensions.replaceOverworldGenerator(frozen, chunkGenerator); diff --git a/net/minecraft/client/gui/screens/worldselection/WorldCreationContext.java b/net/minecraft/client/gui/screens/worldselection/WorldCreationContext.java index 65862885..866c8b7b 100644 --- a/net/minecraft/client/gui/screens/worldselection/WorldCreationContext.java +++ b/net/minecraft/client/gui/screens/worldselection/WorldCreationContext.java @@ -1,5 +1,6 @@ package net.minecraft.client.gui.screens.worldselection; +import java.util.Set; import java.util.function.BiFunction; import java.util.function.UnaryOperator; import net.fabricmc.api.EnvType; @@ -23,7 +24,8 @@ public record WorldCreationContext( WorldDimensions selectedDimensions, LayeredRegistryAccess worldgenRegistries, ReloadableServerResources dataPackResources, - WorldDataConfiguration dataConfiguration + WorldDataConfiguration dataConfiguration, + InitialWorldCreationOptions initialWorldCreationOptions ) { public WorldCreationContext( WorldGenSettings worldGenSettings, @@ -31,28 +33,45 @@ public record WorldCreationContext( ReloadableServerResources dataPackResources, WorldDataConfiguration dataConfiguration ) { - this(worldGenSettings.options(), worldGenSettings.dimensions(), worldGenRegistries, dataPackResources, dataConfiguration); + this( + worldGenSettings.options(), + worldGenSettings.dimensions(), + worldGenRegistries, + dataPackResources, + dataConfiguration, + new InitialWorldCreationOptions(WorldCreationUiState.SelectedGameMode.SURVIVAL, Set.of(), null) + ); } public WorldCreationContext( - WorldOptions options, - WorldDimensions selectedDimensions, - LayeredRegistryAccess worldGenRegistries, - ReloadableServerResources dataPackResources, - WorldDataConfiguration dataConfiguration + WorldOptions worldOptions, + WorldDimensions worldDimensions, + LayeredRegistryAccess layeredRegistryAccess, + ReloadableServerResources reloadableServerResources, + WorldDataConfiguration worldDataConfiguration, + InitialWorldCreationOptions initialWorldCreationOptions ) { this( - options, - worldGenRegistries.getLayer(RegistryLayer.DIMENSIONS).registryOrThrow(Registries.LEVEL_STEM), - selectedDimensions, - worldGenRegistries.replaceFrom(RegistryLayer.DIMENSIONS), - dataPackResources, - dataConfiguration + worldOptions, + layeredRegistryAccess.getLayer(RegistryLayer.DIMENSIONS).lookupOrThrow(Registries.LEVEL_STEM), + worldDimensions, + layeredRegistryAccess.replaceFrom(RegistryLayer.DIMENSIONS), + reloadableServerResources, + worldDataConfiguration, + initialWorldCreationOptions ); } public WorldCreationContext withSettings(WorldOptions options, WorldDimensions selectedDimensions) { - return new WorldCreationContext(options, this.datapackDimensions, selectedDimensions, this.worldgenRegistries, this.dataPackResources, this.dataConfiguration); + return new WorldCreationContext( + options, + this.datapackDimensions, + selectedDimensions, + this.worldgenRegistries, + this.dataPackResources, + this.dataConfiguration, + this.initialWorldCreationOptions + ); } public WorldCreationContext withOptions(WorldCreationContext.OptionsModifier optionsModifier) { @@ -62,7 +81,8 @@ public record WorldCreationContext( this.selectedDimensions, this.worldgenRegistries, this.dataPackResources, - this.dataConfiguration + this.dataConfiguration, + this.initialWorldCreationOptions ); } @@ -73,7 +93,8 @@ public record WorldCreationContext( (WorldDimensions)dimensionsUpdater.apply(this.worldgenLoadContext(), this.selectedDimensions), this.worldgenRegistries, this.dataPackResources, - this.dataConfiguration + this.dataConfiguration, + this.initialWorldCreationOptions ); } diff --git a/net/minecraft/client/gui/screens/worldselection/WorldCreationContextMapper.java b/net/minecraft/client/gui/screens/worldselection/WorldCreationContextMapper.java new file mode 100644 index 00000000..c65ef292 --- /dev/null +++ b/net/minecraft/client/gui/screens/worldselection/WorldCreationContextMapper.java @@ -0,0 +1,15 @@ +package net.minecraft.client.gui.screens.worldselection; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.core.LayeredRegistryAccess; +import net.minecraft.server.RegistryLayer; +import net.minecraft.server.ReloadableServerResources; + +@FunctionalInterface +@Environment(EnvType.CLIENT) +public interface WorldCreationContextMapper { + WorldCreationContext apply( + ReloadableServerResources reloadableServerResources, LayeredRegistryAccess layeredRegistryAccess, DataPackReloadCookie dataPackReloadCookie + ); +} diff --git a/net/minecraft/client/gui/screens/worldselection/WorldCreationUiState.java b/net/minecraft/client/gui/screens/worldselection/WorldCreationUiState.java index fd9618e6..88d39a2a 100644 --- a/net/minecraft/client/gui/screens/worldselection/WorldCreationUiState.java +++ b/net/minecraft/client/gui/screens/worldselection/WorldCreationUiState.java @@ -23,6 +23,7 @@ import net.minecraft.world.level.GameRules; import net.minecraft.world.level.GameType; import net.minecraft.world.level.WorldDataConfiguration; import net.minecraft.world.level.levelgen.WorldOptions; +import net.minecraft.world.level.levelgen.flat.FlatLevelGeneratorPreset; import net.minecraft.world.level.levelgen.presets.WorldPreset; import net.minecraft.world.level.levelgen.presets.WorldPresets; import org.jetbrains.annotations.Nullable; @@ -45,7 +46,7 @@ public class WorldCreationUiState { private WorldCreationUiState.WorldTypeEntry worldType; private final List normalPresetList = new ArrayList(); private final List altPresetList = new ArrayList(); - private GameRules gameRules = new GameRules(); + private GameRules gameRules; public WorldCreationUiState(Path savesFolder, WorldCreationContext settings, Optional> preset, OptionalLong seed) { this.savesFolder = savesFolder; @@ -56,6 +57,13 @@ public class WorldCreationUiState { this.generateStructures = settings.options().generateStructures(); this.bonusChest = settings.options().generateBonusChest(); this.targetFolder = this.findResultFolder(this.name); + this.gameMode = settings.initialWorldCreationOptions().selectedGameMode(); + this.gameRules = new GameRules(settings.dataConfiguration().enabledFeatures()); + settings.initialWorldCreationOptions().disabledGameRules().forEach(key -> this.gameRules.getRule(key).set(false, null)); + Optional.ofNullable(settings.initialWorldCreationOptions().flatLevelPreset()) + .flatMap(resourceKey -> settings.worldgenLoadContext().lookup(Registries.FLAT_LEVEL_GENERATOR_PRESET).flatMap(registry -> registry.get(resourceKey))) + .map(reference -> ((FlatLevelGeneratorPreset)reference.value()).settings()) + .ifPresent(flatLevelGeneratorSettings -> this.updateDimensions(PresetEditor.flatWorldConfigurator(flatLevelGeneratorSettings))); } public void addListener(Consumer listener) { @@ -196,7 +204,8 @@ public class WorldCreationUiState { this.settings.selectedDimensions(), this.settings.worldgenRegistries(), this.settings.dataPackResources(), - worldDataConfiguration + worldDataConfiguration, + this.settings.initialWorldCreationOptions() ); return true; } else { @@ -235,28 +244,35 @@ public class WorldCreationUiState { } private void updatePresetLists() { - Registry registry = this.getSettings().worldgenLoadContext().registryOrThrow(Registries.WORLD_PRESET); + Registry registry = this.getSettings().worldgenLoadContext().lookupOrThrow(Registries.WORLD_PRESET); this.normalPresetList.clear(); this.normalPresetList .addAll( - (Collection)getNonEmptyList(registry, WorldPresetTags.NORMAL).orElseGet(() -> registry.holders().map(WorldCreationUiState.WorldTypeEntry::new).toList()) + (Collection)getNonEmptyList(registry, WorldPresetTags.NORMAL) + .orElseGet(() -> registry.listElements().map(WorldCreationUiState.WorldTypeEntry::new).toList()) ); this.altPresetList.clear(); this.altPresetList.addAll((Collection)getNonEmptyList(registry, WorldPresetTags.EXTENDED).orElse(this.normalPresetList)); Holder holder = this.worldType.preset(); if (holder != null) { - this.worldType = (WorldCreationUiState.WorldTypeEntry)findPreset(this.getSettings(), holder.unwrapKey()) + WorldCreationUiState.WorldTypeEntry worldTypeEntry = (WorldCreationUiState.WorldTypeEntry)findPreset(this.getSettings(), holder.unwrapKey()) .map(WorldCreationUiState.WorldTypeEntry::new) - .orElse((WorldCreationUiState.WorldTypeEntry)this.normalPresetList.get(0)); + .orElse((WorldCreationUiState.WorldTypeEntry)this.normalPresetList.getFirst()); + boolean bl = PresetEditor.EDITORS.get(holder.unwrapKey()) != null; + if (bl) { + this.worldType = worldTypeEntry; + } else { + this.setWorldType(worldTypeEntry); + } } } private static Optional> findPreset(WorldCreationContext context, Optional> preset) { - return preset.flatMap(resourceKey -> context.worldgenLoadContext().registryOrThrow(Registries.WORLD_PRESET).getHolder(resourceKey)); + return preset.flatMap(resourceKey -> context.worldgenLoadContext().lookupOrThrow(Registries.WORLD_PRESET).get(resourceKey)); } private static Optional> getNonEmptyList(Registry registry, TagKey key) { - return registry.getTag(key).map(named -> named.stream().map(WorldCreationUiState.WorldTypeEntry::new).toList()).filter(list -> !list.isEmpty()); + return registry.get(key).map(named -> named.stream().map(WorldCreationUiState.WorldTypeEntry::new).toList()).filter(list -> !list.isEmpty()); } public void setGameRules(GameRules gameRules) { diff --git a/net/minecraft/client/gui/screens/worldselection/WorldOpenFlows.java b/net/minecraft/client/gui/screens/worldselection/WorldOpenFlows.java index 9751fc49..5c15bc4f 100644 --- a/net/minecraft/client/gui/screens/worldselection/WorldOpenFlows.java +++ b/net/minecraft/client/gui/screens/worldselection/WorldOpenFlows.java @@ -9,6 +9,7 @@ import java.io.IOException; import java.nio.file.Files; import java.nio.file.LinkOption; import java.nio.file.Path; +import java.util.Set; import java.util.UUID; import java.util.concurrent.CompletableFuture; import java.util.function.Function; @@ -32,10 +33,10 @@ import net.minecraft.client.gui.screens.RecoverWorldDataScreen; import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.resources.server.DownloadedPackSource; import net.minecraft.commands.Commands; +import net.minecraft.core.HolderLookup; import net.minecraft.core.LayeredRegistryAccess; import net.minecraft.core.MappedRegistry; import net.minecraft.core.Registry; -import net.minecraft.core.RegistryAccess; import net.minecraft.core.registries.Registries; import net.minecraft.nbt.NbtException; import net.minecraft.nbt.ReportedNbtException; @@ -61,6 +62,7 @@ import net.minecraft.world.level.storage.LevelStorageSource; import net.minecraft.world.level.storage.LevelSummary; import net.minecraft.world.level.storage.PrimaryLevelData; import net.minecraft.world.level.storage.WorldData; +import net.minecraft.world.level.storage.LevelSummary.BackupStatus; import net.minecraft.world.level.validation.ContentValidationException; import org.jetbrains.annotations.Nullable; import org.slf4j.Logger; @@ -78,7 +80,7 @@ public class WorldOpenFlows { } public void createFreshLevel( - String levelName, LevelSettings levelSettings, WorldOptions worldOptions, Function dimensionGetter, Screen lastScreen + String levelName, LevelSettings levelSettings, WorldOptions worldOptions, Function dimensionGetter, Screen lastScreen ) { this.minecraft.forceSetScreen(new GenericMessageScreen(Component.translatable("selectWorld.data_read"))); LevelStorageSource.LevelStorageAccess levelStorageAccess = this.createWorldAccess(levelName); @@ -92,7 +94,7 @@ public class WorldOpenFlows { packConfig, dataLoadContext -> { WorldDimensions.Complete complete = ((WorldDimensions)dimensionGetter.apply(dataLoadContext.datapackWorldgen())) - .bake(dataLoadContext.datapackDimensions().registryOrThrow(Registries.LEVEL_STEM)); + .bake(dataLoadContext.datapackDimensions().lookupOrThrow(Registries.LEVEL_STEM)); return new WorldLoader.DataLoadOutput<>( new PrimaryLevelData(levelSettings, worldOptions, complete.specialWorldProperty(), complete.lifecycle()), complete.dimensionsRegistryAccess() ); @@ -139,7 +141,7 @@ public class WorldOpenFlows { return this.loadWorldDataBlocking( packConfig, dataLoadContext -> { - Registry registry = dataLoadContext.datapackDimensions().registryOrThrow(Registries.LEVEL_STEM); + Registry registry = dataLoadContext.datapackDimensions().lookupOrThrow(Registries.LEVEL_STEM); LevelDataAndDimensions levelDataAndDimensions = LevelStorageSource.getLevelDataAndDimensions( dynamic, dataLoadContext.dataConfiguration(), registry, dataLoadContext.datapackWorldgen() ); @@ -176,10 +178,16 @@ public class WorldOpenFlows { }, (closeableResourceManager, reloadableServerResources, layeredRegistryAccess, arg) -> { closeableResourceManager.close(); + InitialWorldCreationOptions initialWorldCreationOptions = new InitialWorldCreationOptions(WorldCreationUiState.SelectedGameMode.SURVIVAL, Set.of(), null); return Pair.of( arg.levelSettings, new WorldCreationContext( - arg.options, new WorldDimensions(arg.existingDimensions), layeredRegistryAccess, reloadableServerResources, arg.levelSettings.getDataConfiguration() + arg.options, + new WorldDimensions(arg.existingDimensions), + layeredRegistryAccess, + reloadableServerResources, + arg.levelSettings.getDataConfiguration(), + initialWorldCreationOptions ) ); } @@ -268,7 +276,6 @@ public class WorldOpenFlows { return; } catch (OutOfMemoryError var11) { MemoryReserve.release(); - System.gc(); String string = "Ran out of memory trying to read level data of world folder \"" + levelStorage.getLevelId() + "\""; LOGGER.error(LogUtils.FATAL_MARKER, string); OutOfMemoryError outOfMemoryError2 = new OutOfMemoryError("Ran out of memory reading level data"); @@ -296,7 +303,7 @@ public class WorldOpenFlows { ) ); } else { - LevelSummary.BackupStatus backupStatus = levelSummary.backupStatus(); + BackupStatus backupStatus = levelSummary.backupStatus(); if (backupStatus.shouldBackup()) { String string = "selectWorld.backupQuestion." + backupStatus.getTranslationKey(); String string2 = "selectWorld.backupWarning." + backupStatus.getTranslationKey(); @@ -330,7 +337,7 @@ public class WorldOpenFlows { try { worldStem = this.loadWorldStem(levelData, safeMode, packRepository); - for (LevelStem levelStem : worldStem.registries().compositeAccess().registryOrThrow(Registries.LEVEL_STEM)) { + for (LevelStem levelStem : worldStem.registries().compositeAccess().lookupOrThrow(Registries.LEVEL_STEM)) { levelStem.generator().validate(); } } catch (Exception var9) { diff --git a/net/minecraft/client/gui/screens/worldselection/WorldSelectionList.java b/net/minecraft/client/gui/screens/worldselection/WorldSelectionList.java index b4e803a7..a41d09db 100644 --- a/net/minecraft/client/gui/screens/worldselection/WorldSelectionList.java +++ b/net/minecraft/client/gui/screens/worldselection/WorldSelectionList.java @@ -2,7 +2,6 @@ package net.minecraft.client.gui.screens.worldselection; import com.google.common.collect.ImmutableList; import com.mojang.blaze3d.platform.NativeImage; -import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.datafixers.util.Pair; import com.mojang.logging.LogUtils; import java.io.IOException; @@ -44,6 +43,7 @@ import net.minecraft.client.gui.screens.LoadingDotsText; import net.minecraft.client.gui.screens.NoticeWithLinkScreen; import net.minecraft.client.gui.screens.ProgressScreen; import net.minecraft.client.gui.screens.Screen; +import net.minecraft.client.renderer.RenderType; import net.minecraft.client.resources.language.I18n; import net.minecraft.client.resources.sounds.SimpleSoundInstance; import net.minecraft.nbt.NbtException; @@ -57,6 +57,8 @@ import net.minecraft.world.level.storage.LevelResource; import net.minecraft.world.level.storage.LevelStorageException; import net.minecraft.world.level.storage.LevelStorageSource; import net.minecraft.world.level.storage.LevelSummary; +import net.minecraft.world.level.storage.LevelSummary.CorruptedLevelSummary; +import net.minecraft.world.level.storage.LevelSummary.SymlinkLevelSummary; import net.minecraft.world.level.validation.ContentValidationException; import net.minecraft.world.level.validation.ForbiddenSymlinkInfo; import org.apache.commons.lang3.StringUtils; @@ -284,7 +286,7 @@ public class WorldSelectionList extends ObjectSelectionList this.minecraft.setScreen(this.screen))); } else { this.minecraft.createWorldOpenFlows().openWorld(this.summary.getLevelId(), () -> { diff --git a/net/minecraft/client/gui/spectator/PlayerMenuItem.java b/net/minecraft/client/gui/spectator/PlayerMenuItem.java index 2aef3836..fa13374e 100644 --- a/net/minecraft/client/gui/spectator/PlayerMenuItem.java +++ b/net/minecraft/client/gui/spectator/PlayerMenuItem.java @@ -10,6 +10,7 @@ import net.minecraft.client.gui.components.PlayerFaceRenderer; import net.minecraft.client.resources.PlayerSkin; import net.minecraft.network.chat.Component; import net.minecraft.network.protocol.game.ServerboundTeleportToEntityPacket; +import net.minecraft.util.ARGB; @Environment(EnvType.CLIENT) public class PlayerMenuItem implements SpectatorMenuItem { @@ -34,10 +35,8 @@ public class PlayerMenuItem implements SpectatorMenuItem { } @Override - public void renderIcon(GuiGraphics guiGraphics, float shadeColor, int alpha) { - guiGraphics.setColor(1.0F, 1.0F, 1.0F, alpha / 255.0F); - PlayerFaceRenderer.draw(guiGraphics, (PlayerSkin)this.skin.get(), 2, 2, 12); - guiGraphics.setColor(1.0F, 1.0F, 1.0F, 1.0F); + public void renderIcon(GuiGraphics guiGraphics, float f, float g) { + PlayerFaceRenderer.draw(guiGraphics, (PlayerSkin)this.skin.get(), 2, 2, 12, ARGB.white(g)); } @Override diff --git a/net/minecraft/client/gui/spectator/SpectatorMenu.java b/net/minecraft/client/gui/spectator/SpectatorMenu.java index f65f00bc..b3e75afa 100644 --- a/net/minecraft/client/gui/spectator/SpectatorMenu.java +++ b/net/minecraft/client/gui/spectator/SpectatorMenu.java @@ -7,9 +7,11 @@ import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.spectator.categories.SpectatorPage; +import net.minecraft.client.renderer.RenderType; import net.minecraft.network.chat.CommonComponents; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.ARGB; @Environment(EnvType.CLIENT) public class SpectatorMenu { @@ -35,7 +37,7 @@ public class SpectatorMenu { } @Override - public void renderIcon(GuiGraphics guiGraphics, float shadeColor, int alpha) { + public void renderIcon(GuiGraphics guiGraphics, float f, float g) { } @Override @@ -126,8 +128,8 @@ public class SpectatorMenu { } @Override - public void renderIcon(GuiGraphics guiGraphics, float shadeColor, int alpha) { - guiGraphics.blitSprite(SpectatorMenu.CLOSE_SPRITE, 0, 0, 16, 16); + public void renderIcon(GuiGraphics guiGraphics, float f, float g) { + guiGraphics.blitSprite(RenderType::guiTextured, SpectatorMenu.CLOSE_SPRITE, 0, 0, 16, 16, ARGB.colorFromFloat(g, f, f, f)); } @Override @@ -157,11 +159,12 @@ public class SpectatorMenu { } @Override - public void renderIcon(GuiGraphics guiGraphics, float shadeColor, int alpha) { + public void renderIcon(GuiGraphics guiGraphics, float f, float g) { + int i = ARGB.colorFromFloat(g, f, f, f); if (this.direction < 0) { - guiGraphics.blitSprite(SpectatorMenu.SCROLL_LEFT_SPRITE, 0, 0, 16, 16); + guiGraphics.blitSprite(RenderType::guiTextured, SpectatorMenu.SCROLL_LEFT_SPRITE, 0, 0, 16, 16, i); } else { - guiGraphics.blitSprite(SpectatorMenu.SCROLL_RIGHT_SPRITE, 0, 0, 16, 16); + guiGraphics.blitSprite(RenderType::guiTextured, SpectatorMenu.SCROLL_RIGHT_SPRITE, 0, 0, 16, 16, i); } } diff --git a/net/minecraft/client/gui/spectator/SpectatorMenuItem.java b/net/minecraft/client/gui/spectator/SpectatorMenuItem.java index 724a7e3e..6c1a5467 100644 --- a/net/minecraft/client/gui/spectator/SpectatorMenuItem.java +++ b/net/minecraft/client/gui/spectator/SpectatorMenuItem.java @@ -11,7 +11,7 @@ public interface SpectatorMenuItem { Component getName(); - void renderIcon(GuiGraphics guiGraphics, float shadeColor, int alpha); + void renderIcon(GuiGraphics guiGraphics, float f, float g); boolean isEnabled(); } diff --git a/net/minecraft/client/gui/spectator/categories/TeleportToPlayerMenuCategory.java b/net/minecraft/client/gui/spectator/categories/TeleportToPlayerMenuCategory.java index dd448c0e..dd9404a1 100644 --- a/net/minecraft/client/gui/spectator/categories/TeleportToPlayerMenuCategory.java +++ b/net/minecraft/client/gui/spectator/categories/TeleportToPlayerMenuCategory.java @@ -12,8 +12,10 @@ import net.minecraft.client.gui.spectator.SpectatorMenu; import net.minecraft.client.gui.spectator.SpectatorMenuCategory; import net.minecraft.client.gui.spectator.SpectatorMenuItem; import net.minecraft.client.multiplayer.PlayerInfo; +import net.minecraft.client.renderer.RenderType; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.ARGB; import net.minecraft.world.level.GameType; @Environment(EnvType.CLIENT) @@ -57,8 +59,8 @@ public class TeleportToPlayerMenuCategory implements SpectatorMenuCategory, Spec } @Override - public void renderIcon(GuiGraphics guiGraphics, float shadeColor, int alpha) { - guiGraphics.blitSprite(TELEPORT_TO_PLAYER_SPRITE, 0, 0, 16, 16); + public void renderIcon(GuiGraphics guiGraphics, float f, float g) { + guiGraphics.blitSprite(RenderType::guiTextured, TELEPORT_TO_PLAYER_SPRITE, 0, 0, 16, 16, ARGB.colorFromFloat(g, f, f, f)); } @Override diff --git a/net/minecraft/client/gui/spectator/categories/TeleportToTeamMenuCategory.java b/net/minecraft/client/gui/spectator/categories/TeleportToTeamMenuCategory.java index ab5ab9c2..d5849a05 100644 --- a/net/minecraft/client/gui/spectator/categories/TeleportToTeamMenuCategory.java +++ b/net/minecraft/client/gui/spectator/categories/TeleportToTeamMenuCategory.java @@ -14,10 +14,11 @@ import net.minecraft.client.gui.spectator.SpectatorMenu; import net.minecraft.client.gui.spectator.SpectatorMenuCategory; import net.minecraft.client.gui.spectator.SpectatorMenuItem; import net.minecraft.client.multiplayer.PlayerInfo; +import net.minecraft.client.renderer.RenderType; import net.minecraft.client.resources.PlayerSkin; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; -import net.minecraft.util.Mth; +import net.minecraft.util.ARGB; import net.minecraft.util.RandomSource; import net.minecraft.world.level.GameType; import net.minecraft.world.scores.PlayerTeam; @@ -63,8 +64,8 @@ public class TeleportToTeamMenuCategory implements SpectatorMenuCategory, Specta } @Override - public void renderIcon(GuiGraphics guiGraphics, float shadeColor, int alpha) { - guiGraphics.blitSprite(TELEPORT_TO_TEAM_SPRITE, 0, 0, 16, 16); + public void renderIcon(GuiGraphics guiGraphics, float f, float g) { + guiGraphics.blitSprite(RenderType::guiTextured, TELEPORT_TO_TEAM_SPRITE, 0, 0, 16, 16, ARGB.colorFromFloat(g, f, f, f)); } @Override @@ -114,18 +115,16 @@ public class TeleportToTeamMenuCategory implements SpectatorMenuCategory, Specta } @Override - public void renderIcon(GuiGraphics guiGraphics, float shadeColor, int alpha) { + public void renderIcon(GuiGraphics guiGraphics, float f, float g) { Integer integer = this.team.getColor().getColor(); if (integer != null) { - float f = (integer >> 16 & 0xFF) / 255.0F; - float g = (integer >> 8 & 0xFF) / 255.0F; - float h = (integer & 0xFF) / 255.0F; - guiGraphics.fill(1, 1, 15, 15, Mth.color(f * shadeColor, g * shadeColor, h * shadeColor) | alpha << 24); + float h = (integer >> 16 & 0xFF) / 255.0F; + float i = (integer >> 8 & 0xFF) / 255.0F; + float j = (integer & 0xFF) / 255.0F; + guiGraphics.fill(1, 1, 15, 15, ARGB.colorFromFloat(g, h * f, i * f, j * f)); } - guiGraphics.setColor(shadeColor, shadeColor, shadeColor, alpha / 255.0F); - PlayerFaceRenderer.draw(guiGraphics, (PlayerSkin)this.iconSkin.get(), 2, 2, 12); - guiGraphics.setColor(1.0F, 1.0F, 1.0F, 1.0F); + PlayerFaceRenderer.draw(guiGraphics, (PlayerSkin)this.iconSkin.get(), 2, 2, 12, ARGB.colorFromFloat(g, f, f, f)); } @Override diff --git a/net/minecraft/client/main/GameConfig.java b/net/minecraft/client/main/GameConfig.java index fbadb7f7..4a0d0f03 100644 --- a/net/minecraft/client/main/GameConfig.java +++ b/net/minecraft/client/main/GameConfig.java @@ -55,13 +55,15 @@ public class GameConfig { public final String versionType; public final boolean disableMultiplayer; public final boolean disableChat; + public final boolean captureTracyImages; - public GameData(boolean demo, String launchVersion, String versionType, boolean disableMultiplayer, boolean disableChat) { - this.demo = demo; - this.launchVersion = launchVersion; - this.versionType = versionType; - this.disableMultiplayer = disableMultiplayer; - this.disableChat = disableChat; + public GameData(boolean bl, String string, String string2, boolean bl2, boolean bl3, boolean bl4) { + this.demo = bl; + this.launchVersion = string; + this.versionType = string2; + this.disableMultiplayer = bl2; + this.disableChat = bl3; + this.captureTracyImages = bl4; } } diff --git a/net/minecraft/client/main/Main.java b/net/minecraft/client/main/Main.java index 7beb7891..80307a53 100644 --- a/net/minecraft/client/main/Main.java +++ b/net/minecraft/client/main/Main.java @@ -6,9 +6,11 @@ import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.mojang.authlib.properties.PropertyMap; import com.mojang.authlib.properties.PropertyMap.Serializer; +import com.mojang.blaze3d.TracyBootstrap; import com.mojang.blaze3d.platform.DisplayData; import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.BufferUploader; +import com.mojang.jtracy.TracyClient; import com.mojang.logging.LogUtils; import com.mojang.util.UndashedUuid; import java.io.File; @@ -16,7 +18,6 @@ import java.net.Authenticator; import java.net.InetSocketAddress; import java.net.PasswordAuthentication; import java.net.Proxy; -import java.net.Proxy.Type; import java.util.List; import java.util.Optional; import java.util.OptionalInt; @@ -35,6 +36,7 @@ import net.minecraft.SharedConstants; import net.minecraft.Util; import net.minecraft.client.Minecraft; import net.minecraft.client.User; +import net.minecraft.client.User.Type; import net.minecraft.client.server.IntegratedServer; import net.minecraft.client.telemetry.TelemetryProperty; import net.minecraft.client.telemetry.events.GameLoadTimesEvent; @@ -62,36 +64,38 @@ public class Main { optionParser.accepts("fullscreen"); optionParser.accepts("checkGlErrors"); OptionSpec optionSpec = optionParser.accepts("jfrProfile"); - OptionSpec optionSpec2 = optionParser.accepts("quickPlayPath").withRequiredArg(); - OptionSpec optionSpec3 = optionParser.accepts("quickPlaySingleplayer").withRequiredArg(); - OptionSpec optionSpec4 = optionParser.accepts("quickPlayMultiplayer").withRequiredArg(); - OptionSpec optionSpec5 = optionParser.accepts("quickPlayRealms").withRequiredArg(); - OptionSpec optionSpec6 = optionParser.accepts("gameDir").withRequiredArg().ofType(File.class).defaultsTo(new File(".")); - OptionSpec optionSpec7 = optionParser.accepts("assetsDir").withRequiredArg().ofType(File.class); - OptionSpec optionSpec8 = optionParser.accepts("resourcePackDir").withRequiredArg().ofType(File.class); - OptionSpec optionSpec9 = optionParser.accepts("proxyHost").withRequiredArg(); - OptionSpec optionSpec10 = optionParser.accepts("proxyPort").withRequiredArg().defaultsTo("8080").ofType(Integer.class); - OptionSpec optionSpec11 = optionParser.accepts("proxyUser").withRequiredArg(); - OptionSpec optionSpec12 = optionParser.accepts("proxyPass").withRequiredArg(); - OptionSpec optionSpec13 = optionParser.accepts("username").withRequiredArg().defaultsTo("Player" + System.currentTimeMillis() % 1000L); - OptionSpec optionSpec14 = optionParser.accepts("uuid").withRequiredArg(); - OptionSpec optionSpec15 = optionParser.accepts("xuid").withOptionalArg().defaultsTo(""); - OptionSpec optionSpec16 = optionParser.accepts("clientId").withOptionalArg().defaultsTo(""); - OptionSpec optionSpec17 = optionParser.accepts("accessToken").withRequiredArg().required(); - OptionSpec optionSpec18 = optionParser.accepts("version").withRequiredArg().required(); - OptionSpec optionSpec19 = optionParser.accepts("width").withRequiredArg().ofType(Integer.class).defaultsTo(854); - OptionSpec optionSpec20 = optionParser.accepts("height").withRequiredArg().ofType(Integer.class).defaultsTo(480); - OptionSpec optionSpec21 = optionParser.accepts("fullscreenWidth").withRequiredArg().ofType(Integer.class); - OptionSpec optionSpec22 = optionParser.accepts("fullscreenHeight").withRequiredArg().ofType(Integer.class); - OptionSpec optionSpec23 = optionParser.accepts("userProperties").withRequiredArg().defaultsTo("{}"); - OptionSpec optionSpec24 = optionParser.accepts("profileProperties").withRequiredArg().defaultsTo("{}"); - OptionSpec optionSpec25 = optionParser.accepts("assetIndex").withRequiredArg(); - OptionSpec optionSpec26 = optionParser.accepts("userType").withRequiredArg().defaultsTo("legacy"); - OptionSpec optionSpec27 = optionParser.accepts("versionType").withRequiredArg().defaultsTo("release"); - OptionSpec optionSpec28 = optionParser.nonOptions(); + OptionSpec optionSpec2 = optionParser.accepts("tracy"); + OptionSpec optionSpec3 = optionParser.accepts("tracyNoImages"); + OptionSpec optionSpec4 = optionParser.accepts("quickPlayPath").withRequiredArg(); + OptionSpec optionSpec5 = optionParser.accepts("quickPlaySingleplayer").withRequiredArg(); + OptionSpec optionSpec6 = optionParser.accepts("quickPlayMultiplayer").withRequiredArg(); + OptionSpec optionSpec7 = optionParser.accepts("quickPlayRealms").withRequiredArg(); + OptionSpec optionSpec8 = optionParser.accepts("gameDir").withRequiredArg().ofType(File.class).defaultsTo(new File(".")); + OptionSpec optionSpec9 = optionParser.accepts("assetsDir").withRequiredArg().ofType(File.class); + OptionSpec optionSpec10 = optionParser.accepts("resourcePackDir").withRequiredArg().ofType(File.class); + OptionSpec optionSpec11 = optionParser.accepts("proxyHost").withRequiredArg(); + OptionSpec optionSpec12 = optionParser.accepts("proxyPort").withRequiredArg().defaultsTo("8080").ofType(Integer.class); + OptionSpec optionSpec13 = optionParser.accepts("proxyUser").withRequiredArg(); + OptionSpec optionSpec14 = optionParser.accepts("proxyPass").withRequiredArg(); + OptionSpec optionSpec15 = optionParser.accepts("username").withRequiredArg().defaultsTo("Player" + System.currentTimeMillis() % 1000L); + OptionSpec optionSpec16 = optionParser.accepts("uuid").withRequiredArg(); + OptionSpec optionSpec17 = optionParser.accepts("xuid").withOptionalArg().defaultsTo(""); + OptionSpec optionSpec18 = optionParser.accepts("clientId").withOptionalArg().defaultsTo(""); + OptionSpec optionSpec19 = optionParser.accepts("accessToken").withRequiredArg().required(); + OptionSpec optionSpec20 = optionParser.accepts("version").withRequiredArg().required(); + OptionSpec optionSpec21 = optionParser.accepts("width").withRequiredArg().ofType(Integer.class).defaultsTo(854); + OptionSpec optionSpec22 = optionParser.accepts("height").withRequiredArg().ofType(Integer.class).defaultsTo(480); + OptionSpec optionSpec23 = optionParser.accepts("fullscreenWidth").withRequiredArg().ofType(Integer.class); + OptionSpec optionSpec24 = optionParser.accepts("fullscreenHeight").withRequiredArg().ofType(Integer.class); + OptionSpec optionSpec25 = optionParser.accepts("userProperties").withRequiredArg().defaultsTo("{}"); + OptionSpec optionSpec26 = optionParser.accepts("profileProperties").withRequiredArg().defaultsTo("{}"); + OptionSpec optionSpec27 = optionParser.accepts("assetIndex").withRequiredArg(); + OptionSpec optionSpec28 = optionParser.accepts("userType").withRequiredArg().defaultsTo("legacy"); + OptionSpec optionSpec29 = optionParser.accepts("versionType").withRequiredArg().defaultsTo("release"); + OptionSpec optionSpec30 = optionParser.nonOptions(); OptionSet optionSet = optionParser.parse(strings); - File file = parseArgument(optionSet, optionSpec6); - String string = parseArgument(optionSet, optionSpec18); + File file = parseArgument(optionSet, optionSpec8); + String string = parseArgument(optionSet, optionSpec20); String string2 = "Pre-bootstrap"; Logger logger; @@ -101,11 +105,16 @@ public class Main { JvmProfiler.INSTANCE.start(net.minecraft.util.profiling.jfr.Environment.CLIENT); } + if (optionSet.has(optionSpec2)) { + TracyBootstrap.setup(); + } + Stopwatch stopwatch = Stopwatch.createStarted(Ticker.systemTicker()); Stopwatch stopwatch2 = Stopwatch.createStarted(Ticker.systemTicker()); GameLoadTimesEvent.INSTANCE.beginStep(TelemetryProperty.LOAD_TIME_TOTAL_TIME_MS, stopwatch); GameLoadTimesEvent.INSTANCE.beginStep(TelemetryProperty.LOAD_TIME_PRE_WINDOW_MS, stopwatch2); SharedConstants.tryDetectVersion(); + TracyClient.reportAppInfo("Minecraft Java Edition " + SharedConstants.getCurrentVersion().getName()); CompletableFuture completableFuture = DataFixers.optimize(DataFixTypes.TYPES_FOR_LEVEL_LIST); CrashReport.preload(); logger = LogUtils.getLogger(); @@ -114,28 +123,28 @@ public class Main { GameLoadTimesEvent.INSTANCE.setBootstrapTime(Bootstrap.bootstrapDuration.get()); Bootstrap.validate(); string2 = "Argument parsing"; - List list = optionSet.valuesOf(optionSpec28); + List list = optionSet.valuesOf(optionSpec30); if (!list.isEmpty()) { logger.info("Completely ignored arguments: {}", list); } - String string3 = optionSpec26.value(optionSet); - User.Type type = User.Type.byName(string3); + String string3 = optionSpec28.value(optionSet); + Type type = Type.byName(string3); if (type == null) { logger.warn("Unrecognized user type: {}", string3); } - String string4 = parseArgument(optionSet, optionSpec9); + String string4 = parseArgument(optionSet, optionSpec11); Proxy proxy = Proxy.NO_PROXY; if (string4 != null) { try { - proxy = new Proxy(Type.SOCKS, new InetSocketAddress(string4, parseArgument(optionSet, optionSpec10))); - } catch (Exception var78) { + proxy = new Proxy(java.net.Proxy.Type.SOCKS, new InetSocketAddress(string4, parseArgument(optionSet, optionSpec12))); + } catch (Exception var81) { } } - final String string5 = parseArgument(optionSet, optionSpec11); - final String string6 = parseArgument(optionSet, optionSpec12); + final String string5 = parseArgument(optionSet, optionSpec13); + final String string6 = parseArgument(optionSet, optionSpec14); if (!proxy.equals(Proxy.NO_PROXY) && stringHasValue(string5) && stringHasValue(string6)) { Authenticator.setDefault(new Authenticator() { protected PasswordAuthentication getPasswordAuthentication() { @@ -144,44 +153,45 @@ public class Main { }); } - int i = parseArgument(optionSet, optionSpec19); - int j = parseArgument(optionSet, optionSpec20); - OptionalInt optionalInt = ofNullable(parseArgument(optionSet, optionSpec21)); - OptionalInt optionalInt2 = ofNullable(parseArgument(optionSet, optionSpec22)); + int i = parseArgument(optionSet, optionSpec21); + int j = parseArgument(optionSet, optionSpec22); + OptionalInt optionalInt = ofNullable(parseArgument(optionSet, optionSpec23)); + OptionalInt optionalInt2 = ofNullable(parseArgument(optionSet, optionSpec24)); boolean bl = optionSet.has("fullscreen"); boolean bl2 = optionSet.has("demo"); boolean bl3 = optionSet.has("disableMultiplayer"); boolean bl4 = optionSet.has("disableChat"); + boolean bl5 = !optionSet.has(optionSpec3); Gson gson = new GsonBuilder().registerTypeAdapter(PropertyMap.class, new Serializer()).create(); - PropertyMap propertyMap = GsonHelper.fromJson(gson, parseArgument(optionSet, optionSpec23), PropertyMap.class); - PropertyMap propertyMap2 = GsonHelper.fromJson(gson, parseArgument(optionSet, optionSpec24), PropertyMap.class); - String string7 = parseArgument(optionSet, optionSpec27); - File file2 = optionSet.has(optionSpec7) ? parseArgument(optionSet, optionSpec7) : new File(file, "assets/"); - File file3 = optionSet.has(optionSpec8) ? parseArgument(optionSet, optionSpec8) : new File(file, "resourcepacks/"); - UUID uUID = optionSet.has(optionSpec14) - ? UndashedUuid.fromStringLenient(optionSpec14.value(optionSet)) - : UUIDUtil.createOfflinePlayerUUID(optionSpec13.value(optionSet)); - String string8 = optionSet.has(optionSpec25) ? optionSpec25.value(optionSet) : null; - String string9 = optionSet.valueOf(optionSpec15); - String string10 = optionSet.valueOf(optionSpec16); - String string11 = parseArgument(optionSet, optionSpec2); - String string12 = unescapeJavaArgument(parseArgument(optionSet, optionSpec3)); - String string13 = unescapeJavaArgument(parseArgument(optionSet, optionSpec4)); - String string14 = unescapeJavaArgument(parseArgument(optionSet, optionSpec5)); + PropertyMap propertyMap = GsonHelper.fromJson(gson, parseArgument(optionSet, optionSpec25), PropertyMap.class); + PropertyMap propertyMap2 = GsonHelper.fromJson(gson, parseArgument(optionSet, optionSpec26), PropertyMap.class); + String string7 = parseArgument(optionSet, optionSpec29); + File file2 = optionSet.has(optionSpec9) ? parseArgument(optionSet, optionSpec9) : new File(file, "assets/"); + File file3 = optionSet.has(optionSpec10) ? parseArgument(optionSet, optionSpec10) : new File(file, "resourcepacks/"); + UUID uUID = hasValidUuid(optionSpec16, optionSet, logger) + ? UndashedUuid.fromStringLenient(optionSpec16.value(optionSet)) + : UUIDUtil.createOfflinePlayerUUID(optionSpec15.value(optionSet)); + String string8 = optionSet.has(optionSpec27) ? optionSpec27.value(optionSet) : null; + String string9 = optionSet.valueOf(optionSpec17); + String string10 = optionSet.valueOf(optionSpec18); + String string11 = parseArgument(optionSet, optionSpec4); + String string12 = unescapeJavaArgument(parseArgument(optionSet, optionSpec5)); + String string13 = unescapeJavaArgument(parseArgument(optionSet, optionSpec6)); + String string14 = unescapeJavaArgument(parseArgument(optionSet, optionSpec7)); User user = new User( - optionSpec13.value(optionSet), uUID, optionSpec17.value(optionSet), emptyStringToEmptyOptional(string9), emptyStringToEmptyOptional(string10), type + optionSpec15.value(optionSet), uUID, optionSpec19.value(optionSet), emptyStringToEmptyOptional(string9), emptyStringToEmptyOptional(string10), type ); gameConfig = new GameConfig( new GameConfig.UserData(user, propertyMap, propertyMap2, proxy), new DisplayData(i, j, optionalInt, optionalInt2, bl), new GameConfig.FolderData(file, file3, file2, string8), - new GameConfig.GameData(bl2, string, string7, bl3, bl4), + new GameConfig.GameData(bl2, string, string7, bl3, bl4, bl5), new GameConfig.QuickPlayData(string11, string12, string13, string14) ); Util.startTimerHackThread(); completableFuture.join(); - } catch (Throwable var79) { - CrashReport crashReport = CrashReport.forThrowable(var79, string2); + } catch (Throwable var82) { + CrashReport crashReport = CrashReport.forThrowable(var82, string2); CrashReportCategory crashReportCategory = crashReport.addCategory("Initialization"); NativeModuleLister.addCrashSection(crashReportCategory); Minecraft.fillReport(null, null, string, null, crashReport); @@ -210,12 +220,12 @@ public class Main { RenderSystem.beginInitialization(); minecraft = new Minecraft(gameConfig); RenderSystem.finishInitialization(); - } catch (SilentInitException var76) { + } catch (SilentInitException var79) { Util.shutdownExecutors(); - logger.warn("Failed to create window: ", (Throwable)var76); + logger.warn("Failed to create window: ", (Throwable)var79); return; - } catch (Throwable var77) { - CrashReport crashReport2 = CrashReport.forThrowable(var77, "Initializing game"); + } catch (Throwable var80) { + CrashReport crashReport2 = CrashReport.forThrowable(var80, "Initializing game"); CrashReportCategory crashReportCategory2 = crashReport2.addCategory("Initialization"); NativeModuleLister.addCrashSection(crashReportCategory2); Minecraft.fillReport(minecraft, null, gameConfig.game.launchVersion, null, crashReport2); @@ -273,6 +283,20 @@ public class Main { return str != null && !str.isEmpty(); } + private static boolean hasValidUuid(OptionSpec optionSpec, OptionSet optionSet, Logger logger) { + return optionSet.has(optionSpec) && isUuidValid(optionSpec, optionSet, logger); + } + + private static boolean isUuidValid(OptionSpec optionSpec, OptionSet optionSet, Logger logger) { + try { + UndashedUuid.fromStringLenient(optionSpec.value(optionSet)); + return true; + } catch (IllegalArgumentException var4) { + logger.warn("Invalid UUID: '{}", optionSpec.value(optionSet)); + return false; + } + } + static { System.setProperty("java.awt.headless", "true"); } diff --git a/net/minecraft/client/model/AbstractBoatModel.java b/net/minecraft/client/model/AbstractBoatModel.java new file mode 100644 index 00000000..3c66d351 --- /dev/null +++ b/net/minecraft/client/model/AbstractBoatModel.java @@ -0,0 +1,33 @@ +package net.minecraft.client.model; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.renderer.entity.state.BoatRenderState; +import net.minecraft.util.Mth; + +@Environment(EnvType.CLIENT) +public abstract class AbstractBoatModel extends EntityModel { + private final ModelPart leftPaddle; + private final ModelPart rightPaddle; + + public AbstractBoatModel(ModelPart modelPart) { + super(modelPart); + this.leftPaddle = modelPart.getChild("left_paddle"); + this.rightPaddle = modelPart.getChild("right_paddle"); + } + + public void setupAnim(BoatRenderState boatRenderState) { + super.setupAnim(boatRenderState); + animatePaddle(boatRenderState.rowingTimeLeft, 0, this.leftPaddle); + animatePaddle(boatRenderState.rowingTimeRight, 1, this.rightPaddle); + } + + private static void animatePaddle(float f, int i, ModelPart modelPart) { + modelPart.xRot = Mth.clampedLerp((float) (-Math.PI / 3), (float) (-Math.PI / 12), (Mth.sin(-f) + 1.0F) / 2.0F); + modelPart.yRot = Mth.clampedLerp((float) (-Math.PI / 4), (float) (Math.PI / 4), (Mth.sin(-f + 1.0F) + 1.0F) / 2.0F); + if (i == 1) { + modelPart.yRot = (float) Math.PI - modelPart.yRot; + } + } +} diff --git a/net/minecraft/client/model/AbstractEquineModel.java b/net/minecraft/client/model/AbstractEquineModel.java new file mode 100644 index 00000000..b73688ef --- /dev/null +++ b/net/minecraft/client/model/AbstractEquineModel.java @@ -0,0 +1,231 @@ +package net.minecraft.client.model; + +import java.util.Set; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.MeshTransformer; +import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.client.renderer.entity.state.EquineRenderState; +import net.minecraft.util.Mth; + +@Environment(EnvType.CLIENT) +public abstract class AbstractEquineModel extends EntityModel { + private static final float DEG_125 = 2.1816616F; + private static final float DEG_60 = (float) (Math.PI / 3); + private static final float DEG_45 = (float) (Math.PI / 4); + private static final float DEG_30 = (float) (Math.PI / 6); + private static final float DEG_15 = (float) (Math.PI / 12); + protected static final String HEAD_PARTS = "head_parts"; + private static final String SADDLE = "saddle"; + private static final String LEFT_SADDLE_MOUTH = "left_saddle_mouth"; + private static final String LEFT_SADDLE_LINE = "left_saddle_line"; + private static final String RIGHT_SADDLE_MOUTH = "right_saddle_mouth"; + private static final String RIGHT_SADDLE_LINE = "right_saddle_line"; + private static final String HEAD_SADDLE = "head_saddle"; + private static final String MOUTH_SADDLE_WRAP = "mouth_saddle_wrap"; + protected static final MeshTransformer BABY_TRANSFORMER = new BabyModelTransform(true, 16.2F, 1.36F, 2.7272F, 2.0F, 20.0F, Set.of("head_parts")); + protected final ModelPart body; + protected final ModelPart headParts; + private final ModelPart rightHindLeg; + private final ModelPart leftHindLeg; + private final ModelPart rightFrontLeg; + private final ModelPart leftFrontLeg; + private final ModelPart tail; + private final ModelPart[] saddleParts; + private final ModelPart[] ridingParts; + + public AbstractEquineModel(ModelPart modelPart) { + super(modelPart); + this.body = modelPart.getChild("body"); + this.headParts = modelPart.getChild("head_parts"); + this.rightHindLeg = modelPart.getChild("right_hind_leg"); + this.leftHindLeg = modelPart.getChild("left_hind_leg"); + this.rightFrontLeg = modelPart.getChild("right_front_leg"); + this.leftFrontLeg = modelPart.getChild("left_front_leg"); + this.tail = this.body.getChild("tail"); + ModelPart modelPart2 = this.body.getChild("saddle"); + ModelPart modelPart3 = this.headParts.getChild("left_saddle_mouth"); + ModelPart modelPart4 = this.headParts.getChild("right_saddle_mouth"); + ModelPart modelPart5 = this.headParts.getChild("left_saddle_line"); + ModelPart modelPart6 = this.headParts.getChild("right_saddle_line"); + ModelPart modelPart7 = this.headParts.getChild("head_saddle"); + ModelPart modelPart8 = this.headParts.getChild("mouth_saddle_wrap"); + this.saddleParts = new ModelPart[]{modelPart2, modelPart3, modelPart4, modelPart7, modelPart8}; + this.ridingParts = new ModelPart[]{modelPart5, modelPart6}; + } + + public static MeshDefinition createBodyMesh(CubeDeformation cubeDeformation) { + MeshDefinition meshDefinition = new MeshDefinition(); + PartDefinition partDefinition = meshDefinition.getRoot(); + PartDefinition partDefinition2 = partDefinition.addOrReplaceChild( + "body", + CubeListBuilder.create().texOffs(0, 32).addBox(-5.0F, -8.0F, -17.0F, 10.0F, 10.0F, 22.0F, new CubeDeformation(0.05F)), + PartPose.offset(0.0F, 11.0F, 5.0F) + ); + PartDefinition partDefinition3 = partDefinition.addOrReplaceChild( + "head_parts", + CubeListBuilder.create().texOffs(0, 35).addBox(-2.05F, -6.0F, -2.0F, 4.0F, 12.0F, 7.0F), + PartPose.offsetAndRotation(0.0F, 4.0F, -12.0F, (float) (Math.PI / 6), 0.0F, 0.0F) + ); + PartDefinition partDefinition4 = partDefinition3.addOrReplaceChild( + "head", CubeListBuilder.create().texOffs(0, 13).addBox(-3.0F, -11.0F, -2.0F, 6.0F, 5.0F, 7.0F, cubeDeformation), PartPose.ZERO + ); + partDefinition3.addOrReplaceChild( + "mane", CubeListBuilder.create().texOffs(56, 36).addBox(-1.0F, -11.0F, 5.01F, 2.0F, 16.0F, 2.0F, cubeDeformation), PartPose.ZERO + ); + partDefinition3.addOrReplaceChild( + "upper_mouth", CubeListBuilder.create().texOffs(0, 25).addBox(-2.0F, -11.0F, -7.0F, 4.0F, 5.0F, 5.0F, cubeDeformation), PartPose.ZERO + ); + partDefinition.addOrReplaceChild( + "left_hind_leg", + CubeListBuilder.create().texOffs(48, 21).mirror().addBox(-3.0F, -1.01F, -1.0F, 4.0F, 11.0F, 4.0F, cubeDeformation), + PartPose.offset(4.0F, 14.0F, 7.0F) + ); + partDefinition.addOrReplaceChild( + "right_hind_leg", + CubeListBuilder.create().texOffs(48, 21).addBox(-1.0F, -1.01F, -1.0F, 4.0F, 11.0F, 4.0F, cubeDeformation), + PartPose.offset(-4.0F, 14.0F, 7.0F) + ); + partDefinition.addOrReplaceChild( + "left_front_leg", + CubeListBuilder.create().texOffs(48, 21).mirror().addBox(-3.0F, -1.01F, -1.9F, 4.0F, 11.0F, 4.0F, cubeDeformation), + PartPose.offset(4.0F, 14.0F, -10.0F) + ); + partDefinition.addOrReplaceChild( + "right_front_leg", + CubeListBuilder.create().texOffs(48, 21).addBox(-1.0F, -1.01F, -1.9F, 4.0F, 11.0F, 4.0F, cubeDeformation), + PartPose.offset(-4.0F, 14.0F, -10.0F) + ); + partDefinition2.addOrReplaceChild( + "tail", + CubeListBuilder.create().texOffs(42, 36).addBox(-1.5F, 0.0F, 0.0F, 3.0F, 14.0F, 4.0F, cubeDeformation), + PartPose.offsetAndRotation(0.0F, -5.0F, 2.0F, (float) (Math.PI / 6), 0.0F, 0.0F) + ); + partDefinition2.addOrReplaceChild( + "saddle", CubeListBuilder.create().texOffs(26, 0).addBox(-5.0F, -8.0F, -9.0F, 10.0F, 9.0F, 9.0F, new CubeDeformation(0.5F)), PartPose.ZERO + ); + partDefinition3.addOrReplaceChild( + "left_saddle_mouth", CubeListBuilder.create().texOffs(29, 5).addBox(2.0F, -9.0F, -6.0F, 1.0F, 2.0F, 2.0F, cubeDeformation), PartPose.ZERO + ); + partDefinition3.addOrReplaceChild( + "right_saddle_mouth", CubeListBuilder.create().texOffs(29, 5).addBox(-3.0F, -9.0F, -6.0F, 1.0F, 2.0F, 2.0F, cubeDeformation), PartPose.ZERO + ); + partDefinition3.addOrReplaceChild( + "left_saddle_line", + CubeListBuilder.create().texOffs(32, 2).addBox(3.1F, -6.0F, -8.0F, 0.0F, 3.0F, 16.0F), + PartPose.rotation((float) (-Math.PI / 6), 0.0F, 0.0F) + ); + partDefinition3.addOrReplaceChild( + "right_saddle_line", + CubeListBuilder.create().texOffs(32, 2).addBox(-3.1F, -6.0F, -8.0F, 0.0F, 3.0F, 16.0F), + PartPose.rotation((float) (-Math.PI / 6), 0.0F, 0.0F) + ); + partDefinition3.addOrReplaceChild( + "head_saddle", CubeListBuilder.create().texOffs(1, 1).addBox(-3.0F, -11.0F, -1.9F, 6.0F, 5.0F, 6.0F, new CubeDeformation(0.22F)), PartPose.ZERO + ); + partDefinition3.addOrReplaceChild( + "mouth_saddle_wrap", CubeListBuilder.create().texOffs(19, 0).addBox(-2.0F, -11.0F, -4.0F, 4.0F, 5.0F, 2.0F, new CubeDeformation(0.2F)), PartPose.ZERO + ); + partDefinition4.addOrReplaceChild( + "left_ear", CubeListBuilder.create().texOffs(19, 16).addBox(0.55F, -13.0F, 4.0F, 2.0F, 3.0F, 1.0F, new CubeDeformation(-0.001F)), PartPose.ZERO + ); + partDefinition4.addOrReplaceChild( + "right_ear", CubeListBuilder.create().texOffs(19, 16).addBox(-2.55F, -13.0F, 4.0F, 2.0F, 3.0F, 1.0F, new CubeDeformation(-0.001F)), PartPose.ZERO + ); + return meshDefinition; + } + + public static MeshDefinition createBabyMesh(CubeDeformation cubeDeformation) { + return BABY_TRANSFORMER.apply(createFullScaleBabyMesh(cubeDeformation)); + } + + protected static MeshDefinition createFullScaleBabyMesh(CubeDeformation cubeDeformation) { + MeshDefinition meshDefinition = createBodyMesh(cubeDeformation); + PartDefinition partDefinition = meshDefinition.getRoot(); + CubeDeformation cubeDeformation2 = cubeDeformation.extend(0.0F, 5.5F, 0.0F); + partDefinition.addOrReplaceChild( + "left_hind_leg", + CubeListBuilder.create().texOffs(48, 21).mirror().addBox(-3.0F, -1.01F, -1.0F, 4.0F, 11.0F, 4.0F, cubeDeformation2), + PartPose.offset(4.0F, 14.0F, 7.0F) + ); + partDefinition.addOrReplaceChild( + "right_hind_leg", + CubeListBuilder.create().texOffs(48, 21).addBox(-1.0F, -1.01F, -1.0F, 4.0F, 11.0F, 4.0F, cubeDeformation2), + PartPose.offset(-4.0F, 14.0F, 7.0F) + ); + partDefinition.addOrReplaceChild( + "left_front_leg", + CubeListBuilder.create().texOffs(48, 21).mirror().addBox(-3.0F, -1.01F, -1.9F, 4.0F, 11.0F, 4.0F, cubeDeformation2), + PartPose.offset(4.0F, 14.0F, -10.0F) + ); + partDefinition.addOrReplaceChild( + "right_front_leg", + CubeListBuilder.create().texOffs(48, 21).addBox(-1.0F, -1.01F, -1.9F, 4.0F, 11.0F, 4.0F, cubeDeformation2), + PartPose.offset(-4.0F, 14.0F, -10.0F) + ); + return meshDefinition; + } + + public void setupAnim(T equineRenderState) { + super.setupAnim(equineRenderState); + + for (ModelPart modelPart : this.saddleParts) { + modelPart.visible = equineRenderState.isSaddled; + } + + for (ModelPart modelPart : this.ridingParts) { + modelPart.visible = equineRenderState.isRidden && equineRenderState.isSaddled; + } + + float f = Mth.clamp(equineRenderState.yRot, -20.0F, 20.0F); + float g = equineRenderState.xRot * (float) (Math.PI / 180.0); + float h = equineRenderState.walkAnimationSpeed; + float i = equineRenderState.walkAnimationPos; + if (h > 0.2F) { + g += Mth.cos(i * 0.8F) * 0.15F * h; + } + + float j = equineRenderState.eatAnimation; + float k = equineRenderState.standAnimation; + float l = 1.0F - k; + float m = equineRenderState.feedingAnimation; + boolean bl = equineRenderState.animateTail; + this.headParts.xRot = (float) (Math.PI / 6) + g; + this.headParts.yRot = f * (float) (Math.PI / 180.0); + float n = equineRenderState.isInWater ? 0.2F : 1.0F; + float o = Mth.cos(n * i * 0.6662F + (float) Math.PI); + float p = o * 0.8F * h; + float q = (1.0F - Math.max(k, j)) * ((float) (Math.PI / 6) + g + m * Mth.sin(equineRenderState.ageInTicks) * 0.05F); + this.headParts.xRot = k * ((float) (Math.PI / 12) + g) + j * (2.1816616F + Mth.sin(equineRenderState.ageInTicks) * 0.05F) + q; + this.headParts.yRot = k * f * (float) (Math.PI / 180.0) + (1.0F - Math.max(k, j)) * this.headParts.yRot; + float r = equineRenderState.ageScale; + this.headParts.y = this.headParts.y + Mth.lerp(j, Mth.lerp(k, 0.0F, -8.0F * r), 7.0F * r); + this.headParts.z = Mth.lerp(k, this.headParts.z, -4.0F * r); + this.body.xRot = k * (float) (-Math.PI / 4) + l * this.body.xRot; + float s = (float) (Math.PI / 12) * k; + float t = Mth.cos(equineRenderState.ageInTicks * 0.6F + (float) Math.PI); + this.leftFrontLeg.y -= 12.0F * r * k; + this.leftFrontLeg.z += 4.0F * r * k; + this.rightFrontLeg.y = this.leftFrontLeg.y; + this.rightFrontLeg.z = this.leftFrontLeg.z; + float u = ((float) (-Math.PI / 3) + t) * k + p * l; + float v = ((float) (-Math.PI / 3) - t) * k - p * l; + this.leftHindLeg.xRot = s - o * 0.5F * h * l; + this.rightHindLeg.xRot = s + o * 0.5F * h * l; + this.leftFrontLeg.xRot = u; + this.rightFrontLeg.xRot = v; + this.tail.xRot = (float) (Math.PI / 6) + h * 0.75F; + this.tail.y += h * r; + this.tail.z += h * 2.0F * r; + if (bl) { + this.tail.yRot = Mth.cos(equineRenderState.ageInTicks * 0.7F); + } else { + this.tail.yRot = 0.0F; + } + } +} diff --git a/net/minecraft/client/model/AbstractPiglinModel.java b/net/minecraft/client/model/AbstractPiglinModel.java new file mode 100644 index 00000000..bb345a6c --- /dev/null +++ b/net/minecraft/client/model/AbstractPiglinModel.java @@ -0,0 +1,93 @@ +package net.minecraft.client.model; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.entity.state.HumanoidRenderState; +import net.minecraft.util.Mth; + +@Environment(EnvType.CLIENT) +public class AbstractPiglinModel extends HumanoidModel { + private static final String LEFT_SLEEVE = "left_sleeve"; + private static final String RIGHT_SLEEVE = "right_sleeve"; + private static final String LEFT_PANTS = "left_pants"; + private static final String RIGHT_PANTS = "right_pants"; + public final ModelPart leftSleeve = this.leftArm.getChild("left_sleeve"); + public final ModelPart rightSleeve = this.rightArm.getChild("right_sleeve"); + public final ModelPart leftPants = this.leftLeg.getChild("left_pants"); + public final ModelPart rightPants = this.rightLeg.getChild("right_pants"); + public final ModelPart jacket = this.body.getChild("jacket"); + public final ModelPart rightEar = this.head.getChild("right_ear"); + public final ModelPart leftEar = this.head.getChild("left_ear"); + + public AbstractPiglinModel(ModelPart modelPart) { + super(modelPart, RenderType::entityTranslucent); + } + + public static MeshDefinition createMesh(CubeDeformation cubeDeformation) { + MeshDefinition meshDefinition = PlayerModel.createMesh(cubeDeformation, false); + PartDefinition partDefinition = meshDefinition.getRoot(); + partDefinition.addOrReplaceChild( + "body", CubeListBuilder.create().texOffs(16, 16).addBox(-4.0F, 0.0F, -2.0F, 8.0F, 12.0F, 4.0F, cubeDeformation), PartPose.ZERO + ); + PartDefinition partDefinition2 = addHead(cubeDeformation, meshDefinition); + partDefinition2.clearChild("hat"); + return meshDefinition; + } + + public static PartDefinition addHead(CubeDeformation cubeDeformation, MeshDefinition meshDefinition) { + PartDefinition partDefinition = meshDefinition.getRoot(); + PartDefinition partDefinition2 = partDefinition.addOrReplaceChild( + "head", + CubeListBuilder.create() + .texOffs(0, 0) + .addBox(-5.0F, -8.0F, -4.0F, 10.0F, 8.0F, 8.0F, cubeDeformation) + .texOffs(31, 1) + .addBox(-2.0F, -4.0F, -5.0F, 4.0F, 4.0F, 1.0F, cubeDeformation) + .texOffs(2, 4) + .addBox(2.0F, -2.0F, -5.0F, 1.0F, 2.0F, 1.0F, cubeDeformation) + .texOffs(2, 0) + .addBox(-3.0F, -2.0F, -5.0F, 1.0F, 2.0F, 1.0F, cubeDeformation), + PartPose.ZERO + ); + partDefinition2.addOrReplaceChild( + "left_ear", + CubeListBuilder.create().texOffs(51, 6).addBox(0.0F, 0.0F, -2.0F, 1.0F, 5.0F, 4.0F, cubeDeformation), + PartPose.offsetAndRotation(4.5F, -6.0F, 0.0F, 0.0F, 0.0F, (float) (-Math.PI / 6)) + ); + partDefinition2.addOrReplaceChild( + "right_ear", + CubeListBuilder.create().texOffs(39, 6).addBox(-1.0F, 0.0F, -2.0F, 1.0F, 5.0F, 4.0F, cubeDeformation), + PartPose.offsetAndRotation(-4.5F, -6.0F, 0.0F, 0.0F, 0.0F, (float) (Math.PI / 6)) + ); + return partDefinition2; + } + + @Override + public void setupAnim(S humanoidRenderState) { + super.setupAnim(humanoidRenderState); + float f = humanoidRenderState.walkAnimationPos; + float g = humanoidRenderState.walkAnimationSpeed; + float h = (float) (Math.PI / 6); + float i = humanoidRenderState.ageInTicks * 0.1F + f * 0.5F; + float j = 0.08F + g * 0.4F; + this.leftEar.zRot = (float) (-Math.PI / 6) - Mth.cos(i * 1.2F) * j; + this.rightEar.zRot = (float) (Math.PI / 6) + Mth.cos(i) * j; + } + + @Override + public void setAllVisible(boolean visible) { + super.setAllVisible(visible); + this.leftSleeve.visible = visible; + this.rightSleeve.visible = visible; + this.leftPants.visible = visible; + this.rightPants.visible = visible; + this.jacket.visible = visible; + } +} diff --git a/net/minecraft/client/model/AbstractZombieModel.java b/net/minecraft/client/model/AbstractZombieModel.java index 3929ab26..588c9d0e 100644 --- a/net/minecraft/client/model/AbstractZombieModel.java +++ b/net/minecraft/client/model/AbstractZombieModel.java @@ -3,21 +3,17 @@ package net.minecraft.client.model; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.model.geom.ModelPart; -import net.minecraft.world.entity.monster.Monster; +import net.minecraft.client.renderer.entity.state.ZombieRenderState; @Environment(EnvType.CLIENT) -public abstract class AbstractZombieModel extends HumanoidModel { +public abstract class AbstractZombieModel extends HumanoidModel { protected AbstractZombieModel(ModelPart root) { super(root); } - /** - * Sets this entity's model rotation angles - */ - public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { - super.setupAnim(entity, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch); - AnimationUtils.animateZombieArms(this.leftArm, this.rightArm, this.isAggressive(entity), this.attackTime, ageInTicks); + public void setupAnim(S zombieRenderState) { + super.setupAnim(zombieRenderState); + float f = zombieRenderState.attackTime; + AnimationUtils.animateZombieArms(this.leftArm, this.rightArm, zombieRenderState.isAggressive, f, zombieRenderState.ageInTicks); } - - public abstract boolean isAggressive(T entity); } diff --git a/net/minecraft/client/model/AgeableHierarchicalModel.java b/net/minecraft/client/model/AgeableHierarchicalModel.java deleted file mode 100644 index 6022fa3e..00000000 --- a/net/minecraft/client/model/AgeableHierarchicalModel.java +++ /dev/null @@ -1,39 +0,0 @@ -package net.minecraft.client.model; - -import com.mojang.blaze3d.vertex.PoseStack; -import com.mojang.blaze3d.vertex.VertexConsumer; -import java.util.function.Function; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.client.renderer.RenderType; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.entity.Entity; - -@Environment(EnvType.CLIENT) -public abstract class AgeableHierarchicalModel extends HierarchicalModel { - private final float youngScaleFactor; - private final float bodyYOffset; - - public AgeableHierarchicalModel(float youngScaleFactor, float bodyYOffset) { - this(youngScaleFactor, bodyYOffset, RenderType::entityCutoutNoCull); - } - - public AgeableHierarchicalModel(float youngScaleFactor, float bodyYOffset, Function renderType) { - super(renderType); - this.bodyYOffset = bodyYOffset; - this.youngScaleFactor = youngScaleFactor; - } - - @Override - public void renderToBuffer(PoseStack poseStack, VertexConsumer buffer, int packedLight, int packedOverlay, int color) { - if (this.young) { - poseStack.pushPose(); - poseStack.scale(this.youngScaleFactor, this.youngScaleFactor, this.youngScaleFactor); - poseStack.translate(0.0F, this.bodyYOffset / 16.0F, 0.0F); - this.root().render(poseStack, buffer, packedLight, packedOverlay, color); - poseStack.popPose(); - } else { - this.root().render(poseStack, buffer, packedLight, packedOverlay, color); - } - } -} diff --git a/net/minecraft/client/model/AgeableListModel.java b/net/minecraft/client/model/AgeableListModel.java deleted file mode 100644 index 491bbee2..00000000 --- a/net/minecraft/client/model/AgeableListModel.java +++ /dev/null @@ -1,79 +0,0 @@ -package net.minecraft.client.model; - -import com.mojang.blaze3d.vertex.PoseStack; -import com.mojang.blaze3d.vertex.VertexConsumer; -import java.util.function.Function; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.client.model.geom.ModelPart; -import net.minecraft.client.renderer.RenderType; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.entity.Entity; - -@Environment(EnvType.CLIENT) -public abstract class AgeableListModel extends EntityModel { - private final boolean scaleHead; - private final float babyYHeadOffset; - private final float babyZHeadOffset; - private final float babyHeadScale; - private final float babyBodyScale; - private final float bodyYOffset; - - protected AgeableListModel(boolean scaleHead, float babyYHeadOffset, float babyZHeadOffset) { - this(scaleHead, babyYHeadOffset, babyZHeadOffset, 2.0F, 2.0F, 24.0F); - } - - protected AgeableListModel(boolean scaleHead, float babyYHeadOffset, float babyZHeadOffset, float babyHeadScale, float babyBodyScale, float bodyYOffset) { - this(RenderType::entityCutoutNoCull, scaleHead, babyYHeadOffset, babyZHeadOffset, babyHeadScale, babyBodyScale, bodyYOffset); - } - - protected AgeableListModel( - Function renderType, - boolean scaleHead, - float babyYHeadOffset, - float babyZHeadOffset, - float babyHeadScale, - float babyBodyScale, - float bodyYOffset - ) { - super(renderType); - this.scaleHead = scaleHead; - this.babyYHeadOffset = babyYHeadOffset; - this.babyZHeadOffset = babyZHeadOffset; - this.babyHeadScale = babyHeadScale; - this.babyBodyScale = babyBodyScale; - this.bodyYOffset = bodyYOffset; - } - - protected AgeableListModel() { - this(false, 5.0F, 2.0F); - } - - @Override - public void renderToBuffer(PoseStack poseStack, VertexConsumer buffer, int packedLight, int packedOverlay, int color) { - if (this.young) { - poseStack.pushPose(); - if (this.scaleHead) { - float f = 1.5F / this.babyHeadScale; - poseStack.scale(f, f, f); - } - - poseStack.translate(0.0F, this.babyYHeadOffset / 16.0F, this.babyZHeadOffset / 16.0F); - this.headParts().forEach(modelPart -> modelPart.render(poseStack, buffer, packedLight, packedOverlay, color)); - poseStack.popPose(); - poseStack.pushPose(); - float f = 1.0F / this.babyBodyScale; - poseStack.scale(f, f, f); - poseStack.translate(0.0F, this.bodyYOffset / 16.0F, 0.0F); - this.bodyParts().forEach(modelPart -> modelPart.render(poseStack, buffer, packedLight, packedOverlay, color)); - poseStack.popPose(); - } else { - this.headParts().forEach(modelPart -> modelPart.render(poseStack, buffer, packedLight, packedOverlay, color)); - this.bodyParts().forEach(modelPart -> modelPart.render(poseStack, buffer, packedLight, packedOverlay, color)); - } - } - - protected abstract Iterable headParts(); - - protected abstract Iterable bodyParts(); -} diff --git a/net/minecraft/client/model/AllayModel.java b/net/minecraft/client/model/AllayModel.java index 681c0164..6010943f 100644 --- a/net/minecraft/client/model/AllayModel.java +++ b/net/minecraft/client/model/AllayModel.java @@ -12,37 +12,24 @@ import net.minecraft.client.model.geom.builders.LayerDefinition; import net.minecraft.client.model.geom.builders.MeshDefinition; import net.minecraft.client.model.geom.builders.PartDefinition; import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.entity.state.AllayRenderState; import net.minecraft.util.Mth; import net.minecraft.world.entity.HumanoidArm; -import net.minecraft.world.entity.animal.allay.Allay; @Environment(EnvType.CLIENT) -public class AllayModel extends HierarchicalModel implements ArmedModel { - private final ModelPart root; - private final ModelPart head; - private final ModelPart body; - private final ModelPart right_arm; - private final ModelPart left_arm; - private final ModelPart right_wing; - private final ModelPart left_wing; +public class AllayModel extends EntityModel implements ArmedModel { + private final ModelPart head = this.root.getChild("head"); + private final ModelPart body = this.root.getChild("body"); + private final ModelPart right_arm = this.body.getChild("right_arm"); + private final ModelPart left_arm = this.body.getChild("left_arm"); + private final ModelPart right_wing = this.body.getChild("right_wing"); + private final ModelPart left_wing = this.body.getChild("left_wing"); private static final float FLYING_ANIMATION_X_ROT = (float) (Math.PI / 4); private static final float MAX_HAND_HOLDING_ITEM_X_ROT_RAD = -1.134464F; private static final float MIN_HAND_HOLDING_ITEM_X_ROT_RAD = (float) (-Math.PI / 3); public AllayModel(ModelPart root) { - super(RenderType::entityTranslucent); - this.root = root.getChild("root"); - this.head = this.root.getChild("head"); - this.body = this.root.getChild("body"); - this.right_arm = this.body.getChild("right_arm"); - this.left_arm = this.body.getChild("left_arm"); - this.right_wing = this.body.getChild("right_wing"); - this.left_wing = this.body.getChild("left_wing"); - } - - @Override - public ModelPart root() { - return this.root; + super(root.getChild("root"), RenderType::entityTranslucent); } public static LayerDefinition createBodyLayer() { @@ -84,48 +71,46 @@ public class AllayModel extends HierarchicalModel implements ArmedModel { return LayerDefinition.create(meshDefinition, 32, 32); } - /** - * Sets this entity's model rotation angles - */ - public void setupAnim(Allay entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { - this.root().getAllParts().forEach(ModelPart::resetPose); - float f = ageInTicks * 20.0F * (float) (Math.PI / 180.0) + limbSwing; - float g = Mth.cos(f) * (float) Math.PI * 0.15F + limbSwingAmount; - float h = ageInTicks - entity.tickCount; - float i = ageInTicks * 9.0F * (float) (Math.PI / 180.0); - float j = Math.min(limbSwingAmount / 0.3F, 1.0F); - float k = 1.0F - j; - float l = entity.getHoldingItemAnimationProgress(h); - if (entity.isDancing()) { - float m = ageInTicks * 8.0F * (float) (Math.PI / 180.0) + limbSwingAmount; - float n = Mth.cos(m) * 16.0F * (float) (Math.PI / 180.0); - float o = entity.getSpinningProgress(h); - float p = Mth.cos(m) * 14.0F * (float) (Math.PI / 180.0); - float q = Mth.cos(m) * 30.0F * (float) (Math.PI / 180.0); - this.root.yRot = entity.isSpinning() ? (float) (Math.PI * 4) * o : this.root.yRot; - this.root.zRot = n * (1.0F - o); - this.head.yRot = q * (1.0F - o); - this.head.zRot = p * (1.0F - o); + public void setupAnim(AllayRenderState allayRenderState) { + super.setupAnim(allayRenderState); + float f = allayRenderState.walkAnimationSpeed; + float g = allayRenderState.walkAnimationPos; + float h = allayRenderState.ageInTicks * 20.0F * (float) (Math.PI / 180.0) + g; + float i = Mth.cos(h) * (float) Math.PI * 0.15F + f; + float j = allayRenderState.ageInTicks * 9.0F * (float) (Math.PI / 180.0); + float k = Math.min(f / 0.3F, 1.0F); + float l = 1.0F - k; + float m = allayRenderState.holdingAnimationProgress; + if (allayRenderState.isDancing) { + float n = allayRenderState.ageInTicks * 8.0F * (float) (Math.PI / 180.0) + f; + float o = Mth.cos(n) * 16.0F * (float) (Math.PI / 180.0); + float p = allayRenderState.spinningProgress; + float q = Mth.cos(n) * 14.0F * (float) (Math.PI / 180.0); + float r = Mth.cos(n) * 30.0F * (float) (Math.PI / 180.0); + this.root.yRot = allayRenderState.isSpinning ? (float) (Math.PI * 4) * p : this.root.yRot; + this.root.zRot = o * (1.0F - p); + this.head.yRot = r * (1.0F - p); + this.head.zRot = q * (1.0F - p); } else { - this.head.xRot = headPitch * (float) (Math.PI / 180.0); - this.head.yRot = netHeadYaw * (float) (Math.PI / 180.0); + this.head.xRot = allayRenderState.xRot * (float) (Math.PI / 180.0); + this.head.yRot = allayRenderState.yRot * (float) (Math.PI / 180.0); } - this.right_wing.xRot = 0.43633232F * (1.0F - j); - this.right_wing.yRot = (float) (-Math.PI / 4) + g; - this.left_wing.xRot = 0.43633232F * (1.0F - j); - this.left_wing.yRot = (float) (Math.PI / 4) - g; - this.body.xRot = j * (float) (Math.PI / 4); - float m = l * Mth.lerp(j, (float) (-Math.PI / 3), -1.134464F); - this.root.y = this.root.y + (float)Math.cos(i) * 0.25F * k; - this.right_arm.xRot = m; - this.left_arm.xRot = m; - float n = k * (1.0F - l); - float o = 0.43633232F - Mth.cos(i + (float) (Math.PI * 3.0 / 2.0)) * (float) Math.PI * 0.075F * n; - this.left_arm.zRot = -o; - this.right_arm.zRot = o; - this.right_arm.yRot = 0.27925268F * l; - this.left_arm.yRot = -0.27925268F * l; + this.right_wing.xRot = 0.43633232F * (1.0F - k); + this.right_wing.yRot = (float) (-Math.PI / 4) + i; + this.left_wing.xRot = 0.43633232F * (1.0F - k); + this.left_wing.yRot = (float) (Math.PI / 4) - i; + this.body.xRot = k * (float) (Math.PI / 4); + float n = m * Mth.lerp(k, (float) (-Math.PI / 3), -1.134464F); + this.root.y = this.root.y + (float)Math.cos(j) * 0.25F * l; + this.right_arm.xRot = n; + this.left_arm.xRot = n; + float o = l * (1.0F - m); + float p = 0.43633232F - Mth.cos(j + (float) (Math.PI * 3.0 / 2.0)) * (float) Math.PI * 0.075F * o; + this.left_arm.zRot = -p; + this.right_arm.zRot = p; + this.right_arm.yRot = 0.27925268F * m; + this.left_arm.yRot = -0.27925268F * m; } @Override diff --git a/net/minecraft/client/model/AnimationUtils.java b/net/minecraft/client/model/AnimationUtils.java index 40224c80..eb6685cb 100644 --- a/net/minecraft/client/model/AnimationUtils.java +++ b/net/minecraft/client/model/AnimationUtils.java @@ -5,9 +5,6 @@ import net.fabricmc.api.Environment; import net.minecraft.client.model.geom.ModelPart; import net.minecraft.util.Mth; import net.minecraft.world.entity.HumanoidArm; -import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.entity.Mob; -import net.minecraft.world.item.CrossbowItem; @Environment(EnvType.CLIENT) public class AnimationUtils { @@ -20,39 +17,38 @@ public class AnimationUtils { modelPart2.xRot = -1.5F + head.xRot; } - public static void animateCrossbowCharge(ModelPart rightArm, ModelPart leftArm, LivingEntity livingEntity, boolean rightHanded) { - ModelPart modelPart = rightHanded ? rightArm : leftArm; - ModelPart modelPart2 = rightHanded ? leftArm : rightArm; - modelPart.yRot = rightHanded ? -0.8F : 0.8F; - modelPart.xRot = -0.97079635F; - modelPart2.xRot = modelPart.xRot; - float f = CrossbowItem.getChargeDuration(livingEntity.getUseItem(), livingEntity); - float g = Mth.clamp((float)livingEntity.getTicksUsingItem(), 0.0F, f); + public static void animateCrossbowCharge(ModelPart modelPart, ModelPart modelPart2, float f, int i, boolean bl) { + ModelPart modelPart3 = bl ? modelPart : modelPart2; + ModelPart modelPart4 = bl ? modelPart2 : modelPart; + modelPart3.yRot = bl ? -0.8F : 0.8F; + modelPart3.xRot = -0.97079635F; + modelPart4.xRot = modelPart3.xRot; + float g = Mth.clamp((float)i, 0.0F, f); float h = g / f; - modelPart2.yRot = Mth.lerp(h, 0.4F, 0.85F) * (rightHanded ? 1 : -1); - modelPart2.xRot = Mth.lerp(h, modelPart2.xRot, (float) (-Math.PI / 2)); + modelPart4.yRot = Mth.lerp(h, 0.4F, 0.85F) * (bl ? 1 : -1); + modelPart4.xRot = Mth.lerp(h, modelPart4.xRot, (float) (-Math.PI / 2)); } - public static void swingWeaponDown(ModelPart rightArm, ModelPart leftArm, T mob, float attackTime, float ageInTicks) { - float f = Mth.sin(attackTime * (float) Math.PI); - float g = Mth.sin((1.0F - (1.0F - attackTime) * (1.0F - attackTime)) * (float) Math.PI); - rightArm.zRot = 0.0F; - leftArm.zRot = 0.0F; - rightArm.yRot = (float) (Math.PI / 20); - leftArm.yRot = (float) (-Math.PI / 20); - if (mob.getMainArm() == HumanoidArm.RIGHT) { - rightArm.xRot = -1.8849558F + Mth.cos(ageInTicks * 0.09F) * 0.15F; - leftArm.xRot = -0.0F + Mth.cos(ageInTicks * 0.19F) * 0.5F; - rightArm.xRot += f * 2.2F - g * 0.4F; - leftArm.xRot += f * 1.2F - g * 0.4F; + public static void swingWeaponDown(ModelPart modelPart, ModelPart modelPart2, HumanoidArm humanoidArm, float f, float g) { + float h = Mth.sin(f * (float) Math.PI); + float i = Mth.sin((1.0F - (1.0F - f) * (1.0F - f)) * (float) Math.PI); + modelPart.zRot = 0.0F; + modelPart2.zRot = 0.0F; + modelPart.yRot = (float) (Math.PI / 20); + modelPart2.yRot = (float) (-Math.PI / 20); + if (humanoidArm == HumanoidArm.RIGHT) { + modelPart.xRot = -1.8849558F + Mth.cos(g * 0.09F) * 0.15F; + modelPart2.xRot = -0.0F + Mth.cos(g * 0.19F) * 0.5F; + modelPart.xRot += h * 2.2F - i * 0.4F; + modelPart2.xRot += h * 1.2F - i * 0.4F; } else { - rightArm.xRot = -0.0F + Mth.cos(ageInTicks * 0.19F) * 0.5F; - leftArm.xRot = -1.8849558F + Mth.cos(ageInTicks * 0.09F) * 0.15F; - rightArm.xRot += f * 1.2F - g * 0.4F; - leftArm.xRot += f * 2.2F - g * 0.4F; + modelPart.xRot = -0.0F + Mth.cos(g * 0.19F) * 0.5F; + modelPart2.xRot = -1.8849558F + Mth.cos(g * 0.09F) * 0.15F; + modelPart.xRot += h * 1.2F - i * 0.4F; + modelPart2.xRot += h * 2.2F - i * 0.4F; } - bobArms(rightArm, leftArm, ageInTicks); + bobArms(modelPart, modelPart2, g); } public static void bobModelPart(ModelPart modelPart, float ageInTicks, float multiplier) { diff --git a/net/minecraft/client/model/ArmadilloModel.java b/net/minecraft/client/model/ArmadilloModel.java index 98b1f17b..ccef1e56 100644 --- a/net/minecraft/client/model/ArmadilloModel.java +++ b/net/minecraft/client/model/ArmadilloModel.java @@ -9,13 +9,14 @@ import net.minecraft.client.model.geom.builders.CubeDeformation; import net.minecraft.client.model.geom.builders.CubeListBuilder; import net.minecraft.client.model.geom.builders.LayerDefinition; import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.MeshTransformer; import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.client.renderer.entity.state.ArmadilloRenderState; import net.minecraft.util.Mth; -import net.minecraft.world.entity.animal.armadillo.Armadillo; @Environment(EnvType.CLIENT) -public class ArmadilloModel extends AgeableHierarchicalModel { - private static final float BABY_Y_OFFSET = 16.02F; +public class ArmadilloModel extends EntityModel { + public static final MeshTransformer BABY_TRANSFORMER = MeshTransformer.scaling(0.6F); private static final float MAX_DOWN_HEAD_ROTATION_EXTENT = 25.0F; private static final float MAX_UP_HEAD_ROTATION_EXTENT = 22.5F; private static final float MAX_WALK_ANIMATION_SPEED = 16.5F; @@ -23,7 +24,6 @@ public class ArmadilloModel extends AgeableHierarchicalModel { private static final String HEAD_CUBE = "head_cube"; private static final String RIGHT_EAR_CUBE = "right_ear_cube"; private static final String LEFT_EAR_CUBE = "left_ear_cube"; - private final ModelPart root; private final ModelPart body; private final ModelPart rightHindLeg; private final ModelPart leftHindLeg; @@ -32,8 +32,7 @@ public class ArmadilloModel extends AgeableHierarchicalModel { private final ModelPart tail; public ArmadilloModel(ModelPart root) { - super(0.6F, 16.02F); - this.root = root; + super(root); this.body = root.getChild("body"); this.rightHindLeg = root.getChild("right_hind_leg"); this.leftHindLeg = root.getChild("left_hind_leg"); @@ -105,17 +104,9 @@ public class ArmadilloModel extends AgeableHierarchicalModel { return LayerDefinition.create(meshDefinition, 64, 64); } - @Override - public ModelPart root() { - return this.root; - } - - /** - * Sets this entity's model rotation angles - */ - public void setupAnim(Armadillo entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { - this.root().getAllParts().forEach(ModelPart::resetPose); - if (entity.shouldHideInShell()) { + public void setupAnim(ArmadilloRenderState armadilloRenderState) { + super.setupAnim(armadilloRenderState); + if (armadilloRenderState.isHidingInShell) { this.body.skipDraw = true; this.leftHindLeg.visible = false; this.rightHindLeg.visible = false; @@ -127,13 +118,13 @@ public class ArmadilloModel extends AgeableHierarchicalModel { this.rightHindLeg.visible = true; this.tail.visible = true; this.cube.visible = false; - this.head.xRot = Mth.clamp(headPitch, -22.5F, 25.0F) * (float) (Math.PI / 180.0); - this.head.yRot = Mth.clamp(netHeadYaw, -32.5F, 32.5F) * (float) (Math.PI / 180.0); + this.head.xRot = Mth.clamp(armadilloRenderState.xRot, -22.5F, 25.0F) * (float) (Math.PI / 180.0); + this.head.yRot = Mth.clamp(armadilloRenderState.yRot, -32.5F, 32.5F) * (float) (Math.PI / 180.0); } - this.animateWalk(ArmadilloAnimation.ARMADILLO_WALK, limbSwing, limbSwingAmount, 16.5F, 2.5F); - this.animate(entity.rollOutAnimationState, ArmadilloAnimation.ARMADILLO_ROLL_OUT, ageInTicks, 1.0F); - this.animate(entity.rollUpAnimationState, ArmadilloAnimation.ARMADILLO_ROLL_UP, ageInTicks, 1.0F); - this.animate(entity.peekAnimationState, ArmadilloAnimation.ARMADILLO_PEEK, ageInTicks, 1.0F); + this.animateWalk(ArmadilloAnimation.ARMADILLO_WALK, armadilloRenderState.walkAnimationPos, armadilloRenderState.walkAnimationSpeed, 16.5F, 2.5F); + this.animate(armadilloRenderState.rollOutAnimationState, ArmadilloAnimation.ARMADILLO_ROLL_OUT, armadilloRenderState.ageInTicks, 1.0F); + this.animate(armadilloRenderState.rollUpAnimationState, ArmadilloAnimation.ARMADILLO_ROLL_UP, armadilloRenderState.ageInTicks, 1.0F); + this.animate(armadilloRenderState.peekAnimationState, ArmadilloAnimation.ARMADILLO_PEEK, armadilloRenderState.ageInTicks, 1.0F); } } diff --git a/net/minecraft/client/model/ArmorStandArmorModel.java b/net/minecraft/client/model/ArmorStandArmorModel.java index 0a804a0c..edc0ab44 100644 --- a/net/minecraft/client/model/ArmorStandArmorModel.java +++ b/net/minecraft/client/model/ArmorStandArmorModel.java @@ -9,10 +9,10 @@ import net.minecraft.client.model.geom.builders.CubeListBuilder; import net.minecraft.client.model.geom.builders.LayerDefinition; import net.minecraft.client.model.geom.builders.MeshDefinition; import net.minecraft.client.model.geom.builders.PartDefinition; -import net.minecraft.world.entity.decoration.ArmorStand; +import net.minecraft.client.renderer.entity.state.ArmorStandRenderState; @Environment(EnvType.CLIENT) -public class ArmorStandArmorModel extends HumanoidModel { +public class ArmorStandArmorModel extends HumanoidModel { public ArmorStandArmorModel(ModelPart root) { super(root); } @@ -20,13 +20,11 @@ public class ArmorStandArmorModel extends HumanoidModel { public static LayerDefinition createBodyLayer(CubeDeformation cubeDeformation) { MeshDefinition meshDefinition = HumanoidModel.createMesh(cubeDeformation, 0.0F); PartDefinition partDefinition = meshDefinition.getRoot(); - partDefinition.addOrReplaceChild( + PartDefinition partDefinition2 = partDefinition.addOrReplaceChild( "head", CubeListBuilder.create().texOffs(0, 0).addBox(-4.0F, -8.0F, -4.0F, 8.0F, 8.0F, 8.0F, cubeDeformation), PartPose.offset(0.0F, 1.0F, 0.0F) ); - partDefinition.addOrReplaceChild( - "hat", - CubeListBuilder.create().texOffs(32, 0).addBox(-4.0F, -8.0F, -4.0F, 8.0F, 8.0F, 8.0F, cubeDeformation.extend(0.5F)), - PartPose.offset(0.0F, 1.0F, 0.0F) + partDefinition2.addOrReplaceChild( + "hat", CubeListBuilder.create().texOffs(32, 0).addBox(-4.0F, -8.0F, -4.0F, 8.0F, 8.0F, 8.0F, cubeDeformation.extend(0.5F)), PartPose.ZERO ); partDefinition.addOrReplaceChild( "right_leg", @@ -41,28 +39,25 @@ public class ArmorStandArmorModel extends HumanoidModel { return LayerDefinition.create(meshDefinition, 64, 32); } - /** - * Sets this entity's model rotation angles - */ - public void setupAnim(ArmorStand entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { - this.head.xRot = (float) (Math.PI / 180.0) * entity.getHeadPose().getX(); - this.head.yRot = (float) (Math.PI / 180.0) * entity.getHeadPose().getY(); - this.head.zRot = (float) (Math.PI / 180.0) * entity.getHeadPose().getZ(); - this.body.xRot = (float) (Math.PI / 180.0) * entity.getBodyPose().getX(); - this.body.yRot = (float) (Math.PI / 180.0) * entity.getBodyPose().getY(); - this.body.zRot = (float) (Math.PI / 180.0) * entity.getBodyPose().getZ(); - this.leftArm.xRot = (float) (Math.PI / 180.0) * entity.getLeftArmPose().getX(); - this.leftArm.yRot = (float) (Math.PI / 180.0) * entity.getLeftArmPose().getY(); - this.leftArm.zRot = (float) (Math.PI / 180.0) * entity.getLeftArmPose().getZ(); - this.rightArm.xRot = (float) (Math.PI / 180.0) * entity.getRightArmPose().getX(); - this.rightArm.yRot = (float) (Math.PI / 180.0) * entity.getRightArmPose().getY(); - this.rightArm.zRot = (float) (Math.PI / 180.0) * entity.getRightArmPose().getZ(); - this.leftLeg.xRot = (float) (Math.PI / 180.0) * entity.getLeftLegPose().getX(); - this.leftLeg.yRot = (float) (Math.PI / 180.0) * entity.getLeftLegPose().getY(); - this.leftLeg.zRot = (float) (Math.PI / 180.0) * entity.getLeftLegPose().getZ(); - this.rightLeg.xRot = (float) (Math.PI / 180.0) * entity.getRightLegPose().getX(); - this.rightLeg.yRot = (float) (Math.PI / 180.0) * entity.getRightLegPose().getY(); - this.rightLeg.zRot = (float) (Math.PI / 180.0) * entity.getRightLegPose().getZ(); - this.hat.copyFrom(this.head); + public void setupAnim(ArmorStandRenderState armorStandRenderState) { + super.setupAnim(armorStandRenderState); + this.head.xRot = (float) (Math.PI / 180.0) * armorStandRenderState.headPose.getX(); + this.head.yRot = (float) (Math.PI / 180.0) * armorStandRenderState.headPose.getY(); + this.head.zRot = (float) (Math.PI / 180.0) * armorStandRenderState.headPose.getZ(); + this.body.xRot = (float) (Math.PI / 180.0) * armorStandRenderState.bodyPose.getX(); + this.body.yRot = (float) (Math.PI / 180.0) * armorStandRenderState.bodyPose.getY(); + this.body.zRot = (float) (Math.PI / 180.0) * armorStandRenderState.bodyPose.getZ(); + this.leftArm.xRot = (float) (Math.PI / 180.0) * armorStandRenderState.leftArmPose.getX(); + this.leftArm.yRot = (float) (Math.PI / 180.0) * armorStandRenderState.leftArmPose.getY(); + this.leftArm.zRot = (float) (Math.PI / 180.0) * armorStandRenderState.leftArmPose.getZ(); + this.rightArm.xRot = (float) (Math.PI / 180.0) * armorStandRenderState.rightArmPose.getX(); + this.rightArm.yRot = (float) (Math.PI / 180.0) * armorStandRenderState.rightArmPose.getY(); + this.rightArm.zRot = (float) (Math.PI / 180.0) * armorStandRenderState.rightArmPose.getZ(); + this.leftLeg.xRot = (float) (Math.PI / 180.0) * armorStandRenderState.leftLegPose.getX(); + this.leftLeg.yRot = (float) (Math.PI / 180.0) * armorStandRenderState.leftLegPose.getY(); + this.leftLeg.zRot = (float) (Math.PI / 180.0) * armorStandRenderState.leftLegPose.getZ(); + this.rightLeg.xRot = (float) (Math.PI / 180.0) * armorStandRenderState.rightLegPose.getX(); + this.rightLeg.yRot = (float) (Math.PI / 180.0) * armorStandRenderState.rightLegPose.getY(); + this.rightLeg.zRot = (float) (Math.PI / 180.0) * armorStandRenderState.rightLegPose.getZ(); } } diff --git a/net/minecraft/client/model/ArmorStandModel.java b/net/minecraft/client/model/ArmorStandModel.java index 3314c731..8266450a 100644 --- a/net/minecraft/client/model/ArmorStandModel.java +++ b/net/minecraft/client/model/ArmorStandModel.java @@ -1,7 +1,5 @@ package net.minecraft.client.model; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.Iterables; import com.mojang.blaze3d.vertex.PoseStack; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; @@ -12,9 +10,8 @@ import net.minecraft.client.model.geom.builders.CubeListBuilder; import net.minecraft.client.model.geom.builders.LayerDefinition; import net.minecraft.client.model.geom.builders.MeshDefinition; import net.minecraft.client.model.geom.builders.PartDefinition; -import net.minecraft.util.Mth; +import net.minecraft.client.renderer.entity.state.ArmorStandRenderState; import net.minecraft.world.entity.HumanoidArm; -import net.minecraft.world.entity.decoration.ArmorStand; @Environment(EnvType.CLIENT) public class ArmorStandModel extends ArmorStandArmorModel { @@ -64,32 +61,22 @@ public class ArmorStandModel extends ArmorStandArmorModel { return LayerDefinition.create(meshDefinition, 64, 64); } - public void prepareMobModel(ArmorStand entity, float limbSwing, float limbSwingAmount, float partialTick) { - this.basePlate.xRot = 0.0F; - this.basePlate.yRot = (float) (Math.PI / 180.0) * -Mth.rotLerp(partialTick, entity.yRotO, entity.getYRot()); - this.basePlate.zRot = 0.0F; - } - @Override - public void setupAnim(ArmorStand entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { - super.setupAnim(entity, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch); - this.leftArm.visible = entity.isShowArms(); - this.rightArm.visible = entity.isShowArms(); - this.basePlate.visible = !entity.isNoBasePlate(); - this.rightBodyStick.xRot = (float) (Math.PI / 180.0) * entity.getBodyPose().getX(); - this.rightBodyStick.yRot = (float) (Math.PI / 180.0) * entity.getBodyPose().getY(); - this.rightBodyStick.zRot = (float) (Math.PI / 180.0) * entity.getBodyPose().getZ(); - this.leftBodyStick.xRot = (float) (Math.PI / 180.0) * entity.getBodyPose().getX(); - this.leftBodyStick.yRot = (float) (Math.PI / 180.0) * entity.getBodyPose().getY(); - this.leftBodyStick.zRot = (float) (Math.PI / 180.0) * entity.getBodyPose().getZ(); - this.shoulderStick.xRot = (float) (Math.PI / 180.0) * entity.getBodyPose().getX(); - this.shoulderStick.yRot = (float) (Math.PI / 180.0) * entity.getBodyPose().getY(); - this.shoulderStick.zRot = (float) (Math.PI / 180.0) * entity.getBodyPose().getZ(); - } - - @Override - protected Iterable bodyParts() { - return Iterables.concat(super.bodyParts(), ImmutableList.of(this.rightBodyStick, this.leftBodyStick, this.shoulderStick, this.basePlate)); + public void setupAnim(ArmorStandRenderState armorStandRenderState) { + super.setupAnim(armorStandRenderState); + this.basePlate.yRot = (float) (Math.PI / 180.0) * -armorStandRenderState.yRot; + this.leftArm.visible = armorStandRenderState.showArms; + this.rightArm.visible = armorStandRenderState.showArms; + this.basePlate.visible = armorStandRenderState.showBasePlate; + this.rightBodyStick.xRot = (float) (Math.PI / 180.0) * armorStandRenderState.bodyPose.getX(); + this.rightBodyStick.yRot = (float) (Math.PI / 180.0) * armorStandRenderState.bodyPose.getY(); + this.rightBodyStick.zRot = (float) (Math.PI / 180.0) * armorStandRenderState.bodyPose.getZ(); + this.leftBodyStick.xRot = (float) (Math.PI / 180.0) * armorStandRenderState.bodyPose.getX(); + this.leftBodyStick.yRot = (float) (Math.PI / 180.0) * armorStandRenderState.bodyPose.getY(); + this.leftBodyStick.zRot = (float) (Math.PI / 180.0) * armorStandRenderState.bodyPose.getZ(); + this.shoulderStick.xRot = (float) (Math.PI / 180.0) * armorStandRenderState.bodyPose.getX(); + this.shoulderStick.yRot = (float) (Math.PI / 180.0) * armorStandRenderState.bodyPose.getY(); + this.shoulderStick.zRot = (float) (Math.PI / 180.0) * armorStandRenderState.bodyPose.getZ(); } @Override diff --git a/net/minecraft/client/model/ArrowModel.java b/net/minecraft/client/model/ArrowModel.java new file mode 100644 index 00000000..7343ca7f --- /dev/null +++ b/net/minecraft/client/model/ArrowModel.java @@ -0,0 +1,43 @@ +package net.minecraft.client.model; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.entity.state.ArrowRenderState; +import net.minecraft.util.Mth; + +@Environment(EnvType.CLIENT) +public class ArrowModel extends EntityModel { + public ArrowModel(ModelPart modelPart) { + super(modelPart, RenderType::entityCutout); + } + + public static LayerDefinition createBodyLayer() { + MeshDefinition meshDefinition = new MeshDefinition(); + PartDefinition partDefinition = meshDefinition.getRoot(); + partDefinition.addOrReplaceChild( + "back", + CubeListBuilder.create().texOffs(0, 0).addBox(0.0F, -2.5F, -2.5F, 0.0F, 5.0F, 5.0F), + PartPose.offsetAndRotation(-11.0F, 0.0F, 0.0F, (float) (Math.PI / 4), 0.0F, 0.0F).withScale(0.8F) + ); + CubeListBuilder cubeListBuilder = CubeListBuilder.create().texOffs(0, 0).addBox(-12.0F, -2.0F, 0.0F, 16.0F, 4.0F, 0.0F, CubeDeformation.NONE, 1.0F, 0.8F); + partDefinition.addOrReplaceChild("cross_1", cubeListBuilder, PartPose.rotation((float) (Math.PI / 4), 0.0F, 0.0F)); + partDefinition.addOrReplaceChild("cross_2", cubeListBuilder, PartPose.rotation((float) (Math.PI * 3.0 / 4.0), 0.0F, 0.0F)); + return LayerDefinition.create(meshDefinition.transformed(partPose -> partPose.scaled(0.9F)), 32, 32); + } + + public void setupAnim(ArrowRenderState arrowRenderState) { + super.setupAnim(arrowRenderState); + if (arrowRenderState.shake > 0.0F) { + float f = -Mth.sin(arrowRenderState.shake * 3.0F) * arrowRenderState.shake; + this.root.zRot += f * (float) (Math.PI / 180.0); + } + } +} diff --git a/net/minecraft/client/model/AxolotlModel.java b/net/minecraft/client/model/AxolotlModel.java index 6076cffe..cbab8fca 100644 --- a/net/minecraft/client/model/AxolotlModel.java +++ b/net/minecraft/client/model/AxolotlModel.java @@ -1,7 +1,5 @@ package net.minecraft.client.model; -import com.google.common.collect.ImmutableList; -import java.util.Map; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.model.geom.ModelPart; @@ -10,15 +8,15 @@ import net.minecraft.client.model.geom.builders.CubeDeformation; import net.minecraft.client.model.geom.builders.CubeListBuilder; import net.minecraft.client.model.geom.builders.LayerDefinition; import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.MeshTransformer; import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.client.renderer.entity.state.AxolotlRenderState; import net.minecraft.util.Mth; -import net.minecraft.world.entity.LerpingModel; -import net.minecraft.world.entity.animal.axolotl.Axolotl; -import org.joml.Vector3f; @Environment(EnvType.CLIENT) -public class AxolotlModel extends AgeableListModel { +public class AxolotlModel extends EntityModel { public static final float SWIMMING_LEG_XROT = 1.8849558F; + public static final MeshTransformer BABY_TRANSFORMER = MeshTransformer.scaling(0.5F); private final ModelPart tail; private final ModelPart leftHindLeg; private final ModelPart rightHindLeg; @@ -31,7 +29,7 @@ public class AxolotlModel extends AgeableListM private final ModelPart rightGills; public AxolotlModel(ModelPart root) { - super(true, 8.0F, 3.35F); + super(root); this.body = root.getChild("body"); this.head = this.body.getChild("head"); this.rightHindLeg = this.body.getChild("right_hind_leg"); @@ -74,209 +72,141 @@ public class AxolotlModel extends AgeableListM return LayerDefinition.create(meshDefinition, 64, 64); } - @Override - protected Iterable headParts() { - return ImmutableList.of(); - } - - @Override - protected Iterable bodyParts() { - return ImmutableList.of(this.body); - } - - /** - * Sets this entity's model rotation angles - */ - public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { - this.setupInitialAnimationValues(entity, netHeadYaw, headPitch); - if (entity.isPlayingDead()) { - this.setupPlayDeadAnimation(netHeadYaw); - this.saveAnimationValues(entity); - } else { - boolean bl = limbSwingAmount > 1.0E-5F || entity.getXRot() != entity.xRotO || entity.getYRot() != entity.yRotO; - if (entity.isInWaterOrBubble()) { - if (bl) { - this.setupSwimmingAnimation(ageInTicks, headPitch); - } else { - this.setupWaterHoveringAnimation(ageInTicks); - } - - this.saveAnimationValues(entity); - } else { - if (entity.onGround()) { - if (bl) { - this.setupGroundCrawlingAnimation(ageInTicks, netHeadYaw); - } else { - this.setupLayStillOnGroundAnimation(ageInTicks, netHeadYaw); - } - } - - this.saveAnimationValues(entity); - } - } - } - - private void saveAnimationValues(T axolotl) { - Map map = axolotl.getModelRotationValues(); - map.put("body", this.getRotationVector(this.body)); - map.put("head", this.getRotationVector(this.head)); - map.put("right_hind_leg", this.getRotationVector(this.rightHindLeg)); - map.put("left_hind_leg", this.getRotationVector(this.leftHindLeg)); - map.put("right_front_leg", this.getRotationVector(this.rightFrontLeg)); - map.put("left_front_leg", this.getRotationVector(this.leftFrontLeg)); - map.put("tail", this.getRotationVector(this.tail)); - map.put("top_gills", this.getRotationVector(this.topGills)); - map.put("left_gills", this.getRotationVector(this.leftGills)); - map.put("right_gills", this.getRotationVector(this.rightGills)); - } - - private Vector3f getRotationVector(ModelPart part) { - return new Vector3f(part.xRot, part.yRot, part.zRot); - } - - private void setRotationFromVector(ModelPart part, Vector3f rotation) { - part.setRotation(rotation.x(), rotation.y(), rotation.z()); - } - - private void setupInitialAnimationValues(T axolotl, float netHeadYaw, float headPitch) { - this.body.x = 0.0F; - this.head.y = 0.0F; - this.body.y = 20.0F; - Map map = axolotl.getModelRotationValues(); - if (map.isEmpty()) { - this.body.setRotation(headPitch * (float) (Math.PI / 180.0), netHeadYaw * (float) (Math.PI / 180.0), 0.0F); - this.head.setRotation(0.0F, 0.0F, 0.0F); - this.leftHindLeg.setRotation(0.0F, 0.0F, 0.0F); - this.rightHindLeg.setRotation(0.0F, 0.0F, 0.0F); - this.leftFrontLeg.setRotation(0.0F, 0.0F, 0.0F); - this.rightFrontLeg.setRotation(0.0F, 0.0F, 0.0F); - this.leftGills.setRotation(0.0F, 0.0F, 0.0F); - this.rightGills.setRotation(0.0F, 0.0F, 0.0F); - this.topGills.setRotation(0.0F, 0.0F, 0.0F); - this.tail.setRotation(0.0F, 0.0F, 0.0F); - } else { - this.setRotationFromVector(this.body, (Vector3f)map.get("body")); - this.setRotationFromVector(this.head, (Vector3f)map.get("head")); - this.setRotationFromVector(this.leftHindLeg, (Vector3f)map.get("left_hind_leg")); - this.setRotationFromVector(this.rightHindLeg, (Vector3f)map.get("right_hind_leg")); - this.setRotationFromVector(this.leftFrontLeg, (Vector3f)map.get("left_front_leg")); - this.setRotationFromVector(this.rightFrontLeg, (Vector3f)map.get("right_front_leg")); - this.setRotationFromVector(this.leftGills, (Vector3f)map.get("left_gills")); - this.setRotationFromVector(this.rightGills, (Vector3f)map.get("right_gills")); - this.setRotationFromVector(this.topGills, (Vector3f)map.get("top_gills")); - this.setRotationFromVector(this.tail, (Vector3f)map.get("tail")); - } - } - - private float lerpTo(float start, float end) { - return this.lerpTo(0.05F, start, end); - } - - private float lerpTo(float delta, float start, float end) { - return Mth.rotLerp(delta, start, end); - } - - private void lerpPart(ModelPart part, float xDelta, float yDelta, float zDelta) { - part.setRotation(this.lerpTo(part.xRot, xDelta), this.lerpTo(part.yRot, yDelta), this.lerpTo(part.zRot, zDelta)); + public void setupAnim(AxolotlRenderState axolotlRenderState) { + super.setupAnim(axolotlRenderState); + float f = axolotlRenderState.playingDeadFactor; + float g = axolotlRenderState.inWaterFactor; + float h = axolotlRenderState.onGroundFactor; + float i = axolotlRenderState.movingFactor; + float j = 1.0F - i; + float k = 1.0F - Math.min(h, i); + this.body.yRot = this.body.yRot + axolotlRenderState.yRot * (float) (Math.PI / 180.0); + this.setupSwimmingAnimation(axolotlRenderState.ageInTicks, axolotlRenderState.xRot, Math.min(i, g)); + this.setupWaterHoveringAnimation(axolotlRenderState.ageInTicks, Math.min(j, g)); + this.setupGroundCrawlingAnimation(axolotlRenderState.ageInTicks, Math.min(i, h)); + this.setupLayStillOnGroundAnimation(axolotlRenderState.ageInTicks, Math.min(j, h)); + this.setupPlayDeadAnimation(f); + this.applyMirrorLegRotations(k); } private void setupLayStillOnGroundAnimation(float ageInTicks, float netHeadYaw) { - float f = ageInTicks * 0.09F; - float g = Mth.sin(f); - float h = Mth.cos(f); - float i = g * g - 2.0F * g; - float j = h * h - 3.0F * g; - this.head.xRot = this.lerpTo(this.head.xRot, -0.09F * i); - this.head.yRot = this.lerpTo(this.head.yRot, 0.0F); - this.head.zRot = this.lerpTo(this.head.zRot, -0.2F); - this.tail.yRot = this.lerpTo(this.tail.yRot, -0.1F + 0.1F * i); - this.topGills.xRot = this.lerpTo(this.topGills.xRot, 0.6F + 0.05F * j); - this.leftGills.yRot = this.lerpTo(this.leftGills.yRot, -this.topGills.xRot); - this.rightGills.yRot = this.lerpTo(this.rightGills.yRot, -this.leftGills.yRot); - this.lerpPart(this.leftHindLeg, 1.1F, 1.0F, 0.0F); - this.lerpPart(this.leftFrontLeg, 0.8F, 2.3F, -0.5F); - this.applyMirrorLegRotations(); - this.body.xRot = this.lerpTo(0.2F, this.body.xRot, 0.0F); - this.body.yRot = this.lerpTo(this.body.yRot, netHeadYaw * (float) (Math.PI / 180.0)); - this.body.zRot = this.lerpTo(this.body.zRot, 0.0F); + if (!(netHeadYaw <= 1.0E-5F)) { + float f = ageInTicks * 0.09F; + float g = Mth.sin(f); + float h = Mth.cos(f); + float i = g * g - 2.0F * g; + float j = h * h - 3.0F * g; + this.head.xRot += -0.09F * i * netHeadYaw; + this.head.zRot += -0.2F * netHeadYaw; + this.tail.yRot += (-0.1F + 0.1F * i) * netHeadYaw; + float k = (0.6F + 0.05F * j) * netHeadYaw; + this.topGills.xRot += k; + this.leftGills.yRot -= k; + this.rightGills.yRot += k; + this.leftHindLeg.xRot += 1.1F * netHeadYaw; + this.leftHindLeg.yRot += 1.0F * netHeadYaw; + this.leftFrontLeg.xRot += 0.8F * netHeadYaw; + this.leftFrontLeg.yRot += 2.3F * netHeadYaw; + this.leftFrontLeg.zRot -= 0.5F * netHeadYaw; + } } private void setupGroundCrawlingAnimation(float ageInTicks, float netHeadYaw) { - float f = ageInTicks * 0.11F; - float g = Mth.cos(f); - float h = (g * g - 2.0F * g) / 5.0F; - float i = 0.7F * g; - this.head.xRot = this.lerpTo(this.head.xRot, 0.0F); - this.head.yRot = this.lerpTo(this.head.yRot, 0.09F * g); - this.head.zRot = this.lerpTo(this.head.zRot, 0.0F); - this.tail.yRot = this.lerpTo(this.tail.yRot, this.head.yRot); - this.topGills.xRot = this.lerpTo(this.topGills.xRot, 0.6F - 0.08F * (g * g + 2.0F * Mth.sin(f))); - this.leftGills.yRot = this.lerpTo(this.leftGills.yRot, -this.topGills.xRot); - this.rightGills.yRot = this.lerpTo(this.rightGills.yRot, -this.leftGills.yRot); - this.lerpPart(this.leftHindLeg, 0.9424779F, 1.5F - h, -0.1F); - this.lerpPart(this.leftFrontLeg, 1.0995574F, (float) (Math.PI / 2) - i, 0.0F); - this.lerpPart(this.rightHindLeg, this.leftHindLeg.xRot, -1.0F - h, 0.0F); - this.lerpPart(this.rightFrontLeg, this.leftFrontLeg.xRot, (float) (-Math.PI / 2) - i, 0.0F); - this.body.xRot = this.lerpTo(0.2F, this.body.xRot, 0.0F); - this.body.yRot = this.lerpTo(this.body.yRot, netHeadYaw * (float) (Math.PI / 180.0)); - this.body.zRot = this.lerpTo(this.body.zRot, 0.0F); + if (!(netHeadYaw <= 1.0E-5F)) { + float f = ageInTicks * 0.11F; + float g = Mth.cos(f); + float h = (g * g - 2.0F * g) / 5.0F; + float i = 0.7F * g; + float j = 0.09F * g * netHeadYaw; + this.head.yRot += j; + this.tail.yRot += j; + float k = (0.6F - 0.08F * (g * g + 2.0F * Mth.sin(f))) * netHeadYaw; + this.topGills.xRot += k; + this.leftGills.yRot -= k; + this.rightGills.yRot += k; + float l = 0.9424779F * netHeadYaw; + float m = 1.0995574F * netHeadYaw; + this.leftHindLeg.xRot += l; + this.leftHindLeg.yRot += (1.5F - h) * netHeadYaw; + this.leftHindLeg.zRot += -0.1F * netHeadYaw; + this.leftFrontLeg.xRot += m; + this.leftFrontLeg.yRot += ((float) (Math.PI / 2) - i) * netHeadYaw; + this.rightHindLeg.xRot += l; + this.rightHindLeg.yRot += (-1.0F - h) * netHeadYaw; + this.rightFrontLeg.xRot += m; + this.rightFrontLeg.yRot += ((float) (-Math.PI / 2) - i) * netHeadYaw; + } } - private void setupWaterHoveringAnimation(float ageInTicks) { - float f = ageInTicks * 0.075F; - float g = Mth.cos(f); - float h = Mth.sin(f) * 0.15F; - this.body.xRot = this.lerpTo(this.body.xRot, -0.15F + 0.075F * g); - this.body.y -= h; - this.head.xRot = this.lerpTo(this.head.xRot, -this.body.xRot); - this.topGills.xRot = this.lerpTo(this.topGills.xRot, 0.2F * g); - this.leftGills.yRot = this.lerpTo(this.leftGills.yRot, -0.3F * g - 0.19F); - this.rightGills.yRot = this.lerpTo(this.rightGills.yRot, -this.leftGills.yRot); - this.lerpPart(this.leftHindLeg, (float) (Math.PI * 3.0 / 4.0) - g * 0.11F, 0.47123894F, 1.7278761F); - this.lerpPart(this.leftFrontLeg, (float) (Math.PI / 4) - g * 0.2F, 2.042035F, 0.0F); - this.applyMirrorLegRotations(); - this.tail.yRot = this.lerpTo(this.tail.yRot, 0.5F * g); - this.head.yRot = this.lerpTo(this.head.yRot, 0.0F); - this.head.zRot = this.lerpTo(this.head.zRot, 0.0F); + private void setupWaterHoveringAnimation(float f, float g) { + if (!(g <= 1.0E-5F)) { + float h = f * 0.075F; + float i = Mth.cos(h); + float j = Mth.sin(h) * 0.15F; + float k = (-0.15F + 0.075F * i) * g; + this.body.xRot += k; + this.body.y -= j * g; + this.head.xRot -= k; + this.topGills.xRot += 0.2F * i * g; + float l = (-0.3F * i - 0.19F) * g; + this.leftGills.yRot += l; + this.rightGills.yRot -= l; + this.leftHindLeg.xRot += ((float) (Math.PI * 3.0 / 4.0) - i * 0.11F) * g; + this.leftHindLeg.yRot += 0.47123894F * g; + this.leftHindLeg.zRot += 1.7278761F * g; + this.leftFrontLeg.xRot += ((float) (Math.PI / 4) - i * 0.2F) * g; + this.leftFrontLeg.yRot += 2.042035F * g; + this.tail.yRot += 0.5F * i * g; + } } - private void setupSwimmingAnimation(float ageInTicks, float headPitch) { - float f = ageInTicks * 0.33F; - float g = Mth.sin(f); - float h = Mth.cos(f); - float i = 0.13F * g; - this.body.xRot = this.lerpTo(0.1F, this.body.xRot, headPitch * (float) (Math.PI / 180.0) + i); - this.head.xRot = -i * 1.8F; - this.body.y -= 0.45F * h; - this.topGills.xRot = this.lerpTo(this.topGills.xRot, -0.5F * g - 0.8F); - this.leftGills.yRot = this.lerpTo(this.leftGills.yRot, 0.3F * g + 0.9F); - this.rightGills.yRot = this.lerpTo(this.rightGills.yRot, -this.leftGills.yRot); - this.tail.yRot = this.lerpTo(this.tail.yRot, 0.3F * Mth.cos(f * 0.9F)); - this.lerpPart(this.leftHindLeg, 1.8849558F, -0.4F * g, (float) (Math.PI / 2)); - this.lerpPart(this.leftFrontLeg, 1.8849558F, -0.2F * h - 0.1F, (float) (Math.PI / 2)); - this.applyMirrorLegRotations(); - this.head.yRot = this.lerpTo(this.head.yRot, 0.0F); - this.head.zRot = this.lerpTo(this.head.zRot, 0.0F); + private void setupSwimmingAnimation(float f, float g, float h) { + if (!(h <= 1.0E-5F)) { + float i = f * 0.33F; + float j = Mth.sin(i); + float k = Mth.cos(i); + float l = 0.13F * j; + this.body.xRot += (g * (float) (Math.PI / 180.0) + l) * h; + this.head.xRot -= l * 1.8F * h; + this.body.y -= 0.45F * k * h; + this.topGills.xRot += (-0.5F * j - 0.8F) * h; + float m = (0.3F * j + 0.9F) * h; + this.leftGills.yRot += m; + this.rightGills.yRot -= m; + this.tail.yRot = this.tail.yRot + 0.3F * Mth.cos(i * 0.9F) * h; + this.leftHindLeg.xRot += 1.8849558F * h; + this.leftHindLeg.yRot += -0.4F * j * h; + this.leftHindLeg.zRot += (float) (Math.PI / 2) * h; + this.leftFrontLeg.xRot += 1.8849558F * h; + this.leftFrontLeg.yRot += (-0.2F * k - 0.1F) * h; + this.leftFrontLeg.zRot += (float) (Math.PI / 2) * h; + } } private void setupPlayDeadAnimation(float netHeadYaw) { - this.lerpPart(this.leftHindLeg, 1.4137167F, 1.0995574F, (float) (Math.PI / 4)); - this.lerpPart(this.leftFrontLeg, (float) (Math.PI / 4), 2.042035F, 0.0F); - this.body.xRot = this.lerpTo(this.body.xRot, -0.15F); - this.body.zRot = this.lerpTo(this.body.zRot, 0.35F); - this.applyMirrorLegRotations(); - this.body.yRot = this.lerpTo(this.body.yRot, netHeadYaw * (float) (Math.PI / 180.0)); - this.head.xRot = this.lerpTo(this.head.xRot, 0.0F); - this.head.yRot = this.lerpTo(this.head.yRot, 0.0F); - this.head.zRot = this.lerpTo(this.head.zRot, 0.0F); - this.tail.yRot = this.lerpTo(this.tail.yRot, 0.0F); - this.lerpPart(this.topGills, 0.0F, 0.0F, 0.0F); - this.lerpPart(this.leftGills, 0.0F, 0.0F, 0.0F); - this.lerpPart(this.rightGills, 0.0F, 0.0F, 0.0F); + if (!(netHeadYaw <= 1.0E-5F)) { + this.leftHindLeg.xRot += 1.4137167F * netHeadYaw; + this.leftHindLeg.yRot += 1.0995574F * netHeadYaw; + this.leftHindLeg.zRot += (float) (Math.PI / 4) * netHeadYaw; + this.leftFrontLeg.xRot += (float) (Math.PI / 4) * netHeadYaw; + this.leftFrontLeg.yRot += 2.042035F * netHeadYaw; + this.body.xRot += -0.15F * netHeadYaw; + this.body.zRot += 0.35F * netHeadYaw; + } } - private void applyMirrorLegRotations() { - this.lerpPart(this.rightHindLeg, this.leftHindLeg.xRot, -this.leftHindLeg.yRot, -this.leftHindLeg.zRot); - this.lerpPart(this.rightFrontLeg, this.leftFrontLeg.xRot, -this.leftFrontLeg.yRot, -this.leftFrontLeg.zRot); + private void applyMirrorLegRotations(float f) { + if (!(f <= 1.0E-5F)) { + this.rightHindLeg.xRot = this.rightHindLeg.xRot + this.leftHindLeg.xRot * f; + ModelPart var2 = this.rightHindLeg; + var2.yRot = var2.yRot + -this.leftHindLeg.yRot * f; + var2 = this.rightHindLeg; + var2.zRot = var2.zRot + -this.leftHindLeg.zRot * f; + this.rightFrontLeg.xRot = this.rightFrontLeg.xRot + this.leftFrontLeg.xRot * f; + var2 = this.rightFrontLeg; + var2.yRot = var2.yRot + -this.leftFrontLeg.yRot * f; + var2 = this.rightFrontLeg; + var2.zRot = var2.zRot + -this.leftFrontLeg.zRot * f; + } } } diff --git a/net/minecraft/client/model/BabyModelTransform.java b/net/minecraft/client/model/BabyModelTransform.java new file mode 100644 index 00000000..6e31eb30 --- /dev/null +++ b/net/minecraft/client/model/BabyModelTransform.java @@ -0,0 +1,41 @@ +package net.minecraft.client.model; + +import java.util.Set; +import java.util.Map.Entry; +import java.util.function.UnaryOperator; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.MeshTransformer; +import net.minecraft.client.model.geom.builders.PartDefinition; + +@Environment(EnvType.CLIENT) +public record BabyModelTransform( + boolean scaleHead, float babyYHeadOffset, float babyZHeadOffset, float babyHeadScale, float babyBodyScale, float bodyYOffset, Set headParts +) implements MeshTransformer { + public BabyModelTransform(Set set) { + this(false, 5.0F, 2.0F, set); + } + + public BabyModelTransform(boolean bl, float f, float g, Set set) { + this(bl, f, g, 2.0F, 2.0F, 24.0F, set); + } + + @Override + public MeshDefinition apply(MeshDefinition meshDefinition) { + float f = this.scaleHead ? 1.5F / this.babyHeadScale : 1.0F; + float g = 1.0F / this.babyBodyScale; + UnaryOperator unaryOperator = partPose -> partPose.translated(0.0F, this.babyYHeadOffset, this.babyZHeadOffset).scaled(f); + UnaryOperator unaryOperator2 = partPose -> partPose.translated(0.0F, this.bodyYOffset, 0.0F).scaled(g); + MeshDefinition meshDefinition2 = new MeshDefinition(); + + for (Entry entry : meshDefinition.getRoot().getChildren()) { + String string = (String)entry.getKey(); + PartDefinition partDefinition = (PartDefinition)entry.getValue(); + meshDefinition2.getRoot().addOrReplaceChild(string, partDefinition.transformed(this.headParts.contains(string) ? unaryOperator : unaryOperator2)); + } + + return meshDefinition2; + } +} diff --git a/net/minecraft/client/model/BatModel.java b/net/minecraft/client/model/BatModel.java index 96048066..733f3a67 100644 --- a/net/minecraft/client/model/BatModel.java +++ b/net/minecraft/client/model/BatModel.java @@ -10,11 +10,10 @@ import net.minecraft.client.model.geom.builders.LayerDefinition; import net.minecraft.client.model.geom.builders.MeshDefinition; import net.minecraft.client.model.geom.builders.PartDefinition; import net.minecraft.client.renderer.RenderType; -import net.minecraft.world.entity.ambient.Bat; +import net.minecraft.client.renderer.entity.state.BatRenderState; @Environment(EnvType.CLIENT) -public class BatModel extends HierarchicalModel { - private final ModelPart root; +public class BatModel extends EntityModel { private final ModelPart head; private final ModelPart body; private final ModelPart rightWing; @@ -24,8 +23,7 @@ public class BatModel extends HierarchicalModel { private final ModelPart feet; public BatModel(ModelPart root) { - super(RenderType::entityCutout); - this.root = root; + super(root, RenderType::entityCutout); this.body = root.getChild("body"); this.head = root.getChild("head"); this.rightWing = this.body.getChild("right_wing"); @@ -68,22 +66,14 @@ public class BatModel extends HierarchicalModel { return LayerDefinition.create(meshDefinition, 32, 32); } - @Override - public ModelPart root() { - return this.root; - } - - /** - * Sets this entity's model rotation angles - */ - public void setupAnim(Bat entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { - this.root().getAllParts().forEach(ModelPart::resetPose); - if (entity.isResting()) { - this.applyHeadRotation(netHeadYaw); + public void setupAnim(BatRenderState batRenderState) { + super.setupAnim(batRenderState); + if (batRenderState.isResting) { + this.applyHeadRotation(batRenderState.yRot); } - this.animate(entity.flyAnimationState, BatAnimation.BAT_FLYING, ageInTicks, 1.0F); - this.animate(entity.restAnimationState, BatAnimation.BAT_RESTING, ageInTicks, 1.0F); + this.animate(batRenderState.flyAnimationState, BatAnimation.BAT_FLYING, batRenderState.ageInTicks, 1.0F); + this.animate(batRenderState.restAnimationState, BatAnimation.BAT_RESTING, batRenderState.ageInTicks, 1.0F); } private void applyHeadRotation(float headRotation) { diff --git a/net/minecraft/client/model/BeeModel.java b/net/minecraft/client/model/BeeModel.java index 009b01d5..df8d8e9e 100644 --- a/net/minecraft/client/model/BeeModel.java +++ b/net/minecraft/client/model/BeeModel.java @@ -1,6 +1,5 @@ package net.minecraft.client.model; -import com.google.common.collect.ImmutableList; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.model.geom.ModelPart; @@ -9,13 +8,14 @@ import net.minecraft.client.model.geom.builders.CubeDeformation; import net.minecraft.client.model.geom.builders.CubeListBuilder; import net.minecraft.client.model.geom.builders.LayerDefinition; import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.MeshTransformer; import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.client.renderer.entity.state.BeeRenderState; import net.minecraft.util.Mth; -import net.minecraft.world.entity.animal.Bee; @Environment(EnvType.CLIENT) -public class BeeModel extends AgeableListModel { - private static final float BEE_Y_BASE = 19.0F; +public class BeeModel extends EntityModel { + public static final MeshTransformer BABY_TRANSFORMER = MeshTransformer.scaling(0.5F); private static final String BONE = "bone"; private static final String STINGER = "stinger"; private static final String LEFT_ANTENNA = "left_antenna"; @@ -35,7 +35,7 @@ public class BeeModel extends AgeableListModel { private float rollAmount; public BeeModel(ModelPart root) { - super(false, 24.0F, 0.0F); + super(root); this.bone = root.getChild("bone"); ModelPart modelPart = this.bone.getChild("body"); this.stinger = modelPart.getChild("stinger"); @@ -85,32 +85,12 @@ public class BeeModel extends AgeableListModel { return LayerDefinition.create(meshDefinition, 64, 64); } - public void prepareMobModel(T entity, float limbSwing, float limbSwingAmount, float partialTick) { - super.prepareMobModel(entity, limbSwing, limbSwingAmount, partialTick); - this.rollAmount = entity.getRollAmount(partialTick); - this.stinger.visible = !entity.hasStung(); - } - - /** - * Sets this entity's model rotation angles - */ - public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { - this.rightWing.xRot = 0.0F; - this.leftAntenna.xRot = 0.0F; - this.rightAntenna.xRot = 0.0F; - this.bone.xRot = 0.0F; - boolean bl = entity.onGround() && entity.getDeltaMovement().lengthSqr() < 1.0E-7; - if (bl) { - this.rightWing.yRot = -0.2618F; - this.rightWing.zRot = 0.0F; - this.leftWing.xRot = 0.0F; - this.leftWing.yRot = 0.2618F; - this.leftWing.zRot = 0.0F; - this.frontLeg.xRot = 0.0F; - this.midLeg.xRot = 0.0F; - this.backLeg.xRot = 0.0F; - } else { - float f = ageInTicks * 120.32113F * (float) (Math.PI / 180.0); + public void setupAnim(BeeRenderState beeRenderState) { + super.setupAnim(beeRenderState); + this.rollAmount = beeRenderState.rollAmount; + this.stinger.visible = beeRenderState.hasStinger; + if (!beeRenderState.isOnGround) { + float f = beeRenderState.ageInTicks * 120.32113F * (float) (Math.PI / 180.0); this.rightWing.yRot = 0.0F; this.rightWing.zRot = Mth.cos(f) * (float) Math.PI * 0.15F; this.leftWing.xRot = this.rightWing.xRot; @@ -119,38 +99,20 @@ public class BeeModel extends AgeableListModel { this.frontLeg.xRot = (float) (Math.PI / 4); this.midLeg.xRot = (float) (Math.PI / 4); this.backLeg.xRot = (float) (Math.PI / 4); - this.bone.xRot = 0.0F; - this.bone.yRot = 0.0F; - this.bone.zRot = 0.0F; } - if (!entity.isAngry()) { - this.bone.xRot = 0.0F; - this.bone.yRot = 0.0F; - this.bone.zRot = 0.0F; - if (!bl) { - float f = Mth.cos(ageInTicks * 0.18F); - this.bone.xRot = 0.1F + f * (float) Math.PI * 0.025F; - this.leftAntenna.xRot = f * (float) Math.PI * 0.03F; - this.rightAntenna.xRot = f * (float) Math.PI * 0.03F; - this.frontLeg.xRot = -f * (float) Math.PI * 0.1F + (float) (Math.PI / 8); - this.backLeg.xRot = -f * (float) Math.PI * 0.05F + (float) (Math.PI / 4); - this.bone.y = 19.0F - Mth.cos(ageInTicks * 0.18F) * 0.9F; - } + if (!beeRenderState.isAngry && !beeRenderState.isOnGround) { + float f = Mth.cos(beeRenderState.ageInTicks * 0.18F); + this.bone.xRot = 0.1F + f * (float) Math.PI * 0.025F; + this.leftAntenna.xRot = f * (float) Math.PI * 0.03F; + this.rightAntenna.xRot = f * (float) Math.PI * 0.03F; + this.frontLeg.xRot = -f * (float) Math.PI * 0.1F + (float) (Math.PI / 8); + this.backLeg.xRot = -f * (float) Math.PI * 0.05F + (float) (Math.PI / 4); + this.bone.y = this.bone.y - Mth.cos(beeRenderState.ageInTicks * 0.18F) * 0.9F; } if (this.rollAmount > 0.0F) { - this.bone.xRot = ModelUtils.rotlerpRad(this.bone.xRot, 3.0915928F, this.rollAmount); + this.bone.xRot = Mth.rotLerpRad(this.rollAmount, this.bone.xRot, 3.0915928F); } } - - @Override - protected Iterable headParts() { - return ImmutableList.of(); - } - - @Override - protected Iterable bodyParts() { - return ImmutableList.of(this.bone); - } } diff --git a/net/minecraft/client/model/BeeStingerModel.java b/net/minecraft/client/model/BeeStingerModel.java new file mode 100644 index 00000000..4f9fdb1e --- /dev/null +++ b/net/minecraft/client/model/BeeStingerModel.java @@ -0,0 +1,27 @@ +package net.minecraft.client.model; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.client.renderer.RenderType; + +@Environment(EnvType.CLIENT) +public class BeeStingerModel extends Model { + public BeeStingerModel(ModelPart modelPart) { + super(modelPart, RenderType::entityCutout); + } + + public static LayerDefinition createBodyLayer() { + MeshDefinition meshDefinition = new MeshDefinition(); + PartDefinition partDefinition = meshDefinition.getRoot(); + CubeListBuilder cubeListBuilder = CubeListBuilder.create().texOffs(0, 0).addBox(-1.0F, -0.5F, 0.0F, 2.0F, 1.0F, 0.0F); + partDefinition.addOrReplaceChild("cross_1", cubeListBuilder, PartPose.rotation((float) (Math.PI / 4), 0.0F, 0.0F)); + partDefinition.addOrReplaceChild("cross_2", cubeListBuilder, PartPose.rotation((float) (Math.PI * 3.0 / 4.0), 0.0F, 0.0F)); + return LayerDefinition.create(meshDefinition, 16, 16); + } +} diff --git a/net/minecraft/client/model/BellModel.java b/net/minecraft/client/model/BellModel.java new file mode 100644 index 00000000..ed131256 --- /dev/null +++ b/net/minecraft/client/model/BellModel.java @@ -0,0 +1,58 @@ +package net.minecraft.client.model; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.core.Direction; +import net.minecraft.util.Mth; +import net.minecraft.world.level.block.entity.BellBlockEntity; + +@Environment(EnvType.CLIENT) +public class BellModel extends Model { + private static final String BELL_BODY = "bell_body"; + private final ModelPart bellBody; + + public BellModel(ModelPart modelPart) { + super(modelPart, RenderType::entitySolid); + this.bellBody = modelPart.getChild("bell_body"); + } + + public static LayerDefinition createBodyLayer() { + MeshDefinition meshDefinition = new MeshDefinition(); + PartDefinition partDefinition = meshDefinition.getRoot(); + PartDefinition partDefinition2 = partDefinition.addOrReplaceChild( + "bell_body", CubeListBuilder.create().texOffs(0, 0).addBox(-3.0F, -6.0F, -3.0F, 6.0F, 7.0F, 6.0F), PartPose.offset(8.0F, 12.0F, 8.0F) + ); + partDefinition2.addOrReplaceChild( + "bell_base", CubeListBuilder.create().texOffs(0, 13).addBox(4.0F, 4.0F, 4.0F, 8.0F, 2.0F, 8.0F), PartPose.offset(-8.0F, -12.0F, -8.0F) + ); + return LayerDefinition.create(meshDefinition, 32, 32); + } + + public void setupAnim(BellBlockEntity bellBlockEntity, float f) { + float g = bellBlockEntity.ticks + f; + float h = 0.0F; + float i = 0.0F; + if (bellBlockEntity.shaking) { + float j = Mth.sin(g / (float) Math.PI) / (4.0F + g / 3.0F); + if (bellBlockEntity.clickDirection == Direction.NORTH) { + h = -j; + } else if (bellBlockEntity.clickDirection == Direction.SOUTH) { + h = j; + } else if (bellBlockEntity.clickDirection == Direction.EAST) { + i = -j; + } else if (bellBlockEntity.clickDirection == Direction.WEST) { + i = j; + } + } + + this.bellBody.xRot = h; + this.bellBody.zRot = i; + } +} diff --git a/net/minecraft/client/model/BlazeModel.java b/net/minecraft/client/model/BlazeModel.java index f9dc4e42..84494796 100644 --- a/net/minecraft/client/model/BlazeModel.java +++ b/net/minecraft/client/model/BlazeModel.java @@ -9,17 +9,16 @@ import net.minecraft.client.model.geom.builders.CubeListBuilder; import net.minecraft.client.model.geom.builders.LayerDefinition; import net.minecraft.client.model.geom.builders.MeshDefinition; import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.client.renderer.entity.state.LivingEntityRenderState; import net.minecraft.util.Mth; -import net.minecraft.world.entity.Entity; @Environment(EnvType.CLIENT) -public class BlazeModel extends HierarchicalModel { - private final ModelPart root; +public class BlazeModel extends EntityModel { private final ModelPart[] upperBodyParts; private final ModelPart head; public BlazeModel(ModelPart root) { - this.root = root; + super(root); this.head = root.getChild("head"); this.upperBodyParts = new ModelPart[12]; Arrays.setAll(this.upperBodyParts, i -> root.getChild(getPartName(i))); @@ -67,41 +66,36 @@ public class BlazeModel extends HierarchicalModel { return LayerDefinition.create(meshDefinition, 64, 32); } - @Override - public ModelPart root() { - return this.root; - } - - @Override - public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { - float f = ageInTicks * (float) Math.PI * -0.1F; + public void setupAnim(LivingEntityRenderState livingEntityRenderState) { + super.setupAnim(livingEntityRenderState); + float f = livingEntityRenderState.ageInTicks * (float) Math.PI * -0.1F; for (int i = 0; i < 4; i++) { - this.upperBodyParts[i].y = -2.0F + Mth.cos((i * 2 + ageInTicks) * 0.25F); + this.upperBodyParts[i].y = -2.0F + Mth.cos((i * 2 + livingEntityRenderState.ageInTicks) * 0.25F); this.upperBodyParts[i].x = Mth.cos(f) * 9.0F; this.upperBodyParts[i].z = Mth.sin(f) * 9.0F; f++; } - f = (float) (Math.PI / 4) + ageInTicks * (float) Math.PI * 0.03F; + f = (float) (Math.PI / 4) + livingEntityRenderState.ageInTicks * (float) Math.PI * 0.03F; for (int i = 4; i < 8; i++) { - this.upperBodyParts[i].y = 2.0F + Mth.cos((i * 2 + ageInTicks) * 0.25F); + this.upperBodyParts[i].y = 2.0F + Mth.cos((i * 2 + livingEntityRenderState.ageInTicks) * 0.25F); this.upperBodyParts[i].x = Mth.cos(f) * 7.0F; this.upperBodyParts[i].z = Mth.sin(f) * 7.0F; f++; } - f = 0.47123894F + ageInTicks * (float) Math.PI * -0.05F; + f = 0.47123894F + livingEntityRenderState.ageInTicks * (float) Math.PI * -0.05F; for (int i = 8; i < 12; i++) { - this.upperBodyParts[i].y = 11.0F + Mth.cos((i * 1.5F + ageInTicks) * 0.5F); + this.upperBodyParts[i].y = 11.0F + Mth.cos((i * 1.5F + livingEntityRenderState.ageInTicks) * 0.5F); this.upperBodyParts[i].x = Mth.cos(f) * 5.0F; this.upperBodyParts[i].z = Mth.sin(f) * 5.0F; f++; } - this.head.yRot = netHeadYaw * (float) (Math.PI / 180.0); - this.head.xRot = headPitch * (float) (Math.PI / 180.0); + this.head.yRot = livingEntityRenderState.yRot * (float) (Math.PI / 180.0); + this.head.xRot = livingEntityRenderState.xRot * (float) (Math.PI / 180.0); } } diff --git a/net/minecraft/client/model/BoatModel.java b/net/minecraft/client/model/BoatModel.java index fd952fba..36e5a03b 100644 --- a/net/minecraft/client/model/BoatModel.java +++ b/net/minecraft/client/model/BoatModel.java @@ -1,7 +1,5 @@ package net.minecraft.client.model; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableList.Builder; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.model.geom.ModelPart; @@ -10,117 +8,104 @@ import net.minecraft.client.model.geom.builders.CubeListBuilder; import net.minecraft.client.model.geom.builders.LayerDefinition; import net.minecraft.client.model.geom.builders.MeshDefinition; import net.minecraft.client.model.geom.builders.PartDefinition; -import net.minecraft.util.Mth; -import net.minecraft.world.entity.vehicle.Boat; @Environment(EnvType.CLIENT) -public class BoatModel extends ListModel implements WaterPatchModel { - private static final String LEFT_PADDLE = "left_paddle"; - private static final String RIGHT_PADDLE = "right_paddle"; +public class BoatModel extends AbstractBoatModel { + private static final int BOTTOM_WIDTH = 28; + private static final int WIDTH = 32; + private static final int DEPTH = 6; + private static final int LENGTH = 20; + private static final int Y_OFFSET = 4; private static final String WATER_PATCH = "water_patch"; - private static final String BOTTOM = "bottom"; private static final String BACK = "back"; private static final String FRONT = "front"; private static final String RIGHT = "right"; private static final String LEFT = "left"; - private final ModelPart leftPaddle; - private final ModelPart rightPaddle; - private final ModelPart waterPatch; - private final ImmutableList parts; public BoatModel(ModelPart root) { - this.leftPaddle = root.getChild("left_paddle"); - this.rightPaddle = root.getChild("right_paddle"); - this.waterPatch = root.getChild("water_patch"); - this.parts = this.createPartsBuilder(root).build(); + super(root); } - protected Builder createPartsBuilder(ModelPart root) { - Builder builder = new Builder<>(); - builder.add( - root.getChild("bottom"), root.getChild("back"), root.getChild("front"), root.getChild("right"), root.getChild("left"), this.leftPaddle, this.rightPaddle - ); - return builder; - } - - public static void createChildren(PartDefinition root) { - int i = 32; - int j = 6; - int k = 20; - int l = 4; - int m = 28; - root.addOrReplaceChild( + private static void addCommonParts(PartDefinition partDefinition) { + int i = 16; + int j = 14; + int k = 10; + partDefinition.addOrReplaceChild( "bottom", CubeListBuilder.create().texOffs(0, 0).addBox(-14.0F, -9.0F, -3.0F, 28.0F, 16.0F, 3.0F), PartPose.offsetAndRotation(0.0F, 3.0F, 1.0F, (float) (Math.PI / 2), 0.0F, 0.0F) ); - root.addOrReplaceChild( + partDefinition.addOrReplaceChild( "back", CubeListBuilder.create().texOffs(0, 19).addBox(-13.0F, -7.0F, -1.0F, 18.0F, 6.0F, 2.0F), PartPose.offsetAndRotation(-15.0F, 4.0F, 4.0F, 0.0F, (float) (Math.PI * 3.0 / 2.0), 0.0F) ); - root.addOrReplaceChild( + partDefinition.addOrReplaceChild( "front", CubeListBuilder.create().texOffs(0, 27).addBox(-8.0F, -7.0F, -1.0F, 16.0F, 6.0F, 2.0F), PartPose.offsetAndRotation(15.0F, 4.0F, 0.0F, 0.0F, (float) (Math.PI / 2), 0.0F) ); - root.addOrReplaceChild( + partDefinition.addOrReplaceChild( "right", CubeListBuilder.create().texOffs(0, 35).addBox(-14.0F, -7.0F, -1.0F, 28.0F, 6.0F, 2.0F), PartPose.offsetAndRotation(0.0F, 4.0F, -9.0F, 0.0F, (float) Math.PI, 0.0F) ); - root.addOrReplaceChild("left", CubeListBuilder.create().texOffs(0, 43).addBox(-14.0F, -7.0F, -1.0F, 28.0F, 6.0F, 2.0F), PartPose.offset(0.0F, 4.0F, 9.0F)); - int n = 20; - int o = 7; - int p = 6; + partDefinition.addOrReplaceChild( + "left", CubeListBuilder.create().texOffs(0, 43).addBox(-14.0F, -7.0F, -1.0F, 28.0F, 6.0F, 2.0F), PartPose.offset(0.0F, 4.0F, 9.0F) + ); + int l = 20; + int m = 7; + int n = 6; float f = -5.0F; - root.addOrReplaceChild( + partDefinition.addOrReplaceChild( "left_paddle", CubeListBuilder.create().texOffs(62, 0).addBox(-1.0F, 0.0F, -5.0F, 2.0F, 2.0F, 18.0F).addBox(-1.001F, -3.0F, 8.0F, 1.0F, 6.0F, 7.0F), PartPose.offsetAndRotation(3.0F, -5.0F, 9.0F, 0.0F, 0.0F, (float) (Math.PI / 16)) ); - root.addOrReplaceChild( + partDefinition.addOrReplaceChild( "right_paddle", CubeListBuilder.create().texOffs(62, 20).addBox(-1.0F, 0.0F, -5.0F, 2.0F, 2.0F, 18.0F).addBox(0.001F, -3.0F, 8.0F, 1.0F, 6.0F, 7.0F), PartPose.offsetAndRotation(3.0F, -5.0F, -9.0F, 0.0F, (float) Math.PI, (float) (Math.PI / 16)) ); - root.addOrReplaceChild( + } + + public static LayerDefinition createBoatModel() { + MeshDefinition meshDefinition = new MeshDefinition(); + PartDefinition partDefinition = meshDefinition.getRoot(); + addCommonParts(partDefinition); + return LayerDefinition.create(meshDefinition, 128, 64); + } + + public static LayerDefinition createChestBoatModel() { + MeshDefinition meshDefinition = new MeshDefinition(); + PartDefinition partDefinition = meshDefinition.getRoot(); + addCommonParts(partDefinition); + partDefinition.addOrReplaceChild( + "chest_bottom", + CubeListBuilder.create().texOffs(0, 76).addBox(0.0F, 0.0F, 0.0F, 12.0F, 8.0F, 12.0F), + PartPose.offsetAndRotation(-2.0F, -5.0F, -6.0F, 0.0F, (float) (-Math.PI / 2), 0.0F) + ); + partDefinition.addOrReplaceChild( + "chest_lid", + CubeListBuilder.create().texOffs(0, 59).addBox(0.0F, 0.0F, 0.0F, 12.0F, 4.0F, 12.0F), + PartPose.offsetAndRotation(-2.0F, -9.0F, -6.0F, 0.0F, (float) (-Math.PI / 2), 0.0F) + ); + partDefinition.addOrReplaceChild( + "chest_lock", + CubeListBuilder.create().texOffs(0, 59).addBox(0.0F, 0.0F, 0.0F, 2.0F, 4.0F, 1.0F), + PartPose.offsetAndRotation(-1.0F, -6.0F, -1.0F, 0.0F, (float) (-Math.PI / 2), 0.0F) + ); + return LayerDefinition.create(meshDefinition, 128, 128); + } + + public static LayerDefinition createWaterPatch() { + MeshDefinition meshDefinition = new MeshDefinition(); + PartDefinition partDefinition = meshDefinition.getRoot(); + partDefinition.addOrReplaceChild( "water_patch", CubeListBuilder.create().texOffs(0, 0).addBox(-14.0F, -9.0F, -3.0F, 28.0F, 16.0F, 3.0F), PartPose.offsetAndRotation(0.0F, -3.0F, 1.0F, (float) (Math.PI / 2), 0.0F, 0.0F) ); - } - - public static LayerDefinition createBodyModel() { - MeshDefinition meshDefinition = new MeshDefinition(); - PartDefinition partDefinition = meshDefinition.getRoot(); - createChildren(partDefinition); - return LayerDefinition.create(meshDefinition, 128, 64); - } - - /** - * Sets this entity's model rotation angles - */ - public void setupAnim(Boat entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { - animatePaddle(entity, 0, this.leftPaddle, limbSwing); - animatePaddle(entity, 1, this.rightPaddle, limbSwing); - } - - public ImmutableList parts() { - return this.parts; - } - - @Override - public ModelPart waterPatch() { - return this.waterPatch; - } - - private static void animatePaddle(Boat boat, int side, ModelPart paddle, float limbSwing) { - float f = boat.getRowingTime(side, limbSwing); - paddle.xRot = Mth.clampedLerp((float) (-Math.PI / 3), (float) (-Math.PI / 12), (Mth.sin(-f) + 1.0F) / 2.0F); - paddle.yRot = Mth.clampedLerp((float) (-Math.PI / 4), (float) (Math.PI / 4), (Mth.sin(-f + 1.0F) + 1.0F) / 2.0F); - if (side == 1) { - paddle.yRot = (float) Math.PI - paddle.yRot; - } + return LayerDefinition.create(meshDefinition, 0, 0); } } diff --git a/net/minecraft/client/model/BoggedModel.java b/net/minecraft/client/model/BoggedModel.java index 90d61384..fea7e58d 100644 --- a/net/minecraft/client/model/BoggedModel.java +++ b/net/minecraft/client/model/BoggedModel.java @@ -9,10 +9,10 @@ import net.minecraft.client.model.geom.builders.CubeListBuilder; import net.minecraft.client.model.geom.builders.LayerDefinition; import net.minecraft.client.model.geom.builders.MeshDefinition; import net.minecraft.client.model.geom.builders.PartDefinition; -import net.minecraft.world.entity.monster.Bogged; +import net.minecraft.client.renderer.entity.state.BoggedRenderState; @Environment(EnvType.CLIENT) -public class BoggedModel extends SkeletonModel { +public class BoggedModel extends SkeletonModel { private final ModelPart mushrooms; public BoggedModel(ModelPart modelPart) { @@ -24,7 +24,7 @@ public class BoggedModel extends SkeletonModel { MeshDefinition meshDefinition = HumanoidModel.createMesh(CubeDeformation.NONE, 0.0F); PartDefinition partDefinition = meshDefinition.getRoot(); SkeletonModel.createDefaultSkeletonMesh(partDefinition); - PartDefinition partDefinition2 = partDefinition.getChild("head").addOrReplaceChild("mushrooms", CubeListBuilder.create(), PartPose.ZERO); + PartDefinition partDefinition2 = partDefinition.getChild("head").clearChild("mushrooms"); partDefinition2.addOrReplaceChild( "red_mushroom_1", CubeListBuilder.create().texOffs(50, 16).addBox(-3.0F, -3.0F, 0.0F, 6.0F, 4.0F, 0.0F), @@ -58,8 +58,8 @@ public class BoggedModel extends SkeletonModel { return LayerDefinition.create(meshDefinition, 64, 32); } - public void prepareMobModel(Bogged bogged, float f, float g, float h) { - this.mushrooms.visible = !bogged.isSheared(); - super.prepareMobModel(bogged, f, g, h); + public void setupAnim(BoggedRenderState boggedRenderState) { + super.setupAnim(boggedRenderState); + this.mushrooms.visible = !boggedRenderState.isSheared; } } diff --git a/net/minecraft/client/model/BookModel.java b/net/minecraft/client/model/BookModel.java index 5c3c2fd8..3d72a3b6 100644 --- a/net/minecraft/client/model/BookModel.java +++ b/net/minecraft/client/model/BookModel.java @@ -1,7 +1,5 @@ package net.minecraft.client.model; -import com.mojang.blaze3d.vertex.PoseStack; -import com.mojang.blaze3d.vertex.VertexConsumer; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.model.geom.ModelPart; @@ -19,7 +17,6 @@ public class BookModel extends Model { private static final String RIGHT_PAGES = "right_pages"; private static final String FLIP_PAGE_1 = "flip_page1"; private static final String FLIP_PAGE_2 = "flip_page2"; - private final ModelPart root; private final ModelPart leftLid; private final ModelPart rightLid; private final ModelPart leftPages; @@ -28,8 +25,7 @@ public class BookModel extends Model { private final ModelPart flipPage2; public BookModel(ModelPart root) { - super(RenderType::entitySolid); - this.root = root; + super(root, RenderType::entitySolid); this.leftLid = root.getChild("left_lid"); this.rightLid = root.getChild("right_lid"); this.leftPages = root.getChild("left_pages"); @@ -58,15 +54,6 @@ public class BookModel extends Model { return LayerDefinition.create(meshDefinition, 64, 32); } - @Override - public void renderToBuffer(PoseStack poseStack, VertexConsumer buffer, int packedLight, int packedOverlay, int color) { - this.render(poseStack, buffer, packedLight, packedOverlay, color); - } - - public void render(PoseStack poseStack, VertexConsumer buffer, int packedLight, int packedOverlay, int color) { - this.root.render(poseStack, buffer, packedLight, packedOverlay, color); - } - public void setupAnim(float time, float rightPageFlipAmount, float leftPageFlipAmount, float bookOpenAmount) { float f = (Mth.sin(time * 0.02F) * 0.1F + 1.25F) * bookOpenAmount; this.leftLid.yRot = (float) Math.PI + f; diff --git a/net/minecraft/client/model/BreezeModel.java b/net/minecraft/client/model/BreezeModel.java index 14c4df4c..f6c939eb 100644 --- a/net/minecraft/client/model/BreezeModel.java +++ b/net/minecraft/client/model/BreezeModel.java @@ -11,15 +11,13 @@ import net.minecraft.client.model.geom.builders.LayerDefinition; import net.minecraft.client.model.geom.builders.MeshDefinition; import net.minecraft.client.model.geom.builders.PartDefinition; import net.minecraft.client.renderer.RenderType; -import net.minecraft.util.Mth; -import net.minecraft.world.entity.monster.breeze.Breeze; +import net.minecraft.client.renderer.entity.state.BreezeRenderState; @Environment(EnvType.CLIENT) -public class BreezeModel extends HierarchicalModel { +public class BreezeModel extends EntityModel { private static final float WIND_TOP_SPEED = 0.6F; private static final float WIND_MIDDLE_SPEED = 0.8F; private static final float WIND_BOTTOM_SPEED = 1.0F; - private final ModelPart root; private final ModelPart head; private final ModelPart eyes; private final ModelPart wind; @@ -29,8 +27,7 @@ public class BreezeModel extends HierarchicalModel { private final ModelPart rods; public BreezeModel(ModelPart root) { - super(RenderType::entityTranslucent); - this.root = root; + super(root, RenderType::entityTranslucent); this.wind = root.getChild("wind_body"); this.windBottom = this.wind.getChild("wind_bottom"); this.windMid = this.windBottom.getChild("wind_mid"); @@ -109,29 +106,14 @@ public class BreezeModel extends HierarchicalModel { return LayerDefinition.create(meshDefinition, width, height); } - /** - * Sets this entity's model rotation angles - */ - public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { - this.root().getAllParts().forEach(ModelPart::resetPose); - float f = ageInTicks * (float) Math.PI * -0.1F; - this.windTop.x = Mth.cos(f) * 1.0F * 0.6F; - this.windTop.z = Mth.sin(f) * 1.0F * 0.6F; - this.windMid.x = Mth.sin(f) * 0.5F * 0.8F; - this.windMid.z = Mth.cos(f) * 0.8F; - this.windBottom.x = Mth.cos(f) * -0.25F * 1.0F; - this.windBottom.z = Mth.sin(f) * -0.25F * 1.0F; - this.head.y = 4.0F + Mth.cos(f) / 4.0F; - this.rods.yRot = ageInTicks * (float) Math.PI * 0.1F; - this.animate(entity.shoot, BreezeAnimation.SHOOT, ageInTicks); - this.animate(entity.slide, BreezeAnimation.SLIDE, ageInTicks); - this.animate(entity.slideBack, BreezeAnimation.SLIDE_BACK, ageInTicks); - this.animate(entity.longJump, BreezeAnimation.JUMP, ageInTicks); - } - - @Override - public ModelPart root() { - return this.root; + public void setupAnim(BreezeRenderState breezeRenderState) { + super.setupAnim(breezeRenderState); + this.animate(breezeRenderState.idle, BreezeAnimation.IDLE, breezeRenderState.ageInTicks); + this.animate(breezeRenderState.shoot, BreezeAnimation.SHOOT, breezeRenderState.ageInTicks); + this.animate(breezeRenderState.slide, BreezeAnimation.SLIDE, breezeRenderState.ageInTicks); + this.animate(breezeRenderState.slideBack, BreezeAnimation.SLIDE_BACK, breezeRenderState.ageInTicks); + this.animate(breezeRenderState.inhale, BreezeAnimation.INHALE, breezeRenderState.ageInTicks); + this.animate(breezeRenderState.longJump, BreezeAnimation.JUMP, breezeRenderState.ageInTicks); } public ModelPart head() { diff --git a/net/minecraft/client/model/CamelModel.java b/net/minecraft/client/model/CamelModel.java index 7bb76e4d..71f4806e 100644 --- a/net/minecraft/client/model/CamelModel.java +++ b/net/minecraft/client/model/CamelModel.java @@ -1,7 +1,5 @@ package net.minecraft.client.model; -import com.mojang.blaze3d.vertex.PoseStack; -import com.mojang.blaze3d.vertex.VertexConsumer; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.animation.definitions.CamelAnimation; @@ -11,26 +9,25 @@ import net.minecraft.client.model.geom.builders.CubeDeformation; import net.minecraft.client.model.geom.builders.CubeListBuilder; import net.minecraft.client.model.geom.builders.LayerDefinition; import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.MeshTransformer; import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.client.renderer.entity.state.CamelRenderState; import net.minecraft.util.Mth; -import net.minecraft.world.entity.animal.camel.Camel; @Environment(EnvType.CLIENT) -public class CamelModel extends HierarchicalModel { +public class CamelModel extends EntityModel { private static final float MAX_WALK_ANIMATION_SPEED = 2.0F; private static final float WALK_ANIMATION_SCALE_FACTOR = 2.5F; - private static final float BABY_SCALE = 0.45F; - private static final float BABY_Y_OFFSET = 29.35F; + public static final MeshTransformer BABY_TRANSFORMER = MeshTransformer.scaling(0.45F); private static final String SADDLE = "saddle"; private static final String BRIDLE = "bridle"; private static final String REINS = "reins"; - private final ModelPart root; private final ModelPart head; private final ModelPart[] saddleParts; private final ModelPart[] ridingParts; public CamelModel(ModelPart root) { - this.root = root; + super(root); ModelPart modelPart = root.getChild("body"); this.head = modelPart.getChild("head"); this.saddleParts = new ModelPart[]{modelPart.getChild("saddle"), this.head.getChild("bridle")}; @@ -120,37 +117,33 @@ public class CamelModel extends HierarchicalModel { return LayerDefinition.create(meshDefinition, 128, 128); } - /** - * Sets this entity's model rotation angles - */ - public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { - this.root().getAllParts().forEach(ModelPart::resetPose); - this.applyHeadRotation(entity, netHeadYaw, headPitch, ageInTicks); - this.toggleInvisibleParts(entity); - this.animateWalk(CamelAnimation.CAMEL_WALK, limbSwing, limbSwingAmount, 2.0F, 2.5F); - this.animate(entity.sitAnimationState, CamelAnimation.CAMEL_SIT, ageInTicks, 1.0F); - this.animate(entity.sitPoseAnimationState, CamelAnimation.CAMEL_SIT_POSE, ageInTicks, 1.0F); - this.animate(entity.sitUpAnimationState, CamelAnimation.CAMEL_STANDUP, ageInTicks, 1.0F); - this.animate(entity.idleAnimationState, CamelAnimation.CAMEL_IDLE, ageInTicks, 1.0F); - this.animate(entity.dashAnimationState, CamelAnimation.CAMEL_DASH, ageInTicks, 1.0F); + public void setupAnim(CamelRenderState camelRenderState) { + super.setupAnim(camelRenderState); + this.applyHeadRotation(camelRenderState, camelRenderState.yRot, camelRenderState.xRot); + this.toggleInvisibleParts(camelRenderState); + this.animateWalk(CamelAnimation.CAMEL_WALK, camelRenderState.walkAnimationPos, camelRenderState.walkAnimationSpeed, 2.0F, 2.5F); + this.animate(camelRenderState.sitAnimationState, CamelAnimation.CAMEL_SIT, camelRenderState.ageInTicks, 1.0F); + this.animate(camelRenderState.sitPoseAnimationState, CamelAnimation.CAMEL_SIT_POSE, camelRenderState.ageInTicks, 1.0F); + this.animate(camelRenderState.sitUpAnimationState, CamelAnimation.CAMEL_STANDUP, camelRenderState.ageInTicks, 1.0F); + this.animate(camelRenderState.idleAnimationState, CamelAnimation.CAMEL_IDLE, camelRenderState.ageInTicks, 1.0F); + this.animate(camelRenderState.dashAnimationState, CamelAnimation.CAMEL_DASH, camelRenderState.ageInTicks, 1.0F); } - private void applyHeadRotation(T entity, float netHeadYaw, float headPitch, float ageInTicks) { - netHeadYaw = Mth.clamp(netHeadYaw, -30.0F, 30.0F); - headPitch = Mth.clamp(headPitch, -25.0F, 45.0F); - if (entity.getJumpCooldown() > 0) { - float f = ageInTicks - entity.tickCount; - float g = 45.0F * (entity.getJumpCooldown() - f) / 55.0F; - headPitch = Mth.clamp(headPitch + g, -25.0F, 70.0F); + private void applyHeadRotation(CamelRenderState camelRenderState, float f, float g) { + f = Mth.clamp(f, -30.0F, 30.0F); + g = Mth.clamp(g, -25.0F, 45.0F); + if (camelRenderState.jumpCooldown > 0.0F) { + float h = 45.0F * camelRenderState.jumpCooldown / 55.0F; + g = Mth.clamp(g + h, -25.0F, 70.0F); } - this.head.yRot = netHeadYaw * (float) (Math.PI / 180.0); - this.head.xRot = headPitch * (float) (Math.PI / 180.0); + this.head.yRot = f * (float) (Math.PI / 180.0); + this.head.xRot = g * (float) (Math.PI / 180.0); } - private void toggleInvisibleParts(T entity) { - boolean bl = entity.isSaddled(); - boolean bl2 = entity.isVehicle(); + private void toggleInvisibleParts(CamelRenderState camelRenderState) { + boolean bl = camelRenderState.isSaddled; + boolean bl2 = camelRenderState.isRidden; for (ModelPart modelPart : this.saddleParts) { modelPart.visible = bl; @@ -160,22 +153,4 @@ public class CamelModel extends HierarchicalModel { modelPart.visible = bl2 && bl; } } - - @Override - public void renderToBuffer(PoseStack poseStack, VertexConsumer buffer, int packedLight, int packedOverlay, int color) { - if (this.young) { - poseStack.pushPose(); - poseStack.scale(0.45F, 0.45F, 0.45F); - poseStack.translate(0.0F, 1.834375F, 0.0F); - this.root().render(poseStack, buffer, packedLight, packedOverlay, color); - poseStack.popPose(); - } else { - this.root().render(poseStack, buffer, packedLight, packedOverlay, color); - } - } - - @Override - public ModelPart root() { - return this.root; - } } diff --git a/net/minecraft/client/model/CatModel.java b/net/minecraft/client/model/CatModel.java index 3ac239c2..2b014eff 100644 --- a/net/minecraft/client/model/CatModel.java +++ b/net/minecraft/client/model/CatModel.java @@ -3,89 +3,14 @@ package net.minecraft.client.model; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.model.geom.ModelPart; -import net.minecraft.world.entity.animal.Cat; +import net.minecraft.client.model.geom.builders.MeshTransformer; +import net.minecraft.client.renderer.entity.state.CatRenderState; @Environment(EnvType.CLIENT) -public class CatModel extends OcelotModel { - private float lieDownAmount; - private float lieDownAmountTail; - private float relaxStateOneAmount; +public class CatModel extends FelineModel { + public static final MeshTransformer CAT_TRANSFORMER = MeshTransformer.scaling(0.8F); public CatModel(ModelPart root) { super(root); } - - public void prepareMobModel(T entity, float limbSwing, float limbSwingAmount, float partialTick) { - this.lieDownAmount = entity.getLieDownAmount(partialTick); - this.lieDownAmountTail = entity.getLieDownAmountTail(partialTick); - this.relaxStateOneAmount = entity.getRelaxStateOneAmount(partialTick); - if (this.lieDownAmount <= 0.0F) { - this.head.xRot = 0.0F; - this.head.zRot = 0.0F; - this.leftFrontLeg.xRot = 0.0F; - this.leftFrontLeg.zRot = 0.0F; - this.rightFrontLeg.xRot = 0.0F; - this.rightFrontLeg.zRot = 0.0F; - this.rightFrontLeg.x = -1.2F; - this.leftHindLeg.xRot = 0.0F; - this.rightHindLeg.xRot = 0.0F; - this.rightHindLeg.zRot = 0.0F; - this.rightHindLeg.x = -1.1F; - this.rightHindLeg.y = 18.0F; - } - - super.prepareMobModel(entity, limbSwing, limbSwingAmount, partialTick); - if (entity.isInSittingPose()) { - this.body.xRot = (float) (Math.PI / 4); - this.body.y += -4.0F; - this.body.z += 5.0F; - this.head.y += -3.3F; - this.head.z++; - this.tail1.y += 8.0F; - this.tail1.z += -2.0F; - this.tail2.y += 2.0F; - this.tail2.z += -0.8F; - this.tail1.xRot = 1.7278761F; - this.tail2.xRot = 2.670354F; - this.leftFrontLeg.xRot = (float) (-Math.PI / 20); - this.leftFrontLeg.y = 16.1F; - this.leftFrontLeg.z = -7.0F; - this.rightFrontLeg.xRot = (float) (-Math.PI / 20); - this.rightFrontLeg.y = 16.1F; - this.rightFrontLeg.z = -7.0F; - this.leftHindLeg.xRot = (float) (-Math.PI / 2); - this.leftHindLeg.y = 21.0F; - this.leftHindLeg.z = 1.0F; - this.rightHindLeg.xRot = (float) (-Math.PI / 2); - this.rightHindLeg.y = 21.0F; - this.rightHindLeg.z = 1.0F; - this.state = 3; - } - } - - /** - * Sets this entity's model rotation angles - */ - public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { - super.setupAnim(entity, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch); - if (this.lieDownAmount > 0.0F) { - this.head.zRot = ModelUtils.rotlerpRad(this.head.zRot, -1.2707963F, this.lieDownAmount); - this.head.yRot = ModelUtils.rotlerpRad(this.head.yRot, 1.2707963F, this.lieDownAmount); - this.leftFrontLeg.xRot = -1.2707963F; - this.rightFrontLeg.xRot = -0.47079635F; - this.rightFrontLeg.zRot = -0.2F; - this.rightFrontLeg.x = -0.2F; - this.leftHindLeg.xRot = -0.4F; - this.rightHindLeg.xRot = 0.5F; - this.rightHindLeg.zRot = -0.5F; - this.rightHindLeg.x = -0.3F; - this.rightHindLeg.y = 20.0F; - this.tail1.xRot = ModelUtils.rotlerpRad(this.tail1.xRot, 0.8F, this.lieDownAmountTail); - this.tail2.xRot = ModelUtils.rotlerpRad(this.tail2.xRot, -0.4F, this.lieDownAmountTail); - } - - if (this.relaxStateOneAmount > 0.0F) { - this.head.xRot = ModelUtils.rotlerpRad(this.head.xRot, -0.58177644F, this.relaxStateOneAmount); - } - } } diff --git a/net/minecraft/client/model/ChestBoatModel.java b/net/minecraft/client/model/ChestBoatModel.java deleted file mode 100644 index 311a524d..00000000 --- a/net/minecraft/client/model/ChestBoatModel.java +++ /dev/null @@ -1,53 +0,0 @@ -package net.minecraft.client.model; - -import com.google.common.collect.ImmutableList.Builder; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.client.model.geom.ModelPart; -import net.minecraft.client.model.geom.PartPose; -import net.minecraft.client.model.geom.builders.CubeListBuilder; -import net.minecraft.client.model.geom.builders.LayerDefinition; -import net.minecraft.client.model.geom.builders.MeshDefinition; -import net.minecraft.client.model.geom.builders.PartDefinition; - -@Environment(EnvType.CLIENT) -public class ChestBoatModel extends BoatModel { - private static final String CHEST_BOTTOM = "chest_bottom"; - private static final String CHEST_LID = "chest_lid"; - private static final String CHEST_LOCK = "chest_lock"; - - public ChestBoatModel(ModelPart modelPart) { - super(modelPart); - } - - @Override - protected Builder createPartsBuilder(ModelPart root) { - Builder builder = super.createPartsBuilder(root); - builder.add(root.getChild("chest_bottom")); - builder.add(root.getChild("chest_lid")); - builder.add(root.getChild("chest_lock")); - return builder; - } - - public static LayerDefinition createBodyModel() { - MeshDefinition meshDefinition = new MeshDefinition(); - PartDefinition partDefinition = meshDefinition.getRoot(); - BoatModel.createChildren(partDefinition); - partDefinition.addOrReplaceChild( - "chest_bottom", - CubeListBuilder.create().texOffs(0, 76).addBox(0.0F, 0.0F, 0.0F, 12.0F, 8.0F, 12.0F), - PartPose.offsetAndRotation(-2.0F, -5.0F, -6.0F, 0.0F, (float) (-Math.PI / 2), 0.0F) - ); - partDefinition.addOrReplaceChild( - "chest_lid", - CubeListBuilder.create().texOffs(0, 59).addBox(0.0F, 0.0F, 0.0F, 12.0F, 4.0F, 12.0F), - PartPose.offsetAndRotation(-2.0F, -9.0F, -6.0F, 0.0F, (float) (-Math.PI / 2), 0.0F) - ); - partDefinition.addOrReplaceChild( - "chest_lock", - CubeListBuilder.create().texOffs(0, 59).addBox(0.0F, 0.0F, 0.0F, 2.0F, 4.0F, 1.0F), - PartPose.offsetAndRotation(-1.0F, -6.0F, -1.0F, 0.0F, (float) (-Math.PI / 2), 0.0F) - ); - return LayerDefinition.create(meshDefinition, 128, 128); - } -} diff --git a/net/minecraft/client/model/ChestModel.java b/net/minecraft/client/model/ChestModel.java new file mode 100644 index 00000000..b3679847 --- /dev/null +++ b/net/minecraft/client/model/ChestModel.java @@ -0,0 +1,70 @@ +package net.minecraft.client.model; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.client.renderer.RenderType; + +@Environment(EnvType.CLIENT) +public class ChestModel extends Model { + private static final String BOTTOM = "bottom"; + private static final String LID = "lid"; + private static final String LOCK = "lock"; + private final ModelPart lid; + private final ModelPart lock; + + public ChestModel(ModelPart modelPart) { + super(modelPart, RenderType::entitySolid); + this.lid = modelPart.getChild("lid"); + this.lock = modelPart.getChild("lock"); + } + + public static LayerDefinition createSingleBodyLayer() { + MeshDefinition meshDefinition = new MeshDefinition(); + PartDefinition partDefinition = meshDefinition.getRoot(); + partDefinition.addOrReplaceChild("bottom", CubeListBuilder.create().texOffs(0, 19).addBox(1.0F, 0.0F, 1.0F, 14.0F, 10.0F, 14.0F), PartPose.ZERO); + partDefinition.addOrReplaceChild( + "lid", CubeListBuilder.create().texOffs(0, 0).addBox(1.0F, 0.0F, 0.0F, 14.0F, 5.0F, 14.0F), PartPose.offset(0.0F, 9.0F, 1.0F) + ); + partDefinition.addOrReplaceChild( + "lock", CubeListBuilder.create().texOffs(0, 0).addBox(7.0F, -2.0F, 14.0F, 2.0F, 4.0F, 1.0F), PartPose.offset(0.0F, 9.0F, 1.0F) + ); + return LayerDefinition.create(meshDefinition, 64, 64); + } + + public static LayerDefinition createDoubleBodyRightLayer() { + MeshDefinition meshDefinition = new MeshDefinition(); + PartDefinition partDefinition = meshDefinition.getRoot(); + partDefinition.addOrReplaceChild("bottom", CubeListBuilder.create().texOffs(0, 19).addBox(1.0F, 0.0F, 1.0F, 15.0F, 10.0F, 14.0F), PartPose.ZERO); + partDefinition.addOrReplaceChild( + "lid", CubeListBuilder.create().texOffs(0, 0).addBox(1.0F, 0.0F, 0.0F, 15.0F, 5.0F, 14.0F), PartPose.offset(0.0F, 9.0F, 1.0F) + ); + partDefinition.addOrReplaceChild( + "lock", CubeListBuilder.create().texOffs(0, 0).addBox(15.0F, -2.0F, 14.0F, 1.0F, 4.0F, 1.0F), PartPose.offset(0.0F, 9.0F, 1.0F) + ); + return LayerDefinition.create(meshDefinition, 64, 64); + } + + public static LayerDefinition createDoubleBodyLeftLayer() { + MeshDefinition meshDefinition = new MeshDefinition(); + PartDefinition partDefinition = meshDefinition.getRoot(); + partDefinition.addOrReplaceChild("bottom", CubeListBuilder.create().texOffs(0, 19).addBox(0.0F, 0.0F, 1.0F, 15.0F, 10.0F, 14.0F), PartPose.ZERO); + partDefinition.addOrReplaceChild( + "lid", CubeListBuilder.create().texOffs(0, 0).addBox(0.0F, 0.0F, 0.0F, 15.0F, 5.0F, 14.0F), PartPose.offset(0.0F, 9.0F, 1.0F) + ); + partDefinition.addOrReplaceChild( + "lock", CubeListBuilder.create().texOffs(0, 0).addBox(0.0F, -2.0F, 14.0F, 1.0F, 4.0F, 1.0F), PartPose.offset(0.0F, 9.0F, 1.0F) + ); + return LayerDefinition.create(meshDefinition, 64, 64); + } + + public void setupAnim(float f) { + this.lid.xRot = -(f * (float) (Math.PI / 2)); + this.lock.xRot = this.lid.xRot; + } +} diff --git a/net/minecraft/client/model/ChestRaftModel.java b/net/minecraft/client/model/ChestRaftModel.java deleted file mode 100644 index ae051072..00000000 --- a/net/minecraft/client/model/ChestRaftModel.java +++ /dev/null @@ -1,53 +0,0 @@ -package net.minecraft.client.model; - -import com.google.common.collect.ImmutableList.Builder; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.client.model.geom.ModelPart; -import net.minecraft.client.model.geom.PartPose; -import net.minecraft.client.model.geom.builders.CubeListBuilder; -import net.minecraft.client.model.geom.builders.LayerDefinition; -import net.minecraft.client.model.geom.builders.MeshDefinition; -import net.minecraft.client.model.geom.builders.PartDefinition; - -@Environment(EnvType.CLIENT) -public class ChestRaftModel extends RaftModel { - private static final String CHEST_BOTTOM = "chest_bottom"; - private static final String CHEST_LID = "chest_lid"; - private static final String CHEST_LOCK = "chest_lock"; - - public ChestRaftModel(ModelPart modelPart) { - super(modelPart); - } - - @Override - protected Builder createPartsBuilder(ModelPart root) { - Builder builder = super.createPartsBuilder(root); - builder.add(root.getChild("chest_bottom")); - builder.add(root.getChild("chest_lid")); - builder.add(root.getChild("chest_lock")); - return builder; - } - - public static LayerDefinition createBodyModel() { - MeshDefinition meshDefinition = new MeshDefinition(); - PartDefinition partDefinition = meshDefinition.getRoot(); - RaftModel.createChildren(partDefinition); - partDefinition.addOrReplaceChild( - "chest_bottom", - CubeListBuilder.create().texOffs(0, 76).addBox(0.0F, 0.0F, 0.0F, 12.0F, 8.0F, 12.0F), - PartPose.offsetAndRotation(-2.0F, -10.1F, -6.0F, 0.0F, (float) (-Math.PI / 2), 0.0F) - ); - partDefinition.addOrReplaceChild( - "chest_lid", - CubeListBuilder.create().texOffs(0, 59).addBox(0.0F, 0.0F, 0.0F, 12.0F, 4.0F, 12.0F), - PartPose.offsetAndRotation(-2.0F, -14.1F, -6.0F, 0.0F, (float) (-Math.PI / 2), 0.0F) - ); - partDefinition.addOrReplaceChild( - "chest_lock", - CubeListBuilder.create().texOffs(0, 59).addBox(0.0F, 0.0F, 0.0F, 2.0F, 4.0F, 1.0F), - PartPose.offsetAndRotation(-1.0F, -11.1F, -1.0F, 0.0F, (float) (-Math.PI / 2), 0.0F) - ); - return LayerDefinition.create(meshDefinition, 128, 128); - } -} diff --git a/net/minecraft/client/model/ChickenModel.java b/net/minecraft/client/model/ChickenModel.java index 1b99883c..cc893f70 100644 --- a/net/minecraft/client/model/ChickenModel.java +++ b/net/minecraft/client/model/ChickenModel.java @@ -1,6 +1,6 @@ package net.minecraft.client.model; -import com.google.common.collect.ImmutableList; +import java.util.Set; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.model.geom.ModelPart; @@ -8,15 +8,16 @@ import net.minecraft.client.model.geom.PartPose; import net.minecraft.client.model.geom.builders.CubeListBuilder; import net.minecraft.client.model.geom.builders.LayerDefinition; import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.MeshTransformer; import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.client.renderer.entity.state.ChickenRenderState; import net.minecraft.util.Mth; -import net.minecraft.world.entity.Entity; @Environment(EnvType.CLIENT) -public class ChickenModel extends AgeableListModel { +public class ChickenModel extends EntityModel { public static final String RED_THING = "red_thing"; + public static final MeshTransformer BABY_TRANSFORMER = new BabyModelTransform(Set.of("head", "beak", "red_thing")); private final ModelPart head; - private final ModelPart body; private final ModelPart rightLeg; private final ModelPart leftLeg; private final ModelPart rightWing; @@ -25,10 +26,10 @@ public class ChickenModel extends AgeableListModel { private final ModelPart redThing; public ChickenModel(ModelPart root) { + super(root); this.head = root.getChild("head"); this.beak = root.getChild("beak"); this.redThing = root.getChild("red_thing"); - this.body = root.getChild("body"); this.rightLeg = root.getChild("right_leg"); this.leftLeg = root.getChild("left_leg"); this.rightWing = root.getChild("right_wing"); @@ -65,27 +66,20 @@ public class ChickenModel extends AgeableListModel { return LayerDefinition.create(meshDefinition, 64, 32); } - @Override - protected Iterable headParts() { - return ImmutableList.of(this.head, this.beak, this.redThing); - } - - @Override - protected Iterable bodyParts() { - return ImmutableList.of(this.body, this.rightLeg, this.leftLeg, this.rightWing, this.leftWing); - } - - @Override - public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { - this.head.xRot = headPitch * (float) (Math.PI / 180.0); - this.head.yRot = netHeadYaw * (float) (Math.PI / 180.0); + public void setupAnim(ChickenRenderState chickenRenderState) { + super.setupAnim(chickenRenderState); + float f = (Mth.sin(chickenRenderState.flap) + 1.0F) * chickenRenderState.flapSpeed; + this.head.xRot = chickenRenderState.xRot * (float) (Math.PI / 180.0); + this.head.yRot = chickenRenderState.yRot * (float) (Math.PI / 180.0); this.beak.xRot = this.head.xRot; this.beak.yRot = this.head.yRot; this.redThing.xRot = this.head.xRot; this.redThing.yRot = this.head.yRot; - this.rightLeg.xRot = Mth.cos(limbSwing * 0.6662F) * 1.4F * limbSwingAmount; - this.leftLeg.xRot = Mth.cos(limbSwing * 0.6662F + (float) Math.PI) * 1.4F * limbSwingAmount; - this.rightWing.zRot = ageInTicks; - this.leftWing.zRot = -ageInTicks; + float g = chickenRenderState.walkAnimationSpeed; + float h = chickenRenderState.walkAnimationPos; + this.rightLeg.xRot = Mth.cos(h * 0.6662F) * 1.4F * g; + this.leftLeg.xRot = Mth.cos(h * 0.6662F + (float) Math.PI) * 1.4F * g; + this.rightWing.zRot = f; + this.leftWing.zRot = -f; } } diff --git a/net/minecraft/client/model/CodModel.java b/net/minecraft/client/model/CodModel.java index 3cfd3db8..0cfbd9fd 100644 --- a/net/minecraft/client/model/CodModel.java +++ b/net/minecraft/client/model/CodModel.java @@ -8,16 +8,15 @@ import net.minecraft.client.model.geom.builders.CubeListBuilder; import net.minecraft.client.model.geom.builders.LayerDefinition; import net.minecraft.client.model.geom.builders.MeshDefinition; import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.client.renderer.entity.state.LivingEntityRenderState; import net.minecraft.util.Mth; -import net.minecraft.world.entity.Entity; @Environment(EnvType.CLIENT) -public class CodModel extends HierarchicalModel { - private final ModelPart root; +public class CodModel extends EntityModel { private final ModelPart tailFin; public CodModel(ModelPart root) { - this.root = root; + super(root); this.tailFin = root.getChild("tail_fin"); } @@ -53,18 +52,9 @@ public class CodModel extends HierarchicalModel { return LayerDefinition.create(meshDefinition, 32, 32); } - @Override - public ModelPart root() { - return this.root; - } - - @Override - public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { - float f = 1.0F; - if (!entity.isInWater()) { - f = 1.5F; - } - - this.tailFin.yRot = -f * 0.45F * Mth.sin(0.6F * ageInTicks); + public void setupAnim(LivingEntityRenderState livingEntityRenderState) { + super.setupAnim(livingEntityRenderState); + float f = livingEntityRenderState.isInWater ? 1.0F : 1.5F; + this.tailFin.yRot = -f * 0.45F * Mth.sin(0.6F * livingEntityRenderState.ageInTicks); } } diff --git a/net/minecraft/client/model/ColorableAgeableListModel.java b/net/minecraft/client/model/ColorableAgeableListModel.java deleted file mode 100644 index 53977ced..00000000 --- a/net/minecraft/client/model/ColorableAgeableListModel.java +++ /dev/null @@ -1,22 +0,0 @@ -package net.minecraft.client.model; - -import com.mojang.blaze3d.vertex.PoseStack; -import com.mojang.blaze3d.vertex.VertexConsumer; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.util.FastColor; -import net.minecraft.world.entity.Entity; - -@Environment(EnvType.CLIENT) -public abstract class ColorableAgeableListModel extends AgeableListModel { - private int color = -1; - - public void setColor(int color) { - this.color = color; - } - - @Override - public void renderToBuffer(PoseStack poseStack, VertexConsumer buffer, int packedLight, int packedOverlay, int color) { - super.renderToBuffer(poseStack, buffer, packedLight, packedOverlay, FastColor.ARGB32.multiply(color, this.color)); - } -} diff --git a/net/minecraft/client/model/ColorableHierarchicalModel.java b/net/minecraft/client/model/ColorableHierarchicalModel.java deleted file mode 100644 index fce7ef6e..00000000 --- a/net/minecraft/client/model/ColorableHierarchicalModel.java +++ /dev/null @@ -1,22 +0,0 @@ -package net.minecraft.client.model; - -import com.mojang.blaze3d.vertex.PoseStack; -import com.mojang.blaze3d.vertex.VertexConsumer; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.util.FastColor; -import net.minecraft.world.entity.Entity; - -@Environment(EnvType.CLIENT) -public abstract class ColorableHierarchicalModel extends HierarchicalModel { - private int color = -1; - - public void setColor(int color) { - this.color = color; - } - - @Override - public void renderToBuffer(PoseStack poseStack, VertexConsumer buffer, int packedLight, int packedOverlay, int color) { - super.renderToBuffer(poseStack, buffer, packedLight, packedOverlay, FastColor.ARGB32.multiply(color, this.color)); - } -} diff --git a/net/minecraft/client/model/CowModel.java b/net/minecraft/client/model/CowModel.java index 502018bb..7a2fe91a 100644 --- a/net/minecraft/client/model/CowModel.java +++ b/net/minecraft/client/model/CowModel.java @@ -1,5 +1,6 @@ package net.minecraft.client.model; +import java.util.Set; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.model.geom.ModelPart; @@ -7,13 +8,16 @@ import net.minecraft.client.model.geom.PartPose; import net.minecraft.client.model.geom.builders.CubeListBuilder; import net.minecraft.client.model.geom.builders.LayerDefinition; import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.MeshTransformer; import net.minecraft.client.model.geom.builders.PartDefinition; -import net.minecraft.world.entity.Entity; +import net.minecraft.client.renderer.entity.state.LivingEntityRenderState; @Environment(EnvType.CLIENT) -public class CowModel extends QuadrupedModel { +public class CowModel extends QuadrupedModel { + public static final MeshTransformer BABY_TRANSFORMER = new BabyModelTransform(false, 10.0F, 4.0F, Set.of("head")); + public CowModel(ModelPart root) { - super(root, false, 10.0F, 4.0F, 2.0F, 2.0F, 24); + super(root); } public static LayerDefinition createBodyLayer() { diff --git a/net/minecraft/client/model/CreakingModel.java b/net/minecraft/client/model/CreakingModel.java new file mode 100644 index 00000000..3774eed6 --- /dev/null +++ b/net/minecraft/client/model/CreakingModel.java @@ -0,0 +1,105 @@ +package net.minecraft.client.model; + +import java.util.List; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.client.animation.definitions.CreakingAnimation; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.client.renderer.entity.state.CreakingRenderState; + +@Environment(EnvType.CLIENT) +public class CreakingModel extends EntityModel { + public static final List NO_PARTS = List.of(); + private final ModelPart head; + private final List headParts; + + public CreakingModel(ModelPart modelPart) { + super(modelPart); + ModelPart modelPart2 = modelPart.getChild("root"); + ModelPart modelPart3 = modelPart2.getChild("upper_body"); + this.head = modelPart3.getChild("head"); + this.headParts = List.of(this.head); + } + + private static MeshDefinition createMesh() { + MeshDefinition meshDefinition = new MeshDefinition(); + PartDefinition partDefinition = meshDefinition.getRoot(); + PartDefinition partDefinition2 = partDefinition.addOrReplaceChild("root", CubeListBuilder.create(), PartPose.offset(0.0F, 24.0F, 0.0F)); + PartDefinition partDefinition3 = partDefinition2.addOrReplaceChild("upper_body", CubeListBuilder.create(), PartPose.offset(-1.0F, -19.0F, 0.0F)); + partDefinition3.addOrReplaceChild( + "head", + CubeListBuilder.create() + .texOffs(0, 0) + .addBox(-3.0F, -10.0F, -3.0F, 6.0F, 10.0F, 6.0F) + .texOffs(28, 31) + .addBox(-3.0F, -13.0F, -3.0F, 6.0F, 3.0F, 6.0F) + .texOffs(12, 40) + .addBox(3.0F, -13.0F, 0.0F, 9.0F, 14.0F, 0.0F) + .texOffs(34, 12) + .addBox(-12.0F, -14.0F, 0.0F, 9.0F, 14.0F, 0.0F), + PartPose.offset(-3.0F, -11.0F, 0.0F) + ); + partDefinition3.addOrReplaceChild( + "body", + CubeListBuilder.create().texOffs(0, 16).addBox(0.0F, -3.0F, -3.0F, 6.0F, 13.0F, 5.0F).texOffs(24, 0).addBox(-6.0F, -4.0F, -3.0F, 6.0F, 7.0F, 5.0F), + PartPose.offset(0.0F, -7.0F, 1.0F) + ); + partDefinition3.addOrReplaceChild( + "right_arm", + CubeListBuilder.create().texOffs(22, 13).addBox(-2.0F, -1.5F, -1.5F, 3.0F, 21.0F, 3.0F).texOffs(46, 0).addBox(-2.0F, 19.5F, -1.5F, 3.0F, 4.0F, 3.0F), + PartPose.offset(-7.0F, -9.5F, 1.5F) + ); + partDefinition3.addOrReplaceChild( + "left_arm", + CubeListBuilder.create() + .texOffs(30, 40) + .addBox(0.0F, -1.0F, -1.5F, 3.0F, 16.0F, 3.0F) + .texOffs(52, 12) + .addBox(0.0F, -5.0F, -1.5F, 3.0F, 4.0F, 3.0F) + .texOffs(52, 19) + .addBox(0.0F, 15.0F, -1.5F, 3.0F, 4.0F, 3.0F), + PartPose.offset(6.0F, -9.0F, 0.5F) + ); + partDefinition2.addOrReplaceChild( + "left_leg", + CubeListBuilder.create().texOffs(42, 40).addBox(-1.5F, 0.0F, -1.5F, 3.0F, 16.0F, 3.0F).texOffs(45, 55).addBox(-1.5F, 15.7F, -4.5F, 5.0F, 0.0F, 9.0F), + PartPose.offset(1.5F, -16.0F, 0.5F) + ); + partDefinition2.addOrReplaceChild( + "right_leg", + CubeListBuilder.create() + .texOffs(0, 34) + .addBox(-3.0F, -1.5F, -1.5F, 3.0F, 19.0F, 3.0F) + .texOffs(45, 46) + .addBox(-5.0F, 17.2F, -4.5F, 5.0F, 0.0F, 9.0F) + .texOffs(12, 34) + .addBox(-3.0F, -4.5F, -1.5F, 3.0F, 3.0F, 3.0F), + PartPose.offset(-1.0F, -17.5F, 0.5F) + ); + return meshDefinition; + } + + public static LayerDefinition createBodyLayer() { + MeshDefinition meshDefinition = createMesh(); + return LayerDefinition.create(meshDefinition, 64, 64); + } + + public void setupAnim(CreakingRenderState creakingRenderState) { + this.root().getAllParts().forEach(ModelPart::resetPose); + if (creakingRenderState.canMove) { + this.animateWalk(CreakingAnimation.CREAKING_WALK, creakingRenderState.walkAnimationPos, creakingRenderState.walkAnimationSpeed, 5.5F, 3.0F); + } + + this.animate(creakingRenderState.attackAnimationState, CreakingAnimation.CREAKING_ATTACK, creakingRenderState.ageInTicks); + this.animate(creakingRenderState.invulnerabilityAnimationState, CreakingAnimation.CREAKING_INVULNERABLE, creakingRenderState.ageInTicks); + } + + public List getHeadModelParts(CreakingRenderState creakingRenderState) { + return !creakingRenderState.isActive ? NO_PARTS : this.headParts; + } +} diff --git a/net/minecraft/client/model/CreeperModel.java b/net/minecraft/client/model/CreeperModel.java index 5c03f0ee..72b6e5b7 100644 --- a/net/minecraft/client/model/CreeperModel.java +++ b/net/minecraft/client/model/CreeperModel.java @@ -9,12 +9,11 @@ import net.minecraft.client.model.geom.builders.CubeListBuilder; import net.minecraft.client.model.geom.builders.LayerDefinition; import net.minecraft.client.model.geom.builders.MeshDefinition; import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.client.renderer.entity.state.CreeperRenderState; import net.minecraft.util.Mth; -import net.minecraft.world.entity.Entity; @Environment(EnvType.CLIENT) -public class CreeperModel extends HierarchicalModel { - private final ModelPart root; +public class CreeperModel extends EntityModel { private final ModelPart head; private final ModelPart rightHindLeg; private final ModelPart leftHindLeg; @@ -23,7 +22,7 @@ public class CreeperModel extends HierarchicalModel { private static final int Y_OFFSET = 6; public CreeperModel(ModelPart root) { - this.root = root; + super(root); this.head = root.getChild("head"); this.leftHindLeg = root.getChild("right_hind_leg"); this.rightHindLeg = root.getChild("left_hind_leg"); @@ -48,18 +47,15 @@ public class CreeperModel extends HierarchicalModel { return LayerDefinition.create(meshDefinition, 64, 32); } - @Override - public ModelPart root() { - return this.root; - } - - @Override - public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { - this.head.yRot = netHeadYaw * (float) (Math.PI / 180.0); - this.head.xRot = headPitch * (float) (Math.PI / 180.0); - this.rightHindLeg.xRot = Mth.cos(limbSwing * 0.6662F) * 1.4F * limbSwingAmount; - this.leftHindLeg.xRot = Mth.cos(limbSwing * 0.6662F + (float) Math.PI) * 1.4F * limbSwingAmount; - this.rightFrontLeg.xRot = Mth.cos(limbSwing * 0.6662F + (float) Math.PI) * 1.4F * limbSwingAmount; - this.leftFrontLeg.xRot = Mth.cos(limbSwing * 0.6662F) * 1.4F * limbSwingAmount; + public void setupAnim(CreeperRenderState creeperRenderState) { + super.setupAnim(creeperRenderState); + this.head.yRot = creeperRenderState.yRot * (float) (Math.PI / 180.0); + this.head.xRot = creeperRenderState.xRot * (float) (Math.PI / 180.0); + float f = creeperRenderState.walkAnimationSpeed; + float g = creeperRenderState.walkAnimationPos; + this.rightHindLeg.xRot = Mth.cos(g * 0.6662F) * 1.4F * f; + this.leftHindLeg.xRot = Mth.cos(g * 0.6662F + (float) Math.PI) * 1.4F * f; + this.rightFrontLeg.xRot = Mth.cos(g * 0.6662F + (float) Math.PI) * 1.4F * f; + this.leftFrontLeg.xRot = Mth.cos(g * 0.6662F) * 1.4F * f; } } diff --git a/net/minecraft/client/model/DolphinModel.java b/net/minecraft/client/model/DolphinModel.java index 7e301d2d..c54c890d 100644 --- a/net/minecraft/client/model/DolphinModel.java +++ b/net/minecraft/client/model/DolphinModel.java @@ -7,19 +7,20 @@ import net.minecraft.client.model.geom.PartPose; import net.minecraft.client.model.geom.builders.CubeListBuilder; import net.minecraft.client.model.geom.builders.LayerDefinition; import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.MeshTransformer; import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.client.renderer.entity.state.DolphinRenderState; import net.minecraft.util.Mth; -import net.minecraft.world.entity.Entity; @Environment(EnvType.CLIENT) -public class DolphinModel extends HierarchicalModel { - private final ModelPart root; +public class DolphinModel extends EntityModel { + public static final MeshTransformer BABY_TRANSFORMER = MeshTransformer.scaling(0.5F); private final ModelPart body; private final ModelPart tail; private final ModelPart tailFin; public DolphinModel(ModelPart root) { - this.root = root; + super(root); this.body = root.getChild("body"); this.tail = this.body.getChild("tail"); this.tailFin = this.tail.getChild("tail_fin"); @@ -61,19 +62,14 @@ public class DolphinModel extends HierarchicalModel { return LayerDefinition.create(meshDefinition, 64, 64); } - @Override - public ModelPart root() { - return this.root; - } - - @Override - public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { - this.body.xRot = headPitch * (float) (Math.PI / 180.0); - this.body.yRot = netHeadYaw * (float) (Math.PI / 180.0); - if (entity.getDeltaMovement().horizontalDistanceSqr() > 1.0E-7) { - this.body.xRot = this.body.xRot + (-0.05F - 0.05F * Mth.cos(ageInTicks * 0.3F)); - this.tail.xRot = -0.1F * Mth.cos(ageInTicks * 0.3F); - this.tailFin.xRot = -0.2F * Mth.cos(ageInTicks * 0.3F); + public void setupAnim(DolphinRenderState dolphinRenderState) { + super.setupAnim(dolphinRenderState); + this.body.xRot = dolphinRenderState.xRot * (float) (Math.PI / 180.0); + this.body.yRot = dolphinRenderState.yRot * (float) (Math.PI / 180.0); + if (dolphinRenderState.isMoving) { + this.body.xRot = this.body.xRot + (-0.05F - 0.05F * Mth.cos(dolphinRenderState.ageInTicks * 0.3F)); + this.tail.xRot = -0.1F * Mth.cos(dolphinRenderState.ageInTicks * 0.3F); + this.tailFin.xRot = -0.2F * Mth.cos(dolphinRenderState.ageInTicks * 0.3F); } } } diff --git a/net/minecraft/client/model/ChestedHorseModel.java b/net/minecraft/client/model/DonkeyModel.java similarity index 67% rename from net/minecraft/client/model/ChestedHorseModel.java rename to net/minecraft/client/model/DonkeyModel.java index 83b55421..24fa0c94 100644 --- a/net/minecraft/client/model/ChestedHorseModel.java +++ b/net/minecraft/client/model/DonkeyModel.java @@ -9,20 +9,30 @@ import net.minecraft.client.model.geom.builders.CubeListBuilder; import net.minecraft.client.model.geom.builders.LayerDefinition; import net.minecraft.client.model.geom.builders.MeshDefinition; import net.minecraft.client.model.geom.builders.PartDefinition; -import net.minecraft.world.entity.animal.horse.AbstractChestedHorse; +import net.minecraft.client.renderer.entity.state.DonkeyRenderState; @Environment(EnvType.CLIENT) -public class ChestedHorseModel extends HorseModel { +public class DonkeyModel extends AbstractEquineModel { private final ModelPart leftChest = this.body.getChild("left_chest"); private final ModelPart rightChest = this.body.getChild("right_chest"); - public ChestedHorseModel(ModelPart root) { - super(root); + public DonkeyModel(ModelPart modelPart) { + super(modelPart); } public static LayerDefinition createBodyLayer() { - MeshDefinition meshDefinition = HorseModel.createBodyMesh(CubeDeformation.NONE); - PartDefinition partDefinition = meshDefinition.getRoot(); + MeshDefinition meshDefinition = AbstractEquineModel.createBodyMesh(CubeDeformation.NONE); + modifyMesh(meshDefinition.getRoot()); + return LayerDefinition.create(meshDefinition, 64, 64); + } + + public static LayerDefinition createBabyLayer() { + MeshDefinition meshDefinition = AbstractEquineModel.createFullScaleBabyMesh(CubeDeformation.NONE); + modifyMesh(meshDefinition.getRoot()); + return LayerDefinition.create(AbstractEquineModel.BABY_TRANSFORMER.apply(meshDefinition), 64, 64); + } + + private static void modifyMesh(PartDefinition partDefinition) { PartDefinition partDefinition2 = partDefinition.getChild("body"); CubeListBuilder cubeListBuilder = CubeListBuilder.create().texOffs(26, 21).addBox(-4.0F, 0.0F, -2.0F, 8.0F, 8.0F, 3.0F); partDefinition2.addOrReplaceChild("left_chest", cubeListBuilder, PartPose.offsetAndRotation(6.0F, -8.0F, 0.0F, 0.0F, (float) (-Math.PI / 2), 0.0F)); @@ -35,20 +45,11 @@ public class ChestedHorseModel extends HorseMode partDefinition3.addOrReplaceChild( "right_ear", cubeListBuilder2, PartPose.offsetAndRotation(-1.25F, -10.0F, 4.0F, (float) (Math.PI / 12), 0.0F, (float) (-Math.PI / 12)) ); - return LayerDefinition.create(meshDefinition, 64, 64); } - /** - * Sets this entity's model rotation angles - */ - public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { - super.setupAnim(entity, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch); - if (entity.hasChest()) { - this.leftChest.visible = true; - this.rightChest.visible = true; - } else { - this.leftChest.visible = false; - this.rightChest.visible = false; - } + public void setupAnim(DonkeyRenderState donkeyRenderState) { + super.setupAnim(donkeyRenderState); + this.leftChest.visible = donkeyRenderState.hasChest; + this.rightChest.visible = donkeyRenderState.hasChest; } } diff --git a/net/minecraft/client/model/DrownedModel.java b/net/minecraft/client/model/DrownedModel.java index 2c621cea..2c47b3a1 100644 --- a/net/minecraft/client/model/DrownedModel.java +++ b/net/minecraft/client/model/DrownedModel.java @@ -9,15 +9,14 @@ import net.minecraft.client.model.geom.builders.CubeListBuilder; import net.minecraft.client.model.geom.builders.LayerDefinition; import net.minecraft.client.model.geom.builders.MeshDefinition; import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.client.renderer.entity.state.ZombieRenderState; import net.minecraft.util.Mth; -import net.minecraft.world.InteractionHand; import net.minecraft.world.entity.HumanoidArm; -import net.minecraft.world.entity.monster.Zombie; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; @Environment(EnvType.CLIENT) -public class DrownedModel extends ZombieModel { +public class DrownedModel extends ZombieModel { public DrownedModel(ModelPart root) { super(root); } @@ -34,45 +33,34 @@ public class DrownedModel extends ZombieModel { return LayerDefinition.create(meshDefinition, 64, 64); } - public void prepareMobModel(T entity, float limbSwing, float limbSwingAmount, float partialTick) { - this.rightArmPose = HumanoidModel.ArmPose.EMPTY; - this.leftArmPose = HumanoidModel.ArmPose.EMPTY; - ItemStack itemStack = entity.getItemInHand(InteractionHand.MAIN_HAND); - if (itemStack.is(Items.TRIDENT) && entity.isAggressive()) { - if (entity.getMainArm() == HumanoidArm.RIGHT) { - this.rightArmPose = HumanoidModel.ArmPose.THROW_SPEAR; - } else { - this.leftArmPose = HumanoidModel.ArmPose.THROW_SPEAR; - } - } - - super.prepareMobModel(entity, limbSwing, limbSwingAmount, partialTick); + protected HumanoidModel.ArmPose getArmPose(ZombieRenderState zombieRenderState, HumanoidArm humanoidArm) { + ItemStack itemStack = humanoidArm == HumanoidArm.RIGHT ? zombieRenderState.rightHandItem : zombieRenderState.leftHandItem; + return itemStack.is(Items.TRIDENT) && zombieRenderState.isAggressive && zombieRenderState.mainArm == humanoidArm + ? HumanoidModel.ArmPose.THROW_SPEAR + : HumanoidModel.ArmPose.EMPTY; } - /** - * Sets this entity's model rotation angles - */ - public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { - super.setupAnim(entity, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch); - if (this.leftArmPose == HumanoidModel.ArmPose.THROW_SPEAR) { + @Override + public void setupAnim(ZombieRenderState zombieRenderState) { + super.setupAnim(zombieRenderState); + if (this.getArmPose(zombieRenderState, HumanoidArm.LEFT) == HumanoidModel.ArmPose.THROW_SPEAR) { this.leftArm.xRot = this.leftArm.xRot * 0.5F - (float) Math.PI; this.leftArm.yRot = 0.0F; } - if (this.rightArmPose == HumanoidModel.ArmPose.THROW_SPEAR) { + if (this.getArmPose(zombieRenderState, HumanoidArm.RIGHT) == HumanoidModel.ArmPose.THROW_SPEAR) { this.rightArm.xRot = this.rightArm.xRot * 0.5F - (float) Math.PI; this.rightArm.yRot = 0.0F; } - if (this.swimAmount > 0.0F) { - this.rightArm.xRot = this.rotlerpRad(this.swimAmount, this.rightArm.xRot, (float) (-Math.PI * 4.0 / 5.0)) - + this.swimAmount * 0.35F * Mth.sin(0.1F * ageInTicks); - this.leftArm.xRot = this.rotlerpRad(this.swimAmount, this.leftArm.xRot, (float) (-Math.PI * 4.0 / 5.0)) - - this.swimAmount * 0.35F * Mth.sin(0.1F * ageInTicks); - this.rightArm.zRot = this.rotlerpRad(this.swimAmount, this.rightArm.zRot, -0.15F); - this.leftArm.zRot = this.rotlerpRad(this.swimAmount, this.leftArm.zRot, 0.15F); - this.leftLeg.xRot = this.leftLeg.xRot - this.swimAmount * 0.55F * Mth.sin(0.1F * ageInTicks); - this.rightLeg.xRot = this.rightLeg.xRot + this.swimAmount * 0.55F * Mth.sin(0.1F * ageInTicks); + float f = zombieRenderState.swimAmount; + if (f > 0.0F) { + this.rightArm.xRot = Mth.rotLerpRad(f, this.rightArm.xRot, (float) (-Math.PI * 4.0 / 5.0)) + f * 0.35F * Mth.sin(0.1F * zombieRenderState.ageInTicks); + this.leftArm.xRot = Mth.rotLerpRad(f, this.leftArm.xRot, (float) (-Math.PI * 4.0 / 5.0)) - f * 0.35F * Mth.sin(0.1F * zombieRenderState.ageInTicks); + this.rightArm.zRot = Mth.rotLerpRad(f, this.rightArm.zRot, -0.15F); + this.leftArm.zRot = Mth.rotLerpRad(f, this.leftArm.zRot, 0.15F); + this.leftLeg.xRot = this.leftLeg.xRot - f * 0.55F * Mth.sin(0.1F * zombieRenderState.ageInTicks); + this.rightLeg.xRot = this.rightLeg.xRot + f * 0.55F * Mth.sin(0.1F * zombieRenderState.ageInTicks); this.head.xRot = 0.0F; } } diff --git a/net/minecraft/client/model/ElytraModel.java b/net/minecraft/client/model/ElytraModel.java index 7c829f2a..8056e012 100644 --- a/net/minecraft/client/model/ElytraModel.java +++ b/net/minecraft/client/model/ElytraModel.java @@ -1,6 +1,5 @@ package net.minecraft.client.model; -import com.google.common.collect.ImmutableList; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.model.geom.ModelPart; @@ -9,17 +8,18 @@ import net.minecraft.client.model.geom.builders.CubeDeformation; import net.minecraft.client.model.geom.builders.CubeListBuilder; import net.minecraft.client.model.geom.builders.LayerDefinition; import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.MeshTransformer; import net.minecraft.client.model.geom.builders.PartDefinition; -import net.minecraft.client.player.AbstractClientPlayer; -import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.phys.Vec3; +import net.minecraft.client.renderer.entity.state.HumanoidRenderState; @Environment(EnvType.CLIENT) -public class ElytraModel extends AgeableListModel { +public class ElytraModel extends EntityModel { + public static final MeshTransformer BABY_TRANSFORMER = MeshTransformer.scaling(0.5F); private final ModelPart rightWing; private final ModelPart leftWing; public ElytraModel(ModelPart root) { + super(root); this.leftWing = root.getChild("left_wing"); this.rightWing = root.getChild("right_wing"); } @@ -41,55 +41,12 @@ public class ElytraModel extends AgeableListModel { return LayerDefinition.create(meshDefinition, 64, 32); } - @Override - protected Iterable headParts() { - return ImmutableList.of(); - } - - @Override - protected Iterable bodyParts() { - return ImmutableList.of(this.leftWing, this.rightWing); - } - - /** - * Sets this entity's model rotation angles - */ - public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { - float f = (float) (Math.PI / 12); - float g = (float) (-Math.PI / 12); - float h = 0.0F; - float i = 0.0F; - if (entity.isFallFlying()) { - float j = 1.0F; - Vec3 vec3 = entity.getDeltaMovement(); - if (vec3.y < 0.0) { - Vec3 vec32 = vec3.normalize(); - j = 1.0F - (float)Math.pow(-vec32.y, 1.5); - } - - f = j * (float) (Math.PI / 9) + (1.0F - j) * f; - g = j * (float) (-Math.PI / 2) + (1.0F - j) * g; - } else if (entity.isCrouching()) { - f = (float) (Math.PI * 2.0 / 9.0); - g = (float) (-Math.PI / 4); - h = 3.0F; - i = 0.08726646F; - } - - this.leftWing.y = h; - if (entity instanceof AbstractClientPlayer abstractClientPlayer) { - abstractClientPlayer.elytraRotX = abstractClientPlayer.elytraRotX + (f - abstractClientPlayer.elytraRotX) * 0.1F; - abstractClientPlayer.elytraRotY = abstractClientPlayer.elytraRotY + (i - abstractClientPlayer.elytraRotY) * 0.1F; - abstractClientPlayer.elytraRotZ = abstractClientPlayer.elytraRotZ + (g - abstractClientPlayer.elytraRotZ) * 0.1F; - this.leftWing.xRot = abstractClientPlayer.elytraRotX; - this.leftWing.yRot = abstractClientPlayer.elytraRotY; - this.leftWing.zRot = abstractClientPlayer.elytraRotZ; - } else { - this.leftWing.xRot = f; - this.leftWing.zRot = g; - this.leftWing.yRot = i; - } - + public void setupAnim(HumanoidRenderState humanoidRenderState) { + super.setupAnim(humanoidRenderState); + this.leftWing.y = humanoidRenderState.isCrouching ? 3.0F : 0.0F; + this.leftWing.xRot = humanoidRenderState.elytraRotX; + this.leftWing.zRot = humanoidRenderState.elytraRotZ; + this.leftWing.yRot = humanoidRenderState.elytraRotY; this.rightWing.yRot = -this.leftWing.yRot; this.rightWing.y = this.leftWing.y; this.rightWing.xRot = this.leftWing.xRot; diff --git a/net/minecraft/client/model/EndCrystalModel.java b/net/minecraft/client/model/EndCrystalModel.java new file mode 100644 index 00000000..ff0e39d6 --- /dev/null +++ b/net/minecraft/client/model/EndCrystalModel.java @@ -0,0 +1,59 @@ +package net.minecraft.client.model; + +import com.mojang.math.Axis; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.client.renderer.entity.EndCrystalRenderer; +import net.minecraft.client.renderer.entity.state.EndCrystalRenderState; +import org.joml.Quaternionf; + +@Environment(EnvType.CLIENT) +public class EndCrystalModel extends EntityModel { + private static final String OUTER_GLASS = "outer_glass"; + private static final String INNER_GLASS = "inner_glass"; + private static final String BASE = "base"; + private static final float SIN_45 = (float)Math.sin(Math.PI / 4); + public final ModelPart base; + public final ModelPart outerGlass; + public final ModelPart innerGlass; + public final ModelPart cube; + + public EndCrystalModel(ModelPart modelPart) { + super(modelPart); + this.base = modelPart.getChild("base"); + this.outerGlass = modelPart.getChild("outer_glass"); + this.innerGlass = this.outerGlass.getChild("inner_glass"); + this.cube = this.innerGlass.getChild("cube"); + } + + public static LayerDefinition createBodyLayer() { + MeshDefinition meshDefinition = new MeshDefinition(); + PartDefinition partDefinition = meshDefinition.getRoot(); + float f = 0.875F; + CubeListBuilder cubeListBuilder = CubeListBuilder.create().texOffs(0, 0).addBox(-4.0F, -4.0F, -4.0F, 8.0F, 8.0F, 8.0F); + PartDefinition partDefinition2 = partDefinition.addOrReplaceChild("outer_glass", cubeListBuilder, PartPose.offset(0.0F, 24.0F, 0.0F)); + PartDefinition partDefinition3 = partDefinition2.addOrReplaceChild("inner_glass", cubeListBuilder, PartPose.ZERO.withScale(0.875F)); + partDefinition3.addOrReplaceChild( + "cube", CubeListBuilder.create().texOffs(32, 0).addBox(-4.0F, -4.0F, -4.0F, 8.0F, 8.0F, 8.0F), PartPose.ZERO.withScale(0.765625F) + ); + partDefinition.addOrReplaceChild("base", CubeListBuilder.create().texOffs(0, 16).addBox(-6.0F, 0.0F, -6.0F, 12.0F, 4.0F, 12.0F), PartPose.ZERO); + return LayerDefinition.create(meshDefinition, 64, 32); + } + + public void setupAnim(EndCrystalRenderState endCrystalRenderState) { + super.setupAnim(endCrystalRenderState); + this.base.visible = endCrystalRenderState.showsBottom; + float f = endCrystalRenderState.ageInTicks * 3.0F; + float g = EndCrystalRenderer.getY(endCrystalRenderState.ageInTicks) * 16.0F; + this.outerGlass.y += g / 2.0F; + this.outerGlass.rotateBy(Axis.YP.rotationDegrees(f).rotateAxis((float) (Math.PI / 3), SIN_45, 0.0F, SIN_45)); + this.innerGlass.rotateBy(new Quaternionf().setAngleAxis((float) (Math.PI / 3), SIN_45, 0.0F, SIN_45).rotateY(f * (float) (Math.PI / 180.0))); + this.cube.rotateBy(new Quaternionf().setAngleAxis((float) (Math.PI / 3), SIN_45, 0.0F, SIN_45).rotateY(f * (float) (Math.PI / 180.0))); + } +} diff --git a/net/minecraft/client/model/EndermanModel.java b/net/minecraft/client/model/EndermanModel.java index 38a32db1..be7bb210 100644 --- a/net/minecraft/client/model/EndermanModel.java +++ b/net/minecraft/client/model/EndermanModel.java @@ -9,13 +9,11 @@ import net.minecraft.client.model.geom.builders.CubeListBuilder; import net.minecraft.client.model.geom.builders.LayerDefinition; import net.minecraft.client.model.geom.builders.MeshDefinition; import net.minecraft.client.model.geom.builders.PartDefinition; -import net.minecraft.world.entity.LivingEntity; +import net.minecraft.client.renderer.entity.state.EndermanRenderState; +import net.minecraft.util.Mth; @Environment(EnvType.CLIENT) -public class EndermanModel extends HumanoidModel { - public boolean carrying; - public boolean creepy; - +public class EndermanModel extends HumanoidModel { public EndermanModel(ModelPart root) { super(root); } @@ -24,11 +22,12 @@ public class EndermanModel extends HumanoidModel { float f = -14.0F; MeshDefinition meshDefinition = HumanoidModel.createMesh(CubeDeformation.NONE, -14.0F); PartDefinition partDefinition = meshDefinition.getRoot(); - PartPose partPose = PartPose.offset(0.0F, -13.0F, 0.0F); - partDefinition.addOrReplaceChild( - "hat", CubeListBuilder.create().texOffs(0, 16).addBox(-4.0F, -8.0F, -4.0F, 8.0F, 8.0F, 8.0F, new CubeDeformation(-0.5F)), partPose + PartDefinition partDefinition2 = partDefinition.addOrReplaceChild( + "head", CubeListBuilder.create().texOffs(0, 0).addBox(-4.0F, -8.0F, -4.0F, 8.0F, 8.0F, 8.0F), PartPose.offset(0.0F, -13.0F, 0.0F) + ); + partDefinition2.addOrReplaceChild( + "hat", CubeListBuilder.create().texOffs(0, 16).addBox(-4.0F, -8.0F, -4.0F, 8.0F, 8.0F, 8.0F, new CubeDeformation(-0.5F)), PartPose.ZERO ); - partDefinition.addOrReplaceChild("head", CubeListBuilder.create().texOffs(0, 0).addBox(-4.0F, -8.0F, -4.0F, 8.0F, 8.0F, 8.0F), partPose); partDefinition.addOrReplaceChild( "body", CubeListBuilder.create().texOffs(32, 16).addBox(-4.0F, 0.0F, -2.0F, 8.0F, 12.0F, 4.0F), PartPose.offset(0.0F, -14.0F, 0.0F) ); @@ -47,79 +46,29 @@ public class EndermanModel extends HumanoidModel { return LayerDefinition.create(meshDefinition, 64, 32); } - @Override - public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { - super.setupAnim(entity, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch); + public void setupAnim(T endermanRenderState) { + super.setupAnim(endermanRenderState); this.head.visible = true; - int i = -14; - this.body.xRot = 0.0F; - this.body.y = -14.0F; - this.body.z = -0.0F; - this.rightLeg.xRot -= 0.0F; - this.leftLeg.xRot -= 0.0F; this.rightArm.xRot *= 0.5F; this.leftArm.xRot *= 0.5F; this.rightLeg.xRot *= 0.5F; this.leftLeg.xRot *= 0.5F; float f = 0.4F; - if (this.rightArm.xRot > 0.4F) { - this.rightArm.xRot = 0.4F; - } - - if (this.leftArm.xRot > 0.4F) { - this.leftArm.xRot = 0.4F; - } - - if (this.rightArm.xRot < -0.4F) { - this.rightArm.xRot = -0.4F; - } - - if (this.leftArm.xRot < -0.4F) { - this.leftArm.xRot = -0.4F; - } - - if (this.rightLeg.xRot > 0.4F) { - this.rightLeg.xRot = 0.4F; - } - - if (this.leftLeg.xRot > 0.4F) { - this.leftLeg.xRot = 0.4F; - } - - if (this.rightLeg.xRot < -0.4F) { - this.rightLeg.xRot = -0.4F; - } - - if (this.leftLeg.xRot < -0.4F) { - this.leftLeg.xRot = -0.4F; - } - - if (this.carrying) { + this.rightArm.xRot = Mth.clamp(this.rightArm.xRot, -0.4F, 0.4F); + this.leftArm.xRot = Mth.clamp(this.leftArm.xRot, -0.4F, 0.4F); + this.rightLeg.xRot = Mth.clamp(this.rightLeg.xRot, -0.4F, 0.4F); + this.leftLeg.xRot = Mth.clamp(this.leftLeg.xRot, -0.4F, 0.4F); + if (endermanRenderState.carriedBlock != null) { this.rightArm.xRot = -0.5F; this.leftArm.xRot = -0.5F; this.rightArm.zRot = 0.05F; this.leftArm.zRot = -0.05F; } - this.rightLeg.z = 0.0F; - this.leftLeg.z = 0.0F; - this.rightLeg.y = -5.0F; - this.leftLeg.y = -5.0F; - this.head.z = -0.0F; - this.head.y = -13.0F; - this.hat.x = this.head.x; - this.hat.y = this.head.y; - this.hat.z = this.head.z; - this.hat.xRot = this.head.xRot; - this.hat.yRot = this.head.yRot; - this.hat.zRot = this.head.zRot; - if (this.creepy) { - float g = 1.0F; + if (endermanRenderState.isCreepy) { + float g = 5.0F; this.head.y -= 5.0F; + this.hat.y += 5.0F; } - - int j = -14; - this.rightArm.setPos(-5.0F, -12.0F, 0.0F); - this.leftArm.setPos(5.0F, -12.0F, 0.0F); } } diff --git a/net/minecraft/client/model/EndermiteModel.java b/net/minecraft/client/model/EndermiteModel.java index af2a80e9..42032934 100644 --- a/net/minecraft/client/model/EndermiteModel.java +++ b/net/minecraft/client/model/EndermiteModel.java @@ -8,20 +8,18 @@ import net.minecraft.client.model.geom.builders.CubeListBuilder; import net.minecraft.client.model.geom.builders.LayerDefinition; import net.minecraft.client.model.geom.builders.MeshDefinition; import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.client.renderer.entity.state.EntityRenderState; import net.minecraft.util.Mth; -import net.minecraft.world.entity.Entity; @Environment(EnvType.CLIENT) -public class EndermiteModel extends HierarchicalModel { +public class EndermiteModel extends EntityModel { private static final int BODY_COUNT = 4; private static final int[][] BODY_SIZES = new int[][]{{4, 3, 2}, {6, 4, 5}, {3, 3, 1}, {1, 2, 1}}; private static final int[][] BODY_TEXS = new int[][]{{0, 0}, {0, 5}, {0, 14}, {0, 18}}; - private final ModelPart root; - private final ModelPart[] bodyParts; + private final ModelPart[] bodyParts = new ModelPart[4]; public EndermiteModel(ModelPart root) { - this.root = root; - this.bodyParts = new ModelPart[4]; + super(root); for (int i = 0; i < 4; i++) { this.bodyParts[i] = root.getChild(createSegmentName(i)); @@ -54,15 +52,12 @@ public class EndermiteModel extends HierarchicalModel { } @Override - public ModelPart root() { - return this.root; - } + public void setupAnim(EntityRenderState entityRenderState) { + super.setupAnim(entityRenderState); - @Override - public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { for (int i = 0; i < this.bodyParts.length; i++) { - this.bodyParts[i].yRot = Mth.cos(ageInTicks * 0.9F + i * 0.15F * (float) Math.PI) * (float) Math.PI * 0.01F * (1 + Math.abs(i - 2)); - this.bodyParts[i].x = Mth.sin(ageInTicks * 0.9F + i * 0.15F * (float) Math.PI) * (float) Math.PI * 0.1F * Math.abs(i - 2); + this.bodyParts[i].yRot = Mth.cos(entityRenderState.ageInTicks * 0.9F + i * 0.15F * (float) Math.PI) * (float) Math.PI * 0.01F * (1 + Math.abs(i - 2)); + this.bodyParts[i].x = Mth.sin(entityRenderState.ageInTicks * 0.9F + i * 0.15F * (float) Math.PI) * (float) Math.PI * 0.1F * Math.abs(i - 2); } } } diff --git a/net/minecraft/client/model/EntityModel.java b/net/minecraft/client/model/EntityModel.java index fafd5b1a..bd4f44e1 100644 --- a/net/minecraft/client/model/EntityModel.java +++ b/net/minecraft/client/model/EntityModel.java @@ -3,35 +3,24 @@ package net.minecraft.client.model; import java.util.function.Function; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; +import net.minecraft.client.model.geom.ModelPart; import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.entity.state.EntityRenderState; import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.entity.Entity; @Environment(EnvType.CLIENT) -public abstract class EntityModel extends Model { - public float attackTime; - public boolean riding; - public boolean young = true; +public abstract class EntityModel extends Model { + public static final float MODEL_Y_OFFSET = -1.501F; - protected EntityModel() { - this(RenderType::entityCutoutNoCull); + protected EntityModel(ModelPart modelPart) { + this(modelPart, RenderType::entityCutoutNoCull); } - protected EntityModel(Function renderType) { - super(renderType); + protected EntityModel(ModelPart modelPart, Function function) { + super(modelPart, function); } - /** - * Sets this entity's model rotation angles - */ - public abstract void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch); - - public void prepareMobModel(T entity, float limbSwing, float limbSwingAmount, float partialTick) { - } - - public void copyPropertiesTo(EntityModel otherModel) { - otherModel.attackTime = this.attackTime; - otherModel.riding = this.riding; - otherModel.young = this.young; + public void setupAnim(T entityRenderState) { + this.resetPose(); } } diff --git a/net/minecraft/client/model/EvokerFangsModel.java b/net/minecraft/client/model/EvokerFangsModel.java index ac05154b..2af41715 100644 --- a/net/minecraft/client/model/EvokerFangsModel.java +++ b/net/minecraft/client/model/EvokerFangsModel.java @@ -8,56 +8,53 @@ import net.minecraft.client.model.geom.builders.CubeListBuilder; import net.minecraft.client.model.geom.builders.LayerDefinition; import net.minecraft.client.model.geom.builders.MeshDefinition; import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.client.renderer.entity.state.EvokerFangsRenderState; import net.minecraft.util.Mth; -import net.minecraft.world.entity.Entity; @Environment(EnvType.CLIENT) -public class EvokerFangsModel extends HierarchicalModel { +public class EvokerFangsModel extends EntityModel { private static final String BASE = "base"; private static final String UPPER_JAW = "upper_jaw"; private static final String LOWER_JAW = "lower_jaw"; - private final ModelPart root; private final ModelPart base; private final ModelPart upperJaw; private final ModelPart lowerJaw; public EvokerFangsModel(ModelPart root) { - this.root = root; + super(root); this.base = root.getChild("base"); - this.upperJaw = root.getChild("upper_jaw"); - this.lowerJaw = root.getChild("lower_jaw"); + this.upperJaw = this.base.getChild("upper_jaw"); + this.lowerJaw = this.base.getChild("lower_jaw"); } public static LayerDefinition createBodyLayer() { MeshDefinition meshDefinition = new MeshDefinition(); PartDefinition partDefinition = meshDefinition.getRoot(); - partDefinition.addOrReplaceChild( + PartDefinition partDefinition2 = partDefinition.addOrReplaceChild( "base", CubeListBuilder.create().texOffs(0, 0).addBox(0.0F, 0.0F, 0.0F, 10.0F, 12.0F, 10.0F), PartPose.offset(-5.0F, 24.0F, -5.0F) ); CubeListBuilder cubeListBuilder = CubeListBuilder.create().texOffs(40, 0).addBox(0.0F, 0.0F, 0.0F, 4.0F, 14.0F, 8.0F); - partDefinition.addOrReplaceChild("upper_jaw", cubeListBuilder, PartPose.offset(1.5F, 24.0F, -4.0F)); - partDefinition.addOrReplaceChild("lower_jaw", cubeListBuilder, PartPose.offsetAndRotation(-1.5F, 24.0F, 4.0F, 0.0F, (float) Math.PI, 0.0F)); + partDefinition2.addOrReplaceChild("upper_jaw", cubeListBuilder, PartPose.offsetAndRotation(6.5F, 0.0F, 1.0F, 0.0F, 0.0F, 2.042035F)); + partDefinition2.addOrReplaceChild("lower_jaw", cubeListBuilder, PartPose.offsetAndRotation(3.5F, 0.0F, 9.0F, 0.0F, (float) Math.PI, 4.2411504F)); return LayerDefinition.create(meshDefinition, 64, 32); } - @Override - public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { - float f = limbSwing * 2.0F; - if (f > 1.0F) { - f = 1.0F; + public void setupAnim(EvokerFangsRenderState evokerFangsRenderState) { + super.setupAnim(evokerFangsRenderState); + float f = evokerFangsRenderState.biteProgress; + float g = Math.min(f * 2.0F, 1.0F); + g = 1.0F - g * g * g; + this.upperJaw.zRot = (float) Math.PI - g * 0.35F * (float) Math.PI; + this.lowerJaw.zRot = (float) Math.PI + g * 0.35F * (float) Math.PI; + this.base.y = this.base.y - (f + Mth.sin(f * 2.7F)) * 7.2F; + float h = 1.0F; + if (f > 0.9F) { + h *= (1.0F - f) / 0.1F; } - f = 1.0F - f * f * f; - this.upperJaw.zRot = (float) Math.PI - f * 0.35F * (float) Math.PI; - this.lowerJaw.zRot = (float) Math.PI + f * 0.35F * (float) Math.PI; - float g = (limbSwing + Mth.sin(limbSwing * 2.7F)) * 0.6F * 12.0F; - this.upperJaw.y = 24.0F - g; - this.lowerJaw.y = this.upperJaw.y; - this.base.y = this.upperJaw.y; - } - - @Override - public ModelPart root() { - return this.root; + this.root.y = 24.0F - 20.0F * h; + this.root.xScale = h; + this.root.yScale = h; + this.root.zScale = h; } } diff --git a/net/minecraft/client/model/FelineModel.java b/net/minecraft/client/model/FelineModel.java new file mode 100644 index 00000000..c925f93c --- /dev/null +++ b/net/minecraft/client/model/FelineModel.java @@ -0,0 +1,174 @@ +package net.minecraft.client.model; + +import java.util.Set; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.MeshTransformer; +import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.client.renderer.entity.state.FelineRenderState; +import net.minecraft.util.Mth; + +@Environment(EnvType.CLIENT) +public class FelineModel extends EntityModel { + public static final MeshTransformer BABY_TRANSFORMER = new BabyModelTransform(true, 10.0F, 4.0F, Set.of("head")); + public static final MeshTransformer CAT_TRANSFORMER = MeshTransformer.scaling(0.8F); + private static final float XO = 0.0F; + private static final float YO = 16.0F; + private static final float ZO = -9.0F; + protected static final float BACK_LEG_Y = 18.0F; + protected static final float BACK_LEG_Z = 5.0F; + protected static final float FRONT_LEG_Y = 14.1F; + private static final float FRONT_LEG_Z = -5.0F; + private static final String TAIL_1 = "tail1"; + private static final String TAIL_2 = "tail2"; + protected final ModelPart leftHindLeg; + protected final ModelPart rightHindLeg; + protected final ModelPart leftFrontLeg; + protected final ModelPart rightFrontLeg; + protected final ModelPart tail1; + protected final ModelPart tail2; + protected final ModelPart head; + protected final ModelPart body; + + public FelineModel(ModelPart modelPart) { + super(modelPart); + this.head = modelPart.getChild("head"); + this.body = modelPart.getChild("body"); + this.tail1 = modelPart.getChild("tail1"); + this.tail2 = modelPart.getChild("tail2"); + this.leftHindLeg = modelPart.getChild("left_hind_leg"); + this.rightHindLeg = modelPart.getChild("right_hind_leg"); + this.leftFrontLeg = modelPart.getChild("left_front_leg"); + this.rightFrontLeg = modelPart.getChild("right_front_leg"); + } + + public static MeshDefinition createBodyMesh(CubeDeformation cubeDeformation) { + MeshDefinition meshDefinition = new MeshDefinition(); + PartDefinition partDefinition = meshDefinition.getRoot(); + CubeDeformation cubeDeformation2 = new CubeDeformation(-0.02F); + partDefinition.addOrReplaceChild( + "head", + CubeListBuilder.create() + .addBox("main", -2.5F, -2.0F, -3.0F, 5.0F, 4.0F, 5.0F, cubeDeformation) + .addBox("nose", -1.5F, -0.001F, -4.0F, 3, 2, 2, cubeDeformation, 0, 24) + .addBox("ear1", -2.0F, -3.0F, 0.0F, 1, 1, 2, cubeDeformation, 0, 10) + .addBox("ear2", 1.0F, -3.0F, 0.0F, 1, 1, 2, cubeDeformation, 6, 10), + PartPose.offset(0.0F, 15.0F, -9.0F) + ); + partDefinition.addOrReplaceChild( + "body", + CubeListBuilder.create().texOffs(20, 0).addBox(-2.0F, 3.0F, -8.0F, 4.0F, 16.0F, 6.0F, cubeDeformation), + PartPose.offsetAndRotation(0.0F, 12.0F, -10.0F, (float) (Math.PI / 2), 0.0F, 0.0F) + ); + partDefinition.addOrReplaceChild( + "tail1", + CubeListBuilder.create().texOffs(0, 15).addBox(-0.5F, 0.0F, 0.0F, 1.0F, 8.0F, 1.0F, cubeDeformation), + PartPose.offsetAndRotation(0.0F, 15.0F, 8.0F, 0.9F, 0.0F, 0.0F) + ); + partDefinition.addOrReplaceChild( + "tail2", CubeListBuilder.create().texOffs(4, 15).addBox(-0.5F, 0.0F, 0.0F, 1.0F, 8.0F, 1.0F, cubeDeformation2), PartPose.offset(0.0F, 20.0F, 14.0F) + ); + CubeListBuilder cubeListBuilder = CubeListBuilder.create().texOffs(8, 13).addBox(-1.0F, 0.0F, 1.0F, 2.0F, 6.0F, 2.0F, cubeDeformation); + partDefinition.addOrReplaceChild("left_hind_leg", cubeListBuilder, PartPose.offset(1.1F, 18.0F, 5.0F)); + partDefinition.addOrReplaceChild("right_hind_leg", cubeListBuilder, PartPose.offset(-1.1F, 18.0F, 5.0F)); + CubeListBuilder cubeListBuilder2 = CubeListBuilder.create().texOffs(40, 0).addBox(-1.0F, 0.0F, 0.0F, 2.0F, 10.0F, 2.0F, cubeDeformation); + partDefinition.addOrReplaceChild("left_front_leg", cubeListBuilder2, PartPose.offset(1.2F, 14.1F, -5.0F)); + partDefinition.addOrReplaceChild("right_front_leg", cubeListBuilder2, PartPose.offset(-1.2F, 14.1F, -5.0F)); + return meshDefinition; + } + + public void setupAnim(T felineRenderState) { + super.setupAnim(felineRenderState); + if (felineRenderState.isCrouching) { + this.body.y++; + this.head.y += 2.0F; + this.tail1.y++; + this.tail2.y += -4.0F; + this.tail2.z += 2.0F; + this.tail1.xRot = (float) (Math.PI / 2); + this.tail2.xRot = (float) (Math.PI / 2); + } else if (felineRenderState.isSprinting) { + this.tail2.y = this.tail1.y; + this.tail2.z += 2.0F; + this.tail1.xRot = (float) (Math.PI / 2); + this.tail2.xRot = (float) (Math.PI / 2); + } + + this.head.xRot = felineRenderState.xRot * (float) (Math.PI / 180.0); + this.head.yRot = felineRenderState.yRot * (float) (Math.PI / 180.0); + if (!felineRenderState.isSitting) { + this.body.xRot = (float) (Math.PI / 2); + float f = felineRenderState.walkAnimationSpeed; + float g = felineRenderState.walkAnimationPos; + if (felineRenderState.isSprinting) { + this.leftHindLeg.xRot = Mth.cos(g * 0.6662F) * f; + this.rightHindLeg.xRot = Mth.cos(g * 0.6662F + 0.3F) * f; + this.leftFrontLeg.xRot = Mth.cos(g * 0.6662F + (float) Math.PI + 0.3F) * f; + this.rightFrontLeg.xRot = Mth.cos(g * 0.6662F + (float) Math.PI) * f; + this.tail2.xRot = 1.7278761F + (float) (Math.PI / 10) * Mth.cos(g) * f; + } else { + this.leftHindLeg.xRot = Mth.cos(g * 0.6662F) * f; + this.rightHindLeg.xRot = Mth.cos(g * 0.6662F + (float) Math.PI) * f; + this.leftFrontLeg.xRot = Mth.cos(g * 0.6662F + (float) Math.PI) * f; + this.rightFrontLeg.xRot = Mth.cos(g * 0.6662F) * f; + if (!felineRenderState.isCrouching) { + this.tail2.xRot = 1.7278761F + (float) (Math.PI / 4) * Mth.cos(g) * f; + } else { + this.tail2.xRot = 1.7278761F + 0.47123894F * Mth.cos(g) * f; + } + } + } + + float f = felineRenderState.ageScale; + if (felineRenderState.isSitting) { + this.body.xRot = (float) (Math.PI / 4); + this.body.y += -4.0F * f; + this.body.z += 5.0F * f; + this.head.y += -3.3F * f; + this.head.z += 1.0F * f; + this.tail1.y += 8.0F * f; + this.tail1.z += -2.0F * f; + this.tail2.y += 2.0F * f; + this.tail2.z += -0.8F * f; + this.tail1.xRot = 1.7278761F; + this.tail2.xRot = 2.670354F; + this.leftFrontLeg.xRot = (float) (-Math.PI / 20); + this.leftFrontLeg.y += 2.0F * f; + this.leftFrontLeg.z -= 2.0F * f; + this.rightFrontLeg.xRot = (float) (-Math.PI / 20); + this.rightFrontLeg.y += 2.0F * f; + this.rightFrontLeg.z -= 2.0F * f; + this.leftHindLeg.xRot = (float) (-Math.PI / 2); + this.leftHindLeg.y += 3.0F * f; + this.leftHindLeg.z -= 4.0F * f; + this.rightHindLeg.xRot = (float) (-Math.PI / 2); + this.rightHindLeg.y += 3.0F * f; + this.rightHindLeg.z -= 4.0F * f; + } + + if (felineRenderState.lieDownAmount > 0.0F) { + this.head.zRot = Mth.rotLerp(felineRenderState.lieDownAmount, this.head.zRot, -1.2707963F); + this.head.yRot = Mth.rotLerp(felineRenderState.lieDownAmount, this.head.yRot, 1.2707963F); + this.leftFrontLeg.xRot = -1.2707963F; + this.rightFrontLeg.xRot = -0.47079635F; + this.rightFrontLeg.zRot = -0.2F; + this.rightFrontLeg.x += f; + this.leftHindLeg.xRot = -0.4F; + this.rightHindLeg.xRot = 0.5F; + this.rightHindLeg.zRot = -0.5F; + this.rightHindLeg.x += 0.8F * f; + this.rightHindLeg.y += 2.0F * f; + this.tail1.xRot = Mth.rotLerp(felineRenderState.lieDownAmountTail, this.tail1.xRot, 0.8F); + this.tail2.xRot = Mth.rotLerp(felineRenderState.lieDownAmountTail, this.tail2.xRot, -0.4F); + } + + if (felineRenderState.relaxStateOneAmount > 0.0F) { + this.head.xRot = Mth.rotLerp(felineRenderState.relaxStateOneAmount, this.head.xRot, -0.58177644F); + } + } +} diff --git a/net/minecraft/client/model/FoxModel.java b/net/minecraft/client/model/FoxModel.java index 77eb2c31..a08f423c 100644 --- a/net/minecraft/client/model/FoxModel.java +++ b/net/minecraft/client/model/FoxModel.java @@ -1,6 +1,6 @@ package net.minecraft.client.model; -import com.google.common.collect.ImmutableList; +import java.util.Set; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.model.geom.ModelPart; @@ -9,12 +9,14 @@ import net.minecraft.client.model.geom.builders.CubeDeformation; import net.minecraft.client.model.geom.builders.CubeListBuilder; import net.minecraft.client.model.geom.builders.LayerDefinition; import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.MeshTransformer; import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.client.renderer.entity.state.FoxRenderState; import net.minecraft.util.Mth; -import net.minecraft.world.entity.animal.Fox; @Environment(EnvType.CLIENT) -public class FoxModel extends AgeableListModel { +public class FoxModel extends EntityModel { + public static final MeshTransformer BABY_TRANSFORMER = new BabyModelTransform(true, 8.0F, 3.35F, Set.of("head")); public final ModelPart head; private final ModelPart body; private final ModelPart rightHindLeg; @@ -28,7 +30,7 @@ public class FoxModel extends AgeableListModel { private float legMotionPos; public FoxModel(ModelPart root) { - super(true, 8.0F, 3.35F); + super(root); this.head = root.getChild("head"); this.body = root.getChild("body"); this.rightHindLeg = root.getChild("right_hind_leg"); @@ -67,104 +69,90 @@ public class FoxModel extends AgeableListModel { return LayerDefinition.create(meshDefinition, 48, 32); } - public void prepareMobModel(T entity, float limbSwing, float limbSwingAmount, float partialTick) { - this.body.xRot = (float) (Math.PI / 2); - this.tail.xRot = -0.05235988F; - this.rightHindLeg.xRot = Mth.cos(limbSwing * 0.6662F) * 1.4F * limbSwingAmount; - this.leftHindLeg.xRot = Mth.cos(limbSwing * 0.6662F + (float) Math.PI) * 1.4F * limbSwingAmount; - this.rightFrontLeg.xRot = Mth.cos(limbSwing * 0.6662F + (float) Math.PI) * 1.4F * limbSwingAmount; - this.leftFrontLeg.xRot = Mth.cos(limbSwing * 0.6662F) * 1.4F * limbSwingAmount; - this.head.setPos(-1.0F, 16.5F, -3.0F); - this.head.yRot = 0.0F; - this.head.zRot = entity.getHeadRollAngle(partialTick); + public void setupAnim(FoxRenderState foxRenderState) { + super.setupAnim(foxRenderState); + float f = foxRenderState.walkAnimationSpeed; + float g = foxRenderState.walkAnimationPos; + this.rightHindLeg.xRot = Mth.cos(g * 0.6662F) * 1.4F * f; + this.leftHindLeg.xRot = Mth.cos(g * 0.6662F + (float) Math.PI) * 1.4F * f; + this.rightFrontLeg.xRot = Mth.cos(g * 0.6662F + (float) Math.PI) * 1.4F * f; + this.leftFrontLeg.xRot = Mth.cos(g * 0.6662F) * 1.4F * f; + this.head.zRot = foxRenderState.headRollAngle; this.rightHindLeg.visible = true; this.leftHindLeg.visible = true; this.rightFrontLeg.visible = true; this.leftFrontLeg.visible = true; - this.body.setPos(0.0F, 16.0F, -6.0F); - this.body.zRot = 0.0F; - this.rightHindLeg.setPos(-5.0F, 17.5F, 7.0F); - this.leftHindLeg.setPos(-1.0F, 17.5F, 7.0F); - if (entity.isCrouching()) { - this.body.xRot = 1.6755161F; - float f = entity.getCrouchAmount(partialTick); - this.body.setPos(0.0F, 16.0F + entity.getCrouchAmount(partialTick), -6.0F); - this.head.setPos(-1.0F, 16.5F + f, -3.0F); - this.head.yRot = 0.0F; - } else if (entity.isSleeping()) { + float h = foxRenderState.ageScale; + if (foxRenderState.isCrouching) { + this.body.xRot += 0.10471976F; + float i = foxRenderState.crouchAmount; + this.body.y += i * h; + this.head.y += i * h; + } else if (foxRenderState.isSleeping) { this.body.zRot = (float) (-Math.PI / 2); - this.body.setPos(0.0F, 21.0F, -6.0F); + this.body.y += 5.0F * h; this.tail.xRot = (float) (-Math.PI * 5.0 / 6.0); - if (this.young) { + if (foxRenderState.isBaby) { this.tail.xRot = -2.1816616F; - this.body.setPos(0.0F, 21.0F, -2.0F); + this.body.z += 2.0F; } - this.head.setPos(1.0F, 19.49F, -3.0F); - this.head.xRot = 0.0F; + this.head.x += 2.0F * h; + this.head.y += 2.99F * h; this.head.yRot = (float) (-Math.PI * 2.0 / 3.0); this.head.zRot = 0.0F; this.rightHindLeg.visible = false; this.leftHindLeg.visible = false; this.rightFrontLeg.visible = false; this.leftFrontLeg.visible = false; - } else if (entity.isSitting()) { + } else if (foxRenderState.isSitting) { this.body.xRot = (float) (Math.PI / 6); - this.body.setPos(0.0F, 9.0F, -3.0F); + this.body.y -= 7.0F * h; + this.body.z += 3.0F * h; this.tail.xRot = (float) (Math.PI / 4); - this.tail.setPos(-4.0F, 15.0F, -2.0F); - this.head.setPos(-1.0F, 10.0F, -0.25F); + this.tail.z -= 1.0F * h; this.head.xRot = 0.0F; this.head.yRot = 0.0F; - if (this.young) { - this.head.setPos(-1.0F, 13.0F, -3.75F); + if (foxRenderState.isBaby) { + this.head.y--; + this.head.z -= 0.375F; + } else { + this.head.y -= 6.5F; + this.head.z += 2.75F; } this.rightHindLeg.xRot = (float) (-Math.PI * 5.0 / 12.0); - this.rightHindLeg.setPos(-5.0F, 21.5F, 6.75F); + this.rightHindLeg.y += 4.0F * h; + this.rightHindLeg.z -= 0.25F * h; this.leftHindLeg.xRot = (float) (-Math.PI * 5.0 / 12.0); - this.leftHindLeg.setPos(-1.0F, 21.5F, 6.75F); + this.leftHindLeg.y += 4.0F * h; + this.leftHindLeg.z -= 0.25F * h; this.rightFrontLeg.xRot = (float) (-Math.PI / 12); this.leftFrontLeg.xRot = (float) (-Math.PI / 12); } - } - @Override - protected Iterable headParts() { - return ImmutableList.of(this.head); - } - - @Override - protected Iterable bodyParts() { - return ImmutableList.of(this.body, this.rightHindLeg, this.leftHindLeg, this.rightFrontLeg, this.leftFrontLeg); - } - - /** - * Sets this entity's model rotation angles - */ - public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { - if (!entity.isSleeping() && !entity.isFaceplanted() && !entity.isCrouching()) { - this.head.xRot = headPitch * (float) (Math.PI / 180.0); - this.head.yRot = netHeadYaw * (float) (Math.PI / 180.0); + if (!foxRenderState.isSleeping && !foxRenderState.isFaceplanted && !foxRenderState.isCrouching) { + this.head.xRot = foxRenderState.xRot * (float) (Math.PI / 180.0); + this.head.yRot = foxRenderState.yRot * (float) (Math.PI / 180.0); } - if (entity.isSleeping()) { + if (foxRenderState.isSleeping) { this.head.xRot = 0.0F; this.head.yRot = (float) (-Math.PI * 2.0 / 3.0); - this.head.zRot = Mth.cos(ageInTicks * 0.027F) / 22.0F; + this.head.zRot = Mth.cos(foxRenderState.ageInTicks * 0.027F) / 22.0F; } - if (entity.isCrouching()) { - float f = Mth.cos(ageInTicks) * 0.01F; - this.body.yRot = f; - this.rightHindLeg.zRot = f; - this.leftHindLeg.zRot = f; - this.rightFrontLeg.zRot = f / 2.0F; - this.leftFrontLeg.zRot = f / 2.0F; + if (foxRenderState.isCrouching) { + float i = Mth.cos(foxRenderState.ageInTicks) * 0.01F; + this.body.yRot = i; + this.rightHindLeg.zRot = i; + this.leftHindLeg.zRot = i; + this.rightFrontLeg.zRot = i / 2.0F; + this.leftFrontLeg.zRot = i / 2.0F; } - if (entity.isFaceplanted()) { - float f = 0.1F; + if (foxRenderState.isFaceplanted) { + float i = 0.1F; this.legMotionPos += 0.67F; this.rightHindLeg.xRot = Mth.cos(this.legMotionPos * 0.4662F) * 0.1F; this.leftHindLeg.xRot = Mth.cos(this.legMotionPos * 0.4662F + (float) Math.PI) * 0.1F; diff --git a/net/minecraft/client/model/FrogModel.java b/net/minecraft/client/model/FrogModel.java index cfd1b65d..2eb65f82 100644 --- a/net/minecraft/client/model/FrogModel.java +++ b/net/minecraft/client/model/FrogModel.java @@ -10,35 +10,25 @@ import net.minecraft.client.model.geom.builders.CubeListBuilder; import net.minecraft.client.model.geom.builders.LayerDefinition; import net.minecraft.client.model.geom.builders.MeshDefinition; import net.minecraft.client.model.geom.builders.PartDefinition; -import net.minecraft.world.entity.animal.frog.Frog; +import net.minecraft.client.renderer.entity.state.FrogRenderState; @Environment(EnvType.CLIENT) -public class FrogModel extends HierarchicalModel { +public class FrogModel extends EntityModel { private static final float MAX_WALK_ANIMATION_SPEED = 1.5F; private static final float MAX_SWIM_ANIMATION_SPEED = 1.0F; private static final float WALK_ANIMATION_SCALE_FACTOR = 2.5F; - private final ModelPart root; - private final ModelPart body; - private final ModelPart head; - private final ModelPart eyes; - private final ModelPart tongue; - private final ModelPart leftArm; - private final ModelPart rightArm; - private final ModelPart leftLeg; - private final ModelPart rightLeg; - private final ModelPart croakingBody; + private final ModelPart body = this.root.getChild("body"); + private final ModelPart head = this.body.getChild("head"); + private final ModelPart eyes = this.head.getChild("eyes"); + private final ModelPart tongue = this.body.getChild("tongue"); + private final ModelPart leftArm = this.body.getChild("left_arm"); + private final ModelPart rightArm = this.body.getChild("right_arm"); + private final ModelPart leftLeg = this.root.getChild("left_leg"); + private final ModelPart rightLeg = this.root.getChild("right_leg"); + private final ModelPart croakingBody = this.body.getChild("croaking_body"); public FrogModel(ModelPart root) { - this.root = root.getChild("root"); - this.body = this.root.getChild("body"); - this.head = this.body.getChild("head"); - this.eyes = this.head.getChild("eyes"); - this.tongue = this.body.getChild("tongue"); - this.leftArm = this.body.getChild("left_arm"); - this.rightArm = this.body.getChild("right_arm"); - this.leftLeg = this.root.getChild("left_leg"); - this.rightLeg = this.root.getChild("right_leg"); - this.croakingBody = this.body.getChild("croaking_body"); + super(root.getChild("root")); } public static LayerDefinition createBodyLayer() { @@ -97,26 +87,18 @@ public class FrogModel extends HierarchicalModel { return LayerDefinition.create(meshDefinition, 48, 48); } - /** - * Sets this entity's model rotation angles - */ - public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { - this.root().getAllParts().forEach(ModelPart::resetPose); - this.animate(entity.jumpAnimationState, FrogAnimation.FROG_JUMP, ageInTicks); - this.animate(entity.croakAnimationState, FrogAnimation.FROG_CROAK, ageInTicks); - this.animate(entity.tongueAnimationState, FrogAnimation.FROG_TONGUE, ageInTicks); - if (entity.isInWaterOrBubble()) { - this.animateWalk(FrogAnimation.FROG_SWIM, limbSwing, limbSwingAmount, 1.0F, 2.5F); + public void setupAnim(FrogRenderState frogRenderState) { + super.setupAnim(frogRenderState); + this.animate(frogRenderState.jumpAnimationState, FrogAnimation.FROG_JUMP, frogRenderState.ageInTicks); + this.animate(frogRenderState.croakAnimationState, FrogAnimation.FROG_CROAK, frogRenderState.ageInTicks); + this.animate(frogRenderState.tongueAnimationState, FrogAnimation.FROG_TONGUE, frogRenderState.ageInTicks); + if (frogRenderState.isSwimming) { + this.animateWalk(FrogAnimation.FROG_SWIM, frogRenderState.walkAnimationPos, frogRenderState.walkAnimationSpeed, 1.0F, 2.5F); } else { - this.animateWalk(FrogAnimation.FROG_WALK, limbSwing, limbSwingAmount, 1.5F, 2.5F); + this.animateWalk(FrogAnimation.FROG_WALK, frogRenderState.walkAnimationPos, frogRenderState.walkAnimationSpeed, 1.5F, 2.5F); } - this.animate(entity.swimIdleAnimationState, FrogAnimation.FROG_IDLE_WATER, ageInTicks); - this.croakingBody.visible = entity.croakAnimationState.isStarted(); - } - - @Override - public ModelPart root() { - return this.root; + this.animate(frogRenderState.swimIdleAnimationState, FrogAnimation.FROG_IDLE_WATER, frogRenderState.ageInTicks); + this.croakingBody.visible = frogRenderState.croakAnimationState.isStarted(); } } diff --git a/net/minecraft/client/model/GhastModel.java b/net/minecraft/client/model/GhastModel.java index 71cfe790..f6984a13 100644 --- a/net/minecraft/client/model/GhastModel.java +++ b/net/minecraft/client/model/GhastModel.java @@ -7,18 +7,18 @@ import net.minecraft.client.model.geom.PartPose; import net.minecraft.client.model.geom.builders.CubeListBuilder; import net.minecraft.client.model.geom.builders.LayerDefinition; import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.MeshTransformer; import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.client.renderer.entity.state.GhastRenderState; import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; -import net.minecraft.world.entity.Entity; @Environment(EnvType.CLIENT) -public class GhastModel extends HierarchicalModel { - private final ModelPart root; +public class GhastModel extends EntityModel { private final ModelPart[] tentacles = new ModelPart[9]; public GhastModel(ModelPart root) { - this.root = root; + super(root); for (int i = 0; i < this.tentacles.length; i++) { this.tentacles[i] = root.getChild(createTentacleName(i)); @@ -46,18 +46,14 @@ public class GhastModel extends HierarchicalModel { ); } - return LayerDefinition.create(meshDefinition, 64, 32); + return LayerDefinition.create(meshDefinition, 64, 32).apply(MeshTransformer.scaling(4.5F)); } - @Override - public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { + public void setupAnim(GhastRenderState ghastRenderState) { + super.setupAnim(ghastRenderState); + for (int i = 0; i < this.tentacles.length; i++) { - this.tentacles[i].xRot = 0.2F * Mth.sin(ageInTicks * 0.3F + i) + 0.4F; + this.tentacles[i].xRot = 0.2F * Mth.sin(ghastRenderState.ageInTicks * 0.3F + i) + 0.4F; } } - - @Override - public ModelPart root() { - return this.root; - } } diff --git a/net/minecraft/client/model/GiantZombieModel.java b/net/minecraft/client/model/GiantZombieModel.java index 6c442b5c..5db8714f 100644 --- a/net/minecraft/client/model/GiantZombieModel.java +++ b/net/minecraft/client/model/GiantZombieModel.java @@ -3,15 +3,11 @@ package net.minecraft.client.model; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.model.geom.ModelPart; -import net.minecraft.world.entity.monster.Giant; +import net.minecraft.client.renderer.entity.state.ZombieRenderState; @Environment(EnvType.CLIENT) -public class GiantZombieModel extends AbstractZombieModel { +public class GiantZombieModel extends AbstractZombieModel { public GiantZombieModel(ModelPart root) { super(root); } - - public boolean isAggressive(Giant entity) { - return false; - } } diff --git a/net/minecraft/client/model/GoatModel.java b/net/minecraft/client/model/GoatModel.java index 4f948013..86c3bd51 100644 --- a/net/minecraft/client/model/GoatModel.java +++ b/net/minecraft/client/model/GoatModel.java @@ -1,5 +1,6 @@ package net.minecraft.client.model; +import java.util.Set; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.model.geom.ModelPart; @@ -7,13 +8,16 @@ import net.minecraft.client.model.geom.PartPose; import net.minecraft.client.model.geom.builders.CubeListBuilder; import net.minecraft.client.model.geom.builders.LayerDefinition; import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.MeshTransformer; import net.minecraft.client.model.geom.builders.PartDefinition; -import net.minecraft.world.entity.animal.goat.Goat; +import net.minecraft.client.renderer.entity.state.GoatRenderState; @Environment(EnvType.CLIENT) -public class GoatModel extends QuadrupedModel { +public class GoatModel extends QuadrupedModel { + public static final MeshTransformer BABY_TRANSFORMER = new BabyModelTransform(true, 19.0F, 1.0F, 2.5F, 2.0F, 24.0F, Set.of("head")); + public GoatModel(ModelPart root) { - super(root, true, 19.0F, 1.0F, 2.5F, 2.0F, 24); + super(root); } public static LayerDefinition createBodyLayer() { @@ -62,16 +66,12 @@ public class GoatModel extends QuadrupedModel { return LayerDefinition.create(meshDefinition, 64, 64); } - /** - * Sets this entity's model rotation angles - */ - public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { - this.head.getChild("left_horn").visible = entity.hasLeftHorn(); - this.head.getChild("right_horn").visible = entity.hasRightHorn(); - super.setupAnim(entity, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch); - float f = entity.getRammingXHeadRot(); - if (f != 0.0F) { - this.head.xRot = f; + public void setupAnim(GoatRenderState goatRenderState) { + super.setupAnim(goatRenderState); + this.head.getChild("left_horn").visible = goatRenderState.hasLeftHorn; + this.head.getChild("right_horn").visible = goatRenderState.hasRightHorn; + if (goatRenderState.rammingXHeadRot != 0.0F) { + this.head.xRot = goatRenderState.rammingXHeadRot; } } } diff --git a/net/minecraft/client/model/GuardianModel.java b/net/minecraft/client/model/GuardianModel.java index 80b79efd..89f0b5f4 100644 --- a/net/minecraft/client/model/GuardianModel.java +++ b/net/minecraft/client/model/GuardianModel.java @@ -2,20 +2,20 @@ package net.minecraft.client.model; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; -import net.minecraft.client.Minecraft; import net.minecraft.client.model.geom.ModelPart; import net.minecraft.client.model.geom.PartPose; import net.minecraft.client.model.geom.builders.CubeListBuilder; import net.minecraft.client.model.geom.builders.LayerDefinition; import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.MeshTransformer; import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.client.renderer.entity.state.GuardianRenderState; import net.minecraft.util.Mth; -import net.minecraft.world.entity.Entity; -import net.minecraft.world.entity.monster.Guardian; import net.minecraft.world.phys.Vec3; @Environment(EnvType.CLIENT) -public class GuardianModel extends HierarchicalModel { +public class GuardianModel extends EntityModel { + public static final MeshTransformer ELDER_GUARDIAN_SCALE = MeshTransformer.scaling(2.35F); private static final float[] SPIKE_X_ROT = new float[]{1.75F, 0.25F, 0.0F, 0.0F, 0.5F, 0.5F, 0.5F, 0.5F, 1.25F, 0.75F, 0.0F, 0.0F}; private static final float[] SPIKE_Y_ROT = new float[]{0.0F, 0.0F, 0.0F, 0.0F, 0.25F, 1.75F, 1.25F, 0.75F, 0.0F, 0.0F, 0.0F, 0.0F}; private static final float[] SPIKE_Z_ROT = new float[]{0.0F, 0.0F, 0.25F, 1.75F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.75F, 1.25F}; @@ -26,15 +26,13 @@ public class GuardianModel extends HierarchicalModel { private static final String TAIL_0 = "tail0"; private static final String TAIL_1 = "tail1"; private static final String TAIL_2 = "tail2"; - private final ModelPart root; private final ModelPart head; private final ModelPart eye; - private final ModelPart[] spikeParts; + private final ModelPart[] spikeParts = new ModelPart[12]; private final ModelPart[] tailParts; public GuardianModel(ModelPart root) { - this.root = root; - this.spikeParts = new ModelPart[12]; + super(root); this.head = root.getChild("head"); for (int i = 0; i < this.spikeParts.length; i++) { @@ -99,47 +97,40 @@ public class GuardianModel extends HierarchicalModel { return LayerDefinition.create(meshDefinition, 64, 64); } - @Override - public ModelPart root() { - return this.root; + public static LayerDefinition createElderGuardianLayer() { + return createBodyLayer().apply(ELDER_GUARDIAN_SCALE); } - /** - * Sets this entity's model rotation angles - */ - public void setupAnim(Guardian entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { - float f = ageInTicks - entity.tickCount; - this.head.yRot = netHeadYaw * (float) (Math.PI / 180.0); - this.head.xRot = headPitch * (float) (Math.PI / 180.0); - float g = (1.0F - entity.getSpikesAnimation(f)) * 0.55F; - this.setupSpikes(ageInTicks, g); - Entity entity2 = Minecraft.getInstance().getCameraEntity(); - if (entity.hasActiveAttackTarget()) { - entity2 = entity.getActiveAttackTarget(); - } - - if (entity2 != null) { - Vec3 vec3 = entity2.getEyePosition(0.0F); - Vec3 vec32 = entity.getEyePosition(0.0F); - double d = vec3.y - vec32.y; + public void setupAnim(GuardianRenderState guardianRenderState) { + super.setupAnim(guardianRenderState); + this.head.yRot = guardianRenderState.yRot * (float) (Math.PI / 180.0); + this.head.xRot = guardianRenderState.xRot * (float) (Math.PI / 180.0); + float f = (1.0F - guardianRenderState.spikesAnimation) * 0.55F; + this.setupSpikes(guardianRenderState.ageInTicks, f); + if (guardianRenderState.lookAtPosition != null && guardianRenderState.lookDirection != null) { + double d = guardianRenderState.lookAtPosition.y - guardianRenderState.eyePosition.y; if (d > 0.0) { this.eye.y = 0.0F; } else { this.eye.y = 1.0F; } - Vec3 vec33 = entity.getViewVector(0.0F); - vec33 = new Vec3(vec33.x, 0.0, vec33.z); - Vec3 vec34 = new Vec3(vec32.x - vec3.x, 0.0, vec32.z - vec3.z).normalize().yRot((float) (Math.PI / 2)); - double e = vec33.dot(vec34); + Vec3 vec3 = guardianRenderState.lookDirection; + vec3 = new Vec3(vec3.x, 0.0, vec3.z); + Vec3 vec32 = new Vec3( + guardianRenderState.eyePosition.x - guardianRenderState.lookAtPosition.x, 0.0, guardianRenderState.eyePosition.z - guardianRenderState.lookAtPosition.z + ) + .normalize() + .yRot((float) (Math.PI / 2)); + double e = vec3.dot(vec32); this.eye.x = Mth.sqrt((float)Math.abs(e)) * 2.0F * (float)Math.signum(e); } this.eye.visible = true; - float h = entity.getTailAnimation(f); - this.tailParts[0].yRot = Mth.sin(h) * (float) Math.PI * 0.05F; - this.tailParts[1].yRot = Mth.sin(h) * (float) Math.PI * 0.1F; - this.tailParts[2].yRot = Mth.sin(h) * (float) Math.PI * 0.15F; + float g = guardianRenderState.tailAnimation; + this.tailParts[0].yRot = Mth.sin(g) * (float) Math.PI * 0.05F; + this.tailParts[1].yRot = Mth.sin(g) * (float) Math.PI * 0.1F; + this.tailParts[2].yRot = Mth.sin(g) * (float) Math.PI * 0.15F; } private void setupSpikes(float ageInTicks, float f) { diff --git a/net/minecraft/client/model/HierarchicalModel.java b/net/minecraft/client/model/HierarchicalModel.java deleted file mode 100644 index 2347a073..00000000 --- a/net/minecraft/client/model/HierarchicalModel.java +++ /dev/null @@ -1,65 +0,0 @@ -package net.minecraft.client.model; - -import com.mojang.blaze3d.vertex.PoseStack; -import com.mojang.blaze3d.vertex.VertexConsumer; -import java.util.Optional; -import java.util.function.Function; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.client.animation.AnimationDefinition; -import net.minecraft.client.animation.KeyframeAnimations; -import net.minecraft.client.model.geom.ModelPart; -import net.minecraft.client.renderer.RenderType; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.entity.AnimationState; -import net.minecraft.world.entity.Entity; -import org.joml.Vector3f; - -@Environment(EnvType.CLIENT) -public abstract class HierarchicalModel extends EntityModel { - private static final Vector3f ANIMATION_VECTOR_CACHE = new Vector3f(); - - public HierarchicalModel() { - this(RenderType::entityCutoutNoCull); - } - - public HierarchicalModel(Function renderType) { - super(renderType); - } - - @Override - public void renderToBuffer(PoseStack poseStack, VertexConsumer buffer, int packedLight, int packedOverlay, int color) { - this.root().render(poseStack, buffer, packedLight, packedOverlay, color); - } - - public abstract ModelPart root(); - - public Optional getAnyDescendantWithName(String name) { - return name.equals("root") - ? Optional.of(this.root()) - : this.root().getAllParts().filter(modelPart -> modelPart.hasChild(name)).findFirst().map(modelPart -> modelPart.getChild(name)); - } - - protected void animate(AnimationState animationState, AnimationDefinition animationDefinition, float ageInTicks) { - this.animate(animationState, animationDefinition, ageInTicks, 1.0F); - } - - protected void animateWalk( - AnimationDefinition animationDefinition, float limbSwing, float limbSwingAmount, float maxAnimationSpeed, float animationScaleFactor - ) { - long l = (long)(limbSwing * 50.0F * maxAnimationSpeed); - float f = Math.min(limbSwingAmount * animationScaleFactor, 1.0F); - KeyframeAnimations.animate(this, animationDefinition, l, f, ANIMATION_VECTOR_CACHE); - } - - protected void animate(AnimationState animationState, AnimationDefinition animationDefinition, float ageInTicks, float speed) { - animationState.updateTime(ageInTicks, speed); - animationState.ifStarted( - animationStatex -> KeyframeAnimations.animate(this, animationDefinition, animationStatex.getAccumulatedTime(), 1.0F, ANIMATION_VECTOR_CACHE) - ); - } - - protected void applyStatic(AnimationDefinition animationDefinition) { - KeyframeAnimations.animate(this, animationDefinition, 0L, 1.0F, ANIMATION_VECTOR_CACHE); - } -} diff --git a/net/minecraft/client/model/HoglinModel.java b/net/minecraft/client/model/HoglinModel.java index cab70602..05f08ecd 100644 --- a/net/minecraft/client/model/HoglinModel.java +++ b/net/minecraft/client/model/HoglinModel.java @@ -1,6 +1,6 @@ package net.minecraft.client.model; -import com.google.common.collect.ImmutableList; +import java.util.Set; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.model.geom.ModelPart; @@ -9,13 +9,14 @@ import net.minecraft.client.model.geom.builders.CubeDeformation; import net.minecraft.client.model.geom.builders.CubeListBuilder; import net.minecraft.client.model.geom.builders.LayerDefinition; import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.MeshTransformer; import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.client.renderer.entity.state.HoglinRenderState; import net.minecraft.util.Mth; -import net.minecraft.world.entity.Mob; -import net.minecraft.world.entity.monster.hoglin.HoglinBase; @Environment(EnvType.CLIENT) -public class HoglinModel extends AgeableListModel { +public class HoglinModel extends EntityModel { + public static final MeshTransformer BABY_TRANSFORMER = new BabyModelTransform(true, 8.0F, 6.0F, 1.9F, 2.0F, 24.0F, Set.of("head")); private static final float DEFAULT_HEAD_X_ROT = 0.87266463F; private static final float ATTACK_HEAD_X_ROT_END = (float) (-Math.PI / 9); private final ModelPart head; @@ -29,7 +30,7 @@ public class HoglinModel extends AgeableListModel private final ModelPart mane; public HoglinModel(ModelPart root) { - super(true, 8.0F, 6.0F, 1.9F, 2.0F, 24.0F); + super(root); this.body = root.getChild("body"); this.mane = this.body.getChild("mane"); this.head = root.getChild("head"); @@ -41,7 +42,7 @@ public class HoglinModel extends AgeableListModel this.leftHindLeg = root.getChild("left_hind_leg"); } - public static LayerDefinition createBodyLayer() { + private static MeshDefinition createMesh() { MeshDefinition meshDefinition = new MeshDefinition(); PartDefinition partDefinition = meshDefinition.getRoot(); PartDefinition partDefinition2 = partDefinition.addOrReplaceChild( @@ -50,7 +51,7 @@ public class HoglinModel extends AgeableListModel partDefinition2.addOrReplaceChild( "mane", CubeListBuilder.create().texOffs(90, 33).addBox(0.0F, 0.0F, -9.0F, 0.0F, 10.0F, 19.0F, new CubeDeformation(0.001F)), - PartPose.offset(0.0F, -14.0F, -5.0F) + PartPose.offset(0.0F, -14.0F, -7.0F) ); PartDefinition partDefinition3 = partDefinition.addOrReplaceChild( "head", @@ -87,40 +88,41 @@ public class HoglinModel extends AgeableListModel partDefinition.addOrReplaceChild( "left_hind_leg", CubeListBuilder.create().texOffs(0, 45).addBox(-2.5F, 0.0F, -2.5F, 5.0F, 11.0F, 5.0F), PartPose.offset(5.0F, 13.0F, 10.0F) ); + return meshDefinition; + } + + public static LayerDefinition createBodyLayer() { + MeshDefinition meshDefinition = createMesh(); return LayerDefinition.create(meshDefinition, 128, 64); } - @Override - protected Iterable headParts() { - return ImmutableList.of(this.head); + public static LayerDefinition createBabyLayer() { + MeshDefinition meshDefinition = createMesh(); + PartDefinition partDefinition = meshDefinition.getRoot().getChild("body"); + partDefinition.addOrReplaceChild( + "mane", + CubeListBuilder.create().texOffs(90, 33).addBox(0.0F, 0.0F, -9.0F, 0.0F, 10.0F, 19.0F, new CubeDeformation(0.001F)), + PartPose.offset(0.0F, -14.0F, -3.0F) + ); + return LayerDefinition.create(meshDefinition, 128, 64).apply(BABY_TRANSFORMER); } - @Override - protected Iterable bodyParts() { - return ImmutableList.of(this.body, this.rightFrontLeg, this.leftFrontLeg, this.rightHindLeg, this.leftHindLeg); - } - - /** - * Sets this entity's model rotation angles - */ - public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { - this.rightEar.zRot = (float) (-Math.PI * 2.0 / 9.0) - limbSwingAmount * Mth.sin(limbSwing); - this.leftEar.zRot = (float) (Math.PI * 2.0 / 9.0) + limbSwingAmount * Mth.sin(limbSwing); - this.head.yRot = netHeadYaw * (float) (Math.PI / 180.0); - int i = entity.getAttackAnimationRemainingTicks(); - float f = 1.0F - Mth.abs(10 - 2 * i) / 10.0F; - this.head.xRot = Mth.lerp(f, 0.87266463F, (float) (-Math.PI / 9)); - if (entity.isBaby()) { - this.head.y = Mth.lerp(f, 2.0F, 5.0F); - this.mane.z = -3.0F; - } else { - this.head.y = 2.0F; - this.mane.z = -7.0F; + public void setupAnim(HoglinRenderState hoglinRenderState) { + super.setupAnim(hoglinRenderState); + float f = hoglinRenderState.walkAnimationSpeed; + float g = hoglinRenderState.walkAnimationPos; + this.rightEar.zRot = (float) (-Math.PI * 2.0 / 9.0) - f * Mth.sin(g); + this.leftEar.zRot = (float) (Math.PI * 2.0 / 9.0) + f * Mth.sin(g); + this.head.yRot = hoglinRenderState.yRot * (float) (Math.PI / 180.0); + float h = 1.0F - Mth.abs(10 - 2 * hoglinRenderState.attackAnimationRemainingTicks) / 10.0F; + this.head.xRot = Mth.lerp(h, 0.87266463F, (float) (-Math.PI / 9)); + if (hoglinRenderState.isBaby) { + this.head.y += h * 2.5F; } - float g = 1.2F; - this.rightFrontLeg.xRot = Mth.cos(limbSwing) * 1.2F * limbSwingAmount; - this.leftFrontLeg.xRot = Mth.cos(limbSwing + (float) Math.PI) * 1.2F * limbSwingAmount; + float i = 1.2F; + this.rightFrontLeg.xRot = Mth.cos(g) * 1.2F * f; + this.leftFrontLeg.xRot = Mth.cos(g + (float) Math.PI) * 1.2F * f; this.rightHindLeg.xRot = this.leftFrontLeg.xRot; this.leftHindLeg.xRot = this.rightFrontLeg.xRot; } diff --git a/net/minecraft/client/model/HorseModel.java b/net/minecraft/client/model/HorseModel.java index 79e8f0ff..b23819a9 100644 --- a/net/minecraft/client/model/HorseModel.java +++ b/net/minecraft/client/model/HorseModel.java @@ -1,295 +1,13 @@ package net.minecraft.client.model; -import com.google.common.collect.ImmutableList; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.model.geom.ModelPart; -import net.minecraft.client.model.geom.PartPose; -import net.minecraft.client.model.geom.builders.CubeDeformation; -import net.minecraft.client.model.geom.builders.CubeListBuilder; -import net.minecraft.client.model.geom.builders.MeshDefinition; -import net.minecraft.client.model.geom.builders.PartDefinition; -import net.minecraft.util.Mth; -import net.minecraft.world.entity.animal.horse.AbstractHorse; +import net.minecraft.client.renderer.entity.state.EquineRenderState; @Environment(EnvType.CLIENT) -public class HorseModel extends AgeableListModel { - private static final float DEG_125 = 2.1816616F; - private static final float DEG_60 = (float) (Math.PI / 3); - private static final float DEG_45 = (float) (Math.PI / 4); - private static final float DEG_30 = (float) (Math.PI / 6); - private static final float DEG_15 = (float) (Math.PI / 12); - protected static final String HEAD_PARTS = "head_parts"; - private static final String LEFT_HIND_BABY_LEG = "left_hind_baby_leg"; - private static final String RIGHT_HIND_BABY_LEG = "right_hind_baby_leg"; - private static final String LEFT_FRONT_BABY_LEG = "left_front_baby_leg"; - private static final String RIGHT_FRONT_BABY_LEG = "right_front_baby_leg"; - private static final String SADDLE = "saddle"; - private static final String LEFT_SADDLE_MOUTH = "left_saddle_mouth"; - private static final String LEFT_SADDLE_LINE = "left_saddle_line"; - private static final String RIGHT_SADDLE_MOUTH = "right_saddle_mouth"; - private static final String RIGHT_SADDLE_LINE = "right_saddle_line"; - private static final String HEAD_SADDLE = "head_saddle"; - private static final String MOUTH_SADDLE_WRAP = "mouth_saddle_wrap"; - protected final ModelPart body; - protected final ModelPart headParts; - private final ModelPart rightHindLeg; - private final ModelPart leftHindLeg; - private final ModelPart rightFrontLeg; - private final ModelPart leftFrontLeg; - private final ModelPart rightHindBabyLeg; - private final ModelPart leftHindBabyLeg; - private final ModelPart rightFrontBabyLeg; - private final ModelPart leftFrontBabyLeg; - private final ModelPart tail; - private final ModelPart[] saddleParts; - private final ModelPart[] ridingParts; - +public class HorseModel extends AbstractEquineModel { public HorseModel(ModelPart root) { - super(true, 16.2F, 1.36F, 2.7272F, 2.0F, 20.0F); - this.body = root.getChild("body"); - this.headParts = root.getChild("head_parts"); - this.rightHindLeg = root.getChild("right_hind_leg"); - this.leftHindLeg = root.getChild("left_hind_leg"); - this.rightFrontLeg = root.getChild("right_front_leg"); - this.leftFrontLeg = root.getChild("left_front_leg"); - this.rightHindBabyLeg = root.getChild("right_hind_baby_leg"); - this.leftHindBabyLeg = root.getChild("left_hind_baby_leg"); - this.rightFrontBabyLeg = root.getChild("right_front_baby_leg"); - this.leftFrontBabyLeg = root.getChild("left_front_baby_leg"); - this.tail = this.body.getChild("tail"); - ModelPart modelPart = this.body.getChild("saddle"); - ModelPart modelPart2 = this.headParts.getChild("left_saddle_mouth"); - ModelPart modelPart3 = this.headParts.getChild("right_saddle_mouth"); - ModelPart modelPart4 = this.headParts.getChild("left_saddle_line"); - ModelPart modelPart5 = this.headParts.getChild("right_saddle_line"); - ModelPart modelPart6 = this.headParts.getChild("head_saddle"); - ModelPart modelPart7 = this.headParts.getChild("mouth_saddle_wrap"); - this.saddleParts = new ModelPart[]{modelPart, modelPart2, modelPart3, modelPart6, modelPart7}; - this.ridingParts = new ModelPart[]{modelPart4, modelPart5}; - } - - public static MeshDefinition createBodyMesh(CubeDeformation cubeDeformation) { - MeshDefinition meshDefinition = new MeshDefinition(); - PartDefinition partDefinition = meshDefinition.getRoot(); - PartDefinition partDefinition2 = partDefinition.addOrReplaceChild( - "body", - CubeListBuilder.create().texOffs(0, 32).addBox(-5.0F, -8.0F, -17.0F, 10.0F, 10.0F, 22.0F, new CubeDeformation(0.05F)), - PartPose.offset(0.0F, 11.0F, 5.0F) - ); - PartDefinition partDefinition3 = partDefinition.addOrReplaceChild( - "head_parts", - CubeListBuilder.create().texOffs(0, 35).addBox(-2.05F, -6.0F, -2.0F, 4.0F, 12.0F, 7.0F), - PartPose.offsetAndRotation(0.0F, 4.0F, -12.0F, (float) (Math.PI / 6), 0.0F, 0.0F) - ); - PartDefinition partDefinition4 = partDefinition3.addOrReplaceChild( - "head", CubeListBuilder.create().texOffs(0, 13).addBox(-3.0F, -11.0F, -2.0F, 6.0F, 5.0F, 7.0F, cubeDeformation), PartPose.ZERO - ); - partDefinition3.addOrReplaceChild( - "mane", CubeListBuilder.create().texOffs(56, 36).addBox(-1.0F, -11.0F, 5.01F, 2.0F, 16.0F, 2.0F, cubeDeformation), PartPose.ZERO - ); - partDefinition3.addOrReplaceChild( - "upper_mouth", CubeListBuilder.create().texOffs(0, 25).addBox(-2.0F, -11.0F, -7.0F, 4.0F, 5.0F, 5.0F, cubeDeformation), PartPose.ZERO - ); - partDefinition.addOrReplaceChild( - "left_hind_leg", - CubeListBuilder.create().texOffs(48, 21).mirror().addBox(-3.0F, -1.01F, -1.0F, 4.0F, 11.0F, 4.0F, cubeDeformation), - PartPose.offset(4.0F, 14.0F, 7.0F) - ); - partDefinition.addOrReplaceChild( - "right_hind_leg", - CubeListBuilder.create().texOffs(48, 21).addBox(-1.0F, -1.01F, -1.0F, 4.0F, 11.0F, 4.0F, cubeDeformation), - PartPose.offset(-4.0F, 14.0F, 7.0F) - ); - partDefinition.addOrReplaceChild( - "left_front_leg", - CubeListBuilder.create().texOffs(48, 21).mirror().addBox(-3.0F, -1.01F, -1.9F, 4.0F, 11.0F, 4.0F, cubeDeformation), - PartPose.offset(4.0F, 14.0F, -12.0F) - ); - partDefinition.addOrReplaceChild( - "right_front_leg", - CubeListBuilder.create().texOffs(48, 21).addBox(-1.0F, -1.01F, -1.9F, 4.0F, 11.0F, 4.0F, cubeDeformation), - PartPose.offset(-4.0F, 14.0F, -12.0F) - ); - CubeDeformation cubeDeformation2 = cubeDeformation.extend(0.0F, 5.5F, 0.0F); - partDefinition.addOrReplaceChild( - "left_hind_baby_leg", - CubeListBuilder.create().texOffs(48, 21).mirror().addBox(-3.0F, -1.01F, -1.0F, 4.0F, 11.0F, 4.0F, cubeDeformation2), - PartPose.offset(4.0F, 14.0F, 7.0F) - ); - partDefinition.addOrReplaceChild( - "right_hind_baby_leg", - CubeListBuilder.create().texOffs(48, 21).addBox(-1.0F, -1.01F, -1.0F, 4.0F, 11.0F, 4.0F, cubeDeformation2), - PartPose.offset(-4.0F, 14.0F, 7.0F) - ); - partDefinition.addOrReplaceChild( - "left_front_baby_leg", - CubeListBuilder.create().texOffs(48, 21).mirror().addBox(-3.0F, -1.01F, -1.9F, 4.0F, 11.0F, 4.0F, cubeDeformation2), - PartPose.offset(4.0F, 14.0F, -12.0F) - ); - partDefinition.addOrReplaceChild( - "right_front_baby_leg", - CubeListBuilder.create().texOffs(48, 21).addBox(-1.0F, -1.01F, -1.9F, 4.0F, 11.0F, 4.0F, cubeDeformation2), - PartPose.offset(-4.0F, 14.0F, -12.0F) - ); - partDefinition2.addOrReplaceChild( - "tail", - CubeListBuilder.create().texOffs(42, 36).addBox(-1.5F, 0.0F, 0.0F, 3.0F, 14.0F, 4.0F, cubeDeformation), - PartPose.offsetAndRotation(0.0F, -5.0F, 2.0F, (float) (Math.PI / 6), 0.0F, 0.0F) - ); - partDefinition2.addOrReplaceChild( - "saddle", CubeListBuilder.create().texOffs(26, 0).addBox(-5.0F, -8.0F, -9.0F, 10.0F, 9.0F, 9.0F, new CubeDeformation(0.5F)), PartPose.ZERO - ); - partDefinition3.addOrReplaceChild( - "left_saddle_mouth", CubeListBuilder.create().texOffs(29, 5).addBox(2.0F, -9.0F, -6.0F, 1.0F, 2.0F, 2.0F, cubeDeformation), PartPose.ZERO - ); - partDefinition3.addOrReplaceChild( - "right_saddle_mouth", CubeListBuilder.create().texOffs(29, 5).addBox(-3.0F, -9.0F, -6.0F, 1.0F, 2.0F, 2.0F, cubeDeformation), PartPose.ZERO - ); - partDefinition3.addOrReplaceChild( - "left_saddle_line", - CubeListBuilder.create().texOffs(32, 2).addBox(3.1F, -6.0F, -8.0F, 0.0F, 3.0F, 16.0F), - PartPose.rotation((float) (-Math.PI / 6), 0.0F, 0.0F) - ); - partDefinition3.addOrReplaceChild( - "right_saddle_line", - CubeListBuilder.create().texOffs(32, 2).addBox(-3.1F, -6.0F, -8.0F, 0.0F, 3.0F, 16.0F), - PartPose.rotation((float) (-Math.PI / 6), 0.0F, 0.0F) - ); - partDefinition3.addOrReplaceChild( - "head_saddle", CubeListBuilder.create().texOffs(1, 1).addBox(-3.0F, -11.0F, -1.9F, 6.0F, 5.0F, 6.0F, new CubeDeformation(0.22F)), PartPose.ZERO - ); - partDefinition3.addOrReplaceChild( - "mouth_saddle_wrap", CubeListBuilder.create().texOffs(19, 0).addBox(-2.0F, -11.0F, -4.0F, 4.0F, 5.0F, 2.0F, new CubeDeformation(0.2F)), PartPose.ZERO - ); - partDefinition4.addOrReplaceChild( - "left_ear", CubeListBuilder.create().texOffs(19, 16).addBox(0.55F, -13.0F, 4.0F, 2.0F, 3.0F, 1.0F, new CubeDeformation(-0.001F)), PartPose.ZERO - ); - partDefinition4.addOrReplaceChild( - "right_ear", CubeListBuilder.create().texOffs(19, 16).addBox(-2.55F, -13.0F, 4.0F, 2.0F, 3.0F, 1.0F, new CubeDeformation(-0.001F)), PartPose.ZERO - ); - return meshDefinition; - } - - /** - * Sets this entity's model rotation angles - */ - public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { - boolean bl = entity.isSaddled(); - boolean bl2 = entity.isVehicle(); - - for (ModelPart modelPart : this.saddleParts) { - modelPart.visible = bl; - } - - for (ModelPart modelPart : this.ridingParts) { - modelPart.visible = bl2 && bl; - } - - this.body.y = 11.0F; - } - - @Override - public Iterable headParts() { - return ImmutableList.of(this.headParts); - } - - @Override - protected Iterable bodyParts() { - return ImmutableList.of( - this.body, - this.rightHindLeg, - this.leftHindLeg, - this.rightFrontLeg, - this.leftFrontLeg, - this.rightHindBabyLeg, - this.leftHindBabyLeg, - this.rightFrontBabyLeg, - this.leftFrontBabyLeg - ); - } - - public void prepareMobModel(T entity, float limbSwing, float limbSwingAmount, float partialTick) { - super.prepareMobModel(entity, limbSwing, limbSwingAmount, partialTick); - float f = Mth.rotLerp(partialTick, entity.yBodyRotO, entity.yBodyRot); - float g = Mth.rotLerp(partialTick, entity.yHeadRotO, entity.yHeadRot); - float h = Mth.lerp(partialTick, entity.xRotO, entity.getXRot()); - float i = g - f; - float j = h * (float) (Math.PI / 180.0); - if (i > 20.0F) { - i = 20.0F; - } - - if (i < -20.0F) { - i = -20.0F; - } - - if (limbSwingAmount > 0.2F) { - j += Mth.cos(limbSwing * 0.8F) * 0.15F * limbSwingAmount; - } - - float k = entity.getEatAnim(partialTick); - float l = entity.getStandAnim(partialTick); - float m = 1.0F - l; - float n = entity.getMouthAnim(partialTick); - boolean bl = entity.tailCounter != 0; - float o = entity.tickCount + partialTick; - this.headParts.y = 4.0F; - this.headParts.z = -12.0F; - this.body.xRot = 0.0F; - this.headParts.xRot = (float) (Math.PI / 6) + j; - this.headParts.yRot = i * (float) (Math.PI / 180.0); - float p = entity.isInWater() ? 0.2F : 1.0F; - float q = Mth.cos(p * limbSwing * 0.6662F + (float) Math.PI); - float r = q * 0.8F * limbSwingAmount; - float s = (1.0F - Math.max(l, k)) * ((float) (Math.PI / 6) + j + n * Mth.sin(o) * 0.05F); - this.headParts.xRot = l * ((float) (Math.PI / 12) + j) + k * (2.1816616F + Mth.sin(o) * 0.05F) + s; - this.headParts.yRot = l * i * (float) (Math.PI / 180.0) + (1.0F - Math.max(l, k)) * this.headParts.yRot; - this.headParts.y = l * -4.0F + k * 11.0F + (1.0F - Math.max(l, k)) * this.headParts.y; - this.headParts.z = l * -4.0F + k * -12.0F + (1.0F - Math.max(l, k)) * this.headParts.z; - this.body.xRot = l * (float) (-Math.PI / 4) + m * this.body.xRot; - float t = (float) (Math.PI / 12) * l; - float u = Mth.cos(o * 0.6F + (float) Math.PI); - this.leftFrontLeg.y = 2.0F * l + 14.0F * m; - this.leftFrontLeg.z = -6.0F * l - 10.0F * m; - this.rightFrontLeg.y = this.leftFrontLeg.y; - this.rightFrontLeg.z = this.leftFrontLeg.z; - float v = ((float) (-Math.PI / 3) + u) * l + r * m; - float w = ((float) (-Math.PI / 3) - u) * l - r * m; - this.leftHindLeg.xRot = t - q * 0.5F * limbSwingAmount * m; - this.rightHindLeg.xRot = t + q * 0.5F * limbSwingAmount * m; - this.leftFrontLeg.xRot = v; - this.rightFrontLeg.xRot = w; - this.tail.xRot = (float) (Math.PI / 6) + limbSwingAmount * 0.75F; - this.tail.y = -5.0F + limbSwingAmount; - this.tail.z = 2.0F + limbSwingAmount * 2.0F; - if (bl) { - this.tail.yRot = Mth.cos(o * 0.7F); - } else { - this.tail.yRot = 0.0F; - } - - this.rightHindBabyLeg.y = this.rightHindLeg.y; - this.rightHindBabyLeg.z = this.rightHindLeg.z; - this.rightHindBabyLeg.xRot = this.rightHindLeg.xRot; - this.leftHindBabyLeg.y = this.leftHindLeg.y; - this.leftHindBabyLeg.z = this.leftHindLeg.z; - this.leftHindBabyLeg.xRot = this.leftHindLeg.xRot; - this.rightFrontBabyLeg.y = this.rightFrontLeg.y; - this.rightFrontBabyLeg.z = this.rightFrontLeg.z; - this.rightFrontBabyLeg.xRot = this.rightFrontLeg.xRot; - this.leftFrontBabyLeg.y = this.leftFrontLeg.y; - this.leftFrontBabyLeg.z = this.leftFrontLeg.z; - this.leftFrontBabyLeg.xRot = this.leftFrontLeg.xRot; - boolean bl2 = entity.isBaby(); - this.rightHindLeg.visible = !bl2; - this.leftHindLeg.visible = !bl2; - this.rightFrontLeg.visible = !bl2; - this.leftFrontLeg.visible = !bl2; - this.rightHindBabyLeg.visible = bl2; - this.leftHindBabyLeg.visible = bl2; - this.rightFrontBabyLeg.visible = bl2; - this.leftFrontBabyLeg.visible = bl2; - this.body.y = bl2 ? 10.8F : 0.0F; + super(root); } } diff --git a/net/minecraft/client/model/HumanoidArmorModel.java b/net/minecraft/client/model/HumanoidArmorModel.java index 288d1472..ba1371a3 100644 --- a/net/minecraft/client/model/HumanoidArmorModel.java +++ b/net/minecraft/client/model/HumanoidArmorModel.java @@ -8,10 +8,10 @@ import net.minecraft.client.model.geom.builders.CubeDeformation; import net.minecraft.client.model.geom.builders.CubeListBuilder; import net.minecraft.client.model.geom.builders.MeshDefinition; import net.minecraft.client.model.geom.builders.PartDefinition; -import net.minecraft.world.entity.LivingEntity; +import net.minecraft.client.renderer.entity.state.HumanoidRenderState; @Environment(EnvType.CLIENT) -public class HumanoidArmorModel extends HumanoidModel { +public class HumanoidArmorModel extends HumanoidModel { public HumanoidArmorModel(ModelPart root) { super(root); } diff --git a/net/minecraft/client/model/HumanoidModel.java b/net/minecraft/client/model/HumanoidModel.java index a4ab41bd..05bfcd94 100644 --- a/net/minecraft/client/model/HumanoidModel.java +++ b/net/minecraft/client/model/HumanoidModel.java @@ -1,7 +1,7 @@ package net.minecraft.client.model; -import com.google.common.collect.ImmutableList; import com.mojang.blaze3d.vertex.PoseStack; +import java.util.Set; import java.util.function.Function; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; @@ -10,16 +10,18 @@ import net.minecraft.client.model.geom.PartPose; import net.minecraft.client.model.geom.builders.CubeDeformation; import net.minecraft.client.model.geom.builders.CubeListBuilder; import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.MeshTransformer; import net.minecraft.client.model.geom.builders.PartDefinition; import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.entity.state.HumanoidRenderState; import net.minecraft.resources.ResourceLocation; import net.minecraft.util.Mth; import net.minecraft.world.InteractionHand; import net.minecraft.world.entity.HumanoidArm; -import net.minecraft.world.entity.LivingEntity; @Environment(EnvType.CLIENT) -public class HumanoidModel extends AgeableListModel implements ArmedModel, HeadedModel { +public class HumanoidModel extends EntityModel implements ArmedModel, HeadedModel { + public static final MeshTransformer BABY_TRANSFORMER = new BabyModelTransform(true, 16.0F, 0.0F, 2.0F, 2.0F, 24.0F, Set.of("head")); public static final float OVERLAY_SCALE = 0.25F; public static final float HAT_OVERLAY_SCALE = 0.5F; public static final float LEGGINGS_OVERLAY_SCALE = -0.1F; @@ -54,19 +56,15 @@ public class HumanoidModel extends AgeableListModel i * The Biped's Left Leg */ public final ModelPart leftLeg; - public HumanoidModel.ArmPose leftArmPose = HumanoidModel.ArmPose.EMPTY; - public HumanoidModel.ArmPose rightArmPose = HumanoidModel.ArmPose.EMPTY; - public boolean crouching; - public float swimAmount; public HumanoidModel(ModelPart root) { this(root, RenderType::entityCutoutNoCull); } public HumanoidModel(ModelPart root, Function renderType) { - super(renderType, true, 16.0F, 0.0F, 2.0F, 2.0F, 24.0F); + super(root, renderType); this.head = root.getChild("head"); - this.hat = root.getChild("hat"); + this.hat = this.head.getChild("hat"); this.body = root.getChild("body"); this.rightArm = root.getChild("right_arm"); this.leftArm = root.getChild("left_arm"); @@ -77,13 +75,11 @@ public class HumanoidModel extends AgeableListModel i public static MeshDefinition createMesh(CubeDeformation cubeDeformation, float yOffset) { MeshDefinition meshDefinition = new MeshDefinition(); PartDefinition partDefinition = meshDefinition.getRoot(); - partDefinition.addOrReplaceChild( + PartDefinition partDefinition2 = partDefinition.addOrReplaceChild( "head", CubeListBuilder.create().texOffs(0, 0).addBox(-4.0F, -8.0F, -4.0F, 8.0F, 8.0F, 8.0F, cubeDeformation), PartPose.offset(0.0F, 0.0F + yOffset, 0.0F) ); - partDefinition.addOrReplaceChild( - "hat", - CubeListBuilder.create().texOffs(32, 0).addBox(-4.0F, -8.0F, -4.0F, 8.0F, 8.0F, 8.0F, cubeDeformation.extend(0.5F)), - PartPose.offset(0.0F, 0.0F + yOffset, 0.0F) + partDefinition2.addOrReplaceChild( + "hat", CubeListBuilder.create().texOffs(32, 0).addBox(-4.0F, -8.0F, -4.0F, 8.0F, 8.0F, 8.0F, cubeDeformation.extend(0.5F)), PartPose.ZERO ); partDefinition.addOrReplaceChild( "body", CubeListBuilder.create().texOffs(16, 16).addBox(-4.0F, 0.0F, -2.0F, 8.0F, 12.0F, 4.0F, cubeDeformation), PartPose.offset(0.0F, 0.0F + yOffset, 0.0F) @@ -111,67 +107,35 @@ public class HumanoidModel extends AgeableListModel i return meshDefinition; } - @Override - protected Iterable headParts() { - return ImmutableList.of(this.head); + protected HumanoidModel.ArmPose getArmPose(T humanoidRenderState, HumanoidArm humanoidArm) { + return HumanoidModel.ArmPose.EMPTY; } - @Override - protected Iterable bodyParts() { - return ImmutableList.of(this.body, this.rightArm, this.leftArm, this.rightLeg, this.leftLeg, this.hat); - } - - public void prepareMobModel(T entity, float limbSwing, float limbSwingAmount, float partialTick) { - this.swimAmount = entity.getSwimAmount(partialTick); - super.prepareMobModel(entity, limbSwing, limbSwingAmount, partialTick); - } - - /** - * Sets this entity's model rotation angles - */ - public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { - boolean bl = entity.getFallFlyingTicks() > 4; - boolean bl2 = entity.isVisuallySwimming(); - this.head.yRot = netHeadYaw * (float) (Math.PI / 180.0); + public void setupAnim(T humanoidRenderState) { + super.setupAnim(humanoidRenderState); + HumanoidModel.ArmPose armPose = this.getArmPose(humanoidRenderState, HumanoidArm.LEFT); + HumanoidModel.ArmPose armPose2 = this.getArmPose(humanoidRenderState, HumanoidArm.RIGHT); + float f = humanoidRenderState.swimAmount; + boolean bl = humanoidRenderState.isFallFlying; + this.head.xRot = humanoidRenderState.xRot * (float) (Math.PI / 180.0); + this.head.yRot = humanoidRenderState.yRot * (float) (Math.PI / 180.0); if (bl) { this.head.xRot = (float) (-Math.PI / 4); - } else if (this.swimAmount > 0.0F) { - if (bl2) { - this.head.xRot = this.rotlerpRad(this.swimAmount, this.head.xRot, (float) (-Math.PI / 4)); - } else { - this.head.xRot = this.rotlerpRad(this.swimAmount, this.head.xRot, headPitch * (float) (Math.PI / 180.0)); - } - } else { - this.head.xRot = headPitch * (float) (Math.PI / 180.0); + } else if (f > 0.0F) { + this.head.xRot = Mth.rotLerpRad(f, this.head.xRot, (float) (-Math.PI / 4)); } - this.body.yRot = 0.0F; - this.rightArm.z = 0.0F; - this.rightArm.x = -5.0F; - this.leftArm.z = 0.0F; - this.leftArm.x = 5.0F; - float f = 1.0F; - if (bl) { - f = (float)entity.getDeltaMovement().lengthSqr(); - f /= 0.2F; - f *= f * f; - } - - if (f < 1.0F) { - f = 1.0F; - } - - this.rightArm.xRot = Mth.cos(limbSwing * 0.6662F + (float) Math.PI) * 2.0F * limbSwingAmount * 0.5F / f; - this.leftArm.xRot = Mth.cos(limbSwing * 0.6662F) * 2.0F * limbSwingAmount * 0.5F / f; - this.rightArm.zRot = 0.0F; - this.leftArm.zRot = 0.0F; - this.rightLeg.xRot = Mth.cos(limbSwing * 0.6662F) * 1.4F * limbSwingAmount / f; - this.leftLeg.xRot = Mth.cos(limbSwing * 0.6662F + (float) Math.PI) * 1.4F * limbSwingAmount / f; + float g = humanoidRenderState.walkAnimationPos; + float h = humanoidRenderState.walkAnimationSpeed; + this.rightArm.xRot = Mth.cos(g * 0.6662F + (float) Math.PI) * 2.0F * h * 0.5F / humanoidRenderState.speedValue; + this.leftArm.xRot = Mth.cos(g * 0.6662F) * 2.0F * h * 0.5F / humanoidRenderState.speedValue; + this.rightLeg.xRot = Mth.cos(g * 0.6662F) * 1.4F * h / humanoidRenderState.speedValue; + this.leftLeg.xRot = Mth.cos(g * 0.6662F + (float) Math.PI) * 1.4F * h / humanoidRenderState.speedValue; this.rightLeg.yRot = 0.005F; this.leftLeg.yRot = -0.005F; this.rightLeg.zRot = 0.005F; this.leftLeg.zRot = -0.005F; - if (this.riding) { + if (humanoidRenderState.isPassenger) { this.rightArm.xRot += (float) (-Math.PI / 5); this.leftArm.xRot += (float) (-Math.PI / 5); this.rightLeg.xRot = -1.4137167F; @@ -182,103 +146,87 @@ public class HumanoidModel extends AgeableListModel i this.leftLeg.zRot = -0.07853982F; } - this.rightArm.yRot = 0.0F; - this.leftArm.yRot = 0.0F; - boolean bl3 = entity.getMainArm() == HumanoidArm.RIGHT; - if (entity.isUsingItem()) { - boolean bl4 = entity.getUsedItemHand() == InteractionHand.MAIN_HAND; - if (bl4 == bl3) { - this.poseRightArm(entity); + boolean bl2 = humanoidRenderState.mainArm == HumanoidArm.RIGHT; + if (humanoidRenderState.isUsingItem) { + boolean bl3 = humanoidRenderState.useItemHand == InteractionHand.MAIN_HAND; + if (bl3 == bl2) { + this.poseRightArm(humanoidRenderState, armPose2); } else { - this.poseLeftArm(entity); + this.poseLeftArm(humanoidRenderState, armPose); } } else { - boolean bl4 = bl3 ? this.leftArmPose.isTwoHanded() : this.rightArmPose.isTwoHanded(); - if (bl3 != bl4) { - this.poseLeftArm(entity); - this.poseRightArm(entity); + boolean bl3 = bl2 ? armPose.isTwoHanded() : armPose2.isTwoHanded(); + if (bl2 != bl3) { + this.poseLeftArm(humanoidRenderState, armPose); + this.poseRightArm(humanoidRenderState, armPose2); } else { - this.poseRightArm(entity); - this.poseLeftArm(entity); + this.poseRightArm(humanoidRenderState, armPose2); + this.poseLeftArm(humanoidRenderState, armPose); } } - this.setupAttackAnimation(entity, ageInTicks); - if (this.crouching) { + this.setupAttackAnimation(humanoidRenderState, humanoidRenderState.ageInTicks); + if (humanoidRenderState.isCrouching) { this.body.xRot = 0.5F; this.rightArm.xRot += 0.4F; this.leftArm.xRot += 0.4F; - this.rightLeg.z = 4.0F; - this.leftLeg.z = 4.0F; - this.rightLeg.y = 12.2F; - this.leftLeg.y = 12.2F; - this.head.y = 4.2F; - this.body.y = 3.2F; - this.leftArm.y = 5.2F; - this.rightArm.y = 5.2F; - } else { - this.body.xRot = 0.0F; - this.rightLeg.z = 0.0F; - this.leftLeg.z = 0.0F; - this.rightLeg.y = 12.0F; - this.leftLeg.y = 12.0F; - this.head.y = 0.0F; - this.body.y = 0.0F; - this.leftArm.y = 2.0F; - this.rightArm.y = 2.0F; + this.rightLeg.z += 4.0F; + this.leftLeg.z += 4.0F; + this.head.y += 4.2F; + this.body.y += 3.2F; + this.leftArm.y += 3.2F; + this.rightArm.y += 3.2F; } - if (this.rightArmPose != HumanoidModel.ArmPose.SPYGLASS) { - AnimationUtils.bobModelPart(this.rightArm, ageInTicks, 1.0F); + if (armPose2 != HumanoidModel.ArmPose.SPYGLASS) { + AnimationUtils.bobModelPart(this.rightArm, humanoidRenderState.ageInTicks, 1.0F); } - if (this.leftArmPose != HumanoidModel.ArmPose.SPYGLASS) { - AnimationUtils.bobModelPart(this.leftArm, ageInTicks, -1.0F); + if (armPose != HumanoidModel.ArmPose.SPYGLASS) { + AnimationUtils.bobModelPart(this.leftArm, humanoidRenderState.ageInTicks, -1.0F); } - if (this.swimAmount > 0.0F) { - float g = limbSwing % 26.0F; - HumanoidArm humanoidArm = this.getAttackArm(entity); - float h = humanoidArm == HumanoidArm.RIGHT && this.attackTime > 0.0F ? 0.0F : this.swimAmount; - float i = humanoidArm == HumanoidArm.LEFT && this.attackTime > 0.0F ? 0.0F : this.swimAmount; - if (!entity.isUsingItem()) { - if (g < 14.0F) { - this.leftArm.xRot = this.rotlerpRad(i, this.leftArm.xRot, 0.0F); - this.rightArm.xRot = Mth.lerp(h, this.rightArm.xRot, 0.0F); - this.leftArm.yRot = this.rotlerpRad(i, this.leftArm.yRot, (float) Math.PI); - this.rightArm.yRot = Mth.lerp(h, this.rightArm.yRot, (float) Math.PI); - this.leftArm.zRot = this.rotlerpRad(i, this.leftArm.zRot, (float) Math.PI + 1.8707964F * this.quadraticArmUpdate(g) / this.quadraticArmUpdate(14.0F)); - this.rightArm.zRot = Mth.lerp(h, this.rightArm.zRot, (float) Math.PI - 1.8707964F * this.quadraticArmUpdate(g) / this.quadraticArmUpdate(14.0F)); - } else if (g >= 14.0F && g < 22.0F) { - float j = (g - 14.0F) / 8.0F; - this.leftArm.xRot = this.rotlerpRad(i, this.leftArm.xRot, (float) (Math.PI / 2) * j); - this.rightArm.xRot = Mth.lerp(h, this.rightArm.xRot, (float) (Math.PI / 2) * j); - this.leftArm.yRot = this.rotlerpRad(i, this.leftArm.yRot, (float) Math.PI); - this.rightArm.yRot = Mth.lerp(h, this.rightArm.yRot, (float) Math.PI); - this.leftArm.zRot = this.rotlerpRad(i, this.leftArm.zRot, 5.012389F - 1.8707964F * j); - this.rightArm.zRot = Mth.lerp(h, this.rightArm.zRot, 1.2707963F + 1.8707964F * j); - } else if (g >= 22.0F && g < 26.0F) { - float j = (g - 22.0F) / 4.0F; - this.leftArm.xRot = this.rotlerpRad(i, this.leftArm.xRot, (float) (Math.PI / 2) - (float) (Math.PI / 2) * j); - this.rightArm.xRot = Mth.lerp(h, this.rightArm.xRot, (float) (Math.PI / 2) - (float) (Math.PI / 2) * j); - this.leftArm.yRot = this.rotlerpRad(i, this.leftArm.yRot, (float) Math.PI); - this.rightArm.yRot = Mth.lerp(h, this.rightArm.yRot, (float) Math.PI); - this.leftArm.zRot = this.rotlerpRad(i, this.leftArm.zRot, (float) Math.PI); - this.rightArm.zRot = Mth.lerp(h, this.rightArm.zRot, (float) Math.PI); + if (f > 0.0F) { + float i = g % 26.0F; + HumanoidArm humanoidArm = humanoidRenderState.attackArm; + float j = humanoidArm == HumanoidArm.RIGHT && humanoidRenderState.attackTime > 0.0F ? 0.0F : f; + float k = humanoidArm == HumanoidArm.LEFT && humanoidRenderState.attackTime > 0.0F ? 0.0F : f; + if (!humanoidRenderState.isUsingItem) { + if (i < 14.0F) { + this.leftArm.xRot = Mth.rotLerpRad(k, this.leftArm.xRot, 0.0F); + this.rightArm.xRot = Mth.lerp(j, this.rightArm.xRot, 0.0F); + this.leftArm.yRot = Mth.rotLerpRad(k, this.leftArm.yRot, (float) Math.PI); + this.rightArm.yRot = Mth.lerp(j, this.rightArm.yRot, (float) Math.PI); + this.leftArm.zRot = Mth.rotLerpRad(k, this.leftArm.zRot, (float) Math.PI + 1.8707964F * this.quadraticArmUpdate(i) / this.quadraticArmUpdate(14.0F)); + this.rightArm.zRot = Mth.lerp(j, this.rightArm.zRot, (float) Math.PI - 1.8707964F * this.quadraticArmUpdate(i) / this.quadraticArmUpdate(14.0F)); + } else if (i >= 14.0F && i < 22.0F) { + float l = (i - 14.0F) / 8.0F; + this.leftArm.xRot = Mth.rotLerpRad(k, this.leftArm.xRot, (float) (Math.PI / 2) * l); + this.rightArm.xRot = Mth.lerp(j, this.rightArm.xRot, (float) (Math.PI / 2) * l); + this.leftArm.yRot = Mth.rotLerpRad(k, this.leftArm.yRot, (float) Math.PI); + this.rightArm.yRot = Mth.lerp(j, this.rightArm.yRot, (float) Math.PI); + this.leftArm.zRot = Mth.rotLerpRad(k, this.leftArm.zRot, 5.012389F - 1.8707964F * l); + this.rightArm.zRot = Mth.lerp(j, this.rightArm.zRot, 1.2707963F + 1.8707964F * l); + } else if (i >= 22.0F && i < 26.0F) { + float l = (i - 22.0F) / 4.0F; + this.leftArm.xRot = Mth.rotLerpRad(k, this.leftArm.xRot, (float) (Math.PI / 2) - (float) (Math.PI / 2) * l); + this.rightArm.xRot = Mth.lerp(j, this.rightArm.xRot, (float) (Math.PI / 2) - (float) (Math.PI / 2) * l); + this.leftArm.yRot = Mth.rotLerpRad(k, this.leftArm.yRot, (float) Math.PI); + this.rightArm.yRot = Mth.lerp(j, this.rightArm.yRot, (float) Math.PI); + this.leftArm.zRot = Mth.rotLerpRad(k, this.leftArm.zRot, (float) Math.PI); + this.rightArm.zRot = Mth.lerp(j, this.rightArm.zRot, (float) Math.PI); } } - float j = 0.3F; - float k = 0.33333334F; - this.leftLeg.xRot = Mth.lerp(this.swimAmount, this.leftLeg.xRot, 0.3F * Mth.cos(limbSwing * 0.33333334F + (float) Math.PI)); - this.rightLeg.xRot = Mth.lerp(this.swimAmount, this.rightLeg.xRot, 0.3F * Mth.cos(limbSwing * 0.33333334F)); + float l = 0.3F; + float m = 0.33333334F; + this.leftLeg.xRot = Mth.lerp(f, this.leftLeg.xRot, 0.3F * Mth.cos(g * 0.33333334F + (float) Math.PI)); + this.rightLeg.xRot = Mth.lerp(f, this.rightLeg.xRot, 0.3F * Mth.cos(g * 0.33333334F)); } - - this.hat.copyFrom(this.head); } - private void poseRightArm(T livingEntity) { - switch (this.rightArmPose) { + private void poseRightArm(T humanoidRenderState, HumanoidModel.ArmPose armPose) { + switch (armPose) { case EMPTY: this.rightArm.yRot = 0.0F; break; @@ -300,13 +248,13 @@ public class HumanoidModel extends AgeableListModel i this.rightArm.yRot = 0.0F; break; case CROSSBOW_CHARGE: - AnimationUtils.animateCrossbowCharge(this.rightArm, this.leftArm, livingEntity, true); + AnimationUtils.animateCrossbowCharge(this.rightArm, this.leftArm, humanoidRenderState.maxCrossbowChargeDuration, humanoidRenderState.ticksUsingItem, true); break; case CROSSBOW_HOLD: AnimationUtils.animateCrossbowHold(this.rightArm, this.leftArm, this.head, true); break; case SPYGLASS: - this.rightArm.xRot = Mth.clamp(this.head.xRot - 1.9198622F - (livingEntity.isCrouching() ? (float) (Math.PI / 12) : 0.0F), -2.4F, 3.3F); + this.rightArm.xRot = Mth.clamp(this.head.xRot - 1.9198622F - (humanoidRenderState.isCrouching ? (float) (Math.PI / 12) : 0.0F), -2.4F, 3.3F); this.rightArm.yRot = this.head.yRot - (float) (Math.PI / 12); break; case TOOT_HORN: @@ -319,8 +267,8 @@ public class HumanoidModel extends AgeableListModel i } } - private void poseLeftArm(T livingEntity) { - switch (this.leftArmPose) { + private void poseLeftArm(T humanoidRenderState, HumanoidModel.ArmPose armPose) { + switch (armPose) { case EMPTY: this.leftArm.yRot = 0.0F; break; @@ -342,13 +290,13 @@ public class HumanoidModel extends AgeableListModel i this.leftArm.yRot = 0.0F; break; case CROSSBOW_CHARGE: - AnimationUtils.animateCrossbowCharge(this.rightArm, this.leftArm, livingEntity, false); + AnimationUtils.animateCrossbowCharge(this.rightArm, this.leftArm, humanoidRenderState.maxCrossbowChargeDuration, humanoidRenderState.ticksUsingItem, false); break; case CROSSBOW_HOLD: AnimationUtils.animateCrossbowHold(this.rightArm, this.leftArm, this.head, false); break; case SPYGLASS: - this.leftArm.xRot = Mth.clamp(this.head.xRot - 1.9198622F - (livingEntity.isCrouching() ? (float) (Math.PI / 12) : 0.0F), -2.4F, 3.3F); + this.leftArm.xRot = Mth.clamp(this.head.xRot - 1.9198622F - (humanoidRenderState.isCrouching ? (float) (Math.PI / 12) : 0.0F), -2.4F, 3.3F); this.leftArm.yRot = this.head.yRot + (float) (Math.PI / 12); break; case TOOT_HORN: @@ -366,59 +314,42 @@ public class HumanoidModel extends AgeableListModel i arm.yRot = (isRightArm ? -30.0F : 30.0F) * (float) (Math.PI / 180.0) + Mth.clamp(this.head.yRot, (float) (-Math.PI / 6), (float) (Math.PI / 6)); } - protected void setupAttackAnimation(T livingEntity, float ageInTicks) { - if (!(this.attackTime <= 0.0F)) { - HumanoidArm humanoidArm = this.getAttackArm(livingEntity); + protected void setupAttackAnimation(T humanoidRenderState, float f) { + float g = humanoidRenderState.attackTime; + if (!(g <= 0.0F)) { + HumanoidArm humanoidArm = humanoidRenderState.attackArm; ModelPart modelPart = this.getArm(humanoidArm); - float f = this.attackTime; - this.body.yRot = Mth.sin(Mth.sqrt(f) * (float) (Math.PI * 2)) * 0.2F; + this.body.yRot = Mth.sin(Mth.sqrt(g) * (float) (Math.PI * 2)) * 0.2F; if (humanoidArm == HumanoidArm.LEFT) { this.body.yRot *= -1.0F; } - this.rightArm.z = Mth.sin(this.body.yRot) * 5.0F; - this.rightArm.x = -Mth.cos(this.body.yRot) * 5.0F; - this.leftArm.z = -Mth.sin(this.body.yRot) * 5.0F; - this.leftArm.x = Mth.cos(this.body.yRot) * 5.0F; + float i = humanoidRenderState.ageScale; + this.rightArm.z = Mth.sin(this.body.yRot) * 5.0F * i; + this.rightArm.x = -Mth.cos(this.body.yRot) * 5.0F * i; + this.leftArm.z = -Mth.sin(this.body.yRot) * 5.0F * i; + this.leftArm.x = Mth.cos(this.body.yRot) * 5.0F * i; this.rightArm.yRot = this.rightArm.yRot + this.body.yRot; this.leftArm.yRot = this.leftArm.yRot + this.body.yRot; this.leftArm.xRot = this.leftArm.xRot + this.body.yRot; - f = 1.0F - this.attackTime; - f *= f; - f *= f; - f = 1.0F - f; - float g = Mth.sin(f * (float) Math.PI); - float h = Mth.sin(this.attackTime * (float) Math.PI) * -(this.head.xRot - 0.7F) * 0.75F; - modelPart.xRot -= g * 1.2F + h; + float h = 1.0F - g; + h *= h; + h *= h; + h = 1.0F - h; + float j = Mth.sin(h * (float) Math.PI); + float k = Mth.sin(g * (float) Math.PI) * -(this.head.xRot - 0.7F) * 0.75F; + modelPart.xRot -= j * 1.2F + k; modelPart.yRot = modelPart.yRot + this.body.yRot * 2.0F; - modelPart.zRot = modelPart.zRot + Mth.sin(this.attackTime * (float) Math.PI) * -0.4F; + modelPart.zRot = modelPart.zRot + Mth.sin(g * (float) Math.PI) * -0.4F; } } - protected float rotlerpRad(float angle, float maxAngle, float mul) { - float f = (mul - maxAngle) % (float) (Math.PI * 2); - if (f < (float) -Math.PI) { - f += (float) (Math.PI * 2); - } - - if (f >= (float) Math.PI) { - f -= (float) (Math.PI * 2); - } - - return maxAngle + angle * f; - } - private float quadraticArmUpdate(float limbSwing) { return -65.0F * limbSwing + limbSwing * limbSwing; } public void copyPropertiesTo(HumanoidModel model) { - super.copyPropertiesTo(model); - model.leftArmPose = this.leftArmPose; - model.rightArmPose = this.rightArmPose; - model.crouching = this.crouching; model.head.copyFrom(this.head); - model.hat.copyFrom(this.hat); model.body.copyFrom(this.body); model.rightArm.copyFrom(this.rightArm); model.leftArm.copyFrom(this.leftArm); @@ -438,6 +369,7 @@ public class HumanoidModel extends AgeableListModel i @Override public void translateToHand(HumanoidArm side, PoseStack poseStack) { + this.root.translateAndRotate(poseStack); this.getArm(side).translateAndRotate(poseStack); } @@ -450,11 +382,6 @@ public class HumanoidModel extends AgeableListModel i return this.head; } - private HumanoidArm getAttackArm(T entity) { - HumanoidArm humanoidArm = entity.getMainArm(); - return entity.swingingArm == InteractionHand.MAIN_HAND ? humanoidArm : humanoidArm.getOpposite(); - } - @Environment(EnvType.CLIENT) public static enum ArmPose { EMPTY(false), diff --git a/net/minecraft/client/model/IllagerModel.java b/net/minecraft/client/model/IllagerModel.java index 5081aebd..5955cb24 100644 --- a/net/minecraft/client/model/IllagerModel.java +++ b/net/minecraft/client/model/IllagerModel.java @@ -10,13 +10,13 @@ import net.minecraft.client.model.geom.builders.CubeListBuilder; import net.minecraft.client.model.geom.builders.LayerDefinition; import net.minecraft.client.model.geom.builders.MeshDefinition; import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.client.renderer.entity.state.IllagerRenderState; import net.minecraft.util.Mth; import net.minecraft.world.entity.HumanoidArm; import net.minecraft.world.entity.monster.AbstractIllager; @Environment(EnvType.CLIENT) -public class IllagerModel extends HierarchicalModel implements ArmedModel, HeadedModel { - private final ModelPart root; +public class IllagerModel extends EntityModel implements ArmedModel, HeadedModel { private final ModelPart head; private final ModelPart hat; private final ModelPart arms; @@ -26,7 +26,7 @@ public class IllagerModel extends HierarchicalModel extends HierarchicalModel extends HierarchicalModel extends HierarchicalModel extends HierarchicalModel extends HierarchicalModel { - private final ModelPart root; +public class IronGolemModel extends EntityModel { private final ModelPart head; private final ModelPart rightArm; private final ModelPart leftArm; @@ -22,7 +21,7 @@ public class IronGolemModel extends HierarchicalModel { private final ModelPart leftLeg; public IronGolemModel(ModelPart root) { - this.root = root; + super(root); this.head = root.getChild("head"); this.rightArm = root.getChild("right_arm"); this.leftArm = root.getChild("left_arm"); @@ -62,38 +61,31 @@ public class IronGolemModel extends HierarchicalModel { return LayerDefinition.create(meshDefinition, 128, 128); } - @Override - public ModelPart root() { - return this.root; - } - - /** - * Sets this entity's model rotation angles - */ - public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { - this.head.yRot = netHeadYaw * (float) (Math.PI / 180.0); - this.head.xRot = headPitch * (float) (Math.PI / 180.0); - this.rightLeg.xRot = -1.5F * Mth.triangleWave(limbSwing, 13.0F) * limbSwingAmount; - this.leftLeg.xRot = 1.5F * Mth.triangleWave(limbSwing, 13.0F) * limbSwingAmount; - this.rightLeg.yRot = 0.0F; - this.leftLeg.yRot = 0.0F; - } - - public void prepareMobModel(T entity, float limbSwing, float limbSwingAmount, float partialTick) { - int i = entity.getAttackAnimationTick(); - if (i > 0) { - this.rightArm.xRot = -2.0F + 1.5F * Mth.triangleWave(i - partialTick, 10.0F); - this.leftArm.xRot = -2.0F + 1.5F * Mth.triangleWave(i - partialTick, 10.0F); + public void setupAnim(IronGolemRenderState ironGolemRenderState) { + super.setupAnim(ironGolemRenderState); + float f = ironGolemRenderState.attackTicksRemaining; + float g = ironGolemRenderState.walkAnimationSpeed; + float h = ironGolemRenderState.walkAnimationPos; + if (f > 0.0F) { + this.rightArm.xRot = -2.0F + 1.5F * Mth.triangleWave(f, 10.0F); + this.leftArm.xRot = -2.0F + 1.5F * Mth.triangleWave(f, 10.0F); } else { - int j = entity.getOfferFlowerTick(); - if (j > 0) { - this.rightArm.xRot = -0.8F + 0.025F * Mth.triangleWave(j, 70.0F); + int i = ironGolemRenderState.offerFlowerTick; + if (i > 0) { + this.rightArm.xRot = -0.8F + 0.025F * Mth.triangleWave(i, 70.0F); this.leftArm.xRot = 0.0F; } else { - this.rightArm.xRot = (-0.2F + 1.5F * Mth.triangleWave(limbSwing, 13.0F)) * limbSwingAmount; - this.leftArm.xRot = (-0.2F - 1.5F * Mth.triangleWave(limbSwing, 13.0F)) * limbSwingAmount; + this.rightArm.xRot = (-0.2F + 1.5F * Mth.triangleWave(h, 13.0F)) * g; + this.leftArm.xRot = (-0.2F - 1.5F * Mth.triangleWave(h, 13.0F)) * g; } } + + this.head.yRot = ironGolemRenderState.yRot * (float) (Math.PI / 180.0); + this.head.xRot = ironGolemRenderState.xRot * (float) (Math.PI / 180.0); + this.rightLeg.xRot = -1.5F * Mth.triangleWave(h, 13.0F) * g; + this.leftLeg.xRot = 1.5F * Mth.triangleWave(h, 13.0F) * g; + this.rightLeg.yRot = 0.0F; + this.leftLeg.yRot = 0.0F; } public ModelPart getFlowerHoldingArm() { diff --git a/net/minecraft/client/model/LavaSlimeModel.java b/net/minecraft/client/model/LavaSlimeModel.java index 0afe12eb..82333009 100644 --- a/net/minecraft/client/model/LavaSlimeModel.java +++ b/net/minecraft/client/model/LavaSlimeModel.java @@ -9,17 +9,15 @@ import net.minecraft.client.model.geom.builders.CubeListBuilder; import net.minecraft.client.model.geom.builders.LayerDefinition; import net.minecraft.client.model.geom.builders.MeshDefinition; import net.minecraft.client.model.geom.builders.PartDefinition; -import net.minecraft.util.Mth; -import net.minecraft.world.entity.monster.Slime; +import net.minecraft.client.renderer.entity.state.SlimeRenderState; @Environment(EnvType.CLIENT) -public class LavaSlimeModel extends HierarchicalModel { +public class LavaSlimeModel extends EntityModel { private static final int SEGMENT_COUNT = 8; - private final ModelPart root; private final ModelPart[] bodyCubes = new ModelPart[8]; public LavaSlimeModel(ModelPart root) { - this.root = root; + super(root); Arrays.setAll(this.bodyCubes, i -> root.getChild(getSegmentName(i))); } @@ -49,25 +47,12 @@ public class LavaSlimeModel extends HierarchicalModel { return LayerDefinition.create(meshDefinition, 64, 32); } - /** - * Sets this entity's model rotation angles - */ - public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { - } - - public void prepareMobModel(T entity, float limbSwing, float limbSwingAmount, float partialTick) { - float f = Mth.lerp(partialTick, entity.oSquish, entity.squish); - if (f < 0.0F) { - f = 0.0F; - } + public void setupAnim(SlimeRenderState slimeRenderState) { + super.setupAnim(slimeRenderState); + float f = Math.max(0.0F, slimeRenderState.squish); for (int i = 0; i < this.bodyCubes.length; i++) { this.bodyCubes[i].y = -(4 - i) * f * 1.7F; } } - - @Override - public ModelPart root() { - return this.root; - } } diff --git a/net/minecraft/client/model/LeashKnotModel.java b/net/minecraft/client/model/LeashKnotModel.java index 9c60f532..c6682e9e 100644 --- a/net/minecraft/client/model/LeashKnotModel.java +++ b/net/minecraft/client/model/LeashKnotModel.java @@ -8,16 +8,15 @@ import net.minecraft.client.model.geom.builders.CubeListBuilder; import net.minecraft.client.model.geom.builders.LayerDefinition; import net.minecraft.client.model.geom.builders.MeshDefinition; import net.minecraft.client.model.geom.builders.PartDefinition; -import net.minecraft.world.entity.Entity; +import net.minecraft.client.renderer.entity.state.EntityRenderState; @Environment(EnvType.CLIENT) -public class LeashKnotModel extends HierarchicalModel { +public class LeashKnotModel extends EntityModel { private static final String KNOT = "knot"; - private final ModelPart root; private final ModelPart knot; public LeashKnotModel(ModelPart root) { - this.root = root; + super(root); this.knot = root.getChild("knot"); } @@ -27,15 +26,4 @@ public class LeashKnotModel extends HierarchicalModel { partDefinition.addOrReplaceChild("knot", CubeListBuilder.create().texOffs(0, 0).addBox(-3.0F, -8.0F, -3.0F, 6.0F, 8.0F, 6.0F), PartPose.ZERO); return LayerDefinition.create(meshDefinition, 32, 32); } - - @Override - public ModelPart root() { - return this.root; - } - - @Override - public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { - this.knot.yRot = netHeadYaw * (float) (Math.PI / 180.0); - this.knot.xRot = headPitch * (float) (Math.PI / 180.0); - } } diff --git a/net/minecraft/client/model/ListModel.java b/net/minecraft/client/model/ListModel.java deleted file mode 100644 index 82cb2c98..00000000 --- a/net/minecraft/client/model/ListModel.java +++ /dev/null @@ -1,29 +0,0 @@ -package net.minecraft.client.model; - -import com.mojang.blaze3d.vertex.PoseStack; -import com.mojang.blaze3d.vertex.VertexConsumer; -import java.util.function.Function; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.client.model.geom.ModelPart; -import net.minecraft.client.renderer.RenderType; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.entity.Entity; - -@Environment(EnvType.CLIENT) -public abstract class ListModel extends EntityModel { - public ListModel() { - this(RenderType::entityCutoutNoCull); - } - - public ListModel(Function function) { - super(function); - } - - @Override - public void renderToBuffer(PoseStack poseStack, VertexConsumer buffer, int packedLight, int packedOverlay, int color) { - this.parts().forEach(modelPart -> modelPart.render(poseStack, buffer, packedLight, packedOverlay, color)); - } - - public abstract Iterable parts(); -} diff --git a/net/minecraft/client/model/LlamaModel.java b/net/minecraft/client/model/LlamaModel.java index e77c9181..9af7e318 100644 --- a/net/minecraft/client/model/LlamaModel.java +++ b/net/minecraft/client/model/LlamaModel.java @@ -1,8 +1,7 @@ package net.minecraft.client.model; -import com.google.common.collect.ImmutableList; -import com.mojang.blaze3d.vertex.PoseStack; -import com.mojang.blaze3d.vertex.VertexConsumer; +import java.util.Map.Entry; +import java.util.function.UnaryOperator; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.model.geom.ModelPart; @@ -11,14 +10,15 @@ import net.minecraft.client.model.geom.builders.CubeDeformation; import net.minecraft.client.model.geom.builders.CubeListBuilder; import net.minecraft.client.model.geom.builders.LayerDefinition; import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.MeshTransformer; import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.client.renderer.entity.state.LlamaRenderState; import net.minecraft.util.Mth; -import net.minecraft.world.entity.animal.horse.AbstractChestedHorse; @Environment(EnvType.CLIENT) -public class LlamaModel extends EntityModel { +public class LlamaModel extends EntityModel { + public static final MeshTransformer BABY_TRANSFORMER = LlamaModel::transformToBaby; private final ModelPart head; - private final ModelPart body; private final ModelPart rightHindLeg; private final ModelPart leftHindLeg; private final ModelPart rightFrontLeg; @@ -27,8 +27,8 @@ public class LlamaModel extends EntityModel { private final ModelPart leftChest; public LlamaModel(ModelPart root) { + super(root); this.head = root.getChild("head"); - this.body = root.getChild("body"); this.rightChest = root.getChild("right_chest"); this.leftChest = root.getChild("left_chest"); this.rightHindLeg = root.getChild("right_hind_leg"); @@ -78,46 +78,41 @@ public class LlamaModel extends EntityModel { return LayerDefinition.create(meshDefinition, 128, 64); } - /** - * Sets this entity's model rotation angles - */ - public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { - this.head.xRot = headPitch * (float) (Math.PI / 180.0); - this.head.yRot = netHeadYaw * (float) (Math.PI / 180.0); - this.rightHindLeg.xRot = Mth.cos(limbSwing * 0.6662F) * 1.4F * limbSwingAmount; - this.leftHindLeg.xRot = Mth.cos(limbSwing * 0.6662F + (float) Math.PI) * 1.4F * limbSwingAmount; - this.rightFrontLeg.xRot = Mth.cos(limbSwing * 0.6662F + (float) Math.PI) * 1.4F * limbSwingAmount; - this.leftFrontLeg.xRot = Mth.cos(limbSwing * 0.6662F) * 1.4F * limbSwingAmount; - boolean bl = !entity.isBaby() && entity.hasChest(); - this.rightChest.visible = bl; - this.leftChest.visible = bl; + private static MeshDefinition transformToBaby(MeshDefinition meshDefinition) { + float f = 2.0F; + float g = 0.7F; + float h = 1.1F; + UnaryOperator unaryOperator = partPose -> partPose.translated(0.0F, 21.0F, 3.52F).scaled(0.71428573F, 0.64935064F, 0.7936508F); + UnaryOperator unaryOperator2 = partPose -> partPose.translated(0.0F, 33.0F, 0.0F).scaled(0.625F, 0.45454544F, 0.45454544F); + UnaryOperator unaryOperator3 = partPose -> partPose.translated(0.0F, 33.0F, 0.0F).scaled(0.45454544F, 0.41322312F, 0.45454544F); + MeshDefinition meshDefinition2 = new MeshDefinition(); + + for (Entry entry : meshDefinition.getRoot().getChildren()) { + String string = (String)entry.getKey(); + PartDefinition partDefinition = (PartDefinition)entry.getValue(); + + UnaryOperator unaryOperator4 = switch (string) { + case "head" -> unaryOperator; + case "body" -> unaryOperator2; + default -> unaryOperator3; + }; + meshDefinition2.getRoot().addOrReplaceChild(string, partDefinition.transformed(unaryOperator4)); + } + + return meshDefinition2; } - @Override - public void renderToBuffer(PoseStack poseStack, VertexConsumer buffer, int packedLight, int packedOverlay, int color) { - if (this.young) { - float f = 2.0F; - poseStack.pushPose(); - float g = 0.7F; - poseStack.scale(0.71428573F, 0.64935064F, 0.7936508F); - poseStack.translate(0.0F, 1.3125F, 0.22F); - this.head.render(poseStack, buffer, packedLight, packedOverlay, color); - poseStack.popPose(); - poseStack.pushPose(); - float h = 1.1F; - poseStack.scale(0.625F, 0.45454544F, 0.45454544F); - poseStack.translate(0.0F, 2.0625F, 0.0F); - this.body.render(poseStack, buffer, packedLight, packedOverlay, color); - poseStack.popPose(); - poseStack.pushPose(); - poseStack.scale(0.45454544F, 0.41322312F, 0.45454544F); - poseStack.translate(0.0F, 2.0625F, 0.0F); - ImmutableList.of(this.rightHindLeg, this.leftHindLeg, this.rightFrontLeg, this.leftFrontLeg, this.rightChest, this.leftChest) - .forEach(modelPart -> modelPart.render(poseStack, buffer, packedLight, packedOverlay, color)); - poseStack.popPose(); - } else { - ImmutableList.of(this.head, this.body, this.rightHindLeg, this.leftHindLeg, this.rightFrontLeg, this.leftFrontLeg, this.rightChest, this.leftChest) - .forEach(modelPart -> modelPart.render(poseStack, buffer, packedLight, packedOverlay, color)); - } + public void setupAnim(LlamaRenderState llamaRenderState) { + super.setupAnim(llamaRenderState); + this.head.xRot = llamaRenderState.xRot * (float) (Math.PI / 180.0); + this.head.yRot = llamaRenderState.yRot * (float) (Math.PI / 180.0); + float f = llamaRenderState.walkAnimationSpeed; + float g = llamaRenderState.walkAnimationPos; + this.rightHindLeg.xRot = Mth.cos(g * 0.6662F) * 1.4F * f; + this.leftHindLeg.xRot = Mth.cos(g * 0.6662F + (float) Math.PI) * 1.4F * f; + this.rightFrontLeg.xRot = Mth.cos(g * 0.6662F + (float) Math.PI) * 1.4F * f; + this.leftFrontLeg.xRot = Mth.cos(g * 0.6662F) * 1.4F * f; + this.rightChest.visible = llamaRenderState.hasChest; + this.leftChest.visible = llamaRenderState.hasChest; } } diff --git a/net/minecraft/client/model/LlamaSpitModel.java b/net/minecraft/client/model/LlamaSpitModel.java index 06f21b15..068f447a 100644 --- a/net/minecraft/client/model/LlamaSpitModel.java +++ b/net/minecraft/client/model/LlamaSpitModel.java @@ -8,15 +8,14 @@ import net.minecraft.client.model.geom.builders.CubeListBuilder; import net.minecraft.client.model.geom.builders.LayerDefinition; import net.minecraft.client.model.geom.builders.MeshDefinition; import net.minecraft.client.model.geom.builders.PartDefinition; -import net.minecraft.world.entity.Entity; +import net.minecraft.client.renderer.entity.state.EntityRenderState; @Environment(EnvType.CLIENT) -public class LlamaSpitModel extends HierarchicalModel { +public class LlamaSpitModel extends EntityModel { private static final String MAIN = "main"; - private final ModelPart root; public LlamaSpitModel(ModelPart root) { - this.root = root; + super(root); } public static LayerDefinition createBodyLayer() { @@ -38,13 +37,4 @@ public class LlamaSpitModel extends HierarchicalModel { ); return LayerDefinition.create(meshDefinition, 64, 32); } - - @Override - public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { - } - - @Override - public ModelPart root() { - return this.root; - } } diff --git a/net/minecraft/client/model/MinecartModel.java b/net/minecraft/client/model/MinecartModel.java index 2efdf8fc..c1f0d4b9 100644 --- a/net/minecraft/client/model/MinecartModel.java +++ b/net/minecraft/client/model/MinecartModel.java @@ -8,14 +8,12 @@ import net.minecraft.client.model.geom.builders.CubeListBuilder; import net.minecraft.client.model.geom.builders.LayerDefinition; import net.minecraft.client.model.geom.builders.MeshDefinition; import net.minecraft.client.model.geom.builders.PartDefinition; -import net.minecraft.world.entity.Entity; +import net.minecraft.client.renderer.entity.state.MinecartRenderState; @Environment(EnvType.CLIENT) -public class MinecartModel extends HierarchicalModel { - private final ModelPart root; - +public class MinecartModel extends EntityModel { public MinecartModel(ModelPart root) { - this.root = root; + super(root); } public static LayerDefinition createBodyLayer() { @@ -50,13 +48,4 @@ public class MinecartModel extends HierarchicalModel { ); return LayerDefinition.create(meshDefinition, 64, 32); } - - @Override - public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { - } - - @Override - public ModelPart root() { - return this.root; - } } diff --git a/net/minecraft/client/model/Model.java b/net/minecraft/client/model/Model.java index 1e822a29..ba674e45 100644 --- a/net/minecraft/client/model/Model.java +++ b/net/minecraft/client/model/Model.java @@ -2,27 +2,88 @@ package net.minecraft.client.model; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.VertexConsumer; +import java.util.List; +import java.util.Optional; import java.util.function.Function; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; +import net.minecraft.client.animation.AnimationDefinition; +import net.minecraft.client.animation.KeyframeAnimations; +import net.minecraft.client.model.geom.ModelPart; import net.minecraft.client.renderer.RenderType; import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.AnimationState; +import org.joml.Vector3f; @Environment(EnvType.CLIENT) public abstract class Model { + private static final Vector3f ANIMATION_VECTOR_CACHE = new Vector3f(); + protected final ModelPart root; protected final Function renderType; + private final List allParts; - public Model(Function renderType) { - this.renderType = renderType; + public Model(ModelPart modelPart, Function function) { + this.root = modelPart; + this.renderType = function; + this.allParts = modelPart.getAllParts().toList(); } public final RenderType renderType(ResourceLocation location) { return (RenderType)this.renderType.apply(location); } - public abstract void renderToBuffer(PoseStack poseStack, VertexConsumer buffer, int packedLight, int packedOverlay, int color); + public final void renderToBuffer(PoseStack poseStack, VertexConsumer buffer, int packedLight, int packedOverlay, int color) { + this.root().render(poseStack, buffer, packedLight, packedOverlay, color); + } public final void renderToBuffer(PoseStack poseStack, VertexConsumer vertexConsumer, int packedLight, int packedOverlay) { this.renderToBuffer(poseStack, vertexConsumer, packedLight, packedOverlay, -1); } + + public final ModelPart root() { + return this.root; + } + + public Optional getAnyDescendantWithName(String string) { + return string.equals("root") + ? Optional.of(this.root()) + : this.root().getAllParts().filter(modelPart -> modelPart.hasChild(string)).findFirst().map(modelPart -> modelPart.getChild(string)); + } + + public final List allParts() { + return this.allParts; + } + + public final void resetPose() { + for (ModelPart modelPart : this.allParts) { + modelPart.resetPose(); + } + } + + protected void animate(AnimationState animationState, AnimationDefinition animationDefinition, float f) { + this.animate(animationState, animationDefinition, f, 1.0F); + } + + protected void animateWalk(AnimationDefinition animationDefinition, float f, float g, float h, float i) { + long l = (long)(f * 50.0F * h); + float j = Math.min(g * i, 1.0F); + KeyframeAnimations.animate(this, animationDefinition, l, j, ANIMATION_VECTOR_CACHE); + } + + protected void animate(AnimationState animationState, AnimationDefinition animationDefinition, float f, float g) { + animationState.ifStarted( + animationStatex -> KeyframeAnimations.animate(this, animationDefinition, (long)((float)animationStatex.getTimeInMillis(f) * g), 1.0F, ANIMATION_VECTOR_CACHE) + ); + } + + protected void applyStatic(AnimationDefinition animationDefinition) { + KeyframeAnimations.animate(this, animationDefinition, 0L, 1.0F, ANIMATION_VECTOR_CACHE); + } + + @Environment(EnvType.CLIENT) + public static class Simple extends Model { + public Simple(ModelPart modelPart, Function function) { + super(modelPart, function); + } + } } diff --git a/net/minecraft/client/model/ModelUtils.java b/net/minecraft/client/model/ModelUtils.java deleted file mode 100644 index 456ced67..00000000 --- a/net/minecraft/client/model/ModelUtils.java +++ /dev/null @@ -1,21 +0,0 @@ -package net.minecraft.client.model; - -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; - -@Environment(EnvType.CLIENT) -public class ModelUtils { - public static float rotlerpRad(float min, float max, float delta) { - float f = max - min; - - while (f < (float) -Math.PI) { - f += (float) (Math.PI * 2); - } - - while (f >= (float) Math.PI) { - f -= (float) (Math.PI * 2); - } - - return min + delta * f; - } -} diff --git a/net/minecraft/client/model/OcelotModel.java b/net/minecraft/client/model/OcelotModel.java index 15f41795..1a9d68a7 100644 --- a/net/minecraft/client/model/OcelotModel.java +++ b/net/minecraft/client/model/OcelotModel.java @@ -1,169 +1,13 @@ package net.minecraft.client.model; -import com.google.common.collect.ImmutableList; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.model.geom.ModelPart; -import net.minecraft.client.model.geom.PartPose; -import net.minecraft.client.model.geom.builders.CubeDeformation; -import net.minecraft.client.model.geom.builders.CubeListBuilder; -import net.minecraft.client.model.geom.builders.MeshDefinition; -import net.minecraft.client.model.geom.builders.PartDefinition; -import net.minecraft.util.Mth; -import net.minecraft.world.entity.Entity; +import net.minecraft.client.renderer.entity.state.FelineRenderState; @Environment(EnvType.CLIENT) -public class OcelotModel extends AgeableListModel { - private static final int CROUCH_STATE = 0; - private static final int WALK_STATE = 1; - private static final int SPRINT_STATE = 2; - protected static final int SITTING_STATE = 3; - private static final float XO = 0.0F; - private static final float YO = 16.0F; - private static final float ZO = -9.0F; - private static final float HEAD_WALK_Y = 15.0F; - private static final float HEAD_WALK_Z = -9.0F; - private static final float BODY_WALK_Y = 12.0F; - private static final float BODY_WALK_Z = -10.0F; - private static final float TAIL_1_WALK_Y = 15.0F; - private static final float TAIL_1_WALK_Z = 8.0F; - private static final float TAIL_2_WALK_Y = 20.0F; - private static final float TAIL_2_WALK_Z = 14.0F; - protected static final float BACK_LEG_Y = 18.0F; - protected static final float BACK_LEG_Z = 5.0F; - protected static final float FRONT_LEG_Y = 14.1F; - private static final float FRONT_LEG_Z = -5.0F; - private static final String TAIL_1 = "tail1"; - private static final String TAIL_2 = "tail2"; - protected final ModelPart leftHindLeg; - protected final ModelPart rightHindLeg; - protected final ModelPart leftFrontLeg; - protected final ModelPart rightFrontLeg; - protected final ModelPart tail1; - protected final ModelPart tail2; - protected final ModelPart head; - protected final ModelPart body; - protected int state = 1; - +public class OcelotModel extends FelineModel { public OcelotModel(ModelPart root) { - super(true, 10.0F, 4.0F); - this.head = root.getChild("head"); - this.body = root.getChild("body"); - this.tail1 = root.getChild("tail1"); - this.tail2 = root.getChild("tail2"); - this.leftHindLeg = root.getChild("left_hind_leg"); - this.rightHindLeg = root.getChild("right_hind_leg"); - this.leftFrontLeg = root.getChild("left_front_leg"); - this.rightFrontLeg = root.getChild("right_front_leg"); - } - - public static MeshDefinition createBodyMesh(CubeDeformation cubeDeformation) { - MeshDefinition meshDefinition = new MeshDefinition(); - PartDefinition partDefinition = meshDefinition.getRoot(); - CubeDeformation cubeDeformation2 = new CubeDeformation(-0.02F); - partDefinition.addOrReplaceChild( - "head", - CubeListBuilder.create() - .addBox("main", -2.5F, -2.0F, -3.0F, 5.0F, 4.0F, 5.0F, cubeDeformation) - .addBox("nose", -1.5F, -0.001F, -4.0F, 3, 2, 2, cubeDeformation, 0, 24) - .addBox("ear1", -2.0F, -3.0F, 0.0F, 1, 1, 2, cubeDeformation, 0, 10) - .addBox("ear2", 1.0F, -3.0F, 0.0F, 1, 1, 2, cubeDeformation, 6, 10), - PartPose.offset(0.0F, 15.0F, -9.0F) - ); - partDefinition.addOrReplaceChild( - "body", - CubeListBuilder.create().texOffs(20, 0).addBox(-2.0F, 3.0F, -8.0F, 4.0F, 16.0F, 6.0F, cubeDeformation), - PartPose.offsetAndRotation(0.0F, 12.0F, -10.0F, (float) (Math.PI / 2), 0.0F, 0.0F) - ); - partDefinition.addOrReplaceChild( - "tail1", - CubeListBuilder.create().texOffs(0, 15).addBox(-0.5F, 0.0F, 0.0F, 1.0F, 8.0F, 1.0F, cubeDeformation), - PartPose.offsetAndRotation(0.0F, 15.0F, 8.0F, 0.9F, 0.0F, 0.0F) - ); - partDefinition.addOrReplaceChild( - "tail2", CubeListBuilder.create().texOffs(4, 15).addBox(-0.5F, 0.0F, 0.0F, 1.0F, 8.0F, 1.0F, cubeDeformation2), PartPose.offset(0.0F, 20.0F, 14.0F) - ); - CubeListBuilder cubeListBuilder = CubeListBuilder.create().texOffs(8, 13).addBox(-1.0F, 0.0F, 1.0F, 2.0F, 6.0F, 2.0F, cubeDeformation); - partDefinition.addOrReplaceChild("left_hind_leg", cubeListBuilder, PartPose.offset(1.1F, 18.0F, 5.0F)); - partDefinition.addOrReplaceChild("right_hind_leg", cubeListBuilder, PartPose.offset(-1.1F, 18.0F, 5.0F)); - CubeListBuilder cubeListBuilder2 = CubeListBuilder.create().texOffs(40, 0).addBox(-1.0F, 0.0F, 0.0F, 2.0F, 10.0F, 2.0F, cubeDeformation); - partDefinition.addOrReplaceChild("left_front_leg", cubeListBuilder2, PartPose.offset(1.2F, 14.1F, -5.0F)); - partDefinition.addOrReplaceChild("right_front_leg", cubeListBuilder2, PartPose.offset(-1.2F, 14.1F, -5.0F)); - return meshDefinition; - } - - @Override - protected Iterable headParts() { - return ImmutableList.of(this.head); - } - - @Override - protected Iterable bodyParts() { - return ImmutableList.of(this.body, this.leftHindLeg, this.rightHindLeg, this.leftFrontLeg, this.rightFrontLeg, this.tail1, this.tail2); - } - - @Override - public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { - this.head.xRot = headPitch * (float) (Math.PI / 180.0); - this.head.yRot = netHeadYaw * (float) (Math.PI / 180.0); - if (this.state != 3) { - this.body.xRot = (float) (Math.PI / 2); - if (this.state == 2) { - this.leftHindLeg.xRot = Mth.cos(limbSwing * 0.6662F) * limbSwingAmount; - this.rightHindLeg.xRot = Mth.cos(limbSwing * 0.6662F + 0.3F) * limbSwingAmount; - this.leftFrontLeg.xRot = Mth.cos(limbSwing * 0.6662F + (float) Math.PI + 0.3F) * limbSwingAmount; - this.rightFrontLeg.xRot = Mth.cos(limbSwing * 0.6662F + (float) Math.PI) * limbSwingAmount; - this.tail2.xRot = 1.7278761F + (float) (Math.PI / 10) * Mth.cos(limbSwing) * limbSwingAmount; - } else { - this.leftHindLeg.xRot = Mth.cos(limbSwing * 0.6662F) * limbSwingAmount; - this.rightHindLeg.xRot = Mth.cos(limbSwing * 0.6662F + (float) Math.PI) * limbSwingAmount; - this.leftFrontLeg.xRot = Mth.cos(limbSwing * 0.6662F + (float) Math.PI) * limbSwingAmount; - this.rightFrontLeg.xRot = Mth.cos(limbSwing * 0.6662F) * limbSwingAmount; - if (this.state == 1) { - this.tail2.xRot = 1.7278761F + (float) (Math.PI / 4) * Mth.cos(limbSwing) * limbSwingAmount; - } else { - this.tail2.xRot = 1.7278761F + 0.47123894F * Mth.cos(limbSwing) * limbSwingAmount; - } - } - } - } - - @Override - public void prepareMobModel(T entity, float limbSwing, float limbSwingAmount, float partialTick) { - this.body.y = 12.0F; - this.body.z = -10.0F; - this.head.y = 15.0F; - this.head.z = -9.0F; - this.tail1.y = 15.0F; - this.tail1.z = 8.0F; - this.tail2.y = 20.0F; - this.tail2.z = 14.0F; - this.leftFrontLeg.y = 14.1F; - this.leftFrontLeg.z = -5.0F; - this.rightFrontLeg.y = 14.1F; - this.rightFrontLeg.z = -5.0F; - this.leftHindLeg.y = 18.0F; - this.leftHindLeg.z = 5.0F; - this.rightHindLeg.y = 18.0F; - this.rightHindLeg.z = 5.0F; - this.tail1.xRot = 0.9F; - if (entity.isCrouching()) { - this.body.y++; - this.head.y += 2.0F; - this.tail1.y++; - this.tail2.y += -4.0F; - this.tail2.z += 2.0F; - this.tail1.xRot = (float) (Math.PI / 2); - this.tail2.xRot = (float) (Math.PI / 2); - this.state = 0; - } else if (entity.isSprinting()) { - this.tail2.y = this.tail1.y; - this.tail2.z += 2.0F; - this.tail1.xRot = (float) (Math.PI / 2); - this.tail2.xRot = (float) (Math.PI / 2); - this.state = 2; - } else { - this.state = 1; - } + super(root); } } diff --git a/net/minecraft/client/model/PandaModel.java b/net/minecraft/client/model/PandaModel.java index abfe27c4..bdc20651 100644 --- a/net/minecraft/client/model/PandaModel.java +++ b/net/minecraft/client/model/PandaModel.java @@ -1,5 +1,6 @@ package net.minecraft.client.model; +import java.util.Set; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.model.geom.ModelPart; @@ -7,18 +8,17 @@ import net.minecraft.client.model.geom.PartPose; import net.minecraft.client.model.geom.builders.CubeListBuilder; import net.minecraft.client.model.geom.builders.LayerDefinition; import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.MeshTransformer; import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.client.renderer.entity.state.PandaRenderState; import net.minecraft.util.Mth; -import net.minecraft.world.entity.animal.Panda; @Environment(EnvType.CLIENT) -public class PandaModel extends QuadrupedModel { - private float sitAmount; - private float lieOnBackAmount; - private float rollAmount; +public class PandaModel extends QuadrupedModel { + public static final MeshTransformer BABY_TRANSFORMER = new BabyModelTransform(true, 23.0F, 4.8F, 2.7F, 3.0F, 49.0F, Set.of("head")); public PandaModel(ModelPart root) { - super(root, true, 23.0F, 4.8F, 2.7F, 3.0F, 49); + super(root); } public static LayerDefinition createBodyLayer() { @@ -52,55 +52,40 @@ public class PandaModel extends QuadrupedModel { return LayerDefinition.create(meshDefinition, 64, 64); } - public void prepareMobModel(T entity, float limbSwing, float limbSwingAmount, float partialTick) { - super.prepareMobModel(entity, limbSwing, limbSwingAmount, partialTick); - this.sitAmount = entity.getSitAmount(partialTick); - this.lieOnBackAmount = entity.getLieOnBackAmount(partialTick); - this.rollAmount = entity.isBaby() ? 0.0F : entity.getRollAmount(partialTick); - } - - /** - * Sets this entity's model rotation angles - */ - public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { - super.setupAnim(entity, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch); - boolean bl = entity.getUnhappyCounter() > 0; - boolean bl2 = entity.isSneezing(); - int i = entity.getSneezeCounter(); - boolean bl3 = entity.isEating(); - boolean bl4 = entity.isScared(); - if (bl) { - this.head.yRot = 0.35F * Mth.sin(0.6F * ageInTicks); - this.head.zRot = 0.35F * Mth.sin(0.6F * ageInTicks); - this.rightFrontLeg.xRot = -0.75F * Mth.sin(0.3F * ageInTicks); - this.leftFrontLeg.xRot = 0.75F * Mth.sin(0.3F * ageInTicks); + public void setupAnim(PandaRenderState pandaRenderState) { + super.setupAnim(pandaRenderState); + if (pandaRenderState.isUnhappy) { + this.head.yRot = 0.35F * Mth.sin(0.6F * pandaRenderState.ageInTicks); + this.head.zRot = 0.35F * Mth.sin(0.6F * pandaRenderState.ageInTicks); + this.rightFrontLeg.xRot = -0.75F * Mth.sin(0.3F * pandaRenderState.ageInTicks); + this.leftFrontLeg.xRot = 0.75F * Mth.sin(0.3F * pandaRenderState.ageInTicks); } else { this.head.zRot = 0.0F; } - if (bl2) { - if (i < 15) { - this.head.xRot = (float) (-Math.PI / 4) * i / 14.0F; - } else if (i < 20) { - float f = (i - 15) / 5; + if (pandaRenderState.isSneezing) { + if (pandaRenderState.sneezeTime < 15) { + this.head.xRot = (float) (-Math.PI / 4) * pandaRenderState.sneezeTime / 14.0F; + } else if (pandaRenderState.sneezeTime < 20) { + float f = (pandaRenderState.sneezeTime - 15) / 5; this.head.xRot = (float) (-Math.PI / 4) + (float) (Math.PI / 4) * f; } } - if (this.sitAmount > 0.0F) { - this.body.xRot = ModelUtils.rotlerpRad(this.body.xRot, 1.7407963F, this.sitAmount); - this.head.xRot = ModelUtils.rotlerpRad(this.head.xRot, (float) (Math.PI / 2), this.sitAmount); + if (pandaRenderState.sitAmount > 0.0F) { + this.body.xRot = Mth.rotLerpRad(pandaRenderState.sitAmount, this.body.xRot, 1.7407963F); + this.head.xRot = Mth.rotLerpRad(pandaRenderState.sitAmount, this.head.xRot, (float) (Math.PI / 2)); this.rightFrontLeg.zRot = -0.27079642F; this.leftFrontLeg.zRot = 0.27079642F; this.rightHindLeg.zRot = 0.5707964F; this.leftHindLeg.zRot = -0.5707964F; - if (bl3) { - this.head.xRot = (float) (Math.PI / 2) + 0.2F * Mth.sin(ageInTicks * 0.6F); - this.rightFrontLeg.xRot = -0.4F - 0.2F * Mth.sin(ageInTicks * 0.6F); - this.leftFrontLeg.xRot = -0.4F - 0.2F * Mth.sin(ageInTicks * 0.6F); + if (pandaRenderState.isEating) { + this.head.xRot = (float) (Math.PI / 2) + 0.2F * Mth.sin(pandaRenderState.ageInTicks * 0.6F); + this.rightFrontLeg.xRot = -0.4F - 0.2F * Mth.sin(pandaRenderState.ageInTicks * 0.6F); + this.leftFrontLeg.xRot = -0.4F - 0.2F * Mth.sin(pandaRenderState.ageInTicks * 0.6F); } - if (bl4) { + if (pandaRenderState.isScared) { this.head.xRot = 2.1707964F; this.rightFrontLeg.xRot = -0.9F; this.leftFrontLeg.xRot = -0.9F; @@ -112,20 +97,20 @@ public class PandaModel extends QuadrupedModel { this.leftFrontLeg.zRot = 0.0F; } - if (this.lieOnBackAmount > 0.0F) { - this.rightHindLeg.xRot = -0.6F * Mth.sin(ageInTicks * 0.15F); - this.leftHindLeg.xRot = 0.6F * Mth.sin(ageInTicks * 0.15F); - this.rightFrontLeg.xRot = 0.3F * Mth.sin(ageInTicks * 0.25F); - this.leftFrontLeg.xRot = -0.3F * Mth.sin(ageInTicks * 0.25F); - this.head.xRot = ModelUtils.rotlerpRad(this.head.xRot, (float) (Math.PI / 2), this.lieOnBackAmount); + if (pandaRenderState.lieOnBackAmount > 0.0F) { + this.rightHindLeg.xRot = -0.6F * Mth.sin(pandaRenderState.ageInTicks * 0.15F); + this.leftHindLeg.xRot = 0.6F * Mth.sin(pandaRenderState.ageInTicks * 0.15F); + this.rightFrontLeg.xRot = 0.3F * Mth.sin(pandaRenderState.ageInTicks * 0.25F); + this.leftFrontLeg.xRot = -0.3F * Mth.sin(pandaRenderState.ageInTicks * 0.25F); + this.head.xRot = Mth.rotLerpRad(pandaRenderState.lieOnBackAmount, this.head.xRot, (float) (Math.PI / 2)); } - if (this.rollAmount > 0.0F) { - this.head.xRot = ModelUtils.rotlerpRad(this.head.xRot, 2.0561945F, this.rollAmount); - this.rightHindLeg.xRot = -0.5F * Mth.sin(ageInTicks * 0.5F); - this.leftHindLeg.xRot = 0.5F * Mth.sin(ageInTicks * 0.5F); - this.rightFrontLeg.xRot = 0.5F * Mth.sin(ageInTicks * 0.5F); - this.leftFrontLeg.xRot = -0.5F * Mth.sin(ageInTicks * 0.5F); + if (pandaRenderState.rollAmount > 0.0F) { + this.head.xRot = Mth.rotLerpRad(pandaRenderState.rollAmount, this.head.xRot, 2.0561945F); + this.rightHindLeg.xRot = -0.5F * Mth.sin(pandaRenderState.ageInTicks * 0.5F); + this.leftHindLeg.xRot = 0.5F * Mth.sin(pandaRenderState.ageInTicks * 0.5F); + this.rightFrontLeg.xRot = 0.5F * Mth.sin(pandaRenderState.ageInTicks * 0.5F); + this.leftFrontLeg.xRot = -0.5F * Mth.sin(pandaRenderState.ageInTicks * 0.5F); } } } diff --git a/net/minecraft/client/model/ParrotModel.java b/net/minecraft/client/model/ParrotModel.java index bb59d3ae..aada500e 100644 --- a/net/minecraft/client/model/ParrotModel.java +++ b/net/minecraft/client/model/ParrotModel.java @@ -1,7 +1,5 @@ package net.minecraft.client.model; -import com.mojang.blaze3d.vertex.PoseStack; -import com.mojang.blaze3d.vertex.VertexConsumer; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.model.geom.ModelPart; @@ -10,30 +8,28 @@ import net.minecraft.client.model.geom.builders.CubeListBuilder; import net.minecraft.client.model.geom.builders.LayerDefinition; import net.minecraft.client.model.geom.builders.MeshDefinition; import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.client.renderer.entity.state.ParrotRenderState; import net.minecraft.util.Mth; import net.minecraft.world.entity.animal.Parrot; @Environment(EnvType.CLIENT) -public class ParrotModel extends HierarchicalModel { +public class ParrotModel extends EntityModel { private static final String FEATHER = "feather"; - private final ModelPart root; private final ModelPart body; private final ModelPart tail; private final ModelPart leftWing; private final ModelPart rightWing; private final ModelPart head; - private final ModelPart feather; private final ModelPart leftLeg; private final ModelPart rightLeg; public ParrotModel(ModelPart root) { - this.root = root; + super(root); this.body = root.getChild("body"); this.tail = root.getChild("tail"); this.leftWing = root.getChild("left_wing"); this.rightWing = root.getChild("right_wing"); this.head = root.getChild("head"); - this.feather = this.head.getChild("feather"); this.leftLeg = root.getChild("left_leg"); this.rightLeg = root.getChild("right_leg"); } @@ -42,16 +38,24 @@ public class ParrotModel extends HierarchicalModel { MeshDefinition meshDefinition = new MeshDefinition(); PartDefinition partDefinition = meshDefinition.getRoot(); partDefinition.addOrReplaceChild( - "body", CubeListBuilder.create().texOffs(2, 8).addBox(-1.5F, 0.0F, -1.5F, 3.0F, 6.0F, 3.0F), PartPose.offset(0.0F, 16.5F, -3.0F) + "body", + CubeListBuilder.create().texOffs(2, 8).addBox(-1.5F, 0.0F, -1.5F, 3.0F, 6.0F, 3.0F), + PartPose.offsetAndRotation(0.0F, 16.5F, -3.0F, 0.4937F, 0.0F, 0.0F) ); partDefinition.addOrReplaceChild( - "tail", CubeListBuilder.create().texOffs(22, 1).addBox(-1.5F, -1.0F, -1.0F, 3.0F, 4.0F, 1.0F), PartPose.offset(0.0F, 21.07F, 1.16F) + "tail", + CubeListBuilder.create().texOffs(22, 1).addBox(-1.5F, -1.0F, -1.0F, 3.0F, 4.0F, 1.0F), + PartPose.offsetAndRotation(0.0F, 21.07F, 1.16F, 1.015F, 0.0F, 0.0F) ); partDefinition.addOrReplaceChild( - "left_wing", CubeListBuilder.create().texOffs(19, 8).addBox(-0.5F, 0.0F, -1.5F, 1.0F, 5.0F, 3.0F), PartPose.offset(1.5F, 16.94F, -2.76F) + "left_wing", + CubeListBuilder.create().texOffs(19, 8).addBox(-0.5F, 0.0F, -1.5F, 1.0F, 5.0F, 3.0F), + PartPose.offsetAndRotation(1.5F, 16.94F, -2.76F, -0.6981F, (float) -Math.PI, 0.0F) ); partDefinition.addOrReplaceChild( - "right_wing", CubeListBuilder.create().texOffs(19, 8).addBox(-0.5F, 0.0F, -1.5F, 1.0F, 5.0F, 3.0F), PartPose.offset(-1.5F, 16.94F, -2.76F) + "right_wing", + CubeListBuilder.create().texOffs(19, 8).addBox(-0.5F, 0.0F, -1.5F, 1.0F, 5.0F, 3.0F), + PartPose.offsetAndRotation(-1.5F, 16.94F, -2.76F, -0.6981F, (float) -Math.PI, 0.0F) ); PartDefinition partDefinition2 = partDefinition.addOrReplaceChild( "head", CubeListBuilder.create().texOffs(2, 2).addBox(-1.0F, -1.5F, -1.0F, 2.0F, 3.0F, 2.0F), PartPose.offset(0.0F, 15.69F, -2.76F) @@ -66,110 +70,65 @@ public class ParrotModel extends HierarchicalModel { "beak2", CubeListBuilder.create().texOffs(16, 7).addBox(-0.5F, 0.0F, -0.5F, 1.0F, 2.0F, 1.0F), PartPose.offset(0.0F, -1.75F, -2.45F) ); partDefinition2.addOrReplaceChild( - "feather", CubeListBuilder.create().texOffs(2, 18).addBox(0.0F, -4.0F, -2.0F, 0.0F, 5.0F, 4.0F), PartPose.offset(0.0F, -2.15F, 0.15F) + "feather", + CubeListBuilder.create().texOffs(2, 18).addBox(0.0F, -4.0F, -2.0F, 0.0F, 5.0F, 4.0F), + PartPose.offsetAndRotation(0.0F, -2.15F, 0.15F, -0.2214F, 0.0F, 0.0F) ); CubeListBuilder cubeListBuilder = CubeListBuilder.create().texOffs(14, 18).addBox(-0.5F, 0.0F, -0.5F, 1.0F, 2.0F, 1.0F); - partDefinition.addOrReplaceChild("left_leg", cubeListBuilder, PartPose.offset(1.0F, 22.0F, -1.05F)); - partDefinition.addOrReplaceChild("right_leg", cubeListBuilder, PartPose.offset(-1.0F, 22.0F, -1.05F)); + partDefinition.addOrReplaceChild("left_leg", cubeListBuilder, PartPose.offsetAndRotation(1.0F, 22.0F, -1.05F, -0.0299F, 0.0F, 0.0F)); + partDefinition.addOrReplaceChild("right_leg", cubeListBuilder, PartPose.offsetAndRotation(-1.0F, 22.0F, -1.05F, -0.0299F, 0.0F, 0.0F)); return LayerDefinition.create(meshDefinition, 32, 32); } - @Override - public ModelPart root() { - return this.root; - } - - /** - * Sets this entity's model rotation angles - */ - public void setupAnim(Parrot entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { - this.setupAnim(getState(entity), entity.tickCount, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch); - } - - public void prepareMobModel(Parrot entity, float limbSwing, float limbSwingAmount, float partialTick) { - this.prepare(getState(entity)); - } - - public void renderOnShoulder( - PoseStack poseStack, - VertexConsumer buffer, - int packedLight, - int packedOverlay, - float limbSwing, - float limbSwingAmount, - float netHeadYaw, - float headPitch, - int tickCount - ) { - this.prepare(ParrotModel.State.ON_SHOULDER); - this.setupAnim(ParrotModel.State.ON_SHOULDER, tickCount, limbSwing, limbSwingAmount, 0.0F, netHeadYaw, headPitch); - this.root.render(poseStack, buffer, packedLight, packedOverlay); - } - - private void setupAnim(ParrotModel.State state, int tickCount, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { - this.head.xRot = headPitch * (float) (Math.PI / 180.0); - this.head.yRot = netHeadYaw * (float) (Math.PI / 180.0); - this.head.zRot = 0.0F; - this.head.x = 0.0F; - this.body.x = 0.0F; - this.tail.x = 0.0F; - this.rightWing.x = -1.5F; - this.leftWing.x = 1.5F; - switch (state) { + public void setupAnim(ParrotRenderState parrotRenderState) { + super.setupAnim(parrotRenderState); + this.prepare(parrotRenderState.pose); + this.head.xRot = parrotRenderState.xRot * (float) (Math.PI / 180.0); + this.head.yRot = parrotRenderState.yRot * (float) (Math.PI / 180.0); + switch (parrotRenderState.pose) { case STANDING: - this.leftLeg.xRot = this.leftLeg.xRot + Mth.cos(limbSwing * 0.6662F) * 1.4F * limbSwingAmount; - this.rightLeg.xRot = this.rightLeg.xRot + Mth.cos(limbSwing * 0.6662F + (float) Math.PI) * 1.4F * limbSwingAmount; + this.leftLeg.xRot = this.leftLeg.xRot + Mth.cos(parrotRenderState.walkAnimationPos * 0.6662F) * 1.4F * parrotRenderState.walkAnimationSpeed; + this.rightLeg.xRot = this.rightLeg.xRot + + Mth.cos(parrotRenderState.walkAnimationPos * 0.6662F + (float) Math.PI) * 1.4F * parrotRenderState.walkAnimationSpeed; case FLYING: case ON_SHOULDER: default: - float h = ageInTicks * 0.3F; - this.head.y = 15.69F + h; - this.tail.xRot = 1.015F + Mth.cos(limbSwing * 0.6662F) * 0.3F * limbSwingAmount; - this.tail.y = 21.07F + h; - this.body.y = 16.5F + h; - this.leftWing.zRot = -0.0873F - ageInTicks; - this.leftWing.y = 16.94F + h; - this.rightWing.zRot = 0.0873F + ageInTicks; - this.rightWing.y = 16.94F + h; - this.leftLeg.y = 22.0F + h; - this.rightLeg.y = 22.0F + h; + float h = parrotRenderState.flapAngle * 0.3F; + this.head.y += h; + this.tail.xRot = this.tail.xRot + Mth.cos(parrotRenderState.walkAnimationPos * 0.6662F) * 0.3F * parrotRenderState.walkAnimationSpeed; + this.tail.y += h; + this.body.y += h; + this.leftWing.zRot = -0.0873F - parrotRenderState.flapAngle; + this.leftWing.y += h; + this.rightWing.zRot = 0.0873F + parrotRenderState.flapAngle; + this.rightWing.y += h; + this.leftLeg.y += h; + this.rightLeg.y += h; case SITTING: break; case PARTY: - float f = Mth.cos(tickCount); - float g = Mth.sin(tickCount); - this.head.x = f; - this.head.y = 15.69F + g; + float f = Mth.cos(parrotRenderState.ageInTicks); + float g = Mth.sin(parrotRenderState.ageInTicks); + this.head.x += f; + this.head.y += g; this.head.xRot = 0.0F; this.head.yRot = 0.0F; - this.head.zRot = Mth.sin(tickCount) * 0.4F; - this.body.x = f; - this.body.y = 16.5F + g; - this.leftWing.zRot = -0.0873F - ageInTicks; - this.leftWing.x = 1.5F + f; - this.leftWing.y = 16.94F + g; - this.rightWing.zRot = 0.0873F + ageInTicks; - this.rightWing.x = -1.5F + f; - this.rightWing.y = 16.94F + g; - this.tail.x = f; - this.tail.y = 21.07F + g; + this.head.zRot = Mth.sin(parrotRenderState.ageInTicks) * 0.4F; + this.body.x += f; + this.body.y += g; + this.leftWing.zRot = -0.0873F - parrotRenderState.flapAngle; + this.leftWing.x += f; + this.leftWing.y += g; + this.rightWing.zRot = 0.0873F + parrotRenderState.flapAngle; + this.rightWing.x += f; + this.rightWing.y += g; + this.tail.x += f; + this.tail.y += g; } } - private void prepare(ParrotModel.State state) { - this.feather.xRot = -0.2214F; - this.body.xRot = 0.4937F; - this.leftWing.xRot = -0.6981F; - this.leftWing.yRot = (float) -Math.PI; - this.rightWing.xRot = -0.6981F; - this.rightWing.yRot = (float) -Math.PI; - this.leftLeg.xRot = -0.0299F; - this.rightLeg.xRot = -0.0299F; - this.leftLeg.y = 22.0F; - this.rightLeg.y = 22.0F; - this.leftLeg.zRot = 0.0F; - this.rightLeg.zRot = 0.0F; - switch (state) { + private void prepare(ParrotModel.Pose pose) { + switch (pose) { case FLYING: this.leftLeg.xRot += (float) (Math.PI * 2.0 / 9.0); this.rightLeg.xRot += (float) (Math.PI * 2.0 / 9.0); @@ -179,14 +138,14 @@ public class ParrotModel extends HierarchicalModel { break; case SITTING: float f = 1.9F; - this.head.y = 17.59F; - this.tail.xRot = 1.5388988F; - this.tail.y = 22.97F; - this.body.y = 18.4F; + this.head.y++; + this.tail.xRot += (float) (Math.PI / 6); + this.tail.y++; + this.body.y++; this.leftWing.zRot = -0.0873F; - this.leftWing.y = 18.84F; + this.leftWing.y++; this.rightWing.zRot = 0.0873F; - this.rightWing.y = 18.84F; + this.rightWing.y++; this.leftLeg.y++; this.rightLeg.y++; this.leftLeg.xRot++; @@ -198,18 +157,18 @@ public class ParrotModel extends HierarchicalModel { } } - private static ParrotModel.State getState(Parrot parrot) { + public static ParrotModel.Pose getPose(Parrot parrot) { if (parrot.isPartyParrot()) { - return ParrotModel.State.PARTY; + return ParrotModel.Pose.PARTY; } else if (parrot.isInSittingPose()) { - return ParrotModel.State.SITTING; + return ParrotModel.Pose.SITTING; } else { - return parrot.isFlying() ? ParrotModel.State.FLYING : ParrotModel.State.STANDING; + return parrot.isFlying() ? ParrotModel.Pose.FLYING : ParrotModel.Pose.STANDING; } } @Environment(EnvType.CLIENT) - public static enum State { + public static enum Pose { FLYING, STANDING, SITTING, diff --git a/net/minecraft/client/model/PhantomModel.java b/net/minecraft/client/model/PhantomModel.java index 34fe6e5c..f4485473 100644 --- a/net/minecraft/client/model/PhantomModel.java +++ b/net/minecraft/client/model/PhantomModel.java @@ -8,14 +8,13 @@ import net.minecraft.client.model.geom.builders.CubeListBuilder; import net.minecraft.client.model.geom.builders.LayerDefinition; import net.minecraft.client.model.geom.builders.MeshDefinition; import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.client.renderer.entity.state.PhantomRenderState; import net.minecraft.util.Mth; -import net.minecraft.world.entity.monster.Phantom; @Environment(EnvType.CLIENT) -public class PhantomModel extends HierarchicalModel { +public class PhantomModel extends EntityModel { private static final String TAIL_BASE = "tail_base"; private static final String TAIL_TIP = "tail_tip"; - private final ModelPart root; private final ModelPart leftWingBase; private final ModelPart leftWingTip; private final ModelPart rightWingBase; @@ -24,7 +23,7 @@ public class PhantomModel extends HierarchicalModel { private final ModelPart tailTip; public PhantomModel(ModelPart root) { - this.root = root; + super(root); ModelPart modelPart = root.getChild("body"); this.tailBase = modelPart.getChild("tail_base"); this.tailTip = this.tailBase.getChild("tail_tip"); @@ -74,16 +73,9 @@ public class PhantomModel extends HierarchicalModel { return LayerDefinition.create(meshDefinition, 64, 64); } - @Override - public ModelPart root() { - return this.root; - } - - /** - * Sets this entity's model rotation angles - */ - public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { - float f = (entity.getUniqueFlapTickOffset() + ageInTicks) * 7.448451F * (float) (Math.PI / 180.0); + public void setupAnim(PhantomRenderState phantomRenderState) { + super.setupAnim(phantomRenderState); + float f = phantomRenderState.flapTime * 7.448451F * (float) (Math.PI / 180.0); float g = 16.0F; this.leftWingBase.zRot = Mth.cos(f) * 16.0F * (float) (Math.PI / 180.0); this.leftWingTip.zRot = Mth.cos(f) * 16.0F * (float) (Math.PI / 180.0); diff --git a/net/minecraft/client/model/PigModel.java b/net/minecraft/client/model/PigModel.java index c816fac2..6f31cedc 100644 --- a/net/minecraft/client/model/PigModel.java +++ b/net/minecraft/client/model/PigModel.java @@ -1,5 +1,6 @@ package net.minecraft.client.model; +import java.util.Set; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.model.geom.ModelPart; @@ -8,13 +9,16 @@ import net.minecraft.client.model.geom.builders.CubeDeformation; import net.minecraft.client.model.geom.builders.CubeListBuilder; import net.minecraft.client.model.geom.builders.LayerDefinition; import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.MeshTransformer; import net.minecraft.client.model.geom.builders.PartDefinition; -import net.minecraft.world.entity.Entity; +import net.minecraft.client.renderer.entity.state.LivingEntityRenderState; @Environment(EnvType.CLIENT) -public class PigModel extends QuadrupedModel { +public class PigModel extends QuadrupedModel { + public static final MeshTransformer BABY_TRANSFORMER = new BabyModelTransform(false, 4.0F, 4.0F, Set.of("head")); + public PigModel(ModelPart root) { - super(root, false, 4.0F, 4.0F, 2.0F, 2.0F, 24); + super(root); } public static LayerDefinition createBodyLayer(CubeDeformation cubeDeformation) { diff --git a/net/minecraft/client/model/PiglinHeadModel.java b/net/minecraft/client/model/PiglinHeadModel.java index 5007e5c7..ceae8720 100644 --- a/net/minecraft/client/model/PiglinHeadModel.java +++ b/net/minecraft/client/model/PiglinHeadModel.java @@ -1,7 +1,5 @@ package net.minecraft.client.model; -import com.mojang.blaze3d.vertex.PoseStack; -import com.mojang.blaze3d.vertex.VertexConsumer; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.model.geom.ModelPart; @@ -15,6 +13,7 @@ public class PiglinHeadModel extends SkullModelBase { private final ModelPart rightEar; public PiglinHeadModel(ModelPart root) { + super(root); this.head = root.getChild("head"); this.leftEar = this.head.getChild("left_ear"); this.rightEar = this.head.getChild("right_ear"); @@ -34,9 +33,4 @@ public class PiglinHeadModel extends SkullModelBase { this.leftEar.zRot = (float)(-(Math.cos(mouthAnimation * (float) Math.PI * 0.2F * 1.2F) + 2.5)) * 0.2F; this.rightEar.zRot = (float)(Math.cos(mouthAnimation * (float) Math.PI * 0.2F) + 2.5) * 0.2F; } - - @Override - public void renderToBuffer(PoseStack poseStack, VertexConsumer buffer, int packedLight, int packedOverlay, int color) { - this.head.render(poseStack, buffer, packedLight, packedOverlay, color); - } } diff --git a/net/minecraft/client/model/PiglinModel.java b/net/minecraft/client/model/PiglinModel.java index 38876bc0..659ea170 100644 --- a/net/minecraft/client/model/PiglinModel.java +++ b/net/minecraft/client/model/PiglinModel.java @@ -3,138 +3,78 @@ package net.minecraft.client.model; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.model.geom.ModelPart; -import net.minecraft.client.model.geom.PartPose; -import net.minecraft.client.model.geom.builders.CubeDeformation; -import net.minecraft.client.model.geom.builders.CubeListBuilder; -import net.minecraft.client.model.geom.builders.MeshDefinition; -import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.client.renderer.entity.state.PiglinRenderState; import net.minecraft.util.Mth; -import net.minecraft.world.entity.EntityType; -import net.minecraft.world.entity.Mob; -import net.minecraft.world.entity.monster.piglin.AbstractPiglin; -import net.minecraft.world.entity.monster.piglin.Piglin; +import net.minecraft.world.entity.HumanoidArm; import net.minecraft.world.entity.monster.piglin.PiglinArmPose; @Environment(EnvType.CLIENT) -public class PiglinModel extends PlayerModel { - public final ModelPart rightEar = this.head.getChild("right_ear"); - private final ModelPart leftEar = this.head.getChild("left_ear"); - private final PartPose bodyDefault = this.body.storePose(); - private final PartPose headDefault = this.head.storePose(); - private final PartPose leftArmDefault = this.leftArm.storePose(); - private final PartPose rightArmDefault = this.rightArm.storePose(); - +public class PiglinModel extends AbstractPiglinModel { public PiglinModel(ModelPart modelPart) { - super(modelPart, false); + super(modelPart); } - public static MeshDefinition createMesh(CubeDeformation cubeDeformation) { - MeshDefinition meshDefinition = PlayerModel.createMesh(cubeDeformation, false); - PartDefinition partDefinition = meshDefinition.getRoot(); - partDefinition.addOrReplaceChild( - "body", CubeListBuilder.create().texOffs(16, 16).addBox(-4.0F, 0.0F, -2.0F, 8.0F, 12.0F, 4.0F, cubeDeformation), PartPose.ZERO - ); - addHead(cubeDeformation, meshDefinition); - partDefinition.addOrReplaceChild("hat", CubeListBuilder.create(), PartPose.ZERO); - return meshDefinition; - } - - public static void addHead(CubeDeformation cubeDeformation, MeshDefinition mesh) { - PartDefinition partDefinition = mesh.getRoot(); - PartDefinition partDefinition2 = partDefinition.addOrReplaceChild( - "head", - CubeListBuilder.create() - .texOffs(0, 0) - .addBox(-5.0F, -8.0F, -4.0F, 10.0F, 8.0F, 8.0F, cubeDeformation) - .texOffs(31, 1) - .addBox(-2.0F, -4.0F, -5.0F, 4.0F, 4.0F, 1.0F, cubeDeformation) - .texOffs(2, 4) - .addBox(2.0F, -2.0F, -5.0F, 1.0F, 2.0F, 1.0F, cubeDeformation) - .texOffs(2, 0) - .addBox(-3.0F, -2.0F, -5.0F, 1.0F, 2.0F, 1.0F, cubeDeformation), - PartPose.ZERO - ); - partDefinition2.addOrReplaceChild( - "left_ear", - CubeListBuilder.create().texOffs(51, 6).addBox(0.0F, 0.0F, -2.0F, 1.0F, 5.0F, 4.0F, cubeDeformation), - PartPose.offsetAndRotation(4.5F, -6.0F, 0.0F, 0.0F, 0.0F, (float) (-Math.PI / 6)) - ); - partDefinition2.addOrReplaceChild( - "right_ear", - CubeListBuilder.create().texOffs(39, 6).addBox(-1.0F, 0.0F, -2.0F, 1.0F, 5.0F, 4.0F, cubeDeformation), - PartPose.offsetAndRotation(-4.5F, -6.0F, 0.0F, 0.0F, 0.0F, (float) (Math.PI / 6)) - ); - } - - /** - * Sets this entity's model rotation angles - */ - public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { - this.body.loadPose(this.bodyDefault); - this.head.loadPose(this.headDefault); - this.leftArm.loadPose(this.leftArmDefault); - this.rightArm.loadPose(this.rightArmDefault); - super.setupAnim(entity, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch); + public void setupAnim(PiglinRenderState piglinRenderState) { + super.setupAnim(piglinRenderState); float f = (float) (Math.PI / 6); - float g = ageInTicks * 0.1F + limbSwing * 0.5F; - float h = 0.08F + limbSwingAmount * 0.4F; - this.leftEar.zRot = (float) (-Math.PI / 6) - Mth.cos(g * 1.2F) * h; - this.rightEar.zRot = (float) (Math.PI / 6) + Mth.cos(g) * h; - if (entity instanceof AbstractPiglin abstractPiglin) { - PiglinArmPose piglinArmPose = abstractPiglin.getArmPose(); - if (piglinArmPose == PiglinArmPose.DANCING) { - float i = ageInTicks / 60.0F; - this.rightEar.zRot = (float) (Math.PI / 6) + (float) (Math.PI / 180.0) * Mth.sin(i * 30.0F) * 10.0F; - this.leftEar.zRot = (float) (-Math.PI / 6) - (float) (Math.PI / 180.0) * Mth.cos(i * 30.0F) * 10.0F; - this.head.x = Mth.sin(i * 10.0F); - this.head.y = Mth.sin(i * 40.0F) + 0.4F; - this.rightArm.zRot = (float) (Math.PI / 180.0) * (70.0F + Mth.cos(i * 40.0F) * 10.0F); - this.leftArm.zRot = this.rightArm.zRot * -1.0F; - this.rightArm.y = Mth.sin(i * 40.0F) * 0.5F + 1.5F; - this.leftArm.y = Mth.sin(i * 40.0F) * 0.5F + 1.5F; - this.body.y = Mth.sin(i * 40.0F) * 0.35F; - } else if (piglinArmPose == PiglinArmPose.ATTACKING_WITH_MELEE_WEAPON && this.attackTime == 0.0F) { - this.holdWeaponHigh(entity); - } else if (piglinArmPose == PiglinArmPose.CROSSBOW_HOLD) { - AnimationUtils.animateCrossbowHold(this.rightArm, this.leftArm, this.head, !entity.isLeftHanded()); - } else if (piglinArmPose == PiglinArmPose.CROSSBOW_CHARGE) { - AnimationUtils.animateCrossbowCharge(this.rightArm, this.leftArm, entity, !entity.isLeftHanded()); - } else if (piglinArmPose == PiglinArmPose.ADMIRING_ITEM) { - this.head.xRot = 0.5F; - this.head.yRot = 0.0F; - if (entity.isLeftHanded()) { - this.rightArm.yRot = -0.5F; - this.rightArm.xRot = -0.9F; - } else { - this.leftArm.yRot = 0.5F; - this.leftArm.xRot = -0.9F; - } + float g = piglinRenderState.attackTime; + PiglinArmPose piglinArmPose = piglinRenderState.armPose; + if (piglinArmPose == PiglinArmPose.DANCING) { + float h = piglinRenderState.ageInTicks / 60.0F; + this.rightEar.zRot = (float) (Math.PI / 6) + (float) (Math.PI / 180.0) * Mth.sin(h * 30.0F) * 10.0F; + this.leftEar.zRot = (float) (-Math.PI / 6) - (float) (Math.PI / 180.0) * Mth.cos(h * 30.0F) * 10.0F; + this.head.x = this.head.x + Mth.sin(h * 10.0F); + this.head.y = this.head.y + (Mth.sin(h * 40.0F) + 0.4F); + this.rightArm.zRot = (float) (Math.PI / 180.0) * (70.0F + Mth.cos(h * 40.0F) * 10.0F); + this.leftArm.zRot = this.rightArm.zRot * -1.0F; + this.rightArm.y = this.rightArm.y + (Mth.sin(h * 40.0F) * 0.5F - 0.5F); + this.leftArm.y = this.leftArm.y + (Mth.sin(h * 40.0F) * 0.5F + 0.5F); + this.body.y = this.body.y + Mth.sin(h * 40.0F) * 0.35F; + } else if (piglinArmPose == PiglinArmPose.ATTACKING_WITH_MELEE_WEAPON && g == 0.0F) { + this.holdWeaponHigh(piglinRenderState); + } else if (piglinArmPose == PiglinArmPose.CROSSBOW_HOLD) { + AnimationUtils.animateCrossbowHold(this.rightArm, this.leftArm, this.head, piglinRenderState.mainArm == HumanoidArm.RIGHT); + } else if (piglinArmPose == PiglinArmPose.CROSSBOW_CHARGE) { + AnimationUtils.animateCrossbowCharge( + this.rightArm, this.leftArm, piglinRenderState.maxCrossbowChageDuration, piglinRenderState.ticksUsingItem, piglinRenderState.mainArm == HumanoidArm.RIGHT + ); + } else if (piglinArmPose == PiglinArmPose.ADMIRING_ITEM) { + this.head.xRot = 0.5F; + this.head.yRot = 0.0F; + if (piglinRenderState.mainArm == HumanoidArm.LEFT) { + this.rightArm.yRot = -0.5F; + this.rightArm.xRot = -0.9F; + } else { + this.leftArm.yRot = 0.5F; + this.leftArm.xRot = -0.9F; } - } else if (entity.getType() == EntityType.ZOMBIFIED_PIGLIN) { - AnimationUtils.animateZombieArms(this.leftArm, this.rightArm, entity.isAggressive(), this.attackTime, ageInTicks); } - - this.leftPants.copyFrom(this.leftLeg); - this.rightPants.copyFrom(this.rightLeg); - this.leftSleeve.copyFrom(this.leftArm); - this.rightSleeve.copyFrom(this.rightArm); - this.jacket.copyFrom(this.body); - this.hat.copyFrom(this.head); } - protected void setupAttackAnimation(T livingEntity, float ageInTicks) { - if (this.attackTime > 0.0F && livingEntity instanceof Piglin && ((Piglin)livingEntity).getArmPose() == PiglinArmPose.ATTACKING_WITH_MELEE_WEAPON) { - AnimationUtils.swingWeaponDown(this.rightArm, this.leftArm, livingEntity, this.attackTime, ageInTicks); + protected void setupAttackAnimation(PiglinRenderState piglinRenderState, float f) { + float g = piglinRenderState.attackTime; + if (g > 0.0F && piglinRenderState.armPose == PiglinArmPose.ATTACKING_WITH_MELEE_WEAPON) { + AnimationUtils.swingWeaponDown(this.rightArm, this.leftArm, piglinRenderState.mainArm, g, piglinRenderState.ageInTicks); } else { - super.setupAttackAnimation(livingEntity, ageInTicks); + super.setupAttackAnimation(piglinRenderState, f); } } - private void holdWeaponHigh(T mob) { - if (mob.isLeftHanded()) { + private void holdWeaponHigh(PiglinRenderState piglinRenderState) { + if (piglinRenderState.mainArm == HumanoidArm.LEFT) { this.leftArm.xRot = -1.8F; } else { this.rightArm.xRot = -1.8F; } } + + @Override + public void setAllVisible(boolean visible) { + super.setAllVisible(visible); + this.leftSleeve.visible = visible; + this.rightSleeve.visible = visible; + this.leftPants.visible = visible; + this.rightPants.visible = visible; + this.jacket.visible = visible; + } } diff --git a/net/minecraft/client/model/PlayerCapeModel.java b/net/minecraft/client/model/PlayerCapeModel.java new file mode 100644 index 00000000..990f3869 --- /dev/null +++ b/net/minecraft/client/model/PlayerCapeModel.java @@ -0,0 +1,53 @@ +package net.minecraft.client.model; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.client.renderer.entity.state.PlayerRenderState; +import org.joml.Quaternionf; + +@Environment(EnvType.CLIENT) +public class PlayerCapeModel extends HumanoidModel { + private static final String CAPE = "cape"; + private final ModelPart cape = this.body.getChild("cape"); + + public PlayerCapeModel(ModelPart modelPart) { + super(modelPart); + } + + public static LayerDefinition createCapeLayer() { + MeshDefinition meshDefinition = HumanoidModel.createMesh(CubeDeformation.NONE, 0.0F); + PartDefinition partDefinition = meshDefinition.getRoot(); + PartDefinition partDefinition2 = partDefinition.clearChild("head"); + partDefinition2.clearChild("hat"); + PartDefinition partDefinition3 = partDefinition.clearChild("body"); + partDefinition.clearChild("left_arm"); + partDefinition.clearChild("right_arm"); + partDefinition.clearChild("left_leg"); + partDefinition.clearChild("right_leg"); + partDefinition3.addOrReplaceChild( + "cape", + CubeListBuilder.create().texOffs(0, 0).addBox(-5.0F, 0.0F, -1.0F, 10.0F, 16.0F, 1.0F, CubeDeformation.NONE, 1.0F, 0.5F), + PartPose.offsetAndRotation(0.0F, 0.0F, 2.0F, 0.0F, (float) Math.PI, 0.0F) + ); + return LayerDefinition.create(meshDefinition, 64, 64); + } + + public void setupAnim(T playerRenderState) { + super.setupAnim(playerRenderState); + this.cape + .rotateBy( + new Quaternionf() + .rotateY((float) -Math.PI) + .rotateX((6.0F + playerRenderState.capeLean / 2.0F + playerRenderState.capeFlap) * (float) (Math.PI / 180.0)) + .rotateZ(playerRenderState.capeLean2 / 2.0F * (float) (Math.PI / 180.0)) + .rotateY((180.0F - playerRenderState.capeLean2 / 2.0F) * (float) (Math.PI / 180.0)) + ); + } +} diff --git a/net/minecraft/client/model/PlayerEarsModel.java b/net/minecraft/client/model/PlayerEarsModel.java new file mode 100644 index 00000000..12453d03 --- /dev/null +++ b/net/minecraft/client/model/PlayerEarsModel.java @@ -0,0 +1,35 @@ +package net.minecraft.client.model; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.client.renderer.entity.state.PlayerRenderState; + +@Environment(EnvType.CLIENT) +public class PlayerEarsModel extends HumanoidModel { + public PlayerEarsModel(ModelPart modelPart) { + super(modelPart); + } + + public static LayerDefinition createEarsLayer() { + MeshDefinition meshDefinition = HumanoidModel.createMesh(CubeDeformation.NONE, 0.0F); + PartDefinition partDefinition = meshDefinition.getRoot(); + PartDefinition partDefinition2 = partDefinition.clearChild("head"); + partDefinition2.clearChild("hat"); + partDefinition.clearChild("body"); + partDefinition.clearChild("left_arm"); + partDefinition.clearChild("right_arm"); + partDefinition.clearChild("left_leg"); + partDefinition.clearChild("right_leg"); + CubeListBuilder cubeListBuilder = CubeListBuilder.create().texOffs(24, 0).addBox(-3.0F, -6.0F, -1.0F, 6.0F, 6.0F, 1.0F, new CubeDeformation(1.0F)); + partDefinition2.addOrReplaceChild("left_ear", cubeListBuilder, PartPose.offset(-6.0F, -6.0F, 0.0F)); + partDefinition2.addOrReplaceChild("right_ear", cubeListBuilder, PartPose.offset(6.0F, -6.0F, 0.0F)); + return LayerDefinition.create(meshDefinition, 64, 64); + } +} diff --git a/net/minecraft/client/model/PlayerModel.java b/net/minecraft/client/model/PlayerModel.java index ae4646ce..06018491 100644 --- a/net/minecraft/client/model/PlayerModel.java +++ b/net/minecraft/client/model/PlayerModel.java @@ -1,12 +1,10 @@ package net.minecraft.client.model; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.Iterables; import com.mojang.blaze3d.vertex.PoseStack; -import com.mojang.blaze3d.vertex.VertexConsumer; import java.util.List; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; +import net.minecraft.Util; import net.minecraft.client.model.geom.ModelPart; import net.minecraft.client.model.geom.PartPose; import net.minecraft.client.model.geom.builders.CubeDeformation; @@ -14,143 +12,97 @@ import net.minecraft.client.model.geom.builders.CubeListBuilder; import net.minecraft.client.model.geom.builders.MeshDefinition; import net.minecraft.client.model.geom.builders.PartDefinition; import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.entity.player.PlayerRenderer; +import net.minecraft.client.renderer.entity.state.PlayerRenderState; import net.minecraft.util.RandomSource; -import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.HumanoidArm; -import net.minecraft.world.entity.LivingEntity; @Environment(EnvType.CLIENT) -public class PlayerModel extends HumanoidModel { - private static final String EAR = "ear"; - private static final String CLOAK = "cloak"; +public class PlayerModel extends HumanoidModel { private static final String LEFT_SLEEVE = "left_sleeve"; private static final String RIGHT_SLEEVE = "right_sleeve"; private static final String LEFT_PANTS = "left_pants"; private static final String RIGHT_PANTS = "right_pants"; - private final List parts; + private final List bodyParts; public final ModelPart leftSleeve; public final ModelPart rightSleeve; public final ModelPart leftPants; public final ModelPart rightPants; public final ModelPart jacket; - private final ModelPart cloak; - private final ModelPart ear; private final boolean slim; public PlayerModel(ModelPart root, boolean slim) { super(root, RenderType::entityTranslucent); this.slim = slim; - this.ear = root.getChild("ear"); - this.cloak = root.getChild("cloak"); - this.leftSleeve = root.getChild("left_sleeve"); - this.rightSleeve = root.getChild("right_sleeve"); - this.leftPants = root.getChild("left_pants"); - this.rightPants = root.getChild("right_pants"); - this.jacket = root.getChild("jacket"); - this.parts = (List)root.getAllParts().filter(modelPart -> !modelPart.isEmpty()).collect(ImmutableList.toImmutableList()); + this.leftSleeve = this.leftArm.getChild("left_sleeve"); + this.rightSleeve = this.rightArm.getChild("right_sleeve"); + this.leftPants = this.leftLeg.getChild("left_pants"); + this.rightPants = this.rightLeg.getChild("right_pants"); + this.jacket = this.body.getChild("jacket"); + this.bodyParts = List.of(this.head, this.body, this.leftArm, this.rightArm, this.leftLeg, this.rightLeg); } public static MeshDefinition createMesh(CubeDeformation cubeDeformation, boolean slim) { MeshDefinition meshDefinition = HumanoidModel.createMesh(cubeDeformation, 0.0F); PartDefinition partDefinition = meshDefinition.getRoot(); - partDefinition.addOrReplaceChild("ear", CubeListBuilder.create().texOffs(24, 0).addBox(-3.0F, -6.0F, -1.0F, 6.0F, 6.0F, 1.0F, cubeDeformation), PartPose.ZERO); - partDefinition.addOrReplaceChild( - "cloak", - CubeListBuilder.create().texOffs(0, 0).addBox(-5.0F, 0.0F, -1.0F, 10.0F, 16.0F, 1.0F, cubeDeformation, 1.0F, 0.5F), - PartPose.offset(0.0F, 0.0F, 0.0F) - ); float f = 0.25F; if (slim) { - partDefinition.addOrReplaceChild( - "left_arm", CubeListBuilder.create().texOffs(32, 48).addBox(-1.0F, -2.0F, -2.0F, 3.0F, 12.0F, 4.0F, cubeDeformation), PartPose.offset(5.0F, 2.5F, 0.0F) + PartDefinition partDefinition2 = partDefinition.addOrReplaceChild( + "left_arm", CubeListBuilder.create().texOffs(32, 48).addBox(-1.0F, -2.0F, -2.0F, 3.0F, 12.0F, 4.0F, cubeDeformation), PartPose.offset(5.0F, 2.0F, 0.0F) ); - partDefinition.addOrReplaceChild( - "right_arm", CubeListBuilder.create().texOffs(40, 16).addBox(-2.0F, -2.0F, -2.0F, 3.0F, 12.0F, 4.0F, cubeDeformation), PartPose.offset(-5.0F, 2.5F, 0.0F) + PartDefinition partDefinition3 = partDefinition.addOrReplaceChild( + "right_arm", CubeListBuilder.create().texOffs(40, 16).addBox(-2.0F, -2.0F, -2.0F, 3.0F, 12.0F, 4.0F, cubeDeformation), PartPose.offset(-5.0F, 2.0F, 0.0F) ); - partDefinition.addOrReplaceChild( - "left_sleeve", - CubeListBuilder.create().texOffs(48, 48).addBox(-1.0F, -2.0F, -2.0F, 3.0F, 12.0F, 4.0F, cubeDeformation.extend(0.25F)), - PartPose.offset(5.0F, 2.5F, 0.0F) + partDefinition2.addOrReplaceChild( + "left_sleeve", CubeListBuilder.create().texOffs(48, 48).addBox(-1.0F, -2.0F, -2.0F, 3.0F, 12.0F, 4.0F, cubeDeformation.extend(0.25F)), PartPose.ZERO ); - partDefinition.addOrReplaceChild( - "right_sleeve", - CubeListBuilder.create().texOffs(40, 32).addBox(-2.0F, -2.0F, -2.0F, 3.0F, 12.0F, 4.0F, cubeDeformation.extend(0.25F)), - PartPose.offset(-5.0F, 2.5F, 0.0F) + partDefinition3.addOrReplaceChild( + "right_sleeve", CubeListBuilder.create().texOffs(40, 32).addBox(-2.0F, -2.0F, -2.0F, 3.0F, 12.0F, 4.0F, cubeDeformation.extend(0.25F)), PartPose.ZERO ); } else { - partDefinition.addOrReplaceChild( + PartDefinition partDefinition2 = partDefinition.addOrReplaceChild( "left_arm", CubeListBuilder.create().texOffs(32, 48).addBox(-1.0F, -2.0F, -2.0F, 4.0F, 12.0F, 4.0F, cubeDeformation), PartPose.offset(5.0F, 2.0F, 0.0F) ); - partDefinition.addOrReplaceChild( - "left_sleeve", - CubeListBuilder.create().texOffs(48, 48).addBox(-1.0F, -2.0F, -2.0F, 4.0F, 12.0F, 4.0F, cubeDeformation.extend(0.25F)), - PartPose.offset(5.0F, 2.0F, 0.0F) + PartDefinition partDefinition3 = partDefinition.getChild("right_arm"); + partDefinition2.addOrReplaceChild( + "left_sleeve", CubeListBuilder.create().texOffs(48, 48).addBox(-1.0F, -2.0F, -2.0F, 4.0F, 12.0F, 4.0F, cubeDeformation.extend(0.25F)), PartPose.ZERO ); - partDefinition.addOrReplaceChild( - "right_sleeve", - CubeListBuilder.create().texOffs(40, 32).addBox(-3.0F, -2.0F, -2.0F, 4.0F, 12.0F, 4.0F, cubeDeformation.extend(0.25F)), - PartPose.offset(-5.0F, 2.0F, 0.0F) + partDefinition3.addOrReplaceChild( + "right_sleeve", CubeListBuilder.create().texOffs(40, 32).addBox(-3.0F, -2.0F, -2.0F, 4.0F, 12.0F, 4.0F, cubeDeformation.extend(0.25F)), PartPose.ZERO ); } - partDefinition.addOrReplaceChild( + PartDefinition partDefinition2 = partDefinition.addOrReplaceChild( "left_leg", CubeListBuilder.create().texOffs(16, 48).addBox(-2.0F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F, cubeDeformation), PartPose.offset(1.9F, 12.0F, 0.0F) ); - partDefinition.addOrReplaceChild( - "left_pants", - CubeListBuilder.create().texOffs(0, 48).addBox(-2.0F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F, cubeDeformation.extend(0.25F)), - PartPose.offset(1.9F, 12.0F, 0.0F) + PartDefinition partDefinition3 = partDefinition.getChild("right_leg"); + partDefinition2.addOrReplaceChild( + "left_pants", CubeListBuilder.create().texOffs(0, 48).addBox(-2.0F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F, cubeDeformation.extend(0.25F)), PartPose.ZERO ); - partDefinition.addOrReplaceChild( - "right_pants", - CubeListBuilder.create().texOffs(0, 32).addBox(-2.0F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F, cubeDeformation.extend(0.25F)), - PartPose.offset(-1.9F, 12.0F, 0.0F) + partDefinition3.addOrReplaceChild( + "right_pants", CubeListBuilder.create().texOffs(0, 32).addBox(-2.0F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F, cubeDeformation.extend(0.25F)), PartPose.ZERO ); - partDefinition.addOrReplaceChild( + PartDefinition partDefinition4 = partDefinition.getChild("body"); + partDefinition4.addOrReplaceChild( "jacket", CubeListBuilder.create().texOffs(16, 32).addBox(-4.0F, 0.0F, -2.0F, 8.0F, 12.0F, 4.0F, cubeDeformation.extend(0.25F)), PartPose.ZERO ); return meshDefinition; } - @Override - protected Iterable bodyParts() { - return Iterables.concat(super.bodyParts(), ImmutableList.of(this.leftPants, this.rightPants, this.leftSleeve, this.rightSleeve, this.jacket)); - } - - public void renderEars(PoseStack poseStack, VertexConsumer buffer, int packedLight, int packedOverlay) { - this.ear.copyFrom(this.head); - this.ear.x = 0.0F; - this.ear.y = 0.0F; - this.ear.render(poseStack, buffer, packedLight, packedOverlay); - } - - public void renderCloak(PoseStack poseStack, VertexConsumer buffer, int packedLight, int packedOverlay) { - this.cloak.render(poseStack, buffer, packedLight, packedOverlay); - } - - @Override - public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { - super.setupAnim(entity, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch); - this.leftPants.copyFrom(this.leftLeg); - this.rightPants.copyFrom(this.rightLeg); - this.leftSleeve.copyFrom(this.leftArm); - this.rightSleeve.copyFrom(this.rightArm); - this.jacket.copyFrom(this.body); - if (entity.getItemBySlot(EquipmentSlot.CHEST).isEmpty()) { - if (entity.isCrouching()) { - this.cloak.z = 1.4F; - this.cloak.y = 1.85F; - } else { - this.cloak.z = 0.0F; - this.cloak.y = 0.0F; - } - } else if (entity.isCrouching()) { - this.cloak.z = 0.3F; - this.cloak.y = 0.8F; - } else { - this.cloak.z = -1.1F; - this.cloak.y = -0.85F; - } + public void setupAnim(PlayerRenderState playerRenderState) { + boolean bl = !playerRenderState.isSpectator; + this.body.visible = bl; + this.rightArm.visible = bl; + this.leftArm.visible = bl; + this.rightLeg.visible = bl; + this.leftLeg.visible = bl; + this.hat.visible = playerRenderState.showHat; + this.jacket.visible = playerRenderState.showJacket; + this.leftPants.visible = playerRenderState.showLeftPants; + this.rightPants.visible = playerRenderState.showRightPants; + this.leftSleeve.visible = playerRenderState.showLeftSleeve; + this.rightSleeve.visible = playerRenderState.showRightSleeve; + super.setupAnim(playerRenderState); } @Override @@ -161,12 +113,11 @@ public class PlayerModel extends HumanoidModel { this.leftPants.visible = visible; this.rightPants.visible = visible; this.jacket.visible = visible; - this.cloak.visible = visible; - this.ear.visible = visible; } @Override public void translateToHand(HumanoidArm side, PoseStack poseStack) { + this.root().translateAndRotate(poseStack); ModelPart modelPart = this.getArm(side); if (this.slim) { float f = 0.5F * (side == HumanoidArm.RIGHT ? 1 : -1); @@ -178,7 +129,11 @@ public class PlayerModel extends HumanoidModel { } } - public ModelPart getRandomModelPart(RandomSource random) { - return (ModelPart)this.parts.get(random.nextInt(this.parts.size())); + public ModelPart getRandomBodyPart(RandomSource randomSource) { + return Util.getRandom(this.bodyParts, randomSource); + } + + protected HumanoidModel.ArmPose getArmPose(PlayerRenderState playerRenderState, HumanoidArm humanoidArm) { + return PlayerRenderer.getArmPose(playerRenderState, humanoidArm); } } diff --git a/net/minecraft/client/model/PolarBearModel.java b/net/minecraft/client/model/PolarBearModel.java index bd9a61fa..7677c108 100644 --- a/net/minecraft/client/model/PolarBearModel.java +++ b/net/minecraft/client/model/PolarBearModel.java @@ -1,5 +1,6 @@ package net.minecraft.client.model; +import java.util.Set; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.model.geom.ModelPart; @@ -7,13 +8,17 @@ import net.minecraft.client.model.geom.PartPose; import net.minecraft.client.model.geom.builders.CubeListBuilder; import net.minecraft.client.model.geom.builders.LayerDefinition; import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.MeshTransformer; import net.minecraft.client.model.geom.builders.PartDefinition; -import net.minecraft.world.entity.animal.PolarBear; +import net.minecraft.client.renderer.entity.state.PolarBearRenderState; @Environment(EnvType.CLIENT) -public class PolarBearModel extends QuadrupedModel { +public class PolarBearModel extends QuadrupedModel { + private static final float BABY_HEAD_SCALE = 2.25F; + public static final MeshTransformer BABY_TRANSFORMER = new BabyModelTransform(true, 16.0F, 4.0F, 2.25F, 2.0F, 24.0F, Set.of("head")); + public PolarBearModel(ModelPart root) { - super(root, true, 16.0F, 4.0F, 2.25F, 2.0F, 24); + super(root); } public static LayerDefinition createBodyLayer() { @@ -45,34 +50,24 @@ public class PolarBearModel extends QuadrupedModel { CubeListBuilder cubeListBuilder2 = CubeListBuilder.create().texOffs(50, 40).addBox(-2.0F, 0.0F, -2.0F, 4.0F, 10.0F, 6.0F); partDefinition.addOrReplaceChild("right_front_leg", cubeListBuilder2, PartPose.offset(-3.5F, 14.0F, -8.0F)); partDefinition.addOrReplaceChild("left_front_leg", cubeListBuilder2, PartPose.offset(3.5F, 14.0F, -8.0F)); - return LayerDefinition.create(meshDefinition, 128, 64); + return LayerDefinition.create(meshDefinition, 128, 64).apply(MeshTransformer.scaling(1.2F)); } - /** - * Sets this entity's model rotation angles - */ - public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { - super.setupAnim(entity, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch); - float f = ageInTicks - entity.tickCount; - float g = entity.getStandingAnimationScale(f); - g *= g; - float h = 1.0F - g; - this.body.xRot = (float) (Math.PI / 2) - g * (float) Math.PI * 0.35F; - this.body.y = 9.0F * h + 11.0F * g; - this.rightFrontLeg.y = 14.0F * h - 6.0F * g; - this.rightFrontLeg.z = -8.0F * h - 4.0F * g; - this.rightFrontLeg.xRot -= g * (float) Math.PI * 0.45F; + public void setupAnim(PolarBearRenderState polarBearRenderState) { + super.setupAnim(polarBearRenderState); + float f = polarBearRenderState.standScale * polarBearRenderState.standScale; + float g = polarBearRenderState.ageScale; + float h = polarBearRenderState.isBaby ? 0.44444445F : 1.0F; + this.body.xRot -= f * (float) Math.PI * 0.35F; + this.body.y += f * g * 2.0F; + this.rightFrontLeg.y -= f * g * 20.0F; + this.rightFrontLeg.z += f * g * 4.0F; + this.rightFrontLeg.xRot -= f * (float) Math.PI * 0.45F; this.leftFrontLeg.y = this.rightFrontLeg.y; this.leftFrontLeg.z = this.rightFrontLeg.z; - this.leftFrontLeg.xRot -= g * (float) Math.PI * 0.45F; - if (this.young) { - this.head.y = 10.0F * h - 9.0F * g; - this.head.z = -16.0F * h - 7.0F * g; - } else { - this.head.y = 10.0F * h - 14.0F * g; - this.head.z = -16.0F * h - 3.0F * g; - } - - this.head.xRot += g * (float) Math.PI * 0.15F; + this.leftFrontLeg.xRot -= f * (float) Math.PI * 0.45F; + this.head.y -= f * h * 24.0F; + this.head.z += f * h * 13.0F; + this.head.xRot += f * (float) Math.PI * 0.15F; } } diff --git a/net/minecraft/client/model/PufferfishBigModel.java b/net/minecraft/client/model/PufferfishBigModel.java index 54cdd52b..6445f09a 100644 --- a/net/minecraft/client/model/PufferfishBigModel.java +++ b/net/minecraft/client/model/PufferfishBigModel.java @@ -8,17 +8,16 @@ import net.minecraft.client.model.geom.builders.CubeListBuilder; import net.minecraft.client.model.geom.builders.LayerDefinition; import net.minecraft.client.model.geom.builders.MeshDefinition; import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.client.renderer.entity.state.EntityRenderState; import net.minecraft.util.Mth; -import net.minecraft.world.entity.Entity; @Environment(EnvType.CLIENT) -public class PufferfishBigModel extends HierarchicalModel { - private final ModelPart root; +public class PufferfishBigModel extends EntityModel { private final ModelPart leftBlueFin; private final ModelPart rightBlueFin; public PufferfishBigModel(ModelPart root) { - this.root = root; + super(root); this.leftBlueFin = root.getChild("left_blue_fin"); this.rightBlueFin = root.getChild("right_blue_fin"); } @@ -86,13 +85,9 @@ public class PufferfishBigModel extends HierarchicalModel { } @Override - public ModelPart root() { - return this.root; - } - - @Override - public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { - this.rightBlueFin.zRot = -0.2F + 0.4F * Mth.sin(ageInTicks * 0.2F); - this.leftBlueFin.zRot = 0.2F - 0.4F * Mth.sin(ageInTicks * 0.2F); + public void setupAnim(EntityRenderState entityRenderState) { + super.setupAnim(entityRenderState); + this.rightBlueFin.zRot = -0.2F + 0.4F * Mth.sin(entityRenderState.ageInTicks * 0.2F); + this.leftBlueFin.zRot = 0.2F - 0.4F * Mth.sin(entityRenderState.ageInTicks * 0.2F); } } diff --git a/net/minecraft/client/model/PufferfishMidModel.java b/net/minecraft/client/model/PufferfishMidModel.java index fce5f11d..ac17dd90 100644 --- a/net/minecraft/client/model/PufferfishMidModel.java +++ b/net/minecraft/client/model/PufferfishMidModel.java @@ -8,17 +8,16 @@ import net.minecraft.client.model.geom.builders.CubeListBuilder; import net.minecraft.client.model.geom.builders.LayerDefinition; import net.minecraft.client.model.geom.builders.MeshDefinition; import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.client.renderer.entity.state.EntityRenderState; import net.minecraft.util.Mth; -import net.minecraft.world.entity.Entity; @Environment(EnvType.CLIENT) -public class PufferfishMidModel extends HierarchicalModel { - private final ModelPart root; +public class PufferfishMidModel extends EntityModel { private final ModelPart leftBlueFin; private final ModelPart rightBlueFin; public PufferfishMidModel(ModelPart root) { - this.root = root; + super(root); this.leftBlueFin = root.getChild("left_blue_fin"); this.rightBlueFin = root.getChild("right_blue_fin"); } @@ -31,62 +30,58 @@ public class PufferfishMidModel extends HierarchicalModel { "body", CubeListBuilder.create().texOffs(12, 22).addBox(-2.5F, -5.0F, -2.5F, 5.0F, 5.0F, 5.0F), PartPose.offset(0.0F, 22.0F, 0.0F) ); partDefinition.addOrReplaceChild( - "right_blue_fin", CubeListBuilder.create().texOffs(24, 0).addBox(-2.0F, 0.0F, 0.0F, 2.0F, 0.0F, 2.0F), PartPose.offset(-2.5F, 17.0F, -1.5F) + "right_blue_fin", CubeListBuilder.create().texOffs(24, 0).addBox(-2.0F, 0.0F, 0.0F, 2.0F, 0.0F, 2.0F), PartPose.offset(-2.5F, 18.0F, -1.5F) ); partDefinition.addOrReplaceChild( - "left_blue_fin", CubeListBuilder.create().texOffs(24, 3).addBox(0.0F, 0.0F, 0.0F, 2.0F, 0.0F, 2.0F), PartPose.offset(2.5F, 17.0F, -1.5F) + "left_blue_fin", CubeListBuilder.create().texOffs(24, 3).addBox(0.0F, 0.0F, 0.0F, 2.0F, 0.0F, 2.0F), PartPose.offset(2.5F, 18.0F, -1.5F) ); partDefinition.addOrReplaceChild( "top_front_fin", - CubeListBuilder.create().texOffs(15, 16).addBox(-2.5F, -1.0F, 0.0F, 5.0F, 1.0F, 1.0F), + CubeListBuilder.create().texOffs(19, 17).addBox(-2.5F, -1.0F, 0.0F, 5.0F, 1.0F, 0.0F), PartPose.offsetAndRotation(0.0F, 17.0F, -2.5F, (float) (Math.PI / 4), 0.0F, 0.0F) ); partDefinition.addOrReplaceChild( "top_back_fin", - CubeListBuilder.create().texOffs(10, 16).addBox(-2.5F, -1.0F, -1.0F, 5.0F, 1.0F, 1.0F), + CubeListBuilder.create().texOffs(11, 17).addBox(-2.5F, -1.0F, 0.0F, 5.0F, 1.0F, 0.0F), PartPose.offsetAndRotation(0.0F, 17.0F, 2.5F, (float) (-Math.PI / 4), 0.0F, 0.0F) ); partDefinition.addOrReplaceChild( "right_front_fin", - CubeListBuilder.create().texOffs(8, 16).addBox(-1.0F, -5.0F, 0.0F, 1.0F, 5.0F, 1.0F), + CubeListBuilder.create().texOffs(5, 17).addBox(-1.0F, -5.0F, 0.0F, 1.0F, 5.0F, 0.0F), PartPose.offsetAndRotation(-2.5F, 22.0F, -2.5F, 0.0F, (float) (-Math.PI / 4), 0.0F) ); partDefinition.addOrReplaceChild( "right_back_fin", - CubeListBuilder.create().texOffs(8, 16).addBox(-1.0F, -5.0F, 0.0F, 1.0F, 5.0F, 1.0F), + CubeListBuilder.create().texOffs(9, 17).addBox(-1.0F, -5.0F, 0.0F, 1.0F, 5.0F, 0.0F), PartPose.offsetAndRotation(-2.5F, 22.0F, 2.5F, 0.0F, (float) (Math.PI / 4), 0.0F) ); partDefinition.addOrReplaceChild( "left_back_fin", - CubeListBuilder.create().texOffs(4, 16).addBox(0.0F, -5.0F, 0.0F, 1.0F, 5.0F, 1.0F), + CubeListBuilder.create().texOffs(1, 17).addBox(0.0F, -5.0F, 0.0F, 1.0F, 5.0F, 0.0F), PartPose.offsetAndRotation(2.5F, 22.0F, 2.5F, 0.0F, (float) (-Math.PI / 4), 0.0F) ); partDefinition.addOrReplaceChild( "left_front_fin", - CubeListBuilder.create().texOffs(0, 16).addBox(0.0F, -5.0F, 0.0F, 1.0F, 5.0F, 1.0F), + CubeListBuilder.create().texOffs(1, 17).addBox(0.0F, -5.0F, 0.0F, 1.0F, 5.0F, 0.0F), PartPose.offsetAndRotation(2.5F, 22.0F, -2.5F, 0.0F, (float) (Math.PI / 4), 0.0F) ); partDefinition.addOrReplaceChild( "bottom_back_fin", - CubeListBuilder.create().texOffs(8, 22).addBox(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F), - PartPose.offsetAndRotation(0.5F, 22.0F, 2.5F, (float) (Math.PI / 4), 0.0F, 0.0F) + CubeListBuilder.create().texOffs(18, 20).addBox(0.0F, 0.0F, 0.0F, 5.0F, 1.0F, 0.0F), + PartPose.offsetAndRotation(-2.5F, 22.0F, 2.5F, (float) (Math.PI / 4), 0.0F, 0.0F) ); partDefinition.addOrReplaceChild( "bottom_front_fin", - CubeListBuilder.create().texOffs(17, 21).addBox(-2.5F, 0.0F, 0.0F, 5.0F, 1.0F, 1.0F), + CubeListBuilder.create().texOffs(17, 19).addBox(-2.5F, 0.0F, 0.0F, 5.0F, 1.0F, 1.0F), PartPose.offsetAndRotation(0.0F, 22.0F, -2.5F, (float) (-Math.PI / 4), 0.0F, 0.0F) ); return LayerDefinition.create(meshDefinition, 32, 32); } @Override - public ModelPart root() { - return this.root; - } - - @Override - public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { - this.rightBlueFin.zRot = -0.2F + 0.4F * Mth.sin(ageInTicks * 0.2F); - this.leftBlueFin.zRot = 0.2F - 0.4F * Mth.sin(ageInTicks * 0.2F); + public void setupAnim(EntityRenderState entityRenderState) { + super.setupAnim(entityRenderState); + this.rightBlueFin.zRot = -0.2F + 0.4F * Mth.sin(entityRenderState.ageInTicks * 0.2F); + this.leftBlueFin.zRot = 0.2F - 0.4F * Mth.sin(entityRenderState.ageInTicks * 0.2F); } } diff --git a/net/minecraft/client/model/PufferfishSmallModel.java b/net/minecraft/client/model/PufferfishSmallModel.java index 7b4980ab..c8db6195 100644 --- a/net/minecraft/client/model/PufferfishSmallModel.java +++ b/net/minecraft/client/model/PufferfishSmallModel.java @@ -8,17 +8,16 @@ import net.minecraft.client.model.geom.builders.CubeListBuilder; import net.minecraft.client.model.geom.builders.LayerDefinition; import net.minecraft.client.model.geom.builders.MeshDefinition; import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.client.renderer.entity.state.EntityRenderState; import net.minecraft.util.Mth; -import net.minecraft.world.entity.Entity; @Environment(EnvType.CLIENT) -public class PufferfishSmallModel extends HierarchicalModel { - private final ModelPart root; +public class PufferfishSmallModel extends EntityModel { private final ModelPart leftFin; private final ModelPart rightFin; public PufferfishSmallModel(ModelPart root) { - this.root = root; + super(root); this.leftFin = root.getChild("left_fin"); this.rightFin = root.getChild("right_fin"); } @@ -49,13 +48,9 @@ public class PufferfishSmallModel extends HierarchicalModel } @Override - public ModelPart root() { - return this.root; - } - - @Override - public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { - this.rightFin.zRot = -0.2F + 0.4F * Mth.sin(ageInTicks * 0.2F); - this.leftFin.zRot = 0.2F - 0.4F * Mth.sin(ageInTicks * 0.2F); + public void setupAnim(EntityRenderState entityRenderState) { + super.setupAnim(entityRenderState); + this.rightFin.zRot = -0.2F + 0.4F * Mth.sin(entityRenderState.ageInTicks * 0.2F); + this.leftFin.zRot = 0.2F - 0.4F * Mth.sin(entityRenderState.ageInTicks * 0.2F); } } diff --git a/net/minecraft/client/model/QuadrupedModel.java b/net/minecraft/client/model/QuadrupedModel.java index fbbb2940..53a65ed1 100644 --- a/net/minecraft/client/model/QuadrupedModel.java +++ b/net/minecraft/client/model/QuadrupedModel.java @@ -1,6 +1,5 @@ package net.minecraft.client.model; -import com.google.common.collect.ImmutableList; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.model.geom.ModelPart; @@ -9,11 +8,11 @@ import net.minecraft.client.model.geom.builders.CubeDeformation; import net.minecraft.client.model.geom.builders.CubeListBuilder; import net.minecraft.client.model.geom.builders.MeshDefinition; import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.client.renderer.entity.state.LivingEntityRenderState; import net.minecraft.util.Mth; -import net.minecraft.world.entity.Entity; @Environment(EnvType.CLIENT) -public class QuadrupedModel extends AgeableListModel { +public class QuadrupedModel extends EntityModel { protected final ModelPart head; protected final ModelPart body; protected final ModelPart rightHindLeg; @@ -21,16 +20,14 @@ public class QuadrupedModel extends AgeableListModel { protected final ModelPart rightFrontLeg; protected final ModelPart leftFrontLeg; - protected QuadrupedModel( - ModelPart root, boolean scaleHead, float babyYHeadOffset, float babyZHeadOffset, float babyHeadScale, float babyBodyScale, int bodyYOffset - ) { - super(scaleHead, babyYHeadOffset, babyZHeadOffset, babyHeadScale, babyBodyScale, bodyYOffset); - this.head = root.getChild("head"); - this.body = root.getChild("body"); - this.rightHindLeg = root.getChild("right_hind_leg"); - this.leftHindLeg = root.getChild("left_hind_leg"); - this.rightFrontLeg = root.getChild("right_front_leg"); - this.leftFrontLeg = root.getChild("left_front_leg"); + protected QuadrupedModel(ModelPart modelPart) { + super(modelPart); + this.head = modelPart.getChild("head"); + this.body = modelPart.getChild("body"); + this.rightHindLeg = modelPart.getChild("right_hind_leg"); + this.leftHindLeg = modelPart.getChild("left_hind_leg"); + this.rightFrontLeg = modelPart.getChild("right_front_leg"); + this.leftFrontLeg = modelPart.getChild("left_front_leg"); } public static MeshDefinition createBodyMesh(int yOffset, CubeDeformation cubeDeformation) { @@ -52,23 +49,15 @@ public class QuadrupedModel extends AgeableListModel { return meshDefinition; } - @Override - protected Iterable headParts() { - return ImmutableList.of(this.head); - } - - @Override - protected Iterable bodyParts() { - return ImmutableList.of(this.body, this.rightHindLeg, this.leftHindLeg, this.rightFrontLeg, this.leftFrontLeg); - } - - @Override - public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { - this.head.xRot = headPitch * (float) (Math.PI / 180.0); - this.head.yRot = netHeadYaw * (float) (Math.PI / 180.0); - this.rightHindLeg.xRot = Mth.cos(limbSwing * 0.6662F) * 1.4F * limbSwingAmount; - this.leftHindLeg.xRot = Mth.cos(limbSwing * 0.6662F + (float) Math.PI) * 1.4F * limbSwingAmount; - this.rightFrontLeg.xRot = Mth.cos(limbSwing * 0.6662F + (float) Math.PI) * 1.4F * limbSwingAmount; - this.leftFrontLeg.xRot = Mth.cos(limbSwing * 0.6662F) * 1.4F * limbSwingAmount; + public void setupAnim(T livingEntityRenderState) { + super.setupAnim(livingEntityRenderState); + this.head.xRot = livingEntityRenderState.xRot * (float) (Math.PI / 180.0); + this.head.yRot = livingEntityRenderState.yRot * (float) (Math.PI / 180.0); + float f = livingEntityRenderState.walkAnimationPos; + float g = livingEntityRenderState.walkAnimationSpeed; + this.rightHindLeg.xRot = Mth.cos(f * 0.6662F) * 1.4F * g; + this.leftHindLeg.xRot = Mth.cos(f * 0.6662F + (float) Math.PI) * 1.4F * g; + this.rightFrontLeg.xRot = Mth.cos(f * 0.6662F + (float) Math.PI) * 1.4F * g; + this.leftFrontLeg.xRot = Mth.cos(f * 0.6662F) * 1.4F * g; } } diff --git a/net/minecraft/client/model/RabbitModel.java b/net/minecraft/client/model/RabbitModel.java index 932ce537..a3ab586f 100644 --- a/net/minecraft/client/model/RabbitModel.java +++ b/net/minecraft/client/model/RabbitModel.java @@ -1,8 +1,6 @@ package net.minecraft.client.model; -import com.google.common.collect.ImmutableList; -import com.mojang.blaze3d.vertex.PoseStack; -import com.mojang.blaze3d.vertex.VertexConsumer; +import java.util.Set; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.model.geom.ModelPart; @@ -10,24 +8,26 @@ import net.minecraft.client.model.geom.PartPose; import net.minecraft.client.model.geom.builders.CubeListBuilder; import net.minecraft.client.model.geom.builders.LayerDefinition; import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.MeshTransformer; import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.client.renderer.entity.state.RabbitRenderState; import net.minecraft.util.Mth; -import net.minecraft.world.entity.animal.Rabbit; @Environment(EnvType.CLIENT) -public class RabbitModel extends EntityModel { +public class RabbitModel extends EntityModel { private static final float REAR_JUMP_ANGLE = 50.0F; private static final float FRONT_JUMP_ANGLE = -40.0F; + private static final float NEW_SCALE = 0.6F; + private static final MeshTransformer ADULT_TRANSFORMER = MeshTransformer.scaling(0.6F); + private static final MeshTransformer BABY_TRANSFORMER = new BabyModelTransform( + true, 22.0F, 2.0F, 2.65F, 2.5F, 36.0F, Set.of("head", "left_ear", "right_ear", "nose") + ); private static final String LEFT_HAUNCH = "left_haunch"; private static final String RIGHT_HAUNCH = "right_haunch"; private final ModelPart leftRearFoot; private final ModelPart rightRearFoot; private final ModelPart leftHaunch; private final ModelPart rightHaunch; - /** - * The Rabbit's Body - */ - private final ModelPart body; private final ModelPart leftFrontLeg; private final ModelPart rightFrontLeg; /** @@ -36,33 +36,26 @@ public class RabbitModel extends EntityModel { private final ModelPart head; private final ModelPart rightEar; private final ModelPart leftEar; - /** - * The Rabbit's Tail - */ - private final ModelPart tail; /** * The Rabbit's Nose */ private final ModelPart nose; - private float jumpRotation; - private static final float NEW_SCALE = 0.6F; public RabbitModel(ModelPart root) { + super(root); this.leftRearFoot = root.getChild("left_hind_foot"); this.rightRearFoot = root.getChild("right_hind_foot"); this.leftHaunch = root.getChild("left_haunch"); this.rightHaunch = root.getChild("right_haunch"); - this.body = root.getChild("body"); this.leftFrontLeg = root.getChild("left_front_leg"); this.rightFrontLeg = root.getChild("right_front_leg"); this.head = root.getChild("head"); this.rightEar = root.getChild("right_ear"); this.leftEar = root.getChild("left_ear"); - this.tail = root.getChild("tail"); this.nose = root.getChild("nose"); } - public static LayerDefinition createBodyLayer() { + public static LayerDefinition createBodyLayer(boolean bl) { MeshDefinition meshDefinition = new MeshDefinition(); PartDefinition partDefinition = meshDefinition.getRoot(); partDefinition.addOrReplaceChild( @@ -117,72 +110,25 @@ public class RabbitModel extends EntityModel { partDefinition.addOrReplaceChild( "nose", CubeListBuilder.create().texOffs(32, 9).addBox(-0.5F, -2.5F, -5.5F, 1.0F, 1.0F, 1.0F), PartPose.offset(0.0F, 16.0F, -1.0F) ); - return LayerDefinition.create(meshDefinition, 64, 32); + return LayerDefinition.create(meshDefinition, 64, 32).apply(bl ? BABY_TRANSFORMER : ADULT_TRANSFORMER); } - @Override - public void renderToBuffer(PoseStack poseStack, VertexConsumer buffer, int packedLight, int packedOverlay, int color) { - if (this.young) { - float f = 1.5F; - poseStack.pushPose(); - poseStack.scale(0.56666666F, 0.56666666F, 0.56666666F); - poseStack.translate(0.0F, 1.375F, 0.125F); - ImmutableList.of(this.head, this.leftEar, this.rightEar, this.nose) - .forEach(modelPart -> modelPart.render(poseStack, buffer, packedLight, packedOverlay, color)); - poseStack.popPose(); - poseStack.pushPose(); - poseStack.scale(0.4F, 0.4F, 0.4F); - poseStack.translate(0.0F, 2.25F, 0.0F); - ImmutableList.of(this.leftRearFoot, this.rightRearFoot, this.leftHaunch, this.rightHaunch, this.body, this.leftFrontLeg, this.rightFrontLeg, this.tail) - .forEach(modelPart -> modelPart.render(poseStack, buffer, packedLight, packedOverlay, color)); - poseStack.popPose(); - } else { - poseStack.pushPose(); - poseStack.scale(0.6F, 0.6F, 0.6F); - poseStack.translate(0.0F, 1.0F, 0.0F); - ImmutableList.of( - this.leftRearFoot, - this.rightRearFoot, - this.leftHaunch, - this.rightHaunch, - this.body, - this.leftFrontLeg, - this.rightFrontLeg, - this.head, - this.rightEar, - this.leftEar, - this.tail, - this.nose - ) - .forEach(modelPart -> modelPart.render(poseStack, buffer, packedLight, packedOverlay, color)); - poseStack.popPose(); - } - } - - /** - * Sets this entity's model rotation angles - */ - public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { - float f = ageInTicks - entity.tickCount; - this.nose.xRot = headPitch * (float) (Math.PI / 180.0); - this.head.xRot = headPitch * (float) (Math.PI / 180.0); - this.rightEar.xRot = headPitch * (float) (Math.PI / 180.0); - this.leftEar.xRot = headPitch * (float) (Math.PI / 180.0); - this.nose.yRot = netHeadYaw * (float) (Math.PI / 180.0); - this.head.yRot = netHeadYaw * (float) (Math.PI / 180.0); + public void setupAnim(RabbitRenderState rabbitRenderState) { + super.setupAnim(rabbitRenderState); + this.nose.xRot = rabbitRenderState.xRot * (float) (Math.PI / 180.0); + this.head.xRot = rabbitRenderState.xRot * (float) (Math.PI / 180.0); + this.rightEar.xRot = rabbitRenderState.xRot * (float) (Math.PI / 180.0); + this.leftEar.xRot = rabbitRenderState.xRot * (float) (Math.PI / 180.0); + this.nose.yRot = rabbitRenderState.yRot * (float) (Math.PI / 180.0); + this.head.yRot = rabbitRenderState.yRot * (float) (Math.PI / 180.0); this.rightEar.yRot = this.nose.yRot - (float) (Math.PI / 12); this.leftEar.yRot = this.nose.yRot + (float) (Math.PI / 12); - this.jumpRotation = Mth.sin(entity.getJumpCompletion(f) * (float) Math.PI); - this.leftHaunch.xRot = (this.jumpRotation * 50.0F - 21.0F) * (float) (Math.PI / 180.0); - this.rightHaunch.xRot = (this.jumpRotation * 50.0F - 21.0F) * (float) (Math.PI / 180.0); - this.leftRearFoot.xRot = this.jumpRotation * 50.0F * (float) (Math.PI / 180.0); - this.rightRearFoot.xRot = this.jumpRotation * 50.0F * (float) (Math.PI / 180.0); - this.leftFrontLeg.xRot = (this.jumpRotation * -40.0F - 11.0F) * (float) (Math.PI / 180.0); - this.rightFrontLeg.xRot = (this.jumpRotation * -40.0F - 11.0F) * (float) (Math.PI / 180.0); - } - - public void prepareMobModel(T entity, float limbSwing, float limbSwingAmount, float partialTick) { - super.prepareMobModel(entity, limbSwing, limbSwingAmount, partialTick); - this.jumpRotation = Mth.sin(entity.getJumpCompletion(partialTick) * (float) Math.PI); + float f = Mth.sin(rabbitRenderState.jumpCompletion * (float) Math.PI); + this.leftHaunch.xRot = (f * 50.0F - 21.0F) * (float) (Math.PI / 180.0); + this.rightHaunch.xRot = (f * 50.0F - 21.0F) * (float) (Math.PI / 180.0); + this.leftRearFoot.xRot = f * 50.0F * (float) (Math.PI / 180.0); + this.rightRearFoot.xRot = f * 50.0F * (float) (Math.PI / 180.0); + this.leftFrontLeg.xRot = (f * -40.0F - 11.0F) * (float) (Math.PI / 180.0); + this.rightFrontLeg.xRot = (f * -40.0F - 11.0F) * (float) (Math.PI / 180.0); } } diff --git a/net/minecraft/client/model/RaftModel.java b/net/minecraft/client/model/RaftModel.java index 25b1b526..4e33810e 100644 --- a/net/minecraft/client/model/RaftModel.java +++ b/net/minecraft/client/model/RaftModel.java @@ -1,7 +1,5 @@ package net.minecraft.client.model; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableList.Builder; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.model.geom.ModelPart; @@ -10,32 +8,15 @@ import net.minecraft.client.model.geom.builders.CubeListBuilder; import net.minecraft.client.model.geom.builders.LayerDefinition; import net.minecraft.client.model.geom.builders.MeshDefinition; import net.minecraft.client.model.geom.builders.PartDefinition; -import net.minecraft.util.Mth; -import net.minecraft.world.entity.vehicle.Boat; @Environment(EnvType.CLIENT) -public class RaftModel extends ListModel { - private static final String LEFT_PADDLE = "left_paddle"; - private static final String RIGHT_PADDLE = "right_paddle"; - private static final String BOTTOM = "bottom"; - private final ModelPart leftPaddle; - private final ModelPart rightPaddle; - private final ImmutableList parts; - +public class RaftModel extends AbstractBoatModel { public RaftModel(ModelPart root) { - this.leftPaddle = root.getChild("left_paddle"); - this.rightPaddle = root.getChild("right_paddle"); - this.parts = this.createPartsBuilder(root).build(); + super(root); } - protected Builder createPartsBuilder(ModelPart root) { - Builder builder = new Builder<>(); - builder.add(root.getChild("bottom"), this.leftPaddle, this.rightPaddle); - return builder; - } - - public static void createChildren(PartDefinition root) { - root.addOrReplaceChild( + private static void addCommonParts(PartDefinition partDefinition) { + partDefinition.addOrReplaceChild( "bottom", CubeListBuilder.create().texOffs(0, 0).addBox(-14.0F, -11.0F, -4.0F, 28.0F, 20.0F, 4.0F).texOffs(0, 0).addBox(-14.0F, -9.0F, -8.0F, 28.0F, 16.0F, 4.0F), PartPose.offsetAndRotation(0.0F, -2.1F, 1.0F, 1.5708F, 0.0F, 0.0F) @@ -44,43 +25,44 @@ public class RaftModel extends ListModel { int j = 7; int k = 6; float f = -5.0F; - root.addOrReplaceChild( + partDefinition.addOrReplaceChild( "left_paddle", CubeListBuilder.create().texOffs(0, 24).addBox(-1.0F, 0.0F, -5.0F, 2.0F, 2.0F, 18.0F).addBox(-1.001F, -3.0F, 8.0F, 1.0F, 6.0F, 7.0F), PartPose.offsetAndRotation(3.0F, -4.0F, 9.0F, 0.0F, 0.0F, (float) (Math.PI / 16)) ); - root.addOrReplaceChild( + partDefinition.addOrReplaceChild( "right_paddle", CubeListBuilder.create().texOffs(40, 24).addBox(-1.0F, 0.0F, -5.0F, 2.0F, 2.0F, 18.0F).addBox(0.001F, -3.0F, 8.0F, 1.0F, 6.0F, 7.0F), PartPose.offsetAndRotation(3.0F, -4.0F, -9.0F, 0.0F, (float) Math.PI, (float) (Math.PI / 16)) ); } - public static LayerDefinition createBodyModel() { + public static LayerDefinition createRaftModel() { MeshDefinition meshDefinition = new MeshDefinition(); PartDefinition partDefinition = meshDefinition.getRoot(); - createChildren(partDefinition); + addCommonParts(partDefinition); return LayerDefinition.create(meshDefinition, 128, 64); } - /** - * Sets this entity's model rotation angles - */ - public void setupAnim(Boat entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { - animatePaddle(entity, 0, this.leftPaddle, limbSwing); - animatePaddle(entity, 1, this.rightPaddle, limbSwing); - } - - public ImmutableList parts() { - return this.parts; - } - - private static void animatePaddle(Boat boat, int side, ModelPart paddle, float limbSwing) { - float f = boat.getRowingTime(side, limbSwing); - paddle.xRot = Mth.clampedLerp((float) (-Math.PI / 3), (float) (-Math.PI / 12), (Mth.sin(-f) + 1.0F) / 2.0F); - paddle.yRot = Mth.clampedLerp((float) (-Math.PI / 4), (float) (Math.PI / 4), (Mth.sin(-f + 1.0F) + 1.0F) / 2.0F); - if (side == 1) { - paddle.yRot = (float) Math.PI - paddle.yRot; - } + public static LayerDefinition createChestRaftModel() { + MeshDefinition meshDefinition = new MeshDefinition(); + PartDefinition partDefinition = meshDefinition.getRoot(); + addCommonParts(partDefinition); + partDefinition.addOrReplaceChild( + "chest_bottom", + CubeListBuilder.create().texOffs(0, 76).addBox(0.0F, 0.0F, 0.0F, 12.0F, 8.0F, 12.0F), + PartPose.offsetAndRotation(-2.0F, -10.1F, -6.0F, 0.0F, (float) (-Math.PI / 2), 0.0F) + ); + partDefinition.addOrReplaceChild( + "chest_lid", + CubeListBuilder.create().texOffs(0, 59).addBox(0.0F, 0.0F, 0.0F, 12.0F, 4.0F, 12.0F), + PartPose.offsetAndRotation(-2.0F, -14.1F, -6.0F, 0.0F, (float) (-Math.PI / 2), 0.0F) + ); + partDefinition.addOrReplaceChild( + "chest_lock", + CubeListBuilder.create().texOffs(0, 59).addBox(0.0F, 0.0F, 0.0F, 2.0F, 4.0F, 1.0F), + PartPose.offsetAndRotation(-1.0F, -11.1F, -1.0F, 0.0F, (float) (-Math.PI / 2), 0.0F) + ); + return LayerDefinition.create(meshDefinition, 128, 128); } } diff --git a/net/minecraft/client/model/RavagerModel.java b/net/minecraft/client/model/RavagerModel.java index f6447a07..e4ce4137 100644 --- a/net/minecraft/client/model/RavagerModel.java +++ b/net/minecraft/client/model/RavagerModel.java @@ -8,12 +8,11 @@ import net.minecraft.client.model.geom.builders.CubeListBuilder; import net.minecraft.client.model.geom.builders.LayerDefinition; import net.minecraft.client.model.geom.builders.MeshDefinition; import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.client.renderer.entity.state.RavagerRenderState; import net.minecraft.util.Mth; -import net.minecraft.world.entity.monster.Ravager; @Environment(EnvType.CLIENT) -public class RavagerModel extends HierarchicalModel { - private final ModelPart root; +public class RavagerModel extends EntityModel { private final ModelPart head; private final ModelPart mouth; private final ModelPart rightHindLeg; @@ -23,7 +22,7 @@ public class RavagerModel extends HierarchicalModel { private final ModelPart neck; public RavagerModel(ModelPart root) { - this.root = root; + super(root); this.neck = root.getChild("neck"); this.head = this.neck.getChild("head"); this.mouth = this.head.getChild("mouth"); @@ -78,61 +77,48 @@ public class RavagerModel extends HierarchicalModel { return LayerDefinition.create(meshDefinition, 128, 128); } - @Override - public ModelPart root() { - return this.root; - } - - /** - * Sets this entity's model rotation angles - */ - public void setupAnim(Ravager entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { - this.head.xRot = headPitch * (float) (Math.PI / 180.0); - this.head.yRot = netHeadYaw * (float) (Math.PI / 180.0); - float f = 0.4F * limbSwingAmount; - this.rightHindLeg.xRot = Mth.cos(limbSwing * 0.6662F) * f; - this.leftHindLeg.xRot = Mth.cos(limbSwing * 0.6662F + (float) Math.PI) * f; - this.rightFrontLeg.xRot = Mth.cos(limbSwing * 0.6662F + (float) Math.PI) * f; - this.leftFrontLeg.xRot = Mth.cos(limbSwing * 0.6662F) * f; - } - - public void prepareMobModel(Ravager entity, float limbSwing, float limbSwingAmount, float partialTick) { - super.prepareMobModel(entity, limbSwing, limbSwingAmount, partialTick); - int i = entity.getStunnedTick(); - int j = entity.getRoarTick(); - int k = 20; - int l = entity.getAttackTick(); - int m = 10; - if (l > 0) { - float f = Mth.triangleWave(l - partialTick, 10.0F); - float g = (1.0F + f) * 0.5F; - float h = g * g * g * 12.0F; - float n = h * Mth.sin(this.neck.xRot); - this.neck.z = -6.5F + h; - this.neck.y = -7.0F - n; - float o = Mth.sin((l - partialTick) / 10.0F * (float) Math.PI * 0.25F); - this.mouth.xRot = (float) (Math.PI / 2) * o; - if (l > 5) { - this.mouth.xRot = Mth.sin((-4 + l - partialTick) / 4.0F) * (float) Math.PI * 0.4F; + public void setupAnim(RavagerRenderState ravagerRenderState) { + super.setupAnim(ravagerRenderState); + float f = ravagerRenderState.stunnedTicksRemaining; + float g = ravagerRenderState.attackTicksRemaining; + int i = 10; + if (g > 0.0F) { + float h = Mth.triangleWave(g, 10.0F); + float j = (1.0F + h) * 0.5F; + float k = j * j * j * 12.0F; + float l = k * Mth.sin(this.neck.xRot); + this.neck.z = -6.5F + k; + this.neck.y = -7.0F - l; + if (g > 5.0F) { + this.mouth.xRot = Mth.sin((-4.0F + g) / 4.0F) * (float) Math.PI * 0.4F; } else { - this.mouth.xRot = (float) (Math.PI / 20) * Mth.sin((float) Math.PI * (l - partialTick) / 10.0F); + this.mouth.xRot = (float) (Math.PI / 20) * Mth.sin((float) Math.PI * g / 10.0F); } } else { - float f = -1.0F; - float g = -1.0F * Mth.sin(this.neck.xRot); + float h = -1.0F; + float j = -1.0F * Mth.sin(this.neck.xRot); this.neck.x = 0.0F; - this.neck.y = -7.0F - g; + this.neck.y = -7.0F - j; this.neck.z = 5.5F; - boolean bl = i > 0; + boolean bl = f > 0.0F; this.neck.xRot = bl ? 0.21991149F : 0.0F; this.mouth.xRot = (float) Math.PI * (bl ? 0.05F : 0.01F); if (bl) { - double d = i / 40.0; + double d = f / 40.0; this.neck.x = (float)Math.sin(d * 10.0) * 3.0F; - } else if (j > 0) { - float n = Mth.sin((20 - j - partialTick) / 20.0F * (float) Math.PI * 0.25F); - this.mouth.xRot = (float) (Math.PI / 2) * n; + } else if (ravagerRenderState.roarAnimation > 0.0) { + float l = Mth.sin(ravagerRenderState.roarAnimation * (float) Math.PI * 0.25F); + this.mouth.xRot = (float) (Math.PI / 2) * l; } } + + this.head.xRot = ravagerRenderState.xRot * (float) (Math.PI / 180.0); + this.head.yRot = ravagerRenderState.yRot * (float) (Math.PI / 180.0); + float hx = ravagerRenderState.walkAnimationPos; + float jx = 0.4F * ravagerRenderState.walkAnimationSpeed; + this.rightHindLeg.xRot = Mth.cos(hx * 0.6662F) * jx; + this.leftHindLeg.xRot = Mth.cos(hx * 0.6662F + (float) Math.PI) * jx; + this.rightFrontLeg.xRot = Mth.cos(hx * 0.6662F + (float) Math.PI) * jx; + this.leftFrontLeg.xRot = Mth.cos(hx * 0.6662F) * jx; } } diff --git a/net/minecraft/client/model/SalmonModel.java b/net/minecraft/client/model/SalmonModel.java index e181c861..a386c5dd 100644 --- a/net/minecraft/client/model/SalmonModel.java +++ b/net/minecraft/client/model/SalmonModel.java @@ -7,19 +7,22 @@ import net.minecraft.client.model.geom.PartPose; import net.minecraft.client.model.geom.builders.CubeListBuilder; import net.minecraft.client.model.geom.builders.LayerDefinition; import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.MeshTransformer; import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.client.renderer.entity.state.SalmonRenderState; import net.minecraft.util.Mth; -import net.minecraft.world.entity.Entity; @Environment(EnvType.CLIENT) -public class SalmonModel extends HierarchicalModel { +public class SalmonModel extends EntityModel { + public static final MeshTransformer SMALL_TRANSFORMER = MeshTransformer.scaling(0.5F); + public static final MeshTransformer LARGE_TRANSFORMER = MeshTransformer.scaling(1.5F); private static final String BODY_FRONT = "body_front"; private static final String BODY_BACK = "body_back"; - private final ModelPart root; + private static final float Z_OFFSET = -7.2F; private final ModelPart bodyBack; public SalmonModel(ModelPart root) { - this.root = root; + super(root); this.bodyBack = root.getChild("body_back"); } @@ -28,13 +31,13 @@ public class SalmonModel extends HierarchicalModel { PartDefinition partDefinition = meshDefinition.getRoot(); int i = 20; PartDefinition partDefinition2 = partDefinition.addOrReplaceChild( - "body_front", CubeListBuilder.create().texOffs(0, 0).addBox(-1.5F, -2.5F, 0.0F, 3.0F, 5.0F, 8.0F), PartPose.offset(0.0F, 20.0F, 0.0F) + "body_front", CubeListBuilder.create().texOffs(0, 0).addBox(-1.5F, -2.5F, 0.0F, 3.0F, 5.0F, 8.0F), PartPose.offset(0.0F, 20.0F, -7.2F) ); PartDefinition partDefinition3 = partDefinition.addOrReplaceChild( - "body_back", CubeListBuilder.create().texOffs(0, 13).addBox(-1.5F, -2.5F, 0.0F, 3.0F, 5.0F, 8.0F), PartPose.offset(0.0F, 20.0F, 8.0F) + "body_back", CubeListBuilder.create().texOffs(0, 13).addBox(-1.5F, -2.5F, 0.0F, 3.0F, 5.0F, 8.0F), PartPose.offset(0.0F, 20.0F, 0.8000002F) ); partDefinition.addOrReplaceChild( - "head", CubeListBuilder.create().texOffs(22, 0).addBox(-1.0F, -2.0F, -3.0F, 2.0F, 4.0F, 3.0F), PartPose.offset(0.0F, 20.0F, 0.0F) + "head", CubeListBuilder.create().texOffs(22, 0).addBox(-1.0F, -2.0F, -3.0F, 2.0F, 4.0F, 3.0F), PartPose.offset(0.0F, 20.0F, -7.2F) ); partDefinition3.addOrReplaceChild( "back_fin", CubeListBuilder.create().texOffs(20, 10).addBox(0.0F, -2.5F, 0.0F, 0.0F, 5.0F, 6.0F), PartPose.offset(0.0F, 0.0F, 8.0F) @@ -48,30 +51,25 @@ public class SalmonModel extends HierarchicalModel { partDefinition.addOrReplaceChild( "right_fin", CubeListBuilder.create().texOffs(-4, 0).addBox(-2.0F, 0.0F, 0.0F, 2.0F, 0.0F, 2.0F), - PartPose.offsetAndRotation(-1.5F, 21.5F, 0.0F, 0.0F, 0.0F, (float) (-Math.PI / 4)) + PartPose.offsetAndRotation(-1.5F, 21.5F, -7.2F, 0.0F, 0.0F, (float) (-Math.PI / 4)) ); partDefinition.addOrReplaceChild( "left_fin", CubeListBuilder.create().texOffs(0, 0).addBox(0.0F, 0.0F, 0.0F, 2.0F, 0.0F, 2.0F), - PartPose.offsetAndRotation(1.5F, 21.5F, 0.0F, 0.0F, 0.0F, (float) (Math.PI / 4)) + PartPose.offsetAndRotation(1.5F, 21.5F, -7.2F, 0.0F, 0.0F, (float) (Math.PI / 4)) ); return LayerDefinition.create(meshDefinition, 32, 32); } - @Override - public ModelPart root() { - return this.root; - } - - @Override - public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { + public void setupAnim(SalmonRenderState salmonRenderState) { + super.setupAnim(salmonRenderState); float f = 1.0F; float g = 1.0F; - if (!entity.isInWater()) { + if (!salmonRenderState.isInWater) { f = 1.3F; g = 1.7F; } - this.bodyBack.yRot = -f * 0.25F * Mth.sin(g * 0.6F * ageInTicks); + this.bodyBack.yRot = -f * 0.25F * Mth.sin(g * 0.6F * salmonRenderState.ageInTicks); } } diff --git a/net/minecraft/client/model/SheepFurModel.java b/net/minecraft/client/model/SheepFurModel.java index 755e482b..0343bf3c 100644 --- a/net/minecraft/client/model/SheepFurModel.java +++ b/net/minecraft/client/model/SheepFurModel.java @@ -9,14 +9,12 @@ import net.minecraft.client.model.geom.builders.CubeListBuilder; import net.minecraft.client.model.geom.builders.LayerDefinition; import net.minecraft.client.model.geom.builders.MeshDefinition; import net.minecraft.client.model.geom.builders.PartDefinition; -import net.minecraft.world.entity.animal.Sheep; +import net.minecraft.client.renderer.entity.state.SheepRenderState; @Environment(EnvType.CLIENT) -public class SheepFurModel extends QuadrupedModel { - private float headXRot; - +public class SheepFurModel extends QuadrupedModel { public SheepFurModel(ModelPart root) { - super(root, false, 8.0F, 4.0F, 2.0F, 2.0F, 24); + super(root); } public static LayerDefinition createFurLayer() { @@ -38,17 +36,9 @@ public class SheepFurModel extends QuadrupedModel { return LayerDefinition.create(meshDefinition, 64, 32); } - public void prepareMobModel(T entity, float limbSwing, float limbSwingAmount, float partialTick) { - super.prepareMobModel(entity, limbSwing, limbSwingAmount, partialTick); - this.head.y = 6.0F + entity.getHeadEatPositionScale(partialTick) * 9.0F; - this.headXRot = entity.getHeadEatAngleScale(partialTick); - } - - /** - * Sets this entity's model rotation angles - */ - public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { - super.setupAnim(entity, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch); - this.head.xRot = this.headXRot; + public void setupAnim(SheepRenderState sheepRenderState) { + super.setupAnim(sheepRenderState); + this.head.y = this.head.y + sheepRenderState.headEatPositionScale * 9.0F * sheepRenderState.ageScale; + this.head.xRot = sheepRenderState.headEatAngleScale; } } diff --git a/net/minecraft/client/model/SheepModel.java b/net/minecraft/client/model/SheepModel.java index 9d55af9c..14569fd9 100644 --- a/net/minecraft/client/model/SheepModel.java +++ b/net/minecraft/client/model/SheepModel.java @@ -1,5 +1,6 @@ package net.minecraft.client.model; +import java.util.Set; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.model.geom.ModelPart; @@ -8,15 +9,16 @@ import net.minecraft.client.model.geom.builders.CubeDeformation; import net.minecraft.client.model.geom.builders.CubeListBuilder; import net.minecraft.client.model.geom.builders.LayerDefinition; import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.MeshTransformer; import net.minecraft.client.model.geom.builders.PartDefinition; -import net.minecraft.world.entity.animal.Sheep; +import net.minecraft.client.renderer.entity.state.SheepRenderState; @Environment(EnvType.CLIENT) -public class SheepModel extends QuadrupedModel { - private float headXRot; +public class SheepModel extends QuadrupedModel { + public static final MeshTransformer BABY_TRANSFORMER = new BabyModelTransform(false, 8.0F, 4.0F, 2.0F, 2.0F, 24.0F, Set.of("head")); public SheepModel(ModelPart root) { - super(root, false, 8.0F, 4.0F, 2.0F, 2.0F, 24); + super(root); } public static LayerDefinition createBodyLayer() { @@ -33,17 +35,9 @@ public class SheepModel extends QuadrupedModel { return LayerDefinition.create(meshDefinition, 64, 32); } - public void prepareMobModel(T entity, float limbSwing, float limbSwingAmount, float partialTick) { - super.prepareMobModel(entity, limbSwing, limbSwingAmount, partialTick); - this.head.y = 6.0F + entity.getHeadEatPositionScale(partialTick) * 9.0F; - this.headXRot = entity.getHeadEatAngleScale(partialTick); - } - - /** - * Sets this entity's model rotation angles - */ - public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { - super.setupAnim(entity, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch); - this.head.xRot = this.headXRot; + public void setupAnim(SheepRenderState sheepRenderState) { + super.setupAnim(sheepRenderState); + this.head.y = this.head.y + sheepRenderState.headEatPositionScale * 9.0F * sheepRenderState.ageScale; + this.head.xRot = sheepRenderState.headEatAngleScale; } } diff --git a/net/minecraft/client/model/ShieldModel.java b/net/minecraft/client/model/ShieldModel.java index 86a5599c..aaea3e84 100644 --- a/net/minecraft/client/model/ShieldModel.java +++ b/net/minecraft/client/model/ShieldModel.java @@ -1,7 +1,5 @@ package net.minecraft.client.model; -import com.mojang.blaze3d.vertex.PoseStack; -import com.mojang.blaze3d.vertex.VertexConsumer; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.model.geom.ModelPart; @@ -18,13 +16,11 @@ public class ShieldModel extends Model { private static final String HANDLE = "handle"; private static final int SHIELD_WIDTH = 10; private static final int SHIELD_HEIGHT = 20; - private final ModelPart root; private final ModelPart plate; private final ModelPart handle; public ShieldModel(ModelPart root) { - super(RenderType::entitySolid); - this.root = root; + super(root, RenderType::entitySolid); this.plate = root.getChild("plate"); this.handle = root.getChild("handle"); } @@ -44,9 +40,4 @@ public class ShieldModel extends Model { public ModelPart handle() { return this.handle; } - - @Override - public void renderToBuffer(PoseStack poseStack, VertexConsumer buffer, int packedLight, int packedOverlay, int color) { - this.root.render(poseStack, buffer, packedLight, packedOverlay, color); - } } diff --git a/net/minecraft/client/model/ShulkerBulletModel.java b/net/minecraft/client/model/ShulkerBulletModel.java index 86fc9f37..64c25ccb 100644 --- a/net/minecraft/client/model/ShulkerBulletModel.java +++ b/net/minecraft/client/model/ShulkerBulletModel.java @@ -8,16 +8,15 @@ import net.minecraft.client.model.geom.builders.CubeListBuilder; import net.minecraft.client.model.geom.builders.LayerDefinition; import net.minecraft.client.model.geom.builders.MeshDefinition; import net.minecraft.client.model.geom.builders.PartDefinition; -import net.minecraft.world.entity.Entity; +import net.minecraft.client.renderer.entity.state.ShulkerBulletRenderState; @Environment(EnvType.CLIENT) -public class ShulkerBulletModel extends HierarchicalModel { +public class ShulkerBulletModel extends EntityModel { private static final String MAIN = "main"; - private final ModelPart root; private final ModelPart main; public ShulkerBulletModel(ModelPart root) { - this.root = root; + super(root); this.main = root.getChild("main"); } @@ -38,14 +37,9 @@ public class ShulkerBulletModel extends HierarchicalModel { return LayerDefinition.create(meshDefinition, 64, 32); } - @Override - public ModelPart root() { - return this.root; - } - - @Override - public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { - this.main.yRot = netHeadYaw * (float) (Math.PI / 180.0); - this.main.xRot = headPitch * (float) (Math.PI / 180.0); + public void setupAnim(ShulkerBulletRenderState shulkerBulletRenderState) { + super.setupAnim(shulkerBulletRenderState); + this.main.yRot = shulkerBulletRenderState.yRot * (float) (Math.PI / 180.0); + this.main.xRot = shulkerBulletRenderState.xRot * (float) (Math.PI / 180.0); } } diff --git a/net/minecraft/client/model/ShulkerModel.java b/net/minecraft/client/model/ShulkerModel.java index 90bfc7bb..234fa567 100644 --- a/net/minecraft/client/model/ShulkerModel.java +++ b/net/minecraft/client/model/ShulkerModel.java @@ -1,6 +1,5 @@ package net.minecraft.client.model; -import com.google.common.collect.ImmutableList; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.model.geom.ModelPart; @@ -10,25 +9,23 @@ import net.minecraft.client.model.geom.builders.LayerDefinition; import net.minecraft.client.model.geom.builders.MeshDefinition; import net.minecraft.client.model.geom.builders.PartDefinition; import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.entity.state.ShulkerRenderState; import net.minecraft.util.Mth; -import net.minecraft.world.entity.monster.Shulker; @Environment(EnvType.CLIENT) -public class ShulkerModel extends ListModel { - private static final String LID = "lid"; +public class ShulkerModel extends EntityModel { + public static final String LID = "lid"; private static final String BASE = "base"; - private final ModelPart base; private final ModelPart lid; private final ModelPart head; public ShulkerModel(ModelPart root) { - super(RenderType::entityCutoutNoCullZOffset); + super(root, RenderType::entityCutoutNoCullZOffset); this.lid = root.getChild("lid"); - this.base = root.getChild("base"); this.head = root.getChild("head"); } - public static LayerDefinition createBodyLayer() { + private static MeshDefinition createShellMesh() { MeshDefinition meshDefinition = new MeshDefinition(); PartDefinition partDefinition = meshDefinition.getRoot(); partDefinition.addOrReplaceChild( @@ -37,45 +34,38 @@ public class ShulkerModel extends ListModel { partDefinition.addOrReplaceChild( "base", CubeListBuilder.create().texOffs(0, 28).addBox(-8.0F, -8.0F, -8.0F, 16.0F, 8.0F, 16.0F), PartPose.offset(0.0F, 24.0F, 0.0F) ); - partDefinition.addOrReplaceChild( - "head", CubeListBuilder.create().texOffs(0, 52).addBox(-3.0F, 0.0F, -3.0F, 6.0F, 6.0F, 6.0F), PartPose.offset(0.0F, 12.0F, 0.0F) - ); + return meshDefinition; + } + + public static LayerDefinition createBodyLayer() { + MeshDefinition meshDefinition = createShellMesh(); + meshDefinition.getRoot() + .addOrReplaceChild("head", CubeListBuilder.create().texOffs(0, 52).addBox(-3.0F, 0.0F, -3.0F, 6.0F, 6.0F, 6.0F), PartPose.offset(0.0F, 12.0F, 0.0F)); return LayerDefinition.create(meshDefinition, 64, 64); } - /** - * Sets this entity's model rotation angles - */ - public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { - float f = ageInTicks - entity.tickCount; - float g = (0.5F + entity.getClientPeekAmount(f)) * (float) Math.PI; - float h = -1.0F + Mth.sin(g); - float i = 0.0F; - if (g > (float) Math.PI) { - i = Mth.sin(ageInTicks * 0.1F) * 0.7F; + public static LayerDefinition createBoxLayer() { + MeshDefinition meshDefinition = createShellMesh(); + return LayerDefinition.create(meshDefinition, 64, 64); + } + + public void setupAnim(ShulkerRenderState shulkerRenderState) { + super.setupAnim(shulkerRenderState); + float f = (0.5F + shulkerRenderState.peekAmount) * (float) Math.PI; + float g = -1.0F + Mth.sin(f); + float h = 0.0F; + if (f > (float) Math.PI) { + h = Mth.sin(shulkerRenderState.ageInTicks * 0.1F) * 0.7F; } - this.lid.setPos(0.0F, 16.0F + Mth.sin(g) * 8.0F + i, 0.0F); - if (entity.getClientPeekAmount(f) > 0.3F) { - this.lid.yRot = h * h * h * h * (float) Math.PI * 0.125F; + this.lid.setPos(0.0F, 16.0F + Mth.sin(f) * 8.0F + h, 0.0F); + if (shulkerRenderState.peekAmount > 0.3F) { + this.lid.yRot = g * g * g * g * (float) Math.PI * 0.125F; } else { this.lid.yRot = 0.0F; } - this.head.xRot = headPitch * (float) (Math.PI / 180.0); - this.head.yRot = (entity.yHeadRot - 180.0F - entity.yBodyRot) * (float) (Math.PI / 180.0); - } - - @Override - public Iterable parts() { - return ImmutableList.of(this.base, this.lid); - } - - public ModelPart getLid() { - return this.lid; - } - - public ModelPart getHead() { - return this.head; + this.head.xRot = shulkerRenderState.xRot * (float) (Math.PI / 180.0); + this.head.yRot = (shulkerRenderState.yHeadRot - 180.0F - shulkerRenderState.yBodyRot) * (float) (Math.PI / 180.0); } } diff --git a/net/minecraft/client/model/SilverfishModel.java b/net/minecraft/client/model/SilverfishModel.java index 3dd94291..3c11b9f6 100644 --- a/net/minecraft/client/model/SilverfishModel.java +++ b/net/minecraft/client/model/SilverfishModel.java @@ -9,20 +9,19 @@ import net.minecraft.client.model.geom.builders.CubeListBuilder; import net.minecraft.client.model.geom.builders.LayerDefinition; import net.minecraft.client.model.geom.builders.MeshDefinition; import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.client.renderer.entity.state.EntityRenderState; import net.minecraft.util.Mth; -import net.minecraft.world.entity.Entity; @Environment(EnvType.CLIENT) -public class SilverfishModel extends HierarchicalModel { +public class SilverfishModel extends EntityModel { private static final int BODY_COUNT = 7; - private final ModelPart root; private final ModelPart[] bodyParts = new ModelPart[7]; private final ModelPart[] bodyLayers = new ModelPart[3]; private static final int[][] BODY_SIZES = new int[][]{{3, 2, 2}, {4, 3, 2}, {6, 4, 3}, {3, 3, 3}, {2, 2, 3}, {2, 1, 2}, {1, 1, 2}}; private static final int[][] BODY_TEXS = new int[][]{{0, 0}, {0, 4}, {0, 9}, {0, 16}, {0, 22}, {11, 0}, {13, 4}}; public SilverfishModel(ModelPart root) { - this.root = root; + super(root); Arrays.setAll(this.bodyParts, i -> root.getChild(getSegmentName(i))); Arrays.setAll(this.bodyLayers, i -> root.getChild(getLayerName(i))); } @@ -74,15 +73,12 @@ public class SilverfishModel extends HierarchicalModel { } @Override - public ModelPart root() { - return this.root; - } + public void setupAnim(EntityRenderState entityRenderState) { + super.setupAnim(entityRenderState); - @Override - public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { for (int i = 0; i < this.bodyParts.length; i++) { - this.bodyParts[i].yRot = Mth.cos(ageInTicks * 0.9F + i * 0.15F * (float) Math.PI) * (float) Math.PI * 0.05F * (1 + Math.abs(i - 2)); - this.bodyParts[i].x = Mth.sin(ageInTicks * 0.9F + i * 0.15F * (float) Math.PI) * (float) Math.PI * 0.2F * Math.abs(i - 2); + this.bodyParts[i].yRot = Mth.cos(entityRenderState.ageInTicks * 0.9F + i * 0.15F * (float) Math.PI) * (float) Math.PI * 0.05F * (1 + Math.abs(i - 2)); + this.bodyParts[i].x = Mth.sin(entityRenderState.ageInTicks * 0.9F + i * 0.15F * (float) Math.PI) * (float) Math.PI * 0.2F * Math.abs(i - 2); } this.bodyLayers[0].yRot = this.bodyParts[2].yRot; diff --git a/net/minecraft/client/model/SkeletonModel.java b/net/minecraft/client/model/SkeletonModel.java index e2f4092d..c06d3640 100644 --- a/net/minecraft/client/model/SkeletonModel.java +++ b/net/minecraft/client/model/SkeletonModel.java @@ -10,16 +10,14 @@ import net.minecraft.client.model.geom.builders.CubeListBuilder; import net.minecraft.client.model.geom.builders.LayerDefinition; import net.minecraft.client.model.geom.builders.MeshDefinition; import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.client.renderer.entity.state.SkeletonRenderState; import net.minecraft.util.Mth; -import net.minecraft.world.InteractionHand; import net.minecraft.world.entity.HumanoidArm; -import net.minecraft.world.entity.Mob; -import net.minecraft.world.entity.monster.RangedAttackMob; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; @Environment(EnvType.CLIENT) -public class SkeletonModel extends HumanoidModel { +public class SkeletonModel extends HumanoidModel { public SkeletonModel(ModelPart root) { super(root); } @@ -46,44 +44,34 @@ public class SkeletonModel extends HumanoidMode ); } - public void prepareMobModel(T entity, float limbSwing, float limbSwingAmount, float partialTick) { - this.rightArmPose = HumanoidModel.ArmPose.EMPTY; - this.leftArmPose = HumanoidModel.ArmPose.EMPTY; - ItemStack itemStack = entity.getItemInHand(InteractionHand.MAIN_HAND); - if (itemStack.is(Items.BOW) && entity.isAggressive()) { - if (entity.getMainArm() == HumanoidArm.RIGHT) { - this.rightArmPose = HumanoidModel.ArmPose.BOW_AND_ARROW; - } else { - this.leftArmPose = HumanoidModel.ArmPose.BOW_AND_ARROW; - } - } - - super.prepareMobModel(entity, limbSwing, limbSwingAmount, partialTick); + protected HumanoidModel.ArmPose getArmPose(S skeletonRenderState, HumanoidArm humanoidArm) { + return skeletonRenderState.getMainHandItem().is(Items.BOW) && skeletonRenderState.isAggressive && skeletonRenderState.mainArm == humanoidArm + ? HumanoidModel.ArmPose.BOW_AND_ARROW + : HumanoidModel.ArmPose.EMPTY; } - /** - * Sets this entity's model rotation angles - */ - public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { - super.setupAnim(entity, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch); - ItemStack itemStack = entity.getMainHandItem(); - if (entity.isAggressive() && (itemStack.isEmpty() || !itemStack.is(Items.BOW))) { - float f = Mth.sin(this.attackTime * (float) Math.PI); - float g = Mth.sin((1.0F - (1.0F - this.attackTime) * (1.0F - this.attackTime)) * (float) Math.PI); + public void setupAnim(S skeletonRenderState) { + super.setupAnim(skeletonRenderState); + ItemStack itemStack = skeletonRenderState.getMainHandItem(); + if (skeletonRenderState.isAggressive && !itemStack.is(Items.BOW)) { + float f = skeletonRenderState.attackTime; + float g = Mth.sin(f * (float) Math.PI); + float h = Mth.sin((1.0F - (1.0F - f) * (1.0F - f)) * (float) Math.PI); this.rightArm.zRot = 0.0F; this.leftArm.zRot = 0.0F; - this.rightArm.yRot = -(0.1F - f * 0.6F); - this.leftArm.yRot = 0.1F - f * 0.6F; + this.rightArm.yRot = -(0.1F - g * 0.6F); + this.leftArm.yRot = 0.1F - g * 0.6F; this.rightArm.xRot = (float) (-Math.PI / 2); this.leftArm.xRot = (float) (-Math.PI / 2); - this.rightArm.xRot -= f * 1.2F - g * 0.4F; - this.leftArm.xRot -= f * 1.2F - g * 0.4F; - AnimationUtils.bobArms(this.rightArm, this.leftArm, ageInTicks); + this.rightArm.xRot -= g * 1.2F - h * 0.4F; + this.leftArm.xRot -= g * 1.2F - h * 0.4F; + AnimationUtils.bobArms(this.rightArm, this.leftArm, skeletonRenderState.ageInTicks); } } @Override public void translateToHand(HumanoidArm side, PoseStack poseStack) { + this.root().translateAndRotate(poseStack); float f = side == HumanoidArm.RIGHT ? 1.0F : -1.0F; ModelPart modelPart = this.getArm(side); modelPart.x += f; diff --git a/net/minecraft/client/model/SkullModel.java b/net/minecraft/client/model/SkullModel.java index 0c0c0386..ca5338fe 100644 --- a/net/minecraft/client/model/SkullModel.java +++ b/net/minecraft/client/model/SkullModel.java @@ -1,7 +1,5 @@ package net.minecraft.client.model; -import com.mojang.blaze3d.vertex.PoseStack; -import com.mojang.blaze3d.vertex.VertexConsumer; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.model.geom.ModelPart; @@ -14,11 +12,10 @@ import net.minecraft.client.model.geom.builders.PartDefinition; @Environment(EnvType.CLIENT) public class SkullModel extends SkullModelBase { - private final ModelPart root; protected final ModelPart head; public SkullModel(ModelPart root) { - this.root = root; + super(root); this.head = root.getChild("head"); } @@ -47,9 +44,4 @@ public class SkullModel extends SkullModelBase { this.head.yRot = yRot * (float) (Math.PI / 180.0); this.head.xRot = xRot * (float) (Math.PI / 180.0); } - - @Override - public void renderToBuffer(PoseStack poseStack, VertexConsumer buffer, int packedLight, int packedOverlay, int color) { - this.root.render(poseStack, buffer, packedLight, packedOverlay, color); - } } diff --git a/net/minecraft/client/model/SkullModelBase.java b/net/minecraft/client/model/SkullModelBase.java index 7fe137e3..732a3544 100644 --- a/net/minecraft/client/model/SkullModelBase.java +++ b/net/minecraft/client/model/SkullModelBase.java @@ -2,12 +2,13 @@ package net.minecraft.client.model; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; +import net.minecraft.client.model.geom.ModelPart; import net.minecraft.client.renderer.RenderType; @Environment(EnvType.CLIENT) public abstract class SkullModelBase extends Model { - public SkullModelBase() { - super(RenderType::entityTranslucent); + public SkullModelBase(ModelPart modelPart) { + super(modelPart, RenderType::entityTranslucent); } public abstract void setupAnim(float mouthAnimation, float yRot, float xRot); diff --git a/net/minecraft/client/model/SlimeModel.java b/net/minecraft/client/model/SlimeModel.java index a731b64f..7f131bbd 100644 --- a/net/minecraft/client/model/SlimeModel.java +++ b/net/minecraft/client/model/SlimeModel.java @@ -8,14 +8,12 @@ import net.minecraft.client.model.geom.builders.CubeListBuilder; import net.minecraft.client.model.geom.builders.LayerDefinition; import net.minecraft.client.model.geom.builders.MeshDefinition; import net.minecraft.client.model.geom.builders.PartDefinition; -import net.minecraft.world.entity.Entity; +import net.minecraft.client.renderer.entity.state.EntityRenderState; @Environment(EnvType.CLIENT) -public class SlimeModel extends HierarchicalModel { - private final ModelPart root; - +public class SlimeModel extends EntityModel { public SlimeModel(ModelPart root) { - this.root = root; + super(root); } public static LayerDefinition createOuterBodyLayer() { @@ -34,13 +32,4 @@ public class SlimeModel extends HierarchicalModel { partDefinition.addOrReplaceChild("mouth", CubeListBuilder.create().texOffs(32, 8).addBox(0.0F, 21.0F, -3.5F, 1.0F, 1.0F, 1.0F), PartPose.ZERO); return LayerDefinition.create(meshDefinition, 64, 32); } - - @Override - public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { - } - - @Override - public ModelPart root() { - return this.root; - } } diff --git a/net/minecraft/client/model/SnifferModel.java b/net/minecraft/client/model/SnifferModel.java index acec9d05..d1088359 100644 --- a/net/minecraft/client/model/SnifferModel.java +++ b/net/minecraft/client/model/SnifferModel.java @@ -9,26 +9,26 @@ import net.minecraft.client.model.geom.builders.CubeDeformation; import net.minecraft.client.model.geom.builders.CubeListBuilder; import net.minecraft.client.model.geom.builders.LayerDefinition; import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.MeshTransformer; import net.minecraft.client.model.geom.builders.PartDefinition; -import net.minecraft.world.entity.animal.sniffer.Sniffer; +import net.minecraft.client.renderer.entity.state.SnifferRenderState; @Environment(EnvType.CLIENT) -public class SnifferModel extends AgeableHierarchicalModel { +public class SnifferModel extends EntityModel { + public static final MeshTransformer BABY_TRANSFORMER = MeshTransformer.scaling(0.5F); private static final float WALK_ANIMATION_SPEED_MAX = 9.0F; private static final float WALK_ANIMATION_SCALE_FACTOR = 100.0F; - private final ModelPart root; private final ModelPart head; public SnifferModel(ModelPart root) { - super(0.5F, 24.0F); - this.root = root.getChild("root"); - this.head = this.root.getChild("bone").getChild("body").getChild("head"); + super(root); + this.head = root.getChild("bone").getChild("body").getChild("head"); } public static LayerDefinition createBodyLayer() { MeshDefinition meshDefinition = new MeshDefinition(); - PartDefinition partDefinition = meshDefinition.getRoot().addOrReplaceChild("root", CubeListBuilder.create(), PartPose.offset(0.0F, 5.0F, 0.0F)); - PartDefinition partDefinition2 = partDefinition.addOrReplaceChild("bone", CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + PartDefinition partDefinition = meshDefinition.getRoot(); + PartDefinition partDefinition2 = partDefinition.addOrReplaceChild("bone", CubeListBuilder.create(), PartPose.offset(0.0F, 5.0F, 0.0F)); PartDefinition partDefinition3 = partDefinition2.addOrReplaceChild( "body", CubeListBuilder.create() @@ -102,31 +102,23 @@ public class SnifferModel extends AgeableHierarchicalModel return LayerDefinition.create(meshDefinition, 192, 192); } - /** - * Sets this entity's model rotation angles - */ - public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { - this.root().getAllParts().forEach(ModelPart::resetPose); - this.head.xRot = headPitch * (float) (Math.PI / 180.0); - this.head.yRot = netHeadYaw * (float) (Math.PI / 180.0); - if (entity.isSearching()) { - this.animateWalk(SnifferAnimation.SNIFFER_SNIFF_SEARCH, limbSwing, limbSwingAmount, 9.0F, 100.0F); + public void setupAnim(SnifferRenderState snifferRenderState) { + super.setupAnim(snifferRenderState); + this.head.xRot = snifferRenderState.xRot * (float) (Math.PI / 180.0); + this.head.yRot = snifferRenderState.yRot * (float) (Math.PI / 180.0); + if (snifferRenderState.isSearching) { + this.animateWalk(SnifferAnimation.SNIFFER_SNIFF_SEARCH, snifferRenderState.walkAnimationPos, snifferRenderState.walkAnimationSpeed, 9.0F, 100.0F); } else { - this.animateWalk(SnifferAnimation.SNIFFER_WALK, limbSwing, limbSwingAmount, 9.0F, 100.0F); + this.animateWalk(SnifferAnimation.SNIFFER_WALK, snifferRenderState.walkAnimationPos, snifferRenderState.walkAnimationSpeed, 9.0F, 100.0F); } - this.animate(entity.diggingAnimationState, SnifferAnimation.SNIFFER_DIG, ageInTicks); - this.animate(entity.sniffingAnimationState, SnifferAnimation.SNIFFER_LONGSNIFF, ageInTicks); - this.animate(entity.risingAnimationState, SnifferAnimation.SNIFFER_STAND_UP, ageInTicks); - this.animate(entity.feelingHappyAnimationState, SnifferAnimation.SNIFFER_HAPPY, ageInTicks); - this.animate(entity.scentingAnimationState, SnifferAnimation.SNIFFER_SNIFFSNIFF, ageInTicks); - if (this.young) { + this.animate(snifferRenderState.diggingAnimationState, SnifferAnimation.SNIFFER_DIG, snifferRenderState.ageInTicks); + this.animate(snifferRenderState.sniffingAnimationState, SnifferAnimation.SNIFFER_LONGSNIFF, snifferRenderState.ageInTicks); + this.animate(snifferRenderState.risingAnimationState, SnifferAnimation.SNIFFER_STAND_UP, snifferRenderState.ageInTicks); + this.animate(snifferRenderState.feelingHappyAnimationState, SnifferAnimation.SNIFFER_HAPPY, snifferRenderState.ageInTicks); + this.animate(snifferRenderState.scentingAnimationState, SnifferAnimation.SNIFFER_SNIFFSNIFF, snifferRenderState.ageInTicks); + if (snifferRenderState.isBaby) { this.applyStatic(SnifferAnimation.BABY_TRANSFORM); } } - - @Override - public ModelPart root() { - return this.root; - } } diff --git a/net/minecraft/client/model/SnowGolemModel.java b/net/minecraft/client/model/SnowGolemModel.java index 5d6183fd..cf459cc0 100644 --- a/net/minecraft/client/model/SnowGolemModel.java +++ b/net/minecraft/client/model/SnowGolemModel.java @@ -9,20 +9,19 @@ import net.minecraft.client.model.geom.builders.CubeListBuilder; import net.minecraft.client.model.geom.builders.LayerDefinition; import net.minecraft.client.model.geom.builders.MeshDefinition; import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.client.renderer.entity.state.LivingEntityRenderState; import net.minecraft.util.Mth; -import net.minecraft.world.entity.Entity; @Environment(EnvType.CLIENT) -public class SnowGolemModel extends HierarchicalModel { +public class SnowGolemModel extends EntityModel { private static final String UPPER_BODY = "upper_body"; - private final ModelPart root; private final ModelPart upperBody; private final ModelPart head; private final ModelPart leftArm; private final ModelPart rightArm; public SnowGolemModel(ModelPart root) { - this.root = root; + super(root); this.head = root.getChild("head"); this.leftArm = root.getChild("left_arm"); this.rightArm = root.getChild("right_arm"); @@ -49,11 +48,11 @@ public class SnowGolemModel extends HierarchicalModel { return LayerDefinition.create(meshDefinition, 64, 64); } - @Override - public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { - this.head.yRot = netHeadYaw * (float) (Math.PI / 180.0); - this.head.xRot = headPitch * (float) (Math.PI / 180.0); - this.upperBody.yRot = netHeadYaw * (float) (Math.PI / 180.0) * 0.25F; + public void setupAnim(LivingEntityRenderState livingEntityRenderState) { + super.setupAnim(livingEntityRenderState); + this.head.yRot = livingEntityRenderState.yRot * (float) (Math.PI / 180.0); + this.head.xRot = livingEntityRenderState.xRot * (float) (Math.PI / 180.0); + this.upperBody.yRot = livingEntityRenderState.yRot * (float) (Math.PI / 180.0) * 0.25F; float f = Mth.sin(this.upperBody.yRot); float g = Mth.cos(this.upperBody.yRot); this.leftArm.yRot = this.upperBody.yRot; @@ -64,11 +63,6 @@ public class SnowGolemModel extends HierarchicalModel { this.rightArm.z = f * 5.0F; } - @Override - public ModelPart root() { - return this.root; - } - public ModelPart getHead() { return this.head; } diff --git a/net/minecraft/client/model/SpiderModel.java b/net/minecraft/client/model/SpiderModel.java index 72cf480a..c659d70a 100644 --- a/net/minecraft/client/model/SpiderModel.java +++ b/net/minecraft/client/model/SpiderModel.java @@ -8,18 +8,17 @@ import net.minecraft.client.model.geom.builders.CubeListBuilder; import net.minecraft.client.model.geom.builders.LayerDefinition; import net.minecraft.client.model.geom.builders.MeshDefinition; import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.client.renderer.entity.state.LivingEntityRenderState; import net.minecraft.util.Mth; -import net.minecraft.world.entity.Entity; @Environment(EnvType.CLIENT) -public class SpiderModel extends HierarchicalModel { +public class SpiderModel extends EntityModel { private static final String BODY_0 = "body0"; private static final String BODY_1 = "body1"; private static final String RIGHT_MIDDLE_FRONT_LEG = "right_middle_front_leg"; private static final String LEFT_MIDDLE_FRONT_LEG = "left_middle_front_leg"; private static final String RIGHT_MIDDLE_HIND_LEG = "right_middle_hind_leg"; private static final String LEFT_MIDDLE_HIND_LEG = "left_middle_hind_leg"; - private final ModelPart root; private final ModelPart head; private final ModelPart rightHindLeg; private final ModelPart leftHindLeg; @@ -31,7 +30,7 @@ public class SpiderModel extends HierarchicalModel { private final ModelPart leftFrontLeg; public SpiderModel(ModelPart root) { - this.root = root; + super(root); this.head = root.getChild("head"); this.rightHindLeg = root.getChild("right_hind_leg"); this.leftHindLeg = root.getChild("left_hind_leg"); @@ -58,68 +57,64 @@ public class SpiderModel extends HierarchicalModel { ); CubeListBuilder cubeListBuilder = CubeListBuilder.create().texOffs(18, 0).addBox(-15.0F, -1.0F, -1.0F, 16.0F, 2.0F, 2.0F); CubeListBuilder cubeListBuilder2 = CubeListBuilder.create().texOffs(18, 0).mirror().addBox(-1.0F, -1.0F, -1.0F, 16.0F, 2.0F, 2.0F); - partDefinition.addOrReplaceChild("right_hind_leg", cubeListBuilder, PartPose.offset(-4.0F, 15.0F, 2.0F)); - partDefinition.addOrReplaceChild("left_hind_leg", cubeListBuilder2, PartPose.offset(4.0F, 15.0F, 2.0F)); - partDefinition.addOrReplaceChild("right_middle_hind_leg", cubeListBuilder, PartPose.offset(-4.0F, 15.0F, 1.0F)); - partDefinition.addOrReplaceChild("left_middle_hind_leg", cubeListBuilder2, PartPose.offset(4.0F, 15.0F, 1.0F)); - partDefinition.addOrReplaceChild("right_middle_front_leg", cubeListBuilder, PartPose.offset(-4.0F, 15.0F, 0.0F)); - partDefinition.addOrReplaceChild("left_middle_front_leg", cubeListBuilder2, PartPose.offset(4.0F, 15.0F, 0.0F)); - partDefinition.addOrReplaceChild("right_front_leg", cubeListBuilder, PartPose.offset(-4.0F, 15.0F, -1.0F)); - partDefinition.addOrReplaceChild("left_front_leg", cubeListBuilder2, PartPose.offset(4.0F, 15.0F, -1.0F)); + float f = (float) (Math.PI / 4); + float g = (float) (Math.PI / 8); + partDefinition.addOrReplaceChild( + "right_hind_leg", cubeListBuilder, PartPose.offsetAndRotation(-4.0F, 15.0F, 2.0F, 0.0F, (float) (Math.PI / 4), (float) (-Math.PI / 4)) + ); + partDefinition.addOrReplaceChild( + "left_hind_leg", cubeListBuilder2, PartPose.offsetAndRotation(4.0F, 15.0F, 2.0F, 0.0F, (float) (-Math.PI / 4), (float) (Math.PI / 4)) + ); + partDefinition.addOrReplaceChild( + "right_middle_hind_leg", cubeListBuilder, PartPose.offsetAndRotation(-4.0F, 15.0F, 1.0F, 0.0F, (float) (Math.PI / 8), -0.58119464F) + ); + partDefinition.addOrReplaceChild( + "left_middle_hind_leg", cubeListBuilder2, PartPose.offsetAndRotation(4.0F, 15.0F, 1.0F, 0.0F, (float) (-Math.PI / 8), 0.58119464F) + ); + partDefinition.addOrReplaceChild( + "right_middle_front_leg", cubeListBuilder, PartPose.offsetAndRotation(-4.0F, 15.0F, 0.0F, 0.0F, (float) (-Math.PI / 8), -0.58119464F) + ); + partDefinition.addOrReplaceChild( + "left_middle_front_leg", cubeListBuilder2, PartPose.offsetAndRotation(4.0F, 15.0F, 0.0F, 0.0F, (float) (Math.PI / 8), 0.58119464F) + ); + partDefinition.addOrReplaceChild( + "right_front_leg", cubeListBuilder, PartPose.offsetAndRotation(-4.0F, 15.0F, -1.0F, 0.0F, (float) (-Math.PI / 4), (float) (-Math.PI / 4)) + ); + partDefinition.addOrReplaceChild( + "left_front_leg", cubeListBuilder2, PartPose.offsetAndRotation(4.0F, 15.0F, -1.0F, 0.0F, (float) (Math.PI / 4), (float) (Math.PI / 4)) + ); return LayerDefinition.create(meshDefinition, 64, 32); } - @Override - public ModelPart root() { - return this.root; - } - - @Override - public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { - this.head.yRot = netHeadYaw * (float) (Math.PI / 180.0); - this.head.xRot = headPitch * (float) (Math.PI / 180.0); - float f = (float) (Math.PI / 4); - this.rightHindLeg.zRot = (float) (-Math.PI / 4); - this.leftHindLeg.zRot = (float) (Math.PI / 4); - this.rightMiddleHindLeg.zRot = -0.58119464F; - this.leftMiddleHindLeg.zRot = 0.58119464F; - this.rightMiddleFrontLeg.zRot = -0.58119464F; - this.leftMiddleFrontLeg.zRot = 0.58119464F; - this.rightFrontLeg.zRot = (float) (-Math.PI / 4); - this.leftFrontLeg.zRot = (float) (Math.PI / 4); - float g = -0.0F; - float h = (float) (Math.PI / 8); - this.rightHindLeg.yRot = (float) (Math.PI / 4); - this.leftHindLeg.yRot = (float) (-Math.PI / 4); - this.rightMiddleHindLeg.yRot = (float) (Math.PI / 8); - this.leftMiddleHindLeg.yRot = (float) (-Math.PI / 8); - this.rightMiddleFrontLeg.yRot = (float) (-Math.PI / 8); - this.leftMiddleFrontLeg.yRot = (float) (Math.PI / 8); - this.rightFrontLeg.yRot = (float) (-Math.PI / 4); - this.leftFrontLeg.yRot = (float) (Math.PI / 4); - float i = -(Mth.cos(limbSwing * 0.6662F * 2.0F + 0.0F) * 0.4F) * limbSwingAmount; - float j = -(Mth.cos(limbSwing * 0.6662F * 2.0F + (float) Math.PI) * 0.4F) * limbSwingAmount; - float k = -(Mth.cos(limbSwing * 0.6662F * 2.0F + (float) (Math.PI / 2)) * 0.4F) * limbSwingAmount; - float l = -(Mth.cos(limbSwing * 0.6662F * 2.0F + (float) (Math.PI * 3.0 / 2.0)) * 0.4F) * limbSwingAmount; - float m = Math.abs(Mth.sin(limbSwing * 0.6662F + 0.0F) * 0.4F) * limbSwingAmount; - float n = Math.abs(Mth.sin(limbSwing * 0.6662F + (float) Math.PI) * 0.4F) * limbSwingAmount; - float o = Math.abs(Mth.sin(limbSwing * 0.6662F + (float) (Math.PI / 2)) * 0.4F) * limbSwingAmount; - float p = Math.abs(Mth.sin(limbSwing * 0.6662F + (float) (Math.PI * 3.0 / 2.0)) * 0.4F) * limbSwingAmount; - this.rightHindLeg.yRot += i; - this.leftHindLeg.yRot += -i; - this.rightMiddleHindLeg.yRot += j; - this.leftMiddleHindLeg.yRot += -j; - this.rightMiddleFrontLeg.yRot += k; - this.leftMiddleFrontLeg.yRot += -k; - this.rightFrontLeg.yRot += l; - this.leftFrontLeg.yRot += -l; - this.rightHindLeg.zRot += m; - this.leftHindLeg.zRot += -m; - this.rightMiddleHindLeg.zRot += n; - this.leftMiddleHindLeg.zRot += -n; - this.rightMiddleFrontLeg.zRot += o; - this.leftMiddleFrontLeg.zRot += -o; - this.rightFrontLeg.zRot += p; - this.leftFrontLeg.zRot += -p; + public void setupAnim(LivingEntityRenderState livingEntityRenderState) { + super.setupAnim(livingEntityRenderState); + this.head.yRot = livingEntityRenderState.yRot * (float) (Math.PI / 180.0); + this.head.xRot = livingEntityRenderState.xRot * (float) (Math.PI / 180.0); + float f = livingEntityRenderState.walkAnimationPos * 0.6662F; + float g = livingEntityRenderState.walkAnimationSpeed; + float h = -(Mth.cos(f * 2.0F + 0.0F) * 0.4F) * g; + float i = -(Mth.cos(f * 2.0F + (float) Math.PI) * 0.4F) * g; + float j = -(Mth.cos(f * 2.0F + (float) (Math.PI / 2)) * 0.4F) * g; + float k = -(Mth.cos(f * 2.0F + (float) (Math.PI * 3.0 / 2.0)) * 0.4F) * g; + float l = Math.abs(Mth.sin(f + 0.0F) * 0.4F) * g; + float m = Math.abs(Mth.sin(f + (float) Math.PI) * 0.4F) * g; + float n = Math.abs(Mth.sin(f + (float) (Math.PI / 2)) * 0.4F) * g; + float o = Math.abs(Mth.sin(f + (float) (Math.PI * 3.0 / 2.0)) * 0.4F) * g; + this.rightHindLeg.yRot += h; + this.leftHindLeg.yRot -= h; + this.rightMiddleHindLeg.yRot += i; + this.leftMiddleHindLeg.yRot -= i; + this.rightMiddleFrontLeg.yRot += j; + this.leftMiddleFrontLeg.yRot -= j; + this.rightFrontLeg.yRot += k; + this.leftFrontLeg.yRot -= k; + this.rightHindLeg.zRot += l; + this.leftHindLeg.zRot -= l; + this.rightMiddleHindLeg.zRot += m; + this.leftMiddleHindLeg.zRot -= m; + this.rightMiddleFrontLeg.zRot += n; + this.leftMiddleFrontLeg.zRot -= n; + this.rightFrontLeg.zRot += o; + this.leftFrontLeg.zRot -= o; } } diff --git a/net/minecraft/client/model/SpinAttackEffectModel.java b/net/minecraft/client/model/SpinAttackEffectModel.java new file mode 100644 index 00000000..efcd7780 --- /dev/null +++ b/net/minecraft/client/model/SpinAttackEffectModel.java @@ -0,0 +1,54 @@ +package net.minecraft.client.model; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.client.renderer.entity.state.PlayerRenderState; +import net.minecraft.util.Mth; + +@Environment(EnvType.CLIENT) +public class SpinAttackEffectModel extends EntityModel { + private static final int BOX_COUNT = 2; + private final ModelPart[] boxes = new ModelPart[2]; + + public SpinAttackEffectModel(ModelPart modelPart) { + super(modelPart); + + for (int i = 0; i < 2; i++) { + this.boxes[i] = modelPart.getChild(boxName(i)); + } + } + + private static String boxName(int i) { + return "box" + i; + } + + public static LayerDefinition createLayer() { + MeshDefinition meshDefinition = new MeshDefinition(); + PartDefinition partDefinition = meshDefinition.getRoot(); + + for (int i = 0; i < 2; i++) { + float f = -3.2F + 9.6F * (i + 1); + float g = 0.75F * (i + 1); + partDefinition.addOrReplaceChild( + boxName(i), CubeListBuilder.create().texOffs(0, 0).addBox(-8.0F, -16.0F + f, -8.0F, 16.0F, 32.0F, 16.0F), PartPose.ZERO.withScale(g) + ); + } + + return LayerDefinition.create(meshDefinition, 64, 64); + } + + public void setupAnim(PlayerRenderState playerRenderState) { + super.setupAnim(playerRenderState); + + for (int i = 0; i < this.boxes.length; i++) { + float f = playerRenderState.ageInTicks * -(45 + (i + 1) * 5); + this.boxes[i].yRot = Mth.wrapDegrees(f) * (float) (Math.PI / 180.0); + } + } +} diff --git a/net/minecraft/client/model/SquidModel.java b/net/minecraft/client/model/SquidModel.java index c7385876..e4bba421 100644 --- a/net/minecraft/client/model/SquidModel.java +++ b/net/minecraft/client/model/SquidModel.java @@ -9,16 +9,17 @@ import net.minecraft.client.model.geom.builders.CubeDeformation; import net.minecraft.client.model.geom.builders.CubeListBuilder; import net.minecraft.client.model.geom.builders.LayerDefinition; import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.MeshTransformer; import net.minecraft.client.model.geom.builders.PartDefinition; -import net.minecraft.world.entity.Entity; +import net.minecraft.client.renderer.entity.state.SquidRenderState; @Environment(EnvType.CLIENT) -public class SquidModel extends HierarchicalModel { +public class SquidModel extends EntityModel { + public static final MeshTransformer BABY_TRANSFORMER = MeshTransformer.scaling(0.5F); private final ModelPart[] tentacles = new ModelPart[8]; - private final ModelPart root; public SquidModel(ModelPart root) { - this.root = root; + super(root); Arrays.setAll(this.tentacles, i -> root.getChild(createTentacleName(i))); } @@ -50,15 +51,11 @@ public class SquidModel extends HierarchicalModel { return LayerDefinition.create(meshDefinition, 64, 32); } - @Override - public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { + public void setupAnim(SquidRenderState squidRenderState) { + super.setupAnim(squidRenderState); + for (ModelPart modelPart : this.tentacles) { - modelPart.xRot = ageInTicks; + modelPart.xRot = squidRenderState.tentacleAngle; } } - - @Override - public ModelPart root() { - return this.root; - } } diff --git a/net/minecraft/client/model/StriderModel.java b/net/minecraft/client/model/StriderModel.java index 4d40101b..a274122a 100644 --- a/net/minecraft/client/model/StriderModel.java +++ b/net/minecraft/client/model/StriderModel.java @@ -8,18 +8,17 @@ import net.minecraft.client.model.geom.builders.CubeListBuilder; import net.minecraft.client.model.geom.builders.LayerDefinition; import net.minecraft.client.model.geom.builders.MeshDefinition; import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.client.renderer.entity.state.StriderRenderState; import net.minecraft.util.Mth; -import net.minecraft.world.entity.monster.Strider; @Environment(EnvType.CLIENT) -public class StriderModel extends HierarchicalModel { +public class StriderModel extends EntityModel { private static final String RIGHT_BOTTOM_BRISTLE = "right_bottom_bristle"; private static final String RIGHT_MIDDLE_BRISTLE = "right_middle_bristle"; private static final String RIGHT_TOP_BRISTLE = "right_top_bristle"; private static final String LEFT_TOP_BRISTLE = "left_top_bristle"; private static final String LEFT_MIDDLE_BRISTLE = "left_middle_bristle"; private static final String LEFT_BOTTOM_BRISTLE = "left_bottom_bristle"; - private final ModelPart root; private final ModelPart rightLeg; private final ModelPart leftLeg; private final ModelPart body; @@ -31,7 +30,7 @@ public class StriderModel extends HierarchicalModel { private final ModelPart leftBottomBristle; public StriderModel(ModelPart root) { - this.root = root; + super(root); this.rightLeg = root.getChild("right_leg"); this.leftLeg = root.getChild("left_leg"); this.body = root.getChild("body"); @@ -88,54 +87,48 @@ public class StriderModel extends HierarchicalModel { return LayerDefinition.create(meshDefinition, 64, 128); } - /** - * Sets this entity's model rotation angles - */ - public void setupAnim(Strider entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { - limbSwingAmount = Math.min(0.25F, limbSwingAmount); - if (!entity.isVehicle()) { - this.body.xRot = headPitch * (float) (Math.PI / 180.0); - this.body.yRot = netHeadYaw * (float) (Math.PI / 180.0); + public void setupAnim(StriderRenderState striderRenderState) { + super.setupAnim(striderRenderState); + float f = striderRenderState.walkAnimationPos; + float g = Math.min(striderRenderState.walkAnimationSpeed, 0.25F); + if (!striderRenderState.isRidden) { + this.body.xRot = striderRenderState.xRot * (float) (Math.PI / 180.0); + this.body.yRot = striderRenderState.yRot * (float) (Math.PI / 180.0); } else { this.body.xRot = 0.0F; this.body.yRot = 0.0F; } - float f = 1.5F; - this.body.zRot = 0.1F * Mth.sin(limbSwing * 1.5F) * 4.0F * limbSwingAmount; + float h = 1.5F; + this.body.zRot = 0.1F * Mth.sin(f * 1.5F) * 4.0F * g; this.body.y = 2.0F; - this.body.y = this.body.y - 2.0F * Mth.cos(limbSwing * 1.5F) * 2.0F * limbSwingAmount; - this.leftLeg.xRot = Mth.sin(limbSwing * 1.5F * 0.5F) * 2.0F * limbSwingAmount; - this.rightLeg.xRot = Mth.sin(limbSwing * 1.5F * 0.5F + (float) Math.PI) * 2.0F * limbSwingAmount; - this.leftLeg.zRot = (float) (Math.PI / 18) * Mth.cos(limbSwing * 1.5F * 0.5F) * limbSwingAmount; - this.rightLeg.zRot = (float) (Math.PI / 18) * Mth.cos(limbSwing * 1.5F * 0.5F + (float) Math.PI) * limbSwingAmount; - this.leftLeg.y = 8.0F + 2.0F * Mth.sin(limbSwing * 1.5F * 0.5F + (float) Math.PI) * 2.0F * limbSwingAmount; - this.rightLeg.y = 8.0F + 2.0F * Mth.sin(limbSwing * 1.5F * 0.5F) * 2.0F * limbSwingAmount; + this.body.y = this.body.y - 2.0F * Mth.cos(f * 1.5F) * 2.0F * g; + this.leftLeg.xRot = Mth.sin(f * 1.5F * 0.5F) * 2.0F * g; + this.rightLeg.xRot = Mth.sin(f * 1.5F * 0.5F + (float) Math.PI) * 2.0F * g; + this.leftLeg.zRot = (float) (Math.PI / 18) * Mth.cos(f * 1.5F * 0.5F) * g; + this.rightLeg.zRot = (float) (Math.PI / 18) * Mth.cos(f * 1.5F * 0.5F + (float) Math.PI) * g; + this.leftLeg.y = 8.0F + 2.0F * Mth.sin(f * 1.5F * 0.5F + (float) Math.PI) * 2.0F * g; + this.rightLeg.y = 8.0F + 2.0F * Mth.sin(f * 1.5F * 0.5F) * 2.0F * g; this.rightBottomBristle.zRot = -1.2217305F; this.rightMiddleBristle.zRot = -1.134464F; this.rightTopBristle.zRot = -0.87266463F; this.leftTopBristle.zRot = 0.87266463F; this.leftMiddleBristle.zRot = 1.134464F; this.leftBottomBristle.zRot = 1.2217305F; - float g = Mth.cos(limbSwing * 1.5F + (float) Math.PI) * limbSwingAmount; - this.rightBottomBristle.zRot += g * 1.3F; - this.rightMiddleBristle.zRot += g * 1.2F; - this.rightTopBristle.zRot += g * 0.6F; - this.leftTopBristle.zRot += g * 0.6F; - this.leftMiddleBristle.zRot += g * 1.2F; - this.leftBottomBristle.zRot += g * 1.3F; - float h = 1.0F; - float i = 1.0F; - this.rightBottomBristle.zRot = this.rightBottomBristle.zRot + 0.05F * Mth.sin(ageInTicks * 1.0F * -0.4F); - this.rightMiddleBristle.zRot = this.rightMiddleBristle.zRot + 0.1F * Mth.sin(ageInTicks * 1.0F * 0.2F); - this.rightTopBristle.zRot = this.rightTopBristle.zRot + 0.1F * Mth.sin(ageInTicks * 1.0F * 0.4F); - this.leftTopBristle.zRot = this.leftTopBristle.zRot + 0.1F * Mth.sin(ageInTicks * 1.0F * 0.4F); - this.leftMiddleBristle.zRot = this.leftMiddleBristle.zRot + 0.1F * Mth.sin(ageInTicks * 1.0F * 0.2F); - this.leftBottomBristle.zRot = this.leftBottomBristle.zRot + 0.05F * Mth.sin(ageInTicks * 1.0F * -0.4F); - } - - @Override - public ModelPart root() { - return this.root; + float i = Mth.cos(f * 1.5F + (float) Math.PI) * g; + this.rightBottomBristle.zRot += i * 1.3F; + this.rightMiddleBristle.zRot += i * 1.2F; + this.rightTopBristle.zRot += i * 0.6F; + this.leftTopBristle.zRot += i * 0.6F; + this.leftMiddleBristle.zRot += i * 1.2F; + this.leftBottomBristle.zRot += i * 1.3F; + float j = 1.0F; + float k = 1.0F; + this.rightBottomBristle.zRot = this.rightBottomBristle.zRot + 0.05F * Mth.sin(striderRenderState.ageInTicks * 1.0F * -0.4F); + this.rightMiddleBristle.zRot = this.rightMiddleBristle.zRot + 0.1F * Mth.sin(striderRenderState.ageInTicks * 1.0F * 0.2F); + this.rightTopBristle.zRot = this.rightTopBristle.zRot + 0.1F * Mth.sin(striderRenderState.ageInTicks * 1.0F * 0.4F); + this.leftTopBristle.zRot = this.leftTopBristle.zRot + 0.1F * Mth.sin(striderRenderState.ageInTicks * 1.0F * 0.4F); + this.leftMiddleBristle.zRot = this.leftMiddleBristle.zRot + 0.1F * Mth.sin(striderRenderState.ageInTicks * 1.0F * 0.2F); + this.leftBottomBristle.zRot = this.leftBottomBristle.zRot + 0.05F * Mth.sin(striderRenderState.ageInTicks * 1.0F * -0.4F); } } diff --git a/net/minecraft/client/model/TadpoleModel.java b/net/minecraft/client/model/TadpoleModel.java index d1a5963e..c429808e 100644 --- a/net/minecraft/client/model/TadpoleModel.java +++ b/net/minecraft/client/model/TadpoleModel.java @@ -1,6 +1,5 @@ package net.minecraft.client.model; -import com.google.common.collect.ImmutableList; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.model.geom.ModelPart; @@ -9,17 +8,16 @@ import net.minecraft.client.model.geom.builders.CubeListBuilder; import net.minecraft.client.model.geom.builders.LayerDefinition; import net.minecraft.client.model.geom.builders.MeshDefinition; import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.entity.state.LivingEntityRenderState; import net.minecraft.util.Mth; -import net.minecraft.world.entity.animal.frog.Tadpole; @Environment(EnvType.CLIENT) -public class TadpoleModel extends AgeableListModel { - private final ModelPart root; +public class TadpoleModel extends EntityModel { private final ModelPart tail; public TadpoleModel(ModelPart root) { - super(true, 8.0F, 3.35F); - this.root = root; + super(root, RenderType::entityCutoutNoCull); this.tail = root.getChild("tail"); } @@ -38,21 +36,9 @@ public class TadpoleModel extends AgeableListModel { return LayerDefinition.create(meshDefinition, 16, 16); } - @Override - protected Iterable headParts() { - return ImmutableList.of(this.root); - } - - @Override - protected Iterable bodyParts() { - return ImmutableList.of(this.tail); - } - - /** - * Sets this entity's model rotation angles - */ - public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { - float f = entity.isInWater() ? 1.0F : 1.5F; - this.tail.yRot = -f * 0.25F * Mth.sin(0.3F * ageInTicks); + public void setupAnim(LivingEntityRenderState livingEntityRenderState) { + super.setupAnim(livingEntityRenderState); + float f = livingEntityRenderState.isInWater ? 1.0F : 1.5F; + this.tail.yRot = -f * 0.25F * Mth.sin(0.3F * livingEntityRenderState.ageInTicks); } } diff --git a/net/minecraft/client/model/TridentModel.java b/net/minecraft/client/model/TridentModel.java index 8fdc2313..2fee9579 100644 --- a/net/minecraft/client/model/TridentModel.java +++ b/net/minecraft/client/model/TridentModel.java @@ -1,7 +1,5 @@ package net.minecraft.client.model; -import com.mojang.blaze3d.vertex.PoseStack; -import com.mojang.blaze3d.vertex.VertexConsumer; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.model.geom.ModelPart; @@ -16,11 +14,9 @@ import net.minecraft.resources.ResourceLocation; @Environment(EnvType.CLIENT) public class TridentModel extends Model { public static final ResourceLocation TEXTURE = ResourceLocation.withDefaultNamespace("textures/entity/trident.png"); - private final ModelPart root; public TridentModel(ModelPart root) { - super(RenderType::entitySolid); - this.root = root; + super(root, RenderType::entitySolid); } public static LayerDefinition createLayer() { @@ -35,9 +31,4 @@ public class TridentModel extends Model { partDefinition2.addOrReplaceChild("right_spike", CubeListBuilder.create().texOffs(4, 3).mirror().addBox(1.5F, -3.0F, -0.5F, 1.0F, 4.0F, 1.0F), PartPose.ZERO); return LayerDefinition.create(meshDefinition, 32, 32); } - - @Override - public void renderToBuffer(PoseStack poseStack, VertexConsumer buffer, int packedLight, int packedOverlay, int color) { - this.root.render(poseStack, buffer, packedLight, packedOverlay, color); - } } diff --git a/net/minecraft/client/model/TropicalFishModelA.java b/net/minecraft/client/model/TropicalFishModelA.java index c3c8d261..e43252be 100644 --- a/net/minecraft/client/model/TropicalFishModelA.java +++ b/net/minecraft/client/model/TropicalFishModelA.java @@ -9,16 +9,15 @@ import net.minecraft.client.model.geom.builders.CubeListBuilder; import net.minecraft.client.model.geom.builders.LayerDefinition; import net.minecraft.client.model.geom.builders.MeshDefinition; import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.client.renderer.entity.state.TropicalFishRenderState; import net.minecraft.util.Mth; -import net.minecraft.world.entity.Entity; @Environment(EnvType.CLIENT) -public class TropicalFishModelA extends ColorableHierarchicalModel { - private final ModelPart root; +public class TropicalFishModelA extends EntityModel { private final ModelPart tail; public TropicalFishModelA(ModelPart root) { - this.root = root; + super(root); this.tail = root.getChild("tail"); } @@ -48,18 +47,9 @@ public class TropicalFishModelA extends ColorableHierarchicalM return LayerDefinition.create(meshDefinition, 32, 32); } - @Override - public ModelPart root() { - return this.root; - } - - @Override - public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { - float f = 1.0F; - if (!entity.isInWater()) { - f = 1.5F; - } - - this.tail.yRot = -f * 0.45F * Mth.sin(0.6F * ageInTicks); + public void setupAnim(TropicalFishRenderState tropicalFishRenderState) { + super.setupAnim(tropicalFishRenderState); + float f = tropicalFishRenderState.isInWater ? 1.0F : 1.5F; + this.tail.yRot = -f * 0.45F * Mth.sin(0.6F * tropicalFishRenderState.ageInTicks); } } diff --git a/net/minecraft/client/model/TropicalFishModelB.java b/net/minecraft/client/model/TropicalFishModelB.java index 70b42798..6e5f0ea2 100644 --- a/net/minecraft/client/model/TropicalFishModelB.java +++ b/net/minecraft/client/model/TropicalFishModelB.java @@ -9,16 +9,15 @@ import net.minecraft.client.model.geom.builders.CubeListBuilder; import net.minecraft.client.model.geom.builders.LayerDefinition; import net.minecraft.client.model.geom.builders.MeshDefinition; import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.client.renderer.entity.state.TropicalFishRenderState; import net.minecraft.util.Mth; -import net.minecraft.world.entity.Entity; @Environment(EnvType.CLIENT) -public class TropicalFishModelB extends ColorableHierarchicalModel { - private final ModelPart root; +public class TropicalFishModelB extends EntityModel { private final ModelPart tail; public TropicalFishModelB(ModelPart root) { - this.root = root; + super(root); this.tail = root.getChild("tail"); } @@ -51,18 +50,9 @@ public class TropicalFishModelB extends ColorableHierarchicalM return LayerDefinition.create(meshDefinition, 32, 32); } - @Override - public ModelPart root() { - return this.root; - } - - @Override - public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { - float f = 1.0F; - if (!entity.isInWater()) { - f = 1.5F; - } - - this.tail.yRot = -f * 0.45F * Mth.sin(0.6F * ageInTicks); + public void setupAnim(TropicalFishRenderState tropicalFishRenderState) { + super.setupAnim(tropicalFishRenderState); + float f = tropicalFishRenderState.isInWater ? 1.0F : 1.5F; + this.tail.yRot = -f * 0.45F * Mth.sin(0.6F * tropicalFishRenderState.ageInTicks); } } diff --git a/net/minecraft/client/model/TurtleModel.java b/net/minecraft/client/model/TurtleModel.java index 9c5e954c..7c471f7f 100644 --- a/net/minecraft/client/model/TurtleModel.java +++ b/net/minecraft/client/model/TurtleModel.java @@ -1,9 +1,6 @@ package net.minecraft.client.model; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.Iterables; -import com.mojang.blaze3d.vertex.PoseStack; -import com.mojang.blaze3d.vertex.VertexConsumer; +import java.util.Set; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.model.geom.ModelPart; @@ -11,17 +8,19 @@ import net.minecraft.client.model.geom.PartPose; import net.minecraft.client.model.geom.builders.CubeListBuilder; import net.minecraft.client.model.geom.builders.LayerDefinition; import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.MeshTransformer; import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.client.renderer.entity.state.TurtleRenderState; import net.minecraft.util.Mth; -import net.minecraft.world.entity.animal.Turtle; @Environment(EnvType.CLIENT) -public class TurtleModel extends QuadrupedModel { +public class TurtleModel extends QuadrupedModel { private static final String EGG_BELLY = "egg_belly"; + public static final MeshTransformer BABY_TRANSFORMER = new BabyModelTransform(true, 120.0F, 0.0F, 9.0F, 6.0F, 120.0F, Set.of("head")); private final ModelPart eggBelly; public TurtleModel(ModelPart root) { - super(root, true, 120.0F, 0.0F, 9.0F, 6.0F, 120); + super(root); this.eggBelly = root.getChild("egg_belly"); } @@ -61,54 +60,32 @@ public class TurtleModel extends QuadrupedModel { return LayerDefinition.create(meshDefinition, 128, 64); } - @Override - protected Iterable bodyParts() { - return Iterables.concat(super.bodyParts(), ImmutableList.of(this.eggBelly)); - } - - /** - * Sets this entity's model rotation angles - */ - public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { - super.setupAnim(entity, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch); - this.rightHindLeg.xRot = Mth.cos(limbSwing * 0.6662F * 0.6F) * 0.5F * limbSwingAmount; - this.leftHindLeg.xRot = Mth.cos(limbSwing * 0.6662F * 0.6F + (float) Math.PI) * 0.5F * limbSwingAmount; - this.rightFrontLeg.zRot = Mth.cos(limbSwing * 0.6662F * 0.6F + (float) Math.PI) * 0.5F * limbSwingAmount; - this.leftFrontLeg.zRot = Mth.cos(limbSwing * 0.6662F * 0.6F) * 0.5F * limbSwingAmount; - this.rightFrontLeg.xRot = 0.0F; - this.leftFrontLeg.xRot = 0.0F; - this.rightFrontLeg.yRot = 0.0F; - this.leftFrontLeg.yRot = 0.0F; - this.rightHindLeg.yRot = 0.0F; - this.leftHindLeg.yRot = 0.0F; - if (!entity.isInWater() && entity.onGround()) { - float f = entity.isLayingEgg() ? 4.0F : 1.0F; - float g = entity.isLayingEgg() ? 2.0F : 1.0F; - float h = 5.0F; - this.rightFrontLeg.yRot = Mth.cos(f * limbSwing * 5.0F + (float) Math.PI) * 8.0F * limbSwingAmount * g; - this.rightFrontLeg.zRot = 0.0F; - this.leftFrontLeg.yRot = Mth.cos(f * limbSwing * 5.0F) * 8.0F * limbSwingAmount * g; - this.leftFrontLeg.zRot = 0.0F; - this.rightHindLeg.yRot = Mth.cos(limbSwing * 5.0F + (float) Math.PI) * 3.0F * limbSwingAmount; - this.rightHindLeg.xRot = 0.0F; - this.leftHindLeg.yRot = Mth.cos(limbSwing * 5.0F) * 3.0F * limbSwingAmount; - this.leftHindLeg.xRot = 0.0F; + public void setupAnim(TurtleRenderState turtleRenderState) { + super.setupAnim(turtleRenderState); + float f = turtleRenderState.walkAnimationPos; + float g = turtleRenderState.walkAnimationSpeed; + if (turtleRenderState.isOnLand) { + float h = turtleRenderState.isLayingEgg ? 4.0F : 1.0F; + float i = turtleRenderState.isLayingEgg ? 2.0F : 1.0F; + float j = f * 5.0F; + float k = Mth.cos(h * j); + float l = Mth.cos(j); + this.rightFrontLeg.yRot = -k * 8.0F * g * i; + this.leftFrontLeg.yRot = k * 8.0F * g * i; + this.rightHindLeg.yRot = -l * 3.0F * g; + this.leftHindLeg.yRot = l * 3.0F * g; + } else { + float h = 0.5F * g; + float i = Mth.cos(f * 0.6662F * 0.6F) * h; + this.rightHindLeg.xRot = i; + this.leftHindLeg.xRot = -i; + this.rightFrontLeg.zRot = -i; + this.leftFrontLeg.zRot = i; } - this.eggBelly.visible = !this.young && entity.hasEgg(); - } - - @Override - public void renderToBuffer(PoseStack poseStack, VertexConsumer buffer, int packedLight, int packedOverlay, int color) { - boolean bl = this.eggBelly.visible; - if (bl) { - poseStack.pushPose(); - poseStack.translate(0.0F, -0.08F, 0.0F); - } - - super.renderToBuffer(poseStack, buffer, packedLight, packedOverlay, color); - if (bl) { - poseStack.popPose(); + this.eggBelly.visible = turtleRenderState.hasEgg; + if (this.eggBelly.visible) { + this.root.y--; } } } diff --git a/net/minecraft/client/model/VexModel.java b/net/minecraft/client/model/VexModel.java index 70c64a4c..6b21d7eb 100644 --- a/net/minecraft/client/model/VexModel.java +++ b/net/minecraft/client/model/VexModel.java @@ -11,30 +11,21 @@ import net.minecraft.client.model.geom.builders.LayerDefinition; import net.minecraft.client.model.geom.builders.MeshDefinition; import net.minecraft.client.model.geom.builders.PartDefinition; import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.entity.state.VexRenderState; import net.minecraft.util.Mth; import net.minecraft.world.entity.HumanoidArm; -import net.minecraft.world.entity.monster.Vex; -import net.minecraft.world.item.ItemStack; @Environment(EnvType.CLIENT) -public class VexModel extends HierarchicalModel implements ArmedModel { - private final ModelPart root; - private final ModelPart body; - private final ModelPart rightArm; - private final ModelPart leftArm; - private final ModelPart rightWing; - private final ModelPart leftWing; - private final ModelPart head; +public class VexModel extends EntityModel implements ArmedModel { + private final ModelPart body = this.root.getChild("body"); + private final ModelPart rightArm = this.body.getChild("right_arm"); + private final ModelPart leftArm = this.body.getChild("left_arm"); + private final ModelPart rightWing = this.body.getChild("right_wing"); + private final ModelPart leftWing = this.body.getChild("left_wing"); + private final ModelPart head = this.root.getChild("head"); public VexModel(ModelPart root) { - super(RenderType::entityTranslucent); - this.root = root.getChild("root"); - this.body = this.root.getChild("body"); - this.rightArm = this.body.getChild("right_arm"); - this.leftArm = this.body.getChild("left_arm"); - this.rightWing = this.body.getChild("right_wing"); - this.leftWing = this.body.getChild("left_wing"); - this.head = this.root.getChild("head"); + super(root.getChild("root"), RenderType::entityTranslucent); } public static LayerDefinition createBodyLayer() { @@ -76,24 +67,21 @@ public class VexModel extends HierarchicalModel implements ArmedModel { return LayerDefinition.create(meshDefinition, 32, 32); } - /** - * Sets this entity's model rotation angles - */ - public void setupAnim(Vex entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { - this.root().getAllParts().forEach(ModelPart::resetPose); - this.head.yRot = netHeadYaw * (float) (Math.PI / 180.0); - this.head.xRot = headPitch * (float) (Math.PI / 180.0); - float f = Mth.cos(ageInTicks * 5.5F * (float) (Math.PI / 180.0)) * 0.1F; + public void setupAnim(VexRenderState vexRenderState) { + super.setupAnim(vexRenderState); + this.head.yRot = vexRenderState.yRot * (float) (Math.PI / 180.0); + this.head.xRot = vexRenderState.xRot * (float) (Math.PI / 180.0); + float f = Mth.cos(vexRenderState.ageInTicks * 5.5F * (float) (Math.PI / 180.0)) * 0.1F; this.rightArm.zRot = (float) (Math.PI / 5) + f; this.leftArm.zRot = -((float) (Math.PI / 5) + f); - if (entity.isCharging()) { + if (vexRenderState.isCharging) { this.body.xRot = 0.0F; - this.setArmsCharging(entity.getMainHandItem(), entity.getOffhandItem(), f); + this.setArmsCharging(!vexRenderState.rightHandItem.isEmpty(), !vexRenderState.leftHandItem.isEmpty(), f); } else { this.body.xRot = (float) (Math.PI / 20); } - this.leftWing.yRot = 1.0995574F + Mth.cos(ageInTicks * 45.836624F * (float) (Math.PI / 180.0)) * (float) (Math.PI / 180.0) * 16.2F; + this.leftWing.yRot = 1.0995574F + Mth.cos(vexRenderState.ageInTicks * 45.836624F * (float) (Math.PI / 180.0)) * (float) (Math.PI / 180.0) * 16.2F; this.rightWing.yRot = -this.leftWing.yRot; this.leftWing.xRot = 0.47123888F; this.leftWing.zRot = -0.47123888F; @@ -101,8 +89,8 @@ public class VexModel extends HierarchicalModel implements ArmedModel { this.rightWing.zRot = 0.47123888F; } - private void setArmsCharging(ItemStack rightHandItem, ItemStack leftHandItem, float f) { - if (rightHandItem.isEmpty() && leftHandItem.isEmpty()) { + private void setArmsCharging(boolean bl, boolean bl2, float f) { + if (!bl && !bl2) { this.rightArm.xRot = -1.2217305F; this.rightArm.yRot = (float) (Math.PI / 12); this.rightArm.zRot = -0.47123888F - f; @@ -110,13 +98,13 @@ public class VexModel extends HierarchicalModel implements ArmedModel { this.leftArm.yRot = (float) (-Math.PI / 12); this.leftArm.zRot = 0.47123888F + f; } else { - if (!rightHandItem.isEmpty()) { + if (bl) { this.rightArm.xRot = (float) (Math.PI * 7.0 / 6.0); this.rightArm.yRot = (float) (Math.PI / 12); this.rightArm.zRot = -0.47123888F - f; } - if (!leftHandItem.isEmpty()) { + if (bl2) { this.leftArm.xRot = (float) (Math.PI * 7.0 / 6.0); this.leftArm.yRot = (float) (-Math.PI / 12); this.leftArm.zRot = 0.47123888F + f; @@ -124,11 +112,6 @@ public class VexModel extends HierarchicalModel implements ArmedModel { } } - @Override - public ModelPart root() { - return this.root; - } - @Override public void translateToHand(HumanoidArm side, PoseStack poseStack) { boolean bl = side == HumanoidArm.RIGHT; diff --git a/net/minecraft/client/model/VillagerModel.java b/net/minecraft/client/model/VillagerModel.java index 6dcd1bfc..cbc4d305 100644 --- a/net/minecraft/client/model/VillagerModel.java +++ b/net/minecraft/client/model/VillagerModel.java @@ -8,26 +8,22 @@ import net.minecraft.client.model.geom.builders.CubeDeformation; import net.minecraft.client.model.geom.builders.CubeListBuilder; import net.minecraft.client.model.geom.builders.MeshDefinition; import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.client.renderer.entity.state.VillagerRenderState; import net.minecraft.util.Mth; -import net.minecraft.world.entity.Entity; -import net.minecraft.world.entity.npc.AbstractVillager; @Environment(EnvType.CLIENT) -public class VillagerModel extends HierarchicalModel implements HeadedModel, VillagerHeadModel { - private final ModelPart root; +public class VillagerModel extends EntityModel implements HeadedModel, VillagerHeadModel { private final ModelPart head; private final ModelPart hat; private final ModelPart hatRim; private final ModelPart rightLeg; private final ModelPart leftLeg; - protected final ModelPart nose; public VillagerModel(ModelPart root) { - this.root = root; + super(root); this.head = root.getChild("head"); this.hat = this.head.getChild("hat"); this.hatRim = this.hat.getChild("hat_rim"); - this.nose = this.head.getChild("nose"); this.rightLeg = root.getChild("right_leg"); this.leftLeg = root.getChild("left_leg"); } @@ -74,29 +70,19 @@ public class VillagerModel extends HierarchicalModel implem return meshDefinition; } - @Override - public ModelPart root() { - return this.root; - } - - @Override - public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { - boolean bl = false; - if (entity instanceof AbstractVillager) { - bl = ((AbstractVillager)entity).getUnhappyCounter() > 0; - } - - this.head.yRot = netHeadYaw * (float) (Math.PI / 180.0); - this.head.xRot = headPitch * (float) (Math.PI / 180.0); - if (bl) { - this.head.zRot = 0.3F * Mth.sin(0.45F * ageInTicks); + public void setupAnim(VillagerRenderState villagerRenderState) { + super.setupAnim(villagerRenderState); + this.head.yRot = villagerRenderState.yRot * (float) (Math.PI / 180.0); + this.head.xRot = villagerRenderState.xRot * (float) (Math.PI / 180.0); + if (villagerRenderState.isUnhappy) { + this.head.zRot = 0.3F * Mth.sin(0.45F * villagerRenderState.ageInTicks); this.head.xRot = 0.4F; } else { this.head.zRot = 0.0F; } - this.rightLeg.xRot = Mth.cos(limbSwing * 0.6662F) * 1.4F * limbSwingAmount * 0.5F; - this.leftLeg.xRot = Mth.cos(limbSwing * 0.6662F + (float) Math.PI) * 1.4F * limbSwingAmount * 0.5F; + this.rightLeg.xRot = Mth.cos(villagerRenderState.walkAnimationPos * 0.6662F) * 1.4F * villagerRenderState.walkAnimationSpeed * 0.5F; + this.leftLeg.xRot = Mth.cos(villagerRenderState.walkAnimationPos * 0.6662F + (float) Math.PI) * 1.4F * villagerRenderState.walkAnimationSpeed * 0.5F; this.rightLeg.yRot = 0.0F; this.leftLeg.yRot = 0.0F; } diff --git a/net/minecraft/client/model/WardenModel.java b/net/minecraft/client/model/WardenModel.java index 0a3d14cb..90dd0da2 100644 --- a/net/minecraft/client/model/WardenModel.java +++ b/net/minecraft/client/model/WardenModel.java @@ -12,14 +12,13 @@ import net.minecraft.client.model.geom.builders.LayerDefinition; import net.minecraft.client.model.geom.builders.MeshDefinition; import net.minecraft.client.model.geom.builders.PartDefinition; import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.entity.state.WardenRenderState; import net.minecraft.util.Mth; -import net.minecraft.world.entity.monster.warden.Warden; @Environment(EnvType.CLIENT) -public class WardenModel extends HierarchicalModel { +public class WardenModel extends EntityModel { private static final float DEFAULT_ARM_X_Y = 13.0F; private static final float DEFAULT_ARM_Z = 1.0F; - private final ModelPart root; protected final ModelPart bone; protected final ModelPart body; protected final ModelPart head; @@ -37,8 +36,7 @@ public class WardenModel extends HierarchicalModel { private final List pulsatingSpotsLayerModelParts; public WardenModel(ModelPart root) { - super(RenderType::entityCutoutNoCull); - this.root = root; + super(root, RenderType::entityCutoutNoCull); this.bone = root.getChild("bone"); this.body = this.bone.getChild("body"); this.head = this.body.getChild("head"); @@ -95,22 +93,18 @@ public class WardenModel extends HierarchicalModel { return LayerDefinition.create(meshDefinition, 128, 128); } - /** - * Sets this entity's model rotation angles - */ - public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { - this.root().getAllParts().forEach(ModelPart::resetPose); - float f = ageInTicks - entity.tickCount; - this.animateHeadLookTarget(netHeadYaw, headPitch); - this.animateWalk(limbSwing, limbSwingAmount); - this.animateIdlePose(ageInTicks); - this.animateTendrils(entity, ageInTicks, f); - this.animate(entity.attackAnimationState, WardenAnimation.WARDEN_ATTACK, ageInTicks); - this.animate(entity.sonicBoomAnimationState, WardenAnimation.WARDEN_SONIC_BOOM, ageInTicks); - this.animate(entity.diggingAnimationState, WardenAnimation.WARDEN_DIG, ageInTicks); - this.animate(entity.emergeAnimationState, WardenAnimation.WARDEN_EMERGE, ageInTicks); - this.animate(entity.roarAnimationState, WardenAnimation.WARDEN_ROAR, ageInTicks); - this.animate(entity.sniffAnimationState, WardenAnimation.WARDEN_SNIFF, ageInTicks); + public void setupAnim(WardenRenderState wardenRenderState) { + super.setupAnim(wardenRenderState); + this.animateHeadLookTarget(wardenRenderState.yRot, wardenRenderState.xRot); + this.animateWalk(wardenRenderState.walkAnimationPos, wardenRenderState.walkAnimationSpeed); + this.animateIdlePose(wardenRenderState.ageInTicks); + this.animateTendrils(wardenRenderState, wardenRenderState.ageInTicks); + this.animate(wardenRenderState.attackAnimationState, WardenAnimation.WARDEN_ATTACK, wardenRenderState.ageInTicks); + this.animate(wardenRenderState.sonicBoomAnimationState, WardenAnimation.WARDEN_SONIC_BOOM, wardenRenderState.ageInTicks); + this.animate(wardenRenderState.diggingAnimationState, WardenAnimation.WARDEN_DIG, wardenRenderState.ageInTicks); + this.animate(wardenRenderState.emergeAnimationState, WardenAnimation.WARDEN_EMERGE, wardenRenderState.ageInTicks); + this.animate(wardenRenderState.roarAnimationState, WardenAnimation.WARDEN_ROAR, wardenRenderState.ageInTicks); + this.animate(wardenRenderState.sniffAnimationState, WardenAnimation.WARDEN_SNIFF, wardenRenderState.ageInTicks); } private void animateHeadLookTarget(float yaw, float pitch) { @@ -158,30 +152,25 @@ public class WardenModel extends HierarchicalModel { this.rightArm.y = -13.0F; } - private void animateTendrils(T entity, float ageInTicks, float partialTick) { - float f = entity.getTendrilAnimation(partialTick) * (float)(Math.cos(ageInTicks * 2.25) * Math.PI * 0.1F); - this.leftTendril.xRot = f; - this.rightTendril.xRot = -f; + private void animateTendrils(WardenRenderState wardenRenderState, float f) { + float g = wardenRenderState.tendrilAnimation * (float)(Math.cos(f * 2.25) * Math.PI * 0.1F); + this.leftTendril.xRot = g; + this.rightTendril.xRot = -g; } - @Override - public ModelPart root() { - return this.root; - } - - public List getTendrilsLayerModelParts() { + public List getTendrilsLayerModelParts(WardenRenderState wardenRenderState) { return this.tendrilsLayerModelParts; } - public List getHeartLayerModelParts() { + public List getHeartLayerModelParts(WardenRenderState wardenRenderState) { return this.heartLayerModelParts; } - public List getBioluminescentLayerModelParts() { + public List getBioluminescentLayerModelParts(WardenRenderState wardenRenderState) { return this.bioluminescentLayerModelParts; } - public List getPulsatingSpotsLayerModelParts() { + public List getPulsatingSpotsLayerModelParts(WardenRenderState wardenRenderState) { return this.pulsatingSpotsLayerModelParts; } } diff --git a/net/minecraft/client/model/WaterPatchModel.java b/net/minecraft/client/model/WaterPatchModel.java deleted file mode 100644 index dff88945..00000000 --- a/net/minecraft/client/model/WaterPatchModel.java +++ /dev/null @@ -1,10 +0,0 @@ -package net.minecraft.client.model; - -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.client.model.geom.ModelPart; - -@Environment(EnvType.CLIENT) -public interface WaterPatchModel { - ModelPart waterPatch(); -} diff --git a/net/minecraft/client/model/WindChargeModel.java b/net/minecraft/client/model/WindChargeModel.java index 9a6c0356..4bf7bfb4 100644 --- a/net/minecraft/client/model/WindChargeModel.java +++ b/net/minecraft/client/model/WindChargeModel.java @@ -10,17 +10,17 @@ import net.minecraft.client.model.geom.builders.LayerDefinition; import net.minecraft.client.model.geom.builders.MeshDefinition; import net.minecraft.client.model.geom.builders.PartDefinition; import net.minecraft.client.renderer.RenderType; -import net.minecraft.world.entity.projectile.windcharge.AbstractWindCharge; +import net.minecraft.client.renderer.entity.state.EntityRenderState; @Environment(EnvType.CLIENT) -public class WindChargeModel extends HierarchicalModel { +public class WindChargeModel extends EntityModel { private static final int ROTATION_SPEED = 16; private final ModelPart bone; private final ModelPart windCharge; private final ModelPart wind; public WindChargeModel(ModelPart root) { - super(RenderType::entityTranslucent); + super(root, RenderType::entityTranslucent); this.bone = root.getChild("bone"); this.wind = this.bone.getChild("wind"); this.windCharge = this.bone.getChild("wind_charge"); @@ -47,16 +47,10 @@ public class WindChargeModel extends HierarchicalModel { return LayerDefinition.create(meshDefinition, 64, 32); } - /** - * Sets this entity's model rotation angles - */ - public void setupAnim(AbstractWindCharge entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { - this.windCharge.yRot = -ageInTicks * 16.0F * (float) (Math.PI / 180.0); - this.wind.yRot = ageInTicks * 16.0F * (float) (Math.PI / 180.0); - } - @Override - public ModelPart root() { - return this.bone; + public void setupAnim(EntityRenderState entityRenderState) { + super.setupAnim(entityRenderState); + this.windCharge.yRot = -entityRenderState.ageInTicks * 16.0F * (float) (Math.PI / 180.0); + this.wind.yRot = entityRenderState.ageInTicks * 16.0F * (float) (Math.PI / 180.0); } } diff --git a/net/minecraft/client/model/WitchModel.java b/net/minecraft/client/model/WitchModel.java index eeb9892b..7ec16d47 100644 --- a/net/minecraft/client/model/WitchModel.java +++ b/net/minecraft/client/model/WitchModel.java @@ -9,15 +9,26 @@ import net.minecraft.client.model.geom.builders.CubeListBuilder; import net.minecraft.client.model.geom.builders.LayerDefinition; import net.minecraft.client.model.geom.builders.MeshDefinition; import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.client.renderer.entity.state.WitchRenderState; import net.minecraft.util.Mth; -import net.minecraft.world.entity.Entity; @Environment(EnvType.CLIENT) -public class WitchModel extends VillagerModel { - private boolean holdingItem; +public class WitchModel extends EntityModel implements HeadedModel, VillagerHeadModel { + protected final ModelPart nose; + private final ModelPart head; + private final ModelPart hat; + private final ModelPart hatRim; + private final ModelPart rightLeg; + private final ModelPart leftLeg; public WitchModel(ModelPart root) { super(root); + this.head = root.getChild("head"); + this.hat = this.head.getChild("hat"); + this.hatRim = this.hat.getChild("hat_rim"); + this.nose = this.head.getChild("nose"); + this.rightLeg = root.getChild("right_leg"); + this.leftLeg = root.getChild("left_leg"); } public static LayerDefinition createBodyLayer() { @@ -51,15 +62,16 @@ public class WitchModel extends VillagerModel { return LayerDefinition.create(meshDefinition, 64, 128); } - @Override - public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { - super.setupAnim(entity, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch); - this.nose.setPos(0.0F, -2.0F, 0.0F); - float f = 0.01F * (entity.getId() % 10); - this.nose.xRot = Mth.sin(entity.tickCount * f) * 4.5F * (float) (Math.PI / 180.0); - this.nose.yRot = 0.0F; - this.nose.zRot = Mth.cos(entity.tickCount * f) * 2.5F * (float) (Math.PI / 180.0); - if (this.holdingItem) { + public void setupAnim(WitchRenderState witchRenderState) { + super.setupAnim(witchRenderState); + this.head.yRot = witchRenderState.yRot * (float) (Math.PI / 180.0); + this.head.xRot = witchRenderState.xRot * (float) (Math.PI / 180.0); + this.rightLeg.xRot = Mth.cos(witchRenderState.walkAnimationPos * 0.6662F) * 1.4F * witchRenderState.walkAnimationSpeed * 0.5F; + this.leftLeg.xRot = Mth.cos(witchRenderState.walkAnimationPos * 0.6662F + (float) Math.PI) * 1.4F * witchRenderState.walkAnimationSpeed * 0.5F; + float f = 0.01F * (witchRenderState.entityId % 10); + this.nose.xRot = Mth.sin(witchRenderState.ageInTicks * f) * 4.5F * (float) (Math.PI / 180.0); + this.nose.zRot = Mth.cos(witchRenderState.ageInTicks * f) * 2.5F * (float) (Math.PI / 180.0); + if (witchRenderState.isHoldingItem) { this.nose.setPos(0.0F, 1.0F, -1.5F); this.nose.xRot = -0.9F; } @@ -69,7 +81,15 @@ public class WitchModel extends VillagerModel { return this.nose; } - public void setHoldingItem(boolean holdingItem) { - this.holdingItem = holdingItem; + @Override + public ModelPart getHead() { + return this.head; + } + + @Override + public void hatVisible(boolean visible) { + this.head.visible = visible; + this.hat.visible = visible; + this.hatRim.visible = visible; } } diff --git a/net/minecraft/client/model/WitherBossModel.java b/net/minecraft/client/model/WitherBossModel.java index 0e096d99..f2b4e795 100644 --- a/net/minecraft/client/model/WitherBossModel.java +++ b/net/minecraft/client/model/WitherBossModel.java @@ -9,18 +9,17 @@ import net.minecraft.client.model.geom.builders.CubeListBuilder; import net.minecraft.client.model.geom.builders.LayerDefinition; import net.minecraft.client.model.geom.builders.MeshDefinition; import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.client.renderer.entity.state.WitherRenderState; import net.minecraft.util.Mth; -import net.minecraft.world.entity.boss.wither.WitherBoss; @Environment(EnvType.CLIENT) -public class WitherBossModel extends HierarchicalModel { +public class WitherBossModel extends EntityModel { private static final String RIBCAGE = "ribcage"; private static final String CENTER_HEAD = "center_head"; private static final String RIGHT_HEAD = "right_head"; private static final String LEFT_HEAD = "left_head"; private static final float RIBCAGE_X_ROT_OFFSET = 0.065F; private static final float TAIL_X_ROT_OFFSET = 0.265F; - private final ModelPart root; private final ModelPart centerHead; private final ModelPart rightHead; private final ModelPart leftHead; @@ -28,7 +27,7 @@ public class WitherBossModel extends HierarchicalModel private final ModelPart tail; public WitherBossModel(ModelPart root) { - this.root = root; + super(root); this.ribcage = root.getChild("ribcage"); this.tail = root.getChild("tail"); this.centerHead = root.getChild("center_head"); @@ -70,30 +69,20 @@ public class WitherBossModel extends HierarchicalModel return LayerDefinition.create(meshDefinition, 64, 64); } - @Override - public ModelPart root() { - return this.root; - } - - /** - * Sets this entity's model rotation angles - */ - public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { - float f = Mth.cos(ageInTicks * 0.1F); + public void setupAnim(WitherRenderState witherRenderState) { + super.setupAnim(witherRenderState); + setupHeadRotation(witherRenderState, this.rightHead, 0); + setupHeadRotation(witherRenderState, this.leftHead, 1); + float f = Mth.cos(witherRenderState.ageInTicks * 0.1F); this.ribcage.xRot = (0.065F + 0.05F * f) * (float) Math.PI; this.tail.setPos(-2.0F, 6.9F + Mth.cos(this.ribcage.xRot) * 10.0F, -0.5F + Mth.sin(this.ribcage.xRot) * 10.0F); this.tail.xRot = (0.265F + 0.1F * f) * (float) Math.PI; - this.centerHead.yRot = netHeadYaw * (float) (Math.PI / 180.0); - this.centerHead.xRot = headPitch * (float) (Math.PI / 180.0); + this.centerHead.yRot = witherRenderState.yRot * (float) (Math.PI / 180.0); + this.centerHead.xRot = witherRenderState.xRot * (float) (Math.PI / 180.0); } - public void prepareMobModel(T entity, float limbSwing, float limbSwingAmount, float partialTick) { - setupHeadRotation(entity, this.rightHead, 0); - setupHeadRotation(entity, this.leftHead, 1); - } - - private static void setupHeadRotation(T wither, ModelPart part, int head) { - part.yRot = (wither.getHeadYRot(head) - wither.yBodyRot) * (float) (Math.PI / 180.0); - part.xRot = wither.getHeadXRot(head) * (float) (Math.PI / 180.0); + private static void setupHeadRotation(WitherRenderState witherRenderState, ModelPart modelPart, int i) { + modelPart.yRot = (witherRenderState.yHeadRots[i] - witherRenderState.bodyRot) * (float) (Math.PI / 180.0); + modelPart.xRot = witherRenderState.xHeadRots[i] * (float) (Math.PI / 180.0); } } diff --git a/net/minecraft/client/model/WolfModel.java b/net/minecraft/client/model/WolfModel.java index 4ab28906..eafed47e 100644 --- a/net/minecraft/client/model/WolfModel.java +++ b/net/minecraft/client/model/WolfModel.java @@ -1,6 +1,6 @@ package net.minecraft.client.model; -import com.google.common.collect.ImmutableList; +import java.util.Set; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.model.geom.ModelPart; @@ -8,12 +8,14 @@ import net.minecraft.client.model.geom.PartPose; import net.minecraft.client.model.geom.builders.CubeDeformation; import net.minecraft.client.model.geom.builders.CubeListBuilder; import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.MeshTransformer; import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.client.renderer.entity.state.WolfRenderState; import net.minecraft.util.Mth; -import net.minecraft.world.entity.animal.Wolf; @Environment(EnvType.CLIENT) -public class WolfModel extends ColorableAgeableListModel { +public class WolfModel extends EntityModel { + public static final MeshTransformer BABY_TRANSFORMER = new BabyModelTransform(Set.of("head")); private static final String REAL_HEAD = "real_head"; private static final String UPPER_BODY = "upper_body"; private static final String REAL_TAIL = "real_tail"; @@ -36,6 +38,7 @@ public class WolfModel extends ColorableAgeableListModel { private static final int LEG_SIZE = 8; public WolfModel(ModelPart root) { + super(root); this.head = root.getChild("head"); this.realHead = this.head.getChild("real_head"); this.body = root.getChild("body"); @@ -90,66 +93,51 @@ public class WolfModel extends ColorableAgeableListModel { return meshDefinition; } - @Override - protected Iterable headParts() { - return ImmutableList.of(this.head); - } - - @Override - protected Iterable bodyParts() { - return ImmutableList.of(this.body, this.rightHindLeg, this.leftHindLeg, this.rightFrontLeg, this.leftFrontLeg, this.tail, this.upperBody); - } - - public void prepareMobModel(T entity, float limbSwing, float limbSwingAmount, float partialTick) { - if (entity.isAngry()) { + public void setupAnim(WolfRenderState wolfRenderState) { + super.setupAnim(wolfRenderState); + float f = wolfRenderState.walkAnimationPos; + float g = wolfRenderState.walkAnimationSpeed; + if (wolfRenderState.isAngry) { this.tail.yRot = 0.0F; } else { - this.tail.yRot = Mth.cos(limbSwing * 0.6662F) * 1.4F * limbSwingAmount; + this.tail.yRot = Mth.cos(f * 0.6662F) * 1.4F * g; } - if (entity.isInSittingPose()) { - this.upperBody.setPos(-1.0F, 16.0F, -3.0F); + if (wolfRenderState.isSitting) { + float h = wolfRenderState.ageScale; + this.upperBody.y += 2.0F * h; this.upperBody.xRot = (float) (Math.PI * 2.0 / 5.0); this.upperBody.yRot = 0.0F; - this.body.setPos(0.0F, 18.0F, 0.0F); + this.body.y += 4.0F * h; + this.body.z -= 2.0F * h; this.body.xRot = (float) (Math.PI / 4); - this.tail.setPos(-1.0F, 21.0F, 6.0F); - this.rightHindLeg.setPos(-2.5F, 22.7F, 2.0F); + this.tail.y += 9.0F * h; + this.tail.z -= 2.0F * h; + this.rightHindLeg.y += 6.7F * h; + this.rightHindLeg.z -= 5.0F * h; this.rightHindLeg.xRot = (float) (Math.PI * 3.0 / 2.0); - this.leftHindLeg.setPos(0.5F, 22.7F, 2.0F); + this.leftHindLeg.y += 6.7F * h; + this.leftHindLeg.z -= 5.0F * h; this.leftHindLeg.xRot = (float) (Math.PI * 3.0 / 2.0); this.rightFrontLeg.xRot = 5.811947F; - this.rightFrontLeg.setPos(-2.49F, 17.0F, -4.0F); + this.rightFrontLeg.x += 0.01F * h; + this.rightFrontLeg.y += 1.0F * h; this.leftFrontLeg.xRot = 5.811947F; - this.leftFrontLeg.setPos(0.51F, 17.0F, -4.0F); + this.leftFrontLeg.x -= 0.01F * h; + this.leftFrontLeg.y += 1.0F * h; } else { - this.body.setPos(0.0F, 14.0F, 2.0F); - this.body.xRot = (float) (Math.PI / 2); - this.upperBody.setPos(-1.0F, 14.0F, -3.0F); - this.upperBody.xRot = this.body.xRot; - this.tail.setPos(-1.0F, 12.0F, 8.0F); - this.rightHindLeg.setPos(-2.5F, 16.0F, 7.0F); - this.leftHindLeg.setPos(0.5F, 16.0F, 7.0F); - this.rightFrontLeg.setPos(-2.5F, 16.0F, -4.0F); - this.leftFrontLeg.setPos(0.5F, 16.0F, -4.0F); - this.rightHindLeg.xRot = Mth.cos(limbSwing * 0.6662F) * 1.4F * limbSwingAmount; - this.leftHindLeg.xRot = Mth.cos(limbSwing * 0.6662F + (float) Math.PI) * 1.4F * limbSwingAmount; - this.rightFrontLeg.xRot = Mth.cos(limbSwing * 0.6662F + (float) Math.PI) * 1.4F * limbSwingAmount; - this.leftFrontLeg.xRot = Mth.cos(limbSwing * 0.6662F) * 1.4F * limbSwingAmount; + this.rightHindLeg.xRot = Mth.cos(f * 0.6662F) * 1.4F * g; + this.leftHindLeg.xRot = Mth.cos(f * 0.6662F + (float) Math.PI) * 1.4F * g; + this.rightFrontLeg.xRot = Mth.cos(f * 0.6662F + (float) Math.PI) * 1.4F * g; + this.leftFrontLeg.xRot = Mth.cos(f * 0.6662F) * 1.4F * g; } - this.realHead.zRot = entity.getHeadRollAngle(partialTick) + entity.getBodyRollAngle(partialTick, 0.0F); - this.upperBody.zRot = entity.getBodyRollAngle(partialTick, -0.08F); - this.body.zRot = entity.getBodyRollAngle(partialTick, -0.16F); - this.realTail.zRot = entity.getBodyRollAngle(partialTick, -0.2F); - } - - /** - * Sets this entity's model rotation angles - */ - public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { - this.head.xRot = headPitch * (float) (Math.PI / 180.0); - this.head.yRot = netHeadYaw * (float) (Math.PI / 180.0); - this.tail.xRot = ageInTicks; + this.realHead.zRot = wolfRenderState.headRollAngle + wolfRenderState.getBodyRollAngle(0.0F); + this.upperBody.zRot = wolfRenderState.getBodyRollAngle(-0.08F); + this.body.zRot = wolfRenderState.getBodyRollAngle(-0.16F); + this.realTail.zRot = wolfRenderState.getBodyRollAngle(-0.2F); + this.head.xRot = wolfRenderState.xRot * (float) (Math.PI / 180.0); + this.head.yRot = wolfRenderState.yRot * (float) (Math.PI / 180.0); + this.tail.xRot = wolfRenderState.tailAngle; } } diff --git a/net/minecraft/client/model/ZombieModel.java b/net/minecraft/client/model/ZombieModel.java index 6e4793e6..3eb67567 100644 --- a/net/minecraft/client/model/ZombieModel.java +++ b/net/minecraft/client/model/ZombieModel.java @@ -3,15 +3,11 @@ package net.minecraft.client.model; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.model.geom.ModelPart; -import net.minecraft.world.entity.monster.Zombie; +import net.minecraft.client.renderer.entity.state.ZombieRenderState; @Environment(EnvType.CLIENT) -public class ZombieModel extends AbstractZombieModel { +public class ZombieModel extends AbstractZombieModel { public ZombieModel(ModelPart root) { super(root); } - - public boolean isAggressive(T entity) { - return entity.isAggressive(); - } } diff --git a/net/minecraft/client/model/ZombieVillagerModel.java b/net/minecraft/client/model/ZombieVillagerModel.java index 4cdea2d2..426272c2 100644 --- a/net/minecraft/client/model/ZombieVillagerModel.java +++ b/net/minecraft/client/model/ZombieVillagerModel.java @@ -9,10 +9,10 @@ import net.minecraft.client.model.geom.builders.CubeListBuilder; import net.minecraft.client.model.geom.builders.LayerDefinition; import net.minecraft.client.model.geom.builders.MeshDefinition; import net.minecraft.client.model.geom.builders.PartDefinition; -import net.minecraft.world.entity.monster.Zombie; +import net.minecraft.client.renderer.entity.state.ZombieVillagerRenderState; @Environment(EnvType.CLIENT) -public class ZombieVillagerModel extends HumanoidModel implements VillagerHeadModel { +public class ZombieVillagerModel extends HumanoidModel implements VillagerHeadModel { private final ModelPart hatRim = this.hat.getChild("hat_rim"); public ZombieVillagerModel(ModelPart root) { @@ -22,15 +22,15 @@ public class ZombieVillagerModel extends HumanoidModel impl public static LayerDefinition createBodyLayer() { MeshDefinition meshDefinition = HumanoidModel.createMesh(CubeDeformation.NONE, 0.0F); PartDefinition partDefinition = meshDefinition.getRoot(); - partDefinition.addOrReplaceChild( + PartDefinition partDefinition2 = partDefinition.addOrReplaceChild( "head", new CubeListBuilder().texOffs(0, 0).addBox(-4.0F, -10.0F, -4.0F, 8.0F, 10.0F, 8.0F).texOffs(24, 0).addBox(-1.0F, -3.0F, -6.0F, 2.0F, 4.0F, 2.0F), PartPose.ZERO ); - PartDefinition partDefinition2 = partDefinition.addOrReplaceChild( + PartDefinition partDefinition3 = partDefinition2.addOrReplaceChild( "hat", CubeListBuilder.create().texOffs(32, 0).addBox(-4.0F, -10.0F, -4.0F, 8.0F, 10.0F, 8.0F, new CubeDeformation(0.5F)), PartPose.ZERO ); - partDefinition2.addOrReplaceChild( + partDefinition3.addOrReplaceChild( "hat_rim", CubeListBuilder.create().texOffs(30, 47).addBox(-8.0F, -8.0F, -6.0F, 16.0F, 16.0F, 1.0F), PartPose.rotation((float) (-Math.PI / 2), 0.0F, 0.0F) ); partDefinition.addOrReplaceChild( @@ -60,7 +60,7 @@ public class ZombieVillagerModel extends HumanoidModel impl public static LayerDefinition createArmorLayer(CubeDeformation cubeDeformation) { MeshDefinition meshDefinition = HumanoidModel.createMesh(cubeDeformation, 0.0F); PartDefinition partDefinition = meshDefinition.getRoot(); - partDefinition.addOrReplaceChild( + PartDefinition partDefinition2 = partDefinition.addOrReplaceChild( "head", CubeListBuilder.create().texOffs(0, 0).addBox(-4.0F, -10.0F, -4.0F, 8.0F, 8.0F, 8.0F, cubeDeformation), PartPose.ZERO ); partDefinition.addOrReplaceChild( @@ -76,16 +76,14 @@ public class ZombieVillagerModel extends HumanoidModel impl CubeListBuilder.create().texOffs(0, 16).mirror().addBox(-2.0F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F, cubeDeformation.extend(0.1F)), PartPose.offset(2.0F, 12.0F, 0.0F) ); - partDefinition.getChild("hat").addOrReplaceChild("hat_rim", CubeListBuilder.create(), PartPose.ZERO); + partDefinition2.getChild("hat").addOrReplaceChild("hat_rim", CubeListBuilder.create(), PartPose.ZERO); return LayerDefinition.create(meshDefinition, 64, 32); } - /** - * Sets this entity's model rotation angles - */ - public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { - super.setupAnim(entity, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch); - AnimationUtils.animateZombieArms(this.leftArm, this.rightArm, entity.isAggressive(), this.attackTime, ageInTicks); + public void setupAnim(S zombieVillagerRenderState) { + super.setupAnim(zombieVillagerRenderState); + float f = zombieVillagerRenderState.attackTime; + AnimationUtils.animateZombieArms(this.leftArm, this.rightArm, zombieVillagerRenderState.isAggressive, f, zombieVillagerRenderState.ageInTicks); } @Override diff --git a/net/minecraft/client/model/ZombifiedPiglinModel.java b/net/minecraft/client/model/ZombifiedPiglinModel.java new file mode 100644 index 00000000..ed69f84e --- /dev/null +++ b/net/minecraft/client/model/ZombifiedPiglinModel.java @@ -0,0 +1,30 @@ +package net.minecraft.client.model; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.renderer.entity.state.ZombifiedPiglinRenderState; + +@Environment(EnvType.CLIENT) +public class ZombifiedPiglinModel extends AbstractPiglinModel { + public ZombifiedPiglinModel(ModelPart modelPart) { + super(modelPart); + } + + public void setupAnim(ZombifiedPiglinRenderState zombifiedPiglinRenderState) { + super.setupAnim(zombifiedPiglinRenderState); + AnimationUtils.animateZombieArms( + this.leftArm, this.rightArm, zombifiedPiglinRenderState.isAggressive, zombifiedPiglinRenderState.attackTime, zombifiedPiglinRenderState.ageInTicks + ); + } + + @Override + public void setAllVisible(boolean visible) { + super.setAllVisible(visible); + this.leftSleeve.visible = visible; + this.rightSleeve.visible = visible; + this.leftPants.visible = visible; + this.rightPants.visible = visible; + this.jacket.visible = visible; + } +} diff --git a/net/minecraft/client/model/dragon/DragonHeadModel.java b/net/minecraft/client/model/dragon/DragonHeadModel.java index 651b3f7d..8cb787f7 100644 --- a/net/minecraft/client/model/dragon/DragonHeadModel.java +++ b/net/minecraft/client/model/dragon/DragonHeadModel.java @@ -1,7 +1,5 @@ package net.minecraft.client.model.dragon; -import com.mojang.blaze3d.vertex.PoseStack; -import com.mojang.blaze3d.vertex.VertexConsumer; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.model.SkullModelBase; @@ -18,6 +16,7 @@ public class DragonHeadModel extends SkullModelBase { private final ModelPart jaw; public DragonHeadModel(ModelPart root) { + super(root); this.head = root.getChild("head"); this.jaw = this.head.getChild("jaw"); } @@ -37,7 +36,7 @@ public class DragonHeadModel extends SkullModelBase { .mirror(false) .addBox("scale", 3.0F, -12.0F, -4.0F, 2, 4, 6, 0, 0) .addBox("nostril", 3.0F, -3.0F, -22.0F, 2, 2, 4, 112, 0), - PartPose.ZERO + PartPose.offset(0.0F, -7.986666F, 0.0F).scaled(0.75F) ); partDefinition2.addOrReplaceChild( "jaw", CubeListBuilder.create().texOffs(176, 65).addBox("jaw", -6.0F, 0.0F, -16.0F, 12.0F, 4.0F, 16.0F), PartPose.offset(0.0F, 4.0F, -8.0F) @@ -51,13 +50,4 @@ public class DragonHeadModel extends SkullModelBase { this.head.yRot = yRot * (float) (Math.PI / 180.0); this.head.xRot = xRot * (float) (Math.PI / 180.0); } - - @Override - public void renderToBuffer(PoseStack poseStack, VertexConsumer buffer, int packedLight, int packedOverlay, int color) { - poseStack.pushPose(); - poseStack.translate(0.0F, -0.374375F, 0.0F); - poseStack.scale(0.75F, 0.75F, 0.75F); - this.head.render(poseStack, buffer, packedLight, packedOverlay, color); - poseStack.popPose(); - } } diff --git a/net/minecraft/client/model/dragon/EnderDragonModel.java b/net/minecraft/client/model/dragon/EnderDragonModel.java new file mode 100644 index 00000000..10b0bb7b --- /dev/null +++ b/net/minecraft/client/model/dragon/EnderDragonModel.java @@ -0,0 +1,286 @@ +package net.minecraft.client.model.dragon; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.client.model.EntityModel; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.client.renderer.entity.state.EnderDragonRenderState; +import net.minecraft.util.Mth; +import net.minecraft.world.entity.boss.enderdragon.DragonFlightHistory; + +@Environment(EnvType.CLIENT) +public class EnderDragonModel extends EntityModel { + private static final int NECK_PART_COUNT = 5; + private static final int TAIL_PART_COUNT = 12; + private final ModelPart head; + private final ModelPart[] neckParts = new ModelPart[5]; + private final ModelPart[] tailParts = new ModelPart[12]; + private final ModelPart jaw; + private final ModelPart body; + private final ModelPart leftWing; + private final ModelPart leftWingTip; + private final ModelPart leftFrontLeg; + private final ModelPart leftFrontLegTip; + private final ModelPart leftFrontFoot; + private final ModelPart leftRearLeg; + private final ModelPart leftRearLegTip; + private final ModelPart leftRearFoot; + private final ModelPart rightWing; + private final ModelPart rightWingTip; + private final ModelPart rightFrontLeg; + private final ModelPart rightFrontLegTip; + private final ModelPart rightFrontFoot; + private final ModelPart rightRearLeg; + private final ModelPart rightRearLegTip; + private final ModelPart rightRearFoot; + + private static String neckName(int i) { + return "neck" + i; + } + + private static String tailName(int i) { + return "tail" + i; + } + + public EnderDragonModel(ModelPart modelPart) { + super(modelPart); + this.head = modelPart.getChild("head"); + this.jaw = this.head.getChild("jaw"); + + for (int i = 0; i < this.neckParts.length; i++) { + this.neckParts[i] = modelPart.getChild(neckName(i)); + } + + for (int i = 0; i < this.tailParts.length; i++) { + this.tailParts[i] = modelPart.getChild(tailName(i)); + } + + this.body = modelPart.getChild("body"); + this.leftWing = this.body.getChild("left_wing"); + this.leftWingTip = this.leftWing.getChild("left_wing_tip"); + this.leftFrontLeg = this.body.getChild("left_front_leg"); + this.leftFrontLegTip = this.leftFrontLeg.getChild("left_front_leg_tip"); + this.leftFrontFoot = this.leftFrontLegTip.getChild("left_front_foot"); + this.leftRearLeg = this.body.getChild("left_hind_leg"); + this.leftRearLegTip = this.leftRearLeg.getChild("left_hind_leg_tip"); + this.leftRearFoot = this.leftRearLegTip.getChild("left_hind_foot"); + this.rightWing = this.body.getChild("right_wing"); + this.rightWingTip = this.rightWing.getChild("right_wing_tip"); + this.rightFrontLeg = this.body.getChild("right_front_leg"); + this.rightFrontLegTip = this.rightFrontLeg.getChild("right_front_leg_tip"); + this.rightFrontFoot = this.rightFrontLegTip.getChild("right_front_foot"); + this.rightRearLeg = this.body.getChild("right_hind_leg"); + this.rightRearLegTip = this.rightRearLeg.getChild("right_hind_leg_tip"); + this.rightRearFoot = this.rightRearLegTip.getChild("right_hind_foot"); + } + + public static LayerDefinition createBodyLayer() { + MeshDefinition meshDefinition = new MeshDefinition(); + PartDefinition partDefinition = meshDefinition.getRoot(); + float f = -16.0F; + PartDefinition partDefinition2 = partDefinition.addOrReplaceChild( + "head", + CubeListBuilder.create() + .addBox("upperlip", -6.0F, -1.0F, -24.0F, 12, 5, 16, 176, 44) + .addBox("upperhead", -8.0F, -8.0F, -10.0F, 16, 16, 16, 112, 30) + .mirror() + .addBox("scale", -5.0F, -12.0F, -4.0F, 2, 4, 6, 0, 0) + .addBox("nostril", -5.0F, -3.0F, -22.0F, 2, 2, 4, 112, 0) + .mirror() + .addBox("scale", 3.0F, -12.0F, -4.0F, 2, 4, 6, 0, 0) + .addBox("nostril", 3.0F, -3.0F, -22.0F, 2, 2, 4, 112, 0), + PartPose.offset(0.0F, 20.0F, -62.0F) + ); + partDefinition2.addOrReplaceChild("jaw", CubeListBuilder.create().addBox("jaw", -6.0F, 0.0F, -16.0F, 12, 4, 16, 176, 65), PartPose.offset(0.0F, 4.0F, -8.0F)); + CubeListBuilder cubeListBuilder = CubeListBuilder.create() + .addBox("box", -5.0F, -5.0F, -5.0F, 10, 10, 10, 192, 104) + .addBox("scale", -1.0F, -9.0F, -3.0F, 2, 4, 6, 48, 0); + + for (int i = 0; i < 5; i++) { + partDefinition.addOrReplaceChild(neckName(i), cubeListBuilder, PartPose.offset(0.0F, 20.0F, -12.0F - i * 10.0F)); + } + + for (int i = 0; i < 12; i++) { + partDefinition.addOrReplaceChild(tailName(i), cubeListBuilder, PartPose.offset(0.0F, 10.0F, 60.0F + i * 10.0F)); + } + + PartDefinition partDefinition3 = partDefinition.addOrReplaceChild( + "body", + CubeListBuilder.create() + .addBox("body", -12.0F, 1.0F, -16.0F, 24, 24, 64, 0, 0) + .addBox("scale", -1.0F, -5.0F, -10.0F, 2, 6, 12, 220, 53) + .addBox("scale", -1.0F, -5.0F, 10.0F, 2, 6, 12, 220, 53) + .addBox("scale", -1.0F, -5.0F, 30.0F, 2, 6, 12, 220, 53), + PartPose.offset(0.0F, 3.0F, 8.0F) + ); + PartDefinition partDefinition4 = partDefinition3.addOrReplaceChild( + "left_wing", + CubeListBuilder.create().mirror().addBox("bone", 0.0F, -4.0F, -4.0F, 56, 8, 8, 112, 88).addBox("skin", 0.0F, 0.0F, 2.0F, 56, 0, 56, -56, 88), + PartPose.offset(12.0F, 2.0F, -6.0F) + ); + partDefinition4.addOrReplaceChild( + "left_wing_tip", + CubeListBuilder.create().mirror().addBox("bone", 0.0F, -2.0F, -2.0F, 56, 4, 4, 112, 136).addBox("skin", 0.0F, 0.0F, 2.0F, 56, 0, 56, -56, 144), + PartPose.offset(56.0F, 0.0F, 0.0F) + ); + PartDefinition partDefinition5 = partDefinition3.addOrReplaceChild( + "left_front_leg", + CubeListBuilder.create().addBox("main", -4.0F, -4.0F, -4.0F, 8, 24, 8, 112, 104), + PartPose.offsetAndRotation(12.0F, 17.0F, -6.0F, 1.3F, 0.0F, 0.0F) + ); + PartDefinition partDefinition6 = partDefinition5.addOrReplaceChild( + "left_front_leg_tip", + CubeListBuilder.create().addBox("main", -3.0F, -1.0F, -3.0F, 6, 24, 6, 226, 138), + PartPose.offsetAndRotation(0.0F, 20.0F, -1.0F, -0.5F, 0.0F, 0.0F) + ); + partDefinition6.addOrReplaceChild( + "left_front_foot", + CubeListBuilder.create().addBox("main", -4.0F, 0.0F, -12.0F, 8, 4, 16, 144, 104), + PartPose.offsetAndRotation(0.0F, 23.0F, 0.0F, 0.75F, 0.0F, 0.0F) + ); + PartDefinition partDefinition7 = partDefinition3.addOrReplaceChild( + "left_hind_leg", + CubeListBuilder.create().addBox("main", -8.0F, -4.0F, -8.0F, 16, 32, 16, 0, 0), + PartPose.offsetAndRotation(16.0F, 13.0F, 34.0F, 1.0F, 0.0F, 0.0F) + ); + PartDefinition partDefinition8 = partDefinition7.addOrReplaceChild( + "left_hind_leg_tip", + CubeListBuilder.create().addBox("main", -6.0F, -2.0F, 0.0F, 12, 32, 12, 196, 0), + PartPose.offsetAndRotation(0.0F, 32.0F, -4.0F, 0.5F, 0.0F, 0.0F) + ); + partDefinition8.addOrReplaceChild( + "left_hind_foot", + CubeListBuilder.create().addBox("main", -9.0F, 0.0F, -20.0F, 18, 6, 24, 112, 0), + PartPose.offsetAndRotation(0.0F, 31.0F, 4.0F, 0.75F, 0.0F, 0.0F) + ); + PartDefinition partDefinition9 = partDefinition3.addOrReplaceChild( + "right_wing", + CubeListBuilder.create().addBox("bone", -56.0F, -4.0F, -4.0F, 56, 8, 8, 112, 88).addBox("skin", -56.0F, 0.0F, 2.0F, 56, 0, 56, -56, 88), + PartPose.offset(-12.0F, 2.0F, -6.0F) + ); + partDefinition9.addOrReplaceChild( + "right_wing_tip", + CubeListBuilder.create().addBox("bone", -56.0F, -2.0F, -2.0F, 56, 4, 4, 112, 136).addBox("skin", -56.0F, 0.0F, 2.0F, 56, 0, 56, -56, 144), + PartPose.offset(-56.0F, 0.0F, 0.0F) + ); + PartDefinition partDefinition10 = partDefinition3.addOrReplaceChild( + "right_front_leg", + CubeListBuilder.create().addBox("main", -4.0F, -4.0F, -4.0F, 8, 24, 8, 112, 104), + PartPose.offsetAndRotation(-12.0F, 17.0F, -6.0F, 1.3F, 0.0F, 0.0F) + ); + PartDefinition partDefinition11 = partDefinition10.addOrReplaceChild( + "right_front_leg_tip", + CubeListBuilder.create().addBox("main", -3.0F, -1.0F, -3.0F, 6, 24, 6, 226, 138), + PartPose.offsetAndRotation(0.0F, 20.0F, -1.0F, -0.5F, 0.0F, 0.0F) + ); + partDefinition11.addOrReplaceChild( + "right_front_foot", + CubeListBuilder.create().addBox("main", -4.0F, 0.0F, -12.0F, 8, 4, 16, 144, 104), + PartPose.offsetAndRotation(0.0F, 23.0F, 0.0F, 0.75F, 0.0F, 0.0F) + ); + PartDefinition partDefinition12 = partDefinition3.addOrReplaceChild( + "right_hind_leg", + CubeListBuilder.create().addBox("main", -8.0F, -4.0F, -8.0F, 16, 32, 16, 0, 0), + PartPose.offsetAndRotation(-16.0F, 13.0F, 34.0F, 1.0F, 0.0F, 0.0F) + ); + PartDefinition partDefinition13 = partDefinition12.addOrReplaceChild( + "right_hind_leg_tip", + CubeListBuilder.create().addBox("main", -6.0F, -2.0F, 0.0F, 12, 32, 12, 196, 0), + PartPose.offsetAndRotation(0.0F, 32.0F, -4.0F, 0.5F, 0.0F, 0.0F) + ); + partDefinition13.addOrReplaceChild( + "right_hind_foot", + CubeListBuilder.create().addBox("main", -9.0F, 0.0F, -20.0F, 18, 6, 24, 112, 0), + PartPose.offsetAndRotation(0.0F, 31.0F, 4.0F, 0.75F, 0.0F, 0.0F) + ); + return LayerDefinition.create(meshDefinition, 256, 256); + } + + public void setupAnim(EnderDragonRenderState enderDragonRenderState) { + super.setupAnim(enderDragonRenderState); + float f = enderDragonRenderState.flapTime * (float) (Math.PI * 2); + this.jaw.xRot = (Mth.sin(f) + 1.0F) * 0.2F; + float g = Mth.sin(f - 1.0F) + 1.0F; + g = (g * g + g * 2.0F) * 0.05F; + this.root.y = (g - 2.0F) * 16.0F; + this.root.z = -48.0F; + this.root.xRot = g * 2.0F * (float) (Math.PI / 180.0); + float h = this.neckParts[0].x; + float i = this.neckParts[0].y; + float j = this.neckParts[0].z; + float k = 1.5F; + DragonFlightHistory.Sample sample = enderDragonRenderState.getHistoricalPos(6); + float l = Mth.wrapDegrees(enderDragonRenderState.getHistoricalPos(5).yRot() - enderDragonRenderState.getHistoricalPos(10).yRot()); + float m = Mth.wrapDegrees(enderDragonRenderState.getHistoricalPos(5).yRot() + l / 2.0F); + + for (int n = 0; n < 5; n++) { + ModelPart modelPart = this.neckParts[n]; + DragonFlightHistory.Sample sample2 = enderDragonRenderState.getHistoricalPos(5 - n); + float o = Mth.cos(n * 0.45F + f) * 0.15F; + modelPart.yRot = Mth.wrapDegrees(sample2.yRot() - sample.yRot()) * (float) (Math.PI / 180.0) * 1.5F; + modelPart.xRot = o + enderDragonRenderState.getHeadPartYOffset(n, sample, sample2) * (float) (Math.PI / 180.0) * 1.5F * 5.0F; + modelPart.zRot = -Mth.wrapDegrees(sample2.yRot() - m) * (float) (Math.PI / 180.0) * 1.5F; + modelPart.y = i; + modelPart.z = j; + modelPart.x = h; + h -= Mth.sin(modelPart.yRot) * Mth.cos(modelPart.xRot) * 10.0F; + i += Mth.sin(modelPart.xRot) * 10.0F; + j -= Mth.cos(modelPart.yRot) * Mth.cos(modelPart.xRot) * 10.0F; + } + + this.head.y = i; + this.head.z = j; + this.head.x = h; + DragonFlightHistory.Sample sample3 = enderDragonRenderState.getHistoricalPos(0); + this.head.yRot = Mth.wrapDegrees(sample3.yRot() - sample.yRot()) * (float) (Math.PI / 180.0); + this.head.xRot = Mth.wrapDegrees(enderDragonRenderState.getHeadPartYOffset(6, sample, sample3)) * (float) (Math.PI / 180.0) * 1.5F * 5.0F; + this.head.zRot = -Mth.wrapDegrees(sample3.yRot() - m) * (float) (Math.PI / 180.0); + this.body.zRot = -l * 1.5F * (float) (Math.PI / 180.0); + this.leftWing.xRot = 0.125F - Mth.cos(f) * 0.2F; + this.leftWing.yRot = -0.25F; + this.leftWing.zRot = -(Mth.sin(f) + 0.125F) * 0.8F; + this.leftWingTip.zRot = (Mth.sin(f + 2.0F) + 0.5F) * 0.75F; + this.rightWing.xRot = this.leftWing.xRot; + this.rightWing.yRot = -this.leftWing.yRot; + this.rightWing.zRot = -this.leftWing.zRot; + this.rightWingTip.zRot = -this.leftWingTip.zRot; + this.poseLimbs(g, this.leftFrontLeg, this.leftFrontLegTip, this.leftFrontFoot, this.leftRearLeg, this.leftRearLegTip, this.leftRearFoot); + this.poseLimbs(g, this.rightFrontLeg, this.rightFrontLegTip, this.rightFrontFoot, this.rightRearLeg, this.rightRearLegTip, this.rightRearFoot); + float p = 0.0F; + i = this.tailParts[0].y; + j = this.tailParts[0].z; + h = this.tailParts[0].x; + sample = enderDragonRenderState.getHistoricalPos(11); + + for (int q = 0; q < 12; q++) { + DragonFlightHistory.Sample sample4 = enderDragonRenderState.getHistoricalPos(12 + q); + p += Mth.sin(q * 0.45F + f) * 0.05F; + ModelPart modelPart2 = this.tailParts[q]; + modelPart2.yRot = (Mth.wrapDegrees(sample4.yRot() - sample.yRot()) * 1.5F + 180.0F) * (float) (Math.PI / 180.0); + modelPart2.xRot = p + (float)(sample4.y() - sample.y()) * (float) (Math.PI / 180.0) * 1.5F * 5.0F; + modelPart2.zRot = Mth.wrapDegrees(sample4.yRot() - m) * (float) (Math.PI / 180.0) * 1.5F; + modelPart2.y = i; + modelPart2.z = j; + modelPart2.x = h; + i += Mth.sin(modelPart2.xRot) * 10.0F; + j -= Mth.cos(modelPart2.yRot) * Mth.cos(modelPart2.xRot) * 10.0F; + h -= Mth.sin(modelPart2.yRot) * Mth.cos(modelPart2.xRot) * 10.0F; + } + } + + private void poseLimbs( + float f, ModelPart modelPart, ModelPart modelPart2, ModelPart modelPart3, ModelPart modelPart4, ModelPart modelPart5, ModelPart modelPart6 + ) { + modelPart4.xRot = 1.0F + f * 0.1F; + modelPart5.xRot = 0.5F + f * 0.1F; + modelPart6.xRot = 0.75F + f * 0.1F; + modelPart.xRot = 1.3F + f * 0.1F; + modelPart2.xRot = -0.5F - f * 0.1F; + modelPart3.xRot = 0.75F + f * 0.1F; + } +} diff --git a/net/minecraft/client/model/geom/LayerDefinitions.java b/net/minecraft/client/model/geom/LayerDefinitions.java index 35710dfe..d9446c1b 100644 --- a/net/minecraft/client/model/geom/LayerDefinitions.java +++ b/net/minecraft/client/model/geom/LayerDefinitions.java @@ -7,29 +7,35 @@ import java.util.Map; import java.util.stream.Collectors; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; +import net.minecraft.client.model.AbstractEquineModel; import net.minecraft.client.model.AllayModel; import net.minecraft.client.model.ArmadilloModel; import net.minecraft.client.model.ArmorStandArmorModel; import net.minecraft.client.model.ArmorStandModel; +import net.minecraft.client.model.ArrowModel; import net.minecraft.client.model.AxolotlModel; import net.minecraft.client.model.BatModel; import net.minecraft.client.model.BeeModel; +import net.minecraft.client.model.BeeStingerModel; +import net.minecraft.client.model.BellModel; import net.minecraft.client.model.BlazeModel; import net.minecraft.client.model.BoatModel; import net.minecraft.client.model.BoggedModel; import net.minecraft.client.model.BookModel; import net.minecraft.client.model.BreezeModel; import net.minecraft.client.model.CamelModel; -import net.minecraft.client.model.ChestBoatModel; -import net.minecraft.client.model.ChestRaftModel; -import net.minecraft.client.model.ChestedHorseModel; +import net.minecraft.client.model.CatModel; +import net.minecraft.client.model.ChestModel; import net.minecraft.client.model.ChickenModel; import net.minecraft.client.model.CodModel; import net.minecraft.client.model.CowModel; +import net.minecraft.client.model.CreakingModel; import net.minecraft.client.model.CreeperModel; import net.minecraft.client.model.DolphinModel; +import net.minecraft.client.model.DonkeyModel; import net.minecraft.client.model.DrownedModel; import net.minecraft.client.model.ElytraModel; +import net.minecraft.client.model.EndCrystalModel; import net.minecraft.client.model.EndermanModel; import net.minecraft.client.model.EndermiteModel; import net.minecraft.client.model.EvokerFangsModel; @@ -39,7 +45,6 @@ import net.minecraft.client.model.GhastModel; import net.minecraft.client.model.GoatModel; import net.minecraft.client.model.GuardianModel; import net.minecraft.client.model.HoglinModel; -import net.minecraft.client.model.HorseModel; import net.minecraft.client.model.HumanoidArmorModel; import net.minecraft.client.model.HumanoidModel; import net.minecraft.client.model.IllagerModel; @@ -56,6 +61,8 @@ import net.minecraft.client.model.PhantomModel; import net.minecraft.client.model.PigModel; import net.minecraft.client.model.PiglinHeadModel; import net.minecraft.client.model.PiglinModel; +import net.minecraft.client.model.PlayerCapeModel; +import net.minecraft.client.model.PlayerEarsModel; import net.minecraft.client.model.PlayerModel; import net.minecraft.client.model.PolarBearModel; import net.minecraft.client.model.PufferfishBigModel; @@ -77,6 +84,7 @@ import net.minecraft.client.model.SlimeModel; import net.minecraft.client.model.SnifferModel; import net.minecraft.client.model.SnowGolemModel; import net.minecraft.client.model.SpiderModel; +import net.minecraft.client.model.SpinAttackEffectModel; import net.minecraft.client.model.SquidModel; import net.minecraft.client.model.StriderModel; import net.minecraft.client.model.TadpoleModel; @@ -93,21 +101,17 @@ import net.minecraft.client.model.WitherBossModel; import net.minecraft.client.model.WolfModel; import net.minecraft.client.model.ZombieVillagerModel; import net.minecraft.client.model.dragon.DragonHeadModel; +import net.minecraft.client.model.dragon.EnderDragonModel; import net.minecraft.client.model.geom.builders.CubeDeformation; import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshTransformer; import net.minecraft.client.renderer.blockentity.BannerRenderer; import net.minecraft.client.renderer.blockentity.BedRenderer; -import net.minecraft.client.renderer.blockentity.BellRenderer; -import net.minecraft.client.renderer.blockentity.ChestRenderer; import net.minecraft.client.renderer.blockentity.ConduitRenderer; import net.minecraft.client.renderer.blockentity.DecoratedPotRenderer; import net.minecraft.client.renderer.blockentity.HangingSignRenderer; import net.minecraft.client.renderer.blockentity.SignRenderer; -import net.minecraft.client.renderer.entity.EndCrystalRenderer; -import net.minecraft.client.renderer.entity.EnderDragonRenderer; import net.minecraft.client.renderer.entity.WitherSkullRenderer; -import net.minecraft.client.renderer.entity.layers.SpinAttackEffectLayer; -import net.minecraft.world.entity.vehicle.Boat; import net.minecraft.world.level.block.state.properties.WoodType; @Environment(EnvType.CLIENT) @@ -124,32 +128,74 @@ public class LayerDefinitions { LayerDefinition layerDefinition4 = LayerDefinition.create(HumanoidArmorModel.createBodyLayer(INNER_ARMOR_DEFORMATION), 64, 32); LayerDefinition layerDefinition5 = MinecartModel.createBodyLayer(); LayerDefinition layerDefinition6 = SkullModel.createMobHeadLayer(); - LayerDefinition layerDefinition7 = LayerDefinition.create(HorseModel.createBodyMesh(CubeDeformation.NONE), 64, 64); - LayerDefinition layerDefinition8 = IllagerModel.createBodyLayer(); - LayerDefinition layerDefinition9 = CowModel.createBodyLayer(); - LayerDefinition layerDefinition10 = LayerDefinition.create(OcelotModel.createBodyMesh(CubeDeformation.NONE), 64, 32); - LayerDefinition layerDefinition11 = LayerDefinition.create(PiglinModel.createMesh(CubeDeformation.NONE), 64, 64); - LayerDefinition layerDefinition12 = LayerDefinition.create(PiglinHeadModel.createHeadModel(), 64, 64); - LayerDefinition layerDefinition13 = SkullModel.createHumanoidHeadLayer(); - LayerDefinition layerDefinition14 = LlamaModel.createBodyLayer(CubeDeformation.NONE); - LayerDefinition layerDefinition15 = StriderModel.createBodyLayer(); - LayerDefinition layerDefinition16 = HoglinModel.createBodyLayer(); - LayerDefinition layerDefinition17 = SkeletonModel.createBodyLayer(); - LayerDefinition layerDefinition18 = LayerDefinition.create(VillagerModel.createBodyModel(), 64, 64); - LayerDefinition layerDefinition19 = SpiderModel.createSpiderBodyLayer(); + LayerDefinition layerDefinition7 = LayerDefinition.create(AbstractEquineModel.createBodyMesh(CubeDeformation.NONE), 64, 64); + LayerDefinition layerDefinition8 = LayerDefinition.create(AbstractEquineModel.createBabyMesh(CubeDeformation.NONE), 64, 64); + MeshTransformer meshTransformer = MeshTransformer.scaling(0.9375F); + LayerDefinition layerDefinition9 = IllagerModel.createBodyLayer().apply(meshTransformer); + LayerDefinition layerDefinition10 = AxolotlModel.createBodyLayer(); + LayerDefinition layerDefinition11 = BeeModel.createBodyLayer(); + LayerDefinition layerDefinition12 = CowModel.createBodyLayer(); + LayerDefinition layerDefinition13 = layerDefinition12.apply(CowModel.BABY_TRANSFORMER); + LayerDefinition layerDefinition14 = ElytraModel.createLayer(); + LayerDefinition layerDefinition15 = LayerDefinition.create(OcelotModel.createBodyMesh(CubeDeformation.NONE), 64, 32); + LayerDefinition layerDefinition16 = layerDefinition15.apply(CatModel.CAT_TRANSFORMER); + LayerDefinition layerDefinition17 = LayerDefinition.create(OcelotModel.createBodyMesh(new CubeDeformation(0.01F)), 64, 32).apply(CatModel.CAT_TRANSFORMER); + LayerDefinition layerDefinition18 = LayerDefinition.create(PiglinModel.createMesh(CubeDeformation.NONE), 64, 64); + LayerDefinition layerDefinition19 = LayerDefinition.create(PiglinHeadModel.createHeadModel(), 64, 64); + LayerDefinition layerDefinition20 = SkullModel.createHumanoidHeadLayer(); + LayerDefinition layerDefinition21 = LlamaModel.createBodyLayer(CubeDeformation.NONE); + LayerDefinition layerDefinition22 = LlamaModel.createBodyLayer(new CubeDeformation(0.5F)); + LayerDefinition layerDefinition23 = StriderModel.createBodyLayer(); + LayerDefinition layerDefinition24 = HoglinModel.createBodyLayer(); + LayerDefinition layerDefinition25 = HoglinModel.createBabyLayer(); + LayerDefinition layerDefinition26 = SkeletonModel.createBodyLayer(); + LayerDefinition layerDefinition27 = LayerDefinition.create(VillagerModel.createBodyModel(), 64, 64).apply(meshTransformer); + LayerDefinition layerDefinition28 = SpiderModel.createSpiderBodyLayer(); + LayerDefinition layerDefinition29 = ArmadilloModel.createBodyLayer(); + LayerDefinition layerDefinition30 = CamelModel.createBodyLayer(); + LayerDefinition layerDefinition31 = ChickenModel.createBodyLayer(); + LayerDefinition layerDefinition32 = GoatModel.createBodyLayer(); + LayerDefinition layerDefinition33 = PandaModel.createBodyLayer(); + LayerDefinition layerDefinition34 = PigModel.createBodyLayer(CubeDeformation.NONE); + LayerDefinition layerDefinition35 = PigModel.createBodyLayer(new CubeDeformation(0.5F)); + LayerDefinition layerDefinition36 = PolarBearModel.createBodyLayer(); + LayerDefinition layerDefinition37 = SheepModel.createBodyLayer(); + LayerDefinition layerDefinition38 = SheepFurModel.createFurLayer(); + LayerDefinition layerDefinition39 = SnifferModel.createBodyLayer(); + LayerDefinition layerDefinition40 = TurtleModel.createBodyLayer(); + LayerDefinition layerDefinition41 = LayerDefinition.create(WolfModel.createMeshDefinition(CubeDeformation.NONE), 64, 32); + LayerDefinition layerDefinition42 = LayerDefinition.create(WolfModel.createMeshDefinition(new CubeDeformation(0.2F)), 64, 32); + LayerDefinition layerDefinition43 = ZombieVillagerModel.createBodyLayer(); + LayerDefinition layerDefinition44 = ArmorStandModel.createBodyLayer(); + LayerDefinition layerDefinition45 = ArmorStandArmorModel.createBodyLayer(INNER_ARMOR_DEFORMATION); + LayerDefinition layerDefinition46 = ArmorStandArmorModel.createBodyLayer(OUTER_ARMOR_DEFORMATION); + LayerDefinition layerDefinition47 = DrownedModel.createBodyLayer(CubeDeformation.NONE); + LayerDefinition layerDefinition48 = DrownedModel.createBodyLayer(new CubeDeformation(0.25F)); + LayerDefinition layerDefinition49 = SquidModel.createBodyLayer(); + LayerDefinition layerDefinition50 = DolphinModel.createBodyLayer(); + LayerDefinition layerDefinition51 = SalmonModel.createBodyLayer(); builder.put(ModelLayers.ALLAY, AllayModel.createBodyLayer()); - builder.put(ModelLayers.ARMADILLO, ArmadilloModel.createBodyLayer()); - builder.put(ModelLayers.ARMOR_STAND, ArmorStandModel.createBodyLayer()); - builder.put(ModelLayers.ARMOR_STAND_INNER_ARMOR, ArmorStandArmorModel.createBodyLayer(INNER_ARMOR_DEFORMATION)); - builder.put(ModelLayers.ARMOR_STAND_OUTER_ARMOR, ArmorStandArmorModel.createBodyLayer(OUTER_ARMOR_DEFORMATION)); - builder.put(ModelLayers.AXOLOTL, AxolotlModel.createBodyLayer()); + builder.put(ModelLayers.ARMADILLO, layerDefinition29); + builder.put(ModelLayers.ARMADILLO_BABY, layerDefinition29.apply(ArmadilloModel.BABY_TRANSFORMER)); + builder.put(ModelLayers.ARMOR_STAND, layerDefinition44); + builder.put(ModelLayers.ARMOR_STAND_INNER_ARMOR, layerDefinition45); + builder.put(ModelLayers.ARMOR_STAND_OUTER_ARMOR, layerDefinition46); + builder.put(ModelLayers.ARMOR_STAND_SMALL, layerDefinition44.apply(HumanoidModel.BABY_TRANSFORMER)); + builder.put(ModelLayers.ARMOR_STAND_SMALL_INNER_ARMOR, layerDefinition45.apply(HumanoidModel.BABY_TRANSFORMER)); + builder.put(ModelLayers.ARMOR_STAND_SMALL_OUTER_ARMOR, layerDefinition46.apply(HumanoidModel.BABY_TRANSFORMER)); + builder.put(ModelLayers.ARROW, ArrowModel.createBodyLayer()); + builder.put(ModelLayers.AXOLOTL, layerDefinition10); + builder.put(ModelLayers.AXOLOTL_BABY, layerDefinition10.apply(AxolotlModel.BABY_TRANSFORMER)); builder.put(ModelLayers.BANNER, BannerRenderer.createBodyLayer()); builder.put(ModelLayers.BAT, BatModel.createBodyLayer()); builder.put(ModelLayers.BED_FOOT, BedRenderer.createFootLayer()); builder.put(ModelLayers.BED_HEAD, BedRenderer.createHeadLayer()); - builder.put(ModelLayers.BEE, BeeModel.createBodyLayer()); - builder.put(ModelLayers.BELL, BellRenderer.createBodyLayer()); + builder.put(ModelLayers.BEE, layerDefinition11); + builder.put(ModelLayers.BEE_BABY, layerDefinition11.apply(BeeModel.BABY_TRANSFORMER)); + builder.put(ModelLayers.BEE_STINGER, BeeStingerModel.createBodyLayer()); + builder.put(ModelLayers.BELL, BellModel.createBodyLayer()); builder.put(ModelLayers.BLAZE, BlazeModel.createBodyLayer()); + builder.put(ModelLayers.BOAT_WATER_PATCH, BoatModel.createWaterPatch()); builder.put(ModelLayers.BOGGED, BoggedModel.createBodyLayer()); builder.put(ModelLayers.BOGGED_INNER_ARMOR, layerDefinition4); builder.put(ModelLayers.BOGGED_OUTER_ARMOR, layerDefinition2); @@ -157,178 +203,252 @@ public class LayerDefinitions { builder.put(ModelLayers.BOOK, BookModel.createBodyLayer()); builder.put(ModelLayers.BREEZE, BreezeModel.createBodyLayer(32, 32)); builder.put(ModelLayers.BREEZE_WIND, BreezeModel.createBodyLayer(128, 128)); - builder.put(ModelLayers.CAT, layerDefinition10); - builder.put(ModelLayers.CAT_COLLAR, LayerDefinition.create(OcelotModel.createBodyMesh(new CubeDeformation(0.01F)), 64, 32)); - builder.put(ModelLayers.CAMEL, CamelModel.createBodyLayer()); - builder.put(ModelLayers.CAVE_SPIDER, layerDefinition19); - builder.put(ModelLayers.CHEST, ChestRenderer.createSingleBodyLayer()); + builder.put(ModelLayers.CAT, layerDefinition16); + builder.put(ModelLayers.CAT_BABY, layerDefinition16.apply(CatModel.BABY_TRANSFORMER)); + builder.put(ModelLayers.CAT_COLLAR, layerDefinition17); + builder.put(ModelLayers.CAT_BABY_COLLAR, layerDefinition17.apply(CatModel.BABY_TRANSFORMER)); + builder.put(ModelLayers.CAMEL, layerDefinition30); + builder.put(ModelLayers.CAMEL_BABY, layerDefinition30.apply(CamelModel.BABY_TRANSFORMER)); + builder.put(ModelLayers.CAVE_SPIDER, layerDefinition28.apply(MeshTransformer.scaling(0.7F))); + builder.put(ModelLayers.CHEST, ChestModel.createSingleBodyLayer()); builder.put(ModelLayers.CHEST_MINECART, layerDefinition5); - builder.put(ModelLayers.CHICKEN, ChickenModel.createBodyLayer()); + builder.put(ModelLayers.CHICKEN, layerDefinition31); + builder.put(ModelLayers.CHICKEN_BABY, layerDefinition31.apply(ChickenModel.BABY_TRANSFORMER)); builder.put(ModelLayers.COD, CodModel.createBodyLayer()); builder.put(ModelLayers.COMMAND_BLOCK_MINECART, layerDefinition5); builder.put(ModelLayers.CONDUIT_EYE, ConduitRenderer.createEyeLayer()); builder.put(ModelLayers.CONDUIT_WIND, ConduitRenderer.createWindLayer()); builder.put(ModelLayers.CONDUIT_SHELL, ConduitRenderer.createShellLayer()); builder.put(ModelLayers.CONDUIT_CAGE, ConduitRenderer.createCageLayer()); - builder.put(ModelLayers.COW, layerDefinition9); + builder.put(ModelLayers.COW, layerDefinition12); + builder.put(ModelLayers.COW_BABY, layerDefinition13); + builder.put(ModelLayers.CREAKING, CreakingModel.createBodyLayer()); builder.put(ModelLayers.CREEPER, CreeperModel.createBodyLayer(CubeDeformation.NONE)); builder.put(ModelLayers.CREEPER_ARMOR, CreeperModel.createBodyLayer(new CubeDeformation(2.0F))); builder.put(ModelLayers.CREEPER_HEAD, layerDefinition6); builder.put(ModelLayers.DECORATED_POT_BASE, DecoratedPotRenderer.createBaseLayer()); builder.put(ModelLayers.DECORATED_POT_SIDES, DecoratedPotRenderer.createSidesLayer()); - builder.put(ModelLayers.DOLPHIN, DolphinModel.createBodyLayer()); - builder.put(ModelLayers.DONKEY, ChestedHorseModel.createBodyLayer()); - builder.put(ModelLayers.DOUBLE_CHEST_LEFT, ChestRenderer.createDoubleBodyLeftLayer()); - builder.put(ModelLayers.DOUBLE_CHEST_RIGHT, ChestRenderer.createDoubleBodyRightLayer()); + builder.put(ModelLayers.DOLPHIN, layerDefinition50); + builder.put(ModelLayers.DOLPHIN_BABY, layerDefinition50.apply(DolphinModel.BABY_TRANSFORMER)); + builder.put(ModelLayers.DONKEY, DonkeyModel.createBodyLayer()); + builder.put(ModelLayers.DONKEY_BABY, DonkeyModel.createBabyLayer()); + builder.put(ModelLayers.DOUBLE_CHEST_LEFT, ChestModel.createDoubleBodyLeftLayer()); + builder.put(ModelLayers.DOUBLE_CHEST_RIGHT, ChestModel.createDoubleBodyRightLayer()); builder.put(ModelLayers.DRAGON_SKULL, DragonHeadModel.createHeadLayer()); - builder.put(ModelLayers.DROWNED, DrownedModel.createBodyLayer(CubeDeformation.NONE)); + builder.put(ModelLayers.DROWNED, layerDefinition47); builder.put(ModelLayers.DROWNED_INNER_ARMOR, layerDefinition4); builder.put(ModelLayers.DROWNED_OUTER_ARMOR, layerDefinition4); - builder.put(ModelLayers.DROWNED_OUTER_LAYER, DrownedModel.createBodyLayer(new CubeDeformation(0.25F))); - builder.put(ModelLayers.ELDER_GUARDIAN, GuardianModel.createBodyLayer()); - builder.put(ModelLayers.ELYTRA, ElytraModel.createLayer()); + builder.put(ModelLayers.DROWNED_OUTER_LAYER, layerDefinition48); + builder.put(ModelLayers.DROWNED_BABY, layerDefinition47.apply(HumanoidModel.BABY_TRANSFORMER)); + builder.put(ModelLayers.DROWNED_BABY_INNER_ARMOR, layerDefinition4.apply(HumanoidModel.BABY_TRANSFORMER)); + builder.put(ModelLayers.DROWNED_BABY_OUTER_ARMOR, layerDefinition4.apply(HumanoidModel.BABY_TRANSFORMER)); + builder.put(ModelLayers.DROWNED_BABY_OUTER_LAYER, layerDefinition48.apply(HumanoidModel.BABY_TRANSFORMER)); + builder.put(ModelLayers.ELDER_GUARDIAN, GuardianModel.createElderGuardianLayer()); + builder.put(ModelLayers.ELYTRA, layerDefinition14); + builder.put(ModelLayers.ELYTRA_BABY, layerDefinition14.apply(ElytraModel.BABY_TRANSFORMER)); builder.put(ModelLayers.ENDERMAN, EndermanModel.createBodyLayer()); builder.put(ModelLayers.ENDERMITE, EndermiteModel.createBodyLayer()); - builder.put(ModelLayers.ENDER_DRAGON, EnderDragonRenderer.createBodyLayer()); - builder.put(ModelLayers.END_CRYSTAL, EndCrystalRenderer.createBodyLayer()); - builder.put(ModelLayers.EVOKER, layerDefinition8); + builder.put(ModelLayers.ENDER_DRAGON, EnderDragonModel.createBodyLayer()); + builder.put(ModelLayers.END_CRYSTAL, EndCrystalModel.createBodyLayer()); + builder.put(ModelLayers.EVOKER, layerDefinition9); builder.put(ModelLayers.EVOKER_FANGS, EvokerFangsModel.createBodyLayer()); builder.put(ModelLayers.FOX, FoxModel.createBodyLayer()); + builder.put(ModelLayers.FOX_BABY, FoxModel.createBodyLayer().apply(FoxModel.BABY_TRANSFORMER)); builder.put(ModelLayers.FROG, FrogModel.createBodyLayer()); builder.put(ModelLayers.FURNACE_MINECART, layerDefinition5); builder.put(ModelLayers.GHAST, GhastModel.createBodyLayer()); - builder.put(ModelLayers.GIANT, layerDefinition); - builder.put(ModelLayers.GIANT_INNER_ARMOR, layerDefinition4); - builder.put(ModelLayers.GIANT_OUTER_ARMOR, layerDefinition2); - builder.put(ModelLayers.GLOW_SQUID, SquidModel.createBodyLayer()); - builder.put(ModelLayers.GOAT, GoatModel.createBodyLayer()); + MeshTransformer meshTransformer2 = MeshTransformer.scaling(6.0F); + builder.put(ModelLayers.GIANT, layerDefinition.apply(meshTransformer2)); + builder.put(ModelLayers.GIANT_INNER_ARMOR, layerDefinition4.apply(meshTransformer2)); + builder.put(ModelLayers.GIANT_OUTER_ARMOR, layerDefinition2.apply(meshTransformer2)); + builder.put(ModelLayers.GLOW_SQUID, layerDefinition49); + builder.put(ModelLayers.GLOW_SQUID_BABY, layerDefinition49.apply(SquidModel.BABY_TRANSFORMER)); + builder.put(ModelLayers.GOAT, layerDefinition32); + builder.put(ModelLayers.GOAT_BABY, layerDefinition32.apply(GoatModel.BABY_TRANSFORMER)); builder.put(ModelLayers.GUARDIAN, GuardianModel.createBodyLayer()); - builder.put(ModelLayers.HOGLIN, layerDefinition16); + builder.put(ModelLayers.HOGLIN, layerDefinition24); + builder.put(ModelLayers.HOGLIN_BABY, layerDefinition25); builder.put(ModelLayers.HOPPER_MINECART, layerDefinition5); builder.put(ModelLayers.HORSE, layerDefinition7); - builder.put(ModelLayers.HORSE_ARMOR, LayerDefinition.create(HorseModel.createBodyMesh(new CubeDeformation(0.1F)), 64, 64)); - builder.put(ModelLayers.HUSK, layerDefinition); - builder.put(ModelLayers.HUSK_INNER_ARMOR, layerDefinition4); - builder.put(ModelLayers.HUSK_OUTER_ARMOR, layerDefinition2); - builder.put(ModelLayers.ILLUSIONER, layerDefinition8); + builder.put(ModelLayers.HORSE_BABY, layerDefinition8); + builder.put(ModelLayers.HORSE_ARMOR, LayerDefinition.create(AbstractEquineModel.createBodyMesh(new CubeDeformation(0.1F)), 64, 64)); + builder.put(ModelLayers.HORSE_BABY_ARMOR, LayerDefinition.create(AbstractEquineModel.createBabyMesh(new CubeDeformation(0.1F)), 64, 64)); + MeshTransformer meshTransformer3 = MeshTransformer.scaling(1.0625F); + builder.put(ModelLayers.HUSK, layerDefinition.apply(meshTransformer3)); + builder.put(ModelLayers.HUSK_INNER_ARMOR, layerDefinition4.apply(meshTransformer3)); + builder.put(ModelLayers.HUSK_OUTER_ARMOR, layerDefinition2.apply(meshTransformer3)); + builder.put(ModelLayers.HUSK_BABY, layerDefinition.apply(HumanoidModel.BABY_TRANSFORMER).apply(meshTransformer3)); + builder.put(ModelLayers.HUSK_BABY_INNER_ARMOR, layerDefinition4.apply(HumanoidModel.BABY_TRANSFORMER).apply(meshTransformer3)); + builder.put(ModelLayers.HUSK_BABY_OUTER_ARMOR, layerDefinition2.apply(HumanoidModel.BABY_TRANSFORMER).apply(meshTransformer3)); + builder.put(ModelLayers.ILLUSIONER, layerDefinition9); builder.put(ModelLayers.IRON_GOLEM, IronGolemModel.createBodyLayer()); builder.put(ModelLayers.LEASH_KNOT, LeashKnotModel.createBodyLayer()); - builder.put(ModelLayers.LLAMA, layerDefinition14); - builder.put(ModelLayers.LLAMA_DECOR, LlamaModel.createBodyLayer(new CubeDeformation(0.5F))); + builder.put(ModelLayers.LLAMA, layerDefinition21); + builder.put(ModelLayers.LLAMA_BABY, layerDefinition21.apply(LlamaModel.BABY_TRANSFORMER)); + builder.put(ModelLayers.LLAMA_DECOR, layerDefinition22); + builder.put(ModelLayers.LLAMA_BABY_DECOR, layerDefinition22.apply(LlamaModel.BABY_TRANSFORMER)); builder.put(ModelLayers.LLAMA_SPIT, LlamaSpitModel.createBodyLayer()); builder.put(ModelLayers.MAGMA_CUBE, LavaSlimeModel.createBodyLayer()); builder.put(ModelLayers.MINECART, layerDefinition5); - builder.put(ModelLayers.MOOSHROOM, layerDefinition9); - builder.put(ModelLayers.MULE, ChestedHorseModel.createBodyLayer()); - builder.put(ModelLayers.OCELOT, layerDefinition10); - builder.put(ModelLayers.PANDA, PandaModel.createBodyLayer()); + builder.put(ModelLayers.MOOSHROOM, layerDefinition12); + builder.put(ModelLayers.MOOSHROOM_BABY, layerDefinition13); + builder.put(ModelLayers.MULE, DonkeyModel.createBodyLayer()); + builder.put(ModelLayers.MULE_BABY, DonkeyModel.createBabyLayer()); + builder.put(ModelLayers.OCELOT, layerDefinition15); + builder.put(ModelLayers.OCELOT_BABY, layerDefinition15.apply(OcelotModel.BABY_TRANSFORMER)); + builder.put(ModelLayers.PANDA, layerDefinition33); + builder.put(ModelLayers.PANDA_BABY, layerDefinition33.apply(PandaModel.BABY_TRANSFORMER)); builder.put(ModelLayers.PARROT, ParrotModel.createBodyLayer()); builder.put(ModelLayers.PHANTOM, PhantomModel.createBodyLayer()); - builder.put(ModelLayers.PIG, PigModel.createBodyLayer(CubeDeformation.NONE)); - builder.put(ModelLayers.PIG_SADDLE, PigModel.createBodyLayer(new CubeDeformation(0.5F))); - builder.put(ModelLayers.PIGLIN, layerDefinition11); + builder.put(ModelLayers.PIG, layerDefinition34); + builder.put(ModelLayers.PIG_BABY, layerDefinition34.apply(PigModel.BABY_TRANSFORMER)); + builder.put(ModelLayers.PIG_SADDLE, layerDefinition35); + builder.put(ModelLayers.PIG_BABY_SADDLE, layerDefinition35.apply(PigModel.BABY_TRANSFORMER)); + builder.put(ModelLayers.PIGLIN, layerDefinition18); builder.put(ModelLayers.PIGLIN_INNER_ARMOR, layerDefinition4); builder.put(ModelLayers.PIGLIN_OUTER_ARMOR, layerDefinition3); - builder.put(ModelLayers.PIGLIN_BRUTE, layerDefinition11); + builder.put(ModelLayers.PIGLIN_BRUTE, layerDefinition18); builder.put(ModelLayers.PIGLIN_BRUTE_INNER_ARMOR, layerDefinition4); builder.put(ModelLayers.PIGLIN_BRUTE_OUTER_ARMOR, layerDefinition3); - builder.put(ModelLayers.PIGLIN_HEAD, layerDefinition12); - builder.put(ModelLayers.PILLAGER, layerDefinition8); + builder.put(ModelLayers.PIGLIN_BABY, layerDefinition18.apply(HumanoidModel.BABY_TRANSFORMER)); + builder.put(ModelLayers.PIGLIN_BABY_INNER_ARMOR, layerDefinition4.apply(HumanoidModel.BABY_TRANSFORMER)); + builder.put(ModelLayers.PIGLIN_BABY_OUTER_ARMOR, layerDefinition3.apply(HumanoidModel.BABY_TRANSFORMER)); + builder.put(ModelLayers.PIGLIN_HEAD, layerDefinition19); + builder.put(ModelLayers.PILLAGER, layerDefinition9); builder.put(ModelLayers.PLAYER, LayerDefinition.create(PlayerModel.createMesh(CubeDeformation.NONE, false), 64, 64)); - builder.put(ModelLayers.PLAYER_HEAD, layerDefinition13); + builder.put(ModelLayers.PLAYER_EARS, PlayerEarsModel.createEarsLayer()); + builder.put(ModelLayers.PLAYER_CAPE, PlayerCapeModel.createCapeLayer()); + builder.put(ModelLayers.PLAYER_HEAD, layerDefinition20); builder.put(ModelLayers.PLAYER_INNER_ARMOR, layerDefinition4); builder.put(ModelLayers.PLAYER_OUTER_ARMOR, layerDefinition2); builder.put(ModelLayers.PLAYER_SLIM, LayerDefinition.create(PlayerModel.createMesh(CubeDeformation.NONE, true), 64, 64)); builder.put(ModelLayers.PLAYER_SLIM_INNER_ARMOR, layerDefinition4); builder.put(ModelLayers.PLAYER_SLIM_OUTER_ARMOR, layerDefinition2); - builder.put(ModelLayers.PLAYER_SPIN_ATTACK, SpinAttackEffectLayer.createLayer()); - builder.put(ModelLayers.POLAR_BEAR, PolarBearModel.createBodyLayer()); + builder.put(ModelLayers.PLAYER_SPIN_ATTACK, SpinAttackEffectModel.createLayer()); + builder.put(ModelLayers.POLAR_BEAR, layerDefinition36); + builder.put(ModelLayers.POLAR_BEAR_BABY, layerDefinition36.apply(PolarBearModel.BABY_TRANSFORMER)); builder.put(ModelLayers.PUFFERFISH_BIG, PufferfishBigModel.createBodyLayer()); builder.put(ModelLayers.PUFFERFISH_MEDIUM, PufferfishMidModel.createBodyLayer()); builder.put(ModelLayers.PUFFERFISH_SMALL, PufferfishSmallModel.createBodyLayer()); - builder.put(ModelLayers.RABBIT, RabbitModel.createBodyLayer()); + builder.put(ModelLayers.RABBIT, RabbitModel.createBodyLayer(false)); + builder.put(ModelLayers.RABBIT_BABY, RabbitModel.createBodyLayer(true)); builder.put(ModelLayers.RAVAGER, RavagerModel.createBodyLayer()); - builder.put(ModelLayers.SALMON, SalmonModel.createBodyLayer()); - builder.put(ModelLayers.SHEEP, SheepModel.createBodyLayer()); - builder.put(ModelLayers.SHEEP_FUR, SheepFurModel.createFurLayer()); + builder.put(ModelLayers.SALMON, layerDefinition51); + builder.put(ModelLayers.SALMON_SMALL, layerDefinition51.apply(SalmonModel.SMALL_TRANSFORMER)); + builder.put(ModelLayers.SALMON_LARGE, layerDefinition51.apply(SalmonModel.LARGE_TRANSFORMER)); + builder.put(ModelLayers.SHEEP, layerDefinition37); + builder.put(ModelLayers.SHEEP_BABY, layerDefinition37.apply(SheepModel.BABY_TRANSFORMER)); + builder.put(ModelLayers.SHEEP_WOOL, layerDefinition38); + builder.put(ModelLayers.SHEEP_BABY_WOOL, layerDefinition38.apply(SheepModel.BABY_TRANSFORMER)); builder.put(ModelLayers.SHIELD, ShieldModel.createLayer()); builder.put(ModelLayers.SHULKER, ShulkerModel.createBodyLayer()); + builder.put(ModelLayers.SHULKER_BOX, ShulkerModel.createBoxLayer()); builder.put(ModelLayers.SHULKER_BULLET, ShulkerBulletModel.createBodyLayer()); builder.put(ModelLayers.SILVERFISH, SilverfishModel.createBodyLayer()); - builder.put(ModelLayers.SKELETON, layerDefinition17); + builder.put(ModelLayers.SKELETON, layerDefinition26); builder.put(ModelLayers.SKELETON_INNER_ARMOR, layerDefinition4); builder.put(ModelLayers.SKELETON_OUTER_ARMOR, layerDefinition2); builder.put(ModelLayers.SKELETON_HORSE, layerDefinition7); + builder.put(ModelLayers.SKELETON_HORSE_BABY, layerDefinition8); builder.put(ModelLayers.SKELETON_SKULL, layerDefinition6); builder.put(ModelLayers.SLIME, SlimeModel.createInnerBodyLayer()); builder.put(ModelLayers.SLIME_OUTER, SlimeModel.createOuterBodyLayer()); - builder.put(ModelLayers.SNIFFER, SnifferModel.createBodyLayer()); + builder.put(ModelLayers.SNIFFER, layerDefinition39); + builder.put(ModelLayers.SNIFFER_BABY, layerDefinition39.apply(SnifferModel.BABY_TRANSFORMER)); builder.put(ModelLayers.SNOW_GOLEM, SnowGolemModel.createBodyLayer()); builder.put(ModelLayers.SPAWNER_MINECART, layerDefinition5); - builder.put(ModelLayers.SPIDER, layerDefinition19); - builder.put(ModelLayers.SQUID, SquidModel.createBodyLayer()); - builder.put(ModelLayers.STRAY, layerDefinition17); + builder.put(ModelLayers.SPIDER, layerDefinition28); + builder.put(ModelLayers.SQUID, layerDefinition49); + builder.put(ModelLayers.SQUID_BABY, layerDefinition49.apply(SquidModel.BABY_TRANSFORMER)); + builder.put(ModelLayers.STRAY, layerDefinition26); builder.put(ModelLayers.STRAY_INNER_ARMOR, layerDefinition4); builder.put(ModelLayers.STRAY_OUTER_ARMOR, layerDefinition2); builder.put(ModelLayers.STRAY_OUTER_LAYER, LayerDefinition.create(HumanoidModel.createMesh(new CubeDeformation(0.25F), 0.0F), 64, 32)); - builder.put(ModelLayers.STRIDER, layerDefinition15); - builder.put(ModelLayers.STRIDER_SADDLE, layerDefinition15); + builder.put(ModelLayers.STRIDER, layerDefinition23); + builder.put(ModelLayers.STRIDER_SADDLE, layerDefinition23); builder.put(ModelLayers.TADPOLE, TadpoleModel.createBodyLayer()); builder.put(ModelLayers.TNT_MINECART, layerDefinition5); - builder.put(ModelLayers.TRADER_LLAMA, layerDefinition14); + builder.put(ModelLayers.TRADER_LLAMA, layerDefinition21); + builder.put(ModelLayers.TRADER_LLAMA_BABY, layerDefinition21.apply(LlamaModel.BABY_TRANSFORMER)); builder.put(ModelLayers.TRIDENT, TridentModel.createLayer()); builder.put(ModelLayers.TROPICAL_FISH_LARGE, TropicalFishModelB.createBodyLayer(CubeDeformation.NONE)); builder.put(ModelLayers.TROPICAL_FISH_LARGE_PATTERN, TropicalFishModelB.createBodyLayer(FISH_PATTERN_DEFORMATION)); builder.put(ModelLayers.TROPICAL_FISH_SMALL, TropicalFishModelA.createBodyLayer(CubeDeformation.NONE)); builder.put(ModelLayers.TROPICAL_FISH_SMALL_PATTERN, TropicalFishModelA.createBodyLayer(FISH_PATTERN_DEFORMATION)); - builder.put(ModelLayers.TURTLE, TurtleModel.createBodyLayer()); + builder.put(ModelLayers.TURTLE, layerDefinition40); + builder.put(ModelLayers.TURTLE_BABY, layerDefinition40.apply(TurtleModel.BABY_TRANSFORMER)); builder.put(ModelLayers.VEX, VexModel.createBodyLayer()); - builder.put(ModelLayers.VILLAGER, layerDefinition18); - builder.put(ModelLayers.VINDICATOR, layerDefinition8); + builder.put(ModelLayers.VILLAGER, layerDefinition27); + builder.put(ModelLayers.VINDICATOR, layerDefinition9); builder.put(ModelLayers.WARDEN, WardenModel.createBodyLayer()); - builder.put(ModelLayers.WANDERING_TRADER, layerDefinition18); + builder.put(ModelLayers.WANDERING_TRADER, layerDefinition27); builder.put(ModelLayers.WIND_CHARGE, WindChargeModel.createBodyLayer()); - builder.put(ModelLayers.WITCH, WitchModel.createBodyLayer()); + builder.put(ModelLayers.WITCH, WitchModel.createBodyLayer().apply(meshTransformer)); builder.put(ModelLayers.WITHER, WitherBossModel.createBodyLayer(CubeDeformation.NONE)); builder.put(ModelLayers.WITHER_ARMOR, WitherBossModel.createBodyLayer(INNER_ARMOR_DEFORMATION)); builder.put(ModelLayers.WITHER_SKULL, WitherSkullRenderer.createSkullLayer()); - builder.put(ModelLayers.WITHER_SKELETON, layerDefinition17); - builder.put(ModelLayers.WITHER_SKELETON_INNER_ARMOR, layerDefinition4); - builder.put(ModelLayers.WITHER_SKELETON_OUTER_ARMOR, layerDefinition2); + MeshTransformer meshTransformer4 = MeshTransformer.scaling(1.2F); + builder.put(ModelLayers.WITHER_SKELETON, layerDefinition26.apply(meshTransformer4)); + builder.put(ModelLayers.WITHER_SKELETON_INNER_ARMOR, layerDefinition4.apply(meshTransformer4)); + builder.put(ModelLayers.WITHER_SKELETON_OUTER_ARMOR, layerDefinition2.apply(meshTransformer4)); builder.put(ModelLayers.WITHER_SKELETON_SKULL, layerDefinition6); - builder.put(ModelLayers.WOLF, LayerDefinition.create(WolfModel.createMeshDefinition(CubeDeformation.NONE), 64, 32)); - builder.put(ModelLayers.WOLF_ARMOR, LayerDefinition.create(WolfModel.createMeshDefinition(new CubeDeformation(0.2F)), 64, 32)); - builder.put(ModelLayers.ZOGLIN, layerDefinition16); + builder.put(ModelLayers.WOLF, layerDefinition41); + builder.put(ModelLayers.WOLF_ARMOR, layerDefinition42); + builder.put(ModelLayers.WOLF_BABY, layerDefinition41.apply(WolfModel.BABY_TRANSFORMER)); + builder.put(ModelLayers.WOLF_BABY_ARMOR, layerDefinition42.apply(WolfModel.BABY_TRANSFORMER)); + builder.put(ModelLayers.ZOGLIN, layerDefinition24); + builder.put(ModelLayers.ZOGLIN_BABY, layerDefinition25); builder.put(ModelLayers.ZOMBIE, layerDefinition); builder.put(ModelLayers.ZOMBIE_INNER_ARMOR, layerDefinition4); builder.put(ModelLayers.ZOMBIE_OUTER_ARMOR, layerDefinition2); - builder.put(ModelLayers.ZOMBIE_HEAD, layerDefinition13); + builder.put(ModelLayers.ZOMBIE_BABY, layerDefinition.apply(HumanoidModel.BABY_TRANSFORMER)); + builder.put(ModelLayers.ZOMBIE_BABY_INNER_ARMOR, layerDefinition4.apply(HumanoidModel.BABY_TRANSFORMER)); + builder.put(ModelLayers.ZOMBIE_BABY_OUTER_ARMOR, layerDefinition2.apply(HumanoidModel.BABY_TRANSFORMER)); + builder.put(ModelLayers.ZOMBIE_HEAD, layerDefinition20); builder.put(ModelLayers.ZOMBIE_HORSE, layerDefinition7); - builder.put(ModelLayers.ZOMBIE_VILLAGER, ZombieVillagerModel.createBodyLayer()); + builder.put(ModelLayers.ZOMBIE_HORSE_BABY, layerDefinition8); + builder.put(ModelLayers.ZOMBIE_VILLAGER, layerDefinition43); builder.put(ModelLayers.ZOMBIE_VILLAGER_INNER_ARMOR, ZombieVillagerModel.createArmorLayer(INNER_ARMOR_DEFORMATION)); builder.put(ModelLayers.ZOMBIE_VILLAGER_OUTER_ARMOR, ZombieVillagerModel.createArmorLayer(OUTER_ARMOR_DEFORMATION)); - builder.put(ModelLayers.ZOMBIFIED_PIGLIN, layerDefinition11); + builder.put(ModelLayers.ZOMBIE_VILLAGER_BABY, layerDefinition43.apply(HumanoidModel.BABY_TRANSFORMER)); + builder.put(ModelLayers.ZOMBIE_VILLAGER_BABY_INNER_ARMOR, ZombieVillagerModel.createArmorLayer(INNER_ARMOR_DEFORMATION).apply(HumanoidModel.BABY_TRANSFORMER)); + builder.put(ModelLayers.ZOMBIE_VILLAGER_BABY_OUTER_ARMOR, ZombieVillagerModel.createArmorLayer(OUTER_ARMOR_DEFORMATION).apply(HumanoidModel.BABY_TRANSFORMER)); + builder.put(ModelLayers.ZOMBIFIED_PIGLIN, layerDefinition18); builder.put(ModelLayers.ZOMBIFIED_PIGLIN_INNER_ARMOR, layerDefinition4); builder.put(ModelLayers.ZOMBIFIED_PIGLIN_OUTER_ARMOR, layerDefinition3); - LayerDefinition layerDefinition20 = BoatModel.createBodyModel(); - LayerDefinition layerDefinition21 = ChestBoatModel.createBodyModel(); - LayerDefinition layerDefinition22 = RaftModel.createBodyModel(); - LayerDefinition layerDefinition23 = ChestRaftModel.createBodyModel(); - - for (Boat.Type type : Boat.Type.values()) { - if (type == Boat.Type.BAMBOO) { - builder.put(ModelLayers.createBoatModelName(type), layerDefinition22); - builder.put(ModelLayers.createChestBoatModelName(type), layerDefinition23); - } else { - builder.put(ModelLayers.createBoatModelName(type), layerDefinition20); - builder.put(ModelLayers.createChestBoatModelName(type), layerDefinition21); - } - } - - LayerDefinition layerDefinition24 = SignRenderer.createSignLayer(); - WoodType.values().forEach(woodType -> builder.put(ModelLayers.createSignModelName(woodType), layerDefinition24)); - LayerDefinition layerDefinition25 = HangingSignRenderer.createHangingSignLayer(); - WoodType.values().forEach(woodType -> builder.put(ModelLayers.createHangingSignModelName(woodType), layerDefinition25)); + builder.put(ModelLayers.ZOMBIFIED_PIGLIN_BABY, layerDefinition18.apply(HumanoidModel.BABY_TRANSFORMER)); + builder.put(ModelLayers.ZOMBIFIED_PIGLIN_BABY_INNER_ARMOR, layerDefinition4.apply(HumanoidModel.BABY_TRANSFORMER)); + builder.put(ModelLayers.ZOMBIFIED_PIGLIN_BABY_OUTER_ARMOR, layerDefinition3.apply(HumanoidModel.BABY_TRANSFORMER)); + builder.put(ModelLayers.BAMBOO_RAFT, RaftModel.createRaftModel()); + builder.put(ModelLayers.BAMBOO_CHEST_RAFT, RaftModel.createChestRaftModel()); + LayerDefinition layerDefinition52 = BoatModel.createBoatModel(); + LayerDefinition layerDefinition53 = BoatModel.createChestBoatModel(); + builder.put(ModelLayers.OAK_BOAT, layerDefinition52); + builder.put(ModelLayers.OAK_CHEST_BOAT, layerDefinition53); + builder.put(ModelLayers.SPRUCE_BOAT, layerDefinition52); + builder.put(ModelLayers.SPRUCE_CHEST_BOAT, layerDefinition53); + builder.put(ModelLayers.BIRCH_BOAT, layerDefinition52); + builder.put(ModelLayers.BIRCH_CHEST_BOAT, layerDefinition53); + builder.put(ModelLayers.JUNGLE_BOAT, layerDefinition52); + builder.put(ModelLayers.JUNGLE_CHEST_BOAT, layerDefinition53); + builder.put(ModelLayers.ACACIA_BOAT, layerDefinition52); + builder.put(ModelLayers.ACACIA_CHEST_BOAT, layerDefinition53); + builder.put(ModelLayers.CHERRY_BOAT, layerDefinition52); + builder.put(ModelLayers.CHERRY_CHEST_BOAT, layerDefinition53); + builder.put(ModelLayers.DARK_OAK_BOAT, layerDefinition52); + builder.put(ModelLayers.DARK_OAK_CHEST_BOAT, layerDefinition53); + builder.put(ModelLayers.PALE_OAK_BOAT, layerDefinition52); + builder.put(ModelLayers.PALE_OAK_CHEST_BOAT, layerDefinition53); + builder.put(ModelLayers.MANGROVE_BOAT, layerDefinition52); + builder.put(ModelLayers.MANGROVE_CHEST_BOAT, layerDefinition53); + LayerDefinition layerDefinition54 = SignRenderer.createSignLayer(true); + LayerDefinition layerDefinition55 = SignRenderer.createSignLayer(false); + LayerDefinition layerDefinition56 = HangingSignRenderer.createHangingSignLayer(); + WoodType.values().forEach(woodType -> { + builder.put(ModelLayers.createStandingSignModelName(woodType), layerDefinition54); + builder.put(ModelLayers.createWallSignModelName(woodType), layerDefinition55); + builder.put(ModelLayers.createHangingSignModelName(woodType), layerDefinition56); + }); ImmutableMap immutableMap = builder.build(); List list = (List)ModelLayers.getKnownLocations() .filter(modelLayerLocation -> !immutableMap.containsKey(modelLayerLocation)) diff --git a/net/minecraft/client/model/geom/ModelLayerLocation.java b/net/minecraft/client/model/geom/ModelLayerLocation.java index fb3a4311..0bac6a94 100644 --- a/net/minecraft/client/model/geom/ModelLayerLocation.java +++ b/net/minecraft/client/model/geom/ModelLayerLocation.java @@ -5,38 +5,7 @@ import net.fabricmc.api.Environment; import net.minecraft.resources.ResourceLocation; @Environment(EnvType.CLIENT) -public final class ModelLayerLocation { - private final ResourceLocation model; - private final String layer; - - public ModelLayerLocation(ResourceLocation model, String layer) { - this.model = model; - this.layer = layer; - } - - public ResourceLocation getModel() { - return this.model; - } - - public String getLayer() { - return this.layer; - } - - public boolean equals(Object object) { - if (this == object) { - return true; - } else { - return !(object instanceof ModelLayerLocation modelLayerLocation) - ? false - : this.model.equals(modelLayerLocation.model) && this.layer.equals(modelLayerLocation.layer); - } - } - - public int hashCode() { - int i = this.model.hashCode(); - return 31 * i + this.layer.hashCode(); - } - +public record ModelLayerLocation(ResourceLocation model, String layer) { public String toString() { return this.model + "#" + this.layer; } diff --git a/net/minecraft/client/model/geom/ModelLayers.java b/net/minecraft/client/model/geom/ModelLayers.java index 401044c4..3ed19654 100644 --- a/net/minecraft/client/model/geom/ModelLayers.java +++ b/net/minecraft/client/model/geom/ModelLayers.java @@ -6,26 +6,40 @@ import java.util.stream.Stream; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.entity.vehicle.Boat; import net.minecraft.world.level.block.state.properties.WoodType; @Environment(EnvType.CLIENT) public class ModelLayers { private static final String DEFAULT_LAYER = "main"; private static final Set ALL_MODELS = Sets.newHashSet(); + public static final ModelLayerLocation ACACIA_BOAT = register("boat/acacia"); + public static final ModelLayerLocation ACACIA_CHEST_BOAT = register("chest_boat/acacia"); public static final ModelLayerLocation ALLAY = register("allay"); public static final ModelLayerLocation ARMADILLO = register("armadillo"); + public static final ModelLayerLocation ARMADILLO_BABY = register("armadillo_baby"); public static final ModelLayerLocation ARMOR_STAND = register("armor_stand"); public static final ModelLayerLocation ARMOR_STAND_INNER_ARMOR = registerInnerArmor("armor_stand"); public static final ModelLayerLocation ARMOR_STAND_OUTER_ARMOR = registerOuterArmor("armor_stand"); + public static final ModelLayerLocation ARMOR_STAND_SMALL = register("armor_stand_small"); + public static final ModelLayerLocation ARMOR_STAND_SMALL_INNER_ARMOR = registerInnerArmor("armor_stand_small"); + public static final ModelLayerLocation ARMOR_STAND_SMALL_OUTER_ARMOR = registerOuterArmor("armor_stand_small"); + public static final ModelLayerLocation ARROW = register("arrow"); public static final ModelLayerLocation AXOLOTL = register("axolotl"); + public static final ModelLayerLocation AXOLOTL_BABY = register("axolotl_baby"); + public static final ModelLayerLocation BAMBOO_CHEST_RAFT = register("chest_boat/bamboo"); + public static final ModelLayerLocation BAMBOO_RAFT = register("boat/bamboo"); public static final ModelLayerLocation BANNER = register("banner"); public static final ModelLayerLocation BAT = register("bat"); public static final ModelLayerLocation BED_FOOT = register("bed_foot"); public static final ModelLayerLocation BED_HEAD = register("bed_head"); public static final ModelLayerLocation BEE = register("bee"); + public static final ModelLayerLocation BEE_BABY = register("bee_baby"); + public static final ModelLayerLocation BEE_STINGER = register("bee_stinger"); public static final ModelLayerLocation BELL = register("bell"); + public static final ModelLayerLocation BIRCH_BOAT = register("boat/birch"); + public static final ModelLayerLocation BIRCH_CHEST_BOAT = register("chest_boat/birch"); public static final ModelLayerLocation BLAZE = register("blaze"); + public static final ModelLayerLocation BOAT_WATER_PATCH = register("boat", "water_patch"); public static final ModelLayerLocation BOGGED = register("bogged"); public static final ModelLayerLocation BOGGED_INNER_ARMOR = registerInnerArmor("bogged"); public static final ModelLayerLocation BOGGED_OUTER_ARMOR = registerOuterArmor("bogged"); @@ -33,13 +47,19 @@ public class ModelLayers { public static final ModelLayerLocation BOOK = register("book"); public static final ModelLayerLocation BREEZE = register("breeze"); public static final ModelLayerLocation BREEZE_WIND = register("breeze_wind"); - public static final ModelLayerLocation CAT = register("cat"); - public static final ModelLayerLocation CAT_COLLAR = register("cat", "collar"); public static final ModelLayerLocation CAMEL = register("camel"); + public static final ModelLayerLocation CAMEL_BABY = register("camel_baby"); + public static final ModelLayerLocation CAT = register("cat"); + public static final ModelLayerLocation CAT_BABY = register("cat_baby"); + public static final ModelLayerLocation CAT_BABY_COLLAR = register("cat_baby", "collar"); + public static final ModelLayerLocation CAT_COLLAR = register("cat", "collar"); public static final ModelLayerLocation CAVE_SPIDER = register("cave_spider"); + public static final ModelLayerLocation CHERRY_BOAT = register("boat/cherry"); + public static final ModelLayerLocation CHERRY_CHEST_BOAT = register("chest_boat/cherry"); public static final ModelLayerLocation CHEST = register("chest"); public static final ModelLayerLocation CHEST_MINECART = register("chest_minecart"); public static final ModelLayerLocation CHICKEN = register("chicken"); + public static final ModelLayerLocation CHICKEN_BABY = register("chicken_baby"); public static final ModelLayerLocation COD = register("cod"); public static final ModelLayerLocation COMMAND_BLOCK_MINECART = register("command_block_minecart"); public static final ModelLayerLocation CONDUIT_CAGE = register("conduit", "cage"); @@ -47,22 +67,33 @@ public class ModelLayers { public static final ModelLayerLocation CONDUIT_SHELL = register("conduit", "shell"); public static final ModelLayerLocation CONDUIT_WIND = register("conduit", "wind"); public static final ModelLayerLocation COW = register("cow"); + public static final ModelLayerLocation COW_BABY = register("cow_baby"); + public static final ModelLayerLocation CREAKING = register("creaking"); public static final ModelLayerLocation CREEPER = register("creeper"); public static final ModelLayerLocation CREEPER_ARMOR = register("creeper", "armor"); public static final ModelLayerLocation CREEPER_HEAD = register("creeper_head"); + public static final ModelLayerLocation DARK_OAK_BOAT = register("boat/dark_oak"); + public static final ModelLayerLocation DARK_OAK_CHEST_BOAT = register("chest_boat/dark_oak"); public static final ModelLayerLocation DECORATED_POT_BASE = register("decorated_pot_base"); public static final ModelLayerLocation DECORATED_POT_SIDES = register("decorated_pot_sides"); public static final ModelLayerLocation DOLPHIN = register("dolphin"); + public static final ModelLayerLocation DOLPHIN_BABY = register("dolphin_baby"); public static final ModelLayerLocation DONKEY = register("donkey"); + public static final ModelLayerLocation DONKEY_BABY = register("donkey_baby"); public static final ModelLayerLocation DOUBLE_CHEST_LEFT = register("double_chest_left"); public static final ModelLayerLocation DOUBLE_CHEST_RIGHT = register("double_chest_right"); public static final ModelLayerLocation DRAGON_SKULL = register("dragon_skull"); public static final ModelLayerLocation DROWNED = register("drowned"); + public static final ModelLayerLocation DROWNED_BABY = register("drowned_baby"); + public static final ModelLayerLocation DROWNED_BABY_INNER_ARMOR = registerInnerArmor("drowned_baby"); + public static final ModelLayerLocation DROWNED_BABY_OUTER_ARMOR = registerOuterArmor("drowned_baby"); + public static final ModelLayerLocation DROWNED_BABY_OUTER_LAYER = register("drowned_baby", "outer"); public static final ModelLayerLocation DROWNED_INNER_ARMOR = registerInnerArmor("drowned"); public static final ModelLayerLocation DROWNED_OUTER_ARMOR = registerOuterArmor("drowned"); public static final ModelLayerLocation DROWNED_OUTER_LAYER = register("drowned", "outer"); public static final ModelLayerLocation ELDER_GUARDIAN = register("elder_guardian"); public static final ModelLayerLocation ELYTRA = register("elytra"); + public static final ModelLayerLocation ELYTRA_BABY = register("elytra_baby"); public static final ModelLayerLocation ENDERMAN = register("enderman"); public static final ModelLayerLocation ENDERMITE = register("endermite"); public static final ModelLayerLocation ENDER_DRAGON = register("ender_dragon"); @@ -70,6 +101,7 @@ public class ModelLayers { public static final ModelLayerLocation EVOKER = register("evoker"); public static final ModelLayerLocation EVOKER_FANGS = register("evoker_fangs"); public static final ModelLayerLocation FOX = register("fox"); + public static final ModelLayerLocation FOX_BABY = register("fox_baby"); public static final ModelLayerLocation FROG = register("frog"); public static final ModelLayerLocation FURNACE_MINECART = register("furnace_minecart"); public static final ModelLayerLocation GHAST = register("ghast"); @@ -77,40 +109,69 @@ public class ModelLayers { public static final ModelLayerLocation GIANT_INNER_ARMOR = registerInnerArmor("giant"); public static final ModelLayerLocation GIANT_OUTER_ARMOR = registerOuterArmor("giant"); public static final ModelLayerLocation GLOW_SQUID = register("glow_squid"); + public static final ModelLayerLocation GLOW_SQUID_BABY = register("glow_squid_baby"); public static final ModelLayerLocation GOAT = register("goat"); + public static final ModelLayerLocation GOAT_BABY = register("goat_baby"); public static final ModelLayerLocation GUARDIAN = register("guardian"); public static final ModelLayerLocation HOGLIN = register("hoglin"); + public static final ModelLayerLocation HOGLIN_BABY = register("hoglin_baby"); public static final ModelLayerLocation HOPPER_MINECART = register("hopper_minecart"); public static final ModelLayerLocation HORSE = register("horse"); public static final ModelLayerLocation HORSE_ARMOR = register("horse_armor"); + public static final ModelLayerLocation HORSE_BABY = register("horse_baby"); + public static final ModelLayerLocation HORSE_BABY_ARMOR = register("horse_armor_baby"); public static final ModelLayerLocation HUSK = register("husk"); + public static final ModelLayerLocation HUSK_BABY = register("husk_baby"); + public static final ModelLayerLocation HUSK_BABY_INNER_ARMOR = registerInnerArmor("husk_baby"); + public static final ModelLayerLocation HUSK_BABY_OUTER_ARMOR = registerOuterArmor("husk_baby"); public static final ModelLayerLocation HUSK_INNER_ARMOR = registerInnerArmor("husk"); public static final ModelLayerLocation HUSK_OUTER_ARMOR = registerOuterArmor("husk"); public static final ModelLayerLocation ILLUSIONER = register("illusioner"); public static final ModelLayerLocation IRON_GOLEM = register("iron_golem"); + public static final ModelLayerLocation JUNGLE_BOAT = register("boat/jungle"); + public static final ModelLayerLocation JUNGLE_CHEST_BOAT = register("chest_boat/jungle"); public static final ModelLayerLocation LEASH_KNOT = register("leash_knot"); public static final ModelLayerLocation LLAMA = register("llama"); + public static final ModelLayerLocation LLAMA_BABY = register("llama_baby"); + public static final ModelLayerLocation LLAMA_BABY_DECOR = register("llama_baby", "decor"); public static final ModelLayerLocation LLAMA_DECOR = register("llama", "decor"); public static final ModelLayerLocation LLAMA_SPIT = register("llama_spit"); public static final ModelLayerLocation MAGMA_CUBE = register("magma_cube"); + public static final ModelLayerLocation MANGROVE_BOAT = register("boat/mangrove"); + public static final ModelLayerLocation MANGROVE_CHEST_BOAT = register("chest_boat/mangrove"); public static final ModelLayerLocation MINECART = register("minecart"); public static final ModelLayerLocation MOOSHROOM = register("mooshroom"); + public static final ModelLayerLocation MOOSHROOM_BABY = register("mooshroom_baby"); public static final ModelLayerLocation MULE = register("mule"); + public static final ModelLayerLocation MULE_BABY = register("mule_baby"); + public static final ModelLayerLocation OAK_BOAT = register("boat/oak"); + public static final ModelLayerLocation OAK_CHEST_BOAT = register("chest_boat/oak"); public static final ModelLayerLocation OCELOT = register("ocelot"); + public static final ModelLayerLocation OCELOT_BABY = register("ocelot_baby"); + public static final ModelLayerLocation PALE_OAK_BOAT = register("boat/pale_oak"); + public static final ModelLayerLocation PALE_OAK_CHEST_BOAT = register("chest_boat/pale_oak"); public static final ModelLayerLocation PANDA = register("panda"); + public static final ModelLayerLocation PANDA_BABY = register("panda_baby"); public static final ModelLayerLocation PARROT = register("parrot"); public static final ModelLayerLocation PHANTOM = register("phantom"); public static final ModelLayerLocation PIG = register("pig"); public static final ModelLayerLocation PIGLIN = register("piglin"); + public static final ModelLayerLocation PIGLIN_BABY = register("piglin_baby"); + public static final ModelLayerLocation PIGLIN_BABY_INNER_ARMOR = registerInnerArmor("piglin_baby"); + public static final ModelLayerLocation PIGLIN_BABY_OUTER_ARMOR = registerOuterArmor("piglin_baby"); public static final ModelLayerLocation PIGLIN_BRUTE = register("piglin_brute"); public static final ModelLayerLocation PIGLIN_BRUTE_INNER_ARMOR = registerInnerArmor("piglin_brute"); public static final ModelLayerLocation PIGLIN_BRUTE_OUTER_ARMOR = registerOuterArmor("piglin_brute"); public static final ModelLayerLocation PIGLIN_HEAD = register("piglin_head"); public static final ModelLayerLocation PIGLIN_INNER_ARMOR = registerInnerArmor("piglin"); public static final ModelLayerLocation PIGLIN_OUTER_ARMOR = registerOuterArmor("piglin"); + public static final ModelLayerLocation PIG_BABY = register("pig_baby"); + public static final ModelLayerLocation PIG_BABY_SADDLE = register("pig_baby", "saddle"); public static final ModelLayerLocation PIG_SADDLE = register("pig", "saddle"); public static final ModelLayerLocation PILLAGER = register("pillager"); public static final ModelLayerLocation PLAYER = register("player"); + public static final ModelLayerLocation PLAYER_CAPE = register("player", "cape"); + public static final ModelLayerLocation PLAYER_EARS = register("player", "ears"); public static final ModelLayerLocation PLAYER_HEAD = register("player_head"); public static final ModelLayerLocation PLAYER_INNER_ARMOR = registerInnerArmor("player"); public static final ModelLayerLocation PLAYER_OUTER_ARMOR = registerOuterArmor("player"); @@ -119,30 +180,42 @@ public class ModelLayers { public static final ModelLayerLocation PLAYER_SLIM_OUTER_ARMOR = registerOuterArmor("player_slim"); public static final ModelLayerLocation PLAYER_SPIN_ATTACK = register("spin_attack"); public static final ModelLayerLocation POLAR_BEAR = register("polar_bear"); + public static final ModelLayerLocation POLAR_BEAR_BABY = register("polar_bear_baby"); public static final ModelLayerLocation PUFFERFISH_BIG = register("pufferfish_big"); public static final ModelLayerLocation PUFFERFISH_MEDIUM = register("pufferfish_medium"); public static final ModelLayerLocation PUFFERFISH_SMALL = register("pufferfish_small"); public static final ModelLayerLocation RABBIT = register("rabbit"); + public static final ModelLayerLocation RABBIT_BABY = register("rabbit_baby"); public static final ModelLayerLocation RAVAGER = register("ravager"); public static final ModelLayerLocation SALMON = register("salmon"); + public static final ModelLayerLocation SALMON_LARGE = register("salmon_large"); + public static final ModelLayerLocation SALMON_SMALL = register("salmon_small"); public static final ModelLayerLocation SHEEP = register("sheep"); - public static final ModelLayerLocation SHEEP_FUR = register("sheep", "fur"); + public static final ModelLayerLocation SHEEP_BABY = register("sheep_baby"); + public static final ModelLayerLocation SHEEP_BABY_WOOL = register("sheep_baby", "wool"); + public static final ModelLayerLocation SHEEP_WOOL = register("sheep", "wool"); public static final ModelLayerLocation SHIELD = register("shield"); public static final ModelLayerLocation SHULKER = register("shulker"); + public static final ModelLayerLocation SHULKER_BOX = register("shulker_box"); public static final ModelLayerLocation SHULKER_BULLET = register("shulker_bullet"); public static final ModelLayerLocation SILVERFISH = register("silverfish"); public static final ModelLayerLocation SKELETON = register("skeleton"); public static final ModelLayerLocation SKELETON_HORSE = register("skeleton_horse"); + public static final ModelLayerLocation SKELETON_HORSE_BABY = register("skeleton_horse_baby"); public static final ModelLayerLocation SKELETON_INNER_ARMOR = registerInnerArmor("skeleton"); public static final ModelLayerLocation SKELETON_OUTER_ARMOR = registerOuterArmor("skeleton"); public static final ModelLayerLocation SKELETON_SKULL = register("skeleton_skull"); public static final ModelLayerLocation SLIME = register("slime"); public static final ModelLayerLocation SLIME_OUTER = register("slime", "outer"); public static final ModelLayerLocation SNIFFER = register("sniffer"); + public static final ModelLayerLocation SNIFFER_BABY = register("sniffer_baby"); public static final ModelLayerLocation SNOW_GOLEM = register("snow_golem"); public static final ModelLayerLocation SPAWNER_MINECART = register("spawner_minecart"); public static final ModelLayerLocation SPIDER = register("spider"); + public static final ModelLayerLocation SPRUCE_BOAT = register("boat/spruce"); + public static final ModelLayerLocation SPRUCE_CHEST_BOAT = register("chest_boat/spruce"); public static final ModelLayerLocation SQUID = register("squid"); + public static final ModelLayerLocation SQUID_BABY = register("squid_baby"); public static final ModelLayerLocation STRAY = register("stray"); public static final ModelLayerLocation STRAY_INNER_ARMOR = registerInnerArmor("stray"); public static final ModelLayerLocation STRAY_OUTER_ARMOR = registerOuterArmor("stray"); @@ -152,17 +225,19 @@ public class ModelLayers { public static final ModelLayerLocation TADPOLE = register("tadpole"); public static final ModelLayerLocation TNT_MINECART = register("tnt_minecart"); public static final ModelLayerLocation TRADER_LLAMA = register("trader_llama"); + public static final ModelLayerLocation TRADER_LLAMA_BABY = register("trader_llama_baby"); public static final ModelLayerLocation TRIDENT = register("trident"); public static final ModelLayerLocation TROPICAL_FISH_LARGE = register("tropical_fish_large"); public static final ModelLayerLocation TROPICAL_FISH_LARGE_PATTERN = register("tropical_fish_large", "pattern"); public static final ModelLayerLocation TROPICAL_FISH_SMALL = register("tropical_fish_small"); public static final ModelLayerLocation TROPICAL_FISH_SMALL_PATTERN = register("tropical_fish_small", "pattern"); public static final ModelLayerLocation TURTLE = register("turtle"); + public static final ModelLayerLocation TURTLE_BABY = register("turtle_baby"); public static final ModelLayerLocation VEX = register("vex"); public static final ModelLayerLocation VILLAGER = register("villager"); public static final ModelLayerLocation VINDICATOR = register("vindicator"); - public static final ModelLayerLocation WARDEN = register("warden"); public static final ModelLayerLocation WANDERING_TRADER = register("wandering_trader"); + public static final ModelLayerLocation WARDEN = register("warden"); public static final ModelLayerLocation WIND_CHARGE = register("wind_charge"); public static final ModelLayerLocation WITCH = register("witch"); public static final ModelLayerLocation WITHER = register("wither"); @@ -174,16 +249,29 @@ public class ModelLayers { public static final ModelLayerLocation WITHER_SKULL = register("wither_skull"); public static final ModelLayerLocation WOLF = register("wolf"); public static final ModelLayerLocation WOLF_ARMOR = register("wolf_armor"); + public static final ModelLayerLocation WOLF_BABY = register("wolf_baby"); + public static final ModelLayerLocation WOLF_BABY_ARMOR = register("wolf_baby_armor"); public static final ModelLayerLocation ZOGLIN = register("zoglin"); + public static final ModelLayerLocation ZOGLIN_BABY = register("zoglin_baby"); public static final ModelLayerLocation ZOMBIE = register("zombie"); + public static final ModelLayerLocation ZOMBIE_BABY = register("zombie_baby"); + public static final ModelLayerLocation ZOMBIE_BABY_INNER_ARMOR = registerInnerArmor("zombie_baby"); + public static final ModelLayerLocation ZOMBIE_BABY_OUTER_ARMOR = registerOuterArmor("zombie_baby"); public static final ModelLayerLocation ZOMBIE_HEAD = register("zombie_head"); public static final ModelLayerLocation ZOMBIE_HORSE = register("zombie_horse"); + public static final ModelLayerLocation ZOMBIE_HORSE_BABY = register("zombie_horse_baby"); public static final ModelLayerLocation ZOMBIE_INNER_ARMOR = registerInnerArmor("zombie"); public static final ModelLayerLocation ZOMBIE_OUTER_ARMOR = registerOuterArmor("zombie"); public static final ModelLayerLocation ZOMBIE_VILLAGER = register("zombie_villager"); + public static final ModelLayerLocation ZOMBIE_VILLAGER_BABY = register("zombie_villager_baby"); + public static final ModelLayerLocation ZOMBIE_VILLAGER_BABY_INNER_ARMOR = registerInnerArmor("zombie_villager_baby"); + public static final ModelLayerLocation ZOMBIE_VILLAGER_BABY_OUTER_ARMOR = registerOuterArmor("zombie_villager_baby"); public static final ModelLayerLocation ZOMBIE_VILLAGER_INNER_ARMOR = registerInnerArmor("zombie_villager"); public static final ModelLayerLocation ZOMBIE_VILLAGER_OUTER_ARMOR = registerOuterArmor("zombie_villager"); public static final ModelLayerLocation ZOMBIFIED_PIGLIN = register("zombified_piglin"); + public static final ModelLayerLocation ZOMBIFIED_PIGLIN_BABY = register("zombified_piglin_baby"); + public static final ModelLayerLocation ZOMBIFIED_PIGLIN_BABY_INNER_ARMOR = registerInnerArmor("zombified_piglin_baby"); + public static final ModelLayerLocation ZOMBIFIED_PIGLIN_BABY_OUTER_ARMOR = registerOuterArmor("zombified_piglin_baby"); public static final ModelLayerLocation ZOMBIFIED_PIGLIN_INNER_ARMOR = registerInnerArmor("zombified_piglin"); public static final ModelLayerLocation ZOMBIFIED_PIGLIN_OUTER_ARMOR = registerOuterArmor("zombified_piglin"); @@ -212,24 +300,12 @@ public class ModelLayers { return register(path, "outer_armor"); } - public static ModelLayerLocation createRaftModelName(Boat.Type type) { - return createLocation("raft/" + type.getName(), "main"); + public static ModelLayerLocation createStandingSignModelName(WoodType woodType) { + return createLocation("sign/standing/" + woodType.name(), "main"); } - public static ModelLayerLocation createChestRaftModelName(Boat.Type type) { - return createLocation("chest_raft/" + type.getName(), "main"); - } - - public static ModelLayerLocation createBoatModelName(Boat.Type type) { - return createLocation("boat/" + type.getName(), "main"); - } - - public static ModelLayerLocation createChestBoatModelName(Boat.Type type) { - return createLocation("chest_boat/" + type.getName(), "main"); - } - - public static ModelLayerLocation createSignModelName(WoodType woodType) { - return createLocation("sign/" + woodType.name(), "main"); + public static ModelLayerLocation createWallSignModelName(WoodType woodType) { + return createLocation("sign/wall/" + woodType.name(), "main"); } public static ModelLayerLocation createHangingSignModelName(WoodType woodType) { diff --git a/net/minecraft/client/model/geom/ModelPart.java b/net/minecraft/client/model/geom/ModelPart.java index b3feb041..c0576774 100644 --- a/net/minecraft/client/model/geom/ModelPart.java +++ b/net/minecraft/client/model/geom/ModelPart.java @@ -11,6 +11,7 @@ import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.core.Direction; import net.minecraft.util.RandomSource; +import org.joml.Matrix3f; import org.joml.Matrix4f; import org.joml.Quaternionf; import org.joml.Vector3f; @@ -55,15 +56,15 @@ public final class ModelPart { } public void loadPose(PartPose partPose) { - this.x = partPose.x; - this.y = partPose.y; - this.z = partPose.z; - this.xRot = partPose.xRot; - this.yRot = partPose.yRot; - this.zRot = partPose.zRot; - this.xScale = 1.0F; - this.yScale = 1.0F; - this.zScale = 1.0F; + this.x = partPose.x(); + this.y = partPose.y(); + this.z = partPose.z(); + this.xRot = partPose.xRot(); + this.yRot = partPose.yRot(); + this.zRot = partPose.zRot(); + this.xScale = partPose.xScale(); + this.yScale = partPose.yScale(); + this.zScale = partPose.zScale(); } public void copyFrom(ModelPart modelPart) { @@ -125,6 +126,13 @@ public final class ModelPart { } } + public void rotateBy(Quaternionf quaternionf) { + Matrix3f matrix3f = new Matrix3f().rotationZYX(this.zRot, this.yRot, this.xRot); + Matrix3f matrix3f2 = matrix3f.rotate(quaternionf); + Vector3f vector3f = matrix3f2.getEulerAnglesZYX(new Vector3f()); + this.setRotation(vector3f.x, vector3f.y, vector3f.z); + } + public void visit(PoseStack poseStack, ModelPart.Visitor visitor) { this.visit(poseStack, visitor, ""); } @@ -194,7 +202,7 @@ public final class ModelPart { @Environment(EnvType.CLIENT) public static class Cube { - private final ModelPart.Polygon[] polygons; + public final ModelPart.Polygon[] polygons; public final float minX; public final float minY; public final float minZ; @@ -318,14 +326,12 @@ public final class ModelPart { } @Environment(EnvType.CLIENT) - static class Polygon { - public final ModelPart.Vertex[] vertices; - public final Vector3f normal; + public record Polygon(ModelPart.Vertex[] vertices, Vector3f normal) { public Polygon( ModelPart.Vertex[] vertices, float u1, float v1, float u2, float v2, float textureWidth, float textureHeight, boolean mirror, Direction direction ) { - this.vertices = vertices; + this(vertices, direction.step()); float f = 0.0F / textureWidth; float g = 0.0F / textureHeight; vertices[0] = vertices[0].remap(u2 / textureWidth - f, v1 / textureHeight + g); @@ -342,7 +348,6 @@ public final class ModelPart { } } - this.normal = direction.step(); if (mirror) { this.normal.mul(-1.0F, 1.0F, 1.0F); } @@ -350,10 +355,7 @@ public final class ModelPart { } @Environment(EnvType.CLIENT) - static class Vertex { - public final Vector3f pos; - public final float u; - public final float v; + public record Vertex(Vector3f pos, float u, float v) { public Vertex(float x, float y, float z, float u, float v) { this(new Vector3f(x, y, z), u, v); @@ -362,12 +364,6 @@ public final class ModelPart { public ModelPart.Vertex remap(float u, float v) { return new ModelPart.Vertex(this.pos, u, v); } - - public Vertex(Vector3f pos, float u, float v) { - this.pos = pos; - this.u = u; - this.v = v; - } } @FunctionalInterface diff --git a/net/minecraft/client/model/geom/PartNames.java b/net/minecraft/client/model/geom/PartNames.java index 88f4cde6..53bbdf6d 100644 --- a/net/minecraft/client/model/geom/PartNames.java +++ b/net/minecraft/client/model/geom/PartNames.java @@ -60,6 +60,7 @@ public class PartNames { public static final String HEAD = "head"; public static final String HAT = "hat"; public static final String BODY = "body"; + public static final String UPPER_BODY = "upper_body"; public static final String HAT_RIM = "hat_rim"; public static final String JACKET = "jacket"; public static final String TOP_GILLS = "top_gills"; @@ -85,4 +86,10 @@ public class PartNames { public static final String RODS = "rods"; public static final String MUSHROOMS = "mushrooms"; public static final String BONE = "bone"; + public static final String LEFT_PADDLE = "left_paddle"; + public static final String RIGHT_PADDLE = "right_paddle"; + public static final String BOTTOM = "bottom"; + public static final String CHEST_BOTTOM = "chest_bottom"; + public static final String CHEST_LID = "chest_lid"; + public static final String CHEST_LOCK = "chest_lock"; } diff --git a/net/minecraft/client/model/geom/PartPose.java b/net/minecraft/client/model/geom/PartPose.java index 8f7f09e2..4684df6f 100644 --- a/net/minecraft/client/model/geom/PartPose.java +++ b/net/minecraft/client/model/geom/PartPose.java @@ -4,23 +4,8 @@ import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; @Environment(EnvType.CLIENT) -public class PartPose { +public record PartPose(float x, float y, float z, float xRot, float yRot, float zRot, float xScale, float yScale, float zScale) { public static final PartPose ZERO = offsetAndRotation(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F); - public final float x; - public final float y; - public final float z; - public final float xRot; - public final float yRot; - public final float zRot; - - private PartPose(float x, float y, float z, float xRot, float yRot, float zRot) { - this.x = x; - this.y = y; - this.z = z; - this.xRot = xRot; - this.yRot = yRot; - this.zRot = zRot; - } public static PartPose offset(float x, float y, float z) { return offsetAndRotation(x, y, z, 0.0F, 0.0F, 0.0F); @@ -31,6 +16,22 @@ public class PartPose { } public static PartPose offsetAndRotation(float x, float y, float z, float xRot, float yRot, float zRot) { - return new PartPose(x, y, z, xRot, yRot, zRot); + return new PartPose(x, y, z, xRot, yRot, zRot, 1.0F, 1.0F, 1.0F); + } + + public PartPose translated(float f, float g, float h) { + return new PartPose(this.x + f, this.y + g, this.z + h, this.xRot, this.yRot, this.zRot, this.xScale, this.yScale, this.zScale); + } + + public PartPose withScale(float f) { + return new PartPose(this.x, this.y, this.z, this.xRot, this.yRot, this.zRot, f, f, f); + } + + public PartPose scaled(float f) { + return f == 1.0F ? this : this.scaled(f, f, f); + } + + public PartPose scaled(float f, float g, float h) { + return new PartPose(this.x * f, this.y * g, this.z * h, this.xRot, this.yRot, this.zRot, this.xScale * f, this.yScale * g, this.zScale * h); } } diff --git a/net/minecraft/client/model/geom/builders/LayerDefinition.java b/net/minecraft/client/model/geom/builders/LayerDefinition.java index 62656555..089d75ea 100644 --- a/net/minecraft/client/model/geom/builders/LayerDefinition.java +++ b/net/minecraft/client/model/geom/builders/LayerDefinition.java @@ -14,6 +14,10 @@ public class LayerDefinition { this.material = material; } + public LayerDefinition apply(MeshTransformer meshTransformer) { + return new LayerDefinition(meshTransformer.apply(this.mesh), this.material); + } + public ModelPart bakeRoot() { return this.mesh.getRoot().bake(this.material.xTexSize, this.material.yTexSize); } diff --git a/net/minecraft/client/model/geom/builders/MeshDefinition.java b/net/minecraft/client/model/geom/builders/MeshDefinition.java index 797d6e16..6eb1fc52 100644 --- a/net/minecraft/client/model/geom/builders/MeshDefinition.java +++ b/net/minecraft/client/model/geom/builders/MeshDefinition.java @@ -1,15 +1,28 @@ package net.minecraft.client.model.geom.builders; import com.google.common.collect.ImmutableList; +import java.util.function.UnaryOperator; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.model.geom.PartPose; @Environment(EnvType.CLIENT) public class MeshDefinition { - private final PartDefinition root = new PartDefinition(ImmutableList.of(), PartPose.ZERO); + private final PartDefinition root; + + public MeshDefinition() { + this(new PartDefinition(ImmutableList.of(), PartPose.ZERO)); + } + + private MeshDefinition(PartDefinition partDefinition) { + this.root = partDefinition; + } public PartDefinition getRoot() { return this.root; } + + public MeshDefinition transformed(UnaryOperator unaryOperator) { + return new MeshDefinition(this.root.transformed(unaryOperator)); + } } diff --git a/net/minecraft/client/model/geom/builders/MeshTransformer.java b/net/minecraft/client/model/geom/builders/MeshTransformer.java new file mode 100644 index 00000000..6cb61008 --- /dev/null +++ b/net/minecraft/client/model/geom/builders/MeshTransformer.java @@ -0,0 +1,15 @@ +package net.minecraft.client.model.geom.builders; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; + +@FunctionalInterface +@Environment(EnvType.CLIENT) +public interface MeshTransformer { + static MeshTransformer scaling(float f) { + float g = 24.016F * (1.0F - f); + return meshDefinition -> meshDefinition.transformed(partPose -> partPose.scaled(f).translated(0.0F, g, 0.0F)); + } + + MeshDefinition apply(MeshDefinition meshDefinition); +} diff --git a/net/minecraft/client/model/geom/builders/PartDefinition.java b/net/minecraft/client/model/geom/builders/PartDefinition.java index 9e406c02..590c0d5d 100644 --- a/net/minecraft/client/model/geom/builders/PartDefinition.java +++ b/net/minecraft/client/model/geom/builders/PartDefinition.java @@ -5,7 +5,9 @@ import com.google.common.collect.Maps; import it.unimi.dsi.fastutil.objects.Object2ObjectArrayMap; import java.util.List; import java.util.Map; +import java.util.Set; import java.util.Map.Entry; +import java.util.function.UnaryOperator; import java.util.stream.Collectors; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; @@ -25,7 +27,11 @@ public class PartDefinition { public PartDefinition addOrReplaceChild(String name, CubeListBuilder cubes, PartPose partPose) { PartDefinition partDefinition = new PartDefinition(cubes.getCubes(), partPose); - PartDefinition partDefinition2 = (PartDefinition)this.children.put(name, partDefinition); + return this.addOrReplaceChild(name, partDefinition); + } + + public PartDefinition addOrReplaceChild(String string, PartDefinition partDefinition) { + PartDefinition partDefinition2 = (PartDefinition)this.children.put(string, partDefinition); if (partDefinition2 != null) { partDefinition.children.putAll(partDefinition2.children); } @@ -33,6 +39,10 @@ public class PartDefinition { return partDefinition; } + public PartDefinition clearChild(String string) { + return this.addOrReplaceChild(string, CubeListBuilder.create(), PartPose.ZERO); + } + public ModelPart bake(int texWidth, int texHeight) { Object2ObjectArrayMap object2ObjectArrayMap = (Object2ObjectArrayMap)this.children .entrySet() @@ -55,4 +65,14 @@ public class PartDefinition { public PartDefinition getChild(String name) { return (PartDefinition)this.children.get(name); } + + public Set> getChildren() { + return this.children.entrySet(); + } + + public PartDefinition transformed(UnaryOperator unaryOperator) { + PartDefinition partDefinition = new PartDefinition(this.cubes, (PartPose)unaryOperator.apply(this.partPose)); + partDefinition.children.putAll(this.children); + return partDefinition; + } } diff --git a/net/minecraft/client/multiplayer/ClientAdvancements.java b/net/minecraft/client/multiplayer/ClientAdvancements.java index 2dafb3f3..d5b96f05 100644 --- a/net/minecraft/client/multiplayer/ClientAdvancements.java +++ b/net/minecraft/client/multiplayer/ClientAdvancements.java @@ -64,7 +64,7 @@ public class ClientAdvancements { Optional optional = advancementNode.advancement().display(); if (optional.isPresent() && ((DisplayInfo)optional.get()).shouldShowToast()) { - this.minecraft.getToasts().addToast(new AdvancementToast(advancementNode.holder())); + this.minecraft.getToastManager().addToast(new AdvancementToast(advancementNode.holder())); } } } else { diff --git a/net/minecraft/client/multiplayer/ClientChunkCache.java b/net/minecraft/client/multiplayer/ClientChunkCache.java index 8a32589a..ec9d220b 100644 --- a/net/minecraft/client/multiplayer/ClientChunkCache.java +++ b/net/minecraft/client/multiplayer/ClientChunkCache.java @@ -1,6 +1,7 @@ package net.minecraft.client.multiplayer; import com.mojang.logging.LogUtils; +import it.unimi.dsi.fastutil.longs.LongOpenHashSet; import java.io.FileOutputStream; import java.io.IOException; import java.nio.charset.StandardCharsets; @@ -14,7 +15,7 @@ import net.minecraft.core.SectionPos; import net.minecraft.core.registries.Registries; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.FriendlyByteBuf; -import net.minecraft.network.protocol.game.ClientboundLevelChunkPacketData; +import net.minecraft.network.protocol.game.ClientboundLevelChunkPacketData.BlockEntityTagOutput; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.ChunkPos; import net.minecraft.world.level.LightLayer; @@ -22,6 +23,7 @@ import net.minecraft.world.level.biome.Biomes; import net.minecraft.world.level.chunk.ChunkSource; import net.minecraft.world.level.chunk.EmptyLevelChunk; import net.minecraft.world.level.chunk.LevelChunk; +import net.minecraft.world.level.chunk.LevelChunkSection; import net.minecraft.world.level.chunk.status.ChunkStatus; import net.minecraft.world.level.lighting.LevelLightEngine; import org.jetbrains.annotations.Nullable; @@ -37,7 +39,7 @@ public class ClientChunkCache extends ChunkSource { public ClientChunkCache(ClientLevel level, int viewDistance) { this.level = level; - this.emptyChunk = new EmptyLevelChunk(level, new ChunkPos(0, 0), level.registryAccess().registryOrThrow(Registries.BIOME).getHolderOrThrow(Biomes.PLAINS)); + this.emptyChunk = new EmptyLevelChunk(level, new ChunkPos(0, 0), level.registryAccess().lookupOrThrow(Registries.BIOME).getOrThrow(Biomes.PLAINS)); this.lightEngine = new LevelLightEngine(this, true, level.dimensionType().hasSkyLight()); this.storage = new ClientChunkCache.Storage(calculateStorageRange(viewDistance)); } @@ -61,7 +63,7 @@ public class ClientChunkCache extends ChunkSource { int i = this.storage.getIndex(chunkPos.x, chunkPos.z); LevelChunk levelChunk = this.storage.getChunk(i); if (isValidChunk(levelChunk, chunkPos.x, chunkPos.z)) { - this.storage.replace(i, levelChunk, null); + this.storage.drop(i, levelChunk); } } } @@ -98,9 +100,7 @@ public class ClientChunkCache extends ChunkSource { } @Nullable - public LevelChunk replaceWithPacketData( - int x, int z, FriendlyByteBuf buffer, CompoundTag tag, Consumer consumer - ) { + public LevelChunk replaceWithPacketData(int x, int z, FriendlyByteBuf buffer, CompoundTag tag, Consumer consumer) { if (!this.storage.inRange(x, z)) { LOGGER.warn("Ignoring chunk since it's not in the view range: {}, {}", x, z); return null; @@ -171,9 +171,19 @@ public class ClientChunkCache extends ChunkSource { Minecraft.getInstance().levelRenderer.setSectionDirty(pos.x(), pos.y(), pos.z()); } + public LongOpenHashSet getLoadedEmptySections() { + return this.storage.loadedEmptySections; + } + + @Override + public void onSectionEmptinessChanged(int i, int j, int k, boolean bl) { + this.storage.onSectionEmptinessChanged(i, j, k, bl); + } + @Environment(EnvType.CLIENT) final class Storage { final AtomicReferenceArray chunks; + final LongOpenHashSet loadedEmptySections = new LongOpenHashSet(); final int chunkRadius; private final int viewRange; volatile int viewCenterX; @@ -190,25 +200,59 @@ public class ClientChunkCache extends ChunkSource { return Math.floorMod(z, this.viewRange) * this.viewRange + Math.floorMod(x, this.viewRange); } - protected void replace(int chunkIndex, @Nullable LevelChunk chunk) { + void replace(int chunkIndex, @Nullable LevelChunk chunk) { LevelChunk levelChunk = (LevelChunk)this.chunks.getAndSet(chunkIndex, chunk); if (levelChunk != null) { this.chunkCount--; + this.dropEmptySections(levelChunk); ClientChunkCache.this.level.unload(levelChunk); } if (chunk != null) { this.chunkCount++; + this.addEmptySections(chunk); } } - protected LevelChunk replace(int chunkIndex, LevelChunk chunk, @Nullable LevelChunk replaceWith) { - if (this.chunks.compareAndSet(chunkIndex, chunk, replaceWith) && replaceWith == null) { + void drop(int i, LevelChunk levelChunk) { + if (this.chunks.compareAndSet(i, levelChunk, null)) { this.chunkCount--; + this.dropEmptySections(levelChunk); } - ClientChunkCache.this.level.unload(chunk); - return chunk; + ClientChunkCache.this.level.unload(levelChunk); + } + + public void onSectionEmptinessChanged(int i, int j, int k, boolean bl) { + if (this.inRange(i, k)) { + long l = SectionPos.asLong(i, j, k); + if (bl) { + this.loadedEmptySections.add(l); + } else if (this.loadedEmptySections.remove(l)) { + ClientChunkCache.this.level.onSectionBecomingNonEmpty(l); + } + } + } + + private void dropEmptySections(LevelChunk levelChunk) { + LevelChunkSection[] levelChunkSections = levelChunk.getSections(); + + for (int i = 0; i < levelChunkSections.length; i++) { + ChunkPos chunkPos = levelChunk.getPos(); + this.loadedEmptySections.remove(SectionPos.asLong(chunkPos.x, levelChunk.getSectionYFromSectionIndex(i), chunkPos.z)); + } + } + + private void addEmptySections(LevelChunk levelChunk) { + LevelChunkSection[] levelChunkSections = levelChunk.getSections(); + + for (int i = 0; i < levelChunkSections.length; i++) { + LevelChunkSection levelChunkSection = levelChunkSections[i]; + if (levelChunkSection.hasOnlyAir()) { + ChunkPos chunkPos = levelChunk.getPos(); + this.loadedEmptySections.add(SectionPos.asLong(chunkPos.x, levelChunk.getSectionYFromSectionIndex(i), chunkPos.z)); + } + } } boolean inRange(int x, int z) { diff --git a/net/minecraft/client/multiplayer/ClientCommonPacketListenerImpl.java b/net/minecraft/client/multiplayer/ClientCommonPacketListenerImpl.java index 1216bc2a..b5ea9a34 100644 --- a/net/minecraft/client/multiplayer/ClientCommonPacketListenerImpl.java +++ b/net/minecraft/client/multiplayer/ClientCommonPacketListenerImpl.java @@ -32,6 +32,7 @@ import net.minecraft.client.gui.screens.DisconnectedScreen; import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.gui.screens.TitleScreen; import net.minecraft.client.gui.screens.multiplayer.JoinMultiplayerScreen; +import net.minecraft.client.multiplayer.ClientCommonPacketListenerImpl.PackConfirmScreen.PendingRequest; import net.minecraft.client.multiplayer.resolver.ServerAddress; import net.minecraft.client.resources.server.DownloadedPackSource; import net.minecraft.client.telemetry.WorldSessionTelemetryManager; @@ -56,6 +57,7 @@ import net.minecraft.network.protocol.common.ClientboundTransferPacket; import net.minecraft.network.protocol.common.ServerboundKeepAlivePacket; import net.minecraft.network.protocol.common.ServerboundPongPacket; import net.minecraft.network.protocol.common.ServerboundResourcePackPacket; +import net.minecraft.network.protocol.common.ServerboundResourcePackPacket.Action; import net.minecraft.network.protocol.common.custom.BrandPayload; import net.minecraft.network.protocol.common.custom.CustomPacketPayload; import net.minecraft.network.protocol.common.custom.DiscardedPayload; @@ -64,6 +66,9 @@ import net.minecraft.network.protocol.cookie.ServerboundCookieResponsePacket; import net.minecraft.realms.DisconnectedRealmsScreen; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.ServerLinks; +import net.minecraft.server.ServerLinks.Entry; +import net.minecraft.server.ServerLinks.KnownLinkType; +import net.minecraft.server.ServerLinks.UntrustedEntry; import org.jetbrains.annotations.Nullable; import org.slf4j.Logger; @@ -81,10 +86,6 @@ public abstract class ClientCommonPacketListenerImpl implements ClientCommonPack @Nullable protected final Screen postDisconnectScreen; protected boolean isTransferring; - @Deprecated( - forRemoval = true - ) - protected final boolean strictErrorHandling; private final List deferredPackets = new ArrayList(); protected final Map serverCookies; protected Map customReportDetails; @@ -98,25 +99,22 @@ public abstract class ClientCommonPacketListenerImpl implements ClientCommonPack this.telemetryManager = commonListenerCookie.telemetryManager(); this.postDisconnectScreen = commonListenerCookie.postDisconnectScreen(); this.serverCookies = commonListenerCookie.serverCookies(); - this.strictErrorHandling = commonListenerCookie.strictErrorHandling(); this.customReportDetails = commonListenerCookie.customReportDetails(); this.serverLinks = commonListenerCookie.serverLinks(); } @Override public void onPacketError(Packet packet, Exception exception) { - LOGGER.error("Failed to handle packet {}", packet, exception); + LOGGER.error("Failed to handle packet {}, disconnecting", packet, exception); Optional optional = this.storeDisconnectionReport(packet, exception); - Optional optional2 = this.serverLinks.findKnownType(ServerLinks.KnownLinkType.BUG_REPORT).map(ServerLinks.Entry::link); - if (this.strictErrorHandling) { - this.connection.disconnect(new DisconnectionDetails(Component.translatable("disconnect.packetError"), optional, optional2)); - } + Optional optional2 = this.serverLinks.findKnownType(KnownLinkType.BUG_REPORT).map(Entry::link); + this.connection.disconnect(new DisconnectionDetails(Component.translatable("disconnect.packetError"), optional, optional2)); } @Override public DisconnectionDetails createDisconnectionInfo(Component reason, Throwable error) { Optional optional = this.storeDisconnectionReport(null, error); - Optional optional2 = this.serverLinks.findKnownType(ServerLinks.KnownLinkType.BUG_REPORT).map(ServerLinks.Entry::link); + Optional optional2 = this.serverLinks.findKnownType(KnownLinkType.BUG_REPORT).map(Entry::link); return new DisconnectionDetails(reason, optional, optional2); } @@ -125,7 +123,7 @@ public abstract class ClientCommonPacketListenerImpl implements ClientCommonPack PacketUtils.fillCrashReport(crashReport, this, packet); Path path = this.minecraft.gameDirectory.toPath().resolve("debug"); Path path2 = path.resolve("disconnect-" + Util.getFilenameFormattedDateTime() + "-client.txt"); - Optional optional = this.serverLinks.findKnownType(ServerLinks.KnownLinkType.BUG_REPORT); + Optional optional = this.serverLinks.findKnownType(KnownLinkType.BUG_REPORT); List list = (List)optional.map(entry -> List.of("Server bug reporting link: " + entry.link())).orElse(List.of()); return crashReport.saveToFile(path2, ReportType.NETWORK_PROTOCOL_ERROR, list) ? Optional.of(path2) : Optional.empty(); } @@ -170,7 +168,7 @@ public abstract class ClientCommonPacketListenerImpl implements ClientCommonPack UUID uUID = packet.id(); URL uRL = parseResourcePackUrl(packet.url()); if (uRL == null) { - this.connection.send(new ServerboundResourcePackPacket(uUID, ServerboundResourcePackPacket.Action.INVALID_URL)); + this.connection.send(new ServerboundResourcePackPacket(uUID, Action.INVALID_URL)); } else { String string = packet.hash(); boolean bl = packet.required(); @@ -225,13 +223,13 @@ public abstract class ClientCommonPacketListenerImpl implements ClientCommonPack @Override public void handleServerLinks(ClientboundServerLinksPacket packet) { PacketUtils.ensureRunningOnSameThread(packet, this, this.minecraft); - List list = packet.links(); - Builder builder = ImmutableList.builderWithExpectedSize(list.size()); + List list = packet.links(); + Builder builder = ImmutableList.builderWithExpectedSize(list.size()); - for (ServerLinks.UntrustedEntry untrustedEntry : list) { + for (UntrustedEntry untrustedEntry : list) { try { URI uRI = Util.parseAndValidateUntrustedUri(untrustedEntry.link()); - builder.add(new ServerLinks.Entry(untrustedEntry.type(), uRI)); + builder.add(new Entry(untrustedEntry.type(), uRI)); } catch (Exception var7) { LOGGER.warn("Received invalid link for type {}:{}", untrustedEntry.type(), untrustedEntry.link(), var7); } @@ -294,6 +292,7 @@ public abstract class ClientCommonPacketListenerImpl implements ClientCommonPack @Override public void fillListenerSpecificCrashDetails(CrashReport crashReport, CrashReportCategory category) { + category.setDetail("Is Local", (CrashReportDetail)(() -> String.valueOf(this.connection.isMemoryConnection()))); category.setDetail("Server type", (CrashReportDetail)(() -> this.serverData != null ? this.serverData.type().toString() : "")); category.setDetail("Server brand", (CrashReportDetail)(() -> this.serverBrand)); if (!this.customReportDetails.isEmpty()) { @@ -326,9 +325,7 @@ public abstract class ClientCommonPacketListenerImpl implements ClientCommonPack Screen screen = this.minecraft.screen; return screen instanceof ClientCommonPacketListenerImpl.PackConfirmScreen packConfirmScreen ? packConfirmScreen.update(this.minecraft, id, url, hash, required, prompt) - : new ClientCommonPacketListenerImpl.PackConfirmScreen( - this.minecraft, screen, List.of(new ClientCommonPacketListenerImpl.PackConfirmScreen.PendingRequest(id, url, hash)), required, prompt - ); + : new ClientCommonPacketListenerImpl.PackConfirmScreen(this.minecraft, screen, List.of(new PendingRequest(id, url, hash)), required, prompt); } @Environment(EnvType.CLIENT) @@ -337,14 +334,14 @@ public abstract class ClientCommonPacketListenerImpl implements ClientCommonPack @Environment(EnvType.CLIENT) class PackConfirmScreen extends ConfirmScreen { - private final List requests; + private final List requests; @Nullable private final Screen parentScreen; PackConfirmScreen( final Minecraft minecraft, @Nullable final Screen parentScreen, - final List requests, + final List requests, final boolean required, @Nullable final Component prompt ) { @@ -367,7 +364,7 @@ public abstract class ClientCommonPacketListenerImpl implements ClientCommonPack } } - for (ClientCommonPacketListenerImpl.PackConfirmScreen.PendingRequest pendingRequest : requests) { + for (PendingRequest pendingRequest : requests) { downloadedPackSource.pushPack(pendingRequest.id, pendingRequest.url, pendingRequest.hash); } @@ -392,17 +389,11 @@ public abstract class ClientCommonPacketListenerImpl implements ClientCommonPack public ClientCommonPacketListenerImpl.PackConfirmScreen update( Minecraft minecraft, UUID id, URL url, String hash, boolean required, @Nullable Component prompt ) { - List list = ImmutableList.builderWithExpectedSize( - this.requests.size() + 1 - ) + List list = ImmutableList.builderWithExpectedSize(this.requests.size() + 1) .addAll(this.requests) - .add(new ClientCommonPacketListenerImpl.PackConfirmScreen.PendingRequest(id, url, hash)) + .add(new PendingRequest(id, url, hash)) .build(); return ClientCommonPacketListenerImpl.this.new PackConfirmScreen(minecraft, this.parentScreen, list, required, prompt); } - - @Environment(EnvType.CLIENT) - record PendingRequest(UUID id, URL url, String hash) { - } } } diff --git a/net/minecraft/client/multiplayer/ClientConfigurationPacketListenerImpl.java b/net/minecraft/client/multiplayer/ClientConfigurationPacketListenerImpl.java index 5a959b08..41c8fcda 100644 --- a/net/minecraft/client/multiplayer/ClientConfigurationPacketListenerImpl.java +++ b/net/minecraft/client/multiplayer/ClientConfigurationPacketListenerImpl.java @@ -135,7 +135,6 @@ public class ClientConfigurationPacketListenerImpl extends ClientCommonPacketLis this.postDisconnectScreen, this.serverCookies, this.chatState, - this.strictErrorHandling, this.customReportDetails, this.serverLinks ) diff --git a/net/minecraft/client/multiplayer/ClientHandshakePacketListenerImpl.java b/net/minecraft/client/multiplayer/ClientHandshakePacketListenerImpl.java index 2a05b39c..af6506d0 100644 --- a/net/minecraft/client/multiplayer/ClientHandshakePacketListenerImpl.java +++ b/net/minecraft/client/multiplayer/ClientHandshakePacketListenerImpl.java @@ -42,10 +42,10 @@ import net.minecraft.network.protocol.cookie.ClientboundCookieRequestPacket; import net.minecraft.network.protocol.cookie.ServerboundCookieResponsePacket; import net.minecraft.network.protocol.login.ClientLoginPacketListener; import net.minecraft.network.protocol.login.ClientboundCustomQueryPacket; -import net.minecraft.network.protocol.login.ClientboundGameProfilePacket; import net.minecraft.network.protocol.login.ClientboundHelloPacket; import net.minecraft.network.protocol.login.ClientboundLoginCompressionPacket; import net.minecraft.network.protocol.login.ClientboundLoginDisconnectPacket; +import net.minecraft.network.protocol.login.ClientboundLoginFinishedPacket; import net.minecraft.network.protocol.login.ServerboundCustomQueryAnswerPacket; import net.minecraft.network.protocol.login.ServerboundKeyPacket; import net.minecraft.network.protocol.login.ServerboundLoginAcknowledgedPacket; @@ -129,7 +129,7 @@ public class ClientHandshakePacketListenerImpl implements ClientLoginPacketListe } if (packet.shouldAuthenticate()) { - Util.ioPool().submit(() -> { + Util.ioPool().execute(() -> { Component component = this.authenticateServer(string); if (component != null) { if (this.serverData == null || !this.serverData.isLan()) { @@ -175,9 +175,9 @@ public class ClientHandshakePacketListenerImpl implements ClientLoginPacketListe } @Override - public void handleGameProfile(ClientboundGameProfilePacket packet) { + public void handleLoginFinished(ClientboundLoginFinishedPacket clientboundLoginFinishedPacket) { this.switchState(ClientHandshakePacketListenerImpl.State.JOINING); - GameProfile gameProfile = packet.gameProfile(); + GameProfile gameProfile = clientboundLoginFinishedPacket.gameProfile(); this.connection .setupInboundProtocol( ConfigurationProtocols.CLIENTBOUND, @@ -194,7 +194,6 @@ public class ClientHandshakePacketListenerImpl implements ClientLoginPacketListe this.parent, this.cookies, null, - packet.strictErrorHandling(), Map.of(), ServerLinks.EMPTY ) @@ -252,6 +251,7 @@ public class ClientHandshakePacketListenerImpl implements ClientLoginPacketListe public void fillListenerSpecificCrashDetails(CrashReport crashReport, CrashReportCategory category) { category.setDetail("Server type", (CrashReportDetail)(() -> this.serverData != null ? this.serverData.type().toString() : "")); category.setDetail("Login phase", (CrashReportDetail)(() -> ((ClientHandshakePacketListenerImpl.State)this.state.get()).toString())); + category.setDetail("Is Local", (CrashReportDetail)(() -> String.valueOf(this.connection.isMemoryConnection()))); } @Environment(EnvType.CLIENT) diff --git a/net/minecraft/client/multiplayer/ClientLevel.java b/net/minecraft/client/multiplayer/ClientLevel.java index 7dbe130b..da937330 100644 --- a/net/minecraft/client/multiplayer/ClientLevel.java +++ b/net/minecraft/client/multiplayer/ClientLevel.java @@ -26,6 +26,7 @@ import net.minecraft.client.particle.FireworkParticles; import net.minecraft.client.player.AbstractClientPlayer; import net.minecraft.client.renderer.BiomeColors; import net.minecraft.client.renderer.DimensionSpecialEffects; +import net.minecraft.client.renderer.LevelEventHandler; import net.minecraft.client.renderer.LevelRenderer; import net.minecraft.client.resources.sounds.EntityBoundSoundInstance; import net.minecraft.client.resources.sounds.SimpleSoundInstance; @@ -44,12 +45,16 @@ import net.minecraft.resources.ResourceKey; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundSource; import net.minecraft.tags.BlockTags; +import net.minecraft.util.ARGB; import net.minecraft.util.CubicSampler; import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; +import net.minecraft.util.profiling.Profiler; import net.minecraft.util.profiling.ProfilerFiller; +import net.minecraft.util.profiling.Zone; import net.minecraft.world.Difficulty; import net.minecraft.world.TickRateManager; +import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.player.Player; import net.minecraft.world.flag.FeatureFlagSet; @@ -59,17 +64,17 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.item.alchemy.PotionBrewing; import net.minecraft.world.item.component.FireworkExplosion; -import net.minecraft.world.item.crafting.RecipeManager; +import net.minecraft.world.item.crafting.RecipeAccess; import net.minecraft.world.level.ChunkPos; import net.minecraft.world.level.ColorResolver; -import net.minecraft.world.level.GameRules; +import net.minecraft.world.level.ExplosionDamageCalculator; import net.minecraft.world.level.GameType; import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelHeightAccessor; import net.minecraft.world.level.biome.Biome; -import net.minecraft.world.level.biome.BiomeManager; import net.minecraft.world.level.biome.Biomes; import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.entity.FuelValues; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.chunk.LevelChunk; import net.minecraft.world.level.dimension.DimensionType; @@ -78,6 +83,7 @@ import net.minecraft.world.level.entity.LevelCallback; import net.minecraft.world.level.entity.LevelEntityGetter; import net.minecraft.world.level.entity.TransientEntitySectionManager; import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.level.gameevent.GameEvent.Context; import net.minecraft.world.level.material.Fluid; import net.minecraft.world.level.material.FluidState; import net.minecraft.world.level.saveddata.maps.MapId; @@ -101,13 +107,14 @@ public class ClientLevel extends Level { private final TransientEntitySectionManager entityStorage = new TransientEntitySectionManager<>(Entity.class, new ClientLevel.EntityCallbacks()); private final ClientPacketListener connection; private final LevelRenderer levelRenderer; + private final LevelEventHandler levelEventHandler; private final ClientLevel.ClientLevelData clientLevelData; private final DimensionSpecialEffects effects; private final TickRateManager tickRateManager; private final Minecraft minecraft = Minecraft.getInstance(); final List players = Lists.newArrayList(); private final Map mapData = Maps.newHashMap(); - private static final long CLOUD_COLOR = 16777215L; + private static final int CLOUD_COLOR = -1; private int skyFlashTime; private final Object2ObjectArrayMap tintCaches = Util.make( new Object2ObjectArrayMap<>(3), @@ -127,6 +134,8 @@ public class ClientLevel extends Level { private final Deque lightUpdateQueue = Queues.newArrayDeque(); private int serverSimulationDistance; private final BlockStatePredictionHandler blockStatePredictionHandler = new BlockStatePredictionHandler(); + private final int seaLevel; + private boolean tickDayTime; private static final Set MARKER_PARTICLE_ITEMS = Set.of(Items.BARRIER, Items.LIGHT); public void handleBlockChangedAck(int sequence) { @@ -170,26 +179,28 @@ public class ClientLevel extends Level { } public ClientLevel( - ClientPacketListener connection, + ClientPacketListener clientPacketListener, ClientLevel.ClientLevelData clientLevelData, - ResourceKey dimension, - Holder dimensionType, - int viewDistance, - int serverSimulationDistance, - Supplier profiler, + ResourceKey resourceKey, + Holder holder, + int i, + int j, LevelRenderer levelRenderer, - boolean isDebug, - long biomeZoomSeed + boolean bl, + long l, + int k ) { - super(clientLevelData, dimension, connection.registryAccess(), dimensionType, profiler, true, isDebug, biomeZoomSeed, 1000000); - this.connection = connection; - this.chunkSource = new ClientChunkCache(this, viewDistance); + super(clientLevelData, resourceKey, clientPacketListener.registryAccess(), holder, true, bl, l, 1000000); + this.connection = clientPacketListener; + this.chunkSource = new ClientChunkCache(this, i); this.tickRateManager = new TickRateManager(); this.clientLevelData = clientLevelData; this.levelRenderer = levelRenderer; - this.effects = DimensionSpecialEffects.forType(dimensionType.value()); + this.seaLevel = k; + this.levelEventHandler = new LevelEventHandler(this.minecraft, this, levelRenderer); + this.effects = DimensionSpecialEffects.forType(holder.value()); this.setDefaultSpawnPos(new BlockPos(8, 64, 8), 0.0F); - this.serverSimulationDistance = serverSimulationDistance; + this.serverSimulationDistance = j; this.updateSkyBrightness(); this.prepareWeather(); } @@ -212,10 +223,6 @@ public class ClientLevel extends Level { } } - public boolean isLightUpdateQueueEmpty() { - return this.lightUpdateQueue.isEmpty(); - } - public DimensionSpecialEffects effects() { return this.effects; } @@ -225,6 +232,7 @@ public class ClientLevel extends Level { */ public void tick(BooleanSupplier hasTimeLeft) { this.getWorldBorder().tick(); + this.updateSkyBrightness(); if (this.tickRateManager().runsNormally()) { this.tickTime(); } @@ -233,34 +241,22 @@ public class ClientLevel extends Level { this.setSkyFlashTime(this.skyFlashTime - 1); } - this.getProfiler().push("blocks"); - this.chunkSource.tick(hasTimeLeft, true); - this.getProfiler().pop(); + try (Zone zone = Profiler.get().zone("blocks")) { + this.chunkSource.tick(hasTimeLeft, true); + } } private void tickTime() { - this.setGameTime(this.levelData.getGameTime() + 1L); - if (this.levelData.getGameRules().getBoolean(GameRules.RULE_DAYLIGHT)) { - this.setDayTime(this.levelData.getDayTime() + 1L); + this.clientLevelData.setGameTime(this.clientLevelData.getGameTime() + 1L); + if (this.tickDayTime) { + this.clientLevelData.setDayTime(this.clientLevelData.getDayTime() + 1L); } } - public void setGameTime(long time) { - this.clientLevelData.setGameTime(time); - } - - /** - * Sets the world time. - */ - public void setDayTime(long time) { - if (time < 0L) { - time = -time; - this.getGameRules().getRule(GameRules.RULE_DAYLIGHT).set(false, null); - } else { - this.getGameRules().getRule(GameRules.RULE_DAYLIGHT).set(true, null); - } - - this.clientLevelData.setDayTime(time); + public void setTimeFromServer(long l, long m, boolean bl) { + this.clientLevelData.setGameTime(l); + this.clientLevelData.setDayTime(m); + this.tickDayTime = bl; } public Iterable entitiesForRendering() { @@ -268,7 +264,7 @@ public class ClientLevel extends Level { } public void tickEntities() { - ProfilerFiller profilerFiller = this.getProfiler(); + ProfilerFiller profilerFiller = Profiler.get(); profilerFiller.push("entities"); this.tickingEntities.forEach(entity -> { if (!entity.isRemoved() && !entity.isPassenger() && !this.tickRateManager.isEntityFrozen(entity)) { @@ -279,6 +275,10 @@ public class ClientLevel extends Level { this.tickBlockEntities(); } + public boolean isTickingEntity(Entity entity) { + return this.tickingEntities.contains(entity); + } + @Override public boolean shouldTickDeath(Entity entity) { return entity.chunkPosition().getChessboardDistance(this.minecraft.player.chunkPosition()) <= this.serverSimulationDistance; @@ -287,9 +287,9 @@ public class ClientLevel extends Level { public void tickNonPassenger(Entity entity) { entity.setOldPosAndRot(); entity.tickCount++; - this.getProfiler().push((Supplier)(() -> BuiltInRegistries.ENTITY_TYPE.getKey(entity.getType()).toString())); + Profiler.get().push((Supplier)(() -> BuiltInRegistries.ENTITY_TYPE.getKey(entity.getType()).toString())); entity.tick(); - this.getProfiler().pop(); + Profiler.get().pop(); for (Entity entity2 : entity.getPassengers()) { this.tickPassenger(entity, entity2); @@ -322,6 +322,10 @@ public class ClientLevel extends Level { this.levelRenderer.onChunkLoaded(chunkPos); } + public void onSectionBecomingNonEmpty(long l) { + this.levelRenderer.onSectionBecomingNonEmpty(l); + } + public void clearTintCaches() { this.tintCaches.forEach((colorResolver, blockTintCache) -> blockTintCache.invalidateAll()); } @@ -534,8 +538,8 @@ public class ClientLevel extends Level { } @Override - public RecipeManager getRecipeManager() { - return this.connection.getRecipeManager(); + public RecipeAccess recipeAccess() { + return this.connection.recipes(); } @Override @@ -598,6 +602,10 @@ public class ClientLevel extends Level { this.levelRenderer.setSectionDirtyWithNeighbors(sectionX, sectionY, sectionZ); } + public void setSectionRangeDirty(int i, int j, int k, int l, int m, int n) { + this.levelRenderer.setSectionRangeDirty(i, j, k, l, m, n); + } + @Override public void destroyBlockProgress(int breakerId, BlockPos pos, int progress) { this.levelRenderer.destroyBlockProgress(breakerId, pos, progress); @@ -605,13 +613,13 @@ public class ClientLevel extends Level { @Override public void globalLevelEvent(int id, BlockPos pos, int data) { - this.levelRenderer.globalLevelEvent(id, pos, data); + this.levelEventHandler.globalLevelEvent(id, pos, data); } @Override public void levelEvent(@Nullable Player player, int type, BlockPos pos, int data) { try { - this.levelRenderer.levelEvent(type, pos, data); + this.levelEventHandler.levelEvent(type, pos, data); } catch (Throwable var8) { CrashReport crashReport = CrashReport.forThrowable(var8, "Playing level event"); CrashReportCategory crashReportCategory = crashReport.addCategory("Level event being played"); @@ -652,7 +660,7 @@ public class ClientLevel extends Level { @Override public Holder getUncachedNoiseBiome(int x, int y, int z) { - return this.registryAccess().registryOrThrow(Registries.BIOME).getHolderOrThrow(Biomes.PLAINS); + return this.registryAccess().lookupOrThrow(Registries.BIOME).getOrThrow(Biomes.PLAINS); } public float getSkyDarken(float partialTick) { @@ -665,79 +673,61 @@ public class ClientLevel extends Level { return g * 0.8F + 0.2F; } - public Vec3 getSkyColor(Vec3 pos, float partialTick) { - float f = this.getTimeOfDay(partialTick); - Vec3 vec3 = pos.subtract(2.0, 2.0, 2.0).scale(0.25); - BiomeManager biomeManager = this.getBiomeManager(); - Vec3 vec32 = CubicSampler.gaussianSampleVec3(vec3, (ix, jx, kx) -> Vec3.fromRGB24(biomeManager.getNoiseBiomeAtQuart(ix, jx, kx).value().getSkyColor())); - float g = Mth.cos(f * (float) (Math.PI * 2)) * 2.0F + 0.5F; - g = Mth.clamp(g, 0.0F, 1.0F); - float h = (float)vec32.x * g; - float i = (float)vec32.y * g; - float j = (float)vec32.z * g; - float k = this.getRainLevel(partialTick); + public int getSkyColor(Vec3 vec3, float f) { + float g = this.getTimeOfDay(f); + Vec3 vec32 = vec3.subtract(2.0, 2.0, 2.0).scale(0.25); + Vec3 vec33 = CubicSampler.gaussianSampleVec3( + vec32, (ix, jx, kx) -> Vec3.fromRGB24(this.getBiomeManager().getNoiseBiomeAtQuart(ix, jx, kx).value().getSkyColor()) + ); + float h = Mth.cos(g * (float) (Math.PI * 2)) * 2.0F + 0.5F; + h = Mth.clamp(h, 0.0F, 1.0F); + vec33 = vec33.scale(h); + int i = ARGB.color(vec33); + float j = this.getRainLevel(f); + if (j > 0.0F) { + float k = 0.6F; + float l = j * 0.75F; + int m = ARGB.scaleRGB(ARGB.greyscale(i), 0.6F); + i = ARGB.lerp(l, i, m); + } + + float k = this.getThunderLevel(f); if (k > 0.0F) { - float l = (h * 0.3F + i * 0.59F + j * 0.11F) * 0.6F; - float m = 1.0F - k * 0.75F; - h = h * m + l * (1.0F - m); - i = i * m + l * (1.0F - m); - j = j * m + l * (1.0F - m); + float l = 0.2F; + float n = k * 0.75F; + int o = ARGB.scaleRGB(ARGB.greyscale(i), 0.2F); + i = ARGB.lerp(n, i, o); } - float l = this.getThunderLevel(partialTick); - if (l > 0.0F) { - float m = (h * 0.3F + i * 0.59F + j * 0.11F) * 0.2F; - float n = 1.0F - l * 0.75F; - h = h * n + m * (1.0F - n); - i = i * n + m * (1.0F - n); - j = j * n + m * (1.0F - n); - } - - int o = this.getSkyFlashTime(); - if (o > 0) { - float n = o - partialTick; - if (n > 1.0F) { - n = 1.0F; - } - + int p = this.getSkyFlashTime(); + if (p > 0) { + float n = Math.min(p - f, 1.0F); n *= 0.45F; - h = h * (1.0F - n) + 0.8F * n; - i = i * (1.0F - n) + 0.8F * n; - j = j * (1.0F - n) + 1.0F * n; + i = ARGB.lerp(n, i, ARGB.color(204, 204, 255)); } - return new Vec3(h, i, j); + return i; } - public Vec3 getCloudColor(float partialTick) { - float f = this.getTimeOfDay(partialTick); - float g = Mth.cos(f * (float) (Math.PI * 2)) * 2.0F + 0.5F; - g = Mth.clamp(g, 0.0F, 1.0F); - float h = 1.0F; - float i = 1.0F; - float j = 1.0F; - float k = this.getRainLevel(partialTick); - if (k > 0.0F) { - float l = (h * 0.3F + i * 0.59F + j * 0.11F) * 0.6F; - float m = 1.0F - k * 0.95F; - h = h * m + l * (1.0F - m); - i = i * m + l * (1.0F - m); - j = j * m + l * (1.0F - m); + public int getCloudColor(float f) { + int i = -1; + float g = this.getRainLevel(f); + if (g > 0.0F) { + int j = ARGB.scaleRGB(ARGB.greyscale(i), 0.6F); + i = ARGB.lerp(g * 0.95F, i, j); } - h *= g * 0.9F + 0.1F; - i *= g * 0.9F + 0.1F; - j *= g * 0.85F + 0.15F; - float l = this.getThunderLevel(partialTick); + float h = this.getTimeOfDay(f); + float k = Mth.cos(h * (float) (Math.PI * 2)) * 2.0F + 0.5F; + k = Mth.clamp(k, 0.0F, 1.0F); + i = ARGB.multiply(i, ARGB.colorFromFloat(1.0F, k * 0.9F + 0.1F, k * 0.9F + 0.1F, k * 0.85F + 0.15F)); + float l = this.getThunderLevel(f); if (l > 0.0F) { - float m = (h * 0.3F + i * 0.59F + j * 0.11F) * 0.2F; - float n = 1.0F - l * 0.95F; - h = h * n + m * (1.0F - n); - i = i * n + m * (1.0F - n); - j = j * n + m * (1.0F - n); + int m = ARGB.scaleRGB(ARGB.greyscale(i), 0.2F); + i = ARGB.lerp(l * 0.95F, i, m); } - return new Vec3(h, i, j); + return i; } public float getStarBrightness(float partialTick) { @@ -825,7 +815,7 @@ public class ClientLevel extends Level { } @Override - public void gameEvent(Holder gameEvent, Vec3 pos, GameEvent.Context context) { + public void gameEvent(Holder gameEvent, Vec3 pos, Context context) { } protected Map getAllMapData() { @@ -869,10 +859,36 @@ public class ClientLevel extends Level { return this.connection.potionBrewing(); } + @Override + public FuelValues fuelValues() { + return this.connection.fuelValues(); + } + + @Override + public void explode( + @Nullable Entity entity, + @Nullable DamageSource damageSource, + @Nullable ExplosionDamageCalculator explosionDamageCalculator, + double d, + double e, + double f, + float g, + boolean bl, + Level.ExplosionInteraction explosionInteraction, + ParticleOptions particleOptions, + ParticleOptions particleOptions2, + Holder holder + ) { + } + + @Override + public int getSeaLevel() { + return this.seaLevel; + } + @Environment(EnvType.CLIENT) public static class ClientLevelData implements WritableLevelData { private final boolean hardcore; - private final GameRules gameRules; private final boolean isFlat; private BlockPos spawnPos; private float spawnAngle; @@ -886,7 +902,6 @@ public class ClientLevel extends Level { this.difficulty = difficulty; this.hardcore = hardcore; this.isFlat = isFlat; - this.gameRules = new GameRules(); } @Override @@ -943,11 +958,6 @@ public class ClientLevel extends Level { return this.hardcore; } - @Override - public GameRules getGameRules() { - return this.gameRules; - } - @Override public Difficulty getDifficulty() { return this.difficulty; @@ -972,7 +982,7 @@ public class ClientLevel extends Level { } public double getHorizonHeight(LevelHeightAccessor level) { - return this.isFlat ? level.getMinBuildHeight() : 63.0; + return this.isFlat ? level.getMinY() : 63.0; } public float getClearColorScale() { diff --git a/net/minecraft/client/multiplayer/ClientPacketListener.java b/net/minecraft/client/multiplayer/ClientPacketListener.java index 36ef5817..f8f84bfd 100644 --- a/net/minecraft/client/multiplayer/ClientPacketListener.java +++ b/net/minecraft/client/multiplayer/ClientPacketListener.java @@ -10,6 +10,7 @@ import com.mojang.logging.LogUtils; import it.unimi.dsi.fastutil.objects.ReferenceOpenHashSet; import it.unimi.dsi.fastutil.objects.Object2IntMap.Entry; import java.time.Instant; +import java.util.ArrayList; import java.util.BitSet; import java.util.Collection; import java.util.Collections; @@ -18,8 +19,10 @@ import java.util.List; import java.util.Map; import java.util.Objects; import java.util.Optional; +import java.util.OptionalInt; import java.util.Set; import java.util.UUID; +import java.util.concurrent.CompletableFuture; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.advancements.AdvancementHolder; @@ -27,7 +30,6 @@ import net.minecraft.client.ClientRecipeBook; import net.minecraft.client.DebugQueryHandler; import net.minecraft.client.Minecraft; import net.minecraft.client.Options; -import net.minecraft.client.gui.MapRenderer; import net.minecraft.client.gui.components.ChatComponent; import net.minecraft.client.gui.components.toasts.RecipeToast; import net.minecraft.client.gui.components.toasts.SystemToast; @@ -42,14 +44,12 @@ import net.minecraft.client.gui.screens.inventory.CommandBlockEditScreen; import net.minecraft.client.gui.screens.inventory.CreativeModeInventoryScreen; import net.minecraft.client.gui.screens.inventory.HorseInventoryScreen; import net.minecraft.client.gui.screens.multiplayer.ServerReconfigScreen; -import net.minecraft.client.gui.screens.recipebook.RecipeBookComponent; import net.minecraft.client.gui.screens.recipebook.RecipeUpdateListener; import net.minecraft.client.particle.ItemPickupParticle; import net.minecraft.client.player.KeyboardInput; import net.minecraft.client.player.LocalPlayer; import net.minecraft.client.player.RemotePlayer; import net.minecraft.client.renderer.debug.BrainDebugRenderer; -import net.minecraft.client.renderer.debug.NeighborsUpdateRenderer; import net.minecraft.client.renderer.debug.VillageSectionsDebugRenderer; import net.minecraft.client.renderer.debug.WorldGenAttemptRenderer; import net.minecraft.client.resources.sounds.BeeAggressiveSoundInstance; @@ -63,8 +63,11 @@ import net.minecraft.commands.SharedSuggestionProvider; import net.minecraft.commands.arguments.ArgumentSignatures; import net.minecraft.core.BlockPos; import net.minecraft.core.Holder; +import net.minecraft.core.Registry; import net.minecraft.core.RegistryAccess; +import net.minecraft.core.RegistrySynchronization; import net.minecraft.core.SectionPos; +import net.minecraft.core.component.DataComponents; import net.minecraft.core.particles.ParticleTypes; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.Connection; @@ -78,12 +81,15 @@ import net.minecraft.network.chat.PlayerChatMessage; import net.minecraft.network.chat.RemoteChatSession; import net.minecraft.network.chat.SignableCommand; import net.minecraft.network.chat.SignedMessageBody; -import net.minecraft.network.chat.SignedMessageChain; import net.minecraft.network.chat.SignedMessageLink; +import net.minecraft.network.chat.LastSeenMessagesTracker.Update; +import net.minecraft.network.chat.RemoteChatSession.Data; +import net.minecraft.network.chat.SignedMessageChain.Encoder; import net.minecraft.network.chat.numbers.NumberFormat; import net.minecraft.network.protocol.Packet; import net.minecraft.network.protocol.PacketUtils; import net.minecraft.network.protocol.common.ClientboundUpdateTagsPacket; +import net.minecraft.network.protocol.common.ServerboundClientInformationPacket; import net.minecraft.network.protocol.common.custom.BeeDebugPayload; import net.minecraft.network.protocol.common.custom.BrainDebugPayload; import net.minecraft.network.protocol.common.custom.BreezeDebugPayload; @@ -100,6 +106,7 @@ import net.minecraft.network.protocol.common.custom.PoiAddedDebugPayload; import net.minecraft.network.protocol.common.custom.PoiRemovedDebugPayload; import net.minecraft.network.protocol.common.custom.PoiTicketCountDebugPayload; import net.minecraft.network.protocol.common.custom.RaidsDebugPayload; +import net.minecraft.network.protocol.common.custom.RedstoneWireOrientationsDebugPayload; import net.minecraft.network.protocol.common.custom.StructuresDebugPayload; import net.minecraft.network.protocol.common.custom.VillageSectionsDebugPayload; import net.minecraft.network.protocol.common.custom.WorldGenAttemptDebugPayload; @@ -134,6 +141,7 @@ import net.minecraft.network.protocol.game.ClientboundDebugSamplePacket; import net.minecraft.network.protocol.game.ClientboundDeleteChatPacket; import net.minecraft.network.protocol.game.ClientboundDisguisedChatPacket; import net.minecraft.network.protocol.game.ClientboundEntityEventPacket; +import net.minecraft.network.protocol.game.ClientboundEntityPositionSyncPacket; import net.minecraft.network.protocol.game.ClientboundExplodePacket; import net.minecraft.network.protocol.game.ClientboundForgetLevelChunkPacket; import net.minecraft.network.protocol.game.ClientboundGameEventPacket; @@ -150,6 +158,7 @@ import net.minecraft.network.protocol.game.ClientboundLoginPacket; import net.minecraft.network.protocol.game.ClientboundMapItemDataPacket; import net.minecraft.network.protocol.game.ClientboundMerchantOffersPacket; import net.minecraft.network.protocol.game.ClientboundMoveEntityPacket; +import net.minecraft.network.protocol.game.ClientboundMoveMinecartPacket; import net.minecraft.network.protocol.game.ClientboundMoveVehiclePacket; import net.minecraft.network.protocol.game.ClientboundOpenBookPacket; import net.minecraft.network.protocol.game.ClientboundOpenScreenPacket; @@ -164,8 +173,11 @@ import net.minecraft.network.protocol.game.ClientboundPlayerInfoRemovePacket; import net.minecraft.network.protocol.game.ClientboundPlayerInfoUpdatePacket; import net.minecraft.network.protocol.game.ClientboundPlayerLookAtPacket; import net.minecraft.network.protocol.game.ClientboundPlayerPositionPacket; +import net.minecraft.network.protocol.game.ClientboundPlayerRotationPacket; import net.minecraft.network.protocol.game.ClientboundProjectilePowerPacket; -import net.minecraft.network.protocol.game.ClientboundRecipePacket; +import net.minecraft.network.protocol.game.ClientboundRecipeBookAddPacket; +import net.minecraft.network.protocol.game.ClientboundRecipeBookRemovePacket; +import net.minecraft.network.protocol.game.ClientboundRecipeBookSettingsPacket; import net.minecraft.network.protocol.game.ClientboundRemoveEntitiesPacket; import net.minecraft.network.protocol.game.ClientboundRemoveMobEffectPacket; import net.minecraft.network.protocol.game.ClientboundResetScorePacket; @@ -181,9 +193,9 @@ import net.minecraft.network.protocol.game.ClientboundSetBorderSizePacket; import net.minecraft.network.protocol.game.ClientboundSetBorderWarningDelayPacket; import net.minecraft.network.protocol.game.ClientboundSetBorderWarningDistancePacket; import net.minecraft.network.protocol.game.ClientboundSetCameraPacket; -import net.minecraft.network.protocol.game.ClientboundSetCarriedItemPacket; import net.minecraft.network.protocol.game.ClientboundSetChunkCacheCenterPacket; import net.minecraft.network.protocol.game.ClientboundSetChunkCacheRadiusPacket; +import net.minecraft.network.protocol.game.ClientboundSetCursorItemPacket; import net.minecraft.network.protocol.game.ClientboundSetDefaultSpawnPositionPacket; import net.minecraft.network.protocol.game.ClientboundSetDisplayObjectivePacket; import net.minecraft.network.protocol.game.ClientboundSetEntityDataPacket; @@ -192,8 +204,10 @@ import net.minecraft.network.protocol.game.ClientboundSetEntityMotionPacket; import net.minecraft.network.protocol.game.ClientboundSetEquipmentPacket; import net.minecraft.network.protocol.game.ClientboundSetExperiencePacket; import net.minecraft.network.protocol.game.ClientboundSetHealthPacket; +import net.minecraft.network.protocol.game.ClientboundSetHeldSlotPacket; import net.minecraft.network.protocol.game.ClientboundSetObjectivePacket; import net.minecraft.network.protocol.game.ClientboundSetPassengersPacket; +import net.minecraft.network.protocol.game.ClientboundSetPlayerInventoryPacket; import net.minecraft.network.protocol.game.ClientboundSetPlayerTeamPacket; import net.minecraft.network.protocol.game.ClientboundSetScorePacket; import net.minecraft.network.protocol.game.ClientboundSetSimulationDistancePacket; @@ -229,19 +243,26 @@ import net.minecraft.network.protocol.game.ServerboundConfigurationAcknowledgedP import net.minecraft.network.protocol.game.ServerboundMovePlayerPacket; import net.minecraft.network.protocol.game.ServerboundMoveVehiclePacket; import net.minecraft.network.protocol.game.VecDeltaCodec; +import net.minecraft.network.protocol.game.ClientboundChunksBiomesPacket.ChunkBiomeData; +import net.minecraft.network.protocol.game.ClientboundGameEventPacket.Type; +import net.minecraft.network.protocol.game.ClientboundSetPlayerTeamPacket.Parameters; +import net.minecraft.network.protocol.game.ClientboundUpdateAttributesPacket.AttributeSnapshot; +import net.minecraft.network.protocol.game.ServerboundClientCommandPacket.Action; import net.minecraft.network.protocol.ping.ClientboundPongResponsePacket; -import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.network.syncher.SynchedEntityData.DataValue; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.ServerLinks; +import net.minecraft.server.level.ClientInformation; import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; import net.minecraft.stats.Stat; import net.minecraft.stats.StatsCounter; -import net.minecraft.util.Crypt; +import net.minecraft.tags.TagNetworkSerialization; import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; import net.minecraft.util.SignatureValidator; +import net.minecraft.util.Crypt.SaltSupplier; import net.minecraft.world.Difficulty; import net.minecraft.world.InteractionHand; import net.minecraft.world.SimpleContainer; @@ -249,12 +270,14 @@ import net.minecraft.world.TickRateManager; import net.minecraft.world.effect.MobEffect; import net.minecraft.world.effect.MobEffectInstance; import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.ExperienceOrb; import net.minecraft.world.entity.Leashable; import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.entity.RelativeMovement; +import net.minecraft.world.entity.PositionMoveRotation; +import net.minecraft.world.entity.Relative; import net.minecraft.world.entity.ai.attributes.AttributeInstance; import net.minecraft.world.entity.ai.attributes.AttributeMap; import net.minecraft.world.entity.ai.attributes.AttributeModifier; @@ -268,8 +291,9 @@ import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.player.ProfileKeyPair; import net.minecraft.world.entity.player.ProfilePublicKey; import net.minecraft.world.entity.projectile.AbstractHurtingProjectile; +import net.minecraft.world.entity.vehicle.AbstractBoat; import net.minecraft.world.entity.vehicle.AbstractMinecart; -import net.minecraft.world.entity.vehicle.Boat; +import net.minecraft.world.entity.vehicle.NewMinecartBehavior; import net.minecraft.world.flag.FeatureFlagSet; import net.minecraft.world.inventory.AbstractContainerMenu; import net.minecraft.world.inventory.HorseInventoryMenu; @@ -279,15 +303,16 @@ import net.minecraft.world.item.CreativeModeTabs; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.item.alchemy.PotionBrewing; -import net.minecraft.world.item.crafting.RecipeManager; +import net.minecraft.world.item.crafting.RecipeAccess; +import net.minecraft.world.item.crafting.SelectableRecipe; +import net.minecraft.world.item.crafting.display.RecipeDisplayId; import net.minecraft.world.level.ChunkPos; -import net.minecraft.world.level.Explosion; import net.minecraft.world.level.GameType; import net.minecraft.world.level.Level; import net.minecraft.world.level.LightLayer; import net.minecraft.world.level.block.entity.CommandBlockEntity; +import net.minecraft.world.level.block.entity.FuelValues; import net.minecraft.world.level.block.entity.SignBlockEntity; -import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.border.WorldBorder; import net.minecraft.world.level.chunk.DataLayer; import net.minecraft.world.level.chunk.LevelChunk; @@ -302,7 +327,8 @@ import net.minecraft.world.scores.PlayerTeam; import net.minecraft.world.scores.ScoreAccess; import net.minecraft.world.scores.ScoreHolder; import net.minecraft.world.scores.Scoreboard; -import net.minecraft.world.scores.Team; +import net.minecraft.world.scores.Team.CollisionRule; +import net.minecraft.world.scores.Team.Visibility; import net.minecraft.world.scores.criteria.ObjectiveCriteria; import org.jetbrains.annotations.Nullable; import org.slf4j.Logger; @@ -313,9 +339,9 @@ public class ClientPacketListener extends ClientCommonPacketListenerImpl impleme private static final Component UNSECURE_SERVER_TOAST_TITLE = Component.translatable("multiplayer.unsecureserver.toast.title"); private static final Component UNSERURE_SERVER_TOAST = Component.translatable("multiplayer.unsecureserver.toast"); private static final Component INVALID_PACKET = Component.translatable("multiplayer.disconnect.invalid_packet"); - private static final Component CHAT_VALIDATION_FAILED_ERROR = Component.translatable("multiplayer.disconnect.chat_validation_failed"); private static final Component RECONFIGURE_SCREEN_MESSAGE = Component.translatable("connect.reconfiguring"); private static final int PENDING_OFFSET_THRESHOLD = 64; + public static final int TELEPORT_INTERPOLATION_THRESHOLD = 64; private final GameProfile localGameProfile; /** * Reference to the current ClientWorld instance, which many handler methods operate on @@ -337,17 +363,23 @@ public class ClientPacketListener extends ClientCommonPacketListenerImpl impleme */ private final RandomSource random = RandomSource.createThreadSafe(); private CommandDispatcher commands = new CommandDispatcher<>(); - private final RecipeManager recipeManager; + private ClientRecipeContainer recipes = new ClientRecipeContainer(Map.of(), SelectableRecipe.SingleInputSet.empty()); private final UUID id = UUID.randomUUID(); private Set> levels; private final RegistryAccess.Frozen registryAccess; private final FeatureFlagSet enabledFeatures; private final PotionBrewing potionBrewing; + private FuelValues fuelValues; + private OptionalInt removedPlayerVehicleId = OptionalInt.empty(); @Nullable private LocalChatSession chatSession; - private SignedMessageChain.Encoder signedMessageEncoder = SignedMessageChain.Encoder.UNSIGNED; + private Encoder signedMessageEncoder = Encoder.UNSIGNED; private LastSeenMessagesTracker lastSeenMessages = new LastSeenMessagesTracker(20); private MessageSignatureCache messageSignatureCache = MessageSignatureCache.createDefault(); + @Nullable + private CompletableFuture> keyPairFuture; + @Nullable + private ClientInformation remoteClientInformation; private final ChunkBatchSizeCalculator chunkBatchSizeCalculator = new ChunkBatchSizeCalculator(); private final PingDebugMonitor pingDebugMonitor; private final DebugSampleSubscriber debugSampleSubscriber; @@ -367,13 +399,13 @@ public class ClientPacketListener extends ClientCommonPacketListenerImpl impleme this.advancements = new ClientAdvancements(minecraft, this.telemetryManager); this.suggestionsProvider = new ClientSuggestionProvider(this, minecraft); this.pingDebugMonitor = new PingDebugMonitor(this, minecraft.getDebugOverlay().getPingLogger()); - this.recipeManager = new RecipeManager(this.registryAccess); this.debugSampleSubscriber = new DebugSampleSubscriber(this, minecraft.getDebugOverlay()); if (commonListenerCookie.chatState() != null) { minecraft.gui.getChat().restoreState(commonListenerCookie.chatState()); } this.potionBrewing = PotionBrewing.bootstrap(this.enabledFeatures); + this.fuelValues = FuelValues.vanillaBurnTimes(commonListenerCookie.receivedRegistries(), this.enabledFeatures); } public ClientSuggestionProvider getSuggestionsProvider() { @@ -391,8 +423,8 @@ public class ClientPacketListener extends ClientCommonPacketListenerImpl impleme this.levelLoadStatusManager = null; } - public RecipeManager getRecipeManager() { - return this.recipeManager; + public RecipeAccess recipes() { + return this.recipes; } @Override @@ -409,6 +441,7 @@ public class ClientPacketListener extends ClientCommonPacketListenerImpl impleme this.serverSimulationDistance = packet.simulationDistance(); boolean bl = commonPlayerSpawnInfo.isDebug(); boolean bl2 = commonPlayerSpawnInfo.isFlat(); + int i = commonPlayerSpawnInfo.seaLevel(); ClientLevel.ClientLevelData clientLevelData = new ClientLevel.ClientLevelData(Difficulty.NORMAL, packet.hardcore(), bl2); this.levelData = clientLevelData; this.level = new ClientLevel( @@ -418,10 +451,10 @@ public class ClientPacketListener extends ClientCommonPacketListenerImpl impleme holder, this.serverChunkRadius, this.serverSimulationDistance, - this.minecraft::getProfiler, this.minecraft.levelRenderer, bl, - commonPlayerSpawnInfo.seed() + commonPlayerSpawnInfo.seed(), + i ); this.minecraft.setLevel(this.level, ReceivingLevelScreen.Reason.OTHER); if (this.minecraft.player == null) { @@ -451,7 +484,7 @@ public class ClientPacketListener extends ClientCommonPacketListenerImpl impleme this.lastSeenMessages = new LastSeenMessagesTracker(20); this.messageSignatureCache = MessageSignatureCache.createDefault(); if (this.connection.isEncrypted()) { - this.minecraft.getProfileKeyPairManager().prepareKeyPair().thenAcceptAsync(optional -> optional.ifPresent(this::setKeyPair), this.minecraft); + this.prepareKeyPair(); } this.telemetryManager.onPlayerInfoReceived(commonPlayerSpawnInfo.gameType(), packet.hardcore()); @@ -461,7 +494,7 @@ public class ClientPacketListener extends ClientCommonPacketListenerImpl impleme SystemToast systemToast = SystemToast.multiline( this.minecraft, SystemToast.SystemToastId.UNSECURE_SERVER_WARNING, UNSECURE_SERVER_TOAST_TITLE, UNSERURE_SERVER_TOAST ); - this.minecraft.getToasts().addToast(systemToast); + this.minecraft.getToastManager().addToast(systemToast); this.seenInsecureChatWarning = true; } } @@ -469,6 +502,10 @@ public class ClientPacketListener extends ClientCommonPacketListenerImpl impleme @Override public void handleAddEntity(ClientboundAddEntityPacket packet) { PacketUtils.ensureRunningOnSameThread(packet, this, this.minecraft); + if (this.removedPlayerVehicleId.isPresent() && this.removedPlayerVehicleId.getAsInt() == packet.getId()) { + this.removedPlayerVehicleId = OptionalInt.empty(); + } + Entity entity = this.createEntityFromPacket(packet); if (entity != null) { entity.recreateFromPacket(packet); @@ -491,7 +528,7 @@ public class ClientPacketListener extends ClientCommonPacketListenerImpl impleme return new RemotePlayer(this.level, playerInfo.getProfile()); } } else { - return entityType.create(this.level); + return entityType.create(this.level, EntitySpawnReason.LOAD); } } @@ -543,20 +580,64 @@ public class ClientPacketListener extends ClientCommonPacketListenerImpl impleme } } + @Override + public void handleEntityPositionSync(ClientboundEntityPositionSyncPacket clientboundEntityPositionSyncPacket) { + PacketUtils.ensureRunningOnSameThread(clientboundEntityPositionSyncPacket, this, this.minecraft); + Entity entity = this.level.getEntity(clientboundEntityPositionSyncPacket.id()); + if (entity != null) { + Vec3 vec3 = clientboundEntityPositionSyncPacket.values().position(); + entity.getPositionCodec().setBase(vec3); + if (!entity.isControlledByLocalInstance()) { + float f = clientboundEntityPositionSyncPacket.values().yRot(); + float g = clientboundEntityPositionSyncPacket.values().xRot(); + boolean bl = entity.position().distanceToSqr(vec3) > 4096.0; + if (this.level.isTickingEntity(entity) && !bl) { + entity.lerpTo(vec3.x, vec3.y, vec3.z, f, g, 3); + } else { + entity.moveTo(vec3.x, vec3.y, vec3.z, f, g); + if (entity.hasIndirectPassenger(this.minecraft.player)) { + entity.positionRider(this.minecraft.player); + this.minecraft.player.setOldPosAndRot(); + } + } + + entity.setOnGround(clientboundEntityPositionSyncPacket.onGround()); + } + } + } + @Override public void handleTeleportEntity(ClientboundTeleportEntityPacket packet) { PacketUtils.ensureRunningOnSameThread(packet, this, this.minecraft); - Entity entity = this.level.getEntity(packet.getId()); - if (entity != null) { - double d = packet.getX(); - double e = packet.getY(); - double f = packet.getZ(); - entity.syncPacketPositionCodec(d, e, f); - if (!entity.isControlledByLocalInstance()) { - float g = packet.getyRot() * 360 / 256.0F; - float h = packet.getxRot() * 360 / 256.0F; - entity.lerpTo(d, e, f, g, h, 3); - entity.setOnGround(packet.isOnGround()); + Entity entity = this.level.getEntity(packet.id()); + if (entity == null) { + if (this.removedPlayerVehicleId.isPresent() && this.removedPlayerVehicleId.getAsInt() == packet.id()) { + LOGGER.debug("Trying to teleport entity with id {}, that was formerly player vehicle, applying teleport to player instead", packet.id()); + setValuesFromPositionPacket(packet.change(), packet.relatives(), this.minecraft.player, false); + this.connection + .send( + new ServerboundMovePlayerPacket.PosRot( + this.minecraft.player.getX(), + this.minecraft.player.getY(), + this.minecraft.player.getZ(), + this.minecraft.player.getYRot(), + this.minecraft.player.getXRot(), + false, + false + ) + ); + } + } else { + boolean bl = packet.relatives().contains(Relative.X) || packet.relatives().contains(Relative.Y) || packet.relatives().contains(Relative.Z); + boolean bl2 = this.level.isTickingEntity(entity) || !entity.isControlledByLocalInstance() || bl; + boolean bl3 = setValuesFromPositionPacket(packet.change(), packet.relatives(), entity, bl2); + entity.setOnGround(packet.onGround()); + if (!bl3 && entity.hasIndirectPassenger(this.minecraft.player)) { + entity.positionRider(this.minecraft.player); + this.minecraft.player.setOldPosAndRot(); + if (entity.isControlledByOrIsLocalPlayer()) { + this.connection.send(new ServerboundMoveVehiclePacket(entity)); + } } } } @@ -581,10 +662,10 @@ public class ClientPacketListener extends ClientCommonPacketListenerImpl impleme } @Override - public void handleSetCarriedItem(ClientboundSetCarriedItemPacket packet) { - PacketUtils.ensureRunningOnSameThread(packet, this, this.minecraft); - if (Inventory.isHotbarSlot(packet.getSlot())) { - this.minecraft.player.getInventory().selected = packet.getSlot(); + public void handleSetHeldSlot(ClientboundSetHeldSlotPacket clientboundSetHeldSlotPacket) { + PacketUtils.ensureRunningOnSameThread(clientboundSetHeldSlotPacket, this, this.minecraft); + if (Inventory.isHotbarSlot(clientboundSetHeldSlotPacket.getSlot())) { + this.minecraft.player.getInventory().selected = clientboundSetHeldSlotPacket.getSlot(); } } @@ -593,18 +674,20 @@ public class ClientPacketListener extends ClientCommonPacketListenerImpl impleme PacketUtils.ensureRunningOnSameThread(packet, this, this.minecraft); Entity entity = packet.getEntity(this.level); if (entity != null) { - if (!entity.isControlledByLocalInstance()) { + if (entity.isControlledByLocalInstance()) { + VecDeltaCodec vecDeltaCodec = entity.getPositionCodec(); + Vec3 vec3 = vecDeltaCodec.decode(packet.getXa(), packet.getYa(), packet.getZa()); + vecDeltaCodec.setBase(vec3); + } else { if (packet.hasPosition()) { VecDeltaCodec vecDeltaCodec = entity.getPositionCodec(); Vec3 vec3 = vecDeltaCodec.decode(packet.getXa(), packet.getYa(), packet.getZa()); vecDeltaCodec.setBase(vec3); - float f = packet.hasRotation() ? packet.getyRot() * 360 / 256.0F : entity.lerpTargetYRot(); - float g = packet.hasRotation() ? packet.getxRot() * 360 / 256.0F : entity.lerpTargetXRot(); + float f = packet.hasRotation() ? packet.getyRot() : entity.lerpTargetYRot(); + float g = packet.hasRotation() ? packet.getxRot() : entity.lerpTargetXRot(); entity.lerpTo(vec3.x(), vec3.y(), vec3.z(), f, g, 3); } else if (packet.hasRotation()) { - float h = packet.getyRot() * 360 / 256.0F; - float i = packet.getxRot() * 360 / 256.0F; - entity.lerpTo(entity.lerpTargetX(), entity.lerpTargetY(), entity.lerpTargetZ(), h, i, 3); + entity.lerpTo(entity.lerpTargetX(), entity.lerpTargetY(), entity.lerpTargetZ(), packet.getyRot(), packet.getxRot(), 3); } entity.setOnGround(packet.isOnGround()); @@ -612,94 +695,89 @@ public class ClientPacketListener extends ClientCommonPacketListenerImpl impleme } } + @Override + public void handleMinecartAlongTrack(ClientboundMoveMinecartPacket clientboundMoveMinecartPacket) { + PacketUtils.ensureRunningOnSameThread(clientboundMoveMinecartPacket, this, this.minecraft); + Entity entity = clientboundMoveMinecartPacket.getEntity(this.level); + if (entity instanceof AbstractMinecart abstractMinecart) { + if (!entity.isControlledByLocalInstance() && abstractMinecart.getBehavior() instanceof NewMinecartBehavior newMinecartBehavior) { + newMinecartBehavior.lerpSteps.addAll(clientboundMoveMinecartPacket.lerpSteps()); + } + } + } + @Override public void handleRotateMob(ClientboundRotateHeadPacket packet) { PacketUtils.ensureRunningOnSameThread(packet, this, this.minecraft); Entity entity = packet.getEntity(this.level); if (entity != null) { - float f = packet.getYHeadRot() * 360 / 256.0F; - entity.lerpHeadTo(f, 3); + entity.lerpHeadTo(packet.getYHeadRot(), 3); } } @Override public void handleRemoveEntities(ClientboundRemoveEntitiesPacket packet) { PacketUtils.ensureRunningOnSameThread(packet, this, this.minecraft); - packet.getEntityIds().forEach(i -> this.level.removeEntity(i, Entity.RemovalReason.DISCARDED)); + packet.getEntityIds().forEach(i -> { + Entity entity = this.level.getEntity(i); + if (entity != null) { + if (entity.hasIndirectPassenger(this.minecraft.player)) { + LOGGER.debug("Remove entity {}:{} that has player as passenger", entity.getType(), i); + this.removedPlayerVehicleId = OptionalInt.of(i); + } + + this.level.removeEntity(i, Entity.RemovalReason.DISCARDED); + } + }); } @Override public void handleMovePlayer(ClientboundPlayerPositionPacket packet) { PacketUtils.ensureRunningOnSameThread(packet, this, this.minecraft); Player player = this.minecraft.player; - Vec3 vec3 = player.getDeltaMovement(); - boolean bl = packet.getRelativeArguments().contains(RelativeMovement.X); - boolean bl2 = packet.getRelativeArguments().contains(RelativeMovement.Y); - boolean bl3 = packet.getRelativeArguments().contains(RelativeMovement.Z); - double d; - double e; - if (bl) { - d = vec3.x(); - e = player.getX() + packet.getX(); - player.xOld = player.xOld + packet.getX(); - player.xo = player.xo + packet.getX(); - } else { - d = 0.0; - e = packet.getX(); - player.xOld = e; - player.xo = e; + if (!player.isPassenger()) { + setValuesFromPositionPacket(packet.change(), packet.relatives(), player, false); } - double f; - double g; - if (bl2) { - f = vec3.y(); - g = player.getY() + packet.getY(); - player.yOld = player.yOld + packet.getY(); - player.yo = player.yo + packet.getY(); - } else { - f = 0.0; - g = packet.getY(); - player.yOld = g; - player.yo = g; - } + this.connection.send(new ServerboundMovePlayerPacket.PosRot(player.getX(), player.getY(), player.getZ(), player.getYRot(), player.getXRot(), false, false)); + this.connection.send(new ServerboundAcceptTeleportationPacket(packet.id())); + } - double h; - double i; - if (bl3) { - h = vec3.z(); - i = player.getZ() + packet.getZ(); - player.zOld = player.zOld + packet.getZ(); - player.zo = player.zo + packet.getZ(); + private static boolean setValuesFromPositionPacket(PositionMoveRotation positionMoveRotation, Set set, Entity entity, boolean bl) { + PositionMoveRotation positionMoveRotation2 = PositionMoveRotation.ofEntityUsingLerpTarget(entity); + PositionMoveRotation positionMoveRotation3 = PositionMoveRotation.calculateAbsolute(positionMoveRotation2, positionMoveRotation, set); + boolean bl2 = positionMoveRotation2.position().distanceToSqr(positionMoveRotation3.position()) > 4096.0; + if (bl && !bl2) { + entity.lerpTo( + positionMoveRotation3.position().x(), + positionMoveRotation3.position().y(), + positionMoveRotation3.position().z(), + positionMoveRotation3.yRot(), + positionMoveRotation3.xRot(), + 3 + ); + entity.setDeltaMovement(positionMoveRotation3.deltaMovement()); + return true; } else { - h = 0.0; - i = packet.getZ(); - player.zOld = i; - player.zo = i; + entity.setPos(positionMoveRotation3.position()); + entity.setDeltaMovement(positionMoveRotation3.deltaMovement()); + entity.setYRot(positionMoveRotation3.yRot()); + entity.setXRot(positionMoveRotation3.xRot()); + PositionMoveRotation positionMoveRotation4 = new PositionMoveRotation(entity.oldPosition(), Vec3.ZERO, entity.yRotO, entity.xRotO); + PositionMoveRotation positionMoveRotation5 = PositionMoveRotation.calculateAbsolute(positionMoveRotation4, positionMoveRotation, set); + entity.setOldPosAndRot(positionMoveRotation5.position(), positionMoveRotation5.yRot(), positionMoveRotation5.xRot()); + return false; } + } - player.setPos(e, g, i); - player.setDeltaMovement(d, f, h); - float j = packet.getYRot(); - float k = packet.getXRot(); - if (packet.getRelativeArguments().contains(RelativeMovement.X_ROT)) { - player.setXRot(player.getXRot() + k); - player.xRotO += k; - } else { - player.setXRot(k); - player.xRotO = k; - } - - if (packet.getRelativeArguments().contains(RelativeMovement.Y_ROT)) { - player.setYRot(player.getYRot() + j); - player.yRotO += j; - } else { - player.setYRot(j); - player.yRotO = j; - } - - this.connection.send(new ServerboundAcceptTeleportationPacket(packet.getId())); - this.connection.send(new ServerboundMovePlayerPacket.PosRot(player.getX(), player.getY(), player.getZ(), player.getYRot(), player.getXRot(), false)); + @Override + public void handleRotatePlayer(ClientboundPlayerRotationPacket clientboundPlayerRotationPacket) { + PacketUtils.ensureRunningOnSameThread(clientboundPlayerRotationPacket, this, this.minecraft); + Player player = this.minecraft.player; + player.setYRot(clientboundPlayerRotationPacket.yRot()); + player.setXRot(clientboundPlayerRotationPacket.xRot()); + player.setOldRot(); + this.connection.send(new ServerboundMovePlayerPacket.Rot(player.getYRot(), player.getXRot(), false, false)); } @Override @@ -716,7 +794,7 @@ public class ClientPacketListener extends ClientCommonPacketListenerImpl impleme this.updateLevelChunk(i, j, packet.getChunkData()); ClientboundLightUpdatePacketData clientboundLightUpdatePacketData = packet.getLightData(); this.level.queueLightUpdate(() -> { - this.applyLightData(i, j, clientboundLightUpdatePacketData); + this.applyLightData(i, j, clientboundLightUpdatePacketData, false); LevelChunk levelChunk = this.level.getChunkSource().getChunk(i, j, false); if (levelChunk != null) { this.enableChunkLight(levelChunk, i, j); @@ -728,18 +806,18 @@ public class ClientPacketListener extends ClientCommonPacketListenerImpl impleme public void handleChunksBiomes(ClientboundChunksBiomesPacket packet) { PacketUtils.ensureRunningOnSameThread(packet, this, this.minecraft); - for (ClientboundChunksBiomesPacket.ChunkBiomeData chunkBiomeData : packet.chunkBiomeData()) { + for (ChunkBiomeData chunkBiomeData : packet.chunkBiomeData()) { this.level.getChunkSource().replaceBiomes(chunkBiomeData.pos().x, chunkBiomeData.pos().z, chunkBiomeData.getReadBuffer()); } - for (ClientboundChunksBiomesPacket.ChunkBiomeData chunkBiomeData : packet.chunkBiomeData()) { + for (ChunkBiomeData chunkBiomeData : packet.chunkBiomeData()) { this.level.onChunkLoaded(new ChunkPos(chunkBiomeData.pos().x, chunkBiomeData.pos().z)); } - for (ClientboundChunksBiomesPacket.ChunkBiomeData chunkBiomeData : packet.chunkBiomeData()) { + for (ChunkBiomeData chunkBiomeData : packet.chunkBiomeData()) { for (int i = -1; i <= 1; i++) { for (int j = -1; j <= 1; j++) { - for (int k = this.level.getMinSection(); k < this.level.getMaxSection(); k++) { + for (int k = this.level.getMinSectionY(); k <= this.level.getMaxSectionY(); k++) { this.minecraft.levelRenderer.setSectionDirty(chunkBiomeData.pos().x + i, k, chunkBiomeData.pos().z + j); } } @@ -760,8 +838,9 @@ public class ClientPacketListener extends ClientCommonPacketListenerImpl impleme LevelChunkSection levelChunkSection = levelChunkSections[i]; int j = this.level.getSectionYFromSectionIndex(i); levelLightEngine.updateSectionStatus(SectionPos.of(chunkPos, j), levelChunkSection.hasOnlyAir()); - this.level.setSectionDirtyWithNeighbors(x, j, z); } + + this.level.setSectionRangeDirty(x - 1, this.level.getMinSectionY(), z - 1, x + 1, this.level.getMaxSectionY(), z + 1); } @Override @@ -783,7 +862,7 @@ public class ClientPacketListener extends ClientCommonPacketListenerImpl impleme levelLightEngine.queueSectionData(LightLayer.SKY, sectionPos, null); } - for (int i = this.level.getMinSection(); i < this.level.getMaxSection(); i++) { + for (int i = this.level.getMinSectionY(); i <= this.level.getMaxSectionY(); i++) { levelLightEngine.updateSectionStatus(SectionPos.of(chunkPos, i), true); } }); @@ -818,7 +897,6 @@ public class ClientPacketListener extends ClientCommonPacketListenerImpl impleme this.postDisconnectScreen, this.serverCookies, state, - this.strictErrorHandling, this.customReportDetails, this.serverLinks ) @@ -977,9 +1055,8 @@ public class ClientPacketListener extends ClientCommonPacketListenerImpl impleme @Override public void handleSetTime(ClientboundSetTimePacket packet) { PacketUtils.ensureRunningOnSameThread(packet, this, this.minecraft); - this.minecraft.level.setGameTime(packet.getGameTime()); - this.minecraft.level.setDayTime(packet.getDayTime()); - this.telemetryManager.setTime(packet.getGameTime()); + this.level.setTimeFromServer(packet.gameTime(), packet.dayTime(), packet.tickDayTime()); + this.telemetryManager.setTime(packet.gameTime()); } @Override @@ -1002,16 +1079,19 @@ public class ClientPacketListener extends ClientCommonPacketListenerImpl impleme Entity entity2 = this.level.getEntity(i); if (entity2 != null) { entity2.startRiding(entity, true); - if (entity2 == this.minecraft.player && !bl) { - if (entity instanceof Boat) { - this.minecraft.player.yRotO = entity.getYRot(); - this.minecraft.player.setYRot(entity.getYRot()); - this.minecraft.player.setYHeadRot(entity.getYRot()); - } + if (entity2 == this.minecraft.player) { + this.removedPlayerVehicleId = OptionalInt.empty(); + if (!bl) { + if (entity instanceof AbstractBoat) { + this.minecraft.player.yRotO = entity.getYRot(); + this.minecraft.player.setYRot(entity.getYRot()); + this.minecraft.player.setYHeadRot(entity.getYRot()); + } - Component component = Component.translatable("mount.onboard", this.minecraft.options.keyShift.getTranslatedKeyMessage()); - this.minecraft.gui.setOverlayMessage(component, false); - this.minecraft.getNarrator().sayNow(component); + Component component = Component.translatable("mount.onboard", this.minecraft.options.keyShift.getTranslatedKeyMessage()); + this.minecraft.gui.setOverlayMessage(component, false); + this.minecraft.getNarrator().sayNow(component); + } } } } @@ -1029,7 +1109,7 @@ public class ClientPacketListener extends ClientCommonPacketListenerImpl impleme private static ItemStack findTotem(Player player) { for (InteractionHand interactionHand : InteractionHand.values()) { ItemStack itemStack = player.getItemInHand(interactionHand); - if (itemStack.is(Items.TOTEM_OF_UNDYING)) { + if (itemStack.has(DataComponents.DEATH_PROTECTION)) { return itemStack; } } @@ -1100,6 +1180,7 @@ public class ClientPacketListener extends ClientCommonPacketListenerImpl impleme Map map = this.level.getAllMapData(); boolean bl2 = commonPlayerSpawnInfo.isDebug(); boolean bl3 = commonPlayerSpawnInfo.isFlat(); + int i = commonPlayerSpawnInfo.seaLevel(); ClientLevel.ClientLevelData clientLevelData = new ClientLevel.ClientLevelData(this.levelData.getDifficulty(), this.levelData.isHardcore(), bl3); this.levelData = clientLevelData; this.level = new ClientLevel( @@ -1109,10 +1190,10 @@ public class ClientPacketListener extends ClientCommonPacketListenerImpl impleme holder, this.serverChunkRadius, this.serverSimulationDistance, - this.minecraft::getProfiler, this.minecraft.levelRenderer, bl2, - commonPlayerSpawnInfo.seed() + commonPlayerSpawnInfo.seed(), + i ); this.level.addMapData(map); this.minecraft.setLevel(this.level, reason); @@ -1141,10 +1222,17 @@ public class ClientPacketListener extends ClientCommonPacketListenerImpl impleme this.minecraft.cameraEntity = localPlayer2; if (packet.shouldKeep((byte)2)) { - List> list = localPlayer.getEntityData().getNonDefaultValues(); + List> list = localPlayer.getEntityData().getNonDefaultValues(); if (list != null) { localPlayer2.getEntityData().assignValues(list); } + + localPlayer2.setDeltaMovement(localPlayer.getDeltaMovement()); + localPlayer2.setYRot(localPlayer.getYRot()); + localPlayer2.setXRot(localPlayer.getXRot()); + } else { + localPlayer2.resetPos(); + localPlayer2.setYRot(-180.0F); } if (packet.shouldKeep((byte)1)) { @@ -1153,9 +1241,7 @@ public class ClientPacketListener extends ClientCommonPacketListenerImpl impleme localPlayer2.getAttributes().assignBaseValues(localPlayer.getAttributes()); } - localPlayer2.resetPos(); this.level.addEntity(localPlayer2); - localPlayer2.setYRot(-180.0F); localPlayer2.input = new KeyboardInput(this.minecraft.options); this.minecraft.gameMode.adjustPlayer(localPlayer2); localPlayer2.setReducedDebugInfo(localPlayer.isReducedDebugInfo()); @@ -1187,21 +1273,21 @@ public class ClientPacketListener extends ClientCommonPacketListenerImpl impleme @Override public void handleExplosion(ClientboundExplodePacket packet) { PacketUtils.ensureRunningOnSameThread(packet, this, this.minecraft); - Explosion explosion = new Explosion( - this.minecraft.level, - null, - packet.getX(), - packet.getY(), - packet.getZ(), - packet.getPower(), - packet.getToBlow(), - packet.getBlockInteraction(), - packet.getSmallExplosionParticles(), - packet.getLargeExplosionParticles(), - packet.getExplosionSound() - ); - explosion.finalizeExplosion(true); - this.minecraft.player.setDeltaMovement(this.minecraft.player.getDeltaMovement().add(packet.getKnockbackX(), packet.getKnockbackY(), packet.getKnockbackZ())); + Vec3 vec3 = packet.center(); + this.minecraft + .level + .playLocalSound( + vec3.x(), + vec3.y(), + vec3.z(), + packet.explosionSound().value(), + SoundSource.BLOCKS, + 4.0F, + (1.0F + (this.minecraft.level.random.nextFloat() - this.minecraft.level.random.nextFloat()) * 0.2F) * 0.7F, + false + ); + this.minecraft.level.addParticle(packet.explosionParticle(), vec3.x(), vec3.y(), vec3.z(), 1.0, 0.0, 0.0); + packet.playerKnockback().ifPresent(this.minecraft.player::addDeltaMovement); } @Override @@ -1230,31 +1316,46 @@ public class ClientPacketListener extends ClientCommonPacketListenerImpl impleme ItemStack itemStack = packet.getItem(); int i = packet.getSlot(); this.minecraft.getTutorial().onGetItem(itemStack); - if (packet.getContainerId() == -1) { - if (!(this.minecraft.screen instanceof CreativeModeInventoryScreen)) { - player.containerMenu.setCarried(itemStack); - } - } else if (packet.getContainerId() == -2) { - player.getInventory().setItem(i, itemStack); + boolean bl; + if (this.minecraft.screen instanceof CreativeModeInventoryScreen creativeModeInventoryScreen) { + bl = !creativeModeInventoryScreen.isInventoryOpen(); } else { - boolean bl = false; - if (this.minecraft.screen instanceof CreativeModeInventoryScreen creativeModeInventoryScreen) { - bl = !creativeModeInventoryScreen.isInventoryOpen(); - } - - if (packet.getContainerId() == 0 && InventoryMenu.isHotbarSlot(i)) { - if (!itemStack.isEmpty()) { - ItemStack itemStack2 = player.inventoryMenu.getSlot(i).getItem(); - if (itemStack2.isEmpty() || itemStack2.getCount() < itemStack.getCount()) { - itemStack.setPopTime(5); - } - } - - player.inventoryMenu.setItem(i, packet.getStateId(), itemStack); - } else if (packet.getContainerId() == player.containerMenu.containerId && (packet.getContainerId() != 0 || !bl)) { - player.containerMenu.setItem(i, packet.getStateId(), itemStack); - } + bl = false; } + + if (packet.getContainerId() == 0) { + if (InventoryMenu.isHotbarSlot(i) && !itemStack.isEmpty()) { + ItemStack itemStack2 = player.inventoryMenu.getSlot(i).getItem(); + if (itemStack2.isEmpty() || itemStack2.getCount() < itemStack.getCount()) { + itemStack.setPopTime(5); + } + } + + player.inventoryMenu.setItem(i, packet.getStateId(), itemStack); + } else if (packet.getContainerId() == player.containerMenu.containerId && (packet.getContainerId() != 0 || !bl)) { + player.containerMenu.setItem(i, packet.getStateId(), itemStack); + } + + if (this.minecraft.screen instanceof CreativeModeInventoryScreen) { + player.inventoryMenu.setRemoteSlot(i, itemStack); + player.inventoryMenu.broadcastChanges(); + } + } + + @Override + public void handleSetCursorItem(ClientboundSetCursorItemPacket clientboundSetCursorItemPacket) { + PacketUtils.ensureRunningOnSameThread(clientboundSetCursorItemPacket, this, this.minecraft); + this.minecraft.getTutorial().onGetItem(clientboundSetCursorItemPacket.contents()); + if (!(this.minecraft.screen instanceof CreativeModeInventoryScreen)) { + this.minecraft.player.containerMenu.setCarried(clientboundSetCursorItemPacket.contents()); + } + } + + @Override + public void handleSetPlayerInventory(ClientboundSetPlayerInventoryPacket clientboundSetPlayerInventoryPacket) { + PacketUtils.ensureRunningOnSameThread(clientboundSetPlayerInventoryPacket, this, this.minecraft); + this.minecraft.getTutorial().onGetItem(clientboundSetPlayerInventoryPacket.contents()); + this.minecraft.player.getInventory().setItem(clientboundSetPlayerInventoryPacket.slot(), clientboundSetPlayerInventoryPacket.contents()); } @Override @@ -1275,10 +1376,7 @@ public class ClientPacketListener extends ClientCommonPacketListenerImpl impleme if (this.level.getBlockEntity(blockPos) instanceof SignBlockEntity signBlockEntity) { this.minecraft.player.openTextEdit(signBlockEntity, packet.isFrontText()); } else { - BlockState blockState = this.level.getBlockState(blockPos); - SignBlockEntity signBlockEntity2 = new SignBlockEntity(blockPos, blockState); - signBlockEntity2.setLevel(this.level); - this.minecraft.player.openTextEdit(signBlockEntity2, packet.isFrontText()); + LOGGER.warn("Ignoring openTextEdit on an invalid entity: {} at pos {}", this.level.getBlockEntity(blockPos), blockPos); } } @@ -1337,7 +1435,7 @@ public class ClientPacketListener extends ClientCommonPacketListenerImpl impleme public void handleGameEvent(ClientboundGameEventPacket packet) { PacketUtils.ensureRunningOnSameThread(packet, this, this.minecraft); Player player = this.minecraft.player; - ClientboundGameEventPacket.Type type = packet.getEvent(); + Type type = packet.getEvent(); float f = packet.getParam(); int i = Mth.floor(f + 0.5F); if (type == ClientboundGameEventPacket.NO_RESPAWN_BLOCK_AVAILABLE) { @@ -1352,7 +1450,7 @@ public class ClientPacketListener extends ClientCommonPacketListenerImpl impleme this.minecraft.gameMode.setLocalMode(GameType.byId(i)); } else if (type == ClientboundGameEventPacket.WIN_GAME) { this.minecraft.setScreen(new WinScreen(true, () -> { - this.minecraft.player.connection.send(new ServerboundClientCommandPacket(ServerboundClientCommandPacket.Action.PERFORM_RESPAWN)); + this.minecraft.player.connection.send(new ServerboundClientCommandPacket(Action.PERFORM_RESPAWN)); this.minecraft.setScreen(null); })); } else if (type == ClientboundGameEventPacket.DEMO_EVENT) { @@ -1409,7 +1507,6 @@ public class ClientPacketListener extends ClientCommonPacketListenerImpl impleme @Override public void handleMapItemData(ClientboundMapItemDataPacket packet) { PacketUtils.ensureRunningOnSameThread(packet, this, this.minecraft); - MapRenderer mapRenderer = this.minecraft.gameRenderer.getMapRenderer(); MapId mapId = packet.mapId(); MapItemSavedData mapItemSavedData = this.minecraft.level.getMapData(mapId); if (mapItemSavedData == null) { @@ -1418,7 +1515,7 @@ public class ClientPacketListener extends ClientCommonPacketListenerImpl impleme } packet.applyToMap(mapItemSavedData); - mapRenderer.update(mapId, mapItemSavedData); + this.minecraft.getMapTextureManager().update(mapId, mapItemSavedData); } @Override @@ -1470,10 +1567,7 @@ public class ClientPacketListener extends ClientCommonPacketListenerImpl impleme @Override public void handleUpdateRecipes(ClientboundUpdateRecipesPacket packet) { PacketUtils.ensureRunningOnSameThread(packet, this, this.minecraft); - this.recipeManager.replaceRecipes(packet.getRecipes()); - ClientRecipeBook clientRecipeBook = this.minecraft.player.getRecipeBook(); - clientRecipeBook.setupCollections(this.recipeManager.getOrderedRecipes(), this.minecraft.level.registryAccess()); - this.searchTrees.updateRecipes(clientRecipeBook, this.registryAccess); + this.recipes = new ClientRecipeContainer(packet.itemSets(), packet.stonecutterRecipes()); } @Override @@ -1509,41 +1603,52 @@ public class ClientPacketListener extends ClientCommonPacketListenerImpl impleme } @Override - public void handleAddOrRemoveRecipes(ClientboundRecipePacket packet) { - PacketUtils.ensureRunningOnSameThread(packet, this, this.minecraft); + public void handleRecipeBookAdd(ClientboundRecipeBookAddPacket clientboundRecipeBookAddPacket) { + PacketUtils.ensureRunningOnSameThread(clientboundRecipeBookAddPacket, this, this.minecraft); ClientRecipeBook clientRecipeBook = this.minecraft.player.getRecipeBook(); - clientRecipeBook.setBookSettings(packet.getBookSettings()); - ClientboundRecipePacket.State state = packet.getState(); - switch (state) { - case REMOVE: - for (ResourceLocation resourceLocation : packet.getRecipes()) { - this.recipeManager.byKey(resourceLocation).ifPresent(clientRecipeBook::remove); - } - break; - case INIT: - for (ResourceLocation resourceLocation : packet.getRecipes()) { - this.recipeManager.byKey(resourceLocation).ifPresent(clientRecipeBook::add); - } - - for (ResourceLocation resourceLocation : packet.getHighlights()) { - this.recipeManager.byKey(resourceLocation).ifPresent(clientRecipeBook::addHighlight); - } - break; - case ADD: - for (ResourceLocation resourceLocation : packet.getRecipes()) { - this.recipeManager.byKey(resourceLocation).ifPresent(recipeHolder -> { - clientRecipeBook.add(recipeHolder); - clientRecipeBook.addHighlight(recipeHolder); - if (recipeHolder.value().showNotification()) { - RecipeToast.addOrUpdate(this.minecraft.getToasts(), recipeHolder); - } - }); - } + if (clientboundRecipeBookAddPacket.replace()) { + clientRecipeBook.clear(); } - clientRecipeBook.getCollections().forEach(recipeCollection -> recipeCollection.updateKnownRecipes(clientRecipeBook)); - if (this.minecraft.screen instanceof RecipeUpdateListener) { - ((RecipeUpdateListener)this.minecraft.screen).recipesUpdated(); + for (ClientboundRecipeBookAddPacket.Entry entry : clientboundRecipeBookAddPacket.entries()) { + clientRecipeBook.add(entry.contents()); + if (entry.highlight()) { + clientRecipeBook.addHighlight(entry.contents().id()); + } + + if (entry.notification()) { + RecipeToast.addOrUpdate(this.minecraft.getToastManager(), entry.contents().display()); + } + } + + this.refreshRecipeBook(clientRecipeBook); + } + + @Override + public void handleRecipeBookRemove(ClientboundRecipeBookRemovePacket clientboundRecipeBookRemovePacket) { + PacketUtils.ensureRunningOnSameThread(clientboundRecipeBookRemovePacket, this, this.minecraft); + ClientRecipeBook clientRecipeBook = this.minecraft.player.getRecipeBook(); + + for (RecipeDisplayId recipeDisplayId : clientboundRecipeBookRemovePacket.recipes()) { + clientRecipeBook.remove(recipeDisplayId); + } + + this.refreshRecipeBook(clientRecipeBook); + } + + @Override + public void handleRecipeBookSettings(ClientboundRecipeBookSettingsPacket clientboundRecipeBookSettingsPacket) { + PacketUtils.ensureRunningOnSameThread(clientboundRecipeBookSettingsPacket, this, this.minecraft); + ClientRecipeBook clientRecipeBook = this.minecraft.player.getRecipeBook(); + clientRecipeBook.setBookSettings(clientboundRecipeBookSettingsPacket.bookSettings()); + this.refreshRecipeBook(clientRecipeBook); + } + + private void refreshRecipeBook(ClientRecipeBook clientRecipeBook) { + clientRecipeBook.rebuildCollections(); + this.searchTrees.updateRecipes(clientRecipeBook, this.level); + if (this.minecraft.screen instanceof RecipeUpdateListener recipeUpdateListener) { + recipeUpdateListener.recipesUpdated(); } } @@ -1564,14 +1669,25 @@ public class ClientPacketListener extends ClientCommonPacketListenerImpl impleme } } + private Registry.PendingTags updateTags(ResourceKey> resourceKey, TagNetworkSerialization.NetworkPayload networkPayload) { + Registry registry = this.registryAccess.lookupOrThrow(resourceKey); + return registry.prepareTagReload(networkPayload.resolve(registry)); + } + @Override public void handleUpdateTags(ClientboundUpdateTagsPacket packet) { PacketUtils.ensureRunningOnSameThread(packet, this, this.minecraft); - TagCollector tagCollector = new TagCollector(); - packet.getTags().forEach(tagCollector::append); - tagCollector.updateTags(this.registryAccess, this.connection.isMemoryConnection()); - List list = List.copyOf(CreativeModeTabs.searchTab().getDisplayItems()); - this.searchTrees.updateCreativeTags(list); + List> list = new ArrayList(packet.getTags().size()); + boolean bl = this.connection.isMemoryConnection(); + packet.getTags().forEach((resourceKey, networkPayload) -> { + if (!bl || RegistrySynchronization.isNetworkable(resourceKey)) { + list.add(this.updateTags(resourceKey, networkPayload)); + } + }); + list.forEach(Registry.PendingTags::apply); + this.fuelValues = FuelValues.vanillaBurnTimes(this.registryAccess, this.enabledFeatures); + List list2 = List.copyOf(CreativeModeTabs.searchTab().getDisplayItems()); + this.searchTrees.updateCreativeTags(list2); } @Override @@ -1782,6 +1898,9 @@ public class ClientPacketListener extends ClientCommonPacketListenerImpl impleme break; case UPDATE_DISPLAY_NAME: playerInfo.setTabListDisplayName(entry.displayName()); + break; + case UPDATE_LIST_ORDER: + playerInfo.setTabListOrder(entry.listOrder()); } } @@ -1792,7 +1911,7 @@ public class ClientPacketListener extends ClientCommonPacketListenerImpl impleme LOGGER.warn("Ignoring chat session from {} due to missing Services public key", gameProfile.getName()); playerInfo.clearChatSession(this.enforcesSecureChat()); } else { - RemoteChatSession.Data data = entry.chatSession(); + Data data = entry.chatSession(); if (data != null) { try { RemoteChatSession remoteChatSession = data.validate(gameProfile, signatureValidator); @@ -1862,9 +1981,9 @@ public class ClientPacketListener extends ClientCommonPacketListenerImpl impleme public void handleItemCooldown(ClientboundCooldownPacket packet) { PacketUtils.ensureRunningOnSameThread(packet, this, this.minecraft); if (packet.duration() == 0) { - this.minecraft.player.getCooldowns().removeCooldown(packet.item()); + this.minecraft.player.getCooldowns().removeCooldown(packet.cooldownGroup()); } else { - this.minecraft.player.getCooldowns().addCooldown(packet.item(), packet.duration()); + this.minecraft.player.getCooldowns().addCooldown(packet.cooldownGroup(), packet.duration()); } } @@ -1873,7 +1992,13 @@ public class ClientPacketListener extends ClientCommonPacketListenerImpl impleme PacketUtils.ensureRunningOnSameThread(packet, this, this.minecraft); Entity entity = this.minecraft.player.getRootVehicle(); if (entity != this.minecraft.player && entity.isControlledByLocalInstance()) { - entity.absMoveTo(packet.getX(), packet.getY(), packet.getZ(), packet.getYRot(), packet.getXRot()); + Vec3 vec3 = new Vec3(packet.getX(), packet.getY(), packet.getZ()); + Vec3 vec32 = new Vec3(entity.lerpTargetX(), entity.lerpTargetY(), entity.lerpTargetZ()); + if (vec3.distanceTo(vec32) > 1.0E-5F) { + entity.cancelLerp(); + entity.absMoveTo(vec3.x(), vec3.y(), vec3.z(), packet.getYRot(), packet.getXRot()); + } + this.connection.send(new ServerboundMoveVehiclePacket(entity)); } } @@ -1896,8 +2021,9 @@ public class ClientPacketListener extends ClientCommonPacketListenerImpl impleme .pathfindingRenderer .addPath(pathfindingDebugPayload.entityId(), pathfindingDebugPayload.path(), pathfindingDebugPayload.maxNodeDistance()); } else if (payload instanceof NeighborUpdatesDebugPayload neighborUpdatesDebugPayload) { - ((NeighborsUpdateRenderer)this.minecraft.debugRenderer.neighborsUpdateRenderer) - .addUpdate(neighborUpdatesDebugPayload.time(), neighborUpdatesDebugPayload.pos()); + this.minecraft.debugRenderer.neighborsUpdateRenderer.addUpdate(neighborUpdatesDebugPayload.time(), neighborUpdatesDebugPayload.pos()); + } else if (payload instanceof RedstoneWireOrientationsDebugPayload redstoneWireOrientationsDebugPayload) { + this.minecraft.debugRenderer.redstoneWireOrientationsRenderer.addWireOrientations(redstoneWireOrientationsDebugPayload); } else if (payload instanceof StructuresDebugPayload structuresDebugPayload) { this.minecraft .debugRenderer @@ -2031,9 +2157,9 @@ public class ClientPacketListener extends ClientCommonPacketListenerImpl impleme @Override public void handleSetPlayerTeamPacket(ClientboundSetPlayerTeamPacket packet) { PacketUtils.ensureRunningOnSameThread(packet, this, this.minecraft); - ClientboundSetPlayerTeamPacket.Action action = packet.getTeamAction(); + net.minecraft.network.protocol.game.ClientboundSetPlayerTeamPacket.Action action = packet.getTeamAction(); PlayerTeam playerTeam; - if (action == ClientboundSetPlayerTeamPacket.Action.ADD) { + if (action == net.minecraft.network.protocol.game.ClientboundSetPlayerTeamPacket.Action.ADD) { playerTeam = this.scoreboard.addPlayerTeam(packet.getName()); } else { playerTeam = this.scoreboard.getPlayerTeam(packet.getName()); @@ -2043,17 +2169,17 @@ public class ClientPacketListener extends ClientCommonPacketListenerImpl impleme } } - Optional optional = packet.getParameters(); + Optional optional = packet.getParameters(); optional.ifPresent(parameters -> { playerTeam.setDisplayName(parameters.getDisplayName()); playerTeam.setColor(parameters.getColor()); playerTeam.unpackOptions(parameters.getOptions()); - Team.Visibility visibility = Team.Visibility.byName(parameters.getNametagVisibility()); + Visibility visibility = Visibility.byName(parameters.getNametagVisibility()); if (visibility != null) { playerTeam.setNameTagVisibility(visibility); } - Team.CollisionRule collisionRule = Team.CollisionRule.byName(parameters.getCollisionRule()); + CollisionRule collisionRule = CollisionRule.byName(parameters.getCollisionRule()); if (collisionRule != null) { playerTeam.setCollisionRule(collisionRule); } @@ -2061,18 +2187,18 @@ public class ClientPacketListener extends ClientCommonPacketListenerImpl impleme playerTeam.setPlayerPrefix(parameters.getPlayerPrefix()); playerTeam.setPlayerSuffix(parameters.getPlayerSuffix()); }); - ClientboundSetPlayerTeamPacket.Action action2 = packet.getPlayerAction(); - if (action2 == ClientboundSetPlayerTeamPacket.Action.ADD) { + net.minecraft.network.protocol.game.ClientboundSetPlayerTeamPacket.Action action2 = packet.getPlayerAction(); + if (action2 == net.minecraft.network.protocol.game.ClientboundSetPlayerTeamPacket.Action.ADD) { for (String string : packet.getPlayers()) { this.scoreboard.addPlayerToTeam(string, playerTeam); } - } else if (action2 == ClientboundSetPlayerTeamPacket.Action.REMOVE) { + } else if (action2 == net.minecraft.network.protocol.game.ClientboundSetPlayerTeamPacket.Action.REMOVE) { for (String string : packet.getPlayers()) { this.scoreboard.removePlayerFromTeam(string, playerTeam); } } - if (action == ClientboundSetPlayerTeamPacket.Action.REMOVE) { + if (action == net.minecraft.network.protocol.game.ClientboundSetPlayerTeamPacket.Action.REMOVE) { this.scoreboard.removePlayerTeam(playerTeam); } } @@ -2119,7 +2245,7 @@ public class ClientPacketListener extends ClientCommonPacketListenerImpl impleme } else { AttributeMap attributeMap = ((LivingEntity)entity).getAttributes(); - for (ClientboundUpdateAttributesPacket.AttributeSnapshot attributeSnapshot : packet.getValues()) { + for (AttributeSnapshot attributeSnapshot : packet.getValues()) { AttributeInstance attributeInstance = attributeMap.getInstance(attributeSnapshot.attribute()); if (attributeInstance == null) { LOGGER.warn("Entity {} does not have attribute {}", entity, attributeSnapshot.attribute().getRegisteredName()); @@ -2140,13 +2266,10 @@ public class ClientPacketListener extends ClientCommonPacketListenerImpl impleme public void handlePlaceRecipe(ClientboundPlaceGhostRecipePacket packet) { PacketUtils.ensureRunningOnSameThread(packet, this, this.minecraft); AbstractContainerMenu abstractContainerMenu = this.minecraft.player.containerMenu; - if (abstractContainerMenu.containerId == packet.getContainerId()) { - this.recipeManager.byKey(packet.getRecipe()).ifPresent(recipeHolder -> { - if (this.minecraft.screen instanceof RecipeUpdateListener) { - RecipeBookComponent recipeBookComponent = ((RecipeUpdateListener)this.minecraft.screen).getRecipeBookComponent(); - recipeBookComponent.setupGhostRecipe(recipeHolder, abstractContainerMenu.slots); - } - }); + if (abstractContainerMenu.containerId == packet.containerId()) { + if (this.minecraft.screen instanceof RecipeUpdateListener recipeUpdateListener) { + recipeUpdateListener.fillGhostRecipe(packet.recipeDisplay()); + } } } @@ -2156,20 +2279,20 @@ public class ClientPacketListener extends ClientCommonPacketListenerImpl impleme int i = packet.getX(); int j = packet.getZ(); ClientboundLightUpdatePacketData clientboundLightUpdatePacketData = packet.getLightData(); - this.level.queueLightUpdate(() -> this.applyLightData(i, j, clientboundLightUpdatePacketData)); + this.level.queueLightUpdate(() -> this.applyLightData(i, j, clientboundLightUpdatePacketData, true)); } - private void applyLightData(int x, int z, ClientboundLightUpdatePacketData data) { + private void applyLightData(int i, int j, ClientboundLightUpdatePacketData clientboundLightUpdatePacketData, boolean bl) { LevelLightEngine levelLightEngine = this.level.getChunkSource().getLightEngine(); - BitSet bitSet = data.getSkyYMask(); - BitSet bitSet2 = data.getEmptySkyYMask(); - Iterator iterator = data.getSkyUpdates().iterator(); - this.readSectionList(x, z, levelLightEngine, LightLayer.SKY, bitSet, bitSet2, iterator); - BitSet bitSet3 = data.getBlockYMask(); - BitSet bitSet4 = data.getEmptyBlockYMask(); - Iterator iterator2 = data.getBlockUpdates().iterator(); - this.readSectionList(x, z, levelLightEngine, LightLayer.BLOCK, bitSet3, bitSet4, iterator2); - levelLightEngine.setLightEnabled(new ChunkPos(x, z), true); + BitSet bitSet = clientboundLightUpdatePacketData.getSkyYMask(); + BitSet bitSet2 = clientboundLightUpdatePacketData.getEmptySkyYMask(); + Iterator iterator = clientboundLightUpdatePacketData.getSkyUpdates().iterator(); + this.readSectionList(i, j, levelLightEngine, LightLayer.SKY, bitSet, bitSet2, iterator, bl); + BitSet bitSet3 = clientboundLightUpdatePacketData.getBlockYMask(); + BitSet bitSet4 = clientboundLightUpdatePacketData.getEmptyBlockYMask(); + Iterator iterator2 = clientboundLightUpdatePacketData.getBlockUpdates().iterator(); + this.readSectionList(i, j, levelLightEngine, LightLayer.BLOCK, bitSet3, bitSet4, iterator2, bl); + levelLightEngine.setLightEnabled(new ChunkPos(i, j), true); } @Override @@ -2251,15 +2374,17 @@ public class ClientPacketListener extends ClientCommonPacketListenerImpl impleme } private void readSectionList( - int x, int z, LevelLightEngine lightEngine, LightLayer lightLayer, BitSet skyYMask, BitSet emptySkyYMask, Iterator skyUpdates + int i, int j, LevelLightEngine levelLightEngine, LightLayer lightLayer, BitSet bitSet, BitSet bitSet2, Iterator iterator, boolean bl ) { - for (int i = 0; i < lightEngine.getLightSectionCount(); i++) { - int j = lightEngine.getMinLightSection() + i; - boolean bl = skyYMask.get(i); - boolean bl2 = emptySkyYMask.get(i); - if (bl || bl2) { - lightEngine.queueSectionData(lightLayer, SectionPos.of(x, j, z), bl ? new DataLayer((byte[])((byte[])skyUpdates.next()).clone()) : new DataLayer()); - this.level.setSectionDirtyWithNeighbors(x, j, z); + for (int k = 0; k < levelLightEngine.getLightSectionCount(); k++) { + int l = levelLightEngine.getMinLightSection() + k; + boolean bl2 = bitSet.get(k); + boolean bl3 = bitSet2.get(k); + if (bl2 || bl3) { + levelLightEngine.queueSectionData(lightLayer, SectionPos.of(i, l, j), bl2 ? new DataLayer((byte[])((byte[])iterator.next()).clone()) : new DataLayer()); + if (bl) { + this.level.setSectionDirtyWithNeighbors(i, l, j); + } } } } @@ -2355,8 +2480,8 @@ public class ClientPacketListener extends ClientCommonPacketListenerImpl impleme public void sendChat(String message) { Instant instant = Instant.now(); - long l = Crypt.SaltSupplier.getLong(); - LastSeenMessagesTracker.Update update = this.lastSeenMessages.generateAndApplyUpdate(); + long l = SaltSupplier.getLong(); + Update update = this.lastSeenMessages.generateAndApplyUpdate(); MessageSignature messageSignature = this.signedMessageEncoder.pack(new SignedMessageBody(message, instant, l, update.lastSeen())); this.send(new ServerboundChatPacket(message, instant, l, messageSignature, update.update())); } @@ -2367,8 +2492,8 @@ public class ClientPacketListener extends ClientCommonPacketListenerImpl impleme this.send(new ServerboundChatCommandPacket(command)); } else { Instant instant = Instant.now(); - long l = Crypt.SaltSupplier.getLong(); - LastSeenMessagesTracker.Update update = this.lastSeenMessages.generateAndApplyUpdate(); + long l = SaltSupplier.getLong(); + Update update = this.lastSeenMessages.generateAndApplyUpdate(); ArgumentSignatures argumentSignatures = ArgumentSignatures.signCommand(signableCommand, string -> { SignedMessageBody signedMessageBody = new SignedMessageBody(string, instant, l, update.lastSeen()); return this.signedMessageEncoder.pack(signedMessageBody); @@ -2390,13 +2515,22 @@ public class ClientPacketListener extends ClientCommonPacketListenerImpl impleme return this.commands.parse(command, this.suggestionsProvider); } + public void broadcastClientInformation(ClientInformation clientInformation) { + if (!clientInformation.equals(this.remoteClientInformation)) { + this.send(new ServerboundClientInformationPacket(clientInformation)); + this.remoteClientInformation = clientInformation; + } + } + @Override public void tick() { - if (this.connection.isEncrypted()) { - ProfileKeyPairManager profileKeyPairManager = this.minecraft.getProfileKeyPairManager(); - if (profileKeyPairManager.shouldRefreshKeyPair()) { - profileKeyPairManager.prepareKeyPair().thenAcceptAsync(optional -> optional.ifPresent(this::setKeyPair), this.minecraft); - } + if (this.chatSession != null && this.minecraft.getProfileKeyPairManager().shouldRefreshKeyPair()) { + this.prepareKeyPair(); + } + + if (this.keyPairFuture != null && this.keyPairFuture.isDone()) { + ((Optional)this.keyPairFuture.join()).ifPresent(this::setKeyPair); + this.keyPairFuture = null; } this.sendDeferredPackets(); @@ -2411,7 +2545,11 @@ public class ClientPacketListener extends ClientCommonPacketListenerImpl impleme } } - public void setKeyPair(ProfileKeyPair keyPair) { + public void prepareKeyPair() { + this.keyPairFuture = this.minecraft.getProfileKeyPairManager().prepareKeyPair(); + } + + private void setKeyPair(ProfileKeyPair keyPair) { if (this.minecraft.isLocalPlayer(this.localGameProfile.getId())) { if (this.chatSession == null || !this.chatSession.keyPair().equals(keyPair)) { this.chatSession = LocalChatSession.create(keyPair); @@ -2442,6 +2580,10 @@ public class ClientPacketListener extends ClientCommonPacketListenerImpl impleme return this.potionBrewing; } + public FuelValues fuelValues() { + return this.fuelValues; + } + public void updateSearchTrees() { this.searchTrees.rebuildAfterLanguageChange(); } diff --git a/net/minecraft/client/multiplayer/ClientRecipeContainer.java b/net/minecraft/client/multiplayer/ClientRecipeContainer.java new file mode 100644 index 00000000..122529a9 --- /dev/null +++ b/net/minecraft/client/multiplayer/ClientRecipeContainer.java @@ -0,0 +1,31 @@ +package net.minecraft.client.multiplayer; + +import java.util.Map; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.resources.ResourceKey; +import net.minecraft.world.item.crafting.RecipeAccess; +import net.minecraft.world.item.crafting.RecipePropertySet; +import net.minecraft.world.item.crafting.SelectableRecipe; +import net.minecraft.world.item.crafting.StonecutterRecipe; + +@Environment(EnvType.CLIENT) +public class ClientRecipeContainer implements RecipeAccess { + private final Map, RecipePropertySet> itemSets; + private final SelectableRecipe.SingleInputSet stonecutterRecipes; + + public ClientRecipeContainer(Map, RecipePropertySet> map, SelectableRecipe.SingleInputSet singleInputSet) { + this.itemSets = map; + this.stonecutterRecipes = singleInputSet; + } + + @Override + public RecipePropertySet propertySet(ResourceKey resourceKey) { + return (RecipePropertySet)this.itemSets.getOrDefault(resourceKey, RecipePropertySet.EMPTY); + } + + @Override + public SelectableRecipe.SingleInputSet stonecutterRecipes() { + return this.stonecutterRecipes; + } +} diff --git a/net/minecraft/client/multiplayer/ClientSuggestionProvider.java b/net/minecraft/client/multiplayer/ClientSuggestionProvider.java index 9f86d81a..b58d5af0 100644 --- a/net/minecraft/client/multiplayer/ClientSuggestionProvider.java +++ b/net/minecraft/client/multiplayer/ClientSuggestionProvider.java @@ -20,8 +20,8 @@ import net.minecraft.commands.SharedSuggestionProvider; import net.minecraft.core.BlockPos; import net.minecraft.core.Registry; import net.minecraft.core.RegistryAccess; -import net.minecraft.network.protocol.game.ClientboundCustomChatCompletionsPacket; import net.minecraft.network.protocol.game.ServerboundCommandSuggestionPacket; +import net.minecraft.network.protocol.game.ClientboundCustomChatCompletionsPacket.Action; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.flag.FeatureFlagSet; @@ -30,6 +30,7 @@ import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.EntityHitResult; import net.minecraft.world.phys.HitResult; import net.minecraft.world.phys.Vec3; +import net.minecraft.world.phys.HitResult.Type; import org.jetbrains.annotations.Nullable; @Environment(EnvType.CLIENT) @@ -70,7 +71,7 @@ public class ClientSuggestionProvider implements SharedSuggestionProvider { @Override public Collection getSelectedEntities() { - return (Collection)(this.minecraft.hitResult != null && this.minecraft.hitResult.getType() == HitResult.Type.ENTITY + return (Collection)(this.minecraft.hitResult != null && this.minecraft.hitResult.getType() == Type.ENTITY ? Collections.singleton(((EntityHitResult)this.minecraft.hitResult).getEntity().getStringUUID()) : Collections.emptyList()); } @@ -85,11 +86,6 @@ public class ClientSuggestionProvider implements SharedSuggestionProvider { return this.minecraft.getSoundManager().getAvailableSounds().stream(); } - @Override - public Stream getRecipeNames() { - return this.connection.getRecipeManager().getRecipeIds(); - } - @Override public boolean hasPermission(int permissionLevel) { LocalPlayer localPlayer = this.minecraft.player; @@ -103,7 +99,7 @@ public class ClientSuggestionProvider implements SharedSuggestionProvider { SuggestionsBuilder builder, CommandContext context ) { - return (CompletableFuture)this.registryAccess().registry(resourceKey).map(registry -> { + return (CompletableFuture)this.registryAccess().lookup(resourceKey).map(registry -> { this.suggestRegistryElements(registry, registryKey, builder); return builder.buildFuture(); }).orElseGet(() -> this.customSuggestion(context)); @@ -132,7 +128,7 @@ public class ClientSuggestionProvider implements SharedSuggestionProvider { @Override public Collection getRelevantCoordinates() { HitResult hitResult = this.minecraft.hitResult; - if (hitResult != null && hitResult.getType() == HitResult.Type.BLOCK) { + if (hitResult != null && hitResult.getType() == Type.BLOCK) { BlockPos blockPos = ((BlockHitResult)hitResult).getBlockPos(); return Collections.singleton( new SharedSuggestionProvider.TextCoordinates(prettyPrint(blockPos.getX()), prettyPrint(blockPos.getY()), prettyPrint(blockPos.getZ())) @@ -145,7 +141,7 @@ public class ClientSuggestionProvider implements SharedSuggestionProvider { @Override public Collection getAbsoluteCoordinates() { HitResult hitResult = this.minecraft.hitResult; - if (hitResult != null && hitResult.getType() == HitResult.Type.BLOCK) { + if (hitResult != null && hitResult.getType() == Type.BLOCK) { Vec3 vec3 = hitResult.getLocation(); return Collections.singleton(new SharedSuggestionProvider.TextCoordinates(prettyPrint(vec3.x), prettyPrint(vec3.y), prettyPrint(vec3.z))); } else { @@ -176,7 +172,7 @@ public class ClientSuggestionProvider implements SharedSuggestionProvider { } } - public void modifyCustomCompletions(ClientboundCustomChatCompletionsPacket.Action action, List entries) { + public void modifyCustomCompletions(Action action, List entries) { switch (action) { case ADD: this.customCompletionSuggestions.addAll(entries); diff --git a/net/minecraft/client/multiplayer/CommonListenerCookie.java b/net/minecraft/client/multiplayer/CommonListenerCookie.java index c5f46a4e..8f4bb9d3 100644 --- a/net/minecraft/client/multiplayer/CommonListenerCookie.java +++ b/net/minecraft/client/multiplayer/CommonListenerCookie.java @@ -24,7 +24,6 @@ public record CommonListenerCookie( @Nullable Screen postDisconnectScreen, Map serverCookies, @Nullable ChatComponent.State chatState, - @Deprecated(forRemoval = true) boolean strictErrorHandling, Map customReportDetails, ServerLinks serverLinks ) { diff --git a/net/minecraft/client/multiplayer/MultiPlayerGameMode.java b/net/minecraft/client/multiplayer/MultiPlayerGameMode.java index fd17a76b..ee8e5296 100644 --- a/net/minecraft/client/multiplayer/MultiPlayerGameMode.java +++ b/net/minecraft/client/multiplayer/MultiPlayerGameMode.java @@ -5,10 +5,13 @@ import com.mojang.logging.LogUtils; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; import java.util.List; +import java.util.Objects; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.ClientRecipeBook; import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; +import net.minecraft.client.gui.screens.inventory.CreativeModeInventoryScreen; import net.minecraft.client.multiplayer.prediction.BlockStatePredictionHandler; import net.minecraft.client.multiplayer.prediction.PredictiveAction; import net.minecraft.client.player.LocalPlayer; @@ -30,13 +33,12 @@ import net.minecraft.network.protocol.game.ServerboundSetCarriedItemPacket; import net.minecraft.network.protocol.game.ServerboundSetCreativeModeSlotPacket; import net.minecraft.network.protocol.game.ServerboundUseItemOnPacket; import net.minecraft.network.protocol.game.ServerboundUseItemPacket; +import net.minecraft.network.protocol.game.ServerboundPlayerActionPacket.Action; import net.minecraft.sounds.SoundSource; import net.minecraft.stats.StatsCounter; import net.minecraft.util.Mth; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; -import net.minecraft.world.InteractionResultHolder; -import net.minecraft.world.ItemInteractionResult; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.HasCustomInventoryScreen; import net.minecraft.world.entity.player.Player; @@ -45,7 +47,7 @@ import net.minecraft.world.inventory.ClickType; import net.minecraft.world.inventory.Slot; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.context.UseOnContext; -import net.minecraft.world.item.crafting.RecipeHolder; +import net.minecraft.world.item.crafting.display.RecipeDisplayId; import net.minecraft.world.level.GameType; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Block; @@ -152,12 +154,12 @@ public class MultiPlayerGameMode { this.minecraft.getTutorial().onDestroyBlock(this.minecraft.level, loc, blockState, 1.0F); this.startPrediction(this.minecraft.level, i -> { this.destroyBlock(loc); - return new ServerboundPlayerActionPacket(ServerboundPlayerActionPacket.Action.START_DESTROY_BLOCK, loc, face, i); + return new ServerboundPlayerActionPacket(Action.START_DESTROY_BLOCK, loc, face, i); }); this.destroyDelay = 5; } else if (!this.isDestroying || !this.sameDestroyTarget(loc)) { if (this.isDestroying) { - this.connection.send(new ServerboundPlayerActionPacket(ServerboundPlayerActionPacket.Action.ABORT_DESTROY_BLOCK, this.destroyBlockPos, face)); + this.connection.send(new ServerboundPlayerActionPacket(Action.ABORT_DESTROY_BLOCK, this.destroyBlockPos, face)); } BlockState blockState = this.minecraft.level.getBlockState(loc); @@ -179,7 +181,7 @@ public class MultiPlayerGameMode { this.minecraft.level.destroyBlockProgress(this.minecraft.player.getId(), this.destroyBlockPos, this.getDestroyStage()); } - return new ServerboundPlayerActionPacket(ServerboundPlayerActionPacket.Action.START_DESTROY_BLOCK, loc, face, i); + return new ServerboundPlayerActionPacket(Action.START_DESTROY_BLOCK, loc, face, i); }); } @@ -194,7 +196,7 @@ public class MultiPlayerGameMode { if (this.isDestroying) { BlockState blockState = this.minecraft.level.getBlockState(this.destroyBlockPos); this.minecraft.getTutorial().onDestroyBlock(this.minecraft.level, this.destroyBlockPos, blockState, -1.0F); - this.connection.send(new ServerboundPlayerActionPacket(ServerboundPlayerActionPacket.Action.ABORT_DESTROY_BLOCK, this.destroyBlockPos, Direction.DOWN)); + this.connection.send(new ServerboundPlayerActionPacket(Action.ABORT_DESTROY_BLOCK, this.destroyBlockPos, Direction.DOWN)); this.isDestroying = false; this.destroyProgress = 0.0F; this.minecraft.level.destroyBlockProgress(this.minecraft.player.getId(), this.destroyBlockPos, -1); @@ -213,7 +215,7 @@ public class MultiPlayerGameMode { this.minecraft.getTutorial().onDestroyBlock(this.minecraft.level, posBlock, blockState, 1.0F); this.startPrediction(this.minecraft.level, i -> { this.destroyBlock(posBlock); - return new ServerboundPlayerActionPacket(ServerboundPlayerActionPacket.Action.START_DESTROY_BLOCK, posBlock, directionFacing, i); + return new ServerboundPlayerActionPacket(Action.START_DESTROY_BLOCK, posBlock, directionFacing, i); }); return true; } else if (this.sameDestroyTarget(posBlock)) { @@ -245,7 +247,7 @@ public class MultiPlayerGameMode { this.isDestroying = false; this.startPrediction(this.minecraft.level, i -> { this.destroyBlock(posBlock); - return new ServerboundPlayerActionPacket(ServerboundPlayerActionPacket.Action.STOP_DESTROY_BLOCK, posBlock, directionFacing, i); + return new ServerboundPlayerActionPacket(Action.STOP_DESTROY_BLOCK, posBlock, directionFacing, i); }); this.destroyProgress = 0.0F; this.destroyTicks = 0.0F; @@ -311,7 +313,7 @@ public class MultiPlayerGameMode { BlockPos blockPos = result.getBlockPos(); ItemStack itemStack = player.getItemInHand(hand); if (this.localPlayerMode == GameType.SPECTATOR) { - return InteractionResult.SUCCESS; + return InteractionResult.CONSUME; } else { boolean bl = !player.getMainHandItem().isEmpty() || !player.getOffhandItem().isEmpty(); boolean bl2 = player.isSecondaryUseActive() && bl; @@ -321,31 +323,31 @@ public class MultiPlayerGameMode { return InteractionResult.FAIL; } - ItemInteractionResult itemInteractionResult = blockState.useItemOn(player.getItemInHand(hand), this.minecraft.level, player, hand, result); - if (itemInteractionResult.consumesAction()) { - return itemInteractionResult.result(); + InteractionResult interactionResult = blockState.useItemOn(player.getItemInHand(hand), this.minecraft.level, player, hand, result); + if (interactionResult.consumesAction()) { + return interactionResult; } - if (itemInteractionResult == ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION && hand == InteractionHand.MAIN_HAND) { - InteractionResult interactionResult = blockState.useWithoutItem(this.minecraft.level, player, result); - if (interactionResult.consumesAction()) { - return interactionResult; + if (interactionResult instanceof InteractionResult.TryEmptyHandInteraction && hand == InteractionHand.MAIN_HAND) { + InteractionResult interactionResult2 = blockState.useWithoutItem(this.minecraft.level, player, result); + if (interactionResult2.consumesAction()) { + return interactionResult2; } } } - if (!itemStack.isEmpty() && !player.getCooldowns().isOnCooldown(itemStack.getItem())) { + if (!itemStack.isEmpty() && !player.getCooldowns().isOnCooldown(itemStack)) { UseOnContext useOnContext = new UseOnContext(player, hand, result); - InteractionResult interactionResult2; + InteractionResult interactionResult3; if (this.localPlayerMode.isCreative()) { int i = itemStack.getCount(); - interactionResult2 = itemStack.useOn(useOnContext); + interactionResult3 = itemStack.useOn(useOnContext); itemStack.setCount(i); } else { - interactionResult2 = itemStack.useOn(useOnContext); + interactionResult3 = itemStack.useOn(useOnContext); } - return interactionResult2; + return interactionResult3; } else { return InteractionResult.PASS; } @@ -361,17 +363,23 @@ public class MultiPlayerGameMode { this.startPrediction(this.minecraft.level, i -> { ServerboundUseItemPacket serverboundUseItemPacket = new ServerboundUseItemPacket(hand, i, player.getYRot(), player.getXRot()); ItemStack itemStack = player.getItemInHand(hand); - if (player.getCooldowns().isOnCooldown(itemStack.getItem())) { + if (player.getCooldowns().isOnCooldown(itemStack)) { mutableObject.setValue(InteractionResult.PASS); return serverboundUseItemPacket; } else { - InteractionResultHolder interactionResultHolder = itemStack.use(this.minecraft.level, player, hand); - ItemStack itemStack2 = interactionResultHolder.getObject(); + InteractionResult interactionResult = itemStack.use(this.minecraft.level, player, hand); + ItemStack itemStack2; + if (interactionResult instanceof InteractionResult.Success success) { + itemStack2 = (ItemStack)Objects.requireNonNullElseGet(success.heldItemTransformedTo(), () -> player.getItemInHand(hand)); + } else { + itemStack2 = player.getItemInHand(hand); + } + if (itemStack2 != itemStack) { player.setItemInHand(hand, itemStack2); } - mutableObject.setValue(interactionResultHolder.getResult()); + mutableObject.setValue(interactionResult); return serverboundUseItemPacket; } }); @@ -405,7 +413,7 @@ public class MultiPlayerGameMode { public InteractionResult interact(Player player, Entity target, InteractionHand hand) { this.ensureHasSentCarriedItem(); this.connection.send(ServerboundInteractPacket.createInteractionPacket(target, player.isShiftKeyDown(), hand)); - return this.localPlayerMode == GameType.SPECTATOR ? InteractionResult.PASS : player.interactOn(target, hand); + return (InteractionResult)(this.localPlayerMode == GameType.SPECTATOR ? InteractionResult.PASS : player.interactOn(target, hand)); } /** @@ -415,7 +423,7 @@ public class MultiPlayerGameMode { this.ensureHasSentCarriedItem(); Vec3 vec3 = ray.getLocation().subtract(target.getX(), target.getY(), target.getZ()); this.connection.send(ServerboundInteractPacket.createInteractionPacket(target, player.isShiftKeyDown(), hand, vec3)); - return this.localPlayerMode == GameType.SPECTATOR ? InteractionResult.PASS : target.interactAt(player, vec3, hand); + return (InteractionResult)(this.localPlayerMode == GameType.SPECTATOR ? InteractionResult.PASS : target.interactAt(player, vec3, hand)); } public void handleInventoryMouseClick(int containerId, int slotId, int mouseButton, ClickType clickType, Player player) { @@ -451,8 +459,8 @@ public class MultiPlayerGameMode { } } - public void handlePlaceRecipe(int containerId, RecipeHolder recipe, boolean shiftDown) { - this.connection.send(new ServerboundPlaceRecipePacket(containerId, recipe, shiftDown)); + public void handlePlaceRecipe(int i, RecipeDisplayId recipeDisplayId, boolean bl) { + this.connection.send(new ServerboundPlaceRecipePacket(i, recipeDisplayId, bl)); } /** @@ -475,14 +483,16 @@ public class MultiPlayerGameMode { * Sends a Packet107 to the server to drop the item on the ground */ public void handleCreativeModeItemDrop(ItemStack stack) { - if (this.localPlayerMode.isCreative() && !stack.isEmpty() && this.connection.isFeatureEnabled(stack.getItem().requiredFeatures())) { + boolean bl = this.minecraft.screen instanceof AbstractContainerScreen && !(this.minecraft.screen instanceof CreativeModeInventoryScreen); + if (this.localPlayerMode.isCreative() && !bl && !stack.isEmpty() && this.connection.isFeatureEnabled(stack.getItem().requiredFeatures())) { this.connection.send(new ServerboundSetCreativeModeSlotPacket(-1, stack)); + this.minecraft.player.getDropSpamThrottler().increment(); } } public void releaseUsingItem(Player player) { this.ensureHasSentCarriedItem(); - this.connection.send(new ServerboundPlayerActionPacket(ServerboundPlayerActionPacket.Action.RELEASE_USE_ITEM, BlockPos.ZERO, Direction.DOWN)); + this.connection.send(new ServerboundPlayerActionPacket(Action.RELEASE_USE_ITEM, BlockPos.ZERO, Direction.DOWN)); player.releaseUsingItem(); } diff --git a/net/minecraft/client/multiplayer/PlayerInfo.java b/net/minecraft/client/multiplayer/PlayerInfo.java index e9914ab9..db73cdbe 100644 --- a/net/minecraft/client/multiplayer/PlayerInfo.java +++ b/net/minecraft/client/multiplayer/PlayerInfo.java @@ -35,6 +35,7 @@ public class PlayerInfo { @Nullable private RemoteChatSession chatSession; private SignedMessageValidator messageValidator; + private int tabListOrder; public PlayerInfo(GameProfile profile, boolean enforeSecureChat) { this.profile = profile; @@ -122,4 +123,12 @@ public class PlayerInfo { public Component getTabListDisplayName() { return this.tabListDisplayName; } + + public void setTabListOrder(int i) { + this.tabListOrder = i; + } + + public int getTabListOrder() { + return this.tabListOrder; + } } diff --git a/net/minecraft/client/multiplayer/RegistryDataCollector.java b/net/minecraft/client/multiplayer/RegistryDataCollector.java index 569708cc..ff4a6474 100644 --- a/net/minecraft/client/multiplayer/RegistryDataCollector.java +++ b/net/minecraft/client/multiplayer/RegistryDataCollector.java @@ -1,11 +1,20 @@ package net.minecraft.client.multiplayer; import java.util.ArrayList; +import java.util.Comparator; import java.util.HashMap; import java.util.List; +import java.util.Locale; import java.util.Map; +import java.util.function.BiConsumer; +import java.util.stream.Collectors; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; +import net.minecraft.CrashReport; +import net.minecraft.CrashReportCategory; +import net.minecraft.CrashReportDetail; +import net.minecraft.ReportedException; +import net.minecraft.core.HolderLookup; import net.minecraft.core.LayeredRegistryAccess; import net.minecraft.core.Registry; import net.minecraft.core.RegistryAccess; @@ -13,6 +22,7 @@ import net.minecraft.core.RegistrySynchronization; import net.minecraft.resources.RegistryDataLoader; import net.minecraft.resources.ResourceKey; import net.minecraft.server.packs.resources.ResourceProvider; +import net.minecraft.tags.TagLoader; import net.minecraft.tags.TagNetworkSerialization; import org.jetbrains.annotations.Nullable; @@ -21,7 +31,7 @@ public class RegistryDataCollector { @Nullable private RegistryDataCollector.ContentsCollector contentsCollector; @Nullable - private TagCollector tagCollector; + private RegistryDataCollector.TagCollector tagCollector; public void appendContents(ResourceKey> registryKey, List registryEntries) { if (this.contentsCollector == null) { @@ -33,40 +43,128 @@ public class RegistryDataCollector { public void appendTags(Map>, TagNetworkSerialization.NetworkPayload> tags) { if (this.tagCollector == null) { - this.tagCollector = new TagCollector(); + this.tagCollector = new RegistryDataCollector.TagCollector(); } tags.forEach(this.tagCollector::append); } - public RegistryAccess.Frozen collectGameRegistries(ResourceProvider resourceProvider, RegistryAccess registryAccess, boolean isMemoryConnection) { + private static Registry.PendingTags resolveRegistryTags( + RegistryAccess.Frozen frozen, ResourceKey> resourceKey, TagNetworkSerialization.NetworkPayload networkPayload + ) { + Registry registry = frozen.lookupOrThrow(resourceKey); + return registry.prepareTagReload(networkPayload.resolve(registry)); + } + + private RegistryAccess loadNewElementsAndTags(ResourceProvider resourceProvider, RegistryDataCollector.ContentsCollector contentsCollector, boolean bl) { LayeredRegistryAccess layeredRegistryAccess = ClientRegistryLayer.createRegistryAccess(); - RegistryAccess registryAccess2; - if (this.contentsCollector != null) { - RegistryAccess.Frozen frozen = layeredRegistryAccess.getAccessForLoading(ClientRegistryLayer.REMOTE); - RegistryAccess.Frozen frozen2 = this.contentsCollector.loadRegistries(resourceProvider, frozen).freeze(); - registryAccess2 = layeredRegistryAccess.replaceFrom(ClientRegistryLayer.REMOTE, frozen2).compositeAccess(); - } else { - registryAccess2 = registryAccess; - } - + RegistryAccess.Frozen frozen = layeredRegistryAccess.getAccessForLoading(ClientRegistryLayer.REMOTE); + Map>, RegistryDataLoader.NetworkedRegistryData> map = new HashMap(); + contentsCollector.elements + .forEach((resourceKey, listx) -> map.put(resourceKey, new RegistryDataLoader.NetworkedRegistryData(listx, TagNetworkSerialization.NetworkPayload.EMPTY))); + List> list = new ArrayList(); if (this.tagCollector != null) { - this.tagCollector.updateTags(registryAccess2, isMemoryConnection); + this.tagCollector.forEach((resourceKey, networkPayload) -> { + if (!networkPayload.isEmpty()) { + if (RegistrySynchronization.isNetworkable(resourceKey)) { + map.compute(resourceKey, (resourceKeyx, networkedRegistryData) -> { + List listxx = networkedRegistryData != null ? networkedRegistryData.elements() : List.of(); + return new RegistryDataLoader.NetworkedRegistryData(listxx, networkPayload); + }); + } else if (!bl) { + list.add(resolveRegistryTags(frozen, resourceKey, networkPayload)); + } + } + }); } - return registryAccess2.freeze(); + List> list2 = TagLoader.buildUpdatedLookups(frozen, list); + + RegistryAccess.Frozen frozen2; + try { + frozen2 = RegistryDataLoader.load(map, resourceProvider, list2, RegistryDataLoader.SYNCHRONIZED_REGISTRIES).freeze(); + } catch (Exception var13) { + CrashReport crashReport = CrashReport.forThrowable(var13, "Network Registry Load"); + addCrashDetails(crashReport, map, list); + throw new ReportedException(crashReport); + } + + RegistryAccess registryAccess = layeredRegistryAccess.replaceFrom(ClientRegistryLayer.REMOTE, frozen2).compositeAccess(); + list.forEach(Registry.PendingTags::apply); + return registryAccess; + } + + private static void addCrashDetails( + CrashReport crashReport, Map>, RegistryDataLoader.NetworkedRegistryData> map, List> list + ) { + CrashReportCategory crashReportCategory = crashReport.addCategory("Received Elements and Tags"); + crashReportCategory.setDetail( + "Dynamic Registries", + (CrashReportDetail)(() -> (String)map.entrySet() + .stream() + .sorted(Comparator.comparing(entry -> ((ResourceKey)entry.getKey()).location())) + .map( + entry -> String.format( + Locale.ROOT, + "\n\t\t%s: elements=%d tags=%d", + ((ResourceKey)entry.getKey()).location(), + ((RegistryDataLoader.NetworkedRegistryData)entry.getValue()).elements().size(), + ((RegistryDataLoader.NetworkedRegistryData)entry.getValue()).tags().size() + ) + ) + .collect(Collectors.joining())) + ); + crashReportCategory.setDetail( + "Static Registries", + (CrashReportDetail)(() -> (String)list.stream() + .sorted(Comparator.comparing(pendingTags -> pendingTags.key().location())) + .map(pendingTags -> String.format(Locale.ROOT, "\n\t\t%s: tags=%d", pendingTags.key().location(), pendingTags.size())) + .collect(Collectors.joining())) + ); + } + + private void loadOnlyTags(RegistryDataCollector.TagCollector tagCollector, RegistryAccess.Frozen frozen, boolean bl) { + tagCollector.forEach((resourceKey, networkPayload) -> { + if (bl || RegistrySynchronization.isNetworkable(resourceKey)) { + resolveRegistryTags(frozen, resourceKey, networkPayload).apply(); + } + }); + } + + public RegistryAccess.Frozen collectGameRegistries(ResourceProvider resourceProvider, RegistryAccess.Frozen frozen, boolean bl) { + RegistryAccess registryAccess; + if (this.contentsCollector != null) { + registryAccess = this.loadNewElementsAndTags(resourceProvider, this.contentsCollector, bl); + } else { + if (this.tagCollector != null) { + this.loadOnlyTags(this.tagCollector, frozen, !bl); + } + + registryAccess = frozen; + } + + return registryAccess.freeze(); } @Environment(EnvType.CLIENT) static class ContentsCollector { - private final Map>, List> elements = new HashMap(); + final Map>, List> elements = new HashMap(); public void append(ResourceKey> registryKey, List entries) { ((List)this.elements.computeIfAbsent(registryKey, resourceKey -> new ArrayList())).addAll(entries); } + } - public RegistryAccess loadRegistries(ResourceProvider resourceProvider, RegistryAccess registryAccess) { - return RegistryDataLoader.load(this.elements, resourceProvider, registryAccess, RegistryDataLoader.SYNCHRONIZED_REGISTRIES); + @Environment(EnvType.CLIENT) + static class TagCollector { + private final Map>, TagNetworkSerialization.NetworkPayload> tags = new HashMap(); + + public void append(ResourceKey> resourceKey, TagNetworkSerialization.NetworkPayload networkPayload) { + this.tags.put(resourceKey, networkPayload); + } + + public void forEach(BiConsumer>, ? super TagNetworkSerialization.NetworkPayload> biConsumer) { + this.tags.forEach(biConsumer); } } } diff --git a/net/minecraft/client/multiplayer/ServerData.java b/net/minecraft/client/multiplayer/ServerData.java index ff8b251f..094fd409 100644 --- a/net/minecraft/client/multiplayer/ServerData.java +++ b/net/minecraft/client/multiplayer/ServerData.java @@ -10,7 +10,7 @@ import net.fabricmc.api.Environment; import net.minecraft.SharedConstants; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.chat.Component; -import net.minecraft.network.protocol.status.ServerStatus; +import net.minecraft.network.protocol.status.ServerStatus.Players; import net.minecraft.util.PngInfo; import org.jetbrains.annotations.Nullable; import org.slf4j.Logger; @@ -24,7 +24,7 @@ public class ServerData { public Component status; public Component motd; @Nullable - public ServerStatus.Players players; + public Players players; public long ping; public int protocol = SharedConstants.getCurrentVersion().getProtocolVersion(); public Component version = Component.literal(SharedConstants.getCurrentVersion().getName()); @@ -83,7 +83,7 @@ public class ServerData { } } - if (nbtCompound.contains("acceptTextures", 1)) { + if (nbtCompound.contains("acceptTextures", 99)) { if (nbtCompound.getBoolean("acceptTextures")) { serverData.setResourcePackStatus(ServerData.ServerPackStatus.ENABLED); } else { diff --git a/net/minecraft/client/multiplayer/ServerList.java b/net/minecraft/client/multiplayer/ServerList.java index de3b00a0..6bc01a15 100644 --- a/net/minecraft/client/multiplayer/ServerList.java +++ b/net/minecraft/client/multiplayer/ServerList.java @@ -5,6 +5,7 @@ import com.mojang.logging.LogUtils; import java.nio.file.Files; import java.nio.file.Path; import java.util.List; +import java.util.Objects; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.Util; @@ -12,14 +13,14 @@ import net.minecraft.client.Minecraft; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.ListTag; import net.minecraft.nbt.NbtIo; -import net.minecraft.util.thread.ProcessorMailbox; +import net.minecraft.util.thread.ConsecutiveExecutor; import org.jetbrains.annotations.Nullable; import org.slf4j.Logger; @Environment(EnvType.CLIENT) public class ServerList { private static final Logger LOGGER = LogUtils.getLogger(); - private static final ProcessorMailbox IO_MAILBOX = ProcessorMailbox.create(Util.backgroundExecutor(), "server-list-io"); + private static final ConsecutiveExecutor IO_EXECUTOR = new ConsecutiveExecutor(Util.backgroundExecutor(), "server-list-io"); private static final int MAX_HIDDEN_SERVERS = 16; private final Minecraft minecraft; private final List serverList = Lists.newArrayList(); @@ -169,7 +170,7 @@ public class ServerList { private static boolean set(ServerData server, List serverList) { for (int i = 0; i < serverList.size(); i++) { ServerData serverData = (ServerData)serverList.get(i); - if (serverData.name.equals(server.name) && serverData.ip.equals(server.ip)) { + if (Objects.equals(serverData.name, server.name) && serverData.ip.equals(server.ip)) { serverList.set(i, server); return true; } @@ -179,7 +180,7 @@ public class ServerList { } public static void saveSingleServer(ServerData server) { - IO_MAILBOX.tell(() -> { + IO_EXECUTOR.schedule(() -> { ServerList serverList = new ServerList(Minecraft.getInstance()); serverList.load(); if (!set(server, serverList.serverList)) { diff --git a/net/minecraft/client/multiplayer/SessionSearchTrees.java b/net/minecraft/client/multiplayer/SessionSearchTrees.java index 724440fe..28a8f7c3 100644 --- a/net/minecraft/client/multiplayer/SessionSearchTrees.java +++ b/net/minecraft/client/multiplayer/SessionSearchTrees.java @@ -20,9 +20,13 @@ import net.minecraft.core.RegistryAccess; import net.minecraft.core.registries.Registries; import net.minecraft.resources.ResourceKey; import net.minecraft.tags.TagKey; +import net.minecraft.util.context.ContextMap; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.TooltipFlag; +import net.minecraft.world.item.TooltipFlag.Default; +import net.minecraft.world.item.crafting.display.SlotDisplayContext; +import net.minecraft.world.level.Level; @Environment(EnvType.CLIENT) public class SessionSearchTrees { @@ -51,21 +55,26 @@ public class SessionSearchTrees { .filter(string -> !string.isEmpty()); } - public void updateRecipes(ClientRecipeBook recipeBook, RegistryAccess.Frozen registries) { + public void updateRecipes(ClientRecipeBook clientRecipeBook, Level level) { this.register( RECIPE_COLLECTIONS, () -> { - List list = recipeBook.getCollections(); - Registry registry = registries.registryOrThrow(Registries.ITEM); - Item.TooltipContext tooltipContext = Item.TooltipContext.of(registries); - TooltipFlag tooltipFlag = TooltipFlag.Default.NORMAL; + List list = clientRecipeBook.getCollections(); + RegistryAccess registryAccess = level.registryAccess(); + Registry registry = registryAccess.lookupOrThrow(Registries.ITEM); + Item.TooltipContext tooltipContext = Item.TooltipContext.of(registryAccess); + ContextMap contextMap = SlotDisplayContext.fromLevel(level); + TooltipFlag tooltipFlag = Default.NORMAL; CompletableFuture completableFuture = this.recipeSearch; this.recipeSearch = CompletableFuture.supplyAsync( () -> new FullTextSearchTree( recipeCollection -> getTooltipLines( - recipeCollection.getRecipes().stream().map(recipeHolder -> recipeHolder.value().getResultItem(registries)), tooltipContext, tooltipFlag + recipeCollection.getRecipes().stream().flatMap(recipeDisplayEntry -> recipeDisplayEntry.resultItems(contextMap).stream()), tooltipContext, tooltipFlag ), - recipeCollection -> recipeCollection.getRecipes().stream().map(recipeHolder -> registry.getKey(recipeHolder.value().getResultItem(registries).getItem())), + recipeCollection -> recipeCollection.getRecipes() + .stream() + .flatMap(recipeDisplayEntry -> recipeDisplayEntry.resultItems(contextMap).stream()) + .map(itemStack -> registry.getKey(itemStack.getItem())), list ), Util.backgroundExecutor() @@ -101,7 +110,7 @@ public class SessionSearchTrees { CREATIVE_NAMES, () -> { Item.TooltipContext tooltipContext = Item.TooltipContext.of(registries); - TooltipFlag tooltipFlag = TooltipFlag.Default.NORMAL.asCreative(); + TooltipFlag tooltipFlag = Default.NORMAL.asCreative(); CompletableFuture completableFuture = this.creativeByNameSearch; this.creativeByNameSearch = CompletableFuture.supplyAsync( () -> new FullTextSearchTree( diff --git a/net/minecraft/client/multiplayer/TagCollector.java b/net/minecraft/client/multiplayer/TagCollector.java deleted file mode 100644 index 9e69af59..00000000 --- a/net/minecraft/client/multiplayer/TagCollector.java +++ /dev/null @@ -1,48 +0,0 @@ -package net.minecraft.client.multiplayer; - -import java.util.HashMap; -import java.util.Map; -import java.util.function.Predicate; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.core.Registry; -import net.minecraft.core.RegistryAccess; -import net.minecraft.core.RegistrySynchronization; -import net.minecraft.resources.ResourceKey; -import net.minecraft.tags.TagNetworkSerialization; -import net.minecraft.world.level.block.Blocks; -import net.minecraft.world.level.block.entity.AbstractFurnaceBlockEntity; - -@Environment(EnvType.CLIENT) -public class TagCollector { - private final Map>, TagNetworkSerialization.NetworkPayload> tags = new HashMap(); - - public void append(ResourceKey> registryKey, TagNetworkSerialization.NetworkPayload networkPayload) { - this.tags.put(registryKey, networkPayload); - } - - private static void refreshBuiltInTagDependentData() { - AbstractFurnaceBlockEntity.invalidateCache(); - Blocks.rebuildCache(); - } - - private void applyTags(RegistryAccess registryAccess, Predicate>> filter) { - this.tags.forEach((resourceKey, networkPayload) -> { - if (filter.test(resourceKey)) { - networkPayload.applyToRegistry(registryAccess.registryOrThrow(resourceKey)); - } - }); - } - - public void updateTags(RegistryAccess registryAccess, boolean isMemoryConnection) { - if (isMemoryConnection) { - this.applyTags(registryAccess, RegistrySynchronization.NETWORKABLE_REGISTRIES::contains); - } else { - registryAccess.registries() - .filter(registryEntry -> !RegistrySynchronization.NETWORKABLE_REGISTRIES.contains(registryEntry.key())) - .forEach(registryEntry -> registryEntry.value().resetTags()); - this.applyTags(registryAccess, resourceKey -> true); - refreshBuiltInTagDependentData(); - } - } -} diff --git a/net/minecraft/client/multiplayer/chat/LoggedChatEvent.java b/net/minecraft/client/multiplayer/chat/LoggedChatEvent.java index 01d4795e..e7d2831c 100644 --- a/net/minecraft/client/multiplayer/chat/LoggedChatEvent.java +++ b/net/minecraft/client/multiplayer/chat/LoggedChatEvent.java @@ -5,6 +5,8 @@ import com.mojang.serialization.MapCodec; import java.util.function.Supplier; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; +import net.minecraft.client.multiplayer.chat.LoggedChatMessage.Player; +import net.minecraft.client.multiplayer.chat.LoggedChatMessage.System; import net.minecraft.util.StringRepresentable; @Environment(EnvType.CLIENT) @@ -15,8 +17,8 @@ public interface LoggedChatEvent { @Environment(EnvType.CLIENT) public static enum Type implements StringRepresentable { - PLAYER("player", () -> LoggedChatMessage.Player.CODEC), - SYSTEM("system", () -> LoggedChatMessage.System.CODEC); + PLAYER("player", () -> Player.CODEC), + SYSTEM("system", () -> System.CODEC); private final String serializedName; private final Supplier> codec; diff --git a/net/minecraft/client/multiplayer/chat/report/ReportEnvironment.java b/net/minecraft/client/multiplayer/chat/report/ReportEnvironment.java index b9b275fc..23eb04fa 100644 --- a/net/minecraft/client/multiplayer/chat/report/ReportEnvironment.java +++ b/net/minecraft/client/multiplayer/chat/report/ReportEnvironment.java @@ -8,6 +8,8 @@ import java.util.Locale; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.Minecraft; +import net.minecraft.client.multiplayer.chat.report.ReportEnvironment.Server.Realm; +import net.minecraft.client.multiplayer.chat.report.ReportEnvironment.Server.ThirdParty; import org.jetbrains.annotations.Nullable; @Environment(EnvType.CLIENT) @@ -17,11 +19,11 @@ public record ReportEnvironment(String clientVersion, @Nullable ReportEnvironmen } public static ReportEnvironment thirdParty(String ip) { - return create(new ReportEnvironment.Server.ThirdParty(ip)); + return create(new ThirdParty(ip)); } public static ReportEnvironment realm(RealmsServer realmsServer) { - return create(new ReportEnvironment.Server.Realm(realmsServer)); + return create(new Realm(realmsServer)); } public static ReportEnvironment create(@Nullable ReportEnvironment.Server server) { @@ -34,17 +36,17 @@ public record ReportEnvironment(String clientVersion, @Nullable ReportEnvironmen @Nullable public ThirdPartyServerInfo thirdPartyServerInfo() { - return this.server instanceof ReportEnvironment.Server.ThirdParty thirdParty ? new ThirdPartyServerInfo(thirdParty.ip) : null; + return this.server instanceof ThirdParty thirdParty ? new ThirdPartyServerInfo(thirdParty.ip) : null; } @Nullable public RealmInfo realmInfo() { - return this.server instanceof ReportEnvironment.Server.Realm realm ? new RealmInfo(String.valueOf(realm.realmId()), realm.slotId()) : null; + return this.server instanceof Realm realm ? new RealmInfo(String.valueOf(realm.realmId()), realm.slotId()) : null; } private static String getClientVersion() { StringBuilder stringBuilder = new StringBuilder(); - stringBuilder.append("1.21.1"); + stringBuilder.append("1.21.2"); if (Minecraft.checkModStatus().shouldReportAsModified()) { stringBuilder.append(" (modded)"); } @@ -54,15 +56,5 @@ public record ReportEnvironment(String clientVersion, @Nullable ReportEnvironmen @Environment(EnvType.CLIENT) public interface Server { - @Environment(EnvType.CLIENT) - public record Realm(long realmId, int slotId) implements ReportEnvironment.Server { - public Realm(RealmsServer realmsServer) { - this(realmsServer.id, realmsServer.activeSlot); - } - } - - @Environment(EnvType.CLIENT) - public record ThirdParty(String ip) implements ReportEnvironment.Server { - } } } diff --git a/net/minecraft/client/multiplayer/chat/report/ReportReason.java b/net/minecraft/client/multiplayer/chat/report/ReportReason.java index ecc6cfa3..350faf8a 100644 --- a/net/minecraft/client/multiplayer/chat/report/ReportReason.java +++ b/net/minecraft/client/multiplayer/chat/report/ReportReason.java @@ -1,5 +1,6 @@ package net.minecraft.client.multiplayer.chat.report; +import java.util.List; import java.util.Locale; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; @@ -7,7 +8,7 @@ import net.minecraft.network.chat.Component; @Environment(EnvType.CLIENT) public enum ReportReason { - GENERIC("generic"), + I_WANT_TO_REPORT_THEM("i_want_to_report_them"), HATE_SPEECH("hate_speech"), HARASSMENT_OR_BULLYING("harassment_or_bullying"), SELF_HARM_OR_SUICIDE("self_harm_or_suicide"), @@ -16,7 +17,8 @@ public enum ReportReason { ALCOHOL_TOBACCO_DRUGS("alcohol_tobacco_drugs"), CHILD_SEXUAL_EXPLOITATION_OR_ABUSE("child_sexual_exploitation_or_abuse"), TERRORISM_OR_VIOLENT_EXTREMISM("terrorism_or_violent_extremism"), - NON_CONSENSUAL_INTIMATE_IMAGERY("non_consensual_intimate_imagery"); + NON_CONSENSUAL_INTIMATE_IMAGERY("non_consensual_intimate_imagery"), + SEXUALLY_INAPPROPRIATE("sexually_inappropriate"); private final String backendName; private final Component title; @@ -40,4 +42,12 @@ public enum ReportReason { public Component description() { return this.description; } + + public static List getIncompatibleCategories(ReportType reportType) { + return switch (reportType) { + case CHAT -> List.of(SEXUALLY_INAPPROPRIATE); + case SKIN -> List.of(IMMINENT_HARM, DEFAMATION_IMPERSONATION_FALSE_INFORMATION); + default -> List.of(); + }; + } } diff --git a/net/minecraft/client/particle/AttackSweepParticle.java b/net/minecraft/client/particle/AttackSweepParticle.java index 4415a20a..13e7fdeb 100644 --- a/net/minecraft/client/particle/AttackSweepParticle.java +++ b/net/minecraft/client/particle/AttackSweepParticle.java @@ -40,7 +40,7 @@ public class AttackSweepParticle extends TextureSheetParticle { @Override public ParticleRenderType getRenderType() { - return ParticleRenderType.PARTICLE_SHEET_LIT; + return ParticleRenderType.PARTICLE_SHEET_OPAQUE; } @Environment(EnvType.CLIENT) diff --git a/net/minecraft/client/particle/DustParticle.java b/net/minecraft/client/particle/DustParticle.java index 0fa726aa..d1b454b2 100644 --- a/net/minecraft/client/particle/DustParticle.java +++ b/net/minecraft/client/particle/DustParticle.java @@ -4,6 +4,7 @@ import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.multiplayer.ClientLevel; import net.minecraft.core.particles.DustParticleOptions; +import org.joml.Vector3f; @Environment(EnvType.CLIENT) public class DustParticle extends DustParticleBase { @@ -12,9 +13,10 @@ public class DustParticle extends DustParticleBase { ) { super(level, x, y, z, xSpeed, ySpeed, zSpeed, options, sprites); float f = this.random.nextFloat() * 0.4F + 0.6F; - this.rCol = this.randomizeColor(options.getColor().x(), f); - this.gCol = this.randomizeColor(options.getColor().y(), f); - this.bCol = this.randomizeColor(options.getColor().z(), f); + Vector3f vector3f = options.getColor(); + this.rCol = this.randomizeColor(vector3f.x(), f); + this.gCol = this.randomizeColor(vector3f.y(), f); + this.bCol = this.randomizeColor(vector3f.z(), f); } @Environment(EnvType.CLIENT) diff --git a/net/minecraft/client/particle/DustPlumeParticle.java b/net/minecraft/client/particle/DustPlumeParticle.java index 856434b2..84e64277 100644 --- a/net/minecraft/client/particle/DustPlumeParticle.java +++ b/net/minecraft/client/particle/DustPlumeParticle.java @@ -4,7 +4,7 @@ import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.multiplayer.ClientLevel; import net.minecraft.core.particles.SimpleParticleType; -import net.minecraft.util.FastColor; +import net.minecraft.util.ARGB; @Environment(EnvType.CLIENT) public class DustPlumeParticle extends BaseAshSmokeParticle { @@ -15,9 +15,9 @@ public class DustPlumeParticle extends BaseAshSmokeParticle { ) { super(level, x, y, z, 0.7F, 0.6F, 0.7F, xSpeed, ySpeed + 0.15F, zSpeed, quadSizeMultiplier, sprites, 0.5F, 7, 0.5F, false); float f = (float)Math.random() * 0.2F; - this.rCol = FastColor.ARGB32.red(12235202) / 255.0F - f; - this.gCol = FastColor.ARGB32.green(12235202) / 255.0F - f; - this.bCol = FastColor.ARGB32.blue(12235202) / 255.0F - f; + this.rCol = ARGB.red(12235202) / 255.0F - f; + this.gCol = ARGB.green(12235202) / 255.0F - f; + this.bCol = ARGB.blue(12235202) / 255.0F - f; } @Override diff --git a/net/minecraft/client/particle/FireworkParticles.java b/net/minecraft/client/particle/FireworkParticles.java index 77752de8..591ce628 100644 --- a/net/minecraft/client/particle/FireworkParticles.java +++ b/net/minecraft/client/particle/FireworkParticles.java @@ -14,7 +14,7 @@ import net.minecraft.core.particles.SimpleParticleType; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; -import net.minecraft.util.FastColor; +import net.minecraft.util.ARGB; import net.minecraft.util.Mth; import net.minecraft.world.item.DyeColor; import net.minecraft.world.item.component.FireworkExplosion; @@ -232,7 +232,7 @@ public class FireworkParticles { int j = intList.getInt(0); Particle particle = this.engine.createParticle(ParticleTypes.FLASH, this.x, this.y, this.z, 0.0, 0.0, 0.0); - particle.setColor(FastColor.ARGB32.red(j) / 255.0F, FastColor.ARGB32.green(j) / 255.0F, FastColor.ARGB32.blue(j) / 255.0F); + particle.setColor(ARGB.red(j) / 255.0F, ARGB.green(j) / 255.0F, ARGB.blue(j) / 255.0F); } this.life++; diff --git a/net/minecraft/client/particle/FlyStraightTowardsParticle.java b/net/minecraft/client/particle/FlyStraightTowardsParticle.java index d48719f0..11e15484 100644 --- a/net/minecraft/client/particle/FlyStraightTowardsParticle.java +++ b/net/minecraft/client/particle/FlyStraightTowardsParticle.java @@ -4,7 +4,7 @@ import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.multiplayer.ClientLevel; import net.minecraft.core.particles.SimpleParticleType; -import net.minecraft.util.FastColor; +import net.minecraft.util.ARGB; import net.minecraft.util.Mth; @Environment(EnvType.CLIENT) @@ -63,9 +63,9 @@ public class FlyStraightTowardsParticle extends TextureSheetParticle { this.x = this.xStart + this.xd * g; this.y = this.yStart + this.yd * g; this.z = this.zStart + this.zd * g; - int i = FastColor.ARGB32.lerp(f, this.startColor, this.endColor); - this.setColor(FastColor.ARGB32.red(i) / 255.0F, FastColor.ARGB32.green(i) / 255.0F, FastColor.ARGB32.blue(i) / 255.0F); - this.setAlpha(FastColor.ARGB32.alpha(i) / 255.0F); + int i = ARGB.lerp(f, this.startColor, this.endColor); + this.setColor(ARGB.red(i) / 255.0F, ARGB.green(i) / 255.0F, ARGB.blue(i) / 255.0F); + this.setAlpha(ARGB.alpha(i) / 255.0F); } } diff --git a/net/minecraft/client/particle/FlyTowardsPositionParticle.java b/net/minecraft/client/particle/FlyTowardsPositionParticle.java index 35bbc461..d9d5df6e 100644 --- a/net/minecraft/client/particle/FlyTowardsPositionParticle.java +++ b/net/minecraft/client/particle/FlyTowardsPositionParticle.java @@ -5,6 +5,7 @@ import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.Camera; import net.minecraft.client.multiplayer.ClientLevel; +import net.minecraft.client.particle.Particle.LifetimeAlpha; import net.minecraft.core.particles.SimpleParticleType; @Environment(EnvType.CLIENT) @@ -13,14 +14,14 @@ public class FlyTowardsPositionParticle extends TextureSheetParticle { private final double yStart; private final double zStart; private final boolean isGlowing; - private final Particle.LifetimeAlpha lifetimeAlpha; + private final LifetimeAlpha lifetimeAlpha; FlyTowardsPositionParticle(ClientLevel level, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed) { - this(level, x, y, z, xSpeed, ySpeed, zSpeed, false, Particle.LifetimeAlpha.ALWAYS_OPAQUE); + this(level, x, y, z, xSpeed, ySpeed, zSpeed, false, LifetimeAlpha.ALWAYS_OPAQUE); } FlyTowardsPositionParticle( - ClientLevel level, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed, boolean isGlowing, Particle.LifetimeAlpha lifetimeAlpha + ClientLevel level, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed, boolean isGlowing, LifetimeAlpha lifetimeAlpha ) { super(level, x, y, z); this.isGlowing = isGlowing; @@ -143,7 +144,7 @@ public class FlyTowardsPositionParticle extends TextureSheetParticle { public Particle createParticle(SimpleParticleType type, ClientLevel level, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed) { FlyTowardsPositionParticle flyTowardsPositionParticle = new FlyTowardsPositionParticle( - level, x, y, z, xSpeed, ySpeed, zSpeed, true, new Particle.LifetimeAlpha(0.0F, 0.6F, 0.25F, 1.0F) + level, x, y, z, xSpeed, ySpeed, zSpeed, true, new LifetimeAlpha(0.0F, 0.6F, 0.25F, 1.0F) ); flyTowardsPositionParticle.scale(1.5F); flyTowardsPositionParticle.pickSprite(this.sprite); diff --git a/net/minecraft/client/particle/GustParticle.java b/net/minecraft/client/particle/GustParticle.java index c83e21bb..f504b34a 100644 --- a/net/minecraft/client/particle/GustParticle.java +++ b/net/minecraft/client/particle/GustParticle.java @@ -20,7 +20,7 @@ public class GustParticle extends TextureSheetParticle { @Override public ParticleRenderType getRenderType() { - return ParticleRenderType.PARTICLE_SHEET_LIT; + return ParticleRenderType.PARTICLE_SHEET_OPAQUE; } @Override diff --git a/net/minecraft/client/particle/HugeExplosionParticle.java b/net/minecraft/client/particle/HugeExplosionParticle.java index be9f87d1..b90c13e3 100644 --- a/net/minecraft/client/particle/HugeExplosionParticle.java +++ b/net/minecraft/client/particle/HugeExplosionParticle.java @@ -40,7 +40,7 @@ public class HugeExplosionParticle extends TextureSheetParticle { @Override public ParticleRenderType getRenderType() { - return ParticleRenderType.PARTICLE_SHEET_LIT; + return ParticleRenderType.PARTICLE_SHEET_OPAQUE; } @Environment(EnvType.CLIENT) diff --git a/net/minecraft/client/particle/ItemPickupParticle.java b/net/minecraft/client/particle/ItemPickupParticle.java index 4be21ba2..97bb312c 100644 --- a/net/minecraft/client/particle/ItemPickupParticle.java +++ b/net/minecraft/client/particle/ItemPickupParticle.java @@ -72,7 +72,6 @@ public class ItemPickupParticle extends Particle { h - vec3.x(), i - vec3.y(), j - vec3.z(), - this.itemEntity.getYRot(), partialTicks, new PoseStack(), bufferSource, diff --git a/net/minecraft/client/particle/MobAppearanceParticle.java b/net/minecraft/client/particle/MobAppearanceParticle.java index a0e9d36b..c63a096c 100644 --- a/net/minecraft/client/particle/MobAppearanceParticle.java +++ b/net/minecraft/client/particle/MobAppearanceParticle.java @@ -16,7 +16,7 @@ import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.entity.ElderGuardianRenderer; import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.core.particles.SimpleParticleType; -import net.minecraft.util.FastColor; +import net.minecraft.util.ARGB; import net.minecraft.util.Mth; @Environment(EnvType.CLIENT) @@ -40,12 +40,13 @@ public class MobAppearanceParticle extends Particle { public void render(VertexConsumer buffer, Camera camera, float partialTicks) { float f = (this.age + partialTicks) / this.lifetime; float g = 0.05F + 0.5F * Mth.sin(f * (float) Math.PI); - int i = FastColor.ARGB32.colorFromFloat(g, 1.0F, 1.0F, 1.0F); + int i = ARGB.colorFromFloat(g, 1.0F, 1.0F, 1.0F); PoseStack poseStack = new PoseStack(); poseStack.mulPose(camera.rotation()); - poseStack.mulPose(Axis.XP.rotationDegrees(150.0F * f - 60.0F)); - poseStack.scale(1.0F, -1.0F, -1.0F); - poseStack.translate(0.0F, -1.101F, 1.5F); + poseStack.mulPose(Axis.XP.rotationDegrees(60.0F - 150.0F * f)); + float h = 0.42553192F; + poseStack.scale(0.42553192F, -0.42553192F, -0.42553192F); + poseStack.translate(0.0F, -0.56F, 3.5F); MultiBufferSource.BufferSource bufferSource = Minecraft.getInstance().renderBuffers().bufferSource(); VertexConsumer vertexConsumer = bufferSource.getBuffer(this.renderType); this.model.renderToBuffer(poseStack, vertexConsumer, 15728880, OverlayTexture.NO_OVERLAY, i); diff --git a/net/minecraft/client/particle/ParticleEngine.java b/net/minecraft/client/particle/ParticleEngine.java index f430e71f..9def498b 100644 --- a/net/minecraft/client/particle/ParticleEngine.java +++ b/net/minecraft/client/particle/ParticleEngine.java @@ -36,12 +36,42 @@ import net.minecraft.ReportedException; import net.minecraft.Util; import net.minecraft.client.Camera; import net.minecraft.client.multiplayer.ClientLevel; -import net.minecraft.client.renderer.GameRenderer; +import net.minecraft.client.particle.BlockMarker.Provider; +import net.minecraft.client.particle.BreakingItemParticle.CobwebProvider; +import net.minecraft.client.particle.BreakingItemParticle.SlimeProvider; +import net.minecraft.client.particle.BreakingItemParticle.SnowballProvider; +import net.minecraft.client.particle.CampfireSmokeParticle.CosyProvider; +import net.minecraft.client.particle.CampfireSmokeParticle.SignalProvider; +import net.minecraft.client.particle.CritParticle.DamageIndicatorProvider; +import net.minecraft.client.particle.CritParticle.MagicProvider; +import net.minecraft.client.particle.FlameParticle.SmallFlameProvider; +import net.minecraft.client.particle.GlowParticle.ElectricSparkProvider; +import net.minecraft.client.particle.GlowParticle.GlowSquidProvider; +import net.minecraft.client.particle.GlowParticle.ScrapeProvider; +import net.minecraft.client.particle.GlowParticle.WaxOffProvider; +import net.minecraft.client.particle.GlowParticle.WaxOnProvider; +import net.minecraft.client.particle.HeartParticle.AngryVillagerProvider; +import net.minecraft.client.particle.ParticleProvider.Sprite; +import net.minecraft.client.particle.PlayerCloudParticle.SneezeProvider; +import net.minecraft.client.particle.ReversePortalParticle.ReversePortalProvider; +import net.minecraft.client.particle.SoulParticle.EmissiveProvider; +import net.minecraft.client.particle.SpellParticle.InstantProvider; +import net.minecraft.client.particle.SpellParticle.MobEffectProvider; +import net.minecraft.client.particle.SpellParticle.WitchProvider; +import net.minecraft.client.particle.SuspendedParticle.CrimsonSporeProvider; +import net.minecraft.client.particle.SuspendedParticle.SporeBlossomAirProvider; +import net.minecraft.client.particle.SuspendedParticle.UnderwaterProvider; +import net.minecraft.client.particle.SuspendedParticle.WarpedSporeProvider; +import net.minecraft.client.particle.SuspendedTownParticle.ComposterFillProvider; +import net.minecraft.client.particle.SuspendedTownParticle.DolphinSpeedProvider; +import net.minecraft.client.particle.SuspendedTownParticle.EggCrackProvider; +import net.minecraft.client.particle.SuspendedTownParticle.HappyVillagerProvider; import net.minecraft.client.renderer.LightTexture; import net.minecraft.client.renderer.texture.SpriteLoader; import net.minecraft.client.renderer.texture.TextureAtlas; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.texture.TextureManager; +import net.minecraft.client.renderer.texture.SpriteLoader.Preparations; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.particles.ParticleGroup; @@ -57,6 +87,7 @@ import net.minecraft.server.packs.resources.ResourceManager; import net.minecraft.util.GsonHelper; import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; +import net.minecraft.util.profiling.Profiler; import net.minecraft.util.profiling.ProfilerFiller; import net.minecraft.world.entity.Entity; import net.minecraft.world.level.block.RenderShape; @@ -73,11 +104,7 @@ public class ParticleEngine implements PreparableReloadListener { private static final ResourceLocation PARTICLES_ATLAS_INFO = ResourceLocation.withDefaultNamespace("particles"); private static final int MAX_PARTICLES_PER_LAYER = 16384; private static final List RENDER_ORDER = ImmutableList.of( - ParticleRenderType.TERRAIN_SHEET, - ParticleRenderType.PARTICLE_SHEET_OPAQUE, - ParticleRenderType.PARTICLE_SHEET_LIT, - ParticleRenderType.PARTICLE_SHEET_TRANSLUCENT, - ParticleRenderType.CUSTOM + ParticleRenderType.TERRAIN_SHEET, ParticleRenderType.PARTICLE_SHEET_OPAQUE, ParticleRenderType.PARTICLE_SHEET_TRANSLUCENT, ParticleRenderType.CUSTOM ); protected ClientLevel level; private final Map> particles = Maps.>newIdentityHashMap(); @@ -99,93 +126,93 @@ public class ParticleEngine implements PreparableReloadListener { } private void registerProviders() { - this.register(ParticleTypes.ANGRY_VILLAGER, HeartParticle.AngryVillagerProvider::new); - this.register(ParticleTypes.BLOCK_MARKER, new BlockMarker.Provider()); + this.register(ParticleTypes.ANGRY_VILLAGER, AngryVillagerProvider::new); + this.register(ParticleTypes.BLOCK_MARKER, new Provider()); this.register(ParticleTypes.BLOCK, new TerrainParticle.Provider()); - this.register(ParticleTypes.BUBBLE, BubbleParticle.Provider::new); - this.register(ParticleTypes.BUBBLE_COLUMN_UP, BubbleColumnUpParticle.Provider::new); - this.register(ParticleTypes.BUBBLE_POP, BubblePopParticle.Provider::new); - this.register(ParticleTypes.CAMPFIRE_COSY_SMOKE, CampfireSmokeParticle.CosyProvider::new); - this.register(ParticleTypes.CAMPFIRE_SIGNAL_SMOKE, CampfireSmokeParticle.SignalProvider::new); - this.register(ParticleTypes.CLOUD, PlayerCloudParticle.Provider::new); - this.register(ParticleTypes.COMPOSTER, SuspendedTownParticle.ComposterFillProvider::new); - this.register(ParticleTypes.CRIT, CritParticle.Provider::new); - this.register(ParticleTypes.CURRENT_DOWN, WaterCurrentDownParticle.Provider::new); - this.register(ParticleTypes.DAMAGE_INDICATOR, CritParticle.DamageIndicatorProvider::new); - this.register(ParticleTypes.DRAGON_BREATH, DragonBreathParticle.Provider::new); - this.register(ParticleTypes.DOLPHIN, SuspendedTownParticle.DolphinSpeedProvider::new); + this.register(ParticleTypes.BUBBLE, net.minecraft.client.particle.BubbleParticle.Provider::new); + this.register(ParticleTypes.BUBBLE_COLUMN_UP, net.minecraft.client.particle.BubbleColumnUpParticle.Provider::new); + this.register(ParticleTypes.BUBBLE_POP, net.minecraft.client.particle.BubblePopParticle.Provider::new); + this.register(ParticleTypes.CAMPFIRE_COSY_SMOKE, CosyProvider::new); + this.register(ParticleTypes.CAMPFIRE_SIGNAL_SMOKE, SignalProvider::new); + this.register(ParticleTypes.CLOUD, net.minecraft.client.particle.PlayerCloudParticle.Provider::new); + this.register(ParticleTypes.COMPOSTER, ComposterFillProvider::new); + this.register(ParticleTypes.CRIT, net.minecraft.client.particle.CritParticle.Provider::new); + this.register(ParticleTypes.CURRENT_DOWN, net.minecraft.client.particle.WaterCurrentDownParticle.Provider::new); + this.register(ParticleTypes.DAMAGE_INDICATOR, DamageIndicatorProvider::new); + this.register(ParticleTypes.DRAGON_BREATH, net.minecraft.client.particle.DragonBreathParticle.Provider::new); + this.register(ParticleTypes.DOLPHIN, DolphinSpeedProvider::new); this.register(ParticleTypes.DRIPPING_LAVA, DripParticle::createLavaHangParticle); this.register(ParticleTypes.FALLING_LAVA, DripParticle::createLavaFallParticle); this.register(ParticleTypes.LANDING_LAVA, DripParticle::createLavaLandParticle); this.register(ParticleTypes.DRIPPING_WATER, DripParticle::createWaterHangParticle); this.register(ParticleTypes.FALLING_WATER, DripParticle::createWaterFallParticle); this.register(ParticleTypes.DUST, DustParticle.Provider::new); - this.register(ParticleTypes.DUST_COLOR_TRANSITION, DustColorTransitionParticle.Provider::new); - this.register(ParticleTypes.EFFECT, SpellParticle.Provider::new); + this.register(ParticleTypes.DUST_COLOR_TRANSITION, net.minecraft.client.particle.DustColorTransitionParticle.Provider::new); + this.register(ParticleTypes.EFFECT, net.minecraft.client.particle.SpellParticle.Provider::new); this.register(ParticleTypes.ELDER_GUARDIAN, new MobAppearanceParticle.Provider()); - this.register(ParticleTypes.ENCHANTED_HIT, CritParticle.MagicProvider::new); + this.register(ParticleTypes.ENCHANTED_HIT, MagicProvider::new); this.register(ParticleTypes.ENCHANT, FlyTowardsPositionParticle.EnchantProvider::new); - this.register(ParticleTypes.END_ROD, EndRodParticle.Provider::new); - this.register(ParticleTypes.ENTITY_EFFECT, SpellParticle.MobEffectProvider::new); - this.register(ParticleTypes.EXPLOSION_EMITTER, new HugeExplosionSeedParticle.Provider()); + this.register(ParticleTypes.END_ROD, net.minecraft.client.particle.EndRodParticle.Provider::new); + this.register(ParticleTypes.ENTITY_EFFECT, MobEffectProvider::new); + this.register(ParticleTypes.EXPLOSION_EMITTER, new net.minecraft.client.particle.HugeExplosionSeedParticle.Provider()); this.register(ParticleTypes.EXPLOSION, HugeExplosionParticle.Provider::new); this.register(ParticleTypes.SONIC_BOOM, SonicBoomParticle.Provider::new); - this.register(ParticleTypes.FALLING_DUST, FallingDustParticle.Provider::new); + this.register(ParticleTypes.FALLING_DUST, net.minecraft.client.particle.FallingDustParticle.Provider::new); this.register(ParticleTypes.GUST, GustParticle.Provider::new); this.register(ParticleTypes.SMALL_GUST, GustParticle.SmallProvider::new); - this.register(ParticleTypes.GUST_EMITTER_LARGE, new GustSeedParticle.Provider(3.0, 7, 0)); - this.register(ParticleTypes.GUST_EMITTER_SMALL, new GustSeedParticle.Provider(1.0, 3, 2)); + this.register(ParticleTypes.GUST_EMITTER_LARGE, new net.minecraft.client.particle.GustSeedParticle.Provider(3.0, 7, 0)); + this.register(ParticleTypes.GUST_EMITTER_SMALL, new net.minecraft.client.particle.GustSeedParticle.Provider(1.0, 3, 2)); this.register(ParticleTypes.FIREWORK, FireworkParticles.SparkProvider::new); - this.register(ParticleTypes.FISHING, WakeParticle.Provider::new); - this.register(ParticleTypes.FLAME, FlameParticle.Provider::new); - this.register(ParticleTypes.INFESTED, SpellParticle.Provider::new); - this.register(ParticleTypes.SCULK_SOUL, SoulParticle.EmissiveProvider::new); - this.register(ParticleTypes.SCULK_CHARGE, SculkChargeParticle.Provider::new); - this.register(ParticleTypes.SCULK_CHARGE_POP, SculkChargePopParticle.Provider::new); - this.register(ParticleTypes.SOUL, SoulParticle.Provider::new); - this.register(ParticleTypes.SOUL_FIRE_FLAME, FlameParticle.Provider::new); + this.register(ParticleTypes.FISHING, net.minecraft.client.particle.WakeParticle.Provider::new); + this.register(ParticleTypes.FLAME, net.minecraft.client.particle.FlameParticle.Provider::new); + this.register(ParticleTypes.INFESTED, net.minecraft.client.particle.SpellParticle.Provider::new); + this.register(ParticleTypes.SCULK_SOUL, EmissiveProvider::new); + this.register(ParticleTypes.SCULK_CHARGE, net.minecraft.client.particle.SculkChargeParticle.Provider::new); + this.register(ParticleTypes.SCULK_CHARGE_POP, net.minecraft.client.particle.SculkChargePopParticle.Provider::new); + this.register(ParticleTypes.SOUL, net.minecraft.client.particle.SoulParticle.Provider::new); + this.register(ParticleTypes.SOUL_FIRE_FLAME, net.minecraft.client.particle.FlameParticle.Provider::new); this.register(ParticleTypes.FLASH, FireworkParticles.FlashProvider::new); - this.register(ParticleTypes.HAPPY_VILLAGER, SuspendedTownParticle.HappyVillagerProvider::new); - this.register(ParticleTypes.HEART, HeartParticle.Provider::new); - this.register(ParticleTypes.INSTANT_EFFECT, SpellParticle.InstantProvider::new); - this.register(ParticleTypes.ITEM, new BreakingItemParticle.Provider()); - this.register(ParticleTypes.ITEM_SLIME, new BreakingItemParticle.SlimeProvider()); - this.register(ParticleTypes.ITEM_COBWEB, new BreakingItemParticle.CobwebProvider()); - this.register(ParticleTypes.ITEM_SNOWBALL, new BreakingItemParticle.SnowballProvider()); - this.register(ParticleTypes.LARGE_SMOKE, LargeSmokeParticle.Provider::new); - this.register(ParticleTypes.LAVA, LavaParticle.Provider::new); - this.register(ParticleTypes.MYCELIUM, SuspendedTownParticle.Provider::new); + this.register(ParticleTypes.HAPPY_VILLAGER, HappyVillagerProvider::new); + this.register(ParticleTypes.HEART, net.minecraft.client.particle.HeartParticle.Provider::new); + this.register(ParticleTypes.INSTANT_EFFECT, InstantProvider::new); + this.register(ParticleTypes.ITEM, new net.minecraft.client.particle.BreakingItemParticle.Provider()); + this.register(ParticleTypes.ITEM_SLIME, new SlimeProvider()); + this.register(ParticleTypes.ITEM_COBWEB, new CobwebProvider()); + this.register(ParticleTypes.ITEM_SNOWBALL, new SnowballProvider()); + this.register(ParticleTypes.LARGE_SMOKE, net.minecraft.client.particle.LargeSmokeParticle.Provider::new); + this.register(ParticleTypes.LAVA, net.minecraft.client.particle.LavaParticle.Provider::new); + this.register(ParticleTypes.MYCELIUM, net.minecraft.client.particle.SuspendedTownParticle.Provider::new); this.register(ParticleTypes.NAUTILUS, FlyTowardsPositionParticle.NautilusProvider::new); - this.register(ParticleTypes.NOTE, NoteParticle.Provider::new); - this.register(ParticleTypes.POOF, ExplodeParticle.Provider::new); - this.register(ParticleTypes.PORTAL, PortalParticle.Provider::new); - this.register(ParticleTypes.RAIN, WaterDropParticle.Provider::new); - this.register(ParticleTypes.SMOKE, SmokeParticle.Provider::new); - this.register(ParticleTypes.WHITE_SMOKE, WhiteSmokeParticle.Provider::new); - this.register(ParticleTypes.SNEEZE, PlayerCloudParticle.SneezeProvider::new); - this.register(ParticleTypes.SNOWFLAKE, SnowflakeParticle.Provider::new); - this.register(ParticleTypes.SPIT, SpitParticle.Provider::new); + this.register(ParticleTypes.NOTE, net.minecraft.client.particle.NoteParticle.Provider::new); + this.register(ParticleTypes.POOF, net.minecraft.client.particle.ExplodeParticle.Provider::new); + this.register(ParticleTypes.PORTAL, net.minecraft.client.particle.PortalParticle.Provider::new); + this.register(ParticleTypes.RAIN, net.minecraft.client.particle.WaterDropParticle.Provider::new); + this.register(ParticleTypes.SMOKE, net.minecraft.client.particle.SmokeParticle.Provider::new); + this.register(ParticleTypes.WHITE_SMOKE, net.minecraft.client.particle.WhiteSmokeParticle.Provider::new); + this.register(ParticleTypes.SNEEZE, SneezeProvider::new); + this.register(ParticleTypes.SNOWFLAKE, net.minecraft.client.particle.SnowflakeParticle.Provider::new); + this.register(ParticleTypes.SPIT, net.minecraft.client.particle.SpitParticle.Provider::new); this.register(ParticleTypes.SWEEP_ATTACK, AttackSweepParticle.Provider::new); - this.register(ParticleTypes.TOTEM_OF_UNDYING, TotemParticle.Provider::new); + this.register(ParticleTypes.TOTEM_OF_UNDYING, net.minecraft.client.particle.TotemParticle.Provider::new); this.register(ParticleTypes.SQUID_INK, SquidInkParticle.Provider::new); - this.register(ParticleTypes.UNDERWATER, SuspendedParticle.UnderwaterProvider::new); - this.register(ParticleTypes.SPLASH, SplashParticle.Provider::new); - this.register(ParticleTypes.WITCH, SpellParticle.WitchProvider::new); + this.register(ParticleTypes.UNDERWATER, UnderwaterProvider::new); + this.register(ParticleTypes.SPLASH, net.minecraft.client.particle.SplashParticle.Provider::new); + this.register(ParticleTypes.WITCH, WitchProvider::new); this.register(ParticleTypes.DRIPPING_HONEY, DripParticle::createHoneyHangParticle); this.register(ParticleTypes.FALLING_HONEY, DripParticle::createHoneyFallParticle); this.register(ParticleTypes.LANDING_HONEY, DripParticle::createHoneyLandParticle); this.register(ParticleTypes.FALLING_NECTAR, DripParticle::createNectarFallParticle); this.register(ParticleTypes.FALLING_SPORE_BLOSSOM, DripParticle::createSporeBlossomFallParticle); - this.register(ParticleTypes.SPORE_BLOSSOM_AIR, SuspendedParticle.SporeBlossomAirProvider::new); - this.register(ParticleTypes.ASH, AshParticle.Provider::new); - this.register(ParticleTypes.CRIMSON_SPORE, SuspendedParticle.CrimsonSporeProvider::new); - this.register(ParticleTypes.WARPED_SPORE, SuspendedParticle.WarpedSporeProvider::new); + this.register(ParticleTypes.SPORE_BLOSSOM_AIR, SporeBlossomAirProvider::new); + this.register(ParticleTypes.ASH, net.minecraft.client.particle.AshParticle.Provider::new); + this.register(ParticleTypes.CRIMSON_SPORE, CrimsonSporeProvider::new); + this.register(ParticleTypes.WARPED_SPORE, WarpedSporeProvider::new); this.register(ParticleTypes.DRIPPING_OBSIDIAN_TEAR, DripParticle::createObsidianTearHangParticle); this.register(ParticleTypes.FALLING_OBSIDIAN_TEAR, DripParticle::createObsidianTearFallParticle); this.register(ParticleTypes.LANDING_OBSIDIAN_TEAR, DripParticle::createObsidianTearLandParticle); - this.register(ParticleTypes.REVERSE_PORTAL, ReversePortalParticle.ReversePortalProvider::new); + this.register(ParticleTypes.REVERSE_PORTAL, ReversePortalProvider::new); this.register(ParticleTypes.WHITE_ASH, WhiteAshParticle.Provider::new); - this.register(ParticleTypes.SMALL_FLAME, FlameParticle.SmallFlameProvider::new); + this.register(ParticleTypes.SMALL_FLAME, SmallFlameProvider::new); this.register(ParticleTypes.DRIPPING_DRIPSTONE_WATER, DripParticle::createDripstoneWaterHangParticle); this.register(ParticleTypes.FALLING_DRIPSTONE_WATER, DripParticle::createDripstoneWaterFallParticle); this.register( @@ -193,30 +220,32 @@ public class ParticleEngine implements PreparableReloadListener { ); this.register(ParticleTypes.DRIPPING_DRIPSTONE_LAVA, DripParticle::createDripstoneLavaHangParticle); this.register(ParticleTypes.FALLING_DRIPSTONE_LAVA, DripParticle::createDripstoneLavaFallParticle); - this.register(ParticleTypes.VIBRATION, VibrationSignalParticle.Provider::new); + this.register(ParticleTypes.VIBRATION, net.minecraft.client.particle.VibrationSignalParticle.Provider::new); + this.register(ParticleTypes.TRAIL, TrailParticle.Provider::new); this.register(ParticleTypes.GLOW_SQUID_INK, SquidInkParticle.GlowInkProvider::new); - this.register(ParticleTypes.GLOW, GlowParticle.GlowSquidProvider::new); - this.register(ParticleTypes.WAX_ON, GlowParticle.WaxOnProvider::new); - this.register(ParticleTypes.WAX_OFF, GlowParticle.WaxOffProvider::new); - this.register(ParticleTypes.ELECTRIC_SPARK, GlowParticle.ElectricSparkProvider::new); - this.register(ParticleTypes.SCRAPE, GlowParticle.ScrapeProvider::new); - this.register(ParticleTypes.SHRIEK, ShriekParticle.Provider::new); - this.register(ParticleTypes.EGG_CRACK, SuspendedTownParticle.EggCrackProvider::new); + this.register(ParticleTypes.GLOW, GlowSquidProvider::new); + this.register(ParticleTypes.WAX_ON, WaxOnProvider::new); + this.register(ParticleTypes.WAX_OFF, WaxOffProvider::new); + this.register(ParticleTypes.ELECTRIC_SPARK, ElectricSparkProvider::new); + this.register(ParticleTypes.SCRAPE, ScrapeProvider::new); + this.register(ParticleTypes.SHRIEK, net.minecraft.client.particle.ShriekParticle.Provider::new); + this.register(ParticleTypes.EGG_CRACK, EggCrackProvider::new); this.register(ParticleTypes.DUST_PLUME, DustPlumeParticle.Provider::new); - this.register(ParticleTypes.TRIAL_SPAWNER_DETECTED_PLAYER, TrialSpawnerDetectionParticle.Provider::new); - this.register(ParticleTypes.TRIAL_SPAWNER_DETECTED_PLAYER_OMINOUS, TrialSpawnerDetectionParticle.Provider::new); + this.register(ParticleTypes.TRIAL_SPAWNER_DETECTED_PLAYER, net.minecraft.client.particle.TrialSpawnerDetectionParticle.Provider::new); + this.register(ParticleTypes.TRIAL_SPAWNER_DETECTED_PLAYER_OMINOUS, net.minecraft.client.particle.TrialSpawnerDetectionParticle.Provider::new); this.register(ParticleTypes.VAULT_CONNECTION, FlyTowardsPositionParticle.VaultConnectionProvider::new); this.register(ParticleTypes.DUST_PILLAR, new TerrainParticle.DustPillarProvider()); - this.register(ParticleTypes.RAID_OMEN, SpellParticle.Provider::new); - this.register(ParticleTypes.TRIAL_OMEN, SpellParticle.Provider::new); + this.register(ParticleTypes.RAID_OMEN, net.minecraft.client.particle.SpellParticle.Provider::new); + this.register(ParticleTypes.TRIAL_OMEN, net.minecraft.client.particle.SpellParticle.Provider::new); this.register(ParticleTypes.OMINOUS_SPAWNING, FlyStraightTowardsParticle.OminousSpawnProvider::new); + this.register(ParticleTypes.BLOCK_CRUMBLE, new TerrainParticle.CrumblingProvider()); } private void register(ParticleType particleType, ParticleProvider particleFactory) { this.providers.put(BuiltInRegistries.PARTICLE_TYPE.getId(particleType), particleFactory); } - private void register(ParticleType particleType, ParticleProvider.Sprite sprite) { + private void register(ParticleType particleType, Sprite sprite) { this.register(particleType, spriteSet -> (particleOptions, clientLevel, d, e, f, g, h, i) -> { TextureSheetParticle textureSheetParticle = sprite.createParticle(particleOptions, clientLevel, d, e, f, g, h, i); if (textureSheetParticle != null) { @@ -235,19 +264,14 @@ public class ParticleEngine implements PreparableReloadListener { @Override public CompletableFuture reload( - PreparableReloadListener.PreparationBarrier preparationBarrier, - ResourceManager resourceManager, - ProfilerFiller preparationsProfiler, - ProfilerFiller reloadProfiler, - Executor backgroundExecutor, - Executor gameExecutor + PreparableReloadListener.PreparationBarrier preparationBarrier, ResourceManager resourceManager, Executor executor, Executor executor2 ) { @Environment(EnvType.CLIENT) record ParticleDefinition(ResourceLocation id, Optional> sprites) { } CompletableFuture> completableFuture = CompletableFuture.supplyAsync( - () -> PARTICLE_LISTER.listMatchingResources(resourceManager), backgroundExecutor + () -> PARTICLE_LISTER.listMatchingResources(resourceManager), executor ) .thenCompose( map -> { @@ -256,25 +280,23 @@ public class ParticleEngine implements PreparableReloadListener { (resourceLocation, resource) -> { ResourceLocation resourceLocation2 = PARTICLE_LISTER.fileToId(resourceLocation); list.add( - CompletableFuture.supplyAsync( - () -> new ParticleDefinition(resourceLocation2, this.loadParticleDescription(resourceLocation2, resource)), backgroundExecutor - ) + CompletableFuture.supplyAsync(() -> new ParticleDefinition(resourceLocation2, this.loadParticleDescription(resourceLocation2, resource)), executor) ); } ); return Util.sequence(list); } ); - CompletableFuture completableFuture2 = SpriteLoader.create(this.textureAtlas) - .loadAndStitch(resourceManager, PARTICLES_ATLAS_INFO, 0, backgroundExecutor) - .thenCompose(SpriteLoader.Preparations::waitForUpload); + CompletableFuture completableFuture2 = SpriteLoader.create(this.textureAtlas) + .loadAndStitch(resourceManager, PARTICLES_ATLAS_INFO, 0, executor) + .thenCompose(Preparations::waitForUpload); return CompletableFuture.allOf(completableFuture2, completableFuture).thenCompose(preparationBarrier::wait).thenAcceptAsync(void_ -> { this.clearParticles(); - reloadProfiler.startTick(); - reloadProfiler.push("upload"); - SpriteLoader.Preparations preparations = (SpriteLoader.Preparations)completableFuture2.join(); + ProfilerFiller profilerFiller = Profiler.get(); + profilerFiller.push("upload"); + Preparations preparations = (Preparations)completableFuture2.join(); this.textureAtlas.upload(preparations); - reloadProfiler.popPush("bindSpriteSets"); + profilerFiller.popPush("bindSpriteSets"); Set set = new HashSet(); TextureAtlasSprite textureAtlasSprite = preparations.missing(); ((List)completableFuture.join()).forEach(arg -> { @@ -303,9 +325,8 @@ public class ParticleEngine implements PreparableReloadListener { LOGGER.warn("Missing particle sprites: {}", set.stream().sorted().map(ResourceLocation::toString).collect(Collectors.joining(","))); } - reloadProfiler.pop(); - reloadProfiler.endTick(); - }, gameExecutor); + profilerFiller.pop(); + }, executor2); } public void close() { @@ -386,9 +407,9 @@ public class ParticleEngine implements PreparableReloadListener { public void tick() { this.particles.forEach((particleRenderType, queue) -> { - this.level.getProfiler().push(particleRenderType.toString()); + Profiler.get().push(particleRenderType.toString()); this.tickParticleList(queue); - this.level.getProfiler().pop(); + Profiler.get().pop(); }); if (!this.trackingEmitters.isEmpty()) { List list = Lists.newArrayList(); @@ -449,7 +470,6 @@ public class ParticleEngine implements PreparableReloadListener { for (ParticleRenderType particleRenderType : RENDER_ORDER) { Queue queue = (Queue)this.particles.get(particleRenderType); if (queue != null && !queue.isEmpty()) { - RenderSystem.setShader(GameRenderer::getParticleShader); Tesselator tesselator = Tesselator.getInstance(); BufferBuilder bufferBuilder = particleRenderType.begin(tesselator, this.textureManager); if (bufferBuilder != null) { diff --git a/net/minecraft/client/particle/ParticleRenderType.java b/net/minecraft/client/particle/ParticleRenderType.java index 1276de69..c9586696 100644 --- a/net/minecraft/client/particle/ParticleRenderType.java +++ b/net/minecraft/client/particle/ParticleRenderType.java @@ -7,7 +7,7 @@ import com.mojang.blaze3d.vertex.Tesselator; import com.mojang.blaze3d.vertex.VertexFormat; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; -import net.minecraft.client.renderer.GameRenderer; +import net.minecraft.client.renderer.CoreShaders; import net.minecraft.client.renderer.texture.TextureAtlas; import net.minecraft.client.renderer.texture.TextureManager; import org.jetbrains.annotations.Nullable; @@ -20,6 +20,7 @@ public interface ParticleRenderType { RenderSystem.enableBlend(); RenderSystem.defaultBlendFunc(); RenderSystem.depthMask(true); + RenderSystem.setShader(CoreShaders.PARTICLE); RenderSystem.setShaderTexture(0, TextureAtlas.LOCATION_BLOCKS); return tesselator.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.PARTICLE); } @@ -33,7 +34,7 @@ public interface ParticleRenderType { public BufferBuilder begin(Tesselator tesselator, TextureManager textureManager) { RenderSystem.disableBlend(); RenderSystem.depthMask(true); - RenderSystem.setShader(GameRenderer::getParticleShader); + RenderSystem.setShader(CoreShaders.PARTICLE); RenderSystem.setShaderTexture(0, TextureAtlas.LOCATION_PARTICLES); return tesselator.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.PARTICLE); } @@ -46,6 +47,7 @@ public interface ParticleRenderType { @Override public BufferBuilder begin(Tesselator tesselator, TextureManager textureManager) { RenderSystem.depthMask(true); + RenderSystem.setShader(CoreShaders.PARTICLE); RenderSystem.setShaderTexture(0, TextureAtlas.LOCATION_PARTICLES); RenderSystem.enableBlend(); RenderSystem.defaultBlendFunc(); @@ -56,19 +58,6 @@ public interface ParticleRenderType { return "PARTICLE_SHEET_TRANSLUCENT"; } }; - ParticleRenderType PARTICLE_SHEET_LIT = new ParticleRenderType() { - @Override - public BufferBuilder begin(Tesselator tesselator, TextureManager textureManager) { - RenderSystem.disableBlend(); - RenderSystem.depthMask(true); - RenderSystem.setShaderTexture(0, TextureAtlas.LOCATION_PARTICLES); - return tesselator.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.PARTICLE); - } - - public String toString() { - return "PARTICLE_SHEET_LIT"; - } - }; ParticleRenderType CUSTOM = new ParticleRenderType() { @Override public BufferBuilder begin(Tesselator tesselator, TextureManager textureManager) { diff --git a/net/minecraft/client/particle/SquidInkParticle.java b/net/minecraft/client/particle/SquidInkParticle.java index 9335643f..5b7693f7 100644 --- a/net/minecraft/client/particle/SquidInkParticle.java +++ b/net/minecraft/client/particle/SquidInkParticle.java @@ -5,7 +5,7 @@ import net.fabricmc.api.Environment; import net.minecraft.client.multiplayer.ClientLevel; import net.minecraft.core.BlockPos; import net.minecraft.core.particles.SimpleParticleType; -import net.minecraft.util.FastColor; +import net.minecraft.util.ARGB; @Environment(EnvType.CLIENT) public class SquidInkParticle extends SimpleAnimatedParticle { @@ -14,7 +14,7 @@ public class SquidInkParticle extends SimpleAnimatedParticle { this.friction = 0.92F; this.quadSize = 0.5F; this.setAlpha(1.0F); - this.setColor(FastColor.ARGB32.red(packedColor), FastColor.ARGB32.green(packedColor), FastColor.ARGB32.blue(packedColor)); + this.setColor(ARGB.red(packedColor), ARGB.green(packedColor), ARGB.blue(packedColor)); this.lifetime = (int)(this.quadSize * 12.0F / (Math.random() * 0.8F + 0.2F)); this.setSpriteFromAge(sprites); this.hasPhysics = false; @@ -47,7 +47,7 @@ public class SquidInkParticle extends SimpleAnimatedParticle { } public Particle createParticle(SimpleParticleType type, ClientLevel level, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed) { - return new SquidInkParticle(level, x, y, z, xSpeed, ySpeed, zSpeed, FastColor.ARGB32.color(255, 204, 31, 102), this.sprites); + return new SquidInkParticle(level, x, y, z, xSpeed, ySpeed, zSpeed, ARGB.color(255, 204, 31, 102), this.sprites); } } @@ -60,7 +60,7 @@ public class SquidInkParticle extends SimpleAnimatedParticle { } public Particle createParticle(SimpleParticleType type, ClientLevel level, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed) { - return new SquidInkParticle(level, x, y, z, xSpeed, ySpeed, zSpeed, FastColor.ARGB32.color(255, 255, 255, 255), this.sprites); + return new SquidInkParticle(level, x, y, z, xSpeed, ySpeed, zSpeed, ARGB.color(255, 255, 255, 255), this.sprites); } } } diff --git a/net/minecraft/client/particle/TerrainParticle.java b/net/minecraft/client/particle/TerrainParticle.java index 05607c25..826dbf4e 100644 --- a/net/minecraft/client/particle/TerrainParticle.java +++ b/net/minecraft/client/particle/TerrainParticle.java @@ -82,6 +82,20 @@ public class TerrainParticle extends TextureSheetParticle { : null; } + @Environment(EnvType.CLIENT) + public static class CrumblingProvider implements ParticleProvider { + @Nullable + public Particle createParticle(BlockParticleOption blockParticleOption, ClientLevel clientLevel, double d, double e, double f, double g, double h, double i) { + Particle particle = TerrainParticle.createTerrainParticle(blockParticleOption, clientLevel, d, e, f, g, h, i); + if (particle != null) { + particle.setParticleSpeed(0.0, 0.0, 0.0); + particle.setLifetime(clientLevel.random.nextInt(10) + 1); + } + + return particle; + } + } + @Environment(EnvType.CLIENT) public static class DustPillarProvider implements ParticleProvider { @Nullable diff --git a/net/minecraft/client/particle/TrailParticle.java b/net/minecraft/client/particle/TrailParticle.java new file mode 100644 index 00000000..5a71f5a9 --- /dev/null +++ b/net/minecraft/client/particle/TrailParticle.java @@ -0,0 +1,68 @@ +package net.minecraft.client.particle; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.client.multiplayer.ClientLevel; +import net.minecraft.core.particles.TargetColorParticleOption; +import net.minecraft.util.ARGB; +import net.minecraft.util.Mth; +import net.minecraft.world.phys.Vec3; + +@Environment(EnvType.CLIENT) +public class TrailParticle extends TextureSheetParticle { + private final Vec3 target; + + TrailParticle(ClientLevel clientLevel, double d, double e, double f, double g, double h, double i, Vec3 vec3, int j) { + super(clientLevel, d, e, f, g, h, i); + j = ARGB.scaleRGB(j, 0.875F + this.random.nextFloat() * 0.25F, 0.875F + this.random.nextFloat() * 0.25F, 0.875F + this.random.nextFloat() * 0.25F); + this.rCol = ARGB.red(j) / 255.0F; + this.gCol = ARGB.green(j) / 255.0F; + this.bCol = ARGB.blue(j) / 255.0F; + this.quadSize = 0.26F; + this.target = vec3; + } + + @Override + public ParticleRenderType getRenderType() { + return ParticleRenderType.PARTICLE_SHEET_OPAQUE; + } + + @Override + public void tick() { + this.xo = this.x; + this.yo = this.y; + this.zo = this.z; + if (this.age++ >= this.lifetime) { + this.remove(); + } else { + int i = this.lifetime - this.age; + double d = 1.0 / i; + this.x = Mth.lerp(d, this.x, this.target.x()); + this.y = Mth.lerp(d, this.y, this.target.y()); + this.z = Mth.lerp(d, this.z, this.target.z()); + } + } + + @Override + public int getLightColor(float partialTick) { + return 15728880; + } + + @Environment(EnvType.CLIENT) + public static class Provider implements ParticleProvider { + private final SpriteSet sprite; + + public Provider(SpriteSet spriteSet) { + this.sprite = spriteSet; + } + + public Particle createParticle( + TargetColorParticleOption targetColorParticleOption, ClientLevel clientLevel, double d, double e, double f, double g, double h, double i + ) { + TrailParticle trailParticle = new TrailParticle(clientLevel, d, e, f, g, h, i, targetColorParticleOption.target(), targetColorParticleOption.color()); + trailParticle.pickSprite(this.sprite); + trailParticle.setLifetime(clientLevel.random.nextInt(40) + 10); + return trailParticle; + } + } +} diff --git a/net/minecraft/client/particle/WhiteAshParticle.java b/net/minecraft/client/particle/WhiteAshParticle.java index b0184765..e0502a1d 100644 --- a/net/minecraft/client/particle/WhiteAshParticle.java +++ b/net/minecraft/client/particle/WhiteAshParticle.java @@ -4,7 +4,7 @@ import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.multiplayer.ClientLevel; import net.minecraft.core.particles.SimpleParticleType; -import net.minecraft.util.FastColor; +import net.minecraft.util.ARGB; import net.minecraft.util.RandomSource; @Environment(EnvType.CLIENT) @@ -15,9 +15,9 @@ public class WhiteAshParticle extends BaseAshSmokeParticle { ClientLevel level, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed, float quadSizeMultiplier, SpriteSet sprites ) { super(level, x, y, z, 0.1F, -0.1F, 0.1F, xSpeed, ySpeed, zSpeed, quadSizeMultiplier, sprites, 0.0F, 20, 0.0125F, false); - this.rCol = FastColor.ARGB32.red(12235202) / 255.0F; - this.gCol = FastColor.ARGB32.green(12235202) / 255.0F; - this.bCol = FastColor.ARGB32.blue(12235202) / 255.0F; + this.rCol = ARGB.red(12235202) / 255.0F; + this.gCol = ARGB.green(12235202) / 255.0F; + this.bCol = ARGB.blue(12235202) / 255.0F; } @Environment(EnvType.CLIENT) diff --git a/net/minecraft/client/player/AbstractClientPlayer.java b/net/minecraft/client/player/AbstractClientPlayer.java index b52a5583..818af212 100644 --- a/net/minecraft/client/player/AbstractClientPlayer.java +++ b/net/minecraft/client/player/AbstractClientPlayer.java @@ -11,7 +11,6 @@ import net.minecraft.client.resources.PlayerSkin; import net.minecraft.util.Mth; import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.entity.player.Player; -import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.level.GameType; import net.minecraft.world.phys.Vec3; @@ -26,6 +25,8 @@ public abstract class AbstractClientPlayer extends Player { public float elytraRotY; public float elytraRotZ; public final ClientLevel clientLevel; + public float walkDistO; + public float walkDist; public AbstractClientPlayer(ClientLevel clientLevel, GameProfile gameProfile) { super(clientLevel, clientLevel.getSharedSpawnPos(), clientLevel.getSharedSpawnAngle(), gameProfile); @@ -55,6 +56,7 @@ public abstract class AbstractClientPlayer extends Player { @Override public void tick() { + this.walkDistO = this.walkDist; this.deltaMovementOnPreviousTick = this.getDeltaMovement(); super.tick(); } @@ -68,34 +70,27 @@ public abstract class AbstractClientPlayer extends Player { return playerInfo == null ? DefaultPlayerSkin.get(this.getUUID()) : playerInfo.getSkin(); } - public float getFieldOfViewModifier() { - float f = 1.0F; + public float getFieldOfViewModifier(boolean bl, float f) { + float g = 1.0F; if (this.getAbilities().flying) { - f *= 1.1F; + g *= 1.1F; } - f *= ((float)this.getAttributeValue(Attributes.MOVEMENT_SPEED) / this.getAbilities().getWalkingSpeed() + 1.0F) / 2.0F; - if (this.getAbilities().getWalkingSpeed() == 0.0F || Float.isNaN(f) || Float.isInfinite(f)) { - f = 1.0F; + float h = this.getAbilities().getWalkingSpeed(); + if (h != 0.0F) { + float i = (float)this.getAttributeValue(Attributes.MOVEMENT_SPEED) / h; + g *= (i + 1.0F) / 2.0F; } - ItemStack itemStack = this.getUseItem(); if (this.isUsingItem()) { - if (itemStack.is(Items.BOW)) { - int i = this.getTicksUsingItem(); - float g = i / 20.0F; - if (g > 1.0F) { - g = 1.0F; - } else { - g *= g; - } - - f *= 1.0F - g * 0.15F; - } else if (Minecraft.getInstance().options.getCameraType().isFirstPerson() && this.isScoping()) { + if (this.getUseItem().is(Items.BOW)) { + float i = Math.min(this.getTicksUsingItem() / 20.0F, 1.0F); + g *= 1.0F - Mth.square(i) * 0.15F; + } else if (bl && this.isScoping()) { return 0.1F; } } - return Mth.lerp(Minecraft.getInstance().options.fovEffectScale().get().floatValue(), 1.0F, f); + return Mth.lerp(f, 1.0F, g); } } diff --git a/net/minecraft/client/player/Input.java b/net/minecraft/client/player/ClientInput.java similarity index 50% rename from net/minecraft/client/player/Input.java rename to net/minecraft/client/player/ClientInput.java index cafec283..49a38ed9 100644 --- a/net/minecraft/client/player/Input.java +++ b/net/minecraft/client/player/ClientInput.java @@ -2,20 +2,16 @@ package net.minecraft.client.player; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; +import net.minecraft.world.entity.player.Input; import net.minecraft.world.phys.Vec2; @Environment(EnvType.CLIENT) -public class Input { +public class ClientInput { + public Input keyPresses = Input.EMPTY; public float leftImpulse; public float forwardImpulse; - public boolean up; - public boolean down; - public boolean left; - public boolean right; - public boolean jumping; - public boolean shiftKeyDown; - public void tick(boolean isSneaking, float sneakingSpeedMultiplier) { + public void tick(boolean bl, float f) { } public Vec2 getMoveVector() { @@ -25,4 +21,16 @@ public class Input { public boolean hasForwardImpulse() { return this.forwardImpulse > 1.0E-5F; } + + public void makeJump() { + this.keyPresses = new Input( + this.keyPresses.forward(), + this.keyPresses.backward(), + this.keyPresses.left(), + this.keyPresses.right(), + true, + this.keyPresses.shift(), + this.keyPresses.sprint() + ); + } } diff --git a/net/minecraft/client/player/KeyboardInput.java b/net/minecraft/client/player/KeyboardInput.java index 1f78b40a..baebd3d8 100644 --- a/net/minecraft/client/player/KeyboardInput.java +++ b/net/minecraft/client/player/KeyboardInput.java @@ -3,9 +3,10 @@ package net.minecraft.client.player; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.Options; +import net.minecraft.world.entity.player.Input; @Environment(EnvType.CLIENT) -public class KeyboardInput extends Input { +public class KeyboardInput extends ClientInput { private final Options options; public KeyboardInput(Options options) { @@ -21,18 +22,21 @@ public class KeyboardInput extends Input { } @Override - public void tick(boolean isSneaking, float sneakingSpeedMultiplier) { - this.up = this.options.keyUp.isDown(); - this.down = this.options.keyDown.isDown(); - this.left = this.options.keyLeft.isDown(); - this.right = this.options.keyRight.isDown(); - this.forwardImpulse = calculateImpulse(this.up, this.down); - this.leftImpulse = calculateImpulse(this.left, this.right); - this.jumping = this.options.keyJump.isDown(); - this.shiftKeyDown = this.options.keyShift.isDown(); - if (isSneaking) { - this.leftImpulse *= sneakingSpeedMultiplier; - this.forwardImpulse *= sneakingSpeedMultiplier; + public void tick(boolean bl, float f) { + this.keyPresses = new Input( + this.options.keyUp.isDown(), + this.options.keyDown.isDown(), + this.options.keyLeft.isDown(), + this.options.keyRight.isDown(), + this.options.keyJump.isDown(), + this.options.keyShift.isDown(), + this.options.keySprint.isDown() + ); + this.forwardImpulse = calculateImpulse(this.keyPresses.forward(), this.keyPresses.backward()); + this.leftImpulse = calculateImpulse(this.keyPresses.left(), this.keyPresses.right()); + if (bl) { + this.leftImpulse *= f; + this.forwardImpulse *= f; } } } diff --git a/net/minecraft/client/player/LocalPlayer.java b/net/minecraft/client/player/LocalPlayer.java index 0f5e5616..6368d6b3 100644 --- a/net/minecraft/client/player/LocalPlayer.java +++ b/net/minecraft/client/player/LocalPlayer.java @@ -31,10 +31,11 @@ import net.minecraft.client.resources.sounds.ElytraOnPlayerSoundInstance; import net.minecraft.client.resources.sounds.RidingMinecartSoundInstance; import net.minecraft.client.resources.sounds.SimpleSoundInstance; import net.minecraft.client.resources.sounds.UnderwaterAmbientSoundHandler; -import net.minecraft.client.resources.sounds.UnderwaterAmbientSoundInstances; +import net.minecraft.client.resources.sounds.UnderwaterAmbientSoundInstances.UnderwaterAmbientSoundInstance; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.Holder; +import net.minecraft.core.component.DataComponents; import net.minecraft.core.particles.ParticleTypes; import net.minecraft.network.chat.Component; import net.minecraft.network.protocol.game.ServerboundClientCommandPacket; @@ -47,6 +48,7 @@ import net.minecraft.network.protocol.game.ServerboundPlayerCommandPacket; import net.minecraft.network.protocol.game.ServerboundPlayerInputPacket; import net.minecraft.network.protocol.game.ServerboundRecipeBookSeenRecipePacket; import net.minecraft.network.protocol.game.ServerboundSwingPacket; +import net.minecraft.network.protocol.game.ServerboundPlayerCommandPacket.Action; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; @@ -54,26 +56,25 @@ import net.minecraft.sounds.SoundSource; import net.minecraft.stats.StatsCounter; import net.minecraft.tags.FluidTags; import net.minecraft.util.Mth; +import net.minecraft.util.TickThrottler; import net.minecraft.world.InteractionHand; -import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.effect.MobEffect; import net.minecraft.world.effect.MobEffectInstance; import net.minecraft.world.effect.MobEffects; import net.minecraft.world.entity.Entity; -import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.HumanoidArm; import net.minecraft.world.entity.MoverType; import net.minecraft.world.entity.PlayerRideableJumping; import net.minecraft.world.entity.Pose; import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.entity.player.Abilities; +import net.minecraft.world.entity.player.Input; +import net.minecraft.world.entity.vehicle.AbstractBoat; import net.minecraft.world.entity.vehicle.AbstractMinecart; -import net.minecraft.world.entity.vehicle.Boat; import net.minecraft.world.inventory.ClickAction; -import net.minecraft.world.item.ElytraItem; import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.Items; -import net.minecraft.world.item.crafting.RecipeHolder; +import net.minecraft.world.item.component.WritableBookContent; +import net.minecraft.world.item.crafting.display.RecipeDisplayId; import net.minecraft.world.level.BaseCommandBlock; import net.minecraft.world.level.GameType; import net.minecraft.world.level.block.Portal; @@ -103,16 +104,14 @@ public class LocalPlayer extends AbstractClientPlayer { public final ClientPacketListener connection; private final StatsCounter stats; private final ClientRecipeBook recipeBook; + private final TickThrottler dropSpamThrottler = new TickThrottler(20, 1280); private final List ambientSoundHandlers = Lists.newArrayList(); private int permissionLevel = 0; /** * The last X position which was transmitted to the server, used to determine when the X position changes and needs to be re-transmitted */ private double xLast; - /** - * The last Y position which was transmitted to the server, used to determine when the Y position changes and needs to be re-transmitted - */ - private double yLast1; + private double yLast; /** * The last Z position which was transmitted to the server, used to determine when the Z position changes and needs to be re-transmitted */ @@ -126,6 +125,7 @@ public class LocalPlayer extends AbstractClientPlayer { */ private float xRotLast; private boolean lastOnGround; + private boolean lastHorizontalCollision; private boolean crouching; private boolean wasShiftKeyDown; /** @@ -137,7 +137,8 @@ public class LocalPlayer extends AbstractClientPlayer { */ private int positionReminder; private boolean flashOnSetHealth; - public Input input; + public ClientInput input = new ClientInput(); + private Input lastSentInput = Input.EMPTY; protected final Minecraft minecraft; protected int sprintTriggerTime; public float yBob; @@ -180,11 +181,6 @@ public class LocalPlayer extends AbstractClientPlayer { this.ambientSoundHandlers.add(new BiomeAmbientSoundsHandler(this, minecraft.getSoundManager(), clientLevel.getBiomeManager())); } - @Override - public boolean hurt(DamageSource source, float amount) { - return false; - } - @Override public void heal(float healAmount) { } @@ -221,23 +217,27 @@ public class LocalPlayer extends AbstractClientPlayer { @Override public void tick() { - if (this.level().hasChunkAt(this.getBlockX(), this.getBlockZ())) { - super.tick(); - if (this.isPassenger()) { - this.connection.send(new ServerboundMovePlayerPacket.Rot(this.getYRot(), this.getXRot(), this.onGround())); - this.connection.send(new ServerboundPlayerInputPacket(this.xxa, this.zza, this.input.jumping, this.input.shiftKeyDown)); - Entity entity = this.getRootVehicle(); - if (entity != this && entity.isControlledByLocalInstance()) { - this.connection.send(new ServerboundMoveVehiclePacket(entity)); - this.sendIsSprintingIfNeeded(); - } - } else { - this.sendPosition(); - } + this.dropSpamThrottler.tick(); + super.tick(); + this.sendShiftKeyState(); + if (!this.lastSentInput.equals(this.input.keyPresses)) { + this.connection.send(new ServerboundPlayerInputPacket(this.input.keyPresses)); + this.lastSentInput = this.input.keyPresses; + } - for (AmbientSoundHandler ambientSoundHandler : this.ambientSoundHandlers) { - ambientSoundHandler.tick(); + if (this.isPassenger()) { + this.connection.send(new ServerboundMovePlayerPacket.Rot(this.getYRot(), this.getXRot(), this.onGround(), this.horizontalCollision)); + Entity entity = this.getRootVehicle(); + if (entity != this && entity.isControlledByLocalInstance()) { + this.connection.send(new ServerboundMoveVehiclePacket(entity)); + this.sendIsSprintingIfNeeded(); } + } else { + this.sendPosition(); + } + + for (AmbientSoundHandler ambientSoundHandler : this.ambientSoundHandlers) { + ambientSoundHandler.tick(); } } @@ -256,70 +256,68 @@ public class LocalPlayer extends AbstractClientPlayer { */ private void sendPosition() { this.sendIsSprintingIfNeeded(); - boolean bl = this.isShiftKeyDown(); - if (bl != this.wasShiftKeyDown) { - ServerboundPlayerCommandPacket.Action action = bl - ? ServerboundPlayerCommandPacket.Action.PRESS_SHIFT_KEY - : ServerboundPlayerCommandPacket.Action.RELEASE_SHIFT_KEY; - this.connection.send(new ServerboundPlayerCommandPacket(this, action)); - this.wasShiftKeyDown = bl; - } - if (this.isControlledCamera()) { double d = this.getX() - this.xLast; - double e = this.getY() - this.yLast1; + double e = this.getY() - this.yLast; double f = this.getZ() - this.zLast; double g = this.getYRot() - this.yRotLast; double h = this.getXRot() - this.xRotLast; this.positionReminder++; - boolean bl2 = Mth.lengthSquared(d, e, f) > Mth.square(2.0E-4) || this.positionReminder >= 20; - boolean bl3 = g != 0.0 || h != 0.0; - if (this.isPassenger()) { - Vec3 vec3 = this.getDeltaMovement(); - this.connection.send(new ServerboundMovePlayerPacket.PosRot(vec3.x, -999.0, vec3.z, this.getYRot(), this.getXRot(), this.onGround())); - bl2 = false; - } else if (bl2 && bl3) { - this.connection.send(new ServerboundMovePlayerPacket.PosRot(this.getX(), this.getY(), this.getZ(), this.getYRot(), this.getXRot(), this.onGround())); + boolean bl = Mth.lengthSquared(d, e, f) > Mth.square(2.0E-4) || this.positionReminder >= 20; + boolean bl2 = g != 0.0 || h != 0.0; + if (bl && bl2) { + this.connection + .send( + new ServerboundMovePlayerPacket.PosRot(this.getX(), this.getY(), this.getZ(), this.getYRot(), this.getXRot(), this.onGround(), this.horizontalCollision) + ); + } else if (bl) { + this.connection.send(new ServerboundMovePlayerPacket.Pos(this.getX(), this.getY(), this.getZ(), this.onGround(), this.horizontalCollision)); } else if (bl2) { - this.connection.send(new ServerboundMovePlayerPacket.Pos(this.getX(), this.getY(), this.getZ(), this.onGround())); - } else if (bl3) { - this.connection.send(new ServerboundMovePlayerPacket.Rot(this.getYRot(), this.getXRot(), this.onGround())); - } else if (this.lastOnGround != this.onGround()) { - this.connection.send(new ServerboundMovePlayerPacket.StatusOnly(this.onGround())); + this.connection.send(new ServerboundMovePlayerPacket.Rot(this.getYRot(), this.getXRot(), this.onGround(), this.horizontalCollision)); + } else if (this.lastOnGround != this.onGround() || this.lastHorizontalCollision != this.horizontalCollision) { + this.connection.send(new ServerboundMovePlayerPacket.StatusOnly(this.onGround(), this.horizontalCollision)); } - if (bl2) { + if (bl) { this.xLast = this.getX(); - this.yLast1 = this.getY(); + this.yLast = this.getY(); this.zLast = this.getZ(); this.positionReminder = 0; } - if (bl3) { + if (bl2) { this.yRotLast = this.getYRot(); this.xRotLast = this.getXRot(); } this.lastOnGround = this.onGround(); + this.lastHorizontalCollision = this.horizontalCollision; this.autoJumpEnabled = this.minecraft.options.autoJump().get(); } } + private void sendShiftKeyState() { + boolean bl = this.isShiftKeyDown(); + if (bl != this.wasShiftKeyDown) { + Action action = bl ? Action.PRESS_SHIFT_KEY : Action.RELEASE_SHIFT_KEY; + this.connection.send(new ServerboundPlayerCommandPacket(this, action)); + this.wasShiftKeyDown = bl; + } + } + private void sendIsSprintingIfNeeded() { boolean bl = this.isSprinting(); if (bl != this.wasSprinting) { - ServerboundPlayerCommandPacket.Action action = bl - ? ServerboundPlayerCommandPacket.Action.START_SPRINTING - : ServerboundPlayerCommandPacket.Action.STOP_SPRINTING; + Action action = bl ? Action.START_SPRINTING : Action.STOP_SPRINTING; this.connection.send(new ServerboundPlayerCommandPacket(this, action)); this.wasSprinting = bl; } } public boolean drop(boolean fullStack) { - ServerboundPlayerActionPacket.Action action = fullStack - ? ServerboundPlayerActionPacket.Action.DROP_ALL_ITEMS - : ServerboundPlayerActionPacket.Action.DROP_ITEM; + net.minecraft.network.protocol.game.ServerboundPlayerActionPacket.Action action = fullStack + ? net.minecraft.network.protocol.game.ServerboundPlayerActionPacket.Action.DROP_ALL_ITEMS + : net.minecraft.network.protocol.game.ServerboundPlayerActionPacket.Action.DROP_ITEM; ItemStack itemStack = this.getInventory().removeFromSelected(fullStack); this.connection.send(new ServerboundPlayerActionPacket(action, BlockPos.ZERO, Direction.DOWN)); return !itemStack.isEmpty(); @@ -333,17 +331,10 @@ public class LocalPlayer extends AbstractClientPlayer { @Override public void respawn() { - this.connection.send(new ServerboundClientCommandPacket(ServerboundClientCommandPacket.Action.PERFORM_RESPAWN)); + this.connection.send(new ServerboundClientCommandPacket(net.minecraft.network.protocol.game.ServerboundClientCommandPacket.Action.PERFORM_RESPAWN)); KeyMapping.resetToggleKeys(); } - @Override - protected void actuallyHurt(DamageSource damageSource, float damageAmount) { - if (!this.isInvulnerableTo(damageSource)) { - this.setHealth(this.getHealth() - damageAmount); - } - } - @Override public void closeContainer() { this.connection.send(new ServerboundContainerClosePacket(this.containerMenu.containerId)); @@ -400,12 +391,11 @@ public class LocalPlayer extends AbstractClientPlayer { } protected void sendRidingJump() { - this.connection - .send(new ServerboundPlayerCommandPacket(this, ServerboundPlayerCommandPacket.Action.START_RIDING_JUMP, Mth.floor(this.getJumpRidingScale() * 100.0F))); + this.connection.send(new ServerboundPlayerCommandPacket(this, Action.START_RIDING_JUMP, Mth.floor(this.getJumpRidingScale() * 100.0F))); } public void sendOpenInventory() { - this.connection.send(new ServerboundPlayerCommandPacket(this, ServerboundPlayerCommandPacket.Action.OPEN_INVENTORY)); + this.connection.send(new ServerboundPlayerCommandPacket(this, Action.OPEN_INVENTORY)); } public StatsCounter getStats() { @@ -416,10 +406,10 @@ public class LocalPlayer extends AbstractClientPlayer { return this.recipeBook; } - public void removeRecipeHighlight(RecipeHolder recipe) { - if (this.recipeBook.willHighlight(recipe)) { - this.recipeBook.removeHighlight(recipe); - this.connection.send(new ServerboundRecipeBookSeenRecipePacket(recipe)); + public void removeRecipeHighlight(RecipeDisplayId recipeDisplayId) { + if (this.recipeBook.willHighlight(recipeDisplayId)) { + this.recipeBook.removeHighlight(recipeDisplayId); + this.connection.send(new ServerboundRecipeBookSeenRecipePacket(recipeDisplayId)); } } @@ -481,11 +471,6 @@ public class LocalPlayer extends AbstractClientPlayer { this.experienceLevel = level; } - @Override - public void sendSystemMessage(Component component) { - this.minecraft.gui.getChat().addMessage(component); - } - @Override public void handleEntityEvent(byte id) { if (id >= 24 && id <= 28) { @@ -615,8 +600,9 @@ public class LocalPlayer extends AbstractClientPlayer { @Override public void openItemGui(ItemStack stack, InteractionHand hand) { - if (stack.is(Items.WRITABLE_BOOK)) { - this.minecraft.setScreen(new BookEditScreen(this, stack, hand)); + WritableBookContent writableBookContent = stack.get(DataComponents.WRITABLE_BOOK_CONTENT); + if (writableBookContent != null) { + this.minecraft.setScreen(new BookEditScreen(this, stack, hand, writableBookContent)); } } @@ -632,7 +618,7 @@ public class LocalPlayer extends AbstractClientPlayer { @Override public boolean isShiftKeyDown() { - return this.input != null && this.input.shiftKeyDown; + return this.input.keyPresses.shift(); } @Override @@ -650,7 +636,7 @@ public class LocalPlayer extends AbstractClientPlayer { if (this.isControlledCamera()) { this.xxa = this.input.leftImpulse; this.zza = this.input.forwardImpulse; - this.jumping = this.input.jumping; + this.jumping = this.input.keyPresses.jump(); this.yBobO = this.yBob; this.xBobO = this.xBob; this.xBob = this.xBob + (this.getXRot() - this.xBob) * 0.5F; @@ -665,7 +651,7 @@ public class LocalPlayer extends AbstractClientPlayer { public void resetPos() { this.setPose(Pose.STANDING); if (this.level() != null) { - for (double d = this.getY(); d > this.level().getMinBuildHeight() && d < this.level().getMaxBuildHeight(); d++) { + for (double d = this.getY(); d > this.level().getMinY() && d <= this.level().getMaxY(); d++) { this.setPos(this.getX(), d, this.getZ()); if (this.level().noCollision(this)) { break; @@ -691,8 +677,8 @@ public class LocalPlayer extends AbstractClientPlayer { this.processPortalCooldown(); } - boolean bl = this.input.jumping; - boolean bl2 = this.input.shiftKeyDown; + boolean bl = this.input.keyPresses.jump(); + boolean bl2 = this.input.keyPresses.shift(); boolean bl3 = this.hasEnoughImpulseToStartSprinting(); Abilities abilities = this.getAbilities(); this.crouching = !abilities.flying @@ -713,7 +699,7 @@ public class LocalPlayer extends AbstractClientPlayer { if (this.autoJumpTime > 0) { this.autoJumpTime--; bl4 = true; - this.input.jumping = true; + this.input.makeJump(); } if (!this.noPhysics) { @@ -746,7 +732,7 @@ public class LocalPlayer extends AbstractClientPlayer { boolean bl8 = !this.input.hasForwardImpulse() || !this.hasEnoughFoodToStartSprinting(); boolean bl9 = bl8 || this.horizontalCollision && !this.minorHorizontalCollision || this.isInWater() && !this.isUnderWater(); if (this.isSwimming()) { - if (!this.onGround() && !this.input.shiftKeyDown && bl8 || !this.isInWater()) { + if (!this.onGround() && !this.input.keyPresses.shift() && bl8 || !this.isInWater()) { this.setSprinting(false); } } else if (bl9) { @@ -762,7 +748,7 @@ public class LocalPlayer extends AbstractClientPlayer { bl8 = true; this.onUpdateAbilities(); } - } else if (!bl && this.input.jumping && !bl4) { + } else if (!bl && this.input.keyPresses.jump() && !bl4) { if (this.jumpTriggerTime == 0) { this.jumpTriggerTime = 7; } else if (!this.isSwimming()) { @@ -778,15 +764,12 @@ public class LocalPlayer extends AbstractClientPlayer { } } - if (this.input.jumping && !bl8 && !bl && !abilities.flying && !this.isPassenger() && !this.onClimbable()) { - ItemStack itemStack = this.getItemBySlot(EquipmentSlot.CHEST); - if (itemStack.is(Items.ELYTRA) && ElytraItem.isFlyEnabled(itemStack) && this.tryToStartFallFlying()) { - this.connection.send(new ServerboundPlayerCommandPacket(this, ServerboundPlayerCommandPacket.Action.START_FALL_FLYING)); - } + if (this.input.keyPresses.jump() && !bl8 && !bl && !this.onClimbable() && this.tryToStartFallFlying()) { + this.connection.send(new ServerboundPlayerCommandPacket(this, Action.START_FALL_FLYING)); } this.wasFallFlying = this.isFallFlying(); - if (this.isInWater() && this.input.shiftKeyDown && this.isAffectedByFluids()) { + if (this.isInWater() && this.input.keyPresses.shift() && this.isAffectedByFluids()) { this.goDownInWater(); } @@ -800,11 +783,11 @@ public class LocalPlayer extends AbstractClientPlayer { if (abilities.flying && this.isControlledCamera()) { int i = 0; - if (this.input.shiftKeyDown) { + if (this.input.keyPresses.shift()) { i--; } - if (this.input.jumping) { + if (this.input.keyPresses.jump()) { i++; } @@ -822,11 +805,11 @@ public class LocalPlayer extends AbstractClientPlayer { } } - if (bl && !this.input.jumping) { + if (bl && !this.input.keyPresses.jump()) { this.jumpRidingTicks = -10; playerRideableJumping.onPlayerJump(Mth.floor(this.getJumpRidingScale() * 100.0F)); this.sendRidingJump(); - } else if (!bl && this.input.jumping) { + } else if (!bl && this.input.keyPresses.jump()) { this.jumpRidingTicks = 0; this.jumpRidingScale = 0.0F; } else if (bl) { @@ -894,9 +877,10 @@ public class LocalPlayer extends AbstractClientPlayer { public void rideTick() { super.rideTick(); this.handsBusy = false; - if (this.getControlledVehicle() instanceof Boat boat) { - boat.setInput(this.input.left, this.input.right, this.input.up, this.input.down); - this.handsBusy = this.handsBusy | (this.input.left || this.input.right || this.input.up || this.input.down); + if (this.getControlledVehicle() instanceof AbstractBoat abstractBoat) { + abstractBoat.setInput(this.input.keyPresses.left(), this.input.keyPresses.right(), this.input.keyPresses.forward(), this.input.keyPresses.backward()); + this.handsBusy = this.handsBusy + | (this.input.keyPresses.left() || this.input.keyPresses.right() || this.input.keyPresses.forward() || this.input.keyPresses.backward()); } } @@ -920,13 +904,21 @@ public class LocalPlayer extends AbstractClientPlayer { double d = this.getX(); double e = this.getZ(); super.move(type, pos); - this.updateAutoJump((float)(this.getX() - d), (float)(this.getZ() - e)); + float f = (float)(this.getX() - d); + float g = (float)(this.getZ() - e); + this.updateAutoJump(f, g); + this.walkDist = this.walkDist + Mth.length(f, g) * 0.6F; } public boolean isAutoJumpEnabled() { return this.autoJumpEnabled; } + @Override + public boolean shouldRotateWithMinecart() { + return this.minecraft.options.rotateWithMinecart().get(); + } + protected void updateAutoJump(float movementX, float movementZ) { if (this.canAutoJump()) { Vec3 vec3 = this.position(); @@ -1116,7 +1108,7 @@ public class LocalPlayer extends AbstractClientPlayer { } else { if (!bl && bl2) { this.level().playLocalSound(this.getX(), this.getY(), this.getZ(), SoundEvents.AMBIENT_UNDERWATER_ENTER, SoundSource.AMBIENT, 1.0F, 1.0F, false); - this.minecraft.getSoundManager().play(new UnderwaterAmbientSoundInstances.UnderwaterAmbientSoundInstance(this)); + this.minecraft.getSoundManager().play(new UnderwaterAmbientSoundInstance(this)); } if (bl && !bl2) { @@ -1149,4 +1141,18 @@ public class LocalPlayer extends AbstractClientPlayer { public float getVisualRotationYInDegrees() { return this.getYRot(); } + + @Override + public void handleCreativeModeItemDrop(ItemStack itemStack) { + this.minecraft.gameMode.handleCreativeModeItemDrop(itemStack); + } + + @Override + public boolean canDropItems() { + return this.dropSpamThrottler.isUnderThreshold(); + } + + public TickThrottler getDropSpamThrottler() { + return this.dropSpamThrottler; + } } diff --git a/net/minecraft/client/player/RemotePlayer.java b/net/minecraft/client/player/RemotePlayer.java index 6465888d..bdda1ab9 100644 --- a/net/minecraft/client/player/RemotePlayer.java +++ b/net/minecraft/client/player/RemotePlayer.java @@ -3,10 +3,10 @@ package net.minecraft.client.player; import com.mojang.authlib.GameProfile; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; -import net.minecraft.client.Minecraft; import net.minecraft.client.multiplayer.ClientLevel; -import net.minecraft.network.chat.Component; import net.minecraft.network.protocol.game.ClientboundAddEntityPacket; +import net.minecraft.util.profiling.Profiler; +import net.minecraft.util.profiling.Zone; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.phys.Vec3; @@ -32,7 +32,7 @@ public class RemotePlayer extends AbstractClientPlayer { } @Override - public boolean hurt(DamageSource source, float amount) { + public boolean hurtClient(DamageSource damageSource) { return true; } @@ -75,9 +75,10 @@ public class RemotePlayer extends AbstractClientPlayer { } this.bob = this.bob + (f - this.bob) * 0.4F; - this.level().getProfiler().push("push"); - this.pushEntities(); - this.level().getProfiler().pop(); + + try (Zone zone = Profiler.get().zone("push")) { + this.pushEntities(); + } } @Override @@ -90,12 +91,6 @@ public class RemotePlayer extends AbstractClientPlayer { protected void updatePlayerPose() { } - @Override - public void sendSystemMessage(Component component) { - Minecraft minecraft = Minecraft.getInstance(); - minecraft.gui.getChat().addMessage(component); - } - @Override public void recreateFromPacket(ClientboundAddEntityPacket packet) { super.recreateFromPacket(packet); diff --git a/net/minecraft/client/renderer/BlockEntityWithoutLevelRenderer.java b/net/minecraft/client/renderer/BlockEntityWithoutLevelRenderer.java index fcb4033c..c03cf908 100644 --- a/net/minecraft/client/renderer/BlockEntityWithoutLevelRenderer.java +++ b/net/minecraft/client/renderer/BlockEntityWithoutLevelRenderer.java @@ -141,7 +141,7 @@ public class BlockEntityWithoutLevelRenderer implements ResourceManagerReloadLis poseStack.scale(1.0F, -1.0F, -1.0F); Material material = bl ? ModelBakery.SHIELD_BASE : ModelBakery.NO_PATTERN_SHIELD; VertexConsumer vertexConsumer = material.sprite() - .wrap(ItemRenderer.getFoilBufferDirect(buffer, this.shieldModel.renderType(material.atlasLocation()), true, stack.hasFoil())); + .wrap(ItemRenderer.getFoilBuffer(buffer, this.shieldModel.renderType(material.atlasLocation()), displayContext == ItemDisplayContext.GUI, stack.hasFoil())); this.shieldModel.handle().render(poseStack, vertexConsumer, packedLight, packedOverlay); if (bl) { BannerRenderer.renderPatterns( @@ -154,7 +154,8 @@ public class BlockEntityWithoutLevelRenderer implements ResourceManagerReloadLis false, (DyeColor)Objects.requireNonNullElse(dyeColor2, DyeColor.WHITE), bannerPatternLayers, - stack.hasFoil() + stack.hasFoil(), + false ); } else { this.shieldModel.plate().render(poseStack, vertexConsumer, packedLight, packedOverlay); @@ -164,7 +165,7 @@ public class BlockEntityWithoutLevelRenderer implements ResourceManagerReloadLis } else if (stack.is(Items.TRIDENT)) { poseStack.pushPose(); poseStack.scale(1.0F, -1.0F, -1.0F); - VertexConsumer vertexConsumer2 = ItemRenderer.getFoilBufferDirect(buffer, this.tridentModel.renderType(TridentModel.TEXTURE), false, stack.hasFoil()); + VertexConsumer vertexConsumer2 = ItemRenderer.getFoilBuffer(buffer, this.tridentModel.renderType(TridentModel.TEXTURE), false, stack.hasFoil()); this.tridentModel.renderToBuffer(poseStack, vertexConsumer2, packedLight, packedOverlay); poseStack.popPose(); } diff --git a/net/minecraft/client/renderer/CloudRenderer.java b/net/minecraft/client/renderer/CloudRenderer.java new file mode 100644 index 00000000..50f12faf --- /dev/null +++ b/net/minecraft/client/renderer/CloudRenderer.java @@ -0,0 +1,346 @@ +package net.minecraft.client.renderer; + +import com.mojang.blaze3d.buffers.BufferUsage; +import com.mojang.blaze3d.platform.NativeImage; +import com.mojang.blaze3d.systems.RenderSystem; +import com.mojang.blaze3d.vertex.BufferBuilder; +import com.mojang.blaze3d.vertex.MeshData; +import com.mojang.blaze3d.vertex.Tesselator; +import com.mojang.blaze3d.vertex.VertexBuffer; +import com.mojang.logging.LogUtils; +import java.io.IOException; +import java.io.InputStream; +import java.util.Optional; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.client.CloudStatus; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.packs.resources.ResourceManager; +import net.minecraft.server.packs.resources.SimplePreparableReloadListener; +import net.minecraft.util.ARGB; +import net.minecraft.util.Mth; +import net.minecraft.util.profiling.ProfilerFiller; +import net.minecraft.world.phys.Vec3; +import org.jetbrains.annotations.Nullable; +import org.joml.Matrix4f; +import org.slf4j.Logger; + +@Environment(EnvType.CLIENT) +public class CloudRenderer extends SimplePreparableReloadListener> implements AutoCloseable { + private static final Logger LOGGER = LogUtils.getLogger(); + private static final ResourceLocation TEXTURE_LOCATION = ResourceLocation.withDefaultNamespace("textures/environment/clouds.png"); + private static final float CELL_SIZE_IN_BLOCKS = 12.0F; + private static final float HEIGHT_IN_BLOCKS = 4.0F; + private static final float BLOCKS_PER_SECOND = 0.6F; + private static final long EMPTY_CELL = 0L; + private static final int COLOR_OFFSET = 4; + private static final int NORTH_OFFSET = 3; + private static final int EAST_OFFSET = 2; + private static final int SOUTH_OFFSET = 1; + private static final int WEST_OFFSET = 0; + private boolean needsRebuild = true; + private int prevCellX = Integer.MIN_VALUE; + private int prevCellZ = Integer.MIN_VALUE; + private CloudRenderer.RelativeCameraPos prevRelativeCameraPos = CloudRenderer.RelativeCameraPos.INSIDE_CLOUDS; + @Nullable + private CloudStatus prevType; + @Nullable + private CloudRenderer.TextureData texture; + private final VertexBuffer vertexBuffer = new VertexBuffer(BufferUsage.STATIC_WRITE); + private boolean vertexBufferEmpty; + + protected Optional prepare(ResourceManager resourceManager, ProfilerFiller profilerFiller) { + try { + InputStream inputStream = resourceManager.open(TEXTURE_LOCATION); + + Optional var20; + try (NativeImage nativeImage = NativeImage.read(inputStream)) { + int i = nativeImage.getWidth(); + int j = nativeImage.getHeight(); + long[] ls = new long[i * j]; + + for (int k = 0; k < j; k++) { + for (int l = 0; l < i; l++) { + int m = nativeImage.getPixel(l, k); + if (isCellEmpty(m)) { + ls[l + k * i] = 0L; + } else { + boolean bl = isCellEmpty(nativeImage.getPixel(l, Math.floorMod(k - 1, j))); + boolean bl2 = isCellEmpty(nativeImage.getPixel(Math.floorMod(l + 1, j), k)); + boolean bl3 = isCellEmpty(nativeImage.getPixel(l, Math.floorMod(k + 1, j))); + boolean bl4 = isCellEmpty(nativeImage.getPixel(Math.floorMod(l - 1, j), k)); + ls[l + k * i] = packCellData(m, bl, bl2, bl3, bl4); + } + } + } + + var20 = Optional.of(new CloudRenderer.TextureData(ls, i, j)); + } catch (Throwable var18) { + if (inputStream != null) { + try { + inputStream.close(); + } catch (Throwable var15) { + var18.addSuppressed(var15); + } + } + + throw var18; + } + + if (inputStream != null) { + inputStream.close(); + } + + return var20; + } catch (IOException var19) { + LOGGER.error("Failed to load cloud texture", (Throwable)var19); + return Optional.empty(); + } + } + + protected void apply(Optional optional, ResourceManager resourceManager, ProfilerFiller profilerFiller) { + this.texture = (CloudRenderer.TextureData)optional.orElse(null); + this.needsRebuild = true; + } + + private static boolean isCellEmpty(int i) { + return ARGB.alpha(i) < 10; + } + + private static long packCellData(int i, boolean bl, boolean bl2, boolean bl3, boolean bl4) { + return (long)i << 4 | (bl ? 1 : 0) << 3 | (bl2 ? 1 : 0) << 2 | (bl3 ? 1 : 0) << 1 | (bl4 ? 1 : 0) << 0; + } + + private static int getColor(long l) { + return (int)(l >> 4 & 4294967295L); + } + + private static boolean isNorthEmpty(long l) { + return (l >> 3 & 1L) != 0L; + } + + private static boolean isEastEmpty(long l) { + return (l >> 2 & 1L) != 0L; + } + + private static boolean isSouthEmpty(long l) { + return (l >> 1 & 1L) != 0L; + } + + private static boolean isWestEmpty(long l) { + return (l >> 0 & 1L) != 0L; + } + + public void render(int i, CloudStatus cloudStatus, float f, Matrix4f matrix4f, Matrix4f matrix4f2, Vec3 vec3, float g) { + if (this.texture != null) { + float h = (float)(f - vec3.y); + float j = h + 4.0F; + CloudRenderer.RelativeCameraPos relativeCameraPos; + if (j < 0.0F) { + relativeCameraPos = CloudRenderer.RelativeCameraPos.ABOVE_CLOUDS; + } else if (h > 0.0F) { + relativeCameraPos = CloudRenderer.RelativeCameraPos.BELOW_CLOUDS; + } else { + relativeCameraPos = CloudRenderer.RelativeCameraPos.INSIDE_CLOUDS; + } + + double d = vec3.x + g * 0.030000001F; + double e = vec3.z + 3.96F; + double k = this.texture.width * 12.0; + double l = this.texture.height * 12.0; + d -= Mth.floor(d / k) * k; + e -= Mth.floor(e / l) * l; + int m = Mth.floor(d / 12.0); + int n = Mth.floor(e / 12.0); + float o = (float)(d - m * 12.0F); + float p = (float)(e - n * 12.0F); + RenderType renderType = cloudStatus == CloudStatus.FANCY ? RenderType.clouds() : RenderType.flatClouds(); + this.vertexBuffer.bind(); + if (this.needsRebuild || m != this.prevCellX || n != this.prevCellZ || relativeCameraPos != this.prevRelativeCameraPos || cloudStatus != this.prevType) { + this.needsRebuild = false; + this.prevCellX = m; + this.prevCellZ = n; + this.prevRelativeCameraPos = relativeCameraPos; + this.prevType = cloudStatus; + MeshData meshData = this.buildMesh(Tesselator.getInstance(), m, n, cloudStatus, relativeCameraPos, renderType); + if (meshData != null) { + this.vertexBuffer.upload(meshData); + this.vertexBufferEmpty = false; + } else { + this.vertexBufferEmpty = true; + } + } + + if (!this.vertexBufferEmpty) { + RenderSystem.setShaderColor(ARGB.from8BitChannel(ARGB.red(i)), ARGB.from8BitChannel(ARGB.green(i)), ARGB.from8BitChannel(ARGB.blue(i)), 1.0F); + if (cloudStatus == CloudStatus.FANCY) { + this.drawWithRenderType(RenderType.cloudsDepthOnly(), matrix4f, matrix4f2, o, h, p); + } + + this.drawWithRenderType(renderType, matrix4f, matrix4f2, o, h, p); + VertexBuffer.unbind(); + RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); + } + } + } + + private void drawWithRenderType(RenderType renderType, Matrix4f matrix4f, Matrix4f matrix4f2, float f, float g, float h) { + renderType.setupRenderState(); + CompiledShaderProgram compiledShaderProgram = RenderSystem.getShader(); + if (compiledShaderProgram != null && compiledShaderProgram.MODEL_OFFSET != null) { + compiledShaderProgram.MODEL_OFFSET.set(-f, g, -h); + } + + this.vertexBuffer.drawWithShader(matrix4f, matrix4f2, compiledShaderProgram); + renderType.clearRenderState(); + } + + @Nullable + private MeshData buildMesh( + Tesselator tesselator, int i, int j, CloudStatus cloudStatus, CloudRenderer.RelativeCameraPos relativeCameraPos, RenderType renderType + ) { + float f = 0.8F; + int k = ARGB.colorFromFloat(0.8F, 1.0F, 1.0F, 1.0F); + int l = ARGB.colorFromFloat(0.8F, 0.9F, 0.9F, 0.9F); + int m = ARGB.colorFromFloat(0.8F, 0.7F, 0.7F, 0.7F); + int n = ARGB.colorFromFloat(0.8F, 0.8F, 0.8F, 0.8F); + BufferBuilder bufferBuilder = tesselator.begin(renderType.mode(), renderType.format()); + this.buildMesh(relativeCameraPos, bufferBuilder, i, j, m, k, l, n, cloudStatus == CloudStatus.FANCY); + return bufferBuilder.build(); + } + + private void buildMesh(CloudRenderer.RelativeCameraPos relativeCameraPos, BufferBuilder bufferBuilder, int i, int j, int k, int l, int m, int n, boolean bl) { + if (this.texture != null) { + int o = 32; + long[] ls = this.texture.cells; + int p = this.texture.width; + int q = this.texture.height; + + for (int r = -32; r <= 32; r++) { + for (int s = -32; s <= 32; s++) { + int t = Math.floorMod(i + s, p); + int u = Math.floorMod(j + r, q); + long v = ls[t + u * p]; + if (v != 0L) { + int w = getColor(v); + if (bl) { + this.buildExtrudedCell(relativeCameraPos, bufferBuilder, ARGB.multiply(k, w), ARGB.multiply(l, w), ARGB.multiply(m, w), ARGB.multiply(n, w), s, r, v); + } else { + this.buildFlatCell(bufferBuilder, ARGB.multiply(l, w), s, r); + } + } + } + } + } + } + + private void buildFlatCell(BufferBuilder bufferBuilder, int i, int j, int k) { + float f = j * 12.0F; + float g = f + 12.0F; + float h = k * 12.0F; + float l = h + 12.0F; + bufferBuilder.addVertex(f, 0.0F, h).setColor(i); + bufferBuilder.addVertex(f, 0.0F, l).setColor(i); + bufferBuilder.addVertex(g, 0.0F, l).setColor(i); + bufferBuilder.addVertex(g, 0.0F, h).setColor(i); + } + + private void buildExtrudedCell( + CloudRenderer.RelativeCameraPos relativeCameraPos, BufferBuilder bufferBuilder, int i, int j, int k, int l, int m, int n, long o + ) { + float f = m * 12.0F; + float g = f + 12.0F; + float h = 0.0F; + float p = 4.0F; + float q = n * 12.0F; + float r = q + 12.0F; + if (relativeCameraPos != CloudRenderer.RelativeCameraPos.BELOW_CLOUDS) { + bufferBuilder.addVertex(f, 4.0F, q).setColor(j); + bufferBuilder.addVertex(f, 4.0F, r).setColor(j); + bufferBuilder.addVertex(g, 4.0F, r).setColor(j); + bufferBuilder.addVertex(g, 4.0F, q).setColor(j); + } + + if (relativeCameraPos != CloudRenderer.RelativeCameraPos.ABOVE_CLOUDS) { + bufferBuilder.addVertex(g, 0.0F, q).setColor(i); + bufferBuilder.addVertex(g, 0.0F, r).setColor(i); + bufferBuilder.addVertex(f, 0.0F, r).setColor(i); + bufferBuilder.addVertex(f, 0.0F, q).setColor(i); + } + + if (isNorthEmpty(o) && n > 0) { + bufferBuilder.addVertex(f, 0.0F, q).setColor(l); + bufferBuilder.addVertex(f, 4.0F, q).setColor(l); + bufferBuilder.addVertex(g, 4.0F, q).setColor(l); + bufferBuilder.addVertex(g, 0.0F, q).setColor(l); + } + + if (isSouthEmpty(o) && n < 0) { + bufferBuilder.addVertex(g, 0.0F, r).setColor(l); + bufferBuilder.addVertex(g, 4.0F, r).setColor(l); + bufferBuilder.addVertex(f, 4.0F, r).setColor(l); + bufferBuilder.addVertex(f, 0.0F, r).setColor(l); + } + + if (isWestEmpty(o) && m > 0) { + bufferBuilder.addVertex(f, 0.0F, r).setColor(k); + bufferBuilder.addVertex(f, 4.0F, r).setColor(k); + bufferBuilder.addVertex(f, 4.0F, q).setColor(k); + bufferBuilder.addVertex(f, 0.0F, q).setColor(k); + } + + if (isEastEmpty(o) && m < 0) { + bufferBuilder.addVertex(g, 0.0F, q).setColor(k); + bufferBuilder.addVertex(g, 4.0F, q).setColor(k); + bufferBuilder.addVertex(g, 4.0F, r).setColor(k); + bufferBuilder.addVertex(g, 0.0F, r).setColor(k); + } + + boolean bl = Math.abs(m) <= 1 && Math.abs(n) <= 1; + if (bl) { + bufferBuilder.addVertex(g, 4.0F, q).setColor(j); + bufferBuilder.addVertex(g, 4.0F, r).setColor(j); + bufferBuilder.addVertex(f, 4.0F, r).setColor(j); + bufferBuilder.addVertex(f, 4.0F, q).setColor(j); + bufferBuilder.addVertex(f, 0.0F, q).setColor(i); + bufferBuilder.addVertex(f, 0.0F, r).setColor(i); + bufferBuilder.addVertex(g, 0.0F, r).setColor(i); + bufferBuilder.addVertex(g, 0.0F, q).setColor(i); + bufferBuilder.addVertex(g, 0.0F, q).setColor(l); + bufferBuilder.addVertex(g, 4.0F, q).setColor(l); + bufferBuilder.addVertex(f, 4.0F, q).setColor(l); + bufferBuilder.addVertex(f, 0.0F, q).setColor(l); + bufferBuilder.addVertex(f, 0.0F, r).setColor(l); + bufferBuilder.addVertex(f, 4.0F, r).setColor(l); + bufferBuilder.addVertex(g, 4.0F, r).setColor(l); + bufferBuilder.addVertex(g, 0.0F, r).setColor(l); + bufferBuilder.addVertex(f, 0.0F, q).setColor(k); + bufferBuilder.addVertex(f, 4.0F, q).setColor(k); + bufferBuilder.addVertex(f, 4.0F, r).setColor(k); + bufferBuilder.addVertex(f, 0.0F, r).setColor(k); + bufferBuilder.addVertex(g, 0.0F, r).setColor(k); + bufferBuilder.addVertex(g, 4.0F, r).setColor(k); + bufferBuilder.addVertex(g, 4.0F, q).setColor(k); + bufferBuilder.addVertex(g, 0.0F, q).setColor(k); + } + } + + public void markForRebuild() { + this.needsRebuild = true; + } + + public void close() { + this.vertexBuffer.close(); + } + + @Environment(EnvType.CLIENT) + static enum RelativeCameraPos { + ABOVE_CLOUDS, + INSIDE_CLOUDS, + BELOW_CLOUDS; + } + + @Environment(EnvType.CLIENT) + public record TextureData(long[] cells, int width, int height) { + } +} diff --git a/net/minecraft/client/renderer/CompiledShaderProgram.java b/net/minecraft/client/renderer/CompiledShaderProgram.java new file mode 100644 index 00000000..9a858526 --- /dev/null +++ b/net/minecraft/client/renderer/CompiledShaderProgram.java @@ -0,0 +1,273 @@ +package net.minecraft.client.renderer; + +import com.mojang.blaze3d.platform.GlStateManager; +import com.mojang.blaze3d.platform.Window; +import com.mojang.blaze3d.shaders.AbstractUniform; +import com.mojang.blaze3d.shaders.CompiledShader; +import com.mojang.blaze3d.shaders.Uniform; +import com.mojang.blaze3d.systems.RenderSystem; +import com.mojang.blaze3d.vertex.VertexFormat; +import it.unimi.dsi.fastutil.ints.IntArrayList; +import it.unimi.dsi.fastutil.ints.IntList; +import it.unimi.dsi.fastutil.objects.Object2IntArrayMap; +import it.unimi.dsi.fastutil.objects.Object2IntMap; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import org.jetbrains.annotations.Nullable; +import org.jetbrains.annotations.VisibleForTesting; +import org.joml.Matrix4f; + +@Environment(EnvType.CLIENT) +public class CompiledShaderProgram implements AutoCloseable { + private static final AbstractUniform DUMMY_UNIFORM = new AbstractUniform(); + private static final int NO_SAMPLER_TEXTURE = -1; + private final List samplers = new ArrayList(); + private final Object2IntMap samplerTextures = new Object2IntArrayMap<>(); + private final IntList samplerLocations = new IntArrayList(); + private final List uniforms = new ArrayList(); + private final Map uniformsByName = new HashMap(); + private final Map uniformConfigs = new HashMap(); + private final int programId; + @Nullable + public Uniform MODEL_VIEW_MATRIX; + @Nullable + public Uniform PROJECTION_MATRIX; + @Nullable + public Uniform TEXTURE_MATRIX; + @Nullable + public Uniform SCREEN_SIZE; + @Nullable + public Uniform COLOR_MODULATOR; + @Nullable + public Uniform LIGHT0_DIRECTION; + @Nullable + public Uniform LIGHT1_DIRECTION; + @Nullable + public Uniform GLINT_ALPHA; + @Nullable + public Uniform FOG_START; + @Nullable + public Uniform FOG_END; + @Nullable + public Uniform FOG_COLOR; + @Nullable + public Uniform FOG_SHAPE; + @Nullable + public Uniform LINE_WIDTH; + @Nullable + public Uniform GAME_TIME; + @Nullable + public Uniform MODEL_OFFSET; + + private CompiledShaderProgram(int i) { + this.programId = i; + this.samplerTextures.defaultReturnValue(-1); + } + + public static CompiledShaderProgram link(CompiledShader compiledShader, CompiledShader compiledShader2, VertexFormat vertexFormat) throws ShaderManager.CompilationException { + int i = GlStateManager.glCreateProgram(); + if (i <= 0) { + throw new ShaderManager.CompilationException("Could not create shader program (returned program ID " + i + ")"); + } else { + vertexFormat.bindAttributes(i); + GlStateManager.glAttachShader(i, compiledShader.getShaderId()); + GlStateManager.glAttachShader(i, compiledShader2.getShaderId()); + GlStateManager.glLinkProgram(i); + int j = GlStateManager.glGetProgrami(i, 35714); + if (j == 0) { + String string = GlStateManager.glGetProgramInfoLog(i, 32768); + throw new ShaderManager.CompilationException( + "Error encountered when linking program containing VS " + compiledShader.getId() + " and FS " + compiledShader2.getId() + ". Log output: " + string + ); + } else { + return new CompiledShaderProgram(i); + } + } + } + + public void setupUniforms(List list, List list2) { + RenderSystem.assertOnRenderThread(); + + for (ShaderProgramConfig.Uniform uniform : list) { + String string = uniform.name(); + int i = Uniform.glGetUniformLocation(this.programId, string); + if (i != -1) { + Uniform uniform2 = this.parseUniformNode(uniform); + uniform2.setLocation(i); + this.uniforms.add(uniform2); + this.uniformsByName.put(string, uniform2); + this.uniformConfigs.put(string, uniform); + } + } + + for (ShaderProgramConfig.Sampler sampler : list2) { + int j = Uniform.glGetUniformLocation(this.programId, sampler.name()); + if (j != -1) { + this.samplers.add(sampler); + this.samplerLocations.add(j); + } + } + + this.MODEL_VIEW_MATRIX = this.getUniform("ModelViewMat"); + this.PROJECTION_MATRIX = this.getUniform("ProjMat"); + this.TEXTURE_MATRIX = this.getUniform("TextureMat"); + this.SCREEN_SIZE = this.getUniform("ScreenSize"); + this.COLOR_MODULATOR = this.getUniform("ColorModulator"); + this.LIGHT0_DIRECTION = this.getUniform("Light0_Direction"); + this.LIGHT1_DIRECTION = this.getUniform("Light1_Direction"); + this.GLINT_ALPHA = this.getUniform("GlintAlpha"); + this.FOG_START = this.getUniform("FogStart"); + this.FOG_END = this.getUniform("FogEnd"); + this.FOG_COLOR = this.getUniform("FogColor"); + this.FOG_SHAPE = this.getUniform("FogShape"); + this.LINE_WIDTH = this.getUniform("LineWidth"); + this.GAME_TIME = this.getUniform("GameTime"); + this.MODEL_OFFSET = this.getUniform("ModelOffset"); + } + + public void close() { + this.uniforms.forEach(Uniform::close); + GlStateManager.glDeleteProgram(this.programId); + } + + public void clear() { + RenderSystem.assertOnRenderThread(); + GlStateManager._glUseProgram(0); + int i = GlStateManager._getActiveTexture(); + + for (int j = 0; j < this.samplerLocations.size(); j++) { + ShaderProgramConfig.Sampler sampler = (ShaderProgramConfig.Sampler)this.samplers.get(j); + if (!this.samplerTextures.containsKey(sampler.name())) { + GlStateManager._activeTexture(33984 + j); + GlStateManager._bindTexture(0); + } + } + + GlStateManager._activeTexture(i); + } + + public void apply() { + RenderSystem.assertOnRenderThread(); + GlStateManager._glUseProgram(this.programId); + int i = GlStateManager._getActiveTexture(); + + for (int j = 0; j < this.samplerLocations.size(); j++) { + String string = ((ShaderProgramConfig.Sampler)this.samplers.get(j)).name(); + int k = this.samplerTextures.getInt(string); + if (k != -1) { + int l = this.samplerLocations.getInt(j); + Uniform.uploadInteger(l, j); + RenderSystem.activeTexture(33984 + j); + RenderSystem.bindTexture(k); + } + } + + GlStateManager._activeTexture(i); + + for (Uniform uniform : this.uniforms) { + uniform.upload(); + } + } + + @Nullable + public Uniform getUniform(String string) { + RenderSystem.assertOnRenderThread(); + return (Uniform)this.uniformsByName.get(string); + } + + @Nullable + public ShaderProgramConfig.Uniform getUniformConfig(String string) { + return (ShaderProgramConfig.Uniform)this.uniformConfigs.get(string); + } + + public AbstractUniform safeGetUniform(String string) { + Uniform uniform = this.getUniform(string); + return (AbstractUniform)(uniform == null ? DUMMY_UNIFORM : uniform); + } + + public void bindSampler(String string, int i) { + this.samplerTextures.put(string, i); + } + + private Uniform parseUniformNode(ShaderProgramConfig.Uniform uniform) { + int i = Uniform.getTypeFromString(uniform.type()); + int j = uniform.count(); + int k = j > 1 && j <= 4 && i < 8 ? j - 1 : 0; + Uniform uniform2 = new Uniform(uniform.name(), i + k, j); + uniform2.setFromConfig(uniform); + return uniform2; + } + + public void setDefaultUniforms(VertexFormat.Mode mode, Matrix4f matrix4f, Matrix4f matrix4f2, Window window) { + for (int i = 0; i < 12; i++) { + int j = RenderSystem.getShaderTexture(i); + this.bindSampler("Sampler" + i, j); + } + + if (this.MODEL_VIEW_MATRIX != null) { + this.MODEL_VIEW_MATRIX.set(matrix4f); + } + + if (this.PROJECTION_MATRIX != null) { + this.PROJECTION_MATRIX.set(matrix4f2); + } + + if (this.COLOR_MODULATOR != null) { + this.COLOR_MODULATOR.set(RenderSystem.getShaderColor()); + } + + if (this.GLINT_ALPHA != null) { + this.GLINT_ALPHA.set(RenderSystem.getShaderGlintAlpha()); + } + + FogParameters fogParameters = RenderSystem.getShaderFog(); + if (this.FOG_START != null) { + this.FOG_START.set(fogParameters.start()); + } + + if (this.FOG_END != null) { + this.FOG_END.set(fogParameters.end()); + } + + if (this.FOG_COLOR != null) { + this.FOG_COLOR.set(fogParameters.red(), fogParameters.green(), fogParameters.blue(), fogParameters.alpha()); + } + + if (this.FOG_SHAPE != null) { + this.FOG_SHAPE.set(fogParameters.shape().getIndex()); + } + + if (this.TEXTURE_MATRIX != null) { + this.TEXTURE_MATRIX.set(RenderSystem.getTextureMatrix()); + } + + if (this.GAME_TIME != null) { + this.GAME_TIME.set(RenderSystem.getShaderGameTime()); + } + + if (this.SCREEN_SIZE != null) { + this.SCREEN_SIZE.set((float)window.getWidth(), (float)window.getHeight()); + } + + if (this.LINE_WIDTH != null && (mode == VertexFormat.Mode.LINES || mode == VertexFormat.Mode.LINE_STRIP)) { + this.LINE_WIDTH.set(RenderSystem.getShaderLineWidth()); + } + + RenderSystem.setupShaderLights(this); + } + + @VisibleForTesting + public void registerUniform(Uniform uniform) { + this.uniforms.add(uniform); + this.uniformsByName.put(uniform.getName(), uniform); + } + + @VisibleForTesting + public int getProgramId() { + return this.programId; + } +} diff --git a/net/minecraft/client/renderer/CoreShaders.java b/net/minecraft/client/renderer/CoreShaders.java new file mode 100644 index 00000000..fc6ee44c --- /dev/null +++ b/net/minecraft/client/renderer/CoreShaders.java @@ -0,0 +1,90 @@ +package net.minecraft.client.renderer; + +import com.mojang.blaze3d.vertex.DefaultVertexFormat; +import com.mojang.blaze3d.vertex.VertexFormat; +import java.util.ArrayList; +import java.util.List; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.resources.ResourceLocation; + +@Environment(EnvType.CLIENT) +public class CoreShaders { + private static final List PROGRAMS = new ArrayList(); + public static final ShaderProgram BLIT_SCREEN = register("blit_screen", DefaultVertexFormat.BLIT_SCREEN); + public static final ShaderProgram LIGHTMAP = register("lightmap", DefaultVertexFormat.BLIT_SCREEN); + public static final ShaderProgram PARTICLE = register("particle", DefaultVertexFormat.PARTICLE); + public static final ShaderProgram POSITION = register("position", DefaultVertexFormat.POSITION); + public static final ShaderProgram POSITION_COLOR = register("position_color", DefaultVertexFormat.POSITION_COLOR); + public static final ShaderProgram POSITION_COLOR_LIGHTMAP = register("position_color_lightmap", DefaultVertexFormat.POSITION_COLOR_LIGHTMAP); + public static final ShaderProgram POSITION_COLOR_TEX_LIGHTMAP = register("position_color_tex_lightmap", DefaultVertexFormat.POSITION_COLOR_TEX_LIGHTMAP); + public static final ShaderProgram POSITION_TEX = register("position_tex", DefaultVertexFormat.POSITION_TEX); + public static final ShaderProgram POSITION_TEX_COLOR = register("position_tex_color", DefaultVertexFormat.POSITION_TEX_COLOR); + public static final ShaderProgram RENDERTYPE_SOLID = register("rendertype_solid", DefaultVertexFormat.BLOCK); + public static final ShaderProgram RENDERTYPE_CUTOUT_MIPPED = register("rendertype_cutout_mipped", DefaultVertexFormat.BLOCK); + public static final ShaderProgram RENDERTYPE_CUTOUT = register("rendertype_cutout", DefaultVertexFormat.BLOCK); + public static final ShaderProgram RENDERTYPE_TRANSLUCENT = register("rendertype_translucent", DefaultVertexFormat.BLOCK); + public static final ShaderProgram RENDERTYPE_TRANSLUCENT_MOVING_BLOCK = register("rendertype_translucent_moving_block", DefaultVertexFormat.BLOCK); + public static final ShaderProgram RENDERTYPE_ARMOR_CUTOUT_NO_CULL = register("rendertype_armor_cutout_no_cull", DefaultVertexFormat.NEW_ENTITY); + public static final ShaderProgram RENDERTYPE_ARMOR_TRANSLUCENT = register("rendertype_armor_translucent", DefaultVertexFormat.NEW_ENTITY); + public static final ShaderProgram RENDERTYPE_ENTITY_SOLID = register("rendertype_entity_solid", DefaultVertexFormat.NEW_ENTITY); + public static final ShaderProgram RENDERTYPE_ENTITY_CUTOUT = register("rendertype_entity_cutout", DefaultVertexFormat.NEW_ENTITY); + public static final ShaderProgram RENDERTYPE_ENTITY_CUTOUT_NO_CULL = register("rendertype_entity_cutout_no_cull", DefaultVertexFormat.NEW_ENTITY); + public static final ShaderProgram RENDERTYPE_ENTITY_CUTOUT_NO_CULL_Z_OFFSET = register( + "rendertype_entity_cutout_no_cull_z_offset", DefaultVertexFormat.NEW_ENTITY + ); + public static final ShaderProgram RENDERTYPE_ITEM_ENTITY_TRANSLUCENT_CULL = register("rendertype_item_entity_translucent_cull", DefaultVertexFormat.NEW_ENTITY); + public static final ShaderProgram RENDERTYPE_ENTITY_TRANSLUCENT = register("rendertype_entity_translucent", DefaultVertexFormat.NEW_ENTITY); + public static final ShaderProgram RENDERTYPE_ENTITY_TRANSLUCENT_EMISSIVE = register("rendertype_entity_translucent_emissive", DefaultVertexFormat.NEW_ENTITY); + public static final ShaderProgram RENDERTYPE_ENTITY_SMOOTH_CUTOUT = register("rendertype_entity_smooth_cutout", DefaultVertexFormat.NEW_ENTITY); + public static final ShaderProgram RENDERTYPE_BEACON_BEAM = register("rendertype_beacon_beam", DefaultVertexFormat.BLOCK); + public static final ShaderProgram RENDERTYPE_ENTITY_DECAL = register("rendertype_entity_decal", DefaultVertexFormat.NEW_ENTITY); + public static final ShaderProgram RENDERTYPE_ENTITY_NO_OUTLINE = register("rendertype_entity_no_outline", DefaultVertexFormat.NEW_ENTITY); + public static final ShaderProgram RENDERTYPE_ENTITY_SHADOW = register("rendertype_entity_shadow", DefaultVertexFormat.NEW_ENTITY); + public static final ShaderProgram RENDERTYPE_ENTITY_ALPHA = register("rendertype_entity_alpha", DefaultVertexFormat.NEW_ENTITY); + public static final ShaderProgram RENDERTYPE_EYES = register("rendertype_eyes", DefaultVertexFormat.NEW_ENTITY); + public static final ShaderProgram RENDERTYPE_ENERGY_SWIRL = register("rendertype_energy_swirl", DefaultVertexFormat.NEW_ENTITY); + public static final ShaderProgram RENDERTYPE_LEASH = register("rendertype_leash", DefaultVertexFormat.POSITION_COLOR_LIGHTMAP); + public static final ShaderProgram RENDERTYPE_WATER_MASK = register("rendertype_water_mask", DefaultVertexFormat.POSITION); + public static final ShaderProgram RENDERTYPE_OUTLINE = register("rendertype_outline", DefaultVertexFormat.POSITION_TEX_COLOR); + public static final ShaderProgram RENDERTYPE_ARMOR_ENTITY_GLINT = register("rendertype_armor_entity_glint", DefaultVertexFormat.POSITION_TEX); + public static final ShaderProgram RENDERTYPE_GLINT_TRANSLUCENT = register("rendertype_glint_translucent", DefaultVertexFormat.POSITION_TEX); + public static final ShaderProgram RENDERTYPE_GLINT = register("rendertype_glint", DefaultVertexFormat.POSITION_TEX); + public static final ShaderProgram RENDERTYPE_ENTITY_GLINT = register("rendertype_entity_glint", DefaultVertexFormat.POSITION_TEX); + public static final ShaderProgram RENDERTYPE_TEXT = register("rendertype_text", DefaultVertexFormat.POSITION_COLOR_TEX_LIGHTMAP); + public static final ShaderProgram RENDERTYPE_TEXT_BACKGROUND = register("rendertype_text_background", DefaultVertexFormat.POSITION_COLOR_LIGHTMAP); + public static final ShaderProgram RENDERTYPE_TEXT_INTENSITY = register("rendertype_text_intensity", DefaultVertexFormat.POSITION_COLOR_TEX_LIGHTMAP); + public static final ShaderProgram RENDERTYPE_TEXT_SEE_THROUGH = register("rendertype_text_see_through", DefaultVertexFormat.POSITION_COLOR_TEX_LIGHTMAP); + public static final ShaderProgram RENDERTYPE_TEXT_BACKGROUND_SEE_THROUGH = register( + "rendertype_text_background_see_through", DefaultVertexFormat.POSITION_COLOR_LIGHTMAP + ); + public static final ShaderProgram RENDERTYPE_TEXT_INTENSITY_SEE_THROUGH = register( + "rendertype_text_intensity_see_through", DefaultVertexFormat.POSITION_COLOR_TEX_LIGHTMAP + ); + public static final ShaderProgram RENDERTYPE_LIGHTNING = register("rendertype_lightning", DefaultVertexFormat.POSITION_COLOR); + public static final ShaderProgram RENDERTYPE_TRIPWIRE = register("rendertype_tripwire", DefaultVertexFormat.BLOCK); + public static final ShaderProgram RENDERTYPE_END_PORTAL = register("rendertype_end_portal", DefaultVertexFormat.POSITION); + public static final ShaderProgram RENDERTYPE_END_GATEWAY = register("rendertype_end_gateway", DefaultVertexFormat.POSITION); + public static final ShaderProgram RENDERTYPE_CLOUDS = register("rendertype_clouds", DefaultVertexFormat.POSITION_COLOR); + public static final ShaderProgram RENDERTYPE_LINES = register("rendertype_lines", DefaultVertexFormat.POSITION_COLOR_NORMAL); + public static final ShaderProgram RENDERTYPE_CRUMBLING = register("rendertype_crumbling", DefaultVertexFormat.BLOCK); + public static final ShaderProgram RENDERTYPE_GUI = register("rendertype_gui", DefaultVertexFormat.POSITION_COLOR); + public static final ShaderProgram RENDERTYPE_GUI_OVERLAY = register("rendertype_gui_overlay", DefaultVertexFormat.POSITION_COLOR); + public static final ShaderProgram RENDERTYPE_GUI_TEXT_HIGHLIGHT = register("rendertype_gui_text_highlight", DefaultVertexFormat.POSITION_COLOR); + public static final ShaderProgram RENDERTYPE_GUI_GHOST_RECIPE_OVERLAY = register("rendertype_gui_ghost_recipe_overlay", DefaultVertexFormat.POSITION_COLOR); + public static final ShaderProgram RENDERTYPE_BREEZE_WIND = register("rendertype_breeze_wind", DefaultVertexFormat.NEW_ENTITY); + + private static ShaderProgram register(String string, VertexFormat vertexFormat) { + return register(string, vertexFormat, ShaderDefines.EMPTY); + } + + private static ShaderProgram register(String string, VertexFormat vertexFormat, ShaderDefines shaderDefines) { + ShaderProgram shaderProgram = new ShaderProgram(ResourceLocation.withDefaultNamespace("core/" + string), vertexFormat, shaderDefines); + PROGRAMS.add(shaderProgram); + return shaderProgram; + } + + public static List getProgramsToPreload() { + return PROGRAMS; + } +} diff --git a/net/minecraft/client/renderer/CubeMap.java b/net/minecraft/client/renderer/CubeMap.java index 6272d0c0..3df0bc39 100644 --- a/net/minecraft/client/renderer/CubeMap.java +++ b/net/minecraft/client/renderer/CubeMap.java @@ -1,12 +1,12 @@ package net.minecraft.client.renderer; +import com.mojang.blaze3d.ProjectionType; import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.BufferBuilder; import com.mojang.blaze3d.vertex.BufferUploader; import com.mojang.blaze3d.vertex.DefaultVertexFormat; import com.mojang.blaze3d.vertex.Tesselator; import com.mojang.blaze3d.vertex.VertexFormat; -import com.mojang.blaze3d.vertex.VertexSorting; import java.util.concurrent.CompletableFuture; import java.util.concurrent.Executor; import net.fabricmc.api.EnvType; @@ -32,11 +32,11 @@ public class CubeMap { Tesselator tesselator = Tesselator.getInstance(); Matrix4f matrix4f = new Matrix4f().setPerspective(1.4835298F, (float)mc.getWindow().getWidth() / mc.getWindow().getHeight(), 0.05F, 10.0F); RenderSystem.backupProjectionMatrix(); - RenderSystem.setProjectionMatrix(matrix4f, VertexSorting.DISTANCE_TO_ORIGIN); + RenderSystem.setProjectionMatrix(matrix4f, ProjectionType.PERSPECTIVE); Matrix4fStack matrix4fStack = RenderSystem.getModelViewStack(); matrix4fStack.pushMatrix(); matrix4fStack.rotationX((float) Math.PI); - RenderSystem.setShader(GameRenderer::getPositionTexColorShader); + RenderSystem.setShader(CoreShaders.POSITION_TEX_COLOR); RenderSystem.enableBlend(); RenderSystem.disableCull(); RenderSystem.depthMask(false); @@ -50,7 +50,6 @@ public class CubeMap { matrix4fStack.translate(f, g, 0.0F); matrix4fStack.rotateX(pitch * (float) (Math.PI / 180.0)); matrix4fStack.rotateY(yaw * (float) (Math.PI / 180.0)); - RenderSystem.applyModelViewMatrix(); for (int k = 0; k < 6; k++) { RenderSystem.setShaderTexture(0, this.images[k]); @@ -108,7 +107,6 @@ public class CubeMap { RenderSystem.colorMask(true, true, true, true); RenderSystem.restoreProjectionMatrix(); matrix4fStack.popMatrix(); - RenderSystem.applyModelViewMatrix(); RenderSystem.depthMask(true); RenderSystem.enableCull(); RenderSystem.enableDepthTest(); diff --git a/net/minecraft/client/renderer/DimensionSpecialEffects.java b/net/minecraft/client/renderer/DimensionSpecialEffects.java index da008e42..d9102afb 100644 --- a/net/minecraft/client/renderer/DimensionSpecialEffects.java +++ b/net/minecraft/client/renderer/DimensionSpecialEffects.java @@ -6,11 +6,11 @@ import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.Util; import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.ARGB; import net.minecraft.util.Mth; import net.minecraft.world.level.dimension.BuiltinDimensionTypes; import net.minecraft.world.level.dimension.DimensionType; import net.minecraft.world.phys.Vec3; -import org.jetbrains.annotations.Nullable; @Environment(EnvType.CLIENT) public abstract class DimensionSpecialEffects { @@ -21,7 +21,6 @@ public abstract class DimensionSpecialEffects { object2ObjectArrayMap.put(BuiltinDimensionTypes.NETHER_EFFECTS, new DimensionSpecialEffects.NetherEffects()); object2ObjectArrayMap.put(BuiltinDimensionTypes.END_EFFECTS, new DimensionSpecialEffects.EndEffects()); }); - private final float[] sunriseCol = new float[4]; private final float cloudLevel; private final boolean hasGround; private final DimensionSpecialEffects.SkyType skyType; @@ -42,23 +41,12 @@ public abstract class DimensionSpecialEffects { return EFFECTS.get(dimensionType.effectsLocation()); } - @Nullable - public float[] getSunriseColor(float timeOfDay, float partialTicks) { - float f = 0.4F; - float g = Mth.cos(timeOfDay * (float) (Math.PI * 2)) - 0.0F; - float h = -0.0F; - if (g >= -0.4F && g <= 0.4F) { - float i = (g - -0.0F) / 0.4F * 0.5F + 0.5F; - float j = 1.0F - (1.0F - Mth.sin(i * (float) Math.PI)) * 0.99F; - j *= j; - this.sunriseCol[0] = i * 0.3F + 0.7F; - this.sunriseCol[1] = i * i * 0.7F + 0.2F; - this.sunriseCol[2] = i * i * 0.0F + 0.2F; - this.sunriseCol[3] = j; - return this.sunriseCol; - } else { - return null; - } + public boolean isSunriseOrSunset(float f) { + return false; + } + + public int getSunriseOrSunsetColor(float f) { + return 0; } public float getCloudHeight() { @@ -100,12 +88,6 @@ public abstract class DimensionSpecialEffects { public boolean isFoggyAt(int x, int y) { return false; } - - @Nullable - @Override - public float[] getSunriseColor(float timeOfDay, float partialTicks) { - return null; - } } @Environment(EnvType.CLIENT) @@ -128,9 +110,24 @@ public abstract class DimensionSpecialEffects { @Environment(EnvType.CLIENT) public static class OverworldEffects extends DimensionSpecialEffects { public static final int CLOUD_LEVEL = 192; + private static final float SUNRISE_AND_SUNSET_TIMESPAN = 0.4F; public OverworldEffects() { - super(192.0F, true, DimensionSpecialEffects.SkyType.NORMAL, false, false); + super(192.0F, true, DimensionSpecialEffects.SkyType.OVERWORLD, false, false); + } + + @Override + public boolean isSunriseOrSunset(float f) { + float g = Mth.cos(f * (float) (Math.PI * 2)); + return g >= -0.4F && g <= 0.4F; + } + + @Override + public int getSunriseOrSunsetColor(float f) { + float g = Mth.cos(f * (float) (Math.PI * 2)); + float h = g / 0.4F * 0.5F + 0.5F; + float i = Mth.square(1.0F - (1.0F - Mth.sin(h * (float) Math.PI)) * 0.99F); + return ARGB.colorFromFloat(i, h * 0.3F + 0.7F, h * h * 0.7F + 0.2F, 0.2F); } @Override @@ -147,7 +144,7 @@ public abstract class DimensionSpecialEffects { @Environment(EnvType.CLIENT) public static enum SkyType { NONE, - NORMAL, + OVERWORLD, END; } } diff --git a/net/minecraft/client/renderer/EffectInstance.java b/net/minecraft/client/renderer/EffectInstance.java deleted file mode 100644 index e4b8217f..00000000 --- a/net/minecraft/client/renderer/EffectInstance.java +++ /dev/null @@ -1,445 +0,0 @@ -package net.minecraft.client.renderer; - -import com.google.common.collect.Lists; -import com.google.common.collect.Maps; -import com.google.gson.JsonArray; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.mojang.blaze3d.platform.GlStateManager; -import com.mojang.blaze3d.shaders.AbstractUniform; -import com.mojang.blaze3d.shaders.BlendMode; -import com.mojang.blaze3d.shaders.Effect; -import com.mojang.blaze3d.shaders.EffectProgram; -import com.mojang.blaze3d.shaders.Program; -import com.mojang.blaze3d.shaders.ProgramManager; -import com.mojang.blaze3d.shaders.Uniform; -import com.mojang.blaze3d.systems.RenderSystem; -import com.mojang.logging.LogUtils; -import it.unimi.dsi.fastutil.ints.IntArrayList; -import it.unimi.dsi.fastutil.ints.IntList; -import java.io.IOException; -import java.io.InputStream; -import java.io.InvalidClassException; -import java.io.Reader; -import java.util.List; -import java.util.Map; -import java.util.function.IntSupplier; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.server.ChainedJsonException; -import net.minecraft.server.packs.resources.Resource; -import net.minecraft.server.packs.resources.ResourceProvider; -import net.minecraft.util.GsonHelper; -import org.jetbrains.annotations.Nullable; -import org.slf4j.Logger; - -@Environment(EnvType.CLIENT) -public class EffectInstance implements Effect, AutoCloseable { - private static final String EFFECT_SHADER_PATH = "shaders/program/"; - private static final Logger LOGGER = LogUtils.getLogger(); - private static final AbstractUniform DUMMY_UNIFORM = new AbstractUniform(); - private static final boolean ALWAYS_REAPPLY = true; - private static EffectInstance lastAppliedEffect; - private static int lastProgramId = -1; - private final Map samplerMap = Maps.newHashMap(); - private final List samplerNames = Lists.newArrayList(); - private final List samplerLocations = Lists.newArrayList(); - private final List uniforms = Lists.newArrayList(); - private final List uniformLocations = Lists.newArrayList(); - private final Map uniformMap = Maps.newHashMap(); - private final int programId; - private final String name; - private boolean dirty; - private final BlendMode blend; - private final List attributes; - private final List attributeNames; - private final EffectProgram vertexProgram; - private final EffectProgram fragmentProgram; - - public EffectInstance(ResourceProvider resourceProvider, String name) throws IOException { - ResourceLocation resourceLocation = ResourceLocation.withDefaultNamespace("shaders/program/" + name + ".json"); - this.name = name; - Resource resource = resourceProvider.getResourceOrThrow(resourceLocation); - - try { - Reader reader = resource.openAsReader(); - - try { - JsonObject jsonObject = GsonHelper.parse(reader); - String string = GsonHelper.getAsString(jsonObject, "vertex"); - String string2 = GsonHelper.getAsString(jsonObject, "fragment"); - JsonArray jsonArray = GsonHelper.getAsJsonArray(jsonObject, "samplers", null); - if (jsonArray != null) { - int i = 0; - - for (JsonElement jsonElement : jsonArray) { - try { - this.parseSamplerNode(jsonElement); - } catch (Exception var20) { - ChainedJsonException chainedJsonException = ChainedJsonException.forException(var20); - chainedJsonException.prependJsonKey("samplers[" + i + "]"); - throw chainedJsonException; - } - - i++; - } - } - - JsonArray jsonArray2 = GsonHelper.getAsJsonArray(jsonObject, "attributes", null); - if (jsonArray2 != null) { - int j = 0; - this.attributes = Lists.newArrayListWithCapacity(jsonArray2.size()); - this.attributeNames = Lists.newArrayListWithCapacity(jsonArray2.size()); - - for (JsonElement jsonElement2 : jsonArray2) { - try { - this.attributeNames.add(GsonHelper.convertToString(jsonElement2, "attribute")); - } catch (Exception var19) { - ChainedJsonException chainedJsonException2 = ChainedJsonException.forException(var19); - chainedJsonException2.prependJsonKey("attributes[" + j + "]"); - throw chainedJsonException2; - } - - j++; - } - } else { - this.attributes = null; - this.attributeNames = null; - } - - JsonArray jsonArray3 = GsonHelper.getAsJsonArray(jsonObject, "uniforms", null); - if (jsonArray3 != null) { - int k = 0; - - for (JsonElement jsonElement3 : jsonArray3) { - try { - this.parseUniformNode(jsonElement3); - } catch (Exception var18) { - ChainedJsonException chainedJsonException3 = ChainedJsonException.forException(var18); - chainedJsonException3.prependJsonKey("uniforms[" + k + "]"); - throw chainedJsonException3; - } - - k++; - } - } - - this.blend = parseBlendNode(GsonHelper.getAsJsonObject(jsonObject, "blend", null)); - this.vertexProgram = getOrCreate(resourceProvider, Program.Type.VERTEX, string); - this.fragmentProgram = getOrCreate(resourceProvider, Program.Type.FRAGMENT, string2); - this.programId = ProgramManager.createProgram(); - ProgramManager.linkShader(this); - this.updateLocations(); - if (this.attributeNames != null) { - for (String string3 : this.attributeNames) { - int l = Uniform.glGetAttribLocation(this.programId, string3); - this.attributes.add(l); - } - } - } catch (Throwable var21) { - if (reader != null) { - try { - reader.close(); - } catch (Throwable var17) { - var21.addSuppressed(var17); - } - } - - throw var21; - } - - if (reader != null) { - reader.close(); - } - } catch (Exception var22) { - ChainedJsonException chainedJsonException4 = ChainedJsonException.forException(var22); - chainedJsonException4.setFilenameAndFlush(resourceLocation.getPath() + " (" + resource.sourcePackId() + ")"); - throw chainedJsonException4; - } - - this.markDirty(); - } - - public static EffectProgram getOrCreate(ResourceProvider resourceProvider, Program.Type type, String name) throws IOException { - Program program = (Program)type.getPrograms().get(name); - if (program != null && !(program instanceof EffectProgram)) { - throw new InvalidClassException("Program is not of type EffectProgram"); - } else { - EffectProgram effectProgram; - if (program == null) { - ResourceLocation resourceLocation = ResourceLocation.withDefaultNamespace("shaders/program/" + name + type.getExtension()); - Resource resource = resourceProvider.getResourceOrThrow(resourceLocation); - InputStream inputStream = resource.open(); - - try { - effectProgram = EffectProgram.compileShader(type, name, inputStream, resource.sourcePackId()); - } catch (Throwable var11) { - if (inputStream != null) { - try { - inputStream.close(); - } catch (Throwable var10) { - var11.addSuppressed(var10); - } - } - - throw var11; - } - - if (inputStream != null) { - inputStream.close(); - } - } else { - effectProgram = (EffectProgram)program; - } - - return effectProgram; - } - } - - public static BlendMode parseBlendNode(@Nullable JsonObject json) { - if (json == null) { - return new BlendMode(); - } else { - int i = 32774; - int j = 1; - int k = 0; - int l = 1; - int m = 0; - boolean bl = true; - boolean bl2 = false; - if (GsonHelper.isStringValue(json, "func")) { - i = BlendMode.stringToBlendFunc(json.get("func").getAsString()); - if (i != 32774) { - bl = false; - } - } - - if (GsonHelper.isStringValue(json, "srcrgb")) { - j = BlendMode.stringToBlendFactor(json.get("srcrgb").getAsString()); - if (j != 1) { - bl = false; - } - } - - if (GsonHelper.isStringValue(json, "dstrgb")) { - k = BlendMode.stringToBlendFactor(json.get("dstrgb").getAsString()); - if (k != 0) { - bl = false; - } - } - - if (GsonHelper.isStringValue(json, "srcalpha")) { - l = BlendMode.stringToBlendFactor(json.get("srcalpha").getAsString()); - if (l != 1) { - bl = false; - } - - bl2 = true; - } - - if (GsonHelper.isStringValue(json, "dstalpha")) { - m = BlendMode.stringToBlendFactor(json.get("dstalpha").getAsString()); - if (m != 0) { - bl = false; - } - - bl2 = true; - } - - if (bl) { - return new BlendMode(); - } else { - return bl2 ? new BlendMode(j, k, l, m, i) : new BlendMode(j, k, i); - } - } - } - - public void close() { - for (Uniform uniform : this.uniforms) { - uniform.close(); - } - - ProgramManager.releaseProgram(this); - } - - public void clear() { - RenderSystem.assertOnRenderThread(); - ProgramManager.glUseProgram(0); - lastProgramId = -1; - lastAppliedEffect = null; - - for (int i = 0; i < this.samplerLocations.size(); i++) { - if (this.samplerMap.get(this.samplerNames.get(i)) != null) { - GlStateManager._activeTexture(33984 + i); - GlStateManager._bindTexture(0); - } - } - } - - public void apply() { - this.dirty = false; - lastAppliedEffect = this; - this.blend.apply(); - if (this.programId != lastProgramId) { - ProgramManager.glUseProgram(this.programId); - lastProgramId = this.programId; - } - - for (int i = 0; i < this.samplerLocations.size(); i++) { - String string = (String)this.samplerNames.get(i); - IntSupplier intSupplier = (IntSupplier)this.samplerMap.get(string); - if (intSupplier != null) { - RenderSystem.activeTexture(33984 + i); - int j = intSupplier.getAsInt(); - if (j != -1) { - RenderSystem.bindTexture(j); - Uniform.uploadInteger((Integer)this.samplerLocations.get(i), i); - } - } - } - - for (Uniform uniform : this.uniforms) { - uniform.upload(); - } - } - - @Override - public void markDirty() { - this.dirty = true; - } - - @Nullable - public Uniform getUniform(String name) { - RenderSystem.assertOnRenderThread(); - return (Uniform)this.uniformMap.get(name); - } - - public AbstractUniform safeGetUniform(String name) { - Uniform uniform = this.getUniform(name); - return (AbstractUniform)(uniform == null ? DUMMY_UNIFORM : uniform); - } - - private void updateLocations() { - RenderSystem.assertOnRenderThread(); - IntList intList = new IntArrayList(); - - for (int i = 0; i < this.samplerNames.size(); i++) { - String string = (String)this.samplerNames.get(i); - int j = Uniform.glGetUniformLocation(this.programId, string); - if (j == -1) { - LOGGER.warn("Shader {} could not find sampler named {} in the specified shader program.", this.name, string); - this.samplerMap.remove(string); - intList.add(i); - } else { - this.samplerLocations.add(j); - } - } - - for (int ix = intList.size() - 1; ix >= 0; ix--) { - this.samplerNames.remove(intList.getInt(ix)); - } - - for (Uniform uniform : this.uniforms) { - String string2 = uniform.getName(); - int k = Uniform.glGetUniformLocation(this.programId, string2); - if (k == -1) { - LOGGER.warn("Shader {} could not find uniform named {} in the specified shader program.", this.name, string2); - } else { - this.uniformLocations.add(k); - uniform.setLocation(k); - this.uniformMap.put(string2, uniform); - } - } - } - - private void parseSamplerNode(JsonElement json) { - JsonObject jsonObject = GsonHelper.convertToJsonObject(json, "sampler"); - String string = GsonHelper.getAsString(jsonObject, "name"); - if (!GsonHelper.isStringValue(jsonObject, "file")) { - this.samplerMap.put(string, null); - this.samplerNames.add(string); - } else { - this.samplerNames.add(string); - } - } - - public void setSampler(String name, IntSupplier textureId) { - if (this.samplerMap.containsKey(name)) { - this.samplerMap.remove(name); - } - - this.samplerMap.put(name, textureId); - this.markDirty(); - } - - private void parseUniformNode(JsonElement json) throws ChainedJsonException { - JsonObject jsonObject = GsonHelper.convertToJsonObject(json, "uniform"); - String string = GsonHelper.getAsString(jsonObject, "name"); - int i = Uniform.getTypeFromString(GsonHelper.getAsString(jsonObject, "type")); - int j = GsonHelper.getAsInt(jsonObject, "count"); - float[] fs = new float[Math.max(j, 16)]; - JsonArray jsonArray = GsonHelper.getAsJsonArray(jsonObject, "values"); - if (jsonArray.size() != j && jsonArray.size() > 1) { - throw new ChainedJsonException("Invalid amount of values specified (expected " + j + ", found " + jsonArray.size() + ")"); - } else { - int k = 0; - - for (JsonElement jsonElement : jsonArray) { - try { - fs[k] = GsonHelper.convertToFloat(jsonElement, "value"); - } catch (Exception var13) { - ChainedJsonException chainedJsonException = ChainedJsonException.forException(var13); - chainedJsonException.prependJsonKey("values[" + k + "]"); - throw chainedJsonException; - } - - k++; - } - - if (j > 1 && jsonArray.size() == 1) { - while (k < j) { - fs[k] = fs[0]; - k++; - } - } - - int l = j > 1 && j <= 4 && i < 8 ? j - 1 : 0; - Uniform uniform = new Uniform(string, i + l, j, this); - if (i <= 3) { - uniform.setSafe((int)fs[0], (int)fs[1], (int)fs[2], (int)fs[3]); - } else if (i <= 7) { - uniform.setSafe(fs[0], fs[1], fs[2], fs[3]); - } else { - uniform.set(fs); - } - - this.uniforms.add(uniform); - } - } - - @Override - public Program getVertexProgram() { - return this.vertexProgram; - } - - @Override - public Program getFragmentProgram() { - return this.fragmentProgram; - } - - @Override - public void attachToProgram() { - this.fragmentProgram.attachToEffect(this); - this.vertexProgram.attachToEffect(this); - } - - public String getName() { - return this.name; - } - - @Override - public int getId() { - return this.programId; - } -} diff --git a/net/minecraft/client/renderer/FogParameters.java b/net/minecraft/client/renderer/FogParameters.java new file mode 100644 index 00000000..af7d8f42 --- /dev/null +++ b/net/minecraft/client/renderer/FogParameters.java @@ -0,0 +1,10 @@ +package net.minecraft.client.renderer; + +import com.mojang.blaze3d.shaders.FogShape; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; + +@Environment(EnvType.CLIENT) +public record FogParameters(float start, float end, FogShape shape, float red, float green, float blue, float alpha) { + public static final FogParameters NO_FOG = new FogParameters(Float.MAX_VALUE, 0.0F, FogShape.SPHERE, 0.0F, 0.0F, 0.0F, 0.0F); +} diff --git a/net/minecraft/client/renderer/FogRenderer.java b/net/minecraft/client/renderer/FogRenderer.java index 0d3c90fb..851aa9e7 100644 --- a/net/minecraft/client/renderer/FogRenderer.java +++ b/net/minecraft/client/renderer/FogRenderer.java @@ -2,7 +2,6 @@ package net.minecraft.client.renderer; import com.google.common.collect.Lists; import com.mojang.blaze3d.shaders.FogShape; -import com.mojang.blaze3d.systems.RenderSystem; import java.util.List; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; @@ -13,6 +12,7 @@ import net.minecraft.client.player.LocalPlayer; import net.minecraft.core.BlockPos; import net.minecraft.core.Holder; import net.minecraft.tags.BiomeTags; +import net.minecraft.util.ARGB; import net.minecraft.util.CubicSampler; import net.minecraft.util.Mth; import net.minecraft.world.effect.MobEffect; @@ -26,6 +26,7 @@ import net.minecraft.world.level.material.FogType; import net.minecraft.world.phys.Vec3; import org.jetbrains.annotations.Nullable; import org.joml.Vector3f; +import org.joml.Vector4f; @Environment(EnvType.CLIENT) public class FogRenderer { @@ -34,161 +35,160 @@ public class FogRenderer { new FogRenderer.BlindnessFogFunction(), new FogRenderer.DarknessFogFunction() ); public static final float BIOME_FOG_TRANSITION_TIME = 5000.0F; - private static float fogRed; - private static float fogGreen; - private static float fogBlue; private static int targetBiomeFog = -1; private static int previousBiomeFog = -1; private static long biomeChangedTime = -1L; + private static boolean fogEnabled = true; - public static void setupColor(Camera activeRenderInfo, float partialTicks, ClientLevel level, int renderDistanceChunks, float bossColorModifier) { - FogType fogType = activeRenderInfo.getFluidInCamera(); - Entity entity = activeRenderInfo.getEntity(); + public static Vector4f computeFogColor(Camera camera, float f, ClientLevel clientLevel, int i, float g) { + FogType fogType = camera.getFluidInCamera(); + Entity entity = camera.getEntity(); + float u; + float v; + float w; if (fogType == FogType.WATER) { long l = Util.getMillis(); - int i = level.getBiome(BlockPos.containing(activeRenderInfo.getPosition())).value().getWaterFogColor(); + int j = clientLevel.getBiome(BlockPos.containing(camera.getPosition())).value().getWaterFogColor(); if (biomeChangedTime < 0L) { - targetBiomeFog = i; - previousBiomeFog = i; + targetBiomeFog = j; + previousBiomeFog = j; biomeChangedTime = l; } - int j = targetBiomeFog >> 16 & 0xFF; - int k = targetBiomeFog >> 8 & 0xFF; - int m = targetBiomeFog & 0xFF; - int n = previousBiomeFog >> 16 & 0xFF; - int o = previousBiomeFog >> 8 & 0xFF; - int p = previousBiomeFog & 0xFF; - float f = Mth.clamp((float)(l - biomeChangedTime) / 5000.0F, 0.0F, 1.0F); - float g = Mth.lerp(f, (float)n, (float)j); - float h = Mth.lerp(f, (float)o, (float)k); - float q = Mth.lerp(f, (float)p, (float)m); - fogRed = g / 255.0F; - fogGreen = h / 255.0F; - fogBlue = q / 255.0F; - if (targetBiomeFog != i) { - targetBiomeFog = i; - previousBiomeFog = Mth.floor(g) << 16 | Mth.floor(h) << 8 | Mth.floor(q); + int k = targetBiomeFog >> 16 & 0xFF; + int m = targetBiomeFog >> 8 & 0xFF; + int n = targetBiomeFog & 0xFF; + int o = previousBiomeFog >> 16 & 0xFF; + int p = previousBiomeFog >> 8 & 0xFF; + int q = previousBiomeFog & 0xFF; + float h = Mth.clamp((float)(l - biomeChangedTime) / 5000.0F, 0.0F, 1.0F); + float r = Mth.lerp(h, (float)o, (float)k); + float s = Mth.lerp(h, (float)p, (float)m); + float t = Mth.lerp(h, (float)q, (float)n); + u = r / 255.0F; + v = s / 255.0F; + w = t / 255.0F; + if (targetBiomeFog != j) { + targetBiomeFog = j; + previousBiomeFog = Mth.floor(r) << 16 | Mth.floor(s) << 8 | Mth.floor(t); biomeChangedTime = l; } } else if (fogType == FogType.LAVA) { - fogRed = 0.6F; - fogGreen = 0.1F; - fogBlue = 0.0F; + u = 0.6F; + v = 0.1F; + w = 0.0F; biomeChangedTime = -1L; } else if (fogType == FogType.POWDER_SNOW) { - fogRed = 0.623F; - fogGreen = 0.734F; - fogBlue = 0.785F; + u = 0.623F; + v = 0.734F; + w = 0.785F; biomeChangedTime = -1L; - RenderSystem.clearColor(fogRed, fogGreen, fogBlue, 0.0F); } else { - float r = 0.25F + 0.75F * renderDistanceChunks / 32.0F; - r = 1.0F - (float)Math.pow(r, 0.25); - Vec3 vec3 = level.getSkyColor(activeRenderInfo.getPosition(), partialTicks); - float s = (float)vec3.x; - float t = (float)vec3.y; - float u = (float)vec3.z; - float v = Mth.clamp(Mth.cos(level.getTimeOfDay(partialTicks) * (float) (Math.PI * 2)) * 2.0F + 0.5F, 0.0F, 1.0F); - BiomeManager biomeManager = level.getBiomeManager(); - Vec3 vec32 = activeRenderInfo.getPosition().subtract(2.0, 2.0, 2.0).scale(0.25); - Vec3 vec33 = CubicSampler.gaussianSampleVec3( - vec32, (ix, j, k) -> level.effects().getBrightnessDependentFogColor(Vec3.fromRGB24(biomeManager.getNoiseBiomeAtQuart(ix, j, k).value().getFogColor()), v) + float x = 0.25F + 0.75F * i / 32.0F; + x = 1.0F - (float)Math.pow(x, 0.25); + int y = clientLevel.getSkyColor(camera.getPosition(), f); + float z = ARGB.from8BitChannel(ARGB.red(y)); + float aa = ARGB.from8BitChannel(ARGB.green(y)); + float ab = ARGB.from8BitChannel(ARGB.blue(y)); + float ac = Mth.clamp(Mth.cos(clientLevel.getTimeOfDay(f) * (float) (Math.PI * 2)) * 2.0F + 0.5F, 0.0F, 1.0F); + BiomeManager biomeManager = clientLevel.getBiomeManager(); + Vec3 vec3 = camera.getPosition().subtract(2.0, 2.0, 2.0).scale(0.25); + Vec3 vec32 = CubicSampler.gaussianSampleVec3( + vec3, + (ix, jx, k) -> clientLevel.effects().getBrightnessDependentFogColor(Vec3.fromRGB24(biomeManager.getNoiseBiomeAtQuart(ix, jx, k).value().getFogColor()), ac) ); - fogRed = (float)vec33.x(); - fogGreen = (float)vec33.y(); - fogBlue = (float)vec33.z(); - if (renderDistanceChunks >= 4) { - float f = Mth.sin(level.getSunAngle(partialTicks)) > 0.0F ? -1.0F : 1.0F; - Vector3f vector3f = new Vector3f(f, 0.0F, 0.0F); - float h = activeRenderInfo.getLookVector().dot(vector3f); - if (h < 0.0F) { - h = 0.0F; + u = (float)vec32.x(); + v = (float)vec32.y(); + w = (float)vec32.z(); + if (i >= 4) { + float h = Mth.sin(clientLevel.getSunAngle(f)) > 0.0F ? -1.0F : 1.0F; + Vector3f vector3f = new Vector3f(h, 0.0F, 0.0F); + float s = camera.getLookVector().dot(vector3f); + if (s < 0.0F) { + s = 0.0F; } - if (h > 0.0F) { - float[] fs = level.effects().getSunriseColor(level.getTimeOfDay(partialTicks), partialTicks); - if (fs != null) { - h *= fs[3]; - fogRed = fogRed * (1.0F - h) + fs[0] * h; - fogGreen = fogGreen * (1.0F - h) + fs[1] * h; - fogBlue = fogBlue * (1.0F - h) + fs[2] * h; - } + if (s > 0.0F && clientLevel.effects().isSunriseOrSunset(clientLevel.getTimeOfDay(f))) { + int ad = clientLevel.effects().getSunriseOrSunsetColor(clientLevel.getTimeOfDay(f)); + s *= ARGB.from8BitChannel(ARGB.alpha(ad)); + u = u * (1.0F - s) + ARGB.from8BitChannel(ARGB.red(ad)) * s; + v = v * (1.0F - s) + ARGB.from8BitChannel(ARGB.green(ad)) * s; + w = w * (1.0F - s) + ARGB.from8BitChannel(ARGB.blue(ad)) * s; } } - fogRed = fogRed + (s - fogRed) * r; - fogGreen = fogGreen + (t - fogGreen) * r; - fogBlue = fogBlue + (u - fogBlue) * r; - float fx = level.getRainLevel(partialTicks); - if (fx > 0.0F) { - float g = 1.0F - fx * 0.5F; - float hx = 1.0F - fx * 0.4F; - fogRed *= g; - fogGreen *= g; - fogBlue *= hx; + u += (z - u) * x; + v += (aa - v) * x; + w += (ab - w) * x; + float hx = clientLevel.getRainLevel(f); + if (hx > 0.0F) { + float r = 1.0F - hx * 0.5F; + float sx = 1.0F - hx * 0.4F; + u *= r; + v *= r; + w *= sx; } - float g = level.getThunderLevel(partialTicks); - if (g > 0.0F) { - float hx = 1.0F - g * 0.5F; - fogRed *= hx; - fogGreen *= hx; - fogBlue *= hx; + float r = clientLevel.getThunderLevel(f); + if (r > 0.0F) { + float sx = 1.0F - r * 0.5F; + u *= sx; + v *= sx; + w *= sx; } biomeChangedTime = -1L; } - float rx = ((float)activeRenderInfo.getPosition().y - level.getMinBuildHeight()) * level.getLevelData().getClearColorScale(); - FogRenderer.MobEffectFogFunction mobEffectFogFunction = getPriorityFogFunction(entity, partialTicks); + float xx = ((float)camera.getPosition().y - clientLevel.getMinY()) * clientLevel.getLevelData().getClearColorScale(); + FogRenderer.MobEffectFogFunction mobEffectFogFunction = getPriorityFogFunction(entity, f); if (mobEffectFogFunction != null) { LivingEntity livingEntity = (LivingEntity)entity; - rx = mobEffectFogFunction.getModifiedVoidDarkness(livingEntity, livingEntity.getEffect(mobEffectFogFunction.getMobEffect()), rx, partialTicks); + xx = mobEffectFogFunction.getModifiedVoidDarkness(livingEntity, livingEntity.getEffect(mobEffectFogFunction.getMobEffect()), xx, f); } - if (rx < 1.0F && fogType != FogType.LAVA && fogType != FogType.POWDER_SNOW) { - if (rx < 0.0F) { - rx = 0.0F; + if (xx < 1.0F && fogType != FogType.LAVA && fogType != FogType.POWDER_SNOW) { + if (xx < 0.0F) { + xx = 0.0F; } - rx *= rx; - fogRed *= rx; - fogGreen *= rx; - fogBlue *= rx; + xx *= xx; + u *= xx; + v *= xx; + w *= xx; } - if (bossColorModifier > 0.0F) { - fogRed = fogRed * (1.0F - bossColorModifier) + fogRed * 0.7F * bossColorModifier; - fogGreen = fogGreen * (1.0F - bossColorModifier) + fogGreen * 0.6F * bossColorModifier; - fogBlue = fogBlue * (1.0F - bossColorModifier) + fogBlue * 0.6F * bossColorModifier; + if (g > 0.0F) { + u = u * (1.0F - g) + u * 0.7F * g; + v = v * (1.0F - g) + v * 0.6F * g; + w = w * (1.0F - g) + w * 0.6F * g; } - float sx; + float zx; if (fogType == FogType.WATER) { if (entity instanceof LocalPlayer) { - sx = ((LocalPlayer)entity).getWaterVision(); + zx = ((LocalPlayer)entity).getWaterVision(); } else { - sx = 1.0F; + zx = 1.0F; } } else if (entity instanceof LivingEntity livingEntity2 && livingEntity2.hasEffect(MobEffects.NIGHT_VISION) && !livingEntity2.hasEffect(MobEffects.DARKNESS)) { - sx = GameRenderer.getNightVisionScale(livingEntity2, partialTicks); + zx = GameRenderer.getNightVisionScale(livingEntity2, f); } else { - sx = 0.0F; + zx = 0.0F; } - if (fogRed != 0.0F && fogGreen != 0.0F && fogBlue != 0.0F) { - float tx = Math.min(1.0F / fogRed, Math.min(1.0F / fogGreen, 1.0F / fogBlue)); - fogRed = fogRed * (1.0F - sx) + fogRed * tx * sx; - fogGreen = fogGreen * (1.0F - sx) + fogGreen * tx * sx; - fogBlue = fogBlue * (1.0F - sx) + fogBlue * tx * sx; + if (u != 0.0F && v != 0.0F && w != 0.0F) { + float aax = Math.min(1.0F / u, Math.min(1.0F / v, 1.0F / w)); + u = u * (1.0F - zx) + u * aax * zx; + v = v * (1.0F - zx) + v * aax * zx; + w = w * (1.0F - zx) + w * aax * zx; } - RenderSystem.clearColor(fogRed, fogGreen, fogBlue, 0.0F); + return new Vector4f(u, v, w, 1.0F); } - public static void setupNoFog() { - RenderSystem.setShaderFogStart(Float.MAX_VALUE); + public static boolean toggleFog() { + return fogEnabled = !fogEnabled; } @Nullable @@ -201,72 +201,70 @@ public class FogRenderer { : null; } - public static void setupFog(Camera camera, FogRenderer.FogMode fogMode, float farPlaneDistance, boolean shouldCreateFog, float partialTick) { - FogType fogType = camera.getFluidInCamera(); - Entity entity = camera.getEntity(); - FogRenderer.FogData fogData = new FogRenderer.FogData(fogMode); - FogRenderer.MobEffectFogFunction mobEffectFogFunction = getPriorityFogFunction(entity, partialTick); - if (fogType == FogType.LAVA) { - if (entity.isSpectator()) { - fogData.start = -8.0F; - fogData.end = farPlaneDistance * 0.5F; - } else if (entity instanceof LivingEntity && ((LivingEntity)entity).hasEffect(MobEffects.FIRE_RESISTANCE)) { - fogData.start = 0.0F; - fogData.end = 5.0F; - } else { - fogData.start = 0.25F; - fogData.end = 1.0F; - } - } else if (fogType == FogType.POWDER_SNOW) { - if (entity.isSpectator()) { - fogData.start = -8.0F; - fogData.end = farPlaneDistance * 0.5F; - } else { - fogData.start = 0.0F; - fogData.end = 2.0F; - } - } else if (mobEffectFogFunction != null) { - LivingEntity livingEntity = (LivingEntity)entity; - MobEffectInstance mobEffectInstance = livingEntity.getEffect(mobEffectFogFunction.getMobEffect()); - if (mobEffectInstance != null) { - mobEffectFogFunction.setupFog(fogData, livingEntity, mobEffectInstance, farPlaneDistance, partialTick); - } - } else if (fogType == FogType.WATER) { - fogData.start = -8.0F; - fogData.end = 96.0F; - if (entity instanceof LocalPlayer localPlayer) { - fogData.end = fogData.end * Math.max(0.25F, localPlayer.getWaterVision()); - Holder holder = localPlayer.level().getBiome(localPlayer.blockPosition()); - if (holder.is(BiomeTags.HAS_CLOSER_WATER_FOG)) { - fogData.end *= 0.85F; + public static FogParameters setupFog(Camera camera, FogRenderer.FogMode fogMode, Vector4f vector4f, float f, boolean bl, float g) { + if (!fogEnabled) { + return FogParameters.NO_FOG; + } else { + FogType fogType = camera.getFluidInCamera(); + Entity entity = camera.getEntity(); + FogRenderer.FogData fogData = new FogRenderer.FogData(fogMode); + FogRenderer.MobEffectFogFunction mobEffectFogFunction = getPriorityFogFunction(entity, g); + if (fogType == FogType.LAVA) { + if (entity.isSpectator()) { + fogData.start = -8.0F; + fogData.end = f * 0.5F; + } else if (entity instanceof LivingEntity && ((LivingEntity)entity).hasEffect(MobEffects.FIRE_RESISTANCE)) { + fogData.start = 0.0F; + fogData.end = 5.0F; + } else { + fogData.start = 0.25F; + fogData.end = 1.0F; + } + } else if (fogType == FogType.POWDER_SNOW) { + if (entity.isSpectator()) { + fogData.start = -8.0F; + fogData.end = f * 0.5F; + } else { + fogData.start = 0.0F; + fogData.end = 2.0F; + } + } else if (mobEffectFogFunction != null) { + LivingEntity livingEntity = (LivingEntity)entity; + MobEffectInstance mobEffectInstance = livingEntity.getEffect(mobEffectFogFunction.getMobEffect()); + if (mobEffectInstance != null) { + mobEffectFogFunction.setupFog(fogData, livingEntity, mobEffectInstance, f, g); + } + } else if (fogType == FogType.WATER) { + fogData.start = -8.0F; + fogData.end = 96.0F; + if (entity instanceof LocalPlayer localPlayer) { + fogData.end = fogData.end * Math.max(0.25F, localPlayer.getWaterVision()); + Holder holder = localPlayer.level().getBiome(localPlayer.blockPosition()); + if (holder.is(BiomeTags.HAS_CLOSER_WATER_FOG)) { + fogData.end *= 0.85F; + } } - } - if (fogData.end > farPlaneDistance) { - fogData.end = farPlaneDistance; + if (fogData.end > f) { + fogData.end = f; + fogData.shape = FogShape.CYLINDER; + } + } else if (bl) { + fogData.start = f * 0.05F; + fogData.end = Math.min(f, 192.0F) * 0.5F; + } else if (fogMode == FogRenderer.FogMode.FOG_SKY) { + fogData.start = 0.0F; + fogData.end = f; + fogData.shape = FogShape.CYLINDER; + } else if (fogMode == FogRenderer.FogMode.FOG_TERRAIN) { + float h = Mth.clamp(f / 10.0F, 4.0F, 64.0F); + fogData.start = f - h; + fogData.end = f; fogData.shape = FogShape.CYLINDER; } - } else if (shouldCreateFog) { - fogData.start = farPlaneDistance * 0.05F; - fogData.end = Math.min(farPlaneDistance, 192.0F) * 0.5F; - } else if (fogMode == FogRenderer.FogMode.FOG_SKY) { - fogData.start = 0.0F; - fogData.end = farPlaneDistance; - fogData.shape = FogShape.CYLINDER; - } else { - float f = Mth.clamp(farPlaneDistance / 10.0F, 4.0F, 64.0F); - fogData.start = farPlaneDistance - f; - fogData.end = farPlaneDistance; - fogData.shape = FogShape.CYLINDER; + + return new FogParameters(fogData.start, fogData.end, fogData.shape, vector4f.x, vector4f.y, vector4f.z, vector4f.w); } - - RenderSystem.setShaderFogStart(fogData.start); - RenderSystem.setShaderFogEnd(fogData.end); - RenderSystem.setShaderFogShape(fogData.shape); - } - - public static void levelFogColor() { - RenderSystem.setShaderFogColor(fogRed, fogGreen, fogBlue); } @Environment(EnvType.CLIENT) @@ -282,7 +280,7 @@ public class FogRenderer { if (fogData.mode == FogRenderer.FogMode.FOG_SKY) { fogData.start = 0.0F; fogData.end = g * 0.8F; - } else { + } else if (fogData.mode == FogRenderer.FogMode.FOG_TERRAIN) { fogData.start = g * 0.25F; fogData.end = g; } @@ -299,7 +297,11 @@ public class FogRenderer { @Override public void setupFog(FogRenderer.FogData fogData, LivingEntity entity, MobEffectInstance effectInstance, float farPlaneDistance, float f) { float g = Mth.lerp(effectInstance.getBlendFactor(entity, f), farPlaneDistance, 15.0F); - fogData.start = fogData.mode == FogRenderer.FogMode.FOG_SKY ? 0.0F : g * 0.75F; + + fogData.start = switch (fogData.mode) { + case FOG_SKY -> 0.0F; + case FOG_TERRAIN -> g * 0.75F; + }; fogData.end = g; } diff --git a/net/minecraft/client/renderer/GameRenderer.java b/net/minecraft/client/renderer/GameRenderer.java index 744cb1fa..40eb241d 100644 --- a/net/minecraft/client/renderer/GameRenderer.java +++ b/net/minecraft/client/renderer/GameRenderer.java @@ -1,33 +1,19 @@ package net.minecraft.client.renderer; -import com.google.common.collect.Lists; -import com.google.common.collect.Maps; -import com.google.gson.JsonSyntaxException; -import com.mojang.blaze3d.platform.GlStateManager; +import com.mojang.blaze3d.ProjectionType; import com.mojang.blaze3d.platform.Lighting; import com.mojang.blaze3d.platform.NativeImage; import com.mojang.blaze3d.platform.Window; -import com.mojang.blaze3d.shaders.Program; +import com.mojang.blaze3d.resource.CrossFrameResourcePool; import com.mojang.blaze3d.systems.RenderSystem; -import com.mojang.blaze3d.vertex.DefaultVertexFormat; import com.mojang.blaze3d.vertex.PoseStack; -import com.mojang.blaze3d.vertex.VertexFormat; -import com.mojang.blaze3d.vertex.VertexSorting; -import com.mojang.datafixers.util.Pair; import com.mojang.logging.LogUtils; import com.mojang.math.Axis; -import java.io.ByteArrayInputStream; import java.io.IOException; -import java.io.InputStream; import java.nio.file.Files; import java.nio.file.LinkOption; import java.nio.file.Path; -import java.util.HashMap; -import java.util.List; import java.util.Locale; -import java.util.Map; -import java.util.Optional; -import java.util.function.Consumer; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.CrashReport; @@ -38,9 +24,9 @@ import net.minecraft.Util; import net.minecraft.client.Camera; import net.minecraft.client.DeltaTracker; import net.minecraft.client.Minecraft; +import net.minecraft.client.Options; import net.minecraft.client.Screenshot; import net.minecraft.client.gui.GuiGraphics; -import net.minecraft.client.gui.MapRenderer; import net.minecraft.client.player.AbstractClientPlayer; import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.client.server.IntegratedServer; @@ -49,17 +35,17 @@ import net.minecraft.core.Direction; import net.minecraft.core.Registry; import net.minecraft.core.registries.Registries; import net.minecraft.resources.ResourceLocation; -import net.minecraft.server.packs.resources.PreparableReloadListener; -import net.minecraft.server.packs.resources.Resource; import net.minecraft.server.packs.resources.ResourceManager; import net.minecraft.server.packs.resources.ResourceProvider; -import net.minecraft.server.packs.resources.SimplePreparableReloadListener; import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; +import net.minecraft.util.profiling.Profiler; import net.minecraft.util.profiling.ProfilerFiller; +import net.minecraft.util.profiling.Zone; import net.minecraft.world.effect.MobEffectInstance; import net.minecraft.world.effect.MobEffects; import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntitySelector; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.monster.Creeper; import net.minecraft.world.entity.monster.EnderMan; @@ -78,6 +64,7 @@ import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.EntityHitResult; import net.minecraft.world.phys.HitResult; import net.minecraft.world.phys.Vec3; +import net.minecraft.world.phys.HitResult.Type; import org.jetbrains.annotations.Nullable; import org.joml.Matrix4f; import org.joml.Matrix4fStack; @@ -87,23 +74,21 @@ import org.slf4j.Logger; @Environment(EnvType.CLIENT) public class GameRenderer implements AutoCloseable { - private static final ResourceLocation NAUSEA_LOCATION = ResourceLocation.withDefaultNamespace("textures/misc/nausea.png"); - private static final ResourceLocation BLUR_LOCATION = ResourceLocation.withDefaultNamespace("shaders/post/blur.json"); + private static final ResourceLocation BLUR_POST_CHAIN_ID = ResourceLocation.withDefaultNamespace("blur"); public static final int MAX_BLUR_RADIUS = 10; - static final Logger LOGGER = LogUtils.getLogger(); + private static final Logger LOGGER = LogUtils.getLogger(); private static final boolean DEPTH_BUFFER_DEBUG = false; public static final float PROJECTION_Z_NEAR = 0.05F; private static final float GUI_Z_NEAR = 1000.0F; - final Minecraft minecraft; + private final Minecraft minecraft; private final ResourceManager resourceManager; private final RandomSource random = RandomSource.create(); private float renderDistance; public final ItemInHandRenderer itemInHandRenderer; - private final MapRenderer mapRenderer; private final RenderBuffers renderBuffers; private int confusionAnimationTick; - private float fov; - private float oldFov; + private float fovModifier; + private float oldFovModifier; private float darkenWorldAmount; private float darkenWorldAmountO; private boolean renderHand = true; @@ -123,153 +108,24 @@ public class GameRenderer implements AutoCloseable { private int itemActivationTicks; private float itemActivationOffX; private float itemActivationOffY; + private final CrossFrameResourcePool resourcePool = new CrossFrameResourcePool(3); @Nullable - PostChain postEffect; - @Nullable - private PostChain blurEffect; + private ResourceLocation postEffectId; private boolean effectActive; private final Camera mainCamera = new Camera(); - @Nullable - public ShaderInstance blitShader; - private final Map shaders = Maps.newHashMap(); - @Nullable - private static ShaderInstance positionShader; - @Nullable - private static ShaderInstance positionColorShader; - @Nullable - private static ShaderInstance positionTexShader; - @Nullable - private static ShaderInstance positionTexColorShader; - @Nullable - private static ShaderInstance particleShader; - @Nullable - private static ShaderInstance positionColorLightmapShader; - @Nullable - private static ShaderInstance positionColorTexLightmapShader; - @Nullable - private static ShaderInstance rendertypeSolidShader; - @Nullable - private static ShaderInstance rendertypeCutoutMippedShader; - @Nullable - private static ShaderInstance rendertypeCutoutShader; - @Nullable - private static ShaderInstance rendertypeTranslucentShader; - @Nullable - private static ShaderInstance rendertypeTranslucentMovingBlockShader; - @Nullable - private static ShaderInstance rendertypeArmorCutoutNoCullShader; - @Nullable - private static ShaderInstance rendertypeEntitySolidShader; - @Nullable - private static ShaderInstance rendertypeEntityCutoutShader; - @Nullable - private static ShaderInstance rendertypeEntityCutoutNoCullShader; - @Nullable - private static ShaderInstance rendertypeEntityCutoutNoCullZOffsetShader; - @Nullable - private static ShaderInstance rendertypeItemEntityTranslucentCullShader; - @Nullable - private static ShaderInstance rendertypeEntityTranslucentCullShader; - @Nullable - private static ShaderInstance rendertypeEntityTranslucentShader; - @Nullable - private static ShaderInstance rendertypeEntityTranslucentEmissiveShader; - @Nullable - private static ShaderInstance rendertypeEntitySmoothCutoutShader; - @Nullable - private static ShaderInstance rendertypeBeaconBeamShader; - @Nullable - private static ShaderInstance rendertypeEntityDecalShader; - @Nullable - private static ShaderInstance rendertypeEntityNoOutlineShader; - @Nullable - private static ShaderInstance rendertypeEntityShadowShader; - @Nullable - private static ShaderInstance rendertypeEntityAlphaShader; - @Nullable - private static ShaderInstance rendertypeEyesShader; - @Nullable - private static ShaderInstance rendertypeEnergySwirlShader; - @Nullable - private static ShaderInstance rendertypeBreezeWindShader; - @Nullable - private static ShaderInstance rendertypeLeashShader; - @Nullable - private static ShaderInstance rendertypeWaterMaskShader; - @Nullable - private static ShaderInstance rendertypeOutlineShader; - @Nullable - private static ShaderInstance rendertypeArmorGlintShader; - @Nullable - private static ShaderInstance rendertypeArmorEntityGlintShader; - @Nullable - private static ShaderInstance rendertypeGlintTranslucentShader; - @Nullable - private static ShaderInstance rendertypeGlintShader; - @Nullable - private static ShaderInstance rendertypeGlintDirectShader; - @Nullable - private static ShaderInstance rendertypeEntityGlintShader; - @Nullable - private static ShaderInstance rendertypeEntityGlintDirectShader; - @Nullable - private static ShaderInstance rendertypeTextShader; - @Nullable - private static ShaderInstance rendertypeTextBackgroundShader; - @Nullable - private static ShaderInstance rendertypeTextIntensityShader; - @Nullable - private static ShaderInstance rendertypeTextSeeThroughShader; - @Nullable - private static ShaderInstance rendertypeTextBackgroundSeeThroughShader; - @Nullable - private static ShaderInstance rendertypeTextIntensitySeeThroughShader; - @Nullable - private static ShaderInstance rendertypeLightningShader; - @Nullable - private static ShaderInstance rendertypeTripwireShader; - @Nullable - private static ShaderInstance rendertypeEndPortalShader; - @Nullable - private static ShaderInstance rendertypeEndGatewayShader; - @Nullable - private static ShaderInstance rendertypeCloudsShader; - @Nullable - private static ShaderInstance rendertypeLinesShader; - @Nullable - private static ShaderInstance rendertypeCrumblingShader; - @Nullable - private static ShaderInstance rendertypeGuiShader; - @Nullable - private static ShaderInstance rendertypeGuiOverlayShader; - @Nullable - private static ShaderInstance rendertypeGuiTextHighlightShader; - @Nullable - private static ShaderInstance rendertypeGuiGhostRecipeOverlayShader; public GameRenderer(Minecraft minecraft, ItemInHandRenderer itemInHandRenderer, ResourceManager resourceManager, RenderBuffers renderBuffers) { this.minecraft = minecraft; this.resourceManager = resourceManager; this.itemInHandRenderer = itemInHandRenderer; - this.mapRenderer = new MapRenderer(minecraft.getTextureManager(), minecraft.getMapDecorationTextures()); this.lightTexture = new LightTexture(this, minecraft); this.renderBuffers = renderBuffers; - this.postEffect = null; } public void close() { this.lightTexture.close(); - this.mapRenderer.close(); this.overlayTexture.close(); - this.shutdownEffect(); - this.shutdownShaders(); - if (this.blurEffect != null) { - this.blurEffect.close(); - } - - if (this.blitShader != null) { - this.blitShader.close(); - } + this.resourcePool.close(); } public void setRenderHand(boolean renderHand) { @@ -288,12 +144,8 @@ public class GameRenderer implements AutoCloseable { return this.panoramicMode; } - public void shutdownEffect() { - if (this.postEffect != null) { - this.postEffect.close(); - } - - this.postEffect = null; + public void clearPostEffect() { + this.postEffectId = null; } public void togglePostEffect() { @@ -304,480 +156,42 @@ public class GameRenderer implements AutoCloseable { * What shader to use when spectating this entity */ public void checkEntityPostEffect(@Nullable Entity entity) { - if (this.postEffect != null) { - this.postEffect.close(); - } - - this.postEffect = null; + this.postEffectId = null; if (entity instanceof Creeper) { - this.loadEffect(ResourceLocation.withDefaultNamespace("shaders/post/creeper.json")); + this.setPostEffect(ResourceLocation.withDefaultNamespace("creeper")); } else if (entity instanceof Spider) { - this.loadEffect(ResourceLocation.withDefaultNamespace("shaders/post/spider.json")); + this.setPostEffect(ResourceLocation.withDefaultNamespace("spider")); } else if (entity instanceof EnderMan) { - this.loadEffect(ResourceLocation.withDefaultNamespace("shaders/post/invert.json")); + this.setPostEffect(ResourceLocation.withDefaultNamespace("invert")); } } - private void loadEffect(ResourceLocation resourceLocation) { - if (this.postEffect != null) { - this.postEffect.close(); - } - - try { - this.postEffect = new PostChain(this.minecraft.getTextureManager(), this.resourceManager, this.minecraft.getMainRenderTarget(), resourceLocation); - this.postEffect.resize(this.minecraft.getWindow().getWidth(), this.minecraft.getWindow().getHeight()); - this.effectActive = true; - } catch (IOException var3) { - LOGGER.warn("Failed to load shader: {}", resourceLocation, var3); - this.effectActive = false; - } catch (JsonSyntaxException var4) { - LOGGER.warn("Failed to parse shader: {}", resourceLocation, var4); - this.effectActive = false; - } + private void setPostEffect(ResourceLocation resourceLocation) { + this.postEffectId = resourceLocation; + this.effectActive = true; } - private void loadBlurEffect(ResourceProvider resourceProvider) { - if (this.blurEffect != null) { - this.blurEffect.close(); - } - - try { - this.blurEffect = new PostChain(this.minecraft.getTextureManager(), resourceProvider, this.minecraft.getMainRenderTarget(), BLUR_LOCATION); - this.blurEffect.resize(this.minecraft.getWindow().getWidth(), this.minecraft.getWindow().getHeight()); - } catch (IOException var3) { - LOGGER.warn("Failed to load shader: {}", BLUR_LOCATION, var3); - } catch (JsonSyntaxException var4) { - LOGGER.warn("Failed to parse shader: {}", BLUR_LOCATION, var4); - } - } - - public void processBlurEffect(float partialTick) { + public void processBlurEffect() { float f = this.minecraft.options.getMenuBackgroundBlurriness(); - if (this.blurEffect != null && f >= 1.0F) { - this.blurEffect.setUniform("Radius", f); - this.blurEffect.process(partialTick); + if (!(f < 1.0F)) { + PostChain postChain = this.minecraft.getShaderManager().getPostChain(BLUR_POST_CHAIN_ID, LevelTargetBundle.MAIN_TARGETS); + if (postChain != null) { + postChain.setUniform("Radius", f); + postChain.process(this.minecraft.getMainRenderTarget(), this.resourcePool); + } } } - public PreparableReloadListener createReloadListener() { - return new SimplePreparableReloadListener() { - protected GameRenderer.ResourceCache prepare(ResourceManager resourceManager, ProfilerFiller profilerFiller) { - Map map = resourceManager.listResources( - "shaders", - resourceLocation -> { - String string = resourceLocation.getPath(); - return string.endsWith(".json") - || string.endsWith(Program.Type.FRAGMENT.getExtension()) - || string.endsWith(Program.Type.VERTEX.getExtension()) - || string.endsWith(".glsl"); - } - ); - Map map2 = new HashMap(); - map.forEach((resourceLocation, resource) -> { - try { - InputStream inputStream = resource.open(); - - try { - byte[] bs = inputStream.readAllBytes(); - map2.put(resourceLocation, new Resource(resource.source(), () -> new ByteArrayInputStream(bs))); - } catch (Throwable var7) { - if (inputStream != null) { - try { - inputStream.close(); - } catch (Throwable var6) { - var7.addSuppressed(var6); - } - } - - throw var7; - } - - if (inputStream != null) { - inputStream.close(); - } - } catch (Exception var8) { - GameRenderer.LOGGER.warn("Failed to read resource {}", resourceLocation, var8); - } - }); - return new GameRenderer.ResourceCache(resourceManager, map2); - } - - protected void apply(GameRenderer.ResourceCache resourceCache, ResourceManager resourceManager, ProfilerFiller profilerFiller) { - GameRenderer.this.reloadShaders(resourceCache); - if (GameRenderer.this.postEffect != null) { - GameRenderer.this.postEffect.close(); - } - - GameRenderer.this.postEffect = null; - GameRenderer.this.checkEntityPostEffect(GameRenderer.this.minecraft.getCameraEntity()); - } - - @Override - public String getName() { - return "Shader Loader"; - } - }; - } - public void preloadUiShader(ResourceProvider resourceProvider) { - if (this.blitShader != null) { - throw new RuntimeException("Blit shader already preloaded"); - } else { - try { - this.blitShader = new ShaderInstance(resourceProvider, "blit_screen", DefaultVertexFormat.BLIT_SCREEN); - } catch (IOException var3) { - throw new RuntimeException("could not preload blit shader", var3); - } - - rendertypeGuiShader = this.preloadShader(resourceProvider, "rendertype_gui", DefaultVertexFormat.POSITION_COLOR); - rendertypeGuiOverlayShader = this.preloadShader(resourceProvider, "rendertype_gui_overlay", DefaultVertexFormat.POSITION_COLOR); - positionShader = this.preloadShader(resourceProvider, "position", DefaultVertexFormat.POSITION); - positionColorShader = this.preloadShader(resourceProvider, "position_color", DefaultVertexFormat.POSITION_COLOR); - positionTexShader = this.preloadShader(resourceProvider, "position_tex", DefaultVertexFormat.POSITION_TEX); - positionTexColorShader = this.preloadShader(resourceProvider, "position_tex_color", DefaultVertexFormat.POSITION_TEX_COLOR); - rendertypeTextShader = this.preloadShader(resourceProvider, "rendertype_text", DefaultVertexFormat.POSITION_COLOR_TEX_LIGHTMAP); - } - } - - private ShaderInstance preloadShader(ResourceProvider resourceProvider, String name, VertexFormat format) { try { - ShaderInstance shaderInstance = new ShaderInstance(resourceProvider, name, format); - this.shaders.put(name, shaderInstance); - return shaderInstance; - } catch (Exception var5) { - throw new IllegalStateException("could not preload shader " + name, var5); + this.minecraft + .getShaderManager() + .preloadForStartup(resourceProvider, CoreShaders.RENDERTYPE_GUI, CoreShaders.RENDERTYPE_GUI_OVERLAY, CoreShaders.POSITION_TEX_COLOR); + } catch (ShaderManager.CompilationException | IOException var3) { + throw new RuntimeException("Could not preload shaders for loading UI", var3); } } - void reloadShaders(ResourceProvider resourceProvider) { - RenderSystem.assertOnRenderThread(); - List list = Lists.newArrayList(); - list.addAll(Program.Type.FRAGMENT.getPrograms().values()); - list.addAll(Program.Type.VERTEX.getPrograms().values()); - list.forEach(Program::close); - List>> list2 = Lists.>>newArrayListWithCapacity( - this.shaders.size() - ); - - try { - list2.add(Pair.of(new ShaderInstance(resourceProvider, "particle", DefaultVertexFormat.PARTICLE), shaderInstance -> particleShader = shaderInstance)); - list2.add(Pair.of(new ShaderInstance(resourceProvider, "position", DefaultVertexFormat.POSITION), shaderInstance -> positionShader = shaderInstance)); - list2.add( - Pair.of(new ShaderInstance(resourceProvider, "position_color", DefaultVertexFormat.POSITION_COLOR), shaderInstance -> positionColorShader = shaderInstance) - ); - list2.add( - Pair.of( - new ShaderInstance(resourceProvider, "position_color_lightmap", DefaultVertexFormat.POSITION_COLOR_LIGHTMAP), - shaderInstance -> positionColorLightmapShader = shaderInstance - ) - ); - list2.add( - Pair.of( - new ShaderInstance(resourceProvider, "position_color_tex_lightmap", DefaultVertexFormat.POSITION_COLOR_TEX_LIGHTMAP), - shaderInstance -> positionColorTexLightmapShader = shaderInstance - ) - ); - list2.add( - Pair.of(new ShaderInstance(resourceProvider, "position_tex", DefaultVertexFormat.POSITION_TEX), shaderInstance -> positionTexShader = shaderInstance) - ); - list2.add( - Pair.of( - new ShaderInstance(resourceProvider, "position_tex_color", DefaultVertexFormat.POSITION_TEX_COLOR), - shaderInstance -> positionTexColorShader = shaderInstance - ) - ); - list2.add( - Pair.of(new ShaderInstance(resourceProvider, "rendertype_solid", DefaultVertexFormat.BLOCK), shaderInstance -> rendertypeSolidShader = shaderInstance) - ); - list2.add( - Pair.of( - new ShaderInstance(resourceProvider, "rendertype_cutout_mipped", DefaultVertexFormat.BLOCK), - shaderInstance -> rendertypeCutoutMippedShader = shaderInstance - ) - ); - list2.add( - Pair.of(new ShaderInstance(resourceProvider, "rendertype_cutout", DefaultVertexFormat.BLOCK), shaderInstance -> rendertypeCutoutShader = shaderInstance) - ); - list2.add( - Pair.of( - new ShaderInstance(resourceProvider, "rendertype_translucent", DefaultVertexFormat.BLOCK), shaderInstance -> rendertypeTranslucentShader = shaderInstance - ) - ); - list2.add( - Pair.of( - new ShaderInstance(resourceProvider, "rendertype_translucent_moving_block", DefaultVertexFormat.BLOCK), - shaderInstance -> rendertypeTranslucentMovingBlockShader = shaderInstance - ) - ); - list2.add( - Pair.of( - new ShaderInstance(resourceProvider, "rendertype_armor_cutout_no_cull", DefaultVertexFormat.NEW_ENTITY), - shaderInstance -> rendertypeArmorCutoutNoCullShader = shaderInstance - ) - ); - list2.add( - Pair.of( - new ShaderInstance(resourceProvider, "rendertype_entity_solid", DefaultVertexFormat.NEW_ENTITY), - shaderInstance -> rendertypeEntitySolidShader = shaderInstance - ) - ); - list2.add( - Pair.of( - new ShaderInstance(resourceProvider, "rendertype_entity_cutout", DefaultVertexFormat.NEW_ENTITY), - shaderInstance -> rendertypeEntityCutoutShader = shaderInstance - ) - ); - list2.add( - Pair.of( - new ShaderInstance(resourceProvider, "rendertype_entity_cutout_no_cull", DefaultVertexFormat.NEW_ENTITY), - shaderInstance -> rendertypeEntityCutoutNoCullShader = shaderInstance - ) - ); - list2.add( - Pair.of( - new ShaderInstance(resourceProvider, "rendertype_entity_cutout_no_cull_z_offset", DefaultVertexFormat.NEW_ENTITY), - shaderInstance -> rendertypeEntityCutoutNoCullZOffsetShader = shaderInstance - ) - ); - list2.add( - Pair.of( - new ShaderInstance(resourceProvider, "rendertype_item_entity_translucent_cull", DefaultVertexFormat.NEW_ENTITY), - shaderInstance -> rendertypeItemEntityTranslucentCullShader = shaderInstance - ) - ); - list2.add( - Pair.of( - new ShaderInstance(resourceProvider, "rendertype_entity_translucent_cull", DefaultVertexFormat.NEW_ENTITY), - shaderInstance -> rendertypeEntityTranslucentCullShader = shaderInstance - ) - ); - list2.add( - Pair.of( - new ShaderInstance(resourceProvider, "rendertype_entity_translucent", DefaultVertexFormat.NEW_ENTITY), - shaderInstance -> rendertypeEntityTranslucentShader = shaderInstance - ) - ); - list2.add( - Pair.of( - new ShaderInstance(resourceProvider, "rendertype_entity_translucent_emissive", DefaultVertexFormat.NEW_ENTITY), - shaderInstance -> rendertypeEntityTranslucentEmissiveShader = shaderInstance - ) - ); - list2.add( - Pair.of( - new ShaderInstance(resourceProvider, "rendertype_entity_smooth_cutout", DefaultVertexFormat.NEW_ENTITY), - shaderInstance -> rendertypeEntitySmoothCutoutShader = shaderInstance - ) - ); - list2.add( - Pair.of( - new ShaderInstance(resourceProvider, "rendertype_beacon_beam", DefaultVertexFormat.BLOCK), shaderInstance -> rendertypeBeaconBeamShader = shaderInstance - ) - ); - list2.add( - Pair.of( - new ShaderInstance(resourceProvider, "rendertype_entity_decal", DefaultVertexFormat.NEW_ENTITY), - shaderInstance -> rendertypeEntityDecalShader = shaderInstance - ) - ); - list2.add( - Pair.of( - new ShaderInstance(resourceProvider, "rendertype_entity_no_outline", DefaultVertexFormat.NEW_ENTITY), - shaderInstance -> rendertypeEntityNoOutlineShader = shaderInstance - ) - ); - list2.add( - Pair.of( - new ShaderInstance(resourceProvider, "rendertype_entity_shadow", DefaultVertexFormat.NEW_ENTITY), - shaderInstance -> rendertypeEntityShadowShader = shaderInstance - ) - ); - list2.add( - Pair.of( - new ShaderInstance(resourceProvider, "rendertype_entity_alpha", DefaultVertexFormat.NEW_ENTITY), - shaderInstance -> rendertypeEntityAlphaShader = shaderInstance - ) - ); - list2.add( - Pair.of(new ShaderInstance(resourceProvider, "rendertype_eyes", DefaultVertexFormat.NEW_ENTITY), shaderInstance -> rendertypeEyesShader = shaderInstance) - ); - list2.add( - Pair.of( - new ShaderInstance(resourceProvider, "rendertype_energy_swirl", DefaultVertexFormat.NEW_ENTITY), - shaderInstance -> rendertypeEnergySwirlShader = shaderInstance - ) - ); - list2.add( - Pair.of( - new ShaderInstance(resourceProvider, "rendertype_leash", DefaultVertexFormat.POSITION_COLOR_LIGHTMAP), - shaderInstance -> rendertypeLeashShader = shaderInstance - ) - ); - list2.add( - Pair.of( - new ShaderInstance(resourceProvider, "rendertype_water_mask", DefaultVertexFormat.POSITION), shaderInstance -> rendertypeWaterMaskShader = shaderInstance - ) - ); - list2.add( - Pair.of( - new ShaderInstance(resourceProvider, "rendertype_outline", DefaultVertexFormat.POSITION_TEX_COLOR), - shaderInstance -> rendertypeOutlineShader = shaderInstance - ) - ); - list2.add( - Pair.of( - new ShaderInstance(resourceProvider, "rendertype_armor_entity_glint", DefaultVertexFormat.POSITION_TEX), - shaderInstance -> rendertypeArmorEntityGlintShader = shaderInstance - ) - ); - list2.add( - Pair.of( - new ShaderInstance(resourceProvider, "rendertype_glint_translucent", DefaultVertexFormat.POSITION_TEX), - shaderInstance -> rendertypeGlintTranslucentShader = shaderInstance - ) - ); - list2.add( - Pair.of( - new ShaderInstance(resourceProvider, "rendertype_glint", DefaultVertexFormat.POSITION_TEX), shaderInstance -> rendertypeGlintShader = shaderInstance - ) - ); - list2.add( - Pair.of( - new ShaderInstance(resourceProvider, "rendertype_entity_glint", DefaultVertexFormat.POSITION_TEX), - shaderInstance -> rendertypeEntityGlintShader = shaderInstance - ) - ); - list2.add( - Pair.of( - new ShaderInstance(resourceProvider, "rendertype_entity_glint_direct", DefaultVertexFormat.POSITION_TEX), - shaderInstance -> rendertypeEntityGlintDirectShader = shaderInstance - ) - ); - list2.add( - Pair.of( - new ShaderInstance(resourceProvider, "rendertype_text", DefaultVertexFormat.POSITION_COLOR_TEX_LIGHTMAP), - shaderInstance -> rendertypeTextShader = shaderInstance - ) - ); - list2.add( - Pair.of( - new ShaderInstance(resourceProvider, "rendertype_text_background", DefaultVertexFormat.POSITION_COLOR_LIGHTMAP), - shaderInstance -> rendertypeTextBackgroundShader = shaderInstance - ) - ); - list2.add( - Pair.of( - new ShaderInstance(resourceProvider, "rendertype_text_intensity", DefaultVertexFormat.POSITION_COLOR_TEX_LIGHTMAP), - shaderInstance -> rendertypeTextIntensityShader = shaderInstance - ) - ); - list2.add( - Pair.of( - new ShaderInstance(resourceProvider, "rendertype_text_see_through", DefaultVertexFormat.POSITION_COLOR_TEX_LIGHTMAP), - shaderInstance -> rendertypeTextSeeThroughShader = shaderInstance - ) - ); - list2.add( - Pair.of( - new ShaderInstance(resourceProvider, "rendertype_text_background_see_through", DefaultVertexFormat.POSITION_COLOR_LIGHTMAP), - shaderInstance -> rendertypeTextBackgroundSeeThroughShader = shaderInstance - ) - ); - list2.add( - Pair.of( - new ShaderInstance(resourceProvider, "rendertype_text_intensity_see_through", DefaultVertexFormat.POSITION_COLOR_TEX_LIGHTMAP), - shaderInstance -> rendertypeTextIntensitySeeThroughShader = shaderInstance - ) - ); - list2.add( - Pair.of( - new ShaderInstance(resourceProvider, "rendertype_lightning", DefaultVertexFormat.POSITION_COLOR), - shaderInstance -> rendertypeLightningShader = shaderInstance - ) - ); - list2.add( - Pair.of(new ShaderInstance(resourceProvider, "rendertype_tripwire", DefaultVertexFormat.BLOCK), shaderInstance -> rendertypeTripwireShader = shaderInstance) - ); - list2.add( - Pair.of( - new ShaderInstance(resourceProvider, "rendertype_end_portal", DefaultVertexFormat.POSITION), shaderInstance -> rendertypeEndPortalShader = shaderInstance - ) - ); - list2.add( - Pair.of( - new ShaderInstance(resourceProvider, "rendertype_end_gateway", DefaultVertexFormat.POSITION), - shaderInstance -> rendertypeEndGatewayShader = shaderInstance - ) - ); - list2.add( - Pair.of( - new ShaderInstance(resourceProvider, "rendertype_clouds", DefaultVertexFormat.POSITION_TEX_COLOR_NORMAL), - shaderInstance -> rendertypeCloudsShader = shaderInstance - ) - ); - list2.add( - Pair.of( - new ShaderInstance(resourceProvider, "rendertype_lines", DefaultVertexFormat.POSITION_COLOR_NORMAL), - shaderInstance -> rendertypeLinesShader = shaderInstance - ) - ); - list2.add( - Pair.of( - new ShaderInstance(resourceProvider, "rendertype_crumbling", DefaultVertexFormat.BLOCK), shaderInstance -> rendertypeCrumblingShader = shaderInstance - ) - ); - list2.add( - Pair.of(new ShaderInstance(resourceProvider, "rendertype_gui", DefaultVertexFormat.POSITION_COLOR), shaderInstance -> rendertypeGuiShader = shaderInstance) - ); - list2.add( - Pair.of( - new ShaderInstance(resourceProvider, "rendertype_gui_overlay", DefaultVertexFormat.POSITION_COLOR), - shaderInstance -> rendertypeGuiOverlayShader = shaderInstance - ) - ); - list2.add( - Pair.of( - new ShaderInstance(resourceProvider, "rendertype_gui_text_highlight", DefaultVertexFormat.POSITION_COLOR), - shaderInstance -> rendertypeGuiTextHighlightShader = shaderInstance - ) - ); - list2.add( - Pair.of( - new ShaderInstance(resourceProvider, "rendertype_gui_ghost_recipe_overlay", DefaultVertexFormat.POSITION_COLOR), - shaderInstance -> rendertypeGuiGhostRecipeOverlayShader = shaderInstance - ) - ); - list2.add( - Pair.of( - new ShaderInstance(resourceProvider, "rendertype_breeze_wind", DefaultVertexFormat.NEW_ENTITY), - shaderInstance -> rendertypeBreezeWindShader = shaderInstance - ) - ); - this.loadBlurEffect(resourceProvider); - } catch (IOException var5) { - list2.forEach(pair -> ((ShaderInstance)pair.getFirst()).close()); - throw new RuntimeException("could not reload shaders", var5); - } - - this.shutdownShaders(); - list2.forEach(pair -> { - ShaderInstance shaderInstance = (ShaderInstance)pair.getFirst(); - this.shaders.put(shaderInstance.getName(), shaderInstance); - ((Consumer)pair.getSecond()).accept(shaderInstance); - }); - } - - private void shutdownShaders() { - RenderSystem.assertOnRenderThread(); - this.shaders.values().forEach(ShaderInstance::close); - this.shaders.clear(); - } - - @Nullable - public ShaderInstance getShader(@Nullable String name) { - return name == null ? null : (ShaderInstance)this.shaders.get(name); - } - /** * Updates the entity renderer */ @@ -792,7 +206,7 @@ public class GameRenderer implements AutoCloseable { this.itemInHandRenderer.tick(); this.confusionAnimationTick++; if (this.minecraft.level.tickRateManager().runsNormally()) { - this.minecraft.levelRenderer.tickRain(this.mainCamera); + this.minecraft.levelRenderer.tickParticles(this.mainCamera); this.darkenWorldAmountO = this.darkenWorldAmount; if (this.minecraft.gui.getBossOverlay().shouldDarkenScreen()) { this.darkenWorldAmount += 0.05F; @@ -813,19 +227,12 @@ public class GameRenderer implements AutoCloseable { } @Nullable - public PostChain currentEffect() { - return this.postEffect; + public ResourceLocation currentPostEffect() { + return this.postEffectId; } public void resize(int width, int height) { - if (this.postEffect != null) { - this.postEffect.resize(width, height); - } - - if (this.blurEffect != null) { - this.blurEffect.resize(width, height); - } - + this.resourcePool.clear(); this.minecraft.levelRenderer.resize(width, height); } @@ -836,13 +243,13 @@ public class GameRenderer implements AutoCloseable { Entity entity = this.minecraft.getCameraEntity(); if (entity != null) { if (this.minecraft.level != null && this.minecraft.player != null) { - this.minecraft.getProfiler().push("pick"); + Profiler.get().push("pick"); double d = this.minecraft.player.blockInteractionRange(); double e = this.minecraft.player.entityInteractionRange(); HitResult hitResult = this.pick(entity, d, e, partialTicks); this.minecraft.hitResult = hitResult; this.minecraft.crosshairPickEntity = hitResult instanceof EntityHitResult entityHitResult ? entityHitResult.getEntity() : null; - this.minecraft.getProfiler().pop(); + Profiler.get().pop(); } } } @@ -853,7 +260,7 @@ public class GameRenderer implements AutoCloseable { Vec3 vec3 = entity.getEyePosition(partialTick); HitResult hitResult = entity.pick(d, partialTick, false); double f = hitResult.getLocation().distanceToSqr(vec3); - if (hitResult.getType() != HitResult.Type.MISS) { + if (hitResult.getType() != Type.MISS) { e = f; d = Math.sqrt(f); } @@ -862,7 +269,7 @@ public class GameRenderer implements AutoCloseable { Vec3 vec33 = vec3.add(vec32.x * d, vec32.y * d, vec32.z * d); float g = 1.0F; AABB aABB = entity.getBoundingBox().expandTowards(vec32.scale(d)).inflate(1.0, 1.0, 1.0); - EntityHitResult entityHitResult = ProjectileUtil.getEntityHitResult(entity, vec3, vec33, aABB, entityx -> !entityx.isSpectator() && entityx.isPickable(), e); + EntityHitResult entityHitResult = ProjectileUtil.getEntityHitResult(entity, vec3, vec33, aABB, EntitySelector.CAN_BE_PICKED, e); return entityHitResult != null && entityHitResult.getLocation().distanceToSqr(vec3) < f ? filterHitResult(entityHitResult, vec3, entityInteractionRange) : filterHitResult(hitResult, vec3, blockInteractionRange); @@ -872,7 +279,7 @@ public class GameRenderer implements AutoCloseable { Vec3 vec3 = hitResult.getLocation(); if (!vec3.closerThan(pos, blockInteractionRange)) { Vec3 vec32 = hitResult.getLocation(); - Direction direction = Direction.getNearest(vec32.x - pos.x, vec32.y - pos.y, vec32.z - pos.z); + Direction direction = Direction.getApproximateNearest(vec32.x - pos.x, vec32.y - pos.y, vec32.z - pos.z); return BlockHitResult.miss(vec32, direction, BlockPos.containing(vec32)); } else { return hitResult; @@ -883,43 +290,43 @@ public class GameRenderer implements AutoCloseable { * Update FOV modifier hand */ private void tickFov() { - float f = 1.0F; + float g; if (this.minecraft.getCameraEntity() instanceof AbstractClientPlayer abstractClientPlayer) { - f = abstractClientPlayer.getFieldOfViewModifier(); + Options options = this.minecraft.options; + boolean bl = options.getCameraType().isFirstPerson(); + float f = options.fovEffectScale().get().floatValue(); + g = abstractClientPlayer.getFieldOfViewModifier(bl, f); + } else { + g = 1.0F; } - this.oldFov = this.fov; - this.fov = this.fov + (f - this.fov) * 0.5F; - if (this.fov > 1.5F) { - this.fov = 1.5F; - } - - if (this.fov < 0.1F) { - this.fov = 0.1F; - } + this.oldFovModifier = this.fovModifier; + this.fovModifier = this.fovModifier + (g - this.fovModifier) * 0.5F; + this.fovModifier = Mth.clamp(this.fovModifier, 0.1F, 1.5F); } - private double getFov(Camera activeRenderInfo, float partialTicks, boolean useFOVSetting) { + private float getFov(Camera camera, float f, boolean bl) { if (this.panoramicMode) { - return 90.0; + return 90.0F; } else { - double d = 70.0; - if (useFOVSetting) { - d = this.minecraft.options.fov().get().intValue(); - d *= Mth.lerp(partialTicks, this.oldFov, this.fov); + float g = 70.0F; + if (bl) { + g = this.minecraft.options.fov().get().intValue(); + g *= Mth.lerp(f, this.oldFovModifier, this.fovModifier); } - if (activeRenderInfo.getEntity() instanceof LivingEntity && ((LivingEntity)activeRenderInfo.getEntity()).isDeadOrDying()) { - float f = Math.min(((LivingEntity)activeRenderInfo.getEntity()).deathTime + partialTicks, 20.0F); - d /= (1.0F - 500.0F / (f + 500.0F)) * 2.0F + 1.0F; + if (camera.getEntity() instanceof LivingEntity livingEntity && livingEntity.isDeadOrDying()) { + float h = Math.min(livingEntity.deathTime + f, 20.0F); + g /= (1.0F - 500.0F / (h + 500.0F)) * 2.0F + 1.0F; } - FogType fogType = activeRenderInfo.getFluidInCamera(); + FogType fogType = camera.getFluidInCamera(); if (fogType == FogType.LAVA || fogType == FogType.WATER) { - d *= Mth.lerp(this.minecraft.options.fovEffectScale().get(), 1.0, 0.85714287F); + float h = this.minecraft.options.fovEffectScale().get().floatValue(); + g *= Mth.lerp(h, 1.0F, 0.85714287F); } - return d; + return g; } } @@ -946,11 +353,10 @@ public class GameRenderer implements AutoCloseable { } private void bobView(PoseStack poseStack, float partialTicks) { - if (this.minecraft.getCameraEntity() instanceof Player) { - Player player = (Player)this.minecraft.getCameraEntity(); - float f = player.walkDist - player.walkDistO; - float g = -(player.walkDist + f * partialTicks); - float h = Mth.lerp(partialTicks, player.oBob, player.bob); + if (this.minecraft.getCameraEntity() instanceof AbstractClientPlayer abstractClientPlayer) { + float var7 = abstractClientPlayer.walkDist - abstractClientPlayer.walkDistO; + float g = -(abstractClientPlayer.walkDist + var7 * partialTicks); + float h = Mth.lerp(partialTicks, abstractClientPlayer.oBob, abstractClientPlayer.bob); poseStack.translate(Mth.sin(g * (float) Math.PI) * h * 0.5F, -Math.abs(Mth.cos(g * (float) Math.PI) * h), 0.0F); poseStack.mulPose(Axis.ZP.rotationDegrees(Mth.sin(g * (float) Math.PI) * h * 3.0F)); poseStack.mulPose(Axis.XP.rotationDegrees(Math.abs(Mth.cos(g * (float) Math.PI - 0.2F) * h) * 5.0F)); @@ -969,13 +375,13 @@ public class GameRenderer implements AutoCloseable { private void renderItemInHand(Camera camera, float partialTick, Matrix4f projectionMatrix) { if (!this.panoramicMode) { - this.resetProjectionMatrix(this.getProjectionMatrix(this.getFov(camera, partialTick, false))); + Matrix4f matrix4f = this.getProjectionMatrix(this.getFov(camera, partialTick, false)); + RenderSystem.setProjectionMatrix(matrix4f, ProjectionType.PERSPECTIVE); PoseStack poseStack = new PoseStack(); poseStack.pushPose(); poseStack.mulPose(projectionMatrix.invert(new Matrix4f())); Matrix4fStack matrix4fStack = RenderSystem.getModelViewStack(); matrix4fStack.pushMatrix().mul(projectionMatrix); - RenderSystem.applyModelViewMatrix(); this.bobHurt(poseStack, partialTick); if (this.minecraft.options.bobView().get()) { this.bobView(poseStack, partialTick); @@ -999,7 +405,6 @@ public class GameRenderer implements AutoCloseable { } matrix4fStack.popMatrix(); - RenderSystem.applyModelViewMatrix(); poseStack.popPose(); if (this.minecraft.options.getCameraType().isFirstPerson() && !bl) { ScreenEffectRenderer.renderScreenEffect(this.minecraft, poseStack); @@ -1007,11 +412,7 @@ public class GameRenderer implements AutoCloseable { } } - public void resetProjectionMatrix(Matrix4f matrix) { - RenderSystem.setProjectionMatrix(matrix, VertexSorting.DISTANCE_TO_ORIGIN); - } - - public Matrix4f getProjectionMatrix(double fov) { + public Matrix4f getProjectionMatrix(float f) { Matrix4f matrix4f = new Matrix4f(); if (this.zoom != 1.0F) { matrix4f.translate(this.zoomX, -this.zoomY, 0.0F); @@ -1019,7 +420,7 @@ public class GameRenderer implements AutoCloseable { } return matrix4f.perspective( - (float)(fov * (float) (Math.PI / 180.0)), (float)this.minecraft.getWindow().getWidth() / this.minecraft.getWindow().getHeight(), 0.05F, this.getDepthFar() + f * (float) (Math.PI / 180.0), (float)this.minecraft.getWindow().getWidth() / this.minecraft.getWindow().getHeight(), 0.05F, this.getDepthFar() ); } @@ -1044,71 +445,65 @@ public class GameRenderer implements AutoCloseable { } if (!this.minecraft.noRender) { + ProfilerFiller profilerFiller = Profiler.get(); boolean bl = this.minecraft.isGameLoadFinished(); int i = (int)(this.minecraft.mouseHandler.xpos() * this.minecraft.getWindow().getGuiScaledWidth() / this.minecraft.getWindow().getScreenWidth()); int j = (int)(this.minecraft.mouseHandler.ypos() * this.minecraft.getWindow().getGuiScaledHeight() / this.minecraft.getWindow().getScreenHeight()); RenderSystem.viewport(0, 0, this.minecraft.getWindow().getWidth(), this.minecraft.getWindow().getHeight()); if (bl && renderLevel && this.minecraft.level != null) { - this.minecraft.getProfiler().push("level"); + profilerFiller.push("level"); this.renderLevel(deltaTracker); this.tryTakeScreenshotIfNeeded(); this.minecraft.levelRenderer.doEntityOutline(); - if (this.postEffect != null && this.effectActive) { + if (this.postEffectId != null && this.effectActive) { RenderSystem.disableBlend(); RenderSystem.disableDepthTest(); RenderSystem.resetTextureMatrix(); - this.postEffect.process(deltaTracker.getGameTimeDeltaTicks()); + PostChain postChain = this.minecraft.getShaderManager().getPostChain(this.postEffectId, LevelTargetBundle.MAIN_TARGETS); + if (postChain != null) { + postChain.process(this.minecraft.getMainRenderTarget(), this.resourcePool); + } } this.minecraft.getMainRenderTarget().bindWrite(true); } Window window = this.minecraft.getWindow(); - RenderSystem.clear(256, Minecraft.ON_OSX); + RenderSystem.clear(256); Matrix4f matrix4f = new Matrix4f() .setOrtho(0.0F, (float)(window.getWidth() / window.getGuiScale()), (float)(window.getHeight() / window.getGuiScale()), 0.0F, 1000.0F, 21000.0F); - RenderSystem.setProjectionMatrix(matrix4f, VertexSorting.ORTHOGRAPHIC_Z); + RenderSystem.setProjectionMatrix(matrix4f, ProjectionType.ORTHOGRAPHIC); Matrix4fStack matrix4fStack = RenderSystem.getModelViewStack(); matrix4fStack.pushMatrix(); matrix4fStack.translation(0.0F, 0.0F, -11000.0F); - RenderSystem.applyModelViewMatrix(); Lighting.setupFor3DItems(); GuiGraphics guiGraphics = new GuiGraphics(this.minecraft, this.renderBuffers.bufferSource()); if (bl && renderLevel && this.minecraft.level != null) { - this.minecraft.getProfiler().popPush("gui"); - if (this.minecraft.player != null) { - float f = Mth.lerp( - deltaTracker.getGameTimeDeltaPartialTick(false), this.minecraft.player.oSpinningEffectIntensity, this.minecraft.player.spinningEffectIntensity - ); - float g = this.minecraft.options.screenEffectScale().get().floatValue(); - if (f > 0.0F && this.minecraft.player.hasEffect(MobEffects.CONFUSION) && g < 1.0F) { - this.renderConfusionOverlay(guiGraphics, f * (1.0F - g)); - } - } - + profilerFiller.popPush("gui"); if (!this.minecraft.options.hideGui) { this.renderItemActivationAnimation(guiGraphics, deltaTracker.getGameTimeDeltaPartialTick(false)); } this.minecraft.gui.render(guiGraphics, deltaTracker); - RenderSystem.clear(256, Minecraft.ON_OSX); - this.minecraft.getProfiler().pop(); + guiGraphics.flush(); + RenderSystem.clear(256); + profilerFiller.pop(); } if (this.minecraft.getOverlay() != null) { try { - this.minecraft.getOverlay().render(guiGraphics, i, j, deltaTracker.getRealtimeDeltaTicks()); - } catch (Throwable var15) { - CrashReport crashReport = CrashReport.forThrowable(var15, "Rendering overlay"); + this.minecraft.getOverlay().render(guiGraphics, i, j, deltaTracker.getGameTimeDeltaTicks()); + } catch (Throwable var17) { + CrashReport crashReport = CrashReport.forThrowable(var17, "Rendering overlay"); CrashReportCategory crashReportCategory = crashReport.addCategory("Overlay render details"); crashReportCategory.setDetail("Overlay name", (CrashReportDetail)(() -> this.minecraft.getOverlay().getClass().getCanonicalName())); throw new ReportedException(crashReport); } } else if (bl && this.minecraft.screen != null) { try { - this.minecraft.screen.renderWithTooltip(guiGraphics, i, j, deltaTracker.getRealtimeDeltaTicks()); - } catch (Throwable var14) { - CrashReport crashReport = CrashReport.forThrowable(var14, "Rendering screen"); + this.minecraft.screen.renderWithTooltip(guiGraphics, i, j, deltaTracker.getGameTimeDeltaTicks()); + } catch (Throwable var16) { + CrashReport crashReport = CrashReport.forThrowable(var16, "Rendering screen"); CrashReportCategory crashReportCategory = crashReport.addCategory("Screen render details"); crashReportCategory.setDetail("Screen name", (CrashReportDetail)(() -> this.minecraft.screen.getClass().getCanonicalName())); crashReportCategory.setDetail( @@ -1136,8 +531,8 @@ public class GameRenderer implements AutoCloseable { if (this.minecraft.screen != null) { this.minecraft.screen.handleDelayedNarration(); } - } catch (Throwable var13) { - CrashReport crashReport = CrashReport.forThrowable(var13, "Narrating screen"); + } catch (Throwable var15) { + CrashReport crashReport = CrashReport.forThrowable(var15, "Narrating screen"); CrashReportCategory crashReportCategory = crashReport.addCategory("Screen details"); crashReportCategory.setDetail("Screen name", (CrashReportDetail)(() -> this.minecraft.screen.getClass().getCanonicalName())); throw new ReportedException(crashReport); @@ -1149,14 +544,14 @@ public class GameRenderer implements AutoCloseable { } if (bl) { - this.minecraft.getProfiler().push("toasts"); - this.minecraft.getToasts().render(guiGraphics); - this.minecraft.getProfiler().pop(); + try (Zone zone = profilerFiller.zone("toasts")) { + this.minecraft.getToastManager().render(guiGraphics); + } } guiGraphics.flush(); matrix4fStack.popMatrix(); - RenderSystem.applyModelViewMatrix(); + this.resourcePool.endFrame(); } } @@ -1216,14 +611,14 @@ public class GameRenderer implements AutoCloseable { if (bl && !((Player)entity).getAbilities().mayBuild) { ItemStack itemStack = ((LivingEntity)entity).getMainHandItem(); HitResult hitResult = this.minecraft.hitResult; - if (hitResult != null && hitResult.getType() == HitResult.Type.BLOCK) { + if (hitResult != null && hitResult.getType() == Type.BLOCK) { BlockPos blockPos = ((BlockHitResult)hitResult).getBlockPos(); BlockState blockState = this.minecraft.level.getBlockState(blockPos); if (this.minecraft.gameMode.getPlayerMode() == GameType.SPECTATOR) { bl = blockState.getMenuProvider(this.minecraft.level, blockPos) != null; } else { BlockInWorld blockInWorld = new BlockInWorld(this.minecraft.level, blockPos, false); - Registry registry = this.minecraft.level.registryAccess().registryOrThrow(Registries.BLOCK); + Registry registry = this.minecraft.level.registryAccess().lookupOrThrow(Registries.BLOCK); bl = !itemStack.isEmpty() && (itemStack.canBreakBlockInAdventureMode(blockInWorld) || itemStack.canPlaceOnBlockInAdventureMode(blockInWorld)); } } @@ -1241,16 +636,17 @@ public class GameRenderer implements AutoCloseable { } this.pick(f); - this.minecraft.getProfiler().push("center"); + ProfilerFiller profilerFiller = Profiler.get(); + profilerFiller.push("center"); boolean bl = this.shouldRenderBlockOutline(); - this.minecraft.getProfiler().popPush("camera"); + profilerFiller.popPush("camera"); Camera camera = this.mainCamera; Entity entity = (Entity)(this.minecraft.getCameraEntity() == null ? this.minecraft.player : this.minecraft.getCameraEntity()); float g = this.minecraft.level.tickRateManager().isEntityFrozen(entity) ? 1.0F : f; camera.setup(this.minecraft.level, entity, !this.minecraft.options.getCameraType().isFirstPerson(), this.minecraft.options.getCameraType().isMirrored(), g); this.renderDistance = this.minecraft.options.getEffectiveRenderDistance() * 16; - double d = this.getFov(camera, f, true); - Matrix4f matrix4f = this.getProjectionMatrix(d); + float h = this.getFov(camera, f, true); + Matrix4f matrix4f = this.getProjectionMatrix(h); PoseStack poseStack = new PoseStack(); this.bobHurt(poseStack, camera.getPartialTickTime()); if (this.minecraft.options.bobView().get()) { @@ -1258,46 +654,43 @@ public class GameRenderer implements AutoCloseable { } matrix4f.mul(poseStack.last().pose()); - float h = this.minecraft.options.screenEffectScale().get().floatValue(); - float i = Mth.lerp(f, this.minecraft.player.oSpinningEffectIntensity, this.minecraft.player.spinningEffectIntensity) * (h * h); - if (i > 0.0F) { - int j = this.minecraft.player.hasEffect(MobEffects.CONFUSION) ? 7 : 20; - float k = 5.0F / (i * i + 5.0F) - i * 0.04F; - k *= k; + float i = this.minecraft.options.screenEffectScale().get().floatValue(); + float j = Mth.lerp(f, this.minecraft.player.oSpinningEffectIntensity, this.minecraft.player.spinningEffectIntensity) * (i * i); + if (j > 0.0F) { + int k = this.minecraft.player.hasEffect(MobEffects.CONFUSION) ? 7 : 20; + float l = 5.0F / (j * j + 5.0F) - j * 0.04F; + l *= l; Vector3f vector3f = new Vector3f(0.0F, Mth.SQRT_OF_TWO / 2.0F, Mth.SQRT_OF_TWO / 2.0F); - float l = (this.confusionAnimationTick + f) * j * (float) (Math.PI / 180.0); - matrix4f.rotate(l, vector3f); - matrix4f.scale(1.0F / k, 1.0F, 1.0F); - matrix4f.rotate(-l, vector3f); + float m = (this.confusionAnimationTick + f) * k * (float) (Math.PI / 180.0); + matrix4f.rotate(m, vector3f); + matrix4f.scale(1.0F / l, 1.0F, 1.0F); + matrix4f.rotate(-m, vector3f); } - this.resetProjectionMatrix(matrix4f); + float n = Math.max(h, this.minecraft.options.fov().get().intValue()); + Matrix4f matrix4f2 = this.getProjectionMatrix(n); + RenderSystem.setProjectionMatrix(matrix4f, ProjectionType.PERSPECTIVE); Quaternionf quaternionf = camera.rotation().conjugate(new Quaternionf()); - Matrix4f matrix4f2 = new Matrix4f().rotation(quaternionf); - this.minecraft - .levelRenderer - .prepareCullFrustum(camera.getPosition(), matrix4f2, this.getProjectionMatrix(Math.max(d, this.minecraft.options.fov().get().intValue()))); - this.minecraft.levelRenderer.renderLevel(deltaTracker, bl, camera, this, this.lightTexture, matrix4f2, matrix4f); - this.minecraft.getProfiler().popPush("hand"); + Matrix4f matrix4f3 = new Matrix4f().rotation(quaternionf); + this.minecraft.levelRenderer.prepareCullFrustum(camera.getPosition(), matrix4f3, matrix4f2); + this.minecraft.getMainRenderTarget().bindWrite(true); + this.minecraft.levelRenderer.renderLevel(this.resourcePool, deltaTracker, bl, camera, this, this.lightTexture, matrix4f3, matrix4f); + profilerFiller.popPush("hand"); if (this.renderHand) { - RenderSystem.clear(256, Minecraft.ON_OSX); - this.renderItemInHand(camera, f, matrix4f2); + RenderSystem.clear(256); + this.renderItemInHand(camera, f, matrix4f3); } - this.minecraft.getProfiler().pop(); + profilerFiller.pop(); } public void resetData() { this.itemActivationItem = null; - this.mapRenderer.resetData(); + this.minecraft.getMapTextureManager().resetData(); this.mainCamera.reset(); this.hasWorldScreenshot = false; } - public MapRenderer getMapRenderer() { - return this.mapRenderer; - } - public void displayItemActivation(ItemStack stack) { this.itemActivationItem = stack; this.itemActivationTicks = 40; @@ -1315,7 +708,7 @@ public class GameRenderer implements AutoCloseable { float k = j * (float) Math.PI; float l = this.itemActivationOffX * (guiGraphics.guiWidth() / 4); float m = this.itemActivationOffY * (guiGraphics.guiHeight() / 4); - PoseStack poseStack = new PoseStack(); + PoseStack poseStack = guiGraphics.pose(); poseStack.pushPose(); poseStack.translate(guiGraphics.guiWidth() / 2 + l * Mth.abs(Mth.sin(k * 2.0F)), guiGraphics.guiHeight() / 2 + m * Mth.abs(Mth.sin(k * 2.0F)), -50.0F); float n = 50.0F + 175.0F * Mth.sin(k); @@ -1323,42 +716,17 @@ public class GameRenderer implements AutoCloseable { poseStack.mulPose(Axis.YP.rotationDegrees(900.0F * Mth.abs(Mth.sin(k)))); poseStack.mulPose(Axis.XP.rotationDegrees(6.0F * Mth.cos(f * 8.0F))); poseStack.mulPose(Axis.ZP.rotationDegrees(6.0F * Mth.cos(f * 8.0F))); - guiGraphics.drawManaged( - () -> this.minecraft + guiGraphics.drawSpecial( + multiBufferSource -> this.minecraft .getItemRenderer() .renderStatic( - this.itemActivationItem, ItemDisplayContext.FIXED, 15728880, OverlayTexture.NO_OVERLAY, poseStack, guiGraphics.bufferSource(), this.minecraft.level, 0 + this.itemActivationItem, ItemDisplayContext.FIXED, 15728880, OverlayTexture.NO_OVERLAY, poseStack, multiBufferSource, this.minecraft.level, 0 ) ); poseStack.popPose(); } } - private void renderConfusionOverlay(GuiGraphics guiGraphics, float scalar) { - int i = guiGraphics.guiWidth(); - int j = guiGraphics.guiHeight(); - guiGraphics.pose().pushPose(); - float f = Mth.lerp(scalar, 2.0F, 1.0F); - guiGraphics.pose().translate(i / 2.0F, j / 2.0F, 0.0F); - guiGraphics.pose().scale(f, f, f); - guiGraphics.pose().translate(-i / 2.0F, -j / 2.0F, 0.0F); - float g = 0.2F * scalar; - float h = 0.4F * scalar; - float k = 0.2F * scalar; - RenderSystem.disableDepthTest(); - RenderSystem.depthMask(false); - RenderSystem.enableBlend(); - RenderSystem.blendFuncSeparate(GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ONE, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ONE); - guiGraphics.setColor(g, h, k, 1.0F); - guiGraphics.blit(NAUSEA_LOCATION, 0, 0, -90, 0.0F, 0.0F, i, j, i, j); - guiGraphics.setColor(1.0F, 1.0F, 1.0F, 1.0F); - RenderSystem.defaultBlendFunc(); - RenderSystem.disableBlend(); - RenderSystem.depthMask(true); - RenderSystem.enableDepthTest(); - guiGraphics.pose().popPose(); - } - public Minecraft getMinecraft() { return this.minecraft; } @@ -1382,298 +750,4 @@ public class GameRenderer implements AutoCloseable { public OverlayTexture overlayTexture() { return this.overlayTexture; } - - @Nullable - public static ShaderInstance getPositionShader() { - return positionShader; - } - - @Nullable - public static ShaderInstance getPositionColorShader() { - return positionColorShader; - } - - @Nullable - public static ShaderInstance getPositionTexShader() { - return positionTexShader; - } - - @Nullable - public static ShaderInstance getPositionTexColorShader() { - return positionTexColorShader; - } - - @Nullable - public static ShaderInstance getParticleShader() { - return particleShader; - } - - @Nullable - public static ShaderInstance getPositionColorLightmapShader() { - return positionColorLightmapShader; - } - - @Nullable - public static ShaderInstance getPositionColorTexLightmapShader() { - return positionColorTexLightmapShader; - } - - @Nullable - public static ShaderInstance getRendertypeSolidShader() { - return rendertypeSolidShader; - } - - @Nullable - public static ShaderInstance getRendertypeCutoutMippedShader() { - return rendertypeCutoutMippedShader; - } - - @Nullable - public static ShaderInstance getRendertypeCutoutShader() { - return rendertypeCutoutShader; - } - - @Nullable - public static ShaderInstance getRendertypeTranslucentShader() { - return rendertypeTranslucentShader; - } - - @Nullable - public static ShaderInstance getRendertypeTranslucentMovingBlockShader() { - return rendertypeTranslucentMovingBlockShader; - } - - @Nullable - public static ShaderInstance getRendertypeArmorCutoutNoCullShader() { - return rendertypeArmorCutoutNoCullShader; - } - - @Nullable - public static ShaderInstance getRendertypeEntitySolidShader() { - return rendertypeEntitySolidShader; - } - - @Nullable - public static ShaderInstance getRendertypeEntityCutoutShader() { - return rendertypeEntityCutoutShader; - } - - @Nullable - public static ShaderInstance getRendertypeEntityCutoutNoCullShader() { - return rendertypeEntityCutoutNoCullShader; - } - - @Nullable - public static ShaderInstance getRendertypeEntityCutoutNoCullZOffsetShader() { - return rendertypeEntityCutoutNoCullZOffsetShader; - } - - @Nullable - public static ShaderInstance getRendertypeItemEntityTranslucentCullShader() { - return rendertypeItemEntityTranslucentCullShader; - } - - @Nullable - public static ShaderInstance getRendertypeEntityTranslucentCullShader() { - return rendertypeEntityTranslucentCullShader; - } - - @Nullable - public static ShaderInstance getRendertypeEntityTranslucentShader() { - return rendertypeEntityTranslucentShader; - } - - @Nullable - public static ShaderInstance getRendertypeEntityTranslucentEmissiveShader() { - return rendertypeEntityTranslucentEmissiveShader; - } - - @Nullable - public static ShaderInstance getRendertypeEntitySmoothCutoutShader() { - return rendertypeEntitySmoothCutoutShader; - } - - @Nullable - public static ShaderInstance getRendertypeBeaconBeamShader() { - return rendertypeBeaconBeamShader; - } - - @Nullable - public static ShaderInstance getRendertypeEntityDecalShader() { - return rendertypeEntityDecalShader; - } - - @Nullable - public static ShaderInstance getRendertypeEntityNoOutlineShader() { - return rendertypeEntityNoOutlineShader; - } - - @Nullable - public static ShaderInstance getRendertypeEntityShadowShader() { - return rendertypeEntityShadowShader; - } - - @Nullable - public static ShaderInstance getRendertypeEntityAlphaShader() { - return rendertypeEntityAlphaShader; - } - - @Nullable - public static ShaderInstance getRendertypeEyesShader() { - return rendertypeEyesShader; - } - - @Nullable - public static ShaderInstance getRendertypeEnergySwirlShader() { - return rendertypeEnergySwirlShader; - } - - @Nullable - public static ShaderInstance getRendertypeBreezeWindShader() { - return rendertypeBreezeWindShader; - } - - @Nullable - public static ShaderInstance getRendertypeLeashShader() { - return rendertypeLeashShader; - } - - @Nullable - public static ShaderInstance getRendertypeWaterMaskShader() { - return rendertypeWaterMaskShader; - } - - @Nullable - public static ShaderInstance getRendertypeOutlineShader() { - return rendertypeOutlineShader; - } - - @Nullable - public static ShaderInstance getRendertypeArmorGlintShader() { - return rendertypeArmorGlintShader; - } - - @Nullable - public static ShaderInstance getRendertypeArmorEntityGlintShader() { - return rendertypeArmorEntityGlintShader; - } - - @Nullable - public static ShaderInstance getRendertypeGlintTranslucentShader() { - return rendertypeGlintTranslucentShader; - } - - @Nullable - public static ShaderInstance getRendertypeGlintShader() { - return rendertypeGlintShader; - } - - @Nullable - public static ShaderInstance getRendertypeGlintDirectShader() { - return rendertypeGlintDirectShader; - } - - @Nullable - public static ShaderInstance getRendertypeEntityGlintShader() { - return rendertypeEntityGlintShader; - } - - @Nullable - public static ShaderInstance getRendertypeEntityGlintDirectShader() { - return rendertypeEntityGlintDirectShader; - } - - @Nullable - public static ShaderInstance getRendertypeTextShader() { - return rendertypeTextShader; - } - - @Nullable - public static ShaderInstance getRendertypeTextBackgroundShader() { - return rendertypeTextBackgroundShader; - } - - @Nullable - public static ShaderInstance getRendertypeTextIntensityShader() { - return rendertypeTextIntensityShader; - } - - @Nullable - public static ShaderInstance getRendertypeTextSeeThroughShader() { - return rendertypeTextSeeThroughShader; - } - - @Nullable - public static ShaderInstance getRendertypeTextBackgroundSeeThroughShader() { - return rendertypeTextBackgroundSeeThroughShader; - } - - @Nullable - public static ShaderInstance getRendertypeTextIntensitySeeThroughShader() { - return rendertypeTextIntensitySeeThroughShader; - } - - @Nullable - public static ShaderInstance getRendertypeLightningShader() { - return rendertypeLightningShader; - } - - @Nullable - public static ShaderInstance getRendertypeTripwireShader() { - return rendertypeTripwireShader; - } - - @Nullable - public static ShaderInstance getRendertypeEndPortalShader() { - return rendertypeEndPortalShader; - } - - @Nullable - public static ShaderInstance getRendertypeEndGatewayShader() { - return rendertypeEndGatewayShader; - } - - @Nullable - public static ShaderInstance getRendertypeCloudsShader() { - return rendertypeCloudsShader; - } - - @Nullable - public static ShaderInstance getRendertypeLinesShader() { - return rendertypeLinesShader; - } - - @Nullable - public static ShaderInstance getRendertypeCrumblingShader() { - return rendertypeCrumblingShader; - } - - @Nullable - public static ShaderInstance getRendertypeGuiShader() { - return rendertypeGuiShader; - } - - @Nullable - public static ShaderInstance getRendertypeGuiOverlayShader() { - return rendertypeGuiOverlayShader; - } - - @Nullable - public static ShaderInstance getRendertypeGuiTextHighlightShader() { - return rendertypeGuiTextHighlightShader; - } - - @Nullable - public static ShaderInstance getRendertypeGuiGhostRecipeOverlayShader() { - return rendertypeGuiGhostRecipeOverlayShader; - } - - @Environment(EnvType.CLIENT) - public record ResourceCache(ResourceProvider original, Map cache) implements ResourceProvider { - @Override - public Optional getResource(ResourceLocation resourceLocation) { - Resource resource = (Resource)this.cache.get(resourceLocation); - return resource != null ? Optional.of(resource) : this.original.getResource(resourceLocation); - } - } } diff --git a/net/minecraft/client/renderer/GpuWarnlistManager.java b/net/minecraft/client/renderer/GpuWarnlistManager.java index a6ed982e..f02fe4b8 100644 --- a/net/minecraft/client/renderer/GpuWarnlistManager.java +++ b/net/minecraft/client/renderer/GpuWarnlistManager.java @@ -20,6 +20,7 @@ import net.minecraft.resources.ResourceLocation; import net.minecraft.server.packs.resources.ResourceManager; import net.minecraft.server.packs.resources.SimplePreparableReloadListener; import net.minecraft.util.profiling.ProfilerFiller; +import net.minecraft.util.profiling.Zone; import org.jetbrains.annotations.Nullable; import org.slf4j.Logger; @@ -96,17 +97,15 @@ public class GpuWarnlistManager extends SimplePreparableReloadListener list = Lists.newArrayList(); List list2 = Lists.newArrayList(); List list3 = Lists.newArrayList(); - profiler.startTick(); JsonObject jsonObject = parseJson(resourceManager, profiler); if (jsonObject != null) { - profiler.push("compile_regex"); - compilePatterns(jsonObject.getAsJsonArray("renderer"), list); - compilePatterns(jsonObject.getAsJsonArray("version"), list2); - compilePatterns(jsonObject.getAsJsonArray("vendor"), list3); - profiler.pop(); + try (Zone zone = profiler.zone("compile_regex")) { + compilePatterns(jsonObject.getAsJsonArray("renderer"), list); + compilePatterns(jsonObject.getAsJsonArray("version"), list2); + compilePatterns(jsonObject.getAsJsonArray("vendor"), list3); + } } - profiler.endTick(); return new GpuWarnlistManager.Preparations(list, list2, list3); } @@ -120,35 +119,35 @@ public class GpuWarnlistManager extends SimplePreparableReloadListenergetRenderer(abstractClientPlayer); + ResourceLocation resourceLocation = abstractClientPlayer.getSkin().texture(); if (bl) { - playerRenderer.renderRightHand(poseStack, buffer, packedLight, abstractClientPlayer); + playerRenderer.renderRightHand(poseStack, buffer, packedLight, resourceLocation, abstractClientPlayer.isModelPartShown(PlayerModelPart.RIGHT_SLEEVE)); } else { - playerRenderer.renderLeftHand(poseStack, buffer, packedLight, abstractClientPlayer); + playerRenderer.renderLeftHand(poseStack, buffer, packedLight, resourceLocation, abstractClientPlayer.isModelPartShown(PlayerModelPart.LEFT_SLEEVE)); } } @@ -313,7 +320,7 @@ public class ItemInHandRenderer { public void renderHandsWithItems(float partialTicks, PoseStack poseStack, MultiBufferSource.BufferSource buffer, LocalPlayer playerEntity, int combinedLight) { float f = playerEntity.getAttackAnim(partialTicks); InteractionHand interactionHand = MoreObjects.firstNonNull(playerEntity.swingingArm, InteractionHand.MAIN_HAND); - float g = Mth.lerp(partialTicks, playerEntity.xRotO, playerEntity.getXRot()); + float g = playerEntity.getXRot(partialTicks); ItemInHandRenderer.HandRenderSelection handRenderSelection = evaluateWhichHandsToRender(playerEntity); float h = Mth.lerp(partialTicks, playerEntity.xBobO, playerEntity.xBob); float i = Mth.lerp(partialTicks, playerEntity.yBobO, playerEntity.yBob); @@ -387,7 +394,7 @@ public class ItemInHandRenderer { if (bl && !player.isInvisible()) { this.renderPlayerArm(poseStack, buffer, combinedLight, equippedProgress, swingProgress, humanoidArm); } - } else if (stack.is(Items.FILLED_MAP)) { + } else if (stack.has(DataComponents.MAP_ID)) { if (bl && this.offHandItem.isEmpty()) { this.renderTwoHandedMap(poseStack, buffer, combinedLight, pitch, equippedProgress, swingProgress); } else { diff --git a/net/minecraft/client/renderer/ItemModelShaper.java b/net/minecraft/client/renderer/ItemModelShaper.java index cab4635a..fc8181fd 100644 --- a/net/minecraft/client/renderer/ItemModelShaper.java +++ b/net/minecraft/client/renderer/ItemModelShaper.java @@ -1,54 +1,39 @@ package net.minecraft.client.renderer; -import it.unimi.dsi.fastutil.ints.Int2ObjectMap; -import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; -import java.util.Map.Entry; +import java.util.HashMap; +import java.util.Map; +import java.util.function.Function; +import java.util.function.Supplier; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.resources.model.BakedModel; import net.minecraft.client.resources.model.ModelManager; import net.minecraft.client.resources.model.ModelResourceLocation; -import net.minecraft.world.item.Item; +import net.minecraft.core.component.DataComponents; +import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.ItemStack; -import org.jetbrains.annotations.Nullable; @Environment(EnvType.CLIENT) public class ItemModelShaper { - public final Int2ObjectMap shapes = new Int2ObjectOpenHashMap<>(256); - private final Int2ObjectMap shapesCache = new Int2ObjectOpenHashMap<>(256); - private final ModelManager modelManager; + private final Map modelToBakedModel = new HashMap(); + private final Supplier missingModel; + private final Function modelGetter; public ItemModelShaper(ModelManager modelManager) { - this.modelManager = modelManager; + this.missingModel = modelManager::getMissingModel; + this.modelGetter = resourceLocation -> modelManager.getModel(ModelResourceLocation.inventory(resourceLocation)); } public BakedModel getItemModel(ItemStack stack) { - BakedModel bakedModel = this.getItemModel(stack.getItem()); - return bakedModel == null ? this.modelManager.getMissingModel() : bakedModel; + ResourceLocation resourceLocation = stack.get(DataComponents.ITEM_MODEL); + return resourceLocation == null ? (BakedModel)this.missingModel.get() : this.getItemModel(resourceLocation); } - @Nullable - public BakedModel getItemModel(Item item) { - return this.shapesCache.get(getIndex(item)); + public BakedModel getItemModel(ResourceLocation resourceLocation) { + return (BakedModel)this.modelToBakedModel.computeIfAbsent(resourceLocation, this.modelGetter); } - private static int getIndex(Item item) { - return Item.getId(item); - } - - public void register(Item item, ModelResourceLocation modelLocation) { - this.shapes.put(getIndex(item), modelLocation); - } - - public ModelManager getModelManager() { - return this.modelManager; - } - - public void rebuildCache() { - this.shapesCache.clear(); - - for (Entry entry : this.shapes.entrySet()) { - this.shapesCache.put((Integer)entry.getKey(), this.modelManager.getModel((ModelResourceLocation)entry.getValue())); - } + public void invalidateCache() { + this.modelToBakedModel.clear(); } } diff --git a/net/minecraft/client/renderer/LevelEventHandler.java b/net/minecraft/client/renderer/LevelEventHandler.java new file mode 100644 index 00000000..3844f94a --- /dev/null +++ b/net/minecraft/client/renderer/LevelEventHandler.java @@ -0,0 +1,692 @@ +package net.minecraft.client.renderer; + +import java.util.HashMap; +import java.util.Map; +import java.util.function.Supplier; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.client.Camera; +import net.minecraft.client.Minecraft; +import net.minecraft.client.particle.Particle; +import net.minecraft.client.resources.sounds.SimpleSoundInstance; +import net.minecraft.client.resources.sounds.SoundInstance; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.core.Holder; +import net.minecraft.core.particles.ItemParticleOption; +import net.minecraft.core.particles.ParticleOptions; +import net.minecraft.core.particles.ParticleTypes; +import net.minecraft.core.particles.SculkChargeParticleOptions; +import net.minecraft.core.particles.ShriekParticleOption; +import net.minecraft.core.particles.SimpleParticleType; +import net.minecraft.core.registries.Registries; +import net.minecraft.sounds.SoundEvent; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.sounds.SoundSource; +import net.minecraft.util.Mth; +import net.minecraft.util.ParticleUtils; +import net.minecraft.util.RandomSource; +import net.minecraft.util.valueproviders.IntProvider; +import net.minecraft.util.valueproviders.UniformInt; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.item.BoneMealItem; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.world.item.JukeboxSong; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.BrushableBlock; +import net.minecraft.world.level.block.ComposterBlock; +import net.minecraft.world.level.block.MultifaceBlock; +import net.minecraft.world.level.block.PointedDripstoneBlock; +import net.minecraft.world.level.block.SculkShriekerBlock; +import net.minecraft.world.level.block.SoundType; +import net.minecraft.world.level.block.entity.trialspawner.TrialSpawner; +import net.minecraft.world.level.block.entity.vault.VaultBlockEntity; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.phys.AABB; +import net.minecraft.world.phys.Vec3; + +@Environment(EnvType.CLIENT) +public class LevelEventHandler { + private final Minecraft minecraft; + private final Level level; + private final LevelRenderer levelRenderer; + private final Map playingJukeboxSongs = new HashMap(); + + public LevelEventHandler(Minecraft minecraft, Level level, LevelRenderer levelRenderer) { + this.minecraft = minecraft; + this.level = level; + this.levelRenderer = levelRenderer; + } + + public void globalLevelEvent(int i, BlockPos blockPos, int j) { + switch (i) { + case 1023: + case 1028: + case 1038: + Camera camera = this.minecraft.gameRenderer.getMainCamera(); + if (camera.isInitialized()) { + Vec3 vec3 = Vec3.atCenterOf(blockPos).subtract(camera.getPosition()).normalize(); + Vec3 vec32 = camera.getPosition().add(vec3.scale(2.0)); + if (i == 1023) { + this.level.playLocalSound(vec32.x, vec32.y, vec32.z, SoundEvents.WITHER_SPAWN, SoundSource.HOSTILE, 1.0F, 1.0F, false); + } else if (i == 1038) { + this.level.playLocalSound(vec32.x, vec32.y, vec32.z, SoundEvents.END_PORTAL_SPAWN, SoundSource.HOSTILE, 1.0F, 1.0F, false); + } else { + this.level.playLocalSound(vec32.x, vec32.y, vec32.z, SoundEvents.ENDER_DRAGON_DEATH, SoundSource.HOSTILE, 5.0F, 1.0F, false); + } + } + } + } + + public void levelEvent(int i, BlockPos blockPos, int j) { + RandomSource randomSource = this.level.random; + switch (i) { + case 1000: + this.level.playLocalSound(blockPos, SoundEvents.DISPENSER_DISPENSE, SoundSource.BLOCKS, 1.0F, 1.0F, false); + break; + case 1001: + this.level.playLocalSound(blockPos, SoundEvents.DISPENSER_FAIL, SoundSource.BLOCKS, 1.0F, 1.2F, false); + break; + case 1002: + this.level.playLocalSound(blockPos, SoundEvents.DISPENSER_LAUNCH, SoundSource.BLOCKS, 1.0F, 1.2F, false); + break; + case 1004: + this.level.playLocalSound(blockPos, SoundEvents.FIREWORK_ROCKET_SHOOT, SoundSource.NEUTRAL, 1.0F, 1.2F, false); + break; + case 1009: + if (j == 0) { + this.level + .playLocalSound( + blockPos, SoundEvents.FIRE_EXTINGUISH, SoundSource.BLOCKS, 0.5F, 2.6F + (randomSource.nextFloat() - randomSource.nextFloat()) * 0.8F, false + ); + } else if (j == 1) { + this.level + .playLocalSound( + blockPos, SoundEvents.GENERIC_EXTINGUISH_FIRE, SoundSource.BLOCKS, 0.7F, 1.6F + (randomSource.nextFloat() - randomSource.nextFloat()) * 0.4F, false + ); + } + break; + case 1010: + this.level.registryAccess().lookupOrThrow(Registries.JUKEBOX_SONG).get(j).ifPresent(reference -> this.playJukeboxSong(reference, blockPos)); + break; + case 1011: + this.stopJukeboxSongAndNotifyNearby(blockPos); + break; + case 1015: + this.level + .playLocalSound(blockPos, SoundEvents.GHAST_WARN, SoundSource.HOSTILE, 10.0F, (randomSource.nextFloat() - randomSource.nextFloat()) * 0.2F + 1.0F, false); + break; + case 1016: + this.level + .playLocalSound(blockPos, SoundEvents.GHAST_SHOOT, SoundSource.HOSTILE, 10.0F, (randomSource.nextFloat() - randomSource.nextFloat()) * 0.2F + 1.0F, false); + break; + case 1017: + this.level + .playLocalSound( + blockPos, SoundEvents.ENDER_DRAGON_SHOOT, SoundSource.HOSTILE, 10.0F, (randomSource.nextFloat() - randomSource.nextFloat()) * 0.2F + 1.0F, false + ); + break; + case 1018: + this.level + .playLocalSound(blockPos, SoundEvents.BLAZE_SHOOT, SoundSource.HOSTILE, 2.0F, (randomSource.nextFloat() - randomSource.nextFloat()) * 0.2F + 1.0F, false); + break; + case 1019: + this.level + .playLocalSound( + blockPos, SoundEvents.ZOMBIE_ATTACK_WOODEN_DOOR, SoundSource.HOSTILE, 2.0F, (randomSource.nextFloat() - randomSource.nextFloat()) * 0.2F + 1.0F, false + ); + break; + case 1020: + this.level + .playLocalSound( + blockPos, SoundEvents.ZOMBIE_ATTACK_IRON_DOOR, SoundSource.HOSTILE, 2.0F, (randomSource.nextFloat() - randomSource.nextFloat()) * 0.2F + 1.0F, false + ); + break; + case 1021: + this.level + .playLocalSound( + blockPos, SoundEvents.ZOMBIE_BREAK_WOODEN_DOOR, SoundSource.HOSTILE, 2.0F, (randomSource.nextFloat() - randomSource.nextFloat()) * 0.2F + 1.0F, false + ); + break; + case 1022: + this.level + .playLocalSound( + blockPos, SoundEvents.WITHER_BREAK_BLOCK, SoundSource.HOSTILE, 2.0F, (randomSource.nextFloat() - randomSource.nextFloat()) * 0.2F + 1.0F, false + ); + break; + case 1024: + this.level + .playLocalSound(blockPos, SoundEvents.WITHER_SHOOT, SoundSource.HOSTILE, 2.0F, (randomSource.nextFloat() - randomSource.nextFloat()) * 0.2F + 1.0F, false); + break; + case 1025: + this.level + .playLocalSound(blockPos, SoundEvents.BAT_TAKEOFF, SoundSource.NEUTRAL, 0.05F, (randomSource.nextFloat() - randomSource.nextFloat()) * 0.2F + 1.0F, false); + break; + case 1026: + this.level + .playLocalSound(blockPos, SoundEvents.ZOMBIE_INFECT, SoundSource.HOSTILE, 2.0F, (randomSource.nextFloat() - randomSource.nextFloat()) * 0.2F + 1.0F, false); + break; + case 1027: + this.level + .playLocalSound( + blockPos, SoundEvents.ZOMBIE_VILLAGER_CONVERTED, SoundSource.HOSTILE, 2.0F, (randomSource.nextFloat() - randomSource.nextFloat()) * 0.2F + 1.0F, false + ); + break; + case 1029: + this.level.playLocalSound(blockPos, SoundEvents.ANVIL_DESTROY, SoundSource.BLOCKS, 1.0F, randomSource.nextFloat() * 0.1F + 0.9F, false); + break; + case 1030: + this.level.playLocalSound(blockPos, SoundEvents.ANVIL_USE, SoundSource.BLOCKS, 1.0F, randomSource.nextFloat() * 0.1F + 0.9F, false); + break; + case 1031: + this.level.playLocalSound(blockPos, SoundEvents.ANVIL_LAND, SoundSource.BLOCKS, 0.3F, this.level.random.nextFloat() * 0.1F + 0.9F, false); + break; + case 1032: + this.minecraft.getSoundManager().play(SimpleSoundInstance.forLocalAmbience(SoundEvents.PORTAL_TRAVEL, randomSource.nextFloat() * 0.4F + 0.8F, 0.25F)); + break; + case 1033: + this.level.playLocalSound(blockPos, SoundEvents.CHORUS_FLOWER_GROW, SoundSource.BLOCKS, 1.0F, 1.0F, false); + break; + case 1034: + this.level.playLocalSound(blockPos, SoundEvents.CHORUS_FLOWER_DEATH, SoundSource.BLOCKS, 1.0F, 1.0F, false); + break; + case 1035: + this.level.playLocalSound(blockPos, SoundEvents.BREWING_STAND_BREW, SoundSource.BLOCKS, 1.0F, 1.0F, false); + break; + case 1039: + this.level.playLocalSound(blockPos, SoundEvents.PHANTOM_BITE, SoundSource.HOSTILE, 0.3F, this.level.random.nextFloat() * 0.1F + 0.9F, false); + break; + case 1040: + this.level + .playLocalSound( + blockPos, SoundEvents.ZOMBIE_CONVERTED_TO_DROWNED, SoundSource.HOSTILE, 2.0F, (randomSource.nextFloat() - randomSource.nextFloat()) * 0.2F + 1.0F, false + ); + break; + case 1041: + this.level + .playLocalSound( + blockPos, SoundEvents.HUSK_CONVERTED_TO_ZOMBIE, SoundSource.HOSTILE, 2.0F, (randomSource.nextFloat() - randomSource.nextFloat()) * 0.2F + 1.0F, false + ); + break; + case 1042: + this.level.playLocalSound(blockPos, SoundEvents.GRINDSTONE_USE, SoundSource.BLOCKS, 1.0F, this.level.random.nextFloat() * 0.1F + 0.9F, false); + break; + case 1043: + this.level.playLocalSound(blockPos, SoundEvents.BOOK_PAGE_TURN, SoundSource.BLOCKS, 1.0F, this.level.random.nextFloat() * 0.1F + 0.9F, false); + break; + case 1044: + this.level.playLocalSound(blockPos, SoundEvents.SMITHING_TABLE_USE, SoundSource.BLOCKS, 1.0F, this.level.random.nextFloat() * 0.1F + 0.9F, false); + break; + case 1045: + this.level.playLocalSound(blockPos, SoundEvents.POINTED_DRIPSTONE_LAND, SoundSource.BLOCKS, 2.0F, this.level.random.nextFloat() * 0.1F + 0.9F, false); + break; + case 1046: + this.level + .playLocalSound( + blockPos, SoundEvents.POINTED_DRIPSTONE_DRIP_LAVA_INTO_CAULDRON, SoundSource.BLOCKS, 2.0F, this.level.random.nextFloat() * 0.1F + 0.9F, false + ); + break; + case 1047: + this.level + .playLocalSound( + blockPos, SoundEvents.POINTED_DRIPSTONE_DRIP_WATER_INTO_CAULDRON, SoundSource.BLOCKS, 2.0F, this.level.random.nextFloat() * 0.1F + 0.9F, false + ); + break; + case 1048: + this.level + .playLocalSound( + blockPos, SoundEvents.SKELETON_CONVERTED_TO_STRAY, SoundSource.HOSTILE, 2.0F, (randomSource.nextFloat() - randomSource.nextFloat()) * 0.2F + 1.0F, false + ); + break; + case 1049: + this.level.playLocalSound(blockPos, SoundEvents.CRAFTER_CRAFT, SoundSource.BLOCKS, 1.0F, 1.0F, false); + break; + case 1050: + this.level.playLocalSound(blockPos, SoundEvents.CRAFTER_FAIL, SoundSource.BLOCKS, 1.0F, 1.0F, false); + break; + case 1051: + this.level + .playLocalSound(blockPos, SoundEvents.WIND_CHARGE_THROW, SoundSource.BLOCKS, 0.5F, 0.4F / (this.level.getRandom().nextFloat() * 0.4F + 0.8F), false); + break; + case 1500: + ComposterBlock.handleFill(this.level, blockPos, j > 0); + break; + case 1501: + this.level + .playLocalSound( + blockPos, SoundEvents.LAVA_EXTINGUISH, SoundSource.BLOCKS, 0.5F, 2.6F + (randomSource.nextFloat() - randomSource.nextFloat()) * 0.8F, false + ); + + for (int ox = 0; ox < 8; ox++) { + this.level + .addParticle( + ParticleTypes.LARGE_SMOKE, + blockPos.getX() + randomSource.nextDouble(), + blockPos.getY() + 1.2, + blockPos.getZ() + randomSource.nextDouble(), + 0.0, + 0.0, + 0.0 + ); + } + break; + case 1502: + this.level + .playLocalSound( + blockPos, SoundEvents.REDSTONE_TORCH_BURNOUT, SoundSource.BLOCKS, 0.5F, 2.6F + (randomSource.nextFloat() - randomSource.nextFloat()) * 0.8F, false + ); + + for (int ox = 0; ox < 5; ox++) { + double g = blockPos.getX() + randomSource.nextDouble() * 0.6 + 0.2; + double p = blockPos.getY() + randomSource.nextDouble() * 0.6 + 0.2; + double q = blockPos.getZ() + randomSource.nextDouble() * 0.6 + 0.2; + this.level.addParticle(ParticleTypes.SMOKE, g, p, q, 0.0, 0.0, 0.0); + } + break; + case 1503: + this.level.playLocalSound(blockPos, SoundEvents.END_PORTAL_FRAME_FILL, SoundSource.BLOCKS, 1.0F, 1.0F, false); + + for (int ox = 0; ox < 16; ox++) { + double g = blockPos.getX() + (5.0 + randomSource.nextDouble() * 6.0) / 16.0; + double p = blockPos.getY() + 0.8125; + double q = blockPos.getZ() + (5.0 + randomSource.nextDouble() * 6.0) / 16.0; + this.level.addParticle(ParticleTypes.SMOKE, g, p, q, 0.0, 0.0, 0.0); + } + break; + case 1504: + PointedDripstoneBlock.spawnDripParticle(this.level, blockPos, this.level.getBlockState(blockPos)); + break; + case 1505: + BoneMealItem.addGrowthParticles(this.level, blockPos, j); + this.level.playLocalSound(blockPos, SoundEvents.BONE_MEAL_USE, SoundSource.BLOCKS, 1.0F, 1.0F, false); + break; + case 2000: + this.shootParticles(j, blockPos, randomSource, ParticleTypes.SMOKE); + break; + case 2001: + BlockState blockState = Block.stateById(j); + if (!blockState.isAir()) { + SoundType soundType = blockState.getSoundType(); + this.level + .playLocalSound(blockPos, soundType.getBreakSound(), SoundSource.BLOCKS, (soundType.getVolume() + 1.0F) / 2.0F, soundType.getPitch() * 0.8F, false); + } + + this.level.addDestroyBlockEffect(blockPos, blockState); + break; + case 2002: + case 2007: + Vec3 vec3 = Vec3.atBottomCenterOf(blockPos); + + for (int l = 0; l < 8; l++) { + this.levelRenderer + .addParticle( + new ItemParticleOption(ParticleTypes.ITEM, new ItemStack(Items.SPLASH_POTION)), + vec3.x, + vec3.y, + vec3.z, + randomSource.nextGaussian() * 0.15, + randomSource.nextDouble() * 0.2, + randomSource.nextGaussian() * 0.15 + ); + } + + float h = (j >> 16 & 0xFF) / 255.0F; + float m = (j >> 8 & 0xFF) / 255.0F; + float n = (j >> 0 & 0xFF) / 255.0F; + ParticleOptions particleOptions = i == 2007 ? ParticleTypes.INSTANT_EFFECT : ParticleTypes.EFFECT; + + for (int ox = 0; ox < 100; ox++) { + double g = randomSource.nextDouble() * 4.0; + double p = randomSource.nextDouble() * Math.PI * 2.0; + double q = Math.cos(p) * g; + double r = 0.01 + randomSource.nextDouble() * 0.5; + double s = Math.sin(p) * g; + Particle particle = this.levelRenderer + .addParticleInternal(particleOptions, particleOptions.getType().getOverrideLimiter(), vec3.x + q * 0.1, vec3.y + 0.3, vec3.z + s * 0.1, q, r, s); + if (particle != null) { + float t = 0.75F + randomSource.nextFloat() * 0.25F; + particle.setColor(h * t, m * t, n * t); + particle.setPower((float)g); + } + } + + this.level.playLocalSound(blockPos, SoundEvents.SPLASH_POTION_BREAK, SoundSource.NEUTRAL, 1.0F, randomSource.nextFloat() * 0.1F + 0.9F, false); + break; + case 2003: + double d = blockPos.getX() + 0.5; + double e = blockPos.getY(); + double f = blockPos.getZ() + 0.5; + + for (int k = 0; k < 8; k++) { + this.levelRenderer + .addParticle( + new ItemParticleOption(ParticleTypes.ITEM, new ItemStack(Items.ENDER_EYE)), + d, + e, + f, + randomSource.nextGaussian() * 0.15, + randomSource.nextDouble() * 0.2, + randomSource.nextGaussian() * 0.15 + ); + } + + for (double g = 0.0; g < Math.PI * 2; g += Math.PI / 20) { + this.levelRenderer.addParticle(ParticleTypes.PORTAL, d + Math.cos(g) * 5.0, e - 0.4, f + Math.sin(g) * 5.0, Math.cos(g) * -5.0, 0.0, Math.sin(g) * -5.0); + this.levelRenderer.addParticle(ParticleTypes.PORTAL, d + Math.cos(g) * 5.0, e - 0.4, f + Math.sin(g) * 5.0, Math.cos(g) * -7.0, 0.0, Math.sin(g) * -7.0); + } + break; + case 2004: + for (int ux = 0; ux < 20; ux++) { + double v = blockPos.getX() + 0.5 + (randomSource.nextDouble() - 0.5) * 2.0; + double w = blockPos.getY() + 0.5 + (randomSource.nextDouble() - 0.5) * 2.0; + double x = blockPos.getZ() + 0.5 + (randomSource.nextDouble() - 0.5) * 2.0; + this.level.addParticle(ParticleTypes.SMOKE, v, w, x, 0.0, 0.0, 0.0); + this.level.addParticle(ParticleTypes.FLAME, v, w, x, 0.0, 0.0, 0.0); + } + break; + case 2006: + for (int o = 0; o < 200; o++) { + float ad = randomSource.nextFloat() * 4.0F; + float ai = randomSource.nextFloat() * (float) (Math.PI * 2); + double p = Mth.cos(ai) * ad; + double q = 0.01 + randomSource.nextDouble() * 0.5; + double r = Mth.sin(ai) * ad; + Particle particle2 = this.levelRenderer + .addParticleInternal(ParticleTypes.DRAGON_BREATH, false, blockPos.getX() + p * 0.1, blockPos.getY() + 0.3, blockPos.getZ() + r * 0.1, p, q, r); + if (particle2 != null) { + particle2.setPower(ad); + } + } + + if (j == 1) { + this.level.playLocalSound(blockPos, SoundEvents.DRAGON_FIREBALL_EXPLODE, SoundSource.HOSTILE, 1.0F, randomSource.nextFloat() * 0.1F + 0.9F, false); + } + break; + case 2008: + this.level.addParticle(ParticleTypes.EXPLOSION, blockPos.getX() + 0.5, blockPos.getY() + 0.5, blockPos.getZ() + 0.5, 0.0, 0.0, 0.0); + break; + case 2009: + for (int ox = 0; ox < 8; ox++) { + this.level + .addParticle( + ParticleTypes.CLOUD, blockPos.getX() + randomSource.nextDouble(), blockPos.getY() + 1.2, blockPos.getZ() + randomSource.nextDouble(), 0.0, 0.0, 0.0 + ); + } + break; + case 2010: + this.shootParticles(j, blockPos, randomSource, ParticleTypes.WHITE_SMOKE); + break; + case 2011: + ParticleUtils.spawnParticleInBlock(this.level, blockPos, j, ParticleTypes.HAPPY_VILLAGER); + break; + case 2012: + ParticleUtils.spawnParticleInBlock(this.level, blockPos, j, ParticleTypes.HAPPY_VILLAGER); + break; + case 2013: + ParticleUtils.spawnSmashAttackParticles(this.level, blockPos, j); + break; + case 3000: + this.level.addParticle(ParticleTypes.EXPLOSION_EMITTER, true, blockPos.getX() + 0.5, blockPos.getY() + 0.5, blockPos.getZ() + 0.5, 0.0, 0.0, 0.0); + this.level + .playLocalSound( + blockPos, + SoundEvents.END_GATEWAY_SPAWN, + SoundSource.BLOCKS, + 10.0F, + (1.0F + (this.level.random.nextFloat() - this.level.random.nextFloat()) * 0.2F) * 0.7F, + false + ); + break; + case 3001: + this.level.playLocalSound(blockPos, SoundEvents.ENDER_DRAGON_GROWL, SoundSource.HOSTILE, 64.0F, 0.8F + this.level.random.nextFloat() * 0.3F, false); + break; + case 3002: + if (j >= 0 && j < Direction.Axis.VALUES.length) { + ParticleUtils.spawnParticlesAlongAxis(Direction.Axis.VALUES[j], this.level, blockPos, 0.125, ParticleTypes.ELECTRIC_SPARK, UniformInt.of(10, 19)); + } else { + ParticleUtils.spawnParticlesOnBlockFaces(this.level, blockPos, ParticleTypes.ELECTRIC_SPARK, UniformInt.of(3, 5)); + } + break; + case 3003: + ParticleUtils.spawnParticlesOnBlockFaces(this.level, blockPos, ParticleTypes.WAX_ON, UniformInt.of(3, 5)); + this.level.playLocalSound(blockPos, SoundEvents.HONEYCOMB_WAX_ON, SoundSource.BLOCKS, 1.0F, 1.0F, false); + break; + case 3004: + ParticleUtils.spawnParticlesOnBlockFaces(this.level, blockPos, ParticleTypes.WAX_OFF, UniformInt.of(3, 5)); + break; + case 3005: + ParticleUtils.spawnParticlesOnBlockFaces(this.level, blockPos, ParticleTypes.SCRAPE, UniformInt.of(3, 5)); + break; + case 3006: + int u = j >> 6; + if (u > 0) { + if (randomSource.nextFloat() < 0.3F + u * 0.1F) { + float n = 0.15F + 0.02F * u * u * randomSource.nextFloat(); + float y = 0.4F + 0.3F * u * randomSource.nextFloat(); + this.level.playLocalSound(blockPos, SoundEvents.SCULK_BLOCK_CHARGE, SoundSource.BLOCKS, n, y, false); + } + + byte b = (byte)(j & 63); + IntProvider intProvider = UniformInt.of(0, u); + float z = 0.005F; + Supplier supplier = () -> new Vec3( + Mth.nextDouble(randomSource, -0.005F, 0.005F), Mth.nextDouble(randomSource, -0.005F, 0.005F), Mth.nextDouble(randomSource, -0.005F, 0.005F) + ); + if (b == 0) { + for (Direction direction : Direction.values()) { + float aa = direction == Direction.DOWN ? (float) Math.PI : 0.0F; + double r = direction.getAxis() == Direction.Axis.Y ? 0.65 : 0.57; + ParticleUtils.spawnParticlesOnBlockFace(this.level, blockPos, new SculkChargeParticleOptions(aa), intProvider, direction, supplier, r); + } + } else { + for (Direction direction2 : MultifaceBlock.unpack(b)) { + float ab = direction2 == Direction.UP ? (float) Math.PI : 0.0F; + double q = 0.35; + ParticleUtils.spawnParticlesOnBlockFace(this.level, blockPos, new SculkChargeParticleOptions(ab), intProvider, direction2, supplier, 0.35); + } + } + } else { + this.level.playLocalSound(blockPos, SoundEvents.SCULK_BLOCK_CHARGE, SoundSource.BLOCKS, 1.0F, 1.0F, false); + boolean bl = this.level.getBlockState(blockPos).isCollisionShapeFullBlock(this.level, blockPos); + int ac = bl ? 40 : 20; + float z = bl ? 0.45F : 0.25F; + float ad = 0.07F; + + for (int ae = 0; ae < ac; ae++) { + float af = 2.0F * randomSource.nextFloat() - 1.0F; + float ab = 2.0F * randomSource.nextFloat() - 1.0F; + float ag = 2.0F * randomSource.nextFloat() - 1.0F; + this.level + .addParticle( + ParticleTypes.SCULK_CHARGE_POP, + blockPos.getX() + 0.5 + af * z, + blockPos.getY() + 0.5 + ab * z, + blockPos.getZ() + 0.5 + ag * z, + af * 0.07F, + ab * 0.07F, + ag * 0.07F + ); + } + } + break; + case 3007: + for (int ah = 0; ah < 10; ah++) { + this.level + .addParticle( + new ShriekParticleOption(ah * 5), false, blockPos.getX() + 0.5, blockPos.getY() + SculkShriekerBlock.TOP_Y, blockPos.getZ() + 0.5, 0.0, 0.0, 0.0 + ); + } + + BlockState blockState3 = this.level.getBlockState(blockPos); + boolean bl2 = blockState3.hasProperty(BlockStateProperties.WATERLOGGED) && (Boolean)blockState3.getValue(BlockStateProperties.WATERLOGGED); + if (!bl2) { + this.level + .playLocalSound( + blockPos.getX() + 0.5, + blockPos.getY() + SculkShriekerBlock.TOP_Y, + blockPos.getZ() + 0.5, + SoundEvents.SCULK_SHRIEKER_SHRIEK, + SoundSource.BLOCKS, + 2.0F, + 0.6F + this.level.random.nextFloat() * 0.4F, + false + ); + } + break; + case 3008: + BlockState blockState2 = Block.stateById(j); + if (blockState2.getBlock() instanceof BrushableBlock brushableBlock) { + this.level.playLocalSound(blockPos, brushableBlock.getBrushCompletedSound(), SoundSource.PLAYERS, 1.0F, 1.0F, false); + } + + this.level.addDestroyBlockEffect(blockPos, blockState2); + break; + case 3009: + ParticleUtils.spawnParticlesOnBlockFaces(this.level, blockPos, ParticleTypes.EGG_CRACK, UniformInt.of(3, 6)); + break; + case 3011: + TrialSpawner.addSpawnParticles(this.level, blockPos, randomSource, TrialSpawner.FlameParticle.decode(j).particleType); + break; + case 3012: + this.level + .playLocalSound( + blockPos, SoundEvents.TRIAL_SPAWNER_SPAWN_MOB, SoundSource.BLOCKS, 1.0F, (randomSource.nextFloat() - randomSource.nextFloat()) * 0.2F + 1.0F, true + ); + TrialSpawner.addSpawnParticles(this.level, blockPos, randomSource, TrialSpawner.FlameParticle.decode(j).particleType); + break; + case 3013: + this.level + .playLocalSound( + blockPos, SoundEvents.TRIAL_SPAWNER_DETECT_PLAYER, SoundSource.BLOCKS, 1.0F, (randomSource.nextFloat() - randomSource.nextFloat()) * 0.2F + 1.0F, true + ); + TrialSpawner.addDetectPlayerParticles(this.level, blockPos, randomSource, j, ParticleTypes.TRIAL_SPAWNER_DETECTED_PLAYER); + break; + case 3014: + this.level + .playLocalSound( + blockPos, SoundEvents.TRIAL_SPAWNER_EJECT_ITEM, SoundSource.BLOCKS, 1.0F, (randomSource.nextFloat() - randomSource.nextFloat()) * 0.2F + 1.0F, true + ); + TrialSpawner.addEjectItemParticles(this.level, blockPos, randomSource); + break; + case 3015: + if (this.level.getBlockEntity(blockPos) instanceof VaultBlockEntity vaultBlockEntity) { + VaultBlockEntity.Client.emitActivationParticles( + this.level, + vaultBlockEntity.getBlockPos(), + vaultBlockEntity.getBlockState(), + vaultBlockEntity.getSharedData(), + j == 0 ? ParticleTypes.SMALL_FLAME : ParticleTypes.SOUL_FIRE_FLAME + ); + this.level + .playLocalSound(blockPos, SoundEvents.VAULT_ACTIVATE, SoundSource.BLOCKS, 1.0F, (randomSource.nextFloat() - randomSource.nextFloat()) * 0.2F + 1.0F, true); + } + break; + case 3016: + VaultBlockEntity.Client.emitDeactivationParticles(this.level, blockPos, j == 0 ? ParticleTypes.SMALL_FLAME : ParticleTypes.SOUL_FIRE_FLAME); + this.level + .playLocalSound( + blockPos, SoundEvents.VAULT_DEACTIVATE, SoundSource.BLOCKS, 1.0F, (randomSource.nextFloat() - randomSource.nextFloat()) * 0.2F + 1.0F, true + ); + break; + case 3017: + TrialSpawner.addEjectItemParticles(this.level, blockPos, randomSource); + break; + case 3018: + for (int ux = 0; ux < 10; ux++) { + double v = randomSource.nextGaussian() * 0.02; + double w = randomSource.nextGaussian() * 0.02; + double x = randomSource.nextGaussian() * 0.02; + this.level + .addParticle( + ParticleTypes.POOF, + blockPos.getX() + randomSource.nextDouble(), + blockPos.getY() + randomSource.nextDouble(), + blockPos.getZ() + randomSource.nextDouble(), + v, + w, + x + ); + } + + this.level + .playLocalSound(blockPos, SoundEvents.COBWEB_PLACE, SoundSource.BLOCKS, 1.0F, (randomSource.nextFloat() - randomSource.nextFloat()) * 0.2F + 1.0F, true); + break; + case 3019: + this.level + .playLocalSound( + blockPos, SoundEvents.TRIAL_SPAWNER_DETECT_PLAYER, SoundSource.BLOCKS, 1.0F, (randomSource.nextFloat() - randomSource.nextFloat()) * 0.2F + 1.0F, true + ); + TrialSpawner.addDetectPlayerParticles(this.level, blockPos, randomSource, j, ParticleTypes.TRIAL_SPAWNER_DETECTED_PLAYER_OMINOUS); + break; + case 3020: + this.level + .playLocalSound( + blockPos, + SoundEvents.TRIAL_SPAWNER_OMINOUS_ACTIVATE, + SoundSource.BLOCKS, + j == 0 ? 0.3F : 1.0F, + (randomSource.nextFloat() - randomSource.nextFloat()) * 0.2F + 1.0F, + true + ); + TrialSpawner.addDetectPlayerParticles(this.level, blockPos, randomSource, 0, ParticleTypes.TRIAL_SPAWNER_DETECTED_PLAYER_OMINOUS); + TrialSpawner.addBecomeOminousParticles(this.level, blockPos, randomSource); + break; + case 3021: + this.level + .playLocalSound( + blockPos, SoundEvents.TRIAL_SPAWNER_SPAWN_ITEM, SoundSource.BLOCKS, 1.0F, (randomSource.nextFloat() - randomSource.nextFloat()) * 0.2F + 1.0F, true + ); + TrialSpawner.addSpawnParticles(this.level, blockPos, randomSource, TrialSpawner.FlameParticle.decode(j).particleType); + } + } + + private void shootParticles(int i, BlockPos blockPos, RandomSource randomSource, SimpleParticleType simpleParticleType) { + Direction direction = Direction.from3DDataValue(i); + int j = direction.getStepX(); + int k = direction.getStepY(); + int l = direction.getStepZ(); + + for (int m = 0; m < 10; m++) { + double d = randomSource.nextDouble() * 0.2 + 0.01; + double e = blockPos.getX() + j * 0.6 + 0.5 + j * 0.01 + (randomSource.nextDouble() - 0.5) * l * 0.5; + double f = blockPos.getY() + k * 0.6 + 0.5 + k * 0.01 + (randomSource.nextDouble() - 0.5) * k * 0.5; + double g = blockPos.getZ() + l * 0.6 + 0.5 + l * 0.01 + (randomSource.nextDouble() - 0.5) * j * 0.5; + double h = j * d + randomSource.nextGaussian() * 0.01; + double n = k * d + randomSource.nextGaussian() * 0.01; + double o = l * d + randomSource.nextGaussian() * 0.01; + this.levelRenderer.addParticle(simpleParticleType, e, f, g, h, n, o); + } + } + + private void playJukeboxSong(Holder holder, BlockPos blockPos) { + this.stopJukeboxSong(blockPos); + JukeboxSong jukeboxSong = holder.value(); + SoundEvent soundEvent = jukeboxSong.soundEvent().value(); + SoundInstance soundInstance = SimpleSoundInstance.forJukeboxSong(soundEvent, Vec3.atCenterOf(blockPos)); + this.playingJukeboxSongs.put(blockPos, soundInstance); + this.minecraft.getSoundManager().play(soundInstance); + this.minecraft.gui.setNowPlaying(jukeboxSong.description()); + this.notifyNearbyEntities(this.level, blockPos, true); + } + + private void stopJukeboxSong(BlockPos blockPos) { + SoundInstance soundInstance = (SoundInstance)this.playingJukeboxSongs.remove(blockPos); + if (soundInstance != null) { + this.minecraft.getSoundManager().stop(soundInstance); + } + } + + private void stopJukeboxSongAndNotifyNearby(BlockPos blockPos) { + this.stopJukeboxSong(blockPos); + this.notifyNearbyEntities(this.level, blockPos, false); + } + + private void notifyNearbyEntities(Level level, BlockPos blockPos, boolean bl) { + for (LivingEntity livingEntity : level.getEntitiesOfClass(LivingEntity.class, new AABB(blockPos).inflate(3.0))) { + livingEntity.setRecordPlayingNearby(blockPos, bl); + } + } +} diff --git a/net/minecraft/client/renderer/LevelRenderer.java b/net/minecraft/client/renderer/LevelRenderer.java index a6b2317f..98101c0d 100644 --- a/net/minecraft/client/renderer/LevelRenderer.java +++ b/net/minecraft/client/renderer/LevelRenderer.java @@ -1,18 +1,18 @@ package net.minecraft.client.renderer; import com.google.common.collect.Lists; -import com.google.common.collect.Maps; import com.google.common.collect.Sets; -import com.google.gson.JsonSyntaxException; +import com.mojang.blaze3d.framegraph.FrameGraphBuilder; +import com.mojang.blaze3d.framegraph.FramePass; import com.mojang.blaze3d.pipeline.RenderTarget; +import com.mojang.blaze3d.pipeline.TextureTarget; import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.platform.Lighting; +import com.mojang.blaze3d.resource.GraphicsResourceAllocator; +import com.mojang.blaze3d.resource.RenderTargetDescriptor; +import com.mojang.blaze3d.resource.ResourceHandle; import com.mojang.blaze3d.shaders.Uniform; import com.mojang.blaze3d.systems.RenderSystem; -import com.mojang.blaze3d.vertex.BufferBuilder; -import com.mojang.blaze3d.vertex.BufferUploader; -import com.mojang.blaze3d.vertex.DefaultVertexFormat; -import com.mojang.blaze3d.vertex.MeshData; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.SheetedDecalTextureGenerator; import com.mojang.blaze3d.vertex.Tesselator; @@ -21,7 +21,6 @@ import com.mojang.blaze3d.vertex.VertexConsumer; import com.mojang.blaze3d.vertex.VertexFormat; import com.mojang.blaze3d.vertex.VertexMultiConsumer; import com.mojang.logging.LogUtils; -import com.mojang.math.Axis; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; import it.unimi.dsi.fastutil.longs.Long2ObjectFunction; @@ -30,12 +29,11 @@ import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; import it.unimi.dsi.fastutil.longs.Long2ObjectMap.Entry; import it.unimi.dsi.fastutil.objects.ObjectArrayList; import it.unimi.dsi.fastutil.objects.ObjectListIterator; -import java.io.IOException; +import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; import java.util.List; import java.util.Locale; -import java.util.Map; import java.util.Set; import java.util.SortedSet; import java.util.function.Supplier; @@ -51,7 +49,6 @@ import net.minecraft.client.CloudStatus; import net.minecraft.client.DeltaTracker; import net.minecraft.client.GraphicsStatus; import net.minecraft.client.Minecraft; -import net.minecraft.client.ParticleStatus; import net.minecraft.client.PrioritizeChunkUpdates; import net.minecraft.client.multiplayer.ClientLevel; import net.minecraft.client.particle.Particle; @@ -61,115 +58,68 @@ import net.minecraft.client.renderer.chunk.RenderRegionCache; import net.minecraft.client.renderer.chunk.SectionRenderDispatcher; import net.minecraft.client.renderer.culling.Frustum; import net.minecraft.client.renderer.entity.EntityRenderDispatcher; -import net.minecraft.client.renderer.texture.TextureAtlas; import net.minecraft.client.resources.model.ModelBakery; -import net.minecraft.client.resources.sounds.SimpleSoundInstance; -import net.minecraft.client.resources.sounds.SoundInstance; import net.minecraft.core.BlockPos; -import net.minecraft.core.Direction; -import net.minecraft.core.Holder; import net.minecraft.core.SectionPos; -import net.minecraft.core.particles.ItemParticleOption; import net.minecraft.core.particles.ParticleOptions; import net.minecraft.core.particles.ParticleTypes; -import net.minecraft.core.particles.SculkChargeParticleOptions; -import net.minecraft.core.particles.ShriekParticleOption; -import net.minecraft.core.particles.SimpleParticleType; import net.minecraft.core.registries.BuiltInRegistries; -import net.minecraft.core.registries.Registries; import net.minecraft.nbt.NbtOps; -import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.level.BlockDestructionProgress; +import net.minecraft.server.level.ParticleStatus; import net.minecraft.server.packs.resources.ResourceManager; import net.minecraft.server.packs.resources.ResourceManagerReloadListener; -import net.minecraft.sounds.SoundEvent; -import net.minecraft.sounds.SoundEvents; -import net.minecraft.sounds.SoundSource; -import net.minecraft.tags.FluidTags; -import net.minecraft.util.FastColor; +import net.minecraft.util.ARGB; import net.minecraft.util.Mth; -import net.minecraft.util.ParticleUtils; -import net.minecraft.util.RandomSource; +import net.minecraft.util.VisibleForDebug; +import net.minecraft.util.profiling.Profiler; import net.minecraft.util.profiling.ProfilerFiller; -import net.minecraft.util.valueproviders.IntProvider; -import net.minecraft.util.valueproviders.UniformInt; +import net.minecraft.util.profiling.Zone; import net.minecraft.world.TickRateManager; import net.minecraft.world.effect.MobEffects; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.item.BoneMealItem; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.Items; -import net.minecraft.world.item.JukeboxSong; import net.minecraft.world.level.BlockAndTintGetter; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.ChunkPos; -import net.minecraft.world.level.Level; -import net.minecraft.world.level.LevelReader; import net.minecraft.world.level.LightLayer; -import net.minecraft.world.level.biome.Biome; -import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.block.Blocks; -import net.minecraft.world.level.block.BrushableBlock; -import net.minecraft.world.level.block.CampfireBlock; -import net.minecraft.world.level.block.ComposterBlock; -import net.minecraft.world.level.block.MultifaceBlock; -import net.minecraft.world.level.block.PointedDripstoneBlock; -import net.minecraft.world.level.block.SculkShriekerBlock; -import net.minecraft.world.level.block.SoundType; import net.minecraft.world.level.block.entity.BlockEntity; -import net.minecraft.world.level.block.entity.trialspawner.TrialSpawner; -import net.minecraft.world.level.block.entity.vault.VaultBlockEntity; import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.world.level.block.state.properties.BlockStateProperties; -import net.minecraft.world.level.border.WorldBorder; -import net.minecraft.world.level.levelgen.Heightmap; import net.minecraft.world.level.lighting.LevelLightEngine; -import net.minecraft.world.level.material.FluidState; import net.minecraft.world.level.material.FogType; -import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.BlockHitResult; -import net.minecraft.world.phys.HitResult; import net.minecraft.world.phys.Vec3; +import net.minecraft.world.phys.HitResult.Type; import net.minecraft.world.phys.shapes.CollisionContext; -import net.minecraft.world.phys.shapes.Shapes; -import net.minecraft.world.phys.shapes.VoxelShape; import org.jetbrains.annotations.Nullable; import org.joml.Matrix4f; import org.joml.Matrix4fStack; -import org.joml.Quaternionf; -import org.joml.Vector3d; -import org.joml.Vector3f; import org.joml.Vector4f; import org.slf4j.Logger; @Environment(EnvType.CLIENT) public class LevelRenderer implements ResourceManagerReloadListener, AutoCloseable { private static final Logger LOGGER = LogUtils.getLogger(); + private static final ResourceLocation TRANSPARENCY_POST_CHAIN_ID = ResourceLocation.withDefaultNamespace("transparency"); + private static final ResourceLocation ENTITY_OUTLINE_POST_CHAIN_ID = ResourceLocation.withDefaultNamespace("entity_outline"); public static final int SECTION_SIZE = 16; public static final int HALF_SECTION_SIZE = 8; - private static final float SKY_DISC_RADIUS = 512.0F; - private static final int MIN_FOG_DISTANCE = 32; - private static final int RAIN_RADIUS = 10; - private static final int RAIN_DIAMETER = 21; - private static final int TRANSPARENT_SORT_COUNT = 15; - private static final ResourceLocation MOON_LOCATION = ResourceLocation.withDefaultNamespace("textures/environment/moon_phases.png"); - private static final ResourceLocation SUN_LOCATION = ResourceLocation.withDefaultNamespace("textures/environment/sun.png"); - protected static final ResourceLocation CLOUDS_LOCATION = ResourceLocation.withDefaultNamespace("textures/environment/clouds.png"); - private static final ResourceLocation END_SKY_LOCATION = ResourceLocation.withDefaultNamespace("textures/environment/end_sky.png"); - private static final ResourceLocation FORCEFIELD_LOCATION = ResourceLocation.withDefaultNamespace("textures/misc/forcefield.png"); - private static final ResourceLocation RAIN_LOCATION = ResourceLocation.withDefaultNamespace("textures/environment/rain.png"); - private static final ResourceLocation SNOW_LOCATION = ResourceLocation.withDefaultNamespace("textures/environment/snow.png"); - public static final Direction[] DIRECTIONS = Direction.values(); + public static final int NEARBY_SECTION_DISTANCE_IN_BLOCKS = 32; + private static final int MINIMUM_TRANSPARENT_SORT_COUNT = 15; private final Minecraft minecraft; private final EntityRenderDispatcher entityRenderDispatcher; private final BlockEntityRenderDispatcher blockEntityRenderDispatcher; private final RenderBuffers renderBuffers; + private final SkyRenderer skyRenderer = new SkyRenderer(); + private final CloudRenderer cloudRenderer = new CloudRenderer(); + private final WorldBorderRenderer worldBorderRenderer = new WorldBorderRenderer(); + private final WeatherEffectRenderer weatherEffectRenderer = new WeatherEffectRenderer(); @Nullable private ClientLevel level; private final SectionOcclusionGraph sectionOcclusionGraph = new SectionOcclusionGraph(); private final ObjectArrayList visibleSections = new ObjectArrayList<>(10000); + private final ObjectArrayList nearbyVisibleSections = new ObjectArrayList<>(50); /** * Global block entities; these are always rendered, even if off-screen. * Any block entity is added to this if {@link net.minecraft.client.renderer.blockentity.BlockEntityRenderer#shouldRenderOffScreen(net.minecraft.world.level.block.entity.BlockEntity)} returns {@code true}. @@ -177,36 +127,12 @@ public class LevelRenderer implements ResourceManagerReloadListener, AutoCloseab private final Set globalBlockEntities = Sets.newHashSet(); @Nullable private ViewArea viewArea; - @Nullable - private VertexBuffer starBuffer; - @Nullable - private VertexBuffer skyBuffer; - @Nullable - private VertexBuffer darkBuffer; - private boolean generateClouds = true; - @Nullable - private VertexBuffer cloudBuffer; - private final RunningTrimmedMean frameTimes = new RunningTrimmedMean(100); private int ticks; private final Int2ObjectMap destroyingBlocks = new Int2ObjectOpenHashMap<>(); private final Long2ObjectMap> destructionProgress = new Long2ObjectOpenHashMap<>(); - private final Map playingJukeboxSongs = Maps.newHashMap(); @Nullable - private RenderTarget entityTarget; - @Nullable - private PostChain entityEffect; - @Nullable - private RenderTarget translucentTarget; - @Nullable - private RenderTarget itemEntityTarget; - @Nullable - private RenderTarget particlesTarget; - @Nullable - private RenderTarget weatherTarget; - @Nullable - private RenderTarget cloudsTarget; - @Nullable - private PostChain transparencyChain; + private RenderTarget entityOutlineTarget; + private final LevelTargetBundle targets = new LevelTargetBundle(); private int lastCameraSectionX = Integer.MIN_VALUE; private int lastCameraSectionY = Integer.MIN_VALUE; private int lastCameraSectionZ = Integer.MIN_VALUE; @@ -215,29 +141,18 @@ public class LevelRenderer implements ResourceManagerReloadListener, AutoCloseab private double prevCamZ = Double.MIN_VALUE; private double prevCamRotX = Double.MIN_VALUE; private double prevCamRotY = Double.MIN_VALUE; - private int prevCloudX = Integer.MIN_VALUE; - private int prevCloudY = Integer.MIN_VALUE; - private int prevCloudZ = Integer.MIN_VALUE; - private Vec3 prevCloudColor = Vec3.ZERO; - @Nullable - private CloudStatus prevCloudsType; @Nullable private SectionRenderDispatcher sectionRenderDispatcher; private int lastViewDistance = -1; - private int renderedEntities; - private int culledEntities; + private final List visibleEntities = new ArrayList(); + private int visibleEntityCount; private Frustum cullingFrustum; private boolean captureFrustum; @Nullable private Frustum capturedFrustum; - private final Vector4f[] frustumPoints = new Vector4f[8]; - private final Vector3d frustumPos = new Vector3d(0.0, 0.0, 0.0); - private double xTransparentOld; - private double yTransparentOld; - private double zTransparentOld; - private int rainSoundTime; - private final float[] rainSizeX = new float[1024]; - private final float[] rainSizeZ = new float[1024]; + @Nullable + private BlockPos lastTranslucentSortBlockPos; + private int translucencyResortIterationIndex; public LevelRenderer( Minecraft minecraft, EntityRenderDispatcher entityRenderDispatcher, BlockEntityRenderDispatcher blockEntityRenderDispatcher, RenderBuffers renderBuffers @@ -246,315 +161,47 @@ public class LevelRenderer implements ResourceManagerReloadListener, AutoCloseab this.entityRenderDispatcher = entityRenderDispatcher; this.blockEntityRenderDispatcher = blockEntityRenderDispatcher; this.renderBuffers = renderBuffers; - - for (int i = 0; i < 32; i++) { - for (int j = 0; j < 32; j++) { - float f = j - 16; - float g = i - 16; - float h = Mth.sqrt(f * f + g * g); - this.rainSizeX[i << 5 | j] = -g / h; - this.rainSizeZ[i << 5 | j] = f / h; - } - } - - this.createStars(); - this.createLightSky(); - this.createDarkSky(); } - private void renderSnowAndRain(LightTexture lightTexture, float partialTick, double camX, double camY, double camZ) { - float f = this.minecraft.level.getRainLevel(partialTick); - if (!(f <= 0.0F)) { - lightTexture.turnOnLightLayer(); - Level level = this.minecraft.level; - int i = Mth.floor(camX); - int j = Mth.floor(camY); - int k = Mth.floor(camZ); - Tesselator tesselator = Tesselator.getInstance(); - BufferBuilder bufferBuilder = null; - RenderSystem.disableCull(); - RenderSystem.enableBlend(); - RenderSystem.enableDepthTest(); - int l = 5; - if (Minecraft.useFancyGraphics()) { - l = 10; - } - - RenderSystem.depthMask(Minecraft.useShaderTransparency()); - int m = -1; - float g = this.ticks + partialTick; - RenderSystem.setShader(GameRenderer::getParticleShader); - BlockPos.MutableBlockPos mutableBlockPos = new BlockPos.MutableBlockPos(); - - for (int n = k - l; n <= k + l; n++) { - for (int o = i - l; o <= i + l; o++) { - int p = (n - k + 16) * 32 + o - i + 16; - double d = this.rainSizeX[p] * 0.5; - double e = this.rainSizeZ[p] * 0.5; - mutableBlockPos.set((double)o, camY, (double)n); - Biome biome = level.getBiome(mutableBlockPos).value(); - if (biome.hasPrecipitation()) { - int q = level.getHeight(Heightmap.Types.MOTION_BLOCKING, o, n); - int r = j - l; - int s = j + l; - if (r < q) { - r = q; - } - - if (s < q) { - s = q; - } - - int t = q; - if (q < j) { - t = j; - } - - if (r != s) { - RandomSource randomSource = RandomSource.create(o * o * 3121 + o * 45238971 ^ n * n * 418711 + n * 13761); - mutableBlockPos.set(o, r, n); - Biome.Precipitation precipitation = biome.getPrecipitationAt(mutableBlockPos); - if (precipitation == Biome.Precipitation.RAIN) { - if (m != 0) { - if (m >= 0) { - BufferUploader.drawWithShader(bufferBuilder.buildOrThrow()); - } - - m = 0; - RenderSystem.setShaderTexture(0, RAIN_LOCATION); - bufferBuilder = tesselator.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.PARTICLE); - } - - int u = this.ticks & 131071; - int v = o * o * 3121 + o * 45238971 + n * n * 418711 + n * 13761 & 0xFF; - float h = 3.0F + randomSource.nextFloat(); - float w = -(u + v + partialTick) / 32.0F * h; - float x = w % 32.0F; - double y = o + 0.5 - camX; - double z = n + 0.5 - camZ; - float aa = (float)Math.sqrt(y * y + z * z) / l; - float ab = ((1.0F - aa * aa) * 0.5F + 0.5F) * f; - mutableBlockPos.set(o, t, n); - int ac = getLightColor(level, mutableBlockPos); - bufferBuilder.addVertex((float)(o - camX - d + 0.5), (float)(s - camY), (float)(n - camZ - e + 0.5)) - .setUv(0.0F, r * 0.25F + x) - .setColor(1.0F, 1.0F, 1.0F, ab) - .setLight(ac); - bufferBuilder.addVertex((float)(o - camX + d + 0.5), (float)(s - camY), (float)(n - camZ + e + 0.5)) - .setUv(1.0F, r * 0.25F + x) - .setColor(1.0F, 1.0F, 1.0F, ab) - .setLight(ac); - bufferBuilder.addVertex((float)(o - camX + d + 0.5), (float)(r - camY), (float)(n - camZ + e + 0.5)) - .setUv(1.0F, s * 0.25F + x) - .setColor(1.0F, 1.0F, 1.0F, ab) - .setLight(ac); - bufferBuilder.addVertex((float)(o - camX - d + 0.5), (float)(r - camY), (float)(n - camZ - e + 0.5)) - .setUv(0.0F, s * 0.25F + x) - .setColor(1.0F, 1.0F, 1.0F, ab) - .setLight(ac); - } else if (precipitation == Biome.Precipitation.SNOW) { - if (m != 1) { - if (m >= 0) { - BufferUploader.drawWithShader(bufferBuilder.buildOrThrow()); - } - - m = 1; - RenderSystem.setShaderTexture(0, SNOW_LOCATION); - bufferBuilder = tesselator.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.PARTICLE); - } - - float ad = -((this.ticks & 511) + partialTick) / 512.0F; - float ae = (float)(randomSource.nextDouble() + g * 0.01 * (float)randomSource.nextGaussian()); - float h = (float)(randomSource.nextDouble() + g * (float)randomSource.nextGaussian() * 0.001); - double af = o + 0.5 - camX; - double y = n + 0.5 - camZ; - float ag = (float)Math.sqrt(af * af + y * y) / l; - float ah = ((1.0F - ag * ag) * 0.3F + 0.5F) * f; - mutableBlockPos.set(o, t, n); - int ai = getLightColor(level, mutableBlockPos); - int aj = ai >> 16 & 65535; - int ac = ai & 65535; - int ak = (aj * 3 + 240) / 4; - int al = (ac * 3 + 240) / 4; - bufferBuilder.addVertex((float)(o - camX - d + 0.5), (float)(s - camY), (float)(n - camZ - e + 0.5)) - .setUv(0.0F + ae, r * 0.25F + ad + h) - .setColor(1.0F, 1.0F, 1.0F, ah) - .setUv2(al, ak); - bufferBuilder.addVertex((float)(o - camX + d + 0.5), (float)(s - camY), (float)(n - camZ + e + 0.5)) - .setUv(1.0F + ae, r * 0.25F + ad + h) - .setColor(1.0F, 1.0F, 1.0F, ah) - .setUv2(al, ak); - bufferBuilder.addVertex((float)(o - camX + d + 0.5), (float)(r - camY), (float)(n - camZ + e + 0.5)) - .setUv(1.0F + ae, s * 0.25F + ad + h) - .setColor(1.0F, 1.0F, 1.0F, ah) - .setUv2(al, ak); - bufferBuilder.addVertex((float)(o - camX - d + 0.5), (float)(r - camY), (float)(n - camZ - e + 0.5)) - .setUv(0.0F + ae, s * 0.25F + ad + h) - .setColor(1.0F, 1.0F, 1.0F, ah) - .setUv2(al, ak); - } - } - } - } - } - - if (m >= 0) { - BufferUploader.drawWithShader(bufferBuilder.buildOrThrow()); - } - - RenderSystem.enableCull(); - RenderSystem.disableBlend(); - lightTexture.turnOffLightLayer(); - } - } - - public void tickRain(Camera camera) { - float f = this.minecraft.level.getRainLevel(1.0F) / (Minecraft.useFancyGraphics() ? 1.0F : 2.0F); - if (!(f <= 0.0F)) { - RandomSource randomSource = RandomSource.create(this.ticks * 312987231L); - LevelReader levelReader = this.minecraft.level; - BlockPos blockPos = BlockPos.containing(camera.getPosition()); - BlockPos blockPos2 = null; - int i = (int)(100.0F * f * f) / (this.minecraft.options.particles().get() == ParticleStatus.DECREASED ? 2 : 1); - - for (int j = 0; j < i; j++) { - int k = randomSource.nextInt(21) - 10; - int l = randomSource.nextInt(21) - 10; - BlockPos blockPos3 = levelReader.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, blockPos.offset(k, 0, l)); - if (blockPos3.getY() > levelReader.getMinBuildHeight() && blockPos3.getY() <= blockPos.getY() + 10 && blockPos3.getY() >= blockPos.getY() - 10) { - Biome biome = levelReader.getBiome(blockPos3).value(); - if (biome.getPrecipitationAt(blockPos3) == Biome.Precipitation.RAIN) { - blockPos2 = blockPos3.below(); - if (this.minecraft.options.particles().get() == ParticleStatus.MINIMAL) { - break; - } - - double d = randomSource.nextDouble(); - double e = randomSource.nextDouble(); - BlockState blockState = levelReader.getBlockState(blockPos2); - FluidState fluidState = levelReader.getFluidState(blockPos2); - VoxelShape voxelShape = blockState.getCollisionShape(levelReader, blockPos2); - double g = voxelShape.max(Direction.Axis.Y, d, e); - double h = fluidState.getHeight(levelReader, blockPos2); - double m = Math.max(g, h); - ParticleOptions particleOptions = !fluidState.is(FluidTags.LAVA) && !blockState.is(Blocks.MAGMA_BLOCK) && !CampfireBlock.isLitCampfire(blockState) - ? ParticleTypes.RAIN - : ParticleTypes.SMOKE; - this.minecraft.level.addParticle(particleOptions, blockPos2.getX() + d, blockPos2.getY() + m, blockPos2.getZ() + e, 0.0, 0.0, 0.0); - } - } - } - - if (blockPos2 != null && randomSource.nextInt(3) < this.rainSoundTime++) { - this.rainSoundTime = 0; - if (blockPos2.getY() > blockPos.getY() + 1 - && levelReader.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, blockPos).getY() > Mth.floor((float)blockPos.getY())) { - this.minecraft.level.playLocalSound(blockPos2, SoundEvents.WEATHER_RAIN_ABOVE, SoundSource.WEATHER, 0.1F, 0.5F, false); - } else { - this.minecraft.level.playLocalSound(blockPos2, SoundEvents.WEATHER_RAIN, SoundSource.WEATHER, 0.2F, 1.0F, false); - } - } - } + public void tickParticles(Camera camera) { + this.weatherEffectRenderer.tickRainParticles(this.minecraft.level, camera, this.ticks, this.minecraft.options.particles().get()); } public void close() { - if (this.entityEffect != null) { - this.entityEffect.close(); + if (this.entityOutlineTarget != null) { + this.entityOutlineTarget.destroyBuffers(); } - if (this.transparencyChain != null) { - this.transparencyChain.close(); - } + this.skyRenderer.close(); + this.cloudRenderer.close(); } @Override public void onResourceManagerReload(ResourceManager resourceManager) { this.initOutline(); - if (Minecraft.useShaderTransparency()) { - this.initTransparency(); - } } public void initOutline() { - if (this.entityEffect != null) { - this.entityEffect.close(); + if (this.entityOutlineTarget != null) { + this.entityOutlineTarget.destroyBuffers(); } - ResourceLocation resourceLocation = ResourceLocation.withDefaultNamespace("shaders/post/entity_outline.json"); - - try { - this.entityEffect = new PostChain( - this.minecraft.getTextureManager(), this.minecraft.getResourceManager(), this.minecraft.getMainRenderTarget(), resourceLocation - ); - this.entityEffect.resize(this.minecraft.getWindow().getWidth(), this.minecraft.getWindow().getHeight()); - this.entityTarget = this.entityEffect.getTempTarget("final"); - } catch (IOException var3) { - LOGGER.warn("Failed to load shader: {}", resourceLocation, var3); - this.entityEffect = null; - this.entityTarget = null; - } catch (JsonSyntaxException var4) { - LOGGER.warn("Failed to parse shader: {}", resourceLocation, var4); - this.entityEffect = null; - this.entityTarget = null; - } + this.entityOutlineTarget = new TextureTarget(this.minecraft.getWindow().getWidth(), this.minecraft.getWindow().getHeight(), true); + this.entityOutlineTarget.setClearColor(0.0F, 0.0F, 0.0F, 0.0F); } - private void initTransparency() { - this.deinitTransparency(); - ResourceLocation resourceLocation = ResourceLocation.withDefaultNamespace("shaders/post/transparency.json"); - - try { - PostChain postChain = new PostChain( - this.minecraft.getTextureManager(), this.minecraft.getResourceManager(), this.minecraft.getMainRenderTarget(), resourceLocation - ); - postChain.resize(this.minecraft.getWindow().getWidth(), this.minecraft.getWindow().getHeight()); - RenderTarget renderTarget = postChain.getTempTarget("translucent"); - RenderTarget renderTarget2 = postChain.getTempTarget("itemEntity"); - RenderTarget renderTarget3 = postChain.getTempTarget("particles"); - RenderTarget renderTarget4 = postChain.getTempTarget("weather"); - RenderTarget renderTarget5 = postChain.getTempTarget("clouds"); - this.transparencyChain = postChain; - this.translucentTarget = renderTarget; - this.itemEntityTarget = renderTarget2; - this.particlesTarget = renderTarget3; - this.weatherTarget = renderTarget4; - this.cloudsTarget = renderTarget5; - } catch (Exception var8) { - String string = var8 instanceof JsonSyntaxException ? "parse" : "load"; - String string2 = "Failed to " + string + " shader: " + resourceLocation; - LevelRenderer.TransparencyShaderException transparencyShaderException = new LevelRenderer.TransparencyShaderException(string2, var8); - if (this.minecraft.getResourcePackRepository().getSelectedIds().size() > 1) { - Component component = (Component)this.minecraft - .getResourceManager() - .listPacks() - .findFirst() - .map(packResources -> Component.literal(packResources.packId())) - .orElse(null); - this.minecraft.options.graphicsMode().set(GraphicsStatus.FANCY); - this.minecraft.clearResourcePacksOnError(transparencyShaderException, component, null); - } else { + @Nullable + private PostChain getTransparencyChain() { + if (!Minecraft.useShaderTransparency()) { + return null; + } else { + PostChain postChain = this.minecraft.getShaderManager().getPostChain(TRANSPARENCY_POST_CHAIN_ID, LevelTargetBundle.SORTING_TARGETS); + if (postChain == null) { this.minecraft.options.graphicsMode().set(GraphicsStatus.FANCY); this.minecraft.options.save(); - LOGGER.error(LogUtils.FATAL_MARKER, string2, (Throwable)transparencyShaderException); - this.minecraft.emergencySaveAndCrash(new CrashReport(string2, transparencyShaderException)); } - } - } - private void deinitTransparency() { - if (this.transparencyChain != null) { - this.transparencyChain.close(); - this.translucentTarget.destroyBuffers(); - this.itemEntityTarget.destroyBuffers(); - this.particlesTarget.destroyBuffers(); - this.weatherTarget.destroyBuffers(); - this.cloudsTarget.destroyBuffers(); - this.transparencyChain = null; - this.translucentTarget = null; - this.itemEntityTarget = null; - this.particlesTarget = null; - this.weatherTarget = null; - this.cloudsTarget = null; + return postChain; } } @@ -564,86 +211,14 @@ public class LevelRenderer implements ResourceManagerReloadListener, AutoCloseab RenderSystem.blendFuncSeparate( GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ZERO, GlStateManager.DestFactor.ONE ); - this.entityTarget.blitToScreen(this.minecraft.getWindow().getWidth(), this.minecraft.getWindow().getHeight(), false); + this.entityOutlineTarget.blitAndBlendToScreen(this.minecraft.getWindow().getWidth(), this.minecraft.getWindow().getHeight()); RenderSystem.disableBlend(); RenderSystem.defaultBlendFunc(); } } protected boolean shouldShowEntityOutlines() { - return !this.minecraft.gameRenderer.isPanoramicMode() && this.entityTarget != null && this.entityEffect != null && this.minecraft.player != null; - } - - private void createDarkSky() { - if (this.darkBuffer != null) { - this.darkBuffer.close(); - } - - this.darkBuffer = new VertexBuffer(VertexBuffer.Usage.STATIC); - this.darkBuffer.bind(); - this.darkBuffer.upload(buildSkyDisc(Tesselator.getInstance(), -16.0F)); - VertexBuffer.unbind(); - } - - private void createLightSky() { - if (this.skyBuffer != null) { - this.skyBuffer.close(); - } - - this.skyBuffer = new VertexBuffer(VertexBuffer.Usage.STATIC); - this.skyBuffer.bind(); - this.skyBuffer.upload(buildSkyDisc(Tesselator.getInstance(), 16.0F)); - VertexBuffer.unbind(); - } - - private static MeshData buildSkyDisc(Tesselator tesselator, float y) { - float f = Math.signum(y) * 512.0F; - float g = 512.0F; - BufferBuilder bufferBuilder = tesselator.begin(VertexFormat.Mode.TRIANGLE_FAN, DefaultVertexFormat.POSITION); - bufferBuilder.addVertex(0.0F, y, 0.0F); - - for (int i = -180; i <= 180; i += 45) { - bufferBuilder.addVertex(f * Mth.cos(i * (float) (Math.PI / 180.0)), y, 512.0F * Mth.sin(i * (float) (Math.PI / 180.0))); - } - - return bufferBuilder.buildOrThrow(); - } - - private void createStars() { - if (this.starBuffer != null) { - this.starBuffer.close(); - } - - this.starBuffer = new VertexBuffer(VertexBuffer.Usage.STATIC); - this.starBuffer.bind(); - this.starBuffer.upload(this.drawStars(Tesselator.getInstance())); - VertexBuffer.unbind(); - } - - private MeshData drawStars(Tesselator tesselator) { - RandomSource randomSource = RandomSource.create(10842L); - int i = 1500; - float f = 100.0F; - BufferBuilder bufferBuilder = tesselator.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION); - - for (int j = 0; j < 1500; j++) { - float g = randomSource.nextFloat() * 2.0F - 1.0F; - float h = randomSource.nextFloat() * 2.0F - 1.0F; - float k = randomSource.nextFloat() * 2.0F - 1.0F; - float l = 0.15F + randomSource.nextFloat() * 0.1F; - float m = Mth.lengthSquared(g, h, k); - if (!(m <= 0.010000001F) && !(m >= 1.0F)) { - Vector3f vector3f = new Vector3f(g, h, k).normalize(100.0F); - float n = (float)(randomSource.nextDouble() * (float) Math.PI * 2.0); - Quaternionf quaternionf = new Quaternionf().rotateTo(new Vector3f(0.0F, 0.0F, -1.0F), vector3f).rotateZ(n); - bufferBuilder.addVertex(vector3f.add(new Vector3f(l, -l, 0.0F).rotate(quaternionf))); - bufferBuilder.addVertex(vector3f.add(new Vector3f(l, l, 0.0F).rotate(quaternionf))); - bufferBuilder.addVertex(vector3f.add(new Vector3f(-l, l, 0.0F).rotate(quaternionf))); - bufferBuilder.addVertex(vector3f.add(new Vector3f(-l, -l, 0.0F).rotate(quaternionf))); - } - } - - return bufferBuilder.buildOrThrow(); + return !this.minecraft.gameRenderer.isPanoramicMode() && this.entityOutlineTarget != null && this.minecraft.player != null; } /** @@ -670,16 +245,13 @@ public class LevelRenderer implements ResourceManagerReloadListener, AutoCloseab this.sectionRenderDispatcher = null; this.globalBlockEntities.clear(); this.sectionOcclusionGraph.waitAndReset(null); - this.visibleSections.clear(); + this.clearVisibleSections(); } } - public void graphicsChanged() { - if (Minecraft.useShaderTransparency()) { - this.initTransparency(); - } else { - this.deinitTransparency(); - } + private void clearVisibleSections() { + this.visibleSections.clear(); + this.nearbyVisibleSections.clear(); } /** @@ -687,7 +259,6 @@ public class LevelRenderer implements ResourceManagerReloadListener, AutoCloseab */ public void allChanged() { if (this.level != null) { - this.graphicsChanged(); this.level.clearTintCaches(); if (this.sectionRenderDispatcher == null) { this.sectionRenderDispatcher = new SectionRenderDispatcher( @@ -697,7 +268,7 @@ public class LevelRenderer implements ResourceManagerReloadListener, AutoCloseab this.sectionRenderDispatcher.setLevel(this.level); } - this.generateClouds = true; + this.cloudRenderer.markForRebuild(); ItemBlockRenderTypes.setFancy(Minecraft.useFancyGraphics()); this.lastViewDistance = this.minecraft.options.getEffectiveRenderDistance(); if (this.viewArea != null) { @@ -711,22 +282,18 @@ public class LevelRenderer implements ResourceManagerReloadListener, AutoCloseab this.viewArea = new ViewArea(this.sectionRenderDispatcher, this.level, this.minecraft.options.getEffectiveRenderDistance(), this); this.sectionOcclusionGraph.waitAndReset(this.viewArea); - this.visibleSections.clear(); + this.clearVisibleSections(); Entity entity = this.minecraft.getCameraEntity(); if (entity != null) { - this.viewArea.repositionCamera(entity.getX(), entity.getZ()); + this.viewArea.repositionCamera(SectionPos.of(entity)); } } } public void resize(int width, int height) { this.needsUpdate(); - if (this.entityEffect != null) { - this.entityEffect.resize(width, height); - } - - if (this.transparencyChain != null) { - this.transparencyChain.resize(width, height); + if (this.entityOutlineTarget != null) { + this.entityOutlineTarget.resize(width, height); } } @@ -760,7 +327,7 @@ public class LevelRenderer implements ResourceManagerReloadListener, AutoCloseab int i = 0; for (SectionRenderDispatcher.RenderSection renderSection : this.visibleSections) { - if (!renderSection.getCompiled().hasNoRenderableLayers()) { + if (renderSection.getCompiled().hasRenderableLayers()) { i++; } } @@ -772,14 +339,7 @@ public class LevelRenderer implements ResourceManagerReloadListener, AutoCloseab * @return entity rendering statistics to display on the {@linkplain net.minecraft.client.gui.components.DebugScreenOverlay debug overlay} */ public String getEntityStatistics() { - return "E: " - + this.renderedEntities - + "/" - + this.level.getEntityCount() - + ", B: " - + this.culledEntities - + ", SD: " - + this.level.getServerSimulationDistance(); + return "E: " + this.visibleEntityCount + "/" + this.level.getEntityCount() + ", SD: " + this.level.getServerSimulationDistance(); } private void setupRender(Camera camera, Frustum frustum, boolean hasCapturedFrustum, boolean isSpectator) { @@ -788,55 +348,50 @@ public class LevelRenderer implements ResourceManagerReloadListener, AutoCloseab this.allChanged(); } - this.level.getProfiler().push("camera"); - double d = this.minecraft.player.getX(); - double e = this.minecraft.player.getY(); - double f = this.minecraft.player.getZ(); - int i = SectionPos.posToSectionCoord(d); - int j = SectionPos.posToSectionCoord(e); - int k = SectionPos.posToSectionCoord(f); + ProfilerFiller profilerFiller = Profiler.get(); + profilerFiller.push("camera"); + int i = SectionPos.posToSectionCoord(vec3.x()); + int j = SectionPos.posToSectionCoord(vec3.y()); + int k = SectionPos.posToSectionCoord(vec3.z()); if (this.lastCameraSectionX != i || this.lastCameraSectionY != j || this.lastCameraSectionZ != k) { this.lastCameraSectionX = i; this.lastCameraSectionY = j; this.lastCameraSectionZ = k; - this.viewArea.repositionCamera(d, f); + this.viewArea.repositionCamera(SectionPos.of(vec3)); } this.sectionRenderDispatcher.setCamera(vec3); - this.level.getProfiler().popPush("cull"); - this.minecraft.getProfiler().popPush("culling"); - BlockPos blockPos = camera.getBlockPosition(); - double g = Math.floor(vec3.x / 8.0); - double h = Math.floor(vec3.y / 8.0); - double l = Math.floor(vec3.z / 8.0); - if (g != this.prevCamX || h != this.prevCamY || l != this.prevCamZ) { + profilerFiller.popPush("cull"); + double d = Math.floor(vec3.x / 8.0); + double e = Math.floor(vec3.y / 8.0); + double f = Math.floor(vec3.z / 8.0); + if (d != this.prevCamX || e != this.prevCamY || f != this.prevCamZ) { this.sectionOcclusionGraph.invalidate(); } - this.prevCamX = g; - this.prevCamY = h; - this.prevCamZ = l; - this.minecraft.getProfiler().popPush("update"); + this.prevCamX = d; + this.prevCamY = e; + this.prevCamZ = f; + profilerFiller.popPush("update"); if (!hasCapturedFrustum) { boolean bl = this.minecraft.smartCull; - if (isSpectator && this.level.getBlockState(blockPos).isSolidRender(this.level, blockPos)) { + if (isSpectator && this.level.getBlockState(camera.getBlockPosition()).isSolidRender()) { bl = false; } - Entity.setViewScale(Mth.clamp(this.minecraft.options.getEffectiveRenderDistance() / 8.0, 1.0, 2.5) * this.minecraft.options.entityDistanceScaling().get()); - this.minecraft.getProfiler().push("section_occlusion_graph"); - this.sectionOcclusionGraph.update(bl, camera, frustum, this.visibleSections); - this.minecraft.getProfiler().pop(); - double m = Math.floor(camera.getXRot() / 2.0F); - double n = Math.floor(camera.getYRot() / 2.0F); - if (this.sectionOcclusionGraph.consumeFrustumUpdate() || m != this.prevCamRotX || n != this.prevCamRotY) { + profilerFiller.push("section_occlusion_graph"); + this.sectionOcclusionGraph.update(bl, camera, frustum, this.visibleSections, this.level.getChunkSource().getLoadedEmptySections()); + profilerFiller.pop(); + double g = Math.floor(camera.getXRot() / 2.0F); + double h = Math.floor(camera.getYRot() / 2.0F); + if (this.sectionOcclusionGraph.consumeFrustumUpdate() || g != this.prevCamRotX || h != this.prevCamRotY) { this.applyFrustum(offsetFrustum(frustum)); - this.prevCamRotX = m; - this.prevCamRotY = n; + this.prevCamRotX = g; + this.prevCamRotY = h; } } - this.minecraft.getProfiler().pop(); + profilerFiller.pop(); } public static Frustum offsetFrustum(Frustum frustum) { @@ -847,38 +402,15 @@ public class LevelRenderer implements ResourceManagerReloadListener, AutoCloseab if (!Minecraft.getInstance().isSameThread()) { throw new IllegalStateException("applyFrustum called from wrong thread: " + Thread.currentThread().getName()); } else { - this.minecraft.getProfiler().push("apply_frustum"); - this.visibleSections.clear(); - this.sectionOcclusionGraph.addSectionsInFrustum(frustum, this.visibleSections); - this.minecraft.getProfiler().pop(); + Profiler.get().push("apply_frustum"); + this.clearVisibleSections(); + this.sectionOcclusionGraph.addSectionsInFrustum(frustum, this.visibleSections, this.nearbyVisibleSections); + Profiler.get().pop(); } } public void addRecentlyCompiledSection(SectionRenderDispatcher.RenderSection renderSection) { - this.sectionOcclusionGraph.onSectionCompiled(renderSection); - } - - private void captureFrustum(Matrix4f viewMatrix, Matrix4f projectionMatrix, double camX, double camY, double camZ, Frustum capturedFrustrum) { - this.capturedFrustum = capturedFrustrum; - Matrix4f matrix4f = new Matrix4f(projectionMatrix); - matrix4f.mul(viewMatrix); - matrix4f.invert(); - this.frustumPos.x = camX; - this.frustumPos.y = camY; - this.frustumPos.z = camZ; - this.frustumPoints[0] = new Vector4f(-1.0F, -1.0F, -1.0F, 1.0F); - this.frustumPoints[1] = new Vector4f(1.0F, -1.0F, -1.0F, 1.0F); - this.frustumPoints[2] = new Vector4f(1.0F, 1.0F, -1.0F, 1.0F); - this.frustumPoints[3] = new Vector4f(-1.0F, 1.0F, -1.0F, 1.0F); - this.frustumPoints[4] = new Vector4f(-1.0F, -1.0F, 1.0F, 1.0F); - this.frustumPoints[5] = new Vector4f(1.0F, -1.0F, 1.0F, 1.0F); - this.frustumPoints[6] = new Vector4f(1.0F, 1.0F, 1.0F, 1.0F); - this.frustumPoints[7] = new Vector4f(-1.0F, 1.0F, 1.0F, 1.0F); - - for (int i = 0; i < 8; i++) { - matrix4f.transform(this.frustumPoints[i]); - this.frustumPoints[i].div(this.frustumPoints[i].w()); - } + this.sectionOcclusionGraph.schedulePropagationFrom(renderSection); } public void prepareCullFrustum(Vec3 cameraPosition, Matrix4f frustumMatrix, Matrix4f projectionMatrix) { @@ -887,20 +419,20 @@ public class LevelRenderer implements ResourceManagerReloadListener, AutoCloseab } public void renderLevel( + GraphicsResourceAllocator graphicsResourceAllocator, DeltaTracker deltaTracker, - boolean renderBlockOutline, + boolean bl, Camera camera, GameRenderer gameRenderer, LightTexture lightTexture, - Matrix4f frustumMatrix, - Matrix4f projectionMatrix + Matrix4f matrix4f, + Matrix4f matrix4f2 ) { - TickRateManager tickRateManager = this.minecraft.level.tickRateManager(); float f = deltaTracker.getGameTimeDeltaPartialTick(false); RenderSystem.setShaderGameTime(this.level.getGameTime(), f); this.blockEntityRenderDispatcher.prepare(this.level, camera, this.minecraft.hitResult); this.entityRenderDispatcher.prepare(this.level, camera, this.minecraft.crosshairPickEntity); - ProfilerFiller profilerFiller = this.level.getProfiler(); + final ProfilerFiller profilerFiller = Profiler.get(); profilerFiller.popPush("light_update_queue"); this.level.pollLightUpdates(); profilerFiller.popPush("light_updates"); @@ -910,134 +442,407 @@ public class LevelRenderer implements ResourceManagerReloadListener, AutoCloseab double e = vec3.y(); double g = vec3.z(); profilerFiller.popPush("culling"); - boolean bl = this.capturedFrustum != null; - Frustum frustum; - if (bl) { - frustum = this.capturedFrustum; - frustum.prepare(this.frustumPos.x, this.frustumPos.y, this.frustumPos.z); - } else { - frustum = this.cullingFrustum; - } - - this.minecraft.getProfiler().popPush("captureFrustum"); + boolean bl2 = this.capturedFrustum != null; + Frustum frustum = bl2 ? this.capturedFrustum : this.cullingFrustum; + Profiler.get().popPush("captureFrustum"); if (this.captureFrustum) { - this.captureFrustum(frustumMatrix, projectionMatrix, vec3.x, vec3.y, vec3.z, bl ? new Frustum(frustumMatrix, projectionMatrix) : frustum); + this.capturedFrustum = bl2 ? new Frustum(matrix4f, matrix4f2) : frustum; + this.capturedFrustum.prepare(d, e, g); this.captureFrustum = false; } - profilerFiller.popPush("clear"); - FogRenderer.setupColor(camera, f, this.minecraft.level, this.minecraft.options.getEffectiveRenderDistance(), gameRenderer.getDarkenWorldAmount(f)); - FogRenderer.levelFogColor(); - RenderSystem.clear(16640, Minecraft.ON_OSX); - float h = gameRenderer.getRenderDistance(); - boolean bl2 = this.minecraft.level.effects().isFoggyAt(Mth.floor(d), Mth.floor(e)) || this.minecraft.gui.getBossOverlay().shouldCreateWorldFog(); - profilerFiller.popPush("sky"); - RenderSystem.setShader(GameRenderer::getPositionShader); - this.renderSky(frustumMatrix, projectionMatrix, f, camera, bl2, () -> FogRenderer.setupFog(camera, FogRenderer.FogMode.FOG_SKY, h, bl2, f)); profilerFiller.popPush("fog"); - FogRenderer.setupFog(camera, FogRenderer.FogMode.FOG_TERRAIN, Math.max(h, 32.0F), bl2, f); + float h = gameRenderer.getRenderDistance(); + boolean bl3 = this.minecraft.level.effects().isFoggyAt(Mth.floor(d), Mth.floor(e)) || this.minecraft.gui.getBossOverlay().shouldCreateWorldFog(); + Vector4f vector4f = FogRenderer.computeFogColor( + camera, f, this.minecraft.level, this.minecraft.options.getEffectiveRenderDistance(), gameRenderer.getDarkenWorldAmount(f) + ); + FogParameters fogParameters = FogRenderer.setupFog(camera, FogRenderer.FogMode.FOG_TERRAIN, vector4f, h, bl3, f); + FogParameters fogParameters2 = FogRenderer.setupFog(camera, FogRenderer.FogMode.FOG_SKY, vector4f, h, bl3, f); + profilerFiller.popPush("cullEntities"); + boolean bl4 = this.collectVisibleEntities(camera, frustum, this.visibleEntities); + this.visibleEntityCount = this.visibleEntities.size(); profilerFiller.popPush("terrain_setup"); - this.setupRender(camera, frustum, bl, this.minecraft.player.isSpectator()); + this.setupRender(camera, frustum, bl2, this.minecraft.player.isSpectator()); profilerFiller.popPush("compile_sections"); this.compileSections(camera); - profilerFiller.popPush("terrain"); - this.renderSectionLayer(RenderType.solid(), d, e, g, frustumMatrix, projectionMatrix); - this.renderSectionLayer(RenderType.cutoutMipped(), d, e, g, frustumMatrix, projectionMatrix); - this.renderSectionLayer(RenderType.cutout(), d, e, g, frustumMatrix, projectionMatrix); - if (this.level.effects().constantAmbientLight()) { - Lighting.setupNetherLevel(); - } else { - Lighting.setupLevel(); - } - - profilerFiller.popPush("entities"); - this.renderedEntities = 0; - this.culledEntities = 0; - if (this.itemEntityTarget != null) { - this.itemEntityTarget.clear(Minecraft.ON_OSX); - this.itemEntityTarget.copyDepthFrom(this.minecraft.getMainRenderTarget()); - this.minecraft.getMainRenderTarget().bindWrite(false); - } - - if (this.weatherTarget != null) { - this.weatherTarget.clear(Minecraft.ON_OSX); - } - - if (this.shouldShowEntityOutlines()) { - this.entityTarget.clear(Minecraft.ON_OSX); - this.minecraft.getMainRenderTarget().bindWrite(false); - } - Matrix4fStack matrix4fStack = RenderSystem.getModelViewStack(); matrix4fStack.pushMatrix(); - matrix4fStack.mul(frustumMatrix); - RenderSystem.applyModelViewMatrix(); - boolean bl3 = false; - PoseStack poseStack = new PoseStack(); - MultiBufferSource.BufferSource bufferSource = this.renderBuffers.bufferSource(); + matrix4fStack.mul(matrix4f); + FrameGraphBuilder frameGraphBuilder = new FrameGraphBuilder(); + this.targets.main = frameGraphBuilder.importExternal("main", this.minecraft.getMainRenderTarget()); + int i = this.minecraft.getMainRenderTarget().width; + int j = this.minecraft.getMainRenderTarget().height; + RenderTargetDescriptor renderTargetDescriptor = new RenderTargetDescriptor(i, j, true); + PostChain postChain = this.getTransparencyChain(); + if (postChain != null) { + this.targets.translucent = frameGraphBuilder.createInternal("translucent", renderTargetDescriptor); + this.targets.itemEntity = frameGraphBuilder.createInternal("item_entity", renderTargetDescriptor); + this.targets.particles = frameGraphBuilder.createInternal("particles", renderTargetDescriptor); + this.targets.weather = frameGraphBuilder.createInternal("weather", renderTargetDescriptor); + this.targets.clouds = frameGraphBuilder.createInternal("clouds", renderTargetDescriptor); + } + + if (this.entityOutlineTarget != null) { + this.targets.entityOutline = frameGraphBuilder.importExternal("entity_outline", this.entityOutlineTarget); + } + + FramePass framePass = frameGraphBuilder.addPass("clear"); + this.targets.main = framePass.readsAndWrites(this.targets.main); + framePass.executes(() -> { + RenderSystem.clearColor(vector4f.x, vector4f.y, vector4f.z, 0.0F); + RenderSystem.clear(16640); + }); + if (!bl3) { + this.addSkyPass(frameGraphBuilder, camera, f, fogParameters2); + } + + this.addMainPass(frameGraphBuilder, frustum, camera, matrix4f, matrix4f2, fogParameters, bl, bl4, deltaTracker, profilerFiller); + PostChain postChain2 = this.minecraft.getShaderManager().getPostChain(ENTITY_OUTLINE_POST_CHAIN_ID, LevelTargetBundle.OUTLINE_TARGETS); + if (bl4 && postChain2 != null) { + postChain2.addToFrame(frameGraphBuilder, i, j, this.targets); + } + + this.addParticlesPass(frameGraphBuilder, camera, lightTexture, f, fogParameters); + CloudStatus cloudStatus = this.minecraft.options.getCloudsType(); + if (cloudStatus != CloudStatus.OFF) { + float k = this.level.effects().getCloudHeight(); + if (!Float.isNaN(k)) { + float l = this.ticks + f; + int m = this.level.getCloudColor(f); + this.addCloudsPass(frameGraphBuilder, matrix4f, matrix4f2, cloudStatus, camera.getPosition(), l, m, k + 0.33F); + } + } + + this.addWeatherPass(frameGraphBuilder, lightTexture, camera.getPosition(), f, fogParameters); + if (postChain != null) { + postChain.addToFrame(frameGraphBuilder, i, j, this.targets); + } + + this.addLateDebugPass(frameGraphBuilder, vec3, fogParameters); + profilerFiller.popPush("framegraph"); + frameGraphBuilder.execute(graphicsResourceAllocator, new FrameGraphBuilder.Inspector() { + @Override + public void beforeExecutePass(String string) { + profilerFiller.push(string); + } + + @Override + public void afterExecutePass(String string) { + profilerFiller.pop(); + } + }); + this.minecraft.getMainRenderTarget().bindWrite(false); + this.visibleEntities.clear(); + this.targets.clear(); + matrix4fStack.popMatrix(); + RenderSystem.depthMask(true); + RenderSystem.disableBlend(); + RenderSystem.setShaderFog(FogParameters.NO_FOG); + } + + private void addMainPass( + FrameGraphBuilder frameGraphBuilder, + Frustum frustum, + Camera camera, + Matrix4f matrix4f, + Matrix4f matrix4f2, + FogParameters fogParameters, + boolean bl, + boolean bl2, + DeltaTracker deltaTracker, + ProfilerFiller profilerFiller + ) { + FramePass framePass = frameGraphBuilder.addPass("main"); + this.targets.main = framePass.readsAndWrites(this.targets.main); + if (this.targets.translucent != null) { + this.targets.translucent = framePass.readsAndWrites(this.targets.translucent); + } + + if (this.targets.itemEntity != null) { + this.targets.itemEntity = framePass.readsAndWrites(this.targets.itemEntity); + } + + if (this.targets.weather != null) { + this.targets.weather = framePass.readsAndWrites(this.targets.weather); + } + + if (bl2 && this.targets.entityOutline != null) { + this.targets.entityOutline = framePass.readsAndWrites(this.targets.entityOutline); + } + + ResourceHandle resourceHandle = this.targets.main; + ResourceHandle resourceHandle2 = this.targets.translucent; + ResourceHandle resourceHandle3 = this.targets.itemEntity; + ResourceHandle resourceHandle4 = this.targets.weather; + ResourceHandle resourceHandle5 = this.targets.entityOutline; + framePass.executes(() -> { + RenderSystem.setShaderFog(fogParameters); + float f = deltaTracker.getGameTimeDeltaPartialTick(false); + Vec3 vec3 = camera.getPosition(); + double d = vec3.x(); + double e = vec3.y(); + double g = vec3.z(); + profilerFiller.push("terrain"); + this.renderSectionLayer(RenderType.solid(), d, e, g, matrix4f, matrix4f2); + this.renderSectionLayer(RenderType.cutoutMipped(), d, e, g, matrix4f, matrix4f2); + this.renderSectionLayer(RenderType.cutout(), d, e, g, matrix4f, matrix4f2); + if (this.level.effects().constantAmbientLight()) { + Lighting.setupNetherLevel(); + } else { + Lighting.setupLevel(); + } + + if (resourceHandle3 != null) { + resourceHandle3.get().setClearColor(0.0F, 0.0F, 0.0F, 0.0F); + resourceHandle3.get().clear(); + resourceHandle3.get().copyDepthFrom(this.minecraft.getMainRenderTarget()); + resourceHandle.get().bindWrite(false); + } + + if (resourceHandle4 != null) { + resourceHandle4.get().setClearColor(0.0F, 0.0F, 0.0F, 0.0F); + resourceHandle4.get().clear(); + } + + if (this.shouldShowEntityOutlines() && resourceHandle5 != null) { + resourceHandle5.get().setClearColor(0.0F, 0.0F, 0.0F, 0.0F); + resourceHandle5.get().clear(); + resourceHandle.get().bindWrite(false); + } + + PoseStack poseStack = new PoseStack(); + MultiBufferSource.BufferSource bufferSource = this.renderBuffers.bufferSource(); + MultiBufferSource.BufferSource bufferSource2 = this.renderBuffers.crumblingBufferSource(); + profilerFiller.popPush("entities"); + this.renderEntities(poseStack, bufferSource, camera, deltaTracker, this.visibleEntities); + bufferSource.endLastBatch(); + this.checkPoseStack(poseStack); + profilerFiller.popPush("blockentities"); + this.renderBlockEntities(poseStack, bufferSource, bufferSource2, camera, f); + bufferSource.endLastBatch(); + this.checkPoseStack(poseStack); + bufferSource.endBatch(RenderType.solid()); + bufferSource.endBatch(RenderType.endPortal()); + bufferSource.endBatch(RenderType.endGateway()); + bufferSource.endBatch(Sheets.solidBlockSheet()); + bufferSource.endBatch(Sheets.cutoutBlockSheet()); + bufferSource.endBatch(Sheets.bedSheet()); + bufferSource.endBatch(Sheets.shulkerBoxSheet()); + bufferSource.endBatch(Sheets.signSheet()); + bufferSource.endBatch(Sheets.hangingSignSheet()); + bufferSource.endBatch(Sheets.chestSheet()); + this.renderBuffers.outlineBufferSource().endOutlineBatch(); + if (bl) { + this.renderBlockOutline(camera, bufferSource, poseStack, false); + } + + profilerFiller.popPush("debug"); + this.minecraft.debugRenderer.render(poseStack, frustum, bufferSource, d, e, g); + bufferSource.endLastBatch(); + this.checkPoseStack(poseStack); + bufferSource.endBatch(Sheets.translucentItemSheet()); + bufferSource.endBatch(Sheets.bannerSheet()); + bufferSource.endBatch(Sheets.shieldSheet()); + bufferSource.endBatch(RenderType.armorEntityGlint()); + bufferSource.endBatch(RenderType.glint()); + bufferSource.endBatch(RenderType.glintTranslucent()); + bufferSource.endBatch(RenderType.entityGlint()); + profilerFiller.popPush("destroyProgress"); + this.renderBlockDestroyAnimation(poseStack, camera, bufferSource2); + bufferSource2.endBatch(); + this.checkPoseStack(poseStack); + bufferSource.endBatch(RenderType.waterMask()); + bufferSource.endBatch(); + if (resourceHandle2 != null) { + resourceHandle2.get().setClearColor(0.0F, 0.0F, 0.0F, 0.0F); + resourceHandle2.get().clear(); + resourceHandle2.get().copyDepthFrom(resourceHandle.get()); + } + + profilerFiller.popPush("translucent"); + this.renderSectionLayer(RenderType.translucent(), d, e, g, matrix4f, matrix4f2); + profilerFiller.popPush("string"); + this.renderSectionLayer(RenderType.tripwire(), d, e, g, matrix4f, matrix4f2); + if (bl) { + this.renderBlockOutline(camera, bufferSource, poseStack, true); + } + + bufferSource.endBatch(); + profilerFiller.pop(); + }); + } + + private void addParticlesPass(FrameGraphBuilder frameGraphBuilder, Camera camera, LightTexture lightTexture, float f, FogParameters fogParameters) { + FramePass framePass = frameGraphBuilder.addPass("particles"); + if (this.targets.particles != null) { + this.targets.particles = framePass.readsAndWrites(this.targets.particles); + framePass.reads(this.targets.main); + } else { + this.targets.main = framePass.readsAndWrites(this.targets.main); + } + + ResourceHandle resourceHandle = this.targets.main; + ResourceHandle resourceHandle2 = this.targets.particles; + framePass.executes(() -> { + RenderSystem.setShaderFog(fogParameters); + if (resourceHandle2 != null) { + resourceHandle2.get().setClearColor(0.0F, 0.0F, 0.0F, 0.0F); + resourceHandle2.get().clear(); + resourceHandle2.get().copyDepthFrom(resourceHandle.get()); + } + + RenderStateShard.PARTICLES_TARGET.setupRenderState(); + this.minecraft.particleEngine.render(lightTexture, camera, f); + RenderStateShard.PARTICLES_TARGET.clearRenderState(); + }); + } + + private void addCloudsPass( + FrameGraphBuilder frameGraphBuilder, Matrix4f matrix4f, Matrix4f matrix4f2, CloudStatus cloudStatus, Vec3 vec3, float f, int i, float g + ) { + FramePass framePass = frameGraphBuilder.addPass("clouds"); + if (this.targets.clouds != null) { + this.targets.clouds = framePass.readsAndWrites(this.targets.clouds); + } else { + this.targets.main = framePass.readsAndWrites(this.targets.main); + } + + ResourceHandle resourceHandle = this.targets.clouds; + framePass.executes(() -> { + if (resourceHandle != null) { + resourceHandle.get().setClearColor(0.0F, 0.0F, 0.0F, 0.0F); + resourceHandle.get().clear(); + } + + this.cloudRenderer.render(i, cloudStatus, g, matrix4f, matrix4f2, vec3, f); + }); + } + + private void addWeatherPass(FrameGraphBuilder frameGraphBuilder, LightTexture lightTexture, Vec3 vec3, float f, FogParameters fogParameters) { + int i = this.minecraft.options.getEffectiveRenderDistance() * 16; + float g = this.minecraft.gameRenderer.getDepthFar(); + FramePass framePass = frameGraphBuilder.addPass("weather"); + if (this.targets.weather != null) { + this.targets.weather = framePass.readsAndWrites(this.targets.weather); + } else { + this.targets.main = framePass.readsAndWrites(this.targets.main); + } + + framePass.executes(() -> { + RenderSystem.setShaderFog(fogParameters); + RenderStateShard.WEATHER_TARGET.setupRenderState(); + this.weatherEffectRenderer.render(this.minecraft.level, lightTexture, this.ticks, f, vec3); + this.worldBorderRenderer.render(this.level.getWorldBorder(), vec3, i, g); + RenderStateShard.WEATHER_TARGET.clearRenderState(); + }); + } + + private void addLateDebugPass(FrameGraphBuilder frameGraphBuilder, Vec3 vec3, FogParameters fogParameters) { + FramePass framePass = frameGraphBuilder.addPass("late_debug"); + this.targets.main = framePass.readsAndWrites(this.targets.main); + if (this.targets.itemEntity != null) { + this.targets.itemEntity = framePass.readsAndWrites(this.targets.itemEntity); + } + + ResourceHandle resourceHandle = this.targets.main; + framePass.executes(() -> { + RenderSystem.setShaderFog(fogParameters); + resourceHandle.get().bindWrite(false); + PoseStack poseStack = new PoseStack(); + MultiBufferSource.BufferSource bufferSource = this.renderBuffers.bufferSource(); + this.minecraft.debugRenderer.renderAfterTranslucents(poseStack, bufferSource, vec3.x, vec3.y, vec3.z); + bufferSource.endLastBatch(); + this.checkPoseStack(poseStack); + }); + } + + private boolean collectVisibleEntities(Camera camera, Frustum frustum, List list) { + Vec3 vec3 = camera.getPosition(); + double d = vec3.x(); + double e = vec3.y(); + double f = vec3.z(); + boolean bl = false; + boolean bl2 = this.shouldShowEntityOutlines(); + Entity.setViewScale(Mth.clamp(this.minecraft.options.getEffectiveRenderDistance() / 8.0, 1.0, 2.5) * this.minecraft.options.entityDistanceScaling().get()); for (Entity entity : this.level.entitiesForRendering()) { - if (this.entityRenderDispatcher.shouldRender(entity, frustum, d, e, g) || entity.hasIndirectPassenger(this.minecraft.player)) { + if (this.entityRenderDispatcher.shouldRender(entity, frustum, d, e, f) || entity.hasIndirectPassenger(this.minecraft.player)) { BlockPos blockPos = entity.blockPosition(); if ((this.level.isOutsideBuildHeight(blockPos.getY()) || this.isSectionCompiled(blockPos)) && (entity != camera.getEntity() || camera.isDetached() || camera.getEntity() instanceof LivingEntity && ((LivingEntity)camera.getEntity()).isSleeping()) && (!(entity instanceof LocalPlayer) || camera.getEntity() == entity)) { - this.renderedEntities++; - if (entity.tickCount == 0) { - entity.xOld = entity.getX(); - entity.yOld = entity.getY(); - entity.zOld = entity.getZ(); + list.add(entity); + if (bl2 && this.minecraft.shouldEntityAppearGlowing(entity)) { + bl = true; } - - MultiBufferSource multiBufferSource; - if (this.shouldShowEntityOutlines() && this.minecraft.shouldEntityAppearGlowing(entity)) { - bl3 = true; - OutlineBufferSource outlineBufferSource = this.renderBuffers.outlineBufferSource(); - multiBufferSource = outlineBufferSource; - int i = entity.getTeamColor(); - outlineBufferSource.setColor(FastColor.ARGB32.red(i), FastColor.ARGB32.green(i), FastColor.ARGB32.blue(i), 255); - } else { - multiBufferSource = bufferSource; - } - - float j = deltaTracker.getGameTimeDeltaPartialTick(!tickRateManager.isEntityFrozen(entity)); - this.renderEntity(entity, d, e, g, j, poseStack, multiBufferSource); } } } - bufferSource.endLastBatch(); - this.checkPoseStack(poseStack); - bufferSource.endBatch(RenderType.entitySolid(TextureAtlas.LOCATION_BLOCKS)); - bufferSource.endBatch(RenderType.entityCutout(TextureAtlas.LOCATION_BLOCKS)); - bufferSource.endBatch(RenderType.entityCutoutNoCull(TextureAtlas.LOCATION_BLOCKS)); - bufferSource.endBatch(RenderType.entitySmoothCutout(TextureAtlas.LOCATION_BLOCKS)); - profilerFiller.popPush("blockentities"); + return bl; + } + + private void renderEntities(PoseStack poseStack, MultiBufferSource.BufferSource bufferSource, Camera camera, DeltaTracker deltaTracker, List list) { + Vec3 vec3 = camera.getPosition(); + double d = vec3.x(); + double e = vec3.y(); + double f = vec3.z(); + TickRateManager tickRateManager = this.minecraft.level.tickRateManager(); + boolean bl = this.shouldShowEntityOutlines(); + + for (Entity entity : list) { + if (entity.tickCount == 0) { + entity.xOld = entity.getX(); + entity.yOld = entity.getY(); + entity.zOld = entity.getZ(); + } + + MultiBufferSource multiBufferSource; + if (bl && this.minecraft.shouldEntityAppearGlowing(entity)) { + OutlineBufferSource outlineBufferSource = this.renderBuffers.outlineBufferSource(); + multiBufferSource = outlineBufferSource; + int i = entity.getTeamColor(); + outlineBufferSource.setColor(ARGB.red(i), ARGB.green(i), ARGB.blue(i), 255); + } else { + multiBufferSource = bufferSource; + } + + float g = deltaTracker.getGameTimeDeltaPartialTick(!tickRateManager.isEntityFrozen(entity)); + this.renderEntity(entity, d, e, f, g, poseStack, multiBufferSource); + } + } + + private void renderBlockEntities( + PoseStack poseStack, MultiBufferSource.BufferSource bufferSource, MultiBufferSource.BufferSource bufferSource2, Camera camera, float f + ) { + Vec3 vec3 = camera.getPosition(); + double d = vec3.x(); + double e = vec3.y(); + double g = vec3.z(); for (SectionRenderDispatcher.RenderSection renderSection : this.visibleSections) { List list = renderSection.getCompiled().getRenderableBlockEntities(); if (!list.isEmpty()) { for (BlockEntity blockEntity : list) { - BlockPos blockPos2 = blockEntity.getBlockPos(); - MultiBufferSource multiBufferSource2 = bufferSource; + BlockPos blockPos = blockEntity.getBlockPos(); + MultiBufferSource multiBufferSource = bufferSource; poseStack.pushPose(); - poseStack.translate(blockPos2.getX() - d, blockPos2.getY() - e, blockPos2.getZ() - g); - SortedSet sortedSet = this.destructionProgress.get(blockPos2.asLong()); + poseStack.translate(blockPos.getX() - d, blockPos.getY() - e, blockPos.getZ() - g); + SortedSet sortedSet = this.destructionProgress.get(blockPos.asLong()); if (sortedSet != null && !sortedSet.isEmpty()) { - int k = ((BlockDestructionProgress)sortedSet.last()).getProgress(); - if (k >= 0) { + int i = ((BlockDestructionProgress)sortedSet.last()).getProgress(); + if (i >= 0) { PoseStack.Pose pose = poseStack.last(); - VertexConsumer vertexConsumer = new SheetedDecalTextureGenerator( - this.renderBuffers.crumblingBufferSource().getBuffer((RenderType)ModelBakery.DESTROY_TYPES.get(k)), pose, 1.0F - ); - multiBufferSource2 = renderType -> { - VertexConsumer vertexConsumer2x = bufferSource.getBuffer(renderType); - return renderType.affectsCrumbling() ? VertexMultiConsumer.create(vertexConsumer, vertexConsumer2x) : vertexConsumer2x; + VertexConsumer vertexConsumer = new SheetedDecalTextureGenerator(bufferSource2.getBuffer((RenderType)ModelBakery.DESTROY_TYPES.get(i)), pose, 1.0F); + multiBufferSource = renderType -> { + VertexConsumer vertexConsumer2 = bufferSource.getBuffer(renderType); + return renderType.affectsCrumbling() ? VertexMultiConsumer.create(vertexConsumer, vertexConsumer2) : vertexConsumer2; }; } } - this.blockEntityRenderDispatcher.render(blockEntity, f, poseStack, multiBufferSource2); + this.blockEntityRenderDispatcher.render(blockEntity, f, poseStack, multiBufferSource); poseStack.popPose(); } } @@ -1045,140 +850,63 @@ public class LevelRenderer implements ResourceManagerReloadListener, AutoCloseab synchronized (this.globalBlockEntities) { for (BlockEntity blockEntity2 : this.globalBlockEntities) { - BlockPos blockPos3 = blockEntity2.getBlockPos(); + BlockPos blockPos2 = blockEntity2.getBlockPos(); poseStack.pushPose(); - poseStack.translate(blockPos3.getX() - d, blockPos3.getY() - e, blockPos3.getZ() - g); + poseStack.translate(blockPos2.getX() - d, blockPos2.getY() - e, blockPos2.getZ() - g); this.blockEntityRenderDispatcher.render(blockEntity2, f, poseStack, bufferSource); poseStack.popPose(); } } + } - this.checkPoseStack(poseStack); - bufferSource.endBatch(RenderType.solid()); - bufferSource.endBatch(RenderType.endPortal()); - bufferSource.endBatch(RenderType.endGateway()); - bufferSource.endBatch(Sheets.solidBlockSheet()); - bufferSource.endBatch(Sheets.cutoutBlockSheet()); - bufferSource.endBatch(Sheets.bedSheet()); - bufferSource.endBatch(Sheets.shulkerBoxSheet()); - bufferSource.endBatch(Sheets.signSheet()); - bufferSource.endBatch(Sheets.hangingSignSheet()); - bufferSource.endBatch(Sheets.chestSheet()); - this.renderBuffers.outlineBufferSource().endOutlineBatch(); - if (bl3) { - this.entityEffect.process(deltaTracker.getGameTimeDeltaTicks()); - this.minecraft.getMainRenderTarget().bindWrite(false); - } - - profilerFiller.popPush("destroyProgress"); + private void renderBlockDestroyAnimation(PoseStack poseStack, Camera camera, MultiBufferSource.BufferSource bufferSource) { + Vec3 vec3 = camera.getPosition(); + double d = vec3.x(); + double e = vec3.y(); + double f = vec3.z(); for (Entry> entry : this.destructionProgress.long2ObjectEntrySet()) { BlockPos blockPos = BlockPos.of(entry.getLongKey()); - double l = blockPos.getX() - d; - double m = blockPos.getY() - e; - double n = blockPos.getZ() - g; - if (!(l * l + m * m + n * n > 1024.0)) { - SortedSet sortedSet2 = (SortedSet)entry.getValue(); - if (sortedSet2 != null && !sortedSet2.isEmpty()) { - int o = ((BlockDestructionProgress)sortedSet2.last()).getProgress(); + if (!(blockPos.distToCenterSqr(d, e, f) > 1024.0)) { + SortedSet sortedSet = (SortedSet)entry.getValue(); + if (sortedSet != null && !sortedSet.isEmpty()) { + int i = ((BlockDestructionProgress)sortedSet.last()).getProgress(); poseStack.pushPose(); - poseStack.translate(blockPos.getX() - d, blockPos.getY() - e, blockPos.getZ() - g); - PoseStack.Pose pose2 = poseStack.last(); - VertexConsumer vertexConsumer2 = new SheetedDecalTextureGenerator( - this.renderBuffers.crumblingBufferSource().getBuffer((RenderType)ModelBakery.DESTROY_TYPES.get(o)), pose2, 1.0F - ); - this.minecraft.getBlockRenderer().renderBreakingTexture(this.level.getBlockState(blockPos), blockPos, this.level, poseStack, vertexConsumer2); + poseStack.translate(blockPos.getX() - d, blockPos.getY() - e, blockPos.getZ() - f); + PoseStack.Pose pose = poseStack.last(); + VertexConsumer vertexConsumer = new SheetedDecalTextureGenerator(bufferSource.getBuffer((RenderType)ModelBakery.DESTROY_TYPES.get(i)), pose, 1.0F); + this.minecraft.getBlockRenderer().renderBreakingTexture(this.level.getBlockState(blockPos), blockPos, this.level, poseStack, vertexConsumer); poseStack.popPose(); } } } + } - this.checkPoseStack(poseStack); - HitResult hitResult = this.minecraft.hitResult; - if (renderBlockOutline && hitResult != null && hitResult.getType() == HitResult.Type.BLOCK) { - profilerFiller.popPush("outline"); - BlockPos blockPos4 = ((BlockHitResult)hitResult).getBlockPos(); - BlockState blockState = this.level.getBlockState(blockPos4); - if (!blockState.isAir() && this.level.getWorldBorder().isWithinBounds(blockPos4)) { - VertexConsumer vertexConsumer3 = bufferSource.getBuffer(RenderType.lines()); - this.renderHitOutline(poseStack, vertexConsumer3, camera.getEntity(), d, e, g, blockPos4, blockState); + private void renderBlockOutline(Camera camera, MultiBufferSource.BufferSource bufferSource, PoseStack poseStack, boolean bl) { + if (this.minecraft.hitResult instanceof BlockHitResult blockHitResult) { + if (blockHitResult.getType() != Type.MISS) { + BlockPos blockPos = blockHitResult.getBlockPos(); + BlockState blockState = this.level.getBlockState(blockPos); + if (!blockState.isAir() && this.level.getWorldBorder().isWithinBounds(blockPos)) { + boolean bl2 = ItemBlockRenderTypes.getChunkRenderType(blockState).sortOnUpload(); + if (bl2 != bl) { + return; + } + + Vec3 vec3 = camera.getPosition(); + Boolean boolean_ = this.minecraft.options.highContrastBlockOutline().get(); + if (boolean_) { + VertexConsumer vertexConsumer = bufferSource.getBuffer(RenderType.secondaryBlockOutline()); + this.renderHitOutline(poseStack, vertexConsumer, camera.getEntity(), vec3.x, vec3.y, vec3.z, blockPos, blockState, -16777216); + } + + VertexConsumer vertexConsumer = bufferSource.getBuffer(RenderType.lines()); + int i = boolean_ ? -11010079 : ARGB.color(102, -16777216); + this.renderHitOutline(poseStack, vertexConsumer, camera.getEntity(), vec3.x, vec3.y, vec3.z, blockPos, blockState, i); + bufferSource.endLastBatch(); + } } } - - this.minecraft.debugRenderer.render(poseStack, bufferSource, d, e, g); - bufferSource.endLastBatch(); - bufferSource.endBatch(Sheets.translucentCullBlockSheet()); - bufferSource.endBatch(Sheets.bannerSheet()); - bufferSource.endBatch(Sheets.shieldSheet()); - bufferSource.endBatch(RenderType.armorEntityGlint()); - bufferSource.endBatch(RenderType.glint()); - bufferSource.endBatch(RenderType.glintTranslucent()); - bufferSource.endBatch(RenderType.entityGlint()); - bufferSource.endBatch(RenderType.entityGlintDirect()); - bufferSource.endBatch(RenderType.waterMask()); - this.renderBuffers.crumblingBufferSource().endBatch(); - if (this.transparencyChain != null) { - bufferSource.endBatch(RenderType.lines()); - bufferSource.endBatch(); - this.translucentTarget.clear(Minecraft.ON_OSX); - this.translucentTarget.copyDepthFrom(this.minecraft.getMainRenderTarget()); - profilerFiller.popPush("translucent"); - this.renderSectionLayer(RenderType.translucent(), d, e, g, frustumMatrix, projectionMatrix); - profilerFiller.popPush("string"); - this.renderSectionLayer(RenderType.tripwire(), d, e, g, frustumMatrix, projectionMatrix); - this.particlesTarget.clear(Minecraft.ON_OSX); - this.particlesTarget.copyDepthFrom(this.minecraft.getMainRenderTarget()); - RenderStateShard.PARTICLES_TARGET.setupRenderState(); - profilerFiller.popPush("particles"); - this.minecraft.particleEngine.render(lightTexture, camera, f); - RenderStateShard.PARTICLES_TARGET.clearRenderState(); - } else { - profilerFiller.popPush("translucent"); - if (this.translucentTarget != null) { - this.translucentTarget.clear(Minecraft.ON_OSX); - } - - this.renderSectionLayer(RenderType.translucent(), d, e, g, frustumMatrix, projectionMatrix); - bufferSource.endBatch(RenderType.lines()); - bufferSource.endBatch(); - profilerFiller.popPush("string"); - this.renderSectionLayer(RenderType.tripwire(), d, e, g, frustumMatrix, projectionMatrix); - profilerFiller.popPush("particles"); - this.minecraft.particleEngine.render(lightTexture, camera, f); - } - - if (this.minecraft.options.getCloudsType() != CloudStatus.OFF) { - if (this.transparencyChain != null) { - this.cloudsTarget.clear(Minecraft.ON_OSX); - } - - profilerFiller.popPush("clouds"); - this.renderClouds(poseStack, frustumMatrix, projectionMatrix, f, d, e, g); - } - - if (this.transparencyChain != null) { - RenderStateShard.WEATHER_TARGET.setupRenderState(); - profilerFiller.popPush("weather"); - this.renderSnowAndRain(lightTexture, f, d, e, g); - this.renderWorldBorder(camera); - RenderStateShard.WEATHER_TARGET.clearRenderState(); - this.transparencyChain.process(deltaTracker.getGameTimeDeltaTicks()); - this.minecraft.getMainRenderTarget().bindWrite(false); - } else { - RenderSystem.depthMask(false); - profilerFiller.popPush("weather"); - this.renderSnowAndRain(lightTexture, f, d, e, g); - this.renderWorldBorder(camera); - RenderSystem.depthMask(true); - } - - this.renderDebug(poseStack, bufferSource, camera); - bufferSource.endLastBatch(); - matrix4fStack.popMatrix(); - RenderSystem.applyModelViewMatrix(); - RenderSystem.depthMask(true); - RenderSystem.disableBlend(); - FogRenderer.setupNoFog(); } /** @@ -1195,229 +923,89 @@ public class LevelRenderer implements ResourceManagerReloadListener, AutoCloseab double d = Mth.lerp((double)partialTick, entity.xOld, entity.getX()); double e = Mth.lerp((double)partialTick, entity.yOld, entity.getY()); double f = Mth.lerp((double)partialTick, entity.zOld, entity.getZ()); - float g = Mth.lerp(partialTick, entity.yRotO, entity.getYRot()); this.entityRenderDispatcher - .render(entity, d - camX, e - camY, f - camZ, g, partialTick, poseStack, bufferSource, this.entityRenderDispatcher.getPackedLightCoords(entity, partialTick)); + .render(entity, d - camX, e - camY, f - camZ, partialTick, poseStack, bufferSource, this.entityRenderDispatcher.getPackedLightCoords(entity, partialTick)); + } + + private void scheduleTranslucentSectionResort(Vec3 vec3) { + if (!this.visibleSections.isEmpty()) { + BlockPos blockPos = BlockPos.containing(vec3); + boolean bl = !blockPos.equals(this.lastTranslucentSortBlockPos); + Profiler.get().push("translucent_sort"); + SectionRenderDispatcher.TranslucencyPointOfView translucencyPointOfView = new SectionRenderDispatcher.TranslucencyPointOfView(); + + for (SectionRenderDispatcher.RenderSection renderSection : this.nearbyVisibleSections) { + this.scheduleResort(renderSection, translucencyPointOfView, vec3, bl, true); + } + + this.translucencyResortIterationIndex = this.translucencyResortIterationIndex % this.visibleSections.size(); + int i = Math.max(this.visibleSections.size() / 8, 15); + + while (i-- > 0) { + int j = this.translucencyResortIterationIndex++ % this.visibleSections.size(); + this.scheduleResort(this.visibleSections.get(j), translucencyPointOfView, vec3, bl, false); + } + + this.lastTranslucentSortBlockPos = blockPos; + Profiler.get().pop(); + } + } + + private void scheduleResort( + SectionRenderDispatcher.RenderSection renderSection, + SectionRenderDispatcher.TranslucencyPointOfView translucencyPointOfView, + Vec3 vec3, + boolean bl, + boolean bl2 + ) { + translucencyPointOfView.set(vec3, renderSection.getSectionNode()); + boolean bl3 = !translucencyPointOfView.equals(renderSection.pointOfView.get()); + boolean bl4 = bl && (translucencyPointOfView.isAxisAligned() || bl2); + if ((bl4 || bl3) && !renderSection.transparencyResortingScheduled() && renderSection.hasTranslucentGeometry()) { + renderSection.resortTransparency(this.sectionRenderDispatcher); + } } private void renderSectionLayer(RenderType renderType, double x, double y, double z, Matrix4f frustrumMatrix, Matrix4f projectionMatrix) { RenderSystem.assertOnRenderThread(); + Zone zone = Profiler.get().zone((Supplier)(() -> "render_" + renderType.name)); + zone.addText(renderType::toString); + boolean bl = renderType != RenderType.translucent(); + ObjectListIterator objectListIterator = this.visibleSections.listIterator(bl ? 0 : this.visibleSections.size()); renderType.setupRenderState(); - if (renderType == RenderType.translucent()) { - this.minecraft.getProfiler().push("translucent_sort"); - double d = x - this.xTransparentOld; - double e = y - this.yTransparentOld; - double f = z - this.zTransparentOld; - if (d * d + e * e + f * f > 1.0) { - int i = SectionPos.posToSectionCoord(x); - int j = SectionPos.posToSectionCoord(y); - int k = SectionPos.posToSectionCoord(z); - boolean bl = i != SectionPos.posToSectionCoord(this.xTransparentOld) - || k != SectionPos.posToSectionCoord(this.zTransparentOld) - || j != SectionPos.posToSectionCoord(this.yTransparentOld); - this.xTransparentOld = x; - this.yTransparentOld = y; - this.zTransparentOld = z; - int l = 0; + CompiledShaderProgram compiledShaderProgram = RenderSystem.getShader(); + if (compiledShaderProgram == null) { + renderType.clearRenderState(); + zone.close(); + } else { + compiledShaderProgram.setDefaultUniforms(VertexFormat.Mode.QUADS, frustrumMatrix, projectionMatrix, this.minecraft.getWindow()); + compiledShaderProgram.apply(); + Uniform uniform = compiledShaderProgram.MODEL_OFFSET; - for (SectionRenderDispatcher.RenderSection renderSection : this.visibleSections) { - if (l < 15 && (bl || renderSection.isAxisAlignedWith(i, j, k)) && renderSection.resortTransparency(renderType, this.sectionRenderDispatcher)) { - l++; - } - } - } - - this.minecraft.getProfiler().pop(); - } - - this.minecraft.getProfiler().push("filterempty"); - this.minecraft.getProfiler().popPush((Supplier)(() -> "render_" + renderType)); - boolean bl2 = renderType != RenderType.translucent(); - ObjectListIterator objectListIterator = this.visibleSections.listIterator(bl2 ? 0 : this.visibleSections.size()); - ShaderInstance shaderInstance = RenderSystem.getShader(); - shaderInstance.setDefaultUniforms(VertexFormat.Mode.QUADS, frustrumMatrix, projectionMatrix, this.minecraft.getWindow()); - shaderInstance.apply(); - Uniform uniform = shaderInstance.CHUNK_OFFSET; - - while (bl2 ? objectListIterator.hasNext() : objectListIterator.hasPrevious()) { - SectionRenderDispatcher.RenderSection renderSection2 = bl2 - ? (SectionRenderDispatcher.RenderSection)objectListIterator.next() - : objectListIterator.previous(); - if (!renderSection2.getCompiled().isEmpty(renderType)) { - VertexBuffer vertexBuffer = renderSection2.getBuffer(renderType); - BlockPos blockPos = renderSection2.getOrigin(); - if (uniform != null) { - uniform.set((float)(blockPos.getX() - x), (float)(blockPos.getY() - y), (float)(blockPos.getZ() - z)); - uniform.upload(); - } - - vertexBuffer.bind(); - vertexBuffer.draw(); - } - } - - if (uniform != null) { - uniform.set(0.0F, 0.0F, 0.0F); - } - - shaderInstance.clear(); - VertexBuffer.unbind(); - this.minecraft.getProfiler().pop(); - renderType.clearRenderState(); - } - - private void renderDebug(PoseStack poseStack, MultiBufferSource buffer, Camera camera) { - if (this.minecraft.sectionPath || this.minecraft.sectionVisibility) { - double d = camera.getPosition().x(); - double e = camera.getPosition().y(); - double f = camera.getPosition().z(); - - for (SectionRenderDispatcher.RenderSection renderSection : this.visibleSections) { - SectionOcclusionGraph.Node node = this.sectionOcclusionGraph.getNode(renderSection); - if (node != null) { + while (bl ? objectListIterator.hasNext() : objectListIterator.hasPrevious()) { + SectionRenderDispatcher.RenderSection renderSection = bl ? (SectionRenderDispatcher.RenderSection)objectListIterator.next() : objectListIterator.previous(); + if (!renderSection.getCompiled().isEmpty(renderType)) { + VertexBuffer vertexBuffer = renderSection.getBuffer(renderType); BlockPos blockPos = renderSection.getOrigin(); - poseStack.pushPose(); - poseStack.translate(blockPos.getX() - d, blockPos.getY() - e, blockPos.getZ() - f); - Matrix4f matrix4f = poseStack.last().pose(); - if (this.minecraft.sectionPath) { - VertexConsumer vertexConsumer = buffer.getBuffer(RenderType.lines()); - int i = node.step == 0 ? 0 : Mth.hsvToRgb(node.step / 50.0F, 0.9F, 0.9F); - int j = i >> 16 & 0xFF; - int k = i >> 8 & 0xFF; - int l = i & 0xFF; - - for (int m = 0; m < DIRECTIONS.length; m++) { - if (node.hasSourceDirection(m)) { - Direction direction = DIRECTIONS[m]; - vertexConsumer.addVertex(matrix4f, 8.0F, 8.0F, 8.0F).setColor(j, k, l, 255).setNormal(direction.getStepX(), direction.getStepY(), direction.getStepZ()); - vertexConsumer.addVertex( - matrix4f, (float)(8 - 16 * direction.getStepX()), (float)(8 - 16 * direction.getStepY()), (float)(8 - 16 * direction.getStepZ()) - ) - .setColor(j, k, l, 255) - .setNormal(direction.getStepX(), direction.getStepY(), direction.getStepZ()); - } - } + if (uniform != null) { + uniform.set((float)(blockPos.getX() - x), (float)(blockPos.getY() - y), (float)(blockPos.getZ() - z)); + uniform.upload(); } - if (this.minecraft.sectionVisibility && !renderSection.getCompiled().hasNoRenderableLayers()) { - VertexConsumer vertexConsumer = buffer.getBuffer(RenderType.lines()); - int i = 0; - - for (Direction direction2 : DIRECTIONS) { - for (Direction direction3 : DIRECTIONS) { - boolean bl = renderSection.getCompiled().facesCanSeeEachother(direction2, direction3); - if (!bl) { - i++; - vertexConsumer.addVertex( - matrix4f, (float)(8 + 8 * direction2.getStepX()), (float)(8 + 8 * direction2.getStepY()), (float)(8 + 8 * direction2.getStepZ()) - ) - .setColor(255, 0, 0, 255) - .setNormal(direction2.getStepX(), direction2.getStepY(), direction2.getStepZ()); - vertexConsumer.addVertex( - matrix4f, (float)(8 + 8 * direction3.getStepX()), (float)(8 + 8 * direction3.getStepY()), (float)(8 + 8 * direction3.getStepZ()) - ) - .setColor(255, 0, 0, 255) - .setNormal(direction3.getStepX(), direction3.getStepY(), direction3.getStepZ()); - } - } - } - - if (i > 0) { - VertexConsumer vertexConsumer2 = buffer.getBuffer(RenderType.debugQuads()); - float g = 0.5F; - float h = 0.2F; - vertexConsumer2.addVertex(matrix4f, 0.5F, 15.5F, 0.5F).setColor(0.9F, 0.9F, 0.0F, 0.2F); - vertexConsumer2.addVertex(matrix4f, 15.5F, 15.5F, 0.5F).setColor(0.9F, 0.9F, 0.0F, 0.2F); - vertexConsumer2.addVertex(matrix4f, 15.5F, 15.5F, 15.5F).setColor(0.9F, 0.9F, 0.0F, 0.2F); - vertexConsumer2.addVertex(matrix4f, 0.5F, 15.5F, 15.5F).setColor(0.9F, 0.9F, 0.0F, 0.2F); - vertexConsumer2.addVertex(matrix4f, 0.5F, 0.5F, 15.5F).setColor(0.9F, 0.9F, 0.0F, 0.2F); - vertexConsumer2.addVertex(matrix4f, 15.5F, 0.5F, 15.5F).setColor(0.9F, 0.9F, 0.0F, 0.2F); - vertexConsumer2.addVertex(matrix4f, 15.5F, 0.5F, 0.5F).setColor(0.9F, 0.9F, 0.0F, 0.2F); - vertexConsumer2.addVertex(matrix4f, 0.5F, 0.5F, 0.5F).setColor(0.9F, 0.9F, 0.0F, 0.2F); - vertexConsumer2.addVertex(matrix4f, 0.5F, 15.5F, 0.5F).setColor(0.9F, 0.9F, 0.0F, 0.2F); - vertexConsumer2.addVertex(matrix4f, 0.5F, 15.5F, 15.5F).setColor(0.9F, 0.9F, 0.0F, 0.2F); - vertexConsumer2.addVertex(matrix4f, 0.5F, 0.5F, 15.5F).setColor(0.9F, 0.9F, 0.0F, 0.2F); - vertexConsumer2.addVertex(matrix4f, 0.5F, 0.5F, 0.5F).setColor(0.9F, 0.9F, 0.0F, 0.2F); - vertexConsumer2.addVertex(matrix4f, 15.5F, 0.5F, 0.5F).setColor(0.9F, 0.9F, 0.0F, 0.2F); - vertexConsumer2.addVertex(matrix4f, 15.5F, 0.5F, 15.5F).setColor(0.9F, 0.9F, 0.0F, 0.2F); - vertexConsumer2.addVertex(matrix4f, 15.5F, 15.5F, 15.5F).setColor(0.9F, 0.9F, 0.0F, 0.2F); - vertexConsumer2.addVertex(matrix4f, 15.5F, 15.5F, 0.5F).setColor(0.9F, 0.9F, 0.0F, 0.2F); - vertexConsumer2.addVertex(matrix4f, 0.5F, 0.5F, 0.5F).setColor(0.9F, 0.9F, 0.0F, 0.2F); - vertexConsumer2.addVertex(matrix4f, 15.5F, 0.5F, 0.5F).setColor(0.9F, 0.9F, 0.0F, 0.2F); - vertexConsumer2.addVertex(matrix4f, 15.5F, 15.5F, 0.5F).setColor(0.9F, 0.9F, 0.0F, 0.2F); - vertexConsumer2.addVertex(matrix4f, 0.5F, 15.5F, 0.5F).setColor(0.9F, 0.9F, 0.0F, 0.2F); - vertexConsumer2.addVertex(matrix4f, 0.5F, 15.5F, 15.5F).setColor(0.9F, 0.9F, 0.0F, 0.2F); - vertexConsumer2.addVertex(matrix4f, 15.5F, 15.5F, 15.5F).setColor(0.9F, 0.9F, 0.0F, 0.2F); - vertexConsumer2.addVertex(matrix4f, 15.5F, 0.5F, 15.5F).setColor(0.9F, 0.9F, 0.0F, 0.2F); - vertexConsumer2.addVertex(matrix4f, 0.5F, 0.5F, 15.5F).setColor(0.9F, 0.9F, 0.0F, 0.2F); - } - } - - poseStack.popPose(); + vertexBuffer.bind(); + vertexBuffer.draw(); } } + + if (uniform != null) { + uniform.set(0.0F, 0.0F, 0.0F); + } + + compiledShaderProgram.clear(); + VertexBuffer.unbind(); + zone.close(); + renderType.clearRenderState(); } - - if (this.capturedFrustum != null) { - poseStack.pushPose(); - poseStack.translate( - (float)(this.frustumPos.x - camera.getPosition().x), - (float)(this.frustumPos.y - camera.getPosition().y), - (float)(this.frustumPos.z - camera.getPosition().z) - ); - Matrix4f matrix4f2 = poseStack.last().pose(); - VertexConsumer vertexConsumer3 = buffer.getBuffer(RenderType.debugQuads()); - this.addFrustumQuad(vertexConsumer3, matrix4f2, 0, 1, 2, 3, 0, 1, 1); - this.addFrustumQuad(vertexConsumer3, matrix4f2, 4, 5, 6, 7, 1, 0, 0); - this.addFrustumQuad(vertexConsumer3, matrix4f2, 0, 1, 5, 4, 1, 1, 0); - this.addFrustumQuad(vertexConsumer3, matrix4f2, 2, 3, 7, 6, 0, 0, 1); - this.addFrustumQuad(vertexConsumer3, matrix4f2, 0, 4, 7, 3, 0, 1, 0); - this.addFrustumQuad(vertexConsumer3, matrix4f2, 1, 5, 6, 2, 1, 0, 1); - VertexConsumer vertexConsumer4 = buffer.getBuffer(RenderType.lines()); - this.addFrustumVertex(vertexConsumer4, matrix4f2, 0); - this.addFrustumVertex(vertexConsumer4, matrix4f2, 1); - this.addFrustumVertex(vertexConsumer4, matrix4f2, 1); - this.addFrustumVertex(vertexConsumer4, matrix4f2, 2); - this.addFrustumVertex(vertexConsumer4, matrix4f2, 2); - this.addFrustumVertex(vertexConsumer4, matrix4f2, 3); - this.addFrustumVertex(vertexConsumer4, matrix4f2, 3); - this.addFrustumVertex(vertexConsumer4, matrix4f2, 0); - this.addFrustumVertex(vertexConsumer4, matrix4f2, 4); - this.addFrustumVertex(vertexConsumer4, matrix4f2, 5); - this.addFrustumVertex(vertexConsumer4, matrix4f2, 5); - this.addFrustumVertex(vertexConsumer4, matrix4f2, 6); - this.addFrustumVertex(vertexConsumer4, matrix4f2, 6); - this.addFrustumVertex(vertexConsumer4, matrix4f2, 7); - this.addFrustumVertex(vertexConsumer4, matrix4f2, 7); - this.addFrustumVertex(vertexConsumer4, matrix4f2, 4); - this.addFrustumVertex(vertexConsumer4, matrix4f2, 0); - this.addFrustumVertex(vertexConsumer4, matrix4f2, 4); - this.addFrustumVertex(vertexConsumer4, matrix4f2, 1); - this.addFrustumVertex(vertexConsumer4, matrix4f2, 5); - this.addFrustumVertex(vertexConsumer4, matrix4f2, 2); - this.addFrustumVertex(vertexConsumer4, matrix4f2, 6); - this.addFrustumVertex(vertexConsumer4, matrix4f2, 3); - this.addFrustumVertex(vertexConsumer4, matrix4f2, 7); - poseStack.popPose(); - } - } - - private void addFrustumVertex(VertexConsumer consumer, Matrix4f matrix, int vertexIndex) { - consumer.addVertex(matrix, this.frustumPoints[vertexIndex].x(), this.frustumPoints[vertexIndex].y(), this.frustumPoints[vertexIndex].z()) - .setColor(-16777216) - .setNormal(0.0F, 0.0F, -1.0F); - } - - private void addFrustumQuad(VertexConsumer consumer, Matrix4f matrix, int index1, int index2, int index3, int index4, int red, int green, int blue) { - float f = 0.25F; - consumer.addVertex(matrix, this.frustumPoints[index1].x(), this.frustumPoints[index1].y(), this.frustumPoints[index1].z()) - .setColor((float)red, (float)green, (float)blue, 0.25F); - consumer.addVertex(matrix, this.frustumPoints[index2].x(), this.frustumPoints[index2].y(), this.frustumPoints[index2].z()) - .setColor((float)red, (float)green, (float)blue, 0.25F); - consumer.addVertex(matrix, this.frustumPoints[index3].x(), this.frustumPoints[index3].y(), this.frustumPoints[index3].z()) - .setColor((float)red, (float)green, (float)blue, 0.25F); - consumer.addVertex(matrix, this.frustumPoints[index4].x(), this.frustumPoints[index4].y(), this.frustumPoints[index4].z()) - .setColor((float)red, (float)green, (float)blue, 0.25F); } public void captureFrustum() { @@ -1456,428 +1044,68 @@ public class LevelRenderer implements ResourceManagerReloadListener, AutoCloseab } } - private void renderEndSky(PoseStack poseStack) { - RenderSystem.enableBlend(); - RenderSystem.depthMask(false); - RenderSystem.setShader(GameRenderer::getPositionTexColorShader); - RenderSystem.setShaderTexture(0, END_SKY_LOCATION); - Tesselator tesselator = Tesselator.getInstance(); - - for (int i = 0; i < 6; i++) { - poseStack.pushPose(); - if (i == 1) { - poseStack.mulPose(Axis.XP.rotationDegrees(90.0F)); - } - - if (i == 2) { - poseStack.mulPose(Axis.XP.rotationDegrees(-90.0F)); - } - - if (i == 3) { - poseStack.mulPose(Axis.XP.rotationDegrees(180.0F)); - } - - if (i == 4) { - poseStack.mulPose(Axis.ZP.rotationDegrees(90.0F)); - } - - if (i == 5) { - poseStack.mulPose(Axis.ZP.rotationDegrees(-90.0F)); - } - - Matrix4f matrix4f = poseStack.last().pose(); - BufferBuilder bufferBuilder = tesselator.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX_COLOR); - bufferBuilder.addVertex(matrix4f, -100.0F, -100.0F, -100.0F).setUv(0.0F, 0.0F).setColor(-14145496); - bufferBuilder.addVertex(matrix4f, -100.0F, -100.0F, 100.0F).setUv(0.0F, 16.0F).setColor(-14145496); - bufferBuilder.addVertex(matrix4f, 100.0F, -100.0F, 100.0F).setUv(16.0F, 16.0F).setColor(-14145496); - bufferBuilder.addVertex(matrix4f, 100.0F, -100.0F, -100.0F).setUv(16.0F, 0.0F).setColor(-14145496); - BufferUploader.drawWithShader(bufferBuilder.buildOrThrow()); - poseStack.popPose(); - } - - RenderSystem.depthMask(true); - RenderSystem.disableBlend(); - } - - public void renderSky(Matrix4f frustumMatrix, Matrix4f projectionMatrix, float partialTick, Camera camera, boolean isFoggy, Runnable skyFogSetup) { - skyFogSetup.run(); - if (!isFoggy) { - FogType fogType = camera.getFluidInCamera(); - if (fogType != FogType.POWDER_SNOW && fogType != FogType.LAVA && !this.doesMobEffectBlockSky(camera)) { - PoseStack poseStack = new PoseStack(); - poseStack.mulPose(frustumMatrix); - if (this.minecraft.level.effects().skyType() == DimensionSpecialEffects.SkyType.END) { - this.renderEndSky(poseStack); - } else if (this.minecraft.level.effects().skyType() == DimensionSpecialEffects.SkyType.NORMAL) { - Vec3 vec3 = this.level.getSkyColor(this.minecraft.gameRenderer.getMainCamera().getPosition(), partialTick); - float f = (float)vec3.x; - float g = (float)vec3.y; - float h = (float)vec3.z; - FogRenderer.levelFogColor(); - Tesselator tesselator = Tesselator.getInstance(); - RenderSystem.depthMask(false); - RenderSystem.setShaderColor(f, g, h, 1.0F); - ShaderInstance shaderInstance = RenderSystem.getShader(); - this.skyBuffer.bind(); - this.skyBuffer.drawWithShader(poseStack.last().pose(), projectionMatrix, shaderInstance); - VertexBuffer.unbind(); - RenderSystem.enableBlend(); - float[] fs = this.level.effects().getSunriseColor(this.level.getTimeOfDay(partialTick), partialTick); - if (fs != null) { - RenderSystem.setShader(GameRenderer::getPositionColorShader); - RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); - poseStack.pushPose(); - poseStack.mulPose(Axis.XP.rotationDegrees(90.0F)); - float i = Mth.sin(this.level.getSunAngle(partialTick)) < 0.0F ? 180.0F : 0.0F; - poseStack.mulPose(Axis.ZP.rotationDegrees(i)); - poseStack.mulPose(Axis.ZP.rotationDegrees(90.0F)); - float j = fs[0]; - float k = fs[1]; - float l = fs[2]; - Matrix4f matrix4f = poseStack.last().pose(); - BufferBuilder bufferBuilder = tesselator.begin(VertexFormat.Mode.TRIANGLE_FAN, DefaultVertexFormat.POSITION_COLOR); - bufferBuilder.addVertex(matrix4f, 0.0F, 100.0F, 0.0F).setColor(j, k, l, fs[3]); - int m = 16; - - for (int n = 0; n <= 16; n++) { - float o = n * (float) (Math.PI * 2) / 16.0F; - float p = Mth.sin(o); - float q = Mth.cos(o); - bufferBuilder.addVertex(matrix4f, p * 120.0F, q * 120.0F, -q * 40.0F * fs[3]).setColor(fs[0], fs[1], fs[2], 0.0F); + private void addSkyPass(FrameGraphBuilder frameGraphBuilder, Camera camera, float f, FogParameters fogParameters) { + FogType fogType = camera.getFluidInCamera(); + if (fogType != FogType.POWDER_SNOW && fogType != FogType.LAVA && !this.doesMobEffectBlockSky(camera)) { + DimensionSpecialEffects dimensionSpecialEffects = this.level.effects(); + DimensionSpecialEffects.SkyType skyType = dimensionSpecialEffects.skyType(); + if (skyType != DimensionSpecialEffects.SkyType.NONE) { + FramePass framePass = frameGraphBuilder.addPass("sky"); + this.targets.main = framePass.readsAndWrites(this.targets.main); + framePass.executes(() -> { + RenderSystem.setShaderFog(fogParameters); + RenderStateShard.MAIN_TARGET.setupRenderState(); + PoseStack poseStack = new PoseStack(); + if (skyType == DimensionSpecialEffects.SkyType.END) { + this.skyRenderer.renderEndSky(poseStack); + } else { + Tesselator tesselator = Tesselator.getInstance(); + float g = this.level.getSunAngle(f); + float h = this.level.getTimeOfDay(f); + float i = 1.0F - this.level.getRainLevel(f); + float j = this.level.getStarBrightness(f) * i; + int k = dimensionSpecialEffects.getSunriseOrSunsetColor(h); + int l = this.level.getMoonPhase(); + int m = this.level.getSkyColor(this.minecraft.gameRenderer.getMainCamera().getPosition(), f); + float n = ARGB.from8BitChannel(ARGB.red(m)); + float o = ARGB.from8BitChannel(ARGB.green(m)); + float p = ARGB.from8BitChannel(ARGB.blue(m)); + this.skyRenderer.renderSkyDisc(n, o, p); + if (dimensionSpecialEffects.isSunriseOrSunset(h)) { + this.skyRenderer.renderSunriseAndSunset(poseStack, tesselator, g, k); } - BufferUploader.drawWithShader(bufferBuilder.buildOrThrow()); - poseStack.popPose(); + this.skyRenderer.renderSunMoonAndStars(poseStack, tesselator, h, l, i, j, fogParameters); + if (this.shouldRenderDarkDisc(f)) { + this.skyRenderer.renderDarkDisc(poseStack); + } } - - RenderSystem.blendFuncSeparate( - GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO - ); - poseStack.pushPose(); - float i = 1.0F - this.level.getRainLevel(partialTick); - RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, i); - poseStack.mulPose(Axis.YP.rotationDegrees(-90.0F)); - poseStack.mulPose(Axis.XP.rotationDegrees(this.level.getTimeOfDay(partialTick) * 360.0F)); - Matrix4f matrix4f2 = poseStack.last().pose(); - float k = 30.0F; - RenderSystem.setShader(GameRenderer::getPositionTexShader); - RenderSystem.setShaderTexture(0, SUN_LOCATION); - BufferBuilder bufferBuilder2 = tesselator.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX); - bufferBuilder2.addVertex(matrix4f2, -k, 100.0F, -k).setUv(0.0F, 0.0F); - bufferBuilder2.addVertex(matrix4f2, k, 100.0F, -k).setUv(1.0F, 0.0F); - bufferBuilder2.addVertex(matrix4f2, k, 100.0F, k).setUv(1.0F, 1.0F); - bufferBuilder2.addVertex(matrix4f2, -k, 100.0F, k).setUv(0.0F, 1.0F); - BufferUploader.drawWithShader(bufferBuilder2.buildOrThrow()); - k = 20.0F; - RenderSystem.setShaderTexture(0, MOON_LOCATION); - int r = this.level.getMoonPhase(); - int s = r % 4; - int m = r / 4 % 2; - float t = (s + 0) / 4.0F; - float o = (m + 0) / 2.0F; - float p = (s + 1) / 4.0F; - float q = (m + 1) / 2.0F; - bufferBuilder2 = tesselator.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX); - bufferBuilder2.addVertex(matrix4f2, -k, -100.0F, k).setUv(p, q); - bufferBuilder2.addVertex(matrix4f2, k, -100.0F, k).setUv(t, q); - bufferBuilder2.addVertex(matrix4f2, k, -100.0F, -k).setUv(t, o); - bufferBuilder2.addVertex(matrix4f2, -k, -100.0F, -k).setUv(p, o); - BufferUploader.drawWithShader(bufferBuilder2.buildOrThrow()); - float u = this.level.getStarBrightness(partialTick) * i; - if (u > 0.0F) { - RenderSystem.setShaderColor(u, u, u, u); - FogRenderer.setupNoFog(); - this.starBuffer.bind(); - this.starBuffer.drawWithShader(poseStack.last().pose(), projectionMatrix, GameRenderer.getPositionShader()); - VertexBuffer.unbind(); - skyFogSetup.run(); - } - - RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); - RenderSystem.disableBlend(); - RenderSystem.defaultBlendFunc(); - poseStack.popPose(); - RenderSystem.setShaderColor(0.0F, 0.0F, 0.0F, 1.0F); - double d = this.minecraft.player.getEyePosition(partialTick).y - this.level.getLevelData().getHorizonHeight(this.level); - if (d < 0.0) { - poseStack.pushPose(); - poseStack.translate(0.0F, 12.0F, 0.0F); - this.darkBuffer.bind(); - this.darkBuffer.drawWithShader(poseStack.last().pose(), projectionMatrix, shaderInstance); - VertexBuffer.unbind(); - poseStack.popPose(); - } - - RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); - RenderSystem.depthMask(true); - } + }); } } } + private boolean shouldRenderDarkDisc(float f) { + return this.minecraft.player.getEyePosition(f).y - this.level.getLevelData().getHorizonHeight(this.level) < 0.0; + } + private boolean doesMobEffectBlockSky(Camera camera) { return !(camera.getEntity() instanceof LivingEntity livingEntity) ? false : livingEntity.hasEffect(MobEffects.BLINDNESS) || livingEntity.hasEffect(MobEffects.DARKNESS); } - public void renderClouds(PoseStack poseStack, Matrix4f frustumMatrix, Matrix4f projectionMatrix, float partialTick, double camX, double camY, double camZ) { - float f = this.level.effects().getCloudHeight(); - if (!Float.isNaN(f)) { - float g = 12.0F; - float h = 4.0F; - double d = 2.0E-4; - double e = (this.ticks + partialTick) * 0.03F; - double i = (camX + e) / 12.0; - double j = f - (float)camY + 0.33F; - double k = camZ / 12.0 + 0.33F; - i -= Mth.floor(i / 2048.0) * 2048; - k -= Mth.floor(k / 2048.0) * 2048; - float l = (float)(i - Mth.floor(i)); - float m = (float)(j / 4.0 - Mth.floor(j / 4.0)) * 4.0F; - float n = (float)(k - Mth.floor(k)); - Vec3 vec3 = this.level.getCloudColor(partialTick); - int o = (int)Math.floor(i); - int p = (int)Math.floor(j / 4.0); - int q = (int)Math.floor(k); - if (o != this.prevCloudX - || p != this.prevCloudY - || q != this.prevCloudZ - || this.minecraft.options.getCloudsType() != this.prevCloudsType - || this.prevCloudColor.distanceToSqr(vec3) > 2.0E-4) { - this.prevCloudX = o; - this.prevCloudY = p; - this.prevCloudZ = q; - this.prevCloudColor = vec3; - this.prevCloudsType = this.minecraft.options.getCloudsType(); - this.generateClouds = true; - } - - if (this.generateClouds) { - this.generateClouds = false; - if (this.cloudBuffer != null) { - this.cloudBuffer.close(); - } - - this.cloudBuffer = new VertexBuffer(VertexBuffer.Usage.STATIC); - this.cloudBuffer.bind(); - this.cloudBuffer.upload(this.buildClouds(Tesselator.getInstance(), i, j, k, vec3)); - VertexBuffer.unbind(); - } - - FogRenderer.levelFogColor(); - poseStack.pushPose(); - poseStack.mulPose(frustumMatrix); - poseStack.scale(12.0F, 1.0F, 12.0F); - poseStack.translate(-l, m, -n); - if (this.cloudBuffer != null) { - this.cloudBuffer.bind(); - int r = this.prevCloudsType == CloudStatus.FANCY ? 0 : 1; - - for (int s = r; s < 2; s++) { - RenderType renderType = s == 0 ? RenderType.cloudsDepthOnly() : RenderType.clouds(); - renderType.setupRenderState(); - ShaderInstance shaderInstance = RenderSystem.getShader(); - this.cloudBuffer.drawWithShader(poseStack.last().pose(), projectionMatrix, shaderInstance); - renderType.clearRenderState(); - } - - VertexBuffer.unbind(); - } - - poseStack.popPose(); - } - } - - private MeshData buildClouds(Tesselator tesselator, double x, double y, double z, Vec3 cloudColor) { - float f = 4.0F; - float g = 0.00390625F; - int i = 8; - int j = 4; - float h = 9.765625E-4F; - float k = Mth.floor(x) * 0.00390625F; - float l = Mth.floor(z) * 0.00390625F; - float m = (float)cloudColor.x; - float n = (float)cloudColor.y; - float o = (float)cloudColor.z; - float p = m * 0.9F; - float q = n * 0.9F; - float r = o * 0.9F; - float s = m * 0.7F; - float t = n * 0.7F; - float u = o * 0.7F; - float v = m * 0.8F; - float w = n * 0.8F; - float aa = o * 0.8F; - BufferBuilder bufferBuilder = tesselator.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX_COLOR_NORMAL); - float ab = (float)Math.floor(y / 4.0) * 4.0F; - if (this.prevCloudsType == CloudStatus.FANCY) { - for (int ac = -3; ac <= 4; ac++) { - for (int ad = -3; ad <= 4; ad++) { - float ae = ac * 8; - float af = ad * 8; - if (ab > -5.0F) { - bufferBuilder.addVertex(ae + 0.0F, ab + 0.0F, af + 8.0F) - .setUv((ae + 0.0F) * 0.00390625F + k, (af + 8.0F) * 0.00390625F + l) - .setColor(s, t, u, 0.8F) - .setNormal(0.0F, -1.0F, 0.0F); - bufferBuilder.addVertex(ae + 8.0F, ab + 0.0F, af + 8.0F) - .setUv((ae + 8.0F) * 0.00390625F + k, (af + 8.0F) * 0.00390625F + l) - .setColor(s, t, u, 0.8F) - .setNormal(0.0F, -1.0F, 0.0F); - bufferBuilder.addVertex(ae + 8.0F, ab + 0.0F, af + 0.0F) - .setUv((ae + 8.0F) * 0.00390625F + k, (af + 0.0F) * 0.00390625F + l) - .setColor(s, t, u, 0.8F) - .setNormal(0.0F, -1.0F, 0.0F); - bufferBuilder.addVertex(ae + 0.0F, ab + 0.0F, af + 0.0F) - .setUv((ae + 0.0F) * 0.00390625F + k, (af + 0.0F) * 0.00390625F + l) - .setColor(s, t, u, 0.8F) - .setNormal(0.0F, -1.0F, 0.0F); - } - - if (ab <= 5.0F) { - bufferBuilder.addVertex(ae + 0.0F, ab + 4.0F - 9.765625E-4F, af + 8.0F) - .setUv((ae + 0.0F) * 0.00390625F + k, (af + 8.0F) * 0.00390625F + l) - .setColor(m, n, o, 0.8F) - .setNormal(0.0F, 1.0F, 0.0F); - bufferBuilder.addVertex(ae + 8.0F, ab + 4.0F - 9.765625E-4F, af + 8.0F) - .setUv((ae + 8.0F) * 0.00390625F + k, (af + 8.0F) * 0.00390625F + l) - .setColor(m, n, o, 0.8F) - .setNormal(0.0F, 1.0F, 0.0F); - bufferBuilder.addVertex(ae + 8.0F, ab + 4.0F - 9.765625E-4F, af + 0.0F) - .setUv((ae + 8.0F) * 0.00390625F + k, (af + 0.0F) * 0.00390625F + l) - .setColor(m, n, o, 0.8F) - .setNormal(0.0F, 1.0F, 0.0F); - bufferBuilder.addVertex(ae + 0.0F, ab + 4.0F - 9.765625E-4F, af + 0.0F) - .setUv((ae + 0.0F) * 0.00390625F + k, (af + 0.0F) * 0.00390625F + l) - .setColor(m, n, o, 0.8F) - .setNormal(0.0F, 1.0F, 0.0F); - } - - if (ac > -1) { - for (int ag = 0; ag < 8; ag++) { - bufferBuilder.addVertex(ae + ag + 0.0F, ab + 0.0F, af + 8.0F) - .setUv((ae + ag + 0.5F) * 0.00390625F + k, (af + 8.0F) * 0.00390625F + l) - .setColor(p, q, r, 0.8F) - .setNormal(-1.0F, 0.0F, 0.0F); - bufferBuilder.addVertex(ae + ag + 0.0F, ab + 4.0F, af + 8.0F) - .setUv((ae + ag + 0.5F) * 0.00390625F + k, (af + 8.0F) * 0.00390625F + l) - .setColor(p, q, r, 0.8F) - .setNormal(-1.0F, 0.0F, 0.0F); - bufferBuilder.addVertex(ae + ag + 0.0F, ab + 4.0F, af + 0.0F) - .setUv((ae + ag + 0.5F) * 0.00390625F + k, (af + 0.0F) * 0.00390625F + l) - .setColor(p, q, r, 0.8F) - .setNormal(-1.0F, 0.0F, 0.0F); - bufferBuilder.addVertex(ae + ag + 0.0F, ab + 0.0F, af + 0.0F) - .setUv((ae + ag + 0.5F) * 0.00390625F + k, (af + 0.0F) * 0.00390625F + l) - .setColor(p, q, r, 0.8F) - .setNormal(-1.0F, 0.0F, 0.0F); - } - } - - if (ac <= 1) { - for (int ag = 0; ag < 8; ag++) { - bufferBuilder.addVertex(ae + ag + 1.0F - 9.765625E-4F, ab + 0.0F, af + 8.0F) - .setUv((ae + ag + 0.5F) * 0.00390625F + k, (af + 8.0F) * 0.00390625F + l) - .setColor(p, q, r, 0.8F) - .setNormal(1.0F, 0.0F, 0.0F); - bufferBuilder.addVertex(ae + ag + 1.0F - 9.765625E-4F, ab + 4.0F, af + 8.0F) - .setUv((ae + ag + 0.5F) * 0.00390625F + k, (af + 8.0F) * 0.00390625F + l) - .setColor(p, q, r, 0.8F) - .setNormal(1.0F, 0.0F, 0.0F); - bufferBuilder.addVertex(ae + ag + 1.0F - 9.765625E-4F, ab + 4.0F, af + 0.0F) - .setUv((ae + ag + 0.5F) * 0.00390625F + k, (af + 0.0F) * 0.00390625F + l) - .setColor(p, q, r, 0.8F) - .setNormal(1.0F, 0.0F, 0.0F); - bufferBuilder.addVertex(ae + ag + 1.0F - 9.765625E-4F, ab + 0.0F, af + 0.0F) - .setUv((ae + ag + 0.5F) * 0.00390625F + k, (af + 0.0F) * 0.00390625F + l) - .setColor(p, q, r, 0.8F) - .setNormal(1.0F, 0.0F, 0.0F); - } - } - - if (ad > -1) { - for (int ag = 0; ag < 8; ag++) { - bufferBuilder.addVertex(ae + 0.0F, ab + 4.0F, af + ag + 0.0F) - .setUv((ae + 0.0F) * 0.00390625F + k, (af + ag + 0.5F) * 0.00390625F + l) - .setColor(v, w, aa, 0.8F) - .setNormal(0.0F, 0.0F, -1.0F); - bufferBuilder.addVertex(ae + 8.0F, ab + 4.0F, af + ag + 0.0F) - .setUv((ae + 8.0F) * 0.00390625F + k, (af + ag + 0.5F) * 0.00390625F + l) - .setColor(v, w, aa, 0.8F) - .setNormal(0.0F, 0.0F, -1.0F); - bufferBuilder.addVertex(ae + 8.0F, ab + 0.0F, af + ag + 0.0F) - .setUv((ae + 8.0F) * 0.00390625F + k, (af + ag + 0.5F) * 0.00390625F + l) - .setColor(v, w, aa, 0.8F) - .setNormal(0.0F, 0.0F, -1.0F); - bufferBuilder.addVertex(ae + 0.0F, ab + 0.0F, af + ag + 0.0F) - .setUv((ae + 0.0F) * 0.00390625F + k, (af + ag + 0.5F) * 0.00390625F + l) - .setColor(v, w, aa, 0.8F) - .setNormal(0.0F, 0.0F, -1.0F); - } - } - - if (ad <= 1) { - for (int ag = 0; ag < 8; ag++) { - bufferBuilder.addVertex(ae + 0.0F, ab + 4.0F, af + ag + 1.0F - 9.765625E-4F) - .setUv((ae + 0.0F) * 0.00390625F + k, (af + ag + 0.5F) * 0.00390625F + l) - .setColor(v, w, aa, 0.8F) - .setNormal(0.0F, 0.0F, 1.0F); - bufferBuilder.addVertex(ae + 8.0F, ab + 4.0F, af + ag + 1.0F - 9.765625E-4F) - .setUv((ae + 8.0F) * 0.00390625F + k, (af + ag + 0.5F) * 0.00390625F + l) - .setColor(v, w, aa, 0.8F) - .setNormal(0.0F, 0.0F, 1.0F); - bufferBuilder.addVertex(ae + 8.0F, ab + 0.0F, af + ag + 1.0F - 9.765625E-4F) - .setUv((ae + 8.0F) * 0.00390625F + k, (af + ag + 0.5F) * 0.00390625F + l) - .setColor(v, w, aa, 0.8F) - .setNormal(0.0F, 0.0F, 1.0F); - bufferBuilder.addVertex(ae + 0.0F, ab + 0.0F, af + ag + 1.0F - 9.765625E-4F) - .setUv((ae + 0.0F) * 0.00390625F + k, (af + ag + 0.5F) * 0.00390625F + l) - .setColor(v, w, aa, 0.8F) - .setNormal(0.0F, 0.0F, 1.0F); - } - } - } - } - } else { - int ac = 1; - int ad = 32; - - for (int ah = -32; ah < 32; ah += 32) { - for (int ai = -32; ai < 32; ai += 32) { - bufferBuilder.addVertex(ah + 0, ab, ai + 32) - .setUv((ah + 0) * 0.00390625F + k, (ai + 32) * 0.00390625F + l) - .setColor(m, n, o, 0.8F) - .setNormal(0.0F, -1.0F, 0.0F); - bufferBuilder.addVertex(ah + 32, ab, ai + 32) - .setUv((ah + 32) * 0.00390625F + k, (ai + 32) * 0.00390625F + l) - .setColor(m, n, o, 0.8F) - .setNormal(0.0F, -1.0F, 0.0F); - bufferBuilder.addVertex(ah + 32, ab, ai + 0) - .setUv((ah + 32) * 0.00390625F + k, (ai + 0) * 0.00390625F + l) - .setColor(m, n, o, 0.8F) - .setNormal(0.0F, -1.0F, 0.0F); - bufferBuilder.addVertex(ah + 0, ab, ai + 0) - .setUv((ah + 0) * 0.00390625F + k, (ai + 0) * 0.00390625F + l) - .setColor(m, n, o, 0.8F) - .setNormal(0.0F, -1.0F, 0.0F); - } - } - } - - return bufferBuilder.buildOrThrow(); - } - private void compileSections(Camera camera) { - this.minecraft.getProfiler().push("populate_sections_to_compile"); + ProfilerFiller profilerFiller = Profiler.get(); + profilerFiller.push("populate_sections_to_compile"); LevelLightEngine levelLightEngine = this.level.getLightEngine(); RenderRegionCache renderRegionCache = new RenderRegionCache(); BlockPos blockPos = camera.getBlockPosition(); List list = Lists.newArrayList(); for (SectionRenderDispatcher.RenderSection renderSection : this.visibleSections) { - SectionPos sectionPos = SectionPos.of(renderSection.getOrigin()); - if (renderSection.isDirty() && levelLightEngine.lightOnInSection(sectionPos)) { + long l = renderSection.getSectionNode(); + if (renderSection.isDirty() && renderSection.hasAllNeighbors() && isLightOnInSectionAndNeighbors(levelLightEngine, l)) { boolean bl = false; if (this.minecraft.options.prioritizeChunkUpdates().get() == PrioritizeChunkUpdates.NEARBY) { BlockPos blockPos2 = renderSection.getOrigin().offset(8, 8, 8); @@ -1887,410 +1115,58 @@ public class LevelRenderer implements ResourceManagerReloadListener, AutoCloseab } if (bl) { - this.minecraft.getProfiler().push("build_near_sync"); + profilerFiller.push("build_near_sync"); this.sectionRenderDispatcher.rebuildSectionSync(renderSection, renderRegionCache); renderSection.setNotDirty(); - this.minecraft.getProfiler().pop(); + profilerFiller.pop(); } else { list.add(renderSection); } } } - this.minecraft.getProfiler().popPush("upload"); + profilerFiller.popPush("upload"); this.sectionRenderDispatcher.uploadAllPendingUploads(); - this.minecraft.getProfiler().popPush("schedule_async_compile"); + profilerFiller.popPush("schedule_async_compile"); for (SectionRenderDispatcher.RenderSection renderSectionx : list) { renderSectionx.rebuildSectionAsync(this.sectionRenderDispatcher, renderRegionCache); renderSectionx.setNotDirty(); } - this.minecraft.getProfiler().pop(); + profilerFiller.pop(); + this.scheduleTranslucentSectionResort(camera.getPosition()); } - private void renderWorldBorder(Camera camera) { - WorldBorder worldBorder = this.level.getWorldBorder(); - double d = this.minecraft.options.getEffectiveRenderDistance() * 16; - if (!(camera.getPosition().x < worldBorder.getMaxX() - d) - || !(camera.getPosition().x > worldBorder.getMinX() + d) - || !(camera.getPosition().z < worldBorder.getMaxZ() - d) - || !(camera.getPosition().z > worldBorder.getMinZ() + d)) { - double e = 1.0 - worldBorder.getDistanceToBorder(camera.getPosition().x, camera.getPosition().z) / d; - e = Math.pow(e, 4.0); - e = Mth.clamp(e, 0.0, 1.0); - double f = camera.getPosition().x; - double g = camera.getPosition().z; - double h = this.minecraft.gameRenderer.getDepthFar(); - RenderSystem.enableBlend(); - RenderSystem.enableDepthTest(); - RenderSystem.blendFuncSeparate( - GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO - ); - RenderSystem.setShaderTexture(0, FORCEFIELD_LOCATION); - RenderSystem.depthMask(Minecraft.useShaderTransparency()); - int i = worldBorder.getStatus().getColor(); - float j = (i >> 16 & 0xFF) / 255.0F; - float k = (i >> 8 & 0xFF) / 255.0F; - float l = (i & 0xFF) / 255.0F; - RenderSystem.setShaderColor(j, k, l, (float)e); - RenderSystem.setShader(GameRenderer::getPositionTexShader); - RenderSystem.polygonOffset(-3.0F, -3.0F); - RenderSystem.enablePolygonOffset(); - RenderSystem.disableCull(); - float m = (float)(Util.getMillis() % 3000L) / 3000.0F; - float n = (float)(-Mth.frac(camera.getPosition().y * 0.5)); - float o = n + (float)h; - BufferBuilder bufferBuilder = Tesselator.getInstance().begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX); - double p = Math.max(Mth.floor(g - d), worldBorder.getMinZ()); - double q = Math.min(Mth.ceil(g + d), worldBorder.getMaxZ()); - float r = (Mth.floor(p) & 1) * 0.5F; - if (f > worldBorder.getMaxX() - d) { - float s = r; + private static boolean isLightOnInSectionAndNeighbors(LevelLightEngine levelLightEngine, long l) { + int i = SectionPos.z(l); + int j = SectionPos.x(l); - for (double t = p; t < q; s += 0.5F) { - double u = Math.min(1.0, q - t); - float v = (float)u * 0.5F; - bufferBuilder.addVertex((float)(worldBorder.getMaxX() - f), (float)(-h), (float)(t - g)).setUv(m - s, m + o); - bufferBuilder.addVertex((float)(worldBorder.getMaxX() - f), (float)(-h), (float)(t + u - g)).setUv(m - (v + s), m + o); - bufferBuilder.addVertex((float)(worldBorder.getMaxX() - f), (float)h, (float)(t + u - g)).setUv(m - (v + s), m + n); - bufferBuilder.addVertex((float)(worldBorder.getMaxX() - f), (float)h, (float)(t - g)).setUv(m - s, m + n); - t++; + for (int k = i - 1; k <= i + 1; k++) { + for (int m = j - 1; m <= j + 1; m++) { + if (!levelLightEngine.lightOnInColumn(SectionPos.getZeroNode(m, k))) { + return false; } } - - if (f < worldBorder.getMinX() + d) { - float s = r; - - for (double t = p; t < q; s += 0.5F) { - double u = Math.min(1.0, q - t); - float v = (float)u * 0.5F; - bufferBuilder.addVertex((float)(worldBorder.getMinX() - f), (float)(-h), (float)(t - g)).setUv(m + s, m + o); - bufferBuilder.addVertex((float)(worldBorder.getMinX() - f), (float)(-h), (float)(t + u - g)).setUv(m + v + s, m + o); - bufferBuilder.addVertex((float)(worldBorder.getMinX() - f), (float)h, (float)(t + u - g)).setUv(m + v + s, m + n); - bufferBuilder.addVertex((float)(worldBorder.getMinX() - f), (float)h, (float)(t - g)).setUv(m + s, m + n); - t++; - } - } - - p = Math.max(Mth.floor(f - d), worldBorder.getMinX()); - q = Math.min(Mth.ceil(f + d), worldBorder.getMaxX()); - r = (Mth.floor(p) & 1) * 0.5F; - if (g > worldBorder.getMaxZ() - d) { - float s = r; - - for (double t = p; t < q; s += 0.5F) { - double u = Math.min(1.0, q - t); - float v = (float)u * 0.5F; - bufferBuilder.addVertex((float)(t - f), (float)(-h), (float)(worldBorder.getMaxZ() - g)).setUv(m + s, m + o); - bufferBuilder.addVertex((float)(t + u - f), (float)(-h), (float)(worldBorder.getMaxZ() - g)).setUv(m + v + s, m + o); - bufferBuilder.addVertex((float)(t + u - f), (float)h, (float)(worldBorder.getMaxZ() - g)).setUv(m + v + s, m + n); - bufferBuilder.addVertex((float)(t - f), (float)h, (float)(worldBorder.getMaxZ() - g)).setUv(m + s, m + n); - t++; - } - } - - if (g < worldBorder.getMinZ() + d) { - float s = r; - - for (double t = p; t < q; s += 0.5F) { - double u = Math.min(1.0, q - t); - float v = (float)u * 0.5F; - bufferBuilder.addVertex((float)(t - f), (float)(-h), (float)(worldBorder.getMinZ() - g)).setUv(m - s, m + o); - bufferBuilder.addVertex((float)(t + u - f), (float)(-h), (float)(worldBorder.getMinZ() - g)).setUv(m - (v + s), m + o); - bufferBuilder.addVertex((float)(t + u - f), (float)h, (float)(worldBorder.getMinZ() - g)).setUv(m - (v + s), m + n); - bufferBuilder.addVertex((float)(t - f), (float)h, (float)(worldBorder.getMinZ() - g)).setUv(m - s, m + n); - t++; - } - } - - MeshData meshData = bufferBuilder.build(); - if (meshData != null) { - BufferUploader.drawWithShader(meshData); - } - - RenderSystem.enableCull(); - RenderSystem.polygonOffset(0.0F, 0.0F); - RenderSystem.disablePolygonOffset(); - RenderSystem.disableBlend(); - RenderSystem.defaultBlendFunc(); - RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); - RenderSystem.depthMask(true); } + + return true; } private void renderHitOutline( - PoseStack poseStack, VertexConsumer consumer, Entity entity, double camX, double camY, double camZ, BlockPos pos, BlockState state + PoseStack poseStack, VertexConsumer vertexConsumer, Entity entity, double d, double e, double f, BlockPos blockPos, BlockState blockState, int i ) { - renderShape( + ShapeRenderer.renderShape( poseStack, - consumer, - state.getShape(this.level, pos, CollisionContext.of(entity)), - pos.getX() - camX, - pos.getY() - camY, - pos.getZ() - camZ, - 0.0F, - 0.0F, - 0.0F, - 0.4F + vertexConsumer, + blockState.getShape(this.level, blockPos, CollisionContext.of(entity)), + blockPos.getX() - d, + blockPos.getY() - e, + blockPos.getZ() - f, + i ); } - private static Vec3 mixColor(float hue) { - float f = 5.99999F; - int i = (int)(Mth.clamp(hue, 0.0F, 1.0F) * 5.99999F); - float g = hue * 5.99999F - i; - - return switch (i) { - case 0 -> new Vec3(1.0, g, 0.0); - case 1 -> new Vec3(1.0F - g, 1.0, 0.0); - case 2 -> new Vec3(0.0, 1.0, g); - case 3 -> new Vec3(0.0, 1.0 - g, 1.0); - case 4 -> new Vec3(g, 0.0, 1.0); - case 5 -> new Vec3(1.0, 0.0, 1.0 - g); - default -> throw new IllegalStateException("Unexpected value: " + i); - }; - } - - private static Vec3 shiftHue(float red, float green, float blue, float hue) { - Vec3 vec3 = mixColor(hue).scale(red); - Vec3 vec32 = mixColor((hue + 0.33333334F) % 1.0F).scale(green); - Vec3 vec33 = mixColor((hue + 0.6666667F) % 1.0F).scale(blue); - Vec3 vec34 = vec3.add(vec32).add(vec33); - double d = Math.max(Math.max(1.0, vec34.x), Math.max(vec34.y, vec34.z)); - return new Vec3(vec34.x / d, vec34.y / d, vec34.z / d); - } - - public static void renderVoxelShape( - PoseStack poseStack, VertexConsumer consumer, VoxelShape shape, double x, double y, double z, float red, float green, float blue, float alpha, boolean bl - ) { - List list = shape.toAabbs(); - if (!list.isEmpty()) { - int i = bl ? list.size() : list.size() * 8; - renderShape(poseStack, consumer, Shapes.create((AABB)list.get(0)), x, y, z, red, green, blue, alpha); - - for (int j = 1; j < list.size(); j++) { - AABB aABB = (AABB)list.get(j); - float f = (float)j / i; - Vec3 vec3 = shiftHue(red, green, blue, f); - renderShape(poseStack, consumer, Shapes.create(aABB), x, y, z, (float)vec3.x, (float)vec3.y, (float)vec3.z, alpha); - } - } - } - - private static void renderShape( - PoseStack poseStack, VertexConsumer consumer, VoxelShape shape, double x, double y, double z, float red, float green, float blue, float alpha - ) { - PoseStack.Pose pose = poseStack.last(); - shape.forAllEdges((k, l, m, n, o, p) -> { - float q = (float)(n - k); - float r = (float)(o - l); - float s = (float)(p - m); - float t = Mth.sqrt(q * q + r * r + s * s); - q /= t; - r /= t; - s /= t; - consumer.addVertex(pose, (float)(k + x), (float)(l + y), (float)(m + z)).setColor(red, green, blue, alpha).setNormal(pose, q, r, s); - consumer.addVertex(pose, (float)(n + x), (float)(o + y), (float)(p + z)).setColor(red, green, blue, alpha).setNormal(pose, q, r, s); - }); - } - - public static void renderLineBox( - VertexConsumer consumer, double minX, double minY, double minZ, double maxX, double maxY, double maxZ, float red, float green, float blue, float alpha - ) { - renderLineBox(new PoseStack(), consumer, minX, minY, minZ, maxX, maxY, maxZ, red, green, blue, alpha, red, green, blue); - } - - public static void renderLineBox(PoseStack poseStack, VertexConsumer buffer, AABB box, float red, float green, float blue, float alpha) { - renderLineBox(poseStack, buffer, box.minX, box.minY, box.minZ, box.maxX, box.maxY, box.maxZ, red, green, blue, alpha, red, green, blue); - } - - public static void renderLineBox( - PoseStack poseStack, - VertexConsumer consumer, - double minX, - double minY, - double minZ, - double maxX, - double maxY, - double maxZ, - float red, - float green, - float blue, - float alpha - ) { - renderLineBox(poseStack, consumer, minX, minY, minZ, maxX, maxY, maxZ, red, green, blue, alpha, red, green, blue); - } - - public static void renderLineBox( - PoseStack poseStack, - VertexConsumer consumer, - double minX, - double minY, - double minZ, - double maxX, - double maxY, - double maxZ, - float red, - float green, - float blue, - float alpha, - float red2, - float green2, - float blue2 - ) { - PoseStack.Pose pose = poseStack.last(); - float f = (float)minX; - float g = (float)minY; - float h = (float)minZ; - float i = (float)maxX; - float j = (float)maxY; - float k = (float)maxZ; - consumer.addVertex(pose, f, g, h).setColor(red, green2, blue2, alpha).setNormal(pose, 1.0F, 0.0F, 0.0F); - consumer.addVertex(pose, i, g, h).setColor(red, green2, blue2, alpha).setNormal(pose, 1.0F, 0.0F, 0.0F); - consumer.addVertex(pose, f, g, h).setColor(red2, green, blue2, alpha).setNormal(pose, 0.0F, 1.0F, 0.0F); - consumer.addVertex(pose, f, j, h).setColor(red2, green, blue2, alpha).setNormal(pose, 0.0F, 1.0F, 0.0F); - consumer.addVertex(pose, f, g, h).setColor(red2, green2, blue, alpha).setNormal(pose, 0.0F, 0.0F, 1.0F); - consumer.addVertex(pose, f, g, k).setColor(red2, green2, blue, alpha).setNormal(pose, 0.0F, 0.0F, 1.0F); - consumer.addVertex(pose, i, g, h).setColor(red, green, blue, alpha).setNormal(pose, 0.0F, 1.0F, 0.0F); - consumer.addVertex(pose, i, j, h).setColor(red, green, blue, alpha).setNormal(pose, 0.0F, 1.0F, 0.0F); - consumer.addVertex(pose, i, j, h).setColor(red, green, blue, alpha).setNormal(pose, -1.0F, 0.0F, 0.0F); - consumer.addVertex(pose, f, j, h).setColor(red, green, blue, alpha).setNormal(pose, -1.0F, 0.0F, 0.0F); - consumer.addVertex(pose, f, j, h).setColor(red, green, blue, alpha).setNormal(pose, 0.0F, 0.0F, 1.0F); - consumer.addVertex(pose, f, j, k).setColor(red, green, blue, alpha).setNormal(pose, 0.0F, 0.0F, 1.0F); - consumer.addVertex(pose, f, j, k).setColor(red, green, blue, alpha).setNormal(pose, 0.0F, -1.0F, 0.0F); - consumer.addVertex(pose, f, g, k).setColor(red, green, blue, alpha).setNormal(pose, 0.0F, -1.0F, 0.0F); - consumer.addVertex(pose, f, g, k).setColor(red, green, blue, alpha).setNormal(pose, 1.0F, 0.0F, 0.0F); - consumer.addVertex(pose, i, g, k).setColor(red, green, blue, alpha).setNormal(pose, 1.0F, 0.0F, 0.0F); - consumer.addVertex(pose, i, g, k).setColor(red, green, blue, alpha).setNormal(pose, 0.0F, 0.0F, -1.0F); - consumer.addVertex(pose, i, g, h).setColor(red, green, blue, alpha).setNormal(pose, 0.0F, 0.0F, -1.0F); - consumer.addVertex(pose, f, j, k).setColor(red, green, blue, alpha).setNormal(pose, 1.0F, 0.0F, 0.0F); - consumer.addVertex(pose, i, j, k).setColor(red, green, blue, alpha).setNormal(pose, 1.0F, 0.0F, 0.0F); - consumer.addVertex(pose, i, g, k).setColor(red, green, blue, alpha).setNormal(pose, 0.0F, 1.0F, 0.0F); - consumer.addVertex(pose, i, j, k).setColor(red, green, blue, alpha).setNormal(pose, 0.0F, 1.0F, 0.0F); - consumer.addVertex(pose, i, j, h).setColor(red, green, blue, alpha).setNormal(pose, 0.0F, 0.0F, 1.0F); - consumer.addVertex(pose, i, j, k).setColor(red, green, blue, alpha).setNormal(pose, 0.0F, 0.0F, 1.0F); - } - - public static void addChainedFilledBoxVertices( - PoseStack poseStack, - VertexConsumer consumer, - double minX, - double minY, - double minZ, - double maxX, - double maxY, - double maxZ, - float red, - float green, - float blue, - float alpha - ) { - addChainedFilledBoxVertices(poseStack, consumer, (float)minX, (float)minY, (float)minZ, (float)maxX, (float)maxY, (float)maxZ, red, green, blue, alpha); - } - - public static void addChainedFilledBoxVertices( - PoseStack poseStack, - VertexConsumer consumer, - float minX, - float minY, - float minZ, - float maxX, - float maxY, - float maxZ, - float red, - float green, - float blue, - float alpha - ) { - Matrix4f matrix4f = poseStack.last().pose(); - consumer.addVertex(matrix4f, minX, minY, minZ).setColor(red, green, blue, alpha); - consumer.addVertex(matrix4f, minX, minY, minZ).setColor(red, green, blue, alpha); - consumer.addVertex(matrix4f, minX, minY, minZ).setColor(red, green, blue, alpha); - consumer.addVertex(matrix4f, minX, minY, maxZ).setColor(red, green, blue, alpha); - consumer.addVertex(matrix4f, minX, maxY, minZ).setColor(red, green, blue, alpha); - consumer.addVertex(matrix4f, minX, maxY, maxZ).setColor(red, green, blue, alpha); - consumer.addVertex(matrix4f, minX, maxY, maxZ).setColor(red, green, blue, alpha); - consumer.addVertex(matrix4f, minX, minY, maxZ).setColor(red, green, blue, alpha); - consumer.addVertex(matrix4f, maxX, maxY, maxZ).setColor(red, green, blue, alpha); - consumer.addVertex(matrix4f, maxX, minY, maxZ).setColor(red, green, blue, alpha); - consumer.addVertex(matrix4f, maxX, minY, maxZ).setColor(red, green, blue, alpha); - consumer.addVertex(matrix4f, maxX, minY, minZ).setColor(red, green, blue, alpha); - consumer.addVertex(matrix4f, maxX, maxY, maxZ).setColor(red, green, blue, alpha); - consumer.addVertex(matrix4f, maxX, maxY, minZ).setColor(red, green, blue, alpha); - consumer.addVertex(matrix4f, maxX, maxY, minZ).setColor(red, green, blue, alpha); - consumer.addVertex(matrix4f, maxX, minY, minZ).setColor(red, green, blue, alpha); - consumer.addVertex(matrix4f, minX, maxY, minZ).setColor(red, green, blue, alpha); - consumer.addVertex(matrix4f, minX, minY, minZ).setColor(red, green, blue, alpha); - consumer.addVertex(matrix4f, minX, minY, minZ).setColor(red, green, blue, alpha); - consumer.addVertex(matrix4f, maxX, minY, minZ).setColor(red, green, blue, alpha); - consumer.addVertex(matrix4f, minX, minY, maxZ).setColor(red, green, blue, alpha); - consumer.addVertex(matrix4f, maxX, minY, maxZ).setColor(red, green, blue, alpha); - consumer.addVertex(matrix4f, maxX, minY, maxZ).setColor(red, green, blue, alpha); - consumer.addVertex(matrix4f, minX, maxY, minZ).setColor(red, green, blue, alpha); - consumer.addVertex(matrix4f, minX, maxY, minZ).setColor(red, green, blue, alpha); - consumer.addVertex(matrix4f, minX, maxY, maxZ).setColor(red, green, blue, alpha); - consumer.addVertex(matrix4f, maxX, maxY, minZ).setColor(red, green, blue, alpha); - consumer.addVertex(matrix4f, maxX, maxY, maxZ).setColor(red, green, blue, alpha); - consumer.addVertex(matrix4f, maxX, maxY, maxZ).setColor(red, green, blue, alpha); - consumer.addVertex(matrix4f, maxX, maxY, maxZ).setColor(red, green, blue, alpha); - } - - public static void renderFace( - PoseStack poseStack, - VertexConsumer buffer, - Direction face, - float x1, - float y1, - float z1, - float x2, - float y2, - float z2, - float red, - float green, - float blue, - float alpha - ) { - Matrix4f matrix4f = poseStack.last().pose(); - switch (face) { - case DOWN: - buffer.addVertex(matrix4f, x1, y1, z1).setColor(red, green, blue, alpha); - buffer.addVertex(matrix4f, x2, y1, z1).setColor(red, green, blue, alpha); - buffer.addVertex(matrix4f, x2, y1, z2).setColor(red, green, blue, alpha); - buffer.addVertex(matrix4f, x1, y1, z2).setColor(red, green, blue, alpha); - break; - case UP: - buffer.addVertex(matrix4f, x1, y2, z1).setColor(red, green, blue, alpha); - buffer.addVertex(matrix4f, x1, y2, z2).setColor(red, green, blue, alpha); - buffer.addVertex(matrix4f, x2, y2, z2).setColor(red, green, blue, alpha); - buffer.addVertex(matrix4f, x2, y2, z1).setColor(red, green, blue, alpha); - break; - case NORTH: - buffer.addVertex(matrix4f, x1, y1, z1).setColor(red, green, blue, alpha); - buffer.addVertex(matrix4f, x1, y2, z1).setColor(red, green, blue, alpha); - buffer.addVertex(matrix4f, x2, y2, z1).setColor(red, green, blue, alpha); - buffer.addVertex(matrix4f, x2, y1, z1).setColor(red, green, blue, alpha); - break; - case SOUTH: - buffer.addVertex(matrix4f, x1, y1, z2).setColor(red, green, blue, alpha); - buffer.addVertex(matrix4f, x2, y1, z2).setColor(red, green, blue, alpha); - buffer.addVertex(matrix4f, x2, y2, z2).setColor(red, green, blue, alpha); - buffer.addVertex(matrix4f, x1, y2, z2).setColor(red, green, blue, alpha); - break; - case WEST: - buffer.addVertex(matrix4f, x1, y1, z1).setColor(red, green, blue, alpha); - buffer.addVertex(matrix4f, x1, y1, z2).setColor(red, green, blue, alpha); - buffer.addVertex(matrix4f, x1, y2, z2).setColor(red, green, blue, alpha); - buffer.addVertex(matrix4f, x1, y2, z1).setColor(red, green, blue, alpha); - break; - case EAST: - buffer.addVertex(matrix4f, x2, y1, z1).setColor(red, green, blue, alpha); - buffer.addVertex(matrix4f, x2, y2, z1).setColor(red, green, blue, alpha); - buffer.addVertex(matrix4f, x2, y2, z2).setColor(red, green, blue, alpha); - buffer.addVertex(matrix4f, x2, y1, z2).setColor(red, green, blue, alpha); - } - } - public void blockChanged(BlockGetter level, BlockPos pos, BlockState oldState, BlockState newState, int flags) { this.setBlockDirty(pos, (flags & 8) != 0); } @@ -2325,10 +1201,14 @@ public class LevelRenderer implements ResourceManagerReloadListener, AutoCloseab } public void setSectionDirtyWithNeighbors(int sectionX, int sectionY, int sectionZ) { - for (int i = sectionZ - 1; i <= sectionZ + 1; i++) { - for (int j = sectionX - 1; j <= sectionX + 1; j++) { - for (int k = sectionY - 1; k <= sectionY + 1; k++) { - this.setSectionDirty(j, k, i); + this.setSectionRangeDirty(sectionX - 1, sectionY - 1, sectionZ - 1, sectionX + 1, sectionY + 1, sectionZ + 1); + } + + public void setSectionRangeDirty(int i, int j, int k, int l, int m, int n) { + for (int o = k; o <= n; o++) { + for (int p = i; p <= l; p++) { + for (int q = j; q <= m; q++) { + this.setSectionDirty(p, q, o); } } } @@ -2342,40 +1222,10 @@ public class LevelRenderer implements ResourceManagerReloadListener, AutoCloseab this.viewArea.setDirty(sectionX, sectionY, sectionZ, reRenderOnMainThread); } - public void playJukeboxSong(Holder song, BlockPos pos) { - if (this.level != null) { - this.stopJukeboxSong(pos); - JukeboxSong jukeboxSong = song.value(); - SoundEvent soundEvent = jukeboxSong.soundEvent().value(); - SoundInstance soundInstance = SimpleSoundInstance.forJukeboxSong(soundEvent, Vec3.atCenterOf(pos)); - this.playingJukeboxSongs.put(pos, soundInstance); - this.minecraft.getSoundManager().play(soundInstance); - this.minecraft.gui.setNowPlaying(jukeboxSong.description()); - this.notifyNearbyEntities(this.level, pos, true); - } - } - - private void stopJukeboxSong(BlockPos pos) { - SoundInstance soundInstance = (SoundInstance)this.playingJukeboxSongs.remove(pos); - if (soundInstance != null) { - this.minecraft.getSoundManager().stop(soundInstance); - } - } - - public void stopJukeboxSongAndNotifyNearby(BlockPos pos) { - this.stopJukeboxSong(pos); - if (this.level != null) { - this.notifyNearbyEntities(this.level, pos, false); - } - } - - /** - * Notifies living entities in a 3 block range of the specified {@code pos} that a record is or isn't playing nearby, dependent on the specified {@code playing} parameter. - * This is used to make parrots start or stop partying. - */ - private void notifyNearbyEntities(Level level, BlockPos pos, boolean playing) { - for (LivingEntity livingEntity : level.getEntitiesOfClass(LivingEntity.class, new AABB(pos).inflate(3.0))) { - livingEntity.setRecordPlayingNearby(pos, playing); + public void onSectionBecomingNonEmpty(long l) { + SectionRenderDispatcher.RenderSection renderSection = this.viewArea.getRenderSection(l); + if (renderSection != null) { + this.sectionOcclusionGraph.schedulePropagationFrom(renderSection); } } @@ -2408,7 +1258,7 @@ public class LevelRenderer implements ResourceManagerReloadListener, AutoCloseab } } - private void addParticle(T options, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed) { + public void addParticle(T options, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed) { this.addParticle(options, options.getType().getOverrideLimiter(), x, y, z, xSpeed, ySpeed, zSpeed); } @@ -2416,7 +1266,7 @@ public class LevelRenderer implements ResourceManagerReloadListener, AutoCloseab * @param force if {@code true}, the particle will be created regardless of its distance from the camera and the {@linkplain #calculateParticleLevel(boolean) calculated particle level} */ @Nullable - private Particle addParticleInternal(ParticleOptions options, boolean force, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed) { + Particle addParticleInternal(ParticleOptions options, boolean force, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed) { return this.addParticleInternal(options, force, false, x, y, z, xSpeed, ySpeed, zSpeed); } @@ -2439,14 +1289,9 @@ public class LevelRenderer implements ResourceManagerReloadListener, AutoCloseab } } - /** - * Calculates the level of particles to use based on the {@linkplain net.minecraft.client.Options#particles particles option} and the specified {@code decreased} parameter. This leads to randomly generating more or less particles than the set option. - * - * @param decreased if {@code true}, and the {@linkplain net.minecraft.client.Options#particles particles option} is set to minimal, has a 1 in 10 chance to return a decreased level and a further 1 in 3 chance to minimise it - */ - private ParticleStatus calculateParticleLevel(boolean decreased) { + private ParticleStatus calculateParticleLevel(boolean bl) { ParticleStatus particleStatus = this.minecraft.options.particles().get(); - if (decreased && particleStatus == ParticleStatus.MINIMAL && this.level.random.nextInt(10) == 0) { + if (bl && particleStatus == ParticleStatus.MINIMAL && this.level.random.nextInt(10) == 0) { particleStatus = ParticleStatus.DECREASED; } @@ -2457,565 +1302,6 @@ public class LevelRenderer implements ResourceManagerReloadListener, AutoCloseab return particleStatus; } - public void clear() { - } - - /** - * Handles a global level event. This includes playing sounds that should be heard by any player, regardless of position and dimension, such as the Wither spawning. - * - * @param type the type of level event to handle. This method only handles {@linkplain net.minecraft.world.level.block.LevelEvent#SOUND_WITHER_BOSS_SPAWN the wither boss spawn sound}, {@linkplain net.minecraft.world.level.block.LevelEvent#SOUND_DRAGON_DEATH the dragon's death sound}, and {@linkplain net.minecraft.world.level.block.LevelEvent#SOUND_END_PORTAL_SPAWN the end portal spawn sound}. - */ - public void globalLevelEvent(int type, BlockPos pos, int data) { - switch (type) { - case 1023: - case 1028: - case 1038: - Camera camera = this.minecraft.gameRenderer.getMainCamera(); - if (camera.isInitialized()) { - double d = pos.getX() - camera.getPosition().x; - double e = pos.getY() - camera.getPosition().y; - double f = pos.getZ() - camera.getPosition().z; - double g = Math.sqrt(d * d + e * e + f * f); - double h = camera.getPosition().x; - double i = camera.getPosition().y; - double j = camera.getPosition().z; - if (g > 0.0) { - h += d / g * 2.0; - i += e / g * 2.0; - j += f / g * 2.0; - } - - if (type == 1023) { - this.level.playLocalSound(h, i, j, SoundEvents.WITHER_SPAWN, SoundSource.HOSTILE, 1.0F, 1.0F, false); - } else if (type == 1038) { - this.level.playLocalSound(h, i, j, SoundEvents.END_PORTAL_SPAWN, SoundSource.HOSTILE, 1.0F, 1.0F, false); - } else { - this.level.playLocalSound(h, i, j, SoundEvents.ENDER_DRAGON_DEATH, SoundSource.HOSTILE, 5.0F, 1.0F, false); - } - } - } - } - - public void levelEvent(int type, BlockPos pos, int data) { - RandomSource randomSource = this.level.random; - switch (type) { - case 1000: - this.level.playLocalSound(pos, SoundEvents.DISPENSER_DISPENSE, SoundSource.BLOCKS, 1.0F, 1.0F, false); - break; - case 1001: - this.level.playLocalSound(pos, SoundEvents.DISPENSER_FAIL, SoundSource.BLOCKS, 1.0F, 1.2F, false); - break; - case 1002: - this.level.playLocalSound(pos, SoundEvents.DISPENSER_LAUNCH, SoundSource.BLOCKS, 1.0F, 1.2F, false); - break; - case 1004: - this.level.playLocalSound(pos, SoundEvents.FIREWORK_ROCKET_SHOOT, SoundSource.NEUTRAL, 1.0F, 1.2F, false); - break; - case 1009: - if (data == 0) { - this.level - .playLocalSound(pos, SoundEvents.FIRE_EXTINGUISH, SoundSource.BLOCKS, 0.5F, 2.6F + (randomSource.nextFloat() - randomSource.nextFloat()) * 0.8F, false); - } else if (data == 1) { - this.level - .playLocalSound( - pos, SoundEvents.GENERIC_EXTINGUISH_FIRE, SoundSource.BLOCKS, 0.7F, 1.6F + (randomSource.nextFloat() - randomSource.nextFloat()) * 0.4F, false - ); - } - break; - case 1010: - this.level.registryAccess().registryOrThrow(Registries.JUKEBOX_SONG).getHolder(data).ifPresent(reference -> this.playJukeboxSong(reference, pos)); - break; - case 1011: - this.stopJukeboxSongAndNotifyNearby(pos); - break; - case 1015: - this.level - .playLocalSound(pos, SoundEvents.GHAST_WARN, SoundSource.HOSTILE, 10.0F, (randomSource.nextFloat() - randomSource.nextFloat()) * 0.2F + 1.0F, false); - break; - case 1016: - this.level - .playLocalSound(pos, SoundEvents.GHAST_SHOOT, SoundSource.HOSTILE, 10.0F, (randomSource.nextFloat() - randomSource.nextFloat()) * 0.2F + 1.0F, false); - break; - case 1017: - this.level - .playLocalSound( - pos, SoundEvents.ENDER_DRAGON_SHOOT, SoundSource.HOSTILE, 10.0F, (randomSource.nextFloat() - randomSource.nextFloat()) * 0.2F + 1.0F, false - ); - break; - case 1018: - this.level - .playLocalSound(pos, SoundEvents.BLAZE_SHOOT, SoundSource.HOSTILE, 2.0F, (randomSource.nextFloat() - randomSource.nextFloat()) * 0.2F + 1.0F, false); - break; - case 1019: - this.level - .playLocalSound( - pos, SoundEvents.ZOMBIE_ATTACK_WOODEN_DOOR, SoundSource.HOSTILE, 2.0F, (randomSource.nextFloat() - randomSource.nextFloat()) * 0.2F + 1.0F, false - ); - break; - case 1020: - this.level - .playLocalSound( - pos, SoundEvents.ZOMBIE_ATTACK_IRON_DOOR, SoundSource.HOSTILE, 2.0F, (randomSource.nextFloat() - randomSource.nextFloat()) * 0.2F + 1.0F, false - ); - break; - case 1021: - this.level - .playLocalSound( - pos, SoundEvents.ZOMBIE_BREAK_WOODEN_DOOR, SoundSource.HOSTILE, 2.0F, (randomSource.nextFloat() - randomSource.nextFloat()) * 0.2F + 1.0F, false - ); - break; - case 1022: - this.level - .playLocalSound(pos, SoundEvents.WITHER_BREAK_BLOCK, SoundSource.HOSTILE, 2.0F, (randomSource.nextFloat() - randomSource.nextFloat()) * 0.2F + 1.0F, false); - break; - case 1024: - this.level - .playLocalSound(pos, SoundEvents.WITHER_SHOOT, SoundSource.HOSTILE, 2.0F, (randomSource.nextFloat() - randomSource.nextFloat()) * 0.2F + 1.0F, false); - break; - case 1025: - this.level - .playLocalSound(pos, SoundEvents.BAT_TAKEOFF, SoundSource.NEUTRAL, 0.05F, (randomSource.nextFloat() - randomSource.nextFloat()) * 0.2F + 1.0F, false); - break; - case 1026: - this.level - .playLocalSound(pos, SoundEvents.ZOMBIE_INFECT, SoundSource.HOSTILE, 2.0F, (randomSource.nextFloat() - randomSource.nextFloat()) * 0.2F + 1.0F, false); - break; - case 1027: - this.level - .playLocalSound( - pos, SoundEvents.ZOMBIE_VILLAGER_CONVERTED, SoundSource.HOSTILE, 2.0F, (randomSource.nextFloat() - randomSource.nextFloat()) * 0.2F + 1.0F, false - ); - break; - case 1029: - this.level.playLocalSound(pos, SoundEvents.ANVIL_DESTROY, SoundSource.BLOCKS, 1.0F, randomSource.nextFloat() * 0.1F + 0.9F, false); - break; - case 1030: - this.level.playLocalSound(pos, SoundEvents.ANVIL_USE, SoundSource.BLOCKS, 1.0F, randomSource.nextFloat() * 0.1F + 0.9F, false); - break; - case 1031: - this.level.playLocalSound(pos, SoundEvents.ANVIL_LAND, SoundSource.BLOCKS, 0.3F, this.level.random.nextFloat() * 0.1F + 0.9F, false); - break; - case 1032: - this.minecraft.getSoundManager().play(SimpleSoundInstance.forLocalAmbience(SoundEvents.PORTAL_TRAVEL, randomSource.nextFloat() * 0.4F + 0.8F, 0.25F)); - break; - case 1033: - this.level.playLocalSound(pos, SoundEvents.CHORUS_FLOWER_GROW, SoundSource.BLOCKS, 1.0F, 1.0F, false); - break; - case 1034: - this.level.playLocalSound(pos, SoundEvents.CHORUS_FLOWER_DEATH, SoundSource.BLOCKS, 1.0F, 1.0F, false); - break; - case 1035: - this.level.playLocalSound(pos, SoundEvents.BREWING_STAND_BREW, SoundSource.BLOCKS, 1.0F, 1.0F, false); - break; - case 1039: - this.level.playLocalSound(pos, SoundEvents.PHANTOM_BITE, SoundSource.HOSTILE, 0.3F, this.level.random.nextFloat() * 0.1F + 0.9F, false); - break; - case 1040: - this.level - .playLocalSound( - pos, SoundEvents.ZOMBIE_CONVERTED_TO_DROWNED, SoundSource.HOSTILE, 2.0F, (randomSource.nextFloat() - randomSource.nextFloat()) * 0.2F + 1.0F, false - ); - break; - case 1041: - this.level - .playLocalSound( - pos, SoundEvents.HUSK_CONVERTED_TO_ZOMBIE, SoundSource.HOSTILE, 2.0F, (randomSource.nextFloat() - randomSource.nextFloat()) * 0.2F + 1.0F, false - ); - break; - case 1042: - this.level.playLocalSound(pos, SoundEvents.GRINDSTONE_USE, SoundSource.BLOCKS, 1.0F, this.level.random.nextFloat() * 0.1F + 0.9F, false); - break; - case 1043: - this.level.playLocalSound(pos, SoundEvents.BOOK_PAGE_TURN, SoundSource.BLOCKS, 1.0F, this.level.random.nextFloat() * 0.1F + 0.9F, false); - break; - case 1044: - this.level.playLocalSound(pos, SoundEvents.SMITHING_TABLE_USE, SoundSource.BLOCKS, 1.0F, this.level.random.nextFloat() * 0.1F + 0.9F, false); - break; - case 1045: - this.level.playLocalSound(pos, SoundEvents.POINTED_DRIPSTONE_LAND, SoundSource.BLOCKS, 2.0F, this.level.random.nextFloat() * 0.1F + 0.9F, false); - break; - case 1046: - this.level - .playLocalSound(pos, SoundEvents.POINTED_DRIPSTONE_DRIP_LAVA_INTO_CAULDRON, SoundSource.BLOCKS, 2.0F, this.level.random.nextFloat() * 0.1F + 0.9F, false); - break; - case 1047: - this.level - .playLocalSound(pos, SoundEvents.POINTED_DRIPSTONE_DRIP_WATER_INTO_CAULDRON, SoundSource.BLOCKS, 2.0F, this.level.random.nextFloat() * 0.1F + 0.9F, false); - break; - case 1048: - this.level - .playLocalSound( - pos, SoundEvents.SKELETON_CONVERTED_TO_STRAY, SoundSource.HOSTILE, 2.0F, (randomSource.nextFloat() - randomSource.nextFloat()) * 0.2F + 1.0F, false - ); - break; - case 1049: - this.level.playLocalSound(pos, SoundEvents.CRAFTER_CRAFT, SoundSource.BLOCKS, 1.0F, 1.0F, false); - break; - case 1050: - this.level.playLocalSound(pos, SoundEvents.CRAFTER_FAIL, SoundSource.BLOCKS, 1.0F, 1.0F, false); - break; - case 1051: - this.level.playLocalSound(pos, SoundEvents.WIND_CHARGE_THROW, SoundSource.BLOCKS, 0.5F, 0.4F / (this.level.getRandom().nextFloat() * 0.4F + 0.8F), false); - case 2010: - this.shootParticles(data, pos, randomSource, ParticleTypes.WHITE_SMOKE); - break; - case 1500: - ComposterBlock.handleFill(this.level, pos, data > 0); - break; - case 1501: - this.level - .playLocalSound(pos, SoundEvents.LAVA_EXTINGUISH, SoundSource.BLOCKS, 0.5F, 2.6F + (randomSource.nextFloat() - randomSource.nextFloat()) * 0.8F, false); - - for (int mx = 0; mx < 8; mx++) { - this.level - .addParticle(ParticleTypes.LARGE_SMOKE, pos.getX() + randomSource.nextDouble(), pos.getY() + 1.2, pos.getZ() + randomSource.nextDouble(), 0.0, 0.0, 0.0); - } - break; - case 1502: - this.level - .playLocalSound( - pos, SoundEvents.REDSTONE_TORCH_BURNOUT, SoundSource.BLOCKS, 0.5F, 2.6F + (randomSource.nextFloat() - randomSource.nextFloat()) * 0.8F, false - ); - - for (int mx = 0; mx < 5; mx++) { - double g = pos.getX() + randomSource.nextDouble() * 0.6 + 0.2; - double n = pos.getY() + randomSource.nextDouble() * 0.6 + 0.2; - double o = pos.getZ() + randomSource.nextDouble() * 0.6 + 0.2; - this.level.addParticle(ParticleTypes.SMOKE, g, n, o, 0.0, 0.0, 0.0); - } - break; - case 1503: - this.level.playLocalSound(pos, SoundEvents.END_PORTAL_FRAME_FILL, SoundSource.BLOCKS, 1.0F, 1.0F, false); - - for (int mx = 0; mx < 16; mx++) { - double g = pos.getX() + (5.0 + randomSource.nextDouble() * 6.0) / 16.0; - double n = pos.getY() + 0.8125; - double o = pos.getZ() + (5.0 + randomSource.nextDouble() * 6.0) / 16.0; - this.level.addParticle(ParticleTypes.SMOKE, g, n, o, 0.0, 0.0, 0.0); - } - break; - case 1504: - PointedDripstoneBlock.spawnDripParticle(this.level, pos, this.level.getBlockState(pos)); - break; - case 1505: - BoneMealItem.addGrowthParticles(this.level, pos, data); - this.level.playLocalSound(pos, SoundEvents.BONE_MEAL_USE, SoundSource.BLOCKS, 1.0F, 1.0F, false); - break; - case 2000: - this.shootParticles(data, pos, randomSource, ParticleTypes.SMOKE); - break; - case 2001: - BlockState blockState = Block.stateById(data); - if (!blockState.isAir()) { - SoundType soundType = blockState.getSoundType(); - this.level.playLocalSound(pos, soundType.getBreakSound(), SoundSource.BLOCKS, (soundType.getVolume() + 1.0F) / 2.0F, soundType.getPitch() * 0.8F, false); - } - - this.level.addDestroyBlockEffect(pos, blockState); - break; - case 2002: - case 2007: - Vec3 vec3 = Vec3.atBottomCenterOf(pos); - - for (int j = 0; j < 8; j++) { - this.addParticle( - new ItemParticleOption(ParticleTypes.ITEM, new ItemStack(Items.SPLASH_POTION)), - vec3.x, - vec3.y, - vec3.z, - randomSource.nextGaussian() * 0.15, - randomSource.nextDouble() * 0.2, - randomSource.nextGaussian() * 0.15 - ); - } - - float h = (data >> 16 & 0xFF) / 255.0F; - float k = (data >> 8 & 0xFF) / 255.0F; - float l = (data >> 0 & 0xFF) / 255.0F; - ParticleOptions particleOptions = type == 2007 ? ParticleTypes.INSTANT_EFFECT : ParticleTypes.EFFECT; - - for (int mx = 0; mx < 100; mx++) { - double g = randomSource.nextDouble() * 4.0; - double n = randomSource.nextDouble() * Math.PI * 2.0; - double o = Math.cos(n) * g; - double p = 0.01 + randomSource.nextDouble() * 0.5; - double q = Math.sin(n) * g; - Particle particle = this.addParticleInternal( - particleOptions, particleOptions.getType().getOverrideLimiter(), vec3.x + o * 0.1, vec3.y + 0.3, vec3.z + q * 0.1, o, p, q - ); - if (particle != null) { - float r = 0.75F + randomSource.nextFloat() * 0.25F; - particle.setColor(h * r, k * r, l * r); - particle.setPower((float)g); - } - } - - this.level.playLocalSound(pos, SoundEvents.SPLASH_POTION_BREAK, SoundSource.NEUTRAL, 1.0F, randomSource.nextFloat() * 0.1F + 0.9F, false); - break; - case 2003: - double d = pos.getX() + 0.5; - double e = pos.getY(); - double f = pos.getZ() + 0.5; - - for (int i = 0; i < 8; i++) { - this.addParticle( - new ItemParticleOption(ParticleTypes.ITEM, new ItemStack(Items.ENDER_EYE)), - d, - e, - f, - randomSource.nextGaussian() * 0.15, - randomSource.nextDouble() * 0.2, - randomSource.nextGaussian() * 0.15 - ); - } - - for (double g = 0.0; g < Math.PI * 2; g += Math.PI / 20) { - this.addParticle(ParticleTypes.PORTAL, d + Math.cos(g) * 5.0, e - 0.4, f + Math.sin(g) * 5.0, Math.cos(g) * -5.0, 0.0, Math.sin(g) * -5.0); - this.addParticle(ParticleTypes.PORTAL, d + Math.cos(g) * 5.0, e - 0.4, f + Math.sin(g) * 5.0, Math.cos(g) * -7.0, 0.0, Math.sin(g) * -7.0); - } - break; - case 2004: - for (int sx = 0; sx < 20; sx++) { - double t = pos.getX() + 0.5 + (randomSource.nextDouble() - 0.5) * 2.0; - double u = pos.getY() + 0.5 + (randomSource.nextDouble() - 0.5) * 2.0; - double v = pos.getZ() + 0.5 + (randomSource.nextDouble() - 0.5) * 2.0; - this.level.addParticle(ParticleTypes.SMOKE, t, u, v, 0.0, 0.0, 0.0); - this.level.addParticle(ParticleTypes.FLAME, t, u, v, 0.0, 0.0, 0.0); - } - break; - case 2006: - for (int m = 0; m < 200; m++) { - float ab = randomSource.nextFloat() * 4.0F; - float ag = randomSource.nextFloat() * (float) (Math.PI * 2); - double n = Mth.cos(ag) * ab; - double o = 0.01 + randomSource.nextDouble() * 0.5; - double p = Mth.sin(ag) * ab; - Particle particle2 = this.addParticleInternal(ParticleTypes.DRAGON_BREATH, false, pos.getX() + n * 0.1, pos.getY() + 0.3, pos.getZ() + p * 0.1, n, o, p); - if (particle2 != null) { - particle2.setPower(ab); - } - } - - if (data == 1) { - this.level.playLocalSound(pos, SoundEvents.DRAGON_FIREBALL_EXPLODE, SoundSource.HOSTILE, 1.0F, randomSource.nextFloat() * 0.1F + 0.9F, false); - } - break; - case 2008: - this.level.addParticle(ParticleTypes.EXPLOSION, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, 0.0, 0.0, 0.0); - break; - case 2009: - for (int mx = 0; mx < 8; mx++) { - this.level - .addParticle(ParticleTypes.CLOUD, pos.getX() + randomSource.nextDouble(), pos.getY() + 1.2, pos.getZ() + randomSource.nextDouble(), 0.0, 0.0, 0.0); - } - break; - case 2011: - ParticleUtils.spawnParticleInBlock(this.level, pos, data, ParticleTypes.HAPPY_VILLAGER); - break; - case 2012: - ParticleUtils.spawnParticleInBlock(this.level, pos, data, ParticleTypes.HAPPY_VILLAGER); - break; - case 2013: - ParticleUtils.spawnSmashAttackParticles(this.level, pos, data); - break; - case 3000: - this.level.addParticle(ParticleTypes.EXPLOSION_EMITTER, true, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, 0.0, 0.0, 0.0); - this.level - .playLocalSound( - pos, - SoundEvents.END_GATEWAY_SPAWN, - SoundSource.BLOCKS, - 10.0F, - (1.0F + (this.level.random.nextFloat() - this.level.random.nextFloat()) * 0.2F) * 0.7F, - false - ); - break; - case 3001: - this.level.playLocalSound(pos, SoundEvents.ENDER_DRAGON_GROWL, SoundSource.HOSTILE, 64.0F, 0.8F + this.level.random.nextFloat() * 0.3F, false); - break; - case 3002: - if (data >= 0 && data < Direction.Axis.VALUES.length) { - ParticleUtils.spawnParticlesAlongAxis(Direction.Axis.VALUES[data], this.level, pos, 0.125, ParticleTypes.ELECTRIC_SPARK, UniformInt.of(10, 19)); - } else { - ParticleUtils.spawnParticlesOnBlockFaces(this.level, pos, ParticleTypes.ELECTRIC_SPARK, UniformInt.of(3, 5)); - } - break; - case 3003: - ParticleUtils.spawnParticlesOnBlockFaces(this.level, pos, ParticleTypes.WAX_ON, UniformInt.of(3, 5)); - this.level.playLocalSound(pos, SoundEvents.HONEYCOMB_WAX_ON, SoundSource.BLOCKS, 1.0F, 1.0F, false); - break; - case 3004: - ParticleUtils.spawnParticlesOnBlockFaces(this.level, pos, ParticleTypes.WAX_OFF, UniformInt.of(3, 5)); - break; - case 3005: - ParticleUtils.spawnParticlesOnBlockFaces(this.level, pos, ParticleTypes.SCRAPE, UniformInt.of(3, 5)); - break; - case 3006: - int s = data >> 6; - if (s > 0) { - if (randomSource.nextFloat() < 0.3F + s * 0.1F) { - float l = 0.15F + 0.02F * s * s * randomSource.nextFloat(); - float w = 0.4F + 0.3F * s * randomSource.nextFloat(); - this.level.playLocalSound(pos, SoundEvents.SCULK_BLOCK_CHARGE, SoundSource.BLOCKS, l, w, false); - } - - byte b = (byte)(data & 63); - IntProvider intProvider = UniformInt.of(0, s); - float x = 0.005F; - Supplier supplier = () -> new Vec3( - Mth.nextDouble(randomSource, -0.005F, 0.005F), Mth.nextDouble(randomSource, -0.005F, 0.005F), Mth.nextDouble(randomSource, -0.005F, 0.005F) - ); - if (b == 0) { - for (Direction direction : Direction.values()) { - float y = direction == Direction.DOWN ? (float) Math.PI : 0.0F; - double p = direction.getAxis() == Direction.Axis.Y ? 0.65 : 0.57; - ParticleUtils.spawnParticlesOnBlockFace(this.level, pos, new SculkChargeParticleOptions(y), intProvider, direction, supplier, p); - } - } else { - for (Direction direction2 : MultifaceBlock.unpack(b)) { - float z = direction2 == Direction.UP ? (float) Math.PI : 0.0F; - double o = 0.35; - ParticleUtils.spawnParticlesOnBlockFace(this.level, pos, new SculkChargeParticleOptions(z), intProvider, direction2, supplier, 0.35); - } - } - } else { - this.level.playLocalSound(pos, SoundEvents.SCULK_BLOCK_CHARGE, SoundSource.BLOCKS, 1.0F, 1.0F, false); - boolean bl = this.level.getBlockState(pos).isCollisionShapeFullBlock(this.level, pos); - int aa = bl ? 40 : 20; - float x = bl ? 0.45F : 0.25F; - float ab = 0.07F; - - for (int ac = 0; ac < aa; ac++) { - float ad = 2.0F * randomSource.nextFloat() - 1.0F; - float z = 2.0F * randomSource.nextFloat() - 1.0F; - float ae = 2.0F * randomSource.nextFloat() - 1.0F; - this.level - .addParticle( - ParticleTypes.SCULK_CHARGE_POP, pos.getX() + 0.5 + ad * x, pos.getY() + 0.5 + z * x, pos.getZ() + 0.5 + ae * x, ad * 0.07F, z * 0.07F, ae * 0.07F - ); - } - } - break; - case 3007: - for (int af = 0; af < 10; af++) { - this.level.addParticle(new ShriekParticleOption(af * 5), false, pos.getX() + 0.5, pos.getY() + SculkShriekerBlock.TOP_Y, pos.getZ() + 0.5, 0.0, 0.0, 0.0); - } - - BlockState blockState3 = this.level.getBlockState(pos); - boolean bl2 = blockState3.hasProperty(BlockStateProperties.WATERLOGGED) && (Boolean)blockState3.getValue(BlockStateProperties.WATERLOGGED); - if (!bl2) { - this.level - .playLocalSound( - pos.getX() + 0.5, - pos.getY() + SculkShriekerBlock.TOP_Y, - pos.getZ() + 0.5, - SoundEvents.SCULK_SHRIEKER_SHRIEK, - SoundSource.BLOCKS, - 2.0F, - 0.6F + this.level.random.nextFloat() * 0.4F, - false - ); - } - break; - case 3008: - BlockState blockState2 = Block.stateById(data); - if (blockState2.getBlock() instanceof BrushableBlock brushableBlock) { - this.level.playLocalSound(pos, brushableBlock.getBrushCompletedSound(), SoundSource.PLAYERS, 1.0F, 1.0F, false); - } - - this.level.addDestroyBlockEffect(pos, blockState2); - break; - case 3009: - ParticleUtils.spawnParticlesOnBlockFaces(this.level, pos, ParticleTypes.EGG_CRACK, UniformInt.of(3, 6)); - break; - case 3011: - TrialSpawner.addSpawnParticles(this.level, pos, randomSource, TrialSpawner.FlameParticle.decode(data).particleType); - break; - case 3012: - this.level - .playLocalSound( - pos, SoundEvents.TRIAL_SPAWNER_SPAWN_MOB, SoundSource.BLOCKS, 1.0F, (randomSource.nextFloat() - randomSource.nextFloat()) * 0.2F + 1.0F, true - ); - TrialSpawner.addSpawnParticles(this.level, pos, randomSource, TrialSpawner.FlameParticle.decode(data).particleType); - break; - case 3013: - this.level - .playLocalSound( - pos, SoundEvents.TRIAL_SPAWNER_DETECT_PLAYER, SoundSource.BLOCKS, 1.0F, (randomSource.nextFloat() - randomSource.nextFloat()) * 0.2F + 1.0F, true - ); - TrialSpawner.addDetectPlayerParticles(this.level, pos, randomSource, data, ParticleTypes.TRIAL_SPAWNER_DETECTED_PLAYER); - break; - case 3014: - this.level - .playLocalSound( - pos, SoundEvents.TRIAL_SPAWNER_EJECT_ITEM, SoundSource.BLOCKS, 1.0F, (randomSource.nextFloat() - randomSource.nextFloat()) * 0.2F + 1.0F, true - ); - TrialSpawner.addEjectItemParticles(this.level, pos, randomSource); - break; - case 3015: - if (this.level.getBlockEntity(pos) instanceof VaultBlockEntity vaultBlockEntity) { - VaultBlockEntity.Client.emitActivationParticles( - this.level, - vaultBlockEntity.getBlockPos(), - vaultBlockEntity.getBlockState(), - vaultBlockEntity.getSharedData(), - data == 0 ? ParticleTypes.SMALL_FLAME : ParticleTypes.SOUL_FIRE_FLAME - ); - this.level - .playLocalSound(pos, SoundEvents.VAULT_ACTIVATE, SoundSource.BLOCKS, 1.0F, (randomSource.nextFloat() - randomSource.nextFloat()) * 0.2F + 1.0F, true); - } - break; - case 3016: - VaultBlockEntity.Client.emitDeactivationParticles(this.level, pos, data == 0 ? ParticleTypes.SMALL_FLAME : ParticleTypes.SOUL_FIRE_FLAME); - this.level - .playLocalSound(pos, SoundEvents.VAULT_DEACTIVATE, SoundSource.BLOCKS, 1.0F, (randomSource.nextFloat() - randomSource.nextFloat()) * 0.2F + 1.0F, true); - break; - case 3017: - TrialSpawner.addEjectItemParticles(this.level, pos, randomSource); - break; - case 3018: - for (int sx = 0; sx < 10; sx++) { - double t = randomSource.nextGaussian() * 0.02; - double u = randomSource.nextGaussian() * 0.02; - double v = randomSource.nextGaussian() * 0.02; - this.level - .addParticle( - ParticleTypes.POOF, pos.getX() + randomSource.nextDouble(), pos.getY() + randomSource.nextDouble(), pos.getZ() + randomSource.nextDouble(), t, u, v - ); - } - - this.level - .playLocalSound(pos, SoundEvents.COBWEB_PLACE, SoundSource.BLOCKS, 1.0F, (randomSource.nextFloat() - randomSource.nextFloat()) * 0.2F + 1.0F, true); - break; - case 3019: - this.level - .playLocalSound( - pos, SoundEvents.TRIAL_SPAWNER_DETECT_PLAYER, SoundSource.BLOCKS, 1.0F, (randomSource.nextFloat() - randomSource.nextFloat()) * 0.2F + 1.0F, true - ); - TrialSpawner.addDetectPlayerParticles(this.level, pos, randomSource, data, ParticleTypes.TRIAL_SPAWNER_DETECTED_PLAYER_OMINOUS); - break; - case 3020: - this.level - .playLocalSound( - pos, - SoundEvents.TRIAL_SPAWNER_OMINOUS_ACTIVATE, - SoundSource.BLOCKS, - data == 0 ? 0.3F : 1.0F, - (randomSource.nextFloat() - randomSource.nextFloat()) * 0.2F + 1.0F, - true - ); - TrialSpawner.addDetectPlayerParticles(this.level, pos, randomSource, 0, ParticleTypes.TRIAL_SPAWNER_DETECTED_PLAYER_OMINOUS); - TrialSpawner.addBecomeOminousParticles(this.level, pos, randomSource); - break; - case 3021: - this.level - .playLocalSound( - pos, SoundEvents.TRIAL_SPAWNER_SPAWN_ITEM, SoundSource.BLOCKS, 1.0F, (randomSource.nextFloat() - randomSource.nextFloat()) * 0.2F + 1.0F, true - ); - TrialSpawner.addSpawnParticles(this.level, pos, randomSource, TrialSpawner.FlameParticle.decode(data).particleType); - } - } - public void destroyBlockProgress(int breakerId, BlockPos pos, int progress) { if (progress >= 0 && progress < 10) { BlockDestructionProgress blockDestructionProgress = this.destroyingBlocks.get(breakerId); @@ -3057,7 +1343,7 @@ public class LevelRenderer implements ResourceManagerReloadListener, AutoCloseab public void needsUpdate() { this.sectionOcclusionGraph.invalidate(); - this.generateClouds = true; + this.cloudRenderer.markForRebuild(); } public void updateGlobalBlockEntities(Collection blockEntitiesToRemove, Collection blockEntitiesToAdd) { @@ -3092,60 +1378,51 @@ public class LevelRenderer implements ResourceManagerReloadListener, AutoCloseab } @Nullable - public RenderTarget entityTarget() { - return this.entityTarget; + public RenderTarget entityOutlineTarget() { + return this.targets.entityOutline != null ? this.targets.entityOutline.get() : null; } @Nullable public RenderTarget getTranslucentTarget() { - return this.translucentTarget; + return this.targets.translucent != null ? this.targets.translucent.get() : null; } @Nullable public RenderTarget getItemEntityTarget() { - return this.itemEntityTarget; + return this.targets.itemEntity != null ? this.targets.itemEntity.get() : null; } @Nullable public RenderTarget getParticlesTarget() { - return this.particlesTarget; + return this.targets.particles != null ? this.targets.particles.get() : null; } @Nullable public RenderTarget getWeatherTarget() { - return this.weatherTarget; + return this.targets.weather != null ? this.targets.weather.get() : null; } @Nullable public RenderTarget getCloudsTarget() { - return this.cloudsTarget; + return this.targets.clouds != null ? this.targets.clouds.get() : null; } - private void shootParticles(int direction, BlockPos pos, RandomSource random, SimpleParticleType particleType) { - Direction direction2 = Direction.from3DDataValue(direction); - int i = direction2.getStepX(); - int j = direction2.getStepY(); - int k = direction2.getStepZ(); - double d = pos.getX() + i * 0.6 + 0.5; - double e = pos.getY() + j * 0.6 + 0.5; - double f = pos.getZ() + k * 0.6 + 0.5; - - for (int l = 0; l < 10; l++) { - double g = random.nextDouble() * 0.2 + 0.01; - double h = d + i * 0.01 + (random.nextDouble() - 0.5) * k * 0.5; - double m = e + j * 0.01 + (random.nextDouble() - 0.5) * j * 0.5; - double n = f + k * 0.01 + (random.nextDouble() - 0.5) * i * 0.5; - double o = i * g + random.nextGaussian() * 0.01; - double p = j * g + random.nextGaussian() * 0.01; - double q = k * g + random.nextGaussian() * 0.01; - this.addParticle(particleType, h, m, n, o, p, q); - } + @VisibleForDebug + public ObjectArrayList getVisibleSections() { + return this.visibleSections; } - @Environment(EnvType.CLIENT) - public static class TransparencyShaderException extends RuntimeException { - public TransparencyShaderException(String message, Throwable cause) { - super(message, cause); - } + @VisibleForDebug + public SectionOcclusionGraph getSectionOcclusionGraph() { + return this.sectionOcclusionGraph; + } + + @Nullable + public Frustum getCapturedFrustum() { + return this.capturedFrustum; + } + + public CloudRenderer getCloudRenderer() { + return this.cloudRenderer; } } diff --git a/net/minecraft/client/renderer/LevelTargetBundle.java b/net/minecraft/client/renderer/LevelTargetBundle.java new file mode 100644 index 00000000..46ad0a0a --- /dev/null +++ b/net/minecraft/client/renderer/LevelTargetBundle.java @@ -0,0 +1,91 @@ +package net.minecraft.client.renderer; + +import com.mojang.blaze3d.pipeline.RenderTarget; +import com.mojang.blaze3d.resource.ResourceHandle; +import java.util.Set; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.resources.ResourceLocation; +import org.jetbrains.annotations.Nullable; + +@Environment(EnvType.CLIENT) +public class LevelTargetBundle implements PostChain.TargetBundle { + public static final ResourceLocation MAIN_TARGET_ID = PostChain.MAIN_TARGET_ID; + public static final ResourceLocation TRANSLUCENT_TARGET_ID = ResourceLocation.withDefaultNamespace("translucent"); + public static final ResourceLocation ITEM_ENTITY_TARGET_ID = ResourceLocation.withDefaultNamespace("item_entity"); + public static final ResourceLocation PARTICLES_TARGET_ID = ResourceLocation.withDefaultNamespace("particles"); + public static final ResourceLocation WEATHER_TARGET_ID = ResourceLocation.withDefaultNamespace("weather"); + public static final ResourceLocation CLOUDS_TARGET_ID = ResourceLocation.withDefaultNamespace("clouds"); + public static final ResourceLocation ENTITY_OUTLINE_TARGET_ID = ResourceLocation.withDefaultNamespace("entity_outline"); + public static final Set MAIN_TARGETS = Set.of(MAIN_TARGET_ID); + public static final Set OUTLINE_TARGETS = Set.of(MAIN_TARGET_ID, ENTITY_OUTLINE_TARGET_ID); + public static final Set SORTING_TARGETS = Set.of( + MAIN_TARGET_ID, TRANSLUCENT_TARGET_ID, ITEM_ENTITY_TARGET_ID, PARTICLES_TARGET_ID, WEATHER_TARGET_ID, CLOUDS_TARGET_ID + ); + public ResourceHandle main = ResourceHandle.invalid(); + @Nullable + public ResourceHandle translucent; + @Nullable + public ResourceHandle itemEntity; + @Nullable + public ResourceHandle particles; + @Nullable + public ResourceHandle weather; + @Nullable + public ResourceHandle clouds; + @Nullable + public ResourceHandle entityOutline; + + @Override + public void replace(ResourceLocation resourceLocation, ResourceHandle resourceHandle) { + if (resourceLocation.equals(MAIN_TARGET_ID)) { + this.main = resourceHandle; + } else if (resourceLocation.equals(TRANSLUCENT_TARGET_ID)) { + this.translucent = resourceHandle; + } else if (resourceLocation.equals(ITEM_ENTITY_TARGET_ID)) { + this.itemEntity = resourceHandle; + } else if (resourceLocation.equals(PARTICLES_TARGET_ID)) { + this.particles = resourceHandle; + } else if (resourceLocation.equals(WEATHER_TARGET_ID)) { + this.weather = resourceHandle; + } else if (resourceLocation.equals(CLOUDS_TARGET_ID)) { + this.clouds = resourceHandle; + } else { + if (!resourceLocation.equals(ENTITY_OUTLINE_TARGET_ID)) { + throw new IllegalArgumentException("No target with id " + resourceLocation); + } + + this.entityOutline = resourceHandle; + } + } + + @Nullable + @Override + public ResourceHandle get(ResourceLocation resourceLocation) { + if (resourceLocation.equals(MAIN_TARGET_ID)) { + return this.main; + } else if (resourceLocation.equals(TRANSLUCENT_TARGET_ID)) { + return this.translucent; + } else if (resourceLocation.equals(ITEM_ENTITY_TARGET_ID)) { + return this.itemEntity; + } else if (resourceLocation.equals(PARTICLES_TARGET_ID)) { + return this.particles; + } else if (resourceLocation.equals(WEATHER_TARGET_ID)) { + return this.weather; + } else if (resourceLocation.equals(CLOUDS_TARGET_ID)) { + return this.clouds; + } else { + return resourceLocation.equals(ENTITY_OUTLINE_TARGET_ID) ? this.entityOutline : null; + } + } + + public void clear() { + this.main = ResourceHandle.invalid(); + this.translucent = null; + this.itemEntity = null; + this.particles = null; + this.weather = null; + this.clouds = null; + this.entityOutline = null; + } +} diff --git a/net/minecraft/client/renderer/LightTexture.java b/net/minecraft/client/renderer/LightTexture.java index 3dbaf665..6a904dfe 100644 --- a/net/minecraft/client/renderer/LightTexture.java +++ b/net/minecraft/client/renderer/LightTexture.java @@ -1,14 +1,19 @@ package net.minecraft.client.renderer; -import com.mojang.blaze3d.platform.NativeImage; +import com.mojang.blaze3d.pipeline.TextureTarget; import com.mojang.blaze3d.systems.RenderSystem; +import com.mojang.blaze3d.vertex.BufferBuilder; +import com.mojang.blaze3d.vertex.BufferUploader; +import com.mojang.blaze3d.vertex.DefaultVertexFormat; +import com.mojang.blaze3d.vertex.VertexFormat; +import java.util.Objects; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.Minecraft; import net.minecraft.client.multiplayer.ClientLevel; -import net.minecraft.client.renderer.texture.DynamicTexture; -import net.minecraft.resources.ResourceLocation; import net.minecraft.util.Mth; +import net.minecraft.util.profiling.Profiler; +import net.minecraft.util.profiling.ProfilerFiller; import net.minecraft.world.effect.MobEffectInstance; import net.minecraft.world.effect.MobEffects; import net.minecraft.world.entity.LivingEntity; @@ -20,9 +25,8 @@ public class LightTexture implements AutoCloseable { public static final int FULL_BRIGHT = 15728880; public static final int FULL_SKY = 15728640; public static final int FULL_BLOCK = 240; - private final DynamicTexture lightTexture; - private final NativeImage lightPixels; - private final ResourceLocation lightTextureLocation; + private static final int TEXTURE_SIZE = 16; + private final TextureTarget target; private boolean updateLightTexture; private float blockLightRedFlicker; private final GameRenderer renderer; @@ -31,21 +35,14 @@ public class LightTexture implements AutoCloseable { public LightTexture(GameRenderer renderer, Minecraft minecraft) { this.renderer = renderer; this.minecraft = minecraft; - this.lightTexture = new DynamicTexture(16, 16, false); - this.lightTextureLocation = this.minecraft.getTextureManager().register("light_map", this.lightTexture); - this.lightPixels = this.lightTexture.getPixels(); - - for (int i = 0; i < 16; i++) { - for (int j = 0; j < 16; j++) { - this.lightPixels.setPixelRGBA(j, i, -1); - } - } - - this.lightTexture.upload(); + this.target = new TextureTarget(16, 16, false); + this.target.setFilterMode(9729); + this.target.setClearColor(1.0F, 1.0F, 1.0F, 1.0F); + this.target.clear(); } public void close() { - this.lightTexture.close(); + this.target.destroyBuffers(); } public void tick() { @@ -59,10 +56,7 @@ public class LightTexture implements AutoCloseable { } public void turnOnLightLayer() { - RenderSystem.setShaderTexture(2, this.lightTextureLocation); - this.minecraft.getTextureManager().bindForSetup(this.lightTextureLocation); - RenderSystem.texParameter(3553, 10241, 9729); - RenderSystem.texParameter(3553, 10240, 9729); + RenderSystem.setShaderTexture(2, this.target.getColorTextureId()); } private float getDarknessGamma(float partialTick) { @@ -78,7 +72,8 @@ public class LightTexture implements AutoCloseable { public void updateLightTexture(float partialTicks) { if (this.updateLightTexture) { this.updateLightTexture = false; - this.minecraft.getProfiler().push("lightTex"); + ProfilerFiller profilerFiller = Profiler.get(); + profilerFiller.push("lightTex"); ClientLevel clientLevel = this.minecraft.level; if (clientLevel != null) { float f = clientLevel.getSkyDarken(1.0F); @@ -104,80 +99,42 @@ public class LightTexture implements AutoCloseable { Vector3f vector3f = new Vector3f(f, f, 1.0F).lerp(new Vector3f(1.0F, 1.0F, 1.0F), 0.35F); float m = this.blockLightRedFlicker + 1.5F; - Vector3f vector3f2 = new Vector3f(); - - for (int n = 0; n < 16; n++) { - for (int o = 0; o < 16; o++) { - float p = getBrightness(clientLevel.dimensionType(), n) * g; - float q = getBrightness(clientLevel.dimensionType(), o) * m; - float s = q * ((q * 0.6F + 0.4F) * 0.6F + 0.4F); - float t = q * (q * q * 0.6F + 0.4F); - vector3f2.set(q, s, t); - boolean bl = clientLevel.effects().forceBrightLightmap(); - if (bl) { - vector3f2.lerp(new Vector3f(0.99F, 1.12F, 1.0F), 0.25F); - clampColor(vector3f2); - } else { - Vector3f vector3f3 = new Vector3f(vector3f).mul(p); - vector3f2.add(vector3f3); - vector3f2.lerp(new Vector3f(0.75F, 0.75F, 0.75F), 0.04F); - if (this.renderer.getDarkenWorldAmount(partialTicks) > 0.0F) { - float u = this.renderer.getDarkenWorldAmount(partialTicks); - Vector3f vector3f4 = new Vector3f(vector3f2).mul(0.7F, 0.6F, 0.6F); - vector3f2.lerp(vector3f4, u); - } - } - - if (l > 0.0F) { - float v = Math.max(vector3f2.x(), Math.max(vector3f2.y(), vector3f2.z())); - if (v < 1.0F) { - float u = 1.0F / v; - Vector3f vector3f4 = new Vector3f(vector3f2).mul(u); - vector3f2.lerp(vector3f4, l); - } - } - - if (!bl) { - if (j > 0.0F) { - vector3f2.add(-j, -j, -j); - } - - clampColor(vector3f2); - } - - float v = this.minecraft.options.gamma().get().floatValue(); - Vector3f vector3f5 = new Vector3f(this.notGamma(vector3f2.x), this.notGamma(vector3f2.y), this.notGamma(vector3f2.z)); - vector3f2.lerp(vector3f5, Math.max(0.0F, v - i)); - vector3f2.lerp(new Vector3f(0.75F, 0.75F, 0.75F), 0.04F); - clampColor(vector3f2); - vector3f2.mul(255.0F); - int w = 255; - int x = (int)vector3f2.x(); - int y = (int)vector3f2.y(); - int z = (int)vector3f2.z(); - this.lightPixels.setPixelRGBA(o, n, 0xFF000000 | z << 16 | y << 8 | x); - } - } - - this.lightTexture.upload(); - this.minecraft.getProfiler().pop(); + float n = clientLevel.dimensionType().ambientLight(); + boolean bl = clientLevel.effects().forceBrightLightmap(); + float o = this.minecraft.options.gamma().get().floatValue(); + CompiledShaderProgram compiledShaderProgram = (CompiledShaderProgram)Objects.requireNonNull( + RenderSystem.setShader(CoreShaders.LIGHTMAP), "Lightmap shader not loaded" + ); + compiledShaderProgram.safeGetUniform("AmbientLightFactor").set(n); + compiledShaderProgram.safeGetUniform("SkyFactor").set(g); + compiledShaderProgram.safeGetUniform("BlockFactor").set(m); + compiledShaderProgram.safeGetUniform("UseBrightLightmap").set(bl ? 1 : 0); + compiledShaderProgram.safeGetUniform("SkyLightColor").set(vector3f); + compiledShaderProgram.safeGetUniform("NightVisionFactor").set(l); + compiledShaderProgram.safeGetUniform("DarknessScale").set(j); + compiledShaderProgram.safeGetUniform("DarkenWorldFactor").set(this.renderer.getDarkenWorldAmount(partialTicks)); + compiledShaderProgram.safeGetUniform("BrightnessFactor").set(Math.max(0.0F, o - i)); + this.target.bindWrite(true); + BufferBuilder bufferBuilder = RenderSystem.renderThreadTesselator().begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.BLIT_SCREEN); + bufferBuilder.addVertex(0.0F, 0.0F, 0.0F); + bufferBuilder.addVertex(1.0F, 0.0F, 0.0F); + bufferBuilder.addVertex(1.0F, 1.0F, 0.0F); + bufferBuilder.addVertex(0.0F, 1.0F, 0.0F); + BufferUploader.drawWithShader(bufferBuilder.buildOrThrow()); + this.target.unbindWrite(); + profilerFiller.pop(); } } } - private static void clampColor(Vector3f color) { - color.set(Mth.clamp(color.x, 0.0F, 1.0F), Mth.clamp(color.y, 0.0F, 1.0F), Mth.clamp(color.z, 0.0F, 1.0F)); - } - - private float notGamma(float value) { - float f = 1.0F - value; - return 1.0F - f * f * f * f; - } - public static float getBrightness(DimensionType dimensionType, int lightLevel) { - float f = lightLevel / 15.0F; - float g = f / (4.0F - 3.0F * f); - return Mth.lerp(dimensionType.ambientLight(), g, 1.0F); + return getBrightness(dimensionType.ambientLight(), lightLevel); + } + + public static float getBrightness(float f, int i) { + float g = i / 15.0F; + float h = g / (4.0F - 3.0F * g); + return Mth.lerp(f, h, 1.0F); } public static int pack(int blockLight, int skyLight) { @@ -185,10 +142,20 @@ public class LightTexture implements AutoCloseable { } public static int block(int packedLight) { - return packedLight >> 4 & 65535; + return packedLight >>> 4 & 15; } public static int sky(int packedLight) { - return packedLight >> 20 & 65535; + return packedLight >>> 20 & 15; + } + + public static int lightCoordsWithEmission(int i, int j) { + if (j == 0) { + return i; + } else { + int k = Math.max(sky(i), j); + int l = Math.max(block(i), j); + return pack(l, k); + } } } diff --git a/net/minecraft/client/renderer/MapRenderer.java b/net/minecraft/client/renderer/MapRenderer.java new file mode 100644 index 00000000..14118240 --- /dev/null +++ b/net/minecraft/client/renderer/MapRenderer.java @@ -0,0 +1,100 @@ +package net.minecraft.client.renderer; + +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; +import com.mojang.math.Axis; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.Font; +import net.minecraft.client.renderer.state.MapRenderState; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.resources.MapDecorationTextureManager; +import net.minecraft.client.resources.MapTextureManager; +import net.minecraft.network.chat.Component; +import net.minecraft.util.Mth; +import net.minecraft.world.level.saveddata.maps.MapDecoration; +import net.minecraft.world.level.saveddata.maps.MapId; +import net.minecraft.world.level.saveddata.maps.MapItemSavedData; +import org.joml.Matrix4f; + +@Environment(EnvType.CLIENT) +public class MapRenderer { + private static final float MAP_Z_OFFSET = -0.01F; + private static final float DECORATION_Z_OFFSET = -0.001F; + private static final int WIDTH = 128; + private static final int HEIGHT = 128; + private final MapTextureManager mapTextureManager; + private final MapDecorationTextureManager decorationTextures; + + public MapRenderer(MapDecorationTextureManager mapDecorationTextureManager, MapTextureManager mapTextureManager) { + this.decorationTextures = mapDecorationTextureManager; + this.mapTextureManager = mapTextureManager; + } + + public void render(MapRenderState mapRenderState, PoseStack poseStack, MultiBufferSource multiBufferSource, boolean bl, int i) { + Matrix4f matrix4f = poseStack.last().pose(); + VertexConsumer vertexConsumer = multiBufferSource.getBuffer(RenderType.text(mapRenderState.texture)); + vertexConsumer.addVertex(matrix4f, 0.0F, 128.0F, -0.01F).setColor(-1).setUv(0.0F, 1.0F).setLight(i); + vertexConsumer.addVertex(matrix4f, 128.0F, 128.0F, -0.01F).setColor(-1).setUv(1.0F, 1.0F).setLight(i); + vertexConsumer.addVertex(matrix4f, 128.0F, 0.0F, -0.01F).setColor(-1).setUv(1.0F, 0.0F).setLight(i); + vertexConsumer.addVertex(matrix4f, 0.0F, 0.0F, -0.01F).setColor(-1).setUv(0.0F, 0.0F).setLight(i); + int j = 0; + + for (MapRenderState.MapDecorationRenderState mapDecorationRenderState : mapRenderState.decorations) { + if (!bl || mapDecorationRenderState.renderOnFrame) { + poseStack.pushPose(); + poseStack.translate(mapDecorationRenderState.x / 2.0F + 64.0F, mapDecorationRenderState.y / 2.0F + 64.0F, -0.02F); + poseStack.mulPose(Axis.ZP.rotationDegrees(mapDecorationRenderState.rot * 360 / 16.0F)); + poseStack.scale(4.0F, 4.0F, 3.0F); + poseStack.translate(-0.125F, 0.125F, 0.0F); + Matrix4f matrix4f2 = poseStack.last().pose(); + TextureAtlasSprite textureAtlasSprite = mapDecorationRenderState.atlasSprite; + if (textureAtlasSprite != null) { + VertexConsumer vertexConsumer2 = multiBufferSource.getBuffer(RenderType.text(textureAtlasSprite.atlasLocation())); + vertexConsumer2.addVertex(matrix4f2, -1.0F, 1.0F, j * -0.001F).setColor(-1).setUv(textureAtlasSprite.getU0(), textureAtlasSprite.getV0()).setLight(i); + vertexConsumer2.addVertex(matrix4f2, 1.0F, 1.0F, j * -0.001F).setColor(-1).setUv(textureAtlasSprite.getU1(), textureAtlasSprite.getV0()).setLight(i); + vertexConsumer2.addVertex(matrix4f2, 1.0F, -1.0F, j * -0.001F).setColor(-1).setUv(textureAtlasSprite.getU1(), textureAtlasSprite.getV1()).setLight(i); + vertexConsumer2.addVertex(matrix4f2, -1.0F, -1.0F, j * -0.001F).setColor(-1).setUv(textureAtlasSprite.getU0(), textureAtlasSprite.getV1()).setLight(i); + poseStack.popPose(); + } + + if (mapDecorationRenderState.name != null) { + Font font = Minecraft.getInstance().font; + float f = font.width(mapDecorationRenderState.name); + float g = Mth.clamp(25.0F / f, 0.0F, 6.0F / 9.0F); + poseStack.pushPose(); + poseStack.translate(mapDecorationRenderState.x / 2.0F + 64.0F - f * g / 2.0F, mapDecorationRenderState.y / 2.0F + 64.0F + 4.0F, -0.025F); + poseStack.scale(g, g, 1.0F); + poseStack.translate(0.0F, 0.0F, -0.1F); + font.drawInBatch( + mapDecorationRenderState.name, 0.0F, 0.0F, -1, false, poseStack.last().pose(), multiBufferSource, Font.DisplayMode.NORMAL, Integer.MIN_VALUE, i, false + ); + poseStack.popPose(); + } + + j++; + } + } + } + + public void extractRenderState(MapId mapId, MapItemSavedData mapItemSavedData, MapRenderState mapRenderState) { + mapRenderState.texture = this.mapTextureManager.prepareMapTexture(mapId, mapItemSavedData); + mapRenderState.decorations.clear(); + + for (MapDecoration mapDecoration : mapItemSavedData.getDecorations()) { + mapRenderState.decorations.add(this.extractDecorationRenderState(mapDecoration)); + } + } + + private MapRenderState.MapDecorationRenderState extractDecorationRenderState(MapDecoration mapDecoration) { + MapRenderState.MapDecorationRenderState mapDecorationRenderState = new MapRenderState.MapDecorationRenderState(); + mapDecorationRenderState.atlasSprite = this.decorationTextures.get(mapDecoration); + mapDecorationRenderState.x = mapDecoration.x(); + mapDecorationRenderState.y = mapDecoration.y(); + mapDecorationRenderState.rot = mapDecoration.rot(); + mapDecorationRenderState.name = (Component)mapDecoration.name().orElse(null); + mapDecorationRenderState.renderOnFrame = mapDecoration.renderOnFrame(); + return mapDecorationRenderState; + } +} diff --git a/net/minecraft/client/renderer/MultiBufferSource.java b/net/minecraft/client/renderer/MultiBufferSource.java index c9de6154..43366015 100644 --- a/net/minecraft/client/renderer/MultiBufferSource.java +++ b/net/minecraft/client/renderer/MultiBufferSource.java @@ -93,7 +93,7 @@ public interface MultiBufferSource { if (meshData != null) { if (renderType.sortOnUpload()) { ByteBufferBuilder byteBufferBuilder = (ByteBufferBuilder)this.fixedBuffers.getOrDefault(renderType, this.sharedBuffer); - meshData.sortQuads(byteBufferBuilder, RenderSystem.getVertexSorting()); + meshData.sortQuads(byteBufferBuilder, RenderSystem.getProjectionType().vertexSorting()); } renderType.draw(meshData); diff --git a/net/minecraft/client/renderer/Octree.java b/net/minecraft/client/renderer/Octree.java new file mode 100644 index 00000000..338a68f5 --- /dev/null +++ b/net/minecraft/client/renderer/Octree.java @@ -0,0 +1,269 @@ +package net.minecraft.client.renderer; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.client.renderer.chunk.SectionRenderDispatcher; +import net.minecraft.client.renderer.culling.Frustum; +import net.minecraft.core.BlockPos; +import net.minecraft.core.SectionPos; +import net.minecraft.util.Mth; +import net.minecraft.world.level.levelgen.structure.BoundingBox; +import net.minecraft.world.phys.AABB; +import org.jetbrains.annotations.Nullable; + +@Environment(EnvType.CLIENT) +public class Octree { + private final Octree.Branch root; + final BlockPos cameraSectionCenter; + + public Octree(SectionPos sectionPos, int i, int j, int k) { + int l = i * 2 + 1; + int m = Mth.smallestEncompassingPowerOfTwo(l); + int n = i * 16; + BlockPos blockPos = sectionPos.origin(); + this.cameraSectionCenter = sectionPos.center(); + int o = blockPos.getX() - n; + int p = o + m * 16 - 1; + int q = m >= j ? k : blockPos.getY() - n; + int r = q + m * 16 - 1; + int s = blockPos.getZ() - n; + int t = s + m * 16 - 1; + this.root = new Octree.Branch(new BoundingBox(o, q, s, p, r, t)); + } + + public boolean add(SectionRenderDispatcher.RenderSection renderSection) { + return this.root.add(renderSection); + } + + public void visitNodes(Octree.OctreeVisitor octreeVisitor, Frustum frustum, int i) { + this.root.visitNodes(octreeVisitor, false, frustum, 0, i, true); + } + + boolean isClose(double d, double e, double f, double g, double h, double i, int j) { + int k = this.cameraSectionCenter.getX(); + int l = this.cameraSectionCenter.getY(); + int m = this.cameraSectionCenter.getZ(); + return k > d - j && k < g + j && l > e - j && l < h + j && m > f - j && m < i + j; + } + + @Environment(EnvType.CLIENT) + static enum AxisSorting { + XYZ(4, 2, 1), + XZY(4, 1, 2), + YXZ(2, 4, 1), + YZX(1, 4, 2), + ZXY(2, 1, 4), + ZYX(1, 2, 4); + + final int xShift; + final int yShift; + final int zShift; + + private AxisSorting(final int j, final int k, final int l) { + this.xShift = j; + this.yShift = k; + this.zShift = l; + } + + public static Octree.AxisSorting getAxisSorting(int i, int j, int k) { + if (i > j && i > k) { + return j > k ? XYZ : XZY; + } else if (j > i && j > k) { + return i > k ? YXZ : YZX; + } else { + return i > j ? ZXY : ZYX; + } + } + } + + @Environment(EnvType.CLIENT) + class Branch implements Octree.Node { + private final Octree.Node[] nodes = new Octree.Node[8]; + private final BoundingBox boundingBox; + private final int bbCenterX; + private final int bbCenterY; + private final int bbCenterZ; + private final Octree.AxisSorting sorting; + private final boolean cameraXDiffNegative; + private final boolean cameraYDiffNegative; + private final boolean cameraZDiffNegative; + + public Branch(final BoundingBox boundingBox) { + this.boundingBox = boundingBox; + this.bbCenterX = this.boundingBox.minX() + this.boundingBox.getXSpan() / 2; + this.bbCenterY = this.boundingBox.minY() + this.boundingBox.getYSpan() / 2; + this.bbCenterZ = this.boundingBox.minZ() + this.boundingBox.getZSpan() / 2; + int i = Octree.this.cameraSectionCenter.getX() - this.bbCenterX; + int j = Octree.this.cameraSectionCenter.getY() - this.bbCenterY; + int k = Octree.this.cameraSectionCenter.getZ() - this.bbCenterZ; + this.sorting = Octree.AxisSorting.getAxisSorting(Math.abs(i), Math.abs(j), Math.abs(k)); + this.cameraXDiffNegative = i < 0; + this.cameraYDiffNegative = j < 0; + this.cameraZDiffNegative = k < 0; + } + + public boolean add(SectionRenderDispatcher.RenderSection renderSection) { + boolean bl = renderSection.getOrigin().getX() - this.bbCenterX < 0; + boolean bl2 = renderSection.getOrigin().getY() - this.bbCenterY < 0; + boolean bl3 = renderSection.getOrigin().getZ() - this.bbCenterZ < 0; + boolean bl4 = bl != this.cameraXDiffNegative; + boolean bl5 = bl2 != this.cameraYDiffNegative; + boolean bl6 = bl3 != this.cameraZDiffNegative; + int i = getNodeIndex(this.sorting, bl4, bl5, bl6); + if (this.areChildrenLeaves()) { + boolean bl7 = this.nodes[i] != null; + this.nodes[i] = Octree.this.new Leaf(renderSection); + return !bl7; + } else if (this.nodes[i] != null) { + Octree.Branch branch = (Octree.Branch)this.nodes[i]; + return branch.add(renderSection); + } else { + BoundingBox boundingBox = this.createChildBoundingBox(bl, bl2, bl3); + Octree.Branch branch2 = Octree.this.new Branch(boundingBox); + this.nodes[i] = branch2; + return branch2.add(renderSection); + } + } + + private static int getNodeIndex(Octree.AxisSorting axisSorting, boolean bl, boolean bl2, boolean bl3) { + int i = 0; + if (bl) { + i += axisSorting.xShift; + } + + if (bl2) { + i += axisSorting.yShift; + } + + if (bl3) { + i += axisSorting.zShift; + } + + return i; + } + + private boolean areChildrenLeaves() { + return this.boundingBox.getXSpan() == 32; + } + + private BoundingBox createChildBoundingBox(boolean bl, boolean bl2, boolean bl3) { + int i; + int j; + if (bl) { + i = this.boundingBox.minX(); + j = this.bbCenterX - 1; + } else { + i = this.bbCenterX; + j = this.boundingBox.maxX(); + } + + int k; + int l; + if (bl2) { + k = this.boundingBox.minY(); + l = this.bbCenterY - 1; + } else { + k = this.bbCenterY; + l = this.boundingBox.maxY(); + } + + int m; + int n; + if (bl3) { + m = this.boundingBox.minZ(); + n = this.bbCenterZ - 1; + } else { + m = this.bbCenterZ; + n = this.boundingBox.maxZ(); + } + + return new BoundingBox(i, k, m, j, l, n); + } + + @Override + public void visitNodes(Octree.OctreeVisitor octreeVisitor, boolean bl, Frustum frustum, int i, int j, boolean bl2) { + boolean bl3 = bl; + if (!bl) { + int k = frustum.cubeInFrustum(this.boundingBox); + bl = k == -2; + bl3 = k == -2 || k == -1; + } + + if (bl3) { + bl2 = bl2 + && Octree.this.isClose( + this.boundingBox.minX(), this.boundingBox.minY(), this.boundingBox.minZ(), this.boundingBox.maxX(), this.boundingBox.maxY(), this.boundingBox.maxZ(), j + ); + octreeVisitor.visit(this, bl, i, bl2); + + for (Octree.Node node : this.nodes) { + if (node != null) { + node.visitNodes(octreeVisitor, bl, frustum, i + 1, j, bl2); + } + } + } + } + + @Nullable + @Override + public SectionRenderDispatcher.RenderSection getSection() { + return null; + } + + @Override + public AABB getAABB() { + return new AABB( + this.boundingBox.minX(), + this.boundingBox.minY(), + this.boundingBox.minZ(), + this.boundingBox.maxX() + 1, + this.boundingBox.maxY() + 1, + this.boundingBox.maxZ() + 1 + ); + } + } + + @Environment(EnvType.CLIENT) + final class Leaf implements Octree.Node { + private final SectionRenderDispatcher.RenderSection section; + + Leaf(final SectionRenderDispatcher.RenderSection renderSection) { + this.section = renderSection; + } + + @Override + public void visitNodes(Octree.OctreeVisitor octreeVisitor, boolean bl, Frustum frustum, int i, int j, boolean bl2) { + AABB aABB = this.section.getBoundingBox(); + if (bl || frustum.isVisible(this.getSection().getBoundingBox())) { + bl2 = bl2 && Octree.this.isClose(aABB.minX, aABB.minY, aABB.minZ, aABB.maxX, aABB.maxY, aABB.maxZ, j); + octreeVisitor.visit(this, bl, i, bl2); + } + } + + @Override + public SectionRenderDispatcher.RenderSection getSection() { + return this.section; + } + + @Override + public AABB getAABB() { + return this.section.getBoundingBox(); + } + } + + @Environment(EnvType.CLIENT) + public interface Node { + void visitNodes(Octree.OctreeVisitor octreeVisitor, boolean bl, Frustum frustum, int i, int j, boolean bl2); + + @Nullable + SectionRenderDispatcher.RenderSection getSection(); + + AABB getAABB(); + } + + @FunctionalInterface + @Environment(EnvType.CLIENT) + public interface OctreeVisitor { + void visit(Octree.Node node, boolean bl, int i, boolean bl2); + } +} diff --git a/net/minecraft/client/renderer/OutlineBufferSource.java b/net/minecraft/client/renderer/OutlineBufferSource.java index f6c4f329..6c52aa5e 100644 --- a/net/minecraft/client/renderer/OutlineBufferSource.java +++ b/net/minecraft/client/renderer/OutlineBufferSource.java @@ -6,7 +6,7 @@ import com.mojang.blaze3d.vertex.VertexMultiConsumer; import java.util.Optional; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; -import net.minecraft.util.FastColor; +import net.minecraft.util.ARGB; @Environment(EnvType.CLIENT) public class OutlineBufferSource implements MultiBufferSource { @@ -55,7 +55,7 @@ public class OutlineBufferSource implements MultiBufferSource { @Environment(EnvType.CLIENT) record EntityOutlineGenerator(VertexConsumer delegate, int color) implements VertexConsumer { public EntityOutlineGenerator(VertexConsumer delegate, int defaultR, int defaultG, int defaultB, int defaultA) { - this(delegate, FastColor.ARGB32.color(defaultA, defaultR, defaultG, defaultB)); + this(delegate, ARGB.color(defaultA, defaultR, defaultG, defaultB)); } @Override diff --git a/net/minecraft/client/renderer/PanoramaRenderer.java b/net/minecraft/client/renderer/PanoramaRenderer.java index c096ef42..ab38dc55 100644 --- a/net/minecraft/client/renderer/PanoramaRenderer.java +++ b/net/minecraft/client/renderer/PanoramaRenderer.java @@ -1,11 +1,11 @@ package net.minecraft.client.renderer; -import com.mojang.blaze3d.systems.RenderSystem; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.ARGB; @Environment(EnvType.CLIENT) public class PanoramaRenderer { @@ -13,7 +13,6 @@ public class PanoramaRenderer { private final Minecraft minecraft; private final CubeMap cubeMap; private float spin; - private float bob; public PanoramaRenderer(CubeMap cubeMap) { this.cubeMap = cubeMap; @@ -21,15 +20,13 @@ public class PanoramaRenderer { } public void render(GuiGraphics guiGraphics, int width, int height, float fade, float partialTick) { - float f = (float)(partialTick * this.minecraft.options.panoramaSpeed().get()); - this.spin = wrap(this.spin + f * 0.1F, 360.0F); - this.bob = wrap(this.bob + f * 0.001F, (float) (Math.PI * 2)); + float f = this.minecraft.getDeltaTracker().getRealtimeDeltaTicks(); + float g = (float)(f * this.minecraft.options.panoramaSpeed().get()); + this.spin = wrap(this.spin + g * 0.1F, 360.0F); + guiGraphics.flush(); this.cubeMap.render(this.minecraft, 10.0F, -this.spin, fade); - RenderSystem.enableBlend(); - guiGraphics.setColor(1.0F, 1.0F, 1.0F, fade); - guiGraphics.blit(PANORAMA_OVERLAY, 0, 0, width, height, 0.0F, 0.0F, 16, 128, 16, 128); - guiGraphics.setColor(1.0F, 1.0F, 1.0F, 1.0F); - RenderSystem.disableBlend(); + guiGraphics.flush(); + guiGraphics.blit(RenderType::guiTextured, PANORAMA_OVERLAY, 0, 0, 0.0F, 0.0F, width, height, 16, 128, 16, 128, ARGB.white(fade)); } private static float wrap(float value, float max) { diff --git a/net/minecraft/client/renderer/PostChain.java b/net/minecraft/client/renderer/PostChain.java index 7d303f5f..67e0be9e 100644 --- a/net/minecraft/client/renderer/PostChain.java +++ b/net/minecraft/client/renderer/PostChain.java @@ -1,366 +1,159 @@ package net.minecraft.client.renderer; -import com.google.common.collect.Lists; -import com.google.common.collect.Maps; -import com.google.gson.JsonArray; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonSyntaxException; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Sets; +import com.google.common.collect.ImmutableList.Builder; +import com.mojang.blaze3d.framegraph.FrameGraphBuilder; import com.mojang.blaze3d.pipeline.RenderTarget; -import com.mojang.blaze3d.pipeline.TextureTarget; -import com.mojang.blaze3d.shaders.Uniform; -import com.mojang.blaze3d.systems.RenderSystem; -import java.io.IOException; -import java.io.Reader; +import com.mojang.blaze3d.resource.GraphicsResourceAllocator; +import com.mojang.blaze3d.resource.RenderTargetDescriptor; +import com.mojang.blaze3d.resource.ResourceHandle; +import com.mojang.blaze3d.vertex.DefaultVertexFormat; +import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Set; +import java.util.Map.Entry; +import java.util.function.UnaryOperator; +import java.util.stream.Collectors; +import java.util.stream.Stream; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; -import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.PostChain.TargetBundle.1; import net.minecraft.client.renderer.texture.AbstractTexture; import net.minecraft.client.renderer.texture.TextureManager; import net.minecraft.resources.ResourceLocation; -import net.minecraft.server.ChainedJsonException; -import net.minecraft.server.packs.resources.Resource; -import net.minecraft.server.packs.resources.ResourceProvider; -import net.minecraft.util.GsonHelper; import org.jetbrains.annotations.Nullable; import org.joml.Matrix4f; @Environment(EnvType.CLIENT) -public class PostChain implements AutoCloseable { - private static final String MAIN_RENDER_TARGET = "minecraft:main"; - private final RenderTarget screenTarget; - private final ResourceProvider resourceProvider; - private final String name; - private final List passes = Lists.newArrayList(); - private final Map customRenderTargets = Maps.newHashMap(); - private final List fullSizedTargets = Lists.newArrayList(); - private Matrix4f shaderOrthoMatrix; - private int screenWidth; - private int screenHeight; - private float time; - private float lastStamp; +public class PostChain { + public static final ResourceLocation MAIN_TARGET_ID = ResourceLocation.withDefaultNamespace("main"); + private final List passes; + private final Map internalTargets; + private final Set externalTargets; - public PostChain(TextureManager textureManager, ResourceProvider resourceProvider, RenderTarget screenTarget, ResourceLocation resourceLocation) throws IOException, JsonSyntaxException { - this.resourceProvider = resourceProvider; - this.screenTarget = screenTarget; - this.time = 0.0F; - this.lastStamp = 0.0F; - this.screenWidth = screenTarget.viewWidth; - this.screenHeight = screenTarget.viewHeight; - this.name = resourceLocation.toString(); - this.updateOrthoMatrix(); - this.load(textureManager, resourceLocation); + private PostChain(List list, Map map, Set set) { + this.passes = list; + this.internalTargets = map; + this.externalTargets = set; } - private void load(TextureManager textureManager, ResourceLocation resourceLocation) throws IOException, JsonSyntaxException { - Resource resource = this.resourceProvider.getResourceOrThrow(resourceLocation); + public static PostChain load(PostChainConfig postChainConfig, TextureManager textureManager, ShaderManager shaderManager, Set set) throws ShaderManager.CompilationException { + Stream stream = postChainConfig.passes() + .stream() + .flatMap(passx -> passx.inputs().stream()) + .flatMap(input -> input.referencedTargets().stream()); + Set set2 = (Set)stream.filter(resourceLocation -> !postChainConfig.internalTargets().containsKey(resourceLocation)) + .collect(Collectors.toSet()); + Set set3 = Sets.difference(set2, set); + if (!set3.isEmpty()) { + throw new ShaderManager.CompilationException("Referenced external targets are not available in this context: " + set3); + } else { + Builder builder = ImmutableList.builder(); - try { - Reader reader = resource.openAsReader(); - - try { - JsonObject jsonObject = GsonHelper.parse(reader); - if (GsonHelper.isArrayNode(jsonObject, "targets")) { - JsonArray jsonArray = jsonObject.getAsJsonArray("targets"); - int i = 0; - - for (JsonElement jsonElement : jsonArray) { - try { - this.parseTargetNode(jsonElement); - } catch (Exception var14) { - ChainedJsonException chainedJsonException = ChainedJsonException.forException(var14); - chainedJsonException.prependJsonKey("targets[" + i + "]"); - throw chainedJsonException; - } - - i++; - } - } - - if (GsonHelper.isArrayNode(jsonObject, "passes")) { - JsonArray jsonArray = jsonObject.getAsJsonArray("passes"); - int i = 0; - - for (JsonElement jsonElement : jsonArray) { - try { - this.parsePassNode(textureManager, jsonElement); - } catch (Exception var13) { - ChainedJsonException chainedJsonException = ChainedJsonException.forException(var13); - chainedJsonException.prependJsonKey("passes[" + i + "]"); - throw chainedJsonException; - } - - i++; - } - } - } catch (Throwable var15) { - if (reader != null) { - try { - reader.close(); - } catch (Throwable var12) { - var15.addSuppressed(var12); - } - } - - throw var15; + for (PostChainConfig.Pass pass : postChainConfig.passes()) { + builder.add(createPass(textureManager, shaderManager, pass)); } - if (reader != null) { - reader.close(); - } - } catch (Exception var16) { - ChainedJsonException chainedJsonException2 = ChainedJsonException.forException(var16); - chainedJsonException2.setFilenameAndFlush(resourceLocation.getPath() + " (" + resource.sourcePackId() + ")"); - throw chainedJsonException2; + return new PostChain(builder.build(), postChainConfig.internalTargets(), set2); } } - private void parseTargetNode(JsonElement json) throws ChainedJsonException { - if (GsonHelper.isStringValue(json)) { - this.addTempTarget(json.getAsString(), this.screenWidth, this.screenHeight); - } else { - JsonObject jsonObject = GsonHelper.convertToJsonObject(json, "target"); - String string = GsonHelper.getAsString(jsonObject, "name"); - int i = GsonHelper.getAsInt(jsonObject, "width", this.screenWidth); - int j = GsonHelper.getAsInt(jsonObject, "height", this.screenHeight); - if (this.customRenderTargets.containsKey(string)) { - throw new ChainedJsonException(string + " is already defined"); - } + private static PostPass createPass(TextureManager textureManager, ShaderManager shaderManager, PostChainConfig.Pass pass) throws ShaderManager.CompilationException { + ResourceLocation resourceLocation = pass.program(); + CompiledShaderProgram compiledShaderProgram = shaderManager.getProgramForLoading( + new ShaderProgram(resourceLocation, DefaultVertexFormat.POSITION, ShaderDefines.EMPTY) + ); - this.addTempTarget(string, i, j); - } - } - - private void parsePassNode(TextureManager textureManager, JsonElement json) throws IOException { - JsonObject jsonObject = GsonHelper.convertToJsonObject(json, "pass"); - String string = GsonHelper.getAsString(jsonObject, "name"); - String string2 = GsonHelper.getAsString(jsonObject, "intarget"); - String string3 = GsonHelper.getAsString(jsonObject, "outtarget"); - RenderTarget renderTarget = this.getRenderTarget(string2); - RenderTarget renderTarget2 = this.getRenderTarget(string3); - boolean bl = GsonHelper.getAsBoolean(jsonObject, "use_linear_filter", false); - if (renderTarget == null) { - throw new ChainedJsonException("Input target '" + string2 + "' does not exist"); - } else if (renderTarget2 == null) { - throw new ChainedJsonException("Output target '" + string3 + "' does not exist"); - } else { - PostPass postPass = this.addPass(string, renderTarget, renderTarget2, bl); - JsonArray jsonArray = GsonHelper.getAsJsonArray(jsonObject, "auxtargets", null); - if (jsonArray != null) { - int i = 0; - - for (JsonElement jsonElement : jsonArray) { - try { - JsonObject jsonObject2 = GsonHelper.convertToJsonObject(jsonElement, "auxtarget"); - String string4 = GsonHelper.getAsString(jsonObject2, "name"); - String string5 = GsonHelper.getAsString(jsonObject2, "id"); - boolean bl2; - String string6; - if (string5.endsWith(":depth")) { - bl2 = true; - string6 = string5.substring(0, string5.lastIndexOf(58)); - } else { - bl2 = false; - string6 = string5; - } - - RenderTarget renderTarget3 = this.getRenderTarget(string6); - if (renderTarget3 == null) { - if (bl2) { - throw new ChainedJsonException("Render target '" + string6 + "' can't be used as depth buffer"); - } - - ResourceLocation resourceLocation = ResourceLocation.withDefaultNamespace("textures/effect/" + string6 + ".png"); - this.resourceProvider - .getResource(resourceLocation) - .orElseThrow(() -> new ChainedJsonException("Render target or texture '" + string6 + "' does not exist")); - RenderSystem.setShaderTexture(0, resourceLocation); - textureManager.bindForSetup(resourceLocation); - AbstractTexture abstractTexture = textureManager.getTexture(resourceLocation); - int j = GsonHelper.getAsInt(jsonObject2, "width"); - int k = GsonHelper.getAsInt(jsonObject2, "height"); - boolean bl3 = GsonHelper.getAsBoolean(jsonObject2, "bilinear"); - if (bl3) { - RenderSystem.texParameter(3553, 10241, 9729); - RenderSystem.texParameter(3553, 10240, 9729); - } else { - RenderSystem.texParameter(3553, 10241, 9728); - RenderSystem.texParameter(3553, 10240, 9728); - } - - postPass.addAuxAsset(string4, abstractTexture::getId, j, k); - } else if (bl2) { - postPass.addAuxAsset(string4, renderTarget3::getDepthTextureId, renderTarget3.width, renderTarget3.height); - } else { - postPass.addAuxAsset(string4, renderTarget3::getColorTextureId, renderTarget3.width, renderTarget3.height); - } - } catch (Exception var27) { - ChainedJsonException chainedJsonException = ChainedJsonException.forException(var27); - chainedJsonException.prependJsonKey("auxtargets[" + i + "]"); - throw chainedJsonException; - } - - i++; - } - } - - JsonArray jsonArray2 = GsonHelper.getAsJsonArray(jsonObject, "uniforms", null); - if (jsonArray2 != null) { - int l = 0; - - for (JsonElement jsonElement2 : jsonArray2) { - try { - this.parseUniformNode(jsonElement2); - } catch (Exception var26) { - ChainedJsonException chainedJsonException2 = ChainedJsonException.forException(var26); - chainedJsonException2.prependJsonKey("uniforms[" + l + "]"); - throw chainedJsonException2; - } - - l++; - } + for (PostChainConfig.Uniform uniform : pass.uniforms()) { + String string = uniform.name(); + if (compiledShaderProgram.getUniform(string) == null) { + throw new ShaderManager.CompilationException("Uniform '" + string + "' does not exist for " + resourceLocation); } } - } - private void parseUniformNode(JsonElement json) throws ChainedJsonException { - JsonObject jsonObject = GsonHelper.convertToJsonObject(json, "uniform"); - String string = GsonHelper.getAsString(jsonObject, "name"); - Uniform uniform = ((PostPass)this.passes.get(this.passes.size() - 1)).getEffect().getUniform(string); - if (uniform == null) { - throw new ChainedJsonException("Uniform '" + string + "' does not exist"); - } else { - float[] fs = new float[4]; - int i = 0; + String string2 = resourceLocation.toString(); + PostPass postPass = new PostPass(string2, compiledShaderProgram, pass.outputTarget(), pass.uniforms()); - for (JsonElement jsonElement : GsonHelper.getAsJsonArray(jsonObject, "values")) { - try { - fs[i] = GsonHelper.convertToFloat(jsonElement, "value"); - } catch (Exception var12) { - ChainedJsonException chainedJsonException = ChainedJsonException.forException(var12); - chainedJsonException.prependJsonKey("values[" + i + "]"); - throw chainedJsonException; - } - - i++; - } - - switch (i) { - case 0: + for (PostChainConfig.Input input : pass.inputs()) { + switch (input) { + case PostChainConfig.TextureInput(String var35, ResourceLocation var36, int var37, int var38, boolean var39): + AbstractTexture abstractTexture = textureManager.getTexture(var36.withPath((UnaryOperator)(stringx -> "textures/effect/" + stringx + ".png"))); + abstractTexture.setFilter(var39, false); + postPass.addInput(new PostPass.TextureInput(var35, abstractTexture, var37, var38)); + break; + case PostChainConfig.TargetInput(String var22, ResourceLocation var41, boolean var42, boolean var43): + postPass.addInput(new PostPass.TargetInput(var22, var41, var42, var43)); + break; default: - break; - case 1: - uniform.set(fs[0]); - break; - case 2: - uniform.set(fs[0], fs[1]); - break; - case 3: - uniform.set(fs[0], fs[1], fs[2]); - break; - case 4: - uniform.set(fs[0], fs[1], fs[2], fs[3]); + throw new MatchException(null, null); } } - } - public RenderTarget getTempTarget(String attributeName) { - return (RenderTarget)this.customRenderTargets.get(attributeName); - } - - public void addTempTarget(String name, int width, int height) { - RenderTarget renderTarget = new TextureTarget(width, height, true, Minecraft.ON_OSX); - renderTarget.setClearColor(0.0F, 0.0F, 0.0F, 0.0F); - this.customRenderTargets.put(name, renderTarget); - if (width == this.screenWidth && height == this.screenHeight) { - this.fullSizedTargets.add(renderTarget); - } - } - - public void close() { - for (RenderTarget renderTarget : this.customRenderTargets.values()) { - renderTarget.destroyBuffers(); - } - - for (PostPass postPass : this.passes) { - postPass.close(); - } - - this.passes.clear(); - } - - public PostPass addPass(String name, RenderTarget inTarget, RenderTarget outTarget, boolean useLinearFilter) throws IOException { - PostPass postPass = new PostPass(this.resourceProvider, name, inTarget, outTarget, useLinearFilter); - this.passes.add(this.passes.size(), postPass); return postPass; } - private void updateOrthoMatrix() { - this.shaderOrthoMatrix = new Matrix4f().setOrtho(0.0F, this.screenTarget.width, 0.0F, this.screenTarget.height, 0.1F, 1000.0F); - } + public void addToFrame(FrameGraphBuilder frameGraphBuilder, int i, int j, PostChain.TargetBundle targetBundle) { + Matrix4f matrix4f = new Matrix4f().setOrtho(0.0F, i, 0.0F, j, 0.1F, 1000.0F); + Map> map = new HashMap(this.internalTargets.size() + this.externalTargets.size()); - public void resize(int width, int height) { - this.screenWidth = this.screenTarget.width; - this.screenHeight = this.screenTarget.height; - this.updateOrthoMatrix(); + for (ResourceLocation resourceLocation : this.externalTargets) { + map.put(resourceLocation, targetBundle.getOrThrow(resourceLocation)); + } + + for (Entry entry : this.internalTargets.entrySet()) { + ResourceLocation resourceLocation2 = (ResourceLocation)entry.getKey(); + + RenderTargetDescriptor renderTargetDescriptor = switch ((PostChainConfig.InternalTarget)entry.getValue()) { + case PostChainConfig.FixedSizedTarget(int var25, int var26) -> new RenderTargetDescriptor(var25, var26, true); + case PostChainConfig.FullScreenTarget var16 -> new RenderTargetDescriptor(i, j, true); + default -> throw new MatchException(null, null); + }; + map.put(resourceLocation2, frameGraphBuilder.createInternal(resourceLocation2.toString(), renderTargetDescriptor)); + } for (PostPass postPass : this.passes) { - postPass.setOrthoMatrix(this.shaderOrthoMatrix); + postPass.addToFrame(frameGraphBuilder, map, matrix4f); } - for (RenderTarget renderTarget : this.fullSizedTargets) { - renderTarget.resize(width, height, Minecraft.ON_OSX); + for (ResourceLocation resourceLocation : this.externalTargets) { + targetBundle.replace(resourceLocation, (ResourceHandle)map.get(resourceLocation)); } } - private void setFilterMode(int filterMode) { - this.screenTarget.setFilterMode(filterMode); - - for (RenderTarget renderTarget : this.customRenderTargets.values()) { - renderTarget.setFilterMode(filterMode); - } - } - - public void process(float partialTicks) { - this.time += partialTicks; - - while (this.time > 20.0F) { - this.time -= 20.0F; - } - - int i = 9728; - - for (PostPass postPass : this.passes) { - int j = postPass.getFilterMode(); - if (i != j) { - this.setFilterMode(j); - i = j; - } - - postPass.process(this.time / 20.0F); - } - - this.setFilterMode(9728); + @Deprecated + public void process(RenderTarget renderTarget, GraphicsResourceAllocator graphicsResourceAllocator) { + FrameGraphBuilder frameGraphBuilder = new FrameGraphBuilder(); + PostChain.TargetBundle targetBundle = PostChain.TargetBundle.of(MAIN_TARGET_ID, frameGraphBuilder.importExternal("main", renderTarget)); + this.addToFrame(frameGraphBuilder, renderTarget.width, renderTarget.height, targetBundle); + frameGraphBuilder.execute(graphicsResourceAllocator); } public void setUniform(String name, float backgroundBlurriness) { for (PostPass postPass : this.passes) { - postPass.getEffect().safeGetUniform(name).set(backgroundBlurriness); + postPass.getShader().safeGetUniform(name).set(backgroundBlurriness); } } - public final String getName() { - return this.name; - } + @Environment(EnvType.CLIENT) + public interface TargetBundle { + static PostChain.TargetBundle of(ResourceLocation resourceLocation, ResourceHandle resourceHandle) { + return new 1(resourceHandle, resourceLocation); + } - @Nullable - private RenderTarget getRenderTarget(@Nullable String target) { - if (target == null) { - return null; - } else { - return target.equals("minecraft:main") ? this.screenTarget : (RenderTarget)this.customRenderTargets.get(target); + void replace(ResourceLocation resourceLocation, ResourceHandle resourceHandle); + + @Nullable + ResourceHandle get(ResourceLocation resourceLocation); + + default ResourceHandle getOrThrow(ResourceLocation resourceLocation) { + ResourceHandle resourceHandle = this.get(resourceLocation); + if (resourceHandle == null) { + throw new IllegalArgumentException("Missing target with id " + resourceLocation); + } else { + return resourceHandle; + } } } } diff --git a/net/minecraft/client/renderer/PostChainConfig.java b/net/minecraft/client/renderer/PostChainConfig.java new file mode 100644 index 00000000..6cc78ed9 --- /dev/null +++ b/net/minecraft/client/renderer/PostChainConfig.java @@ -0,0 +1,144 @@ +package net.minecraft.client.renderer; + +import com.mojang.datafixers.util.Either; +import com.mojang.serialization.Codec; +import com.mojang.serialization.DataResult; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import it.unimi.dsi.fastutil.objects.ObjectArraySet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.function.Function; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.ExtraCodecs; + +@Environment(EnvType.CLIENT) +public record PostChainConfig(Map internalTargets, List passes) { + public static final Codec CODEC = RecordCodecBuilder.create( + instance -> instance.group( + Codec.unboundedMap(ResourceLocation.CODEC, PostChainConfig.InternalTarget.CODEC) + .optionalFieldOf("targets", Map.of()) + .forGetter(PostChainConfig::internalTargets), + PostChainConfig.Pass.CODEC.listOf().optionalFieldOf("passes", List.of()).forGetter(PostChainConfig::passes) + ) + .apply(instance, PostChainConfig::new) + ); + + @Environment(EnvType.CLIENT) + public record FixedSizedTarget(int width, int height) implements PostChainConfig.InternalTarget { + public static final Codec CODEC = RecordCodecBuilder.create( + instance -> instance.group( + ExtraCodecs.POSITIVE_INT.fieldOf("width").forGetter(PostChainConfig.FixedSizedTarget::width), + ExtraCodecs.POSITIVE_INT.fieldOf("height").forGetter(PostChainConfig.FixedSizedTarget::height) + ) + .apply(instance, PostChainConfig.FixedSizedTarget::new) + ); + } + + @Environment(EnvType.CLIENT) + public record FullScreenTarget() implements PostChainConfig.InternalTarget { + public static final Codec CODEC = Codec.unit(PostChainConfig.FullScreenTarget::new); + } + + @Environment(EnvType.CLIENT) + public sealed interface Input permits PostChainConfig.TextureInput, PostChainConfig.TargetInput { + Codec CODEC = Codec.xor(PostChainConfig.TextureInput.CODEC, PostChainConfig.TargetInput.CODEC) + .xmap(either -> either.map(Function.identity(), Function.identity()), input -> { + return switch (input) { + case PostChainConfig.TextureInput textureInput -> Either.left(textureInput); + case PostChainConfig.TargetInput targetInput -> Either.right(targetInput); + default -> throw new MatchException(null, null); + }; + }); + + String samplerName(); + + Set referencedTargets(); + } + + @Environment(EnvType.CLIENT) + public sealed interface InternalTarget permits PostChainConfig.FullScreenTarget, PostChainConfig.FixedSizedTarget { + Codec CODEC = Codec.either(PostChainConfig.FixedSizedTarget.CODEC, PostChainConfig.FullScreenTarget.CODEC) + .xmap(either -> either.map(Function.identity(), Function.identity()), internalTarget -> { + return switch (internalTarget) { + case PostChainConfig.FixedSizedTarget fixedSizedTarget -> Either.left(fixedSizedTarget); + case PostChainConfig.FullScreenTarget fullScreenTarget -> Either.right(fullScreenTarget); + default -> throw new MatchException(null, null); + }; + }); + } + + @Environment(EnvType.CLIENT) + public record Pass(ResourceLocation program, List inputs, ResourceLocation outputTarget, List uniforms) { + private static final Codec> INPUTS_CODEC = PostChainConfig.Input.CODEC.listOf().validate(list -> { + Set set = new ObjectArraySet<>(list.size()); + + for (PostChainConfig.Input input : list) { + if (!set.add(input.samplerName())) { + return DataResult.error(() -> "Encountered repeated sampler name: " + input.samplerName()); + } + } + + return DataResult.success(list); + }); + public static final Codec CODEC = RecordCodecBuilder.create( + instance -> instance.group( + ResourceLocation.CODEC.fieldOf("program").forGetter(PostChainConfig.Pass::program), + INPUTS_CODEC.optionalFieldOf("inputs", List.of()).forGetter(PostChainConfig.Pass::inputs), + ResourceLocation.CODEC.fieldOf("output").forGetter(PostChainConfig.Pass::outputTarget), + PostChainConfig.Uniform.CODEC.listOf().optionalFieldOf("uniforms", List.of()).forGetter(PostChainConfig.Pass::uniforms) + ) + .apply(instance, PostChainConfig.Pass::new) + ); + } + + @Environment(EnvType.CLIENT) + public record TargetInput(String samplerName, ResourceLocation targetId, boolean useDepthBuffer, boolean bilinear) implements PostChainConfig.Input { + public static final Codec CODEC = RecordCodecBuilder.create( + instance -> instance.group( + Codec.STRING.fieldOf("sampler_name").forGetter(PostChainConfig.TargetInput::samplerName), + ResourceLocation.CODEC.fieldOf("target").forGetter(PostChainConfig.TargetInput::targetId), + Codec.BOOL.optionalFieldOf("use_depth_buffer", false).forGetter(PostChainConfig.TargetInput::useDepthBuffer), + Codec.BOOL.optionalFieldOf("bilinear", false).forGetter(PostChainConfig.TargetInput::bilinear) + ) + .apply(instance, PostChainConfig.TargetInput::new) + ); + + @Override + public Set referencedTargets() { + return Set.of(this.targetId); + } + } + + @Environment(EnvType.CLIENT) + public record TextureInput(String samplerName, ResourceLocation location, int width, int height, boolean bilinear) implements PostChainConfig.Input { + public static final Codec CODEC = RecordCodecBuilder.create( + instance -> instance.group( + Codec.STRING.fieldOf("sampler_name").forGetter(PostChainConfig.TextureInput::samplerName), + ResourceLocation.CODEC.fieldOf("location").forGetter(PostChainConfig.TextureInput::location), + ExtraCodecs.POSITIVE_INT.fieldOf("width").forGetter(PostChainConfig.TextureInput::width), + ExtraCodecs.POSITIVE_INT.fieldOf("height").forGetter(PostChainConfig.TextureInput::height), + Codec.BOOL.optionalFieldOf("bilinear", false).forGetter(PostChainConfig.TextureInput::bilinear) + ) + .apply(instance, PostChainConfig.TextureInput::new) + ); + + @Override + public Set referencedTargets() { + return Set.of(); + } + } + + @Environment(EnvType.CLIENT) + public record Uniform(String name, List values) { + public static final Codec CODEC = RecordCodecBuilder.create( + instance -> instance.group( + Codec.STRING.fieldOf("name").forGetter(PostChainConfig.Uniform::name), + Codec.FLOAT.sizeLimitedListOf(4).fieldOf("values").forGetter(PostChainConfig.Uniform::values) + ) + .apply(instance, PostChainConfig.Uniform::new) + ); + } +} diff --git a/net/minecraft/client/renderer/PostPass.java b/net/minecraft/client/renderer/PostPass.java index 188af891..2a948a53 100644 --- a/net/minecraft/client/renderer/PostPass.java +++ b/net/minecraft/client/renderer/PostPass.java @@ -1,105 +1,169 @@ package net.minecraft.client.renderer; -import com.google.common.collect.Lists; +import com.mojang.blaze3d.ProjectionType; +import com.mojang.blaze3d.framegraph.FrameGraphBuilder; +import com.mojang.blaze3d.framegraph.FramePass; import com.mojang.blaze3d.pipeline.RenderTarget; +import com.mojang.blaze3d.resource.ResourceHandle; +import com.mojang.blaze3d.shaders.Uniform; import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.BufferBuilder; import com.mojang.blaze3d.vertex.BufferUploader; import com.mojang.blaze3d.vertex.DefaultVertexFormat; import com.mojang.blaze3d.vertex.Tesselator; import com.mojang.blaze3d.vertex.VertexFormat; -import java.io.IOException; +import java.util.ArrayList; import java.util.List; -import java.util.function.IntSupplier; +import java.util.Map; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; -import net.minecraft.client.Minecraft; -import net.minecraft.server.packs.resources.ResourceProvider; +import net.minecraft.client.renderer.texture.AbstractTexture; +import net.minecraft.resources.ResourceLocation; import org.joml.Matrix4f; @Environment(EnvType.CLIENT) -public class PostPass implements AutoCloseable { - private final EffectInstance effect; - public final RenderTarget inTarget; - public final RenderTarget outTarget; - private final List auxAssets = Lists.newArrayList(); - private final List auxNames = Lists.newArrayList(); - private final List auxWidths = Lists.newArrayList(); - private final List auxHeights = Lists.newArrayList(); - private Matrix4f shaderOrthoMatrix; - private final int filterMode; +public class PostPass { + private final String name; + private final CompiledShaderProgram shader; + private final ResourceLocation outputTargetId; + private final List uniforms; + private final List inputs = new ArrayList(); - public PostPass(ResourceProvider resourceProvider, String name, RenderTarget inTarget, RenderTarget outTarget, boolean useLinearFilter) throws IOException { - this.effect = new EffectInstance(resourceProvider, name); - this.inTarget = inTarget; - this.outTarget = outTarget; - this.filterMode = useLinearFilter ? 9729 : 9728; + public PostPass(String string, CompiledShaderProgram compiledShaderProgram, ResourceLocation resourceLocation, List list) { + this.name = string; + this.shader = compiledShaderProgram; + this.outputTargetId = resourceLocation; + this.uniforms = list; } - public void close() { - this.effect.close(); + public void addInput(PostPass.Input input) { + this.inputs.add(input); } - public final String getName() { - return this.effect.getName(); - } + public void addToFrame(FrameGraphBuilder frameGraphBuilder, Map> map, Matrix4f matrix4f) { + FramePass framePass = frameGraphBuilder.addPass(this.name); - public void addAuxAsset(String auxName, IntSupplier auxFramebuffer, int width, int height) { - this.auxNames.add(this.auxNames.size(), auxName); - this.auxAssets.add(this.auxAssets.size(), auxFramebuffer); - this.auxWidths.add(this.auxWidths.size(), width); - this.auxHeights.add(this.auxHeights.size(), height); - } - - public void setOrthoMatrix(Matrix4f shaderOrthoMatrix) { - this.shaderOrthoMatrix = shaderOrthoMatrix; - } - - public void process(float partialTicks) { - this.inTarget.unbindWrite(); - float f = this.outTarget.width; - float g = this.outTarget.height; - RenderSystem.viewport(0, 0, (int)f, (int)g); - this.effect.setSampler("DiffuseSampler", this.inTarget::getColorTextureId); - - for (int i = 0; i < this.auxAssets.size(); i++) { - this.effect.setSampler((String)this.auxNames.get(i), (IntSupplier)this.auxAssets.get(i)); - this.effect.safeGetUniform("AuxSize" + i).set((float)((Integer)this.auxWidths.get(i)).intValue(), (float)((Integer)this.auxHeights.get(i)).intValue()); + for (PostPass.Input input : this.inputs) { + input.addToPass(framePass, map); } - this.effect.safeGetUniform("ProjMat").set(this.shaderOrthoMatrix); - this.effect.safeGetUniform("InSize").set((float)this.inTarget.width, (float)this.inTarget.height); - this.effect.safeGetUniform("OutSize").set(f, g); - this.effect.safeGetUniform("Time").set(partialTicks); - Minecraft minecraft = Minecraft.getInstance(); - this.effect.safeGetUniform("ScreenSize").set((float)minecraft.getWindow().getWidth(), (float)minecraft.getWindow().getHeight()); - this.effect.apply(); - this.outTarget.clear(Minecraft.ON_OSX); - this.outTarget.bindWrite(false); - RenderSystem.depthFunc(519); - BufferBuilder bufferBuilder = Tesselator.getInstance().begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION); - bufferBuilder.addVertex(0.0F, 0.0F, 500.0F); - bufferBuilder.addVertex(f, 0.0F, 500.0F); - bufferBuilder.addVertex(f, g, 500.0F); - bufferBuilder.addVertex(0.0F, g, 500.0F); - BufferUploader.draw(bufferBuilder.buildOrThrow()); - RenderSystem.depthFunc(515); - this.effect.clear(); - this.outTarget.unbindWrite(); - this.inTarget.unbindRead(); + ResourceHandle resourceHandle = (ResourceHandle)map.computeIfPresent( + this.outputTargetId, (resourceLocation, resourceHandlex) -> framePass.readsAndWrites(resourceHandlex) + ); + if (resourceHandle == null) { + throw new IllegalStateException("Missing handle for target " + this.outputTargetId); + } else { + framePass.executes(() -> { + RenderTarget renderTarget = resourceHandle.get(); + RenderSystem.viewport(0, 0, renderTarget.width, renderTarget.height); - for (Object object : this.auxAssets) { - if (object instanceof RenderTarget) { - ((RenderTarget)object).unbindRead(); + for (PostPass.Input inputx : this.inputs) { + inputx.bindTo(this.shader, map); + } + + this.shader.safeGetUniform("OutSize").set((float)renderTarget.width, (float)renderTarget.height); + + for (PostChainConfig.Uniform uniform : this.uniforms) { + Uniform uniform2 = this.shader.getUniform(uniform.name()); + if (uniform2 != null) { + uniform2.setFromConfig(uniform.values(), uniform.values().size()); + } + } + + renderTarget.setClearColor(0.0F, 0.0F, 0.0F, 0.0F); + renderTarget.clear(); + renderTarget.bindWrite(false); + RenderSystem.depthFunc(519); + RenderSystem.setShader(this.shader); + RenderSystem.backupProjectionMatrix(); + RenderSystem.setProjectionMatrix(matrix4f, ProjectionType.ORTHOGRAPHIC); + BufferBuilder bufferBuilder = Tesselator.getInstance().begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION); + bufferBuilder.addVertex(0.0F, 0.0F, 500.0F); + bufferBuilder.addVertex(renderTarget.width, 0.0F, 500.0F); + bufferBuilder.addVertex(renderTarget.width, renderTarget.height, 500.0F); + bufferBuilder.addVertex(0.0F, renderTarget.height, 500.0F); + BufferUploader.drawWithShader(bufferBuilder.buildOrThrow()); + RenderSystem.depthFunc(515); + RenderSystem.restoreProjectionMatrix(); + renderTarget.unbindWrite(); + + for (PostPass.Input input2 : this.inputs) { + input2.cleanup(map); + } + + this.restoreDefaultUniforms(); + }); + } + } + + private void restoreDefaultUniforms() { + for (PostChainConfig.Uniform uniform : this.uniforms) { + String string = uniform.name(); + Uniform uniform2 = this.shader.getUniform(string); + ShaderProgramConfig.Uniform uniform3 = this.shader.getUniformConfig(string); + if (uniform2 != null && uniform3 != null && !uniform.values().equals(uniform3.values())) { + uniform2.setFromConfig(uniform3); } } } - public EffectInstance getEffect() { - return this.effect; + public CompiledShaderProgram getShader() { + return this.shader; } - public int getFilterMode() { - return this.filterMode; + @Environment(EnvType.CLIENT) + public interface Input { + void addToPass(FramePass framePass, Map> map); + + void bindTo(CompiledShaderProgram compiledShaderProgram, Map> map); + + default void cleanup(Map> map) { + } + } + + @Environment(EnvType.CLIENT) + public record TargetInput(String samplerName, ResourceLocation targetId, boolean depthBuffer, boolean bilinear) implements PostPass.Input { + private ResourceHandle getHandle(Map> map) { + ResourceHandle resourceHandle = (ResourceHandle)map.get(this.targetId); + if (resourceHandle == null) { + throw new IllegalStateException("Missing handle for target " + this.targetId); + } else { + return resourceHandle; + } + } + + @Override + public void addToPass(FramePass framePass, Map> map) { + framePass.reads(this.getHandle(map)); + } + + @Override + public void bindTo(CompiledShaderProgram compiledShaderProgram, Map> map) { + ResourceHandle resourceHandle = this.getHandle(map); + RenderTarget renderTarget = resourceHandle.get(); + renderTarget.setFilterMode(this.bilinear ? 9729 : 9728); + compiledShaderProgram.bindSampler(this.samplerName + "Sampler", this.depthBuffer ? renderTarget.getDepthTextureId() : renderTarget.getColorTextureId()); + compiledShaderProgram.safeGetUniform(this.samplerName + "Size").set((float)renderTarget.width, (float)renderTarget.height); + } + + @Override + public void cleanup(Map> map) { + if (this.bilinear) { + this.getHandle(map).get().setFilterMode(9728); + } + } + } + + @Environment(EnvType.CLIENT) + public record TextureInput(String samplerName, AbstractTexture texture, int width, int height) implements PostPass.Input { + @Override + public void addToPass(FramePass framePass, Map> map) { + } + + @Override + public void bindTo(CompiledShaderProgram compiledShaderProgram, Map> map) { + compiledShaderProgram.bindSampler(this.samplerName + "Sampler", this.texture.getId()); + compiledShaderProgram.safeGetUniform(this.samplerName + "Size").set((float)this.width, (float)this.height); + } } } diff --git a/net/minecraft/client/renderer/RenderBuffers.java b/net/minecraft/client/renderer/RenderBuffers.java index b68406dc..0fba82f3 100644 --- a/net/minecraft/client/renderer/RenderBuffers.java +++ b/net/minecraft/client/renderer/RenderBuffers.java @@ -23,7 +23,7 @@ public class RenderBuffers { object2ObjectLinkedOpenHashMap.put(Sheets.solidBlockSheet(), this.fixedBufferPack.buffer(RenderType.solid())); object2ObjectLinkedOpenHashMap.put(Sheets.cutoutBlockSheet(), this.fixedBufferPack.buffer(RenderType.cutout())); object2ObjectLinkedOpenHashMap.put(Sheets.bannerSheet(), this.fixedBufferPack.buffer(RenderType.cutoutMipped())); - object2ObjectLinkedOpenHashMap.put(Sheets.translucentCullBlockSheet(), this.fixedBufferPack.buffer(RenderType.translucent())); + object2ObjectLinkedOpenHashMap.put(Sheets.translucentItemSheet(), this.fixedBufferPack.buffer(RenderType.translucent())); put(object2ObjectLinkedOpenHashMap, Sheets.shieldSheet()); put(object2ObjectLinkedOpenHashMap, Sheets.bedSheet()); put(object2ObjectLinkedOpenHashMap, Sheets.shulkerBoxSheet()); @@ -34,14 +34,16 @@ public class RenderBuffers { put(object2ObjectLinkedOpenHashMap, RenderType.glint()); put(object2ObjectLinkedOpenHashMap, RenderType.glintTranslucent()); put(object2ObjectLinkedOpenHashMap, RenderType.entityGlint()); - put(object2ObjectLinkedOpenHashMap, RenderType.entityGlintDirect()); put(object2ObjectLinkedOpenHashMap, RenderType.waterMask()); - ModelBakery.DESTROY_TYPES.forEach(renderType -> put(object2ObjectLinkedOpenHashMap, renderType)); } ); - this.crumblingBufferSource = MultiBufferSource.immediate(new ByteBufferBuilder(1536)); this.bufferSource = MultiBufferSource.immediateWithBuffers(sequencedMap, new ByteBufferBuilder(786432)); this.outlineBufferSource = new OutlineBufferSource(this.bufferSource); + SequencedMap sequencedMap2 = Util.make( + new Object2ObjectLinkedOpenHashMap(), + object2ObjectLinkedOpenHashMap -> ModelBakery.DESTROY_TYPES.forEach(renderType -> put(object2ObjectLinkedOpenHashMap, renderType)) + ); + this.crumblingBufferSource = MultiBufferSource.immediateWithBuffers(sequencedMap2, new ByteBufferBuilder(0)); } private static void put(Object2ObjectLinkedOpenHashMap mapBuilders, RenderType renderType) { diff --git a/net/minecraft/client/renderer/RenderStateShard.java b/net/minecraft/client/renderer/RenderStateShard.java index 0d3cbba3..78934e6c 100644 --- a/net/minecraft/client/renderer/RenderStateShard.java +++ b/net/minecraft/client/renderer/RenderStateShard.java @@ -1,26 +1,28 @@ package net.minecraft.client.renderer; import com.google.common.collect.ImmutableList; +import com.mojang.blaze3d.pipeline.RenderTarget; import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.systems.RenderSystem; import java.util.Objects; import java.util.Optional; import java.util.OptionalDouble; -import java.util.function.Supplier; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.Util; import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.RenderStateShard.MultiTextureStateShard.Builder; +import net.minecraft.client.renderer.texture.AbstractTexture; import net.minecraft.client.renderer.texture.TextureAtlas; import net.minecraft.client.renderer.texture.TextureManager; import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.TriState; import org.apache.commons.lang3.tuple.Triple; import org.joml.Matrix4f; import org.joml.Matrix4fStack; @Environment(EnvType.CLIENT) public abstract class RenderStateShard { - private static final float VIEW_SCALE_Z_EPSILON = 0.99975586F; public static final double MAX_ENCHANTMENT_GLINT_SPEED_MILLIS = 8.0; protected final String name; private final Runnable setupState; @@ -88,158 +90,185 @@ public abstract class RenderStateShard { RenderSystem.defaultBlendFunc(); } ); + protected static final RenderStateShard.TransparencyStateShard VIGNETTE_TRANSPARENCY = new RenderStateShard.TransparencyStateShard( + "vignette_transparency", () -> { + RenderSystem.enableBlend(); + RenderSystem.blendFunc(GlStateManager.SourceFactor.ZERO, GlStateManager.DestFactor.ONE_MINUS_SRC_COLOR); + }, () -> { + RenderSystem.disableBlend(); + RenderSystem.defaultBlendFunc(); + } + ); + protected static final RenderStateShard.TransparencyStateShard CROSSHAIR_TRANSPARENCY = new RenderStateShard.TransparencyStateShard( + "crosshair_transparency", + () -> { + RenderSystem.enableBlend(); + RenderSystem.blendFuncSeparate( + GlStateManager.SourceFactor.ONE_MINUS_DST_COLOR, + GlStateManager.DestFactor.ONE_MINUS_SRC_COLOR, + GlStateManager.SourceFactor.ONE, + GlStateManager.DestFactor.ZERO + ); + }, + () -> { + RenderSystem.disableBlend(); + RenderSystem.defaultBlendFunc(); + } + ); + protected static final RenderStateShard.TransparencyStateShard MOJANG_LOGO_TRANSPARENCY = new RenderStateShard.TransparencyStateShard( + "mojang_logo_transparency", () -> { + RenderSystem.enableBlend(); + RenderSystem.blendFunc(770, 1); + }, () -> { + RenderSystem.disableBlend(); + RenderSystem.defaultBlendFunc(); + } + ); + protected static final RenderStateShard.TransparencyStateShard NAUSEA_OVERLAY_TRANSPARENCY = new RenderStateShard.TransparencyStateShard( + "nausea_overlay_transparency", + () -> { + RenderSystem.enableBlend(); + RenderSystem.blendFuncSeparate( + GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ONE, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ONE + ); + }, + () -> { + RenderSystem.disableBlend(); + RenderSystem.defaultBlendFunc(); + } + ); protected static final RenderStateShard.ShaderStateShard NO_SHADER = new RenderStateShard.ShaderStateShard(); protected static final RenderStateShard.ShaderStateShard POSITION_COLOR_LIGHTMAP_SHADER = new RenderStateShard.ShaderStateShard( - GameRenderer::getPositionColorLightmapShader + CoreShaders.POSITION_COLOR_LIGHTMAP ); - protected static final RenderStateShard.ShaderStateShard POSITION_SHADER = new RenderStateShard.ShaderStateShard(GameRenderer::getPositionShader); - protected static final RenderStateShard.ShaderStateShard POSITION_TEX_SHADER = new RenderStateShard.ShaderStateShard(GameRenderer::getPositionTexShader); + protected static final RenderStateShard.ShaderStateShard POSITION_SHADER = new RenderStateShard.ShaderStateShard(CoreShaders.POSITION); + protected static final RenderStateShard.ShaderStateShard POSITION_TEX_SHADER = new RenderStateShard.ShaderStateShard(CoreShaders.POSITION_TEX); protected static final RenderStateShard.ShaderStateShard POSITION_COLOR_TEX_LIGHTMAP_SHADER = new RenderStateShard.ShaderStateShard( - GameRenderer::getPositionColorTexLightmapShader - ); - protected static final RenderStateShard.ShaderStateShard POSITION_COLOR_SHADER = new RenderStateShard.ShaderStateShard(GameRenderer::getPositionColorShader); - protected static final RenderStateShard.ShaderStateShard RENDERTYPE_SOLID_SHADER = new RenderStateShard.ShaderStateShard( - GameRenderer::getRendertypeSolidShader + CoreShaders.POSITION_COLOR_TEX_LIGHTMAP ); + protected static final RenderStateShard.ShaderStateShard POSITION_COLOR_SHADER = new RenderStateShard.ShaderStateShard(CoreShaders.POSITION_COLOR); + protected static final RenderStateShard.ShaderStateShard POSITION_TEXTURE_COLOR_SHADER = new RenderStateShard.ShaderStateShard(CoreShaders.POSITION_TEX_COLOR); + protected static final RenderStateShard.ShaderStateShard RENDERTYPE_SOLID_SHADER = new RenderStateShard.ShaderStateShard(CoreShaders.RENDERTYPE_SOLID); protected static final RenderStateShard.ShaderStateShard RENDERTYPE_CUTOUT_MIPPED_SHADER = new RenderStateShard.ShaderStateShard( - GameRenderer::getRendertypeCutoutMippedShader - ); - protected static final RenderStateShard.ShaderStateShard RENDERTYPE_CUTOUT_SHADER = new RenderStateShard.ShaderStateShard( - GameRenderer::getRendertypeCutoutShader + CoreShaders.RENDERTYPE_CUTOUT_MIPPED ); + protected static final RenderStateShard.ShaderStateShard RENDERTYPE_CUTOUT_SHADER = new RenderStateShard.ShaderStateShard(CoreShaders.RENDERTYPE_CUTOUT); protected static final RenderStateShard.ShaderStateShard RENDERTYPE_TRANSLUCENT_SHADER = new RenderStateShard.ShaderStateShard( - GameRenderer::getRendertypeTranslucentShader + CoreShaders.RENDERTYPE_TRANSLUCENT ); protected static final RenderStateShard.ShaderStateShard RENDERTYPE_TRANSLUCENT_MOVING_BLOCK_SHADER = new RenderStateShard.ShaderStateShard( - GameRenderer::getRendertypeTranslucentMovingBlockShader + CoreShaders.RENDERTYPE_TRANSLUCENT_MOVING_BLOCK ); protected static final RenderStateShard.ShaderStateShard RENDERTYPE_ARMOR_CUTOUT_NO_CULL_SHADER = new RenderStateShard.ShaderStateShard( - GameRenderer::getRendertypeArmorCutoutNoCullShader + CoreShaders.RENDERTYPE_ARMOR_CUTOUT_NO_CULL + ); + protected static final RenderStateShard.ShaderStateShard RENDERTYPE_ARMOR_TRANSLUCENT_SHADER = new RenderStateShard.ShaderStateShard( + CoreShaders.RENDERTYPE_ARMOR_TRANSLUCENT ); protected static final RenderStateShard.ShaderStateShard RENDERTYPE_ENTITY_SOLID_SHADER = new RenderStateShard.ShaderStateShard( - GameRenderer::getRendertypeEntitySolidShader + CoreShaders.RENDERTYPE_ENTITY_SOLID ); protected static final RenderStateShard.ShaderStateShard RENDERTYPE_ENTITY_CUTOUT_SHADER = new RenderStateShard.ShaderStateShard( - GameRenderer::getRendertypeEntityCutoutShader + CoreShaders.RENDERTYPE_ENTITY_CUTOUT ); protected static final RenderStateShard.ShaderStateShard RENDERTYPE_ENTITY_CUTOUT_NO_CULL_SHADER = new RenderStateShard.ShaderStateShard( - GameRenderer::getRendertypeEntityCutoutNoCullShader + CoreShaders.RENDERTYPE_ENTITY_CUTOUT_NO_CULL ); protected static final RenderStateShard.ShaderStateShard RENDERTYPE_ENTITY_CUTOUT_NO_CULL_Z_OFFSET_SHADER = new RenderStateShard.ShaderStateShard( - GameRenderer::getRendertypeEntityCutoutNoCullZOffsetShader + CoreShaders.RENDERTYPE_ENTITY_CUTOUT_NO_CULL_Z_OFFSET ); protected static final RenderStateShard.ShaderStateShard RENDERTYPE_ITEM_ENTITY_TRANSLUCENT_CULL_SHADER = new RenderStateShard.ShaderStateShard( - GameRenderer::getRendertypeItemEntityTranslucentCullShader - ); - protected static final RenderStateShard.ShaderStateShard RENDERTYPE_ENTITY_TRANSLUCENT_CULL_SHADER = new RenderStateShard.ShaderStateShard( - GameRenderer::getRendertypeEntityTranslucentCullShader + CoreShaders.RENDERTYPE_ITEM_ENTITY_TRANSLUCENT_CULL ); protected static final RenderStateShard.ShaderStateShard RENDERTYPE_ENTITY_TRANSLUCENT_SHADER = new RenderStateShard.ShaderStateShard( - GameRenderer::getRendertypeEntityTranslucentShader + CoreShaders.RENDERTYPE_ENTITY_TRANSLUCENT ); protected static final RenderStateShard.ShaderStateShard RENDERTYPE_ENTITY_TRANSLUCENT_EMISSIVE_SHADER = new RenderStateShard.ShaderStateShard( - GameRenderer::getRendertypeEntityTranslucentEmissiveShader + CoreShaders.RENDERTYPE_ENTITY_TRANSLUCENT_EMISSIVE ); protected static final RenderStateShard.ShaderStateShard RENDERTYPE_ENTITY_SMOOTH_CUTOUT_SHADER = new RenderStateShard.ShaderStateShard( - GameRenderer::getRendertypeEntitySmoothCutoutShader + CoreShaders.RENDERTYPE_ENTITY_SMOOTH_CUTOUT ); protected static final RenderStateShard.ShaderStateShard RENDERTYPE_BEACON_BEAM_SHADER = new RenderStateShard.ShaderStateShard( - GameRenderer::getRendertypeBeaconBeamShader + CoreShaders.RENDERTYPE_BEACON_BEAM ); protected static final RenderStateShard.ShaderStateShard RENDERTYPE_ENTITY_DECAL_SHADER = new RenderStateShard.ShaderStateShard( - GameRenderer::getRendertypeEntityDecalShader + CoreShaders.RENDERTYPE_ENTITY_DECAL ); protected static final RenderStateShard.ShaderStateShard RENDERTYPE_ENTITY_NO_OUTLINE_SHADER = new RenderStateShard.ShaderStateShard( - GameRenderer::getRendertypeEntityNoOutlineShader + CoreShaders.RENDERTYPE_ENTITY_NO_OUTLINE ); protected static final RenderStateShard.ShaderStateShard RENDERTYPE_ENTITY_SHADOW_SHADER = new RenderStateShard.ShaderStateShard( - GameRenderer::getRendertypeEntityShadowShader + CoreShaders.RENDERTYPE_ENTITY_SHADOW ); protected static final RenderStateShard.ShaderStateShard RENDERTYPE_ENTITY_ALPHA_SHADER = new RenderStateShard.ShaderStateShard( - GameRenderer::getRendertypeEntityAlphaShader + CoreShaders.RENDERTYPE_ENTITY_ALPHA ); - protected static final RenderStateShard.ShaderStateShard RENDERTYPE_EYES_SHADER = new RenderStateShard.ShaderStateShard(GameRenderer::getRendertypeEyesShader); + protected static final RenderStateShard.ShaderStateShard RENDERTYPE_EYES_SHADER = new RenderStateShard.ShaderStateShard(CoreShaders.RENDERTYPE_EYES); protected static final RenderStateShard.ShaderStateShard RENDERTYPE_ENERGY_SWIRL_SHADER = new RenderStateShard.ShaderStateShard( - GameRenderer::getRendertypeEnergySwirlShader - ); - protected static final RenderStateShard.ShaderStateShard RENDERTYPE_LEASH_SHADER = new RenderStateShard.ShaderStateShard( - GameRenderer::getRendertypeLeashShader + CoreShaders.RENDERTYPE_ENERGY_SWIRL ); + protected static final RenderStateShard.ShaderStateShard RENDERTYPE_LEASH_SHADER = new RenderStateShard.ShaderStateShard(CoreShaders.RENDERTYPE_LEASH); protected static final RenderStateShard.ShaderStateShard RENDERTYPE_WATER_MASK_SHADER = new RenderStateShard.ShaderStateShard( - GameRenderer::getRendertypeWaterMaskShader - ); - protected static final RenderStateShard.ShaderStateShard RENDERTYPE_OUTLINE_SHADER = new RenderStateShard.ShaderStateShard( - GameRenderer::getRendertypeOutlineShader + CoreShaders.RENDERTYPE_WATER_MASK ); + protected static final RenderStateShard.ShaderStateShard RENDERTYPE_OUTLINE_SHADER = new RenderStateShard.ShaderStateShard(CoreShaders.RENDERTYPE_OUTLINE); protected static final RenderStateShard.ShaderStateShard RENDERTYPE_ARMOR_ENTITY_GLINT_SHADER = new RenderStateShard.ShaderStateShard( - GameRenderer::getRendertypeArmorEntityGlintShader + CoreShaders.RENDERTYPE_ARMOR_ENTITY_GLINT ); protected static final RenderStateShard.ShaderStateShard RENDERTYPE_GLINT_TRANSLUCENT_SHADER = new RenderStateShard.ShaderStateShard( - GameRenderer::getRendertypeGlintTranslucentShader - ); - protected static final RenderStateShard.ShaderStateShard RENDERTYPE_GLINT_SHADER = new RenderStateShard.ShaderStateShard( - GameRenderer::getRendertypeGlintShader + CoreShaders.RENDERTYPE_GLINT_TRANSLUCENT ); + protected static final RenderStateShard.ShaderStateShard RENDERTYPE_GLINT_SHADER = new RenderStateShard.ShaderStateShard(CoreShaders.RENDERTYPE_GLINT); protected static final RenderStateShard.ShaderStateShard RENDERTYPE_ENTITY_GLINT_SHADER = new RenderStateShard.ShaderStateShard( - GameRenderer::getRendertypeEntityGlintShader + CoreShaders.RENDERTYPE_ENTITY_GLINT ); - protected static final RenderStateShard.ShaderStateShard RENDERTYPE_ENTITY_GLINT_DIRECT_SHADER = new RenderStateShard.ShaderStateShard( - GameRenderer::getRendertypeEntityGlintDirectShader - ); - protected static final RenderStateShard.ShaderStateShard RENDERTYPE_CRUMBLING_SHADER = new RenderStateShard.ShaderStateShard( - GameRenderer::getRendertypeCrumblingShader - ); - protected static final RenderStateShard.ShaderStateShard RENDERTYPE_TEXT_SHADER = new RenderStateShard.ShaderStateShard(GameRenderer::getRendertypeTextShader); + protected static final RenderStateShard.ShaderStateShard RENDERTYPE_CRUMBLING_SHADER = new RenderStateShard.ShaderStateShard(CoreShaders.RENDERTYPE_CRUMBLING); + protected static final RenderStateShard.ShaderStateShard RENDERTYPE_TEXT_SHADER = new RenderStateShard.ShaderStateShard(CoreShaders.RENDERTYPE_TEXT); protected static final RenderStateShard.ShaderStateShard RENDERTYPE_TEXT_BACKGROUND_SHADER = new RenderStateShard.ShaderStateShard( - GameRenderer::getRendertypeTextBackgroundShader + CoreShaders.RENDERTYPE_TEXT_BACKGROUND ); protected static final RenderStateShard.ShaderStateShard RENDERTYPE_TEXT_INTENSITY_SHADER = new RenderStateShard.ShaderStateShard( - GameRenderer::getRendertypeTextIntensityShader + CoreShaders.RENDERTYPE_TEXT_INTENSITY ); protected static final RenderStateShard.ShaderStateShard RENDERTYPE_TEXT_SEE_THROUGH_SHADER = new RenderStateShard.ShaderStateShard( - GameRenderer::getRendertypeTextSeeThroughShader + CoreShaders.RENDERTYPE_TEXT_SEE_THROUGH ); protected static final RenderStateShard.ShaderStateShard RENDERTYPE_TEXT_BACKGROUND_SEE_THROUGH_SHADER = new RenderStateShard.ShaderStateShard( - GameRenderer::getRendertypeTextBackgroundSeeThroughShader + CoreShaders.RENDERTYPE_TEXT_BACKGROUND_SEE_THROUGH ); protected static final RenderStateShard.ShaderStateShard RENDERTYPE_TEXT_INTENSITY_SEE_THROUGH_SHADER = new RenderStateShard.ShaderStateShard( - GameRenderer::getRendertypeTextIntensitySeeThroughShader - ); - protected static final RenderStateShard.ShaderStateShard RENDERTYPE_LIGHTNING_SHADER = new RenderStateShard.ShaderStateShard( - GameRenderer::getRendertypeLightningShader - ); - protected static final RenderStateShard.ShaderStateShard RENDERTYPE_TRIPWIRE_SHADER = new RenderStateShard.ShaderStateShard( - GameRenderer::getRendertypeTripwireShader + CoreShaders.RENDERTYPE_TEXT_INTENSITY_SEE_THROUGH ); + protected static final RenderStateShard.ShaderStateShard RENDERTYPE_LIGHTNING_SHADER = new RenderStateShard.ShaderStateShard(CoreShaders.RENDERTYPE_LIGHTNING); + protected static final RenderStateShard.ShaderStateShard RENDERTYPE_TRIPWIRE_SHADER = new RenderStateShard.ShaderStateShard(CoreShaders.RENDERTYPE_TRIPWIRE); protected static final RenderStateShard.ShaderStateShard RENDERTYPE_END_PORTAL_SHADER = new RenderStateShard.ShaderStateShard( - GameRenderer::getRendertypeEndPortalShader + CoreShaders.RENDERTYPE_END_PORTAL ); protected static final RenderStateShard.ShaderStateShard RENDERTYPE_END_GATEWAY_SHADER = new RenderStateShard.ShaderStateShard( - GameRenderer::getRendertypeEndGatewayShader + CoreShaders.RENDERTYPE_END_GATEWAY ); - protected static final RenderStateShard.ShaderStateShard RENDERTYPE_CLOUDS_SHADER = new RenderStateShard.ShaderStateShard( - GameRenderer::getRendertypeCloudsShader - ); - protected static final RenderStateShard.ShaderStateShard RENDERTYPE_LINES_SHADER = new RenderStateShard.ShaderStateShard( - GameRenderer::getRendertypeLinesShader - ); - protected static final RenderStateShard.ShaderStateShard RENDERTYPE_GUI_SHADER = new RenderStateShard.ShaderStateShard(GameRenderer::getRendertypeGuiShader); + protected static final RenderStateShard.ShaderStateShard RENDERTYPE_CLOUDS_SHADER = new RenderStateShard.ShaderStateShard(CoreShaders.RENDERTYPE_CLOUDS); + protected static final RenderStateShard.ShaderStateShard RENDERTYPE_LINES_SHADER = new RenderStateShard.ShaderStateShard(CoreShaders.RENDERTYPE_LINES); + protected static final RenderStateShard.ShaderStateShard RENDERTYPE_GUI_SHADER = new RenderStateShard.ShaderStateShard(CoreShaders.RENDERTYPE_GUI); protected static final RenderStateShard.ShaderStateShard RENDERTYPE_GUI_OVERLAY_SHADER = new RenderStateShard.ShaderStateShard( - GameRenderer::getRendertypeGuiOverlayShader + CoreShaders.RENDERTYPE_GUI_OVERLAY ); protected static final RenderStateShard.ShaderStateShard RENDERTYPE_GUI_TEXT_HIGHLIGHT_SHADER = new RenderStateShard.ShaderStateShard( - GameRenderer::getRendertypeGuiTextHighlightShader + CoreShaders.RENDERTYPE_GUI_TEXT_HIGHLIGHT ); protected static final RenderStateShard.ShaderStateShard RENDERTYPE_GUI_GHOST_RECIPE_OVERLAY_SHADER = new RenderStateShard.ShaderStateShard( - GameRenderer::getRendertypeGuiGhostRecipeOverlayShader + CoreShaders.RENDERTYPE_GUI_GHOST_RECIPE_OVERLAY ); protected static final RenderStateShard.ShaderStateShard RENDERTYPE_BREEZE_WIND_SHADER = new RenderStateShard.ShaderStateShard( - GameRenderer::getRendertypeBreezeWindShader + CoreShaders.RENDERTYPE_BREEZE_WIND ); protected static final RenderStateShard.TextureStateShard BLOCK_SHEET_MIPPED = new RenderStateShard.TextureStateShard( - TextureAtlas.LOCATION_BLOCKS, false, true + TextureAtlas.LOCATION_BLOCKS, TriState.FALSE, true + ); + protected static final RenderStateShard.TextureStateShard BLOCK_SHEET = new RenderStateShard.TextureStateShard( + TextureAtlas.LOCATION_BLOCKS, TriState.FALSE, false ); - protected static final RenderStateShard.TextureStateShard BLOCK_SHEET = new RenderStateShard.TextureStateShard(TextureAtlas.LOCATION_BLOCKS, false, false); protected static final RenderStateShard.EmptyTextureStateShard NO_TEXTURE = new RenderStateShard.EmptyTextureStateShard(); protected static final RenderStateShard.TexturingStateShard DEFAULT_TEXTURING = new RenderStateShard.TexturingStateShard( "default_texturing", () -> {}, () -> {} @@ -276,64 +305,72 @@ public abstract class RenderStateShard { protected static final RenderStateShard.LayeringStateShard VIEW_OFFSET_Z_LAYERING = new RenderStateShard.LayeringStateShard("view_offset_z_layering", () -> { Matrix4fStack matrix4fStack = RenderSystem.getModelViewStack(); matrix4fStack.pushMatrix(); - matrix4fStack.scale(0.99975586F, 0.99975586F, 0.99975586F); - RenderSystem.applyModelViewMatrix(); + RenderSystem.getProjectionType().applyLayeringTransform(matrix4fStack, 1.0F); }, () -> { Matrix4fStack matrix4fStack = RenderSystem.getModelViewStack(); matrix4fStack.popMatrix(); - RenderSystem.applyModelViewMatrix(); }); - protected static final RenderStateShard.OutputStateShard MAIN_TARGET = new RenderStateShard.OutputStateShard("main_target", () -> {}, () -> {}); - protected static final RenderStateShard.OutputStateShard OUTLINE_TARGET = new RenderStateShard.OutputStateShard( - "outline_target", - () -> Minecraft.getInstance().levelRenderer.entityTarget().bindWrite(false), - () -> Minecraft.getInstance().getMainRenderTarget().bindWrite(false) + protected static final RenderStateShard.LayeringStateShard VIEW_OFFSET_Z_LAYERING_FORWARD = new RenderStateShard.LayeringStateShard( + "view_offset_z_layering_forward", () -> { + Matrix4fStack matrix4fStack = RenderSystem.getModelViewStack(); + matrix4fStack.pushMatrix(); + RenderSystem.getProjectionType().applyLayeringTransform(matrix4fStack, -1.0F); + }, () -> { + Matrix4fStack matrix4fStack = RenderSystem.getModelViewStack(); + matrix4fStack.popMatrix(); + } ); + protected static final RenderStateShard.OutputStateShard MAIN_TARGET = new RenderStateShard.OutputStateShard( + "main_target", () -> Minecraft.getInstance().getMainRenderTarget().bindWrite(false), () -> {} + ); + protected static final RenderStateShard.OutputStateShard OUTLINE_TARGET = new RenderStateShard.OutputStateShard("outline_target", () -> { + RenderTarget renderTarget = Minecraft.getInstance().levelRenderer.entityOutlineTarget(); + if (renderTarget != null) { + renderTarget.bindWrite(false); + } else { + Minecraft.getInstance().getMainRenderTarget().bindWrite(false); + } + }, () -> Minecraft.getInstance().getMainRenderTarget().bindWrite(false)); protected static final RenderStateShard.OutputStateShard TRANSLUCENT_TARGET = new RenderStateShard.OutputStateShard("translucent_target", () -> { - if (Minecraft.useShaderTransparency()) { - Minecraft.getInstance().levelRenderer.getTranslucentTarget().bindWrite(false); - } - }, () -> { - if (Minecraft.useShaderTransparency()) { + RenderTarget renderTarget = Minecraft.getInstance().levelRenderer.getTranslucentTarget(); + if (renderTarget != null) { + renderTarget.bindWrite(false); + } else { Minecraft.getInstance().getMainRenderTarget().bindWrite(false); } - }); + }, () -> Minecraft.getInstance().getMainRenderTarget().bindWrite(false)); protected static final RenderStateShard.OutputStateShard PARTICLES_TARGET = new RenderStateShard.OutputStateShard("particles_target", () -> { - if (Minecraft.useShaderTransparency()) { - Minecraft.getInstance().levelRenderer.getParticlesTarget().bindWrite(false); - } - }, () -> { - if (Minecraft.useShaderTransparency()) { + RenderTarget renderTarget = Minecraft.getInstance().levelRenderer.getParticlesTarget(); + if (renderTarget != null) { + renderTarget.bindWrite(false); + } else { Minecraft.getInstance().getMainRenderTarget().bindWrite(false); } - }); + }, () -> Minecraft.getInstance().getMainRenderTarget().bindWrite(false)); protected static final RenderStateShard.OutputStateShard WEATHER_TARGET = new RenderStateShard.OutputStateShard("weather_target", () -> { - if (Minecraft.useShaderTransparency()) { - Minecraft.getInstance().levelRenderer.getWeatherTarget().bindWrite(false); - } - }, () -> { - if (Minecraft.useShaderTransparency()) { + RenderTarget renderTarget = Minecraft.getInstance().levelRenderer.getWeatherTarget(); + if (renderTarget != null) { + renderTarget.bindWrite(false); + } else { Minecraft.getInstance().getMainRenderTarget().bindWrite(false); } - }); + }, () -> Minecraft.getInstance().getMainRenderTarget().bindWrite(false)); protected static final RenderStateShard.OutputStateShard CLOUDS_TARGET = new RenderStateShard.OutputStateShard("clouds_target", () -> { - if (Minecraft.useShaderTransparency()) { - Minecraft.getInstance().levelRenderer.getCloudsTarget().bindWrite(false); - } - }, () -> { - if (Minecraft.useShaderTransparency()) { + RenderTarget renderTarget = Minecraft.getInstance().levelRenderer.getCloudsTarget(); + if (renderTarget != null) { + renderTarget.bindWrite(false); + } else { Minecraft.getInstance().getMainRenderTarget().bindWrite(false); } - }); + }, () -> Minecraft.getInstance().getMainRenderTarget().bindWrite(false)); protected static final RenderStateShard.OutputStateShard ITEM_ENTITY_TARGET = new RenderStateShard.OutputStateShard("item_entity_target", () -> { - if (Minecraft.useShaderTransparency()) { - Minecraft.getInstance().levelRenderer.getItemEntityTarget().bindWrite(false); - } - }, () -> { - if (Minecraft.useShaderTransparency()) { + RenderTarget renderTarget = Minecraft.getInstance().levelRenderer.getItemEntityTarget(); + if (renderTarget != null) { + renderTarget.bindWrite(false); + } else { Minecraft.getInstance().getMainRenderTarget().bindWrite(false); } - }); + }, () -> Minecraft.getInstance().getMainRenderTarget().bindWrite(false)); protected static final RenderStateShard.LineStateShard DEFAULT_LINE = new RenderStateShard.LineStateShard(OptionalDouble.of(1.0)); protected static final RenderStateShard.ColorLogicStateShard NO_COLOR_LOGIC = new RenderStateShard.ColorLogicStateShard( "no_color_logic", () -> RenderSystem.disableColorLogicOp(), () -> {} @@ -518,22 +555,8 @@ public abstract class RenderStateShard { return this.cutoutTexture; } - public static RenderStateShard.MultiTextureStateShard.Builder builder() { - return new RenderStateShard.MultiTextureStateShard.Builder(); - } - - @Environment(EnvType.CLIENT) - public static final class Builder { - private final ImmutableList.Builder> builder = new ImmutableList.Builder<>(); - - public RenderStateShard.MultiTextureStateShard.Builder add(ResourceLocation texture, boolean blur, boolean mipmap) { - this.builder.add(Triple.of(texture, blur, mipmap)); - return this; - } - - public RenderStateShard.MultiTextureStateShard build() { - return new RenderStateShard.MultiTextureStateShard(this.builder.build()); - } + public static Builder builder() { + return new Builder(); } } @@ -568,15 +591,15 @@ public abstract class RenderStateShard { @Environment(EnvType.CLIENT) protected static class ShaderStateShard extends RenderStateShard { - private final Optional> shader; + private final Optional shader; - public ShaderStateShard(Supplier shader) { - super("shader", () -> RenderSystem.setShader(shader), () -> {}); - this.shader = Optional.of(shader); + public ShaderStateShard(ShaderProgram shaderProgram) { + super("shader", () -> RenderSystem.setShader(shaderProgram), () -> {}); + this.shader = Optional.of(shaderProgram); } public ShaderStateShard() { - super("shader", () -> RenderSystem.setShader(() -> null), () -> {}); + super("shader", RenderSystem::clearShader, () -> {}); this.shader = Optional.empty(); } @@ -589,18 +612,19 @@ public abstract class RenderStateShard { @Environment(EnvType.CLIENT) protected static class TextureStateShard extends RenderStateShard.EmptyTextureStateShard { private final Optional texture; - private final boolean blur; + private final TriState blur; private final boolean mipmap; - public TextureStateShard(ResourceLocation texture, boolean blur, boolean mipmap) { + public TextureStateShard(ResourceLocation resourceLocation, TriState triState, boolean bl) { super(() -> { TextureManager textureManager = Minecraft.getInstance().getTextureManager(); - textureManager.getTexture(texture).setFilter(blur, mipmap); - RenderSystem.setShaderTexture(0, texture); + AbstractTexture abstractTexture = textureManager.getTexture(resourceLocation); + abstractTexture.setFilter(triState.toBoolean(abstractTexture.getDefaultBlur()), bl); + RenderSystem.setShaderTexture(0, resourceLocation); }, () -> {}); - this.texture = Optional.of(texture); - this.blur = blur; - this.mipmap = mipmap; + this.texture = Optional.of(resourceLocation); + this.blur = triState; + this.mipmap = bl; } @Override diff --git a/net/minecraft/client/renderer/RenderType.java b/net/minecraft/client/renderer/RenderType.java index 08652b7f..2d4e1bc4 100644 --- a/net/minecraft/client/renderer/RenderType.java +++ b/net/minecraft/client/renderer/RenderType.java @@ -13,9 +13,13 @@ import java.util.function.Function; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.Util; +import net.minecraft.client.gui.Gui; +import net.minecraft.client.gui.screens.LoadingOverlay; +import net.minecraft.client.renderer.RenderType.CompositeState.CompositeStateBuilder; import net.minecraft.client.renderer.blockentity.TheEndPortalRenderer; import net.minecraft.client.renderer.entity.ItemRenderer; import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.TriState; @Environment(EnvType.CLIENT) public abstract class RenderType extends RenderStateShard { @@ -71,11 +75,25 @@ public abstract class RenderType extends RenderStateShard { private static final Function ARMOR_CUTOUT_NO_CULL = Util.memoize( (Function)(resourceLocation -> createArmorCutoutNoCull("armor_cutout_no_cull", resourceLocation, false)) ); + private static final Function ARMOR_TRANSLUCENT = Util.memoize( + (Function)(resourceLocation -> { + RenderType.CompositeState compositeState = RenderType.CompositeState.builder() + .setShaderState(RENDERTYPE_ARMOR_TRANSLUCENT_SHADER) + .setTextureState(new RenderStateShard.TextureStateShard(resourceLocation, TriState.FALSE, false)) + .setTransparencyState(TRANSLUCENT_TRANSPARENCY) + .setCullState(NO_CULL) + .setLightmapState(LIGHTMAP) + .setOverlayState(OVERLAY) + .setLayeringState(VIEW_OFFSET_Z_LAYERING) + .createCompositeState(true); + return create("armor_translucent", DefaultVertexFormat.NEW_ENTITY, VertexFormat.Mode.QUADS, 1536, true, true, compositeState); + }) + ); private static final Function ENTITY_SOLID = Util.memoize( (Function)(resourceLocation -> { RenderType.CompositeState compositeState = RenderType.CompositeState.builder() .setShaderState(RENDERTYPE_ENTITY_SOLID_SHADER) - .setTextureState(new RenderStateShard.TextureStateShard(resourceLocation, false, false)) + .setTextureState(new RenderStateShard.TextureStateShard(resourceLocation, TriState.FALSE, false)) .setTransparencyState(NO_TRANSPARENCY) .setLightmapState(LIGHTMAP) .setOverlayState(OVERLAY) @@ -83,11 +101,24 @@ public abstract class RenderType extends RenderStateShard { return create("entity_solid", DefaultVertexFormat.NEW_ENTITY, VertexFormat.Mode.QUADS, 1536, true, false, compositeState); }) ); + private static final Function ENTITY_SOLID_Z_OFFSET_FORWARD = Util.memoize( + (Function)(resourceLocation -> { + RenderType.CompositeState compositeState = RenderType.CompositeState.builder() + .setShaderState(RENDERTYPE_ENTITY_SOLID_SHADER) + .setTextureState(new RenderStateShard.TextureStateShard(resourceLocation, TriState.FALSE, false)) + .setTransparencyState(NO_TRANSPARENCY) + .setLightmapState(LIGHTMAP) + .setOverlayState(OVERLAY) + .setLayeringState(VIEW_OFFSET_Z_LAYERING_FORWARD) + .createCompositeState(true); + return create("entity_solid_z_offset_forward", DefaultVertexFormat.NEW_ENTITY, VertexFormat.Mode.QUADS, 1536, true, false, compositeState); + }) + ); private static final Function ENTITY_CUTOUT = Util.memoize( (Function)(resourceLocation -> { RenderType.CompositeState compositeState = RenderType.CompositeState.builder() .setShaderState(RENDERTYPE_ENTITY_CUTOUT_SHADER) - .setTextureState(new RenderStateShard.TextureStateShard(resourceLocation, false, false)) + .setTextureState(new RenderStateShard.TextureStateShard(resourceLocation, TriState.FALSE, false)) .setTransparencyState(NO_TRANSPARENCY) .setLightmapState(LIGHTMAP) .setOverlayState(OVERLAY) @@ -99,7 +130,7 @@ public abstract class RenderType extends RenderStateShard { (BiFunction)((resourceLocation, boolean_) -> { RenderType.CompositeState compositeState = RenderType.CompositeState.builder() .setShaderState(RENDERTYPE_ENTITY_CUTOUT_NO_CULL_SHADER) - .setTextureState(new RenderStateShard.TextureStateShard(resourceLocation, false, false)) + .setTextureState(new RenderStateShard.TextureStateShard(resourceLocation, TriState.FALSE, false)) .setTransparencyState(NO_TRANSPARENCY) .setCullState(NO_CULL) .setLightmapState(LIGHTMAP) @@ -112,7 +143,7 @@ public abstract class RenderType extends RenderStateShard { (BiFunction)((resourceLocation, boolean_) -> { RenderType.CompositeState compositeState = RenderType.CompositeState.builder() .setShaderState(RENDERTYPE_ENTITY_CUTOUT_NO_CULL_Z_OFFSET_SHADER) - .setTextureState(new RenderStateShard.TextureStateShard(resourceLocation, false, false)) + .setTextureState(new RenderStateShard.TextureStateShard(resourceLocation, TriState.FALSE, false)) .setTransparencyState(NO_TRANSPARENCY) .setCullState(NO_CULL) .setLightmapState(LIGHTMAP) @@ -126,33 +157,21 @@ public abstract class RenderType extends RenderStateShard { (Function)(resourceLocation -> { RenderType.CompositeState compositeState = RenderType.CompositeState.builder() .setShaderState(RENDERTYPE_ITEM_ENTITY_TRANSLUCENT_CULL_SHADER) - .setTextureState(new RenderStateShard.TextureStateShard(resourceLocation, false, false)) + .setTextureState(new RenderStateShard.TextureStateShard(resourceLocation, TriState.FALSE, false)) .setTransparencyState(TRANSLUCENT_TRANSPARENCY) .setOutputState(ITEM_ENTITY_TARGET) .setLightmapState(LIGHTMAP) .setOverlayState(OVERLAY) - .setWriteMaskState(RenderStateShard.COLOR_DEPTH_WRITE) + .setWriteMaskState(COLOR_DEPTH_WRITE) .createCompositeState(true); return create("item_entity_translucent_cull", DefaultVertexFormat.NEW_ENTITY, VertexFormat.Mode.QUADS, 1536, true, true, compositeState); }) ); - private static final Function ENTITY_TRANSLUCENT_CULL = Util.memoize( - (Function)(resourceLocation -> { - RenderType.CompositeState compositeState = RenderType.CompositeState.builder() - .setShaderState(RENDERTYPE_ENTITY_TRANSLUCENT_CULL_SHADER) - .setTextureState(new RenderStateShard.TextureStateShard(resourceLocation, false, false)) - .setTransparencyState(TRANSLUCENT_TRANSPARENCY) - .setLightmapState(LIGHTMAP) - .setOverlayState(OVERLAY) - .createCompositeState(true); - return create("entity_translucent_cull", DefaultVertexFormat.NEW_ENTITY, VertexFormat.Mode.QUADS, 1536, true, true, compositeState); - }) - ); private static final BiFunction ENTITY_TRANSLUCENT = Util.memoize( (BiFunction)((resourceLocation, boolean_) -> { RenderType.CompositeState compositeState = RenderType.CompositeState.builder() .setShaderState(RENDERTYPE_ENTITY_TRANSLUCENT_SHADER) - .setTextureState(new RenderStateShard.TextureStateShard(resourceLocation, false, false)) + .setTextureState(new RenderStateShard.TextureStateShard(resourceLocation, TriState.FALSE, false)) .setTransparencyState(TRANSLUCENT_TRANSPARENCY) .setCullState(NO_CULL) .setLightmapState(LIGHTMAP) @@ -165,7 +184,7 @@ public abstract class RenderType extends RenderStateShard { (BiFunction)((resourceLocation, boolean_) -> { RenderType.CompositeState compositeState = RenderType.CompositeState.builder() .setShaderState(RENDERTYPE_ENTITY_TRANSLUCENT_EMISSIVE_SHADER) - .setTextureState(new RenderStateShard.TextureStateShard(resourceLocation, false, false)) + .setTextureState(new RenderStateShard.TextureStateShard(resourceLocation, TriState.FALSE, false)) .setTransparencyState(TRANSLUCENT_TRANSPARENCY) .setCullState(NO_CULL) .setWriteMaskState(COLOR_WRITE) @@ -178,7 +197,7 @@ public abstract class RenderType extends RenderStateShard { (Function)(resourceLocation -> { RenderType.CompositeState compositeState = RenderType.CompositeState.builder() .setShaderState(RENDERTYPE_ENTITY_SMOOTH_CUTOUT_SHADER) - .setTextureState(new RenderStateShard.TextureStateShard(resourceLocation, false, false)) + .setTextureState(new RenderStateShard.TextureStateShard(resourceLocation, TriState.FALSE, false)) .setCullState(NO_CULL) .setLightmapState(LIGHTMAP) .createCompositeState(true); @@ -189,7 +208,7 @@ public abstract class RenderType extends RenderStateShard { (BiFunction)((resourceLocation, boolean_) -> { RenderType.CompositeState compositeState = RenderType.CompositeState.builder() .setShaderState(RENDERTYPE_BEACON_BEAM_SHADER) - .setTextureState(new RenderStateShard.TextureStateShard(resourceLocation, false, false)) + .setTextureState(new RenderStateShard.TextureStateShard(resourceLocation, TriState.FALSE, false)) .setTransparencyState(boolean_ ? TRANSLUCENT_TRANSPARENCY : NO_TRANSPARENCY) .setWriteMaskState(boolean_ ? COLOR_WRITE : COLOR_DEPTH_WRITE) .createCompositeState(false); @@ -200,7 +219,7 @@ public abstract class RenderType extends RenderStateShard { (Function)(resourceLocation -> { RenderType.CompositeState compositeState = RenderType.CompositeState.builder() .setShaderState(RENDERTYPE_ENTITY_DECAL_SHADER) - .setTextureState(new RenderStateShard.TextureStateShard(resourceLocation, false, false)) + .setTextureState(new RenderStateShard.TextureStateShard(resourceLocation, TriState.FALSE, false)) .setDepthTestState(EQUAL_DEPTH_TEST) .setCullState(NO_CULL) .setLightmapState(LIGHTMAP) @@ -213,7 +232,7 @@ public abstract class RenderType extends RenderStateShard { (Function)(resourceLocation -> { RenderType.CompositeState compositeState = RenderType.CompositeState.builder() .setShaderState(RENDERTYPE_ENTITY_NO_OUTLINE_SHADER) - .setTextureState(new RenderStateShard.TextureStateShard(resourceLocation, false, false)) + .setTextureState(new RenderStateShard.TextureStateShard(resourceLocation, TriState.FALSE, false)) .setTransparencyState(TRANSLUCENT_TRANSPARENCY) .setCullState(NO_CULL) .setLightmapState(LIGHTMAP) @@ -227,7 +246,7 @@ public abstract class RenderType extends RenderStateShard { (Function)(resourceLocation -> { RenderType.CompositeState compositeState = RenderType.CompositeState.builder() .setShaderState(RENDERTYPE_ENTITY_SHADOW_SHADER) - .setTextureState(new RenderStateShard.TextureStateShard(resourceLocation, false, false)) + .setTextureState(new RenderStateShard.TextureStateShard(resourceLocation, TriState.FALSE, false)) .setTransparencyState(TRANSLUCENT_TRANSPARENCY) .setCullState(CULL) .setLightmapState(LIGHTMAP) @@ -243,7 +262,7 @@ public abstract class RenderType extends RenderStateShard { (Function)(resourceLocation -> { RenderType.CompositeState compositeState = RenderType.CompositeState.builder() .setShaderState(RENDERTYPE_ENTITY_ALPHA_SHADER) - .setTextureState(new RenderStateShard.TextureStateShard(resourceLocation, false, false)) + .setTextureState(new RenderStateShard.TextureStateShard(resourceLocation, TriState.FALSE, false)) .setCullState(NO_CULL) .createCompositeState(true); return create("entity_alpha", DefaultVertexFormat.NEW_ENTITY, VertexFormat.Mode.QUADS, 1536, compositeState); @@ -251,7 +270,7 @@ public abstract class RenderType extends RenderStateShard { ); private static final BiFunction EYES = Util.memoize( (BiFunction)((resourceLocation, transparencyStateShard) -> { - RenderStateShard.TextureStateShard textureStateShard = new RenderStateShard.TextureStateShard(resourceLocation, false, false); + RenderStateShard.TextureStateShard textureStateShard = new RenderStateShard.TextureStateShard(resourceLocation, TriState.FALSE, false); return create( "eyes", DefaultVertexFormat.NEW_ENTITY, @@ -298,7 +317,7 @@ public abstract class RenderType extends RenderStateShard { 1536, RenderType.CompositeState.builder() .setShaderState(RENDERTYPE_ARMOR_ENTITY_GLINT_SHADER) - .setTextureState(new RenderStateShard.TextureStateShard(ItemRenderer.ENCHANTED_GLINT_ENTITY, true, false)) + .setTextureState(new RenderStateShard.TextureStateShard(ItemRenderer.ENCHANTED_GLINT_ENTITY, TriState.DEFAULT, false)) .setWriteMaskState(COLOR_WRITE) .setCullState(NO_CULL) .setDepthTestState(EQUAL_DEPTH_TEST) @@ -314,7 +333,7 @@ public abstract class RenderType extends RenderStateShard { 1536, RenderType.CompositeState.builder() .setShaderState(RENDERTYPE_GLINT_TRANSLUCENT_SHADER) - .setTextureState(new RenderStateShard.TextureStateShard(ItemRenderer.ENCHANTED_GLINT_ITEM, true, false)) + .setTextureState(new RenderStateShard.TextureStateShard(ItemRenderer.ENCHANTED_GLINT_ITEM, TriState.DEFAULT, false)) .setWriteMaskState(COLOR_WRITE) .setCullState(NO_CULL) .setDepthTestState(EQUAL_DEPTH_TEST) @@ -330,7 +349,7 @@ public abstract class RenderType extends RenderStateShard { 1536, RenderType.CompositeState.builder() .setShaderState(RENDERTYPE_GLINT_SHADER) - .setTextureState(new RenderStateShard.TextureStateShard(ItemRenderer.ENCHANTED_GLINT_ITEM, true, false)) + .setTextureState(new RenderStateShard.TextureStateShard(ItemRenderer.ENCHANTED_GLINT_ITEM, TriState.DEFAULT, false)) .setWriteMaskState(COLOR_WRITE) .setCullState(NO_CULL) .setDepthTestState(EQUAL_DEPTH_TEST) @@ -345,23 +364,7 @@ public abstract class RenderType extends RenderStateShard { 1536, RenderType.CompositeState.builder() .setShaderState(RENDERTYPE_ENTITY_GLINT_SHADER) - .setTextureState(new RenderStateShard.TextureStateShard(ItemRenderer.ENCHANTED_GLINT_ENTITY, true, false)) - .setWriteMaskState(COLOR_WRITE) - .setCullState(NO_CULL) - .setDepthTestState(EQUAL_DEPTH_TEST) - .setTransparencyState(GLINT_TRANSPARENCY) - .setOutputState(ITEM_ENTITY_TARGET) - .setTexturingState(ENTITY_GLINT_TEXTURING) - .createCompositeState(false) - ); - private static final RenderType ENTITY_GLINT_DIRECT = create( - "entity_glint_direct", - DefaultVertexFormat.POSITION_TEX, - VertexFormat.Mode.QUADS, - 1536, - RenderType.CompositeState.builder() - .setShaderState(RENDERTYPE_ENTITY_GLINT_DIRECT_SHADER) - .setTextureState(new RenderStateShard.TextureStateShard(ItemRenderer.ENCHANTED_GLINT_ENTITY, true, false)) + .setTextureState(new RenderStateShard.TextureStateShard(ItemRenderer.ENCHANTED_GLINT_ENTITY, TriState.DEFAULT, false)) .setWriteMaskState(COLOR_WRITE) .setCullState(NO_CULL) .setDepthTestState(EQUAL_DEPTH_TEST) @@ -371,7 +374,7 @@ public abstract class RenderType extends RenderStateShard { ); private static final Function CRUMBLING = Util.memoize( (Function)(resourceLocation -> { - RenderStateShard.TextureStateShard textureStateShard = new RenderStateShard.TextureStateShard(resourceLocation, false, false); + RenderStateShard.TextureStateShard textureStateShard = new RenderStateShard.TextureStateShard(resourceLocation, TriState.FALSE, false); return create( "crumbling", DefaultVertexFormat.BLOCK, @@ -396,10 +399,10 @@ public abstract class RenderType extends RenderStateShard { VertexFormat.Mode.QUADS, 786432, false, - true, + false, RenderType.CompositeState.builder() .setShaderState(RENDERTYPE_TEXT_SHADER) - .setTextureState(new RenderStateShard.TextureStateShard(resourceLocation, false, false)) + .setTextureState(new RenderStateShard.TextureStateShard(resourceLocation, TriState.FALSE, false)) .setTransparencyState(TRANSLUCENT_TRANSPARENCY) .setLightmapState(LIGHTMAP) .createCompositeState(false) @@ -426,10 +429,10 @@ public abstract class RenderType extends RenderStateShard { VertexFormat.Mode.QUADS, 786432, false, - true, + false, RenderType.CompositeState.builder() .setShaderState(RENDERTYPE_TEXT_INTENSITY_SHADER) - .setTextureState(new RenderStateShard.TextureStateShard(resourceLocation, false, false)) + .setTextureState(new RenderStateShard.TextureStateShard(resourceLocation, TriState.FALSE, false)) .setTransparencyState(TRANSLUCENT_TRANSPARENCY) .setLightmapState(LIGHTMAP) .createCompositeState(false) @@ -445,7 +448,7 @@ public abstract class RenderType extends RenderStateShard { true, RenderType.CompositeState.builder() .setShaderState(RENDERTYPE_TEXT_SHADER) - .setTextureState(new RenderStateShard.TextureStateShard(resourceLocation, false, false)) + .setTextureState(new RenderStateShard.TextureStateShard(resourceLocation, TriState.FALSE, false)) .setTransparencyState(TRANSLUCENT_TRANSPARENCY) .setLightmapState(LIGHTMAP) .setLayeringState(POLYGON_OFFSET_LAYERING) @@ -462,7 +465,7 @@ public abstract class RenderType extends RenderStateShard { true, RenderType.CompositeState.builder() .setShaderState(RENDERTYPE_TEXT_INTENSITY_SHADER) - .setTextureState(new RenderStateShard.TextureStateShard(resourceLocation, false, false)) + .setTextureState(new RenderStateShard.TextureStateShard(resourceLocation, TriState.FALSE, false)) .setTransparencyState(TRANSLUCENT_TRANSPARENCY) .setLightmapState(LIGHTMAP) .setLayeringState(POLYGON_OFFSET_LAYERING) @@ -476,10 +479,10 @@ public abstract class RenderType extends RenderStateShard { VertexFormat.Mode.QUADS, 1536, false, - true, + false, RenderType.CompositeState.builder() .setShaderState(RENDERTYPE_TEXT_SEE_THROUGH_SHADER) - .setTextureState(new RenderStateShard.TextureStateShard(resourceLocation, false, false)) + .setTextureState(new RenderStateShard.TextureStateShard(resourceLocation, TriState.FALSE, false)) .setTransparencyState(TRANSLUCENT_TRANSPARENCY) .setLightmapState(LIGHTMAP) .setDepthTestState(NO_DEPTH_TEST) @@ -513,7 +516,7 @@ public abstract class RenderType extends RenderStateShard { true, RenderType.CompositeState.builder() .setShaderState(RENDERTYPE_TEXT_INTENSITY_SEE_THROUGH_SHADER) - .setTextureState(new RenderStateShard.TextureStateShard(resourceLocation, false, false)) + .setTextureState(new RenderStateShard.TextureStateShard(resourceLocation, TriState.FALSE, false)) .setTransparencyState(TRANSLUCENT_TRANSPARENCY) .setLightmapState(LIGHTMAP) .setDepthTestState(NO_DEPTH_TEST) @@ -555,7 +558,7 @@ public abstract class RenderType extends RenderStateShard { 1536, false, false, - RenderType.CompositeState.builder().setShaderState(RenderStateShard.POSITION_SHADER).setWriteMaskState(DEPTH_WRITE).createCompositeState(false) + RenderType.CompositeState.builder().setShaderState(POSITION_SHADER).setWriteMaskState(DEPTH_WRITE).createCompositeState(false) ); private static final RenderType TRIPWIRE = create("tripwire", DefaultVertexFormat.BLOCK, VertexFormat.Mode.QUADS, 1536, true, true, tripwireState()); private static final RenderType END_PORTAL = create( @@ -592,8 +595,9 @@ public abstract class RenderType extends RenderStateShard { ) .createCompositeState(false) ); - private static final RenderType CLOUDS = createClouds(false); - private static final RenderType CLOUDS_DEPTH_ONLY = createClouds(true); + private static final RenderType FLAT_CLOUDS = createClouds(false, false); + private static final RenderType CLOUDS = createClouds(false, true); + private static final RenderType CLOUDS_DEPTH_ONLY = createClouds(true, true); public static final RenderType.CompositeRenderType LINES = create( "lines", DefaultVertexFormat.POSITION_COLOR_NORMAL, @@ -609,6 +613,21 @@ public abstract class RenderType extends RenderStateShard { .setCullState(NO_CULL) .createCompositeState(false) ); + public static final RenderType.CompositeRenderType SECONDARY_BLOCK_OUTLINE = create( + "secondary_block_outline", + DefaultVertexFormat.POSITION_COLOR_NORMAL, + VertexFormat.Mode.LINES, + 1536, + RenderType.CompositeState.builder() + .setShaderState(RENDERTYPE_LINES_SHADER) + .setLineState(new RenderStateShard.LineStateShard(OptionalDouble.of(7.0))) + .setLayeringState(VIEW_OFFSET_Z_LAYERING) + .setTransparencyState(RenderStateShard.TRANSLUCENT_TRANSPARENCY) + .setOutputState(ITEM_ENTITY_TARGET) + .setWriteMaskState(COLOR_WRITE) + .setCullState(NO_CULL) + .createCompositeState(false) + ); public static final RenderType.CompositeRenderType LINE_STRIP = create( "line_strip", DefaultVertexFormat.POSITION_COLOR_NORMAL, @@ -664,6 +683,19 @@ public abstract class RenderType extends RenderStateShard { .setCullState(NO_CULL) .createCompositeState(false) ); + private static final RenderType.CompositeRenderType DEBUG_TRIANGLE_FAN = create( + "debug_triangle_fan", + DefaultVertexFormat.POSITION_COLOR, + VertexFormat.Mode.TRIANGLE_FAN, + 1536, + false, + true, + RenderType.CompositeState.builder() + .setShaderState(POSITION_COLOR_SHADER) + .setTransparencyState(TRANSLUCENT_TRANSPARENCY) + .setCullState(NO_CULL) + .createCompositeState(false) + ); private static final RenderType.CompositeRenderType DEBUG_STRUCTURE_QUADS = create( "debug_structure_quads", DefaultVertexFormat.POSITION_COLOR, @@ -716,6 +748,48 @@ public abstract class RenderType extends RenderStateShard { .setWriteMaskState(COLOR_WRITE) .createCompositeState(false) ); + private static final Function GUI_TEXTURED_OVERLAY = Util.memoize( + (Function)(resourceLocation -> create( + "gui_textured_overlay", + DefaultVertexFormat.POSITION_TEX_COLOR, + VertexFormat.Mode.QUADS, + 1536, + RenderType.CompositeState.builder() + .setTextureState(new RenderStateShard.TextureStateShard(resourceLocation, TriState.DEFAULT, false)) + .setShaderState(POSITION_TEXTURE_COLOR_SHADER) + .setTransparencyState(TRANSLUCENT_TRANSPARENCY) + .setDepthTestState(NO_DEPTH_TEST) + .setWriteMaskState(COLOR_WRITE) + .createCompositeState(false) + )) + ); + private static final Function GUI_OPAQUE_TEXTURED_BACKGROUND = Util.memoize( + (Function)(resourceLocation -> create( + "gui_opaque_textured_background", + DefaultVertexFormat.POSITION_TEX_COLOR, + VertexFormat.Mode.QUADS, + 786432, + RenderType.CompositeState.builder() + .setTextureState(new RenderStateShard.TextureStateShard(resourceLocation, TriState.FALSE, false)) + .setShaderState(POSITION_TEXTURE_COLOR_SHADER) + .setTransparencyState(NO_TRANSPARENCY) + .setDepthTestState(LEQUAL_DEPTH_TEST) + .createCompositeState(false) + )) + ); + private static final RenderType.CompositeRenderType GUI_NAUSEA_OVERLAY = create( + "gui_nausea_overlay", + DefaultVertexFormat.POSITION_TEX_COLOR, + VertexFormat.Mode.QUADS, + 1536, + RenderType.CompositeState.builder() + .setTextureState(new RenderStateShard.TextureStateShard(Gui.NAUSEA_LOCATION, TriState.DEFAULT, false)) + .setShaderState(POSITION_TEXTURE_COLOR_SHADER) + .setTransparencyState(NAUSEA_OVERLAY_TRANSPARENCY) + .setDepthTestState(NO_DEPTH_TEST) + .setWriteMaskState(COLOR_WRITE) + .createCompositeState(false) + ); private static final RenderType.CompositeRenderType GUI_TEXT_HIGHLIGHT = create( "gui_text_highlight", DefaultVertexFormat.POSITION_COLOR, @@ -740,6 +814,61 @@ public abstract class RenderType extends RenderStateShard { .setWriteMaskState(COLOR_WRITE) .createCompositeState(false) ); + private static final Function GUI_TEXTURED = Util.memoize( + (Function)(resourceLocation -> create( + "gui_textured", + DefaultVertexFormat.POSITION_TEX_COLOR, + VertexFormat.Mode.QUADS, + 786432, + RenderType.CompositeState.builder() + .setTextureState(new RenderStateShard.TextureStateShard(resourceLocation, TriState.FALSE, false)) + .setShaderState(POSITION_TEXTURE_COLOR_SHADER) + .setTransparencyState(TRANSLUCENT_TRANSPARENCY) + .setDepthTestState(LEQUAL_DEPTH_TEST) + .createCompositeState(false) + )) + ); + private static final Function VIGNETTE = Util.memoize( + (Function)(resourceLocation -> create( + "vignette", + DefaultVertexFormat.POSITION_TEX_COLOR, + VertexFormat.Mode.QUADS, + 786432, + RenderType.CompositeState.builder() + .setTextureState(new RenderStateShard.TextureStateShard(resourceLocation, TriState.DEFAULT, false)) + .setShaderState(POSITION_TEXTURE_COLOR_SHADER) + .setTransparencyState(VIGNETTE_TRANSPARENCY) + .setDepthTestState(NO_DEPTH_TEST) + .setWriteMaskState(COLOR_WRITE) + .createCompositeState(false) + )) + ); + private static final Function CROSSHAIR = Util.memoize( + (Function)(resourceLocation -> create( + "crosshair", + DefaultVertexFormat.POSITION_TEX_COLOR, + VertexFormat.Mode.QUADS, + 786432, + RenderType.CompositeState.builder() + .setTextureState(new RenderStateShard.TextureStateShard(resourceLocation, TriState.FALSE, false)) + .setShaderState(POSITION_TEXTURE_COLOR_SHADER) + .setTransparencyState(CROSSHAIR_TRANSPARENCY) + .createCompositeState(false) + )) + ); + private static final RenderType.CompositeRenderType MOJANG_LOGO = create( + "mojang_logo", + DefaultVertexFormat.POSITION_TEX_COLOR, + VertexFormat.Mode.QUADS, + 786432, + RenderType.CompositeState.builder() + .setTextureState(new RenderStateShard.TextureStateShard(LoadingOverlay.MOJANG_STUDIOS_LOGO_LOCATION, TriState.DEFAULT, false)) + .setShaderState(POSITION_TEXTURE_COLOR_SHADER) + .setTransparencyState(MOJANG_LOGO_TRANSPARENCY) + .setDepthTestState(NO_DEPTH_TEST) + .setWriteMaskState(COLOR_WRITE) + .createCompositeState(false) + ); private static final ImmutableList CHUNK_BUFFER_LAYERS = ImmutableList.of(solid(), cutoutMipped(), cutout(), translucent(), tripwire()); private final VertexFormat format; private final VertexFormat.Mode mode; @@ -790,7 +919,7 @@ public abstract class RenderType extends RenderStateShard { private static RenderType.CompositeRenderType createArmorCutoutNoCull(String name, ResourceLocation id, boolean equalDepthTest) { RenderType.CompositeState compositeState = RenderType.CompositeState.builder() .setShaderState(RENDERTYPE_ARMOR_CUTOUT_NO_CULL_SHADER) - .setTextureState(new RenderStateShard.TextureStateShard(id, false, false)) + .setTextureState(new RenderStateShard.TextureStateShard(id, TriState.FALSE, false)) .setTransparencyState(NO_TRANSPARENCY) .setCullState(NO_CULL) .setLightmapState(LIGHTMAP) @@ -809,10 +938,18 @@ public abstract class RenderType extends RenderStateShard { return createArmorCutoutNoCull("armor_decal_cutout_no_cull", id, true); } + public static RenderType armorTranslucent(ResourceLocation resourceLocation) { + return (RenderType)ARMOR_TRANSLUCENT.apply(resourceLocation); + } + public static RenderType entitySolid(ResourceLocation location) { return (RenderType)ENTITY_SOLID.apply(location); } + public static RenderType entitySolidZOffsetForward(ResourceLocation resourceLocation) { + return (RenderType)ENTITY_SOLID_Z_OFFSET_FORWARD.apply(resourceLocation); + } + public static RenderType entityCutout(ResourceLocation location) { return (RenderType)ENTITY_CUTOUT.apply(location); } @@ -837,10 +974,6 @@ public abstract class RenderType extends RenderStateShard { return (RenderType)ITEM_ENTITY_TRANSLUCENT_CULL.apply(location); } - public static RenderType entityTranslucentCull(ResourceLocation location) { - return (RenderType)ENTITY_TRANSLUCENT_CULL.apply(location); - } - public static RenderType entityTranslucent(ResourceLocation location, boolean outline) { return (RenderType)ENTITY_TRANSLUCENT.apply(location, outline); } @@ -882,7 +1015,7 @@ public abstract class RenderType extends RenderStateShard { } public static RenderType eyes(ResourceLocation location) { - return (RenderType)EYES.apply(location, ADDITIVE_TRANSPARENCY); + return (RenderType)EYES.apply(location, TRANSLUCENT_TRANSPARENCY); } public static RenderType breezeEyes(ResourceLocation location) { @@ -899,7 +1032,7 @@ public abstract class RenderType extends RenderStateShard { true, RenderType.CompositeState.builder() .setShaderState(RENDERTYPE_BREEZE_WIND_SHADER) - .setTextureState(new RenderStateShard.TextureStateShard(location, false, false)) + .setTextureState(new RenderStateShard.TextureStateShard(location, TriState.FALSE, false)) .setTexturingState(new RenderStateShard.OffsetTexturingStateShard(u, v)) .setTransparencyState(TRANSLUCENT_TRANSPARENCY) .setCullState(NO_CULL) @@ -919,7 +1052,7 @@ public abstract class RenderType extends RenderStateShard { true, RenderType.CompositeState.builder() .setShaderState(RENDERTYPE_ENERGY_SWIRL_SHADER) - .setTextureState(new RenderStateShard.TextureStateShard(location, false, false)) + .setTextureState(new RenderStateShard.TextureStateShard(location, TriState.FALSE, false)) .setTexturingState(new RenderStateShard.OffsetTexturingStateShard(u, v)) .setTransparencyState(ADDITIVE_TRANSPARENCY) .setCullState(NO_CULL) @@ -957,10 +1090,6 @@ public abstract class RenderType extends RenderStateShard { return ENTITY_GLINT; } - public static RenderType entityGlintDirect() { - return ENTITY_GLINT_DIRECT; - } - public static RenderType crumbling(ResourceLocation location) { return (RenderType)CRUMBLING.apply(location); } @@ -1031,25 +1160,28 @@ public abstract class RenderType extends RenderStateShard { return END_GATEWAY; } - private static RenderType.CompositeRenderType createClouds(boolean color) { + private static RenderType.CompositeRenderType createClouds(boolean bl, boolean bl2) { return create( "clouds", - DefaultVertexFormat.POSITION_TEX_COLOR_NORMAL, + DefaultVertexFormat.POSITION_COLOR, VertexFormat.Mode.QUADS, 786432, false, false, RenderType.CompositeState.builder() .setShaderState(RENDERTYPE_CLOUDS_SHADER) - .setTextureState(new RenderStateShard.TextureStateShard(LevelRenderer.CLOUDS_LOCATION, false, false)) .setTransparencyState(TRANSLUCENT_TRANSPARENCY) - .setCullState(NO_CULL) - .setWriteMaskState(color ? DEPTH_WRITE : COLOR_DEPTH_WRITE) + .setCullState(bl2 ? CULL : NO_CULL) + .setWriteMaskState(bl ? DEPTH_WRITE : COLOR_DEPTH_WRITE) .setOutputState(CLOUDS_TARGET) .createCompositeState(true) ); } + public static RenderType flatClouds() { + return FLAT_CLOUDS; + } + public static RenderType clouds() { return CLOUDS; } @@ -1062,6 +1194,10 @@ public abstract class RenderType extends RenderStateShard { return LINES; } + public static RenderType secondaryBlockOutline() { + return SECONDARY_BLOCK_OUTLINE; + } + public static RenderType lineStrip() { return LINE_STRIP; } @@ -1078,6 +1214,10 @@ public abstract class RenderType extends RenderStateShard { return DEBUG_QUADS; } + public static RenderType debugTriangleFan() { + return DEBUG_TRIANGLE_FAN; + } + public static RenderType debugStructureQuads() { return DEBUG_STRUCTURE_QUADS; } @@ -1094,6 +1234,18 @@ public abstract class RenderType extends RenderStateShard { return GUI_OVERLAY; } + public static RenderType guiTexturedOverlay(ResourceLocation resourceLocation) { + return (RenderType)GUI_TEXTURED_OVERLAY.apply(resourceLocation); + } + + public static RenderType guiOpaqueTexturedBackground(ResourceLocation resourceLocation) { + return (RenderType)GUI_OPAQUE_TEXTURED_BACKGROUND.apply(resourceLocation); + } + + public static RenderType guiNauseaOverlay() { + return GUI_NAUSEA_OVERLAY; + } + public static RenderType guiTextHighlight() { return GUI_TEXT_HIGHLIGHT; } @@ -1102,6 +1254,22 @@ public abstract class RenderType extends RenderStateShard { return GUI_GHOST_RECIPE_OVERLAY; } + public static RenderType guiTextured(ResourceLocation resourceLocation) { + return (RenderType)GUI_TEXTURED.apply(resourceLocation); + } + + public static RenderType vignette(ResourceLocation resourceLocation) { + return (RenderType)VIGNETTE.apply(resourceLocation); + } + + public static RenderType crosshair(ResourceLocation resourceLocation) { + return (RenderType)CROSSHAIR.apply(resourceLocation); + } + + public static RenderType mojangLogo() { + return MOJANG_LOGO; + } + public RenderType( String name, VertexFormat format, @@ -1187,7 +1355,7 @@ public abstract class RenderType extends RenderStateShard { 1536, RenderType.CompositeState.builder() .setShaderState(RENDERTYPE_OUTLINE_SHADER) - .setTextureState(new RenderStateShard.TextureStateShard(resourceLocation, false, false)) + .setTextureState(new RenderStateShard.TextureStateShard(resourceLocation, TriState.FALSE, false)) .setCullState(cullStateShard) .setDepthTestState(NO_DEPTH_TEST) .setOutputState(OUTLINE_TARGET) @@ -1307,116 +1475,8 @@ public abstract class RenderType extends RenderStateShard { return "CompositeState[" + this.states + ", outlineProperty=" + this.outlineProperty + "]"; } - public static RenderType.CompositeState.CompositeStateBuilder builder() { - return new RenderType.CompositeState.CompositeStateBuilder(); - } - - @Environment(EnvType.CLIENT) - public static class CompositeStateBuilder { - private RenderStateShard.EmptyTextureStateShard textureState = RenderStateShard.NO_TEXTURE; - private RenderStateShard.ShaderStateShard shaderState = RenderStateShard.NO_SHADER; - private RenderStateShard.TransparencyStateShard transparencyState = RenderStateShard.NO_TRANSPARENCY; - private RenderStateShard.DepthTestStateShard depthTestState = RenderStateShard.LEQUAL_DEPTH_TEST; - private RenderStateShard.CullStateShard cullState = RenderStateShard.CULL; - private RenderStateShard.LightmapStateShard lightmapState = RenderStateShard.NO_LIGHTMAP; - private RenderStateShard.OverlayStateShard overlayState = RenderStateShard.NO_OVERLAY; - private RenderStateShard.LayeringStateShard layeringState = RenderStateShard.NO_LAYERING; - private RenderStateShard.OutputStateShard outputState = RenderStateShard.MAIN_TARGET; - private RenderStateShard.TexturingStateShard texturingState = RenderStateShard.DEFAULT_TEXTURING; - private RenderStateShard.WriteMaskStateShard writeMaskState = RenderStateShard.COLOR_DEPTH_WRITE; - private RenderStateShard.LineStateShard lineState = RenderStateShard.DEFAULT_LINE; - private RenderStateShard.ColorLogicStateShard colorLogicState = RenderStateShard.NO_COLOR_LOGIC; - - CompositeStateBuilder() { - } - - public RenderType.CompositeState.CompositeStateBuilder setTextureState(RenderStateShard.EmptyTextureStateShard textureState) { - this.textureState = textureState; - return this; - } - - public RenderType.CompositeState.CompositeStateBuilder setShaderState(RenderStateShard.ShaderStateShard shaderState) { - this.shaderState = shaderState; - return this; - } - - public RenderType.CompositeState.CompositeStateBuilder setTransparencyState(RenderStateShard.TransparencyStateShard transparencyState) { - this.transparencyState = transparencyState; - return this; - } - - public RenderType.CompositeState.CompositeStateBuilder setDepthTestState(RenderStateShard.DepthTestStateShard depthTestState) { - this.depthTestState = depthTestState; - return this; - } - - public RenderType.CompositeState.CompositeStateBuilder setCullState(RenderStateShard.CullStateShard cullState) { - this.cullState = cullState; - return this; - } - - public RenderType.CompositeState.CompositeStateBuilder setLightmapState(RenderStateShard.LightmapStateShard lightmapState) { - this.lightmapState = lightmapState; - return this; - } - - public RenderType.CompositeState.CompositeStateBuilder setOverlayState(RenderStateShard.OverlayStateShard overlayState) { - this.overlayState = overlayState; - return this; - } - - public RenderType.CompositeState.CompositeStateBuilder setLayeringState(RenderStateShard.LayeringStateShard layerState) { - this.layeringState = layerState; - return this; - } - - public RenderType.CompositeState.CompositeStateBuilder setOutputState(RenderStateShard.OutputStateShard outputState) { - this.outputState = outputState; - return this; - } - - public RenderType.CompositeState.CompositeStateBuilder setTexturingState(RenderStateShard.TexturingStateShard texturingState) { - this.texturingState = texturingState; - return this; - } - - public RenderType.CompositeState.CompositeStateBuilder setWriteMaskState(RenderStateShard.WriteMaskStateShard writeMaskState) { - this.writeMaskState = writeMaskState; - return this; - } - - public RenderType.CompositeState.CompositeStateBuilder setLineState(RenderStateShard.LineStateShard lineState) { - this.lineState = lineState; - return this; - } - - public RenderType.CompositeState.CompositeStateBuilder setColorLogicState(RenderStateShard.ColorLogicStateShard colorLogicState) { - this.colorLogicState = colorLogicState; - return this; - } - - public RenderType.CompositeState createCompositeState(boolean outline) { - return this.createCompositeState(outline ? RenderType.OutlineProperty.AFFECTS_OUTLINE : RenderType.OutlineProperty.NONE); - } - - public RenderType.CompositeState createCompositeState(RenderType.OutlineProperty outlineState) { - return new RenderType.CompositeState( - this.textureState, - this.shaderState, - this.transparencyState, - this.depthTestState, - this.cullState, - this.lightmapState, - this.overlayState, - this.layeringState, - this.outputState, - this.texturingState, - this.writeMaskState, - this.lineState, - this.colorLogicState, - outlineState - ); - } + public static CompositeStateBuilder builder() { + return new CompositeStateBuilder(); } } diff --git a/net/minecraft/client/renderer/ScreenEffectRenderer.java b/net/minecraft/client/renderer/ScreenEffectRenderer.java index fa670923..fd1de629 100644 --- a/net/minecraft/client/renderer/ScreenEffectRenderer.java +++ b/net/minecraft/client/renderer/ScreenEffectRenderer.java @@ -67,7 +67,7 @@ public class ScreenEffectRenderer { private static void renderTex(TextureAtlasSprite texture, PoseStack poseStack) { RenderSystem.setShaderTexture(0, texture.atlasLocation()); - RenderSystem.setShader(GameRenderer::getPositionTexColorShader); + RenderSystem.setShader(CoreShaders.POSITION_TEX_COLOR); float f = 0.1F; float g = -1.0F; float h = 1.0F; @@ -88,7 +88,7 @@ public class ScreenEffectRenderer { } private static void renderWater(Minecraft minecraft, PoseStack poseStack) { - RenderSystem.setShader(GameRenderer::getPositionTexShader); + RenderSystem.setShader(CoreShaders.POSITION_TEX); RenderSystem.setShaderTexture(0, UNDERWATER_LOCATION); BlockPos blockPos = BlockPos.containing(minecraft.player.getX(), minecraft.player.getEyeY(), minecraft.player.getZ()); float f = LightTexture.getBrightness(minecraft.player.level().dimensionType(), minecraft.player.level().getMaxLocalRawBrightness(blockPos)); @@ -114,7 +114,7 @@ public class ScreenEffectRenderer { } private static void renderFire(Minecraft minecraft, PoseStack poseStack) { - RenderSystem.setShader(GameRenderer::getPositionTexColorShader); + RenderSystem.setShader(CoreShaders.POSITION_TEX_COLOR); RenderSystem.depthFunc(519); RenderSystem.depthMask(false); RenderSystem.enableBlend(); diff --git a/net/minecraft/client/renderer/SectionOcclusionGraph.java b/net/minecraft/client/renderer/SectionOcclusionGraph.java index 2c4669f5..0e920aaf 100644 --- a/net/minecraft/client/renderer/SectionOcclusionGraph.java +++ b/net/minecraft/client/renderer/SectionOcclusionGraph.java @@ -11,10 +11,10 @@ import it.unimi.dsi.fastutil.longs.LongOpenHashSet; import it.unimi.dsi.fastutil.longs.LongSet; import java.util.ArrayList; import java.util.Comparator; -import java.util.LinkedHashSet; import java.util.List; import java.util.Queue; import java.util.concurrent.BlockingQueue; +import java.util.concurrent.CompletableFuture; import java.util.concurrent.Future; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.atomic.AtomicBoolean; @@ -65,7 +65,7 @@ public class SectionOcclusionGraph { this.viewArea = viewArea; if (viewArea != null) { - this.currentGraph.set(new SectionOcclusionGraph.GraphState(viewArea.sections.length)); + this.currentGraph.set(new SectionOcclusionGraph.GraphState(viewArea)); this.invalidate(); } else { this.currentGraph.set(null); @@ -76,12 +76,16 @@ public class SectionOcclusionGraph { this.needsFullUpdate = true; } - public void addSectionsInFrustum(Frustum frustum, List sections) { - for (SectionOcclusionGraph.Node node : ((SectionOcclusionGraph.GraphState)this.currentGraph.get()).storage().renderSections) { - if (frustum.isVisible(node.section.getBoundingBox())) { - sections.add(node.section); + public void addSectionsInFrustum(Frustum frustum, List list, List list2) { + ((SectionOcclusionGraph.GraphState)this.currentGraph.get()).storage().sectionTree.visitNodes((node, bl, i, bl2) -> { + SectionRenderDispatcher.RenderSection renderSection = node.getSection(); + if (renderSection != null) { + list.add(renderSection); + if (bl2) { + list2.add(renderSection); + } } - } + }, frustum, 32); } public boolean consumeFrustumUpdate() { @@ -100,43 +104,44 @@ public class SectionOcclusionGraph { } } - public void onSectionCompiled(SectionRenderDispatcher.RenderSection section) { + public void schedulePropagationFrom(SectionRenderDispatcher.RenderSection renderSection) { SectionOcclusionGraph.GraphEvents graphEvents = (SectionOcclusionGraph.GraphEvents)this.nextGraphEvents.get(); if (graphEvents != null) { - graphEvents.sectionsToPropagateFrom.add(section); + graphEvents.sectionsToPropagateFrom.add(renderSection); } SectionOcclusionGraph.GraphEvents graphEvents2 = ((SectionOcclusionGraph.GraphState)this.currentGraph.get()).events; if (graphEvents2 != graphEvents) { - graphEvents2.sectionsToPropagateFrom.add(section); + graphEvents2.sectionsToPropagateFrom.add(renderSection); } } - public void update(boolean smartCull, Camera camera, Frustum frustum, List sections) { + public void update(boolean bl, Camera camera, Frustum frustum, List list, LongOpenHashSet longOpenHashSet) { Vec3 vec3 = camera.getPosition(); if (this.needsFullUpdate && (this.fullUpdateTask == null || this.fullUpdateTask.isDone())) { - this.scheduleFullUpdate(smartCull, camera, vec3); + this.scheduleFullUpdate(bl, camera, vec3, longOpenHashSet); } - this.runPartialUpdate(smartCull, frustum, sections, vec3); + this.runPartialUpdate(bl, frustum, list, vec3, longOpenHashSet); } - private void scheduleFullUpdate(boolean smartCull, Camera camera, Vec3 cameraPosition) { + private void scheduleFullUpdate(boolean bl, Camera camera, Vec3 vec3, LongOpenHashSet longOpenHashSet) { this.needsFullUpdate = false; - this.fullUpdateTask = Util.backgroundExecutor().submit(() -> { - SectionOcclusionGraph.GraphState graphState = new SectionOcclusionGraph.GraphState(this.viewArea.sections.length); + LongOpenHashSet longOpenHashSet2 = longOpenHashSet.clone(); + this.fullUpdateTask = CompletableFuture.runAsync(() -> { + SectionOcclusionGraph.GraphState graphState = new SectionOcclusionGraph.GraphState(this.viewArea); this.nextGraphEvents.set(graphState.events); Queue queue = Queues.newArrayDeque(); this.initializeQueueForFullUpdate(camera, queue); queue.forEach(node -> graphState.storage.sectionToNodeMap.put(node.section, node)); - this.runUpdates(graphState.storage, cameraPosition, queue, smartCull, renderSection -> {}); + this.runUpdates(graphState.storage, vec3, queue, bl, renderSection -> {}, longOpenHashSet2); this.currentGraph.set(graphState); this.nextGraphEvents.set(null); this.needsFrustumUpdate.set(true); - }); + }, Util.backgroundExecutor()); } - private void runPartialUpdate(boolean smartCull, Frustum frustum, List sections, Vec3 cameraPosition) { + private void runPartialUpdate(boolean bl, Frustum frustum, List list, Vec3 vec3, LongOpenHashSet longOpenHashSet) { SectionOcclusionGraph.GraphState graphState = (SectionOcclusionGraph.GraphState)this.currentGraph.get(); this.queueSectionsWithNewNeighbors(graphState); if (!graphState.events.sectionsToPropagateFrom.isEmpty()) { @@ -153,10 +158,10 @@ public class SectionOcclusionGraph { Frustum frustum2 = LevelRenderer.offsetFrustum(frustum); Consumer consumer = renderSection -> { if (frustum2.isVisible(renderSection.getBoundingBox())) { - sections.add(renderSection); + this.needsFrustumUpdate.set(true); } }; - this.runUpdates(graphState.storage, cameraPosition, queue, smartCull, consumer); + this.runUpdates(graphState.storage, vec3, queue, bl, consumer, longOpenHashSet); } } @@ -183,36 +188,35 @@ public class SectionOcclusionGraph { } private void initializeQueueForFullUpdate(Camera camera, Queue nodeQueue) { - int i = 16; - Vec3 vec3 = camera.getPosition(); BlockPos blockPos = camera.getBlockPosition(); - SectionRenderDispatcher.RenderSection renderSection = this.viewArea.getRenderSectionAt(blockPos); + long l = SectionPos.asLong(blockPos); + int i = SectionPos.y(l); + SectionRenderDispatcher.RenderSection renderSection = this.viewArea.getRenderSection(l); if (renderSection == null) { LevelHeightAccessor levelHeightAccessor = this.viewArea.getLevelHeightAccessor(); - boolean bl = blockPos.getY() > levelHeightAccessor.getMinBuildHeight(); - int j = bl ? levelHeightAccessor.getMaxBuildHeight() - 8 : levelHeightAccessor.getMinBuildHeight() + 8; - int k = Mth.floor(vec3.x / 16.0) * 16; - int l = Mth.floor(vec3.z / 16.0) * 16; - int m = this.viewArea.getViewDistance(); + boolean bl = i < levelHeightAccessor.getMinSectionY(); + int j = bl ? levelHeightAccessor.getMinSectionY() : levelHeightAccessor.getMaxSectionY(); + int k = this.viewArea.getViewDistance(); List list = Lists.newArrayList(); + int m = SectionPos.x(l); + int n = SectionPos.z(l); - for (int n = -m; n <= m; n++) { - for (int o = -m; o <= m; o++) { - SectionRenderDispatcher.RenderSection renderSection2 = this.viewArea - .getRenderSectionAt(new BlockPos(k + SectionPos.sectionToBlockCoord(n, 8), j, l + SectionPos.sectionToBlockCoord(o, 8))); - if (renderSection2 != null && this.isInViewDistance(blockPos, renderSection2.getOrigin())) { - Direction direction = bl ? Direction.DOWN : Direction.UP; + for (int o = -k; o <= k; o++) { + for (int p = -k; p <= k; p++) { + SectionRenderDispatcher.RenderSection renderSection2 = this.viewArea.getRenderSection(SectionPos.asLong(o + m, j, p + n)); + if (renderSection2 != null && this.isInViewDistance(l, renderSection2.getSectionNode())) { + Direction direction = bl ? Direction.UP : Direction.DOWN; SectionOcclusionGraph.Node node = new SectionOcclusionGraph.Node(renderSection2, direction, 0); node.setDirections(node.directions, direction); - if (n > 0) { + if (o > 0) { node.setDirections(node.directions, Direction.EAST); - } else if (n < 0) { + } else if (o < 0) { node.setDirections(node.directions, Direction.WEST); } - if (o > 0) { + if (p > 0) { node.setDirections(node.directions, Direction.SOUTH); - } else if (o < 0) { + } else if (p < 0) { node.setDirections(node.directions, Direction.NORTH); } @@ -230,71 +234,77 @@ public class SectionOcclusionGraph { private void runUpdates( SectionOcclusionGraph.GraphStorage graphStorage, - Vec3 cameraPosition, - Queue nodeQueue, - boolean smartCull, - Consumer sections + Vec3 vec3, + Queue queue, + boolean bl, + Consumer consumer, + LongOpenHashSet longOpenHashSet ) { int i = 16; - BlockPos blockPos = new BlockPos(Mth.floor(cameraPosition.x / 16.0) * 16, Mth.floor(cameraPosition.y / 16.0) * 16, Mth.floor(cameraPosition.z / 16.0) * 16); + BlockPos blockPos = new BlockPos(Mth.floor(vec3.x / 16.0) * 16, Mth.floor(vec3.y / 16.0) * 16, Mth.floor(vec3.z / 16.0) * 16); + long l = SectionPos.asLong(blockPos); BlockPos blockPos2 = blockPos.offset(8, 8, 8); - while (!nodeQueue.isEmpty()) { - SectionOcclusionGraph.Node node = (SectionOcclusionGraph.Node)nodeQueue.poll(); + while (!queue.isEmpty()) { + SectionOcclusionGraph.Node node = (SectionOcclusionGraph.Node)queue.poll(); SectionRenderDispatcher.RenderSection renderSection = node.section; - if (graphStorage.renderSections.add(node)) { - sections.accept(node.section); + if (!longOpenHashSet.contains(node.section.getSectionNode())) { + if (graphStorage.sectionTree.add(node.section)) { + consumer.accept(node.section); + } + } else { + node.section.compiled.compareAndSet(SectionRenderDispatcher.CompiledSection.UNCOMPILED, SectionRenderDispatcher.CompiledSection.EMPTY); } - boolean bl = Math.abs(renderSection.getOrigin().getX() - blockPos.getX()) > 60 + boolean bl2 = Math.abs(renderSection.getOrigin().getX() - blockPos.getX()) > 60 || Math.abs(renderSection.getOrigin().getY() - blockPos.getY()) > 60 || Math.abs(renderSection.getOrigin().getZ() - blockPos.getZ()) > 60; for (Direction direction : DIRECTIONS) { - SectionRenderDispatcher.RenderSection renderSection2 = this.getRelativeFrom(blockPos, renderSection, direction); - if (renderSection2 != null && (!smartCull || !node.hasDirection(direction.getOpposite()))) { - if (smartCull && node.hasSourceDirections()) { + SectionRenderDispatcher.RenderSection renderSection2 = this.getRelativeFrom(l, renderSection, direction); + if (renderSection2 != null && (!bl || !node.hasDirection(direction.getOpposite()))) { + if (bl && node.hasSourceDirections()) { SectionRenderDispatcher.CompiledSection compiledSection = renderSection.getCompiled(); - boolean bl2 = false; + boolean bl3 = false; for (int j = 0; j < DIRECTIONS.length; j++) { if (node.hasSourceDirection(j) && compiledSection.facesCanSeeEachother(DIRECTIONS[j].getOpposite(), direction)) { - bl2 = true; + bl3 = true; break; } } - if (!bl2) { + if (!bl3) { continue; } } - if (smartCull && bl) { + if (bl && bl2) { BlockPos blockPos3 = renderSection2.getOrigin(); BlockPos blockPos4 = blockPos3.offset( (direction.getAxis() == Direction.Axis.X ? blockPos2.getX() <= blockPos3.getX() : blockPos2.getX() >= blockPos3.getX()) ? 0 : 16, (direction.getAxis() == Direction.Axis.Y ? blockPos2.getY() <= blockPos3.getY() : blockPos2.getY() >= blockPos3.getY()) ? 0 : 16, (direction.getAxis() == Direction.Axis.Z ? blockPos2.getZ() <= blockPos3.getZ() : blockPos2.getZ() >= blockPos3.getZ()) ? 0 : 16 ); - Vec3 vec3 = new Vec3(blockPos4.getX(), blockPos4.getY(), blockPos4.getZ()); - Vec3 vec32 = cameraPosition.subtract(vec3).normalize().scale(CEILED_SECTION_DIAGONAL); - boolean bl3 = true; + Vec3 vec32 = new Vec3(blockPos4.getX(), blockPos4.getY(), blockPos4.getZ()); + Vec3 vec33 = vec3.subtract(vec32).normalize().scale(CEILED_SECTION_DIAGONAL); + boolean bl4 = true; - while (cameraPosition.subtract(vec3).lengthSqr() > 3600.0) { - vec3 = vec3.add(vec32); + while (vec3.subtract(vec32).lengthSqr() > 3600.0) { + vec32 = vec32.add(vec33); LevelHeightAccessor levelHeightAccessor = this.viewArea.getLevelHeightAccessor(); - if (vec3.y > levelHeightAccessor.getMaxBuildHeight() || vec3.y < levelHeightAccessor.getMinBuildHeight()) { + if (vec32.y > levelHeightAccessor.getMaxY() || vec32.y < levelHeightAccessor.getMinY()) { break; } - SectionRenderDispatcher.RenderSection renderSection3 = this.viewArea.getRenderSectionAt(BlockPos.containing(vec3.x, vec3.y, vec3.z)); + SectionRenderDispatcher.RenderSection renderSection3 = this.viewArea.getRenderSectionAt(BlockPos.containing(vec32.x, vec32.y, vec32.z)); if (renderSection3 == null || graphStorage.sectionToNodeMap.get(renderSection3) == null) { - bl3 = false; + bl4 = false; break; } } - if (!bl3) { + if (!bl4) { continue; } } @@ -306,13 +316,13 @@ public class SectionOcclusionGraph { SectionOcclusionGraph.Node node3 = new SectionOcclusionGraph.Node(renderSection2, direction, node.step + 1); node3.setDirections(node.directions, direction); if (renderSection2.hasAllNeighbors()) { - nodeQueue.add(node3); + queue.add(node3); graphStorage.sectionToNodeMap.put(renderSection2, node3); - } else if (this.isInViewDistance(blockPos, renderSection2.getOrigin())) { + } else if (this.isInViewDistance(l, renderSection2.getSectionNode())) { graphStorage.sectionToNodeMap.put(renderSection2, node3); graphStorage.chunksWaitingForNeighbors .computeIfAbsent( - ChunkPos.asLong(renderSection2.getOrigin()), (Long2ObjectFunction>)(l -> new ArrayList()) + ChunkPos.asLong(renderSection2.getOrigin()), (Long2ObjectFunction>)(lx -> new ArrayList()) ) .add(renderSection2); } @@ -322,34 +332,34 @@ public class SectionOcclusionGraph { } } - private boolean isInViewDistance(BlockPos pos, BlockPos origin) { - int i = SectionPos.blockToSectionCoord(pos.getX()); - int j = SectionPos.blockToSectionCoord(pos.getZ()); - int k = SectionPos.blockToSectionCoord(origin.getX()); - int l = SectionPos.blockToSectionCoord(origin.getZ()); - return ChunkTrackingView.isInViewDistance(i, j, this.viewArea.getViewDistance(), k, l); + private boolean isInViewDistance(long l, long m) { + return ChunkTrackingView.isInViewDistance(SectionPos.x(l), SectionPos.z(l), this.viewArea.getViewDistance(), SectionPos.x(m), SectionPos.z(m)); } @Nullable - private SectionRenderDispatcher.RenderSection getRelativeFrom(BlockPos pos, SectionRenderDispatcher.RenderSection section, Direction direction) { - BlockPos blockPos = section.getRelativeOrigin(direction); - if (!this.isInViewDistance(pos, blockPos)) { + private SectionRenderDispatcher.RenderSection getRelativeFrom(long l, SectionRenderDispatcher.RenderSection renderSection, Direction direction) { + long m = renderSection.getNeighborSectionNode(direction); + if (!this.isInViewDistance(l, m)) { return null; } else { - return Mth.abs(pos.getY() - blockPos.getY()) > this.viewArea.getViewDistance() * 16 ? null : this.viewArea.getRenderSectionAt(blockPos); + return Mth.abs(SectionPos.y(l) - SectionPos.y(m)) > this.viewArea.getViewDistance() ? null : this.viewArea.getRenderSection(m); } } @Nullable @VisibleForDebug - protected SectionOcclusionGraph.Node getNode(SectionRenderDispatcher.RenderSection section) { + public SectionOcclusionGraph.Node getNode(SectionRenderDispatcher.RenderSection section) { return ((SectionOcclusionGraph.GraphState)this.currentGraph.get()).storage.sectionToNodeMap.get(section); } + public Octree getOctree() { + return ((SectionOcclusionGraph.GraphState)this.currentGraph.get()).storage.sectionTree; + } + @Environment(EnvType.CLIENT) record GraphEvents(LongSet chunksWhichReceivedNeighbors, BlockingQueue sectionsToPropagateFrom) { - public GraphEvents() { + GraphEvents() { this(new LongOpenHashSet(), new LinkedBlockingQueue()); } } @@ -357,33 +367,33 @@ public class SectionOcclusionGraph { @Environment(EnvType.CLIENT) record GraphState(SectionOcclusionGraph.GraphStorage storage, SectionOcclusionGraph.GraphEvents events) { - public GraphState(int size) { - this(new SectionOcclusionGraph.GraphStorage(size), new SectionOcclusionGraph.GraphEvents()); + GraphState(ViewArea viewArea) { + this(new SectionOcclusionGraph.GraphStorage(viewArea), new SectionOcclusionGraph.GraphEvents()); } } @Environment(EnvType.CLIENT) static class GraphStorage { public final SectionOcclusionGraph.SectionToNodeMap sectionToNodeMap; - public final LinkedHashSet renderSections; + public final Octree sectionTree; public final Long2ObjectMap> chunksWaitingForNeighbors; - public GraphStorage(int size) { - this.sectionToNodeMap = new SectionOcclusionGraph.SectionToNodeMap(size); - this.renderSections = new LinkedHashSet(size); + public GraphStorage(ViewArea viewArea) { + this.sectionToNodeMap = new SectionOcclusionGraph.SectionToNodeMap(viewArea.sections.length); + this.sectionTree = new Octree(viewArea.getCameraSectionPos(), viewArea.getViewDistance(), viewArea.sectionGridSizeY, viewArea.level.getMinY()); this.chunksWaitingForNeighbors = new Long2ObjectOpenHashMap<>(); } } @Environment(EnvType.CLIENT) @VisibleForDebug - protected static class Node { + public static class Node { @VisibleForDebug protected final SectionRenderDispatcher.RenderSection section; private byte sourceDirections; byte directions; @VisibleForDebug - protected final int step; + public final int step; Node(SectionRenderDispatcher.RenderSection section, @Nullable Direction sourceDirection, int step) { this.section = section; @@ -407,7 +417,7 @@ public class SectionOcclusionGraph { } @VisibleForDebug - protected boolean hasSourceDirection(int direction) { + public boolean hasSourceDirection(int direction) { return (this.sourceDirections & 1 << direction) > 0; } @@ -416,11 +426,11 @@ public class SectionOcclusionGraph { } public int hashCode() { - return this.section.getOrigin().hashCode(); + return Long.hashCode(this.section.getSectionNode()); } public boolean equals(Object object) { - return !(object instanceof SectionOcclusionGraph.Node node) ? false : this.section.getOrigin().equals(node.section.getOrigin()); + return !(object instanceof SectionOcclusionGraph.Node node) ? false : this.section.getSectionNode() == node.section.getSectionNode(); } } diff --git a/net/minecraft/client/renderer/ShaderDefines.java b/net/minecraft/client/renderer/ShaderDefines.java new file mode 100644 index 00000000..d39ffe7b --- /dev/null +++ b/net/minecraft/client/renderer/ShaderDefines.java @@ -0,0 +1,100 @@ +package net.minecraft.client.renderer; + +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import com.mojang.serialization.Codec; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.Map.Entry; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; + +@Environment(EnvType.CLIENT) +public record ShaderDefines(Map values, Set flags) { + public static final ShaderDefines EMPTY = new ShaderDefines(Map.of(), Set.of()); + public static final Codec CODEC = RecordCodecBuilder.create( + instance -> instance.group( + Codec.unboundedMap(Codec.STRING, Codec.STRING).optionalFieldOf("values", Map.of()).forGetter(ShaderDefines::values), + Codec.STRING.listOf().xmap(Set::copyOf, List::copyOf).optionalFieldOf("flags", Set.of()).forGetter(ShaderDefines::flags) + ) + .apply(instance, ShaderDefines::new) + ); + + public static ShaderDefines.Builder builder() { + return new ShaderDefines.Builder(); + } + + public ShaderDefines withOverrides(ShaderDefines shaderDefines) { + if (this.isEmpty()) { + return shaderDefines; + } else if (shaderDefines.isEmpty()) { + return this; + } else { + ImmutableMap.Builder builder = ImmutableMap.builderWithExpectedSize(this.values.size() + shaderDefines.values.size()); + builder.putAll(this.values); + builder.putAll(shaderDefines.values); + ImmutableSet.Builder builder2 = ImmutableSet.builderWithExpectedSize(this.flags.size() + shaderDefines.flags.size()); + builder2.addAll(this.flags); + builder2.addAll(shaderDefines.flags); + return new ShaderDefines(builder.buildKeepingLast(), builder2.build()); + } + } + + public String asSourceDirectives() { + StringBuilder stringBuilder = new StringBuilder(); + + for (Entry entry : this.values.entrySet()) { + String string = (String)entry.getKey(); + String string2 = (String)entry.getValue(); + stringBuilder.append("#define ").append(string).append(" ").append(string2).append('\n'); + } + + for (String string3 : this.flags) { + stringBuilder.append("#define ").append(string3).append('\n'); + } + + return stringBuilder.toString(); + } + + public boolean isEmpty() { + return this.values.isEmpty() && this.flags.isEmpty(); + } + + @Environment(EnvType.CLIENT) + public static class Builder { + private final ImmutableMap.Builder values = ImmutableMap.builder(); + private final ImmutableSet.Builder flags = ImmutableSet.builder(); + + Builder() { + } + + public ShaderDefines.Builder define(String string, String string2) { + if (string2.isBlank()) { + throw new IllegalArgumentException("Cannot define empty string"); + } else { + this.values.put(string, escapeNewLines(string2)); + return this; + } + } + + private static String escapeNewLines(String string) { + return string.replaceAll("\n", "\\\\\n"); + } + + public ShaderDefines.Builder define(String string, float f) { + this.values.put(string, String.valueOf(f)); + return this; + } + + public ShaderDefines.Builder define(String string) { + this.flags.add(string); + return this; + } + + public ShaderDefines build() { + return new ShaderDefines(this.values.build(), this.flags.build()); + } + } +} diff --git a/net/minecraft/client/renderer/ShaderInstance.java b/net/minecraft/client/renderer/ShaderInstance.java deleted file mode 100644 index 0eadb54c..00000000 --- a/net/minecraft/client/renderer/ShaderInstance.java +++ /dev/null @@ -1,528 +0,0 @@ -package net.minecraft.client.renderer; - -import com.google.common.collect.Lists; -import com.google.common.collect.Maps; -import com.google.common.collect.Sets; -import com.google.gson.JsonArray; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.mojang.blaze3d.pipeline.RenderTarget; -import com.mojang.blaze3d.platform.GlStateManager; -import com.mojang.blaze3d.platform.Window; -import com.mojang.blaze3d.preprocessor.GlslPreprocessor; -import com.mojang.blaze3d.shaders.AbstractUniform; -import com.mojang.blaze3d.shaders.Program; -import com.mojang.blaze3d.shaders.ProgramManager; -import com.mojang.blaze3d.shaders.Shader; -import com.mojang.blaze3d.shaders.Uniform; -import com.mojang.blaze3d.systems.RenderSystem; -import com.mojang.blaze3d.vertex.VertexFormat; -import com.mojang.logging.LogUtils; -import it.unimi.dsi.fastutil.ints.IntArrayList; -import it.unimi.dsi.fastutil.ints.IntList; -import java.io.IOException; -import java.io.InputStream; -import java.io.Reader; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.Set; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.FileUtil; -import net.minecraft.client.renderer.texture.AbstractTexture; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.server.ChainedJsonException; -import net.minecraft.server.packs.resources.Resource; -import net.minecraft.server.packs.resources.ResourceProvider; -import net.minecraft.util.GsonHelper; -import org.apache.commons.io.IOUtils; -import org.jetbrains.annotations.Nullable; -import org.joml.Matrix4f; -import org.slf4j.Logger; - -@Environment(EnvType.CLIENT) -public class ShaderInstance implements Shader, AutoCloseable { - public static final String SHADER_PATH = "shaders"; - private static final String SHADER_CORE_PATH = "shaders/core/"; - private static final String SHADER_INCLUDE_PATH = "shaders/include/"; - static final Logger LOGGER = LogUtils.getLogger(); - private static final AbstractUniform DUMMY_UNIFORM = new AbstractUniform(); - private static final boolean ALWAYS_REAPPLY = true; - private static ShaderInstance lastAppliedShader; - private static int lastProgramId = -1; - private final Map samplerMap = Maps.newHashMap(); - private final List samplerNames = Lists.newArrayList(); - private final List samplerLocations = Lists.newArrayList(); - private final List uniforms = Lists.newArrayList(); - private final List uniformLocations = Lists.newArrayList(); - private final Map uniformMap = Maps.newHashMap(); - private final int programId; - private final String name; - private boolean dirty; - private final Program vertexProgram; - private final Program fragmentProgram; - private final VertexFormat vertexFormat; - @Nullable - public final Uniform MODEL_VIEW_MATRIX; - @Nullable - public final Uniform PROJECTION_MATRIX; - @Nullable - public final Uniform TEXTURE_MATRIX; - @Nullable - public final Uniform SCREEN_SIZE; - @Nullable - public final Uniform COLOR_MODULATOR; - @Nullable - public final Uniform LIGHT0_DIRECTION; - @Nullable - public final Uniform LIGHT1_DIRECTION; - @Nullable - public final Uniform GLINT_ALPHA; - @Nullable - public final Uniform FOG_START; - @Nullable - public final Uniform FOG_END; - @Nullable - public final Uniform FOG_COLOR; - @Nullable - public final Uniform FOG_SHAPE; - @Nullable - public final Uniform LINE_WIDTH; - @Nullable - public final Uniform GAME_TIME; - @Nullable - public final Uniform CHUNK_OFFSET; - - public ShaderInstance(ResourceProvider resourceProvider, String name, VertexFormat vertexFormat) throws IOException { - this.name = name; - this.vertexFormat = vertexFormat; - ResourceLocation resourceLocation = ResourceLocation.withDefaultNamespace("shaders/core/" + name + ".json"); - - try { - Reader reader = resourceProvider.openAsReader(resourceLocation); - - try { - JsonObject jsonObject = GsonHelper.parse(reader); - String string = GsonHelper.getAsString(jsonObject, "vertex"); - String string2 = GsonHelper.getAsString(jsonObject, "fragment"); - JsonArray jsonArray = GsonHelper.getAsJsonArray(jsonObject, "samplers", null); - if (jsonArray != null) { - int i = 0; - - for (JsonElement jsonElement : jsonArray) { - try { - this.parseSamplerNode(jsonElement); - } catch (Exception var18) { - ChainedJsonException chainedJsonException = ChainedJsonException.forException(var18); - chainedJsonException.prependJsonKey("samplers[" + i + "]"); - throw chainedJsonException; - } - - i++; - } - } - - JsonArray jsonArray2 = GsonHelper.getAsJsonArray(jsonObject, "uniforms", null); - if (jsonArray2 != null) { - int j = 0; - - for (JsonElement jsonElement2 : jsonArray2) { - try { - this.parseUniformNode(jsonElement2); - } catch (Exception var17) { - ChainedJsonException chainedJsonException2 = ChainedJsonException.forException(var17); - chainedJsonException2.prependJsonKey("uniforms[" + j + "]"); - throw chainedJsonException2; - } - - j++; - } - } - - this.vertexProgram = getOrCreate(resourceProvider, Program.Type.VERTEX, string); - this.fragmentProgram = getOrCreate(resourceProvider, Program.Type.FRAGMENT, string2); - this.programId = ProgramManager.createProgram(); - int j = 0; - - for (String string3 : vertexFormat.getElementAttributeNames()) { - Uniform.glBindAttribLocation(this.programId, j, string3); - j++; - } - - ProgramManager.linkShader(this); - this.updateLocations(); - } catch (Throwable var19) { - if (reader != null) { - try { - reader.close(); - } catch (Throwable var16) { - var19.addSuppressed(var16); - } - } - - throw var19; - } - - if (reader != null) { - reader.close(); - } - } catch (Exception var20) { - ChainedJsonException chainedJsonException3 = ChainedJsonException.forException(var20); - chainedJsonException3.setFilenameAndFlush(resourceLocation.getPath()); - throw chainedJsonException3; - } - - this.markDirty(); - this.MODEL_VIEW_MATRIX = this.getUniform("ModelViewMat"); - this.PROJECTION_MATRIX = this.getUniform("ProjMat"); - this.TEXTURE_MATRIX = this.getUniform("TextureMat"); - this.SCREEN_SIZE = this.getUniform("ScreenSize"); - this.COLOR_MODULATOR = this.getUniform("ColorModulator"); - this.LIGHT0_DIRECTION = this.getUniform("Light0_Direction"); - this.LIGHT1_DIRECTION = this.getUniform("Light1_Direction"); - this.GLINT_ALPHA = this.getUniform("GlintAlpha"); - this.FOG_START = this.getUniform("FogStart"); - this.FOG_END = this.getUniform("FogEnd"); - this.FOG_COLOR = this.getUniform("FogColor"); - this.FOG_SHAPE = this.getUniform("FogShape"); - this.LINE_WIDTH = this.getUniform("LineWidth"); - this.GAME_TIME = this.getUniform("GameTime"); - this.CHUNK_OFFSET = this.getUniform("ChunkOffset"); - } - - private static Program getOrCreate(ResourceProvider resourceProvider, Program.Type programType, String name) throws IOException { - Program program = (Program)programType.getPrograms().get(name); - Program program2; - if (program == null) { - String string = "shaders/core/" + name + programType.getExtension(); - Resource resource = resourceProvider.getResourceOrThrow(ResourceLocation.withDefaultNamespace(string)); - InputStream inputStream = resource.open(); - - try { - final String string2 = FileUtil.getFullResourcePath(string); - program2 = Program.compileShader(programType, name, inputStream, resource.sourcePackId(), new GlslPreprocessor() { - private final Set importedPaths = Sets.newHashSet(); - - @Override - public String applyImport(boolean useFullPath, String directory) { - directory = FileUtil.normalizeResourcePath((useFullPath ? string2 : "shaders/include/") + directory); - if (!this.importedPaths.add(directory)) { - return null; - } else { - ResourceLocation resourceLocation = ResourceLocation.parse(directory); - - try { - Reader reader = resourceProvider.openAsReader(resourceLocation); - - String var5; - try { - var5 = IOUtils.toString(reader); - } catch (Throwable var8) { - if (reader != null) { - try { - reader.close(); - } catch (Throwable var7) { - var8.addSuppressed(var7); - } - } - - throw var8; - } - - if (reader != null) { - reader.close(); - } - - return var5; - } catch (IOException var9) { - ShaderInstance.LOGGER.error("Could not open GLSL import {}: {}", directory, var9.getMessage()); - return "#error " + var9.getMessage(); - } - } - } - }); - } catch (Throwable var11) { - if (inputStream != null) { - try { - inputStream.close(); - } catch (Throwable var10) { - var11.addSuppressed(var10); - } - } - - throw var11; - } - - if (inputStream != null) { - inputStream.close(); - } - } else { - program2 = program; - } - - return program2; - } - - public void close() { - for (Uniform uniform : this.uniforms) { - uniform.close(); - } - - ProgramManager.releaseProgram(this); - } - - public void clear() { - RenderSystem.assertOnRenderThread(); - ProgramManager.glUseProgram(0); - lastProgramId = -1; - lastAppliedShader = null; - int i = GlStateManager._getActiveTexture(); - - for (int j = 0; j < this.samplerLocations.size(); j++) { - if (this.samplerMap.get(this.samplerNames.get(j)) != null) { - GlStateManager._activeTexture(33984 + j); - GlStateManager._bindTexture(0); - } - } - - GlStateManager._activeTexture(i); - } - - public void apply() { - RenderSystem.assertOnRenderThread(); - this.dirty = false; - lastAppliedShader = this; - if (this.programId != lastProgramId) { - ProgramManager.glUseProgram(this.programId); - lastProgramId = this.programId; - } - - int i = GlStateManager._getActiveTexture(); - - for (int j = 0; j < this.samplerLocations.size(); j++) { - String string = (String)this.samplerNames.get(j); - if (this.samplerMap.get(string) != null) { - int k = Uniform.glGetUniformLocation(this.programId, string); - Uniform.uploadInteger(k, j); - RenderSystem.activeTexture(33984 + j); - Object object = this.samplerMap.get(string); - int l = -1; - if (object instanceof RenderTarget) { - l = ((RenderTarget)object).getColorTextureId(); - } else if (object instanceof AbstractTexture) { - l = ((AbstractTexture)object).getId(); - } else if (object instanceof Integer) { - l = (Integer)object; - } - - if (l != -1) { - RenderSystem.bindTexture(l); - } - } - } - - GlStateManager._activeTexture(i); - - for (Uniform uniform : this.uniforms) { - uniform.upload(); - } - } - - @Override - public void markDirty() { - this.dirty = true; - } - - @Nullable - public Uniform getUniform(String name) { - RenderSystem.assertOnRenderThread(); - return (Uniform)this.uniformMap.get(name); - } - - public AbstractUniform safeGetUniform(String name) { - Uniform uniform = this.getUniform(name); - return (AbstractUniform)(uniform == null ? DUMMY_UNIFORM : uniform); - } - - private void updateLocations() { - RenderSystem.assertOnRenderThread(); - IntList intList = new IntArrayList(); - - for (int i = 0; i < this.samplerNames.size(); i++) { - String string = (String)this.samplerNames.get(i); - int j = Uniform.glGetUniformLocation(this.programId, string); - if (j == -1) { - LOGGER.warn("Shader {} could not find sampler named {} in the specified shader program.", this.name, string); - this.samplerMap.remove(string); - intList.add(i); - } else { - this.samplerLocations.add(j); - } - } - - for (int ix = intList.size() - 1; ix >= 0; ix--) { - int k = intList.getInt(ix); - this.samplerNames.remove(k); - } - - for (Uniform uniform : this.uniforms) { - String string2 = uniform.getName(); - int l = Uniform.glGetUniformLocation(this.programId, string2); - if (l == -1) { - LOGGER.warn("Shader {} could not find uniform named {} in the specified shader program.", this.name, string2); - } else { - this.uniformLocations.add(l); - uniform.setLocation(l); - this.uniformMap.put(string2, uniform); - } - } - } - - private void parseSamplerNode(JsonElement json) { - JsonObject jsonObject = GsonHelper.convertToJsonObject(json, "sampler"); - String string = GsonHelper.getAsString(jsonObject, "name"); - if (!GsonHelper.isStringValue(jsonObject, "file")) { - this.samplerMap.put(string, null); - this.samplerNames.add(string); - } else { - this.samplerNames.add(string); - } - } - - public void setSampler(String name, Object textureId) { - this.samplerMap.put(name, textureId); - this.markDirty(); - } - - private void parseUniformNode(JsonElement json) throws ChainedJsonException { - JsonObject jsonObject = GsonHelper.convertToJsonObject(json, "uniform"); - String string = GsonHelper.getAsString(jsonObject, "name"); - int i = Uniform.getTypeFromString(GsonHelper.getAsString(jsonObject, "type")); - int j = GsonHelper.getAsInt(jsonObject, "count"); - float[] fs = new float[Math.max(j, 16)]; - JsonArray jsonArray = GsonHelper.getAsJsonArray(jsonObject, "values"); - if (jsonArray.size() != j && jsonArray.size() > 1) { - throw new ChainedJsonException("Invalid amount of values specified (expected " + j + ", found " + jsonArray.size() + ")"); - } else { - int k = 0; - - for (JsonElement jsonElement : jsonArray) { - try { - fs[k] = GsonHelper.convertToFloat(jsonElement, "value"); - } catch (Exception var13) { - ChainedJsonException chainedJsonException = ChainedJsonException.forException(var13); - chainedJsonException.prependJsonKey("values[" + k + "]"); - throw chainedJsonException; - } - - k++; - } - - if (j > 1 && jsonArray.size() == 1) { - while (k < j) { - fs[k] = fs[0]; - k++; - } - } - - int l = j > 1 && j <= 4 && i < 8 ? j - 1 : 0; - Uniform uniform = new Uniform(string, i + l, j, this); - if (i <= 3) { - uniform.setSafe((int)fs[0], (int)fs[1], (int)fs[2], (int)fs[3]); - } else if (i <= 7) { - uniform.setSafe(fs[0], fs[1], fs[2], fs[3]); - } else { - uniform.set(Arrays.copyOfRange(fs, 0, j)); - } - - this.uniforms.add(uniform); - } - } - - @Override - public Program getVertexProgram() { - return this.vertexProgram; - } - - @Override - public Program getFragmentProgram() { - return this.fragmentProgram; - } - - @Override - public void attachToProgram() { - this.fragmentProgram.attachToShader(this); - this.vertexProgram.attachToShader(this); - } - - public VertexFormat getVertexFormat() { - return this.vertexFormat; - } - - public String getName() { - return this.name; - } - - @Override - public int getId() { - return this.programId; - } - - public void setDefaultUniforms(VertexFormat.Mode mode, Matrix4f frustumMatrix, Matrix4f projectionMatrix, Window window) { - for (int i = 0; i < 12; i++) { - int j = RenderSystem.getShaderTexture(i); - this.setSampler("Sampler" + i, j); - } - - if (this.MODEL_VIEW_MATRIX != null) { - this.MODEL_VIEW_MATRIX.set(frustumMatrix); - } - - if (this.PROJECTION_MATRIX != null) { - this.PROJECTION_MATRIX.set(projectionMatrix); - } - - if (this.COLOR_MODULATOR != null) { - this.COLOR_MODULATOR.set(RenderSystem.getShaderColor()); - } - - if (this.GLINT_ALPHA != null) { - this.GLINT_ALPHA.set(RenderSystem.getShaderGlintAlpha()); - } - - if (this.FOG_START != null) { - this.FOG_START.set(RenderSystem.getShaderFogStart()); - } - - if (this.FOG_END != null) { - this.FOG_END.set(RenderSystem.getShaderFogEnd()); - } - - if (this.FOG_COLOR != null) { - this.FOG_COLOR.set(RenderSystem.getShaderFogColor()); - } - - if (this.FOG_SHAPE != null) { - this.FOG_SHAPE.set(RenderSystem.getShaderFogShape().getIndex()); - } - - if (this.TEXTURE_MATRIX != null) { - this.TEXTURE_MATRIX.set(RenderSystem.getTextureMatrix()); - } - - if (this.GAME_TIME != null) { - this.GAME_TIME.set(RenderSystem.getShaderGameTime()); - } - - if (this.SCREEN_SIZE != null) { - this.SCREEN_SIZE.set((float)window.getWidth(), (float)window.getHeight()); - } - - if (this.LINE_WIDTH != null && (mode == VertexFormat.Mode.LINES || mode == VertexFormat.Mode.LINE_STRIP)) { - this.LINE_WIDTH.set(RenderSystem.getShaderLineWidth()); - } - - RenderSystem.setupShaderLights(this); - } -} diff --git a/net/minecraft/client/renderer/ShaderManager.java b/net/minecraft/client/renderer/ShaderManager.java new file mode 100644 index 00000000..36683c02 --- /dev/null +++ b/net/minecraft/client/renderer/ShaderManager.java @@ -0,0 +1,497 @@ +package net.minecraft.client.renderer; + +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableMap.Builder; +import com.google.gson.JsonElement; +import com.google.gson.JsonParseException; +import com.google.gson.JsonParser; +import com.google.gson.JsonSyntaxException; +import com.mojang.blaze3d.preprocessor.GlslPreprocessor; +import com.mojang.blaze3d.shaders.CompiledShader; +import com.mojang.blaze3d.systems.RenderSystem; +import com.mojang.logging.LogUtils; +import com.mojang.serialization.JsonOps; +import it.unimi.dsi.fastutil.objects.ObjectArraySet; +import java.io.IOException; +import java.io.Reader; +import java.util.HashMap; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import java.util.Map.Entry; +import java.util.function.Consumer; +import java.util.function.UnaryOperator; +import java.util.stream.Collectors; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.FileUtil; +import net.minecraft.ResourceLocationException; +import net.minecraft.client.renderer.texture.TextureManager; +import net.minecraft.resources.FileToIdConverter; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.packs.resources.Resource; +import net.minecraft.server.packs.resources.ResourceManager; +import net.minecraft.server.packs.resources.ResourceProvider; +import net.minecraft.server.packs.resources.SimplePreparableReloadListener; +import net.minecraft.util.profiling.ProfilerFiller; +import org.apache.commons.io.IOUtils; +import org.jetbrains.annotations.Nullable; +import org.slf4j.Logger; + +@Environment(EnvType.CLIENT) +public class ShaderManager extends SimplePreparableReloadListener implements AutoCloseable { + static final Logger LOGGER = LogUtils.getLogger(); + public static final String SHADER_PATH = "shaders"; + public static final String SHADER_INCLUDE_PATH = "shaders/include/"; + private static final FileToIdConverter PROGRAM_ID_CONVERTER = FileToIdConverter.json("shaders"); + private static final FileToIdConverter POST_CHAIN_ID_CONVERTER = FileToIdConverter.json("post_effect"); + public static final int MAX_LOG_LENGTH = 32768; + final TextureManager textureManager; + private final Consumer recoveryHandler; + private ShaderManager.CompilationCache compilationCache = new ShaderManager.CompilationCache(ShaderManager.Configs.EMPTY); + + public ShaderManager(TextureManager textureManager, Consumer consumer) { + this.textureManager = textureManager; + this.recoveryHandler = consumer; + } + + protected ShaderManager.Configs prepare(ResourceManager resourceManager, ProfilerFiller profilerFiller) { + Builder builder = ImmutableMap.builder(); + Builder builder2 = ImmutableMap.builder(); + Map map = resourceManager.listResources("shaders", resourceLocation -> isProgram(resourceLocation) || isShader(resourceLocation)); + + for (Entry entry : map.entrySet()) { + ResourceLocation resourceLocation = (ResourceLocation)entry.getKey(); + CompiledShader.Type type = CompiledShader.Type.byLocation(resourceLocation); + if (type != null) { + loadShader(resourceLocation, (Resource)entry.getValue(), type, map, builder2); + } else if (isProgram(resourceLocation)) { + loadProgram(resourceLocation, (Resource)entry.getValue(), builder); + } + } + + Builder builder3 = ImmutableMap.builder(); + + for (Entry entry2 : POST_CHAIN_ID_CONVERTER.listMatchingResources(resourceManager).entrySet()) { + loadPostChain((ResourceLocation)entry2.getKey(), (Resource)entry2.getValue(), builder3); + } + + return new ShaderManager.Configs(builder.build(), builder2.build(), builder3.build()); + } + + private static void loadShader( + ResourceLocation resourceLocation, + Resource resource, + CompiledShader.Type type, + Map map, + Builder builder + ) { + ResourceLocation resourceLocation2 = type.idConverter().fileToId(resourceLocation); + GlslPreprocessor glslPreprocessor = createPreprocessor(map, resourceLocation); + + try { + Reader reader = resource.openAsReader(); + + try { + String string = IOUtils.toString(reader); + builder.put(new ShaderManager.ShaderSourceKey(resourceLocation2, type), String.join("", glslPreprocessor.process(string))); + } catch (Throwable var11) { + if (reader != null) { + try { + reader.close(); + } catch (Throwable var10) { + var11.addSuppressed(var10); + } + } + + throw var11; + } + + if (reader != null) { + reader.close(); + } + } catch (IOException var12) { + LOGGER.error("Failed to load shader source at {}", resourceLocation, var12); + } + } + + private static GlslPreprocessor createPreprocessor(Map map, ResourceLocation resourceLocation) { + final ResourceLocation resourceLocation2 = resourceLocation.withPath(FileUtil::getFullResourcePath); + return new GlslPreprocessor() { + private final Set importedLocations = new ObjectArraySet<>(); + + @Override + public String applyImport(boolean useFullPath, String directory) { + ResourceLocation resourceLocationx; + try { + if (useFullPath) { + resourceLocationx = resourceLocation2.withPath((UnaryOperator)(string2 -> FileUtil.normalizeResourcePath(string2 + directory))); + } else { + resourceLocationx = ResourceLocation.parse(directory).withPrefix("shaders/include/"); + } + } catch (ResourceLocationException var8) { + ShaderManager.LOGGER.error("Malformed GLSL import {}: {}", directory, var8.getMessage()); + return "#error " + var8.getMessage(); + } + + if (!this.importedLocations.add(resourceLocationx)) { + return null; + } else { + try { + Reader reader = ((Resource)map.get(resourceLocationx)).openAsReader(); + + String var5; + try { + var5 = IOUtils.toString(reader); + } catch (Throwable var9) { + if (reader != null) { + try { + reader.close(); + } catch (Throwable var7) { + var9.addSuppressed(var7); + } + } + + throw var9; + } + + if (reader != null) { + reader.close(); + } + + return var5; + } catch (IOException var10) { + ShaderManager.LOGGER.error("Could not open GLSL import {}: {}", resourceLocationx, var10.getMessage()); + return "#error " + var10.getMessage(); + } + } + } + }; + } + + private static void loadProgram(ResourceLocation resourceLocation, Resource resource, Builder builder) { + ResourceLocation resourceLocation2 = PROGRAM_ID_CONVERTER.fileToId(resourceLocation); + + try { + Reader reader = resource.openAsReader(); + + try { + JsonElement jsonElement = JsonParser.parseReader(reader); + ShaderProgramConfig shaderProgramConfig = ShaderProgramConfig.CODEC.parse(JsonOps.INSTANCE, jsonElement).getOrThrow(JsonSyntaxException::new); + builder.put(resourceLocation2, shaderProgramConfig); + } catch (Throwable var8) { + if (reader != null) { + try { + reader.close(); + } catch (Throwable var7) { + var8.addSuppressed(var7); + } + } + + throw var8; + } + + if (reader != null) { + reader.close(); + } + } catch (JsonParseException | IOException var9) { + LOGGER.error("Failed to parse shader config at {}", resourceLocation, var9); + } + } + + private static void loadPostChain(ResourceLocation resourceLocation, Resource resource, Builder builder) { + ResourceLocation resourceLocation2 = POST_CHAIN_ID_CONVERTER.fileToId(resourceLocation); + + try { + Reader reader = resource.openAsReader(); + + try { + JsonElement jsonElement = JsonParser.parseReader(reader); + builder.put(resourceLocation2, PostChainConfig.CODEC.parse(JsonOps.INSTANCE, jsonElement).getOrThrow(JsonSyntaxException::new)); + } catch (Throwable var8) { + if (reader != null) { + try { + reader.close(); + } catch (Throwable var7) { + var8.addSuppressed(var7); + } + } + + throw var8; + } + + if (reader != null) { + reader.close(); + } + } catch (JsonParseException | IOException var9) { + LOGGER.error("Failed to parse post chain at {}", resourceLocation, var9); + } + } + + private static boolean isProgram(ResourceLocation resourceLocation) { + return resourceLocation.getPath().endsWith(".json"); + } + + private static boolean isShader(ResourceLocation resourceLocation) { + return CompiledShader.Type.byLocation(resourceLocation) != null || resourceLocation.getPath().endsWith(".glsl"); + } + + protected void apply(ShaderManager.Configs configs, ResourceManager resourceManager, ProfilerFiller profilerFiller) { + ShaderManager.CompilationCache compilationCache = new ShaderManager.CompilationCache(configs); + Map map = new HashMap(); + + for (ShaderProgram shaderProgram : CoreShaders.getProgramsToPreload()) { + try { + compilationCache.programs.put(shaderProgram, Optional.of(compilationCache.compileProgram(shaderProgram))); + } catch (ShaderManager.CompilationException var9) { + map.put(shaderProgram, var9); + } + } + + if (!map.isEmpty()) { + compilationCache.close(); + throw new RuntimeException( + "Failed to load required shader programs:\n" + + (String)map.entrySet() + .stream() + .map(entry -> " - " + entry.getKey() + ": " + ((ShaderManager.CompilationException)entry.getValue()).getMessage()) + .collect(Collectors.joining("\n")) + ); + } else { + this.compilationCache.close(); + this.compilationCache = compilationCache; + } + } + + @Override + public String getName() { + return "Shader Loader"; + } + + public void preloadForStartup(ResourceProvider resourceProvider, ShaderProgram... shaderPrograms) throws IOException, ShaderManager.CompilationException { + for (ShaderProgram shaderProgram : shaderPrograms) { + Resource resource = resourceProvider.getResourceOrThrow(PROGRAM_ID_CONVERTER.idToFile(shaderProgram.configId())); + Reader reader = resource.openAsReader(); + + try { + JsonElement jsonElement = JsonParser.parseReader(reader); + ShaderProgramConfig shaderProgramConfig = ShaderProgramConfig.CODEC.parse(JsonOps.INSTANCE, jsonElement).getOrThrow(JsonSyntaxException::new); + ShaderDefines shaderDefines = shaderProgramConfig.defines().withOverrides(shaderProgram.defines()); + CompiledShader compiledShader = this.preloadShader(resourceProvider, shaderProgramConfig.vertex(), CompiledShader.Type.VERTEX, shaderDefines); + CompiledShader compiledShader2 = this.preloadShader(resourceProvider, shaderProgramConfig.fragment(), CompiledShader.Type.FRAGMENT, shaderDefines); + CompiledShaderProgram compiledShaderProgram = linkProgram(shaderProgram, shaderProgramConfig, compiledShader, compiledShader2); + this.compilationCache.programs.put(shaderProgram, Optional.of(compiledShaderProgram)); + } catch (Throwable var16) { + if (reader != null) { + try { + reader.close(); + } catch (Throwable var15) { + var16.addSuppressed(var15); + } + } + + throw var16; + } + + if (reader != null) { + reader.close(); + } + } + } + + private CompiledShader preloadShader( + ResourceProvider resourceProvider, ResourceLocation resourceLocation, CompiledShader.Type type, ShaderDefines shaderDefines + ) throws IOException, ShaderManager.CompilationException { + ResourceLocation resourceLocation2 = type.idConverter().idToFile(resourceLocation); + Reader reader = resourceProvider.getResourceOrThrow(resourceLocation2).openAsReader(); + + CompiledShader var10; + try { + String string = IOUtils.toString(reader); + String string2 = GlslPreprocessor.injectDefines(string, shaderDefines); + CompiledShader compiledShader = CompiledShader.compile(resourceLocation, type, string2); + this.compilationCache.shaders.put(new ShaderManager.ShaderCompilationKey(resourceLocation, type, shaderDefines), compiledShader); + var10 = compiledShader; + } catch (Throwable var12) { + if (reader != null) { + try { + reader.close(); + } catch (Throwable var11) { + var12.addSuppressed(var11); + } + } + + throw var12; + } + + if (reader != null) { + reader.close(); + } + + return var10; + } + + @Nullable + public CompiledShaderProgram getProgram(ShaderProgram shaderProgram) { + try { + return this.compilationCache.getOrCompileProgram(shaderProgram); + } catch (ShaderManager.CompilationException var3) { + LOGGER.error("Failed to load shader program: {}", shaderProgram, var3); + this.compilationCache.programs.put(shaderProgram, Optional.empty()); + this.recoveryHandler.accept(var3); + return null; + } + } + + public CompiledShaderProgram getProgramForLoading(ShaderProgram shaderProgram) throws ShaderManager.CompilationException { + CompiledShaderProgram compiledShaderProgram = this.compilationCache.getOrCompileProgram(shaderProgram); + if (compiledShaderProgram == null) { + throw new ShaderManager.CompilationException("Shader '" + shaderProgram + "' could not be found"); + } else { + return compiledShaderProgram; + } + } + + static CompiledShaderProgram linkProgram( + ShaderProgram shaderProgram, ShaderProgramConfig shaderProgramConfig, CompiledShader compiledShader, CompiledShader compiledShader2 + ) throws ShaderManager.CompilationException { + CompiledShaderProgram compiledShaderProgram = CompiledShaderProgram.link(compiledShader, compiledShader2, shaderProgram.vertexFormat()); + compiledShaderProgram.setupUniforms(shaderProgramConfig.uniforms(), shaderProgramConfig.samplers()); + return compiledShaderProgram; + } + + @Nullable + public PostChain getPostChain(ResourceLocation resourceLocation, Set set) { + try { + return this.compilationCache.getOrLoadPostChain(resourceLocation, set); + } catch (ShaderManager.CompilationException var4) { + LOGGER.error("Failed to load post chain: {}", resourceLocation, var4); + this.compilationCache.postChains.put(resourceLocation, Optional.empty()); + this.recoveryHandler.accept(var4); + return null; + } + } + + public void close() { + this.compilationCache.close(); + } + + @Environment(EnvType.CLIENT) + class CompilationCache implements AutoCloseable { + private final ShaderManager.Configs configs; + final Map> programs = new HashMap(); + final Map shaders = new HashMap(); + final Map> postChains = new HashMap(); + + CompilationCache(final ShaderManager.Configs configs) { + this.configs = configs; + } + + @Nullable + public CompiledShaderProgram getOrCompileProgram(ShaderProgram shaderProgram) throws ShaderManager.CompilationException { + Optional optional = (Optional)this.programs.get(shaderProgram); + if (optional != null) { + return (CompiledShaderProgram)optional.orElse(null); + } else { + CompiledShaderProgram compiledShaderProgram = this.compileProgram(shaderProgram); + this.programs.put(shaderProgram, Optional.of(compiledShaderProgram)); + return compiledShaderProgram; + } + } + + CompiledShaderProgram compileProgram(ShaderProgram shaderProgram) throws ShaderManager.CompilationException { + ShaderProgramConfig shaderProgramConfig = (ShaderProgramConfig)this.configs.programs.get(shaderProgram.configId()); + if (shaderProgramConfig == null) { + throw new ShaderManager.CompilationException("Could not find program with id: " + shaderProgram.configId()); + } else { + ShaderDefines shaderDefines = shaderProgramConfig.defines().withOverrides(shaderProgram.defines()); + CompiledShader compiledShader = this.getOrCompileShader(shaderProgramConfig.vertex(), CompiledShader.Type.VERTEX, shaderDefines); + CompiledShader compiledShader2 = this.getOrCompileShader(shaderProgramConfig.fragment(), CompiledShader.Type.FRAGMENT, shaderDefines); + return ShaderManager.linkProgram(shaderProgram, shaderProgramConfig, compiledShader, compiledShader2); + } + } + + private CompiledShader getOrCompileShader(ResourceLocation resourceLocation, CompiledShader.Type type, ShaderDefines shaderDefines) throws ShaderManager.CompilationException { + ShaderManager.ShaderCompilationKey shaderCompilationKey = new ShaderManager.ShaderCompilationKey(resourceLocation, type, shaderDefines); + CompiledShader compiledShader = (CompiledShader)this.shaders.get(shaderCompilationKey); + if (compiledShader == null) { + compiledShader = this.compileShader(shaderCompilationKey); + this.shaders.put(shaderCompilationKey, compiledShader); + } + + return compiledShader; + } + + private CompiledShader compileShader(ShaderManager.ShaderCompilationKey shaderCompilationKey) throws ShaderManager.CompilationException { + String string = (String)this.configs.shaderSources.get(new ShaderManager.ShaderSourceKey(shaderCompilationKey.id, shaderCompilationKey.type)); + if (string == null) { + throw new ShaderManager.CompilationException("Could not find shader: " + shaderCompilationKey); + } else { + String string2 = GlslPreprocessor.injectDefines(string, shaderCompilationKey.defines); + return CompiledShader.compile(shaderCompilationKey.id, shaderCompilationKey.type, string2); + } + } + + @Nullable + public PostChain getOrLoadPostChain(ResourceLocation resourceLocation, Set set) throws ShaderManager.CompilationException { + Optional optional = (Optional)this.postChains.get(resourceLocation); + if (optional != null) { + return (PostChain)optional.orElse(null); + } else { + PostChain postChain = this.loadPostChain(resourceLocation, set); + this.postChains.put(resourceLocation, Optional.of(postChain)); + return postChain; + } + } + + private PostChain loadPostChain(ResourceLocation resourceLocation, Set set) throws ShaderManager.CompilationException { + PostChainConfig postChainConfig = (PostChainConfig)this.configs.postChains.get(resourceLocation); + if (postChainConfig == null) { + throw new ShaderManager.CompilationException("Could not find post chain with id: " + resourceLocation); + } else { + return PostChain.load(postChainConfig, ShaderManager.this.textureManager, ShaderManager.this, set); + } + } + + public void close() { + RenderSystem.assertOnRenderThread(); + this.programs.values().forEach(optional -> optional.ifPresent(CompiledShaderProgram::close)); + this.shaders.values().forEach(CompiledShader::close); + this.programs.clear(); + this.shaders.clear(); + this.postChains.clear(); + } + } + + @Environment(EnvType.CLIENT) + public static class CompilationException extends Exception { + public CompilationException(String string) { + super(string); + } + } + + @Environment(EnvType.CLIENT) + public record Configs( + Map programs, + Map shaderSources, + Map postChains + ) { + public static final ShaderManager.Configs EMPTY = new ShaderManager.Configs(Map.of(), Map.of(), Map.of()); + } + + @Environment(EnvType.CLIENT) + record ShaderCompilationKey(ResourceLocation id, CompiledShader.Type type, ShaderDefines defines) { + + public String toString() { + String string = this.id + " (" + this.type + ")"; + return !this.defines.isEmpty() ? string + " with " + this.defines : string; + } + } + + @Environment(EnvType.CLIENT) + record ShaderSourceKey(ResourceLocation id, CompiledShader.Type type) { + public String toString() { + return this.id + " (" + this.type + ")"; + } + } +} diff --git a/net/minecraft/client/renderer/ShaderProgram.java b/net/minecraft/client/renderer/ShaderProgram.java new file mode 100644 index 00000000..41a74d0c --- /dev/null +++ b/net/minecraft/client/renderer/ShaderProgram.java @@ -0,0 +1,14 @@ +package net.minecraft.client.renderer; + +import com.mojang.blaze3d.vertex.VertexFormat; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.resources.ResourceLocation; + +@Environment(EnvType.CLIENT) +public record ShaderProgram(ResourceLocation configId, VertexFormat vertexFormat, ShaderDefines defines) { + public String toString() { + String string = this.configId + " (" + this.vertexFormat + ")"; + return !this.defines.isEmpty() ? string + " with " + this.defines : string; + } +} diff --git a/net/minecraft/client/renderer/ShaderProgramConfig.java b/net/minecraft/client/renderer/ShaderProgramConfig.java new file mode 100644 index 00000000..c95ed835 --- /dev/null +++ b/net/minecraft/client/renderer/ShaderProgramConfig.java @@ -0,0 +1,58 @@ +package net.minecraft.client.renderer; + +import com.mojang.serialization.Codec; +import com.mojang.serialization.DataResult; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import java.util.List; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.resources.ResourceLocation; + +@Environment(EnvType.CLIENT) +public record ShaderProgramConfig( + ResourceLocation vertex, + ResourceLocation fragment, + List samplers, + List uniforms, + ShaderDefines defines +) { + public static final Codec CODEC = RecordCodecBuilder.create( + instance -> instance.group( + ResourceLocation.CODEC.fieldOf("vertex").forGetter(ShaderProgramConfig::vertex), + ResourceLocation.CODEC.fieldOf("fragment").forGetter(ShaderProgramConfig::fragment), + ShaderProgramConfig.Sampler.CODEC.listOf().optionalFieldOf("samplers", List.of()).forGetter(ShaderProgramConfig::samplers), + ShaderProgramConfig.Uniform.CODEC.listOf().optionalFieldOf("uniforms", List.of()).forGetter(ShaderProgramConfig::uniforms), + ShaderDefines.CODEC.optionalFieldOf("defines", ShaderDefines.EMPTY).forGetter(ShaderProgramConfig::defines) + ) + .apply(instance, ShaderProgramConfig::new) + ); + + @Environment(EnvType.CLIENT) + public record Sampler(String name) { + public static final Codec CODEC = RecordCodecBuilder.create( + instance -> instance.group(Codec.STRING.fieldOf("name").forGetter(ShaderProgramConfig.Sampler::name)).apply(instance, ShaderProgramConfig.Sampler::new) + ); + } + + @Environment(EnvType.CLIENT) + public record Uniform(String name, String type, int count, List values) { + public static final Codec CODEC = RecordCodecBuilder.create( + instance -> instance.group( + Codec.STRING.fieldOf("name").forGetter(ShaderProgramConfig.Uniform::name), + Codec.STRING.fieldOf("type").forGetter(ShaderProgramConfig.Uniform::type), + Codec.INT.fieldOf("count").forGetter(ShaderProgramConfig.Uniform::count), + Codec.FLOAT.listOf().fieldOf("values").forGetter(ShaderProgramConfig.Uniform::values) + ) + .apply(instance, ShaderProgramConfig.Uniform::new) + ) + .validate(ShaderProgramConfig.Uniform::validate); + + private static DataResult validate(ShaderProgramConfig.Uniform uniform) { + int i = uniform.count; + int j = uniform.values.size(); + return j != i && j > 1 + ? DataResult.error(() -> "Invalid amount of uniform values specified (expected " + i + ", found " + j + ")") + : DataResult.success(uniform); + } + } +} diff --git a/net/minecraft/client/renderer/ShapeRenderer.java b/net/minecraft/client/renderer/ShapeRenderer.java new file mode 100644 index 00000000..a36638d8 --- /dev/null +++ b/net/minecraft/client/renderer/ShapeRenderer.java @@ -0,0 +1,189 @@ +package net.minecraft.client.renderer; + +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.core.Direction; +import net.minecraft.world.phys.AABB; +import net.minecraft.world.phys.Vec3; +import net.minecraft.world.phys.shapes.VoxelShape; +import org.joml.Matrix4f; +import org.joml.Vector3f; + +@Environment(EnvType.CLIENT) +public class ShapeRenderer { + public static void renderShape(PoseStack poseStack, VertexConsumer vertexConsumer, VoxelShape voxelShape, double d, double e, double f, int i) { + PoseStack.Pose pose = poseStack.last(); + voxelShape.forAllEdges((g, h, j, k, l, m) -> { + Vector3f vector3f = new Vector3f((float)(k - g), (float)(l - h), (float)(m - j)).normalize(); + vertexConsumer.addVertex(pose, (float)(g + d), (float)(h + e), (float)(j + f)).setColor(i).setNormal(pose, vector3f); + vertexConsumer.addVertex(pose, (float)(k + d), (float)(l + e), (float)(m + f)).setColor(i).setNormal(pose, vector3f); + }); + } + + public static void renderLineBox(PoseStack poseStack, VertexConsumer vertexConsumer, AABB aABB, float f, float g, float h, float i) { + renderLineBox(poseStack, vertexConsumer, aABB.minX, aABB.minY, aABB.minZ, aABB.maxX, aABB.maxY, aABB.maxZ, f, g, h, i, f, g, h); + } + + public static void renderLineBox( + PoseStack poseStack, VertexConsumer vertexConsumer, double d, double e, double f, double g, double h, double i, float j, float k, float l, float m + ) { + renderLineBox(poseStack, vertexConsumer, d, e, f, g, h, i, j, k, l, m, j, k, l); + } + + public static void renderLineBox( + PoseStack poseStack, + VertexConsumer vertexConsumer, + double d, + double e, + double f, + double g, + double h, + double i, + float j, + float k, + float l, + float m, + float n, + float o, + float p + ) { + PoseStack.Pose pose = poseStack.last(); + float q = (float)d; + float r = (float)e; + float s = (float)f; + float t = (float)g; + float u = (float)h; + float v = (float)i; + vertexConsumer.addVertex(pose, q, r, s).setColor(j, o, p, m).setNormal(pose, 1.0F, 0.0F, 0.0F); + vertexConsumer.addVertex(pose, t, r, s).setColor(j, o, p, m).setNormal(pose, 1.0F, 0.0F, 0.0F); + vertexConsumer.addVertex(pose, q, r, s).setColor(n, k, p, m).setNormal(pose, 0.0F, 1.0F, 0.0F); + vertexConsumer.addVertex(pose, q, u, s).setColor(n, k, p, m).setNormal(pose, 0.0F, 1.0F, 0.0F); + vertexConsumer.addVertex(pose, q, r, s).setColor(n, o, l, m).setNormal(pose, 0.0F, 0.0F, 1.0F); + vertexConsumer.addVertex(pose, q, r, v).setColor(n, o, l, m).setNormal(pose, 0.0F, 0.0F, 1.0F); + vertexConsumer.addVertex(pose, t, r, s).setColor(j, k, l, m).setNormal(pose, 0.0F, 1.0F, 0.0F); + vertexConsumer.addVertex(pose, t, u, s).setColor(j, k, l, m).setNormal(pose, 0.0F, 1.0F, 0.0F); + vertexConsumer.addVertex(pose, t, u, s).setColor(j, k, l, m).setNormal(pose, -1.0F, 0.0F, 0.0F); + vertexConsumer.addVertex(pose, q, u, s).setColor(j, k, l, m).setNormal(pose, -1.0F, 0.0F, 0.0F); + vertexConsumer.addVertex(pose, q, u, s).setColor(j, k, l, m).setNormal(pose, 0.0F, 0.0F, 1.0F); + vertexConsumer.addVertex(pose, q, u, v).setColor(j, k, l, m).setNormal(pose, 0.0F, 0.0F, 1.0F); + vertexConsumer.addVertex(pose, q, u, v).setColor(j, k, l, m).setNormal(pose, 0.0F, -1.0F, 0.0F); + vertexConsumer.addVertex(pose, q, r, v).setColor(j, k, l, m).setNormal(pose, 0.0F, -1.0F, 0.0F); + vertexConsumer.addVertex(pose, q, r, v).setColor(j, k, l, m).setNormal(pose, 1.0F, 0.0F, 0.0F); + vertexConsumer.addVertex(pose, t, r, v).setColor(j, k, l, m).setNormal(pose, 1.0F, 0.0F, 0.0F); + vertexConsumer.addVertex(pose, t, r, v).setColor(j, k, l, m).setNormal(pose, 0.0F, 0.0F, -1.0F); + vertexConsumer.addVertex(pose, t, r, s).setColor(j, k, l, m).setNormal(pose, 0.0F, 0.0F, -1.0F); + vertexConsumer.addVertex(pose, q, u, v).setColor(j, k, l, m).setNormal(pose, 1.0F, 0.0F, 0.0F); + vertexConsumer.addVertex(pose, t, u, v).setColor(j, k, l, m).setNormal(pose, 1.0F, 0.0F, 0.0F); + vertexConsumer.addVertex(pose, t, r, v).setColor(j, k, l, m).setNormal(pose, 0.0F, 1.0F, 0.0F); + vertexConsumer.addVertex(pose, t, u, v).setColor(j, k, l, m).setNormal(pose, 0.0F, 1.0F, 0.0F); + vertexConsumer.addVertex(pose, t, u, s).setColor(j, k, l, m).setNormal(pose, 0.0F, 0.0F, 1.0F); + vertexConsumer.addVertex(pose, t, u, v).setColor(j, k, l, m).setNormal(pose, 0.0F, 0.0F, 1.0F); + } + + public static void addChainedFilledBoxVertices( + PoseStack poseStack, VertexConsumer vertexConsumer, double d, double e, double f, double g, double h, double i, float j, float k, float l, float m + ) { + addChainedFilledBoxVertices(poseStack, vertexConsumer, (float)d, (float)e, (float)f, (float)g, (float)h, (float)i, j, k, l, m); + } + + public static void addChainedFilledBoxVertices( + PoseStack poseStack, VertexConsumer vertexConsumer, float f, float g, float h, float i, float j, float k, float l, float m, float n, float o + ) { + Matrix4f matrix4f = poseStack.last().pose(); + vertexConsumer.addVertex(matrix4f, f, g, h).setColor(l, m, n, o); + vertexConsumer.addVertex(matrix4f, f, g, h).setColor(l, m, n, o); + vertexConsumer.addVertex(matrix4f, f, g, h).setColor(l, m, n, o); + vertexConsumer.addVertex(matrix4f, f, g, k).setColor(l, m, n, o); + vertexConsumer.addVertex(matrix4f, f, j, h).setColor(l, m, n, o); + vertexConsumer.addVertex(matrix4f, f, j, k).setColor(l, m, n, o); + vertexConsumer.addVertex(matrix4f, f, j, k).setColor(l, m, n, o); + vertexConsumer.addVertex(matrix4f, f, g, k).setColor(l, m, n, o); + vertexConsumer.addVertex(matrix4f, i, j, k).setColor(l, m, n, o); + vertexConsumer.addVertex(matrix4f, i, g, k).setColor(l, m, n, o); + vertexConsumer.addVertex(matrix4f, i, g, k).setColor(l, m, n, o); + vertexConsumer.addVertex(matrix4f, i, g, h).setColor(l, m, n, o); + vertexConsumer.addVertex(matrix4f, i, j, k).setColor(l, m, n, o); + vertexConsumer.addVertex(matrix4f, i, j, h).setColor(l, m, n, o); + vertexConsumer.addVertex(matrix4f, i, j, h).setColor(l, m, n, o); + vertexConsumer.addVertex(matrix4f, i, g, h).setColor(l, m, n, o); + vertexConsumer.addVertex(matrix4f, f, j, h).setColor(l, m, n, o); + vertexConsumer.addVertex(matrix4f, f, g, h).setColor(l, m, n, o); + vertexConsumer.addVertex(matrix4f, f, g, h).setColor(l, m, n, o); + vertexConsumer.addVertex(matrix4f, i, g, h).setColor(l, m, n, o); + vertexConsumer.addVertex(matrix4f, f, g, k).setColor(l, m, n, o); + vertexConsumer.addVertex(matrix4f, i, g, k).setColor(l, m, n, o); + vertexConsumer.addVertex(matrix4f, i, g, k).setColor(l, m, n, o); + vertexConsumer.addVertex(matrix4f, f, j, h).setColor(l, m, n, o); + vertexConsumer.addVertex(matrix4f, f, j, h).setColor(l, m, n, o); + vertexConsumer.addVertex(matrix4f, f, j, k).setColor(l, m, n, o); + vertexConsumer.addVertex(matrix4f, i, j, h).setColor(l, m, n, o); + vertexConsumer.addVertex(matrix4f, i, j, k).setColor(l, m, n, o); + vertexConsumer.addVertex(matrix4f, i, j, k).setColor(l, m, n, o); + vertexConsumer.addVertex(matrix4f, i, j, k).setColor(l, m, n, o); + } + + public static void renderFace( + PoseStack poseStack, + VertexConsumer vertexConsumer, + Direction direction, + float f, + float g, + float h, + float i, + float j, + float k, + float l, + float m, + float n, + float o + ) { + Matrix4f matrix4f = poseStack.last().pose(); + switch (direction) { + case DOWN: + vertexConsumer.addVertex(matrix4f, f, g, h).setColor(l, m, n, o); + vertexConsumer.addVertex(matrix4f, i, g, h).setColor(l, m, n, o); + vertexConsumer.addVertex(matrix4f, i, g, k).setColor(l, m, n, o); + vertexConsumer.addVertex(matrix4f, f, g, k).setColor(l, m, n, o); + break; + case UP: + vertexConsumer.addVertex(matrix4f, f, j, h).setColor(l, m, n, o); + vertexConsumer.addVertex(matrix4f, f, j, k).setColor(l, m, n, o); + vertexConsumer.addVertex(matrix4f, i, j, k).setColor(l, m, n, o); + vertexConsumer.addVertex(matrix4f, i, j, h).setColor(l, m, n, o); + break; + case NORTH: + vertexConsumer.addVertex(matrix4f, f, g, h).setColor(l, m, n, o); + vertexConsumer.addVertex(matrix4f, f, j, h).setColor(l, m, n, o); + vertexConsumer.addVertex(matrix4f, i, j, h).setColor(l, m, n, o); + vertexConsumer.addVertex(matrix4f, i, g, h).setColor(l, m, n, o); + break; + case SOUTH: + vertexConsumer.addVertex(matrix4f, f, g, k).setColor(l, m, n, o); + vertexConsumer.addVertex(matrix4f, i, g, k).setColor(l, m, n, o); + vertexConsumer.addVertex(matrix4f, i, j, k).setColor(l, m, n, o); + vertexConsumer.addVertex(matrix4f, f, j, k).setColor(l, m, n, o); + break; + case WEST: + vertexConsumer.addVertex(matrix4f, f, g, h).setColor(l, m, n, o); + vertexConsumer.addVertex(matrix4f, f, g, k).setColor(l, m, n, o); + vertexConsumer.addVertex(matrix4f, f, j, k).setColor(l, m, n, o); + vertexConsumer.addVertex(matrix4f, f, j, h).setColor(l, m, n, o); + break; + case EAST: + vertexConsumer.addVertex(matrix4f, i, g, h).setColor(l, m, n, o); + vertexConsumer.addVertex(matrix4f, i, j, h).setColor(l, m, n, o); + vertexConsumer.addVertex(matrix4f, i, j, k).setColor(l, m, n, o); + vertexConsumer.addVertex(matrix4f, i, g, k).setColor(l, m, n, o); + } + } + + public static void renderVector(PoseStack poseStack, VertexConsumer vertexConsumer, Vector3f vector3f, Vec3 vec3, int i) { + PoseStack.Pose pose = poseStack.last(); + vertexConsumer.addVertex(pose, vector3f).setColor(i).setNormal(pose, (float)vec3.x, (float)vec3.y, (float)vec3.z); + vertexConsumer.addVertex(pose, (float)(vector3f.x() + vec3.x), (float)(vector3f.y() + vec3.y), (float)(vector3f.z() + vec3.z)) + .setColor(i) + .setNormal(pose, (float)vec3.x, (float)vec3.y, (float)vec3.z); + } +} diff --git a/net/minecraft/client/renderer/Sheets.java b/net/minecraft/client/renderer/Sheets.java index 2e7783fe..15a78cfe 100644 --- a/net/minecraft/client/renderer/Sheets.java +++ b/net/minecraft/client/renderer/Sheets.java @@ -48,7 +48,6 @@ public class Sheets { private static final RenderType SOLID_BLOCK_SHEET = RenderType.entitySolid(TextureAtlas.LOCATION_BLOCKS); private static final RenderType CUTOUT_BLOCK_SHEET = RenderType.entityCutout(TextureAtlas.LOCATION_BLOCKS); private static final RenderType TRANSLUCENT_ITEM_CULL_BLOCK_SHEET = RenderType.itemEntityTranslucentCull(TextureAtlas.LOCATION_BLOCKS); - private static final RenderType TRANSLUCENT_CULL_BLOCK_SHEET = RenderType.entityTranslucentCull(TextureAtlas.LOCATION_BLOCKS); public static final Material DEFAULT_SHULKER_TEXTURE_LOCATION = new Material(SHULKER_SHEET, ResourceLocation.withDefaultNamespace("entity/shulker/shulker")); public static final List SHULKER_TEXTURE_LOCATION = (List)Stream.of( "white", "orange", "magenta", "light_blue", "yellow", "lime", "pink", "gray", "light_gray", "cyan", "purple", "blue", "brown", "green", "red", "black" @@ -64,7 +63,7 @@ public class Sheets { private static final Map BANNER_MATERIALS = new HashMap(); private static final Map SHIELD_MATERIALS = new HashMap(); public static final Map, Material> DECORATED_POT_MATERIALS = (Map, Material>)BuiltInRegistries.DECORATED_POT_PATTERN - .holders() + .listElements() .collect(Collectors.toMap(Holder.Reference::key, reference -> createDecoratedPotMaterial(((DecoratedPotPattern)reference.value()).assetId()))); public static final Material DECORATED_POT_BASE = createDecoratedPotMaterial(ResourceLocation.withDefaultNamespace("decorated_pot_base")); public static final Material DECORATED_POT_SIDE = createDecoratedPotMaterial(ResourceLocation.withDefaultNamespace("decorated_pot_side")); @@ -127,10 +126,6 @@ public class Sheets { return TRANSLUCENT_ITEM_CULL_BLOCK_SHEET; } - public static RenderType translucentCullBlockSheet() { - return TRANSLUCENT_CULL_BLOCK_SHEET; - } - private static Material createSignMaterial(WoodType woodType) { return new Material(SIGN_SHEET, ResourceLocation.withDefaultNamespace("entity/signs/" + woodType.name())); } diff --git a/net/minecraft/client/renderer/SkyRenderer.java b/net/minecraft/client/renderer/SkyRenderer.java new file mode 100644 index 00000000..37986398 --- /dev/null +++ b/net/minecraft/client/renderer/SkyRenderer.java @@ -0,0 +1,283 @@ +package net.minecraft.client.renderer; + +import com.mojang.blaze3d.buffers.BufferUsage; +import com.mojang.blaze3d.systems.RenderSystem; +import com.mojang.blaze3d.vertex.BufferBuilder; +import com.mojang.blaze3d.vertex.BufferUploader; +import com.mojang.blaze3d.vertex.DefaultVertexFormat; +import com.mojang.blaze3d.vertex.MeshData; +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.Tesselator; +import com.mojang.blaze3d.vertex.VertexBuffer; +import com.mojang.blaze3d.vertex.VertexFormat; +import com.mojang.math.Axis; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.ARGB; +import net.minecraft.util.Mth; +import net.minecraft.util.RandomSource; +import org.joml.Matrix3f; +import org.joml.Matrix4f; +import org.joml.Matrix4fStack; +import org.joml.Vector3f; + +@Environment(EnvType.CLIENT) +public class SkyRenderer implements AutoCloseable { + private static final ResourceLocation SUN_LOCATION = ResourceLocation.withDefaultNamespace("textures/environment/sun.png"); + private static final ResourceLocation MOON_LOCATION = ResourceLocation.withDefaultNamespace("textures/environment/moon_phases.png"); + private static final ResourceLocation END_SKY_LOCATION = ResourceLocation.withDefaultNamespace("textures/environment/end_sky.png"); + private static final float SKY_DISC_RADIUS = 512.0F; + private final VertexBuffer starBuffer = this.createStarBuffer(); + private final VertexBuffer topSkyBuffer = this.createTopSkyBuffer(); + private final VertexBuffer bottomSkyBuffer = this.createBottomSkyBuffer(); + + private VertexBuffer createStarBuffer() { + VertexBuffer vertexBuffer = new VertexBuffer(BufferUsage.STATIC_WRITE); + vertexBuffer.bind(); + vertexBuffer.upload(this.drawStars(Tesselator.getInstance())); + VertexBuffer.unbind(); + return vertexBuffer; + } + + private VertexBuffer createTopSkyBuffer() { + VertexBuffer vertexBuffer = new VertexBuffer(BufferUsage.STATIC_WRITE); + vertexBuffer.bind(); + vertexBuffer.upload(this.buildSkyDisc(Tesselator.getInstance(), 16.0F)); + VertexBuffer.unbind(); + return vertexBuffer; + } + + private VertexBuffer createBottomSkyBuffer() { + VertexBuffer vertexBuffer = new VertexBuffer(BufferUsage.STATIC_WRITE); + vertexBuffer.bind(); + vertexBuffer.upload(this.buildSkyDisc(Tesselator.getInstance(), -16.0F)); + VertexBuffer.unbind(); + return vertexBuffer; + } + + private MeshData drawStars(Tesselator tesselator) { + RandomSource randomSource = RandomSource.create(10842L); + int i = 1500; + float f = 100.0F; + BufferBuilder bufferBuilder = tesselator.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION); + + for (int j = 0; j < 1500; j++) { + float g = randomSource.nextFloat() * 2.0F - 1.0F; + float h = randomSource.nextFloat() * 2.0F - 1.0F; + float k = randomSource.nextFloat() * 2.0F - 1.0F; + float l = 0.15F + randomSource.nextFloat() * 0.1F; + float m = Mth.lengthSquared(g, h, k); + if (!(m <= 0.010000001F) && !(m >= 1.0F)) { + Vector3f vector3f = new Vector3f(g, h, k).normalize(100.0F); + float n = (float)(randomSource.nextDouble() * (float) Math.PI * 2.0); + Matrix3f matrix3f = new Matrix3f().rotateTowards(new Vector3f(vector3f).negate(), new Vector3f(0.0F, 1.0F, 0.0F)).rotateZ(-n); + bufferBuilder.addVertex(new Vector3f(l, -l, 0.0F).mul(matrix3f).add(vector3f)); + bufferBuilder.addVertex(new Vector3f(l, l, 0.0F).mul(matrix3f).add(vector3f)); + bufferBuilder.addVertex(new Vector3f(-l, l, 0.0F).mul(matrix3f).add(vector3f)); + bufferBuilder.addVertex(new Vector3f(-l, -l, 0.0F).mul(matrix3f).add(vector3f)); + } + } + + return bufferBuilder.buildOrThrow(); + } + + private MeshData buildSkyDisc(Tesselator tesselator, float f) { + float g = Math.signum(f) * 512.0F; + BufferBuilder bufferBuilder = tesselator.begin(VertexFormat.Mode.TRIANGLE_FAN, DefaultVertexFormat.POSITION); + bufferBuilder.addVertex(0.0F, f, 0.0F); + + for (int i = -180; i <= 180; i += 45) { + bufferBuilder.addVertex(g * Mth.cos(i * (float) (Math.PI / 180.0)), f, 512.0F * Mth.sin(i * (float) (Math.PI / 180.0))); + } + + return bufferBuilder.buildOrThrow(); + } + + public void renderSkyDisc(float f, float g, float h) { + RenderSystem.depthMask(false); + RenderSystem.setShader(CoreShaders.POSITION); + RenderSystem.setShaderColor(f, g, h, 1.0F); + this.topSkyBuffer.bind(); + this.topSkyBuffer.drawWithShader(RenderSystem.getModelViewMatrix(), RenderSystem.getProjectionMatrix(), RenderSystem.getShader()); + VertexBuffer.unbind(); + RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); + RenderSystem.depthMask(true); + } + + public void renderDarkDisc(PoseStack poseStack) { + RenderSystem.depthMask(false); + RenderSystem.setShader(CoreShaders.POSITION); + RenderSystem.setShaderColor(0.0F, 0.0F, 0.0F, 1.0F); + poseStack.pushPose(); + poseStack.translate(0.0F, 12.0F, 0.0F); + this.bottomSkyBuffer.bind(); + this.bottomSkyBuffer.drawWithShader(RenderSystem.getModelViewMatrix(), RenderSystem.getProjectionMatrix(), RenderSystem.getShader()); + VertexBuffer.unbind(); + poseStack.popPose(); + RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); + RenderSystem.depthMask(true); + } + + public void renderSunMoonAndStars(PoseStack poseStack, Tesselator tesselator, float f, int i, float g, float h, FogParameters fogParameters) { + poseStack.pushPose(); + poseStack.mulPose(Axis.YP.rotationDegrees(-90.0F)); + poseStack.mulPose(Axis.XP.rotationDegrees(f * 360.0F)); + this.renderSun(g, tesselator, poseStack); + this.renderMoon(i, g, tesselator, poseStack); + if (h > 0.0F) { + this.renderStars(fogParameters, h, poseStack); + } + + poseStack.popPose(); + } + + private void renderSun(float f, Tesselator tesselator, PoseStack poseStack) { + float g = 30.0F; + float h = 100.0F; + BufferBuilder bufferBuilder = tesselator.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX); + Matrix4f matrix4f = poseStack.last().pose(); + RenderSystem.depthMask(false); + RenderSystem.overlayBlendFunc(); + RenderSystem.setShader(CoreShaders.POSITION_TEX); + RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, f); + RenderSystem.setShaderTexture(0, SUN_LOCATION); + RenderSystem.enableBlend(); + bufferBuilder.addVertex(matrix4f, -30.0F, 100.0F, -30.0F).setUv(0.0F, 0.0F); + bufferBuilder.addVertex(matrix4f, 30.0F, 100.0F, -30.0F).setUv(1.0F, 0.0F); + bufferBuilder.addVertex(matrix4f, 30.0F, 100.0F, 30.0F).setUv(1.0F, 1.0F); + bufferBuilder.addVertex(matrix4f, -30.0F, 100.0F, 30.0F).setUv(0.0F, 1.0F); + BufferUploader.drawWithShader(bufferBuilder.buildOrThrow()); + RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); + RenderSystem.disableBlend(); + RenderSystem.defaultBlendFunc(); + RenderSystem.depthMask(true); + } + + private void renderMoon(int i, float f, Tesselator tesselator, PoseStack poseStack) { + float g = 20.0F; + int j = i % 4; + int k = i / 4 % 2; + float h = (j + 0) / 4.0F; + float l = (k + 0) / 2.0F; + float m = (j + 1) / 4.0F; + float n = (k + 1) / 2.0F; + float o = 100.0F; + BufferBuilder bufferBuilder = tesselator.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX); + RenderSystem.depthMask(false); + RenderSystem.overlayBlendFunc(); + RenderSystem.setShader(CoreShaders.POSITION_TEX); + RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, f); + RenderSystem.setShaderTexture(0, MOON_LOCATION); + RenderSystem.enableBlend(); + Matrix4f matrix4f = poseStack.last().pose(); + bufferBuilder.addVertex(matrix4f, -20.0F, -100.0F, 20.0F).setUv(m, n); + bufferBuilder.addVertex(matrix4f, 20.0F, -100.0F, 20.0F).setUv(h, n); + bufferBuilder.addVertex(matrix4f, 20.0F, -100.0F, -20.0F).setUv(h, l); + bufferBuilder.addVertex(matrix4f, -20.0F, -100.0F, -20.0F).setUv(m, l); + BufferUploader.drawWithShader(bufferBuilder.buildOrThrow()); + RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); + RenderSystem.disableBlend(); + RenderSystem.defaultBlendFunc(); + RenderSystem.depthMask(true); + } + + private void renderStars(FogParameters fogParameters, float f, PoseStack poseStack) { + Matrix4fStack matrix4fStack = RenderSystem.getModelViewStack(); + matrix4fStack.pushMatrix(); + matrix4fStack.mul(poseStack.last().pose()); + RenderSystem.depthMask(false); + RenderSystem.overlayBlendFunc(); + RenderSystem.setShader(CoreShaders.POSITION); + RenderSystem.setShaderColor(f, f, f, f); + RenderSystem.enableBlend(); + RenderSystem.setShaderFog(FogParameters.NO_FOG); + this.starBuffer.bind(); + this.starBuffer.drawWithShader(matrix4fStack, RenderSystem.getProjectionMatrix(), RenderSystem.getShader()); + VertexBuffer.unbind(); + RenderSystem.setShaderFog(fogParameters); + RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); + RenderSystem.disableBlend(); + RenderSystem.defaultBlendFunc(); + RenderSystem.depthMask(true); + matrix4fStack.popMatrix(); + } + + public void renderSunriseAndSunset(PoseStack poseStack, Tesselator tesselator, float f, int i) { + RenderSystem.setShader(CoreShaders.POSITION_COLOR); + RenderSystem.depthMask(false); + RenderSystem.enableBlend(); + poseStack.pushPose(); + poseStack.mulPose(Axis.XP.rotationDegrees(90.0F)); + float g = Mth.sin(f) < 0.0F ? 180.0F : 0.0F; + poseStack.mulPose(Axis.ZP.rotationDegrees(g)); + poseStack.mulPose(Axis.ZP.rotationDegrees(90.0F)); + Matrix4f matrix4f = poseStack.last().pose(); + BufferBuilder bufferBuilder = tesselator.begin(VertexFormat.Mode.TRIANGLE_FAN, DefaultVertexFormat.POSITION_COLOR); + float h = ARGB.from8BitChannel(ARGB.alpha(i)); + bufferBuilder.addVertex(matrix4f, 0.0F, 100.0F, 0.0F).setColor(i); + int j = ARGB.transparent(i); + int k = 16; + + for (int l = 0; l <= 16; l++) { + float m = l * (float) (Math.PI * 2) / 16.0F; + float n = Mth.sin(m); + float o = Mth.cos(m); + bufferBuilder.addVertex(matrix4f, n * 120.0F, o * 120.0F, -o * 40.0F * h).setColor(j); + } + + BufferUploader.drawWithShader(bufferBuilder.buildOrThrow()); + poseStack.popPose(); + RenderSystem.disableBlend(); + RenderSystem.depthMask(true); + } + + public void renderEndSky(PoseStack poseStack) { + RenderSystem.enableBlend(); + RenderSystem.depthMask(false); + RenderSystem.setShader(CoreShaders.POSITION_TEX_COLOR); + RenderSystem.setShaderTexture(0, END_SKY_LOCATION); + Tesselator tesselator = Tesselator.getInstance(); + + for (int i = 0; i < 6; i++) { + poseStack.pushPose(); + if (i == 1) { + poseStack.mulPose(Axis.XP.rotationDegrees(90.0F)); + } + + if (i == 2) { + poseStack.mulPose(Axis.XP.rotationDegrees(-90.0F)); + } + + if (i == 3) { + poseStack.mulPose(Axis.XP.rotationDegrees(180.0F)); + } + + if (i == 4) { + poseStack.mulPose(Axis.ZP.rotationDegrees(90.0F)); + } + + if (i == 5) { + poseStack.mulPose(Axis.ZP.rotationDegrees(-90.0F)); + } + + Matrix4f matrix4f = poseStack.last().pose(); + BufferBuilder bufferBuilder = tesselator.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX_COLOR); + bufferBuilder.addVertex(matrix4f, -100.0F, -100.0F, -100.0F).setUv(0.0F, 0.0F).setColor(-14145496); + bufferBuilder.addVertex(matrix4f, -100.0F, -100.0F, 100.0F).setUv(0.0F, 16.0F).setColor(-14145496); + bufferBuilder.addVertex(matrix4f, 100.0F, -100.0F, 100.0F).setUv(16.0F, 16.0F).setColor(-14145496); + bufferBuilder.addVertex(matrix4f, 100.0F, -100.0F, -100.0F).setUv(16.0F, 0.0F).setColor(-14145496); + BufferUploader.drawWithShader(bufferBuilder.buildOrThrow()); + poseStack.popPose(); + } + + RenderSystem.depthMask(true); + RenderSystem.disableBlend(); + } + + public void close() { + this.starBuffer.close(); + this.topSkyBuffer.close(); + this.bottomSkyBuffer.close(); + } +} diff --git a/net/minecraft/client/renderer/ViewArea.java b/net/minecraft/client/renderer/ViewArea.java index e25e2b32..d407b3eb 100644 --- a/net/minecraft/client/renderer/ViewArea.java +++ b/net/minecraft/client/renderer/ViewArea.java @@ -5,7 +5,7 @@ import net.fabricmc.api.Environment; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.chunk.SectionRenderDispatcher; import net.minecraft.core.BlockPos; -import net.minecraft.util.Mth; +import net.minecraft.core.SectionPos; import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelHeightAccessor; import org.jetbrains.annotations.Nullable; @@ -18,6 +18,7 @@ public class ViewArea { protected int sectionGridSizeX; protected int sectionGridSizeZ; private int viewDistance; + private SectionPos cameraSectionPos; public SectionRenderDispatcher.RenderSection[] sections; public ViewArea(SectionRenderDispatcher sectionRenderDispatcher, Level level, int viewDistance, LevelRenderer levelRenderer) { @@ -25,6 +26,7 @@ public class ViewArea { this.level = level; this.setViewDistance(viewDistance); this.createSections(sectionRenderDispatcher); + this.cameraSectionPos = SectionPos.of(this.viewDistance + 1, 0, this.viewDistance + 1); } protected void createSections(SectionRenderDispatcher sectionRenderDispatcher) { @@ -38,7 +40,7 @@ public class ViewArea { for (int k = 0; k < this.sectionGridSizeY; k++) { for (int l = 0; l < this.sectionGridSizeZ; l++) { int m = this.getSectionIndex(j, k, l); - this.sections[m] = sectionRenderDispatcher.new RenderSection(m, j * 16, this.level.getMinBuildHeight() + k * 16, l * 16); + this.sections[m] = sectionRenderDispatcher.new RenderSection(m, SectionPos.asLong(j, k + this.level.getMinSectionY(), l)); } } } @@ -71,49 +73,73 @@ public class ViewArea { return this.level; } - public void repositionCamera(double viewEntityX, double viewEntityZ) { - int i = Mth.ceil(viewEntityX); - int j = Mth.ceil(viewEntityZ); + public void repositionCamera(SectionPos sectionPos) { + for (int i = 0; i < this.sectionGridSizeX; i++) { + int j = sectionPos.x() - this.viewDistance; + int k = j + Math.floorMod(i - j, this.sectionGridSizeX); - for (int k = 0; k < this.sectionGridSizeX; k++) { - int l = this.sectionGridSizeX * 16; - int m = i - 8 - l / 2; - int n = m + Math.floorMod(k * 16 - m, l); + for (int l = 0; l < this.sectionGridSizeZ; l++) { + int m = sectionPos.z() - this.viewDistance; + int n = m + Math.floorMod(l - m, this.sectionGridSizeZ); - for (int o = 0; o < this.sectionGridSizeZ; o++) { - int p = this.sectionGridSizeZ * 16; - int q = j - 8 - p / 2; - int r = q + Math.floorMod(o * 16 - q, p); - - for (int s = 0; s < this.sectionGridSizeY; s++) { - int t = this.level.getMinBuildHeight() + s * 16; - SectionRenderDispatcher.RenderSection renderSection = this.sections[this.getSectionIndex(k, s, o)]; - BlockPos blockPos = renderSection.getOrigin(); - if (n != blockPos.getX() || t != blockPos.getY() || r != blockPos.getZ()) { - renderSection.setOrigin(n, t, r); + for (int o = 0; o < this.sectionGridSizeY; o++) { + int p = this.level.getMinSectionY() + o; + SectionRenderDispatcher.RenderSection renderSection = this.sections[this.getSectionIndex(i, o, l)]; + long q = renderSection.getSectionNode(); + if (q != SectionPos.asLong(k, p, n)) { + renderSection.setSectionNode(SectionPos.asLong(k, p, n)); } } } } + + this.cameraSectionPos = sectionPos; + this.levelRenderer.getSectionOcclusionGraph().invalidate(); + } + + public SectionPos getCameraSectionPos() { + return this.cameraSectionPos; } public void setDirty(int sectionX, int sectionY, int sectionZ, boolean reRenderOnMainThread) { - int i = Math.floorMod(sectionX, this.sectionGridSizeX); - int j = Math.floorMod(sectionY - this.level.getMinSection(), this.sectionGridSizeY); - int k = Math.floorMod(sectionZ, this.sectionGridSizeZ); - SectionRenderDispatcher.RenderSection renderSection = this.sections[this.getSectionIndex(i, j, k)]; - renderSection.setDirty(reRenderOnMainThread); + SectionRenderDispatcher.RenderSection renderSection = this.getRenderSection(sectionX, sectionY, sectionZ); + if (renderSection != null) { + renderSection.setDirty(reRenderOnMainThread); + } } @Nullable protected SectionRenderDispatcher.RenderSection getRenderSectionAt(BlockPos pos) { - int i = Mth.floorDiv(pos.getY() - this.level.getMinBuildHeight(), 16); - if (i >= 0 && i < this.sectionGridSizeY) { - int j = Mth.positiveModulo(Mth.floorDiv(pos.getX(), 16), this.sectionGridSizeX); - int k = Mth.positiveModulo(Mth.floorDiv(pos.getZ(), 16), this.sectionGridSizeZ); - return this.sections[this.getSectionIndex(j, i, k)]; - } else { + return this.getRenderSection(SectionPos.asLong(pos)); + } + + @Nullable + protected SectionRenderDispatcher.RenderSection getRenderSection(long l) { + int i = SectionPos.x(l); + int j = SectionPos.y(l); + int k = SectionPos.z(l); + return this.getRenderSection(i, j, k); + } + + @Nullable + private SectionRenderDispatcher.RenderSection getRenderSection(int i, int j, int k) { + if (!this.containsSection(i, j, k)) { return null; + } else { + int l = j - this.level.getMinSectionY(); + int m = Math.floorMod(i, this.sectionGridSizeX); + int n = Math.floorMod(k, this.sectionGridSizeZ); + return this.sections[this.getSectionIndex(m, l, n)]; + } + } + + private boolean containsSection(int i, int j, int k) { + if (j >= this.level.getMinSectionY() && j <= this.level.getMaxSectionY()) { + return i < this.cameraSectionPos.x() - this.viewDistance || i > this.cameraSectionPos.x() + this.viewDistance + ? false + : k >= this.cameraSectionPos.z() - this.viewDistance && k <= this.cameraSectionPos.z() + this.viewDistance; + } else { + return false; } } } diff --git a/net/minecraft/client/renderer/WeatherEffectRenderer.java b/net/minecraft/client/renderer/WeatherEffectRenderer.java new file mode 100644 index 00000000..f1bfe763 --- /dev/null +++ b/net/minecraft/client/renderer/WeatherEffectRenderer.java @@ -0,0 +1,243 @@ +package net.minecraft.client.renderer; + +import com.mojang.blaze3d.systems.RenderSystem; +import com.mojang.blaze3d.vertex.BufferBuilder; +import com.mojang.blaze3d.vertex.BufferUploader; +import com.mojang.blaze3d.vertex.DefaultVertexFormat; +import com.mojang.blaze3d.vertex.Tesselator; +import com.mojang.blaze3d.vertex.VertexFormat; +import java.util.ArrayList; +import java.util.List; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.client.Camera; +import net.minecraft.client.Minecraft; +import net.minecraft.client.multiplayer.ClientLevel; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.core.SectionPos; +import net.minecraft.core.particles.ParticleOptions; +import net.minecraft.core.particles.ParticleTypes; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.level.ParticleStatus; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.sounds.SoundSource; +import net.minecraft.tags.FluidTags; +import net.minecraft.util.ARGB; +import net.minecraft.util.Mth; +import net.minecraft.util.RandomSource; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.biome.Biome; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.CampfireBlock; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.levelgen.Heightmap; +import net.minecraft.world.level.material.FluidState; +import net.minecraft.world.phys.Vec3; +import net.minecraft.world.phys.shapes.VoxelShape; + +@Environment(EnvType.CLIENT) +public class WeatherEffectRenderer { + private static final int RAIN_RADIUS = 10; + private static final int RAIN_DIAMETER = 21; + private static final ResourceLocation RAIN_LOCATION = ResourceLocation.withDefaultNamespace("textures/environment/rain.png"); + private static final ResourceLocation SNOW_LOCATION = ResourceLocation.withDefaultNamespace("textures/environment/snow.png"); + private static final int RAIN_TABLE_SIZE = 32; + private static final int HALF_RAIN_TABLE_SIZE = 16; + private int rainSoundTime; + private final float[] columnSizeX = new float[1024]; + private final float[] columnSizeZ = new float[1024]; + + public WeatherEffectRenderer() { + for (int i = 0; i < 32; i++) { + for (int j = 0; j < 32; j++) { + float f = j - 16; + float g = i - 16; + float h = Mth.length(f, g); + this.columnSizeX[i * 32 + j] = -g / h; + this.columnSizeZ[i * 32 + j] = f / h; + } + } + } + + public void render(Level level, LightTexture lightTexture, int i, float f, Vec3 vec3) { + float g = level.getRainLevel(f); + if (!(g <= 0.0F)) { + int j = Minecraft.useFancyGraphics() ? 10 : 5; + List list = new ArrayList(); + List list2 = new ArrayList(); + this.collectColumnInstances(level, i, f, vec3, j, list, list2); + if (!list.isEmpty() || !list2.isEmpty()) { + this.render(lightTexture, vec3, j, g, list, list2); + } + } + } + + private void collectColumnInstances( + Level level, int i, float f, Vec3 vec3, int j, List list, List list2 + ) { + int k = Mth.floor(vec3.x); + int l = Mth.floor(vec3.y); + int m = Mth.floor(vec3.z); + BlockPos.MutableBlockPos mutableBlockPos = new BlockPos.MutableBlockPos(); + RandomSource randomSource = RandomSource.create(); + + for (int n = m - j; n <= m + j; n++) { + for (int o = k - j; o <= k + j; o++) { + int p = level.getHeight(Heightmap.Types.MOTION_BLOCKING, o, n); + int q = Math.max(l - j, p); + int r = Math.max(l + j, p); + if (r - q != 0) { + Biome.Precipitation precipitation = this.getPrecipitationAt(level, mutableBlockPos.set(o, l, n)); + if (precipitation != Biome.Precipitation.NONE) { + int s = o * o * 3121 + o * 45238971 ^ n * n * 418711 + n * 13761; + randomSource.setSeed(s); + int t = Math.max(l, p); + int u = LevelRenderer.getLightColor(level, mutableBlockPos.set(o, t, n)); + if (precipitation == Biome.Precipitation.RAIN) { + list.add(this.createRainColumnInstance(randomSource, i, o, q, r, n, u, f)); + } else if (precipitation == Biome.Precipitation.SNOW) { + list2.add(this.createSnowColumnInstance(randomSource, i, o, q, r, n, u, f)); + } + } + } + } + } + } + + private void render( + LightTexture lightTexture, Vec3 vec3, int i, float f, List list, List list2 + ) { + lightTexture.turnOnLightLayer(); + Tesselator tesselator = Tesselator.getInstance(); + RenderSystem.disableCull(); + RenderSystem.enableBlend(); + RenderSystem.enableDepthTest(); + RenderSystem.depthMask(Minecraft.useShaderTransparency()); + RenderSystem.setShader(CoreShaders.PARTICLE); + if (!list.isEmpty()) { + RenderSystem.setShaderTexture(0, RAIN_LOCATION); + this.renderInstances(tesselator, list, vec3, 1.0F, i, f); + } + + if (!list2.isEmpty()) { + RenderSystem.setShaderTexture(0, SNOW_LOCATION); + this.renderInstances(tesselator, list2, vec3, 0.8F, i, f); + } + + RenderSystem.depthMask(true); + RenderSystem.enableCull(); + RenderSystem.disableBlend(); + lightTexture.turnOffLightLayer(); + } + + private WeatherEffectRenderer.ColumnInstance createRainColumnInstance(RandomSource randomSource, int i, int j, int k, int l, int m, int n, float f) { + int o = i & 131071; + int p = j * j * 3121 + j * 45238971 + m * m * 418711 + m * 13761 & 0xFF; + float g = 3.0F + randomSource.nextFloat(); + float h = -(o + p + f) / 32.0F * g; + float q = h % 32.0F; + return new WeatherEffectRenderer.ColumnInstance(j, m, k, l, 0.0F, q, n); + } + + private WeatherEffectRenderer.ColumnInstance createSnowColumnInstance(RandomSource randomSource, int i, int j, int k, int l, int m, int n, float f) { + float g = i + f; + float h = (float)(randomSource.nextDouble() + g * 0.01F * (float)randomSource.nextGaussian()); + float o = (float)(randomSource.nextDouble() + g * (float)randomSource.nextGaussian() * 0.001F); + float p = -((i & 511) + f) / 512.0F; + int q = LightTexture.pack((LightTexture.block(n) * 3 + 15) / 4, (LightTexture.sky(n) * 3 + 15) / 4); + return new WeatherEffectRenderer.ColumnInstance(j, m, k, l, h, p + o, q); + } + + private void renderInstances(Tesselator tesselator, List list, Vec3 vec3, float f, int i, float g) { + BufferBuilder bufferBuilder = tesselator.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.PARTICLE); + + for (WeatherEffectRenderer.ColumnInstance columnInstance : list) { + float h = (float)(columnInstance.x + 0.5 - vec3.x); + float j = (float)(columnInstance.z + 0.5 - vec3.z); + float k = (float)Mth.lengthSquared(h, j); + float l = Mth.lerp(k / (i * i), f, 0.5F) * g; + int m = ARGB.white(l); + int n = (columnInstance.z - Mth.floor(vec3.z) + 16) * 32 + columnInstance.x - Mth.floor(vec3.x) + 16; + float o = this.columnSizeX[n] / 2.0F; + float p = this.columnSizeZ[n] / 2.0F; + float q = h - o; + float r = h + o; + float s = (float)(columnInstance.topY - vec3.y); + float t = (float)(columnInstance.bottomY - vec3.y); + float u = j - p; + float v = j + p; + float w = columnInstance.uOffset + 0.0F; + float x = columnInstance.uOffset + 1.0F; + float y = columnInstance.bottomY * 0.25F + columnInstance.vOffset; + float z = columnInstance.topY * 0.25F + columnInstance.vOffset; + bufferBuilder.addVertex(q, s, u).setUv(w, y).setColor(m).setLight(columnInstance.lightCoords); + bufferBuilder.addVertex(r, s, v).setUv(x, y).setColor(m).setLight(columnInstance.lightCoords); + bufferBuilder.addVertex(r, t, v).setUv(x, z).setColor(m).setLight(columnInstance.lightCoords); + bufferBuilder.addVertex(q, t, u).setUv(w, z).setColor(m).setLight(columnInstance.lightCoords); + } + + BufferUploader.drawWithShader(bufferBuilder.buildOrThrow()); + } + + public void tickRainParticles(ClientLevel clientLevel, Camera camera, int i, ParticleStatus particleStatus) { + float f = clientLevel.getRainLevel(1.0F) / (Minecraft.useFancyGraphics() ? 1.0F : 2.0F); + if (!(f <= 0.0F)) { + RandomSource randomSource = RandomSource.create(i * 312987231L); + BlockPos blockPos = BlockPos.containing(camera.getPosition()); + BlockPos blockPos2 = null; + int j = (int)(100.0F * f * f) / (particleStatus == ParticleStatus.DECREASED ? 2 : 1); + + for (int k = 0; k < j; k++) { + int l = randomSource.nextInt(21) - 10; + int m = randomSource.nextInt(21) - 10; + BlockPos blockPos3 = clientLevel.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, blockPos.offset(l, 0, m)); + if (blockPos3.getY() > clientLevel.getMinY() + && blockPos3.getY() <= blockPos.getY() + 10 + && blockPos3.getY() >= blockPos.getY() - 10 + && this.getPrecipitationAt(clientLevel, blockPos3) == Biome.Precipitation.RAIN) { + blockPos2 = blockPos3.below(); + if (particleStatus == ParticleStatus.MINIMAL) { + break; + } + + double d = randomSource.nextDouble(); + double e = randomSource.nextDouble(); + BlockState blockState = clientLevel.getBlockState(blockPos2); + FluidState fluidState = clientLevel.getFluidState(blockPos2); + VoxelShape voxelShape = blockState.getCollisionShape(clientLevel, blockPos2); + double g = voxelShape.max(Direction.Axis.Y, d, e); + double h = fluidState.getHeight(clientLevel, blockPos2); + double n = Math.max(g, h); + ParticleOptions particleOptions = !fluidState.is(FluidTags.LAVA) && !blockState.is(Blocks.MAGMA_BLOCK) && !CampfireBlock.isLitCampfire(blockState) + ? ParticleTypes.RAIN + : ParticleTypes.SMOKE; + clientLevel.addParticle(particleOptions, blockPos2.getX() + d, blockPos2.getY() + n, blockPos2.getZ() + e, 0.0, 0.0, 0.0); + } + } + + if (blockPos2 != null && randomSource.nextInt(3) < this.rainSoundTime++) { + this.rainSoundTime = 0; + if (blockPos2.getY() > blockPos.getY() + 1 + && clientLevel.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, blockPos).getY() > Mth.floor((float)blockPos.getY())) { + clientLevel.playLocalSound(blockPos2, SoundEvents.WEATHER_RAIN_ABOVE, SoundSource.WEATHER, 0.1F, 0.5F, false); + } else { + clientLevel.playLocalSound(blockPos2, SoundEvents.WEATHER_RAIN, SoundSource.WEATHER, 0.2F, 1.0F, false); + } + } + } + } + + private Biome.Precipitation getPrecipitationAt(Level level, BlockPos blockPos) { + if (!level.getChunkSource().hasChunk(SectionPos.blockToSectionCoord(blockPos.getX()), SectionPos.blockToSectionCoord(blockPos.getZ()))) { + return Biome.Precipitation.NONE; + } else { + Biome biome = level.getBiome(blockPos).value(); + return biome.getPrecipitationAt(blockPos, level.getSeaLevel()); + } + } + + @Environment(EnvType.CLIENT) + record ColumnInstance(int x, int z, int bottomY, int topY, float uOffset, float vOffset, int lightCoords) { + } +} diff --git a/net/minecraft/client/renderer/WorldBorderRenderer.java b/net/minecraft/client/renderer/WorldBorderRenderer.java new file mode 100644 index 00000000..f00e515a --- /dev/null +++ b/net/minecraft/client/renderer/WorldBorderRenderer.java @@ -0,0 +1,133 @@ +package net.minecraft.client.renderer; + +import com.mojang.blaze3d.platform.GlStateManager; +import com.mojang.blaze3d.systems.RenderSystem; +import com.mojang.blaze3d.vertex.BufferBuilder; +import com.mojang.blaze3d.vertex.BufferUploader; +import com.mojang.blaze3d.vertex.DefaultVertexFormat; +import com.mojang.blaze3d.vertex.MeshData; +import com.mojang.blaze3d.vertex.Tesselator; +import com.mojang.blaze3d.vertex.VertexFormat; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.Util; +import net.minecraft.client.Minecraft; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.ARGB; +import net.minecraft.util.Mth; +import net.minecraft.world.level.border.WorldBorder; +import net.minecraft.world.phys.Vec3; + +@Environment(EnvType.CLIENT) +public class WorldBorderRenderer { + private static final ResourceLocation FORCEFIELD_LOCATION = ResourceLocation.withDefaultNamespace("textures/misc/forcefield.png"); + + public void render(WorldBorder worldBorder, Vec3 vec3, double d, double e) { + double f = worldBorder.getMinX(); + double g = worldBorder.getMaxX(); + double h = worldBorder.getMinZ(); + double i = worldBorder.getMaxZ(); + if (!(vec3.x < g - d) || !(vec3.x > f + d) || !(vec3.z < i - d) || !(vec3.z > h + d)) { + double j = 1.0 - worldBorder.getDistanceToBorder(vec3.x, vec3.z) / d; + j = Math.pow(j, 4.0); + j = Mth.clamp(j, 0.0, 1.0); + double k = vec3.x; + double l = vec3.z; + float m = (float)e; + RenderSystem.enableBlend(); + RenderSystem.enableDepthTest(); + RenderSystem.blendFuncSeparate( + GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO + ); + RenderSystem.setShaderTexture(0, FORCEFIELD_LOCATION); + RenderSystem.depthMask(Minecraft.useShaderTransparency()); + int n = worldBorder.getStatus().getColor(); + float o = ARGB.red(n) / 255.0F; + float p = ARGB.green(n) / 255.0F; + float q = ARGB.blue(n) / 255.0F; + RenderSystem.setShaderColor(o, p, q, (float)j); + RenderSystem.setShader(CoreShaders.POSITION_TEX); + RenderSystem.polygonOffset(-3.0F, -3.0F); + RenderSystem.enablePolygonOffset(); + RenderSystem.disableCull(); + float r = (float)(Util.getMillis() % 3000L) / 3000.0F; + float s = (float)(-Mth.frac(vec3.y * 0.5)); + float t = s + m; + BufferBuilder bufferBuilder = Tesselator.getInstance().begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX); + double u = Math.max(Mth.floor(l - d), h); + double v = Math.min(Mth.ceil(l + d), i); + float w = (Mth.floor(u) & 1) * 0.5F; + if (k > g - d) { + float x = w; + + for (double y = u; y < v; x += 0.5F) { + double z = Math.min(1.0, v - y); + float aa = (float)z * 0.5F; + bufferBuilder.addVertex((float)(g - k), -m, (float)(y - l)).setUv(r - x, r + t); + bufferBuilder.addVertex((float)(g - k), -m, (float)(y + z - l)).setUv(r - (aa + x), r + t); + bufferBuilder.addVertex((float)(g - k), m, (float)(y + z - l)).setUv(r - (aa + x), r + s); + bufferBuilder.addVertex((float)(g - k), m, (float)(y - l)).setUv(r - x, r + s); + y++; + } + } + + if (k < f + d) { + float x = w; + + for (double y = u; y < v; x += 0.5F) { + double z = Math.min(1.0, v - y); + float aa = (float)z * 0.5F; + bufferBuilder.addVertex((float)(f - k), -m, (float)(y - l)).setUv(r + x, r + t); + bufferBuilder.addVertex((float)(f - k), -m, (float)(y + z - l)).setUv(r + aa + x, r + t); + bufferBuilder.addVertex((float)(f - k), m, (float)(y + z - l)).setUv(r + aa + x, r + s); + bufferBuilder.addVertex((float)(f - k), m, (float)(y - l)).setUv(r + x, r + s); + y++; + } + } + + u = Math.max(Mth.floor(k - d), f); + v = Math.min(Mth.ceil(k + d), g); + w = (Mth.floor(u) & 1) * 0.5F; + if (l > i - d) { + float x = w; + + for (double y = u; y < v; x += 0.5F) { + double z = Math.min(1.0, v - y); + float aa = (float)z * 0.5F; + bufferBuilder.addVertex((float)(y - k), -m, (float)(i - l)).setUv(r + x, r + t); + bufferBuilder.addVertex((float)(y + z - k), -m, (float)(i - l)).setUv(r + aa + x, r + t); + bufferBuilder.addVertex((float)(y + z - k), m, (float)(i - l)).setUv(r + aa + x, r + s); + bufferBuilder.addVertex((float)(y - k), m, (float)(i - l)).setUv(r + x, r + s); + y++; + } + } + + if (l < h + d) { + float x = w; + + for (double y = u; y < v; x += 0.5F) { + double z = Math.min(1.0, v - y); + float aa = (float)z * 0.5F; + bufferBuilder.addVertex((float)(y - k), -m, (float)(h - l)).setUv(r - x, r + t); + bufferBuilder.addVertex((float)(y + z - k), -m, (float)(h - l)).setUv(r - (aa + x), r + t); + bufferBuilder.addVertex((float)(y + z - k), m, (float)(h - l)).setUv(r - (aa + x), r + s); + bufferBuilder.addVertex((float)(y - k), m, (float)(h - l)).setUv(r - x, r + s); + y++; + } + } + + MeshData meshData = bufferBuilder.build(); + if (meshData != null) { + BufferUploader.drawWithShader(meshData); + } + + RenderSystem.enableCull(); + RenderSystem.polygonOffset(0.0F, 0.0F); + RenderSystem.disablePolygonOffset(); + RenderSystem.disableBlend(); + RenderSystem.defaultBlendFunc(); + RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); + RenderSystem.depthMask(true); + } + } +} diff --git a/net/minecraft/client/renderer/block/BlockRenderDispatcher.java b/net/minecraft/client/renderer/block/BlockRenderDispatcher.java index f3244568..d9c1974a 100644 --- a/net/minecraft/client/renderer/block/BlockRenderDispatcher.java +++ b/net/minecraft/client/renderer/block/BlockRenderDispatcher.java @@ -97,9 +97,7 @@ public class BlockRenderDispatcher implements ResourceManagerReloadListener { float g = (i >> 8 & 0xFF) / 255.0F; float h = (i & 0xFF) / 255.0F; this.modelRenderer - .renderModel( - poseStack.last(), bufferSource.getBuffer(ItemBlockRenderTypes.getRenderType(state, false)), state, bakedModel, f, g, h, packedLight, packedOverlay - ); + .renderModel(poseStack.last(), bufferSource.getBuffer(ItemBlockRenderTypes.getRenderType(state)), state, bakedModel, f, g, h, packedLight, packedOverlay); break; case ENTITYBLOCK_ANIMATED: this.blockEntityRenderer.renderByItem(new ItemStack(state.getBlock()), ItemDisplayContext.NONE, poseStack, bufferSource, packedLight, packedOverlay); diff --git a/net/minecraft/client/renderer/block/LiquidBlockRenderer.java b/net/minecraft/client/renderer/block/LiquidBlockRenderer.java index b543d61b..c7329871 100644 --- a/net/minecraft/client/renderer/block/LiquidBlockRenderer.java +++ b/net/minecraft/client/renderer/block/LiquidBlockRenderer.java @@ -13,7 +13,6 @@ import net.minecraft.core.Direction; import net.minecraft.tags.FluidTags; import net.minecraft.util.Mth; import net.minecraft.world.level.BlockAndTintGetter; -import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.HalfTransparentBlock; @@ -44,28 +43,29 @@ public class LiquidBlockRenderer { return secondState.getType().isSame(firstState.getType()); } - private static boolean isFaceOccludedByState(BlockGetter level, Direction face, float height, BlockPos pos, BlockState state) { - if (state.canOcclude()) { - VoxelShape voxelShape = Shapes.box(0.0, 0.0, 0.0, 1.0, height, 1.0); - VoxelShape voxelShape2 = state.getOcclusionShape(level, pos); - return Shapes.blockOccudes(voxelShape, voxelShape2, face); - } else { + private static boolean isFaceOccludedByState(Direction direction, float f, BlockState blockState) { + VoxelShape voxelShape = blockState.getFaceOcclusionShape(direction.getOpposite()); + if (voxelShape == Shapes.empty()) { return false; + } else if (voxelShape == Shapes.block()) { + boolean bl = f == 1.0F; + return direction != Direction.UP || bl; + } else { + VoxelShape voxelShape2 = Shapes.box(0.0, 0.0, 0.0, 1.0, f, 1.0); + return Shapes.blockOccudes(voxelShape2, voxelShape, direction); } } - private static boolean isFaceOccludedByNeighbor(BlockGetter level, BlockPos pos, Direction side, float height, BlockState blockState) { - return isFaceOccludedByState(level, side, height, pos.relative(side), blockState); + private static boolean isFaceOccludedByNeighbor(Direction direction, float f, BlockState blockState) { + return isFaceOccludedByState(direction, f, blockState); } - private static boolean isFaceOccludedBySelf(BlockGetter level, BlockPos pos, BlockState state, Direction face) { - return isFaceOccludedByState(level, face.getOpposite(), 1.0F, pos, state); + private static boolean isFaceOccludedBySelf(BlockState blockState, Direction direction) { + return isFaceOccludedByState(direction.getOpposite(), 1.0F, blockState); } - public static boolean shouldRenderFace( - BlockAndTintGetter level, BlockPos pos, FluidState fluidState, BlockState blockState, Direction side, FluidState neighborFluid - ) { - return !isFaceOccludedBySelf(level, pos, blockState, side) && !isNeighborSameFluid(fluidState, neighborFluid); + public static boolean shouldRenderFace(FluidState fluidState, BlockState blockState, Direction direction, FluidState fluidState2) { + return !isFaceOccludedBySelf(blockState, direction) && !isNeighborSameFluid(fluidState, fluidState2); } public void tesselate(BlockAndTintGetter level, BlockPos pos, VertexConsumer buffer, BlockState blockState, FluidState fluidState) { @@ -88,12 +88,11 @@ public class LiquidBlockRenderer { BlockState blockState7 = level.getBlockState(pos.relative(Direction.EAST)); FluidState fluidState7 = blockState7.getFluidState(); boolean bl2 = !isNeighborSameFluid(fluidState, fluidState3); - boolean bl3 = shouldRenderFace(level, pos, fluidState, blockState, Direction.DOWN, fluidState2) - && !isFaceOccludedByNeighbor(level, pos, Direction.DOWN, 0.8888889F, blockState2); - boolean bl4 = shouldRenderFace(level, pos, fluidState, blockState, Direction.NORTH, fluidState4); - boolean bl5 = shouldRenderFace(level, pos, fluidState, blockState, Direction.SOUTH, fluidState5); - boolean bl6 = shouldRenderFace(level, pos, fluidState, blockState, Direction.WEST, fluidState6); - boolean bl7 = shouldRenderFace(level, pos, fluidState, blockState, Direction.EAST, fluidState7); + boolean bl3 = shouldRenderFace(fluidState, blockState, Direction.DOWN, fluidState2) && !isFaceOccludedByNeighbor(Direction.DOWN, 0.8888889F, blockState2); + boolean bl4 = shouldRenderFace(fluidState, blockState, Direction.NORTH, fluidState4); + boolean bl5 = shouldRenderFace(fluidState, blockState, Direction.SOUTH, fluidState5); + boolean bl6 = shouldRenderFace(fluidState, blockState, Direction.WEST, fluidState6); + boolean bl7 = shouldRenderFace(fluidState, blockState, Direction.EAST, fluidState7); if (bl2 || bl3 || bl7 || bl6 || bl4 || bl5) { float j = level.getShade(Direction.DOWN, true); float k = level.getShade(Direction.UP, true); @@ -126,7 +125,7 @@ public class LiquidBlockRenderer { float u = pos.getZ() & 15; float v = 0.001F; float w = bl3 ? 0.001F : 0.0F; - if (bl2 && !isFaceOccludedByNeighbor(level, pos, Direction.UP, Math.min(Math.min(p, r), Math.min(q, o)), blockState3)) { + if (bl2 && !isFaceOccludedByNeighbor(Direction.UP, Math.min(Math.min(p, r), Math.min(q, o)), blockState3)) { p -= 0.001F; r -= 0.001F; q -= 0.001F; @@ -256,7 +255,7 @@ public class LiquidBlockRenderer { bl8 = bl7; } - if (bl8 && !isFaceOccludedByNeighbor(level, pos, direction, Math.max(adx, yx), level.getBlockState(pos.relative(direction)))) { + if (bl8 && !isFaceOccludedByNeighbor(direction, Math.max(adx, yx), level.getBlockState(pos.relative(direction)))) { BlockPos blockPos = pos.relative(direction); TextureAtlasSprite textureAtlasSprite2 = textureAtlasSprites[1]; if (!bl) { diff --git a/net/minecraft/client/renderer/block/ModelBlockRenderer.java b/net/minecraft/client/renderer/block/ModelBlockRenderer.java index 133aeb85..e5407d3d 100644 --- a/net/minecraft/client/renderer/block/ModelBlockRenderer.java +++ b/net/minecraft/client/renderer/block/ModelBlockRenderer.java @@ -15,6 +15,8 @@ import net.minecraft.Util; import net.minecraft.client.Minecraft; import net.minecraft.client.color.block.BlockColors; import net.minecraft.client.renderer.LevelRenderer; +import net.minecraft.client.renderer.block.ModelBlockRenderer.Cache.1; +import net.minecraft.client.renderer.block.ModelBlockRenderer.Cache.2; import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.client.resources.model.BakedModel; import net.minecraft.core.BlockPos; @@ -24,7 +26,6 @@ import net.minecraft.util.RandomSource; import net.minecraft.world.level.BlockAndTintGetter; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.world.phys.Vec3; import org.jetbrains.annotations.Nullable; @Environment(EnvType.CLIENT) @@ -56,8 +57,7 @@ public class ModelBlockRenderer { int packedOverlay ) { boolean bl = Minecraft.useAmbientOcclusion() && state.getLightEmission() == 0 && model.useAmbientOcclusion(); - Vec3 vec3 = state.getOffset(level, pos); - poseStack.translate(vec3.x, vec3.y, vec3.z); + poseStack.translate(state.getOffset(pos)); try { if (bl) { @@ -65,8 +65,8 @@ public class ModelBlockRenderer { } else { this.tesselateWithoutAO(level, model, state, pos, poseStack, consumer, checkSides, random, seed, packedOverlay); } - } catch (Throwable var17) { - CrashReport crashReport = CrashReport.forThrowable(var17, "Tesselating block model"); + } catch (Throwable var16) { + CrashReport crashReport = CrashReport.forThrowable(var16, "Tesselating block model"); CrashReportCategory crashReportCategory = crashReport.addCategory("Block model being tesselated"); CrashReportCategory.populateBlockDetails(crashReportCategory, level, pos, state); crashReportCategory.setDetail("Using AO", bl); @@ -99,7 +99,7 @@ public class ModelBlockRenderer { List list = model.getQuads(state, direction, random); if (!list.isEmpty()) { mutableBlockPos.setWithOffset(pos, direction); - if (!checkSides || Block.shouldRenderFace(state, level, pos, direction, mutableBlockPos)) { + if (!checkSides || Block.shouldRenderFace(state, level.getBlockState(mutableBlockPos), direction)) { this.renderModelFaceAO(level, state, pos, poseStack, consumer, list, fs, bitSet, ambientOcclusionFace, packedOverlay); } } @@ -135,7 +135,7 @@ public class ModelBlockRenderer { List list = model.getQuads(state, direction, random); if (!list.isEmpty()) { mutableBlockPos.setWithOffset(pos, direction); - if (!checkSides || Block.shouldRenderFace(state, level, pos, direction, mutableBlockPos)) { + if (!checkSides || Block.shouldRenderFace(state, level.getBlockState(mutableBlockPos), direction)) { int i = LevelRenderer.getLightColor(level, state, mutableBlockPos); this.renderModelFaceFlat(level, state, pos, i, packedOverlay, false, poseStack, consumer, list, bitSet); } @@ -733,13 +733,13 @@ public class ModelBlockRenderer { int l = cache.getLightColor(blockState4, level, mutableBlockPos); float m = cache.getShadeBrightness(blockState4, level, mutableBlockPos); BlockState blockState5 = level.getBlockState(mutableBlockPos.setWithOffset(blockPos, adjacencyInfo.corners[0]).move(direction)); - boolean bl = !blockState5.isViewBlocking(level, mutableBlockPos) || blockState5.getLightBlock(level, mutableBlockPos) == 0; + boolean bl = !blockState5.isViewBlocking(level, mutableBlockPos) || blockState5.getLightBlock() == 0; BlockState blockState6 = level.getBlockState(mutableBlockPos.setWithOffset(blockPos, adjacencyInfo.corners[1]).move(direction)); - boolean bl2 = !blockState6.isViewBlocking(level, mutableBlockPos) || blockState6.getLightBlock(level, mutableBlockPos) == 0; + boolean bl2 = !blockState6.isViewBlocking(level, mutableBlockPos) || blockState6.getLightBlock() == 0; BlockState blockState7 = level.getBlockState(mutableBlockPos.setWithOffset(blockPos, adjacencyInfo.corners[2]).move(direction)); - boolean bl3 = !blockState7.isViewBlocking(level, mutableBlockPos) || blockState7.getLightBlock(level, mutableBlockPos) == 0; + boolean bl3 = !blockState7.isViewBlocking(level, mutableBlockPos) || blockState7.getLightBlock() == 0; BlockState blockState8 = level.getBlockState(mutableBlockPos.setWithOffset(blockPos, adjacencyInfo.corners[3]).move(direction)); - boolean bl4 = !blockState8.isViewBlocking(level, mutableBlockPos) || blockState8.getLightBlock(level, mutableBlockPos) == 0; + boolean bl4 = !blockState8.isViewBlocking(level, mutableBlockPos) || blockState8.getLightBlock() == 0; float n; int o; if (!bl3 && !bl) { @@ -791,7 +791,7 @@ public class ModelBlockRenderer { int v = cache.getLightColor(state, level, pos); mutableBlockPos.setWithOffset(pos, direction); BlockState blockState10 = level.getBlockState(mutableBlockPos); - if (shapeFlags.get(0) || !blockState10.isSolidRender(level, mutableBlockPos)) { + if (shapeFlags.get(0) || !blockState10.isSolidRender()) { v = cache.getLightColor(blockState10, level, mutableBlockPos); } @@ -820,10 +820,10 @@ public class ModelBlockRenderer { float ao = shape[adjacencyInfo.vert3Weights[2].shape] * shape[adjacencyInfo.vert3Weights[3].shape]; float ap = shape[adjacencyInfo.vert3Weights[4].shape] * shape[adjacencyInfo.vert3Weights[5].shape]; float aq = shape[adjacencyInfo.vert3Weights[6].shape] * shape[adjacencyInfo.vert3Weights[7].shape]; - this.brightness[ambientVertexRemap.vert0] = x * ab + y * ac + z * ad + aa * ae; - this.brightness[ambientVertexRemap.vert1] = x * af + y * ag + z * ah + aa * ai; - this.brightness[ambientVertexRemap.vert2] = x * aj + y * ak + z * al + aa * am; - this.brightness[ambientVertexRemap.vert3] = x * an + y * ao + z * ap + aa * aq; + this.brightness[ambientVertexRemap.vert0] = Math.clamp(x * ab + y * ac + z * ad + aa * ae, 0.0F, 1.0F); + this.brightness[ambientVertexRemap.vert1] = Math.clamp(x * af + y * ag + z * ah + aa * ai, 0.0F, 1.0F); + this.brightness[ambientVertexRemap.vert2] = Math.clamp(x * aj + y * ak + z * al + aa * am, 0.0F, 1.0F); + this.brightness[ambientVertexRemap.vert3] = Math.clamp(x * an + y * ao + z * ap + aa * aq, 0.0F, 1.0F); int ar = this.blend(l, i, q, v); int as = this.blend(k, i, o, v); int at = this.blend(k, j, s, v); @@ -921,20 +921,12 @@ public class ModelBlockRenderer { static class Cache { private boolean enabled; private final Long2IntLinkedOpenHashMap colorCache = Util.make(() -> { - Long2IntLinkedOpenHashMap long2IntLinkedOpenHashMap = new Long2IntLinkedOpenHashMap(100, 0.25F) { - @Override - protected void rehash(int i) { - } - }; + Long2IntLinkedOpenHashMap long2IntLinkedOpenHashMap = new 1(this, 100, 0.25F); long2IntLinkedOpenHashMap.defaultReturnValue(Integer.MAX_VALUE); return long2IntLinkedOpenHashMap; }); private final Long2FloatLinkedOpenHashMap brightnessCache = Util.make(() -> { - Long2FloatLinkedOpenHashMap long2FloatLinkedOpenHashMap = new Long2FloatLinkedOpenHashMap(100, 0.25F) { - @Override - protected void rehash(int i) { - } - }; + Long2FloatLinkedOpenHashMap long2FloatLinkedOpenHashMap = new 2(this, 100, 0.25F); long2FloatLinkedOpenHashMap.defaultReturnValue(Float.NaN); return long2FloatLinkedOpenHashMap; }); diff --git a/net/minecraft/client/renderer/block/model/BakedOverrides.java b/net/minecraft/client/renderer/block/model/BakedOverrides.java new file mode 100644 index 00000000..0e243b55 --- /dev/null +++ b/net/minecraft/client/renderer/block/model/BakedOverrides.java @@ -0,0 +1,103 @@ +package net.minecraft.client.renderer.block.model; + +import com.google.common.collect.Lists; +import it.unimi.dsi.fastutil.objects.Object2IntMap; +import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; +import java.util.List; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.client.multiplayer.ClientLevel; +import net.minecraft.client.renderer.item.ItemProperties; +import net.minecraft.client.renderer.item.ItemPropertyFunction; +import net.minecraft.client.resources.model.BakedModel; +import net.minecraft.client.resources.model.BlockModelRotation; +import net.minecraft.client.resources.model.ModelBaker; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.item.ItemStack; +import org.jetbrains.annotations.Nullable; + +@Environment(EnvType.CLIENT) +public class BakedOverrides { + public static final BakedOverrides EMPTY = new BakedOverrides(); + public static final float NO_OVERRIDE = Float.NEGATIVE_INFINITY; + private final BakedOverrides.BakedOverride[] overrides; + private final ResourceLocation[] properties; + + private BakedOverrides() { + this.overrides = new BakedOverrides.BakedOverride[0]; + this.properties = new ResourceLocation[0]; + } + + public BakedOverrides(ModelBaker modelBaker, List list) { + this.properties = (ResourceLocation[])list.stream() + .flatMap(itemOverridex -> itemOverridex.predicates().stream()) + .map(ItemOverride.Predicate::property) + .distinct() + .toArray(ResourceLocation[]::new); + Object2IntMap object2IntMap = new Object2IntOpenHashMap<>(); + + for (int i = 0; i < this.properties.length; i++) { + object2IntMap.put(this.properties[i], i); + } + + List list2 = Lists.newArrayList(); + + for (int j = list.size() - 1; j >= 0; j--) { + ItemOverride itemOverride = (ItemOverride)list.get(j); + BakedModel bakedModel = modelBaker.bake(itemOverride.model(), BlockModelRotation.X0_Y0); + BakedOverrides.PropertyMatcher[] propertyMatchers = (BakedOverrides.PropertyMatcher[])itemOverride.predicates().stream().map(predicate -> { + int i = object2IntMap.getInt(predicate.property()); + return new BakedOverrides.PropertyMatcher(i, predicate.value()); + }).toArray(BakedOverrides.PropertyMatcher[]::new); + list2.add(new BakedOverrides.BakedOverride(propertyMatchers, bakedModel)); + } + + this.overrides = (BakedOverrides.BakedOverride[])list2.toArray(new BakedOverrides.BakedOverride[0]); + } + + @Nullable + public BakedModel findOverride(ItemStack itemStack, @Nullable ClientLevel clientLevel, @Nullable LivingEntity livingEntity, int i) { + int j = this.properties.length; + if (j != 0) { + float[] fs = new float[j]; + + for (int k = 0; k < j; k++) { + ResourceLocation resourceLocation = this.properties[k]; + ItemPropertyFunction itemPropertyFunction = ItemProperties.getProperty(itemStack, resourceLocation); + if (itemPropertyFunction != null) { + fs[k] = itemPropertyFunction.call(itemStack, clientLevel, livingEntity, i); + } else { + fs[k] = Float.NEGATIVE_INFINITY; + } + } + + for (BakedOverrides.BakedOverride bakedOverride : this.overrides) { + if (bakedOverride.test(fs)) { + return bakedOverride.model; + } + } + } + + return null; + } + + @Environment(EnvType.CLIENT) + record BakedOverride(BakedOverrides.PropertyMatcher[] matchers, @Nullable BakedModel model) { + + boolean test(float[] fs) { + for (BakedOverrides.PropertyMatcher propertyMatcher : this.matchers) { + float f = fs[propertyMatcher.index]; + if (f < propertyMatcher.value) { + return false; + } + } + + return true; + } + } + + @Environment(EnvType.CLIENT) + record PropertyMatcher(int index, float value) { + } +} diff --git a/net/minecraft/client/renderer/block/model/BakedQuad.java b/net/minecraft/client/renderer/block/model/BakedQuad.java index 6eefcd94..380cd182 100644 --- a/net/minecraft/client/renderer/block/model/BakedQuad.java +++ b/net/minecraft/client/renderer/block/model/BakedQuad.java @@ -15,13 +15,15 @@ public class BakedQuad { protected final Direction direction; protected final TextureAtlasSprite sprite; private final boolean shade; + private final int lightEmission; - public BakedQuad(int[] vertices, int tintIndex, Direction direction, TextureAtlasSprite sprite, boolean shade) { - this.vertices = vertices; - this.tintIndex = tintIndex; + public BakedQuad(int[] is, int i, Direction direction, TextureAtlasSprite textureAtlasSprite, boolean bl, int j) { + this.vertices = is; + this.tintIndex = i; this.direction = direction; - this.sprite = sprite; - this.shade = shade; + this.sprite = textureAtlasSprite; + this.shade = bl; + this.lightEmission = j; } public TextureAtlasSprite getSprite() { @@ -47,4 +49,8 @@ public class BakedQuad { public boolean isShade() { return this.shade; } + + public int getLightEmission() { + return this.lightEmission; + } } diff --git a/net/minecraft/client/renderer/block/model/BlockElement.java b/net/minecraft/client/renderer/block/model/BlockElement.java index 9511507a..2e146dcb 100644 --- a/net/minecraft/client/renderer/block/model/BlockElement.java +++ b/net/minecraft/client/renderer/block/model/BlockElement.java @@ -29,13 +29,21 @@ public class BlockElement { public final Map faces; public final BlockElementRotation rotation; public final boolean shade; + public final int lightEmission; - public BlockElement(Vector3f from, Vector3f to, Map faces, @Nullable BlockElementRotation rotation, boolean shade) { - this.from = from; - this.to = to; - this.faces = faces; - this.rotation = rotation; - this.shade = shade; + public BlockElement(Vector3f vector3f, Vector3f vector3f2, Map map) { + this(vector3f, vector3f2, map, null, true, 0); + } + + public BlockElement( + Vector3f vector3f, Vector3f vector3f2, Map map, @Nullable BlockElementRotation blockElementRotation, boolean bl, int i + ) { + this.from = vector3f; + this.to = vector3f2; + this.faces = map; + this.rotation = blockElementRotation; + this.shade = bl; + this.lightEmission = i; this.fillUvs(); } @@ -67,6 +75,7 @@ public class BlockElement { @Environment(EnvType.CLIENT) protected static class Deserializer implements JsonDeserializer { private static final boolean DEFAULT_SHADE = true; + private static final int DEFAULT_LIGHT_EMISSION = 0; public BlockElement deserialize(JsonElement json, Type type, JsonDeserializationContext context) throws JsonParseException { JsonObject jsonObject = json.getAsJsonObject(); @@ -78,7 +87,19 @@ public class BlockElement { throw new JsonParseException("Expected shade to be a Boolean"); } else { boolean bl = GsonHelper.getAsBoolean(jsonObject, "shade", true); - return new BlockElement(vector3f, vector3f2, map, blockElementRotation, bl); + int i = 0; + if (jsonObject.has("light_emission")) { + boolean bl2 = GsonHelper.isNumberValue(jsonObject, "light_emission"); + if (bl2) { + i = GsonHelper.getAsInt(jsonObject, "light_emission"); + } + + if (!bl2 || i < 0 || i > 15) { + throw new JsonParseException("Expected light_emission to be an Integer between (inclusive) 0 and 15"); + } + } + + return new BlockElement(vector3f, vector3f2, map, blockElementRotation, bl, i); } } diff --git a/net/minecraft/client/renderer/block/model/BlockModel.java b/net/minecraft/client/renderer/block/model/BlockModel.java index bfd39ce7..bba1d9c7 100644 --- a/net/minecraft/client/renderer/block/model/BlockModel.java +++ b/net/minecraft/client/renderer/block/model/BlockModel.java @@ -4,7 +4,6 @@ import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Joiner; import com.google.common.collect.Lists; import com.google.common.collect.Maps; -import com.google.common.collect.Sets; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.JsonDeserializationContext; @@ -15,17 +14,12 @@ import com.google.gson.JsonParseException; import com.mojang.datafixers.util.Either; import com.mojang.logging.LogUtils; import java.io.Reader; -import java.io.StringReader; import java.lang.reflect.Type; -import java.util.Collection; import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Optional; -import java.util.Set; import java.util.Map.Entry; import java.util.function.Function; -import java.util.stream.Collectors; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.renderer.texture.MissingTextureAtlasSprite; @@ -35,9 +29,9 @@ import net.minecraft.client.resources.model.BakedModel; import net.minecraft.client.resources.model.BuiltInModel; import net.minecraft.client.resources.model.Material; import net.minecraft.client.resources.model.ModelBaker; -import net.minecraft.client.resources.model.ModelBakery; import net.minecraft.client.resources.model.ModelState; import net.minecraft.client.resources.model.SimpleBakedModel; +import net.minecraft.client.resources.model.SpecialModels; import net.minecraft.client.resources.model.UnbakedModel; import net.minecraft.core.Direction; import net.minecraft.resources.ResourceLocation; @@ -63,6 +57,7 @@ public class BlockModel implements UnbakedModel { private static final char REFERENCE_CHAR = '#'; public static final String PARTICLE_TEXTURE_REFERENCE = "particle"; private static final boolean DEFAULT_AMBIENT_OCCLUSION = true; + public static final Material MISSING_MATERIAL = new Material(TextureAtlas.LOCATION_BLOCKS, MissingTextureAtlasSprite.getLocation()); private final List elements; @Nullable private final BlockModel.GuiLight guiLight; @@ -82,10 +77,6 @@ public class BlockModel implements UnbakedModel { return GsonHelper.fromJson(GSON, reader, BlockModel.class); } - public static BlockModel fromString(String jsonString) { - return fromStream(new StringReader(jsonString)); - } - public BlockModel( @Nullable ResourceLocation parentLocation, List elements, @@ -132,88 +123,39 @@ public class BlockModel implements UnbakedModel { return this.overrides; } - private ItemOverrides getItemOverrides(ModelBaker baker, BlockModel model) { - return this.overrides.isEmpty() ? ItemOverrides.EMPTY : new ItemOverrides(baker, model, this.overrides); - } - @Override - public Collection getDependencies() { - Set set = Sets.newHashSet(); - - for (ItemOverride itemOverride : this.overrides) { - set.add(itemOverride.getModel()); - } - + public void resolveDependencies(UnbakedModel.Resolver resolver) { if (this.parentLocation != null) { - set.add(this.parentLocation); - } - - return set; - } - - @Override - public void resolveParents(Function resolver) { - Set set = Sets.newLinkedHashSet(); - - for (BlockModel blockModel = this; blockModel.parentLocation != null && blockModel.parent == null; blockModel = blockModel.parent) { - set.add(blockModel); - UnbakedModel unbakedModel = (UnbakedModel)resolver.apply(blockModel.parentLocation); - if (unbakedModel == null) { - LOGGER.warn("No parent '{}' while loading model '{}'", this.parentLocation, blockModel); - } - - if (set.contains(unbakedModel)) { - LOGGER.warn( - "Found 'parent' loop while loading model '{}' in chain: {} -> {}", - blockModel, - set.stream().map(Object::toString).collect(Collectors.joining(" -> ")), - this.parentLocation - ); - unbakedModel = null; - } - - if (unbakedModel == null) { - blockModel.parentLocation = ModelBakery.MISSING_MODEL_LOCATION; - unbakedModel = (UnbakedModel)resolver.apply(blockModel.parentLocation); - } - - if (!(unbakedModel instanceof BlockModel)) { + if (!(resolver.resolve(this.parentLocation) instanceof BlockModel blockModel)) { throw new IllegalStateException("BlockModel parent has to be a block model."); } - blockModel.parent = (BlockModel)unbakedModel; + this.parent = blockModel; } - - this.overrides.forEach(itemOverride -> { - UnbakedModel unbakedModelx = (UnbakedModel)resolver.apply(itemOverride.getModel()); - if (!Objects.equals(unbakedModelx, this)) { - unbakedModelx.resolveParents(resolver); - } - }); } @Override public BakedModel bake(ModelBaker baker, Function spriteGetter, ModelState state) { - return this.bake(baker, this, spriteGetter, state, true); + return this.bake(spriteGetter, state, true); } - public BakedModel bake(ModelBaker baker, BlockModel model, Function spriteGetter, ModelState state, boolean guiLight3d) { - TextureAtlasSprite textureAtlasSprite = (TextureAtlasSprite)spriteGetter.apply(this.getMaterial("particle")); - if (this.getRootModel() == ModelBakery.BLOCK_ENTITY_MARKER) { - return new BuiltInModel(this.getTransforms(), this.getItemOverrides(baker, model), textureAtlasSprite, this.getGuiLight().lightLikeBlock()); + public BakedModel bake(Function function, ModelState modelState, boolean bl) { + TextureAtlasSprite textureAtlasSprite = (TextureAtlasSprite)function.apply(this.getMaterial("particle")); + if (this.getRootModel() == SpecialModels.BLOCK_ENTITY_MARKER) { + return new BuiltInModel(this.getTransforms(), textureAtlasSprite, this.getGuiLight().lightLikeBlock()); } else { - SimpleBakedModel.Builder builder = new SimpleBakedModel.Builder(this, this.getItemOverrides(baker, model), guiLight3d).particle(textureAtlasSprite); + SimpleBakedModel.Builder builder = new SimpleBakedModel.Builder(this, bl).particle(textureAtlasSprite); for (BlockElement blockElement : this.getElements()) { for (Direction direction : blockElement.faces.keySet()) { BlockElementFace blockElementFace = (BlockElementFace)blockElement.faces.get(direction); - TextureAtlasSprite textureAtlasSprite2 = (TextureAtlasSprite)spriteGetter.apply(this.getMaterial(blockElementFace.texture())); + TextureAtlasSprite textureAtlasSprite2 = (TextureAtlasSprite)function.apply(this.getMaterial(blockElementFace.texture())); if (blockElementFace.cullForDirection() == null) { - builder.addUnculledFace(bakeFace(blockElement, blockElementFace, textureAtlasSprite2, direction, state)); + builder.addUnculledFace(bakeFace(blockElement, blockElementFace, textureAtlasSprite2, direction, modelState)); } else { builder.addCulledFace( - Direction.rotate(state.getRotation().getMatrix(), blockElementFace.cullForDirection()), - bakeFace(blockElement, blockElementFace, textureAtlasSprite2, direction, state) + Direction.rotate(modelState.getRotation().getMatrix(), blockElementFace.cullForDirection()), + bakeFace(blockElement, blockElementFace, textureAtlasSprite2, direction, modelState) ); } } @@ -224,7 +166,7 @@ public class BlockModel implements UnbakedModel { } private static BakedQuad bakeFace(BlockElement element, BlockElementFace face, TextureAtlasSprite sprite, Direction facing, ModelState state) { - return FACE_BAKERY.bakeQuad(element.from, element.to, face, sprite, facing, state, element.rotation, element.shade); + return FACE_BAKERY.bakeQuad(element.from, element.to, face, sprite, facing, state, element.rotation, element.shade, element.lightEmission); } public boolean hasTexture(String textureName) { @@ -248,7 +190,7 @@ public class BlockModel implements UnbakedModel { name = (String)either.right().get(); if (list.contains(name)) { LOGGER.warn("Unable to resolve texture due to reference chain {}->{} in {}", Joiner.on("->").join(list), name, this.name); - return new Material(TextureAtlas.LOCATION_BLOCKS, MissingTextureAtlasSprite.getLocation()); + return MISSING_MATERIAL; } list.add(name); @@ -263,7 +205,7 @@ public class BlockModel implements UnbakedModel { } } - return Either.left(new Material(TextureAtlas.LOCATION_BLOCKS, MissingTextureAtlasSprite.getLocation())); + return Either.left(MISSING_MATERIAL); } static boolean isTextureReference(String str) { @@ -404,11 +346,4 @@ public class BlockModel implements UnbakedModel { return this == SIDE; } } - - @Environment(EnvType.CLIENT) - public static class LoopException extends RuntimeException { - public LoopException(String message) { - super(message); - } - } } diff --git a/net/minecraft/client/renderer/block/model/BlockModelDefinition.java b/net/minecraft/client/renderer/block/model/BlockModelDefinition.java index b1617895..02397d1a 100644 --- a/net/minecraft/client/renderer/block/model/BlockModelDefinition.java +++ b/net/minecraft/client/renderer/block/model/BlockModelDefinition.java @@ -11,60 +11,52 @@ import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonParseException; +import com.mojang.logging.LogUtils; import java.io.Reader; import java.lang.reflect.Type; +import java.util.IdentityHashMap; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.Set; import java.util.Map.Entry; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.renderer.block.model.multipart.MultiPart; import net.minecraft.client.renderer.block.model.multipart.Selector; +import net.minecraft.client.resources.model.UnbakedModel; import net.minecraft.util.GsonHelper; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; import org.jetbrains.annotations.Nullable; +import org.slf4j.Logger; @Environment(EnvType.CLIENT) public class BlockModelDefinition { - private final Map variants = Maps.newLinkedHashMap(); - private MultiPart multiPart; + private static final Logger LOGGER = LogUtils.getLogger(); + public static final Gson GSON = new GsonBuilder() + .registerTypeAdapter(BlockModelDefinition.class, new BlockModelDefinition.Deserializer()) + .registerTypeAdapter(Variant.class, new Variant.Deserializer()) + .registerTypeAdapter(MultiVariant.class, new MultiVariant.Deserializer()) + .registerTypeAdapter(MultiPart.Definition.class, new MultiPart.Deserializer()) + .registerTypeAdapter(Selector.class, new Selector.Deserializer()) + .create(); + private final Map variants; + @Nullable + private final MultiPart.Definition multiPart; - public static BlockModelDefinition fromStream(BlockModelDefinition.Context context, Reader reader) { - return GsonHelper.fromJson(context.gson, reader, BlockModelDefinition.class); + public static BlockModelDefinition fromStream(Reader reader) { + return GsonHelper.fromJson(GSON, reader, BlockModelDefinition.class); } - public static BlockModelDefinition fromJsonElement(BlockModelDefinition.Context context, JsonElement json) { - return context.gson.fromJson(json, BlockModelDefinition.class); + public static BlockModelDefinition fromJsonElement(JsonElement jsonElement) { + return GSON.fromJson(jsonElement, BlockModelDefinition.class); } - public BlockModelDefinition(Map variants, MultiPart multiPart) { - this.multiPart = multiPart; - this.variants.putAll(variants); - } - - public BlockModelDefinition(List modelDefinitions) { - BlockModelDefinition blockModelDefinition = null; - - for (BlockModelDefinition blockModelDefinition2 : modelDefinitions) { - if (blockModelDefinition2.isMultiPart()) { - this.variants.clear(); - blockModelDefinition = blockModelDefinition2; - } - - this.variants.putAll(blockModelDefinition2.variants); - } - - if (blockModelDefinition != null) { - this.multiPart = blockModelDefinition.multiPart; - } - } - - @VisibleForTesting - public boolean hasVariant(String key) { - return this.variants.get(key) != null; + public BlockModelDefinition(Map map, @Nullable MultiPart.Definition definition) { + this.multiPart = definition; + this.variants = map; } @VisibleForTesting @@ -80,57 +72,57 @@ public class BlockModelDefinition { public boolean equals(Object object) { if (this == object) { return true; - } else if (object instanceof BlockModelDefinition blockModelDefinition && this.variants.equals(blockModelDefinition.variants)) { - return this.isMultiPart() ? this.multiPart.equals(blockModelDefinition.multiPart) : !blockModelDefinition.isMultiPart(); } else { - return false; + return !(object instanceof BlockModelDefinition blockModelDefinition) + ? false + : this.variants.equals(blockModelDefinition.variants) && Objects.equals(this.multiPart, blockModelDefinition.multiPart); } } public int hashCode() { - return 31 * this.variants.hashCode() + (this.isMultiPart() ? this.multiPart.hashCode() : 0); - } - - public Map getVariants() { - return this.variants; + return 31 * this.variants.hashCode() + (this.multiPart != null ? this.multiPart.hashCode() : 0); } @VisibleForTesting public Set getMultiVariants() { Set set = Sets.newHashSet(this.variants.values()); - if (this.isMultiPart()) { + if (this.multiPart != null) { set.addAll(this.multiPart.getMultiVariants()); } return set; } - public boolean isMultiPart() { - return this.multiPart != null; - } - - public MultiPart getMultiPart() { + @Nullable + public MultiPart.Definition getMultiPart() { return this.multiPart; } - @Environment(EnvType.CLIENT) - public static final class Context { - protected final Gson gson = new GsonBuilder() - .registerTypeAdapter(BlockModelDefinition.class, new BlockModelDefinition.Deserializer()) - .registerTypeAdapter(Variant.class, new Variant.Deserializer()) - .registerTypeAdapter(MultiVariant.class, new MultiVariant.Deserializer()) - .registerTypeAdapter(MultiPart.class, new MultiPart.Deserializer(this)) - .registerTypeAdapter(Selector.class, new Selector.Deserializer()) - .create(); - private StateDefinition definition; - - public StateDefinition getDefinition() { - return this.definition; + public Map instantiate(StateDefinition stateDefinition, String string) { + Map map = new IdentityHashMap(); + List list = stateDefinition.getPossibleStates(); + MultiPart multiPart; + if (this.multiPart != null) { + multiPart = this.multiPart.instantiate(stateDefinition); + list.forEach(blockState -> map.put(blockState, multiPart)); + } else { + multiPart = null; } - public void setDefinition(StateDefinition stateContainer) { - this.definition = stateContainer; - } + this.variants.forEach((string2, multiVariant) -> { + try { + list.stream().filter(VariantSelector.predicate(stateDefinition, string2)).forEach(blockState -> { + UnbakedModel unbakedModel = (UnbakedModel)map.put(blockState, multiVariant); + if (unbakedModel != null && unbakedModel != multiPart) { + String stringxx = (String)((Entry)this.variants.entrySet().stream().filter(entry -> entry.getValue() == unbakedModel).findFirst().get()).getKey(); + throw new RuntimeException("Overlapping definition with: " + stringxx); + } + }); + } catch (Exception var9) { + LOGGER.warn("Exception loading blockstate definition: '{}' for variant: '{}': {}", string, string2, var9.getMessage()); + } + }); + return map; } @Environment(EnvType.CLIENT) @@ -138,11 +130,11 @@ public class BlockModelDefinition { public BlockModelDefinition deserialize(JsonElement json, Type type, JsonDeserializationContext context) throws JsonParseException { JsonObject jsonObject = json.getAsJsonObject(); Map map = this.getVariants(context, jsonObject); - MultiPart multiPart = this.getMultiPart(context, jsonObject); - if (!map.isEmpty() || multiPart != null && !multiPart.getMultiVariants().isEmpty()) { - return new BlockModelDefinition(map, multiPart); - } else { + MultiPart.Definition definition = this.getMultiPart(context, jsonObject); + if (map.isEmpty() && definition == null) { throw new JsonParseException("Neither 'variants' nor 'multipart' found"); + } else { + return new BlockModelDefinition(map, definition); } } @@ -160,17 +152,17 @@ public class BlockModelDefinition { } @Nullable - protected MultiPart getMultiPart(JsonDeserializationContext context, JsonObject json) { - if (!json.has("multipart")) { + protected MultiPart.Definition getMultiPart(JsonDeserializationContext jsonDeserializationContext, JsonObject jsonObject) { + if (!jsonObject.has("multipart")) { return null; } else { - JsonArray jsonArray = GsonHelper.getAsJsonArray(json, "multipart"); - return context.deserialize(jsonArray, MultiPart.class); + JsonArray jsonArray = GsonHelper.getAsJsonArray(jsonObject, "multipart"); + return jsonDeserializationContext.deserialize(jsonArray, MultiPart.Definition.class); } } } @Environment(EnvType.CLIENT) - protected class MissingVariantException extends RuntimeException { + protected static class MissingVariantException extends RuntimeException { } } diff --git a/net/minecraft/client/renderer/block/model/FaceBakery.java b/net/minecraft/client/renderer/block/model/FaceBakery.java index 90203d7b..e4ea0239 100644 --- a/net/minecraft/client/renderer/block/model/FaceBakery.java +++ b/net/minecraft/client/renderer/block/model/FaceBakery.java @@ -4,6 +4,8 @@ import com.mojang.math.Transformation; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.renderer.FaceInfo; +import net.minecraft.client.renderer.FaceInfo.Constants; +import net.minecraft.client.renderer.FaceInfo.VertexInfo; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.resources.model.ModelState; import net.minecraft.core.BlockMath; @@ -27,37 +29,38 @@ public class FaceBakery { public static final int UV_INDEX = 4; public BakedQuad bakeQuad( - Vector3f posFrom, - Vector3f posTo, - BlockElementFace face, - TextureAtlasSprite sprite, - Direction facing, - ModelState transform, - @Nullable BlockElementRotation rotation, - boolean shade + Vector3f vector3f, + Vector3f vector3f2, + BlockElementFace blockElementFace, + TextureAtlasSprite textureAtlasSprite, + Direction direction, + ModelState modelState, + @Nullable BlockElementRotation blockElementRotation, + boolean bl, + int i ) { - BlockFaceUV blockFaceUV = face.uv(); - if (transform.isUvLocked()) { - blockFaceUV = recomputeUVs(face.uv(), facing, transform.getRotation()); + BlockFaceUV blockFaceUV = blockElementFace.uv(); + if (modelState.isUvLocked()) { + blockFaceUV = recomputeUVs(blockElementFace.uv(), direction, modelState.getRotation()); } float[] fs = new float[blockFaceUV.uvs.length]; System.arraycopy(blockFaceUV.uvs, 0, fs, 0, fs.length); - float f = sprite.uvShrinkRatio(); + float f = textureAtlasSprite.uvShrinkRatio(); float g = (blockFaceUV.uvs[0] + blockFaceUV.uvs[0] + blockFaceUV.uvs[2] + blockFaceUV.uvs[2]) / 4.0F; float h = (blockFaceUV.uvs[1] + blockFaceUV.uvs[1] + blockFaceUV.uvs[3] + blockFaceUV.uvs[3]) / 4.0F; blockFaceUV.uvs[0] = Mth.lerp(f, blockFaceUV.uvs[0], g); blockFaceUV.uvs[2] = Mth.lerp(f, blockFaceUV.uvs[2], g); blockFaceUV.uvs[1] = Mth.lerp(f, blockFaceUV.uvs[1], h); blockFaceUV.uvs[3] = Mth.lerp(f, blockFaceUV.uvs[3], h); - int[] is = this.makeVertices(blockFaceUV, sprite, facing, this.setupShape(posFrom, posTo), transform.getRotation(), rotation, shade); - Direction direction = calculateFacing(is); + int[] is = this.makeVertices(blockFaceUV, textureAtlasSprite, direction, this.setupShape(vector3f, vector3f2), modelState.getRotation(), blockElementRotation); + Direction direction2 = calculateFacing(is); System.arraycopy(fs, 0, blockFaceUV.uvs, 0, fs.length); - if (rotation == null) { - this.recalculateWinding(is, direction); + if (blockElementRotation == null) { + this.recalculateWinding(is, direction2); } - return new BakedQuad(is, face.tintIndex(), direction, sprite, shade); + return new BakedQuad(is, blockElementFace.tintIndex(), direction2, textureAtlasSprite, bl, i); } public static BlockFaceUV recomputeUVs(BlockFaceUV uv, Direction facing, Transformation rotation) { @@ -100,18 +103,17 @@ public class FaceBakery { } private int[] makeVertices( - BlockFaceUV uvs, - TextureAtlasSprite sprite, - Direction orientation, - float[] posDiv16, - Transformation rotation, - @Nullable BlockElementRotation partRotation, - boolean shade + BlockFaceUV blockFaceUV, + TextureAtlasSprite textureAtlasSprite, + Direction direction, + float[] fs, + Transformation transformation, + @Nullable BlockElementRotation blockElementRotation ) { int[] is = new int[32]; for (int i = 0; i < 4; i++) { - this.bakeVertex(is, i, orientation, uvs, posDiv16, sprite, rotation, partRotation, shade); + this.bakeVertex(is, i, direction, blockFaceUV, fs, textureAtlasSprite, transformation, blockElementRotation); } return is; @@ -119,31 +121,30 @@ public class FaceBakery { private float[] setupShape(Vector3f min, Vector3f max) { float[] fs = new float[Direction.values().length]; - fs[FaceInfo.Constants.MIN_X] = min.x() / 16.0F; - fs[FaceInfo.Constants.MIN_Y] = min.y() / 16.0F; - fs[FaceInfo.Constants.MIN_Z] = min.z() / 16.0F; - fs[FaceInfo.Constants.MAX_X] = max.x() / 16.0F; - fs[FaceInfo.Constants.MAX_Y] = max.y() / 16.0F; - fs[FaceInfo.Constants.MAX_Z] = max.z() / 16.0F; + fs[Constants.MIN_X] = min.x() / 16.0F; + fs[Constants.MIN_Y] = min.y() / 16.0F; + fs[Constants.MIN_Z] = min.z() / 16.0F; + fs[Constants.MAX_X] = max.x() / 16.0F; + fs[Constants.MAX_Y] = max.y() / 16.0F; + fs[Constants.MAX_Z] = max.z() / 16.0F; return fs; } private void bakeVertex( - int[] vertexData, - int vertexIndex, - Direction facing, + int[] is, + int i, + Direction direction, BlockFaceUV blockFaceUV, - float[] posDiv16, - TextureAtlasSprite sprite, - Transformation rotation, - @Nullable BlockElementRotation partRotation, - boolean shade + float[] fs, + TextureAtlasSprite textureAtlasSprite, + Transformation transformation, + @Nullable BlockElementRotation blockElementRotation ) { - FaceInfo.VertexInfo vertexInfo = FaceInfo.fromFacing(facing).getVertexInfo(vertexIndex); - Vector3f vector3f = new Vector3f(posDiv16[vertexInfo.xFace], posDiv16[vertexInfo.yFace], posDiv16[vertexInfo.zFace]); - this.applyElementRotation(vector3f, partRotation); - this.applyModelRotation(vector3f, rotation); - this.fillVertex(vertexData, vertexIndex, vector3f, sprite, blockFaceUV); + VertexInfo vertexInfo = FaceInfo.fromFacing(direction).getVertexInfo(i); + Vector3f vector3f = new Vector3f(fs[vertexInfo.xFace], fs[vertexInfo.yFace], fs[vertexInfo.zFace]); + this.applyElementRotation(vector3f, blockElementRotation); + this.applyModelRotation(vector3f, transformation); + this.fillVertex(is, i, vector3f, textureAtlasSprite, blockFaceUV); } private void fillVertex(int[] vertexData, int vertexIndex, Vector3f vector, TextureAtlasSprite sprite, BlockFaceUV blockFaceUV) { @@ -220,7 +221,7 @@ public class FaceBakery { float f = 0.0F; for (Direction direction2 : Direction.values()) { - Vec3i vec3i = direction2.getNormal(); + Vec3i vec3i = direction2.getUnitVec3i(); Vector3f vector3f7 = new Vector3f(vec3i.getX(), vec3i.getY(), vec3i.getZ()); float g = vector3f6.dot(vector3f7); if (g >= 0.0F && g > f) { @@ -237,40 +238,40 @@ public class FaceBakery { int[] is = new int[vertices.length]; System.arraycopy(vertices, 0, is, 0, vertices.length); float[] fs = new float[Direction.values().length]; - fs[FaceInfo.Constants.MIN_X] = 999.0F; - fs[FaceInfo.Constants.MIN_Y] = 999.0F; - fs[FaceInfo.Constants.MIN_Z] = 999.0F; - fs[FaceInfo.Constants.MAX_X] = -999.0F; - fs[FaceInfo.Constants.MAX_Y] = -999.0F; - fs[FaceInfo.Constants.MAX_Z] = -999.0F; + fs[Constants.MIN_X] = 999.0F; + fs[Constants.MIN_Y] = 999.0F; + fs[Constants.MIN_Z] = 999.0F; + fs[Constants.MAX_X] = -999.0F; + fs[Constants.MAX_Y] = -999.0F; + fs[Constants.MAX_Z] = -999.0F; for (int i = 0; i < 4; i++) { int j = 8 * i; float f = Float.intBitsToFloat(is[j]); float g = Float.intBitsToFloat(is[j + 1]); float h = Float.intBitsToFloat(is[j + 2]); - if (f < fs[FaceInfo.Constants.MIN_X]) { - fs[FaceInfo.Constants.MIN_X] = f; + if (f < fs[Constants.MIN_X]) { + fs[Constants.MIN_X] = f; } - if (g < fs[FaceInfo.Constants.MIN_Y]) { - fs[FaceInfo.Constants.MIN_Y] = g; + if (g < fs[Constants.MIN_Y]) { + fs[Constants.MIN_Y] = g; } - if (h < fs[FaceInfo.Constants.MIN_Z]) { - fs[FaceInfo.Constants.MIN_Z] = h; + if (h < fs[Constants.MIN_Z]) { + fs[Constants.MIN_Z] = h; } - if (f > fs[FaceInfo.Constants.MAX_X]) { - fs[FaceInfo.Constants.MAX_X] = f; + if (f > fs[Constants.MAX_X]) { + fs[Constants.MAX_X] = f; } - if (g > fs[FaceInfo.Constants.MAX_Y]) { - fs[FaceInfo.Constants.MAX_Y] = g; + if (g > fs[Constants.MAX_Y]) { + fs[Constants.MAX_Y] = g; } - if (h > fs[FaceInfo.Constants.MAX_Z]) { - fs[FaceInfo.Constants.MAX_Z] = h; + if (h > fs[Constants.MAX_Z]) { + fs[Constants.MAX_Z] = h; } } @@ -278,7 +279,7 @@ public class FaceBakery { for (int jx = 0; jx < 4; jx++) { int k = 8 * jx; - FaceInfo.VertexInfo vertexInfo = faceInfo.getVertexInfo(jx); + VertexInfo vertexInfo = faceInfo.getVertexInfo(jx); float hx = fs[vertexInfo.xFace]; float l = fs[vertexInfo.yFace]; float m = fs[vertexInfo.zFace]; diff --git a/net/minecraft/client/renderer/block/model/ItemModelGenerator.java b/net/minecraft/client/renderer/block/model/ItemModelGenerator.java index b20b5bb2..05fb5ec1 100644 --- a/net/minecraft/client/renderer/block/model/ItemModelGenerator.java +++ b/net/minecraft/client/renderer/block/model/ItemModelGenerator.java @@ -47,7 +47,7 @@ public class ItemModelGenerator { map.put(Direction.SOUTH, new BlockElementFace(null, tintIndex, texture, new BlockFaceUV(new float[]{0.0F, 0.0F, 16.0F, 16.0F}, 0))); map.put(Direction.NORTH, new BlockElementFace(null, tintIndex, texture, new BlockFaceUV(new float[]{16.0F, 0.0F, 0.0F, 16.0F}, 0))); List list = Lists.newArrayList(); - list.add(new BlockElement(new Vector3f(0.0F, 0.0F, 7.5F), new Vector3f(16.0F, 16.0F, 8.5F), map, null, true)); + list.add(new BlockElement(new Vector3f(0.0F, 0.0F, 7.5F), new Vector3f(16.0F, 16.0F, 8.5F), map)); list.addAll(this.createSideElements(sprite, texture, tintIndex)); return list; } @@ -124,16 +124,16 @@ public class ItemModelGenerator { map.put(spanFacing.getDirection(), new BlockElementFace(null, tintIndex, texture, new BlockFaceUV(new float[]{l, n, m, o}, 0))); switch (spanFacing) { case UP: - list.add(new BlockElement(new Vector3f(h, i, 7.5F), new Vector3f(j, i, 8.5F), map, null, true)); + list.add(new BlockElement(new Vector3f(h, i, 7.5F), new Vector3f(j, i, 8.5F), map)); break; case DOWN: - list.add(new BlockElement(new Vector3f(h, k, 7.5F), new Vector3f(j, k, 8.5F), map, null, true)); + list.add(new BlockElement(new Vector3f(h, k, 7.5F), new Vector3f(j, k, 8.5F), map)); break; case LEFT: - list.add(new BlockElement(new Vector3f(h, i, 7.5F), new Vector3f(h, k, 8.5F), map, null, true)); + list.add(new BlockElement(new Vector3f(h, i, 7.5F), new Vector3f(h, k, 8.5F), map)); break; case RIGHT: - list.add(new BlockElement(new Vector3f(j, i, 7.5F), new Vector3f(j, k, 8.5F), map, null, true)); + list.add(new BlockElement(new Vector3f(j, i, 7.5F), new Vector3f(j, k, 8.5F), map)); } } diff --git a/net/minecraft/client/renderer/block/model/ItemOverride.java b/net/minecraft/client/renderer/block/model/ItemOverride.java index b5e9e0dd..cd13c2f4 100644 --- a/net/minecraft/client/renderer/block/model/ItemOverride.java +++ b/net/minecraft/client/renderer/block/model/ItemOverride.java @@ -11,31 +11,17 @@ import java.lang.reflect.Type; import java.util.List; import java.util.Map; import java.util.Map.Entry; -import java.util.stream.Stream; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.resources.ResourceLocation; import net.minecraft.util.GsonHelper; @Environment(EnvType.CLIENT) -public class ItemOverride { - private final ResourceLocation model; - private final List predicates; - +public record ItemOverride(ResourceLocation model, List predicates) { public ItemOverride(ResourceLocation model, List predicates) { + predicates = List.copyOf(predicates); this.model = model; - this.predicates = ImmutableList.copyOf(predicates); - } - - /** - * @return the location of the target model - */ - public ResourceLocation getModel() { - return this.model; - } - - public Stream getPredicates() { - return this.predicates.stream(); + this.predicates = predicates; } @Environment(EnvType.CLIENT) @@ -63,21 +49,6 @@ public class ItemOverride { } @Environment(EnvType.CLIENT) - public static class Predicate { - private final ResourceLocation property; - private final float value; - - public Predicate(ResourceLocation property, float value) { - this.property = property; - this.value = value; - } - - public ResourceLocation getProperty() { - return this.property; - } - - public float getValue() { - return this.value; - } + public record Predicate(ResourceLocation property, float value) { } } diff --git a/net/minecraft/client/renderer/block/model/ItemOverrides.java b/net/minecraft/client/renderer/block/model/ItemOverrides.java deleted file mode 100644 index c5f0689b..00000000 --- a/net/minecraft/client/renderer/block/model/ItemOverrides.java +++ /dev/null @@ -1,131 +0,0 @@ -package net.minecraft.client.renderer.block.model; - -import com.google.common.collect.Lists; -import it.unimi.dsi.fastutil.objects.Object2IntMap; -import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; -import java.util.List; -import java.util.Objects; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.client.multiplayer.ClientLevel; -import net.minecraft.client.renderer.item.ItemProperties; -import net.minecraft.client.renderer.item.ItemPropertyFunction; -import net.minecraft.client.resources.model.BakedModel; -import net.minecraft.client.resources.model.BlockModelRotation; -import net.minecraft.client.resources.model.ModelBaker; -import net.minecraft.client.resources.model.UnbakedModel; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.item.ItemStack; -import org.jetbrains.annotations.Nullable; - -@Environment(EnvType.CLIENT) -public class ItemOverrides { - public static final ItemOverrides EMPTY = new ItemOverrides(); - public static final float NO_OVERRIDE = Float.NEGATIVE_INFINITY; - private final ItemOverrides.BakedOverride[] overrides; - private final ResourceLocation[] properties; - - private ItemOverrides() { - this.overrides = new ItemOverrides.BakedOverride[0]; - this.properties = new ResourceLocation[0]; - } - - public ItemOverrides(ModelBaker baker, BlockModel model, List overrides) { - this.properties = (ResourceLocation[])overrides.stream() - .flatMap(ItemOverride::getPredicates) - .map(ItemOverride.Predicate::getProperty) - .distinct() - .toArray(ResourceLocation[]::new); - Object2IntMap object2IntMap = new Object2IntOpenHashMap<>(); - - for (int i = 0; i < this.properties.length; i++) { - object2IntMap.put(this.properties[i], i); - } - - List list = Lists.newArrayList(); - - for (int j = overrides.size() - 1; j >= 0; j--) { - ItemOverride itemOverride = (ItemOverride)overrides.get(j); - BakedModel bakedModel = this.bakeModel(baker, model, itemOverride); - ItemOverrides.PropertyMatcher[] propertyMatchers = (ItemOverrides.PropertyMatcher[])itemOverride.getPredicates().map(predicate -> { - int i = object2IntMap.getInt(predicate.getProperty()); - return new ItemOverrides.PropertyMatcher(i, predicate.getValue()); - }).toArray(ItemOverrides.PropertyMatcher[]::new); - list.add(new ItemOverrides.BakedOverride(propertyMatchers, bakedModel)); - } - - this.overrides = (ItemOverrides.BakedOverride[])list.toArray(new ItemOverrides.BakedOverride[0]); - } - - @Nullable - private BakedModel bakeModel(ModelBaker baker, BlockModel model, ItemOverride override) { - UnbakedModel unbakedModel = baker.getModel(override.getModel()); - return Objects.equals(unbakedModel, model) ? null : baker.bake(override.getModel(), BlockModelRotation.X0_Y0); - } - - @Nullable - public BakedModel resolve(BakedModel model, ItemStack stack, @Nullable ClientLevel level, @Nullable LivingEntity entity, int seed) { - if (this.overrides.length != 0) { - int i = this.properties.length; - float[] fs = new float[i]; - - for (int j = 0; j < i; j++) { - ResourceLocation resourceLocation = this.properties[j]; - ItemPropertyFunction itemPropertyFunction = ItemProperties.getProperty(stack, resourceLocation); - if (itemPropertyFunction != null) { - fs[j] = itemPropertyFunction.call(stack, level, entity, seed); - } else { - fs[j] = Float.NEGATIVE_INFINITY; - } - } - - for (ItemOverrides.BakedOverride bakedOverride : this.overrides) { - if (bakedOverride.test(fs)) { - BakedModel bakedModel = bakedOverride.model; - if (bakedModel == null) { - return model; - } - - return bakedModel; - } - } - } - - return model; - } - - @Environment(EnvType.CLIENT) - static class BakedOverride { - private final ItemOverrides.PropertyMatcher[] matchers; - @Nullable - final BakedModel model; - - BakedOverride(ItemOverrides.PropertyMatcher[] matchers, @Nullable BakedModel model) { - this.matchers = matchers; - this.model = model; - } - - boolean test(float[] properties) { - for (ItemOverrides.PropertyMatcher propertyMatcher : this.matchers) { - float f = properties[propertyMatcher.index]; - if (f < propertyMatcher.value) { - return false; - } - } - - return true; - } - } - - @Environment(EnvType.CLIENT) - static class PropertyMatcher { - public final int index; - public final float value; - - PropertyMatcher(int index, float value) { - this.index = index; - this.value = value; - } - } -} diff --git a/net/minecraft/client/renderer/block/model/MultiVariant.java b/net/minecraft/client/renderer/block/model/MultiVariant.java index 26132264..58c5346a 100644 --- a/net/minecraft/client/renderer/block/model/MultiVariant.java +++ b/net/minecraft/client/renderer/block/model/MultiVariant.java @@ -7,10 +7,8 @@ import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonParseException; import java.lang.reflect.Type; -import java.util.Collection; import java.util.List; import java.util.function.Function; -import java.util.stream.Collectors; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.renderer.texture.TextureAtlasSprite; @@ -20,61 +18,44 @@ import net.minecraft.client.resources.model.ModelBaker; import net.minecraft.client.resources.model.ModelState; import net.minecraft.client.resources.model.UnbakedModel; import net.minecraft.client.resources.model.WeightedBakedModel; -import net.minecraft.resources.ResourceLocation; -import org.jetbrains.annotations.Nullable; +import net.minecraft.util.random.SimpleWeightedRandomList; +import net.minecraft.util.random.SimpleWeightedRandomList.Builder; +import net.minecraft.world.level.block.state.BlockState; @Environment(EnvType.CLIENT) -public class MultiVariant implements UnbakedModel { - private final List variants; - +public record MultiVariant(List variants) implements UnbakedBlockStateModel { public MultiVariant(List variants) { - this.variants = variants; - } - - public List getVariants() { - return this.variants; - } - - public boolean equals(Object object) { - if (this == object) { - return true; + if (variants.isEmpty()) { + throw new IllegalArgumentException("Variant list must contain at least one element"); } else { - return object instanceof MultiVariant multiVariant ? this.variants.equals(multiVariant.variants) : false; + this.variants = variants; } } - public int hashCode() { - return this.variants.hashCode(); + @Override + public Object visualEqualityGroup(BlockState blockState) { + return this; } @Override - public Collection getDependencies() { - return (Collection)this.getVariants().stream().map(Variant::getModelLocation).collect(Collectors.toSet()); + public void resolveDependencies(UnbakedModel.Resolver resolver) { + this.variants.forEach(variant -> resolver.resolve(variant.getModelLocation())); } - @Override - public void resolveParents(Function resolver) { - this.getVariants() - .stream() - .map(Variant::getModelLocation) - .distinct() - .forEach(resourceLocation -> ((UnbakedModel)resolver.apply(resourceLocation)).resolveParents(resolver)); - } - - @Nullable @Override public BakedModel bake(ModelBaker baker, Function spriteGetter, ModelState state) { - if (this.getVariants().isEmpty()) { - return null; + if (this.variants.size() == 1) { + Variant variant = (Variant)this.variants.getFirst(); + return baker.bake(variant.getModelLocation(), variant); } else { - WeightedBakedModel.Builder builder = new WeightedBakedModel.Builder(); + Builder builder = SimpleWeightedRandomList.builder(); - for (Variant variant : this.getVariants()) { - BakedModel bakedModel = baker.bake(variant.getModelLocation(), variant); - builder.add(bakedModel, variant.getWeight()); + for (Variant variant2 : this.variants) { + BakedModel bakedModel = baker.bake(variant2.getModelLocation(), variant2); + builder.add(bakedModel, variant2.getWeight()); } - return builder.build(); + return new WeightedBakedModel(builder.build()); } } @@ -84,7 +65,7 @@ public class MultiVariant implements UnbakedModel { List list = Lists.newArrayList(); if (json.isJsonArray()) { JsonArray jsonArray = json.getAsJsonArray(); - if (jsonArray.size() == 0) { + if (jsonArray.isEmpty()) { throw new JsonParseException("Empty variant array"); } diff --git a/net/minecraft/client/renderer/block/model/UnbakedBlockStateModel.java b/net/minecraft/client/renderer/block/model/UnbakedBlockStateModel.java new file mode 100644 index 00000000..d4dc3723 --- /dev/null +++ b/net/minecraft/client/renderer/block/model/UnbakedBlockStateModel.java @@ -0,0 +1,11 @@ +package net.minecraft.client.renderer.block.model; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.client.resources.model.UnbakedModel; +import net.minecraft.world.level.block.state.BlockState; + +@Environment(EnvType.CLIENT) +public interface UnbakedBlockStateModel extends UnbakedModel { + Object visualEqualityGroup(BlockState blockState); +} diff --git a/net/minecraft/client/renderer/block/model/VariantSelector.java b/net/minecraft/client/renderer/block/model/VariantSelector.java new file mode 100644 index 00000000..05cae2bb --- /dev/null +++ b/net/minecraft/client/renderer/block/model/VariantSelector.java @@ -0,0 +1,59 @@ +package net.minecraft.client.renderer.block.model; + +import com.google.common.base.Splitter; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.Objects; +import java.util.Map.Entry; +import java.util.function.Predicate; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.StateHolder; +import net.minecraft.world.level.block.state.properties.Property; +import org.jetbrains.annotations.Nullable; + +@Environment(EnvType.CLIENT) +public class VariantSelector { + private static final Splitter COMMA_SPLITTER = Splitter.on(','); + private static final Splitter EQUAL_SPLITTER = Splitter.on('=').limit(2); + + public static > Predicate> predicate(StateDefinition stateDefinition, String string) { + Map, Comparable> map = new HashMap(); + + for (String string2 : COMMA_SPLITTER.split(string)) { + Iterator iterator = EQUAL_SPLITTER.split(string2).iterator(); + if (iterator.hasNext()) { + String string3 = (String)iterator.next(); + Property property = stateDefinition.getProperty(string3); + if (property != null && iterator.hasNext()) { + String string4 = (String)iterator.next(); + Comparable comparable = getValueHelper((Property>)property, string4); + if (comparable == null) { + throw new RuntimeException("Unknown value: '" + string4 + "' for blockstate property: '" + string3 + "' " + property.getPossibleValues()); + } + + map.put(property, comparable); + } else if (!string3.isEmpty()) { + throw new RuntimeException("Unknown blockstate property: '" + string3 + "'"); + } + } + } + + return stateHolder -> { + for (Entry, Comparable> entry : map.entrySet()) { + if (!Objects.equals(stateHolder.getValue((Property)entry.getKey()), entry.getValue())) { + return false; + } + } + + return true; + }; + } + + @Nullable + private static > T getValueHelper(Property property, String string) { + return (T)property.getValue(string).orElse(null); + } +} diff --git a/net/minecraft/client/renderer/block/model/multipart/AndCondition.java b/net/minecraft/client/renderer/block/model/multipart/AndCondition.java index 3aaafd8c..ed7e2e84 100644 --- a/net/minecraft/client/renderer/block/model/multipart/AndCondition.java +++ b/net/minecraft/client/renderer/block/model/multipart/AndCondition.java @@ -1,11 +1,10 @@ package net.minecraft.client.renderer.block.model.multipart; import com.google.common.collect.Streams; -import java.util.List; import java.util.function.Predicate; -import java.util.stream.Collectors; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; +import net.minecraft.Util; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; @@ -21,9 +20,6 @@ public class AndCondition implements Condition { @Override public Predicate getPredicate(StateDefinition stateDefinition) { - List> list = (List>)Streams.stream(this.conditions) - .map(condition -> condition.getPredicate(stateDefinition)) - .collect(Collectors.toList()); - return blockState -> list.stream().allMatch(predicate -> predicate.test(blockState)); + return Util.allOf(Streams.stream(this.conditions).map(condition -> condition.getPredicate(stateDefinition)).toList()); } } diff --git a/net/minecraft/client/renderer/block/model/multipart/KeyValueCondition.java b/net/minecraft/client/renderer/block/model/multipart/KeyValueCondition.java index af675637..27676bec 100644 --- a/net/minecraft/client/renderer/block/model/multipart/KeyValueCondition.java +++ b/net/minecraft/client/renderer/block/model/multipart/KeyValueCondition.java @@ -6,9 +6,9 @@ import java.util.List; import java.util.Locale; import java.util.Optional; import java.util.function.Predicate; -import java.util.stream.Collectors; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; +import net.minecraft.Util; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; @@ -45,10 +45,7 @@ public class KeyValueCondition implements Condition { if (list.size() == 1) { predicate = this.getBlockStatePredicate(stateDefinition, property, string); } else { - List> list2 = (List>)list.stream() - .map(stringx -> this.getBlockStatePredicate(stateDefinition, property, stringx)) - .collect(Collectors.toList()); - predicate = blockState -> list2.stream().anyMatch(predicatex -> predicatex.test(blockState)); + predicate = Util.anyOf(list.stream().map(stringx -> this.getBlockStatePredicate(stateDefinition, property, stringx)).toList()); } return bl ? predicate.negate() : predicate; diff --git a/net/minecraft/client/renderer/block/model/multipart/MultiPart.java b/net/minecraft/client/renderer/block/model/multipart/MultiPart.java index efa5321e..65be9618 100644 --- a/net/minecraft/client/renderer/block/model/multipart/MultiPart.java +++ b/net/minecraft/client/renderer/block/model/multipart/MultiPart.java @@ -1,23 +1,24 @@ package net.minecraft.client.renderer.block.model.multipart; -import com.google.common.collect.Lists; -import com.google.common.collect.Sets; import com.google.gson.JsonArray; import com.google.gson.JsonDeserializationContext; import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonParseException; +import com.google.gson.JsonSyntaxException; +import it.unimi.dsi.fastutil.ints.IntArrayList; +import it.unimi.dsi.fastutil.ints.IntList; import java.lang.reflect.Type; -import java.util.Collection; +import java.util.ArrayList; import java.util.List; -import java.util.Objects; import java.util.Set; import java.util.function.Function; +import java.util.function.Predicate; import java.util.stream.Collectors; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; -import net.minecraft.client.renderer.block.model.BlockModelDefinition; import net.minecraft.client.renderer.block.model.MultiVariant; +import net.minecraft.client.renderer.block.model.UnbakedBlockStateModel; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.resources.model.BakedModel; import net.minecraft.client.resources.model.Material; @@ -25,98 +26,88 @@ import net.minecraft.client.resources.model.ModelBaker; import net.minecraft.client.resources.model.ModelState; import net.minecraft.client.resources.model.MultiPartBakedModel; import net.minecraft.client.resources.model.UnbakedModel; -import net.minecraft.resources.ResourceLocation; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; -import org.jetbrains.annotations.Nullable; @Environment(EnvType.CLIENT) -public class MultiPart implements UnbakedModel { - private final StateDefinition definition; - private final List selectors; +public class MultiPart implements UnbakedBlockStateModel { + private final List selectors; - public MultiPart(StateDefinition definition, List selectors) { - this.definition = definition; - this.selectors = selectors; - } - - public List getSelectors() { - return this.selectors; - } - - public Set getMultiVariants() { - Set set = Sets.newHashSet(); - - for (Selector selector : this.selectors) { - set.add(selector.getVariant()); - } - - return set; - } - - public boolean equals(Object object) { - if (this == object) { - return true; - } else { - return !(object instanceof MultiPart multiPart) - ? false - : Objects.equals(this.definition, multiPart.definition) && Objects.equals(this.selectors, multiPart.selectors); - } - } - - public int hashCode() { - return Objects.hash(new Object[]{this.definition, this.selectors}); + MultiPart(List list) { + this.selectors = list; } @Override - public Collection getDependencies() { - return (Collection)this.getSelectors() - .stream() - .flatMap(selector -> selector.getVariant().getDependencies().stream()) - .collect(Collectors.toSet()); - } + public Object visualEqualityGroup(BlockState blockState) { + IntList intList = new IntArrayList(); - @Override - public void resolveParents(Function resolver) { - this.getSelectors().forEach(selector -> selector.getVariant().resolveParents(resolver)); - } - - @Nullable - @Override - public BakedModel bake(ModelBaker baker, Function spriteGetter, ModelState state) { - MultiPartBakedModel.Builder builder = new MultiPartBakedModel.Builder(); - - for (Selector selector : this.getSelectors()) { - BakedModel bakedModel = selector.getVariant().bake(baker, spriteGetter, state); - if (bakedModel != null) { - builder.add(selector.getPredicate(this.definition), bakedModel); + for (int i = 0; i < this.selectors.size(); i++) { + if (((MultiPart.InstantiatedSelector)this.selectors.get(i)).predicate.test(blockState)) { + intList.add(i); } } - return builder.build(); + @Environment(EnvType.CLIENT) + record Key(MultiPart model, IntList selectors) { + } + + return new Key(this, intList); + } + + @Override + public void resolveDependencies(UnbakedModel.Resolver resolver) { + this.selectors.forEach(instantiatedSelector -> instantiatedSelector.variant.resolveDependencies(resolver)); + } + + @Override + public BakedModel bake(ModelBaker baker, Function spriteGetter, ModelState state) { + List list = new ArrayList(this.selectors.size()); + + for (MultiPart.InstantiatedSelector instantiatedSelector : this.selectors) { + BakedModel bakedModel = instantiatedSelector.variant.bake(baker, spriteGetter, state); + list.add(new MultiPartBakedModel.Selector(instantiatedSelector.predicate, bakedModel)); + } + + return new MultiPartBakedModel(list); } @Environment(EnvType.CLIENT) - public static class Deserializer implements JsonDeserializer { - private final BlockModelDefinition.Context context; - - public Deserializer(BlockModelDefinition.Context context) { - this.context = context; + public record Definition(List selectors) { + public MultiPart instantiate(StateDefinition stateDefinition) { + List list = this.selectors + .stream() + .map(selector -> new MultiPart.InstantiatedSelector(selector.getPredicate(stateDefinition), selector.getVariant())) + .toList(); + return new MultiPart(list); } - public MultiPart deserialize(JsonElement json, Type type, JsonDeserializationContext jsonContext) throws JsonParseException { - return new MultiPart(this.context.getDefinition(), this.getSelectors(jsonContext, json.getAsJsonArray())); + public Set getMultiVariants() { + return (Set)this.selectors.stream().map(Selector::getVariant).collect(Collectors.toSet()); + } + } + + @Environment(EnvType.CLIENT) + public static class Deserializer implements JsonDeserializer { + public MultiPart.Definition deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext jsonDeserializationContext) throws JsonParseException { + return new MultiPart.Definition(this.getSelectors(jsonDeserializationContext, jsonElement.getAsJsonArray())); } private List getSelectors(JsonDeserializationContext jsonContext, JsonArray elements) { - List list = Lists.newArrayList(); + List list = new ArrayList(); + if (elements.isEmpty()) { + throw new JsonSyntaxException("Empty selector array"); + } else { + for (JsonElement jsonElement : elements) { + list.add((Selector)jsonContext.deserialize(jsonElement, Selector.class)); + } - for (JsonElement jsonElement : elements) { - list.add((Selector)jsonContext.deserialize(jsonElement, Selector.class)); + return list; } - - return list; } } + + @Environment(EnvType.CLIENT) + record InstantiatedSelector(Predicate predicate, MultiVariant variant) { + } } diff --git a/net/minecraft/client/renderer/block/model/multipart/OrCondition.java b/net/minecraft/client/renderer/block/model/multipart/OrCondition.java index 5c8382d5..f05b38da 100644 --- a/net/minecraft/client/renderer/block/model/multipart/OrCondition.java +++ b/net/minecraft/client/renderer/block/model/multipart/OrCondition.java @@ -1,11 +1,10 @@ package net.minecraft.client.renderer.block.model.multipart; import com.google.common.collect.Streams; -import java.util.List; import java.util.function.Predicate; -import java.util.stream.Collectors; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; +import net.minecraft.Util; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; @@ -21,9 +20,6 @@ public class OrCondition implements Condition { @Override public Predicate getPredicate(StateDefinition stateDefinition) { - List> list = (List>)Streams.stream(this.conditions) - .map(condition -> condition.getPredicate(stateDefinition)) - .collect(Collectors.toList()); - return blockState -> list.stream().anyMatch(predicate -> predicate.test(blockState)); + return Util.anyOf(Streams.stream(this.conditions).map(condition -> condition.getPredicate(stateDefinition)).toList()); } } diff --git a/net/minecraft/client/renderer/block/model/multipart/Selector.java b/net/minecraft/client/renderer/block/model/multipart/Selector.java index 8060ebd6..69b1f628 100644 --- a/net/minecraft/client/renderer/block/model/multipart/Selector.java +++ b/net/minecraft/client/renderer/block/model/multipart/Selector.java @@ -27,14 +27,8 @@ public class Selector { private final MultiVariant variant; public Selector(Condition condition, MultiVariant variant) { - if (condition == null) { - throw new IllegalArgumentException("Missing condition for selector"); - } else if (variant == null) { - throw new IllegalArgumentException("Missing variant for selector"); - } else { - this.condition = condition; - this.variant = variant; - } + this.condition = condition; + this.variant = variant; } public MultiVariant getVariant() { @@ -45,14 +39,6 @@ public class Selector { return this.condition.getPredicate(definition); } - public boolean equals(Object object) { - return this == object; - } - - public int hashCode() { - return System.identityHashCode(this); - } - @Environment(EnvType.CLIENT) public static class Deserializer implements JsonDeserializer { public Selector deserialize(JsonElement json, Type type, JsonDeserializationContext context) throws JsonParseException { diff --git a/net/minecraft/client/renderer/blockentity/BannerRenderer.java b/net/minecraft/client/renderer/blockentity/BannerRenderer.java index 68aa2a2b..c72a304d 100644 --- a/net/minecraft/client/renderer/blockentity/BannerRenderer.java +++ b/net/minecraft/client/renderer/blockentity/BannerRenderer.java @@ -15,6 +15,7 @@ import net.minecraft.client.model.geom.builders.PartDefinition; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.Sheets; +import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider.Context; import net.minecraft.client.resources.model.Material; import net.minecraft.client.resources.model.ModelBakery; import net.minecraft.core.BlockPos; @@ -25,6 +26,7 @@ import net.minecraft.world.level.block.BannerBlock; import net.minecraft.world.level.block.WallBannerBlock; import net.minecraft.world.level.block.entity.BannerBlockEntity; import net.minecraft.world.level.block.entity.BannerPatternLayers; +import net.minecraft.world.level.block.entity.BannerPatternLayers.Layer; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.properties.RotationSegment; @@ -40,7 +42,7 @@ public class BannerRenderer implements BlockEntityRenderer { private final ModelPart pole; private final ModelPart bar; - public BannerRenderer(BlockEntityRendererProvider.Context context) { + public BannerRenderer(Context context) { ModelPart modelPart = context.bakeLayer(ModelLayers.BANNER); this.flag = modelPart.getChild("flag"); this.pole = modelPart.getChild("pole"); @@ -50,7 +52,9 @@ public class BannerRenderer implements BlockEntityRenderer { public static LayerDefinition createBodyLayer() { MeshDefinition meshDefinition = new MeshDefinition(); PartDefinition partDefinition = meshDefinition.getRoot(); - partDefinition.addOrReplaceChild("flag", CubeListBuilder.create().texOffs(0, 0).addBox(-10.0F, 0.0F, -2.0F, 20.0F, 40.0F, 1.0F), PartPose.ZERO); + partDefinition.addOrReplaceChild( + "flag", CubeListBuilder.create().texOffs(0, 0).addBox(-10.0F, 0.0F, -2.0F, 20.0F, 40.0F, 1.0F), PartPose.offset(0.0F, -32.0F, 0.0F) + ); partDefinition.addOrReplaceChild("pole", CubeListBuilder.create().texOffs(44, 0).addBox(-1.0F, -30.0F, -1.0F, 2.0F, 42.0F, 2.0F), PartPose.ZERO); partDefinition.addOrReplaceChild("bar", CubeListBuilder.create().texOffs(0, 42).addBox(-10.0F, -32.0F, -1.0F, 20.0F, 2.0F, 2.0F), PartPose.ZERO); return LayerDefinition.create(meshDefinition, 64, 64); @@ -90,7 +94,6 @@ public class BannerRenderer implements BlockEntityRenderer { BlockPos blockPos = blockEntity.getBlockPos(); float h = ((float)Math.floorMod(blockPos.getX() * 7 + blockPos.getY() * 9 + blockPos.getZ() * 13 + l, 100L) + partialTick) / 100.0F; this.flag.xRot = (-0.0125F + 0.01F * Mth.cos((float) (Math.PI * 2) * h)) * (float) Math.PI; - this.flag.y = -32.0F; renderPatterns( poseStack, bufferSource, packedLight, packedOverlay, this.flag, ModelBakery.BANNER_BASE, true, blockEntity.getBaseColor(), blockEntity.getPatterns() ); @@ -112,31 +115,29 @@ public class BannerRenderer implements BlockEntityRenderer { DyeColor baseColor, BannerPatternLayers patterns ) { - renderPatterns(poseStack, buffer, packedLight, packedOverlay, flagPart, flagMaterial, banner, baseColor, patterns, false); + renderPatterns(poseStack, buffer, packedLight, packedOverlay, flagPart, flagMaterial, banner, baseColor, patterns, false, true); } - /** - * @param banner if {@code true}, uses banner material; otherwise if {@code false} uses shield material - */ public static void renderPatterns( PoseStack poseStack, - MultiBufferSource buffer, - int packedLight, - int packedOverlay, - ModelPart flagPart, - Material flagMaterial, - boolean banner, - DyeColor baseColor, - BannerPatternLayers patterns, - boolean glint + MultiBufferSource multiBufferSource, + int i, + int j, + ModelPart modelPart, + Material material, + boolean bl, + DyeColor dyeColor, + BannerPatternLayers bannerPatternLayers, + boolean bl2, + boolean bl3 ) { - flagPart.render(poseStack, flagMaterial.buffer(buffer, RenderType::entitySolid, glint), packedLight, packedOverlay); - renderPatternLayer(poseStack, buffer, packedLight, packedOverlay, flagPart, banner ? Sheets.BANNER_BASE : Sheets.SHIELD_BASE, baseColor); + modelPart.render(poseStack, material.buffer(multiBufferSource, RenderType::entitySolid, bl3, bl2), i, j); + renderPatternLayer(poseStack, multiBufferSource, i, j, modelPart, bl ? Sheets.BANNER_BASE : Sheets.SHIELD_BASE, dyeColor); - for (int i = 0; i < 16 && i < patterns.layers().size(); i++) { - BannerPatternLayers.Layer layer = (BannerPatternLayers.Layer)patterns.layers().get(i); - Material material = banner ? Sheets.getBannerMaterial(layer.pattern()) : Sheets.getShieldMaterial(layer.pattern()); - renderPatternLayer(poseStack, buffer, packedLight, packedOverlay, flagPart, material, layer.color()); + for (int k = 0; k < 16 && k < bannerPatternLayers.layers().size(); k++) { + Layer layer = (Layer)bannerPatternLayers.layers().get(k); + Material material2 = bl ? Sheets.getBannerMaterial(layer.pattern()) : Sheets.getShieldMaterial(layer.pattern()); + renderPatternLayer(poseStack, multiBufferSource, i, j, modelPart, material2, layer.color()); } } diff --git a/net/minecraft/client/renderer/blockentity/BeaconRenderer.java b/net/minecraft/client/renderer/blockentity/BeaconRenderer.java index 02cb428a..bd1c869e 100644 --- a/net/minecraft/client/renderer/blockentity/BeaconRenderer.java +++ b/net/minecraft/client/renderer/blockentity/BeaconRenderer.java @@ -8,9 +8,10 @@ import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider.Context; import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.resources.ResourceLocation; -import net.minecraft.util.FastColor; +import net.minecraft.util.ARGB; import net.minecraft.util.Mth; import net.minecraft.world.level.block.entity.BeaconBlockEntity; import net.minecraft.world.phys.Vec3; @@ -20,7 +21,7 @@ public class BeaconRenderer implements BlockEntityRenderer { public static final ResourceLocation BEAM_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/beacon_beam.png"); public static final int MAX_RENDER_Y = 1024; - public BeaconRenderer(BlockEntityRendererProvider.Context context) { + public BeaconRenderer(Context context) { } public void render(BeaconBlockEntity blockEntity, float partialTick, PoseStack poseStack, MultiBufferSource bufferSource, int packedLight, int packedOverlay) { @@ -101,7 +102,7 @@ public class BeaconRenderer implements BlockEntityRenderer { renderPart( poseStack, bufferSource.getBuffer(RenderType.beaconBeam(beamLocation, true)), - FastColor.ARGB32.color(32, color), + ARGB.color(32, color), yOffset, i, j, diff --git a/net/minecraft/client/renderer/blockentity/BedRenderer.java b/net/minecraft/client/renderer/blockentity/BedRenderer.java index 76004ff4..0772e916 100644 --- a/net/minecraft/client/renderer/blockentity/BedRenderer.java +++ b/net/minecraft/client/renderer/blockentity/BedRenderer.java @@ -5,8 +5,8 @@ import com.mojang.blaze3d.vertex.VertexConsumer; import com.mojang.math.Axis; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; +import net.minecraft.client.model.Model; import net.minecraft.client.model.geom.ModelLayers; -import net.minecraft.client.model.geom.ModelPart; import net.minecraft.client.model.geom.PartPose; import net.minecraft.client.model.geom.builders.CubeListBuilder; import net.minecraft.client.model.geom.builders.LayerDefinition; @@ -15,6 +15,7 @@ import net.minecraft.client.model.geom.builders.PartDefinition; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.Sheets; +import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider.Context; import net.minecraft.client.resources.model.Material; import net.minecraft.core.Direction; import net.minecraft.world.level.Level; @@ -28,12 +29,12 @@ import net.minecraft.world.level.block.state.properties.BedPart; @Environment(EnvType.CLIENT) public class BedRenderer implements BlockEntityRenderer { - private final ModelPart headRoot; - private final ModelPart footRoot; + private final Model headModel; + private final Model footModel; - public BedRenderer(BlockEntityRendererProvider.Context context) { - this.headRoot = context.bakeLayer(ModelLayers.BED_HEAD); - this.footRoot = context.bakeLayer(ModelLayers.BED_FOOT); + public BedRenderer(Context context) { + this.headModel = new Model.Simple(context.bakeLayer(ModelLayers.BED_HEAD), RenderType::entitySolid); + this.footModel = new Model.Simple(context.bakeLayer(ModelLayers.BED_FOOT), RenderType::entitySolid); } public static LayerDefinition createHeadLayer() { @@ -87,7 +88,7 @@ public class BedRenderer implements BlockEntityRenderer { this.renderPiece( poseStack, bufferSource, - blockState.getValue(BedBlock.PART) == BedPart.HEAD ? this.headRoot : this.footRoot, + blockState.getValue(BedBlock.PART) == BedPart.HEAD ? this.headModel : this.footModel, blockState.getValue(BedBlock.FACING), material, i, @@ -95,32 +96,22 @@ public class BedRenderer implements BlockEntityRenderer { false ); } else { - this.renderPiece(poseStack, bufferSource, this.headRoot, Direction.SOUTH, material, packedLight, packedOverlay, false); - this.renderPiece(poseStack, bufferSource, this.footRoot, Direction.SOUTH, material, packedLight, packedOverlay, true); + this.renderPiece(poseStack, bufferSource, this.headModel, Direction.SOUTH, material, packedLight, packedOverlay, false); + this.renderPiece(poseStack, bufferSource, this.footModel, Direction.SOUTH, material, packedLight, packedOverlay, true); } } - /** - * @param foot {@code true} if piece to render is the foot of the bed, {@code false} otherwise or if being rendered by a {@link net.minecraft.client.renderer.BlockEntityWithoutLevelRenderer} - */ private void renderPiece( - PoseStack poseStack, - MultiBufferSource bufferSource, - ModelPart modelPart, - Direction direction, - Material material, - int packedLight, - int packedOverlay, - boolean foot + PoseStack poseStack, MultiBufferSource multiBufferSource, Model model, Direction direction, Material material, int i, int j, boolean bl ) { poseStack.pushPose(); - poseStack.translate(0.0F, 0.5625F, foot ? -1.0F : 0.0F); + poseStack.translate(0.0F, 0.5625F, bl ? -1.0F : 0.0F); poseStack.mulPose(Axis.XP.rotationDegrees(90.0F)); poseStack.translate(0.5F, 0.5F, 0.5F); poseStack.mulPose(Axis.ZP.rotationDegrees(180.0F + direction.toYRot())); poseStack.translate(-0.5F, -0.5F, -0.5F); - VertexConsumer vertexConsumer = material.buffer(bufferSource, RenderType::entitySolid); - modelPart.render(poseStack, vertexConsumer, packedLight, packedOverlay); + VertexConsumer vertexConsumer = material.buffer(multiBufferSource, RenderType::entitySolid); + model.renderToBuffer(poseStack, vertexConsumer, i, j); poseStack.popPose(); } } diff --git a/net/minecraft/client/renderer/blockentity/BellRenderer.java b/net/minecraft/client/renderer/blockentity/BellRenderer.java index 43ce4008..6bb35b18 100644 --- a/net/minecraft/client/renderer/blockentity/BellRenderer.java +++ b/net/minecraft/client/renderer/blockentity/BellRenderer.java @@ -4,20 +4,14 @@ import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.VertexConsumer; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; +import net.minecraft.client.model.BellModel; import net.minecraft.client.model.geom.ModelLayers; -import net.minecraft.client.model.geom.ModelPart; -import net.minecraft.client.model.geom.PartPose; -import net.minecraft.client.model.geom.builders.CubeListBuilder; -import net.minecraft.client.model.geom.builders.LayerDefinition; -import net.minecraft.client.model.geom.builders.MeshDefinition; -import net.minecraft.client.model.geom.builders.PartDefinition; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider.Context; import net.minecraft.client.renderer.texture.TextureAtlas; import net.minecraft.client.resources.model.Material; -import net.minecraft.core.Direction; import net.minecraft.resources.ResourceLocation; -import net.minecraft.util.Mth; import net.minecraft.world.level.block.entity.BellBlockEntity; @Environment(EnvType.CLIENT) @@ -25,46 +19,15 @@ public class BellRenderer implements BlockEntityRenderer { public static final Material BELL_RESOURCE_LOCATION = new Material( TextureAtlas.LOCATION_BLOCKS, ResourceLocation.withDefaultNamespace("entity/bell/bell_body") ); - private static final String BELL_BODY = "bell_body"; - private final ModelPart bellBody; + private final BellModel model; - public BellRenderer(BlockEntityRendererProvider.Context context) { - ModelPart modelPart = context.bakeLayer(ModelLayers.BELL); - this.bellBody = modelPart.getChild("bell_body"); - } - - public static LayerDefinition createBodyLayer() { - MeshDefinition meshDefinition = new MeshDefinition(); - PartDefinition partDefinition = meshDefinition.getRoot(); - PartDefinition partDefinition2 = partDefinition.addOrReplaceChild( - "bell_body", CubeListBuilder.create().texOffs(0, 0).addBox(-3.0F, -6.0F, -3.0F, 6.0F, 7.0F, 6.0F), PartPose.offset(8.0F, 12.0F, 8.0F) - ); - partDefinition2.addOrReplaceChild( - "bell_base", CubeListBuilder.create().texOffs(0, 13).addBox(4.0F, 4.0F, 4.0F, 8.0F, 2.0F, 8.0F), PartPose.offset(-8.0F, -12.0F, -8.0F) - ); - return LayerDefinition.create(meshDefinition, 32, 32); + public BellRenderer(Context context) { + this.model = new BellModel(context.bakeLayer(ModelLayers.BELL)); } public void render(BellBlockEntity blockEntity, float partialTick, PoseStack poseStack, MultiBufferSource bufferSource, int packedLight, int packedOverlay) { - float f = blockEntity.ticks + partialTick; - float g = 0.0F; - float h = 0.0F; - if (blockEntity.shaking) { - float i = Mth.sin(f / (float) Math.PI) / (4.0F + f / 3.0F); - if (blockEntity.clickDirection == Direction.NORTH) { - g = -i; - } else if (blockEntity.clickDirection == Direction.SOUTH) { - g = i; - } else if (blockEntity.clickDirection == Direction.EAST) { - h = -i; - } else if (blockEntity.clickDirection == Direction.WEST) { - h = i; - } - } - - this.bellBody.xRot = g; - this.bellBody.zRot = h; VertexConsumer vertexConsumer = BELL_RESOURCE_LOCATION.buffer(bufferSource, RenderType::entitySolid); - this.bellBody.render(poseStack, vertexConsumer, packedLight, packedOverlay); + this.model.setupAnim(blockEntity, partialTick); + this.model.renderToBuffer(poseStack, vertexConsumer, packedLight, packedOverlay); } } diff --git a/net/minecraft/client/renderer/blockentity/BlockEntityRenderDispatcher.java b/net/minecraft/client/renderer/blockentity/BlockEntityRenderDispatcher.java index 1e22f9bb..5df35bd9 100644 --- a/net/minecraft/client/renderer/blockentity/BlockEntityRenderDispatcher.java +++ b/net/minecraft/client/renderer/blockentity/BlockEntityRenderDispatcher.java @@ -15,6 +15,7 @@ import net.minecraft.client.model.geom.EntityModelSet; import net.minecraft.client.renderer.LevelRenderer; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.block.BlockRenderDispatcher; +import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider.Context; import net.minecraft.client.renderer.entity.EntityRenderDispatcher; import net.minecraft.client.renderer.entity.ItemRenderer; import net.minecraft.client.renderer.texture.OverlayTexture; @@ -124,7 +125,7 @@ public class BlockEntityRenderDispatcher implements ResourceManagerReloadListene @Override public void onResourceManagerReload(ResourceManager resourceManager) { - BlockEntityRendererProvider.Context context = new BlockEntityRendererProvider.Context( + Context context = new Context( this, (BlockRenderDispatcher)this.blockRenderDispatcher.get(), (ItemRenderer)this.itemRenderer.get(), diff --git a/net/minecraft/client/renderer/blockentity/CampfireRenderer.java b/net/minecraft/client/renderer/blockentity/CampfireRenderer.java index 8d0f5b2d..f2b9ff94 100644 --- a/net/minecraft/client/renderer/blockentity/CampfireRenderer.java +++ b/net/minecraft/client/renderer/blockentity/CampfireRenderer.java @@ -5,6 +5,7 @@ import com.mojang.math.Axis; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider.Context; import net.minecraft.client.renderer.entity.ItemRenderer; import net.minecraft.core.Direction; import net.minecraft.core.NonNullList; @@ -18,7 +19,7 @@ public class CampfireRenderer implements BlockEntityRenderer implements BlockEntityRenderer { - private static final String BOTTOM = "bottom"; - private static final String LID = "lid"; - private static final String LOCK = "lock"; - private final ModelPart lid; - private final ModelPart bottom; - private final ModelPart lock; - private final ModelPart doubleLeftLid; - private final ModelPart doubleLeftBottom; - private final ModelPart doubleLeftLock; - private final ModelPart doubleRightLid; - private final ModelPart doubleRightBottom; - private final ModelPart doubleRightLock; + private final ChestModel singleModel; + private final ChestModel doubleLeftModel; + private final ChestModel doubleRightModel; private boolean xmasTextures; - public ChestRenderer(BlockEntityRendererProvider.Context context) { + public ChestRenderer(Context context) { Calendar calendar = Calendar.getInstance(); if (calendar.get(2) + 1 == 12 && calendar.get(5) >= 24 && calendar.get(5) <= 26) { this.xmasTextures = true; } - ModelPart modelPart = context.bakeLayer(ModelLayers.CHEST); - this.bottom = modelPart.getChild("bottom"); - this.lid = modelPart.getChild("lid"); - this.lock = modelPart.getChild("lock"); - ModelPart modelPart2 = context.bakeLayer(ModelLayers.DOUBLE_CHEST_LEFT); - this.doubleLeftBottom = modelPart2.getChild("bottom"); - this.doubleLeftLid = modelPart2.getChild("lid"); - this.doubleLeftLock = modelPart2.getChild("lock"); - ModelPart modelPart3 = context.bakeLayer(ModelLayers.DOUBLE_CHEST_RIGHT); - this.doubleRightBottom = modelPart3.getChild("bottom"); - this.doubleRightLid = modelPart3.getChild("lid"); - this.doubleRightLock = modelPart3.getChild("lock"); - } - - public static LayerDefinition createSingleBodyLayer() { - MeshDefinition meshDefinition = new MeshDefinition(); - PartDefinition partDefinition = meshDefinition.getRoot(); - partDefinition.addOrReplaceChild("bottom", CubeListBuilder.create().texOffs(0, 19).addBox(1.0F, 0.0F, 1.0F, 14.0F, 10.0F, 14.0F), PartPose.ZERO); - partDefinition.addOrReplaceChild( - "lid", CubeListBuilder.create().texOffs(0, 0).addBox(1.0F, 0.0F, 0.0F, 14.0F, 5.0F, 14.0F), PartPose.offset(0.0F, 9.0F, 1.0F) - ); - partDefinition.addOrReplaceChild( - "lock", CubeListBuilder.create().texOffs(0, 0).addBox(7.0F, -2.0F, 14.0F, 2.0F, 4.0F, 1.0F), PartPose.offset(0.0F, 9.0F, 1.0F) - ); - return LayerDefinition.create(meshDefinition, 64, 64); - } - - public static LayerDefinition createDoubleBodyRightLayer() { - MeshDefinition meshDefinition = new MeshDefinition(); - PartDefinition partDefinition = meshDefinition.getRoot(); - partDefinition.addOrReplaceChild("bottom", CubeListBuilder.create().texOffs(0, 19).addBox(1.0F, 0.0F, 1.0F, 15.0F, 10.0F, 14.0F), PartPose.ZERO); - partDefinition.addOrReplaceChild( - "lid", CubeListBuilder.create().texOffs(0, 0).addBox(1.0F, 0.0F, 0.0F, 15.0F, 5.0F, 14.0F), PartPose.offset(0.0F, 9.0F, 1.0F) - ); - partDefinition.addOrReplaceChild( - "lock", CubeListBuilder.create().texOffs(0, 0).addBox(15.0F, -2.0F, 14.0F, 1.0F, 4.0F, 1.0F), PartPose.offset(0.0F, 9.0F, 1.0F) - ); - return LayerDefinition.create(meshDefinition, 64, 64); - } - - public static LayerDefinition createDoubleBodyLeftLayer() { - MeshDefinition meshDefinition = new MeshDefinition(); - PartDefinition partDefinition = meshDefinition.getRoot(); - partDefinition.addOrReplaceChild("bottom", CubeListBuilder.create().texOffs(0, 19).addBox(0.0F, 0.0F, 1.0F, 15.0F, 10.0F, 14.0F), PartPose.ZERO); - partDefinition.addOrReplaceChild( - "lid", CubeListBuilder.create().texOffs(0, 0).addBox(0.0F, 0.0F, 0.0F, 15.0F, 5.0F, 14.0F), PartPose.offset(0.0F, 9.0F, 1.0F) - ); - partDefinition.addOrReplaceChild( - "lock", CubeListBuilder.create().texOffs(0, 0).addBox(0.0F, -2.0F, 14.0F, 1.0F, 4.0F, 1.0F), PartPose.offset(0.0F, 9.0F, 1.0F) - ); - return LayerDefinition.create(meshDefinition, 64, 64); + this.singleModel = new ChestModel(context.bakeLayer(ModelLayers.CHEST)); + this.doubleLeftModel = new ChestModel(context.bakeLayer(ModelLayers.DOUBLE_CHEST_LEFT)); + this.doubleRightModel = new ChestModel(context.bakeLayer(ModelLayers.DOUBLE_CHEST_RIGHT)); } @Override public void render(T blockEntity, float partialTick, PoseStack poseStack, MultiBufferSource bufferSource, int packedLight, int packedOverlay) { Level level = blockEntity.getLevel(); boolean bl = level != null; - BlockState blockState = bl ? blockEntity.getBlockState() : Blocks.CHEST.defaultBlockState().setValue(ChestBlock.FACING, Direction.SOUTH); + BlockState blockState = bl ? blockEntity.getBlockState() : Blocks.CHEST.defaultBlockState().setValue((Property)ChestBlock.FACING, Direction.SOUTH); ChestType chestType = blockState.hasProperty((Property)ChestBlock.TYPE) ? blockState.getValue(ChestBlock.TYPE) : ChestType.SINGLE; if (blockState.getBlock() instanceof AbstractChestBlock abstractChestBlock) { boolean bl2 = chestType != ChestType.SINGLE; poseStack.pushPose(); - float f = ((Direction)blockState.getValue(ChestBlock.FACING)).toYRot(); + float f = ((Direction)blockState.getValue((Property)ChestBlock.FACING)).toYRot(); poseStack.translate(0.5F, 0.5F, 0.5F); poseStack.mulPose(Axis.YP.rotationDegrees(-f)); poseStack.translate(-0.5F, -0.5F, -0.5F); @@ -133,25 +72,20 @@ public class ChestRenderer implements Bl VertexConsumer vertexConsumer = material.buffer(bufferSource, RenderType::entityCutout); if (bl2) { if (chestType == ChestType.LEFT) { - this.render(poseStack, vertexConsumer, this.doubleLeftLid, this.doubleLeftLock, this.doubleLeftBottom, g, i, packedOverlay); + this.render(poseStack, vertexConsumer, this.doubleLeftModel, g, i, packedOverlay); } else { - this.render(poseStack, vertexConsumer, this.doubleRightLid, this.doubleRightLock, this.doubleRightBottom, g, i, packedOverlay); + this.render(poseStack, vertexConsumer, this.doubleRightModel, g, i, packedOverlay); } } else { - this.render(poseStack, vertexConsumer, this.lid, this.lock, this.bottom, g, i, packedOverlay); + this.render(poseStack, vertexConsumer, this.singleModel, g, i, packedOverlay); } poseStack.popPose(); } } - private void render( - PoseStack poseStack, VertexConsumer consumer, ModelPart lidPart, ModelPart lockPart, ModelPart bottomPart, float lidAngle, int packedLight, int packedOverlay - ) { - lidPart.xRot = -(lidAngle * (float) (Math.PI / 2)); - lockPart.xRot = lidPart.xRot; - lidPart.render(poseStack, consumer, packedLight, packedOverlay); - lockPart.render(poseStack, consumer, packedLight, packedOverlay); - bottomPart.render(poseStack, consumer, packedLight, packedOverlay); + private void render(PoseStack poseStack, VertexConsumer vertexConsumer, ChestModel chestModel, float f, int i, int j) { + chestModel.setupAnim(f); + chestModel.renderToBuffer(poseStack, vertexConsumer, i, j); } } diff --git a/net/minecraft/client/renderer/blockentity/EnchantTableRenderer.java b/net/minecraft/client/renderer/blockentity/EnchantTableRenderer.java index c1c8afff..8bd5521a 100644 --- a/net/minecraft/client/renderer/blockentity/EnchantTableRenderer.java +++ b/net/minecraft/client/renderer/blockentity/EnchantTableRenderer.java @@ -9,6 +9,7 @@ import net.minecraft.client.model.BookModel; import net.minecraft.client.model.geom.ModelLayers; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider.Context; import net.minecraft.client.renderer.texture.TextureAtlas; import net.minecraft.client.resources.model.Material; import net.minecraft.resources.ResourceLocation; @@ -23,7 +24,7 @@ public class EnchantTableRenderer implements BlockEntityRenderer hangingSignModels; - public HangingSignRenderer(BlockEntityRendererProvider.Context context) { + public HangingSignRenderer(Context context) { super(context); this.hangingSignModels = (Map)WoodType.values() .collect( @@ -79,12 +79,6 @@ public class HangingSignRenderer extends SignRenderer { poseStack.translate(0.0F, -0.3125F, 0.0F); } - @Override - void renderSignModel(PoseStack poseStack, int packedLight, int packedOverlay, Model model, VertexConsumer vertexConsumer) { - HangingSignRenderer.HangingSignModel hangingSignModel = (HangingSignRenderer.HangingSignModel)model; - hangingSignModel.root.render(poseStack, vertexConsumer, packedLight, packedOverlay); - } - @Override Material getSignMaterial(WoodType woodType) { return Sheets.getHangingSignMaterial(woodType); @@ -127,14 +121,12 @@ public class HangingSignRenderer extends SignRenderer { @Environment(EnvType.CLIENT) public static final class HangingSignModel extends Model { - public final ModelPart root; public final ModelPart plank; public final ModelPart vChains; public final ModelPart normalChains; public HangingSignModel(ModelPart root) { - super(RenderType::entityCutoutNoCull); - this.root = root; + super(root, RenderType::entityCutoutNoCull); this.plank = root.getChild("plank"); this.normalChains = root.getChild("normalChains"); this.vChains = root.getChild("vChains"); @@ -151,10 +143,5 @@ public class HangingSignRenderer extends SignRenderer { this.vChains.visible = bl2; } } - - @Override - public void renderToBuffer(PoseStack poseStack, VertexConsumer buffer, int packedLight, int packedOverlay, int color) { - this.root.render(poseStack, buffer, packedLight, packedOverlay, color); - } } } diff --git a/net/minecraft/client/renderer/blockentity/LecternRenderer.java b/net/minecraft/client/renderer/blockentity/LecternRenderer.java index 25f46b0f..337e27ab 100644 --- a/net/minecraft/client/renderer/blockentity/LecternRenderer.java +++ b/net/minecraft/client/renderer/blockentity/LecternRenderer.java @@ -9,6 +9,7 @@ import net.minecraft.client.model.BookModel; import net.minecraft.client.model.geom.ModelLayers; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider.Context; import net.minecraft.core.Direction; import net.minecraft.world.level.block.LecternBlock; import net.minecraft.world.level.block.entity.LecternBlockEntity; @@ -18,7 +19,7 @@ import net.minecraft.world.level.block.state.BlockState; public class LecternRenderer implements BlockEntityRenderer { private final BookModel bookModel; - public LecternRenderer(BlockEntityRendererProvider.Context context) { + public LecternRenderer(Context context) { this.bookModel = new BookModel(context.bakeLayer(ModelLayers.BOOK)); } @@ -33,7 +34,7 @@ public class LecternRenderer implements BlockEntityRenderer poseStack.translate(0.0F, -0.125F, 0.0F); this.bookModel.setupAnim(0.0F, 0.1F, 0.9F, 1.2F); VertexConsumer vertexConsumer = EnchantTableRenderer.BOOK_LOCATION.buffer(bufferSource, RenderType::entitySolid); - this.bookModel.render(poseStack, vertexConsumer, packedLight, packedOverlay, -1); + this.bookModel.renderToBuffer(poseStack, vertexConsumer, packedLight, packedOverlay); poseStack.popPose(); } } diff --git a/net/minecraft/client/renderer/blockentity/PistonHeadRenderer.java b/net/minecraft/client/renderer/blockentity/PistonHeadRenderer.java index 465e4371..acb2cd52 100644 --- a/net/minecraft/client/renderer/blockentity/PistonHeadRenderer.java +++ b/net/minecraft/client/renderer/blockentity/PistonHeadRenderer.java @@ -9,6 +9,7 @@ import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.block.BlockRenderDispatcher; import net.minecraft.client.renderer.block.ModelBlockRenderer; +import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider.Context; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.util.RandomSource; @@ -24,7 +25,7 @@ import net.minecraft.world.level.block.state.properties.PistonType; public class PistonHeadRenderer implements BlockEntityRenderer { private final BlockRenderDispatcher blockRenderer; - public PistonHeadRenderer(BlockEntityRendererProvider.Context context) { + public PistonHeadRenderer(Context context) { this.blockRenderer = context.getBlockRenderDispatcher(); } diff --git a/net/minecraft/client/renderer/blockentity/ShulkerBoxRenderer.java b/net/minecraft/client/renderer/blockentity/ShulkerBoxRenderer.java index 1d9395f9..84385a61 100644 --- a/net/minecraft/client/renderer/blockentity/ShulkerBoxRenderer.java +++ b/net/minecraft/client/renderer/blockentity/ShulkerBoxRenderer.java @@ -4,12 +4,13 @@ import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.VertexConsumer; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; -import net.minecraft.client.model.ShulkerModel; +import net.minecraft.client.model.Model; import net.minecraft.client.model.geom.ModelLayers; import net.minecraft.client.model.geom.ModelPart; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.Sheets; +import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider.Context; import net.minecraft.client.resources.model.Material; import net.minecraft.core.Direction; import net.minecraft.world.item.DyeColor; @@ -19,10 +20,10 @@ import net.minecraft.world.level.block.state.BlockState; @Environment(EnvType.CLIENT) public class ShulkerBoxRenderer implements BlockEntityRenderer { - private final ShulkerModel model; + private final ShulkerBoxRenderer.ShulkerBoxModel model; - public ShulkerBoxRenderer(BlockEntityRendererProvider.Context context) { - this.model = new ShulkerModel(context.bakeLayer(ModelLayers.SHULKER)); + public ShulkerBoxRenderer(Context context) { + this.model = new ShulkerBoxRenderer.ShulkerBoxModel(context.bakeLayer(ModelLayers.SHULKER_BOX)); } public void render( @@ -51,11 +52,24 @@ public class ShulkerBoxRenderer implements BlockEntityRenderer { - private static final String STICK = "stick"; private static final int BLACK_TEXT_OUTLINE_COLOR = -988212; private static final int OUTLINE_RENDER_DISTANCE = Mth.square(16); private static final float RENDER_SCALE = 0.6666667F; private static final Vec3 TEXT_OFFSET = new Vec3(0.0, 0.33333334F, 0.046666667F); - private final Map signModels; + private final Map signModels; private final Font font; - public SignRenderer(BlockEntityRendererProvider.Context context) { - this.signModels = (Map)WoodType.values() + public SignRenderer(Context context) { + this.signModels = (Map)WoodType.values() .collect( - ImmutableMap.toImmutableMap(woodType -> woodType, woodType -> new SignRenderer.SignModel(context.bakeLayer(ModelLayers.createSignModelName(woodType)))) + ImmutableMap.toImmutableMap( + woodType -> woodType, + woodType -> new SignRenderer.Models(createSignModel(context.getModelSet(), woodType, true), createSignModel(context.getModelSet(), woodType, false)) + ) ); this.font = context.getFont(); } @@ -60,9 +63,9 @@ public class SignRenderer implements BlockEntityRenderer { BlockState blockState = blockEntity.getBlockState(); SignBlock signBlock = (SignBlock)blockState.getBlock(); WoodType woodType = SignBlock.getWoodType(signBlock); - SignRenderer.SignModel signModel = (SignRenderer.SignModel)this.signModels.get(woodType); - signModel.stick.visible = blockState.getBlock() instanceof StandingSignBlock; - this.renderSignWithText(blockEntity, poseStack, bufferSource, packedLight, packedOverlay, blockState, signBlock, woodType, signModel); + SignRenderer.Models models = (SignRenderer.Models)this.signModels.get(woodType); + Model model = blockState.getBlock() instanceof StandingSignBlock ? models.standing() : models.wall(); + this.renderSignWithText(blockEntity, poseStack, bufferSource, packedLight, packedOverlay, blockState, signBlock, woodType, model); } public float getSignModelRenderScale() { @@ -110,15 +113,10 @@ public class SignRenderer implements BlockEntityRenderer { poseStack.scale(f, -f, -f); Material material = this.getSignMaterial(woodType); VertexConsumer vertexConsumer = material.buffer(buffer, model::renderType); - this.renderSignModel(poseStack, packedLight, packedOverlay, model, vertexConsumer); + model.renderToBuffer(poseStack, vertexConsumer, packedLight, packedOverlay); poseStack.popPose(); } - void renderSignModel(PoseStack poseStack, int packedLight, int packedOverlay, Model model, VertexConsumer vertexConsumer) { - SignRenderer.SignModel signModel = (SignRenderer.SignModel)model; - signModel.root.render(poseStack, vertexConsumer, packedLight, packedOverlay); - } - Material getSignMaterial(WoodType woodType) { return Sheets.getSignMaterial(woodType); } @@ -167,7 +165,7 @@ public class SignRenderer implements BlockEntityRenderer { } float f = 0.015625F * this.getSignTextRenderScale(); - poseStack.translate(offset.x, offset.y, offset.z); + poseStack.translate(offset); poseStack.scale(f, -f, f); } @@ -196,39 +194,30 @@ public class SignRenderer implements BlockEntityRenderer { return -988212; } else { double d = 0.4; - int j = (int)(FastColor.ARGB32.red(i) * 0.4); - int k = (int)(FastColor.ARGB32.green(i) * 0.4); - int l = (int)(FastColor.ARGB32.blue(i) * 0.4); - return FastColor.ARGB32.color(0, j, k, l); + int j = (int)(ARGB.red(i) * 0.4); + int k = (int)(ARGB.green(i) * 0.4); + int l = (int)(ARGB.blue(i) * 0.4); + return ARGB.color(0, j, k, l); } } - public static SignRenderer.SignModel createSignModel(EntityModelSet entityModelSet, WoodType woodType) { - return new SignRenderer.SignModel(entityModelSet.bakeLayer(ModelLayers.createSignModelName(woodType))); + public static Model createSignModel(EntityModelSet entityModelSet, WoodType woodType, boolean bl) { + ModelLayerLocation modelLayerLocation = bl ? ModelLayers.createStandingSignModelName(woodType) : ModelLayers.createWallSignModelName(woodType); + return new Model.Simple(entityModelSet.bakeLayer(modelLayerLocation), RenderType::entityCutoutNoCull); } - public static LayerDefinition createSignLayer() { + public static LayerDefinition createSignLayer(boolean bl) { MeshDefinition meshDefinition = new MeshDefinition(); PartDefinition partDefinition = meshDefinition.getRoot(); partDefinition.addOrReplaceChild("sign", CubeListBuilder.create().texOffs(0, 0).addBox(-12.0F, -14.0F, -1.0F, 24.0F, 12.0F, 2.0F), PartPose.ZERO); - partDefinition.addOrReplaceChild("stick", CubeListBuilder.create().texOffs(0, 14).addBox(-1.0F, -2.0F, -1.0F, 2.0F, 14.0F, 2.0F), PartPose.ZERO); + if (bl) { + partDefinition.addOrReplaceChild("stick", CubeListBuilder.create().texOffs(0, 14).addBox(-1.0F, -2.0F, -1.0F, 2.0F, 14.0F, 2.0F), PartPose.ZERO); + } + return LayerDefinition.create(meshDefinition, 64, 32); } @Environment(EnvType.CLIENT) - public static final class SignModel extends Model { - public final ModelPart root; - public final ModelPart stick; - - public SignModel(ModelPart root) { - super(RenderType::entityCutoutNoCull); - this.root = root; - this.stick = root.getChild("stick"); - } - - @Override - public void renderToBuffer(PoseStack poseStack, VertexConsumer buffer, int packedLight, int packedOverlay, int color) { - this.root.render(poseStack, buffer, packedLight, packedOverlay, color); - } + record Models(Model standing, Model wall) { } } diff --git a/net/minecraft/client/renderer/blockentity/SkullBlockRenderer.java b/net/minecraft/client/renderer/blockentity/SkullBlockRenderer.java index 201893dd..5810e70d 100644 --- a/net/minecraft/client/renderer/blockentity/SkullBlockRenderer.java +++ b/net/minecraft/client/renderer/blockentity/SkullBlockRenderer.java @@ -18,6 +18,7 @@ import net.minecraft.client.model.geom.EntityModelSet; import net.minecraft.client.model.geom.ModelLayers; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider.Context; import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.client.resources.DefaultPlayerSkin; import net.minecraft.client.resources.SkinManager; @@ -57,7 +58,7 @@ public class SkullBlockRenderer implements BlockEntityRenderer return builder.build(); } - public SkullBlockRenderer(BlockEntityRendererProvider.Context context) { + public SkullBlockRenderer(Context context) { this.modelByType = createSkullRenderers(context.getModelSet()); } diff --git a/net/minecraft/client/renderer/blockentity/SpawnerRenderer.java b/net/minecraft/client/renderer/blockentity/SpawnerRenderer.java index 531ca45d..7aa9ddad 100644 --- a/net/minecraft/client/renderer/blockentity/SpawnerRenderer.java +++ b/net/minecraft/client/renderer/blockentity/SpawnerRenderer.java @@ -5,6 +5,7 @@ import com.mojang.math.Axis; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider.Context; import net.minecraft.client.renderer.entity.EntityRenderDispatcher; import net.minecraft.util.Mth; import net.minecraft.world.entity.Entity; @@ -16,7 +17,7 @@ import net.minecraft.world.level.block.entity.SpawnerBlockEntity; public class SpawnerRenderer implements BlockEntityRenderer { private final EntityRenderDispatcher entityRenderer; - public SpawnerRenderer(BlockEntityRendererProvider.Context context) { + public SpawnerRenderer(Context context) { this.entityRenderer = context.getEntityRenderer(); } @@ -54,7 +55,7 @@ public class SpawnerRenderer implements BlockEntityRenderer poseStack.translate(0.0F, -0.2F, 0.0F); poseStack.mulPose(Axis.XP.rotationDegrees(-30.0F)); poseStack.scale(f, f, f); - entityRenderer.render(entity, 0.0, 0.0, 0.0, 0.0F, partialTick, poseStack, buffer, packedLight); + entityRenderer.render(entity, 0.0, 0.0, 0.0, partialTick, poseStack, buffer, packedLight); poseStack.popPose(); } } diff --git a/net/minecraft/client/renderer/blockentity/StructureBlockRenderer.java b/net/minecraft/client/renderer/blockentity/StructureBlockRenderer.java index be7dae28..fc44e62d 100644 --- a/net/minecraft/client/renderer/blockentity/StructureBlockRenderer.java +++ b/net/minecraft/client/renderer/blockentity/StructureBlockRenderer.java @@ -5,9 +5,10 @@ import com.mojang.blaze3d.vertex.VertexConsumer; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.LevelRenderer; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.ShapeRenderer; +import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider.Context; import net.minecraft.core.BlockPos; import net.minecraft.core.Vec3i; import net.minecraft.gametest.framework.StructureUtils; @@ -21,7 +22,7 @@ import net.minecraft.world.phys.shapes.DiscreteVoxelShape; @Environment(EnvType.CLIENT) public class StructureBlockRenderer implements BlockEntityRenderer { - public StructureBlockRenderer(BlockEntityRendererProvider.Context context) { + public StructureBlockRenderer(Context context) { } public void render( @@ -87,7 +88,7 @@ public class StructureBlockRenderer implements BlockEntityRenderer { private static final ResourceLocation BEAM_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/end_gateway_beam.png"); - public TheEndGatewayRenderer(BlockEntityRendererProvider.Context context) { + public TheEndGatewayRenderer(Context context) { super(context); } public void render(TheEndGatewayBlockEntity theEndGatewayBlockEntity, float f, PoseStack poseStack, MultiBufferSource multiBufferSource, int i, int j) { if (theEndGatewayBlockEntity.isSpawning() || theEndGatewayBlockEntity.isCoolingDown()) { float g = theEndGatewayBlockEntity.isSpawning() ? theEndGatewayBlockEntity.getSpawnPercent(f) : theEndGatewayBlockEntity.getCooldownPercent(f); - double d = theEndGatewayBlockEntity.isSpawning() ? theEndGatewayBlockEntity.getLevel().getMaxBuildHeight() : 50.0; + double d = theEndGatewayBlockEntity.isSpawning() ? theEndGatewayBlockEntity.getLevel().getMaxY() : 50.0; g = Mth.sin(g * (float) Math.PI); int k = Mth.floor(g * d); int l = theEndGatewayBlockEntity.isSpawning() ? DyeColor.MAGENTA.getTextureDiffuseColor() : DyeColor.PURPLE.getTextureDiffuseColor(); diff --git a/net/minecraft/client/renderer/chunk/CompileTaskDynamicQueue.java b/net/minecraft/client/renderer/chunk/CompileTaskDynamicQueue.java new file mode 100644 index 00000000..4e87dd70 --- /dev/null +++ b/net/minecraft/client/renderer/chunk/CompileTaskDynamicQueue.java @@ -0,0 +1,76 @@ +package net.minecraft.client.renderer.chunk; + +import it.unimi.dsi.fastutil.objects.ObjectArrayList; +import java.util.List; +import java.util.ListIterator; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.client.renderer.chunk.SectionRenderDispatcher.RenderSection.CompileTask; +import net.minecraft.world.phys.Vec3; +import org.jetbrains.annotations.Nullable; + +@Environment(EnvType.CLIENT) +public class CompileTaskDynamicQueue { + private static final int MAX_RECOMPILE_QUOTA = 2; + private int recompileQuota = 2; + private final List tasks = new ObjectArrayList<>(); + + public synchronized void add(CompileTask compileTask) { + this.tasks.add(compileTask); + } + + @Nullable + public synchronized CompileTask poll(Vec3 vec3) { + int i = -1; + int j = -1; + double d = Double.MAX_VALUE; + double e = Double.MAX_VALUE; + ListIterator listIterator = this.tasks.listIterator(); + + while (listIterator.hasNext()) { + int k = listIterator.nextIndex(); + CompileTask compileTask = (CompileTask)listIterator.next(); + if (compileTask.isCancelled.get()) { + listIterator.remove(); + } else { + double f = compileTask.getOrigin().distToCenterSqr(vec3); + if (!compileTask.isRecompile() && f < d) { + d = f; + i = k; + } + + if (compileTask.isRecompile() && f < e) { + e = f; + j = k; + } + } + } + + boolean bl = j >= 0; + boolean bl2 = i >= 0; + if (!bl || bl2 && (this.recompileQuota <= 0 || !(e < d))) { + this.recompileQuota = 2; + return this.removeTaskByIndex(i); + } else { + this.recompileQuota--; + return this.removeTaskByIndex(j); + } + } + + public int size() { + return this.tasks.size(); + } + + @Nullable + private CompileTask removeTaskByIndex(int i) { + return i >= 0 ? (CompileTask)this.tasks.remove(i) : null; + } + + public synchronized void clear() { + for (CompileTask compileTask : this.tasks) { + compileTask.cancel(); + } + + this.tasks.clear(); + } +} diff --git a/net/minecraft/client/renderer/chunk/RenderChunkRegion.java b/net/minecraft/client/renderer/chunk/RenderChunkRegion.java index 02dfccb4..4a28dc3d 100644 --- a/net/minecraft/client/renderer/chunk/RenderChunkRegion.java +++ b/net/minecraft/client/renderer/chunk/RenderChunkRegion.java @@ -66,8 +66,8 @@ public class RenderChunkRegion implements BlockAndTintGetter { } @Override - public int getMinBuildHeight() { - return this.level.getMinBuildHeight(); + public int getMinY() { + return this.level.getMinY(); } @Override diff --git a/net/minecraft/client/renderer/chunk/SectionCompiler.java b/net/minecraft/client/renderer/chunk/SectionCompiler.java index ac7f8b5c..ba13a7b0 100644 --- a/net/minecraft/client/renderer/chunk/SectionCompiler.java +++ b/net/minecraft/client/renderer/chunk/SectionCompiler.java @@ -7,6 +7,7 @@ import com.mojang.blaze3d.vertex.MeshData; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.VertexFormat; import com.mojang.blaze3d.vertex.VertexSorting; +import com.mojang.blaze3d.vertex.MeshData.SortState; import it.unimi.dsi.fastutil.objects.Reference2ObjectArrayMap; import java.util.ArrayList; import java.util.List; @@ -54,7 +55,7 @@ public class SectionCompiler { for (BlockPos blockPos3 : BlockPos.betweenClosed(blockPos, blockPos2)) { BlockState blockState = region.getBlockState(blockPos3); - if (blockState.isSolidRender(region, blockPos3)) { + if (blockState.isSolidRender()) { visGraph.setOpaque(blockPos3); } @@ -131,7 +132,7 @@ public class SectionCompiler { public final Map renderedLayers = new Reference2ObjectArrayMap<>(); public VisibilitySet visibilitySet = new VisibilitySet(); @Nullable - public MeshData.SortState transparencyState; + public SortState transparencyState; public void release() { this.renderedLayers.values().forEach(MeshData::close); diff --git a/net/minecraft/client/renderer/chunk/SectionRenderDispatcher.java b/net/minecraft/client/renderer/chunk/SectionRenderDispatcher.java index e8574401..9f8dc070 100644 --- a/net/minecraft/client/renderer/chunk/SectionRenderDispatcher.java +++ b/net/minecraft/client/renderer/chunk/SectionRenderDispatcher.java @@ -3,13 +3,13 @@ package net.minecraft.client.renderer.chunk; import com.google.common.collect.Lists; import com.google.common.collect.Queues; import com.google.common.collect.Sets; -import com.google.common.primitives.Doubles; +import com.mojang.blaze3d.buffers.BufferUsage; import com.mojang.blaze3d.vertex.ByteBufferBuilder; import com.mojang.blaze3d.vertex.MeshData; import com.mojang.blaze3d.vertex.VertexBuffer; import com.mojang.blaze3d.vertex.VertexSorting; +import com.mojang.blaze3d.vertex.MeshData.SortState; import it.unimi.dsi.fastutil.objects.ObjectArraySet; -import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.Locale; @@ -17,19 +17,13 @@ import java.util.Map; import java.util.Objects; import java.util.Queue; import java.util.Set; -import java.util.concurrent.CancellationException; import java.util.concurrent.CompletableFuture; -import java.util.concurrent.Executor; -import java.util.concurrent.PriorityBlockingQueue; -import java.util.concurrent.atomic.AtomicBoolean; -import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicReference; -import java.util.function.Supplier; import java.util.stream.Collectors; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.CrashReport; -import net.minecraft.Util; +import net.minecraft.TracingExecutor; import net.minecraft.client.Camera; import net.minecraft.client.Minecraft; import net.minecraft.client.multiplayer.ClientLevel; @@ -40,10 +34,18 @@ import net.minecraft.client.renderer.SectionBufferBuilderPack; import net.minecraft.client.renderer.SectionBufferBuilderPool; import net.minecraft.client.renderer.block.BlockRenderDispatcher; import net.minecraft.client.renderer.blockentity.BlockEntityRenderDispatcher; +import net.minecraft.client.renderer.chunk.SectionRenderDispatcher.CompiledSection.1; +import net.minecraft.client.renderer.chunk.SectionRenderDispatcher.CompiledSection.2; +import net.minecraft.client.renderer.chunk.SectionRenderDispatcher.RenderSection.CompileTask; +import net.minecraft.client.renderer.chunk.SectionRenderDispatcher.RenderSection.RebuildTask; +import net.minecraft.client.renderer.chunk.SectionRenderDispatcher.RenderSection.ResortTransparencyTask; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.SectionPos; -import net.minecraft.util.thread.ProcessorMailbox; +import net.minecraft.util.Mth; +import net.minecraft.util.profiling.Profiler; +import net.minecraft.util.profiling.Zone; +import net.minecraft.util.thread.ConsecutiveExecutor; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.chunk.status.ChunkStatus; import net.minecraft.world.phys.AABB; @@ -52,38 +54,35 @@ import org.jetbrains.annotations.Nullable; @Environment(EnvType.CLIENT) public class SectionRenderDispatcher { - private static final int MAX_HIGH_PRIORITY_QUOTA = 2; - private final PriorityBlockingQueue toBatchHighPriority = Queues.newPriorityBlockingQueue(); - private final Queue toBatchLowPriority = Queues.newLinkedBlockingDeque(); - private int highPriorityQuota = 2; + private final CompileTaskDynamicQueue compileQueue = new CompileTaskDynamicQueue(); private final Queue toUpload = Queues.newConcurrentLinkedQueue(); final SectionBufferBuilderPack fixedBuffers; private final SectionBufferBuilderPool bufferPool; private volatile int toBatchCount; private volatile boolean closed; - private final ProcessorMailbox mailbox; - private final Executor executor; + private final ConsecutiveExecutor consecutiveExecutor; + private final TracingExecutor executor; ClientLevel level; final LevelRenderer renderer; private Vec3 camera = Vec3.ZERO; final SectionCompiler sectionCompiler; public SectionRenderDispatcher( - ClientLevel level, - LevelRenderer renderer, - Executor executor, - RenderBuffers buffers, - BlockRenderDispatcher blockRenderer, - BlockEntityRenderDispatcher blockEntityRenderer + ClientLevel clientLevel, + LevelRenderer levelRenderer, + TracingExecutor tracingExecutor, + RenderBuffers renderBuffers, + BlockRenderDispatcher blockRenderDispatcher, + BlockEntityRenderDispatcher blockEntityRenderDispatcher ) { - this.level = level; - this.renderer = renderer; - this.fixedBuffers = buffers.fixedBufferPack(); - this.bufferPool = buffers.sectionBufferPool(); - this.executor = executor; - this.mailbox = ProcessorMailbox.create(executor, "Section Renderer"); - this.mailbox.tell(this::runTask); - this.sectionCompiler = new SectionCompiler(blockRenderer, blockEntityRenderer); + this.level = clientLevel; + this.renderer = levelRenderer; + this.fixedBuffers = renderBuffers.fixedBufferPack(); + this.bufferPool = renderBuffers.sectionBufferPool(); + this.executor = tracingExecutor; + this.consecutiveExecutor = new ConsecutiveExecutor(tracingExecutor, "Section Renderer"); + this.consecutiveExecutor.schedule(this::runTask); + this.sectionCompiler = new SectionCompiler(blockRenderDispatcher, blockEntityRenderDispatcher); } public void setLevel(ClientLevel level) { @@ -92,19 +91,18 @@ public class SectionRenderDispatcher { private void runTask() { if (!this.closed && !this.bufferPool.isEmpty()) { - SectionRenderDispatcher.RenderSection.CompileTask compileTask = this.pollTask(); + CompileTask compileTask = this.compileQueue.poll(this.getCameraPosition()); if (compileTask != null) { SectionBufferBuilderPack sectionBufferBuilderPack = (SectionBufferBuilderPack)Objects.requireNonNull(this.bufferPool.acquire()); - this.toBatchCount = this.toBatchHighPriority.size() + this.toBatchLowPriority.size(); - CompletableFuture.supplyAsync( - Util.wrapThreadWithTaskName(compileTask.name(), (Supplier)(() -> compileTask.doTask(sectionBufferBuilderPack))), this.executor - ) + this.toBatchCount = this.compileQueue.size(); + CompletableFuture.supplyAsync(() -> compileTask.doTask(sectionBufferBuilderPack), this.executor.forName(compileTask.name())) .thenCompose(completableFuture -> completableFuture) .whenComplete((sectionTaskResult, throwable) -> { if (throwable != null) { Minecraft.getInstance().delayCrash(CrashReport.forThrowable(throwable, "Batching sections")); } else { - this.mailbox.tell(() -> { + compileTask.isCompleted.set(true); + this.consecutiveExecutor.schedule(() -> { if (sectionTaskResult == SectionRenderDispatcher.SectionTaskResult.SUCCESSFUL) { sectionBufferBuilderPack.clearAll(); } else { @@ -120,26 +118,6 @@ public class SectionRenderDispatcher { } } - @Nullable - private SectionRenderDispatcher.RenderSection.CompileTask pollTask() { - if (this.highPriorityQuota <= 0) { - SectionRenderDispatcher.RenderSection.CompileTask compileTask = (SectionRenderDispatcher.RenderSection.CompileTask)this.toBatchLowPriority.poll(); - if (compileTask != null) { - this.highPriorityQuota = 2; - return compileTask; - } - } - - SectionRenderDispatcher.RenderSection.CompileTask compileTask = (SectionRenderDispatcher.RenderSection.CompileTask)this.toBatchHighPriority.poll(); - if (compileTask != null) { - this.highPriorityQuota--; - return compileTask; - } else { - this.highPriorityQuota = 2; - return (SectionRenderDispatcher.RenderSection.CompileTask)this.toBatchLowPriority.poll(); - } - } - public String getStats() { return String.format(Locale.ROOT, "pC: %03d, pU: %02d, aB: %02d", this.toBatchCount, this.toUpload.size(), this.bufferPool.getFreeBufferCount()); } @@ -179,17 +157,12 @@ public class SectionRenderDispatcher { this.clearBatchQueue(); } - public void schedule(SectionRenderDispatcher.RenderSection.CompileTask task) { + public void schedule(CompileTask task) { if (!this.closed) { - this.mailbox.tell(() -> { + this.consecutiveExecutor.schedule(() -> { if (!this.closed) { - if (task.isHighPriority) { - this.toBatchHighPriority.offer(task); - } else { - this.toBatchLowPriority.offer(task); - } - - this.toBatchCount = this.toBatchHighPriority.size() + this.toBatchLowPriority.size(); + this.compileQueue.add(task); + this.toBatchCount = this.compileQueue.size(); this.runTask(); } }); @@ -201,9 +174,11 @@ public class SectionRenderDispatcher { if (vertexBuffer.isInvalid()) { meshData.close(); } else { - vertexBuffer.bind(); - vertexBuffer.upload(meshData); - VertexBuffer.unbind(); + try (Zone zone = Profiler.get().zone("Upload Section Layer")) { + vertexBuffer.bind(); + vertexBuffer.upload(meshData); + VertexBuffer.unbind(); + } } }, this.toUpload::add); } @@ -213,28 +188,17 @@ public class SectionRenderDispatcher { if (vertexBuffer.isInvalid()) { result.close(); } else { - vertexBuffer.bind(); - vertexBuffer.uploadIndexBuffer(result); - VertexBuffer.unbind(); + try (Zone zone = Profiler.get().zone("Upload Section Indices")) { + vertexBuffer.bind(); + vertexBuffer.uploadIndexBuffer(result); + VertexBuffer.unbind(); + } } }, this.toUpload::add); } private void clearBatchQueue() { - while (!this.toBatchHighPriority.isEmpty()) { - SectionRenderDispatcher.RenderSection.CompileTask compileTask = (SectionRenderDispatcher.RenderSection.CompileTask)this.toBatchHighPriority.poll(); - if (compileTask != null) { - compileTask.cancel(); - } - } - - while (!this.toBatchLowPriority.isEmpty()) { - SectionRenderDispatcher.RenderSection.CompileTask compileTask = (SectionRenderDispatcher.RenderSection.CompileTask)this.toBatchLowPriority.poll(); - if (compileTask != null) { - compileTask.cancel(); - } - } - + this.compileQueue.clear(); this.toBatchCount = 0; } @@ -250,26 +214,16 @@ public class SectionRenderDispatcher { @Environment(EnvType.CLIENT) public static class CompiledSection { - public static final SectionRenderDispatcher.CompiledSection UNCOMPILED = new SectionRenderDispatcher.CompiledSection() { - @Override - public boolean facesCanSeeEachother(Direction face1, Direction face2) { - return false; - } - }; - public static final SectionRenderDispatcher.CompiledSection EMPTY = new SectionRenderDispatcher.CompiledSection() { - @Override - public boolean facesCanSeeEachother(Direction face1, Direction face2) { - return true; - } - }; + public static final SectionRenderDispatcher.CompiledSection UNCOMPILED = new 1(); + public static final SectionRenderDispatcher.CompiledSection EMPTY = new 2(); final Set hasBlocks = new ObjectArraySet<>(RenderType.chunkBufferLayers().size()); final List renderableBlockEntities = Lists.newArrayList(); VisibilitySet visibilitySet = new VisibilitySet(); @Nullable - MeshData.SortState transparencyState; + SortState transparencyState; - public boolean hasNoRenderableLayers() { - return this.hasBlocks.isEmpty(); + public boolean hasRenderableLayers() { + return !this.hasBlocks.isEmpty(); } public boolean isEmpty(RenderType renderType) { @@ -290,44 +244,38 @@ public class SectionRenderDispatcher { public static final int SIZE = 16; public final int index; public final AtomicReference compiled = new AtomicReference(SectionRenderDispatcher.CompiledSection.UNCOMPILED); - private final AtomicInteger initialCompilationCancelCount = new AtomicInteger(0); + public final AtomicReference pointOfView = new AtomicReference(null); @Nullable - private SectionRenderDispatcher.RenderSection.RebuildTask lastRebuildTask; + private RebuildTask lastRebuildTask; @Nullable - private SectionRenderDispatcher.RenderSection.ResortTransparencyTask lastResortTransparencyTask; + private ResortTransparencyTask lastResortTransparencyTask; private final Set globalBlockEntities = Sets.newHashSet(); private final Map buffers = (Map)RenderType.chunkBufferLayers() .stream() - .collect(Collectors.toMap(renderType -> renderType, renderType -> new VertexBuffer(VertexBuffer.Usage.STATIC))); + .collect(Collectors.toMap(renderType -> renderType, renderType -> new VertexBuffer(BufferUsage.STATIC_WRITE))); private AABB bb; private boolean dirty = true; + long sectionNode = SectionPos.asLong(-1, -1, -1); final BlockPos.MutableBlockPos origin = new BlockPos.MutableBlockPos(-1, -1, -1); - private final BlockPos.MutableBlockPos[] relativeOrigins = Util.make(new BlockPos.MutableBlockPos[6], mutableBlockPoss -> { - for (int i = 0; i < mutableBlockPoss.length; i++) { - mutableBlockPoss[i] = new BlockPos.MutableBlockPos(); - } - }); private boolean playerChanged; - public RenderSection(final int index, final int originX, final int originY, final int originZ) { - this.index = index; - this.setOrigin(originX, originY, originZ); + public RenderSection(final int i, final long l) { + this.index = i; + this.setSectionNode(l); } - private boolean doesChunkExistAt(BlockPos pos) { - return SectionRenderDispatcher.this.level - .getChunk(SectionPos.blockToSectionCoord(pos.getX()), SectionPos.blockToSectionCoord(pos.getZ()), ChunkStatus.FULL, false) - != null; + private boolean doesChunkExistAt(long l) { + return SectionRenderDispatcher.this.level.getChunk(SectionPos.x(l), SectionPos.z(l), ChunkStatus.FULL, false) != null; } public boolean hasAllNeighbors() { int i = 24; return !(this.getDistToPlayerSqr() > 576.0) ? true - : this.doesChunkExistAt(this.relativeOrigins[Direction.WEST.ordinal()]) - && this.doesChunkExistAt(this.relativeOrigins[Direction.NORTH.ordinal()]) - && this.doesChunkExistAt(this.relativeOrigins[Direction.EAST.ordinal()]) - && this.doesChunkExistAt(this.relativeOrigins[Direction.SOUTH.ordinal()]); + : this.doesChunkExistAt(SectionPos.offset(this.sectionNode, Direction.WEST)) + && this.doesChunkExistAt(SectionPos.offset(this.sectionNode, Direction.NORTH)) + && this.doesChunkExistAt(SectionPos.offset(this.sectionNode, Direction.EAST)) + && this.doesChunkExistAt(SectionPos.offset(this.sectionNode, Direction.SOUTH)); } public AABB getBoundingBox() { @@ -338,14 +286,14 @@ public class SectionRenderDispatcher { return (VertexBuffer)this.buffers.get(renderType); } - public void setOrigin(int x, int y, int z) { + public void setSectionNode(long l) { this.reset(); - this.origin.set(x, y, z); - this.bb = new AABB(x, y, z, x + 16, y + 16, z + 16); - - for (Direction direction : Direction.values()) { - this.relativeOrigins[direction.ordinal()].set(this.origin).move(direction, 16); - } + this.sectionNode = l; + int i = SectionPos.sectionToBlockCoord(SectionPos.x(l)); + int j = SectionPos.sectionToBlockCoord(SectionPos.y(l)); + int k = SectionPos.sectionToBlockCoord(SectionPos.z(l)); + this.origin.set(i, j, k); + this.bb = new AABB(i, j, k, i + 16, j + 16, k + 16); } protected double getDistToPlayerSqr() { @@ -363,6 +311,7 @@ public class SectionRenderDispatcher { private void reset() { this.cancelTasks(); this.compiled.set(SectionRenderDispatcher.CompiledSection.UNCOMPILED); + this.pointOfView.set(null); this.dirty = true; } @@ -375,6 +324,10 @@ public class SectionRenderDispatcher { return this.origin; } + public long getSectionNode() { + return this.sectionNode; + } + public void setDirty(boolean playerChanged) { boolean bl = this.dirty; this.dirty = true; @@ -394,57 +347,45 @@ public class SectionRenderDispatcher { return this.dirty && this.playerChanged; } - public BlockPos getRelativeOrigin(Direction direction) { - return this.relativeOrigins[direction.ordinal()]; + public long getNeighborSectionNode(Direction direction) { + return SectionPos.offset(this.sectionNode, direction); } - public boolean resortTransparency(RenderType renderType, SectionRenderDispatcher sectionRenderDispatcher) { - SectionRenderDispatcher.CompiledSection compiledSection = this.getCompiled(); - if (this.lastResortTransparencyTask != null) { - this.lastResortTransparencyTask.cancel(); - } - - if (!compiledSection.hasBlocks.contains(renderType)) { - return false; - } else { - this.lastResortTransparencyTask = new SectionRenderDispatcher.RenderSection.ResortTransparencyTask(this.getDistToPlayerSqr(), compiledSection); - sectionRenderDispatcher.schedule(this.lastResortTransparencyTask); - return true; - } + public void resortTransparency(SectionRenderDispatcher sectionRenderDispatcher) { + this.lastResortTransparencyTask = new ResortTransparencyTask(this, this.getCompiled()); + sectionRenderDispatcher.schedule(this.lastResortTransparencyTask); } - protected boolean cancelTasks() { - boolean bl = false; + public boolean hasTranslucentGeometry() { + return this.getCompiled().hasBlocks.contains(RenderType.translucent()); + } + + public boolean transparencyResortingScheduled() { + return this.lastResortTransparencyTask != null && !this.lastResortTransparencyTask.isCompleted.get(); + } + + protected void cancelTasks() { if (this.lastRebuildTask != null) { this.lastRebuildTask.cancel(); this.lastRebuildTask = null; - bl = true; } if (this.lastResortTransparencyTask != null) { this.lastResortTransparencyTask.cancel(); this.lastResortTransparencyTask = null; } - - return bl; } - public SectionRenderDispatcher.RenderSection.CompileTask createCompileTask(RenderRegionCache regionCache) { - boolean bl = this.cancelTasks(); - RenderChunkRegion renderChunkRegion = regionCache.createRegion(SectionRenderDispatcher.this.level, SectionPos.of(this.origin)); - boolean bl2 = this.compiled.get() == SectionRenderDispatcher.CompiledSection.UNCOMPILED; - if (bl2 && bl) { - this.initialCompilationCancelCount.incrementAndGet(); - } - - this.lastRebuildTask = new SectionRenderDispatcher.RenderSection.RebuildTask( - this.getDistToPlayerSqr(), renderChunkRegion, !bl2 || this.initialCompilationCancelCount.get() > 2 - ); + public CompileTask createCompileTask(RenderRegionCache regionCache) { + this.cancelTasks(); + RenderChunkRegion renderChunkRegion = regionCache.createRegion(SectionRenderDispatcher.this.level, SectionPos.of(this.sectionNode)); + boolean bl = this.compiled.get() != SectionRenderDispatcher.CompiledSection.UNCOMPILED; + this.lastRebuildTask = new RebuildTask(this, renderChunkRegion, bl); return this.lastRebuildTask; } public void rebuildSectionAsync(SectionRenderDispatcher sectionRenderDispatcher, RenderRegionCache regionCache) { - SectionRenderDispatcher.RenderSection.CompileTask compileTask = this.createCompileTask(regionCache); + CompileTask compileTask = this.createCompileTask(regionCache); sectionRenderDispatcher.schedule(compileTask); } @@ -463,20 +404,12 @@ public class SectionRenderDispatcher { } public void compileSync(RenderRegionCache regionCache) { - SectionRenderDispatcher.RenderSection.CompileTask compileTask = this.createCompileTask(regionCache); + CompileTask compileTask = this.createCompileTask(regionCache); compileTask.doTask(SectionRenderDispatcher.this.fixedBuffers); } - public boolean isAxisAlignedWith(int x, int y, int z) { - BlockPos blockPos = this.getOrigin(); - return x == SectionPos.blockToSectionCoord(blockPos.getX()) - || z == SectionPos.blockToSectionCoord(blockPos.getZ()) - || y == SectionPos.blockToSectionCoord(blockPos.getY()); - } - void setCompiled(SectionRenderDispatcher.CompiledSection compiled) { this.compiled.set(compiled); - this.initialCompilationCancelCount.set(0); SectionRenderDispatcher.this.renderer.addRecentlyCompiledSection(this); } @@ -484,160 +417,6 @@ public class SectionRenderDispatcher { Vec3 vec3 = SectionRenderDispatcher.this.getCameraPosition(); return VertexSorting.byDistance((float)(vec3.x - this.origin.getX()), (float)(vec3.y - this.origin.getY()), (float)(vec3.z - this.origin.getZ())); } - - @Environment(EnvType.CLIENT) - abstract class CompileTask implements Comparable { - protected final double distAtCreation; - protected final AtomicBoolean isCancelled = new AtomicBoolean(false); - protected final boolean isHighPriority; - - public CompileTask(final double distAtCreation, final boolean isHighPriority) { - this.distAtCreation = distAtCreation; - this.isHighPriority = isHighPriority; - } - - public abstract CompletableFuture doTask(SectionBufferBuilderPack sectionBufferBuilderPack); - - public abstract void cancel(); - - protected abstract String name(); - - public int compareTo(SectionRenderDispatcher.RenderSection.CompileTask other) { - return Doubles.compare(this.distAtCreation, other.distAtCreation); - } - } - - @Environment(EnvType.CLIENT) - class RebuildTask extends SectionRenderDispatcher.RenderSection.CompileTask { - @Nullable - protected RenderChunkRegion region; - - public RebuildTask(final double distAtCreation, @Nullable final RenderChunkRegion region, final boolean isHighPriority) { - super(distAtCreation, isHighPriority); - this.region = region; - } - - @Override - protected String name() { - return "rend_chk_rebuild"; - } - - @Override - public CompletableFuture doTask(SectionBufferBuilderPack sectionBufferBuilderPack) { - if (this.isCancelled.get()) { - return CompletableFuture.completedFuture(SectionRenderDispatcher.SectionTaskResult.CANCELLED); - } else if (!RenderSection.this.hasAllNeighbors()) { - this.cancel(); - return CompletableFuture.completedFuture(SectionRenderDispatcher.SectionTaskResult.CANCELLED); - } else if (this.isCancelled.get()) { - return CompletableFuture.completedFuture(SectionRenderDispatcher.SectionTaskResult.CANCELLED); - } else { - RenderChunkRegion renderChunkRegion = this.region; - this.region = null; - if (renderChunkRegion == null) { - RenderSection.this.setCompiled(SectionRenderDispatcher.CompiledSection.EMPTY); - return CompletableFuture.completedFuture(SectionRenderDispatcher.SectionTaskResult.SUCCESSFUL); - } else { - SectionPos sectionPos = SectionPos.of(RenderSection.this.origin); - SectionCompiler.Results results = SectionRenderDispatcher.this.sectionCompiler - .compile(sectionPos, renderChunkRegion, RenderSection.this.createVertexSorting(), sectionBufferBuilderPack); - RenderSection.this.updateGlobalBlockEntities(results.globalBlockEntities); - if (this.isCancelled.get()) { - results.release(); - return CompletableFuture.completedFuture(SectionRenderDispatcher.SectionTaskResult.CANCELLED); - } else { - SectionRenderDispatcher.CompiledSection compiledSection = new SectionRenderDispatcher.CompiledSection(); - compiledSection.visibilitySet = results.visibilitySet; - compiledSection.renderableBlockEntities.addAll(results.blockEntities); - compiledSection.transparencyState = results.transparencyState; - List> list = new ArrayList(results.renderedLayers.size()); - results.renderedLayers.forEach((renderType, meshData) -> { - list.add(SectionRenderDispatcher.this.uploadSectionLayer(meshData, RenderSection.this.getBuffer(renderType))); - compiledSection.hasBlocks.add(renderType); - }); - return Util.sequenceFailFast(list).handle((listx, throwable) -> { - if (throwable != null && !(throwable instanceof CancellationException) && !(throwable instanceof InterruptedException)) { - Minecraft.getInstance().delayCrash(CrashReport.forThrowable(throwable, "Rendering section")); - } - - if (this.isCancelled.get()) { - return SectionRenderDispatcher.SectionTaskResult.CANCELLED; - } else { - RenderSection.this.setCompiled(compiledSection); - return SectionRenderDispatcher.SectionTaskResult.SUCCESSFUL; - } - }); - } - } - } - } - - @Override - public void cancel() { - this.region = null; - if (this.isCancelled.compareAndSet(false, true)) { - RenderSection.this.setDirty(false); - } - } - } - - @Environment(EnvType.CLIENT) - class ResortTransparencyTask extends SectionRenderDispatcher.RenderSection.CompileTask { - private final SectionRenderDispatcher.CompiledSection compiledSection; - - public ResortTransparencyTask(final double distAtCreation, final SectionRenderDispatcher.CompiledSection compiledSection) { - super(distAtCreation, true); - this.compiledSection = compiledSection; - } - - @Override - protected String name() { - return "rend_chk_sort"; - } - - @Override - public CompletableFuture doTask(SectionBufferBuilderPack sectionBufferBuilderPack) { - if (this.isCancelled.get()) { - return CompletableFuture.completedFuture(SectionRenderDispatcher.SectionTaskResult.CANCELLED); - } else if (!RenderSection.this.hasAllNeighbors()) { - this.isCancelled.set(true); - return CompletableFuture.completedFuture(SectionRenderDispatcher.SectionTaskResult.CANCELLED); - } else if (this.isCancelled.get()) { - return CompletableFuture.completedFuture(SectionRenderDispatcher.SectionTaskResult.CANCELLED); - } else { - MeshData.SortState sortState = this.compiledSection.transparencyState; - if (sortState != null && !this.compiledSection.isEmpty(RenderType.translucent())) { - VertexSorting vertexSorting = RenderSection.this.createVertexSorting(); - ByteBufferBuilder.Result result = sortState.buildSortedIndexBuffer(sectionBufferBuilderPack.buffer(RenderType.translucent()), vertexSorting); - if (result == null) { - return CompletableFuture.completedFuture(SectionRenderDispatcher.SectionTaskResult.CANCELLED); - } else if (this.isCancelled.get()) { - result.close(); - return CompletableFuture.completedFuture(SectionRenderDispatcher.SectionTaskResult.CANCELLED); - } else { - CompletableFuture completableFuture = SectionRenderDispatcher.this.uploadSectionIndexBuffer( - result, RenderSection.this.getBuffer(RenderType.translucent()) - ) - .thenApply(void_ -> SectionRenderDispatcher.SectionTaskResult.CANCELLED); - return completableFuture.handle((sectionTaskResult, throwable) -> { - if (throwable != null && !(throwable instanceof CancellationException) && !(throwable instanceof InterruptedException)) { - Minecraft.getInstance().delayCrash(CrashReport.forThrowable(throwable, "Rendering section")); - } - - return this.isCancelled.get() ? SectionRenderDispatcher.SectionTaskResult.CANCELLED : SectionRenderDispatcher.SectionTaskResult.SUCCESSFUL; - }); - } - } else { - return CompletableFuture.completedFuture(SectionRenderDispatcher.SectionTaskResult.CANCELLED); - } - } - } - - @Override - public void cancel() { - this.isCancelled.set(true); - } - } } @Environment(EnvType.CLIENT) @@ -645,4 +424,41 @@ public class SectionRenderDispatcher { SUCCESSFUL, CANCELLED; } + + @Environment(EnvType.CLIENT) + public static final class TranslucencyPointOfView { + private int x; + private int y; + private int z; + + public static SectionRenderDispatcher.TranslucencyPointOfView of(Vec3 vec3, long l) { + return new SectionRenderDispatcher.TranslucencyPointOfView().set(vec3, l); + } + + public SectionRenderDispatcher.TranslucencyPointOfView set(Vec3 vec3, long l) { + this.x = getCoordinate(vec3.x(), SectionPos.x(l)); + this.y = getCoordinate(vec3.y(), SectionPos.y(l)); + this.z = getCoordinate(vec3.z(), SectionPos.z(l)); + return this; + } + + private static int getCoordinate(double d, int i) { + int j = SectionPos.blockToSectionCoord(d) - i; + return Mth.clamp(j, -1, 1); + } + + public boolean isAxisAligned() { + return this.x == 0 || this.y == 0 || this.z == 0; + } + + public boolean equals(Object object) { + if (object == this) { + return true; + } else { + return !(object instanceof SectionRenderDispatcher.TranslucencyPointOfView translucencyPointOfView) + ? false + : this.x == translucencyPointOfView.x && this.y == translucencyPointOfView.y && this.z == translucencyPointOfView.z; + } + } + } } diff --git a/net/minecraft/client/renderer/culling/Frustum.java b/net/minecraft/client/renderer/culling/Frustum.java index 377a277f..b0ebfebd 100644 --- a/net/minecraft/client/renderer/culling/Frustum.java +++ b/net/minecraft/client/renderer/culling/Frustum.java @@ -2,6 +2,7 @@ package net.minecraft.client.renderer.culling; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; +import net.minecraft.world.level.levelgen.structure.BoundingBox; import net.minecraft.world.phys.AABB; import org.joml.FrustumIntersection; import org.joml.Matrix4f; @@ -65,16 +66,54 @@ public class Frustum { } public boolean isVisible(AABB aabb) { - return this.cubeInFrustum(aabb.minX, aabb.minY, aabb.minZ, aabb.maxX, aabb.maxY, aabb.maxZ); + int i = this.cubeInFrustum(aabb.minX, aabb.minY, aabb.minZ, aabb.maxX, aabb.maxY, aabb.maxZ); + return i == -2 || i == -1; } - private boolean cubeInFrustum(double minX, double minY, double minZ, double maxX, double maxY, double maxZ) { - float f = (float)(minX - this.camX); - float g = (float)(minY - this.camY); - float h = (float)(minZ - this.camZ); - float i = (float)(maxX - this.camX); - float j = (float)(maxY - this.camY); - float k = (float)(maxZ - this.camZ); - return this.intersection.testAab(f, g, h, i, j, k); + public int cubeInFrustum(BoundingBox boundingBox) { + return this.cubeInFrustum(boundingBox.minX(), boundingBox.minY(), boundingBox.minZ(), boundingBox.maxX() + 1, boundingBox.maxY() + 1, boundingBox.maxZ() + 1); + } + + private int cubeInFrustum(double d, double e, double f, double g, double h, double i) { + float j = (float)(d - this.camX); + float k = (float)(e - this.camY); + float l = (float)(f - this.camZ); + float m = (float)(g - this.camX); + float n = (float)(h - this.camY); + float o = (float)(i - this.camZ); + return this.intersection.intersectAab(j, k, l, m, n, o); + } + + public Vector4f[] getFrustumPoints() { + Vector4f[] vector4fs = new Vector4f[]{ + new Vector4f(-1.0F, -1.0F, -1.0F, 1.0F), + new Vector4f(1.0F, -1.0F, -1.0F, 1.0F), + new Vector4f(1.0F, 1.0F, -1.0F, 1.0F), + new Vector4f(-1.0F, 1.0F, -1.0F, 1.0F), + new Vector4f(-1.0F, -1.0F, 1.0F, 1.0F), + new Vector4f(1.0F, -1.0F, 1.0F, 1.0F), + new Vector4f(1.0F, 1.0F, 1.0F, 1.0F), + new Vector4f(-1.0F, 1.0F, 1.0F, 1.0F) + }; + Matrix4f matrix4f = this.matrix.invert(new Matrix4f()); + + for (int i = 0; i < 8; i++) { + matrix4f.transform(vector4fs[i]); + vector4fs[i].div(vector4fs[i].w()); + } + + return vector4fs; + } + + public double getCamX() { + return this.camX; + } + + public double getCamY() { + return this.camY; + } + + public double getCamZ() { + return this.camZ; } } diff --git a/net/minecraft/client/renderer/debug/BeeDebugRenderer.java b/net/minecraft/client/renderer/debug/BeeDebugRenderer.java index 775e34aa..454acfdf 100644 --- a/net/minecraft/client/renderer/debug/BeeDebugRenderer.java +++ b/net/minecraft/client/renderer/debug/BeeDebugRenderer.java @@ -20,8 +20,8 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.core.BlockPos; import net.minecraft.core.Position; -import net.minecraft.network.protocol.common.custom.BeeDebugPayload; -import net.minecraft.network.protocol.common.custom.HiveDebugPayload; +import net.minecraft.network.protocol.common.custom.BeeDebugPayload.BeeInfo; +import net.minecraft.network.protocol.common.custom.HiveDebugPayload.HiveInfo; import net.minecraft.network.protocol.game.DebugEntityNameGenerator; import net.minecraft.world.entity.player.Player; import org.jetbrains.annotations.Nullable; @@ -47,16 +47,12 @@ public class BeeDebugRenderer implements DebugRenderer.SimpleDebugRenderer { private static final int MAX_TARGETING_DIST = 8; private static final int HIVE_TIMEOUT = 20; private static final float TEXT_SCALE = 0.02F; - private static final int WHITE = -1; - private static final int YELLOW = -256; private static final int ORANGE = -23296; - private static final int GREEN = -16711936; private static final int GRAY = -3355444; private static final int PINK = -98404; - private static final int RED = -65536; private final Minecraft minecraft; private final Map hives = new HashMap(); - private final Map beeInfosPerEntity = new HashMap(); + private final Map beeInfosPerEntity = new HashMap(); @Nullable private UUID lastLookedAtUuid; @@ -71,11 +67,11 @@ public class BeeDebugRenderer implements DebugRenderer.SimpleDebugRenderer { this.lastLookedAtUuid = null; } - public void addOrUpdateHiveInfo(HiveDebugPayload.HiveInfo hiveInfo, long lastSeen) { + public void addOrUpdateHiveInfo(HiveInfo hiveInfo, long lastSeen) { this.hives.put(hiveInfo.pos(), new BeeDebugRenderer.HiveDebugInfo(hiveInfo, lastSeen)); } - public void addOrUpdateBeeInfo(BeeDebugPayload.BeeInfo beeInfo) { + public void addOrUpdateBeeInfo(BeeInfo beeInfo) { this.beeInfosPerEntity.put(beeInfo.uuid(), beeInfo); } @@ -94,7 +90,7 @@ public class BeeDebugRenderer implements DebugRenderer.SimpleDebugRenderer { } private void clearRemovedBees() { - this.beeInfosPerEntity.entrySet().removeIf(entry -> this.minecraft.level.getEntity(((BeeDebugPayload.BeeInfo)entry.getValue()).id()) == null); + this.beeInfosPerEntity.entrySet().removeIf(entry -> this.minecraft.level.getEntity(((BeeInfo)entry.getValue()).id()) == null); } private void clearRemovedHives() { @@ -178,7 +174,7 @@ public class BeeDebugRenderer implements DebugRenderer.SimpleDebugRenderer { renderTextOverPos(poseStack, buffer, "Ghost Hive", hivePos, 1, -65536); } - private void renderHiveInfo(PoseStack poseStack, MultiBufferSource buffer, HiveDebugPayload.HiveInfo hiveInfo, Collection beeUuids) { + private void renderHiveInfo(PoseStack poseStack, MultiBufferSource buffer, HiveInfo hiveInfo, Collection beeUuids) { int i = 0; if (!beeUuids.isEmpty()) { renderTextOverHive(poseStack, buffer, "Blacklisted by " + getBeeUuidsAsString(beeUuids), hiveInfo, i++, -65536); @@ -197,7 +193,7 @@ public class BeeDebugRenderer implements DebugRenderer.SimpleDebugRenderer { renderTextOverHive(poseStack, buffer, hiveInfo.hiveType() + (hiveInfo.sedated() ? " (sedated)" : ""), hiveInfo, i++, -1); } - private void renderPath(PoseStack poseStack, MultiBufferSource buffer, BeeDebugPayload.BeeInfo beeInfo) { + private void renderPath(PoseStack poseStack, MultiBufferSource buffer, BeeInfo beeInfo) { if (beeInfo.path() != null) { PathfindingRenderer.renderPath( poseStack, @@ -213,7 +209,7 @@ public class BeeDebugRenderer implements DebugRenderer.SimpleDebugRenderer { } } - private void renderBeeInfo(PoseStack poseStack, MultiBufferSource buffer, BeeDebugPayload.BeeInfo beeInfo) { + private void renderBeeInfo(PoseStack poseStack, MultiBufferSource buffer, BeeInfo beeInfo) { boolean bl = this.isBeeSelected(beeInfo); int i = 0; renderTextOverMob(poseStack, buffer, beeInfo.pos(), i++, beeInfo.toString(), -1, 0.03F); @@ -238,12 +234,12 @@ public class BeeDebugRenderer implements DebugRenderer.SimpleDebugRenderer { } if (beeInfo.travelTicks() > 0) { - int j = beeInfo.travelTicks() < 600 ? -3355444 : -23296; + int j = beeInfo.travelTicks() < 2400 ? -3355444 : -23296; renderTextOverMob(poseStack, buffer, beeInfo.pos(), i++, "Travelling: " + beeInfo.travelTicks() + " ticks", j, 0.02F); } } - private static void renderTextOverHive(PoseStack poseStack, MultiBufferSource buffer, String text, HiveDebugPayload.HiveInfo hiveInfo, int layer, int color) { + private static void renderTextOverHive(PoseStack poseStack, MultiBufferSource buffer, String text, HiveInfo hiveInfo, int layer, int color) { renderTextOverPos(poseStack, buffer, text, hiveInfo.pos(), layer, color); } @@ -271,21 +267,21 @@ public class BeeDebugRenderer implements DebugRenderer.SimpleDebugRenderer { return this.minecraft.gameRenderer.getMainCamera(); } - private Set getHiveMemberNames(HiveDebugPayload.HiveInfo hiveInfo) { + private Set getHiveMemberNames(HiveInfo hiveInfo) { return (Set)this.getHiveMembers(hiveInfo.pos()).stream().map(DebugEntityNameGenerator::getEntityName).collect(Collectors.toSet()); } - private String getPosDescription(BeeDebugPayload.BeeInfo beeInfo, BlockPos pos) { + private String getPosDescription(BeeInfo beeInfo, BlockPos pos) { double d = Math.sqrt(pos.distToCenterSqr(beeInfo.pos())); double e = Math.round(d * 10.0) / 10.0; return pos.toShortString() + " (dist " + e + ")"; } - private boolean isBeeSelected(BeeDebugPayload.BeeInfo beeInfo) { + private boolean isBeeSelected(BeeInfo beeInfo) { return Objects.equals(this.lastLookedAtUuid, beeInfo.uuid()); } - private boolean isPlayerCloseEnoughToMob(BeeDebugPayload.BeeInfo beeInfo) { + private boolean isPlayerCloseEnoughToMob(BeeInfo beeInfo) { Player player = this.minecraft.player; BlockPos blockPos = BlockPos.containing(player.getX(), beeInfo.pos().y(), player.getZ()); BlockPos blockPos2 = BlockPos.containing(beeInfo.pos()); @@ -293,18 +289,13 @@ public class BeeDebugRenderer implements DebugRenderer.SimpleDebugRenderer { } private Collection getHiveMembers(BlockPos pos) { - return (Collection)this.beeInfosPerEntity - .values() - .stream() - .filter(beeInfo -> beeInfo.hasHive(pos)) - .map(BeeDebugPayload.BeeInfo::uuid) - .collect(Collectors.toSet()); + return (Collection)this.beeInfosPerEntity.values().stream().filter(beeInfo -> beeInfo.hasHive(pos)).map(BeeInfo::uuid).collect(Collectors.toSet()); } private Map> getGhostHives() { Map> map = Maps.>newHashMap(); - for (BeeDebugPayload.BeeInfo beeInfo : this.beeInfosPerEntity.values()) { + for (BeeInfo beeInfo : this.beeInfosPerEntity.values()) { if (beeInfo.hivePos() != null && !this.hives.containsKey(beeInfo.hivePos())) { ((List)map.computeIfAbsent(beeInfo.hivePos(), blockPos -> Lists.newArrayList())).add(beeInfo.generateName()); } @@ -318,6 +309,6 @@ public class BeeDebugRenderer implements DebugRenderer.SimpleDebugRenderer { } @Environment(EnvType.CLIENT) - record HiveDebugInfo(HiveDebugPayload.HiveInfo info, long lastSeen) { + record HiveDebugInfo(HiveInfo info, long lastSeen) { } } diff --git a/net/minecraft/client/renderer/debug/BrainDebugRenderer.java b/net/minecraft/client/renderer/debug/BrainDebugRenderer.java index 940f3c5d..ba18ad50 100644 --- a/net/minecraft/client/renderer/debug/BrainDebugRenderer.java +++ b/net/minecraft/client/renderer/debug/BrainDebugRenderer.java @@ -19,7 +19,7 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.core.BlockPos; import net.minecraft.core.Position; -import net.minecraft.network.protocol.common.custom.BrainDebugPayload; +import net.minecraft.network.protocol.common.custom.BrainDebugPayload.BrainDump; import net.minecraft.network.protocol.game.DebugEntityNameGenerator; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.player.Player; @@ -55,17 +55,13 @@ public class BrainDebugRenderer implements DebugRenderer.SimpleDebugRenderer { private static final int MAX_RENDER_DIST_FOR_POI_INFO = 30; private static final int MAX_TARGETING_DIST = 8; private static final float TEXT_SCALE = 0.02F; - private static final int WHITE = -1; - private static final int YELLOW = -256; private static final int CYAN = -16711681; - private static final int GREEN = -16711936; private static final int GRAY = -3355444; private static final int PINK = -98404; - private static final int RED = -65536; private static final int ORANGE = -23296; private final Minecraft minecraft; private final Map pois = Maps.newHashMap(); - private final Map brainDumpsPerEntity = Maps.newHashMap(); + private final Map brainDumpsPerEntity = Maps.newHashMap(); @Nullable private UUID lastLookedAtUuid; @@ -97,7 +93,7 @@ public class BrainDebugRenderer implements DebugRenderer.SimpleDebugRenderer { } } - public void addOrUpdateBrainDump(BrainDebugPayload.BrainDump brainDump) { + public void addOrUpdateBrainDump(BrainDump brainDump) { this.brainDumpsPerEntity.put(brainDump.uuid(), brainDump); } @@ -116,7 +112,7 @@ public class BrainDebugRenderer implements DebugRenderer.SimpleDebugRenderer { private void clearRemovedEntities() { this.brainDumpsPerEntity.entrySet().removeIf(entry -> { - Entity entity = this.minecraft.level.getEntity(((BrainDebugPayload.BrainDump)entry.getValue()).id()); + Entity entity = this.minecraft.level.getEntity(((BrainDump)entry.getValue()).id()); return entity == null || entity.isRemoved(); }); } @@ -180,13 +176,13 @@ public class BrainDebugRenderer implements DebugRenderer.SimpleDebugRenderer { renderTextOverPoi(poseStack, buffer, poiInfo.type, poiInfo, ++i, -1); } - private void renderPath(PoseStack poseStack, MultiBufferSource buffer, BrainDebugPayload.BrainDump brainDump, double x, double y, double z) { + private void renderPath(PoseStack poseStack, MultiBufferSource buffer, BrainDump brainDump, double x, double y, double z) { if (brainDump.path() != null) { PathfindingRenderer.renderPath(poseStack, buffer, brainDump.path(), 0.5F, false, false, x, y, z); } } - private void renderBrainInfo(PoseStack poseStack, MultiBufferSource buffer, BrainDebugPayload.BrainDump brainDump, double x, double y, double z) { + private void renderBrainInfo(PoseStack poseStack, MultiBufferSource buffer, BrainDump brainDump, double x, double y, double z) { boolean bl = this.isMobSelected(brainDump); int i = 0; renderTextOverMob(poseStack, buffer, brainDump.pos(), i, brainDump.name(), -1, 0.03F); @@ -295,11 +291,11 @@ public class BrainDebugRenderer implements DebugRenderer.SimpleDebugRenderer { return (Set)this.getPotentialTicketHolders(poiInfo.pos).stream().map(DebugEntityNameGenerator::getEntityName).collect(Collectors.toSet()); } - private boolean isMobSelected(BrainDebugPayload.BrainDump brainDump) { + private boolean isMobSelected(BrainDump brainDump) { return Objects.equals(this.lastLookedAtUuid, brainDump.uuid()); } - private boolean isPlayerCloseEnoughToMob(BrainDebugPayload.BrainDump brainDump) { + private boolean isPlayerCloseEnoughToMob(BrainDump brainDump) { Player player = this.minecraft.player; BlockPos blockPos = BlockPos.containing(player.getX(), brainDump.pos().y(), player.getZ()); BlockPos blockPos2 = BlockPos.containing(brainDump.pos()); @@ -311,7 +307,7 @@ public class BrainDebugRenderer implements DebugRenderer.SimpleDebugRenderer { .values() .stream() .filter(brainDump -> brainDump.hasPoi(pos)) - .map(BrainDebugPayload.BrainDump::uuid) + .map(BrainDump::uuid) .collect(Collectors.toSet()); } @@ -320,14 +316,14 @@ public class BrainDebugRenderer implements DebugRenderer.SimpleDebugRenderer { .values() .stream() .filter(brainDump -> brainDump.hasPotentialPoi(pos)) - .map(BrainDebugPayload.BrainDump::uuid) + .map(BrainDump::uuid) .collect(Collectors.toSet()); } private Map> getGhostPois() { Map> map = Maps.>newHashMap(); - for (BrainDebugPayload.BrainDump brainDump : this.brainDumpsPerEntity.values()) { + for (BrainDump brainDump : this.brainDumpsPerEntity.values()) { for (BlockPos blockPos : Iterables.concat(brainDump.pois(), brainDump.potentialPois())) { if (!this.pois.containsKey(blockPos)) { ((List)map.computeIfAbsent(blockPos, blockPosx -> Lists.newArrayList())).add(brainDump.name()); diff --git a/net/minecraft/client/renderer/debug/BreezeDebugRenderer.java b/net/minecraft/client/renderer/debug/BreezeDebugRenderer.java index 024c4e08..d7e188f1 100644 --- a/net/minecraft/client/renderer/debug/BreezeDebugRenderer.java +++ b/net/minecraft/client/renderer/debug/BreezeDebugRenderer.java @@ -11,8 +11,8 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.player.LocalPlayer; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderType; -import net.minecraft.network.protocol.common.custom.BreezeDebugPayload; -import net.minecraft.util.FastColor; +import net.minecraft.network.protocol.common.custom.BreezeDebugPayload.BreezeInfo; +import net.minecraft.util.ARGB; import net.minecraft.world.entity.EntityType; import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.Vec3; @@ -20,15 +20,15 @@ import org.joml.Matrix4f; @Environment(EnvType.CLIENT) public class BreezeDebugRenderer { - private static final int JUMP_TARGET_LINE_COLOR = FastColor.ARGB32.color(255, 255, 100, 255); - private static final int TARGET_LINE_COLOR = FastColor.ARGB32.color(255, 100, 255, 255); - private static final int INNER_CIRCLE_COLOR = FastColor.ARGB32.color(255, 0, 255, 0); - private static final int MIDDLE_CIRCLE_COLOR = FastColor.ARGB32.color(255, 255, 165, 0); - private static final int OUTER_CIRCLE_COLOR = FastColor.ARGB32.color(255, 255, 0, 0); + private static final int JUMP_TARGET_LINE_COLOR = ARGB.color(255, 255, 100, 255); + private static final int TARGET_LINE_COLOR = ARGB.color(255, 100, 255, 255); + private static final int INNER_CIRCLE_COLOR = ARGB.color(255, 0, 255, 0); + private static final int MIDDLE_CIRCLE_COLOR = ARGB.color(255, 255, 165, 0); + private static final int OUTER_CIRCLE_COLOR = ARGB.color(255, 255, 0, 0); private static final int CIRCLE_VERTICES = 20; private static final float SEGMENT_SIZE_RADIANS = (float) (Math.PI / 10); private final Minecraft minecraft; - private final Map perEntity = new HashMap(); + private final Map perEntity = new HashMap(); public BreezeDebugRenderer(Minecraft minecraft) { this.minecraft = minecraft; @@ -40,18 +40,18 @@ public class BreezeDebugRenderer { .getEntities(EntityType.BREEZE, localPlayer.getBoundingBox().inflate(100.0), breeze -> true) .forEach( breeze -> { - Optional optional = Optional.ofNullable((BreezeDebugPayload.BreezeInfo)this.perEntity.get(breeze.getId())); - optional.map(BreezeDebugPayload.BreezeInfo::attackTarget) + Optional optional = Optional.ofNullable((BreezeInfo)this.perEntity.get(breeze.getId())); + optional.map(BreezeInfo::attackTarget) .map(integer -> localPlayer.level().getEntity(integer)) - .map(entity -> entity.getPosition(this.minecraft.getTimer().getGameTimeDeltaPartialTick(true))) + .map(entity -> entity.getPosition(this.minecraft.getDeltaTracker().getGameTimeDeltaPartialTick(true))) .ifPresent(vec3 -> { drawLine(poseStack, buffer, xOffset, yOffset, zOffset, breeze.position(), vec3, TARGET_LINE_COLOR); Vec3 vec32 = vec3.add(0.0, 0.01F, 0.0); drawCircle(poseStack.last().pose(), xOffset, yOffset, zOffset, buffer.getBuffer(RenderType.debugLineStrip(2.0)), vec32, 4.0F, INNER_CIRCLE_COLOR); drawCircle(poseStack.last().pose(), xOffset, yOffset, zOffset, buffer.getBuffer(RenderType.debugLineStrip(2.0)), vec32, 8.0F, MIDDLE_CIRCLE_COLOR); - drawCircle(poseStack.last().pose(), xOffset, yOffset, zOffset, buffer.getBuffer(RenderType.debugLineStrip(2.0)), vec32, 20.0F, OUTER_CIRCLE_COLOR); + drawCircle(poseStack.last().pose(), xOffset, yOffset, zOffset, buffer.getBuffer(RenderType.debugLineStrip(2.0)), vec32, 24.0F, OUTER_CIRCLE_COLOR); }); - optional.map(BreezeDebugPayload.BreezeInfo::jumpTarget) + optional.map(BreezeInfo::jumpTarget) .ifPresent( blockPos -> { drawLine(poseStack, buffer, xOffset, yOffset, zOffset, breeze.position(), blockPos.getCenter(), JUMP_TARGET_LINE_COLOR); @@ -92,7 +92,7 @@ public class BreezeDebugRenderer { this.perEntity.clear(); } - public void add(BreezeDebugPayload.BreezeInfo breeze) { + public void add(BreezeInfo breeze) { this.perEntity.put(breeze.id(), breeze); } } diff --git a/net/minecraft/client/renderer/debug/ChunkBorderRenderer.java b/net/minecraft/client/renderer/debug/ChunkBorderRenderer.java index 5188c1b7..0e239754 100644 --- a/net/minecraft/client/renderer/debug/ChunkBorderRenderer.java +++ b/net/minecraft/client/renderer/debug/ChunkBorderRenderer.java @@ -7,7 +7,7 @@ import net.fabricmc.api.Environment; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderType; -import net.minecraft.util.FastColor; +import net.minecraft.util.ARGB; import net.minecraft.world.entity.Entity; import net.minecraft.world.level.ChunkPos; import org.joml.Matrix4f; @@ -15,8 +15,8 @@ import org.joml.Matrix4f; @Environment(EnvType.CLIENT) public class ChunkBorderRenderer implements DebugRenderer.SimpleDebugRenderer { private final Minecraft minecraft; - private static final int CELL_BORDER = FastColor.ARGB32.color(255, 0, 155, 155); - private static final int YELLOW = FastColor.ARGB32.color(255, 255, 255, 0); + private static final int CELL_BORDER = ARGB.color(255, 0, 155, 155); + private static final int YELLOW = ARGB.color(255, 255, 255, 0); public ChunkBorderRenderer(Minecraft minecraft) { this.minecraft = minecraft; @@ -25,8 +25,8 @@ public class ChunkBorderRenderer implements DebugRenderer.SimpleDebugRenderer { @Override public void render(PoseStack poseStack, MultiBufferSource bufferSource, double camX, double camY, double camZ) { Entity entity = this.minecraft.gameRenderer.getMainCamera().getEntity(); - float f = (float)(this.minecraft.level.getMinBuildHeight() - camY); - float g = (float)(this.minecraft.level.getMaxBuildHeight() - camY); + float f = (float)(this.minecraft.level.getMinY() - camY); + float g = (float)(this.minecraft.level.getMaxY() + 1 - camY); ChunkPos chunkPos = entity.chunkPosition(); float h = (float)(chunkPos.getMinBlockX() - camX); float i = (float)(chunkPos.getMinBlockZ() - camZ); @@ -66,7 +66,7 @@ public class ChunkBorderRenderer implements DebugRenderer.SimpleDebugRenderer { vertexConsumer.addVertex(matrix4f, h + 16.0F, g, i + j).setColor(1.0F, 1.0F, 0.0F, 0.0F); } - for (int j = this.minecraft.level.getMinBuildHeight(); j <= this.minecraft.level.getMaxBuildHeight(); j += 2) { + for (int j = this.minecraft.level.getMinY(); j <= this.minecraft.level.getMaxY() + 1; j += 2) { float l = (float)(j - camY); int m = j % 8 == 0 ? CELL_BORDER : YELLOW; vertexConsumer.addVertex(matrix4f, h, l, i).setColor(1.0F, 1.0F, 0.0F, 0.0F); @@ -89,7 +89,7 @@ public class ChunkBorderRenderer implements DebugRenderer.SimpleDebugRenderer { } } - for (int j = this.minecraft.level.getMinBuildHeight(); j <= this.minecraft.level.getMaxBuildHeight(); j += 16) { + for (int j = this.minecraft.level.getMinY(); j <= this.minecraft.level.getMaxY() + 1; j += 16) { float l = (float)(j - camY); vertexConsumer.addVertex(matrix4f, h, l, i).setColor(0.25F, 0.25F, 1.0F, 0.0F); vertexConsumer.addVertex(matrix4f, h, l, i).setColor(0.25F, 0.25F, 1.0F, 1.0F); diff --git a/net/minecraft/client/renderer/debug/ChunkCullingDebugRenderer.java b/net/minecraft/client/renderer/debug/ChunkCullingDebugRenderer.java new file mode 100644 index 00000000..27c71e1c --- /dev/null +++ b/net/minecraft/client/renderer/debug/ChunkCullingDebugRenderer.java @@ -0,0 +1,174 @@ +package net.minecraft.client.renderer.debug; + +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.LevelRenderer; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.SectionOcclusionGraph; +import net.minecraft.client.renderer.chunk.SectionRenderDispatcher; +import net.minecraft.client.renderer.culling.Frustum; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.util.Mth; +import org.joml.Matrix4f; +import org.joml.Vector4f; + +@Environment(EnvType.CLIENT) +public class ChunkCullingDebugRenderer implements DebugRenderer.SimpleDebugRenderer { + public static final Direction[] DIRECTIONS = Direction.values(); + private final Minecraft minecraft; + + public ChunkCullingDebugRenderer(Minecraft minecraft) { + this.minecraft = minecraft; + } + + @Override + public void render(PoseStack poseStack, MultiBufferSource bufferSource, double camX, double camY, double camZ) { + LevelRenderer levelRenderer = this.minecraft.levelRenderer; + if (this.minecraft.sectionPath || this.minecraft.sectionVisibility) { + SectionOcclusionGraph sectionOcclusionGraph = levelRenderer.getSectionOcclusionGraph(); + + for (SectionRenderDispatcher.RenderSection renderSection : levelRenderer.getVisibleSections()) { + SectionOcclusionGraph.Node node = sectionOcclusionGraph.getNode(renderSection); + if (node != null) { + BlockPos blockPos = renderSection.getOrigin(); + poseStack.pushPose(); + poseStack.translate(blockPos.getX() - camX, blockPos.getY() - camY, blockPos.getZ() - camZ); + Matrix4f matrix4f = poseStack.last().pose(); + if (this.minecraft.sectionPath) { + VertexConsumer vertexConsumer = bufferSource.getBuffer(RenderType.lines()); + int i = node.step == 0 ? 0 : Mth.hsvToRgb(node.step / 50.0F, 0.9F, 0.9F); + int j = i >> 16 & 0xFF; + int k = i >> 8 & 0xFF; + int l = i & 0xFF; + + for (int m = 0; m < DIRECTIONS.length; m++) { + if (node.hasSourceDirection(m)) { + Direction direction = DIRECTIONS[m]; + vertexConsumer.addVertex(matrix4f, 8.0F, 8.0F, 8.0F).setColor(j, k, l, 255).setNormal(direction.getStepX(), direction.getStepY(), direction.getStepZ()); + vertexConsumer.addVertex( + matrix4f, (float)(8 - 16 * direction.getStepX()), (float)(8 - 16 * direction.getStepY()), (float)(8 - 16 * direction.getStepZ()) + ) + .setColor(j, k, l, 255) + .setNormal(direction.getStepX(), direction.getStepY(), direction.getStepZ()); + } + } + } + + if (this.minecraft.sectionVisibility && renderSection.getCompiled().hasRenderableLayers()) { + VertexConsumer vertexConsumer = bufferSource.getBuffer(RenderType.lines()); + int i = 0; + + for (Direction direction2 : DIRECTIONS) { + for (Direction direction3 : DIRECTIONS) { + boolean bl = renderSection.getCompiled().facesCanSeeEachother(direction2, direction3); + if (!bl) { + i++; + vertexConsumer.addVertex( + matrix4f, (float)(8 + 8 * direction2.getStepX()), (float)(8 + 8 * direction2.getStepY()), (float)(8 + 8 * direction2.getStepZ()) + ) + .setColor(255, 0, 0, 255) + .setNormal(direction2.getStepX(), direction2.getStepY(), direction2.getStepZ()); + vertexConsumer.addVertex( + matrix4f, (float)(8 + 8 * direction3.getStepX()), (float)(8 + 8 * direction3.getStepY()), (float)(8 + 8 * direction3.getStepZ()) + ) + .setColor(255, 0, 0, 255) + .setNormal(direction3.getStepX(), direction3.getStepY(), direction3.getStepZ()); + } + } + } + + if (i > 0) { + VertexConsumer vertexConsumer2 = bufferSource.getBuffer(RenderType.debugQuads()); + float f = 0.5F; + float g = 0.2F; + vertexConsumer2.addVertex(matrix4f, 0.5F, 15.5F, 0.5F).setColor(0.9F, 0.9F, 0.0F, 0.2F); + vertexConsumer2.addVertex(matrix4f, 15.5F, 15.5F, 0.5F).setColor(0.9F, 0.9F, 0.0F, 0.2F); + vertexConsumer2.addVertex(matrix4f, 15.5F, 15.5F, 15.5F).setColor(0.9F, 0.9F, 0.0F, 0.2F); + vertexConsumer2.addVertex(matrix4f, 0.5F, 15.5F, 15.5F).setColor(0.9F, 0.9F, 0.0F, 0.2F); + vertexConsumer2.addVertex(matrix4f, 0.5F, 0.5F, 15.5F).setColor(0.9F, 0.9F, 0.0F, 0.2F); + vertexConsumer2.addVertex(matrix4f, 15.5F, 0.5F, 15.5F).setColor(0.9F, 0.9F, 0.0F, 0.2F); + vertexConsumer2.addVertex(matrix4f, 15.5F, 0.5F, 0.5F).setColor(0.9F, 0.9F, 0.0F, 0.2F); + vertexConsumer2.addVertex(matrix4f, 0.5F, 0.5F, 0.5F).setColor(0.9F, 0.9F, 0.0F, 0.2F); + vertexConsumer2.addVertex(matrix4f, 0.5F, 15.5F, 0.5F).setColor(0.9F, 0.9F, 0.0F, 0.2F); + vertexConsumer2.addVertex(matrix4f, 0.5F, 15.5F, 15.5F).setColor(0.9F, 0.9F, 0.0F, 0.2F); + vertexConsumer2.addVertex(matrix4f, 0.5F, 0.5F, 15.5F).setColor(0.9F, 0.9F, 0.0F, 0.2F); + vertexConsumer2.addVertex(matrix4f, 0.5F, 0.5F, 0.5F).setColor(0.9F, 0.9F, 0.0F, 0.2F); + vertexConsumer2.addVertex(matrix4f, 15.5F, 0.5F, 0.5F).setColor(0.9F, 0.9F, 0.0F, 0.2F); + vertexConsumer2.addVertex(matrix4f, 15.5F, 0.5F, 15.5F).setColor(0.9F, 0.9F, 0.0F, 0.2F); + vertexConsumer2.addVertex(matrix4f, 15.5F, 15.5F, 15.5F).setColor(0.9F, 0.9F, 0.0F, 0.2F); + vertexConsumer2.addVertex(matrix4f, 15.5F, 15.5F, 0.5F).setColor(0.9F, 0.9F, 0.0F, 0.2F); + vertexConsumer2.addVertex(matrix4f, 0.5F, 0.5F, 0.5F).setColor(0.9F, 0.9F, 0.0F, 0.2F); + vertexConsumer2.addVertex(matrix4f, 15.5F, 0.5F, 0.5F).setColor(0.9F, 0.9F, 0.0F, 0.2F); + vertexConsumer2.addVertex(matrix4f, 15.5F, 15.5F, 0.5F).setColor(0.9F, 0.9F, 0.0F, 0.2F); + vertexConsumer2.addVertex(matrix4f, 0.5F, 15.5F, 0.5F).setColor(0.9F, 0.9F, 0.0F, 0.2F); + vertexConsumer2.addVertex(matrix4f, 0.5F, 15.5F, 15.5F).setColor(0.9F, 0.9F, 0.0F, 0.2F); + vertexConsumer2.addVertex(matrix4f, 15.5F, 15.5F, 15.5F).setColor(0.9F, 0.9F, 0.0F, 0.2F); + vertexConsumer2.addVertex(matrix4f, 15.5F, 0.5F, 15.5F).setColor(0.9F, 0.9F, 0.0F, 0.2F); + vertexConsumer2.addVertex(matrix4f, 0.5F, 0.5F, 15.5F).setColor(0.9F, 0.9F, 0.0F, 0.2F); + } + } + + poseStack.popPose(); + } + } + } + + Frustum frustum = levelRenderer.getCapturedFrustum(); + if (frustum != null) { + poseStack.pushPose(); + poseStack.translate((float)(frustum.getCamX() - camX), (float)(frustum.getCamY() - camY), (float)(frustum.getCamZ() - camZ)); + Matrix4f matrix4f2 = poseStack.last().pose(); + Vector4f[] vector4fs = frustum.getFrustumPoints(); + VertexConsumer vertexConsumer3 = bufferSource.getBuffer(RenderType.debugQuads()); + this.addFrustumQuad(vertexConsumer3, matrix4f2, vector4fs, 0, 1, 2, 3, 0, 1, 1); + this.addFrustumQuad(vertexConsumer3, matrix4f2, vector4fs, 4, 5, 6, 7, 1, 0, 0); + this.addFrustumQuad(vertexConsumer3, matrix4f2, vector4fs, 0, 1, 5, 4, 1, 1, 0); + this.addFrustumQuad(vertexConsumer3, matrix4f2, vector4fs, 2, 3, 7, 6, 0, 0, 1); + this.addFrustumQuad(vertexConsumer3, matrix4f2, vector4fs, 0, 4, 7, 3, 0, 1, 0); + this.addFrustumQuad(vertexConsumer3, matrix4f2, vector4fs, 1, 5, 6, 2, 1, 0, 1); + VertexConsumer vertexConsumer4 = bufferSource.getBuffer(RenderType.lines()); + this.addFrustumVertex(vertexConsumer4, matrix4f2, vector4fs[0]); + this.addFrustumVertex(vertexConsumer4, matrix4f2, vector4fs[1]); + this.addFrustumVertex(vertexConsumer4, matrix4f2, vector4fs[1]); + this.addFrustumVertex(vertexConsumer4, matrix4f2, vector4fs[2]); + this.addFrustumVertex(vertexConsumer4, matrix4f2, vector4fs[2]); + this.addFrustumVertex(vertexConsumer4, matrix4f2, vector4fs[3]); + this.addFrustumVertex(vertexConsumer4, matrix4f2, vector4fs[3]); + this.addFrustumVertex(vertexConsumer4, matrix4f2, vector4fs[0]); + this.addFrustumVertex(vertexConsumer4, matrix4f2, vector4fs[4]); + this.addFrustumVertex(vertexConsumer4, matrix4f2, vector4fs[5]); + this.addFrustumVertex(vertexConsumer4, matrix4f2, vector4fs[5]); + this.addFrustumVertex(vertexConsumer4, matrix4f2, vector4fs[6]); + this.addFrustumVertex(vertexConsumer4, matrix4f2, vector4fs[6]); + this.addFrustumVertex(vertexConsumer4, matrix4f2, vector4fs[7]); + this.addFrustumVertex(vertexConsumer4, matrix4f2, vector4fs[7]); + this.addFrustumVertex(vertexConsumer4, matrix4f2, vector4fs[4]); + this.addFrustumVertex(vertexConsumer4, matrix4f2, vector4fs[0]); + this.addFrustumVertex(vertexConsumer4, matrix4f2, vector4fs[4]); + this.addFrustumVertex(vertexConsumer4, matrix4f2, vector4fs[1]); + this.addFrustumVertex(vertexConsumer4, matrix4f2, vector4fs[5]); + this.addFrustumVertex(vertexConsumer4, matrix4f2, vector4fs[2]); + this.addFrustumVertex(vertexConsumer4, matrix4f2, vector4fs[6]); + this.addFrustumVertex(vertexConsumer4, matrix4f2, vector4fs[3]); + this.addFrustumVertex(vertexConsumer4, matrix4f2, vector4fs[7]); + poseStack.popPose(); + } + } + + private void addFrustumVertex(VertexConsumer vertexConsumer, Matrix4f matrix4f, Vector4f vector4f) { + vertexConsumer.addVertex(matrix4f, vector4f.x(), vector4f.y(), vector4f.z()).setColor(-16777216).setNormal(0.0F, 0.0F, -1.0F); + } + + private void addFrustumQuad(VertexConsumer vertexConsumer, Matrix4f matrix4f, Vector4f[] vector4fs, int i, int j, int k, int l, int m, int n, int o) { + float f = 0.25F; + vertexConsumer.addVertex(matrix4f, vector4fs[i].x(), vector4fs[i].y(), vector4fs[i].z()).setColor((float)m, (float)n, (float)o, 0.25F); + vertexConsumer.addVertex(matrix4f, vector4fs[j].x(), vector4fs[j].y(), vector4fs[j].z()).setColor((float)m, (float)n, (float)o, 0.25F); + vertexConsumer.addVertex(matrix4f, vector4fs[k].x(), vector4fs[k].y(), vector4fs[k].z()).setColor((float)m, (float)n, (float)o, 0.25F); + vertexConsumer.addVertex(matrix4f, vector4fs[l].x(), vector4fs[l].y(), vector4fs[l].z()).setColor((float)m, (float)n, (float)o, 0.25F); + } +} diff --git a/net/minecraft/client/renderer/debug/CollisionBoxRenderer.java b/net/minecraft/client/renderer/debug/CollisionBoxRenderer.java index 97778813..6d708a44 100644 --- a/net/minecraft/client/renderer/debug/CollisionBoxRenderer.java +++ b/net/minecraft/client/renderer/debug/CollisionBoxRenderer.java @@ -9,7 +9,6 @@ import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.Util; import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.LevelRenderer; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderType; import net.minecraft.world.entity.Entity; @@ -37,7 +36,7 @@ public class CollisionBoxRenderer implements DebugRenderer.SimpleDebugRenderer { VertexConsumer vertexConsumer = bufferSource.getBuffer(RenderType.lines()); for (VoxelShape voxelShape : this.shapes) { - LevelRenderer.renderVoxelShape(poseStack, vertexConsumer, voxelShape, -camX, -camY, -camZ, 1.0F, 1.0F, 1.0F, 1.0F, true); + DebugRenderer.renderVoxelShape(poseStack, vertexConsumer, voxelShape, -camX, -camY, -camZ, 1.0F, 1.0F, 1.0F, 1.0F, true); } } } diff --git a/net/minecraft/client/renderer/debug/DebugRenderer.java b/net/minecraft/client/renderer/debug/DebugRenderer.java index 8636756f..3c0809bf 100644 --- a/net/minecraft/client/renderer/debug/DebugRenderer.java +++ b/net/minecraft/client/renderer/debug/DebugRenderer.java @@ -2,23 +2,29 @@ package net.minecraft.client.renderer.debug; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.VertexConsumer; +import java.util.List; import java.util.Optional; -import java.util.function.Predicate; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.Camera; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Font; -import net.minecraft.client.renderer.LevelRenderer; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.ShapeRenderer; +import net.minecraft.client.renderer.culling.Frustum; import net.minecraft.core.BlockPos; +import net.minecraft.util.ARGB; +import net.minecraft.util.Mth; import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntitySelector; import net.minecraft.world.entity.projectile.ProjectileUtil; import net.minecraft.world.level.LightLayer; import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.EntityHitResult; import net.minecraft.world.phys.Vec3; +import net.minecraft.world.phys.shapes.Shapes; +import net.minecraft.world.phys.shapes.VoxelShape; import org.jetbrains.annotations.Nullable; @Environment(EnvType.CLIENT) @@ -29,7 +35,8 @@ public class DebugRenderer { public final DebugRenderer.SimpleDebugRenderer heightMapRenderer; public final DebugRenderer.SimpleDebugRenderer collisionBoxRenderer; public final DebugRenderer.SimpleDebugRenderer supportBlockRenderer; - public final DebugRenderer.SimpleDebugRenderer neighborsUpdateRenderer; + public final NeighborsUpdateRenderer neighborsUpdateRenderer; + public final RedstoneWireOrientationsRenderer redstoneWireOrientationsRenderer; public final StructureRenderer structureRenderer; public final DebugRenderer.SimpleDebugRenderer lightDebugRenderer; public final DebugRenderer.SimpleDebugRenderer worldGenAttemptRenderer; @@ -44,7 +51,10 @@ public class DebugRenderer { public final GameEventListenerRenderer gameEventListenerRenderer; public final LightSectionDebugRenderer skyLightSectionDebugRenderer; public final BreezeDebugRenderer breezeDebugRenderer; + public final ChunkCullingDebugRenderer chunkCullingDebugRenderer; + public final OctreeDebugRenderer octreeDebugRenderer; private boolean renderChunkborder; + private boolean renderOctree; public DebugRenderer(Minecraft minecraft) { this.waterDebugRenderer = new WaterDebugRenderer(minecraft); @@ -53,6 +63,7 @@ public class DebugRenderer { this.collisionBoxRenderer = new CollisionBoxRenderer(minecraft); this.supportBlockRenderer = new SupportBlockRenderer(minecraft); this.neighborsUpdateRenderer = new NeighborsUpdateRenderer(minecraft); + this.redstoneWireOrientationsRenderer = new RedstoneWireOrientationsRenderer(minecraft); this.structureRenderer = new StructureRenderer(minecraft); this.lightDebugRenderer = new LightDebugRenderer(minecraft); this.worldGenAttemptRenderer = new WorldGenAttemptRenderer(); @@ -67,6 +78,8 @@ public class DebugRenderer { this.gameEventListenerRenderer = new GameEventListenerRenderer(minecraft); this.skyLightSectionDebugRenderer = new LightSectionDebugRenderer(minecraft, LightLayer.SKY); this.breezeDebugRenderer = new BreezeDebugRenderer(minecraft); + this.chunkCullingDebugRenderer = new ChunkCullingDebugRenderer(minecraft); + this.octreeDebugRenderer = new OctreeDebugRenderer(minecraft); } public void clear() { @@ -91,6 +104,7 @@ public class DebugRenderer { this.gameEventListenerRenderer.clear(); this.skyLightSectionDebugRenderer.clear(); this.breezeDebugRenderer.clear(); + this.chunkCullingDebugRenderer.clear(); } /** @@ -103,12 +117,24 @@ public class DebugRenderer { return this.renderChunkborder; } - public void render(PoseStack poseStack, MultiBufferSource.BufferSource bufferSource, double camX, double camY, double camZ) { + public boolean toggleRenderOctree() { + return this.renderOctree = !this.renderOctree; + } + + public void render(PoseStack poseStack, Frustum frustum, MultiBufferSource.BufferSource bufferSource, double d, double e, double f) { if (this.renderChunkborder && !Minecraft.getInstance().showOnlyReducedInfo()) { - this.chunkBorderRenderer.render(poseStack, bufferSource, camX, camY, camZ); + this.chunkBorderRenderer.render(poseStack, bufferSource, d, e, f); } - this.gameTestDebugRenderer.render(poseStack, bufferSource, camX, camY, camZ); + if (this.renderOctree) { + this.octreeDebugRenderer.render(poseStack, frustum, bufferSource, d, e, f); + } + + this.gameTestDebugRenderer.render(poseStack, bufferSource, d, e, f); + } + + public void renderAfterTranslucents(PoseStack poseStack, MultiBufferSource.BufferSource bufferSource, double d, double e, double f) { + this.chunkCullingDebugRenderer.render(poseStack, bufferSource, d, e, f); } public static Optional getTargetedEntity(@Nullable Entity entity, int distance) { @@ -120,8 +146,7 @@ public class DebugRenderer { Vec3 vec33 = vec3.add(vec32); AABB aABB = entity.getBoundingBox().expandTowards(vec32).inflate(1.0); int i = distance * distance; - Predicate predicate = entityx -> !entityx.isSpectator() && entityx.isPickable(); - EntityHitResult entityHitResult = ProjectileUtil.getEntityHitResult(entity, vec3, vec33, aABB, predicate, i); + EntityHitResult entityHitResult = ProjectileUtil.getEntityHitResult(entity, vec3, vec33, aABB, EntitySelector.CAN_BE_PICKED, i); if (entityHitResult == null) { return Optional.empty(); } else { @@ -177,7 +202,7 @@ public class DebugRenderer { float alpha ) { VertexConsumer vertexConsumer = bufferSource.getBuffer(RenderType.debugFilledBox()); - LevelRenderer.addChainedFilledBoxVertices(poseStack, vertexConsumer, minX, minY, minZ, maxX, maxY, maxZ, red, green, blue, alpha); + ShapeRenderer.addChainedFilledBoxVertices(poseStack, vertexConsumer, minX, minY, minZ, maxX, maxY, maxZ, red, green, blue, alpha); } public static void renderFloatingText(PoseStack poseStack, MultiBufferSource bufferSource, String text, int x, int y, int z, int color) { @@ -225,6 +250,48 @@ public class DebugRenderer { } } + private static Vec3 mixColor(float f) { + float g = 5.99999F; + int i = (int)(Mth.clamp(f, 0.0F, 1.0F) * 5.99999F); + float h = f * 5.99999F - i; + + return switch (i) { + case 0 -> new Vec3(1.0, h, 0.0); + case 1 -> new Vec3(1.0F - h, 1.0, 0.0); + case 2 -> new Vec3(0.0, 1.0, h); + case 3 -> new Vec3(0.0, 1.0 - h, 1.0); + case 4 -> new Vec3(h, 0.0, 1.0); + case 5 -> new Vec3(1.0, 0.0, 1.0 - h); + default -> throw new IllegalStateException("Unexpected value: " + i); + }; + } + + private static Vec3 shiftHue(float f, float g, float h, float i) { + Vec3 vec3 = mixColor(i).scale(f); + Vec3 vec32 = mixColor((i + 0.33333334F) % 1.0F).scale(g); + Vec3 vec33 = mixColor((i + 0.6666667F) % 1.0F).scale(h); + Vec3 vec34 = vec3.add(vec32).add(vec33); + double d = Math.max(Math.max(1.0, vec34.x), Math.max(vec34.y, vec34.z)); + return new Vec3(vec34.x / d, vec34.y / d, vec34.z / d); + } + + public static void renderVoxelShape( + PoseStack poseStack, VertexConsumer vertexConsumer, VoxelShape voxelShape, double d, double e, double f, float g, float h, float i, float j, boolean bl + ) { + List list = voxelShape.toAabbs(); + if (!list.isEmpty()) { + int k = bl ? list.size() : list.size() * 8; + ShapeRenderer.renderShape(poseStack, vertexConsumer, Shapes.create((AABB)list.get(0)), d, e, f, ARGB.colorFromFloat(j, g, h, i)); + + for (int l = 1; l < list.size(); l++) { + AABB aABB = (AABB)list.get(l); + float m = (float)l / k; + Vec3 vec3 = shiftHue(g, h, i, m); + ShapeRenderer.renderShape(poseStack, vertexConsumer, Shapes.create(aABB), d, e, f, ARGB.colorFromFloat(j, (float)vec3.x, (float)vec3.y, (float)vec3.z)); + } + } + } + @Environment(EnvType.CLIENT) public interface SimpleDebugRenderer { void render(PoseStack poseStack, MultiBufferSource bufferSource, double camX, double camY, double camZ); diff --git a/net/minecraft/client/renderer/debug/GameEventListenerRenderer.java b/net/minecraft/client/renderer/debug/GameEventListenerRenderer.java index 99174e7e..5c2cd1f5 100644 --- a/net/minecraft/client/renderer/debug/GameEventListenerRenderer.java +++ b/net/minecraft/client/renderer/debug/GameEventListenerRenderer.java @@ -10,9 +10,9 @@ import net.fabricmc.api.Environment; import net.minecraft.Util; import net.minecraft.client.Camera; import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.LevelRenderer; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.ShapeRenderer; import net.minecraft.core.BlockPos; import net.minecraft.core.Holder; import net.minecraft.resources.ResourceKey; @@ -21,6 +21,7 @@ import net.minecraft.world.level.Level; import net.minecraft.world.level.gameevent.GameEvent; import net.minecraft.world.level.gameevent.GameEventListener; import net.minecraft.world.level.gameevent.PositionSource; +import net.minecraft.world.level.gameevent.GameEvent.Context; import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.shapes.Shapes; @@ -59,7 +60,7 @@ public class GameEventListenerRenderer implements DebugRenderer.SimpleDebugRende double jx = vec3x.x() + trackedListener.getListenerRadius(); double k = vec3x.y() + trackedListener.getListenerRadius(); double l = vec3x.z() + trackedListener.getListenerRadius(); - LevelRenderer.renderVoxelShape( + DebugRenderer.renderVoxelShape( poseStack, vertexConsumer, Shapes.create(new AABB(gx, hx, ix, jx, k, l)), -camX, -camY, -camZ, 1.0F, 1.0F, 0.0F, 0.35F, true ); } @@ -71,7 +72,7 @@ public class GameEventListenerRenderer implements DebugRenderer.SimpleDebugRende for (GameEventListenerRenderer.TrackedListener trackedListener2 : this.trackedListeners) { trackedListener2.getPosition(level) .ifPresent( - vec3x -> LevelRenderer.addChainedFilledBoxVertices( + vec3x -> ShapeRenderer.addChainedFilledBoxVertices( poseStack, vertexConsumer2, vec3x.x() - 0.25 - camX, @@ -165,7 +166,7 @@ public class GameEventListenerRenderer implements DebugRenderer.SimpleDebugRende } @Override - public boolean handleGameEvent(ServerLevel level, Holder gameEvent, GameEvent.Context context, Vec3 pos) { + public boolean handleGameEvent(ServerLevel level, Holder gameEvent, Context context, Vec3 pos) { return false; } } diff --git a/net/minecraft/client/renderer/debug/GoalSelectorDebugRenderer.java b/net/minecraft/client/renderer/debug/GoalSelectorDebugRenderer.java index d88f40b8..704c7cbf 100644 --- a/net/minecraft/client/renderer/debug/GoalSelectorDebugRenderer.java +++ b/net/minecraft/client/renderer/debug/GoalSelectorDebugRenderer.java @@ -10,7 +10,7 @@ import net.minecraft.client.Camera; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.core.BlockPos; -import net.minecraft.network.protocol.common.custom.GoalDebugPayload; +import net.minecraft.network.protocol.common.custom.GoalDebugPayload.DebugGoal; @Environment(EnvType.CLIENT) public class GoalSelectorDebugRenderer implements DebugRenderer.SimpleDebugRenderer { @@ -23,7 +23,7 @@ public class GoalSelectorDebugRenderer implements DebugRenderer.SimpleDebugRende this.goalSelectors.clear(); } - public void addGoalSelector(int mobId, BlockPos entityPos, List goals) { + public void addGoalSelector(int mobId, BlockPos entityPos, List goals) { this.goalSelectors.put(mobId, new GoalSelectorDebugRenderer.EntityGoalInfo(entityPos, goals)); } @@ -44,7 +44,7 @@ public class GoalSelectorDebugRenderer implements DebugRenderer.SimpleDebugRende BlockPos blockPos2 = entityGoalInfo.entityPos; if (blockPos.closerThan(blockPos2, 160.0)) { for (int i = 0; i < entityGoalInfo.goals.size(); i++) { - GoalDebugPayload.DebugGoal debugGoal = (GoalDebugPayload.DebugGoal)entityGoalInfo.goals.get(i); + DebugGoal debugGoal = (DebugGoal)entityGoalInfo.goals.get(i); double d = blockPos2.getX() + 0.5; double e = blockPos2.getY() + 2.0 + i * 0.25; double f = blockPos2.getZ() + 0.5; @@ -56,6 +56,6 @@ public class GoalSelectorDebugRenderer implements DebugRenderer.SimpleDebugRende } @Environment(EnvType.CLIENT) - record EntityGoalInfo(BlockPos entityPos, List goals) { + record EntityGoalInfo(BlockPos entityPos, List goals) { } } diff --git a/net/minecraft/client/renderer/debug/HeightMapRenderer.java b/net/minecraft/client/renderer/debug/HeightMapRenderer.java index 3a30330a..55cf8f4f 100644 --- a/net/minecraft/client/renderer/debug/HeightMapRenderer.java +++ b/net/minecraft/client/renderer/debug/HeightMapRenderer.java @@ -6,9 +6,9 @@ import java.util.Map.Entry; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.LevelRenderer; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.ShapeRenderer; import net.minecraft.core.BlockPos; import net.minecraft.core.SectionPos; import net.minecraft.world.level.ChunkPos; @@ -47,7 +47,7 @@ public class HeightMapRenderer implements DebugRenderer.SimpleDebugRenderer { int m = SectionPos.sectionToBlockCoord(chunkPos.x, k); int n = SectionPos.sectionToBlockCoord(chunkPos.z, l); float f = (float)(levelAccessor.getHeight(types, m, n) + types.ordinal() * 0.09375F - camY); - LevelRenderer.addChainedFilledBoxVertices( + ShapeRenderer.addChainedFilledBoxVertices( poseStack, vertexConsumer, m + 0.25F - camX, diff --git a/net/minecraft/client/renderer/debug/LightSectionDebugRenderer.java b/net/minecraft/client/renderer/debug/LightSectionDebugRenderer.java index 1f055074..51782cc9 100644 --- a/net/minecraft/client/renderer/debug/LightSectionDebugRenderer.java +++ b/net/minecraft/client/renderer/debug/LightSectionDebugRenderer.java @@ -7,9 +7,9 @@ import java.time.Instant; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.LevelRenderer; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.ShapeRenderer; import net.minecraft.core.Direction; import net.minecraft.core.SectionPos; import net.minecraft.world.level.LightLayer; @@ -87,7 +87,7 @@ public class LightSectionDebugRenderer implements DebugRenderer.SimpleDebugRende float f = (float)(SectionPos.sectionToBlockCoord(blockX) - camX); float g = (float)(SectionPos.sectionToBlockCoord(blockY) - camY); float h = (float)(SectionPos.sectionToBlockCoord(blockZ) - camZ); - LevelRenderer.renderFace(poseStack, buffer, face, f, g, h, f + 16.0F, g + 16.0F, h + 16.0F, color.x(), color.y(), color.z(), color.w()); + ShapeRenderer.renderFace(poseStack, buffer, face, f, g, h, f + 16.0F, g + 16.0F, h + 16.0F, color.x(), color.y(), color.z(), color.w()); } private static void renderEdge( diff --git a/net/minecraft/client/renderer/debug/NeighborsUpdateRenderer.java b/net/minecraft/client/renderer/debug/NeighborsUpdateRenderer.java index 7a0197cf..8c832213 100644 --- a/net/minecraft/client/renderer/debug/NeighborsUpdateRenderer.java +++ b/net/minecraft/client/renderer/debug/NeighborsUpdateRenderer.java @@ -12,9 +12,9 @@ import java.util.Map.Entry; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.LevelRenderer; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.ShapeRenderer; import net.minecraft.core.BlockPos; import net.minecraft.world.phys.AABB; @@ -56,7 +56,7 @@ public class NeighborsUpdateRenderer implements DebugRenderer.SimpleDebugRendere Integer integer = (Integer)entry2.getValue(); if (set.add(blockPos)) { AABB aABB = new AABB(BlockPos.ZERO).inflate(0.002).deflate(0.0025 * m).move(blockPos.getX(), blockPos.getY(), blockPos.getZ()).move(-camX, -camY, -camZ); - LevelRenderer.renderLineBox(poseStack, vertexConsumer, aABB.minX, aABB.minY, aABB.minZ, aABB.maxX, aABB.maxY, aABB.maxZ, 1.0F, 1.0F, 1.0F, 1.0F); + ShapeRenderer.renderLineBox(poseStack, vertexConsumer, aABB.minX, aABB.minY, aABB.minZ, aABB.maxX, aABB.maxY, aABB.maxZ, 1.0F, 1.0F, 1.0F, 1.0F); map.put(blockPos, integer); } } diff --git a/net/minecraft/client/renderer/debug/OctreeDebugRenderer.java b/net/minecraft/client/renderer/debug/OctreeDebugRenderer.java new file mode 100644 index 00000000..b4bf58dc --- /dev/null +++ b/net/minecraft/client/renderer/debug/OctreeDebugRenderer.java @@ -0,0 +1,72 @@ +package net.minecraft.client.renderer.debug; + +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.Octree; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.ShapeRenderer; +import net.minecraft.client.renderer.culling.Frustum; +import net.minecraft.util.Mth; +import net.minecraft.world.phys.AABB; +import org.apache.commons.lang3.mutable.MutableInt; + +@Environment(EnvType.CLIENT) +public class OctreeDebugRenderer { + private final Minecraft minecraft; + + public OctreeDebugRenderer(Minecraft minecraft) { + this.minecraft = minecraft; + } + + public void render(PoseStack poseStack, Frustum frustum, MultiBufferSource multiBufferSource, double d, double e, double f) { + Octree octree = this.minecraft.levelRenderer.getSectionOcclusionGraph().getOctree(); + MutableInt mutableInt = new MutableInt(0); + octree.visitNodes((node, bl, i, bl2) -> this.renderNode(node, poseStack, multiBufferSource, d, e, f, i, bl, mutableInt, bl2), frustum, 32); + } + + private void renderNode( + Octree.Node node, + PoseStack poseStack, + MultiBufferSource multiBufferSource, + double d, + double e, + double f, + int i, + boolean bl, + MutableInt mutableInt, + boolean bl2 + ) { + AABB aABB = node.getAABB(); + double g = aABB.getXsize(); + long l = Math.round(g / 16.0); + if (l == 1L) { + mutableInt.add(1); + double h = aABB.getCenter().x; + double j = aABB.getCenter().y; + double k = aABB.getCenter().z; + int m = bl2 ? -16711936 : -1; + DebugRenderer.renderFloatingText(poseStack, multiBufferSource, String.valueOf(mutableInt.getValue()), h, j, k, m, 0.3F); + } + + VertexConsumer vertexConsumer = multiBufferSource.getBuffer(RenderType.lines()); + long n = l + 5L; + ShapeRenderer.renderLineBox( + poseStack, + vertexConsumer, + aABB.deflate(0.1 * i).move(-d, -e, -f), + getColorComponent(n, 0.3F), + getColorComponent(n, 0.8F), + getColorComponent(n, 0.5F), + bl ? 0.4F : 1.0F + ); + } + + private static float getColorComponent(long l, float f) { + float g = 0.1F; + return Mth.frac(f * (float)l) * 0.9F + 0.1F; + } +} diff --git a/net/minecraft/client/renderer/debug/PathfindingRenderer.java b/net/minecraft/client/renderer/debug/PathfindingRenderer.java index 6592de15..15b325c5 100644 --- a/net/minecraft/client/renderer/debug/PathfindingRenderer.java +++ b/net/minecraft/client/renderer/debug/PathfindingRenderer.java @@ -14,6 +14,7 @@ import net.minecraft.core.BlockPos; import net.minecraft.util.Mth; import net.minecraft.world.level.pathfinder.Node; import net.minecraft.world.level.pathfinder.Path; +import net.minecraft.world.level.pathfinder.Path.DebugData; import net.minecraft.world.phys.AABB; @Environment(EnvType.CLIENT) @@ -91,7 +92,7 @@ public class PathfindingRenderer implements DebugRenderer.SimpleDebugRenderer { } } - Path.DebugData debugData = path.debugData(); + DebugData debugData = path.debugData(); if (bl && debugData != null) { for (Node node2 : debugData.closedSet()) { if (distanceToCamera(node2.asBlockPos(), x, y, z) <= 80.0F) { diff --git a/net/minecraft/client/renderer/debug/RaidDebugRenderer.java b/net/minecraft/client/renderer/debug/RaidDebugRenderer.java index 033e4e87..3f582676 100644 --- a/net/minecraft/client/renderer/debug/RaidDebugRenderer.java +++ b/net/minecraft/client/renderer/debug/RaidDebugRenderer.java @@ -38,7 +38,6 @@ public class RaidDebugRenderer implements DebugRenderer.SimpleDebugRenderer { private static void highlightRaidCenter(PoseStack poseStack, MultiBufferSource buffer, BlockPos pos) { DebugRenderer.renderFilledUnitCube(poseStack, buffer, pos, 1.0F, 0.0F, 0.0F, 0.15F); - int i = -65536; renderTextOverBlock(poseStack, buffer, "Raid center", pos, -65536); } diff --git a/net/minecraft/client/renderer/debug/RedstoneWireOrientationsRenderer.java b/net/minecraft/client/renderer/debug/RedstoneWireOrientationsRenderer.java new file mode 100644 index 00000000..0b5ad1a0 --- /dev/null +++ b/net/minecraft/client/renderer/debug/RedstoneWireOrientationsRenderer.java @@ -0,0 +1,54 @@ +package net.minecraft.client.renderer.debug; + +import com.google.common.collect.Lists; +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; +import java.util.Iterator; +import java.util.List; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.ShapeRenderer; +import net.minecraft.network.protocol.common.custom.RedstoneWireOrientationsDebugPayload; +import net.minecraft.world.level.redstone.Orientation; +import org.joml.Vector3f; + +@Environment(EnvType.CLIENT) +public class RedstoneWireOrientationsRenderer implements DebugRenderer.SimpleDebugRenderer { + public static final int TIMEOUT = 200; + private final Minecraft minecraft; + private final List updatedWires = Lists.newArrayList(); + + RedstoneWireOrientationsRenderer(Minecraft minecraft) { + this.minecraft = minecraft; + } + + public void addWireOrientations(RedstoneWireOrientationsDebugPayload redstoneWireOrientationsDebugPayload) { + this.updatedWires.add(redstoneWireOrientationsDebugPayload); + } + + @Override + public void render(PoseStack poseStack, MultiBufferSource bufferSource, double camX, double camY, double camZ) { + VertexConsumer vertexConsumer = bufferSource.getBuffer(RenderType.lines()); + long l = this.minecraft.level.getGameTime(); + Iterator iterator = this.updatedWires.iterator(); + + while (iterator.hasNext()) { + RedstoneWireOrientationsDebugPayload redstoneWireOrientationsDebugPayload = (RedstoneWireOrientationsDebugPayload)iterator.next(); + long m = l - redstoneWireOrientationsDebugPayload.time(); + if (m > 200L) { + iterator.remove(); + } else { + for (RedstoneWireOrientationsDebugPayload.Wire wire : redstoneWireOrientationsDebugPayload.wires()) { + Vector3f vector3f = wire.pos().getBottomCenter().subtract(camX, camY - 0.1, camZ).toVector3f(); + Orientation orientation = wire.orientation(); + ShapeRenderer.renderVector(poseStack, vertexConsumer, vector3f, orientation.getFront().getUnitVec3().scale(0.5), -16776961); + ShapeRenderer.renderVector(poseStack, vertexConsumer, vector3f, orientation.getUp().getUnitVec3().scale(0.4), -65536); + ShapeRenderer.renderVector(poseStack, vertexConsumer, vector3f, orientation.getSide().getUnitVec3().scale(0.3), -256); + } + } + } + } +} diff --git a/net/minecraft/client/renderer/debug/StructureRenderer.java b/net/minecraft/client/renderer/debug/StructureRenderer.java index 0a3fb54f..b8cb7991 100644 --- a/net/minecraft/client/renderer/debug/StructureRenderer.java +++ b/net/minecraft/client/renderer/debug/StructureRenderer.java @@ -10,11 +10,11 @@ import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.Camera; import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.LevelRenderer; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.ShapeRenderer; import net.minecraft.core.BlockPos; -import net.minecraft.network.protocol.common.custom.StructuresDebugPayload; +import net.minecraft.network.protocol.common.custom.StructuresDebugPayload.PieceInfo; import net.minecraft.resources.ResourceKey; import net.minecraft.world.level.Level; import net.minecraft.world.level.levelgen.structure.BoundingBox; @@ -23,7 +23,7 @@ import net.minecraft.world.level.levelgen.structure.BoundingBox; public class StructureRenderer implements DebugRenderer.SimpleDebugRenderer { private final Minecraft minecraft; private final Map, Map> postMainBoxes = Maps., Map>newIdentityHashMap(); - private final Map, Map> postPieces = Maps., Map>newIdentityHashMap(); + private final Map, Map> postPieces = Maps., Map>newIdentityHashMap(); private static final int MAX_RENDER_DIST = 500; public StructureRenderer(Minecraft minecraft) { @@ -39,7 +39,7 @@ public class StructureRenderer implements DebugRenderer.SimpleDebugRenderer { if (this.postMainBoxes.containsKey(resourceKey)) { for (BoundingBox boundingBox : ((Map)this.postMainBoxes.get(resourceKey)).values()) { if (blockPos.closerThan(boundingBox.getCenter(), 500.0)) { - LevelRenderer.renderLineBox( + ShapeRenderer.renderLineBox( poseStack, vertexConsumer, boundingBox.minX() - camX, @@ -60,13 +60,13 @@ public class StructureRenderer implements DebugRenderer.SimpleDebugRenderer { } } - Map map = (Map)this.postPieces.get(resourceKey); + Map map = (Map)this.postPieces.get(resourceKey); if (map != null) { - for (StructuresDebugPayload.PieceInfo pieceInfo : map.values()) { + for (PieceInfo pieceInfo : map.values()) { BoundingBox boundingBox2 = pieceInfo.boundingBox(); if (blockPos.closerThan(boundingBox2.getCenter(), 500.0)) { if (pieceInfo.isStart()) { - LevelRenderer.renderLineBox( + ShapeRenderer.renderLineBox( poseStack, vertexConsumer, boundingBox2.minX() - camX, @@ -84,7 +84,7 @@ public class StructureRenderer implements DebugRenderer.SimpleDebugRenderer { 0.0F ); } else { - LevelRenderer.renderLineBox( + ShapeRenderer.renderLineBox( poseStack, vertexConsumer, boundingBox2.minX() - camX, @@ -107,12 +107,11 @@ public class StructureRenderer implements DebugRenderer.SimpleDebugRenderer { } } - public void addBoundingBox(BoundingBox boundingBox, List pieces, ResourceKey dimension) { + public void addBoundingBox(BoundingBox boundingBox, List pieces, ResourceKey dimension) { ((Map)this.postMainBoxes.computeIfAbsent(dimension, resourceKey -> new HashMap())).put(boundingBox.toString(), boundingBox); - Map map = (Map)this.postPieces - .computeIfAbsent(dimension, resourceKey -> new HashMap()); + Map map = (Map)this.postPieces.computeIfAbsent(dimension, resourceKey -> new HashMap()); - for (StructuresDebugPayload.PieceInfo pieceInfo : pieces) { + for (PieceInfo pieceInfo : pieces) { map.put(pieceInfo.boundingBox().toString(), pieceInfo); } } diff --git a/net/minecraft/client/renderer/debug/SupportBlockRenderer.java b/net/minecraft/client/renderer/debug/SupportBlockRenderer.java index 1e541779..d6b53d68 100644 --- a/net/minecraft/client/renderer/debug/SupportBlockRenderer.java +++ b/net/minecraft/client/renderer/debug/SupportBlockRenderer.java @@ -9,9 +9,9 @@ import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.Util; import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.LevelRenderer; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.ShapeRenderer; import net.minecraft.core.BlockPos; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.player.Player; @@ -84,8 +84,8 @@ public class SupportBlockRenderer implements DebugRenderer.SimpleDebugRenderer { double g = d + 1.0 + 4.0 * bias; double h = e + 1.0 + 4.0 * bias; double i = f + 1.0 + 4.0 * bias; - LevelRenderer.renderLineBox(poseStack, buffer.getBuffer(RenderType.lines()), d, e, f, g, h, i, red, green, blue, 0.4F); - LevelRenderer.renderVoxelShape( + ShapeRenderer.renderLineBox(poseStack, buffer.getBuffer(RenderType.lines()), d, e, f, g, h, i, red, green, blue, 0.4F); + DebugRenderer.renderVoxelShape( poseStack, buffer.getBuffer(RenderType.lines()), this.minecraft.level.getBlockState(pos).getCollisionShape(this.minecraft.level, pos, CollisionContext.empty()).move(pos.getX(), pos.getY(), pos.getZ()), diff --git a/net/minecraft/client/renderer/debug/WorldGenAttemptRenderer.java b/net/minecraft/client/renderer/debug/WorldGenAttemptRenderer.java index 072644da..bf9ad746 100644 --- a/net/minecraft/client/renderer/debug/WorldGenAttemptRenderer.java +++ b/net/minecraft/client/renderer/debug/WorldGenAttemptRenderer.java @@ -6,9 +6,9 @@ import com.mojang.blaze3d.vertex.VertexConsumer; import java.util.List; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; -import net.minecraft.client.renderer.LevelRenderer; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.ShapeRenderer; import net.minecraft.core.BlockPos; @Environment(EnvType.CLIENT) @@ -37,7 +37,7 @@ public class WorldGenAttemptRenderer implements DebugRenderer.SimpleDebugRendere BlockPos blockPos = (BlockPos)this.toRender.get(i); Float float_ = (Float)this.scales.get(i); float f = float_ / 2.0F; - LevelRenderer.addChainedFilledBoxVertices( + ShapeRenderer.addChainedFilledBoxVertices( poseStack, vertexConsumer, blockPos.getX() + 0.5F - f - camX, diff --git a/net/minecraft/client/renderer/entity/AbstractBoatRenderer.java b/net/minecraft/client/renderer/entity/AbstractBoatRenderer.java new file mode 100644 index 00000000..c90186a2 --- /dev/null +++ b/net/minecraft/client/renderer/entity/AbstractBoatRenderer.java @@ -0,0 +1,70 @@ +package net.minecraft.client.renderer.entity; + +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; +import com.mojang.math.Axis; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.client.model.EntityModel; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.entity.state.BoatRenderState; +import net.minecraft.client.renderer.texture.OverlayTexture; +import net.minecraft.util.Mth; +import net.minecraft.world.entity.vehicle.AbstractBoat; +import org.joml.Quaternionf; + +@Environment(EnvType.CLIENT) +public abstract class AbstractBoatRenderer extends EntityRenderer { + public AbstractBoatRenderer(EntityRendererProvider.Context context) { + super(context); + this.shadowRadius = 0.8F; + } + + public void render(BoatRenderState boatRenderState, PoseStack poseStack, MultiBufferSource multiBufferSource, int i) { + poseStack.pushPose(); + poseStack.translate(0.0F, 0.375F, 0.0F); + poseStack.mulPose(Axis.YP.rotationDegrees(180.0F - boatRenderState.yRot)); + float f = boatRenderState.hurtTime; + if (f > 0.0F) { + poseStack.mulPose(Axis.XP.rotationDegrees(Mth.sin(f) * f * boatRenderState.damageTime / 10.0F * boatRenderState.hurtDir)); + } + + if (!Mth.equal(boatRenderState.bubbleAngle, 0.0F)) { + poseStack.mulPose(new Quaternionf().setAngleAxis(boatRenderState.bubbleAngle * (float) (Math.PI / 180.0), 1.0F, 0.0F, 1.0F)); + } + + poseStack.scale(-1.0F, -1.0F, 1.0F); + poseStack.mulPose(Axis.YP.rotationDegrees(90.0F)); + EntityModel entityModel = this.model(); + entityModel.setupAnim(boatRenderState); + VertexConsumer vertexConsumer = multiBufferSource.getBuffer(this.renderType()); + entityModel.renderToBuffer(poseStack, vertexConsumer, i, OverlayTexture.NO_OVERLAY); + this.renderTypeAdditions(boatRenderState, poseStack, multiBufferSource, i); + poseStack.popPose(); + super.render(boatRenderState, poseStack, multiBufferSource, i); + } + + protected void renderTypeAdditions(BoatRenderState boatRenderState, PoseStack poseStack, MultiBufferSource multiBufferSource, int i) { + } + + protected abstract EntityModel model(); + + protected abstract RenderType renderType(); + + public BoatRenderState createRenderState() { + return new BoatRenderState(); + } + + public void extractRenderState(AbstractBoat abstractBoat, BoatRenderState boatRenderState, float f) { + super.extractRenderState(abstractBoat, boatRenderState, f); + boatRenderState.yRot = abstractBoat.getYRot(f); + boatRenderState.hurtTime = abstractBoat.getHurtTime() - f; + boatRenderState.hurtDir = abstractBoat.getHurtDir(); + boatRenderState.damageTime = Math.max(abstractBoat.getDamage() - f, 0.0F); + boatRenderState.bubbleAngle = abstractBoat.getBubbleAngle(f); + boatRenderState.isUnderWater = abstractBoat.isUnderWater(); + boatRenderState.rowingTimeLeft = abstractBoat.getRowingTime(0, f); + boatRenderState.rowingTimeRight = abstractBoat.getRowingTime(1, f); + } +} diff --git a/net/minecraft/client/renderer/entity/AbstractHoglinRenderer.java b/net/minecraft/client/renderer/entity/AbstractHoglinRenderer.java new file mode 100644 index 00000000..e3f39bb8 --- /dev/null +++ b/net/minecraft/client/renderer/entity/AbstractHoglinRenderer.java @@ -0,0 +1,25 @@ +package net.minecraft.client.renderer.entity; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.client.model.HoglinModel; +import net.minecraft.client.model.geom.ModelLayerLocation; +import net.minecraft.client.renderer.entity.state.HoglinRenderState; +import net.minecraft.world.entity.Mob; +import net.minecraft.world.entity.monster.hoglin.HoglinBase; + +@Environment(EnvType.CLIENT) +public abstract class AbstractHoglinRenderer extends AgeableMobRenderer { + public AbstractHoglinRenderer(EntityRendererProvider.Context context, ModelLayerLocation modelLayerLocation, ModelLayerLocation modelLayerLocation2, float f) { + super(context, new HoglinModel(context.bakeLayer(modelLayerLocation)), new HoglinModel(context.bakeLayer(modelLayerLocation2)), f); + } + + public HoglinRenderState createRenderState() { + return new HoglinRenderState(); + } + + public void extractRenderState(T mob, HoglinRenderState hoglinRenderState, float f) { + super.extractRenderState(mob, hoglinRenderState, f); + hoglinRenderState.attackAnimationRemainingTicks = mob.getAttackAnimationRemainingTicks(); + } +} diff --git a/net/minecraft/client/renderer/entity/AbstractHorseRenderer.java b/net/minecraft/client/renderer/entity/AbstractHorseRenderer.java index 86e76640..84485420 100644 --- a/net/minecraft/client/renderer/entity/AbstractHorseRenderer.java +++ b/net/minecraft/client/renderer/entity/AbstractHorseRenderer.java @@ -3,20 +3,32 @@ package net.minecraft.client.renderer.entity; import com.mojang.blaze3d.vertex.PoseStack; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; -import net.minecraft.client.model.HorseModel; +import net.minecraft.client.model.EntityModel; +import net.minecraft.client.renderer.entity.state.EquineRenderState; import net.minecraft.world.entity.animal.horse.AbstractHorse; @Environment(EnvType.CLIENT) -public abstract class AbstractHorseRenderer> extends MobRenderer { +public abstract class AbstractHorseRenderer> + extends AgeableMobRenderer { private final float scale; - public AbstractHorseRenderer(EntityRendererProvider.Context context, M model, float scale) { - super(context, model, 0.75F); - this.scale = scale; + public AbstractHorseRenderer(EntityRendererProvider.Context context, M entityModel, M entityModel2, float f) { + super(context, entityModel, entityModel2, 0.75F); + this.scale = f; } - protected void scale(T livingEntity, PoseStack poseStack, float partialTickTime) { + protected void scale(S equineRenderState, PoseStack poseStack) { poseStack.scale(this.scale, this.scale, this.scale); - super.scale(livingEntity, poseStack, partialTickTime); + super.scale(equineRenderState, poseStack); + } + + public void extractRenderState(T abstractHorse, S equineRenderState, float f) { + super.extractRenderState(abstractHorse, equineRenderState, f); + equineRenderState.isSaddled = abstractHorse.isSaddled(); + equineRenderState.isRidden = abstractHorse.isVehicle(); + equineRenderState.eatAnimation = abstractHorse.getEatAnim(f); + equineRenderState.standAnimation = abstractHorse.getStandAnim(f); + equineRenderState.feedingAnimation = abstractHorse.getMouthAnim(f); + equineRenderState.animateTail = abstractHorse.tailCounter > 0; } } diff --git a/net/minecraft/client/renderer/entity/AbstractMinecartRenderer.java b/net/minecraft/client/renderer/entity/AbstractMinecartRenderer.java new file mode 100644 index 00000000..4eb9e161 --- /dev/null +++ b/net/minecraft/client/renderer/entity/AbstractMinecartRenderer.java @@ -0,0 +1,179 @@ +package net.minecraft.client.renderer.entity; + +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; +import com.mojang.math.Axis; +import java.util.Objects; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.client.model.MinecartModel; +import net.minecraft.client.model.geom.ModelLayerLocation; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.block.BlockRenderDispatcher; +import net.minecraft.client.renderer.entity.state.MinecartRenderState; +import net.minecraft.client.renderer.texture.OverlayTexture; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.Mth; +import net.minecraft.world.entity.vehicle.AbstractMinecart; +import net.minecraft.world.entity.vehicle.NewMinecartBehavior; +import net.minecraft.world.entity.vehicle.OldMinecartBehavior; +import net.minecraft.world.level.block.RenderShape; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.AABB; +import net.minecraft.world.phys.Vec3; + +@Environment(EnvType.CLIENT) +public abstract class AbstractMinecartRenderer extends EntityRenderer { + private static final ResourceLocation MINECART_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/minecart.png"); + protected final MinecartModel model; + private final BlockRenderDispatcher blockRenderer; + + public AbstractMinecartRenderer(EntityRendererProvider.Context context, ModelLayerLocation modelLayerLocation) { + super(context); + this.shadowRadius = 0.7F; + this.model = new MinecartModel(context.bakeLayer(modelLayerLocation)); + this.blockRenderer = context.getBlockRenderDispatcher(); + } + + public void render(S minecartRenderState, PoseStack poseStack, MultiBufferSource multiBufferSource, int i) { + super.render(minecartRenderState, poseStack, multiBufferSource, i); + poseStack.pushPose(); + long l = minecartRenderState.offsetSeed; + float f = (((float)(l >> 16 & 7L) + 0.5F) / 8.0F - 0.5F) * 0.004F; + float g = (((float)(l >> 20 & 7L) + 0.5F) / 8.0F - 0.5F) * 0.004F; + float h = (((float)(l >> 24 & 7L) + 0.5F) / 8.0F - 0.5F) * 0.004F; + poseStack.translate(f, g, h); + if (minecartRenderState.isNewRender) { + newRender(minecartRenderState, poseStack); + } else { + oldRender(minecartRenderState, poseStack); + } + + float j = minecartRenderState.hurtTime; + if (j > 0.0F) { + poseStack.mulPose(Axis.XP.rotationDegrees(Mth.sin(j) * j * minecartRenderState.damageTime / 10.0F * minecartRenderState.hurtDir)); + } + + BlockState blockState = minecartRenderState.displayBlockState; + if (blockState.getRenderShape() != RenderShape.INVISIBLE) { + poseStack.pushPose(); + float k = 0.75F; + poseStack.scale(0.75F, 0.75F, 0.75F); + poseStack.translate(-0.5F, (minecartRenderState.displayOffset - 8) / 16.0F, 0.5F); + poseStack.mulPose(Axis.YP.rotationDegrees(90.0F)); + this.renderMinecartContents(minecartRenderState, blockState, poseStack, multiBufferSource, i); + poseStack.popPose(); + } + + poseStack.scale(-1.0F, -1.0F, 1.0F); + this.model.setupAnim(minecartRenderState); + VertexConsumer vertexConsumer = multiBufferSource.getBuffer(this.model.renderType(MINECART_LOCATION)); + this.model.renderToBuffer(poseStack, vertexConsumer, i, OverlayTexture.NO_OVERLAY); + poseStack.popPose(); + } + + private static void newRender(S minecartRenderState, PoseStack poseStack) { + poseStack.mulPose(Axis.YP.rotationDegrees(minecartRenderState.yRot)); + poseStack.mulPose(Axis.ZP.rotationDegrees(-minecartRenderState.xRot)); + poseStack.translate(0.0F, 0.375F, 0.0F); + } + + private static void oldRender(S minecartRenderState, PoseStack poseStack) { + double d = minecartRenderState.x; + double e = minecartRenderState.y; + double f = minecartRenderState.z; + float g = minecartRenderState.xRot; + float h = minecartRenderState.yRot; + if (minecartRenderState.posOnRail != null && minecartRenderState.frontPos != null && minecartRenderState.backPos != null) { + Vec3 vec3 = minecartRenderState.frontPos; + Vec3 vec32 = minecartRenderState.backPos; + poseStack.translate(minecartRenderState.posOnRail.x - d, (vec3.y + vec32.y) / 2.0 - e, minecartRenderState.posOnRail.z - f); + Vec3 vec33 = vec32.add(-vec3.x, -vec3.y, -vec3.z); + if (vec33.length() != 0.0) { + vec33 = vec33.normalize(); + h = (float)(Math.atan2(vec33.z, vec33.x) * 180.0 / Math.PI); + g = (float)(Math.atan(vec33.y) * 73.0); + } + } + + poseStack.translate(0.0F, 0.375F, 0.0F); + poseStack.mulPose(Axis.YP.rotationDegrees(180.0F - h)); + poseStack.mulPose(Axis.ZP.rotationDegrees(-g)); + } + + public void extractRenderState(T abstractMinecart, S minecartRenderState, float f) { + super.extractRenderState(abstractMinecart, minecartRenderState, f); + if (abstractMinecart.getBehavior() instanceof NewMinecartBehavior newMinecartBehavior) { + newExtractState(abstractMinecart, newMinecartBehavior, minecartRenderState, f); + minecartRenderState.isNewRender = true; + } else if (abstractMinecart.getBehavior() instanceof OldMinecartBehavior oldMinecartBehavior) { + oldExtractState(abstractMinecart, oldMinecartBehavior, minecartRenderState, f); + minecartRenderState.isNewRender = false; + } + + long l = abstractMinecart.getId() * 493286711L; + minecartRenderState.offsetSeed = l * l * 4392167121L + l * 98761L; + minecartRenderState.hurtTime = abstractMinecart.getHurtTime() - f; + minecartRenderState.hurtDir = abstractMinecart.getHurtDir(); + minecartRenderState.damageTime = Math.max(abstractMinecart.getDamage() - f, 0.0F); + minecartRenderState.displayOffset = abstractMinecart.getDisplayOffset(); + minecartRenderState.displayBlockState = abstractMinecart.getDisplayBlockState(); + } + + private static void newExtractState( + T abstractMinecart, NewMinecartBehavior newMinecartBehavior, S minecartRenderState, float f + ) { + if (newMinecartBehavior.cartHasPosRotLerp()) { + minecartRenderState.renderPos = newMinecartBehavior.getCartLerpPosition(f); + minecartRenderState.xRot = newMinecartBehavior.getCartLerpXRot(f); + minecartRenderState.yRot = newMinecartBehavior.getCartLerpYRot(f); + } else { + minecartRenderState.renderPos = null; + minecartRenderState.xRot = abstractMinecart.getXRot(); + minecartRenderState.yRot = abstractMinecart.getYRot(); + } + } + + private static void oldExtractState( + T abstractMinecart, OldMinecartBehavior oldMinecartBehavior, S minecartRenderState, float f + ) { + float g = 0.3F; + minecartRenderState.xRot = abstractMinecart.getXRot(f); + minecartRenderState.yRot = abstractMinecart.getYRot(f); + double d = minecartRenderState.x; + double e = minecartRenderState.y; + double h = minecartRenderState.z; + Vec3 vec3 = oldMinecartBehavior.getPos(d, e, h); + if (vec3 != null) { + minecartRenderState.posOnRail = vec3; + Vec3 vec32 = oldMinecartBehavior.getPosOffs(d, e, h, 0.3F); + Vec3 vec33 = oldMinecartBehavior.getPosOffs(d, e, h, -0.3F); + minecartRenderState.frontPos = (Vec3)Objects.requireNonNullElse(vec32, vec3); + minecartRenderState.backPos = (Vec3)Objects.requireNonNullElse(vec33, vec3); + } else { + minecartRenderState.posOnRail = null; + minecartRenderState.frontPos = null; + minecartRenderState.backPos = null; + } + } + + protected void renderMinecartContents(S minecartRenderState, BlockState blockState, PoseStack poseStack, MultiBufferSource multiBufferSource, int i) { + this.blockRenderer.renderSingleBlock(blockState, poseStack, multiBufferSource, i, OverlayTexture.NO_OVERLAY); + } + + protected AABB getBoundingBoxForCulling(T abstractMinecart) { + AABB aABB = super.getBoundingBoxForCulling(abstractMinecart); + return abstractMinecart.hasCustomDisplay() ? aABB.inflate(Math.abs(abstractMinecart.getDisplayOffset()) / 16.0) : aABB; + } + + public Vec3 getRenderOffset(S minecartRenderState) { + Vec3 vec3 = super.getRenderOffset(minecartRenderState); + return minecartRenderState.isNewRender && minecartRenderState.renderPos != null + ? vec3.add( + minecartRenderState.renderPos.x - minecartRenderState.x, + minecartRenderState.renderPos.y - minecartRenderState.y, + minecartRenderState.renderPos.z - minecartRenderState.z + ) + : vec3; + } +} diff --git a/net/minecraft/client/renderer/entity/AbstractSkeletonRenderer.java b/net/minecraft/client/renderer/entity/AbstractSkeletonRenderer.java new file mode 100644 index 00000000..b0300c1e --- /dev/null +++ b/net/minecraft/client/renderer/entity/AbstractSkeletonRenderer.java @@ -0,0 +1,39 @@ +package net.minecraft.client.renderer.entity; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.client.model.SkeletonModel; +import net.minecraft.client.model.geom.ModelLayerLocation; +import net.minecraft.client.renderer.entity.layers.HumanoidArmorLayer; +import net.minecraft.client.renderer.entity.state.SkeletonRenderState; +import net.minecraft.world.entity.monster.AbstractSkeleton; + +@Environment(EnvType.CLIENT) +public abstract class AbstractSkeletonRenderer extends HumanoidMobRenderer> { + public AbstractSkeletonRenderer( + EntityRendererProvider.Context context, ModelLayerLocation modelLayerLocation, ModelLayerLocation modelLayerLocation2, ModelLayerLocation modelLayerLocation3 + ) { + this(context, modelLayerLocation2, modelLayerLocation3, new SkeletonModel<>(context.bakeLayer(modelLayerLocation))); + } + + public AbstractSkeletonRenderer( + EntityRendererProvider.Context context, ModelLayerLocation modelLayerLocation, ModelLayerLocation modelLayerLocation2, SkeletonModel skeletonModel + ) { + super(context, skeletonModel, 0.5F); + this.addLayer( + new HumanoidArmorLayer<>( + this, new SkeletonModel(context.bakeLayer(modelLayerLocation)), new SkeletonModel(context.bakeLayer(modelLayerLocation2)), context.getEquipmentRenderer() + ) + ); + } + + public void extractRenderState(T abstractSkeleton, S skeletonRenderState, float f) { + super.extractRenderState(abstractSkeleton, skeletonRenderState, f); + skeletonRenderState.isAggressive = abstractSkeleton.isAggressive(); + skeletonRenderState.isShaking = abstractSkeleton.isShaking(); + } + + protected boolean isShaking(S skeletonRenderState) { + return skeletonRenderState.isShaking; + } +} diff --git a/net/minecraft/client/renderer/entity/AbstractZombieRenderer.java b/net/minecraft/client/renderer/entity/AbstractZombieRenderer.java index c6ada584..913c2117 100644 --- a/net/minecraft/client/renderer/entity/AbstractZombieRenderer.java +++ b/net/minecraft/client/renderer/entity/AbstractZombieRenderer.java @@ -4,26 +4,32 @@ import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.model.ZombieModel; import net.minecraft.client.renderer.entity.layers.HumanoidArmorLayer; +import net.minecraft.client.renderer.entity.state.ZombieRenderState; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.monster.Zombie; @Environment(EnvType.CLIENT) -public abstract class AbstractZombieRenderer> extends HumanoidMobRenderer { +public abstract class AbstractZombieRenderer> extends HumanoidMobRenderer { private static final ResourceLocation ZOMBIE_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/zombie/zombie.png"); - protected AbstractZombieRenderer(EntityRendererProvider.Context context, M model, M innerModel, M outerModel) { - super(context, model, 0.5F); - this.addLayer(new HumanoidArmorLayer<>(this, innerModel, outerModel, context.getModelManager())); + protected AbstractZombieRenderer( + EntityRendererProvider.Context context, M zombieModel, M zombieModel2, M zombieModel3, M zombieModel4, M zombieModel5, M zombieModel6 + ) { + super(context, zombieModel, zombieModel2, 0.5F); + this.addLayer(new HumanoidArmorLayer<>(this, zombieModel3, zombieModel4, zombieModel5, zombieModel6, context.getEquipmentRenderer())); } - /** - * Returns the location of an entity's texture. - */ - public ResourceLocation getTextureLocation(Zombie entity) { + public ResourceLocation getTextureLocation(S zombieRenderState) { return ZOMBIE_LOCATION; } - protected boolean isShaking(T entity) { - return super.isShaking(entity) || entity.isUnderWaterConverting(); + public void extractRenderState(T zombie, S zombieRenderState, float f) { + super.extractRenderState(zombie, zombieRenderState, f); + zombieRenderState.isAggressive = zombie.isAggressive(); + zombieRenderState.isConverting = zombie.isUnderWaterConverting(); + } + + protected boolean isShaking(S zombieRenderState) { + return super.isShaking(zombieRenderState) || zombieRenderState.isConverting; } } diff --git a/net/minecraft/client/renderer/entity/AgeableMobRenderer.java b/net/minecraft/client/renderer/entity/AgeableMobRenderer.java new file mode 100644 index 00000000..a348612a --- /dev/null +++ b/net/minecraft/client/renderer/entity/AgeableMobRenderer.java @@ -0,0 +1,28 @@ +package net.minecraft.client.renderer.entity; + +import com.mojang.blaze3d.vertex.PoseStack; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.client.model.EntityModel; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.entity.state.LivingEntityRenderState; +import net.minecraft.world.entity.Mob; + +@Deprecated +@Environment(EnvType.CLIENT) +public abstract class AgeableMobRenderer> extends MobRenderer { + private final M adultModel; + private final M babyModel; + + public AgeableMobRenderer(EntityRendererProvider.Context context, M entityModel, M entityModel2, float f) { + super(context, entityModel, f); + this.adultModel = entityModel; + this.babyModel = entityModel2; + } + + @Override + public void render(S livingEntityRenderState, PoseStack poseStack, MultiBufferSource multiBufferSource, int i) { + this.model = livingEntityRenderState.isBaby ? this.babyModel : this.adultModel; + super.render(livingEntityRenderState, poseStack, multiBufferSource, i); + } +} diff --git a/net/minecraft/client/renderer/entity/AllayRenderer.java b/net/minecraft/client/renderer/entity/AllayRenderer.java index 0ca9c11c..351d7e9f 100644 --- a/net/minecraft/client/renderer/entity/AllayRenderer.java +++ b/net/minecraft/client/renderer/entity/AllayRenderer.java @@ -5,23 +5,36 @@ import net.fabricmc.api.Environment; import net.minecraft.client.model.AllayModel; import net.minecraft.client.model.geom.ModelLayers; import net.minecraft.client.renderer.entity.layers.ItemInHandLayer; +import net.minecraft.client.renderer.entity.state.AllayRenderState; import net.minecraft.core.BlockPos; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.animal.allay.Allay; @Environment(EnvType.CLIENT) -public class AllayRenderer extends MobRenderer { +public class AllayRenderer extends MobRenderer { private static final ResourceLocation ALLAY_TEXTURE = ResourceLocation.withDefaultNamespace("textures/entity/allay/allay.png"); public AllayRenderer(EntityRendererProvider.Context context) { super(context, new AllayModel(context.bakeLayer(ModelLayers.ALLAY)), 0.4F); - this.addLayer(new ItemInHandLayer<>(this, context.getItemInHandRenderer())); + this.addLayer(new ItemInHandLayer<>(this, context.getItemRenderer())); } - public ResourceLocation getTextureLocation(Allay allay) { + public ResourceLocation getTextureLocation(AllayRenderState allayRenderState) { return ALLAY_TEXTURE; } + public AllayRenderState createRenderState() { + return new AllayRenderState(); + } + + public void extractRenderState(Allay allay, AllayRenderState allayRenderState, float f) { + super.extractRenderState(allay, allayRenderState, f); + allayRenderState.isDancing = allay.isDancing(); + allayRenderState.isSpinning = allay.isSpinning(); + allayRenderState.spinningProgress = allay.getSpinningProgress(f); + allayRenderState.holdingAnimationProgress = allay.getHoldingItemAnimationProgress(f); + } + protected int getBlockLightLevel(Allay allay, BlockPos blockPos) { return 15; } diff --git a/net/minecraft/client/renderer/entity/ArmadilloRenderer.java b/net/minecraft/client/renderer/entity/ArmadilloRenderer.java index fd4fc0b8..241ea611 100644 --- a/net/minecraft/client/renderer/entity/ArmadilloRenderer.java +++ b/net/minecraft/client/renderer/entity/ArmadilloRenderer.java @@ -4,18 +4,31 @@ import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.model.ArmadilloModel; import net.minecraft.client.model.geom.ModelLayers; +import net.minecraft.client.renderer.entity.state.ArmadilloRenderState; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.animal.armadillo.Armadillo; @Environment(EnvType.CLIENT) -public class ArmadilloRenderer extends MobRenderer { +public class ArmadilloRenderer extends AgeableMobRenderer { private static final ResourceLocation ARMADILLO_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/armadillo.png"); public ArmadilloRenderer(EntityRendererProvider.Context context) { - super(context, new ArmadilloModel(context.bakeLayer(ModelLayers.ARMADILLO)), 0.4F); + super(context, new ArmadilloModel(context.bakeLayer(ModelLayers.ARMADILLO)), new ArmadilloModel(context.bakeLayer(ModelLayers.ARMADILLO_BABY)), 0.4F); } - public ResourceLocation getTextureLocation(Armadillo armadillo) { + public ResourceLocation getTextureLocation(ArmadilloRenderState armadilloRenderState) { return ARMADILLO_LOCATION; } + + public ArmadilloRenderState createRenderState() { + return new ArmadilloRenderState(); + } + + public void extractRenderState(Armadillo armadillo, ArmadilloRenderState armadilloRenderState, float f) { + super.extractRenderState(armadillo, armadilloRenderState, f); + armadilloRenderState.isHidingInShell = armadillo.shouldHideInShell(); + armadilloRenderState.peekAnimationState.copyFrom(armadillo.peekAnimationState); + armadilloRenderState.rollOutAnimationState.copyFrom(armadillo.rollOutAnimationState); + armadilloRenderState.rollUpAnimationState.copyFrom(armadillo.rollUpAnimationState); + } } diff --git a/net/minecraft/client/renderer/entity/ArmorStandRenderer.java b/net/minecraft/client/renderer/entity/ArmorStandRenderer.java index 42127eca..6483189a 100644 --- a/net/minecraft/client/renderer/entity/ArmorStandRenderer.java +++ b/net/minecraft/client/renderer/entity/ArmorStandRenderer.java @@ -7,69 +7,96 @@ import net.fabricmc.api.Environment; import net.minecraft.client.model.ArmorStandArmorModel; import net.minecraft.client.model.ArmorStandModel; import net.minecraft.client.model.geom.ModelLayers; +import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.entity.layers.CustomHeadLayer; -import net.minecraft.client.renderer.entity.layers.ElytraLayer; import net.minecraft.client.renderer.entity.layers.HumanoidArmorLayer; import net.minecraft.client.renderer.entity.layers.ItemInHandLayer; +import net.minecraft.client.renderer.entity.layers.WingsLayer; +import net.minecraft.client.renderer.entity.state.ArmorStandRenderState; import net.minecraft.resources.ResourceLocation; import net.minecraft.util.Mth; import net.minecraft.world.entity.decoration.ArmorStand; import org.jetbrains.annotations.Nullable; @Environment(EnvType.CLIENT) -public class ArmorStandRenderer extends LivingEntityRenderer { +public class ArmorStandRenderer extends LivingEntityRenderer { /** * A constant instance of the armor stand texture, wrapped inside a ResourceLocation wrapper. */ public static final ResourceLocation DEFAULT_SKIN_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/armorstand/wood.png"); + private final ArmorStandArmorModel bigModel = this.getModel(); + private final ArmorStandArmorModel smallModel; public ArmorStandRenderer(EntityRendererProvider.Context context) { super(context, new ArmorStandModel(context.bakeLayer(ModelLayers.ARMOR_STAND)), 0.0F); + this.smallModel = new ArmorStandModel(context.bakeLayer(ModelLayers.ARMOR_STAND_SMALL)); this.addLayer( new HumanoidArmorLayer<>( this, new ArmorStandArmorModel(context.bakeLayer(ModelLayers.ARMOR_STAND_INNER_ARMOR)), new ArmorStandArmorModel(context.bakeLayer(ModelLayers.ARMOR_STAND_OUTER_ARMOR)), - context.getModelManager() + new ArmorStandArmorModel(context.bakeLayer(ModelLayers.ARMOR_STAND_SMALL_INNER_ARMOR)), + new ArmorStandArmorModel(context.bakeLayer(ModelLayers.ARMOR_STAND_SMALL_OUTER_ARMOR)), + context.getEquipmentRenderer() ) ); - this.addLayer(new ItemInHandLayer<>(this, context.getItemInHandRenderer())); - this.addLayer(new ElytraLayer<>(this, context.getModelSet())); - this.addLayer(new CustomHeadLayer<>(this, context.getModelSet(), context.getItemInHandRenderer())); + this.addLayer(new ItemInHandLayer<>(this, context.getItemRenderer())); + this.addLayer(new WingsLayer<>(this, context.getModelSet(), context.getEquipmentRenderer())); + this.addLayer(new CustomHeadLayer<>(this, context.getModelSet(), context.getItemRenderer())); } - /** - * Returns the location of an entity's texture. - */ - public ResourceLocation getTextureLocation(ArmorStand entity) { + public ResourceLocation getTextureLocation(ArmorStandRenderState armorStandRenderState) { return DEFAULT_SKIN_LOCATION; } - protected void setupRotations(ArmorStand entity, PoseStack poseStack, float bob, float yBodyRot, float partialTick, float scale) { - poseStack.mulPose(Axis.YP.rotationDegrees(180.0F - yBodyRot)); - float f = (float)(entity.level().getGameTime() - entity.lastHit) + partialTick; - if (f < 5.0F) { - poseStack.mulPose(Axis.YP.rotationDegrees(Mth.sin(f / 1.5F * (float) Math.PI) * 3.0F)); + public ArmorStandRenderState createRenderState() { + return new ArmorStandRenderState(); + } + + public void extractRenderState(ArmorStand armorStand, ArmorStandRenderState armorStandRenderState, float f) { + super.extractRenderState(armorStand, armorStandRenderState, f); + HumanoidMobRenderer.extractHumanoidRenderState(armorStand, armorStandRenderState, f); + armorStandRenderState.yRot = Mth.rotLerp(f, armorStand.yRotO, armorStand.getYRot()); + armorStandRenderState.isMarker = armorStand.isMarker(); + armorStandRenderState.isSmall = armorStand.isSmall(); + armorStandRenderState.showArms = armorStand.showArms(); + armorStandRenderState.showBasePlate = armorStand.showBasePlate(); + armorStandRenderState.bodyPose = armorStand.getBodyPose(); + armorStandRenderState.headPose = armorStand.getHeadPose(); + armorStandRenderState.leftArmPose = armorStand.getLeftArmPose(); + armorStandRenderState.rightArmPose = armorStand.getRightArmPose(); + armorStandRenderState.leftLegPose = armorStand.getLeftLegPose(); + armorStandRenderState.rightLegPose = armorStand.getRightLegPose(); + armorStandRenderState.wiggle = (float)(armorStand.level().getGameTime() - armorStand.lastHit) + f; + } + + public void render(ArmorStandRenderState armorStandRenderState, PoseStack poseStack, MultiBufferSource multiBufferSource, int i) { + this.model = armorStandRenderState.isSmall ? this.smallModel : this.bigModel; + super.render(armorStandRenderState, poseStack, multiBufferSource, i); + } + + protected void setupRotations(ArmorStandRenderState armorStandRenderState, PoseStack poseStack, float f, float g) { + poseStack.mulPose(Axis.YP.rotationDegrees(180.0F - f)); + if (armorStandRenderState.wiggle < 5.0F) { + poseStack.mulPose(Axis.YP.rotationDegrees(Mth.sin(armorStandRenderState.wiggle / 1.5F * (float) Math.PI) * 3.0F)); } } - protected boolean shouldShowName(ArmorStand entity) { - double d = this.entityRenderDispatcher.distanceToSqr(entity); - float f = entity.isCrouching() ? 32.0F : 64.0F; - return d >= f * f ? false : entity.isCustomNameVisible(); + protected boolean shouldShowName(ArmorStand armorStand, double d) { + return armorStand.isCustomNameVisible(); } @Nullable - protected RenderType getRenderType(ArmorStand livingEntity, boolean bodyVisible, boolean translucent, boolean glowing) { - if (!livingEntity.isMarker()) { - return super.getRenderType(livingEntity, bodyVisible, translucent, glowing); + protected RenderType getRenderType(ArmorStandRenderState armorStandRenderState, boolean bl, boolean bl2, boolean bl3) { + if (!armorStandRenderState.isMarker) { + return super.getRenderType(armorStandRenderState, bl, bl2, bl3); } else { - ResourceLocation resourceLocation = this.getTextureLocation(livingEntity); - if (translucent) { + ResourceLocation resourceLocation = this.getTextureLocation(armorStandRenderState); + if (bl2) { return RenderType.entityTranslucent(resourceLocation, false); } else { - return bodyVisible ? RenderType.entityCutoutNoCull(resourceLocation, false) : null; + return bl ? RenderType.entityCutoutNoCull(resourceLocation, false) : null; } } } diff --git a/net/minecraft/client/renderer/entity/ArrowRenderer.java b/net/minecraft/client/renderer/entity/ArrowRenderer.java index 976c9358..699c426f 100644 --- a/net/minecraft/client/renderer/entity/ArrowRenderer.java +++ b/net/minecraft/client/renderer/entity/ArrowRenderer.java @@ -5,70 +5,41 @@ import com.mojang.blaze3d.vertex.VertexConsumer; import com.mojang.math.Axis; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; +import net.minecraft.client.model.ArrowModel; +import net.minecraft.client.model.geom.ModelLayers; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.entity.state.ArrowRenderState; import net.minecraft.client.renderer.texture.OverlayTexture; -import net.minecraft.util.Mth; +import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.projectile.AbstractArrow; @Environment(EnvType.CLIENT) -public abstract class ArrowRenderer extends EntityRenderer { +public abstract class ArrowRenderer extends EntityRenderer { + private final ArrowModel model; + public ArrowRenderer(EntityRendererProvider.Context context) { super(context); + this.model = new ArrowModel(context.bakeLayer(ModelLayers.ARROW)); } - public void render(T entity, float entityYaw, float partialTicks, PoseStack poseStack, MultiBufferSource buffer, int packedLight) { + public void render(S arrowRenderState, PoseStack poseStack, MultiBufferSource multiBufferSource, int i) { poseStack.pushPose(); - poseStack.mulPose(Axis.YP.rotationDegrees(Mth.lerp(partialTicks, entity.yRotO, entity.getYRot()) - 90.0F)); - poseStack.mulPose(Axis.ZP.rotationDegrees(Mth.lerp(partialTicks, entity.xRotO, entity.getXRot()))); - int i = 0; - float f = 0.0F; - float g = 0.5F; - float h = 0.0F; - float j = 0.15625F; - float k = 0.0F; - float l = 0.15625F; - float m = 0.15625F; - float n = 0.3125F; - float o = 0.05625F; - float p = entity.shakeTime - partialTicks; - if (p > 0.0F) { - float q = -Mth.sin(p * 3.0F) * p; - poseStack.mulPose(Axis.ZP.rotationDegrees(q)); - } - - poseStack.mulPose(Axis.XP.rotationDegrees(45.0F)); - poseStack.scale(0.05625F, 0.05625F, 0.05625F); - poseStack.translate(-4.0F, 0.0F, 0.0F); - VertexConsumer vertexConsumer = buffer.getBuffer(RenderType.entityCutout(this.getTextureLocation(entity))); - PoseStack.Pose pose = poseStack.last(); - this.vertex(pose, vertexConsumer, -7, -2, -2, 0.0F, 0.15625F, -1, 0, 0, packedLight); - this.vertex(pose, vertexConsumer, -7, -2, 2, 0.15625F, 0.15625F, -1, 0, 0, packedLight); - this.vertex(pose, vertexConsumer, -7, 2, 2, 0.15625F, 0.3125F, -1, 0, 0, packedLight); - this.vertex(pose, vertexConsumer, -7, 2, -2, 0.0F, 0.3125F, -1, 0, 0, packedLight); - this.vertex(pose, vertexConsumer, -7, 2, -2, 0.0F, 0.15625F, 1, 0, 0, packedLight); - this.vertex(pose, vertexConsumer, -7, 2, 2, 0.15625F, 0.15625F, 1, 0, 0, packedLight); - this.vertex(pose, vertexConsumer, -7, -2, 2, 0.15625F, 0.3125F, 1, 0, 0, packedLight); - this.vertex(pose, vertexConsumer, -7, -2, -2, 0.0F, 0.3125F, 1, 0, 0, packedLight); - - for (int r = 0; r < 4; r++) { - poseStack.mulPose(Axis.XP.rotationDegrees(90.0F)); - this.vertex(pose, vertexConsumer, -8, -2, 0, 0.0F, 0.0F, 0, 1, 0, packedLight); - this.vertex(pose, vertexConsumer, 8, -2, 0, 0.5F, 0.0F, 0, 1, 0, packedLight); - this.vertex(pose, vertexConsumer, 8, 2, 0, 0.5F, 0.15625F, 0, 1, 0, packedLight); - this.vertex(pose, vertexConsumer, -8, 2, 0, 0.0F, 0.15625F, 0, 1, 0, packedLight); - } - + poseStack.mulPose(Axis.YP.rotationDegrees(arrowRenderState.yRot - 90.0F)); + poseStack.mulPose(Axis.ZP.rotationDegrees(arrowRenderState.xRot)); + VertexConsumer vertexConsumer = multiBufferSource.getBuffer(RenderType.entityCutout(this.getTextureLocation(arrowRenderState))); + this.model.setupAnim(arrowRenderState); + this.model.renderToBuffer(poseStack, vertexConsumer, i, OverlayTexture.NO_OVERLAY); poseStack.popPose(); - super.render(entity, entityYaw, partialTicks, poseStack, buffer, packedLight); + super.render(arrowRenderState, poseStack, multiBufferSource, i); } - public void vertex(PoseStack.Pose pose, VertexConsumer consumer, int x, int y, int z, float u, float v, int normalX, int normalY, int normalZ, int packedLight) { - consumer.addVertex(pose, (float)x, (float)y, (float)z) - .setColor(-1) - .setUv(u, v) - .setOverlay(OverlayTexture.NO_OVERLAY) - .setLight(packedLight) - .setNormal(pose, normalX, normalZ, normalY); + protected abstract ResourceLocation getTextureLocation(S arrowRenderState); + + public void extractRenderState(T abstractArrow, S arrowRenderState, float f) { + super.extractRenderState(abstractArrow, arrowRenderState, f); + arrowRenderState.xRot = abstractArrow.getXRot(f); + arrowRenderState.yRot = abstractArrow.getYRot(f); + arrowRenderState.shake = abstractArrow.shakeTime - f; } } diff --git a/net/minecraft/client/renderer/entity/AxolotlRenderer.java b/net/minecraft/client/renderer/entity/AxolotlRenderer.java index a9d8b835..c9fc823d 100644 --- a/net/minecraft/client/renderer/entity/AxolotlRenderer.java +++ b/net/minecraft/client/renderer/entity/AxolotlRenderer.java @@ -8,11 +8,12 @@ import net.fabricmc.api.Environment; import net.minecraft.Util; import net.minecraft.client.model.AxolotlModel; import net.minecraft.client.model.geom.ModelLayers; +import net.minecraft.client.renderer.entity.state.AxolotlRenderState; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.animal.axolotl.Axolotl; @Environment(EnvType.CLIENT) -public class AxolotlRenderer extends MobRenderer> { +public class AxolotlRenderer extends AgeableMobRenderer { private static final Map TEXTURE_BY_TYPE = Util.make(Maps.newHashMap(), hashMap -> { for (Axolotl.Variant variant : Axolotl.Variant.values()) { hashMap.put(variant, ResourceLocation.withDefaultNamespace(String.format(Locale.ROOT, "textures/entity/axolotl/axolotl_%s.png", variant.getName()))); @@ -20,10 +21,23 @@ public class AxolotlRenderer extends MobRenderer> }); public AxolotlRenderer(EntityRendererProvider.Context context) { - super(context, new AxolotlModel<>(context.bakeLayer(ModelLayers.AXOLOTL)), 0.5F); + super(context, new AxolotlModel(context.bakeLayer(ModelLayers.AXOLOTL)), new AxolotlModel(context.bakeLayer(ModelLayers.AXOLOTL_BABY)), 0.5F); } - public ResourceLocation getTextureLocation(Axolotl axolotl) { - return (ResourceLocation)TEXTURE_BY_TYPE.get(axolotl.getVariant()); + public ResourceLocation getTextureLocation(AxolotlRenderState axolotlRenderState) { + return (ResourceLocation)TEXTURE_BY_TYPE.get(axolotlRenderState.variant); + } + + public AxolotlRenderState createRenderState() { + return new AxolotlRenderState(); + } + + public void extractRenderState(Axolotl axolotl, AxolotlRenderState axolotlRenderState, float f) { + super.extractRenderState(axolotl, axolotlRenderState, f); + axolotlRenderState.variant = axolotl.getVariant(); + axolotlRenderState.playingDeadFactor = axolotl.playingDeadAnimator.getFactor(f); + axolotlRenderState.inWaterFactor = axolotl.inWaterAnimator.getFactor(f); + axolotlRenderState.onGroundFactor = axolotl.onGroundAnimator.getFactor(f); + axolotlRenderState.movingFactor = axolotl.movingAnimator.getFactor(f); } } diff --git a/net/minecraft/client/renderer/entity/BatRenderer.java b/net/minecraft/client/renderer/entity/BatRenderer.java index e9b3c0e6..6c1a2de5 100644 --- a/net/minecraft/client/renderer/entity/BatRenderer.java +++ b/net/minecraft/client/renderer/entity/BatRenderer.java @@ -4,21 +4,30 @@ import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.model.BatModel; import net.minecraft.client.model.geom.ModelLayers; +import net.minecraft.client.renderer.entity.state.BatRenderState; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.ambient.Bat; @Environment(EnvType.CLIENT) -public class BatRenderer extends MobRenderer { +public class BatRenderer extends MobRenderer { private static final ResourceLocation BAT_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/bat.png"); public BatRenderer(EntityRendererProvider.Context context) { super(context, new BatModel(context.bakeLayer(ModelLayers.BAT)), 0.25F); } - /** - * Returns the location of an entity's texture. - */ - public ResourceLocation getTextureLocation(Bat entity) { + public ResourceLocation getTextureLocation(BatRenderState batRenderState) { return BAT_LOCATION; } + + public BatRenderState createRenderState() { + return new BatRenderState(); + } + + public void extractRenderState(Bat bat, BatRenderState batRenderState, float f) { + super.extractRenderState(bat, batRenderState, f); + batRenderState.isResting = bat.isResting(); + batRenderState.flyAnimationState.copyFrom(bat.flyAnimationState); + batRenderState.restAnimationState.copyFrom(bat.restAnimationState); + } } diff --git a/net/minecraft/client/renderer/entity/BeeRenderer.java b/net/minecraft/client/renderer/entity/BeeRenderer.java index a23b9461..f40ac282 100644 --- a/net/minecraft/client/renderer/entity/BeeRenderer.java +++ b/net/minecraft/client/renderer/entity/BeeRenderer.java @@ -4,28 +4,39 @@ import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.model.BeeModel; import net.minecraft.client.model.geom.ModelLayers; +import net.minecraft.client.renderer.entity.state.BeeRenderState; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.animal.Bee; @Environment(EnvType.CLIENT) -public class BeeRenderer extends MobRenderer> { +public class BeeRenderer extends AgeableMobRenderer { private static final ResourceLocation ANGRY_BEE_TEXTURE = ResourceLocation.withDefaultNamespace("textures/entity/bee/bee_angry.png"); private static final ResourceLocation ANGRY_NECTAR_BEE_TEXTURE = ResourceLocation.withDefaultNamespace("textures/entity/bee/bee_angry_nectar.png"); private static final ResourceLocation BEE_TEXTURE = ResourceLocation.withDefaultNamespace("textures/entity/bee/bee.png"); private static final ResourceLocation NECTAR_BEE_TEXTURE = ResourceLocation.withDefaultNamespace("textures/entity/bee/bee_nectar.png"); public BeeRenderer(EntityRendererProvider.Context context) { - super(context, new BeeModel<>(context.bakeLayer(ModelLayers.BEE)), 0.4F); + super(context, new BeeModel(context.bakeLayer(ModelLayers.BEE)), new BeeModel(context.bakeLayer(ModelLayers.BEE_BABY)), 0.4F); } - /** - * Returns the location of an entity's texture. - */ - public ResourceLocation getTextureLocation(Bee entity) { - if (entity.isAngry()) { - return entity.hasNectar() ? ANGRY_NECTAR_BEE_TEXTURE : ANGRY_BEE_TEXTURE; + public ResourceLocation getTextureLocation(BeeRenderState beeRenderState) { + if (beeRenderState.isAngry) { + return beeRenderState.hasNectar ? ANGRY_NECTAR_BEE_TEXTURE : ANGRY_BEE_TEXTURE; } else { - return entity.hasNectar() ? NECTAR_BEE_TEXTURE : BEE_TEXTURE; + return beeRenderState.hasNectar ? NECTAR_BEE_TEXTURE : BEE_TEXTURE; } } + + public BeeRenderState createRenderState() { + return new BeeRenderState(); + } + + public void extractRenderState(Bee bee, BeeRenderState beeRenderState, float f) { + super.extractRenderState(bee, beeRenderState, f); + beeRenderState.rollAmount = bee.getRollAmount(f); + beeRenderState.hasStinger = !bee.hasStung(); + beeRenderState.isOnGround = bee.onGround() && bee.getDeltaMovement().lengthSqr() < 1.0E-7; + beeRenderState.isAngry = bee.isAngry(); + beeRenderState.hasNectar = bee.hasNectar(); + } } diff --git a/net/minecraft/client/renderer/entity/BlazeRenderer.java b/net/minecraft/client/renderer/entity/BlazeRenderer.java index cab3cda3..0c007317 100644 --- a/net/minecraft/client/renderer/entity/BlazeRenderer.java +++ b/net/minecraft/client/renderer/entity/BlazeRenderer.java @@ -4,26 +4,29 @@ import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.model.BlazeModel; import net.minecraft.client.model.geom.ModelLayers; +import net.minecraft.client.renderer.entity.state.LivingEntityRenderState; import net.minecraft.core.BlockPos; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.monster.Blaze; @Environment(EnvType.CLIENT) -public class BlazeRenderer extends MobRenderer> { +public class BlazeRenderer extends MobRenderer { private static final ResourceLocation BLAZE_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/blaze.png"); public BlazeRenderer(EntityRendererProvider.Context context) { - super(context, new BlazeModel<>(context.bakeLayer(ModelLayers.BLAZE)), 0.5F); + super(context, new BlazeModel(context.bakeLayer(ModelLayers.BLAZE)), 0.5F); } protected int getBlockLightLevel(Blaze entity, BlockPos pos) { return 15; } - /** - * Returns the location of an entity's texture. - */ - public ResourceLocation getTextureLocation(Blaze entity) { + @Override + public ResourceLocation getTextureLocation(LivingEntityRenderState livingEntityRenderState) { return BLAZE_LOCATION; } + + public LivingEntityRenderState createRenderState() { + return new LivingEntityRenderState(); + } } diff --git a/net/minecraft/client/renderer/entity/BoatRenderer.java b/net/minecraft/client/renderer/entity/BoatRenderer.java index faf5b421..4b5eb30d 100644 --- a/net/minecraft/client/renderer/entity/BoatRenderer.java +++ b/net/minecraft/client/renderer/entity/BoatRenderer.java @@ -1,100 +1,47 @@ package net.minecraft.client.renderer.entity; -import com.google.common.collect.ImmutableMap; import com.mojang.blaze3d.vertex.PoseStack; -import com.mojang.blaze3d.vertex.VertexConsumer; -import com.mojang.datafixers.util.Pair; -import com.mojang.math.Axis; -import java.util.Map; -import java.util.stream.Stream; +import java.util.function.UnaryOperator; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.model.BoatModel; -import net.minecraft.client.model.ChestBoatModel; -import net.minecraft.client.model.ChestRaftModel; -import net.minecraft.client.model.ListModel; -import net.minecraft.client.model.RaftModel; -import net.minecraft.client.model.WaterPatchModel; +import net.minecraft.client.model.EntityModel; +import net.minecraft.client.model.Model; import net.minecraft.client.model.geom.ModelLayerLocation; import net.minecraft.client.model.geom.ModelLayers; -import net.minecraft.client.model.geom.ModelPart; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.entity.state.BoatRenderState; import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.resources.ResourceLocation; -import net.minecraft.util.Mth; -import net.minecraft.world.entity.vehicle.Boat; -import org.joml.Quaternionf; @Environment(EnvType.CLIENT) -public class BoatRenderer extends EntityRenderer { - private final Map>> boatResources; +public class BoatRenderer extends AbstractBoatRenderer { + private final Model waterPatchModel; + private final ResourceLocation texture; + private final EntityModel model; - public BoatRenderer(EntityRendererProvider.Context context, boolean chestBoat) { + public BoatRenderer(EntityRendererProvider.Context context, ModelLayerLocation modelLayerLocation) { super(context); - this.shadowRadius = 0.8F; - this.boatResources = (Map>>)Stream.of(Boat.Type.values()) - .collect(ImmutableMap.toImmutableMap(type -> type, type -> Pair.of(getTextureLocation(type, chestBoat), this.createBoatModel(context, type, chestBoat)))); + this.texture = modelLayerLocation.model().withPath((UnaryOperator)(string -> "textures/entity/" + string + ".png")); + this.waterPatchModel = new Model.Simple(context.bakeLayer(ModelLayers.BOAT_WATER_PATCH), resourceLocation -> RenderType.waterMask()); + this.model = new BoatModel(context.bakeLayer(modelLayerLocation)); } - private ListModel createBoatModel(EntityRendererProvider.Context context, Boat.Type type, boolean chestBoat) { - ModelLayerLocation modelLayerLocation = chestBoat ? ModelLayers.createChestBoatModelName(type) : ModelLayers.createBoatModelName(type); - ModelPart modelPart = context.bakeLayer(modelLayerLocation); - if (type == Boat.Type.BAMBOO) { - return (ListModel)(chestBoat ? new ChestRaftModel(modelPart) : new RaftModel(modelPart)); - } else { - return (ListModel)(chestBoat ? new ChestBoatModel(modelPart) : new BoatModel(modelPart)); - } + @Override + protected EntityModel model() { + return this.model; } - private static ResourceLocation getTextureLocation(Boat.Type type, boolean chestBoat) { - return chestBoat - ? ResourceLocation.withDefaultNamespace("textures/entity/chest_boat/" + type.getName() + ".png") - : ResourceLocation.withDefaultNamespace("textures/entity/boat/" + type.getName() + ".png"); + @Override + protected RenderType renderType() { + return this.model.renderType(this.texture); } - public void render(Boat entity, float entityYaw, float partialTicks, PoseStack poseStack, MultiBufferSource buffer, int packedLight) { - poseStack.pushPose(); - poseStack.translate(0.0F, 0.375F, 0.0F); - poseStack.mulPose(Axis.YP.rotationDegrees(180.0F - entityYaw)); - float f = entity.getHurtTime() - partialTicks; - float g = entity.getDamage() - partialTicks; - if (g < 0.0F) { - g = 0.0F; + @Override + protected void renderTypeAdditions(BoatRenderState boatRenderState, PoseStack poseStack, MultiBufferSource multiBufferSource, int i) { + if (!boatRenderState.isUnderWater) { + this.waterPatchModel.renderToBuffer(poseStack, multiBufferSource.getBuffer(this.waterPatchModel.renderType(this.texture)), i, OverlayTexture.NO_OVERLAY); } - - if (f > 0.0F) { - poseStack.mulPose(Axis.XP.rotationDegrees(Mth.sin(f) * f * g / 10.0F * entity.getHurtDir())); - } - - float h = entity.getBubbleAngle(partialTicks); - if (!Mth.equal(h, 0.0F)) { - poseStack.mulPose(new Quaternionf().setAngleAxis(entity.getBubbleAngle(partialTicks) * (float) (Math.PI / 180.0), 1.0F, 0.0F, 1.0F)); - } - - Pair> pair = (Pair>)this.boatResources.get(entity.getVariant()); - ResourceLocation resourceLocation = pair.getFirst(); - ListModel listModel = pair.getSecond(); - poseStack.scale(-1.0F, -1.0F, 1.0F); - poseStack.mulPose(Axis.YP.rotationDegrees(90.0F)); - listModel.setupAnim(entity, partialTicks, 0.0F, -0.1F, 0.0F, 0.0F); - VertexConsumer vertexConsumer = buffer.getBuffer(listModel.renderType(resourceLocation)); - listModel.renderToBuffer(poseStack, vertexConsumer, packedLight, OverlayTexture.NO_OVERLAY); - if (!entity.isUnderWater()) { - VertexConsumer vertexConsumer2 = buffer.getBuffer(RenderType.waterMask()); - if (listModel instanceof WaterPatchModel waterPatchModel) { - waterPatchModel.waterPatch().render(poseStack, vertexConsumer2, packedLight, OverlayTexture.NO_OVERLAY); - } - } - - poseStack.popPose(); - super.render(entity, entityYaw, partialTicks, poseStack, buffer, packedLight); - } - - /** - * Returns the location of an entity's texture. - */ - public ResourceLocation getTextureLocation(Boat entity) { - return (ResourceLocation)((Pair)this.boatResources.get(entity.getVariant())).getFirst(); } } diff --git a/net/minecraft/client/renderer/entity/BoggedRenderer.java b/net/minecraft/client/renderer/entity/BoggedRenderer.java index 53d33357..e544b9e3 100644 --- a/net/minecraft/client/renderer/entity/BoggedRenderer.java +++ b/net/minecraft/client/renderer/entity/BoggedRenderer.java @@ -5,11 +5,12 @@ import net.fabricmc.api.Environment; import net.minecraft.client.model.BoggedModel; import net.minecraft.client.model.geom.ModelLayers; import net.minecraft.client.renderer.entity.layers.SkeletonClothingLayer; +import net.minecraft.client.renderer.entity.state.BoggedRenderState; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.monster.Bogged; @Environment(EnvType.CLIENT) -public class BoggedRenderer extends SkeletonRenderer { +public class BoggedRenderer extends AbstractSkeletonRenderer { private static final ResourceLocation BOGGED_SKELETON_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/skeleton/bogged.png"); private static final ResourceLocation BOGGED_OUTER_LAYER_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/skeleton/bogged_overlay.png"); @@ -18,7 +19,16 @@ public class BoggedRenderer extends SkeletonRenderer { this.addLayer(new SkeletonClothingLayer<>(this, context.getModelSet(), ModelLayers.BOGGED_OUTER_LAYER, BOGGED_OUTER_LAYER_LOCATION)); } - public ResourceLocation getTextureLocation(Bogged bogged) { + public ResourceLocation getTextureLocation(BoggedRenderState boggedRenderState) { return BOGGED_SKELETON_LOCATION; } + + public BoggedRenderState createRenderState() { + return new BoggedRenderState(); + } + + public void extractRenderState(Bogged bogged, BoggedRenderState boggedRenderState, float f) { + super.extractRenderState(bogged, boggedRenderState, f); + boggedRenderState.isSheared = bogged.isSheared(); + } } diff --git a/net/minecraft/client/renderer/entity/BreezeRenderer.java b/net/minecraft/client/renderer/entity/BreezeRenderer.java index e2df7dd6..a09ac26f 100644 --- a/net/minecraft/client/renderer/entity/BreezeRenderer.java +++ b/net/minecraft/client/renderer/entity/BreezeRenderer.java @@ -9,33 +9,45 @@ import net.minecraft.client.model.geom.ModelPart; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.entity.layers.BreezeEyesLayer; import net.minecraft.client.renderer.entity.layers.BreezeWindLayer; +import net.minecraft.client.renderer.entity.state.BreezeRenderState; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.monster.breeze.Breeze; @Environment(EnvType.CLIENT) -public class BreezeRenderer extends MobRenderer> { +public class BreezeRenderer extends MobRenderer { private static final ResourceLocation TEXTURE_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/breeze/breeze.png"); public BreezeRenderer(EntityRendererProvider.Context context) { - super(context, new BreezeModel<>(context.bakeLayer(ModelLayers.BREEZE)), 0.5F); + super(context, new BreezeModel(context.bakeLayer(ModelLayers.BREEZE)), 0.5F); this.addLayer(new BreezeWindLayer(context, this)); this.addLayer(new BreezeEyesLayer(this)); } - public void render(Breeze entity, float entityYaw, float partialTicks, PoseStack poseStack, MultiBufferSource buffer, int packedLight) { - BreezeModel breezeModel = this.getModel(); + public void render(BreezeRenderState breezeRenderState, PoseStack poseStack, MultiBufferSource multiBufferSource, int i) { + BreezeModel breezeModel = this.getModel(); enable(breezeModel, breezeModel.head(), breezeModel.rods()); - super.render(entity, entityYaw, partialTicks, poseStack, buffer, packedLight); + super.render(breezeRenderState, poseStack, multiBufferSource, i); } - /** - * Returns the location of an entity's texture. - */ - public ResourceLocation getTextureLocation(Breeze entity) { + public ResourceLocation getTextureLocation(BreezeRenderState breezeRenderState) { return TEXTURE_LOCATION; } - public static BreezeModel enable(BreezeModel model, ModelPart... parts) { + public BreezeRenderState createRenderState() { + return new BreezeRenderState(); + } + + public void extractRenderState(Breeze breeze, BreezeRenderState breezeRenderState, float f) { + super.extractRenderState(breeze, breezeRenderState, f); + breezeRenderState.idle.copyFrom(breeze.idle); + breezeRenderState.shoot.copyFrom(breeze.shoot); + breezeRenderState.slide.copyFrom(breeze.slide); + breezeRenderState.slideBack.copyFrom(breeze.slideBack); + breezeRenderState.inhale.copyFrom(breeze.inhale); + breezeRenderState.longJump.copyFrom(breeze.longJump); + } + + public static BreezeModel enable(BreezeModel model, ModelPart... parts) { model.head().visible = false; model.eyes().visible = false; model.rods().visible = false; diff --git a/net/minecraft/client/renderer/entity/CamelRenderer.java b/net/minecraft/client/renderer/entity/CamelRenderer.java index dfe1056b..feeb7138 100644 --- a/net/minecraft/client/renderer/entity/CamelRenderer.java +++ b/net/minecraft/client/renderer/entity/CamelRenderer.java @@ -3,22 +3,36 @@ package net.minecraft.client.renderer.entity; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.model.CamelModel; -import net.minecraft.client.model.geom.ModelLayerLocation; +import net.minecraft.client.model.geom.ModelLayers; +import net.minecraft.client.renderer.entity.state.CamelRenderState; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.animal.camel.Camel; @Environment(EnvType.CLIENT) -public class CamelRenderer extends MobRenderer> { +public class CamelRenderer extends AgeableMobRenderer { private static final ResourceLocation CAMEL_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/camel/camel.png"); - public CamelRenderer(EntityRendererProvider.Context context, ModelLayerLocation layerLocation) { - super(context, new CamelModel<>(context.bakeLayer(layerLocation)), 0.7F); + public CamelRenderer(EntityRendererProvider.Context context) { + super(context, new CamelModel(context.bakeLayer(ModelLayers.CAMEL)), new CamelModel(context.bakeLayer(ModelLayers.CAMEL_BABY)), 0.7F); } - /** - * Returns the location of an entity's texture. - */ - public ResourceLocation getTextureLocation(Camel entity) { + public ResourceLocation getTextureLocation(CamelRenderState camelRenderState) { return CAMEL_LOCATION; } + + public CamelRenderState createRenderState() { + return new CamelRenderState(); + } + + public void extractRenderState(Camel camel, CamelRenderState camelRenderState, float f) { + super.extractRenderState(camel, camelRenderState, f); + camelRenderState.isSaddled = camel.isSaddled(); + camelRenderState.isRidden = camel.isVehicle(); + camelRenderState.jumpCooldown = Math.max(camel.getJumpCooldown() - f, 0.0F); + camelRenderState.sitAnimationState.copyFrom(camel.sitAnimationState); + camelRenderState.sitPoseAnimationState.copyFrom(camel.sitPoseAnimationState); + camelRenderState.sitUpAnimationState.copyFrom(camel.sitUpAnimationState); + camelRenderState.idleAnimationState.copyFrom(camel.idleAnimationState); + camelRenderState.dashAnimationState.copyFrom(camel.dashAnimationState); + } } diff --git a/net/minecraft/client/renderer/entity/CatRenderer.java b/net/minecraft/client/renderer/entity/CatRenderer.java index 95c2e02c..db2290a0 100644 --- a/net/minecraft/client/renderer/entity/CatRenderer.java +++ b/net/minecraft/client/renderer/entity/CatRenderer.java @@ -7,45 +7,47 @@ import net.fabricmc.api.Environment; import net.minecraft.client.model.CatModel; import net.minecraft.client.model.geom.ModelLayers; import net.minecraft.client.renderer.entity.layers.CatCollarLayer; -import net.minecraft.core.BlockPos; +import net.minecraft.client.renderer.entity.state.CatRenderState; import net.minecraft.resources.ResourceLocation; import net.minecraft.util.Mth; import net.minecraft.world.entity.animal.Cat; -import net.minecraft.world.entity.player.Player; -import net.minecraft.world.phys.AABB; @Environment(EnvType.CLIENT) -public class CatRenderer extends MobRenderer> { +public class CatRenderer extends AgeableMobRenderer { public CatRenderer(EntityRendererProvider.Context context) { - super(context, new CatModel<>(context.bakeLayer(ModelLayers.CAT)), 0.4F); + super(context, new CatModel(context.bakeLayer(ModelLayers.CAT)), new CatModel(context.bakeLayer(ModelLayers.CAT_BABY)), 0.4F); this.addLayer(new CatCollarLayer(this, context.getModelSet())); } - /** - * Returns the location of an entity's texture. - */ - public ResourceLocation getTextureLocation(Cat entity) { - return entity.getTextureId(); + public ResourceLocation getTextureLocation(CatRenderState catRenderState) { + return catRenderState.texture; } - protected void scale(Cat livingEntity, PoseStack poseStack, float partialTickTime) { - super.scale(livingEntity, poseStack, partialTickTime); - poseStack.scale(0.8F, 0.8F, 0.8F); + public CatRenderState createRenderState() { + return new CatRenderState(); } - protected void setupRotations(Cat entity, PoseStack poseStack, float bob, float yBodyRot, float partialTick, float scale) { - super.setupRotations(entity, poseStack, bob, yBodyRot, partialTick, scale); - float f = entity.getLieDownAmount(partialTick); - if (f > 0.0F) { - poseStack.translate(0.4F * f, 0.15F * f, 0.1F * f); - poseStack.mulPose(Axis.ZP.rotationDegrees(Mth.rotLerp(f, 0.0F, 90.0F))); - BlockPos blockPos = entity.blockPosition(); + public void extractRenderState(Cat cat, CatRenderState catRenderState, float f) { + super.extractRenderState(cat, catRenderState, f); + catRenderState.texture = cat.getVariant().value().texture(); + catRenderState.isCrouching = cat.isCrouching(); + catRenderState.isSprinting = cat.isSprinting(); + catRenderState.isSitting = cat.isInSittingPose(); + catRenderState.lieDownAmount = cat.getLieDownAmount(f); + catRenderState.lieDownAmountTail = cat.getLieDownAmountTail(f); + catRenderState.relaxStateOneAmount = cat.getRelaxStateOneAmount(f); + catRenderState.isLyingOnTopOfSleepingPlayer = cat.isLyingOnTopOfSleepingPlayer(); + catRenderState.collarColor = cat.isTame() ? cat.getCollarColor() : null; + } - for (Player player : entity.level().getEntitiesOfClass(Player.class, new AABB(blockPos).inflate(2.0, 2.0, 2.0))) { - if (player.isSleeping()) { - poseStack.translate(0.15F * f, 0.0F, 0.0F); - break; - } + protected void setupRotations(CatRenderState catRenderState, PoseStack poseStack, float f, float g) { + super.setupRotations(catRenderState, poseStack, f, g); + float h = catRenderState.lieDownAmount; + if (h > 0.0F) { + poseStack.translate(0.4F * h, 0.15F * h, 0.1F * h); + poseStack.mulPose(Axis.ZP.rotationDegrees(Mth.rotLerp(h, 0.0F, 90.0F))); + if (catRenderState.isLyingOnTopOfSleepingPlayer) { + poseStack.translate(0.15F * h, 0.0F, 0.0F); } } } diff --git a/net/minecraft/client/renderer/entity/CaveSpiderRenderer.java b/net/minecraft/client/renderer/entity/CaveSpiderRenderer.java index ba048ef2..8893c6df 100644 --- a/net/minecraft/client/renderer/entity/CaveSpiderRenderer.java +++ b/net/minecraft/client/renderer/entity/CaveSpiderRenderer.java @@ -1,30 +1,23 @@ package net.minecraft.client.renderer.entity; -import com.mojang.blaze3d.vertex.PoseStack; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.model.geom.ModelLayers; +import net.minecraft.client.renderer.entity.state.LivingEntityRenderState; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.monster.CaveSpider; @Environment(EnvType.CLIENT) public class CaveSpiderRenderer extends SpiderRenderer { private static final ResourceLocation CAVE_SPIDER_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/spider/cave_spider.png"); - private static final float SCALE = 0.7F; public CaveSpiderRenderer(EntityRendererProvider.Context context) { super(context, ModelLayers.CAVE_SPIDER); - this.shadowRadius *= 0.7F; + this.shadowRadius = 0.56F; } - protected void scale(CaveSpider livingEntity, PoseStack poseStack, float partialTickTime) { - poseStack.scale(0.7F, 0.7F, 0.7F); - } - - /** - * Returns the location of an entity's texture. - */ - public ResourceLocation getTextureLocation(CaveSpider entity) { + @Override + public ResourceLocation getTextureLocation(LivingEntityRenderState livingEntityRenderState) { return CAVE_SPIDER_LOCATION; } } diff --git a/net/minecraft/client/renderer/entity/ChestedHorseRenderer.java b/net/minecraft/client/renderer/entity/ChestedHorseRenderer.java deleted file mode 100644 index 2efca23a..00000000 --- a/net/minecraft/client/renderer/entity/ChestedHorseRenderer.java +++ /dev/null @@ -1,35 +0,0 @@ -package net.minecraft.client.renderer.entity; - -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.Maps; -import java.util.Map; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.client.model.ChestedHorseModel; -import net.minecraft.client.model.geom.ModelLayerLocation; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.entity.EntityType; -import net.minecraft.world.entity.animal.horse.AbstractChestedHorse; - -@Environment(EnvType.CLIENT) -public class ChestedHorseRenderer extends AbstractHorseRenderer> { - private static final Map, ResourceLocation> MAP = Maps., ResourceLocation>newHashMap( - ImmutableMap.of( - EntityType.DONKEY, - ResourceLocation.withDefaultNamespace("textures/entity/horse/donkey.png"), - EntityType.MULE, - ResourceLocation.withDefaultNamespace("textures/entity/horse/mule.png") - ) - ); - - public ChestedHorseRenderer(EntityRendererProvider.Context context, float scale, ModelLayerLocation layer) { - super(context, new ChestedHorseModel<>(context.bakeLayer(layer)), scale); - } - - /** - * Returns the location of an entity's texture. - */ - public ResourceLocation getTextureLocation(T entity) { - return (ResourceLocation)MAP.get(entity.getType()); - } -} diff --git a/net/minecraft/client/renderer/entity/ChickenRenderer.java b/net/minecraft/client/renderer/entity/ChickenRenderer.java index e43bab50..506795d3 100644 --- a/net/minecraft/client/renderer/entity/ChickenRenderer.java +++ b/net/minecraft/client/renderer/entity/ChickenRenderer.java @@ -4,31 +4,30 @@ import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.model.ChickenModel; import net.minecraft.client.model.geom.ModelLayers; +import net.minecraft.client.renderer.entity.state.ChickenRenderState; import net.minecraft.resources.ResourceLocation; import net.minecraft.util.Mth; import net.minecraft.world.entity.animal.Chicken; @Environment(EnvType.CLIENT) -public class ChickenRenderer extends MobRenderer> { +public class ChickenRenderer extends AgeableMobRenderer { private static final ResourceLocation CHICKEN_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/chicken.png"); public ChickenRenderer(EntityRendererProvider.Context context) { - super(context, new ChickenModel<>(context.bakeLayer(ModelLayers.CHICKEN)), 0.3F); + super(context, new ChickenModel(context.bakeLayer(ModelLayers.CHICKEN)), new ChickenModel(context.bakeLayer(ModelLayers.CHICKEN_BABY)), 0.3F); } - /** - * Returns the location of an entity's texture. - */ - public ResourceLocation getTextureLocation(Chicken entity) { + public ResourceLocation getTextureLocation(ChickenRenderState chickenRenderState) { return CHICKEN_LOCATION; } - /** - * Defines what float the third param in setRotationAngles of ModelBase is - */ - protected float getBob(Chicken livingBase, float partialTicks) { - float f = Mth.lerp(partialTicks, livingBase.oFlap, livingBase.flap); - float g = Mth.lerp(partialTicks, livingBase.oFlapSpeed, livingBase.flapSpeed); - return (Mth.sin(f) + 1.0F) * g; + public ChickenRenderState createRenderState() { + return new ChickenRenderState(); + } + + public void extractRenderState(Chicken chicken, ChickenRenderState chickenRenderState, float f) { + super.extractRenderState(chicken, chickenRenderState, f); + chickenRenderState.flap = Mth.lerp(f, chicken.oFlap, chicken.flap); + chickenRenderState.flapSpeed = Mth.lerp(f, chicken.oFlapSpeed, chicken.flapSpeed); } } diff --git a/net/minecraft/client/renderer/entity/CodRenderer.java b/net/minecraft/client/renderer/entity/CodRenderer.java index 45a2fac8..f2012290 100644 --- a/net/minecraft/client/renderer/entity/CodRenderer.java +++ b/net/minecraft/client/renderer/entity/CodRenderer.java @@ -6,30 +6,34 @@ import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.model.CodModel; import net.minecraft.client.model.geom.ModelLayers; +import net.minecraft.client.renderer.entity.state.LivingEntityRenderState; import net.minecraft.resources.ResourceLocation; import net.minecraft.util.Mth; import net.minecraft.world.entity.animal.Cod; @Environment(EnvType.CLIENT) -public class CodRenderer extends MobRenderer> { +public class CodRenderer extends MobRenderer { private static final ResourceLocation COD_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/fish/cod.png"); public CodRenderer(EntityRendererProvider.Context context) { - super(context, new CodModel<>(context.bakeLayer(ModelLayers.COD)), 0.3F); + super(context, new CodModel(context.bakeLayer(ModelLayers.COD)), 0.3F); } - /** - * Returns the location of an entity's texture. - */ - public ResourceLocation getTextureLocation(Cod entity) { + @Override + public ResourceLocation getTextureLocation(LivingEntityRenderState livingEntityRenderState) { return COD_LOCATION; } - protected void setupRotations(Cod entity, PoseStack poseStack, float bob, float yBodyRot, float partialTick, float scale) { - super.setupRotations(entity, poseStack, bob, yBodyRot, partialTick, scale); - float f = 4.3F * Mth.sin(0.6F * bob); - poseStack.mulPose(Axis.YP.rotationDegrees(f)); - if (!entity.isInWater()) { + public LivingEntityRenderState createRenderState() { + return new LivingEntityRenderState(); + } + + @Override + protected void setupRotations(LivingEntityRenderState livingEntityRenderState, PoseStack poseStack, float f, float g) { + super.setupRotations(livingEntityRenderState, poseStack, f, g); + float h = 4.3F * Mth.sin(0.6F * livingEntityRenderState.ageInTicks); + poseStack.mulPose(Axis.YP.rotationDegrees(h)); + if (!livingEntityRenderState.isInWater) { poseStack.translate(0.1F, 0.1F, -0.1F); poseStack.mulPose(Axis.ZP.rotationDegrees(90.0F)); } diff --git a/net/minecraft/client/renderer/entity/CowRenderer.java b/net/minecraft/client/renderer/entity/CowRenderer.java index 582de11e..ef9a0c92 100644 --- a/net/minecraft/client/renderer/entity/CowRenderer.java +++ b/net/minecraft/client/renderer/entity/CowRenderer.java @@ -4,21 +4,28 @@ import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.model.CowModel; import net.minecraft.client.model.geom.ModelLayers; +import net.minecraft.client.renderer.entity.state.LivingEntityRenderState; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.animal.Cow; @Environment(EnvType.CLIENT) -public class CowRenderer extends MobRenderer> { +public class CowRenderer extends AgeableMobRenderer { private static final ResourceLocation COW_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/cow/cow.png"); public CowRenderer(EntityRendererProvider.Context context) { - super(context, new CowModel<>(context.bakeLayer(ModelLayers.COW)), 0.7F); + super(context, new CowModel(context.bakeLayer(ModelLayers.COW)), new CowModel(context.bakeLayer(ModelLayers.COW_BABY)), 0.7F); } - /** - * Returns the location of an entity's texture. - */ - public ResourceLocation getTextureLocation(Cow entity) { + @Override + public ResourceLocation getTextureLocation(LivingEntityRenderState livingEntityRenderState) { return COW_LOCATION; } + + public LivingEntityRenderState createRenderState() { + return new LivingEntityRenderState(); + } + + public void extractRenderState(Cow cow, LivingEntityRenderState livingEntityRenderState, float f) { + super.extractRenderState(cow, livingEntityRenderState, f); + } } diff --git a/net/minecraft/client/renderer/entity/CreakingRenderer.java b/net/minecraft/client/renderer/entity/CreakingRenderer.java new file mode 100644 index 00000000..71bacc78 --- /dev/null +++ b/net/minecraft/client/renderer/entity/CreakingRenderer.java @@ -0,0 +1,40 @@ +package net.minecraft.client.renderer.entity; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.client.model.CreakingModel; +import net.minecraft.client.model.geom.ModelLayers; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.entity.layers.LivingEntityEmissiveLayer; +import net.minecraft.client.renderer.entity.state.CreakingRenderState; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.monster.creaking.Creaking; + +@Environment(EnvType.CLIENT) +public class CreakingRenderer extends MobRenderer { + private static final ResourceLocation TEXTURE_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/creaking/creaking.png"); + private static final ResourceLocation EYES_TEXTURE_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/creaking/creaking_eyes.png"); + + public CreakingRenderer(EntityRendererProvider.Context context) { + super(context, new CreakingModel(context.bakeLayer(ModelLayers.CREAKING)), 0.7F); + this.addLayer( + new LivingEntityEmissiveLayer<>(this, EYES_TEXTURE_LOCATION, (creakingRenderState, f) -> 1.0F, CreakingModel::getHeadModelParts, RenderType::eyes) + ); + } + + public ResourceLocation getTextureLocation(CreakingRenderState creakingRenderState) { + return TEXTURE_LOCATION; + } + + public CreakingRenderState createRenderState() { + return new CreakingRenderState(); + } + + public void extractRenderState(T creaking, CreakingRenderState creakingRenderState, float f) { + super.extractRenderState(creaking, creakingRenderState, f); + creakingRenderState.attackAnimationState.copyFrom(creaking.attackAnimationState); + creakingRenderState.invulnerabilityAnimationState.copyFrom(creaking.invulnerabilityAnimationState); + creakingRenderState.isActive = creaking.isActive(); + creakingRenderState.canMove = creaking.canMove(); + } +} diff --git a/net/minecraft/client/renderer/entity/CreeperRenderer.java b/net/minecraft/client/renderer/entity/CreeperRenderer.java index e2aff806..8faf2018 100644 --- a/net/minecraft/client/renderer/entity/CreeperRenderer.java +++ b/net/minecraft/client/renderer/entity/CreeperRenderer.java @@ -6,21 +6,22 @@ import net.fabricmc.api.Environment; import net.minecraft.client.model.CreeperModel; import net.minecraft.client.model.geom.ModelLayers; import net.minecraft.client.renderer.entity.layers.CreeperPowerLayer; +import net.minecraft.client.renderer.entity.state.CreeperRenderState; import net.minecraft.resources.ResourceLocation; import net.minecraft.util.Mth; import net.minecraft.world.entity.monster.Creeper; @Environment(EnvType.CLIENT) -public class CreeperRenderer extends MobRenderer> { +public class CreeperRenderer extends MobRenderer { private static final ResourceLocation CREEPER_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/creeper/creeper.png"); public CreeperRenderer(EntityRendererProvider.Context context) { - super(context, new CreeperModel<>(context.bakeLayer(ModelLayers.CREEPER)), 0.5F); + super(context, new CreeperModel(context.bakeLayer(ModelLayers.CREEPER)), 0.5F); this.addLayer(new CreeperPowerLayer(this, context.getModelSet())); } - protected void scale(Creeper livingEntity, PoseStack poseStack, float partialTickTime) { - float f = livingEntity.getSwelling(partialTickTime); + protected void scale(CreeperRenderState creeperRenderState, PoseStack poseStack) { + float f = creeperRenderState.swelling; float g = 1.0F + Mth.sin(f * 100.0F) * f * 0.01F; f = Mth.clamp(f, 0.0F, 1.0F); f *= f; @@ -30,15 +31,22 @@ public class CreeperRenderer extends MobRenderer> poseStack.scale(h, i, h); } - protected float getWhiteOverlayProgress(Creeper livingEntity, float partialTicks) { - float f = livingEntity.getSwelling(partialTicks); + protected float getWhiteOverlayProgress(CreeperRenderState creeperRenderState) { + float f = creeperRenderState.swelling; return (int)(f * 10.0F) % 2 == 0 ? 0.0F : Mth.clamp(f, 0.5F, 1.0F); } - /** - * Returns the location of an entity's texture. - */ - public ResourceLocation getTextureLocation(Creeper entity) { + public ResourceLocation getTextureLocation(CreeperRenderState creeperRenderState) { return CREEPER_LOCATION; } + + public CreeperRenderState createRenderState() { + return new CreeperRenderState(); + } + + public void extractRenderState(Creeper creeper, CreeperRenderState creeperRenderState, float f) { + super.extractRenderState(creeper, creeperRenderState, f); + creeperRenderState.swelling = creeper.getSwelling(f); + creeperRenderState.isPowered = creeper.isPowered(); + } } diff --git a/net/minecraft/client/renderer/entity/DisplayRenderer.java b/net/minecraft/client/renderer/entity/DisplayRenderer.java index f9ecb71d..8d45a63f 100644 --- a/net/minecraft/client/renderer/entity/DisplayRenderer.java +++ b/net/minecraft/client/renderer/entity/DisplayRenderer.java @@ -11,22 +11,32 @@ import net.fabricmc.api.Environment; import net.minecraft.client.Camera; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Font; +import net.minecraft.client.renderer.LightTexture; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.block.BlockRenderDispatcher; +import net.minecraft.client.renderer.entity.state.BlockDisplayEntityRenderState; +import net.minecraft.client.renderer.entity.state.DisplayEntityRenderState; +import net.minecraft.client.renderer.entity.state.ItemDisplayEntityRenderState; +import net.minecraft.client.renderer.entity.state.TextDisplayEntityRenderState; import net.minecraft.client.renderer.texture.OverlayTexture; -import net.minecraft.client.renderer.texture.TextureAtlas; +import net.minecraft.client.resources.model.BakedModel; +import net.minecraft.core.BlockPos; import net.minecraft.network.chat.Component; -import net.minecraft.resources.ResourceLocation; import net.minecraft.util.FormattedCharSequence; -import net.minecraft.util.Mth; import net.minecraft.world.entity.Display; -import org.jetbrains.annotations.Nullable; +import net.minecraft.world.entity.Display.BlockDisplay.BlockRenderState; +import net.minecraft.world.entity.Display.ItemDisplay.ItemRenderState; +import net.minecraft.world.entity.Display.TextDisplay.Align; +import net.minecraft.world.entity.Display.TextDisplay.CachedInfo; +import net.minecraft.world.entity.Display.TextDisplay.CachedLine; +import net.minecraft.world.entity.Display.TextDisplay.TextRenderState; +import net.minecraft.world.phys.AABB; import org.joml.Matrix4f; import org.joml.Quaternionf; @Environment(EnvType.CLIENT) -public abstract class DisplayRenderer extends EntityRenderer { +public abstract class DisplayRenderer extends EntityRenderer { private final EntityRenderDispatcher entityRenderDispatcher; protected DisplayRenderer(EntityRendererProvider.Context context) { @@ -34,44 +44,61 @@ public abstract class DisplayRenderer extends EntityRender this.entityRenderDispatcher = context.getEntityRenderDispatcher(); } - /** - * Returns the location of an entity's texture. - */ - public ResourceLocation getTextureLocation(T entity) { - return TextureAtlas.LOCATION_BLOCKS; + protected AABB getBoundingBoxForCulling(T display) { + return display.getBoundingBoxForCulling(); } - public void render(T entity, float entityYaw, float partialTick, PoseStack poseStack, MultiBufferSource buffer, int packedLight) { - Display.RenderState renderState = entity.renderState(); + protected boolean affectedByCulling(T display) { + return display.affectedByCulling(); + } + + private static int getBrightnessOverride(Display display) { + Display.RenderState renderState = display.renderState(); + return renderState != null ? renderState.brightnessOverride() : -1; + } + + protected int getSkyLightLevel(T display, BlockPos blockPos) { + int i = getBrightnessOverride(display); + return i != -1 ? LightTexture.sky(i) : super.getSkyLightLevel(display, blockPos); + } + + protected int getBlockLightLevel(T display, BlockPos blockPos) { + int i = getBrightnessOverride(display); + return i != -1 ? LightTexture.block(i) : super.getBlockLightLevel(display, blockPos); + } + + public void render(ST displayEntityRenderState, PoseStack poseStack, MultiBufferSource multiBufferSource, int i) { + Display.RenderState renderState = displayEntityRenderState.renderState; if (renderState != null) { - S object = this.getSubState(entity); - if (object != null) { - float f = entity.calculateInterpolationProgress(partialTick); + if (displayEntityRenderState.hasSubState()) { + float f = displayEntityRenderState.interpolationProgress; this.shadowRadius = renderState.shadowRadius().get(f); this.shadowStrength = renderState.shadowStrength().get(f); - int i = renderState.brightnessOverride(); - int j = i != -1 ? i : packedLight; - super.render(entity, entityYaw, partialTick, poseStack, buffer, j); + super.render(displayEntityRenderState, poseStack, multiBufferSource, i); poseStack.pushPose(); - poseStack.mulPose(this.calculateOrientation(renderState, entity, partialTick, new Quaternionf())); + poseStack.mulPose(this.calculateOrientation(renderState, displayEntityRenderState, new Quaternionf())); Transformation transformation = renderState.transformation().get(f); poseStack.mulPose(transformation.getMatrix()); - this.renderInner(entity, object, poseStack, buffer, j, f); + this.renderInner(displayEntityRenderState, poseStack, multiBufferSource, i, f); poseStack.popPose(); } } } - private Quaternionf calculateOrientation(Display.RenderState renderState, T entity, float partialTick, Quaternionf quaternion) { + private Quaternionf calculateOrientation(Display.RenderState renderState, ST displayEntityRenderState, Quaternionf quaternionf) { Camera camera = this.entityRenderDispatcher.camera; return switch (renderState.billboardConstraints()) { - case FIXED -> quaternion.rotationYXZ( - (float) (-Math.PI / 180.0) * entityYRot(entity, partialTick), (float) (Math.PI / 180.0) * entityXRot(entity, partialTick), 0.0F + case FIXED -> quaternionf.rotationYXZ( + (float) (-Math.PI / 180.0) * displayEntityRenderState.entityYRot, (float) (Math.PI / 180.0) * displayEntityRenderState.entityXRot, 0.0F ); - case HORIZONTAL -> quaternion.rotationYXZ((float) (-Math.PI / 180.0) * entityYRot(entity, partialTick), (float) (Math.PI / 180.0) * cameraXRot(camera), 0.0F); - case VERTICAL -> quaternion.rotationYXZ((float) (-Math.PI / 180.0) * cameraYrot(camera), (float) (Math.PI / 180.0) * entityXRot(entity, partialTick), 0.0F); - case CENTER -> quaternion.rotationYXZ((float) (-Math.PI / 180.0) * cameraYrot(camera), (float) (Math.PI / 180.0) * cameraXRot(camera), 0.0F); + case HORIZONTAL -> quaternionf.rotationYXZ( + (float) (-Math.PI / 180.0) * displayEntityRenderState.entityYRot, (float) (Math.PI / 180.0) * cameraXRot(camera), 0.0F + ); + case VERTICAL -> quaternionf.rotationYXZ( + (float) (-Math.PI / 180.0) * cameraYrot(camera), (float) (Math.PI / 180.0) * displayEntityRenderState.entityXRot, 0.0F + ); + case CENTER -> quaternionf.rotationYXZ((float) (-Math.PI / 180.0) * cameraYrot(camera), (float) (Math.PI / 180.0) * cameraXRot(camera), 0.0F); }; } @@ -84,20 +111,25 @@ public abstract class DisplayRenderer extends EntityRender } private static float entityYRot(T entity, float partialTick) { - return Mth.rotLerp(partialTick, entity.yRotO, entity.getYRot()); + return entity.getYRot(partialTick); } private static float entityXRot(T entity, float partialTick) { - return Mth.lerp(partialTick, entity.xRotO, entity.getXRot()); + return entity.getXRot(partialTick); } - @Nullable - protected abstract S getSubState(T textDisplay); + protected abstract void renderInner(ST displayEntityRenderState, PoseStack poseStack, MultiBufferSource multiBufferSource, int i, float f); - protected abstract void renderInner(T textDisplay, S renderState, PoseStack poseStack, MultiBufferSource buffer, int lightmapUV, float partialTick); + public void extractRenderState(T display, ST displayEntityRenderState, float f) { + super.extractRenderState(display, displayEntityRenderState, f); + displayEntityRenderState.renderState = display.renderState(); + displayEntityRenderState.interpolationProgress = display.calculateInterpolationProgress(f); + displayEntityRenderState.entityYRot = entityYRot(display, f); + displayEntityRenderState.entityXRot = entityXRot(display, f); + } @Environment(EnvType.CLIENT) - public static class BlockDisplayRenderer extends DisplayRenderer { + public static class BlockDisplayRenderer extends DisplayRenderer { private final BlockRenderDispatcher blockRenderer; protected BlockDisplayRenderer(EntityRendererProvider.Context context) { @@ -105,25 +137,23 @@ public abstract class DisplayRenderer extends EntityRender this.blockRenderer = context.getBlockRenderDispatcher(); } - @Nullable - protected Display.BlockDisplay.BlockRenderState getSubState(Display.BlockDisplay blockDisplay) { - return blockDisplay.blockRenderState(); + public BlockDisplayEntityRenderState createRenderState() { + return new BlockDisplayEntityRenderState(); } - public void renderInner( - Display.BlockDisplay blockDisplay, - Display.BlockDisplay.BlockRenderState blockRenderState, - PoseStack poseStack, - MultiBufferSource multiBufferSource, - int i, - float f - ) { - this.blockRenderer.renderSingleBlock(blockRenderState.blockState(), poseStack, multiBufferSource, i, OverlayTexture.NO_OVERLAY); + public void extractRenderState(Display.BlockDisplay blockDisplay, BlockDisplayEntityRenderState blockDisplayEntityRenderState, float f) { + super.extractRenderState(blockDisplay, blockDisplayEntityRenderState, f); + blockDisplayEntityRenderState.blockRenderState = blockDisplay.blockRenderState(); + } + + public void renderInner(BlockDisplayEntityRenderState blockDisplayEntityRenderState, PoseStack poseStack, MultiBufferSource multiBufferSource, int i, float f) { + this.blockRenderer + .renderSingleBlock(blockDisplayEntityRenderState.blockRenderState.blockState(), poseStack, multiBufferSource, i, OverlayTexture.NO_OVERLAY); } } @Environment(EnvType.CLIENT) - public static class ItemDisplayRenderer extends DisplayRenderer { + public static class ItemDisplayRenderer extends DisplayRenderer { private final ItemRenderer itemRenderer; protected ItemDisplayRenderer(EntityRendererProvider.Context context) { @@ -131,36 +161,36 @@ public abstract class DisplayRenderer extends EntityRender this.itemRenderer = context.getItemRenderer(); } - @Nullable - protected Display.ItemDisplay.ItemRenderState getSubState(Display.ItemDisplay itemDisplay) { - return itemDisplay.itemRenderState(); + public ItemDisplayEntityRenderState createRenderState() { + return new ItemDisplayEntityRenderState(); } - public void renderInner( - Display.ItemDisplay itemDisplay, - Display.ItemDisplay.ItemRenderState itemRenderState, - PoseStack poseStack, - MultiBufferSource multiBufferSource, - int i, - float f - ) { - poseStack.mulPose(Axis.YP.rotation((float) Math.PI)); - this.itemRenderer - .renderStatic( - itemRenderState.itemStack(), - itemRenderState.itemTransform(), - i, - OverlayTexture.NO_OVERLAY, - poseStack, - multiBufferSource, - itemDisplay.level(), - itemDisplay.getId() - ); + public void extractRenderState(Display.ItemDisplay itemDisplay, ItemDisplayEntityRenderState itemDisplayEntityRenderState, float f) { + super.extractRenderState(itemDisplay, itemDisplayEntityRenderState, f); + ItemRenderState itemRenderState = itemDisplay.itemRenderState(); + if (itemRenderState != null) { + itemDisplayEntityRenderState.itemRenderState = itemRenderState; + itemDisplayEntityRenderState.itemModel = this.itemRenderer + .getModel(itemDisplayEntityRenderState.itemRenderState.itemStack(), itemDisplay.level(), null, itemDisplay.getId()); + } else { + itemDisplayEntityRenderState.itemRenderState = null; + itemDisplayEntityRenderState.itemModel = null; + } + } + + public void renderInner(ItemDisplayEntityRenderState itemDisplayEntityRenderState, PoseStack poseStack, MultiBufferSource multiBufferSource, int i, float f) { + ItemRenderState itemRenderState = itemDisplayEntityRenderState.itemRenderState; + BakedModel bakedModel = itemDisplayEntityRenderState.itemModel; + if (itemRenderState != null && bakedModel != null) { + poseStack.mulPose(Axis.YP.rotation((float) Math.PI)); + this.itemRenderer + .render(itemRenderState.itemStack(), itemRenderState.itemTransform(), false, poseStack, multiBufferSource, i, OverlayTexture.NO_OVERLAY, bakedModel); + } } } @Environment(EnvType.CLIENT) - public static class TextDisplayRenderer extends DisplayRenderer { + public static class TextDisplayRenderer extends DisplayRenderer { private final Font font; protected TextDisplayRenderer(EntityRendererProvider.Context context) { @@ -168,84 +198,85 @@ public abstract class DisplayRenderer extends EntityRender this.font = context.getFont(); } - private Display.TextDisplay.CachedInfo splitLines(Component text, int maxWidth) { + public TextDisplayEntityRenderState createRenderState() { + return new TextDisplayEntityRenderState(); + } + + public void extractRenderState(Display.TextDisplay textDisplay, TextDisplayEntityRenderState textDisplayEntityRenderState, float f) { + super.extractRenderState(textDisplay, textDisplayEntityRenderState, f); + textDisplayEntityRenderState.textRenderState = textDisplay.textRenderState(); + textDisplayEntityRenderState.cachedInfo = textDisplay.cacheDisplay(this::splitLines); + } + + private CachedInfo splitLines(Component text, int maxWidth) { List list = this.font.split(text, maxWidth); - List list2 = new ArrayList(list.size()); + List list2 = new ArrayList(list.size()); int i = 0; for (FormattedCharSequence formattedCharSequence : list) { int j = this.font.width(formattedCharSequence); i = Math.max(i, j); - list2.add(new Display.TextDisplay.CachedLine(formattedCharSequence, j)); + list2.add(new CachedLine(formattedCharSequence, j)); } - return new Display.TextDisplay.CachedInfo(list2, i); + return new CachedInfo(list2, i); } - @Nullable - protected Display.TextDisplay.TextRenderState getSubState(Display.TextDisplay textDisplay) { - return textDisplay.textRenderState(); - } - - public void renderInner( - Display.TextDisplay textDisplay, - Display.TextDisplay.TextRenderState renderState, - PoseStack poseStack, - MultiBufferSource buffer, - int lightmapUV, - float partialTick - ) { - byte b = renderState.flags(); + public void renderInner(TextDisplayEntityRenderState textDisplayEntityRenderState, PoseStack poseStack, MultiBufferSource multiBufferSource, int i, float f) { + TextRenderState textRenderState = textDisplayEntityRenderState.textRenderState; + byte b = textRenderState.flags(); boolean bl = (b & 2) != 0; boolean bl2 = (b & 4) != 0; boolean bl3 = (b & 1) != 0; - Display.TextDisplay.Align align = Display.TextDisplay.getAlign(b); - byte c = (byte)renderState.textOpacity().get(partialTick); - int i; + Align align = Display.TextDisplay.getAlign(b); + byte c = (byte)textRenderState.textOpacity().get(f); + int j; if (bl2) { - float f = Minecraft.getInstance().options.getBackgroundOpacity(0.25F); - i = (int)(f * 255.0F) << 24; + float g = Minecraft.getInstance().options.getBackgroundOpacity(0.25F); + j = (int)(g * 255.0F) << 24; } else { - i = renderState.backgroundColor().get(partialTick); + j = textRenderState.backgroundColor().get(f); } - float f = 0.0F; + float g = 0.0F; Matrix4f matrix4f = poseStack.last().pose(); matrix4f.rotate((float) Math.PI, 0.0F, 1.0F, 0.0F); matrix4f.scale(-0.025F, -0.025F, -0.025F); - Display.TextDisplay.CachedInfo cachedInfo = textDisplay.cacheDisplay(this::splitLines); - int j = 9 + 1; - int k = cachedInfo.width(); - int l = cachedInfo.lines().size() * j; - matrix4f.translate(1.0F - k / 2.0F, -l, 0.0F); - if (i != 0) { - VertexConsumer vertexConsumer = buffer.getBuffer(bl ? RenderType.textBackgroundSeeThrough() : RenderType.textBackground()); - vertexConsumer.addVertex(matrix4f, -1.0F, -1.0F, 0.0F).setColor(i).setLight(lightmapUV); - vertexConsumer.addVertex(matrix4f, -1.0F, (float)l, 0.0F).setColor(i).setLight(lightmapUV); - vertexConsumer.addVertex(matrix4f, (float)k, (float)l, 0.0F).setColor(i).setLight(lightmapUV); - vertexConsumer.addVertex(matrix4f, (float)k, -1.0F, 0.0F).setColor(i).setLight(lightmapUV); + CachedInfo cachedInfo = textDisplayEntityRenderState.cachedInfo; + int k = 1; + int l = 9 + 1; + int m = cachedInfo.width(); + int n = cachedInfo.lines().size() * l - 1; + matrix4f.translate(1.0F - m / 2.0F, -n, 0.0F); + if (j != 0) { + VertexConsumer vertexConsumer = multiBufferSource.getBuffer(bl ? RenderType.textBackgroundSeeThrough() : RenderType.textBackground()); + vertexConsumer.addVertex(matrix4f, -1.0F, -1.0F, 0.0F).setColor(j).setLight(i); + vertexConsumer.addVertex(matrix4f, -1.0F, (float)n, 0.0F).setColor(j).setLight(i); + vertexConsumer.addVertex(matrix4f, (float)m, (float)n, 0.0F).setColor(j).setLight(i); + vertexConsumer.addVertex(matrix4f, (float)m, -1.0F, 0.0F).setColor(j).setLight(i); } - for (Display.TextDisplay.CachedLine cachedLine : cachedInfo.lines()) { - float g = switch (align) { + for (CachedLine cachedLine : cachedInfo.lines()) { + float h = switch (align) { case LEFT -> 0.0F; - case RIGHT -> k - cachedLine.width(); - case CENTER -> k / 2.0F - cachedLine.width() / 2.0F; + case RIGHT -> m - cachedLine.width(); + case CENTER -> m / 2.0F - cachedLine.width() / 2.0F; + default -> throw new MatchException(null, null); }; this.font .drawInBatch( cachedLine.contents(), + h, g, - f, c << 24 | 16777215, bl3, matrix4f, - buffer, + multiBufferSource, bl ? Font.DisplayMode.SEE_THROUGH : Font.DisplayMode.POLYGON_OFFSET, 0, - lightmapUV + i ); - f += j; + g += l; } } } diff --git a/net/minecraft/client/renderer/entity/DolphinRenderer.java b/net/minecraft/client/renderer/entity/DolphinRenderer.java index 18a40198..13c803d6 100644 --- a/net/minecraft/client/renderer/entity/DolphinRenderer.java +++ b/net/minecraft/client/renderer/entity/DolphinRenderer.java @@ -5,22 +5,29 @@ import net.fabricmc.api.Environment; import net.minecraft.client.model.DolphinModel; import net.minecraft.client.model.geom.ModelLayers; import net.minecraft.client.renderer.entity.layers.DolphinCarryingItemLayer; +import net.minecraft.client.renderer.entity.state.DolphinRenderState; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.animal.Dolphin; @Environment(EnvType.CLIENT) -public class DolphinRenderer extends MobRenderer> { +public class DolphinRenderer extends AgeableMobRenderer { private static final ResourceLocation DOLPHIN_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/dolphin.png"); public DolphinRenderer(EntityRendererProvider.Context context) { - super(context, new DolphinModel<>(context.bakeLayer(ModelLayers.DOLPHIN)), 0.7F); - this.addLayer(new DolphinCarryingItemLayer(this, context.getItemInHandRenderer())); + super(context, new DolphinModel(context.bakeLayer(ModelLayers.DOLPHIN)), new DolphinModel(context.bakeLayer(ModelLayers.DOLPHIN_BABY)), 0.7F); + this.addLayer(new DolphinCarryingItemLayer(this, context.getItemRenderer())); } - /** - * Returns the location of an entity's texture. - */ - public ResourceLocation getTextureLocation(Dolphin entity) { + public ResourceLocation getTextureLocation(DolphinRenderState dolphinRenderState) { return DOLPHIN_LOCATION; } + + public DolphinRenderState createRenderState() { + return new DolphinRenderState(); + } + + public void extractRenderState(Dolphin dolphin, DolphinRenderState dolphinRenderState, float f) { + super.extractRenderState(dolphin, dolphinRenderState, f); + dolphinRenderState.isMoving = dolphin.getDeltaMovement().horizontalDistanceSqr() > 1.0E-7; + } } diff --git a/net/minecraft/client/renderer/entity/DonkeyRenderer.java b/net/minecraft/client/renderer/entity/DonkeyRenderer.java new file mode 100644 index 00000000..12b5dbca --- /dev/null +++ b/net/minecraft/client/renderer/entity/DonkeyRenderer.java @@ -0,0 +1,36 @@ +package net.minecraft.client.renderer.entity; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.client.model.DonkeyModel; +import net.minecraft.client.model.geom.ModelLayerLocation; +import net.minecraft.client.renderer.entity.state.DonkeyRenderState; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.animal.horse.AbstractChestedHorse; + +@Environment(EnvType.CLIENT) +public class DonkeyRenderer extends AbstractHorseRenderer { + public static final ResourceLocation DONKEY_TEXTURE = ResourceLocation.withDefaultNamespace("textures/entity/horse/donkey.png"); + public static final ResourceLocation MULE_TEXTURE = ResourceLocation.withDefaultNamespace("textures/entity/horse/mule.png"); + private final ResourceLocation texture; + + public DonkeyRenderer( + EntityRendererProvider.Context context, float f, ModelLayerLocation modelLayerLocation, ModelLayerLocation modelLayerLocation2, boolean bl + ) { + super(context, new DonkeyModel(context.bakeLayer(modelLayerLocation)), new DonkeyModel(context.bakeLayer(modelLayerLocation2)), f); + this.texture = bl ? MULE_TEXTURE : DONKEY_TEXTURE; + } + + public ResourceLocation getTextureLocation(DonkeyRenderState donkeyRenderState) { + return this.texture; + } + + public DonkeyRenderState createRenderState() { + return new DonkeyRenderState(); + } + + public void extractRenderState(T abstractChestedHorse, DonkeyRenderState donkeyRenderState, float f) { + super.extractRenderState(abstractChestedHorse, donkeyRenderState, f); + donkeyRenderState.hasChest = abstractChestedHorse.hasChest(); + } +} diff --git a/net/minecraft/client/renderer/entity/DragonFireballRenderer.java b/net/minecraft/client/renderer/entity/DragonFireballRenderer.java index 03f989f0..a4dae302 100644 --- a/net/minecraft/client/renderer/entity/DragonFireballRenderer.java +++ b/net/minecraft/client/renderer/entity/DragonFireballRenderer.java @@ -6,13 +6,14 @@ import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.entity.state.EntityRenderState; import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.core.BlockPos; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.projectile.DragonFireball; @Environment(EnvType.CLIENT) -public class DragonFireballRenderer extends EntityRenderer { +public class DragonFireballRenderer extends EntityRenderer { private static final ResourceLocation TEXTURE_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/enderdragon/dragon_fireball.png"); private static final RenderType RENDER_TYPE = RenderType.entityCutoutNoCull(TEXTURE_LOCATION); @@ -24,18 +25,19 @@ public class DragonFireballRenderer extends EntityRenderer { return 15; } - public void render(DragonFireball entity, float entityYaw, float partialTicks, PoseStack poseStack, MultiBufferSource buffer, int packedLight) { + @Override + public void render(EntityRenderState entityRenderState, PoseStack poseStack, MultiBufferSource multiBufferSource, int i) { poseStack.pushPose(); poseStack.scale(2.0F, 2.0F, 2.0F); poseStack.mulPose(this.entityRenderDispatcher.cameraOrientation()); PoseStack.Pose pose = poseStack.last(); - VertexConsumer vertexConsumer = buffer.getBuffer(RENDER_TYPE); - vertex(vertexConsumer, pose, packedLight, 0.0F, 0, 0, 1); - vertex(vertexConsumer, pose, packedLight, 1.0F, 0, 1, 1); - vertex(vertexConsumer, pose, packedLight, 1.0F, 1, 1, 0); - vertex(vertexConsumer, pose, packedLight, 0.0F, 1, 0, 0); + VertexConsumer vertexConsumer = multiBufferSource.getBuffer(RENDER_TYPE); + vertex(vertexConsumer, pose, i, 0.0F, 0, 0, 1); + vertex(vertexConsumer, pose, i, 1.0F, 0, 1, 1); + vertex(vertexConsumer, pose, i, 1.0F, 1, 1, 0); + vertex(vertexConsumer, pose, i, 0.0F, 1, 0, 0); poseStack.popPose(); - super.render(entity, entityYaw, partialTicks, poseStack, buffer, packedLight); + super.render(entityRenderState, poseStack, multiBufferSource, i); } private static void vertex(VertexConsumer consumer, PoseStack.Pose pose, int packedLight, float x, int y, int u, int v) { @@ -47,10 +49,8 @@ public class DragonFireballRenderer extends EntityRenderer { .setNormal(pose, 0.0F, 1.0F, 0.0F); } - /** - * Returns the location of an entity's texture. - */ - public ResourceLocation getTextureLocation(DragonFireball entity) { - return TEXTURE_LOCATION; + @Override + public EntityRenderState createRenderState() { + return new EntityRenderState(); } } diff --git a/net/minecraft/client/renderer/entity/DrownedRenderer.java b/net/minecraft/client/renderer/entity/DrownedRenderer.java index a50106c6..b217143e 100644 --- a/net/minecraft/client/renderer/entity/DrownedRenderer.java +++ b/net/minecraft/client/renderer/entity/DrownedRenderer.java @@ -7,37 +7,44 @@ import net.fabricmc.api.Environment; import net.minecraft.client.model.DrownedModel; import net.minecraft.client.model.geom.ModelLayers; import net.minecraft.client.renderer.entity.layers.DrownedOuterLayer; +import net.minecraft.client.renderer.entity.state.ZombieRenderState; import net.minecraft.resources.ResourceLocation; import net.minecraft.util.Mth; import net.minecraft.world.entity.monster.Drowned; -import net.minecraft.world.entity.monster.Zombie; @Environment(EnvType.CLIENT) -public class DrownedRenderer extends AbstractZombieRenderer> { +public class DrownedRenderer extends AbstractZombieRenderer { private static final ResourceLocation DROWNED_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/zombie/drowned.png"); public DrownedRenderer(EntityRendererProvider.Context context) { super( context, - new DrownedModel<>(context.bakeLayer(ModelLayers.DROWNED)), - new DrownedModel<>(context.bakeLayer(ModelLayers.DROWNED_INNER_ARMOR)), - new DrownedModel<>(context.bakeLayer(ModelLayers.DROWNED_OUTER_ARMOR)) + new DrownedModel(context.bakeLayer(ModelLayers.DROWNED)), + new DrownedModel(context.bakeLayer(ModelLayers.DROWNED_BABY)), + new DrownedModel(context.bakeLayer(ModelLayers.DROWNED_INNER_ARMOR)), + new DrownedModel(context.bakeLayer(ModelLayers.DROWNED_OUTER_ARMOR)), + new DrownedModel(context.bakeLayer(ModelLayers.DROWNED_BABY_INNER_ARMOR)), + new DrownedModel(context.bakeLayer(ModelLayers.DROWNED_BABY_OUTER_ARMOR)) ); - this.addLayer(new DrownedOuterLayer<>(this, context.getModelSet())); + this.addLayer(new DrownedOuterLayer(this, context.getModelSet())); + } + + public ZombieRenderState createRenderState() { + return new ZombieRenderState(); } @Override - public ResourceLocation getTextureLocation(Zombie entity) { + public ResourceLocation getTextureLocation(ZombieRenderState zombieRenderState) { return DROWNED_LOCATION; } - protected void setupRotations(Drowned entity, PoseStack poseStack, float bob, float yBodyRot, float partialTick, float scale) { - super.setupRotations(entity, poseStack, bob, yBodyRot, partialTick, scale); - float f = entity.getSwimAmount(partialTick); - if (f > 0.0F) { - float g = -10.0F - entity.getXRot(); - float h = Mth.lerp(f, 0.0F, g); - poseStack.rotateAround(Axis.XP.rotationDegrees(h), 0.0F, entity.getBbHeight() / 2.0F / scale, 0.0F); + protected void setupRotations(ZombieRenderState zombieRenderState, PoseStack poseStack, float f, float g) { + super.setupRotations(zombieRenderState, poseStack, f, g); + float h = zombieRenderState.swimAmount; + if (h > 0.0F) { + float i = -10.0F - zombieRenderState.xRot; + float j = Mth.lerp(h, 0.0F, i); + poseStack.rotateAround(Axis.XP.rotationDegrees(j), 0.0F, zombieRenderState.boundingBoxHeight / 2.0F / g, 0.0F); } } } diff --git a/net/minecraft/client/renderer/entity/ElderGuardianRenderer.java b/net/minecraft/client/renderer/entity/ElderGuardianRenderer.java index 66f36848..5345e3e0 100644 --- a/net/minecraft/client/renderer/entity/ElderGuardianRenderer.java +++ b/net/minecraft/client/renderer/entity/ElderGuardianRenderer.java @@ -1,12 +1,10 @@ package net.minecraft.client.renderer.entity; -import com.mojang.blaze3d.vertex.PoseStack; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.model.geom.ModelLayers; +import net.minecraft.client.renderer.entity.state.GuardianRenderState; import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.entity.monster.ElderGuardian; -import net.minecraft.world.entity.monster.Guardian; @Environment(EnvType.CLIENT) public class ElderGuardianRenderer extends GuardianRenderer { @@ -16,12 +14,8 @@ public class ElderGuardianRenderer extends GuardianRenderer { super(context, 1.2F, ModelLayers.ELDER_GUARDIAN); } - protected void scale(Guardian livingEntity, PoseStack poseStack, float partialTickTime) { - poseStack.scale(ElderGuardian.ELDER_SIZE_SCALE, ElderGuardian.ELDER_SIZE_SCALE, ElderGuardian.ELDER_SIZE_SCALE); - } - @Override - public ResourceLocation getTextureLocation(Guardian entity) { + public ResourceLocation getTextureLocation(GuardianRenderState guardianRenderState) { return GUARDIAN_ELDER_LOCATION; } } diff --git a/net/minecraft/client/renderer/entity/EndCrystalRenderer.java b/net/minecraft/client/renderer/entity/EndCrystalRenderer.java index fb3d360f..865863bc 100644 --- a/net/minecraft/client/renderer/entity/EndCrystalRenderer.java +++ b/net/minecraft/client/renderer/entity/EndCrystalRenderer.java @@ -1,111 +1,73 @@ package net.minecraft.client.renderer.entity; import com.mojang.blaze3d.vertex.PoseStack; -import com.mojang.blaze3d.vertex.VertexConsumer; -import com.mojang.math.Axis; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; +import net.minecraft.client.model.EndCrystalModel; import net.minecraft.client.model.geom.ModelLayers; -import net.minecraft.client.model.geom.ModelPart; -import net.minecraft.client.model.geom.PartPose; -import net.minecraft.client.model.geom.builders.CubeListBuilder; -import net.minecraft.client.model.geom.builders.LayerDefinition; -import net.minecraft.client.model.geom.builders.MeshDefinition; -import net.minecraft.client.model.geom.builders.PartDefinition; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.culling.Frustum; +import net.minecraft.client.renderer.entity.state.EndCrystalRenderState; import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.core.BlockPos; import net.minecraft.resources.ResourceLocation; import net.minecraft.util.Mth; import net.minecraft.world.entity.boss.enderdragon.EndCrystal; -import org.joml.Quaternionf; +import net.minecraft.world.phys.Vec3; @Environment(EnvType.CLIENT) -public class EndCrystalRenderer extends EntityRenderer { +public class EndCrystalRenderer extends EntityRenderer { private static final ResourceLocation END_CRYSTAL_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/end_crystal/end_crystal.png"); private static final RenderType RENDER_TYPE = RenderType.entityCutoutNoCull(END_CRYSTAL_LOCATION); - private static final float SIN_45 = (float)Math.sin(Math.PI / 4); - private static final String GLASS = "glass"; - private static final String BASE = "base"; - private final ModelPart cube; - private final ModelPart glass; - private final ModelPart base; + private final EndCrystalModel model; public EndCrystalRenderer(EntityRendererProvider.Context context) { super(context); this.shadowRadius = 0.5F; - ModelPart modelPart = context.bakeLayer(ModelLayers.END_CRYSTAL); - this.glass = modelPart.getChild("glass"); - this.cube = modelPart.getChild("cube"); - this.base = modelPart.getChild("base"); + this.model = new EndCrystalModel(context.bakeLayer(ModelLayers.END_CRYSTAL)); } - public static LayerDefinition createBodyLayer() { - MeshDefinition meshDefinition = new MeshDefinition(); - PartDefinition partDefinition = meshDefinition.getRoot(); - partDefinition.addOrReplaceChild("glass", CubeListBuilder.create().texOffs(0, 0).addBox(-4.0F, -4.0F, -4.0F, 8.0F, 8.0F, 8.0F), PartPose.ZERO); - partDefinition.addOrReplaceChild("cube", CubeListBuilder.create().texOffs(32, 0).addBox(-4.0F, -4.0F, -4.0F, 8.0F, 8.0F, 8.0F), PartPose.ZERO); - partDefinition.addOrReplaceChild("base", CubeListBuilder.create().texOffs(0, 16).addBox(-6.0F, 0.0F, -6.0F, 12.0F, 4.0F, 12.0F), PartPose.ZERO); - return LayerDefinition.create(meshDefinition, 64, 32); - } - - public void render(EndCrystal entity, float entityYaw, float partialTicks, PoseStack poseStack, MultiBufferSource buffer, int packedLight) { - poseStack.pushPose(); - float f = getY(entity, partialTicks); - float g = (entity.time + partialTicks) * 3.0F; - VertexConsumer vertexConsumer = buffer.getBuffer(RENDER_TYPE); + public void render(EndCrystalRenderState endCrystalRenderState, PoseStack poseStack, MultiBufferSource multiBufferSource, int i) { poseStack.pushPose(); poseStack.scale(2.0F, 2.0F, 2.0F); poseStack.translate(0.0F, -0.5F, 0.0F); - int i = OverlayTexture.NO_OVERLAY; - if (entity.showsBottom()) { - this.base.render(poseStack, vertexConsumer, packedLight, i); + this.model.setupAnim(endCrystalRenderState); + this.model.renderToBuffer(poseStack, multiBufferSource.getBuffer(RENDER_TYPE), i, OverlayTexture.NO_OVERLAY); + poseStack.popPose(); + Vec3 vec3 = endCrystalRenderState.beamOffset; + if (vec3 != null) { + float f = getY(endCrystalRenderState.ageInTicks); + float g = (float)vec3.x; + float h = (float)vec3.y; + float j = (float)vec3.z; + poseStack.translate(vec3); + EnderDragonRenderer.renderCrystalBeams(-g, -h + f, -j, endCrystalRenderState.ageInTicks, poseStack, multiBufferSource, i); } - poseStack.mulPose(Axis.YP.rotationDegrees(g)); - poseStack.translate(0.0F, 1.5F + f / 2.0F, 0.0F); - poseStack.mulPose(new Quaternionf().setAngleAxis((float) (Math.PI / 3), SIN_45, 0.0F, SIN_45)); - this.glass.render(poseStack, vertexConsumer, packedLight, i); - float h = 0.875F; - poseStack.scale(0.875F, 0.875F, 0.875F); - poseStack.mulPose(new Quaternionf().setAngleAxis((float) (Math.PI / 3), SIN_45, 0.0F, SIN_45)); - poseStack.mulPose(Axis.YP.rotationDegrees(g)); - this.glass.render(poseStack, vertexConsumer, packedLight, i); - poseStack.scale(0.875F, 0.875F, 0.875F); - poseStack.mulPose(new Quaternionf().setAngleAxis((float) (Math.PI / 3), SIN_45, 0.0F, SIN_45)); - poseStack.mulPose(Axis.YP.rotationDegrees(g)); - this.cube.render(poseStack, vertexConsumer, packedLight, i); - poseStack.popPose(); - poseStack.popPose(); - BlockPos blockPos = entity.getBeamTarget(); - if (blockPos != null) { - float j = blockPos.getX() + 0.5F; - float k = blockPos.getY() + 0.5F; - float l = blockPos.getZ() + 0.5F; - float m = (float)(j - entity.getX()); - float n = (float)(k - entity.getY()); - float o = (float)(l - entity.getZ()); - poseStack.translate(m, n, o); - EnderDragonRenderer.renderCrystalBeams(-m, -n + f, -o, partialTicks, entity.time, poseStack, buffer, packedLight); - } - - super.render(entity, entityYaw, partialTicks, poseStack, buffer, packedLight); + super.render(endCrystalRenderState, poseStack, multiBufferSource, i); } - public static float getY(EndCrystal endCrystal, float partialTick) { - float f = endCrystal.time + partialTick; + public static float getY(float f) { float g = Mth.sin(f * 0.2F) / 2.0F + 0.5F; g = (g * g + g) * 0.4F; return g - 1.4F; } - /** - * Returns the location of an entity's texture. - */ - public ResourceLocation getTextureLocation(EndCrystal entity) { - return END_CRYSTAL_LOCATION; + public EndCrystalRenderState createRenderState() { + return new EndCrystalRenderState(); + } + + public void extractRenderState(EndCrystal endCrystal, EndCrystalRenderState endCrystalRenderState, float f) { + super.extractRenderState(endCrystal, endCrystalRenderState, f); + endCrystalRenderState.ageInTicks = endCrystal.time + f; + endCrystalRenderState.showsBottom = endCrystal.showsBottom(); + BlockPos blockPos = endCrystal.getBeamTarget(); + if (blockPos != null) { + endCrystalRenderState.beamOffset = Vec3.atCenterOf(blockPos).subtract(endCrystal.getPosition(f)); + } else { + endCrystalRenderState.beamOffset = null; + } } public boolean shouldRender(EndCrystal livingEntity, Frustum camera, double camX, double camY, double camZ) { diff --git a/net/minecraft/client/renderer/entity/EnderDragonRenderer.java b/net/minecraft/client/renderer/entity/EnderDragonRenderer.java index 3f847266..2fcfb485 100644 --- a/net/minecraft/client/renderer/entity/EnderDragonRenderer.java +++ b/net/minecraft/client/renderer/entity/EnderDragonRenderer.java @@ -5,28 +5,29 @@ import com.mojang.blaze3d.vertex.VertexConsumer; import com.mojang.math.Axis; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; -import net.minecraft.client.model.EntityModel; +import net.minecraft.client.model.dragon.EnderDragonModel; import net.minecraft.client.model.geom.ModelLayers; -import net.minecraft.client.model.geom.ModelPart; -import net.minecraft.client.model.geom.PartPose; -import net.minecraft.client.model.geom.builders.CubeListBuilder; -import net.minecraft.client.model.geom.builders.LayerDefinition; -import net.minecraft.client.model.geom.builders.MeshDefinition; -import net.minecraft.client.model.geom.builders.PartDefinition; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.entity.state.EnderDragonRenderState; import net.minecraft.client.renderer.texture.OverlayTexture; +import net.minecraft.core.BlockPos; import net.minecraft.resources.ResourceLocation; -import net.minecraft.util.FastColor; +import net.minecraft.util.ARGB; import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; +import net.minecraft.world.entity.boss.enderdragon.EndCrystal; import net.minecraft.world.entity.boss.enderdragon.EnderDragon; -import org.jetbrains.annotations.Nullable; +import net.minecraft.world.entity.boss.enderdragon.phases.DragonPhaseInstance; +import net.minecraft.world.entity.boss.enderdragon.phases.EnderDragonPhase; +import net.minecraft.world.level.levelgen.Heightmap; +import net.minecraft.world.level.levelgen.feature.EndPodiumFeature; +import net.minecraft.world.phys.Vec3; import org.joml.Quaternionf; import org.joml.Vector3f; @Environment(EnvType.CLIENT) -public class EnderDragonRenderer extends EntityRenderer { +public class EnderDragonRenderer extends EntityRenderer { public static final ResourceLocation CRYSTAL_BEAM_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/end_crystal/end_crystal_beam.png"); private static final ResourceLocation DRAGON_EXPLODING_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/enderdragon/dragon_exploding.png"); private static final ResourceLocation DRAGON_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/enderdragon/dragon.png"); @@ -36,65 +37,67 @@ public class EnderDragonRenderer extends EntityRenderer { private static final RenderType EYES = RenderType.eyes(DRAGON_EYES_LOCATION); private static final RenderType BEAM = RenderType.entitySmoothCutout(CRYSTAL_BEAM_LOCATION); private static final float HALF_SQRT_3 = (float)(Math.sqrt(3.0) / 2.0); - private final EnderDragonRenderer.DragonModel model; + private final EnderDragonModel model; public EnderDragonRenderer(EntityRendererProvider.Context context) { super(context); this.shadowRadius = 0.5F; - this.model = new EnderDragonRenderer.DragonModel(context.bakeLayer(ModelLayers.ENDER_DRAGON)); + this.model = new EnderDragonModel(context.bakeLayer(ModelLayers.ENDER_DRAGON)); } - public void render(EnderDragon entity, float entityYaw, float partialTicks, PoseStack poseStack, MultiBufferSource buffer, int packedLight) { + public void render(EnderDragonRenderState enderDragonRenderState, PoseStack poseStack, MultiBufferSource multiBufferSource, int i) { poseStack.pushPose(); - float f = (float)entity.getLatencyPos(7, partialTicks)[0]; - float g = (float)(entity.getLatencyPos(5, partialTicks)[1] - entity.getLatencyPos(10, partialTicks)[1]); + float f = enderDragonRenderState.getHistoricalPos(7).yRot(); + float g = (float)(enderDragonRenderState.getHistoricalPos(5).y() - enderDragonRenderState.getHistoricalPos(10).y()); poseStack.mulPose(Axis.YP.rotationDegrees(-f)); poseStack.mulPose(Axis.XP.rotationDegrees(g * 10.0F)); poseStack.translate(0.0F, 0.0F, 1.0F); poseStack.scale(-1.0F, -1.0F, 1.0F); poseStack.translate(0.0F, -1.501F, 0.0F); - boolean bl = entity.hurtTime > 0; - this.model.prepareMobModel(entity, 0.0F, 0.0F, partialTicks); - if (entity.dragonDeathTime > 0) { - float h = entity.dragonDeathTime / 200.0F; - int i = FastColor.ARGB32.color(Mth.floor(h * 255.0F), -1); - VertexConsumer vertexConsumer = buffer.getBuffer(RenderType.dragonExplosionAlpha(DRAGON_EXPLODING_LOCATION)); - this.model.renderToBuffer(poseStack, vertexConsumer, packedLight, OverlayTexture.NO_OVERLAY, i); - VertexConsumer vertexConsumer2 = buffer.getBuffer(DECAL); - this.model.renderToBuffer(poseStack, vertexConsumer2, packedLight, OverlayTexture.pack(0.0F, bl)); + this.model.setupAnim(enderDragonRenderState); + if (enderDragonRenderState.deathTime > 0.0F) { + float h = enderDragonRenderState.deathTime / 200.0F; + int j = ARGB.color(Mth.floor(h * 255.0F), -1); + VertexConsumer vertexConsumer = multiBufferSource.getBuffer(RenderType.dragonExplosionAlpha(DRAGON_EXPLODING_LOCATION)); + this.model.renderToBuffer(poseStack, vertexConsumer, i, OverlayTexture.NO_OVERLAY, j); + VertexConsumer vertexConsumer2 = multiBufferSource.getBuffer(DECAL); + this.model.renderToBuffer(poseStack, vertexConsumer2, i, OverlayTexture.pack(0.0F, enderDragonRenderState.hasRedOverlay)); } else { - VertexConsumer vertexConsumer3 = buffer.getBuffer(RENDER_TYPE); - this.model.renderToBuffer(poseStack, vertexConsumer3, packedLight, OverlayTexture.pack(0.0F, bl)); + VertexConsumer vertexConsumer3 = multiBufferSource.getBuffer(RENDER_TYPE); + this.model.renderToBuffer(poseStack, vertexConsumer3, i, OverlayTexture.pack(0.0F, enderDragonRenderState.hasRedOverlay)); } - VertexConsumer vertexConsumer3 = buffer.getBuffer(EYES); - this.model.renderToBuffer(poseStack, vertexConsumer3, packedLight, OverlayTexture.NO_OVERLAY); - if (entity.dragonDeathTime > 0) { - float j = (entity.dragonDeathTime + partialTicks) / 200.0F; + VertexConsumer vertexConsumer3 = multiBufferSource.getBuffer(EYES); + this.model.renderToBuffer(poseStack, vertexConsumer3, i, OverlayTexture.NO_OVERLAY); + if (enderDragonRenderState.deathTime > 0.0F) { + float k = enderDragonRenderState.deathTime / 200.0F; poseStack.pushPose(); poseStack.translate(0.0F, -1.0F, -2.0F); - renderRays(poseStack, j, buffer.getBuffer(RenderType.dragonRays())); - renderRays(poseStack, j, buffer.getBuffer(RenderType.dragonRaysDepth())); + renderRays(poseStack, k, multiBufferSource.getBuffer(RenderType.dragonRays())); + renderRays(poseStack, k, multiBufferSource.getBuffer(RenderType.dragonRaysDepth())); poseStack.popPose(); } poseStack.popPose(); - if (entity.nearestCrystal != null) { - poseStack.pushPose(); - float j = (float)(entity.nearestCrystal.getX() - Mth.lerp((double)partialTicks, entity.xo, entity.getX())); - float k = (float)(entity.nearestCrystal.getY() - Mth.lerp((double)partialTicks, entity.yo, entity.getY())); - float l = (float)(entity.nearestCrystal.getZ() - Mth.lerp((double)partialTicks, entity.zo, entity.getZ())); - renderCrystalBeams(j, k + EndCrystalRenderer.getY(entity.nearestCrystal, partialTicks), l, partialTicks, entity.tickCount, poseStack, buffer, packedLight); - poseStack.popPose(); + if (enderDragonRenderState.beamOffset != null) { + renderCrystalBeams( + (float)enderDragonRenderState.beamOffset.x, + (float)enderDragonRenderState.beamOffset.y, + (float)enderDragonRenderState.beamOffset.z, + enderDragonRenderState.ageInTicks, + poseStack, + multiBufferSource, + i + ); } - super.render(entity, entityYaw, partialTicks, poseStack, buffer, packedLight); + super.render(enderDragonRenderState, poseStack, multiBufferSource, i); } private static void renderRays(PoseStack poseStack, float dragonDeathCompletion, VertexConsumer buffer) { poseStack.pushPose(); float f = Math.min(dragonDeathCompletion > 0.8F ? (dragonDeathCompletion - 0.8F) / 0.2F : 0.0F, 1.0F); - int i = FastColor.ARGB32.colorFromFloat(1.0F - f, 1.0F, 1.0F, 1.0F); + int i = ARGB.colorFromFloat(1.0F - f, 1.0F, 1.0F, 1.0F); int j = 16711935; RandomSource randomSource = RandomSource.create(432L); Vector3f vector3f = new Vector3f(); @@ -134,354 +137,76 @@ public class EnderDragonRenderer extends EntityRenderer { poseStack.popPose(); } - public static void renderCrystalBeams( - float x, float y, float z, float partialTick, int tickCount, PoseStack poseStack, MultiBufferSource bufferSource, int packedLight - ) { - float f = Mth.sqrt(x * x + z * z); - float g = Mth.sqrt(x * x + y * y + z * z); + public static void renderCrystalBeams(float f, float g, float h, float i, PoseStack poseStack, MultiBufferSource multiBufferSource, int j) { + float k = Mth.sqrt(f * f + h * h); + float l = Mth.sqrt(f * f + g * g + h * h); poseStack.pushPose(); poseStack.translate(0.0F, 2.0F, 0.0F); - poseStack.mulPose(Axis.YP.rotation((float)(-Math.atan2(z, x)) - (float) (Math.PI / 2))); - poseStack.mulPose(Axis.XP.rotation((float)(-Math.atan2(f, y)) - (float) (Math.PI / 2))); - VertexConsumer vertexConsumer = bufferSource.getBuffer(BEAM); - float h = 0.0F - (tickCount + partialTick) * 0.01F; - float i = Mth.sqrt(x * x + y * y + z * z) / 32.0F - (tickCount + partialTick) * 0.01F; - int j = 8; - float k = 0.0F; - float l = 0.75F; - float m = 0.0F; + poseStack.mulPose(Axis.YP.rotation((float)(-Math.atan2(h, f)) - (float) (Math.PI / 2))); + poseStack.mulPose(Axis.XP.rotation((float)(-Math.atan2(k, g)) - (float) (Math.PI / 2))); + VertexConsumer vertexConsumer = multiBufferSource.getBuffer(BEAM); + float m = 0.0F - i * 0.01F; + float n = l / 32.0F - i * 0.01F; + int o = 8; + float p = 0.0F; + float q = 0.75F; + float r = 0.0F; PoseStack.Pose pose = poseStack.last(); - for (int n = 1; n <= 8; n++) { - float o = Mth.sin(n * (float) (Math.PI * 2) / 8.0F) * 0.75F; - float p = Mth.cos(n * (float) (Math.PI * 2) / 8.0F) * 0.75F; - float q = n / 8.0F; - vertexConsumer.addVertex(pose, k * 0.2F, l * 0.2F, 0.0F) + for (int s = 1; s <= 8; s++) { + float t = Mth.sin(s * (float) (Math.PI * 2) / 8.0F) * 0.75F; + float u = Mth.cos(s * (float) (Math.PI * 2) / 8.0F) * 0.75F; + float v = s / 8.0F; + vertexConsumer.addVertex(pose, p * 0.2F, q * 0.2F, 0.0F) .setColor(-16777216) - .setUv(m, h) + .setUv(r, m) .setOverlay(OverlayTexture.NO_OVERLAY) - .setLight(packedLight) + .setLight(j) .setNormal(pose, 0.0F, -1.0F, 0.0F); - vertexConsumer.addVertex(pose, k, l, g) - .setColor(-1) - .setUv(m, i) - .setOverlay(OverlayTexture.NO_OVERLAY) - .setLight(packedLight) - .setNormal(pose, 0.0F, -1.0F, 0.0F); - vertexConsumer.addVertex(pose, o, p, g) - .setColor(-1) - .setUv(q, i) - .setOverlay(OverlayTexture.NO_OVERLAY) - .setLight(packedLight) - .setNormal(pose, 0.0F, -1.0F, 0.0F); - vertexConsumer.addVertex(pose, o * 0.2F, p * 0.2F, 0.0F) + vertexConsumer.addVertex(pose, p, q, l).setColor(-1).setUv(r, n).setOverlay(OverlayTexture.NO_OVERLAY).setLight(j).setNormal(pose, 0.0F, -1.0F, 0.0F); + vertexConsumer.addVertex(pose, t, u, l).setColor(-1).setUv(v, n).setOverlay(OverlayTexture.NO_OVERLAY).setLight(j).setNormal(pose, 0.0F, -1.0F, 0.0F); + vertexConsumer.addVertex(pose, t * 0.2F, u * 0.2F, 0.0F) .setColor(-16777216) - .setUv(q, h) + .setUv(v, m) .setOverlay(OverlayTexture.NO_OVERLAY) - .setLight(packedLight) + .setLight(j) .setNormal(pose, 0.0F, -1.0F, 0.0F); - k = o; - l = p; - m = q; + p = t; + q = u; + r = v; } poseStack.popPose(); } - /** - * Returns the location of an entity's texture. - */ - public ResourceLocation getTextureLocation(EnderDragon entity) { - return DRAGON_LOCATION; + public EnderDragonRenderState createRenderState() { + return new EnderDragonRenderState(); } - public static LayerDefinition createBodyLayer() { - MeshDefinition meshDefinition = new MeshDefinition(); - PartDefinition partDefinition = meshDefinition.getRoot(); - float f = -16.0F; - PartDefinition partDefinition2 = partDefinition.addOrReplaceChild( - "head", - CubeListBuilder.create() - .addBox("upperlip", -6.0F, -1.0F, -24.0F, 12, 5, 16, 176, 44) - .addBox("upperhead", -8.0F, -8.0F, -10.0F, 16, 16, 16, 112, 30) - .mirror() - .addBox("scale", -5.0F, -12.0F, -4.0F, 2, 4, 6, 0, 0) - .addBox("nostril", -5.0F, -3.0F, -22.0F, 2, 2, 4, 112, 0) - .mirror() - .addBox("scale", 3.0F, -12.0F, -4.0F, 2, 4, 6, 0, 0) - .addBox("nostril", 3.0F, -3.0F, -22.0F, 2, 2, 4, 112, 0), - PartPose.ZERO - ); - partDefinition2.addOrReplaceChild("jaw", CubeListBuilder.create().addBox("jaw", -6.0F, 0.0F, -16.0F, 12, 4, 16, 176, 65), PartPose.offset(0.0F, 4.0F, -8.0F)); - partDefinition.addOrReplaceChild( - "neck", - CubeListBuilder.create().addBox("box", -5.0F, -5.0F, -5.0F, 10, 10, 10, 192, 104).addBox("scale", -1.0F, -9.0F, -3.0F, 2, 4, 6, 48, 0), - PartPose.ZERO - ); - partDefinition.addOrReplaceChild( - "body", - CubeListBuilder.create() - .addBox("body", -12.0F, 0.0F, -16.0F, 24, 24, 64, 0, 0) - .addBox("scale", -1.0F, -6.0F, -10.0F, 2, 6, 12, 220, 53) - .addBox("scale", -1.0F, -6.0F, 10.0F, 2, 6, 12, 220, 53) - .addBox("scale", -1.0F, -6.0F, 30.0F, 2, 6, 12, 220, 53), - PartPose.offset(0.0F, 4.0F, 8.0F) - ); - PartDefinition partDefinition3 = partDefinition.addOrReplaceChild( - "left_wing", - CubeListBuilder.create().mirror().addBox("bone", 0.0F, -4.0F, -4.0F, 56, 8, 8, 112, 88).addBox("skin", 0.0F, 0.0F, 2.0F, 56, 0, 56, -56, 88), - PartPose.offset(12.0F, 5.0F, 2.0F) - ); - partDefinition3.addOrReplaceChild( - "left_wing_tip", - CubeListBuilder.create().mirror().addBox("bone", 0.0F, -2.0F, -2.0F, 56, 4, 4, 112, 136).addBox("skin", 0.0F, 0.0F, 2.0F, 56, 0, 56, -56, 144), - PartPose.offset(56.0F, 0.0F, 0.0F) - ); - PartDefinition partDefinition4 = partDefinition.addOrReplaceChild( - "left_front_leg", CubeListBuilder.create().addBox("main", -4.0F, -4.0F, -4.0F, 8, 24, 8, 112, 104), PartPose.offset(12.0F, 20.0F, 2.0F) - ); - PartDefinition partDefinition5 = partDefinition4.addOrReplaceChild( - "left_front_leg_tip", CubeListBuilder.create().addBox("main", -3.0F, -1.0F, -3.0F, 6, 24, 6, 226, 138), PartPose.offset(0.0F, 20.0F, -1.0F) - ); - partDefinition5.addOrReplaceChild( - "left_front_foot", CubeListBuilder.create().addBox("main", -4.0F, 0.0F, -12.0F, 8, 4, 16, 144, 104), PartPose.offset(0.0F, 23.0F, 0.0F) - ); - PartDefinition partDefinition6 = partDefinition.addOrReplaceChild( - "left_hind_leg", CubeListBuilder.create().addBox("main", -8.0F, -4.0F, -8.0F, 16, 32, 16, 0, 0), PartPose.offset(16.0F, 16.0F, 42.0F) - ); - PartDefinition partDefinition7 = partDefinition6.addOrReplaceChild( - "left_hind_leg_tip", CubeListBuilder.create().addBox("main", -6.0F, -2.0F, 0.0F, 12, 32, 12, 196, 0), PartPose.offset(0.0F, 32.0F, -4.0F) - ); - partDefinition7.addOrReplaceChild( - "left_hind_foot", CubeListBuilder.create().addBox("main", -9.0F, 0.0F, -20.0F, 18, 6, 24, 112, 0), PartPose.offset(0.0F, 31.0F, 4.0F) - ); - PartDefinition partDefinition8 = partDefinition.addOrReplaceChild( - "right_wing", - CubeListBuilder.create().addBox("bone", -56.0F, -4.0F, -4.0F, 56, 8, 8, 112, 88).addBox("skin", -56.0F, 0.0F, 2.0F, 56, 0, 56, -56, 88), - PartPose.offset(-12.0F, 5.0F, 2.0F) - ); - partDefinition8.addOrReplaceChild( - "right_wing_tip", - CubeListBuilder.create().addBox("bone", -56.0F, -2.0F, -2.0F, 56, 4, 4, 112, 136).addBox("skin", -56.0F, 0.0F, 2.0F, 56, 0, 56, -56, 144), - PartPose.offset(-56.0F, 0.0F, 0.0F) - ); - PartDefinition partDefinition9 = partDefinition.addOrReplaceChild( - "right_front_leg", CubeListBuilder.create().addBox("main", -4.0F, -4.0F, -4.0F, 8, 24, 8, 112, 104), PartPose.offset(-12.0F, 20.0F, 2.0F) - ); - PartDefinition partDefinition10 = partDefinition9.addOrReplaceChild( - "right_front_leg_tip", CubeListBuilder.create().addBox("main", -3.0F, -1.0F, -3.0F, 6, 24, 6, 226, 138), PartPose.offset(0.0F, 20.0F, -1.0F) - ); - partDefinition10.addOrReplaceChild( - "right_front_foot", CubeListBuilder.create().addBox("main", -4.0F, 0.0F, -12.0F, 8, 4, 16, 144, 104), PartPose.offset(0.0F, 23.0F, 0.0F) - ); - PartDefinition partDefinition11 = partDefinition.addOrReplaceChild( - "right_hind_leg", CubeListBuilder.create().addBox("main", -8.0F, -4.0F, -8.0F, 16, 32, 16, 0, 0), PartPose.offset(-16.0F, 16.0F, 42.0F) - ); - PartDefinition partDefinition12 = partDefinition11.addOrReplaceChild( - "right_hind_leg_tip", CubeListBuilder.create().addBox("main", -6.0F, -2.0F, 0.0F, 12, 32, 12, 196, 0), PartPose.offset(0.0F, 32.0F, -4.0F) - ); - partDefinition12.addOrReplaceChild( - "right_hind_foot", CubeListBuilder.create().addBox("main", -9.0F, 0.0F, -20.0F, 18, 6, 24, 112, 0), PartPose.offset(0.0F, 31.0F, 4.0F) - ); - return LayerDefinition.create(meshDefinition, 256, 256); + public void extractRenderState(EnderDragon enderDragon, EnderDragonRenderState enderDragonRenderState, float f) { + super.extractRenderState(enderDragon, enderDragonRenderState, f); + enderDragonRenderState.flapTime = Mth.lerp(f, enderDragon.oFlapTime, enderDragon.flapTime); + enderDragonRenderState.deathTime = enderDragon.dragonDeathTime > 0 ? enderDragon.dragonDeathTime + f : 0.0F; + enderDragonRenderState.hasRedOverlay = enderDragon.hurtTime > 0; + EndCrystal endCrystal = enderDragon.nearestCrystal; + if (endCrystal != null) { + Vec3 vec3 = endCrystal.getPosition(f).add(0.0, EndCrystalRenderer.getY(endCrystal.time + f), 0.0); + enderDragonRenderState.beamOffset = vec3.subtract(enderDragon.getPosition(f)); + } else { + enderDragonRenderState.beamOffset = null; + } + + DragonPhaseInstance dragonPhaseInstance = enderDragon.getPhaseManager().getCurrentPhase(); + enderDragonRenderState.isLandingOrTakingOff = dragonPhaseInstance == EnderDragonPhase.LANDING || dragonPhaseInstance == EnderDragonPhase.TAKEOFF; + enderDragonRenderState.isSitting = dragonPhaseInstance.isSitting(); + BlockPos blockPos = enderDragon.level() + .getHeightmapPos(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, EndPodiumFeature.getLocation(enderDragon.getFightOrigin())); + enderDragonRenderState.distanceToEgg = blockPos.distToCenterSqr(enderDragon.position()); + enderDragonRenderState.partialTicks = enderDragon.isDeadOrDying() ? 0.0F : f; + enderDragonRenderState.flightHistory.copyFrom(enderDragon.flightHistory); } - @Environment(EnvType.CLIENT) - public static class DragonModel extends EntityModel { - private final ModelPart head; - private final ModelPart neck; - private final ModelPart jaw; - private final ModelPart body; - private final ModelPart leftWing; - private final ModelPart leftWingTip; - private final ModelPart leftFrontLeg; - private final ModelPart leftFrontLegTip; - private final ModelPart leftFrontFoot; - private final ModelPart leftRearLeg; - private final ModelPart leftRearLegTip; - private final ModelPart leftRearFoot; - private final ModelPart rightWing; - private final ModelPart rightWingTip; - private final ModelPart rightFrontLeg; - private final ModelPart rightFrontLegTip; - private final ModelPart rightFrontFoot; - private final ModelPart rightRearLeg; - private final ModelPart rightRearLegTip; - private final ModelPart rightRearFoot; - @Nullable - private EnderDragon entity; - private float a; - - public DragonModel(ModelPart root) { - this.head = root.getChild("head"); - this.jaw = this.head.getChild("jaw"); - this.neck = root.getChild("neck"); - this.body = root.getChild("body"); - this.leftWing = root.getChild("left_wing"); - this.leftWingTip = this.leftWing.getChild("left_wing_tip"); - this.leftFrontLeg = root.getChild("left_front_leg"); - this.leftFrontLegTip = this.leftFrontLeg.getChild("left_front_leg_tip"); - this.leftFrontFoot = this.leftFrontLegTip.getChild("left_front_foot"); - this.leftRearLeg = root.getChild("left_hind_leg"); - this.leftRearLegTip = this.leftRearLeg.getChild("left_hind_leg_tip"); - this.leftRearFoot = this.leftRearLegTip.getChild("left_hind_foot"); - this.rightWing = root.getChild("right_wing"); - this.rightWingTip = this.rightWing.getChild("right_wing_tip"); - this.rightFrontLeg = root.getChild("right_front_leg"); - this.rightFrontLegTip = this.rightFrontLeg.getChild("right_front_leg_tip"); - this.rightFrontFoot = this.rightFrontLegTip.getChild("right_front_foot"); - this.rightRearLeg = root.getChild("right_hind_leg"); - this.rightRearLegTip = this.rightRearLeg.getChild("right_hind_leg_tip"); - this.rightRearFoot = this.rightRearLegTip.getChild("right_hind_foot"); - } - - public void prepareMobModel(EnderDragon entity, float limbSwing, float limbSwingAmount, float partialTick) { - this.entity = entity; - this.a = partialTick; - } - - /** - * Sets this entity's model rotation angles - */ - public void setupAnim(EnderDragon entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { - } - - @Override - public void renderToBuffer(PoseStack poseStack, VertexConsumer buffer, int packedLight, int packedOverlay, int color) { - poseStack.pushPose(); - float f = Mth.lerp(this.a, this.entity.oFlapTime, this.entity.flapTime); - this.jaw.xRot = (float)(Math.sin(f * (float) (Math.PI * 2)) + 1.0) * 0.2F; - float g = (float)(Math.sin(f * (float) (Math.PI * 2) - 1.0F) + 1.0); - g = (g * g + g * 2.0F) * 0.05F; - poseStack.translate(0.0F, g - 2.0F, -3.0F); - poseStack.mulPose(Axis.XP.rotationDegrees(g * 2.0F)); - float h = 0.0F; - float i = 20.0F; - float j = -12.0F; - float k = 1.5F; - double[] ds = this.entity.getLatencyPos(6, this.a); - float l = Mth.wrapDegrees((float)(this.entity.getLatencyPos(5, this.a)[0] - this.entity.getLatencyPos(10, this.a)[0])); - float m = Mth.wrapDegrees((float)(this.entity.getLatencyPos(5, this.a)[0] + l / 2.0F)); - float n = f * (float) (Math.PI * 2); - - for (int o = 0; o < 5; o++) { - double[] es = this.entity.getLatencyPos(5 - o, this.a); - float p = (float)Math.cos(o * 0.45F + n) * 0.15F; - this.neck.yRot = Mth.wrapDegrees((float)(es[0] - ds[0])) * (float) (Math.PI / 180.0) * 1.5F; - this.neck.xRot = p + this.entity.getHeadPartYOffset(o, ds, es) * (float) (Math.PI / 180.0) * 1.5F * 5.0F; - this.neck.zRot = -Mth.wrapDegrees((float)(es[0] - m)) * (float) (Math.PI / 180.0) * 1.5F; - this.neck.y = i; - this.neck.z = j; - this.neck.x = h; - i += Mth.sin(this.neck.xRot) * 10.0F; - j -= Mth.cos(this.neck.yRot) * Mth.cos(this.neck.xRot) * 10.0F; - h -= Mth.sin(this.neck.yRot) * Mth.cos(this.neck.xRot) * 10.0F; - this.neck.render(poseStack, buffer, packedLight, packedOverlay, color); - } - - this.head.y = i; - this.head.z = j; - this.head.x = h; - double[] fs = this.entity.getLatencyPos(0, this.a); - this.head.yRot = Mth.wrapDegrees((float)(fs[0] - ds[0])) * (float) (Math.PI / 180.0); - this.head.xRot = Mth.wrapDegrees(this.entity.getHeadPartYOffset(6, ds, fs)) * (float) (Math.PI / 180.0) * 1.5F * 5.0F; - this.head.zRot = -Mth.wrapDegrees((float)(fs[0] - m)) * (float) (Math.PI / 180.0); - this.head.render(poseStack, buffer, packedLight, packedOverlay, color); - poseStack.pushPose(); - poseStack.translate(0.0F, 1.0F, 0.0F); - poseStack.mulPose(Axis.ZP.rotationDegrees(-l * 1.5F)); - poseStack.translate(0.0F, -1.0F, 0.0F); - this.body.zRot = 0.0F; - this.body.render(poseStack, buffer, packedLight, packedOverlay, color); - float q = f * (float) (Math.PI * 2); - this.leftWing.xRot = 0.125F - (float)Math.cos(q) * 0.2F; - this.leftWing.yRot = -0.25F; - this.leftWing.zRot = -((float)(Math.sin(q) + 0.125)) * 0.8F; - this.leftWingTip.zRot = (float)(Math.sin(q + 2.0F) + 0.5) * 0.75F; - this.rightWing.xRot = this.leftWing.xRot; - this.rightWing.yRot = -this.leftWing.yRot; - this.rightWing.zRot = -this.leftWing.zRot; - this.rightWingTip.zRot = -this.leftWingTip.zRot; - this.renderSide( - poseStack, - buffer, - packedLight, - packedOverlay, - g, - this.leftWing, - this.leftFrontLeg, - this.leftFrontLegTip, - this.leftFrontFoot, - this.leftRearLeg, - this.leftRearLegTip, - this.leftRearFoot, - color - ); - this.renderSide( - poseStack, - buffer, - packedLight, - packedOverlay, - g, - this.rightWing, - this.rightFrontLeg, - this.rightFrontLegTip, - this.rightFrontFoot, - this.rightRearLeg, - this.rightRearLegTip, - this.rightRearFoot, - color - ); - poseStack.popPose(); - float p = -Mth.sin(f * (float) (Math.PI * 2)) * 0.0F; - n = f * (float) (Math.PI * 2); - i = 10.0F; - j = 60.0F; - h = 0.0F; - ds = this.entity.getLatencyPos(11, this.a); - - for (int r = 0; r < 12; r++) { - fs = this.entity.getLatencyPos(12 + r, this.a); - p += Mth.sin(r * 0.45F + n) * 0.05F; - this.neck.yRot = (Mth.wrapDegrees((float)(fs[0] - ds[0])) * 1.5F + 180.0F) * (float) (Math.PI / 180.0); - this.neck.xRot = p + (float)(fs[1] - ds[1]) * (float) (Math.PI / 180.0) * 1.5F * 5.0F; - this.neck.zRot = Mth.wrapDegrees((float)(fs[0] - m)) * (float) (Math.PI / 180.0) * 1.5F; - this.neck.y = i; - this.neck.z = j; - this.neck.x = h; - i += Mth.sin(this.neck.xRot) * 10.0F; - j -= Mth.cos(this.neck.yRot) * Mth.cos(this.neck.xRot) * 10.0F; - h -= Mth.sin(this.neck.yRot) * Mth.cos(this.neck.xRot) * 10.0F; - this.neck.render(poseStack, buffer, packedLight, packedOverlay, color); - } - - poseStack.popPose(); - } - - private void renderSide( - PoseStack poseStack, - VertexConsumer buffer, - int packedLight, - int packedOverlay, - float rotation, - ModelPart wing, - ModelPart frontLeg, - ModelPart frontLegTip, - ModelPart frontFoot, - ModelPart rearLeg, - ModelPart rearLegTip, - ModelPart rearFoot, - int alpha - ) { - rearLeg.xRot = 1.0F + rotation * 0.1F; - rearLegTip.xRot = 0.5F + rotation * 0.1F; - rearFoot.xRot = 0.75F + rotation * 0.1F; - frontLeg.xRot = 1.3F + rotation * 0.1F; - frontLegTip.xRot = -0.5F - rotation * 0.1F; - frontFoot.xRot = 0.75F + rotation * 0.1F; - wing.render(poseStack, buffer, packedLight, packedOverlay, alpha); - frontLeg.render(poseStack, buffer, packedLight, packedOverlay, alpha); - rearLeg.render(poseStack, buffer, packedLight, packedOverlay, alpha); - } + protected boolean affectedByCulling(EnderDragon enderDragon) { + return false; } } diff --git a/net/minecraft/client/renderer/entity/EndermanRenderer.java b/net/minecraft/client/renderer/entity/EndermanRenderer.java index 080845c7..b59a8dfd 100644 --- a/net/minecraft/client/renderer/entity/EndermanRenderer.java +++ b/net/minecraft/client/renderer/entity/EndermanRenderer.java @@ -1,51 +1,50 @@ package net.minecraft.client.renderer.entity; -import com.mojang.blaze3d.vertex.PoseStack; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.model.EndermanModel; import net.minecraft.client.model.geom.ModelLayers; -import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.entity.layers.CarriedBlockLayer; import net.minecraft.client.renderer.entity.layers.EnderEyesLayer; +import net.minecraft.client.renderer.entity.state.EndermanRenderState; import net.minecraft.resources.ResourceLocation; import net.minecraft.util.RandomSource; import net.minecraft.world.entity.monster.EnderMan; -import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.Vec3; @Environment(EnvType.CLIENT) -public class EndermanRenderer extends MobRenderer> { +public class EndermanRenderer extends MobRenderer> { private static final ResourceLocation ENDERMAN_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/enderman/enderman.png"); private final RandomSource random = RandomSource.create(); public EndermanRenderer(EntityRendererProvider.Context context) { super(context, new EndermanModel<>(context.bakeLayer(ModelLayers.ENDERMAN)), 0.5F); - this.addLayer(new EnderEyesLayer<>(this)); + this.addLayer(new EnderEyesLayer(this)); this.addLayer(new CarriedBlockLayer(this, context.getBlockRenderDispatcher())); } - public void render(EnderMan entity, float entityYaw, float partialTicks, PoseStack poseStack, MultiBufferSource buffer, int packedLight) { - BlockState blockState = entity.getCarriedBlock(); - EndermanModel endermanModel = this.getModel(); - endermanModel.carrying = blockState != null; - endermanModel.creepy = entity.isCreepy(); - super.render(entity, entityYaw, partialTicks, poseStack, buffer, packedLight); - } - - public Vec3 getRenderOffset(EnderMan entity, float partialTicks) { - if (entity.isCreepy()) { - double d = 0.02 * entity.getScale(); - return new Vec3(this.random.nextGaussian() * d, 0.0, this.random.nextGaussian() * d); + public Vec3 getRenderOffset(EndermanRenderState endermanRenderState) { + Vec3 vec3 = super.getRenderOffset(endermanRenderState); + if (endermanRenderState.isCreepy) { + double d = 0.02 * endermanRenderState.scale; + return vec3.add(this.random.nextGaussian() * d, 0.0, this.random.nextGaussian() * d); } else { - return super.getRenderOffset(entity, partialTicks); + return vec3; } } - /** - * Returns the location of an entity's texture. - */ - public ResourceLocation getTextureLocation(EnderMan entity) { + public ResourceLocation getTextureLocation(EndermanRenderState endermanRenderState) { return ENDERMAN_LOCATION; } + + public EndermanRenderState createRenderState() { + return new EndermanRenderState(); + } + + public void extractRenderState(EnderMan enderMan, EndermanRenderState endermanRenderState, float f) { + super.extractRenderState(enderMan, endermanRenderState, f); + HumanoidMobRenderer.extractHumanoidRenderState(enderMan, endermanRenderState, f); + endermanRenderState.isCreepy = enderMan.isCreepy(); + endermanRenderState.carriedBlock = enderMan.getCarriedBlock(); + } } diff --git a/net/minecraft/client/renderer/entity/EndermiteRenderer.java b/net/minecraft/client/renderer/entity/EndermiteRenderer.java index 3bfe6b04..dcaa33ec 100644 --- a/net/minecraft/client/renderer/entity/EndermiteRenderer.java +++ b/net/minecraft/client/renderer/entity/EndermiteRenderer.java @@ -4,25 +4,29 @@ import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.model.EndermiteModel; import net.minecraft.client.model.geom.ModelLayers; +import net.minecraft.client.renderer.entity.state.LivingEntityRenderState; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.monster.Endermite; @Environment(EnvType.CLIENT) -public class EndermiteRenderer extends MobRenderer> { +public class EndermiteRenderer extends MobRenderer { private static final ResourceLocation ENDERMITE_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/endermite.png"); public EndermiteRenderer(EntityRendererProvider.Context context) { - super(context, new EndermiteModel<>(context.bakeLayer(ModelLayers.ENDERMITE)), 0.3F); + super(context, new EndermiteModel(context.bakeLayer(ModelLayers.ENDERMITE)), 0.3F); } - protected float getFlipDegrees(Endermite livingEntity) { + @Override + protected float getFlipDegrees() { return 180.0F; } - /** - * Returns the location of an entity's texture. - */ - public ResourceLocation getTextureLocation(Endermite entity) { + @Override + public ResourceLocation getTextureLocation(LivingEntityRenderState livingEntityRenderState) { return ENDERMITE_LOCATION; } + + public LivingEntityRenderState createRenderState() { + return new LivingEntityRenderState(); + } } diff --git a/net/minecraft/client/renderer/entity/EntityRenderDispatcher.java b/net/minecraft/client/renderer/entity/EntityRenderDispatcher.java index 7889dfc8..b32170a5 100644 --- a/net/minecraft/client/renderer/entity/EntityRenderDispatcher.java +++ b/net/minecraft/client/renderer/entity/EntityRenderDispatcher.java @@ -16,18 +16,21 @@ import net.minecraft.client.gui.Font; import net.minecraft.client.model.geom.EntityModelSet; import net.minecraft.client.player.AbstractClientPlayer; import net.minecraft.client.renderer.ItemInHandRenderer; -import net.minecraft.client.renderer.LevelRenderer; import net.minecraft.client.renderer.LightTexture; +import net.minecraft.client.renderer.MapRenderer; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.ShapeRenderer; import net.minecraft.client.renderer.Sheets; import net.minecraft.client.renderer.block.BlockRenderDispatcher; import net.minecraft.client.renderer.culling.Frustum; import net.minecraft.client.renderer.debug.DebugRenderer; +import net.minecraft.client.renderer.entity.state.EntityRenderState; import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.texture.TextureManager; -import net.minecraft.client.resources.PlayerSkin; +import net.minecraft.client.resources.PlayerSkin.Model; +import net.minecraft.client.resources.model.EquipmentModelSet; import net.minecraft.client.resources.model.ModelBakery; import net.minecraft.client.server.IntegratedServer; import net.minecraft.core.BlockPos; @@ -35,7 +38,7 @@ import net.minecraft.resources.ResourceLocation; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.packs.resources.ResourceManager; import net.minecraft.server.packs.resources.ResourceManagerReloadListener; -import net.minecraft.util.FastColor; +import net.minecraft.util.ARGB; import net.minecraft.util.Mth; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; @@ -60,22 +63,24 @@ public class EntityRenderDispatcher implements ResourceManagerReloadListener { private static final RenderType SHADOW_RENDER_TYPE = RenderType.entityShadow(ResourceLocation.withDefaultNamespace("textures/misc/shadow.png")); private static final float MAX_SHADOW_RADIUS = 32.0F; private static final float SHADOW_POWER_FALLOFF_Y = 0.5F; - private Map, EntityRenderer> renderers = ImmutableMap.of(); + private Map, EntityRenderer> renderers = ImmutableMap.of(); /** * lists the various player skin types with their associated Renderer class instances. */ - private Map> playerRenderers = Map.of(); + private Map> playerRenderers = Map.of(); public final TextureManager textureManager; private Level level; public Camera camera; private Quaternionf cameraOrientation; public Entity crosshairPickEntity; private final ItemRenderer itemRenderer; + private final MapRenderer mapRenderer; private final BlockRenderDispatcher blockRenderDispatcher; private final ItemInHandRenderer itemInHandRenderer; private final Font font; public final Options options; private final EntityModelSet entityModels; + private final EquipmentModelSet equipmentModels; private boolean shouldRenderShadow = true; private boolean renderHitBoxes; @@ -87,27 +92,31 @@ public class EntityRenderDispatcher implements ResourceManagerReloadListener { Minecraft minecraft, TextureManager textureManager, ItemRenderer itemRenderer, + MapRenderer mapRenderer, BlockRenderDispatcher blockRenderDispatcher, Font font, Options options, - EntityModelSet entityModels + EntityModelSet entityModelSet, + EquipmentModelSet equipmentModelSet ) { this.textureManager = textureManager; this.itemRenderer = itemRenderer; + this.mapRenderer = mapRenderer; this.itemInHandRenderer = new ItemInHandRenderer(minecraft, this, itemRenderer); this.blockRenderDispatcher = blockRenderDispatcher; this.font = font; this.options = options; - this.entityModels = entityModels; + this.entityModels = entityModelSet; + this.equipmentModels = equipmentModelSet; } - public EntityRenderer getRenderer(T entity) { + public EntityRenderer getRenderer(T entity) { if (entity instanceof AbstractClientPlayer abstractClientPlayer) { - PlayerSkin.Model model = abstractClientPlayer.getSkin().model(); - EntityRenderer entityRenderer = (EntityRenderer)this.playerRenderers.get(model); - return (EntityRenderer)(entityRenderer != null ? entityRenderer : (EntityRenderer)this.playerRenderers.get(PlayerSkin.Model.WIDE)); + Model model = abstractClientPlayer.getSkin().model(); + EntityRenderer entityRenderer = (EntityRenderer)this.playerRenderers.get(model); + return (EntityRenderer)(entityRenderer != null ? entityRenderer : (EntityRenderer)this.playerRenderers.get(Model.WIDE)); } else { - return (EntityRenderer)this.renderers.get(entity.getType()); + return (EntityRenderer)this.renderers.get(entity.getType()); } } @@ -135,41 +144,52 @@ public class EntityRenderDispatcher implements ResourceManagerReloadListener { } public boolean shouldRender(E entity, Frustum frustum, double camX, double camY, double camZ) { - EntityRenderer entityRenderer = this.getRenderer(entity); + EntityRenderer entityRenderer = this.getRenderer(entity); return entityRenderer.shouldRender(entity, frustum, camX, camY, camZ); } - public void render( - E entity, double x, double y, double z, float rotationYaw, float partialTicks, PoseStack poseStack, MultiBufferSource buffer, int packedLight - ) { - EntityRenderer entityRenderer = this.getRenderer(entity); + public void render(E entity, double d, double e, double f, float g, PoseStack poseStack, MultiBufferSource multiBufferSource, int i) { + EntityRenderer entityRenderer = this.getRenderer(entity); + this.render(entity, d, e, f, g, poseStack, multiBufferSource, i, entityRenderer); + } + private void render( + E entity, double d, double e, double f, float g, PoseStack poseStack, MultiBufferSource multiBufferSource, int i, EntityRenderer entityRenderer + ) { try { - Vec3 vec3 = entityRenderer.getRenderOffset(entity, partialTicks); - double d = x + vec3.x(); - double e = y + vec3.y(); - double f = z + vec3.z(); + S entityRenderState = entityRenderer.createRenderState(entity, g); + Vec3 vec3 = entityRenderer.getRenderOffset(entityRenderState); + double h = d + vec3.x(); + double j = e + vec3.y(); + double k = f + vec3.z(); poseStack.pushPose(); - poseStack.translate(d, e, f); - entityRenderer.render(entity, rotationYaw, partialTicks, poseStack, buffer, packedLight); - if (entity.displayFireAnimation()) { - this.renderFlame(poseStack, buffer, entity, Mth.rotationAroundAxis(Mth.Y_AXIS, this.cameraOrientation, new Quaternionf())); + poseStack.translate(h, j, k); + entityRenderer.render(entityRenderState, poseStack, multiBufferSource, i); + if (entityRenderState.displayFireAnimation) { + this.renderFlame(poseStack, multiBufferSource, entityRenderState, Mth.rotationAroundAxis(Mth.Y_AXIS, this.cameraOrientation, new Quaternionf())); } - poseStack.translate(-vec3.x(), -vec3.y(), -vec3.z()); - if (this.options.entityShadows().get() && this.shouldRenderShadow && !entity.isInvisible()) { - float g = entityRenderer.getShadowRadius(entity); - if (g > 0.0F) { - double h = this.distanceToSqr(entity.getX(), entity.getY(), entity.getZ()); - float i = (float)((1.0 - h / 256.0) * entityRenderer.shadowStrength); - if (i > 0.0F) { - renderShadow(poseStack, buffer, entity, i, partialTicks, this.level, Math.min(g, 32.0F)); + if (entity instanceof Player) { + poseStack.translate(-vec3.x(), -vec3.y(), -vec3.z()); + } + + if (this.options.entityShadows().get() && this.shouldRenderShadow && !entityRenderState.isInvisible) { + float l = entityRenderer.getShadowRadius(entityRenderState); + if (l > 0.0F) { + double m = entityRenderState.distanceToCameraSq; + float n = (float)((1.0 - m / 256.0) * entityRenderer.shadowStrength); + if (n > 0.0F) { + renderShadow(poseStack, multiBufferSource, entityRenderState, n, g, this.level, Math.min(l, 32.0F)); } } } - if (this.renderHitBoxes && !entity.isInvisible() && !Minecraft.getInstance().showOnlyReducedInfo()) { - renderHitbox(poseStack, buffer.getBuffer(RenderType.lines()), entity, partialTicks, 1.0F, 1.0F, 1.0F); + if (!(entity instanceof Player)) { + poseStack.translate(-vec3.x(), -vec3.y(), -vec3.z()); + } + + if (this.renderHitBoxes && !entityRenderState.isInvisible && !Minecraft.getInstance().showOnlyReducedInfo()) { + renderHitbox(poseStack, multiBufferSource.getBuffer(RenderType.lines()), entity, g, 1.0F, 1.0F, 1.0F); } poseStack.popPose(); @@ -179,9 +199,8 @@ public class EntityRenderDispatcher implements ResourceManagerReloadListener { entity.fillCrashReportCategory(crashReportCategory); CrashReportCategory crashReportCategory2 = crashReport.addCategory("Renderer details"); crashReportCategory2.setDetail("Assigned renderer", entityRenderer); - crashReportCategory2.setDetail("Location", CrashReportCategory.formatLocation(this.level, x, y, z)); - crashReportCategory2.setDetail("Rotation", rotationYaw); - crashReportCategory2.setDetail("Delta", partialTicks); + crashReportCategory2.setDetail("Location", CrashReportCategory.formatLocation(this.level, d, e, f)); + crashReportCategory2.setDetail("Delta", g); throw new ReportedException(crashReport); } } @@ -194,7 +213,7 @@ public class EntityRenderDispatcher implements ResourceManagerReloadListener { poseStack.pushPose(); poseStack.translate(entity2.getX() - entity.getX(), entity2.getY() - entity.getY(), entity2.getZ() - entity.getZ()); renderHitbox(poseStack, bufferSource.getBuffer(RenderType.lines()), entity2, 1.0F, 0.0F, 1.0F, 0.0F); - renderVector(poseStack, bufferSource.getBuffer(RenderType.lines()), new Vector3f(), entity2.getDeltaMovement(), -256); + ShapeRenderer.renderVector(poseStack, bufferSource.getBuffer(RenderType.lines()), new Vector3f(), entity2.getDeltaMovement(), -256); poseStack.popPose(); } } @@ -214,7 +233,7 @@ public class EntityRenderDispatcher implements ResourceManagerReloadListener { private static void renderHitbox(PoseStack poseStack, VertexConsumer buffer, Entity entity, float red, float green, float blue, float alpha) { AABB aABB = entity.getBoundingBox().move(-entity.getX(), -entity.getY(), -entity.getZ()); - LevelRenderer.renderLineBox(poseStack, buffer, aABB, green, blue, alpha, 1.0F); + ShapeRenderer.renderLineBox(poseStack, buffer, aABB, green, blue, alpha, 1.0F); if (entity instanceof EnderDragon) { double d = -Mth.lerp((double)red, entity.xOld, entity.getX()); double e = -Mth.lerp((double)red, entity.yOld, entity.getY()); @@ -226,7 +245,7 @@ public class EntityRenderDispatcher implements ResourceManagerReloadListener { double h = e + Mth.lerp((double)red, enderDragonPart.yOld, enderDragonPart.getY()); double i = f + Mth.lerp((double)red, enderDragonPart.zOld, enderDragonPart.getZ()); poseStack.translate(g, h, i); - LevelRenderer.renderLineBox( + ShapeRenderer.renderLineBox( poseStack, buffer, enderDragonPart.getBoundingBox().move(-enderDragonPart.getX(), -enderDragonPart.getY(), -enderDragonPart.getZ()), @@ -241,7 +260,7 @@ public class EntityRenderDispatcher implements ResourceManagerReloadListener { if (entity instanceof LivingEntity) { float j = 0.01F; - LevelRenderer.renderLineBox( + ShapeRenderer.renderLineBox( poseStack, buffer, aABB.minX, entity.getEyeHeight() - 0.01F, aABB.minZ, aABB.maxX, entity.getEyeHeight() + 0.01F, aABB.maxZ, 1.0F, 0.0F, 0.0F, 1.0F ); } @@ -251,35 +270,27 @@ public class EntityRenderDispatcher implements ResourceManagerReloadListener { float k = Math.min(entity2.getBbWidth(), entity.getBbWidth()) / 2.0F; float l = 0.0625F; Vec3 vec3 = entity2.getPassengerRidingPosition(entity).subtract(entity.position()); - LevelRenderer.renderLineBox(poseStack, buffer, vec3.x - k, vec3.y, vec3.z - k, vec3.x + k, vec3.y + 0.0625, vec3.z + k, 1.0F, 1.0F, 0.0F, 1.0F); + ShapeRenderer.renderLineBox(poseStack, buffer, vec3.x - k, vec3.y, vec3.z - k, vec3.x + k, vec3.y + 0.0625, vec3.z + k, 1.0F, 1.0F, 0.0F, 1.0F); } - renderVector(poseStack, buffer, new Vector3f(0.0F, entity.getEyeHeight(), 0.0F), entity.getViewVector(red).scale(2.0), -16776961); + ShapeRenderer.renderVector(poseStack, buffer, new Vector3f(0.0F, entity.getEyeHeight(), 0.0F), entity.getViewVector(red).scale(2.0), -16776961); } - private static void renderVector(PoseStack poseStack, VertexConsumer buffer, Vector3f startPos, Vec3 vector, int color) { - PoseStack.Pose pose = poseStack.last(); - buffer.addVertex(pose, startPos).setColor(color).setNormal(pose, (float)vector.x, (float)vector.y, (float)vector.z); - buffer.addVertex(pose, (float)(startPos.x() + vector.x), (float)(startPos.y() + vector.y), (float)(startPos.z() + vector.z)) - .setColor(color) - .setNormal(pose, (float)vector.x, (float)vector.y, (float)vector.z); - } - - private void renderFlame(PoseStack poseStack, MultiBufferSource buffer, Entity entity, Quaternionf quaternion) { + private void renderFlame(PoseStack poseStack, MultiBufferSource multiBufferSource, EntityRenderState entityRenderState, Quaternionf quaternionf) { TextureAtlasSprite textureAtlasSprite = ModelBakery.FIRE_0.sprite(); TextureAtlasSprite textureAtlasSprite2 = ModelBakery.FIRE_1.sprite(); poseStack.pushPose(); - float f = entity.getBbWidth() * 1.4F; + float f = entityRenderState.boundingBoxWidth * 1.4F; poseStack.scale(f, f, f); float g = 0.5F; float h = 0.0F; - float i = entity.getBbHeight() / f; + float i = entityRenderState.boundingBoxHeight / f; float j = 0.0F; - poseStack.mulPose(quaternion); + poseStack.mulPose(quaternionf); poseStack.translate(0.0F, 0.0F, 0.3F - (int)i * 0.02F); float k = 0.0F; int l = 0; - VertexConsumer vertexConsumer = buffer.getBuffer(Sheets.cutoutBlockSheet()); + VertexConsumer vertexConsumer = multiBufferSource.getBuffer(Sheets.cutoutBlockSheet()); for (PoseStack.Pose pose = poseStack.last(); i > 0.0F; l++) { TextureAtlasSprite textureAtlasSprite3 = l % 2 == 0 ? textureAtlasSprite : textureAtlasSprite2; @@ -310,30 +321,29 @@ public class EntityRenderDispatcher implements ResourceManagerReloadListener { buffer.addVertex(matrixEntry, x, y, z).setColor(-1).setUv(texU, texV).setUv1(0, 10).setLight(240).setNormal(matrixEntry, 0.0F, 1.0F, 0.0F); } - private static void renderShadow(PoseStack poseStack, MultiBufferSource buffer, Entity entity, float weight, float partialTicks, LevelReader level, float size) { - double d = Mth.lerp((double)partialTicks, entity.xOld, entity.getX()); - double e = Mth.lerp((double)partialTicks, entity.yOld, entity.getY()); - double f = Mth.lerp((double)partialTicks, entity.zOld, entity.getZ()); - float g = Math.min(weight / 0.5F, size); - int i = Mth.floor(d - size); - int j = Mth.floor(d + size); - int k = Mth.floor(e - g); - int l = Mth.floor(e); - int m = Mth.floor(f - size); - int n = Mth.floor(f + size); + private static void renderShadow( + PoseStack poseStack, MultiBufferSource multiBufferSource, EntityRenderState entityRenderState, float f, float g, LevelReader levelReader, float h + ) { + float i = Math.min(f / 0.5F, h); + int j = Mth.floor(entityRenderState.x - h); + int k = Mth.floor(entityRenderState.x + h); + int l = Mth.floor(entityRenderState.y - i); + int m = Mth.floor(entityRenderState.y); + int n = Mth.floor(entityRenderState.z - h); + int o = Mth.floor(entityRenderState.z + h); PoseStack.Pose pose = poseStack.last(); - VertexConsumer vertexConsumer = buffer.getBuffer(SHADOW_RENDER_TYPE); + VertexConsumer vertexConsumer = multiBufferSource.getBuffer(SHADOW_RENDER_TYPE); BlockPos.MutableBlockPos mutableBlockPos = new BlockPos.MutableBlockPos(); - for (int o = m; o <= n; o++) { - for (int p = i; p <= j; p++) { - mutableBlockPos.set(p, 0, o); - ChunkAccess chunkAccess = level.getChunk(mutableBlockPos); + for (int p = n; p <= o; p++) { + for (int q = j; q <= k; q++) { + mutableBlockPos.set(q, 0, p); + ChunkAccess chunkAccess = levelReader.getChunk(mutableBlockPos); - for (int q = k; q <= l; q++) { - mutableBlockPos.setY(q); - float h = weight - (float)(e - mutableBlockPos.getY()) * 0.5F; - renderBlockShadow(pose, vertexConsumer, chunkAccess, level, mutableBlockPos, d, e, f, size, h); + for (int r = l; r <= m; r++) { + mutableBlockPos.setY(r); + float s = f - (float)(entityRenderState.y - mutableBlockPos.getY()) * 0.5F; + renderBlockShadow(pose, vertexConsumer, chunkAccess, levelReader, mutableBlockPos, entityRenderState.x, entityRenderState.y, entityRenderState.z, h, s); } } } @@ -364,7 +374,7 @@ public class EntityRenderDispatcher implements ResourceManagerReloadListener { g = 1.0F; } - int i = FastColor.ARGB32.color(Mth.floor(g * 255.0F), 255, 255, 255); + int i = ARGB.color(Mth.floor(g * 255.0F), 255, 255, 255); AABB aABB = voxelShape.bounds(); double d = pos.getX() + aABB.minX; double e = pos.getX() + aABB.maxX; @@ -424,7 +434,7 @@ public class EntityRenderDispatcher implements ResourceManagerReloadListener { @Override public void onResourceManagerReload(ResourceManager resourceManager) { EntityRendererProvider.Context context = new EntityRendererProvider.Context( - this, this.itemRenderer, this.blockRenderDispatcher, this.itemInHandRenderer, resourceManager, this.entityModels, this.font + this, this.itemRenderer, this.mapRenderer, this.blockRenderDispatcher, resourceManager, this.entityModels, this.equipmentModels, this.font ); this.renderers = EntityRenderers.createEntityRenderers(context); this.playerRenderers = EntityRenderers.createPlayerRenderers(context); diff --git a/net/minecraft/client/renderer/entity/EntityRenderer.java b/net/minecraft/client/renderer/entity/EntityRenderer.java index f5554764..ad5fd913 100644 --- a/net/minecraft/client/renderer/entity/EntityRenderer.java +++ b/net/minecraft/client/renderer/entity/EntityRenderer.java @@ -10,26 +10,30 @@ import net.minecraft.client.renderer.LightTexture; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.culling.Frustum; +import net.minecraft.client.renderer.entity.state.EntityRenderState; import net.minecraft.core.BlockPos; import net.minecraft.network.chat.Component; -import net.minecraft.resources.ResourceLocation; import net.minecraft.util.Mth; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityAttachment; import net.minecraft.world.entity.Leashable; +import net.minecraft.world.entity.vehicle.AbstractMinecart; +import net.minecraft.world.entity.vehicle.NewMinecartBehavior; import net.minecraft.world.level.LightLayer; import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.Vec3; +import org.jetbrains.annotations.Nullable; import org.joml.Matrix4f; @Environment(EnvType.CLIENT) -public abstract class EntityRenderer { +public abstract class EntityRenderer { protected static final float NAMETAG_SCALE = 0.025F; public static final int LEASH_RENDER_STEPS = 24; protected final EntityRenderDispatcher entityRenderDispatcher; private final Font font; protected float shadowRadius; protected float shadowStrength = 1.0F; + private final S reusedState = this.createRenderState(); protected EntityRenderer(EntityRendererProvider.Context context) { this.entityRenderDispatcher = context.getEntityRenderDispatcher(); @@ -52,10 +56,10 @@ public abstract class EntityRenderer { public boolean shouldRender(T livingEntity, Frustum camera, double camX, double camY, double camZ) { if (!livingEntity.shouldRender(camX, camY, camZ)) { return false; - } else if (livingEntity.noCulling) { + } else if (!this.affectedByCulling(livingEntity)) { return true; } else { - AABB aABB = livingEntity.getBoundingBoxForCulling().inflate(0.5); + AABB aABB = this.getBoundingBoxForCulling(livingEntity).inflate(0.5); if (aABB.hasNaN() || aABB.getSize() == 0.0) { aABB = new AABB( livingEntity.getX() - 2.0, @@ -73,7 +77,7 @@ public abstract class EntityRenderer { if (livingEntity instanceof Leashable leashable) { Entity entity = leashable.getLeashHolder(); if (entity != null) { - return camera.isVisible(entity.getBoundingBoxForCulling()); + return camera.isVisible(this.entityRenderDispatcher.getRenderer(entity).getBoundingBoxForCulling(entity)); } } @@ -82,56 +86,80 @@ public abstract class EntityRenderer { } } - public Vec3 getRenderOffset(T entity, float partialTicks) { - return Vec3.ZERO; + protected AABB getBoundingBoxForCulling(T entity) { + return entity.getBoundingBox(); } - public void render(T entity, float entityYaw, float partialTick, PoseStack poseStack, MultiBufferSource bufferSource, int packedLight) { - if (entity instanceof Leashable leashable) { - Entity entity2 = leashable.getLeashHolder(); - if (entity2 != null) { - this.renderLeash(entity, partialTick, poseStack, bufferSource, entity2); - } + protected boolean affectedByCulling(T entity) { + return true; + } + + public Vec3 getRenderOffset(S entityRenderState) { + return entityRenderState.passengerOffset != null ? entityRenderState.passengerOffset : Vec3.ZERO; + } + + public void render(S entityRenderState, PoseStack poseStack, MultiBufferSource multiBufferSource, int i) { + EntityRenderState.LeashState leashState = entityRenderState.leashState; + if (leashState != null) { + renderLeash(poseStack, multiBufferSource, leashState); } - if (this.shouldShowName(entity)) { - this.renderNameTag(entity, entity.getDisplayName(), poseStack, bufferSource, packedLight, partialTick); + if (entityRenderState.nameTag != null) { + this.renderNameTag(entityRenderState, entityRenderState.nameTag, poseStack, multiBufferSource, i); } } - private void renderLeash(T entity, float partialTick, PoseStack poseStack, MultiBufferSource bufferSource, E leashHolder) { + private static void renderLeash(PoseStack poseStack, MultiBufferSource multiBufferSource, EntityRenderState.LeashState leashState) { + float f = 0.025F; + float g = (float)(leashState.end.x - leashState.start.x); + float h = (float)(leashState.end.y - leashState.start.y); + float i = (float)(leashState.end.z - leashState.start.z); + float j = Mth.invSqrt(g * g + i * i) * 0.025F / 2.0F; + float k = i * j; + float l = g * j; poseStack.pushPose(); - Vec3 vec3 = leashHolder.getRopeHoldPosition(partialTick); - double d = entity.getPreciseBodyRotation(partialTick) * (float) (Math.PI / 180.0) + (Math.PI / 2); - Vec3 vec32 = entity.getLeashOffset(partialTick); - double e = Math.cos(d) * vec32.z + Math.sin(d) * vec32.x; - double f = Math.sin(d) * vec32.z - Math.cos(d) * vec32.x; - double g = Mth.lerp((double)partialTick, entity.xo, entity.getX()) + e; - double h = Mth.lerp((double)partialTick, entity.yo, entity.getY()) + vec32.y; - double i = Mth.lerp((double)partialTick, entity.zo, entity.getZ()) + f; - poseStack.translate(e, vec32.y, f); - float j = (float)(vec3.x - g); - float k = (float)(vec3.y - h); - float l = (float)(vec3.z - i); - float m = 0.025F; - VertexConsumer vertexConsumer = bufferSource.getBuffer(RenderType.leash()); + poseStack.translate(leashState.offset); + VertexConsumer vertexConsumer = multiBufferSource.getBuffer(RenderType.leash()); Matrix4f matrix4f = poseStack.last().pose(); - float n = Mth.invSqrt(j * j + l * l) * 0.025F / 2.0F; - float o = l * n; - float p = j * n; - BlockPos blockPos = BlockPos.containing(entity.getEyePosition(partialTick)); - BlockPos blockPos2 = BlockPos.containing(leashHolder.getEyePosition(partialTick)); - int q = this.getBlockLightLevel(entity, blockPos); - int r = this.entityRenderDispatcher.getRenderer(leashHolder).getBlockLightLevel(leashHolder, blockPos2); - int s = entity.level().getBrightness(LightLayer.SKY, blockPos); - int t = entity.level().getBrightness(LightLayer.SKY, blockPos2); - for (int u = 0; u <= 24; u++) { - addVertexPair(vertexConsumer, matrix4f, j, k, l, q, r, s, t, 0.025F, 0.025F, o, p, u, false); + for (int m = 0; m <= 24; m++) { + addVertexPair( + vertexConsumer, + matrix4f, + g, + h, + i, + leashState.startBlockLight, + leashState.endBlockLight, + leashState.startSkyLight, + leashState.endSkyLight, + 0.025F, + 0.025F, + k, + l, + m, + false + ); } - for (int u = 24; u >= 0; u--) { - addVertexPair(vertexConsumer, matrix4f, j, k, l, q, r, s, t, 0.025F, 0.0F, o, p, u, true); + for (int m = 24; m >= 0; m--) { + addVertexPair( + vertexConsumer, + matrix4f, + g, + h, + i, + leashState.startBlockLight, + leashState.endBlockLight, + leashState.startSkyLight, + leashState.endSkyLight, + 0.025F, + 0.0F, + k, + l, + m, + true + ); } poseStack.popPose(); @@ -169,15 +197,10 @@ public abstract class EntityRenderer { buffer.addVertex(pose, n + dx, o + yOffset - dy, p - dz).setColor(h, l, m, 1.0F).setLight(k); } - protected boolean shouldShowName(T entity) { + protected boolean shouldShowName(T entity, double d) { return entity.shouldShowName() || entity.hasCustomName() && entity == this.entityRenderDispatcher.crosshairPickEntity; } - /** - * Returns the location of an entity's texture. - */ - public abstract ResourceLocation getTextureLocation(T entity); - /** * Returns the font renderer from the set render manager */ @@ -185,35 +208,98 @@ public abstract class EntityRenderer { return this.font; } - protected void renderNameTag(T entity, Component displayName, PoseStack poseStack, MultiBufferSource bufferSource, int packedLight, float partialTick) { - double d = this.entityRenderDispatcher.distanceToSqr(entity); - if (!(d > 4096.0)) { - Vec3 vec3 = entity.getAttachments().getNullable(EntityAttachment.NAME_TAG, 0, entity.getViewYRot(partialTick)); - if (vec3 != null) { - boolean bl = !entity.isDiscrete(); - int i = "deadmau5".equals(displayName.getString()) ? -10 : 0; - poseStack.pushPose(); - poseStack.translate(vec3.x, vec3.y + 0.5, vec3.z); - poseStack.mulPose(this.entityRenderDispatcher.cameraOrientation()); - poseStack.scale(0.025F, -0.025F, 0.025F); - Matrix4f matrix4f = poseStack.last().pose(); - float f = Minecraft.getInstance().options.getBackgroundOpacity(0.25F); - int j = (int)(f * 255.0F) << 24; - Font font = this.getFont(); - float g = -font.width(displayName) / 2; - font.drawInBatch( - displayName, g, (float)i, 553648127, false, matrix4f, bufferSource, bl ? Font.DisplayMode.SEE_THROUGH : Font.DisplayMode.NORMAL, j, packedLight - ); - if (bl) { - font.drawInBatch(displayName, g, (float)i, -1, false, matrix4f, bufferSource, Font.DisplayMode.NORMAL, 0, packedLight); - } - - poseStack.popPose(); + protected void renderNameTag(S entityRenderState, Component component, PoseStack poseStack, MultiBufferSource multiBufferSource, int i) { + Vec3 vec3 = entityRenderState.nameTagAttachment; + if (vec3 != null) { + boolean bl = !entityRenderState.isDiscrete; + int j = "deadmau5".equals(component.getString()) ? -10 : 0; + poseStack.pushPose(); + poseStack.translate(vec3.x, vec3.y + 0.5, vec3.z); + poseStack.mulPose(this.entityRenderDispatcher.cameraOrientation()); + poseStack.scale(0.025F, -0.025F, 0.025F); + Matrix4f matrix4f = poseStack.last().pose(); + Font font = this.getFont(); + float f = -font.width(component) / 2.0F; + int k = (int)(Minecraft.getInstance().options.getBackgroundOpacity(0.25F) * 255.0F) << 24; + font.drawInBatch(component, f, (float)j, -2130706433, false, matrix4f, multiBufferSource, bl ? Font.DisplayMode.SEE_THROUGH : Font.DisplayMode.NORMAL, k, i); + if (bl) { + font.drawInBatch(component, f, (float)j, -1, false, matrix4f, multiBufferSource, Font.DisplayMode.NORMAL, 0, LightTexture.lightCoordsWithEmission(i, 2)); } + + poseStack.popPose(); } } - protected float getShadowRadius(T entity) { + @Nullable + protected Component getNameTag(T entity) { + return entity.getDisplayName(); + } + + protected float getShadowRadius(S entityRenderState) { return this.shadowRadius; } + + public abstract S createRenderState(); + + public final S createRenderState(T entity, float f) { + S entityRenderState = this.reusedState; + this.extractRenderState(entity, entityRenderState, f); + return entityRenderState; + } + + public void extractRenderState(T entity, S entityRenderState, float f) { + entityRenderState.x = Mth.lerp((double)f, entity.xOld, entity.getX()); + entityRenderState.y = Mth.lerp((double)f, entity.yOld, entity.getY()); + entityRenderState.z = Mth.lerp((double)f, entity.zOld, entity.getZ()); + entityRenderState.isInvisible = entity.isInvisible(); + entityRenderState.ageInTicks = entity.tickCount + f; + entityRenderState.boundingBoxWidth = entity.getBbWidth(); + entityRenderState.boundingBoxHeight = entity.getBbHeight(); + entityRenderState.eyeHeight = entity.getEyeHeight(); + if (entity.isPassenger() + && entity.getVehicle() instanceof AbstractMinecart abstractMinecart + && abstractMinecart.getBehavior() instanceof NewMinecartBehavior newMinecartBehavior + && newMinecartBehavior.cartHasPosRotLerp()) { + double d = Mth.lerp((double)f, abstractMinecart.xOld, abstractMinecart.getX()); + double e = Mth.lerp((double)f, abstractMinecart.yOld, abstractMinecart.getY()); + double g = Mth.lerp((double)f, abstractMinecart.zOld, abstractMinecart.getZ()); + entityRenderState.passengerOffset = newMinecartBehavior.getCartLerpPosition(f).subtract(new Vec3(d, e, g)); + } else { + entityRenderState.passengerOffset = null; + } + + entityRenderState.distanceToCameraSq = this.entityRenderDispatcher.distanceToSqr(entity); + boolean bl = entityRenderState.distanceToCameraSq < 4096.0 && this.shouldShowName(entity, entityRenderState.distanceToCameraSq); + if (bl) { + entityRenderState.nameTag = this.getNameTag(entity); + entityRenderState.nameTagAttachment = entity.getAttachments().getNullable(EntityAttachment.NAME_TAG, 0, entity.getYRot(f)); + } else { + entityRenderState.nameTag = null; + } + + entityRenderState.isDiscrete = entity.isDiscrete(); + Entity entity2 = entity instanceof Leashable leashable ? leashable.getLeashHolder() : null; + if (entity2 != null) { + float h = entity.getPreciseBodyRotation(f) * (float) (Math.PI / 180.0); + Vec3 vec3 = entity.getLeashOffset(f).yRot(-h); + BlockPos blockPos = BlockPos.containing(entity.getEyePosition(f)); + BlockPos blockPos2 = BlockPos.containing(entity2.getEyePosition(f)); + if (entityRenderState.leashState == null) { + entityRenderState.leashState = new EntityRenderState.LeashState(); + } + + EntityRenderState.LeashState leashState = entityRenderState.leashState; + leashState.offset = vec3; + leashState.start = entity.getPosition(f).add(vec3); + leashState.end = entity2.getRopeHoldPosition(f); + leashState.startBlockLight = this.getBlockLightLevel(entity, blockPos); + leashState.endBlockLight = this.entityRenderDispatcher.getRenderer(entity2).getBlockLightLevel(entity2, blockPos2); + leashState.startSkyLight = entity.level().getBrightness(LightLayer.SKY, blockPos); + leashState.endSkyLight = entity.level().getBrightness(LightLayer.SKY, blockPos2); + } else { + entityRenderState.leashState = null; + } + + entityRenderState.displayFireAnimation = entity.displayFireAnimation(); + } } diff --git a/net/minecraft/client/renderer/entity/EntityRendererProvider.java b/net/minecraft/client/renderer/entity/EntityRendererProvider.java index 12f7c81b..22c01ebc 100644 --- a/net/minecraft/client/renderer/entity/EntityRendererProvider.java +++ b/net/minecraft/client/renderer/entity/EntityRendererProvider.java @@ -6,8 +6,11 @@ import net.minecraft.client.gui.Font; import net.minecraft.client.model.geom.EntityModelSet; import net.minecraft.client.model.geom.ModelLayerLocation; import net.minecraft.client.model.geom.ModelPart; -import net.minecraft.client.renderer.ItemInHandRenderer; +import net.minecraft.client.renderer.MapRenderer; +import net.minecraft.client.renderer.Sheets; import net.minecraft.client.renderer.block.BlockRenderDispatcher; +import net.minecraft.client.renderer.entity.layers.EquipmentLayerRenderer; +import net.minecraft.client.resources.model.EquipmentModelSet; import net.minecraft.client.resources.model.ModelManager; import net.minecraft.server.packs.resources.ResourceManager; import net.minecraft.world.entity.Entity; @@ -15,34 +18,39 @@ import net.minecraft.world.entity.Entity; @FunctionalInterface @Environment(EnvType.CLIENT) public interface EntityRendererProvider { - EntityRenderer create(EntityRendererProvider.Context context); + EntityRenderer create(EntityRendererProvider.Context context); @Environment(EnvType.CLIENT) public static class Context { private final EntityRenderDispatcher entityRenderDispatcher; private final ItemRenderer itemRenderer; + private final MapRenderer mapRenderer; private final BlockRenderDispatcher blockRenderDispatcher; - private final ItemInHandRenderer itemInHandRenderer; private final ResourceManager resourceManager; private final EntityModelSet modelSet; + private final EquipmentModelSet equipmentModels; private final Font font; + private final EquipmentLayerRenderer equipmentRenderer; public Context( EntityRenderDispatcher entityRenderDispatcher, ItemRenderer itemRenderer, + MapRenderer mapRenderer, BlockRenderDispatcher blockRenderDispatcher, - ItemInHandRenderer itemInHandRenderer, ResourceManager resourceManager, - EntityModelSet modelSet, + EntityModelSet entityModelSet, + EquipmentModelSet equipmentModelSet, Font font ) { this.entityRenderDispatcher = entityRenderDispatcher; this.itemRenderer = itemRenderer; + this.mapRenderer = mapRenderer; this.blockRenderDispatcher = blockRenderDispatcher; - this.itemInHandRenderer = itemInHandRenderer; this.resourceManager = resourceManager; - this.modelSet = modelSet; + this.modelSet = entityModelSet; + this.equipmentModels = equipmentModelSet; this.font = font; + this.equipmentRenderer = new EquipmentLayerRenderer(equipmentModelSet, this.getModelManager().getAtlas(Sheets.ARMOR_TRIMS_SHEET)); } public EntityRenderDispatcher getEntityRenderDispatcher() { @@ -53,12 +61,12 @@ public interface EntityRendererProvider { return this.itemRenderer; } - public BlockRenderDispatcher getBlockRenderDispatcher() { - return this.blockRenderDispatcher; + public MapRenderer getMapRenderer() { + return this.mapRenderer; } - public ItemInHandRenderer getItemInHandRenderer() { - return this.itemInHandRenderer; + public BlockRenderDispatcher getBlockRenderDispatcher() { + return this.blockRenderDispatcher; } public ResourceManager getResourceManager() { @@ -69,6 +77,14 @@ public interface EntityRendererProvider { return this.modelSet; } + public EquipmentModelSet getEquipmentModels() { + return this.equipmentModels; + } + + public EquipmentLayerRenderer getEquipmentRenderer() { + return this.equipmentRenderer; + } + public ModelManager getModelManager() { return this.blockRenderDispatcher.getBlockModelShaper().getModelManager(); } diff --git a/net/minecraft/client/renderer/entity/EntityRenderers.java b/net/minecraft/client/renderer/entity/EntityRenderers.java index a908df7f..cc87bd42 100644 --- a/net/minecraft/client/renderer/entity/EntityRenderers.java +++ b/net/minecraft/client/renderer/entity/EntityRenderers.java @@ -11,7 +11,7 @@ import net.minecraft.client.model.SquidModel; import net.minecraft.client.model.geom.ModelLayers; import net.minecraft.client.player.AbstractClientPlayer; import net.minecraft.client.renderer.entity.player.PlayerRenderer; -import net.minecraft.client.resources.PlayerSkin; +import net.minecraft.client.resources.PlayerSkin.Model; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; @@ -22,10 +22,10 @@ import org.slf4j.Logger; public class EntityRenderers { private static final Logger LOGGER = LogUtils.getLogger(); private static final Map, EntityRendererProvider> PROVIDERS = new Object2ObjectOpenHashMap<>(); - private static final Map> PLAYER_PROVIDERS = Map.of( - PlayerSkin.Model.WIDE, + private static final Map> PLAYER_PROVIDERS = Map.of( + Model.WIDE, (EntityRendererProvider<>)context -> new PlayerRenderer(context, false), - PlayerSkin.Model.SLIM, + Model.SLIM, (EntityRendererProvider<>)context -> new PlayerRenderer(context, true) ); @@ -33,8 +33,8 @@ public class EntityRenderers { PROVIDERS.put(entityType, provider); } - public static Map, EntityRenderer> createEntityRenderers(EntityRendererProvider.Context context) { - Builder, EntityRenderer> builder = ImmutableMap.builder(); + public static Map, EntityRenderer> createEntityRenderers(EntityRendererProvider.Context context) { + Builder, EntityRenderer> builder = ImmutableMap.builder(); PROVIDERS.forEach((entityType, entityRendererProvider) -> { try { builder.put(entityType, entityRendererProvider.create(context)); @@ -45,8 +45,8 @@ public class EntityRenderers { return builder.build(); } - public static Map> createPlayerRenderers(EntityRendererProvider.Context context) { - Builder> builder = ImmutableMap.builder(); + public static Map> createPlayerRenderers(EntityRendererProvider.Context context) { + Builder> builder = ImmutableMap.builder(); PLAYER_PROVIDERS.forEach((model, entityRendererProvider) -> { try { builder.put(model, entityRendererProvider.create(context)); @@ -81,22 +81,42 @@ public class EntityRenderers { register(EntityType.BEE, BeeRenderer::new); register(EntityType.BLAZE, BlazeRenderer::new); register(EntityType.BLOCK_DISPLAY, DisplayRenderer.BlockDisplayRenderer::new); - register(EntityType.BOAT, context -> new BoatRenderer(context, false)); + register(EntityType.OAK_BOAT, context -> new BoatRenderer(context, ModelLayers.OAK_BOAT)); + register(EntityType.SPRUCE_BOAT, context -> new BoatRenderer(context, ModelLayers.SPRUCE_BOAT)); + register(EntityType.BIRCH_BOAT, context -> new BoatRenderer(context, ModelLayers.BIRCH_BOAT)); + register(EntityType.JUNGLE_BOAT, context -> new BoatRenderer(context, ModelLayers.JUNGLE_BOAT)); + register(EntityType.ACACIA_BOAT, context -> new BoatRenderer(context, ModelLayers.ACACIA_BOAT)); + register(EntityType.CHERRY_BOAT, context -> new BoatRenderer(context, ModelLayers.CHERRY_BOAT)); + register(EntityType.DARK_OAK_BOAT, context -> new BoatRenderer(context, ModelLayers.DARK_OAK_BOAT)); + register(EntityType.PALE_OAK_BOAT, context -> new BoatRenderer(context, ModelLayers.PALE_OAK_BOAT)); + register(EntityType.MANGROVE_BOAT, context -> new BoatRenderer(context, ModelLayers.MANGROVE_BOAT)); + register(EntityType.BAMBOO_RAFT, context -> new RaftRenderer(context, ModelLayers.BAMBOO_RAFT)); register(EntityType.BOGGED, BoggedRenderer::new); register(EntityType.BREEZE, BreezeRenderer::new); register(EntityType.BREEZE_WIND_CHARGE, WindChargeRenderer::new); register(EntityType.CAT, CatRenderer::new); - register(EntityType.CAMEL, context -> new CamelRenderer(context, ModelLayers.CAMEL)); + register(EntityType.CAMEL, CamelRenderer::new); register(EntityType.CAVE_SPIDER, CaveSpiderRenderer::new); - register(EntityType.CHEST_BOAT, context -> new BoatRenderer(context, true)); - register(EntityType.CHEST_MINECART, context -> new MinecartRenderer<>(context, ModelLayers.CHEST_MINECART)); + register(EntityType.OAK_CHEST_BOAT, context -> new BoatRenderer(context, ModelLayers.OAK_CHEST_BOAT)); + register(EntityType.SPRUCE_CHEST_BOAT, context -> new BoatRenderer(context, ModelLayers.SPRUCE_CHEST_BOAT)); + register(EntityType.BIRCH_CHEST_BOAT, context -> new BoatRenderer(context, ModelLayers.BIRCH_CHEST_BOAT)); + register(EntityType.JUNGLE_CHEST_BOAT, context -> new BoatRenderer(context, ModelLayers.JUNGLE_CHEST_BOAT)); + register(EntityType.ACACIA_CHEST_BOAT, context -> new BoatRenderer(context, ModelLayers.ACACIA_CHEST_BOAT)); + register(EntityType.CHERRY_CHEST_BOAT, context -> new BoatRenderer(context, ModelLayers.CHERRY_CHEST_BOAT)); + register(EntityType.DARK_OAK_CHEST_BOAT, context -> new BoatRenderer(context, ModelLayers.DARK_OAK_CHEST_BOAT)); + register(EntityType.PALE_OAK_CHEST_BOAT, context -> new BoatRenderer(context, ModelLayers.PALE_OAK_CHEST_BOAT)); + register(EntityType.MANGROVE_CHEST_BOAT, context -> new BoatRenderer(context, ModelLayers.MANGROVE_CHEST_BOAT)); + register(EntityType.BAMBOO_CHEST_RAFT, context -> new RaftRenderer(context, ModelLayers.BAMBOO_CHEST_RAFT)); + register(EntityType.CHEST_MINECART, context -> new MinecartRenderer(context, ModelLayers.CHEST_MINECART)); register(EntityType.CHICKEN, ChickenRenderer::new); register(EntityType.COD, CodRenderer::new); - register(EntityType.COMMAND_BLOCK_MINECART, context -> new MinecartRenderer<>(context, ModelLayers.COMMAND_BLOCK_MINECART)); + register(EntityType.COMMAND_BLOCK_MINECART, context -> new MinecartRenderer(context, ModelLayers.COMMAND_BLOCK_MINECART)); register(EntityType.COW, CowRenderer::new); + register(EntityType.CREAKING, CreakingRenderer::new); + register(EntityType.CREAKING_TRANSIENT, CreakingRenderer::new); register(EntityType.CREEPER, CreeperRenderer::new); register(EntityType.DOLPHIN, DolphinRenderer::new); - register(EntityType.DONKEY, context -> new ChestedHorseRenderer<>(context, 0.87F, ModelLayers.DONKEY)); + register(EntityType.DONKEY, context -> new DonkeyRenderer<>(context, 0.87F, ModelLayers.DONKEY, ModelLayers.DONKEY_BABY, false)); register(EntityType.DRAGON_FIREBALL, DragonFireballRenderer::new); register(EntityType.DROWNED, DrownedRenderer::new); register(EntityType.EGG, ThrownItemRenderer::new); @@ -117,15 +137,20 @@ public class EntityRenderers { register(EntityType.FISHING_BOBBER, FishingHookRenderer::new); register(EntityType.FOX, FoxRenderer::new); register(EntityType.FROG, FrogRenderer::new); - register(EntityType.FURNACE_MINECART, context -> new MinecartRenderer<>(context, ModelLayers.FURNACE_MINECART)); + register(EntityType.FURNACE_MINECART, context -> new MinecartRenderer(context, ModelLayers.FURNACE_MINECART)); register(EntityType.GHAST, GhastRenderer::new); register(EntityType.GIANT, context -> new GiantMobRenderer(context, 6.0F)); register(EntityType.GLOW_ITEM_FRAME, ItemFrameRenderer::new); - register(EntityType.GLOW_SQUID, context -> new GlowSquidRenderer(context, new SquidModel<>(context.bakeLayer(ModelLayers.GLOW_SQUID)))); + register( + EntityType.GLOW_SQUID, + context -> new GlowSquidRenderer( + context, new SquidModel(context.bakeLayer(ModelLayers.GLOW_SQUID)), new SquidModel(context.bakeLayer(ModelLayers.GLOW_SQUID_BABY)) + ) + ); register(EntityType.GOAT, GoatRenderer::new); register(EntityType.GUARDIAN, GuardianRenderer::new); register(EntityType.HOGLIN, HoglinRenderer::new); - register(EntityType.HOPPER_MINECART, context -> new MinecartRenderer<>(context, ModelLayers.HOPPER_MINECART)); + register(EntityType.HOPPER_MINECART, context -> new MinecartRenderer(context, ModelLayers.HOPPER_MINECART)); register(EntityType.HORSE, HorseRenderer::new); register(EntityType.HUSK, HuskRenderer::new); register(EntityType.ILLUSIONER, IllusionerRenderer::new); @@ -137,23 +162,42 @@ public class EntityRenderers { register(EntityType.OMINOUS_ITEM_SPAWNER, OminousItemSpawnerRenderer::new); register(EntityType.LEASH_KNOT, LeashKnotRenderer::new); register(EntityType.LIGHTNING_BOLT, LightningBoltRenderer::new); - register(EntityType.LLAMA, context -> new LlamaRenderer(context, ModelLayers.LLAMA)); + register(EntityType.LLAMA, context -> new LlamaRenderer(context, ModelLayers.LLAMA, ModelLayers.LLAMA_BABY)); register(EntityType.LLAMA_SPIT, LlamaSpitRenderer::new); register(EntityType.MAGMA_CUBE, MagmaCubeRenderer::new); register(EntityType.MARKER, NoopRenderer::new); - register(EntityType.MINECART, context -> new MinecartRenderer<>(context, ModelLayers.MINECART)); + register(EntityType.MINECART, context -> new MinecartRenderer(context, ModelLayers.MINECART)); register(EntityType.MOOSHROOM, MushroomCowRenderer::new); - register(EntityType.MULE, context -> new ChestedHorseRenderer<>(context, 0.92F, ModelLayers.MULE)); + register(EntityType.MULE, context -> new DonkeyRenderer<>(context, 0.92F, ModelLayers.MULE, ModelLayers.MULE_BABY, true)); register(EntityType.OCELOT, OcelotRenderer::new); register(EntityType.PAINTING, PaintingRenderer::new); register(EntityType.PANDA, PandaRenderer::new); register(EntityType.PARROT, ParrotRenderer::new); register(EntityType.PHANTOM, PhantomRenderer::new); register(EntityType.PIG, PigRenderer::new); - register(EntityType.PIGLIN, context -> new PiglinRenderer(context, ModelLayers.PIGLIN, ModelLayers.PIGLIN_INNER_ARMOR, ModelLayers.PIGLIN_OUTER_ARMOR, false)); + register( + EntityType.PIGLIN, + context -> new PiglinRenderer( + context, + ModelLayers.PIGLIN, + ModelLayers.PIGLIN_BABY, + ModelLayers.PIGLIN_INNER_ARMOR, + ModelLayers.PIGLIN_OUTER_ARMOR, + ModelLayers.PIGLIN_BABY_INNER_ARMOR, + ModelLayers.PIGLIN_BABY_OUTER_ARMOR + ) + ); register( EntityType.PIGLIN_BRUTE, - context -> new PiglinRenderer(context, ModelLayers.PIGLIN_BRUTE, ModelLayers.PIGLIN_BRUTE_INNER_ARMOR, ModelLayers.PIGLIN_BRUTE_OUTER_ARMOR, false) + context -> new PiglinRenderer( + context, + ModelLayers.PIGLIN_BRUTE, + ModelLayers.PIGLIN_BRUTE, + ModelLayers.PIGLIN_BRUTE_INNER_ARMOR, + ModelLayers.PIGLIN_BRUTE_OUTER_ARMOR, + ModelLayers.PIGLIN_BRUTE_INNER_ARMOR, + ModelLayers.PIGLIN_BRUTE_OUTER_ARMOR + ) ); register(EntityType.PILLAGER, PillagerRenderer::new); register(EntityType.POLAR_BEAR, PolarBearRenderer::new); @@ -167,23 +211,26 @@ public class EntityRenderers { register(EntityType.SHULKER_BULLET, ShulkerBulletRenderer::new); register(EntityType.SILVERFISH, SilverfishRenderer::new); register(EntityType.SKELETON, SkeletonRenderer::new); - register(EntityType.SKELETON_HORSE, context -> new UndeadHorseRenderer(context, ModelLayers.SKELETON_HORSE)); + register(EntityType.SKELETON_HORSE, context -> new UndeadHorseRenderer(context, ModelLayers.SKELETON_HORSE, ModelLayers.SKELETON_HORSE_BABY, true)); register(EntityType.SLIME, SlimeRenderer::new); register(EntityType.SMALL_FIREBALL, context -> new ThrownItemRenderer<>(context, 0.75F, true)); register(EntityType.SNIFFER, SnifferRenderer::new); register(EntityType.SNOWBALL, ThrownItemRenderer::new); register(EntityType.SNOW_GOLEM, SnowGolemRenderer::new); - register(EntityType.SPAWNER_MINECART, context -> new MinecartRenderer<>(context, ModelLayers.SPAWNER_MINECART)); + register(EntityType.SPAWNER_MINECART, context -> new MinecartRenderer(context, ModelLayers.SPAWNER_MINECART)); register(EntityType.SPECTRAL_ARROW, SpectralArrowRenderer::new); register(EntityType.SPIDER, SpiderRenderer::new); - register(EntityType.SQUID, context -> new SquidRenderer<>(context, new SquidModel<>(context.bakeLayer(ModelLayers.SQUID)))); + register( + EntityType.SQUID, + context -> new SquidRenderer<>(context, new SquidModel(context.bakeLayer(ModelLayers.SQUID)), new SquidModel(context.bakeLayer(ModelLayers.SQUID_BABY))) + ); register(EntityType.STRAY, StrayRenderer::new); register(EntityType.STRIDER, StriderRenderer::new); register(EntityType.TADPOLE, TadpoleRenderer::new); register(EntityType.TEXT_DISPLAY, DisplayRenderer.TextDisplayRenderer::new); register(EntityType.TNT, TntRenderer::new); register(EntityType.TNT_MINECART, TntMinecartRenderer::new); - register(EntityType.TRADER_LLAMA, context -> new LlamaRenderer(context, ModelLayers.TRADER_LLAMA)); + register(EntityType.TRADER_LLAMA, context -> new LlamaRenderer(context, ModelLayers.TRADER_LLAMA, ModelLayers.TRADER_LLAMA_BABY)); register(EntityType.TRIDENT, ThrownTridentRenderer::new); register(EntityType.TROPICAL_FISH, TropicalFishRenderer::new); register(EntityType.TURTLE, TurtleRenderer::new); @@ -200,12 +247,18 @@ public class EntityRenderers { register(EntityType.WOLF, WolfRenderer::new); register(EntityType.ZOGLIN, ZoglinRenderer::new); register(EntityType.ZOMBIE, ZombieRenderer::new); - register(EntityType.ZOMBIE_HORSE, context -> new UndeadHorseRenderer(context, ModelLayers.ZOMBIE_HORSE)); + register(EntityType.ZOMBIE_HORSE, context -> new UndeadHorseRenderer(context, ModelLayers.ZOMBIE_HORSE, ModelLayers.ZOMBIE_HORSE_BABY, false)); register(EntityType.ZOMBIE_VILLAGER, ZombieVillagerRenderer::new); register( EntityType.ZOMBIFIED_PIGLIN, - context -> new PiglinRenderer( - context, ModelLayers.ZOMBIFIED_PIGLIN, ModelLayers.ZOMBIFIED_PIGLIN_INNER_ARMOR, ModelLayers.ZOMBIFIED_PIGLIN_OUTER_ARMOR, true + context -> new ZombifiedPiglinRenderer( + context, + ModelLayers.ZOMBIFIED_PIGLIN, + ModelLayers.ZOMBIFIED_PIGLIN_BABY, + ModelLayers.ZOMBIFIED_PIGLIN_INNER_ARMOR, + ModelLayers.ZOMBIFIED_PIGLIN_OUTER_ARMOR, + ModelLayers.ZOMBIFIED_PIGLIN_BABY_INNER_ARMOR, + ModelLayers.ZOMBIFIED_PIGLIN_BABY_OUTER_ARMOR ) ); } diff --git a/net/minecraft/client/renderer/entity/EvokerFangsRenderer.java b/net/minecraft/client/renderer/entity/EvokerFangsRenderer.java index cd14ce18..334b68a9 100644 --- a/net/minecraft/client/renderer/entity/EvokerFangsRenderer.java +++ b/net/minecraft/client/renderer/entity/EvokerFangsRenderer.java @@ -8,46 +8,43 @@ import net.fabricmc.api.Environment; import net.minecraft.client.model.EvokerFangsModel; import net.minecraft.client.model.geom.ModelLayers; import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.entity.state.EvokerFangsRenderState; import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.projectile.EvokerFangs; @Environment(EnvType.CLIENT) -public class EvokerFangsRenderer extends EntityRenderer { +public class EvokerFangsRenderer extends EntityRenderer { private static final ResourceLocation TEXTURE_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/illager/evoker_fangs.png"); - private final EvokerFangsModel model; + private final EvokerFangsModel model; public EvokerFangsRenderer(EntityRendererProvider.Context context) { super(context); - this.model = new EvokerFangsModel<>(context.bakeLayer(ModelLayers.EVOKER_FANGS)); + this.model = new EvokerFangsModel(context.bakeLayer(ModelLayers.EVOKER_FANGS)); } - public void render(EvokerFangs entity, float entityYaw, float partialTicks, PoseStack poseStack, MultiBufferSource buffer, int packedLight) { - float f = entity.getAnimationProgress(partialTicks); + public void render(EvokerFangsRenderState evokerFangsRenderState, PoseStack poseStack, MultiBufferSource multiBufferSource, int i) { + float f = evokerFangsRenderState.biteProgress; if (f != 0.0F) { - float g = 2.0F; - if (f > 0.9F) { - g *= (1.0F - f) / 0.1F; - } - poseStack.pushPose(); - poseStack.mulPose(Axis.YP.rotationDegrees(90.0F - entity.getYRot())); - poseStack.scale(-g, -g, g); - float h = 0.03125F; - poseStack.translate(0.0, -0.626, 0.0); - poseStack.scale(0.5F, 0.5F, 0.5F); - this.model.setupAnim(entity, f, 0.0F, 0.0F, entity.getYRot(), entity.getXRot()); - VertexConsumer vertexConsumer = buffer.getBuffer(this.model.renderType(TEXTURE_LOCATION)); - this.model.renderToBuffer(poseStack, vertexConsumer, packedLight, OverlayTexture.NO_OVERLAY); + poseStack.mulPose(Axis.YP.rotationDegrees(90.0F - evokerFangsRenderState.yRot)); + poseStack.scale(-1.0F, -1.0F, 1.0F); + poseStack.translate(0.0F, -1.501F, 0.0F); + this.model.setupAnim(evokerFangsRenderState); + VertexConsumer vertexConsumer = multiBufferSource.getBuffer(this.model.renderType(TEXTURE_LOCATION)); + this.model.renderToBuffer(poseStack, vertexConsumer, i, OverlayTexture.NO_OVERLAY); poseStack.popPose(); - super.render(entity, entityYaw, partialTicks, poseStack, buffer, packedLight); + super.render(evokerFangsRenderState, poseStack, multiBufferSource, i); } } - /** - * Returns the location of an entity's texture. - */ - public ResourceLocation getTextureLocation(EvokerFangs entity) { - return TEXTURE_LOCATION; + public EvokerFangsRenderState createRenderState() { + return new EvokerFangsRenderState(); + } + + public void extractRenderState(EvokerFangs evokerFangs, EvokerFangsRenderState evokerFangsRenderState, float f) { + super.extractRenderState(evokerFangs, evokerFangsRenderState, f); + evokerFangsRenderState.yRot = evokerFangs.getYRot(); + evokerFangsRenderState.biteProgress = evokerFangs.getAnimationProgress(f); } } diff --git a/net/minecraft/client/renderer/entity/EvokerRenderer.java b/net/minecraft/client/renderer/entity/EvokerRenderer.java index 58829ad2..2bf306ba 100644 --- a/net/minecraft/client/renderer/entity/EvokerRenderer.java +++ b/net/minecraft/client/renderer/entity/EvokerRenderer.java @@ -7,32 +7,35 @@ import net.minecraft.client.model.IllagerModel; import net.minecraft.client.model.geom.ModelLayers; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.entity.layers.ItemInHandLayer; +import net.minecraft.client.renderer.entity.state.EvokerRenderState; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.monster.SpellcasterIllager; @Environment(EnvType.CLIENT) -public class EvokerRenderer extends IllagerRenderer { +public class EvokerRenderer extends IllagerRenderer { private static final ResourceLocation EVOKER_ILLAGER = ResourceLocation.withDefaultNamespace("textures/entity/illager/evoker.png"); public EvokerRenderer(EntityRendererProvider.Context context) { super(context, new IllagerModel<>(context.bakeLayer(ModelLayers.EVOKER)), 0.5F); - this.addLayer( - new ItemInHandLayer>(this, context.getItemInHandRenderer()) { - public void render( - PoseStack poseStack, MultiBufferSource multiBufferSource, int i, T spellcasterIllager, float f, float g, float h, float j, float k, float l - ) { - if (spellcasterIllager.isCastingSpell()) { - super.render(poseStack, multiBufferSource, i, spellcasterIllager, f, g, h, j, k, l); - } + this.addLayer(new ItemInHandLayer>(this, context.getItemRenderer()) { + public void render(PoseStack poseStack, MultiBufferSource multiBufferSource, int i, EvokerRenderState evokerRenderState, float f, float g) { + if (evokerRenderState.isCastingSpell) { + super.render(poseStack, multiBufferSource, i, evokerRenderState, f, g); } } - ); + }); } - /** - * Returns the location of an entity's texture. - */ - public ResourceLocation getTextureLocation(T entity) { + public ResourceLocation getTextureLocation(EvokerRenderState evokerRenderState) { return EVOKER_ILLAGER; } + + public EvokerRenderState createRenderState() { + return new EvokerRenderState(); + } + + public void extractRenderState(T spellcasterIllager, EvokerRenderState evokerRenderState, float f) { + super.extractRenderState(spellcasterIllager, evokerRenderState, f); + evokerRenderState.isCastingSpell = spellcasterIllager.isCastingSpell(); + } } diff --git a/net/minecraft/client/renderer/entity/ExperienceOrbRenderer.java b/net/minecraft/client/renderer/entity/ExperienceOrbRenderer.java index 9f1807a9..888d0086 100644 --- a/net/minecraft/client/renderer/entity/ExperienceOrbRenderer.java +++ b/net/minecraft/client/renderer/entity/ExperienceOrbRenderer.java @@ -6,6 +6,7 @@ import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.entity.state.ExperienceOrbRenderState; import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.core.BlockPos; import net.minecraft.resources.ResourceLocation; @@ -13,7 +14,7 @@ import net.minecraft.util.Mth; import net.minecraft.world.entity.ExperienceOrb; @Environment(EnvType.CLIENT) -public class ExperienceOrbRenderer extends EntityRenderer { +public class ExperienceOrbRenderer extends EntityRenderer { private static final ResourceLocation EXPERIENCE_ORB_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/experience_orb.png"); private static final RenderType RENDER_TYPE = RenderType.itemEntityTranslucentCull(EXPERIENCE_ORB_LOCATION); @@ -27,33 +28,33 @@ public class ExperienceOrbRenderer extends EntityRenderer { return Mth.clamp(super.getBlockLightLevel(entity, pos) + 7, 0, 15); } - public void render(ExperienceOrb entity, float entityYaw, float partialTicks, PoseStack poseStack, MultiBufferSource buffer, int packedLight) { + public void render(ExperienceOrbRenderState experienceOrbRenderState, PoseStack poseStack, MultiBufferSource multiBufferSource, int i) { poseStack.pushPose(); - int i = entity.getIcon(); - float f = (i % 4 * 16 + 0) / 64.0F; - float g = (i % 4 * 16 + 16) / 64.0F; - float h = (i / 4 * 16 + 0) / 64.0F; - float j = (i / 4 * 16 + 16) / 64.0F; - float k = 1.0F; - float l = 0.5F; - float m = 0.25F; - float n = 255.0F; - float o = (entity.tickCount + partialTicks) / 2.0F; - int p = (int)((Mth.sin(o + 0.0F) + 1.0F) * 0.5F * 255.0F); - int q = 255; - int r = (int)((Mth.sin(o + (float) (Math.PI * 4.0 / 3.0)) + 1.0F) * 0.1F * 255.0F); + int j = experienceOrbRenderState.icon; + float f = (j % 4 * 16 + 0) / 64.0F; + float g = (j % 4 * 16 + 16) / 64.0F; + float h = (j / 4 * 16 + 0) / 64.0F; + float k = (j / 4 * 16 + 16) / 64.0F; + float l = 1.0F; + float m = 0.5F; + float n = 0.25F; + float o = 255.0F; + float p = experienceOrbRenderState.ageInTicks / 2.0F; + int q = (int)((Mth.sin(p + 0.0F) + 1.0F) * 0.5F * 255.0F); + int r = 255; + int s = (int)((Mth.sin(p + (float) (Math.PI * 4.0 / 3.0)) + 1.0F) * 0.1F * 255.0F); poseStack.translate(0.0F, 0.1F, 0.0F); poseStack.mulPose(this.entityRenderDispatcher.cameraOrientation()); - float s = 0.3F; + float t = 0.3F; poseStack.scale(0.3F, 0.3F, 0.3F); - VertexConsumer vertexConsumer = buffer.getBuffer(RENDER_TYPE); + VertexConsumer vertexConsumer = multiBufferSource.getBuffer(RENDER_TYPE); PoseStack.Pose pose = poseStack.last(); - vertex(vertexConsumer, pose, -0.5F, -0.25F, p, 255, r, f, j, packedLight); - vertex(vertexConsumer, pose, 0.5F, -0.25F, p, 255, r, g, j, packedLight); - vertex(vertexConsumer, pose, 0.5F, 0.75F, p, 255, r, g, h, packedLight); - vertex(vertexConsumer, pose, -0.5F, 0.75F, p, 255, r, f, h, packedLight); + vertex(vertexConsumer, pose, -0.5F, -0.25F, q, 255, s, f, k, i); + vertex(vertexConsumer, pose, 0.5F, -0.25F, q, 255, s, g, k, i); + vertex(vertexConsumer, pose, 0.5F, 0.75F, q, 255, s, g, h, i); + vertex(vertexConsumer, pose, -0.5F, 0.75F, q, 255, s, f, h, i); poseStack.popPose(); - super.render(entity, entityYaw, partialTicks, poseStack, buffer, packedLight); + super.render(experienceOrbRenderState, poseStack, multiBufferSource, i); } private static void vertex(VertexConsumer consumer, PoseStack.Pose pose, float x, float y, int red, int green, int blue, float u, float v, int packedLight) { @@ -65,10 +66,12 @@ public class ExperienceOrbRenderer extends EntityRenderer { .setNormal(pose, 0.0F, 1.0F, 0.0F); } - /** - * Returns the location of an entity's texture. - */ - public ResourceLocation getTextureLocation(ExperienceOrb entity) { - return EXPERIENCE_ORB_LOCATION; + public ExperienceOrbRenderState createRenderState() { + return new ExperienceOrbRenderState(); + } + + public void extractRenderState(ExperienceOrb experienceOrb, ExperienceOrbRenderState experienceOrbRenderState, float f) { + super.extractRenderState(experienceOrb, experienceOrbRenderState, f); + experienceOrbRenderState.icon = experienceOrb.getIcon(); } } diff --git a/net/minecraft/client/renderer/entity/FallingBlockRenderer.java b/net/minecraft/client/renderer/entity/FallingBlockRenderer.java index b097ca24..bf96ae7c 100644 --- a/net/minecraft/client/renderer/entity/FallingBlockRenderer.java +++ b/net/minecraft/client/renderer/entity/FallingBlockRenderer.java @@ -6,18 +6,17 @@ import net.fabricmc.api.Environment; import net.minecraft.client.renderer.ItemBlockRenderTypes; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.block.BlockRenderDispatcher; +import net.minecraft.client.renderer.culling.Frustum; +import net.minecraft.client.renderer.entity.state.FallingBlockRenderState; import net.minecraft.client.renderer.texture.OverlayTexture; -import net.minecraft.client.renderer.texture.TextureAtlas; import net.minecraft.core.BlockPos; -import net.minecraft.resources.ResourceLocation; import net.minecraft.util.RandomSource; import net.minecraft.world.entity.item.FallingBlockEntity; -import net.minecraft.world.level.Level; import net.minecraft.world.level.block.RenderShape; import net.minecraft.world.level.block.state.BlockState; @Environment(EnvType.CLIENT) -public class FallingBlockRenderer extends EntityRenderer { +public class FallingBlockRenderer extends EntityRenderer { private final BlockRenderDispatcher dispatcher; public FallingBlockRenderer(EntityRendererProvider.Context context) { @@ -26,38 +25,47 @@ public class FallingBlockRenderer extends EntityRenderer { this.dispatcher = context.getBlockRenderDispatcher(); } - public void render(FallingBlockEntity entity, float entityYaw, float partialTicks, PoseStack poseStack, MultiBufferSource buffer, int packedLight) { - BlockState blockState = entity.getBlockState(); + public boolean shouldRender(FallingBlockEntity fallingBlockEntity, Frustum frustum, double d, double e, double f) { + return !super.shouldRender(fallingBlockEntity, frustum, d, e, f) + ? false + : fallingBlockEntity.getBlockState() != fallingBlockEntity.level().getBlockState(fallingBlockEntity.blockPosition()); + } + + public void render(FallingBlockRenderState fallingBlockRenderState, PoseStack poseStack, MultiBufferSource multiBufferSource, int i) { + BlockState blockState = fallingBlockRenderState.blockState; if (blockState.getRenderShape() == RenderShape.MODEL) { - Level level = entity.level(); - if (blockState != level.getBlockState(entity.blockPosition()) && blockState.getRenderShape() != RenderShape.INVISIBLE) { - poseStack.pushPose(); - BlockPos blockPos = BlockPos.containing(entity.getX(), entity.getBoundingBox().maxY, entity.getZ()); - poseStack.translate(-0.5, 0.0, -0.5); - this.dispatcher - .getModelRenderer() - .tesselateBlock( - level, - this.dispatcher.getBlockModel(blockState), - blockState, - blockPos, - poseStack, - buffer.getBuffer(ItemBlockRenderTypes.getMovingBlockRenderType(blockState)), - false, - RandomSource.create(), - blockState.getSeed(entity.getStartPos()), - OverlayTexture.NO_OVERLAY - ); - poseStack.popPose(); - super.render(entity, entityYaw, partialTicks, poseStack, buffer, packedLight); - } + poseStack.pushPose(); + poseStack.translate(-0.5, 0.0, -0.5); + this.dispatcher + .getModelRenderer() + .tesselateBlock( + fallingBlockRenderState, + this.dispatcher.getBlockModel(blockState), + blockState, + fallingBlockRenderState.blockPos, + poseStack, + multiBufferSource.getBuffer(ItemBlockRenderTypes.getMovingBlockRenderType(blockState)), + false, + RandomSource.create(), + blockState.getSeed(fallingBlockRenderState.startBlockPos), + OverlayTexture.NO_OVERLAY + ); + poseStack.popPose(); + super.render(fallingBlockRenderState, poseStack, multiBufferSource, i); } } - /** - * Returns the location of an entity's texture. - */ - public ResourceLocation getTextureLocation(FallingBlockEntity entity) { - return TextureAtlas.LOCATION_BLOCKS; + public FallingBlockRenderState createRenderState() { + return new FallingBlockRenderState(); + } + + public void extractRenderState(FallingBlockEntity fallingBlockEntity, FallingBlockRenderState fallingBlockRenderState, float f) { + super.extractRenderState(fallingBlockEntity, fallingBlockRenderState, f); + BlockPos blockPos = BlockPos.containing(fallingBlockEntity.getX(), fallingBlockEntity.getBoundingBox().maxY, fallingBlockEntity.getZ()); + fallingBlockRenderState.startBlockPos = fallingBlockEntity.getStartPos(); + fallingBlockRenderState.blockPos = blockPos; + fallingBlockRenderState.blockState = fallingBlockEntity.getBlockState(); + fallingBlockRenderState.biome = fallingBlockEntity.level().getBiome(blockPos); + fallingBlockRenderState.level = fallingBlockEntity.level(); } } diff --git a/net/minecraft/client/renderer/entity/FireworkEntityRenderer.java b/net/minecraft/client/renderer/entity/FireworkEntityRenderer.java index fb373d36..724a5015 100644 --- a/net/minecraft/client/renderer/entity/FireworkEntityRenderer.java +++ b/net/minecraft/client/renderer/entity/FireworkEntityRenderer.java @@ -5,14 +5,14 @@ import com.mojang.math.Axis; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.entity.state.FireworkRocketRenderState; import net.minecraft.client.renderer.texture.OverlayTexture; -import net.minecraft.client.renderer.texture.TextureAtlas; -import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.projectile.FireworkRocketEntity; import net.minecraft.world.item.ItemDisplayContext; +import net.minecraft.world.item.ItemStack; @Environment(EnvType.CLIENT) -public class FireworkEntityRenderer extends EntityRenderer { +public class FireworkEntityRenderer extends EntityRenderer { private final ItemRenderer itemRenderer; public FireworkEntityRenderer(EntityRendererProvider.Context context) { @@ -20,25 +20,41 @@ public class FireworkEntityRenderer extends EntityRenderer this.itemRenderer = context.getItemRenderer(); } - public void render(FireworkRocketEntity entity, float entityYaw, float partialTicks, PoseStack poseStack, MultiBufferSource buffer, int packedLight) { + public void render(FireworkRocketRenderState fireworkRocketRenderState, PoseStack poseStack, MultiBufferSource multiBufferSource, int i) { poseStack.pushPose(); poseStack.mulPose(this.entityRenderDispatcher.cameraOrientation()); - if (entity.isShotAtAngle()) { + if (fireworkRocketRenderState.isShotAtAngle) { poseStack.mulPose(Axis.ZP.rotationDegrees(180.0F)); poseStack.mulPose(Axis.YP.rotationDegrees(180.0F)); poseStack.mulPose(Axis.XP.rotationDegrees(90.0F)); } this.itemRenderer - .renderStatic(entity.getItem(), ItemDisplayContext.GROUND, packedLight, OverlayTexture.NO_OVERLAY, poseStack, buffer, entity.level(), entity.getId()); + .render( + fireworkRocketRenderState.item, + ItemDisplayContext.GROUND, + false, + poseStack, + multiBufferSource, + i, + OverlayTexture.NO_OVERLAY, + fireworkRocketRenderState.itemModel + ); poseStack.popPose(); - super.render(entity, entityYaw, partialTicks, poseStack, buffer, packedLight); + super.render(fireworkRocketRenderState, poseStack, multiBufferSource, i); } - /** - * Returns the location of an entity's texture. - */ - public ResourceLocation getTextureLocation(FireworkRocketEntity entity) { - return TextureAtlas.LOCATION_BLOCKS; + public FireworkRocketRenderState createRenderState() { + return new FireworkRocketRenderState(); + } + + public void extractRenderState(FireworkRocketEntity fireworkRocketEntity, FireworkRocketRenderState fireworkRocketRenderState, float f) { + super.extractRenderState(fireworkRocketEntity, fireworkRocketRenderState, f); + fireworkRocketRenderState.isShotAtAngle = fireworkRocketEntity.isShotAtAngle(); + ItemStack itemStack = fireworkRocketEntity.getItem(); + fireworkRocketRenderState.item = itemStack.copy(); + fireworkRocketRenderState.itemModel = !itemStack.isEmpty() + ? this.itemRenderer.getModel(itemStack, fireworkRocketEntity.level(), null, fireworkRocketEntity.getId()) + : null; } } diff --git a/net/minecraft/client/renderer/entity/FishingHookRenderer.java b/net/minecraft/client/renderer/entity/FishingHookRenderer.java index 5ec0395a..bc985b6f 100644 --- a/net/minecraft/client/renderer/entity/FishingHookRenderer.java +++ b/net/minecraft/client/renderer/entity/FishingHookRenderer.java @@ -7,6 +7,8 @@ import net.fabricmc.api.Environment; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.culling.Frustum; +import net.minecraft.client.renderer.entity.state.FishingHookRenderState; import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.resources.ResourceLocation; import net.minecraft.util.Mth; @@ -18,7 +20,7 @@ import net.minecraft.world.item.Items; import net.minecraft.world.phys.Vec3; @Environment(EnvType.CLIENT) -public class FishingHookRenderer extends EntityRenderer { +public class FishingHookRenderer extends EntityRenderer { private static final ResourceLocation TEXTURE_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/fishing_hook.png"); private static final RenderType RENDER_TYPE = RenderType.entityCutout(TEXTURE_LOCATION); private static final double VIEW_BOBBING_SCALE = 960.0; @@ -27,38 +29,35 @@ public class FishingHookRenderer extends EntityRenderer { super(context); } - public void render(FishingHook entity, float entityYaw, float partialTicks, PoseStack poseStack, MultiBufferSource buffer, int packedLight) { - Player player = entity.getPlayerOwner(); - if (player != null) { - poseStack.pushPose(); - poseStack.pushPose(); - poseStack.scale(0.5F, 0.5F, 0.5F); - poseStack.mulPose(this.entityRenderDispatcher.cameraOrientation()); - PoseStack.Pose pose = poseStack.last(); - VertexConsumer vertexConsumer = buffer.getBuffer(RENDER_TYPE); - vertex(vertexConsumer, pose, packedLight, 0.0F, 0, 0, 1); - vertex(vertexConsumer, pose, packedLight, 1.0F, 0, 1, 1); - vertex(vertexConsumer, pose, packedLight, 1.0F, 1, 1, 0); - vertex(vertexConsumer, pose, packedLight, 0.0F, 1, 0, 0); - poseStack.popPose(); - float f = player.getAttackAnim(partialTicks); - float g = Mth.sin(Mth.sqrt(f) * (float) Math.PI); - Vec3 vec3 = this.getPlayerHandPos(player, g, partialTicks); - Vec3 vec32 = entity.getPosition(partialTicks).add(0.0, 0.25, 0.0); - float h = (float)(vec3.x - vec32.x); - float i = (float)(vec3.y - vec32.y); - float j = (float)(vec3.z - vec32.z); - VertexConsumer vertexConsumer2 = buffer.getBuffer(RenderType.lineStrip()); - PoseStack.Pose pose2 = poseStack.last(); - int k = 16; + public boolean shouldRender(FishingHook fishingHook, Frustum frustum, double d, double e, double f) { + return super.shouldRender(fishingHook, frustum, d, e, f) && fishingHook.getPlayerOwner() != null; + } - for (int l = 0; l <= 16; l++) { - stringVertex(h, i, j, vertexConsumer2, pose2, fraction(l, 16), fraction(l + 1, 16)); - } + public void render(FishingHookRenderState fishingHookRenderState, PoseStack poseStack, MultiBufferSource multiBufferSource, int i) { + poseStack.pushPose(); + poseStack.pushPose(); + poseStack.scale(0.5F, 0.5F, 0.5F); + poseStack.mulPose(this.entityRenderDispatcher.cameraOrientation()); + PoseStack.Pose pose = poseStack.last(); + VertexConsumer vertexConsumer = multiBufferSource.getBuffer(RENDER_TYPE); + vertex(vertexConsumer, pose, i, 0.0F, 0, 0, 1); + vertex(vertexConsumer, pose, i, 1.0F, 0, 1, 1); + vertex(vertexConsumer, pose, i, 1.0F, 1, 1, 0); + vertex(vertexConsumer, pose, i, 0.0F, 1, 0, 0); + poseStack.popPose(); + float f = (float)fishingHookRenderState.lineOriginOffset.x; + float g = (float)fishingHookRenderState.lineOriginOffset.y; + float h = (float)fishingHookRenderState.lineOriginOffset.z; + VertexConsumer vertexConsumer2 = multiBufferSource.getBuffer(RenderType.lineStrip()); + PoseStack.Pose pose2 = poseStack.last(); + int j = 16; - poseStack.popPose(); - super.render(entity, entityYaw, partialTicks, poseStack, buffer, packedLight); + for (int k = 0; k <= 16; k++) { + stringVertex(f, g, h, vertexConsumer2, pose2, fraction(k, 16), fraction(k + 1, 16)); } + + poseStack.popPose(); + super.render(fishingHookRenderState, poseStack, multiBufferSource, i); } private Vec3 getPlayerHandPos(Player player, float f, float partialTick) { @@ -111,10 +110,25 @@ public class FishingHookRenderer extends EntityRenderer { consumer.addVertex(pose, f, g, h).setColor(-16777216).setNormal(pose, i, j, k); } - /** - * Returns the location of an entity's texture. - */ - public ResourceLocation getTextureLocation(FishingHook entity) { - return TEXTURE_LOCATION; + public FishingHookRenderState createRenderState() { + return new FishingHookRenderState(); + } + + public void extractRenderState(FishingHook fishingHook, FishingHookRenderState fishingHookRenderState, float f) { + super.extractRenderState(fishingHook, fishingHookRenderState, f); + Player player = fishingHook.getPlayerOwner(); + if (player == null) { + fishingHookRenderState.lineOriginOffset = Vec3.ZERO; + } else { + float g = player.getAttackAnim(f); + float h = Mth.sin(Mth.sqrt(g) * (float) Math.PI); + Vec3 vec3 = this.getPlayerHandPos(player, h, f); + Vec3 vec32 = fishingHook.getPosition(f).add(0.0, 0.25, 0.0); + fishingHookRenderState.lineOriginOffset = vec3.subtract(vec32); + } + } + + protected boolean affectedByCulling(FishingHook fishingHook) { + return false; } } diff --git a/net/minecraft/client/renderer/entity/FoxRenderer.java b/net/minecraft/client/renderer/entity/FoxRenderer.java index 12b586d0..b27f1b51 100644 --- a/net/minecraft/client/renderer/entity/FoxRenderer.java +++ b/net/minecraft/client/renderer/entity/FoxRenderer.java @@ -7,38 +7,50 @@ import net.fabricmc.api.Environment; import net.minecraft.client.model.FoxModel; import net.minecraft.client.model.geom.ModelLayers; import net.minecraft.client.renderer.entity.layers.FoxHeldItemLayer; +import net.minecraft.client.renderer.entity.state.FoxRenderState; import net.minecraft.resources.ResourceLocation; -import net.minecraft.util.Mth; import net.minecraft.world.entity.animal.Fox; @Environment(EnvType.CLIENT) -public class FoxRenderer extends MobRenderer> { +public class FoxRenderer extends AgeableMobRenderer { private static final ResourceLocation RED_FOX_TEXTURE = ResourceLocation.withDefaultNamespace("textures/entity/fox/fox.png"); private static final ResourceLocation RED_FOX_SLEEP_TEXTURE = ResourceLocation.withDefaultNamespace("textures/entity/fox/fox_sleep.png"); private static final ResourceLocation SNOW_FOX_TEXTURE = ResourceLocation.withDefaultNamespace("textures/entity/fox/snow_fox.png"); private static final ResourceLocation SNOW_FOX_SLEEP_TEXTURE = ResourceLocation.withDefaultNamespace("textures/entity/fox/snow_fox_sleep.png"); public FoxRenderer(EntityRendererProvider.Context context) { - super(context, new FoxModel<>(context.bakeLayer(ModelLayers.FOX)), 0.4F); - this.addLayer(new FoxHeldItemLayer(this, context.getItemInHandRenderer())); + super(context, new FoxModel(context.bakeLayer(ModelLayers.FOX)), new FoxModel(context.bakeLayer(ModelLayers.FOX_BABY)), 0.4F); + this.addLayer(new FoxHeldItemLayer(this, context.getItemRenderer())); } - protected void setupRotations(Fox entity, PoseStack poseStack, float bob, float yBodyRot, float partialTick, float scale) { - super.setupRotations(entity, poseStack, bob, yBodyRot, partialTick, scale); - if (entity.isPouncing() || entity.isFaceplanted()) { - float f = -Mth.lerp(partialTick, entity.xRotO, entity.getXRot()); - poseStack.mulPose(Axis.XP.rotationDegrees(f)); + protected void setupRotations(FoxRenderState foxRenderState, PoseStack poseStack, float f, float g) { + super.setupRotations(foxRenderState, poseStack, f, g); + if (foxRenderState.isPouncing || foxRenderState.isFaceplanted) { + poseStack.mulPose(Axis.XP.rotationDegrees(-foxRenderState.xRot)); } } - /** - * Returns the location of an entity's texture. - */ - public ResourceLocation getTextureLocation(Fox entity) { - if (entity.getVariant() == Fox.Type.RED) { - return entity.isSleeping() ? RED_FOX_SLEEP_TEXTURE : RED_FOX_TEXTURE; + public ResourceLocation getTextureLocation(FoxRenderState foxRenderState) { + if (foxRenderState.variant == Fox.Variant.RED) { + return foxRenderState.isSleeping ? RED_FOX_SLEEP_TEXTURE : RED_FOX_TEXTURE; } else { - return entity.isSleeping() ? SNOW_FOX_SLEEP_TEXTURE : SNOW_FOX_TEXTURE; + return foxRenderState.isSleeping ? SNOW_FOX_SLEEP_TEXTURE : SNOW_FOX_TEXTURE; } } + + public FoxRenderState createRenderState() { + return new FoxRenderState(); + } + + public void extractRenderState(Fox fox, FoxRenderState foxRenderState, float f) { + super.extractRenderState(fox, foxRenderState, f); + foxRenderState.headRollAngle = fox.getHeadRollAngle(f); + foxRenderState.isCrouching = fox.isCrouching(); + foxRenderState.crouchAmount = fox.getCrouchAmount(f); + foxRenderState.isSleeping = fox.isSleeping(); + foxRenderState.isSitting = fox.isSitting(); + foxRenderState.isFaceplanted = fox.isFaceplanted(); + foxRenderState.isPouncing = fox.isPouncing(); + foxRenderState.variant = fox.getVariant(); + } } diff --git a/net/minecraft/client/renderer/entity/FrogRenderer.java b/net/minecraft/client/renderer/entity/FrogRenderer.java index d318b36c..bf5116ab 100644 --- a/net/minecraft/client/renderer/entity/FrogRenderer.java +++ b/net/minecraft/client/renderer/entity/FrogRenderer.java @@ -4,16 +4,31 @@ import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.model.FrogModel; import net.minecraft.client.model.geom.ModelLayers; +import net.minecraft.client.renderer.entity.state.FrogRenderState; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.animal.frog.Frog; @Environment(EnvType.CLIENT) -public class FrogRenderer extends MobRenderer> { +public class FrogRenderer extends MobRenderer { public FrogRenderer(EntityRendererProvider.Context context) { - super(context, new FrogModel<>(context.bakeLayer(ModelLayers.FROG)), 0.3F); + super(context, new FrogModel(context.bakeLayer(ModelLayers.FROG)), 0.3F); } - public ResourceLocation getTextureLocation(Frog frog) { - return frog.getVariant().value().texture(); + public ResourceLocation getTextureLocation(FrogRenderState frogRenderState) { + return frogRenderState.texture; + } + + public FrogRenderState createRenderState() { + return new FrogRenderState(); + } + + public void extractRenderState(Frog frog, FrogRenderState frogRenderState, float f) { + super.extractRenderState(frog, frogRenderState, f); + frogRenderState.isSwimming = frog.isInWaterOrBubble(); + frogRenderState.jumpAnimationState.copyFrom(frog.jumpAnimationState); + frogRenderState.croakAnimationState.copyFrom(frog.croakAnimationState); + frogRenderState.tongueAnimationState.copyFrom(frog.tongueAnimationState); + frogRenderState.swimIdleAnimationState.copyFrom(frog.swimIdleAnimationState); + frogRenderState.texture = frog.getVariant().value().texture(); } } diff --git a/net/minecraft/client/renderer/entity/GhastRenderer.java b/net/minecraft/client/renderer/entity/GhastRenderer.java index 5202f606..73014e74 100644 --- a/net/minecraft/client/renderer/entity/GhastRenderer.java +++ b/net/minecraft/client/renderer/entity/GhastRenderer.java @@ -1,33 +1,32 @@ package net.minecraft.client.renderer.entity; -import com.mojang.blaze3d.vertex.PoseStack; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.model.GhastModel; import net.minecraft.client.model.geom.ModelLayers; +import net.minecraft.client.renderer.entity.state.GhastRenderState; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.monster.Ghast; @Environment(EnvType.CLIENT) -public class GhastRenderer extends MobRenderer> { +public class GhastRenderer extends MobRenderer { private static final ResourceLocation GHAST_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/ghast/ghast.png"); private static final ResourceLocation GHAST_SHOOTING_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/ghast/ghast_shooting.png"); public GhastRenderer(EntityRendererProvider.Context context) { - super(context, new GhastModel<>(context.bakeLayer(ModelLayers.GHAST)), 1.5F); + super(context, new GhastModel(context.bakeLayer(ModelLayers.GHAST)), 1.5F); } - /** - * Returns the location of an entity's texture. - */ - public ResourceLocation getTextureLocation(Ghast entity) { - return entity.isCharging() ? GHAST_SHOOTING_LOCATION : GHAST_LOCATION; + public ResourceLocation getTextureLocation(GhastRenderState ghastRenderState) { + return ghastRenderState.isCharging ? GHAST_SHOOTING_LOCATION : GHAST_LOCATION; } - protected void scale(Ghast livingEntity, PoseStack poseStack, float partialTickTime) { - float f = 1.0F; - float g = 4.5F; - float h = 4.5F; - poseStack.scale(4.5F, 4.5F, 4.5F); + public GhastRenderState createRenderState() { + return new GhastRenderState(); + } + + public void extractRenderState(Ghast ghast, GhastRenderState ghastRenderState, float f) { + super.extractRenderState(ghast, ghastRenderState, f); + ghastRenderState.isCharging = ghast.isCharging(); } } diff --git a/net/minecraft/client/renderer/entity/GiantMobRenderer.java b/net/minecraft/client/renderer/entity/GiantMobRenderer.java index b30c769e..e80e9cc6 100644 --- a/net/minecraft/client/renderer/entity/GiantMobRenderer.java +++ b/net/minecraft/client/renderer/entity/GiantMobRenderer.java @@ -1,6 +1,5 @@ package net.minecraft.client.renderer.entity; -import com.mojang.blaze3d.vertex.PoseStack; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.model.GiantZombieModel; @@ -8,36 +7,37 @@ import net.minecraft.client.model.HumanoidModel; import net.minecraft.client.model.geom.ModelLayers; import net.minecraft.client.renderer.entity.layers.HumanoidArmorLayer; import net.minecraft.client.renderer.entity.layers.ItemInHandLayer; +import net.minecraft.client.renderer.entity.state.ZombieRenderState; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.monster.Giant; @Environment(EnvType.CLIENT) -public class GiantMobRenderer extends MobRenderer> { +public class GiantMobRenderer extends MobRenderer> { private static final ResourceLocation ZOMBIE_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/zombie/zombie.png"); - private final float scale; public GiantMobRenderer(EntityRendererProvider.Context context, float scale) { super(context, new GiantZombieModel(context.bakeLayer(ModelLayers.GIANT)), 0.5F * scale); - this.scale = scale; - this.addLayer(new ItemInHandLayer<>(this, context.getItemInHandRenderer())); + this.addLayer(new ItemInHandLayer<>(this, context.getItemRenderer())); this.addLayer( new HumanoidArmorLayer<>( this, new GiantZombieModel(context.bakeLayer(ModelLayers.GIANT_INNER_ARMOR)), new GiantZombieModel(context.bakeLayer(ModelLayers.GIANT_OUTER_ARMOR)), - context.getModelManager() + context.getEquipmentRenderer() ) ); } - protected void scale(Giant livingEntity, PoseStack poseStack, float partialTickTime) { - poseStack.scale(this.scale, this.scale, this.scale); - } - - /** - * Returns the location of an entity's texture. - */ - public ResourceLocation getTextureLocation(Giant entity) { + public ResourceLocation getTextureLocation(ZombieRenderState zombieRenderState) { return ZOMBIE_LOCATION; } + + public ZombieRenderState createRenderState() { + return new ZombieRenderState(); + } + + public void extractRenderState(Giant giant, ZombieRenderState zombieRenderState, float f) { + super.extractRenderState(giant, zombieRenderState, f); + HumanoidMobRenderer.extractHumanoidRenderState(giant, zombieRenderState, f); + } } diff --git a/net/minecraft/client/renderer/entity/GlowSquidRenderer.java b/net/minecraft/client/renderer/entity/GlowSquidRenderer.java index 1ae6df75..6a8e741d 100644 --- a/net/minecraft/client/renderer/entity/GlowSquidRenderer.java +++ b/net/minecraft/client/renderer/entity/GlowSquidRenderer.java @@ -3,6 +3,7 @@ package net.minecraft.client.renderer.entity; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.model.SquidModel; +import net.minecraft.client.renderer.entity.state.SquidRenderState; import net.minecraft.core.BlockPos; import net.minecraft.resources.ResourceLocation; import net.minecraft.util.Mth; @@ -12,11 +13,12 @@ import net.minecraft.world.entity.GlowSquid; public class GlowSquidRenderer extends SquidRenderer { private static final ResourceLocation GLOW_SQUID_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/squid/glow_squid.png"); - public GlowSquidRenderer(EntityRendererProvider.Context context, SquidModel squidModel) { - super(context, squidModel); + public GlowSquidRenderer(EntityRendererProvider.Context context, SquidModel squidModel, SquidModel squidModel2) { + super(context, squidModel, squidModel2); } - public ResourceLocation getTextureLocation(GlowSquid glowSquid) { + @Override + public ResourceLocation getTextureLocation(SquidRenderState squidRenderState) { return GLOW_SQUID_LOCATION; } diff --git a/net/minecraft/client/renderer/entity/GoatRenderer.java b/net/minecraft/client/renderer/entity/GoatRenderer.java index b6009c85..a6a5414a 100644 --- a/net/minecraft/client/renderer/entity/GoatRenderer.java +++ b/net/minecraft/client/renderer/entity/GoatRenderer.java @@ -4,18 +4,30 @@ import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.model.GoatModel; import net.minecraft.client.model.geom.ModelLayers; +import net.minecraft.client.renderer.entity.state.GoatRenderState; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.animal.goat.Goat; @Environment(EnvType.CLIENT) -public class GoatRenderer extends MobRenderer> { +public class GoatRenderer extends AgeableMobRenderer { private static final ResourceLocation GOAT_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/goat/goat.png"); public GoatRenderer(EntityRendererProvider.Context context) { - super(context, new GoatModel<>(context.bakeLayer(ModelLayers.GOAT)), 0.7F); + super(context, new GoatModel(context.bakeLayer(ModelLayers.GOAT)), new GoatModel(context.bakeLayer(ModelLayers.GOAT_BABY)), 0.7F); } - public ResourceLocation getTextureLocation(Goat goat) { + public ResourceLocation getTextureLocation(GoatRenderState goatRenderState) { return GOAT_LOCATION; } + + public GoatRenderState createRenderState() { + return new GoatRenderState(); + } + + public void extractRenderState(Goat goat, GoatRenderState goatRenderState, float f) { + super.extractRenderState(goat, goatRenderState, f); + goatRenderState.hasLeftHorn = goat.hasLeftHorn(); + goatRenderState.hasRightHorn = goat.hasRightHorn(); + goatRenderState.rammingXHeadRot = goat.getRammingXHeadRot(); + } } diff --git a/net/minecraft/client/renderer/entity/GuardianRenderer.java b/net/minecraft/client/renderer/entity/GuardianRenderer.java index 4c7d3965..5a138cf1 100644 --- a/net/minecraft/client/renderer/entity/GuardianRenderer.java +++ b/net/minecraft/client/renderer/entity/GuardianRenderer.java @@ -5,22 +5,26 @@ import com.mojang.blaze3d.vertex.VertexConsumer; import com.mojang.math.Axis; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; +import net.minecraft.client.Minecraft; import net.minecraft.client.model.GuardianModel; import net.minecraft.client.model.geom.ModelLayerLocation; import net.minecraft.client.model.geom.ModelLayers; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.culling.Frustum; +import net.minecraft.client.renderer.entity.state.GuardianRenderState; import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.resources.ResourceLocation; import net.minecraft.util.Mth; +import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.monster.Guardian; import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.Vec3; +import org.jetbrains.annotations.Nullable; @Environment(EnvType.CLIENT) -public class GuardianRenderer extends MobRenderer { +public class GuardianRenderer extends MobRenderer { private static final ResourceLocation GUARDIAN_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/guardian.png"); private static final ResourceLocation GUARDIAN_BEAM_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/guardian_beam.png"); private static final RenderType BEAM_RENDER_TYPE = RenderType.entityCutoutNoCull(GUARDIAN_BEAM_LOCATION); @@ -57,76 +61,75 @@ public class GuardianRenderer extends MobRenderer { return new Vec3(d, e, f); } - public void render(Guardian entity, float entityYaw, float partialTicks, PoseStack poseStack, MultiBufferSource buffer, int packedLight) { - super.render(entity, entityYaw, partialTicks, poseStack, buffer, packedLight); - LivingEntity livingEntity = entity.getActiveAttackTarget(); - if (livingEntity != null) { - float f = entity.getAttackAnimationScale(partialTicks); - float g = entity.getClientSideAttackTime() + partialTicks; - float h = g * 0.5F % 1.0F; - float i = entity.getEyeHeight(); + public void render(GuardianRenderState guardianRenderState, PoseStack poseStack, MultiBufferSource multiBufferSource, int i) { + super.render(guardianRenderState, poseStack, multiBufferSource, i); + Vec3 vec3 = guardianRenderState.attackTargetPosition; + if (vec3 != null) { + float f = guardianRenderState.attackTime * 0.5F % 1.0F; poseStack.pushPose(); - poseStack.translate(0.0F, i, 0.0F); - Vec3 vec3 = this.getPosition(livingEntity, livingEntity.getBbHeight() * 0.5, partialTicks); - Vec3 vec32 = this.getPosition(entity, i, partialTicks); - Vec3 vec33 = vec3.subtract(vec32); - float j = (float)(vec33.length() + 1.0); - vec33 = vec33.normalize(); - float k = (float)Math.acos(vec33.y); - float l = (float)Math.atan2(vec33.z, vec33.x); - poseStack.mulPose(Axis.YP.rotationDegrees(((float) (Math.PI / 2) - l) * (180.0F / (float)Math.PI))); - poseStack.mulPose(Axis.XP.rotationDegrees(k * (180.0F / (float)Math.PI))); - int m = 1; - float n = g * 0.05F * -1.5F; - float o = f * f; - int p = 64 + (int)(o * 191.0F); - int q = 32 + (int)(o * 191.0F); - int r = 128 - (int)(o * 64.0F); - float s = 0.2F; - float t = 0.282F; - float u = Mth.cos(n + (float) (Math.PI * 3.0 / 4.0)) * 0.282F; - float v = Mth.sin(n + (float) (Math.PI * 3.0 / 4.0)) * 0.282F; - float w = Mth.cos(n + (float) (Math.PI / 4)) * 0.282F; - float x = Mth.sin(n + (float) (Math.PI / 4)) * 0.282F; - float y = Mth.cos(n + ((float) Math.PI * 5.0F / 4.0F)) * 0.282F; - float z = Mth.sin(n + ((float) Math.PI * 5.0F / 4.0F)) * 0.282F; - float aa = Mth.cos(n + ((float) Math.PI * 7.0F / 4.0F)) * 0.282F; - float ab = Mth.sin(n + ((float) Math.PI * 7.0F / 4.0F)) * 0.282F; - float ac = Mth.cos(n + (float) Math.PI) * 0.2F; - float ad = Mth.sin(n + (float) Math.PI) * 0.2F; - float ae = Mth.cos(n + 0.0F) * 0.2F; - float af = Mth.sin(n + 0.0F) * 0.2F; - float ag = Mth.cos(n + (float) (Math.PI / 2)) * 0.2F; - float ah = Mth.sin(n + (float) (Math.PI / 2)) * 0.2F; - float ai = Mth.cos(n + (float) (Math.PI * 3.0 / 2.0)) * 0.2F; - float aj = Mth.sin(n + (float) (Math.PI * 3.0 / 2.0)) * 0.2F; - float al = 0.0F; - float am = 0.4999F; - float an = -1.0F + h; - float ao = j * 2.5F + an; - VertexConsumer vertexConsumer = buffer.getBuffer(BEAM_RENDER_TYPE); - PoseStack.Pose pose = poseStack.last(); - vertex(vertexConsumer, pose, ac, j, ad, p, q, r, 0.4999F, ao); - vertex(vertexConsumer, pose, ac, 0.0F, ad, p, q, r, 0.4999F, an); - vertex(vertexConsumer, pose, ae, 0.0F, af, p, q, r, 0.0F, an); - vertex(vertexConsumer, pose, ae, j, af, p, q, r, 0.0F, ao); - vertex(vertexConsumer, pose, ag, j, ah, p, q, r, 0.4999F, ao); - vertex(vertexConsumer, pose, ag, 0.0F, ah, p, q, r, 0.4999F, an); - vertex(vertexConsumer, pose, ai, 0.0F, aj, p, q, r, 0.0F, an); - vertex(vertexConsumer, pose, ai, j, aj, p, q, r, 0.0F, ao); - float ap = 0.0F; - if (entity.tickCount % 2 == 0) { - ap = 0.5F; - } - - vertex(vertexConsumer, pose, u, j, v, p, q, r, 0.5F, ap + 0.5F); - vertex(vertexConsumer, pose, w, j, x, p, q, r, 1.0F, ap + 0.5F); - vertex(vertexConsumer, pose, aa, j, ab, p, q, r, 1.0F, ap); - vertex(vertexConsumer, pose, y, j, z, p, q, r, 0.5F, ap); + poseStack.translate(0.0F, guardianRenderState.eyeHeight, 0.0F); + renderBeam( + poseStack, + multiBufferSource.getBuffer(BEAM_RENDER_TYPE), + vec3.subtract(guardianRenderState.eyePosition), + guardianRenderState.attackTime, + guardianRenderState.attackScale, + f + ); poseStack.popPose(); } } + private static void renderBeam(PoseStack poseStack, VertexConsumer vertexConsumer, Vec3 vec3, float f, float g, float h) { + float i = (float)(vec3.length() + 1.0); + vec3 = vec3.normalize(); + float j = (float)Math.acos(vec3.y); + float k = (float) (Math.PI / 2) - (float)Math.atan2(vec3.z, vec3.x); + poseStack.mulPose(Axis.YP.rotationDegrees(k * (180.0F / (float)Math.PI))); + poseStack.mulPose(Axis.XP.rotationDegrees(j * (180.0F / (float)Math.PI))); + float l = f * 0.05F * -1.5F; + float m = g * g; + int n = 64 + (int)(m * 191.0F); + int o = 32 + (int)(m * 191.0F); + int p = 128 - (int)(m * 64.0F); + float q = 0.2F; + float r = 0.282F; + float s = Mth.cos(l + (float) (Math.PI * 3.0 / 4.0)) * 0.282F; + float t = Mth.sin(l + (float) (Math.PI * 3.0 / 4.0)) * 0.282F; + float u = Mth.cos(l + (float) (Math.PI / 4)) * 0.282F; + float v = Mth.sin(l + (float) (Math.PI / 4)) * 0.282F; + float w = Mth.cos(l + ((float) Math.PI * 5.0F / 4.0F)) * 0.282F; + float x = Mth.sin(l + ((float) Math.PI * 5.0F / 4.0F)) * 0.282F; + float y = Mth.cos(l + ((float) Math.PI * 7.0F / 4.0F)) * 0.282F; + float z = Mth.sin(l + ((float) Math.PI * 7.0F / 4.0F)) * 0.282F; + float aa = Mth.cos(l + (float) Math.PI) * 0.2F; + float ab = Mth.sin(l + (float) Math.PI) * 0.2F; + float ac = Mth.cos(l + 0.0F) * 0.2F; + float ad = Mth.sin(l + 0.0F) * 0.2F; + float ae = Mth.cos(l + (float) (Math.PI / 2)) * 0.2F; + float af = Mth.sin(l + (float) (Math.PI / 2)) * 0.2F; + float ag = Mth.cos(l + (float) (Math.PI * 3.0 / 2.0)) * 0.2F; + float ah = Mth.sin(l + (float) (Math.PI * 3.0 / 2.0)) * 0.2F; + float aj = 0.0F; + float ak = 0.4999F; + float al = -1.0F + h; + float am = al + i * 2.5F; + PoseStack.Pose pose = poseStack.last(); + vertex(vertexConsumer, pose, aa, i, ab, n, o, p, 0.4999F, am); + vertex(vertexConsumer, pose, aa, 0.0F, ab, n, o, p, 0.4999F, al); + vertex(vertexConsumer, pose, ac, 0.0F, ad, n, o, p, 0.0F, al); + vertex(vertexConsumer, pose, ac, i, ad, n, o, p, 0.0F, am); + vertex(vertexConsumer, pose, ae, i, af, n, o, p, 0.4999F, am); + vertex(vertexConsumer, pose, ae, 0.0F, af, n, o, p, 0.4999F, al); + vertex(vertexConsumer, pose, ag, 0.0F, ah, n, o, p, 0.0F, al); + vertex(vertexConsumer, pose, ag, i, ah, n, o, p, 0.0F, am); + float an = Mth.floor(f) % 2 == 0 ? 0.5F : 0.0F; + vertex(vertexConsumer, pose, s, i, t, n, o, p, 0.5F, an + 0.5F); + vertex(vertexConsumer, pose, u, i, v, n, o, p, 1.0F, an + 0.5F); + vertex(vertexConsumer, pose, y, i, z, n, o, p, 1.0F, an); + vertex(vertexConsumer, pose, w, i, x, n, o, p, 0.5F, an); + } + private static void vertex(VertexConsumer consumer, PoseStack.Pose pose, float x, float y, float z, int red, int green, int blue, float u, float v) { consumer.addVertex(pose, x, y, z) .setColor(red, green, blue, 255) @@ -136,10 +139,41 @@ public class GuardianRenderer extends MobRenderer { .setNormal(pose, 0.0F, 1.0F, 0.0F); } - /** - * Returns the location of an entity's texture. - */ - public ResourceLocation getTextureLocation(Guardian entity) { + public ResourceLocation getTextureLocation(GuardianRenderState guardianRenderState) { return GUARDIAN_LOCATION; } + + public GuardianRenderState createRenderState() { + return new GuardianRenderState(); + } + + public void extractRenderState(Guardian guardian, GuardianRenderState guardianRenderState, float f) { + super.extractRenderState(guardian, guardianRenderState, f); + guardianRenderState.spikesAnimation = guardian.getSpikesAnimation(f); + guardianRenderState.tailAnimation = guardian.getTailAnimation(f); + guardianRenderState.eyePosition = guardian.getEyePosition(f); + Entity entity = getEntityToLookAt(guardian); + if (entity != null) { + guardianRenderState.lookDirection = guardian.getViewVector(f); + guardianRenderState.lookAtPosition = entity.getEyePosition(f); + } else { + guardianRenderState.lookDirection = null; + guardianRenderState.lookAtPosition = null; + } + + LivingEntity livingEntity = guardian.getActiveAttackTarget(); + if (livingEntity != null) { + guardianRenderState.attackScale = guardian.getAttackAnimationScale(f); + guardianRenderState.attackTime = guardian.getClientSideAttackTime() + f; + guardianRenderState.attackTargetPosition = this.getPosition(livingEntity, livingEntity.getBbHeight() * 0.5, f); + } else { + guardianRenderState.attackTargetPosition = null; + } + } + + @Nullable + private static Entity getEntityToLookAt(Guardian guardian) { + Entity entity = Minecraft.getInstance().getCameraEntity(); + return (Entity)(guardian.hasActiveAttackTarget() ? guardian.getActiveAttackTarget() : entity); + } } diff --git a/net/minecraft/client/renderer/entity/HoglinRenderer.java b/net/minecraft/client/renderer/entity/HoglinRenderer.java index e6651eb1..e87f51d0 100644 --- a/net/minecraft/client/renderer/entity/HoglinRenderer.java +++ b/net/minecraft/client/renderer/entity/HoglinRenderer.java @@ -2,27 +2,29 @@ package net.minecraft.client.renderer.entity; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; -import net.minecraft.client.model.HoglinModel; import net.minecraft.client.model.geom.ModelLayers; +import net.minecraft.client.renderer.entity.state.HoglinRenderState; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.monster.hoglin.Hoglin; @Environment(EnvType.CLIENT) -public class HoglinRenderer extends MobRenderer> { +public class HoglinRenderer extends AbstractHoglinRenderer { private static final ResourceLocation HOGLIN_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/hoglin/hoglin.png"); public HoglinRenderer(EntityRendererProvider.Context context) { - super(context, new HoglinModel<>(context.bakeLayer(ModelLayers.HOGLIN)), 0.7F); + super(context, ModelLayers.HOGLIN, ModelLayers.HOGLIN_BABY, 0.7F); } - /** - * Returns the location of an entity's texture. - */ - public ResourceLocation getTextureLocation(Hoglin entity) { + public ResourceLocation getTextureLocation(HoglinRenderState hoglinRenderState) { return HOGLIN_LOCATION; } - protected boolean isShaking(Hoglin entity) { - return super.isShaking(entity) || entity.isConverting(); + public void extractRenderState(Hoglin hoglin, HoglinRenderState hoglinRenderState, float f) { + super.extractRenderState(hoglin, hoglinRenderState, f); + hoglinRenderState.isConverting = hoglin.isConverting(); + } + + protected boolean isShaking(HoglinRenderState hoglinRenderState) { + return super.isShaking(hoglinRenderState) || hoglinRenderState.isConverting; } } diff --git a/net/minecraft/client/renderer/entity/HorseRenderer.java b/net/minecraft/client/renderer/entity/HorseRenderer.java index 5d17c66a..2ab92fd0 100644 --- a/net/minecraft/client/renderer/entity/HorseRenderer.java +++ b/net/minecraft/client/renderer/entity/HorseRenderer.java @@ -9,12 +9,13 @@ import net.minecraft.client.model.HorseModel; import net.minecraft.client.model.geom.ModelLayers; import net.minecraft.client.renderer.entity.layers.HorseArmorLayer; import net.minecraft.client.renderer.entity.layers.HorseMarkingLayer; +import net.minecraft.client.renderer.entity.state.HorseRenderState; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.animal.horse.Horse; import net.minecraft.world.entity.animal.horse.Variant; @Environment(EnvType.CLIENT) -public final class HorseRenderer extends AbstractHorseRenderer> { +public final class HorseRenderer extends AbstractHorseRenderer { private static final Map LOCATION_BY_VARIANT = Util.make(Maps.newEnumMap(Variant.class), enumMap -> { enumMap.put(Variant.WHITE, ResourceLocation.withDefaultNamespace("textures/entity/horse/horse_white.png")); enumMap.put(Variant.CREAMY, ResourceLocation.withDefaultNamespace("textures/entity/horse/horse_creamy.png")); @@ -26,15 +27,23 @@ public final class HorseRenderer extends AbstractHorseRenderer(context.bakeLayer(ModelLayers.HORSE)), 1.1F); + super(context, new HorseModel(context.bakeLayer(ModelLayers.HORSE)), new HorseModel(context.bakeLayer(ModelLayers.HORSE_BABY)), 1.1F); this.addLayer(new HorseMarkingLayer(this)); - this.addLayer(new HorseArmorLayer(this, context.getModelSet())); + this.addLayer(new HorseArmorLayer(this, context.getModelSet(), context.getEquipmentRenderer())); } - /** - * Returns the location of an entity's texture. - */ - public ResourceLocation getTextureLocation(Horse entity) { - return (ResourceLocation)LOCATION_BY_VARIANT.get(entity.getVariant()); + public ResourceLocation getTextureLocation(HorseRenderState horseRenderState) { + return (ResourceLocation)LOCATION_BY_VARIANT.get(horseRenderState.variant); + } + + public HorseRenderState createRenderState() { + return new HorseRenderState(); + } + + public void extractRenderState(Horse horse, HorseRenderState horseRenderState, float f) { + super.extractRenderState(horse, horseRenderState, f); + horseRenderState.variant = horse.getVariant(); + horseRenderState.markings = horse.getMarkings(); + horseRenderState.bodyArmorItem = horse.getBodyArmorItem().copy(); } } diff --git a/net/minecraft/client/renderer/entity/HumanoidMobRenderer.java b/net/minecraft/client/renderer/entity/HumanoidMobRenderer.java index 31d1ef91..3e9b049f 100644 --- a/net/minecraft/client/renderer/entity/HumanoidMobRenderer.java +++ b/net/minecraft/client/renderer/entity/HumanoidMobRenderer.java @@ -4,20 +4,71 @@ import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.model.HumanoidModel; import net.minecraft.client.renderer.entity.layers.CustomHeadLayer; -import net.minecraft.client.renderer.entity.layers.ElytraLayer; import net.minecraft.client.renderer.entity.layers.ItemInHandLayer; +import net.minecraft.client.renderer.entity.layers.WingsLayer; +import net.minecraft.client.renderer.entity.state.HumanoidRenderState; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.entity.EquipmentSlot; +import net.minecraft.world.entity.HumanoidArm; +import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.Mob; +import net.minecraft.world.item.CrossbowItem; @Environment(EnvType.CLIENT) -public abstract class HumanoidMobRenderer> extends MobRenderer { +public abstract class HumanoidMobRenderer> extends AgeableMobRenderer { public HumanoidMobRenderer(EntityRendererProvider.Context context, M model, float shadowRadius) { - this(context, model, shadowRadius, 1.0F, 1.0F, 1.0F); + this(context, model, model, shadowRadius); } - public HumanoidMobRenderer(EntityRendererProvider.Context context, M model, float shadowRadius, float scaleX, float scaleY, float scaleZ) { - super(context, model, shadowRadius); - this.addLayer(new CustomHeadLayer<>(this, context.getModelSet(), scaleX, scaleY, scaleZ, context.getItemInHandRenderer())); - this.addLayer(new ElytraLayer<>(this, context.getModelSet())); - this.addLayer(new ItemInHandLayer<>(this, context.getItemInHandRenderer())); + public HumanoidMobRenderer(EntityRendererProvider.Context context, M humanoidModel, M humanoidModel2, float f) { + this(context, humanoidModel, humanoidModel2, f, CustomHeadLayer.Transforms.DEFAULT); + } + + public HumanoidMobRenderer(EntityRendererProvider.Context context, M humanoidModel, M humanoidModel2, float f, CustomHeadLayer.Transforms transforms) { + super(context, humanoidModel, humanoidModel2, f); + this.addLayer(new CustomHeadLayer<>(this, context.getModelSet(), transforms, context.getItemRenderer())); + this.addLayer(new WingsLayer<>(this, context.getModelSet(), context.getEquipmentRenderer())); + this.addLayer(new ItemInHandLayer<>(this, context.getItemRenderer())); + } + + public void extractRenderState(T mob, S humanoidRenderState, float f) { + super.extractRenderState(mob, humanoidRenderState, f); + extractHumanoidRenderState(mob, humanoidRenderState, f); + } + + public static void extractHumanoidRenderState(LivingEntity livingEntity, HumanoidRenderState humanoidRenderState, float f) { + humanoidRenderState.isCrouching = livingEntity.isCrouching(); + humanoidRenderState.isFallFlying = livingEntity.isFallFlying(); + humanoidRenderState.isVisuallySwimming = livingEntity.isVisuallySwimming(); + humanoidRenderState.isPassenger = livingEntity.isPassenger(); + humanoidRenderState.speedValue = 1.0F; + if (humanoidRenderState.isFallFlying) { + humanoidRenderState.speedValue = (float)livingEntity.getDeltaMovement().lengthSqr(); + humanoidRenderState.speedValue /= 0.2F; + humanoidRenderState.speedValue = humanoidRenderState.speedValue * (humanoidRenderState.speedValue * humanoidRenderState.speedValue); + } + + if (humanoidRenderState.speedValue < 1.0F) { + humanoidRenderState.speedValue = 1.0F; + } + + humanoidRenderState.attackTime = livingEntity.getAttackAnim(f); + humanoidRenderState.swimAmount = livingEntity.getSwimAmount(f); + humanoidRenderState.attackArm = getAttackArm(livingEntity); + humanoidRenderState.useItemHand = livingEntity.getUsedItemHand(); + humanoidRenderState.maxCrossbowChargeDuration = CrossbowItem.getChargeDuration(livingEntity.getUseItem(), livingEntity); + humanoidRenderState.ticksUsingItem = livingEntity.getTicksUsingItem(); + humanoidRenderState.isUsingItem = livingEntity.isUsingItem(); + humanoidRenderState.elytraRotX = livingEntity.elytraAnimationState.getRotX(f); + humanoidRenderState.elytraRotY = livingEntity.elytraAnimationState.getRotY(f); + humanoidRenderState.elytraRotZ = livingEntity.elytraAnimationState.getRotZ(f); + humanoidRenderState.chestItem = livingEntity.getItemBySlot(EquipmentSlot.CHEST).copy(); + humanoidRenderState.legsItem = livingEntity.getItemBySlot(EquipmentSlot.LEGS).copy(); + humanoidRenderState.feetItem = livingEntity.getItemBySlot(EquipmentSlot.FEET).copy(); + } + + private static HumanoidArm getAttackArm(LivingEntity livingEntity) { + HumanoidArm humanoidArm = livingEntity.getMainArm(); + return livingEntity.swingingArm == InteractionHand.MAIN_HAND ? humanoidArm : humanoidArm.getOpposite(); } } diff --git a/net/minecraft/client/renderer/entity/HuskRenderer.java b/net/minecraft/client/renderer/entity/HuskRenderer.java index 2fabbda8..18a5be6b 100644 --- a/net/minecraft/client/renderer/entity/HuskRenderer.java +++ b/net/minecraft/client/renderer/entity/HuskRenderer.java @@ -1,28 +1,29 @@ package net.minecraft.client.renderer.entity; -import com.mojang.blaze3d.vertex.PoseStack; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.model.geom.ModelLayers; +import net.minecraft.client.renderer.entity.state.ZombieRenderState; import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.entity.monster.Zombie; @Environment(EnvType.CLIENT) public class HuskRenderer extends ZombieRenderer { private static final ResourceLocation HUSK_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/zombie/husk.png"); public HuskRenderer(EntityRendererProvider.Context context) { - super(context, ModelLayers.HUSK, ModelLayers.HUSK_INNER_ARMOR, ModelLayers.HUSK_OUTER_ARMOR); - } - - protected void scale(Zombie livingEntity, PoseStack poseStack, float partialTickTime) { - float f = 1.0625F; - poseStack.scale(1.0625F, 1.0625F, 1.0625F); - super.scale(livingEntity, poseStack, partialTickTime); + super( + context, + ModelLayers.HUSK, + ModelLayers.HUSK_BABY, + ModelLayers.HUSK_INNER_ARMOR, + ModelLayers.HUSK_OUTER_ARMOR, + ModelLayers.HUSK_BABY_INNER_ARMOR, + ModelLayers.HUSK_BABY_OUTER_ARMOR + ); } @Override - public ResourceLocation getTextureLocation(Zombie entity) { + public ResourceLocation getTextureLocation(ZombieRenderState zombieRenderState) { return HUSK_LOCATION; } } diff --git a/net/minecraft/client/renderer/entity/IllagerRenderer.java b/net/minecraft/client/renderer/entity/IllagerRenderer.java index fefa058c..f1e156c4 100644 --- a/net/minecraft/client/renderer/entity/IllagerRenderer.java +++ b/net/minecraft/client/renderer/entity/IllagerRenderer.java @@ -1,21 +1,30 @@ package net.minecraft.client.renderer.entity; -import com.mojang.blaze3d.vertex.PoseStack; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.model.IllagerModel; import net.minecraft.client.renderer.entity.layers.CustomHeadLayer; +import net.minecraft.client.renderer.entity.state.IllagerRenderState; import net.minecraft.world.entity.monster.AbstractIllager; +import net.minecraft.world.item.CrossbowItem; @Environment(EnvType.CLIENT) -public abstract class IllagerRenderer extends MobRenderer> { - protected IllagerRenderer(EntityRendererProvider.Context context, IllagerModel model, float shadowRadius) { +public abstract class IllagerRenderer extends MobRenderer> { + protected IllagerRenderer(EntityRendererProvider.Context context, IllagerModel model, float shadowRadius) { super(context, model, shadowRadius); - this.addLayer(new CustomHeadLayer<>(this, context.getModelSet(), context.getItemInHandRenderer())); + this.addLayer(new CustomHeadLayer<>(this, context.getModelSet(), context.getItemRenderer())); } - protected void scale(T livingEntity, PoseStack poseStack, float partialTickTime) { - float f = 0.9375F; - poseStack.scale(0.9375F, 0.9375F, 0.9375F); + public void extractRenderState(T abstractIllager, S illagerRenderState, float f) { + super.extractRenderState(abstractIllager, illagerRenderState, f); + illagerRenderState.isRiding = abstractIllager.isPassenger(); + illagerRenderState.mainArm = abstractIllager.getMainArm(); + illagerRenderState.armPose = abstractIllager.getArmPose(); + illagerRenderState.maxCrossbowChargeDuration = illagerRenderState.armPose == AbstractIllager.IllagerArmPose.CROSSBOW_CHARGE + ? CrossbowItem.getChargeDuration(abstractIllager.getUseItem(), abstractIllager) + : 0; + illagerRenderState.ticksUsingItem = abstractIllager.getTicksUsingItem(); + illagerRenderState.attackAnim = abstractIllager.getAttackAnim(f); + illagerRenderState.isAggressive = abstractIllager.isAggressive(); } } diff --git a/net/minecraft/client/renderer/entity/IllusionerRenderer.java b/net/minecraft/client/renderer/entity/IllusionerRenderer.java index 4f8d8449..7010c73a 100644 --- a/net/minecraft/client/renderer/entity/IllusionerRenderer.java +++ b/net/minecraft/client/renderer/entity/IllusionerRenderer.java @@ -1,61 +1,75 @@ package net.minecraft.client.renderer.entity; import com.mojang.blaze3d.vertex.PoseStack; +import java.util.Arrays; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.model.IllagerModel; import net.minecraft.client.model.geom.ModelLayers; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.entity.layers.ItemInHandLayer; +import net.minecraft.client.renderer.entity.state.IllusionerRenderState; import net.minecraft.resources.ResourceLocation; import net.minecraft.util.Mth; import net.minecraft.world.entity.monster.Illusioner; +import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.Vec3; @Environment(EnvType.CLIENT) -public class IllusionerRenderer extends IllagerRenderer { +public class IllusionerRenderer extends IllagerRenderer { private static final ResourceLocation ILLUSIONER = ResourceLocation.withDefaultNamespace("textures/entity/illager/illusioner.png"); public IllusionerRenderer(EntityRendererProvider.Context context) { super(context, new IllagerModel<>(context.bakeLayer(ModelLayers.ILLUSIONER)), 0.5F); - this.addLayer( - new ItemInHandLayer>(this, context.getItemInHandRenderer()) { - public void render( - PoseStack poseStack, MultiBufferSource multiBufferSource, int i, Illusioner illusioner, float f, float g, float h, float j, float k, float l - ) { - if (illusioner.isCastingSpell() || illusioner.isAggressive()) { - super.render(poseStack, multiBufferSource, i, illusioner, f, g, h, j, k, l); - } + this.addLayer(new ItemInHandLayer>(this, context.getItemRenderer()) { + public void render(PoseStack poseStack, MultiBufferSource multiBufferSource, int i, IllusionerRenderState illusionerRenderState, float f, float g) { + if (illusionerRenderState.isCastingSpell || illusionerRenderState.isAggressive) { + super.render(poseStack, multiBufferSource, i, illusionerRenderState, f, g); } } - ); + }); this.model.getHat().visible = true; } - /** - * Returns the location of an entity's texture. - */ - public ResourceLocation getTextureLocation(Illusioner entity) { + public ResourceLocation getTextureLocation(IllusionerRenderState illusionerRenderState) { return ILLUSIONER; } - public void render(Illusioner entity, float entityYaw, float partialTicks, PoseStack poseStack, MultiBufferSource buffer, int packedLight) { - if (entity.isInvisible()) { - Vec3[] vec3s = entity.getIllusionOffsets(partialTicks); - float f = this.getBob(entity, partialTicks); + public IllusionerRenderState createRenderState() { + return new IllusionerRenderState(); + } - for (int i = 0; i < vec3s.length; i++) { + public void extractRenderState(Illusioner illusioner, IllusionerRenderState illusionerRenderState, float f) { + super.extractRenderState(illusioner, illusionerRenderState, f); + Vec3[] vec3s = illusioner.getIllusionOffsets(f); + illusionerRenderState.illusionOffsets = (Vec3[])Arrays.copyOf(vec3s, vec3s.length); + illusionerRenderState.isCastingSpell = illusioner.isCastingSpell(); + } + + public void render(IllusionerRenderState illusionerRenderState, PoseStack poseStack, MultiBufferSource multiBufferSource, int i) { + if (illusionerRenderState.isInvisible) { + Vec3[] vec3s = illusionerRenderState.illusionOffsets; + + for (int j = 0; j < vec3s.length; j++) { poseStack.pushPose(); - poseStack.translate(vec3s[i].x + Mth.cos(i + f * 0.5F) * 0.025, vec3s[i].y + Mth.cos(i + f * 0.75F) * 0.0125, vec3s[i].z + Mth.cos(i + f * 0.7F) * 0.025); - super.render(entity, entityYaw, partialTicks, poseStack, buffer, packedLight); + poseStack.translate( + vec3s[j].x + Mth.cos(j + illusionerRenderState.ageInTicks * 0.5F) * 0.025, + vec3s[j].y + Mth.cos(j + illusionerRenderState.ageInTicks * 0.75F) * 0.0125, + vec3s[j].z + Mth.cos(j + illusionerRenderState.ageInTicks * 0.7F) * 0.025 + ); + super.render(illusionerRenderState, poseStack, multiBufferSource, i); poseStack.popPose(); } } else { - super.render(entity, entityYaw, partialTicks, poseStack, buffer, packedLight); + super.render(illusionerRenderState, poseStack, multiBufferSource, i); } } - protected boolean isBodyVisible(Illusioner livingEntity) { + protected boolean isBodyVisible(IllusionerRenderState illusionerRenderState) { return true; } + + protected AABB getBoundingBoxForCulling(Illusioner illusioner) { + return super.getBoundingBoxForCulling(illusioner).inflate(3.0, 0.0, 3.0); + } } diff --git a/net/minecraft/client/renderer/entity/IronGolemRenderer.java b/net/minecraft/client/renderer/entity/IronGolemRenderer.java index 68984c5d..e2fc381c 100644 --- a/net/minecraft/client/renderer/entity/IronGolemRenderer.java +++ b/net/minecraft/client/renderer/entity/IronGolemRenderer.java @@ -8,33 +8,42 @@ import net.minecraft.client.model.IronGolemModel; import net.minecraft.client.model.geom.ModelLayers; import net.minecraft.client.renderer.entity.layers.IronGolemCrackinessLayer; import net.minecraft.client.renderer.entity.layers.IronGolemFlowerLayer; +import net.minecraft.client.renderer.entity.state.IronGolemRenderState; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.animal.IronGolem; @Environment(EnvType.CLIENT) -public class IronGolemRenderer extends MobRenderer> { +public class IronGolemRenderer extends MobRenderer { private static final ResourceLocation GOLEM_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/iron_golem/iron_golem.png"); public IronGolemRenderer(EntityRendererProvider.Context context) { - super(context, new IronGolemModel<>(context.bakeLayer(ModelLayers.IRON_GOLEM)), 0.7F); + super(context, new IronGolemModel(context.bakeLayer(ModelLayers.IRON_GOLEM)), 0.7F); this.addLayer(new IronGolemCrackinessLayer(this)); this.addLayer(new IronGolemFlowerLayer(this, context.getBlockRenderDispatcher())); } - /** - * Returns the location of an entity's texture. - */ - public ResourceLocation getTextureLocation(IronGolem entity) { + public ResourceLocation getTextureLocation(IronGolemRenderState ironGolemRenderState) { return GOLEM_LOCATION; } - protected void setupRotations(IronGolem entity, PoseStack poseStack, float bob, float yBodyRot, float partialTick, float scale) { - super.setupRotations(entity, poseStack, bob, yBodyRot, partialTick, scale); - if (!(entity.walkAnimation.speed() < 0.01)) { - float f = 13.0F; - float g = entity.walkAnimation.position(partialTick) + 6.0F; - float h = (Math.abs(g % 13.0F - 6.5F) - 3.25F) / 3.25F; - poseStack.mulPose(Axis.ZP.rotationDegrees(6.5F * h)); + public IronGolemRenderState createRenderState() { + return new IronGolemRenderState(); + } + + public void extractRenderState(IronGolem ironGolem, IronGolemRenderState ironGolemRenderState, float f) { + super.extractRenderState(ironGolem, ironGolemRenderState, f); + ironGolemRenderState.attackTicksRemaining = ironGolem.getAttackAnimationTick() > 0.0F ? ironGolem.getAttackAnimationTick() - f : 0.0F; + ironGolemRenderState.offerFlowerTick = ironGolem.getOfferFlowerTick(); + ironGolemRenderState.crackiness = ironGolem.getCrackiness(); + } + + protected void setupRotations(IronGolemRenderState ironGolemRenderState, PoseStack poseStack, float f, float g) { + super.setupRotations(ironGolemRenderState, poseStack, f, g); + if (!(ironGolemRenderState.walkAnimationSpeed < 0.01)) { + float h = 13.0F; + float i = ironGolemRenderState.walkAnimationPos + 6.0F; + float j = (Math.abs(i % 13.0F - 6.5F) - 3.25F) / 3.25F; + poseStack.mulPose(Axis.ZP.rotationDegrees(6.5F * j)); } } } diff --git a/net/minecraft/client/renderer/entity/ItemEntityRenderer.java b/net/minecraft/client/renderer/entity/ItemEntityRenderer.java index c4a56931..516efbe2 100644 --- a/net/minecraft/client/renderer/entity/ItemEntityRenderer.java +++ b/net/minecraft/client/renderer/entity/ItemEntityRenderer.java @@ -6,10 +6,9 @@ import com.mojang.math.Axis; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.entity.state.ItemEntityRenderState; import net.minecraft.client.renderer.texture.OverlayTexture; -import net.minecraft.client.renderer.texture.TextureAtlas; import net.minecraft.client.resources.model.BakedModel; -import net.minecraft.resources.ResourceLocation; import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; import net.minecraft.world.entity.item.ItemEntity; @@ -19,7 +18,7 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; @Environment(EnvType.CLIENT) -public class ItemEntityRenderer extends EntityRenderer { +public class ItemEntityRenderer extends EntityRenderer { private static final float ITEM_BUNDLE_OFFSET_SCALE = 0.15F; private static final float FLAT_ITEM_BUNDLE_OFFSET_X = 0.0F; private static final float FLAT_ITEM_BUNDLE_OFFSET_Y = 0.0F; @@ -34,28 +33,36 @@ public class ItemEntityRenderer extends EntityRenderer { this.shadowStrength = 0.75F; } - /** - * Returns the location of an entity's texture. - */ - public ResourceLocation getTextureLocation(ItemEntity entity) { - return TextureAtlas.LOCATION_BLOCKS; + public ItemEntityRenderState createRenderState() { + return new ItemEntityRenderState(); } - public void render(ItemEntity entity, float entityYaw, float partialTicks, PoseStack poseStack, MultiBufferSource buffer, int packedLight) { - poseStack.pushPose(); - ItemStack itemStack = entity.getItem(); - this.random.setSeed(getSeedForItemStack(itemStack)); - BakedModel bakedModel = this.itemRenderer.getModel(itemStack, entity.level(), null, entity.getId()); - boolean bl = bakedModel.isGui3d(); - float f = 0.25F; - float g = Mth.sin((entity.getAge() + partialTicks) / 10.0F + entity.bobOffs) * 0.1F + 0.1F; - float h = bakedModel.getTransforms().getTransform(ItemDisplayContext.GROUND).scale.y(); - poseStack.translate(0.0F, g + 0.25F * h, 0.0F); - float i = entity.getSpin(partialTicks); - poseStack.mulPose(Axis.YP.rotation(i)); - renderMultipleFromCount(this.itemRenderer, poseStack, buffer, packedLight, itemStack, bakedModel, bl, this.random); - poseStack.popPose(); - super.render(entity, entityYaw, partialTicks, poseStack, buffer, packedLight); + public void extractRenderState(ItemEntity itemEntity, ItemEntityRenderState itemEntityRenderState, float f) { + super.extractRenderState(itemEntity, itemEntityRenderState, f); + itemEntityRenderState.ageInTicks = itemEntity.getAge() + f; + itemEntityRenderState.bobOffset = itemEntity.bobOffs; + ItemStack itemStack = itemEntity.getItem(); + itemEntityRenderState.item = itemStack.copy(); + itemEntityRenderState.itemModel = this.itemRenderer.getModel(itemStack, itemEntity.level(), null, itemEntity.getId()); + } + + public void render(ItemEntityRenderState itemEntityRenderState, PoseStack poseStack, MultiBufferSource multiBufferSource, int i) { + BakedModel bakedModel = itemEntityRenderState.itemModel; + if (bakedModel != null) { + poseStack.pushPose(); + ItemStack itemStack = itemEntityRenderState.item; + this.random.setSeed(getSeedForItemStack(itemStack)); + boolean bl = bakedModel.isGui3d(); + float f = 0.25F; + float g = Mth.sin(itemEntityRenderState.ageInTicks / 10.0F + itemEntityRenderState.bobOffset) * 0.1F + 0.1F; + float h = bakedModel.getTransforms().getTransform(ItemDisplayContext.GROUND).scale.y(); + poseStack.translate(0.0F, g + 0.25F * h, 0.0F); + float j = ItemEntity.getSpin(itemEntityRenderState.ageInTicks, itemEntityRenderState.bobOffset); + poseStack.mulPose(Axis.YP.rotation(j)); + renderMultipleFromCount(this.itemRenderer, poseStack, multiBufferSource, i, itemStack, bakedModel, bl, this.random); + poseStack.popPose(); + super.render(itemEntityRenderState, poseStack, multiBufferSource, i); + } } public static int getSeedForItemStack(ItemStack stack) { diff --git a/net/minecraft/client/renderer/entity/ItemFrameRenderer.java b/net/minecraft/client/renderer/entity/ItemFrameRenderer.java index efbd04d6..903e193a 100644 --- a/net/minecraft/client/renderer/entity/ItemFrameRenderer.java +++ b/net/minecraft/client/renderer/entity/ItemFrameRenderer.java @@ -5,42 +5,40 @@ import com.mojang.math.Axis; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.MapRenderer; import net.minecraft.client.renderer.MultiBufferSource; -import net.minecraft.client.renderer.Sheets; +import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.block.BlockRenderDispatcher; +import net.minecraft.client.renderer.entity.state.ItemFrameRenderState; import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.client.renderer.texture.TextureAtlas; +import net.minecraft.client.resources.model.BlockStateModelLoader; import net.minecraft.client.resources.model.ModelManager; import net.minecraft.client.resources.model.ModelResourceLocation; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.component.DataComponents; import net.minecraft.network.chat.Component; -import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.decoration.ItemFrame; import net.minecraft.world.item.ItemDisplayContext; import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.Items; -import net.minecraft.world.item.MapItem; import net.minecraft.world.level.saveddata.maps.MapId; import net.minecraft.world.level.saveddata.maps.MapItemSavedData; import net.minecraft.world.phys.Vec3; @Environment(EnvType.CLIENT) -public class ItemFrameRenderer extends EntityRenderer { - private static final ModelResourceLocation FRAME_LOCATION = ModelResourceLocation.vanilla("item_frame", "map=false"); - private static final ModelResourceLocation MAP_FRAME_LOCATION = ModelResourceLocation.vanilla("item_frame", "map=true"); - private static final ModelResourceLocation GLOW_FRAME_LOCATION = ModelResourceLocation.vanilla("glow_item_frame", "map=false"); - private static final ModelResourceLocation GLOW_MAP_FRAME_LOCATION = ModelResourceLocation.vanilla("glow_item_frame", "map=true"); +public class ItemFrameRenderer extends EntityRenderer { public static final int GLOW_FRAME_BRIGHTNESS = 5; public static final int BRIGHT_MAP_LIGHT_ADJUSTMENT = 30; private final ItemRenderer itemRenderer; + private final MapRenderer mapRenderer; private final BlockRenderDispatcher blockRenderer; public ItemFrameRenderer(EntityRendererProvider.Context context) { super(context); this.itemRenderer = context.getItemRenderer(); + this.mapRenderer = context.getMapRenderer(); this.blockRenderer = context.getBlockRenderDispatcher(); } @@ -48,108 +46,128 @@ public class ItemFrameRenderer extends EntityRenderer { return entity.getType() == EntityType.GLOW_ITEM_FRAME ? Math.max(5, super.getBlockLightLevel(entity, pos)) : super.getBlockLightLevel(entity, pos); } - public void render(T entity, float entityYaw, float partialTicks, PoseStack poseStack, MultiBufferSource buffer, int packedLight) { - super.render(entity, entityYaw, partialTicks, poseStack, buffer, packedLight); + public void render(ItemFrameRenderState itemFrameRenderState, PoseStack poseStack, MultiBufferSource multiBufferSource, int i) { + super.render(itemFrameRenderState, poseStack, multiBufferSource, i); poseStack.pushPose(); - Direction direction = entity.getDirection(); - Vec3 vec3 = this.getRenderOffset(entity, partialTicks); + Direction direction = itemFrameRenderState.direction; + Vec3 vec3 = this.getRenderOffset(itemFrameRenderState); poseStack.translate(-vec3.x(), -vec3.y(), -vec3.z()); double d = 0.46875; poseStack.translate(direction.getStepX() * 0.46875, direction.getStepY() * 0.46875, direction.getStepZ() * 0.46875); - poseStack.mulPose(Axis.XP.rotationDegrees(entity.getXRot())); - poseStack.mulPose(Axis.YP.rotationDegrees(180.0F - entity.getYRot())); - boolean bl = entity.isInvisible(); - ItemStack itemStack = entity.getItem(); - if (!bl) { + float f; + float g; + if (direction.getAxis().isHorizontal()) { + f = 0.0F; + g = 180.0F - direction.toYRot(); + } else { + f = -90 * direction.getAxisDirection().getStep(); + g = 180.0F; + } + + poseStack.mulPose(Axis.XP.rotationDegrees(f)); + poseStack.mulPose(Axis.YP.rotationDegrees(g)); + ItemStack itemStack = itemFrameRenderState.itemStack; + if (!itemFrameRenderState.isInvisible) { ModelManager modelManager = this.blockRenderer.getBlockModelShaper().getModelManager(); - ModelResourceLocation modelResourceLocation = this.getFrameModelResourceLoc(entity, itemStack); + ModelResourceLocation modelResourceLocation = this.getFrameModelResourceLoc(itemFrameRenderState.isGlowFrame, itemStack); poseStack.pushPose(); poseStack.translate(-0.5F, -0.5F, -0.5F); this.blockRenderer .getModelRenderer() .renderModel( poseStack.last(), - buffer.getBuffer(Sheets.solidBlockSheet()), + multiBufferSource.getBuffer(RenderType.entitySolidZOffsetForward(TextureAtlas.LOCATION_BLOCKS)), null, modelManager.getModel(modelResourceLocation), 1.0F, 1.0F, 1.0F, - packedLight, + i, OverlayTexture.NO_OVERLAY ); poseStack.popPose(); } if (!itemStack.isEmpty()) { - MapId mapId = entity.getFramedMapId(itemStack); - if (bl) { + MapId mapId = itemFrameRenderState.mapId; + if (itemFrameRenderState.isInvisible) { poseStack.translate(0.0F, 0.0F, 0.5F); } else { poseStack.translate(0.0F, 0.0F, 0.4375F); } - int i = mapId != null ? entity.getRotation() % 4 * 2 : entity.getRotation(); - poseStack.mulPose(Axis.ZP.rotationDegrees(i * 360.0F / 8.0F)); + int j = mapId != null ? itemFrameRenderState.rotation % 4 * 2 : itemFrameRenderState.rotation; + poseStack.mulPose(Axis.ZP.rotationDegrees(j * 360.0F / 8.0F)); if (mapId != null) { poseStack.mulPose(Axis.ZP.rotationDegrees(180.0F)); - float f = 0.0078125F; + float h = 0.0078125F; poseStack.scale(0.0078125F, 0.0078125F, 0.0078125F); poseStack.translate(-64.0F, -64.0F, 0.0F); - MapItemSavedData mapItemSavedData = MapItem.getSavedData(mapId, entity.level()); poseStack.translate(0.0F, 0.0F, -1.0F); - if (mapItemSavedData != null) { - int j = this.getLightVal(entity, 15728850, packedLight); - Minecraft.getInstance().gameRenderer.getMapRenderer().render(poseStack, buffer, mapId, mapItemSavedData, true, j); - } - } else { - int k = this.getLightVal(entity, 15728880, packedLight); + int k = this.getLightVal(itemFrameRenderState.isGlowFrame, 15728850, i); + this.mapRenderer.render(itemFrameRenderState.mapRenderState, poseStack, multiBufferSource, true, k); + } else if (itemFrameRenderState.itemModel != null) { + int l = this.getLightVal(itemFrameRenderState.isGlowFrame, 15728880, i); poseStack.scale(0.5F, 0.5F, 0.5F); - this.itemRenderer.renderStatic(itemStack, ItemDisplayContext.FIXED, k, OverlayTexture.NO_OVERLAY, poseStack, buffer, entity.level(), entity.getId()); + this.itemRenderer + .render(itemStack, ItemDisplayContext.FIXED, false, poseStack, multiBufferSource, l, OverlayTexture.NO_OVERLAY, itemFrameRenderState.itemModel); } } poseStack.popPose(); } - private int getLightVal(T itemFrame, int glowLightVal, int regularLightVal) { - return itemFrame.getType() == EntityType.GLOW_ITEM_FRAME ? glowLightVal : regularLightVal; + private int getLightVal(boolean bl, int i, int j) { + return bl ? i : j; } - private ModelResourceLocation getFrameModelResourceLoc(T entity, ItemStack item) { - boolean bl = entity.getType() == EntityType.GLOW_ITEM_FRAME; - if (item.is(Items.FILLED_MAP)) { - return bl ? GLOW_MAP_FRAME_LOCATION : MAP_FRAME_LOCATION; + private ModelResourceLocation getFrameModelResourceLoc(boolean bl, ItemStack itemStack) { + if (itemStack.has(DataComponents.MAP_ID)) { + return bl ? BlockStateModelLoader.GLOW_MAP_FRAME_LOCATION : BlockStateModelLoader.MAP_FRAME_LOCATION; } else { - return bl ? GLOW_FRAME_LOCATION : FRAME_LOCATION; + return bl ? BlockStateModelLoader.GLOW_FRAME_LOCATION : BlockStateModelLoader.FRAME_LOCATION; } } - public Vec3 getRenderOffset(T entity, float partialTicks) { - return new Vec3(entity.getDirection().getStepX() * 0.3F, -0.25, entity.getDirection().getStepZ() * 0.3F); + public Vec3 getRenderOffset(ItemFrameRenderState itemFrameRenderState) { + return new Vec3(itemFrameRenderState.direction.getStepX() * 0.3F, -0.25, itemFrameRenderState.direction.getStepZ() * 0.3F); } - /** - * Returns the location of an entity's texture. - */ - public ResourceLocation getTextureLocation(T entity) { - return TextureAtlas.LOCATION_BLOCKS; + protected boolean shouldShowName(T itemFrame, double d) { + return Minecraft.renderNames() + && !itemFrame.getItem().isEmpty() + && itemFrame.getItem().has(DataComponents.CUSTOM_NAME) + && this.entityRenderDispatcher.crosshairPickEntity == itemFrame; } - protected boolean shouldShowName(T entity) { - if (Minecraft.renderNames() - && !entity.getItem().isEmpty() - && entity.getItem().has(DataComponents.CUSTOM_NAME) - && this.entityRenderDispatcher.crosshairPickEntity == entity) { - double d = this.entityRenderDispatcher.distanceToSqr(entity); - float f = entity.isDiscrete() ? 32.0F : 64.0F; - return d < f * f; - } else { - return false; + protected Component getNameTag(T itemFrame) { + return itemFrame.getItem().getHoverName(); + } + + public ItemFrameRenderState createRenderState() { + return new ItemFrameRenderState(); + } + + public void extractRenderState(T itemFrame, ItemFrameRenderState itemFrameRenderState, float f) { + super.extractRenderState(itemFrame, itemFrameRenderState, f); + itemFrameRenderState.direction = itemFrame.getDirection(); + ItemStack itemStack = itemFrame.getItem(); + itemFrameRenderState.itemStack = itemStack.copy(); + itemFrameRenderState.rotation = itemFrame.getRotation(); + itemFrameRenderState.isGlowFrame = itemFrame.getType() == EntityType.GLOW_ITEM_FRAME; + itemFrameRenderState.itemModel = null; + itemFrameRenderState.mapId = null; + if (!itemFrameRenderState.itemStack.isEmpty()) { + MapId mapId = itemFrame.getFramedMapId(itemStack); + if (mapId != null) { + MapItemSavedData mapItemSavedData = itemFrame.level().getMapData(mapId); + if (mapItemSavedData != null) { + this.mapRenderer.extractRenderState(mapId, mapItemSavedData, itemFrameRenderState.mapRenderState); + itemFrameRenderState.mapId = mapId; + } + } else { + itemFrameRenderState.itemModel = this.itemRenderer.getModel(itemStack, itemFrame.level(), null, itemFrame.getId()); + } } } - - protected void renderNameTag(T entity, Component displayName, PoseStack poseStack, MultiBufferSource bufferSource, int packedLight, float partialTick) { - super.renderNameTag(entity, entity.getItem().getHoverName(), poseStack, bufferSource, packedLight, partialTick); - } } diff --git a/net/minecraft/client/renderer/entity/ItemRenderer.java b/net/minecraft/client/renderer/entity/ItemRenderer.java index fb18a8c5..d399490a 100644 --- a/net/minecraft/client/renderer/entity/ItemRenderer.java +++ b/net/minecraft/client/renderer/entity/ItemRenderer.java @@ -1,13 +1,11 @@ package net.minecraft.client.renderer.entity; -import com.google.common.collect.Sets; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.SheetedDecalTextureGenerator; import com.mojang.blaze3d.vertex.VertexConsumer; import com.mojang.blaze3d.vertex.VertexMultiConsumer; import com.mojang.math.MatrixUtil; import java.util.List; -import java.util.Set; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.Minecraft; @@ -20,72 +18,48 @@ import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.Sheets; import net.minecraft.client.renderer.block.model.BakedQuad; -import net.minecraft.client.renderer.texture.TextureManager; import net.minecraft.client.resources.model.BakedModel; import net.minecraft.client.resources.model.ModelManager; import net.minecraft.client.resources.model.ModelResourceLocation; import net.minecraft.core.Direction; -import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.packs.resources.ResourceManager; import net.minecraft.server.packs.resources.ResourceManagerReloadListener; import net.minecraft.tags.ItemTags; -import net.minecraft.util.FastColor; +import net.minecraft.util.ARGB; import net.minecraft.util.RandomSource; import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.item.BlockItem; -import net.minecraft.world.item.Item; +import net.minecraft.world.item.BundleItem; import net.minecraft.world.item.ItemDisplayContext; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.level.Level; -import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.block.HalfTransparentBlock; -import net.minecraft.world.level.block.StainedGlassPaneBlock; import org.jetbrains.annotations.Nullable; @Environment(EnvType.CLIENT) public class ItemRenderer implements ResourceManagerReloadListener { public static final ResourceLocation ENCHANTED_GLINT_ENTITY = ResourceLocation.withDefaultNamespace("textures/misc/enchanted_glint_entity.png"); public static final ResourceLocation ENCHANTED_GLINT_ITEM = ResourceLocation.withDefaultNamespace("textures/misc/enchanted_glint_item.png"); - private static final Set IGNORED = Sets.newHashSet(Items.AIR); public static final int GUI_SLOT_CENTER_X = 8; public static final int GUI_SLOT_CENTER_Y = 8; - public static final int ITEM_COUNT_BLIT_OFFSET = 200; + public static final int ITEM_DECORATION_BLIT_OFFSET = 200; public static final float COMPASS_FOIL_UI_SCALE = 0.5F; public static final float COMPASS_FOIL_FIRST_PERSON_SCALE = 0.75F; public static final float COMPASS_FOIL_TEXTURE_SCALE = 0.0078125F; - private static final ModelResourceLocation TRIDENT_MODEL = ModelResourceLocation.inventory(ResourceLocation.withDefaultNamespace("trident")); - public static final ModelResourceLocation TRIDENT_IN_HAND_MODEL = ModelResourceLocation.inventory(ResourceLocation.withDefaultNamespace("trident_in_hand")); - private static final ModelResourceLocation SPYGLASS_MODEL = ModelResourceLocation.inventory(ResourceLocation.withDefaultNamespace("spyglass")); - public static final ModelResourceLocation SPYGLASS_IN_HAND_MODEL = ModelResourceLocation.inventory(ResourceLocation.withDefaultNamespace("spyglass_in_hand")); - private final Minecraft minecraft; + public static final ModelResourceLocation TRIDENT_MODEL = ModelResourceLocation.inventory(ResourceLocation.withDefaultNamespace("trident")); + public static final ModelResourceLocation SPYGLASS_MODEL = ModelResourceLocation.inventory(ResourceLocation.withDefaultNamespace("spyglass")); + private final ModelManager modelManager; private final ItemModelShaper itemModelShaper; - private final TextureManager textureManager; private final ItemColors itemColors; private final BlockEntityWithoutLevelRenderer blockEntityRenderer; - public ItemRenderer( - Minecraft minecraft, TextureManager textureManager, ModelManager modelManager, ItemColors itemColors, BlockEntityWithoutLevelRenderer blockEntityRenderer - ) { - this.minecraft = minecraft; - this.textureManager = textureManager; + public ItemRenderer(ModelManager modelManager, ItemColors itemColors, BlockEntityWithoutLevelRenderer blockEntityWithoutLevelRenderer) { + this.modelManager = modelManager; this.itemModelShaper = new ItemModelShaper(modelManager); - this.blockEntityRenderer = blockEntityRenderer; - - for (Item item : BuiltInRegistries.ITEM) { - if (!IGNORED.contains(item)) { - this.itemModelShaper.register(item, ModelResourceLocation.inventory(BuiltInRegistries.ITEM.getKey(item))); - } - } - + this.blockEntityRenderer = blockEntityWithoutLevelRenderer; this.itemColors = itemColors; } - public ItemModelShaper getItemModelShaper() { - return this.itemModelShaper; - } - private void renderModelLists(BakedModel model, ItemStack stack, int combinedLight, int combinedOverlay, PoseStack poseStack, VertexConsumer buffer) { RandomSource randomSource = RandomSource.create(); long l = 42L; @@ -110,53 +84,118 @@ public class ItemRenderer implements ResourceManagerReloadListener { BakedModel model ) { if (!itemStack.isEmpty()) { - poseStack.pushPose(); - boolean bl = displayContext == ItemDisplayContext.GUI || displayContext == ItemDisplayContext.GROUND || displayContext == ItemDisplayContext.FIXED; - if (bl) { - if (itemStack.is(Items.TRIDENT)) { - model = this.itemModelShaper.getModelManager().getModel(TRIDENT_MODEL); - } else if (itemStack.is(Items.SPYGLASS)) { - model = this.itemModelShaper.getModelManager().getModel(SPYGLASS_MODEL); - } - } - - model.getTransforms().getTransform(displayContext).apply(leftHand, poseStack); - poseStack.translate(-0.5F, -0.5F, -0.5F); - if (!model.isCustomRenderer() && (!itemStack.is(Items.TRIDENT) || bl)) { - boolean bl2; - if (displayContext != ItemDisplayContext.GUI && !displayContext.firstPerson() && itemStack.getItem() instanceof BlockItem blockItem) { - Block block = blockItem.getBlock(); - bl2 = !(block instanceof HalfTransparentBlock) && !(block instanceof StainedGlassPaneBlock); - } else { - bl2 = true; - } - - RenderType renderType = ItemBlockRenderTypes.getRenderType(itemStack, bl2); - VertexConsumer vertexConsumer; - if (hasAnimatedTexture(itemStack) && itemStack.hasFoil()) { - PoseStack.Pose pose = poseStack.last().copy(); - if (displayContext == ItemDisplayContext.GUI) { - MatrixUtil.mulComponentWise(pose.pose(), 0.5F); - } else if (displayContext.firstPerson()) { - MatrixUtil.mulComponentWise(pose.pose(), 0.75F); - } - - vertexConsumer = getCompassFoilBuffer(bufferSource, renderType, pose); - } else if (bl2) { - vertexConsumer = getFoilBufferDirect(bufferSource, renderType, true, itemStack.hasFoil()); - } else { - vertexConsumer = getFoilBuffer(bufferSource, renderType, true, itemStack.hasFoil()); - } - - this.renderModelLists(model, itemStack, combinedLight, combinedOverlay, poseStack, vertexConsumer); - } else { - this.blockEntityRenderer.renderByItem(itemStack, displayContext, poseStack, bufferSource, combinedLight, combinedOverlay); - } - - poseStack.popPose(); + this.renderSimpleItemModel( + itemStack, displayContext, leftHand, poseStack, bufferSource, combinedLight, combinedOverlay, model, shouldRenderItemFlat(displayContext) + ); } } + public void renderBundleItem( + ItemStack itemStack, + ItemDisplayContext itemDisplayContext, + boolean bl, + PoseStack poseStack, + MultiBufferSource multiBufferSource, + int i, + int j, + BakedModel bakedModel, + @Nullable Level level, + @Nullable LivingEntity livingEntity, + int k + ) { + if (itemStack.getItem() instanceof BundleItem bundleItem) { + if (BundleItem.hasSelectedItem(itemStack)) { + boolean bl2 = shouldRenderItemFlat(itemDisplayContext); + BakedModel bakedModel2 = this.resolveModelOverride(this.itemModelShaper.getItemModel(bundleItem.openBackModel()), itemStack, level, livingEntity, k); + this.renderItemModelRaw(itemStack, itemDisplayContext, bl, poseStack, multiBufferSource, i, j, bakedModel2, bl2, -1.5F); + ItemStack itemStack2 = BundleItem.getSelectedItemStack(itemStack); + BakedModel bakedModel3 = this.getModel(itemStack2, level, livingEntity, k); + this.renderSimpleItemModel(itemStack2, itemDisplayContext, bl, poseStack, multiBufferSource, i, j, bakedModel3, bl2); + BakedModel bakedModel4 = this.resolveModelOverride(this.itemModelShaper.getItemModel(bundleItem.openFrontModel()), itemStack, level, livingEntity, k); + this.renderItemModelRaw(itemStack, itemDisplayContext, bl, poseStack, multiBufferSource, i, j, bakedModel4, bl2, 0.5F); + } else { + this.render(itemStack, itemDisplayContext, bl, poseStack, multiBufferSource, i, j, bakedModel); + } + } + } + + private void renderSimpleItemModel( + ItemStack itemStack, + ItemDisplayContext itemDisplayContext, + boolean bl, + PoseStack poseStack, + MultiBufferSource multiBufferSource, + int i, + int j, + BakedModel bakedModel, + boolean bl2 + ) { + if (bl2) { + if (itemStack.is(Items.TRIDENT)) { + bakedModel = this.modelManager.getModel(TRIDENT_MODEL); + } else if (itemStack.is(Items.SPYGLASS)) { + bakedModel = this.modelManager.getModel(SPYGLASS_MODEL); + } + } + + this.renderItemModelRaw(itemStack, itemDisplayContext, bl, poseStack, multiBufferSource, i, j, bakedModel, bl2, -0.5F); + } + + private void renderItemModelRaw( + ItemStack itemStack, + ItemDisplayContext itemDisplayContext, + boolean bl, + PoseStack poseStack, + MultiBufferSource multiBufferSource, + int i, + int j, + BakedModel bakedModel, + boolean bl2, + float f + ) { + poseStack.pushPose(); + bakedModel.getTransforms().getTransform(itemDisplayContext).apply(bl, poseStack); + poseStack.translate(-0.5F, -0.5F, f); + this.renderItem(itemStack, itemDisplayContext, poseStack, multiBufferSource, i, j, bakedModel, bl2); + poseStack.popPose(); + } + + private void renderItem( + ItemStack itemStack, + ItemDisplayContext itemDisplayContext, + PoseStack poseStack, + MultiBufferSource multiBufferSource, + int i, + int j, + BakedModel bakedModel, + boolean bl + ) { + if (!bakedModel.isCustomRenderer() && (!itemStack.is(Items.TRIDENT) || bl)) { + RenderType renderType = ItemBlockRenderTypes.getRenderType(itemStack); + VertexConsumer vertexConsumer; + if (hasAnimatedTexture(itemStack) && itemStack.hasFoil()) { + PoseStack.Pose pose = poseStack.last().copy(); + if (itemDisplayContext == ItemDisplayContext.GUI) { + MatrixUtil.mulComponentWise(pose.pose(), 0.5F); + } else if (itemDisplayContext.firstPerson()) { + MatrixUtil.mulComponentWise(pose.pose(), 0.75F); + } + + vertexConsumer = getCompassFoilBuffer(multiBufferSource, renderType, pose); + } else { + vertexConsumer = getFoilBuffer(multiBufferSource, renderType, true, itemStack.hasFoil()); + } + + this.renderModelLists(bakedModel, itemStack, i, j, poseStack, vertexConsumer); + } else { + this.blockEntityRenderer.renderByItem(itemStack, itemDisplayContext, poseStack, multiBufferSource, i, j); + } + } + + private static boolean shouldRenderItemFlat(ItemDisplayContext itemDisplayContext) { + return itemDisplayContext == ItemDisplayContext.GUI || itemDisplayContext == ItemDisplayContext.GROUND || itemDisplayContext == ItemDisplayContext.FIXED; + } + private static boolean hasAnimatedTexture(ItemStack stack) { return stack.is(ItemTags.COMPASSES) || stack.is(Items.CLOCK); } @@ -183,12 +222,6 @@ public class ItemRenderer implements ResourceManagerReloadListener { } } - public static VertexConsumer getFoilBufferDirect(MultiBufferSource bufferSource, RenderType renderType, boolean noEntity, boolean withGlint) { - return withGlint - ? VertexMultiConsumer.create(bufferSource.getBuffer(noEntity ? RenderType.glint() : RenderType.entityGlintDirect()), bufferSource.getBuffer(renderType)) - : bufferSource.getBuffer(renderType); - } - private void renderQuadList(PoseStack poseStack, VertexConsumer buffer, List quads, ItemStack itemStack, int combinedLight, int combinedOverlay) { boolean bl = !itemStack.isEmpty(); PoseStack.Pose pose = poseStack.last(); @@ -199,27 +232,17 @@ public class ItemRenderer implements ResourceManagerReloadListener { i = this.itemColors.getColor(itemStack, bakedQuad.getTintIndex()); } - float f = FastColor.ARGB32.alpha(i) / 255.0F; - float g = FastColor.ARGB32.red(i) / 255.0F; - float h = FastColor.ARGB32.green(i) / 255.0F; - float j = FastColor.ARGB32.blue(i) / 255.0F; + float f = ARGB.alpha(i) / 255.0F; + float g = ARGB.red(i) / 255.0F; + float h = ARGB.green(i) / 255.0F; + float j = ARGB.blue(i) / 255.0F; buffer.putBulkData(pose, bakedQuad, g, h, j, f, combinedLight, combinedOverlay); } } public BakedModel getModel(ItemStack stack, @Nullable Level level, @Nullable LivingEntity entity, int seed) { - BakedModel bakedModel; - if (stack.is(Items.TRIDENT)) { - bakedModel = this.itemModelShaper.getModelManager().getModel(TRIDENT_IN_HAND_MODEL); - } else if (stack.is(Items.SPYGLASS)) { - bakedModel = this.itemModelShaper.getModelManager().getModel(SPYGLASS_IN_HAND_MODEL); - } else { - bakedModel = this.itemModelShaper.getItemModel(stack); - } - - ClientLevel clientLevel = level instanceof ClientLevel ? (ClientLevel)level : null; - BakedModel bakedModel2 = bakedModel.getOverrides().resolve(bakedModel, stack, clientLevel, entity, seed); - return bakedModel2 == null ? this.itemModelShaper.getModelManager().getMissingModel() : bakedModel2; + BakedModel bakedModel = this.itemModelShaper.getItemModel(stack); + return this.resolveModelOverride(bakedModel, stack, level, entity, seed); } public void renderStatic( @@ -255,6 +278,17 @@ public class ItemRenderer implements ResourceManagerReloadListener { @Override public void onResourceManagerReload(ResourceManager resourceManager) { - this.itemModelShaper.rebuildCache(); + this.itemModelShaper.invalidateCache(); + } + + @Nullable + public BakedModel resolveItemModel(ItemStack itemStack, LivingEntity livingEntity, ItemDisplayContext itemDisplayContext) { + return itemStack.isEmpty() ? null : this.getModel(itemStack, livingEntity.level(), livingEntity, livingEntity.getId() + itemDisplayContext.ordinal()); + } + + private BakedModel resolveModelOverride(BakedModel bakedModel, ItemStack itemStack, @Nullable Level level, @Nullable LivingEntity livingEntity, int i) { + ClientLevel clientLevel = level instanceof ClientLevel ? (ClientLevel)level : null; + BakedModel bakedModel2 = bakedModel.overrides().findOverride(itemStack, clientLevel, livingEntity, i); + return bakedModel2 == null ? bakedModel : bakedModel2; } } diff --git a/net/minecraft/client/renderer/entity/LeashKnotRenderer.java b/net/minecraft/client/renderer/entity/LeashKnotRenderer.java index 7b59b67a..0649adb9 100644 --- a/net/minecraft/client/renderer/entity/LeashKnotRenderer.java +++ b/net/minecraft/client/renderer/entity/LeashKnotRenderer.java @@ -7,34 +7,34 @@ import net.fabricmc.api.Environment; import net.minecraft.client.model.LeashKnotModel; import net.minecraft.client.model.geom.ModelLayers; import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.entity.state.EntityRenderState; import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.decoration.LeashFenceKnotEntity; @Environment(EnvType.CLIENT) -public class LeashKnotRenderer extends EntityRenderer { +public class LeashKnotRenderer extends EntityRenderer { private static final ResourceLocation KNOT_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/lead_knot.png"); - private final LeashKnotModel model; + private final LeashKnotModel model; public LeashKnotRenderer(EntityRendererProvider.Context context) { super(context); - this.model = new LeashKnotModel<>(context.bakeLayer(ModelLayers.LEASH_KNOT)); + this.model = new LeashKnotModel(context.bakeLayer(ModelLayers.LEASH_KNOT)); } - public void render(LeashFenceKnotEntity entity, float entityYaw, float partialTicks, PoseStack poseStack, MultiBufferSource buffer, int packedLight) { + @Override + public void render(EntityRenderState entityRenderState, PoseStack poseStack, MultiBufferSource multiBufferSource, int i) { poseStack.pushPose(); poseStack.scale(-1.0F, -1.0F, 1.0F); - this.model.setupAnim(entity, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F); - VertexConsumer vertexConsumer = buffer.getBuffer(this.model.renderType(KNOT_LOCATION)); - this.model.renderToBuffer(poseStack, vertexConsumer, packedLight, OverlayTexture.NO_OVERLAY); + this.model.setupAnim(entityRenderState); + VertexConsumer vertexConsumer = multiBufferSource.getBuffer(this.model.renderType(KNOT_LOCATION)); + this.model.renderToBuffer(poseStack, vertexConsumer, i, OverlayTexture.NO_OVERLAY); poseStack.popPose(); - super.render(entity, entityYaw, partialTicks, poseStack, buffer, packedLight); + super.render(entityRenderState, poseStack, multiBufferSource, i); } - /** - * Returns the location of an entity's texture. - */ - public ResourceLocation getTextureLocation(LeashFenceKnotEntity entity) { - return KNOT_LOCATION; + @Override + public EntityRenderState createRenderState() { + return new EntityRenderState(); } } diff --git a/net/minecraft/client/renderer/entity/LightningBoltRenderer.java b/net/minecraft/client/renderer/entity/LightningBoltRenderer.java index dda8be41..0b82ec37 100644 --- a/net/minecraft/client/renderer/entity/LightningBoltRenderer.java +++ b/net/minecraft/client/renderer/entity/LightningBoltRenderer.java @@ -6,81 +6,80 @@ import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderType; -import net.minecraft.client.renderer.texture.TextureAtlas; -import net.minecraft.resources.ResourceLocation; +import net.minecraft.client.renderer.entity.state.LightningBoltRenderState; import net.minecraft.util.RandomSource; import net.minecraft.world.entity.LightningBolt; import org.joml.Matrix4f; @Environment(EnvType.CLIENT) -public class LightningBoltRenderer extends EntityRenderer { +public class LightningBoltRenderer extends EntityRenderer { public LightningBoltRenderer(EntityRendererProvider.Context context) { super(context); } - public void render(LightningBolt entity, float entityYaw, float partialTicks, PoseStack poseStack, MultiBufferSource buffer, int packedLight) { + public void render(LightningBoltRenderState lightningBoltRenderState, PoseStack poseStack, MultiBufferSource multiBufferSource, int i) { float[] fs = new float[8]; float[] gs = new float[8]; float f = 0.0F; float g = 0.0F; - RandomSource randomSource = RandomSource.create(entity.seed); + RandomSource randomSource = RandomSource.create(lightningBoltRenderState.seed); - for (int i = 7; i >= 0; i--) { - fs[i] = f; - gs[i] = g; + for (int j = 7; j >= 0; j--) { + fs[j] = f; + gs[j] = g; f += randomSource.nextInt(11) - 5; g += randomSource.nextInt(11) - 5; } - VertexConsumer vertexConsumer = buffer.getBuffer(RenderType.lightning()); + VertexConsumer vertexConsumer = multiBufferSource.getBuffer(RenderType.lightning()); Matrix4f matrix4f = poseStack.last().pose(); - for (int j = 0; j < 4; j++) { - RandomSource randomSource2 = RandomSource.create(entity.seed); + for (int k = 0; k < 4; k++) { + RandomSource randomSource2 = RandomSource.create(lightningBoltRenderState.seed); - for (int k = 0; k < 3; k++) { - int l = 7; - int m = 0; - if (k > 0) { - l = 7 - k; + for (int l = 0; l < 3; l++) { + int m = 7; + int n = 0; + if (l > 0) { + m = 7 - l; } - if (k > 0) { - m = l - 2; + if (l > 0) { + n = m - 2; } - float h = fs[l] - f; - float n = gs[l] - g; + float h = fs[m] - f; + float o = gs[m] - g; - for (int o = l; o >= m; o--) { - float p = h; - float q = n; - if (k == 0) { + for (int p = m; p >= n; p--) { + float q = h; + float r = o; + if (l == 0) { h += randomSource2.nextInt(11) - 5; - n += randomSource2.nextInt(11) - 5; + o += randomSource2.nextInt(11) - 5; } else { h += randomSource2.nextInt(31) - 15; - n += randomSource2.nextInt(31) - 15; + o += randomSource2.nextInt(31) - 15; } - float r = 0.5F; - float s = 0.45F; + float s = 0.5F; float t = 0.45F; - float u = 0.5F; - float v = 0.1F + j * 0.2F; - if (k == 0) { - v *= o * 0.1F + 1.0F; + float u = 0.45F; + float v = 0.5F; + float w = 0.1F + k * 0.2F; + if (l == 0) { + w *= p * 0.1F + 1.0F; } - float w = 0.1F + j * 0.2F; - if (k == 0) { - w *= (o - 1.0F) * 0.1F + 1.0F; + float x = 0.1F + k * 0.2F; + if (l == 0) { + x *= (p - 1.0F) * 0.1F + 1.0F; } - quad(matrix4f, vertexConsumer, h, n, o, p, q, 0.45F, 0.45F, 0.5F, v, w, false, false, true, false); - quad(matrix4f, vertexConsumer, h, n, o, p, q, 0.45F, 0.45F, 0.5F, v, w, true, false, true, true); - quad(matrix4f, vertexConsumer, h, n, o, p, q, 0.45F, 0.45F, 0.5F, v, w, true, true, false, true); - quad(matrix4f, vertexConsumer, h, n, o, p, q, 0.45F, 0.45F, 0.5F, v, w, false, true, false, false); + quad(matrix4f, vertexConsumer, h, o, p, q, r, 0.45F, 0.45F, 0.5F, w, x, false, false, true, false); + quad(matrix4f, vertexConsumer, h, o, p, q, r, 0.45F, 0.45F, 0.5F, w, x, true, false, true, true); + quad(matrix4f, vertexConsumer, h, o, p, q, r, 0.45F, 0.45F, 0.5F, w, x, true, true, false, true); + quad(matrix4f, vertexConsumer, h, o, p, q, r, 0.45F, 0.45F, 0.5F, w, x, false, true, false, false); } } } @@ -110,10 +109,16 @@ public class LightningBoltRenderer extends EntityRenderer { consumer.addVertex(matrix, x1 + (bl3 ? g : -g), (float)(index * 16), z1 + (bl4 ? g : -g)).setColor(red, green, blue, 0.3F); } - /** - * Returns the location of an entity's texture. - */ - public ResourceLocation getTextureLocation(LightningBolt entity) { - return TextureAtlas.LOCATION_BLOCKS; + public LightningBoltRenderState createRenderState() { + return new LightningBoltRenderState(); + } + + public void extractRenderState(LightningBolt lightningBolt, LightningBoltRenderState lightningBoltRenderState, float f) { + super.extractRenderState(lightningBolt, lightningBoltRenderState, f); + lightningBoltRenderState.seed = lightningBolt.seed; + } + + protected boolean affectedByCulling(LightningBolt lightningBolt) { + return false; } } diff --git a/net/minecraft/client/renderer/entity/LivingEntityRenderer.java b/net/minecraft/client/renderer/entity/LivingEntityRenderer.java index bae94303..6cd85cb1 100644 --- a/net/minecraft/client/renderer/entity/LivingEntityRenderer.java +++ b/net/minecraft/client/renderer/entity/LivingEntityRenderer.java @@ -3,7 +3,6 @@ package net.minecraft.client.renderer.entity; import com.google.common.collect.Lists; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.VertexConsumer; -import com.mojang.logging.LogUtils; import com.mojang.math.Axis; import java.util.List; import net.fabricmc.api.EnvType; @@ -15,32 +14,43 @@ import net.minecraft.client.player.LocalPlayer; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.entity.layers.RenderLayer; +import net.minecraft.client.renderer.entity.state.LivingEntityRenderState; import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.core.Direction; import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.ARGB; import net.minecraft.util.Mth; +import net.minecraft.world.entity.EquipmentSlot; +import net.minecraft.world.entity.HumanoidArm; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.Pose; import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.player.PlayerModelPart; +import net.minecraft.world.item.ItemDisplayContext; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.world.phys.AABB; import net.minecraft.world.scores.Team; +import net.minecraft.world.scores.Team.Visibility; import org.jetbrains.annotations.Nullable; -import org.slf4j.Logger; @Environment(EnvType.CLIENT) -public abstract class LivingEntityRenderer> extends EntityRenderer implements RenderLayerParent { - private static final Logger LOGGER = LogUtils.getLogger(); +public abstract class LivingEntityRenderer> + extends EntityRenderer + implements RenderLayerParent { private static final float EYE_BED_OFFSET = 0.1F; protected M model; - protected final List> layers = Lists.>newArrayList(); + protected final ItemRenderer itemRenderer; + protected final List> layers = Lists.>newArrayList(); public LivingEntityRenderer(EntityRendererProvider.Context context, M model, float shadowRadius) { super(context); + this.itemRenderer = context.getItemRenderer(); this.model = model; this.shadowRadius = shadowRadius; } - protected final boolean addLayer(RenderLayer layer) { + protected final boolean addLayer(RenderLayer layer) { return this.layers.add(layer); } @@ -49,111 +59,82 @@ public abstract class LivingEntityRenderer= 85.0F) { - i = 85.0F; - } - - f = g - i; - if (i * i > 2500.0F) { - f += i * 0.2F; - } - - h = g - f; - } - - float j = Mth.lerp(partialTicks, entity.xRotO, entity.getXRot()); - if (isEntityUpsideDown(entity)) { - j *= -1.0F; - h *= -1.0F; - } - - h = Mth.wrapDegrees(h); - if (entity.hasPose(Pose.SLEEPING)) { - Direction direction = entity.getBedOrientation(); + if (livingEntityRenderState.hasPose(Pose.SLEEPING)) { + Direction direction = livingEntityRenderState.bedOrientation; if (direction != null) { - float k = entity.getEyeHeight(Pose.STANDING) - 0.1F; - poseStack.translate(-direction.getStepX() * k, 0.0F, -direction.getStepZ() * k); + float f = livingEntityRenderState.eyeHeight - 0.1F; + poseStack.translate(-direction.getStepX() * f, 0.0F, -direction.getStepZ() * f); } } - float ix = entity.getScale(); - poseStack.scale(ix, ix, ix); - float k = this.getBob(entity, partialTicks); - this.setupRotations(entity, poseStack, k, f, partialTicks, ix); + float g = livingEntityRenderState.scale; + poseStack.scale(g, g, g); + this.setupRotations(livingEntityRenderState, poseStack, livingEntityRenderState.bodyRot, g); poseStack.scale(-1.0F, -1.0F, 1.0F); - this.scale(entity, poseStack, partialTicks); + this.scale(livingEntityRenderState, poseStack); poseStack.translate(0.0F, -1.501F, 0.0F); - float l = 0.0F; - float m = 0.0F; - if (!entity.isPassenger() && entity.isAlive()) { - l = entity.walkAnimation.speed(partialTicks); - m = entity.walkAnimation.position(partialTicks); - if (entity.isBaby()) { - m *= 3.0F; - } - - if (l > 1.0F) { - l = 1.0F; - } - } - - this.model.prepareMobModel(entity, m, l, partialTicks); - this.model.setupAnim(entity, m, l, k, h, j); - Minecraft minecraft = Minecraft.getInstance(); - boolean bl = this.isBodyVisible(entity); - boolean bl2 = !bl && !entity.isInvisibleTo(minecraft.player); - boolean bl3 = minecraft.shouldEntityAppearGlowing(entity); - RenderType renderType = this.getRenderType(entity, bl, bl2, bl3); + this.model.setupAnim(livingEntityRenderState); + boolean bl = this.isBodyVisible(livingEntityRenderState); + boolean bl2 = !bl && !livingEntityRenderState.isInvisibleToPlayer; + RenderType renderType = this.getRenderType(livingEntityRenderState, bl, bl2, livingEntityRenderState.appearsGlowing); if (renderType != null) { - VertexConsumer vertexConsumer = buffer.getBuffer(renderType); - int n = getOverlayCoords(entity, this.getWhiteOverlayProgress(entity, partialTicks)); - this.model.renderToBuffer(poseStack, vertexConsumer, packedLight, n, bl2 ? 654311423 : -1); + VertexConsumer vertexConsumer = multiBufferSource.getBuffer(renderType); + int j = getOverlayCoords(livingEntityRenderState, this.getWhiteOverlayProgress(livingEntityRenderState)); + int k = bl2 ? 654311423 : -1; + int l = ARGB.multiply(k, this.getModelTint(livingEntityRenderState)); + this.model.renderToBuffer(poseStack, vertexConsumer, i, j, l); } - if (!entity.isSpectator()) { - for (RenderLayer renderLayer : this.layers) { - renderLayer.render(poseStack, buffer, packedLight, entity, m, l, partialTicks, k, h, j); + if (this.shouldRenderLayers(livingEntityRenderState)) { + for (RenderLayer renderLayer : this.layers) { + renderLayer.render(poseStack, multiBufferSource, i, livingEntityRenderState, livingEntityRenderState.yRot, livingEntityRenderState.xRot); } } poseStack.popPose(); - super.render(entity, entityYaw, partialTicks, poseStack, buffer, packedLight); + super.render(livingEntityRenderState, poseStack, multiBufferSource, i); } + protected boolean shouldRenderLayers(S livingEntityRenderState) { + return true; + } + + protected int getModelTint(S livingEntityRenderState) { + return -1; + } + + public abstract ResourceLocation getTextureLocation(S livingEntityRenderState); + @Nullable - protected RenderType getRenderType(T livingEntity, boolean bodyVisible, boolean translucent, boolean glowing) { - ResourceLocation resourceLocation = this.getTextureLocation(livingEntity); - if (translucent) { + protected RenderType getRenderType(S livingEntityRenderState, boolean bl, boolean bl2, boolean bl3) { + ResourceLocation resourceLocation = this.getTextureLocation(livingEntityRenderState); + if (bl2) { return RenderType.itemEntityTranslucentCull(resourceLocation); - } else if (bodyVisible) { + } else if (bl) { return this.model.renderType(resourceLocation); } else { - return glowing ? RenderType.outline(resourceLocation) : null; + return bl3 ? RenderType.outline(resourceLocation) : null; } } - public static int getOverlayCoords(LivingEntity livingEntity, float u) { - return OverlayTexture.pack(OverlayTexture.u(u), OverlayTexture.v(livingEntity.hurtTime > 0 || livingEntity.deathTime > 0)); + public static int getOverlayCoords(LivingEntityRenderState livingEntityRenderState, float f) { + return OverlayTexture.pack(OverlayTexture.u(f), OverlayTexture.v(livingEntityRenderState.hasRedOverlay)); } - protected boolean isBodyVisible(T livingEntity) { - return !livingEntity.isInvisible(); + protected boolean isBodyVisible(S livingEntityRenderState) { + return !livingEntityRenderState.isInvisible; } private static float sleepDirectionToRotation(Direction facing) { @@ -171,98 +152,85 @@ public abstract class LivingEntityRenderer 0) { - float f = (entity.deathTime + partialTick - 1.0F) / 20.0F * 1.6F; - f = Mth.sqrt(f); - if (f > 1.0F) { - f = 1.0F; + if (livingEntityRenderState.deathTime > 0.0F) { + float h = (livingEntityRenderState.deathTime - 1.0F) / 20.0F * 1.6F; + h = Mth.sqrt(h); + if (h > 1.0F) { + h = 1.0F; } - poseStack.mulPose(Axis.ZP.rotationDegrees(f * this.getFlipDegrees(entity))); - } else if (entity.isAutoSpinAttack()) { - poseStack.mulPose(Axis.XP.rotationDegrees(-90.0F - entity.getXRot())); - poseStack.mulPose(Axis.YP.rotationDegrees((entity.tickCount + partialTick) * -75.0F)); - } else if (entity.hasPose(Pose.SLEEPING)) { - Direction direction = entity.getBedOrientation(); - float g = direction != null ? sleepDirectionToRotation(direction) : yBodyRot; - poseStack.mulPose(Axis.YP.rotationDegrees(g)); - poseStack.mulPose(Axis.ZP.rotationDegrees(this.getFlipDegrees(entity))); + poseStack.mulPose(Axis.ZP.rotationDegrees(h * this.getFlipDegrees())); + } else if (livingEntityRenderState.isAutoSpinAttack) { + poseStack.mulPose(Axis.XP.rotationDegrees(-90.0F - livingEntityRenderState.xRot)); + poseStack.mulPose(Axis.YP.rotationDegrees(livingEntityRenderState.ageInTicks * -75.0F)); + } else if (livingEntityRenderState.hasPose(Pose.SLEEPING)) { + Direction direction = livingEntityRenderState.bedOrientation; + float i = direction != null ? sleepDirectionToRotation(direction) : f; + poseStack.mulPose(Axis.YP.rotationDegrees(i)); + poseStack.mulPose(Axis.ZP.rotationDegrees(this.getFlipDegrees())); poseStack.mulPose(Axis.YP.rotationDegrees(270.0F)); - } else if (isEntityUpsideDown(entity)) { - poseStack.translate(0.0F, (entity.getBbHeight() + 0.1F) / scale, 0.0F); + } else if (livingEntityRenderState.isUpsideDown) { + poseStack.translate(0.0F, (livingEntityRenderState.boundingBoxHeight + 0.1F) / g, 0.0F); poseStack.mulPose(Axis.ZP.rotationDegrees(180.0F)); } } - /** - * Returns where in the swing animation the living entity is (from 0 to 1). Args : entity, partialTickTime - */ - protected float getAttackAnim(T livingBase, float partialTickTime) { - return livingBase.getAttackAnim(partialTickTime); - } - - /** - * Defines what float the third param in setRotationAngles of ModelBase is - */ - protected float getBob(T livingBase, float partialTick) { - return livingBase.tickCount + partialTick; - } - - protected float getFlipDegrees(T livingEntity) { + protected float getFlipDegrees() { return 90.0F; } - protected float getWhiteOverlayProgress(T livingEntity, float partialTicks) { + protected float getWhiteOverlayProgress(S livingEntityRenderState) { return 0.0F; } - protected void scale(T livingEntity, PoseStack poseStack, float partialTickTime) { + protected void scale(S livingEntityRenderState, PoseStack poseStack) { } - protected boolean shouldShowName(T entity) { - double d = this.entityRenderDispatcher.distanceToSqr(entity); - float f = entity.isDiscrete() ? 32.0F : 64.0F; - if (d >= f * f) { - return false; - } else { - Minecraft minecraft = Minecraft.getInstance(); - LocalPlayer localPlayer = minecraft.player; - boolean bl = !entity.isInvisibleTo(localPlayer); - if (entity != localPlayer) { - Team team = entity.getTeam(); - Team team2 = localPlayer.getTeam(); - if (team != null) { - Team.Visibility visibility = team.getNameTagVisibility(); - switch (visibility) { - case ALWAYS: - return bl; - case NEVER: - return false; - case HIDE_FOR_OTHER_TEAMS: - return team2 == null ? bl : team.isAlliedTo(team2) && (team.canSeeFriendlyInvisibles() || bl); - case HIDE_FOR_OWN_TEAM: - return team2 == null ? bl : !team.isAlliedTo(team2) && bl; - default: - return true; - } + protected boolean shouldShowName(T livingEntity, double d) { + if (livingEntity.isDiscrete()) { + float f = 32.0F; + if (d >= 1024.0) { + return false; + } + } + + Minecraft minecraft = Minecraft.getInstance(); + LocalPlayer localPlayer = minecraft.player; + boolean bl = !livingEntity.isInvisibleTo(localPlayer); + if (livingEntity != localPlayer) { + Team team = livingEntity.getTeam(); + Team team2 = localPlayer.getTeam(); + if (team != null) { + Visibility visibility = team.getNameTagVisibility(); + switch (visibility) { + case ALWAYS: + return bl; + case NEVER: + return false; + case HIDE_FOR_OTHER_TEAMS: + return team2 == null ? bl : team.isAlliedTo(team2) && (team.canSeeFriendlyInvisibles() || bl); + case HIDE_FOR_OWN_TEAM: + return team2 == null ? bl : !team.isAlliedTo(team2) && bl; + default: + return true; } } - - return Minecraft.renderNames() && entity != minecraft.getCameraEntity() && bl && !entity.isVehicle(); } + + return Minecraft.renderNames() && livingEntity != minecraft.getCameraEntity() && bl && !livingEntity.isVehicle(); } public static boolean isEntityUpsideDown(LivingEntity entity) { @@ -276,7 +244,79 @@ public abstract class LivingEntityRenderer 0 || livingEntity.deathTime > 0; + ItemStack itemStack = livingEntity.getItemBySlot(EquipmentSlot.HEAD); + livingEntityRenderState.headItem = itemStack.copy(); + livingEntityRenderState.headItemModel = this.itemRenderer.resolveItemModel(itemStack, livingEntity, ItemDisplayContext.HEAD); + livingEntityRenderState.mainArm = livingEntity.getMainArm(); + ItemStack itemStack2 = livingEntity.getItemHeldByArm(HumanoidArm.RIGHT); + ItemStack itemStack3 = livingEntity.getItemHeldByArm(HumanoidArm.LEFT); + livingEntityRenderState.rightHandItem = itemStack2.copy(); + livingEntityRenderState.leftHandItem = itemStack3.copy(); + livingEntityRenderState.rightHandItemModel = this.itemRenderer.resolveItemModel(itemStack2, livingEntity, ItemDisplayContext.THIRD_PERSON_RIGHT_HAND); + livingEntityRenderState.leftHandItemModel = this.itemRenderer.resolveItemModel(itemStack3, livingEntity, ItemDisplayContext.THIRD_PERSON_LEFT_HAND); + livingEntityRenderState.deathTime = livingEntity.deathTime > 0 ? livingEntity.deathTime + f : 0.0F; + Minecraft minecraft = Minecraft.getInstance(); + livingEntityRenderState.isInvisibleToPlayer = livingEntityRenderState.isInvisible && livingEntity.isInvisibleTo(minecraft.player); + livingEntityRenderState.appearsGlowing = minecraft.shouldEntityAppearGlowing(livingEntity); + } + + private static float solveBodyRot(LivingEntity livingEntity, float f, float g) { + if (livingEntity.getVehicle() instanceof LivingEntity livingEntity2) { + float h = Mth.rotLerp(g, livingEntity2.yBodyRotO, livingEntity2.yBodyRot); + float i = 85.0F; + float j = Mth.clamp(Mth.wrapDegrees(f - h), -85.0F, 85.0F); + h = f - j; + if (Math.abs(j) > 50.0F) { + h += j * 0.2F; + } + + return h; + } else { + return Mth.rotLerp(g, livingEntity.yBodyRotO, livingEntity.yBodyRot); + } } } diff --git a/net/minecraft/client/renderer/entity/LlamaRenderer.java b/net/minecraft/client/renderer/entity/LlamaRenderer.java index 90737381..362099fd 100644 --- a/net/minecraft/client/renderer/entity/LlamaRenderer.java +++ b/net/minecraft/client/renderer/entity/LlamaRenderer.java @@ -5,30 +5,40 @@ import net.fabricmc.api.Environment; import net.minecraft.client.model.LlamaModel; import net.minecraft.client.model.geom.ModelLayerLocation; import net.minecraft.client.renderer.entity.layers.LlamaDecorLayer; +import net.minecraft.client.renderer.entity.state.LlamaRenderState; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.animal.horse.Llama; @Environment(EnvType.CLIENT) -public class LlamaRenderer extends MobRenderer> { +public class LlamaRenderer extends AgeableMobRenderer { private static final ResourceLocation CREAMY = ResourceLocation.withDefaultNamespace("textures/entity/llama/creamy.png"); private static final ResourceLocation WHITE = ResourceLocation.withDefaultNamespace("textures/entity/llama/white.png"); private static final ResourceLocation BROWN = ResourceLocation.withDefaultNamespace("textures/entity/llama/brown.png"); private static final ResourceLocation GRAY = ResourceLocation.withDefaultNamespace("textures/entity/llama/gray.png"); - public LlamaRenderer(EntityRendererProvider.Context context, ModelLayerLocation layer) { - super(context, new LlamaModel<>(context.bakeLayer(layer)), 0.7F); - this.addLayer(new LlamaDecorLayer(this, context.getModelSet())); + public LlamaRenderer(EntityRendererProvider.Context context, ModelLayerLocation modelLayerLocation, ModelLayerLocation modelLayerLocation2) { + super(context, new LlamaModel(context.bakeLayer(modelLayerLocation)), new LlamaModel(context.bakeLayer(modelLayerLocation2)), 0.7F); + this.addLayer(new LlamaDecorLayer(this, context.getModelSet(), context.getEquipmentRenderer())); } - /** - * Returns the location of an entity's texture. - */ - public ResourceLocation getTextureLocation(Llama entity) { - return switch (entity.getVariant()) { + public ResourceLocation getTextureLocation(LlamaRenderState llamaRenderState) { + return switch (llamaRenderState.variant) { case CREAMY -> CREAMY; case WHITE -> WHITE; case BROWN -> BROWN; case GRAY -> GRAY; }; } + + public LlamaRenderState createRenderState() { + return new LlamaRenderState(); + } + + public void extractRenderState(Llama llama, LlamaRenderState llamaRenderState, float f) { + super.extractRenderState(llama, llamaRenderState, f); + llamaRenderState.variant = llama.getVariant(); + llamaRenderState.hasChest = !llama.isBaby() && llama.hasChest(); + llamaRenderState.bodyItem = llama.getBodyArmorItem(); + llamaRenderState.isTraderLlama = llama.isTraderLlama(); + } } diff --git a/net/minecraft/client/renderer/entity/LlamaSpitRenderer.java b/net/minecraft/client/renderer/entity/LlamaSpitRenderer.java index 127e20e3..911a1b78 100644 --- a/net/minecraft/client/renderer/entity/LlamaSpitRenderer.java +++ b/net/minecraft/client/renderer/entity/LlamaSpitRenderer.java @@ -8,37 +8,40 @@ import net.fabricmc.api.Environment; import net.minecraft.client.model.LlamaSpitModel; import net.minecraft.client.model.geom.ModelLayers; import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.entity.state.LlamaSpitRenderState; import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.resources.ResourceLocation; -import net.minecraft.util.Mth; import net.minecraft.world.entity.projectile.LlamaSpit; @Environment(EnvType.CLIENT) -public class LlamaSpitRenderer extends EntityRenderer { +public class LlamaSpitRenderer extends EntityRenderer { private static final ResourceLocation LLAMA_SPIT_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/llama/spit.png"); - private final LlamaSpitModel model; + private final LlamaSpitModel model; public LlamaSpitRenderer(EntityRendererProvider.Context context) { super(context); - this.model = new LlamaSpitModel<>(context.bakeLayer(ModelLayers.LLAMA_SPIT)); + this.model = new LlamaSpitModel(context.bakeLayer(ModelLayers.LLAMA_SPIT)); } - public void render(LlamaSpit entity, float entityYaw, float partialTicks, PoseStack poseStack, MultiBufferSource buffer, int packedLight) { + public void render(LlamaSpitRenderState llamaSpitRenderState, PoseStack poseStack, MultiBufferSource multiBufferSource, int i) { poseStack.pushPose(); poseStack.translate(0.0F, 0.15F, 0.0F); - poseStack.mulPose(Axis.YP.rotationDegrees(Mth.lerp(partialTicks, entity.yRotO, entity.getYRot()) - 90.0F)); - poseStack.mulPose(Axis.ZP.rotationDegrees(Mth.lerp(partialTicks, entity.xRotO, entity.getXRot()))); - this.model.setupAnim(entity, partialTicks, 0.0F, -0.1F, 0.0F, 0.0F); - VertexConsumer vertexConsumer = buffer.getBuffer(this.model.renderType(LLAMA_SPIT_LOCATION)); - this.model.renderToBuffer(poseStack, vertexConsumer, packedLight, OverlayTexture.NO_OVERLAY); + poseStack.mulPose(Axis.YP.rotationDegrees(llamaSpitRenderState.yRot - 90.0F)); + poseStack.mulPose(Axis.ZP.rotationDegrees(llamaSpitRenderState.xRot)); + this.model.setupAnim(llamaSpitRenderState); + VertexConsumer vertexConsumer = multiBufferSource.getBuffer(this.model.renderType(LLAMA_SPIT_LOCATION)); + this.model.renderToBuffer(poseStack, vertexConsumer, i, OverlayTexture.NO_OVERLAY); poseStack.popPose(); - super.render(entity, entityYaw, partialTicks, poseStack, buffer, packedLight); + super.render(llamaSpitRenderState, poseStack, multiBufferSource, i); } - /** - * Returns the location of an entity's texture. - */ - public ResourceLocation getTextureLocation(LlamaSpit entity) { - return LLAMA_SPIT_LOCATION; + public LlamaSpitRenderState createRenderState() { + return new LlamaSpitRenderState(); + } + + public void extractRenderState(LlamaSpit llamaSpit, LlamaSpitRenderState llamaSpitRenderState, float f) { + super.extractRenderState(llamaSpit, llamaSpitRenderState, f); + llamaSpitRenderState.xRot = llamaSpit.getXRot(f); + llamaSpitRenderState.yRot = llamaSpit.getYRot(f); } } diff --git a/net/minecraft/client/renderer/entity/MagmaCubeRenderer.java b/net/minecraft/client/renderer/entity/MagmaCubeRenderer.java index 086b4edd..06d5ea2c 100644 --- a/net/minecraft/client/renderer/entity/MagmaCubeRenderer.java +++ b/net/minecraft/client/renderer/entity/MagmaCubeRenderer.java @@ -6,38 +6,46 @@ import net.fabricmc.api.Environment; import net.minecraft.client.model.LavaSlimeModel; import net.minecraft.client.model.geom.ModelLayers; import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.entity.state.SlimeRenderState; import net.minecraft.core.BlockPos; import net.minecraft.resources.ResourceLocation; import net.minecraft.util.Mth; import net.minecraft.world.entity.monster.MagmaCube; @Environment(EnvType.CLIENT) -public class MagmaCubeRenderer extends MobRenderer> { +public class MagmaCubeRenderer extends MobRenderer { private static final ResourceLocation MAGMACUBE_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/slime/magmacube.png"); public MagmaCubeRenderer(EntityRendererProvider.Context context) { - super(context, new LavaSlimeModel<>(context.bakeLayer(ModelLayers.MAGMA_CUBE)), 0.25F); + super(context, new LavaSlimeModel(context.bakeLayer(ModelLayers.MAGMA_CUBE)), 0.25F); } protected int getBlockLightLevel(MagmaCube entity, BlockPos pos) { return 15; } - /** - * Returns the location of an entity's texture. - */ - public ResourceLocation getTextureLocation(MagmaCube entity) { + public ResourceLocation getTextureLocation(SlimeRenderState slimeRenderState) { return MAGMACUBE_LOCATION; } - public void render(MagmaCube entity, float entityYaw, float partialTicks, PoseStack poseStack, MultiBufferSource buffer, int packedLight) { - this.shadowRadius = 0.25F * entity.getSize(); - super.render(entity, entityYaw, partialTicks, poseStack, buffer, packedLight); + public SlimeRenderState createRenderState() { + return new SlimeRenderState(); } - protected void scale(MagmaCube livingEntity, PoseStack poseStack, float partialTickTime) { - int i = livingEntity.getSize(); - float f = Mth.lerp(partialTickTime, livingEntity.oSquish, livingEntity.squish) / (i * 0.5F + 1.0F); + public void extractRenderState(MagmaCube magmaCube, SlimeRenderState slimeRenderState, float f) { + super.extractRenderState(magmaCube, slimeRenderState, f); + slimeRenderState.squish = Mth.lerp(f, magmaCube.oSquish, magmaCube.squish); + slimeRenderState.size = magmaCube.getSize(); + } + + public void render(SlimeRenderState slimeRenderState, PoseStack poseStack, MultiBufferSource multiBufferSource, int i) { + this.shadowRadius = 0.25F * slimeRenderState.size; + super.render(slimeRenderState, poseStack, multiBufferSource, i); + } + + protected void scale(SlimeRenderState slimeRenderState, PoseStack poseStack) { + int i = slimeRenderState.size; + float f = slimeRenderState.squish / (i * 0.5F + 1.0F); float g = 1.0F / (f + 1.0F); poseStack.scale(g * i, 1.0F / g * i, g * i); } diff --git a/net/minecraft/client/renderer/entity/MinecartRenderer.java b/net/minecraft/client/renderer/entity/MinecartRenderer.java index 6404ad95..3f751592 100644 --- a/net/minecraft/client/renderer/entity/MinecartRenderer.java +++ b/net/minecraft/client/renderer/entity/MinecartRenderer.java @@ -1,111 +1,18 @@ package net.minecraft.client.renderer.entity; -import com.mojang.blaze3d.vertex.PoseStack; -import com.mojang.blaze3d.vertex.VertexConsumer; -import com.mojang.math.Axis; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; -import net.minecraft.client.model.EntityModel; -import net.minecraft.client.model.MinecartModel; import net.minecraft.client.model.geom.ModelLayerLocation; -import net.minecraft.client.renderer.MultiBufferSource; -import net.minecraft.client.renderer.block.BlockRenderDispatcher; -import net.minecraft.client.renderer.texture.OverlayTexture; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.util.Mth; +import net.minecraft.client.renderer.entity.state.MinecartRenderState; import net.minecraft.world.entity.vehicle.AbstractMinecart; -import net.minecraft.world.level.block.RenderShape; -import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.world.phys.Vec3; @Environment(EnvType.CLIENT) -public class MinecartRenderer extends EntityRenderer { - private static final ResourceLocation MINECART_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/minecart.png"); - protected final EntityModel model; - private final BlockRenderDispatcher blockRenderer; - +public class MinecartRenderer extends AbstractMinecartRenderer { public MinecartRenderer(EntityRendererProvider.Context context, ModelLayerLocation layer) { - super(context); - this.shadowRadius = 0.7F; - this.model = new MinecartModel<>(context.bakeLayer(layer)); - this.blockRenderer = context.getBlockRenderDispatcher(); + super(context, layer); } - public void render(T entity, float entityYaw, float partialTicks, PoseStack poseStack, MultiBufferSource buffer, int packedLight) { - super.render(entity, entityYaw, partialTicks, poseStack, buffer, packedLight); - poseStack.pushPose(); - long l = entity.getId() * 493286711L; - l = l * l * 4392167121L + l * 98761L; - float f = (((float)(l >> 16 & 7L) + 0.5F) / 8.0F - 0.5F) * 0.004F; - float g = (((float)(l >> 20 & 7L) + 0.5F) / 8.0F - 0.5F) * 0.004F; - float h = (((float)(l >> 24 & 7L) + 0.5F) / 8.0F - 0.5F) * 0.004F; - poseStack.translate(f, g, h); - double d = Mth.lerp((double)partialTicks, entity.xOld, entity.getX()); - double e = Mth.lerp((double)partialTicks, entity.yOld, entity.getY()); - double i = Mth.lerp((double)partialTicks, entity.zOld, entity.getZ()); - double j = 0.3F; - Vec3 vec3 = entity.getPos(d, e, i); - float k = Mth.lerp(partialTicks, entity.xRotO, entity.getXRot()); - if (vec3 != null) { - Vec3 vec32 = entity.getPosOffs(d, e, i, 0.3F); - Vec3 vec33 = entity.getPosOffs(d, e, i, -0.3F); - if (vec32 == null) { - vec32 = vec3; - } - - if (vec33 == null) { - vec33 = vec3; - } - - poseStack.translate(vec3.x - d, (vec32.y + vec33.y) / 2.0 - e, vec3.z - i); - Vec3 vec34 = vec33.add(-vec32.x, -vec32.y, -vec32.z); - if (vec34.length() != 0.0) { - vec34 = vec34.normalize(); - entityYaw = (float)(Math.atan2(vec34.z, vec34.x) * 180.0 / Math.PI); - k = (float)(Math.atan(vec34.y) * 73.0); - } - } - - poseStack.translate(0.0F, 0.375F, 0.0F); - poseStack.mulPose(Axis.YP.rotationDegrees(180.0F - entityYaw)); - poseStack.mulPose(Axis.ZP.rotationDegrees(-k)); - float m = entity.getHurtTime() - partialTicks; - float n = entity.getDamage() - partialTicks; - if (n < 0.0F) { - n = 0.0F; - } - - if (m > 0.0F) { - poseStack.mulPose(Axis.XP.rotationDegrees(Mth.sin(m) * m * n / 10.0F * entity.getHurtDir())); - } - - int o = entity.getDisplayOffset(); - BlockState blockState = entity.getDisplayBlockState(); - if (blockState.getRenderShape() != RenderShape.INVISIBLE) { - poseStack.pushPose(); - float p = 0.75F; - poseStack.scale(0.75F, 0.75F, 0.75F); - poseStack.translate(-0.5F, (o - 8) / 16.0F, 0.5F); - poseStack.mulPose(Axis.YP.rotationDegrees(90.0F)); - this.renderMinecartContents(entity, partialTicks, blockState, poseStack, buffer, packedLight); - poseStack.popPose(); - } - - poseStack.scale(-1.0F, -1.0F, 1.0F); - this.model.setupAnim(entity, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F); - VertexConsumer vertexConsumer = buffer.getBuffer(this.model.renderType(this.getTextureLocation(entity))); - this.model.renderToBuffer(poseStack, vertexConsumer, packedLight, OverlayTexture.NO_OVERLAY); - poseStack.popPose(); - } - - /** - * Returns the location of an entity's texture. - */ - public ResourceLocation getTextureLocation(T entity) { - return MINECART_LOCATION; - } - - protected void renderMinecartContents(T entity, float partialTicks, BlockState state, PoseStack poseStack, MultiBufferSource buffer, int packedLight) { - this.blockRenderer.renderSingleBlock(state, poseStack, buffer, packedLight, OverlayTexture.NO_OVERLAY); + public MinecartRenderState createRenderState() { + return new MinecartRenderState(); } } diff --git a/net/minecraft/client/renderer/entity/MobRenderer.java b/net/minecraft/client/renderer/entity/MobRenderer.java index 45431212..bd89ee9a 100644 --- a/net/minecraft/client/renderer/entity/MobRenderer.java +++ b/net/minecraft/client/renderer/entity/MobRenderer.java @@ -3,19 +3,21 @@ package net.minecraft.client.renderer.entity; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.model.EntityModel; +import net.minecraft.client.renderer.entity.state.LivingEntityRenderState; import net.minecraft.world.entity.Mob; @Environment(EnvType.CLIENT) -public abstract class MobRenderer> extends LivingEntityRenderer { +public abstract class MobRenderer> extends LivingEntityRenderer { public MobRenderer(EntityRendererProvider.Context context, M model, float shadowRadius) { super(context, model, shadowRadius); } - protected boolean shouldShowName(T entity) { - return super.shouldShowName(entity) && (entity.shouldShowName() || entity.hasCustomName() && entity == this.entityRenderDispatcher.crosshairPickEntity); + protected boolean shouldShowName(T mob, double d) { + return super.shouldShowName(mob, d) && (mob.shouldShowName() || mob.hasCustomName() && mob == this.entityRenderDispatcher.crosshairPickEntity); } - protected float getShadowRadius(T entity) { - return super.getShadowRadius(entity) * entity.getAgeScale(); + @Override + protected float getShadowRadius(S livingEntityRenderState) { + return super.getShadowRadius(livingEntityRenderState) * livingEntityRenderState.ageScale; } } diff --git a/net/minecraft/client/renderer/entity/MushroomCowRenderer.java b/net/minecraft/client/renderer/entity/MushroomCowRenderer.java index e006190e..9f3aa1c3 100644 --- a/net/minecraft/client/renderer/entity/MushroomCowRenderer.java +++ b/net/minecraft/client/renderer/entity/MushroomCowRenderer.java @@ -8,27 +8,32 @@ import net.minecraft.Util; import net.minecraft.client.model.CowModel; import net.minecraft.client.model.geom.ModelLayers; import net.minecraft.client.renderer.entity.layers.MushroomCowMushroomLayer; +import net.minecraft.client.renderer.entity.state.MushroomCowRenderState; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.animal.MushroomCow; @Environment(EnvType.CLIENT) -public class MushroomCowRenderer extends MobRenderer> { - private static final Map TEXTURES = Util.make( - Maps.newHashMap(), hashMap -> { - hashMap.put(MushroomCow.MushroomType.BROWN, ResourceLocation.withDefaultNamespace("textures/entity/cow/brown_mooshroom.png")); - hashMap.put(MushroomCow.MushroomType.RED, ResourceLocation.withDefaultNamespace("textures/entity/cow/red_mooshroom.png")); - } - ); +public class MushroomCowRenderer extends AgeableMobRenderer { + private static final Map TEXTURES = Util.make(Maps.newHashMap(), hashMap -> { + hashMap.put(MushroomCow.Variant.BROWN, ResourceLocation.withDefaultNamespace("textures/entity/cow/brown_mooshroom.png")); + hashMap.put(MushroomCow.Variant.RED, ResourceLocation.withDefaultNamespace("textures/entity/cow/red_mooshroom.png")); + }); public MushroomCowRenderer(EntityRendererProvider.Context context) { - super(context, new CowModel<>(context.bakeLayer(ModelLayers.MOOSHROOM)), 0.7F); - this.addLayer(new MushroomCowMushroomLayer<>(this, context.getBlockRenderDispatcher())); + super(context, new CowModel(context.bakeLayer(ModelLayers.MOOSHROOM)), new CowModel(context.bakeLayer(ModelLayers.MOOSHROOM_BABY)), 0.7F); + this.addLayer(new MushroomCowMushroomLayer(this, context.getBlockRenderDispatcher())); } - /** - * Returns the location of an entity's texture. - */ - public ResourceLocation getTextureLocation(MushroomCow entity) { - return (ResourceLocation)TEXTURES.get(entity.getVariant()); + public ResourceLocation getTextureLocation(MushroomCowRenderState mushroomCowRenderState) { + return (ResourceLocation)TEXTURES.get(mushroomCowRenderState.variant); + } + + public MushroomCowRenderState createRenderState() { + return new MushroomCowRenderState(); + } + + public void extractRenderState(MushroomCow mushroomCow, MushroomCowRenderState mushroomCowRenderState, float f) { + super.extractRenderState(mushroomCow, mushroomCowRenderState, f); + mushroomCowRenderState.variant = mushroomCow.getVariant(); } } diff --git a/net/minecraft/client/renderer/entity/NoopRenderer.java b/net/minecraft/client/renderer/entity/NoopRenderer.java index c59cb73c..17411f55 100644 --- a/net/minecraft/client/renderer/entity/NoopRenderer.java +++ b/net/minecraft/client/renderer/entity/NoopRenderer.java @@ -2,18 +2,17 @@ package net.minecraft.client.renderer.entity; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; -import net.minecraft.client.renderer.texture.TextureAtlas; -import net.minecraft.resources.ResourceLocation; +import net.minecraft.client.renderer.entity.state.EntityRenderState; import net.minecraft.world.entity.Entity; @Environment(EnvType.CLIENT) -public class NoopRenderer extends EntityRenderer { +public class NoopRenderer extends EntityRenderer { public NoopRenderer(EntityRendererProvider.Context context) { super(context); } @Override - public ResourceLocation getTextureLocation(T entity) { - return TextureAtlas.LOCATION_BLOCKS; + public EntityRenderState createRenderState() { + return new EntityRenderState(); } } diff --git a/net/minecraft/client/renderer/entity/OcelotRenderer.java b/net/minecraft/client/renderer/entity/OcelotRenderer.java index 73fd5b11..c3823b0d 100644 --- a/net/minecraft/client/renderer/entity/OcelotRenderer.java +++ b/net/minecraft/client/renderer/entity/OcelotRenderer.java @@ -4,21 +4,29 @@ import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.model.OcelotModel; import net.minecraft.client.model.geom.ModelLayers; +import net.minecraft.client.renderer.entity.state.FelineRenderState; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.animal.Ocelot; @Environment(EnvType.CLIENT) -public class OcelotRenderer extends MobRenderer> { +public class OcelotRenderer extends AgeableMobRenderer { private static final ResourceLocation CAT_OCELOT_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/cat/ocelot.png"); public OcelotRenderer(EntityRendererProvider.Context context) { - super(context, new OcelotModel<>(context.bakeLayer(ModelLayers.OCELOT)), 0.4F); + super(context, new OcelotModel(context.bakeLayer(ModelLayers.OCELOT)), new OcelotModel(context.bakeLayer(ModelLayers.OCELOT_BABY)), 0.4F); } - /** - * Returns the location of an entity's texture. - */ - public ResourceLocation getTextureLocation(Ocelot entity) { + public ResourceLocation getTextureLocation(FelineRenderState felineRenderState) { return CAT_OCELOT_LOCATION; } + + public FelineRenderState createRenderState() { + return new FelineRenderState(); + } + + public void extractRenderState(Ocelot ocelot, FelineRenderState felineRenderState, float f) { + super.extractRenderState(ocelot, felineRenderState, f); + felineRenderState.isCrouching = ocelot.isCrouching(); + felineRenderState.isSprinting = ocelot.isSprinting(); + } } diff --git a/net/minecraft/client/renderer/entity/OminousItemSpawnerRenderer.java b/net/minecraft/client/renderer/entity/OminousItemSpawnerRenderer.java index 9a39f83e..13828bb9 100644 --- a/net/minecraft/client/renderer/entity/OminousItemSpawnerRenderer.java +++ b/net/minecraft/client/renderer/entity/OminousItemSpawnerRenderer.java @@ -5,15 +5,15 @@ import com.mojang.math.Axis; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.renderer.MultiBufferSource; -import net.minecraft.client.renderer.texture.TextureAtlas; -import net.minecraft.resources.ResourceLocation; +import net.minecraft.client.renderer.entity.state.OminousItemSpawnerRenderState; +import net.minecraft.client.resources.model.BakedModel; import net.minecraft.util.Mth; +import net.minecraft.util.RandomSource; import net.minecraft.world.entity.OminousItemSpawner; import net.minecraft.world.item.ItemStack; -import net.minecraft.world.level.Level; @Environment(EnvType.CLIENT) -public class OminousItemSpawnerRenderer extends EntityRenderer { +public class OminousItemSpawnerRenderer extends EntityRenderer { private static final float ROTATION_SPEED = 40.0F; private static final int TICKS_SCALING = 50; private final ItemRenderer itemRenderer; @@ -23,24 +23,31 @@ public class OminousItemSpawnerRenderer extends EntityRenderer { +public class PaintingRenderer extends EntityRenderer { public PaintingRenderer(EntityRendererProvider.Context context) { super(context); } - public void render(Painting entity, float entityYaw, float partialTicks, PoseStack poseStack, MultiBufferSource buffer, int packedLight) { - poseStack.pushPose(); - poseStack.mulPose(Axis.YP.rotationDegrees(180.0F - entityYaw)); - PaintingVariant paintingVariant = entity.getVariant().value(); - VertexConsumer vertexConsumer = buffer.getBuffer(RenderType.entitySolid(this.getTextureLocation(entity))); - PaintingTextureManager paintingTextureManager = Minecraft.getInstance().getPaintingTextures(); - this.renderPainting( - poseStack, - vertexConsumer, - entity, - paintingVariant.width(), - paintingVariant.height(), - paintingTextureManager.get(paintingVariant), - paintingTextureManager.getBackSprite() - ); - poseStack.popPose(); - super.render(entity, entityYaw, partialTicks, poseStack, buffer, packedLight); + public void render(PaintingRenderState paintingRenderState, PoseStack poseStack, MultiBufferSource multiBufferSource, int i) { + PaintingVariant paintingVariant = paintingRenderState.variant; + if (paintingVariant != null) { + poseStack.pushPose(); + poseStack.mulPose(Axis.YP.rotationDegrees(180 - paintingRenderState.direction.get2DDataValue() * 90)); + PaintingTextureManager paintingTextureManager = Minecraft.getInstance().getPaintingTextures(); + TextureAtlasSprite textureAtlasSprite = paintingTextureManager.getBackSprite(); + VertexConsumer vertexConsumer = multiBufferSource.getBuffer(RenderType.entitySolidZOffsetForward(textureAtlasSprite.atlasLocation())); + this.renderPainting( + poseStack, + vertexConsumer, + paintingRenderState.lightCoords, + paintingVariant.width(), + paintingVariant.height(), + paintingTextureManager.get(paintingVariant), + textureAtlasSprite + ); + poseStack.popPose(); + super.render(paintingRenderState, poseStack, multiBufferSource, i); + } } - /** - * Returns the location of an entity's texture. - */ - public ResourceLocation getTextureLocation(Painting entity) { - return Minecraft.getInstance().getPaintingTextures().getBackSprite().atlasLocation(); + public PaintingRenderState createRenderState() { + return new PaintingRenderState(); + } + + public void extractRenderState(Painting painting, PaintingRenderState paintingRenderState, float f) { + super.extractRenderState(painting, paintingRenderState, f); + Direction direction = painting.getDirection(); + PaintingVariant paintingVariant = painting.getVariant().value(); + paintingRenderState.direction = direction; + paintingRenderState.variant = paintingVariant; + int i = paintingVariant.width(); + int j = paintingVariant.height(); + if (paintingRenderState.lightCoords.length != i * j) { + paintingRenderState.lightCoords = new int[i * j]; + } + + float g = -i / 2.0F; + float h = -j / 2.0F; + Level level = painting.level(); + + for (int k = 0; k < j; k++) { + for (int l = 0; l < i; l++) { + float m = l + g + 0.5F; + float n = k + h + 0.5F; + int o = painting.getBlockX(); + int p = Mth.floor(painting.getY() + n); + int q = painting.getBlockZ(); + switch (direction) { + case NORTH: + o = Mth.floor(painting.getX() + m); + break; + case WEST: + q = Mth.floor(painting.getZ() - m); + break; + case SOUTH: + o = Mth.floor(painting.getX() - m); + break; + case EAST: + q = Mth.floor(painting.getZ() + m); + } + + paintingRenderState.lightCoords[l + k * i] = LevelRenderer.getLightColor(level, new BlockPos(o, p, q)); + } + } } private void renderPainting( - PoseStack poseStack, VertexConsumer consumer, Painting painting, int width, int height, TextureAtlasSprite paintingSprite, TextureAtlasSprite backSprite + PoseStack poseStack, VertexConsumer vertexConsumer, int[] is, int i, int j, TextureAtlasSprite textureAtlasSprite, TextureAtlasSprite textureAtlasSprite2 ) { PoseStack.Pose pose = poseStack.last(); - float f = -width / 2.0F; - float g = -height / 2.0F; + float f = -i / 2.0F; + float g = -j / 2.0F; float h = 0.03125F; - float i = backSprite.getU0(); - float j = backSprite.getU1(); - float k = backSprite.getV0(); - float l = backSprite.getV1(); - float m = backSprite.getU0(); - float n = backSprite.getU1(); - float o = backSprite.getV0(); - float p = backSprite.getV(0.0625F); - float q = backSprite.getU0(); - float r = backSprite.getU(0.0625F); - float s = backSprite.getV0(); - float t = backSprite.getV1(); - double d = 1.0 / width; - double e = 1.0 / height; + float k = textureAtlasSprite2.getU0(); + float l = textureAtlasSprite2.getU1(); + float m = textureAtlasSprite2.getV0(); + float n = textureAtlasSprite2.getV1(); + float o = textureAtlasSprite2.getU0(); + float p = textureAtlasSprite2.getU1(); + float q = textureAtlasSprite2.getV0(); + float r = textureAtlasSprite2.getV(0.0625F); + float s = textureAtlasSprite2.getU0(); + float t = textureAtlasSprite2.getU(0.0625F); + float u = textureAtlasSprite2.getV0(); + float v = textureAtlasSprite2.getV1(); + double d = 1.0 / i; + double e = 1.0 / j; - for (int u = 0; u < width; u++) { - for (int v = 0; v < height; v++) { - float w = f + (u + 1); - float x = f + u; - float y = g + (v + 1); - float z = g + v; - int aa = painting.getBlockX(); - int ab = Mth.floor(painting.getY() + (y + z) / 2.0F); - int ac = painting.getBlockZ(); - Direction direction = painting.getDirection(); - if (direction == Direction.NORTH) { - aa = Mth.floor(painting.getX() + (w + x) / 2.0F); - } - - if (direction == Direction.WEST) { - ac = Mth.floor(painting.getZ() - (w + x) / 2.0F); - } - - if (direction == Direction.SOUTH) { - aa = Mth.floor(painting.getX() - (w + x) / 2.0F); - } - - if (direction == Direction.EAST) { - ac = Mth.floor(painting.getZ() + (w + x) / 2.0F); - } - - int ad = LevelRenderer.getLightColor(painting.level(), new BlockPos(aa, ab, ac)); - float ae = paintingSprite.getU((float)(d * (width - u))); - float af = paintingSprite.getU((float)(d * (width - (u + 1)))); - float ag = paintingSprite.getV((float)(e * (height - v))); - float ah = paintingSprite.getV((float)(e * (height - (v + 1)))); - this.vertex(pose, consumer, w, z, af, ag, -0.03125F, 0, 0, -1, ad); - this.vertex(pose, consumer, x, z, ae, ag, -0.03125F, 0, 0, -1, ad); - this.vertex(pose, consumer, x, y, ae, ah, -0.03125F, 0, 0, -1, ad); - this.vertex(pose, consumer, w, y, af, ah, -0.03125F, 0, 0, -1, ad); - this.vertex(pose, consumer, w, y, j, k, 0.03125F, 0, 0, 1, ad); - this.vertex(pose, consumer, x, y, i, k, 0.03125F, 0, 0, 1, ad); - this.vertex(pose, consumer, x, z, i, l, 0.03125F, 0, 0, 1, ad); - this.vertex(pose, consumer, w, z, j, l, 0.03125F, 0, 0, 1, ad); - this.vertex(pose, consumer, w, y, m, o, -0.03125F, 0, 1, 0, ad); - this.vertex(pose, consumer, x, y, n, o, -0.03125F, 0, 1, 0, ad); - this.vertex(pose, consumer, x, y, n, p, 0.03125F, 0, 1, 0, ad); - this.vertex(pose, consumer, w, y, m, p, 0.03125F, 0, 1, 0, ad); - this.vertex(pose, consumer, w, z, m, o, 0.03125F, 0, -1, 0, ad); - this.vertex(pose, consumer, x, z, n, o, 0.03125F, 0, -1, 0, ad); - this.vertex(pose, consumer, x, z, n, p, -0.03125F, 0, -1, 0, ad); - this.vertex(pose, consumer, w, z, m, p, -0.03125F, 0, -1, 0, ad); - this.vertex(pose, consumer, w, y, r, s, 0.03125F, -1, 0, 0, ad); - this.vertex(pose, consumer, w, z, r, t, 0.03125F, -1, 0, 0, ad); - this.vertex(pose, consumer, w, z, q, t, -0.03125F, -1, 0, 0, ad); - this.vertex(pose, consumer, w, y, q, s, -0.03125F, -1, 0, 0, ad); - this.vertex(pose, consumer, x, y, r, s, -0.03125F, 1, 0, 0, ad); - this.vertex(pose, consumer, x, z, r, t, -0.03125F, 1, 0, 0, ad); - this.vertex(pose, consumer, x, z, q, t, 0.03125F, 1, 0, 0, ad); - this.vertex(pose, consumer, x, y, q, s, 0.03125F, 1, 0, 0, ad); + for (int w = 0; w < i; w++) { + for (int x = 0; x < j; x++) { + float y = f + (w + 1); + float z = f + w; + float aa = g + (x + 1); + float ab = g + x; + int ac = is[w + x * i]; + float ad = textureAtlasSprite.getU((float)(d * (i - w))); + float ae = textureAtlasSprite.getU((float)(d * (i - (w + 1)))); + float af = textureAtlasSprite.getV((float)(e * (j - x))); + float ag = textureAtlasSprite.getV((float)(e * (j - (x + 1)))); + this.vertex(pose, vertexConsumer, y, ab, ae, af, -0.03125F, 0, 0, -1, ac); + this.vertex(pose, vertexConsumer, z, ab, ad, af, -0.03125F, 0, 0, -1, ac); + this.vertex(pose, vertexConsumer, z, aa, ad, ag, -0.03125F, 0, 0, -1, ac); + this.vertex(pose, vertexConsumer, y, aa, ae, ag, -0.03125F, 0, 0, -1, ac); + this.vertex(pose, vertexConsumer, y, aa, l, m, 0.03125F, 0, 0, 1, ac); + this.vertex(pose, vertexConsumer, z, aa, k, m, 0.03125F, 0, 0, 1, ac); + this.vertex(pose, vertexConsumer, z, ab, k, n, 0.03125F, 0, 0, 1, ac); + this.vertex(pose, vertexConsumer, y, ab, l, n, 0.03125F, 0, 0, 1, ac); + this.vertex(pose, vertexConsumer, y, aa, o, q, -0.03125F, 0, 1, 0, ac); + this.vertex(pose, vertexConsumer, z, aa, p, q, -0.03125F, 0, 1, 0, ac); + this.vertex(pose, vertexConsumer, z, aa, p, r, 0.03125F, 0, 1, 0, ac); + this.vertex(pose, vertexConsumer, y, aa, o, r, 0.03125F, 0, 1, 0, ac); + this.vertex(pose, vertexConsumer, y, ab, o, q, 0.03125F, 0, -1, 0, ac); + this.vertex(pose, vertexConsumer, z, ab, p, q, 0.03125F, 0, -1, 0, ac); + this.vertex(pose, vertexConsumer, z, ab, p, r, -0.03125F, 0, -1, 0, ac); + this.vertex(pose, vertexConsumer, y, ab, o, r, -0.03125F, 0, -1, 0, ac); + this.vertex(pose, vertexConsumer, y, aa, t, u, 0.03125F, -1, 0, 0, ac); + this.vertex(pose, vertexConsumer, y, ab, t, v, 0.03125F, -1, 0, 0, ac); + this.vertex(pose, vertexConsumer, y, ab, s, v, -0.03125F, -1, 0, 0, ac); + this.vertex(pose, vertexConsumer, y, aa, s, u, -0.03125F, -1, 0, 0, ac); + this.vertex(pose, vertexConsumer, z, aa, t, u, -0.03125F, 1, 0, 0, ac); + this.vertex(pose, vertexConsumer, z, ab, t, v, -0.03125F, 1, 0, 0, ac); + this.vertex(pose, vertexConsumer, z, ab, s, v, 0.03125F, 1, 0, 0, ac); + this.vertex(pose, vertexConsumer, z, aa, s, u, 0.03125F, 1, 0, 0, ac); } } } diff --git a/net/minecraft/client/renderer/entity/PandaRenderer.java b/net/minecraft/client/renderer/entity/PandaRenderer.java index 490bdec6..9f96d66d 100644 --- a/net/minecraft/client/renderer/entity/PandaRenderer.java +++ b/net/minecraft/client/renderer/entity/PandaRenderer.java @@ -10,12 +10,13 @@ import net.minecraft.Util; import net.minecraft.client.model.PandaModel; import net.minecraft.client.model.geom.ModelLayers; import net.minecraft.client.renderer.entity.layers.PandaHoldsItemLayer; +import net.minecraft.client.renderer.entity.state.PandaRenderState; import net.minecraft.resources.ResourceLocation; import net.minecraft.util.Mth; import net.minecraft.world.entity.animal.Panda; @Environment(EnvType.CLIENT) -public class PandaRenderer extends MobRenderer> { +public class PandaRenderer extends AgeableMobRenderer { private static final Map TEXTURES = Util.make(Maps.newEnumMap(Panda.Gene.class), enumMap -> { enumMap.put(Panda.Gene.NORMAL, ResourceLocation.withDefaultNamespace("textures/entity/panda/panda.png")); enumMap.put(Panda.Gene.LAZY, ResourceLocation.withDefaultNamespace("textures/entity/panda/lazy_panda.png")); @@ -27,73 +28,90 @@ public class PandaRenderer extends MobRenderer> { }); public PandaRenderer(EntityRendererProvider.Context context) { - super(context, new PandaModel<>(context.bakeLayer(ModelLayers.PANDA)), 0.9F); - this.addLayer(new PandaHoldsItemLayer(this, context.getItemInHandRenderer())); + super(context, new PandaModel(context.bakeLayer(ModelLayers.PANDA)), new PandaModel(context.bakeLayer(ModelLayers.PANDA_BABY)), 0.9F); + this.addLayer(new PandaHoldsItemLayer(this, context.getItemRenderer())); } - /** - * Returns the location of an entity's texture. - */ - public ResourceLocation getTextureLocation(Panda entity) { - return (ResourceLocation)TEXTURES.getOrDefault(entity.getVariant(), (ResourceLocation)TEXTURES.get(Panda.Gene.NORMAL)); + public ResourceLocation getTextureLocation(PandaRenderState pandaRenderState) { + return (ResourceLocation)TEXTURES.getOrDefault(pandaRenderState.variant, (ResourceLocation)TEXTURES.get(Panda.Gene.NORMAL)); } - protected void setupRotations(Panda entity, PoseStack poseStack, float bob, float yBodyRot, float partialTick, float scale) { - super.setupRotations(entity, poseStack, bob, yBodyRot, partialTick, scale); - if (entity.rollCounter > 0) { - int i = entity.rollCounter; + public PandaRenderState createRenderState() { + return new PandaRenderState(); + } + + public void extractRenderState(Panda panda, PandaRenderState pandaRenderState, float f) { + super.extractRenderState(panda, pandaRenderState, f); + pandaRenderState.variant = panda.getVariant(); + pandaRenderState.isUnhappy = panda.getUnhappyCounter() > 0; + pandaRenderState.isSneezing = panda.isSneezing(); + pandaRenderState.sneezeTime = panda.getSneezeCounter(); + pandaRenderState.isEating = panda.isEating(); + pandaRenderState.isScared = panda.isScared(); + pandaRenderState.isSitting = panda.isSitting(); + pandaRenderState.sitAmount = panda.getSitAmount(f); + pandaRenderState.lieOnBackAmount = panda.getLieOnBackAmount(f); + pandaRenderState.rollAmount = panda.isBaby() ? 0.0F : panda.getRollAmount(f); + pandaRenderState.rollTime = panda.rollCounter > 0 ? panda.rollCounter + f : 0.0F; + } + + protected void setupRotations(PandaRenderState pandaRenderState, PoseStack poseStack, float f, float g) { + super.setupRotations(pandaRenderState, poseStack, f, g); + if (pandaRenderState.rollTime > 0.0F) { + float h = Mth.frac(pandaRenderState.rollTime); + int i = Mth.floor(pandaRenderState.rollTime); int j = i + 1; - float f = 7.0F; - float g = entity.isBaby() ? 0.3F : 0.8F; - if (i < 8) { - float h = 90 * i / 7.0F; - float k = 90 * j / 7.0F; - float l = this.getAngle(h, k, j, partialTick, 8.0F); - poseStack.translate(0.0F, (g + 0.2F) * (l / 90.0F), 0.0F); - poseStack.mulPose(Axis.XP.rotationDegrees(-l)); - } else if (i < 16) { - float h = (i - 8.0F) / 7.0F; - float k = 90.0F + 90.0F * h; - float m = 90.0F + 90.0F * (j - 8.0F) / 7.0F; - float l = this.getAngle(k, m, j, partialTick, 16.0F); - poseStack.translate(0.0F, g + 0.2F + (g - 0.2F) * (l - 90.0F) / 90.0F, 0.0F); - poseStack.mulPose(Axis.XP.rotationDegrees(-l)); + float k = 7.0F; + float l = pandaRenderState.isBaby ? 0.3F : 0.8F; + if (i < 8.0F) { + float m = 90.0F * i / 7.0F; + float n = 90.0F * j / 7.0F; + float o = this.getAngle(m, n, j, h, 8.0F); + poseStack.translate(0.0F, (l + 0.2F) * (o / 90.0F), 0.0F); + poseStack.mulPose(Axis.XP.rotationDegrees(-o)); + } else if (i < 16.0F) { + float m = (i - 8.0F) / 7.0F; + float n = 90.0F + 90.0F * m; + float p = 90.0F + 90.0F * (j - 8.0F) / 7.0F; + float o = this.getAngle(n, p, j, h, 16.0F); + poseStack.translate(0.0F, l + 0.2F + (l - 0.2F) * (o - 90.0F) / 90.0F, 0.0F); + poseStack.mulPose(Axis.XP.rotationDegrees(-o)); } else if (i < 24.0F) { - float h = (i - 16.0F) / 7.0F; - float k = 180.0F + 90.0F * h; - float m = 180.0F + 90.0F * (j - 16.0F) / 7.0F; - float l = this.getAngle(k, m, j, partialTick, 24.0F); - poseStack.translate(0.0F, g + g * (270.0F - l) / 90.0F, 0.0F); - poseStack.mulPose(Axis.XP.rotationDegrees(-l)); + float m = (i - 16.0F) / 7.0F; + float n = 180.0F + 90.0F * m; + float p = 180.0F + 90.0F * (j - 16.0F) / 7.0F; + float o = this.getAngle(n, p, j, h, 24.0F); + poseStack.translate(0.0F, l + l * (270.0F - o) / 90.0F, 0.0F); + poseStack.mulPose(Axis.XP.rotationDegrees(-o)); } else if (i < 32) { - float h = (i - 24.0F) / 7.0F; - float k = 270.0F + 90.0F * h; - float m = 270.0F + 90.0F * (j - 24.0F) / 7.0F; - float l = this.getAngle(k, m, j, partialTick, 32.0F); - poseStack.translate(0.0F, g * ((360.0F - l) / 90.0F), 0.0F); - poseStack.mulPose(Axis.XP.rotationDegrees(-l)); + float m = (i - 24.0F) / 7.0F; + float n = 270.0F + 90.0F * m; + float p = 270.0F + 90.0F * (j - 24.0F) / 7.0F; + float o = this.getAngle(n, p, j, h, 32.0F); + poseStack.translate(0.0F, l * ((360.0F - o) / 90.0F), 0.0F); + poseStack.mulPose(Axis.XP.rotationDegrees(-o)); } } - float n = entity.getSitAmount(partialTick); - if (n > 0.0F) { - poseStack.translate(0.0F, 0.8F * n, 0.0F); - poseStack.mulPose(Axis.XP.rotationDegrees(Mth.lerp(n, entity.getXRot(), entity.getXRot() + 90.0F))); - poseStack.translate(0.0F, -1.0F * n, 0.0F); - if (entity.isScared()) { - float o = (float)(Math.cos(entity.tickCount * 1.25) * Math.PI * 0.05F); - poseStack.mulPose(Axis.YP.rotationDegrees(o)); - if (entity.isBaby()) { + float h = pandaRenderState.sitAmount; + if (h > 0.0F) { + poseStack.translate(0.0F, 0.8F * h, 0.0F); + poseStack.mulPose(Axis.XP.rotationDegrees(Mth.lerp(h, pandaRenderState.xRot, pandaRenderState.xRot + 90.0F))); + poseStack.translate(0.0F, -1.0F * h, 0.0F); + if (pandaRenderState.isScared) { + float q = (float)(Math.cos(pandaRenderState.ageInTicks * 1.25F) * Math.PI * 0.05F); + poseStack.mulPose(Axis.YP.rotationDegrees(q)); + if (pandaRenderState.isBaby) { poseStack.translate(0.0F, 0.8F, 0.55F); } } } - float o = entity.getLieOnBackAmount(partialTick); - if (o > 0.0F) { - float f = entity.isBaby() ? 0.5F : 1.3F; - poseStack.translate(0.0F, f * o, 0.0F); - poseStack.mulPose(Axis.XP.rotationDegrees(Mth.lerp(o, entity.getXRot(), entity.getXRot() + 180.0F))); + float q = pandaRenderState.lieOnBackAmount; + if (q > 0.0F) { + float r = pandaRenderState.isBaby ? 0.5F : 1.3F; + poseStack.translate(0.0F, r * q, 0.0F); + poseStack.mulPose(Axis.XP.rotationDegrees(Mth.lerp(q, pandaRenderState.xRot, pandaRenderState.xRot + 180.0F))); } } diff --git a/net/minecraft/client/renderer/entity/ParrotRenderer.java b/net/minecraft/client/renderer/entity/ParrotRenderer.java index f2b7a4da..3a4f8c32 100644 --- a/net/minecraft/client/renderer/entity/ParrotRenderer.java +++ b/net/minecraft/client/renderer/entity/ParrotRenderer.java @@ -4,12 +4,13 @@ import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.model.ParrotModel; import net.minecraft.client.model.geom.ModelLayers; +import net.minecraft.client.renderer.entity.state.ParrotRenderState; import net.minecraft.resources.ResourceLocation; import net.minecraft.util.Mth; import net.minecraft.world.entity.animal.Parrot; @Environment(EnvType.CLIENT) -public class ParrotRenderer extends MobRenderer { +public class ParrotRenderer extends MobRenderer { private static final ResourceLocation RED_BLUE = ResourceLocation.withDefaultNamespace("textures/entity/parrot/parrot_red_blue.png"); private static final ResourceLocation BLUE = ResourceLocation.withDefaultNamespace("textures/entity/parrot/parrot_blue.png"); private static final ResourceLocation GREEN = ResourceLocation.withDefaultNamespace("textures/entity/parrot/parrot_green.png"); @@ -20,11 +21,21 @@ public class ParrotRenderer extends MobRenderer { super(context, new ParrotModel(context.bakeLayer(ModelLayers.PARROT)), 0.3F); } - /** - * Returns the location of an entity's texture. - */ - public ResourceLocation getTextureLocation(Parrot entity) { - return getVariantTexture(entity.getVariant()); + public ResourceLocation getTextureLocation(ParrotRenderState parrotRenderState) { + return getVariantTexture(parrotRenderState.variant); + } + + public ParrotRenderState createRenderState() { + return new ParrotRenderState(); + } + + public void extractRenderState(Parrot parrot, ParrotRenderState parrotRenderState, float f) { + super.extractRenderState(parrot, parrotRenderState, f); + parrotRenderState.variant = parrot.getVariant(); + float g = Mth.lerp(f, parrot.oFlap, parrot.flap); + float h = Mth.lerp(f, parrot.oFlapSpeed, parrot.flapSpeed); + parrotRenderState.flapAngle = (Mth.sin(g) + 1.0F) * h; + parrotRenderState.pose = ParrotModel.getPose(parrot); } public static ResourceLocation getVariantTexture(Parrot.Variant variant) { @@ -36,13 +47,4 @@ public class ParrotRenderer extends MobRenderer { case GRAY -> GREY; }; } - - /** - * Defines what float the third param in setRotationAngles of ModelBase is - */ - public float getBob(Parrot livingBase, float partialTicks) { - float f = Mth.lerp(partialTicks, livingBase.oFlap, livingBase.flap); - float g = Mth.lerp(partialTicks, livingBase.oFlapSpeed, livingBase.flapSpeed); - return (Mth.sin(f) + 1.0F) * g; - } } diff --git a/net/minecraft/client/renderer/entity/PhantomRenderer.java b/net/minecraft/client/renderer/entity/PhantomRenderer.java index a77c003e..5cd973ac 100644 --- a/net/minecraft/client/renderer/entity/PhantomRenderer.java +++ b/net/minecraft/client/renderer/entity/PhantomRenderer.java @@ -7,34 +7,41 @@ import net.fabricmc.api.Environment; import net.minecraft.client.model.PhantomModel; import net.minecraft.client.model.geom.ModelLayers; import net.minecraft.client.renderer.entity.layers.PhantomEyesLayer; +import net.minecraft.client.renderer.entity.state.PhantomRenderState; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.monster.Phantom; @Environment(EnvType.CLIENT) -public class PhantomRenderer extends MobRenderer> { +public class PhantomRenderer extends MobRenderer { private static final ResourceLocation PHANTOM_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/phantom.png"); public PhantomRenderer(EntityRendererProvider.Context context) { - super(context, new PhantomModel<>(context.bakeLayer(ModelLayers.PHANTOM)), 0.75F); - this.addLayer(new PhantomEyesLayer<>(this)); + super(context, new PhantomModel(context.bakeLayer(ModelLayers.PHANTOM)), 0.75F); + this.addLayer(new PhantomEyesLayer(this)); } - /** - * Returns the location of an entity's texture. - */ - public ResourceLocation getTextureLocation(Phantom entity) { + public ResourceLocation getTextureLocation(PhantomRenderState phantomRenderState) { return PHANTOM_LOCATION; } - protected void scale(Phantom livingEntity, PoseStack poseStack, float partialTickTime) { - int i = livingEntity.getPhantomSize(); - float f = 1.0F + 0.15F * i; + public PhantomRenderState createRenderState() { + return new PhantomRenderState(); + } + + public void extractRenderState(Phantom phantom, PhantomRenderState phantomRenderState, float f) { + super.extractRenderState(phantom, phantomRenderState, f); + phantomRenderState.flapTime = phantom.getUniqueFlapTickOffset() + phantomRenderState.ageInTicks; + phantomRenderState.size = phantom.getPhantomSize(); + } + + protected void scale(PhantomRenderState phantomRenderState, PoseStack poseStack) { + float f = 1.0F + 0.15F * phantomRenderState.size; poseStack.scale(f, f, f); poseStack.translate(0.0F, 1.3125F, 0.1875F); } - protected void setupRotations(Phantom entity, PoseStack poseStack, float bob, float yBodyRot, float partialTick, float scale) { - super.setupRotations(entity, poseStack, bob, yBodyRot, partialTick, scale); - poseStack.mulPose(Axis.XP.rotationDegrees(entity.getXRot())); + protected void setupRotations(PhantomRenderState phantomRenderState, PoseStack poseStack, float f, float g) { + super.setupRotations(phantomRenderState, poseStack, f, g); + poseStack.mulPose(Axis.XP.rotationDegrees(phantomRenderState.xRot)); } } diff --git a/net/minecraft/client/renderer/entity/PigRenderer.java b/net/minecraft/client/renderer/entity/PigRenderer.java index ccfe29e4..3ece7af2 100644 --- a/net/minecraft/client/renderer/entity/PigRenderer.java +++ b/net/minecraft/client/renderer/entity/PigRenderer.java @@ -5,26 +5,36 @@ import net.fabricmc.api.Environment; import net.minecraft.client.model.PigModel; import net.minecraft.client.model.geom.ModelLayers; import net.minecraft.client.renderer.entity.layers.SaddleLayer; +import net.minecraft.client.renderer.entity.state.PigRenderState; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.animal.Pig; @Environment(EnvType.CLIENT) -public class PigRenderer extends MobRenderer> { +public class PigRenderer extends AgeableMobRenderer { private static final ResourceLocation PIG_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/pig/pig.png"); public PigRenderer(EntityRendererProvider.Context context) { - super(context, new PigModel<>(context.bakeLayer(ModelLayers.PIG)), 0.7F); + super(context, new PigModel(context.bakeLayer(ModelLayers.PIG)), new PigModel(context.bakeLayer(ModelLayers.PIG_BABY)), 0.7F); this.addLayer( new SaddleLayer<>( - this, new PigModel<>(context.bakeLayer(ModelLayers.PIG_SADDLE)), ResourceLocation.withDefaultNamespace("textures/entity/pig/pig_saddle.png") + this, + new PigModel(context.bakeLayer(ModelLayers.PIG_SADDLE)), + new PigModel(context.bakeLayer(ModelLayers.PIG_BABY_SADDLE)), + ResourceLocation.withDefaultNamespace("textures/entity/pig/pig_saddle.png") ) ); } - /** - * Returns the location of an entity's texture. - */ - public ResourceLocation getTextureLocation(Pig entity) { + public ResourceLocation getTextureLocation(PigRenderState pigRenderState) { return PIG_LOCATION; } + + public PigRenderState createRenderState() { + return new PigRenderState(); + } + + public void extractRenderState(Pig pig, PigRenderState pigRenderState, float f) { + super.extractRenderState(pig, pigRenderState, f); + pigRenderState.isSaddled = pig.isSaddled(); + } } diff --git a/net/minecraft/client/renderer/entity/PiglinRenderer.java b/net/minecraft/client/renderer/entity/PiglinRenderer.java index 46e61169..c7fd12bb 100644 --- a/net/minecraft/client/renderer/entity/PiglinRenderer.java +++ b/net/minecraft/client/renderer/entity/PiglinRenderer.java @@ -1,71 +1,69 @@ package net.minecraft.client.renderer.entity; -import com.google.common.collect.ImmutableMap; -import java.util.Map; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.model.HumanoidArmorModel; import net.minecraft.client.model.PiglinModel; -import net.minecraft.client.model.geom.EntityModelSet; import net.minecraft.client.model.geom.ModelLayerLocation; +import net.minecraft.client.renderer.entity.layers.CustomHeadLayer; import net.minecraft.client.renderer.entity.layers.HumanoidArmorLayer; +import net.minecraft.client.renderer.entity.state.PiglinRenderState; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.EntityType; -import net.minecraft.world.entity.Mob; import net.minecraft.world.entity.monster.piglin.AbstractPiglin; +import net.minecraft.world.item.CrossbowItem; @Environment(EnvType.CLIENT) -public class PiglinRenderer extends HumanoidMobRenderer> { - private static final Map, ResourceLocation> TEXTURES = ImmutableMap.of( - EntityType.PIGLIN, - ResourceLocation.withDefaultNamespace("textures/entity/piglin/piglin.png"), - EntityType.ZOMBIFIED_PIGLIN, - ResourceLocation.withDefaultNamespace("textures/entity/piglin/zombified_piglin.png"), - EntityType.PIGLIN_BRUTE, - ResourceLocation.withDefaultNamespace("textures/entity/piglin/piglin_brute.png") - ); - private static final float PIGLIN_CUSTOM_HEAD_SCALE = 1.0019531F; +public class PiglinRenderer extends HumanoidMobRenderer { + private static final ResourceLocation PIGLIN_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/piglin/piglin.png"); + private static final ResourceLocation PIGLIN_BRUTE_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/piglin/piglin_brute.png"); + public static final CustomHeadLayer.Transforms PIGLIN_CUSTOM_HEAD_TRANSFORMS = new CustomHeadLayer.Transforms(0.0F, 0.0F, 1.0019531F); public PiglinRenderer( EntityRendererProvider.Context context, - ModelLayerLocation layer, ModelLayerLocation modelLayerLocation, ModelLayerLocation modelLayerLocation2, - boolean noRightEar + ModelLayerLocation modelLayerLocation3, + ModelLayerLocation modelLayerLocation4, + ModelLayerLocation modelLayerLocation5, + ModelLayerLocation modelLayerLocation6 ) { - super(context, createModel(context.getModelSet(), layer, noRightEar), 0.5F, 1.0019531F, 1.0F, 1.0019531F); + super( + context, + new PiglinModel(context.bakeLayer(modelLayerLocation)), + new PiglinModel(context.bakeLayer(modelLayerLocation2)), + 0.5F, + PIGLIN_CUSTOM_HEAD_TRANSFORMS + ); this.addLayer( new HumanoidArmorLayer<>( this, - new HumanoidArmorModel(context.bakeLayer(modelLayerLocation)), - new HumanoidArmorModel(context.bakeLayer(modelLayerLocation2)), - context.getModelManager() + new HumanoidArmorModel(context.bakeLayer(modelLayerLocation3)), + new HumanoidArmorModel(context.bakeLayer(modelLayerLocation4)), + new HumanoidArmorModel(context.bakeLayer(modelLayerLocation5)), + new HumanoidArmorModel(context.bakeLayer(modelLayerLocation6)), + context.getEquipmentRenderer() ) ); } - private static PiglinModel createModel(EntityModelSet modelSet, ModelLayerLocation layer, boolean noRightEar) { - PiglinModel piglinModel = new PiglinModel<>(modelSet.bakeLayer(layer)); - if (noRightEar) { - piglinModel.rightEar.visible = false; - } - - return piglinModel; + public ResourceLocation getTextureLocation(PiglinRenderState piglinRenderState) { + return piglinRenderState.isBrute ? PIGLIN_BRUTE_LOCATION : PIGLIN_LOCATION; } - /** - * Returns the location of an entity's texture. - */ - public ResourceLocation getTextureLocation(Mob entity) { - ResourceLocation resourceLocation = (ResourceLocation)TEXTURES.get(entity.getType()); - if (resourceLocation == null) { - throw new IllegalArgumentException("I don't know what texture to use for " + entity.getType()); - } else { - return resourceLocation; - } + public PiglinRenderState createRenderState() { + return new PiglinRenderState(); } - protected boolean isShaking(Mob entity) { - return super.isShaking(entity) || entity instanceof AbstractPiglin && ((AbstractPiglin)entity).isConverting(); + public void extractRenderState(AbstractPiglin abstractPiglin, PiglinRenderState piglinRenderState, float f) { + super.extractRenderState(abstractPiglin, piglinRenderState, f); + piglinRenderState.isBrute = abstractPiglin.getType() == EntityType.PIGLIN_BRUTE; + piglinRenderState.armPose = abstractPiglin.getArmPose(); + piglinRenderState.maxCrossbowChageDuration = CrossbowItem.getChargeDuration(abstractPiglin.getUseItem(), abstractPiglin); + piglinRenderState.isConverting = abstractPiglin.isConverting(); + } + + protected boolean isShaking(PiglinRenderState piglinRenderState) { + return super.isShaking(piglinRenderState) || piglinRenderState.isConverting; } } diff --git a/net/minecraft/client/renderer/entity/PillagerRenderer.java b/net/minecraft/client/renderer/entity/PillagerRenderer.java index 07b2034f..74764edd 100644 --- a/net/minecraft/client/renderer/entity/PillagerRenderer.java +++ b/net/minecraft/client/renderer/entity/PillagerRenderer.java @@ -5,22 +5,24 @@ import net.fabricmc.api.Environment; import net.minecraft.client.model.IllagerModel; import net.minecraft.client.model.geom.ModelLayers; import net.minecraft.client.renderer.entity.layers.ItemInHandLayer; +import net.minecraft.client.renderer.entity.state.IllagerRenderState; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.monster.Pillager; @Environment(EnvType.CLIENT) -public class PillagerRenderer extends IllagerRenderer { +public class PillagerRenderer extends IllagerRenderer { private static final ResourceLocation PILLAGER = ResourceLocation.withDefaultNamespace("textures/entity/illager/pillager.png"); public PillagerRenderer(EntityRendererProvider.Context context) { super(context, new IllagerModel<>(context.bakeLayer(ModelLayers.PILLAGER)), 0.5F); - this.addLayer(new ItemInHandLayer<>(this, context.getItemInHandRenderer())); + this.addLayer(new ItemInHandLayer<>(this, context.getItemRenderer())); } - /** - * Returns the location of an entity's texture. - */ - public ResourceLocation getTextureLocation(Pillager entity) { + public ResourceLocation getTextureLocation(IllagerRenderState illagerRenderState) { return PILLAGER; } + + public IllagerRenderState createRenderState() { + return new IllagerRenderState(); + } } diff --git a/net/minecraft/client/renderer/entity/PolarBearRenderer.java b/net/minecraft/client/renderer/entity/PolarBearRenderer.java index 7ee19767..dc6038cc 100644 --- a/net/minecraft/client/renderer/entity/PolarBearRenderer.java +++ b/net/minecraft/client/renderer/entity/PolarBearRenderer.java @@ -1,30 +1,31 @@ package net.minecraft.client.renderer.entity; -import com.mojang.blaze3d.vertex.PoseStack; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.model.PolarBearModel; import net.minecraft.client.model.geom.ModelLayers; +import net.minecraft.client.renderer.entity.state.PolarBearRenderState; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.animal.PolarBear; @Environment(EnvType.CLIENT) -public class PolarBearRenderer extends MobRenderer> { +public class PolarBearRenderer extends AgeableMobRenderer { private static final ResourceLocation BEAR_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/bear/polarbear.png"); public PolarBearRenderer(EntityRendererProvider.Context context) { - super(context, new PolarBearModel<>(context.bakeLayer(ModelLayers.POLAR_BEAR)), 0.9F); + super(context, new PolarBearModel(context.bakeLayer(ModelLayers.POLAR_BEAR)), new PolarBearModel(context.bakeLayer(ModelLayers.POLAR_BEAR_BABY)), 0.9F); } - /** - * Returns the location of an entity's texture. - */ - public ResourceLocation getTextureLocation(PolarBear entity) { + public ResourceLocation getTextureLocation(PolarBearRenderState polarBearRenderState) { return BEAR_LOCATION; } - protected void scale(PolarBear livingEntity, PoseStack poseStack, float partialTickTime) { - poseStack.scale(1.2F, 1.2F, 1.2F); - super.scale(livingEntity, poseStack, partialTickTime); + public PolarBearRenderState createRenderState() { + return new PolarBearRenderState(); + } + + public void extractRenderState(PolarBear polarBear, PolarBearRenderState polarBearRenderState, float f) { + super.extractRenderState(polarBear, polarBearRenderState, f); + polarBearRenderState.standScale = polarBear.getStandingAnimationScale(f); } } diff --git a/net/minecraft/client/renderer/entity/PufferfishRenderer.java b/net/minecraft/client/renderer/entity/PufferfishRenderer.java index 92c45beb..4a8dc70e 100644 --- a/net/minecraft/client/renderer/entity/PufferfishRenderer.java +++ b/net/minecraft/client/renderer/entity/PufferfishRenderer.java @@ -9,50 +9,50 @@ import net.minecraft.client.model.PufferfishMidModel; import net.minecraft.client.model.PufferfishSmallModel; import net.minecraft.client.model.geom.ModelLayers; import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.entity.state.EntityRenderState; +import net.minecraft.client.renderer.entity.state.PufferfishRenderState; import net.minecraft.resources.ResourceLocation; import net.minecraft.util.Mth; import net.minecraft.world.entity.animal.Pufferfish; @Environment(EnvType.CLIENT) -public class PufferfishRenderer extends MobRenderer> { +public class PufferfishRenderer extends MobRenderer> { private static final ResourceLocation PUFFER_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/fish/pufferfish.png"); - private int puffStateO = 3; - private final EntityModel small; - private final EntityModel mid; - private final EntityModel big = this.getModel(); + private final EntityModel small; + private final EntityModel mid; + private final EntityModel big = this.getModel(); public PufferfishRenderer(EntityRendererProvider.Context context) { - super(context, new PufferfishBigModel<>(context.bakeLayer(ModelLayers.PUFFERFISH_BIG)), 0.2F); - this.mid = new PufferfishMidModel<>(context.bakeLayer(ModelLayers.PUFFERFISH_MEDIUM)); - this.small = new PufferfishSmallModel<>(context.bakeLayer(ModelLayers.PUFFERFISH_SMALL)); + super(context, new PufferfishBigModel(context.bakeLayer(ModelLayers.PUFFERFISH_BIG)), 0.2F); + this.mid = new PufferfishMidModel(context.bakeLayer(ModelLayers.PUFFERFISH_MEDIUM)); + this.small = new PufferfishSmallModel(context.bakeLayer(ModelLayers.PUFFERFISH_SMALL)); } - /** - * Returns the location of an entity's texture. - */ - public ResourceLocation getTextureLocation(Pufferfish entity) { + public ResourceLocation getTextureLocation(PufferfishRenderState pufferfishRenderState) { return PUFFER_LOCATION; } - public void render(Pufferfish entity, float entityYaw, float partialTicks, PoseStack poseStack, MultiBufferSource buffer, int packedLight) { - int i = entity.getPuffState(); - if (i != this.puffStateO) { - if (i == 0) { - this.model = this.small; - } else if (i == 1) { - this.model = this.mid; - } else { - this.model = this.big; - } - } - - this.puffStateO = i; - this.shadowRadius = 0.1F + 0.1F * i; - super.render(entity, entityYaw, partialTicks, poseStack, buffer, packedLight); + public PufferfishRenderState createRenderState() { + return new PufferfishRenderState(); } - protected void setupRotations(Pufferfish entity, PoseStack poseStack, float bob, float yBodyRot, float partialTick, float scale) { - poseStack.translate(0.0F, Mth.cos(bob * 0.05F) * 0.08F, 0.0F); - super.setupRotations(entity, poseStack, bob, yBodyRot, partialTick, scale); + public void render(PufferfishRenderState pufferfishRenderState, PoseStack poseStack, MultiBufferSource multiBufferSource, int i) { + this.model = switch (pufferfishRenderState.puffState) { + case 0 -> this.small; + case 1 -> this.mid; + default -> this.big; + }; + this.shadowRadius = 0.1F + 0.1F * pufferfishRenderState.puffState; + super.render(pufferfishRenderState, poseStack, multiBufferSource, i); + } + + public void extractRenderState(Pufferfish pufferfish, PufferfishRenderState pufferfishRenderState, float f) { + super.extractRenderState(pufferfish, pufferfishRenderState, f); + pufferfishRenderState.puffState = pufferfish.getPuffState(); + } + + protected void setupRotations(PufferfishRenderState pufferfishRenderState, PoseStack poseStack, float f, float g) { + poseStack.translate(0.0F, Mth.cos(pufferfishRenderState.ageInTicks * 0.05F) * 0.08F, 0.0F); + super.setupRotations(pufferfishRenderState, poseStack, f, g); } } diff --git a/net/minecraft/client/renderer/entity/RabbitRenderer.java b/net/minecraft/client/renderer/entity/RabbitRenderer.java index 50d045ce..f61ea664 100644 --- a/net/minecraft/client/renderer/entity/RabbitRenderer.java +++ b/net/minecraft/client/renderer/entity/RabbitRenderer.java @@ -5,11 +5,12 @@ import net.fabricmc.api.Environment; import net.minecraft.ChatFormatting; import net.minecraft.client.model.RabbitModel; import net.minecraft.client.model.geom.ModelLayers; +import net.minecraft.client.renderer.entity.state.RabbitRenderState; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.animal.Rabbit; @Environment(EnvType.CLIENT) -public class RabbitRenderer extends MobRenderer> { +public class RabbitRenderer extends AgeableMobRenderer { private static final ResourceLocation RABBIT_BROWN_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/rabbit/brown.png"); private static final ResourceLocation RABBIT_WHITE_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/rabbit/white.png"); private static final ResourceLocation RABBIT_BLACK_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/rabbit/black.png"); @@ -20,18 +21,14 @@ public class RabbitRenderer extends MobRenderer> { private static final ResourceLocation RABBIT_EVIL_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/rabbit/caerbannog.png"); public RabbitRenderer(EntityRendererProvider.Context context) { - super(context, new RabbitModel<>(context.bakeLayer(ModelLayers.RABBIT)), 0.3F); + super(context, new RabbitModel(context.bakeLayer(ModelLayers.RABBIT)), new RabbitModel(context.bakeLayer(ModelLayers.RABBIT_BABY)), 0.3F); } - /** - * Returns the location of an entity's texture. - */ - public ResourceLocation getTextureLocation(Rabbit entity) { - String string = ChatFormatting.stripFormatting(entity.getName().getString()); - if ("Toast".equals(string)) { + public ResourceLocation getTextureLocation(RabbitRenderState rabbitRenderState) { + if (rabbitRenderState.isToast) { return RABBIT_TOAST_LOCATION; } else { - return switch (entity.getVariant()) { + return switch (rabbitRenderState.variant) { case BROWN -> RABBIT_BROWN_LOCATION; case WHITE -> RABBIT_WHITE_LOCATION; case BLACK -> RABBIT_BLACK_LOCATION; @@ -42,4 +39,15 @@ public class RabbitRenderer extends MobRenderer> { }; } } + + public RabbitRenderState createRenderState() { + return new RabbitRenderState(); + } + + public void extractRenderState(Rabbit rabbit, RabbitRenderState rabbitRenderState, float f) { + super.extractRenderState(rabbit, rabbitRenderState, f); + rabbitRenderState.jumpCompletion = rabbit.getJumpCompletion(f); + rabbitRenderState.isToast = "Toast".equals(ChatFormatting.stripFormatting(rabbit.getName().getString())); + rabbitRenderState.variant = rabbit.getVariant(); + } } diff --git a/net/minecraft/client/renderer/entity/RaftRenderer.java b/net/minecraft/client/renderer/entity/RaftRenderer.java new file mode 100644 index 00000000..512bba5b --- /dev/null +++ b/net/minecraft/client/renderer/entity/RaftRenderer.java @@ -0,0 +1,33 @@ +package net.minecraft.client.renderer.entity; + +import java.util.function.UnaryOperator; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.client.model.EntityModel; +import net.minecraft.client.model.RaftModel; +import net.minecraft.client.model.geom.ModelLayerLocation; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.entity.state.BoatRenderState; +import net.minecraft.resources.ResourceLocation; + +@Environment(EnvType.CLIENT) +public class RaftRenderer extends AbstractBoatRenderer { + private final EntityModel model; + private final ResourceLocation texture; + + public RaftRenderer(EntityRendererProvider.Context context, ModelLayerLocation modelLayerLocation) { + super(context); + this.texture = modelLayerLocation.model().withPath((UnaryOperator)(string -> "textures/entity/" + string + ".png")); + this.model = new RaftModel(context.bakeLayer(modelLayerLocation)); + } + + @Override + protected EntityModel model() { + return this.model; + } + + @Override + protected RenderType renderType() { + return this.model.renderType(this.texture); + } +} diff --git a/net/minecraft/client/renderer/entity/RavagerRenderer.java b/net/minecraft/client/renderer/entity/RavagerRenderer.java index f4c6ebc8..d064e8c3 100644 --- a/net/minecraft/client/renderer/entity/RavagerRenderer.java +++ b/net/minecraft/client/renderer/entity/RavagerRenderer.java @@ -4,21 +4,34 @@ import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.model.RavagerModel; import net.minecraft.client.model.geom.ModelLayers; +import net.minecraft.client.renderer.entity.state.RavagerRenderState; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.monster.Ravager; @Environment(EnvType.CLIENT) -public class RavagerRenderer extends MobRenderer { +public class RavagerRenderer extends MobRenderer { private static final ResourceLocation TEXTURE_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/illager/ravager.png"); public RavagerRenderer(EntityRendererProvider.Context context) { super(context, new RavagerModel(context.bakeLayer(ModelLayers.RAVAGER)), 1.1F); } - /** - * Returns the location of an entity's texture. - */ - public ResourceLocation getTextureLocation(Ravager entity) { + public ResourceLocation getTextureLocation(RavagerRenderState ravagerRenderState) { return TEXTURE_LOCATION; } + + public RavagerRenderState createRenderState() { + return new RavagerRenderState(); + } + + public void extractRenderState(Ravager ravager, RavagerRenderState ravagerRenderState, float f) { + super.extractRenderState(ravager, ravagerRenderState, f); + ravagerRenderState.stunnedTicksRemaining = ravager.getStunnedTick() > 0.0F ? ravager.getStunnedTick() - f : 0.0F; + ravagerRenderState.attackTicksRemaining = ravager.getAttackTick() > 0.0F ? ravager.getAttackTick() - f : 0.0F; + if (ravager.getRoarTick() > 0) { + ravagerRenderState.roarAnimation = (20 - ravager.getRoarTick() + f) / 20.0F; + } else { + ravagerRenderState.roarAnimation = 0.0F; + } + } } diff --git a/net/minecraft/client/renderer/entity/RenderLayerParent.java b/net/minecraft/client/renderer/entity/RenderLayerParent.java index 7071d959..9a5458b9 100644 --- a/net/minecraft/client/renderer/entity/RenderLayerParent.java +++ b/net/minecraft/client/renderer/entity/RenderLayerParent.java @@ -3,15 +3,9 @@ package net.minecraft.client.renderer.entity; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.model.EntityModel; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.entity.Entity; +import net.minecraft.client.renderer.entity.state.EntityRenderState; @Environment(EnvType.CLIENT) -public interface RenderLayerParent> { +public interface RenderLayerParent> { M getModel(); - - /** - * Returns the location of an entity's texture. - */ - ResourceLocation getTextureLocation(T entity); } diff --git a/net/minecraft/client/renderer/entity/SalmonRenderer.java b/net/minecraft/client/renderer/entity/SalmonRenderer.java index a64cb56b..c3be7d29 100644 --- a/net/minecraft/client/renderer/entity/SalmonRenderer.java +++ b/net/minecraft/client/renderer/entity/SalmonRenderer.java @@ -6,40 +6,65 @@ import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.model.SalmonModel; import net.minecraft.client.model.geom.ModelLayers; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.entity.state.SalmonRenderState; import net.minecraft.resources.ResourceLocation; import net.minecraft.util.Mth; import net.minecraft.world.entity.animal.Salmon; @Environment(EnvType.CLIENT) -public class SalmonRenderer extends MobRenderer> { +public class SalmonRenderer extends MobRenderer { private static final ResourceLocation SALMON_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/fish/salmon.png"); + private final SalmonModel smallSalmonModel; + private final SalmonModel mediumSalmonModel; + private final SalmonModel largeSalmonModel; public SalmonRenderer(EntityRendererProvider.Context context) { - super(context, new SalmonModel<>(context.bakeLayer(ModelLayers.SALMON)), 0.4F); + super(context, new SalmonModel(context.bakeLayer(ModelLayers.SALMON)), 0.4F); + this.smallSalmonModel = new SalmonModel(context.bakeLayer(ModelLayers.SALMON_SMALL)); + this.mediumSalmonModel = new SalmonModel(context.bakeLayer(ModelLayers.SALMON)); + this.largeSalmonModel = new SalmonModel(context.bakeLayer(ModelLayers.SALMON_LARGE)); } - /** - * Returns the location of an entity's texture. - */ - public ResourceLocation getTextureLocation(Salmon entity) { + public void extractRenderState(Salmon salmon, SalmonRenderState salmonRenderState, float f) { + super.extractRenderState(salmon, salmonRenderState, f); + salmonRenderState.variant = salmon.getVariant(); + } + + public ResourceLocation getTextureLocation(SalmonRenderState salmonRenderState) { return SALMON_LOCATION; } - protected void setupRotations(Salmon entity, PoseStack poseStack, float bob, float yBodyRot, float partialTick, float scale) { - super.setupRotations(entity, poseStack, bob, yBodyRot, partialTick, scale); - float f = 1.0F; - float g = 1.0F; - if (!entity.isInWater()) { - f = 1.3F; - g = 1.7F; + public SalmonRenderState createRenderState() { + return new SalmonRenderState(); + } + + protected void setupRotations(SalmonRenderState salmonRenderState, PoseStack poseStack, float f, float g) { + super.setupRotations(salmonRenderState, poseStack, f, g); + float h = 1.0F; + float i = 1.0F; + if (!salmonRenderState.isInWater) { + h = 1.3F; + i = 1.7F; } - float h = f * 4.3F * Mth.sin(g * 0.6F * bob); - poseStack.mulPose(Axis.YP.rotationDegrees(h)); - poseStack.translate(0.0F, 0.0F, -0.4F); - if (!entity.isInWater()) { + float j = h * 4.3F * Mth.sin(i * 0.6F * salmonRenderState.ageInTicks); + poseStack.mulPose(Axis.YP.rotationDegrees(j)); + if (!salmonRenderState.isInWater) { poseStack.translate(0.2F, 0.1F, 0.0F); poseStack.mulPose(Axis.ZP.rotationDegrees(90.0F)); } } + + public void render(SalmonRenderState salmonRenderState, PoseStack poseStack, MultiBufferSource multiBufferSource, int i) { + if (salmonRenderState.variant == Salmon.Variant.SMALL) { + this.model = this.smallSalmonModel; + } else if (salmonRenderState.variant == Salmon.Variant.LARGE) { + this.model = this.largeSalmonModel; + } else { + this.model = this.mediumSalmonModel; + } + + super.render(salmonRenderState, poseStack, multiBufferSource, i); + } } diff --git a/net/minecraft/client/renderer/entity/SheepRenderer.java b/net/minecraft/client/renderer/entity/SheepRenderer.java index aa9cb0dc..17078053 100644 --- a/net/minecraft/client/renderer/entity/SheepRenderer.java +++ b/net/minecraft/client/renderer/entity/SheepRenderer.java @@ -4,23 +4,34 @@ import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.model.SheepModel; import net.minecraft.client.model.geom.ModelLayers; -import net.minecraft.client.renderer.entity.layers.SheepFurLayer; +import net.minecraft.client.renderer.entity.layers.SheepWoolLayer; +import net.minecraft.client.renderer.entity.state.SheepRenderState; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.animal.Sheep; @Environment(EnvType.CLIENT) -public class SheepRenderer extends MobRenderer> { +public class SheepRenderer extends AgeableMobRenderer { private static final ResourceLocation SHEEP_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/sheep/sheep.png"); public SheepRenderer(EntityRendererProvider.Context context) { - super(context, new SheepModel<>(context.bakeLayer(ModelLayers.SHEEP)), 0.7F); - this.addLayer(new SheepFurLayer(this, context.getModelSet())); + super(context, new SheepModel(context.bakeLayer(ModelLayers.SHEEP)), new SheepModel(context.bakeLayer(ModelLayers.SHEEP_BABY)), 0.7F); + this.addLayer(new SheepWoolLayer(this, context.getModelSet())); } - /** - * Returns the location of an entity's texture. - */ - public ResourceLocation getTextureLocation(Sheep entity) { + public ResourceLocation getTextureLocation(SheepRenderState sheepRenderState) { return SHEEP_LOCATION; } + + public SheepRenderState createRenderState() { + return new SheepRenderState(); + } + + public void extractRenderState(Sheep sheep, SheepRenderState sheepRenderState, float f) { + super.extractRenderState(sheep, sheepRenderState, f); + sheepRenderState.headEatAngleScale = sheep.getHeadEatAngleScale(f); + sheepRenderState.headEatPositionScale = sheep.getHeadEatPositionScale(f); + sheepRenderState.isSheared = sheep.isSheared(); + sheepRenderState.woolColor = sheep.getColor(); + sheepRenderState.id = sheep.getId(); + } } diff --git a/net/minecraft/client/renderer/entity/ShulkerBulletRenderer.java b/net/minecraft/client/renderer/entity/ShulkerBulletRenderer.java index 6416a89a..5a3ca11d 100644 --- a/net/minecraft/client/renderer/entity/ShulkerBulletRenderer.java +++ b/net/minecraft/client/renderer/entity/ShulkerBulletRenderer.java @@ -9,6 +9,7 @@ import net.minecraft.client.model.ShulkerBulletModel; import net.minecraft.client.model.geom.ModelLayers; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.entity.state.ShulkerBulletRenderState; import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.core.BlockPos; import net.minecraft.resources.ResourceLocation; @@ -16,44 +17,45 @@ import net.minecraft.util.Mth; import net.minecraft.world.entity.projectile.ShulkerBullet; @Environment(EnvType.CLIENT) -public class ShulkerBulletRenderer extends EntityRenderer { +public class ShulkerBulletRenderer extends EntityRenderer { private static final ResourceLocation TEXTURE_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/shulker/spark.png"); private static final RenderType RENDER_TYPE = RenderType.entityTranslucent(TEXTURE_LOCATION); - private final ShulkerBulletModel model; + private final ShulkerBulletModel model; public ShulkerBulletRenderer(EntityRendererProvider.Context context) { super(context); - this.model = new ShulkerBulletModel<>(context.bakeLayer(ModelLayers.SHULKER_BULLET)); + this.model = new ShulkerBulletModel(context.bakeLayer(ModelLayers.SHULKER_BULLET)); } protected int getBlockLightLevel(ShulkerBullet entity, BlockPos pos) { return 15; } - public void render(ShulkerBullet entity, float entityYaw, float partialTicks, PoseStack poseStack, MultiBufferSource buffer, int packedLight) { + public void render(ShulkerBulletRenderState shulkerBulletRenderState, PoseStack poseStack, MultiBufferSource multiBufferSource, int i) { poseStack.pushPose(); - float f = Mth.rotLerp(partialTicks, entity.yRotO, entity.getYRot()); - float g = Mth.lerp(partialTicks, entity.xRotO, entity.getXRot()); - float h = entity.tickCount + partialTicks; + float f = shulkerBulletRenderState.ageInTicks; poseStack.translate(0.0F, 0.15F, 0.0F); - poseStack.mulPose(Axis.YP.rotationDegrees(Mth.sin(h * 0.1F) * 180.0F)); - poseStack.mulPose(Axis.XP.rotationDegrees(Mth.cos(h * 0.1F) * 180.0F)); - poseStack.mulPose(Axis.ZP.rotationDegrees(Mth.sin(h * 0.15F) * 360.0F)); + poseStack.mulPose(Axis.YP.rotationDegrees(Mth.sin(f * 0.1F) * 180.0F)); + poseStack.mulPose(Axis.XP.rotationDegrees(Mth.cos(f * 0.1F) * 180.0F)); + poseStack.mulPose(Axis.ZP.rotationDegrees(Mth.sin(f * 0.15F) * 360.0F)); poseStack.scale(-0.5F, -0.5F, 0.5F); - this.model.setupAnim(entity, 0.0F, 0.0F, 0.0F, f, g); - VertexConsumer vertexConsumer = buffer.getBuffer(this.model.renderType(TEXTURE_LOCATION)); - this.model.renderToBuffer(poseStack, vertexConsumer, packedLight, OverlayTexture.NO_OVERLAY); + this.model.setupAnim(shulkerBulletRenderState); + VertexConsumer vertexConsumer = multiBufferSource.getBuffer(this.model.renderType(TEXTURE_LOCATION)); + this.model.renderToBuffer(poseStack, vertexConsumer, i, OverlayTexture.NO_OVERLAY); poseStack.scale(1.5F, 1.5F, 1.5F); - VertexConsumer vertexConsumer2 = buffer.getBuffer(RENDER_TYPE); - this.model.renderToBuffer(poseStack, vertexConsumer2, packedLight, OverlayTexture.NO_OVERLAY, 654311423); + VertexConsumer vertexConsumer2 = multiBufferSource.getBuffer(RENDER_TYPE); + this.model.renderToBuffer(poseStack, vertexConsumer2, i, OverlayTexture.NO_OVERLAY, 654311423); poseStack.popPose(); - super.render(entity, entityYaw, partialTicks, poseStack, buffer, packedLight); + super.render(shulkerBulletRenderState, poseStack, multiBufferSource, i); } - /** - * Returns the location of an entity's texture. - */ - public ResourceLocation getTextureLocation(ShulkerBullet entity) { - return TEXTURE_LOCATION; + public ShulkerBulletRenderState createRenderState() { + return new ShulkerBulletRenderState(); + } + + public void extractRenderState(ShulkerBullet shulkerBullet, ShulkerBulletRenderState shulkerBulletRenderState, float f) { + super.extractRenderState(shulkerBullet, shulkerBulletRenderState, f); + shulkerBulletRenderState.yRot = shulkerBullet.getYRot(f); + shulkerBulletRenderState.xRot = shulkerBullet.getXRot(f); } } diff --git a/net/minecraft/client/renderer/entity/ShulkerRenderer.java b/net/minecraft/client/renderer/entity/ShulkerRenderer.java index 056327f8..39c01fc2 100644 --- a/net/minecraft/client/renderer/entity/ShulkerRenderer.java +++ b/net/minecraft/client/renderer/entity/ShulkerRenderer.java @@ -1,6 +1,7 @@ package net.minecraft.client.renderer.entity; import com.mojang.blaze3d.vertex.PoseStack; +import java.util.Objects; import java.util.function.UnaryOperator; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; @@ -8,7 +9,7 @@ import net.minecraft.client.model.ShulkerModel; import net.minecraft.client.model.geom.ModelLayers; import net.minecraft.client.renderer.Sheets; import net.minecraft.client.renderer.culling.Frustum; -import net.minecraft.client.renderer.entity.layers.ShulkerHeadLayer; +import net.minecraft.client.renderer.entity.state.ShulkerRenderState; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.monster.Shulker; @@ -18,7 +19,7 @@ import net.minecraft.world.phys.Vec3; import org.jetbrains.annotations.Nullable; @Environment(EnvType.CLIENT) -public class ShulkerRenderer extends MobRenderer> { +public class ShulkerRenderer extends MobRenderer { private static final ResourceLocation DEFAULT_TEXTURE_LOCATION = Sheets.DEFAULT_SHULKER_TEXTURE_LOCATION .texture() .withPath((UnaryOperator)(string -> "textures/" + string + ".png")); @@ -28,37 +29,54 @@ public class ShulkerRenderer extends MobRenderer> .toArray(ResourceLocation[]::new); public ShulkerRenderer(EntityRendererProvider.Context context) { - super(context, new ShulkerModel<>(context.bakeLayer(ModelLayers.SHULKER)), 0.0F); - this.addLayer(new ShulkerHeadLayer(this)); + super(context, new ShulkerModel(context.bakeLayer(ModelLayers.SHULKER)), 0.0F); } - public Vec3 getRenderOffset(Shulker entity, float partialTicks) { - return ((Vec3)entity.getRenderPosition(partialTicks).orElse(super.getRenderOffset(entity, partialTicks))).scale(entity.getScale()); + public Vec3 getRenderOffset(ShulkerRenderState shulkerRenderState) { + return shulkerRenderState.renderOffset; } public boolean shouldRender(Shulker livingEntity, Frustum camera, double camX, double camY, double camZ) { - return super.shouldRender(livingEntity, camera, camX, camY, camZ) ? true : livingEntity.getRenderPosition(0.0F).filter(vec3 -> { - EntityType entityType = livingEntity.getType(); - float f = entityType.getHeight() / 2.0F; - float g = entityType.getWidth() / 2.0F; - Vec3 vec32 = Vec3.atBottomCenterOf(livingEntity.blockPosition()); - return camera.isVisible(new AABB(vec3.x, vec3.y + f, vec3.z, vec32.x, vec32.y + f, vec32.z).inflate(g, f, g)); - }).isPresent(); + if (super.shouldRender(livingEntity, camera, camX, camY, camZ)) { + return true; + } else { + Vec3 vec3 = livingEntity.getRenderPosition(0.0F); + if (vec3 == null) { + return false; + } else { + EntityType entityType = livingEntity.getType(); + float f = entityType.getHeight() / 2.0F; + float g = entityType.getWidth() / 2.0F; + Vec3 vec32 = Vec3.atBottomCenterOf(livingEntity.blockPosition()); + return camera.isVisible(new AABB(vec3.x, vec3.y + f, vec3.z, vec32.x, vec32.y + f, vec32.z).inflate(g, f, g)); + } + } } - /** - * Returns the location of an entity's texture. - */ - public ResourceLocation getTextureLocation(Shulker entity) { - return getTextureLocation(entity.getColor()); + public ResourceLocation getTextureLocation(ShulkerRenderState shulkerRenderState) { + return getTextureLocation(shulkerRenderState.color); + } + + public ShulkerRenderState createRenderState() { + return new ShulkerRenderState(); + } + + public void extractRenderState(Shulker shulker, ShulkerRenderState shulkerRenderState, float f) { + super.extractRenderState(shulker, shulkerRenderState, f); + shulkerRenderState.renderOffset = (Vec3)Objects.requireNonNullElse(shulker.getRenderPosition(f), Vec3.ZERO); + shulkerRenderState.color = shulker.getColor(); + shulkerRenderState.peekAmount = shulker.getClientPeekAmount(f); + shulkerRenderState.yHeadRot = shulker.yHeadRot; + shulkerRenderState.yBodyRot = shulker.yBodyRot; + shulkerRenderState.attachFace = shulker.getAttachFace(); } public static ResourceLocation getTextureLocation(@Nullable DyeColor color) { return color == null ? DEFAULT_TEXTURE_LOCATION : TEXTURE_LOCATION[color.getId()]; } - protected void setupRotations(Shulker entity, PoseStack poseStack, float bob, float yBodyRot, float partialTick, float scale) { - super.setupRotations(entity, poseStack, bob, yBodyRot + 180.0F, partialTick, scale); - poseStack.rotateAround(entity.getAttachFace().getOpposite().getRotation(), 0.0F, 0.5F, 0.0F); + protected void setupRotations(ShulkerRenderState shulkerRenderState, PoseStack poseStack, float f, float g) { + super.setupRotations(shulkerRenderState, poseStack, f + 180.0F, g); + poseStack.rotateAround(shulkerRenderState.attachFace.getOpposite().getRotation(), 0.0F, 0.5F, 0.0F); } } diff --git a/net/minecraft/client/renderer/entity/SilverfishRenderer.java b/net/minecraft/client/renderer/entity/SilverfishRenderer.java index d048704e..e3363a74 100644 --- a/net/minecraft/client/renderer/entity/SilverfishRenderer.java +++ b/net/minecraft/client/renderer/entity/SilverfishRenderer.java @@ -4,25 +4,29 @@ import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.model.SilverfishModel; import net.minecraft.client.model.geom.ModelLayers; +import net.minecraft.client.renderer.entity.state.LivingEntityRenderState; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.monster.Silverfish; @Environment(EnvType.CLIENT) -public class SilverfishRenderer extends MobRenderer> { +public class SilverfishRenderer extends MobRenderer { private static final ResourceLocation SILVERFISH_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/silverfish.png"); public SilverfishRenderer(EntityRendererProvider.Context context) { - super(context, new SilverfishModel<>(context.bakeLayer(ModelLayers.SILVERFISH)), 0.3F); + super(context, new SilverfishModel(context.bakeLayer(ModelLayers.SILVERFISH)), 0.3F); } - protected float getFlipDegrees(Silverfish livingEntity) { + @Override + protected float getFlipDegrees() { return 180.0F; } - /** - * Returns the location of an entity's texture. - */ - public ResourceLocation getTextureLocation(Silverfish entity) { + @Override + public ResourceLocation getTextureLocation(LivingEntityRenderState livingEntityRenderState) { return SILVERFISH_LOCATION; } + + public LivingEntityRenderState createRenderState() { + return new LivingEntityRenderState(); + } } diff --git a/net/minecraft/client/renderer/entity/SkeletonRenderer.java b/net/minecraft/client/renderer/entity/SkeletonRenderer.java index c502491d..49770b37 100644 --- a/net/minecraft/client/renderer/entity/SkeletonRenderer.java +++ b/net/minecraft/client/renderer/entity/SkeletonRenderer.java @@ -2,44 +2,24 @@ package net.minecraft.client.renderer.entity; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; -import net.minecraft.client.model.SkeletonModel; -import net.minecraft.client.model.geom.ModelLayerLocation; import net.minecraft.client.model.geom.ModelLayers; -import net.minecraft.client.renderer.entity.layers.HumanoidArmorLayer; +import net.minecraft.client.renderer.entity.state.SkeletonRenderState; import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.entity.monster.AbstractSkeleton; +import net.minecraft.world.entity.monster.Skeleton; @Environment(EnvType.CLIENT) -public class SkeletonRenderer extends HumanoidMobRenderer> { +public class SkeletonRenderer extends AbstractSkeletonRenderer { private static final ResourceLocation SKELETON_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/skeleton/skeleton.png"); public SkeletonRenderer(EntityRendererProvider.Context context) { - this(context, ModelLayers.SKELETON, ModelLayers.SKELETON_INNER_ARMOR, ModelLayers.SKELETON_OUTER_ARMOR); + super(context, ModelLayers.SKELETON, ModelLayers.SKELETON_INNER_ARMOR, ModelLayers.SKELETON_OUTER_ARMOR); } - public SkeletonRenderer( - EntityRendererProvider.Context context, ModelLayerLocation skeletonLayer, ModelLayerLocation innerModelLayer, ModelLayerLocation outerModelLayer - ) { - this(context, innerModelLayer, outerModelLayer, new SkeletonModel<>(context.bakeLayer(skeletonLayer))); - } - - public SkeletonRenderer(EntityRendererProvider.Context context, ModelLayerLocation skeletonLayer, ModelLayerLocation innerModelLayer, SkeletonModel model) { - super(context, model, 0.5F); - this.addLayer( - new HumanoidArmorLayer<>( - this, new SkeletonModel(context.bakeLayer(skeletonLayer)), new SkeletonModel(context.bakeLayer(innerModelLayer)), context.getModelManager() - ) - ); - } - - /** - * Returns the location of an entity's texture. - */ - public ResourceLocation getTextureLocation(T entity) { + public ResourceLocation getTextureLocation(SkeletonRenderState skeletonRenderState) { return SKELETON_LOCATION; } - protected boolean isShaking(T entity) { - return entity.isShaking(); + public SkeletonRenderState createRenderState() { + return new SkeletonRenderState(); } } diff --git a/net/minecraft/client/renderer/entity/SlimeRenderer.java b/net/minecraft/client/renderer/entity/SlimeRenderer.java index 2c5fa8b0..d988c52f 100644 --- a/net/minecraft/client/renderer/entity/SlimeRenderer.java +++ b/net/minecraft/client/renderer/entity/SlimeRenderer.java @@ -7,38 +7,46 @@ import net.minecraft.client.model.SlimeModel; import net.minecraft.client.model.geom.ModelLayers; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.entity.layers.SlimeOuterLayer; +import net.minecraft.client.renderer.entity.state.SlimeRenderState; import net.minecraft.resources.ResourceLocation; import net.minecraft.util.Mth; import net.minecraft.world.entity.monster.Slime; @Environment(EnvType.CLIENT) -public class SlimeRenderer extends MobRenderer> { - private static final ResourceLocation SLIME_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/slime/slime.png"); +public class SlimeRenderer extends MobRenderer { + public static final ResourceLocation SLIME_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/slime/slime.png"); public SlimeRenderer(EntityRendererProvider.Context context) { - super(context, new SlimeModel<>(context.bakeLayer(ModelLayers.SLIME)), 0.25F); - this.addLayer(new SlimeOuterLayer<>(this, context.getModelSet())); + super(context, new SlimeModel(context.bakeLayer(ModelLayers.SLIME)), 0.25F); + this.addLayer(new SlimeOuterLayer(this, context.getModelSet())); } - public void render(Slime entity, float entityYaw, float partialTicks, PoseStack poseStack, MultiBufferSource buffer, int packedLight) { - this.shadowRadius = 0.25F * entity.getSize(); - super.render(entity, entityYaw, partialTicks, poseStack, buffer, packedLight); + public void render(SlimeRenderState slimeRenderState, PoseStack poseStack, MultiBufferSource multiBufferSource, int i) { + this.shadowRadius = 0.25F * slimeRenderState.size; + super.render(slimeRenderState, poseStack, multiBufferSource, i); } - protected void scale(Slime livingEntity, PoseStack poseStack, float partialTickTime) { + protected void scale(SlimeRenderState slimeRenderState, PoseStack poseStack) { float f = 0.999F; poseStack.scale(0.999F, 0.999F, 0.999F); poseStack.translate(0.0F, 0.001F, 0.0F); - float g = livingEntity.getSize(); - float h = Mth.lerp(partialTickTime, livingEntity.oSquish, livingEntity.squish) / (g * 0.5F + 1.0F); + float g = slimeRenderState.size; + float h = slimeRenderState.squish / (g * 0.5F + 1.0F); float i = 1.0F / (h + 1.0F); poseStack.scale(i * g, 1.0F / i * g, i * g); } - /** - * Returns the location of an entity's texture. - */ - public ResourceLocation getTextureLocation(Slime entity) { + public ResourceLocation getTextureLocation(SlimeRenderState slimeRenderState) { return SLIME_LOCATION; } + + public SlimeRenderState createRenderState() { + return new SlimeRenderState(); + } + + public void extractRenderState(Slime slime, SlimeRenderState slimeRenderState, float f) { + super.extractRenderState(slime, slimeRenderState, f); + slimeRenderState.squish = Mth.lerp(f, slime.oSquish, slime.squish); + slimeRenderState.size = slime.getSize(); + } } diff --git a/net/minecraft/client/renderer/entity/SnifferRenderer.java b/net/minecraft/client/renderer/entity/SnifferRenderer.java index 4c5e5f8c..c6007dce 100644 --- a/net/minecraft/client/renderer/entity/SnifferRenderer.java +++ b/net/minecraft/client/renderer/entity/SnifferRenderer.java @@ -4,18 +4,38 @@ import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.model.SnifferModel; import net.minecraft.client.model.geom.ModelLayers; +import net.minecraft.client.renderer.entity.state.SnifferRenderState; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.animal.sniffer.Sniffer; +import net.minecraft.world.phys.AABB; @Environment(EnvType.CLIENT) -public class SnifferRenderer extends MobRenderer> { +public class SnifferRenderer extends AgeableMobRenderer { private static final ResourceLocation SNIFFER_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/sniffer/sniffer.png"); public SnifferRenderer(EntityRendererProvider.Context context) { - super(context, new SnifferModel<>(context.bakeLayer(ModelLayers.SNIFFER)), 1.1F); + super(context, new SnifferModel(context.bakeLayer(ModelLayers.SNIFFER)), new SnifferModel(context.bakeLayer(ModelLayers.SNIFFER_BABY)), 1.1F); } - public ResourceLocation getTextureLocation(Sniffer sniffer) { + public ResourceLocation getTextureLocation(SnifferRenderState snifferRenderState) { return SNIFFER_LOCATION; } + + public SnifferRenderState createRenderState() { + return new SnifferRenderState(); + } + + public void extractRenderState(Sniffer sniffer, SnifferRenderState snifferRenderState, float f) { + super.extractRenderState(sniffer, snifferRenderState, f); + snifferRenderState.isSearching = sniffer.isSearching(); + snifferRenderState.diggingAnimationState.copyFrom(sniffer.diggingAnimationState); + snifferRenderState.sniffingAnimationState.copyFrom(sniffer.sniffingAnimationState); + snifferRenderState.risingAnimationState.copyFrom(sniffer.risingAnimationState); + snifferRenderState.feelingHappyAnimationState.copyFrom(sniffer.feelingHappyAnimationState); + snifferRenderState.scentingAnimationState.copyFrom(sniffer.scentingAnimationState); + } + + protected AABB getBoundingBoxForCulling(Sniffer sniffer) { + return super.getBoundingBoxForCulling(sniffer).inflate(0.6F); + } } diff --git a/net/minecraft/client/renderer/entity/SnowGolemRenderer.java b/net/minecraft/client/renderer/entity/SnowGolemRenderer.java index 37dd6679..b1c9f12b 100644 --- a/net/minecraft/client/renderer/entity/SnowGolemRenderer.java +++ b/net/minecraft/client/renderer/entity/SnowGolemRenderer.java @@ -5,22 +5,34 @@ import net.fabricmc.api.Environment; import net.minecraft.client.model.SnowGolemModel; import net.minecraft.client.model.geom.ModelLayers; import net.minecraft.client.renderer.entity.layers.SnowGolemHeadLayer; +import net.minecraft.client.renderer.entity.state.LivingEntityRenderState; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.animal.SnowGolem; +import net.minecraft.world.item.ItemDisplayContext; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; @Environment(EnvType.CLIENT) -public class SnowGolemRenderer extends MobRenderer> { +public class SnowGolemRenderer extends MobRenderer { private static final ResourceLocation SNOW_GOLEM_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/snow_golem.png"); public SnowGolemRenderer(EntityRendererProvider.Context context) { - super(context, new SnowGolemModel<>(context.bakeLayer(ModelLayers.SNOW_GOLEM)), 0.5F); + super(context, new SnowGolemModel(context.bakeLayer(ModelLayers.SNOW_GOLEM)), 0.5F); this.addLayer(new SnowGolemHeadLayer(this, context.getBlockRenderDispatcher(), context.getItemRenderer())); } - /** - * Returns the location of an entity's texture. - */ - public ResourceLocation getTextureLocation(SnowGolem entity) { + @Override + public ResourceLocation getTextureLocation(LivingEntityRenderState livingEntityRenderState) { return SNOW_GOLEM_LOCATION; } + + public LivingEntityRenderState createRenderState() { + return new LivingEntityRenderState(); + } + + public void extractRenderState(SnowGolem snowGolem, LivingEntityRenderState livingEntityRenderState, float f) { + super.extractRenderState(snowGolem, livingEntityRenderState, f); + livingEntityRenderState.headItem = snowGolem.hasPumpkin() ? new ItemStack(Items.CARVED_PUMPKIN) : ItemStack.EMPTY; + livingEntityRenderState.headItemModel = this.itemRenderer.resolveItemModel(livingEntityRenderState.headItem, snowGolem, ItemDisplayContext.HEAD); + } } diff --git a/net/minecraft/client/renderer/entity/SpectralArrowRenderer.java b/net/minecraft/client/renderer/entity/SpectralArrowRenderer.java index 6d3dfc2c..241e47e5 100644 --- a/net/minecraft/client/renderer/entity/SpectralArrowRenderer.java +++ b/net/minecraft/client/renderer/entity/SpectralArrowRenderer.java @@ -2,21 +2,24 @@ package net.minecraft.client.renderer.entity; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; +import net.minecraft.client.renderer.entity.state.ArrowRenderState; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.projectile.SpectralArrow; @Environment(EnvType.CLIENT) -public class SpectralArrowRenderer extends ArrowRenderer { +public class SpectralArrowRenderer extends ArrowRenderer { public static final ResourceLocation SPECTRAL_ARROW_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/projectiles/spectral_arrow.png"); public SpectralArrowRenderer(EntityRendererProvider.Context context) { super(context); } - /** - * Returns the location of an entity's texture. - */ - public ResourceLocation getTextureLocation(SpectralArrow entity) { + @Override + protected ResourceLocation getTextureLocation(ArrowRenderState arrowRenderState) { return SPECTRAL_ARROW_LOCATION; } + + public ArrowRenderState createRenderState() { + return new ArrowRenderState(); + } } diff --git a/net/minecraft/client/renderer/entity/SpiderRenderer.java b/net/minecraft/client/renderer/entity/SpiderRenderer.java index 0cde395c..8c7e8022 100644 --- a/net/minecraft/client/renderer/entity/SpiderRenderer.java +++ b/net/minecraft/client/renderer/entity/SpiderRenderer.java @@ -6,11 +6,12 @@ import net.minecraft.client.model.SpiderModel; import net.minecraft.client.model.geom.ModelLayerLocation; import net.minecraft.client.model.geom.ModelLayers; import net.minecraft.client.renderer.entity.layers.SpiderEyesLayer; +import net.minecraft.client.renderer.entity.state.LivingEntityRenderState; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.monster.Spider; @Environment(EnvType.CLIENT) -public class SpiderRenderer extends MobRenderer> { +public class SpiderRenderer extends MobRenderer { private static final ResourceLocation SPIDER_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/spider/spider.png"); public SpiderRenderer(EntityRendererProvider.Context context) { @@ -18,18 +19,25 @@ public class SpiderRenderer extends MobRenderer(context.bakeLayer(layer)), 0.8F); + super(context, new SpiderModel(context.bakeLayer(layer)), 0.8F); this.addLayer(new SpiderEyesLayer<>(this)); } - protected float getFlipDegrees(T livingEntity) { + @Override + protected float getFlipDegrees() { return 180.0F; } - /** - * Returns the location of an entity's texture. - */ - public ResourceLocation getTextureLocation(T entity) { + @Override + public ResourceLocation getTextureLocation(LivingEntityRenderState livingEntityRenderState) { return SPIDER_LOCATION; } + + public LivingEntityRenderState createRenderState() { + return new LivingEntityRenderState(); + } + + public void extractRenderState(T spider, LivingEntityRenderState livingEntityRenderState, float f) { + super.extractRenderState(spider, livingEntityRenderState, f); + } } diff --git a/net/minecraft/client/renderer/entity/SquidRenderer.java b/net/minecraft/client/renderer/entity/SquidRenderer.java index 4f577937..ec612d25 100644 --- a/net/minecraft/client/renderer/entity/SquidRenderer.java +++ b/net/minecraft/client/renderer/entity/SquidRenderer.java @@ -5,39 +5,39 @@ import com.mojang.math.Axis; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.model.SquidModel; +import net.minecraft.client.renderer.entity.state.SquidRenderState; import net.minecraft.resources.ResourceLocation; import net.minecraft.util.Mth; import net.minecraft.world.entity.animal.Squid; @Environment(EnvType.CLIENT) -public class SquidRenderer extends MobRenderer> { +public class SquidRenderer extends AgeableMobRenderer { private static final ResourceLocation SQUID_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/squid/squid.png"); - public SquidRenderer(EntityRendererProvider.Context context, SquidModel model) { - super(context, model, 0.7F); + public SquidRenderer(EntityRendererProvider.Context context, SquidModel squidModel, SquidModel squidModel2) { + super(context, squidModel, squidModel2, 0.7F); } - /** - * Returns the location of an entity's texture. - */ - public ResourceLocation getTextureLocation(T entity) { + public ResourceLocation getTextureLocation(SquidRenderState squidRenderState) { return SQUID_LOCATION; } - protected void setupRotations(T entity, PoseStack poseStack, float bob, float yBodyRot, float partialTick, float scale) { - float f = Mth.lerp(partialTick, entity.xBodyRotO, entity.xBodyRot); - float g = Mth.lerp(partialTick, entity.zBodyRotO, entity.zBodyRot); - poseStack.translate(0.0F, 0.5F, 0.0F); - poseStack.mulPose(Axis.YP.rotationDegrees(180.0F - yBodyRot)); - poseStack.mulPose(Axis.XP.rotationDegrees(f)); - poseStack.mulPose(Axis.YP.rotationDegrees(g)); - poseStack.translate(0.0F, -1.2F, 0.0F); + public SquidRenderState createRenderState() { + return new SquidRenderState(); } - /** - * Defines what float the third param in setRotationAngles of ModelBase is - */ - protected float getBob(T livingBase, float partialTicks) { - return Mth.lerp(partialTicks, livingBase.oldTentacleAngle, livingBase.tentacleAngle); + public void extractRenderState(T squid, SquidRenderState squidRenderState, float f) { + super.extractRenderState(squid, squidRenderState, f); + squidRenderState.tentacleAngle = Mth.lerp(f, squid.oldTentacleAngle, squid.tentacleAngle); + squidRenderState.xBodyRot = Mth.lerp(f, squid.xBodyRotO, squid.xBodyRot); + squidRenderState.zBodyRot = Mth.lerp(f, squid.zBodyRotO, squid.zBodyRot); + } + + protected void setupRotations(SquidRenderState squidRenderState, PoseStack poseStack, float f, float g) { + poseStack.translate(0.0F, squidRenderState.isBaby ? 0.25F : 0.5F, 0.0F); + poseStack.mulPose(Axis.YP.rotationDegrees(180.0F - f)); + poseStack.mulPose(Axis.XP.rotationDegrees(squidRenderState.xBodyRot)); + poseStack.mulPose(Axis.YP.rotationDegrees(squidRenderState.zBodyRot)); + poseStack.translate(0.0F, squidRenderState.isBaby ? -0.6F : -1.2F, 0.0F); } } diff --git a/net/minecraft/client/renderer/entity/StrayRenderer.java b/net/minecraft/client/renderer/entity/StrayRenderer.java index 64f23504..06f91886 100644 --- a/net/minecraft/client/renderer/entity/StrayRenderer.java +++ b/net/minecraft/client/renderer/entity/StrayRenderer.java @@ -4,11 +4,12 @@ import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.model.geom.ModelLayers; import net.minecraft.client.renderer.entity.layers.SkeletonClothingLayer; +import net.minecraft.client.renderer.entity.state.SkeletonRenderState; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.monster.Stray; @Environment(EnvType.CLIENT) -public class StrayRenderer extends SkeletonRenderer { +public class StrayRenderer extends AbstractSkeletonRenderer { private static final ResourceLocation STRAY_SKELETON_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/skeleton/stray.png"); private static final ResourceLocation STRAY_CLOTHES_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/skeleton/stray_overlay.png"); @@ -17,10 +18,11 @@ public class StrayRenderer extends SkeletonRenderer { this.addLayer(new SkeletonClothingLayer<>(this, context.getModelSet(), ModelLayers.STRAY_OUTER_LAYER, STRAY_CLOTHES_LOCATION)); } - /** - * Returns the location of an entity's texture. - */ - public ResourceLocation getTextureLocation(Stray entity) { + public ResourceLocation getTextureLocation(SkeletonRenderState skeletonRenderState) { return STRAY_SKELETON_LOCATION; } + + public SkeletonRenderState createRenderState() { + return new SkeletonRenderState(); + } } diff --git a/net/minecraft/client/renderer/entity/StriderRenderer.java b/net/minecraft/client/renderer/entity/StriderRenderer.java index 98a78b06..b2b9196d 100644 --- a/net/minecraft/client/renderer/entity/StriderRenderer.java +++ b/net/minecraft/client/renderer/entity/StriderRenderer.java @@ -6,44 +6,51 @@ import net.fabricmc.api.Environment; import net.minecraft.client.model.StriderModel; import net.minecraft.client.model.geom.ModelLayers; import net.minecraft.client.renderer.entity.layers.SaddleLayer; +import net.minecraft.client.renderer.entity.state.StriderRenderState; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.monster.Strider; @Environment(EnvType.CLIENT) -public class StriderRenderer extends MobRenderer> { +public class StriderRenderer extends MobRenderer { private static final ResourceLocation STRIDER_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/strider/strider.png"); private static final ResourceLocation COLD_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/strider/strider_cold.png"); private static final float SHADOW_RADIUS = 0.5F; public StriderRenderer(EntityRendererProvider.Context context) { - super(context, new StriderModel<>(context.bakeLayer(ModelLayers.STRIDER)), 0.5F); + super(context, new StriderModel(context.bakeLayer(ModelLayers.STRIDER)), 0.5F); this.addLayer( new SaddleLayer<>( - this, - new StriderModel<>(context.bakeLayer(ModelLayers.STRIDER_SADDLE)), - ResourceLocation.withDefaultNamespace("textures/entity/strider/strider_saddle.png") + this, new StriderModel(context.bakeLayer(ModelLayers.STRIDER_SADDLE)), ResourceLocation.withDefaultNamespace("textures/entity/strider/strider_saddle.png") ) ); } - /** - * Returns the location of an entity's texture. - */ - public ResourceLocation getTextureLocation(Strider entity) { - return entity.isSuffocating() ? COLD_LOCATION : STRIDER_LOCATION; + public ResourceLocation getTextureLocation(StriderRenderState striderRenderState) { + return striderRenderState.isSuffocating ? COLD_LOCATION : STRIDER_LOCATION; } - protected float getShadowRadius(Strider entity) { - float f = super.getShadowRadius(entity); - return entity.isBaby() ? f * 0.5F : f; + protected float getShadowRadius(StriderRenderState striderRenderState) { + float f = super.getShadowRadius(striderRenderState); + return striderRenderState.isBaby ? f * 0.5F : f; } - protected void scale(Strider livingEntity, PoseStack poseStack, float partialTickTime) { - float f = livingEntity.getAgeScale(); + public StriderRenderState createRenderState() { + return new StriderRenderState(); + } + + public void extractRenderState(Strider strider, StriderRenderState striderRenderState, float f) { + super.extractRenderState(strider, striderRenderState, f); + striderRenderState.isSaddled = strider.isSaddled(); + striderRenderState.isSuffocating = strider.isSuffocating(); + striderRenderState.isRidden = strider.isVehicle(); + } + + protected void scale(StriderRenderState striderRenderState, PoseStack poseStack) { + float f = striderRenderState.ageScale; poseStack.scale(f, f, f); } - protected boolean isShaking(Strider entity) { - return super.isShaking(entity) || entity.isSuffocating(); + protected boolean isShaking(StriderRenderState striderRenderState) { + return super.isShaking(striderRenderState) || striderRenderState.isSuffocating; } } diff --git a/net/minecraft/client/renderer/entity/TadpoleRenderer.java b/net/minecraft/client/renderer/entity/TadpoleRenderer.java index a25a206e..979f57b7 100644 --- a/net/minecraft/client/renderer/entity/TadpoleRenderer.java +++ b/net/minecraft/client/renderer/entity/TadpoleRenderer.java @@ -4,18 +4,24 @@ import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.model.TadpoleModel; import net.minecraft.client.model.geom.ModelLayers; +import net.minecraft.client.renderer.entity.state.LivingEntityRenderState; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.animal.frog.Tadpole; @Environment(EnvType.CLIENT) -public class TadpoleRenderer extends MobRenderer> { +public class TadpoleRenderer extends MobRenderer { private static final ResourceLocation TADPOLE_TEXTURE = ResourceLocation.withDefaultNamespace("textures/entity/tadpole/tadpole.png"); public TadpoleRenderer(EntityRendererProvider.Context context) { - super(context, new TadpoleModel<>(context.bakeLayer(ModelLayers.TADPOLE)), 0.14F); + super(context, new TadpoleModel(context.bakeLayer(ModelLayers.TADPOLE)), 0.14F); } - public ResourceLocation getTextureLocation(Tadpole tadpole) { + @Override + public ResourceLocation getTextureLocation(LivingEntityRenderState livingEntityRenderState) { return TADPOLE_TEXTURE; } + + public LivingEntityRenderState createRenderState() { + return new LivingEntityRenderState(); + } } diff --git a/net/minecraft/client/renderer/entity/ThrownItemRenderer.java b/net/minecraft/client/renderer/entity/ThrownItemRenderer.java index a33aad06..33a1b53f 100644 --- a/net/minecraft/client/renderer/entity/ThrownItemRenderer.java +++ b/net/minecraft/client/renderer/entity/ThrownItemRenderer.java @@ -4,17 +4,16 @@ import com.mojang.blaze3d.vertex.PoseStack; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.entity.state.ThrownItemRenderState; import net.minecraft.client.renderer.texture.OverlayTexture; -import net.minecraft.client.renderer.texture.TextureAtlas; import net.minecraft.core.BlockPos; -import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.projectile.ItemSupplier; import net.minecraft.world.item.ItemDisplayContext; +import net.minecraft.world.item.ItemStack; @Environment(EnvType.CLIENT) -public class ThrownItemRenderer extends EntityRenderer { - private static final float MIN_CAMERA_DISTANCE_SQUARED = 12.25F; +public class ThrownItemRenderer extends EntityRenderer { private final ItemRenderer itemRenderer; private final float scale; private final boolean fullBright; @@ -35,21 +34,29 @@ public class ThrownItemRenderer extends EntityR return this.fullBright ? 15 : super.getBlockLightLevel(entity, pos); } - @Override - public void render(T entity, float entityYaw, float partialTick, PoseStack poseStack, MultiBufferSource bufferSource, int packedLight) { - if (entity.tickCount >= 2 || !(this.entityRenderDispatcher.camera.getEntity().distanceToSqr(entity) < 12.25)) { - poseStack.pushPose(); - poseStack.scale(this.scale, this.scale, this.scale); - poseStack.mulPose(this.entityRenderDispatcher.cameraOrientation()); + public void render(ThrownItemRenderState thrownItemRenderState, PoseStack poseStack, MultiBufferSource multiBufferSource, int i) { + poseStack.pushPose(); + poseStack.scale(this.scale, this.scale, this.scale); + poseStack.mulPose(this.entityRenderDispatcher.cameraOrientation()); + if (thrownItemRenderState.itemModel != null) { this.itemRenderer - .renderStatic(entity.getItem(), ItemDisplayContext.GROUND, packedLight, OverlayTexture.NO_OVERLAY, poseStack, bufferSource, entity.level(), entity.getId()); - poseStack.popPose(); - super.render(entity, entityYaw, partialTick, poseStack, bufferSource, packedLight); + .render( + thrownItemRenderState.item, ItemDisplayContext.GROUND, false, poseStack, multiBufferSource, i, OverlayTexture.NO_OVERLAY, thrownItemRenderState.itemModel + ); } + + poseStack.popPose(); + super.render(thrownItemRenderState, poseStack, multiBufferSource, i); } - @Override - public ResourceLocation getTextureLocation(Entity entity) { - return TextureAtlas.LOCATION_BLOCKS; + public ThrownItemRenderState createRenderState() { + return new ThrownItemRenderState(); + } + + public void extractRenderState(T entity, ThrownItemRenderState thrownItemRenderState, float f) { + super.extractRenderState(entity, thrownItemRenderState, f); + ItemStack itemStack = entity.getItem(); + thrownItemRenderState.itemModel = !itemStack.isEmpty() ? this.itemRenderer.getModel(itemStack, entity.level(), null, entity.getId()) : null; + thrownItemRenderState.item = itemStack.copy(); } } diff --git a/net/minecraft/client/renderer/entity/ThrownTridentRenderer.java b/net/minecraft/client/renderer/entity/ThrownTridentRenderer.java index 0e3e7c0e..9c2d37ae 100644 --- a/net/minecraft/client/renderer/entity/ThrownTridentRenderer.java +++ b/net/minecraft/client/renderer/entity/ThrownTridentRenderer.java @@ -8,13 +8,13 @@ import net.fabricmc.api.Environment; import net.minecraft.client.model.TridentModel; import net.minecraft.client.model.geom.ModelLayers; import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.entity.state.ThrownTridentRenderState; import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.resources.ResourceLocation; -import net.minecraft.util.Mth; import net.minecraft.world.entity.projectile.ThrownTrident; @Environment(EnvType.CLIENT) -public class ThrownTridentRenderer extends EntityRenderer { +public class ThrownTridentRenderer extends EntityRenderer { public static final ResourceLocation TRIDENT_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/trident.png"); private final TridentModel model; @@ -23,20 +23,24 @@ public class ThrownTridentRenderer extends EntityRenderer { this.model = new TridentModel(context.bakeLayer(ModelLayers.TRIDENT)); } - public void render(ThrownTrident entity, float entityYaw, float partialTicks, PoseStack poseStack, MultiBufferSource buffer, int packedLight) { + public void render(ThrownTridentRenderState thrownTridentRenderState, PoseStack poseStack, MultiBufferSource multiBufferSource, int i) { poseStack.pushPose(); - poseStack.mulPose(Axis.YP.rotationDegrees(Mth.lerp(partialTicks, entity.yRotO, entity.getYRot()) - 90.0F)); - poseStack.mulPose(Axis.ZP.rotationDegrees(Mth.lerp(partialTicks, entity.xRotO, entity.getXRot()) + 90.0F)); - VertexConsumer vertexConsumer = ItemRenderer.getFoilBufferDirect(buffer, this.model.renderType(this.getTextureLocation(entity)), false, entity.isFoil()); - this.model.renderToBuffer(poseStack, vertexConsumer, packedLight, OverlayTexture.NO_OVERLAY); + poseStack.mulPose(Axis.YP.rotationDegrees(thrownTridentRenderState.yRot - 90.0F)); + poseStack.mulPose(Axis.ZP.rotationDegrees(thrownTridentRenderState.xRot + 90.0F)); + VertexConsumer vertexConsumer = ItemRenderer.getFoilBuffer(multiBufferSource, this.model.renderType(TRIDENT_LOCATION), false, thrownTridentRenderState.isFoil); + this.model.renderToBuffer(poseStack, vertexConsumer, i, OverlayTexture.NO_OVERLAY); poseStack.popPose(); - super.render(entity, entityYaw, partialTicks, poseStack, buffer, packedLight); + super.render(thrownTridentRenderState, poseStack, multiBufferSource, i); } - /** - * Returns the location of an entity's texture. - */ - public ResourceLocation getTextureLocation(ThrownTrident entity) { - return TRIDENT_LOCATION; + public ThrownTridentRenderState createRenderState() { + return new ThrownTridentRenderState(); + } + + public void extractRenderState(ThrownTrident thrownTrident, ThrownTridentRenderState thrownTridentRenderState, float f) { + super.extractRenderState(thrownTrident, thrownTridentRenderState, f); + thrownTridentRenderState.yRot = thrownTrident.getYRot(f); + thrownTridentRenderState.xRot = thrownTrident.getXRot(f); + thrownTridentRenderState.isFoil = thrownTrident.isFoil(); } } diff --git a/net/minecraft/client/renderer/entity/TippableArrowRenderer.java b/net/minecraft/client/renderer/entity/TippableArrowRenderer.java index 24e3a477..98c4687e 100644 --- a/net/minecraft/client/renderer/entity/TippableArrowRenderer.java +++ b/net/minecraft/client/renderer/entity/TippableArrowRenderer.java @@ -2,11 +2,12 @@ package net.minecraft.client.renderer.entity; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; +import net.minecraft.client.renderer.entity.state.TippableArrowRenderState; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.projectile.Arrow; @Environment(EnvType.CLIENT) -public class TippableArrowRenderer extends ArrowRenderer { +public class TippableArrowRenderer extends ArrowRenderer { public static final ResourceLocation NORMAL_ARROW_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/projectiles/arrow.png"); public static final ResourceLocation TIPPED_ARROW_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/projectiles/tipped_arrow.png"); @@ -14,10 +15,16 @@ public class TippableArrowRenderer extends ArrowRenderer { super(context); } - /** - * Returns the location of an entity's texture. - */ - public ResourceLocation getTextureLocation(Arrow entity) { - return entity.getColor() > 0 ? TIPPED_ARROW_LOCATION : NORMAL_ARROW_LOCATION; + protected ResourceLocation getTextureLocation(TippableArrowRenderState tippableArrowRenderState) { + return tippableArrowRenderState.isTipped ? TIPPED_ARROW_LOCATION : NORMAL_ARROW_LOCATION; + } + + public TippableArrowRenderState createRenderState() { + return new TippableArrowRenderState(); + } + + public void extractRenderState(Arrow arrow, TippableArrowRenderState tippableArrowRenderState, float f) { + super.extractRenderState(arrow, tippableArrowRenderState, f); + tippableArrowRenderState.isTipped = arrow.getColor() > 0; } } diff --git a/net/minecraft/client/renderer/entity/TntMinecartRenderer.java b/net/minecraft/client/renderer/entity/TntMinecartRenderer.java index 003f9099..8eccf01f 100644 --- a/net/minecraft/client/renderer/entity/TntMinecartRenderer.java +++ b/net/minecraft/client/renderer/entity/TntMinecartRenderer.java @@ -6,13 +6,14 @@ import net.fabricmc.api.Environment; import net.minecraft.client.model.geom.ModelLayers; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.block.BlockRenderDispatcher; +import net.minecraft.client.renderer.entity.state.MinecartTntRenderState; import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.util.Mth; import net.minecraft.world.entity.vehicle.MinecartTNT; import net.minecraft.world.level.block.state.BlockState; @Environment(EnvType.CLIENT) -public class TntMinecartRenderer extends MinecartRenderer { +public class TntMinecartRenderer extends AbstractMinecartRenderer { private final BlockRenderDispatcher blockRenderer; public TntMinecartRenderer(EntityRendererProvider.Context context) { @@ -20,18 +21,20 @@ public class TntMinecartRenderer extends MinecartRenderer { this.blockRenderer = context.getBlockRenderDispatcher(); } - protected void renderMinecartContents(MinecartTNT entity, float partialTicks, BlockState state, PoseStack poseStack, MultiBufferSource buffer, int packedLight) { - int i = entity.getFuse(); - if (i > -1 && i - partialTicks + 1.0F < 10.0F) { - float f = 1.0F - (i - partialTicks + 1.0F) / 10.0F; - f = Mth.clamp(f, 0.0F, 1.0F); - f *= f; - f *= f; - float g = 1.0F + f * 0.3F; - poseStack.scale(g, g, g); + protected void renderMinecartContents( + MinecartTntRenderState minecartTntRenderState, BlockState blockState, PoseStack poseStack, MultiBufferSource multiBufferSource, int i + ) { + float f = minecartTntRenderState.fuseRemainingInTicks; + if (f > -1.0F && f < 10.0F) { + float g = 1.0F - f / 10.0F; + g = Mth.clamp(g, 0.0F, 1.0F); + g *= g; + g *= g; + float h = 1.0F + g * 0.3F; + poseStack.scale(h, h, h); } - renderWhiteSolidBlock(this.blockRenderer, state, poseStack, buffer, packedLight, i > -1 && i / 5 % 2 == 0); + renderWhiteSolidBlock(this.blockRenderer, blockState, poseStack, multiBufferSource, i, f > -1.0F && (int)f / 5 % 2 == 0); } public static void renderWhiteSolidBlock( @@ -46,4 +49,13 @@ public class TntMinecartRenderer extends MinecartRenderer { blockRenderDispatcher.renderSingleBlock(state, poseStack, buffer, packedLight, i); } + + public MinecartTntRenderState createRenderState() { + return new MinecartTntRenderState(); + } + + public void extractRenderState(MinecartTNT minecartTNT, MinecartTntRenderState minecartTntRenderState, float f) { + super.extractRenderState(minecartTNT, minecartTntRenderState, f); + minecartTntRenderState.fuseRemainingInTicks = minecartTNT.getFuse() > -1 ? minecartTNT.getFuse() - f + 1.0F : -1.0F; + } } diff --git a/net/minecraft/client/renderer/entity/TntRenderer.java b/net/minecraft/client/renderer/entity/TntRenderer.java index 079427c2..0c866884 100644 --- a/net/minecraft/client/renderer/entity/TntRenderer.java +++ b/net/minecraft/client/renderer/entity/TntRenderer.java @@ -6,13 +6,12 @@ import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.block.BlockRenderDispatcher; -import net.minecraft.client.renderer.texture.TextureAtlas; -import net.minecraft.resources.ResourceLocation; +import net.minecraft.client.renderer.entity.state.TntRenderState; import net.minecraft.util.Mth; import net.minecraft.world.entity.item.PrimedTnt; @Environment(EnvType.CLIENT) -public class TntRenderer extends EntityRenderer { +public class TntRenderer extends EntityRenderer { private final BlockRenderDispatcher blockRenderer; public TntRenderer(EntityRendererProvider.Context context) { @@ -21,31 +20,37 @@ public class TntRenderer extends EntityRenderer { this.blockRenderer = context.getBlockRenderDispatcher(); } - public void render(PrimedTnt entity, float entityYaw, float partialTicks, PoseStack poseStack, MultiBufferSource buffer, int packedLight) { + public void render(TntRenderState tntRenderState, PoseStack poseStack, MultiBufferSource multiBufferSource, int i) { poseStack.pushPose(); poseStack.translate(0.0F, 0.5F, 0.0F); - int i = entity.getFuse(); - if (i - partialTicks + 1.0F < 10.0F) { - float f = 1.0F - (i - partialTicks + 1.0F) / 10.0F; - f = Mth.clamp(f, 0.0F, 1.0F); - f *= f; - f *= f; - float g = 1.0F + f * 0.3F; - poseStack.scale(g, g, g); + float f = tntRenderState.fuseRemainingInTicks; + if (tntRenderState.fuseRemainingInTicks < 10.0F) { + float g = 1.0F - tntRenderState.fuseRemainingInTicks / 10.0F; + g = Mth.clamp(g, 0.0F, 1.0F); + g *= g; + g *= g; + float h = 1.0F + g * 0.3F; + poseStack.scale(h, h, h); } poseStack.mulPose(Axis.YP.rotationDegrees(-90.0F)); poseStack.translate(-0.5F, -0.5F, 0.5F); poseStack.mulPose(Axis.YP.rotationDegrees(90.0F)); - TntMinecartRenderer.renderWhiteSolidBlock(this.blockRenderer, entity.getBlockState(), poseStack, buffer, packedLight, i / 5 % 2 == 0); + if (tntRenderState.blockState != null) { + TntMinecartRenderer.renderWhiteSolidBlock(this.blockRenderer, tntRenderState.blockState, poseStack, multiBufferSource, i, (int)f / 5 % 2 == 0); + } + poseStack.popPose(); - super.render(entity, entityYaw, partialTicks, poseStack, buffer, packedLight); + super.render(tntRenderState, poseStack, multiBufferSource, i); } - /** - * Returns the location of an entity's texture. - */ - public ResourceLocation getTextureLocation(PrimedTnt entity) { - return TextureAtlas.LOCATION_BLOCKS; + public TntRenderState createRenderState() { + return new TntRenderState(); + } + + public void extractRenderState(PrimedTnt primedTnt, TntRenderState tntRenderState, float f) { + super.extractRenderState(primedTnt, tntRenderState, f); + tntRenderState.fuseRemainingInTicks = primedTnt.getFuse() - f + 1.0F; + tntRenderState.blockState = primedTnt.getBlockState(); } } diff --git a/net/minecraft/client/renderer/entity/TropicalFishRenderer.java b/net/minecraft/client/renderer/entity/TropicalFishRenderer.java index 0cbe674f..22484a84 100644 --- a/net/minecraft/client/renderer/entity/TropicalFishRenderer.java +++ b/net/minecraft/client/renderer/entity/TropicalFishRenderer.java @@ -4,61 +4,65 @@ import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.math.Axis; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; -import net.minecraft.client.model.ColorableHierarchicalModel; +import net.minecraft.client.model.EntityModel; import net.minecraft.client.model.TropicalFishModelA; import net.minecraft.client.model.TropicalFishModelB; import net.minecraft.client.model.geom.ModelLayers; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.entity.layers.TropicalFishPatternLayer; +import net.minecraft.client.renderer.entity.state.TropicalFishRenderState; import net.minecraft.resources.ResourceLocation; import net.minecraft.util.Mth; import net.minecraft.world.entity.animal.TropicalFish; @Environment(EnvType.CLIENT) -public class TropicalFishRenderer extends MobRenderer> { - /** - * Breaking recompile intentionally since modelA/B incorrectly mapped. - */ - private final ColorableHierarchicalModel modelA = this.getModel(); - /** - * Breaking recompile intentionally since modelA/B incorrectly mapped. - */ - private final ColorableHierarchicalModel modelB; +public class TropicalFishRenderer extends MobRenderer> { + private final EntityModel modelA = this.getModel(); + private final EntityModel modelB; private static final ResourceLocation MODEL_A_TEXTURE = ResourceLocation.withDefaultNamespace("textures/entity/fish/tropical_a.png"); private static final ResourceLocation MODEL_B_TEXTURE = ResourceLocation.withDefaultNamespace("textures/entity/fish/tropical_b.png"); public TropicalFishRenderer(EntityRendererProvider.Context context) { - super(context, new TropicalFishModelA<>(context.bakeLayer(ModelLayers.TROPICAL_FISH_SMALL)), 0.15F); - this.modelB = new TropicalFishModelB<>(context.bakeLayer(ModelLayers.TROPICAL_FISH_LARGE)); + super(context, new TropicalFishModelA(context.bakeLayer(ModelLayers.TROPICAL_FISH_SMALL)), 0.15F); + this.modelB = new TropicalFishModelB(context.bakeLayer(ModelLayers.TROPICAL_FISH_LARGE)); this.addLayer(new TropicalFishPatternLayer(this, context.getModelSet())); } - /** - * Returns the location of an entity's texture. - */ - public ResourceLocation getTextureLocation(TropicalFish entity) { - return switch (entity.getVariant().base()) { + public ResourceLocation getTextureLocation(TropicalFishRenderState tropicalFishRenderState) { + return switch (tropicalFishRenderState.variant.base()) { case SMALL -> MODEL_A_TEXTURE; case LARGE -> MODEL_B_TEXTURE; }; } - public void render(TropicalFish entity, float entityYaw, float partialTicks, PoseStack poseStack, MultiBufferSource buffer, int packedLight) { - ColorableHierarchicalModel colorableHierarchicalModel = switch (entity.getVariant().base()) { + public TropicalFishRenderState createRenderState() { + return new TropicalFishRenderState(); + } + + public void extractRenderState(TropicalFish tropicalFish, TropicalFishRenderState tropicalFishRenderState, float f) { + super.extractRenderState(tropicalFish, tropicalFishRenderState, f); + tropicalFishRenderState.variant = tropicalFish.getVariant(); + tropicalFishRenderState.baseColor = tropicalFish.getBaseColor().getTextureDiffuseColor(); + tropicalFishRenderState.patternColor = tropicalFish.getPatternColor().getTextureDiffuseColor(); + } + + public void render(TropicalFishRenderState tropicalFishRenderState, PoseStack poseStack, MultiBufferSource multiBufferSource, int i) { + this.model = switch (tropicalFishRenderState.variant.base()) { case SMALL -> this.modelA; case LARGE -> this.modelB; }; - this.model = colorableHierarchicalModel; - colorableHierarchicalModel.setColor(entity.getBaseColor().getTextureDiffuseColor()); - super.render(entity, entityYaw, partialTicks, poseStack, buffer, packedLight); - colorableHierarchicalModel.setColor(-1); + super.render(tropicalFishRenderState, poseStack, multiBufferSource, i); } - protected void setupRotations(TropicalFish entity, PoseStack poseStack, float bob, float yBodyRot, float partialTick, float scale) { - super.setupRotations(entity, poseStack, bob, yBodyRot, partialTick, scale); - float f = 4.3F * Mth.sin(0.6F * bob); - poseStack.mulPose(Axis.YP.rotationDegrees(f)); - if (!entity.isInWater()) { + protected int getModelTint(TropicalFishRenderState tropicalFishRenderState) { + return tropicalFishRenderState.baseColor; + } + + protected void setupRotations(TropicalFishRenderState tropicalFishRenderState, PoseStack poseStack, float f, float g) { + super.setupRotations(tropicalFishRenderState, poseStack, f, g); + float h = 4.3F * Mth.sin(0.6F * tropicalFishRenderState.ageInTicks); + poseStack.mulPose(Axis.YP.rotationDegrees(h)); + if (!tropicalFishRenderState.isInWater) { poseStack.translate(0.2F, 0.1F, 0.0F); poseStack.mulPose(Axis.ZP.rotationDegrees(90.0F)); } diff --git a/net/minecraft/client/renderer/entity/TurtleRenderer.java b/net/minecraft/client/renderer/entity/TurtleRenderer.java index 99d8636b..7b90964b 100644 --- a/net/minecraft/client/renderer/entity/TurtleRenderer.java +++ b/net/minecraft/client/renderer/entity/TurtleRenderer.java @@ -4,26 +4,35 @@ import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.model.TurtleModel; import net.minecraft.client.model.geom.ModelLayers; +import net.minecraft.client.renderer.entity.state.TurtleRenderState; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.animal.Turtle; @Environment(EnvType.CLIENT) -public class TurtleRenderer extends MobRenderer> { +public class TurtleRenderer extends AgeableMobRenderer { private static final ResourceLocation TURTLE_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/turtle/big_sea_turtle.png"); public TurtleRenderer(EntityRendererProvider.Context context) { - super(context, new TurtleModel<>(context.bakeLayer(ModelLayers.TURTLE)), 0.7F); + super(context, new TurtleModel(context.bakeLayer(ModelLayers.TURTLE)), new TurtleModel(context.bakeLayer(ModelLayers.TURTLE_BABY)), 0.7F); } - protected float getShadowRadius(Turtle entity) { - float f = super.getShadowRadius(entity); - return entity.isBaby() ? f * 0.83F : f; + protected float getShadowRadius(TurtleRenderState turtleRenderState) { + float f = super.getShadowRadius(turtleRenderState); + return turtleRenderState.isBaby ? f * 0.83F : f; } - /** - * Returns the location of an entity's texture. - */ - public ResourceLocation getTextureLocation(Turtle entity) { + public TurtleRenderState createRenderState() { + return new TurtleRenderState(); + } + + public void extractRenderState(Turtle turtle, TurtleRenderState turtleRenderState, float f) { + super.extractRenderState(turtle, turtleRenderState, f); + turtleRenderState.isOnLand = !turtle.isInWater() && turtle.onGround(); + turtleRenderState.isLayingEgg = turtle.isLayingEgg(); + turtleRenderState.hasEgg = !turtle.isBaby() && turtle.hasEgg(); + } + + public ResourceLocation getTextureLocation(TurtleRenderState turtleRenderState) { return TURTLE_LOCATION; } } diff --git a/net/minecraft/client/renderer/entity/UndeadHorseRenderer.java b/net/minecraft/client/renderer/entity/UndeadHorseRenderer.java index 24867364..6cb5dbc2 100644 --- a/net/minecraft/client/renderer/entity/UndeadHorseRenderer.java +++ b/net/minecraft/client/renderer/entity/UndeadHorseRenderer.java @@ -1,35 +1,30 @@ package net.minecraft.client.renderer.entity; -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.Maps; -import java.util.Map; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; +import net.minecraft.client.model.AbstractEquineModel; import net.minecraft.client.model.HorseModel; import net.minecraft.client.model.geom.ModelLayerLocation; +import net.minecraft.client.renderer.entity.state.EquineRenderState; import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.animal.horse.AbstractHorse; @Environment(EnvType.CLIENT) -public class UndeadHorseRenderer extends AbstractHorseRenderer> { - private static final Map, ResourceLocation> MAP = Maps., ResourceLocation>newHashMap( - ImmutableMap.of( - EntityType.ZOMBIE_HORSE, - ResourceLocation.withDefaultNamespace("textures/entity/horse/horse_zombie.png"), - EntityType.SKELETON_HORSE, - ResourceLocation.withDefaultNamespace("textures/entity/horse/horse_skeleton.png") - ) - ); +public class UndeadHorseRenderer extends AbstractHorseRenderer> { + private static final ResourceLocation ZOMBIE_TEXTURE = ResourceLocation.withDefaultNamespace("textures/entity/horse/horse_zombie.png"); + private static final ResourceLocation SKELETON_TEXTURE = ResourceLocation.withDefaultNamespace("textures/entity/horse/horse_skeleton.png"); + private final ResourceLocation texture; - public UndeadHorseRenderer(EntityRendererProvider.Context context, ModelLayerLocation layer) { - super(context, new HorseModel<>(context.bakeLayer(layer)), 1.0F); + public UndeadHorseRenderer(EntityRendererProvider.Context context, ModelLayerLocation modelLayerLocation, ModelLayerLocation modelLayerLocation2, boolean bl) { + super(context, new HorseModel(context.bakeLayer(modelLayerLocation)), new HorseModel(context.bakeLayer(modelLayerLocation2)), 1.0F); + this.texture = bl ? SKELETON_TEXTURE : ZOMBIE_TEXTURE; } - /** - * Returns the location of an entity's texture. - */ - public ResourceLocation getTextureLocation(AbstractHorse entity) { - return (ResourceLocation)MAP.get(entity.getType()); + public ResourceLocation getTextureLocation(EquineRenderState equineRenderState) { + return this.texture; + } + + public EquineRenderState createRenderState() { + return new EquineRenderState(); } } diff --git a/net/minecraft/client/renderer/entity/VexRenderer.java b/net/minecraft/client/renderer/entity/VexRenderer.java index b7bae621..7b6f2d07 100644 --- a/net/minecraft/client/renderer/entity/VexRenderer.java +++ b/net/minecraft/client/renderer/entity/VexRenderer.java @@ -5,28 +5,35 @@ import net.fabricmc.api.Environment; import net.minecraft.client.model.VexModel; import net.minecraft.client.model.geom.ModelLayers; import net.minecraft.client.renderer.entity.layers.ItemInHandLayer; +import net.minecraft.client.renderer.entity.state.VexRenderState; import net.minecraft.core.BlockPos; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.monster.Vex; @Environment(EnvType.CLIENT) -public class VexRenderer extends MobRenderer { +public class VexRenderer extends MobRenderer { private static final ResourceLocation VEX_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/illager/vex.png"); private static final ResourceLocation VEX_CHARGING_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/illager/vex_charging.png"); public VexRenderer(EntityRendererProvider.Context context) { super(context, new VexModel(context.bakeLayer(ModelLayers.VEX)), 0.3F); - this.addLayer(new ItemInHandLayer<>(this, context.getItemInHandRenderer())); + this.addLayer(new ItemInHandLayer<>(this, context.getItemRenderer())); } protected int getBlockLightLevel(Vex entity, BlockPos pos) { return 15; } - /** - * Returns the location of an entity's texture. - */ - public ResourceLocation getTextureLocation(Vex entity) { - return entity.isCharging() ? VEX_CHARGING_LOCATION : VEX_LOCATION; + public ResourceLocation getTextureLocation(VexRenderState vexRenderState) { + return vexRenderState.isCharging ? VEX_CHARGING_LOCATION : VEX_LOCATION; + } + + public VexRenderState createRenderState() { + return new VexRenderState(); + } + + public void extractRenderState(Vex vex, VexRenderState vexRenderState, float f) { + super.extractRenderState(vex, vexRenderState, f); + vexRenderState.isCharging = vex.isCharging(); } } diff --git a/net/minecraft/client/renderer/entity/VillagerRenderer.java b/net/minecraft/client/renderer/entity/VillagerRenderer.java index 2bd90db0..3e67cc0b 100644 --- a/net/minecraft/client/renderer/entity/VillagerRenderer.java +++ b/net/minecraft/client/renderer/entity/VillagerRenderer.java @@ -8,34 +8,44 @@ import net.minecraft.client.model.geom.ModelLayers; import net.minecraft.client.renderer.entity.layers.CrossedArmsItemLayer; import net.minecraft.client.renderer.entity.layers.CustomHeadLayer; import net.minecraft.client.renderer.entity.layers.VillagerProfessionLayer; +import net.minecraft.client.renderer.entity.state.VillagerRenderState; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.npc.Villager; @Environment(EnvType.CLIENT) -public class VillagerRenderer extends MobRenderer> { +public class VillagerRenderer extends MobRenderer { private static final ResourceLocation VILLAGER_BASE_SKIN = ResourceLocation.withDefaultNamespace("textures/entity/villager/villager.png"); + public static final CustomHeadLayer.Transforms CUSTOM_HEAD_TRANSFORMS = new CustomHeadLayer.Transforms(-0.1171875F, -0.07421875F, 1.0F); public VillagerRenderer(EntityRendererProvider.Context context) { - super(context, new VillagerModel<>(context.bakeLayer(ModelLayers.VILLAGER)), 0.5F); - this.addLayer(new CustomHeadLayer<>(this, context.getModelSet(), context.getItemInHandRenderer())); + super(context, new VillagerModel(context.bakeLayer(ModelLayers.VILLAGER)), 0.5F); + this.addLayer(new CustomHeadLayer<>(this, context.getModelSet(), CUSTOM_HEAD_TRANSFORMS, context.getItemRenderer())); this.addLayer(new VillagerProfessionLayer<>(this, context.getResourceManager(), "villager")); - this.addLayer(new CrossedArmsItemLayer<>(this, context.getItemInHandRenderer())); + this.addLayer(new CrossedArmsItemLayer<>(this, context.getItemRenderer())); } - /** - * Returns the location of an entity's texture. - */ - public ResourceLocation getTextureLocation(Villager entity) { - return VILLAGER_BASE_SKIN; - } - - protected void scale(Villager livingEntity, PoseStack poseStack, float partialTickTime) { - float f = 0.9375F * livingEntity.getAgeScale(); + protected void scale(VillagerRenderState villagerRenderState, PoseStack poseStack) { + super.scale(villagerRenderState, poseStack); + float f = villagerRenderState.ageScale; poseStack.scale(f, f, f); } - protected float getShadowRadius(Villager entity) { - float f = super.getShadowRadius(entity); - return entity.isBaby() ? f * 0.5F : f; + public ResourceLocation getTextureLocation(VillagerRenderState villagerRenderState) { + return VILLAGER_BASE_SKIN; + } + + protected float getShadowRadius(VillagerRenderState villagerRenderState) { + float f = super.getShadowRadius(villagerRenderState); + return villagerRenderState.isBaby ? f * 0.5F : f; + } + + public VillagerRenderState createRenderState() { + return new VillagerRenderState(); + } + + public void extractRenderState(Villager villager, VillagerRenderState villagerRenderState, float f) { + super.extractRenderState(villager, villagerRenderState, f); + villagerRenderState.isUnhappy = villager.getUnhappyCounter() > 0; + villagerRenderState.villagerData = villager.getVillagerData(); } } diff --git a/net/minecraft/client/renderer/entity/VindicatorRenderer.java b/net/minecraft/client/renderer/entity/VindicatorRenderer.java index 976678f0..9d390f64 100644 --- a/net/minecraft/client/renderer/entity/VindicatorRenderer.java +++ b/net/minecraft/client/renderer/entity/VindicatorRenderer.java @@ -7,32 +7,30 @@ import net.minecraft.client.model.IllagerModel; import net.minecraft.client.model.geom.ModelLayers; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.entity.layers.ItemInHandLayer; +import net.minecraft.client.renderer.entity.state.IllagerRenderState; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.monster.Vindicator; @Environment(EnvType.CLIENT) -public class VindicatorRenderer extends IllagerRenderer { +public class VindicatorRenderer extends IllagerRenderer { private static final ResourceLocation VINDICATOR = ResourceLocation.withDefaultNamespace("textures/entity/illager/vindicator.png"); public VindicatorRenderer(EntityRendererProvider.Context context) { super(context, new IllagerModel<>(context.bakeLayer(ModelLayers.VINDICATOR)), 0.5F); - this.addLayer( - new ItemInHandLayer>(this, context.getItemInHandRenderer()) { - public void render( - PoseStack poseStack, MultiBufferSource multiBufferSource, int i, Vindicator vindicator, float f, float g, float h, float j, float k, float l - ) { - if (vindicator.isAggressive()) { - super.render(poseStack, multiBufferSource, i, vindicator, f, g, h, j, k, l); - } + this.addLayer(new ItemInHandLayer>(this, context.getItemRenderer()) { + public void render(PoseStack poseStack, MultiBufferSource multiBufferSource, int i, IllagerRenderState illagerRenderState, float f, float g) { + if (illagerRenderState.isAggressive) { + super.render(poseStack, multiBufferSource, i, illagerRenderState, f, g); } } - ); + }); } - /** - * Returns the location of an entity's texture. - */ - public ResourceLocation getTextureLocation(Vindicator entity) { + public ResourceLocation getTextureLocation(IllagerRenderState illagerRenderState) { return VINDICATOR; } + + public IllagerRenderState createRenderState() { + return new IllagerRenderState(); + } } diff --git a/net/minecraft/client/renderer/entity/WanderingTraderRenderer.java b/net/minecraft/client/renderer/entity/WanderingTraderRenderer.java index 2ec382b6..38798a20 100644 --- a/net/minecraft/client/renderer/entity/WanderingTraderRenderer.java +++ b/net/minecraft/client/renderer/entity/WanderingTraderRenderer.java @@ -1,34 +1,35 @@ package net.minecraft.client.renderer.entity; -import com.mojang.blaze3d.vertex.PoseStack; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.model.VillagerModel; import net.minecraft.client.model.geom.ModelLayers; import net.minecraft.client.renderer.entity.layers.CrossedArmsItemLayer; import net.minecraft.client.renderer.entity.layers.CustomHeadLayer; +import net.minecraft.client.renderer.entity.state.VillagerRenderState; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.npc.WanderingTrader; @Environment(EnvType.CLIENT) -public class WanderingTraderRenderer extends MobRenderer> { +public class WanderingTraderRenderer extends MobRenderer { private static final ResourceLocation VILLAGER_BASE_SKIN = ResourceLocation.withDefaultNamespace("textures/entity/wandering_trader.png"); public WanderingTraderRenderer(EntityRendererProvider.Context context) { - super(context, new VillagerModel<>(context.bakeLayer(ModelLayers.WANDERING_TRADER)), 0.5F); - this.addLayer(new CustomHeadLayer<>(this, context.getModelSet(), context.getItemInHandRenderer())); - this.addLayer(new CrossedArmsItemLayer<>(this, context.getItemInHandRenderer())); + super(context, new VillagerModel(context.bakeLayer(ModelLayers.WANDERING_TRADER)), 0.5F); + this.addLayer(new CustomHeadLayer<>(this, context.getModelSet(), context.getItemRenderer())); + this.addLayer(new CrossedArmsItemLayer<>(this, context.getItemRenderer())); } - /** - * Returns the location of an entity's texture. - */ - public ResourceLocation getTextureLocation(WanderingTrader entity) { + public ResourceLocation getTextureLocation(VillagerRenderState villagerRenderState) { return VILLAGER_BASE_SKIN; } - protected void scale(WanderingTrader livingEntity, PoseStack poseStack, float partialTickTime) { - float f = 0.9375F; - poseStack.scale(0.9375F, 0.9375F, 0.9375F); + public VillagerRenderState createRenderState() { + return new VillagerRenderState(); + } + + public void extractRenderState(WanderingTrader wanderingTrader, VillagerRenderState villagerRenderState, float f) { + super.extractRenderState(wanderingTrader, villagerRenderState, f); + villagerRenderState.isUnhappy = wanderingTrader.getUnhappyCounter() > 0; } } diff --git a/net/minecraft/client/renderer/entity/WardenRenderer.java b/net/minecraft/client/renderer/entity/WardenRenderer.java index c646e464..5f6917c0 100644 --- a/net/minecraft/client/renderer/entity/WardenRenderer.java +++ b/net/minecraft/client/renderer/entity/WardenRenderer.java @@ -4,13 +4,15 @@ import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.model.WardenModel; import net.minecraft.client.model.geom.ModelLayers; -import net.minecraft.client.renderer.entity.layers.WardenEmissiveLayer; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.entity.layers.LivingEntityEmissiveLayer; +import net.minecraft.client.renderer.entity.state.WardenRenderState; import net.minecraft.resources.ResourceLocation; import net.minecraft.util.Mth; import net.minecraft.world.entity.monster.warden.Warden; @Environment(EnvType.CLIENT) -public class WardenRenderer extends MobRenderer> { +public class WardenRenderer extends MobRenderer { private static final ResourceLocation TEXTURE = ResourceLocation.withDefaultNamespace("textures/entity/warden/warden.png"); private static final ResourceLocation BIOLUMINESCENT_LAYER_TEXTURE = ResourceLocation.withDefaultNamespace( "textures/entity/warden/warden_bioluminescent_layer.png" @@ -20,26 +22,63 @@ public class WardenRenderer extends MobRenderer> { private static final ResourceLocation PULSATING_SPOTS_TEXTURE_2 = ResourceLocation.withDefaultNamespace("textures/entity/warden/warden_pulsating_spots_2.png"); public WardenRenderer(EntityRendererProvider.Context context) { - super(context, new WardenModel<>(context.bakeLayer(ModelLayers.WARDEN)), 0.9F); - this.addLayer(new WardenEmissiveLayer<>(this, BIOLUMINESCENT_LAYER_TEXTURE, (warden, f, g) -> 1.0F, WardenModel::getBioluminescentLayerModelParts)); + super(context, new WardenModel(context.bakeLayer(ModelLayers.WARDEN)), 0.9F); this.addLayer( - new WardenEmissiveLayer<>( - this, PULSATING_SPOTS_TEXTURE_1, (warden, f, g) -> Math.max(0.0F, Mth.cos(g * 0.045F) * 0.25F), WardenModel::getPulsatingSpotsLayerModelParts + new LivingEntityEmissiveLayer<>( + this, BIOLUMINESCENT_LAYER_TEXTURE, (wardenRenderState, f) -> 1.0F, WardenModel::getBioluminescentLayerModelParts, RenderType::entityTranslucentEmissive ) ); this.addLayer( - new WardenEmissiveLayer<>( + new LivingEntityEmissiveLayer<>( + this, + PULSATING_SPOTS_TEXTURE_1, + (wardenRenderState, f) -> Math.max(0.0F, Mth.cos(f * 0.045F) * 0.25F), + WardenModel::getPulsatingSpotsLayerModelParts, + RenderType::entityTranslucentEmissive + ) + ); + this.addLayer( + new LivingEntityEmissiveLayer<>( this, PULSATING_SPOTS_TEXTURE_2, - (warden, f, g) -> Math.max(0.0F, Mth.cos(g * 0.045F + (float) Math.PI) * 0.25F), - WardenModel::getPulsatingSpotsLayerModelParts + (wardenRenderState, f) -> Math.max(0.0F, Mth.cos(f * 0.045F + (float) Math.PI) * 0.25F), + WardenModel::getPulsatingSpotsLayerModelParts, + RenderType::entityTranslucentEmissive + ) + ); + this.addLayer( + new LivingEntityEmissiveLayer<>( + this, TEXTURE, (wardenRenderState, f) -> wardenRenderState.tendrilAnimation, WardenModel::getTendrilsLayerModelParts, RenderType::entityTranslucentEmissive + ) + ); + this.addLayer( + new LivingEntityEmissiveLayer<>( + this, + HEART_TEXTURE, + (wardenRenderState, f) -> wardenRenderState.heartAnimation, + WardenModel::getHeartLayerModelParts, + RenderType::entityTranslucentEmissive ) ); - this.addLayer(new WardenEmissiveLayer<>(this, TEXTURE, (warden, f, g) -> warden.getTendrilAnimation(f), WardenModel::getTendrilsLayerModelParts)); - this.addLayer(new WardenEmissiveLayer<>(this, HEART_TEXTURE, (warden, f, g) -> warden.getHeartAnimation(f), WardenModel::getHeartLayerModelParts)); } - public ResourceLocation getTextureLocation(Warden warden) { + public ResourceLocation getTextureLocation(WardenRenderState wardenRenderState) { return TEXTURE; } + + public WardenRenderState createRenderState() { + return new WardenRenderState(); + } + + public void extractRenderState(Warden warden, WardenRenderState wardenRenderState, float f) { + super.extractRenderState(warden, wardenRenderState, f); + wardenRenderState.tendrilAnimation = warden.getTendrilAnimation(f); + wardenRenderState.heartAnimation = warden.getHeartAnimation(f); + wardenRenderState.roarAnimationState.copyFrom(warden.roarAnimationState); + wardenRenderState.sniffAnimationState.copyFrom(warden.sniffAnimationState); + wardenRenderState.emergeAnimationState.copyFrom(warden.emergeAnimationState); + wardenRenderState.diggingAnimationState.copyFrom(warden.diggingAnimationState); + wardenRenderState.attackAnimationState.copyFrom(warden.attackAnimationState); + wardenRenderState.sonicBoomAnimationState.copyFrom(warden.sonicBoomAnimationState); + } } diff --git a/net/minecraft/client/renderer/entity/WindChargeRenderer.java b/net/minecraft/client/renderer/entity/WindChargeRenderer.java index 982ccfd5..63d4fcd9 100644 --- a/net/minecraft/client/renderer/entity/WindChargeRenderer.java +++ b/net/minecraft/client/renderer/entity/WindChargeRenderer.java @@ -8,14 +8,13 @@ import net.minecraft.client.model.WindChargeModel; import net.minecraft.client.model.geom.ModelLayers; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.entity.state.EntityRenderState; import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.resources.ResourceLocation; -import net.minecraft.util.Mth; import net.minecraft.world.entity.projectile.windcharge.AbstractWindCharge; @Environment(EnvType.CLIENT) -public class WindChargeRenderer extends EntityRenderer { - private static final float MIN_CAMERA_DISTANCE_SQUARED = Mth.square(3.5F); +public class WindChargeRenderer extends EntityRenderer { private static final ResourceLocation TEXTURE_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/projectiles/wind_charge.png"); private final WindChargeModel model; @@ -24,24 +23,20 @@ public class WindChargeRenderer extends EntityRenderer { this.model = new WindChargeModel(context.bakeLayer(ModelLayers.WIND_CHARGE)); } - public void render(AbstractWindCharge entity, float entityYaw, float partialTick, PoseStack poseStack, MultiBufferSource bufferSource, int packedLight) { - if (entity.tickCount >= 2 || !(this.entityRenderDispatcher.camera.getEntity().distanceToSqr(entity) < MIN_CAMERA_DISTANCE_SQUARED)) { - float f = entity.tickCount + partialTick; - VertexConsumer vertexConsumer = bufferSource.getBuffer(RenderType.breezeWind(TEXTURE_LOCATION, this.xOffset(f) % 1.0F, 0.0F)); - this.model.setupAnim(entity, 0.0F, 0.0F, f, 0.0F, 0.0F); - this.model.renderToBuffer(poseStack, vertexConsumer, packedLight, OverlayTexture.NO_OVERLAY); - super.render(entity, entityYaw, partialTick, poseStack, bufferSource, packedLight); - } + @Override + public void render(EntityRenderState entityRenderState, PoseStack poseStack, MultiBufferSource multiBufferSource, int i) { + VertexConsumer vertexConsumer = multiBufferSource.getBuffer(RenderType.breezeWind(TEXTURE_LOCATION, this.xOffset(entityRenderState.ageInTicks) % 1.0F, 0.0F)); + this.model.setupAnim(entityRenderState); + this.model.renderToBuffer(poseStack, vertexConsumer, i, OverlayTexture.NO_OVERLAY); + super.render(entityRenderState, poseStack, multiBufferSource, i); } protected float xOffset(float tickCount) { return tickCount * 0.03F; } - /** - * Returns the location of an entity's texture. - */ - public ResourceLocation getTextureLocation(AbstractWindCharge entity) { - return TEXTURE_LOCATION; + @Override + public EntityRenderState createRenderState() { + return new EntityRenderState(); } } diff --git a/net/minecraft/client/renderer/entity/WitchRenderer.java b/net/minecraft/client/renderer/entity/WitchRenderer.java index f8ec98a0..27ae7840 100644 --- a/net/minecraft/client/renderer/entity/WitchRenderer.java +++ b/net/minecraft/client/renderer/entity/WitchRenderer.java @@ -1,38 +1,34 @@ package net.minecraft.client.renderer.entity; -import com.mojang.blaze3d.vertex.PoseStack; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.model.WitchModel; import net.minecraft.client.model.geom.ModelLayers; -import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.entity.layers.WitchItemLayer; +import net.minecraft.client.renderer.entity.state.WitchRenderState; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.monster.Witch; @Environment(EnvType.CLIENT) -public class WitchRenderer extends MobRenderer> { +public class WitchRenderer extends MobRenderer { private static final ResourceLocation WITCH_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/witch.png"); public WitchRenderer(EntityRendererProvider.Context context) { - super(context, new WitchModel<>(context.bakeLayer(ModelLayers.WITCH)), 0.5F); - this.addLayer(new WitchItemLayer<>(this, context.getItemInHandRenderer())); + super(context, new WitchModel(context.bakeLayer(ModelLayers.WITCH)), 0.5F); + this.addLayer(new WitchItemLayer(this, context.getItemRenderer())); } - public void render(Witch entity, float entityYaw, float partialTicks, PoseStack poseStack, MultiBufferSource buffer, int packedLight) { - this.model.setHoldingItem(!entity.getMainHandItem().isEmpty()); - super.render(entity, entityYaw, partialTicks, poseStack, buffer, packedLight); - } - - /** - * Returns the location of an entity's texture. - */ - public ResourceLocation getTextureLocation(Witch entity) { + public ResourceLocation getTextureLocation(WitchRenderState witchRenderState) { return WITCH_LOCATION; } - protected void scale(Witch livingEntity, PoseStack poseStack, float partialTickTime) { - float f = 0.9375F; - poseStack.scale(0.9375F, 0.9375F, 0.9375F); + public WitchRenderState createRenderState() { + return new WitchRenderState(); + } + + public void extractRenderState(Witch witch, WitchRenderState witchRenderState, float f) { + super.extractRenderState(witch, witchRenderState, f); + witchRenderState.entityId = witch.getId(); + witchRenderState.isHoldingItem = !witch.getMainHandItem().isEmpty(); } } diff --git a/net/minecraft/client/renderer/entity/WitherBossRenderer.java b/net/minecraft/client/renderer/entity/WitherBossRenderer.java index c82e4dc5..5a938a7f 100644 --- a/net/minecraft/client/renderer/entity/WitherBossRenderer.java +++ b/net/minecraft/client/renderer/entity/WitherBossRenderer.java @@ -6,17 +6,19 @@ import net.fabricmc.api.Environment; import net.minecraft.client.model.WitherBossModel; import net.minecraft.client.model.geom.ModelLayers; import net.minecraft.client.renderer.entity.layers.WitherArmorLayer; +import net.minecraft.client.renderer.entity.state.WitherRenderState; import net.minecraft.core.BlockPos; import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.Mth; import net.minecraft.world.entity.boss.wither.WitherBoss; @Environment(EnvType.CLIENT) -public class WitherBossRenderer extends MobRenderer> { +public class WitherBossRenderer extends MobRenderer { private static final ResourceLocation WITHER_INVULNERABLE_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/wither/wither_invulnerable.png"); private static final ResourceLocation WITHER_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/wither/wither.png"); public WitherBossRenderer(EntityRendererProvider.Context context) { - super(context, new WitherBossModel<>(context.bakeLayer(ModelLayers.WITHER)), 1.0F); + super(context, new WitherBossModel(context.bakeLayer(ModelLayers.WITHER)), 1.0F); this.addLayer(new WitherArmorLayer(this, context.getModelSet())); } @@ -24,21 +26,30 @@ public class WitherBossRenderer extends MobRenderer 0 && (i > 80 || i / 5 % 2 != 1) ? WITHER_INVULNERABLE_LOCATION : WITHER_LOCATION; } - protected void scale(WitherBoss livingEntity, PoseStack poseStack, float partialTickTime) { + public WitherRenderState createRenderState() { + return new WitherRenderState(); + } + + protected void scale(WitherRenderState witherRenderState, PoseStack poseStack) { float f = 2.0F; - int i = livingEntity.getInvulnerableTicks(); - if (i > 0) { - f -= (i - partialTickTime) / 220.0F * 0.5F; + if (witherRenderState.invulnerableTicks > 0.0F) { + f -= witherRenderState.invulnerableTicks / 220.0F * 0.5F; } poseStack.scale(f, f, f); } + + public void extractRenderState(WitherBoss witherBoss, WitherRenderState witherRenderState, float f) { + super.extractRenderState(witherBoss, witherRenderState, f); + int i = witherBoss.getInvulnerableTicks(); + witherRenderState.invulnerableTicks = i > 0 ? i - f : 0.0F; + System.arraycopy(witherBoss.getHeadXRots(), 0, witherRenderState.xHeadRots, 0, witherRenderState.xHeadRots.length); + System.arraycopy(witherBoss.getHeadYRots(), 0, witherRenderState.yHeadRots, 0, witherRenderState.yHeadRots.length); + witherRenderState.isPowered = witherBoss.isPowered(); + } } diff --git a/net/minecraft/client/renderer/entity/WitherSkeletonRenderer.java b/net/minecraft/client/renderer/entity/WitherSkeletonRenderer.java index e9d38529..55a59adf 100644 --- a/net/minecraft/client/renderer/entity/WitherSkeletonRenderer.java +++ b/net/minecraft/client/renderer/entity/WitherSkeletonRenderer.java @@ -1,28 +1,25 @@ package net.minecraft.client.renderer.entity; -import com.mojang.blaze3d.vertex.PoseStack; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.model.geom.ModelLayers; +import net.minecraft.client.renderer.entity.state.SkeletonRenderState; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.monster.WitherSkeleton; @Environment(EnvType.CLIENT) -public class WitherSkeletonRenderer extends SkeletonRenderer { +public class WitherSkeletonRenderer extends AbstractSkeletonRenderer { private static final ResourceLocation WITHER_SKELETON_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/skeleton/wither_skeleton.png"); public WitherSkeletonRenderer(EntityRendererProvider.Context context) { super(context, ModelLayers.WITHER_SKELETON, ModelLayers.WITHER_SKELETON_INNER_ARMOR, ModelLayers.WITHER_SKELETON_OUTER_ARMOR); } - /** - * Returns the location of an entity's texture. - */ - public ResourceLocation getTextureLocation(WitherSkeleton entity) { + public ResourceLocation getTextureLocation(SkeletonRenderState skeletonRenderState) { return WITHER_SKELETON_LOCATION; } - protected void scale(WitherSkeleton livingEntity, PoseStack poseStack, float partialTickTime) { - poseStack.scale(1.2F, 1.2F, 1.2F); + public SkeletonRenderState createRenderState() { + return new SkeletonRenderState(); } } diff --git a/net/minecraft/client/renderer/entity/WitherSkullRenderer.java b/net/minecraft/client/renderer/entity/WitherSkullRenderer.java index cecb0d37..b6666ffd 100644 --- a/net/minecraft/client/renderer/entity/WitherSkullRenderer.java +++ b/net/minecraft/client/renderer/entity/WitherSkullRenderer.java @@ -12,14 +12,14 @@ import net.minecraft.client.model.geom.builders.LayerDefinition; import net.minecraft.client.model.geom.builders.MeshDefinition; import net.minecraft.client.model.geom.builders.PartDefinition; import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.entity.state.WitherSkullRenderState; import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.core.BlockPos; import net.minecraft.resources.ResourceLocation; -import net.minecraft.util.Mth; import net.minecraft.world.entity.projectile.WitherSkull; @Environment(EnvType.CLIENT) -public class WitherSkullRenderer extends EntityRenderer { +public class WitherSkullRenderer extends EntityRenderer { private static final ResourceLocation WITHER_INVULNERABLE_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/wither/wither_invulnerable.png"); private static final ResourceLocation WITHER_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/wither/wither.png"); private final SkullModel model; @@ -40,22 +40,28 @@ public class WitherSkullRenderer extends EntityRenderer { return 15; } - public void render(WitherSkull entity, float entityYaw, float partialTicks, PoseStack poseStack, MultiBufferSource buffer, int packedLight) { + public void render(WitherSkullRenderState witherSkullRenderState, PoseStack poseStack, MultiBufferSource multiBufferSource, int i) { poseStack.pushPose(); poseStack.scale(-1.0F, -1.0F, 1.0F); - float f = Mth.rotLerp(partialTicks, entity.yRotO, entity.getYRot()); - float g = Mth.lerp(partialTicks, entity.xRotO, entity.getXRot()); - VertexConsumer vertexConsumer = buffer.getBuffer(this.model.renderType(this.getTextureLocation(entity))); - this.model.setupAnim(0.0F, f, g); - this.model.renderToBuffer(poseStack, vertexConsumer, packedLight, OverlayTexture.NO_OVERLAY); + VertexConsumer vertexConsumer = multiBufferSource.getBuffer(this.model.renderType(this.getTextureLocation(witherSkullRenderState))); + this.model.setupAnim(0.0F, witherSkullRenderState.yRot, witherSkullRenderState.xRot); + this.model.renderToBuffer(poseStack, vertexConsumer, i, OverlayTexture.NO_OVERLAY); poseStack.popPose(); - super.render(entity, entityYaw, partialTicks, poseStack, buffer, packedLight); + super.render(witherSkullRenderState, poseStack, multiBufferSource, i); } - /** - * Returns the location of an entity's texture. - */ - public ResourceLocation getTextureLocation(WitherSkull entity) { - return entity.isDangerous() ? WITHER_INVULNERABLE_LOCATION : WITHER_LOCATION; + private ResourceLocation getTextureLocation(WitherSkullRenderState witherSkullRenderState) { + return witherSkullRenderState.isDangerous ? WITHER_INVULNERABLE_LOCATION : WITHER_LOCATION; + } + + public WitherSkullRenderState createRenderState() { + return new WitherSkullRenderState(); + } + + public void extractRenderState(WitherSkull witherSkull, WitherSkullRenderState witherSkullRenderState, float f) { + super.extractRenderState(witherSkull, witherSkullRenderState, f); + witherSkullRenderState.isDangerous = witherSkull.isDangerous(); + witherSkullRenderState.yRot = witherSkull.getYRot(f); + witherSkullRenderState.xRot = witherSkull.getXRot(f); } } diff --git a/net/minecraft/client/renderer/entity/WolfRenderer.java b/net/minecraft/client/renderer/entity/WolfRenderer.java index 2b93cf16..1d250ae8 100644 --- a/net/minecraft/client/renderer/entity/WolfRenderer.java +++ b/net/minecraft/client/renderer/entity/WolfRenderer.java @@ -1,48 +1,47 @@ package net.minecraft.client.renderer.entity; -import com.mojang.blaze3d.vertex.PoseStack; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.model.WolfModel; import net.minecraft.client.model.geom.ModelLayers; -import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.entity.layers.WolfArmorLayer; import net.minecraft.client.renderer.entity.layers.WolfCollarLayer; +import net.minecraft.client.renderer.entity.state.WolfRenderState; import net.minecraft.resources.ResourceLocation; -import net.minecraft.util.FastColor; +import net.minecraft.util.ARGB; import net.minecraft.world.entity.animal.Wolf; @Environment(EnvType.CLIENT) -public class WolfRenderer extends MobRenderer> { +public class WolfRenderer extends AgeableMobRenderer { public WolfRenderer(EntityRendererProvider.Context context) { - super(context, new WolfModel<>(context.bakeLayer(ModelLayers.WOLF)), 0.5F); - this.addLayer(new WolfArmorLayer(this, context.getModelSet())); + super(context, new WolfModel(context.bakeLayer(ModelLayers.WOLF)), new WolfModel(context.bakeLayer(ModelLayers.WOLF_BABY)), 0.5F); + this.addLayer(new WolfArmorLayer(this, context.getModelSet(), context.getEquipmentRenderer())); this.addLayer(new WolfCollarLayer(this)); } - /** - * Defines what float the third param in setRotationAngles of ModelBase is - */ - protected float getBob(Wolf livingBase, float partialTicks) { - return livingBase.getTailAngle(); + protected int getModelTint(WolfRenderState wolfRenderState) { + float f = wolfRenderState.wetShade; + return f == 1.0F ? -1 : ARGB.colorFromFloat(1.0F, f, f, f); } - public void render(Wolf entity, float entityYaw, float partialTicks, PoseStack poseStack, MultiBufferSource buffer, int packedLight) { - if (entity.isWet()) { - float f = entity.getWetShade(partialTicks); - this.model.setColor(FastColor.ARGB32.colorFromFloat(1.0F, f, f, f)); - } - - super.render(entity, entityYaw, partialTicks, poseStack, buffer, packedLight); - if (entity.isWet()) { - this.model.setColor(-1); - } + public ResourceLocation getTextureLocation(WolfRenderState wolfRenderState) { + return wolfRenderState.texture; } - /** - * Returns the location of an entity's texture. - */ - public ResourceLocation getTextureLocation(Wolf entity) { - return entity.getTexture(); + public WolfRenderState createRenderState() { + return new WolfRenderState(); + } + + public void extractRenderState(Wolf wolf, WolfRenderState wolfRenderState, float f) { + super.extractRenderState(wolf, wolfRenderState, f); + wolfRenderState.isAngry = wolf.isAngry(); + wolfRenderState.isSitting = wolf.isInSittingPose(); + wolfRenderState.tailAngle = wolf.getTailAngle(); + wolfRenderState.headRollAngle = wolf.getHeadRollAngle(f); + wolfRenderState.shakeAnim = wolf.getShakeAnim(f); + wolfRenderState.texture = wolf.getTexture(); + wolfRenderState.wetShade = wolf.getWetShade(f); + wolfRenderState.collarColor = wolf.isTame() ? wolf.getCollarColor() : null; + wolfRenderState.bodyArmorItem = wolf.getBodyArmorItem().copy(); } } diff --git a/net/minecraft/client/renderer/entity/ZoglinRenderer.java b/net/minecraft/client/renderer/entity/ZoglinRenderer.java index 95de4ffe..bca8f37d 100644 --- a/net/minecraft/client/renderer/entity/ZoglinRenderer.java +++ b/net/minecraft/client/renderer/entity/ZoglinRenderer.java @@ -2,23 +2,20 @@ package net.minecraft.client.renderer.entity; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; -import net.minecraft.client.model.HoglinModel; import net.minecraft.client.model.geom.ModelLayers; +import net.minecraft.client.renderer.entity.state.HoglinRenderState; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.monster.Zoglin; @Environment(EnvType.CLIENT) -public class ZoglinRenderer extends MobRenderer> { +public class ZoglinRenderer extends AbstractHoglinRenderer { private static final ResourceLocation ZOGLIN_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/hoglin/zoglin.png"); public ZoglinRenderer(EntityRendererProvider.Context context) { - super(context, new HoglinModel<>(context.bakeLayer(ModelLayers.ZOGLIN)), 0.7F); + super(context, ModelLayers.ZOGLIN, ModelLayers.ZOGLIN_BABY, 0.7F); } - /** - * Returns the location of an entity's texture. - */ - public ResourceLocation getTextureLocation(Zoglin entity) { + public ResourceLocation getTextureLocation(HoglinRenderState hoglinRenderState) { return ZOGLIN_LOCATION; } } diff --git a/net/minecraft/client/renderer/entity/ZombieRenderer.java b/net/minecraft/client/renderer/entity/ZombieRenderer.java index 2af548aa..3aab56c8 100644 --- a/net/minecraft/client/renderer/entity/ZombieRenderer.java +++ b/net/minecraft/client/renderer/entity/ZombieRenderer.java @@ -5,20 +5,44 @@ import net.fabricmc.api.Environment; import net.minecraft.client.model.ZombieModel; import net.minecraft.client.model.geom.ModelLayerLocation; import net.minecraft.client.model.geom.ModelLayers; +import net.minecraft.client.renderer.entity.state.ZombieRenderState; import net.minecraft.world.entity.monster.Zombie; @Environment(EnvType.CLIENT) -public class ZombieRenderer extends AbstractZombieRenderer> { +public class ZombieRenderer extends AbstractZombieRenderer> { public ZombieRenderer(EntityRendererProvider.Context context) { - this(context, ModelLayers.ZOMBIE, ModelLayers.ZOMBIE_INNER_ARMOR, ModelLayers.ZOMBIE_OUTER_ARMOR); + this( + context, + ModelLayers.ZOMBIE, + ModelLayers.ZOMBIE_BABY, + ModelLayers.ZOMBIE_INNER_ARMOR, + ModelLayers.ZOMBIE_OUTER_ARMOR, + ModelLayers.ZOMBIE_BABY_INNER_ARMOR, + ModelLayers.ZOMBIE_BABY_OUTER_ARMOR + ); } - public ZombieRenderer(EntityRendererProvider.Context context, ModelLayerLocation zombieLayer, ModelLayerLocation innerArmor, ModelLayerLocation outerArmor) { + public ZombieRenderState createRenderState() { + return new ZombieRenderState(); + } + + public ZombieRenderer( + EntityRendererProvider.Context context, + ModelLayerLocation modelLayerLocation, + ModelLayerLocation modelLayerLocation2, + ModelLayerLocation modelLayerLocation3, + ModelLayerLocation modelLayerLocation4, + ModelLayerLocation modelLayerLocation5, + ModelLayerLocation modelLayerLocation6 + ) { super( context, - new ZombieModel<>(context.bakeLayer(zombieLayer)), - new ZombieModel<>(context.bakeLayer(innerArmor)), - new ZombieModel<>(context.bakeLayer(outerArmor)) + new ZombieModel<>(context.bakeLayer(modelLayerLocation)), + new ZombieModel<>(context.bakeLayer(modelLayerLocation2)), + new ZombieModel<>(context.bakeLayer(modelLayerLocation3)), + new ZombieModel<>(context.bakeLayer(modelLayerLocation4)), + new ZombieModel<>(context.bakeLayer(modelLayerLocation5)), + new ZombieModel<>(context.bakeLayer(modelLayerLocation6)) ); } } diff --git a/net/minecraft/client/renderer/entity/ZombieVillagerRenderer.java b/net/minecraft/client/renderer/entity/ZombieVillagerRenderer.java index e4adc5c2..e8315fc4 100644 --- a/net/minecraft/client/renderer/entity/ZombieVillagerRenderer.java +++ b/net/minecraft/client/renderer/entity/ZombieVillagerRenderer.java @@ -6,34 +6,51 @@ import net.minecraft.client.model.ZombieVillagerModel; import net.minecraft.client.model.geom.ModelLayers; import net.minecraft.client.renderer.entity.layers.HumanoidArmorLayer; import net.minecraft.client.renderer.entity.layers.VillagerProfessionLayer; +import net.minecraft.client.renderer.entity.state.ZombieVillagerRenderState; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.monster.ZombieVillager; @Environment(EnvType.CLIENT) -public class ZombieVillagerRenderer extends HumanoidMobRenderer> { +public class ZombieVillagerRenderer extends HumanoidMobRenderer> { private static final ResourceLocation ZOMBIE_VILLAGER_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/zombie_villager/zombie_villager.png"); public ZombieVillagerRenderer(EntityRendererProvider.Context context) { - super(context, new ZombieVillagerModel<>(context.bakeLayer(ModelLayers.ZOMBIE_VILLAGER)), 0.5F); + super( + context, + new ZombieVillagerModel<>(context.bakeLayer(ModelLayers.ZOMBIE_VILLAGER)), + new ZombieVillagerModel<>(context.bakeLayer(ModelLayers.ZOMBIE_VILLAGER_BABY)), + 0.5F, + VillagerRenderer.CUSTOM_HEAD_TRANSFORMS + ); this.addLayer( new HumanoidArmorLayer<>( this, new ZombieVillagerModel(context.bakeLayer(ModelLayers.ZOMBIE_VILLAGER_INNER_ARMOR)), new ZombieVillagerModel(context.bakeLayer(ModelLayers.ZOMBIE_VILLAGER_OUTER_ARMOR)), - context.getModelManager() + new ZombieVillagerModel(context.bakeLayer(ModelLayers.ZOMBIE_VILLAGER_BABY_INNER_ARMOR)), + new ZombieVillagerModel(context.bakeLayer(ModelLayers.ZOMBIE_VILLAGER_BABY_OUTER_ARMOR)), + context.getEquipmentRenderer() ) ); this.addLayer(new VillagerProfessionLayer<>(this, context.getResourceManager(), "zombie_villager")); } - /** - * Returns the location of an entity's texture. - */ - public ResourceLocation getTextureLocation(ZombieVillager entity) { + public ResourceLocation getTextureLocation(ZombieVillagerRenderState zombieVillagerRenderState) { return ZOMBIE_VILLAGER_LOCATION; } - protected boolean isShaking(ZombieVillager entity) { - return super.isShaking(entity) || entity.isConverting(); + public ZombieVillagerRenderState createRenderState() { + return new ZombieVillagerRenderState(); + } + + public void extractRenderState(ZombieVillager zombieVillager, ZombieVillagerRenderState zombieVillagerRenderState, float f) { + super.extractRenderState(zombieVillager, zombieVillagerRenderState, f); + zombieVillagerRenderState.isConverting = zombieVillager.isConverting(); + zombieVillagerRenderState.villagerData = zombieVillager.getVillagerData(); + zombieVillagerRenderState.isAggressive = zombieVillager.isAggressive(); + } + + protected boolean isShaking(ZombieVillagerRenderState zombieVillagerRenderState) { + return super.isShaking(zombieVillagerRenderState) || zombieVillagerRenderState.isConverting; } } diff --git a/net/minecraft/client/renderer/entity/ZombifiedPiglinRenderer.java b/net/minecraft/client/renderer/entity/ZombifiedPiglinRenderer.java new file mode 100644 index 00000000..e887e9f0 --- /dev/null +++ b/net/minecraft/client/renderer/entity/ZombifiedPiglinRenderer.java @@ -0,0 +1,57 @@ +package net.minecraft.client.renderer.entity; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.client.model.HumanoidArmorModel; +import net.minecraft.client.model.ZombifiedPiglinModel; +import net.minecraft.client.model.geom.ModelLayerLocation; +import net.minecraft.client.renderer.entity.layers.HumanoidArmorLayer; +import net.minecraft.client.renderer.entity.state.ZombifiedPiglinRenderState; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.monster.ZombifiedPiglin; + +@Environment(EnvType.CLIENT) +public class ZombifiedPiglinRenderer extends HumanoidMobRenderer { + private static final ResourceLocation ZOMBIFIED_PIGLIN_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/piglin/zombified_piglin.png"); + + public ZombifiedPiglinRenderer( + EntityRendererProvider.Context context, + ModelLayerLocation modelLayerLocation, + ModelLayerLocation modelLayerLocation2, + ModelLayerLocation modelLayerLocation3, + ModelLayerLocation modelLayerLocation4, + ModelLayerLocation modelLayerLocation5, + ModelLayerLocation modelLayerLocation6 + ) { + super( + context, + new ZombifiedPiglinModel(context.bakeLayer(modelLayerLocation)), + new ZombifiedPiglinModel(context.bakeLayer(modelLayerLocation2)), + 0.5F, + PiglinRenderer.PIGLIN_CUSTOM_HEAD_TRANSFORMS + ); + this.addLayer( + new HumanoidArmorLayer<>( + this, + new HumanoidArmorModel(context.bakeLayer(modelLayerLocation3)), + new HumanoidArmorModel(context.bakeLayer(modelLayerLocation4)), + new HumanoidArmorModel(context.bakeLayer(modelLayerLocation5)), + new HumanoidArmorModel(context.bakeLayer(modelLayerLocation5)), + context.getEquipmentRenderer() + ) + ); + } + + public ResourceLocation getTextureLocation(ZombifiedPiglinRenderState zombifiedPiglinRenderState) { + return ZOMBIFIED_PIGLIN_LOCATION; + } + + public ZombifiedPiglinRenderState createRenderState() { + return new ZombifiedPiglinRenderState(); + } + + public void extractRenderState(ZombifiedPiglin zombifiedPiglin, ZombifiedPiglinRenderState zombifiedPiglinRenderState, float f) { + super.extractRenderState(zombifiedPiglin, zombifiedPiglinRenderState, f); + zombifiedPiglinRenderState.isAggressive = zombifiedPiglin.isAggressive(); + } +} diff --git a/net/minecraft/client/renderer/entity/layers/ArrowLayer.java b/net/minecraft/client/renderer/entity/layers/ArrowLayer.java index ff5165de..2ac69101 100644 --- a/net/minecraft/client/renderer/entity/layers/ArrowLayer.java +++ b/net/minecraft/client/renderer/entity/layers/ArrowLayer.java @@ -1,41 +1,28 @@ package net.minecraft.client.renderer.entity.layers; -import com.mojang.blaze3d.vertex.PoseStack; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; +import net.minecraft.client.model.ArrowModel; import net.minecraft.client.model.PlayerModel; -import net.minecraft.client.renderer.MultiBufferSource; -import net.minecraft.client.renderer.entity.EntityRenderDispatcher; +import net.minecraft.client.model.geom.ModelLayers; import net.minecraft.client.renderer.entity.EntityRendererProvider; import net.minecraft.client.renderer.entity.LivingEntityRenderer; -import net.minecraft.util.Mth; -import net.minecraft.world.entity.Entity; -import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.entity.projectile.Arrow; -import net.minecraft.world.item.ItemStack; +import net.minecraft.client.renderer.entity.TippableArrowRenderer; +import net.minecraft.client.renderer.entity.state.PlayerRenderState; @Environment(EnvType.CLIENT) -public class ArrowLayer> extends StuckInBodyLayer { - private final EntityRenderDispatcher dispatcher; - - public ArrowLayer(EntityRendererProvider.Context context, LivingEntityRenderer renderer) { - super(renderer); - this.dispatcher = context.getEntityRenderDispatcher(); +public class ArrowLayer extends StuckInBodyLayer { + public ArrowLayer(LivingEntityRenderer livingEntityRenderer, EntityRendererProvider.Context context) { + super( + livingEntityRenderer, + new ArrowModel(context.bakeLayer(ModelLayers.ARROW)), + TippableArrowRenderer.NORMAL_ARROW_LOCATION, + StuckInBodyLayer.PlacementStyle.IN_CUBE + ); } @Override - protected int numStuck(T entity) { - return entity.getArrowCount(); - } - - @Override - protected void renderStuckItem(PoseStack poseStack, MultiBufferSource buffer, int packedLight, Entity entity, float x, float y, float z, float partialTick) { - float f = Mth.sqrt(x * x + z * z); - Arrow arrow = new Arrow(entity.level(), entity.getX(), entity.getY(), entity.getZ(), ItemStack.EMPTY, null); - arrow.setYRot((float)(Math.atan2(x, z) * 180.0F / (float)Math.PI)); - arrow.setXRot((float)(Math.atan2(y, f) * 180.0F / (float)Math.PI)); - arrow.yRotO = arrow.getYRot(); - arrow.xRotO = arrow.getXRot(); - this.dispatcher.render(arrow, 0.0, 0.0, 0.0, 0.0F, partialTick, poseStack, buffer, packedLight); + protected int numStuck(PlayerRenderState playerRenderState) { + return playerRenderState.arrowCount; } } diff --git a/net/minecraft/client/renderer/entity/layers/BeeStingerLayer.java b/net/minecraft/client/renderer/entity/layers/BeeStingerLayer.java index 993e892c..05ce3252 100644 --- a/net/minecraft/client/renderer/entity/layers/BeeStingerLayer.java +++ b/net/minecraft/client/renderer/entity/layers/BeeStingerLayer.java @@ -1,67 +1,25 @@ package net.minecraft.client.renderer.entity.layers; -import com.mojang.blaze3d.vertex.PoseStack; -import com.mojang.blaze3d.vertex.VertexConsumer; -import com.mojang.math.Axis; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; +import net.minecraft.client.model.BeeStingerModel; import net.minecraft.client.model.PlayerModel; -import net.minecraft.client.renderer.MultiBufferSource; -import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.model.geom.ModelLayers; +import net.minecraft.client.renderer.entity.EntityRendererProvider; import net.minecraft.client.renderer.entity.LivingEntityRenderer; -import net.minecraft.client.renderer.texture.OverlayTexture; +import net.minecraft.client.renderer.entity.state.PlayerRenderState; import net.minecraft.resources.ResourceLocation; -import net.minecraft.util.Mth; -import net.minecraft.world.entity.Entity; -import net.minecraft.world.entity.LivingEntity; @Environment(EnvType.CLIENT) -public class BeeStingerLayer> extends StuckInBodyLayer { +public class BeeStingerLayer extends StuckInBodyLayer { private static final ResourceLocation BEE_STINGER_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/bee/bee_stinger.png"); - public BeeStingerLayer(LivingEntityRenderer renderer) { - super(renderer); + public BeeStingerLayer(LivingEntityRenderer livingEntityRenderer, EntityRendererProvider.Context context) { + super(livingEntityRenderer, new BeeStingerModel(context.bakeLayer(ModelLayers.BEE_STINGER)), BEE_STINGER_LOCATION, StuckInBodyLayer.PlacementStyle.ON_SURFACE); } @Override - protected int numStuck(T entity) { - return entity.getStingerCount(); - } - - @Override - protected void renderStuckItem(PoseStack poseStack, MultiBufferSource buffer, int packedLight, Entity entity, float x, float y, float z, float partialTick) { - float f = Mth.sqrt(x * x + z * z); - float g = (float)(Math.atan2(x, z) * 180.0F / (float)Math.PI); - float h = (float)(Math.atan2(y, f) * 180.0F / (float)Math.PI); - poseStack.translate(0.0F, 0.0F, 0.0F); - poseStack.mulPose(Axis.YP.rotationDegrees(g - 90.0F)); - poseStack.mulPose(Axis.ZP.rotationDegrees(h)); - float i = 0.0F; - float j = 0.125F; - float k = 0.0F; - float l = 0.0625F; - float m = 0.03125F; - poseStack.mulPose(Axis.XP.rotationDegrees(45.0F)); - poseStack.scale(0.03125F, 0.03125F, 0.03125F); - poseStack.translate(2.5F, 0.0F, 0.0F); - VertexConsumer vertexConsumer = buffer.getBuffer(RenderType.entityCutoutNoCull(BEE_STINGER_LOCATION)); - - for (int n = 0; n < 4; n++) { - poseStack.mulPose(Axis.XP.rotationDegrees(90.0F)); - PoseStack.Pose pose = poseStack.last(); - vertex(vertexConsumer, pose, -4.5F, -1, 0.0F, 0.0F, packedLight); - vertex(vertexConsumer, pose, 4.5F, -1, 0.125F, 0.0F, packedLight); - vertex(vertexConsumer, pose, 4.5F, 1, 0.125F, 0.0625F, packedLight); - vertex(vertexConsumer, pose, -4.5F, 1, 0.0F, 0.0625F, packedLight); - } - } - - private static void vertex(VertexConsumer consumer, PoseStack.Pose pose, float x, int y, float u, float v, int packedLight) { - consumer.addVertex(pose, x, (float)y, 0.0F) - .setColor(-1) - .setUv(u, v) - .setOverlay(OverlayTexture.NO_OVERLAY) - .setLight(packedLight) - .setNormal(pose, 0.0F, 1.0F, 0.0F); + protected int numStuck(PlayerRenderState playerRenderState) { + return playerRenderState.stingerCount; } } diff --git a/net/minecraft/client/renderer/entity/layers/BreezeEyesLayer.java b/net/minecraft/client/renderer/entity/layers/BreezeEyesLayer.java index f8f05640..4de8ff3b 100644 --- a/net/minecraft/client/renderer/entity/layers/BreezeEyesLayer.java +++ b/net/minecraft/client/renderer/entity/layers/BreezeEyesLayer.java @@ -9,21 +9,21 @@ import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.entity.BreezeRenderer; import net.minecraft.client.renderer.entity.RenderLayerParent; +import net.minecraft.client.renderer.entity.state.BreezeRenderState; import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.entity.monster.breeze.Breeze; @Environment(EnvType.CLIENT) -public class BreezeEyesLayer extends RenderLayer> { +public class BreezeEyesLayer extends RenderLayer { private static final RenderType BREEZE_EYES = RenderType.breezeEyes(ResourceLocation.withDefaultNamespace("textures/entity/breeze/breeze_eyes.png")); - public BreezeEyesLayer(RenderLayerParent> renderLayerParent) { + public BreezeEyesLayer(RenderLayerParent renderLayerParent) { super(renderLayerParent); } - public void render(PoseStack poseStack, MultiBufferSource multiBufferSource, int i, Breeze breeze, float f, float g, float h, float j, float k, float l) { + public void render(PoseStack poseStack, MultiBufferSource multiBufferSource, int i, BreezeRenderState breezeRenderState, float f, float g) { VertexConsumer vertexConsumer = multiBufferSource.getBuffer(BREEZE_EYES); - BreezeModel breezeModel = this.getParentModel(); + BreezeModel breezeModel = this.getParentModel(); BreezeRenderer.enable(breezeModel, breezeModel.head(), breezeModel.eyes()).renderToBuffer(poseStack, vertexConsumer, i, OverlayTexture.NO_OVERLAY); } } diff --git a/net/minecraft/client/renderer/entity/layers/BreezeWindLayer.java b/net/minecraft/client/renderer/entity/layers/BreezeWindLayer.java index b8ad2ede..ff21ae97 100644 --- a/net/minecraft/client/renderer/entity/layers/BreezeWindLayer.java +++ b/net/minecraft/client/renderer/entity/layers/BreezeWindLayer.java @@ -11,36 +11,24 @@ import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.entity.BreezeRenderer; import net.minecraft.client.renderer.entity.EntityRendererProvider; import net.minecraft.client.renderer.entity.RenderLayerParent; +import net.minecraft.client.renderer.entity.state.BreezeRenderState; import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.entity.monster.breeze.Breeze; @Environment(EnvType.CLIENT) -public class BreezeWindLayer extends RenderLayer> { +public class BreezeWindLayer extends RenderLayer { private static final ResourceLocation TEXTURE_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/breeze/breeze_wind.png"); - private final BreezeModel model; + private final BreezeModel model; - public BreezeWindLayer(EntityRendererProvider.Context context, RenderLayerParent> renderer) { + public BreezeWindLayer(EntityRendererProvider.Context context, RenderLayerParent renderer) { super(renderer); - this.model = new BreezeModel<>(context.bakeLayer(ModelLayers.BREEZE_WIND)); + this.model = new BreezeModel(context.bakeLayer(ModelLayers.BREEZE_WIND)); } - public void render( - PoseStack poseStack, - MultiBufferSource bufferSource, - int packedLight, - Breeze livingEntity, - float limbSwing, - float limbSwingAmount, - float partialTick, - float ageInTicks, - float netHeadYaw, - float headPitch - ) { - float f = livingEntity.tickCount + partialTick; - VertexConsumer vertexConsumer = bufferSource.getBuffer(RenderType.breezeWind(TEXTURE_LOCATION, this.xOffset(f) % 1.0F, 0.0F)); - this.model.setupAnim(livingEntity, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch); - BreezeRenderer.enable(this.model, this.model.wind()).renderToBuffer(poseStack, vertexConsumer, packedLight, OverlayTexture.NO_OVERLAY); + public void render(PoseStack poseStack, MultiBufferSource multiBufferSource, int i, BreezeRenderState breezeRenderState, float f, float g) { + VertexConsumer vertexConsumer = multiBufferSource.getBuffer(RenderType.breezeWind(TEXTURE_LOCATION, this.xOffset(breezeRenderState.ageInTicks) % 1.0F, 0.0F)); + this.model.setupAnim(breezeRenderState); + BreezeRenderer.enable(this.model, this.model.wind()).renderToBuffer(poseStack, vertexConsumer, i, OverlayTexture.NO_OVERLAY); } private float xOffset(float tickCount) { diff --git a/net/minecraft/client/renderer/entity/layers/CapeLayer.java b/net/minecraft/client/renderer/entity/layers/CapeLayer.java index 7af3f9a4..77f9576e 100644 --- a/net/minecraft/client/renderer/entity/layers/CapeLayer.java +++ b/net/minecraft/client/renderer/entity/layers/CapeLayer.java @@ -2,77 +2,61 @@ package net.minecraft.client.renderer.entity.layers; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.VertexConsumer; -import com.mojang.math.Axis; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; +import net.minecraft.client.model.HumanoidModel; +import net.minecraft.client.model.PlayerCapeModel; import net.minecraft.client.model.PlayerModel; -import net.minecraft.client.player.AbstractClientPlayer; +import net.minecraft.client.model.geom.EntityModelSet; +import net.minecraft.client.model.geom.ModelLayers; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.entity.RenderLayerParent; +import net.minecraft.client.renderer.entity.state.PlayerRenderState; import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.client.resources.PlayerSkin; -import net.minecraft.util.Mth; -import net.minecraft.world.entity.EquipmentSlot; -import net.minecraft.world.entity.player.PlayerModelPart; +import net.minecraft.client.resources.model.EquipmentModelSet; +import net.minecraft.core.component.DataComponents; +import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.Items; +import net.minecraft.world.item.equipment.EquipmentModel; +import net.minecraft.world.item.equipment.Equippable; @Environment(EnvType.CLIENT) -public class CapeLayer extends RenderLayer> { - public CapeLayer(RenderLayerParent> renderer) { - super(renderer); +public class CapeLayer extends RenderLayer { + private final HumanoidModel model; + private final EquipmentModelSet equipmentModels; + + public CapeLayer(RenderLayerParent renderLayerParent, EntityModelSet entityModelSet, EquipmentModelSet equipmentModelSet) { + super(renderLayerParent); + this.model = new PlayerCapeModel<>(entityModelSet.bakeLayer(ModelLayers.PLAYER_CAPE)); + this.equipmentModels = equipmentModelSet; } - public void render( - PoseStack poseStack, - MultiBufferSource buffer, - int packedLight, - AbstractClientPlayer livingEntity, - float limbSwing, - float limbSwingAmount, - float partialTicks, - float ageInTicks, - float netHeadYaw, - float headPitch - ) { - if (!livingEntity.isInvisible() && livingEntity.isModelPartShown(PlayerModelPart.CAPE)) { - PlayerSkin playerSkin = livingEntity.getSkin(); + private boolean hasLayer(ItemStack itemStack, EquipmentModel.LayerType layerType) { + Equippable equippable = itemStack.get(DataComponents.EQUIPPABLE); + if (equippable != null && !equippable.model().isEmpty()) { + EquipmentModel equipmentModel = this.equipmentModels.get((ResourceLocation)equippable.model().get()); + return !equipmentModel.getLayers(layerType).isEmpty(); + } else { + return false; + } + } + + public void render(PoseStack poseStack, MultiBufferSource multiBufferSource, int i, PlayerRenderState playerRenderState, float f, float g) { + if (!playerRenderState.isInvisible && playerRenderState.showCape) { + PlayerSkin playerSkin = playerRenderState.skin; if (playerSkin.capeTexture() != null) { - ItemStack itemStack = livingEntity.getItemBySlot(EquipmentSlot.CHEST); - if (!itemStack.is(Items.ELYTRA)) { + if (!this.hasLayer(playerRenderState.chestItem, EquipmentModel.LayerType.WINGS)) { poseStack.pushPose(); - poseStack.translate(0.0F, 0.0F, 0.125F); - double d = Mth.lerp((double)partialTicks, livingEntity.xCloakO, livingEntity.xCloak) - - Mth.lerp((double)partialTicks, livingEntity.xo, livingEntity.getX()); - double e = Mth.lerp((double)partialTicks, livingEntity.yCloakO, livingEntity.yCloak) - - Mth.lerp((double)partialTicks, livingEntity.yo, livingEntity.getY()); - double f = Mth.lerp((double)partialTicks, livingEntity.zCloakO, livingEntity.zCloak) - - Mth.lerp((double)partialTicks, livingEntity.zo, livingEntity.getZ()); - float g = Mth.rotLerp(partialTicks, livingEntity.yBodyRotO, livingEntity.yBodyRot); - double h = Mth.sin(g * (float) (Math.PI / 180.0)); - double i = -Mth.cos(g * (float) (Math.PI / 180.0)); - float j = (float)e * 10.0F; - j = Mth.clamp(j, -6.0F, 32.0F); - float k = (float)(d * h + f * i) * 100.0F; - k = Mth.clamp(k, 0.0F, 150.0F); - float l = (float)(d * i - f * h) * 100.0F; - l = Mth.clamp(l, -20.0F, 20.0F); - if (k < 0.0F) { - k = 0.0F; + if (this.hasLayer(playerRenderState.chestItem, EquipmentModel.LayerType.HUMANOID)) { + poseStack.translate(0.0F, -0.053125F, 0.06875F); } - float m = Mth.lerp(partialTicks, livingEntity.oBob, livingEntity.bob); - j += Mth.sin(Mth.lerp(partialTicks, livingEntity.walkDistO, livingEntity.walkDist) * 6.0F) * 32.0F * m; - if (livingEntity.isCrouching()) { - j += 25.0F; - } - - poseStack.mulPose(Axis.XP.rotationDegrees(6.0F + k / 2.0F + j)); - poseStack.mulPose(Axis.ZP.rotationDegrees(l / 2.0F)); - poseStack.mulPose(Axis.YP.rotationDegrees(180.0F - l / 2.0F)); - VertexConsumer vertexConsumer = buffer.getBuffer(RenderType.entitySolid(playerSkin.capeTexture())); - this.getParentModel().renderCloak(poseStack, vertexConsumer, packedLight, OverlayTexture.NO_OVERLAY); + VertexConsumer vertexConsumer = multiBufferSource.getBuffer(RenderType.entitySolid(playerSkin.capeTexture())); + this.getParentModel().copyPropertiesTo(this.model); + this.model.setupAnim(playerRenderState); + this.model.renderToBuffer(poseStack, vertexConsumer, i, OverlayTexture.NO_OVERLAY); poseStack.popPose(); } } diff --git a/net/minecraft/client/renderer/entity/layers/CarriedBlockLayer.java b/net/minecraft/client/renderer/entity/layers/CarriedBlockLayer.java index 6b320424..c475142a 100644 --- a/net/minecraft/client/renderer/entity/layers/CarriedBlockLayer.java +++ b/net/minecraft/client/renderer/entity/layers/CarriedBlockLayer.java @@ -8,42 +8,31 @@ import net.minecraft.client.model.EndermanModel; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.block.BlockRenderDispatcher; import net.minecraft.client.renderer.entity.RenderLayerParent; +import net.minecraft.client.renderer.entity.state.EndermanRenderState; import net.minecraft.client.renderer.texture.OverlayTexture; -import net.minecraft.world.entity.monster.EnderMan; import net.minecraft.world.level.block.state.BlockState; @Environment(EnvType.CLIENT) -public class CarriedBlockLayer extends RenderLayer> { +public class CarriedBlockLayer extends RenderLayer> { private final BlockRenderDispatcher blockRenderer; - public CarriedBlockLayer(RenderLayerParent> renderer, BlockRenderDispatcher blockRenderer) { + public CarriedBlockLayer(RenderLayerParent> renderer, BlockRenderDispatcher blockRenderer) { super(renderer); this.blockRenderer = blockRenderer; } - public void render( - PoseStack poseStack, - MultiBufferSource buffer, - int packedLight, - EnderMan livingEntity, - float limbSwing, - float limbSwingAmount, - float partialTicks, - float ageInTicks, - float netHeadYaw, - float headPitch - ) { - BlockState blockState = livingEntity.getCarriedBlock(); + public void render(PoseStack poseStack, MultiBufferSource multiBufferSource, int i, EndermanRenderState endermanRenderState, float f, float g) { + BlockState blockState = endermanRenderState.carriedBlock; if (blockState != null) { poseStack.pushPose(); poseStack.translate(0.0F, 0.6875F, -0.75F); poseStack.mulPose(Axis.XP.rotationDegrees(20.0F)); poseStack.mulPose(Axis.YP.rotationDegrees(45.0F)); poseStack.translate(0.25F, 0.1875F, 0.25F); - float f = 0.5F; + float h = 0.5F; poseStack.scale(-0.5F, -0.5F, 0.5F); poseStack.mulPose(Axis.YP.rotationDegrees(90.0F)); - this.blockRenderer.renderSingleBlock(blockState, poseStack, buffer, packedLight, OverlayTexture.NO_OVERLAY); + this.blockRenderer.renderSingleBlock(blockState, poseStack, multiBufferSource, i, OverlayTexture.NO_OVERLAY); poseStack.popPose(); } } diff --git a/net/minecraft/client/renderer/entity/layers/CatCollarLayer.java b/net/minecraft/client/renderer/entity/layers/CatCollarLayer.java index bc7350aa..9ef073dc 100644 --- a/net/minecraft/client/renderer/entity/layers/CatCollarLayer.java +++ b/net/minecraft/client/renderer/entity/layers/CatCollarLayer.java @@ -8,49 +8,28 @@ import net.minecraft.client.model.geom.EntityModelSet; import net.minecraft.client.model.geom.ModelLayers; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.entity.RenderLayerParent; +import net.minecraft.client.renderer.entity.state.CatRenderState; import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.entity.animal.Cat; +import net.minecraft.world.item.DyeColor; @Environment(EnvType.CLIENT) -public class CatCollarLayer extends RenderLayer> { +public class CatCollarLayer extends RenderLayer { private static final ResourceLocation CAT_COLLAR_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/cat/cat_collar.png"); - private final CatModel catModel; + private final CatModel adultModel; + private final CatModel babyModel; - public CatCollarLayer(RenderLayerParent> renderer, EntityModelSet modelSet) { + public CatCollarLayer(RenderLayerParent renderer, EntityModelSet modelSet) { super(renderer); - this.catModel = new CatModel<>(modelSet.bakeLayer(ModelLayers.CAT_COLLAR)); + this.adultModel = new CatModel(modelSet.bakeLayer(ModelLayers.CAT_COLLAR)); + this.babyModel = new CatModel(modelSet.bakeLayer(ModelLayers.CAT_BABY_COLLAR)); } - public void render( - PoseStack poseStack, - MultiBufferSource buffer, - int packedLight, - Cat livingEntity, - float limbSwing, - float limbSwingAmount, - float partialTicks, - float ageInTicks, - float netHeadYaw, - float headPitch - ) { - if (livingEntity.isTame()) { - int i = livingEntity.getCollarColor().getTextureDiffuseColor(); - coloredCutoutModelCopyLayerRender( - this.getParentModel(), - this.catModel, - CAT_COLLAR_LOCATION, - poseStack, - buffer, - packedLight, - livingEntity, - limbSwing, - limbSwingAmount, - ageInTicks, - netHeadYaw, - headPitch, - partialTicks, - i - ); + public void render(PoseStack poseStack, MultiBufferSource multiBufferSource, int i, CatRenderState catRenderState, float f, float g) { + DyeColor dyeColor = catRenderState.collarColor; + if (dyeColor != null) { + int j = dyeColor.getTextureDiffuseColor(); + CatModel catModel = catRenderState.isBaby ? this.babyModel : this.adultModel; + coloredCutoutModelCopyLayerRender(catModel, CAT_COLLAR_LOCATION, poseStack, multiBufferSource, i, catRenderState, j); } } } diff --git a/net/minecraft/client/renderer/entity/layers/CreeperPowerLayer.java b/net/minecraft/client/renderer/entity/layers/CreeperPowerLayer.java index e3c65a27..c9309c0a 100644 --- a/net/minecraft/client/renderer/entity/layers/CreeperPowerLayer.java +++ b/net/minecraft/client/renderer/entity/layers/CreeperPowerLayer.java @@ -3,21 +3,24 @@ package net.minecraft.client.renderer.entity.layers; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.model.CreeperModel; -import net.minecraft.client.model.EntityModel; import net.minecraft.client.model.geom.EntityModelSet; import net.minecraft.client.model.geom.ModelLayers; import net.minecraft.client.renderer.entity.RenderLayerParent; +import net.minecraft.client.renderer.entity.state.CreeperRenderState; import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.entity.monster.Creeper; @Environment(EnvType.CLIENT) -public class CreeperPowerLayer extends EnergySwirlLayer> { +public class CreeperPowerLayer extends EnergySwirlLayer { private static final ResourceLocation POWER_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/creeper/creeper_armor.png"); - private final CreeperModel model; + private final CreeperModel model; - public CreeperPowerLayer(RenderLayerParent> renderer, EntityModelSet modelSet) { + public CreeperPowerLayer(RenderLayerParent renderer, EntityModelSet modelSet) { super(renderer); - this.model = new CreeperModel<>(modelSet.bakeLayer(ModelLayers.CREEPER_ARMOR)); + this.model = new CreeperModel(modelSet.bakeLayer(ModelLayers.CREEPER_ARMOR)); + } + + protected boolean isPowered(CreeperRenderState creeperRenderState) { + return creeperRenderState.isPowered; } @Override @@ -30,8 +33,7 @@ public class CreeperPowerLayer extends EnergySwirlLayer model() { + protected CreeperModel model() { return this.model; } } diff --git a/net/minecraft/client/renderer/entity/layers/CrossedArmsItemLayer.java b/net/minecraft/client/renderer/entity/layers/CrossedArmsItemLayer.java index 6b91cd2c..c7e9fe9d 100644 --- a/net/minecraft/client/renderer/entity/layers/CrossedArmsItemLayer.java +++ b/net/minecraft/client/renderer/entity/layers/CrossedArmsItemLayer.java @@ -5,40 +5,33 @@ import com.mojang.math.Axis; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.model.EntityModel; -import net.minecraft.client.renderer.ItemInHandRenderer; import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.entity.ItemRenderer; import net.minecraft.client.renderer.entity.RenderLayerParent; -import net.minecraft.world.entity.EquipmentSlot; -import net.minecraft.world.entity.LivingEntity; +import net.minecraft.client.renderer.entity.state.LivingEntityRenderState; +import net.minecraft.client.renderer.texture.OverlayTexture; +import net.minecraft.client.resources.model.BakedModel; import net.minecraft.world.item.ItemDisplayContext; import net.minecraft.world.item.ItemStack; @Environment(EnvType.CLIENT) -public class CrossedArmsItemLayer> extends RenderLayer { - private final ItemInHandRenderer itemInHandRenderer; +public class CrossedArmsItemLayer> extends RenderLayer { + private final ItemRenderer itemRenderer; - public CrossedArmsItemLayer(RenderLayerParent renderer, ItemInHandRenderer itemInHandRenderer) { - super(renderer); - this.itemInHandRenderer = itemInHandRenderer; + public CrossedArmsItemLayer(RenderLayerParent renderLayerParent, ItemRenderer itemRenderer) { + super(renderLayerParent); + this.itemRenderer = itemRenderer; } - public void render( - PoseStack poseStack, - MultiBufferSource buffer, - int packedLight, - T livingEntity, - float limbSwing, - float limbSwingAmount, - float partialTicks, - float ageInTicks, - float netHeadYaw, - float headPitch - ) { - poseStack.pushPose(); - poseStack.translate(0.0F, 0.4F, -0.4F); - poseStack.mulPose(Axis.XP.rotationDegrees(180.0F)); - ItemStack itemStack = livingEntity.getItemBySlot(EquipmentSlot.MAINHAND); - this.itemInHandRenderer.renderItem(livingEntity, itemStack, ItemDisplayContext.GROUND, false, poseStack, buffer, packedLight); - poseStack.popPose(); + public void render(PoseStack poseStack, MultiBufferSource multiBufferSource, int i, S livingEntityRenderState, float f, float g) { + BakedModel bakedModel = livingEntityRenderState.getMainHandItemModel(); + if (bakedModel != null) { + poseStack.pushPose(); + poseStack.translate(0.0F, 0.4F, -0.4F); + poseStack.mulPose(Axis.XP.rotationDegrees(180.0F)); + ItemStack itemStack = livingEntityRenderState.getMainHandItem(); + this.itemRenderer.render(itemStack, ItemDisplayContext.GROUND, false, poseStack, multiBufferSource, i, OverlayTexture.NO_OVERLAY, bakedModel); + poseStack.popPose(); + } } } diff --git a/net/minecraft/client/renderer/entity/layers/CustomHeadLayer.java b/net/minecraft/client/renderer/entity/layers/CustomHeadLayer.java index 277fd7e4..8270f777 100644 --- a/net/minecraft/client/renderer/entity/layers/CustomHeadLayer.java +++ b/net/minecraft/client/renderer/entity/layers/CustomHeadLayer.java @@ -9,18 +9,16 @@ import net.minecraft.client.model.EntityModel; import net.minecraft.client.model.HeadedModel; import net.minecraft.client.model.SkullModelBase; import net.minecraft.client.model.geom.EntityModelSet; -import net.minecraft.client.renderer.ItemInHandRenderer; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.blockentity.SkullBlockRenderer; +import net.minecraft.client.renderer.entity.ItemRenderer; import net.minecraft.client.renderer.entity.RenderLayerParent; +import net.minecraft.client.renderer.entity.state.LivingEntityRenderState; +import net.minecraft.client.renderer.texture.OverlayTexture; +import net.minecraft.client.resources.model.BakedModel; import net.minecraft.core.component.DataComponents; import net.minecraft.world.entity.EquipmentSlot; -import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.entity.WalkAnimationState; -import net.minecraft.world.entity.monster.ZombieVillager; -import net.minecraft.world.entity.npc.Villager; -import net.minecraft.world.item.ArmorItem; import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemDisplayContext; @@ -30,92 +28,62 @@ import net.minecraft.world.level.block.AbstractSkullBlock; import net.minecraft.world.level.block.SkullBlock; @Environment(EnvType.CLIENT) -public class CustomHeadLayer & HeadedModel> extends RenderLayer { - private final float scaleX; - private final float scaleY; - private final float scaleZ; +public class CustomHeadLayer & HeadedModel> extends RenderLayer { + private static final float ITEM_SCALE = 0.625F; + private static final float SKULL_SCALE = 1.1875F; + private final CustomHeadLayer.Transforms transforms; private final Map skullModels; - private final ItemInHandRenderer itemInHandRenderer; + private final ItemRenderer itemRenderer; - public CustomHeadLayer(RenderLayerParent renderer, EntityModelSet modelSet, ItemInHandRenderer itemInHandRenderer) { - this(renderer, modelSet, 1.0F, 1.0F, 1.0F, itemInHandRenderer); + public CustomHeadLayer(RenderLayerParent renderLayerParent, EntityModelSet entityModelSet, ItemRenderer itemRenderer) { + this(renderLayerParent, entityModelSet, CustomHeadLayer.Transforms.DEFAULT, itemRenderer); } public CustomHeadLayer( - RenderLayerParent renderer, EntityModelSet modelSet, float scaleX, float scaleY, float scaleZ, ItemInHandRenderer itemInHandRenderer + RenderLayerParent renderLayerParent, EntityModelSet entityModelSet, CustomHeadLayer.Transforms transforms, ItemRenderer itemRenderer ) { - super(renderer); - this.scaleX = scaleX; - this.scaleY = scaleY; - this.scaleZ = scaleZ; - this.skullModels = SkullBlockRenderer.createSkullRenderers(modelSet); - this.itemInHandRenderer = itemInHandRenderer; + super(renderLayerParent); + this.transforms = transforms; + this.skullModels = SkullBlockRenderer.createSkullRenderers(entityModelSet); + this.itemRenderer = itemRenderer; } - public void render( - PoseStack poseStack, - MultiBufferSource buffer, - int packedLight, - T livingEntity, - float limbSwing, - float limbSwingAmount, - float partialTicks, - float ageInTicks, - float netHeadYaw, - float headPitch - ) { - ItemStack itemStack = livingEntity.getItemBySlot(EquipmentSlot.HEAD); - if (!itemStack.isEmpty()) { + public void render(PoseStack poseStack, MultiBufferSource multiBufferSource, int i, S livingEntityRenderState, float f, float g) { + ItemStack itemStack = livingEntityRenderState.headItem; + BakedModel bakedModel = livingEntityRenderState.headItemModel; + if (!itemStack.isEmpty() && bakedModel != null) { Item item = itemStack.getItem(); poseStack.pushPose(); - poseStack.scale(this.scaleX, this.scaleY, this.scaleZ); - boolean bl = livingEntity instanceof Villager || livingEntity instanceof ZombieVillager; - if (livingEntity.isBaby() && !(livingEntity instanceof Villager)) { - float f = 2.0F; - float g = 1.4F; - poseStack.translate(0.0F, 0.03125F, 0.0F); - poseStack.scale(0.7F, 0.7F, 0.7F); - poseStack.translate(0.0F, 1.0F, 0.0F); - } - - this.getParentModel().getHead().translateAndRotate(poseStack); - if (item instanceof BlockItem && ((BlockItem)item).getBlock() instanceof AbstractSkullBlock) { - float g = 1.1875F; + poseStack.scale(this.transforms.horizontalScale(), 1.0F, this.transforms.horizontalScale()); + M entityModel = this.getParentModel(); + entityModel.root().translateAndRotate(poseStack); + entityModel.getHead().translateAndRotate(poseStack); + if (item instanceof BlockItem blockItem && blockItem.getBlock() instanceof AbstractSkullBlock abstractSkullBlock) { + poseStack.translate(0.0F, this.transforms.skullYOffset(), 0.0F); poseStack.scale(1.1875F, -1.1875F, -1.1875F); - if (bl) { - poseStack.translate(0.0F, 0.0625F, 0.0F); - } - ResolvableProfile resolvableProfile = itemStack.get(DataComponents.PROFILE); poseStack.translate(-0.5, 0.0, -0.5); - SkullBlock.Type type = ((AbstractSkullBlock)((BlockItem)item).getBlock()).getType(); + SkullBlock.Type type = abstractSkullBlock.getType(); SkullModelBase skullModelBase = (SkullModelBase)this.skullModels.get(type); RenderType renderType = SkullBlockRenderer.getRenderType(type, resolvableProfile); - WalkAnimationState walkAnimationState; - if (livingEntity.getVehicle() instanceof LivingEntity livingEntity2) { - walkAnimationState = livingEntity2.walkAnimation; - } else { - walkAnimationState = livingEntity.walkAnimation; - } - - float h = walkAnimationState.position(partialTicks); - SkullBlockRenderer.renderSkull(null, 180.0F, h, poseStack, buffer, packedLight, skullModelBase, renderType); - } else if (!(item instanceof ArmorItem armorItem && armorItem.getEquipmentSlot() == EquipmentSlot.HEAD)) { - translateToHead(poseStack, bl); - this.itemInHandRenderer.renderItem(livingEntity, itemStack, ItemDisplayContext.HEAD, false, poseStack, buffer, packedLight); + SkullBlockRenderer.renderSkull(null, 180.0F, livingEntityRenderState.wornHeadAnimationPos, poseStack, multiBufferSource, i, skullModelBase, renderType); + } else if (!HumanoidArmorLayer.shouldRender(itemStack, EquipmentSlot.HEAD)) { + translateToHead(poseStack, this.transforms); + this.itemRenderer.render(itemStack, ItemDisplayContext.HEAD, false, poseStack, multiBufferSource, i, OverlayTexture.NO_OVERLAY, bakedModel); } poseStack.popPose(); } } - public static void translateToHead(PoseStack poseStack, boolean isVillager) { - float f = 0.625F; - poseStack.translate(0.0F, -0.25F, 0.0F); + public static void translateToHead(PoseStack poseStack, CustomHeadLayer.Transforms transforms) { + poseStack.translate(0.0F, -0.25F + transforms.yOffset(), 0.0F); poseStack.mulPose(Axis.YP.rotationDegrees(180.0F)); poseStack.scale(0.625F, -0.625F, -0.625F); - if (isVillager) { - poseStack.translate(0.0F, 0.1875F, 0.0F); - } + } + + @Environment(EnvType.CLIENT) + public record Transforms(float yOffset, float skullYOffset, float horizontalScale) { + public static final CustomHeadLayer.Transforms DEFAULT = new CustomHeadLayer.Transforms(0.0F, 0.0F, 1.0F); } } diff --git a/net/minecraft/client/renderer/entity/layers/Deadmau5EarsLayer.java b/net/minecraft/client/renderer/entity/layers/Deadmau5EarsLayer.java index 3f982546..c24c5816 100644 --- a/net/minecraft/client/renderer/entity/layers/Deadmau5EarsLayer.java +++ b/net/minecraft/client/renderer/entity/layers/Deadmau5EarsLayer.java @@ -2,54 +2,35 @@ package net.minecraft.client.renderer.entity.layers; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.VertexConsumer; -import com.mojang.math.Axis; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; +import net.minecraft.client.model.HumanoidModel; +import net.minecraft.client.model.PlayerEarsModel; import net.minecraft.client.model.PlayerModel; -import net.minecraft.client.player.AbstractClientPlayer; +import net.minecraft.client.model.geom.EntityModelSet; +import net.minecraft.client.model.geom.ModelLayers; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.entity.LivingEntityRenderer; import net.minecraft.client.renderer.entity.RenderLayerParent; -import net.minecraft.util.Mth; +import net.minecraft.client.renderer.entity.state.PlayerRenderState; @Environment(EnvType.CLIENT) -public class Deadmau5EarsLayer extends RenderLayer> { - public Deadmau5EarsLayer(RenderLayerParent> renderer) { - super(renderer); +public class Deadmau5EarsLayer extends RenderLayer { + private final HumanoidModel model; + + public Deadmau5EarsLayer(RenderLayerParent renderLayerParent, EntityModelSet entityModelSet) { + super(renderLayerParent); + this.model = new PlayerEarsModel(entityModelSet.bakeLayer(ModelLayers.PLAYER_EARS)); } - public void render( - PoseStack poseStack, - MultiBufferSource buffer, - int packedLight, - AbstractClientPlayer livingEntity, - float limbSwing, - float limbSwingAmount, - float partialTicks, - float ageInTicks, - float netHeadYaw, - float headPitch - ) { - if ("deadmau5".equals(livingEntity.getName().getString()) && !livingEntity.isInvisible()) { - VertexConsumer vertexConsumer = buffer.getBuffer(RenderType.entitySolid(livingEntity.getSkin().texture())); - int i = LivingEntityRenderer.getOverlayCoords(livingEntity, 0.0F); - - for (int j = 0; j < 2; j++) { - float f = Mth.lerp(partialTicks, livingEntity.yRotO, livingEntity.getYRot()) - Mth.lerp(partialTicks, livingEntity.yBodyRotO, livingEntity.yBodyRot); - float g = Mth.lerp(partialTicks, livingEntity.xRotO, livingEntity.getXRot()); - poseStack.pushPose(); - poseStack.mulPose(Axis.YP.rotationDegrees(f)); - poseStack.mulPose(Axis.XP.rotationDegrees(g)); - poseStack.translate(0.375F * (j * 2 - 1), 0.0F, 0.0F); - poseStack.translate(0.0F, -0.375F, 0.0F); - poseStack.mulPose(Axis.XP.rotationDegrees(-g)); - poseStack.mulPose(Axis.YP.rotationDegrees(-f)); - float h = 1.3333334F; - poseStack.scale(1.3333334F, 1.3333334F, 1.3333334F); - this.getParentModel().renderEars(poseStack, vertexConsumer, packedLight, i); - poseStack.popPose(); - } + public void render(PoseStack poseStack, MultiBufferSource multiBufferSource, int i, PlayerRenderState playerRenderState, float f, float g) { + if ("deadmau5".equals(playerRenderState.name) && !playerRenderState.isInvisible) { + VertexConsumer vertexConsumer = multiBufferSource.getBuffer(RenderType.entitySolid(playerRenderState.skin.texture())); + int j = LivingEntityRenderer.getOverlayCoords(playerRenderState, 0.0F); + this.getParentModel().copyPropertiesTo(this.model); + this.model.setupAnim(playerRenderState); + this.model.renderToBuffer(poseStack, vertexConsumer, i, j); } } } diff --git a/net/minecraft/client/renderer/entity/layers/DolphinCarryingItemLayer.java b/net/minecraft/client/renderer/entity/layers/DolphinCarryingItemLayer.java index e2b9bcca..4404ec77 100644 --- a/net/minecraft/client/renderer/entity/layers/DolphinCarryingItemLayer.java +++ b/net/minecraft/client/renderer/entity/layers/DolphinCarryingItemLayer.java @@ -4,49 +4,41 @@ import com.mojang.blaze3d.vertex.PoseStack; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.model.DolphinModel; -import net.minecraft.client.renderer.ItemInHandRenderer; import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.entity.ItemRenderer; import net.minecraft.client.renderer.entity.RenderLayerParent; +import net.minecraft.client.renderer.entity.state.DolphinRenderState; +import net.minecraft.client.renderer.texture.OverlayTexture; +import net.minecraft.client.resources.model.BakedModel; import net.minecraft.util.Mth; -import net.minecraft.world.entity.HumanoidArm; -import net.minecraft.world.entity.animal.Dolphin; import net.minecraft.world.item.ItemDisplayContext; import net.minecraft.world.item.ItemStack; @Environment(EnvType.CLIENT) -public class DolphinCarryingItemLayer extends RenderLayer> { - private final ItemInHandRenderer itemInHandRenderer; +public class DolphinCarryingItemLayer extends RenderLayer { + private final ItemRenderer itemRenderer; - public DolphinCarryingItemLayer(RenderLayerParent> renderer, ItemInHandRenderer itemInHandRenderer) { - super(renderer); - this.itemInHandRenderer = itemInHandRenderer; + public DolphinCarryingItemLayer(RenderLayerParent renderLayerParent, ItemRenderer itemRenderer) { + super(renderLayerParent); + this.itemRenderer = itemRenderer; } - public void render( - PoseStack poseStack, - MultiBufferSource buffer, - int packedLight, - Dolphin livingEntity, - float limbSwing, - float limbSwingAmount, - float partialTicks, - float ageInTicks, - float netHeadYaw, - float headPitch - ) { - boolean bl = livingEntity.getMainArm() == HumanoidArm.RIGHT; - poseStack.pushPose(); - float f = 1.0F; - float g = -1.0F; - float h = Mth.abs(livingEntity.getXRot()) / 60.0F; - if (livingEntity.getXRot() < 0.0F) { - poseStack.translate(0.0F, 1.0F - h * 0.5F, -1.0F + h * 0.5F); - } else { - poseStack.translate(0.0F, 1.0F + h * 0.8F, -1.0F + h * 0.2F); - } + public void render(PoseStack poseStack, MultiBufferSource multiBufferSource, int i, DolphinRenderState dolphinRenderState, float f, float g) { + ItemStack itemStack = dolphinRenderState.getMainHandItem(); + BakedModel bakedModel = dolphinRenderState.getMainHandItemModel(); + if (bakedModel != null) { + poseStack.pushPose(); + float h = 1.0F; + float j = -1.0F; + float k = Mth.abs(dolphinRenderState.xRot) / 60.0F; + if (dolphinRenderState.xRot < 0.0F) { + poseStack.translate(0.0F, 1.0F - k * 0.5F, -1.0F + k * 0.5F); + } else { + poseStack.translate(0.0F, 1.0F + k * 0.8F, -1.0F + k * 0.2F); + } - ItemStack itemStack = bl ? livingEntity.getMainHandItem() : livingEntity.getOffhandItem(); - this.itemInHandRenderer.renderItem(livingEntity, itemStack, ItemDisplayContext.GROUND, false, poseStack, buffer, packedLight); - poseStack.popPose(); + this.itemRenderer.render(itemStack, ItemDisplayContext.GROUND, false, poseStack, multiBufferSource, i, OverlayTexture.NO_OVERLAY, bakedModel); + poseStack.popPose(); + } } } diff --git a/net/minecraft/client/renderer/entity/layers/DrownedOuterLayer.java b/net/minecraft/client/renderer/entity/layers/DrownedOuterLayer.java index 59c7011f..e6f065e1 100644 --- a/net/minecraft/client/renderer/entity/layers/DrownedOuterLayer.java +++ b/net/minecraft/client/renderer/entity/layers/DrownedOuterLayer.java @@ -8,46 +8,23 @@ import net.minecraft.client.model.geom.EntityModelSet; import net.minecraft.client.model.geom.ModelLayers; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.entity.RenderLayerParent; +import net.minecraft.client.renderer.entity.state.ZombieRenderState; import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.entity.monster.Drowned; @Environment(EnvType.CLIENT) -public class DrownedOuterLayer extends RenderLayer> { +public class DrownedOuterLayer extends RenderLayer { private static final ResourceLocation DROWNED_OUTER_LAYER_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/zombie/drowned_outer_layer.png"); - private final DrownedModel model; + private final DrownedModel model; + private final DrownedModel babyModel; - public DrownedOuterLayer(RenderLayerParent> renderer, EntityModelSet modelSet) { + public DrownedOuterLayer(RenderLayerParent renderer, EntityModelSet modelSet) { super(renderer); - this.model = new DrownedModel<>(modelSet.bakeLayer(ModelLayers.DROWNED_OUTER_LAYER)); + this.model = new DrownedModel(modelSet.bakeLayer(ModelLayers.DROWNED_OUTER_LAYER)); + this.babyModel = new DrownedModel(modelSet.bakeLayer(ModelLayers.DROWNED_BABY_OUTER_LAYER)); } - public void render( - PoseStack poseStack, - MultiBufferSource buffer, - int packedLight, - T livingEntity, - float limbSwing, - float limbSwingAmount, - float partialTicks, - float ageInTicks, - float netHeadYaw, - float headPitch - ) { - coloredCutoutModelCopyLayerRender( - this.getParentModel(), - this.model, - DROWNED_OUTER_LAYER_LOCATION, - poseStack, - buffer, - packedLight, - livingEntity, - limbSwing, - limbSwingAmount, - ageInTicks, - netHeadYaw, - headPitch, - partialTicks, - -1 - ); + public void render(PoseStack poseStack, MultiBufferSource multiBufferSource, int i, ZombieRenderState zombieRenderState, float f, float g) { + DrownedModel drownedModel = zombieRenderState.isBaby ? this.babyModel : this.model; + coloredCutoutModelCopyLayerRender(drownedModel, DROWNED_OUTER_LAYER_LOCATION, poseStack, multiBufferSource, i, zombieRenderState, -1); } } diff --git a/net/minecraft/client/renderer/entity/layers/ElytraLayer.java b/net/minecraft/client/renderer/entity/layers/ElytraLayer.java deleted file mode 100644 index 42fbeda4..00000000 --- a/net/minecraft/client/renderer/entity/layers/ElytraLayer.java +++ /dev/null @@ -1,72 +0,0 @@ -package net.minecraft.client.renderer.entity.layers; - -import com.mojang.blaze3d.vertex.PoseStack; -import com.mojang.blaze3d.vertex.VertexConsumer; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.client.model.ElytraModel; -import net.minecraft.client.model.EntityModel; -import net.minecraft.client.model.geom.EntityModelSet; -import net.minecraft.client.model.geom.ModelLayers; -import net.minecraft.client.player.AbstractClientPlayer; -import net.minecraft.client.renderer.MultiBufferSource; -import net.minecraft.client.renderer.RenderType; -import net.minecraft.client.renderer.entity.ItemRenderer; -import net.minecraft.client.renderer.entity.RenderLayerParent; -import net.minecraft.client.renderer.texture.OverlayTexture; -import net.minecraft.client.resources.PlayerSkin; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.entity.EquipmentSlot; -import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.entity.player.PlayerModelPart; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.Items; - -@Environment(EnvType.CLIENT) -public class ElytraLayer> extends RenderLayer { - private static final ResourceLocation WINGS_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/elytra.png"); - private final ElytraModel elytraModel; - - public ElytraLayer(RenderLayerParent renderer, EntityModelSet modelSet) { - super(renderer); - this.elytraModel = new ElytraModel<>(modelSet.bakeLayer(ModelLayers.ELYTRA)); - } - - public void render( - PoseStack poseStack, - MultiBufferSource buffer, - int packedLight, - T livingEntity, - float limbSwing, - float limbSwingAmount, - float partialTicks, - float ageInTicks, - float netHeadYaw, - float headPitch - ) { - ItemStack itemStack = livingEntity.getItemBySlot(EquipmentSlot.CHEST); - if (itemStack.is(Items.ELYTRA)) { - ResourceLocation resourceLocation; - if (livingEntity instanceof AbstractClientPlayer abstractClientPlayer) { - PlayerSkin playerSkin = abstractClientPlayer.getSkin(); - if (playerSkin.elytraTexture() != null) { - resourceLocation = playerSkin.elytraTexture(); - } else if (playerSkin.capeTexture() != null && abstractClientPlayer.isModelPartShown(PlayerModelPart.CAPE)) { - resourceLocation = playerSkin.capeTexture(); - } else { - resourceLocation = WINGS_LOCATION; - } - } else { - resourceLocation = WINGS_LOCATION; - } - - poseStack.pushPose(); - poseStack.translate(0.0F, 0.0F, 0.125F); - this.getParentModel().copyPropertiesTo(this.elytraModel); - this.elytraModel.setupAnim(livingEntity, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch); - VertexConsumer vertexConsumer = ItemRenderer.getArmorFoilBuffer(buffer, RenderType.armorCutoutNoCull(resourceLocation), itemStack.hasFoil()); - this.elytraModel.renderToBuffer(poseStack, vertexConsumer, packedLight, OverlayTexture.NO_OVERLAY); - poseStack.popPose(); - } - } -} diff --git a/net/minecraft/client/renderer/entity/layers/EnderEyesLayer.java b/net/minecraft/client/renderer/entity/layers/EnderEyesLayer.java index c6560b0b..60c9b84f 100644 --- a/net/minecraft/client/renderer/entity/layers/EnderEyesLayer.java +++ b/net/minecraft/client/renderer/entity/layers/EnderEyesLayer.java @@ -5,14 +5,14 @@ import net.fabricmc.api.Environment; import net.minecraft.client.model.EndermanModel; import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.entity.RenderLayerParent; +import net.minecraft.client.renderer.entity.state.EndermanRenderState; import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.entity.LivingEntity; @Environment(EnvType.CLIENT) -public class EnderEyesLayer extends EyesLayer> { +public class EnderEyesLayer extends EyesLayer> { private static final RenderType ENDERMAN_EYES = RenderType.eyes(ResourceLocation.withDefaultNamespace("textures/entity/enderman/enderman_eyes.png")); - public EnderEyesLayer(RenderLayerParent> renderLayerParent) { + public EnderEyesLayer(RenderLayerParent> renderLayerParent) { super(renderLayerParent); } diff --git a/net/minecraft/client/renderer/entity/layers/EnergySwirlLayer.java b/net/minecraft/client/renderer/entity/layers/EnergySwirlLayer.java index 56715a16..7b5ea18d 100644 --- a/net/minecraft/client/renderer/entity/layers/EnergySwirlLayer.java +++ b/net/minecraft/client/renderer/entity/layers/EnergySwirlLayer.java @@ -8,44 +8,32 @@ import net.minecraft.client.model.EntityModel; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.entity.RenderLayerParent; +import net.minecraft.client.renderer.entity.state.EntityRenderState; import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.entity.Entity; -import net.minecraft.world.entity.PowerableMob; @Environment(EnvType.CLIENT) -public abstract class EnergySwirlLayer> extends RenderLayer { - public EnergySwirlLayer(RenderLayerParent renderer) { +public abstract class EnergySwirlLayer> extends RenderLayer { + public EnergySwirlLayer(RenderLayerParent renderer) { super(renderer); } @Override - public void render( - PoseStack poseStack, - MultiBufferSource bufferSource, - int packedLight, - T livingEntity, - float limbSwing, - float limbSwingAmount, - float partialTick, - float ageInTicks, - float netHeadYaw, - float headPitch - ) { - if (livingEntity.isPowered()) { - float f = livingEntity.tickCount + partialTick; - EntityModel entityModel = this.model(); - entityModel.prepareMobModel(livingEntity, limbSwing, limbSwingAmount, partialTick); - this.getParentModel().copyPropertiesTo(entityModel); - VertexConsumer vertexConsumer = bufferSource.getBuffer(RenderType.energySwirl(this.getTextureLocation(), this.xOffset(f) % 1.0F, f * 0.01F % 1.0F)); - entityModel.setupAnim(livingEntity, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch); - entityModel.renderToBuffer(poseStack, vertexConsumer, packedLight, OverlayTexture.NO_OVERLAY, -8355712); + public void render(PoseStack poseStack, MultiBufferSource multiBufferSource, int i, S entityRenderState, float f, float g) { + if (this.isPowered(entityRenderState)) { + float h = entityRenderState.ageInTicks; + M entityModel = this.model(); + VertexConsumer vertexConsumer = multiBufferSource.getBuffer(RenderType.energySwirl(this.getTextureLocation(), this.xOffset(h) % 1.0F, h * 0.01F % 1.0F)); + entityModel.setupAnim(entityRenderState); + entityModel.renderToBuffer(poseStack, vertexConsumer, i, OverlayTexture.NO_OVERLAY, -8355712); } } + protected abstract boolean isPowered(S entityRenderState); + protected abstract float xOffset(float tickCount); protected abstract ResourceLocation getTextureLocation(); - protected abstract EntityModel model(); + protected abstract M model(); } diff --git a/net/minecraft/client/renderer/entity/layers/EquipmentLayerRenderer.java b/net/minecraft/client/renderer/entity/layers/EquipmentLayerRenderer.java new file mode 100644 index 00000000..c7559650 --- /dev/null +++ b/net/minecraft/client/renderer/entity/layers/EquipmentLayerRenderer.java @@ -0,0 +1,114 @@ +package net.minecraft.client.renderer.entity.layers; + +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; +import java.util.List; +import java.util.Optional; +import java.util.function.Function; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.Util; +import net.minecraft.client.model.Model; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.Sheets; +import net.minecraft.client.renderer.entity.ItemRenderer; +import net.minecraft.client.renderer.texture.OverlayTexture; +import net.minecraft.client.renderer.texture.TextureAtlas; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.resources.model.EquipmentModelSet; +import net.minecraft.core.component.DataComponents; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.tags.ItemTags; +import net.minecraft.util.ARGB; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.component.DyedItemColor; +import net.minecraft.world.item.equipment.EquipmentModel; +import net.minecraft.world.item.equipment.trim.ArmorTrim; +import org.jetbrains.annotations.Nullable; + +@Environment(EnvType.CLIENT) +public class EquipmentLayerRenderer { + private static final int NO_LAYER_COLOR = 0; + private final EquipmentModelSet equipmentModels; + private final Function layerTextureLookup; + private final Function trimSpriteLookup; + + public EquipmentLayerRenderer(EquipmentModelSet equipmentModelSet, TextureAtlas textureAtlas) { + this.equipmentModels = equipmentModelSet; + this.layerTextureLookup = Util.memoize( + (Function)(layerTextureKey -> layerTextureKey.layer.getTextureLocation(layerTextureKey.layerType)) + ); + this.trimSpriteLookup = Util.memoize((Function)(trimSpriteKey -> { + ResourceLocation resourceLocation = trimSpriteKey.trim.getTexture(trimSpriteKey.layerType, trimSpriteKey.equipmentModelId); + return textureAtlas.getSprite(resourceLocation); + })); + } + + public void renderLayers( + EquipmentModel.LayerType layerType, + ResourceLocation resourceLocation, + Model model, + ItemStack itemStack, + PoseStack poseStack, + MultiBufferSource multiBufferSource, + int i + ) { + this.renderLayers(layerType, resourceLocation, model, itemStack, poseStack, multiBufferSource, i, null); + } + + public void renderLayers( + EquipmentModel.LayerType layerType, + ResourceLocation resourceLocation, + Model model, + ItemStack itemStack, + PoseStack poseStack, + MultiBufferSource multiBufferSource, + int i, + @Nullable ResourceLocation resourceLocation2 + ) { + List list = this.equipmentModels.get(resourceLocation).getLayers(layerType); + if (!list.isEmpty()) { + int j = itemStack.is(ItemTags.DYEABLE) ? DyedItemColor.getOrDefault(itemStack, 0) : 0; + boolean bl = itemStack.hasFoil(); + + for (EquipmentModel.Layer layer : list) { + int k = getColorForLayer(layer, j); + if (k != 0) { + ResourceLocation resourceLocation3 = layer.usePlayerTexture() && resourceLocation2 != null + ? resourceLocation2 + : (ResourceLocation)this.layerTextureLookup.apply(new EquipmentLayerRenderer.LayerTextureKey(layerType, layer)); + VertexConsumer vertexConsumer = ItemRenderer.getArmorFoilBuffer(multiBufferSource, RenderType.armorCutoutNoCull(resourceLocation3), bl); + model.renderToBuffer(poseStack, vertexConsumer, i, OverlayTexture.NO_OVERLAY, k); + bl = false; + } + } + + ArmorTrim armorTrim = itemStack.get(DataComponents.TRIM); + if (armorTrim != null) { + TextureAtlasSprite textureAtlasSprite = (TextureAtlasSprite)this.trimSpriteLookup + .apply(new EquipmentLayerRenderer.TrimSpriteKey(armorTrim, layerType, resourceLocation)); + VertexConsumer vertexConsumer2 = textureAtlasSprite.wrap(multiBufferSource.getBuffer(Sheets.armorTrimsSheet(armorTrim.pattern().value().decal()))); + model.renderToBuffer(poseStack, vertexConsumer2, i, OverlayTexture.NO_OVERLAY); + } + } + } + + private static int getColorForLayer(EquipmentModel.Layer layer, int i) { + Optional optional = layer.dyeable(); + if (optional.isPresent()) { + int j = (Integer)((EquipmentModel.Dyeable)optional.get()).colorWhenUndyed().map(ARGB::opaque).orElse(0); + return i != 0 ? i : j; + } else { + return -1; + } + } + + @Environment(EnvType.CLIENT) + record LayerTextureKey(EquipmentModel.LayerType layerType, EquipmentModel.Layer layer) { + } + + @Environment(EnvType.CLIENT) + record TrimSpriteKey(ArmorTrim trim, EquipmentModel.LayerType layerType, ResourceLocation equipmentModelId) { + } +} diff --git a/net/minecraft/client/renderer/entity/layers/EyesLayer.java b/net/minecraft/client/renderer/entity/layers/EyesLayer.java index 74bf28a5..ed21707a 100644 --- a/net/minecraft/client/renderer/entity/layers/EyesLayer.java +++ b/net/minecraft/client/renderer/entity/layers/EyesLayer.java @@ -8,30 +8,19 @@ import net.minecraft.client.model.EntityModel; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.entity.RenderLayerParent; +import net.minecraft.client.renderer.entity.state.EntityRenderState; import net.minecraft.client.renderer.texture.OverlayTexture; -import net.minecraft.world.entity.Entity; @Environment(EnvType.CLIENT) -public abstract class EyesLayer> extends RenderLayer { - public EyesLayer(RenderLayerParent renderer) { +public abstract class EyesLayer> extends RenderLayer { + public EyesLayer(RenderLayerParent renderer) { super(renderer); } @Override - public void render( - PoseStack poseStack, - MultiBufferSource bufferSource, - int packedLight, - T livingEntity, - float limbSwing, - float limbSwingAmount, - float partialTick, - float ageInTicks, - float netHeadYaw, - float headPitch - ) { - VertexConsumer vertexConsumer = bufferSource.getBuffer(this.renderType()); - this.getParentModel().renderToBuffer(poseStack, vertexConsumer, 15728640, OverlayTexture.NO_OVERLAY); + public void render(PoseStack poseStack, MultiBufferSource multiBufferSource, int i, S entityRenderState, float f, float g) { + VertexConsumer vertexConsumer = multiBufferSource.getBuffer(this.renderType()); + this.getParentModel().renderToBuffer(poseStack, vertexConsumer, i, OverlayTexture.NO_OVERLAY); } public abstract RenderType renderType(); diff --git a/net/minecraft/client/renderer/entity/layers/FoxHeldItemLayer.java b/net/minecraft/client/renderer/entity/layers/FoxHeldItemLayer.java index d70aabb7..2da88d5b 100644 --- a/net/minecraft/client/renderer/entity/layers/FoxHeldItemLayer.java +++ b/net/minecraft/client/renderer/entity/layers/FoxHeldItemLayer.java @@ -5,68 +5,59 @@ import com.mojang.math.Axis; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.model.FoxModel; -import net.minecraft.client.renderer.ItemInHandRenderer; import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.entity.ItemRenderer; import net.minecraft.client.renderer.entity.RenderLayerParent; -import net.minecraft.world.entity.EquipmentSlot; -import net.minecraft.world.entity.animal.Fox; +import net.minecraft.client.renderer.entity.state.FoxRenderState; +import net.minecraft.client.renderer.texture.OverlayTexture; +import net.minecraft.client.resources.model.BakedModel; import net.minecraft.world.item.ItemDisplayContext; import net.minecraft.world.item.ItemStack; @Environment(EnvType.CLIENT) -public class FoxHeldItemLayer extends RenderLayer> { - private final ItemInHandRenderer itemInHandRenderer; +public class FoxHeldItemLayer extends RenderLayer { + private final ItemRenderer itemRenderer; - public FoxHeldItemLayer(RenderLayerParent> renderer, ItemInHandRenderer itemInHandRenderer) { - super(renderer); - this.itemInHandRenderer = itemInHandRenderer; + public FoxHeldItemLayer(RenderLayerParent renderLayerParent, ItemRenderer itemRenderer) { + super(renderLayerParent); + this.itemRenderer = itemRenderer; } - public void render( - PoseStack poseStack, - MultiBufferSource buffer, - int packedLight, - Fox livingEntity, - float limbSwing, - float limbSwingAmount, - float partialTicks, - float ageInTicks, - float netHeadYaw, - float headPitch - ) { - boolean bl = livingEntity.isSleeping(); - boolean bl2 = livingEntity.isBaby(); - poseStack.pushPose(); - if (bl2) { - float f = 0.75F; - poseStack.scale(0.75F, 0.75F, 0.75F); - poseStack.translate(0.0F, 0.5F, 0.209375F); - } - - poseStack.translate(this.getParentModel().head.x / 16.0F, this.getParentModel().head.y / 16.0F, this.getParentModel().head.z / 16.0F); - float f = livingEntity.getHeadRollAngle(partialTicks); - poseStack.mulPose(Axis.ZP.rotation(f)); - poseStack.mulPose(Axis.YP.rotationDegrees(netHeadYaw)); - poseStack.mulPose(Axis.XP.rotationDegrees(headPitch)); - if (livingEntity.isBaby()) { - if (bl) { - poseStack.translate(0.4F, 0.26F, 0.15F); - } else { - poseStack.translate(0.06F, 0.26F, -0.5F); + public void render(PoseStack poseStack, MultiBufferSource multiBufferSource, int i, FoxRenderState foxRenderState, float f, float g) { + BakedModel bakedModel = foxRenderState.getMainHandItemModel(); + ItemStack itemStack = foxRenderState.getMainHandItem(); + if (bakedModel != null && !itemStack.isEmpty()) { + boolean bl = foxRenderState.isSleeping; + boolean bl2 = foxRenderState.isBaby; + poseStack.pushPose(); + poseStack.translate(this.getParentModel().head.x / 16.0F, this.getParentModel().head.y / 16.0F, this.getParentModel().head.z / 16.0F); + if (bl2) { + float h = 0.75F; + poseStack.scale(0.75F, 0.75F, 0.75F); } - } else if (bl) { - poseStack.translate(0.46F, 0.26F, 0.22F); - } else { - poseStack.translate(0.06F, 0.27F, -0.5F); - } - poseStack.mulPose(Axis.XP.rotationDegrees(90.0F)); - if (bl) { - poseStack.mulPose(Axis.ZP.rotationDegrees(90.0F)); - } + poseStack.mulPose(Axis.ZP.rotation(foxRenderState.headRollAngle)); + poseStack.mulPose(Axis.YP.rotationDegrees(f)); + poseStack.mulPose(Axis.XP.rotationDegrees(g)); + if (foxRenderState.isBaby) { + if (bl) { + poseStack.translate(0.4F, 0.26F, 0.15F); + } else { + poseStack.translate(0.06F, 0.26F, -0.5F); + } + } else if (bl) { + poseStack.translate(0.46F, 0.26F, 0.22F); + } else { + poseStack.translate(0.06F, 0.27F, -0.5F); + } - ItemStack itemStack = livingEntity.getItemBySlot(EquipmentSlot.MAINHAND); - this.itemInHandRenderer.renderItem(livingEntity, itemStack, ItemDisplayContext.GROUND, false, poseStack, buffer, packedLight); - poseStack.popPose(); + poseStack.mulPose(Axis.XP.rotationDegrees(90.0F)); + if (bl) { + poseStack.mulPose(Axis.ZP.rotationDegrees(90.0F)); + } + + this.itemRenderer.render(itemStack, ItemDisplayContext.GROUND, false, poseStack, multiBufferSource, i, OverlayTexture.NO_OVERLAY, bakedModel); + poseStack.popPose(); + } } } diff --git a/net/minecraft/client/renderer/entity/layers/HorseArmorLayer.java b/net/minecraft/client/renderer/entity/layers/HorseArmorLayer.java index 544153f8..42412743 100644 --- a/net/minecraft/client/renderer/entity/layers/HorseArmorLayer.java +++ b/net/minecraft/client/renderer/entity/layers/HorseArmorLayer.java @@ -1,58 +1,43 @@ package net.minecraft.client.renderer.entity.layers; import com.mojang.blaze3d.vertex.PoseStack; -import com.mojang.blaze3d.vertex.VertexConsumer; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.model.HorseModel; import net.minecraft.client.model.geom.EntityModelSet; import net.minecraft.client.model.geom.ModelLayers; import net.minecraft.client.renderer.MultiBufferSource; -import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.entity.RenderLayerParent; -import net.minecraft.client.renderer.texture.OverlayTexture; -import net.minecraft.tags.ItemTags; -import net.minecraft.util.FastColor; -import net.minecraft.world.entity.animal.horse.Horse; -import net.minecraft.world.item.AnimalArmorItem; +import net.minecraft.client.renderer.entity.state.HorseRenderState; +import net.minecraft.core.component.DataComponents; +import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.component.DyedItemColor; +import net.minecraft.world.item.equipment.EquipmentModel; +import net.minecraft.world.item.equipment.Equippable; @Environment(EnvType.CLIENT) -public class HorseArmorLayer extends RenderLayer> { - private final HorseModel model; +public class HorseArmorLayer extends RenderLayer { + private final HorseModel adultModel; + private final HorseModel babyModel; + private final EquipmentLayerRenderer equipmentRenderer; - public HorseArmorLayer(RenderLayerParent> renderer, EntityModelSet modelSet) { - super(renderer); - this.model = new HorseModel<>(modelSet.bakeLayer(ModelLayers.HORSE_ARMOR)); + public HorseArmorLayer( + RenderLayerParent renderLayerParent, EntityModelSet entityModelSet, EquipmentLayerRenderer equipmentLayerRenderer + ) { + super(renderLayerParent); + this.equipmentRenderer = equipmentLayerRenderer; + this.adultModel = new HorseModel(entityModelSet.bakeLayer(ModelLayers.HORSE_ARMOR)); + this.babyModel = new HorseModel(entityModelSet.bakeLayer(ModelLayers.HORSE_BABY_ARMOR)); } - public void render( - PoseStack poseStack, - MultiBufferSource buffer, - int packedLight, - Horse livingEntity, - float limbSwing, - float limbSwingAmount, - float partialTicks, - float ageInTicks, - float netHeadYaw, - float headPitch - ) { - ItemStack itemStack = livingEntity.getBodyArmorItem(); - if (itemStack.getItem() instanceof AnimalArmorItem animalArmorItem && animalArmorItem.getBodyType() == AnimalArmorItem.BodyType.EQUESTRIAN) { - this.getParentModel().copyPropertiesTo(this.model); - this.model.prepareMobModel(livingEntity, limbSwing, limbSwingAmount, partialTicks); - this.model.setupAnim(livingEntity, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch); - int i; - if (itemStack.is(ItemTags.DYEABLE)) { - i = FastColor.ARGB32.opaque(DyedItemColor.getOrDefault(itemStack, -6265536)); - } else { - i = -1; - } - - VertexConsumer vertexConsumer = buffer.getBuffer(RenderType.entityCutoutNoCull(animalArmorItem.getTexture())); - this.model.renderToBuffer(poseStack, vertexConsumer, packedLight, OverlayTexture.NO_OVERLAY, i); + public void render(PoseStack poseStack, MultiBufferSource multiBufferSource, int i, HorseRenderState horseRenderState, float f, float g) { + ItemStack itemStack = horseRenderState.bodyArmorItem; + Equippable equippable = itemStack.get(DataComponents.EQUIPPABLE); + if (equippable != null && !equippable.model().isEmpty()) { + HorseModel horseModel = horseRenderState.isBaby ? this.babyModel : this.adultModel; + ResourceLocation resourceLocation = (ResourceLocation)equippable.model().get(); + horseModel.setupAnim(horseRenderState); + this.equipmentRenderer.renderLayers(EquipmentModel.LayerType.HORSE_BODY, resourceLocation, horseModel, itemStack, poseStack, multiBufferSource, i); } } } diff --git a/net/minecraft/client/renderer/entity/layers/HorseMarkingLayer.java b/net/minecraft/client/renderer/entity/layers/HorseMarkingLayer.java index 2bee5d8a..43910213 100644 --- a/net/minecraft/client/renderer/entity/layers/HorseMarkingLayer.java +++ b/net/minecraft/client/renderer/entity/layers/HorseMarkingLayer.java @@ -12,12 +12,12 @@ import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.entity.LivingEntityRenderer; import net.minecraft.client.renderer.entity.RenderLayerParent; +import net.minecraft.client.renderer.entity.state.HorseRenderState; import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.entity.animal.horse.Horse; import net.minecraft.world.entity.animal.horse.Markings; @Environment(EnvType.CLIENT) -public class HorseMarkingLayer extends RenderLayer> { +public class HorseMarkingLayer extends RenderLayer { private static final Map LOCATION_BY_MARKINGS = Util.make(Maps.newEnumMap(Markings.class), enumMap -> { enumMap.put(Markings.NONE, null); enumMap.put(Markings.WHITE, ResourceLocation.withDefaultNamespace("textures/entity/horse/horse_markings_white.png")); @@ -26,26 +26,15 @@ public class HorseMarkingLayer extends RenderLayer> { enumMap.put(Markings.BLACK_DOTS, ResourceLocation.withDefaultNamespace("textures/entity/horse/horse_markings_blackdots.png")); }); - public HorseMarkingLayer(RenderLayerParent> renderer) { + public HorseMarkingLayer(RenderLayerParent renderer) { super(renderer); } - public void render( - PoseStack poseStack, - MultiBufferSource buffer, - int packedLight, - Horse livingEntity, - float limbSwing, - float limbSwingAmount, - float partialTicks, - float ageInTicks, - float netHeadYaw, - float headPitch - ) { - ResourceLocation resourceLocation = (ResourceLocation)LOCATION_BY_MARKINGS.get(livingEntity.getMarkings()); - if (resourceLocation != null && !livingEntity.isInvisible()) { - VertexConsumer vertexConsumer = buffer.getBuffer(RenderType.entityTranslucent(resourceLocation)); - this.getParentModel().renderToBuffer(poseStack, vertexConsumer, packedLight, LivingEntityRenderer.getOverlayCoords(livingEntity, 0.0F)); + public void render(PoseStack poseStack, MultiBufferSource multiBufferSource, int i, HorseRenderState horseRenderState, float f, float g) { + ResourceLocation resourceLocation = (ResourceLocation)LOCATION_BY_MARKINGS.get(horseRenderState.markings); + if (resourceLocation != null && !horseRenderState.isInvisible) { + VertexConsumer vertexConsumer = multiBufferSource.getBuffer(RenderType.entityTranslucent(resourceLocation)); + this.getParentModel().renderToBuffer(poseStack, vertexConsumer, i, LivingEntityRenderer.getOverlayCoords(horseRenderState, 0.0F)); } } } diff --git a/net/minecraft/client/renderer/entity/layers/HumanoidArmorLayer.java b/net/minecraft/client/renderer/entity/layers/HumanoidArmorLayer.java index 877f193f..bfeb3fd5 100644 --- a/net/minecraft/client/renderer/entity/layers/HumanoidArmorLayer.java +++ b/net/minecraft/client/renderer/entity/layers/HumanoidArmorLayer.java @@ -1,89 +1,81 @@ package net.minecraft.client.renderer.entity.layers; -import com.google.common.collect.Maps; import com.mojang.blaze3d.vertex.PoseStack; -import com.mojang.blaze3d.vertex.VertexConsumer; -import java.util.Map; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.model.HumanoidModel; import net.minecraft.client.renderer.MultiBufferSource; -import net.minecraft.client.renderer.RenderType; -import net.minecraft.client.renderer.Sheets; import net.minecraft.client.renderer.entity.RenderLayerParent; -import net.minecraft.client.renderer.texture.OverlayTexture; -import net.minecraft.client.renderer.texture.TextureAtlas; -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.client.resources.model.ModelManager; -import net.minecraft.core.Holder; +import net.minecraft.client.renderer.entity.state.HumanoidRenderState; import net.minecraft.core.component.DataComponents; import net.minecraft.resources.ResourceLocation; -import net.minecraft.tags.ItemTags; -import net.minecraft.util.FastColor; import net.minecraft.world.entity.EquipmentSlot; -import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.item.ArmorItem; -import net.minecraft.world.item.ArmorMaterial; import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.armortrim.ArmorTrim; -import net.minecraft.world.item.component.DyedItemColor; +import net.minecraft.world.item.equipment.EquipmentModel; +import net.minecraft.world.item.equipment.Equippable; @Environment(EnvType.CLIENT) -public class HumanoidArmorLayer, A extends HumanoidModel> extends RenderLayer { - private static final Map ARMOR_LOCATION_CACHE = Maps.newHashMap(); +public class HumanoidArmorLayer, A extends HumanoidModel> extends RenderLayer { private final A innerModel; private final A outerModel; - private final TextureAtlas armorTrimAtlas; + private final A innerModelBaby; + private final A outerModelBaby; + private final EquipmentLayerRenderer equipmentRenderer; - public HumanoidArmorLayer(RenderLayerParent renderer, A innerModel, A outerModel, ModelManager modelManager) { - super(renderer); - this.innerModel = innerModel; - this.outerModel = outerModel; - this.armorTrimAtlas = modelManager.getAtlas(Sheets.ARMOR_TRIMS_SHEET); + public HumanoidArmorLayer(RenderLayerParent renderLayerParent, A humanoidModel, A humanoidModel2, EquipmentLayerRenderer equipmentLayerRenderer) { + this(renderLayerParent, humanoidModel, humanoidModel2, humanoidModel, humanoidModel2, equipmentLayerRenderer); } - public void render( - PoseStack poseStack, - MultiBufferSource buffer, - int packedLight, - T livingEntity, - float limbSwing, - float limbSwingAmount, - float partialTicks, - float ageInTicks, - float netHeadYaw, - float headPitch + public HumanoidArmorLayer( + RenderLayerParent renderLayerParent, + A humanoidModel, + A humanoidModel2, + A humanoidModel3, + A humanoidModel4, + EquipmentLayerRenderer equipmentLayerRenderer ) { - this.renderArmorPiece(poseStack, buffer, livingEntity, EquipmentSlot.CHEST, packedLight, this.getArmorModel(EquipmentSlot.CHEST)); - this.renderArmorPiece(poseStack, buffer, livingEntity, EquipmentSlot.LEGS, packedLight, this.getArmorModel(EquipmentSlot.LEGS)); - this.renderArmorPiece(poseStack, buffer, livingEntity, EquipmentSlot.FEET, packedLight, this.getArmorModel(EquipmentSlot.FEET)); - this.renderArmorPiece(poseStack, buffer, livingEntity, EquipmentSlot.HEAD, packedLight, this.getArmorModel(EquipmentSlot.HEAD)); + super(renderLayerParent); + this.innerModel = humanoidModel; + this.outerModel = humanoidModel2; + this.innerModelBaby = humanoidModel3; + this.outerModelBaby = humanoidModel4; + this.equipmentRenderer = equipmentLayerRenderer; } - private void renderArmorPiece(PoseStack poseStack, MultiBufferSource bufferSource, T livingEntity, EquipmentSlot slot, int packedLight, A model) { - ItemStack itemStack = livingEntity.getItemBySlot(slot); - if (itemStack.getItem() instanceof ArmorItem armorItem) { - if (armorItem.getEquipmentSlot() == slot) { - this.getParentModel().copyPropertiesTo(model); - this.setPartVisibility(model, slot); - boolean bl = this.usesInnerModel(slot); - ArmorMaterial armorMaterial = armorItem.getMaterial().value(); - int i = itemStack.is(ItemTags.DYEABLE) ? FastColor.ARGB32.opaque(DyedItemColor.getOrDefault(itemStack, -6265536)) : -1; + public static boolean shouldRender(ItemStack itemStack, EquipmentSlot equipmentSlot) { + Equippable equippable = itemStack.get(DataComponents.EQUIPPABLE); + return equippable != null && shouldRender(equippable, equipmentSlot); + } - for (ArmorMaterial.Layer layer : armorMaterial.layers()) { - int j = layer.dyeable() ? i : -1; - this.renderModel(poseStack, bufferSource, packedLight, model, j, layer.texture(bl)); - } + private static boolean shouldRender(Equippable equippable, EquipmentSlot equipmentSlot) { + return equippable.model().isPresent() && equippable.slot() == equipmentSlot; + } - ArmorTrim armorTrim = itemStack.get(DataComponents.TRIM); - if (armorTrim != null) { - this.renderTrim(armorItem.getMaterial(), poseStack, bufferSource, packedLight, armorTrim, model, bl); - } + public void render(PoseStack poseStack, MultiBufferSource multiBufferSource, int i, S humanoidRenderState, float f, float g) { + this.renderArmorPiece( + poseStack, multiBufferSource, humanoidRenderState.chestItem, EquipmentSlot.CHEST, i, this.getArmorModel(humanoidRenderState, EquipmentSlot.CHEST) + ); + this.renderArmorPiece( + poseStack, multiBufferSource, humanoidRenderState.legsItem, EquipmentSlot.LEGS, i, this.getArmorModel(humanoidRenderState, EquipmentSlot.LEGS) + ); + this.renderArmorPiece( + poseStack, multiBufferSource, humanoidRenderState.feetItem, EquipmentSlot.FEET, i, this.getArmorModel(humanoidRenderState, EquipmentSlot.FEET) + ); + this.renderArmorPiece( + poseStack, multiBufferSource, humanoidRenderState.headItem, EquipmentSlot.HEAD, i, this.getArmorModel(humanoidRenderState, EquipmentSlot.HEAD) + ); + } - if (itemStack.hasFoil()) { - this.renderGlint(poseStack, bufferSource, packedLight, model); - } - } + private void renderArmorPiece( + PoseStack poseStack, MultiBufferSource multiBufferSource, ItemStack itemStack, EquipmentSlot equipmentSlot, int i, A humanoidModel + ) { + Equippable equippable = itemStack.get(DataComponents.EQUIPPABLE); + if (equippable != null && shouldRender(equippable, equipmentSlot)) { + this.getParentModel().copyPropertiesTo(humanoidModel); + this.setPartVisibility(humanoidModel, equipmentSlot); + ResourceLocation resourceLocation = (ResourceLocation)equippable.model().orElseThrow(); + EquipmentModel.LayerType layerType = this.usesInnerModel(equipmentSlot) ? EquipmentModel.LayerType.HUMANOID_LEGGINGS : EquipmentModel.LayerType.HUMANOID; + this.equipmentRenderer.renderLayers(layerType, resourceLocation, humanoidModel, itemStack, poseStack, multiBufferSource, i); } } @@ -110,25 +102,12 @@ public class HumanoidArmorLayer armorMaterial, PoseStack poseStack, MultiBufferSource bufferSource, int packedLight, ArmorTrim trim, A model, boolean innerTexture - ) { - TextureAtlasSprite textureAtlasSprite = this.armorTrimAtlas.getSprite(innerTexture ? trim.innerTexture(armorMaterial) : trim.outerTexture(armorMaterial)); - VertexConsumer vertexConsumer = textureAtlasSprite.wrap(bufferSource.getBuffer(Sheets.armorTrimsSheet(trim.pattern().value().decal()))); - model.renderToBuffer(poseStack, vertexConsumer, packedLight, OverlayTexture.NO_OVERLAY); - } - - private void renderGlint(PoseStack poseStack, MultiBufferSource bufferSource, int packedLight, A model) { - model.renderToBuffer(poseStack, bufferSource.getBuffer(RenderType.armorEntityGlint()), packedLight, OverlayTexture.NO_OVERLAY); - } - - private A getArmorModel(EquipmentSlot slot) { - return this.usesInnerModel(slot) ? this.innerModel : this.outerModel; + private A getArmorModel(S humanoidRenderState, EquipmentSlot equipmentSlot) { + if (this.usesInnerModel(equipmentSlot)) { + return humanoidRenderState.isBaby ? this.innerModelBaby : this.innerModel; + } else { + return humanoidRenderState.isBaby ? this.outerModelBaby : this.outerModel; + } } private boolean usesInnerModel(EquipmentSlot slot) { diff --git a/net/minecraft/client/renderer/entity/layers/IronGolemCrackinessLayer.java b/net/minecraft/client/renderer/entity/layers/IronGolemCrackinessLayer.java index 5e8f8f2b..d800f6bc 100644 --- a/net/minecraft/client/renderer/entity/layers/IronGolemCrackinessLayer.java +++ b/net/minecraft/client/renderer/entity/layers/IronGolemCrackinessLayer.java @@ -8,42 +8,31 @@ import net.fabricmc.api.Environment; import net.minecraft.client.model.IronGolemModel; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.entity.RenderLayerParent; +import net.minecraft.client.renderer.entity.state.IronGolemRenderState; import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.entity.Crackiness; -import net.minecraft.world.entity.animal.IronGolem; +import net.minecraft.world.entity.Crackiness.Level; @Environment(EnvType.CLIENT) -public class IronGolemCrackinessLayer extends RenderLayer> { - private static final Map resourceLocations = ImmutableMap.of( - Crackiness.Level.LOW, +public class IronGolemCrackinessLayer extends RenderLayer { + private static final Map resourceLocations = ImmutableMap.of( + Level.LOW, ResourceLocation.withDefaultNamespace("textures/entity/iron_golem/iron_golem_crackiness_low.png"), - Crackiness.Level.MEDIUM, + Level.MEDIUM, ResourceLocation.withDefaultNamespace("textures/entity/iron_golem/iron_golem_crackiness_medium.png"), - Crackiness.Level.HIGH, + Level.HIGH, ResourceLocation.withDefaultNamespace("textures/entity/iron_golem/iron_golem_crackiness_high.png") ); - public IronGolemCrackinessLayer(RenderLayerParent> renderer) { + public IronGolemCrackinessLayer(RenderLayerParent renderer) { super(renderer); } - public void render( - PoseStack poseStack, - MultiBufferSource buffer, - int packedLight, - IronGolem livingEntity, - float limbSwing, - float limbSwingAmount, - float partialTicks, - float ageInTicks, - float netHeadYaw, - float headPitch - ) { - if (!livingEntity.isInvisible()) { - Crackiness.Level level = livingEntity.getCrackiness(); - if (level != Crackiness.Level.NONE) { + public void render(PoseStack poseStack, MultiBufferSource multiBufferSource, int i, IronGolemRenderState ironGolemRenderState, float f, float g) { + if (!ironGolemRenderState.isInvisible) { + Level level = ironGolemRenderState.crackiness; + if (level != Level.NONE) { ResourceLocation resourceLocation = (ResourceLocation)resourceLocations.get(level); - renderColoredCutoutModel(this.getParentModel(), resourceLocation, poseStack, buffer, packedLight, livingEntity, -1); + renderColoredCutoutModel(this.getParentModel(), resourceLocation, poseStack, multiBufferSource, i, ironGolemRenderState, -1); } } } diff --git a/net/minecraft/client/renderer/entity/layers/IronGolemFlowerLayer.java b/net/minecraft/client/renderer/entity/layers/IronGolemFlowerLayer.java index 972ecfcd..827c9238 100644 --- a/net/minecraft/client/renderer/entity/layers/IronGolemFlowerLayer.java +++ b/net/minecraft/client/renderer/entity/layers/IronGolemFlowerLayer.java @@ -9,42 +9,31 @@ import net.minecraft.client.model.geom.ModelPart; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.block.BlockRenderDispatcher; import net.minecraft.client.renderer.entity.RenderLayerParent; +import net.minecraft.client.renderer.entity.state.IronGolemRenderState; import net.minecraft.client.renderer.texture.OverlayTexture; -import net.minecraft.world.entity.animal.IronGolem; import net.minecraft.world.level.block.Blocks; @Environment(EnvType.CLIENT) -public class IronGolemFlowerLayer extends RenderLayer> { +public class IronGolemFlowerLayer extends RenderLayer { private final BlockRenderDispatcher blockRenderer; - public IronGolemFlowerLayer(RenderLayerParent> renderer, BlockRenderDispatcher blockRenderer) { + public IronGolemFlowerLayer(RenderLayerParent renderer, BlockRenderDispatcher blockRenderer) { super(renderer); this.blockRenderer = blockRenderer; } - public void render( - PoseStack poseStack, - MultiBufferSource buffer, - int packedLight, - IronGolem livingEntity, - float limbSwing, - float limbSwingAmount, - float partialTicks, - float ageInTicks, - float netHeadYaw, - float headPitch - ) { - if (livingEntity.getOfferFlowerTick() != 0) { + public void render(PoseStack poseStack, MultiBufferSource multiBufferSource, int i, IronGolemRenderState ironGolemRenderState, float f, float g) { + if (ironGolemRenderState.offerFlowerTick != 0) { poseStack.pushPose(); ModelPart modelPart = this.getParentModel().getFlowerHoldingArm(); modelPart.translateAndRotate(poseStack); poseStack.translate(-1.1875F, 1.0625F, -0.9375F); poseStack.translate(0.5F, 0.5F, 0.5F); - float f = 0.5F; + float h = 0.5F; poseStack.scale(0.5F, 0.5F, 0.5F); poseStack.mulPose(Axis.XP.rotationDegrees(-90.0F)); poseStack.translate(-0.5F, -0.5F, -0.5F); - this.blockRenderer.renderSingleBlock(Blocks.POPPY.defaultBlockState(), poseStack, buffer, packedLight, OverlayTexture.NO_OVERLAY); + this.blockRenderer.renderSingleBlock(Blocks.POPPY.defaultBlockState(), poseStack, multiBufferSource, i, OverlayTexture.NO_OVERLAY); poseStack.popPose(); } } diff --git a/net/minecraft/client/renderer/entity/layers/ItemInHandLayer.java b/net/minecraft/client/renderer/entity/layers/ItemInHandLayer.java index 3cd3bf64..5b2af91b 100644 --- a/net/minecraft/client/renderer/entity/layers/ItemInHandLayer.java +++ b/net/minecraft/client/renderer/entity/layers/ItemInHandLayer.java @@ -6,69 +6,67 @@ import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.model.ArmedModel; import net.minecraft.client.model.EntityModel; -import net.minecraft.client.renderer.ItemInHandRenderer; import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.entity.ItemRenderer; import net.minecraft.client.renderer.entity.RenderLayerParent; +import net.minecraft.client.renderer.entity.state.LivingEntityRenderState; +import net.minecraft.client.renderer.texture.OverlayTexture; +import net.minecraft.client.resources.model.BakedModel; import net.minecraft.world.entity.HumanoidArm; -import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.item.ItemDisplayContext; import net.minecraft.world.item.ItemStack; +import org.jetbrains.annotations.Nullable; @Environment(EnvType.CLIENT) -public class ItemInHandLayer & ArmedModel> extends RenderLayer { - private final ItemInHandRenderer itemInHandRenderer; +public class ItemInHandLayer & ArmedModel> extends RenderLayer { + private final ItemRenderer itemRenderer; - public ItemInHandLayer(RenderLayerParent renderer, ItemInHandRenderer itemInHandRenderer) { - super(renderer); - this.itemInHandRenderer = itemInHandRenderer; + public ItemInHandLayer(RenderLayerParent renderLayerParent, ItemRenderer itemRenderer) { + super(renderLayerParent); + this.itemRenderer = itemRenderer; } - public void render( - PoseStack poseStack, - MultiBufferSource buffer, - int packedLight, - T livingEntity, - float limbSwing, - float limbSwingAmount, - float partialTicks, - float ageInTicks, - float netHeadYaw, - float headPitch - ) { - boolean bl = livingEntity.getMainArm() == HumanoidArm.RIGHT; - ItemStack itemStack = bl ? livingEntity.getOffhandItem() : livingEntity.getMainHandItem(); - ItemStack itemStack2 = bl ? livingEntity.getMainHandItem() : livingEntity.getOffhandItem(); - if (!itemStack.isEmpty() || !itemStack2.isEmpty()) { - poseStack.pushPose(); - if (this.getParentModel().young) { - float f = 0.5F; - poseStack.translate(0.0F, 0.75F, 0.0F); - poseStack.scale(0.5F, 0.5F, 0.5F); - } - - this.renderArmWithItem(livingEntity, itemStack2, ItemDisplayContext.THIRD_PERSON_RIGHT_HAND, HumanoidArm.RIGHT, poseStack, buffer, packedLight); - this.renderArmWithItem(livingEntity, itemStack, ItemDisplayContext.THIRD_PERSON_LEFT_HAND, HumanoidArm.LEFT, poseStack, buffer, packedLight); - poseStack.popPose(); - } + public void render(PoseStack poseStack, MultiBufferSource multiBufferSource, int i, S livingEntityRenderState, float f, float g) { + this.renderArmWithItem( + livingEntityRenderState, + livingEntityRenderState.rightHandItemModel, + livingEntityRenderState.rightHandItem, + ItemDisplayContext.THIRD_PERSON_RIGHT_HAND, + HumanoidArm.RIGHT, + poseStack, + multiBufferSource, + i + ); + this.renderArmWithItem( + livingEntityRenderState, + livingEntityRenderState.leftHandItemModel, + livingEntityRenderState.leftHandItem, + ItemDisplayContext.THIRD_PERSON_LEFT_HAND, + HumanoidArm.LEFT, + poseStack, + multiBufferSource, + i + ); } protected void renderArmWithItem( - LivingEntity livingEntity, + S livingEntityRenderState, + @Nullable BakedModel bakedModel, ItemStack itemStack, - ItemDisplayContext displayContext, - HumanoidArm arm, + ItemDisplayContext itemDisplayContext, + HumanoidArm humanoidArm, PoseStack poseStack, - MultiBufferSource buffer, - int packedLight + MultiBufferSource multiBufferSource, + int i ) { - if (!itemStack.isEmpty()) { + if (bakedModel != null && !itemStack.isEmpty()) { poseStack.pushPose(); - this.getParentModel().translateToHand(arm, poseStack); + this.getParentModel().translateToHand(humanoidArm, poseStack); poseStack.mulPose(Axis.XP.rotationDegrees(-90.0F)); poseStack.mulPose(Axis.YP.rotationDegrees(180.0F)); - boolean bl = arm == HumanoidArm.LEFT; + boolean bl = humanoidArm == HumanoidArm.LEFT; poseStack.translate((bl ? -1 : 1) / 16.0F, 0.125F, -0.625F); - this.itemInHandRenderer.renderItem(livingEntity, itemStack, displayContext, bl, poseStack, buffer, packedLight); + this.itemRenderer.render(itemStack, itemDisplayContext, bl, poseStack, multiBufferSource, i, OverlayTexture.NO_OVERLAY, bakedModel); poseStack.popPose(); } } diff --git a/net/minecraft/client/renderer/entity/layers/LivingEntityEmissiveLayer.java b/net/minecraft/client/renderer/entity/layers/LivingEntityEmissiveLayer.java new file mode 100644 index 00000000..f909a22f --- /dev/null +++ b/net/minecraft/client/renderer/entity/layers/LivingEntityEmissiveLayer.java @@ -0,0 +1,77 @@ +package net.minecraft.client.renderer.entity.layers; + +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; +import java.util.List; +import java.util.function.Function; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.client.model.EntityModel; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.entity.LivingEntityRenderer; +import net.minecraft.client.renderer.entity.RenderLayerParent; +import net.minecraft.client.renderer.entity.state.LivingEntityRenderState; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.ARGB; +import net.minecraft.util.Mth; + +@Environment(EnvType.CLIENT) +public class LivingEntityEmissiveLayer> extends RenderLayer { + private final ResourceLocation texture; + private final LivingEntityEmissiveLayer.AlphaFunction alphaFunction; + private final LivingEntityEmissiveLayer.DrawSelector drawSelector; + private final Function bufferProvider; + + public LivingEntityEmissiveLayer( + RenderLayerParent renderLayerParent, + ResourceLocation resourceLocation, + LivingEntityEmissiveLayer.AlphaFunction alphaFunction, + LivingEntityEmissiveLayer.DrawSelector drawSelector, + Function function + ) { + super(renderLayerParent); + this.texture = resourceLocation; + this.alphaFunction = alphaFunction; + this.drawSelector = drawSelector; + this.bufferProvider = function; + } + + public void render(PoseStack poseStack, MultiBufferSource multiBufferSource, int i, S livingEntityRenderState, float f, float g) { + if (!livingEntityRenderState.isInvisible) { + if (this.onlyDrawSelectedParts(livingEntityRenderState)) { + VertexConsumer vertexConsumer = multiBufferSource.getBuffer((RenderType)this.bufferProvider.apply(this.texture)); + float h = this.alphaFunction.apply(livingEntityRenderState, livingEntityRenderState.ageInTicks); + int j = ARGB.color(Mth.floor(h * 255.0F), 255, 255, 255); + this.getParentModel().renderToBuffer(poseStack, vertexConsumer, i, LivingEntityRenderer.getOverlayCoords(livingEntityRenderState, 0.0F), j); + this.resetDrawForAllParts(); + } + } + } + + private boolean onlyDrawSelectedParts(S livingEntityRenderState) { + List list = this.drawSelector.getPartsToDraw(this.getParentModel(), livingEntityRenderState); + if (list.isEmpty()) { + return false; + } else { + this.getParentModel().allParts().forEach(modelPart -> modelPart.skipDraw = true); + list.forEach(modelPart -> modelPart.skipDraw = false); + return true; + } + } + + private void resetDrawForAllParts() { + this.getParentModel().allParts().forEach(modelPart -> modelPart.skipDraw = false); + } + + @Environment(EnvType.CLIENT) + public interface AlphaFunction { + float apply(S livingEntityRenderState, float f); + } + + @Environment(EnvType.CLIENT) + public interface DrawSelector> { + List getPartsToDraw(M entityModel, S livingEntityRenderState); + } +} diff --git a/net/minecraft/client/renderer/entity/layers/LlamaDecorLayer.java b/net/minecraft/client/renderer/entity/layers/LlamaDecorLayer.java index 23158b09..1a856edf 100644 --- a/net/minecraft/client/renderer/entity/layers/LlamaDecorLayer.java +++ b/net/minecraft/client/renderer/entity/layers/LlamaDecorLayer.java @@ -1,75 +1,51 @@ package net.minecraft.client.renderer.entity.layers; import com.mojang.blaze3d.vertex.PoseStack; -import com.mojang.blaze3d.vertex.VertexConsumer; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.model.LlamaModel; import net.minecraft.client.model.geom.EntityModelSet; import net.minecraft.client.model.geom.ModelLayers; import net.minecraft.client.renderer.MultiBufferSource; -import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.entity.RenderLayerParent; -import net.minecraft.client.renderer.texture.OverlayTexture; +import net.minecraft.client.renderer.entity.state.LlamaRenderState; +import net.minecraft.core.component.DataComponents; import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.entity.animal.horse.Llama; -import net.minecraft.world.item.DyeColor; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.equipment.EquipmentModel; +import net.minecraft.world.item.equipment.EquipmentModels; +import net.minecraft.world.item.equipment.Equippable; @Environment(EnvType.CLIENT) -public class LlamaDecorLayer extends RenderLayer> { - private static final ResourceLocation[] TEXTURE_LOCATION = new ResourceLocation[]{ - ResourceLocation.withDefaultNamespace("textures/entity/llama/decor/white.png"), - ResourceLocation.withDefaultNamespace("textures/entity/llama/decor/orange.png"), - ResourceLocation.withDefaultNamespace("textures/entity/llama/decor/magenta.png"), - ResourceLocation.withDefaultNamespace("textures/entity/llama/decor/light_blue.png"), - ResourceLocation.withDefaultNamespace("textures/entity/llama/decor/yellow.png"), - ResourceLocation.withDefaultNamespace("textures/entity/llama/decor/lime.png"), - ResourceLocation.withDefaultNamespace("textures/entity/llama/decor/pink.png"), - ResourceLocation.withDefaultNamespace("textures/entity/llama/decor/gray.png"), - ResourceLocation.withDefaultNamespace("textures/entity/llama/decor/light_gray.png"), - ResourceLocation.withDefaultNamespace("textures/entity/llama/decor/cyan.png"), - ResourceLocation.withDefaultNamespace("textures/entity/llama/decor/purple.png"), - ResourceLocation.withDefaultNamespace("textures/entity/llama/decor/blue.png"), - ResourceLocation.withDefaultNamespace("textures/entity/llama/decor/brown.png"), - ResourceLocation.withDefaultNamespace("textures/entity/llama/decor/green.png"), - ResourceLocation.withDefaultNamespace("textures/entity/llama/decor/red.png"), - ResourceLocation.withDefaultNamespace("textures/entity/llama/decor/black.png") - }; - private static final ResourceLocation TRADER_LLAMA = ResourceLocation.withDefaultNamespace("textures/entity/llama/decor/trader_llama.png"); - private final LlamaModel model; +public class LlamaDecorLayer extends RenderLayer { + private final LlamaModel adultModel; + private final LlamaModel babyModel; + private final EquipmentLayerRenderer equipmentRenderer; - public LlamaDecorLayer(RenderLayerParent> renderer, EntityModelSet modelSet) { - super(renderer); - this.model = new LlamaModel<>(modelSet.bakeLayer(ModelLayers.LLAMA_DECOR)); + public LlamaDecorLayer( + RenderLayerParent renderLayerParent, EntityModelSet entityModelSet, EquipmentLayerRenderer equipmentLayerRenderer + ) { + super(renderLayerParent); + this.equipmentRenderer = equipmentLayerRenderer; + this.adultModel = new LlamaModel(entityModelSet.bakeLayer(ModelLayers.LLAMA_DECOR)); + this.babyModel = new LlamaModel(entityModelSet.bakeLayer(ModelLayers.LLAMA_BABY_DECOR)); } - public void render( - PoseStack poseStack, - MultiBufferSource buffer, - int packedLight, - Llama livingEntity, - float limbSwing, - float limbSwingAmount, - float partialTicks, - float ageInTicks, - float netHeadYaw, - float headPitch - ) { - DyeColor dyeColor = livingEntity.getSwag(); - ResourceLocation resourceLocation; - if (dyeColor != null) { - resourceLocation = TEXTURE_LOCATION[dyeColor.getId()]; - } else { - if (!livingEntity.isTraderLlama()) { - return; - } - - resourceLocation = TRADER_LLAMA; + public void render(PoseStack poseStack, MultiBufferSource multiBufferSource, int i, LlamaRenderState llamaRenderState, float f, float g) { + ItemStack itemStack = llamaRenderState.bodyItem; + Equippable equippable = itemStack.get(DataComponents.EQUIPPABLE); + if (equippable != null && equippable.model().isPresent()) { + this.renderEquipment(poseStack, multiBufferSource, llamaRenderState, itemStack, (ResourceLocation)equippable.model().get(), i); + } else if (llamaRenderState.isTraderLlama) { + this.renderEquipment(poseStack, multiBufferSource, llamaRenderState, ItemStack.EMPTY, EquipmentModels.TRADER_LLAMA, i); } + } - this.getParentModel().copyPropertiesTo(this.model); - this.model.setupAnim(livingEntity, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch); - VertexConsumer vertexConsumer = buffer.getBuffer(RenderType.entityCutoutNoCull(resourceLocation)); - this.model.renderToBuffer(poseStack, vertexConsumer, packedLight, OverlayTexture.NO_OVERLAY); + private void renderEquipment( + PoseStack poseStack, MultiBufferSource multiBufferSource, LlamaRenderState llamaRenderState, ItemStack itemStack, ResourceLocation resourceLocation, int i + ) { + LlamaModel llamaModel = llamaRenderState.isBaby ? this.babyModel : this.adultModel; + llamaModel.setupAnim(llamaRenderState); + this.equipmentRenderer.renderLayers(EquipmentModel.LayerType.LLAMA_BODY, resourceLocation, llamaModel, itemStack, poseStack, multiBufferSource, i); } } diff --git a/net/minecraft/client/renderer/entity/layers/MushroomCowMushroomLayer.java b/net/minecraft/client/renderer/entity/layers/MushroomCowMushroomLayer.java index 41650965..14be15b4 100644 --- a/net/minecraft/client/renderer/entity/layers/MushroomCowMushroomLayer.java +++ b/net/minecraft/client/renderer/entity/layers/MushroomCowMushroomLayer.java @@ -4,52 +4,39 @@ import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.math.Axis; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; -import net.minecraft.client.Minecraft; import net.minecraft.client.model.CowModel; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.block.BlockRenderDispatcher; import net.minecraft.client.renderer.entity.LivingEntityRenderer; import net.minecraft.client.renderer.entity.RenderLayerParent; +import net.minecraft.client.renderer.entity.state.MushroomCowRenderState; import net.minecraft.client.renderer.texture.TextureAtlas; import net.minecraft.client.resources.model.BakedModel; -import net.minecraft.world.entity.animal.MushroomCow; import net.minecraft.world.level.block.state.BlockState; @Environment(EnvType.CLIENT) -public class MushroomCowMushroomLayer extends RenderLayer> { +public class MushroomCowMushroomLayer extends RenderLayer { private final BlockRenderDispatcher blockRenderer; - public MushroomCowMushroomLayer(RenderLayerParent> renderer, BlockRenderDispatcher blockRenderer) { + public MushroomCowMushroomLayer(RenderLayerParent renderer, BlockRenderDispatcher blockRenderer) { super(renderer); this.blockRenderer = blockRenderer; } - public void render( - PoseStack poseStack, - MultiBufferSource buffer, - int packedLight, - T livingEntity, - float limbSwing, - float limbSwingAmount, - float partialTicks, - float ageInTicks, - float netHeadYaw, - float headPitch - ) { - if (!livingEntity.isBaby()) { - Minecraft minecraft = Minecraft.getInstance(); - boolean bl = minecraft.shouldEntityAppearGlowing(livingEntity) && livingEntity.isInvisible(); - if (!livingEntity.isInvisible() || bl) { - BlockState blockState = livingEntity.getVariant().getBlockState(); - int i = LivingEntityRenderer.getOverlayCoords(livingEntity, 0.0F); + public void render(PoseStack poseStack, MultiBufferSource multiBufferSource, int i, MushroomCowRenderState mushroomCowRenderState, float f, float g) { + if (!mushroomCowRenderState.isBaby) { + boolean bl = mushroomCowRenderState.appearsGlowing && mushroomCowRenderState.isInvisible; + if (!mushroomCowRenderState.isInvisible || bl) { + BlockState blockState = mushroomCowRenderState.variant.getBlockState(); + int j = LivingEntityRenderer.getOverlayCoords(mushroomCowRenderState, 0.0F); BakedModel bakedModel = this.blockRenderer.getBlockModel(blockState); poseStack.pushPose(); poseStack.translate(0.2F, -0.35F, 0.5F); poseStack.mulPose(Axis.YP.rotationDegrees(-48.0F)); poseStack.scale(-1.0F, -1.0F, 1.0F); poseStack.translate(-0.5F, -0.5F, -0.5F); - this.renderMushroomBlock(poseStack, buffer, packedLight, bl, blockState, i, bakedModel); + this.renderMushroomBlock(poseStack, multiBufferSource, i, bl, blockState, j, bakedModel); poseStack.popPose(); poseStack.pushPose(); poseStack.translate(0.2F, -0.35F, 0.5F); @@ -58,7 +45,7 @@ public class MushroomCowMushroomLayer extends RenderLayer poseStack.mulPose(Axis.YP.rotationDegrees(-48.0F)); poseStack.scale(-1.0F, -1.0F, 1.0F); poseStack.translate(-0.5F, -0.5F, -0.5F); - this.renderMushroomBlock(poseStack, buffer, packedLight, bl, blockState, i, bakedModel); + this.renderMushroomBlock(poseStack, multiBufferSource, i, bl, blockState, j, bakedModel); poseStack.popPose(); poseStack.pushPose(); this.getParentModel().getHead().translateAndRotate(poseStack); @@ -66,7 +53,7 @@ public class MushroomCowMushroomLayer extends RenderLayer poseStack.mulPose(Axis.YP.rotationDegrees(-78.0F)); poseStack.scale(-1.0F, -1.0F, 1.0F); poseStack.translate(-0.5F, -0.5F, -0.5F); - this.renderMushroomBlock(poseStack, buffer, packedLight, bl, blockState, i, bakedModel); + this.renderMushroomBlock(poseStack, multiBufferSource, i, bl, blockState, j, bakedModel); poseStack.popPose(); } } diff --git a/net/minecraft/client/renderer/entity/layers/PandaHoldsItemLayer.java b/net/minecraft/client/renderer/entity/layers/PandaHoldsItemLayer.java index 5d5eadc9..16c5d47b 100644 --- a/net/minecraft/client/renderer/entity/layers/PandaHoldsItemLayer.java +++ b/net/minecraft/client/renderer/entity/layers/PandaHoldsItemLayer.java @@ -4,48 +4,39 @@ import com.mojang.blaze3d.vertex.PoseStack; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.model.PandaModel; -import net.minecraft.client.renderer.ItemInHandRenderer; import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.entity.ItemRenderer; import net.minecraft.client.renderer.entity.RenderLayerParent; +import net.minecraft.client.renderer.entity.state.PandaRenderState; +import net.minecraft.client.renderer.texture.OverlayTexture; +import net.minecraft.client.resources.model.BakedModel; import net.minecraft.util.Mth; -import net.minecraft.world.entity.EquipmentSlot; -import net.minecraft.world.entity.animal.Panda; import net.minecraft.world.item.ItemDisplayContext; import net.minecraft.world.item.ItemStack; @Environment(EnvType.CLIENT) -public class PandaHoldsItemLayer extends RenderLayer> { - private final ItemInHandRenderer itemInHandRenderer; +public class PandaHoldsItemLayer extends RenderLayer { + private final ItemRenderer itemRenderer; - public PandaHoldsItemLayer(RenderLayerParent> renderer, ItemInHandRenderer itemInHandRenderer) { - super(renderer); - this.itemInHandRenderer = itemInHandRenderer; + public PandaHoldsItemLayer(RenderLayerParent renderLayerParent, ItemRenderer itemRenderer) { + super(renderLayerParent); + this.itemRenderer = itemRenderer; } - public void render( - PoseStack poseStack, - MultiBufferSource buffer, - int packedLight, - Panda livingEntity, - float limbSwing, - float limbSwingAmount, - float partialTicks, - float ageInTicks, - float netHeadYaw, - float headPitch - ) { - ItemStack itemStack = livingEntity.getItemBySlot(EquipmentSlot.MAINHAND); - if (livingEntity.isSitting() && !livingEntity.isScared()) { - float f = -0.6F; - float g = 1.4F; - if (livingEntity.isEating()) { - f -= 0.2F * Mth.sin(ageInTicks * 0.6F) + 0.2F; - g -= 0.09F * Mth.sin(ageInTicks * 0.6F); + public void render(PoseStack poseStack, MultiBufferSource multiBufferSource, int i, PandaRenderState pandaRenderState, float f, float g) { + BakedModel bakedModel = pandaRenderState.getMainHandItemModel(); + if (bakedModel != null && pandaRenderState.isSitting && !pandaRenderState.isScared) { + float h = -0.6F; + float j = 1.4F; + if (pandaRenderState.isEating) { + h -= 0.2F * Mth.sin(pandaRenderState.ageInTicks * 0.6F) + 0.2F; + j -= 0.09F * Mth.sin(pandaRenderState.ageInTicks * 0.6F); } poseStack.pushPose(); - poseStack.translate(0.1F, g, f); - this.itemInHandRenderer.renderItem(livingEntity, itemStack, ItemDisplayContext.GROUND, false, poseStack, buffer, packedLight); + poseStack.translate(0.1F, j, h); + ItemStack itemStack = pandaRenderState.getMainHandItem(); + this.itemRenderer.render(itemStack, ItemDisplayContext.GROUND, false, poseStack, multiBufferSource, i, OverlayTexture.NO_OVERLAY, bakedModel); poseStack.popPose(); } } diff --git a/net/minecraft/client/renderer/entity/layers/ParrotOnShoulderLayer.java b/net/minecraft/client/renderer/entity/layers/ParrotOnShoulderLayer.java index 5e43766a..87cd7f72 100644 --- a/net/minecraft/client/renderer/entity/layers/ParrotOnShoulderLayer.java +++ b/net/minecraft/client/renderer/entity/layers/ParrotOnShoulderLayer.java @@ -1,7 +1,6 @@ package net.minecraft.client.renderer.entity.layers; import com.mojang.blaze3d.vertex.PoseStack; -import com.mojang.blaze3d.vertex.VertexConsumer; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.model.ParrotModel; @@ -11,63 +10,47 @@ import net.minecraft.client.model.geom.ModelLayers; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.entity.ParrotRenderer; import net.minecraft.client.renderer.entity.RenderLayerParent; +import net.minecraft.client.renderer.entity.state.ParrotRenderState; +import net.minecraft.client.renderer.entity.state.PlayerRenderState; import net.minecraft.client.renderer.texture.OverlayTexture; -import net.minecraft.nbt.CompoundTag; -import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.animal.Parrot; -import net.minecraft.world.entity.player.Player; @Environment(EnvType.CLIENT) -public class ParrotOnShoulderLayer extends RenderLayer> { +public class ParrotOnShoulderLayer extends RenderLayer { private final ParrotModel model; + private final ParrotRenderState parrotState = new ParrotRenderState(); - public ParrotOnShoulderLayer(RenderLayerParent> renderer, EntityModelSet modelSet) { + public ParrotOnShoulderLayer(RenderLayerParent renderer, EntityModelSet modelSet) { super(renderer); this.model = new ParrotModel(modelSet.bakeLayer(ModelLayers.PARROT)); + this.parrotState.pose = ParrotModel.Pose.ON_SHOULDER; } - public void render( - PoseStack poseStack, - MultiBufferSource buffer, - int packedLight, - T livingEntity, - float limbSwing, - float limbSwingAmount, - float partialTicks, - float ageInTicks, - float netHeadYaw, - float headPitch - ) { - this.render(poseStack, buffer, packedLight, livingEntity, limbSwing, limbSwingAmount, netHeadYaw, headPitch, true); - this.render(poseStack, buffer, packedLight, livingEntity, limbSwing, limbSwingAmount, netHeadYaw, headPitch, false); + public void render(PoseStack poseStack, MultiBufferSource multiBufferSource, int i, PlayerRenderState playerRenderState, float f, float g) { + Parrot.Variant variant = playerRenderState.parrotOnLeftShoulder; + if (variant != null) { + this.renderOnShoulder(poseStack, multiBufferSource, i, playerRenderState, variant, f, g, true); + } + + Parrot.Variant variant2 = playerRenderState.parrotOnRightShoulder; + if (variant2 != null) { + this.renderOnShoulder(poseStack, multiBufferSource, i, playerRenderState, variant2, f, g, false); + } } - private void render( - PoseStack poseStack, - MultiBufferSource buffer, - int packedLight, - T livingEntity, - float limbSwing, - float limbSwingAmount, - float netHeadYaw, - float headPitch, - boolean leftShoulder + private void renderOnShoulder( + PoseStack poseStack, MultiBufferSource multiBufferSource, int i, PlayerRenderState playerRenderState, Parrot.Variant variant, float f, float g, boolean bl ) { - CompoundTag compoundTag = leftShoulder ? livingEntity.getShoulderEntityLeft() : livingEntity.getShoulderEntityRight(); - EntityType.byString(compoundTag.getString("id")) - .filter(entityType -> entityType == EntityType.PARROT) - .ifPresent( - entityType -> { - poseStack.pushPose(); - poseStack.translate(leftShoulder ? 0.4F : -0.4F, livingEntity.isCrouching() ? -1.3F : -1.5F, 0.0F); - Parrot.Variant variant = Parrot.Variant.byId(compoundTag.getInt("Variant")); - VertexConsumer vertexConsumer = buffer.getBuffer(this.model.renderType(ParrotRenderer.getVariantTexture(variant))); - this.model - .renderOnShoulder( - poseStack, vertexConsumer, packedLight, OverlayTexture.NO_OVERLAY, limbSwing, limbSwingAmount, netHeadYaw, headPitch, livingEntity.tickCount - ); - poseStack.popPose(); - } - ); + poseStack.pushPose(); + poseStack.translate(bl ? 0.4F : -0.4F, playerRenderState.isCrouching ? -1.3F : -1.5F, 0.0F); + this.parrotState.ageInTicks = playerRenderState.ageInTicks; + this.parrotState.walkAnimationPos = playerRenderState.walkAnimationPos; + this.parrotState.walkAnimationSpeed = playerRenderState.walkAnimationSpeed; + this.parrotState.yRot = f; + this.parrotState.xRot = g; + this.model.setupAnim(this.parrotState); + this.model + .renderToBuffer(poseStack, multiBufferSource.getBuffer(this.model.renderType(ParrotRenderer.getVariantTexture(variant))), i, OverlayTexture.NO_OVERLAY); + poseStack.popPose(); } } diff --git a/net/minecraft/client/renderer/entity/layers/PhantomEyesLayer.java b/net/minecraft/client/renderer/entity/layers/PhantomEyesLayer.java index 6b301ebf..9449f3d5 100644 --- a/net/minecraft/client/renderer/entity/layers/PhantomEyesLayer.java +++ b/net/minecraft/client/renderer/entity/layers/PhantomEyesLayer.java @@ -5,14 +5,14 @@ import net.fabricmc.api.Environment; import net.minecraft.client.model.PhantomModel; import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.entity.RenderLayerParent; +import net.minecraft.client.renderer.entity.state.PhantomRenderState; import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.entity.monster.Phantom; @Environment(EnvType.CLIENT) -public class PhantomEyesLayer extends EyesLayer> { +public class PhantomEyesLayer extends EyesLayer { private static final RenderType PHANTOM_EYES = RenderType.eyes(ResourceLocation.withDefaultNamespace("textures/entity/phantom_eyes.png")); - public PhantomEyesLayer(RenderLayerParent> renderLayerParent) { + public PhantomEyesLayer(RenderLayerParent renderLayerParent) { super(renderLayerParent); } diff --git a/net/minecraft/client/renderer/entity/layers/PlayerItemInHandLayer.java b/net/minecraft/client/renderer/entity/layers/PlayerItemInHandLayer.java index c660428a..b36f2d75 100644 --- a/net/minecraft/client/renderer/entity/layers/PlayerItemInHandLayer.java +++ b/net/minecraft/client/renderer/entity/layers/PlayerItemInHandLayer.java @@ -7,56 +7,68 @@ import net.minecraft.client.model.ArmedModel; import net.minecraft.client.model.EntityModel; import net.minecraft.client.model.HeadedModel; import net.minecraft.client.model.geom.ModelPart; -import net.minecraft.client.renderer.ItemInHandRenderer; import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.entity.ItemRenderer; import net.minecraft.client.renderer.entity.RenderLayerParent; +import net.minecraft.client.renderer.entity.state.PlayerRenderState; +import net.minecraft.client.renderer.texture.OverlayTexture; +import net.minecraft.client.resources.model.BakedModel; import net.minecraft.util.Mth; +import net.minecraft.world.InteractionHand; import net.minecraft.world.entity.HumanoidArm; -import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemDisplayContext; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; +import org.jetbrains.annotations.Nullable; @Environment(EnvType.CLIENT) -public class PlayerItemInHandLayer & ArmedModel & HeadedModel> extends ItemInHandLayer { - private final ItemInHandRenderer itemInHandRenderer; +public class PlayerItemInHandLayer & ArmedModel & HeadedModel> extends ItemInHandLayer { + private final ItemRenderer itemRenderer; private static final float X_ROT_MIN = (float) (-Math.PI / 6); private static final float X_ROT_MAX = (float) (Math.PI / 2); - public PlayerItemInHandLayer(RenderLayerParent renderer, ItemInHandRenderer itemInHandRenderer) { - super(renderer, itemInHandRenderer); - this.itemInHandRenderer = itemInHandRenderer; + public PlayerItemInHandLayer(RenderLayerParent renderLayerParent, ItemRenderer itemRenderer) { + super(renderLayerParent, itemRenderer); + this.itemRenderer = itemRenderer; } - @Override protected void renderArmWithItem( - LivingEntity livingEntity, + S playerRenderState, + @Nullable BakedModel bakedModel, ItemStack itemStack, - ItemDisplayContext displayContext, - HumanoidArm arm, + ItemDisplayContext itemDisplayContext, + HumanoidArm humanoidArm, PoseStack poseStack, - MultiBufferSource buffer, - int packedLight + MultiBufferSource multiBufferSource, + int i ) { - if (itemStack.is(Items.SPYGLASS) && livingEntity.getUseItem() == itemStack && livingEntity.swingTime == 0) { - this.renderArmWithSpyglass(livingEntity, itemStack, arm, poseStack, buffer, packedLight); - } else { - super.renderArmWithItem(livingEntity, itemStack, displayContext, arm, poseStack, buffer, packedLight); + if (bakedModel != null) { + InteractionHand interactionHand = humanoidArm == playerRenderState.mainArm ? InteractionHand.MAIN_HAND : InteractionHand.OFF_HAND; + if (playerRenderState.isUsingItem + && playerRenderState.useItemHand == interactionHand + && playerRenderState.attackTime < 1.0E-5F + && itemStack.is(Items.SPYGLASS)) { + this.renderArmWithSpyglass(bakedModel, itemStack, humanoidArm, poseStack, multiBufferSource, i); + } else { + super.renderArmWithItem(playerRenderState, bakedModel, itemStack, itemDisplayContext, humanoidArm, poseStack, multiBufferSource, i); + } } } - private void renderArmWithSpyglass(LivingEntity entity, ItemStack stack, HumanoidArm arm, PoseStack poseStack, MultiBufferSource buffer, int combinedLight) { + private void renderArmWithSpyglass( + BakedModel bakedModel, ItemStack itemStack, HumanoidArm humanoidArm, PoseStack poseStack, MultiBufferSource multiBufferSource, int i + ) { poseStack.pushPose(); + this.getParentModel().root().translateAndRotate(poseStack); ModelPart modelPart = this.getParentModel().getHead(); float f = modelPart.xRot; modelPart.xRot = Mth.clamp(modelPart.xRot, (float) (-Math.PI / 6), (float) (Math.PI / 2)); modelPart.translateAndRotate(poseStack); modelPart.xRot = f; - CustomHeadLayer.translateToHead(poseStack, false); - boolean bl = arm == HumanoidArm.LEFT; + CustomHeadLayer.translateToHead(poseStack, CustomHeadLayer.Transforms.DEFAULT); + boolean bl = humanoidArm == HumanoidArm.LEFT; poseStack.translate((bl ? -2.5F : 2.5F) / 16.0F, -0.0625F, 0.0F); - this.itemInHandRenderer.renderItem(entity, stack, ItemDisplayContext.HEAD, false, poseStack, buffer, combinedLight); + this.itemRenderer.render(itemStack, ItemDisplayContext.HEAD, false, poseStack, multiBufferSource, i, OverlayTexture.NO_OVERLAY, bakedModel); poseStack.popPose(); } } diff --git a/net/minecraft/client/renderer/entity/layers/RenderLayer.java b/net/minecraft/client/renderer/entity/layers/RenderLayer.java index 6f5a6130..d16f1f5d 100644 --- a/net/minecraft/client/renderer/entity/layers/RenderLayer.java +++ b/net/minecraft/client/renderer/entity/layers/RenderLayer.java @@ -9,67 +9,49 @@ import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.entity.LivingEntityRenderer; import net.minecraft.client.renderer.entity.RenderLayerParent; +import net.minecraft.client.renderer.entity.state.EntityRenderState; +import net.minecraft.client.renderer.entity.state.LivingEntityRenderState; import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.entity.Entity; -import net.minecraft.world.entity.LivingEntity; @Environment(EnvType.CLIENT) -public abstract class RenderLayer> { - private final RenderLayerParent renderer; +public abstract class RenderLayer> { + private final RenderLayerParent renderer; - public RenderLayer(RenderLayerParent renderer) { + public RenderLayer(RenderLayerParent renderer) { this.renderer = renderer; } - protected static void coloredCutoutModelCopyLayerRender( - EntityModel modelParent, - EntityModel model, - ResourceLocation textureLocation, + protected static void coloredCutoutModelCopyLayerRender( + EntityModel entityModel, + ResourceLocation resourceLocation, PoseStack poseStack, - MultiBufferSource buffer, - int packedLight, - T entity, - float limbSwing, - float limbSwingAmount, - float ageInTicks, - float netHeadYaw, - float headPitch, - float partialTick, - int color + MultiBufferSource multiBufferSource, + int i, + S livingEntityRenderState, + int j ) { - if (!entity.isInvisible()) { - modelParent.copyPropertiesTo(model); - model.prepareMobModel(entity, limbSwing, limbSwingAmount, partialTick); - model.setupAnim(entity, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch); - renderColoredCutoutModel(model, textureLocation, poseStack, buffer, packedLight, entity, color); + if (!livingEntityRenderState.isInvisible) { + entityModel.setupAnim(livingEntityRenderState); + renderColoredCutoutModel(entityModel, resourceLocation, poseStack, multiBufferSource, i, livingEntityRenderState, j); } } - protected static void renderColoredCutoutModel( - EntityModel model, ResourceLocation textureLocation, PoseStack poseStack, MultiBufferSource buffer, int packedLight, T entity, int color + protected static void renderColoredCutoutModel( + EntityModel entityModel, + ResourceLocation resourceLocation, + PoseStack poseStack, + MultiBufferSource multiBufferSource, + int i, + LivingEntityRenderState livingEntityRenderState, + int j ) { - VertexConsumer vertexConsumer = buffer.getBuffer(RenderType.entityCutoutNoCull(textureLocation)); - model.renderToBuffer(poseStack, vertexConsumer, packedLight, LivingEntityRenderer.getOverlayCoords(entity, 0.0F), color); + VertexConsumer vertexConsumer = multiBufferSource.getBuffer(RenderType.entityCutoutNoCull(resourceLocation)); + entityModel.renderToBuffer(poseStack, vertexConsumer, i, LivingEntityRenderer.getOverlayCoords(livingEntityRenderState, 0.0F), j); } public M getParentModel() { return this.renderer.getModel(); } - protected ResourceLocation getTextureLocation(T entity) { - return this.renderer.getTextureLocation(entity); - } - - public abstract void render( - PoseStack poseStack, - MultiBufferSource bufferSource, - int packedLight, - T livingEntity, - float limbSwing, - float limbSwingAmount, - float partialTick, - float ageInTicks, - float netHeadYaw, - float headPitch - ); + public abstract void render(PoseStack poseStack, MultiBufferSource multiBufferSource, int i, S entityRenderState, float f, float g); } diff --git a/net/minecraft/client/renderer/entity/layers/SaddleLayer.java b/net/minecraft/client/renderer/entity/layers/SaddleLayer.java index 5659d687..b320f866 100644 --- a/net/minecraft/client/renderer/entity/layers/SaddleLayer.java +++ b/net/minecraft/client/renderer/entity/layers/SaddleLayer.java @@ -8,41 +8,34 @@ import net.minecraft.client.model.EntityModel; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.entity.RenderLayerParent; +import net.minecraft.client.renderer.entity.state.LivingEntityRenderState; +import net.minecraft.client.renderer.entity.state.SaddleableRenderState; import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.entity.Entity; -import net.minecraft.world.entity.Saddleable; @Environment(EnvType.CLIENT) -public class SaddleLayer> extends RenderLayer { +public class SaddleLayer> extends RenderLayer { private final ResourceLocation textureLocation; - private final M model; + private final M adultModel; + private final M babyModel; - public SaddleLayer(RenderLayerParent renderer, M model, ResourceLocation textureLocation) { - super(renderer); - this.model = model; - this.textureLocation = textureLocation; + public SaddleLayer(RenderLayerParent renderLayerParent, M entityModel, M entityModel2, ResourceLocation resourceLocation) { + super(renderLayerParent); + this.adultModel = entityModel; + this.babyModel = entityModel2; + this.textureLocation = resourceLocation; } - @Override - public void render( - PoseStack poseStack, - MultiBufferSource bufferSource, - int packedLight, - T livingEntity, - float limbSwing, - float limbSwingAmount, - float partialTick, - float ageInTicks, - float netHeadYaw, - float headPitch - ) { - if (livingEntity.isSaddled()) { - this.getParentModel().copyPropertiesTo(this.model); - this.model.prepareMobModel(livingEntity, limbSwing, limbSwingAmount, partialTick); - this.model.setupAnim(livingEntity, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch); - VertexConsumer vertexConsumer = bufferSource.getBuffer(RenderType.entityCutoutNoCull(this.textureLocation)); - this.model.renderToBuffer(poseStack, vertexConsumer, packedLight, OverlayTexture.NO_OVERLAY); + public SaddleLayer(RenderLayerParent renderer, M model, ResourceLocation textureLocation) { + this(renderer, model, model, textureLocation); + } + + public void render(PoseStack poseStack, MultiBufferSource multiBufferSource, int i, S livingEntityRenderState, float f, float g) { + if (livingEntityRenderState.isSaddled()) { + M entityModel = livingEntityRenderState.isBaby ? this.babyModel : this.adultModel; + entityModel.setupAnim(livingEntityRenderState); + VertexConsumer vertexConsumer = multiBufferSource.getBuffer(RenderType.entityCutoutNoCull(this.textureLocation)); + entityModel.renderToBuffer(poseStack, vertexConsumer, i, OverlayTexture.NO_OVERLAY); } } } diff --git a/net/minecraft/client/renderer/entity/layers/SheepFurLayer.java b/net/minecraft/client/renderer/entity/layers/SheepFurLayer.java deleted file mode 100644 index 67808341..00000000 --- a/net/minecraft/client/renderer/entity/layers/SheepFurLayer.java +++ /dev/null @@ -1,89 +0,0 @@ -package net.minecraft.client.renderer.entity.layers; - -import com.mojang.blaze3d.vertex.PoseStack; -import com.mojang.blaze3d.vertex.VertexConsumer; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.client.Minecraft; -import net.minecraft.client.model.SheepFurModel; -import net.minecraft.client.model.SheepModel; -import net.minecraft.client.model.geom.EntityModelSet; -import net.minecraft.client.model.geom.ModelLayers; -import net.minecraft.client.renderer.MultiBufferSource; -import net.minecraft.client.renderer.RenderType; -import net.minecraft.client.renderer.entity.LivingEntityRenderer; -import net.minecraft.client.renderer.entity.RenderLayerParent; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.util.FastColor; -import net.minecraft.world.entity.animal.Sheep; -import net.minecraft.world.item.DyeColor; - -@Environment(EnvType.CLIENT) -public class SheepFurLayer extends RenderLayer> { - private static final ResourceLocation SHEEP_FUR_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/sheep/sheep_fur.png"); - private final SheepFurModel model; - - public SheepFurLayer(RenderLayerParent> renderer, EntityModelSet modelSet) { - super(renderer); - this.model = new SheepFurModel<>(modelSet.bakeLayer(ModelLayers.SHEEP_FUR)); - } - - public void render( - PoseStack poseStack, - MultiBufferSource buffer, - int packedLight, - Sheep livingEntity, - float limbSwing, - float limbSwingAmount, - float partialTicks, - float ageInTicks, - float netHeadYaw, - float headPitch - ) { - if (!livingEntity.isSheared()) { - if (livingEntity.isInvisible()) { - Minecraft minecraft = Minecraft.getInstance(); - boolean bl = minecraft.shouldEntityAppearGlowing(livingEntity); - if (bl) { - this.getParentModel().copyPropertiesTo(this.model); - this.model.prepareMobModel(livingEntity, limbSwing, limbSwingAmount, partialTicks); - this.model.setupAnim(livingEntity, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch); - VertexConsumer vertexConsumer = buffer.getBuffer(RenderType.outline(SHEEP_FUR_LOCATION)); - this.model.renderToBuffer(poseStack, vertexConsumer, packedLight, LivingEntityRenderer.getOverlayCoords(livingEntity, 0.0F), -16777216); - } - } else { - int p; - if (livingEntity.hasCustomName() && "jeb_".equals(livingEntity.getName().getString())) { - int i = 25; - int j = livingEntity.tickCount / 25 + livingEntity.getId(); - int k = DyeColor.values().length; - int l = j % k; - int m = (j + 1) % k; - float f = (livingEntity.tickCount % 25 + partialTicks) / 25.0F; - int n = Sheep.getColor(DyeColor.byId(l)); - int o = Sheep.getColor(DyeColor.byId(m)); - p = FastColor.ARGB32.lerp(f, n, o); - } else { - p = Sheep.getColor(livingEntity.getColor()); - } - - coloredCutoutModelCopyLayerRender( - this.getParentModel(), - this.model, - SHEEP_FUR_LOCATION, - poseStack, - buffer, - packedLight, - livingEntity, - limbSwing, - limbSwingAmount, - ageInTicks, - netHeadYaw, - headPitch, - partialTicks, - p - ); - } - } - } -} diff --git a/net/minecraft/client/renderer/entity/layers/SheepWoolLayer.java b/net/minecraft/client/renderer/entity/layers/SheepWoolLayer.java new file mode 100644 index 00000000..cd9b7dd8 --- /dev/null +++ b/net/minecraft/client/renderer/entity/layers/SheepWoolLayer.java @@ -0,0 +1,65 @@ +package net.minecraft.client.renderer.entity.layers; + +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.client.model.EntityModel; +import net.minecraft.client.model.SheepFurModel; +import net.minecraft.client.model.SheepModel; +import net.minecraft.client.model.geom.EntityModelSet; +import net.minecraft.client.model.geom.ModelLayers; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.entity.LivingEntityRenderer; +import net.minecraft.client.renderer.entity.RenderLayerParent; +import net.minecraft.client.renderer.entity.state.SheepRenderState; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.ARGB; +import net.minecraft.util.Mth; +import net.minecraft.world.entity.animal.Sheep; +import net.minecraft.world.item.DyeColor; + +@Environment(EnvType.CLIENT) +public class SheepWoolLayer extends RenderLayer { + private static final ResourceLocation SHEEP_FUR_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/sheep/sheep_fur.png"); + private final EntityModel adultModel; + private final EntityModel babyModel; + + public SheepWoolLayer(RenderLayerParent renderLayerParent, EntityModelSet entityModelSet) { + super(renderLayerParent); + this.adultModel = new SheepFurModel(entityModelSet.bakeLayer(ModelLayers.SHEEP_WOOL)); + this.babyModel = new SheepFurModel(entityModelSet.bakeLayer(ModelLayers.SHEEP_BABY_WOOL)); + } + + public void render(PoseStack poseStack, MultiBufferSource multiBufferSource, int i, SheepRenderState sheepRenderState, float f, float g) { + if (!sheepRenderState.isSheared) { + EntityModel entityModel = sheepRenderState.isBaby ? this.babyModel : this.adultModel; + if (sheepRenderState.isInvisible) { + if (sheepRenderState.appearsGlowing) { + entityModel.setupAnim(sheepRenderState); + VertexConsumer vertexConsumer = multiBufferSource.getBuffer(RenderType.outline(SHEEP_FUR_LOCATION)); + entityModel.renderToBuffer(poseStack, vertexConsumer, i, LivingEntityRenderer.getOverlayCoords(sheepRenderState, 0.0F), -16777216); + } + } else { + int r; + if (sheepRenderState.customName != null && "jeb_".equals(sheepRenderState.customName.getString())) { + int j = 25; + int k = Mth.floor(sheepRenderState.ageInTicks); + int l = k / 25 + sheepRenderState.id; + int m = DyeColor.values().length; + int n = l % m; + int o = (l + 1) % m; + float h = (k % 25 + Mth.frac(sheepRenderState.ageInTicks)) / 25.0F; + int p = Sheep.getColor(DyeColor.byId(n)); + int q = Sheep.getColor(DyeColor.byId(o)); + r = ARGB.lerp(h, p, q); + } else { + r = Sheep.getColor(sheepRenderState.woolColor); + } + + coloredCutoutModelCopyLayerRender(entityModel, SHEEP_FUR_LOCATION, poseStack, multiBufferSource, i, sheepRenderState, r); + } + } + } +} diff --git a/net/minecraft/client/renderer/entity/layers/ShulkerHeadLayer.java b/net/minecraft/client/renderer/entity/layers/ShulkerHeadLayer.java deleted file mode 100644 index a2888129..00000000 --- a/net/minecraft/client/renderer/entity/layers/ShulkerHeadLayer.java +++ /dev/null @@ -1,38 +0,0 @@ -package net.minecraft.client.renderer.entity.layers; - -import com.mojang.blaze3d.vertex.PoseStack; -import com.mojang.blaze3d.vertex.VertexConsumer; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.client.model.ShulkerModel; -import net.minecraft.client.renderer.MultiBufferSource; -import net.minecraft.client.renderer.RenderType; -import net.minecraft.client.renderer.entity.LivingEntityRenderer; -import net.minecraft.client.renderer.entity.RenderLayerParent; -import net.minecraft.client.renderer.entity.ShulkerRenderer; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.entity.monster.Shulker; - -@Environment(EnvType.CLIENT) -public class ShulkerHeadLayer extends RenderLayer> { - public ShulkerHeadLayer(RenderLayerParent> renderer) { - super(renderer); - } - - public void render( - PoseStack poseStack, - MultiBufferSource buffer, - int packedLight, - Shulker livingEntity, - float limbSwing, - float limbSwingAmount, - float partialTicks, - float ageInTicks, - float netHeadYaw, - float headPitch - ) { - ResourceLocation resourceLocation = ShulkerRenderer.getTextureLocation(livingEntity.getColor()); - VertexConsumer vertexConsumer = buffer.getBuffer(RenderType.entitySolid(resourceLocation)); - this.getParentModel().getHead().render(poseStack, vertexConsumer, packedLight, LivingEntityRenderer.getOverlayCoords(livingEntity, 0.0F)); - } -} diff --git a/net/minecraft/client/renderer/entity/layers/SkeletonClothingLayer.java b/net/minecraft/client/renderer/entity/layers/SkeletonClothingLayer.java index 3b13c743..5334b36d 100644 --- a/net/minecraft/client/renderer/entity/layers/SkeletonClothingLayer.java +++ b/net/minecraft/client/renderer/entity/layers/SkeletonClothingLayer.java @@ -9,48 +9,21 @@ import net.minecraft.client.model.geom.EntityModelSet; import net.minecraft.client.model.geom.ModelLayerLocation; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.entity.RenderLayerParent; +import net.minecraft.client.renderer.entity.state.SkeletonRenderState; import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.entity.Mob; -import net.minecraft.world.entity.monster.RangedAttackMob; @Environment(EnvType.CLIENT) -public class SkeletonClothingLayer> extends RenderLayer { - private final SkeletonModel layerModel; +public class SkeletonClothingLayer> extends RenderLayer { + private final SkeletonModel layerModel; private final ResourceLocation clothesLocation; - public SkeletonClothingLayer(RenderLayerParent renderer, EntityModelSet models, ModelLayerLocation modelLayerLocation, ResourceLocation clothesLocation) { + public SkeletonClothingLayer(RenderLayerParent renderer, EntityModelSet models, ModelLayerLocation modelLayerLocation, ResourceLocation clothesLocation) { super(renderer); this.clothesLocation = clothesLocation; this.layerModel = new SkeletonModel<>(models.bakeLayer(modelLayerLocation)); } - public void render( - PoseStack poseStack, - MultiBufferSource bufferSource, - int packedLight, - T livingEntity, - float limbSwing, - float limbSwingAmount, - float partialTick, - float ageInTicks, - float netHeadYaw, - float headPitch - ) { - coloredCutoutModelCopyLayerRender( - this.getParentModel(), - this.layerModel, - this.clothesLocation, - poseStack, - bufferSource, - packedLight, - livingEntity, - limbSwing, - limbSwingAmount, - ageInTicks, - netHeadYaw, - headPitch, - partialTick, - -1 - ); + public void render(PoseStack poseStack, MultiBufferSource multiBufferSource, int i, S skeletonRenderState, float f, float g) { + coloredCutoutModelCopyLayerRender(this.layerModel, this.clothesLocation, poseStack, multiBufferSource, i, skeletonRenderState, -1); } } diff --git a/net/minecraft/client/renderer/entity/layers/SlimeOuterLayer.java b/net/minecraft/client/renderer/entity/layers/SlimeOuterLayer.java index 82dcd579..5cef6861 100644 --- a/net/minecraft/client/renderer/entity/layers/SlimeOuterLayer.java +++ b/net/minecraft/client/renderer/entity/layers/SlimeOuterLayer.java @@ -4,8 +4,6 @@ import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.VertexConsumer; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; -import net.minecraft.client.Minecraft; -import net.minecraft.client.model.EntityModel; import net.minecraft.client.model.SlimeModel; import net.minecraft.client.model.geom.EntityModelSet; import net.minecraft.client.model.geom.ModelLayers; @@ -13,43 +11,30 @@ import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.entity.LivingEntityRenderer; import net.minecraft.client.renderer.entity.RenderLayerParent; -import net.minecraft.world.entity.LivingEntity; +import net.minecraft.client.renderer.entity.SlimeRenderer; +import net.minecraft.client.renderer.entity.state.SlimeRenderState; @Environment(EnvType.CLIENT) -public class SlimeOuterLayer extends RenderLayer> { - private final EntityModel model; +public class SlimeOuterLayer extends RenderLayer { + private final SlimeModel model; - public SlimeOuterLayer(RenderLayerParent> renderer, EntityModelSet modelSet) { + public SlimeOuterLayer(RenderLayerParent renderer, EntityModelSet modelSet) { super(renderer); - this.model = new SlimeModel<>(modelSet.bakeLayer(ModelLayers.SLIME_OUTER)); + this.model = new SlimeModel(modelSet.bakeLayer(ModelLayers.SLIME_OUTER)); } - public void render( - PoseStack poseStack, - MultiBufferSource buffer, - int packedLight, - T livingEntity, - float limbSwing, - float limbSwingAmount, - float partialTicks, - float ageInTicks, - float netHeadYaw, - float headPitch - ) { - Minecraft minecraft = Minecraft.getInstance(); - boolean bl = minecraft.shouldEntityAppearGlowing(livingEntity) && livingEntity.isInvisible(); - if (!livingEntity.isInvisible() || bl) { + public void render(PoseStack poseStack, MultiBufferSource multiBufferSource, int i, SlimeRenderState slimeRenderState, float f, float g) { + boolean bl = slimeRenderState.appearsGlowing && slimeRenderState.isInvisible; + if (!slimeRenderState.isInvisible || bl) { VertexConsumer vertexConsumer; if (bl) { - vertexConsumer = buffer.getBuffer(RenderType.outline(this.getTextureLocation(livingEntity))); + vertexConsumer = multiBufferSource.getBuffer(RenderType.outline(SlimeRenderer.SLIME_LOCATION)); } else { - vertexConsumer = buffer.getBuffer(RenderType.entityTranslucent(this.getTextureLocation(livingEntity))); + vertexConsumer = multiBufferSource.getBuffer(RenderType.entityTranslucent(SlimeRenderer.SLIME_LOCATION)); } - this.getParentModel().copyPropertiesTo(this.model); - this.model.prepareMobModel(livingEntity, limbSwing, limbSwingAmount, partialTicks); - this.model.setupAnim(livingEntity, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch); - this.model.renderToBuffer(poseStack, vertexConsumer, packedLight, LivingEntityRenderer.getOverlayCoords(livingEntity, 0.0F)); + this.model.setupAnim(slimeRenderState); + this.model.renderToBuffer(poseStack, vertexConsumer, i, LivingEntityRenderer.getOverlayCoords(slimeRenderState, 0.0F)); } } } diff --git a/net/minecraft/client/renderer/entity/layers/SnowGolemHeadLayer.java b/net/minecraft/client/renderer/entity/layers/SnowGolemHeadLayer.java index 34c030b7..81c3b5c2 100644 --- a/net/minecraft/client/renderer/entity/layers/SnowGolemHeadLayer.java +++ b/net/minecraft/client/renderer/entity/layers/SnowGolemHeadLayer.java @@ -4,7 +4,6 @@ import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.math.Axis; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; -import net.minecraft.client.Minecraft; import net.minecraft.client.model.SnowGolemModel; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderType; @@ -12,70 +11,58 @@ import net.minecraft.client.renderer.block.BlockRenderDispatcher; import net.minecraft.client.renderer.entity.ItemRenderer; import net.minecraft.client.renderer.entity.LivingEntityRenderer; import net.minecraft.client.renderer.entity.RenderLayerParent; +import net.minecraft.client.renderer.entity.state.LivingEntityRenderState; import net.minecraft.client.renderer.texture.TextureAtlas; import net.minecraft.client.resources.model.BakedModel; -import net.minecraft.world.entity.animal.SnowGolem; +import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.ItemDisplayContext; import net.minecraft.world.item.ItemStack; -import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.state.BlockState; @Environment(EnvType.CLIENT) -public class SnowGolemHeadLayer extends RenderLayer> { +public class SnowGolemHeadLayer extends RenderLayer { private final BlockRenderDispatcher blockRenderer; private final ItemRenderer itemRenderer; - public SnowGolemHeadLayer(RenderLayerParent> renderer, BlockRenderDispatcher blockRenderer, ItemRenderer itemRenderer) { + public SnowGolemHeadLayer(RenderLayerParent renderer, BlockRenderDispatcher blockRenderer, ItemRenderer itemRenderer) { super(renderer); this.blockRenderer = blockRenderer; this.itemRenderer = itemRenderer; } - public void render( - PoseStack poseStack, - MultiBufferSource buffer, - int packedLight, - SnowGolem livingEntity, - float limbSwing, - float limbSwingAmount, - float partialTicks, - float ageInTicks, - float netHeadYaw, - float headPitch - ) { - if (livingEntity.hasPumpkin()) { - boolean bl = Minecraft.getInstance().shouldEntityAppearGlowing(livingEntity) && livingEntity.isInvisible(); - if (!livingEntity.isInvisible() || bl) { + public void render(PoseStack poseStack, MultiBufferSource multiBufferSource, int i, LivingEntityRenderState livingEntityRenderState, float f, float g) { + BakedModel bakedModel = livingEntityRenderState.headItemModel; + if (bakedModel != null) { + boolean bl = livingEntityRenderState.appearsGlowing && livingEntityRenderState.isInvisible; + if (!livingEntityRenderState.isInvisible || bl) { poseStack.pushPose(); this.getParentModel().getHead().translateAndRotate(poseStack); - float f = 0.625F; + float h = 0.625F; poseStack.translate(0.0F, -0.34375F, 0.0F); poseStack.mulPose(Axis.YP.rotationDegrees(180.0F)); poseStack.scale(0.625F, -0.625F, -0.625F); - ItemStack itemStack = new ItemStack(Blocks.CARVED_PUMPKIN); - if (bl) { - BlockState blockState = Blocks.CARVED_PUMPKIN.defaultBlockState(); - BakedModel bakedModel = this.blockRenderer.getBlockModel(blockState); - int i = LivingEntityRenderer.getOverlayCoords(livingEntity, 0.0F); + ItemStack itemStack = livingEntityRenderState.headItem; + if (bl && itemStack.getItem() instanceof BlockItem blockItem) { + BlockState blockState = blockItem.getBlock().defaultBlockState(); + BakedModel bakedModel2 = this.blockRenderer.getBlockModel(blockState); + int j = LivingEntityRenderer.getOverlayCoords(livingEntityRenderState, 0.0F); poseStack.translate(-0.5F, -0.5F, -0.5F); this.blockRenderer .getModelRenderer() .renderModel( - poseStack.last(), buffer.getBuffer(RenderType.outline(TextureAtlas.LOCATION_BLOCKS)), blockState, bakedModel, 0.0F, 0.0F, 0.0F, packedLight, i + poseStack.last(), multiBufferSource.getBuffer(RenderType.outline(TextureAtlas.LOCATION_BLOCKS)), blockState, bakedModel2, 0.0F, 0.0F, 0.0F, i, j ); } else { this.itemRenderer - .renderStatic( - livingEntity, + .render( itemStack, ItemDisplayContext.HEAD, false, poseStack, - buffer, - livingEntity.level(), - packedLight, - LivingEntityRenderer.getOverlayCoords(livingEntity, 0.0F), - livingEntity.getId() + multiBufferSource, + i, + LivingEntityRenderer.getOverlayCoords(livingEntityRenderState, 0.0F), + bakedModel ); } diff --git a/net/minecraft/client/renderer/entity/layers/SpiderEyesLayer.java b/net/minecraft/client/renderer/entity/layers/SpiderEyesLayer.java index 0e8f8f9b..71ba2bc0 100644 --- a/net/minecraft/client/renderer/entity/layers/SpiderEyesLayer.java +++ b/net/minecraft/client/renderer/entity/layers/SpiderEyesLayer.java @@ -5,14 +5,14 @@ import net.fabricmc.api.Environment; import net.minecraft.client.model.SpiderModel; import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.entity.RenderLayerParent; +import net.minecraft.client.renderer.entity.state.LivingEntityRenderState; import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.entity.Entity; @Environment(EnvType.CLIENT) -public class SpiderEyesLayer> extends EyesLayer { +public class SpiderEyesLayer extends EyesLayer { private static final RenderType SPIDER_EYES = RenderType.eyes(ResourceLocation.withDefaultNamespace("textures/entity/spider_eyes.png")); - public SpiderEyesLayer(RenderLayerParent renderLayerParent) { + public SpiderEyesLayer(RenderLayerParent renderLayerParent) { super(renderLayerParent); } diff --git a/net/minecraft/client/renderer/entity/layers/SpinAttackEffectLayer.java b/net/minecraft/client/renderer/entity/layers/SpinAttackEffectLayer.java index 966a1783..da9108c6 100644 --- a/net/minecraft/client/renderer/entity/layers/SpinAttackEffectLayer.java +++ b/net/minecraft/client/renderer/entity/layers/SpinAttackEffectLayer.java @@ -2,69 +2,33 @@ package net.minecraft.client.renderer.entity.layers; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.VertexConsumer; -import com.mojang.math.Axis; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.model.PlayerModel; +import net.minecraft.client.model.SpinAttackEffectModel; import net.minecraft.client.model.geom.EntityModelSet; import net.minecraft.client.model.geom.ModelLayers; -import net.minecraft.client.model.geom.ModelPart; -import net.minecraft.client.model.geom.PartPose; -import net.minecraft.client.model.geom.builders.CubeListBuilder; -import net.minecraft.client.model.geom.builders.LayerDefinition; -import net.minecraft.client.model.geom.builders.MeshDefinition; -import net.minecraft.client.model.geom.builders.PartDefinition; import net.minecraft.client.renderer.MultiBufferSource; -import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.entity.RenderLayerParent; +import net.minecraft.client.renderer.entity.state.PlayerRenderState; import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.entity.LivingEntity; @Environment(EnvType.CLIENT) -public class SpinAttackEffectLayer extends RenderLayer> { +public class SpinAttackEffectLayer extends RenderLayer { public static final ResourceLocation TEXTURE = ResourceLocation.withDefaultNamespace("textures/entity/trident_riptide.png"); - public static final String BOX = "box"; - private final ModelPart box; + private final SpinAttackEffectModel model; - public SpinAttackEffectLayer(RenderLayerParent> renderer, EntityModelSet modelSet) { + public SpinAttackEffectLayer(RenderLayerParent renderer, EntityModelSet modelSet) { super(renderer); - ModelPart modelPart = modelSet.bakeLayer(ModelLayers.PLAYER_SPIN_ATTACK); - this.box = modelPart.getChild("box"); + this.model = new SpinAttackEffectModel(modelSet.bakeLayer(ModelLayers.PLAYER_SPIN_ATTACK)); } - public static LayerDefinition createLayer() { - MeshDefinition meshDefinition = new MeshDefinition(); - PartDefinition partDefinition = meshDefinition.getRoot(); - partDefinition.addOrReplaceChild("box", CubeListBuilder.create().texOffs(0, 0).addBox(-8.0F, -16.0F, -8.0F, 16.0F, 32.0F, 16.0F), PartPose.ZERO); - return LayerDefinition.create(meshDefinition, 64, 64); - } - - public void render( - PoseStack poseStack, - MultiBufferSource buffer, - int packedLight, - T livingEntity, - float limbSwing, - float limbSwingAmount, - float partialTicks, - float ageInTicks, - float netHeadYaw, - float headPitch - ) { - if (livingEntity.isAutoSpinAttack()) { - VertexConsumer vertexConsumer = buffer.getBuffer(RenderType.entityCutoutNoCull(TEXTURE)); - - for (int i = 0; i < 3; i++) { - poseStack.pushPose(); - float f = ageInTicks * -(45 + i * 5); - poseStack.mulPose(Axis.YP.rotationDegrees(f)); - float g = 0.75F * i; - poseStack.scale(g, g, g); - poseStack.translate(0.0F, -0.2F + 0.6F * i, 0.0F); - this.box.render(poseStack, vertexConsumer, packedLight, OverlayTexture.NO_OVERLAY); - poseStack.popPose(); - } + public void render(PoseStack poseStack, MultiBufferSource multiBufferSource, int i, PlayerRenderState playerRenderState, float f, float g) { + if (playerRenderState.isAutoSpinAttack) { + VertexConsumer vertexConsumer = multiBufferSource.getBuffer(this.model.renderType(TEXTURE)); + this.model.setupAnim(playerRenderState); + this.model.renderToBuffer(poseStack, vertexConsumer, i, OverlayTexture.NO_OVERLAY); } } } diff --git a/net/minecraft/client/renderer/entity/layers/StuckInBodyLayer.java b/net/minecraft/client/renderer/entity/layers/StuckInBodyLayer.java index 321235c2..3539dcbe 100644 --- a/net/minecraft/client/renderer/entity/layers/StuckInBodyLayer.java +++ b/net/minecraft/client/renderer/entity/layers/StuckInBodyLayer.java @@ -1,62 +1,90 @@ package net.minecraft.client.renderer.entity.layers; import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.math.Axis; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; +import net.minecraft.client.model.Model; import net.minecraft.client.model.PlayerModel; import net.minecraft.client.model.geom.ModelPart; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.entity.LivingEntityRenderer; +import net.minecraft.client.renderer.entity.state.PlayerRenderState; +import net.minecraft.client.renderer.texture.OverlayTexture; +import net.minecraft.resources.ResourceLocation; import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; -import net.minecraft.world.entity.Entity; -import net.minecraft.world.entity.LivingEntity; @Environment(EnvType.CLIENT) -public abstract class StuckInBodyLayer> extends RenderLayer { - public StuckInBodyLayer(LivingEntityRenderer renderer) { - super(renderer); +public abstract class StuckInBodyLayer extends RenderLayer { + private final Model model; + private final ResourceLocation texture; + private final StuckInBodyLayer.PlacementStyle placementStyle; + + public StuckInBodyLayer( + LivingEntityRenderer livingEntityRenderer, + Model model, + ResourceLocation resourceLocation, + StuckInBodyLayer.PlacementStyle placementStyle + ) { + super(livingEntityRenderer); + this.model = model; + this.texture = resourceLocation; + this.placementStyle = placementStyle; } - protected abstract int numStuck(T entity); + protected abstract int numStuck(PlayerRenderState playerRenderState); - protected abstract void renderStuckItem( - PoseStack poseStack, MultiBufferSource buffer, int packedLight, Entity entity, float x, float y, float z, float partialTick - ); + private void renderStuckItem(PoseStack poseStack, MultiBufferSource multiBufferSource, int i, float f, float g, float h) { + float j = Mth.sqrt(f * f + h * h); + float k = (float)(Math.atan2(f, h) * 180.0F / (float)Math.PI); + float l = (float)(Math.atan2(g, j) * 180.0F / (float)Math.PI); + poseStack.mulPose(Axis.YP.rotationDegrees(k - 90.0F)); + poseStack.mulPose(Axis.ZP.rotationDegrees(l)); + this.model.renderToBuffer(poseStack, multiBufferSource.getBuffer(this.model.renderType(this.texture)), i, OverlayTexture.NO_OVERLAY); + } - public void render( - PoseStack poseStack, - MultiBufferSource buffer, - int packedLight, - T livingEntity, - float limbSwing, - float limbSwingAmount, - float partialTicks, - float ageInTicks, - float netHeadYaw, - float headPitch - ) { - int i = this.numStuck(livingEntity); - RandomSource randomSource = RandomSource.create(livingEntity.getId()); - if (i > 0) { - for (int j = 0; j < i; j++) { + public void render(PoseStack poseStack, MultiBufferSource multiBufferSource, int i, PlayerRenderState playerRenderState, float f, float g) { + int j = this.numStuck(playerRenderState); + if (j > 0) { + RandomSource randomSource = RandomSource.create(playerRenderState.id); + + for (int k = 0; k < j; k++) { poseStack.pushPose(); - ModelPart modelPart = this.getParentModel().getRandomModelPart(randomSource); + ModelPart modelPart = this.getParentModel().getRandomBodyPart(randomSource); ModelPart.Cube cube = modelPart.getRandomCube(randomSource); modelPart.translateAndRotate(poseStack); - float f = randomSource.nextFloat(); - float g = randomSource.nextFloat(); float h = randomSource.nextFloat(); - float k = Mth.lerp(f, cube.minX, cube.maxX) / 16.0F; - float l = Mth.lerp(g, cube.minY, cube.maxY) / 16.0F; - float m = Mth.lerp(h, cube.minZ, cube.maxZ) / 16.0F; - poseStack.translate(k, l, m); - f = -1.0F * (f * 2.0F - 1.0F); - g = -1.0F * (g * 2.0F - 1.0F); - h = -1.0F * (h * 2.0F - 1.0F); - this.renderStuckItem(poseStack, buffer, packedLight, livingEntity, f, g, h, partialTicks); + float l = randomSource.nextFloat(); + float m = randomSource.nextFloat(); + if (this.placementStyle == StuckInBodyLayer.PlacementStyle.ON_SURFACE) { + int n = randomSource.nextInt(3); + switch (n) { + case 0: + h = snapToFace(h); + break; + case 1: + l = snapToFace(l); + break; + default: + m = snapToFace(m); + } + } + + poseStack.translate(Mth.lerp(h, cube.minX, cube.maxX) / 16.0F, Mth.lerp(l, cube.minY, cube.maxY) / 16.0F, Mth.lerp(m, cube.minZ, cube.maxZ) / 16.0F); + this.renderStuckItem(poseStack, multiBufferSource, i, -(h * 2.0F - 1.0F), -(l * 2.0F - 1.0F), -(m * 2.0F - 1.0F)); poseStack.popPose(); } } } + + private static float snapToFace(float f) { + return f > 0.5F ? 1.0F : 0.5F; + } + + @Environment(EnvType.CLIENT) + public static enum PlacementStyle { + IN_CUBE, + ON_SURFACE; + } } diff --git a/net/minecraft/client/renderer/entity/layers/TropicalFishPatternLayer.java b/net/minecraft/client/renderer/entity/layers/TropicalFishPatternLayer.java index c4014b3d..c0142b0f 100644 --- a/net/minecraft/client/renderer/entity/layers/TropicalFishPatternLayer.java +++ b/net/minecraft/client/renderer/entity/layers/TropicalFishPatternLayer.java @@ -3,7 +3,6 @@ package net.minecraft.client.renderer.entity.layers; import com.mojang.blaze3d.vertex.PoseStack; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; -import net.minecraft.client.model.ColorableHierarchicalModel; import net.minecraft.client.model.EntityModel; import net.minecraft.client.model.TropicalFishModelA; import net.minecraft.client.model.TropicalFishModelB; @@ -11,11 +10,12 @@ import net.minecraft.client.model.geom.EntityModelSet; import net.minecraft.client.model.geom.ModelLayers; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.entity.RenderLayerParent; +import net.minecraft.client.renderer.entity.state.TropicalFishRenderState; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.animal.TropicalFish; @Environment(EnvType.CLIENT) -public class TropicalFishPatternLayer extends RenderLayer> { +public class TropicalFishPatternLayer extends RenderLayer> { private static final ResourceLocation KOB_TEXTURE = ResourceLocation.withDefaultNamespace("textures/entity/fish/tropical_a_pattern_1.png"); private static final ResourceLocation SUNSTREAK_TEXTURE = ResourceLocation.withDefaultNamespace("textures/entity/fish/tropical_a_pattern_2.png"); private static final ResourceLocation SNOOPER_TEXTURE = ResourceLocation.withDefaultNamespace("textures/entity/fish/tropical_a_pattern_3.png"); @@ -28,30 +28,19 @@ public class TropicalFishPatternLayer extends RenderLayer modelA; - private final TropicalFishModelB modelB; + private final TropicalFishModelA modelA; + private final TropicalFishModelB modelB; - public TropicalFishPatternLayer(RenderLayerParent> renderer, EntityModelSet modelSet) { + public TropicalFishPatternLayer(RenderLayerParent> renderer, EntityModelSet modelSet) { super(renderer); - this.modelA = new TropicalFishModelA<>(modelSet.bakeLayer(ModelLayers.TROPICAL_FISH_SMALL_PATTERN)); - this.modelB = new TropicalFishModelB<>(modelSet.bakeLayer(ModelLayers.TROPICAL_FISH_LARGE_PATTERN)); + this.modelA = new TropicalFishModelA(modelSet.bakeLayer(ModelLayers.TROPICAL_FISH_SMALL_PATTERN)); + this.modelB = new TropicalFishModelB(modelSet.bakeLayer(ModelLayers.TROPICAL_FISH_LARGE_PATTERN)); } - public void render( - PoseStack poseStack, - MultiBufferSource buffer, - int packedLight, - TropicalFish livingEntity, - float limbSwing, - float limbSwingAmount, - float partialTicks, - float ageInTicks, - float netHeadYaw, - float headPitch - ) { - TropicalFish.Pattern pattern = livingEntity.getVariant(); + public void render(PoseStack poseStack, MultiBufferSource multiBufferSource, int i, TropicalFishRenderState tropicalFishRenderState, float f, float g) { + TropicalFish.Pattern pattern = tropicalFishRenderState.variant; - EntityModel entityModel = (EntityModel)(switch (pattern.base()) { + EntityModel entityModel = (EntityModel)(switch (pattern.base()) { case SMALL -> this.modelA; case LARGE -> this.modelB; }); @@ -70,22 +59,8 @@ public class TropicalFishPatternLayer extends RenderLayer BETTY_TEXTURE; case CLAYFISH -> CLAYFISH_TEXTURE; }; - int i = livingEntity.getPatternColor().getTextureDiffuseColor(); coloredCutoutModelCopyLayerRender( - this.getParentModel(), - entityModel, - resourceLocation, - poseStack, - buffer, - packedLight, - livingEntity, - limbSwing, - limbSwingAmount, - ageInTicks, - netHeadYaw, - headPitch, - partialTicks, - i + entityModel, resourceLocation, poseStack, multiBufferSource, i, tropicalFishRenderState, tropicalFishRenderState.patternColor ); } } diff --git a/net/minecraft/client/renderer/entity/layers/VillagerProfessionLayer.java b/net/minecraft/client/renderer/entity/layers/VillagerProfessionLayer.java index 40ed8b18..b05ec4f7 100644 --- a/net/minecraft/client/renderer/entity/layers/VillagerProfessionLayer.java +++ b/net/minecraft/client/renderer/entity/layers/VillagerProfessionLayer.java @@ -15,20 +15,22 @@ import net.minecraft.client.model.EntityModel; import net.minecraft.client.model.VillagerHeadModel; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.entity.RenderLayerParent; +import net.minecraft.client.renderer.entity.state.LivingEntityRenderState; +import net.minecraft.client.renderer.entity.state.VillagerDataHolderRenderState; import net.minecraft.client.resources.metadata.animation.VillagerMetaDataSection; +import net.minecraft.client.resources.metadata.animation.VillagerMetaDataSection.Hat; import net.minecraft.core.DefaultedRegistry; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.packs.resources.ResourceManager; import net.minecraft.util.Mth; -import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.npc.VillagerData; -import net.minecraft.world.entity.npc.VillagerDataHolder; import net.minecraft.world.entity.npc.VillagerProfession; import net.minecraft.world.entity.npc.VillagerType; @Environment(EnvType.CLIENT) -public class VillagerProfessionLayer & VillagerHeadModel> extends RenderLayer { +public class VillagerProfessionLayer & VillagerHeadModel> + extends RenderLayer { private static final Int2ObjectMap LEVEL_LOCATIONS = Util.make(new Int2ObjectOpenHashMap<>(), int2ObjectOpenHashMap -> { int2ObjectOpenHashMap.put(1, ResourceLocation.withDefaultNamespace("stone")); int2ObjectOpenHashMap.put(2, ResourceLocation.withDefaultNamespace("iron")); @@ -36,48 +38,37 @@ public class VillagerProfessionLayer typeHatCache = new Object2ObjectOpenHashMap<>(); - private final Object2ObjectMap professionHatCache = new Object2ObjectOpenHashMap<>(); + private final Object2ObjectMap typeHatCache = new Object2ObjectOpenHashMap<>(); + private final Object2ObjectMap professionHatCache = new Object2ObjectOpenHashMap<>(); private final ResourceManager resourceManager; private final String path; - public VillagerProfessionLayer(RenderLayerParent renderer, ResourceManager resourceManager, String path) { + public VillagerProfessionLayer(RenderLayerParent renderer, ResourceManager resourceManager, String path) { super(renderer); this.resourceManager = resourceManager; this.path = path; } - public void render( - PoseStack poseStack, - MultiBufferSource buffer, - int packedLight, - T livingEntity, - float limbSwing, - float limbSwingAmount, - float partialTicks, - float ageInTicks, - float netHeadYaw, - float headPitch - ) { - if (!livingEntity.isInvisible()) { - VillagerData villagerData = livingEntity.getVillagerData(); + public void render(PoseStack poseStack, MultiBufferSource multiBufferSource, int i, S livingEntityRenderState, float f, float g) { + if (!livingEntityRenderState.isInvisible) { + VillagerData villagerData = livingEntityRenderState.getVillagerData(); VillagerType villagerType = villagerData.getType(); VillagerProfession villagerProfession = villagerData.getProfession(); - VillagerMetaDataSection.Hat hat = this.getHatData(this.typeHatCache, "type", BuiltInRegistries.VILLAGER_TYPE, villagerType); - VillagerMetaDataSection.Hat hat2 = this.getHatData(this.professionHatCache, "profession", BuiltInRegistries.VILLAGER_PROFESSION, villagerProfession); + Hat hat = this.getHatData(this.typeHatCache, "type", BuiltInRegistries.VILLAGER_TYPE, villagerType); + Hat hat2 = this.getHatData(this.professionHatCache, "profession", BuiltInRegistries.VILLAGER_PROFESSION, villagerProfession); M entityModel = this.getParentModel(); - entityModel.hatVisible(hat2 == VillagerMetaDataSection.Hat.NONE || hat2 == VillagerMetaDataSection.Hat.PARTIAL && hat != VillagerMetaDataSection.Hat.FULL); + entityModel.hatVisible(hat2 == Hat.NONE || hat2 == Hat.PARTIAL && hat != Hat.FULL); ResourceLocation resourceLocation = this.getResourceLocation("type", BuiltInRegistries.VILLAGER_TYPE.getKey(villagerType)); - renderColoredCutoutModel(entityModel, resourceLocation, poseStack, buffer, packedLight, livingEntity, -1); + renderColoredCutoutModel(entityModel, resourceLocation, poseStack, multiBufferSource, i, livingEntityRenderState, -1); entityModel.hatVisible(true); - if (villagerProfession != VillagerProfession.NONE && !livingEntity.isBaby()) { + if (villagerProfession != VillagerProfession.NONE && !livingEntityRenderState.isBaby) { ResourceLocation resourceLocation2 = this.getResourceLocation("profession", BuiltInRegistries.VILLAGER_PROFESSION.getKey(villagerProfession)); - renderColoredCutoutModel(entityModel, resourceLocation2, poseStack, buffer, packedLight, livingEntity, -1); + renderColoredCutoutModel(entityModel, resourceLocation2, poseStack, multiBufferSource, i, livingEntityRenderState, -1); if (villagerProfession != VillagerProfession.NITWIT) { ResourceLocation resourceLocation3 = this.getResourceLocation( "profession_level", LEVEL_LOCATIONS.get(Mth.clamp(villagerData.getLevel(), 1, LEVEL_LOCATIONS.size())) ); - renderColoredCutoutModel(entityModel, resourceLocation3, poseStack, buffer, packedLight, livingEntity, -1); + renderColoredCutoutModel(entityModel, resourceLocation3, poseStack, multiBufferSource, i, livingEntityRenderState, -1); } } } @@ -87,21 +78,15 @@ public class VillagerProfessionLayer)(string2 -> "textures/entity/" + this.path + "/" + folder + "/" + string2 + ".png")); } - public VillagerMetaDataSection.Hat getHatData( - Object2ObjectMap cache, String folder, DefaultedRegistry villagerTypeRegistry, K key - ) { + public Hat getHatData(Object2ObjectMap cache, String folder, DefaultedRegistry villagerTypeRegistry, K key) { return cache.computeIfAbsent( - key, - object2 -> (VillagerMetaDataSection.Hat)this.resourceManager - .getResource(this.getResourceLocation(folder, villagerTypeRegistry.getKey(key))) - .flatMap(resource -> { - try { - return resource.metadata().getSection(VillagerMetaDataSection.SERIALIZER).map(VillagerMetaDataSection::getHat); - } catch (IOException var2) { - return Optional.empty(); - } - }) - .orElse(VillagerMetaDataSection.Hat.NONE) + key, object2 -> (Hat)this.resourceManager.getResource(this.getResourceLocation(folder, villagerTypeRegistry.getKey(key))).flatMap(resource -> { + try { + return resource.metadata().getSection(VillagerMetaDataSection.SERIALIZER).map(VillagerMetaDataSection::getHat); + } catch (IOException var2) { + return Optional.empty(); + } + }).orElse(Hat.NONE) ); } } diff --git a/net/minecraft/client/renderer/entity/layers/WardenEmissiveLayer.java b/net/minecraft/client/renderer/entity/layers/WardenEmissiveLayer.java deleted file mode 100644 index f5361656..00000000 --- a/net/minecraft/client/renderer/entity/layers/WardenEmissiveLayer.java +++ /dev/null @@ -1,79 +0,0 @@ -package net.minecraft.client.renderer.entity.layers; - -import com.mojang.blaze3d.vertex.PoseStack; -import com.mojang.blaze3d.vertex.VertexConsumer; -import java.util.List; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.client.model.EntityModel; -import net.minecraft.client.model.WardenModel; -import net.minecraft.client.model.geom.ModelPart; -import net.minecraft.client.renderer.MultiBufferSource; -import net.minecraft.client.renderer.RenderType; -import net.minecraft.client.renderer.entity.LivingEntityRenderer; -import net.minecraft.client.renderer.entity.RenderLayerParent; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.util.FastColor; -import net.minecraft.util.Mth; -import net.minecraft.world.entity.monster.warden.Warden; - -@Environment(EnvType.CLIENT) -public class WardenEmissiveLayer> extends RenderLayer { - private final ResourceLocation texture; - private final WardenEmissiveLayer.AlphaFunction alphaFunction; - private final WardenEmissiveLayer.DrawSelector drawSelector; - - public WardenEmissiveLayer( - RenderLayerParent renderer, - ResourceLocation texture, - WardenEmissiveLayer.AlphaFunction alphaFunction, - WardenEmissiveLayer.DrawSelector drawSelector - ) { - super(renderer); - this.texture = texture; - this.alphaFunction = alphaFunction; - this.drawSelector = drawSelector; - } - - public void render( - PoseStack poseStack, - MultiBufferSource bufferSource, - int packedLight, - T livingEntity, - float limbSwing, - float limbSwingAmount, - float partialTick, - float ageInTicks, - float netHeadYaw, - float headPitch - ) { - if (!livingEntity.isInvisible()) { - this.onlyDrawSelectedParts(); - VertexConsumer vertexConsumer = bufferSource.getBuffer(RenderType.entityTranslucentEmissive(this.texture)); - float f = this.alphaFunction.apply(livingEntity, partialTick, ageInTicks); - int i = FastColor.ARGB32.color(Mth.floor(f * 255.0F), 255, 255, 255); - this.getParentModel().renderToBuffer(poseStack, vertexConsumer, packedLight, LivingEntityRenderer.getOverlayCoords(livingEntity, 0.0F), i); - this.resetDrawForAllParts(); - } - } - - private void onlyDrawSelectedParts() { - List list = this.drawSelector.getPartsToDraw(this.getParentModel()); - this.getParentModel().root().getAllParts().forEach(modelPart -> modelPart.skipDraw = true); - list.forEach(modelPart -> modelPart.skipDraw = false); - } - - private void resetDrawForAllParts() { - this.getParentModel().root().getAllParts().forEach(modelPart -> modelPart.skipDraw = false); - } - - @Environment(EnvType.CLIENT) - public interface AlphaFunction { - float apply(T warden, float f, float g); - } - - @Environment(EnvType.CLIENT) - public interface DrawSelector> { - List getPartsToDraw(M entityModel); - } -} diff --git a/net/minecraft/client/renderer/entity/layers/WingsLayer.java b/net/minecraft/client/renderer/entity/layers/WingsLayer.java new file mode 100644 index 00000000..1530fae6 --- /dev/null +++ b/net/minecraft/client/renderer/entity/layers/WingsLayer.java @@ -0,0 +1,66 @@ +package net.minecraft.client.renderer.entity.layers; + +import com.mojang.blaze3d.vertex.PoseStack; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.client.model.ElytraModel; +import net.minecraft.client.model.EntityModel; +import net.minecraft.client.model.geom.EntityModelSet; +import net.minecraft.client.model.geom.ModelLayers; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.entity.RenderLayerParent; +import net.minecraft.client.renderer.entity.state.HumanoidRenderState; +import net.minecraft.client.renderer.entity.state.PlayerRenderState; +import net.minecraft.client.resources.PlayerSkin; +import net.minecraft.core.component.DataComponents; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.equipment.EquipmentModel; +import net.minecraft.world.item.equipment.Equippable; +import org.jetbrains.annotations.Nullable; + +@Environment(EnvType.CLIENT) +public class WingsLayer> extends RenderLayer { + private final ElytraModel elytraModel; + private final ElytraModel elytraBabyModel; + private final EquipmentLayerRenderer equipmentRenderer; + + public WingsLayer(RenderLayerParent renderLayerParent, EntityModelSet entityModelSet, EquipmentLayerRenderer equipmentLayerRenderer) { + super(renderLayerParent); + this.elytraModel = new ElytraModel(entityModelSet.bakeLayer(ModelLayers.ELYTRA)); + this.elytraBabyModel = new ElytraModel(entityModelSet.bakeLayer(ModelLayers.ELYTRA_BABY)); + this.equipmentRenderer = equipmentLayerRenderer; + } + + public void render(PoseStack poseStack, MultiBufferSource multiBufferSource, int i, S humanoidRenderState, float f, float g) { + ItemStack itemStack = humanoidRenderState.chestItem; + Equippable equippable = itemStack.get(DataComponents.EQUIPPABLE); + if (equippable != null && !equippable.model().isEmpty()) { + ResourceLocation resourceLocation = getPlayerElytraTexture(humanoidRenderState); + ElytraModel elytraModel = humanoidRenderState.isBaby ? this.elytraBabyModel : this.elytraModel; + ResourceLocation resourceLocation2 = (ResourceLocation)equippable.model().get(); + poseStack.pushPose(); + poseStack.translate(0.0F, 0.0F, 0.125F); + elytraModel.setupAnim(humanoidRenderState); + this.equipmentRenderer + .renderLayers(EquipmentModel.LayerType.WINGS, resourceLocation2, elytraModel, itemStack, poseStack, multiBufferSource, i, resourceLocation); + poseStack.popPose(); + } + } + + @Nullable + private static ResourceLocation getPlayerElytraTexture(HumanoidRenderState humanoidRenderState) { + if (humanoidRenderState instanceof PlayerRenderState playerRenderState) { + PlayerSkin playerSkin = playerRenderState.skin; + if (playerSkin.elytraTexture() != null) { + return playerSkin.elytraTexture(); + } + + if (playerSkin.capeTexture() != null && playerRenderState.showCape) { + return playerSkin.capeTexture(); + } + } + + return null; + } +} diff --git a/net/minecraft/client/renderer/entity/layers/WitchItemLayer.java b/net/minecraft/client/renderer/entity/layers/WitchItemLayer.java index e79af89a..eca956cc 100644 --- a/net/minecraft/client/renderer/entity/layers/WitchItemLayer.java +++ b/net/minecraft/client/renderer/entity/layers/WitchItemLayer.java @@ -5,35 +5,22 @@ import com.mojang.math.Axis; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.model.WitchModel; -import net.minecraft.client.renderer.ItemInHandRenderer; import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.entity.ItemRenderer; import net.minecraft.client.renderer.entity.RenderLayerParent; -import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.item.ItemStack; +import net.minecraft.client.renderer.entity.state.WitchRenderState; import net.minecraft.world.item.Items; @Environment(EnvType.CLIENT) -public class WitchItemLayer extends CrossedArmsItemLayer> { - public WitchItemLayer(RenderLayerParent> renderer, ItemInHandRenderer itemInHandRenderer) { - super(renderer, itemInHandRenderer); +public class WitchItemLayer extends CrossedArmsItemLayer { + public WitchItemLayer(RenderLayerParent renderLayerParent, ItemRenderer itemRenderer) { + super(renderLayerParent, itemRenderer); } - @Override - public void render( - PoseStack poseStack, - MultiBufferSource buffer, - int packedLight, - T livingEntity, - float limbSwing, - float limbSwingAmount, - float partialTicks, - float ageInTicks, - float netHeadYaw, - float headPitch - ) { - ItemStack itemStack = livingEntity.getMainHandItem(); + public void render(PoseStack poseStack, MultiBufferSource multiBufferSource, int i, WitchRenderState witchRenderState, float f, float g) { poseStack.pushPose(); - if (itemStack.is(Items.POTION)) { + if (witchRenderState.rightHandItem.is(Items.POTION)) { + this.getParentModel().root().translateAndRotate(poseStack); this.getParentModel().getHead().translateAndRotate(poseStack); this.getParentModel().getNose().translateAndRotate(poseStack); poseStack.translate(0.0625F, 0.25F, 0.0F); @@ -43,7 +30,7 @@ public class WitchItemLayer extends CrossedArmsItemLayer poseStack.translate(0.0F, -0.4F, 0.4F); } - super.render(poseStack, buffer, packedLight, livingEntity, limbSwing, limbSwingAmount, partialTicks, ageInTicks, netHeadYaw, headPitch); + super.render(poseStack, multiBufferSource, i, witchRenderState, f, g); poseStack.popPose(); } } diff --git a/net/minecraft/client/renderer/entity/layers/WitherArmorLayer.java b/net/minecraft/client/renderer/entity/layers/WitherArmorLayer.java index e20df3e3..2b444175 100644 --- a/net/minecraft/client/renderer/entity/layers/WitherArmorLayer.java +++ b/net/minecraft/client/renderer/entity/layers/WitherArmorLayer.java @@ -2,23 +2,26 @@ package net.minecraft.client.renderer.entity.layers; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; -import net.minecraft.client.model.EntityModel; import net.minecraft.client.model.WitherBossModel; import net.minecraft.client.model.geom.EntityModelSet; import net.minecraft.client.model.geom.ModelLayers; import net.minecraft.client.renderer.entity.RenderLayerParent; +import net.minecraft.client.renderer.entity.state.WitherRenderState; import net.minecraft.resources.ResourceLocation; import net.minecraft.util.Mth; -import net.minecraft.world.entity.boss.wither.WitherBoss; @Environment(EnvType.CLIENT) -public class WitherArmorLayer extends EnergySwirlLayer> { +public class WitherArmorLayer extends EnergySwirlLayer { private static final ResourceLocation WITHER_ARMOR_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/wither/wither_armor.png"); - private final WitherBossModel model; + private final WitherBossModel model; - public WitherArmorLayer(RenderLayerParent> renderer, EntityModelSet modelSet) { + public WitherArmorLayer(RenderLayerParent renderer, EntityModelSet modelSet) { super(renderer); - this.model = new WitherBossModel<>(modelSet.bakeLayer(ModelLayers.WITHER_ARMOR)); + this.model = new WitherBossModel(modelSet.bakeLayer(ModelLayers.WITHER_ARMOR)); + } + + protected boolean isPowered(WitherRenderState witherRenderState) { + return witherRenderState.isPowered; } @Override @@ -31,8 +34,7 @@ public class WitherArmorLayer extends EnergySwirlLayer model() { + protected WitherBossModel model() { return this.model; } } diff --git a/net/minecraft/client/renderer/entity/layers/WolfArmorLayer.java b/net/minecraft/client/renderer/entity/layers/WolfArmorLayer.java index 593f51bb..af6a63ab 100644 --- a/net/minecraft/client/renderer/entity/layers/WolfArmorLayer.java +++ b/net/minecraft/client/renderer/entity/layers/WolfArmorLayer.java @@ -5,90 +5,64 @@ import com.mojang.blaze3d.vertex.VertexConsumer; import java.util.Map; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; +import net.minecraft.client.model.Model; import net.minecraft.client.model.WolfModel; import net.minecraft.client.model.geom.EntityModelSet; import net.minecraft.client.model.geom.ModelLayers; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.entity.RenderLayerParent; +import net.minecraft.client.renderer.entity.state.WolfRenderState; import net.minecraft.client.renderer.texture.OverlayTexture; +import net.minecraft.core.component.DataComponents; import net.minecraft.resources.ResourceLocation; -import net.minecraft.tags.ItemTags; -import net.minecraft.util.FastColor; import net.minecraft.world.entity.Crackiness; -import net.minecraft.world.entity.animal.Wolf; -import net.minecraft.world.item.AnimalArmorItem; +import net.minecraft.world.entity.Crackiness.Level; import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.component.DyedItemColor; +import net.minecraft.world.item.equipment.EquipmentModel; +import net.minecraft.world.item.equipment.Equippable; @Environment(EnvType.CLIENT) -public class WolfArmorLayer extends RenderLayer> { - private final WolfModel model; - private static final Map ARMOR_CRACK_LOCATIONS = Map.of( - Crackiness.Level.LOW, +public class WolfArmorLayer extends RenderLayer { + private final WolfModel adultModel; + private final WolfModel babyModel; + private final EquipmentLayerRenderer equipmentRenderer; + private static final Map ARMOR_CRACK_LOCATIONS = Map.of( + Level.LOW, ResourceLocation.withDefaultNamespace("textures/entity/wolf/wolf_armor_crackiness_low.png"), - Crackiness.Level.MEDIUM, + Level.MEDIUM, ResourceLocation.withDefaultNamespace("textures/entity/wolf/wolf_armor_crackiness_medium.png"), - Crackiness.Level.HIGH, + Level.HIGH, ResourceLocation.withDefaultNamespace("textures/entity/wolf/wolf_armor_crackiness_high.png") ); - public WolfArmorLayer(RenderLayerParent> renderer, EntityModelSet models) { - super(renderer); - this.model = new WolfModel<>(models.bakeLayer(ModelLayers.WOLF_ARMOR)); - } - - public void render( - PoseStack poseStack, - MultiBufferSource bufferSource, - int packedLight, - Wolf livingEntity, - float limbSwing, - float limbSwingAmount, - float partialTick, - float ageInTicks, - float netHeadYaw, - float headPitch + public WolfArmorLayer( + RenderLayerParent renderLayerParent, EntityModelSet entityModelSet, EquipmentLayerRenderer equipmentLayerRenderer ) { - if (livingEntity.hasArmor()) { - ItemStack itemStack = livingEntity.getBodyArmorItem(); - if (itemStack.getItem() instanceof AnimalArmorItem animalArmorItem && animalArmorItem.getBodyType() == AnimalArmorItem.BodyType.CANINE) { - this.getParentModel().copyPropertiesTo(this.model); - this.model.prepareMobModel(livingEntity, limbSwing, limbSwingAmount, partialTick); - this.model.setupAnim(livingEntity, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch); - VertexConsumer vertexConsumer = bufferSource.getBuffer(RenderType.entityCutoutNoCull(animalArmorItem.getTexture())); - this.model.renderToBuffer(poseStack, vertexConsumer, packedLight, OverlayTexture.NO_OVERLAY); - this.maybeRenderColoredLayer(poseStack, bufferSource, packedLight, itemStack, animalArmorItem); - this.maybeRenderCracks(poseStack, bufferSource, packedLight, itemStack); - } + super(renderLayerParent); + this.adultModel = new WolfModel(entityModelSet.bakeLayer(ModelLayers.WOLF_ARMOR)); + this.babyModel = new WolfModel(entityModelSet.bakeLayer(ModelLayers.WOLF_BABY_ARMOR)); + this.equipmentRenderer = equipmentLayerRenderer; + } + + public void render(PoseStack poseStack, MultiBufferSource multiBufferSource, int i, WolfRenderState wolfRenderState, float f, float g) { + ItemStack itemStack = wolfRenderState.bodyArmorItem; + Equippable equippable = itemStack.get(DataComponents.EQUIPPABLE); + if (equippable != null && !equippable.model().isEmpty()) { + WolfModel wolfModel = wolfRenderState.isBaby ? this.babyModel : this.adultModel; + ResourceLocation resourceLocation = (ResourceLocation)equippable.model().get(); + wolfModel.setupAnim(wolfRenderState); + this.equipmentRenderer.renderLayers(EquipmentModel.LayerType.WOLF_BODY, resourceLocation, wolfModel, itemStack, poseStack, multiBufferSource, i); + this.maybeRenderCracks(poseStack, multiBufferSource, i, itemStack, wolfModel); } } - private void maybeRenderColoredLayer(PoseStack poseStack, MultiBufferSource buffer, int packedLight, ItemStack armorStack, AnimalArmorItem armorItem) { - if (armorStack.is(ItemTags.DYEABLE)) { - int i = DyedItemColor.getOrDefault(armorStack, 0); - if (FastColor.ARGB32.alpha(i) == 0) { - return; - } - - ResourceLocation resourceLocation = armorItem.getOverlayTexture(); - if (resourceLocation == null) { - return; - } - - this.model - .renderToBuffer( - poseStack, buffer.getBuffer(RenderType.entityCutoutNoCull(resourceLocation)), packedLight, OverlayTexture.NO_OVERLAY, FastColor.ARGB32.opaque(i) - ); - } - } - - private void maybeRenderCracks(PoseStack poseStack, MultiBufferSource buffer, int packedLight, ItemStack armorStack) { - Crackiness.Level level = Crackiness.WOLF_ARMOR.byDamage(armorStack); - if (level != Crackiness.Level.NONE) { + private void maybeRenderCracks(PoseStack poseStack, MultiBufferSource multiBufferSource, int i, ItemStack itemStack, Model model) { + Level level = Crackiness.WOLF_ARMOR.byDamage(itemStack); + if (level != Level.NONE) { ResourceLocation resourceLocation = (ResourceLocation)ARMOR_CRACK_LOCATIONS.get(level); - VertexConsumer vertexConsumer = buffer.getBuffer(RenderType.entityTranslucent(resourceLocation)); - this.model.renderToBuffer(poseStack, vertexConsumer, packedLight, OverlayTexture.NO_OVERLAY); + VertexConsumer vertexConsumer = multiBufferSource.getBuffer(RenderType.armorTranslucent(resourceLocation)); + model.renderToBuffer(poseStack, vertexConsumer, i, OverlayTexture.NO_OVERLAY); } } } diff --git a/net/minecraft/client/renderer/entity/layers/WolfCollarLayer.java b/net/minecraft/client/renderer/entity/layers/WolfCollarLayer.java index 31adbc76..6ad13f8c 100644 --- a/net/minecraft/client/renderer/entity/layers/WolfCollarLayer.java +++ b/net/minecraft/client/renderer/entity/layers/WolfCollarLayer.java @@ -8,34 +8,25 @@ import net.minecraft.client.model.WolfModel; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.entity.RenderLayerParent; +import net.minecraft.client.renderer.entity.state.WolfRenderState; import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.entity.animal.Wolf; +import net.minecraft.world.item.DyeColor; @Environment(EnvType.CLIENT) -public class WolfCollarLayer extends RenderLayer> { +public class WolfCollarLayer extends RenderLayer { private static final ResourceLocation WOLF_COLLAR_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/wolf/wolf_collar.png"); - public WolfCollarLayer(RenderLayerParent> renderer) { + public WolfCollarLayer(RenderLayerParent renderer) { super(renderer); } - public void render( - PoseStack poseStack, - MultiBufferSource buffer, - int packedLight, - Wolf livingEntity, - float limbSwing, - float limbSwingAmount, - float partialTicks, - float ageInTicks, - float netHeadYaw, - float headPitch - ) { - if (livingEntity.isTame() && !livingEntity.isInvisible()) { - int i = livingEntity.getCollarColor().getTextureDiffuseColor(); - VertexConsumer vertexConsumer = buffer.getBuffer(RenderType.entityCutoutNoCull(WOLF_COLLAR_LOCATION)); - this.getParentModel().renderToBuffer(poseStack, vertexConsumer, packedLight, OverlayTexture.NO_OVERLAY, i); + public void render(PoseStack poseStack, MultiBufferSource multiBufferSource, int i, WolfRenderState wolfRenderState, float f, float g) { + DyeColor dyeColor = wolfRenderState.collarColor; + if (dyeColor != null && !wolfRenderState.isInvisible) { + int j = dyeColor.getTextureDiffuseColor(); + VertexConsumer vertexConsumer = multiBufferSource.getBuffer(RenderType.entityCutoutNoCull(WOLF_COLLAR_LOCATION)); + this.getParentModel().renderToBuffer(poseStack, vertexConsumer, i, OverlayTexture.NO_OVERLAY, j); } } } diff --git a/net/minecraft/client/renderer/entity/player/PlayerRenderer.java b/net/minecraft/client/renderer/entity/player/PlayerRenderer.java index eb8f73fe..887e2126 100644 --- a/net/minecraft/client/renderer/entity/player/PlayerRenderer.java +++ b/net/minecraft/client/renderer/entity/player/PlayerRenderer.java @@ -13,134 +13,118 @@ import net.minecraft.client.player.AbstractClientPlayer; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.entity.EntityRendererProvider; +import net.minecraft.client.renderer.entity.HumanoidMobRenderer; import net.minecraft.client.renderer.entity.LivingEntityRenderer; import net.minecraft.client.renderer.entity.layers.ArrowLayer; import net.minecraft.client.renderer.entity.layers.BeeStingerLayer; import net.minecraft.client.renderer.entity.layers.CapeLayer; import net.minecraft.client.renderer.entity.layers.CustomHeadLayer; import net.minecraft.client.renderer.entity.layers.Deadmau5EarsLayer; -import net.minecraft.client.renderer.entity.layers.ElytraLayer; import net.minecraft.client.renderer.entity.layers.HumanoidArmorLayer; import net.minecraft.client.renderer.entity.layers.ParrotOnShoulderLayer; import net.minecraft.client.renderer.entity.layers.PlayerItemInHandLayer; import net.minecraft.client.renderer.entity.layers.SpinAttackEffectLayer; +import net.minecraft.client.renderer.entity.layers.WingsLayer; +import net.minecraft.client.renderer.entity.state.PlayerRenderState; import net.minecraft.client.renderer.texture.OverlayTexture; +import net.minecraft.nbt.CompoundTag; import net.minecraft.network.chat.CommonComponents; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.numbers.StyledFormat; import net.minecraft.resources.ResourceLocation; import net.minecraft.util.Mth; import net.minecraft.world.InteractionHand; +import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.HumanoidArm; +import net.minecraft.world.entity.animal.Parrot; import net.minecraft.world.entity.player.PlayerModelPart; import net.minecraft.world.item.CrossbowItem; import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.ItemUseAnimation; import net.minecraft.world.item.Items; -import net.minecraft.world.item.UseAnim; import net.minecraft.world.phys.Vec3; import net.minecraft.world.scores.DisplaySlot; import net.minecraft.world.scores.Objective; import net.minecraft.world.scores.ReadOnlyScoreInfo; import net.minecraft.world.scores.Scoreboard; +import org.jetbrains.annotations.Nullable; @Environment(EnvType.CLIENT) -public class PlayerRenderer extends LivingEntityRenderer> { +public class PlayerRenderer extends LivingEntityRenderer { public PlayerRenderer(EntityRendererProvider.Context context, boolean useSlimModel) { - super(context, new PlayerModel<>(context.bakeLayer(useSlimModel ? ModelLayers.PLAYER_SLIM : ModelLayers.PLAYER), useSlimModel), 0.5F); + super(context, new PlayerModel(context.bakeLayer(useSlimModel ? ModelLayers.PLAYER_SLIM : ModelLayers.PLAYER), useSlimModel), 0.5F); this.addLayer( new HumanoidArmorLayer<>( this, new HumanoidArmorModel(context.bakeLayer(useSlimModel ? ModelLayers.PLAYER_SLIM_INNER_ARMOR : ModelLayers.PLAYER_INNER_ARMOR)), new HumanoidArmorModel(context.bakeLayer(useSlimModel ? ModelLayers.PLAYER_SLIM_OUTER_ARMOR : ModelLayers.PLAYER_OUTER_ARMOR)), - context.getModelManager() + context.getEquipmentRenderer() ) ); - this.addLayer(new PlayerItemInHandLayer<>(this, context.getItemInHandRenderer())); - this.addLayer(new ArrowLayer<>(context, this)); - this.addLayer(new Deadmau5EarsLayer(this)); - this.addLayer(new CapeLayer(this)); - this.addLayer(new CustomHeadLayer<>(this, context.getModelSet(), context.getItemInHandRenderer())); - this.addLayer(new ElytraLayer<>(this, context.getModelSet())); - this.addLayer(new ParrotOnShoulderLayer<>(this, context.getModelSet())); - this.addLayer(new SpinAttackEffectLayer<>(this, context.getModelSet())); - this.addLayer(new BeeStingerLayer<>(this)); + this.addLayer(new PlayerItemInHandLayer<>(this, context.getItemRenderer())); + this.addLayer(new ArrowLayer<>(this, context)); + this.addLayer(new Deadmau5EarsLayer(this, context.getModelSet())); + this.addLayer(new CapeLayer(this, context.getModelSet(), context.getEquipmentModels())); + this.addLayer(new CustomHeadLayer<>(this, context.getModelSet(), context.getItemRenderer())); + this.addLayer(new WingsLayer<>(this, context.getModelSet(), context.getEquipmentRenderer())); + this.addLayer(new ParrotOnShoulderLayer(this, context.getModelSet())); + this.addLayer(new SpinAttackEffectLayer(this, context.getModelSet())); + this.addLayer(new BeeStingerLayer<>(this, context)); } - public void render(AbstractClientPlayer entity, float entityYaw, float partialTicks, PoseStack poseStack, MultiBufferSource buffer, int packedLight) { - this.setModelProperties(entity); - super.render(entity, entityYaw, partialTicks, poseStack, buffer, packedLight); + protected boolean shouldRenderLayers(PlayerRenderState playerRenderState) { + return !playerRenderState.isSpectator; } - public Vec3 getRenderOffset(AbstractClientPlayer entity, float partialTicks) { - return entity.isCrouching() ? new Vec3(0.0, entity.getScale() * -2.0F / 16.0, 0.0) : super.getRenderOffset(entity, partialTicks); + public Vec3 getRenderOffset(PlayerRenderState playerRenderState) { + Vec3 vec3 = super.getRenderOffset(playerRenderState); + return playerRenderState.isCrouching ? vec3.add(0.0, playerRenderState.scale * -2.0F / 16.0, 0.0) : vec3; } - private void setModelProperties(AbstractClientPlayer clientPlayer) { - PlayerModel playerModel = this.getModel(); - if (clientPlayer.isSpectator()) { - playerModel.setAllVisible(false); - playerModel.head.visible = true; - playerModel.hat.visible = true; - } else { - playerModel.setAllVisible(true); - playerModel.hat.visible = clientPlayer.isModelPartShown(PlayerModelPart.HAT); - playerModel.jacket.visible = clientPlayer.isModelPartShown(PlayerModelPart.JACKET); - playerModel.leftPants.visible = clientPlayer.isModelPartShown(PlayerModelPart.LEFT_PANTS_LEG); - playerModel.rightPants.visible = clientPlayer.isModelPartShown(PlayerModelPart.RIGHT_PANTS_LEG); - playerModel.leftSleeve.visible = clientPlayer.isModelPartShown(PlayerModelPart.LEFT_SLEEVE); - playerModel.rightSleeve.visible = clientPlayer.isModelPartShown(PlayerModelPart.RIGHT_SLEEVE); - playerModel.crouching = clientPlayer.isCrouching(); - HumanoidModel.ArmPose armPose = getArmPose(clientPlayer, InteractionHand.MAIN_HAND); - HumanoidModel.ArmPose armPose2 = getArmPose(clientPlayer, InteractionHand.OFF_HAND); - if (armPose.isTwoHanded()) { - armPose2 = clientPlayer.getOffhandItem().isEmpty() ? HumanoidModel.ArmPose.EMPTY : HumanoidModel.ArmPose.ITEM; - } - - if (clientPlayer.getMainArm() == HumanoidArm.RIGHT) { - playerModel.rightArmPose = armPose; - playerModel.leftArmPose = armPose2; - } else { - playerModel.rightArmPose = armPose2; - playerModel.leftArmPose = armPose; - } + public static HumanoidModel.ArmPose getArmPose(PlayerRenderState playerRenderState, HumanoidArm humanoidArm) { + HumanoidModel.ArmPose armPose = getArmPose(playerRenderState, playerRenderState.mainHandState, InteractionHand.MAIN_HAND); + HumanoidModel.ArmPose armPose2 = getArmPose(playerRenderState, playerRenderState.offhandState, InteractionHand.OFF_HAND); + if (armPose.isTwoHanded()) { + armPose2 = playerRenderState.offhandState.isEmpty ? HumanoidModel.ArmPose.EMPTY : HumanoidModel.ArmPose.ITEM; } + + return playerRenderState.mainArm == humanoidArm ? armPose : armPose2; } - private static HumanoidModel.ArmPose getArmPose(AbstractClientPlayer player, InteractionHand hand) { - ItemStack itemStack = player.getItemInHand(hand); - if (itemStack.isEmpty()) { + private static HumanoidModel.ArmPose getArmPose(PlayerRenderState playerRenderState, PlayerRenderState.HandState handState, InteractionHand interactionHand) { + if (handState.isEmpty) { return HumanoidModel.ArmPose.EMPTY; } else { - if (player.getUsedItemHand() == hand && player.getUseItemRemainingTicks() > 0) { - UseAnim useAnim = itemStack.getUseAnimation(); - if (useAnim == UseAnim.BLOCK) { + if (playerRenderState.useItemHand == interactionHand && playerRenderState.useItemRemainingTicks > 0) { + ItemUseAnimation itemUseAnimation = handState.useAnimation; + if (itemUseAnimation == ItemUseAnimation.BLOCK) { return HumanoidModel.ArmPose.BLOCK; } - if (useAnim == UseAnim.BOW) { + if (itemUseAnimation == ItemUseAnimation.BOW) { return HumanoidModel.ArmPose.BOW_AND_ARROW; } - if (useAnim == UseAnim.SPEAR) { + if (itemUseAnimation == ItemUseAnimation.SPEAR) { return HumanoidModel.ArmPose.THROW_SPEAR; } - if (useAnim == UseAnim.CROSSBOW && hand == player.getUsedItemHand()) { + if (itemUseAnimation == ItemUseAnimation.CROSSBOW) { return HumanoidModel.ArmPose.CROSSBOW_CHARGE; } - if (useAnim == UseAnim.SPYGLASS) { + if (itemUseAnimation == ItemUseAnimation.SPYGLASS) { return HumanoidModel.ArmPose.SPYGLASS; } - if (useAnim == UseAnim.TOOT_HORN) { + if (itemUseAnimation == ItemUseAnimation.TOOT_HORN) { return HumanoidModel.ArmPose.TOOT_HORN; } - if (useAnim == UseAnim.BRUSH) { + if (itemUseAnimation == ItemUseAnimation.BRUSH) { return HumanoidModel.ArmPose.BRUSH; } - } else if (!player.swinging && itemStack.is(Items.CROSSBOW) && CrossbowItem.isCharged(itemStack)) { + } else if (!playerRenderState.swinging && handState.holdsChargedCrossbow) { return HumanoidModel.ArmPose.CROSSBOW_HOLD; } @@ -148,99 +132,166 @@ public class PlayerRenderer extends LivingEntityRenderer playerModel = this.getModel(); - this.setModelProperties(player); - playerModel.attackTime = 0.0F; - playerModel.crouching = false; - playerModel.swimAmount = 0.0F; - playerModel.setupAnim(player, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F); - rendererArm.xRot = 0.0F; - ResourceLocation resourceLocation = player.getSkin().texture(); - rendererArm.render(poseStack, buffer.getBuffer(RenderType.entitySolid(resourceLocation)), combinedLight, OverlayTexture.NO_OVERLAY); - rendererArmwear.xRot = 0.0F; - rendererArmwear.render(poseStack, buffer.getBuffer(RenderType.entityTranslucent(resourceLocation)), combinedLight, OverlayTexture.NO_OVERLAY); + private static void extractFlightData(AbstractClientPlayer abstractClientPlayer, PlayerRenderState playerRenderState, float f) { + playerRenderState.fallFlyingTimeInTicks = abstractClientPlayer.getFallFlyingTicks() + f; + Vec3 vec3 = abstractClientPlayer.getViewVector(f); + Vec3 vec32 = abstractClientPlayer.getDeltaMovementLerped(f); + double d = vec32.horizontalDistanceSqr(); + double e = vec3.horizontalDistanceSqr(); + if (d > 0.0 && e > 0.0) { + playerRenderState.shouldApplyFlyingYRot = true; + double g = (vec32.x * vec3.x + vec32.z * vec3.z) / Math.sqrt(d * e); + double h = vec32.x * vec3.z - vec32.z * vec3.x; + playerRenderState.flyingYRot = (float)(Math.signum(h) * Math.acos(g)); + } else { + playerRenderState.shouldApplyFlyingYRot = false; + playerRenderState.flyingYRot = 0.0F; + } } - protected void setupRotations(AbstractClientPlayer entity, PoseStack poseStack, float bob, float yBodyRot, float partialTick, float scale) { - float f = entity.getSwimAmount(partialTick); - float g = entity.getViewXRot(partialTick); - if (entity.isFallFlying()) { - super.setupRotations(entity, poseStack, bob, yBodyRot, partialTick, scale); - float h = entity.getFallFlyingTicks() + partialTick; - float i = Mth.clamp(h * h / 100.0F, 0.0F, 1.0F); - if (!entity.isAutoSpinAttack()) { - poseStack.mulPose(Axis.XP.rotationDegrees(i * (-90.0F - g))); + private void extractHandState(AbstractClientPlayer abstractClientPlayer, PlayerRenderState.HandState handState, InteractionHand interactionHand) { + ItemStack itemStack = abstractClientPlayer.getItemInHand(interactionHand); + handState.isEmpty = itemStack.isEmpty(); + handState.useAnimation = !itemStack.isEmpty() ? itemStack.getUseAnimation() : null; + handState.holdsChargedCrossbow = itemStack.is(Items.CROSSBOW) && CrossbowItem.isCharged(itemStack); + } + + private static void extractCapeState(AbstractClientPlayer abstractClientPlayer, PlayerRenderState playerRenderState, float f) { + double d = Mth.lerp((double)f, abstractClientPlayer.xCloakO, abstractClientPlayer.xCloak) + - Mth.lerp((double)f, abstractClientPlayer.xo, abstractClientPlayer.getX()); + double e = Mth.lerp((double)f, abstractClientPlayer.yCloakO, abstractClientPlayer.yCloak) + - Mth.lerp((double)f, abstractClientPlayer.yo, abstractClientPlayer.getY()); + double g = Mth.lerp((double)f, abstractClientPlayer.zCloakO, abstractClientPlayer.zCloak) + - Mth.lerp((double)f, abstractClientPlayer.zo, abstractClientPlayer.getZ()); + float h = Mth.rotLerp(f, abstractClientPlayer.yBodyRotO, abstractClientPlayer.yBodyRot); + double i = Mth.sin(h * (float) (Math.PI / 180.0)); + double j = -Mth.cos(h * (float) (Math.PI / 180.0)); + playerRenderState.capeFlap = (float)e * 10.0F; + playerRenderState.capeFlap = Mth.clamp(playerRenderState.capeFlap, -6.0F, 32.0F); + playerRenderState.capeLean = (float)(d * i + g * j) * 100.0F; + playerRenderState.capeLean = playerRenderState.capeLean * (1.0F - playerRenderState.fallFlyingScale()); + playerRenderState.capeLean = Mth.clamp(playerRenderState.capeLean, 0.0F, 150.0F); + playerRenderState.capeLean2 = (float)(d * j - g * i) * 100.0F; + playerRenderState.capeLean2 = Mth.clamp(playerRenderState.capeLean2, -20.0F, 20.0F); + float k = Mth.lerp(f, abstractClientPlayer.oBob, abstractClientPlayer.bob); + float l = Mth.lerp(f, abstractClientPlayer.walkDistO, abstractClientPlayer.walkDist); + playerRenderState.capeFlap = playerRenderState.capeFlap + Mth.sin(l * 6.0F) * 32.0F * k; + } + + @Nullable + private static Parrot.Variant getParrotOnShoulder(AbstractClientPlayer abstractClientPlayer, boolean bl) { + CompoundTag compoundTag = bl ? abstractClientPlayer.getShoulderEntityLeft() : abstractClientPlayer.getShoulderEntityRight(); + return EntityType.byString(compoundTag.getString("id")).filter(entityType -> entityType == EntityType.PARROT).isPresent() + ? Parrot.Variant.byId(compoundTag.getInt("Variant")) + : null; + } + + public void renderRightHand(PoseStack poseStack, MultiBufferSource multiBufferSource, int i, ResourceLocation resourceLocation, boolean bl) { + this.renderHand(poseStack, multiBufferSource, i, resourceLocation, this.model.rightArm, bl); + } + + public void renderLeftHand(PoseStack poseStack, MultiBufferSource multiBufferSource, int i, ResourceLocation resourceLocation, boolean bl) { + this.renderHand(poseStack, multiBufferSource, i, resourceLocation, this.model.leftArm, bl); + } + + private void renderHand(PoseStack poseStack, MultiBufferSource multiBufferSource, int i, ResourceLocation resourceLocation, ModelPart modelPart, boolean bl) { + PlayerModel playerModel = this.getModel(); + modelPart.resetPose(); + modelPart.visible = true; + playerModel.leftSleeve.visible = bl; + playerModel.rightSleeve.visible = bl; + playerModel.leftArm.zRot = -0.1F; + playerModel.rightArm.zRot = 0.1F; + modelPart.render(poseStack, multiBufferSource.getBuffer(RenderType.entityTranslucent(resourceLocation)), i, OverlayTexture.NO_OVERLAY); + } + + protected void setupRotations(PlayerRenderState playerRenderState, PoseStack poseStack, float f, float g) { + float h = playerRenderState.swimAmount; + float i = playerRenderState.xRot; + if (playerRenderState.isFallFlying) { + super.setupRotations(playerRenderState, poseStack, f, g); + float j = playerRenderState.fallFlyingScale(); + if (!playerRenderState.isAutoSpinAttack) { + poseStack.mulPose(Axis.XP.rotationDegrees(j * (-90.0F - i))); } - Vec3 vec3 = entity.getViewVector(partialTick); - Vec3 vec32 = entity.getDeltaMovementLerped(partialTick); - double d = vec32.horizontalDistanceSqr(); - double e = vec3.horizontalDistanceSqr(); - if (d > 0.0 && e > 0.0) { - double j = (vec32.x * vec3.x + vec32.z * vec3.z) / Math.sqrt(d * e); - double k = vec32.x * vec3.z - vec32.z * vec3.x; - poseStack.mulPose(Axis.YP.rotation((float)(Math.signum(k) * Math.acos(j)))); + if (playerRenderState.shouldApplyFlyingYRot) { + poseStack.mulPose(Axis.YP.rotation(playerRenderState.flyingYRot)); } - } else if (f > 0.0F) { - super.setupRotations(entity, poseStack, bob, yBodyRot, partialTick, scale); - float hx = entity.isInWater() ? -90.0F - g : -90.0F; - float ix = Mth.lerp(f, 0.0F, hx); - poseStack.mulPose(Axis.XP.rotationDegrees(ix)); - if (entity.isVisuallySwimming()) { + } else if (h > 0.0F) { + super.setupRotations(playerRenderState, poseStack, f, g); + float jx = playerRenderState.isInWater ? -90.0F - i : -90.0F; + float k = Mth.lerp(h, 0.0F, jx); + poseStack.mulPose(Axis.XP.rotationDegrees(k)); + if (playerRenderState.isVisuallySwimming) { poseStack.translate(0.0F, -1.0F, 0.3F); } } else { - super.setupRotations(entity, poseStack, bob, yBodyRot, partialTick, scale); + super.setupRotations(playerRenderState, poseStack, f, g); } } } diff --git a/net/minecraft/client/renderer/entity/state/AllayRenderState.java b/net/minecraft/client/renderer/entity/state/AllayRenderState.java new file mode 100644 index 00000000..0a7e0085 --- /dev/null +++ b/net/minecraft/client/renderer/entity/state/AllayRenderState.java @@ -0,0 +1,12 @@ +package net.minecraft.client.renderer.entity.state; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; + +@Environment(EnvType.CLIENT) +public class AllayRenderState extends LivingEntityRenderState { + public boolean isDancing; + public boolean isSpinning; + public float spinningProgress; + public float holdingAnimationProgress; +} diff --git a/net/minecraft/client/renderer/entity/state/ArmadilloRenderState.java b/net/minecraft/client/renderer/entity/state/ArmadilloRenderState.java new file mode 100644 index 00000000..9c88714b --- /dev/null +++ b/net/minecraft/client/renderer/entity/state/ArmadilloRenderState.java @@ -0,0 +1,13 @@ +package net.minecraft.client.renderer.entity.state; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.world.entity.AnimationState; + +@Environment(EnvType.CLIENT) +public class ArmadilloRenderState extends LivingEntityRenderState { + public boolean isHidingInShell; + public final AnimationState rollOutAnimationState = new AnimationState(); + public final AnimationState rollUpAnimationState = new AnimationState(); + public final AnimationState peekAnimationState = new AnimationState(); +} diff --git a/net/minecraft/client/renderer/entity/state/ArmorStandRenderState.java b/net/minecraft/client/renderer/entity/state/ArmorStandRenderState.java new file mode 100644 index 00000000..1cd5ada6 --- /dev/null +++ b/net/minecraft/client/renderer/entity/state/ArmorStandRenderState.java @@ -0,0 +1,22 @@ +package net.minecraft.client.renderer.entity.state; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.core.Rotations; +import net.minecraft.world.entity.decoration.ArmorStand; + +@Environment(EnvType.CLIENT) +public class ArmorStandRenderState extends HumanoidRenderState { + public float yRot; + public float wiggle; + public boolean isMarker; + public boolean isSmall; + public boolean showArms; + public boolean showBasePlate = true; + public Rotations headPose = ArmorStand.DEFAULT_HEAD_POSE; + public Rotations bodyPose = ArmorStand.DEFAULT_BODY_POSE; + public Rotations leftArmPose = ArmorStand.DEFAULT_LEFT_ARM_POSE; + public Rotations rightArmPose = ArmorStand.DEFAULT_RIGHT_ARM_POSE; + public Rotations leftLegPose = ArmorStand.DEFAULT_LEFT_LEG_POSE; + public Rotations rightLegPose = ArmorStand.DEFAULT_RIGHT_LEG_POSE; +} diff --git a/net/minecraft/client/renderer/entity/state/ArrowRenderState.java b/net/minecraft/client/renderer/entity/state/ArrowRenderState.java new file mode 100644 index 00000000..57167645 --- /dev/null +++ b/net/minecraft/client/renderer/entity/state/ArrowRenderState.java @@ -0,0 +1,11 @@ +package net.minecraft.client.renderer.entity.state; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; + +@Environment(EnvType.CLIENT) +public class ArrowRenderState extends EntityRenderState { + public float xRot; + public float yRot; + public float shake; +} diff --git a/net/minecraft/client/renderer/entity/state/AxolotlRenderState.java b/net/minecraft/client/renderer/entity/state/AxolotlRenderState.java new file mode 100644 index 00000000..e6918f79 --- /dev/null +++ b/net/minecraft/client/renderer/entity/state/AxolotlRenderState.java @@ -0,0 +1,14 @@ +package net.minecraft.client.renderer.entity.state; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.world.entity.animal.axolotl.Axolotl; + +@Environment(EnvType.CLIENT) +public class AxolotlRenderState extends LivingEntityRenderState { + public Axolotl.Variant variant = Axolotl.Variant.LUCY; + public float playingDeadFactor; + public float movingFactor; + public float inWaterFactor = 1.0F; + public float onGroundFactor; +} diff --git a/net/minecraft/client/renderer/entity/state/BatRenderState.java b/net/minecraft/client/renderer/entity/state/BatRenderState.java new file mode 100644 index 00000000..ac98733b --- /dev/null +++ b/net/minecraft/client/renderer/entity/state/BatRenderState.java @@ -0,0 +1,12 @@ +package net.minecraft.client.renderer.entity.state; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.world.entity.AnimationState; + +@Environment(EnvType.CLIENT) +public class BatRenderState extends LivingEntityRenderState { + public boolean isResting; + public final AnimationState flyAnimationState = new AnimationState(); + public final AnimationState restAnimationState = new AnimationState(); +} diff --git a/net/minecraft/client/renderer/entity/state/BeeRenderState.java b/net/minecraft/client/renderer/entity/state/BeeRenderState.java new file mode 100644 index 00000000..c1ffecfb --- /dev/null +++ b/net/minecraft/client/renderer/entity/state/BeeRenderState.java @@ -0,0 +1,13 @@ +package net.minecraft.client.renderer.entity.state; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; + +@Environment(EnvType.CLIENT) +public class BeeRenderState extends LivingEntityRenderState { + public float rollAmount; + public boolean hasStinger = true; + public boolean isOnGround; + public boolean isAngry; + public boolean hasNectar; +} diff --git a/net/minecraft/client/renderer/entity/state/BlockDisplayEntityRenderState.java b/net/minecraft/client/renderer/entity/state/BlockDisplayEntityRenderState.java new file mode 100644 index 00000000..9f68274b --- /dev/null +++ b/net/minecraft/client/renderer/entity/state/BlockDisplayEntityRenderState.java @@ -0,0 +1,17 @@ +package net.minecraft.client.renderer.entity.state; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.world.entity.Display.BlockDisplay.BlockRenderState; +import org.jetbrains.annotations.Nullable; + +@Environment(EnvType.CLIENT) +public class BlockDisplayEntityRenderState extends DisplayEntityRenderState { + @Nullable + public BlockRenderState blockRenderState; + + @Override + public boolean hasSubState() { + return this.blockRenderState != null; + } +} diff --git a/net/minecraft/client/renderer/entity/state/BoatRenderState.java b/net/minecraft/client/renderer/entity/state/BoatRenderState.java new file mode 100644 index 00000000..c80b0427 --- /dev/null +++ b/net/minecraft/client/renderer/entity/state/BoatRenderState.java @@ -0,0 +1,16 @@ +package net.minecraft.client.renderer.entity.state; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; + +@Environment(EnvType.CLIENT) +public class BoatRenderState extends EntityRenderState { + public float yRot; + public int hurtDir; + public float hurtTime; + public float damageTime; + public float bubbleAngle; + public boolean isUnderWater; + public float rowingTimeLeft; + public float rowingTimeRight; +} diff --git a/net/minecraft/client/renderer/entity/state/BoggedRenderState.java b/net/minecraft/client/renderer/entity/state/BoggedRenderState.java new file mode 100644 index 00000000..1cdf4268 --- /dev/null +++ b/net/minecraft/client/renderer/entity/state/BoggedRenderState.java @@ -0,0 +1,9 @@ +package net.minecraft.client.renderer.entity.state; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; + +@Environment(EnvType.CLIENT) +public class BoggedRenderState extends SkeletonRenderState { + public boolean isSheared; +} diff --git a/net/minecraft/client/renderer/entity/state/BreezeRenderState.java b/net/minecraft/client/renderer/entity/state/BreezeRenderState.java new file mode 100644 index 00000000..7b13b3db --- /dev/null +++ b/net/minecraft/client/renderer/entity/state/BreezeRenderState.java @@ -0,0 +1,15 @@ +package net.minecraft.client.renderer.entity.state; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.world.entity.AnimationState; + +@Environment(EnvType.CLIENT) +public class BreezeRenderState extends LivingEntityRenderState { + public final AnimationState idle = new AnimationState(); + public final AnimationState shoot = new AnimationState(); + public final AnimationState slide = new AnimationState(); + public final AnimationState slideBack = new AnimationState(); + public final AnimationState inhale = new AnimationState(); + public final AnimationState longJump = new AnimationState(); +} diff --git a/net/minecraft/client/renderer/entity/state/CamelRenderState.java b/net/minecraft/client/renderer/entity/state/CamelRenderState.java new file mode 100644 index 00000000..503b895f --- /dev/null +++ b/net/minecraft/client/renderer/entity/state/CamelRenderState.java @@ -0,0 +1,17 @@ +package net.minecraft.client.renderer.entity.state; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.world.entity.AnimationState; + +@Environment(EnvType.CLIENT) +public class CamelRenderState extends LivingEntityRenderState { + public boolean isSaddled; + public boolean isRidden; + public float jumpCooldown; + public final AnimationState sitAnimationState = new AnimationState(); + public final AnimationState sitPoseAnimationState = new AnimationState(); + public final AnimationState sitUpAnimationState = new AnimationState(); + public final AnimationState idleAnimationState = new AnimationState(); + public final AnimationState dashAnimationState = new AnimationState(); +} diff --git a/net/minecraft/client/renderer/entity/state/CatRenderState.java b/net/minecraft/client/renderer/entity/state/CatRenderState.java new file mode 100644 index 00000000..86869e2e --- /dev/null +++ b/net/minecraft/client/renderer/entity/state/CatRenderState.java @@ -0,0 +1,16 @@ +package net.minecraft.client.renderer.entity.state; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.DyeColor; +import org.jetbrains.annotations.Nullable; + +@Environment(EnvType.CLIENT) +public class CatRenderState extends FelineRenderState { + private static final ResourceLocation DEFAULT_TEXTURE = ResourceLocation.withDefaultNamespace("textures/entity/cat/tabby.png"); + public ResourceLocation texture = DEFAULT_TEXTURE; + public boolean isLyingOnTopOfSleepingPlayer; + @Nullable + public DyeColor collarColor; +} diff --git a/net/minecraft/client/renderer/entity/state/ChickenRenderState.java b/net/minecraft/client/renderer/entity/state/ChickenRenderState.java new file mode 100644 index 00000000..203b2fab --- /dev/null +++ b/net/minecraft/client/renderer/entity/state/ChickenRenderState.java @@ -0,0 +1,10 @@ +package net.minecraft.client.renderer.entity.state; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; + +@Environment(EnvType.CLIENT) +public class ChickenRenderState extends LivingEntityRenderState { + public float flap; + public float flapSpeed; +} diff --git a/net/minecraft/client/renderer/entity/state/CreakingRenderState.java b/net/minecraft/client/renderer/entity/state/CreakingRenderState.java new file mode 100644 index 00000000..632802a0 --- /dev/null +++ b/net/minecraft/client/renderer/entity/state/CreakingRenderState.java @@ -0,0 +1,13 @@ +package net.minecraft.client.renderer.entity.state; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.world.entity.AnimationState; + +@Environment(EnvType.CLIENT) +public class CreakingRenderState extends LivingEntityRenderState { + public AnimationState invulnerabilityAnimationState = new AnimationState(); + public AnimationState attackAnimationState = new AnimationState(); + public boolean isActive; + public boolean canMove; +} diff --git a/net/minecraft/client/renderer/entity/state/CreeperRenderState.java b/net/minecraft/client/renderer/entity/state/CreeperRenderState.java new file mode 100644 index 00000000..36497c84 --- /dev/null +++ b/net/minecraft/client/renderer/entity/state/CreeperRenderState.java @@ -0,0 +1,10 @@ +package net.minecraft.client.renderer.entity.state; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; + +@Environment(EnvType.CLIENT) +public class CreeperRenderState extends LivingEntityRenderState { + public float swelling; + public boolean isPowered; +} diff --git a/net/minecraft/client/renderer/entity/state/DisplayEntityRenderState.java b/net/minecraft/client/renderer/entity/state/DisplayEntityRenderState.java new file mode 100644 index 00000000..7d0c5f3e --- /dev/null +++ b/net/minecraft/client/renderer/entity/state/DisplayEntityRenderState.java @@ -0,0 +1,17 @@ +package net.minecraft.client.renderer.entity.state; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.world.entity.Display; +import org.jetbrains.annotations.Nullable; + +@Environment(EnvType.CLIENT) +public abstract class DisplayEntityRenderState extends EntityRenderState { + @Nullable + public Display.RenderState renderState; + public float interpolationProgress; + public float entityYRot; + public float entityXRot; + + public abstract boolean hasSubState(); +} diff --git a/net/minecraft/client/renderer/entity/state/DolphinRenderState.java b/net/minecraft/client/renderer/entity/state/DolphinRenderState.java new file mode 100644 index 00000000..98b14b65 --- /dev/null +++ b/net/minecraft/client/renderer/entity/state/DolphinRenderState.java @@ -0,0 +1,9 @@ +package net.minecraft.client.renderer.entity.state; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; + +@Environment(EnvType.CLIENT) +public class DolphinRenderState extends LivingEntityRenderState { + public boolean isMoving; +} diff --git a/net/minecraft/client/renderer/entity/state/DonkeyRenderState.java b/net/minecraft/client/renderer/entity/state/DonkeyRenderState.java new file mode 100644 index 00000000..c907f139 --- /dev/null +++ b/net/minecraft/client/renderer/entity/state/DonkeyRenderState.java @@ -0,0 +1,9 @@ +package net.minecraft.client.renderer.entity.state; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; + +@Environment(EnvType.CLIENT) +public class DonkeyRenderState extends EquineRenderState { + public boolean hasChest; +} diff --git a/net/minecraft/client/renderer/entity/state/EndCrystalRenderState.java b/net/minecraft/client/renderer/entity/state/EndCrystalRenderState.java new file mode 100644 index 00000000..7bb2f486 --- /dev/null +++ b/net/minecraft/client/renderer/entity/state/EndCrystalRenderState.java @@ -0,0 +1,13 @@ +package net.minecraft.client.renderer.entity.state; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.world.phys.Vec3; +import org.jetbrains.annotations.Nullable; + +@Environment(EnvType.CLIENT) +public class EndCrystalRenderState extends EntityRenderState { + public boolean showsBottom = true; + @Nullable + public Vec3 beamOffset; +} diff --git a/net/minecraft/client/renderer/entity/state/EnderDragonRenderState.java b/net/minecraft/client/renderer/entity/state/EnderDragonRenderState.java new file mode 100644 index 00000000..0eedc9bb --- /dev/null +++ b/net/minecraft/client/renderer/entity/state/EnderDragonRenderState.java @@ -0,0 +1,40 @@ +package net.minecraft.client.renderer.entity.state; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.world.entity.boss.enderdragon.DragonFlightHistory; +import net.minecraft.world.phys.Vec3; +import org.jetbrains.annotations.Nullable; + +@Environment(EnvType.CLIENT) +public class EnderDragonRenderState extends EntityRenderState { + public float flapTime; + public float deathTime; + public boolean hasRedOverlay; + @Nullable + public Vec3 beamOffset; + public boolean isLandingOrTakingOff; + public boolean isSitting; + public double distanceToEgg; + public float partialTicks; + public final DragonFlightHistory flightHistory = new DragonFlightHistory(); + + public DragonFlightHistory.Sample getHistoricalPos(int i) { + return this.flightHistory.get(i, this.partialTicks); + } + + public float getHeadPartYOffset(int i, DragonFlightHistory.Sample sample, DragonFlightHistory.Sample sample2) { + double d; + if (this.isLandingOrTakingOff) { + d = i / Math.max(this.distanceToEgg / 4.0, 1.0); + } else if (this.isSitting) { + d = i; + } else if (i == 6) { + d = 0.0; + } else { + d = sample2.y() - sample.y(); + } + + return (float)d; + } +} diff --git a/net/minecraft/client/renderer/entity/state/EndermanRenderState.java b/net/minecraft/client/renderer/entity/state/EndermanRenderState.java new file mode 100644 index 00000000..b08d48ae --- /dev/null +++ b/net/minecraft/client/renderer/entity/state/EndermanRenderState.java @@ -0,0 +1,13 @@ +package net.minecraft.client.renderer.entity.state; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.world.level.block.state.BlockState; +import org.jetbrains.annotations.Nullable; + +@Environment(EnvType.CLIENT) +public class EndermanRenderState extends HumanoidRenderState { + public boolean isCreepy; + @Nullable + public BlockState carriedBlock; +} diff --git a/net/minecraft/client/renderer/entity/state/EntityRenderState.java b/net/minecraft/client/renderer/entity/state/EntityRenderState.java new file mode 100644 index 00000000..7e7f8336 --- /dev/null +++ b/net/minecraft/client/renderer/entity/state/EntityRenderState.java @@ -0,0 +1,41 @@ +package net.minecraft.client.renderer.entity.state; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.network.chat.Component; +import net.minecraft.world.phys.Vec3; +import org.jetbrains.annotations.Nullable; + +@Environment(EnvType.CLIENT) +public class EntityRenderState { + public double x; + public double y; + public double z; + public float ageInTicks; + public float boundingBoxWidth; + public float boundingBoxHeight; + public float eyeHeight; + public double distanceToCameraSq; + public boolean isInvisible; + public boolean isDiscrete; + public boolean displayFireAnimation; + @Nullable + public Vec3 passengerOffset; + @Nullable + public Component nameTag; + @Nullable + public Vec3 nameTagAttachment; + @Nullable + public EntityRenderState.LeashState leashState; + + @Environment(EnvType.CLIENT) + public static class LeashState { + public Vec3 offset = Vec3.ZERO; + public Vec3 start = Vec3.ZERO; + public Vec3 end = Vec3.ZERO; + public int startBlockLight = 0; + public int endBlockLight = 0; + public int startSkyLight = 15; + public int endSkyLight = 15; + } +} diff --git a/net/minecraft/client/renderer/entity/state/EquineRenderState.java b/net/minecraft/client/renderer/entity/state/EquineRenderState.java new file mode 100644 index 00000000..b27dedc5 --- /dev/null +++ b/net/minecraft/client/renderer/entity/state/EquineRenderState.java @@ -0,0 +1,14 @@ +package net.minecraft.client.renderer.entity.state; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; + +@Environment(EnvType.CLIENT) +public class EquineRenderState extends LivingEntityRenderState { + public boolean isSaddled; + public boolean isRidden; + public boolean animateTail; + public float eatAnimation; + public float standAnimation; + public float feedingAnimation; +} diff --git a/net/minecraft/client/renderer/entity/state/EvokerFangsRenderState.java b/net/minecraft/client/renderer/entity/state/EvokerFangsRenderState.java new file mode 100644 index 00000000..815c2c3a --- /dev/null +++ b/net/minecraft/client/renderer/entity/state/EvokerFangsRenderState.java @@ -0,0 +1,10 @@ +package net.minecraft.client.renderer.entity.state; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; + +@Environment(EnvType.CLIENT) +public class EvokerFangsRenderState extends EntityRenderState { + public float yRot; + public float biteProgress; +} diff --git a/net/minecraft/client/renderer/entity/state/EvokerRenderState.java b/net/minecraft/client/renderer/entity/state/EvokerRenderState.java new file mode 100644 index 00000000..772282c8 --- /dev/null +++ b/net/minecraft/client/renderer/entity/state/EvokerRenderState.java @@ -0,0 +1,9 @@ +package net.minecraft.client.renderer.entity.state; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; + +@Environment(EnvType.CLIENT) +public class EvokerRenderState extends IllagerRenderState { + public boolean isCastingSpell; +} diff --git a/net/minecraft/client/renderer/entity/state/ExperienceOrbRenderState.java b/net/minecraft/client/renderer/entity/state/ExperienceOrbRenderState.java new file mode 100644 index 00000000..a1c52578 --- /dev/null +++ b/net/minecraft/client/renderer/entity/state/ExperienceOrbRenderState.java @@ -0,0 +1,9 @@ +package net.minecraft.client.renderer.entity.state; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; + +@Environment(EnvType.CLIENT) +public class ExperienceOrbRenderState extends EntityRenderState { + public int icon; +} diff --git a/net/minecraft/client/renderer/entity/state/FallingBlockRenderState.java b/net/minecraft/client/renderer/entity/state/FallingBlockRenderState.java new file mode 100644 index 00000000..ca06af4c --- /dev/null +++ b/net/minecraft/client/renderer/entity/state/FallingBlockRenderState.java @@ -0,0 +1,68 @@ +package net.minecraft.client.renderer.entity.state; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.core.Holder; +import net.minecraft.world.level.BlockAndTintGetter; +import net.minecraft.world.level.ColorResolver; +import net.minecraft.world.level.EmptyBlockAndTintGetter; +import net.minecraft.world.level.biome.Biome; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.lighting.LevelLightEngine; +import net.minecraft.world.level.material.FluidState; +import org.jetbrains.annotations.Nullable; + +@Environment(EnvType.CLIENT) +public class FallingBlockRenderState extends EntityRenderState implements BlockAndTintGetter { + public BlockPos startBlockPos = BlockPos.ZERO; + public BlockPos blockPos = BlockPos.ZERO; + public BlockState blockState = Blocks.SAND.defaultBlockState(); + @Nullable + public Holder biome; + public BlockAndTintGetter level = EmptyBlockAndTintGetter.INSTANCE; + + @Override + public float getShade(Direction direction, boolean shade) { + return this.level.getShade(direction, shade); + } + + @Override + public LevelLightEngine getLightEngine() { + return this.level.getLightEngine(); + } + + @Override + public int getBlockTint(BlockPos blockPos, ColorResolver colorResolver) { + return this.biome == null ? -1 : colorResolver.getColor(this.biome.value(), blockPos.getX(), blockPos.getZ()); + } + + @Nullable + @Override + public BlockEntity getBlockEntity(BlockPos pos) { + return null; + } + + @Override + public BlockState getBlockState(BlockPos pos) { + return pos.equals(this.blockPos) ? this.blockState : Blocks.AIR.defaultBlockState(); + } + + @Override + public FluidState getFluidState(BlockPos pos) { + return this.getBlockState(pos).getFluidState(); + } + + @Override + public int getHeight() { + return 1; + } + + @Override + public int getMinY() { + return this.blockPos.getY(); + } +} diff --git a/net/minecraft/client/renderer/entity/state/FelineRenderState.java b/net/minecraft/client/renderer/entity/state/FelineRenderState.java new file mode 100644 index 00000000..ff433d7a --- /dev/null +++ b/net/minecraft/client/renderer/entity/state/FelineRenderState.java @@ -0,0 +1,14 @@ +package net.minecraft.client.renderer.entity.state; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; + +@Environment(EnvType.CLIENT) +public class FelineRenderState extends LivingEntityRenderState { + public boolean isCrouching; + public boolean isSprinting; + public boolean isSitting; + public float lieDownAmount; + public float lieDownAmountTail; + public float relaxStateOneAmount; +} diff --git a/net/minecraft/client/renderer/entity/state/FireworkRocketRenderState.java b/net/minecraft/client/renderer/entity/state/FireworkRocketRenderState.java new file mode 100644 index 00000000..12334e2a --- /dev/null +++ b/net/minecraft/client/renderer/entity/state/FireworkRocketRenderState.java @@ -0,0 +1,15 @@ +package net.minecraft.client.renderer.entity.state; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.client.resources.model.BakedModel; +import net.minecraft.world.item.ItemStack; +import org.jetbrains.annotations.Nullable; + +@Environment(EnvType.CLIENT) +public class FireworkRocketRenderState extends EntityRenderState { + public boolean isShotAtAngle; + @Nullable + public BakedModel itemModel; + public ItemStack item = ItemStack.EMPTY; +} diff --git a/net/minecraft/client/renderer/entity/state/FishingHookRenderState.java b/net/minecraft/client/renderer/entity/state/FishingHookRenderState.java new file mode 100644 index 00000000..1ac7932b --- /dev/null +++ b/net/minecraft/client/renderer/entity/state/FishingHookRenderState.java @@ -0,0 +1,10 @@ +package net.minecraft.client.renderer.entity.state; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.world.phys.Vec3; + +@Environment(EnvType.CLIENT) +public class FishingHookRenderState extends EntityRenderState { + public Vec3 lineOriginOffset = Vec3.ZERO; +} diff --git a/net/minecraft/client/renderer/entity/state/FoxRenderState.java b/net/minecraft/client/renderer/entity/state/FoxRenderState.java new file mode 100644 index 00000000..679e2d4e --- /dev/null +++ b/net/minecraft/client/renderer/entity/state/FoxRenderState.java @@ -0,0 +1,17 @@ +package net.minecraft.client.renderer.entity.state; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.world.entity.animal.Fox; + +@Environment(EnvType.CLIENT) +public class FoxRenderState extends LivingEntityRenderState { + public float headRollAngle; + public float crouchAmount; + public boolean isCrouching; + public boolean isSleeping; + public boolean isSitting; + public boolean isFaceplanted; + public boolean isPouncing; + public Fox.Variant variant = Fox.Variant.RED; +} diff --git a/net/minecraft/client/renderer/entity/state/FrogRenderState.java b/net/minecraft/client/renderer/entity/state/FrogRenderState.java new file mode 100644 index 00000000..47753926 --- /dev/null +++ b/net/minecraft/client/renderer/entity/state/FrogRenderState.java @@ -0,0 +1,17 @@ +package net.minecraft.client.renderer.entity.state; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.AnimationState; + +@Environment(EnvType.CLIENT) +public class FrogRenderState extends LivingEntityRenderState { + private static final ResourceLocation DEFAULT_TEXTURE = ResourceLocation.withDefaultNamespace("textures/entity/frog/temperate_frog.png"); + public boolean isSwimming; + public final AnimationState jumpAnimationState = new AnimationState(); + public final AnimationState croakAnimationState = new AnimationState(); + public final AnimationState tongueAnimationState = new AnimationState(); + public final AnimationState swimIdleAnimationState = new AnimationState(); + public ResourceLocation texture = DEFAULT_TEXTURE; +} diff --git a/net/minecraft/client/renderer/entity/state/GhastRenderState.java b/net/minecraft/client/renderer/entity/state/GhastRenderState.java new file mode 100644 index 00000000..cdeb5133 --- /dev/null +++ b/net/minecraft/client/renderer/entity/state/GhastRenderState.java @@ -0,0 +1,9 @@ +package net.minecraft.client.renderer.entity.state; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; + +@Environment(EnvType.CLIENT) +public class GhastRenderState extends LivingEntityRenderState { + public boolean isCharging; +} diff --git a/net/minecraft/client/renderer/entity/state/GoatRenderState.java b/net/minecraft/client/renderer/entity/state/GoatRenderState.java new file mode 100644 index 00000000..7116f549 --- /dev/null +++ b/net/minecraft/client/renderer/entity/state/GoatRenderState.java @@ -0,0 +1,11 @@ +package net.minecraft.client.renderer.entity.state; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; + +@Environment(EnvType.CLIENT) +public class GoatRenderState extends LivingEntityRenderState { + public boolean hasLeftHorn = true; + public boolean hasRightHorn = true; + public float rammingXHeadRot; +} diff --git a/net/minecraft/client/renderer/entity/state/GuardianRenderState.java b/net/minecraft/client/renderer/entity/state/GuardianRenderState.java new file mode 100644 index 00000000..51f6f546 --- /dev/null +++ b/net/minecraft/client/renderer/entity/state/GuardianRenderState.java @@ -0,0 +1,21 @@ +package net.minecraft.client.renderer.entity.state; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.world.phys.Vec3; +import org.jetbrains.annotations.Nullable; + +@Environment(EnvType.CLIENT) +public class GuardianRenderState extends LivingEntityRenderState { + public float spikesAnimation; + public float tailAnimation; + public Vec3 eyePosition = Vec3.ZERO; + @Nullable + public Vec3 lookDirection; + @Nullable + public Vec3 lookAtPosition; + @Nullable + public Vec3 attackTargetPosition; + public float attackTime; + public float attackScale; +} diff --git a/net/minecraft/client/renderer/entity/state/HoglinRenderState.java b/net/minecraft/client/renderer/entity/state/HoglinRenderState.java new file mode 100644 index 00000000..1dc35063 --- /dev/null +++ b/net/minecraft/client/renderer/entity/state/HoglinRenderState.java @@ -0,0 +1,10 @@ +package net.minecraft.client.renderer.entity.state; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; + +@Environment(EnvType.CLIENT) +public class HoglinRenderState extends LivingEntityRenderState { + public int attackAnimationRemainingTicks; + public boolean isConverting; +} diff --git a/net/minecraft/client/renderer/entity/state/HorseRenderState.java b/net/minecraft/client/renderer/entity/state/HorseRenderState.java new file mode 100644 index 00000000..4f1922f7 --- /dev/null +++ b/net/minecraft/client/renderer/entity/state/HorseRenderState.java @@ -0,0 +1,14 @@ +package net.minecraft.client.renderer.entity.state; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.world.entity.animal.horse.Markings; +import net.minecraft.world.entity.animal.horse.Variant; +import net.minecraft.world.item.ItemStack; + +@Environment(EnvType.CLIENT) +public class HorseRenderState extends EquineRenderState { + public Variant variant = Variant.WHITE; + public Markings markings = Markings.NONE; + public ItemStack bodyArmorItem = ItemStack.EMPTY; +} diff --git a/net/minecraft/client/renderer/entity/state/HumanoidRenderState.java b/net/minecraft/client/renderer/entity/state/HumanoidRenderState.java new file mode 100644 index 00000000..7ee311a2 --- /dev/null +++ b/net/minecraft/client/renderer/entity/state/HumanoidRenderState.java @@ -0,0 +1,29 @@ +package net.minecraft.client.renderer.entity.state; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.entity.HumanoidArm; +import net.minecraft.world.item.ItemStack; + +@Environment(EnvType.CLIENT) +public class HumanoidRenderState extends LivingEntityRenderState { + public float swimAmount; + public float attackTime; + public float speedValue = 1.0F; + public float maxCrossbowChargeDuration; + public int ticksUsingItem; + public HumanoidArm attackArm = HumanoidArm.RIGHT; + public InteractionHand useItemHand = InteractionHand.MAIN_HAND; + public boolean isCrouching; + public boolean isFallFlying; + public boolean isVisuallySwimming; + public boolean isPassenger; + public boolean isUsingItem; + public float elytraRotX; + public float elytraRotY; + public float elytraRotZ; + public ItemStack chestItem = ItemStack.EMPTY; + public ItemStack legsItem = ItemStack.EMPTY; + public ItemStack feetItem = ItemStack.EMPTY; +} diff --git a/net/minecraft/client/renderer/entity/state/IllagerRenderState.java b/net/minecraft/client/renderer/entity/state/IllagerRenderState.java new file mode 100644 index 00000000..bdc13880 --- /dev/null +++ b/net/minecraft/client/renderer/entity/state/IllagerRenderState.java @@ -0,0 +1,17 @@ +package net.minecraft.client.renderer.entity.state; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.world.entity.HumanoidArm; +import net.minecraft.world.entity.monster.AbstractIllager; + +@Environment(EnvType.CLIENT) +public class IllagerRenderState extends LivingEntityRenderState { + public boolean isRiding; + public boolean isAggressive; + public HumanoidArm mainArm = HumanoidArm.RIGHT; + public AbstractIllager.IllagerArmPose armPose = AbstractIllager.IllagerArmPose.NEUTRAL; + public int maxCrossbowChargeDuration; + public int ticksUsingItem; + public float attackAnim; +} diff --git a/net/minecraft/client/renderer/entity/state/IllusionerRenderState.java b/net/minecraft/client/renderer/entity/state/IllusionerRenderState.java new file mode 100644 index 00000000..42d1d298 --- /dev/null +++ b/net/minecraft/client/renderer/entity/state/IllusionerRenderState.java @@ -0,0 +1,11 @@ +package net.minecraft.client.renderer.entity.state; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.world.phys.Vec3; + +@Environment(EnvType.CLIENT) +public class IllusionerRenderState extends IllagerRenderState { + public Vec3[] illusionOffsets = new Vec3[0]; + public boolean isCastingSpell; +} diff --git a/net/minecraft/client/renderer/entity/state/IronGolemRenderState.java b/net/minecraft/client/renderer/entity/state/IronGolemRenderState.java new file mode 100644 index 00000000..1490aa53 --- /dev/null +++ b/net/minecraft/client/renderer/entity/state/IronGolemRenderState.java @@ -0,0 +1,12 @@ +package net.minecraft.client.renderer.entity.state; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.world.entity.Crackiness.Level; + +@Environment(EnvType.CLIENT) +public class IronGolemRenderState extends LivingEntityRenderState { + public float attackTicksRemaining; + public int offerFlowerTick; + public Level crackiness = Level.NONE; +} diff --git a/net/minecraft/client/renderer/entity/state/ItemDisplayEntityRenderState.java b/net/minecraft/client/renderer/entity/state/ItemDisplayEntityRenderState.java new file mode 100644 index 00000000..b68b96a6 --- /dev/null +++ b/net/minecraft/client/renderer/entity/state/ItemDisplayEntityRenderState.java @@ -0,0 +1,20 @@ +package net.minecraft.client.renderer.entity.state; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.client.resources.model.BakedModel; +import net.minecraft.world.entity.Display.ItemDisplay.ItemRenderState; +import org.jetbrains.annotations.Nullable; + +@Environment(EnvType.CLIENT) +public class ItemDisplayEntityRenderState extends DisplayEntityRenderState { + @Nullable + public ItemRenderState itemRenderState; + @Nullable + public BakedModel itemModel; + + @Override + public boolean hasSubState() { + return this.itemRenderState != null && this.itemModel != null; + } +} diff --git a/net/minecraft/client/renderer/entity/state/ItemEntityRenderState.java b/net/minecraft/client/renderer/entity/state/ItemEntityRenderState.java new file mode 100644 index 00000000..9613cf20 --- /dev/null +++ b/net/minecraft/client/renderer/entity/state/ItemEntityRenderState.java @@ -0,0 +1,15 @@ +package net.minecraft.client.renderer.entity.state; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.client.resources.model.BakedModel; +import net.minecraft.world.item.ItemStack; +import org.jetbrains.annotations.Nullable; + +@Environment(EnvType.CLIENT) +public class ItemEntityRenderState extends EntityRenderState { + public float bobOffset; + @Nullable + public BakedModel itemModel; + public ItemStack item = ItemStack.EMPTY; +} diff --git a/net/minecraft/client/renderer/entity/state/ItemFrameRenderState.java b/net/minecraft/client/renderer/entity/state/ItemFrameRenderState.java new file mode 100644 index 00000000..93a93232 --- /dev/null +++ b/net/minecraft/client/renderer/entity/state/ItemFrameRenderState.java @@ -0,0 +1,23 @@ +package net.minecraft.client.renderer.entity.state; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.client.renderer.state.MapRenderState; +import net.minecraft.client.resources.model.BakedModel; +import net.minecraft.core.Direction; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.saveddata.maps.MapId; +import org.jetbrains.annotations.Nullable; + +@Environment(EnvType.CLIENT) +public class ItemFrameRenderState extends EntityRenderState { + public Direction direction = Direction.NORTH; + public ItemStack itemStack = ItemStack.EMPTY; + public int rotation; + public boolean isGlowFrame; + @Nullable + public BakedModel itemModel; + @Nullable + public MapId mapId; + public final MapRenderState mapRenderState = new MapRenderState(); +} diff --git a/net/minecraft/client/renderer/entity/state/LightningBoltRenderState.java b/net/minecraft/client/renderer/entity/state/LightningBoltRenderState.java new file mode 100644 index 00000000..847865a1 --- /dev/null +++ b/net/minecraft/client/renderer/entity/state/LightningBoltRenderState.java @@ -0,0 +1,9 @@ +package net.minecraft.client.renderer.entity.state; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; + +@Environment(EnvType.CLIENT) +public class LightningBoltRenderState extends EntityRenderState { + public long seed; +} diff --git a/net/minecraft/client/renderer/entity/state/LivingEntityRenderState.java b/net/minecraft/client/renderer/entity/state/LivingEntityRenderState.java new file mode 100644 index 00000000..0244a952 --- /dev/null +++ b/net/minecraft/client/renderer/entity/state/LivingEntityRenderState.java @@ -0,0 +1,60 @@ +package net.minecraft.client.renderer.entity.state; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.client.resources.model.BakedModel; +import net.minecraft.core.Direction; +import net.minecraft.network.chat.Component; +import net.minecraft.world.entity.HumanoidArm; +import net.minecraft.world.entity.Pose; +import net.minecraft.world.item.ItemStack; +import org.jetbrains.annotations.Nullable; + +@Environment(EnvType.CLIENT) +public class LivingEntityRenderState extends EntityRenderState { + public float bodyRot; + public float yRot; + public float xRot; + public float deathTime; + public float walkAnimationPos; + public float walkAnimationSpeed; + public float wornHeadAnimationPos; + public float scale = 1.0F; + public float ageScale = 1.0F; + public boolean isUpsideDown; + public boolean isFullyFrozen; + public boolean isBaby; + public boolean isInWater; + public boolean isAutoSpinAttack; + public boolean hasRedOverlay; + public boolean isInvisibleToPlayer; + public boolean appearsGlowing; + @Nullable + public Direction bedOrientation; + @Nullable + public Component customName; + public Pose pose = Pose.STANDING; + @Nullable + public BakedModel headItemModel; + public ItemStack headItem = ItemStack.EMPTY; + public HumanoidArm mainArm = HumanoidArm.RIGHT; + @Nullable + public BakedModel rightHandItemModel; + public ItemStack rightHandItem = ItemStack.EMPTY; + @Nullable + public BakedModel leftHandItemModel; + public ItemStack leftHandItem = ItemStack.EMPTY; + + public ItemStack getMainHandItem() { + return this.mainArm == HumanoidArm.RIGHT ? this.rightHandItem : this.leftHandItem; + } + + @Nullable + public BakedModel getMainHandItemModel() { + return this.mainArm == HumanoidArm.RIGHT ? this.rightHandItemModel : this.leftHandItemModel; + } + + public boolean hasPose(Pose pose) { + return this.pose == pose; + } +} diff --git a/net/minecraft/client/renderer/entity/state/LlamaRenderState.java b/net/minecraft/client/renderer/entity/state/LlamaRenderState.java new file mode 100644 index 00000000..6cde9d20 --- /dev/null +++ b/net/minecraft/client/renderer/entity/state/LlamaRenderState.java @@ -0,0 +1,14 @@ +package net.minecraft.client.renderer.entity.state; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.world.entity.animal.horse.Llama; +import net.minecraft.world.item.ItemStack; + +@Environment(EnvType.CLIENT) +public class LlamaRenderState extends LivingEntityRenderState { + public Llama.Variant variant = Llama.Variant.CREAMY; + public boolean hasChest; + public ItemStack bodyItem = ItemStack.EMPTY; + public boolean isTraderLlama; +} diff --git a/net/minecraft/client/renderer/entity/state/LlamaSpitRenderState.java b/net/minecraft/client/renderer/entity/state/LlamaSpitRenderState.java new file mode 100644 index 00000000..02861312 --- /dev/null +++ b/net/minecraft/client/renderer/entity/state/LlamaSpitRenderState.java @@ -0,0 +1,10 @@ +package net.minecraft.client.renderer.entity.state; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; + +@Environment(EnvType.CLIENT) +public class LlamaSpitRenderState extends EntityRenderState { + public float yRot; + public float xRot; +} diff --git a/net/minecraft/client/renderer/entity/state/MinecartRenderState.java b/net/minecraft/client/renderer/entity/state/MinecartRenderState.java new file mode 100644 index 00000000..517d4096 --- /dev/null +++ b/net/minecraft/client/renderer/entity/state/MinecartRenderState.java @@ -0,0 +1,29 @@ +package net.minecraft.client.renderer.entity.state; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.Vec3; +import org.jetbrains.annotations.Nullable; + +@Environment(EnvType.CLIENT) +public class MinecartRenderState extends EntityRenderState { + public float xRot; + public float yRot; + public long offsetSeed; + public int hurtDir; + public float hurtTime; + public float damageTime; + public int displayOffset; + public BlockState displayBlockState = Blocks.AIR.defaultBlockState(); + public boolean isNewRender; + @Nullable + public Vec3 renderPos; + @Nullable + public Vec3 posOnRail; + @Nullable + public Vec3 frontPos; + @Nullable + public Vec3 backPos; +} diff --git a/net/minecraft/client/renderer/entity/state/MinecartTntRenderState.java b/net/minecraft/client/renderer/entity/state/MinecartTntRenderState.java new file mode 100644 index 00000000..3df72cea --- /dev/null +++ b/net/minecraft/client/renderer/entity/state/MinecartTntRenderState.java @@ -0,0 +1,9 @@ +package net.minecraft.client.renderer.entity.state; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; + +@Environment(EnvType.CLIENT) +public class MinecartTntRenderState extends MinecartRenderState { + public float fuseRemainingInTicks = -1.0F; +} diff --git a/net/minecraft/client/renderer/entity/state/MushroomCowRenderState.java b/net/minecraft/client/renderer/entity/state/MushroomCowRenderState.java new file mode 100644 index 00000000..d2530ec1 --- /dev/null +++ b/net/minecraft/client/renderer/entity/state/MushroomCowRenderState.java @@ -0,0 +1,10 @@ +package net.minecraft.client.renderer.entity.state; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.world.entity.animal.MushroomCow; + +@Environment(EnvType.CLIENT) +public class MushroomCowRenderState extends LivingEntityRenderState { + public MushroomCow.Variant variant = MushroomCow.Variant.RED; +} diff --git a/net/minecraft/client/renderer/entity/state/OminousItemSpawnerRenderState.java b/net/minecraft/client/renderer/entity/state/OminousItemSpawnerRenderState.java new file mode 100644 index 00000000..b50f1159 --- /dev/null +++ b/net/minecraft/client/renderer/entity/state/OminousItemSpawnerRenderState.java @@ -0,0 +1,14 @@ +package net.minecraft.client.renderer.entity.state; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.client.resources.model.BakedModel; +import net.minecraft.world.item.ItemStack; +import org.jetbrains.annotations.Nullable; + +@Environment(EnvType.CLIENT) +public class OminousItemSpawnerRenderState extends EntityRenderState { + @Nullable + public BakedModel itemModel; + public ItemStack item = ItemStack.EMPTY; +} diff --git a/net/minecraft/client/renderer/entity/state/PaintingRenderState.java b/net/minecraft/client/renderer/entity/state/PaintingRenderState.java new file mode 100644 index 00000000..1d6f947b --- /dev/null +++ b/net/minecraft/client/renderer/entity/state/PaintingRenderState.java @@ -0,0 +1,15 @@ +package net.minecraft.client.renderer.entity.state; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.core.Direction; +import net.minecraft.world.entity.decoration.PaintingVariant; +import org.jetbrains.annotations.Nullable; + +@Environment(EnvType.CLIENT) +public class PaintingRenderState extends EntityRenderState { + public Direction direction = Direction.NORTH; + @Nullable + public PaintingVariant variant; + public int[] lightCoords = new int[0]; +} diff --git a/net/minecraft/client/renderer/entity/state/PandaRenderState.java b/net/minecraft/client/renderer/entity/state/PandaRenderState.java new file mode 100644 index 00000000..9c9d49bb --- /dev/null +++ b/net/minecraft/client/renderer/entity/state/PandaRenderState.java @@ -0,0 +1,20 @@ +package net.minecraft.client.renderer.entity.state; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.world.entity.animal.Panda; + +@Environment(EnvType.CLIENT) +public class PandaRenderState extends LivingEntityRenderState { + public Panda.Gene variant = Panda.Gene.NORMAL; + public boolean isUnhappy; + public boolean isSneezing; + public int sneezeTime; + public boolean isEating; + public boolean isScared; + public boolean isSitting; + public float sitAmount; + public float lieOnBackAmount; + public float rollAmount; + public float rollTime; +} diff --git a/net/minecraft/client/renderer/entity/state/ParrotRenderState.java b/net/minecraft/client/renderer/entity/state/ParrotRenderState.java new file mode 100644 index 00000000..2d554c33 --- /dev/null +++ b/net/minecraft/client/renderer/entity/state/ParrotRenderState.java @@ -0,0 +1,13 @@ +package net.minecraft.client.renderer.entity.state; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.client.model.ParrotModel; +import net.minecraft.world.entity.animal.Parrot; + +@Environment(EnvType.CLIENT) +public class ParrotRenderState extends LivingEntityRenderState { + public Parrot.Variant variant = Parrot.Variant.RED_BLUE; + public float flapAngle; + public ParrotModel.Pose pose = ParrotModel.Pose.FLYING; +} diff --git a/net/minecraft/client/renderer/entity/state/PhantomRenderState.java b/net/minecraft/client/renderer/entity/state/PhantomRenderState.java new file mode 100644 index 00000000..2f0f307e --- /dev/null +++ b/net/minecraft/client/renderer/entity/state/PhantomRenderState.java @@ -0,0 +1,10 @@ +package net.minecraft.client.renderer.entity.state; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; + +@Environment(EnvType.CLIENT) +public class PhantomRenderState extends LivingEntityRenderState { + public float flapTime; + public int size; +} diff --git a/net/minecraft/client/renderer/entity/state/PigRenderState.java b/net/minecraft/client/renderer/entity/state/PigRenderState.java new file mode 100644 index 00000000..f7f82f7e --- /dev/null +++ b/net/minecraft/client/renderer/entity/state/PigRenderState.java @@ -0,0 +1,14 @@ +package net.minecraft.client.renderer.entity.state; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; + +@Environment(EnvType.CLIENT) +public class PigRenderState extends LivingEntityRenderState implements SaddleableRenderState { + public boolean isSaddled; + + @Override + public boolean isSaddled() { + return this.isSaddled; + } +} diff --git a/net/minecraft/client/renderer/entity/state/PiglinRenderState.java b/net/minecraft/client/renderer/entity/state/PiglinRenderState.java new file mode 100644 index 00000000..15b215ed --- /dev/null +++ b/net/minecraft/client/renderer/entity/state/PiglinRenderState.java @@ -0,0 +1,13 @@ +package net.minecraft.client.renderer.entity.state; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.world.entity.monster.piglin.PiglinArmPose; + +@Environment(EnvType.CLIENT) +public class PiglinRenderState extends HumanoidRenderState { + public boolean isBrute; + public boolean isConverting; + public float maxCrossbowChageDuration; + public PiglinArmPose armPose = PiglinArmPose.DEFAULT; +} diff --git a/net/minecraft/client/renderer/entity/state/PlayerRenderState.java b/net/minecraft/client/renderer/entity/state/PlayerRenderState.java new file mode 100644 index 00000000..e3e6e71b --- /dev/null +++ b/net/minecraft/client/renderer/entity/state/PlayerRenderState.java @@ -0,0 +1,56 @@ +package net.minecraft.client.renderer.entity.state; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.client.resources.DefaultPlayerSkin; +import net.minecraft.client.resources.PlayerSkin; +import net.minecraft.network.chat.Component; +import net.minecraft.util.Mth; +import net.minecraft.world.entity.animal.Parrot; +import net.minecraft.world.item.ItemUseAnimation; +import org.jetbrains.annotations.Nullable; + +@Environment(EnvType.CLIENT) +public class PlayerRenderState extends HumanoidRenderState { + public PlayerSkin skin = DefaultPlayerSkin.getDefaultSkin(); + public float capeFlap; + public float capeLean; + public float capeLean2; + public int arrowCount; + public int stingerCount; + public int useItemRemainingTicks; + public boolean isSpectator; + public boolean showHat = true; + public boolean showJacket = true; + public boolean showLeftPants = true; + public boolean showRightPants = true; + public boolean showLeftSleeve = true; + public boolean showRightSleeve = true; + public boolean showCape = true; + public float fallFlyingTimeInTicks; + public boolean shouldApplyFlyingYRot; + public float flyingYRot; + public boolean swinging; + public PlayerRenderState.HandState mainHandState = new PlayerRenderState.HandState(); + public PlayerRenderState.HandState offhandState = new PlayerRenderState.HandState(); + @Nullable + public Component scoreText; + @Nullable + public Parrot.Variant parrotOnLeftShoulder; + @Nullable + public Parrot.Variant parrotOnRightShoulder; + public int id; + public String name = "Steve"; + + public float fallFlyingScale() { + return Mth.clamp(this.fallFlyingTimeInTicks * this.fallFlyingTimeInTicks / 100.0F, 0.0F, 1.0F); + } + + @Environment(EnvType.CLIENT) + public static class HandState { + public boolean isEmpty = true; + @Nullable + public ItemUseAnimation useAnimation; + public boolean holdsChargedCrossbow; + } +} diff --git a/net/minecraft/client/renderer/entity/state/PolarBearRenderState.java b/net/minecraft/client/renderer/entity/state/PolarBearRenderState.java new file mode 100644 index 00000000..a90d94f1 --- /dev/null +++ b/net/minecraft/client/renderer/entity/state/PolarBearRenderState.java @@ -0,0 +1,9 @@ +package net.minecraft.client.renderer.entity.state; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; + +@Environment(EnvType.CLIENT) +public class PolarBearRenderState extends LivingEntityRenderState { + public float standScale; +} diff --git a/net/minecraft/client/renderer/entity/state/PufferfishRenderState.java b/net/minecraft/client/renderer/entity/state/PufferfishRenderState.java new file mode 100644 index 00000000..431e95e6 --- /dev/null +++ b/net/minecraft/client/renderer/entity/state/PufferfishRenderState.java @@ -0,0 +1,9 @@ +package net.minecraft.client.renderer.entity.state; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; + +@Environment(EnvType.CLIENT) +public class PufferfishRenderState extends LivingEntityRenderState { + public int puffState; +} diff --git a/net/minecraft/client/renderer/entity/state/RabbitRenderState.java b/net/minecraft/client/renderer/entity/state/RabbitRenderState.java new file mode 100644 index 00000000..eca65a4c --- /dev/null +++ b/net/minecraft/client/renderer/entity/state/RabbitRenderState.java @@ -0,0 +1,12 @@ +package net.minecraft.client.renderer.entity.state; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.world.entity.animal.Rabbit; + +@Environment(EnvType.CLIENT) +public class RabbitRenderState extends LivingEntityRenderState { + public float jumpCompletion; + public boolean isToast; + public Rabbit.Variant variant = Rabbit.Variant.BROWN; +} diff --git a/net/minecraft/client/renderer/entity/state/RavagerRenderState.java b/net/minecraft/client/renderer/entity/state/RavagerRenderState.java new file mode 100644 index 00000000..d1a69c41 --- /dev/null +++ b/net/minecraft/client/renderer/entity/state/RavagerRenderState.java @@ -0,0 +1,11 @@ +package net.minecraft.client.renderer.entity.state; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; + +@Environment(EnvType.CLIENT) +public class RavagerRenderState extends LivingEntityRenderState { + public float stunnedTicksRemaining; + public float attackTicksRemaining; + public float roarAnimation; +} diff --git a/net/minecraft/client/renderer/entity/state/SaddleableRenderState.java b/net/minecraft/client/renderer/entity/state/SaddleableRenderState.java new file mode 100644 index 00000000..defbd316 --- /dev/null +++ b/net/minecraft/client/renderer/entity/state/SaddleableRenderState.java @@ -0,0 +1,9 @@ +package net.minecraft.client.renderer.entity.state; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; + +@Environment(EnvType.CLIENT) +public interface SaddleableRenderState { + boolean isSaddled(); +} diff --git a/net/minecraft/client/renderer/entity/state/SalmonRenderState.java b/net/minecraft/client/renderer/entity/state/SalmonRenderState.java new file mode 100644 index 00000000..56798d07 --- /dev/null +++ b/net/minecraft/client/renderer/entity/state/SalmonRenderState.java @@ -0,0 +1,10 @@ +package net.minecraft.client.renderer.entity.state; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.world.entity.animal.Salmon; + +@Environment(EnvType.CLIENT) +public class SalmonRenderState extends LivingEntityRenderState { + public Salmon.Variant variant = Salmon.Variant.MEDIUM; +} diff --git a/net/minecraft/client/renderer/entity/state/SheepRenderState.java b/net/minecraft/client/renderer/entity/state/SheepRenderState.java new file mode 100644 index 00000000..63853bd5 --- /dev/null +++ b/net/minecraft/client/renderer/entity/state/SheepRenderState.java @@ -0,0 +1,14 @@ +package net.minecraft.client.renderer.entity.state; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.world.item.DyeColor; + +@Environment(EnvType.CLIENT) +public class SheepRenderState extends LivingEntityRenderState { + public float headEatPositionScale; + public float headEatAngleScale; + public boolean isSheared; + public DyeColor woolColor = DyeColor.WHITE; + public int id; +} diff --git a/net/minecraft/client/renderer/entity/state/ShulkerBulletRenderState.java b/net/minecraft/client/renderer/entity/state/ShulkerBulletRenderState.java new file mode 100644 index 00000000..c433d6c0 --- /dev/null +++ b/net/minecraft/client/renderer/entity/state/ShulkerBulletRenderState.java @@ -0,0 +1,10 @@ +package net.minecraft.client.renderer.entity.state; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; + +@Environment(EnvType.CLIENT) +public class ShulkerBulletRenderState extends EntityRenderState { + public float xRot; + public float yRot; +} diff --git a/net/minecraft/client/renderer/entity/state/ShulkerRenderState.java b/net/minecraft/client/renderer/entity/state/ShulkerRenderState.java new file mode 100644 index 00000000..a9eb4c4d --- /dev/null +++ b/net/minecraft/client/renderer/entity/state/ShulkerRenderState.java @@ -0,0 +1,19 @@ +package net.minecraft.client.renderer.entity.state; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.core.Direction; +import net.minecraft.world.item.DyeColor; +import net.minecraft.world.phys.Vec3; +import org.jetbrains.annotations.Nullable; + +@Environment(EnvType.CLIENT) +public class ShulkerRenderState extends LivingEntityRenderState { + public Vec3 renderOffset = Vec3.ZERO; + @Nullable + public DyeColor color; + public float peekAmount; + public float yHeadRot; + public float yBodyRot; + public Direction attachFace = Direction.DOWN; +} diff --git a/net/minecraft/client/renderer/entity/state/SkeletonRenderState.java b/net/minecraft/client/renderer/entity/state/SkeletonRenderState.java new file mode 100644 index 00000000..b9c74e5a --- /dev/null +++ b/net/minecraft/client/renderer/entity/state/SkeletonRenderState.java @@ -0,0 +1,10 @@ +package net.minecraft.client.renderer.entity.state; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; + +@Environment(EnvType.CLIENT) +public class SkeletonRenderState extends HumanoidRenderState { + public boolean isAggressive; + public boolean isShaking; +} diff --git a/net/minecraft/client/renderer/entity/state/SlimeRenderState.java b/net/minecraft/client/renderer/entity/state/SlimeRenderState.java new file mode 100644 index 00000000..8c156cbd --- /dev/null +++ b/net/minecraft/client/renderer/entity/state/SlimeRenderState.java @@ -0,0 +1,10 @@ +package net.minecraft.client.renderer.entity.state; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; + +@Environment(EnvType.CLIENT) +public class SlimeRenderState extends LivingEntityRenderState { + public float squish; + public int size = 1; +} diff --git a/net/minecraft/client/renderer/entity/state/SnifferRenderState.java b/net/minecraft/client/renderer/entity/state/SnifferRenderState.java new file mode 100644 index 00000000..a68057f2 --- /dev/null +++ b/net/minecraft/client/renderer/entity/state/SnifferRenderState.java @@ -0,0 +1,15 @@ +package net.minecraft.client.renderer.entity.state; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.world.entity.AnimationState; + +@Environment(EnvType.CLIENT) +public class SnifferRenderState extends LivingEntityRenderState { + public boolean isSearching; + public final AnimationState diggingAnimationState = new AnimationState(); + public final AnimationState sniffingAnimationState = new AnimationState(); + public final AnimationState risingAnimationState = new AnimationState(); + public final AnimationState feelingHappyAnimationState = new AnimationState(); + public final AnimationState scentingAnimationState = new AnimationState(); +} diff --git a/net/minecraft/client/renderer/entity/state/SquidRenderState.java b/net/minecraft/client/renderer/entity/state/SquidRenderState.java new file mode 100644 index 00000000..8bcf91b7 --- /dev/null +++ b/net/minecraft/client/renderer/entity/state/SquidRenderState.java @@ -0,0 +1,11 @@ +package net.minecraft.client.renderer.entity.state; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; + +@Environment(EnvType.CLIENT) +public class SquidRenderState extends LivingEntityRenderState { + public float tentacleAngle; + public float xBodyRot; + public float zBodyRot; +} diff --git a/net/minecraft/client/renderer/entity/state/StriderRenderState.java b/net/minecraft/client/renderer/entity/state/StriderRenderState.java new file mode 100644 index 00000000..086a1eb7 --- /dev/null +++ b/net/minecraft/client/renderer/entity/state/StriderRenderState.java @@ -0,0 +1,16 @@ +package net.minecraft.client.renderer.entity.state; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; + +@Environment(EnvType.CLIENT) +public class StriderRenderState extends LivingEntityRenderState implements SaddleableRenderState { + public boolean isSaddled; + public boolean isSuffocating; + public boolean isRidden; + + @Override + public boolean isSaddled() { + return this.isSaddled; + } +} diff --git a/net/minecraft/client/renderer/entity/state/TextDisplayEntityRenderState.java b/net/minecraft/client/renderer/entity/state/TextDisplayEntityRenderState.java new file mode 100644 index 00000000..c3ccd01f --- /dev/null +++ b/net/minecraft/client/renderer/entity/state/TextDisplayEntityRenderState.java @@ -0,0 +1,20 @@ +package net.minecraft.client.renderer.entity.state; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.world.entity.Display.TextDisplay.CachedInfo; +import net.minecraft.world.entity.Display.TextDisplay.TextRenderState; +import org.jetbrains.annotations.Nullable; + +@Environment(EnvType.CLIENT) +public class TextDisplayEntityRenderState extends DisplayEntityRenderState { + @Nullable + public TextRenderState textRenderState; + @Nullable + public CachedInfo cachedInfo; + + @Override + public boolean hasSubState() { + return this.textRenderState != null; + } +} diff --git a/net/minecraft/client/renderer/entity/state/ThrownItemRenderState.java b/net/minecraft/client/renderer/entity/state/ThrownItemRenderState.java new file mode 100644 index 00000000..8dc2116c --- /dev/null +++ b/net/minecraft/client/renderer/entity/state/ThrownItemRenderState.java @@ -0,0 +1,14 @@ +package net.minecraft.client.renderer.entity.state; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.client.resources.model.BakedModel; +import net.minecraft.world.item.ItemStack; +import org.jetbrains.annotations.Nullable; + +@Environment(EnvType.CLIENT) +public class ThrownItemRenderState extends EntityRenderState { + @Nullable + public BakedModel itemModel; + public ItemStack item = ItemStack.EMPTY; +} diff --git a/net/minecraft/client/renderer/entity/state/ThrownTridentRenderState.java b/net/minecraft/client/renderer/entity/state/ThrownTridentRenderState.java new file mode 100644 index 00000000..2e9d21e1 --- /dev/null +++ b/net/minecraft/client/renderer/entity/state/ThrownTridentRenderState.java @@ -0,0 +1,11 @@ +package net.minecraft.client.renderer.entity.state; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; + +@Environment(EnvType.CLIENT) +public class ThrownTridentRenderState extends EntityRenderState { + public float xRot; + public float yRot; + public boolean isFoil; +} diff --git a/net/minecraft/client/renderer/entity/state/TippableArrowRenderState.java b/net/minecraft/client/renderer/entity/state/TippableArrowRenderState.java new file mode 100644 index 00000000..571025f9 --- /dev/null +++ b/net/minecraft/client/renderer/entity/state/TippableArrowRenderState.java @@ -0,0 +1,9 @@ +package net.minecraft.client.renderer.entity.state; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; + +@Environment(EnvType.CLIENT) +public class TippableArrowRenderState extends ArrowRenderState { + public boolean isTipped; +} diff --git a/net/minecraft/client/renderer/entity/state/TntRenderState.java b/net/minecraft/client/renderer/entity/state/TntRenderState.java new file mode 100644 index 00000000..1ef88671 --- /dev/null +++ b/net/minecraft/client/renderer/entity/state/TntRenderState.java @@ -0,0 +1,13 @@ +package net.minecraft.client.renderer.entity.state; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.world.level.block.state.BlockState; +import org.jetbrains.annotations.Nullable; + +@Environment(EnvType.CLIENT) +public class TntRenderState extends EntityRenderState { + public float fuseRemainingInTicks; + @Nullable + public BlockState blockState; +} diff --git a/net/minecraft/client/renderer/entity/state/TropicalFishRenderState.java b/net/minecraft/client/renderer/entity/state/TropicalFishRenderState.java new file mode 100644 index 00000000..907edb4d --- /dev/null +++ b/net/minecraft/client/renderer/entity/state/TropicalFishRenderState.java @@ -0,0 +1,12 @@ +package net.minecraft.client.renderer.entity.state; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.world.entity.animal.TropicalFish; + +@Environment(EnvType.CLIENT) +public class TropicalFishRenderState extends LivingEntityRenderState { + public TropicalFish.Pattern variant = TropicalFish.Pattern.FLOPPER; + public int baseColor = -1; + public int patternColor = -1; +} diff --git a/net/minecraft/client/renderer/entity/state/TurtleRenderState.java b/net/minecraft/client/renderer/entity/state/TurtleRenderState.java new file mode 100644 index 00000000..c5cb2e01 --- /dev/null +++ b/net/minecraft/client/renderer/entity/state/TurtleRenderState.java @@ -0,0 +1,11 @@ +package net.minecraft.client.renderer.entity.state; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; + +@Environment(EnvType.CLIENT) +public class TurtleRenderState extends LivingEntityRenderState { + public boolean isOnLand; + public boolean isLayingEgg; + public boolean hasEgg; +} diff --git a/net/minecraft/client/renderer/entity/state/VexRenderState.java b/net/minecraft/client/renderer/entity/state/VexRenderState.java new file mode 100644 index 00000000..3ec23cb5 --- /dev/null +++ b/net/minecraft/client/renderer/entity/state/VexRenderState.java @@ -0,0 +1,9 @@ +package net.minecraft.client.renderer.entity.state; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; + +@Environment(EnvType.CLIENT) +public class VexRenderState extends LivingEntityRenderState { + public boolean isCharging; +} diff --git a/net/minecraft/client/renderer/entity/state/VillagerDataHolderRenderState.java b/net/minecraft/client/renderer/entity/state/VillagerDataHolderRenderState.java new file mode 100644 index 00000000..e44fc821 --- /dev/null +++ b/net/minecraft/client/renderer/entity/state/VillagerDataHolderRenderState.java @@ -0,0 +1,10 @@ +package net.minecraft.client.renderer.entity.state; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.world.entity.npc.VillagerData; + +@Environment(EnvType.CLIENT) +public interface VillagerDataHolderRenderState { + VillagerData getVillagerData(); +} diff --git a/net/minecraft/client/renderer/entity/state/VillagerRenderState.java b/net/minecraft/client/renderer/entity/state/VillagerRenderState.java new file mode 100644 index 00000000..a00b2751 --- /dev/null +++ b/net/minecraft/client/renderer/entity/state/VillagerRenderState.java @@ -0,0 +1,18 @@ +package net.minecraft.client.renderer.entity.state; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.world.entity.npc.VillagerData; +import net.minecraft.world.entity.npc.VillagerProfession; +import net.minecraft.world.entity.npc.VillagerType; + +@Environment(EnvType.CLIENT) +public class VillagerRenderState extends LivingEntityRenderState implements VillagerDataHolderRenderState { + public boolean isUnhappy; + public VillagerData villagerData = new VillagerData(VillagerType.PLAINS, VillagerProfession.NONE, 1); + + @Override + public VillagerData getVillagerData() { + return this.villagerData; + } +} diff --git a/net/minecraft/client/renderer/entity/state/WardenRenderState.java b/net/minecraft/client/renderer/entity/state/WardenRenderState.java new file mode 100644 index 00000000..601bcbf6 --- /dev/null +++ b/net/minecraft/client/renderer/entity/state/WardenRenderState.java @@ -0,0 +1,17 @@ +package net.minecraft.client.renderer.entity.state; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.world.entity.AnimationState; + +@Environment(EnvType.CLIENT) +public class WardenRenderState extends LivingEntityRenderState { + public float tendrilAnimation; + public float heartAnimation; + public final AnimationState roarAnimationState = new AnimationState(); + public final AnimationState sniffAnimationState = new AnimationState(); + public final AnimationState emergeAnimationState = new AnimationState(); + public final AnimationState diggingAnimationState = new AnimationState(); + public final AnimationState attackAnimationState = new AnimationState(); + public final AnimationState sonicBoomAnimationState = new AnimationState(); +} diff --git a/net/minecraft/client/renderer/entity/state/WitchRenderState.java b/net/minecraft/client/renderer/entity/state/WitchRenderState.java new file mode 100644 index 00000000..c278d7f2 --- /dev/null +++ b/net/minecraft/client/renderer/entity/state/WitchRenderState.java @@ -0,0 +1,10 @@ +package net.minecraft.client.renderer.entity.state; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; + +@Environment(EnvType.CLIENT) +public class WitchRenderState extends LivingEntityRenderState { + public int entityId; + public boolean isHoldingItem; +} diff --git a/net/minecraft/client/renderer/entity/state/WitherRenderState.java b/net/minecraft/client/renderer/entity/state/WitherRenderState.java new file mode 100644 index 00000000..1fe11771 --- /dev/null +++ b/net/minecraft/client/renderer/entity/state/WitherRenderState.java @@ -0,0 +1,12 @@ +package net.minecraft.client.renderer.entity.state; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; + +@Environment(EnvType.CLIENT) +public class WitherRenderState extends LivingEntityRenderState { + public float[] xHeadRots = new float[2]; + public float[] yHeadRots = new float[2]; + public float invulnerableTicks; + public boolean isPowered; +} diff --git a/net/minecraft/client/renderer/entity/state/WitherSkullRenderState.java b/net/minecraft/client/renderer/entity/state/WitherSkullRenderState.java new file mode 100644 index 00000000..03acacb9 --- /dev/null +++ b/net/minecraft/client/renderer/entity/state/WitherSkullRenderState.java @@ -0,0 +1,11 @@ +package net.minecraft.client.renderer.entity.state; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; + +@Environment(EnvType.CLIENT) +public class WitherSkullRenderState extends EntityRenderState { + public boolean isDangerous; + public float xRot; + public float yRot; +} diff --git a/net/minecraft/client/renderer/entity/state/WolfRenderState.java b/net/minecraft/client/renderer/entity/state/WolfRenderState.java new file mode 100644 index 00000000..38674fc0 --- /dev/null +++ b/net/minecraft/client/renderer/entity/state/WolfRenderState.java @@ -0,0 +1,35 @@ +package net.minecraft.client.renderer.entity.state; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.Mth; +import net.minecraft.world.item.DyeColor; +import net.minecraft.world.item.ItemStack; +import org.jetbrains.annotations.Nullable; + +@Environment(EnvType.CLIENT) +public class WolfRenderState extends LivingEntityRenderState { + private static final ResourceLocation DEFAULT_TEXTURE = ResourceLocation.withDefaultNamespace("textures/entity/wolf/wolf.png"); + public boolean isAngry; + public boolean isSitting; + public float tailAngle = (float) (Math.PI / 5); + public float headRollAngle; + public float shakeAnim; + public float wetShade = 1.0F; + public ResourceLocation texture = DEFAULT_TEXTURE; + @Nullable + public DyeColor collarColor; + public ItemStack bodyArmorItem = ItemStack.EMPTY; + + public float getBodyRollAngle(float f) { + float g = (this.shakeAnim + f) / 1.8F; + if (g < 0.0F) { + g = 0.0F; + } else if (g > 1.0F) { + g = 1.0F; + } + + return Mth.sin(g * (float) Math.PI) * Mth.sin(g * (float) Math.PI * 11.0F) * 0.15F * (float) Math.PI; + } +} diff --git a/net/minecraft/client/renderer/entity/state/ZombieRenderState.java b/net/minecraft/client/renderer/entity/state/ZombieRenderState.java new file mode 100644 index 00000000..a3fc9065 --- /dev/null +++ b/net/minecraft/client/renderer/entity/state/ZombieRenderState.java @@ -0,0 +1,10 @@ +package net.minecraft.client.renderer.entity.state; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; + +@Environment(EnvType.CLIENT) +public class ZombieRenderState extends HumanoidRenderState { + public boolean isAggressive; + public boolean isConverting; +} diff --git a/net/minecraft/client/renderer/entity/state/ZombieVillagerRenderState.java b/net/minecraft/client/renderer/entity/state/ZombieVillagerRenderState.java new file mode 100644 index 00000000..ebef3082 --- /dev/null +++ b/net/minecraft/client/renderer/entity/state/ZombieVillagerRenderState.java @@ -0,0 +1,17 @@ +package net.minecraft.client.renderer.entity.state; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.world.entity.npc.VillagerData; +import net.minecraft.world.entity.npc.VillagerProfession; +import net.minecraft.world.entity.npc.VillagerType; + +@Environment(EnvType.CLIENT) +public class ZombieVillagerRenderState extends ZombieRenderState implements VillagerDataHolderRenderState { + public VillagerData villagerData = new VillagerData(VillagerType.PLAINS, VillagerProfession.NONE, 1); + + @Override + public VillagerData getVillagerData() { + return this.villagerData; + } +} diff --git a/net/minecraft/client/renderer/entity/state/ZombifiedPiglinRenderState.java b/net/minecraft/client/renderer/entity/state/ZombifiedPiglinRenderState.java new file mode 100644 index 00000000..b4fdced3 --- /dev/null +++ b/net/minecraft/client/renderer/entity/state/ZombifiedPiglinRenderState.java @@ -0,0 +1,9 @@ +package net.minecraft.client.renderer.entity.state; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; + +@Environment(EnvType.CLIENT) +public class ZombifiedPiglinRenderState extends HumanoidRenderState { + public boolean isAggressive; +} diff --git a/net/minecraft/client/renderer/entity/state/package-info.java b/net/minecraft/client/renderer/entity/state/package-info.java new file mode 100644 index 00000000..99620da1 --- /dev/null +++ b/net/minecraft/client/renderer/entity/state/package-info.java @@ -0,0 +1,11 @@ +@ParametersAreNonnullByDefault +@MethodsReturnNonnullByDefault +@FieldsAreNonnullByDefault +@Environment(EnvType.CLIENT) +package net.minecraft.client.renderer.entity.state; + +import javax.annotation.ParametersAreNonnullByDefault; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.FieldsAreNonnullByDefault; +import net.minecraft.MethodsReturnNonnullByDefault; diff --git a/net/minecraft/client/renderer/item/ItemProperties.java b/net/minecraft/client/renderer/item/ItemProperties.java index 0ecb06fd..5a69b3ac 100644 --- a/net/minecraft/client/renderer/item/ItemProperties.java +++ b/net/minecraft/client/renderer/item/ItemProperties.java @@ -17,17 +17,17 @@ import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.BundleItem; import net.minecraft.world.item.CompassItem; import net.minecraft.world.item.CrossbowItem; -import net.minecraft.world.item.ElytraItem; import net.minecraft.world.item.FishingRodItem; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; -import net.minecraft.world.item.armortrim.ArmorTrim; import net.minecraft.world.item.component.BlockItemStateProperties; import net.minecraft.world.item.component.ChargedProjectiles; import net.minecraft.world.item.component.CustomModelData; import net.minecraft.world.item.component.LodestoneTracker; +import net.minecraft.world.item.equipment.trim.ArmorTrim; import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.BeehiveBlock; import net.minecraft.world.level.block.LightBlock; import org.jetbrains.annotations.Nullable; @@ -55,6 +55,12 @@ public class ItemProperties { ((Map)PROPERTIES.computeIfAbsent(item, itemx -> Maps.newHashMap())).put(name, property); } + private static int honeyLevelProperty(ItemStack itemStack) { + BlockItemStateProperties blockItemStateProperties = itemStack.getOrDefault(DataComponents.BLOCK_STATE, BlockItemStateProperties.EMPTY); + Integer integer = blockItemStateProperties.get(BeehiveBlock.HONEY_LEVEL); + return integer != null && integer == 5 ? 1 : 0; + } + @Nullable public static ItemPropertyFunction getProperty(ItemStack stack, ResourceLocation location) { if (stack.getMaxDamage() > 0) { @@ -84,7 +90,7 @@ public class ItemProperties { registerGeneric( ResourceLocation.withDefaultNamespace("cooldown"), (itemStack, clientLevel, livingEntity, i) -> livingEntity instanceof Player - ? ((Player)livingEntity).getCooldowns().getCooldownPercent(itemStack.getItem(), 0.0F) + ? ((Player)livingEntity).getCooldowns().getCooldownPercent(itemStack, 0.0F) : 0.0F ); ClampedItemPropertyFunction clampedItemPropertyFunction = (itemStack, clientLevel, livingEntity, i) -> { @@ -92,6 +98,7 @@ public class ItemProperties { return armorTrim != null ? armorTrim.material().value().itemModelIndex() : Float.NEGATIVE_INFINITY; }; registerGeneric(ItemModelGenerators.TRIM_TYPE_PREDICATE_ID, clampedItemPropertyFunction); + registerGeneric(ResourceLocation.withDefaultNamespace("broken"), (itemStack, clientLevel, livingEntity, i) -> itemStack.nextDamageWillBreak() ? 1.0F : 0.0F); registerCustomModelData( (itemStack, clientLevel, livingEntity, i) -> itemStack.getOrDefault(DataComponents.CUSTOM_MODEL_DATA, CustomModelData.DEFAULT).value() ); @@ -114,7 +121,13 @@ public class ItemProperties { ResourceLocation.withDefaultNamespace("pulling"), (itemStack, clientLevel, livingEntity, i) -> livingEntity != null && livingEntity.isUsingItem() && livingEntity.getUseItem() == itemStack ? 1.0F : 0.0F ); - register(Items.BUNDLE, ResourceLocation.withDefaultNamespace("filled"), (itemStack, clientLevel, livingEntity, i) -> BundleItem.getFullnessDisplay(itemStack)); + + for (BundleItem bundleItem : BundleItem.getAllBundleItemColors()) { + register( + bundleItem.asItem(), ResourceLocation.withDefaultNamespace("filled"), (itemStack, clientLevel, livingEntity, i) -> BundleItem.getFullnessDisplay(itemStack) + ); + } + register(Items.CLOCK, ResourceLocation.withDefaultNamespace("time"), new ClampedItemPropertyFunction() { private double rotation; private double rota; @@ -202,9 +215,6 @@ public class ItemProperties { ChargedProjectiles chargedProjectiles = itemStack.get(DataComponents.CHARGED_PROJECTILES); return chargedProjectiles != null && chargedProjectiles.contains(Items.FIREWORK_ROCKET) ? 1.0F : 0.0F; }); - register( - Items.ELYTRA, ResourceLocation.withDefaultNamespace("broken"), (itemStack, clientLevel, livingEntity, i) -> ElytraItem.isFlyEnabled(itemStack) ? 0.0F : 1.0F - ); register(Items.FISHING_ROD, ResourceLocation.withDefaultNamespace("cast"), (itemStack, clientLevel, livingEntity, i) -> { if (livingEntity == null) { return 0.0F; @@ -238,5 +248,7 @@ public class ItemProperties { ResourceLocation.withDefaultNamespace("tooting"), (itemStack, clientLevel, livingEntity, i) -> livingEntity != null && livingEntity.isUsingItem() && livingEntity.getUseItem() == itemStack ? 1.0F : 0.0F ); + register(Items.BEE_NEST, ResourceLocation.withDefaultNamespace("honey_level"), (itemStack, clientLevel, livingEntity, i) -> honeyLevelProperty(itemStack)); + register(Items.BEEHIVE, ResourceLocation.withDefaultNamespace("honey_level"), (itemStack, clientLevel, livingEntity, i) -> honeyLevelProperty(itemStack)); } } diff --git a/net/minecraft/client/renderer/state/MapRenderState.java b/net/minecraft/client/renderer/state/MapRenderState.java new file mode 100644 index 00000000..243894be --- /dev/null +++ b/net/minecraft/client/renderer/state/MapRenderState.java @@ -0,0 +1,29 @@ +package net.minecraft.client.renderer.state; + +import java.util.ArrayList; +import java.util.List; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceLocation; +import org.jetbrains.annotations.Nullable; + +@Environment(EnvType.CLIENT) +public class MapRenderState { + @Nullable + public ResourceLocation texture; + public final List decorations = new ArrayList(); + + @Environment(EnvType.CLIENT) + public static class MapDecorationRenderState { + @Nullable + public TextureAtlasSprite atlasSprite; + public byte x; + public byte y; + public byte rot; + public boolean renderOnFrame; + @Nullable + public Component name; + } +} diff --git a/net/minecraft/client/renderer/state/package-info.java b/net/minecraft/client/renderer/state/package-info.java new file mode 100644 index 00000000..420a129d --- /dev/null +++ b/net/minecraft/client/renderer/state/package-info.java @@ -0,0 +1,11 @@ +@ParametersAreNonnullByDefault +@MethodsReturnNonnullByDefault +@FieldsAreNonnullByDefault +@Environment(EnvType.CLIENT) +package net.minecraft.client.renderer.state; + +import javax.annotation.ParametersAreNonnullByDefault; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.FieldsAreNonnullByDefault; +import net.minecraft.MethodsReturnNonnullByDefault; diff --git a/net/minecraft/client/renderer/texture/AbstractTexture.java b/net/minecraft/client/renderer/texture/AbstractTexture.java index 74e1517e..7758ade6 100644 --- a/net/minecraft/client/renderer/texture/AbstractTexture.java +++ b/net/minecraft/client/renderer/texture/AbstractTexture.java @@ -14,16 +14,13 @@ import net.minecraft.server.packs.resources.ResourceManager; public abstract class AbstractTexture implements AutoCloseable { public static final int NOT_ASSIGNED = -1; protected int id = -1; - protected boolean blur; - protected boolean mipmap; + protected boolean defaultBlur; /** * @param mipmap {@code true} if a mipmap is being used (mip level is greater than 0) */ public void setFilter(boolean blur, boolean mipmap) { RenderSystem.assertOnRenderThreadOrInit(); - this.blur = blur; - this.mipmap = mipmap; int i; int j; if (blur) { @@ -62,6 +59,10 @@ public abstract class AbstractTexture implements AutoCloseable { } } + public boolean getDefaultBlur() { + return this.defaultBlur; + } + public abstract void load(ResourceManager resourceManager) throws IOException; public void bind() { diff --git a/net/minecraft/client/renderer/texture/HttpTexture.java b/net/minecraft/client/renderer/texture/HttpTexture.java index abff3945..1d4a5e44 100644 --- a/net/minecraft/client/renderer/texture/HttpTexture.java +++ b/net/minecraft/client/renderer/texture/HttpTexture.java @@ -17,6 +17,7 @@ import net.minecraft.Util; import net.minecraft.client.Minecraft; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.packs.resources.ResourceManager; +import net.minecraft.util.ARGB; import org.apache.commons.io.FileUtils; import org.jetbrains.annotations.Nullable; import org.slf4j.Logger; @@ -125,7 +126,7 @@ public class HttpTexture extends SimpleTexture { httpURLConnection.disconnect(); } } - }, Util.backgroundExecutor()); + }, Util.backgroundExecutor().forName("downloadTexture")); } } } @@ -190,8 +191,8 @@ public class HttpTexture extends SimpleTexture { private static void doNotchTransparencyHack(NativeImage image, int x, int y, int width, int height) { for (int i = x; i < width; i++) { for (int j = y; j < height; j++) { - int k = image.getPixelRGBA(i, j); - if ((k >> 24 & 0xFF) < 128) { + int k = image.getPixel(i, j); + if (ARGB.alpha(k) < 128) { return; } } @@ -199,7 +200,7 @@ public class HttpTexture extends SimpleTexture { for (int i = x; i < width; i++) { for (int jx = y; jx < height; jx++) { - image.setPixelRGBA(i, jx, image.getPixelRGBA(i, jx) & 16777215); + image.setPixel(i, jx, image.getPixel(i, jx) & 16777215); } } } @@ -207,7 +208,7 @@ public class HttpTexture extends SimpleTexture { private static void setNoAlpha(NativeImage image, int x, int y, int width, int height) { for (int i = x; i < width; i++) { for (int j = y; j < height; j++) { - image.setPixelRGBA(i, j, image.getPixelRGBA(i, j) | 0xFF000000); + image.setPixel(i, j, ARGB.opaque(image.getPixel(i, j))); } } } diff --git a/net/minecraft/client/renderer/texture/MipmapGenerator.java b/net/minecraft/client/renderer/texture/MipmapGenerator.java index f84e1175..1e343989 100644 --- a/net/minecraft/client/renderer/texture/MipmapGenerator.java +++ b/net/minecraft/client/renderer/texture/MipmapGenerator.java @@ -4,6 +4,7 @@ import com.mojang.blaze3d.platform.NativeImage; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.Util; +import net.minecraft.util.ARGB; @Environment(EnvType.CLIENT) public class MipmapGenerator { @@ -36,14 +37,14 @@ public class MipmapGenerator { for (int l = 0; l < j; l++) { for (int m = 0; m < k; m++) { - nativeImage2.setPixelRGBA( + nativeImage2.setPixel( l, m, alphaBlend( - nativeImage.getPixelRGBA(l * 2 + 0, m * 2 + 0), - nativeImage.getPixelRGBA(l * 2 + 1, m * 2 + 0), - nativeImage.getPixelRGBA(l * 2 + 0, m * 2 + 1), - nativeImage.getPixelRGBA(l * 2 + 1, m * 2 + 1), + nativeImage.getPixel(l * 2 + 0, m * 2 + 0), + nativeImage.getPixel(l * 2 + 1, m * 2 + 0), + nativeImage.getPixel(l * 2 + 0, m * 2 + 1), + nativeImage.getPixel(l * 2 + 1, m * 2 + 1), bl ) ); @@ -61,7 +62,7 @@ public class MipmapGenerator { private static boolean hasTransparentPixel(NativeImage image) { for (int i = 0; i < image.getWidth(); i++) { for (int j = 0; j < image.getHeight(); j++) { - if (image.getPixelRGBA(i, j) >> 24 == 0) { + if (ARGB.alpha(image.getPixel(i, j)) == 0) { return true; } } @@ -116,13 +117,13 @@ public class MipmapGenerator { j = 0; } - return j << 24 | k << 16 | l << 8 | m; + return ARGB.color(j, k, l, m); } else { int n = gammaBlend(col0, col1, col2, col3, 24); int o = gammaBlend(col0, col1, col2, col3, 16); int p = gammaBlend(col0, col1, col2, col3, 8); int q = gammaBlend(col0, col1, col2, col3, 0); - return n << 24 | o << 16 | p << 8 | q; + return ARGB.color(n, o, p, q); } } diff --git a/net/minecraft/client/renderer/texture/MissingTextureAtlasSprite.java b/net/minecraft/client/renderer/texture/MissingTextureAtlasSprite.java index c8b856eb..6cf9e43d 100644 --- a/net/minecraft/client/renderer/texture/MissingTextureAtlasSprite.java +++ b/net/minecraft/client/renderer/texture/MissingTextureAtlasSprite.java @@ -10,6 +10,7 @@ import net.minecraft.client.resources.metadata.animation.AnimationMetadataSectio import net.minecraft.client.resources.metadata.animation.FrameSize; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.packs.resources.ResourceMetadata; +import net.minecraft.server.packs.resources.ResourceMetadata.Builder; import org.jetbrains.annotations.Nullable; @Environment(EnvType.CLIENT) @@ -18,7 +19,7 @@ public final class MissingTextureAtlasSprite { private static final int MISSING_IMAGE_HEIGHT = 16; private static final String MISSING_TEXTURE_NAME = "missingno"; private static final ResourceLocation MISSING_TEXTURE_LOCATION = ResourceLocation.withDefaultNamespace("missingno"); - private static final ResourceMetadata SPRITE_METADATA = new ResourceMetadata.Builder() + private static final ResourceMetadata SPRITE_METADATA = new Builder() .put(AnimationMetadataSection.SERIALIZER, new AnimationMetadataSection(ImmutableList.of(new AnimationFrame(0, -1)), 16, 16, 1, false)) .build(); @Nullable @@ -26,15 +27,14 @@ public final class MissingTextureAtlasSprite { private static NativeImage generateMissingImage(int width, int height) { NativeImage nativeImage = new NativeImage(width, height, false); - int i = -16777216; - int j = -524040; + int i = -524040; - for (int k = 0; k < height; k++) { - for (int l = 0; l < width; l++) { - if (k < height / 2 ^ l < width / 2) { - nativeImage.setPixelRGBA(l, k, -524040); + for (int j = 0; j < height; j++) { + for (int k = 0; k < width; k++) { + if (j < height / 2 ^ k < width / 2) { + nativeImage.setPixel(k, j, -524040); } else { - nativeImage.setPixelRGBA(l, k, -16777216); + nativeImage.setPixel(k, j, -16777216); } } } diff --git a/net/minecraft/client/renderer/texture/OverlayTexture.java b/net/minecraft/client/renderer/texture/OverlayTexture.java index f8f333ba..8369268b 100644 --- a/net/minecraft/client/renderer/texture/OverlayTexture.java +++ b/net/minecraft/client/renderer/texture/OverlayTexture.java @@ -4,6 +4,7 @@ import com.mojang.blaze3d.platform.NativeImage; import com.mojang.blaze3d.systems.RenderSystem; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; +import net.minecraft.util.ARGB; @Environment(EnvType.CLIENT) public class OverlayTexture implements AutoCloseable { @@ -20,10 +21,10 @@ public class OverlayTexture implements AutoCloseable { for (int i = 0; i < 16; i++) { for (int j = 0; j < 16; j++) { if (i < 8) { - nativeImage.setPixelRGBA(j, i, -1308622593); + nativeImage.setPixel(j, i, -1291911168); } else { int k = (int)((1.0F - j / 15.0F * 0.75F) * 255.0F); - nativeImage.setPixelRGBA(j, i, k << 24 | 16777215); + nativeImage.setPixel(j, i, ARGB.color(k, -1)); } } } diff --git a/net/minecraft/client/renderer/texture/SimpleTexture.java b/net/minecraft/client/renderer/texture/SimpleTexture.java index 62205232..b0207f9d 100644 --- a/net/minecraft/client/renderer/texture/SimpleTexture.java +++ b/net/minecraft/client/renderer/texture/SimpleTexture.java @@ -31,20 +31,19 @@ public class SimpleTexture extends AbstractTexture { textureImage.throwIfError(); TextureMetadataSection textureMetadataSection = textureImage.getTextureMetadata(); boolean bl; - boolean bl2; if (textureMetadataSection != null) { - bl = textureMetadataSection.isBlur(); - bl2 = textureMetadataSection.isClamp(); + this.defaultBlur = textureMetadataSection.isBlur(); + bl = textureMetadataSection.isClamp(); } else { + this.defaultBlur = false; bl = false; - bl2 = false; } NativeImage nativeImage = textureImage.getImage(); if (!RenderSystem.isOnRenderThreadOrInit()) { - RenderSystem.recordRenderCall(() -> this.doLoad(nativeImage, bl, bl2)); + RenderSystem.recordRenderCall(() -> this.doLoad(nativeImage, this.defaultBlur, bl)); } else { - this.doLoad(nativeImage, bl, bl2); + this.doLoad(nativeImage, this.defaultBlur, bl); } } diff --git a/net/minecraft/client/renderer/texture/SpriteContents.java b/net/minecraft/client/renderer/texture/SpriteContents.java index 1c4433c6..99bda1d5 100644 --- a/net/minecraft/client/renderer/texture/SpriteContents.java +++ b/net/minecraft/client/renderer/texture/SpriteContents.java @@ -2,7 +2,6 @@ package net.minecraft.client.renderer.texture; import com.google.common.collect.ImmutableList; import com.mojang.blaze3d.platform.NativeImage; -import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.logging.LogUtils; import it.unimi.dsi.fastutil.ints.IntOpenHashSet; import it.unimi.dsi.fastutil.ints.IntSet; @@ -17,15 +16,17 @@ import net.minecraft.CrashReport; import net.minecraft.CrashReportCategory; import net.minecraft.CrashReportDetail; import net.minecraft.ReportedException; +import net.minecraft.client.renderer.texture.Stitcher.Entry; import net.minecraft.client.resources.metadata.animation.AnimationMetadataSection; import net.minecraft.client.resources.metadata.animation.FrameSize; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.packs.resources.ResourceMetadata; +import net.minecraft.util.ARGB; import org.jetbrains.annotations.Nullable; import org.slf4j.Logger; @Environment(EnvType.CLIENT) -public class SpriteContents implements Stitcher.Entry, AutoCloseable { +public class SpriteContents implements Entry, AutoCloseable { private static final Logger LOGGER = LogUtils.getLogger(); private final ResourceLocation name; final int width; @@ -172,7 +173,7 @@ public class SpriteContents implements Stitcher.Entry, AutoCloseable { j = y + this.animatedTexture.getFrameY(frame) * this.height; } - return (this.originalImage.getPixelRGBA(i, j) >> 24 & 0xFF) == 0; + return ARGB.alpha(this.originalImage.getPixel(i, j)) == 0; } public void uploadFirstFrame(int x, int y) { @@ -249,7 +250,7 @@ public class SpriteContents implements Stitcher.Entry, AutoCloseable { SpriteContents.AnimatedTexture animatedTexture = ticker.animationInfo; List list = animatedTexture.frames; SpriteContents.FrameInfo frameInfo = (SpriteContents.FrameInfo)list.get(ticker.frame); - double d = 1.0 - (double)ticker.subFrame / frameInfo.time; + float f = (float)ticker.subFrame / frameInfo.time; int i = frameInfo.index; int j = ((SpriteContents.FrameInfo)list.get((ticker.frame + 1) % list.size())).index; if (i != j) { @@ -261,10 +262,7 @@ public class SpriteContents implements Stitcher.Entry, AutoCloseable { for (int o = 0; o < l; o++) { int p = this.getPixel(animatedTexture, i, k, o, n); int q = this.getPixel(animatedTexture, j, k, o, n); - int r = this.mix(d, p >> 16 & 0xFF, q >> 16 & 0xFF); - int s = this.mix(d, p >> 8 & 0xFF, q >> 8 & 0xFF); - int t = this.mix(d, p & 0xFF, q & 0xFF); - this.activeFrame[k].setPixelRGBA(o, n, p & 0xFF000000 | r << 16 | s << 8 | t); + this.activeFrame[k].setPixel(o, n, ARGB.lerp(f, p, q)); } } } @@ -275,16 +273,12 @@ public class SpriteContents implements Stitcher.Entry, AutoCloseable { private int getPixel(SpriteContents.AnimatedTexture animatedTexture, int frameIndex, int mipLevel, int x, int y) { return SpriteContents.this.byMipLevel[mipLevel] - .getPixelRGBA( + .getPixel( x + (animatedTexture.getFrameX(frameIndex) * SpriteContents.this.width >> mipLevel), y + (animatedTexture.getFrameY(frameIndex) * SpriteContents.this.height >> mipLevel) ); } - private int mix(double delta, int color1, int color2) { - return (int)(delta * color1 + (1.0 - delta) * color2); - } - public void close() { for (NativeImage nativeImage : this.activeFrame) { nativeImage.close(); @@ -318,11 +312,7 @@ public class SpriteContents implements Stitcher.Entry, AutoCloseable { this.animationInfo.uploadFrame(x, y, j); } } else if (this.interpolationData != null) { - if (!RenderSystem.isOnRenderThread()) { - RenderSystem.recordRenderCall(() -> this.interpolationData.uploadInterpolatedFrame(x, y, this)); - } else { - this.interpolationData.uploadInterpolatedFrame(x, y, this); - } + this.interpolationData.uploadInterpolatedFrame(x, y, this); } } diff --git a/net/minecraft/client/renderer/texture/TextureAtlas.java b/net/minecraft/client/renderer/texture/TextureAtlas.java index 09f1ff23..defeada5 100644 --- a/net/minecraft/client/renderer/texture/TextureAtlas.java +++ b/net/minecraft/client/renderer/texture/TextureAtlas.java @@ -17,6 +17,8 @@ import net.fabricmc.api.Environment; import net.minecraft.CrashReport; import net.minecraft.CrashReportCategory; import net.minecraft.ReportedException; +import net.minecraft.client.renderer.texture.SpriteLoader.Preparations; +import net.minecraft.client.renderer.texture.TextureAtlasSprite.Ticker; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.packs.resources.ResourceManager; import net.minecraft.world.inventory.InventoryMenu; @@ -31,7 +33,7 @@ public class TextureAtlas extends AbstractTexture implements Dumpable, Tickable @Deprecated public static final ResourceLocation LOCATION_PARTICLES = ResourceLocation.withDefaultNamespace("textures/atlas/particles.png"); private List sprites = List.of(); - private List animatedTextures = List.of(); + private List animatedTextures = List.of(); private Map texturesByName = Map.of(); @Nullable private TextureAtlasSprite missingSprite; @@ -50,7 +52,7 @@ public class TextureAtlas extends AbstractTexture implements Dumpable, Tickable public void load(ResourceManager resourceManager) { } - public void upload(SpriteLoader.Preparations preparations) { + public void upload(Preparations preparations) { LOGGER.info("Created: {}x{}x{} {}-atlas", preparations.width(), preparations.height(), preparations.mipLevel(), this.location); TextureUtil.prepareImage(this.getId(), preparations.mipLevel(), preparations.width(), preparations.height()); this.width = preparations.width(); @@ -63,7 +65,7 @@ public class TextureAtlas extends AbstractTexture implements Dumpable, Tickable throw new IllegalStateException("Atlas '" + this.location + "' (" + this.texturesByName.size() + " sprites) has no missing texture sprite"); } else { List list = new ArrayList(); - List list2 = new ArrayList(); + List list2 = new ArrayList(); for (TextureAtlasSprite textureAtlasSprite : preparations.regions().values()) { list.add(textureAtlasSprite.contents()); @@ -78,7 +80,7 @@ public class TextureAtlas extends AbstractTexture implements Dumpable, Tickable throw new ReportedException(crashReport); } - TextureAtlasSprite.Ticker ticker = textureAtlasSprite.createTicker(); + Ticker ticker = textureAtlasSprite.createTicker(); if (ticker != null) { list2.add(ticker); } @@ -140,18 +142,14 @@ public class TextureAtlas extends AbstractTexture implements Dumpable, Tickable public void cycleAnimationFrames() { this.bind(); - for (TextureAtlasSprite.Ticker ticker : this.animatedTextures) { + for (Ticker ticker : this.animatedTextures) { ticker.tickAndUpload(); } } @Override public void tick() { - if (!RenderSystem.isOnRenderThread()) { - RenderSystem.recordRenderCall(this::cycleAnimationFrames); - } else { - this.cycleAnimationFrames(); - } + this.cycleAnimationFrames(); } public TextureAtlasSprite getSprite(ResourceLocation name) { @@ -165,7 +163,7 @@ public class TextureAtlas extends AbstractTexture implements Dumpable, Tickable public void clearTextureData() { this.sprites.forEach(SpriteContents::close); - this.animatedTextures.forEach(TextureAtlasSprite.Ticker::close); + this.animatedTextures.forEach(Ticker::close); this.sprites = List.of(); this.animatedTextures = List.of(); this.texturesByName = Map.of(); @@ -188,7 +186,7 @@ public class TextureAtlas extends AbstractTexture implements Dumpable, Tickable return this.height; } - public void updateFilter(SpriteLoader.Preparations preparations) { + public void updateFilter(Preparations preparations) { this.setFilter(false, preparations.mipLevel() > 0); } } diff --git a/net/minecraft/client/renderer/texture/TextureManager.java b/net/minecraft/client/renderer/texture/TextureManager.java index ff511d8d..89385a2f 100644 --- a/net/minecraft/client/renderer/texture/TextureManager.java +++ b/net/minecraft/client/renderer/texture/TextureManager.java @@ -26,7 +26,6 @@ import net.minecraft.client.gui.screens.TitleScreen; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.packs.resources.PreparableReloadListener; import net.minecraft.server.packs.resources.ResourceManager; -import net.minecraft.util.profiling.ProfilerFiller; import org.slf4j.Logger; @Environment(EnvType.CLIENT) @@ -42,24 +41,6 @@ public class TextureManager implements PreparableReloadListener, Tickable, AutoC this.resourceManager = resourceManager; } - public void bindForSetup(ResourceLocation path) { - if (!RenderSystem.isOnRenderThread()) { - RenderSystem.recordRenderCall(() -> this._bind(path)); - } else { - this._bind(path); - } - } - - private void _bind(ResourceLocation path) { - AbstractTexture abstractTexture = (AbstractTexture)this.byPath.get(path); - if (abstractTexture == null) { - abstractTexture = new SimpleTexture(path); - this.register(path, abstractTexture); - } - - abstractTexture.bind(); - } - public void register(ResourceLocation path, AbstractTexture texture) { texture = this.loadTexture(path, texture); AbstractTexture abstractTexture = (AbstractTexture)this.byPath.put(path, texture); @@ -172,15 +153,10 @@ public class TextureManager implements PreparableReloadListener, Tickable, AutoC @Override public CompletableFuture reload( - PreparableReloadListener.PreparationBarrier preparationBarrier, - ResourceManager resourceManager, - ProfilerFiller preparationsProfiler, - ProfilerFiller reloadProfiler, - Executor backgroundExecutor, - Executor gameExecutor + PreparableReloadListener.PreparationBarrier preparationBarrier, ResourceManager resourceManager, Executor executor, Executor executor2 ) { CompletableFuture completableFuture = new CompletableFuture(); - TitleScreen.preloadResources(this, backgroundExecutor).thenCompose(preparationBarrier::wait).thenAcceptAsync(void_ -> { + TitleScreen.preloadResources(this, executor).thenCompose(preparationBarrier::wait).thenAcceptAsync(void_ -> { MissingTextureAtlasSprite.getTexture(); AddRealmPopupScreen.updateCarouselImages(this.resourceManager); Iterator> iterator = this.byPath.entrySet().iterator(); @@ -192,11 +168,11 @@ public class TextureManager implements PreparableReloadListener, Tickable, AutoC if (abstractTexture == MissingTextureAtlasSprite.getTexture() && !resourceLocation.equals(MissingTextureAtlasSprite.getLocation())) { iterator.remove(); } else { - abstractTexture.reset(this, resourceManager, resourceLocation, gameExecutor); + abstractTexture.reset(this, resourceManager, resourceLocation, executor2); } } - Minecraft.getInstance().tell(() -> completableFuture.complete(null)); + Minecraft.getInstance().schedule(() -> completableFuture.complete(null)); }, runnable -> RenderSystem.recordRenderCall(runnable::run)); return completableFuture; } diff --git a/net/minecraft/client/renderer/texture/atlas/sources/PalettedPermutations.java b/net/minecraft/client/renderer/texture/atlas/sources/PalettedPermutations.java index d4f33518..755843f1 100644 --- a/net/minecraft/client/renderer/texture/atlas/sources/PalettedPermutations.java +++ b/net/minecraft/client/renderer/texture/atlas/sources/PalettedPermutations.java @@ -24,12 +24,14 @@ import net.minecraft.client.renderer.texture.atlas.SpriteResourceLoader; import net.minecraft.client.renderer.texture.atlas.SpriteSource; import net.minecraft.client.renderer.texture.atlas.SpriteSourceType; import net.minecraft.client.renderer.texture.atlas.SpriteSources; +import net.minecraft.client.renderer.texture.atlas.SpriteSource.Output; +import net.minecraft.client.renderer.texture.atlas.SpriteSource.SpriteSupplier; import net.minecraft.client.resources.metadata.animation.FrameSize; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.packs.resources.Resource; import net.minecraft.server.packs.resources.ResourceManager; import net.minecraft.server.packs.resources.ResourceMetadata; -import net.minecraft.util.FastColor; +import net.minecraft.util.ARGB; import org.jetbrains.annotations.Nullable; import org.slf4j.Logger; @@ -55,7 +57,7 @@ public class PalettedPermutations implements SpriteSource { } @Override - public void run(ResourceManager resourceManager, SpriteSource.Output output) { + public void run(ResourceManager resourceManager, Output output) { Supplier supplier = Suppliers.memoize(() -> loadPaletteEntryFromImage(resourceManager, this.paletteKey)); Map> map = new HashMap(); this.permutations @@ -92,26 +94,26 @@ public class PalettedPermutations implements SpriteSource { for (int i = 0; i < is.length; i++) { int j = is[i]; - if (FastColor.ABGR32.alpha(j) != 0) { - int2IntMap.put(FastColor.ABGR32.transparent(j), js[i]); + if (ARGB.alpha(j) != 0) { + int2IntMap.put(ARGB.transparent(j), js[i]); } } return ix -> { - int jx = FastColor.ABGR32.alpha(ix); + int jx = ARGB.alpha(ix); if (jx == 0) { return ix; } else { - int k = FastColor.ABGR32.transparent(ix); - int l = int2IntMap.getOrDefault(k, FastColor.ABGR32.opaque(k)); - int m = FastColor.ABGR32.alpha(l); - return FastColor.ABGR32.color(jx * m / 255, l); + int k = ARGB.transparent(ix); + int l = int2IntMap.getOrDefault(k, ARGB.opaque(k)); + int m = ARGB.alpha(l); + return ARGB.color(jx * m / 255, l); } }; } } - public static int[] loadPaletteEntryFromImage(ResourceManager resourceMananger, ResourceLocation palette) { + private static int[] loadPaletteEntryFromImage(ResourceManager resourceMananger, ResourceLocation palette) { Optional optional = resourceMananger.getResource(TEXTURE_ID_CONVERTER.idToFile(palette)); if (optional.isEmpty()) { LOGGER.error("Failed to load palette image {}", palette); @@ -122,7 +124,7 @@ public class PalettedPermutations implements SpriteSource { int[] var5; try (NativeImage nativeImage = NativeImage.read(inputStream)) { - var5 = nativeImage.getPixelsRGBA(); + var5 = nativeImage.getPixels(); } catch (Throwable var10) { if (inputStream != null) { try { @@ -153,8 +155,7 @@ public class PalettedPermutations implements SpriteSource { } @Environment(EnvType.CLIENT) - record PalettedSpriteSupplier(LazyLoadedImage baseImage, Supplier palette, ResourceLocation permutationLocation) - implements SpriteSource.SpriteSupplier { + record PalettedSpriteSupplier(LazyLoadedImage baseImage, Supplier palette, ResourceLocation permutationLocation) implements SpriteSupplier { @Nullable public SpriteContents apply(SpriteResourceLoader spriteResourceLoader) { Object var3; diff --git a/net/minecraft/client/resources/DefaultPlayerSkin.java b/net/minecraft/client/resources/DefaultPlayerSkin.java index 6dcd8de7..956af175 100644 --- a/net/minecraft/client/resources/DefaultPlayerSkin.java +++ b/net/minecraft/client/resources/DefaultPlayerSkin.java @@ -4,33 +4,38 @@ import com.mojang.authlib.GameProfile; import java.util.UUID; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; +import net.minecraft.client.resources.PlayerSkin.Model; import net.minecraft.resources.ResourceLocation; @Environment(EnvType.CLIENT) public class DefaultPlayerSkin { private static final PlayerSkin[] DEFAULT_SKINS = new PlayerSkin[]{ - create("textures/entity/player/slim/alex.png", PlayerSkin.Model.SLIM), - create("textures/entity/player/slim/ari.png", PlayerSkin.Model.SLIM), - create("textures/entity/player/slim/efe.png", PlayerSkin.Model.SLIM), - create("textures/entity/player/slim/kai.png", PlayerSkin.Model.SLIM), - create("textures/entity/player/slim/makena.png", PlayerSkin.Model.SLIM), - create("textures/entity/player/slim/noor.png", PlayerSkin.Model.SLIM), - create("textures/entity/player/slim/steve.png", PlayerSkin.Model.SLIM), - create("textures/entity/player/slim/sunny.png", PlayerSkin.Model.SLIM), - create("textures/entity/player/slim/zuri.png", PlayerSkin.Model.SLIM), - create("textures/entity/player/wide/alex.png", PlayerSkin.Model.WIDE), - create("textures/entity/player/wide/ari.png", PlayerSkin.Model.WIDE), - create("textures/entity/player/wide/efe.png", PlayerSkin.Model.WIDE), - create("textures/entity/player/wide/kai.png", PlayerSkin.Model.WIDE), - create("textures/entity/player/wide/makena.png", PlayerSkin.Model.WIDE), - create("textures/entity/player/wide/noor.png", PlayerSkin.Model.WIDE), - create("textures/entity/player/wide/steve.png", PlayerSkin.Model.WIDE), - create("textures/entity/player/wide/sunny.png", PlayerSkin.Model.WIDE), - create("textures/entity/player/wide/zuri.png", PlayerSkin.Model.WIDE) + create("textures/entity/player/slim/alex.png", Model.SLIM), + create("textures/entity/player/slim/ari.png", Model.SLIM), + create("textures/entity/player/slim/efe.png", Model.SLIM), + create("textures/entity/player/slim/kai.png", Model.SLIM), + create("textures/entity/player/slim/makena.png", Model.SLIM), + create("textures/entity/player/slim/noor.png", Model.SLIM), + create("textures/entity/player/slim/steve.png", Model.SLIM), + create("textures/entity/player/slim/sunny.png", Model.SLIM), + create("textures/entity/player/slim/zuri.png", Model.SLIM), + create("textures/entity/player/wide/alex.png", Model.WIDE), + create("textures/entity/player/wide/ari.png", Model.WIDE), + create("textures/entity/player/wide/efe.png", Model.WIDE), + create("textures/entity/player/wide/kai.png", Model.WIDE), + create("textures/entity/player/wide/makena.png", Model.WIDE), + create("textures/entity/player/wide/noor.png", Model.WIDE), + create("textures/entity/player/wide/steve.png", Model.WIDE), + create("textures/entity/player/wide/sunny.png", Model.WIDE), + create("textures/entity/player/wide/zuri.png", Model.WIDE) }; public static ResourceLocation getDefaultTexture() { - return DEFAULT_SKINS[6].texture(); + return getDefaultSkin().texture(); + } + + public static PlayerSkin getDefaultSkin() { + return DEFAULT_SKINS[6]; } public static PlayerSkin get(UUID uuid) { @@ -41,7 +46,7 @@ public class DefaultPlayerSkin { return get(profile.getId()); } - private static PlayerSkin create(String path, PlayerSkin.Model skinModel) { + private static PlayerSkin create(String path, Model skinModel) { return new PlayerSkin(ResourceLocation.withDefaultNamespace(path), null, null, null, skinModel, true); } } diff --git a/net/minecraft/client/resources/MapTextureManager.java b/net/minecraft/client/resources/MapTextureManager.java new file mode 100644 index 00000000..e2d68820 --- /dev/null +++ b/net/minecraft/client/resources/MapTextureManager.java @@ -0,0 +1,101 @@ +package net.minecraft.client.resources; + +import com.mojang.blaze3d.platform.NativeImage; +import it.unimi.dsi.fastutil.ints.Int2ObjectMap; +import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.client.renderer.texture.DynamicTexture; +import net.minecraft.client.renderer.texture.TextureManager; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.level.material.MapColor; +import net.minecraft.world.level.saveddata.maps.MapId; +import net.minecraft.world.level.saveddata.maps.MapItemSavedData; + +@Environment(EnvType.CLIENT) +public class MapTextureManager implements AutoCloseable { + private final Int2ObjectMap maps = new Int2ObjectOpenHashMap<>(); + final TextureManager textureManager; + + public MapTextureManager(TextureManager textureManager) { + this.textureManager = textureManager; + } + + public void update(MapId mapId, MapItemSavedData mapItemSavedData) { + this.getOrCreateMapInstance(mapId, mapItemSavedData).forceUpload(); + } + + public ResourceLocation prepareMapTexture(MapId mapId, MapItemSavedData mapItemSavedData) { + MapTextureManager.MapInstance mapInstance = this.getOrCreateMapInstance(mapId, mapItemSavedData); + mapInstance.updateTextureIfNeeded(); + return mapInstance.location; + } + + public void resetData() { + for (MapTextureManager.MapInstance mapInstance : this.maps.values()) { + mapInstance.close(); + } + + this.maps.clear(); + } + + private MapTextureManager.MapInstance getOrCreateMapInstance(MapId mapId, MapItemSavedData mapItemSavedData) { + return this.maps.compute(mapId.id(), (integer, mapInstance) -> { + if (mapInstance == null) { + return new MapTextureManager.MapInstance(integer, mapItemSavedData); + } else { + mapInstance.replaceMapData(mapItemSavedData); + return mapInstance; + } + }); + } + + public void close() { + this.resetData(); + } + + @Environment(EnvType.CLIENT) + class MapInstance implements AutoCloseable { + private MapItemSavedData data; + private final DynamicTexture texture; + private boolean requiresUpload = true; + final ResourceLocation location; + + MapInstance(final int i, final MapItemSavedData mapItemSavedData) { + this.data = mapItemSavedData; + this.texture = new DynamicTexture(128, 128, true); + this.location = MapTextureManager.this.textureManager.register("map/" + i, this.texture); + } + + void replaceMapData(MapItemSavedData mapItemSavedData) { + boolean bl = this.data != mapItemSavedData; + this.data = mapItemSavedData; + this.requiresUpload |= bl; + } + + public void forceUpload() { + this.requiresUpload = true; + } + + void updateTextureIfNeeded() { + if (this.requiresUpload) { + NativeImage nativeImage = this.texture.getPixels(); + if (nativeImage != null) { + for (int i = 0; i < 128; i++) { + for (int j = 0; j < 128; j++) { + int k = j + i * 128; + nativeImage.setPixel(j, i, MapColor.getColorFromPackedId(this.data.colors[k])); + } + } + } + + this.texture.upload(); + this.requiresUpload = false; + } + } + + public void close() { + this.texture.close(); + } + } +} diff --git a/net/minecraft/client/resources/SkinManager.java b/net/minecraft/client/resources/SkinManager.java index bf5c0d92..86674ec1 100644 --- a/net/minecraft/client/resources/SkinManager.java +++ b/net/minecraft/client/resources/SkinManager.java @@ -26,6 +26,7 @@ import net.minecraft.Optionull; import net.minecraft.Util; import net.minecraft.client.renderer.texture.HttpTexture; import net.minecraft.client.renderer.texture.TextureManager; +import net.minecraft.client.resources.PlayerSkin.Model; import net.minecraft.resources.ResourceLocation; import org.jetbrains.annotations.Nullable; import org.slf4j.Logger; @@ -61,7 +62,7 @@ public class SkinManager { return minecraftProfileTextures; } - }, Util.backgroundExecutor()) + }, Util.backgroundExecutor().forName("unpackSkinTextures")) .thenComposeAsync(minecraftProfileTextures -> SkinManager.this.registerTextures(cacheKey.profileId(), minecraftProfileTextures), executor); } } @@ -87,10 +88,10 @@ public class SkinManager { CompletableFuture registerTextures(UUID uuid, MinecraftProfileTextures textures) { MinecraftProfileTexture minecraftProfileTexture = textures.skin(); CompletableFuture completableFuture; - PlayerSkin.Model model; + Model model; if (minecraftProfileTexture != null) { completableFuture = this.skinTextures.getOrLoad(minecraftProfileTexture); - model = PlayerSkin.Model.byName(minecraftProfileTexture.getMetadata("model")); + model = Model.byName(minecraftProfileTexture.getMetadata("model")); } else { PlayerSkin playerSkin = DefaultPlayerSkin.get(uuid); completableFuture = CompletableFuture.completedFuture(playerSkin.texture()); diff --git a/net/minecraft/client/resources/TextureAtlasHolder.java b/net/minecraft/client/resources/TextureAtlasHolder.java index aa48ee96..34396086 100644 --- a/net/minecraft/client/resources/TextureAtlasHolder.java +++ b/net/minecraft/client/resources/TextureAtlasHolder.java @@ -9,11 +9,13 @@ import net.minecraft.client.renderer.texture.SpriteLoader; import net.minecraft.client.renderer.texture.TextureAtlas; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.texture.TextureManager; +import net.minecraft.client.renderer.texture.SpriteLoader.Preparations; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.packs.metadata.MetadataSectionSerializer; import net.minecraft.server.packs.resources.PreparableReloadListener; import net.minecraft.server.packs.resources.ResourceManager; -import net.minecraft.util.profiling.ProfilerFiller; +import net.minecraft.util.profiling.Profiler; +import net.minecraft.util.profiling.Zone; @Environment(EnvType.CLIENT) public abstract class TextureAtlasHolder implements PreparableReloadListener, AutoCloseable { @@ -43,26 +45,19 @@ public abstract class TextureAtlasHolder implements PreparableReloadListener, Au @Override public final CompletableFuture reload( - PreparableReloadListener.PreparationBarrier preparationBarrier, - ResourceManager resourceManager, - ProfilerFiller preparationsProfiler, - ProfilerFiller reloadProfiler, - Executor backgroundExecutor, - Executor gameExecutor + PreparableReloadListener.PreparationBarrier preparationBarrier, ResourceManager resourceManager, Executor executor, Executor executor2 ) { return SpriteLoader.create(this.textureAtlas) - .loadAndStitch(resourceManager, this.atlasInfoLocation, 0, backgroundExecutor, this.metadataSections) - .thenCompose(SpriteLoader.Preparations::waitForUpload) + .loadAndStitch(resourceManager, this.atlasInfoLocation, 0, executor, this.metadataSections) + .thenCompose(Preparations::waitForUpload) .thenCompose(preparationBarrier::wait) - .thenAcceptAsync(preparations -> this.apply(preparations, reloadProfiler), gameExecutor); + .thenAcceptAsync(this::apply, executor2); } - private void apply(SpriteLoader.Preparations preparations, ProfilerFiller profiler) { - profiler.startTick(); - profiler.push("upload"); - this.textureAtlas.upload(preparations); - profiler.pop(); - profiler.endTick(); + private void apply(Preparations preparations) { + try (Zone zone = Profiler.get().zone("upload")) { + this.textureAtlas.upload(preparations); + } } public void close() { diff --git a/net/minecraft/client/resources/language/ClientLanguage.java b/net/minecraft/client/resources/language/ClientLanguage.java index 0c814099..86faddd1 100644 --- a/net/minecraft/client/resources/language/ClientLanguage.java +++ b/net/minecraft/client/resources/language/ClientLanguage.java @@ -1,15 +1,15 @@ package net.minecraft.client.resources.language; -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.Maps; import com.mojang.logging.LogUtils; import java.io.IOException; import java.io.InputStream; +import java.util.HashMap; import java.util.List; import java.util.Locale; import java.util.Map; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; +import net.minecraft.locale.DeprecatedTranslationsInfo; import net.minecraft.locale.Language; import net.minecraft.network.chat.FormattedText; import net.minecraft.resources.ResourceLocation; @@ -30,7 +30,7 @@ public class ClientLanguage extends Language { } public static ClientLanguage loadFrom(ResourceManager resourceManager, List filenames, boolean defaultRightToLeft) { - Map map = Maps.newHashMap(); + Map map = new HashMap(); for (String string : filenames) { String string2 = String.format(Locale.ROOT, "lang/%s.json", string); @@ -45,7 +45,8 @@ public class ClientLanguage extends Language { } } - return new ClientLanguage(ImmutableMap.copyOf(map), defaultRightToLeft); + DeprecatedTranslationsInfo.loadFromDefaultResource().applyToMap(map); + return new ClientLanguage(Map.copyOf(map), defaultRightToLeft); } private static void appendFrom(String languageName, List resources, Map destinationMap) { diff --git a/net/minecraft/client/resources/metadata/gui/GuiSpriteScaling.java b/net/minecraft/client/resources/metadata/gui/GuiSpriteScaling.java index 6760a7b8..9cb439e1 100644 --- a/net/minecraft/client/resources/metadata/gui/GuiSpriteScaling.java +++ b/net/minecraft/client/resources/metadata/gui/GuiSpriteScaling.java @@ -1,13 +1,12 @@ package net.minecraft.client.resources.metadata.gui; -import com.mojang.datafixers.util.Either; import com.mojang.serialization.Codec; import com.mojang.serialization.DataResult; import com.mojang.serialization.MapCodec; import com.mojang.serialization.codecs.RecordCodecBuilder; -import java.util.OptionalInt; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; +import net.minecraft.client.resources.metadata.gui.GuiSpriteScaling.NineSlice.Border; import net.minecraft.util.ExtraCodecs; import net.minecraft.util.StringRepresentable; @@ -19,19 +18,20 @@ public interface GuiSpriteScaling { GuiSpriteScaling.Type type(); @Environment(EnvType.CLIENT) - public record NineSlice(int width, int height, GuiSpriteScaling.NineSlice.Border border) implements GuiSpriteScaling { + public record NineSlice(int width, int height, Border border, boolean stretchInner) implements GuiSpriteScaling { public static final MapCodec CODEC = RecordCodecBuilder.mapCodec( instance -> instance.group( ExtraCodecs.POSITIVE_INT.fieldOf("width").forGetter(GuiSpriteScaling.NineSlice::width), ExtraCodecs.POSITIVE_INT.fieldOf("height").forGetter(GuiSpriteScaling.NineSlice::height), - GuiSpriteScaling.NineSlice.Border.CODEC.fieldOf("border").forGetter(GuiSpriteScaling.NineSlice::border) + Border.CODEC.fieldOf("border").forGetter(GuiSpriteScaling.NineSlice::border), + Codec.BOOL.optionalFieldOf("stretch_inner", false).forGetter(GuiSpriteScaling.NineSlice::stretchInner) ) .apply(instance, GuiSpriteScaling.NineSlice::new) ) .validate(GuiSpriteScaling.NineSlice::validate); private static DataResult validate(GuiSpriteScaling.NineSlice nineSlice) { - GuiSpriteScaling.NineSlice.Border border = nineSlice.border(); + Border border = nineSlice.border(); if (border.left() + border.right() >= nineSlice.width()) { return DataResult.error(() -> "Nine-sliced texture has no horizontal center slice: " + border.left() + " + " + border.right() + " >= " + nineSlice.width()); } else { @@ -45,30 +45,6 @@ public interface GuiSpriteScaling { public GuiSpriteScaling.Type type() { return GuiSpriteScaling.Type.NINE_SLICE; } - - @Environment(EnvType.CLIENT) - public record Border(int left, int top, int right, int bottom) { - private static final Codec VALUE_CODEC = ExtraCodecs.POSITIVE_INT - .flatComapMap(integer -> new GuiSpriteScaling.NineSlice.Border(integer, integer, integer, integer), border -> { - OptionalInt optionalInt = border.unpackValue(); - return optionalInt.isPresent() ? DataResult.success(optionalInt.getAsInt()) : DataResult.error(() -> "Border has different side sizes"); - }); - private static final Codec RECORD_CODEC = RecordCodecBuilder.create( - instance -> instance.group( - ExtraCodecs.NON_NEGATIVE_INT.fieldOf("left").forGetter(GuiSpriteScaling.NineSlice.Border::left), - ExtraCodecs.NON_NEGATIVE_INT.fieldOf("top").forGetter(GuiSpriteScaling.NineSlice.Border::top), - ExtraCodecs.NON_NEGATIVE_INT.fieldOf("right").forGetter(GuiSpriteScaling.NineSlice.Border::right), - ExtraCodecs.NON_NEGATIVE_INT.fieldOf("bottom").forGetter(GuiSpriteScaling.NineSlice.Border::bottom) - ) - .apply(instance, GuiSpriteScaling.NineSlice.Border::new) - ); - static final Codec CODEC = Codec.either(VALUE_CODEC, RECORD_CODEC) - .xmap(Either::unwrap, border -> border.unpackValue().isPresent() ? Either.left(border) : Either.right(border)); - - private OptionalInt unpackValue() { - return this.left() == this.top() && this.top() == this.right() && this.right() == this.bottom() ? OptionalInt.of(this.left()) : OptionalInt.empty(); - } - } } @Environment(EnvType.CLIENT) diff --git a/net/minecraft/client/resources/model/BakedModel.java b/net/minecraft/client/resources/model/BakedModel.java index 25a9786a..bc5daffd 100644 --- a/net/minecraft/client/resources/model/BakedModel.java +++ b/net/minecraft/client/resources/model/BakedModel.java @@ -3,8 +3,8 @@ package net.minecraft.client.resources.model; import java.util.List; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; +import net.minecraft.client.renderer.block.model.BakedOverrides; import net.minecraft.client.renderer.block.model.BakedQuad; -import net.minecraft.client.renderer.block.model.ItemOverrides; import net.minecraft.client.renderer.block.model.ItemTransforms; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.core.Direction; @@ -28,5 +28,7 @@ public interface BakedModel { ItemTransforms getTransforms(); - ItemOverrides getOverrides(); + default BakedOverrides overrides() { + return BakedOverrides.EMPTY; + } } diff --git a/net/minecraft/client/resources/model/BlockStateModelLoader.java b/net/minecraft/client/resources/model/BlockStateModelLoader.java index 0d59aed7..da588da1 100644 --- a/net/minecraft/client/resources/model/BlockStateModelLoader.java +++ b/net/minecraft/client/resources/model/BlockStateModelLoader.java @@ -1,298 +1,103 @@ package net.minecraft.client.resources.model; -import com.google.common.base.Splitter; -import com.google.common.collect.Sets; -import com.google.gson.JsonElement; import com.mojang.logging.LogUtils; -import it.unimi.dsi.fastutil.objects.Object2IntMap; -import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; -import java.util.Collection; import java.util.HashMap; -import java.util.IdentityHashMap; import java.util.Iterator; import java.util.List; -import java.util.Locale; import java.util.Map; -import java.util.Objects; -import java.util.Set; -import java.util.Map.Entry; -import java.util.function.BiConsumer; -import java.util.function.Predicate; -import java.util.function.Supplier; -import java.util.stream.Collectors; +import java.util.function.Function; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; -import net.minecraft.Util; -import net.minecraft.client.color.block.BlockColors; import net.minecraft.client.renderer.block.BlockModelShaper; import net.minecraft.client.renderer.block.model.BlockModelDefinition; -import net.minecraft.client.renderer.block.model.multipart.MultiPart; -import net.minecraft.client.renderer.block.model.multipart.Selector; import net.minecraft.core.registries.BuiltInRegistries; -import net.minecraft.resources.FileToIdConverter; import net.minecraft.resources.ResourceLocation; -import net.minecraft.util.profiling.ProfilerFiller; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; -import net.minecraft.world.level.block.RenderShape; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.block.state.properties.BooleanProperty; -import net.minecraft.world.level.block.state.properties.Property; -import org.jetbrains.annotations.Nullable; import org.slf4j.Logger; @Environment(EnvType.CLIENT) public class BlockStateModelLoader { private static final Logger LOGGER = LogUtils.getLogger(); - static final int SINGLETON_MODEL_GROUP = -1; - private static final int INVISIBLE_MODEL_GROUP = 0; - public static final FileToIdConverter BLOCKSTATE_LISTER = FileToIdConverter.json("blockstates"); - private static final Splitter COMMA_SPLITTER = Splitter.on(','); - private static final Splitter EQUAL_SPLITTER = Splitter.on('=').limit(2); + private static final String FRAME_MAP_PROPERTY = "map"; + private static final String FRAME_MAP_PROPERTY_TRUE = "map=true"; + private static final String FRAME_MAP_PROPERTY_FALSE = "map=false"; private static final StateDefinition ITEM_FRAME_FAKE_DEFINITION = new StateDefinition.Builder(Blocks.AIR) .add(BooleanProperty.create("map")) .create(Block::defaultBlockState, BlockState::new); + private static final ResourceLocation GLOW_ITEM_FRAME_LOCATION = ResourceLocation.withDefaultNamespace("glow_item_frame"); + private static final ResourceLocation ITEM_FRAME_LOCATION = ResourceLocation.withDefaultNamespace("item_frame"); private static final Map> STATIC_DEFINITIONS = Map.of( - ResourceLocation.withDefaultNamespace("item_frame"), - ITEM_FRAME_FAKE_DEFINITION, - ResourceLocation.withDefaultNamespace("glow_item_frame"), - ITEM_FRAME_FAKE_DEFINITION + ITEM_FRAME_LOCATION, ITEM_FRAME_FAKE_DEFINITION, GLOW_ITEM_FRAME_LOCATION, ITEM_FRAME_FAKE_DEFINITION ); - private final Map> blockStateResources; - private final ProfilerFiller profiler; - private final BlockColors blockColors; - private final BiConsumer discoveredModelOutput; - private int nextModelGroup = 1; - private final Object2IntMap modelGroups = Util.make( - new Object2IntOpenHashMap<>(), object2IntOpenHashMap -> object2IntOpenHashMap.defaultReturnValue(-1) - ); - private final BlockStateModelLoader.LoadedModel missingModel; - private final BlockModelDefinition.Context context = new BlockModelDefinition.Context(); + public static final ModelResourceLocation GLOW_MAP_FRAME_LOCATION = new ModelResourceLocation(GLOW_ITEM_FRAME_LOCATION, "map=true"); + public static final ModelResourceLocation GLOW_FRAME_LOCATION = new ModelResourceLocation(GLOW_ITEM_FRAME_LOCATION, "map=false"); + public static final ModelResourceLocation MAP_FRAME_LOCATION = new ModelResourceLocation(ITEM_FRAME_LOCATION, "map=true"); + public static final ModelResourceLocation FRAME_LOCATION = new ModelResourceLocation(ITEM_FRAME_LOCATION, "map=false"); + private final UnbakedModel missingModel; - public BlockStateModelLoader( - Map> blockStateResources, - ProfilerFiller profiler, - UnbakedModel missingModel, - BlockColors blockColors, - BiConsumer discoveredModelOutput - ) { - this.blockStateResources = blockStateResources; - this.profiler = profiler; - this.blockColors = blockColors; - this.discoveredModelOutput = discoveredModelOutput; - BlockStateModelLoader.ModelGroupKey modelGroupKey = new BlockStateModelLoader.ModelGroupKey(List.of(missingModel), List.of()); - this.missingModel = new BlockStateModelLoader.LoadedModel(missingModel, () -> modelGroupKey); + public BlockStateModelLoader(UnbakedModel unbakedModel) { + this.missingModel = unbakedModel; } - public void loadAllBlockStates() { - this.profiler.push("static_definitions"); - STATIC_DEFINITIONS.forEach(this::loadBlockStateDefinitions); - this.profiler.popPush("blocks"); + public static Function> definitionLocationToBlockMapper() { + Map> map = new HashMap(STATIC_DEFINITIONS); for (Block block : BuiltInRegistries.BLOCK) { - this.loadBlockStateDefinitions(block.builtInRegistryHolder().key().location(), block.getStateDefinition()); + map.put(block.builtInRegistryHolder().key().location(), block.getStateDefinition()); } - this.profiler.pop(); + return map::get; } - private void loadBlockStateDefinitions(ResourceLocation blockStateId, StateDefinition stateDefenition) { - this.context.setDefinition(stateDefenition); - List> list = List.copyOf(this.blockColors.getColoringProperties(stateDefenition.getOwner())); - List list2 = stateDefenition.getPossibleStates(); - Map map = new HashMap(); - list2.forEach(blockState -> map.put(BlockModelShaper.stateToModelLocation(blockStateId, blockState), blockState)); - Map map2 = new HashMap(); - ResourceLocation resourceLocation = BLOCKSTATE_LISTER.idToFile(blockStateId); + public BlockStateModelLoader.LoadedModels loadBlockStateDefinitionStack( + ResourceLocation resourceLocation, StateDefinition stateDefinition, List list + ) { + List list2 = stateDefinition.getPossibleStates(); + Map map = new HashMap(); + Map map2 = new HashMap(); try { - for (BlockStateModelLoader.LoadedJson loadedJson : (List)this.blockStateResources.getOrDefault(resourceLocation, List.of())) { - BlockModelDefinition blockModelDefinition = loadedJson.parse(blockStateId, this.context); - Map map3 = new IdentityHashMap(); - MultiPart multiPart; - if (blockModelDefinition.isMultiPart()) { - multiPart = blockModelDefinition.getMultiPart(); - list2.forEach( - blockState -> map3.put( - blockState, new BlockStateModelLoader.LoadedModel(multiPart, () -> BlockStateModelLoader.ModelGroupKey.create(blockState, multiPart, list)) - ) - ); - } else { - multiPart = null; - } - - blockModelDefinition.getVariants() - .forEach( - (string, multiVariant) -> { - try { - list2.stream() - .filter(predicate(stateDefenition, string)) - .forEach( - blockState -> { - BlockStateModelLoader.LoadedModel loadedModel = (BlockStateModelLoader.LoadedModel)map3.put( - blockState, new BlockStateModelLoader.LoadedModel(multiVariant, () -> BlockStateModelLoader.ModelGroupKey.create(blockState, multiVariant, list)) - ); - if (loadedModel != null && loadedModel.model != multiPart) { - map3.put(blockState, this.missingModel); - throw new RuntimeException( - "Overlapping definition with: " - + (String)((Entry)blockModelDefinition.getVariants().entrySet().stream().filter(entry -> entry.getValue() == loadedModel.model).findFirst().get()) - .getKey() - ); - } - } - ); - } catch (Exception var12x) { - LOGGER.warn( - "Exception loading blockstate definition: '{}' in resourcepack: '{}' for variant: '{}': {}", - resourceLocation, - loadedJson.source, - string, - var12x.getMessage() - ); - } - } - ); - map2.putAll(map3); + for (BlockStateModelLoader.LoadedBlockModelDefinition loadedBlockModelDefinition : list) { + loadedBlockModelDefinition.contents + .instantiate(stateDefinition, resourceLocation + "/" + loadedBlockModelDefinition.source) + .forEach((blockStatex, unbakedBlockStateModel) -> map.put(blockStatex, new BlockStateModelLoader.LoadedModel(blockStatex, unbakedBlockStateModel))); } - } catch (BlockStateModelLoader.BlockStateDefinitionException var18) { - LOGGER.warn("{}", var18.getMessage()); - } catch (Exception var19) { - LOGGER.warn("Exception loading blockstate definition: '{}'", resourceLocation, var19); } finally { - Map> map5 = new HashMap(); - map.forEach((modelResourceLocation, blockState) -> { - BlockStateModelLoader.LoadedModel loadedModel = (BlockStateModelLoader.LoadedModel)map2.get(blockState); - if (loadedModel == null) { - LOGGER.warn("Exception loading blockstate definition: '{}' missing model for variant: '{}'", resourceLocation, modelResourceLocation); - loadedModel = this.missingModel; - } + Iterator var12 = list2.iterator(); - this.discoveredModelOutput.accept(modelResourceLocation, loadedModel.model); - - try { - BlockStateModelLoader.ModelGroupKey modelGroupKey = (BlockStateModelLoader.ModelGroupKey)loadedModel.key().get(); - ((Set)map5.computeIfAbsent(modelGroupKey, modelGroupKeyx -> Sets.newIdentityHashSet())).add(blockState); - } catch (Exception var8) { - LOGGER.warn("Exception evaluating model definition: '{}'", modelResourceLocation, var8); - } - }); - map5.forEach((modelGroupKey, set) -> { - Iterator iterator = set.iterator(); - - while (iterator.hasNext()) { - BlockState blockState = (BlockState)iterator.next(); - if (blockState.getRenderShape() != RenderShape.MODEL) { - iterator.remove(); - this.modelGroups.put(blockState, 0); - } - } - - if (set.size() > 1) { - this.registerModelGroup(set); - } - }); - } - } - - private static Predicate predicate(StateDefinition stateDefentition, String properties) { - Map, Comparable> map = new HashMap(); - - for (String string : COMMA_SPLITTER.split(properties)) { - Iterator iterator = EQUAL_SPLITTER.split(string).iterator(); - if (iterator.hasNext()) { - String string2 = (String)iterator.next(); - Property property = stateDefentition.getProperty(string2); - if (property != null && iterator.hasNext()) { - String string3 = (String)iterator.next(); - Comparable comparable = getValueHelper((Property>)property, string3); - if (comparable == null) { - throw new RuntimeException("Unknown value: '" + string3 + "' for blockstate property: '" + string2 + "' " + property.getPossibleValues()); + while (true) { + if (!var12.hasNext()) { + ; + } else { + BlockState blockState2 = (BlockState)var12.next(); + ModelResourceLocation modelResourceLocation2 = BlockModelShaper.stateToModelLocation(resourceLocation, blockState2); + BlockStateModelLoader.LoadedModel loadedModel2 = (BlockStateModelLoader.LoadedModel)map.get(blockState2); + if (loadedModel2 == null) { + LOGGER.warn("Missing blockstate definition: '{}' missing model for variant: '{}'", resourceLocation, modelResourceLocation2); + loadedModel2 = new BlockStateModelLoader.LoadedModel(blockState2, this.missingModel); } - map.put(property, comparable); - } else if (!string2.isEmpty()) { - throw new RuntimeException("Unknown blockstate property: '" + string2 + "'"); + map2.put(modelResourceLocation2, loadedModel2); } } } - Block block = stateDefentition.getOwner(); - return blockState -> { - if (blockState != null && blockState.is(block)) { - for (Entry, Comparable> entry : map.entrySet()) { - if (!Objects.equals(blockState.getValue((Property)entry.getKey()), entry.getValue())) { - return false; - } - } - - return true; - } else { - return false; - } - }; - } - - @Nullable - static > T getValueHelper(Property property, String propertyName) { - return (T)property.getValue(propertyName).orElse(null); - } - - private void registerModelGroup(Iterable models) { - int i = this.nextModelGroup++; - models.forEach(blockState -> this.modelGroups.put(blockState, i)); - } - - public Object2IntMap getModelGroups() { - return this.modelGroups; + return new BlockStateModelLoader.LoadedModels(map2); } @Environment(EnvType.CLIENT) - static class BlockStateDefinitionException extends RuntimeException { - public BlockStateDefinitionException(String message) { - super(message); - } + public record LoadedBlockModelDefinition(String source, BlockModelDefinition contents) { } @Environment(EnvType.CLIENT) - public record LoadedJson(String source, JsonElement data) { - - BlockModelDefinition parse(ResourceLocation blockStateId, BlockModelDefinition.Context context) { - try { - return BlockModelDefinition.fromJsonElement(context, this.data); - } catch (Exception var4) { - throw new BlockStateModelLoader.BlockStateDefinitionException( - String.format(Locale.ROOT, "Exception loading blockstate definition: '%s' in resourcepack: '%s': %s", blockStateId, this.source, var4.getMessage()) - ); - } - } + public record LoadedModel(BlockState state, UnbakedModel model) { } @Environment(EnvType.CLIENT) - record LoadedModel(UnbakedModel model, Supplier key) { - } - - @Environment(EnvType.CLIENT) - record ModelGroupKey(List models, List coloringValues) { - public static BlockStateModelLoader.ModelGroupKey create(BlockState state, MultiPart model, Collection> properties) { - StateDefinition stateDefinition = state.getBlock().getStateDefinition(); - List list = (List)model.getSelectors() - .stream() - .filter(selector -> selector.getPredicate(stateDefinition).test(state)) - .map(Selector::getVariant) - .collect(Collectors.toUnmodifiableList()); - List list2 = getColoringValues(state, properties); - return new BlockStateModelLoader.ModelGroupKey(list, list2); - } - - public static BlockStateModelLoader.ModelGroupKey create(BlockState state, UnbakedModel model, Collection> properties) { - List list = getColoringValues(state, properties); - return new BlockStateModelLoader.ModelGroupKey(List.of(model), list); - } - - private static List getColoringValues(BlockState state, Collection> properties) { - return (List)properties.stream().map(state::getValue).collect(Collectors.toUnmodifiableList()); - } + public record LoadedModels(Map models) { } } diff --git a/net/minecraft/client/resources/model/BuiltInModel.java b/net/minecraft/client/resources/model/BuiltInModel.java index 82790df9..f712b2b2 100644 --- a/net/minecraft/client/resources/model/BuiltInModel.java +++ b/net/minecraft/client/resources/model/BuiltInModel.java @@ -5,7 +5,6 @@ import java.util.List; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.renderer.block.model.BakedQuad; -import net.minecraft.client.renderer.block.model.ItemOverrides; import net.minecraft.client.renderer.block.model.ItemTransforms; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.core.Direction; @@ -16,15 +15,13 @@ import org.jetbrains.annotations.Nullable; @Environment(EnvType.CLIENT) public class BuiltInModel implements BakedModel { private final ItemTransforms itemTransforms; - private final ItemOverrides overrides; private final TextureAtlasSprite particleTexture; private final boolean usesBlockLight; - public BuiltInModel(ItemTransforms itemTransforms, ItemOverrides overrides, TextureAtlasSprite particleTexture, boolean usesBlockLight) { + public BuiltInModel(ItemTransforms itemTransforms, TextureAtlasSprite textureAtlasSprite, boolean bl) { this.itemTransforms = itemTransforms; - this.overrides = overrides; - this.particleTexture = particleTexture; - this.usesBlockLight = usesBlockLight; + this.particleTexture = textureAtlasSprite; + this.usesBlockLight = bl; } @Override @@ -61,9 +58,4 @@ public class BuiltInModel implements BakedModel { public ItemTransforms getTransforms() { return this.itemTransforms; } - - @Override - public ItemOverrides getOverrides() { - return this.overrides; - } } diff --git a/net/minecraft/client/resources/model/DelegateBakedModel.java b/net/minecraft/client/resources/model/DelegateBakedModel.java new file mode 100644 index 00000000..e019c896 --- /dev/null +++ b/net/minecraft/client/resources/model/DelegateBakedModel.java @@ -0,0 +1,56 @@ +package net.minecraft.client.resources.model; + +import java.util.List; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.client.renderer.block.model.BakedQuad; +import net.minecraft.client.renderer.block.model.ItemTransforms; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.core.Direction; +import net.minecraft.util.RandomSource; +import net.minecraft.world.level.block.state.BlockState; +import org.jetbrains.annotations.Nullable; + +@Environment(EnvType.CLIENT) +public abstract class DelegateBakedModel implements BakedModel { + protected final BakedModel parent; + + public DelegateBakedModel(BakedModel bakedModel) { + this.parent = bakedModel; + } + + @Override + public List getQuads(@Nullable BlockState state, @Nullable Direction direction, RandomSource random) { + return this.parent.getQuads(state, direction, random); + } + + @Override + public boolean useAmbientOcclusion() { + return this.parent.useAmbientOcclusion(); + } + + @Override + public boolean isGui3d() { + return this.parent.isGui3d(); + } + + @Override + public boolean usesBlockLight() { + return this.parent.usesBlockLight(); + } + + @Override + public boolean isCustomRenderer() { + return this.parent.isCustomRenderer(); + } + + @Override + public TextureAtlasSprite getParticleIcon() { + return this.parent.getParticleIcon(); + } + + @Override + public ItemTransforms getTransforms() { + return this.parent.getTransforms(); + } +} diff --git a/net/minecraft/client/resources/model/EquipmentModelSet.java b/net/minecraft/client/resources/model/EquipmentModelSet.java new file mode 100644 index 00000000..9e1194b5 --- /dev/null +++ b/net/minecraft/client/resources/model/EquipmentModelSet.java @@ -0,0 +1,28 @@ +package net.minecraft.client.resources.model; + +import java.util.Map; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.packs.resources.ResourceManager; +import net.minecraft.server.packs.resources.SimpleJsonResourceReloadListener; +import net.minecraft.util.profiling.ProfilerFiller; +import net.minecraft.world.item.equipment.EquipmentModel; + +@Environment(EnvType.CLIENT) +public class EquipmentModelSet extends SimpleJsonResourceReloadListener { + public static final EquipmentModel MISSING_MODEL = new EquipmentModel(Map.of()); + private Map models = Map.of(); + + public EquipmentModelSet() { + super(EquipmentModel.CODEC, "models/equipment"); + } + + protected void apply(Map map, ResourceManager resourceManager, ProfilerFiller profilerFiller) { + this.models = Map.copyOf(map); + } + + public EquipmentModel get(ResourceLocation resourceLocation) { + return (EquipmentModel)this.models.getOrDefault(resourceLocation, MISSING_MODEL); + } +} diff --git a/net/minecraft/client/resources/model/ItemModel.java b/net/minecraft/client/resources/model/ItemModel.java new file mode 100644 index 00000000..25eb90a5 --- /dev/null +++ b/net/minecraft/client/resources/model/ItemModel.java @@ -0,0 +1,55 @@ +package net.minecraft.client.resources.model; + +import java.util.List; +import java.util.function.Function; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.client.renderer.block.model.BakedOverrides; +import net.minecraft.client.renderer.block.model.BlockModel; +import net.minecraft.client.renderer.block.model.ItemOverride; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.resources.ResourceLocation; + +@Environment(EnvType.CLIENT) +public class ItemModel implements UnbakedModel { + private final ResourceLocation id; + private List overrides = List.of(); + + public ItemModel(ResourceLocation resourceLocation) { + this.id = resourceLocation; + } + + @Override + public void resolveDependencies(UnbakedModel.Resolver resolver) { + if (resolver.resolve(this.id) instanceof BlockModel blockModel) { + this.overrides = blockModel.getOverrides(); + this.overrides.forEach(itemOverride -> resolver.resolve(itemOverride.model())); + } + } + + @Override + public BakedModel bake(ModelBaker baker, Function spriteGetter, ModelState state) { + BakedModel bakedModel = baker.bake(this.id, state); + if (this.overrides.isEmpty()) { + return bakedModel; + } else { + BakedOverrides bakedOverrides = new BakedOverrides(baker, this.overrides); + return new ItemModel.BakedModelWithOverrides(bakedModel, bakedOverrides); + } + } + + @Environment(EnvType.CLIENT) + static class BakedModelWithOverrides extends DelegateBakedModel { + private final BakedOverrides overrides; + + public BakedModelWithOverrides(BakedModel bakedModel, BakedOverrides bakedOverrides) { + super(bakedModel); + this.overrides = bakedOverrides; + } + + @Override + public BakedOverrides overrides() { + return this.overrides; + } + } +} diff --git a/net/minecraft/client/resources/model/Material.java b/net/minecraft/client/resources/model/Material.java index c92fa8c5..b18121eb 100644 --- a/net/minecraft/client/resources/model/Material.java +++ b/net/minecraft/client/resources/model/Material.java @@ -51,8 +51,8 @@ public class Material { return this.sprite().wrap(buffer.getBuffer(this.renderType(renderTypeGetter))); } - public VertexConsumer buffer(MultiBufferSource buffer, Function renderTypeGetter, boolean withGlint) { - return this.sprite().wrap(ItemRenderer.getFoilBufferDirect(buffer, this.renderType(renderTypeGetter), true, withGlint)); + public VertexConsumer buffer(MultiBufferSource multiBufferSource, Function function, boolean bl, boolean bl2) { + return this.sprite().wrap(ItemRenderer.getFoilBuffer(multiBufferSource, this.renderType(function), bl, bl2)); } public boolean equals(Object object) { diff --git a/net/minecraft/client/resources/model/MissingBlockModel.java b/net/minecraft/client/resources/model/MissingBlockModel.java new file mode 100644 index 00000000..08d2cc68 --- /dev/null +++ b/net/minecraft/client/resources/model/MissingBlockModel.java @@ -0,0 +1,40 @@ +package net.minecraft.client.resources.model; + +import com.mojang.datafixers.util.Either; +import java.util.EnumMap; +import java.util.List; +import java.util.Map; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.client.renderer.block.model.BlockElement; +import net.minecraft.client.renderer.block.model.BlockElementFace; +import net.minecraft.client.renderer.block.model.BlockFaceUV; +import net.minecraft.client.renderer.block.model.BlockModel; +import net.minecraft.client.renderer.block.model.ItemTransforms; +import net.minecraft.client.renderer.texture.MissingTextureAtlasSprite; +import net.minecraft.core.Direction; +import net.minecraft.resources.ResourceLocation; +import org.joml.Vector3f; + +@Environment(EnvType.CLIENT) +public class MissingBlockModel { + public static final String NAME = "missing"; + public static final ResourceLocation LOCATION = SpecialModels.builtinModelId("missing"); + public static final ModelResourceLocation VARIANT = new ModelResourceLocation(LOCATION, "missing"); + + public static UnbakedModel missingModel() { + BlockFaceUV blockFaceUV = new BlockFaceUV(new float[]{0.0F, 0.0F, 16.0F, 16.0F}, 0); + Map map = new EnumMap(Direction.class); + + for (Direction direction : Direction.values()) { + map.put(direction, new BlockElementFace(direction, 0, MissingTextureAtlasSprite.getLocation().getPath(), blockFaceUV)); + } + + BlockElement blockElement = new BlockElement(new Vector3f(0.0F, 0.0F, 0.0F), new Vector3f(16.0F, 16.0F, 16.0F), map); + BlockModel blockModel = new BlockModel( + null, List.of(blockElement), Map.of("particle", Either.left(BlockModel.MISSING_MATERIAL)), null, null, ItemTransforms.NO_TRANSFORMS, List.of() + ); + blockModel.name = "missingno"; + return blockModel; + } +} diff --git a/net/minecraft/client/resources/model/ModelBaker.java b/net/minecraft/client/resources/model/ModelBaker.java index 0345f559..f9bfb7e7 100644 --- a/net/minecraft/client/resources/model/ModelBaker.java +++ b/net/minecraft/client/resources/model/ModelBaker.java @@ -3,12 +3,8 @@ package net.minecraft.client.resources.model; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.resources.ResourceLocation; -import org.jetbrains.annotations.Nullable; @Environment(EnvType.CLIENT) public interface ModelBaker { - UnbakedModel getModel(ResourceLocation location); - - @Nullable BakedModel bake(ResourceLocation location, ModelState transform); } diff --git a/net/minecraft/client/resources/model/ModelBakery.java b/net/minecraft/client/resources/model/ModelBakery.java index 0e54e1ba..04698f8a 100644 --- a/net/minecraft/client/resources/model/ModelBakery.java +++ b/net/minecraft/client/resources/model/ModelBakery.java @@ -1,40 +1,23 @@ package net.minecraft.client.resources.model; -import com.google.common.annotations.VisibleForTesting; import com.mojang.logging.LogUtils; import com.mojang.math.Transformation; -import it.unimi.dsi.fastutil.objects.Object2IntMap; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.Reader; -import java.io.StringReader; import java.util.HashMap; -import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Set; import java.util.function.Function; import java.util.function.UnaryOperator; import java.util.stream.Collectors; import java.util.stream.IntStream; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; -import net.minecraft.Util; -import net.minecraft.client.color.block.BlockColors; import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.Sheets; import net.minecraft.client.renderer.block.model.BlockModel; import net.minecraft.client.renderer.block.model.ItemModelGenerator; -import net.minecraft.client.renderer.entity.ItemRenderer; -import net.minecraft.client.renderer.texture.MissingTextureAtlasSprite; import net.minecraft.client.renderer.texture.TextureAtlas; import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.core.registries.BuiltInRegistries; -import net.minecraft.resources.FileToIdConverter; import net.minecraft.resources.ResourceLocation; -import net.minecraft.util.profiling.ProfilerFiller; -import net.minecraft.world.level.block.state.BlockState; -import org.jetbrains.annotations.Nullable; import org.slf4j.Logger; @Environment(EnvType.CLIENT) @@ -55,75 +38,22 @@ public class ModelBakery { .map(resourceLocation -> resourceLocation.withPath((UnaryOperator)(string -> "textures/" + string + ".png"))) .collect(Collectors.toList()); public static final List DESTROY_TYPES = (List)BREAKING_LOCATIONS.stream().map(RenderType::crumbling).collect(Collectors.toList()); - private static final Logger LOGGER = LogUtils.getLogger(); - private static final String BUILTIN_SLASH = "builtin/"; - private static final String BUILTIN_SLASH_GENERATED = "builtin/generated"; - private static final String BUILTIN_BLOCK_ENTITY = "builtin/entity"; - private static final String MISSING_MODEL_NAME = "missing"; - public static final ResourceLocation MISSING_MODEL_LOCATION = ResourceLocation.withDefaultNamespace("builtin/missing"); - public static final ModelResourceLocation MISSING_MODEL_VARIANT = new ModelResourceLocation(MISSING_MODEL_LOCATION, "missing"); - public static final FileToIdConverter MODEL_LISTER = FileToIdConverter.json("models"); - @VisibleForTesting - public static final String MISSING_MODEL_MESH = ("{ 'textures': { 'particle': '" - + MissingTextureAtlasSprite.getLocation().getPath() - + "', 'missingno': '" - + MissingTextureAtlasSprite.getLocation().getPath() - + "' }, 'elements': [ { 'from': [ 0, 0, 0 ], 'to': [ 16, 16, 16 ], 'faces': { 'down': { 'uv': [ 0, 0, 16, 16 ], 'cullface': 'down', 'texture': '#missingno' }, 'up': { 'uv': [ 0, 0, 16, 16 ], 'cullface': 'up', 'texture': '#missingno' }, 'north': { 'uv': [ 0, 0, 16, 16 ], 'cullface': 'north', 'texture': '#missingno' }, 'south': { 'uv': [ 0, 0, 16, 16 ], 'cullface': 'south', 'texture': '#missingno' }, 'west': { 'uv': [ 0, 0, 16, 16 ], 'cullface': 'west', 'texture': '#missingno' }, 'east': { 'uv': [ 0, 0, 16, 16 ], 'cullface': 'east', 'texture': '#missingno' } } } ]}") - .replace('\'', '"'); - private static final Map BUILTIN_MODELS = Map.of("missing", MISSING_MODEL_MESH); - public static final BlockModel GENERATION_MARKER = Util.make( - BlockModel.fromString("{\"gui_light\": \"front\"}"), blockModel -> blockModel.name = "generation marker" - ); - public static final BlockModel BLOCK_ENTITY_MARKER = Util.make( - BlockModel.fromString("{\"gui_light\": \"side\"}"), blockModel -> blockModel.name = "block entity marker" - ); + static final Logger LOGGER = LogUtils.getLogger(); static final ItemModelGenerator ITEM_MODEL_GENERATOR = new ItemModelGenerator(); - private final Map modelResources; - private final Set loadingStack = new HashSet(); - private final Map unbakedCache = new HashMap(); final Map bakedCache = new HashMap(); - private final Map topLevelModels = new HashMap(); private final Map bakedTopLevelModels = new HashMap(); - private final UnbakedModel missingModel; - private final Object2IntMap modelGroups; + private final Map topModels; + final Map unbakedModels; + final UnbakedModel missingModel; - public ModelBakery( - BlockColors blockColors, - ProfilerFiller profilerFiller, - Map modelResources, - Map> blockStateResources - ) { - this.modelResources = modelResources; - profilerFiller.push("missing_model"); - - try { - this.missingModel = this.loadBlockModel(MISSING_MODEL_LOCATION); - this.registerModel(MISSING_MODEL_VARIANT, this.missingModel); - } catch (IOException var8) { - LOGGER.error("Error loading missing model, should never happen :(", (Throwable)var8); - throw new RuntimeException(var8); - } - - BlockStateModelLoader blockStateModelLoader = new BlockStateModelLoader( - blockStateResources, profilerFiller, this.missingModel, blockColors, this::registerModelAndLoadDependencies - ); - blockStateModelLoader.loadAllBlockStates(); - this.modelGroups = blockStateModelLoader.getModelGroups(); - profilerFiller.popPush("items"); - - for (ResourceLocation resourceLocation : BuiltInRegistries.ITEM.keySet()) { - this.loadItemModelAndDependencies(resourceLocation); - } - - profilerFiller.popPush("special"); - this.loadSpecialItemModelAndDependencies(ItemRenderer.TRIDENT_IN_HAND_MODEL); - this.loadSpecialItemModelAndDependencies(ItemRenderer.SPYGLASS_IN_HAND_MODEL); - this.topLevelModels.values().forEach(unbakedModel -> unbakedModel.resolveParents(this::getModel)); - profilerFiller.pop(); + public ModelBakery(Map map, Map map2, UnbakedModel unbakedModel) { + this.topModels = map; + this.unbakedModels = map2; + this.missingModel = unbakedModel; } public void bakeModels(ModelBakery.TextureGetter textureGetter) { - this.topLevelModels.forEach((modelResourceLocation, unbakedModel) -> { + this.topModels.forEach((modelResourceLocation, unbakedModel) -> { BakedModel bakedModel = null; try { @@ -138,97 +68,10 @@ public class ModelBakery { }); } - UnbakedModel getModel(ResourceLocation modelLocation) { - if (this.unbakedCache.containsKey(modelLocation)) { - return (UnbakedModel)this.unbakedCache.get(modelLocation); - } else if (this.loadingStack.contains(modelLocation)) { - throw new IllegalStateException("Circular reference while loading " + modelLocation); - } else { - this.loadingStack.add(modelLocation); - - while (!this.loadingStack.isEmpty()) { - ResourceLocation resourceLocation = (ResourceLocation)this.loadingStack.iterator().next(); - - try { - if (!this.unbakedCache.containsKey(resourceLocation)) { - UnbakedModel unbakedModel = this.loadBlockModel(resourceLocation); - this.unbakedCache.put(resourceLocation, unbakedModel); - this.loadingStack.addAll(unbakedModel.getDependencies()); - } - } catch (Exception var7) { - LOGGER.warn("Unable to load model: '{}' referenced from: {}: {}", resourceLocation, modelLocation, var7); - this.unbakedCache.put(resourceLocation, this.missingModel); - } finally { - this.loadingStack.remove(resourceLocation); - } - } - - return (UnbakedModel)this.unbakedCache.getOrDefault(modelLocation, this.missingModel); - } - } - - private void loadItemModelAndDependencies(ResourceLocation modelLocation) { - ModelResourceLocation modelResourceLocation = ModelResourceLocation.inventory(modelLocation); - ResourceLocation resourceLocation = modelLocation.withPrefix("item/"); - UnbakedModel unbakedModel = this.getModel(resourceLocation); - this.registerModelAndLoadDependencies(modelResourceLocation, unbakedModel); - } - - private void loadSpecialItemModelAndDependencies(ModelResourceLocation modelLocation) { - ResourceLocation resourceLocation = modelLocation.id().withPrefix("item/"); - UnbakedModel unbakedModel = this.getModel(resourceLocation); - this.registerModelAndLoadDependencies(modelLocation, unbakedModel); - } - - private void registerModelAndLoadDependencies(ModelResourceLocation modelLocation, UnbakedModel model) { - for (ResourceLocation resourceLocation : model.getDependencies()) { - this.getModel(resourceLocation); - } - - this.registerModel(modelLocation, model); - } - - private void registerModel(ModelResourceLocation modelLocation, UnbakedModel model) { - this.topLevelModels.put(modelLocation, model); - } - - private BlockModel loadBlockModel(ResourceLocation location) throws IOException { - String string = location.getPath(); - if ("builtin/generated".equals(string)) { - return GENERATION_MARKER; - } else if ("builtin/entity".equals(string)) { - return BLOCK_ENTITY_MARKER; - } else if (string.startsWith("builtin/")) { - String string2 = string.substring("builtin/".length()); - String string3 = (String)BUILTIN_MODELS.get(string2); - if (string3 == null) { - throw new FileNotFoundException(location.toString()); - } else { - Reader reader = new StringReader(string3); - BlockModel blockModel = BlockModel.fromStream(reader); - blockModel.name = location.toString(); - return blockModel; - } - } else { - ResourceLocation resourceLocation = MODEL_LISTER.idToFile(location); - BlockModel blockModel2 = (BlockModel)this.modelResources.get(resourceLocation); - if (blockModel2 == null) { - throw new FileNotFoundException(resourceLocation.toString()); - } else { - blockModel2.name = location.toString(); - return blockModel2; - } - } - } - public Map getBakedTopLevelModels() { return this.bakedTopLevelModels; } - public Object2IntMap getModelGroups() { - return this.modelGroups; - } - @Environment(EnvType.CLIENT) record BakedCacheKey(ResourceLocation id, Transformation transformation, boolean isUvLocked) { } @@ -241,9 +84,14 @@ public class ModelBakery { this.modelTextureGetter = material -> textureGetter.get(modelLocation, material); } - @Override - public UnbakedModel getModel(ResourceLocation location) { - return ModelBakery.this.getModel(location); + private UnbakedModel getModel(ResourceLocation location) { + UnbakedModel unbakedModel = (UnbakedModel)ModelBakery.this.unbakedModels.get(location); + if (unbakedModel == null) { + ModelBakery.LOGGER.warn("Requested a model that was not discovered previously: {}", location); + return ModelBakery.this.missingModel; + } else { + return unbakedModel; + } } @Override @@ -260,10 +108,9 @@ public class ModelBakery { } } - @Nullable BakedModel bakeUncached(UnbakedModel model, ModelState state) { - return model instanceof BlockModel blockModel && blockModel.getRootModel() == ModelBakery.GENERATION_MARKER - ? ModelBakery.ITEM_MODEL_GENERATOR.generateBlockModel(this.modelTextureGetter, blockModel).bake(this, blockModel, this.modelTextureGetter, state, false) + return model instanceof BlockModel blockModel && blockModel.getRootModel() == SpecialModels.GENERATED_MARKER + ? ModelBakery.ITEM_MODEL_GENERATOR.generateBlockModel(this.modelTextureGetter, blockModel).bake(this.modelTextureGetter, state, false) : model.bake(this, this.modelTextureGetter, state); } } diff --git a/net/minecraft/client/resources/model/ModelDiscovery.java b/net/minecraft/client/resources/model/ModelDiscovery.java new file mode 100644 index 00000000..21a56118 --- /dev/null +++ b/net/minecraft/client/resources/model/ModelDiscovery.java @@ -0,0 +1,138 @@ +package net.minecraft.client.resources.model; + +import com.mojang.logging.LogUtils; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.function.UnaryOperator; +import java.util.stream.Collectors; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.client.renderer.entity.ItemRenderer; +import net.minecraft.core.component.DataComponents; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.BundleItem; +import net.minecraft.world.item.Item; +import org.slf4j.Logger; + +@Environment(EnvType.CLIENT) +public class ModelDiscovery { + static final Logger LOGGER = LogUtils.getLogger(); + public static final String INVENTORY_MODEL_PREFIX = "item/"; + private final Map inputModels; + final UnbakedModel missingModel; + private final Map topModels = new HashMap(); + private final Map referencedModels = new HashMap(); + + public ModelDiscovery(Map map, UnbakedModel unbakedModel) { + this.inputModels = map; + this.missingModel = unbakedModel; + this.registerTopModel(MissingBlockModel.VARIANT, unbakedModel); + this.referencedModels.put(MissingBlockModel.LOCATION, unbakedModel); + } + + private static Set listMandatoryModels() { + Set set = new HashSet(); + BuiltInRegistries.ITEM.listElements().forEach(reference -> { + ResourceLocation resourceLocation = ((Item)reference.value()).components().get(DataComponents.ITEM_MODEL); + if (resourceLocation != null) { + set.add(ModelResourceLocation.inventory(resourceLocation)); + } + + if (reference.value() instanceof BundleItem bundleItem) { + set.add(ModelResourceLocation.inventory(bundleItem.openFrontModel())); + set.add(ModelResourceLocation.inventory(bundleItem.openBackModel())); + } + }); + set.add(ItemRenderer.TRIDENT_MODEL); + set.add(ItemRenderer.SPYGLASS_MODEL); + return set; + } + + private void registerTopModel(ModelResourceLocation modelResourceLocation, UnbakedModel unbakedModel) { + this.topModels.put(modelResourceLocation, unbakedModel); + } + + public void registerStandardModels(BlockStateModelLoader.LoadedModels loadedModels) { + this.referencedModels.put(SpecialModels.BUILTIN_GENERATED, SpecialModels.GENERATED_MARKER); + this.referencedModels.put(SpecialModels.BUILTIN_BLOCK_ENTITY, SpecialModels.BLOCK_ENTITY_MARKER); + Set set = listMandatoryModels(); + loadedModels.models().forEach((modelResourceLocation, loadedModel) -> { + this.registerTopModel(modelResourceLocation, loadedModel.model()); + set.remove(modelResourceLocation); + }); + this.inputModels + .keySet() + .forEach( + resourceLocation -> { + if (resourceLocation.getPath().startsWith("item/")) { + ModelResourceLocation modelResourceLocation = ModelResourceLocation.inventory( + resourceLocation.withPath((UnaryOperator)(string -> string.substring("item/".length()))) + ); + this.registerTopModel(modelResourceLocation, new ItemModel(resourceLocation)); + set.remove(modelResourceLocation); + } + } + ); + if (!set.isEmpty()) { + LOGGER.warn("Missing mandatory models: {}", set.stream().map(modelResourceLocation -> "\n\t" + modelResourceLocation).collect(Collectors.joining())); + } + } + + public void discoverDependencies() { + this.topModels.values().forEach(unbakedModel -> unbakedModel.resolveDependencies(new ModelDiscovery.ResolverImpl())); + } + + public Map getTopModels() { + return this.topModels; + } + + public Map getReferencedModels() { + return this.referencedModels; + } + + UnbakedModel getBlockModel(ResourceLocation resourceLocation) { + return (UnbakedModel)this.referencedModels.computeIfAbsent(resourceLocation, this::loadBlockModel); + } + + private UnbakedModel loadBlockModel(ResourceLocation resourceLocation) { + UnbakedModel unbakedModel = (UnbakedModel)this.inputModels.get(resourceLocation); + if (unbakedModel == null) { + LOGGER.warn("Missing block model: '{}'", resourceLocation); + return this.missingModel; + } else { + return unbakedModel; + } + } + + @Environment(EnvType.CLIENT) + class ResolverImpl implements UnbakedModel.Resolver { + private final List stack = new ArrayList(); + private final Set resolvedModels = new HashSet(); + + @Override + public UnbakedModel resolve(ResourceLocation resourceLocation) { + if (this.stack.contains(resourceLocation)) { + ModelDiscovery.LOGGER.warn("Detected model loading loop: {}->{}", this.stacktraceToString(), resourceLocation); + return ModelDiscovery.this.missingModel; + } else { + UnbakedModel unbakedModel = ModelDiscovery.this.getBlockModel(resourceLocation); + if (this.resolvedModels.add(resourceLocation)) { + this.stack.add(resourceLocation); + unbakedModel.resolveDependencies(this); + this.stack.remove(resourceLocation); + } + + return unbakedModel; + } + } + + private String stacktraceToString() { + return (String)this.stack.stream().map(ResourceLocation::toString).collect(Collectors.joining("->")); + } + } +} diff --git a/net/minecraft/client/resources/model/ModelGroupCollector.java b/net/minecraft/client/resources/model/ModelGroupCollector.java new file mode 100644 index 00000000..cf8ed09a --- /dev/null +++ b/net/minecraft/client/resources/model/ModelGroupCollector.java @@ -0,0 +1,82 @@ +package net.minecraft.client.resources.model; + +import com.google.common.collect.Sets; +import it.unimi.dsi.fastutil.objects.Object2IntMap; +import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.client.color.block.BlockColors; +import net.minecraft.client.renderer.block.model.UnbakedBlockStateModel; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.RenderShape; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.properties.Property; + +@Environment(EnvType.CLIENT) +public class ModelGroupCollector { + static final int SINGLETON_MODEL_GROUP = -1; + private static final int INVISIBLE_MODEL_GROUP = 0; + + public static Object2IntMap build(BlockColors blockColors, BlockStateModelLoader.LoadedModels loadedModels) { + Map>> map = new HashMap(); + Map> map2 = new HashMap(); + loadedModels.models() + .forEach( + (modelResourceLocation, loadedModel) -> { + List> list = (List>)map.computeIfAbsent( + loadedModel.state().getBlock(), block -> List.copyOf(blockColors.getColoringProperties(block)) + ); + ModelGroupCollector.GroupKey groupKey = ModelGroupCollector.GroupKey.create(loadedModel.state(), loadedModel.model(), list); + ((Set)map2.computeIfAbsent(groupKey, groupKeyx -> Sets.newIdentityHashSet())).add(loadedModel.state()); + } + ); + int i = 1; + Object2IntMap object2IntMap = new Object2IntOpenHashMap<>(); + object2IntMap.defaultReturnValue(-1); + + for (Set set : map2.values()) { + Iterator iterator = set.iterator(); + + while (iterator.hasNext()) { + BlockState blockState = (BlockState)iterator.next(); + if (blockState.getRenderShape() != RenderShape.MODEL) { + iterator.remove(); + object2IntMap.put(blockState, 0); + } + } + + if (set.size() > 1) { + int j = i++; + set.forEach(blockState -> object2IntMap.put(blockState, j)); + } + } + + return object2IntMap; + } + + @Environment(EnvType.CLIENT) + record GroupKey(Object equalityGroup, List coloringValues) { + public static ModelGroupCollector.GroupKey create(BlockState blockState, UnbakedModel unbakedModel, List> list) { + List list2 = getColoringValues(blockState, list); + Object object = unbakedModel instanceof UnbakedBlockStateModel unbakedBlockStateModel + ? unbakedBlockStateModel.visualEqualityGroup(blockState) + : unbakedModel; + return new ModelGroupCollector.GroupKey(object, list2); + } + + private static List getColoringValues(BlockState blockState, List> list) { + Object[] objects = new Object[list.size()]; + + for (int i = 0; i < list.size(); i++) { + objects[i] = blockState.getValue((Property)list.get(i)); + } + + return List.of(objects); + } + } +} diff --git a/net/minecraft/client/resources/model/ModelManager.java b/net/minecraft/client/resources/model/ModelManager.java index ffec834d..8b1800f3 100644 --- a/net/minecraft/client/resources/model/ModelManager.java +++ b/net/minecraft/client/resources/model/ModelManager.java @@ -8,6 +8,7 @@ import com.mojang.logging.LogUtils; import it.unimi.dsi.fastutil.objects.Object2IntMap; import java.io.Reader; import java.util.ArrayList; +import java.util.HashMap; import java.util.IdentityHashMap; import java.util.List; import java.util.Map; @@ -15,6 +16,7 @@ import java.util.Objects; import java.util.Map.Entry; import java.util.concurrent.CompletableFuture; import java.util.concurrent.Executor; +import java.util.function.Function; import java.util.stream.Collectors; import java.util.stream.Stream; import net.fabricmc.api.EnvType; @@ -24,24 +26,31 @@ import net.minecraft.client.color.block.BlockColors; import net.minecraft.client.renderer.Sheets; import net.minecraft.client.renderer.block.BlockModelShaper; import net.minecraft.client.renderer.block.model.BlockModel; +import net.minecraft.client.renderer.block.model.BlockModelDefinition; import net.minecraft.client.renderer.texture.TextureAtlas; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.texture.TextureManager; +import net.minecraft.client.resources.model.AtlasSet.StitchResult; import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.resources.FileToIdConverter; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.packs.resources.PreparableReloadListener; import net.minecraft.server.packs.resources.Resource; import net.minecraft.server.packs.resources.ResourceManager; import net.minecraft.util.GsonHelper; +import net.minecraft.util.profiling.Profiler; import net.minecraft.util.profiling.ProfilerFiller; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.material.FluidState; import org.slf4j.Logger; @Environment(EnvType.CLIENT) public class ModelManager implements PreparableReloadListener, AutoCloseable { private static final Logger LOGGER = LogUtils.getLogger(); + private static final FileToIdConverter BLOCKSTATE_LISTER = FileToIdConverter.json("blockstates"); + private static final FileToIdConverter MODEL_LISTER = FileToIdConverter.json("models"); private static final Map VANILLA_ATLASES = Map.of( Sheets.BANNER_SHEET, ResourceLocation.withDefaultNamespace("banner_patterns"), @@ -91,69 +100,77 @@ public class ModelManager implements PreparableReloadListener, AutoCloseable { @Override public final CompletableFuture reload( - PreparableReloadListener.PreparationBarrier preparationBarrier, - ResourceManager resourceManager, - ProfilerFiller preparationsProfiler, - ProfilerFiller reloadProfiler, - Executor backgroundExecutor, - Executor gameExecutor + PreparableReloadListener.PreparationBarrier preparationBarrier, ResourceManager resourceManager, Executor executor, Executor executor2 ) { - preparationsProfiler.startTick(); - CompletableFuture> completableFuture = loadBlockModels(resourceManager, backgroundExecutor); - CompletableFuture>> completableFuture2 = loadBlockStates(resourceManager, backgroundExecutor); - CompletableFuture completableFuture3 = completableFuture.thenCombineAsync( - completableFuture2, (mapx, map2) -> new ModelBakery(this.blockColors, preparationsProfiler, mapx, map2), backgroundExecutor + UnbakedModel unbakedModel = MissingBlockModel.missingModel(); + BlockStateModelLoader blockStateModelLoader = new BlockStateModelLoader(unbakedModel); + CompletableFuture> completableFuture = loadBlockModels(resourceManager, executor); + CompletableFuture completableFuture2 = loadBlockStates(blockStateModelLoader, resourceManager, executor); + CompletableFuture completableFuture3 = completableFuture2.thenCombineAsync( + completableFuture, (loadedModels, mapx) -> this.discoverModelDependencies(unbakedModel, mapx, loadedModels), executor ); - Map> map = this.atlases.scheduleLoad(resourceManager, this.maxMipmapLevels, backgroundExecutor); - return CompletableFuture.allOf((CompletableFuture[])Stream.concat(map.values().stream(), Stream.of(completableFuture3)).toArray(CompletableFuture[]::new)) + CompletableFuture> completableFuture4 = completableFuture2.thenApplyAsync( + loadedModels -> buildModelGroups(this.blockColors, loadedModels), executor + ); + Map> map = this.atlases.scheduleLoad(resourceManager, this.maxMipmapLevels, executor); + return CompletableFuture.allOf( + (CompletableFuture[])Stream.concat(map.values().stream(), Stream.of(completableFuture3, completableFuture4)).toArray(CompletableFuture[]::new) + ) .thenApplyAsync( - void_ -> this.loadModels( - preparationsProfiler, - (Map)map.entrySet() + void_ -> { + Map map2 = (Map)map.entrySet() .stream() - .collect(Collectors.toMap(Entry::getKey, entry -> (AtlasSet.StitchResult)((CompletableFuture)entry.getValue()).join())), - (ModelBakery)completableFuture3.join() - ), - backgroundExecutor + .collect(Collectors.toMap(Entry::getKey, entry -> (StitchResult)((CompletableFuture)entry.getValue()).join())); + ModelDiscovery modelDiscovery = (ModelDiscovery)completableFuture3.join(); + Object2IntMap object2IntMap = (Object2IntMap)completableFuture4.join(); + return this.loadModels( + Profiler.get(), map2, new ModelBakery(modelDiscovery.getTopModels(), modelDiscovery.getReferencedModels(), unbakedModel), object2IntMap + ); + }, + executor ) .thenCompose(reloadState -> reloadState.readyForUpload.thenApply(void_ -> reloadState)) .thenCompose(preparationBarrier::wait) - .thenAcceptAsync(reloadState -> this.apply(reloadState, reloadProfiler), gameExecutor); + .thenAcceptAsync(reloadState -> this.apply(reloadState, Profiler.get()), executor2); } - private static CompletableFuture> loadBlockModels(ResourceManager resourceManager, Executor executor) { - return CompletableFuture.supplyAsync(() -> ModelBakery.MODEL_LISTER.listMatchingResources(resourceManager), executor) + private static CompletableFuture> loadBlockModels(ResourceManager resourceManager, Executor executor) { + return CompletableFuture.supplyAsync(() -> MODEL_LISTER.listMatchingResources(resourceManager), executor) .thenCompose( map -> { List>> list = new ArrayList(map.size()); for (Entry entry : map.entrySet()) { list.add(CompletableFuture.supplyAsync(() -> { + ResourceLocation resourceLocation = MODEL_LISTER.fileToId((ResourceLocation)entry.getKey()); + try { Reader reader = ((Resource)entry.getValue()).openAsReader(); - Pair var2x; + Pair var4x; try { - var2x = Pair.of((ResourceLocation)entry.getKey(), BlockModel.fromStream(reader)); - } catch (Throwable var5) { + BlockModel blockModel = BlockModel.fromStream(reader); + blockModel.name = resourceLocation.toString(); + var4x = Pair.of(resourceLocation, blockModel); + } catch (Throwable var6) { if (reader != null) { try { reader.close(); - } catch (Throwable var4x) { - var5.addSuppressed(var4x); + } catch (Throwable var5) { + var6.addSuppressed(var5); } } - throw var5; + throw var6; } if (reader != null) { reader.close(); } - return var2x; - } catch (Exception var6) { - LOGGER.error("Failed to load model {}", entry.getKey(), var6); + return var4x; + } catch (Exception var7) { + LOGGER.error("Failed to load model {}", entry.getKey(), var7); return null; } }, executor)); @@ -165,64 +182,92 @@ public class ModelManager implements PreparableReloadListener, AutoCloseable { ); } - private static CompletableFuture>> loadBlockStates( - ResourceManager resourceManager, Executor executor + private ModelDiscovery discoverModelDependencies( + UnbakedModel unbakedModel, Map map, BlockStateModelLoader.LoadedModels loadedModels ) { - return CompletableFuture.supplyAsync(() -> BlockStateModelLoader.BLOCKSTATE_LISTER.listMatchingResourceStacks(resourceManager), executor) - .thenCompose( - map -> { - List>>> list = new ArrayList(map.size()); + ModelDiscovery modelDiscovery = new ModelDiscovery(map, unbakedModel); + modelDiscovery.registerStandardModels(loadedModels); + modelDiscovery.discoverDependencies(); + return modelDiscovery; + } - for (Entry> entry : map.entrySet()) { - list.add(CompletableFuture.supplyAsync(() -> { - List listx = (List)entry.getValue(); - List list2 = new ArrayList(listx.size()); + private static CompletableFuture loadBlockStates( + BlockStateModelLoader blockStateModelLoader, ResourceManager resourceManager, Executor executor + ) { + Function> function = BlockStateModelLoader.definitionLocationToBlockMapper(); + return CompletableFuture.supplyAsync(() -> BLOCKSTATE_LISTER.listMatchingResourceStacks(resourceManager), executor).thenCompose(map -> { + List> list = new ArrayList(map.size()); + + for (Entry> entry : map.entrySet()) { + list.add(CompletableFuture.supplyAsync(() -> { + ResourceLocation resourceLocation = BLOCKSTATE_LISTER.fileToId((ResourceLocation)entry.getKey()); + StateDefinition stateDefinition = (StateDefinition)function.apply(resourceLocation); + if (stateDefinition == null) { + LOGGER.debug("Discovered unknown block state definition {}, ignoring", resourceLocation); + return null; + } else { + List listx = (List)entry.getValue(); + List list2 = new ArrayList(listx.size()); + + for (Resource resource : listx) { + try { + Reader reader = resource.openAsReader(); - for (Resource resource : listx) { try { - Reader reader = resource.openAsReader(); - - try { - JsonObject jsonObject = GsonHelper.parse(reader); - list2.add(new BlockStateModelLoader.LoadedJson(resource.sourcePackId(), jsonObject)); - } catch (Throwable var9) { - if (reader != null) { - try { - reader.close(); - } catch (Throwable var8) { - var9.addSuppressed(var8); - } - } - - throw var9; - } - + JsonObject jsonObject = GsonHelper.parse(reader); + BlockModelDefinition blockModelDefinition = BlockModelDefinition.fromJsonElement(jsonObject); + list2.add(new BlockStateModelLoader.LoadedBlockModelDefinition(resource.sourcePackId(), blockModelDefinition)); + } catch (Throwable var14) { if (reader != null) { - reader.close(); + try { + reader.close(); + } catch (Throwable var13) { + var14.addSuppressed(var13); + } } - } catch (Exception var10) { - LOGGER.error("Failed to load blockstate {} from pack {}", entry.getKey(), resource.sourcePackId(), var10); + + throw var14; } + + if (reader != null) { + reader.close(); + } + } catch (Exception var15) { + LOGGER.error("Failed to load blockstate definition {} from pack {}", resourceLocation, resource.sourcePackId(), var15); } + } - return Pair.of((ResourceLocation)entry.getKey(), list2); - }, executor)); + try { + return blockStateModelLoader.loadBlockStateDefinitionStack(resourceLocation, stateDefinition, list2); + } catch (Exception var12) { + LOGGER.error("Failed to load blockstate definition {}", resourceLocation, var12); + return null; + } } + }, executor)); + } - return Util.sequence(list) - .thenApply(listx -> (Map)listx.stream().filter(Objects::nonNull).collect(Collectors.toUnmodifiableMap(Pair::getFirst, Pair::getSecond))); + return Util.sequence(list).thenApply(listx -> { + Map mapx = new HashMap(); + + for (BlockStateModelLoader.LoadedModels loadedModels : listx) { + if (loadedModels != null) { + mapx.putAll(loadedModels.models()); + } } - ); + + return new BlockStateModelLoader.LoadedModels(mapx); + }); + }); } private ModelManager.ReloadState loadModels( - ProfilerFiller profilerFiller, Map atlasPreparations, ModelBakery modelBakery + ProfilerFiller profilerFiller, Map map, ModelBakery modelBakery, Object2IntMap object2IntMap ) { - profilerFiller.push("load"); - profilerFiller.popPush("baking"); + profilerFiller.push("baking"); Multimap multimap = HashMultimap.create(); modelBakery.bakeModels((modelResourceLocation, material) -> { - AtlasSet.StitchResult stitchResult = (AtlasSet.StitchResult)atlasPreparations.get(material.atlasLocation()); + StitchResult stitchResult = (StitchResult)map.get(material.atlasLocation()); TextureAtlasSprite textureAtlasSprite = stitchResult.getSprite(material.texture()); if (textureAtlasSprite != null) { return textureAtlasSprite; @@ -243,38 +288,39 @@ public class ModelManager implements PreparableReloadListener, AutoCloseable { ) ); profilerFiller.popPush("dispatch"); - Map map = modelBakery.getBakedTopLevelModels(); - BakedModel bakedModel = (BakedModel)map.get(ModelBakery.MISSING_MODEL_VARIANT); - Map map2 = new IdentityHashMap(); + Map map2 = modelBakery.getBakedTopLevelModels(); + BakedModel bakedModel = (BakedModel)map2.get(MissingBlockModel.VARIANT); + Map map3 = new IdentityHashMap(); for (Block block : BuiltInRegistries.BLOCK) { block.getStateDefinition().getPossibleStates().forEach(blockState -> { ResourceLocation resourceLocation = blockState.getBlock().builtInRegistryHolder().key().location(); - BakedModel bakedModel2 = (BakedModel)map.getOrDefault(BlockModelShaper.stateToModelLocation(resourceLocation, blockState), bakedModel); - map2.put(blockState, bakedModel2); + BakedModel bakedModel2 = (BakedModel)map2.getOrDefault(BlockModelShaper.stateToModelLocation(resourceLocation, blockState), bakedModel); + map3.put(blockState, bakedModel2); }); } CompletableFuture completableFuture = CompletableFuture.allOf( - (CompletableFuture[])atlasPreparations.values().stream().map(AtlasSet.StitchResult::readyForUpload).toArray(CompletableFuture[]::new) + (CompletableFuture[])map.values().stream().map(StitchResult::readyForUpload).toArray(CompletableFuture[]::new) ); profilerFiller.pop(); - profilerFiller.endTick(); - return new ModelManager.ReloadState(modelBakery, bakedModel, map2, atlasPreparations, completableFuture); + return new ModelManager.ReloadState(modelBakery, object2IntMap, bakedModel, map3, map, completableFuture); + } + + private static Object2IntMap buildModelGroups(BlockColors blockColors, BlockStateModelLoader.LoadedModels loadedModels) { + return ModelGroupCollector.build(blockColors, loadedModels); } private void apply(ModelManager.ReloadState reloadState, ProfilerFiller profiler) { - profiler.startTick(); profiler.push("upload"); - reloadState.atlasPreparations.values().forEach(AtlasSet.StitchResult::upload); + reloadState.atlasPreparations.values().forEach(StitchResult::upload); ModelBakery modelBakery = reloadState.modelBakery; this.bakedRegistry = modelBakery.getBakedTopLevelModels(); - this.modelGroups = modelBakery.getModelGroups(); + this.modelGroups = reloadState.modelGroups; this.missingModel = reloadState.missingModel; profiler.popPush("cache"); this.blockModelShaper.replaceCache(reloadState.modelCache); profiler.pop(); - profiler.endTick(); } public boolean requiresRender(BlockState oldState, BlockState newState) { @@ -310,9 +356,10 @@ public class ModelManager implements PreparableReloadListener, AutoCloseable { @Environment(EnvType.CLIENT) record ReloadState( ModelBakery modelBakery, + Object2IntMap modelGroups, BakedModel missingModel, Map modelCache, - Map atlasPreparations, + Map atlasPreparations, CompletableFuture readyForUpload ) { } diff --git a/net/minecraft/client/resources/model/ModelResourceLocation.java b/net/minecraft/client/resources/model/ModelResourceLocation.java index dee1b7b4..205611e6 100644 --- a/net/minecraft/client/resources/model/ModelResourceLocation.java +++ b/net/minecraft/client/resources/model/ModelResourceLocation.java @@ -15,10 +15,6 @@ public record ModelResourceLocation(ResourceLocation id, String variant) { this.variant = variant; } - public static ModelResourceLocation vanilla(String path, String variant) { - return new ModelResourceLocation(ResourceLocation.withDefaultNamespace(path), variant); - } - public static ModelResourceLocation inventory(ResourceLocation id) { return new ModelResourceLocation(id, "inventory"); } diff --git a/net/minecraft/client/resources/model/MultiPartBakedModel.java b/net/minecraft/client/resources/model/MultiPartBakedModel.java index 41646c36..5cfc8d62 100644 --- a/net/minecraft/client/resources/model/MultiPartBakedModel.java +++ b/net/minecraft/client/resources/model/MultiPartBakedModel.java @@ -1,7 +1,7 @@ package net.minecraft.client.resources.model; -import com.google.common.collect.Lists; import it.unimi.dsi.fastutil.objects.Reference2ObjectOpenHashMap; +import java.util.ArrayList; import java.util.BitSet; import java.util.Collections; import java.util.List; @@ -10,35 +10,27 @@ import java.util.function.Predicate; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.renderer.block.model.BakedQuad; -import net.minecraft.client.renderer.block.model.ItemOverrides; -import net.minecraft.client.renderer.block.model.ItemTransforms; -import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.core.Direction; import net.minecraft.util.RandomSource; import net.minecraft.world.level.block.state.BlockState; -import org.apache.commons.lang3.tuple.Pair; import org.jetbrains.annotations.Nullable; @Environment(EnvType.CLIENT) -public class MultiPartBakedModel implements BakedModel { - private final List, BakedModel>> selectors; - protected final boolean hasAmbientOcclusion; - protected final boolean isGui3d; - protected final boolean usesBlockLight; - protected final TextureAtlasSprite particleIcon; - protected final ItemTransforms transforms; - protected final ItemOverrides overrides; +public class MultiPartBakedModel extends DelegateBakedModel { + private final List selectors; private final Map selectorCache = new Reference2ObjectOpenHashMap<>(); - public MultiPartBakedModel(List, BakedModel>> selectors) { + private static BakedModel getFirstModel(List list) { + if (list.isEmpty()) { + throw new IllegalArgumentException("Model must have at least one selector"); + } else { + return ((MultiPartBakedModel.Selector)list.getFirst()).model(); + } + } + + public MultiPartBakedModel(List selectors) { + super(getFirstModel(selectors)); this.selectors = selectors; - BakedModel bakedModel = (BakedModel)((Pair)selectors.iterator().next()).getRight(); - this.hasAmbientOcclusion = bakedModel.useAmbientOcclusion(); - this.isGui3d = bakedModel.isGui3d(); - this.usesBlockLight = bakedModel.usesBlockLight(); - this.particleIcon = bakedModel.getParticleIcon(); - this.transforms = bakedModel.getTransforms(); - this.overrides = bakedModel.getOverrides(); } @Override @@ -51,8 +43,7 @@ public class MultiPartBakedModel implements BakedModel { bitSet = new BitSet(); for (int i = 0; i < this.selectors.size(); i++) { - Pair, BakedModel> pair = (Pair, BakedModel>)this.selectors.get(i); - if (pair.getLeft().test(state)) { + if (((MultiPartBakedModel.Selector)this.selectors.get(i)).condition.test(state)) { bitSet.set(i); } } @@ -60,12 +51,13 @@ public class MultiPartBakedModel implements BakedModel { this.selectorCache.put(state, bitSet); } - List list = Lists.newArrayList(); + List list = new ArrayList(); long l = random.nextLong(); for (int j = 0; j < bitSet.length(); j++) { if (bitSet.get(j)) { - list.addAll(((BakedModel)((Pair)this.selectors.get(j)).getRight()).getQuads(state, direction, RandomSource.create(l))); + random.setSeed(l); + list.addAll(((MultiPartBakedModel.Selector)this.selectors.get(j)).model.getQuads(state, direction, random)); } } @@ -73,51 +65,7 @@ public class MultiPartBakedModel implements BakedModel { } } - @Override - public boolean useAmbientOcclusion() { - return this.hasAmbientOcclusion; - } - - @Override - public boolean isGui3d() { - return this.isGui3d; - } - - @Override - public boolean usesBlockLight() { - return this.usesBlockLight; - } - - @Override - public boolean isCustomRenderer() { - return false; - } - - @Override - public TextureAtlasSprite getParticleIcon() { - return this.particleIcon; - } - - @Override - public ItemTransforms getTransforms() { - return this.transforms; - } - - @Override - public ItemOverrides getOverrides() { - return this.overrides; - } - @Environment(EnvType.CLIENT) - public static class Builder { - private final List, BakedModel>> selectors = Lists., BakedModel>>newArrayList(); - - public void add(Predicate predicate, BakedModel model) { - this.selectors.add(Pair.of(predicate, model)); - } - - public BakedModel build() { - return new MultiPartBakedModel(this.selectors); - } + public record Selector(Predicate condition, BakedModel model) { } } diff --git a/net/minecraft/client/resources/model/SimpleBakedModel.java b/net/minecraft/client/resources/model/SimpleBakedModel.java index 7a976d09..27043189 100644 --- a/net/minecraft/client/resources/model/SimpleBakedModel.java +++ b/net/minecraft/client/resources/model/SimpleBakedModel.java @@ -1,14 +1,14 @@ package net.minecraft.client.resources.model; -import com.google.common.collect.Lists; +import com.google.common.collect.ImmutableList; import com.google.common.collect.Maps; +import java.util.EnumMap; import java.util.List; import java.util.Map; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.client.renderer.block.model.BlockModel; -import net.minecraft.client.renderer.block.model.ItemOverrides; import net.minecraft.client.renderer.block.model.ItemTransforms; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.core.Direction; @@ -25,26 +25,23 @@ public class SimpleBakedModel implements BakedModel { protected final boolean usesBlockLight; protected final TextureAtlasSprite particleIcon; protected final ItemTransforms transforms; - protected final ItemOverrides overrides; public SimpleBakedModel( - List unculledFaces, - Map> culledFaces, - boolean hasAmbientOcclusion, - boolean usesBlockLight, - boolean isGui3d, - TextureAtlasSprite particleIcon, - ItemTransforms transforms, - ItemOverrides overrides + List list, + Map> map, + boolean bl, + boolean bl2, + boolean bl3, + TextureAtlasSprite textureAtlasSprite, + ItemTransforms itemTransforms ) { - this.unculledFaces = unculledFaces; - this.culledFaces = culledFaces; - this.hasAmbientOcclusion = hasAmbientOcclusion; - this.isGui3d = isGui3d; - this.usesBlockLight = usesBlockLight; - this.particleIcon = particleIcon; - this.transforms = transforms; - this.overrides = overrides; + this.unculledFaces = list; + this.culledFaces = map; + this.hasAmbientOcclusion = bl; + this.isGui3d = bl3; + this.usesBlockLight = bl2; + this.particleIcon = textureAtlasSprite; + this.transforms = itemTransforms; } @Override @@ -82,40 +79,34 @@ public class SimpleBakedModel implements BakedModel { return this.transforms; } - @Override - public ItemOverrides getOverrides() { - return this.overrides; - } - @Environment(EnvType.CLIENT) public static class Builder { - private final List unculledFaces = Lists.newArrayList(); - private final Map> culledFaces = Maps.newEnumMap(Direction.class); - private final ItemOverrides overrides; + private final ImmutableList.Builder unculledFaces = ImmutableList.builder(); + private final EnumMap> culledFaces = Maps.newEnumMap(Direction.class); private final boolean hasAmbientOcclusion; + @Nullable private TextureAtlasSprite particleIcon; private final boolean usesBlockLight; private final boolean isGui3d; private final ItemTransforms transforms; - public Builder(BlockModel blockModel, ItemOverrides overrides, boolean isGui3d) { - this(blockModel.hasAmbientOcclusion(), blockModel.getGuiLight().lightLikeBlock(), isGui3d, blockModel.getTransforms(), overrides); + public Builder(BlockModel blockModel, boolean bl) { + this(blockModel.hasAmbientOcclusion(), blockModel.getGuiLight().lightLikeBlock(), bl, blockModel.getTransforms()); } - private Builder(boolean hasAmbientOcclusion, boolean usesBlockLight, boolean isGui3d, ItemTransforms transforms, ItemOverrides overrides) { - for (Direction direction : Direction.values()) { - this.culledFaces.put(direction, Lists.newArrayList()); - } + private Builder(boolean bl, boolean bl2, boolean bl3, ItemTransforms itemTransforms) { + this.hasAmbientOcclusion = bl; + this.usesBlockLight = bl2; + this.isGui3d = bl3; + this.transforms = itemTransforms; - this.overrides = overrides; - this.hasAmbientOcclusion = hasAmbientOcclusion; - this.usesBlockLight = usesBlockLight; - this.isGui3d = isGui3d; - this.transforms = transforms; + for (Direction direction : Direction.values()) { + this.culledFaces.put(direction, ImmutableList.builder()); + } } public SimpleBakedModel.Builder addCulledFace(Direction facing, BakedQuad quad) { - ((List)this.culledFaces.get(facing)).add(quad); + ((ImmutableList.Builder)this.culledFaces.get(facing)).add(quad); return this; } @@ -137,8 +128,9 @@ public class SimpleBakedModel implements BakedModel { if (this.particleIcon == null) { throw new RuntimeException("Missing particle!"); } else { + Map> map = Maps.transformValues(this.culledFaces, ImmutableList.Builder::build); return new SimpleBakedModel( - this.unculledFaces, this.culledFaces, this.hasAmbientOcclusion, this.usesBlockLight, this.isGui3d, this.particleIcon, this.transforms, this.overrides + this.unculledFaces.build(), new EnumMap(map), this.hasAmbientOcclusion, this.usesBlockLight, this.isGui3d, this.particleIcon, this.transforms ); } } diff --git a/net/minecraft/client/resources/model/SpecialModels.java b/net/minecraft/client/resources/model/SpecialModels.java new file mode 100644 index 00000000..b5185e83 --- /dev/null +++ b/net/minecraft/client/resources/model/SpecialModels.java @@ -0,0 +1,27 @@ +package net.minecraft.client.resources.model; + +import java.util.List; +import java.util.Map; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.client.renderer.block.model.BlockModel; +import net.minecraft.client.renderer.block.model.ItemTransforms; +import net.minecraft.resources.ResourceLocation; + +@Environment(EnvType.CLIENT) +public class SpecialModels { + public static final ResourceLocation BUILTIN_GENERATED = builtinModelId("generated"); + public static final ResourceLocation BUILTIN_BLOCK_ENTITY = builtinModelId("entity"); + public static final UnbakedModel GENERATED_MARKER = createMarker("generation marker", BlockModel.GuiLight.FRONT); + public static final UnbakedModel BLOCK_ENTITY_MARKER = createMarker("block entity marker", BlockModel.GuiLight.SIDE); + + public static ResourceLocation builtinModelId(String string) { + return ResourceLocation.withDefaultNamespace("builtin/" + string); + } + + private static UnbakedModel createMarker(String string, BlockModel.GuiLight guiLight) { + BlockModel blockModel = new BlockModel(null, List.of(), Map.of(), null, guiLight, ItemTransforms.NO_TRANSFORMS, List.of()); + blockModel.name = string; + return blockModel; + } +} diff --git a/net/minecraft/client/resources/model/UnbakedModel.java b/net/minecraft/client/resources/model/UnbakedModel.java index 2e795876..f9e4a131 100644 --- a/net/minecraft/client/resources/model/UnbakedModel.java +++ b/net/minecraft/client/resources/model/UnbakedModel.java @@ -1,19 +1,19 @@ package net.minecraft.client.resources.model; -import java.util.Collection; import java.util.function.Function; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.resources.ResourceLocation; -import org.jetbrains.annotations.Nullable; @Environment(EnvType.CLIENT) public interface UnbakedModel { - Collection getDependencies(); + void resolveDependencies(UnbakedModel.Resolver resolver); - void resolveParents(Function resolver); - - @Nullable BakedModel bake(ModelBaker baker, Function spriteGetter, ModelState state); + + @Environment(EnvType.CLIENT) + public interface Resolver { + UnbakedModel resolve(ResourceLocation resourceLocation); + } } diff --git a/net/minecraft/client/resources/model/WeightedBakedModel.java b/net/minecraft/client/resources/model/WeightedBakedModel.java index 98e8ef9f..234e8e36 100644 --- a/net/minecraft/client/resources/model/WeightedBakedModel.java +++ b/net/minecraft/client/resources/model/WeightedBakedModel.java @@ -1,94 +1,28 @@ package net.minecraft.client.resources.model; -import com.google.common.collect.Lists; import java.util.Collections; import java.util.List; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.renderer.block.model.BakedQuad; -import net.minecraft.client.renderer.block.model.ItemOverrides; -import net.minecraft.client.renderer.block.model.ItemTransforms; -import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.core.Direction; import net.minecraft.util.RandomSource; -import net.minecraft.util.random.WeightedEntry; -import net.minecraft.util.random.WeightedRandom; +import net.minecraft.util.random.SimpleWeightedRandomList; +import net.minecraft.util.random.WeightedEntry.Wrapper; import net.minecraft.world.level.block.state.BlockState; import org.jetbrains.annotations.Nullable; @Environment(EnvType.CLIENT) -public class WeightedBakedModel implements BakedModel { - private final int totalWeight; - private final List> list; - private final BakedModel wrapped; +public class WeightedBakedModel extends DelegateBakedModel { + private final SimpleWeightedRandomList list; - public WeightedBakedModel(List> list) { - this.list = list; - this.totalWeight = WeightedRandom.getTotalWeight(list); - this.wrapped = (BakedModel)((WeightedEntry.Wrapper)list.get(0)).data(); + public WeightedBakedModel(SimpleWeightedRandomList simpleWeightedRandomList) { + super((BakedModel)((Wrapper)simpleWeightedRandomList.unwrap().getFirst()).data()); + this.list = simpleWeightedRandomList; } @Override public List getQuads(@Nullable BlockState state, @Nullable Direction direction, RandomSource random) { - return (List)WeightedRandom.getWeightedItem(this.list, Math.abs((int)random.nextLong()) % this.totalWeight) - .map(wrapper -> ((BakedModel)wrapper.data()).getQuads(state, direction, random)) - .orElse(Collections.emptyList()); - } - - @Override - public boolean useAmbientOcclusion() { - return this.wrapped.useAmbientOcclusion(); - } - - @Override - public boolean isGui3d() { - return this.wrapped.isGui3d(); - } - - @Override - public boolean usesBlockLight() { - return this.wrapped.usesBlockLight(); - } - - @Override - public boolean isCustomRenderer() { - return this.wrapped.isCustomRenderer(); - } - - @Override - public TextureAtlasSprite getParticleIcon() { - return this.wrapped.getParticleIcon(); - } - - @Override - public ItemTransforms getTransforms() { - return this.wrapped.getTransforms(); - } - - @Override - public ItemOverrides getOverrides() { - return this.wrapped.getOverrides(); - } - - @Environment(EnvType.CLIENT) - public static class Builder { - private final List> list = Lists.>newArrayList(); - - public WeightedBakedModel.Builder add(@Nullable BakedModel model, int weight) { - if (model != null) { - this.list.add(WeightedEntry.wrap(model, weight)); - } - - return this; - } - - @Nullable - public BakedModel build() { - if (this.list.isEmpty()) { - return null; - } else { - return (BakedModel)(this.list.size() == 1 ? (BakedModel)((WeightedEntry.Wrapper)this.list.get(0)).data() : new WeightedBakedModel(this.list)); - } - } + return (List)this.list.getRandomValue(random).map(bakedModel -> bakedModel.getQuads(state, direction, random)).orElse(Collections.emptyList()); } } diff --git a/net/minecraft/client/resources/server/DownloadedPackSource.java b/net/minecraft/client/resources/server/DownloadedPackSource.java index 458f2267..a704deb8 100644 --- a/net/minecraft/client/resources/server/DownloadedPackSource.java +++ b/net/minecraft/client/resources/server/DownloadedPackSource.java @@ -31,18 +31,27 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.User; import net.minecraft.client.gui.components.toasts.SystemToast; import net.minecraft.client.main.GameConfig; +import net.minecraft.client.resources.server.PackLoadFeedback.FinalResult; +import net.minecraft.client.resources.server.PackLoadFeedback.Update; +import net.minecraft.client.resources.server.PackReloadConfig.Callbacks; +import net.minecraft.client.resources.server.PackReloadConfig.IdAndPath; +import net.minecraft.client.resources.server.ServerPackManager.PackPromptStatus; import net.minecraft.network.Connection; import net.minecraft.network.chat.Component; import net.minecraft.network.protocol.common.ServerboundResourcePackPacket; +import net.minecraft.network.protocol.common.ServerboundResourcePackPacket.Action; import net.minecraft.server.packs.DownloadQueue; -import net.minecraft.server.packs.FilePackResources; import net.minecraft.server.packs.PackLocationInfo; import net.minecraft.server.packs.PackSelectionConfig; import net.minecraft.server.packs.PackType; +import net.minecraft.server.packs.FilePackResources.FileResourcesSupplier; import net.minecraft.server.packs.repository.Pack; import net.minecraft.server.packs.repository.PackSource; import net.minecraft.server.packs.repository.RepositorySource; -import net.minecraft.util.HttpUtil; +import net.minecraft.server.packs.repository.Pack.Metadata; +import net.minecraft.server.packs.repository.Pack.Position; +import net.minecraft.server.packs.repository.Pack.ResourcesSupplier; +import net.minecraft.util.HttpUtil.DownloadProgressListener; import org.jetbrains.annotations.Nullable; import org.slf4j.Logger; @@ -52,22 +61,22 @@ public class DownloadedPackSource implements AutoCloseable { private static final Pattern SHA1 = Pattern.compile("^[a-fA-F0-9]{40}$"); static final Logger LOGGER = LogUtils.getLogger(); private static final RepositorySource EMPTY_SOURCE = consumer -> {}; - private static final PackSelectionConfig DOWNLOADED_PACK_SELECTION = new PackSelectionConfig(true, Pack.Position.TOP, true); + private static final PackSelectionConfig DOWNLOADED_PACK_SELECTION = new PackSelectionConfig(true, Position.TOP, true); private static final PackLoadFeedback LOG_ONLY_FEEDBACK = new PackLoadFeedback() { @Override - public void reportUpdate(UUID id, PackLoadFeedback.Update update) { + public void reportUpdate(UUID id, Update update) { DownloadedPackSource.LOGGER.debug("Downloaded pack {} changed state to {}", id, update); } @Override - public void reportFinalResult(UUID id, PackLoadFeedback.FinalResult result) { + public void reportFinalResult(UUID id, FinalResult result) { DownloadedPackSource.LOGGER.debug("Downloaded pack {} finished with state {}", id, result); } }; final Minecraft minecraft; private RepositorySource packSource = EMPTY_SOURCE; @Nullable - private PackReloadConfig.Callbacks pendingReload; + private Callbacks pendingReload; final ServerPackManager manager; private final DownloadQueue downloadQueue; private PackSource packType = PackSource.SERVER; @@ -83,22 +92,22 @@ public class DownloadedPackSource implements AutoCloseable { throw new UncheckedIOException("Failed to open download queue in directory " + directory, var5); } - Executor executor = minecraft::tell; + Executor executor = minecraft::schedule; this.manager = new ServerPackManager(this.createDownloader(this.downloadQueue, executor, userData.user, userData.proxy), new PackLoadFeedback() { @Override - public void reportUpdate(UUID id, PackLoadFeedback.Update update) { + public void reportUpdate(UUID id, Update update) { DownloadedPackSource.this.packFeedback.reportUpdate(id, update); } @Override - public void reportFinalResult(UUID id, PackLoadFeedback.FinalResult result) { + public void reportFinalResult(UUID id, FinalResult result) { DownloadedPackSource.this.packFeedback.reportFinalResult(id, result); } - }, this.createReloadConfig(), this.createUpdateScheduler(executor), ServerPackManager.PackPromptStatus.PENDING); + }, this.createReloadConfig(), this.createUpdateScheduler(executor), PackPromptStatus.PENDING); } - HttpUtil.DownloadProgressListener createDownloadNotifier(int packCount) { - return new HttpUtil.DownloadProgressListener() { + DownloadProgressListener createDownloadNotifier(int packCount) { + return new DownloadProgressListener() { private final SystemToast.SystemToastId toastId = new SystemToast.SystemToastId(); private Component title = Component.empty(); @Nullable @@ -108,7 +117,7 @@ public class DownloadedPackSource implements AutoCloseable { private OptionalLong totalBytes = OptionalLong.empty(); private void updateToast() { - SystemToast.addOrUpdate(DownloadedPackSource.this.minecraft.getToasts(), this.toastId, this.title, this.message); + SystemToast.addOrUpdate(DownloadedPackSource.this.minecraft.getToastManager(), this.toastId, this.title, this.message); } private void updateProgress(long progress) { @@ -157,7 +166,7 @@ public class DownloadedPackSource implements AutoCloseable { this.message = null; this.updateToast(); } else { - SystemToast.forceHide(DownloadedPackSource.this.minecraft.getToasts(), this.toastId); + SystemToast.forceHide(DownloadedPackSource.this.minecraft.getToastManager(), this.toastId); } } } @@ -229,16 +238,16 @@ public class DownloadedPackSource implements AutoCloseable { } @Nullable - private List loadRequestedPacks(List packs) { + private List loadRequestedPacks(List packs) { List list = new ArrayList(packs.size()); - for (PackReloadConfig.IdAndPath idAndPath : Lists.reverse(packs)) { + for (IdAndPath idAndPath : Lists.reverse(packs)) { String string = String.format(Locale.ROOT, "server/%08X/%s", this.packIdSerialNumber++, idAndPath.id()); Path path = idAndPath.path(); PackLocationInfo packLocationInfo = new PackLocationInfo(string, SERVER_NAME, this.packType, Optional.empty()); - Pack.ResourcesSupplier resourcesSupplier = new FilePackResources.FileResourcesSupplier(path); + ResourcesSupplier resourcesSupplier = new FileResourcesSupplier(path); int i = SharedConstants.getCurrentVersion().getPackVersion(PackType.CLIENT_RESOURCES); - Pack.Metadata metadata = Pack.readPackMetadata(packLocationInfo, resourcesSupplier, i); + Metadata metadata = Pack.readPackMetadata(packLocationInfo, resourcesSupplier, i); if (metadata == null) { LOGGER.warn("Invalid pack metadata in {}, ignoring all", path); return null; @@ -258,13 +267,13 @@ public class DownloadedPackSource implements AutoCloseable { return packs.isEmpty() ? EMPTY_SOURCE : packs::forEach; } - private void startReload(PackReloadConfig.Callbacks callbacks) { + private void startReload(Callbacks callbacks) { this.pendingReload = callbacks; - List list = callbacks.packsToLoad(); + List list = callbacks.packsToLoad(); List list2 = this.loadRequestedPacks(list); if (list2 == null) { callbacks.onFailure(false); - List list3 = callbacks.packsToLoad(); + List list3 = callbacks.packsToLoad(); list2 = this.loadRequestedPacks(list3); if (list2 == null) { LOGGER.warn("Double failure in loading server packs"); @@ -329,33 +338,33 @@ public class DownloadedPackSource implements AutoCloseable { private static PackLoadFeedback createPackResponseSender(Connection connection) { return new PackLoadFeedback() { @Override - public void reportUpdate(UUID id, PackLoadFeedback.Update update) { + public void reportUpdate(UUID id, Update update) { DownloadedPackSource.LOGGER.debug("Pack {} changed status to {}", id, update); - ServerboundResourcePackPacket.Action action = switch (update) { - case ACCEPTED -> ServerboundResourcePackPacket.Action.ACCEPTED; - case DOWNLOADED -> ServerboundResourcePackPacket.Action.DOWNLOADED; + Action action = switch (update) { + case ACCEPTED -> Action.ACCEPTED; + case DOWNLOADED -> Action.DOWNLOADED; }; connection.send(new ServerboundResourcePackPacket(id, action)); } @Override - public void reportFinalResult(UUID id, PackLoadFeedback.FinalResult result) { + public void reportFinalResult(UUID id, FinalResult result) { DownloadedPackSource.LOGGER.debug("Pack {} changed status to {}", id, result); - ServerboundResourcePackPacket.Action action = switch (result) { - case APPLIED -> ServerboundResourcePackPacket.Action.SUCCESSFULLY_LOADED; - case DOWNLOAD_FAILED -> ServerboundResourcePackPacket.Action.FAILED_DOWNLOAD; - case DECLINED -> ServerboundResourcePackPacket.Action.DECLINED; - case DISCARDED -> ServerboundResourcePackPacket.Action.DISCARDED; - case ACTIVATION_FAILED -> ServerboundResourcePackPacket.Action.FAILED_RELOAD; + Action action = switch (result) { + case APPLIED -> Action.SUCCESSFULLY_LOADED; + case DOWNLOAD_FAILED -> Action.FAILED_DOWNLOAD; + case DECLINED -> Action.DECLINED; + case DISCARDED -> Action.DISCARDED; + case ACTIVATION_FAILED -> Action.FAILED_RELOAD; }; connection.send(new ServerboundResourcePackPacket(id, action)); } }; } - public void configureForServerControl(Connection connection, ServerPackManager.PackPromptStatus packPromptStatus) { + public void configureForServerControl(Connection connection, PackPromptStatus packPromptStatus) { this.packType = PackSource.SERVER; this.packFeedback = createPackResponseSender(connection); switch (packPromptStatus) { @@ -389,15 +398,15 @@ public class DownloadedPackSource implements AutoCloseable { final PackLoadFeedback packLoadFeedback = this.packFeedback; this.packFeedback = new PackLoadFeedback() { @Override - public void reportUpdate(UUID id, PackLoadFeedback.Update update) { + public void reportUpdate(UUID id, Update update) { packLoadFeedback.reportUpdate(id, update); } @Override - public void reportFinalResult(UUID id, PackLoadFeedback.FinalResult result) { + public void reportFinalResult(UUID id, FinalResult result) { if (uuid.equals(id)) { DownloadedPackSource.this.packFeedback = packLoadFeedback; - if (result == PackLoadFeedback.FinalResult.APPLIED) { + if (result == FinalResult.APPLIED) { completableFuture.complete(null); } else { completableFuture.completeExceptionally(new IllegalStateException("Failed to apply pack " + id + ", reason: " + result)); diff --git a/net/minecraft/client/resources/sounds/AbstractSoundInstance.java b/net/minecraft/client/resources/sounds/AbstractSoundInstance.java index 8a47e5e5..b020b98e 100644 --- a/net/minecraft/client/resources/sounds/AbstractSoundInstance.java +++ b/net/minecraft/client/resources/sounds/AbstractSoundInstance.java @@ -2,6 +2,7 @@ package net.minecraft.client.resources.sounds; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; +import net.minecraft.client.resources.sounds.SoundInstance.Attenuation; import net.minecraft.client.sounds.SoundManager; import net.minecraft.client.sounds.WeighedSoundEvents; import net.minecraft.resources.ResourceLocation; @@ -24,12 +25,12 @@ public abstract class AbstractSoundInstance implements SoundInstance { * The number of ticks between repeating the sound */ protected int delay; - protected SoundInstance.Attenuation attenuation = SoundInstance.Attenuation.LINEAR; + protected Attenuation attenuation = Attenuation.LINEAR; protected boolean relative; protected RandomSource random; protected AbstractSoundInstance(SoundEvent soundEvent, SoundSource source, RandomSource random) { - this(soundEvent.getLocation(), source, random); + this(soundEvent.location(), source, random); } protected AbstractSoundInstance(ResourceLocation location, SoundSource source, RandomSource random) { @@ -106,7 +107,7 @@ public abstract class AbstractSoundInstance implements SoundInstance { } @Override - public SoundInstance.Attenuation getAttenuation() { + public Attenuation getAttenuation() { return this.attenuation; } diff --git a/net/minecraft/client/resources/sounds/BiomeAmbientSoundsHandler.java b/net/minecraft/client/resources/sounds/BiomeAmbientSoundsHandler.java index bccd7290..6faf4ab0 100644 --- a/net/minecraft/client/resources/sounds/BiomeAmbientSoundsHandler.java +++ b/net/minecraft/client/resources/sounds/BiomeAmbientSoundsHandler.java @@ -82,7 +82,7 @@ public class BiomeAmbientSoundsHandler implements AmbientSoundHandler { ); int j = level.getBrightness(LightLayer.SKY, blockPos); if (j > 0) { - this.moodiness = this.moodiness - (float)j / level.getMaxLightLevel() * 0.001F; + this.moodiness -= j / 15.0F * 0.001F; } else { this.moodiness = this.moodiness - (float)(level.getBrightness(LightLayer.BLOCK, blockPos) - 1) / ambientMoodSettings.getTickDelay(); } diff --git a/net/minecraft/client/resources/sounds/MinecartSoundInstance.java b/net/minecraft/client/resources/sounds/MinecartSoundInstance.java index 9d1aa8de..c57241f4 100644 --- a/net/minecraft/client/resources/sounds/MinecartSoundInstance.java +++ b/net/minecraft/client/resources/sounds/MinecartSoundInstance.java @@ -6,6 +6,7 @@ import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; import net.minecraft.util.Mth; import net.minecraft.world.entity.vehicle.AbstractMinecart; +import net.minecraft.world.entity.vehicle.NewMinecartBehavior; @Environment(EnvType.CLIENT) public class MinecartSoundInstance extends AbstractTickableSoundInstance { @@ -47,7 +48,8 @@ public class MinecartSoundInstance extends AbstractTickableSoundInstance { this.y = (float)this.minecart.getY(); this.z = (float)this.minecart.getZ(); float f = (float)this.minecart.getDeltaMovement().horizontalDistance(); - if (f >= 0.01F && this.minecart.level().tickRateManager().runsNormally()) { + boolean bl = !this.minecart.isOnRails() && this.minecart.getBehavior() instanceof NewMinecartBehavior; + if (f >= 0.01F && this.minecart.level().tickRateManager().runsNormally() && !bl) { this.pitch = Mth.clamp(this.pitch + 0.0025F, 0.0F, 1.0F); this.volume = Mth.lerp(Mth.clamp(f, 0.0F, 0.5F), 0.0F, 0.7F); } else { diff --git a/net/minecraft/client/resources/sounds/RidingMinecartSoundInstance.java b/net/minecraft/client/resources/sounds/RidingMinecartSoundInstance.java index 88ff54ef..32671d41 100644 --- a/net/minecraft/client/resources/sounds/RidingMinecartSoundInstance.java +++ b/net/minecraft/client/resources/sounds/RidingMinecartSoundInstance.java @@ -2,11 +2,13 @@ package net.minecraft.client.resources.sounds; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; +import net.minecraft.client.resources.sounds.SoundInstance.Attenuation; import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; import net.minecraft.util.Mth; import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.vehicle.AbstractMinecart; +import net.minecraft.world.entity.vehicle.NewMinecartBehavior; @Environment(EnvType.CLIENT) public class RidingMinecartSoundInstance extends AbstractTickableSoundInstance { @@ -21,7 +23,7 @@ public class RidingMinecartSoundInstance extends AbstractTickableSoundInstance { this.player = player; this.minecart = minecart; this.underwaterSound = underwaterSound; - this.attenuation = SoundInstance.Attenuation.NONE; + this.attenuation = Attenuation.NONE; this.looping = true; this.delay = 0; this.volume = 0.0F; @@ -45,7 +47,8 @@ public class RidingMinecartSoundInstance extends AbstractTickableSoundInstance { this.volume = 0.0F; } else { float f = (float)this.minecart.getDeltaMovement().horizontalDistance(); - if (f >= 0.01F) { + boolean bl = !this.minecart.isOnRails() && this.minecart.getBehavior() instanceof NewMinecartBehavior; + if (f >= 0.01F && !bl) { this.volume = Mth.clampedLerp(0.0F, 0.75F, f); } else { this.volume = 0.0F; diff --git a/net/minecraft/client/resources/sounds/SimpleSoundInstance.java b/net/minecraft/client/resources/sounds/SimpleSoundInstance.java index 52785739..8ad57aea 100644 --- a/net/minecraft/client/resources/sounds/SimpleSoundInstance.java +++ b/net/minecraft/client/resources/sounds/SimpleSoundInstance.java @@ -2,6 +2,7 @@ package net.minecraft.client.resources.sounds; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; +import net.minecraft.client.resources.sounds.SoundInstance.Attenuation; import net.minecraft.core.BlockPos; import net.minecraft.core.Holder; import net.minecraft.resources.ResourceLocation; @@ -26,25 +27,25 @@ public class SimpleSoundInstance extends AbstractSoundInstance { public static SimpleSoundInstance forUI(SoundEvent sound, float pitch, float volume) { return new SimpleSoundInstance( - sound.getLocation(), SoundSource.MASTER, volume, pitch, SoundInstance.createUnseededRandom(), false, 0, SoundInstance.Attenuation.NONE, 0.0, 0.0, 0.0, true + sound.location(), SoundSource.MASTER, volume, pitch, SoundInstance.createUnseededRandom(), false, 0, Attenuation.NONE, 0.0, 0.0, 0.0, true ); } public static SimpleSoundInstance forMusic(SoundEvent sound) { return new SimpleSoundInstance( - sound.getLocation(), SoundSource.MUSIC, 1.0F, 1.0F, SoundInstance.createUnseededRandom(), false, 0, SoundInstance.Attenuation.NONE, 0.0, 0.0, 0.0, true + sound.location(), SoundSource.MUSIC, 1.0F, 1.0F, SoundInstance.createUnseededRandom(), false, 0, Attenuation.NONE, 0.0, 0.0, 0.0, true ); } public static SimpleSoundInstance forJukeboxSong(SoundEvent sound, Vec3 pos) { return new SimpleSoundInstance( - sound, SoundSource.RECORDS, 4.0F, 1.0F, SoundInstance.createUnseededRandom(), false, 0, SoundInstance.Attenuation.LINEAR, pos.x, pos.y, pos.z + sound, SoundSource.RECORDS, 4.0F, 1.0F, SoundInstance.createUnseededRandom(), false, 0, Attenuation.LINEAR, pos.x, pos.y, pos.z ); } public static SimpleSoundInstance forLocalAmbience(SoundEvent sound, float volume, float pitch) { return new SimpleSoundInstance( - sound.getLocation(), SoundSource.AMBIENT, pitch, volume, SoundInstance.createUnseededRandom(), false, 0, SoundInstance.Attenuation.NONE, 0.0, 0.0, 0.0, true + sound.location(), SoundSource.AMBIENT, pitch, volume, SoundInstance.createUnseededRandom(), false, 0, Attenuation.NONE, 0.0, 0.0, 0.0, true ); } @@ -53,11 +54,11 @@ public class SimpleSoundInstance extends AbstractSoundInstance { } public static SimpleSoundInstance forAmbientMood(SoundEvent soundEvent, RandomSource random, double x, double y, double z) { - return new SimpleSoundInstance(soundEvent, SoundSource.AMBIENT, 1.0F, 1.0F, random, false, 0, SoundInstance.Attenuation.LINEAR, x, y, z); + return new SimpleSoundInstance(soundEvent, SoundSource.AMBIENT, 1.0F, 1.0F, random, false, 0, Attenuation.LINEAR, x, y, z); } public SimpleSoundInstance(SoundEvent soundEvent, SoundSource source, float volume, float pitch, RandomSource random, double x, double y, double z) { - this(soundEvent, source, volume, pitch, random, false, 0, SoundInstance.Attenuation.LINEAR, x, y, z); + this(soundEvent, source, volume, pitch, random, false, 0, Attenuation.LINEAR, x, y, z); } private SimpleSoundInstance( @@ -68,12 +69,12 @@ public class SimpleSoundInstance extends AbstractSoundInstance { RandomSource random, boolean looping, int delay, - SoundInstance.Attenuation attenuation, + Attenuation attenuation, double x, double y, double z ) { - this(soundEvent.getLocation(), source, volume, pitch, random, looping, delay, attenuation, x, y, z, false); + this(soundEvent.location(), source, volume, pitch, random, looping, delay, attenuation, x, y, z, false); } public SimpleSoundInstance( @@ -84,7 +85,7 @@ public class SimpleSoundInstance extends AbstractSoundInstance { RandomSource random, boolean looping, int delay, - SoundInstance.Attenuation attenuation, + Attenuation attenuation, double x, double y, double z, diff --git a/net/minecraft/client/server/IntegratedServer.java b/net/minecraft/client/server/IntegratedServer.java index 99f13a27..72d26963 100644 --- a/net/minecraft/client/server/IntegratedServer.java +++ b/net/minecraft/client/server/IntegratedServer.java @@ -16,7 +16,6 @@ import net.minecraft.SharedConstants; import net.minecraft.SystemReport; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.components.toasts.SystemToast; -import net.minecraft.client.multiplayer.ClientPacketListener; import net.minecraft.server.MinecraftServer; import net.minecraft.server.Services; import net.minecraft.server.WorldStem; @@ -26,6 +25,7 @@ import net.minecraft.server.packs.repository.PackRepository; import net.minecraft.stats.Stats; import net.minecraft.util.ModCheck; import net.minecraft.util.debugchart.LocalSampleLogger; +import net.minecraft.util.profiling.Profiler; import net.minecraft.util.profiling.ProfilerFiller; import net.minecraft.world.level.ChunkPos; import net.minecraft.world.level.GameType; @@ -88,7 +88,7 @@ public class IntegratedServer extends MinecraftServer { public void tickServer(BooleanSupplier hasTimeLeft) { boolean bl = this.paused; this.paused = Minecraft.getInstance().isPaused(); - ProfilerFiller profilerFiller = this.getProfiler(); + ProfilerFiller profilerFiller = Profiler.get(); if (!bl && this.paused) { profilerFiller.push("autoSave"); LOGGER.info("Saving and pausing game..."); @@ -187,12 +187,7 @@ public class IntegratedServer extends MinecraftServer { public boolean publishServer(@Nullable GameType gameMode, boolean commands, int port) { try { this.minecraft.prepareForMultiplayer(); - this.minecraft.getProfileKeyPairManager().prepareKeyPair().thenAcceptAsync(optional -> optional.ifPresent(profileKeyPair -> { - ClientPacketListener clientPacketListener = this.minecraft.getConnection(); - if (clientPacketListener != null) { - clientPacketListener.setKeyPair(profileKeyPair); - } - }), this.minecraft); + this.minecraft.getConnection().prepareKeyPair(); this.getConnection().startTcpServerListener(null, port); LOGGER.info("Started serving on {}", port); this.publishedPort = port; @@ -291,7 +286,7 @@ public class IntegratedServer extends MinecraftServer { @Nullable @Override public GameType getForcedGameType() { - return this.isPublished() ? MoreObjects.firstNonNull(this.publishedGameType, this.worldData.getGameType()) : null; + return this.isPublished() && !this.isHardcore() ? MoreObjects.firstNonNull(this.publishedGameType, this.worldData.getGameType()) : null; } @Override diff --git a/net/minecraft/client/sounds/MusicManager.java b/net/minecraft/client/sounds/MusicManager.java index ac035e75..7da2a7a4 100644 --- a/net/minecraft/client/sounds/MusicManager.java +++ b/net/minecraft/client/sounds/MusicManager.java @@ -38,7 +38,7 @@ public class MusicManager { public void tick() { Music music = this.minecraft.getSituationalMusic(); if (this.currentMusic != null) { - if (!music.getEvent().value().getLocation().equals(this.currentMusic.getLocation()) && music.replaceCurrentMusic()) { + if (!music.getEvent().value().location().equals(this.currentMusic.getLocation()) && music.replaceCurrentMusic()) { this.minecraft.getSoundManager().stop(this.currentMusic); this.nextSongDelay = Mth.nextInt(this.random, 0, music.getMinDelay() / 2); } @@ -98,6 +98,6 @@ public class MusicManager { * @param selector the {@linkplain Music} selector to check for */ public boolean isPlayingMusic(Music selector) { - return this.currentMusic == null ? false : selector.getEvent().value().getLocation().equals(this.currentMusic.getLocation()); + return this.currentMusic == null ? false : selector.getEvent().value().location().equals(this.currentMusic.getLocation()); } } diff --git a/net/minecraft/client/sounds/SoundEngine.java b/net/minecraft/client/sounds/SoundEngine.java index bce47dee..351a7ddc 100644 --- a/net/minecraft/client/sounds/SoundEngine.java +++ b/net/minecraft/client/sounds/SoundEngine.java @@ -9,6 +9,7 @@ import com.mojang.blaze3d.audio.Channel; import com.mojang.blaze3d.audio.Library; import com.mojang.blaze3d.audio.Listener; import com.mojang.blaze3d.audio.ListenerTransform; +import com.mojang.blaze3d.audio.Library.Pool; import com.mojang.logging.LogUtils; import java.util.Iterator; import java.util.List; @@ -26,6 +27,8 @@ import net.minecraft.client.Options; import net.minecraft.client.resources.sounds.Sound; import net.minecraft.client.resources.sounds.SoundInstance; import net.minecraft.client.resources.sounds.TickableSoundInstance; +import net.minecraft.client.resources.sounds.SoundInstance.Attenuation; +import net.minecraft.client.sounds.ChannelAccess.ChannelHandle; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.packs.resources.ResourceProvider; @@ -94,7 +97,7 @@ public class SoundEngine { * The current state of the audio device check */ private final AtomicReference devicePoolState = new AtomicReference(SoundEngine.DeviceCheckState.NO_CHANGE); - private final Map instanceToChannel = Maps.newHashMap(); + private final Map instanceToChannel = Maps.newHashMap(); private final Multimap instanceBySource = HashMultimap.create(); /** * A subset of playingSounds, this contains only {@linkplain TickableSoundInstance} @@ -128,7 +131,7 @@ public class SoundEngine { for (SoundEvent soundEvent : BuiltInRegistries.SOUND_EVENT) { if (soundEvent != SoundEvents.EMPTY) { - ResourceLocation resourceLocation = soundEvent.getLocation(); + ResourceLocation resourceLocation = soundEvent.location(); if (this.soundManager.getSoundEvent(resourceLocation) == null) { LOGGER.warn("Missing sound for event: {}", BuiltInRegistries.SOUND_EVENT.getKey(soundEvent)); ONLY_WARN_ONCE.add(resourceLocation); @@ -221,7 +224,7 @@ public class SoundEngine { */ public void stop(SoundInstance sound) { if (this.loaded) { - ChannelAccess.ChannelHandle channelHandle = (ChannelAccess.ChannelHandle)this.instanceToChannel.get(sound); + ChannelHandle channelHandle = (ChannelHandle)this.instanceToChannel.get(sound); if (channelHandle != null) { channelHandle.execute(Channel::stop); } @@ -352,7 +355,7 @@ public class SoundEngine { float f = this.calculateVolume(tickableSoundInstance); float g = this.calculatePitch(tickableSoundInstance); Vec3 vec3 = new Vec3(tickableSoundInstance.getX(), tickableSoundInstance.getY(), tickableSoundInstance.getZ()); - ChannelAccess.ChannelHandle channelHandle = (ChannelAccess.ChannelHandle)this.instanceToChannel.get(tickableSoundInstance); + ChannelHandle channelHandle = (ChannelHandle)this.instanceToChannel.get(tickableSoundInstance); if (channelHandle != null) { channelHandle.execute(channel -> { channel.setVolume(f); @@ -363,11 +366,11 @@ public class SoundEngine { } } - Iterator> iterator = this.instanceToChannel.entrySet().iterator(); + Iterator> iterator = this.instanceToChannel.entrySet().iterator(); while (iterator.hasNext()) { - Entry entry = (Entry)iterator.next(); - ChannelAccess.ChannelHandle channelHandle2 = (ChannelAccess.ChannelHandle)entry.getValue(); + Entry entry = (Entry)iterator.next(); + ChannelHandle channelHandle2 = (ChannelHandle)entry.getValue(); SoundInstance soundInstance = (SoundInstance)entry.getKey(); float h = this.options.getSoundSourceVolume(soundInstance.getSource()); if (h <= 0.0F) { @@ -493,14 +496,14 @@ public class SoundEngine { SoundSource soundSource = sound.getSource(); float h = this.calculateVolume(f, soundSource); float i = this.calculatePitch(sound); - SoundInstance.Attenuation attenuation = sound.getAttenuation(); + Attenuation attenuation = sound.getAttenuation(); boolean bl = sound.isRelative(); if (h == 0.0F && !sound.canStartSilent()) { LOGGER.debug(MARKER, "Skipped playing sound {}, volume was zero.", sound2.getLocation()); } else { Vec3 vec3 = new Vec3(sound.getX(), sound.getY(), sound.getZ()); if (!this.listeners.isEmpty()) { - float j = !bl && attenuation != SoundInstance.Attenuation.NONE ? g : Float.POSITIVE_INFINITY; + float j = !bl && attenuation != Attenuation.NONE ? g : Float.POSITIVE_INFINITY; for (SoundEventListener soundEventListener : this.listeners) { soundEventListener.onPlaySound(sound, weighedSoundEvents, j); @@ -512,9 +515,8 @@ public class SoundEngine { } else { boolean bl2 = shouldLoopAutomatically(sound); boolean bl3 = sound2.shouldStream(); - CompletableFuture completableFuture = this.channelAccess - .createHandle(sound2.shouldStream() ? Library.Pool.STREAMING : Library.Pool.STATIC); - ChannelAccess.ChannelHandle channelHandle = (ChannelAccess.ChannelHandle)completableFuture.join(); + CompletableFuture completableFuture = this.channelAccess.createHandle(sound2.shouldStream() ? Pool.STREAMING : Pool.STATIC); + ChannelHandle channelHandle = (ChannelHandle)completableFuture.join(); if (channelHandle == null) { if (SharedConstants.IS_RUNNING_IN_IDE) { LOGGER.warn("Failed to create new sound handle"); @@ -527,7 +529,7 @@ public class SoundEngine { channelHandle.execute(channel -> { channel.setPitch(i); channel.setVolume(h); - if (attenuation == SoundInstance.Attenuation.LINEAR) { + if (attenuation == Attenuation.LINEAR) { channel.linearAttenuation(g); } else { channel.disableAttenuation(); diff --git a/net/minecraft/client/sounds/SoundEngineExecutor.java b/net/minecraft/client/sounds/SoundEngineExecutor.java index 21e9757d..fac70bbb 100644 --- a/net/minecraft/client/sounds/SoundEngineExecutor.java +++ b/net/minecraft/client/sounds/SoundEngineExecutor.java @@ -33,7 +33,7 @@ public class SoundEngineExecutor extends BlockableEventLoop { } @Override - protected Runnable wrapRunnable(Runnable runnable) { + public Runnable wrapRunnable(Runnable runnable) { return runnable; } diff --git a/net/minecraft/client/sounds/SoundManager.java b/net/minecraft/client/sounds/SoundManager.java index 48bffd93..ac6def1d 100644 --- a/net/minecraft/client/sounds/SoundManager.java +++ b/net/minecraft/client/sounds/SoundManager.java @@ -23,6 +23,8 @@ import net.minecraft.client.resources.sounds.SoundEventRegistration; import net.minecraft.client.resources.sounds.SoundEventRegistrationSerializer; import net.minecraft.client.resources.sounds.SoundInstance; import net.minecraft.client.resources.sounds.TickableSoundInstance; +import net.minecraft.client.resources.sounds.Sound.Type; +import net.minecraft.client.sounds.SoundManager.Preparations.1; import net.minecraft.core.RegistryAccess; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.network.chat.Component; @@ -34,10 +36,9 @@ import net.minecraft.server.packs.resources.ResourceProvider; import net.minecraft.server.packs.resources.SimplePreparableReloadListener; import net.minecraft.sounds.SoundSource; import net.minecraft.util.GsonHelper; -import net.minecraft.util.RandomSource; import net.minecraft.util.profiling.ProfilerFiller; +import net.minecraft.util.profiling.Zone; import net.minecraft.util.valueproviders.ConstantFloat; -import net.minecraft.util.valueproviders.MultipliedFloats; import org.jetbrains.annotations.Nullable; import org.slf4j.Logger; @@ -48,11 +49,11 @@ import org.slf4j.Logger; @Environment(EnvType.CLIENT) public class SoundManager extends SimplePreparableReloadListener { public static final ResourceLocation EMPTY_SOUND_LOCATION = ResourceLocation.withDefaultNamespace("empty"); - public static final Sound EMPTY_SOUND = new Sound(EMPTY_SOUND_LOCATION, ConstantFloat.of(1.0F), ConstantFloat.of(1.0F), 1, Sound.Type.FILE, false, false, 16); + public static final Sound EMPTY_SOUND = new Sound(EMPTY_SOUND_LOCATION, ConstantFloat.of(1.0F), ConstantFloat.of(1.0F), 1, Type.FILE, false, false, 16); public static final ResourceLocation INTENTIONALLY_EMPTY_SOUND_LOCATION = ResourceLocation.withDefaultNamespace("intentionally_empty"); public static final WeighedSoundEvents INTENTIONALLY_EMPTY_SOUND_EVENT = new WeighedSoundEvents(INTENTIONALLY_EMPTY_SOUND_LOCATION, null); public static final Sound INTENTIONALLY_EMPTY_SOUND = new Sound( - INTENTIONALLY_EMPTY_SOUND_LOCATION, ConstantFloat.of(1.0F), ConstantFloat.of(1.0F), 1, Sound.Type.FILE, false, false, 16 + INTENTIONALLY_EMPTY_SOUND_LOCATION, ConstantFloat.of(1.0F), ConstantFloat.of(1.0F), 1, Type.FILE, false, false, 16 ); static final Logger LOGGER = LogUtils.getLogger(); private static final String SOUNDS_PATH = "sounds.json"; @@ -77,15 +78,13 @@ public class SoundManager extends SimplePreparableReloadListener weighted; switch (sound.getType()) { case FILE: @@ -365,40 +361,7 @@ public class SoundManager extends SimplePreparableReloadListener() { - @Override - public int getWeight() { - WeighedSoundEvents weighedSoundEventsx = (WeighedSoundEvents)Preparations.this.registry.get(resourceLocation); - return weighedSoundEventsx == null ? 0 : weighedSoundEventsx.getWeight(); - } - - public Sound getSound(RandomSource randomSource) { - WeighedSoundEvents weighedSoundEventsx = (WeighedSoundEvents)Preparations.this.registry.get(resourceLocation); - if (weighedSoundEventsx == null) { - return SoundManager.EMPTY_SOUND; - } else { - Sound soundx = weighedSoundEventsx.getSound(randomSource); - return new Sound( - soundx.getLocation(), - new MultipliedFloats(soundx.getVolume(), sound.getVolume()), - new MultipliedFloats(soundx.getPitch(), sound.getPitch()), - sound.getWeight(), - Sound.Type.FILE, - soundx.shouldStream() || sound.shouldStream(), - soundx.shouldPreload(), - soundx.getAttenuationDistance() - ); - } - } - - @Override - public void preloadIfRequired(SoundEngine engine) { - WeighedSoundEvents weighedSoundEventsx = (WeighedSoundEvents)Preparations.this.registry.get(resourceLocation); - if (weighedSoundEventsx != null) { - weighedSoundEventsx.preloadIfRequired(engine); - } - } - }; + weighted = new 1(this, resourceLocation, sound); break; default: throw new IllegalStateException("Unknown SoundEventRegistration type: " + sound.getType()); diff --git a/net/minecraft/client/telemetry/TelemetryEventLog.java b/net/minecraft/client/telemetry/TelemetryEventLog.java index babebe9f..bcdd7a32 100644 --- a/net/minecraft/client/telemetry/TelemetryEventLog.java +++ b/net/minecraft/client/telemetry/TelemetryEventLog.java @@ -7,7 +7,7 @@ import java.util.concurrent.Executor; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.util.eventlog.JsonEventLog; -import net.minecraft.util.thread.ProcessorMailbox; +import net.minecraft.util.thread.ConsecutiveExecutor; import org.apache.commons.io.IOUtils; import org.slf4j.Logger; @@ -15,15 +15,15 @@ import org.slf4j.Logger; public class TelemetryEventLog implements AutoCloseable { private static final Logger LOGGER = LogUtils.getLogger(); private final JsonEventLog log; - private final ProcessorMailbox mailbox; + private final ConsecutiveExecutor consecutiveExecutor; public TelemetryEventLog(FileChannel channel, Executor dispatcher) { this.log = new JsonEventLog<>(TelemetryEventInstance.CODEC, channel); - this.mailbox = ProcessorMailbox.create(dispatcher, "telemetry-event-log"); + this.consecutiveExecutor = new ConsecutiveExecutor(dispatcher, "telemetry-event-log"); } public TelemetryEventLogger logger() { - return telemetryEventInstance -> this.mailbox.tell(() -> { + return telemetryEventInstance -> this.consecutiveExecutor.schedule(() -> { try { this.log.write(telemetryEventInstance); } catch (IOException var3) { @@ -33,7 +33,7 @@ public class TelemetryEventLog implements AutoCloseable { } public void close() { - this.mailbox.tell(() -> IOUtils.closeQuietly(this.log)); - this.mailbox.close(); + this.consecutiveExecutor.schedule(() -> IOUtils.closeQuietly(this.log)); + this.consecutiveExecutor.close(); } } diff --git a/net/minecraft/client/telemetry/TelemetryLogManager.java b/net/minecraft/client/telemetry/TelemetryLogManager.java index 0938f507..ffe92cd5 100644 --- a/net/minecraft/client/telemetry/TelemetryLogManager.java +++ b/net/minecraft/client/telemetry/TelemetryLogManager.java @@ -11,6 +11,7 @@ import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.Util; import net.minecraft.util.eventlog.EventLogDirectory; +import net.minecraft.util.eventlog.EventLogDirectory.RawFile; import org.jetbrains.annotations.Nullable; import org.slf4j.Logger; @@ -44,7 +45,7 @@ public class TelemetryLogManager implements AutoCloseable { if (this.sessionLog == null) { this.sessionLog = CompletableFuture.supplyAsync(() -> { try { - EventLogDirectory.RawFile rawFile = this.directory.createNewFile(LocalDate.now()); + RawFile rawFile = this.directory.createNewFile(LocalDate.now()); FileChannel fileChannel = rawFile.openChannel(); return Optional.of(new TelemetryEventLog(fileChannel, Util.backgroundExecutor())); } catch (IOException var3) { diff --git a/net/minecraft/client/telemetry/TelemetryProperty.java b/net/minecraft/client/telemetry/TelemetryProperty.java index e090f981..d0f64508 100644 --- a/net/minecraft/client/telemetry/TelemetryProperty.java +++ b/net/minecraft/client/telemetry/TelemetryProperty.java @@ -13,7 +13,7 @@ import java.util.function.Function; import java.util.stream.Collectors; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; -import net.minecraft.client.telemetry.events.GameLoadTimesEvent; +import net.minecraft.client.telemetry.events.GameLoadTimesEvent.Measurement; import net.minecraft.core.UUIDUtil; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.MutableComponent; @@ -63,16 +63,10 @@ public record TelemetryProperty(String id, String exportKey, Codec codec, public static final TelemetryProperty DEDICATED_MEMORY_KB = integer("dedicated_memory_kb", "dedicatedMemoryKb"); public static final TelemetryProperty WORLD_LOAD_TIME_MS = integer("world_load_time_ms", "worldLoadTimeMs"); public static final TelemetryProperty NEW_WORLD = bool("new_world", "newWorld"); - public static final TelemetryProperty LOAD_TIME_TOTAL_TIME_MS = gameLoadMeasurement( - "load_time_total_time_ms", "loadTimeTotalTimeMs" - ); - public static final TelemetryProperty LOAD_TIME_PRE_WINDOW_MS = gameLoadMeasurement( - "load_time_pre_window_ms", "loadTimePreWindowMs" - ); - public static final TelemetryProperty LOAD_TIME_BOOTSTRAP_MS = gameLoadMeasurement( - "load_time_bootstrap_ms", "loadTimeBootstrapMs" - ); - public static final TelemetryProperty LOAD_TIME_LOADING_OVERLAY_MS = gameLoadMeasurement( + public static final TelemetryProperty LOAD_TIME_TOTAL_TIME_MS = gameLoadMeasurement("load_time_total_time_ms", "loadTimeTotalTimeMs"); + public static final TelemetryProperty LOAD_TIME_PRE_WINDOW_MS = gameLoadMeasurement("load_time_pre_window_ms", "loadTimePreWindowMs"); + public static final TelemetryProperty LOAD_TIME_BOOTSTRAP_MS = gameLoadMeasurement("load_time_bootstrap_ms", "loadTimeBootstrapMs"); + public static final TelemetryProperty LOAD_TIME_LOADING_OVERLAY_MS = gameLoadMeasurement( "load_time_loading_overlay_ms", "loadTimeLoadingOverlayMs" ); public static final TelemetryProperty ADVANCEMENT_ID = string("advancement_id", "advancementId"); @@ -104,12 +98,9 @@ public record TelemetryProperty(String id, String exportKey, Codec codec, ); } - public static TelemetryProperty gameLoadMeasurement(String id, String exportKey) { + public static TelemetryProperty gameLoadMeasurement(String id, String exportKey) { return create( - id, - exportKey, - GameLoadTimesEvent.Measurement.CODEC, - (telemetryPropertyContainer, string, measurement) -> telemetryPropertyContainer.addProperty(string, measurement.millis()) + id, exportKey, Measurement.CODEC, (telemetryPropertyContainer, string, measurement) -> telemetryPropertyContainer.addProperty(string, measurement.millis()) ); } diff --git a/net/minecraft/client/tutorial/BundleTutorial.java b/net/minecraft/client/tutorial/BundleTutorial.java deleted file mode 100644 index ee2873e6..00000000 --- a/net/minecraft/client/tutorial/BundleTutorial.java +++ /dev/null @@ -1,61 +0,0 @@ -package net.minecraft.client.tutorial; - -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.client.Options; -import net.minecraft.client.gui.components.toasts.TutorialToast; -import net.minecraft.network.chat.Component; -import net.minecraft.world.inventory.ClickAction; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.Items; -import org.jetbrains.annotations.Nullable; - -@Environment(EnvType.CLIENT) -public class BundleTutorial { - private final Tutorial tutorial; - private final Options options; - @Nullable - private TutorialToast toast; - - public BundleTutorial(Tutorial tutorial, Options options) { - this.tutorial = tutorial; - this.options = options; - } - - private void showToast() { - if (this.toast != null) { - this.tutorial.removeTimedToast(this.toast); - } - - Component component = Component.translatable("tutorial.bundleInsert.title"); - Component component2 = Component.translatable("tutorial.bundleInsert.description"); - this.toast = new TutorialToast(TutorialToast.Icons.RIGHT_CLICK, component, component2, true); - this.tutorial.addTimedToast(this.toast, 160); - } - - private void clearToast() { - if (this.toast != null) { - this.tutorial.removeTimedToast(this.toast); - this.toast = null; - } - - if (!this.options.hideBundleTutorial) { - this.options.hideBundleTutorial = true; - this.options.save(); - } - } - - public void onInventoryAction(ItemStack carriedStack, ItemStack slottedStack, ClickAction action) { - if (!this.options.hideBundleTutorial) { - if (!carriedStack.isEmpty() && slottedStack.is(Items.BUNDLE)) { - if (action == ClickAction.PRIMARY) { - this.showToast(); - } else if (action == ClickAction.SECONDARY) { - this.clearToast(); - } - } else if (carriedStack.is(Items.BUNDLE) && !slottedStack.isEmpty() && action == ClickAction.SECONDARY) { - this.clearToast(); - } - } - } -} diff --git a/net/minecraft/client/tutorial/CraftPlanksTutorialStep.java b/net/minecraft/client/tutorial/CraftPlanksTutorialStep.java index b4d9833c..18b53f78 100644 --- a/net/minecraft/client/tutorial/CraftPlanksTutorialStep.java +++ b/net/minecraft/client/tutorial/CraftPlanksTutorialStep.java @@ -12,6 +12,7 @@ import net.minecraft.tags.ItemTags; import net.minecraft.tags.TagKey; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; +import org.jetbrains.annotations.Nullable; @Environment(EnvType.CLIENT) public class CraftPlanksTutorialStep implements TutorialStepInstance { @@ -19,6 +20,7 @@ public class CraftPlanksTutorialStep implements TutorialStepInstance { private static final Component CRAFT_TITLE = Component.translatable("tutorial.craft_planks.title"); private static final Component CRAFT_DESCRIPTION = Component.translatable("tutorial.craft_planks.description"); private final Tutorial tutorial; + @Nullable private TutorialToast toast; private int timeWaiting; @@ -49,7 +51,7 @@ public class CraftPlanksTutorialStep implements TutorialStepInstance { if (this.timeWaiting >= 1200 && this.toast == null) { this.toast = new TutorialToast(TutorialToast.Icons.WOODEN_PLANKS, CRAFT_TITLE, CRAFT_DESCRIPTION, false); - this.tutorial.getMinecraft().getToasts().addToast(this.toast); + this.tutorial.getMinecraft().getToastManager().addToast(this.toast); } } } diff --git a/net/minecraft/client/tutorial/FindTreeTutorialStepInstance.java b/net/minecraft/client/tutorial/FindTreeTutorialStepInstance.java index 71228086..0d29a73a 100644 --- a/net/minecraft/client/tutorial/FindTreeTutorialStepInstance.java +++ b/net/minecraft/client/tutorial/FindTreeTutorialStepInstance.java @@ -16,6 +16,8 @@ import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.HitResult; +import net.minecraft.world.phys.HitResult.Type; +import org.jetbrains.annotations.Nullable; @Environment(EnvType.CLIENT) public class FindTreeTutorialStepInstance implements TutorialStepInstance { @@ -23,6 +25,7 @@ public class FindTreeTutorialStepInstance implements TutorialStepInstance { private static final Component TITLE = Component.translatable("tutorial.find_tree.title"); private static final Component DESCRIPTION = Component.translatable("tutorial.find_tree.description"); private final Tutorial tutorial; + @Nullable private TutorialToast toast; private int timeWaiting; @@ -46,7 +49,7 @@ public class FindTreeTutorialStepInstance implements TutorialStepInstance { if (this.timeWaiting >= 6000 && this.toast == null) { this.toast = new TutorialToast(TutorialToast.Icons.TREE, TITLE, DESCRIPTION, false); - this.tutorial.getMinecraft().getToasts().addToast(this.toast); + this.tutorial.getMinecraft().getToastManager().addToast(this.toast); } } } @@ -61,7 +64,7 @@ public class FindTreeTutorialStepInstance implements TutorialStepInstance { @Override public void onLookAt(ClientLevel level, HitResult result) { - if (result.getType() == HitResult.Type.BLOCK) { + if (result.getType() == Type.BLOCK) { BlockState blockState = level.getBlockState(((BlockHitResult)result).getBlockPos()); if (blockState.is(BlockTags.COMPLETES_FIND_TREE_TUTORIAL)) { this.tutorial.setStep(TutorialSteps.PUNCH_TREE); diff --git a/net/minecraft/client/tutorial/MovementTutorialStepInstance.java b/net/minecraft/client/tutorial/MovementTutorialStepInstance.java index e6509e07..97f2dc15 100644 --- a/net/minecraft/client/tutorial/MovementTutorialStepInstance.java +++ b/net/minecraft/client/tutorial/MovementTutorialStepInstance.java @@ -3,8 +3,9 @@ package net.minecraft.client.tutorial; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.gui.components.toasts.TutorialToast; -import net.minecraft.client.player.Input; +import net.minecraft.client.player.ClientInput; import net.minecraft.network.chat.Component; +import org.jetbrains.annotations.Nullable; @Environment(EnvType.CLIENT) public class MovementTutorialStepInstance implements TutorialStepInstance { @@ -20,7 +21,9 @@ public class MovementTutorialStepInstance implements TutorialStepInstance { private static final Component LOOK_TITLE = Component.translatable("tutorial.look.title"); private static final Component LOOK_DESCRIPTION = Component.translatable("tutorial.look.description"); private final Tutorial tutorial; + @Nullable private TutorialToast moveToast; + @Nullable private TutorialToast lookToast; private int timeWaiting; private int timeMoved; @@ -84,10 +87,10 @@ public class MovementTutorialStepInstance implements TutorialStepInstance { if (this.timeWaiting >= 100) { if (this.moveCompleted == -1 && this.moveToast == null) { this.moveToast = new TutorialToast(TutorialToast.Icons.MOVEMENT_KEYS, MOVE_TITLE, MOVE_DESCRIPTION, true); - this.tutorial.getMinecraft().getToasts().addToast(this.moveToast); + this.tutorial.getMinecraft().getToastManager().addToast(this.moveToast); } else if (this.moveCompleted != -1 && this.timeWaiting - this.moveCompleted >= 20 && this.lookCompleted == -1 && this.lookToast == null) { this.lookToast = new TutorialToast(TutorialToast.Icons.MOUSE, LOOK_TITLE, LOOK_DESCRIPTION, true); - this.tutorial.getMinecraft().getToasts().addToast(this.lookToast); + this.tutorial.getMinecraft().getToastManager().addToast(this.lookToast); } } } @@ -106,8 +109,12 @@ public class MovementTutorialStepInstance implements TutorialStepInstance { } @Override - public void onInput(Input input) { - if (input.up || input.down || input.left || input.right || input.jumping) { + public void onInput(ClientInput clientInput) { + if (clientInput.keyPresses.forward() + || clientInput.keyPresses.backward() + || clientInput.keyPresses.left() + || clientInput.keyPresses.right() + || clientInput.keyPresses.jump()) { this.moved = true; } } diff --git a/net/minecraft/client/tutorial/OpenInventoryTutorialStep.java b/net/minecraft/client/tutorial/OpenInventoryTutorialStep.java index 9033d747..ba4ddffe 100644 --- a/net/minecraft/client/tutorial/OpenInventoryTutorialStep.java +++ b/net/minecraft/client/tutorial/OpenInventoryTutorialStep.java @@ -4,6 +4,7 @@ import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.gui.components.toasts.TutorialToast; import net.minecraft.network.chat.Component; +import org.jetbrains.annotations.Nullable; @Environment(EnvType.CLIENT) public class OpenInventoryTutorialStep implements TutorialStepInstance { @@ -11,6 +12,7 @@ public class OpenInventoryTutorialStep implements TutorialStepInstance { private static final Component TITLE = Component.translatable("tutorial.open_inventory.title"); private static final Component DESCRIPTION = Component.translatable("tutorial.open_inventory.description", Tutorial.key("inventory")); private final Tutorial tutorial; + @Nullable private TutorialToast toast; private int timeWaiting; @@ -26,7 +28,7 @@ public class OpenInventoryTutorialStep implements TutorialStepInstance { } else { if (this.timeWaiting >= 600 && this.toast == null) { this.toast = new TutorialToast(TutorialToast.Icons.RECIPE_BOOK, TITLE, DESCRIPTION, false); - this.tutorial.getMinecraft().getToasts().addToast(this.toast); + this.tutorial.getMinecraft().getToastManager().addToast(this.toast); } } } diff --git a/net/minecraft/client/tutorial/PunchTreeTutorialStepInstance.java b/net/minecraft/client/tutorial/PunchTreeTutorialStepInstance.java index caf9ba3d..bf164e58 100644 --- a/net/minecraft/client/tutorial/PunchTreeTutorialStepInstance.java +++ b/net/minecraft/client/tutorial/PunchTreeTutorialStepInstance.java @@ -11,6 +11,7 @@ import net.minecraft.tags.BlockTags; import net.minecraft.tags.ItemTags; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.block.state.BlockState; +import org.jetbrains.annotations.Nullable; @Environment(EnvType.CLIENT) public class PunchTreeTutorialStepInstance implements TutorialStepInstance { @@ -18,6 +19,7 @@ public class PunchTreeTutorialStepInstance implements TutorialStepInstance { private static final Component TITLE = Component.translatable("tutorial.punch_tree.title"); private static final Component DESCRIPTION = Component.translatable("tutorial.punch_tree.description", Tutorial.key("attack")); private final Tutorial tutorial; + @Nullable private TutorialToast toast; private int timeWaiting; private int resetCount; @@ -49,7 +51,7 @@ public class PunchTreeTutorialStepInstance implements TutorialStepInstance { if ((this.timeWaiting >= 600 || this.resetCount > 3) && this.toast == null) { this.toast = new TutorialToast(TutorialToast.Icons.TREE, TITLE, DESCRIPTION, true); - this.tutorial.getMinecraft().getToasts().addToast(this.toast); + this.tutorial.getMinecraft().getToastManager().addToast(this.toast); } } } diff --git a/net/minecraft/client/tutorial/Tutorial.java b/net/minecraft/client/tutorial/Tutorial.java index 2c0661ba..c3e7c4e0 100644 --- a/net/minecraft/client/tutorial/Tutorial.java +++ b/net/minecraft/client/tutorial/Tutorial.java @@ -1,15 +1,12 @@ package net.minecraft.client.tutorial; -import com.google.common.collect.Lists; -import java.util.List; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.ChatFormatting; import net.minecraft.client.Minecraft; import net.minecraft.client.Options; -import net.minecraft.client.gui.components.toasts.TutorialToast; import net.minecraft.client.multiplayer.ClientLevel; -import net.minecraft.client.player.Input; +import net.minecraft.client.player.ClientInput; import net.minecraft.core.BlockPos; import net.minecraft.network.chat.Component; import net.minecraft.world.inventory.ClickAction; @@ -24,17 +21,14 @@ public class Tutorial { private final Minecraft minecraft; @Nullable private TutorialStepInstance instance; - private final List timedToasts = Lists.newArrayList(); - private final BundleTutorial bundleTutorial; public Tutorial(Minecraft minecraft, Options options) { this.minecraft = minecraft; - this.bundleTutorial = new BundleTutorial(this, options); } - public void onInput(Input input) { + public void onInput(ClientInput clientInput) { if (this.instance != null) { - this.instance.onInput(input); + this.instance.onInput(clientInput); } } @@ -92,18 +86,7 @@ public class Tutorial { this.instance = this.minecraft.options.tutorialStep.create(this); } - public void addTimedToast(TutorialToast toast, int durationTicks) { - this.timedToasts.add(new Tutorial.TimedToast(toast, durationTicks)); - this.minecraft.getToasts().addToast(toast); - } - - public void removeTimedToast(TutorialToast toast) { - this.timedToasts.removeIf(timedToast -> timedToast.toast == toast); - toast.hide(); - } - public void tick() { - this.timedToasts.removeIf(Tutorial.TimedToast::updateProgress); if (this.instance != null) { if (this.minecraft.level != null) { this.instance.tick(); @@ -140,28 +123,5 @@ public class Tutorial { } public void onInventoryAction(ItemStack carriedStack, ItemStack slottedStack, ClickAction action) { - this.bundleTutorial.onInventoryAction(carriedStack, slottedStack, action); - } - - @Environment(EnvType.CLIENT) - static final class TimedToast { - final TutorialToast toast; - private final int durationTicks; - private int progress; - - TimedToast(TutorialToast toast, int durationTicks) { - this.toast = toast; - this.durationTicks = durationTicks; - } - - private boolean updateProgress() { - this.toast.updateProgress(Math.min((float)(++this.progress) / this.durationTicks, 1.0F)); - if (this.progress > this.durationTicks) { - this.toast.hide(); - return true; - } else { - return false; - } - } } } diff --git a/net/minecraft/client/tutorial/TutorialStepInstance.java b/net/minecraft/client/tutorial/TutorialStepInstance.java index 92e85b0d..d266a4b8 100644 --- a/net/minecraft/client/tutorial/TutorialStepInstance.java +++ b/net/minecraft/client/tutorial/TutorialStepInstance.java @@ -3,7 +3,7 @@ package net.minecraft.client.tutorial; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.multiplayer.ClientLevel; -import net.minecraft.client.player.Input; +import net.minecraft.client.player.ClientInput; import net.minecraft.core.BlockPos; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.block.state.BlockState; @@ -17,10 +17,7 @@ public interface TutorialStepInstance { default void tick() { } - /** - * Handles the player movement - */ - default void onInput(Input input) { + default void onInput(ClientInput clientInput) { } default void onMouse(double velocityX, double velocityY) { diff --git a/net/minecraft/commands/CommandBuildContext.java b/net/minecraft/commands/CommandBuildContext.java index f9ba69e8..6488d6ae 100644 --- a/net/minecraft/commands/CommandBuildContext.java +++ b/net/minecraft/commands/CommandBuildContext.java @@ -11,14 +11,21 @@ public interface CommandBuildContext extends HolderLookup.Provider { static CommandBuildContext simple(HolderLookup.Provider provider, FeatureFlagSet enabledFeatures) { return new CommandBuildContext() { @Override - public Stream>> listRegistries() { - return provider.listRegistries(); + public Stream>> listRegistryKeys() { + return provider.listRegistryKeys(); } @Override public Optional> lookup(ResourceKey> registryKey) { return provider.lookup(registryKey).map(registryLookup -> registryLookup.filterFeatures(enabledFeatures)); } + + @Override + public FeatureFlagSet enabledFeatures() { + return enabledFeatures; + } }; } + + FeatureFlagSet enabledFeatures(); } diff --git a/net/minecraft/commands/CommandSourceStack.java b/net/minecraft/commands/CommandSourceStack.java index 42fc01b1..87b4a53e 100644 --- a/net/minecraft/commands/CommandSourceStack.java +++ b/net/minecraft/commands/CommandSourceStack.java @@ -17,11 +17,13 @@ import java.util.function.BinaryOperator; import java.util.function.Supplier; import java.util.stream.Stream; import net.minecraft.ChatFormatting; -import net.minecraft.commands.arguments.EntityAnchorArgument; +import net.minecraft.advancements.AdvancementHolder; +import net.minecraft.commands.arguments.EntityAnchorArgument.Anchor; import net.minecraft.commands.execution.TraceCallbacks; import net.minecraft.core.Registry; import net.minecraft.core.RegistryAccess; import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.core.registries.Registries; import net.minecraft.network.chat.ChatType; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.ComponentUtils; @@ -57,7 +59,7 @@ public class CommandSourceStack implements ExecutionCommandSource getAvailableSounds() { - return BuiltInRegistries.SOUND_EVENT.stream().map(SoundEvent::getLocation); - } - - @Override - public Stream getRecipeNames() { - return this.server.getRecipeManager().getRecipeIds(); + return BuiltInRegistries.SOUND_EVENT.stream().map(SoundEvent::location); } @Override @@ -549,10 +546,19 @@ public class CommandSourceStack implements ExecutionCommandSource context ) { - return (CompletableFuture)this.registryAccess().registry(resourceKey).map(registry -> { - this.suggestRegistryElements(registry, registryKey, builder); - return builder.buildFuture(); - }).orElseGet(Suggestions::empty); + if (resourceKey == Registries.RECIPE) { + return SharedSuggestionProvider.suggestResource( + this.server.getRecipeManager().getRecipes().stream().map(recipeHolder -> recipeHolder.id().location()), builder + ); + } else if (resourceKey == Registries.ADVANCEMENT) { + Collection collection = this.server.getAdvancements().getAllAdvancements(); + return SharedSuggestionProvider.suggestResource(collection.stream().map(AdvancementHolder::id), builder); + } else { + return (CompletableFuture)this.registryAccess().lookup(resourceKey).map(registry -> { + this.suggestRegistryElements(registry, registryKey, builder); + return builder.buildFuture(); + }).orElseGet(Suggestions::empty); + } } @Override diff --git a/net/minecraft/commands/Commands.java b/net/minecraft/commands/Commands.java index 1975b888..a3568744 100644 --- a/net/minecraft/commands/Commands.java +++ b/net/minecraft/commands/Commands.java @@ -26,13 +26,14 @@ import java.util.stream.Stream; import net.minecraft.ChatFormatting; import net.minecraft.SharedConstants; import net.minecraft.Util; +import net.minecraft.commands.Commands.1.1; import net.minecraft.commands.execution.ExecutionContext; import net.minecraft.commands.synchronization.ArgumentTypeInfos; import net.minecraft.commands.synchronization.ArgumentUtils; import net.minecraft.commands.synchronization.SuggestionProviders; import net.minecraft.core.HolderLookup; -import net.minecraft.core.HolderSet; import net.minecraft.core.Registry; +import net.minecraft.core.HolderLookup.RegistryLookup.Delegate; import net.minecraft.data.registries.VanillaRegistries; import net.minecraft.gametest.framework.TestCommand; import net.minecraft.network.chat.ClickEvent; @@ -96,6 +97,7 @@ import net.minecraft.server.commands.RecipeCommand; import net.minecraft.server.commands.ReloadCommand; import net.minecraft.server.commands.ReturnCommand; import net.minecraft.server.commands.RideCommand; +import net.minecraft.server.commands.RotateCommand; import net.minecraft.server.commands.SaveAllCommand; import net.minecraft.server.commands.SaveOffCommand; import net.minecraft.server.commands.SaveOnCommand; @@ -130,8 +132,10 @@ import net.minecraft.server.commands.WhitelistCommand; import net.minecraft.server.commands.WorldBorderCommand; import net.minecraft.server.commands.data.DataCommands; import net.minecraft.server.level.ServerPlayer; -import net.minecraft.tags.TagKey; +import net.minecraft.util.profiling.Profiler; import net.minecraft.util.profiling.jfr.JvmProfiler; +import net.minecraft.world.flag.FeatureFlagSet; +import net.minecraft.world.flag.FeatureFlags; import net.minecraft.world.level.GameRules; import org.jetbrains.annotations.Nullable; import org.slf4j.Logger; @@ -168,7 +172,7 @@ public class Commands { ForceLoadCommand.register(this.dispatcher); FunctionCommand.register(this.dispatcher); GameModeCommand.register(this.dispatcher); - GameRuleCommand.register(this.dispatcher); + GameRuleCommand.register(this.dispatcher, context); GiveCommand.register(this.dispatcher, context); HelpCommand.register(this.dispatcher); ItemCommands.register(this.dispatcher, context); @@ -186,6 +190,7 @@ public class Commands { RecipeCommand.register(this.dispatcher); ReturnCommand.register(this.dispatcher); RideCommand.register(this.dispatcher); + RotateCommand.register(this.dispatcher); SayCommand.register(this.dispatcher); ScheduleCommand.register(this.dispatcher); ScoreboardCommand.register(this.dispatcher, context); @@ -263,7 +268,7 @@ public class Commands { public void performCommand(ParseResults parseResults, String command) { CommandSourceStack commandSourceStack = parseResults.getContext().getSource(); - commandSourceStack.getServer().getProfiler().push((Supplier)(() -> "/" + command)); + Profiler.get().push((Supplier)(() -> "/" + command)); ContextChain contextChain = finishParsing(parseResults, command, commandSourceStack); try { @@ -297,7 +302,7 @@ public class Commands { LOGGER.error("'/{}' threw an exception", command, var12); } } finally { - commandSourceStack.getServer().getProfiler().pop(); + Profiler.get().pop(); } } @@ -340,7 +345,7 @@ public class Commands { int i = Math.max(1, minecraftServer.getGameRules().getInt(GameRules.RULE_MAX_COMMAND_CHAIN_LENGTH)); int j = minecraftServer.getGameRules().getInt(GameRules.RULE_MAX_COMMAND_FORK_COUNT); - try (ExecutionContext executionContext2 = new ExecutionContext<>(i, j, minecraftServer.getProfiler())) { + try (ExecutionContext executionContext2 = new ExecutionContext<>(i, j, Profiler.get())) { CURRENT_EXECUTION_CONTEXT.set(executionContext2); contextConsumer.accept(executionContext2); executionContext2.runCommandQueue(); @@ -445,8 +450,13 @@ public class Commands { public static CommandBuildContext createValidationContext(HolderLookup.Provider provider) { return new CommandBuildContext() { @Override - public Stream>> listRegistries() { - return provider.listRegistries(); + public FeatureFlagSet enabledFeatures() { + return FeatureFlags.REGISTRY.allFlags(); + } + + @Override + public Stream>> listRegistryKeys() { + return provider.listRegistryKeys(); } @Override @@ -454,24 +464,8 @@ public class Commands { return provider.lookup(registryKey).map(this::createLookup); } - private HolderLookup.RegistryLookup.Delegate createLookup(HolderLookup.RegistryLookup registryLookup) { - return new HolderLookup.RegistryLookup.Delegate() { - @Override - public HolderLookup.RegistryLookup parent() { - return registryLookup; - } - - @Override - public Optional> get(TagKey tagKey) { - return Optional.of(this.getOrThrow(tagKey)); - } - - @Override - public HolderSet.Named getOrThrow(TagKey tagKey) { - Optional> optional = this.parent().get(tagKey); - return (HolderSet.Named)optional.orElseGet(() -> HolderSet.emptyNamed(this.parent(), tagKey)); - } - }; + private Delegate createLookup(HolderLookup.RegistryLookup registryLookup) { + return new 1(this, registryLookup); } }; } diff --git a/net/minecraft/commands/SharedSuggestionProvider.java b/net/minecraft/commands/SharedSuggestionProvider.java index fb246608..107b217d 100644 --- a/net/minecraft/commands/SharedSuggestionProvider.java +++ b/net/minecraft/commands/SharedSuggestionProvider.java @@ -20,7 +20,6 @@ import net.minecraft.core.Registry; import net.minecraft.core.RegistryAccess; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; -import net.minecraft.tags.TagKey; import net.minecraft.world.flag.FeatureFlagSet; import net.minecraft.world.level.Level; @@ -39,8 +38,6 @@ public interface SharedSuggestionProvider { Stream getAvailableSounds(); - Stream getRecipeNames(); - CompletableFuture customSuggestion(CommandContext context); default Collection getRelevantCoordinates() { @@ -59,7 +56,7 @@ public interface SharedSuggestionProvider { default void suggestRegistryElements(Registry registry, SharedSuggestionProvider.ElementSuggestionType type, SuggestionsBuilder builder) { if (type.shouldSuggestTags()) { - suggestResource(registry.getTagNames().map(TagKey::location), builder, "#"); + suggestResource(registry.getTags().map(named -> named.key().location()), builder, "#"); } if (type.shouldSuggestElements()) { diff --git a/net/minecraft/commands/arguments/ResourceKeyArgument.java b/net/minecraft/commands/arguments/ResourceKeyArgument.java index b12a4260..93d1bc7e 100644 --- a/net/minecraft/commands/arguments/ResourceKeyArgument.java +++ b/net/minecraft/commands/arguments/ResourceKeyArgument.java @@ -12,7 +12,8 @@ import java.util.Arrays; import java.util.Collection; import java.util.Optional; import java.util.concurrent.CompletableFuture; -import net.minecraft.commands.CommandBuildContext; +import net.minecraft.advancements.Advancement; +import net.minecraft.advancements.AdvancementHolder; import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.SharedSuggestionProvider; import net.minecraft.commands.synchronization.ArgumentTypeInfo; @@ -23,6 +24,9 @@ import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.crafting.Recipe; +import net.minecraft.world.item.crafting.RecipeHolder; +import net.minecraft.world.item.crafting.RecipeManager; import net.minecraft.world.level.levelgen.feature.ConfiguredFeature; import net.minecraft.world.level.levelgen.structure.Structure; import net.minecraft.world.level.levelgen.structure.pools.StructureTemplatePool; @@ -38,6 +42,12 @@ public class ResourceKeyArgument implements ArgumentType> { private static final DynamicCommandExceptionType ERROR_INVALID_TEMPLATE_POOL = new DynamicCommandExceptionType( object -> Component.translatableEscape("commands.place.jigsaw.invalid", object) ); + private static final DynamicCommandExceptionType ERROR_INVALID_RECIPE = new DynamicCommandExceptionType( + object -> Component.translatableEscape("recipe.notFound", object) + ); + private static final DynamicCommandExceptionType ERROR_INVALID_ADVANCEMENT = new DynamicCommandExceptionType( + object -> Component.translatableEscape("advancement.advancementNotFound", object) + ); final ResourceKey> registryKey; public ResourceKeyArgument(ResourceKey> registryKey) { @@ -53,18 +63,18 @@ public class ResourceKeyArgument implements ArgumentType> { ) throws CommandSyntaxException { ResourceKey resourceKey = context.getArgument(argument, ResourceKey.class); Optional> optional = resourceKey.cast(registryKey); - return (ResourceKey)optional.orElseThrow(() -> exception.create(resourceKey)); + return (ResourceKey)optional.orElseThrow(() -> exception.create(resourceKey.location())); } private static Registry getRegistry(CommandContext context, ResourceKey> registryKey) { - return context.getSource().getServer().registryAccess().registryOrThrow(registryKey); + return context.getSource().getServer().registryAccess().lookupOrThrow(registryKey); } private static Holder.Reference resolveKey( CommandContext context, String argument, ResourceKey> registryKey, DynamicCommandExceptionType exception ) throws CommandSyntaxException { ResourceKey resourceKey = getRegistryKey(context, argument, registryKey, exception); - return (Holder.Reference)getRegistry(context, registryKey).getHolder(resourceKey).orElseThrow(() -> exception.create(resourceKey.location())); + return (Holder.Reference)getRegistry(context, registryKey).get(resourceKey).orElseThrow(() -> exception.create(resourceKey.location())); } public static Holder.Reference> getConfiguredFeature(CommandContext context, String argument) throws CommandSyntaxException { @@ -79,6 +89,22 @@ public class ResourceKeyArgument implements ArgumentType> { return resolveKey(context, argument, Registries.TEMPLATE_POOL, ERROR_INVALID_TEMPLATE_POOL); } + public static RecipeHolder getRecipe(CommandContext commandContext, String string) throws CommandSyntaxException { + RecipeManager recipeManager = commandContext.getSource().getServer().getRecipeManager(); + ResourceKey> resourceKey = getRegistryKey(commandContext, string, Registries.RECIPE, ERROR_INVALID_RECIPE); + return (RecipeHolder)recipeManager.byKey(resourceKey).orElseThrow(() -> ERROR_INVALID_RECIPE.create(resourceKey.location())); + } + + public static AdvancementHolder getAdvancement(CommandContext commandContext, String string) throws CommandSyntaxException { + ResourceKey resourceKey = getRegistryKey(commandContext, string, Registries.ADVANCEMENT, ERROR_INVALID_ADVANCEMENT); + AdvancementHolder advancementHolder = commandContext.getSource().getServer().getAdvancements().get(resourceKey.location()); + if (advancementHolder == null) { + throw ERROR_INVALID_ADVANCEMENT.create(resourceKey.location()); + } else { + return advancementHolder; + } + } + public ResourceKey parse(StringReader reader) throws CommandSyntaxException { ResourceLocation resourceLocation = ResourceLocation.read(reader); return ResourceKey.create(this.registryKey, resourceLocation); @@ -104,7 +130,7 @@ public class ResourceKeyArgument implements ArgumentType> { } public ResourceKeyArgument.Info.Template deserializeFromNetwork(FriendlyByteBuf buffer) { - return new ResourceKeyArgument.Info.Template(buffer.readRegistryKey()); + return new net.minecraft.commands.arguments.ResourceKeyArgument.Info.Template(this, buffer.readRegistryKey()); } public void serializeToJson(ResourceKeyArgument.Info.Template template, JsonObject json) { @@ -112,24 +138,7 @@ public class ResourceKeyArgument implements ArgumentType> { } public ResourceKeyArgument.Info.Template unpack(ResourceKeyArgument argument) { - return new ResourceKeyArgument.Info.Template(argument.registryKey); - } - - public final class Template implements ArgumentTypeInfo.Template> { - final ResourceKey> registryKey; - - Template(final ResourceKey> registryKey) { - this.registryKey = registryKey; - } - - public ResourceKeyArgument instantiate(CommandBuildContext context) { - return new ResourceKeyArgument<>(this.registryKey); - } - - @Override - public ArgumentTypeInfo, ?> type() { - return Info.this; - } + return new net.minecraft.commands.arguments.ResourceKeyArgument.Info.Template(this, argument.registryKey); } } } diff --git a/net/minecraft/commands/arguments/ResourceLocationArgument.java b/net/minecraft/commands/arguments/ResourceLocationArgument.java index 3be5ea17..1f268390 100644 --- a/net/minecraft/commands/arguments/ResourceLocationArgument.java +++ b/net/minecraft/commands/arguments/ResourceLocationArgument.java @@ -4,45 +4,18 @@ import com.mojang.brigadier.StringReader; import com.mojang.brigadier.arguments.ArgumentType; import com.mojang.brigadier.context.CommandContext; import com.mojang.brigadier.exceptions.CommandSyntaxException; -import com.mojang.brigadier.exceptions.DynamicCommandExceptionType; import java.util.Arrays; import java.util.Collection; -import net.minecraft.advancements.AdvancementHolder; import net.minecraft.commands.CommandSourceStack; -import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.item.crafting.RecipeHolder; -import net.minecraft.world.item.crafting.RecipeManager; public class ResourceLocationArgument implements ArgumentType { private static final Collection EXAMPLES = Arrays.asList("foo", "foo:bar", "012"); - private static final DynamicCommandExceptionType ERROR_UNKNOWN_ADVANCEMENT = new DynamicCommandExceptionType( - object -> Component.translatableEscape("advancement.advancementNotFound", object) - ); - private static final DynamicCommandExceptionType ERROR_UNKNOWN_RECIPE = new DynamicCommandExceptionType( - object -> Component.translatableEscape("recipe.notFound", object) - ); public static ResourceLocationArgument id() { return new ResourceLocationArgument(); } - public static AdvancementHolder getAdvancement(CommandContext context, String name) throws CommandSyntaxException { - ResourceLocation resourceLocation = getId(context, name); - AdvancementHolder advancementHolder = context.getSource().getServer().getAdvancements().get(resourceLocation); - if (advancementHolder == null) { - throw ERROR_UNKNOWN_ADVANCEMENT.create(resourceLocation); - } else { - return advancementHolder; - } - } - - public static RecipeHolder getRecipe(CommandContext context, String name) throws CommandSyntaxException { - RecipeManager recipeManager = context.getSource().getServer().getRecipeManager(); - ResourceLocation resourceLocation = getId(context, name); - return (RecipeHolder)recipeManager.byKey(resourceLocation).orElseThrow(() -> ERROR_UNKNOWN_RECIPE.create(resourceLocation)); - } - public static ResourceLocation getId(CommandContext context, String name) { return context.getArgument(name, ResourceLocation.class); } diff --git a/net/minecraft/commands/arguments/coordinates/WorldCoordinates.java b/net/minecraft/commands/arguments/coordinates/WorldCoordinates.java index 36ff0ae0..6ba29f7d 100644 --- a/net/minecraft/commands/arguments/coordinates/WorldCoordinates.java +++ b/net/minecraft/commands/arguments/coordinates/WorldCoordinates.java @@ -104,13 +104,6 @@ public class WorldCoordinates implements Coordinates { return new WorldCoordinates(new WorldCoordinate(false, vector.x), new WorldCoordinate(false, vector.y), new WorldCoordinate(true, 0.0)); } - /** - * A location with a delta of 0 for all values (equivalent to ~ ~ ~ or ~0 ~0 ~0) - */ - public static WorldCoordinates current() { - return new WorldCoordinates(new WorldCoordinate(true, 0.0), new WorldCoordinate(true, 0.0), new WorldCoordinate(true, 0.0)); - } - public int hashCode() { int i = this.x.hashCode(); i = 31 * i + this.y.hashCode(); diff --git a/net/minecraft/commands/arguments/item/ItemParser.java b/net/minecraft/commands/arguments/item/ItemParser.java index 2c542298..f43b45c7 100644 --- a/net/minecraft/commands/arguments/item/ItemParser.java +++ b/net/minecraft/commands/arguments/item/ItemParser.java @@ -209,7 +209,7 @@ public class ItemParser { } else { int i = reader.getCursor(); ResourceLocation resourceLocation = ResourceLocation.read(reader); - DataComponentType dataComponentType = BuiltInRegistries.DATA_COMPONENT_TYPE.get(resourceLocation); + DataComponentType dataComponentType = BuiltInRegistries.DATA_COMPONENT_TYPE.getValue(resourceLocation); if (dataComponentType != null && !dataComponentType.isTransient()) { return dataComponentType; } else { diff --git a/net/minecraft/commands/arguments/selector/SelectorPattern.java b/net/minecraft/commands/arguments/selector/SelectorPattern.java new file mode 100644 index 00000000..81d601ef --- /dev/null +++ b/net/minecraft/commands/arguments/selector/SelectorPattern.java @@ -0,0 +1,31 @@ +package net.minecraft.commands.arguments.selector; + +import com.mojang.brigadier.StringReader; +import com.mojang.brigadier.exceptions.CommandSyntaxException; +import com.mojang.serialization.Codec; +import com.mojang.serialization.DataResult; + +public record SelectorPattern(String pattern, EntitySelector resolved) { + public static final Codec CODEC = Codec.STRING.comapFlatMap(SelectorPattern::parse, SelectorPattern::pattern); + + public static DataResult parse(String string) { + try { + EntitySelectorParser entitySelectorParser = new EntitySelectorParser(new StringReader(string), true); + return DataResult.success(new SelectorPattern(string, entitySelectorParser.parse())); + } catch (CommandSyntaxException var2) { + return DataResult.error(() -> "Invalid selector component: " + string + ": " + var2.getMessage()); + } + } + + public boolean equals(Object object) { + return object instanceof SelectorPattern selectorPattern && this.pattern.equals(selectorPattern.pattern); + } + + public int hashCode() { + return this.pattern.hashCode(); + } + + public String toString() { + return this.pattern; + } +} diff --git a/net/minecraft/commands/arguments/selector/options/EntitySelectorOptions.java b/net/minecraft/commands/arguments/selector/options/EntitySelectorOptions.java index 0ee5c287..dad3448e 100644 --- a/net/minecraft/commands/arguments/selector/options/EntitySelectorOptions.java +++ b/net/minecraft/commands/arguments/selector/options/EntitySelectorOptions.java @@ -16,8 +16,9 @@ import java.util.function.Predicate; import net.minecraft.advancements.AdvancementHolder; import net.minecraft.advancements.AdvancementProgress; import net.minecraft.advancements.CriterionProgress; -import net.minecraft.advancements.critereon.MinMaxBounds; import net.minecraft.advancements.critereon.WrappedMinMaxBounds; +import net.minecraft.advancements.critereon.MinMaxBounds.Doubles; +import net.minecraft.advancements.critereon.MinMaxBounds.Ints; import net.minecraft.commands.SharedSuggestionProvider; import net.minecraft.commands.arguments.selector.EntitySelector; import net.minecraft.commands.arguments.selector.EntitySelectorParser; @@ -102,7 +103,7 @@ public class EntitySelectorOptions { }, entitySelectorParser -> !entitySelectorParser.hasNameEquals(), Component.translatable("argument.entity.options.name.description")); register("distance", entitySelectorParser -> { int i = entitySelectorParser.getReader().getCursor(); - MinMaxBounds.Doubles doubles = MinMaxBounds.Doubles.fromReader(entitySelectorParser.getReader()); + Doubles doubles = Doubles.fromReader(entitySelectorParser.getReader()); if ((!doubles.min().isPresent() || !((Double)doubles.min().get() < 0.0)) && (!doubles.max().isPresent() || !((Double)doubles.max().get() < 0.0))) { entitySelectorParser.setDistance(doubles); entitySelectorParser.setWorldLimited(); @@ -113,7 +114,7 @@ public class EntitySelectorOptions { }, entitySelectorParser -> entitySelectorParser.getDistance().isAny(), Component.translatable("argument.entity.options.distance.description")); register("level", entitySelectorParser -> { int i = entitySelectorParser.getReader().getCursor(); - MinMaxBounds.Ints ints = MinMaxBounds.Ints.fromReader(entitySelectorParser.getReader()); + Ints ints = Ints.fromReader(entitySelectorParser.getReader()); if ((!ints.min().isPresent() || (Integer)ints.min().get() >= 0) && (!ints.max().isPresent() || (Integer)ints.max().get() >= 0)) { entitySelectorParser.setLevel(ints); entitySelectorParser.setIncludesEntities(false); @@ -273,47 +274,56 @@ public class EntitySelectorOptions { entitySelectorParser.setHasTeamEquals(true); } }, entitySelectorParser -> !entitySelectorParser.hasTeamEquals(), Component.translatable("argument.entity.options.team.description")); - register("type", entitySelectorParser -> { - entitySelectorParser.setSuggestions((suggestionsBuilder, consumer) -> { - SharedSuggestionProvider.suggestResource(BuiltInRegistries.ENTITY_TYPE.keySet(), suggestionsBuilder, String.valueOf('!')); - SharedSuggestionProvider.suggestResource(BuiltInRegistries.ENTITY_TYPE.getTagNames().map(TagKey::location), suggestionsBuilder, "!#"); - if (!entitySelectorParser.isTypeLimitedInversely()) { - SharedSuggestionProvider.suggestResource(BuiltInRegistries.ENTITY_TYPE.keySet(), suggestionsBuilder); - SharedSuggestionProvider.suggestResource(BuiltInRegistries.ENTITY_TYPE.getTagNames().map(TagKey::location), suggestionsBuilder, String.valueOf('#')); - } + register( + "type", + entitySelectorParser -> { + entitySelectorParser.setSuggestions( + (suggestionsBuilder, consumer) -> { + SharedSuggestionProvider.suggestResource(BuiltInRegistries.ENTITY_TYPE.keySet(), suggestionsBuilder, String.valueOf('!')); + SharedSuggestionProvider.suggestResource(BuiltInRegistries.ENTITY_TYPE.getTags().map(named -> named.key().location()), suggestionsBuilder, "!#"); + if (!entitySelectorParser.isTypeLimitedInversely()) { + SharedSuggestionProvider.suggestResource(BuiltInRegistries.ENTITY_TYPE.keySet(), suggestionsBuilder); + SharedSuggestionProvider.suggestResource( + BuiltInRegistries.ENTITY_TYPE.getTags().map(named -> named.key().location()), suggestionsBuilder, String.valueOf('#') + ); + } - return suggestionsBuilder.buildFuture(); - }); - int i = entitySelectorParser.getReader().getCursor(); - boolean bl = entitySelectorParser.shouldInvertValue(); - if (entitySelectorParser.isTypeLimitedInversely() && !bl) { - entitySelectorParser.getReader().setCursor(i); - throw ERROR_INAPPLICABLE_OPTION.createWithContext(entitySelectorParser.getReader(), "type"); - } else { - if (bl) { - entitySelectorParser.setTypeLimitedInversely(); - } - - if (entitySelectorParser.isTag()) { - TagKey> tagKey = TagKey.create(Registries.ENTITY_TYPE, ResourceLocation.read(entitySelectorParser.getReader())); - entitySelectorParser.addPredicate(entity -> entity.getType().is(tagKey) != bl); + return suggestionsBuilder.buildFuture(); + } + ); + int i = entitySelectorParser.getReader().getCursor(); + boolean bl = entitySelectorParser.shouldInvertValue(); + if (entitySelectorParser.isTypeLimitedInversely() && !bl) { + entitySelectorParser.getReader().setCursor(i); + throw ERROR_INAPPLICABLE_OPTION.createWithContext(entitySelectorParser.getReader(), "type"); } else { - ResourceLocation resourceLocation = ResourceLocation.read(entitySelectorParser.getReader()); - EntityType entityType = (EntityType)BuiltInRegistries.ENTITY_TYPE.getOptional(resourceLocation).orElseThrow(() -> { - entitySelectorParser.getReader().setCursor(i); - return ERROR_ENTITY_TYPE_INVALID.createWithContext(entitySelectorParser.getReader(), resourceLocation.toString()); - }); - if (Objects.equals(EntityType.PLAYER, entityType) && !bl) { - entitySelectorParser.setIncludesEntities(false); + if (bl) { + entitySelectorParser.setTypeLimitedInversely(); } - entitySelectorParser.addPredicate(entity -> Objects.equals(entityType, entity.getType()) != bl); - if (!bl) { - entitySelectorParser.limitToType(entityType); + if (entitySelectorParser.isTag()) { + TagKey> tagKey = TagKey.create(Registries.ENTITY_TYPE, ResourceLocation.read(entitySelectorParser.getReader())); + entitySelectorParser.addPredicate(entity -> entity.getType().is(tagKey) != bl); + } else { + ResourceLocation resourceLocation = ResourceLocation.read(entitySelectorParser.getReader()); + EntityType entityType = (EntityType)BuiltInRegistries.ENTITY_TYPE.getOptional(resourceLocation).orElseThrow(() -> { + entitySelectorParser.getReader().setCursor(i); + return ERROR_ENTITY_TYPE_INVALID.createWithContext(entitySelectorParser.getReader(), resourceLocation.toString()); + }); + if (Objects.equals(EntityType.PLAYER, entityType) && !bl) { + entitySelectorParser.setIncludesEntities(false); + } + + entitySelectorParser.addPredicate(entity -> Objects.equals(entityType, entity.getType()) != bl); + if (!bl) { + entitySelectorParser.limitToType(entityType); + } } } - } - }, entitySelectorParser -> !entitySelectorParser.isTypeLimited(), Component.translatable("argument.entity.options.type.description")); + }, + entitySelectorParser -> !entitySelectorParser.isTypeLimited(), + Component.translatable("argument.entity.options.type.description") + ); register("tag", entitySelectorParser -> { boolean bl = entitySelectorParser.shouldInvertValue(); String string = entitySelectorParser.getReader().readUnquotedString(); @@ -336,7 +346,7 @@ public class EntitySelectorOptions { }, entitySelectorParser -> true, Component.translatable("argument.entity.options.nbt.description")); register("scores", entitySelectorParser -> { StringReader stringReader = entitySelectorParser.getReader(); - Map map = Maps.newHashMap(); + Map map = Maps.newHashMap(); stringReader.expect('{'); stringReader.skipWhitespace(); @@ -346,7 +356,7 @@ public class EntitySelectorOptions { stringReader.skipWhitespace(); stringReader.expect('='); stringReader.skipWhitespace(); - MinMaxBounds.Ints ints = MinMaxBounds.Ints.fromReader(stringReader); + Ints ints = Ints.fromReader(stringReader); map.put(string, ints); stringReader.skipWhitespace(); if (stringReader.canRead() && stringReader.peek() == ',') { @@ -359,7 +369,7 @@ public class EntitySelectorOptions { entitySelectorParser.addPredicate(entity -> { Scoreboard scoreboard = entity.getServer().getScoreboard(); - for (Entry entry : map.entrySet()) { + for (Entry entry : map.entrySet()) { Objective objective = scoreboard.getObjective((String)entry.getKey()); if (objective == null) { return false; @@ -370,7 +380,7 @@ public class EntitySelectorOptions { return false; } - if (!((MinMaxBounds.Ints)entry.getValue()).matches(readOnlyScoreInfo.value())) { + if (!((Ints)entry.getValue()).matches(readOnlyScoreInfo.value())) { return false; } } @@ -472,11 +482,7 @@ public class EntitySelectorOptions { return false; } else { ServerLevel serverLevel = (ServerLevel)entity.level(); - Optional optional = serverLevel.getServer() - .reloadableRegistries() - .lookup() - .get(Registries.PREDICATE, resourceKey) - .map(Holder::value); + Optional optional = serverLevel.getServer().reloadableRegistries().lookup().get(resourceKey).map(Holder::value); if (optional.isEmpty()) { return false; } else { diff --git a/net/minecraft/commands/synchronization/SuggestionProviders.java b/net/minecraft/commands/synchronization/SuggestionProviders.java index 64e6bcfe..b2ec5c6d 100644 --- a/net/minecraft/commands/synchronization/SuggestionProviders.java +++ b/net/minecraft/commands/synchronization/SuggestionProviders.java @@ -22,10 +22,6 @@ public class SuggestionProviders { public static final SuggestionProvider ASK_SERVER = register( DEFAULT_NAME, (commandContext, suggestionsBuilder) -> commandContext.getSource().customSuggestion(commandContext) ); - public static final SuggestionProvider ALL_RECIPES = register( - ResourceLocation.withDefaultNamespace("all_recipes"), - (commandContext, suggestionsBuilder) -> SharedSuggestionProvider.suggestResource(commandContext.getSource().getRecipeNames(), suggestionsBuilder) - ); public static final SuggestionProvider AVAILABLE_SOUNDS = register( ResourceLocation.withDefaultNamespace("available_sounds"), (commandContext, suggestionsBuilder) -> SharedSuggestionProvider.suggestResource(commandContext.getSource().getAvailableSounds(), suggestionsBuilder) diff --git a/net/minecraft/core/BlockPos.java b/net/minecraft/core/BlockPos.java index f3238d2c..a707f628 100644 --- a/net/minecraft/core/BlockPos.java +++ b/net/minecraft/core/BlockPos.java @@ -51,15 +51,15 @@ public class BlockPos extends Vec3i { * An immutable BlockPos with zero as all coordinates. */ public static final BlockPos ZERO = new BlockPos(0, 0, 0); - private static final int PACKED_X_LENGTH = 1 + Mth.log2(Mth.smallestEncompassingPowerOfTwo(30000000)); - private static final int PACKED_Z_LENGTH = PACKED_X_LENGTH; - public static final int PACKED_Y_LENGTH = 64 - PACKED_X_LENGTH - PACKED_Z_LENGTH; - private static final long PACKED_X_MASK = (1L << PACKED_X_LENGTH) - 1L; + public static final int PACKED_HORIZONTAL_LENGTH = 1 + Mth.log2(Mth.smallestEncompassingPowerOfTwo(30000000)); + public static final int PACKED_Y_LENGTH = 64 - 2 * PACKED_HORIZONTAL_LENGTH; + private static final long PACKED_X_MASK = (1L << PACKED_HORIZONTAL_LENGTH) - 1L; private static final long PACKED_Y_MASK = (1L << PACKED_Y_LENGTH) - 1L; - private static final long PACKED_Z_MASK = (1L << PACKED_Z_LENGTH) - 1L; + private static final long PACKED_Z_MASK = (1L << PACKED_HORIZONTAL_LENGTH) - 1L; private static final int Y_OFFSET = 0; private static final int Z_OFFSET = PACKED_Y_LENGTH; - private static final int X_OFFSET = PACKED_Y_LENGTH + PACKED_Z_LENGTH; + private static final int X_OFFSET = PACKED_Y_LENGTH + PACKED_HORIZONTAL_LENGTH; + public static final int MAX_HORIZONTAL_COORDINATE = (1 << PACKED_HORIZONTAL_LENGTH) / 2 - 1; public BlockPos(int x, int y, int z) { super(x, y, z); @@ -78,7 +78,7 @@ public class BlockPos extends Vec3i { } public static int getX(long packedPos) { - return (int)(packedPos << 64 - X_OFFSET - PACKED_X_LENGTH >> 64 - PACKED_X_LENGTH); + return (int)(packedPos << 64 - X_OFFSET - PACKED_HORIZONTAL_LENGTH >> 64 - PACKED_HORIZONTAL_LENGTH); } public static int getY(long packedPos) { @@ -86,7 +86,7 @@ public class BlockPos extends Vec3i { } public static int getZ(long packedPos) { - return (int)(packedPos << 64 - Z_OFFSET - PACKED_Z_LENGTH >> 64 - PACKED_Z_LENGTH); + return (int)(packedPos << 64 - Z_OFFSET - PACKED_HORIZONTAL_LENGTH >> 64 - PACKED_HORIZONTAL_LENGTH); } public static BlockPos of(long packedPos) { @@ -395,6 +395,12 @@ public class BlockPos extends Vec3i { return StreamSupport.stream(withinManhattan(pos, xSize, ySize, zSize).spliterator(), false); } + public static Iterable betweenClosed(AABB aABB) { + BlockPos blockPos = containing(aABB.minX, aABB.minY, aABB.minZ); + BlockPos blockPos2 = containing(aABB.maxX, aABB.maxY, aABB.maxZ); + return betweenClosed(blockPos, blockPos2); + } + public static Iterable betweenClosed(BlockPos firstPos, BlockPos secondPos) { return betweenClosed( Math.min(firstPos.getX(), secondPos.getX()), diff --git a/net/minecraft/core/DefaultedMappedRegistry.java b/net/minecraft/core/DefaultedMappedRegistry.java index 613f437c..bd819851 100644 --- a/net/minecraft/core/DefaultedMappedRegistry.java +++ b/net/minecraft/core/DefaultedMappedRegistry.java @@ -42,14 +42,14 @@ public class DefaultedMappedRegistry extends MappedRegistry implements Def @NotNull @Override - public T get(@Nullable ResourceLocation name) { - T object = super.get(name); + public T getValue(@Nullable ResourceLocation resourceLocation) { + T object = super.getValue(resourceLocation); return object == null ? this.defaultValue.value() : object; } @Override public Optional getOptional(@Nullable ResourceLocation name) { - return Optional.ofNullable(super.get(name)); + return Optional.ofNullable(super.getValue(name)); } @Override diff --git a/net/minecraft/core/DefaultedRegistry.java b/net/minecraft/core/DefaultedRegistry.java index 0a25d541..dcad439d 100644 --- a/net/minecraft/core/DefaultedRegistry.java +++ b/net/minecraft/core/DefaultedRegistry.java @@ -11,7 +11,7 @@ public interface DefaultedRegistry extends Registry { @NotNull @Override - T get(@Nullable ResourceLocation name); + T getValue(@Nullable ResourceLocation resourceLocation); @NotNull @Override diff --git a/net/minecraft/core/Direction.java b/net/minecraft/core/Direction.java index 01e47df2..5be1b05d 100644 --- a/net/minecraft/core/Direction.java +++ b/net/minecraft/core/Direction.java @@ -19,8 +19,10 @@ import net.minecraft.util.ByIdMap; import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; import net.minecraft.util.StringRepresentable; +import net.minecraft.util.ByIdMap.OutOfBoundsStrategy; import net.minecraft.world.entity.Entity; import net.minecraft.world.phys.Vec3; +import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.Nullable; import org.joml.Matrix4f; import org.joml.Quaternionf; @@ -37,7 +39,7 @@ public enum Direction implements StringRepresentable { public static final StringRepresentable.EnumCodec CODEC = StringRepresentable.fromEnum(Direction::values); public static final Codec VERTICAL_CODEC = CODEC.validate(Direction::verifyVertical); - public static final IntFunction BY_ID = ByIdMap.continuous(Direction::get3DDataValue, values(), ByIdMap.OutOfBoundsStrategy.WRAP); + public static final IntFunction BY_ID = ByIdMap.continuous(Direction::get3DDataValue, values(), OutOfBoundsStrategy.WRAP); public static final StreamCodec STREAM_CODEC = ByteBufCodecs.idMapper(BY_ID, Direction::get3DDataValue); /** * Ordering index for D-U-N-S-W-E @@ -58,6 +60,7 @@ public enum Direction implements StringRepresentable { * Normalized vector that points in the direction of this Direction */ private final Vec3i normal; + private final Vec3 normalVec3; private static final Direction[] VALUES = values(); private static final Direction[] BY_3D_DATA = (Direction[])Arrays.stream(VALUES) .sorted(Comparator.comparingInt(direction -> direction.data3d)) @@ -86,6 +89,7 @@ public enum Direction implements StringRepresentable { this.axis = axis; this.axisDirection = axisDirection; this.normal = normal; + this.normalVec3 = Vec3.atLowerCornerOf(normal); } /** @@ -128,9 +132,9 @@ public enum Direction implements StringRepresentable { } public static Direction rotate(Matrix4f matrix, Direction direction) { - Vec3i vec3i = direction.getNormal(); + Vec3i vec3i = direction.getUnitVec3i(); Vector4f vector4f = matrix.transform(new Vector4f(vec3i.getX(), vec3i.getY(), vec3i.getZ(), 0.0F)); - return getNearest(vector4f.x(), vector4f.y(), vector4f.z()); + return getApproximateNearest(vector4f.x(), vector4f.y(), vector4f.z()); } public static Collection allShuffled(RandomSource random) { @@ -141,6 +145,16 @@ public enum Direction implements StringRepresentable { return Stream.of(VALUES); } + public static float getYRot(Direction direction) { + return switch (direction) { + case NORTH -> 180.0F; + case SOUTH -> 0.0F; + case WEST -> 90.0F; + case EAST -> -90.0F; + default -> throw new IllegalStateException("No y-Rot for vertical axis: " + direction); + }; + } + public Quaternionf getRotation() { return switch (this) { case DOWN -> new Quaternionf().rotationX((float) Math.PI); @@ -324,35 +338,6 @@ public enum Direction implements StringRepresentable { return BY_2D_DATA[Mth.abs(horizontalIndex % BY_2D_DATA.length)]; } - @Nullable - public static Direction fromDelta(int x, int y, int z) { - if (x == 0) { - if (y == 0) { - if (z > 0) { - return SOUTH; - } - - if (z < 0) { - return NORTH; - } - } else if (z == 0) { - if (y > 0) { - return UP; - } - - return DOWN; - } - } else if (y == 0 && z == 0) { - if (x > 0) { - return EAST; - } - - return WEST; - } - - return null; - } - /** * @return the Direction corresponding to the given angle in degrees (0-360). Out of bounds values are wrapped around. An angle of 0 is SOUTH, an angle of 90 would be WEST. */ @@ -380,18 +365,18 @@ public enum Direction implements StringRepresentable { return Util.getRandom(VALUES, random); } - public static Direction getNearest(double x, double y, double z) { - return getNearest((float)x, (float)y, (float)z); + public static Direction getApproximateNearest(double d, double e, double f) { + return getApproximateNearest((float)d, (float)e, (float)f); } - public static Direction getNearest(float x, float y, float z) { + public static Direction getApproximateNearest(float f, float g, float h) { Direction direction = NORTH; - float f = Float.MIN_VALUE; + float i = Float.MIN_VALUE; for (Direction direction2 : VALUES) { - float g = x * direction2.normal.getX() + y * direction2.normal.getY() + z * direction2.normal.getZ(); - if (g > f) { - f = g; + float j = f * direction2.normal.getX() + g * direction2.normal.getY() + h * direction2.normal.getZ(); + if (j > i) { + i = j; direction = direction2; } } @@ -399,8 +384,31 @@ public enum Direction implements StringRepresentable { return direction; } - public static Direction getNearest(Vec3 ois) { - return getNearest(ois.x, ois.y, ois.z); + public static Direction getApproximateNearest(Vec3 vec3) { + return getApproximateNearest(vec3.x, vec3.y, vec3.z); + } + + @Nullable + @Contract("_,_,_,!null->!null;_,_,_,_->_") + public static Direction getNearest(int i, int j, int k, @Nullable Direction direction) { + int l = Math.abs(i); + int m = Math.abs(j); + int n = Math.abs(k); + if (l > n && l > m) { + return i < 0 ? WEST : EAST; + } else if (n > l && n > m) { + return k < 0 ? NORTH : SOUTH; + } else if (m > l && m > n) { + return j < 0 ? DOWN : UP; + } else { + return direction; + } + } + + @Nullable + @Contract("_,!null->!null;_,_->_") + public static Direction getNearest(Vec3i vec3i, @Nullable Direction direction) { + return getNearest(vec3i.getX(), vec3i.getY(), vec3i.getZ(), direction); } public String toString() { @@ -426,13 +434,14 @@ public enum Direction implements StringRepresentable { throw new IllegalArgumentException("No such direction: " + axisDirection + " " + axis); } - /** - * @return the normalized Vector that points in the direction of this Direction. - */ - public Vec3i getNormal() { + public Vec3i getUnitVec3i() { return this.normal; } + public Vec3 getUnitVec3() { + return this.normalVec3; + } + public boolean isFacingAngle(float degrees) { float f = degrees * (float) (Math.PI / 180.0); float g = -Mth.sin(f); @@ -441,39 +450,9 @@ public enum Direction implements StringRepresentable { } public static enum Axis implements StringRepresentable, Predicate { - X("x") { - @Override - public int choose(int x, int y, int z) { - return x; - } - - @Override - public double choose(double x, double y, double z) { - return x; - } - }, - Y("y") { - @Override - public int choose(int x, int y, int z) { - return y; - } - - @Override - public double choose(double x, double y, double z) { - return y; - } - }, - Z("z") { - @Override - public int choose(int x, int y, int z) { - return z; - } - - @Override - public double choose(double x, double y, double z) { - return z; - } - }; + X("X", 0, "x"), + Y("Y", 1, "y"), + Z("Z", 2, "z"); public static final Direction.Axis[] VALUES = values(); public static final StringRepresentable.EnumCodec CODEC = StringRepresentable.fromEnum(Direction.Axis::values); @@ -506,6 +485,14 @@ public enum Direction implements StringRepresentable { return this == X || this == Z; } + public abstract Direction getPositive(); + + public abstract Direction getNegative(); + + public Direction[] getDirections() { + return new Direction[]{this.getPositive(), this.getNegative()}; + } + public String toString() { return this.name; } diff --git a/net/minecraft/core/FrontAndTop.java b/net/minecraft/core/FrontAndTop.java index 5b28fcb5..97f6b6e6 100644 --- a/net/minecraft/core/FrontAndTop.java +++ b/net/minecraft/core/FrontAndTop.java @@ -1,7 +1,5 @@ package net.minecraft.core; -import it.unimi.dsi.fastutil.ints.Int2ObjectMap; -import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; import net.minecraft.Util; import net.minecraft.util.StringRepresentable; @@ -19,9 +17,10 @@ public enum FrontAndTop implements StringRepresentable { NORTH_UP("north_up", Direction.NORTH, Direction.UP), SOUTH_UP("south_up", Direction.SOUTH, Direction.UP); - private static final Int2ObjectMap LOOKUP_TOP_FRONT = Util.make(new Int2ObjectOpenHashMap<>(values().length), int2ObjectOpenHashMap -> { + private static final int NUM_DIRECTIONS = Direction.values().length; + private static final FrontAndTop[] BY_TOP_FRONT = Util.make(new FrontAndTop[NUM_DIRECTIONS * NUM_DIRECTIONS], frontAndTops -> { for (FrontAndTop frontAndTop : values()) { - int2ObjectOpenHashMap.put(lookupKey(frontAndTop.front, frontAndTop.top), frontAndTop); + frontAndTops[lookupKey(frontAndTop.front, frontAndTop.top)] = frontAndTop; } }); private final String name; @@ -29,7 +28,7 @@ public enum FrontAndTop implements StringRepresentable { private final Direction front; private static int lookupKey(Direction front, Direction top) { - return top.ordinal() << 3 | front.ordinal(); + return front.ordinal() * NUM_DIRECTIONS + top.ordinal(); } private FrontAndTop(final String name, final Direction front, final Direction top) { @@ -44,8 +43,7 @@ public enum FrontAndTop implements StringRepresentable { } public static FrontAndTop fromFrontAndTop(Direction front, Direction top) { - int i = lookupKey(front, top); - return LOOKUP_TOP_FRONT.get(i); + return BY_TOP_FRONT[lookupKey(front, top)]; } public Direction front() { diff --git a/net/minecraft/core/GlobalPos.java b/net/minecraft/core/GlobalPos.java index af8a48e1..e40e7d68 100644 --- a/net/minecraft/core/GlobalPos.java +++ b/net/minecraft/core/GlobalPos.java @@ -28,4 +28,8 @@ public record GlobalPos(ResourceKey dimension, BlockPos pos) { public String toString() { return this.dimension + " " + this.pos; } + + public boolean isCloseEnough(ResourceKey resourceKey, BlockPos blockPos, int i) { + return this.dimension.equals(resourceKey) && this.pos.distChessboard(blockPos) <= i; + } } diff --git a/net/minecraft/core/Holder.java b/net/minecraft/core/Holder.java index 0f7f6038..178c4906 100644 --- a/net/minecraft/core/Holder.java +++ b/net/minecraft/core/Holder.java @@ -6,6 +6,7 @@ import java.util.Optional; import java.util.Set; import java.util.function.Predicate; import java.util.stream.Stream; +import net.minecraft.core.Holder.Reference.Type; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.TagKey; @@ -113,14 +114,15 @@ public interface Holder { public static class Reference implements Holder { private final HolderOwner owner; - private Set> tags = Set.of(); - private final Holder.Reference.Type type; + @Nullable + private Set> tags; + private final Type type; @Nullable private ResourceKey key; @Nullable private T value; - protected Reference(Holder.Reference.Type type, HolderOwner owner, @Nullable ResourceKey key, @Nullable T value) { + protected Reference(Type type, HolderOwner owner, @Nullable ResourceKey key, @Nullable T value) { this.owner = owner; this.type = type; this.key = key; @@ -128,12 +130,12 @@ public interface Holder { } public static Holder.Reference createStandAlone(HolderOwner owner, ResourceKey key) { - return new Holder.Reference<>(Holder.Reference.Type.STAND_ALONE, owner, key, null); + return new Holder.Reference<>(Type.STAND_ALONE, owner, key, null); } @Deprecated public static Holder.Reference createIntrusive(HolderOwner owner, @Nullable T value) { - return new Holder.Reference<>(Holder.Reference.Type.INTRUSIVE, owner, null, value); + return new Holder.Reference<>(Type.INTRUSIVE, owner, null, value); } public ResourceKey key() { @@ -163,9 +165,17 @@ public interface Holder { return this.key() == resourceKey; } + private Set> boundTags() { + if (this.tags == null) { + throw new IllegalStateException("Tags not bound"); + } else { + return this.tags; + } + } + @Override public boolean is(TagKey tagKey) { - return this.tags.contains(tagKey); + return this.boundTags().contains(tagKey); } @Override @@ -212,7 +222,7 @@ public interface Holder { } protected void bindValue(T value) { - if (this.type == Holder.Reference.Type.INTRUSIVE && this.value != value) { + if (this.type == Type.INTRUSIVE && this.value != value) { throw new IllegalStateException("Can't change holder " + this.key + " value: existing=" + this.value + ", new=" + value); } else { this.value = value; @@ -225,16 +235,11 @@ public interface Holder { @Override public Stream> tags() { - return this.tags.stream(); + return this.boundTags().stream(); } public String toString() { return "Reference{" + this.key + "=" + this.value + "}"; } - - protected static enum Type { - STAND_ALONE, - INTRUSIVE; - } } } diff --git a/net/minecraft/core/HolderGetter.java b/net/minecraft/core/HolderGetter.java index 65a72feb..215fcca4 100644 --- a/net/minecraft/core/HolderGetter.java +++ b/net/minecraft/core/HolderGetter.java @@ -18,14 +18,14 @@ public interface HolderGetter { } public interface Provider { - Optional> lookup(ResourceKey> registryKey); + Optional> lookup(ResourceKey> registryKey); default HolderGetter lookupOrThrow(ResourceKey> registryKey) { return (HolderGetter)this.lookup(registryKey).orElseThrow(() -> new IllegalStateException("Registry " + registryKey.location() + " not found")); } - default Optional> get(ResourceKey> registryKey, ResourceKey key) { - return this.lookup(registryKey).flatMap(holderGetter -> holderGetter.get(key)); + default Optional> get(ResourceKey resourceKey) { + return this.lookup(resourceKey.registryKey()).flatMap(holderGetter -> holderGetter.get(resourceKey)); } } } diff --git a/net/minecraft/core/HolderLookup.java b/net/minecraft/core/HolderLookup.java index 60b41529..724628b7 100644 --- a/net/minecraft/core/HolderLookup.java +++ b/net/minecraft/core/HolderLookup.java @@ -7,6 +7,7 @@ import java.util.Optional; import java.util.function.Predicate; import java.util.stream.Collectors; import java.util.stream.Stream; +import net.minecraft.core.HolderLookup.Provider.1; import net.minecraft.resources.RegistryOps; import net.minecraft.resources.ResourceKey; import net.minecraft.tags.TagKey; @@ -26,10 +27,15 @@ public interface HolderLookup extends HolderGetter { return this.listTags().map(HolderSet.Named::key); } - public interface Provider { - Stream>> listRegistries(); + public interface Provider extends HolderGetter.Provider { + Stream>> listRegistryKeys(); - Optional> lookup(ResourceKey> registryKey); + default Stream> listRegistries() { + return this.listRegistryKeys().map(this::lookupOrThrow); + } + + @Override + Optional> lookup(ResourceKey> registryKey); default HolderLookup.RegistryLookup lookupOrThrow(ResourceKey> registryKey) { return (HolderLookup.RegistryLookup)this.lookup(registryKey) @@ -40,30 +46,15 @@ public interface HolderLookup extends HolderGetter { return RegistryOps.create(ops, this); } - default HolderGetter.Provider asGetterLookup() { - return new HolderGetter.Provider() { - @Override - public Optional> lookup(ResourceKey> registryKey) { - return Provider.this.lookup(registryKey).map(registryLookup -> registryLookup); - } - }; - } - static HolderLookup.Provider create(Stream> lookupStream) { - final Map>, HolderLookup.RegistryLookup> map = (Map>, HolderLookup.RegistryLookup>)lookupStream.collect( + Map>, HolderLookup.RegistryLookup> map = (Map>, HolderLookup.RegistryLookup>)lookupStream.collect( Collectors.toUnmodifiableMap(HolderLookup.RegistryLookup::key, registryLookup -> registryLookup) ); - return new HolderLookup.Provider() { - @Override - public Stream>> listRegistries() { - return map.keySet().stream(); - } + return new 1(map); + } - @Override - public Optional> lookup(ResourceKey> registryKey) { - return Optional.ofNullable((HolderLookup.RegistryLookup)map.get(registryKey)); - } - }; + default Lifecycle allRegistriesLifecycle() { + return (Lifecycle)this.listRegistries().map(HolderLookup.RegistryLookup::registryLifecycle).reduce(Lifecycle.stable(), Lifecycle::add); } } @@ -77,56 +68,7 @@ public interface HolderLookup extends HolderGetter { } default HolderLookup.RegistryLookup filterElements(Predicate predicate) { - return new HolderLookup.RegistryLookup.Delegate() { - @Override - public HolderLookup.RegistryLookup parent() { - return RegistryLookup.this; - } - - @Override - public Optional> get(ResourceKey resourceKey) { - return this.parent().get(resourceKey).filter(reference -> predicate.test(reference.value())); - } - - @Override - public Stream> listElements() { - return this.parent().listElements().filter(reference -> predicate.test(reference.value())); - } - }; - } - - public interface Delegate extends HolderLookup.RegistryLookup { - HolderLookup.RegistryLookup parent(); - - @Override - default ResourceKey> key() { - return this.parent().key(); - } - - @Override - default Lifecycle registryLifecycle() { - return this.parent().registryLifecycle(); - } - - @Override - default Optional> get(ResourceKey resourceKey) { - return this.parent().get(resourceKey); - } - - @Override - default Stream> listElements() { - return this.parent().listElements(); - } - - @Override - default Optional> get(TagKey tagKey) { - return this.parent().get(tagKey); - } - - @Override - default Stream> listTags() { - return this.parent().listTags(); - } + return new net.minecraft.core.HolderLookup.RegistryLookup.1(this, predicate); } } } diff --git a/net/minecraft/core/HolderSet.java b/net/minecraft/core/HolderSet.java index 4ced2346..f05e0834 100644 --- a/net/minecraft/core/HolderSet.java +++ b/net/minecraft/core/HolderSet.java @@ -20,6 +20,8 @@ public interface HolderSet extends Iterable> { int size(); + boolean isBound(); + Either, List>> unwrap(); Optional> getRandomElement(RandomSource random); @@ -80,6 +82,11 @@ public interface HolderSet extends Iterable> { return this.contents; } + @Override + public boolean isBound() { + return true; + } + @Override public Either, List>> unwrap() { return Either.right(this.contents); @@ -152,7 +159,8 @@ public interface HolderSet extends Iterable> { public static class Named extends HolderSet.ListBacked { private final HolderOwner owner; private final TagKey key; - private List> contents = List.of(); + @Nullable + private List> contents; Named(HolderOwner owner, TagKey key) { this.owner = owner; @@ -169,7 +177,16 @@ public interface HolderSet extends Iterable> { @Override protected List> contents() { - return this.contents; + if (this.contents == null) { + throw new IllegalStateException("Trying to access unbound tag '" + this.key + "' from registry " + this.owner); + } else { + return this.contents; + } + } + + @Override + public boolean isBound() { + return this.contents != null; } @Override diff --git a/net/minecraft/core/MappedRegistry.java b/net/minecraft/core/MappedRegistry.java index 40aff52d..51735b84 100644 --- a/net/minecraft/core/MappedRegistry.java +++ b/net/minecraft/core/MappedRegistry.java @@ -1,10 +1,9 @@ package net.minecraft.core; +import com.google.common.collect.ImmutableMap; import com.google.common.collect.Iterators; import com.google.common.collect.Maps; -import com.google.common.collect.Sets; -import com.mojang.datafixers.util.Pair; -import com.mojang.logging.LogUtils; +import com.google.common.collect.ImmutableMap.Builder; import com.mojang.serialization.Lifecycle; import it.unimi.dsi.fastutil.objects.ObjectArrayList; import it.unimi.dsi.fastutil.objects.ObjectList; @@ -21,19 +20,21 @@ import java.util.Objects; import java.util.Optional; import java.util.Set; import java.util.Map.Entry; -import java.util.stream.Collectors; +import java.util.function.BiConsumer; import java.util.stream.Stream; import net.minecraft.Util; +import net.minecraft.core.HolderLookup.RegistryLookup.Delegate; +import net.minecraft.core.MappedRegistry.TagSet.1; +import net.minecraft.core.MappedRegistry.TagSet.2; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.TagKey; +import net.minecraft.tags.TagLoader; import net.minecraft.util.RandomSource; import org.jetbrains.annotations.Nullable; -import org.slf4j.Logger; public class MappedRegistry implements WritableRegistry { - private static final Logger LOGGER = LogUtils.getLogger(); - final ResourceKey> key; + private final ResourceKey> key; private final ObjectList> byId = new ObjectArrayList<>(256); private final Reference2IntMap toId = Util.make( new Reference2IntOpenHashMap<>(), reference2IntOpenHashMap -> reference2IntOpenHashMap.defaultReturnValue(-1) @@ -43,42 +44,16 @@ public class MappedRegistry implements WritableRegistry { private final Map> byValue = new IdentityHashMap(); private final Map, RegistrationInfo> registrationInfos = new IdentityHashMap(); private Lifecycle registryLifecycle; - private volatile Map, HolderSet.Named> tags = new IdentityHashMap(); + private final Map, HolderSet.Named> frozenTags = new IdentityHashMap(); + MappedRegistry.TagSet allTags = MappedRegistry.TagSet.unbound(); private boolean frozen; @Nullable private Map> unregisteredIntrusiveHolders; - private final HolderLookup.RegistryLookup lookup = new HolderLookup.RegistryLookup() { - @Override - public ResourceKey> key() { - return MappedRegistry.this.key; - } - @Override - public Lifecycle registryLifecycle() { - return MappedRegistry.this.registryLifecycle(); - } - - @Override - public Optional> get(ResourceKey resourceKey) { - return MappedRegistry.this.getHolder(resourceKey); - } - - @Override - public Stream> listElements() { - return MappedRegistry.this.holders(); - } - - @Override - public Optional> get(TagKey tagKey) { - return MappedRegistry.this.getTag(tagKey); - } - - @Override - public Stream> listTags() { - return MappedRegistry.this.getTags().map(Pair::getSecond); - } - }; - private final Object tagAdditionLock = new Object(); + @Override + public Stream> listTags() { + return this.getTags(); + } public MappedRegistry(ResourceKey> key, Lifecycle registryLifecycle) { this(key, registryLifecycle, false); @@ -119,34 +94,32 @@ public class MappedRegistry implements WritableRegistry { Objects.requireNonNull(key); Objects.requireNonNull(value); if (this.byLocation.containsKey(key.location())) { - Util.pauseInIde((T)(new IllegalStateException("Adding duplicate key '" + key + "' to registry"))); - } + throw (IllegalStateException)Util.pauseInIde((T)(new IllegalStateException("Adding duplicate key '" + key + "' to registry"))); + } else if (this.byValue.containsKey(value)) { + throw (IllegalStateException)Util.pauseInIde((T)(new IllegalStateException("Adding duplicate value '" + value + "' to registry"))); + } else { + Holder.Reference reference; + if (this.unregisteredIntrusiveHolders != null) { + reference = (Holder.Reference)this.unregisteredIntrusiveHolders.remove(value); + if (reference == null) { + throw new AssertionError("Missing intrusive holder for " + key + ":" + value); + } - if (this.byValue.containsKey(value)) { - Util.pauseInIde((T)(new IllegalStateException("Adding duplicate value '" + value + "' to registry"))); - } - - Holder.Reference reference; - if (this.unregisteredIntrusiveHolders != null) { - reference = (Holder.Reference)this.unregisteredIntrusiveHolders.remove(value); - if (reference == null) { - throw new AssertionError("Missing intrusive holder for " + key + ":" + value); + reference.bindKey(key); + } else { + reference = (Holder.Reference)this.byKey.computeIfAbsent(key, resourceKey -> Holder.Reference.createStandAlone(this, resourceKey)); } - reference.bindKey(key); - } else { - reference = (Holder.Reference)this.byKey.computeIfAbsent(key, resourceKey -> Holder.Reference.createStandAlone(this.holderOwner(), resourceKey)); + this.byKey.put(key, reference); + this.byLocation.put(key.location(), reference); + this.byValue.put(value, reference); + int i = this.byId.size(); + this.byId.add(reference); + this.toId.put(value, i); + this.registrationInfos.put(key, registrationInfo); + this.registryLifecycle = this.registryLifecycle.add(registrationInfo.lifecycle()); + return reference; } - - this.byKey.put(key, reference); - this.byLocation.put(key.location(), reference); - this.byValue.put(value, reference); - int i = this.byId.size(); - this.byId.add(reference); - this.toId.put(value, i); - this.registrationInfos.put(key, registrationInfo); - this.registryLifecycle = this.registryLifecycle.add(registrationInfo.lifecycle()); - return reference; } @Nullable @@ -168,8 +141,8 @@ public class MappedRegistry implements WritableRegistry { @Nullable @Override - public T get(@Nullable ResourceKey key) { - return getValueFromNullable((Holder.Reference)this.byKey.get(key)); + public T getValue(@Nullable ResourceKey resourceKey) { + return getValueFromNullable((Holder.Reference)this.byKey.get(resourceKey)); } @Nullable @@ -179,18 +152,18 @@ public class MappedRegistry implements WritableRegistry { } @Override - public Optional> getHolder(int id) { - return id >= 0 && id < this.byId.size() ? Optional.ofNullable((Holder.Reference)this.byId.get(id)) : Optional.empty(); + public Optional> get(int i) { + return i >= 0 && i < this.byId.size() ? Optional.ofNullable((Holder.Reference)this.byId.get(i)) : Optional.empty(); } @Override - public Optional> getHolder(ResourceLocation location) { - return Optional.ofNullable((Holder.Reference)this.byLocation.get(location)); + public Optional> get(ResourceLocation resourceLocation) { + return Optional.ofNullable((Holder.Reference)this.byLocation.get(resourceLocation)); } @Override - public Optional> getHolder(ResourceKey key) { - return Optional.ofNullable((Holder.Reference)this.byKey.get(key)); + public Optional> get(ResourceKey resourceKey) { + return Optional.ofNullable((Holder.Reference)this.byKey.get(resourceKey)); } @Override @@ -210,7 +183,7 @@ public class MappedRegistry implements WritableRegistry { throw new IllegalStateException("This registry can't create new holders without value"); } else { this.validateWrite(resourceKey); - return Holder.Reference.createStandAlone(this.holderOwner(), resourceKey); + return Holder.Reference.createStandAlone(this, resourceKey); } }); } @@ -236,8 +209,8 @@ public class MappedRegistry implements WritableRegistry { @Nullable @Override - public T get(@Nullable ResourceLocation name) { - Holder.Reference reference = (Holder.Reference)this.byLocation.get(name); + public T getValue(@Nullable ResourceLocation resourceLocation) { + Holder.Reference reference = (Holder.Reference)this.byLocation.get(resourceLocation); return getValueFromNullable(reference); } @@ -262,43 +235,21 @@ public class MappedRegistry implements WritableRegistry { } @Override - public Stream> holders() { + public Stream> listElements() { return this.byId.stream(); } @Override - public Stream, HolderSet.Named>> getTags() { - return this.tags.entrySet().stream().map(entry -> Pair.of((TagKey)entry.getKey(), (HolderSet.Named)entry.getValue())); + public Stream> getTags() { + return this.allTags.getTags(); } - @Override - public HolderSet.Named getOrCreateTag(TagKey key) { - HolderSet.Named named = (HolderSet.Named)this.tags.get(key); - if (named != null) { - return named; - } else { - synchronized (this.tagAdditionLock) { - named = (HolderSet.Named)this.tags.get(key); - if (named != null) { - return named; - } else { - named = this.createTag(key); - Map, HolderSet.Named> map = new IdentityHashMap(this.tags); - map.put(key, named); - this.tags = map; - return named; - } - } - } + HolderSet.Named getOrCreateTagForRegistration(TagKey tagKey) { + return (HolderSet.Named)this.frozenTags.computeIfAbsent(tagKey, this::createTag); } private HolderSet.Named createTag(TagKey key) { - return new HolderSet.Named<>(this.holderOwner(), key); - } - - @Override - public Stream> getTagNames() { - return this.tags.keySet().stream(); + return new HolderSet.Named<>(this, key); } @Override @@ -346,7 +297,24 @@ public class MappedRegistry implements WritableRegistry { this.unregisteredIntrusiveHolders = null; } - return this; + if (this.allTags.isBound()) { + throw new IllegalStateException("Tags already present before freezing"); + } else { + List list2 = this.frozenTags + .entrySet() + .stream() + .filter(entry -> !((HolderSet.Named)entry.getValue()).isBound()) + .map(entry -> ((TagKey)entry.getKey()).location()) + .sorted() + .toList(); + if (!list2.isEmpty()) { + throw new IllegalStateException("Unbound tags in registry " + this.key() + ": " + list2); + } else { + this.allTags = MappedRegistry.TagSet.fromMap(this.frozenTags); + this.refreshTagsInHolders(); + return this; + } + } } } } @@ -357,53 +325,46 @@ public class MappedRegistry implements WritableRegistry { throw new IllegalStateException("This registry can't create intrusive holders"); } else { this.validateWrite(); - return (Holder.Reference)this.unregisteredIntrusiveHolders.computeIfAbsent(value, object -> Holder.Reference.createIntrusive(this.asLookup(), (T)object)); + return (Holder.Reference)this.unregisteredIntrusiveHolders.computeIfAbsent(value, object -> Holder.Reference.createIntrusive(this, (T)object)); } } @Override - public Optional> getTag(TagKey key) { - return Optional.ofNullable((HolderSet.Named)this.tags.get(key)); + public Optional> get(TagKey tagKey) { + return this.allTags.get(tagKey); + } + + private Holder.Reference validateAndUnwrapTagElement(TagKey tagKey, Holder holder) { + if (!holder.canSerializeIn(this)) { + throw new IllegalStateException("Can't create named set " + tagKey + " containing value " + holder + " from outside registry " + this); + } else if (holder instanceof Holder.Reference reference) { + return reference; + } else { + throw new IllegalStateException("Found direct holder " + holder + " value in tag " + tagKey); + } } @Override - public void bindTags(Map, List>> tagMap) { + public void bindTag(TagKey tagKey, List> list) { + this.validateWrite(); + this.getOrCreateTagForRegistration(tagKey).bind(list); + } + + void refreshTagsInHolders() { Map, List>> map = new IdentityHashMap(); this.byKey.values().forEach(reference -> map.put(reference, new ArrayList())); - tagMap.forEach((tagKey, list) -> { - for (Holder holder : list) { - if (!holder.canSerializeIn(this.asLookup())) { - throw new IllegalStateException("Can't create named set " + tagKey + " containing value " + holder + " from outside registry " + this); - } - - if (!(holder instanceof Holder.Reference reference)) { - throw new IllegalStateException("Found direct holder " + holder + " value in tag " + tagKey); - } - + this.allTags.forEach((tagKey, named) -> { + for (Holder holder : named) { + Holder.Reference reference = this.validateAndUnwrapTagElement(tagKey, holder); ((List)map.get(reference)).add(tagKey); } }); - Set> set = Sets.>difference(this.tags.keySet(), tagMap.keySet()); - if (!set.isEmpty()) { - LOGGER.warn( - "Not all defined tags for registry {} are present in data pack: {}", - this.key(), - set.stream().map(tagKey -> tagKey.location().toString()).sorted().collect(Collectors.joining(", ")) - ); - } - - synchronized (this.tagAdditionLock) { - Map, HolderSet.Named> map2 = new IdentityHashMap(this.tags); - tagMap.forEach((tagKey, list) -> ((HolderSet.Named)map2.computeIfAbsent(tagKey, this::createTag)).bind(list)); - map.forEach(Holder.Reference::bindTags); - this.tags = map2; - } + map.forEach(Holder.Reference::bindTags); } - @Override - public void resetTags() { - this.tags.values().forEach(named -> named.bind(List.of())); - this.byKey.values().forEach(reference -> reference.bindTags(Set.of())); + public void bindAllTagsToEmpty() { + this.validateWrite(); + this.frozenTags.values().forEach(named -> named.bind(List.of())); } @Override @@ -427,18 +388,85 @@ public class MappedRegistry implements WritableRegistry { @Override public HolderSet.Named getOrThrow(TagKey tagKey) { - return MappedRegistry.this.getOrCreateTag(tagKey); + return MappedRegistry.this.getOrCreateTagForRegistration(tagKey); } }; } @Override - public HolderOwner holderOwner() { - return this.lookup; + public Registry.PendingTags prepareTagReload(TagLoader.LoadResult loadResult) { + if (!this.frozen) { + throw new IllegalStateException("Invalid method used for tag loading"); + } else { + Builder, HolderSet.Named> builder = ImmutableMap.builder(); + final Map, List>> map = new HashMap(); + loadResult.tags().forEach((tagKey, list) -> { + HolderSet.Named named = (HolderSet.Named)this.frozenTags.get(tagKey); + if (named == null) { + named = this.createTag(tagKey); + } + + builder.put(tagKey, named); + map.put(tagKey, List.copyOf(list)); + }); + final ImmutableMap, HolderSet.Named> immutableMap = builder.build(); + final HolderLookup.RegistryLookup registryLookup = new Delegate() { + public HolderLookup.RegistryLookup parent() { + return MappedRegistry.this; + } + + public Optional> get(TagKey tagKey) { + return Optional.ofNullable(immutableMap.get(tagKey)); + } + + public Stream> listTags() { + return immutableMap.values().stream(); + } + }; + return new Registry.PendingTags() { + @Override + public ResourceKey> key() { + return MappedRegistry.this.key(); + } + + @Override + public int size() { + return map.size(); + } + + @Override + public HolderLookup.RegistryLookup lookup() { + return registryLookup; + } + + @Override + public void apply() { + immutableMap.forEach((tagKey, named) -> { + List> list = (List>)map.getOrDefault(tagKey, List.of()); + named.bind(list); + }); + MappedRegistry.this.allTags = MappedRegistry.TagSet.fromMap(immutableMap); + MappedRegistry.this.refreshTagsInHolders(); + } + }; + } } - @Override - public HolderLookup.RegistryLookup asLookup() { - return this.lookup; + interface TagSet { + static MappedRegistry.TagSet unbound() { + return new 1(); + } + + static MappedRegistry.TagSet fromMap(Map, HolderSet.Named> map) { + return new 2(map); + } + + boolean isBound(); + + Optional> get(TagKey tagKey); + + void forEach(BiConsumer, ? super HolderSet.Named> biConsumer); + + Stream> getTags(); } } diff --git a/net/minecraft/core/Registry.java b/net/minecraft/core/Registry.java index c26c3da7..4e06ca5d 100644 --- a/net/minecraft/core/Registry.java +++ b/net/minecraft/core/Registry.java @@ -1,7 +1,6 @@ package net.minecraft.core; import com.mojang.datafixers.DataFixUtils; -import com.mojang.datafixers.util.Pair; import com.mojang.serialization.Codec; import com.mojang.serialization.DataResult; import com.mojang.serialization.DynamicOps; @@ -9,7 +8,6 @@ import com.mojang.serialization.Keyable; import com.mojang.serialization.Lifecycle; import java.util.Iterator; import java.util.List; -import java.util.Map; import java.util.Optional; import java.util.Set; import java.util.Map.Entry; @@ -18,11 +16,13 @@ import java.util.stream.StreamSupport; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.TagKey; +import net.minecraft.tags.TagLoader; import net.minecraft.util.ExtraCodecs; import net.minecraft.util.RandomSource; import org.jetbrains.annotations.Nullable; -public interface Registry extends Keyable, IdMap { +public interface Registry extends Keyable, HolderLookup.RegistryLookup, IdMap { + @Override ResourceKey> key(); default Codec byNameCodec() { @@ -36,7 +36,7 @@ public interface Registry extends Keyable, IdMap { private Codec> referenceHolderWithLifecycle() { Codec> codec = ResourceLocation.CODEC .comapFlatMap( - resourceLocation -> (DataResult)this.getHolder(resourceLocation) + resourceLocation -> (DataResult)this.get(resourceLocation) .map(DataResult::success) .orElseGet(() -> DataResult.error(() -> "Unknown registry key in " + this.key() + ": " + resourceLocation)), reference -> reference.key().location() @@ -69,29 +69,27 @@ public interface Registry extends Keyable, IdMap { int getId(@Nullable T value); @Nullable - T get(@Nullable ResourceKey key); + T getValue(@Nullable ResourceKey resourceKey); @Nullable - T get(@Nullable ResourceLocation name); + T getValue(@Nullable ResourceLocation resourceLocation); Optional registrationInfo(ResourceKey key); - Lifecycle registryLifecycle(); - default Optional getOptional(@Nullable ResourceLocation name) { - return Optional.ofNullable(this.get(name)); + return Optional.ofNullable(this.getValue(name)); } default Optional getOptional(@Nullable ResourceKey registryKey) { - return Optional.ofNullable(this.get(registryKey)); + return Optional.ofNullable(this.getValue(registryKey)); } Optional> getAny(); - default T getOrThrow(ResourceKey key) { - T object = this.get(key); + default T getValueOrThrow(ResourceKey resourceKey) { + T object = this.getValue(resourceKey); if (object == null) { - throw new IllegalStateException("Missing key in " + this.key() + ": " + key); + throw new IllegalStateException("Missing key in " + this.key() + ": " + resourceKey); } else { return object; } @@ -141,39 +139,21 @@ public interface Registry extends Keyable, IdMap { Holder.Reference createIntrusiveHolder(T value); - Optional> getHolder(int id); + Optional> get(int i); - Optional> getHolder(ResourceLocation location); - - Optional> getHolder(ResourceKey key); + Optional> get(ResourceLocation resourceLocation); Holder wrapAsHolder(T value); - default Holder.Reference getHolderOrThrow(ResourceKey key) { - return (Holder.Reference)this.getHolder(key).orElseThrow(() -> new IllegalStateException("Missing key in " + this.key() + ": " + key)); - } - - Stream> holders(); - - Optional> getTag(TagKey key); - default Iterable> getTagOrEmpty(TagKey key) { - return DataFixUtils.orElse(this.getTag(key), List.of()); + return DataFixUtils.orElse(this.get(key), List.of()); } default Optional> getRandomElementOf(TagKey key, RandomSource random) { - return this.getTag(key).flatMap(named -> named.getRandomElement(random)); + return this.get(key).flatMap(named -> named.getRandomElement(random)); } - HolderSet.Named getOrCreateTag(TagKey key); - - Stream, HolderSet.Named>> getTags(); - - Stream> getTagNames(); - - void resetTags(); - - void bindTags(Map, List>> tagMap); + Stream> getTags(); default IdMap> asHolderIdMap() { return new IdMap>() { @@ -186,7 +166,7 @@ public interface Registry extends Keyable, IdMap { @Nullable public Holder byId(int id) { - return (Holder)Registry.this.getHolder(id).orElse(null); + return (Holder)Registry.this.get(id).orElse(null); } @Override @@ -195,31 +175,20 @@ public interface Registry extends Keyable, IdMap { } public Iterator> iterator() { - return Registry.this.holders().map(reference -> reference).iterator(); + return Registry.this.listElements().map(reference -> reference).iterator(); } }; } - HolderOwner holderOwner(); + Registry.PendingTags prepareTagReload(TagLoader.LoadResult loadResult); - HolderLookup.RegistryLookup asLookup(); + public interface PendingTags { + ResourceKey> key(); - default HolderLookup.RegistryLookup asTagAddingLookup() { - return new HolderLookup.RegistryLookup.Delegate() { - @Override - public HolderLookup.RegistryLookup parent() { - return Registry.this.asLookup(); - } + HolderLookup.RegistryLookup lookup(); - @Override - public Optional> get(TagKey tagKey) { - return Optional.of(this.getOrThrow(tagKey)); - } + void apply(); - @Override - public HolderSet.Named getOrThrow(TagKey tagKey) { - return Registry.this.getOrCreateTag(tagKey); - } - }; + int size(); } } diff --git a/net/minecraft/core/RegistryAccess.java b/net/minecraft/core/RegistryAccess.java index b8035ac3..4ae4fb15 100644 --- a/net/minecraft/core/RegistryAccess.java +++ b/net/minecraft/core/RegistryAccess.java @@ -2,7 +2,6 @@ package net.minecraft.core; import com.google.common.collect.ImmutableMap; import com.mojang.logging.LogUtils; -import com.mojang.serialization.Lifecycle; import java.util.List; import java.util.Map; import java.util.Optional; @@ -19,35 +18,24 @@ public interface RegistryAccess extends HolderLookup.Provider { Logger LOGGER = LogUtils.getLogger(); RegistryAccess.Frozen EMPTY = new RegistryAccess.ImmutableRegistryAccess(Map.of()).freeze(); - /** - * Get the registry owned by this registry access by the given key. If it doesn't exist, the default registry of registries is queried instead, which contains static registries such as blocks. - * The returned registry can not guarantee that it is writable here, so the return type is widened to {@code Registry} instead. - */ - Optional> registry(ResourceKey> registryKey); - @Override - default Optional> lookup(ResourceKey> registryKey) { - return this.registry(registryKey).map(Registry::asLookup); - } + Optional> lookup(ResourceKey> registryKey); - /** - * A variant of {@link #registry(ResourceKey)} that throws if the registry does not exist. - */ - default Registry registryOrThrow(ResourceKey> registryKey) { - return (Registry)this.registry(registryKey).orElseThrow(() -> new IllegalStateException("Missing registry: " + registryKey)); + default Registry lookupOrThrow(ResourceKey> resourceKey) { + return (Registry)this.lookup(resourceKey).orElseThrow(() -> new IllegalStateException("Missing registry: " + resourceKey)); } Stream> registries(); @Override - default Stream>> listRegistries() { - return this.registries().map(RegistryAccess.RegistryEntry::key); + default Stream>> listRegistryKeys() { + return this.registries().map(registryEntry -> registryEntry.key); } static RegistryAccess.Frozen fromRegistryOfRegistries(Registry> registryOfRegistries) { return new RegistryAccess.Frozen() { @Override - public Optional> registry(ResourceKey> registryKey) { + public Optional> lookup(ResourceKey> registryKey) { Registry> registry = (Registry>)registryOfRegistries; return registry.getOptional((ResourceKey>)registryKey); } @@ -74,10 +62,6 @@ public interface RegistryAccess extends HolderLookup.Provider { return new FrozenAccess(this.registries().map(RegistryAccess.RegistryEntry::freeze)); } - default Lifecycle allRegistriesLifecycle() { - return (Lifecycle)this.registries().map(registryEntry -> registryEntry.value.registryLifecycle()).reduce(Lifecycle.stable(), Lifecycle::add); - } - public interface Frozen extends RegistryAccess { } @@ -100,7 +84,7 @@ public interface RegistryAccess extends HolderLookup.Provider { } @Override - public Optional> registry(ResourceKey> registryKey) { + public Optional> lookup(ResourceKey> registryKey) { return Optional.ofNullable((Registry)this.registries.get(registryKey)).map(registry -> registry); } diff --git a/net/minecraft/core/RegistrySetBuilder.java b/net/minecraft/core/RegistrySetBuilder.java index 90a1532d..caf43c6e 100644 --- a/net/minecraft/core/RegistrySetBuilder.java +++ b/net/minecraft/core/RegistrySetBuilder.java @@ -14,10 +14,15 @@ import java.util.Set; import java.util.function.Supplier; import java.util.stream.Collectors; import java.util.stream.Stream; +import net.minecraft.core.Cloner.Factory; +import net.minecraft.core.Holder.Reference.Type; +import net.minecraft.core.HolderLookup.RegistryLookup.Delegate; +import net.minecraft.core.RegistrySetBuilder.3.1; import net.minecraft.data.worldgen.BootstrapContext; import net.minecraft.resources.RegistryOps; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; +import net.minecraft.resources.RegistryOps.RegistryInfo; import net.minecraft.tags.TagKey; import org.apache.commons.lang3.mutable.MutableObject; import org.jetbrains.annotations.Nullable; @@ -83,24 +88,24 @@ public class RegistrySetBuilder { private static HolderLookup.Provider buildProviderWithContext( RegistrySetBuilder.UniversalOwner owner, RegistryAccess registryAccess, Stream> lookups ) { - record Entry(HolderLookup.RegistryLookup lookup, RegistryOps.RegistryInfo opsInfo) { + record Entry(HolderLookup.RegistryLookup lookup, RegistryInfo opsInfo) { public static Entry createForContextRegistry(HolderLookup.RegistryLookup lookup) { - return new Entry<>(new RegistrySetBuilder.EmptyTagLookupWrapper<>(lookup, lookup), RegistryOps.RegistryInfo.fromRegistryLookup(lookup)); + return new Entry<>(new RegistrySetBuilder.EmptyTagLookupWrapper<>(lookup, lookup), RegistryInfo.fromRegistryLookup(lookup)); } public static Entry createForNewRegistry(RegistrySetBuilder.UniversalOwner owner, HolderLookup.RegistryLookup lookup) { return new Entry<>( - new RegistrySetBuilder.EmptyTagLookupWrapper<>(owner.cast(), lookup), new RegistryOps.RegistryInfo<>(owner.cast(), lookup, lookup.registryLifecycle()) + new RegistrySetBuilder.EmptyTagLookupWrapper<>(owner.cast(), lookup), new RegistryInfo<>(owner.cast(), lookup, lookup.registryLifecycle()) ); } } final Map>, Entry> map = new HashMap(); - registryAccess.registries().forEach(registryEntry -> map.put(registryEntry.key(), Entry.createForContextRegistry(registryEntry.value().asLookup()))); + registryAccess.registries().forEach(registryEntry -> map.put(registryEntry.key(), Entry.createForContextRegistry(registryEntry.value()))); lookups.forEach(registryLookup -> map.put(registryLookup.key(), Entry.createForNewRegistry(owner, registryLookup))); return new HolderLookup.Provider() { @Override - public Stream>> listRegistries() { + public Stream>> listRegistryKeys() { return map.keySet().stream(); } @@ -115,12 +120,7 @@ public class RegistrySetBuilder { @Override public RegistryOps createSerializationContext(DynamicOps ops) { - return RegistryOps.create(ops, new RegistryOps.RegistryInfoLookup() { - @Override - public Optional> lookup(ResourceKey> registryKey) { - return getEntry(registryKey).map(Entry::opsInfo); - } - }); + return RegistryOps.create(ops, new 1(this)); } }; } @@ -140,7 +140,7 @@ public class RegistrySetBuilder { private HolderLookup.Provider createLazyFullPatchedRegistries( RegistryAccess registry, HolderLookup.Provider lookupProvider, - Cloner.Factory clonerFactory, + Factory clonerFactory, Map>, RegistrySetBuilder.RegistryContents> registries, HolderLookup.Provider registryLookupProvider ) { @@ -157,7 +157,7 @@ public class RegistrySetBuilder { private HolderLookup.RegistryLookup createLazyFullPatchedRegistries( HolderOwner owner, - Cloner.Factory clonerFactory, + Factory clonerFactory, ResourceKey> registryKey, HolderLookup.Provider registryLookupProvider, HolderLookup.Provider lookupProvider, @@ -189,16 +189,16 @@ public class RegistrySetBuilder { } } - public RegistrySetBuilder.PatchedRegistries buildPatch(RegistryAccess registryAccess, HolderLookup.Provider lookupProvider, Cloner.Factory clonerFactory) { + public RegistrySetBuilder.PatchedRegistries buildPatch(RegistryAccess registryAccess, HolderLookup.Provider lookupProvider, Factory clonerFactory) { RegistrySetBuilder.BuildState buildState = this.createState(registryAccess); Map>, RegistrySetBuilder.RegistryContents> map = new HashMap(); this.entries .stream() .map(registryStub -> registryStub.collectRegisteredValues(buildState)) .forEach(registryContents -> map.put(registryContents.key, registryContents)); - Set>> set = (Set>>)registryAccess.listRegistries() + Set>> set = (Set>>)registryAccess.listRegistryKeys() .collect(Collectors.toUnmodifiableSet()); - lookupProvider.listRegistries() + lookupProvider.listRegistryKeys() .filter(resourceKey -> !set.contains(resourceKey)) .forEach(resourceKey -> map.putIfAbsent(resourceKey, new RegistrySetBuilder.RegistryContents(resourceKey, Lifecycle.stable(), Map.of()))); Stream> stream = map.values().stream().map(registryContents -> registryContents.buildAsLookup(buildState.owner)); @@ -223,29 +223,13 @@ public class RegistrySetBuilder { RegistrySetBuilder.UniversalLookup universalLookup = new RegistrySetBuilder.UniversalLookup(universalOwner); Builder> builder = ImmutableMap.builder(); registryAccess.registries() - .forEach(registryEntry -> builder.put(registryEntry.key().location(), RegistrySetBuilder.wrapContextLookup(registryEntry.value().asLookup()))); + .forEach(registryEntry -> builder.put(registryEntry.key().location(), RegistrySetBuilder.wrapContextLookup(registryEntry.value()))); registries.forEach(resourceKey -> builder.put(resourceKey.location(), universalLookup)); return new RegistrySetBuilder.BuildState(universalOwner, universalLookup, builder.build(), new HashMap(), list); } public BootstrapContext bootstrapContext() { - return new BootstrapContext() { - @Override - public Holder.Reference register(ResourceKey key, T value, Lifecycle registryLifecycle) { - RegistrySetBuilder.RegisteredValue registeredValue = (RegistrySetBuilder.RegisteredValue)BuildState.this.registeredValues - .put(key, new RegistrySetBuilder.RegisteredValue(value, registryLifecycle)); - if (registeredValue != null) { - BuildState.this.errors.add(new IllegalStateException("Duplicate registration for " + key + ", new=" + value + ", old=" + registeredValue.value)); - } - - return BuildState.this.lookup.getOrCreate(key); - } - - @Override - public HolderGetter lookup(ResourceKey> registryKey) { - return (HolderGetter)BuildState.this.registries.getOrDefault(registryKey.location(), BuildState.this.lookup); - } - }; + return new net.minecraft.core.RegistrySetBuilder.BuildState.1(this); } public void reportUnclaimedRegisteredValues() { @@ -285,7 +269,7 @@ public class RegistrySetBuilder { } } - static class EmptyTagLookupWrapper extends RegistrySetBuilder.EmptyTagRegistryLookup implements HolderLookup.RegistryLookup.Delegate { + static class EmptyTagLookupWrapper extends RegistrySetBuilder.EmptyTagRegistryLookup implements Delegate { private final HolderLookup.RegistryLookup parent; EmptyTagLookupWrapper(HolderOwner owner, HolderLookup.RegistryLookup parent) { @@ -293,7 +277,6 @@ public class RegistrySetBuilder { this.parent = parent; } - @Override public HolderLookup.RegistryLookup parent() { return this.parent; } @@ -315,7 +298,7 @@ public class RegistrySetBuilder { Supplier supplier; protected LazyHolder(HolderOwner owner, @Nullable ResourceKey key) { - super(Holder.Reference.Type.STAND_ALONE, owner, key, null); + super(Type.STAND_ALONE, owner, key, null); } @Override diff --git a/net/minecraft/core/RegistrySynchronization.java b/net/minecraft/core/RegistrySynchronization.java index 8a118b34..f745f6ac 100644 --- a/net/minecraft/core/RegistrySynchronization.java +++ b/net/minecraft/core/RegistrySynchronization.java @@ -19,7 +19,7 @@ import net.minecraft.server.RegistryLayer; import net.minecraft.server.packs.repository.KnownPack; public class RegistrySynchronization { - public static final Set>> NETWORKABLE_REGISTRIES = (Set>>)RegistryDataLoader.SYNCHRONIZED_REGISTRIES + private static final Set>> NETWORKABLE_REGISTRIES = (Set>>)RegistryDataLoader.SYNCHRONIZED_REGISTRIES .stream() .map(RegistryDataLoader.RegistryData::key) .collect(Collectors.toUnmodifiableSet()); @@ -40,11 +40,11 @@ public class RegistrySynchronization { Set packs, BiConsumer>, List> packetSender ) { - registryAccess.registry(registryData.key()) + registryAccess.lookup(registryData.key()) .ifPresent( registry -> { List list = new ArrayList(registry.size()); - registry.holders() + registry.listElements() .forEach( reference -> { boolean bl = registry.registrationInfo(reference.key()).flatMap(RegistrationInfo::knownPackInfo).filter(packs::contains).isPresent(); @@ -67,7 +67,7 @@ public class RegistrySynchronization { } private static Stream> ownedNetworkableRegistries(RegistryAccess registryAccess) { - return registryAccess.registries().filter(registryEntry -> NETWORKABLE_REGISTRIES.contains(registryEntry.key())); + return registryAccess.registries().filter(registryEntry -> isNetworkable(registryEntry.key())); } public static Stream> networkedRegistries(LayeredRegistryAccess registryAccess) { @@ -80,6 +80,10 @@ public class RegistrySynchronization { return Stream.concat(stream2, stream); } + public static boolean isNetworkable(ResourceKey> resourceKey) { + return NETWORKABLE_REGISTRIES.contains(resourceKey); + } + public record PackedRegistryEntry(ResourceLocation id, Optional data) { public static final StreamCodec STREAM_CODEC = StreamCodec.composite( ResourceLocation.STREAM_CODEC, diff --git a/net/minecraft/core/SectionPos.java b/net/minecraft/core/SectionPos.java index 1d9dfb4f..1d696ef1 100644 --- a/net/minecraft/core/SectionPos.java +++ b/net/minecraft/core/SectionPos.java @@ -58,7 +58,7 @@ public class SectionPos extends Vec3i { } public static SectionPos bottomOf(ChunkAccess chunk) { - return of(chunk.getPos(), chunk.getMinSection()); + return of(chunk.getPos(), chunk.getMinSectionY()); } public static long offset(long packed, Direction direction) { @@ -234,7 +234,7 @@ public class SectionPos extends Vec3i { public static Stream aroundChunk(ChunkPos chunkPos, int x, int y, int z) { int i = chunkPos.x; int j = chunkPos.z; - return betweenClosedStream(i - x, y, j - x, i + x, z - 1, j + x); + return betweenClosedStream(i - x, y, j - x, i + x, z, j + x); } public static Stream betweenClosedStream(int x1, int y1, int z1, int x2, int y2, int z2) { diff --git a/net/minecraft/core/Vec3i.java b/net/minecraft/core/Vec3i.java index 9e09af9e..6a150cd8 100644 --- a/net/minecraft/core/Vec3i.java +++ b/net/minecraft/core/Vec3i.java @@ -243,6 +243,13 @@ public class Vec3i implements Comparable { return (int)(f + g + h); } + public int distChessboard(Vec3i vec3i) { + int i = Math.abs(this.getX() - vec3i.getX()); + int j = Math.abs(this.getY() - vec3i.getY()); + int k = Math.abs(this.getZ() - vec3i.getZ()); + return Math.max(Math.max(i, j), k); + } + public int get(Direction.Axis axis) { return axis.choose(this.x, this.y, this.z); } diff --git a/net/minecraft/core/WritableRegistry.java b/net/minecraft/core/WritableRegistry.java index 0dde526e..7a9a5568 100644 --- a/net/minecraft/core/WritableRegistry.java +++ b/net/minecraft/core/WritableRegistry.java @@ -1,10 +1,14 @@ package net.minecraft.core; +import java.util.List; import net.minecraft.resources.ResourceKey; +import net.minecraft.tags.TagKey; public interface WritableRegistry extends Registry { Holder.Reference register(ResourceKey key, T value, RegistrationInfo registrationInfo); + void bindTag(TagKey tagKey, List> list); + boolean isEmpty(); HolderGetter createRegistrationLookup(); diff --git a/net/minecraft/core/cauldron/CauldronInteraction.java b/net/minecraft/core/cauldron/CauldronInteraction.java index 4fb325c4..76a30935 100644 --- a/net/minecraft/core/cauldron/CauldronInteraction.java +++ b/net/minecraft/core/cauldron/CauldronInteraction.java @@ -11,9 +11,10 @@ import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; import net.minecraft.stats.Stats; +import net.minecraft.tags.FluidTags; import net.minecraft.tags.ItemTags; import net.minecraft.world.InteractionHand; -import net.minecraft.world.ItemInteractionResult; +import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; @@ -29,6 +30,7 @@ import net.minecraft.world.level.block.ShulkerBoxBlock; import net.minecraft.world.level.block.entity.BannerPatternLayers; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.level.material.FluidState; public interface CauldronInteraction { Map INTERACTIONS = new Object2ObjectArrayMap<>(); @@ -37,85 +39,16 @@ public interface CauldronInteraction { CauldronInteraction.InteractionMap WATER = newInteractionMap("water"); CauldronInteraction.InteractionMap LAVA = newInteractionMap("lava"); CauldronInteraction.InteractionMap POWDER_SNOW = newInteractionMap("powder_snow"); - CauldronInteraction FILL_WATER = (blockState, level, blockPos, player, interactionHand, itemStack) -> emptyBucket( - level, - blockPos, - player, - interactionHand, - itemStack, - Blocks.WATER_CAULDRON.defaultBlockState().setValue(LayeredCauldronBlock.LEVEL, 3), - SoundEvents.BUCKET_EMPTY - ); - CauldronInteraction FILL_LAVA = (blockState, level, blockPos, player, interactionHand, itemStack) -> emptyBucket( - level, blockPos, player, interactionHand, itemStack, Blocks.LAVA_CAULDRON.defaultBlockState(), SoundEvents.BUCKET_EMPTY_LAVA - ); - CauldronInteraction FILL_POWDER_SNOW = (blockState, level, blockPos, player, interactionHand, itemStack) -> emptyBucket( - level, - blockPos, - player, - interactionHand, - itemStack, - Blocks.POWDER_SNOW_CAULDRON.defaultBlockState().setValue(LayeredCauldronBlock.LEVEL, 3), - SoundEvents.BUCKET_EMPTY_POWDER_SNOW - ); - CauldronInteraction SHULKER_BOX = (blockState, level, blockPos, player, interactionHand, itemStack) -> { - Block block = Block.byItem(itemStack.getItem()); - if (!(block instanceof ShulkerBoxBlock)) { - return ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION; - } else { - if (!level.isClientSide) { - ItemStack itemStack2 = itemStack.transmuteCopy(Blocks.SHULKER_BOX, 1); - player.setItemInHand(interactionHand, ItemUtils.createFilledResult(itemStack, player, itemStack2, false)); - player.awardStat(Stats.CLEAN_SHULKER_BOX); - LayeredCauldronBlock.lowerFillLevel(blockState, level, blockPos); - } - - return ItemInteractionResult.sidedSuccess(level.isClientSide); - } - }; - CauldronInteraction BANNER = (blockState, level, blockPos, player, interactionHand, itemStack) -> { - BannerPatternLayers bannerPatternLayers = itemStack.getOrDefault(DataComponents.BANNER_PATTERNS, BannerPatternLayers.EMPTY); - if (bannerPatternLayers.layers().isEmpty()) { - return ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION; - } else { - if (!level.isClientSide) { - ItemStack itemStack2 = itemStack.copyWithCount(1); - itemStack2.set(DataComponents.BANNER_PATTERNS, bannerPatternLayers.removeLast()); - player.setItemInHand(interactionHand, ItemUtils.createFilledResult(itemStack, player, itemStack2, false)); - player.awardStat(Stats.CLEAN_BANNER); - LayeredCauldronBlock.lowerFillLevel(blockState, level, blockPos); - } - - return ItemInteractionResult.sidedSuccess(level.isClientSide); - } - }; - CauldronInteraction DYED_ITEM = (blockState, level, blockPos, player, interactionHand, itemStack) -> { - if (!itemStack.is(ItemTags.DYEABLE)) { - return ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION; - } else if (!itemStack.has(DataComponents.DYED_COLOR)) { - return ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION; - } else { - if (!level.isClientSide) { - itemStack.remove(DataComponents.DYED_COLOR); - player.awardStat(Stats.CLEAN_ARMOR); - LayeredCauldronBlock.lowerFillLevel(blockState, level, blockPos); - } - - return ItemInteractionResult.sidedSuccess(level.isClientSide); - } - }; static CauldronInteraction.InteractionMap newInteractionMap(String name) { Object2ObjectOpenHashMap object2ObjectOpenHashMap = new Object2ObjectOpenHashMap<>(); - object2ObjectOpenHashMap.defaultReturnValue( - (blockState, level, blockPos, player, interactionHand, itemStack) -> ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION - ); + object2ObjectOpenHashMap.defaultReturnValue((blockState, level, blockPos, player, interactionHand, itemStack) -> InteractionResult.TRY_WITH_EMPTY_HAND); CauldronInteraction.InteractionMap interactionMap = new CauldronInteraction.InteractionMap(name, object2ObjectOpenHashMap); INTERACTIONS.put(name, interactionMap); return interactionMap; } - ItemInteractionResult interact(BlockState blockState, Level level, BlockPos blockPos, Player player, InteractionHand interactionHand, ItemStack itemStack); + InteractionResult interact(BlockState blockState, Level level, BlockPos blockPos, Player player, InteractionHand interactionHand, ItemStack itemStack); static void bootStrap() { Map map = EMPTY.map(); @@ -133,9 +66,9 @@ public interface CauldronInteraction { level.gameEvent(null, GameEvent.FLUID_PLACE, blockPos); } - return ItemInteractionResult.sidedSuccess(level.isClientSide); + return InteractionResult.SUCCESS; } else { - return ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION; + return InteractionResult.TRY_WITH_EMPTY_HAND; } }); Map map2 = WATER.map(); @@ -165,11 +98,11 @@ public interface CauldronInteraction { level.gameEvent(null, GameEvent.FLUID_PICKUP, blockPos); } - return ItemInteractionResult.sidedSuccess(level.isClientSide); + return InteractionResult.SUCCESS; }); map2.put(Items.POTION, (CauldronInteraction)(blockState, level, blockPos, player, interactionHand, itemStack) -> { if ((Integer)blockState.getValue(LayeredCauldronBlock.LEVEL) == 3) { - return ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION; + return InteractionResult.TRY_WITH_EMPTY_HAND; } else { PotionContents potionContents = itemStack.get(DataComponents.POTION_CONTENTS); if (potionContents != null && potionContents.is(Potions.WATER)) { @@ -182,50 +115,50 @@ public interface CauldronInteraction { level.gameEvent(null, GameEvent.FLUID_PLACE, blockPos); } - return ItemInteractionResult.sidedSuccess(level.isClientSide); + return InteractionResult.SUCCESS; } else { - return ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION; + return InteractionResult.TRY_WITH_EMPTY_HAND; } } }); - map2.put(Items.LEATHER_BOOTS, DYED_ITEM); - map2.put(Items.LEATHER_LEGGINGS, DYED_ITEM); - map2.put(Items.LEATHER_CHESTPLATE, DYED_ITEM); - map2.put(Items.LEATHER_HELMET, DYED_ITEM); - map2.put(Items.LEATHER_HORSE_ARMOR, DYED_ITEM); - map2.put(Items.WOLF_ARMOR, DYED_ITEM); - map2.put(Items.WHITE_BANNER, BANNER); - map2.put(Items.GRAY_BANNER, BANNER); - map2.put(Items.BLACK_BANNER, BANNER); - map2.put(Items.BLUE_BANNER, BANNER); - map2.put(Items.BROWN_BANNER, BANNER); - map2.put(Items.CYAN_BANNER, BANNER); - map2.put(Items.GREEN_BANNER, BANNER); - map2.put(Items.LIGHT_BLUE_BANNER, BANNER); - map2.put(Items.LIGHT_GRAY_BANNER, BANNER); - map2.put(Items.LIME_BANNER, BANNER); - map2.put(Items.MAGENTA_BANNER, BANNER); - map2.put(Items.ORANGE_BANNER, BANNER); - map2.put(Items.PINK_BANNER, BANNER); - map2.put(Items.PURPLE_BANNER, BANNER); - map2.put(Items.RED_BANNER, BANNER); - map2.put(Items.YELLOW_BANNER, BANNER); - map2.put(Items.WHITE_SHULKER_BOX, SHULKER_BOX); - map2.put(Items.GRAY_SHULKER_BOX, SHULKER_BOX); - map2.put(Items.BLACK_SHULKER_BOX, SHULKER_BOX); - map2.put(Items.BLUE_SHULKER_BOX, SHULKER_BOX); - map2.put(Items.BROWN_SHULKER_BOX, SHULKER_BOX); - map2.put(Items.CYAN_SHULKER_BOX, SHULKER_BOX); - map2.put(Items.GREEN_SHULKER_BOX, SHULKER_BOX); - map2.put(Items.LIGHT_BLUE_SHULKER_BOX, SHULKER_BOX); - map2.put(Items.LIGHT_GRAY_SHULKER_BOX, SHULKER_BOX); - map2.put(Items.LIME_SHULKER_BOX, SHULKER_BOX); - map2.put(Items.MAGENTA_SHULKER_BOX, SHULKER_BOX); - map2.put(Items.ORANGE_SHULKER_BOX, SHULKER_BOX); - map2.put(Items.PINK_SHULKER_BOX, SHULKER_BOX); - map2.put(Items.PURPLE_SHULKER_BOX, SHULKER_BOX); - map2.put(Items.RED_SHULKER_BOX, SHULKER_BOX); - map2.put(Items.YELLOW_SHULKER_BOX, SHULKER_BOX); + map2.put(Items.LEATHER_BOOTS, CauldronInteraction::dyedItemIteration); + map2.put(Items.LEATHER_LEGGINGS, CauldronInteraction::dyedItemIteration); + map2.put(Items.LEATHER_CHESTPLATE, CauldronInteraction::dyedItemIteration); + map2.put(Items.LEATHER_HELMET, CauldronInteraction::dyedItemIteration); + map2.put(Items.LEATHER_HORSE_ARMOR, CauldronInteraction::dyedItemIteration); + map2.put(Items.WOLF_ARMOR, CauldronInteraction::dyedItemIteration); + map2.put(Items.WHITE_BANNER, CauldronInteraction::bannerInteraction); + map2.put(Items.GRAY_BANNER, CauldronInteraction::bannerInteraction); + map2.put(Items.BLACK_BANNER, CauldronInteraction::bannerInteraction); + map2.put(Items.BLUE_BANNER, CauldronInteraction::bannerInteraction); + map2.put(Items.BROWN_BANNER, CauldronInteraction::bannerInteraction); + map2.put(Items.CYAN_BANNER, CauldronInteraction::bannerInteraction); + map2.put(Items.GREEN_BANNER, CauldronInteraction::bannerInteraction); + map2.put(Items.LIGHT_BLUE_BANNER, CauldronInteraction::bannerInteraction); + map2.put(Items.LIGHT_GRAY_BANNER, CauldronInteraction::bannerInteraction); + map2.put(Items.LIME_BANNER, CauldronInteraction::bannerInteraction); + map2.put(Items.MAGENTA_BANNER, CauldronInteraction::bannerInteraction); + map2.put(Items.ORANGE_BANNER, CauldronInteraction::bannerInteraction); + map2.put(Items.PINK_BANNER, CauldronInteraction::bannerInteraction); + map2.put(Items.PURPLE_BANNER, CauldronInteraction::bannerInteraction); + map2.put(Items.RED_BANNER, CauldronInteraction::bannerInteraction); + map2.put(Items.YELLOW_BANNER, CauldronInteraction::bannerInteraction); + map2.put(Items.WHITE_SHULKER_BOX, CauldronInteraction::shulkerBoxInteraction); + map2.put(Items.GRAY_SHULKER_BOX, CauldronInteraction::shulkerBoxInteraction); + map2.put(Items.BLACK_SHULKER_BOX, CauldronInteraction::shulkerBoxInteraction); + map2.put(Items.BLUE_SHULKER_BOX, CauldronInteraction::shulkerBoxInteraction); + map2.put(Items.BROWN_SHULKER_BOX, CauldronInteraction::shulkerBoxInteraction); + map2.put(Items.CYAN_SHULKER_BOX, CauldronInteraction::shulkerBoxInteraction); + map2.put(Items.GREEN_SHULKER_BOX, CauldronInteraction::shulkerBoxInteraction); + map2.put(Items.LIGHT_BLUE_SHULKER_BOX, CauldronInteraction::shulkerBoxInteraction); + map2.put(Items.LIGHT_GRAY_SHULKER_BOX, CauldronInteraction::shulkerBoxInteraction); + map2.put(Items.LIME_SHULKER_BOX, CauldronInteraction::shulkerBoxInteraction); + map2.put(Items.MAGENTA_SHULKER_BOX, CauldronInteraction::shulkerBoxInteraction); + map2.put(Items.ORANGE_SHULKER_BOX, CauldronInteraction::shulkerBoxInteraction); + map2.put(Items.PINK_SHULKER_BOX, CauldronInteraction::shulkerBoxInteraction); + map2.put(Items.PURPLE_SHULKER_BOX, CauldronInteraction::shulkerBoxInteraction); + map2.put(Items.RED_SHULKER_BOX, CauldronInteraction::shulkerBoxInteraction); + map2.put(Items.YELLOW_SHULKER_BOX, CauldronInteraction::shulkerBoxInteraction); Map map3 = LAVA.map(); map3.put( Items.BUCKET, @@ -253,53 +186,151 @@ public interface CauldronInteraction { } static void addDefaultInteractions(Map interactionsMap) { - interactionsMap.put(Items.LAVA_BUCKET, FILL_LAVA); - interactionsMap.put(Items.WATER_BUCKET, FILL_WATER); - interactionsMap.put(Items.POWDER_SNOW_BUCKET, FILL_POWDER_SNOW); + interactionsMap.put(Items.LAVA_BUCKET, CauldronInteraction::fillLavaInteraction); + interactionsMap.put(Items.WATER_BUCKET, CauldronInteraction::fillWaterInteraction); + interactionsMap.put(Items.POWDER_SNOW_BUCKET, CauldronInteraction::fillPowderSnowInteraction); } - static ItemInteractionResult fillBucket( - BlockState state, + static InteractionResult fillBucket( + BlockState blockState, Level level, - BlockPos pos, + BlockPos blockPos, Player player, - InteractionHand hand, - ItemStack emptyStack, - ItemStack filledStack, - Predicate statePredicate, - SoundEvent fillSound + InteractionHand interactionHand, + ItemStack itemStack, + ItemStack itemStack2, + Predicate predicate, + SoundEvent soundEvent ) { - if (!statePredicate.test(state)) { - return ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION; + if (!predicate.test(blockState)) { + return InteractionResult.TRY_WITH_EMPTY_HAND; } else { if (!level.isClientSide) { - Item item = emptyStack.getItem(); - player.setItemInHand(hand, ItemUtils.createFilledResult(emptyStack, player, filledStack)); + Item item = itemStack.getItem(); + player.setItemInHand(interactionHand, ItemUtils.createFilledResult(itemStack, player, itemStack2)); player.awardStat(Stats.USE_CAULDRON); player.awardStat(Stats.ITEM_USED.get(item)); - level.setBlockAndUpdate(pos, Blocks.CAULDRON.defaultBlockState()); - level.playSound(null, pos, fillSound, SoundSource.BLOCKS, 1.0F, 1.0F); - level.gameEvent(null, GameEvent.FLUID_PICKUP, pos); + level.setBlockAndUpdate(blockPos, Blocks.CAULDRON.defaultBlockState()); + level.playSound(null, blockPos, soundEvent, SoundSource.BLOCKS, 1.0F, 1.0F); + level.gameEvent(null, GameEvent.FLUID_PICKUP, blockPos); } - return ItemInteractionResult.sidedSuccess(level.isClientSide); + return InteractionResult.SUCCESS; } } - static ItemInteractionResult emptyBucket( - Level level, BlockPos pos, Player player, InteractionHand hand, ItemStack filledStack, BlockState state, SoundEvent emptySound + static InteractionResult emptyBucket( + Level level, BlockPos blockPos, Player player, InteractionHand interactionHand, ItemStack itemStack, BlockState blockState, SoundEvent soundEvent ) { if (!level.isClientSide) { - Item item = filledStack.getItem(); - player.setItemInHand(hand, ItemUtils.createFilledResult(filledStack, player, new ItemStack(Items.BUCKET))); + Item item = itemStack.getItem(); + player.setItemInHand(interactionHand, ItemUtils.createFilledResult(itemStack, player, new ItemStack(Items.BUCKET))); player.awardStat(Stats.FILL_CAULDRON); player.awardStat(Stats.ITEM_USED.get(item)); - level.setBlockAndUpdate(pos, state); - level.playSound(null, pos, emptySound, SoundSource.BLOCKS, 1.0F, 1.0F); - level.gameEvent(null, GameEvent.FLUID_PLACE, pos); + level.setBlockAndUpdate(blockPos, blockState); + level.playSound(null, blockPos, soundEvent, SoundSource.BLOCKS, 1.0F, 1.0F); + level.gameEvent(null, GameEvent.FLUID_PLACE, blockPos); } - return ItemInteractionResult.sidedSuccess(level.isClientSide); + return InteractionResult.SUCCESS; + } + + private static InteractionResult fillWaterInteraction( + BlockState blockState, Level level, BlockPos blockPos, Player player, InteractionHand interactionHand, ItemStack itemStack + ) { + return emptyBucket( + level, + blockPos, + player, + interactionHand, + itemStack, + Blocks.WATER_CAULDRON.defaultBlockState().setValue(LayeredCauldronBlock.LEVEL, 3), + SoundEvents.BUCKET_EMPTY + ); + } + + private static InteractionResult fillLavaInteraction( + BlockState blockState, Level level, BlockPos blockPos, Player player, InteractionHand interactionHand, ItemStack itemStack + ) { + return (InteractionResult)(isUnderWater(level, blockPos) + ? InteractionResult.CONSUME + : emptyBucket(level, blockPos, player, interactionHand, itemStack, Blocks.LAVA_CAULDRON.defaultBlockState(), SoundEvents.BUCKET_EMPTY_LAVA)); + } + + private static InteractionResult fillPowderSnowInteraction( + BlockState blockState, Level level, BlockPos blockPos, Player player, InteractionHand interactionHand, ItemStack itemStack + ) { + return (InteractionResult)(isUnderWater(level, blockPos) + ? InteractionResult.CONSUME + : emptyBucket( + level, + blockPos, + player, + interactionHand, + itemStack, + Blocks.POWDER_SNOW_CAULDRON.defaultBlockState().setValue(LayeredCauldronBlock.LEVEL, 3), + SoundEvents.BUCKET_EMPTY_POWDER_SNOW + )); + } + + private static InteractionResult shulkerBoxInteraction( + BlockState blockState, Level level, BlockPos blockPos, Player player, InteractionHand interactionHand, ItemStack itemStack + ) { + Block block = Block.byItem(itemStack.getItem()); + if (!(block instanceof ShulkerBoxBlock)) { + return InteractionResult.TRY_WITH_EMPTY_HAND; + } else { + if (!level.isClientSide) { + ItemStack itemStack2 = itemStack.transmuteCopy(Blocks.SHULKER_BOX, 1); + player.setItemInHand(interactionHand, ItemUtils.createFilledResult(itemStack, player, itemStack2, false)); + player.awardStat(Stats.CLEAN_SHULKER_BOX); + LayeredCauldronBlock.lowerFillLevel(blockState, level, blockPos); + } + + return InteractionResult.SUCCESS; + } + } + + private static InteractionResult bannerInteraction( + BlockState blockState, Level level, BlockPos blockPos, Player player, InteractionHand interactionHand, ItemStack itemStack + ) { + BannerPatternLayers bannerPatternLayers = itemStack.getOrDefault(DataComponents.BANNER_PATTERNS, BannerPatternLayers.EMPTY); + if (bannerPatternLayers.layers().isEmpty()) { + return InteractionResult.TRY_WITH_EMPTY_HAND; + } else { + if (!level.isClientSide) { + ItemStack itemStack2 = itemStack.copyWithCount(1); + itemStack2.set(DataComponents.BANNER_PATTERNS, bannerPatternLayers.removeLast()); + player.setItemInHand(interactionHand, ItemUtils.createFilledResult(itemStack, player, itemStack2, false)); + player.awardStat(Stats.CLEAN_BANNER); + LayeredCauldronBlock.lowerFillLevel(blockState, level, blockPos); + } + + return InteractionResult.SUCCESS; + } + } + + private static InteractionResult dyedItemIteration( + BlockState blockState, Level level, BlockPos blockPos, Player player, InteractionHand interactionHand, ItemStack itemStack + ) { + if (!itemStack.is(ItemTags.DYEABLE)) { + return InteractionResult.TRY_WITH_EMPTY_HAND; + } else if (!itemStack.has(DataComponents.DYED_COLOR)) { + return InteractionResult.TRY_WITH_EMPTY_HAND; + } else { + if (!level.isClientSide) { + itemStack.remove(DataComponents.DYED_COLOR); + player.awardStat(Stats.CLEAN_ARMOR); + LayeredCauldronBlock.lowerFillLevel(blockState, level, blockPos); + } + + return InteractionResult.SUCCESS; + } + } + + private static boolean isUnderWater(Level level, BlockPos blockPos) { + FluidState fluidState = level.getFluidState(blockPos.above()); + return fluidState.is(FluidTags.WATER); } public record InteractionMap(String name, Map map) { diff --git a/net/minecraft/core/component/DataComponentHolder.java b/net/minecraft/core/component/DataComponentHolder.java index 9b73a4a6..6ae333b0 100644 --- a/net/minecraft/core/component/DataComponentHolder.java +++ b/net/minecraft/core/component/DataComponentHolder.java @@ -1,5 +1,6 @@ package net.minecraft.core.component; +import java.util.stream.Stream; import org.jetbrains.annotations.Nullable; public interface DataComponentHolder { @@ -10,6 +11,10 @@ public interface DataComponentHolder { return this.getComponents().get(component); } + default Stream getAllOfType(Class class_) { + return this.getComponents().stream().map(TypedDataComponent::value).filter(object -> class_.isAssignableFrom(object.getClass())).map(object -> object); + } + default T getOrDefault(DataComponentType component, T defaultValue) { return this.getComponents().getOrDefault(component, defaultValue); } diff --git a/net/minecraft/core/component/DataComponentPatch.java b/net/minecraft/core/component/DataComponentPatch.java index 4d9bcb5d..8f116c6e 100644 --- a/net/minecraft/core/component/DataComponentPatch.java +++ b/net/minecraft/core/component/DataComponentPatch.java @@ -249,7 +249,7 @@ public final class DataComponentPatch { } ResourceLocation resourceLocation = ResourceLocation.tryParse(string); - DataComponentType dataComponentType = BuiltInRegistries.DATA_COMPONENT_TYPE.get(resourceLocation); + DataComponentType dataComponentType = BuiltInRegistries.DATA_COMPONENT_TYPE.getValue(resourceLocation); if (dataComponentType == null) { return DataResult.error(() -> "No component with type: '" + resourceLocation + "'"); } else { diff --git a/net/minecraft/core/component/DataComponentPredicate.java b/net/minecraft/core/component/DataComponentPredicate.java index e32615d9..beb7d6f9 100644 --- a/net/minecraft/core/component/DataComponentPredicate.java +++ b/net/minecraft/core/component/DataComponentPredicate.java @@ -41,6 +41,19 @@ public final class DataComponentPredicate implements Predicate return new DataComponentPredicate(ImmutableList.copyOf(expectedComponents)); } + public static DataComponentPredicate someOf(DataComponentMap dataComponentMap, DataComponentType... dataComponentTypes) { + DataComponentPredicate.Builder builder = new DataComponentPredicate.Builder(); + + for (DataComponentType dataComponentType : dataComponentTypes) { + TypedDataComponent typedDataComponent = dataComponentMap.getTyped(dataComponentType); + if (typedDataComponent != null) { + builder.expect(typedDataComponent); + } + } + + return builder.build(); + } + public boolean equals(Object object) { return object instanceof DataComponentPredicate dataComponentPredicate && this.expectedComponents.equals(dataComponentPredicate.expectedComponents); } @@ -88,6 +101,10 @@ public final class DataComponentPredicate implements Predicate Builder() { } + public DataComponentPredicate.Builder expect(TypedDataComponent typedDataComponent) { + return this.expect(typedDataComponent.type(), typedDataComponent.value()); + } + public DataComponentPredicate.Builder expect(DataComponentType component, T value) { for (TypedDataComponent typedDataComponent : this.expectedComponents) { if (typedDataComponent.type() == component) { diff --git a/net/minecraft/core/component/DataComponents.java b/net/minecraft/core/component/DataComponents.java index d8acc4ea..f637d03d 100644 --- a/net/minecraft/core/component/DataComponents.java +++ b/net/minecraft/core/component/DataComponents.java @@ -5,11 +5,14 @@ import java.util.List; import java.util.function.UnaryOperator; import net.minecraft.core.Holder; import net.minecraft.core.Registry; +import net.minecraft.core.component.DataComponentType.Builder; import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.core.registries.Registries; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.ComponentSerialization; import net.minecraft.network.codec.ByteBufCodecs; import net.minecraft.network.codec.StreamCodec; +import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; import net.minecraft.util.EncoderCache; import net.minecraft.util.ExtraCodecs; @@ -22,12 +25,14 @@ import net.minecraft.world.item.Instrument; import net.minecraft.world.item.JukeboxPlayable; import net.minecraft.world.item.Rarity; import net.minecraft.world.item.alchemy.PotionContents; -import net.minecraft.world.item.armortrim.ArmorTrim; import net.minecraft.world.item.component.BlockItemStateProperties; import net.minecraft.world.item.component.BundleContents; import net.minecraft.world.item.component.ChargedProjectiles; +import net.minecraft.world.item.component.Consumable; import net.minecraft.world.item.component.CustomData; import net.minecraft.world.item.component.CustomModelData; +import net.minecraft.world.item.component.DamageResistant; +import net.minecraft.world.item.component.DeathProtection; import net.minecraft.world.item.component.DebugStickState; import net.minecraft.world.item.component.DyedItemColor; import net.minecraft.world.item.component.FireworkExplosion; @@ -39,14 +44,22 @@ import net.minecraft.world.item.component.LodestoneTracker; import net.minecraft.world.item.component.MapDecorations; import net.minecraft.world.item.component.MapItemColor; import net.minecraft.world.item.component.MapPostProcessing; +import net.minecraft.world.item.component.OminousBottleAmplifier; import net.minecraft.world.item.component.ResolvableProfile; import net.minecraft.world.item.component.SeededContainerLoot; import net.minecraft.world.item.component.SuspiciousStewEffects; import net.minecraft.world.item.component.Tool; import net.minecraft.world.item.component.Unbreakable; +import net.minecraft.world.item.component.UseCooldown; +import net.minecraft.world.item.component.UseRemainder; import net.minecraft.world.item.component.WritableBookContent; import net.minecraft.world.item.component.WrittenBookContent; +import net.minecraft.world.item.crafting.Recipe; +import net.minecraft.world.item.enchantment.Enchantable; import net.minecraft.world.item.enchantment.ItemEnchantments; +import net.minecraft.world.item.enchantment.Repairable; +import net.minecraft.world.item.equipment.Equippable; +import net.minecraft.world.item.equipment.trim.ArmorTrim; import net.minecraft.world.level.block.entity.BannerPatternLayers; import net.minecraft.world.level.block.entity.BeehiveBlockEntity; import net.minecraft.world.level.block.entity.PotDecorations; @@ -73,6 +86,9 @@ public class DataComponents { public static final DataComponentType ITEM_NAME = register( "item_name", builder -> builder.persistent(ComponentSerialization.FLAT_CODEC).networkSynchronized(ComponentSerialization.STREAM_CODEC).cacheEncoding() ); + public static final DataComponentType ITEM_MODEL = register( + "item_model", builder -> builder.persistent(ResourceLocation.CODEC).networkSynchronized(ResourceLocation.STREAM_CODEC).cacheEncoding() + ); public static final DataComponentType LORE = register( "lore", builder -> builder.persistent(ItemLore.CODEC).networkSynchronized(ItemLore.STREAM_CODEC).cacheEncoding() ); @@ -111,12 +127,39 @@ public class DataComponents { public static final DataComponentType FOOD = register( "food", builder -> builder.persistent(FoodProperties.DIRECT_CODEC).networkSynchronized(FoodProperties.DIRECT_STREAM_CODEC).cacheEncoding() ); - public static final DataComponentType FIRE_RESISTANT = register( - "fire_resistant", builder -> builder.persistent(Unit.CODEC).networkSynchronized(StreamCodec.unit(Unit.INSTANCE)) + public static final DataComponentType CONSUMABLE = register( + "consumable", builder -> builder.persistent(Consumable.CODEC).networkSynchronized(Consumable.STREAM_CODEC).cacheEncoding() + ); + public static final DataComponentType USE_REMAINDER = register( + "use_remainder", builder -> builder.persistent(UseRemainder.CODEC).networkSynchronized(UseRemainder.STREAM_CODEC).cacheEncoding() + ); + public static final DataComponentType USE_COOLDOWN = register( + "use_cooldown", builder -> builder.persistent(UseCooldown.CODEC).networkSynchronized(UseCooldown.STREAM_CODEC).cacheEncoding() + ); + public static final DataComponentType DAMAGE_RESISTANT = register( + "damage_resistant", builder -> builder.persistent(DamageResistant.CODEC).networkSynchronized(DamageResistant.STREAM_CODEC).cacheEncoding() ); public static final DataComponentType TOOL = register( "tool", builder -> builder.persistent(Tool.CODEC).networkSynchronized(Tool.STREAM_CODEC).cacheEncoding() ); + public static final DataComponentType ENCHANTABLE = register( + "enchantable", builder -> builder.persistent(Enchantable.CODEC).networkSynchronized(Enchantable.STREAM_CODEC).cacheEncoding() + ); + public static final DataComponentType EQUIPPABLE = register( + "equippable", builder -> builder.persistent(Equippable.CODEC).networkSynchronized(Equippable.STREAM_CODEC).cacheEncoding() + ); + public static final DataComponentType REPAIRABLE = register( + "repairable", builder -> builder.persistent(Repairable.CODEC).networkSynchronized(Repairable.STREAM_CODEC).cacheEncoding() + ); + public static final DataComponentType GLIDER = register( + "glider", builder -> builder.persistent(Unit.CODEC).networkSynchronized(StreamCodec.unit(Unit.INSTANCE)) + ); + public static final DataComponentType TOOLTIP_STYLE = register( + "tooltip_style", builder -> builder.persistent(ResourceLocation.CODEC).networkSynchronized(ResourceLocation.STREAM_CODEC).cacheEncoding() + ); + public static final DataComponentType DEATH_PROTECTION = register( + "death_protection", builder -> builder.persistent(DeathProtection.CODEC).networkSynchronized(DeathProtection.STREAM_CODEC).cacheEncoding() + ); public static final DataComponentType STORED_ENCHANTMENTS = register( "stored_enchantments", builder -> builder.persistent(ItemEnchantments.CODEC).networkSynchronized(ItemEnchantments.STREAM_CODEC).cacheEncoding() ); @@ -169,14 +212,14 @@ public class DataComponents { public static final DataComponentType> INSTRUMENT = register( "instrument", builder -> builder.persistent(Instrument.CODEC).networkSynchronized(Instrument.STREAM_CODEC).cacheEncoding() ); - public static final DataComponentType OMINOUS_BOTTLE_AMPLIFIER = register( - "ominous_bottle_amplifier", builder -> builder.persistent(ExtraCodecs.intRange(0, 4)).networkSynchronized(ByteBufCodecs.VAR_INT) + public static final DataComponentType OMINOUS_BOTTLE_AMPLIFIER = register( + "ominous_bottle_amplifier", builder -> builder.persistent(OminousBottleAmplifier.CODEC).networkSynchronized(OminousBottleAmplifier.STREAM_CODEC) ); public static final DataComponentType JUKEBOX_PLAYABLE = register( "jukebox_playable", builder -> builder.persistent(JukeboxPlayable.CODEC).networkSynchronized(JukeboxPlayable.STREAM_CODEC) ); - public static final DataComponentType> RECIPES = register( - "recipes", builder -> builder.persistent(ResourceLocation.CODEC.listOf()).cacheEncoding() + public static final DataComponentType>>> RECIPES = register( + "recipes", builder -> builder.persistent(ResourceKey.codec(Registries.RECIPE).listOf()).cacheEncoding() ); public static final DataComponentType LODESTONE_TRACKER = register( "lodestone_tracker", builder -> builder.persistent(LodestoneTracker.CODEC).networkSynchronized(LodestoneTracker.STREAM_CODEC).cacheEncoding() @@ -231,7 +274,7 @@ public class DataComponents { return CUSTOM_DATA; } - private static DataComponentType register(String name, UnaryOperator> builder) { - return Registry.register(BuiltInRegistries.DATA_COMPONENT_TYPE, name, ((DataComponentType.Builder)builder.apply(DataComponentType.builder())).build()); + private static DataComponentType register(String name, UnaryOperator> builder) { + return Registry.register(BuiltInRegistries.DATA_COMPONENT_TYPE, name, ((Builder)builder.apply(DataComponentType.builder())).build()); } } diff --git a/net/minecraft/core/component/PatchedDataComponentMap.java b/net/minecraft/core/component/PatchedDataComponentMap.java index 382d2926..716d688a 100644 --- a/net/minecraft/core/component/PatchedDataComponentMap.java +++ b/net/minecraft/core/component/PatchedDataComponentMap.java @@ -119,6 +119,11 @@ public final class PatchedDataComponentMap implements DataComponentMap { this.patch.putAll(patch.map); } + public void clearPatch() { + this.ensureMapOwnership(); + this.patch.clear(); + } + public void setAll(DataComponentMap map) { for (TypedDataComponent typedDataComponent : map) { typedDataComponent.applyTo(this); diff --git a/net/minecraft/core/dispenser/BoatDispenseItemBehavior.java b/net/minecraft/core/dispenser/BoatDispenseItemBehavior.java index c1a66699..b7669f01 100644 --- a/net/minecraft/core/dispenser/BoatDispenseItemBehavior.java +++ b/net/minecraft/core/dispenser/BoatDispenseItemBehavior.java @@ -4,25 +4,19 @@ import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.server.level.ServerLevel; import net.minecraft.tags.FluidTags; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; -import net.minecraft.world.entity.vehicle.Boat; -import net.minecraft.world.entity.vehicle.ChestBoat; +import net.minecraft.world.entity.vehicle.AbstractBoat; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.block.DispenserBlock; import net.minecraft.world.phys.Vec3; public class BoatDispenseItemBehavior extends DefaultDispenseItemBehavior { private final DefaultDispenseItemBehavior defaultDispenseItemBehavior = new DefaultDispenseItemBehavior(); - private final Boat.Type type; - private final boolean isChestBoat; + private final EntityType type; - public BoatDispenseItemBehavior(Boat.Type type) { - this(type, false); - } - - public BoatDispenseItemBehavior(Boat.Type type, boolean isChestBoat) { - this.type = type; - this.isChestBoat = isChestBoat; + public BoatDispenseItemBehavior(EntityType entityType) { + this.type = entityType; } @Override @@ -30,7 +24,7 @@ public class BoatDispenseItemBehavior extends DefaultDispenseItemBehavior { Direction direction = blockSource.state().getValue(DispenserBlock.FACING); ServerLevel serverLevel = blockSource.level(); Vec3 vec3 = blockSource.center(); - double d = 0.5625 + EntityType.BOAT.getWidth() / 2.0; + double d = 0.5625 + this.type.getWidth() / 2.0; double e = vec3.x() + direction.getStepX() * d; double f = vec3.y() + direction.getStepY() * 1.125F; double g = vec3.z() + direction.getStepZ() * d; @@ -46,12 +40,15 @@ public class BoatDispenseItemBehavior extends DefaultDispenseItemBehavior { h = 0.0; } - Boat boat = (Boat)(this.isChestBoat ? new ChestBoat(serverLevel, e, f + h, g) : new Boat(serverLevel, e, f + h, g)); - EntityType.createDefaultStackConfig(serverLevel, item, null).accept(boat); - boat.setVariant(this.type); - boat.setYRot(direction.toYRot()); - serverLevel.addFreshEntity(boat); - item.shrink(1); + AbstractBoat abstractBoat = this.type.create(serverLevel, EntitySpawnReason.DISPENSER); + if (abstractBoat != null) { + abstractBoat.setInitialPos(e, f + h, g); + EntityType.createDefaultStackConfig(serverLevel, item, null).accept(abstractBoat); + abstractBoat.setYRot(direction.toYRot()); + serverLevel.addFreshEntity(abstractBoat); + item.shrink(1); + } + return item; } diff --git a/net/minecraft/core/dispenser/DispenseItemBehavior.java b/net/minecraft/core/dispenser/DispenseItemBehavior.java index b52c7720..b664cc75 100644 --- a/net/minecraft/core/dispenser/DispenseItemBehavior.java +++ b/net/minecraft/core/dispenser/DispenseItemBehavior.java @@ -14,18 +14,14 @@ import net.minecraft.sounds.SoundSource; import net.minecraft.tags.BlockTags; import net.minecraft.tags.FluidTags; import net.minecraft.world.entity.EntitySelector; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; -import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.entity.MobSpawnType; import net.minecraft.world.entity.Saddleable; import net.minecraft.world.entity.animal.armadillo.Armadillo; import net.minecraft.world.entity.animal.horse.AbstractChestedHorse; -import net.minecraft.world.entity.animal.horse.AbstractHorse; import net.minecraft.world.entity.decoration.ArmorStand; import net.minecraft.world.entity.item.PrimedTnt; -import net.minecraft.world.entity.vehicle.Boat; -import net.minecraft.world.item.ArmorItem; import net.minecraft.world.item.BoneMealItem; import net.minecraft.world.item.DispensibleContainerItem; import net.minecraft.world.item.DyeColor; @@ -87,7 +83,7 @@ public interface DispenseItemBehavior { EntityType entityType = ((SpawnEggItem)item.getItem()).getType(item); try { - entityType.spawn(blockSource.level(), item, null, blockSource.pos().relative(direction), MobSpawnType.DISPENSER, direction != Direction.UP, false); + entityType.spawn(blockSource.level(), item, null, blockSource.pos().relative(direction), EntitySpawnReason.DISPENSER, direction != Direction.UP, false); } catch (Exception var6) { LOGGER.error("Error while dispensing spawn egg from dispenser at {}", blockSource.pos(), var6); return ItemStack.EMPTY; @@ -110,7 +106,7 @@ public interface DispenseItemBehavior { BlockPos blockPos = blockSource.pos().relative(direction); ServerLevel serverLevel = blockSource.level(); Consumer consumer = EntityType.appendDefaultStackConfig(armorStandx -> armorStandx.setYRot(direction.toYRot()), serverLevel, item, null); - ArmorStand armorStand = EntityType.ARMOR_STAND.spawn(serverLevel, consumer, blockPos, MobSpawnType.DISPENSER, false, false); + ArmorStand armorStand = EntityType.ARMOR_STAND.spawn(serverLevel, consumer, blockPos, EntitySpawnReason.DISPENSER, false, false); if (armorStand != null) { item.shrink(1); } @@ -140,43 +136,6 @@ public interface DispenseItemBehavior { } } ); - DefaultDispenseItemBehavior defaultDispenseItemBehavior2 = new OptionalDispenseItemBehavior() { - @Override - protected ItemStack execute(BlockSource blockSource, ItemStack item) { - BlockPos blockPos = blockSource.pos().relative(blockSource.state().getValue(DispenserBlock.FACING)); - - for (AbstractHorse abstractHorse : blockSource.level() - .getEntitiesOfClass(AbstractHorse.class, new AABB(blockPos), abstractHorsex -> abstractHorsex.isAlive() && abstractHorsex.canUseSlot(EquipmentSlot.BODY))) { - if (abstractHorse.isBodyArmorItem(item) && !abstractHorse.isWearingBodyArmor() && abstractHorse.isTamed()) { - abstractHorse.setBodyArmorItem(item.split(1)); - this.setSuccess(true); - return item; - } - } - - return super.execute(blockSource, item); - } - }; - DispenserBlock.registerBehavior(Items.LEATHER_HORSE_ARMOR, defaultDispenseItemBehavior2); - DispenserBlock.registerBehavior(Items.IRON_HORSE_ARMOR, defaultDispenseItemBehavior2); - DispenserBlock.registerBehavior(Items.GOLDEN_HORSE_ARMOR, defaultDispenseItemBehavior2); - DispenserBlock.registerBehavior(Items.DIAMOND_HORSE_ARMOR, defaultDispenseItemBehavior2); - DispenserBlock.registerBehavior(Items.WHITE_CARPET, defaultDispenseItemBehavior2); - DispenserBlock.registerBehavior(Items.ORANGE_CARPET, defaultDispenseItemBehavior2); - DispenserBlock.registerBehavior(Items.CYAN_CARPET, defaultDispenseItemBehavior2); - DispenserBlock.registerBehavior(Items.BLUE_CARPET, defaultDispenseItemBehavior2); - DispenserBlock.registerBehavior(Items.BROWN_CARPET, defaultDispenseItemBehavior2); - DispenserBlock.registerBehavior(Items.BLACK_CARPET, defaultDispenseItemBehavior2); - DispenserBlock.registerBehavior(Items.GRAY_CARPET, defaultDispenseItemBehavior2); - DispenserBlock.registerBehavior(Items.GREEN_CARPET, defaultDispenseItemBehavior2); - DispenserBlock.registerBehavior(Items.LIGHT_BLUE_CARPET, defaultDispenseItemBehavior2); - DispenserBlock.registerBehavior(Items.LIGHT_GRAY_CARPET, defaultDispenseItemBehavior2); - DispenserBlock.registerBehavior(Items.LIME_CARPET, defaultDispenseItemBehavior2); - DispenserBlock.registerBehavior(Items.MAGENTA_CARPET, defaultDispenseItemBehavior2); - DispenserBlock.registerBehavior(Items.PINK_CARPET, defaultDispenseItemBehavior2); - DispenserBlock.registerBehavior(Items.PURPLE_CARPET, defaultDispenseItemBehavior2); - DispenserBlock.registerBehavior(Items.RED_CARPET, defaultDispenseItemBehavior2); - DispenserBlock.registerBehavior(Items.YELLOW_CARPET, defaultDispenseItemBehavior2); DispenserBlock.registerBehavior( Items.CHEST, new OptionalDispenseItemBehavior() { @@ -199,24 +158,26 @@ public interface DispenseItemBehavior { } } ); - DispenserBlock.registerBehavior(Items.OAK_BOAT, new BoatDispenseItemBehavior(Boat.Type.OAK)); - DispenserBlock.registerBehavior(Items.SPRUCE_BOAT, new BoatDispenseItemBehavior(Boat.Type.SPRUCE)); - DispenserBlock.registerBehavior(Items.BIRCH_BOAT, new BoatDispenseItemBehavior(Boat.Type.BIRCH)); - DispenserBlock.registerBehavior(Items.JUNGLE_BOAT, new BoatDispenseItemBehavior(Boat.Type.JUNGLE)); - DispenserBlock.registerBehavior(Items.DARK_OAK_BOAT, new BoatDispenseItemBehavior(Boat.Type.DARK_OAK)); - DispenserBlock.registerBehavior(Items.ACACIA_BOAT, new BoatDispenseItemBehavior(Boat.Type.ACACIA)); - DispenserBlock.registerBehavior(Items.CHERRY_BOAT, new BoatDispenseItemBehavior(Boat.Type.CHERRY)); - DispenserBlock.registerBehavior(Items.MANGROVE_BOAT, new BoatDispenseItemBehavior(Boat.Type.MANGROVE)); - DispenserBlock.registerBehavior(Items.BAMBOO_RAFT, new BoatDispenseItemBehavior(Boat.Type.BAMBOO)); - DispenserBlock.registerBehavior(Items.OAK_CHEST_BOAT, new BoatDispenseItemBehavior(Boat.Type.OAK, true)); - DispenserBlock.registerBehavior(Items.SPRUCE_CHEST_BOAT, new BoatDispenseItemBehavior(Boat.Type.SPRUCE, true)); - DispenserBlock.registerBehavior(Items.BIRCH_CHEST_BOAT, new BoatDispenseItemBehavior(Boat.Type.BIRCH, true)); - DispenserBlock.registerBehavior(Items.JUNGLE_CHEST_BOAT, new BoatDispenseItemBehavior(Boat.Type.JUNGLE, true)); - DispenserBlock.registerBehavior(Items.DARK_OAK_CHEST_BOAT, new BoatDispenseItemBehavior(Boat.Type.DARK_OAK, true)); - DispenserBlock.registerBehavior(Items.ACACIA_CHEST_BOAT, new BoatDispenseItemBehavior(Boat.Type.ACACIA, true)); - DispenserBlock.registerBehavior(Items.CHERRY_CHEST_BOAT, new BoatDispenseItemBehavior(Boat.Type.CHERRY, true)); - DispenserBlock.registerBehavior(Items.MANGROVE_CHEST_BOAT, new BoatDispenseItemBehavior(Boat.Type.MANGROVE, true)); - DispenserBlock.registerBehavior(Items.BAMBOO_CHEST_RAFT, new BoatDispenseItemBehavior(Boat.Type.BAMBOO, true)); + DispenserBlock.registerBehavior(Items.OAK_BOAT, new BoatDispenseItemBehavior(EntityType.OAK_BOAT)); + DispenserBlock.registerBehavior(Items.SPRUCE_BOAT, new BoatDispenseItemBehavior(EntityType.SPRUCE_BOAT)); + DispenserBlock.registerBehavior(Items.BIRCH_BOAT, new BoatDispenseItemBehavior(EntityType.BIRCH_BOAT)); + DispenserBlock.registerBehavior(Items.JUNGLE_BOAT, new BoatDispenseItemBehavior(EntityType.JUNGLE_BOAT)); + DispenserBlock.registerBehavior(Items.DARK_OAK_BOAT, new BoatDispenseItemBehavior(EntityType.DARK_OAK_BOAT)); + DispenserBlock.registerBehavior(Items.ACACIA_BOAT, new BoatDispenseItemBehavior(EntityType.ACACIA_BOAT)); + DispenserBlock.registerBehavior(Items.CHERRY_BOAT, new BoatDispenseItemBehavior(EntityType.CHERRY_BOAT)); + DispenserBlock.registerBehavior(Items.MANGROVE_BOAT, new BoatDispenseItemBehavior(EntityType.MANGROVE_BOAT)); + DispenserBlock.registerBehavior(Items.PALE_OAK_BOAT, new BoatDispenseItemBehavior(EntityType.PALE_OAK_BOAT)); + DispenserBlock.registerBehavior(Items.BAMBOO_RAFT, new BoatDispenseItemBehavior(EntityType.BAMBOO_RAFT)); + DispenserBlock.registerBehavior(Items.OAK_CHEST_BOAT, new BoatDispenseItemBehavior(EntityType.OAK_CHEST_BOAT)); + DispenserBlock.registerBehavior(Items.SPRUCE_CHEST_BOAT, new BoatDispenseItemBehavior(EntityType.SPRUCE_CHEST_BOAT)); + DispenserBlock.registerBehavior(Items.BIRCH_CHEST_BOAT, new BoatDispenseItemBehavior(EntityType.BIRCH_CHEST_BOAT)); + DispenserBlock.registerBehavior(Items.JUNGLE_CHEST_BOAT, new BoatDispenseItemBehavior(EntityType.JUNGLE_CHEST_BOAT)); + DispenserBlock.registerBehavior(Items.DARK_OAK_CHEST_BOAT, new BoatDispenseItemBehavior(EntityType.DARK_OAK_CHEST_BOAT)); + DispenserBlock.registerBehavior(Items.ACACIA_CHEST_BOAT, new BoatDispenseItemBehavior(EntityType.ACACIA_CHEST_BOAT)); + DispenserBlock.registerBehavior(Items.CHERRY_CHEST_BOAT, new BoatDispenseItemBehavior(EntityType.CHERRY_CHEST_BOAT)); + DispenserBlock.registerBehavior(Items.MANGROVE_CHEST_BOAT, new BoatDispenseItemBehavior(EntityType.MANGROVE_CHEST_BOAT)); + DispenserBlock.registerBehavior(Items.PALE_OAK_CHEST_BOAT, new BoatDispenseItemBehavior(EntityType.PALE_OAK_CHEST_BOAT)); + DispenserBlock.registerBehavior(Items.BAMBOO_CHEST_RAFT, new BoatDispenseItemBehavior(EntityType.BAMBOO_CHEST_RAFT)); DispenseItemBehavior dispenseItemBehavior = new DefaultDispenseItemBehavior() { private final DefaultDispenseItemBehavior defaultDispenseItemBehavior = new DefaultDispenseItemBehavior(); @@ -318,19 +279,6 @@ public interface DispenseItemBehavior { return item; } }); - DispenseItemBehavior dispenseItemBehavior2 = new OptionalDispenseItemBehavior() { - @Override - protected ItemStack execute(BlockSource blockSource, ItemStack item) { - this.setSuccess(ArmorItem.dispenseArmor(blockSource, item)); - return item; - } - }; - DispenserBlock.registerBehavior(Items.CREEPER_HEAD, dispenseItemBehavior2); - DispenserBlock.registerBehavior(Items.ZOMBIE_HEAD, dispenseItemBehavior2); - DispenserBlock.registerBehavior(Items.DRAGON_HEAD, dispenseItemBehavior2); - DispenserBlock.registerBehavior(Items.SKELETON_SKULL, dispenseItemBehavior2); - DispenserBlock.registerBehavior(Items.PIGLIN_HEAD, dispenseItemBehavior2); - DispenserBlock.registerBehavior(Items.PLAYER_HEAD, dispenseItemBehavior2); DispenserBlock.registerBehavior(Items.WITHER_SKELETON_SKULL, new OptionalDispenseItemBehavior() { @Override protected ItemStack execute(BlockSource blockSource, ItemStack item) { @@ -348,7 +296,7 @@ public interface DispenseItemBehavior { item.shrink(1); this.setSuccess(true); } else { - this.setSuccess(ArmorItem.dispenseArmor(blockSource, item)); + this.setSuccess(EquipmentDispenseItemBehavior.dispenseEquipment(blockSource, item)); } return item; @@ -369,7 +317,7 @@ public interface DispenseItemBehavior { item.shrink(1); this.setSuccess(true); } else { - this.setSuccess(ArmorItem.dispenseArmor(blockSource, item)); + this.setSuccess(EquipmentDispenseItemBehavior.dispenseEquipment(blockSource, item)); } return item; @@ -384,9 +332,9 @@ public interface DispenseItemBehavior { DispenserBlock.registerBehavior( Items.GLASS_BOTTLE.asItem(), new OptionalDispenseItemBehavior() { - private ItemStack takeLiquid(BlockSource source, ItemStack emptyItem, ItemStack fullItem) { - source.level().gameEvent(null, GameEvent.FLUID_PICKUP, source.pos()); - return this.consumeWithRemainder(source, emptyItem, fullItem); + private ItemStack takeLiquid(BlockSource blockSource, ItemStack itemStack, ItemStack itemStack2) { + blockSource.level().gameEvent(null, GameEvent.FLUID_PICKUP, blockSource.pos()); + return this.consumeWithRemainder(blockSource, itemStack, itemStack2); } @Override @@ -517,5 +465,11 @@ public interface DispenseItemBehavior { } } ); + DispenserBlock.registerBehavior(Items.MINECART, new MinecartDispenseItemBehavior(EntityType.MINECART)); + DispenserBlock.registerBehavior(Items.CHEST_MINECART, new MinecartDispenseItemBehavior(EntityType.CHEST_MINECART)); + DispenserBlock.registerBehavior(Items.FURNACE_MINECART, new MinecartDispenseItemBehavior(EntityType.FURNACE_MINECART)); + DispenserBlock.registerBehavior(Items.TNT_MINECART, new MinecartDispenseItemBehavior(EntityType.TNT_MINECART)); + DispenserBlock.registerBehavior(Items.HOPPER_MINECART, new MinecartDispenseItemBehavior(EntityType.HOPPER_MINECART)); + DispenserBlock.registerBehavior(Items.COMMAND_BLOCK_MINECART, new MinecartDispenseItemBehavior(EntityType.COMMAND_BLOCK_MINECART)); } } diff --git a/net/minecraft/core/dispenser/EquipmentDispenseItemBehavior.java b/net/minecraft/core/dispenser/EquipmentDispenseItemBehavior.java new file mode 100644 index 00000000..5d5d77ca --- /dev/null +++ b/net/minecraft/core/dispenser/EquipmentDispenseItemBehavior.java @@ -0,0 +1,39 @@ +package net.minecraft.core.dispenser; + +import java.util.List; +import net.minecraft.core.BlockPos; +import net.minecraft.world.entity.EquipmentSlot; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.Mob; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.block.DispenserBlock; +import net.minecraft.world.phys.AABB; + +public class EquipmentDispenseItemBehavior extends DefaultDispenseItemBehavior { + public static final EquipmentDispenseItemBehavior INSTANCE = new EquipmentDispenseItemBehavior(); + + @Override + protected ItemStack execute(BlockSource blockSource, ItemStack item) { + return dispenseEquipment(blockSource, item) ? item : super.execute(blockSource, item); + } + + public static boolean dispenseEquipment(BlockSource blockSource, ItemStack itemStack) { + BlockPos blockPos = blockSource.pos().relative(blockSource.state().getValue(DispenserBlock.FACING)); + List list = blockSource.level() + .getEntitiesOfClass(LivingEntity.class, new AABB(blockPos), livingEntityx -> livingEntityx.canEquipWithDispenser(itemStack)); + if (list.isEmpty()) { + return false; + } else { + LivingEntity livingEntity = (LivingEntity)list.getFirst(); + EquipmentSlot equipmentSlot = livingEntity.getEquipmentSlotForItem(itemStack); + ItemStack itemStack2 = itemStack.split(1); + livingEntity.setItemSlot(equipmentSlot, itemStack2); + if (livingEntity instanceof Mob mob) { + mob.setDropChance(equipmentSlot, 2.0F); + mob.setPersistenceRequired(); + } + + return true; + } + } +} diff --git a/net/minecraft/core/dispenser/MinecartDispenseItemBehavior.java b/net/minecraft/core/dispenser/MinecartDispenseItemBehavior.java new file mode 100644 index 00000000..ccfaa75b --- /dev/null +++ b/net/minecraft/core/dispenser/MinecartDispenseItemBehavior.java @@ -0,0 +1,79 @@ +package net.minecraft.core.dispenser; + +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.tags.BlockTags; +import net.minecraft.world.entity.EntitySpawnReason; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.vehicle.AbstractMinecart; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.block.BaseRailBlock; +import net.minecraft.world.level.block.DispenserBlock; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.properties.RailShape; +import net.minecraft.world.phys.Vec3; + +public class MinecartDispenseItemBehavior extends DefaultDispenseItemBehavior { + private final DefaultDispenseItemBehavior defaultDispenseItemBehavior = new DefaultDispenseItemBehavior(); + private final EntityType entityType; + + public MinecartDispenseItemBehavior(EntityType entityType) { + this.entityType = entityType; + } + + @Override + public ItemStack execute(BlockSource blockSource, ItemStack item) { + Direction direction = blockSource.state().getValue(DispenserBlock.FACING); + ServerLevel serverLevel = blockSource.level(); + Vec3 vec3 = blockSource.center(); + double d = vec3.x() + direction.getStepX() * 1.125; + double e = Math.floor(vec3.y()) + direction.getStepY(); + double f = vec3.z() + direction.getStepZ() * 1.125; + BlockPos blockPos = blockSource.pos().relative(direction); + BlockState blockState = serverLevel.getBlockState(blockPos); + double g; + if (blockState.is(BlockTags.RAILS)) { + if (getRailShape(blockState).isSlope()) { + g = 0.6; + } else { + g = 0.1; + } + } else { + if (!blockState.isAir()) { + return this.defaultDispenseItemBehavior.dispense(blockSource, item); + } + + BlockState blockState2 = serverLevel.getBlockState(blockPos.below()); + if (!blockState2.is(BlockTags.RAILS)) { + return this.defaultDispenseItemBehavior.dispense(blockSource, item); + } + + if (direction != Direction.DOWN && getRailShape(blockState2).isSlope()) { + g = -0.4; + } else { + g = -0.9; + } + } + + Vec3 vec32 = new Vec3(d, e + g, f); + AbstractMinecart abstractMinecart = AbstractMinecart.createMinecart( + serverLevel, vec32.x, vec32.y, vec32.z, this.entityType, EntitySpawnReason.DISPENSER, item, null + ); + if (abstractMinecart != null) { + serverLevel.addFreshEntity(abstractMinecart); + item.shrink(1); + } + + return item; + } + + private static RailShape getRailShape(BlockState blockState) { + return blockState.getBlock() instanceof BaseRailBlock baseRailBlock ? blockState.getValue(baseRailBlock.getShapeProperty()) : RailShape.NORTH_SOUTH; + } + + @Override + protected void playSound(BlockSource blockSource) { + blockSource.level().levelEvent(1000, blockSource.pos(), 0); + } +} diff --git a/net/minecraft/core/dispenser/ProjectileDispenseBehavior.java b/net/minecraft/core/dispenser/ProjectileDispenseBehavior.java index 0c464daa..9dae54b9 100644 --- a/net/minecraft/core/dispenser/ProjectileDispenseBehavior.java +++ b/net/minecraft/core/dispenser/ProjectileDispenseBehavior.java @@ -2,16 +2,17 @@ package net.minecraft.core.dispenser; import net.minecraft.core.Direction; import net.minecraft.core.Position; +import net.minecraft.server.level.ServerLevel; import net.minecraft.world.entity.projectile.Projectile; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ProjectileItem; -import net.minecraft.world.level.Level; +import net.minecraft.world.item.ProjectileItem.DispenseConfig; import net.minecraft.world.level.block.DispenserBlock; public class ProjectileDispenseBehavior extends DefaultDispenseItemBehavior { private final ProjectileItem projectileItem; - private final ProjectileItem.DispenseConfig dispenseConfig; + private final DispenseConfig dispenseConfig; public ProjectileDispenseBehavior(Item projectile) { if (projectile instanceof ProjectileItem projectileItem) { @@ -24,13 +25,19 @@ public class ProjectileDispenseBehavior extends DefaultDispenseItemBehavior { @Override public ItemStack execute(BlockSource blockSource, ItemStack item) { - Level level = blockSource.level(); + ServerLevel serverLevel = blockSource.level(); Direction direction = blockSource.state().getValue(DispenserBlock.FACING); Position position = this.dispenseConfig.positionFunction().getDispensePosition(blockSource, direction); - Projectile projectile = this.projectileItem.asProjectile(level, position, item, direction); - this.projectileItem - .shoot(projectile, direction.getStepX(), direction.getStepY(), direction.getStepZ(), this.dispenseConfig.power(), this.dispenseConfig.uncertainty()); - level.addFreshEntity(projectile); + Projectile.spawnProjectileUsingShoot( + this.projectileItem.asProjectile(serverLevel, position, item, direction), + serverLevel, + item, + direction.getStepX(), + direction.getStepY(), + direction.getStepZ(), + this.dispenseConfig.power(), + this.dispenseConfig.uncertainty() + ); item.shrink(1); return item; } diff --git a/net/minecraft/core/dispenser/ShearsDispenseItemBehavior.java b/net/minecraft/core/dispenser/ShearsDispenseItemBehavior.java index f43a436b..f102baf4 100644 --- a/net/minecraft/core/dispenser/ShearsDispenseItemBehavior.java +++ b/net/minecraft/core/dispenser/ShearsDispenseItemBehavior.java @@ -22,7 +22,7 @@ public class ShearsDispenseItemBehavior extends OptionalDispenseItemBehavior { ServerLevel serverLevel = blockSource.level(); if (!serverLevel.isClientSide()) { BlockPos blockPos = blockSource.pos().relative(blockSource.state().getValue(DispenserBlock.FACING)); - this.setSuccess(tryShearBeehive(serverLevel, blockPos) || tryShearLivingEntity(serverLevel, blockPos)); + this.setSuccess(tryShearBeehive(serverLevel, blockPos) || tryShearLivingEntity(serverLevel, blockPos, item)); if (this.isSuccess()) { item.hurtAndBreak(1, serverLevel, null, itemx -> {}); } @@ -49,11 +49,11 @@ public class ShearsDispenseItemBehavior extends OptionalDispenseItemBehavior { return false; } - private static boolean tryShearLivingEntity(ServerLevel level, BlockPos pos) { - for (LivingEntity livingEntity : level.getEntitiesOfClass(LivingEntity.class, new AABB(pos), EntitySelector.NO_SPECTATORS)) { + private static boolean tryShearLivingEntity(ServerLevel serverLevel, BlockPos blockPos, ItemStack itemStack) { + for (LivingEntity livingEntity : serverLevel.getEntitiesOfClass(LivingEntity.class, new AABB(blockPos), EntitySelector.NO_SPECTATORS)) { if (livingEntity instanceof Shearable shearable && shearable.readyForShearing()) { - shearable.shear(SoundSource.BLOCKS); - level.gameEvent(null, GameEvent.SHEAR, pos); + shearable.shear(serverLevel, SoundSource.BLOCKS, itemStack); + serverLevel.gameEvent(null, GameEvent.SHEAR, blockPos); return true; } } diff --git a/net/minecraft/core/particles/ColorParticleOption.java b/net/minecraft/core/particles/ColorParticleOption.java index 1c4c68c4..77cef2f5 100644 --- a/net/minecraft/core/particles/ColorParticleOption.java +++ b/net/minecraft/core/particles/ColorParticleOption.java @@ -4,8 +4,8 @@ import com.mojang.serialization.MapCodec; import io.netty.buffer.ByteBuf; import net.minecraft.network.codec.ByteBufCodecs; import net.minecraft.network.codec.StreamCodec; +import net.minecraft.util.ARGB; import net.minecraft.util.ExtraCodecs; -import net.minecraft.util.FastColor; public class ColorParticleOption implements ParticleOptions { private final ParticleType type; @@ -32,19 +32,19 @@ public class ColorParticleOption implements ParticleOptions { } public float getRed() { - return FastColor.ARGB32.red(this.color) / 255.0F; + return ARGB.red(this.color) / 255.0F; } public float getGreen() { - return FastColor.ARGB32.green(this.color) / 255.0F; + return ARGB.green(this.color) / 255.0F; } public float getBlue() { - return FastColor.ARGB32.blue(this.color) / 255.0F; + return ARGB.blue(this.color) / 255.0F; } public float getAlpha() { - return FastColor.ARGB32.alpha(this.color) / 255.0F; + return ARGB.alpha(this.color) / 255.0F; } public static ColorParticleOption create(ParticleType type, int color) { @@ -52,6 +52,6 @@ public class ColorParticleOption implements ParticleOptions { } public static ColorParticleOption create(ParticleType type, float red, float green, float blue) { - return create(type, FastColor.ARGB32.colorFromFloat(1.0F, red, green, blue)); + return create(type, ARGB.colorFromFloat(1.0F, red, green, blue)); } } diff --git a/net/minecraft/core/particles/DustColorTransitionOptions.java b/net/minecraft/core/particles/DustColorTransitionOptions.java index b7ed1378..71720a27 100644 --- a/net/minecraft/core/particles/DustColorTransitionOptions.java +++ b/net/minecraft/core/particles/DustColorTransitionOptions.java @@ -5,47 +5,45 @@ import com.mojang.serialization.codecs.RecordCodecBuilder; import net.minecraft.network.RegistryFriendlyByteBuf; import net.minecraft.network.codec.ByteBufCodecs; import net.minecraft.network.codec.StreamCodec; +import net.minecraft.util.ARGB; import net.minecraft.util.ExtraCodecs; -import net.minecraft.world.phys.Vec3; import org.joml.Vector3f; public class DustColorTransitionOptions extends ScalableParticleOptionsBase { - public static final Vector3f SCULK_PARTICLE_COLOR = Vec3.fromRGB24(3790560).toVector3f(); - public static final DustColorTransitionOptions SCULK_TO_REDSTONE = new DustColorTransitionOptions( - SCULK_PARTICLE_COLOR, DustParticleOptions.REDSTONE_PARTICLE_COLOR, 1.0F - ); + public static final int SCULK_PARTICLE_COLOR = 3790560; + public static final DustColorTransitionOptions SCULK_TO_REDSTONE = new DustColorTransitionOptions(3790560, 16711680, 1.0F); public static final MapCodec CODEC = RecordCodecBuilder.mapCodec( instance -> instance.group( - ExtraCodecs.VECTOR3F.fieldOf("from_color").forGetter(dustColorTransitionOptions -> dustColorTransitionOptions.fromColor), - ExtraCodecs.VECTOR3F.fieldOf("to_color").forGetter(dustColorTransitionOptions -> dustColorTransitionOptions.toColor), + ExtraCodecs.RGB_COLOR_CODEC.fieldOf("from_color").forGetter(dustColorTransitionOptions -> dustColorTransitionOptions.fromColor), + ExtraCodecs.RGB_COLOR_CODEC.fieldOf("to_color").forGetter(dustColorTransitionOptions -> dustColorTransitionOptions.toColor), SCALE.fieldOf("scale").forGetter(ScalableParticleOptionsBase::getScale) ) .apply(instance, DustColorTransitionOptions::new) ); public static final StreamCodec STREAM_CODEC = StreamCodec.composite( - ByteBufCodecs.VECTOR3F, + ByteBufCodecs.INT, dustColorTransitionOptions -> dustColorTransitionOptions.fromColor, - ByteBufCodecs.VECTOR3F, + ByteBufCodecs.INT, dustColorTransitionOptions -> dustColorTransitionOptions.toColor, ByteBufCodecs.FLOAT, ScalableParticleOptionsBase::getScale, DustColorTransitionOptions::new ); - private final Vector3f fromColor; - private final Vector3f toColor; + private final int fromColor; + private final int toColor; - public DustColorTransitionOptions(Vector3f color, Vector3f toColor, float scale) { - super(scale); - this.fromColor = color; - this.toColor = toColor; + public DustColorTransitionOptions(int i, int j, float f) { + super(f); + this.fromColor = i; + this.toColor = j; } public Vector3f getFromColor() { - return this.fromColor; + return ARGB.vector3fFromRGB24(this.fromColor); } public Vector3f getToColor() { - return this.toColor; + return ARGB.vector3fFromRGB24(this.toColor); } @Override diff --git a/net/minecraft/core/particles/DustParticleOptions.java b/net/minecraft/core/particles/DustParticleOptions.java index 98418aca..ca70e604 100644 --- a/net/minecraft/core/particles/DustParticleOptions.java +++ b/net/minecraft/core/particles/DustParticleOptions.java @@ -5,32 +5,28 @@ import com.mojang.serialization.codecs.RecordCodecBuilder; import net.minecraft.network.RegistryFriendlyByteBuf; import net.minecraft.network.codec.ByteBufCodecs; import net.minecraft.network.codec.StreamCodec; +import net.minecraft.util.ARGB; import net.minecraft.util.ExtraCodecs; -import net.minecraft.world.phys.Vec3; import org.joml.Vector3f; public class DustParticleOptions extends ScalableParticleOptionsBase { - public static final Vector3f REDSTONE_PARTICLE_COLOR = Vec3.fromRGB24(16711680).toVector3f(); - public static final DustParticleOptions REDSTONE = new DustParticleOptions(REDSTONE_PARTICLE_COLOR, 1.0F); + public static final int REDSTONE_PARTICLE_COLOR = 16711680; + public static final DustParticleOptions REDSTONE = new DustParticleOptions(16711680, 1.0F); public static final MapCodec CODEC = RecordCodecBuilder.mapCodec( instance -> instance.group( - ExtraCodecs.VECTOR3F.fieldOf("color").forGetter(dustParticleOptions -> dustParticleOptions.color), + ExtraCodecs.RGB_COLOR_CODEC.fieldOf("color").forGetter(dustParticleOptions -> dustParticleOptions.color), SCALE.fieldOf("scale").forGetter(ScalableParticleOptionsBase::getScale) ) .apply(instance, DustParticleOptions::new) ); public static final StreamCodec STREAM_CODEC = StreamCodec.composite( - ByteBufCodecs.VECTOR3F, - dustParticleOptions -> dustParticleOptions.color, - ByteBufCodecs.FLOAT, - ScalableParticleOptionsBase::getScale, - DustParticleOptions::new + ByteBufCodecs.INT, dustParticleOptions -> dustParticleOptions.color, ByteBufCodecs.FLOAT, ScalableParticleOptionsBase::getScale, DustParticleOptions::new ); - private final Vector3f color; + private final int color; - public DustParticleOptions(Vector3f color, float scale) { - super(scale); - this.color = color; + public DustParticleOptions(int i, float f) { + super(f); + this.color = i; } @Override @@ -39,6 +35,6 @@ public class DustParticleOptions extends ScalableParticleOptionsBase { } public Vector3f getColor() { - return this.color; + return ARGB.vector3fFromRGB24(this.color); } } diff --git a/net/minecraft/core/particles/ItemParticleOption.java b/net/minecraft/core/particles/ItemParticleOption.java index b10ccc8e..a81c79b0 100644 --- a/net/minecraft/core/particles/ItemParticleOption.java +++ b/net/minecraft/core/particles/ItemParticleOption.java @@ -4,10 +4,11 @@ import com.mojang.serialization.Codec; import com.mojang.serialization.MapCodec; import net.minecraft.network.RegistryFriendlyByteBuf; import net.minecraft.network.codec.StreamCodec; +import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; public class ItemParticleOption implements ParticleOptions { - private static final Codec ITEM_CODEC = Codec.withAlternative(ItemStack.SINGLE_ITEM_CODEC, ItemStack.ITEM_NON_AIR_CODEC, ItemStack::new); + private static final Codec ITEM_CODEC = Codec.withAlternative(ItemStack.SINGLE_ITEM_CODEC, Item.CODEC, ItemStack::new); private final ParticleType type; private final ItemStack itemStack; diff --git a/net/minecraft/core/particles/ParticleTypes.java b/net/minecraft/core/particles/ParticleTypes.java index 5556ebcb..48acbc88 100644 --- a/net/minecraft/core/particles/ParticleTypes.java +++ b/net/minecraft/core/particles/ParticleTypes.java @@ -71,6 +71,9 @@ public class ParticleTypes { public static final ParticleType VIBRATION = register( "vibration", true, particleType -> VibrationParticleOption.CODEC, particleType -> VibrationParticleOption.STREAM_CODEC ); + public static final ParticleType TRAIL = register( + "trail", false, particleType -> TargetColorParticleOption.CODEC, particleType -> TargetColorParticleOption.STREAM_CODEC + ); public static final SimpleParticleType ITEM_SLIME = register("item_slime", false); public static final SimpleParticleType ITEM_COBWEB = register("item_cobweb", false); public static final SimpleParticleType ITEM_SNOWBALL = register("item_snowball", false); @@ -138,6 +141,9 @@ public class ParticleTypes { public static final SimpleParticleType OMINOUS_SPAWNING = register("ominous_spawning", true); public static final SimpleParticleType RAID_OMEN = register("raid_omen", false); public static final SimpleParticleType TRIAL_OMEN = register("trial_omen", false); + public static final ParticleType BLOCK_CRUMBLE = register( + "block_crumble", false, BlockParticleOption::codec, BlockParticleOption::streamCodec + ); public static final Codec CODEC = BuiltInRegistries.PARTICLE_TYPE .byNameCodec() .dispatch("type", ParticleOptions::getType, ParticleType::codec); diff --git a/net/minecraft/core/particles/TargetColorParticleOption.java b/net/minecraft/core/particles/TargetColorParticleOption.java new file mode 100644 index 00000000..d51fc235 --- /dev/null +++ b/net/minecraft/core/particles/TargetColorParticleOption.java @@ -0,0 +1,27 @@ +package net.minecraft.core.particles; + +import com.mojang.serialization.MapCodec; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.util.ExtraCodecs; +import net.minecraft.world.phys.Vec3; + +public record TargetColorParticleOption(Vec3 target, int color) implements ParticleOptions { + public static final MapCodec CODEC = RecordCodecBuilder.mapCodec( + instance -> instance.group( + Vec3.CODEC.fieldOf("target").forGetter(TargetColorParticleOption::target), + ExtraCodecs.RGB_COLOR_CODEC.fieldOf("color").forGetter(TargetColorParticleOption::color) + ) + .apply(instance, TargetColorParticleOption::new) + ); + public static final StreamCodec STREAM_CODEC = StreamCodec.composite( + Vec3.STREAM_CODEC, TargetColorParticleOption::target, ByteBufCodecs.INT, TargetColorParticleOption::color, TargetColorParticleOption::new + ); + + @Override + public ParticleType getType() { + return ParticleTypes.TRAIL; + } +} diff --git a/net/minecraft/core/registries/BuiltInRegistries.java b/net/minecraft/core/registries/BuiltInRegistries.java index c9b9cab8..788802c8 100644 --- a/net/minecraft/core/registries/BuiltInRegistries.java +++ b/net/minecraft/core/registries/BuiltInRegistries.java @@ -11,12 +11,13 @@ import net.minecraft.advancements.CriteriaTriggers; import net.minecraft.advancements.CriterionTrigger; import net.minecraft.advancements.critereon.EntitySubPredicate; import net.minecraft.advancements.critereon.EntitySubPredicates; -import net.minecraft.advancements.critereon.ItemSubPredicate; import net.minecraft.advancements.critereon.ItemSubPredicates; +import net.minecraft.advancements.critereon.ItemSubPredicate.Type; import net.minecraft.commands.synchronization.ArgumentTypeInfo; import net.minecraft.commands.synchronization.ArgumentTypeInfos; import net.minecraft.core.DefaultedMappedRegistry; import net.minecraft.core.DefaultedRegistry; +import net.minecraft.core.HolderGetter; import net.minecraft.core.MappedRegistry; import net.minecraft.core.RegistrationInfo; import net.minecraft.core.Registry; @@ -52,18 +53,21 @@ import net.minecraft.world.entity.npc.VillagerType; import net.minecraft.world.entity.schedule.Activity; import net.minecraft.world.entity.schedule.Schedule; import net.minecraft.world.inventory.MenuType; -import net.minecraft.world.item.ArmorMaterial; -import net.minecraft.world.item.ArmorMaterials; import net.minecraft.world.item.CreativeModeTab; import net.minecraft.world.item.CreativeModeTabs; -import net.minecraft.world.item.Instrument; -import net.minecraft.world.item.Instruments; import net.minecraft.world.item.Item; import net.minecraft.world.item.Items; import net.minecraft.world.item.alchemy.Potion; import net.minecraft.world.item.alchemy.Potions; +import net.minecraft.world.item.consume_effects.ConsumeEffect; +import net.minecraft.world.item.crafting.RecipeBookCategories; +import net.minecraft.world.item.crafting.RecipeBookCategory; import net.minecraft.world.item.crafting.RecipeSerializer; import net.minecraft.world.item.crafting.RecipeType; +import net.minecraft.world.item.crafting.display.RecipeDisplay; +import net.minecraft.world.item.crafting.display.RecipeDisplays; +import net.minecraft.world.item.crafting.display.SlotDisplay; +import net.minecraft.world.item.crafting.display.SlotDisplays; import net.minecraft.world.item.enchantment.EnchantmentEffectComponents; import net.minecraft.world.item.enchantment.LevelBasedValue; import net.minecraft.world.item.enchantment.effects.EnchantmentEntityEffect; @@ -245,19 +249,15 @@ public class BuiltInRegistries { ); public static final Registry CAT_VARIANT = registerSimple(Registries.CAT_VARIANT, CatVariant::bootstrap); public static final Registry FROG_VARIANT = registerSimple(Registries.FROG_VARIANT, FrogVariant::bootstrap); - public static final Registry INSTRUMENT = registerSimple(Registries.INSTRUMENT, Instruments::bootstrap); public static final Registry DECORATED_POT_PATTERN = registerSimple(Registries.DECORATED_POT_PATTERN, DecoratedPotPatterns::bootstrap); public static final Registry CREATIVE_MODE_TAB = registerSimple(Registries.CREATIVE_MODE_TAB, CreativeModeTabs::bootstrap); public static final Registry> TRIGGER_TYPES = registerSimple(Registries.TRIGGER_TYPE, CriteriaTriggers::bootstrap); public static final Registry> NUMBER_FORMAT_TYPE = registerSimple(Registries.NUMBER_FORMAT_TYPE, NumberFormatTypes::bootstrap); - public static final Registry ARMOR_MATERIAL = registerSimple(Registries.ARMOR_MATERIAL, ArmorMaterials::bootstrap); public static final Registry> DATA_COMPONENT_TYPE = registerSimple(Registries.DATA_COMPONENT_TYPE, DataComponents::bootstrap); public static final Registry> ENTITY_SUB_PREDICATE_TYPE = registerSimple( Registries.ENTITY_SUB_PREDICATE_TYPE, EntitySubPredicates::bootstrap ); - public static final Registry> ITEM_SUB_PREDICATE_TYPE = registerSimple( - Registries.ITEM_SUB_PREDICATE_TYPE, ItemSubPredicates::bootstrap - ); + public static final Registry> ITEM_SUB_PREDICATE_TYPE = registerSimple(Registries.ITEM_SUB_PREDICATE_TYPE, ItemSubPredicates::bootstrap); public static final Registry MAP_DECORATION_TYPE = registerSimple(Registries.MAP_DECORATION_TYPE, MapDecorationTypes::bootstrap); public static final Registry> ENCHANTMENT_EFFECT_COMPONENT_TYPE = registerSimple( Registries.ENCHANTMENT_EFFECT_COMPONENT_TYPE, EnchantmentEffectComponents::bootstrap @@ -277,6 +277,12 @@ public class BuiltInRegistries { public static final Registry> ENCHANTMENT_PROVIDER_TYPE = registerSimple( Registries.ENCHANTMENT_PROVIDER_TYPE, EnchantmentProviderTypes::bootstrap ); + public static final Registry> CONSUME_EFFECT_TYPE = registerSimple( + Registries.CONSUME_EFFECT_TYPE, registry -> ConsumeEffect.Type.APPLY_EFFECTS + ); + public static final Registry> RECIPE_DISPLAY = registerSimple(Registries.RECIPE_DISPLAY, RecipeDisplays::bootstrap); + public static final Registry> SLOT_DISPLAY = registerSimple(Registries.SLOT_DISPLAY, SlotDisplays::bootstrap); + public static final Registry RECIPE_BOOK_CATEGORY = registerSimple(Registries.RECIPE_BOOK_CATEGORY, RecipeBookCategories::bootstrap); public static final Registry> REGISTRY = WRITABLE_REGISTRY; private static Registry registerSimple(ResourceKey> key, BuiltInRegistries.RegistryBootstrap bootstrap) { @@ -302,7 +308,7 @@ public class BuiltInRegistries { private static > R internalRegister( ResourceKey> key, R registry, BuiltInRegistries.RegistryBootstrap bootstrap ) { - Bootstrap.checkBootstrapCalled(() -> "registry " + key); + Bootstrap.checkBootstrapCalled(() -> "registry " + key.location()); ResourceLocation resourceLocation = key.location(); LOADERS.put(resourceLocation, (Supplier)() -> bootstrap.run(registry)); WRITABLE_REGISTRY.register((ResourceKey>)key, registry, RegistrationInfo.BUILT_IN); @@ -327,6 +333,7 @@ public class BuiltInRegistries { REGISTRY.freeze(); for (Registry registry : REGISTRY) { + bindBootstrappedTagsToEmpty(registry); registry.freeze(); } } @@ -339,11 +346,19 @@ public class BuiltInRegistries { if (registry2 instanceof DefaultedRegistry) { ResourceLocation resourceLocation = ((DefaultedRegistry)registry2).getDefaultKey(); - Validate.notNull(registry2.get(resourceLocation), "Missing default of DefaultedMappedRegistry: " + resourceLocation); + Validate.notNull(registry2.getValue(resourceLocation), "Missing default of DefaultedMappedRegistry: " + resourceLocation); } }); } + public static HolderGetter acquireBootstrapRegistrationLookup(Registry registry) { + return ((WritableRegistry)registry).createRegistrationLookup(); + } + + private static void bindBootstrappedTagsToEmpty(Registry registry) { + ((MappedRegistry)registry).bindAllTagsToEmpty(); + } + @FunctionalInterface interface RegistryBootstrap { Object run(Registry registry); diff --git a/net/minecraft/core/registries/Registries.java b/net/minecraft/core/registries/Registries.java index 7d20d029..1ec289fb 100644 --- a/net/minecraft/core/registries/Registries.java +++ b/net/minecraft/core/registries/Registries.java @@ -4,7 +4,7 @@ import com.mojang.serialization.MapCodec; import net.minecraft.advancements.Advancement; import net.minecraft.advancements.CriterionTrigger; import net.minecraft.advancements.critereon.EntitySubPredicate; -import net.minecraft.advancements.critereon.ItemSubPredicate; +import net.minecraft.advancements.critereon.ItemSubPredicate.Type; import net.minecraft.commands.synchronization.ArgumentTypeInfo; import net.minecraft.core.Registry; import net.minecraft.core.component.DataComponentType; @@ -33,23 +33,26 @@ import net.minecraft.world.entity.npc.VillagerType; import net.minecraft.world.entity.schedule.Activity; import net.minecraft.world.entity.schedule.Schedule; import net.minecraft.world.inventory.MenuType; -import net.minecraft.world.item.ArmorMaterial; import net.minecraft.world.item.CreativeModeTab; import net.minecraft.world.item.Instrument; import net.minecraft.world.item.Item; import net.minecraft.world.item.JukeboxSong; import net.minecraft.world.item.alchemy.Potion; -import net.minecraft.world.item.armortrim.TrimMaterial; -import net.minecraft.world.item.armortrim.TrimPattern; +import net.minecraft.world.item.consume_effects.ConsumeEffect; import net.minecraft.world.item.crafting.Recipe; +import net.minecraft.world.item.crafting.RecipeBookCategory; import net.minecraft.world.item.crafting.RecipeSerializer; import net.minecraft.world.item.crafting.RecipeType; +import net.minecraft.world.item.crafting.display.RecipeDisplay; +import net.minecraft.world.item.crafting.display.SlotDisplay; import net.minecraft.world.item.enchantment.Enchantment; import net.minecraft.world.item.enchantment.LevelBasedValue; import net.minecraft.world.item.enchantment.effects.EnchantmentEntityEffect; import net.minecraft.world.item.enchantment.effects.EnchantmentLocationBasedEffect; import net.minecraft.world.item.enchantment.effects.EnchantmentValueEffect; import net.minecraft.world.item.enchantment.providers.EnchantmentProvider; +import net.minecraft.world.item.equipment.trim.TrimMaterial; +import net.minecraft.world.item.equipment.trim.TrimPattern; import net.minecraft.world.level.Level; import net.minecraft.world.level.biome.Biome; import net.minecraft.world.level.biome.BiomeSource; @@ -58,6 +61,7 @@ import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.entity.BannerPattern; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.entity.DecoratedPotPattern; +import net.minecraft.world.level.block.entity.trialspawner.TrialSpawnerConfig; import net.minecraft.world.level.chunk.ChunkGenerator; import net.minecraft.world.level.chunk.status.ChunkStatus; import net.minecraft.world.level.dimension.DimensionType; @@ -96,7 +100,7 @@ import net.minecraft.world.level.levelgen.structure.templatesystem.RuleTestType; import net.minecraft.world.level.levelgen.structure.templatesystem.StructureProcessorList; import net.minecraft.world.level.levelgen.structure.templatesystem.StructureProcessorType; import net.minecraft.world.level.levelgen.structure.templatesystem.rule.blockentity.RuleBlockEntityModifierType; -import net.minecraft.world.level.levelgen.synth.NormalNoise; +import net.minecraft.world.level.levelgen.synth.NormalNoise.NoiseParameters; import net.minecraft.world.level.material.Fluid; import net.minecraft.world.level.saveddata.maps.MapDecorationType; import net.minecraft.world.level.storage.loot.LootTable; @@ -197,12 +201,15 @@ public class Registries { public static final ResourceKey> VILLAGER_TYPE = createRegistryKey("villager_type"); public static final ResourceKey> DECORATED_POT_PATTERN = createRegistryKey("decorated_pot_pattern"); public static final ResourceKey>> NUMBER_FORMAT_TYPE = createRegistryKey("number_format_type"); - public static final ResourceKey> ARMOR_MATERIAL = createRegistryKey("armor_material"); public static final ResourceKey>> DATA_COMPONENT_TYPE = createRegistryKey("data_component_type"); public static final ResourceKey>> ENTITY_SUB_PREDICATE_TYPE = createRegistryKey("entity_sub_predicate_type"); - public static final ResourceKey>> ITEM_SUB_PREDICATE_TYPE = createRegistryKey("item_sub_predicate_type"); + public static final ResourceKey>> ITEM_SUB_PREDICATE_TYPE = createRegistryKey("item_sub_predicate_type"); public static final ResourceKey> MAP_DECORATION_TYPE = createRegistryKey("map_decoration_type"); public static final ResourceKey>> ENCHANTMENT_EFFECT_COMPONENT_TYPE = createRegistryKey("enchantment_effect_component_type"); + public static final ResourceKey>> CONSUME_EFFECT_TYPE = createRegistryKey("consume_effect_type"); + public static final ResourceKey>> RECIPE_DISPLAY = createRegistryKey("recipe_display"); + public static final ResourceKey>> SLOT_DISPLAY = createRegistryKey("slot_display"); + public static final ResourceKey> RECIPE_BOOK_CATEGORY = createRegistryKey("recipe_book_category"); public static final ResourceKey> BIOME = createRegistryKey("worldgen/biome"); public static final ResourceKey> CHAT_TYPE = createRegistryKey("chat_type"); public static final ResourceKey>> CONFIGURED_CARVER = createRegistryKey("worldgen/configured_carver"); @@ -213,7 +220,7 @@ public class Registries { public static final ResourceKey> ENCHANTMENT_PROVIDER = createRegistryKey("enchantment_provider"); public static final ResourceKey> FLAT_LEVEL_GENERATOR_PRESET = createRegistryKey("worldgen/flat_level_generator_preset"); public static final ResourceKey> NOISE_SETTINGS = createRegistryKey("worldgen/noise_settings"); - public static final ResourceKey> NOISE = createRegistryKey("worldgen/noise"); + public static final ResourceKey> NOISE = createRegistryKey("worldgen/noise"); public static final ResourceKey> PLACED_FEATURE = createRegistryKey("worldgen/placed_feature"); public static final ResourceKey> STRUCTURE = createRegistryKey("worldgen/structure"); public static final ResourceKey> PROCESSOR_LIST = createRegistryKey("worldgen/processor_list"); @@ -226,6 +233,7 @@ public class Registries { public static final ResourceKey> MULTI_NOISE_BIOME_SOURCE_PARAMETER_LIST = createRegistryKey( "worldgen/multi_noise_biome_source_parameter_list" ); + public static final ResourceKey> TRIAL_SPAWNER_CONFIG = createRegistryKey("trial_spawner"); public static final ResourceKey> DIMENSION = createRegistryKey("dimension"); public static final ResourceKey> LEVEL_STEM = createRegistryKey("dimension"); public static final ResourceKey> LOOT_TABLE = createRegistryKey("loot_table"); diff --git a/net/minecraft/data/BlockFamilies.java b/net/minecraft/data/BlockFamilies.java index e8e64569..6e2f43c6 100644 --- a/net/minecraft/data/BlockFamilies.java +++ b/net/minecraft/data/BlockFamilies.java @@ -4,6 +4,7 @@ import com.google.common.collect.Maps; import java.util.Map; import java.util.stream.Stream; import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.data.BlockFamily.Builder; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; @@ -102,6 +103,19 @@ public class BlockFamilies { .recipeGroupPrefix("wooden") .recipeUnlockedBy("has_planks") .getFamily(); + public static final BlockFamily PALE_OAK_PLANKS = familyBuilder(Blocks.PALE_OAK_PLANKS) + .button(Blocks.PALE_OAK_BUTTON) + .fence(Blocks.PALE_OAK_FENCE) + .fenceGate(Blocks.PALE_OAK_FENCE_GATE) + .pressurePlate(Blocks.PALE_OAK_PRESSURE_PLATE) + .sign(Blocks.PALE_OAK_SIGN, Blocks.PALE_OAK_WALL_SIGN) + .slab(Blocks.PALE_OAK_SLAB) + .stairs(Blocks.PALE_OAK_STAIRS) + .door(Blocks.PALE_OAK_DOOR) + .trapdoor(Blocks.PALE_OAK_TRAPDOOR) + .recipeGroupPrefix("wooden") + .recipeUnlockedBy("has_planks") + .getFamily(); public static final BlockFamily SPRUCE_PLANKS = familyBuilder(Blocks.SPRUCE_PLANKS) .button(Blocks.SPRUCE_BUTTON) .fence(Blocks.SPRUCE_FENCE) @@ -438,8 +452,8 @@ public class BlockFamilies { .cracked(Blocks.CRACKED_DEEPSLATE_TILES) .getFamily(); - private static BlockFamily.Builder familyBuilder(Block baseBlock) { - BlockFamily.Builder builder = new BlockFamily.Builder(baseBlock); + private static Builder familyBuilder(Block baseBlock) { + Builder builder = new Builder(baseBlock); BlockFamily blockFamily = (BlockFamily)MAP.put(baseBlock, builder.getFamily()); if (blockFamily != null) { throw new IllegalStateException("Duplicate family definition for " + BuiltInRegistries.BLOCK.getKey(baseBlock)); diff --git a/net/minecraft/data/DataProvider.java b/net/minecraft/data/DataProvider.java index 6d2bab88..d063cb01 100644 --- a/net/minecraft/data/DataProvider.java +++ b/net/minecraft/data/DataProvider.java @@ -6,6 +6,7 @@ import com.google.gson.JsonElement; import com.google.gson.stream.JsonWriter; import com.mojang.logging.LogUtils; import com.mojang.serialization.Codec; +import com.mojang.serialization.DynamicOps; import com.mojang.serialization.JsonOps; import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; import java.io.ByteArrayOutputStream; @@ -14,11 +15,14 @@ import java.io.OutputStreamWriter; import java.nio.charset.StandardCharsets; import java.nio.file.Path; import java.util.Comparator; +import java.util.Map; import java.util.concurrent.CompletableFuture; import java.util.function.ToIntFunction; import net.minecraft.Util; import net.minecraft.core.HolderLookup; +import net.minecraft.data.PackOutput.PathProvider; import net.minecraft.resources.RegistryOps; +import net.minecraft.resources.ResourceLocation; import net.minecraft.util.GsonHelper; import org.slf4j.Logger; @@ -38,10 +42,27 @@ public interface DataProvider { */ String getName(); + static CompletableFuture saveAll(CachedOutput cachedOutput, Codec codec, PathProvider pathProvider, Map map) { + return CompletableFuture.allOf( + (CompletableFuture[])map.entrySet() + .stream() + .map(entry -> saveStable(cachedOutput, codec, (T)entry.getValue(), pathProvider.json((ResourceLocation)entry.getKey()))) + .toArray(CompletableFuture[]::new) + ); + } + static CompletableFuture saveStable(CachedOutput output, HolderLookup.Provider registries, Codec codec, T value, Path path) { RegistryOps registryOps = registries.createSerializationContext(JsonOps.INSTANCE); - JsonElement jsonElement = codec.encodeStart(registryOps, value).getOrThrow(); - return saveStable(output, jsonElement, path); + return saveStable(output, registryOps, codec, value, path); + } + + static CompletableFuture saveStable(CachedOutput cachedOutput, Codec codec, T object, Path path) { + return saveStable(cachedOutput, JsonOps.INSTANCE, codec, object, path); + } + + private static CompletableFuture saveStable(CachedOutput cachedOutput, DynamicOps dynamicOps, Codec codec, T object, Path path) { + JsonElement jsonElement = codec.encodeStart(dynamicOps, object).getOrThrow(); + return saveStable(cachedOutput, jsonElement, path); } static CompletableFuture saveStable(CachedOutput output, JsonElement json, Path path) { @@ -70,7 +91,7 @@ public interface DataProvider { } catch (IOException var10) { LOGGER.error("Failed to save file to {}", path, var10); } - }, Util.backgroundExecutor()); + }, Util.backgroundExecutor().forName("saveStable")); } @FunctionalInterface diff --git a/net/minecraft/data/Main.java b/net/minecraft/data/Main.java index ba147c0a..3f9b207a 100644 --- a/net/minecraft/data/Main.java +++ b/net/minecraft/data/Main.java @@ -15,22 +15,28 @@ import net.minecraft.Util; import net.minecraft.WorldVersion; import net.minecraft.core.HolderLookup; import net.minecraft.core.RegistrySetBuilder; +import net.minecraft.data.DataGenerator.PackGenerator; import net.minecraft.data.advancements.packs.VanillaAdvancementProvider; +import net.minecraft.data.advancements.packs.WinterDropAdvancementProvider; import net.minecraft.data.info.BiomeParametersDumpReport; import net.minecraft.data.info.BlockListReport; import net.minecraft.data.info.CommandsReport; +import net.minecraft.data.info.DatapackStructureReport; import net.minecraft.data.info.ItemListReport; import net.minecraft.data.info.PacketReport; import net.minecraft.data.info.RegistryDumpReport; import net.minecraft.data.loot.packs.TradeRebalanceLootTableProvider; import net.minecraft.data.loot.packs.VanillaLootTableProvider; +import net.minecraft.data.loot.packs.WinterDropLootTableProvider; import net.minecraft.data.metadata.PackMetadataGenerator; +import net.minecraft.data.models.EquipmentModelProvider; import net.minecraft.data.models.ModelProvider; -import net.minecraft.data.recipes.packs.BundleRecipeProvider; import net.minecraft.data.recipes.packs.VanillaRecipeProvider; +import net.minecraft.data.recipes.packs.WinterDropRecipeProvider; import net.minecraft.data.registries.RegistriesDatapackGenerator; import net.minecraft.data.registries.TradeRebalanceRegistries; import net.minecraft.data.registries.VanillaRegistries; +import net.minecraft.data.registries.WinterDropRegistries; import net.minecraft.data.structures.NbtToSnbt; import net.minecraft.data.structures.SnbtToNbt; import net.minecraft.data.structures.StructureUpdater; @@ -52,6 +58,10 @@ import net.minecraft.data.tags.TradeRebalanceStructureTagsProvider; import net.minecraft.data.tags.VanillaBlockTagsProvider; import net.minecraft.data.tags.VanillaEnchantmentTagsProvider; import net.minecraft.data.tags.VanillaItemTagsProvider; +import net.minecraft.data.tags.WinterDropBiomeTagsProvider; +import net.minecraft.data.tags.WinterDropBlockTagsProvider; +import net.minecraft.data.tags.WinterDropEntityTypeTagsProvider; +import net.minecraft.data.tags.WinterDropItemTagsProvider; import net.minecraft.data.tags.WorldPresetTagsProvider; import net.minecraft.network.chat.Component; import net.minecraft.obfuscate.DontObfuscate; @@ -121,16 +131,17 @@ public class Main { boolean alwaysGenerate ) { DataGenerator dataGenerator = new DataGenerator(outputFolder, version, alwaysGenerate); - DataGenerator.PackGenerator packGenerator = dataGenerator.getVanillaPack(client || server); + PackGenerator packGenerator = dataGenerator.getVanillaPack(client || server); packGenerator.addProvider(packOutput -> new SnbtToNbt(packOutput, inputFolders).addFilter(new StructureUpdater())); CompletableFuture completableFuture = CompletableFuture.supplyAsync(VanillaRegistries::createLookup, Util.backgroundExecutor()); - DataGenerator.PackGenerator packGenerator2 = dataGenerator.getVanillaPack(client); + PackGenerator packGenerator2 = dataGenerator.getVanillaPack(client); packGenerator2.addProvider(ModelProvider::new); - DataGenerator.PackGenerator packGenerator3 = dataGenerator.getVanillaPack(server); + packGenerator2.addProvider(EquipmentModelProvider::new); + PackGenerator packGenerator3 = dataGenerator.getVanillaPack(server); packGenerator3.addProvider(bindRegistries(RegistriesDatapackGenerator::new, completableFuture)); packGenerator3.addProvider(bindRegistries(VanillaAdvancementProvider::create, completableFuture)); packGenerator3.addProvider(bindRegistries(VanillaLootTableProvider::create, completableFuture)); - packGenerator3.addProvider(bindRegistries(VanillaRecipeProvider::new, completableFuture)); + packGenerator3.addProvider(bindRegistries(VanillaRecipeProvider.Runner::new, completableFuture)); TagsProvider tagsProvider = packGenerator3.addProvider(bindRegistries(VanillaBlockTagsProvider::new, completableFuture)); TagsProvider tagsProvider2 = packGenerator3.addProvider( packOutput -> new VanillaItemTagsProvider(packOutput, completableFuture, tagsProvider.contentsGetter()) @@ -158,14 +169,10 @@ public class Main { packGenerator3.addProvider(bindRegistries(CommandsReport::new, completableFuture)); packGenerator3.addProvider(RegistryDumpReport::new); packGenerator3.addProvider(PacketReport::new); - packGenerator3 = dataGenerator.getBuiltinDatapack(server, "bundle"); - packGenerator3.addProvider(bindRegistries(BundleRecipeProvider::new, completableFuture)); - packGenerator3.addProvider( - packOutput -> PackMetadataGenerator.forFeaturePack(packOutput, Component.translatable("dataPack.bundle.description"), FeatureFlagSet.of(FeatureFlags.BUNDLE)) - ); + packGenerator3.addProvider(DatapackStructureReport::new); CompletableFuture completableFuture2 = TradeRebalanceRegistries.createLookup(completableFuture); CompletableFuture completableFuture3 = completableFuture2.thenApply(RegistrySetBuilder.PatchedRegistries::patches); - DataGenerator.PackGenerator packGenerator4 = dataGenerator.getBuiltinDatapack(server, "trade_rebalance"); + PackGenerator packGenerator4 = dataGenerator.getBuiltinDatapack(server, "trade_rebalance"); packGenerator4.addProvider(bindRegistries(RegistriesDatapackGenerator::new, completableFuture3)); packGenerator4.addProvider( packOutput -> PackMetadataGenerator.forFeaturePack( @@ -175,6 +182,38 @@ public class Main { packGenerator4.addProvider(bindRegistries(TradeRebalanceLootTableProvider::create, completableFuture)); packGenerator4.addProvider(bindRegistries(TradeRebalanceStructureTagsProvider::new, completableFuture)); packGenerator4.addProvider(bindRegistries(TradeRebalanceEnchantmentTagsProvider::new, completableFuture)); + packGenerator3 = dataGenerator.getBuiltinDatapack(server, "redstone_experiments"); + packGenerator3.addProvider( + packOutput -> PackMetadataGenerator.forFeaturePack( + packOutput, Component.translatable("dataPack.redstone_experiments.description"), FeatureFlagSet.of(FeatureFlags.REDSTONE_EXPERIMENTS) + ) + ); + packGenerator3 = dataGenerator.getBuiltinDatapack(server, "minecart_improvements"); + packGenerator3.addProvider( + packOutput -> PackMetadataGenerator.forFeaturePack( + packOutput, Component.translatable("dataPack.minecart_improvements.description"), FeatureFlagSet.of(FeatureFlags.MINECART_IMPROVEMENTS) + ) + ); + CompletableFuture completableFuture2x = WinterDropRegistries.createLookup(completableFuture); + completableFuture3 = completableFuture2x.thenApply(RegistrySetBuilder.PatchedRegistries::full); + packGenerator4 = dataGenerator.getBuiltinDatapack(server, "winter_drop"); + packGenerator4.addProvider(bindRegistries(RegistriesDatapackGenerator::new, completableFuture2x.thenApply(RegistrySetBuilder.PatchedRegistries::patches))); + packGenerator4.addProvider(bindRegistries(WinterDropRecipeProvider.Runner::new, completableFuture3)); + TagsProvider tagsProvider6 = packGenerator4.addProvider( + packOutput -> new WinterDropBlockTagsProvider(packOutput, completableFuture3, tagsProvider.contentsGetter()) + ); + packGenerator4.addProvider( + packOutput -> new WinterDropItemTagsProvider(packOutput, completableFuture3, tagsProvider2.contentsGetter(), tagsProvider6.contentsGetter()) + ); + packGenerator4.addProvider(packOutput -> new WinterDropBiomeTagsProvider(packOutput, completableFuture3, tagsProvider3.contentsGetter())); + packGenerator4.addProvider(bindRegistries(WinterDropLootTableProvider::create, completableFuture3)); + packGenerator4.addProvider( + packOutput -> PackMetadataGenerator.forFeaturePack( + packOutput, Component.translatable("dataPack.winter_drop.description"), FeatureFlagSet.of(FeatureFlags.WINTER_DROP) + ) + ); + packGenerator4.addProvider(bindRegistries(WinterDropEntityTypeTagsProvider::new, completableFuture3)); + packGenerator4.addProvider(bindRegistries(WinterDropAdvancementProvider::create, completableFuture3)); return dataGenerator; } } diff --git a/net/minecraft/data/advancements/AdvancementProvider.java b/net/minecraft/data/advancements/AdvancementProvider.java index d903d1a5..9e6b3a41 100644 --- a/net/minecraft/data/advancements/AdvancementProvider.java +++ b/net/minecraft/data/advancements/AdvancementProvider.java @@ -14,10 +14,11 @@ import net.minecraft.core.registries.Registries; import net.minecraft.data.CachedOutput; import net.minecraft.data.DataProvider; import net.minecraft.data.PackOutput; +import net.minecraft.data.PackOutput.PathProvider; import net.minecraft.resources.ResourceLocation; public class AdvancementProvider implements DataProvider { - private final PackOutput.PathProvider pathProvider; + private final PathProvider pathProvider; private final List subProviders; private final CompletableFuture registries; diff --git a/net/minecraft/data/advancements/packs/VanillaAdventureAdvancements.java b/net/minecraft/data/advancements/packs/VanillaAdventureAdvancements.java index 20e4e1c9..c8a2346b 100644 --- a/net/minecraft/data/advancements/packs/VanillaAdventureAdvancements.java +++ b/net/minecraft/data/advancements/packs/VanillaAdventureAdvancements.java @@ -6,47 +6,33 @@ import java.util.List; import java.util.Optional; import java.util.Set; import java.util.function.Consumer; -import net.minecraft.advancements.Advancement; import net.minecraft.advancements.AdvancementHolder; import net.minecraft.advancements.AdvancementRequirements; import net.minecraft.advancements.AdvancementRewards; import net.minecraft.advancements.AdvancementType; import net.minecraft.advancements.Criterion; +import net.minecraft.advancements.Advancement.Builder; +import net.minecraft.advancements.AdvancementRequirements.Strategy; import net.minecraft.advancements.critereon.BlockPredicate; -import net.minecraft.advancements.critereon.ChanneledLightningTrigger; -import net.minecraft.advancements.critereon.DamagePredicate; -import net.minecraft.advancements.critereon.DamageSourcePredicate; import net.minecraft.advancements.critereon.DistancePredicate; -import net.minecraft.advancements.critereon.DistanceTrigger; import net.minecraft.advancements.critereon.EntityEquipmentPredicate; import net.minecraft.advancements.critereon.EntityPredicate; -import net.minecraft.advancements.critereon.FallAfterExplosionTrigger; -import net.minecraft.advancements.critereon.InventoryChangeTrigger; import net.minecraft.advancements.critereon.ItemJukeboxPlayablePredicate; import net.minecraft.advancements.critereon.ItemPredicate; import net.minecraft.advancements.critereon.ItemSubPredicates; import net.minecraft.advancements.critereon.ItemUsedOnLocationTrigger; -import net.minecraft.advancements.critereon.KilledByCrossbowTrigger; -import net.minecraft.advancements.critereon.KilledTrigger; +import net.minecraft.advancements.critereon.KilledByArrowTrigger; import net.minecraft.advancements.critereon.LightningBoltPredicate; -import net.minecraft.advancements.critereon.LightningStrikeTrigger; -import net.minecraft.advancements.critereon.LocationPredicate; import net.minecraft.advancements.critereon.LootTableTrigger; -import net.minecraft.advancements.critereon.MinMaxBounds; -import net.minecraft.advancements.critereon.PlayerHurtEntityTrigger; -import net.minecraft.advancements.critereon.PlayerInteractTrigger; import net.minecraft.advancements.critereon.PlayerPredicate; import net.minecraft.advancements.critereon.PlayerTrigger; import net.minecraft.advancements.critereon.RecipeCraftedTrigger; import net.minecraft.advancements.critereon.ShotCrossbowTrigger; -import net.minecraft.advancements.critereon.SlideDownBlockTrigger; -import net.minecraft.advancements.critereon.StatePropertiesPredicate; -import net.minecraft.advancements.critereon.SummonedEntityTrigger; import net.minecraft.advancements.critereon.TagPredicate; -import net.minecraft.advancements.critereon.TargetBlockTrigger; -import net.minecraft.advancements.critereon.TradeTrigger; import net.minecraft.advancements.critereon.UsedTotemTrigger; -import net.minecraft.advancements.critereon.UsingItemTrigger; +import net.minecraft.advancements.critereon.LightningStrikeTrigger.TriggerInstance; +import net.minecraft.advancements.critereon.MinMaxBounds.Doubles; +import net.minecraft.advancements.critereon.MinMaxBounds.Ints; import net.minecraft.core.BlockPos; import net.minecraft.core.HolderGetter; import net.minecraft.core.HolderLookup; @@ -129,11 +115,11 @@ public class VanillaAdventureAdvancements implements AdvancementSubProvider { EntityType.ZOMBIFIED_PIGLIN ); - private static Criterion fireCountAndBystander(MinMaxBounds.Ints fireCount, Optional bystander) { - return LightningStrikeTrigger.TriggerInstance.lightningStrike( + private static Criterion fireCountAndBystander(Ints fireCount, Optional bystander) { + return TriggerInstance.lightningStrike( Optional.of( EntityPredicate.Builder.entity() - .distance(DistancePredicate.absolute(MinMaxBounds.Doubles.atMost(30.0))) + .distance(DistancePredicate.absolute(Doubles.atMost(30.0))) .subPredicate(LightningBoltPredicate.blockSetOnFire(fireCount)) .build() ), @@ -141,16 +127,20 @@ public class VanillaAdventureAdvancements implements AdvancementSubProvider { ); } - private static Criterion lookAtThroughItem(EntityType entity, Item item) { - return UsingItemTrigger.TriggerInstance.lookingAt( - EntityPredicate.Builder.entity().subPredicate(PlayerPredicate.Builder.player().setLookingAt(EntityPredicate.Builder.entity().of(entity)).build()), - ItemPredicate.Builder.item().of(item) + private static Criterion lookAtThroughItem( + EntityPredicate.Builder builder, ItemPredicate.Builder builder2 + ) { + return net.minecraft.advancements.critereon.UsingItemTrigger.TriggerInstance.lookingAt( + EntityPredicate.Builder.entity().subPredicate(PlayerPredicate.Builder.player().setLookingAt(builder).build()), builder2 ); } @Override public void generate(HolderLookup.Provider registries, Consumer writer) { - AdvancementHolder advancementHolder = Advancement.Builder.advancement() + HolderGetter> holderGetter = registries.lookupOrThrow(Registries.ENTITY_TYPE); + HolderGetter holderGetter2 = registries.lookupOrThrow(Registries.ITEM); + HolderGetter holderGetter3 = registries.lookupOrThrow(Registries.BLOCK); + AdvancementHolder advancementHolder = Builder.advancement() .display( Items.MAP, Component.translatable("advancements.adventure.root.title"), @@ -161,11 +151,11 @@ public class VanillaAdventureAdvancements implements AdvancementSubProvider { false, false ) - .requirements(AdvancementRequirements.Strategy.OR) - .addCriterion("killed_something", KilledTrigger.TriggerInstance.playerKilledEntity()) - .addCriterion("killed_by_something", KilledTrigger.TriggerInstance.entityKilledPlayer()) + .requirements(Strategy.OR) + .addCriterion("killed_something", net.minecraft.advancements.critereon.KilledTrigger.TriggerInstance.playerKilledEntity()) + .addCriterion("killed_by_something", net.minecraft.advancements.critereon.KilledTrigger.TriggerInstance.entityKilledPlayer()) .save(writer, "adventure/root"); - AdvancementHolder advancementHolder2 = Advancement.Builder.advancement() + AdvancementHolder advancementHolder2 = Builder.advancement() .parent(advancementHolder) .display( Blocks.RED_BED, @@ -180,7 +170,7 @@ public class VanillaAdventureAdvancements implements AdvancementSubProvider { .addCriterion("slept_in_bed", PlayerTrigger.TriggerInstance.sleptInBed()) .save(writer, "adventure/sleep_in_bed"); createAdventuringTime(registries, writer, advancementHolder2, MultiNoiseBiomeSourceParameterList.Preset.OVERWORLD); - AdvancementHolder advancementHolder3 = Advancement.Builder.advancement() + AdvancementHolder advancementHolder3 = Builder.advancement() .parent(advancementHolder) .display( Items.EMERALD, @@ -192,9 +182,9 @@ public class VanillaAdventureAdvancements implements AdvancementSubProvider { true, false ) - .addCriterion("traded", TradeTrigger.TriggerInstance.tradedWithVillager()) + .addCriterion("traded", net.minecraft.advancements.critereon.TradeTrigger.TriggerInstance.tradedWithVillager()) .save(writer, "adventure/trade"); - Advancement.Builder.advancement() + Builder.advancement() .parent(advancementHolder3) .display( Items.EMERALD, @@ -208,13 +198,13 @@ public class VanillaAdventureAdvancements implements AdvancementSubProvider { ) .addCriterion( "trade_at_world_height", - TradeTrigger.TriggerInstance.tradedWithVillager( - EntityPredicate.Builder.entity().located(LocationPredicate.Builder.atYLocation(MinMaxBounds.Doubles.atLeast(319.0))) + net.minecraft.advancements.critereon.TradeTrigger.TriggerInstance.tradedWithVillager( + EntityPredicate.Builder.entity().located(net.minecraft.advancements.critereon.LocationPredicate.Builder.atYLocation(Doubles.atLeast(319.0))) ) ) .save(writer, "adventure/trade_at_world_height"); - AdvancementHolder advancementHolder4 = createMonsterHunterAdvancement(advancementHolder, writer, MOBS_TO_KILL); - AdvancementHolder advancementHolder5 = Advancement.Builder.advancement() + AdvancementHolder advancementHolder4 = createMonsterHunterAdvancement(advancementHolder, writer, holderGetter, MOBS_TO_KILL); + AdvancementHolder advancementHolder5 = Builder.advancement() .parent(advancementHolder4) .display( Items.BOW, @@ -228,17 +218,17 @@ public class VanillaAdventureAdvancements implements AdvancementSubProvider { ) .addCriterion( "shot_arrow", - PlayerHurtEntityTrigger.TriggerInstance.playerHurtEntityWithDamage( - DamagePredicate.Builder.damageInstance() + net.minecraft.advancements.critereon.PlayerHurtEntityTrigger.TriggerInstance.playerHurtEntityWithDamage( + net.minecraft.advancements.critereon.DamagePredicate.Builder.damageInstance() .type( - DamageSourcePredicate.Builder.damageType() + net.minecraft.advancements.critereon.DamageSourcePredicate.Builder.damageType() .tag(TagPredicate.is(DamageTypeTags.IS_PROJECTILE)) - .direct(EntityPredicate.Builder.entity().of(EntityTypeTags.ARROWS)) + .direct(EntityPredicate.Builder.entity().of(holderGetter, EntityTypeTags.ARROWS)) ) ) ) .save(writer, "adventure/shoot_arrow"); - AdvancementHolder advancementHolder6 = Advancement.Builder.advancement() + AdvancementHolder advancementHolder6 = Builder.advancement() .parent(advancementHolder4) .display( Items.TRIDENT, @@ -252,17 +242,17 @@ public class VanillaAdventureAdvancements implements AdvancementSubProvider { ) .addCriterion( "shot_trident", - PlayerHurtEntityTrigger.TriggerInstance.playerHurtEntityWithDamage( - DamagePredicate.Builder.damageInstance() + net.minecraft.advancements.critereon.PlayerHurtEntityTrigger.TriggerInstance.playerHurtEntityWithDamage( + net.minecraft.advancements.critereon.DamagePredicate.Builder.damageInstance() .type( - DamageSourcePredicate.Builder.damageType() + net.minecraft.advancements.critereon.DamageSourcePredicate.Builder.damageType() .tag(TagPredicate.is(DamageTypeTags.IS_PROJECTILE)) - .direct(EntityPredicate.Builder.entity().of(EntityType.TRIDENT)) + .direct(EntityPredicate.Builder.entity().of(holderGetter, EntityType.TRIDENT)) ) ) ) .save(writer, "adventure/throw_trident"); - Advancement.Builder.advancement() + Builder.advancement() .parent(advancementHolder6) .display( Items.TRIDENT, @@ -274,9 +264,14 @@ public class VanillaAdventureAdvancements implements AdvancementSubProvider { true, false ) - .addCriterion("struck_villager", ChanneledLightningTrigger.TriggerInstance.channeledLightning(EntityPredicate.Builder.entity().of(EntityType.VILLAGER))) + .addCriterion( + "struck_villager", + net.minecraft.advancements.critereon.ChanneledLightningTrigger.TriggerInstance.channeledLightning( + EntityPredicate.Builder.entity().of(holderGetter, EntityType.VILLAGER) + ) + ) .save(writer, "adventure/very_very_frightening"); - Advancement.Builder.advancement() + Builder.advancement() .parent(advancementHolder3) .display( Blocks.CARVED_PUMPKIN, @@ -288,9 +283,14 @@ public class VanillaAdventureAdvancements implements AdvancementSubProvider { true, false ) - .addCriterion("summoned_golem", SummonedEntityTrigger.TriggerInstance.summonedEntity(EntityPredicate.Builder.entity().of(EntityType.IRON_GOLEM))) + .addCriterion( + "summoned_golem", + net.minecraft.advancements.critereon.SummonedEntityTrigger.TriggerInstance.summonedEntity( + EntityPredicate.Builder.entity().of(holderGetter, EntityType.IRON_GOLEM) + ) + ) .save(writer, "adventure/summon_iron_golem"); - Advancement.Builder.advancement() + Builder.advancement() .parent(advancementHolder5) .display( Items.ARROW, @@ -305,13 +305,13 @@ public class VanillaAdventureAdvancements implements AdvancementSubProvider { .rewards(AdvancementRewards.Builder.experience(50)) .addCriterion( "killed_skeleton", - KilledTrigger.TriggerInstance.playerKilledEntity( - EntityPredicate.Builder.entity().of(EntityType.SKELETON).distance(DistancePredicate.horizontal(MinMaxBounds.Doubles.atLeast(50.0))), - DamageSourcePredicate.Builder.damageType().tag(TagPredicate.is(DamageTypeTags.IS_PROJECTILE)) + net.minecraft.advancements.critereon.KilledTrigger.TriggerInstance.playerKilledEntity( + EntityPredicate.Builder.entity().of(holderGetter, EntityType.SKELETON).distance(DistancePredicate.horizontal(Doubles.atLeast(50.0))), + net.minecraft.advancements.critereon.DamageSourcePredicate.Builder.damageType().tag(TagPredicate.is(DamageTypeTags.IS_PROJECTILE)) ) ) .save(writer, "adventure/sniper_duel"); - Advancement.Builder.advancement() + Builder.advancement() .parent(advancementHolder4) .display( Items.TOTEM_OF_UNDYING, @@ -323,9 +323,9 @@ public class VanillaAdventureAdvancements implements AdvancementSubProvider { true, false ) - .addCriterion("used_totem", UsedTotemTrigger.TriggerInstance.usedTotem(Items.TOTEM_OF_UNDYING)) + .addCriterion("used_totem", UsedTotemTrigger.TriggerInstance.usedTotem(holderGetter2, Items.TOTEM_OF_UNDYING)) .save(writer, "adventure/totem_of_undying"); - AdvancementHolder advancementHolder7 = Advancement.Builder.advancement() + AdvancementHolder advancementHolder7 = Builder.advancement() .parent(advancementHolder) .display( Items.CROSSBOW, @@ -337,9 +337,9 @@ public class VanillaAdventureAdvancements implements AdvancementSubProvider { true, false ) - .addCriterion("shot_crossbow", ShotCrossbowTrigger.TriggerInstance.shotCrossbow(Items.CROSSBOW)) + .addCriterion("shot_crossbow", ShotCrossbowTrigger.TriggerInstance.shotCrossbow(holderGetter2, Items.CROSSBOW)) .save(writer, "adventure/ol_betsy"); - Advancement.Builder.advancement() + Builder.advancement() .parent(advancementHolder7) .display( Items.CROSSBOW, @@ -351,9 +351,11 @@ public class VanillaAdventureAdvancements implements AdvancementSubProvider { true, false ) - .addCriterion("kill_pillager", KilledByCrossbowTrigger.TriggerInstance.crossbowKilled(EntityPredicate.Builder.entity().of(EntityType.PILLAGER))) + .addCriterion( + "kill_pillager", KilledByArrowTrigger.TriggerInstance.crossbowKilled(holderGetter2, EntityPredicate.Builder.entity().of(holderGetter, EntityType.PILLAGER)) + ) .save(writer, "adventure/whos_the_pillager_now"); - Advancement.Builder.advancement() + Builder.advancement() .parent(advancementHolder7) .display( Items.CROSSBOW, @@ -368,12 +370,14 @@ public class VanillaAdventureAdvancements implements AdvancementSubProvider { .rewards(AdvancementRewards.Builder.experience(65)) .addCriterion( "two_birds", - KilledByCrossbowTrigger.TriggerInstance.crossbowKilled( - EntityPredicate.Builder.entity().of(EntityType.PHANTOM), EntityPredicate.Builder.entity().of(EntityType.PHANTOM) + KilledByArrowTrigger.TriggerInstance.crossbowKilled( + holderGetter2, + EntityPredicate.Builder.entity().of(holderGetter, EntityType.PHANTOM), + EntityPredicate.Builder.entity().of(holderGetter, EntityType.PHANTOM) ) ) .save(writer, "adventure/two_birds_one_arrow"); - Advancement.Builder.advancement() + Builder.advancement() .parent(advancementHolder7) .display( Items.CROSSBOW, @@ -386,13 +390,13 @@ public class VanillaAdventureAdvancements implements AdvancementSubProvider { true ) .rewards(AdvancementRewards.Builder.experience(85)) - .addCriterion("arbalistic", KilledByCrossbowTrigger.TriggerInstance.crossbowKilled(MinMaxBounds.Ints.exactly(5))) + .addCriterion("arbalistic", KilledByArrowTrigger.TriggerInstance.crossbowKilled(holderGetter2, Ints.exactly(5))) .save(writer, "adventure/arbalistic"); HolderLookup.RegistryLookup registryLookup = registries.lookupOrThrow(Registries.BANNER_PATTERN); - AdvancementHolder advancementHolder8 = Advancement.Builder.advancement() + AdvancementHolder advancementHolder8 = Builder.advancement() .parent(advancementHolder) .display( - Raid.getLeaderBannerInstance(registryLookup), + Raid.getOminousBannerInstance(registryLookup), Component.translatable("advancements.adventure.voluntary_exile.title"), Component.translatable("advancements.adventure.voluntary_exile.description"), null, @@ -403,15 +407,17 @@ public class VanillaAdventureAdvancements implements AdvancementSubProvider { ) .addCriterion( "voluntary_exile", - KilledTrigger.TriggerInstance.playerKilledEntity( - EntityPredicate.Builder.entity().of(EntityTypeTags.RAIDERS).equipment(EntityEquipmentPredicate.captainPredicate(registryLookup)) + net.minecraft.advancements.critereon.KilledTrigger.TriggerInstance.playerKilledEntity( + EntityPredicate.Builder.entity() + .of(holderGetter, EntityTypeTags.RAIDERS) + .equipment(EntityEquipmentPredicate.captainPredicate(holderGetter2, registryLookup)) ) ) .save(writer, "adventure/voluntary_exile"); - Advancement.Builder.advancement() + Builder.advancement() .parent(advancementHolder8) .display( - Raid.getLeaderBannerInstance(registryLookup), + Raid.getOminousBannerInstance(registryLookup), Component.translatable("advancements.adventure.hero_of_the_village.title"), Component.translatable("advancements.adventure.hero_of_the_village.description"), null, @@ -423,7 +429,7 @@ public class VanillaAdventureAdvancements implements AdvancementSubProvider { .rewards(AdvancementRewards.Builder.experience(100)) .addCriterion("hero_of_the_village", PlayerTrigger.TriggerInstance.raidWon()) .save(writer, "adventure/hero_of_the_village"); - Advancement.Builder.advancement() + Builder.advancement() .parent(advancementHolder) .display( Blocks.HONEY_BLOCK.asItem(), @@ -435,9 +441,9 @@ public class VanillaAdventureAdvancements implements AdvancementSubProvider { true, false ) - .addCriterion("honey_block_slide", SlideDownBlockTrigger.TriggerInstance.slidesDownBlock(Blocks.HONEY_BLOCK)) + .addCriterion("honey_block_slide", net.minecraft.advancements.critereon.SlideDownBlockTrigger.TriggerInstance.slidesDownBlock(Blocks.HONEY_BLOCK)) .save(writer, "adventure/honey_block_slide"); - Advancement.Builder.advancement() + Builder.advancement() .parent(advancementHolder5) .display( Blocks.TARGET.asItem(), @@ -452,13 +458,12 @@ public class VanillaAdventureAdvancements implements AdvancementSubProvider { .rewards(AdvancementRewards.Builder.experience(50)) .addCriterion( "bullseye", - TargetBlockTrigger.TriggerInstance.targetHit( - MinMaxBounds.Ints.exactly(15), - Optional.of(EntityPredicate.wrap(EntityPredicate.Builder.entity().distance(DistancePredicate.horizontal(MinMaxBounds.Doubles.atLeast(30.0))))) + net.minecraft.advancements.critereon.TargetBlockTrigger.TriggerInstance.targetHit( + Ints.exactly(15), Optional.of(EntityPredicate.wrap(EntityPredicate.Builder.entity().distance(DistancePredicate.horizontal(Doubles.atLeast(30.0))))) ) ) .save(writer, "adventure/bullseye"); - Advancement.Builder.advancement() + Builder.advancement() .parent(advancementHolder2) .display( Items.LEATHER_BOOTS, @@ -470,9 +475,12 @@ public class VanillaAdventureAdvancements implements AdvancementSubProvider { true, false ) - .addCriterion("walk_on_powder_snow_with_leather_boots", PlayerTrigger.TriggerInstance.walkOnBlockWithEquipment(Blocks.POWDER_SNOW, Items.LEATHER_BOOTS)) + .addCriterion( + "walk_on_powder_snow_with_leather_boots", + PlayerTrigger.TriggerInstance.walkOnBlockWithEquipment(holderGetter3, holderGetter2, Blocks.POWDER_SNOW, Items.LEATHER_BOOTS) + ) .save(writer, "adventure/walk_on_powder_snow_with_leather_boots"); - Advancement.Builder.advancement() + Builder.advancement() .parent(advancementHolder) .display( Items.LIGHTNING_ROD, @@ -486,10 +494,10 @@ public class VanillaAdventureAdvancements implements AdvancementSubProvider { ) .addCriterion( "lightning_rod_with_villager_no_fire", - fireCountAndBystander(MinMaxBounds.Ints.exactly(0), Optional.of(EntityPredicate.Builder.entity().of(EntityType.VILLAGER).build())) + fireCountAndBystander(Ints.exactly(0), Optional.of(EntityPredicate.Builder.entity().of(holderGetter, EntityType.VILLAGER).build())) ) .save(writer, "adventure/lightning_rod_with_villager_no_fire"); - AdvancementHolder advancementHolder9 = Advancement.Builder.advancement() + AdvancementHolder advancementHolder9 = Builder.advancement() .parent(advancementHolder) .display( Items.SPYGLASS, @@ -501,9 +509,12 @@ public class VanillaAdventureAdvancements implements AdvancementSubProvider { true, false ) - .addCriterion("spyglass_at_parrot", lookAtThroughItem(EntityType.PARROT, Items.SPYGLASS)) + .addCriterion( + "spyglass_at_parrot", + lookAtThroughItem(EntityPredicate.Builder.entity().of(holderGetter, EntityType.PARROT), ItemPredicate.Builder.item().of(holderGetter2, Items.SPYGLASS)) + ) .save(writer, "adventure/spyglass_at_parrot"); - AdvancementHolder advancementHolder10 = Advancement.Builder.advancement() + AdvancementHolder advancementHolder10 = Builder.advancement() .parent(advancementHolder9) .display( Items.SPYGLASS, @@ -515,9 +526,12 @@ public class VanillaAdventureAdvancements implements AdvancementSubProvider { true, false ) - .addCriterion("spyglass_at_ghast", lookAtThroughItem(EntityType.GHAST, Items.SPYGLASS)) + .addCriterion( + "spyglass_at_ghast", + lookAtThroughItem(EntityPredicate.Builder.entity().of(holderGetter, EntityType.GHAST), ItemPredicate.Builder.item().of(holderGetter2, Items.SPYGLASS)) + ) .save(writer, "adventure/spyglass_at_ghast"); - Advancement.Builder.advancement() + Builder.advancement() .parent(advancementHolder2) .display( Items.JUKEBOX, @@ -532,14 +546,14 @@ public class VanillaAdventureAdvancements implements AdvancementSubProvider { .addCriterion( "play_jukebox_in_meadows", ItemUsedOnLocationTrigger.TriggerInstance.itemUsedOnBlock( - LocationPredicate.Builder.location() + net.minecraft.advancements.critereon.LocationPredicate.Builder.location() .setBiomes(HolderSet.direct(registries.lookupOrThrow(Registries.BIOME).getOrThrow(Biomes.MEADOW))) - .setBlock(BlockPredicate.Builder.block().of(Blocks.JUKEBOX)), + .setBlock(BlockPredicate.Builder.block().of(holderGetter3, Blocks.JUKEBOX)), ItemPredicate.Builder.item().withSubPredicate(ItemSubPredicates.JUKEBOX_PLAYABLE, ItemJukeboxPlayablePredicate.any()) ) ) .save(writer, "adventure/play_jukebox_in_meadows"); - Advancement.Builder.advancement() + Builder.advancement() .parent(advancementHolder10) .display( Items.SPYGLASS, @@ -551,9 +565,14 @@ public class VanillaAdventureAdvancements implements AdvancementSubProvider { true, false ) - .addCriterion("spyglass_at_dragon", lookAtThroughItem(EntityType.ENDER_DRAGON, Items.SPYGLASS)) + .addCriterion( + "spyglass_at_dragon", + lookAtThroughItem( + EntityPredicate.Builder.entity().of(holderGetter, EntityType.ENDER_DRAGON), ItemPredicate.Builder.item().of(holderGetter2, Items.SPYGLASS) + ) + ) .save(writer, "adventure/spyglass_at_dragon"); - Advancement.Builder.advancement() + Builder.advancement() .parent(advancementHolder) .display( Items.WATER_BUCKET, @@ -567,14 +586,14 @@ public class VanillaAdventureAdvancements implements AdvancementSubProvider { ) .addCriterion( "fall_from_world_height", - DistanceTrigger.TriggerInstance.fallFromHeight( - EntityPredicate.Builder.entity().located(LocationPredicate.Builder.atYLocation(MinMaxBounds.Doubles.atMost(-59.0))), - DistancePredicate.vertical(MinMaxBounds.Doubles.atLeast(379.0)), - LocationPredicate.Builder.atYLocation(MinMaxBounds.Doubles.atLeast(319.0)) + net.minecraft.advancements.critereon.DistanceTrigger.TriggerInstance.fallFromHeight( + EntityPredicate.Builder.entity().located(net.minecraft.advancements.critereon.LocationPredicate.Builder.atYLocation(Doubles.atMost(-59.0))), + DistancePredicate.vertical(Doubles.atLeast(379.0)), + net.minecraft.advancements.critereon.LocationPredicate.Builder.atYLocation(Doubles.atLeast(319.0)) ) ) .save(writer, "adventure/fall_from_world_height"); - Advancement.Builder.advancement() + Builder.advancement() .parent(advancementHolder4) .display( Blocks.SCULK_CATALYST, @@ -586,9 +605,9 @@ public class VanillaAdventureAdvancements implements AdvancementSubProvider { true, false ) - .addCriterion("kill_mob_near_sculk_catalyst", KilledTrigger.TriggerInstance.playerKilledEntityNearSculkCatalyst()) + .addCriterion("kill_mob_near_sculk_catalyst", net.minecraft.advancements.critereon.KilledTrigger.TriggerInstance.playerKilledEntityNearSculkCatalyst()) .save(writer, "adventure/kill_mob_near_sculk_catalyst"); - Advancement.Builder.advancement() + Builder.advancement() .parent(advancementHolder) .display( Blocks.SCULK_SENSOR, @@ -602,7 +621,7 @@ public class VanillaAdventureAdvancements implements AdvancementSubProvider { ) .addCriterion("avoid_vibration", PlayerTrigger.TriggerInstance.avoidVibration()) .save(writer, "adventure/avoid_vibration"); - AdvancementHolder advancementHolder11 = respectingTheRemnantsCriterions(Advancement.Builder.advancement()) + AdvancementHolder advancementHolder11 = respectingTheRemnantsCriterions(holderGetter2, Builder.advancement()) .parent(advancementHolder) .display( Items.BRUSH, @@ -615,7 +634,7 @@ public class VanillaAdventureAdvancements implements AdvancementSubProvider { false ) .save(writer, "adventure/salvage_sherd"); - Advancement.Builder.advancement() + Builder.advancement() .parent(advancementHolder11) .display( DecoratedPotBlockEntity.createDecoratedPotItem( @@ -632,17 +651,17 @@ public class VanillaAdventureAdvancements implements AdvancementSubProvider { .addCriterion( "pot_crafted_using_only_sherds", RecipeCraftedTrigger.TriggerInstance.craftedItem( - ResourceLocation.withDefaultNamespace("decorated_pot"), + ResourceKey.create(Registries.RECIPE, ResourceLocation.withDefaultNamespace("decorated_pot")), List.of( - ItemPredicate.Builder.item().of(ItemTags.DECORATED_POT_SHERDS), - ItemPredicate.Builder.item().of(ItemTags.DECORATED_POT_SHERDS), - ItemPredicate.Builder.item().of(ItemTags.DECORATED_POT_SHERDS), - ItemPredicate.Builder.item().of(ItemTags.DECORATED_POT_SHERDS) + ItemPredicate.Builder.item().of(holderGetter2, ItemTags.DECORATED_POT_SHERDS), + ItemPredicate.Builder.item().of(holderGetter2, ItemTags.DECORATED_POT_SHERDS), + ItemPredicate.Builder.item().of(holderGetter2, ItemTags.DECORATED_POT_SHERDS), + ItemPredicate.Builder.item().of(holderGetter2, ItemTags.DECORATED_POT_SHERDS) ) ) ) .save(writer, "adventure/craft_decorated_pot_using_only_sherds"); - AdvancementHolder advancementHolder12 = craftingANewLook(Advancement.Builder.advancement()) + AdvancementHolder advancementHolder12 = craftingANewLook(Builder.advancement()) .parent(advancementHolder) .display( new ItemStack(Items.DUNE_ARMOR_TRIM_SMITHING_TEMPLATE), @@ -655,7 +674,7 @@ public class VanillaAdventureAdvancements implements AdvancementSubProvider { false ) .save(writer, "adventure/trim_with_any_armor_pattern"); - smithingWithStyle(Advancement.Builder.advancement()) + smithingWithStyle(Builder.advancement()) .parent(advancementHolder12) .display( new ItemStack(Items.SILENCE_ARMOR_TRIM_SMITHING_TEMPLATE), @@ -669,7 +688,7 @@ public class VanillaAdventureAdvancements implements AdvancementSubProvider { ) .rewards(AdvancementRewards.Builder.experience(150)) .save(writer, "adventure/trim_with_all_exclusive_armor_patterns"); - Advancement.Builder.advancement() + Builder.advancement() .parent(advancementHolder) .display( Items.CHISELED_BOOKSHELF, @@ -681,11 +700,11 @@ public class VanillaAdventureAdvancements implements AdvancementSubProvider { true, false ) - .requirements(AdvancementRequirements.Strategy.OR) - .addCriterion("chiseled_bookshelf", placedBlockReadByComparator(Blocks.CHISELED_BOOKSHELF)) - .addCriterion("comparator", placedComparatorReadingBlock(Blocks.CHISELED_BOOKSHELF)) + .requirements(Strategy.OR) + .addCriterion("chiseled_bookshelf", placedBlockReadByComparator(holderGetter3, Blocks.CHISELED_BOOKSHELF)) + .addCriterion("comparator", placedComparatorReadingBlock(holderGetter3, Blocks.CHISELED_BOOKSHELF)) .save(writer, "adventure/read_power_of_chiseled_bookshelf"); - Advancement.Builder.advancement() + Builder.advancement() .parent(advancementHolder) .display( Items.ARMADILLO_SCUTE, @@ -699,12 +718,13 @@ public class VanillaAdventureAdvancements implements AdvancementSubProvider { ) .addCriterion( "brush_armadillo", - PlayerInteractTrigger.TriggerInstance.itemUsedOnEntity( - ItemPredicate.Builder.item().of(Items.BRUSH), Optional.of(EntityPredicate.wrap(EntityPredicate.Builder.entity().of(EntityType.ARMADILLO))) + net.minecraft.advancements.critereon.PlayerInteractTrigger.TriggerInstance.itemUsedOnEntity( + ItemPredicate.Builder.item().of(holderGetter2, Items.BRUSH), + Optional.of(EntityPredicate.wrap(EntityPredicate.Builder.entity().of(holderGetter, EntityType.ARMADILLO))) ) ) .save(writer, "adventure/brush_armadillo"); - AdvancementHolder advancementHolder13 = Advancement.Builder.advancement() + AdvancementHolder advancementHolder13 = Builder.advancement() .parent(advancementHolder) .display( Blocks.CHISELED_TUFF, @@ -719,11 +739,13 @@ public class VanillaAdventureAdvancements implements AdvancementSubProvider { .addCriterion( "minecraft_trials_edition", PlayerTrigger.TriggerInstance.located( - LocationPredicate.Builder.inStructure(registries.lookupOrThrow(Registries.STRUCTURE).getOrThrow(BuiltinStructures.TRIAL_CHAMBERS)) + net.minecraft.advancements.critereon.LocationPredicate.Builder.inStructure( + registries.lookupOrThrow(Registries.STRUCTURE).getOrThrow(BuiltinStructures.TRIAL_CHAMBERS) + ) ) ) .save(writer, "adventure/minecraft_trials_edition"); - Advancement.Builder.advancement() + Builder.advancement() .parent(advancementHolder13) .display( Items.COPPER_BULB, @@ -738,10 +760,11 @@ public class VanillaAdventureAdvancements implements AdvancementSubProvider { .addCriterion( "lighten_up", ItemUsedOnLocationTrigger.TriggerInstance.itemUsedOnBlock( - LocationPredicate.Builder.location() + net.minecraft.advancements.critereon.LocationPredicate.Builder.location() .setBlock( BlockPredicate.Builder.block() .of( + holderGetter3, Blocks.OXIDIZED_COPPER_BULB, Blocks.WEATHERED_COPPER_BULB, Blocks.EXPOSED_COPPER_BULB, @@ -749,13 +772,13 @@ public class VanillaAdventureAdvancements implements AdvancementSubProvider { Blocks.WAXED_WEATHERED_COPPER_BULB, Blocks.WAXED_EXPOSED_COPPER_BULB ) - .setProperties(StatePropertiesPredicate.Builder.properties().hasProperty(CopperBulbBlock.LIT, true)) + .setProperties(net.minecraft.advancements.critereon.StatePropertiesPredicate.Builder.properties().hasProperty(CopperBulbBlock.LIT, true)) ), - ItemPredicate.Builder.item().of(VanillaHusbandryAdvancements.WAX_SCRAPING_TOOLS) + ItemPredicate.Builder.item().of(holderGetter2, VanillaHusbandryAdvancements.WAX_SCRAPING_TOOLS) ) ) .save(writer, "adventure/lighten_up"); - AdvancementHolder advancementHolder14 = Advancement.Builder.advancement() + AdvancementHolder advancementHolder14 = Builder.advancement() .parent(advancementHolder13) .display( Items.TRIAL_KEY, @@ -770,15 +793,17 @@ public class VanillaAdventureAdvancements implements AdvancementSubProvider { .addCriterion( "under_lock_and_key", ItemUsedOnLocationTrigger.TriggerInstance.itemUsedOnBlock( - LocationPredicate.Builder.location() + net.minecraft.advancements.critereon.LocationPredicate.Builder.location() .setBlock( - BlockPredicate.Builder.block().of(Blocks.VAULT).setProperties(StatePropertiesPredicate.Builder.properties().hasProperty(VaultBlock.OMINOUS, false)) + BlockPredicate.Builder.block() + .of(holderGetter3, Blocks.VAULT) + .setProperties(net.minecraft.advancements.critereon.StatePropertiesPredicate.Builder.properties().hasProperty(VaultBlock.OMINOUS, false)) ), - ItemPredicate.Builder.item().of(Items.TRIAL_KEY) + ItemPredicate.Builder.item().of(holderGetter2, Items.TRIAL_KEY) ) ) .save(writer, "adventure/under_lock_and_key"); - Advancement.Builder.advancement() + Builder.advancement() .parent(advancementHolder14) .display( Items.OMINOUS_TRIAL_KEY, @@ -793,15 +818,17 @@ public class VanillaAdventureAdvancements implements AdvancementSubProvider { .addCriterion( "revaulting", ItemUsedOnLocationTrigger.TriggerInstance.itemUsedOnBlock( - LocationPredicate.Builder.location() + net.minecraft.advancements.critereon.LocationPredicate.Builder.location() .setBlock( - BlockPredicate.Builder.block().of(Blocks.VAULT).setProperties(StatePropertiesPredicate.Builder.properties().hasProperty(VaultBlock.OMINOUS, true)) + BlockPredicate.Builder.block() + .of(holderGetter3, Blocks.VAULT) + .setProperties(net.minecraft.advancements.critereon.StatePropertiesPredicate.Builder.properties().hasProperty(VaultBlock.OMINOUS, true)) ), - ItemPredicate.Builder.item().of(Items.OMINOUS_TRIAL_KEY) + ItemPredicate.Builder.item().of(holderGetter2, Items.OMINOUS_TRIAL_KEY) ) ) .save(writer, "adventure/revaulting"); - Advancement.Builder.advancement() + Builder.advancement() .parent(advancementHolder13) .display( Items.WIND_CHARGE, @@ -816,15 +843,15 @@ public class VanillaAdventureAdvancements implements AdvancementSubProvider { .rewards(AdvancementRewards.Builder.experience(40)) .addCriterion( "blowback", - KilledTrigger.TriggerInstance.playerKilledEntity( - EntityPredicate.Builder.entity().of(EntityType.BREEZE), - DamageSourcePredicate.Builder.damageType() + net.minecraft.advancements.critereon.KilledTrigger.TriggerInstance.playerKilledEntity( + EntityPredicate.Builder.entity().of(holderGetter, EntityType.BREEZE), + net.minecraft.advancements.critereon.DamageSourcePredicate.Builder.damageType() .tag(TagPredicate.is(DamageTypeTags.IS_PROJECTILE)) - .direct(EntityPredicate.Builder.entity().of(EntityType.BREEZE_WIND_CHARGE)) + .direct(EntityPredicate.Builder.entity().of(holderGetter, EntityType.BREEZE_WIND_CHARGE)) ) ) .save(writer, "adventure/blowback"); - Advancement.Builder.advancement() + Builder.advancement() .parent(advancementHolder) .display( Items.CRAFTER, @@ -836,9 +863,12 @@ public class VanillaAdventureAdvancements implements AdvancementSubProvider { true, false ) - .addCriterion("crafter_crafted_crafter", RecipeCraftedTrigger.TriggerInstance.crafterCraftedItem(ResourceLocation.withDefaultNamespace("crafter"))) + .addCriterion( + "crafter_crafted_crafter", + RecipeCraftedTrigger.TriggerInstance.crafterCraftedItem(ResourceKey.create(Registries.RECIPE, ResourceLocation.withDefaultNamespace("crafter"))) + ) .save(writer, "adventure/crafters_crafting_crafters"); - Advancement.Builder.advancement() + Builder.advancement() .parent(advancementHolder13) .display( Items.WIND_CHARGE, @@ -852,12 +882,12 @@ public class VanillaAdventureAdvancements implements AdvancementSubProvider { ) .addCriterion( "who_needs_rockets", - FallAfterExplosionTrigger.TriggerInstance.fallAfterExplosion( - DistancePredicate.vertical(MinMaxBounds.Doubles.atLeast(7.0)), EntityPredicate.Builder.entity().of(EntityType.WIND_CHARGE) + net.minecraft.advancements.critereon.FallAfterExplosionTrigger.TriggerInstance.fallAfterExplosion( + DistancePredicate.vertical(Doubles.atLeast(7.0)), EntityPredicate.Builder.entity().of(holderGetter, EntityType.WIND_CHARGE) ) ) .save(writer, "adventure/who_needs_rockets"); - Advancement.Builder.advancement() + Builder.advancement() .parent(advancementHolder13) .display( Items.MACE, @@ -872,16 +902,16 @@ public class VanillaAdventureAdvancements implements AdvancementSubProvider { .rewards(AdvancementRewards.Builder.experience(50)) .addCriterion( "overoverkill", - PlayerHurtEntityTrigger.TriggerInstance.playerHurtEntityWithDamage( - DamagePredicate.Builder.damageInstance() - .dealtDamage(MinMaxBounds.Doubles.atLeast(100.0)) + net.minecraft.advancements.critereon.PlayerHurtEntityTrigger.TriggerInstance.playerHurtEntityWithDamage( + net.minecraft.advancements.critereon.DamagePredicate.Builder.damageInstance() + .dealtDamage(Doubles.atLeast(100.0)) .type( - DamageSourcePredicate.Builder.damageType() - .tag(TagPredicate.is(DamageTypeTags.IS_PLAYER_ATTACK)) + net.minecraft.advancements.critereon.DamageSourcePredicate.Builder.damageType() + .tag(TagPredicate.is(DamageTypeTags.IS_MACE_SMASH)) .direct( EntityPredicate.Builder.entity() - .of(EntityType.PLAYER) - .equipment(EntityEquipmentPredicate.Builder.equipment().mainhand(ItemPredicate.Builder.item().of(Items.MACE))) + .of(holderGetter, EntityType.PLAYER) + .equipment(EntityEquipmentPredicate.Builder.equipment().mainhand(ItemPredicate.Builder.item().of(holderGetter2, Items.MACE))) ) ) ) @@ -890,10 +920,10 @@ public class VanillaAdventureAdvancements implements AdvancementSubProvider { } public static AdvancementHolder createMonsterHunterAdvancement( - AdvancementHolder advancement, Consumer output, List> typesRequired + AdvancementHolder advancementHolder, Consumer consumer, HolderGetter> holderGetter, List> list ) { - AdvancementHolder advancementHolder = addMobsToKill(Advancement.Builder.advancement(), typesRequired) - .parent(advancement) + AdvancementHolder advancementHolder2 = addMobsToKill(Builder.advancement(), holderGetter, list) + .parent(advancementHolder) .display( Items.IRON_SWORD, Component.translatable("advancements.adventure.kill_a_mob.title"), @@ -904,10 +934,10 @@ public class VanillaAdventureAdvancements implements AdvancementSubProvider { true, false ) - .requirements(AdvancementRequirements.Strategy.OR) - .save(output, "adventure/kill_a_mob"); - addMobsToKill(Advancement.Builder.advancement(), typesRequired) - .parent(advancementHolder) + .requirements(Strategy.OR) + .save(consumer, "adventure/kill_a_mob"); + addMobsToKill(Builder.advancement(), holderGetter, list) + .parent(advancementHolder2) .display( Items.DIAMOND_SWORD, Component.translatable("advancements.adventure.kill_all_mobs.title"), @@ -919,31 +949,42 @@ public class VanillaAdventureAdvancements implements AdvancementSubProvider { false ) .rewards(AdvancementRewards.Builder.experience(100)) - .save(output, "adventure/kill_all_mobs"); - return advancementHolder; + .save(consumer, "adventure/kill_all_mobs"); + return advancementHolder2; } - private static Criterion placedBlockReadByComparator(Block block) { - LootItemCondition.Builder[] builders = (LootItemCondition.Builder[])ComparatorBlock.FACING.getPossibleValues().stream().map(direction -> { - StatePropertiesPredicate.Builder builder = StatePropertiesPredicate.Builder.properties().hasProperty(ComparatorBlock.FACING, direction); - BlockPredicate.Builder builder2 = BlockPredicate.Builder.block().of(Blocks.COMPARATOR).setProperties(builder); - return LocationCheck.checkLocation(LocationPredicate.Builder.location().setBlock(builder2), new BlockPos(direction.getOpposite().getNormal())); - }).toArray(LootItemCondition.Builder[]::new); - return ItemUsedOnLocationTrigger.TriggerInstance.placedBlock( - LootItemBlockStatePropertyCondition.hasBlockStateProperties(block), AnyOfCondition.anyOf(builders) - ); - } - - private static Criterion placedComparatorReadingBlock(Block block) { + private static Criterion placedBlockReadByComparator(HolderGetter holderGetter, Block block) { LootItemCondition.Builder[] builders = (LootItemCondition.Builder[])ComparatorBlock.FACING .getPossibleValues() .stream() .map( direction -> { - StatePropertiesPredicate.Builder builder = StatePropertiesPredicate.Builder.properties().hasProperty(ComparatorBlock.FACING, direction); + net.minecraft.advancements.critereon.StatePropertiesPredicate.Builder builder = net.minecraft.advancements.critereon.StatePropertiesPredicate.Builder.properties() + .hasProperty(ComparatorBlock.FACING, direction); + BlockPredicate.Builder builder2 = BlockPredicate.Builder.block().of(holderGetter, Blocks.COMPARATOR).setProperties(builder); + return LocationCheck.checkLocation( + net.minecraft.advancements.critereon.LocationPredicate.Builder.location().setBlock(builder2), new BlockPos(direction.getOpposite().getUnitVec3i()) + ); + } + ) + .toArray(LootItemCondition.Builder[]::new); + return ItemUsedOnLocationTrigger.TriggerInstance.placedBlock( + LootItemBlockStatePropertyCondition.hasBlockStateProperties(block), AnyOfCondition.anyOf(builders) + ); + } + + private static Criterion placedComparatorReadingBlock(HolderGetter holderGetter, Block block) { + LootItemCondition.Builder[] builders = (LootItemCondition.Builder[])ComparatorBlock.FACING + .getPossibleValues() + .stream() + .map( + direction -> { + net.minecraft.advancements.critereon.StatePropertiesPredicate.Builder builder = net.minecraft.advancements.critereon.StatePropertiesPredicate.Builder.properties() + .hasProperty(ComparatorBlock.FACING, direction); LootItemBlockStatePropertyCondition.Builder builder2 = new LootItemBlockStatePropertyCondition.Builder(Blocks.COMPARATOR).setProperties(builder); LootItemCondition.Builder builder3 = LocationCheck.checkLocation( - LocationPredicate.Builder.location().setBlock(BlockPredicate.Builder.block().of(block)), new BlockPos(direction.getNormal()) + net.minecraft.advancements.critereon.LocationPredicate.Builder.location().setBlock(BlockPredicate.Builder.block().of(holderGetter, block)), + new BlockPos(direction.getUnitVec3i()) ); return AllOfCondition.allOf(builder2, builder3); } @@ -952,8 +993,8 @@ public class VanillaAdventureAdvancements implements AdvancementSubProvider { return ItemUsedOnLocationTrigger.TriggerInstance.placedBlock(AnyOfCondition.anyOf(builders)); } - private static Advancement.Builder smithingWithStyle(Advancement.Builder builder) { - builder.requirements(AdvancementRequirements.Strategy.AND); + private static Builder smithingWithStyle(Builder builder) { + builder.requirements(Strategy.AND); Set set = Set.of( Items.SPIRE_ARMOR_TRIM_SMITHING_TEMPLATE, Items.SNOUT_ARMOR_TRIM_SMITHING_TEMPLATE, @@ -966,19 +1007,21 @@ public class VanillaAdventureAdvancements implements AdvancementSubProvider { ); VanillaRecipeProvider.smithingTrims() .filter(trimTemplate -> set.contains(trimTemplate.template())) - .forEach(trimTemplate -> builder.addCriterion("armor_trimmed_" + trimTemplate.id(), RecipeCraftedTrigger.TriggerInstance.craftedItem(trimTemplate.id()))); + .forEach( + trimTemplate -> builder.addCriterion("armor_trimmed_" + trimTemplate.id().location(), RecipeCraftedTrigger.TriggerInstance.craftedItem(trimTemplate.id())) + ); return builder; } - private static Advancement.Builder craftingANewLook(Advancement.Builder builder) { - builder.requirements(AdvancementRequirements.Strategy.OR); + private static Builder craftingANewLook(Builder builder) { + builder.requirements(Strategy.OR); VanillaRecipeProvider.smithingTrims() .map(VanillaRecipeProvider.TrimTemplate::id) - .forEach(resourceLocation -> builder.addCriterion("armor_trimmed_" + resourceLocation, RecipeCraftedTrigger.TriggerInstance.craftedItem(resourceLocation))); + .forEach(resourceKey -> builder.addCriterion("armor_trimmed_" + resourceKey.location(), RecipeCraftedTrigger.TriggerInstance.craftedItem(resourceKey))); return builder; } - private static Advancement.Builder respectingTheRemnantsCriterions(Advancement.Builder builder) { + private static Builder respectingTheRemnantsCriterions(HolderGetter holderGetter, Builder builder) { List>> list = List.of( Pair.of("desert_pyramid", LootTableTrigger.TriggerInstance.lootTableUsed(BuiltInLootTables.DESERT_PYRAMID_ARCHAEOLOGY)), Pair.of("desert_well", LootTableTrigger.TriggerInstance.lootTableUsed(BuiltInLootTables.DESERT_WELL_ARCHAEOLOGY)), @@ -989,7 +1032,12 @@ public class VanillaAdventureAdvancements implements AdvancementSubProvider { ); list.forEach(pair -> builder.addCriterion((String)pair.getFirst(), (Criterion)pair.getSecond())); String string = "has_sherd"; - builder.addCriterion("has_sherd", InventoryChangeTrigger.TriggerInstance.hasItems(ItemPredicate.Builder.item().of(ItemTags.DECORATED_POT_SHERDS))); + builder.addCriterion( + "has_sherd", + net.minecraft.advancements.critereon.InventoryChangeTrigger.TriggerInstance.hasItems( + ItemPredicate.Builder.item().of(holderGetter, ItemTags.DECORATED_POT_SHERDS) + ) + ); builder.requirements(new AdvancementRequirements(List.of(list.stream().map(Pair::getFirst).toList(), List.of("has_sherd")))); return builder; } @@ -997,7 +1045,7 @@ public class VanillaAdventureAdvancements implements AdvancementSubProvider { protected static void createAdventuringTime( HolderLookup.Provider levelRegistry, Consumer writer, AdvancementHolder parent, MultiNoiseBiomeSourceParameterList.Preset preset ) { - addBiomes(Advancement.Builder.advancement(), levelRegistry, preset.usedBiomes().toList()) + addBiomes(Builder.advancement(), levelRegistry, preset.usedBiomes().toList()) .parent(parent) .display( Items.DIAMOND_BOOTS, @@ -1013,22 +1061,23 @@ public class VanillaAdventureAdvancements implements AdvancementSubProvider { .save(writer, "adventure/adventuring_time"); } - private static Advancement.Builder addMobsToKill(Advancement.Builder builder, List> mobs) { - mobs.forEach( + private static Builder addMobsToKill(Builder builder, HolderGetter> holderGetter, List> list) { + list.forEach( entityType -> builder.addCriterion( BuiltInRegistries.ENTITY_TYPE.getKey(entityType).toString(), - KilledTrigger.TriggerInstance.playerKilledEntity(EntityPredicate.Builder.entity().of(entityType)) + net.minecraft.advancements.critereon.KilledTrigger.TriggerInstance.playerKilledEntity(EntityPredicate.Builder.entity().of(holderGetter, entityType)) ) ); return builder; } - protected static Advancement.Builder addBiomes(Advancement.Builder builder, HolderLookup.Provider levelRegistry, List> biomes) { + protected static Builder addBiomes(Builder builder, HolderLookup.Provider levelRegistry, List> biomes) { HolderGetter holderGetter = levelRegistry.lookupOrThrow(Registries.BIOME); for (ResourceKey resourceKey : biomes) { builder.addCriterion( - resourceKey.location().toString(), PlayerTrigger.TriggerInstance.located(LocationPredicate.Builder.inBiome(holderGetter.getOrThrow(resourceKey))) + resourceKey.location().toString(), + PlayerTrigger.TriggerInstance.located(net.minecraft.advancements.critereon.LocationPredicate.Builder.inBiome(holderGetter.getOrThrow(resourceKey))) ); } diff --git a/net/minecraft/data/advancements/packs/VanillaHusbandryAdvancements.java b/net/minecraft/data/advancements/packs/VanillaHusbandryAdvancements.java index cc88906e..dd6d50d3 100644 --- a/net/minecraft/data/advancements/packs/VanillaHusbandryAdvancements.java +++ b/net/minecraft/data/advancements/packs/VanillaHusbandryAdvancements.java @@ -6,35 +6,26 @@ import java.util.List; import java.util.Optional; import java.util.function.Consumer; import java.util.stream.Stream; -import net.minecraft.advancements.Advancement; import net.minecraft.advancements.AdvancementHolder; -import net.minecraft.advancements.AdvancementRequirements; import net.minecraft.advancements.AdvancementRewards; import net.minecraft.advancements.AdvancementType; -import net.minecraft.advancements.critereon.BeeNestDestroyedTrigger; +import net.minecraft.advancements.Advancement.Builder; +import net.minecraft.advancements.AdvancementRequirements.Strategy; import net.minecraft.advancements.critereon.BlockPredicate; -import net.minecraft.advancements.critereon.BredAnimalsTrigger; import net.minecraft.advancements.critereon.ConsumeItemTrigger; -import net.minecraft.advancements.critereon.EffectsChangedTrigger; import net.minecraft.advancements.critereon.EnchantmentPredicate; import net.minecraft.advancements.critereon.EntityEquipmentPredicate; -import net.minecraft.advancements.critereon.EntityFlagsPredicate; import net.minecraft.advancements.critereon.EntityPredicate; import net.minecraft.advancements.critereon.EntitySubPredicates; -import net.minecraft.advancements.critereon.FilledBucketTrigger; import net.minecraft.advancements.critereon.FishingRodHookedTrigger; -import net.minecraft.advancements.critereon.InventoryChangeTrigger; import net.minecraft.advancements.critereon.ItemEnchantmentsPredicate; import net.minecraft.advancements.critereon.ItemPredicate; import net.minecraft.advancements.critereon.ItemSubPredicates; import net.minecraft.advancements.critereon.ItemUsedOnLocationTrigger; -import net.minecraft.advancements.critereon.LocationPredicate; -import net.minecraft.advancements.critereon.MinMaxBounds; -import net.minecraft.advancements.critereon.PickedUpItemTrigger; -import net.minecraft.advancements.critereon.PlayerInteractTrigger; -import net.minecraft.advancements.critereon.StartRidingTrigger; -import net.minecraft.advancements.critereon.TameAnimalTrigger; +import net.minecraft.advancements.critereon.BredAnimalsTrigger.TriggerInstance; +import net.minecraft.advancements.critereon.MinMaxBounds.Ints; import net.minecraft.core.Holder; +import net.minecraft.core.HolderGetter; import net.minecraft.core.HolderLookup; import net.minecraft.core.HolderSet; import net.minecraft.core.component.DataComponentPredicate; @@ -46,6 +37,7 @@ import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.BlockTags; +import net.minecraft.tags.EntityTypeTags; import net.minecraft.tags.ItemTags; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.animal.WolfVariant; @@ -54,6 +46,7 @@ import net.minecraft.world.item.Item; import net.minecraft.world.item.Items; import net.minecraft.world.item.enchantment.Enchantment; import net.minecraft.world.item.enchantment.Enchantments; +import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; public class VanillaHusbandryAdvancements implements AdvancementSubProvider { @@ -132,8 +125,11 @@ public class VanillaHusbandryAdvancements implements AdvancementSubProvider { @Override public void generate(HolderLookup.Provider registries, Consumer writer) { + HolderGetter> holderGetter = registries.lookupOrThrow(Registries.ENTITY_TYPE); + HolderGetter holderGetter2 = registries.lookupOrThrow(Registries.ITEM); + HolderGetter holderGetter3 = registries.lookupOrThrow(Registries.BLOCK); HolderLookup.RegistryLookup registryLookup = registries.lookupOrThrow(Registries.ENCHANTMENT); - AdvancementHolder advancementHolder = Advancement.Builder.advancement() + AdvancementHolder advancementHolder = Builder.advancement() .display( Blocks.HAY_BLOCK, Component.translatable("advancements.husbandry.root.title"), @@ -146,7 +142,7 @@ public class VanillaHusbandryAdvancements implements AdvancementSubProvider { ) .addCriterion("consumed_item", ConsumeItemTrigger.TriggerInstance.usedItem()) .save(writer, "husbandry/root"); - AdvancementHolder advancementHolder2 = Advancement.Builder.advancement() + AdvancementHolder advancementHolder2 = Builder.advancement() .parent(advancementHolder) .display( Items.WHEAT, @@ -158,7 +154,7 @@ public class VanillaHusbandryAdvancements implements AdvancementSubProvider { true, false ) - .requirements(AdvancementRequirements.Strategy.OR) + .requirements(Strategy.OR) .addCriterion("wheat", ItemUsedOnLocationTrigger.TriggerInstance.placedBlock(Blocks.WHEAT)) .addCriterion("pumpkin_stem", ItemUsedOnLocationTrigger.TriggerInstance.placedBlock(Blocks.PUMPKIN_STEM)) .addCriterion("melon_stem", ItemUsedOnLocationTrigger.TriggerInstance.placedBlock(Blocks.MELON_STEM)) @@ -167,7 +163,7 @@ public class VanillaHusbandryAdvancements implements AdvancementSubProvider { .addCriterion("torchflower", ItemUsedOnLocationTrigger.TriggerInstance.placedBlock(Blocks.TORCHFLOWER_CROP)) .addCriterion("pitcher_pod", ItemUsedOnLocationTrigger.TriggerInstance.placedBlock(Blocks.PITCHER_CROP)) .save(writer, "husbandry/plant_seed"); - AdvancementHolder advancementHolder3 = Advancement.Builder.advancement() + AdvancementHolder advancementHolder3 = Builder.advancement() .parent(advancementHolder) .display( Items.WHEAT, @@ -179,11 +175,11 @@ public class VanillaHusbandryAdvancements implements AdvancementSubProvider { true, false ) - .requirements(AdvancementRequirements.Strategy.OR) - .addCriterion("bred", BredAnimalsTrigger.TriggerInstance.bredAnimals()) + .requirements(Strategy.OR) + .addCriterion("bred", TriggerInstance.bredAnimals()) .save(writer, "husbandry/breed_an_animal"); - createBreedAllAnimalsAdvancement(advancementHolder3, writer, BREEDABLE_ANIMALS.stream(), INDIRECTLY_BREEDABLE_ANIMALS.stream()); - addFood(Advancement.Builder.advancement()) + createBreedAllAnimalsAdvancement(advancementHolder3, writer, holderGetter, BREEDABLE_ANIMALS.stream(), INDIRECTLY_BREEDABLE_ANIMALS.stream()); + addFood(Builder.advancement(), holderGetter2) .parent(advancementHolder2) .display( Items.APPLE, @@ -197,7 +193,7 @@ public class VanillaHusbandryAdvancements implements AdvancementSubProvider { ) .rewards(AdvancementRewards.Builder.experience(100)) .save(writer, "husbandry/balanced_diet"); - Advancement.Builder.advancement() + Builder.advancement() .parent(advancementHolder2) .display( Items.NETHERITE_HOE, @@ -210,9 +206,9 @@ public class VanillaHusbandryAdvancements implements AdvancementSubProvider { false ) .rewards(AdvancementRewards.Builder.experience(100)) - .addCriterion("netherite_hoe", InventoryChangeTrigger.TriggerInstance.hasItems(Items.NETHERITE_HOE)) + .addCriterion("netherite_hoe", net.minecraft.advancements.critereon.InventoryChangeTrigger.TriggerInstance.hasItems(Items.NETHERITE_HOE)) .save(writer, "husbandry/obtain_netherite_hoe"); - AdvancementHolder advancementHolder4 = Advancement.Builder.advancement() + AdvancementHolder advancementHolder4 = Builder.advancement() .parent(advancementHolder) .display( Items.LEAD, @@ -224,11 +220,11 @@ public class VanillaHusbandryAdvancements implements AdvancementSubProvider { true, false ) - .addCriterion("tamed_animal", TameAnimalTrigger.TriggerInstance.tamedAnimal()) + .addCriterion("tamed_animal", net.minecraft.advancements.critereon.TameAnimalTrigger.TriggerInstance.tamedAnimal()) .save(writer, "husbandry/tame_an_animal"); - AdvancementHolder advancementHolder5 = addFish(Advancement.Builder.advancement()) + AdvancementHolder advancementHolder5 = addFish(Builder.advancement(), holderGetter2) .parent(advancementHolder) - .requirements(AdvancementRequirements.Strategy.OR) + .requirements(Strategy.OR) .display( Items.FISHING_ROD, Component.translatable("advancements.husbandry.fishy_business.title"), @@ -240,9 +236,9 @@ public class VanillaHusbandryAdvancements implements AdvancementSubProvider { false ) .save(writer, "husbandry/fishy_business"); - AdvancementHolder advancementHolder6 = addFishBuckets(Advancement.Builder.advancement()) + AdvancementHolder advancementHolder6 = addFishBuckets(Builder.advancement(), holderGetter2) .parent(advancementHolder5) - .requirements(AdvancementRequirements.Strategy.OR) + .requirements(Strategy.OR) .display( Items.PUFFERFISH_BUCKET, Component.translatable("advancements.husbandry.tactical_fishing.title"), @@ -254,12 +250,12 @@ public class VanillaHusbandryAdvancements implements AdvancementSubProvider { false ) .save(writer, "husbandry/tactical_fishing"); - AdvancementHolder advancementHolder7 = Advancement.Builder.advancement() + AdvancementHolder advancementHolder7 = Builder.advancement() .parent(advancementHolder6) - .requirements(AdvancementRequirements.Strategy.OR) + .requirements(Strategy.OR) .addCriterion( BuiltInRegistries.ITEM.getKey(Items.AXOLOTL_BUCKET).getPath(), - FilledBucketTrigger.TriggerInstance.filledBucket(ItemPredicate.Builder.item().of(Items.AXOLOTL_BUCKET)) + net.minecraft.advancements.critereon.FilledBucketTrigger.TriggerInstance.filledBucket(ItemPredicate.Builder.item().of(holderGetter2, Items.AXOLOTL_BUCKET)) ) .display( Items.AXOLOTL_BUCKET, @@ -272,9 +268,14 @@ public class VanillaHusbandryAdvancements implements AdvancementSubProvider { false ) .save(writer, "husbandry/axolotl_in_a_bucket"); - Advancement.Builder.advancement() + Builder.advancement() .parent(advancementHolder7) - .addCriterion("kill_axolotl_target", EffectsChangedTrigger.TriggerInstance.gotEffectsFrom(EntityPredicate.Builder.entity().of(EntityType.AXOLOTL))) + .addCriterion( + "kill_axolotl_target", + net.minecraft.advancements.critereon.EffectsChangedTrigger.TriggerInstance.gotEffectsFrom( + EntityPredicate.Builder.entity().of(holderGetter, EntityType.AXOLOTL) + ) + ) .display( Items.TROPICAL_FISH_BUCKET, Component.translatable("advancements.husbandry.kill_axolotl_target.title"), @@ -286,7 +287,7 @@ public class VanillaHusbandryAdvancements implements AdvancementSubProvider { false ) .save(writer, "husbandry/kill_axolotl_target"); - addCatVariants(Advancement.Builder.advancement()) + addCatVariants(Builder.advancement()) .parent(advancementHolder4) .display( Items.COD, @@ -300,7 +301,7 @@ public class VanillaHusbandryAdvancements implements AdvancementSubProvider { ) .rewards(AdvancementRewards.Builder.experience(50)) .save(writer, "husbandry/complete_catalogue"); - addTamedWolfVariants(Advancement.Builder.advancement(), registries) + addTamedWolfVariants(Builder.advancement(), registries) .parent(advancementHolder4) .display( Items.BONE, @@ -314,13 +315,15 @@ public class VanillaHusbandryAdvancements implements AdvancementSubProvider { ) .rewards(AdvancementRewards.Builder.experience(50)) .save(writer, "husbandry/whole_pack"); - AdvancementHolder advancementHolder8 = Advancement.Builder.advancement() + AdvancementHolder advancementHolder8 = Builder.advancement() .parent(advancementHolder) .addCriterion( "safely_harvest_honey", ItemUsedOnLocationTrigger.TriggerInstance.itemUsedOnBlock( - LocationPredicate.Builder.location().setBlock(BlockPredicate.Builder.block().of(BlockTags.BEEHIVES)).setSmokey(true), - ItemPredicate.Builder.item().of(Items.GLASS_BOTTLE) + net.minecraft.advancements.critereon.LocationPredicate.Builder.location() + .setBlock(BlockPredicate.Builder.block().of(holderGetter3, BlockTags.BEEHIVES)) + .setSmokey(true), + ItemPredicate.Builder.item().of(holderGetter2, Items.GLASS_BOTTLE) ) ) .display( @@ -334,7 +337,7 @@ public class VanillaHusbandryAdvancements implements AdvancementSubProvider { false ) .save(writer, "husbandry/safely_harvest_honey"); - AdvancementHolder advancementHolder9 = Advancement.Builder.advancement() + AdvancementHolder advancementHolder9 = Builder.advancement() .parent(advancementHolder8) .display( Items.HONEYCOMB, @@ -349,12 +352,13 @@ public class VanillaHusbandryAdvancements implements AdvancementSubProvider { .addCriterion( "wax_on", ItemUsedOnLocationTrigger.TriggerInstance.itemUsedOnBlock( - LocationPredicate.Builder.location().setBlock(BlockPredicate.Builder.block().of(((BiMap)HoneycombItem.WAXABLES.get()).keySet())), - ItemPredicate.Builder.item().of(Items.HONEYCOMB) + net.minecraft.advancements.critereon.LocationPredicate.Builder.location() + .setBlock(BlockPredicate.Builder.block().of(holderGetter3, ((BiMap)HoneycombItem.WAXABLES.get()).keySet())), + ItemPredicate.Builder.item().of(holderGetter2, Items.HONEYCOMB) ) ) .save(writer, "husbandry/wax_on"); - Advancement.Builder.advancement() + Builder.advancement() .parent(advancementHolder9) .display( Items.STONE_AXE, @@ -369,16 +373,17 @@ public class VanillaHusbandryAdvancements implements AdvancementSubProvider { .addCriterion( "wax_off", ItemUsedOnLocationTrigger.TriggerInstance.itemUsedOnBlock( - LocationPredicate.Builder.location().setBlock(BlockPredicate.Builder.block().of(((BiMap)HoneycombItem.WAX_OFF_BY_BLOCK.get()).keySet())), - ItemPredicate.Builder.item().of(WAX_SCRAPING_TOOLS) + net.minecraft.advancements.critereon.LocationPredicate.Builder.location() + .setBlock(BlockPredicate.Builder.block().of(holderGetter3, ((BiMap)HoneycombItem.WAX_OFF_BY_BLOCK.get()).keySet())), + ItemPredicate.Builder.item().of(holderGetter2, WAX_SCRAPING_TOOLS) ) ) .save(writer, "husbandry/wax_off"); - AdvancementHolder advancementHolder10 = Advancement.Builder.advancement() + AdvancementHolder advancementHolder10 = Builder.advancement() .parent(advancementHolder) .addCriterion( BuiltInRegistries.ITEM.getKey(Items.TADPOLE_BUCKET).getPath(), - FilledBucketTrigger.TriggerInstance.filledBucket(ItemPredicate.Builder.item().of(Items.TADPOLE_BUCKET)) + net.minecraft.advancements.critereon.FilledBucketTrigger.TriggerInstance.filledBucket(ItemPredicate.Builder.item().of(holderGetter2, Items.TADPOLE_BUCKET)) ) .display( Items.TADPOLE_BUCKET, @@ -391,7 +396,7 @@ public class VanillaHusbandryAdvancements implements AdvancementSubProvider { false ) .save(writer, "husbandry/tadpole_in_a_bucket"); - AdvancementHolder advancementHolder11 = addLeashedFrogVariants(Advancement.Builder.advancement()) + AdvancementHolder advancementHolder11 = addLeashedFrogVariants(holderGetter, holderGetter2, Builder.advancement()) .parent(advancementHolder10) .display( Items.LEAD, @@ -404,7 +409,7 @@ public class VanillaHusbandryAdvancements implements AdvancementSubProvider { false ) .save(writer, "husbandry/leash_all_frog_variants"); - Advancement.Builder.advancement() + Builder.advancement() .parent(advancementHolder11) .display( Items.VERDANT_FROGLIGHT, @@ -416,22 +421,25 @@ public class VanillaHusbandryAdvancements implements AdvancementSubProvider { true, false ) - .addCriterion("froglights", InventoryChangeTrigger.TriggerInstance.hasItems(Items.OCHRE_FROGLIGHT, Items.PEARLESCENT_FROGLIGHT, Items.VERDANT_FROGLIGHT)) + .addCriterion( + "froglights", + net.minecraft.advancements.critereon.InventoryChangeTrigger.TriggerInstance.hasItems( + Items.OCHRE_FROGLIGHT, Items.PEARLESCENT_FROGLIGHT, Items.VERDANT_FROGLIGHT + ) + ) .save(writer, "husbandry/froglights"); - Advancement.Builder.advancement() + Builder.advancement() .parent(advancementHolder) .addCriterion( "silk_touch_nest", - BeeNestDestroyedTrigger.TriggerInstance.destroyedBeeNest( + net.minecraft.advancements.critereon.BeeNestDestroyedTrigger.TriggerInstance.destroyedBeeNest( Blocks.BEE_NEST, ItemPredicate.Builder.item() .withSubPredicate( ItemSubPredicates.ENCHANTMENTS, - ItemEnchantmentsPredicate.enchantments( - List.of(new EnchantmentPredicate(registryLookup.getOrThrow(Enchantments.SILK_TOUCH), MinMaxBounds.Ints.atLeast(1))) - ) + ItemEnchantmentsPredicate.enchantments(List.of(new EnchantmentPredicate(registryLookup.getOrThrow(Enchantments.SILK_TOUCH), Ints.atLeast(1)))) ), - MinMaxBounds.Ints.exactly(3) + Ints.exactly(3) ) ) .display( @@ -445,7 +453,7 @@ public class VanillaHusbandryAdvancements implements AdvancementSubProvider { false ) .save(writer, "husbandry/silk_touch_nest"); - Advancement.Builder.advancement() + Builder.advancement() .parent(advancementHolder) .display( Items.OAK_BOAT, @@ -459,13 +467,15 @@ public class VanillaHusbandryAdvancements implements AdvancementSubProvider { ) .addCriterion( "ride_a_boat_with_a_goat", - StartRidingTrigger.TriggerInstance.playerStartsRiding( + net.minecraft.advancements.critereon.StartRidingTrigger.TriggerInstance.playerStartsRiding( EntityPredicate.Builder.entity() - .vehicle(EntityPredicate.Builder.entity().of(EntityType.BOAT).passenger(EntityPredicate.Builder.entity().of(EntityType.GOAT))) + .vehicle( + EntityPredicate.Builder.entity().of(holderGetter, EntityTypeTags.BOAT).passenger(EntityPredicate.Builder.entity().of(holderGetter, EntityType.GOAT)) + ) ) ) .save(writer, "husbandry/ride_a_boat_with_a_goat"); - Advancement.Builder.advancement() + Builder.advancement() .parent(advancementHolder) .display( Items.GLOW_INK_SAC, @@ -480,11 +490,12 @@ public class VanillaHusbandryAdvancements implements AdvancementSubProvider { .addCriterion( "make_a_sign_glow", ItemUsedOnLocationTrigger.TriggerInstance.itemUsedOnBlock( - LocationPredicate.Builder.location().setBlock(BlockPredicate.Builder.block().of(BlockTags.ALL_SIGNS)), ItemPredicate.Builder.item().of(Items.GLOW_INK_SAC) + net.minecraft.advancements.critereon.LocationPredicate.Builder.location().setBlock(BlockPredicate.Builder.block().of(holderGetter3, BlockTags.ALL_SIGNS)), + ItemPredicate.Builder.item().of(holderGetter2, Items.GLOW_INK_SAC) ) ) .save(writer, "husbandry/make_a_sign_glow"); - AdvancementHolder advancementHolder12 = Advancement.Builder.advancement() + AdvancementHolder advancementHolder12 = Builder.advancement() .parent(advancementHolder) .display( Items.COOKIE, @@ -498,12 +509,12 @@ public class VanillaHusbandryAdvancements implements AdvancementSubProvider { ) .addCriterion( "allay_deliver_item_to_player", - PickedUpItemTrigger.TriggerInstance.thrownItemPickedUpByPlayer( - Optional.empty(), Optional.empty(), Optional.of(EntityPredicate.wrap(EntityPredicate.Builder.entity().of(EntityType.ALLAY))) + net.minecraft.advancements.critereon.PickedUpItemTrigger.TriggerInstance.thrownItemPickedUpByPlayer( + Optional.empty(), Optional.empty(), Optional.of(EntityPredicate.wrap(EntityPredicate.Builder.entity().of(holderGetter, EntityType.ALLAY))) ) ) .save(writer, "husbandry/allay_deliver_item_to_player"); - Advancement.Builder.advancement() + Builder.advancement() .parent(advancementHolder12) .display( Items.NOTE_BLOCK, @@ -518,11 +529,12 @@ public class VanillaHusbandryAdvancements implements AdvancementSubProvider { .addCriterion( "allay_deliver_cake_to_note_block", ItemUsedOnLocationTrigger.TriggerInstance.allayDropItemOnBlock( - LocationPredicate.Builder.location().setBlock(BlockPredicate.Builder.block().of(Blocks.NOTE_BLOCK)), ItemPredicate.Builder.item().of(Items.CAKE) + net.minecraft.advancements.critereon.LocationPredicate.Builder.location().setBlock(BlockPredicate.Builder.block().of(holderGetter3, Blocks.NOTE_BLOCK)), + ItemPredicate.Builder.item().of(holderGetter2, Items.CAKE) ) ) .save(writer, "husbandry/allay_deliver_cake_to_note_block"); - AdvancementHolder advancementHolder13 = Advancement.Builder.advancement() + AdvancementHolder advancementHolder13 = Builder.advancement() .parent(advancementHolder) .display( Items.SNIFFER_EGG, @@ -534,9 +546,9 @@ public class VanillaHusbandryAdvancements implements AdvancementSubProvider { true, true ) - .addCriterion("obtain_sniffer_egg", InventoryChangeTrigger.TriggerInstance.hasItems(Items.SNIFFER_EGG)) + .addCriterion("obtain_sniffer_egg", net.minecraft.advancements.critereon.InventoryChangeTrigger.TriggerInstance.hasItems(Items.SNIFFER_EGG)) .save(writer, "husbandry/obtain_sniffer_egg"); - AdvancementHolder advancementHolder14 = Advancement.Builder.advancement() + AdvancementHolder advancementHolder14 = Builder.advancement() .parent(advancementHolder13) .display( Items.TORCHFLOWER_SEEDS, @@ -550,13 +562,19 @@ public class VanillaHusbandryAdvancements implements AdvancementSubProvider { ) .addCriterion( "feed_snifflet", - PlayerInteractTrigger.TriggerInstance.itemUsedOnEntity( - ItemPredicate.Builder.item().of(ItemTags.SNIFFER_FOOD), - Optional.of(EntityPredicate.wrap(EntityPredicate.Builder.entity().of(EntityType.SNIFFER).flags(EntityFlagsPredicate.Builder.flags().setIsBaby(true)))) + net.minecraft.advancements.critereon.PlayerInteractTrigger.TriggerInstance.itemUsedOnEntity( + ItemPredicate.Builder.item().of(holderGetter2, ItemTags.SNIFFER_FOOD), + Optional.of( + EntityPredicate.wrap( + EntityPredicate.Builder.entity() + .of(holderGetter, EntityType.SNIFFER) + .flags(net.minecraft.advancements.critereon.EntityFlagsPredicate.Builder.flags().setIsBaby(true)) + ) + ) ) ) .save(writer, "husbandry/feed_snifflet"); - Advancement.Builder.advancement() + Builder.advancement() .parent(advancementHolder14) .display( Items.PITCHER_POD, @@ -568,11 +586,11 @@ public class VanillaHusbandryAdvancements implements AdvancementSubProvider { true, true ) - .requirements(AdvancementRequirements.Strategy.OR) + .requirements(Strategy.OR) .addCriterion("torchflower", ItemUsedOnLocationTrigger.TriggerInstance.placedBlock(Blocks.TORCHFLOWER_CROP)) .addCriterion("pitcher_pod", ItemUsedOnLocationTrigger.TriggerInstance.placedBlock(Blocks.PITCHER_CROP)) .save(writer, "husbandry/plant_any_sniffer_seed"); - Advancement.Builder.advancement() + Builder.advancement() .parent(advancementHolder4) .display( Items.SHEARS, @@ -586,12 +604,13 @@ public class VanillaHusbandryAdvancements implements AdvancementSubProvider { ) .addCriterion( "remove_wolf_armor", - PlayerInteractTrigger.TriggerInstance.itemUsedOnEntity( - ItemPredicate.Builder.item().of(Items.SHEARS), Optional.of(EntityPredicate.wrap(EntityPredicate.Builder.entity().of(EntityType.WOLF))) + net.minecraft.advancements.critereon.PlayerInteractTrigger.TriggerInstance.itemUsedOnEntity( + ItemPredicate.Builder.item().of(holderGetter2, Items.SHEARS), + Optional.of(EntityPredicate.wrap(EntityPredicate.Builder.entity().of(holderGetter, EntityType.WOLF))) ) ) .save(writer, "husbandry/remove_wolf_armor"); - Advancement.Builder.advancement() + Builder.advancement() .parent(advancementHolder4) .display( Items.WOLF_ARMOR, @@ -605,15 +624,19 @@ public class VanillaHusbandryAdvancements implements AdvancementSubProvider { ) .addCriterion( "repair_wolf_armor", - PlayerInteractTrigger.TriggerInstance.itemUsedOnEntity( - ItemPredicate.Builder.item().of(Items.ARMADILLO_SCUTE), + net.minecraft.advancements.critereon.PlayerInteractTrigger.TriggerInstance.itemUsedOnEntity( + ItemPredicate.Builder.item().of(holderGetter2, Items.ARMADILLO_SCUTE), Optional.of( EntityPredicate.wrap( EntityPredicate.Builder.entity() - .of(EntityType.WOLF) + .of(holderGetter, EntityType.WOLF) .equipment( EntityEquipmentPredicate.Builder.equipment() - .body(ItemPredicate.Builder.item().of(Items.WOLF_ARMOR).hasComponents(DataComponentPredicate.builder().expect(DataComponents.DAMAGE, 0).build())) + .body( + ItemPredicate.Builder.item() + .of(holderGetter2, Items.WOLF_ARMOR) + .hasComponents(DataComponentPredicate.builder().expect(DataComponents.DAMAGE, 0).build()) + ) ) ) ) @@ -623,10 +646,14 @@ public class VanillaHusbandryAdvancements implements AdvancementSubProvider { } public static AdvancementHolder createBreedAllAnimalsAdvancement( - AdvancementHolder parent, Consumer writer, Stream> breedableAnimals, Stream> indirectlyBreedableAnimals + AdvancementHolder advancementHolder, + Consumer consumer, + HolderGetter> holderGetter, + Stream> stream, + Stream> stream2 ) { - return addBreedable(Advancement.Builder.advancement(), breedableAnimals, indirectlyBreedableAnimals) - .parent(parent) + return addBreedable(Builder.advancement(), stream, holderGetter, stream2) + .parent(advancementHolder) .display( Items.GOLDEN_CARROT, Component.translatable("advancements.husbandry.breed_all_animals.title"), @@ -638,49 +665,46 @@ public class VanillaHusbandryAdvancements implements AdvancementSubProvider { false ) .rewards(AdvancementRewards.Builder.experience(100)) - .save(writer, "husbandry/bred_all_animals"); + .save(consumer, "husbandry/bred_all_animals"); } - private static Advancement.Builder addLeashedFrogVariants(Advancement.Builder builder) { + private static Builder addLeashedFrogVariants(HolderGetter> holderGetter, HolderGetter holderGetter2, Builder builder) { BuiltInRegistries.FROG_VARIANT - .holders() + .listElements() .forEach( reference -> builder.addCriterion( reference.key().location().toString(), - PlayerInteractTrigger.TriggerInstance.itemUsedOnEntity( - ItemPredicate.Builder.item().of(Items.LEAD), - Optional.of(EntityPredicate.wrap(EntityPredicate.Builder.entity().of(EntityType.FROG).subPredicate(EntitySubPredicates.frogVariant(reference)))) + net.minecraft.advancements.critereon.PlayerInteractTrigger.TriggerInstance.itemUsedOnEntity( + ItemPredicate.Builder.item().of(holderGetter2, Items.LEAD), + Optional.of( + EntityPredicate.wrap(EntityPredicate.Builder.entity().of(holderGetter, EntityType.FROG).subPredicate(EntitySubPredicates.frogVariant(reference))) + ) ) ) ); return builder; } - /** - * Adds all the items in {@link #EDIBLE_ITEMS} to the given advancement's criteria - */ - private static Advancement.Builder addFood(Advancement.Builder builder) { + private static Builder addFood(Builder builder, HolderGetter holderGetter) { for (Item item : EDIBLE_ITEMS) { - builder.addCriterion(BuiltInRegistries.ITEM.getKey(item).getPath(), ConsumeItemTrigger.TriggerInstance.usedItem(item)); + builder.addCriterion(BuiltInRegistries.ITEM.getKey(item).getPath(), ConsumeItemTrigger.TriggerInstance.usedItem(holderGetter, item)); } return builder; } - private static Advancement.Builder addBreedable( - Advancement.Builder builder, Stream> breedableAnimals, Stream> indirectlyBreedableAnimals - ) { - breedableAnimals.forEach( + private static Builder addBreedable(Builder builder, Stream> stream, HolderGetter> holderGetter, Stream> stream2) { + stream.forEach( entityType -> builder.addCriterion( - EntityType.getKey(entityType).toString(), BredAnimalsTrigger.TriggerInstance.bredAnimals(EntityPredicate.Builder.entity().of(entityType)) + EntityType.getKey(entityType).toString(), TriggerInstance.bredAnimals(EntityPredicate.Builder.entity().of(holderGetter, entityType)) ) ); - indirectlyBreedableAnimals.forEach( + stream2.forEach( entityType -> builder.addCriterion( EntityType.getKey(entityType).toString(), - BredAnimalsTrigger.TriggerInstance.bredAnimals( - Optional.of(EntityPredicate.Builder.entity().of(entityType).build()), - Optional.of(EntityPredicate.Builder.entity().of(entityType).build()), + TriggerInstance.bredAnimals( + Optional.of(EntityPredicate.Builder.entity().of(holderGetter, entityType).build()), + Optional.of(EntityPredicate.Builder.entity().of(holderGetter, entityType).build()), Optional.empty() ) ) @@ -688,39 +712,46 @@ public class VanillaHusbandryAdvancements implements AdvancementSubProvider { return builder; } - private static Advancement.Builder addFishBuckets(Advancement.Builder builder) { + private static Builder addFishBuckets(Builder builder, HolderGetter holderGetter) { for (Item item : FISH_BUCKETS) { - builder.addCriterion(BuiltInRegistries.ITEM.getKey(item).getPath(), FilledBucketTrigger.TriggerInstance.filledBucket(ItemPredicate.Builder.item().of(item))); - } - - return builder; - } - - private static Advancement.Builder addFish(Advancement.Builder builder) { - for (Item item : FISH) { builder.addCriterion( BuiltInRegistries.ITEM.getKey(item).getPath(), - FishingRodHookedTrigger.TriggerInstance.fishedItem(Optional.empty(), Optional.empty(), Optional.of(ItemPredicate.Builder.item().of(item).build())) + net.minecraft.advancements.critereon.FilledBucketTrigger.TriggerInstance.filledBucket(ItemPredicate.Builder.item().of(holderGetter, item)) ); } return builder; } - private static Advancement.Builder addCatVariants(Advancement.Builder builder) { + private static Builder addFish(Builder builder, HolderGetter holderGetter) { + for (Item item : FISH) { + builder.addCriterion( + BuiltInRegistries.ITEM.getKey(item).getPath(), + FishingRodHookedTrigger.TriggerInstance.fishedItem( + Optional.empty(), Optional.empty(), Optional.of(ItemPredicate.Builder.item().of(holderGetter, item).build()) + ) + ); + } + + return builder; + } + + private static Builder addCatVariants(Builder builder) { BuiltInRegistries.CAT_VARIANT - .holders() + .listElements() .sorted(Comparator.comparing(reference -> reference.key().location())) .forEach( reference -> builder.addCriterion( reference.key().location().toString(), - TameAnimalTrigger.TriggerInstance.tamedAnimal(EntityPredicate.Builder.entity().subPredicate(EntitySubPredicates.catVariant(reference))) + net.minecraft.advancements.critereon.TameAnimalTrigger.TriggerInstance.tamedAnimal( + EntityPredicate.Builder.entity().subPredicate(EntitySubPredicates.catVariant(reference)) + ) ) ); return builder; } - private static Advancement.Builder addTamedWolfVariants(Advancement.Builder builder, HolderLookup.Provider registries) { + private static Builder addTamedWolfVariants(Builder builder, HolderLookup.Provider registries) { HolderLookup.RegistryLookup registryLookup = registries.lookupOrThrow(Registries.WOLF_VARIANT); registryLookup.listElementIds() .sorted(Comparator.comparing(ResourceKey::location)) @@ -729,7 +760,9 @@ public class VanillaHusbandryAdvancements implements AdvancementSubProvider { Holder holder = registryLookup.getOrThrow(resourceKey); builder.addCriterion( resourceKey.location().toString(), - TameAnimalTrigger.TriggerInstance.tamedAnimal(EntityPredicate.Builder.entity().subPredicate(EntitySubPredicates.wolfVariant(HolderSet.direct(holder)))) + net.minecraft.advancements.critereon.TameAnimalTrigger.TriggerInstance.tamedAnimal( + EntityPredicate.Builder.entity().subPredicate(EntitySubPredicates.wolfVariant(HolderSet.direct(holder))) + ) ); } ); diff --git a/net/minecraft/data/advancements/packs/VanillaNetherAdvancements.java b/net/minecraft/data/advancements/packs/VanillaNetherAdvancements.java index b93e87ad..d9b914e2 100644 --- a/net/minecraft/data/advancements/packs/VanillaNetherAdvancements.java +++ b/net/minecraft/data/advancements/packs/VanillaNetherAdvancements.java @@ -2,38 +2,25 @@ package net.minecraft.data.advancements.packs; import java.util.Optional; import java.util.function.Consumer; -import net.minecraft.advancements.Advancement; import net.minecraft.advancements.AdvancementHolder; -import net.minecraft.advancements.AdvancementRequirements; import net.minecraft.advancements.AdvancementRewards; import net.minecraft.advancements.AdvancementType; +import net.minecraft.advancements.Advancement.Builder; +import net.minecraft.advancements.AdvancementRequirements.Strategy; import net.minecraft.advancements.critereon.BlockPredicate; -import net.minecraft.advancements.critereon.BrewedPotionTrigger; -import net.minecraft.advancements.critereon.ChangeDimensionTrigger; -import net.minecraft.advancements.critereon.ConstructBeaconTrigger; import net.minecraft.advancements.critereon.ContextAwarePredicate; -import net.minecraft.advancements.critereon.DamageSourcePredicate; import net.minecraft.advancements.critereon.DistancePredicate; -import net.minecraft.advancements.critereon.DistanceTrigger; -import net.minecraft.advancements.critereon.EffectsChangedTrigger; import net.minecraft.advancements.critereon.EntityEquipmentPredicate; -import net.minecraft.advancements.critereon.EntityFlagsPredicate; import net.minecraft.advancements.critereon.EntityPredicate; -import net.minecraft.advancements.critereon.InventoryChangeTrigger; -import net.minecraft.advancements.critereon.ItemDurabilityTrigger; import net.minecraft.advancements.critereon.ItemPredicate; import net.minecraft.advancements.critereon.ItemUsedOnLocationTrigger; -import net.minecraft.advancements.critereon.KilledTrigger; -import net.minecraft.advancements.critereon.LocationPredicate; import net.minecraft.advancements.critereon.LootTableTrigger; -import net.minecraft.advancements.critereon.MinMaxBounds; -import net.minecraft.advancements.critereon.MobEffectsPredicate; -import net.minecraft.advancements.critereon.PickedUpItemTrigger; -import net.minecraft.advancements.critereon.PlayerInteractTrigger; import net.minecraft.advancements.critereon.PlayerTrigger; -import net.minecraft.advancements.critereon.StatePropertiesPredicate; -import net.minecraft.advancements.critereon.SummonedEntityTrigger; import net.minecraft.advancements.critereon.TagPredicate; +import net.minecraft.advancements.critereon.ChangeDimensionTrigger.TriggerInstance; +import net.minecraft.advancements.critereon.MinMaxBounds.Doubles; +import net.minecraft.advancements.critereon.MinMaxBounds.Ints; +import net.minecraft.core.HolderGetter; import net.minecraft.core.HolderLookup; import net.minecraft.core.registries.Registries; import net.minecraft.data.advancements.AdvancementSubProvider; @@ -44,9 +31,11 @@ import net.minecraft.tags.ItemTags; import net.minecraft.world.effect.MobEffects; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.monster.piglin.PiglinAi; +import net.minecraft.world.item.Item; import net.minecraft.world.item.Items; import net.minecraft.world.level.Level; import net.minecraft.world.level.biome.MultiNoiseBiomeSourceParameterList; +import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.RespawnAnchorBlock; import net.minecraft.world.level.levelgen.structure.BuiltinStructures; @@ -55,36 +44,12 @@ import net.minecraft.world.level.storage.loot.LootContext; import net.minecraft.world.level.storage.loot.predicates.LootItemEntityPropertyCondition; public class VanillaNetherAdvancements implements AdvancementSubProvider { - private static final ContextAwarePredicate DISTRACT_PIGLIN_PLAYER_ARMOR_PREDICATE = ContextAwarePredicate.create( - LootItemEntityPropertyCondition.hasProperties( - LootContext.EntityTarget.THIS, - EntityPredicate.Builder.entity().equipment(EntityEquipmentPredicate.Builder.equipment().head(ItemPredicate.Builder.item().of(Items.GOLDEN_HELMET))) - ) - .invert() - .build(), - LootItemEntityPropertyCondition.hasProperties( - LootContext.EntityTarget.THIS, - EntityPredicate.Builder.entity().equipment(EntityEquipmentPredicate.Builder.equipment().chest(ItemPredicate.Builder.item().of(Items.GOLDEN_CHESTPLATE))) - ) - .invert() - .build(), - LootItemEntityPropertyCondition.hasProperties( - LootContext.EntityTarget.THIS, - EntityPredicate.Builder.entity().equipment(EntityEquipmentPredicate.Builder.equipment().legs(ItemPredicate.Builder.item().of(Items.GOLDEN_LEGGINGS))) - ) - .invert() - .build(), - LootItemEntityPropertyCondition.hasProperties( - LootContext.EntityTarget.THIS, - EntityPredicate.Builder.entity().equipment(EntityEquipmentPredicate.Builder.equipment().feet(ItemPredicate.Builder.item().of(Items.GOLDEN_BOOTS))) - ) - .invert() - .build() - ); - @Override public void generate(HolderLookup.Provider registries, Consumer writer) { - AdvancementHolder advancementHolder = Advancement.Builder.advancement() + HolderGetter> holderGetter = registries.lookupOrThrow(Registries.ENTITY_TYPE); + HolderGetter holderGetter2 = registries.lookupOrThrow(Registries.ITEM); + HolderGetter holderGetter3 = registries.lookupOrThrow(Registries.BLOCK); + AdvancementHolder advancementHolder = Builder.advancement() .display( Blocks.RED_NETHER_BRICKS, Component.translatable("advancements.nether.root.title"), @@ -95,9 +60,9 @@ public class VanillaNetherAdvancements implements AdvancementSubProvider { false, false ) - .addCriterion("entered_nether", ChangeDimensionTrigger.TriggerInstance.changedDimensionTo(Level.NETHER)) + .addCriterion("entered_nether", TriggerInstance.changedDimensionTo(Level.NETHER)) .save(writer, "nether/root"); - AdvancementHolder advancementHolder2 = Advancement.Builder.advancement() + AdvancementHolder advancementHolder2 = Builder.advancement() .parent(advancementHolder) .display( Items.FIRE_CHARGE, @@ -112,15 +77,15 @@ public class VanillaNetherAdvancements implements AdvancementSubProvider { .rewards(AdvancementRewards.Builder.experience(50)) .addCriterion( "killed_ghast", - KilledTrigger.TriggerInstance.playerKilledEntity( - EntityPredicate.Builder.entity().of(EntityType.GHAST), - DamageSourcePredicate.Builder.damageType() + net.minecraft.advancements.critereon.KilledTrigger.TriggerInstance.playerKilledEntity( + EntityPredicate.Builder.entity().of(holderGetter, EntityType.GHAST), + net.minecraft.advancements.critereon.DamageSourcePredicate.Builder.damageType() .tag(TagPredicate.is(DamageTypeTags.IS_PROJECTILE)) - .direct(EntityPredicate.Builder.entity().of(EntityType.FIREBALL)) + .direct(EntityPredicate.Builder.entity().of(holderGetter, EntityType.FIREBALL)) ) ) .save(writer, "nether/return_to_sender"); - AdvancementHolder advancementHolder3 = Advancement.Builder.advancement() + AdvancementHolder advancementHolder3 = Builder.advancement() .parent(advancementHolder) .display( Blocks.NETHER_BRICKS, @@ -135,11 +100,13 @@ public class VanillaNetherAdvancements implements AdvancementSubProvider { .addCriterion( "fortress", PlayerTrigger.TriggerInstance.located( - LocationPredicate.Builder.inStructure(registries.lookupOrThrow(Registries.STRUCTURE).getOrThrow(BuiltinStructures.FORTRESS)) + net.minecraft.advancements.critereon.LocationPredicate.Builder.inStructure( + registries.lookupOrThrow(Registries.STRUCTURE).getOrThrow(BuiltinStructures.FORTRESS) + ) ) ) .save(writer, "nether/find_fortress"); - Advancement.Builder.advancement() + Builder.advancement() .parent(advancementHolder) .display( Items.MAP, @@ -152,9 +119,12 @@ public class VanillaNetherAdvancements implements AdvancementSubProvider { false ) .rewards(AdvancementRewards.Builder.experience(100)) - .addCriterion("travelled", DistanceTrigger.TriggerInstance.travelledThroughNether(DistancePredicate.horizontal(MinMaxBounds.Doubles.atLeast(7000.0)))) + .addCriterion( + "travelled", + net.minecraft.advancements.critereon.DistanceTrigger.TriggerInstance.travelledThroughNether(DistancePredicate.horizontal(Doubles.atLeast(7000.0))) + ) .save(writer, "nether/fast_travel"); - Advancement.Builder.advancement() + Builder.advancement() .parent(advancementHolder2) .display( Items.GHAST_TEAR, @@ -169,12 +139,14 @@ public class VanillaNetherAdvancements implements AdvancementSubProvider { .rewards(AdvancementRewards.Builder.experience(100)) .addCriterion( "killed_ghast", - KilledTrigger.TriggerInstance.playerKilledEntity( - EntityPredicate.Builder.entity().of(EntityType.GHAST).located(LocationPredicate.Builder.inDimension(Level.OVERWORLD)) + net.minecraft.advancements.critereon.KilledTrigger.TriggerInstance.playerKilledEntity( + EntityPredicate.Builder.entity() + .of(holderGetter, EntityType.GHAST) + .located(net.minecraft.advancements.critereon.LocationPredicate.Builder.inDimension(Level.OVERWORLD)) ) ) .save(writer, "nether/uneasy_alliance"); - AdvancementHolder advancementHolder4 = Advancement.Builder.advancement() + AdvancementHolder advancementHolder4 = Builder.advancement() .parent(advancementHolder3) .display( Blocks.WITHER_SKELETON_SKULL, @@ -186,9 +158,9 @@ public class VanillaNetherAdvancements implements AdvancementSubProvider { true, false ) - .addCriterion("wither_skull", InventoryChangeTrigger.TriggerInstance.hasItems(Blocks.WITHER_SKELETON_SKULL)) + .addCriterion("wither_skull", net.minecraft.advancements.critereon.InventoryChangeTrigger.TriggerInstance.hasItems(Blocks.WITHER_SKELETON_SKULL)) .save(writer, "nether/get_wither_skull"); - AdvancementHolder advancementHolder5 = Advancement.Builder.advancement() + AdvancementHolder advancementHolder5 = Builder.advancement() .parent(advancementHolder4) .display( Items.NETHER_STAR, @@ -200,9 +172,14 @@ public class VanillaNetherAdvancements implements AdvancementSubProvider { true, false ) - .addCriterion("summoned", SummonedEntityTrigger.TriggerInstance.summonedEntity(EntityPredicate.Builder.entity().of(EntityType.WITHER))) + .addCriterion( + "summoned", + net.minecraft.advancements.critereon.SummonedEntityTrigger.TriggerInstance.summonedEntity( + EntityPredicate.Builder.entity().of(holderGetter, EntityType.WITHER) + ) + ) .save(writer, "nether/summon_wither"); - AdvancementHolder advancementHolder6 = Advancement.Builder.advancement() + AdvancementHolder advancementHolder6 = Builder.advancement() .parent(advancementHolder3) .display( Items.BLAZE_ROD, @@ -214,9 +191,9 @@ public class VanillaNetherAdvancements implements AdvancementSubProvider { true, false ) - .addCriterion("blaze_rod", InventoryChangeTrigger.TriggerInstance.hasItems(Items.BLAZE_ROD)) + .addCriterion("blaze_rod", net.minecraft.advancements.critereon.InventoryChangeTrigger.TriggerInstance.hasItems(Items.BLAZE_ROD)) .save(writer, "nether/obtain_blaze_rod"); - AdvancementHolder advancementHolder7 = Advancement.Builder.advancement() + AdvancementHolder advancementHolder7 = Builder.advancement() .parent(advancementHolder5) .display( Blocks.BEACON, @@ -228,9 +205,9 @@ public class VanillaNetherAdvancements implements AdvancementSubProvider { true, false ) - .addCriterion("beacon", ConstructBeaconTrigger.TriggerInstance.constructedBeacon(MinMaxBounds.Ints.atLeast(1))) + .addCriterion("beacon", net.minecraft.advancements.critereon.ConstructBeaconTrigger.TriggerInstance.constructedBeacon(Ints.atLeast(1))) .save(writer, "nether/create_beacon"); - Advancement.Builder.advancement() + Builder.advancement() .parent(advancementHolder7) .display( Blocks.BEACON, @@ -242,9 +219,9 @@ public class VanillaNetherAdvancements implements AdvancementSubProvider { true, false ) - .addCriterion("beacon", ConstructBeaconTrigger.TriggerInstance.constructedBeacon(MinMaxBounds.Ints.exactly(4))) + .addCriterion("beacon", net.minecraft.advancements.critereon.ConstructBeaconTrigger.TriggerInstance.constructedBeacon(Ints.exactly(4))) .save(writer, "nether/create_full_beacon"); - AdvancementHolder advancementHolder8 = Advancement.Builder.advancement() + AdvancementHolder advancementHolder8 = Builder.advancement() .parent(advancementHolder6) .display( Items.POTION, @@ -256,9 +233,9 @@ public class VanillaNetherAdvancements implements AdvancementSubProvider { true, false ) - .addCriterion("potion", BrewedPotionTrigger.TriggerInstance.brewedPotion()) + .addCriterion("potion", net.minecraft.advancements.critereon.BrewedPotionTrigger.TriggerInstance.brewedPotion()) .save(writer, "nether/brew_potion"); - AdvancementHolder advancementHolder9 = Advancement.Builder.advancement() + AdvancementHolder advancementHolder9 = Builder.advancement() .parent(advancementHolder8) .display( Items.MILK_BUCKET, @@ -273,8 +250,8 @@ public class VanillaNetherAdvancements implements AdvancementSubProvider { .rewards(AdvancementRewards.Builder.experience(100)) .addCriterion( "all_effects", - EffectsChangedTrigger.TriggerInstance.hasEffects( - MobEffectsPredicate.Builder.effects() + net.minecraft.advancements.critereon.EffectsChangedTrigger.TriggerInstance.hasEffects( + net.minecraft.advancements.critereon.MobEffectsPredicate.Builder.effects() .and(MobEffects.MOVEMENT_SPEED) .and(MobEffects.MOVEMENT_SLOWDOWN) .and(MobEffects.DAMAGE_BOOST) @@ -295,7 +272,7 @@ public class VanillaNetherAdvancements implements AdvancementSubProvider { ) ) .save(writer, "nether/all_potions"); - Advancement.Builder.advancement() + Builder.advancement() .parent(advancementHolder9) .display( Items.BUCKET, @@ -310,8 +287,8 @@ public class VanillaNetherAdvancements implements AdvancementSubProvider { .rewards(AdvancementRewards.Builder.experience(1000)) .addCriterion( "all_effects", - EffectsChangedTrigger.TriggerInstance.hasEffects( - MobEffectsPredicate.Builder.effects() + net.minecraft.advancements.critereon.EffectsChangedTrigger.TriggerInstance.hasEffects( + net.minecraft.advancements.critereon.MobEffectsPredicate.Builder.effects() .and(MobEffects.MOVEMENT_SPEED) .and(MobEffects.MOVEMENT_SLOWDOWN) .and(MobEffects.DAMAGE_BOOST) @@ -348,7 +325,7 @@ public class VanillaNetherAdvancements implements AdvancementSubProvider { ) ) .save(writer, "nether/all_effects"); - AdvancementHolder advancementHolder10 = Advancement.Builder.advancement() + AdvancementHolder advancementHolder10 = Builder.advancement() .parent(advancementHolder) .display( Items.ANCIENT_DEBRIS, @@ -360,9 +337,9 @@ public class VanillaNetherAdvancements implements AdvancementSubProvider { true, false ) - .addCriterion("ancient_debris", InventoryChangeTrigger.TriggerInstance.hasItems(Items.ANCIENT_DEBRIS)) + .addCriterion("ancient_debris", net.minecraft.advancements.critereon.InventoryChangeTrigger.TriggerInstance.hasItems(Items.ANCIENT_DEBRIS)) .save(writer, "nether/obtain_ancient_debris"); - Advancement.Builder.advancement() + Builder.advancement() .parent(advancementHolder10) .display( Items.NETHERITE_CHESTPLATE, @@ -377,10 +354,12 @@ public class VanillaNetherAdvancements implements AdvancementSubProvider { .rewards(AdvancementRewards.Builder.experience(100)) .addCriterion( "netherite_armor", - InventoryChangeTrigger.TriggerInstance.hasItems(Items.NETHERITE_HELMET, Items.NETHERITE_CHESTPLATE, Items.NETHERITE_LEGGINGS, Items.NETHERITE_BOOTS) + net.minecraft.advancements.critereon.InventoryChangeTrigger.TriggerInstance.hasItems( + Items.NETHERITE_HELMET, Items.NETHERITE_CHESTPLATE, Items.NETHERITE_LEGGINGS, Items.NETHERITE_BOOTS + ) ) .save(writer, "nether/netherite_armor"); - Advancement.Builder.advancement() + Builder.advancement() .parent(advancementHolder10) .display( Items.LODESTONE, @@ -395,11 +374,12 @@ public class VanillaNetherAdvancements implements AdvancementSubProvider { .addCriterion( "use_lodestone", ItemUsedOnLocationTrigger.TriggerInstance.itemUsedOnBlock( - LocationPredicate.Builder.location().setBlock(BlockPredicate.Builder.block().of(Blocks.LODESTONE)), ItemPredicate.Builder.item().of(Items.COMPASS) + net.minecraft.advancements.critereon.LocationPredicate.Builder.location().setBlock(BlockPredicate.Builder.block().of(holderGetter3, Blocks.LODESTONE)), + ItemPredicate.Builder.item().of(holderGetter2, Items.COMPASS) ) ) .save(writer, "nether/use_lodestone"); - AdvancementHolder advancementHolder11 = Advancement.Builder.advancement() + AdvancementHolder advancementHolder11 = Builder.advancement() .parent(advancementHolder) .display( Items.CRYING_OBSIDIAN, @@ -411,9 +391,9 @@ public class VanillaNetherAdvancements implements AdvancementSubProvider { true, false ) - .addCriterion("crying_obsidian", InventoryChangeTrigger.TriggerInstance.hasItems(Items.CRYING_OBSIDIAN)) + .addCriterion("crying_obsidian", net.minecraft.advancements.critereon.InventoryChangeTrigger.TriggerInstance.hasItems(Items.CRYING_OBSIDIAN)) .save(writer, "nether/obtain_crying_obsidian"); - Advancement.Builder.advancement() + Builder.advancement() .parent(advancementHolder11) .display( Items.RESPAWN_ANCHOR, @@ -428,17 +408,17 @@ public class VanillaNetherAdvancements implements AdvancementSubProvider { .addCriterion( "charge_respawn_anchor", ItemUsedOnLocationTrigger.TriggerInstance.itemUsedOnBlock( - LocationPredicate.Builder.location() + net.minecraft.advancements.critereon.LocationPredicate.Builder.location() .setBlock( BlockPredicate.Builder.block() - .of(Blocks.RESPAWN_ANCHOR) - .setProperties(StatePropertiesPredicate.Builder.properties().hasProperty(RespawnAnchorBlock.CHARGE, 4)) + .of(holderGetter3, Blocks.RESPAWN_ANCHOR) + .setProperties(net.minecraft.advancements.critereon.StatePropertiesPredicate.Builder.properties().hasProperty(RespawnAnchorBlock.CHARGE, 4)) ), - ItemPredicate.Builder.item().of(Blocks.GLOWSTONE) + ItemPredicate.Builder.item().of(holderGetter2, Blocks.GLOWSTONE) ) ) .save(writer, "nether/charge_respawn_anchor"); - AdvancementHolder advancementHolder12 = Advancement.Builder.advancement() + AdvancementHolder advancementHolder12 = Builder.advancement() .parent(advancementHolder) .display( Items.WARPED_FUNGUS_ON_A_STICK, @@ -452,14 +432,14 @@ public class VanillaNetherAdvancements implements AdvancementSubProvider { ) .addCriterion( "used_warped_fungus_on_a_stick", - ItemDurabilityTrigger.TriggerInstance.changedDurability( - Optional.of(EntityPredicate.wrap(EntityPredicate.Builder.entity().vehicle(EntityPredicate.Builder.entity().of(EntityType.STRIDER)))), - Optional.of(ItemPredicate.Builder.item().of(Items.WARPED_FUNGUS_ON_A_STICK).build()), - MinMaxBounds.Ints.ANY + net.minecraft.advancements.critereon.ItemDurabilityTrigger.TriggerInstance.changedDurability( + Optional.of(EntityPredicate.wrap(EntityPredicate.Builder.entity().vehicle(EntityPredicate.Builder.entity().of(holderGetter, EntityType.STRIDER)))), + Optional.of(ItemPredicate.Builder.item().of(holderGetter2, Items.WARPED_FUNGUS_ON_A_STICK).build()), + Ints.ANY ) ) .save(writer, "nether/ride_strider"); - Advancement.Builder.advancement() + Builder.advancement() .parent(advancementHolder12) .display( Items.WARPED_FUNGUS_ON_A_STICK, @@ -473,15 +453,15 @@ public class VanillaNetherAdvancements implements AdvancementSubProvider { ) .addCriterion( "ride_entity_distance", - DistanceTrigger.TriggerInstance.rideEntityInLava( + net.minecraft.advancements.critereon.DistanceTrigger.TriggerInstance.rideEntityInLava( EntityPredicate.Builder.entity() - .located(LocationPredicate.Builder.inDimension(Level.OVERWORLD)) - .vehicle(EntityPredicate.Builder.entity().of(EntityType.STRIDER)), - DistancePredicate.horizontal(MinMaxBounds.Doubles.atLeast(50.0)) + .located(net.minecraft.advancements.critereon.LocationPredicate.Builder.inDimension(Level.OVERWORLD)) + .vehicle(EntityPredicate.Builder.entity().of(holderGetter, EntityType.STRIDER)), + DistancePredicate.horizontal(Doubles.atLeast(50.0)) ) ) .save(writer, "nether/ride_strider_in_overworld_lava"); - VanillaAdventureAdvancements.addBiomes(Advancement.Builder.advancement(), registries, MultiNoiseBiomeSourceParameterList.Preset.NETHER.usedBiomes().toList()) + VanillaAdventureAdvancements.addBiomes(Builder.advancement(), registries, MultiNoiseBiomeSourceParameterList.Preset.NETHER.usedBiomes().toList()) .parent(advancementHolder12) .display( Items.NETHERITE_BOOTS, @@ -495,7 +475,7 @@ public class VanillaNetherAdvancements implements AdvancementSubProvider { ) .rewards(AdvancementRewards.Builder.experience(500)) .save(writer, "nether/explore_nether"); - AdvancementHolder advancementHolder13 = Advancement.Builder.advancement() + AdvancementHolder advancementHolder13 = Builder.advancement() .parent(advancementHolder) .display( Items.POLISHED_BLACKSTONE_BRICKS, @@ -510,11 +490,13 @@ public class VanillaNetherAdvancements implements AdvancementSubProvider { .addCriterion( "bastion", PlayerTrigger.TriggerInstance.located( - LocationPredicate.Builder.inStructure(registries.lookupOrThrow(Registries.STRUCTURE).getOrThrow(BuiltinStructures.BASTION_REMNANT)) + net.minecraft.advancements.critereon.LocationPredicate.Builder.inStructure( + registries.lookupOrThrow(Registries.STRUCTURE).getOrThrow(BuiltinStructures.BASTION_REMNANT) + ) ) ) .save(writer, "nether/find_bastion"); - Advancement.Builder.advancement() + Builder.advancement() .parent(advancementHolder13) .display( Blocks.CHEST, @@ -526,15 +508,45 @@ public class VanillaNetherAdvancements implements AdvancementSubProvider { true, false ) - .requirements(AdvancementRequirements.Strategy.OR) + .requirements(Strategy.OR) .addCriterion("loot_bastion_other", LootTableTrigger.TriggerInstance.lootTableUsed(BuiltInLootTables.BASTION_OTHER)) .addCriterion("loot_bastion_treasure", LootTableTrigger.TriggerInstance.lootTableUsed(BuiltInLootTables.BASTION_TREASURE)) .addCriterion("loot_bastion_hoglin_stable", LootTableTrigger.TriggerInstance.lootTableUsed(BuiltInLootTables.BASTION_HOGLIN_STABLE)) .addCriterion("loot_bastion_bridge", LootTableTrigger.TriggerInstance.lootTableUsed(BuiltInLootTables.BASTION_BRIDGE)) .save(writer, "nether/loot_bastion"); - Advancement.Builder.advancement() + ContextAwarePredicate contextAwarePredicate = ContextAwarePredicate.create( + LootItemEntityPropertyCondition.hasProperties( + LootContext.EntityTarget.THIS, + EntityPredicate.Builder.entity() + .equipment(EntityEquipmentPredicate.Builder.equipment().head(ItemPredicate.Builder.item().of(holderGetter2, ItemTags.PIGLIN_SAFE_ARMOR))) + ) + .invert() + .build(), + LootItemEntityPropertyCondition.hasProperties( + LootContext.EntityTarget.THIS, + EntityPredicate.Builder.entity() + .equipment(EntityEquipmentPredicate.Builder.equipment().chest(ItemPredicate.Builder.item().of(holderGetter2, ItemTags.PIGLIN_SAFE_ARMOR))) + ) + .invert() + .build(), + LootItemEntityPropertyCondition.hasProperties( + LootContext.EntityTarget.THIS, + EntityPredicate.Builder.entity() + .equipment(EntityEquipmentPredicate.Builder.equipment().legs(ItemPredicate.Builder.item().of(holderGetter2, ItemTags.PIGLIN_SAFE_ARMOR))) + ) + .invert() + .build(), + LootItemEntityPropertyCondition.hasProperties( + LootContext.EntityTarget.THIS, + EntityPredicate.Builder.entity() + .equipment(EntityEquipmentPredicate.Builder.equipment().feet(ItemPredicate.Builder.item().of(holderGetter2, ItemTags.PIGLIN_SAFE_ARMOR))) + ) + .invert() + .build() + ); + Builder.advancement() .parent(advancementHolder) - .requirements(AdvancementRequirements.Strategy.OR) + .requirements(Strategy.OR) .display( Items.GOLD_INGOT, Component.translatable("advancements.nether.distract_piglin.title"), @@ -547,18 +559,30 @@ public class VanillaNetherAdvancements implements AdvancementSubProvider { ) .addCriterion( "distract_piglin", - PickedUpItemTrigger.TriggerInstance.thrownItemPickedUpByEntity( - DISTRACT_PIGLIN_PLAYER_ARMOR_PREDICATE, - Optional.of(ItemPredicate.Builder.item().of(ItemTags.PIGLIN_LOVED).build()), - Optional.of(EntityPredicate.wrap(EntityPredicate.Builder.entity().of(EntityType.PIGLIN).flags(EntityFlagsPredicate.Builder.flags().setIsBaby(false)))) + net.minecraft.advancements.critereon.PickedUpItemTrigger.TriggerInstance.thrownItemPickedUpByEntity( + contextAwarePredicate, + Optional.of(ItemPredicate.Builder.item().of(holderGetter2, ItemTags.PIGLIN_LOVED).build()), + Optional.of( + EntityPredicate.wrap( + EntityPredicate.Builder.entity() + .of(holderGetter, EntityType.PIGLIN) + .flags(net.minecraft.advancements.critereon.EntityFlagsPredicate.Builder.flags().setIsBaby(false)) + ) + ) ) ) .addCriterion( "distract_piglin_directly", - PlayerInteractTrigger.TriggerInstance.itemUsedOnEntity( - Optional.of(DISTRACT_PIGLIN_PLAYER_ARMOR_PREDICATE), - ItemPredicate.Builder.item().of(PiglinAi.BARTERING_ITEM), - Optional.of(EntityPredicate.wrap(EntityPredicate.Builder.entity().of(EntityType.PIGLIN).flags(EntityFlagsPredicate.Builder.flags().setIsBaby(false)))) + net.minecraft.advancements.critereon.PlayerInteractTrigger.TriggerInstance.itemUsedOnEntity( + Optional.of(contextAwarePredicate), + ItemPredicate.Builder.item().of(holderGetter2, PiglinAi.BARTERING_ITEM), + Optional.of( + EntityPredicate.wrap( + EntityPredicate.Builder.entity() + .of(holderGetter, EntityType.PIGLIN) + .flags(net.minecraft.advancements.critereon.EntityFlagsPredicate.Builder.flags().setIsBaby(false)) + ) + ) ) ) .save(writer, "nether/distract_piglin"); diff --git a/net/minecraft/data/advancements/packs/VanillaStoryAdvancements.java b/net/minecraft/data/advancements/packs/VanillaStoryAdvancements.java index 4264257d..46bf2dab 100644 --- a/net/minecraft/data/advancements/packs/VanillaStoryAdvancements.java +++ b/net/minecraft/data/advancements/packs/VanillaStoryAdvancements.java @@ -1,21 +1,15 @@ package net.minecraft.data.advancements.packs; import java.util.function.Consumer; -import net.minecraft.advancements.Advancement; import net.minecraft.advancements.AdvancementHolder; -import net.minecraft.advancements.AdvancementRequirements; import net.minecraft.advancements.AdvancementType; -import net.minecraft.advancements.critereon.ChangeDimensionTrigger; -import net.minecraft.advancements.critereon.CuredZombieVillagerTrigger; -import net.minecraft.advancements.critereon.DamagePredicate; -import net.minecraft.advancements.critereon.DamageSourcePredicate; -import net.minecraft.advancements.critereon.EnchantedItemTrigger; -import net.minecraft.advancements.critereon.EntityHurtPlayerTrigger; -import net.minecraft.advancements.critereon.InventoryChangeTrigger; +import net.minecraft.advancements.Advancement.Builder; +import net.minecraft.advancements.AdvancementRequirements.Strategy; import net.minecraft.advancements.critereon.ItemPredicate; -import net.minecraft.advancements.critereon.LocationPredicate; import net.minecraft.advancements.critereon.PlayerTrigger; import net.minecraft.advancements.critereon.TagPredicate; +import net.minecraft.advancements.critereon.InventoryChangeTrigger.TriggerInstance; +import net.minecraft.core.HolderGetter; import net.minecraft.core.HolderLookup; import net.minecraft.core.registries.Registries; import net.minecraft.data.advancements.AdvancementSubProvider; @@ -23,6 +17,7 @@ import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.DamageTypeTags; import net.minecraft.tags.ItemTags; +import net.minecraft.world.item.Item; import net.minecraft.world.item.Items; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Blocks; @@ -31,7 +26,8 @@ import net.minecraft.world.level.levelgen.structure.BuiltinStructures; public class VanillaStoryAdvancements implements AdvancementSubProvider { @Override public void generate(HolderLookup.Provider registries, Consumer writer) { - AdvancementHolder advancementHolder = Advancement.Builder.advancement() + HolderGetter holderGetter = registries.lookupOrThrow(Registries.ITEM); + AdvancementHolder advancementHolder = Builder.advancement() .display( Blocks.GRASS_BLOCK, Component.translatable("advancements.story.root.title"), @@ -42,9 +38,9 @@ public class VanillaStoryAdvancements implements AdvancementSubProvider { false, false ) - .addCriterion("crafting_table", InventoryChangeTrigger.TriggerInstance.hasItems(Blocks.CRAFTING_TABLE)) + .addCriterion("crafting_table", TriggerInstance.hasItems(Blocks.CRAFTING_TABLE)) .save(writer, "story/root"); - AdvancementHolder advancementHolder2 = Advancement.Builder.advancement() + AdvancementHolder advancementHolder2 = Builder.advancement() .parent(advancementHolder) .display( Items.WOODEN_PICKAXE, @@ -56,9 +52,9 @@ public class VanillaStoryAdvancements implements AdvancementSubProvider { true, false ) - .addCriterion("get_stone", InventoryChangeTrigger.TriggerInstance.hasItems(ItemPredicate.Builder.item().of(ItemTags.STONE_TOOL_MATERIALS))) + .addCriterion("get_stone", TriggerInstance.hasItems(ItemPredicate.Builder.item().of(holderGetter, ItemTags.STONE_TOOL_MATERIALS))) .save(writer, "story/mine_stone"); - AdvancementHolder advancementHolder3 = Advancement.Builder.advancement() + AdvancementHolder advancementHolder3 = Builder.advancement() .parent(advancementHolder2) .display( Items.STONE_PICKAXE, @@ -70,9 +66,9 @@ public class VanillaStoryAdvancements implements AdvancementSubProvider { true, false ) - .addCriterion("stone_pickaxe", InventoryChangeTrigger.TriggerInstance.hasItems(Items.STONE_PICKAXE)) + .addCriterion("stone_pickaxe", TriggerInstance.hasItems(Items.STONE_PICKAXE)) .save(writer, "story/upgrade_tools"); - AdvancementHolder advancementHolder4 = Advancement.Builder.advancement() + AdvancementHolder advancementHolder4 = Builder.advancement() .parent(advancementHolder3) .display( Items.IRON_INGOT, @@ -84,9 +80,9 @@ public class VanillaStoryAdvancements implements AdvancementSubProvider { true, false ) - .addCriterion("iron", InventoryChangeTrigger.TriggerInstance.hasItems(Items.IRON_INGOT)) + .addCriterion("iron", TriggerInstance.hasItems(Items.IRON_INGOT)) .save(writer, "story/smelt_iron"); - AdvancementHolder advancementHolder5 = Advancement.Builder.advancement() + AdvancementHolder advancementHolder5 = Builder.advancement() .parent(advancementHolder4) .display( Items.IRON_PICKAXE, @@ -98,9 +94,9 @@ public class VanillaStoryAdvancements implements AdvancementSubProvider { true, false ) - .addCriterion("iron_pickaxe", InventoryChangeTrigger.TriggerInstance.hasItems(Items.IRON_PICKAXE)) + .addCriterion("iron_pickaxe", TriggerInstance.hasItems(Items.IRON_PICKAXE)) .save(writer, "story/iron_tools"); - AdvancementHolder advancementHolder6 = Advancement.Builder.advancement() + AdvancementHolder advancementHolder6 = Builder.advancement() .parent(advancementHolder5) .display( Items.DIAMOND, @@ -112,9 +108,9 @@ public class VanillaStoryAdvancements implements AdvancementSubProvider { true, false ) - .addCriterion("diamond", InventoryChangeTrigger.TriggerInstance.hasItems(Items.DIAMOND)) + .addCriterion("diamond", TriggerInstance.hasItems(Items.DIAMOND)) .save(writer, "story/mine_diamond"); - AdvancementHolder advancementHolder7 = Advancement.Builder.advancement() + AdvancementHolder advancementHolder7 = Builder.advancement() .parent(advancementHolder4) .display( Items.LAVA_BUCKET, @@ -126,9 +122,9 @@ public class VanillaStoryAdvancements implements AdvancementSubProvider { true, false ) - .addCriterion("lava_bucket", InventoryChangeTrigger.TriggerInstance.hasItems(Items.LAVA_BUCKET)) + .addCriterion("lava_bucket", TriggerInstance.hasItems(Items.LAVA_BUCKET)) .save(writer, "story/lava_bucket"); - AdvancementHolder advancementHolder8 = Advancement.Builder.advancement() + AdvancementHolder advancementHolder8 = Builder.advancement() .parent(advancementHolder4) .display( Items.IRON_CHESTPLATE, @@ -140,13 +136,13 @@ public class VanillaStoryAdvancements implements AdvancementSubProvider { true, false ) - .requirements(AdvancementRequirements.Strategy.OR) - .addCriterion("iron_helmet", InventoryChangeTrigger.TriggerInstance.hasItems(Items.IRON_HELMET)) - .addCriterion("iron_chestplate", InventoryChangeTrigger.TriggerInstance.hasItems(Items.IRON_CHESTPLATE)) - .addCriterion("iron_leggings", InventoryChangeTrigger.TriggerInstance.hasItems(Items.IRON_LEGGINGS)) - .addCriterion("iron_boots", InventoryChangeTrigger.TriggerInstance.hasItems(Items.IRON_BOOTS)) + .requirements(Strategy.OR) + .addCriterion("iron_helmet", TriggerInstance.hasItems(Items.IRON_HELMET)) + .addCriterion("iron_chestplate", TriggerInstance.hasItems(Items.IRON_CHESTPLATE)) + .addCriterion("iron_leggings", TriggerInstance.hasItems(Items.IRON_LEGGINGS)) + .addCriterion("iron_boots", TriggerInstance.hasItems(Items.IRON_BOOTS)) .save(writer, "story/obtain_armor"); - Advancement.Builder.advancement() + Builder.advancement() .parent(advancementHolder6) .display( Items.ENCHANTED_BOOK, @@ -158,9 +154,9 @@ public class VanillaStoryAdvancements implements AdvancementSubProvider { true, false ) - .addCriterion("enchanted_item", EnchantedItemTrigger.TriggerInstance.enchantedItem()) + .addCriterion("enchanted_item", net.minecraft.advancements.critereon.EnchantedItemTrigger.TriggerInstance.enchantedItem()) .save(writer, "story/enchant_item"); - AdvancementHolder advancementHolder9 = Advancement.Builder.advancement() + AdvancementHolder advancementHolder9 = Builder.advancement() .parent(advancementHolder7) .display( Blocks.OBSIDIAN, @@ -172,9 +168,9 @@ public class VanillaStoryAdvancements implements AdvancementSubProvider { true, false ) - .addCriterion("obsidian", InventoryChangeTrigger.TriggerInstance.hasItems(Blocks.OBSIDIAN)) + .addCriterion("obsidian", TriggerInstance.hasItems(Blocks.OBSIDIAN)) .save(writer, "story/form_obsidian"); - Advancement.Builder.advancement() + Builder.advancement() .parent(advancementHolder8) .display( Items.SHIELD, @@ -188,12 +184,14 @@ public class VanillaStoryAdvancements implements AdvancementSubProvider { ) .addCriterion( "deflected_projectile", - EntityHurtPlayerTrigger.TriggerInstance.entityHurtPlayer( - DamagePredicate.Builder.damageInstance().type(DamageSourcePredicate.Builder.damageType().tag(TagPredicate.is(DamageTypeTags.IS_PROJECTILE))).blocked(true) + net.minecraft.advancements.critereon.EntityHurtPlayerTrigger.TriggerInstance.entityHurtPlayer( + net.minecraft.advancements.critereon.DamagePredicate.Builder.damageInstance() + .type(net.minecraft.advancements.critereon.DamageSourcePredicate.Builder.damageType().tag(TagPredicate.is(DamageTypeTags.IS_PROJECTILE))) + .blocked(true) ) ) .save(writer, "story/deflect_arrow"); - Advancement.Builder.advancement() + Builder.advancement() .parent(advancementHolder6) .display( Items.DIAMOND_CHESTPLATE, @@ -205,13 +203,13 @@ public class VanillaStoryAdvancements implements AdvancementSubProvider { true, false ) - .requirements(AdvancementRequirements.Strategy.OR) - .addCriterion("diamond_helmet", InventoryChangeTrigger.TriggerInstance.hasItems(Items.DIAMOND_HELMET)) - .addCriterion("diamond_chestplate", InventoryChangeTrigger.TriggerInstance.hasItems(Items.DIAMOND_CHESTPLATE)) - .addCriterion("diamond_leggings", InventoryChangeTrigger.TriggerInstance.hasItems(Items.DIAMOND_LEGGINGS)) - .addCriterion("diamond_boots", InventoryChangeTrigger.TriggerInstance.hasItems(Items.DIAMOND_BOOTS)) + .requirements(Strategy.OR) + .addCriterion("diamond_helmet", TriggerInstance.hasItems(Items.DIAMOND_HELMET)) + .addCriterion("diamond_chestplate", TriggerInstance.hasItems(Items.DIAMOND_CHESTPLATE)) + .addCriterion("diamond_leggings", TriggerInstance.hasItems(Items.DIAMOND_LEGGINGS)) + .addCriterion("diamond_boots", TriggerInstance.hasItems(Items.DIAMOND_BOOTS)) .save(writer, "story/shiny_gear"); - AdvancementHolder advancementHolder10 = Advancement.Builder.advancement() + AdvancementHolder advancementHolder10 = Builder.advancement() .parent(advancementHolder9) .display( Items.FLINT_AND_STEEL, @@ -223,9 +221,9 @@ public class VanillaStoryAdvancements implements AdvancementSubProvider { true, false ) - .addCriterion("entered_nether", ChangeDimensionTrigger.TriggerInstance.changedDimensionTo(Level.NETHER)) + .addCriterion("entered_nether", net.minecraft.advancements.critereon.ChangeDimensionTrigger.TriggerInstance.changedDimensionTo(Level.NETHER)) .save(writer, "story/enter_the_nether"); - Advancement.Builder.advancement() + Builder.advancement() .parent(advancementHolder10) .display( Items.GOLDEN_APPLE, @@ -237,9 +235,9 @@ public class VanillaStoryAdvancements implements AdvancementSubProvider { true, false ) - .addCriterion("cured_zombie", CuredZombieVillagerTrigger.TriggerInstance.curedZombieVillager()) + .addCriterion("cured_zombie", net.minecraft.advancements.critereon.CuredZombieVillagerTrigger.TriggerInstance.curedZombieVillager()) .save(writer, "story/cure_zombie_villager"); - AdvancementHolder advancementHolder11 = Advancement.Builder.advancement() + AdvancementHolder advancementHolder11 = Builder.advancement() .parent(advancementHolder10) .display( Items.ENDER_EYE, @@ -254,11 +252,13 @@ public class VanillaStoryAdvancements implements AdvancementSubProvider { .addCriterion( "in_stronghold", PlayerTrigger.TriggerInstance.located( - LocationPredicate.Builder.inStructure(registries.lookupOrThrow(Registries.STRUCTURE).getOrThrow(BuiltinStructures.STRONGHOLD)) + net.minecraft.advancements.critereon.LocationPredicate.Builder.inStructure( + registries.lookupOrThrow(Registries.STRUCTURE).getOrThrow(BuiltinStructures.STRONGHOLD) + ) ) ) .save(writer, "story/follow_ender_eye"); - Advancement.Builder.advancement() + Builder.advancement() .parent(advancementHolder11) .display( Blocks.END_STONE, @@ -270,7 +270,7 @@ public class VanillaStoryAdvancements implements AdvancementSubProvider { true, false ) - .addCriterion("entered_end", ChangeDimensionTrigger.TriggerInstance.changedDimensionTo(Level.END)) + .addCriterion("entered_end", net.minecraft.advancements.critereon.ChangeDimensionTrigger.TriggerInstance.changedDimensionTo(Level.END)) .save(writer, "story/enter_the_end"); } } diff --git a/net/minecraft/data/advancements/packs/VanillaTheEndAdvancements.java b/net/minecraft/data/advancements/packs/VanillaTheEndAdvancements.java index dee4b233..05f3d1eb 100644 --- a/net/minecraft/data/advancements/packs/VanillaTheEndAdvancements.java +++ b/net/minecraft/data/advancements/packs/VanillaTheEndAdvancements.java @@ -1,21 +1,16 @@ package net.minecraft.data.advancements.packs; import java.util.function.Consumer; -import net.minecraft.advancements.Advancement; import net.minecraft.advancements.AdvancementHolder; import net.minecraft.advancements.AdvancementRewards; import net.minecraft.advancements.AdvancementType; -import net.minecraft.advancements.critereon.ChangeDimensionTrigger; +import net.minecraft.advancements.Advancement.Builder; import net.minecraft.advancements.critereon.DistancePredicate; -import net.minecraft.advancements.critereon.EnterBlockTrigger; import net.minecraft.advancements.critereon.EntityPredicate; -import net.minecraft.advancements.critereon.InventoryChangeTrigger; -import net.minecraft.advancements.critereon.KilledTrigger; -import net.minecraft.advancements.critereon.LevitationTrigger; -import net.minecraft.advancements.critereon.LocationPredicate; -import net.minecraft.advancements.critereon.MinMaxBounds; import net.minecraft.advancements.critereon.PlayerTrigger; -import net.minecraft.advancements.critereon.SummonedEntityTrigger; +import net.minecraft.advancements.critereon.ChangeDimensionTrigger.TriggerInstance; +import net.minecraft.advancements.critereon.MinMaxBounds.Doubles; +import net.minecraft.core.HolderGetter; import net.minecraft.core.HolderLookup; import net.minecraft.core.registries.Registries; import net.minecraft.data.advancements.AdvancementSubProvider; @@ -30,7 +25,8 @@ import net.minecraft.world.level.levelgen.structure.BuiltinStructures; public class VanillaTheEndAdvancements implements AdvancementSubProvider { @Override public void generate(HolderLookup.Provider registries, Consumer writer) { - AdvancementHolder advancementHolder = Advancement.Builder.advancement() + HolderGetter> holderGetter = registries.lookupOrThrow(Registries.ENTITY_TYPE); + AdvancementHolder advancementHolder = Builder.advancement() .display( Blocks.END_STONE, Component.translatable("advancements.end.root.title"), @@ -41,9 +37,9 @@ public class VanillaTheEndAdvancements implements AdvancementSubProvider { false, false ) - .addCriterion("entered_end", ChangeDimensionTrigger.TriggerInstance.changedDimensionTo(Level.END)) + .addCriterion("entered_end", TriggerInstance.changedDimensionTo(Level.END)) .save(writer, "end/root"); - AdvancementHolder advancementHolder2 = Advancement.Builder.advancement() + AdvancementHolder advancementHolder2 = Builder.advancement() .parent(advancementHolder) .display( Blocks.DRAGON_HEAD, @@ -55,9 +51,14 @@ public class VanillaTheEndAdvancements implements AdvancementSubProvider { true, false ) - .addCriterion("killed_dragon", KilledTrigger.TriggerInstance.playerKilledEntity(EntityPredicate.Builder.entity().of(EntityType.ENDER_DRAGON))) + .addCriterion( + "killed_dragon", + net.minecraft.advancements.critereon.KilledTrigger.TriggerInstance.playerKilledEntity( + EntityPredicate.Builder.entity().of(holderGetter, EntityType.ENDER_DRAGON) + ) + ) .save(writer, "end/kill_dragon"); - AdvancementHolder advancementHolder3 = Advancement.Builder.advancement() + AdvancementHolder advancementHolder3 = Builder.advancement() .parent(advancementHolder2) .display( Items.ENDER_PEARL, @@ -69,9 +70,9 @@ public class VanillaTheEndAdvancements implements AdvancementSubProvider { true, false ) - .addCriterion("entered_end_gateway", EnterBlockTrigger.TriggerInstance.entersBlock(Blocks.END_GATEWAY)) + .addCriterion("entered_end_gateway", net.minecraft.advancements.critereon.EnterBlockTrigger.TriggerInstance.entersBlock(Blocks.END_GATEWAY)) .save(writer, "end/enter_end_gateway"); - Advancement.Builder.advancement() + Builder.advancement() .parent(advancementHolder2) .display( Items.END_CRYSTAL, @@ -83,9 +84,14 @@ public class VanillaTheEndAdvancements implements AdvancementSubProvider { true, false ) - .addCriterion("summoned_dragon", SummonedEntityTrigger.TriggerInstance.summonedEntity(EntityPredicate.Builder.entity().of(EntityType.ENDER_DRAGON))) + .addCriterion( + "summoned_dragon", + net.minecraft.advancements.critereon.SummonedEntityTrigger.TriggerInstance.summonedEntity( + EntityPredicate.Builder.entity().of(holderGetter, EntityType.ENDER_DRAGON) + ) + ) .save(writer, "end/respawn_dragon"); - AdvancementHolder advancementHolder4 = Advancement.Builder.advancement() + AdvancementHolder advancementHolder4 = Builder.advancement() .parent(advancementHolder3) .display( Blocks.PURPUR_BLOCK, @@ -100,11 +106,13 @@ public class VanillaTheEndAdvancements implements AdvancementSubProvider { .addCriterion( "in_city", PlayerTrigger.TriggerInstance.located( - LocationPredicate.Builder.inStructure(registries.lookupOrThrow(Registries.STRUCTURE).getOrThrow(BuiltinStructures.END_CITY)) + net.minecraft.advancements.critereon.LocationPredicate.Builder.inStructure( + registries.lookupOrThrow(Registries.STRUCTURE).getOrThrow(BuiltinStructures.END_CITY) + ) ) ) .save(writer, "end/find_end_city"); - Advancement.Builder.advancement() + Builder.advancement() .parent(advancementHolder2) .display( Items.DRAGON_BREATH, @@ -116,9 +124,9 @@ public class VanillaTheEndAdvancements implements AdvancementSubProvider { true, false ) - .addCriterion("dragon_breath", InventoryChangeTrigger.TriggerInstance.hasItems(Items.DRAGON_BREATH)) + .addCriterion("dragon_breath", net.minecraft.advancements.critereon.InventoryChangeTrigger.TriggerInstance.hasItems(Items.DRAGON_BREATH)) .save(writer, "end/dragon_breath"); - Advancement.Builder.advancement() + Builder.advancement() .parent(advancementHolder4) .display( Items.SHULKER_SHELL, @@ -131,9 +139,11 @@ public class VanillaTheEndAdvancements implements AdvancementSubProvider { false ) .rewards(AdvancementRewards.Builder.experience(50)) - .addCriterion("levitated", LevitationTrigger.TriggerInstance.levitated(DistancePredicate.vertical(MinMaxBounds.Doubles.atLeast(50.0)))) + .addCriterion( + "levitated", net.minecraft.advancements.critereon.LevitationTrigger.TriggerInstance.levitated(DistancePredicate.vertical(Doubles.atLeast(50.0))) + ) .save(writer, "end/levitate"); - Advancement.Builder.advancement() + Builder.advancement() .parent(advancementHolder4) .display( Items.ELYTRA, @@ -145,9 +155,9 @@ public class VanillaTheEndAdvancements implements AdvancementSubProvider { true, false ) - .addCriterion("elytra", InventoryChangeTrigger.TriggerInstance.hasItems(Items.ELYTRA)) + .addCriterion("elytra", net.minecraft.advancements.critereon.InventoryChangeTrigger.TriggerInstance.hasItems(Items.ELYTRA)) .save(writer, "end/elytra"); - Advancement.Builder.advancement() + Builder.advancement() .parent(advancementHolder2) .display( Blocks.DRAGON_EGG, @@ -159,7 +169,7 @@ public class VanillaTheEndAdvancements implements AdvancementSubProvider { true, false ) - .addCriterion("dragon_egg", InventoryChangeTrigger.TriggerInstance.hasItems(Blocks.DRAGON_EGG)) + .addCriterion("dragon_egg", net.minecraft.advancements.critereon.InventoryChangeTrigger.TriggerInstance.hasItems(Blocks.DRAGON_EGG)) .save(writer, "end/dragon_egg"); } } diff --git a/net/minecraft/data/advancements/packs/WinterDropAdvancementProvider.java b/net/minecraft/data/advancements/packs/WinterDropAdvancementProvider.java new file mode 100644 index 00000000..d89ee38a --- /dev/null +++ b/net/minecraft/data/advancements/packs/WinterDropAdvancementProvider.java @@ -0,0 +1,13 @@ +package net.minecraft.data.advancements.packs; + +import java.util.List; +import java.util.concurrent.CompletableFuture; +import net.minecraft.core.HolderLookup; +import net.minecraft.data.PackOutput; +import net.minecraft.data.advancements.AdvancementProvider; + +public class WinterDropAdvancementProvider { + public static AdvancementProvider create(PackOutput packOutput, CompletableFuture completableFuture) { + return new AdvancementProvider(packOutput, completableFuture, List.of(new WinterDropAdventureAdvancements())); + } +} diff --git a/net/minecraft/data/advancements/packs/WinterDropAdventureAdvancements.java b/net/minecraft/data/advancements/packs/WinterDropAdventureAdvancements.java new file mode 100644 index 00000000..88d90981 --- /dev/null +++ b/net/minecraft/data/advancements/packs/WinterDropAdventureAdvancements.java @@ -0,0 +1,28 @@ +package net.minecraft.data.advancements.packs; + +import java.util.List; +import java.util.function.Consumer; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import net.minecraft.advancements.AdvancementHolder; +import net.minecraft.core.HolderLookup; +import net.minecraft.core.registries.Registries; +import net.minecraft.data.advancements.AdvancementSubProvider; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.level.biome.MultiNoiseBiomeSourceParameterList; + +public class WinterDropAdventureAdvancements implements AdvancementSubProvider { + @Override + public void generate(HolderLookup.Provider registries, Consumer writer) { + AdvancementHolder advancementHolder = AdvancementSubProvider.createPlaceholder("adventure/root"); + VanillaAdventureAdvancements.createMonsterHunterAdvancement( + advancementHolder, + writer, + registries.lookupOrThrow(Registries.ENTITY_TYPE), + (List>)Stream.concat(VanillaAdventureAdvancements.MOBS_TO_KILL.stream(), Stream.of(EntityType.CREAKING_TRANSIENT)) + .collect(Collectors.toList()) + ); + AdvancementHolder advancementHolder2 = AdvancementSubProvider.createPlaceholder("adventure/sleep_in_bed"); + VanillaAdventureAdvancements.createAdventuringTime(registries, writer, advancementHolder2, MultiNoiseBiomeSourceParameterList.Preset.OVERWORLD_WINTER_DROP); + } +} diff --git a/net/minecraft/data/info/BiomeParametersDumpReport.java b/net/minecraft/data/info/BiomeParametersDumpReport.java index 58836079..ebe6005e 100644 --- a/net/minecraft/data/info/BiomeParametersDumpReport.java +++ b/net/minecraft/data/info/BiomeParametersDumpReport.java @@ -17,6 +17,7 @@ import net.minecraft.core.registries.Registries; import net.minecraft.data.CachedOutput; import net.minecraft.data.DataProvider; import net.minecraft.data.PackOutput; +import net.minecraft.data.PackOutput.Target; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.level.biome.Biome; @@ -32,7 +33,7 @@ public class BiomeParametersDumpReport implements DataProvider { private static final Codec>> CODEC = Climate.ParameterList.codec(ENTRY_CODEC).fieldOf("biomes").codec(); public BiomeParametersDumpReport(PackOutput output, CompletableFuture registries) { - this.topPath = output.getOutputFolder(PackOutput.Target.REPORTS).resolve("biome_parameters"); + this.topPath = output.getOutputFolder(Target.REPORTS).resolve("biome_parameters"); this.registries = registries; } diff --git a/net/minecraft/data/info/BlockListReport.java b/net/minecraft/data/info/BlockListReport.java index 99468722..080539e6 100644 --- a/net/minecraft/data/info/BlockListReport.java +++ b/net/minecraft/data/info/BlockListReport.java @@ -12,6 +12,7 @@ import net.minecraft.core.registries.Registries; import net.minecraft.data.CachedOutput; import net.minecraft.data.DataProvider; import net.minecraft.data.PackOutput; +import net.minecraft.data.PackOutput.Target; import net.minecraft.resources.RegistryOps; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.BlockTypes; @@ -30,7 +31,7 @@ public class BlockListReport implements DataProvider { @Override public CompletableFuture run(CachedOutput output) { - Path path = this.output.getOutputFolder(PackOutput.Target.REPORTS).resolve("blocks.json"); + Path path = this.output.getOutputFolder(Target.REPORTS).resolve("blocks.json"); return this.registries .thenCompose( provider -> { diff --git a/net/minecraft/data/info/CommandsReport.java b/net/minecraft/data/info/CommandsReport.java index 65865583..cadd12da 100644 --- a/net/minecraft/data/info/CommandsReport.java +++ b/net/minecraft/data/info/CommandsReport.java @@ -10,6 +10,7 @@ import net.minecraft.core.HolderLookup; import net.minecraft.data.CachedOutput; import net.minecraft.data.DataProvider; import net.minecraft.data.PackOutput; +import net.minecraft.data.PackOutput.Target; public class CommandsReport implements DataProvider { private final PackOutput output; @@ -22,7 +23,7 @@ public class CommandsReport implements DataProvider { @Override public CompletableFuture run(CachedOutput output) { - Path path = this.output.getOutputFolder(PackOutput.Target.REPORTS).resolve("commands.json"); + Path path = this.output.getOutputFolder(Target.REPORTS).resolve("commands.json"); return this.registries .thenCompose( provider -> { diff --git a/net/minecraft/data/info/DatapackStructureReport.java b/net/minecraft/data/info/DatapackStructureReport.java new file mode 100644 index 00000000..dd86d548 --- /dev/null +++ b/net/minecraft/data/info/DatapackStructureReport.java @@ -0,0 +1,135 @@ +package net.minecraft.data.info; + +import com.mojang.serialization.Codec; +import com.mojang.serialization.JsonOps; +import com.mojang.serialization.MapCodec; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import java.nio.file.Path; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.CompletableFuture; +import net.minecraft.core.Registry; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.core.registries.Registries; +import net.minecraft.data.CachedOutput; +import net.minecraft.data.DataProvider; +import net.minecraft.data.PackOutput; +import net.minecraft.data.PackOutput.Target; +import net.minecraft.resources.RegistryDataLoader; +import net.minecraft.resources.ResourceKey; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.StringRepresentable; + +public class DatapackStructureReport implements DataProvider { + private final PackOutput output; + private static final DatapackStructureReport.Entry PSEUDO_REGISTRY = new DatapackStructureReport.Entry(true, false, true); + private static final DatapackStructureReport.Entry STABLE_DYNAMIC_REGISTRY = new DatapackStructureReport.Entry(true, true, true); + private static final DatapackStructureReport.Entry UNSTABLE_DYNAMIC_REGISTRY = new DatapackStructureReport.Entry(true, true, false); + private static final DatapackStructureReport.Entry BUILT_IN_REGISTRY = new DatapackStructureReport.Entry(false, true, true); + private static final Map>, DatapackStructureReport.Entry> MANUAL_ENTRIES = Map.of( + Registries.RECIPE, + PSEUDO_REGISTRY, + Registries.ADVANCEMENT, + PSEUDO_REGISTRY, + Registries.LOOT_TABLE, + STABLE_DYNAMIC_REGISTRY, + Registries.ITEM_MODIFIER, + STABLE_DYNAMIC_REGISTRY, + Registries.PREDICATE, + STABLE_DYNAMIC_REGISTRY + ); + private static final Map NON_REGISTRY_ENTRIES = Map.of( + "structure", + new DatapackStructureReport.CustomPackEntry(DatapackStructureReport.Format.STRUCTURE, new DatapackStructureReport.Entry(true, false, true)), + "function", + new DatapackStructureReport.CustomPackEntry(DatapackStructureReport.Format.MCFUNCTION, new DatapackStructureReport.Entry(true, true, true)) + ); + static final Codec>> REGISTRY_KEY_CODEC = ResourceLocation.CODEC.xmap(ResourceKey::createRegistryKey, ResourceKey::location); + + public DatapackStructureReport(PackOutput packOutput) { + this.output = packOutput; + } + + @Override + public CompletableFuture run(CachedOutput output) { + DatapackStructureReport.Report report = new DatapackStructureReport.Report(this.listRegistries(), NON_REGISTRY_ENTRIES); + Path path = this.output.getOutputFolder(Target.REPORTS).resolve("datapack.json"); + return DataProvider.saveStable(output, DatapackStructureReport.Report.CODEC.encodeStart(JsonOps.INSTANCE, report).getOrThrow(), path); + } + + @Override + public String getName() { + return "Datapack Structure"; + } + + private void putIfNotPresent( + Map>, DatapackStructureReport.Entry> map, + ResourceKey> resourceKey, + DatapackStructureReport.Entry entry + ) { + DatapackStructureReport.Entry entry2 = (DatapackStructureReport.Entry)map.putIfAbsent(resourceKey, entry); + if (entry2 != null) { + throw new IllegalStateException("Duplicate entry for key " + resourceKey.location()); + } + } + + private Map>, DatapackStructureReport.Entry> listRegistries() { + Map>, DatapackStructureReport.Entry> map = new HashMap(); + BuiltInRegistries.REGISTRY.forEach(registry -> this.putIfNotPresent(map, registry.key(), BUILT_IN_REGISTRY)); + RegistryDataLoader.WORLDGEN_REGISTRIES.forEach(registryData -> this.putIfNotPresent(map, registryData.key(), UNSTABLE_DYNAMIC_REGISTRY)); + RegistryDataLoader.DIMENSION_REGISTRIES.forEach(registryData -> this.putIfNotPresent(map, registryData.key(), UNSTABLE_DYNAMIC_REGISTRY)); + MANUAL_ENTRIES.forEach((resourceKey, entry) -> this.putIfNotPresent(map, resourceKey, entry)); + return map; + } + + record CustomPackEntry(DatapackStructureReport.Format format, DatapackStructureReport.Entry entry) { + public static final Codec CODEC = RecordCodecBuilder.create( + instance -> instance.group( + DatapackStructureReport.Format.CODEC.fieldOf("format").forGetter(DatapackStructureReport.CustomPackEntry::format), + DatapackStructureReport.Entry.MAP_CODEC.forGetter(DatapackStructureReport.CustomPackEntry::entry) + ) + .apply(instance, DatapackStructureReport.CustomPackEntry::new) + ); + } + + record Entry(boolean elements, boolean tags, boolean stable) { + public static final MapCodec MAP_CODEC = RecordCodecBuilder.mapCodec( + instance -> instance.group( + Codec.BOOL.fieldOf("elements").forGetter(DatapackStructureReport.Entry::elements), + Codec.BOOL.fieldOf("tags").forGetter(DatapackStructureReport.Entry::tags), + Codec.BOOL.fieldOf("stable").forGetter(DatapackStructureReport.Entry::stable) + ) + .apply(instance, DatapackStructureReport.Entry::new) + ); + public static final Codec CODEC = MAP_CODEC.codec(); + } + + static enum Format implements StringRepresentable { + STRUCTURE("structure"), + MCFUNCTION("mcfunction"); + + public static final Codec CODEC = StringRepresentable.fromEnum(DatapackStructureReport.Format::values); + private final String name; + + private Format(final String string2) { + this.name = string2; + } + + @Override + public String getSerializedName() { + return this.name; + } + } + + record Report(Map>, DatapackStructureReport.Entry> registries, Map others) { + public static final Codec CODEC = RecordCodecBuilder.create( + instance -> instance.group( + Codec.unboundedMap(DatapackStructureReport.REGISTRY_KEY_CODEC, DatapackStructureReport.Entry.CODEC) + .fieldOf("registries") + .forGetter(DatapackStructureReport.Report::registries), + Codec.unboundedMap(Codec.STRING, DatapackStructureReport.CustomPackEntry.CODEC).fieldOf("others").forGetter(DatapackStructureReport.Report::others) + ) + .apply(instance, DatapackStructureReport.Report::new) + ); + } +} diff --git a/net/minecraft/data/info/ItemListReport.java b/net/minecraft/data/info/ItemListReport.java index a32c71c8..d3b6bc00 100644 --- a/net/minecraft/data/info/ItemListReport.java +++ b/net/minecraft/data/info/ItemListReport.java @@ -11,6 +11,7 @@ import net.minecraft.core.registries.Registries; import net.minecraft.data.CachedOutput; import net.minecraft.data.DataProvider; import net.minecraft.data.PackOutput; +import net.minecraft.data.PackOutput.Target; import net.minecraft.resources.RegistryOps; import net.minecraft.world.item.Item; @@ -25,7 +26,7 @@ public class ItemListReport implements DataProvider { @Override public CompletableFuture run(CachedOutput output) { - Path path = this.output.getOutputFolder(PackOutput.Target.REPORTS).resolve("items.json"); + Path path = this.output.getOutputFolder(Target.REPORTS).resolve("items.json"); return this.registries .thenCompose( provider -> { diff --git a/net/minecraft/data/info/PacketReport.java b/net/minecraft/data/info/PacketReport.java index 94651efe..abd7b18f 100644 --- a/net/minecraft/data/info/PacketReport.java +++ b/net/minecraft/data/info/PacketReport.java @@ -10,7 +10,8 @@ import java.util.stream.Stream; import net.minecraft.data.CachedOutput; import net.minecraft.data.DataProvider; import net.minecraft.data.PackOutput; -import net.minecraft.network.ProtocolInfo; +import net.minecraft.data.PackOutput.Target; +import net.minecraft.network.ProtocolInfo.Unbound; import net.minecraft.network.protocol.configuration.ConfigurationProtocols; import net.minecraft.network.protocol.game.GameProtocols; import net.minecraft.network.protocol.handshake.HandshakeProtocols; @@ -26,7 +27,7 @@ public class PacketReport implements DataProvider { @Override public CompletableFuture run(CachedOutput output) { - Path path = this.output.getOutputFolder(PackOutput.Target.REPORTS).resolve("packets.json"); + Path path = this.output.getOutputFolder(Target.REPORTS).resolve("packets.json"); return DataProvider.saveStable(output, this.serializePackets(), path); } @@ -43,7 +44,7 @@ public class PacketReport implements DataProvider { GameProtocols.CLIENTBOUND_TEMPLATE, GameProtocols.SERVERBOUND_TEMPLATE ) - .collect(Collectors.groupingBy(ProtocolInfo.Unbound::id))) + .collect(Collectors.groupingBy(Unbound::id))) .forEach((connectionProtocol, list) -> { JsonObject jsonObject2 = new JsonObject(); jsonObject.add(connectionProtocol.id(), jsonObject2); diff --git a/net/minecraft/data/info/RegistryDumpReport.java b/net/minecraft/data/info/RegistryDumpReport.java index 16fc2fee..7cd88d74 100644 --- a/net/minecraft/data/info/RegistryDumpReport.java +++ b/net/minecraft/data/info/RegistryDumpReport.java @@ -10,6 +10,7 @@ import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.data.CachedOutput; import net.minecraft.data.DataProvider; import net.minecraft.data.PackOutput; +import net.minecraft.data.PackOutput.Target; import net.minecraft.resources.ResourceLocation; public class RegistryDumpReport implements DataProvider { @@ -22,8 +23,10 @@ public class RegistryDumpReport implements DataProvider { @Override public CompletableFuture run(CachedOutput output) { JsonObject jsonObject = new JsonObject(); - BuiltInRegistries.REGISTRY.holders().forEach(reference -> jsonObject.add(reference.key().location().toString(), dumpRegistry((Registry)reference.value()))); - Path path = this.output.getOutputFolder(PackOutput.Target.REPORTS).resolve("registries.json"); + BuiltInRegistries.REGISTRY + .listElements() + .forEach(reference -> jsonObject.add(reference.key().location().toString(), dumpRegistry((Registry)reference.value()))); + Path path = this.output.getOutputFolder(Target.REPORTS).resolve("registries.json"); return DataProvider.saveStable(output, jsonObject, path); } @@ -37,7 +40,7 @@ public class RegistryDumpReport implements DataProvider { int i = BuiltInRegistries.REGISTRY.getId(registry); jsonObject.addProperty("protocol_id", i); JsonObject jsonObject2 = new JsonObject(); - registry.holders().forEach(reference -> { + registry.listElements().forEach(reference -> { T object = (T)reference.value(); int ix = registry.getId(object); JsonObject jsonObject2x = new JsonObject(); diff --git a/net/minecraft/data/loot/BlockLootSubProvider.java b/net/minecraft/data/loot/BlockLootSubProvider.java index b98a064f..cdcf663e 100644 --- a/net/minecraft/data/loot/BlockLootSubProvider.java +++ b/net/minecraft/data/loot/BlockLootSubProvider.java @@ -14,9 +14,7 @@ import net.minecraft.advancements.critereon.EnchantmentPredicate; import net.minecraft.advancements.critereon.ItemEnchantmentsPredicate; import net.minecraft.advancements.critereon.ItemPredicate; import net.minecraft.advancements.critereon.ItemSubPredicates; -import net.minecraft.advancements.critereon.LocationPredicate; -import net.minecraft.advancements.critereon.MinMaxBounds; -import net.minecraft.advancements.critereon.StatePropertiesPredicate; +import net.minecraft.advancements.critereon.MinMaxBounds.Ints; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.HolderLookup; @@ -39,6 +37,7 @@ import net.minecraft.world.level.block.CaveVines; import net.minecraft.world.level.block.DoorBlock; import net.minecraft.world.level.block.DoublePlantBlock; import net.minecraft.world.level.block.FlowerPotBlock; +import net.minecraft.world.level.block.MossyCarpetBlock; import net.minecraft.world.level.block.MultifaceBlock; import net.minecraft.world.level.block.PinkPetalsBlock; import net.minecraft.world.level.block.SlabBlock; @@ -46,13 +45,11 @@ import net.minecraft.world.level.block.StemBlock; import net.minecraft.world.level.block.state.properties.DoubleBlockHalf; import net.minecraft.world.level.block.state.properties.Property; import net.minecraft.world.level.block.state.properties.SlabType; -import net.minecraft.world.level.storage.loot.BuiltInLootTables; import net.minecraft.world.level.storage.loot.IntRange; import net.minecraft.world.level.storage.loot.LootPool; import net.minecraft.world.level.storage.loot.LootTable; import net.minecraft.world.level.storage.loot.entries.LootItem; -import net.minecraft.world.level.storage.loot.entries.LootPoolEntryContainer; -import net.minecraft.world.level.storage.loot.entries.LootPoolSingletonContainer; +import net.minecraft.world.level.storage.loot.entries.LootPoolEntryContainer.Builder; import net.minecraft.world.level.storage.loot.functions.ApplyBonusCount; import net.minecraft.world.level.storage.loot.functions.ApplyExplosionDecay; import net.minecraft.world.level.storage.loot.functions.CopyBlockState; @@ -74,7 +71,6 @@ import net.minecraft.world.level.storage.loot.providers.number.NumberProvider; import net.minecraft.world.level.storage.loot.providers.number.UniformGenerator; public abstract class BlockLootSubProvider implements LootTableSubProvider { - protected static final LootItemCondition.Builder HAS_SHEARS = MatchTool.toolMatches(ItemPredicate.Builder.item().of(Items.SHEARS)); protected final HolderLookup.Provider registries; protected final Set explosionResistant; protected final FeatureFlagSet enabledFeatures; @@ -88,7 +84,7 @@ public abstract class BlockLootSubProvider implements LootTableSubProvider { ItemPredicate.Builder.item() .withSubPredicate( ItemSubPredicates.ENCHANTMENTS, - ItemEnchantmentsPredicate.enchantments(List.of(new EnchantmentPredicate(registryLookup.getOrThrow(Enchantments.SILK_TOUCH), MinMaxBounds.Ints.atLeast(1)))) + ItemEnchantmentsPredicate.enchantments(List.of(new EnchantmentPredicate(registryLookup.getOrThrow(Enchantments.SILK_TOUCH), Ints.atLeast(1)))) ) ); } @@ -97,8 +93,12 @@ public abstract class BlockLootSubProvider implements LootTableSubProvider { return this.hasSilkTouch().invert(); } + protected LootItemCondition.Builder hasShears() { + return MatchTool.toolMatches(ItemPredicate.Builder.item().of(this.registries.lookupOrThrow(Registries.ITEM), Items.SHEARS)); + } + private LootItemCondition.Builder hasShearsOrSilkTouch() { - return HAS_SHEARS.or(this.hasSilkTouch()); + return this.hasShears().or(this.hasSilkTouch()); } private LootItemCondition.Builder doesNotHaveShearsOrSilkTouch() { @@ -135,9 +135,7 @@ public abstract class BlockLootSubProvider implements LootTableSubProvider { * If the condition from {@code conditionBuilder} succeeds, drops 1 {@code block}. * Otherwise, drops loot specified by {@code alternativeBuilder}. */ - private static LootTable.Builder createSelfDropDispatchTable( - Block block, LootItemCondition.Builder conditionBuilder, LootPoolEntryContainer.Builder alternativeBuilder - ) { + private static LootTable.Builder createSelfDropDispatchTable(Block block, LootItemCondition.Builder conditionBuilder, Builder alternativeBuilder) { return LootTable.lootTable() .withPool(LootPool.lootPool().setRolls(ConstantValue.exactly(1.0F)).add(LootItem.lootTableItem(block).when(conditionBuilder).otherwise(alternativeBuilder))); } @@ -146,7 +144,7 @@ public abstract class BlockLootSubProvider implements LootTableSubProvider { * If the block is mined with Silk Touch, drops 1 {@code block}. * Otherwise, drops loot specified by {@code builder}. */ - protected LootTable.Builder createSilkTouchDispatchTable(Block block, LootPoolEntryContainer.Builder builder) { + protected LootTable.Builder createSilkTouchDispatchTable(Block block, Builder builder) { return createSelfDropDispatchTable(block, this.hasSilkTouch(), builder); } @@ -154,20 +152,20 @@ public abstract class BlockLootSubProvider implements LootTableSubProvider { * If the block is mined with Shears, drops 1 {@code block}. * Otherwise, drops loot specified by {@code builder}. */ - protected LootTable.Builder createShearsDispatchTable(Block block, LootPoolEntryContainer.Builder builder) { - return createSelfDropDispatchTable(block, HAS_SHEARS, builder); + protected LootTable.Builder createShearsDispatchTable(Block block, Builder builder) { + return createSelfDropDispatchTable(block, this.hasShears(), builder); } /** * If the block is mined either with Silk Touch or Shears, drops 1 {@code block}. * Otherwise, drops loot specified by {@code builder}. */ - protected LootTable.Builder createSilkTouchOrShearsDispatchTable(Block block, LootPoolEntryContainer.Builder builder) { + protected LootTable.Builder createSilkTouchOrShearsDispatchTable(Block block, Builder builder) { return createSelfDropDispatchTable(block, this.hasShearsOrSilkTouch(), builder); } protected LootTable.Builder createSingleItemTableWithSilkTouch(Block block, ItemLike item) { - return this.createSilkTouchDispatchTable(block, (LootPoolEntryContainer.Builder)this.applyExplosionCondition(block, LootItem.lootTableItem(item))); + return this.createSilkTouchDispatchTable(block, (Builder)this.applyExplosionCondition(block, LootItem.lootTableItem(item))); } protected LootTable.Builder createSingleItemTable(ItemLike item, NumberProvider count) { @@ -175,13 +173,13 @@ public abstract class BlockLootSubProvider implements LootTableSubProvider { .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) - .add((LootPoolEntryContainer.Builder)this.applyExplosionDecay(item, LootItem.lootTableItem(item).apply(SetItemCountFunction.setCount(count)))) + .add((Builder)this.applyExplosionDecay(item, LootItem.lootTableItem(item).apply(SetItemCountFunction.setCount(count)))) ); } protected LootTable.Builder createSingleItemTableWithSilkTouch(Block block, ItemLike item, NumberProvider count) { return this.createSilkTouchDispatchTable( - block, (LootPoolEntryContainer.Builder)this.applyExplosionDecay(block, LootItem.lootTableItem(item).apply(SetItemCountFunction.setCount(count))) + block, (Builder)this.applyExplosionDecay(block, LootItem.lootTableItem(item).apply(SetItemCountFunction.setCount(count))) ); } @@ -203,14 +201,14 @@ public abstract class BlockLootSubProvider implements LootTableSubProvider { LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add( - (LootPoolEntryContainer.Builder)this.applyExplosionDecay( + (Builder)this.applyExplosionDecay( block, LootItem.lootTableItem(block) .apply( SetItemCountFunction.setCount(ConstantValue.exactly(2.0F)) .when( LootItemBlockStatePropertyCondition.hasBlockStateProperties(block) - .setProperties(StatePropertiesPredicate.Builder.properties().hasProperty(SlabBlock.TYPE, SlabType.DOUBLE)) + .setProperties(net.minecraft.advancements.critereon.StatePropertiesPredicate.Builder.properties().hasProperty(SlabBlock.TYPE, SlabType.DOUBLE)) ) ) ) @@ -229,7 +227,7 @@ public abstract class BlockLootSubProvider implements LootTableSubProvider { LootItem.lootTableItem(block) .when( LootItemBlockStatePropertyCondition.hasBlockStateProperties(block) - .setProperties(StatePropertiesPredicate.Builder.properties().hasProperty(property, value)) + .setProperties(net.minecraft.advancements.critereon.StatePropertiesPredicate.Builder.properties().hasProperty(property, value)) ) ) ) @@ -276,7 +274,7 @@ public abstract class BlockLootSubProvider implements LootTableSubProvider { HolderLookup.RegistryLookup registryLookup = this.registries.lookupOrThrow(Registries.ENCHANTMENT); return this.createSilkTouchDispatchTable( block, - (LootPoolEntryContainer.Builder)this.applyExplosionDecay( + (Builder)this.applyExplosionDecay( block, LootItem.lootTableItem(Items.RAW_COPPER) .apply(SetItemCountFunction.setCount(UniformGenerator.between(2.0F, 5.0F))) @@ -289,7 +287,7 @@ public abstract class BlockLootSubProvider implements LootTableSubProvider { HolderLookup.RegistryLookup registryLookup = this.registries.lookupOrThrow(Registries.ENCHANTMENT); return this.createSilkTouchDispatchTable( block, - (LootPoolEntryContainer.Builder)this.applyExplosionDecay( + (Builder)this.applyExplosionDecay( block, LootItem.lootTableItem(Items.LAPIS_LAZULI) .apply(SetItemCountFunction.setCount(UniformGenerator.between(4.0F, 9.0F))) @@ -302,7 +300,7 @@ public abstract class BlockLootSubProvider implements LootTableSubProvider { HolderLookup.RegistryLookup registryLookup = this.registries.lookupOrThrow(Registries.ENCHANTMENT); return this.createSilkTouchDispatchTable( block, - (LootPoolEntryContainer.Builder)this.applyExplosionDecay( + (Builder)this.applyExplosionDecay( block, LootItem.lootTableItem(Items.REDSTONE) .apply(SetItemCountFunction.setCount(UniformGenerator.between(4.0F, 5.0F))) @@ -326,6 +324,7 @@ public abstract class BlockLootSubProvider implements LootTableSubProvider { .include(DataComponents.ITEM_NAME) .include(DataComponents.HIDE_ADDITIONAL_TOOLTIP) .include(DataComponents.BANNER_PATTERNS) + .include(DataComponents.RARITY) ) ) ) @@ -368,7 +367,7 @@ public abstract class BlockLootSubProvider implements LootTableSubProvider { .add(LootItem.lootTableItem(Items.GLOW_BERRIES)) .when( LootItemBlockStatePropertyCondition.hasBlockStateProperties(block) - .setProperties(StatePropertiesPredicate.Builder.properties().hasProperty(CaveVines.BERRIES, true)) + .setProperties(net.minecraft.advancements.critereon.StatePropertiesPredicate.Builder.properties().hasProperty(CaveVines.BERRIES, true)) ) ); } @@ -377,7 +376,7 @@ public abstract class BlockLootSubProvider implements LootTableSubProvider { HolderLookup.RegistryLookup registryLookup = this.registries.lookupOrThrow(Registries.ENCHANTMENT); return this.createSilkTouchDispatchTable( block, - (LootPoolEntryContainer.Builder)this.applyExplosionDecay( + (Builder)this.applyExplosionDecay( block, LootItem.lootTableItem(item).apply(ApplyBonusCount.addOreBonusCount(registryLookup.getOrThrow(Enchantments.FORTUNE))) ) ); @@ -386,7 +385,7 @@ public abstract class BlockLootSubProvider implements LootTableSubProvider { protected LootTable.Builder createMushroomBlockDrop(Block block, ItemLike item) { return this.createSilkTouchDispatchTable( block, - (LootPoolEntryContainer.Builder)this.applyExplosionDecay( + (Builder)this.applyExplosionDecay( block, LootItem.lootTableItem(item) .apply(SetItemCountFunction.setCount(UniformGenerator.between(-6.0F, 2.0F))) @@ -399,7 +398,7 @@ public abstract class BlockLootSubProvider implements LootTableSubProvider { HolderLookup.RegistryLookup registryLookup = this.registries.lookupOrThrow(Registries.ENCHANTMENT); return this.createShearsDispatchTable( block, - (LootPoolEntryContainer.Builder)this.applyExplosionDecay( + (Builder)this.applyExplosionDecay( block, LootItem.lootTableItem(Items.WHEAT_SEEDS) .when(LootItemRandomChanceCondition.randomChance(0.125F)) @@ -425,7 +424,7 @@ public abstract class BlockLootSubProvider implements LootTableSubProvider { integer -> SetItemCountFunction.setCount(BinomialDistributionGenerator.binomial(3, (integer + 1) / 15.0F)) .when( LootItemBlockStatePropertyCondition.hasBlockStateProperties(block) - .setProperties(StatePropertiesPredicate.Builder.properties().hasProperty(StemBlock.AGE, integer)) + .setProperties(net.minecraft.advancements.critereon.StatePropertiesPredicate.Builder.properties().hasProperty(StemBlock.AGE, integer)) ) ) ) @@ -445,8 +444,13 @@ public abstract class BlockLootSubProvider implements LootTableSubProvider { ); } - protected static LootTable.Builder createShearsOnlyDrop(ItemLike item) { - return LootTable.lootTable().withPool(LootPool.lootPool().setRolls(ConstantValue.exactly(1.0F)).when(HAS_SHEARS).add(LootItem.lootTableItem(item))); + protected LootTable.Builder createShearsOnlyDrop(ItemLike itemLike) { + return LootTable.lootTable().withPool(LootPool.lootPool().setRolls(ConstantValue.exactly(1.0F)).when(this.hasShears()).add(LootItem.lootTableItem(itemLike))); + } + + protected LootTable.Builder createShearsOrSilkTouchOnlyDrop(ItemLike itemLike) { + return LootTable.lootTable() + .withPool(LootPool.lootPool().setRolls(ConstantValue.exactly(1.0F)).when(this.hasShearsOrSilkTouch()).add(LootItem.lootTableItem(itemLike))); } protected LootTable.Builder createMultifaceBlockDrops(Block block, LootItemCondition.Builder builder) { @@ -454,7 +458,7 @@ public abstract class BlockLootSubProvider implements LootTableSubProvider { .withPool( LootPool.lootPool() .add( - (LootPoolEntryContainer.Builder)this.applyExplosionDecay( + (Builder)this.applyExplosionDecay( block, LootItem.lootTableItem(block) .when(builder) @@ -463,7 +467,9 @@ public abstract class BlockLootSubProvider implements LootTableSubProvider { direction -> SetItemCountFunction.setCount(ConstantValue.exactly(1.0F), true) .when( LootItemBlockStatePropertyCondition.hasBlockStateProperties(block) - .setProperties(StatePropertiesPredicate.Builder.properties().hasProperty(MultifaceBlock.getFaceProperty(direction), true)) + .setProperties( + net.minecraft.advancements.critereon.StatePropertiesPredicate.Builder.properties().hasProperty(MultifaceBlock.getFaceProperty(direction), true) + ) ) ) .apply(SetItemCountFunction.setCount(ConstantValue.exactly(-1.0F), true)) @@ -472,6 +478,23 @@ public abstract class BlockLootSubProvider implements LootTableSubProvider { ); } + protected LootTable.Builder createMossyCarpetBlockDrops(Block block) { + return LootTable.lootTable() + .withPool( + LootPool.lootPool() + .add( + (Builder)this.applyExplosionDecay( + block, + LootItem.lootTableItem(block) + .when( + LootItemBlockStatePropertyCondition.hasBlockStateProperties(block) + .setProperties(net.minecraft.advancements.critereon.StatePropertiesPredicate.Builder.properties().hasProperty(MossyCarpetBlock.BASE, true)) + ) + ) + ) + ); + } + /** * Used for all leaves, drops self with silk touch, otherwise drops the second Block param with the passed chances for fortune levels, adding in sticks. */ @@ -479,7 +502,9 @@ public abstract class BlockLootSubProvider implements LootTableSubProvider { HolderLookup.RegistryLookup registryLookup = this.registries.lookupOrThrow(Registries.ENCHANTMENT); return this.createSilkTouchOrShearsDispatchTable( leavesBlock, - ((LootPoolSingletonContainer.Builder)this.applyExplosionCondition(leavesBlock, LootItem.lootTableItem(saplingBlock))) + ((net.minecraft.world.level.storage.loot.entries.LootPoolSingletonContainer.Builder)this.applyExplosionCondition( + leavesBlock, LootItem.lootTableItem(saplingBlock) + )) .when(BonusLevelTableCondition.bonusLevelFlatChance(registryLookup.getOrThrow(Enchantments.FORTUNE), chances)) ) .withPool( @@ -487,7 +512,7 @@ public abstract class BlockLootSubProvider implements LootTableSubProvider { .setRolls(ConstantValue.exactly(1.0F)) .when(this.doesNotHaveShearsOrSilkTouch()) .add( - ((LootPoolSingletonContainer.Builder)this.applyExplosionDecay( + ((net.minecraft.world.level.storage.loot.entries.LootPoolSingletonContainer.Builder)this.applyExplosionDecay( leavesBlock, LootItem.lootTableItem(Items.STICK).apply(SetItemCountFunction.setCount(UniformGenerator.between(1.0F, 2.0F))) )) .when(BonusLevelTableCondition.bonusLevelFlatChance(registryLookup.getOrThrow(Enchantments.FORTUNE), NORMAL_LEAVES_STICK_CHANCES)) @@ -506,7 +531,9 @@ public abstract class BlockLootSubProvider implements LootTableSubProvider { .setRolls(ConstantValue.exactly(1.0F)) .when(this.doesNotHaveShearsOrSilkTouch()) .add( - ((LootPoolSingletonContainer.Builder)this.applyExplosionCondition(oakLeavesBlock, LootItem.lootTableItem(Items.APPLE))) + ((net.minecraft.world.level.storage.loot.entries.LootPoolSingletonContainer.Builder)this.applyExplosionCondition( + oakLeavesBlock, LootItem.lootTableItem(Items.APPLE) + )) .when( BonusLevelTableCondition.bonusLevelFlatChance(registryLookup.getOrThrow(Enchantments.FORTUNE), 0.005F, 0.0055555557F, 0.00625F, 0.008333334F, 0.025F) ) @@ -518,7 +545,7 @@ public abstract class BlockLootSubProvider implements LootTableSubProvider { HolderLookup.RegistryLookup registryLookup = this.registries.lookupOrThrow(Registries.ENCHANTMENT); return this.createSilkTouchOrShearsDispatchTable( block, - ((LootPoolSingletonContainer.Builder)this.applyExplosionDecay( + ((net.minecraft.world.level.storage.loot.entries.LootPoolSingletonContainer.Builder)this.applyExplosionDecay( Blocks.MANGROVE_LEAVES, LootItem.lootTableItem(Items.STICK).apply(SetItemCountFunction.setCount(UniformGenerator.between(1.0F, 2.0F))) )) .when(BonusLevelTableCondition.bonusLevelFlatChance(registryLookup.getOrThrow(Enchantments.FORTUNE), NORMAL_LEAVES_STICK_CHANCES)) @@ -548,15 +575,18 @@ public abstract class BlockLootSubProvider implements LootTableSubProvider { protected LootTable.Builder createDoublePlantShearsDrop(Block sheared) { return LootTable.lootTable() - .withPool(LootPool.lootPool().when(HAS_SHEARS).add(LootItem.lootTableItem(sheared).apply(SetItemCountFunction.setCount(ConstantValue.exactly(2.0F))))); + .withPool(LootPool.lootPool().when(this.hasShears()).add(LootItem.lootTableItem(sheared).apply(SetItemCountFunction.setCount(ConstantValue.exactly(2.0F))))); } protected LootTable.Builder createDoublePlantWithSeedDrops(Block block, Block sheared) { - LootPoolEntryContainer.Builder builder = LootItem.lootTableItem(sheared) + HolderLookup.RegistryLookup registryLookup = this.registries.lookupOrThrow(Registries.BLOCK); + Builder builder = LootItem.lootTableItem(sheared) .apply(SetItemCountFunction.setCount(ConstantValue.exactly(2.0F))) - .when(HAS_SHEARS) + .when(this.hasShears()) .otherwise( - ((LootPoolSingletonContainer.Builder)this.applyExplosionCondition(block, LootItem.lootTableItem(Items.WHEAT_SEEDS))) + ((net.minecraft.world.level.storage.loot.entries.LootPoolSingletonContainer.Builder)this.applyExplosionCondition( + block, LootItem.lootTableItem(Items.WHEAT_SEEDS) + )) .when(LootItemRandomChanceCondition.randomChance(0.125F)) ); return LootTable.lootTable() @@ -565,15 +595,19 @@ public abstract class BlockLootSubProvider implements LootTableSubProvider { .add(builder) .when( LootItemBlockStatePropertyCondition.hasBlockStateProperties(block) - .setProperties(StatePropertiesPredicate.Builder.properties().hasProperty(DoublePlantBlock.HALF, DoubleBlockHalf.LOWER)) + .setProperties( + net.minecraft.advancements.critereon.StatePropertiesPredicate.Builder.properties().hasProperty(DoublePlantBlock.HALF, DoubleBlockHalf.LOWER) + ) ) .when( LocationCheck.checkLocation( - LocationPredicate.Builder.location() + net.minecraft.advancements.critereon.LocationPredicate.Builder.location() .setBlock( BlockPredicate.Builder.block() - .of(block) - .setProperties(StatePropertiesPredicate.Builder.properties().hasProperty(DoublePlantBlock.HALF, DoubleBlockHalf.UPPER)) + .of(registryLookup, block) + .setProperties( + net.minecraft.advancements.critereon.StatePropertiesPredicate.Builder.properties().hasProperty(DoublePlantBlock.HALF, DoubleBlockHalf.UPPER) + ) ), new BlockPos(0, 1, 0) ) @@ -584,15 +618,19 @@ public abstract class BlockLootSubProvider implements LootTableSubProvider { .add(builder) .when( LootItemBlockStatePropertyCondition.hasBlockStateProperties(block) - .setProperties(StatePropertiesPredicate.Builder.properties().hasProperty(DoublePlantBlock.HALF, DoubleBlockHalf.UPPER)) + .setProperties( + net.minecraft.advancements.critereon.StatePropertiesPredicate.Builder.properties().hasProperty(DoublePlantBlock.HALF, DoubleBlockHalf.UPPER) + ) ) .when( LocationCheck.checkLocation( - LocationPredicate.Builder.location() + net.minecraft.advancements.critereon.LocationPredicate.Builder.location() .setBlock( BlockPredicate.Builder.block() - .of(block) - .setProperties(StatePropertiesPredicate.Builder.properties().hasProperty(DoublePlantBlock.HALF, DoubleBlockHalf.LOWER)) + .of(registryLookup, block) + .setProperties( + net.minecraft.advancements.critereon.StatePropertiesPredicate.Builder.properties().hasProperty(DoublePlantBlock.HALF, DoubleBlockHalf.LOWER) + ) ), new BlockPos(0, -1, 0) ) @@ -606,7 +644,7 @@ public abstract class BlockLootSubProvider implements LootTableSubProvider { LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add( - (LootPoolEntryContainer.Builder)this.applyExplosionDecay( + (Builder)this.applyExplosionDecay( candleBlock, LootItem.lootTableItem(candleBlock) .apply( @@ -614,7 +652,7 @@ public abstract class BlockLootSubProvider implements LootTableSubProvider { integer -> SetItemCountFunction.setCount(ConstantValue.exactly(integer.intValue())) .when( LootItemBlockStatePropertyCondition.hasBlockStateProperties(candleBlock) - .setProperties(StatePropertiesPredicate.Builder.properties().hasProperty(CandleBlock.CANDLES, integer)) + .setProperties(net.minecraft.advancements.critereon.StatePropertiesPredicate.Builder.properties().hasProperty(CandleBlock.CANDLES, integer)) ) ) ) @@ -628,7 +666,7 @@ public abstract class BlockLootSubProvider implements LootTableSubProvider { LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add( - (LootPoolEntryContainer.Builder)this.applyExplosionDecay( + (Builder)this.applyExplosionDecay( petalBlock, LootItem.lootTableItem(petalBlock) .apply( @@ -636,7 +674,7 @@ public abstract class BlockLootSubProvider implements LootTableSubProvider { integer -> SetItemCountFunction.setCount(ConstantValue.exactly(integer.intValue())) .when( LootItemBlockStatePropertyCondition.hasBlockStateProperties(petalBlock) - .setProperties(StatePropertiesPredicate.Builder.properties().hasProperty(PinkPetalsBlock.AMOUNT, integer)) + .setProperties(net.minecraft.advancements.critereon.StatePropertiesPredicate.Builder.properties().hasProperty(PinkPetalsBlock.AMOUNT, integer)) ) ) ) @@ -661,17 +699,21 @@ public abstract class BlockLootSubProvider implements LootTableSubProvider { for (Block block : BuiltInRegistries.BLOCK) { if (block.isEnabled(this.enabledFeatures)) { - ResourceKey resourceKey = block.getLootTable(); - if (resourceKey != BuiltInLootTables.EMPTY && set.add(resourceKey)) { - LootTable.Builder builder = (LootTable.Builder)this.map.remove(resourceKey); - if (builder == null) { - throw new IllegalStateException( - String.format(Locale.ROOT, "Missing loottable '%s' for '%s'", resourceKey.location(), BuiltInRegistries.BLOCK.getKey(block)) - ); - } + block.getLootTable() + .ifPresent( + resourceKey -> { + if (set.add(resourceKey)) { + LootTable.Builder builder = (LootTable.Builder)this.map.remove(resourceKey); + if (builder == null) { + throw new IllegalStateException( + String.format(Locale.ROOT, "Missing loottable '%s' for '%s'", resourceKey.location(), BuiltInRegistries.BLOCK.getKey(block)) + ); + } - biConsumer.accept(resourceKey, builder); - } + biConsumer.accept(resourceKey, builder); + } + } + ); } } @@ -720,6 +762,6 @@ public abstract class BlockLootSubProvider implements LootTableSubProvider { } protected void add(Block block, LootTable.Builder builder) { - this.map.put(block.getLootTable(), builder); + this.map.put((ResourceKey)block.getLootTable().orElseThrow(() -> new IllegalStateException("Block " + block + " does not have loot table")), builder); } } diff --git a/net/minecraft/data/loot/EntityLootSubProvider.java b/net/minecraft/data/loot/EntityLootSubProvider.java index 96510596..c7333063 100644 --- a/net/minecraft/data/loot/EntityLootSubProvider.java +++ b/net/minecraft/data/loot/EntityLootSubProvider.java @@ -1,62 +1,59 @@ package net.minecraft.data.loot; -import com.google.common.collect.ImmutableSet; import com.google.common.collect.Maps; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Locale; import java.util.Map; +import java.util.Optional; import java.util.Set; +import java.util.Map.Entry; import java.util.function.BiConsumer; import java.util.stream.Collectors; -import net.minecraft.advancements.critereon.DamageSourcePredicate; import net.minecraft.advancements.critereon.EnchantmentPredicate; import net.minecraft.advancements.critereon.EntityEquipmentPredicate; -import net.minecraft.advancements.critereon.EntityFlagsPredicate; import net.minecraft.advancements.critereon.EntityPredicate; import net.minecraft.advancements.critereon.EntitySubPredicates; import net.minecraft.advancements.critereon.ItemEnchantmentsPredicate; import net.minecraft.advancements.critereon.ItemPredicate; import net.minecraft.advancements.critereon.ItemSubPredicates; -import net.minecraft.advancements.critereon.MinMaxBounds; +import net.minecraft.advancements.critereon.SheepPredicate; +import net.minecraft.advancements.critereon.MinMaxBounds.Ints; +import net.minecraft.core.HolderGetter; import net.minecraft.core.HolderLookup; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.core.registries.Registries; import net.minecraft.resources.ResourceKey; import net.minecraft.tags.EnchantmentTags; import net.minecraft.world.entity.EntityType; -import net.minecraft.world.entity.MobCategory; import net.minecraft.world.entity.animal.FrogVariant; import net.minecraft.world.flag.FeatureFlagSet; +import net.minecraft.world.item.DyeColor; import net.minecraft.world.item.enchantment.Enchantment; -import net.minecraft.world.level.ItemLike; -import net.minecraft.world.level.storage.loot.BuiltInLootTables; import net.minecraft.world.level.storage.loot.LootContext; import net.minecraft.world.level.storage.loot.LootPool; import net.minecraft.world.level.storage.loot.LootTable; -import net.minecraft.world.level.storage.loot.entries.LootItem; +import net.minecraft.world.level.storage.loot.entries.AlternativesEntry; import net.minecraft.world.level.storage.loot.entries.NestedLootTable; import net.minecraft.world.level.storage.loot.predicates.AnyOfCondition; import net.minecraft.world.level.storage.loot.predicates.DamageSourceCondition; import net.minecraft.world.level.storage.loot.predicates.LootItemCondition; import net.minecraft.world.level.storage.loot.predicates.LootItemEntityPropertyCondition; -import net.minecraft.world.level.storage.loot.providers.number.ConstantValue; +import net.minecraft.world.level.storage.loot.predicates.AnyOfCondition.Builder; public abstract class EntityLootSubProvider implements LootTableSubProvider { - private static final Set> SPECIAL_LOOT_TABLE_TYPES = ImmutableSet.of( - EntityType.PLAYER, EntityType.ARMOR_STAND, EntityType.IRON_GOLEM, EntityType.SNOW_GOLEM, EntityType.VILLAGER - ); protected final HolderLookup.Provider registries; private final FeatureFlagSet allowed; private final FeatureFlagSet required; private final Map, Map, LootTable.Builder>> map = Maps., Map, LootTable.Builder>>newHashMap(); - protected final AnyOfCondition.Builder shouldSmeltLoot() { + protected final Builder shouldSmeltLoot() { HolderLookup.RegistryLookup registryLookup = this.registries.lookupOrThrow(Registries.ENCHANTMENT); return AnyOfCondition.anyOf( LootItemEntityPropertyCondition.hasProperties( - LootContext.EntityTarget.THIS, EntityPredicate.Builder.entity().flags(EntityFlagsPredicate.Builder.flags().setOnFire(true)) + LootContext.EntityTarget.THIS, + EntityPredicate.Builder.entity().flags(net.minecraft.advancements.critereon.EntityFlagsPredicate.Builder.flags().setOnFire(true)) ), LootItemEntityPropertyCondition.hasProperties( LootContext.EntityTarget.DIRECT_ATTACKER, @@ -67,9 +64,7 @@ public abstract class EntityLootSubProvider implements LootTableSubProvider { ItemPredicate.Builder.item() .withSubPredicate( ItemSubPredicates.ENCHANTMENTS, - ItemEnchantmentsPredicate.enchantments( - List.of(new EnchantmentPredicate(registryLookup.getOrThrow(EnchantmentTags.SMELTS_LOOT), MinMaxBounds.Ints.ANY)) - ) + ItemEnchantmentsPredicate.enchantments(List.of(new EnchantmentPredicate(registryLookup.getOrThrow(EnchantmentTags.SMELTS_LOOT), Ints.ANY))) ) ) ) @@ -87,10 +82,21 @@ public abstract class EntityLootSubProvider implements LootTableSubProvider { this.registries = registries; } - protected static LootTable.Builder createSheepTable(ItemLike woolItem) { - return LootTable.lootTable() - .withPool(LootPool.lootPool().setRolls(ConstantValue.exactly(1.0F)).add(LootItem.lootTableItem(woolItem))) - .withPool(LootPool.lootPool().setRolls(ConstantValue.exactly(1.0F)).add(NestedLootTable.lootTableReference(EntityType.SHEEP.getDefaultLootTable()))); + public static net.minecraft.world.level.storage.loot.LootPool.Builder createSheepDispatchPool(Map> map) { + net.minecraft.world.level.storage.loot.entries.AlternativesEntry.Builder builder = AlternativesEntry.alternatives(); + + for (Entry> entry : map.entrySet()) { + builder = builder.otherwise( + NestedLootTable.lootTableReference((ResourceKey)entry.getValue()) + .when( + LootItemEntityPropertyCondition.hasProperties( + LootContext.EntityTarget.THIS, EntityPredicate.Builder.entity().subPredicate(SheepPredicate.hasWool((DyeColor)entry.getKey())) + ) + ) + ); + } + + return LootPool.lootPool().add(builder); } public abstract void generate(); @@ -100,24 +106,24 @@ public abstract class EntityLootSubProvider implements LootTableSubProvider { this.generate(); Set> set = new HashSet(); BuiltInRegistries.ENTITY_TYPE - .holders() + .listElements() .forEach( reference -> { EntityType entityType = (EntityType)reference.value(); if (entityType.isEnabled(this.allowed)) { - if (canHaveLootTable(entityType)) { + Optional> optional = entityType.getDefaultLootTable(); + if (optional.isPresent()) { Map, LootTable.Builder> map = (Map, LootTable.Builder>)this.map.remove(entityType); - ResourceKey resourceKey = entityType.getDefaultLootTable(); - if (resourceKey != BuiltInLootTables.EMPTY && entityType.isEnabled(this.required) && (map == null || !map.containsKey(resourceKey))) { - throw new IllegalStateException(String.format(Locale.ROOT, "Missing loottable '%s' for '%s'", resourceKey, reference.key().location())); + if (entityType.isEnabled(this.required) && (map == null || !map.containsKey(optional.get()))) { + throw new IllegalStateException(String.format(Locale.ROOT, "Missing loottable '%s' for '%s'", optional.get(), reference.key().location())); } if (map != null) { - map.forEach((resourceKeyx, builder) -> { - if (!set.add(resourceKeyx)) { - throw new IllegalStateException(String.format(Locale.ROOT, "Duplicate loottable '%s' for '%s'", resourceKeyx, reference.key().location())); + map.forEach((resourceKey, builder) -> { + if (!set.add(resourceKey)) { + throw new IllegalStateException(String.format(Locale.ROOT, "Duplicate loottable '%s' for '%s'", resourceKey, reference.key().location())); } else { - biConsumer.accept(resourceKeyx, builder); + biConsumer.accept(resourceKey, builder); } }); } @@ -128,7 +134,7 @@ public abstract class EntityLootSubProvider implements LootTableSubProvider { String.format( Locale.ROOT, "Weird loottables '%s' for '%s', not a LivingEntity so should not have loot", - mapx.keySet().stream().map(resourceKeyx -> resourceKeyx.location().toString()).collect(Collectors.joining(",")), + mapx.keySet().stream().map(resourceKey -> resourceKey.location().toString()).collect(Collectors.joining(",")), reference.key().location() ) ); @@ -142,27 +148,29 @@ public abstract class EntityLootSubProvider implements LootTableSubProvider { } } - private static boolean canHaveLootTable(EntityType entityType) { - return SPECIAL_LOOT_TABLE_TYPES.contains(entityType) || entityType.getCategory() != MobCategory.MISC; - } - - protected LootItemCondition.Builder killedByFrog() { - return DamageSourceCondition.hasDamageSource(DamageSourcePredicate.Builder.damageType().source(EntityPredicate.Builder.entity().of(EntityType.FROG))); - } - - protected LootItemCondition.Builder killedByFrogVariant(ResourceKey frogVariant) { + protected LootItemCondition.Builder killedByFrog(HolderGetter> holderGetter) { return DamageSourceCondition.hasDamageSource( - DamageSourcePredicate.Builder.damageType() + net.minecraft.advancements.critereon.DamageSourcePredicate.Builder.damageType().source(EntityPredicate.Builder.entity().of(holderGetter, EntityType.FROG)) + ); + } + + protected LootItemCondition.Builder killedByFrogVariant(HolderGetter> holderGetter, ResourceKey resourceKey) { + return DamageSourceCondition.hasDamageSource( + net.minecraft.advancements.critereon.DamageSourcePredicate.Builder.damageType() .source( EntityPredicate.Builder.entity() - .of(EntityType.FROG) - .subPredicate(EntitySubPredicates.frogVariant(BuiltInRegistries.FROG_VARIANT.getHolderOrThrow(frogVariant))) + .of(holderGetter, EntityType.FROG) + .subPredicate(EntitySubPredicates.frogVariant(BuiltInRegistries.FROG_VARIANT.getOrThrow(resourceKey))) ) ); } protected void add(EntityType entityType, LootTable.Builder builder) { - this.add(entityType, entityType.getDefaultLootTable(), builder); + this.add( + entityType, + (ResourceKey)entityType.getDefaultLootTable().orElseThrow(() -> new IllegalStateException("Entity " + entityType + " has no loot table")), + builder + ); } protected void add(EntityType entityType, ResourceKey defaultLootTable, LootTable.Builder builder) { diff --git a/net/minecraft/data/loot/LootTableProvider.java b/net/minecraft/data/loot/LootTableProvider.java index 025390ed..657b4e9b 100644 --- a/net/minecraft/data/loot/LootTableProvider.java +++ b/net/minecraft/data/loot/LootTableProvider.java @@ -22,20 +22,21 @@ import net.minecraft.core.registries.Registries; import net.minecraft.data.CachedOutput; import net.minecraft.data.DataProvider; import net.minecraft.data.PackOutput; +import net.minecraft.data.PackOutput.PathProvider; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; -import net.minecraft.util.ProblemReporter; +import net.minecraft.util.ProblemReporter.Collector; +import net.minecraft.util.context.ContextKeySet; import net.minecraft.world.RandomSequence; -import net.minecraft.world.level.levelgen.RandomSupport; +import net.minecraft.world.level.levelgen.RandomSupport.Seed128bit; import net.minecraft.world.level.storage.loot.LootTable; import net.minecraft.world.level.storage.loot.ValidationContext; -import net.minecraft.world.level.storage.loot.parameters.LootContextParamSet; import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets; import org.slf4j.Logger; public class LootTableProvider implements DataProvider { private static final Logger LOGGER = LogUtils.getLogger(); - private final PackOutput.PathProvider pathProvider; + private final PathProvider pathProvider; private final Set> requiredTables; private final List subProviders; private final CompletableFuture registries; @@ -59,7 +60,7 @@ public class LootTableProvider implements DataProvider { private CompletableFuture run(CachedOutput output, HolderLookup.Provider provider) { WritableRegistry writableRegistry = new MappedRegistry<>(Registries.LOOT_TABLE, Lifecycle.experimental()); - Map map = new Object2ObjectOpenHashMap<>(); + Map map = new Object2ObjectOpenHashMap<>(); this.subProviders.forEach(subProviderEntry -> ((LootTableSubProvider)subProviderEntry.provider().apply(provider)).generate((resourceKeyx, builder) -> { ResourceLocation resourceLocation = sequenceIdForLootTable(resourceKeyx); ResourceLocation resourceLocation2 = (ResourceLocation)map.put(RandomSequence.seedForKey(resourceLocation), resourceLocation); @@ -72,18 +73,20 @@ public class LootTableProvider implements DataProvider { writableRegistry.register(resourceKeyx, lootTable, RegistrationInfo.BUILT_IN); })); writableRegistry.freeze(); - ProblemReporter.Collector collector = new ProblemReporter.Collector(); - HolderGetter.Provider provider2 = new RegistryAccess.ImmutableRegistryAccess(List.of(writableRegistry)).freeze().asGetterLookup(); + Collector collector = new Collector(); + HolderGetter.Provider provider2 = new RegistryAccess.ImmutableRegistryAccess(List.of(writableRegistry)).freeze(); ValidationContext validationContext = new ValidationContext(collector, LootContextParamSets.ALL_PARAMS, provider2); for (ResourceKey resourceKey : Sets.difference(this.requiredTables, writableRegistry.registryKeySet())) { collector.report("Missing built-in table: " + resourceKey.location()); } - writableRegistry.holders() + writableRegistry.listElements() .forEach( reference -> ((LootTable)reference.value()) - .validate(validationContext.setParams(((LootTable)reference.value()).getParamSet()).enterElement("{" + reference.key().location() + "}", reference.key())) + .validate( + validationContext.setContextKeySet(((LootTable)reference.value()).getParamSet()).enterElement("{" + reference.key().location() + "}", reference.key()) + ) ); Multimap multimap = collector.get(); if (!multimap.isEmpty()) { @@ -108,6 +111,6 @@ public class LootTableProvider implements DataProvider { return "Loot Tables"; } - public record SubProviderEntry(Function provider, LootContextParamSet paramSet) { + public record SubProviderEntry(Function provider, ContextKeySet paramSet) { } } diff --git a/net/minecraft/data/loot/packs/LootData.java b/net/minecraft/data/loot/packs/LootData.java new file mode 100644 index 00000000..9bece524 --- /dev/null +++ b/net/minecraft/data/loot/packs/LootData.java @@ -0,0 +1,29 @@ +package net.minecraft.data.loot.packs; + +import com.google.common.collect.Maps; +import java.util.Map; +import net.minecraft.Util; +import net.minecraft.world.item.DyeColor; +import net.minecraft.world.level.ItemLike; +import net.minecraft.world.level.block.Blocks; + +public interface LootData { + Map WOOL_ITEM_BY_DYE = Util.make(Maps.newEnumMap(DyeColor.class), enumMap -> { + enumMap.put(DyeColor.WHITE, Blocks.WHITE_WOOL); + enumMap.put(DyeColor.ORANGE, Blocks.ORANGE_WOOL); + enumMap.put(DyeColor.MAGENTA, Blocks.MAGENTA_WOOL); + enumMap.put(DyeColor.LIGHT_BLUE, Blocks.LIGHT_BLUE_WOOL); + enumMap.put(DyeColor.YELLOW, Blocks.YELLOW_WOOL); + enumMap.put(DyeColor.LIME, Blocks.LIME_WOOL); + enumMap.put(DyeColor.PINK, Blocks.PINK_WOOL); + enumMap.put(DyeColor.GRAY, Blocks.GRAY_WOOL); + enumMap.put(DyeColor.LIGHT_GRAY, Blocks.LIGHT_GRAY_WOOL); + enumMap.put(DyeColor.CYAN, Blocks.CYAN_WOOL); + enumMap.put(DyeColor.PURPLE, Blocks.PURPLE_WOOL); + enumMap.put(DyeColor.BLUE, Blocks.BLUE_WOOL); + enumMap.put(DyeColor.BROWN, Blocks.BROWN_WOOL); + enumMap.put(DyeColor.GREEN, Blocks.GREEN_WOOL); + enumMap.put(DyeColor.RED, Blocks.RED_WOOL); + enumMap.put(DyeColor.BLACK, Blocks.BLACK_WOOL); + }); +} diff --git a/net/minecraft/data/loot/packs/VanillaBlockLoot.java b/net/minecraft/data/loot/packs/VanillaBlockLoot.java index 8713a49e..b14ee09b 100644 --- a/net/minecraft/data/loot/packs/VanillaBlockLoot.java +++ b/net/minecraft/data/loot/packs/VanillaBlockLoot.java @@ -5,7 +5,7 @@ import java.util.Set; import java.util.stream.Collectors; import java.util.stream.Stream; import net.minecraft.advancements.critereon.ItemPredicate; -import net.minecraft.advancements.critereon.StatePropertiesPredicate; +import net.minecraft.advancements.critereon.StatePropertiesPredicate.Builder; import net.minecraft.core.HolderLookup; import net.minecraft.core.component.DataComponents; import net.minecraft.core.registries.Registries; @@ -44,8 +44,6 @@ import net.minecraft.world.level.storage.loot.LootTable; import net.minecraft.world.level.storage.loot.entries.AlternativesEntry; import net.minecraft.world.level.storage.loot.entries.DynamicLoot; import net.minecraft.world.level.storage.loot.entries.LootItem; -import net.minecraft.world.level.storage.loot.entries.LootPoolEntryContainer; -import net.minecraft.world.level.storage.loot.entries.LootPoolSingletonContainer; import net.minecraft.world.level.storage.loot.functions.ApplyBonusCount; import net.minecraft.world.level.storage.loot.functions.CopyComponentsFunction; import net.minecraft.world.level.storage.loot.functions.LimitCount; @@ -100,6 +98,7 @@ public class VanillaBlockLoot extends BlockLootSubProvider { @Override protected void generate() { HolderLookup.RegistryLookup registryLookup = this.registries.lookupOrThrow(Registries.ENCHANTMENT); + HolderLookup.RegistryLookup registryLookup2 = this.registries.lookupOrThrow(Registries.ITEM); this.dropSelf(Blocks.GRANITE); this.dropSelf(Blocks.POLISHED_GRANITE); this.dropSelf(Blocks.DIORITE); @@ -115,6 +114,7 @@ public class VanillaBlockLoot extends BlockLootSubProvider { this.dropSelf(Blocks.JUNGLE_PLANKS); this.dropSelf(Blocks.ACACIA_PLANKS); this.dropSelf(Blocks.DARK_OAK_PLANKS); + this.add(Blocks.PALE_OAK_PLANKS, noDrop()); this.dropSelf(Blocks.MANGROVE_PLANKS); this.dropSelf(Blocks.CHERRY_PLANKS); this.dropSelf(Blocks.BAMBOO_PLANKS); @@ -126,6 +126,7 @@ public class VanillaBlockLoot extends BlockLootSubProvider { this.dropSelf(Blocks.JUNGLE_SAPLING); this.dropSelf(Blocks.ACACIA_SAPLING); this.dropSelf(Blocks.DARK_OAK_SAPLING); + this.add(Blocks.PALE_OAK_SAPLING, noDrop()); this.dropSelf(Blocks.CHERRY_SAPLING); this.dropSelf(Blocks.SAND); this.add(Blocks.SUSPICIOUS_SAND, noDrop()); @@ -137,6 +138,7 @@ public class VanillaBlockLoot extends BlockLootSubProvider { this.dropSelf(Blocks.JUNGLE_LOG); this.dropSelf(Blocks.ACACIA_LOG); this.dropSelf(Blocks.DARK_OAK_LOG); + this.add(Blocks.PALE_OAK_LOG, noDrop()); this.dropSelf(Blocks.CHERRY_LOG); this.dropSelf(Blocks.BAMBOO_BLOCK); this.dropSelf(Blocks.STRIPPED_OAK_LOG); @@ -145,6 +147,7 @@ public class VanillaBlockLoot extends BlockLootSubProvider { this.dropSelf(Blocks.STRIPPED_JUNGLE_LOG); this.dropSelf(Blocks.STRIPPED_ACACIA_LOG); this.dropSelf(Blocks.STRIPPED_DARK_OAK_LOG); + this.add(Blocks.STRIPPED_PALE_OAK_LOG, noDrop()); this.dropSelf(Blocks.STRIPPED_MANGROVE_LOG); this.dropSelf(Blocks.STRIPPED_CHERRY_LOG); this.dropSelf(Blocks.STRIPPED_BAMBOO_BLOCK); @@ -156,6 +159,7 @@ public class VanillaBlockLoot extends BlockLootSubProvider { this.dropSelf(Blocks.JUNGLE_WOOD); this.dropSelf(Blocks.ACACIA_WOOD); this.dropSelf(Blocks.DARK_OAK_WOOD); + this.add(Blocks.PALE_OAK_WOOD, noDrop()); this.dropSelf(Blocks.MANGROVE_WOOD); this.dropSelf(Blocks.CHERRY_WOOD); this.dropSelf(Blocks.STRIPPED_OAK_WOOD); @@ -164,6 +168,7 @@ public class VanillaBlockLoot extends BlockLootSubProvider { this.dropSelf(Blocks.STRIPPED_JUNGLE_WOOD); this.dropSelf(Blocks.STRIPPED_ACACIA_WOOD); this.dropSelf(Blocks.STRIPPED_DARK_OAK_WOOD); + this.add(Blocks.STRIPPED_PALE_OAK_WOOD, noDrop()); this.dropSelf(Blocks.STRIPPED_MANGROVE_WOOD); this.dropSelf(Blocks.STRIPPED_CHERRY_WOOD); this.dropSelf(Blocks.STRIPPED_CRIMSON_HYPHAE); @@ -231,6 +236,7 @@ public class VanillaBlockLoot extends BlockLootSubProvider { this.dropSelf(Blocks.ACACIA_SIGN); this.dropSelf(Blocks.JUNGLE_SIGN); this.dropSelf(Blocks.DARK_OAK_SIGN); + this.add(Blocks.PALE_OAK_SIGN, noDrop()); this.dropSelf(Blocks.MANGROVE_SIGN); this.dropSelf(Blocks.CHERRY_SIGN); this.dropSelf(Blocks.BAMBOO_SIGN); @@ -241,6 +247,7 @@ public class VanillaBlockLoot extends BlockLootSubProvider { this.dropSelf(Blocks.CHERRY_HANGING_SIGN); this.dropSelf(Blocks.JUNGLE_HANGING_SIGN); this.dropSelf(Blocks.DARK_OAK_HANGING_SIGN); + this.add(Blocks.PALE_OAK_HANGING_SIGN, noDrop()); this.dropSelf(Blocks.MANGROVE_HANGING_SIGN); this.dropSelf(Blocks.CRIMSON_HANGING_SIGN); this.dropSelf(Blocks.WARPED_HANGING_SIGN); @@ -256,6 +263,7 @@ public class VanillaBlockLoot extends BlockLootSubProvider { this.dropSelf(Blocks.JUNGLE_PRESSURE_PLATE); this.dropSelf(Blocks.ACACIA_PRESSURE_PLATE); this.dropSelf(Blocks.DARK_OAK_PRESSURE_PLATE); + this.add(Blocks.PALE_OAK_PRESSURE_PLATE, noDrop()); this.dropSelf(Blocks.MANGROVE_PRESSURE_PLATE); this.dropSelf(Blocks.CHERRY_PRESSURE_PLATE); this.dropSelf(Blocks.BAMBOO_PRESSURE_PLATE); @@ -284,6 +292,7 @@ public class VanillaBlockLoot extends BlockLootSubProvider { this.dropSelf(Blocks.JUNGLE_TRAPDOOR); this.dropSelf(Blocks.ACACIA_TRAPDOOR); this.dropSelf(Blocks.DARK_OAK_TRAPDOOR); + this.add(Blocks.PALE_OAK_TRAPDOOR, noDrop()); this.dropSelf(Blocks.MANGROVE_TRAPDOOR); this.dropSelf(Blocks.CHERRY_TRAPDOOR); this.dropSelf(Blocks.BAMBOO_TRAPDOOR); @@ -327,6 +336,7 @@ public class VanillaBlockLoot extends BlockLootSubProvider { this.dropSelf(Blocks.JUNGLE_BUTTON); this.dropSelf(Blocks.ACACIA_BUTTON); this.dropSelf(Blocks.DARK_OAK_BUTTON); + this.add(Blocks.PALE_OAK_BUTTON, noDrop()); this.dropSelf(Blocks.MANGROVE_BUTTON); this.dropSelf(Blocks.CHERRY_BUTTON); this.dropSelf(Blocks.BAMBOO_BUTTON); @@ -367,6 +377,7 @@ public class VanillaBlockLoot extends BlockLootSubProvider { this.dropSelf(Blocks.BLACK_TERRACOTTA); this.dropSelf(Blocks.ACACIA_STAIRS); this.dropSelf(Blocks.DARK_OAK_STAIRS); + this.add(Blocks.PALE_OAK_STAIRS, noDrop()); this.dropSelf(Blocks.CHERRY_STAIRS); this.dropSelf(Blocks.SLIME_BLOCK); this.dropSelf(Blocks.IRON_TRAPDOOR); @@ -408,12 +419,14 @@ public class VanillaBlockLoot extends BlockLootSubProvider { this.dropSelf(Blocks.JUNGLE_FENCE_GATE); this.dropSelf(Blocks.ACACIA_FENCE_GATE); this.dropSelf(Blocks.DARK_OAK_FENCE_GATE); + this.add(Blocks.PALE_OAK_FENCE_GATE, noDrop()); this.dropSelf(Blocks.CHERRY_FENCE_GATE); this.dropSelf(Blocks.SPRUCE_FENCE); this.dropSelf(Blocks.BIRCH_FENCE); this.dropSelf(Blocks.JUNGLE_FENCE); this.dropSelf(Blocks.ACACIA_FENCE); this.dropSelf(Blocks.DARK_OAK_FENCE); + this.add(Blocks.PALE_OAK_FENCE, noDrop()); this.dropSelf(Blocks.CHERRY_FENCE); this.dropSelf(Blocks.END_ROD); this.dropSelf(Blocks.PURPUR_BLOCK); @@ -610,6 +623,9 @@ public class VanillaBlockLoot extends BlockLootSubProvider { this.add(Blocks.PINK_PETALS, this.createPetalsDrops(Blocks.PINK_PETALS)); this.dropSelf(Blocks.BIG_DRIPLEAF); this.dropSelf(Blocks.MOSS_BLOCK); + this.add(Blocks.PALE_MOSS_CARPET, noDrop()); + this.add(Blocks.PALE_HANGING_MOSS, noDrop()); + this.add(Blocks.PALE_MOSS_BLOCK, noDrop()); this.dropSelf(Blocks.ROOTED_DIRT); this.dropSelf(Blocks.COBBLED_DEEPSLATE); this.dropSelf(Blocks.COBBLED_DEEPSLATE_STAIRS); @@ -707,6 +723,7 @@ public class VanillaBlockLoot extends BlockLootSubProvider { this.dropPottedContents(Blocks.POTTED_JUNGLE_SAPLING); this.dropPottedContents(Blocks.POTTED_ACACIA_SAPLING); this.dropPottedContents(Blocks.POTTED_DARK_OAK_SAPLING); + this.add(Blocks.POTTED_PALE_OAK_SAPLING, noDrop()); this.dropPottedContents(Blocks.POTTED_MANGROVE_PROPAGULE); this.dropPottedContents(Blocks.POTTED_CHERRY_SAPLING); this.dropPottedContents(Blocks.POTTED_FERN); @@ -742,6 +759,7 @@ public class VanillaBlockLoot extends BlockLootSubProvider { this.add(Blocks.JUNGLE_SLAB, block -> this.createSlabItemTable(block)); this.add(Blocks.ACACIA_SLAB, block -> this.createSlabItemTable(block)); this.add(Blocks.DARK_OAK_SLAB, block -> this.createSlabItemTable(block)); + this.add(Blocks.PALE_OAK_SLAB, noDrop()); this.add(Blocks.MANGROVE_SLAB, block -> this.createSlabItemTable(block)); this.add(Blocks.CHERRY_SLAB, block -> this.createSlabItemTable(block)); this.add(Blocks.BAMBOO_SLAB, block -> this.createSlabItemTable(block)); @@ -798,6 +816,7 @@ public class VanillaBlockLoot extends BlockLootSubProvider { this.add(Blocks.JUNGLE_DOOR, block -> this.createDoorTable(block)); this.add(Blocks.ACACIA_DOOR, block -> this.createDoorTable(block)); this.add(Blocks.DARK_OAK_DOOR, block -> this.createDoorTable(block)); + this.add(Blocks.PALE_OAK_DOOR, noDrop()); this.add(Blocks.MANGROVE_DOOR, block -> this.createDoorTable(block)); this.add(Blocks.CHERRY_DOOR, block -> this.createDoorTable(block)); this.add(Blocks.BAMBOO_DOOR, block -> this.createDoorTable(block)); @@ -843,8 +862,7 @@ public class VanillaBlockLoot extends BlockLootSubProvider { .add( LootItem.lootTableItem(Blocks.TNT) .when( - LootItemBlockStatePropertyCondition.hasBlockStateProperties(Blocks.TNT) - .setProperties(StatePropertiesPredicate.Builder.properties().hasProperty(TntBlock.UNSTABLE, false)) + LootItemBlockStatePropertyCondition.hasBlockStateProperties(Blocks.TNT).setProperties(Builder.properties().hasProperty(TntBlock.UNSTABLE, false)) ) ) ) @@ -857,15 +875,12 @@ public class VanillaBlockLoot extends BlockLootSubProvider { LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add( - (LootPoolEntryContainer.Builder)this.applyExplosionDecay( + (net.minecraft.world.level.storage.loot.entries.LootPoolEntryContainer.Builder)this.applyExplosionDecay( block, LootItem.lootTableItem(Items.COCOA_BEANS) .apply( SetItemCountFunction.setCount(ConstantValue.exactly(3.0F)) - .when( - LootItemBlockStatePropertyCondition.hasBlockStateProperties(block) - .setProperties(StatePropertiesPredicate.Builder.properties().hasProperty(CocoaBlock.AGE, 2)) - ) + .when(LootItemBlockStatePropertyCondition.hasBlockStateProperties(block).setProperties(Builder.properties().hasProperty(CocoaBlock.AGE, 2))) ) ) ) @@ -878,15 +893,14 @@ public class VanillaBlockLoot extends BlockLootSubProvider { LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add( - (LootPoolEntryContainer.Builder)this.applyExplosionDecay( + (net.minecraft.world.level.storage.loot.entries.LootPoolEntryContainer.Builder)this.applyExplosionDecay( Blocks.SEA_PICKLE, LootItem.lootTableItem(block) .apply( List.of(2, 3, 4), integer -> SetItemCountFunction.setCount(ConstantValue.exactly(integer.intValue())) .when( - LootItemBlockStatePropertyCondition.hasBlockStateProperties(block) - .setProperties(StatePropertiesPredicate.Builder.properties().hasProperty(SeaPickleBlock.PICKLES, integer)) + LootItemBlockStatePropertyCondition.hasBlockStateProperties(block).setProperties(Builder.properties().hasProperty(SeaPickleBlock.PICKLES, integer)) ) ) ) @@ -896,14 +910,18 @@ public class VanillaBlockLoot extends BlockLootSubProvider { this.add( Blocks.COMPOSTER, block -> LootTable.lootTable() - .withPool(LootPool.lootPool().add((LootPoolEntryContainer.Builder)this.applyExplosionDecay(block, LootItem.lootTableItem(Items.COMPOSTER)))) + .withPool( + LootPool.lootPool() + .add( + (net.minecraft.world.level.storage.loot.entries.LootPoolEntryContainer.Builder)this.applyExplosionDecay( + block, LootItem.lootTableItem(Items.COMPOSTER) + ) + ) + ) .withPool( LootPool.lootPool() .add(LootItem.lootTableItem(Items.BONE_MEAL)) - .when( - LootItemBlockStatePropertyCondition.hasBlockStateProperties(block) - .setProperties(StatePropertiesPredicate.Builder.properties().hasProperty(ComposterBlock.LEVEL, 8)) - ) + .when(LootItemBlockStatePropertyCondition.hasBlockStateProperties(block).setProperties(Builder.properties().hasProperty(ComposterBlock.LEVEL, 8))) ) ); this.add(Blocks.CAVE_VINES, block -> this.createCaveVinesDrop(block)); @@ -1007,19 +1025,20 @@ public class VanillaBlockLoot extends BlockLootSubProvider { this.add(Blocks.JUNGLE_LEAVES, block -> this.createLeavesDrops(block, Blocks.JUNGLE_SAPLING, JUNGLE_LEAVES_SAPLING_CHANGES)); this.add(Blocks.ACACIA_LEAVES, block -> this.createLeavesDrops(block, Blocks.ACACIA_SAPLING, NORMAL_LEAVES_SAPLING_CHANCES)); this.add(Blocks.DARK_OAK_LEAVES, block -> this.createOakLeavesDrops(block, Blocks.DARK_OAK_SAPLING, NORMAL_LEAVES_SAPLING_CHANCES)); + this.add(Blocks.PALE_OAK_LEAVES, noDrop()); this.add(Blocks.CHERRY_LEAVES, block -> this.createLeavesDrops(block, Blocks.CHERRY_SAPLING, NORMAL_LEAVES_SAPLING_CHANCES)); this.add(Blocks.AZALEA_LEAVES, block -> this.createLeavesDrops(block, Blocks.AZALEA, NORMAL_LEAVES_SAPLING_CHANCES)); this.add(Blocks.FLOWERING_AZALEA_LEAVES, block -> this.createLeavesDrops(block, Blocks.FLOWERING_AZALEA, NORMAL_LEAVES_SAPLING_CHANCES)); LootItemCondition.Builder builder = LootItemBlockStatePropertyCondition.hasBlockStateProperties(Blocks.BEETROOTS) - .setProperties(StatePropertiesPredicate.Builder.properties().hasProperty(BeetrootBlock.AGE, 3)); + .setProperties(Builder.properties().hasProperty(BeetrootBlock.AGE, 3)); this.add(Blocks.BEETROOTS, this.createCropDrops(Blocks.BEETROOTS, Items.BEETROOT, Items.BEETROOT_SEEDS, builder)); LootItemCondition.Builder builder2 = LootItemBlockStatePropertyCondition.hasBlockStateProperties(Blocks.WHEAT) - .setProperties(StatePropertiesPredicate.Builder.properties().hasProperty(CropBlock.AGE, 7)); + .setProperties(Builder.properties().hasProperty(CropBlock.AGE, 7)); this.add(Blocks.WHEAT, this.createCropDrops(Blocks.WHEAT, Items.WHEAT, Items.WHEAT_SEEDS, builder2)); LootItemCondition.Builder builder3 = LootItemBlockStatePropertyCondition.hasBlockStateProperties(Blocks.CARROTS) - .setProperties(StatePropertiesPredicate.Builder.properties().hasProperty(CarrotBlock.AGE, 7)); + .setProperties(Builder.properties().hasProperty(CarrotBlock.AGE, 7)); LootItemCondition.Builder builder4 = LootItemBlockStatePropertyCondition.hasBlockStateProperties(Blocks.MANGROVE_PROPAGULE) - .setProperties(StatePropertiesPredicate.Builder.properties().hasProperty(MangrovePropaguleBlock.AGE, 4)); + .setProperties(Builder.properties().hasProperty(MangrovePropaguleBlock.AGE, 4)); this.add( Blocks.MANGROVE_PROPAGULE, this.applyExplosionDecay( @@ -1044,7 +1063,7 @@ public class VanillaBlockLoot extends BlockLootSubProvider { LootItem.lootTableItem(Items.PITCHER_PLANT) .when( LootItemBlockStatePropertyCondition.hasBlockStateProperties(Blocks.PITCHER_PLANT) - .setProperties(StatePropertiesPredicate.Builder.properties().hasProperty(DoublePlantBlock.HALF, DoubleBlockHalf.LOWER)) + .setProperties(Builder.properties().hasProperty(DoublePlantBlock.HALF, DoubleBlockHalf.LOWER)) ) ) ) @@ -1067,7 +1086,7 @@ public class VanillaBlockLoot extends BlockLootSubProvider { ) ); LootItemCondition.Builder builder5 = LootItemBlockStatePropertyCondition.hasBlockStateProperties(Blocks.POTATOES) - .setProperties(StatePropertiesPredicate.Builder.properties().hasProperty(PotatoBlock.AGE, 7)); + .setProperties(Builder.properties().hasProperty(PotatoBlock.AGE, 7)); this.add( Blocks.POTATOES, this.applyExplosionDecay( @@ -1094,7 +1113,7 @@ public class VanillaBlockLoot extends BlockLootSubProvider { LootPool.lootPool() .when( LootItemBlockStatePropertyCondition.hasBlockStateProperties(Blocks.SWEET_BERRY_BUSH) - .setProperties(StatePropertiesPredicate.Builder.properties().hasProperty(SweetBerryBushBlock.AGE, 3)) + .setProperties(Builder.properties().hasProperty(SweetBerryBushBlock.AGE, 3)) ) .add(LootItem.lootTableItem(Items.SWEET_BERRIES)) .apply(SetItemCountFunction.setCount(UniformGenerator.between(2.0F, 3.0F))) @@ -1104,7 +1123,7 @@ public class VanillaBlockLoot extends BlockLootSubProvider { LootPool.lootPool() .when( LootItemBlockStatePropertyCondition.hasBlockStateProperties(Blocks.SWEET_BERRY_BUSH) - .setProperties(StatePropertiesPredicate.Builder.properties().hasProperty(SweetBerryBushBlock.AGE, 2)) + .setProperties(Builder.properties().hasProperty(SweetBerryBushBlock.AGE, 2)) ) .add(LootItem.lootTableItem(Items.SWEET_BERRIES)) .apply(SetItemCountFunction.setCount(UniformGenerator.between(1.0F, 2.0F))) @@ -1131,7 +1150,7 @@ public class VanillaBlockLoot extends BlockLootSubProvider { Blocks.NETHER_GOLD_ORE, block -> this.createSilkTouchDispatchTable( block, - (LootPoolEntryContainer.Builder)this.applyExplosionDecay( + (net.minecraft.world.level.storage.loot.entries.LootPoolEntryContainer.Builder)this.applyExplosionDecay( block, LootItem.lootTableItem(Items.GOLD_NUGGET) .apply(SetItemCountFunction.setCount(UniformGenerator.between(2.0F, 6.0F))) @@ -1144,24 +1163,25 @@ public class VanillaBlockLoot extends BlockLootSubProvider { this.add( Blocks.COBWEB, block -> this.createSilkTouchOrShearsDispatchTable( - block, (LootPoolEntryContainer.Builder)this.applyExplosionCondition(block, LootItem.lootTableItem(Items.STRING)) + block, + (net.minecraft.world.level.storage.loot.entries.LootPoolEntryContainer.Builder)this.applyExplosionCondition(block, LootItem.lootTableItem(Items.STRING)) ) ); this.add( Blocks.DEAD_BUSH, block -> this.createShearsDispatchTable( block, - (LootPoolEntryContainer.Builder)this.applyExplosionDecay( + (net.minecraft.world.level.storage.loot.entries.LootPoolEntryContainer.Builder)this.applyExplosionDecay( block, LootItem.lootTableItem(Items.STICK).apply(SetItemCountFunction.setCount(UniformGenerator.between(0.0F, 2.0F))) ) ) ); - this.add(Blocks.NETHER_SPROUTS, itemLike -> BlockLootSubProvider.createShearsOnlyDrop(itemLike)); - this.add(Blocks.SEAGRASS, itemLike -> BlockLootSubProvider.createShearsOnlyDrop(itemLike)); - this.add(Blocks.VINE, itemLike -> BlockLootSubProvider.createShearsOnlyDrop(itemLike)); - this.add(Blocks.GLOW_LICHEN, block -> this.createMultifaceBlockDrops(block, HAS_SHEARS)); - this.add(Blocks.HANGING_ROOTS, itemLike -> BlockLootSubProvider.createShearsOnlyDrop(itemLike)); - this.add(Blocks.SMALL_DRIPLEAF, itemLike -> BlockLootSubProvider.createShearsOnlyDrop(itemLike)); + this.add(Blocks.NETHER_SPROUTS, itemLike -> this.createShearsOnlyDrop(itemLike)); + this.add(Blocks.SEAGRASS, itemLike -> this.createShearsOnlyDrop(itemLike)); + this.add(Blocks.VINE, itemLike -> this.createShearsOnlyDrop(itemLike)); + this.add(Blocks.GLOW_LICHEN, block -> this.createMultifaceBlockDrops(block, this.hasShears())); + this.add(Blocks.HANGING_ROOTS, itemLike -> this.createShearsOnlyDrop(itemLike)); + this.add(Blocks.SMALL_DRIPLEAF, itemLike -> this.createShearsOnlyDrop(itemLike)); this.add(Blocks.MANGROVE_LEAVES, block -> this.createMangroveLeavesDrops(block)); this.add(Blocks.TALL_SEAGRASS, this.createDoublePlantShearsDrop(Blocks.SEAGRASS)); this.add(Blocks.LARGE_FERN, block -> this.createDoublePlantWithSeedDrops(block, Blocks.FERN)); @@ -1177,7 +1197,7 @@ public class VanillaBlockLoot extends BlockLootSubProvider { LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add( - ((LootPoolSingletonContainer.Builder)this.applyExplosionCondition(block, LootItem.lootTableItem(block))) + ((net.minecraft.world.level.storage.loot.entries.LootPoolSingletonContainer.Builder)this.applyExplosionCondition(block, LootItem.lootTableItem(block))) .when(LootItemEntityPropertyCondition.entityPresent(LootContext.EntityTarget.THIS)) ) ) @@ -1188,7 +1208,7 @@ public class VanillaBlockLoot extends BlockLootSubProvider { Blocks.GLOWSTONE, block -> this.createSilkTouchDispatchTable( block, - (LootPoolEntryContainer.Builder)this.applyExplosionDecay( + (net.minecraft.world.level.storage.loot.entries.LootPoolEntryContainer.Builder)this.applyExplosionDecay( block, LootItem.lootTableItem(Items.GLOWSTONE_DUST) .apply(SetItemCountFunction.setCount(UniformGenerator.between(2.0F, 4.0F))) @@ -1201,7 +1221,7 @@ public class VanillaBlockLoot extends BlockLootSubProvider { Blocks.MELON, block -> this.createSilkTouchDispatchTable( block, - (LootPoolEntryContainer.Builder)this.applyExplosionDecay( + (net.minecraft.world.level.storage.loot.entries.LootPoolEntryContainer.Builder)this.applyExplosionDecay( block, LootItem.lootTableItem(Items.MELON_SLICE) .apply(SetItemCountFunction.setCount(UniformGenerator.between(3.0F, 7.0F))) @@ -1216,7 +1236,7 @@ public class VanillaBlockLoot extends BlockLootSubProvider { Blocks.SEA_LANTERN, block -> this.createSilkTouchDispatchTable( block, - (LootPoolEntryContainer.Builder)this.applyExplosionDecay( + (net.minecraft.world.level.storage.loot.entries.LootPoolEntryContainer.Builder)this.applyExplosionDecay( block, LootItem.lootTableItem(Items.PRISMARINE_CRYSTALS) .apply(SetItemCountFunction.setCount(UniformGenerator.between(2.0F, 3.0F))) @@ -1237,17 +1257,11 @@ public class VanillaBlockLoot extends BlockLootSubProvider { LootItem.lootTableItem(Items.NETHER_WART) .apply( SetItemCountFunction.setCount(UniformGenerator.between(2.0F, 4.0F)) - .when( - LootItemBlockStatePropertyCondition.hasBlockStateProperties(block) - .setProperties(StatePropertiesPredicate.Builder.properties().hasProperty(NetherWartBlock.AGE, 3)) - ) + .when(LootItemBlockStatePropertyCondition.hasBlockStateProperties(block).setProperties(Builder.properties().hasProperty(NetherWartBlock.AGE, 3))) ) .apply( ApplyBonusCount.addUniformBonusCount(registryLookup.getOrThrow(Enchantments.FORTUNE)) - .when( - LootItemBlockStatePropertyCondition.hasBlockStateProperties(block) - .setProperties(StatePropertiesPredicate.Builder.properties().hasProperty(NetherWartBlock.AGE, 3)) - ) + .when(LootItemBlockStatePropertyCondition.hasBlockStateProperties(block).setProperties(Builder.properties().hasProperty(NetherWartBlock.AGE, 3))) ) ) ) @@ -1265,8 +1279,7 @@ public class VanillaBlockLoot extends BlockLootSubProvider { SnowLayerBlock.LAYERS.getPossibleValues(), integer -> LootItem.lootTableItem(Items.SNOWBALL) .when( - LootItemBlockStatePropertyCondition.hasBlockStateProperties(block) - .setProperties(StatePropertiesPredicate.Builder.properties().hasProperty(SnowLayerBlock.LAYERS, integer)) + LootItemBlockStatePropertyCondition.hasBlockStateProperties(block).setProperties(Builder.properties().hasProperty(SnowLayerBlock.LAYERS, integer)) ) .apply(SetItemCountFunction.setCount(ConstantValue.exactly(integer.intValue()))) ) @@ -1278,8 +1291,7 @@ public class VanillaBlockLoot extends BlockLootSubProvider { : LootItem.lootTableItem(Blocks.SNOW) .apply(SetItemCountFunction.setCount(ConstantValue.exactly(integer.intValue()))) .when( - LootItemBlockStatePropertyCondition.hasBlockStateProperties(block) - .setProperties(StatePropertiesPredicate.Builder.properties().hasProperty(SnowLayerBlock.LAYERS, integer)) + LootItemBlockStatePropertyCondition.hasBlockStateProperties(block).setProperties(Builder.properties().hasProperty(SnowLayerBlock.LAYERS, integer)) ) ) ) @@ -1302,7 +1314,7 @@ public class VanillaBlockLoot extends BlockLootSubProvider { Blocks.CAMPFIRE, block -> this.createSilkTouchDispatchTable( block, - (LootPoolEntryContainer.Builder)this.applyExplosionCondition( + (net.minecraft.world.level.storage.loot.entries.LootPoolEntryContainer.Builder)this.applyExplosionCondition( block, LootItem.lootTableItem(Items.CHARCOAL).apply(SetItemCountFunction.setCount(ConstantValue.exactly(2.0F))) ) ) @@ -1324,7 +1336,7 @@ public class VanillaBlockLoot extends BlockLootSubProvider { Blocks.SOUL_CAMPFIRE, block -> this.createSilkTouchDispatchTable( block, - (LootPoolEntryContainer.Builder)this.applyExplosionCondition( + (net.minecraft.world.level.storage.loot.entries.LootPoolEntryContainer.Builder)this.applyExplosionCondition( block, LootItem.lootTableItem(Items.SOUL_SOIL).apply(SetItemCountFunction.setCount(ConstantValue.exactly(1.0F))) ) ) @@ -1336,9 +1348,9 @@ public class VanillaBlockLoot extends BlockLootSubProvider { LootItem.lootTableItem(Items.AMETHYST_SHARD) .apply(SetItemCountFunction.setCount(ConstantValue.exactly(4.0F))) .apply(ApplyBonusCount.addOreBonusCount(registryLookup.getOrThrow(Enchantments.FORTUNE))) - .when(MatchTool.toolMatches(ItemPredicate.Builder.item().of(ItemTags.CLUSTER_MAX_HARVESTABLES))) + .when(MatchTool.toolMatches(ItemPredicate.Builder.item().of(registryLookup2, ItemTags.CLUSTER_MAX_HARVESTABLES))) .otherwise( - (LootPoolEntryContainer.Builder)this.applyExplosionDecay( + (net.minecraft.world.level.storage.loot.entries.LootPoolEntryContainer.Builder)this.applyExplosionDecay( block, LootItem.lootTableItem(Items.AMETHYST_SHARD).apply(SetItemCountFunction.setCount(ConstantValue.exactly(2.0F))) ) ) @@ -1385,6 +1397,7 @@ public class VanillaBlockLoot extends BlockLootSubProvider { this.dropWhenSilkTouch(Blocks.PACKED_ICE); this.dropWhenSilkTouch(Blocks.BLUE_ICE); this.dropWhenSilkTouch(Blocks.TURTLE_EGG); + this.add(Blocks.CREAKING_HEART, noDrop()); this.dropWhenSilkTouch(Blocks.MUSHROOM_STEM); this.dropWhenSilkTouch(Blocks.DEAD_TUBE_CORAL); this.dropWhenSilkTouch(Blocks.DEAD_BRAIN_CORAL); @@ -1456,8 +1469,7 @@ public class VanillaBlockLoot extends BlockLootSubProvider { .add( DynamicLoot.dynamicEntry(DecoratedPotBlock.SHERDS_DYNAMIC_DROP_ID) .when( - LootItemBlockStatePropertyCondition.hasBlockStateProperties(block) - .setProperties(StatePropertiesPredicate.Builder.properties().hasProperty(DecoratedPotBlock.CRACKED, true)) + LootItemBlockStatePropertyCondition.hasBlockStateProperties(block).setProperties(Builder.properties().hasProperty(DecoratedPotBlock.CRACKED, true)) ) .otherwise( LootItem.lootTableItem(block) @@ -1478,9 +1490,9 @@ public class VanillaBlockLoot extends BlockLootSubProvider { PitcherCropBlock.AGE.getPossibleValues(), integer -> { LootItemBlockStatePropertyCondition.Builder builder = LootItemBlockStatePropertyCondition.hasBlockStateProperties(Blocks.PITCHER_CROP) - .setProperties(StatePropertiesPredicate.Builder.properties().hasProperty(DoublePlantBlock.HALF, DoubleBlockHalf.LOWER)); + .setProperties(Builder.properties().hasProperty(DoublePlantBlock.HALF, DoubleBlockHalf.LOWER)); LootItemBlockStatePropertyCondition.Builder builder2 = LootItemBlockStatePropertyCondition.hasBlockStateProperties(Blocks.PITCHER_CROP) - .setProperties(StatePropertiesPredicate.Builder.properties().hasProperty(PitcherCropBlock.AGE, integer)); + .setProperties(Builder.properties().hasProperty(PitcherCropBlock.AGE, integer)); return integer == 4 ? LootItem.lootTableItem(Items.PITCHER_PLANT).when(builder2).when(builder).apply(SetItemCountFunction.setCount(ConstantValue.exactly(1.0F))) : LootItem.lootTableItem(Items.PITCHER_POD).when(builder2).when(builder).apply(SetItemCountFunction.setCount(ConstantValue.exactly(1.0F))); diff --git a/net/minecraft/data/loot/packs/VanillaEntityLoot.java b/net/minecraft/data/loot/packs/VanillaEntityLoot.java index e656cc19..34055800 100644 --- a/net/minecraft/data/loot/packs/VanillaEntityLoot.java +++ b/net/minecraft/data/loot/packs/VanillaEntityLoot.java @@ -1,13 +1,16 @@ package net.minecraft.data.loot.packs; -import net.minecraft.advancements.critereon.DamageSourcePredicate; import net.minecraft.advancements.critereon.EntityPredicate; -import net.minecraft.advancements.critereon.MinMaxBounds; import net.minecraft.advancements.critereon.RaiderPredicate; import net.minecraft.advancements.critereon.SlimePredicate; import net.minecraft.advancements.critereon.TagPredicate; +import net.minecraft.advancements.critereon.DamageSourcePredicate.Builder; +import net.minecraft.advancements.critereon.MinMaxBounds.Ints; +import net.minecraft.core.HolderGetter; import net.minecraft.core.HolderLookup; +import net.minecraft.core.registries.Registries; import net.minecraft.data.loot.EntityLootSubProvider; +import net.minecraft.resources.ResourceKey; import net.minecraft.tags.DamageTypeTags; import net.minecraft.tags.EntityTypeTags; import net.minecraft.tags.ItemTags; @@ -45,6 +48,7 @@ public class VanillaEntityLoot extends EntityLootSubProvider { @Override public void generate() { + HolderGetter> holderGetter = this.registries.lookupOrThrow(Registries.ENTITY_TYPE); this.add(EntityType.ALLAY, LootTable.lootTable()); this.add(EntityType.ARMADILLO, LootTable.lootTable()); this.add(EntityType.ARMOR_STAND, LootTable.lootTable()); @@ -206,7 +210,11 @@ public class VanillaEntityLoot extends EntityLootSubProvider { .withPool( LootPool.lootPool() .add(TagEntry.expandTag(ItemTags.CREEPER_DROP_MUSIC_DISCS)) - .when(LootItemEntityPropertyCondition.hasProperties(LootContext.EntityTarget.ATTACKER, EntityPredicate.Builder.entity().of(EntityTypeTags.SKELETONS))) + .when( + LootItemEntityPropertyCondition.hasProperties( + LootContext.EntityTarget.ATTACKER, EntityPredicate.Builder.entity().of(holderGetter, EntityTypeTags.SKELETONS) + ) + ) ) ); this.add( @@ -458,27 +466,27 @@ public class VanillaEntityLoot extends EntityLootSubProvider { LootItem.lootTableItem(Items.MAGMA_CREAM) .apply(SetItemCountFunction.setCount(UniformGenerator.between(-2.0F, 1.0F))) .apply(EnchantedCountIncreaseFunction.lootingMultiplier(this.registries, UniformGenerator.between(0.0F, 1.0F))) - .when(this.killedByFrog().invert()) + .when(this.killedByFrog(holderGetter).invert()) .when( LootItemEntityPropertyCondition.hasProperties( - LootContext.EntityTarget.THIS, EntityPredicate.Builder.entity().subPredicate(SlimePredicate.sized(MinMaxBounds.Ints.atLeast(2))) + LootContext.EntityTarget.THIS, EntityPredicate.Builder.entity().subPredicate(SlimePredicate.sized(Ints.atLeast(2))) ) ) ) .add( LootItem.lootTableItem(Items.PEARLESCENT_FROGLIGHT) .apply(SetItemCountFunction.setCount(ConstantValue.exactly(1.0F))) - .when(this.killedByFrogVariant(FrogVariant.WARM)) + .when(this.killedByFrogVariant(holderGetter, FrogVariant.WARM)) ) .add( LootItem.lootTableItem(Items.VERDANT_FROGLIGHT) .apply(SetItemCountFunction.setCount(ConstantValue.exactly(1.0F))) - .when(this.killedByFrogVariant(FrogVariant.COLD)) + .when(this.killedByFrogVariant(holderGetter, FrogVariant.COLD)) ) .add( LootItem.lootTableItem(Items.OCHRE_FROGLIGHT) .apply(SetItemCountFunction.setCount(ConstantValue.exactly(1.0F))) - .when(this.killedByFrogVariant(FrogVariant.TEMPERATE)) + .when(this.killedByFrogVariant(holderGetter, FrogVariant.TEMPERATE)) ) ) ); @@ -682,23 +690,16 @@ public class VanillaEntityLoot extends EntityLootSubProvider { .apply(EnchantedCountIncreaseFunction.lootingMultiplier(this.registries, UniformGenerator.between(0.0F, 1.0F))) ) ) + .withPool(createSheepDispatchPool(BuiltInLootTables.SHEEP_BY_DYE)) ); - this.add(EntityType.SHEEP, BuiltInLootTables.SHEEP_BLACK, createSheepTable(Blocks.BLACK_WOOL)); - this.add(EntityType.SHEEP, BuiltInLootTables.SHEEP_BLUE, createSheepTable(Blocks.BLUE_WOOL)); - this.add(EntityType.SHEEP, BuiltInLootTables.SHEEP_BROWN, createSheepTable(Blocks.BROWN_WOOL)); - this.add(EntityType.SHEEP, BuiltInLootTables.SHEEP_CYAN, createSheepTable(Blocks.CYAN_WOOL)); - this.add(EntityType.SHEEP, BuiltInLootTables.SHEEP_GRAY, createSheepTable(Blocks.GRAY_WOOL)); - this.add(EntityType.SHEEP, BuiltInLootTables.SHEEP_GREEN, createSheepTable(Blocks.GREEN_WOOL)); - this.add(EntityType.SHEEP, BuiltInLootTables.SHEEP_LIGHT_BLUE, createSheepTable(Blocks.LIGHT_BLUE_WOOL)); - this.add(EntityType.SHEEP, BuiltInLootTables.SHEEP_LIGHT_GRAY, createSheepTable(Blocks.LIGHT_GRAY_WOOL)); - this.add(EntityType.SHEEP, BuiltInLootTables.SHEEP_LIME, createSheepTable(Blocks.LIME_WOOL)); - this.add(EntityType.SHEEP, BuiltInLootTables.SHEEP_MAGENTA, createSheepTable(Blocks.MAGENTA_WOOL)); - this.add(EntityType.SHEEP, BuiltInLootTables.SHEEP_ORANGE, createSheepTable(Blocks.ORANGE_WOOL)); - this.add(EntityType.SHEEP, BuiltInLootTables.SHEEP_PINK, createSheepTable(Blocks.PINK_WOOL)); - this.add(EntityType.SHEEP, BuiltInLootTables.SHEEP_PURPLE, createSheepTable(Blocks.PURPLE_WOOL)); - this.add(EntityType.SHEEP, BuiltInLootTables.SHEEP_RED, createSheepTable(Blocks.RED_WOOL)); - this.add(EntityType.SHEEP, BuiltInLootTables.SHEEP_WHITE, createSheepTable(Blocks.WHITE_WOOL)); - this.add(EntityType.SHEEP, BuiltInLootTables.SHEEP_YELLOW, createSheepTable(Blocks.YELLOW_WOOL)); + LootData.WOOL_ITEM_BY_DYE + .forEach( + (dyeColor, itemLike) -> this.add( + EntityType.SHEEP, + (ResourceKey)BuiltInLootTables.SHEEP_BY_DYE.get(dyeColor), + LootTable.lootTable().withPool(LootPool.lootPool().add(LootItem.lootTableItem(itemLike))) + ) + ); this.add( EntityType.SHULKER, LootTable.lootTable() @@ -755,12 +756,12 @@ public class VanillaEntityLoot extends EntityLootSubProvider { LootItem.lootTableItem(Items.SLIME_BALL) .apply(SetItemCountFunction.setCount(UniformGenerator.between(0.0F, 2.0F))) .apply(EnchantedCountIncreaseFunction.lootingMultiplier(this.registries, UniformGenerator.between(0.0F, 1.0F))) - .when(this.killedByFrog().invert()) + .when(this.killedByFrog(holderGetter).invert()) ) - .add(LootItem.lootTableItem(Items.SLIME_BALL).apply(SetItemCountFunction.setCount(ConstantValue.exactly(1.0F))).when(this.killedByFrog())) + .add(LootItem.lootTableItem(Items.SLIME_BALL).apply(SetItemCountFunction.setCount(ConstantValue.exactly(1.0F))).when(this.killedByFrog(holderGetter))) .when( LootItemEntityPropertyCondition.hasProperties( - LootContext.EntityTarget.THIS, EntityPredicate.Builder.entity().subPredicate(SlimePredicate.sized(MinMaxBounds.Ints.exactly(1))) + LootContext.EntityTarget.THIS, EntityPredicate.Builder.entity().subPredicate(SlimePredicate.sized(Ints.exactly(1))) ) ) ) @@ -903,7 +904,7 @@ public class VanillaEntityLoot extends EntityLootSubProvider { LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add(LootItem.lootTableItem(Items.BOWL)) - .when(DamageSourceCondition.hasDamageSource(DamageSourcePredicate.Builder.damageType().tag(TagPredicate.is(DamageTypeTags.IS_LIGHTNING)))) + .when(DamageSourceCondition.hasDamageSource(Builder.damageType().tag(TagPredicate.is(DamageTypeTags.IS_LIGHTNING)))) ) ); this.add(EntityType.VEX, LootTable.lootTable()); @@ -1019,6 +1020,8 @@ public class VanillaEntityLoot extends EntityLootSubProvider { ) ) ); + this.add(EntityType.CREAKING, LootTable.lootTable()); + this.add(EntityType.CREAKING_TRANSIENT, LootTable.lootTable()); this.add( EntityType.ZOMBIE, LootTable.lootTable() diff --git a/net/minecraft/data/loot/packs/VanillaEquipmentLoot.java b/net/minecraft/data/loot/packs/VanillaEquipmentLoot.java index 0c091ba7..bd968191 100644 --- a/net/minecraft/data/loot/packs/VanillaEquipmentLoot.java +++ b/net/minecraft/data/loot/packs/VanillaEquipmentLoot.java @@ -1,7 +1,6 @@ package net.minecraft.data.loot.packs; import java.util.function.BiConsumer; -import net.minecraft.core.Holder; import net.minecraft.core.HolderLookup; import net.minecraft.core.component.DataComponents; import net.minecraft.core.registries.Registries; @@ -9,13 +8,13 @@ import net.minecraft.data.loot.LootTableSubProvider; import net.minecraft.resources.ResourceKey; import net.minecraft.world.item.Item; import net.minecraft.world.item.Items; -import net.minecraft.world.item.armortrim.ArmorTrim; -import net.minecraft.world.item.armortrim.TrimMaterial; -import net.minecraft.world.item.armortrim.TrimMaterials; -import net.minecraft.world.item.armortrim.TrimPattern; -import net.minecraft.world.item.armortrim.TrimPatterns; import net.minecraft.world.item.enchantment.Enchantment; import net.minecraft.world.item.enchantment.Enchantments; +import net.minecraft.world.item.equipment.trim.ArmorTrim; +import net.minecraft.world.item.equipment.trim.TrimMaterial; +import net.minecraft.world.item.equipment.trim.TrimMaterials; +import net.minecraft.world.item.equipment.trim.TrimPattern; +import net.minecraft.world.item.equipment.trim.TrimPatterns; import net.minecraft.world.level.storage.loot.BuiltInLootTables; import net.minecraft.world.level.storage.loot.LootPool; import net.minecraft.world.level.storage.loot.LootTable; @@ -29,19 +28,11 @@ import net.minecraft.world.level.storage.loot.providers.number.ConstantValue; public record VanillaEquipmentLoot(HolderLookup.Provider registries) implements LootTableSubProvider { @Override public void generate(BiConsumer, LootTable.Builder> biConsumer) { - HolderLookup.RegistryLookup registryLookup = (HolderLookup.RegistryLookup)this.registries - .lookup(Registries.TRIM_PATTERN) - .orElseThrow(); - HolderLookup.RegistryLookup registryLookup2 = (HolderLookup.RegistryLookup)this.registries - .lookup(Registries.TRIM_MATERIAL) - .orElseThrow(); + HolderLookup.RegistryLookup registryLookup = this.registries.lookupOrThrow(Registries.TRIM_PATTERN); + HolderLookup.RegistryLookup registryLookup2 = this.registries.lookupOrThrow(Registries.TRIM_MATERIAL); HolderLookup.RegistryLookup registryLookup3 = this.registries.lookupOrThrow(Registries.ENCHANTMENT); - ArmorTrim armorTrim = new ArmorTrim( - (Holder)registryLookup2.get(TrimMaterials.COPPER).orElseThrow(), (Holder)registryLookup.get(TrimPatterns.FLOW).orElseThrow() - ); - ArmorTrim armorTrim2 = new ArmorTrim( - (Holder)registryLookup2.get(TrimMaterials.COPPER).orElseThrow(), (Holder)registryLookup.get(TrimPatterns.BOLT).orElseThrow() - ); + ArmorTrim armorTrim = new ArmorTrim(registryLookup2.getOrThrow(TrimMaterials.COPPER), registryLookup.getOrThrow(TrimPatterns.FLOW)); + ArmorTrim armorTrim2 = new ArmorTrim(registryLookup2.getOrThrow(TrimMaterials.COPPER), registryLookup.getOrThrow(TrimPatterns.BOLT)); biConsumer.accept( BuiltInLootTables.EQUIPMENT_TRIAL_CHAMBER, LootTable.lootTable() @@ -97,20 +88,20 @@ public record VanillaEquipmentLoot(HolderLookup.Provider registries) implements ); } - public static LootTable.Builder trialChamberEquipment(Item helmet, Item chestplate, ArmorTrim trim, HolderLookup.RegistryLookup enchantments) { + public static LootTable.Builder trialChamberEquipment(Item item, Item item2, ArmorTrim armorTrim, HolderLookup.RegistryLookup registryLookup) { return LootTable.lootTable() .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .when(LootItemRandomChanceCondition.randomChance(0.5F)) .add( - LootItem.lootTableItem(helmet) - .apply(SetComponentsFunction.setComponent(DataComponents.TRIM, trim)) + LootItem.lootTableItem(item) + .apply(SetComponentsFunction.setComponent(DataComponents.TRIM, armorTrim)) .apply( new SetEnchantmentsFunction.Builder() - .withEnchantment(enchantments.getOrThrow(Enchantments.PROTECTION), ConstantValue.exactly(4.0F)) - .withEnchantment(enchantments.getOrThrow(Enchantments.PROJECTILE_PROTECTION), ConstantValue.exactly(4.0F)) - .withEnchantment(enchantments.getOrThrow(Enchantments.FIRE_PROTECTION), ConstantValue.exactly(4.0F)) + .withEnchantment(registryLookup.getOrThrow(Enchantments.PROTECTION), ConstantValue.exactly(4.0F)) + .withEnchantment(registryLookup.getOrThrow(Enchantments.PROJECTILE_PROTECTION), ConstantValue.exactly(4.0F)) + .withEnchantment(registryLookup.getOrThrow(Enchantments.FIRE_PROTECTION), ConstantValue.exactly(4.0F)) ) ) ) @@ -119,13 +110,13 @@ public record VanillaEquipmentLoot(HolderLookup.Provider registries) implements .setRolls(ConstantValue.exactly(1.0F)) .when(LootItemRandomChanceCondition.randomChance(0.5F)) .add( - LootItem.lootTableItem(chestplate) - .apply(SetComponentsFunction.setComponent(DataComponents.TRIM, trim)) + LootItem.lootTableItem(item2) + .apply(SetComponentsFunction.setComponent(DataComponents.TRIM, armorTrim)) .apply( new SetEnchantmentsFunction.Builder() - .withEnchantment(enchantments.getOrThrow(Enchantments.PROTECTION), ConstantValue.exactly(4.0F)) - .withEnchantment(enchantments.getOrThrow(Enchantments.PROJECTILE_PROTECTION), ConstantValue.exactly(4.0F)) - .withEnchantment(enchantments.getOrThrow(Enchantments.FIRE_PROTECTION), ConstantValue.exactly(4.0F)) + .withEnchantment(registryLookup.getOrThrow(Enchantments.PROTECTION), ConstantValue.exactly(4.0F)) + .withEnchantment(registryLookup.getOrThrow(Enchantments.PROJECTILE_PROTECTION), ConstantValue.exactly(4.0F)) + .withEnchantment(registryLookup.getOrThrow(Enchantments.FIRE_PROTECTION), ConstantValue.exactly(4.0F)) ) ) ); diff --git a/net/minecraft/data/loot/packs/VanillaGiftLoot.java b/net/minecraft/data/loot/packs/VanillaGiftLoot.java index e8311368..54e8ad83 100644 --- a/net/minecraft/data/loot/packs/VanillaGiftLoot.java +++ b/net/minecraft/data/loot/packs/VanillaGiftLoot.java @@ -220,6 +220,14 @@ public record VanillaGiftLoot(HolderLookup.Provider registries) implements LootT .add(LootItem.lootTableItem(Items.IRON_AXE)) ) ); + biConsumer.accept( + BuiltInLootTables.UNEMPLOYED_GIFT, + LootTable.lootTable().withPool(LootPool.lootPool().setRolls(ConstantValue.exactly(1.0F)).add(LootItem.lootTableItem(Items.WHEAT_SEEDS))) + ); + biConsumer.accept( + BuiltInLootTables.BABY_VILLAGER_GIFT, + LootTable.lootTable().withPool(LootPool.lootPool().setRolls(ConstantValue.exactly(1.0F)).add(LootItem.lootTableItem(Items.POPPY))) + ); biConsumer.accept( BuiltInLootTables.SNIFFER_DIGGING, LootTable.lootTable() @@ -240,5 +248,13 @@ public record VanillaGiftLoot(HolderLookup.Provider registries) implements LootT .add(EmptyLootItem.emptyItem().setWeight(699)) ) ); + biConsumer.accept( + BuiltInLootTables.CHICKEN_LAY, + LootTable.lootTable().withPool(LootPool.lootPool().setRolls(ConstantValue.exactly(1.0F)).add(LootItem.lootTableItem(Items.EGG))) + ); + biConsumer.accept( + BuiltInLootTables.ARMADILLO_SHED, + LootTable.lootTable().withPool(LootPool.lootPool().setRolls(ConstantValue.exactly(1.0F)).add(LootItem.lootTableItem(Items.ARMADILLO_SCUTE))) + ); } } diff --git a/net/minecraft/data/loot/packs/VanillaShearingLoot.java b/net/minecraft/data/loot/packs/VanillaShearingLoot.java index 06ea0a83..a38ffe51 100644 --- a/net/minecraft/data/loot/packs/VanillaShearingLoot.java +++ b/net/minecraft/data/loot/packs/VanillaShearingLoot.java @@ -1,16 +1,25 @@ package net.minecraft.data.loot.packs; import java.util.function.BiConsumer; +import net.minecraft.advancements.critereon.EntityPredicate; +import net.minecraft.advancements.critereon.EntitySubPredicates; import net.minecraft.core.HolderLookup; +import net.minecraft.data.loot.EntityLootSubProvider; import net.minecraft.data.loot.LootTableSubProvider; import net.minecraft.resources.ResourceKey; +import net.minecraft.world.entity.animal.MushroomCow; import net.minecraft.world.item.Items; import net.minecraft.world.level.storage.loot.BuiltInLootTables; +import net.minecraft.world.level.storage.loot.LootContext; import net.minecraft.world.level.storage.loot.LootPool; import net.minecraft.world.level.storage.loot.LootTable; +import net.minecraft.world.level.storage.loot.entries.AlternativesEntry; import net.minecraft.world.level.storage.loot.entries.LootItem; +import net.minecraft.world.level.storage.loot.entries.NestedLootTable; import net.minecraft.world.level.storage.loot.functions.SetItemCountFunction; +import net.minecraft.world.level.storage.loot.predicates.LootItemEntityPropertyCondition; import net.minecraft.world.level.storage.loot.providers.number.ConstantValue; +import net.minecraft.world.level.storage.loot.providers.number.UniformGenerator; public record VanillaShearingLoot(HolderLookup.Provider registries) implements LootTableSubProvider { @Override @@ -25,5 +34,51 @@ public record VanillaShearingLoot(HolderLookup.Provider registries) implements L .add(LootItem.lootTableItem(Items.RED_MUSHROOM).apply(SetItemCountFunction.setCount(ConstantValue.exactly(1.0F)))) ) ); + LootData.WOOL_ITEM_BY_DYE + .forEach( + (dyeColor, itemLike) -> biConsumer.accept( + (ResourceKey)BuiltInLootTables.SHEAR_SHEEP_BY_DYE.get(dyeColor), + LootTable.lootTable().withPool(LootPool.lootPool().setRolls(UniformGenerator.between(1.0F, 3.0F)).add(LootItem.lootTableItem(itemLike))) + ) + ); + biConsumer.accept( + BuiltInLootTables.SHEAR_SHEEP, LootTable.lootTable().withPool(EntityLootSubProvider.createSheepDispatchPool(BuiltInLootTables.SHEAR_SHEEP_BY_DYE)) + ); + biConsumer.accept( + BuiltInLootTables.SHEAR_MOOSHROOM, + LootTable.lootTable() + .withPool( + LootPool.lootPool() + .add( + AlternativesEntry.alternatives( + NestedLootTable.lootTableReference(BuiltInLootTables.SHEAR_RED_MOOSHROOM) + .when( + LootItemEntityPropertyCondition.hasProperties( + LootContext.EntityTarget.THIS, EntityPredicate.Builder.entity().subPredicate(EntitySubPredicates.MOOSHROOM.createPredicate(MushroomCow.Variant.RED)) + ) + ), + NestedLootTable.lootTableReference(BuiltInLootTables.SHEAR_BROWN_MOOSHROOM) + .when( + LootItemEntityPropertyCondition.hasProperties( + LootContext.EntityTarget.THIS, + EntityPredicate.Builder.entity().subPredicate(EntitySubPredicates.MOOSHROOM.createPredicate(MushroomCow.Variant.BROWN)) + ) + ) + ) + ) + ) + ); + biConsumer.accept( + BuiltInLootTables.SHEAR_RED_MOOSHROOM, + LootTable.lootTable().withPool(LootPool.lootPool().setRolls(ConstantValue.exactly(5.0F)).add(LootItem.lootTableItem(Items.RED_MUSHROOM))) + ); + biConsumer.accept( + BuiltInLootTables.SHEAR_BROWN_MOOSHROOM, + LootTable.lootTable().withPool(LootPool.lootPool().setRolls(ConstantValue.exactly(5.0F)).add(LootItem.lootTableItem(Items.BROWN_MUSHROOM))) + ); + biConsumer.accept( + BuiltInLootTables.SHEAR_SNOW_GOLEM, + LootTable.lootTable().withPool(LootPool.lootPool().setRolls(ConstantValue.exactly(1.0F)).add(LootItem.lootTableItem(Items.CARVED_PUMPKIN))) + ); } } diff --git a/net/minecraft/data/loot/packs/WinterDropBlockLoot.java b/net/minecraft/data/loot/packs/WinterDropBlockLoot.java new file mode 100644 index 00000000..e78d857e --- /dev/null +++ b/net/minecraft/data/loot/packs/WinterDropBlockLoot.java @@ -0,0 +1,40 @@ +package net.minecraft.data.loot.packs; + +import java.util.Set; +import net.minecraft.core.HolderLookup; +import net.minecraft.data.loot.BlockLootSubProvider; +import net.minecraft.world.flag.FeatureFlagSet; +import net.minecraft.world.flag.FeatureFlags; +import net.minecraft.world.level.block.Blocks; + +public class WinterDropBlockLoot extends BlockLootSubProvider { + public WinterDropBlockLoot(HolderLookup.Provider provider) { + super(Set.of(), FeatureFlagSet.of(FeatureFlags.WINTER_DROP), provider); + } + + @Override + protected void generate() { + this.dropSelf(Blocks.PALE_OAK_PLANKS); + this.dropSelf(Blocks.PALE_OAK_SAPLING); + this.dropSelf(Blocks.PALE_OAK_LOG); + this.dropSelf(Blocks.STRIPPED_PALE_OAK_LOG); + this.dropSelf(Blocks.PALE_OAK_WOOD); + this.dropSelf(Blocks.STRIPPED_PALE_OAK_WOOD); + this.dropSelf(Blocks.PALE_OAK_SIGN); + this.dropSelf(Blocks.PALE_OAK_HANGING_SIGN); + this.dropSelf(Blocks.PALE_OAK_PRESSURE_PLATE); + this.dropSelf(Blocks.PALE_OAK_TRAPDOOR); + this.dropSelf(Blocks.PALE_OAK_BUTTON); + this.dropSelf(Blocks.PALE_OAK_STAIRS); + this.dropSelf(Blocks.PALE_OAK_FENCE_GATE); + this.dropSelf(Blocks.PALE_OAK_FENCE); + this.add(Blocks.PALE_MOSS_CARPET, block -> this.createMossyCarpetBlockDrops(block)); + this.add(Blocks.PALE_HANGING_MOSS, itemLike -> this.createShearsOrSilkTouchOnlyDrop(itemLike)); + this.dropSelf(Blocks.PALE_MOSS_BLOCK); + this.dropPottedContents(Blocks.POTTED_PALE_OAK_SAPLING); + this.add(Blocks.PALE_OAK_SLAB, block -> this.createSlabItemTable(block)); + this.add(Blocks.PALE_OAK_DOOR, block -> this.createDoorTable(block)); + this.add(Blocks.PALE_OAK_LEAVES, block -> this.createLeavesDrops(block, Blocks.PALE_OAK_SAPLING, NORMAL_LEAVES_SAPLING_CHANCES)); + this.dropWhenSilkTouch(Blocks.CREAKING_HEART); + } +} diff --git a/net/minecraft/data/loot/packs/WinterDropLootTableProvider.java b/net/minecraft/data/loot/packs/WinterDropLootTableProvider.java new file mode 100644 index 00000000..89d5a520 --- /dev/null +++ b/net/minecraft/data/loot/packs/WinterDropLootTableProvider.java @@ -0,0 +1,17 @@ +package net.minecraft.data.loot.packs; + +import java.util.List; +import java.util.Set; +import java.util.concurrent.CompletableFuture; +import net.minecraft.core.HolderLookup; +import net.minecraft.data.PackOutput; +import net.minecraft.data.loot.LootTableProvider; +import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets; + +public class WinterDropLootTableProvider { + public static LootTableProvider create(PackOutput packOutput, CompletableFuture completableFuture) { + return new LootTableProvider( + packOutput, Set.of(), List.of(new LootTableProvider.SubProviderEntry(WinterDropBlockLoot::new, LootContextParamSets.BLOCK)), completableFuture + ); + } +} diff --git a/net/minecraft/data/models/BlockModelGenerators.java b/net/minecraft/data/models/BlockModelGenerators.java index 86ff7770..5ec5891d 100644 --- a/net/minecraft/data/models/BlockModelGenerators.java +++ b/net/minecraft/data/models/BlockModelGenerators.java @@ -35,6 +35,8 @@ import net.minecraft.data.models.blockstates.MultiVariantGenerator; import net.minecraft.data.models.blockstates.PropertyDispatch; import net.minecraft.data.models.blockstates.Variant; import net.minecraft.data.models.blockstates.VariantProperties; +import net.minecraft.data.models.blockstates.Condition.TerminalCondition; +import net.minecraft.data.models.blockstates.VariantProperties.Rotation; import net.minecraft.data.models.model.DelegatedModel; import net.minecraft.data.models.model.ModelLocationUtils; import net.minecraft.data.models.model.ModelTemplate; @@ -49,8 +51,12 @@ import net.minecraft.world.item.SpawnEggItem; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.CrafterBlock; +import net.minecraft.world.level.block.CreakingHeartBlock; +import net.minecraft.world.level.block.HangingMossBlock; import net.minecraft.world.level.block.LayeredCauldronBlock; import net.minecraft.world.level.block.MangrovePropaguleBlock; +import net.minecraft.world.level.block.MossyCarpetBlock; +import net.minecraft.world.level.block.MultifaceBlock; import net.minecraft.world.level.block.PitcherCropBlock; import net.minecraft.world.level.block.SnifferEggBlock; import net.minecraft.world.level.block.VaultBlock; @@ -63,6 +69,7 @@ import net.minecraft.world.level.block.state.properties.ComparatorMode; import net.minecraft.world.level.block.state.properties.DoorHingeSide; import net.minecraft.world.level.block.state.properties.DoubleBlockHalf; import net.minecraft.world.level.block.state.properties.DripstoneThickness; +import net.minecraft.world.level.block.state.properties.EnumProperty; import net.minecraft.world.level.block.state.properties.Half; import net.minecraft.world.level.block.state.properties.PistonType; import net.minecraft.world.level.block.state.properties.Property; @@ -123,57 +130,57 @@ public class BlockModelGenerators { .put(Blocks.CHISELED_TUFF_BRICKS, TexturedModel.COLUMN_WITH_WALL.get(Blocks.CHISELED_TUFF_BRICKS)) .put(Blocks.CHISELED_TUFF, TexturedModel.COLUMN_WITH_WALL.get(Blocks.CHISELED_TUFF)) .build(); - static final Map> SHAPE_CONSUMERS = ImmutableMap.>builder() - .put(BlockFamily.Variant.BUTTON, BlockModelGenerators.BlockFamilyProvider::button) - .put(BlockFamily.Variant.DOOR, BlockModelGenerators.BlockFamilyProvider::door) - .put(BlockFamily.Variant.CHISELED, BlockModelGenerators.BlockFamilyProvider::fullBlockVariant) - .put(BlockFamily.Variant.CRACKED, BlockModelGenerators.BlockFamilyProvider::fullBlockVariant) - .put(BlockFamily.Variant.CUSTOM_FENCE, BlockModelGenerators.BlockFamilyProvider::customFence) - .put(BlockFamily.Variant.FENCE, BlockModelGenerators.BlockFamilyProvider::fence) - .put(BlockFamily.Variant.CUSTOM_FENCE_GATE, BlockModelGenerators.BlockFamilyProvider::customFenceGate) - .put(BlockFamily.Variant.FENCE_GATE, BlockModelGenerators.BlockFamilyProvider::fenceGate) - .put(BlockFamily.Variant.SIGN, BlockModelGenerators.BlockFamilyProvider::sign) - .put(BlockFamily.Variant.SLAB, BlockModelGenerators.BlockFamilyProvider::slab) - .put(BlockFamily.Variant.STAIRS, BlockModelGenerators.BlockFamilyProvider::stairs) - .put(BlockFamily.Variant.PRESSURE_PLATE, BlockModelGenerators.BlockFamilyProvider::pressurePlate) - .put(BlockFamily.Variant.TRAPDOOR, BlockModelGenerators.BlockFamilyProvider::trapdoor) - .put(BlockFamily.Variant.WALL, BlockModelGenerators.BlockFamilyProvider::wall) + static final Map> SHAPE_CONSUMERS = ImmutableMap.>builder() + .put(net.minecraft.data.BlockFamily.Variant.BUTTON, BlockModelGenerators.BlockFamilyProvider::button) + .put(net.minecraft.data.BlockFamily.Variant.DOOR, BlockModelGenerators.BlockFamilyProvider::door) + .put(net.minecraft.data.BlockFamily.Variant.CHISELED, BlockModelGenerators.BlockFamilyProvider::fullBlockVariant) + .put(net.minecraft.data.BlockFamily.Variant.CRACKED, BlockModelGenerators.BlockFamilyProvider::fullBlockVariant) + .put(net.minecraft.data.BlockFamily.Variant.CUSTOM_FENCE, BlockModelGenerators.BlockFamilyProvider::customFence) + .put(net.minecraft.data.BlockFamily.Variant.FENCE, BlockModelGenerators.BlockFamilyProvider::fence) + .put(net.minecraft.data.BlockFamily.Variant.CUSTOM_FENCE_GATE, BlockModelGenerators.BlockFamilyProvider::customFenceGate) + .put(net.minecraft.data.BlockFamily.Variant.FENCE_GATE, BlockModelGenerators.BlockFamilyProvider::fenceGate) + .put(net.minecraft.data.BlockFamily.Variant.SIGN, BlockModelGenerators.BlockFamilyProvider::sign) + .put(net.minecraft.data.BlockFamily.Variant.SLAB, BlockModelGenerators.BlockFamilyProvider::slab) + .put(net.minecraft.data.BlockFamily.Variant.STAIRS, BlockModelGenerators.BlockFamilyProvider::stairs) + .put(net.minecraft.data.BlockFamily.Variant.PRESSURE_PLATE, BlockModelGenerators.BlockFamilyProvider::pressurePlate) + .put(net.minecraft.data.BlockFamily.Variant.TRAPDOOR, BlockModelGenerators.BlockFamilyProvider::trapdoor) + .put(net.minecraft.data.BlockFamily.Variant.WALL, BlockModelGenerators.BlockFamilyProvider::wall) .build(); - public static final List>> MULTIFACE_GENERATOR = List.of( - Pair.of(BlockStateProperties.NORTH, resourceLocation -> Variant.variant().with(VariantProperties.MODEL, resourceLocation)), + public static final List>> MULTIFACE_GENERATOR = List.of( + Pair.of(Direction.NORTH, resourceLocation -> Variant.variant().with(VariantProperties.MODEL, resourceLocation)), Pair.of( - BlockStateProperties.EAST, + Direction.EAST, resourceLocation -> Variant.variant() .with(VariantProperties.MODEL, resourceLocation) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90) + .with(VariantProperties.Y_ROT, Rotation.R90) .with(VariantProperties.UV_LOCK, true) ), Pair.of( - BlockStateProperties.SOUTH, + Direction.SOUTH, resourceLocation -> Variant.variant() .with(VariantProperties.MODEL, resourceLocation) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R180) + .with(VariantProperties.Y_ROT, Rotation.R180) .with(VariantProperties.UV_LOCK, true) ), Pair.of( - BlockStateProperties.WEST, + Direction.WEST, resourceLocation -> Variant.variant() .with(VariantProperties.MODEL, resourceLocation) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R270) + .with(VariantProperties.Y_ROT, Rotation.R270) .with(VariantProperties.UV_LOCK, true) ), Pair.of( - BlockStateProperties.UP, + Direction.UP, resourceLocation -> Variant.variant() .with(VariantProperties.MODEL, resourceLocation) - .with(VariantProperties.X_ROT, VariantProperties.Rotation.R270) + .with(VariantProperties.X_ROT, Rotation.R270) .with(VariantProperties.UV_LOCK, true) ), Pair.of( - BlockStateProperties.DOWN, + Direction.DOWN, resourceLocation -> Variant.variant() .with(VariantProperties.MODEL, resourceLocation) - .with(VariantProperties.X_ROT, VariantProperties.Rotation.R90) + .with(VariantProperties.X_ROT, Rotation.R90) .with(VariantProperties.UV_LOCK, true) ) ); @@ -241,36 +248,36 @@ public class BlockModelGenerators { private static PropertyDispatch createHorizontalFacingDispatch() { return PropertyDispatch.property(BlockStateProperties.HORIZONTAL_FACING) - .select(Direction.EAST, Variant.variant().with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90)) - .select(Direction.SOUTH, Variant.variant().with(VariantProperties.Y_ROT, VariantProperties.Rotation.R180)) - .select(Direction.WEST, Variant.variant().with(VariantProperties.Y_ROT, VariantProperties.Rotation.R270)) + .select(Direction.EAST, Variant.variant().with(VariantProperties.Y_ROT, Rotation.R90)) + .select(Direction.SOUTH, Variant.variant().with(VariantProperties.Y_ROT, Rotation.R180)) + .select(Direction.WEST, Variant.variant().with(VariantProperties.Y_ROT, Rotation.R270)) .select(Direction.NORTH, Variant.variant()); } private static PropertyDispatch createHorizontalFacingDispatchAlt() { return PropertyDispatch.property(BlockStateProperties.HORIZONTAL_FACING) .select(Direction.SOUTH, Variant.variant()) - .select(Direction.WEST, Variant.variant().with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90)) - .select(Direction.NORTH, Variant.variant().with(VariantProperties.Y_ROT, VariantProperties.Rotation.R180)) - .select(Direction.EAST, Variant.variant().with(VariantProperties.Y_ROT, VariantProperties.Rotation.R270)); + .select(Direction.WEST, Variant.variant().with(VariantProperties.Y_ROT, Rotation.R90)) + .select(Direction.NORTH, Variant.variant().with(VariantProperties.Y_ROT, Rotation.R180)) + .select(Direction.EAST, Variant.variant().with(VariantProperties.Y_ROT, Rotation.R270)); } private static PropertyDispatch createTorchHorizontalDispatch() { return PropertyDispatch.property(BlockStateProperties.HORIZONTAL_FACING) .select(Direction.EAST, Variant.variant()) - .select(Direction.SOUTH, Variant.variant().with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90)) - .select(Direction.WEST, Variant.variant().with(VariantProperties.Y_ROT, VariantProperties.Rotation.R180)) - .select(Direction.NORTH, Variant.variant().with(VariantProperties.Y_ROT, VariantProperties.Rotation.R270)); + .select(Direction.SOUTH, Variant.variant().with(VariantProperties.Y_ROT, Rotation.R90)) + .select(Direction.WEST, Variant.variant().with(VariantProperties.Y_ROT, Rotation.R180)) + .select(Direction.NORTH, Variant.variant().with(VariantProperties.Y_ROT, Rotation.R270)); } private static PropertyDispatch createFacingDispatch() { return PropertyDispatch.property(BlockStateProperties.FACING) - .select(Direction.DOWN, Variant.variant().with(VariantProperties.X_ROT, VariantProperties.Rotation.R90)) - .select(Direction.UP, Variant.variant().with(VariantProperties.X_ROT, VariantProperties.Rotation.R270)) + .select(Direction.DOWN, Variant.variant().with(VariantProperties.X_ROT, Rotation.R90)) + .select(Direction.UP, Variant.variant().with(VariantProperties.X_ROT, Rotation.R270)) .select(Direction.NORTH, Variant.variant()) - .select(Direction.SOUTH, Variant.variant().with(VariantProperties.Y_ROT, VariantProperties.Rotation.R180)) - .select(Direction.WEST, Variant.variant().with(VariantProperties.Y_ROT, VariantProperties.Rotation.R270)) - .select(Direction.EAST, Variant.variant().with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90)); + .select(Direction.SOUTH, Variant.variant().with(VariantProperties.Y_ROT, Rotation.R180)) + .select(Direction.WEST, Variant.variant().with(VariantProperties.Y_ROT, Rotation.R270)) + .select(Direction.EAST, Variant.variant().with(VariantProperties.Y_ROT, Rotation.R90)); } private static MultiVariantGenerator createRotatedVariant(Block block, ResourceLocation modelLocation) { @@ -280,9 +287,9 @@ public class BlockModelGenerators { private static Variant[] createRotatedVariants(ResourceLocation modelLocation) { return new Variant[]{ Variant.variant().with(VariantProperties.MODEL, modelLocation), - Variant.variant().with(VariantProperties.MODEL, modelLocation).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90), - Variant.variant().with(VariantProperties.MODEL, modelLocation).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R180), - Variant.variant().with(VariantProperties.MODEL, modelLocation).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R270) + Variant.variant().with(VariantProperties.MODEL, modelLocation).with(VariantProperties.Y_ROT, Rotation.R90), + Variant.variant().with(VariantProperties.MODEL, modelLocation).with(VariantProperties.Y_ROT, Rotation.R180), + Variant.variant().with(VariantProperties.MODEL, modelLocation).with(VariantProperties.Y_ROT, Rotation.R270) }; } @@ -291,8 +298,8 @@ public class BlockModelGenerators { block, Variant.variant().with(VariantProperties.MODEL, normalModelLocation), Variant.variant().with(VariantProperties.MODEL, mirroredModelLocation), - Variant.variant().with(VariantProperties.MODEL, normalModelLocation).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R180), - Variant.variant().with(VariantProperties.MODEL, mirroredModelLocation).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R180) + Variant.variant().with(VariantProperties.MODEL, normalModelLocation).with(VariantProperties.Y_ROT, Rotation.R180), + Variant.variant().with(VariantProperties.MODEL, mirroredModelLocation).with(VariantProperties.Y_ROT, Rotation.R180) ); } @@ -344,53 +351,30 @@ public class BlockModelGenerators { ) .with( PropertyDispatch.properties(BlockStateProperties.ATTACH_FACE, BlockStateProperties.HORIZONTAL_FACING) - .select(AttachFace.FLOOR, Direction.EAST, Variant.variant().with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90)) - .select(AttachFace.FLOOR, Direction.WEST, Variant.variant().with(VariantProperties.Y_ROT, VariantProperties.Rotation.R270)) - .select(AttachFace.FLOOR, Direction.SOUTH, Variant.variant().with(VariantProperties.Y_ROT, VariantProperties.Rotation.R180)) + .select(AttachFace.FLOOR, Direction.EAST, Variant.variant().with(VariantProperties.Y_ROT, Rotation.R90)) + .select(AttachFace.FLOOR, Direction.WEST, Variant.variant().with(VariantProperties.Y_ROT, Rotation.R270)) + .select(AttachFace.FLOOR, Direction.SOUTH, Variant.variant().with(VariantProperties.Y_ROT, Rotation.R180)) .select(AttachFace.FLOOR, Direction.NORTH, Variant.variant()) .select( AttachFace.WALL, Direction.EAST, - Variant.variant() - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90) - .with(VariantProperties.X_ROT, VariantProperties.Rotation.R90) - .with(VariantProperties.UV_LOCK, true) + Variant.variant().with(VariantProperties.Y_ROT, Rotation.R90).with(VariantProperties.X_ROT, Rotation.R90).with(VariantProperties.UV_LOCK, true) ) .select( AttachFace.WALL, Direction.WEST, - Variant.variant() - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R270) - .with(VariantProperties.X_ROT, VariantProperties.Rotation.R90) - .with(VariantProperties.UV_LOCK, true) + Variant.variant().with(VariantProperties.Y_ROT, Rotation.R270).with(VariantProperties.X_ROT, Rotation.R90).with(VariantProperties.UV_LOCK, true) ) .select( AttachFace.WALL, Direction.SOUTH, - Variant.variant() - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R180) - .with(VariantProperties.X_ROT, VariantProperties.Rotation.R90) - .with(VariantProperties.UV_LOCK, true) - ) - .select( - AttachFace.WALL, Direction.NORTH, Variant.variant().with(VariantProperties.X_ROT, VariantProperties.Rotation.R90).with(VariantProperties.UV_LOCK, true) - ) - .select( - AttachFace.CEILING, - Direction.EAST, - Variant.variant().with(VariantProperties.Y_ROT, VariantProperties.Rotation.R270).with(VariantProperties.X_ROT, VariantProperties.Rotation.R180) - ) - .select( - AttachFace.CEILING, - Direction.WEST, - Variant.variant().with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90).with(VariantProperties.X_ROT, VariantProperties.Rotation.R180) - ) - .select(AttachFace.CEILING, Direction.SOUTH, Variant.variant().with(VariantProperties.X_ROT, VariantProperties.Rotation.R180)) - .select( - AttachFace.CEILING, - Direction.NORTH, - Variant.variant().with(VariantProperties.Y_ROT, VariantProperties.Rotation.R180).with(VariantProperties.X_ROT, VariantProperties.Rotation.R180) + Variant.variant().with(VariantProperties.Y_ROT, Rotation.R180).with(VariantProperties.X_ROT, Rotation.R90).with(VariantProperties.UV_LOCK, true) ) + .select(AttachFace.WALL, Direction.NORTH, Variant.variant().with(VariantProperties.X_ROT, Rotation.R90).with(VariantProperties.UV_LOCK, true)) + .select(AttachFace.CEILING, Direction.EAST, Variant.variant().with(VariantProperties.Y_ROT, Rotation.R270).with(VariantProperties.X_ROT, Rotation.R180)) + .select(AttachFace.CEILING, Direction.WEST, Variant.variant().with(VariantProperties.Y_ROT, Rotation.R90).with(VariantProperties.X_ROT, Rotation.R180)) + .select(AttachFace.CEILING, Direction.SOUTH, Variant.variant().with(VariantProperties.X_ROT, Rotation.R180)) + .select(AttachFace.CEILING, Direction.NORTH, Variant.variant().with(VariantProperties.Y_ROT, Rotation.R180).with(VariantProperties.X_ROT, Rotation.R180)) ); } @@ -408,21 +392,21 @@ public class BlockModelGenerators { half, DoorHingeSide.LEFT, false, - Variant.variant().with(VariantProperties.MODEL, leftModelLocation).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90) + Variant.variant().with(VariantProperties.MODEL, leftModelLocation).with(VariantProperties.Y_ROT, Rotation.R90) ) .select( Direction.WEST, half, DoorHingeSide.LEFT, false, - Variant.variant().with(VariantProperties.MODEL, leftModelLocation).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R180) + Variant.variant().with(VariantProperties.MODEL, leftModelLocation).with(VariantProperties.Y_ROT, Rotation.R180) ) .select( Direction.NORTH, half, DoorHingeSide.LEFT, false, - Variant.variant().with(VariantProperties.MODEL, leftModelLocation).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R270) + Variant.variant().with(VariantProperties.MODEL, leftModelLocation).with(VariantProperties.Y_ROT, Rotation.R270) ) .select(Direction.EAST, half, DoorHingeSide.RIGHT, false, Variant.variant().with(VariantProperties.MODEL, rightModelLocation)) .select( @@ -430,42 +414,42 @@ public class BlockModelGenerators { half, DoorHingeSide.RIGHT, false, - Variant.variant().with(VariantProperties.MODEL, rightModelLocation).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90) + Variant.variant().with(VariantProperties.MODEL, rightModelLocation).with(VariantProperties.Y_ROT, Rotation.R90) ) .select( Direction.WEST, half, DoorHingeSide.RIGHT, false, - Variant.variant().with(VariantProperties.MODEL, rightModelLocation).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R180) + Variant.variant().with(VariantProperties.MODEL, rightModelLocation).with(VariantProperties.Y_ROT, Rotation.R180) ) .select( Direction.NORTH, half, DoorHingeSide.RIGHT, false, - Variant.variant().with(VariantProperties.MODEL, rightModelLocation).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R270) + Variant.variant().with(VariantProperties.MODEL, rightModelLocation).with(VariantProperties.Y_ROT, Rotation.R270) ) .select( Direction.EAST, half, DoorHingeSide.LEFT, true, - Variant.variant().with(VariantProperties.MODEL, leftOpenModelLocation).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90) + Variant.variant().with(VariantProperties.MODEL, leftOpenModelLocation).with(VariantProperties.Y_ROT, Rotation.R90) ) .select( Direction.SOUTH, half, DoorHingeSide.LEFT, true, - Variant.variant().with(VariantProperties.MODEL, leftOpenModelLocation).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R180) + Variant.variant().with(VariantProperties.MODEL, leftOpenModelLocation).with(VariantProperties.Y_ROT, Rotation.R180) ) .select( Direction.WEST, half, DoorHingeSide.LEFT, true, - Variant.variant().with(VariantProperties.MODEL, leftOpenModelLocation).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R270) + Variant.variant().with(VariantProperties.MODEL, leftOpenModelLocation).with(VariantProperties.Y_ROT, Rotation.R270) ) .select(Direction.NORTH, half, DoorHingeSide.LEFT, true, Variant.variant().with(VariantProperties.MODEL, leftOpenModelLocation)) .select( @@ -473,7 +457,7 @@ public class BlockModelGenerators { half, DoorHingeSide.RIGHT, true, - Variant.variant().with(VariantProperties.MODEL, rightOpenModelLocation).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R270) + Variant.variant().with(VariantProperties.MODEL, rightOpenModelLocation).with(VariantProperties.Y_ROT, Rotation.R270) ) .select(Direction.SOUTH, half, DoorHingeSide.RIGHT, true, Variant.variant().with(VariantProperties.MODEL, rightOpenModelLocation)) .select( @@ -481,14 +465,14 @@ public class BlockModelGenerators { half, DoorHingeSide.RIGHT, true, - Variant.variant().with(VariantProperties.MODEL, rightOpenModelLocation).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90) + Variant.variant().with(VariantProperties.MODEL, rightOpenModelLocation).with(VariantProperties.Y_ROT, Rotation.R90) ) .select( Direction.NORTH, half, DoorHingeSide.RIGHT, true, - Variant.variant().with(VariantProperties.MODEL, rightOpenModelLocation).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R180) + Variant.variant().with(VariantProperties.MODEL, rightOpenModelLocation).with(VariantProperties.Y_ROT, Rotation.R180) ); } @@ -562,24 +546,15 @@ public class BlockModelGenerators { ) .with( Condition.condition().term(BlockStateProperties.EAST, true), - Variant.variant() - .with(VariantProperties.MODEL, fenceSideModelLocation) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90) - .with(VariantProperties.UV_LOCK, true) + Variant.variant().with(VariantProperties.MODEL, fenceSideModelLocation).with(VariantProperties.Y_ROT, Rotation.R90).with(VariantProperties.UV_LOCK, true) ) .with( Condition.condition().term(BlockStateProperties.SOUTH, true), - Variant.variant() - .with(VariantProperties.MODEL, fenceSideModelLocation) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R180) - .with(VariantProperties.UV_LOCK, true) + Variant.variant().with(VariantProperties.MODEL, fenceSideModelLocation).with(VariantProperties.Y_ROT, Rotation.R180).with(VariantProperties.UV_LOCK, true) ) .with( Condition.condition().term(BlockStateProperties.WEST, true), - Variant.variant() - .with(VariantProperties.MODEL, fenceSideModelLocation) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R270) - .with(VariantProperties.UV_LOCK, true) + Variant.variant().with(VariantProperties.MODEL, fenceSideModelLocation).with(VariantProperties.Y_ROT, Rotation.R270).with(VariantProperties.UV_LOCK, true) ); } @@ -594,24 +569,15 @@ public class BlockModelGenerators { ) .with( Condition.condition().term(BlockStateProperties.EAST_WALL, WallSide.LOW), - Variant.variant() - .with(VariantProperties.MODEL, lowSideModelLocation) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90) - .with(VariantProperties.UV_LOCK, true) + Variant.variant().with(VariantProperties.MODEL, lowSideModelLocation).with(VariantProperties.Y_ROT, Rotation.R90).with(VariantProperties.UV_LOCK, true) ) .with( Condition.condition().term(BlockStateProperties.SOUTH_WALL, WallSide.LOW), - Variant.variant() - .with(VariantProperties.MODEL, lowSideModelLocation) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R180) - .with(VariantProperties.UV_LOCK, true) + Variant.variant().with(VariantProperties.MODEL, lowSideModelLocation).with(VariantProperties.Y_ROT, Rotation.R180).with(VariantProperties.UV_LOCK, true) ) .with( Condition.condition().term(BlockStateProperties.WEST_WALL, WallSide.LOW), - Variant.variant() - .with(VariantProperties.MODEL, lowSideModelLocation) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R270) - .with(VariantProperties.UV_LOCK, true) + Variant.variant().with(VariantProperties.MODEL, lowSideModelLocation).with(VariantProperties.Y_ROT, Rotation.R270).with(VariantProperties.UV_LOCK, true) ) .with( Condition.condition().term(BlockStateProperties.NORTH_WALL, WallSide.TALL), @@ -619,24 +585,15 @@ public class BlockModelGenerators { ) .with( Condition.condition().term(BlockStateProperties.EAST_WALL, WallSide.TALL), - Variant.variant() - .with(VariantProperties.MODEL, tallSideModelLocation) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90) - .with(VariantProperties.UV_LOCK, true) + Variant.variant().with(VariantProperties.MODEL, tallSideModelLocation).with(VariantProperties.Y_ROT, Rotation.R90).with(VariantProperties.UV_LOCK, true) ) .with( Condition.condition().term(BlockStateProperties.SOUTH_WALL, WallSide.TALL), - Variant.variant() - .with(VariantProperties.MODEL, tallSideModelLocation) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R180) - .with(VariantProperties.UV_LOCK, true) + Variant.variant().with(VariantProperties.MODEL, tallSideModelLocation).with(VariantProperties.Y_ROT, Rotation.R180).with(VariantProperties.UV_LOCK, true) ) .with( Condition.condition().term(BlockStateProperties.WEST_WALL, WallSide.TALL), - Variant.variant() - .with(VariantProperties.MODEL, tallSideModelLocation) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R270) - .with(VariantProperties.UV_LOCK, true) + Variant.variant().with(VariantProperties.MODEL, tallSideModelLocation).with(VariantProperties.Y_ROT, Rotation.R270).with(VariantProperties.UV_LOCK, true) ); } @@ -670,149 +627,101 @@ public class BlockModelGenerators { Direction.WEST, Half.BOTTOM, StairsShape.STRAIGHT, - Variant.variant() - .with(VariantProperties.MODEL, straightModelLocation) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R180) - .with(VariantProperties.UV_LOCK, true) + Variant.variant().with(VariantProperties.MODEL, straightModelLocation).with(VariantProperties.Y_ROT, Rotation.R180).with(VariantProperties.UV_LOCK, true) ) .select( Direction.SOUTH, Half.BOTTOM, StairsShape.STRAIGHT, - Variant.variant() - .with(VariantProperties.MODEL, straightModelLocation) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90) - .with(VariantProperties.UV_LOCK, true) + Variant.variant().with(VariantProperties.MODEL, straightModelLocation).with(VariantProperties.Y_ROT, Rotation.R90).with(VariantProperties.UV_LOCK, true) ) .select( Direction.NORTH, Half.BOTTOM, StairsShape.STRAIGHT, - Variant.variant() - .with(VariantProperties.MODEL, straightModelLocation) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R270) - .with(VariantProperties.UV_LOCK, true) + Variant.variant().with(VariantProperties.MODEL, straightModelLocation).with(VariantProperties.Y_ROT, Rotation.R270).with(VariantProperties.UV_LOCK, true) ) .select(Direction.EAST, Half.BOTTOM, StairsShape.OUTER_RIGHT, Variant.variant().with(VariantProperties.MODEL, outerModelLocation)) .select( Direction.WEST, Half.BOTTOM, StairsShape.OUTER_RIGHT, - Variant.variant() - .with(VariantProperties.MODEL, outerModelLocation) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R180) - .with(VariantProperties.UV_LOCK, true) + Variant.variant().with(VariantProperties.MODEL, outerModelLocation).with(VariantProperties.Y_ROT, Rotation.R180).with(VariantProperties.UV_LOCK, true) ) .select( Direction.SOUTH, Half.BOTTOM, StairsShape.OUTER_RIGHT, - Variant.variant() - .with(VariantProperties.MODEL, outerModelLocation) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90) - .with(VariantProperties.UV_LOCK, true) + Variant.variant().with(VariantProperties.MODEL, outerModelLocation).with(VariantProperties.Y_ROT, Rotation.R90).with(VariantProperties.UV_LOCK, true) ) .select( Direction.NORTH, Half.BOTTOM, StairsShape.OUTER_RIGHT, - Variant.variant() - .with(VariantProperties.MODEL, outerModelLocation) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R270) - .with(VariantProperties.UV_LOCK, true) + Variant.variant().with(VariantProperties.MODEL, outerModelLocation).with(VariantProperties.Y_ROT, Rotation.R270).with(VariantProperties.UV_LOCK, true) ) .select( Direction.EAST, Half.BOTTOM, StairsShape.OUTER_LEFT, - Variant.variant() - .with(VariantProperties.MODEL, outerModelLocation) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R270) - .with(VariantProperties.UV_LOCK, true) + Variant.variant().with(VariantProperties.MODEL, outerModelLocation).with(VariantProperties.Y_ROT, Rotation.R270).with(VariantProperties.UV_LOCK, true) ) .select( Direction.WEST, Half.BOTTOM, StairsShape.OUTER_LEFT, - Variant.variant() - .with(VariantProperties.MODEL, outerModelLocation) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90) - .with(VariantProperties.UV_LOCK, true) + Variant.variant().with(VariantProperties.MODEL, outerModelLocation).with(VariantProperties.Y_ROT, Rotation.R90).with(VariantProperties.UV_LOCK, true) ) .select(Direction.SOUTH, Half.BOTTOM, StairsShape.OUTER_LEFT, Variant.variant().with(VariantProperties.MODEL, outerModelLocation)) .select( Direction.NORTH, Half.BOTTOM, StairsShape.OUTER_LEFT, - Variant.variant() - .with(VariantProperties.MODEL, outerModelLocation) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R180) - .with(VariantProperties.UV_LOCK, true) + Variant.variant().with(VariantProperties.MODEL, outerModelLocation).with(VariantProperties.Y_ROT, Rotation.R180).with(VariantProperties.UV_LOCK, true) ) .select(Direction.EAST, Half.BOTTOM, StairsShape.INNER_RIGHT, Variant.variant().with(VariantProperties.MODEL, innerModelLocation)) .select( Direction.WEST, Half.BOTTOM, StairsShape.INNER_RIGHT, - Variant.variant() - .with(VariantProperties.MODEL, innerModelLocation) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R180) - .with(VariantProperties.UV_LOCK, true) + Variant.variant().with(VariantProperties.MODEL, innerModelLocation).with(VariantProperties.Y_ROT, Rotation.R180).with(VariantProperties.UV_LOCK, true) ) .select( Direction.SOUTH, Half.BOTTOM, StairsShape.INNER_RIGHT, - Variant.variant() - .with(VariantProperties.MODEL, innerModelLocation) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90) - .with(VariantProperties.UV_LOCK, true) + Variant.variant().with(VariantProperties.MODEL, innerModelLocation).with(VariantProperties.Y_ROT, Rotation.R90).with(VariantProperties.UV_LOCK, true) ) .select( Direction.NORTH, Half.BOTTOM, StairsShape.INNER_RIGHT, - Variant.variant() - .with(VariantProperties.MODEL, innerModelLocation) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R270) - .with(VariantProperties.UV_LOCK, true) + Variant.variant().with(VariantProperties.MODEL, innerModelLocation).with(VariantProperties.Y_ROT, Rotation.R270).with(VariantProperties.UV_LOCK, true) ) .select( Direction.EAST, Half.BOTTOM, StairsShape.INNER_LEFT, - Variant.variant() - .with(VariantProperties.MODEL, innerModelLocation) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R270) - .with(VariantProperties.UV_LOCK, true) + Variant.variant().with(VariantProperties.MODEL, innerModelLocation).with(VariantProperties.Y_ROT, Rotation.R270).with(VariantProperties.UV_LOCK, true) ) .select( Direction.WEST, Half.BOTTOM, StairsShape.INNER_LEFT, - Variant.variant() - .with(VariantProperties.MODEL, innerModelLocation) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90) - .with(VariantProperties.UV_LOCK, true) + Variant.variant().with(VariantProperties.MODEL, innerModelLocation).with(VariantProperties.Y_ROT, Rotation.R90).with(VariantProperties.UV_LOCK, true) ) .select(Direction.SOUTH, Half.BOTTOM, StairsShape.INNER_LEFT, Variant.variant().with(VariantProperties.MODEL, innerModelLocation)) .select( Direction.NORTH, Half.BOTTOM, StairsShape.INNER_LEFT, - Variant.variant() - .with(VariantProperties.MODEL, innerModelLocation) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R180) - .with(VariantProperties.UV_LOCK, true) + Variant.variant().with(VariantProperties.MODEL, innerModelLocation).with(VariantProperties.Y_ROT, Rotation.R180).with(VariantProperties.UV_LOCK, true) ) .select( Direction.EAST, Half.TOP, StairsShape.STRAIGHT, - Variant.variant() - .with(VariantProperties.MODEL, straightModelLocation) - .with(VariantProperties.X_ROT, VariantProperties.Rotation.R180) - .with(VariantProperties.UV_LOCK, true) + Variant.variant().with(VariantProperties.MODEL, straightModelLocation).with(VariantProperties.X_ROT, Rotation.R180).with(VariantProperties.UV_LOCK, true) ) .select( Direction.WEST, @@ -820,8 +729,8 @@ public class BlockModelGenerators { StairsShape.STRAIGHT, Variant.variant() .with(VariantProperties.MODEL, straightModelLocation) - .with(VariantProperties.X_ROT, VariantProperties.Rotation.R180) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R180) + .with(VariantProperties.X_ROT, Rotation.R180) + .with(VariantProperties.Y_ROT, Rotation.R180) .with(VariantProperties.UV_LOCK, true) ) .select( @@ -830,8 +739,8 @@ public class BlockModelGenerators { StairsShape.STRAIGHT, Variant.variant() .with(VariantProperties.MODEL, straightModelLocation) - .with(VariantProperties.X_ROT, VariantProperties.Rotation.R180) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90) + .with(VariantProperties.X_ROT, Rotation.R180) + .with(VariantProperties.Y_ROT, Rotation.R90) .with(VariantProperties.UV_LOCK, true) ) .select( @@ -840,8 +749,8 @@ public class BlockModelGenerators { StairsShape.STRAIGHT, Variant.variant() .with(VariantProperties.MODEL, straightModelLocation) - .with(VariantProperties.X_ROT, VariantProperties.Rotation.R180) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R270) + .with(VariantProperties.X_ROT, Rotation.R180) + .with(VariantProperties.Y_ROT, Rotation.R270) .with(VariantProperties.UV_LOCK, true) ) .select( @@ -850,8 +759,8 @@ public class BlockModelGenerators { StairsShape.OUTER_RIGHT, Variant.variant() .with(VariantProperties.MODEL, outerModelLocation) - .with(VariantProperties.X_ROT, VariantProperties.Rotation.R180) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90) + .with(VariantProperties.X_ROT, Rotation.R180) + .with(VariantProperties.Y_ROT, Rotation.R90) .with(VariantProperties.UV_LOCK, true) ) .select( @@ -860,8 +769,8 @@ public class BlockModelGenerators { StairsShape.OUTER_RIGHT, Variant.variant() .with(VariantProperties.MODEL, outerModelLocation) - .with(VariantProperties.X_ROT, VariantProperties.Rotation.R180) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R270) + .with(VariantProperties.X_ROT, Rotation.R180) + .with(VariantProperties.Y_ROT, Rotation.R270) .with(VariantProperties.UV_LOCK, true) ) .select( @@ -870,27 +779,21 @@ public class BlockModelGenerators { StairsShape.OUTER_RIGHT, Variant.variant() .with(VariantProperties.MODEL, outerModelLocation) - .with(VariantProperties.X_ROT, VariantProperties.Rotation.R180) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R180) + .with(VariantProperties.X_ROT, Rotation.R180) + .with(VariantProperties.Y_ROT, Rotation.R180) .with(VariantProperties.UV_LOCK, true) ) .select( Direction.NORTH, Half.TOP, StairsShape.OUTER_RIGHT, - Variant.variant() - .with(VariantProperties.MODEL, outerModelLocation) - .with(VariantProperties.X_ROT, VariantProperties.Rotation.R180) - .with(VariantProperties.UV_LOCK, true) + Variant.variant().with(VariantProperties.MODEL, outerModelLocation).with(VariantProperties.X_ROT, Rotation.R180).with(VariantProperties.UV_LOCK, true) ) .select( Direction.EAST, Half.TOP, StairsShape.OUTER_LEFT, - Variant.variant() - .with(VariantProperties.MODEL, outerModelLocation) - .with(VariantProperties.X_ROT, VariantProperties.Rotation.R180) - .with(VariantProperties.UV_LOCK, true) + Variant.variant().with(VariantProperties.MODEL, outerModelLocation).with(VariantProperties.X_ROT, Rotation.R180).with(VariantProperties.UV_LOCK, true) ) .select( Direction.WEST, @@ -898,8 +801,8 @@ public class BlockModelGenerators { StairsShape.OUTER_LEFT, Variant.variant() .with(VariantProperties.MODEL, outerModelLocation) - .with(VariantProperties.X_ROT, VariantProperties.Rotation.R180) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R180) + .with(VariantProperties.X_ROT, Rotation.R180) + .with(VariantProperties.Y_ROT, Rotation.R180) .with(VariantProperties.UV_LOCK, true) ) .select( @@ -908,8 +811,8 @@ public class BlockModelGenerators { StairsShape.OUTER_LEFT, Variant.variant() .with(VariantProperties.MODEL, outerModelLocation) - .with(VariantProperties.X_ROT, VariantProperties.Rotation.R180) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90) + .with(VariantProperties.X_ROT, Rotation.R180) + .with(VariantProperties.Y_ROT, Rotation.R90) .with(VariantProperties.UV_LOCK, true) ) .select( @@ -918,8 +821,8 @@ public class BlockModelGenerators { StairsShape.OUTER_LEFT, Variant.variant() .with(VariantProperties.MODEL, outerModelLocation) - .with(VariantProperties.X_ROT, VariantProperties.Rotation.R180) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R270) + .with(VariantProperties.X_ROT, Rotation.R180) + .with(VariantProperties.Y_ROT, Rotation.R270) .with(VariantProperties.UV_LOCK, true) ) .select( @@ -928,8 +831,8 @@ public class BlockModelGenerators { StairsShape.INNER_RIGHT, Variant.variant() .with(VariantProperties.MODEL, innerModelLocation) - .with(VariantProperties.X_ROT, VariantProperties.Rotation.R180) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90) + .with(VariantProperties.X_ROT, Rotation.R180) + .with(VariantProperties.Y_ROT, Rotation.R90) .with(VariantProperties.UV_LOCK, true) ) .select( @@ -938,8 +841,8 @@ public class BlockModelGenerators { StairsShape.INNER_RIGHT, Variant.variant() .with(VariantProperties.MODEL, innerModelLocation) - .with(VariantProperties.X_ROT, VariantProperties.Rotation.R180) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R270) + .with(VariantProperties.X_ROT, Rotation.R180) + .with(VariantProperties.Y_ROT, Rotation.R270) .with(VariantProperties.UV_LOCK, true) ) .select( @@ -948,27 +851,21 @@ public class BlockModelGenerators { StairsShape.INNER_RIGHT, Variant.variant() .with(VariantProperties.MODEL, innerModelLocation) - .with(VariantProperties.X_ROT, VariantProperties.Rotation.R180) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R180) + .with(VariantProperties.X_ROT, Rotation.R180) + .with(VariantProperties.Y_ROT, Rotation.R180) .with(VariantProperties.UV_LOCK, true) ) .select( Direction.NORTH, Half.TOP, StairsShape.INNER_RIGHT, - Variant.variant() - .with(VariantProperties.MODEL, innerModelLocation) - .with(VariantProperties.X_ROT, VariantProperties.Rotation.R180) - .with(VariantProperties.UV_LOCK, true) + Variant.variant().with(VariantProperties.MODEL, innerModelLocation).with(VariantProperties.X_ROT, Rotation.R180).with(VariantProperties.UV_LOCK, true) ) .select( Direction.EAST, Half.TOP, StairsShape.INNER_LEFT, - Variant.variant() - .with(VariantProperties.MODEL, innerModelLocation) - .with(VariantProperties.X_ROT, VariantProperties.Rotation.R180) - .with(VariantProperties.UV_LOCK, true) + Variant.variant().with(VariantProperties.MODEL, innerModelLocation).with(VariantProperties.X_ROT, Rotation.R180).with(VariantProperties.UV_LOCK, true) ) .select( Direction.WEST, @@ -976,8 +873,8 @@ public class BlockModelGenerators { StairsShape.INNER_LEFT, Variant.variant() .with(VariantProperties.MODEL, innerModelLocation) - .with(VariantProperties.X_ROT, VariantProperties.Rotation.R180) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R180) + .with(VariantProperties.X_ROT, Rotation.R180) + .with(VariantProperties.Y_ROT, Rotation.R180) .with(VariantProperties.UV_LOCK, true) ) .select( @@ -986,8 +883,8 @@ public class BlockModelGenerators { StairsShape.INNER_LEFT, Variant.variant() .with(VariantProperties.MODEL, innerModelLocation) - .with(VariantProperties.X_ROT, VariantProperties.Rotation.R180) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90) + .with(VariantProperties.X_ROT, Rotation.R180) + .with(VariantProperties.Y_ROT, Rotation.R90) .with(VariantProperties.UV_LOCK, true) ) .select( @@ -996,8 +893,8 @@ public class BlockModelGenerators { StairsShape.INNER_LEFT, Variant.variant() .with(VariantProperties.MODEL, innerModelLocation) - .with(VariantProperties.X_ROT, VariantProperties.Rotation.R180) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R270) + .with(VariantProperties.X_ROT, Rotation.R180) + .with(VariantProperties.Y_ROT, Rotation.R270) .with(VariantProperties.UV_LOCK, true) ) ); @@ -1011,69 +908,32 @@ public class BlockModelGenerators { PropertyDispatch.properties(BlockStateProperties.HORIZONTAL_FACING, BlockStateProperties.HALF, BlockStateProperties.OPEN) .select(Direction.NORTH, Half.BOTTOM, false, Variant.variant().with(VariantProperties.MODEL, bottomModelLocation)) .select( - Direction.SOUTH, - Half.BOTTOM, - false, - Variant.variant().with(VariantProperties.MODEL, bottomModelLocation).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R180) + Direction.SOUTH, Half.BOTTOM, false, Variant.variant().with(VariantProperties.MODEL, bottomModelLocation).with(VariantProperties.Y_ROT, Rotation.R180) ) .select( - Direction.EAST, - Half.BOTTOM, - false, - Variant.variant().with(VariantProperties.MODEL, bottomModelLocation).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90) + Direction.EAST, Half.BOTTOM, false, Variant.variant().with(VariantProperties.MODEL, bottomModelLocation).with(VariantProperties.Y_ROT, Rotation.R90) ) .select( - Direction.WEST, - Half.BOTTOM, - false, - Variant.variant().with(VariantProperties.MODEL, bottomModelLocation).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R270) + Direction.WEST, Half.BOTTOM, false, Variant.variant().with(VariantProperties.MODEL, bottomModelLocation).with(VariantProperties.Y_ROT, Rotation.R270) ) .select(Direction.NORTH, Half.TOP, false, Variant.variant().with(VariantProperties.MODEL, topModelLocation)) - .select( - Direction.SOUTH, - Half.TOP, - false, - Variant.variant().with(VariantProperties.MODEL, topModelLocation).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R180) - ) - .select( - Direction.EAST, - Half.TOP, - false, - Variant.variant().with(VariantProperties.MODEL, topModelLocation).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90) - ) - .select( - Direction.WEST, - Half.TOP, - false, - Variant.variant().with(VariantProperties.MODEL, topModelLocation).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R270) - ) + .select(Direction.SOUTH, Half.TOP, false, Variant.variant().with(VariantProperties.MODEL, topModelLocation).with(VariantProperties.Y_ROT, Rotation.R180)) + .select(Direction.EAST, Half.TOP, false, Variant.variant().with(VariantProperties.MODEL, topModelLocation).with(VariantProperties.Y_ROT, Rotation.R90)) + .select(Direction.WEST, Half.TOP, false, Variant.variant().with(VariantProperties.MODEL, topModelLocation).with(VariantProperties.Y_ROT, Rotation.R270)) .select(Direction.NORTH, Half.BOTTOM, true, Variant.variant().with(VariantProperties.MODEL, openModelLocation)) .select( - Direction.SOUTH, - Half.BOTTOM, - true, - Variant.variant().with(VariantProperties.MODEL, openModelLocation).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R180) - ) - .select( - Direction.EAST, - Half.BOTTOM, - true, - Variant.variant().with(VariantProperties.MODEL, openModelLocation).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90) - ) - .select( - Direction.WEST, - Half.BOTTOM, - true, - Variant.variant().with(VariantProperties.MODEL, openModelLocation).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R270) + Direction.SOUTH, Half.BOTTOM, true, Variant.variant().with(VariantProperties.MODEL, openModelLocation).with(VariantProperties.Y_ROT, Rotation.R180) ) + .select(Direction.EAST, Half.BOTTOM, true, Variant.variant().with(VariantProperties.MODEL, openModelLocation).with(VariantProperties.Y_ROT, Rotation.R90)) + .select(Direction.WEST, Half.BOTTOM, true, Variant.variant().with(VariantProperties.MODEL, openModelLocation).with(VariantProperties.Y_ROT, Rotation.R270)) .select( Direction.NORTH, Half.TOP, true, Variant.variant() .with(VariantProperties.MODEL, openModelLocation) - .with(VariantProperties.X_ROT, VariantProperties.Rotation.R180) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R180) + .with(VariantProperties.X_ROT, Rotation.R180) + .with(VariantProperties.Y_ROT, Rotation.R180) ) .select( Direction.SOUTH, @@ -1081,8 +941,8 @@ public class BlockModelGenerators { true, Variant.variant() .with(VariantProperties.MODEL, openModelLocation) - .with(VariantProperties.X_ROT, VariantProperties.Rotation.R180) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R0) + .with(VariantProperties.X_ROT, Rotation.R180) + .with(VariantProperties.Y_ROT, Rotation.R0) ) .select( Direction.EAST, @@ -1090,8 +950,8 @@ public class BlockModelGenerators { true, Variant.variant() .with(VariantProperties.MODEL, openModelLocation) - .with(VariantProperties.X_ROT, VariantProperties.Rotation.R180) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R270) + .with(VariantProperties.X_ROT, Rotation.R180) + .with(VariantProperties.Y_ROT, Rotation.R270) ) .select( Direction.WEST, @@ -1099,8 +959,8 @@ public class BlockModelGenerators { true, Variant.variant() .with(VariantProperties.MODEL, openModelLocation) - .with(VariantProperties.X_ROT, VariantProperties.Rotation.R180) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90) + .with(VariantProperties.X_ROT, Rotation.R180) + .with(VariantProperties.Y_ROT, Rotation.R90) ) ); } @@ -1121,42 +981,14 @@ public class BlockModelGenerators { .select(Direction.WEST, Half.TOP, false, Variant.variant().with(VariantProperties.MODEL, topModelLocation)) .select(Direction.NORTH, Half.BOTTOM, true, Variant.variant().with(VariantProperties.MODEL, openModelLocation)) .select( - Direction.SOUTH, - Half.BOTTOM, - true, - Variant.variant().with(VariantProperties.MODEL, openModelLocation).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R180) - ) - .select( - Direction.EAST, - Half.BOTTOM, - true, - Variant.variant().with(VariantProperties.MODEL, openModelLocation).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90) - ) - .select( - Direction.WEST, - Half.BOTTOM, - true, - Variant.variant().with(VariantProperties.MODEL, openModelLocation).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R270) + Direction.SOUTH, Half.BOTTOM, true, Variant.variant().with(VariantProperties.MODEL, openModelLocation).with(VariantProperties.Y_ROT, Rotation.R180) ) + .select(Direction.EAST, Half.BOTTOM, true, Variant.variant().with(VariantProperties.MODEL, openModelLocation).with(VariantProperties.Y_ROT, Rotation.R90)) + .select(Direction.WEST, Half.BOTTOM, true, Variant.variant().with(VariantProperties.MODEL, openModelLocation).with(VariantProperties.Y_ROT, Rotation.R270)) .select(Direction.NORTH, Half.TOP, true, Variant.variant().with(VariantProperties.MODEL, openModelLocation)) - .select( - Direction.SOUTH, - Half.TOP, - true, - Variant.variant().with(VariantProperties.MODEL, openModelLocation).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R180) - ) - .select( - Direction.EAST, - Half.TOP, - true, - Variant.variant().with(VariantProperties.MODEL, openModelLocation).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90) - ) - .select( - Direction.WEST, - Half.TOP, - true, - Variant.variant().with(VariantProperties.MODEL, openModelLocation).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R270) - ) + .select(Direction.SOUTH, Half.TOP, true, Variant.variant().with(VariantProperties.MODEL, openModelLocation).with(VariantProperties.Y_ROT, Rotation.R180)) + .select(Direction.EAST, Half.TOP, true, Variant.variant().with(VariantProperties.MODEL, openModelLocation).with(VariantProperties.Y_ROT, Rotation.R90)) + .select(Direction.WEST, Half.TOP, true, Variant.variant().with(VariantProperties.MODEL, openModelLocation).with(VariantProperties.Y_ROT, Rotation.R270)) ); } @@ -1167,11 +999,8 @@ public class BlockModelGenerators { private static PropertyDispatch createRotatedPillar() { return PropertyDispatch.property(BlockStateProperties.AXIS) .select(Direction.Axis.Y, Variant.variant()) - .select(Direction.Axis.Z, Variant.variant().with(VariantProperties.X_ROT, VariantProperties.Rotation.R90)) - .select( - Direction.Axis.X, - Variant.variant().with(VariantProperties.X_ROT, VariantProperties.Rotation.R90).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90) - ); + .select(Direction.Axis.Z, Variant.variant().with(VariantProperties.X_ROT, Rotation.R90)) + .select(Direction.Axis.X, Variant.variant().with(VariantProperties.X_ROT, Rotation.R90).with(VariantProperties.Y_ROT, Rotation.R90)); } static BlockStateGenerator createPillarBlockUVLocked( @@ -1219,15 +1048,13 @@ public class BlockModelGenerators { .with( PropertyDispatch.property(BlockStateProperties.AXIS) .select(Direction.Axis.Y, Variant.variant().with(VariantProperties.MODEL, modelLocation)) - .select( - Direction.Axis.Z, Variant.variant().with(VariantProperties.MODEL, horizontalModelLocation).with(VariantProperties.X_ROT, VariantProperties.Rotation.R90) - ) + .select(Direction.Axis.Z, Variant.variant().with(VariantProperties.MODEL, horizontalModelLocation).with(VariantProperties.X_ROT, Rotation.R90)) .select( Direction.Axis.X, Variant.variant() .with(VariantProperties.MODEL, horizontalModelLocation) - .with(VariantProperties.X_ROT, VariantProperties.Rotation.R90) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90) + .with(VariantProperties.X_ROT, Rotation.R90) + .with(VariantProperties.Y_ROT, Rotation.R90) ) ); } @@ -1240,6 +1067,67 @@ public class BlockModelGenerators { this.blockStateOutput.accept(createRotatedPillarWithHorizontalVariant(rotatedPillarBlock, resourceLocation, resourceLocation2)); } + private void createCreakingHeart(Block block) { + Function function = provider -> provider.updateTexture( + textureMapping -> textureMapping.put(TextureSlot.SIDE, TextureMapping.getBlockTexture(block, "_active")) + ) + .updateTexture(textureMapping -> textureMapping.put(TextureSlot.END, TextureMapping.getBlockTexture(block, "_top_active"))) + .createWithSuffix(block, "_active", this.modelOutput); + ResourceLocation resourceLocation = TexturedModel.COLUMN_ALT.create(block, this.modelOutput); + ResourceLocation resourceLocation2 = TexturedModel.COLUMN_HORIZONTAL_ALT.create(block, this.modelOutput); + ResourceLocation resourceLocation3 = (ResourceLocation)function.apply(TexturedModel.COLUMN_ALT); + ResourceLocation resourceLocation4 = (ResourceLocation)function.apply(TexturedModel.COLUMN_HORIZONTAL_ALT); + this.blockStateOutput + .accept( + MultiVariantGenerator.multiVariant(block) + .with( + PropertyDispatch.properties(BlockStateProperties.AXIS, CreakingHeartBlock.CREAKING) + .select(Direction.Axis.Y, CreakingHeartBlock.CreakingHeartState.DISABLED, Variant.variant().with(VariantProperties.MODEL, resourceLocation)) + .select( + Direction.Axis.Z, + CreakingHeartBlock.CreakingHeartState.DISABLED, + Variant.variant().with(VariantProperties.MODEL, resourceLocation2).with(VariantProperties.X_ROT, Rotation.R90) + ) + .select( + Direction.Axis.X, + CreakingHeartBlock.CreakingHeartState.DISABLED, + Variant.variant() + .with(VariantProperties.MODEL, resourceLocation2) + .with(VariantProperties.X_ROT, Rotation.R90) + .with(VariantProperties.Y_ROT, Rotation.R90) + ) + .select(Direction.Axis.Y, CreakingHeartBlock.CreakingHeartState.DORMANT, Variant.variant().with(VariantProperties.MODEL, resourceLocation3)) + .select( + Direction.Axis.Z, + CreakingHeartBlock.CreakingHeartState.DORMANT, + Variant.variant().with(VariantProperties.MODEL, resourceLocation4).with(VariantProperties.X_ROT, Rotation.R90) + ) + .select( + Direction.Axis.X, + CreakingHeartBlock.CreakingHeartState.DORMANT, + Variant.variant() + .with(VariantProperties.MODEL, resourceLocation4) + .with(VariantProperties.X_ROT, Rotation.R90) + .with(VariantProperties.Y_ROT, Rotation.R90) + ) + .select(Direction.Axis.Y, CreakingHeartBlock.CreakingHeartState.ACTIVE, Variant.variant().with(VariantProperties.MODEL, resourceLocation3)) + .select( + Direction.Axis.Z, + CreakingHeartBlock.CreakingHeartState.ACTIVE, + Variant.variant().with(VariantProperties.MODEL, resourceLocation4).with(VariantProperties.X_ROT, Rotation.R90) + ) + .select( + Direction.Axis.X, + CreakingHeartBlock.CreakingHeartState.ACTIVE, + Variant.variant() + .with(VariantProperties.MODEL, resourceLocation4) + .with(VariantProperties.X_ROT, Rotation.R90) + .with(VariantProperties.Y_ROT, Rotation.R90) + ) + ) + ); + } + private ResourceLocation createSuffixedVariant( Block block, String suffix, ModelTemplate modelTemplate, Function textureMappingGetter ) { @@ -1468,9 +1356,9 @@ public class BlockModelGenerators { .with( PropertyDispatch.property(BlockStateProperties.HORIZONTAL_FACING) .select(Direction.WEST, Variant.variant()) - .select(Direction.SOUTH, Variant.variant().with(VariantProperties.Y_ROT, VariantProperties.Rotation.R270)) - .select(Direction.NORTH, Variant.variant().with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90)) - .select(Direction.EAST, Variant.variant().with(VariantProperties.Y_ROT, VariantProperties.Rotation.R180)) + .select(Direction.SOUTH, Variant.variant().with(VariantProperties.Y_ROT, Rotation.R270)) + .select(Direction.NORTH, Variant.variant().with(VariantProperties.Y_ROT, Rotation.R90)) + .select(Direction.EAST, Variant.variant().with(VariantProperties.Y_ROT, Rotation.R180)) ) ); this.blockStateOutput @@ -1588,29 +1476,15 @@ public class BlockModelGenerators { .with( PropertyDispatch.property(BlockStateProperties.RAIL_SHAPE) .select(RailShape.NORTH_SOUTH, Variant.variant().with(VariantProperties.MODEL, resourceLocation)) - .select( - RailShape.EAST_WEST, Variant.variant().with(VariantProperties.MODEL, resourceLocation).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90) - ) - .select( - RailShape.ASCENDING_EAST, - Variant.variant().with(VariantProperties.MODEL, resourceLocation3).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90) - ) - .select( - RailShape.ASCENDING_WEST, - Variant.variant().with(VariantProperties.MODEL, resourceLocation4).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90) - ) + .select(RailShape.EAST_WEST, Variant.variant().with(VariantProperties.MODEL, resourceLocation).with(VariantProperties.Y_ROT, Rotation.R90)) + .select(RailShape.ASCENDING_EAST, Variant.variant().with(VariantProperties.MODEL, resourceLocation3).with(VariantProperties.Y_ROT, Rotation.R90)) + .select(RailShape.ASCENDING_WEST, Variant.variant().with(VariantProperties.MODEL, resourceLocation4).with(VariantProperties.Y_ROT, Rotation.R90)) .select(RailShape.ASCENDING_NORTH, Variant.variant().with(VariantProperties.MODEL, resourceLocation3)) .select(RailShape.ASCENDING_SOUTH, Variant.variant().with(VariantProperties.MODEL, resourceLocation4)) .select(RailShape.SOUTH_EAST, Variant.variant().with(VariantProperties.MODEL, resourceLocation2)) - .select( - RailShape.SOUTH_WEST, Variant.variant().with(VariantProperties.MODEL, resourceLocation2).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90) - ) - .select( - RailShape.NORTH_WEST, Variant.variant().with(VariantProperties.MODEL, resourceLocation2).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R180) - ) - .select( - RailShape.NORTH_EAST, Variant.variant().with(VariantProperties.MODEL, resourceLocation2).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R270) - ) + .select(RailShape.SOUTH_WEST, Variant.variant().with(VariantProperties.MODEL, resourceLocation2).with(VariantProperties.Y_ROT, Rotation.R90)) + .select(RailShape.NORTH_WEST, Variant.variant().with(VariantProperties.MODEL, resourceLocation2).with(VariantProperties.Y_ROT, Rotation.R180)) + .select(RailShape.NORTH_EAST, Variant.variant().with(VariantProperties.MODEL, resourceLocation2).with(VariantProperties.Y_ROT, Rotation.R270)) ) ); } @@ -1623,32 +1497,24 @@ public class BlockModelGenerators { ResourceLocation resourceLocation5 = this.createSuffixedVariant(railBlock, "_on", ModelTemplates.RAIL_RAISED_NE, TextureMapping::rail); ResourceLocation resourceLocation6 = this.createSuffixedVariant(railBlock, "_on", ModelTemplates.RAIL_RAISED_SW, TextureMapping::rail); PropertyDispatch propertyDispatch = PropertyDispatch.properties(BlockStateProperties.POWERED, BlockStateProperties.RAIL_SHAPE_STRAIGHT) - .generate( - (boolean_, railShape) -> { - switch (railShape) { - case NORTH_SOUTH: - return Variant.variant().with(VariantProperties.MODEL, boolean_ ? resourceLocation4 : resourceLocation); - case EAST_WEST: - return Variant.variant() - .with(VariantProperties.MODEL, boolean_ ? resourceLocation4 : resourceLocation) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90); - case ASCENDING_EAST: - return Variant.variant() - .with(VariantProperties.MODEL, boolean_ ? resourceLocation5 : resourceLocation2) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90); - case ASCENDING_WEST: - return Variant.variant() - .with(VariantProperties.MODEL, boolean_ ? resourceLocation6 : resourceLocation3) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90); - case ASCENDING_NORTH: - return Variant.variant().with(VariantProperties.MODEL, boolean_ ? resourceLocation5 : resourceLocation2); - case ASCENDING_SOUTH: - return Variant.variant().with(VariantProperties.MODEL, boolean_ ? resourceLocation6 : resourceLocation3); - default: - throw new UnsupportedOperationException("Fix you generator!"); - } + .generate((boolean_, railShape) -> { + switch (railShape) { + case NORTH_SOUTH: + return Variant.variant().with(VariantProperties.MODEL, boolean_ ? resourceLocation4 : resourceLocation); + case EAST_WEST: + return Variant.variant().with(VariantProperties.MODEL, boolean_ ? resourceLocation4 : resourceLocation).with(VariantProperties.Y_ROT, Rotation.R90); + case ASCENDING_EAST: + return Variant.variant().with(VariantProperties.MODEL, boolean_ ? resourceLocation5 : resourceLocation2).with(VariantProperties.Y_ROT, Rotation.R90); + case ASCENDING_WEST: + return Variant.variant().with(VariantProperties.MODEL, boolean_ ? resourceLocation6 : resourceLocation3).with(VariantProperties.Y_ROT, Rotation.R90); + case ASCENDING_NORTH: + return Variant.variant().with(VariantProperties.MODEL, boolean_ ? resourceLocation5 : resourceLocation2); + case ASCENDING_SOUTH: + return Variant.variant().with(VariantProperties.MODEL, boolean_ ? resourceLocation6 : resourceLocation3); + default: + throw new UnsupportedOperationException("Fix you generator!"); } - ); + }); this.createSimpleFlatItemModel(railBlock); this.blockStateOutput.accept(MultiVariantGenerator.multiVariant(railBlock).with(propertyDispatch)); } @@ -1692,15 +1558,15 @@ public class BlockModelGenerators { ) .with( Condition.condition().term(BlockStateProperties.FLOWER_AMOUNT, 1, 2, 3, 4).term(BlockStateProperties.HORIZONTAL_FACING, Direction.EAST), - Variant.variant().with(VariantProperties.MODEL, resourceLocation).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90) + Variant.variant().with(VariantProperties.MODEL, resourceLocation).with(VariantProperties.Y_ROT, Rotation.R90) ) .with( Condition.condition().term(BlockStateProperties.FLOWER_AMOUNT, 1, 2, 3, 4).term(BlockStateProperties.HORIZONTAL_FACING, Direction.SOUTH), - Variant.variant().with(VariantProperties.MODEL, resourceLocation).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R180) + Variant.variant().with(VariantProperties.MODEL, resourceLocation).with(VariantProperties.Y_ROT, Rotation.R180) ) .with( Condition.condition().term(BlockStateProperties.FLOWER_AMOUNT, 1, 2, 3, 4).term(BlockStateProperties.HORIZONTAL_FACING, Direction.WEST), - Variant.variant().with(VariantProperties.MODEL, resourceLocation).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R270) + Variant.variant().with(VariantProperties.MODEL, resourceLocation).with(VariantProperties.Y_ROT, Rotation.R270) ) .with( Condition.condition().term(BlockStateProperties.FLOWER_AMOUNT, 2, 3, 4).term(BlockStateProperties.HORIZONTAL_FACING, Direction.NORTH), @@ -1708,15 +1574,15 @@ public class BlockModelGenerators { ) .with( Condition.condition().term(BlockStateProperties.FLOWER_AMOUNT, 2, 3, 4).term(BlockStateProperties.HORIZONTAL_FACING, Direction.EAST), - Variant.variant().with(VariantProperties.MODEL, resourceLocation2).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90) + Variant.variant().with(VariantProperties.MODEL, resourceLocation2).with(VariantProperties.Y_ROT, Rotation.R90) ) .with( Condition.condition().term(BlockStateProperties.FLOWER_AMOUNT, 2, 3, 4).term(BlockStateProperties.HORIZONTAL_FACING, Direction.SOUTH), - Variant.variant().with(VariantProperties.MODEL, resourceLocation2).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R180) + Variant.variant().with(VariantProperties.MODEL, resourceLocation2).with(VariantProperties.Y_ROT, Rotation.R180) ) .with( Condition.condition().term(BlockStateProperties.FLOWER_AMOUNT, 2, 3, 4).term(BlockStateProperties.HORIZONTAL_FACING, Direction.WEST), - Variant.variant().with(VariantProperties.MODEL, resourceLocation2).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R270) + Variant.variant().with(VariantProperties.MODEL, resourceLocation2).with(VariantProperties.Y_ROT, Rotation.R270) ) .with( Condition.condition().term(BlockStateProperties.FLOWER_AMOUNT, 3, 4).term(BlockStateProperties.HORIZONTAL_FACING, Direction.NORTH), @@ -1724,15 +1590,15 @@ public class BlockModelGenerators { ) .with( Condition.condition().term(BlockStateProperties.FLOWER_AMOUNT, 3, 4).term(BlockStateProperties.HORIZONTAL_FACING, Direction.EAST), - Variant.variant().with(VariantProperties.MODEL, resourceLocation3).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90) + Variant.variant().with(VariantProperties.MODEL, resourceLocation3).with(VariantProperties.Y_ROT, Rotation.R90) ) .with( Condition.condition().term(BlockStateProperties.FLOWER_AMOUNT, 3, 4).term(BlockStateProperties.HORIZONTAL_FACING, Direction.SOUTH), - Variant.variant().with(VariantProperties.MODEL, resourceLocation3).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R180) + Variant.variant().with(VariantProperties.MODEL, resourceLocation3).with(VariantProperties.Y_ROT, Rotation.R180) ) .with( Condition.condition().term(BlockStateProperties.FLOWER_AMOUNT, 3, 4).term(BlockStateProperties.HORIZONTAL_FACING, Direction.WEST), - Variant.variant().with(VariantProperties.MODEL, resourceLocation3).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R270) + Variant.variant().with(VariantProperties.MODEL, resourceLocation3).with(VariantProperties.Y_ROT, Rotation.R270) ) .with( Condition.condition().term(BlockStateProperties.FLOWER_AMOUNT, 4).term(BlockStateProperties.HORIZONTAL_FACING, Direction.NORTH), @@ -1740,15 +1606,15 @@ public class BlockModelGenerators { ) .with( Condition.condition().term(BlockStateProperties.FLOWER_AMOUNT, 4).term(BlockStateProperties.HORIZONTAL_FACING, Direction.EAST), - Variant.variant().with(VariantProperties.MODEL, resourceLocation4).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90) + Variant.variant().with(VariantProperties.MODEL, resourceLocation4).with(VariantProperties.Y_ROT, Rotation.R90) ) .with( Condition.condition().term(BlockStateProperties.FLOWER_AMOUNT, 4).term(BlockStateProperties.HORIZONTAL_FACING, Direction.SOUTH), - Variant.variant().with(VariantProperties.MODEL, resourceLocation4).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R180) + Variant.variant().with(VariantProperties.MODEL, resourceLocation4).with(VariantProperties.Y_ROT, Rotation.R180) ) .with( Condition.condition().term(BlockStateProperties.FLOWER_AMOUNT, 4).term(BlockStateProperties.HORIZONTAL_FACING, Direction.WEST), - Variant.variant().with(VariantProperties.MODEL, resourceLocation4).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R270) + Variant.variant().with(VariantProperties.MODEL, resourceLocation4).with(VariantProperties.Y_ROT, Rotation.R270) ) ); } @@ -1787,22 +1653,22 @@ public class BlockModelGenerators { .with(Condition.condition().term(BlockStateProperties.NORTH, true), Variant.variant().with(VariantProperties.MODEL, resourceLocation2)) .with( Condition.condition().term(BlockStateProperties.EAST, true), - Variant.variant().with(VariantProperties.MODEL, resourceLocation2).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90) + Variant.variant().with(VariantProperties.MODEL, resourceLocation2).with(VariantProperties.Y_ROT, Rotation.R90) ) .with(Condition.condition().term(BlockStateProperties.SOUTH, true), Variant.variant().with(VariantProperties.MODEL, resourceLocation3)) .with( Condition.condition().term(BlockStateProperties.WEST, true), - Variant.variant().with(VariantProperties.MODEL, resourceLocation3).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90) + Variant.variant().with(VariantProperties.MODEL, resourceLocation3).with(VariantProperties.Y_ROT, Rotation.R90) ) .with(Condition.condition().term(BlockStateProperties.NORTH, false), Variant.variant().with(VariantProperties.MODEL, resourceLocation4)) .with(Condition.condition().term(BlockStateProperties.EAST, false), Variant.variant().with(VariantProperties.MODEL, resourceLocation5)) .with( Condition.condition().term(BlockStateProperties.SOUTH, false), - Variant.variant().with(VariantProperties.MODEL, resourceLocation5).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90) + Variant.variant().with(VariantProperties.MODEL, resourceLocation5).with(VariantProperties.Y_ROT, Rotation.R90) ) .with( Condition.condition().term(BlockStateProperties.WEST, false), - Variant.variant().with(VariantProperties.MODEL, resourceLocation4).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R270) + Variant.variant().with(VariantProperties.MODEL, resourceLocation4).with(VariantProperties.Y_ROT, Rotation.R270) ) ); } @@ -1853,21 +1719,12 @@ public class BlockModelGenerators { private PropertyDispatch createColumnWithFacing() { return PropertyDispatch.property(BlockStateProperties.FACING) - .select(Direction.DOWN, Variant.variant().with(VariantProperties.X_ROT, VariantProperties.Rotation.R180)) + .select(Direction.DOWN, Variant.variant().with(VariantProperties.X_ROT, Rotation.R180)) .select(Direction.UP, Variant.variant()) - .select(Direction.NORTH, Variant.variant().with(VariantProperties.X_ROT, VariantProperties.Rotation.R90)) - .select( - Direction.SOUTH, - Variant.variant().with(VariantProperties.X_ROT, VariantProperties.Rotation.R90).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R180) - ) - .select( - Direction.WEST, - Variant.variant().with(VariantProperties.X_ROT, VariantProperties.Rotation.R90).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R270) - ) - .select( - Direction.EAST, - Variant.variant().with(VariantProperties.X_ROT, VariantProperties.Rotation.R90).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90) - ); + .select(Direction.NORTH, Variant.variant().with(VariantProperties.X_ROT, Rotation.R90)) + .select(Direction.SOUTH, Variant.variant().with(VariantProperties.X_ROT, Rotation.R90).with(VariantProperties.Y_ROT, Rotation.R180)) + .select(Direction.WEST, Variant.variant().with(VariantProperties.X_ROT, Rotation.R90).with(VariantProperties.Y_ROT, Rotation.R270)) + .select(Direction.EAST, Variant.variant().with(VariantProperties.X_ROT, Rotation.R90).with(VariantProperties.Y_ROT, Rotation.R90)); } private void createBarrel() { @@ -1908,8 +1765,11 @@ public class BlockModelGenerators { private void createBeeNest(Block beeNestBlock, Function textureMappingGetter) { TextureMapping textureMapping = ((TextureMapping)textureMappingGetter.apply(beeNestBlock)).copyForced(TextureSlot.SIDE, TextureSlot.PARTICLE); TextureMapping textureMapping2 = textureMapping.copyAndUpdate(TextureSlot.FRONT, TextureMapping.getBlockTexture(beeNestBlock, "_front_honey")); - ResourceLocation resourceLocation = ModelTemplates.CUBE_ORIENTABLE_TOP_BOTTOM.create(beeNestBlock, textureMapping, this.modelOutput); + ResourceLocation resourceLocation = ModelTemplates.CUBE_ORIENTABLE_TOP_BOTTOM.createWithSuffix(beeNestBlock, "_empty", textureMapping, this.modelOutput); ResourceLocation resourceLocation2 = ModelTemplates.CUBE_ORIENTABLE_TOP_BOTTOM.createWithSuffix(beeNestBlock, "_honey", textureMapping2, this.modelOutput); + this.skipAutoItemBlock(beeNestBlock); + ModelTemplates.CUBE_ORIENTABLE_TOP_BOTTOM.create(ModelLocationUtils.getModelLocation(beeNestBlock.asItem(), "_empty"), textureMapping, this.modelOutput); + ModelTemplates.CUBE_ORIENTABLE_TOP_BOTTOM.create(ModelLocationUtils.getModelLocation(beeNestBlock.asItem(), "_honey"), textureMapping2, this.modelOutput); this.blockStateOutput .accept( MultiVariantGenerator.multiVariant(beeNestBlock) @@ -1951,67 +1811,57 @@ public class BlockModelGenerators { PropertyDispatch.properties(BlockStateProperties.HORIZONTAL_FACING, BlockStateProperties.BELL_ATTACHMENT) .select(Direction.NORTH, BellAttachType.FLOOR, Variant.variant().with(VariantProperties.MODEL, resourceLocation)) .select( - Direction.SOUTH, - BellAttachType.FLOOR, - Variant.variant().with(VariantProperties.MODEL, resourceLocation).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R180) + Direction.SOUTH, BellAttachType.FLOOR, Variant.variant().with(VariantProperties.MODEL, resourceLocation).with(VariantProperties.Y_ROT, Rotation.R180) ) .select( - Direction.EAST, - BellAttachType.FLOOR, - Variant.variant().with(VariantProperties.MODEL, resourceLocation).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90) + Direction.EAST, BellAttachType.FLOOR, Variant.variant().with(VariantProperties.MODEL, resourceLocation).with(VariantProperties.Y_ROT, Rotation.R90) ) .select( - Direction.WEST, - BellAttachType.FLOOR, - Variant.variant().with(VariantProperties.MODEL, resourceLocation).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R270) + Direction.WEST, BellAttachType.FLOOR, Variant.variant().with(VariantProperties.MODEL, resourceLocation).with(VariantProperties.Y_ROT, Rotation.R270) ) .select(Direction.NORTH, BellAttachType.CEILING, Variant.variant().with(VariantProperties.MODEL, resourceLocation2)) .select( Direction.SOUTH, BellAttachType.CEILING, - Variant.variant().with(VariantProperties.MODEL, resourceLocation2).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R180) + Variant.variant().with(VariantProperties.MODEL, resourceLocation2).with(VariantProperties.Y_ROT, Rotation.R180) ) .select( - Direction.EAST, - BellAttachType.CEILING, - Variant.variant().with(VariantProperties.MODEL, resourceLocation2).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90) + Direction.EAST, BellAttachType.CEILING, Variant.variant().with(VariantProperties.MODEL, resourceLocation2).with(VariantProperties.Y_ROT, Rotation.R90) ) .select( - Direction.WEST, - BellAttachType.CEILING, - Variant.variant().with(VariantProperties.MODEL, resourceLocation2).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R270) + Direction.WEST, BellAttachType.CEILING, Variant.variant().with(VariantProperties.MODEL, resourceLocation2).with(VariantProperties.Y_ROT, Rotation.R270) ) .select( Direction.NORTH, BellAttachType.SINGLE_WALL, - Variant.variant().with(VariantProperties.MODEL, resourceLocation3).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R270) + Variant.variant().with(VariantProperties.MODEL, resourceLocation3).with(VariantProperties.Y_ROT, Rotation.R270) ) .select( Direction.SOUTH, BellAttachType.SINGLE_WALL, - Variant.variant().with(VariantProperties.MODEL, resourceLocation3).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90) + Variant.variant().with(VariantProperties.MODEL, resourceLocation3).with(VariantProperties.Y_ROT, Rotation.R90) ) .select(Direction.EAST, BellAttachType.SINGLE_WALL, Variant.variant().with(VariantProperties.MODEL, resourceLocation3)) .select( Direction.WEST, BellAttachType.SINGLE_WALL, - Variant.variant().with(VariantProperties.MODEL, resourceLocation3).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R180) + Variant.variant().with(VariantProperties.MODEL, resourceLocation3).with(VariantProperties.Y_ROT, Rotation.R180) ) .select( Direction.SOUTH, BellAttachType.DOUBLE_WALL, - Variant.variant().with(VariantProperties.MODEL, resourceLocation4).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90) + Variant.variant().with(VariantProperties.MODEL, resourceLocation4).with(VariantProperties.Y_ROT, Rotation.R90) ) .select( Direction.NORTH, BellAttachType.DOUBLE_WALL, - Variant.variant().with(VariantProperties.MODEL, resourceLocation4).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R270) + Variant.variant().with(VariantProperties.MODEL, resourceLocation4).with(VariantProperties.Y_ROT, Rotation.R270) ) .select(Direction.EAST, BellAttachType.DOUBLE_WALL, Variant.variant().with(VariantProperties.MODEL, resourceLocation4)) .select( Direction.WEST, BellAttachType.DOUBLE_WALL, - Variant.variant().with(VariantProperties.MODEL, resourceLocation4).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R180) + Variant.variant().with(VariantProperties.MODEL, resourceLocation4).with(VariantProperties.Y_ROT, Rotation.R180) ) ) ); @@ -2026,41 +1876,17 @@ public class BlockModelGenerators { .with( PropertyDispatch.properties(BlockStateProperties.ATTACH_FACE, BlockStateProperties.HORIZONTAL_FACING) .select(AttachFace.FLOOR, Direction.NORTH, Variant.variant()) - .select(AttachFace.FLOOR, Direction.EAST, Variant.variant().with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90)) - .select(AttachFace.FLOOR, Direction.SOUTH, Variant.variant().with(VariantProperties.Y_ROT, VariantProperties.Rotation.R180)) - .select(AttachFace.FLOOR, Direction.WEST, Variant.variant().with(VariantProperties.Y_ROT, VariantProperties.Rotation.R270)) - .select(AttachFace.WALL, Direction.NORTH, Variant.variant().with(VariantProperties.X_ROT, VariantProperties.Rotation.R90)) - .select( - AttachFace.WALL, - Direction.EAST, - Variant.variant().with(VariantProperties.X_ROT, VariantProperties.Rotation.R90).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90) - ) - .select( - AttachFace.WALL, - Direction.SOUTH, - Variant.variant().with(VariantProperties.X_ROT, VariantProperties.Rotation.R90).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R180) - ) - .select( - AttachFace.WALL, - Direction.WEST, - Variant.variant().with(VariantProperties.X_ROT, VariantProperties.Rotation.R90).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R270) - ) - .select(AttachFace.CEILING, Direction.SOUTH, Variant.variant().with(VariantProperties.X_ROT, VariantProperties.Rotation.R180)) - .select( - AttachFace.CEILING, - Direction.WEST, - Variant.variant().with(VariantProperties.X_ROT, VariantProperties.Rotation.R180).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90) - ) - .select( - AttachFace.CEILING, - Direction.NORTH, - Variant.variant().with(VariantProperties.X_ROT, VariantProperties.Rotation.R180).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R180) - ) - .select( - AttachFace.CEILING, - Direction.EAST, - Variant.variant().with(VariantProperties.X_ROT, VariantProperties.Rotation.R180).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R270) - ) + .select(AttachFace.FLOOR, Direction.EAST, Variant.variant().with(VariantProperties.Y_ROT, Rotation.R90)) + .select(AttachFace.FLOOR, Direction.SOUTH, Variant.variant().with(VariantProperties.Y_ROT, Rotation.R180)) + .select(AttachFace.FLOOR, Direction.WEST, Variant.variant().with(VariantProperties.Y_ROT, Rotation.R270)) + .select(AttachFace.WALL, Direction.NORTH, Variant.variant().with(VariantProperties.X_ROT, Rotation.R90)) + .select(AttachFace.WALL, Direction.EAST, Variant.variant().with(VariantProperties.X_ROT, Rotation.R90).with(VariantProperties.Y_ROT, Rotation.R90)) + .select(AttachFace.WALL, Direction.SOUTH, Variant.variant().with(VariantProperties.X_ROT, Rotation.R90).with(VariantProperties.Y_ROT, Rotation.R180)) + .select(AttachFace.WALL, Direction.WEST, Variant.variant().with(VariantProperties.X_ROT, Rotation.R90).with(VariantProperties.Y_ROT, Rotation.R270)) + .select(AttachFace.CEILING, Direction.SOUTH, Variant.variant().with(VariantProperties.X_ROT, Rotation.R180)) + .select(AttachFace.CEILING, Direction.WEST, Variant.variant().with(VariantProperties.X_ROT, Rotation.R180).with(VariantProperties.Y_ROT, Rotation.R90)) + .select(AttachFace.CEILING, Direction.NORTH, Variant.variant().with(VariantProperties.X_ROT, Rotation.R180).with(VariantProperties.Y_ROT, Rotation.R180)) + .select(AttachFace.CEILING, Direction.EAST, Variant.variant().with(VariantProperties.X_ROT, Rotation.R180).with(VariantProperties.Y_ROT, Rotation.R270)) ) ); } @@ -2155,13 +1981,13 @@ public class BlockModelGenerators { Condition.condition().term(BlockStateProperties.EAST_REDSTONE, RedstoneSide.SIDE, RedstoneSide.UP), Variant.variant() .with(VariantProperties.MODEL, ModelLocationUtils.decorateBlockModelLocation("redstone_dust_side_alt1")) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R270) + .with(VariantProperties.Y_ROT, Rotation.R270) ) .with( Condition.condition().term(BlockStateProperties.WEST_REDSTONE, RedstoneSide.SIDE, RedstoneSide.UP), Variant.variant() .with(VariantProperties.MODEL, ModelLocationUtils.decorateBlockModelLocation("redstone_dust_side1")) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R270) + .with(VariantProperties.Y_ROT, Rotation.R270) ) .with( Condition.condition().term(BlockStateProperties.NORTH_REDSTONE, RedstoneSide.UP), @@ -2171,19 +1997,19 @@ public class BlockModelGenerators { Condition.condition().term(BlockStateProperties.EAST_REDSTONE, RedstoneSide.UP), Variant.variant() .with(VariantProperties.MODEL, ModelLocationUtils.decorateBlockModelLocation("redstone_dust_up")) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90) + .with(VariantProperties.Y_ROT, Rotation.R90) ) .with( Condition.condition().term(BlockStateProperties.SOUTH_REDSTONE, RedstoneSide.UP), Variant.variant() .with(VariantProperties.MODEL, ModelLocationUtils.decorateBlockModelLocation("redstone_dust_up")) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R180) + .with(VariantProperties.Y_ROT, Rotation.R180) ) .with( Condition.condition().term(BlockStateProperties.WEST_REDSTONE, RedstoneSide.UP), Variant.variant() .with(VariantProperties.MODEL, ModelLocationUtils.decorateBlockModelLocation("redstone_dust_up")) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R270) + .with(VariantProperties.Y_ROT, Rotation.R270) ) ); } @@ -2260,74 +2086,44 @@ public class BlockModelGenerators { .with(Condition.condition().term(BlockStateProperties.NORTH, true), Variant.variant().with(VariantProperties.MODEL, resourceLocation)) .with( Condition.condition().term(BlockStateProperties.EAST, true), - Variant.variant() - .with(VariantProperties.MODEL, resourceLocation) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90) - .with(VariantProperties.UV_LOCK, true) + Variant.variant().with(VariantProperties.MODEL, resourceLocation).with(VariantProperties.Y_ROT, Rotation.R90).with(VariantProperties.UV_LOCK, true) ) .with( Condition.condition().term(BlockStateProperties.SOUTH, true), - Variant.variant() - .with(VariantProperties.MODEL, resourceLocation) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R180) - .with(VariantProperties.UV_LOCK, true) + Variant.variant().with(VariantProperties.MODEL, resourceLocation).with(VariantProperties.Y_ROT, Rotation.R180).with(VariantProperties.UV_LOCK, true) ) .with( Condition.condition().term(BlockStateProperties.WEST, true), - Variant.variant() - .with(VariantProperties.MODEL, resourceLocation) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R270) - .with(VariantProperties.UV_LOCK, true) + Variant.variant().with(VariantProperties.MODEL, resourceLocation).with(VariantProperties.Y_ROT, Rotation.R270).with(VariantProperties.UV_LOCK, true) ) .with( Condition.condition().term(BlockStateProperties.UP, true), - Variant.variant() - .with(VariantProperties.MODEL, resourceLocation) - .with(VariantProperties.X_ROT, VariantProperties.Rotation.R270) - .with(VariantProperties.UV_LOCK, true) + Variant.variant().with(VariantProperties.MODEL, resourceLocation).with(VariantProperties.X_ROT, Rotation.R270).with(VariantProperties.UV_LOCK, true) ) .with( Condition.condition().term(BlockStateProperties.DOWN, true), - Variant.variant() - .with(VariantProperties.MODEL, resourceLocation) - .with(VariantProperties.X_ROT, VariantProperties.Rotation.R90) - .with(VariantProperties.UV_LOCK, true) + Variant.variant().with(VariantProperties.MODEL, resourceLocation).with(VariantProperties.X_ROT, Rotation.R90).with(VariantProperties.UV_LOCK, true) ) .with(Condition.condition().term(BlockStateProperties.NORTH, false), Variant.variant().with(VariantProperties.MODEL, resourceLocation2)) .with( Condition.condition().term(BlockStateProperties.EAST, false), - Variant.variant() - .with(VariantProperties.MODEL, resourceLocation2) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90) - .with(VariantProperties.UV_LOCK, false) + Variant.variant().with(VariantProperties.MODEL, resourceLocation2).with(VariantProperties.Y_ROT, Rotation.R90).with(VariantProperties.UV_LOCK, false) ) .with( Condition.condition().term(BlockStateProperties.SOUTH, false), - Variant.variant() - .with(VariantProperties.MODEL, resourceLocation2) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R180) - .with(VariantProperties.UV_LOCK, false) + Variant.variant().with(VariantProperties.MODEL, resourceLocation2).with(VariantProperties.Y_ROT, Rotation.R180).with(VariantProperties.UV_LOCK, false) ) .with( Condition.condition().term(BlockStateProperties.WEST, false), - Variant.variant() - .with(VariantProperties.MODEL, resourceLocation2) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R270) - .with(VariantProperties.UV_LOCK, false) + Variant.variant().with(VariantProperties.MODEL, resourceLocation2).with(VariantProperties.Y_ROT, Rotation.R270).with(VariantProperties.UV_LOCK, false) ) .with( Condition.condition().term(BlockStateProperties.UP, false), - Variant.variant() - .with(VariantProperties.MODEL, resourceLocation2) - .with(VariantProperties.X_ROT, VariantProperties.Rotation.R270) - .with(VariantProperties.UV_LOCK, false) + Variant.variant().with(VariantProperties.MODEL, resourceLocation2).with(VariantProperties.X_ROT, Rotation.R270).with(VariantProperties.UV_LOCK, false) ) .with( Condition.condition().term(BlockStateProperties.DOWN, false), - Variant.variant() - .with(VariantProperties.MODEL, resourceLocation2) - .with(VariantProperties.X_ROT, VariantProperties.Rotation.R90) - .with(VariantProperties.UV_LOCK, false) + Variant.variant().with(VariantProperties.MODEL, resourceLocation2).with(VariantProperties.X_ROT, Rotation.R90).with(VariantProperties.UV_LOCK, false) ) ); this.delegateItemModel(mushroomBlock, TexturedModel.CUBE.createWithSuffix(mushroomBlock, "_inventory", this.modelOutput)); @@ -2547,16 +2343,12 @@ public class BlockModelGenerators { MultiVariantGenerator.multiVariant(dispenserBlock) .with( PropertyDispatch.property(BlockStateProperties.FACING) - .select( - Direction.DOWN, Variant.variant().with(VariantProperties.MODEL, resourceLocation2).with(VariantProperties.X_ROT, VariantProperties.Rotation.R180) - ) + .select(Direction.DOWN, Variant.variant().with(VariantProperties.MODEL, resourceLocation2).with(VariantProperties.X_ROT, Rotation.R180)) .select(Direction.UP, Variant.variant().with(VariantProperties.MODEL, resourceLocation2)) .select(Direction.NORTH, Variant.variant().with(VariantProperties.MODEL, resourceLocation)) - .select(Direction.EAST, Variant.variant().with(VariantProperties.MODEL, resourceLocation).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90)) - .select( - Direction.SOUTH, Variant.variant().with(VariantProperties.MODEL, resourceLocation).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R180) - ) - .select(Direction.WEST, Variant.variant().with(VariantProperties.MODEL, resourceLocation).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R270)) + .select(Direction.EAST, Variant.variant().with(VariantProperties.MODEL, resourceLocation).with(VariantProperties.Y_ROT, Rotation.R90)) + .select(Direction.SOUTH, Variant.variant().with(VariantProperties.MODEL, resourceLocation).with(VariantProperties.Y_ROT, Rotation.R180)) + .select(Direction.WEST, Variant.variant().with(VariantProperties.MODEL, resourceLocation).with(VariantProperties.Y_ROT, Rotation.R270)) ) ); } @@ -2588,38 +2380,23 @@ public class BlockModelGenerators { .with(Condition.condition().term(BlockStateProperties.NORTH, true), Variant.variant().with(VariantProperties.MODEL, resourceLocation)) .with( Condition.condition().term(BlockStateProperties.EAST, true), - Variant.variant() - .with(VariantProperties.MODEL, resourceLocation) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90) - .with(VariantProperties.UV_LOCK, true) + Variant.variant().with(VariantProperties.MODEL, resourceLocation).with(VariantProperties.Y_ROT, Rotation.R90).with(VariantProperties.UV_LOCK, true) ) .with( Condition.condition().term(BlockStateProperties.SOUTH, true), - Variant.variant() - .with(VariantProperties.MODEL, resourceLocation) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R180) - .with(VariantProperties.UV_LOCK, true) + Variant.variant().with(VariantProperties.MODEL, resourceLocation).with(VariantProperties.Y_ROT, Rotation.R180).with(VariantProperties.UV_LOCK, true) ) .with( Condition.condition().term(BlockStateProperties.WEST, true), - Variant.variant() - .with(VariantProperties.MODEL, resourceLocation) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R270) - .with(VariantProperties.UV_LOCK, true) + Variant.variant().with(VariantProperties.MODEL, resourceLocation).with(VariantProperties.Y_ROT, Rotation.R270).with(VariantProperties.UV_LOCK, true) ) .with( Condition.condition().term(BlockStateProperties.UP, true), - Variant.variant() - .with(VariantProperties.MODEL, resourceLocation) - .with(VariantProperties.X_ROT, VariantProperties.Rotation.R270) - .with(VariantProperties.UV_LOCK, true) + Variant.variant().with(VariantProperties.MODEL, resourceLocation).with(VariantProperties.X_ROT, Rotation.R270).with(VariantProperties.UV_LOCK, true) ) .with( Condition.condition().term(BlockStateProperties.DOWN, true), - Variant.variant() - .with(VariantProperties.MODEL, resourceLocation) - .with(VariantProperties.X_ROT, VariantProperties.Rotation.R90) - .with(VariantProperties.UV_LOCK, true) + Variant.variant().with(VariantProperties.MODEL, resourceLocation).with(VariantProperties.X_ROT, Rotation.R90).with(VariantProperties.UV_LOCK, true) ) .with( Condition.condition().term(BlockStateProperties.NORTH, false), @@ -2630,102 +2407,57 @@ public class BlockModelGenerators { ) .with( Condition.condition().term(BlockStateProperties.EAST, false), - Variant.variant() - .with(VariantProperties.MODEL, resourceLocation3) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90) - .with(VariantProperties.UV_LOCK, true), - Variant.variant() - .with(VariantProperties.MODEL, resourceLocation4) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90) - .with(VariantProperties.UV_LOCK, true), - Variant.variant() - .with(VariantProperties.MODEL, resourceLocation5) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90) - .with(VariantProperties.UV_LOCK, true), + Variant.variant().with(VariantProperties.MODEL, resourceLocation3).with(VariantProperties.Y_ROT, Rotation.R90).with(VariantProperties.UV_LOCK, true), + Variant.variant().with(VariantProperties.MODEL, resourceLocation4).with(VariantProperties.Y_ROT, Rotation.R90).with(VariantProperties.UV_LOCK, true), + Variant.variant().with(VariantProperties.MODEL, resourceLocation5).with(VariantProperties.Y_ROT, Rotation.R90).with(VariantProperties.UV_LOCK, true), Variant.variant() .with(VariantProperties.MODEL, resourceLocation2) .with(VariantProperties.WEIGHT, 2) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90) + .with(VariantProperties.Y_ROT, Rotation.R90) .with(VariantProperties.UV_LOCK, true) ) .with( Condition.condition().term(BlockStateProperties.SOUTH, false), - Variant.variant() - .with(VariantProperties.MODEL, resourceLocation4) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R180) - .with(VariantProperties.UV_LOCK, true), - Variant.variant() - .with(VariantProperties.MODEL, resourceLocation5) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R180) - .with(VariantProperties.UV_LOCK, true), + Variant.variant().with(VariantProperties.MODEL, resourceLocation4).with(VariantProperties.Y_ROT, Rotation.R180).with(VariantProperties.UV_LOCK, true), + Variant.variant().with(VariantProperties.MODEL, resourceLocation5).with(VariantProperties.Y_ROT, Rotation.R180).with(VariantProperties.UV_LOCK, true), Variant.variant() .with(VariantProperties.MODEL, resourceLocation2) .with(VariantProperties.WEIGHT, 2) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R180) + .with(VariantProperties.Y_ROT, Rotation.R180) .with(VariantProperties.UV_LOCK, true), - Variant.variant() - .with(VariantProperties.MODEL, resourceLocation3) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R180) - .with(VariantProperties.UV_LOCK, true) + Variant.variant().with(VariantProperties.MODEL, resourceLocation3).with(VariantProperties.Y_ROT, Rotation.R180).with(VariantProperties.UV_LOCK, true) ) .with( Condition.condition().term(BlockStateProperties.WEST, false), - Variant.variant() - .with(VariantProperties.MODEL, resourceLocation5) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R270) - .with(VariantProperties.UV_LOCK, true), + Variant.variant().with(VariantProperties.MODEL, resourceLocation5).with(VariantProperties.Y_ROT, Rotation.R270).with(VariantProperties.UV_LOCK, true), Variant.variant() .with(VariantProperties.MODEL, resourceLocation2) .with(VariantProperties.WEIGHT, 2) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R270) + .with(VariantProperties.Y_ROT, Rotation.R270) .with(VariantProperties.UV_LOCK, true), - Variant.variant() - .with(VariantProperties.MODEL, resourceLocation3) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R270) - .with(VariantProperties.UV_LOCK, true), - Variant.variant() - .with(VariantProperties.MODEL, resourceLocation4) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R270) - .with(VariantProperties.UV_LOCK, true) + Variant.variant().with(VariantProperties.MODEL, resourceLocation3).with(VariantProperties.Y_ROT, Rotation.R270).with(VariantProperties.UV_LOCK, true), + Variant.variant().with(VariantProperties.MODEL, resourceLocation4).with(VariantProperties.Y_ROT, Rotation.R270).with(VariantProperties.UV_LOCK, true) ) .with( Condition.condition().term(BlockStateProperties.UP, false), Variant.variant() .with(VariantProperties.MODEL, resourceLocation2) .with(VariantProperties.WEIGHT, 2) - .with(VariantProperties.X_ROT, VariantProperties.Rotation.R270) + .with(VariantProperties.X_ROT, Rotation.R270) .with(VariantProperties.UV_LOCK, true), - Variant.variant() - .with(VariantProperties.MODEL, resourceLocation5) - .with(VariantProperties.X_ROT, VariantProperties.Rotation.R270) - .with(VariantProperties.UV_LOCK, true), - Variant.variant() - .with(VariantProperties.MODEL, resourceLocation3) - .with(VariantProperties.X_ROT, VariantProperties.Rotation.R270) - .with(VariantProperties.UV_LOCK, true), - Variant.variant() - .with(VariantProperties.MODEL, resourceLocation4) - .with(VariantProperties.X_ROT, VariantProperties.Rotation.R270) - .with(VariantProperties.UV_LOCK, true) + Variant.variant().with(VariantProperties.MODEL, resourceLocation5).with(VariantProperties.X_ROT, Rotation.R270).with(VariantProperties.UV_LOCK, true), + Variant.variant().with(VariantProperties.MODEL, resourceLocation3).with(VariantProperties.X_ROT, Rotation.R270).with(VariantProperties.UV_LOCK, true), + Variant.variant().with(VariantProperties.MODEL, resourceLocation4).with(VariantProperties.X_ROT, Rotation.R270).with(VariantProperties.UV_LOCK, true) ) .with( Condition.condition().term(BlockStateProperties.DOWN, false), - Variant.variant() - .with(VariantProperties.MODEL, resourceLocation5) - .with(VariantProperties.X_ROT, VariantProperties.Rotation.R90) - .with(VariantProperties.UV_LOCK, true), - Variant.variant() - .with(VariantProperties.MODEL, resourceLocation4) - .with(VariantProperties.X_ROT, VariantProperties.Rotation.R90) - .with(VariantProperties.UV_LOCK, true), - Variant.variant() - .with(VariantProperties.MODEL, resourceLocation3) - .with(VariantProperties.X_ROT, VariantProperties.Rotation.R90) - .with(VariantProperties.UV_LOCK, true), + Variant.variant().with(VariantProperties.MODEL, resourceLocation5).with(VariantProperties.X_ROT, Rotation.R90).with(VariantProperties.UV_LOCK, true), + Variant.variant().with(VariantProperties.MODEL, resourceLocation4).with(VariantProperties.X_ROT, Rotation.R90).with(VariantProperties.UV_LOCK, true), + Variant.variant().with(VariantProperties.MODEL, resourceLocation3).with(VariantProperties.X_ROT, Rotation.R90).with(VariantProperties.UV_LOCK, true), Variant.variant() .with(VariantProperties.MODEL, resourceLocation2) .with(VariantProperties.WEIGHT, 2) - .with(VariantProperties.X_ROT, VariantProperties.Rotation.R90) + .with(VariantProperties.X_ROT, Rotation.R90) .with(VariantProperties.UV_LOCK, true) ) ); @@ -2977,15 +2709,15 @@ public class BlockModelGenerators { .with(Condition.or(Condition.condition().term(BlockStateProperties.NORTH, true), condition), wrapModels(list2, variant -> variant)) .with( Condition.or(Condition.condition().term(BlockStateProperties.EAST, true), condition), - wrapModels(list2, variant -> variant.with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90)) + wrapModels(list2, variant -> variant.with(VariantProperties.Y_ROT, Rotation.R90)) ) .with( Condition.or(Condition.condition().term(BlockStateProperties.SOUTH, true), condition), - wrapModels(list2, variant -> variant.with(VariantProperties.Y_ROT, VariantProperties.Rotation.R180)) + wrapModels(list2, variant -> variant.with(VariantProperties.Y_ROT, Rotation.R180)) ) .with( Condition.or(Condition.condition().term(BlockStateProperties.WEST, true), condition), - wrapModels(list2, variant -> variant.with(VariantProperties.Y_ROT, VariantProperties.Rotation.R270)) + wrapModels(list2, variant -> variant.with(VariantProperties.Y_ROT, Rotation.R270)) ) .with(Condition.condition().term(BlockStateProperties.UP, true), wrapModels(list3, variant -> variant)) ); @@ -2999,9 +2731,9 @@ public class BlockModelGenerators { MultiPartGenerator.multiPart(Blocks.SOUL_FIRE) .with(wrapModels(list, variant -> variant)) .with(wrapModels(list2, variant -> variant)) - .with(wrapModels(list2, variant -> variant.with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90))) - .with(wrapModels(list2, variant -> variant.with(VariantProperties.Y_ROT, VariantProperties.Rotation.R180))) - .with(wrapModels(list2, variant -> variant.with(VariantProperties.Y_ROT, VariantProperties.Rotation.R270))) + .with(wrapModels(list2, variant -> variant.with(VariantProperties.Y_ROT, Rotation.R90))) + .with(wrapModels(list2, variant -> variant.with(VariantProperties.Y_ROT, Rotation.R180))) + .with(wrapModels(list2, variant -> variant.with(VariantProperties.Y_ROT, Rotation.R270))) ); } @@ -3128,13 +2860,9 @@ public class BlockModelGenerators { PropertyDispatch.property(BlockStateProperties.FACING_HOPPER) .select(Direction.DOWN, Variant.variant().with(VariantProperties.MODEL, resourceLocation)) .select(Direction.NORTH, Variant.variant().with(VariantProperties.MODEL, resourceLocation2)) - .select(Direction.EAST, Variant.variant().with(VariantProperties.MODEL, resourceLocation2).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90)) - .select( - Direction.SOUTH, Variant.variant().with(VariantProperties.MODEL, resourceLocation2).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R180) - ) - .select( - Direction.WEST, Variant.variant().with(VariantProperties.MODEL, resourceLocation2).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R270) - ) + .select(Direction.EAST, Variant.variant().with(VariantProperties.MODEL, resourceLocation2).with(VariantProperties.Y_ROT, Rotation.R90)) + .select(Direction.SOUTH, Variant.variant().with(VariantProperties.MODEL, resourceLocation2).with(VariantProperties.Y_ROT, Rotation.R180)) + .select(Direction.WEST, Variant.variant().with(VariantProperties.MODEL, resourceLocation2).with(VariantProperties.Y_ROT, Rotation.R270)) ) ); } @@ -3178,7 +2906,7 @@ public class BlockModelGenerators { .term(BlockStateProperties.EAST, true) .term(BlockStateProperties.SOUTH, false) .term(BlockStateProperties.WEST, false), - Variant.variant().with(VariantProperties.MODEL, resourceLocation3).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90) + Variant.variant().with(VariantProperties.MODEL, resourceLocation3).with(VariantProperties.Y_ROT, Rotation.R90) ) .with( Condition.condition() @@ -3194,17 +2922,17 @@ public class BlockModelGenerators { .term(BlockStateProperties.EAST, false) .term(BlockStateProperties.SOUTH, false) .term(BlockStateProperties.WEST, true), - Variant.variant().with(VariantProperties.MODEL, resourceLocation4).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90) + Variant.variant().with(VariantProperties.MODEL, resourceLocation4).with(VariantProperties.Y_ROT, Rotation.R90) ) .with(Condition.condition().term(BlockStateProperties.NORTH, true), Variant.variant().with(VariantProperties.MODEL, resourceLocation5)) .with( Condition.condition().term(BlockStateProperties.EAST, true), - Variant.variant().with(VariantProperties.MODEL, resourceLocation5).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90) + Variant.variant().with(VariantProperties.MODEL, resourceLocation5).with(VariantProperties.Y_ROT, Rotation.R90) ) .with(Condition.condition().term(BlockStateProperties.SOUTH, true), Variant.variant().with(VariantProperties.MODEL, resourceLocation6)) .with( Condition.condition().term(BlockStateProperties.WEST, true), - Variant.variant().with(VariantProperties.MODEL, resourceLocation6).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90) + Variant.variant().with(VariantProperties.MODEL, resourceLocation6).with(VariantProperties.Y_ROT, Rotation.R90) ) ); this.createSimpleFlatItemModel(Blocks.IRON_BARS); @@ -3228,42 +2956,18 @@ public class BlockModelGenerators { .with(createBooleanModelDispatch(BlockStateProperties.POWERED, resourceLocation, resourceLocation2)) .with( PropertyDispatch.properties(BlockStateProperties.ATTACH_FACE, BlockStateProperties.HORIZONTAL_FACING) - .select( - AttachFace.CEILING, - Direction.NORTH, - Variant.variant().with(VariantProperties.X_ROT, VariantProperties.Rotation.R180).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R180) - ) - .select( - AttachFace.CEILING, - Direction.EAST, - Variant.variant().with(VariantProperties.X_ROT, VariantProperties.Rotation.R180).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R270) - ) - .select(AttachFace.CEILING, Direction.SOUTH, Variant.variant().with(VariantProperties.X_ROT, VariantProperties.Rotation.R180)) - .select( - AttachFace.CEILING, - Direction.WEST, - Variant.variant().with(VariantProperties.X_ROT, VariantProperties.Rotation.R180).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90) - ) + .select(AttachFace.CEILING, Direction.NORTH, Variant.variant().with(VariantProperties.X_ROT, Rotation.R180).with(VariantProperties.Y_ROT, Rotation.R180)) + .select(AttachFace.CEILING, Direction.EAST, Variant.variant().with(VariantProperties.X_ROT, Rotation.R180).with(VariantProperties.Y_ROT, Rotation.R270)) + .select(AttachFace.CEILING, Direction.SOUTH, Variant.variant().with(VariantProperties.X_ROT, Rotation.R180)) + .select(AttachFace.CEILING, Direction.WEST, Variant.variant().with(VariantProperties.X_ROT, Rotation.R180).with(VariantProperties.Y_ROT, Rotation.R90)) .select(AttachFace.FLOOR, Direction.NORTH, Variant.variant()) - .select(AttachFace.FLOOR, Direction.EAST, Variant.variant().with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90)) - .select(AttachFace.FLOOR, Direction.SOUTH, Variant.variant().with(VariantProperties.Y_ROT, VariantProperties.Rotation.R180)) - .select(AttachFace.FLOOR, Direction.WEST, Variant.variant().with(VariantProperties.Y_ROT, VariantProperties.Rotation.R270)) - .select(AttachFace.WALL, Direction.NORTH, Variant.variant().with(VariantProperties.X_ROT, VariantProperties.Rotation.R90)) - .select( - AttachFace.WALL, - Direction.EAST, - Variant.variant().with(VariantProperties.X_ROT, VariantProperties.Rotation.R90).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90) - ) - .select( - AttachFace.WALL, - Direction.SOUTH, - Variant.variant().with(VariantProperties.X_ROT, VariantProperties.Rotation.R90).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R180) - ) - .select( - AttachFace.WALL, - Direction.WEST, - Variant.variant().with(VariantProperties.X_ROT, VariantProperties.Rotation.R90).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R270) - ) + .select(AttachFace.FLOOR, Direction.EAST, Variant.variant().with(VariantProperties.Y_ROT, Rotation.R90)) + .select(AttachFace.FLOOR, Direction.SOUTH, Variant.variant().with(VariantProperties.Y_ROT, Rotation.R180)) + .select(AttachFace.FLOOR, Direction.WEST, Variant.variant().with(VariantProperties.Y_ROT, Rotation.R270)) + .select(AttachFace.WALL, Direction.NORTH, Variant.variant().with(VariantProperties.X_ROT, Rotation.R90)) + .select(AttachFace.WALL, Direction.EAST, Variant.variant().with(VariantProperties.X_ROT, Rotation.R90).with(VariantProperties.Y_ROT, Rotation.R90)) + .select(AttachFace.WALL, Direction.SOUTH, Variant.variant().with(VariantProperties.X_ROT, Rotation.R90).with(VariantProperties.Y_ROT, Rotation.R180)) + .select(AttachFace.WALL, Direction.WEST, Variant.variant().with(VariantProperties.X_ROT, Rotation.R90).with(VariantProperties.Y_ROT, Rotation.R270)) ) ); } @@ -3297,48 +3001,33 @@ public class BlockModelGenerators { MultiVariantGenerator.multiVariant( Blocks.NETHERRACK, Variant.variant().with(VariantProperties.MODEL, resourceLocation), - Variant.variant().with(VariantProperties.MODEL, resourceLocation).with(VariantProperties.X_ROT, VariantProperties.Rotation.R90), - Variant.variant().with(VariantProperties.MODEL, resourceLocation).with(VariantProperties.X_ROT, VariantProperties.Rotation.R180), - Variant.variant().with(VariantProperties.MODEL, resourceLocation).with(VariantProperties.X_ROT, VariantProperties.Rotation.R270), - Variant.variant().with(VariantProperties.MODEL, resourceLocation).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90), + Variant.variant().with(VariantProperties.MODEL, resourceLocation).with(VariantProperties.X_ROT, Rotation.R90), + Variant.variant().with(VariantProperties.MODEL, resourceLocation).with(VariantProperties.X_ROT, Rotation.R180), + Variant.variant().with(VariantProperties.MODEL, resourceLocation).with(VariantProperties.X_ROT, Rotation.R270), + Variant.variant().with(VariantProperties.MODEL, resourceLocation).with(VariantProperties.Y_ROT, Rotation.R90), + Variant.variant().with(VariantProperties.MODEL, resourceLocation).with(VariantProperties.Y_ROT, Rotation.R90).with(VariantProperties.X_ROT, Rotation.R90), + Variant.variant().with(VariantProperties.MODEL, resourceLocation).with(VariantProperties.Y_ROT, Rotation.R90).with(VariantProperties.X_ROT, Rotation.R180), + Variant.variant().with(VariantProperties.MODEL, resourceLocation).with(VariantProperties.Y_ROT, Rotation.R90).with(VariantProperties.X_ROT, Rotation.R270), + Variant.variant().with(VariantProperties.MODEL, resourceLocation).with(VariantProperties.Y_ROT, Rotation.R180), + Variant.variant().with(VariantProperties.MODEL, resourceLocation).with(VariantProperties.Y_ROT, Rotation.R180).with(VariantProperties.X_ROT, Rotation.R90), Variant.variant() .with(VariantProperties.MODEL, resourceLocation) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90) - .with(VariantProperties.X_ROT, VariantProperties.Rotation.R90), + .with(VariantProperties.Y_ROT, Rotation.R180) + .with(VariantProperties.X_ROT, Rotation.R180), Variant.variant() .with(VariantProperties.MODEL, resourceLocation) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90) - .with(VariantProperties.X_ROT, VariantProperties.Rotation.R180), + .with(VariantProperties.Y_ROT, Rotation.R180) + .with(VariantProperties.X_ROT, Rotation.R270), + Variant.variant().with(VariantProperties.MODEL, resourceLocation).with(VariantProperties.Y_ROT, Rotation.R270), + Variant.variant().with(VariantProperties.MODEL, resourceLocation).with(VariantProperties.Y_ROT, Rotation.R270).with(VariantProperties.X_ROT, Rotation.R90), Variant.variant() .with(VariantProperties.MODEL, resourceLocation) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90) - .with(VariantProperties.X_ROT, VariantProperties.Rotation.R270), - Variant.variant().with(VariantProperties.MODEL, resourceLocation).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R180), + .with(VariantProperties.Y_ROT, Rotation.R270) + .with(VariantProperties.X_ROT, Rotation.R180), Variant.variant() .with(VariantProperties.MODEL, resourceLocation) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R180) - .with(VariantProperties.X_ROT, VariantProperties.Rotation.R90), - Variant.variant() - .with(VariantProperties.MODEL, resourceLocation) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R180) - .with(VariantProperties.X_ROT, VariantProperties.Rotation.R180), - Variant.variant() - .with(VariantProperties.MODEL, resourceLocation) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R180) - .with(VariantProperties.X_ROT, VariantProperties.Rotation.R270), - Variant.variant().with(VariantProperties.MODEL, resourceLocation).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R270), - Variant.variant() - .with(VariantProperties.MODEL, resourceLocation) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R270) - .with(VariantProperties.X_ROT, VariantProperties.Rotation.R90), - Variant.variant() - .with(VariantProperties.MODEL, resourceLocation) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R270) - .with(VariantProperties.X_ROT, VariantProperties.Rotation.R180), - Variant.variant() - .with(VariantProperties.MODEL, resourceLocation) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R270) - .with(VariantProperties.X_ROT, VariantProperties.Rotation.R270) + .with(VariantProperties.Y_ROT, Rotation.R270) + .with(VariantProperties.X_ROT, Rotation.R270) ) ); } @@ -3600,14 +3289,14 @@ public class BlockModelGenerators { private void createRedstoneTorch() { TextureMapping textureMapping = TextureMapping.torch(Blocks.REDSTONE_TORCH); TextureMapping textureMapping2 = TextureMapping.torch(TextureMapping.getBlockTexture(Blocks.REDSTONE_TORCH, "_off")); - ResourceLocation resourceLocation = ModelTemplates.TORCH.create(Blocks.REDSTONE_TORCH, textureMapping, this.modelOutput); - ResourceLocation resourceLocation2 = ModelTemplates.TORCH.createWithSuffix(Blocks.REDSTONE_TORCH, "_off", textureMapping2, this.modelOutput); + ResourceLocation resourceLocation = ModelTemplates.REDSTONE_TORCH.create(Blocks.REDSTONE_TORCH, textureMapping, this.modelOutput); + ResourceLocation resourceLocation2 = ModelTemplates.TORCH_UNLIT.createWithSuffix(Blocks.REDSTONE_TORCH, "_off", textureMapping2, this.modelOutput); this.blockStateOutput .accept( MultiVariantGenerator.multiVariant(Blocks.REDSTONE_TORCH).with(createBooleanModelDispatch(BlockStateProperties.LIT, resourceLocation, resourceLocation2)) ); - ResourceLocation resourceLocation3 = ModelTemplates.WALL_TORCH.create(Blocks.REDSTONE_WALL_TORCH, textureMapping, this.modelOutput); - ResourceLocation resourceLocation4 = ModelTemplates.WALL_TORCH.createWithSuffix(Blocks.REDSTONE_WALL_TORCH, "_off", textureMapping2, this.modelOutput); + ResourceLocation resourceLocation3 = ModelTemplates.REDSTONE_WALL_TORCH.create(Blocks.REDSTONE_WALL_TORCH, textureMapping, this.modelOutput); + ResourceLocation resourceLocation4 = ModelTemplates.WALL_TORCH_UNLIT.createWithSuffix(Blocks.REDSTONE_WALL_TORCH, "_off", textureMapping2, this.modelOutput); this.blockStateOutput .accept( MultiVariantGenerator.multiVariant(Blocks.REDSTONE_WALL_TORCH) @@ -3740,9 +3429,7 @@ public class BlockModelGenerators { false, false, false, - Variant.variant() - .with(VariantProperties.MODEL, ModelLocationUtils.getModelLocation(Blocks.TRIPWIRE, "_n")) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90) + Variant.variant().with(VariantProperties.MODEL, ModelLocationUtils.getModelLocation(Blocks.TRIPWIRE, "_n")).with(VariantProperties.Y_ROT, Rotation.R90) ) .select(false, false, true, false, false, Variant.variant().with(VariantProperties.MODEL, ModelLocationUtils.getModelLocation(Blocks.TRIPWIRE, "_n"))) .select( @@ -3753,7 +3440,7 @@ public class BlockModelGenerators { false, Variant.variant() .with(VariantProperties.MODEL, ModelLocationUtils.getModelLocation(Blocks.TRIPWIRE, "_n")) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R180) + .with(VariantProperties.Y_ROT, Rotation.R180) ) .select( false, @@ -3763,7 +3450,7 @@ public class BlockModelGenerators { true, Variant.variant() .with(VariantProperties.MODEL, ModelLocationUtils.getModelLocation(Blocks.TRIPWIRE, "_n")) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R270) + .with(VariantProperties.Y_ROT, Rotation.R270) ) .select(false, true, true, false, false, Variant.variant().with(VariantProperties.MODEL, ModelLocationUtils.getModelLocation(Blocks.TRIPWIRE, "_ne"))) .select( @@ -3774,7 +3461,7 @@ public class BlockModelGenerators { false, Variant.variant() .with(VariantProperties.MODEL, ModelLocationUtils.getModelLocation(Blocks.TRIPWIRE, "_ne")) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90) + .with(VariantProperties.Y_ROT, Rotation.R90) ) .select( false, @@ -3784,7 +3471,7 @@ public class BlockModelGenerators { true, Variant.variant() .with(VariantProperties.MODEL, ModelLocationUtils.getModelLocation(Blocks.TRIPWIRE, "_ne")) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R180) + .with(VariantProperties.Y_ROT, Rotation.R180) ) .select( false, @@ -3794,7 +3481,7 @@ public class BlockModelGenerators { true, Variant.variant() .with(VariantProperties.MODEL, ModelLocationUtils.getModelLocation(Blocks.TRIPWIRE, "_ne")) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R270) + .with(VariantProperties.Y_ROT, Rotation.R270) ) .select(false, false, true, true, false, Variant.variant().with(VariantProperties.MODEL, ModelLocationUtils.getModelLocation(Blocks.TRIPWIRE, "_ns"))) .select( @@ -3805,7 +3492,7 @@ public class BlockModelGenerators { true, Variant.variant() .with(VariantProperties.MODEL, ModelLocationUtils.getModelLocation(Blocks.TRIPWIRE, "_ns")) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90) + .with(VariantProperties.Y_ROT, Rotation.R90) ) .select(false, true, true, true, false, Variant.variant().with(VariantProperties.MODEL, ModelLocationUtils.getModelLocation(Blocks.TRIPWIRE, "_nse"))) .select( @@ -3816,7 +3503,7 @@ public class BlockModelGenerators { true, Variant.variant() .with(VariantProperties.MODEL, ModelLocationUtils.getModelLocation(Blocks.TRIPWIRE, "_nse")) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90) + .with(VariantProperties.Y_ROT, Rotation.R90) ) .select( false, @@ -3826,7 +3513,7 @@ public class BlockModelGenerators { true, Variant.variant() .with(VariantProperties.MODEL, ModelLocationUtils.getModelLocation(Blocks.TRIPWIRE, "_nse")) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R180) + .with(VariantProperties.Y_ROT, Rotation.R180) ) .select( false, @@ -3836,7 +3523,7 @@ public class BlockModelGenerators { true, Variant.variant() .with(VariantProperties.MODEL, ModelLocationUtils.getModelLocation(Blocks.TRIPWIRE, "_nse")) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R270) + .with(VariantProperties.Y_ROT, Rotation.R270) ) .select(false, true, true, true, true, Variant.variant().with(VariantProperties.MODEL, ModelLocationUtils.getModelLocation(Blocks.TRIPWIRE, "_nsew"))) .select( @@ -3853,7 +3540,7 @@ public class BlockModelGenerators { false, Variant.variant() .with(VariantProperties.MODEL, ModelLocationUtils.getModelLocation(Blocks.TRIPWIRE, "_attached_n")) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R180) + .with(VariantProperties.Y_ROT, Rotation.R180) ) .select( true, @@ -3863,7 +3550,7 @@ public class BlockModelGenerators { false, Variant.variant() .with(VariantProperties.MODEL, ModelLocationUtils.getModelLocation(Blocks.TRIPWIRE, "_attached_n")) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90) + .with(VariantProperties.Y_ROT, Rotation.R90) ) .select( true, @@ -3873,7 +3560,7 @@ public class BlockModelGenerators { true, Variant.variant() .with(VariantProperties.MODEL, ModelLocationUtils.getModelLocation(Blocks.TRIPWIRE, "_attached_n")) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R270) + .with(VariantProperties.Y_ROT, Rotation.R270) ) .select( true, true, true, false, false, Variant.variant().with(VariantProperties.MODEL, ModelLocationUtils.getModelLocation(Blocks.TRIPWIRE, "_attached_ne")) @@ -3886,7 +3573,7 @@ public class BlockModelGenerators { false, Variant.variant() .with(VariantProperties.MODEL, ModelLocationUtils.getModelLocation(Blocks.TRIPWIRE, "_attached_ne")) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90) + .with(VariantProperties.Y_ROT, Rotation.R90) ) .select( true, @@ -3896,7 +3583,7 @@ public class BlockModelGenerators { true, Variant.variant() .with(VariantProperties.MODEL, ModelLocationUtils.getModelLocation(Blocks.TRIPWIRE, "_attached_ne")) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R180) + .with(VariantProperties.Y_ROT, Rotation.R180) ) .select( true, @@ -3906,7 +3593,7 @@ public class BlockModelGenerators { true, Variant.variant() .with(VariantProperties.MODEL, ModelLocationUtils.getModelLocation(Blocks.TRIPWIRE, "_attached_ne")) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R270) + .with(VariantProperties.Y_ROT, Rotation.R270) ) .select( true, false, true, true, false, Variant.variant().with(VariantProperties.MODEL, ModelLocationUtils.getModelLocation(Blocks.TRIPWIRE, "_attached_ns")) @@ -3919,7 +3606,7 @@ public class BlockModelGenerators { true, Variant.variant() .with(VariantProperties.MODEL, ModelLocationUtils.getModelLocation(Blocks.TRIPWIRE, "_attached_ns")) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90) + .with(VariantProperties.Y_ROT, Rotation.R90) ) .select( true, true, true, true, false, Variant.variant().with(VariantProperties.MODEL, ModelLocationUtils.getModelLocation(Blocks.TRIPWIRE, "_attached_nse")) @@ -3932,7 +3619,7 @@ public class BlockModelGenerators { true, Variant.variant() .with(VariantProperties.MODEL, ModelLocationUtils.getModelLocation(Blocks.TRIPWIRE, "_attached_nse")) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90) + .with(VariantProperties.Y_ROT, Rotation.R90) ) .select( true, @@ -3942,7 +3629,7 @@ public class BlockModelGenerators { true, Variant.variant() .with(VariantProperties.MODEL, ModelLocationUtils.getModelLocation(Blocks.TRIPWIRE, "_attached_nse")) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R180) + .with(VariantProperties.Y_ROT, Rotation.R180) ) .select( true, @@ -3952,7 +3639,7 @@ public class BlockModelGenerators { true, Variant.variant() .with(VariantProperties.MODEL, ModelLocationUtils.getModelLocation(Blocks.TRIPWIRE, "_attached_nse")) - .with(VariantProperties.Y_ROT, VariantProperties.Rotation.R270) + .with(VariantProperties.Y_ROT, Rotation.R270) ) .select( true, true, true, true, true, Variant.variant().with(VariantProperties.MODEL, ModelLocationUtils.getModelLocation(Blocks.TRIPWIRE, "_attached_nsew")) @@ -4047,16 +3734,17 @@ public class BlockModelGenerators { this.createSimpleFlatItemModel(multifaceBlock); ResourceLocation resourceLocation = ModelLocationUtils.getModelLocation(multifaceBlock); MultiPartGenerator multiPartGenerator = MultiPartGenerator.multiPart(multifaceBlock); - Condition.TerminalCondition terminalCondition = Util.make( - Condition.condition(), terminalConditionx -> MULTIFACE_GENERATOR.stream().map(Pair::getFirst).forEach(booleanPropertyx -> { + TerminalCondition terminalCondition = Util.make( + Condition.condition(), + terminalConditionx -> MULTIFACE_GENERATOR.stream().map(Pair::getFirst).map(MultifaceBlock::getFaceProperty).forEach(booleanPropertyx -> { if (multifaceBlock.defaultBlockState().hasProperty(booleanPropertyx)) { terminalConditionx.term(booleanPropertyx, false); } }) ); - for (Pair> pair : MULTIFACE_GENERATOR) { - BooleanProperty booleanProperty = pair.getFirst(); + for (Pair> pair : MULTIFACE_GENERATOR) { + BooleanProperty booleanProperty = MultifaceBlock.getFaceProperty(pair.getFirst()); Function function = pair.getSecond(); if (multifaceBlock.defaultBlockState().hasProperty(booleanProperty)) { multiPartGenerator.with(Condition.condition().term(booleanProperty, true), (Variant)function.apply(resourceLocation)); @@ -4067,6 +3755,52 @@ public class BlockModelGenerators { this.blockStateOutput.accept(multiPartGenerator); } + private void createMossyCarpet(Block block) { + ResourceLocation resourceLocation = TexturedModel.CARPET.create(block, this.modelOutput); + ResourceLocation resourceLocation2 = TexturedModel.MOSSY_CARPET_SIDE + .get(block) + .updateTextures(textureMapping -> textureMapping.put(TextureSlot.SIDE, TextureMapping.getBlockTexture(block, "_side_tall"))) + .createWithSuffix(block, "_side_tall", this.modelOutput); + ResourceLocation resourceLocation3 = TexturedModel.MOSSY_CARPET_SIDE + .get(block) + .updateTextures(textureMapping -> textureMapping.put(TextureSlot.SIDE, TextureMapping.getBlockTexture(block, "_side_small"))) + .createWithSuffix(block, "_side_small", this.modelOutput); + MultiPartGenerator multiPartGenerator = MultiPartGenerator.multiPart(block); + TerminalCondition terminalCondition = Condition.condition().term(MossyCarpetBlock.BASE, false); + multiPartGenerator.with(Condition.condition().term(MossyCarpetBlock.BASE, true), Variant.variant().with(VariantProperties.MODEL, resourceLocation)); + multiPartGenerator.with(terminalCondition, Variant.variant().with(VariantProperties.MODEL, resourceLocation)); + MULTIFACE_GENERATOR.stream().map(Pair::getFirst).forEach(directionx -> { + EnumProperty enumPropertyx = MossyCarpetBlock.getPropertyForFace(directionx); + if (enumPropertyx != null && block.defaultBlockState().hasProperty(enumPropertyx)) { + terminalCondition.term(enumPropertyx, WallSide.NONE); + } + }); + + for (Pair> pair : MULTIFACE_GENERATOR) { + Direction direction = pair.getFirst(); + EnumProperty enumProperty = MossyCarpetBlock.getPropertyForFace(direction); + if (enumProperty != null) { + Function function = pair.getSecond(); + multiPartGenerator.with(Condition.condition().term(enumProperty, WallSide.TALL), (Variant)function.apply(resourceLocation2)); + multiPartGenerator.with(Condition.condition().term(enumProperty, WallSide.LOW), (Variant)function.apply(resourceLocation3)); + multiPartGenerator.with(terminalCondition, (Variant)function.apply(resourceLocation2)); + } + } + + this.blockStateOutput.accept(multiPartGenerator); + } + + private void createHangingMoss(Block block) { + PropertyDispatch propertyDispatch = PropertyDispatch.property(HangingMossBlock.TIP).generate(boolean_ -> { + String string = boolean_ ? "_tip" : ""; + TextureMapping textureMapping = TextureMapping.cross(TextureMapping.getBlockTexture(block, string)); + ResourceLocation resourceLocation = BlockModelGenerators.TintState.NOT_TINTED.getCross().createWithSuffix(block, string, textureMapping, this.modelOutput); + return Variant.variant().with(VariantProperties.MODEL, resourceLocation); + }); + this.createSimpleFlatItemModel(block); + this.blockStateOutput.accept(MultiVariantGenerator.multiVariant(block).with(propertyDispatch)); + } + private void createSculkCatalyst() { ResourceLocation resourceLocation = TextureMapping.getBlockTexture(Blocks.SCULK_CATALYST, "_bottom"); TextureMapping textureMapping = new TextureMapping() @@ -4095,16 +3829,16 @@ public class BlockModelGenerators { ResourceLocation resourceLocation = ModelLocationUtils.getModelLocation(block); MultiPartGenerator multiPartGenerator = MultiPartGenerator.multiPart(block); List.of( - Pair.of(Direction.NORTH, VariantProperties.Rotation.R0), - Pair.of(Direction.EAST, VariantProperties.Rotation.R90), - Pair.of(Direction.SOUTH, VariantProperties.Rotation.R180), - Pair.of(Direction.WEST, VariantProperties.Rotation.R270) + Pair.of(Direction.NORTH, Rotation.R0), + Pair.of(Direction.EAST, Rotation.R90), + Pair.of(Direction.SOUTH, Rotation.R180), + Pair.of(Direction.WEST, Rotation.R270) ) .forEach( pair -> { Direction direction = (Direction)pair.getFirst(); - VariantProperties.Rotation rotation = (VariantProperties.Rotation)pair.getSecond(); - Condition.TerminalCondition terminalCondition = Condition.condition().term(BlockStateProperties.HORIZONTAL_FACING, direction); + Rotation rotation = (Rotation)pair.getSecond(); + TerminalCondition terminalCondition = Condition.condition().term(BlockStateProperties.HORIZONTAL_FACING, direction); multiPartGenerator.with( terminalCondition, Variant.variant().with(VariantProperties.MODEL, resourceLocation).with(VariantProperties.Y_ROT, rotation).with(VariantProperties.UV_LOCK, true) @@ -4117,7 +3851,7 @@ public class BlockModelGenerators { CHISELED_BOOKSHELF_SLOT_MODEL_CACHE.clear(); } - private void addSlotStateAndRotationVariants(MultiPartGenerator generator, Condition.TerminalCondition condition, VariantProperties.Rotation rotation) { + private void addSlotStateAndRotationVariants(MultiPartGenerator generator, TerminalCondition condition, Rotation rotation) { List.of( Pair.of(BlockStateProperties.CHISELED_BOOKSHELF_SLOT_0_OCCUPIED, ModelTemplates.CHISELED_BOOKSHELF_SLOT_TOP_LEFT), Pair.of(BlockStateProperties.CHISELED_BOOKSHELF_SLOT_1_OCCUPIED, ModelTemplates.CHISELED_BOOKSHELF_SLOT_TOP_MID), @@ -4135,12 +3869,7 @@ public class BlockModelGenerators { } private void addBookSlotModel( - MultiPartGenerator generator, - Condition.TerminalCondition condition, - VariantProperties.Rotation rotation, - BooleanProperty hasBookProperty, - ModelTemplate template, - boolean hasBook + MultiPartGenerator generator, TerminalCondition condition, Rotation rotation, BooleanProperty hasBookProperty, ModelTemplate template, boolean hasBook ) { String string = hasBook ? "_occupied" : "_empty"; TextureMapping textureMapping = new TextureMapping().put(TextureSlot.TEXTURE, TextureMapping.getBlockTexture(Blocks.CHISELED_BOOKSHELF, string)); @@ -4228,29 +3957,29 @@ public class BlockModelGenerators { private Variant applyRotation(FrontAndTop frontAndTop, Variant variant) { switch (frontAndTop) { case DOWN_NORTH: - return variant.with(VariantProperties.X_ROT, VariantProperties.Rotation.R90); + return variant.with(VariantProperties.X_ROT, Rotation.R90); case DOWN_SOUTH: - return variant.with(VariantProperties.X_ROT, VariantProperties.Rotation.R90).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R180); + return variant.with(VariantProperties.X_ROT, Rotation.R90).with(VariantProperties.Y_ROT, Rotation.R180); case DOWN_WEST: - return variant.with(VariantProperties.X_ROT, VariantProperties.Rotation.R90).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R270); + return variant.with(VariantProperties.X_ROT, Rotation.R90).with(VariantProperties.Y_ROT, Rotation.R270); case DOWN_EAST: - return variant.with(VariantProperties.X_ROT, VariantProperties.Rotation.R90).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90); + return variant.with(VariantProperties.X_ROT, Rotation.R90).with(VariantProperties.Y_ROT, Rotation.R90); case UP_NORTH: - return variant.with(VariantProperties.X_ROT, VariantProperties.Rotation.R270).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R180); + return variant.with(VariantProperties.X_ROT, Rotation.R270).with(VariantProperties.Y_ROT, Rotation.R180); case UP_SOUTH: - return variant.with(VariantProperties.X_ROT, VariantProperties.Rotation.R270); + return variant.with(VariantProperties.X_ROT, Rotation.R270); case UP_WEST: - return variant.with(VariantProperties.X_ROT, VariantProperties.Rotation.R270).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90); + return variant.with(VariantProperties.X_ROT, Rotation.R270).with(VariantProperties.Y_ROT, Rotation.R90); case UP_EAST: - return variant.with(VariantProperties.X_ROT, VariantProperties.Rotation.R270).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R270); + return variant.with(VariantProperties.X_ROT, Rotation.R270).with(VariantProperties.Y_ROT, Rotation.R270); case NORTH_UP: return variant; case SOUTH_UP: - return variant.with(VariantProperties.Y_ROT, VariantProperties.Rotation.R180); + return variant.with(VariantProperties.Y_ROT, Rotation.R180); case WEST_UP: - return variant.with(VariantProperties.Y_ROT, VariantProperties.Rotation.R270); + return variant.with(VariantProperties.Y_ROT, Rotation.R270); case EAST_UP: - return variant.with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90); + return variant.with(VariantProperties.Y_ROT, Rotation.R90); default: throw new UnsupportedOperationException("Rotation " + frontAndTop + " can't be expressed with existing x and y values"); } @@ -4362,6 +4091,9 @@ public class BlockModelGenerators { this.createPottedAzalea(Blocks.POTTED_FLOWERING_AZALEA); this.createCaveVines(); this.createFullAndCarpetBlocks(Blocks.MOSS_BLOCK, Blocks.MOSS_CARPET); + this.createMossyCarpet(Blocks.PALE_MOSS_CARPET); + this.createHangingMoss(Blocks.PALE_HANGING_MOSS); + this.createTrivialCube(Blocks.PALE_MOSS_BLOCK); this.createFlowerBed(Blocks.PINK_PETALS); this.createAirLikeBlock(Blocks.BARRIER, Items.BARRIER); this.createSimpleFlatItemModel(Items.BARRIER); @@ -4419,6 +4151,7 @@ public class BlockModelGenerators { this.createTrivialCube(Blocks.SOUL_SAND); this.createTrivialCube(Blocks.SOUL_SOIL); this.createTrivialBlock(Blocks.SPAWNER, TexturedModel.CUBE_INNER_FACES); + this.createCreakingHeart(Blocks.CREAKING_HEART); this.createTrivialCube(Blocks.SPONGE); this.createTrivialBlock(Blocks.SEAGRASS, TexturedModel.SEAGRASS); this.createSimpleFlatItemModel(Items.SEAGRASS); @@ -4939,6 +4672,11 @@ public class BlockModelGenerators { this.createHangingSign(Blocks.STRIPPED_DARK_OAK_LOG, Blocks.DARK_OAK_HANGING_SIGN, Blocks.DARK_OAK_WALL_HANGING_SIGN); this.createPlant(Blocks.DARK_OAK_SAPLING, Blocks.POTTED_DARK_OAK_SAPLING, BlockModelGenerators.TintState.NOT_TINTED); this.createTrivialBlock(Blocks.DARK_OAK_LEAVES, TexturedModel.LEAVES); + this.woodProvider(Blocks.PALE_OAK_LOG).logWithHorizontal(Blocks.PALE_OAK_LOG).wood(Blocks.PALE_OAK_WOOD); + this.woodProvider(Blocks.STRIPPED_PALE_OAK_LOG).logWithHorizontal(Blocks.STRIPPED_PALE_OAK_LOG).wood(Blocks.STRIPPED_PALE_OAK_WOOD); + this.createHangingSign(Blocks.STRIPPED_PALE_OAK_LOG, Blocks.PALE_OAK_HANGING_SIGN, Blocks.PALE_OAK_WALL_HANGING_SIGN); + this.createPlant(Blocks.PALE_OAK_SAPLING, Blocks.POTTED_PALE_OAK_SAPLING, BlockModelGenerators.TintState.NOT_TINTED); + this.createTrivialBlock(Blocks.PALE_OAK_LEAVES, TexturedModel.LEAVES); this.woodProvider(Blocks.JUNGLE_LOG).logWithHorizontal(Blocks.JUNGLE_LOG).wood(Blocks.JUNGLE_WOOD); this.woodProvider(Blocks.STRIPPED_JUNGLE_LOG).logWithHorizontal(Blocks.STRIPPED_JUNGLE_LOG).wood(Blocks.STRIPPED_JUNGLE_WOOD); this.createHangingSign(Blocks.STRIPPED_JUNGLE_LOG, Blocks.JUNGLE_HANGING_SIGN, Blocks.JUNGLE_WALL_HANGING_SIGN); @@ -5193,7 +4931,7 @@ public class BlockModelGenerators { if (this.family == null) { throw new IllegalStateException("Family not defined"); } else { - Block block = (Block)this.family.getVariants().get(BlockFamily.Variant.WALL_SIGN); + Block block = (Block)this.family.getVariants().get(net.minecraft.data.BlockFamily.Variant.WALL_SIGN); ResourceLocation resourceLocation = ModelTemplates.PARTICLE_ONLY.create(signBlock, this.mapping, BlockModelGenerators.this.modelOutput); BlockModelGenerators.this.blockStateOutput.accept(BlockModelGenerators.createSimpleBlock(signBlock, resourceLocation)); BlockModelGenerators.this.blockStateOutput.accept(BlockModelGenerators.createSimpleBlock(block, resourceLocation)); diff --git a/net/minecraft/data/models/EquipmentModelProvider.java b/net/minecraft/data/models/EquipmentModelProvider.java new file mode 100644 index 00000000..8ddb404c --- /dev/null +++ b/net/minecraft/data/models/EquipmentModelProvider.java @@ -0,0 +1,37 @@ +package net.minecraft.data.models; + +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.CompletableFuture; +import net.minecraft.data.CachedOutput; +import net.minecraft.data.DataProvider; +import net.minecraft.data.PackOutput; +import net.minecraft.data.PackOutput.PathProvider; +import net.minecraft.data.PackOutput.Target; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.equipment.EquipmentModel; +import net.minecraft.world.item.equipment.EquipmentModels; + +public class EquipmentModelProvider implements DataProvider { + private final PathProvider pathProvider; + + public EquipmentModelProvider(PackOutput packOutput) { + this.pathProvider = packOutput.createPathProvider(Target.RESOURCE_PACK, "models/equipment"); + } + + @Override + public CompletableFuture run(CachedOutput output) { + Map map = new HashMap(); + EquipmentModels.bootstrap((resourceLocation, equipmentModel) -> { + if (map.putIfAbsent(resourceLocation, equipmentModel) != null) { + throw new IllegalStateException("Tried to register equipment model twice for id: " + resourceLocation); + } + }); + return DataProvider.saveAll(output, EquipmentModel.CODEC, this.pathProvider, map); + } + + @Override + public String getName() { + return "Equipment Model Definitions"; + } +} diff --git a/net/minecraft/data/models/ItemModelGenerators.java b/net/minecraft/data/models/ItemModelGenerators.java index 2ccd7a4c..1691673d 100644 --- a/net/minecraft/data/models/ItemModelGenerators.java +++ b/net/minecraft/data/models/ItemModelGenerators.java @@ -3,12 +3,13 @@ package net.minecraft.data.models; import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonObject; +import java.util.HashMap; import java.util.List; import java.util.Locale; import java.util.Map; import java.util.function.BiConsumer; import java.util.function.Supplier; -import net.minecraft.core.Holder; +import net.minecraft.core.component.DataComponents; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.data.models.model.ModelLocationUtils; import net.minecraft.data.models.model.ModelTemplate; @@ -16,23 +17,24 @@ import net.minecraft.data.models.model.ModelTemplates; import net.minecraft.data.models.model.TextureMapping; import net.minecraft.data.models.model.TextureSlot; import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.item.ArmorItem; -import net.minecraft.world.item.ArmorMaterial; -import net.minecraft.world.item.ArmorMaterials; +import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.item.Item; import net.minecraft.world.item.Items; +import net.minecraft.world.item.equipment.EquipmentModel; +import net.minecraft.world.item.equipment.EquipmentModels; +import net.minecraft.world.item.equipment.Equippable; public class ItemModelGenerators { public static final ResourceLocation TRIM_TYPE_PREDICATE_ID = ResourceLocation.withDefaultNamespace("trim_type"); private static final List GENERATED_TRIM_MODELS = List.of( new ItemModelGenerators.TrimModelData("quartz", 0.1F, Map.of()), - new ItemModelGenerators.TrimModelData("iron", 0.2F, Map.of(ArmorMaterials.IRON, "iron_darker")), - new ItemModelGenerators.TrimModelData("netherite", 0.3F, Map.of(ArmorMaterials.NETHERITE, "netherite_darker")), + new ItemModelGenerators.TrimModelData("iron", 0.2F, Map.of(EquipmentModels.IRON, "iron_darker")), + new ItemModelGenerators.TrimModelData("netherite", 0.3F, Map.of(EquipmentModels.NETHERITE, "netherite_darker")), new ItemModelGenerators.TrimModelData("redstone", 0.4F, Map.of()), new ItemModelGenerators.TrimModelData("copper", 0.5F, Map.of()), - new ItemModelGenerators.TrimModelData("gold", 0.6F, Map.of(ArmorMaterials.GOLD, "gold_darker")), + new ItemModelGenerators.TrimModelData("gold", 0.6F, Map.of(EquipmentModels.GOLD, "gold_darker")), new ItemModelGenerators.TrimModelData("emerald", 0.7F, Map.of()), - new ItemModelGenerators.TrimModelData("diamond", 0.8F, Map.of(ArmorMaterials.DIAMOND, "diamond_darker")), + new ItemModelGenerators.TrimModelData("diamond", 0.8F, Map.of(EquipmentModels.DIAMOND, "diamond_darker")), new ItemModelGenerators.TrimModelData("lapis", 0.9F, Map.of()), new ItemModelGenerators.TrimModelData("amethyst", 1.0F, Map.of()) ); @@ -86,10 +88,8 @@ public class ItemModelGenerators { return modelLocation.withSuffix("_" + trimId + "_trim"); } - private JsonObject generateBaseArmorTrimTemplate( - ResourceLocation modelLocation, Map modelGetter, Holder armorMaterial - ) { - JsonObject jsonObject = ModelTemplates.TWO_LAYERED_ITEM.createBaseTemplate(modelLocation, modelGetter); + private JsonObject generateBaseArmorTrimTemplate(ResourceLocation resourceLocation, Map map, ResourceLocation resourceLocation2) { + JsonObject jsonObject = ModelTemplates.TWO_LAYERED_ITEM.createBaseTemplate(resourceLocation, map); JsonArray jsonArray = new JsonArray(); for (ItemModelGenerators.TrimModelData trimModelData : GENERATED_TRIM_MODELS) { @@ -97,7 +97,7 @@ public class ItemModelGenerators { JsonObject jsonObject3 = new JsonObject(); jsonObject3.addProperty(TRIM_TYPE_PREDICATE_ID.getPath(), trimModelData.itemModelIndex()); jsonObject2.add("predicate", jsonObject3); - jsonObject2.addProperty("model", this.getItemModelForTrimMaterial(modelLocation, trimModelData.name(armorMaterial)).toString()); + jsonObject2.addProperty("model", this.getItemModelForTrimMaterial(resourceLocation, trimModelData.name(resourceLocation2)).toString()); jsonArray.add(jsonObject2); } @@ -105,38 +105,47 @@ public class ItemModelGenerators { return jsonObject; } - private void generateArmorTrims(ArmorItem armorItem) { - if (armorItem.getType().hasTrims()) { - ResourceLocation resourceLocation = ModelLocationUtils.getModelLocation(armorItem); - ResourceLocation resourceLocation2 = TextureMapping.getItemTexture(armorItem); - ResourceLocation resourceLocation3 = TextureMapping.getItemTexture(armorItem, "_overlay"); - if (armorItem.getMaterial().is(ArmorMaterials.LEATHER)) { + private void generateArmorTrims(Item item, ResourceLocation resourceLocation, EquipmentModel equipmentModel, EquipmentSlot equipmentSlot) { + List list = equipmentModel.getLayers(EquipmentModel.LayerType.HUMANOID); + if (!list.isEmpty()) { + boolean bl = list.size() == 2 && ((EquipmentModel.Layer)list.getFirst()).dyeable().isPresent(); + ResourceLocation resourceLocation2 = ModelLocationUtils.getModelLocation(item); + ResourceLocation resourceLocation3 = TextureMapping.getItemTexture(item); + ResourceLocation resourceLocation4 = TextureMapping.getItemTexture(item, "_overlay"); + if (bl) { ModelTemplates.TWO_LAYERED_ITEM .create( - resourceLocation, - TextureMapping.layered(resourceLocation2, resourceLocation3), + resourceLocation2, + TextureMapping.layered(resourceLocation3, resourceLocation4), this.output, - (resourceLocationx, map) -> this.generateBaseArmorTrimTemplate(resourceLocationx, map, armorItem.getMaterial()) + (resourceLocation2x, map) -> this.generateBaseArmorTrimTemplate(resourceLocation2x, map, resourceLocation) ); } else { ModelTemplates.FLAT_ITEM .create( - resourceLocation, - TextureMapping.layer0(resourceLocation2), + resourceLocation2, + TextureMapping.layer0(resourceLocation3), this.output, - (resourceLocationx, map) -> this.generateBaseArmorTrimTemplate(resourceLocationx, map, armorItem.getMaterial()) + (resourceLocation2x, map) -> this.generateBaseArmorTrimTemplate(resourceLocation2x, map, resourceLocation) ); } + String string = switch (equipmentSlot) { + case HEAD -> "helmet"; + case CHEST -> "chestplate"; + case LEGS -> "leggings"; + case FEET -> "boots"; + default -> throw new UnsupportedOperationException(); + }; for (ItemModelGenerators.TrimModelData trimModelData : GENERATED_TRIM_MODELS) { - String string = trimModelData.name(armorItem.getMaterial()); - ResourceLocation resourceLocation4 = this.getItemModelForTrimMaterial(resourceLocation, string); - String string2 = armorItem.getType().getName() + "_trim_" + string; - ResourceLocation resourceLocation5 = ResourceLocation.withDefaultNamespace(string2).withPrefix("trims/items/"); - if (armorItem.getMaterial().is(ArmorMaterials.LEATHER)) { - this.generateLayeredItem(resourceLocation4, resourceLocation2, resourceLocation3, resourceLocation5); + String string2 = trimModelData.name(resourceLocation); + ResourceLocation resourceLocation5 = this.getItemModelForTrimMaterial(resourceLocation2, string2); + String string3 = string + "_trim_" + string2; + ResourceLocation resourceLocation6 = ResourceLocation.withDefaultNamespace(string3).withPrefix("trims/items/"); + if (bl) { + this.generateLayeredItem(resourceLocation5, resourceLocation3, resourceLocation4, resourceLocation6); } else { - this.generateLayeredItem(resourceLocation4, resourceLocation2, resourceLocation5); + this.generateLayeredItem(resourceLocation5, resourceLocation3, resourceLocation6); } } } @@ -164,11 +173,12 @@ public class ItemModelGenerators { this.generateFlatItem(Items.BLAZE_ROD, ModelTemplates.FLAT_HANDHELD_ITEM); this.generateFlatItem(Items.BLUE_DYE, ModelTemplates.FLAT_ITEM); this.generateFlatItem(Items.BONE_MEAL, ModelTemplates.FLAT_ITEM); + this.generateFlatItem(Items.BORDURE_INDENTED_BANNER_PATTERN, ModelTemplates.FLAT_ITEM); this.generateFlatItem(Items.BOOK, ModelTemplates.FLAT_ITEM); this.generateFlatItem(Items.BOWL, ModelTemplates.FLAT_ITEM); this.generateFlatItem(Items.BREAD, ModelTemplates.FLAT_ITEM); this.generateFlatItem(Items.BRICK, ModelTemplates.FLAT_ITEM); - this.generateFlatItem(Items.BREEZE_ROD, ModelTemplates.FLAT_ITEM); + this.generateFlatItem(Items.BREEZE_ROD, ModelTemplates.FLAT_HANDHELD_ITEM); this.generateFlatItem(Items.BROWN_DYE, ModelTemplates.FLAT_ITEM); this.generateFlatItem(Items.BUCKET, ModelTemplates.FLAT_ITEM); this.generateFlatItem(Items.CARROT_ON_A_STICK, ModelTemplates.FLAT_HANDHELD_ROD_ITEM); @@ -215,6 +225,7 @@ public class ItemModelGenerators { this.generateFlatItem(Items.END_CRYSTAL, ModelTemplates.FLAT_ITEM); this.generateFlatItem(Items.EXPERIENCE_BOTTLE, ModelTemplates.FLAT_ITEM); this.generateFlatItem(Items.FERMENTED_SPIDER_EYE, ModelTemplates.FLAT_ITEM); + this.generateFlatItem(Items.FIELD_MASONED_BANNER_PATTERN, ModelTemplates.FLAT_ITEM); this.generateFlatItem(Items.FIREWORK_ROCKET, ModelTemplates.FLAT_ITEM); this.generateFlatItem(Items.FIRE_CHARGE, ModelTemplates.FLAT_ITEM); this.generateFlatItem(Items.FLINT, ModelTemplates.FLAT_ITEM); @@ -318,6 +329,8 @@ public class ItemModelGenerators { this.generateFlatItem(Items.OAK_CHEST_BOAT, ModelTemplates.FLAT_ITEM); this.generateFlatItem(Items.ORANGE_DYE, ModelTemplates.FLAT_ITEM); this.generateFlatItem(Items.PAINTING, ModelTemplates.FLAT_ITEM); + this.generateFlatItem(Items.PALE_OAK_BOAT, ModelTemplates.FLAT_ITEM); + this.generateFlatItem(Items.PALE_OAK_CHEST_BOAT, ModelTemplates.FLAT_ITEM); this.generateFlatItem(Items.PAPER, ModelTemplates.FLAT_ITEM); this.generateFlatItem(Items.PHANTOM_MEMBRANE, ModelTemplates.FLAT_ITEM); this.generateFlatItem(Items.PIGLIN_BANNER_PATTERN, ModelTemplates.FLAT_ITEM); @@ -404,10 +417,19 @@ public class ItemModelGenerators { this.generateFlatItem(Items.BOLT_ARMOR_TRIM_SMITHING_TEMPLATE, ModelTemplates.FLAT_ITEM); this.generateFlatItem(Items.DEBUG_STICK, Items.STICK, ModelTemplates.FLAT_HANDHELD_ITEM); this.generateFlatItem(Items.ENCHANTED_GOLDEN_APPLE, Items.GOLDEN_APPLE, ModelTemplates.FLAT_ITEM); + Map map = new HashMap(); + EquipmentModels.bootstrap(map::put); for (Item item : BuiltInRegistries.ITEM) { - if (item instanceof ArmorItem armorItem) { - this.generateArmorTrims(armorItem); + Equippable equippable = item.components().get(DataComponents.EQUIPPABLE); + if (equippable != null && equippable.slot().getType() == EquipmentSlot.Type.HUMANOID_ARMOR && equippable.model().isPresent()) { + ResourceLocation resourceLocation = (ResourceLocation)equippable.model().get(); + EquipmentModel equipmentModel = (EquipmentModel)map.get(resourceLocation); + if (equipmentModel == null) { + throw new IllegalStateException("Referenced equipment model does not exist: " + resourceLocation); + } + + this.generateArmorTrims(item, resourceLocation, equipmentModel, equippable.slot()); } } @@ -437,11 +459,28 @@ public class ItemModelGenerators { this.generateFlatItem(Items.TRIAL_KEY, ModelTemplates.FLAT_ITEM); this.generateFlatItem(Items.OMINOUS_TRIAL_KEY, ModelTemplates.FLAT_ITEM); this.generateFlatItem(Items.OMINOUS_BOTTLE, ModelTemplates.FLAT_ITEM); + this.generateFlatItem(Items.BUNDLE, ModelTemplates.FLAT_ITEM); + this.generateFlatItem(Items.BLACK_BUNDLE, ModelTemplates.FLAT_ITEM); + this.generateFlatItem(Items.WHITE_BUNDLE, ModelTemplates.FLAT_ITEM); + this.generateFlatItem(Items.GRAY_BUNDLE, ModelTemplates.FLAT_ITEM); + this.generateFlatItem(Items.LIGHT_GRAY_BUNDLE, ModelTemplates.FLAT_ITEM); + this.generateFlatItem(Items.LIGHT_BLUE_BUNDLE, ModelTemplates.FLAT_ITEM); + this.generateFlatItem(Items.BLUE_BUNDLE, ModelTemplates.FLAT_ITEM); + this.generateFlatItem(Items.CYAN_BUNDLE, ModelTemplates.FLAT_ITEM); + this.generateFlatItem(Items.YELLOW_BUNDLE, ModelTemplates.FLAT_ITEM); + this.generateFlatItem(Items.RED_BUNDLE, ModelTemplates.FLAT_ITEM); + this.generateFlatItem(Items.PURPLE_BUNDLE, ModelTemplates.FLAT_ITEM); + this.generateFlatItem(Items.MAGENTA_BUNDLE, ModelTemplates.FLAT_ITEM); + this.generateFlatItem(Items.PINK_BUNDLE, ModelTemplates.FLAT_ITEM); + this.generateFlatItem(Items.GREEN_BUNDLE, ModelTemplates.FLAT_ITEM); + this.generateFlatItem(Items.LIME_BUNDLE, ModelTemplates.FLAT_ITEM); + this.generateFlatItem(Items.BROWN_BUNDLE, ModelTemplates.FLAT_ITEM); + this.generateFlatItem(Items.ORANGE_BUNDLE, ModelTemplates.FLAT_ITEM); } - record TrimModelData(String name, float itemModelIndex, Map, String> overrideArmorMaterials) { - public String name(Holder armorMaterial) { - return (String)this.overrideArmorMaterials.getOrDefault(armorMaterial, this.name); + record TrimModelData(String name, float itemModelIndex, Map overrideArmorMaterials) { + public String name(ResourceLocation resourceLocation) { + return (String)this.overrideArmorMaterials.getOrDefault(resourceLocation, this.name); } } } diff --git a/net/minecraft/data/models/ModelProvider.java b/net/minecraft/data/models/ModelProvider.java index 06445db0..3e97b992 100644 --- a/net/minecraft/data/models/ModelProvider.java +++ b/net/minecraft/data/models/ModelProvider.java @@ -17,6 +17,8 @@ import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.data.CachedOutput; import net.minecraft.data.DataProvider; import net.minecraft.data.PackOutput; +import net.minecraft.data.PackOutput.PathProvider; +import net.minecraft.data.PackOutput.Target; import net.minecraft.data.models.blockstates.BlockStateGenerator; import net.minecraft.data.models.model.DelegatedModel; import net.minecraft.data.models.model.ModelLocationUtils; @@ -25,12 +27,12 @@ import net.minecraft.world.item.Item; import net.minecraft.world.level.block.Block; public class ModelProvider implements DataProvider { - private final PackOutput.PathProvider blockStatePathProvider; - private final PackOutput.PathProvider modelPathProvider; + private final PathProvider blockStatePathProvider; + private final PathProvider modelPathProvider; public ModelProvider(PackOutput output) { - this.blockStatePathProvider = output.createPathProvider(PackOutput.Target.RESOURCE_PACK, "blockstates"); - this.modelPathProvider = output.createPathProvider(PackOutput.Target.RESOURCE_PACK, "models"); + this.blockStatePathProvider = output.createPathProvider(Target.RESOURCE_PACK, "blockstates"); + this.modelPathProvider = output.createPathProvider(Target.RESOURCE_PACK, "models"); } @Override diff --git a/net/minecraft/data/models/model/ModelTemplates.java b/net/minecraft/data/models/model/ModelTemplates.java index 907d5eab..ed89cb12 100644 --- a/net/minecraft/data/models/model/ModelTemplates.java +++ b/net/minecraft/data/models/model/ModelTemplates.java @@ -88,6 +88,7 @@ public class ModelTemplates { public static final ModelTemplate RAIL_RAISED_NE = create("template_rail_raised_ne", "_raised_ne", TextureSlot.RAIL); public static final ModelTemplate RAIL_RAISED_SW = create("template_rail_raised_sw", "_raised_sw", TextureSlot.RAIL); public static final ModelTemplate CARPET = create("carpet", TextureSlot.WOOL); + public static final ModelTemplate MOSSY_CARPET_SIDE = create("mossy_carpet_side", TextureSlot.SIDE); public static final ModelTemplate FLOWERBED_1 = create("flowerbed_1", "_1", TextureSlot.FLOWERBED, TextureSlot.STEM); public static final ModelTemplate FLOWERBED_2 = create("flowerbed_2", "_2", TextureSlot.FLOWERBED, TextureSlot.STEM); public static final ModelTemplate FLOWERBED_3 = create("flowerbed_3", "_3", TextureSlot.FLOWERBED, TextureSlot.STEM); @@ -133,7 +134,11 @@ public class ModelTemplates { public static final ModelTemplate LANTERN = create("template_lantern", TextureSlot.LANTERN); public static final ModelTemplate HANGING_LANTERN = create("template_hanging_lantern", "_hanging", TextureSlot.LANTERN); public static final ModelTemplate TORCH = create("template_torch", TextureSlot.TORCH); + public static final ModelTemplate TORCH_UNLIT = create("template_torch_unlit", TextureSlot.TORCH); public static final ModelTemplate WALL_TORCH = create("template_torch_wall", TextureSlot.TORCH); + public static final ModelTemplate WALL_TORCH_UNLIT = create("template_torch_wall_unlit", TextureSlot.TORCH); + public static final ModelTemplate REDSTONE_TORCH = create("template_redstone_torch", TextureSlot.TORCH); + public static final ModelTemplate REDSTONE_WALL_TORCH = create("template_redstone_torch_wall", TextureSlot.TORCH); public static final ModelTemplate PISTON = create("template_piston", TextureSlot.PLATFORM, TextureSlot.BOTTOM, TextureSlot.SIDE); public static final ModelTemplate PISTON_HEAD = create("template_piston_head", TextureSlot.PLATFORM, TextureSlot.SIDE, TextureSlot.UNSTICKY); public static final ModelTemplate PISTON_HEAD_SHORT = create("template_piston_head_short", TextureSlot.PLATFORM, TextureSlot.SIDE, TextureSlot.UNSTICKY); diff --git a/net/minecraft/data/models/model/TextureMapping.java b/net/minecraft/data/models/model/TextureMapping.java index bde56c2d..f75ec7c8 100644 --- a/net/minecraft/data/models/model/TextureMapping.java +++ b/net/minecraft/data/models/model/TextureMapping.java @@ -83,6 +83,10 @@ public class TextureMapping { return singleSlot(TextureSlot.CROSS, getBlockTexture(block)); } + public static TextureMapping side(Block block) { + return singleSlot(TextureSlot.SIDE, getBlockTexture(block)); + } + public static TextureMapping cross(ResourceLocation crossTextureLocation) { return singleSlot(TextureSlot.CROSS, crossTextureLocation); } diff --git a/net/minecraft/data/models/model/TexturedModel.java b/net/minecraft/data/models/model/TexturedModel.java index 1f7b83f4..5f7d3ba9 100644 --- a/net/minecraft/data/models/model/TexturedModel.java +++ b/net/minecraft/data/models/model/TexturedModel.java @@ -19,6 +19,7 @@ public class TexturedModel { public static final TexturedModel.Provider ORIENTABLE_ONLY_TOP = createDefault(TextureMapping::orientableCubeOnlyTop, ModelTemplates.CUBE_ORIENTABLE); public static final TexturedModel.Provider ORIENTABLE = createDefault(TextureMapping::orientableCube, ModelTemplates.CUBE_ORIENTABLE_TOP_BOTTOM); public static final TexturedModel.Provider CARPET = createDefault(TextureMapping::wool, ModelTemplates.CARPET); + public static final TexturedModel.Provider MOSSY_CARPET_SIDE = createDefault(TextureMapping::side, ModelTemplates.MOSSY_CARPET_SIDE); public static final TexturedModel.Provider FLOWERBED_1 = createDefault(TextureMapping::flowerbed, ModelTemplates.FLOWERBED_1); public static final TexturedModel.Provider FLOWERBED_2 = createDefault(TextureMapping::flowerbed, ModelTemplates.FLOWERBED_2); public static final TexturedModel.Provider FLOWERBED_3 = createDefault(TextureMapping::flowerbed, ModelTemplates.FLOWERBED_3); diff --git a/net/minecraft/data/recipes/RecipeBuilder.java b/net/minecraft/data/recipes/RecipeBuilder.java index a76e724d..72f4b573 100644 --- a/net/minecraft/data/recipes/RecipeBuilder.java +++ b/net/minecraft/data/recipes/RecipeBuilder.java @@ -2,9 +2,12 @@ package net.minecraft.data.recipes; import net.minecraft.advancements.Criterion; import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.core.registries.Registries; +import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.Item; import net.minecraft.world.item.crafting.CraftingBookCategory; +import net.minecraft.world.item.crafting.Recipe; import net.minecraft.world.level.ItemLike; import org.jetbrains.annotations.Nullable; @@ -17,10 +20,10 @@ public interface RecipeBuilder { Item getResult(); - void save(RecipeOutput recipeOutput, ResourceLocation id); + void save(RecipeOutput recipeOutput, ResourceKey> resourceKey); default void save(RecipeOutput recipeOutput) { - this.save(recipeOutput, getDefaultRecipeId(this.getResult())); + this.save(recipeOutput, ResourceKey.create(Registries.RECIPE, getDefaultRecipeId(this.getResult()))); } default void save(RecipeOutput recipeOutput, String id) { @@ -29,7 +32,7 @@ public interface RecipeBuilder { if (resourceLocation2.equals(resourceLocation)) { throw new IllegalStateException("Recipe " + id + " should remove its 'save' argument as it is equal to default one"); } else { - this.save(recipeOutput, resourceLocation2); + this.save(recipeOutput, ResourceKey.create(Registries.RECIPE, resourceLocation2)); } } diff --git a/net/minecraft/data/recipes/RecipeOutput.java b/net/minecraft/data/recipes/RecipeOutput.java index b8fbc788..c0c65f78 100644 --- a/net/minecraft/data/recipes/RecipeOutput.java +++ b/net/minecraft/data/recipes/RecipeOutput.java @@ -1,13 +1,15 @@ package net.minecraft.data.recipes; -import net.minecraft.advancements.Advancement; import net.minecraft.advancements.AdvancementHolder; -import net.minecraft.resources.ResourceLocation; +import net.minecraft.advancements.Advancement.Builder; +import net.minecraft.resources.ResourceKey; import net.minecraft.world.item.crafting.Recipe; import org.jetbrains.annotations.Nullable; public interface RecipeOutput { - void accept(ResourceLocation location, Recipe recipe, @Nullable AdvancementHolder advancement); + void accept(ResourceKey> resourceKey, Recipe recipe, @Nullable AdvancementHolder advancementHolder); - Advancement.Builder advancement(); + Builder advancement(); + + void includeRootAdvancement(); } diff --git a/net/minecraft/data/recipes/RecipeProvider.java b/net/minecraft/data/recipes/RecipeProvider.java index 643c959b..00c4b9f0 100644 --- a/net/minecraft/data/recipes/RecipeProvider.java +++ b/net/minecraft/data/recipes/RecipeProvider.java @@ -10,16 +10,17 @@ import java.util.Map; import java.util.Optional; import java.util.Set; import java.util.concurrent.CompletableFuture; -import java.util.function.BiFunction; -import net.minecraft.advancements.Advancement; -import net.minecraft.advancements.AdvancementHolder; +import java.util.stream.Stream; import net.minecraft.advancements.CriteriaTriggers; import net.minecraft.advancements.Criterion; -import net.minecraft.advancements.critereon.EnterBlockTrigger; -import net.minecraft.advancements.critereon.InventoryChangeTrigger; import net.minecraft.advancements.critereon.ItemPredicate; -import net.minecraft.advancements.critereon.MinMaxBounds; +import net.minecraft.advancements.critereon.EnterBlockTrigger.TriggerInstance; +import net.minecraft.advancements.critereon.InventoryChangeTrigger.TriggerInstance.Slots; +import net.minecraft.advancements.critereon.MinMaxBounds.Ints; +import net.minecraft.core.HolderGetter; import net.minecraft.core.HolderLookup; +import net.minecraft.core.component.DataComponentPatch; +import net.minecraft.core.component.DataComponents; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.core.registries.Registries; import net.minecraft.data.BlockFamilies; @@ -27,6 +28,10 @@ import net.minecraft.data.BlockFamily; import net.minecraft.data.CachedOutput; import net.minecraft.data.DataProvider; import net.minecraft.data.PackOutput; +import net.minecraft.data.BlockFamily.Variant; +import net.minecraft.data.PackOutput.PathProvider; +import net.minecraft.data.recipes.RecipeProvider.Runner.1; +import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.ItemTags; import net.minecraft.tags.TagKey; @@ -44,658 +49,598 @@ import net.minecraft.world.item.crafting.SmeltingRecipe; import net.minecraft.world.level.ItemLike; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.SuspiciousEffectHolder; import org.jetbrains.annotations.Nullable; -public abstract class RecipeProvider implements DataProvider { - final PackOutput.PathProvider recipePathProvider; - final PackOutput.PathProvider advancementPathProvider; - private final CompletableFuture registries; - private static final Map> SHAPE_BUILDERS = ImmutableMap.>builder() - .put(BlockFamily.Variant.BUTTON, (itemLike, itemLike2) -> buttonBuilder(itemLike, Ingredient.of(itemLike2))) - .put(BlockFamily.Variant.CHISELED, (itemLike, itemLike2) -> chiseledBuilder(RecipeCategory.BUILDING_BLOCKS, itemLike, Ingredient.of(itemLike2))) - .put(BlockFamily.Variant.CUT, (itemLike, itemLike2) -> cutBuilder(RecipeCategory.BUILDING_BLOCKS, itemLike, Ingredient.of(itemLike2))) - .put(BlockFamily.Variant.DOOR, (itemLike, itemLike2) -> doorBuilder(itemLike, Ingredient.of(itemLike2))) - .put(BlockFamily.Variant.CUSTOM_FENCE, (itemLike, itemLike2) -> fenceBuilder(itemLike, Ingredient.of(itemLike2))) - .put(BlockFamily.Variant.FENCE, (itemLike, itemLike2) -> fenceBuilder(itemLike, Ingredient.of(itemLike2))) - .put(BlockFamily.Variant.CUSTOM_FENCE_GATE, (itemLike, itemLike2) -> fenceGateBuilder(itemLike, Ingredient.of(itemLike2))) - .put(BlockFamily.Variant.FENCE_GATE, (itemLike, itemLike2) -> fenceGateBuilder(itemLike, Ingredient.of(itemLike2))) - .put(BlockFamily.Variant.SIGN, (itemLike, itemLike2) -> signBuilder(itemLike, Ingredient.of(itemLike2))) - .put(BlockFamily.Variant.SLAB, (itemLike, itemLike2) -> slabBuilder(RecipeCategory.BUILDING_BLOCKS, itemLike, Ingredient.of(itemLike2))) - .put(BlockFamily.Variant.STAIRS, (itemLike, itemLike2) -> stairBuilder(itemLike, Ingredient.of(itemLike2))) - .put(BlockFamily.Variant.PRESSURE_PLATE, (itemLike, itemLike2) -> pressurePlateBuilder(RecipeCategory.REDSTONE, itemLike, Ingredient.of(itemLike2))) - .put(BlockFamily.Variant.POLISHED, (itemLike, itemLike2) -> polishedBuilder(RecipeCategory.BUILDING_BLOCKS, itemLike, Ingredient.of(itemLike2))) - .put(BlockFamily.Variant.TRAPDOOR, (itemLike, itemLike2) -> trapdoorBuilder(itemLike, Ingredient.of(itemLike2))) - .put(BlockFamily.Variant.WALL, (itemLike, itemLike2) -> wallBuilder(RecipeCategory.DECORATIONS, itemLike, Ingredient.of(itemLike2))) +public abstract class RecipeProvider { + protected final HolderLookup.Provider registries; + private final HolderGetter items; + protected final RecipeOutput output; + private static final Map SHAPE_BUILDERS = ImmutableMap.builder() + .put(Variant.BUTTON, (recipeProvider, itemLike, itemLike2) -> recipeProvider.buttonBuilder(itemLike, Ingredient.of(itemLike2))) + .put( + Variant.CHISELED, + (recipeProvider, itemLike, itemLike2) -> recipeProvider.chiseledBuilder(RecipeCategory.BUILDING_BLOCKS, itemLike, Ingredient.of(itemLike2)) + ) + .put(Variant.CUT, (recipeProvider, itemLike, itemLike2) -> recipeProvider.cutBuilder(RecipeCategory.BUILDING_BLOCKS, itemLike, Ingredient.of(itemLike2))) + .put(Variant.DOOR, (recipeProvider, itemLike, itemLike2) -> recipeProvider.doorBuilder(itemLike, Ingredient.of(itemLike2))) + .put(Variant.CUSTOM_FENCE, (recipeProvider, itemLike, itemLike2) -> recipeProvider.fenceBuilder(itemLike, Ingredient.of(itemLike2))) + .put(Variant.FENCE, (recipeProvider, itemLike, itemLike2) -> recipeProvider.fenceBuilder(itemLike, Ingredient.of(itemLike2))) + .put(Variant.CUSTOM_FENCE_GATE, (recipeProvider, itemLike, itemLike2) -> recipeProvider.fenceGateBuilder(itemLike, Ingredient.of(itemLike2))) + .put(Variant.FENCE_GATE, (recipeProvider, itemLike, itemLike2) -> recipeProvider.fenceGateBuilder(itemLike, Ingredient.of(itemLike2))) + .put(Variant.SIGN, (recipeProvider, itemLike, itemLike2) -> recipeProvider.signBuilder(itemLike, Ingredient.of(itemLike2))) + .put(Variant.SLAB, (recipeProvider, itemLike, itemLike2) -> recipeProvider.slabBuilder(RecipeCategory.BUILDING_BLOCKS, itemLike, Ingredient.of(itemLike2))) + .put(Variant.STAIRS, (recipeProvider, itemLike, itemLike2) -> recipeProvider.stairBuilder(itemLike, Ingredient.of(itemLike2))) + .put( + Variant.PRESSURE_PLATE, + (recipeProvider, itemLike, itemLike2) -> recipeProvider.pressurePlateBuilder(RecipeCategory.REDSTONE, itemLike, Ingredient.of(itemLike2)) + ) + .put( + Variant.POLISHED, + (recipeProvider, itemLike, itemLike2) -> recipeProvider.polishedBuilder(RecipeCategory.BUILDING_BLOCKS, itemLike, Ingredient.of(itemLike2)) + ) + .put(Variant.TRAPDOOR, (recipeProvider, itemLike, itemLike2) -> recipeProvider.trapdoorBuilder(itemLike, Ingredient.of(itemLike2))) + .put(Variant.WALL, (recipeProvider, itemLike, itemLike2) -> recipeProvider.wallBuilder(RecipeCategory.DECORATIONS, itemLike, Ingredient.of(itemLike2))) .build(); - public RecipeProvider(PackOutput output, CompletableFuture registries) { - this.recipePathProvider = output.createRegistryElementsPathProvider(Registries.RECIPE); - this.advancementPathProvider = output.createRegistryElementsPathProvider(Registries.ADVANCEMENT); - this.registries = registries; + protected RecipeProvider(HolderLookup.Provider provider, RecipeOutput recipeOutput) { + this.registries = provider; + this.items = provider.lookupOrThrow(Registries.ITEM); + this.output = recipeOutput; } - @Override - public final CompletableFuture run(CachedOutput output) { - return this.registries.thenCompose(provider -> this.run(output, provider)); + protected abstract void buildRecipes(); + + protected void generateForEnabledBlockFamilies(FeatureFlagSet featureFlagSet) { + BlockFamilies.getAllFamilies().filter(BlockFamily::shouldGenerateRecipe).forEach(blockFamily -> this.generateRecipes(blockFamily, featureFlagSet)); } - protected CompletableFuture run(CachedOutput output, HolderLookup.Provider registries) { - final Set set = Sets.newHashSet(); - final List> list = new ArrayList(); - this.buildRecipes( - new RecipeOutput() { - @Override - public void accept(ResourceLocation location, Recipe recipe, @Nullable AdvancementHolder advancement) { - if (!set.add(location)) { - throw new IllegalStateException("Duplicate recipe " + location); - } else { - list.add(DataProvider.saveStable(output, registries, Recipe.CODEC, recipe, RecipeProvider.this.recipePathProvider.json(location))); - if (advancement != null) { - list.add( - DataProvider.saveStable(output, registries, Advancement.CODEC, advancement.value(), RecipeProvider.this.advancementPathProvider.json(advancement.id())) - ); - } - } - } - - @Override - public Advancement.Builder advancement() { - return Advancement.Builder.recipeAdvancement().parent(RecipeBuilder.ROOT_RECIPE_ADVANCEMENT); - } - } - ); - return CompletableFuture.allOf((CompletableFuture[])list.toArray(CompletableFuture[]::new)); + protected void oneToOneConversionRecipe(ItemLike itemLike, ItemLike itemLike2, @Nullable String string) { + this.oneToOneConversionRecipe(itemLike, itemLike2, string, 1); } - protected CompletableFuture buildAdvancement(CachedOutput output, HolderLookup.Provider registries, AdvancementHolder advancement) { - return DataProvider.saveStable(output, registries, Advancement.CODEC, advancement.value(), this.advancementPathProvider.json(advancement.id())); + protected void oneToOneConversionRecipe(ItemLike itemLike, ItemLike itemLike2, @Nullable String string, int i) { + this.shapeless(RecipeCategory.MISC, itemLike, i) + .requires(itemLike2) + .group(string) + .unlockedBy(getHasName(itemLike2), this.has(itemLike2)) + .save(this.output, getConversionRecipeName(itemLike, itemLike2)); } - protected abstract void buildRecipes(RecipeOutput recipeOutput); - - protected static void generateForEnabledBlockFamilies(RecipeOutput recipeOutput, FeatureFlagSet enabledFeatures) { - BlockFamilies.getAllFamilies().filter(BlockFamily::shouldGenerateRecipe).forEach(blockFamily -> generateRecipes(recipeOutput, blockFamily, enabledFeatures)); + protected void oreSmelting(List list, RecipeCategory recipeCategory, ItemLike itemLike, float f, int i, String string) { + this.oreCooking(RecipeSerializer.SMELTING_RECIPE, SmeltingRecipe::new, list, recipeCategory, itemLike, f, i, string, "_from_smelting"); } - protected static void oneToOneConversionRecipe(RecipeOutput recipeOutput, ItemLike result, ItemLike ingredient, @Nullable String group) { - oneToOneConversionRecipe(recipeOutput, result, ingredient, group, 1); + protected void oreBlasting(List list, RecipeCategory recipeCategory, ItemLike itemLike, float f, int i, String string) { + this.oreCooking(RecipeSerializer.BLASTING_RECIPE, BlastingRecipe::new, list, recipeCategory, itemLike, f, i, string, "_from_blasting"); } - protected static void oneToOneConversionRecipe(RecipeOutput recipeOutput, ItemLike result, ItemLike ingredient, @Nullable String group, int resultCount) { - ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, result, resultCount) - .requires(ingredient) - .group(group) - .unlockedBy(getHasName(ingredient), has(ingredient)) - .save(recipeOutput, getConversionRecipeName(result, ingredient)); - } - - protected static void oreSmelting( - RecipeOutput recipeOutput, List ingredients, RecipeCategory category, ItemLike result, float experience, int cookingTime, String group + private void oreCooking( + RecipeSerializer recipeSerializer, + AbstractCookingRecipe.Factory factory, + List list, + RecipeCategory recipeCategory, + ItemLike itemLike, + float f, + int i, + String string, + String string2 ) { - oreCooking( - recipeOutput, RecipeSerializer.SMELTING_RECIPE, SmeltingRecipe::new, ingredients, category, result, experience, cookingTime, group, "_from_smelting" - ); - } - - protected static void oreBlasting( - RecipeOutput recipeOutput, List ingredients, RecipeCategory category, ItemLike result, float experience, int cookingTime, String group - ) { - oreCooking( - recipeOutput, RecipeSerializer.BLASTING_RECIPE, BlastingRecipe::new, ingredients, category, result, experience, cookingTime, group, "_from_blasting" - ); - } - - private static void oreCooking( - RecipeOutput recipeOutput, - RecipeSerializer serializer, - AbstractCookingRecipe.Factory recipeFactory, - List ingredients, - RecipeCategory category, - ItemLike result, - float experience, - int cookingTime, - String group, - String suffix - ) { - for (ItemLike itemLike : ingredients) { - SimpleCookingRecipeBuilder.generic(Ingredient.of(itemLike), category, result, experience, cookingTime, serializer, recipeFactory) - .group(group) - .unlockedBy(getHasName(itemLike), has(itemLike)) - .save(recipeOutput, getItemName(result) + suffix + "_" + getItemName(itemLike)); + for (ItemLike itemLike2 : list) { + SimpleCookingRecipeBuilder.generic(Ingredient.of(itemLike2), recipeCategory, itemLike, f, i, recipeSerializer, factory) + .group(string) + .unlockedBy(getHasName(itemLike2), this.has(itemLike2)) + .save(this.output, getItemName(itemLike) + string2 + "_" + getItemName(itemLike2)); } } - protected static void netheriteSmithing(RecipeOutput recipeOutput, Item ingredientItem, RecipeCategory category, Item resultItem) { + protected void netheriteSmithing(Item item, RecipeCategory recipeCategory, Item item2) { SmithingTransformRecipeBuilder.smithing( - Ingredient.of(Items.NETHERITE_UPGRADE_SMITHING_TEMPLATE), Ingredient.of(ingredientItem), Ingredient.of(Items.NETHERITE_INGOT), category, resultItem + Ingredient.of(Items.NETHERITE_UPGRADE_SMITHING_TEMPLATE), Ingredient.of(item), this.tag(ItemTags.NETHERITE_TOOL_MATERIALS), recipeCategory, item2 ) - .unlocks("has_netherite_ingot", has(Items.NETHERITE_INGOT)) - .save(recipeOutput, getItemName(resultItem) + "_smithing"); + .unlocks("has_netherite_ingot", this.has(ItemTags.NETHERITE_TOOL_MATERIALS)) + .save(this.output, getItemName(item2) + "_smithing"); } - protected static void trimSmithing(RecipeOutput recipeOutput, Item ingredientItem, ResourceLocation location) { - SmithingTrimRecipeBuilder.smithingTrim( - Ingredient.of(ingredientItem), Ingredient.of(ItemTags.TRIMMABLE_ARMOR), Ingredient.of(ItemTags.TRIM_MATERIALS), RecipeCategory.MISC - ) - .unlocks("has_smithing_trim_template", has(ingredientItem)) - .save(recipeOutput, location); + protected void trimSmithing(Item item, ResourceKey> resourceKey) { + SmithingTrimRecipeBuilder.smithingTrim(Ingredient.of(item), this.tag(ItemTags.TRIMMABLE_ARMOR), this.tag(ItemTags.TRIM_MATERIALS), RecipeCategory.MISC) + .unlocks("has_smithing_trim_template", this.has(item)) + .save(this.output, resourceKey); } - protected static void twoByTwoPacker(RecipeOutput recipeOutput, RecipeCategory category, ItemLike packed, ItemLike unpacked) { - ShapedRecipeBuilder.shaped(category, packed, 1) - .define('#', unpacked) + protected void twoByTwoPacker(RecipeCategory recipeCategory, ItemLike itemLike, ItemLike itemLike2) { + this.shaped(recipeCategory, itemLike, 1) + .define('#', itemLike2) .pattern("##") .pattern("##") - .unlockedBy(getHasName(unpacked), has(unpacked)) - .save(recipeOutput); + .unlockedBy(getHasName(itemLike2), this.has(itemLike2)) + .save(this.output); } - protected static void threeByThreePacker(RecipeOutput recipeOutput, RecipeCategory category, ItemLike packed, ItemLike unpacked, String criterionName) { - ShapelessRecipeBuilder.shapeless(category, packed).requires(unpacked, 9).unlockedBy(criterionName, has(unpacked)).save(recipeOutput); + protected void threeByThreePacker(RecipeCategory recipeCategory, ItemLike itemLike, ItemLike itemLike2, String string) { + this.shapeless(recipeCategory, itemLike).requires(itemLike2, 9).unlockedBy(string, this.has(itemLike2)).save(this.output); } - protected static void threeByThreePacker(RecipeOutput recipeOutput, RecipeCategory category, ItemLike packed, ItemLike unpacked) { - threeByThreePacker(recipeOutput, category, packed, unpacked, getHasName(unpacked)); + protected void threeByThreePacker(RecipeCategory recipeCategory, ItemLike itemLike, ItemLike itemLike2) { + this.threeByThreePacker(recipeCategory, itemLike, itemLike2, getHasName(itemLike2)); } - protected static void planksFromLog(RecipeOutput recipeOutput, ItemLike planks, TagKey logs, int resultCount) { - ShapelessRecipeBuilder.shapeless(RecipeCategory.BUILDING_BLOCKS, planks, resultCount) - .requires(logs) - .group("planks") - .unlockedBy("has_log", has(logs)) - .save(recipeOutput); + protected void planksFromLog(ItemLike itemLike, TagKey tagKey, int i) { + this.shapeless(RecipeCategory.BUILDING_BLOCKS, itemLike, i).requires(tagKey).group("planks").unlockedBy("has_log", this.has(tagKey)).save(this.output); } - protected static void planksFromLogs(RecipeOutput recipeOutput, ItemLike planks, TagKey logs, int result) { - ShapelessRecipeBuilder.shapeless(RecipeCategory.BUILDING_BLOCKS, planks, result) - .requires(logs) - .group("planks") - .unlockedBy("has_logs", has(logs)) - .save(recipeOutput); + protected void planksFromLogs(ItemLike itemLike, TagKey tagKey, int i) { + this.shapeless(RecipeCategory.BUILDING_BLOCKS, itemLike, i).requires(tagKey).group("planks").unlockedBy("has_logs", this.has(tagKey)).save(this.output); } - protected static void woodFromLogs(RecipeOutput recipeOutput, ItemLike wood, ItemLike log) { - ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, wood, 3) - .define('#', log) + protected void woodFromLogs(ItemLike itemLike, ItemLike itemLike2) { + this.shaped(RecipeCategory.BUILDING_BLOCKS, itemLike, 3) + .define('#', itemLike2) .pattern("##") .pattern("##") .group("bark") - .unlockedBy("has_log", has(log)) - .save(recipeOutput); + .unlockedBy("has_log", this.has(itemLike2)) + .save(this.output); } - protected static void woodenBoat(RecipeOutput recipeOutput, ItemLike boat, ItemLike material) { - ShapedRecipeBuilder.shaped(RecipeCategory.TRANSPORTATION, boat) - .define('#', material) + protected void woodenBoat(ItemLike itemLike, ItemLike itemLike2) { + this.shaped(RecipeCategory.TRANSPORTATION, itemLike) + .define('#', itemLike2) .pattern("# #") .pattern("###") .group("boat") .unlockedBy("in_water", insideOf(Blocks.WATER)) - .save(recipeOutput); + .save(this.output); } - protected static void chestBoat(RecipeOutput recipeOutput, ItemLike boat, ItemLike material) { - ShapelessRecipeBuilder.shapeless(RecipeCategory.TRANSPORTATION, boat) + protected void chestBoat(ItemLike itemLike, ItemLike itemLike2) { + this.shapeless(RecipeCategory.TRANSPORTATION, itemLike) .requires(Blocks.CHEST) - .requires(material) + .requires(itemLike2) .group("chest_boat") - .unlockedBy("has_boat", has(ItemTags.BOATS)) - .save(recipeOutput); + .unlockedBy("has_boat", this.has(ItemTags.BOATS)) + .save(this.output); } - private static RecipeBuilder buttonBuilder(ItemLike button, Ingredient material) { - return ShapelessRecipeBuilder.shapeless(RecipeCategory.REDSTONE, button).requires(material); + private RecipeBuilder buttonBuilder(ItemLike material, Ingredient ingredient) { + return this.shapeless(RecipeCategory.REDSTONE, material).requires(ingredient); } - protected static RecipeBuilder doorBuilder(ItemLike door, Ingredient material) { - return ShapedRecipeBuilder.shaped(RecipeCategory.REDSTONE, door, 3).define('#', material).pattern("##").pattern("##").pattern("##"); + protected RecipeBuilder doorBuilder(ItemLike material, Ingredient ingredient) { + return this.shaped(RecipeCategory.REDSTONE, material, 3).define('#', ingredient).pattern("##").pattern("##").pattern("##"); } - private static RecipeBuilder fenceBuilder(ItemLike fence, Ingredient material) { - int i = fence == Blocks.NETHER_BRICK_FENCE ? 6 : 3; - Item item = fence == Blocks.NETHER_BRICK_FENCE ? Items.NETHER_BRICK : Items.STICK; - return ShapedRecipeBuilder.shaped(RecipeCategory.DECORATIONS, fence, i).define('W', material).define('#', item).pattern("W#W").pattern("W#W"); + private RecipeBuilder fenceBuilder(ItemLike material, Ingredient ingredient) { + int i = material == Blocks.NETHER_BRICK_FENCE ? 6 : 3; + Item item = material == Blocks.NETHER_BRICK_FENCE ? Items.NETHER_BRICK : Items.STICK; + return this.shaped(RecipeCategory.DECORATIONS, material, i).define('W', ingredient).define('#', item).pattern("W#W").pattern("W#W"); } - private static RecipeBuilder fenceGateBuilder(ItemLike fenceGate, Ingredient material) { - return ShapedRecipeBuilder.shaped(RecipeCategory.REDSTONE, fenceGate).define('#', Items.STICK).define('W', material).pattern("#W#").pattern("#W#"); + private RecipeBuilder fenceGateBuilder(ItemLike material, Ingredient ingredient) { + return this.shaped(RecipeCategory.REDSTONE, material).define('#', Items.STICK).define('W', ingredient).pattern("#W#").pattern("#W#"); } - protected static void pressurePlate(RecipeOutput recipeOutput, ItemLike pressurePlate, ItemLike material) { - pressurePlateBuilder(RecipeCategory.REDSTONE, pressurePlate, Ingredient.of(material)).unlockedBy(getHasName(material), has(material)).save(recipeOutput); + protected void pressurePlate(ItemLike itemLike, ItemLike itemLike2) { + this.pressurePlateBuilder(RecipeCategory.REDSTONE, itemLike, Ingredient.of(itemLike2)) + .unlockedBy(getHasName(itemLike2), this.has(itemLike2)) + .save(this.output); } - private static RecipeBuilder pressurePlateBuilder(RecipeCategory category, ItemLike pressurePlate, Ingredient material) { - return ShapedRecipeBuilder.shaped(category, pressurePlate).define('#', material).pattern("##"); + private RecipeBuilder pressurePlateBuilder(RecipeCategory pressurePlate, ItemLike material, Ingredient ingredient) { + return this.shaped(pressurePlate, material).define('#', ingredient).pattern("##"); } - protected static void slab(RecipeOutput recipeOutput, RecipeCategory category, ItemLike slab, ItemLike material) { - slabBuilder(category, slab, Ingredient.of(material)).unlockedBy(getHasName(material), has(material)).save(recipeOutput); + protected void slab(RecipeCategory recipeCategory, ItemLike itemLike, ItemLike itemLike2) { + this.slabBuilder(recipeCategory, itemLike, Ingredient.of(itemLike2)).unlockedBy(getHasName(itemLike2), this.has(itemLike2)).save(this.output); } - protected static RecipeBuilder slabBuilder(RecipeCategory category, ItemLike slab, Ingredient material) { - return ShapedRecipeBuilder.shaped(category, slab, 6).define('#', material).pattern("###"); + protected RecipeBuilder slabBuilder(RecipeCategory slab, ItemLike material, Ingredient ingredient) { + return this.shaped(slab, material, 6).define('#', ingredient).pattern("###"); } - protected static RecipeBuilder stairBuilder(ItemLike stairs, Ingredient material) { - return ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, stairs, 4).define('#', material).pattern("# ").pattern("## ").pattern("###"); + protected RecipeBuilder stairBuilder(ItemLike material, Ingredient ingredient) { + return this.shaped(RecipeCategory.BUILDING_BLOCKS, material, 4).define('#', ingredient).pattern("# ").pattern("## ").pattern("###"); } - protected static RecipeBuilder trapdoorBuilder(ItemLike trapdoor, Ingredient material) { - return ShapedRecipeBuilder.shaped(RecipeCategory.REDSTONE, trapdoor, 2).define('#', material).pattern("###").pattern("###"); + protected RecipeBuilder trapdoorBuilder(ItemLike material, Ingredient ingredient) { + return this.shaped(RecipeCategory.REDSTONE, material, 2).define('#', ingredient).pattern("###").pattern("###"); } - private static RecipeBuilder signBuilder(ItemLike sign, Ingredient material) { - return ShapedRecipeBuilder.shaped(RecipeCategory.DECORATIONS, sign, 3) + private RecipeBuilder signBuilder(ItemLike material, Ingredient ingredient) { + return this.shaped(RecipeCategory.DECORATIONS, material, 3) .group("sign") - .define('#', material) + .define('#', ingredient) .define('X', Items.STICK) .pattern("###") .pattern("###") .pattern(" X "); } - protected static void hangingSign(RecipeOutput recipeOutput, ItemLike sign, ItemLike material) { - ShapedRecipeBuilder.shaped(RecipeCategory.DECORATIONS, sign, 6) + protected void hangingSign(ItemLike itemLike, ItemLike itemLike2) { + this.shaped(RecipeCategory.DECORATIONS, itemLike, 6) .group("hanging_sign") - .define('#', material) + .define('#', itemLike2) .define('X', Items.CHAIN) .pattern("X X") .pattern("###") .pattern("###") - .unlockedBy("has_stripped_logs", has(material)) - .save(recipeOutput); + .unlockedBy("has_stripped_logs", this.has(itemLike2)) + .save(this.output); } - protected static void colorBlockWithDye(RecipeOutput recipeOutput, List dyes, List dyeableItems, String group) { - for (int i = 0; i < dyes.size(); i++) { - Item item = (Item)dyes.get(i); - Item item2 = (Item)dyeableItems.get(i); - ShapelessRecipeBuilder.shapeless(RecipeCategory.BUILDING_BLOCKS, item2) - .requires(item) - .requires(Ingredient.of(dyeableItems.stream().filter(item2x -> !item2x.equals(item2)).map(ItemStack::new))) - .group(group) - .unlockedBy("has_needed_dye", has(item)) - .save(recipeOutput, "dye_" + getItemName(item2)); + protected void colorBlockWithDye(List list, List list2, String string) { + this.colorWithDye(list, list2, null, string, RecipeCategory.BUILDING_BLOCKS); + } + + protected void colorWithDye(List list, List list2, @Nullable Item item, String string, RecipeCategory recipeCategory) { + for (int i = 0; i < list.size(); i++) { + Item item2 = (Item)list.get(i); + Item item3 = (Item)list2.get(i); + Stream stream = list2.stream().filter(item2x -> !item2x.equals(item3)); + if (item != null) { + stream = Stream.concat(stream, Stream.of(item)); + } + + this.shapeless(recipeCategory, item3) + .requires(item2) + .requires(Ingredient.of(stream)) + .group(string) + .unlockedBy("has_needed_dye", this.has(item2)) + .save(this.output, "dye_" + getItemName(item3)); } } - protected static void carpet(RecipeOutput recipeOutput, ItemLike carpet, ItemLike material) { - ShapedRecipeBuilder.shaped(RecipeCategory.DECORATIONS, carpet, 3) - .define('#', material) + protected void carpet(ItemLike itemLike, ItemLike itemLike2) { + this.shaped(RecipeCategory.DECORATIONS, itemLike, 3) + .define('#', itemLike2) .pattern("##") .group("carpet") - .unlockedBy(getHasName(material), has(material)) - .save(recipeOutput); + .unlockedBy(getHasName(itemLike2), this.has(itemLike2)) + .save(this.output); } - protected static void bedFromPlanksAndWool(RecipeOutput recipeOutput, ItemLike bed, ItemLike wool) { - ShapedRecipeBuilder.shaped(RecipeCategory.DECORATIONS, bed) - .define('#', wool) + protected void bedFromPlanksAndWool(ItemLike itemLike, ItemLike itemLike2) { + this.shaped(RecipeCategory.DECORATIONS, itemLike) + .define('#', itemLike2) .define('X', ItemTags.PLANKS) .pattern("###") .pattern("XXX") .group("bed") - .unlockedBy(getHasName(wool), has(wool)) - .save(recipeOutput); + .unlockedBy(getHasName(itemLike2), this.has(itemLike2)) + .save(this.output); } - protected static void banner(RecipeOutput recipeOutput, ItemLike banner, ItemLike material) { - ShapedRecipeBuilder.shaped(RecipeCategory.DECORATIONS, banner) - .define('#', material) + protected void banner(ItemLike itemLike, ItemLike itemLike2) { + this.shaped(RecipeCategory.DECORATIONS, itemLike) + .define('#', itemLike2) .define('|', Items.STICK) .pattern("###") .pattern("###") .pattern(" | ") .group("banner") - .unlockedBy(getHasName(material), has(material)) - .save(recipeOutput); + .unlockedBy(getHasName(itemLike2), this.has(itemLike2)) + .save(this.output); } - protected static void stainedGlassFromGlassAndDye(RecipeOutput recipeOutput, ItemLike stainedGlass, ItemLike dye) { - ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, stainedGlass, 8) + protected void stainedGlassFromGlassAndDye(ItemLike itemLike, ItemLike itemLike2) { + this.shaped(RecipeCategory.BUILDING_BLOCKS, itemLike, 8) .define('#', Blocks.GLASS) - .define('X', dye) + .define('X', itemLike2) .pattern("###") .pattern("#X#") .pattern("###") .group("stained_glass") - .unlockedBy("has_glass", has(Blocks.GLASS)) - .save(recipeOutput); + .unlockedBy("has_glass", this.has(Blocks.GLASS)) + .save(this.output); } - protected static void stainedGlassPaneFromStainedGlass(RecipeOutput recipeOutput, ItemLike stainedGlassPane, ItemLike stainedGlass) { - ShapedRecipeBuilder.shaped(RecipeCategory.DECORATIONS, stainedGlassPane, 16) - .define('#', stainedGlass) + protected void stainedGlassPaneFromStainedGlass(ItemLike itemLike, ItemLike itemLike2) { + this.shaped(RecipeCategory.DECORATIONS, itemLike, 16) + .define('#', itemLike2) .pattern("###") .pattern("###") .group("stained_glass_pane") - .unlockedBy("has_glass", has(stainedGlass)) - .save(recipeOutput); + .unlockedBy("has_glass", this.has(itemLike2)) + .save(this.output); } - protected static void stainedGlassPaneFromGlassPaneAndDye(RecipeOutput recipeOutput, ItemLike stainedGlassPane, ItemLike dye) { - ShapedRecipeBuilder.shaped(RecipeCategory.DECORATIONS, stainedGlassPane, 8) + protected void stainedGlassPaneFromGlassPaneAndDye(ItemLike itemLike, ItemLike itemLike2) { + this.shaped(RecipeCategory.DECORATIONS, itemLike, 8) .define('#', Blocks.GLASS_PANE) - .define('$', dye) + .define('$', itemLike2) .pattern("###") .pattern("#$#") .pattern("###") .group("stained_glass_pane") - .unlockedBy("has_glass_pane", has(Blocks.GLASS_PANE)) - .unlockedBy(getHasName(dye), has(dye)) - .save(recipeOutput, getConversionRecipeName(stainedGlassPane, Blocks.GLASS_PANE)); + .unlockedBy("has_glass_pane", this.has(Blocks.GLASS_PANE)) + .unlockedBy(getHasName(itemLike2), this.has(itemLike2)) + .save(this.output, getConversionRecipeName(itemLike, Blocks.GLASS_PANE)); } - protected static void coloredTerracottaFromTerracottaAndDye(RecipeOutput recipeOutput, ItemLike terracotta, ItemLike dye) { - ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, terracotta, 8) + protected void coloredTerracottaFromTerracottaAndDye(ItemLike itemLike, ItemLike itemLike2) { + this.shaped(RecipeCategory.BUILDING_BLOCKS, itemLike, 8) .define('#', Blocks.TERRACOTTA) - .define('X', dye) + .define('X', itemLike2) .pattern("###") .pattern("#X#") .pattern("###") .group("stained_terracotta") - .unlockedBy("has_terracotta", has(Blocks.TERRACOTTA)) - .save(recipeOutput); + .unlockedBy("has_terracotta", this.has(Blocks.TERRACOTTA)) + .save(this.output); } - protected static void concretePowder(RecipeOutput recipeOutput, ItemLike concretePowder, ItemLike dye) { - ShapelessRecipeBuilder.shapeless(RecipeCategory.BUILDING_BLOCKS, concretePowder, 8) - .requires(dye) + protected void concretePowder(ItemLike itemLike, ItemLike itemLike2) { + this.shapeless(RecipeCategory.BUILDING_BLOCKS, itemLike, 8) + .requires(itemLike2) .requires(Blocks.SAND, 4) .requires(Blocks.GRAVEL, 4) .group("concrete_powder") - .unlockedBy("has_sand", has(Blocks.SAND)) - .unlockedBy("has_gravel", has(Blocks.GRAVEL)) - .save(recipeOutput); + .unlockedBy("has_sand", this.has(Blocks.SAND)) + .unlockedBy("has_gravel", this.has(Blocks.GRAVEL)) + .save(this.output); } - protected static void candle(RecipeOutput recipeOutput, ItemLike candle, ItemLike dye) { - ShapelessRecipeBuilder.shapeless(RecipeCategory.DECORATIONS, candle) + protected void candle(ItemLike itemLike, ItemLike itemLike2) { + this.shapeless(RecipeCategory.DECORATIONS, itemLike) .requires(Blocks.CANDLE) - .requires(dye) + .requires(itemLike2) .group("dyed_candle") - .unlockedBy(getHasName(dye), has(dye)) - .save(recipeOutput); + .unlockedBy(getHasName(itemLike2), this.has(itemLike2)) + .save(this.output); } - protected static void wall(RecipeOutput recipeOutput, RecipeCategory category, ItemLike wall, ItemLike material) { - wallBuilder(category, wall, Ingredient.of(material)).unlockedBy(getHasName(material), has(material)).save(recipeOutput); + protected void wall(RecipeCategory recipeCategory, ItemLike itemLike, ItemLike itemLike2) { + this.wallBuilder(recipeCategory, itemLike, Ingredient.of(itemLike2)).unlockedBy(getHasName(itemLike2), this.has(itemLike2)).save(this.output); } - private static RecipeBuilder wallBuilder(RecipeCategory category, ItemLike wall, Ingredient material) { - return ShapedRecipeBuilder.shaped(category, wall, 6).define('#', material).pattern("###").pattern("###"); + private RecipeBuilder wallBuilder(RecipeCategory wall, ItemLike material, Ingredient ingredient) { + return this.shaped(wall, material, 6).define('#', ingredient).pattern("###").pattern("###"); } - protected static void polished(RecipeOutput recipeOutput, RecipeCategory category, ItemLike result, ItemLike material) { - polishedBuilder(category, result, Ingredient.of(material)).unlockedBy(getHasName(material), has(material)).save(recipeOutput); + protected void polished(RecipeCategory recipeCategory, ItemLike itemLike, ItemLike itemLike2) { + this.polishedBuilder(recipeCategory, itemLike, Ingredient.of(itemLike2)).unlockedBy(getHasName(itemLike2), this.has(itemLike2)).save(this.output); } - private static RecipeBuilder polishedBuilder(RecipeCategory category, ItemLike result, Ingredient material) { - return ShapedRecipeBuilder.shaped(category, result, 4).define('S', material).pattern("SS").pattern("SS"); + private RecipeBuilder polishedBuilder(RecipeCategory result, ItemLike material, Ingredient ingredient) { + return this.shaped(result, material, 4).define('S', ingredient).pattern("SS").pattern("SS"); } - protected static void cut(RecipeOutput recipeOutput, RecipeCategory category, ItemLike cutResult, ItemLike material) { - cutBuilder(category, cutResult, Ingredient.of(material)).unlockedBy(getHasName(material), has(material)).save(recipeOutput); + protected void cut(RecipeCategory recipeCategory, ItemLike itemLike, ItemLike itemLike2) { + this.cutBuilder(recipeCategory, itemLike, Ingredient.of(itemLike2)).unlockedBy(getHasName(itemLike2), this.has(itemLike2)).save(this.output); } - private static ShapedRecipeBuilder cutBuilder(RecipeCategory category, ItemLike cutResult, Ingredient material) { - return ShapedRecipeBuilder.shaped(category, cutResult, 4).define('#', material).pattern("##").pattern("##"); + private ShapedRecipeBuilder cutBuilder(RecipeCategory cutResult, ItemLike material, Ingredient ingredient) { + return this.shaped(cutResult, material, 4).define('#', ingredient).pattern("##").pattern("##"); } - protected static void chiseled(RecipeOutput recipeOutput, RecipeCategory category, ItemLike chiseledResult, ItemLike material) { - chiseledBuilder(category, chiseledResult, Ingredient.of(material)).unlockedBy(getHasName(material), has(material)).save(recipeOutput); + protected void chiseled(RecipeCategory recipeCategory, ItemLike itemLike, ItemLike itemLike2) { + this.chiseledBuilder(recipeCategory, itemLike, Ingredient.of(itemLike2)).unlockedBy(getHasName(itemLike2), this.has(itemLike2)).save(this.output); } - protected static void mosaicBuilder(RecipeOutput recipeOutput, RecipeCategory category, ItemLike result, ItemLike material) { - ShapedRecipeBuilder.shaped(category, result) - .define('#', material) + protected void mosaicBuilder(RecipeCategory recipeCategory, ItemLike itemLike, ItemLike itemLike2) { + this.shaped(recipeCategory, itemLike) + .define('#', itemLike2) .pattern("#") .pattern("#") - .unlockedBy(getHasName(material), has(material)) - .save(recipeOutput); + .unlockedBy(getHasName(itemLike2), this.has(itemLike2)) + .save(this.output); } - protected static ShapedRecipeBuilder chiseledBuilder(RecipeCategory category, ItemLike chiseledResult, Ingredient material) { - return ShapedRecipeBuilder.shaped(category, chiseledResult).define('#', material).pattern("#").pattern("#"); + protected ShapedRecipeBuilder chiseledBuilder(RecipeCategory chiseledResult, ItemLike material, Ingredient ingredient) { + return this.shaped(chiseledResult, material).define('#', ingredient).pattern("#").pattern("#"); } - protected static void stonecutterResultFromBase(RecipeOutput recipeOutput, RecipeCategory category, ItemLike result, ItemLike material) { - stonecutterResultFromBase(recipeOutput, category, result, material, 1); + protected void stonecutterResultFromBase(RecipeCategory recipeCategory, ItemLike itemLike, ItemLike itemLike2) { + this.stonecutterResultFromBase(recipeCategory, itemLike, itemLike2, 1); } - protected static void stonecutterResultFromBase(RecipeOutput recipeOutput, RecipeCategory category, ItemLike result, ItemLike material, int resultCount) { - SingleItemRecipeBuilder.stonecutting(Ingredient.of(material), category, result, resultCount) - .unlockedBy(getHasName(material), has(material)) - .save(recipeOutput, getConversionRecipeName(result, material) + "_stonecutting"); + protected void stonecutterResultFromBase(RecipeCategory recipeCategory, ItemLike itemLike, ItemLike itemLike2, int i) { + SingleItemRecipeBuilder.stonecutting(Ingredient.of(itemLike2), recipeCategory, itemLike, i) + .unlockedBy(getHasName(itemLike2), this.has(itemLike2)) + .save(this.output, getConversionRecipeName(itemLike, itemLike2) + "_stonecutting"); } - private static void smeltingResultFromBase(RecipeOutput recipeOutput, ItemLike result, ItemLike ingredient) { - SimpleCookingRecipeBuilder.smelting(Ingredient.of(ingredient), RecipeCategory.BUILDING_BLOCKS, result, 0.1F, 200) - .unlockedBy(getHasName(ingredient), has(ingredient)) - .save(recipeOutput); + private void smeltingResultFromBase(ItemLike itemLike, ItemLike itemLike2) { + SimpleCookingRecipeBuilder.smelting(Ingredient.of(itemLike2), RecipeCategory.BUILDING_BLOCKS, itemLike, 0.1F, 200) + .unlockedBy(getHasName(itemLike2), this.has(itemLike2)) + .save(this.output); } - protected static void nineBlockStorageRecipes( - RecipeOutput recipeOutput, RecipeCategory unpackedCategory, ItemLike unpacked, RecipeCategory packedCategory, ItemLike packed + protected void nineBlockStorageRecipes(RecipeCategory recipeCategory, ItemLike itemLike, RecipeCategory recipeCategory2, ItemLike itemLike2) { + this.nineBlockStorageRecipes(recipeCategory, itemLike, recipeCategory2, itemLike2, getSimpleRecipeName(itemLike2), null, getSimpleRecipeName(itemLike), null); + } + + protected void nineBlockStorageRecipesWithCustomPacking( + RecipeCategory recipeCategory, ItemLike itemLike, RecipeCategory recipeCategory2, ItemLike itemLike2, String string, String string2 ) { - nineBlockStorageRecipes( - recipeOutput, unpackedCategory, unpacked, packedCategory, packed, getSimpleRecipeName(packed), null, getSimpleRecipeName(unpacked), null - ); + this.nineBlockStorageRecipes(recipeCategory, itemLike, recipeCategory2, itemLike2, string, string2, getSimpleRecipeName(itemLike), null); } - protected static void nineBlockStorageRecipesWithCustomPacking( - RecipeOutput recipeOutput, - RecipeCategory unpackedCategory, - ItemLike unpacked, - RecipeCategory packedCategory, - ItemLike packed, - String packedName, - String packedGroup + protected void nineBlockStorageRecipesRecipesWithCustomUnpacking( + RecipeCategory recipeCategory, ItemLike itemLike, RecipeCategory recipeCategory2, ItemLike itemLike2, String string, String string2 ) { - nineBlockStorageRecipes(recipeOutput, unpackedCategory, unpacked, packedCategory, packed, packedName, packedGroup, getSimpleRecipeName(unpacked), null); + this.nineBlockStorageRecipes(recipeCategory, itemLike, recipeCategory2, itemLike2, getSimpleRecipeName(itemLike2), null, string, string2); } - protected static void nineBlockStorageRecipesRecipesWithCustomUnpacking( - RecipeOutput recipeOutput, - RecipeCategory unpackedCategory, - ItemLike unpacked, - RecipeCategory packedCategory, - ItemLike packed, - String unpackedName, - String unpackedGroup + private void nineBlockStorageRecipes( + RecipeCategory recipeCategory, + ItemLike itemLike, + RecipeCategory recipeCategory2, + ItemLike itemLike2, + String string, + @Nullable String string2, + String string3, + @Nullable String string4 ) { - nineBlockStorageRecipes(recipeOutput, unpackedCategory, unpacked, packedCategory, packed, getSimpleRecipeName(packed), null, unpackedName, unpackedGroup); - } - - private static void nineBlockStorageRecipes( - RecipeOutput recipeOutput, - RecipeCategory unpackedCategory, - ItemLike unpacked, - RecipeCategory packedCategory, - ItemLike packed, - String packedName, - @Nullable String packedGroup, - String unpackedName, - @Nullable String unpackedGroup - ) { - ShapelessRecipeBuilder.shapeless(unpackedCategory, unpacked, 9) - .requires(packed) - .group(unpackedGroup) - .unlockedBy(getHasName(packed), has(packed)) - .save(recipeOutput, ResourceLocation.parse(unpackedName)); - ShapedRecipeBuilder.shaped(packedCategory, packed) - .define('#', unpacked) + this.shapeless(recipeCategory, itemLike, 9) + .requires(itemLike2) + .group(string4) + .unlockedBy(getHasName(itemLike2), this.has(itemLike2)) + .save(this.output, ResourceKey.create(Registries.RECIPE, ResourceLocation.parse(string3))); + this.shaped(recipeCategory2, itemLike2) + .define('#', itemLike) .pattern("###") .pattern("###") .pattern("###") - .group(packedGroup) - .unlockedBy(getHasName(unpacked), has(unpacked)) - .save(recipeOutput, ResourceLocation.parse(packedName)); + .group(string2) + .unlockedBy(getHasName(itemLike), this.has(itemLike)) + .save(this.output, ResourceKey.create(Registries.RECIPE, ResourceLocation.parse(string))); } - protected static void copySmithingTemplate(RecipeOutput recipeOutput, ItemLike template, TagKey baseMaterial) { - ShapedRecipeBuilder.shaped(RecipeCategory.MISC, template, 2) + protected void copySmithingTemplate(ItemLike itemLike, ItemLike itemLike2) { + this.shaped(RecipeCategory.MISC, itemLike, 2) .define('#', Items.DIAMOND) - .define('C', baseMaterial) - .define('S', template) + .define('C', itemLike2) + .define('S', itemLike) .pattern("#S#") .pattern("#C#") .pattern("###") - .unlockedBy(getHasName(template), has(template)) - .save(recipeOutput); + .unlockedBy(getHasName(itemLike), this.has(itemLike)) + .save(this.output); } - protected static void copySmithingTemplate(RecipeOutput recipeOutput, ItemLike template, ItemLike baseItem) { - ShapedRecipeBuilder.shaped(RecipeCategory.MISC, template, 2) + protected void copySmithingTemplate(ItemLike itemLike, Ingredient ingredient) { + this.shaped(RecipeCategory.MISC, itemLike, 2) .define('#', Items.DIAMOND) - .define('C', baseItem) - .define('S', template) + .define('C', ingredient) + .define('S', itemLike) .pattern("#S#") .pattern("#C#") .pattern("###") - .unlockedBy(getHasName(template), has(template)) - .save(recipeOutput); + .unlockedBy(getHasName(itemLike), this.has(itemLike)) + .save(this.output); } - protected static void copySmithingTemplate(RecipeOutput recipeOutput, ItemLike template, Ingredient baseItem) { - ShapedRecipeBuilder.shaped(RecipeCategory.MISC, template, 2) - .define('#', Items.DIAMOND) - .define('C', baseItem) - .define('S', template) - .pattern("#S#") - .pattern("#C#") - .pattern("###") - .unlockedBy(getHasName(template), has(template)) - .save(recipeOutput); - } - - protected static void cookRecipes( - RecipeOutput recipeOutput, String cookingMethod, RecipeSerializer cookingSerializer, AbstractCookingRecipe.Factory recipeFactory, int cookingTime + protected void cookRecipes( + String string, RecipeSerializer recipeSerializer, AbstractCookingRecipe.Factory factory, int i ) { - simpleCookingRecipe(recipeOutput, cookingMethod, cookingSerializer, recipeFactory, cookingTime, Items.BEEF, Items.COOKED_BEEF, 0.35F); - simpleCookingRecipe(recipeOutput, cookingMethod, cookingSerializer, recipeFactory, cookingTime, Items.CHICKEN, Items.COOKED_CHICKEN, 0.35F); - simpleCookingRecipe(recipeOutput, cookingMethod, cookingSerializer, recipeFactory, cookingTime, Items.COD, Items.COOKED_COD, 0.35F); - simpleCookingRecipe(recipeOutput, cookingMethod, cookingSerializer, recipeFactory, cookingTime, Items.KELP, Items.DRIED_KELP, 0.1F); - simpleCookingRecipe(recipeOutput, cookingMethod, cookingSerializer, recipeFactory, cookingTime, Items.SALMON, Items.COOKED_SALMON, 0.35F); - simpleCookingRecipe(recipeOutput, cookingMethod, cookingSerializer, recipeFactory, cookingTime, Items.MUTTON, Items.COOKED_MUTTON, 0.35F); - simpleCookingRecipe(recipeOutput, cookingMethod, cookingSerializer, recipeFactory, cookingTime, Items.PORKCHOP, Items.COOKED_PORKCHOP, 0.35F); - simpleCookingRecipe(recipeOutput, cookingMethod, cookingSerializer, recipeFactory, cookingTime, Items.POTATO, Items.BAKED_POTATO, 0.35F); - simpleCookingRecipe(recipeOutput, cookingMethod, cookingSerializer, recipeFactory, cookingTime, Items.RABBIT, Items.COOKED_RABBIT, 0.35F); + this.simpleCookingRecipe(string, recipeSerializer, factory, i, Items.BEEF, Items.COOKED_BEEF, 0.35F); + this.simpleCookingRecipe(string, recipeSerializer, factory, i, Items.CHICKEN, Items.COOKED_CHICKEN, 0.35F); + this.simpleCookingRecipe(string, recipeSerializer, factory, i, Items.COD, Items.COOKED_COD, 0.35F); + this.simpleCookingRecipe(string, recipeSerializer, factory, i, Items.KELP, Items.DRIED_KELP, 0.1F); + this.simpleCookingRecipe(string, recipeSerializer, factory, i, Items.SALMON, Items.COOKED_SALMON, 0.35F); + this.simpleCookingRecipe(string, recipeSerializer, factory, i, Items.MUTTON, Items.COOKED_MUTTON, 0.35F); + this.simpleCookingRecipe(string, recipeSerializer, factory, i, Items.PORKCHOP, Items.COOKED_PORKCHOP, 0.35F); + this.simpleCookingRecipe(string, recipeSerializer, factory, i, Items.POTATO, Items.BAKED_POTATO, 0.35F); + this.simpleCookingRecipe(string, recipeSerializer, factory, i, Items.RABBIT, Items.COOKED_RABBIT, 0.35F); } - private static void simpleCookingRecipe( - RecipeOutput recipeOutput, - String cookingMethod, - RecipeSerializer cookingSerializer, - AbstractCookingRecipe.Factory recipeFactory, - int cookingTime, - ItemLike material, - ItemLike result, - float experience + private void simpleCookingRecipe( + String string, RecipeSerializer recipeSerializer, AbstractCookingRecipe.Factory factory, int i, ItemLike itemLike, ItemLike itemLike2, float f ) { - SimpleCookingRecipeBuilder.generic(Ingredient.of(material), RecipeCategory.FOOD, result, experience, cookingTime, cookingSerializer, recipeFactory) - .unlockedBy(getHasName(material), has(material)) - .save(recipeOutput, getItemName(result) + "_from_" + cookingMethod); + SimpleCookingRecipeBuilder.generic(Ingredient.of(itemLike), RecipeCategory.FOOD, itemLike2, f, i, recipeSerializer, factory) + .unlockedBy(getHasName(itemLike), this.has(itemLike)) + .save(this.output, getItemName(itemLike2) + "_from_" + string); } - protected static void waxRecipes(RecipeOutput recipeOutput, FeatureFlagSet requiredFeatures) { + protected void waxRecipes(FeatureFlagSet featureFlagSet) { ((BiMap)HoneycombItem.WAXABLES.get()) .forEach( (block, block2) -> { - if (block2.requiredFeatures().isSubsetOf(requiredFeatures)) { - ShapelessRecipeBuilder.shapeless(RecipeCategory.BUILDING_BLOCKS, block2) + if (block2.requiredFeatures().isSubsetOf(featureFlagSet)) { + this.shapeless(RecipeCategory.BUILDING_BLOCKS, block2) .requires(block) .requires(Items.HONEYCOMB) .group(getItemName(block2)) - .unlockedBy(getHasName(block), has(block)) - .save(recipeOutput, getConversionRecipeName(block2, Items.HONEYCOMB)); + .unlockedBy(getHasName(block), this.has(block)) + .save(this.output, getConversionRecipeName(block2, Items.HONEYCOMB)); } } ); } - protected static void grate(RecipeOutput recipeOutput, Block grateBlock, Block material) { - ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, grateBlock, 4) - .define('M', material) + protected void grate(Block block, Block block2) { + this.shaped(RecipeCategory.BUILDING_BLOCKS, block, 4) + .define('M', block2) .pattern(" M ") .pattern("M M") .pattern(" M ") - .unlockedBy(getHasName(material), has(material)) - .save(recipeOutput); + .unlockedBy(getHasName(block2), this.has(block2)) + .save(this.output); } - protected static void copperBulb(RecipeOutput recipeOutput, Block bulbBlock, Block material) { - ShapedRecipeBuilder.shaped(RecipeCategory.REDSTONE, bulbBlock, 4) - .define('C', material) + protected void copperBulb(Block block, Block block2) { + this.shaped(RecipeCategory.REDSTONE, block, 4) + .define('C', block2) .define('R', Items.REDSTONE) .define('B', Items.BLAZE_ROD) .pattern(" C ") .pattern("CBC") .pattern(" R ") - .unlockedBy(getHasName(material), has(material)) - .save(recipeOutput); + .unlockedBy(getHasName(block2), this.has(block2)) + .save(this.output); } - protected static void generateRecipes(RecipeOutput recipeOutput, BlockFamily blockFamily, FeatureFlagSet requiredFeatures) { - blockFamily.getVariants() - .forEach( - (variant, block) -> { - if (block.requiredFeatures().isSubsetOf(requiredFeatures)) { - BiFunction biFunction = (BiFunction)SHAPE_BUILDERS.get(variant); - ItemLike itemLike = getBaseBlock(blockFamily, variant); - if (biFunction != null) { - RecipeBuilder recipeBuilder = (RecipeBuilder)biFunction.apply(block, itemLike); - blockFamily.getRecipeGroupPrefix() - .ifPresent(string -> recipeBuilder.group(string + (variant == BlockFamily.Variant.CUT ? "" : "_" + variant.getRecipeGroup()))); - recipeBuilder.unlockedBy((String)blockFamily.getRecipeUnlockedBy().orElseGet(() -> getHasName(itemLike)), has(itemLike)); - recipeBuilder.save(recipeOutput); - } + protected void suspiciousStew(Item item, SuspiciousEffectHolder suspiciousEffectHolder) { + ItemStack itemStack = new ItemStack( + Items.SUSPICIOUS_STEW.builtInRegistryHolder(), + 1, + DataComponentPatch.builder().set(DataComponents.SUSPICIOUS_STEW_EFFECTS, suspiciousEffectHolder.getSuspiciousEffects()).build() + ); + this.shapeless(RecipeCategory.FOOD, itemStack) + .requires(Items.BOWL) + .requires(Items.BROWN_MUSHROOM) + .requires(Items.RED_MUSHROOM) + .requires(item) + .group("suspicious_stew") + .unlockedBy(getHasName(item), this.has(item)) + .save(this.output, getItemName(itemStack.getItem()) + "_from_" + getItemName(item)); + } - if (variant == BlockFamily.Variant.CRACKED) { - smeltingResultFromBase(recipeOutput, block, itemLike); - } - } + protected void generateRecipes(BlockFamily blockFamily, FeatureFlagSet featureFlagSet) { + blockFamily.getVariants().forEach((variant, block) -> { + if (block.requiredFeatures().isSubsetOf(featureFlagSet)) { + RecipeProvider.FamilyRecipeProvider familyRecipeProvider = (RecipeProvider.FamilyRecipeProvider)SHAPE_BUILDERS.get(variant); + ItemLike itemLike = this.getBaseBlock(blockFamily, variant); + if (familyRecipeProvider != null) { + RecipeBuilder recipeBuilder = familyRecipeProvider.create(this, block, itemLike); + blockFamily.getRecipeGroupPrefix().ifPresent(string -> recipeBuilder.group(string + (variant == Variant.CUT ? "" : "_" + variant.getRecipeGroup()))); + recipeBuilder.unlockedBy((String)blockFamily.getRecipeUnlockedBy().orElseGet(() -> getHasName(itemLike)), this.has(itemLike)); + recipeBuilder.save(this.output); } - ); + + if (variant == Variant.CRACKED) { + this.smeltingResultFromBase(block, itemLike); + } + } + }); } - private static Block getBaseBlock(BlockFamily family, BlockFamily.Variant variant) { - if (variant == BlockFamily.Variant.CHISELED) { - if (!family.getVariants().containsKey(BlockFamily.Variant.SLAB)) { + private Block getBaseBlock(BlockFamily variant, Variant variant2) { + if (variant2 == Variant.CHISELED) { + if (!variant.getVariants().containsKey(Variant.SLAB)) { throw new IllegalStateException("Slab is not defined for the family."); } else { - return family.get(BlockFamily.Variant.SLAB); + return variant.get(Variant.SLAB); } } else { - return family.getBaseBlock(); + return variant.getBaseBlock(); } } - private static Criterion insideOf(Block block) { - return CriteriaTriggers.ENTER_BLOCK - .createCriterion(new EnterBlockTrigger.TriggerInstance(Optional.empty(), Optional.of(block.builtInRegistryHolder()), Optional.empty())); + private static Criterion insideOf(Block block) { + return CriteriaTriggers.ENTER_BLOCK.createCriterion(new TriggerInstance(Optional.empty(), Optional.of(block.builtInRegistryHolder()), Optional.empty())); } - private static Criterion has(MinMaxBounds.Ints count, ItemLike item) { - return inventoryTrigger(ItemPredicate.Builder.item().of(item).withCount(count)); + private Criterion has(Ints item, ItemLike itemLike) { + return inventoryTrigger(ItemPredicate.Builder.item().of(this.items, itemLike).withCount(item)); } - protected static Criterion has(ItemLike itemLike) { - return inventoryTrigger(ItemPredicate.Builder.item().of(itemLike)); + protected Criterion has(ItemLike itemLike) { + return inventoryTrigger(ItemPredicate.Builder.item().of(this.items, itemLike)); } - protected static Criterion has(TagKey tag) { - return inventoryTrigger(ItemPredicate.Builder.item().of(tag)); + protected Criterion has(TagKey tagKey) { + return inventoryTrigger(ItemPredicate.Builder.item().of(this.items, tagKey)); } - private static Criterion inventoryTrigger(ItemPredicate.Builder... items) { + private static Criterion inventoryTrigger(ItemPredicate.Builder... items) { return inventoryTrigger((ItemPredicate[])Arrays.stream(items).map(ItemPredicate.Builder::build).toArray(ItemPredicate[]::new)); } - private static Criterion inventoryTrigger(ItemPredicate... predicates) { + private static Criterion inventoryTrigger(ItemPredicate... predicates) { return CriteriaTriggers.INVENTORY_CHANGED - .createCriterion(new InventoryChangeTrigger.TriggerInstance(Optional.empty(), InventoryChangeTrigger.TriggerInstance.Slots.ANY, List.of(predicates))); + .createCriterion(new net.minecraft.advancements.critereon.InventoryChangeTrigger.TriggerInstance(Optional.empty(), Slots.ANY, List.of(predicates))); } protected static String getHasName(ItemLike itemLike) { @@ -722,8 +667,57 @@ public abstract class RecipeProvider implements DataProvider { return getItemName(itemLike) + "_from_blasting"; } - @Override - public final String getName() { - return "Recipes"; + protected Ingredient tag(TagKey tagKey) { + return Ingredient.of(this.items.getOrThrow(tagKey)); + } + + protected ShapedRecipeBuilder shaped(RecipeCategory recipeCategory, ItemLike itemLike) { + return ShapedRecipeBuilder.shaped(this.items, recipeCategory, itemLike); + } + + protected ShapedRecipeBuilder shaped(RecipeCategory recipeCategory, ItemLike itemLike, int i) { + return ShapedRecipeBuilder.shaped(this.items, recipeCategory, itemLike, i); + } + + protected ShapelessRecipeBuilder shapeless(RecipeCategory recipeCategory, ItemStack itemStack) { + return ShapelessRecipeBuilder.shapeless(this.items, recipeCategory, itemStack); + } + + protected ShapelessRecipeBuilder shapeless(RecipeCategory recipeCategory, ItemLike itemLike) { + return ShapelessRecipeBuilder.shapeless(this.items, recipeCategory, itemLike); + } + + protected ShapelessRecipeBuilder shapeless(RecipeCategory recipeCategory, ItemLike itemLike, int i) { + return ShapelessRecipeBuilder.shapeless(this.items, recipeCategory, itemLike, i); + } + + @FunctionalInterface + interface FamilyRecipeProvider { + RecipeBuilder create(RecipeProvider recipeProvider, ItemLike itemLike, ItemLike itemLike2); + } + + protected abstract static class Runner implements DataProvider { + private final PackOutput packOutput; + private final CompletableFuture registries; + + protected Runner(PackOutput packOutput, CompletableFuture completableFuture) { + this.packOutput = packOutput; + this.registries = completableFuture; + } + + @Override + public final CompletableFuture run(CachedOutput output) { + return this.registries.thenCompose(provider -> { + PathProvider pathProvider = this.packOutput.createRegistryElementsPathProvider(Registries.RECIPE); + PathProvider pathProvider2 = this.packOutput.createRegistryElementsPathProvider(Registries.ADVANCEMENT); + Set>> set = Sets.>>newHashSet(); + List> list = new ArrayList(); + RecipeOutput recipeOutput = new 1(this, set, list, output, provider, pathProvider, pathProvider2); + this.createRecipeProvider(provider, recipeOutput).buildRecipes(); + return CompletableFuture.allOf((CompletableFuture[])list.toArray(CompletableFuture[]::new)); + }); + } + + protected abstract RecipeProvider createRecipeProvider(HolderLookup.Provider provider, RecipeOutput recipeOutput); } } diff --git a/net/minecraft/data/recipes/ShapedRecipeBuilder.java b/net/minecraft/data/recipes/ShapedRecipeBuilder.java index 8ea1a8cb..375559e0 100644 --- a/net/minecraft/data/recipes/ShapedRecipeBuilder.java +++ b/net/minecraft/data/recipes/ShapedRecipeBuilder.java @@ -6,22 +6,25 @@ import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Objects; -import net.minecraft.advancements.Advancement; -import net.minecraft.advancements.AdvancementRequirements; import net.minecraft.advancements.AdvancementRewards; import net.minecraft.advancements.Criterion; +import net.minecraft.advancements.Advancement.Builder; +import net.minecraft.advancements.AdvancementRequirements.Strategy; import net.minecraft.advancements.critereon.RecipeUnlockedTrigger; -import net.minecraft.resources.ResourceLocation; +import net.minecraft.core.HolderGetter; +import net.minecraft.resources.ResourceKey; import net.minecraft.tags.TagKey; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.crafting.Ingredient; +import net.minecraft.world.item.crafting.Recipe; import net.minecraft.world.item.crafting.ShapedRecipe; import net.minecraft.world.item.crafting.ShapedRecipePattern; import net.minecraft.world.level.ItemLike; import org.jetbrains.annotations.Nullable; public class ShapedRecipeBuilder implements RecipeBuilder { + private final HolderGetter items; private final RecipeCategory category; private final Item result; private final int count; @@ -32,31 +35,26 @@ public class ShapedRecipeBuilder implements RecipeBuilder { private String group; private boolean showNotification = true; - public ShapedRecipeBuilder(RecipeCategory category, ItemLike result, int count) { - this.category = category; - this.result = result.asItem(); - this.count = count; + private ShapedRecipeBuilder(HolderGetter holderGetter, RecipeCategory recipeCategory, ItemLike itemLike, int i) { + this.items = holderGetter; + this.category = recipeCategory; + this.result = itemLike.asItem(); + this.count = i; } - /** - * Creates a new builder for a shaped recipe. - */ - public static ShapedRecipeBuilder shaped(RecipeCategory category, ItemLike result) { - return shaped(category, result, 1); + public static ShapedRecipeBuilder shaped(HolderGetter holderGetter, RecipeCategory recipeCategory, ItemLike itemLike) { + return shaped(holderGetter, recipeCategory, itemLike, 1); } - /** - * Creates a new builder for a shaped recipe. - */ - public static ShapedRecipeBuilder shaped(RecipeCategory category, ItemLike result, int count) { - return new ShapedRecipeBuilder(category, result, count); + public static ShapedRecipeBuilder shaped(HolderGetter holderGetter, RecipeCategory recipeCategory, ItemLike itemLike, int i) { + return new ShapedRecipeBuilder(holderGetter, recipeCategory, itemLike, i); } /** * Adds a key to the recipe pattern. */ public ShapedRecipeBuilder define(Character symbol, TagKey tag) { - return this.define(symbol, Ingredient.of(tag)); + return this.define(symbol, Ingredient.of(this.items.getOrThrow(tag))); } /** @@ -113,12 +111,12 @@ public class ShapedRecipeBuilder implements RecipeBuilder { } @Override - public void save(RecipeOutput recipeOutput, ResourceLocation id) { - ShapedRecipePattern shapedRecipePattern = this.ensureValid(id); - Advancement.Builder builder = recipeOutput.advancement() - .addCriterion("has_the_recipe", RecipeUnlockedTrigger.unlocked(id)) - .rewards(AdvancementRewards.Builder.recipe(id)) - .requirements(AdvancementRequirements.Strategy.OR); + public void save(RecipeOutput recipeOutput, ResourceKey> resourceKey) { + ShapedRecipePattern shapedRecipePattern = this.ensureValid(resourceKey); + Builder builder = recipeOutput.advancement() + .addCriterion("has_the_recipe", RecipeUnlockedTrigger.unlocked(resourceKey)) + .rewards(AdvancementRewards.Builder.recipe(resourceKey)) + .requirements(Strategy.OR); this.criteria.forEach(builder::addCriterion); ShapedRecipe shapedRecipe = new ShapedRecipe( (String)Objects.requireNonNullElse(this.group, ""), @@ -127,12 +125,12 @@ public class ShapedRecipeBuilder implements RecipeBuilder { new ItemStack(this.result, this.count), this.showNotification ); - recipeOutput.accept(id, shapedRecipe, builder.build(id.withPrefix("recipes/" + this.category.getFolderName() + "/"))); + recipeOutput.accept(resourceKey, shapedRecipe, builder.build(resourceKey.location().withPrefix("recipes/" + this.category.getFolderName() + "/"))); } - private ShapedRecipePattern ensureValid(ResourceLocation loaction) { + private ShapedRecipePattern ensureValid(ResourceKey> resourceKey) { if (this.criteria.isEmpty()) { - throw new IllegalStateException("No way of obtaining recipe " + loaction); + throw new IllegalStateException("No way of obtaining recipe " + resourceKey.location()); } else { return ShapedRecipePattern.of(this.key, this.rows); } diff --git a/net/minecraft/data/recipes/ShapelessRecipeBuilder.java b/net/minecraft/data/recipes/ShapelessRecipeBuilder.java index 2095b3b9..2e17f1a8 100644 --- a/net/minecraft/data/recipes/ShapelessRecipeBuilder.java +++ b/net/minecraft/data/recipes/ShapelessRecipeBuilder.java @@ -1,57 +1,58 @@ package net.minecraft.data.recipes; +import java.util.ArrayList; import java.util.LinkedHashMap; +import java.util.List; import java.util.Map; import java.util.Objects; -import net.minecraft.advancements.Advancement; -import net.minecraft.advancements.AdvancementRequirements; import net.minecraft.advancements.AdvancementRewards; import net.minecraft.advancements.Criterion; +import net.minecraft.advancements.Advancement.Builder; +import net.minecraft.advancements.AdvancementRequirements.Strategy; import net.minecraft.advancements.critereon.RecipeUnlockedTrigger; -import net.minecraft.core.NonNullList; -import net.minecraft.resources.ResourceLocation; +import net.minecraft.core.HolderGetter; +import net.minecraft.resources.ResourceKey; import net.minecraft.tags.TagKey; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.crafting.Ingredient; +import net.minecraft.world.item.crafting.Recipe; import net.minecraft.world.item.crafting.ShapelessRecipe; import net.minecraft.world.level.ItemLike; import org.jetbrains.annotations.Nullable; public class ShapelessRecipeBuilder implements RecipeBuilder { + private final HolderGetter items; private final RecipeCategory category; - private final Item result; - private final int count; - private final NonNullList ingredients = NonNullList.create(); + private final ItemStack result; + private final List ingredients = new ArrayList(); private final Map> criteria = new LinkedHashMap(); @Nullable private String group; - public ShapelessRecipeBuilder(RecipeCategory category, ItemLike result, int count) { - this.category = category; - this.result = result.asItem(); - this.count = count; + private ShapelessRecipeBuilder(HolderGetter holderGetter, RecipeCategory recipeCategory, ItemStack itemStack) { + this.items = holderGetter; + this.category = recipeCategory; + this.result = itemStack; } - /** - * Creates a new builder for a shapeless recipe. - */ - public static ShapelessRecipeBuilder shapeless(RecipeCategory category, ItemLike result) { - return new ShapelessRecipeBuilder(category, result, 1); + public static ShapelessRecipeBuilder shapeless(HolderGetter holderGetter, RecipeCategory recipeCategory, ItemStack itemStack) { + return new ShapelessRecipeBuilder(holderGetter, recipeCategory, itemStack); } - /** - * Creates a new builder for a shapeless recipe. - */ - public static ShapelessRecipeBuilder shapeless(RecipeCategory category, ItemLike result, int count) { - return new ShapelessRecipeBuilder(category, result, count); + public static ShapelessRecipeBuilder shapeless(HolderGetter holderGetter, RecipeCategory recipeCategory, ItemLike itemLike) { + return shapeless(holderGetter, recipeCategory, itemLike, 1); + } + + public static ShapelessRecipeBuilder shapeless(HolderGetter holderGetter, RecipeCategory recipeCategory, ItemLike itemLike, int i) { + return new ShapelessRecipeBuilder(holderGetter, recipeCategory, itemLike.asItem().getDefaultInstance().copyWithCount(i)); } /** * Adds an ingredient that can be any item in the given tag. */ public ShapelessRecipeBuilder requires(TagKey tag) { - return this.requires(Ingredient.of(tag)); + return this.requires(Ingredient.of(this.items.getOrThrow(tag))); } /** @@ -102,32 +103,26 @@ public class ShapelessRecipeBuilder implements RecipeBuilder { @Override public Item getResult() { - return this.result; + return this.result.getItem(); } @Override - public void save(RecipeOutput recipeOutput, ResourceLocation id) { - this.ensureValid(id); - Advancement.Builder builder = recipeOutput.advancement() - .addCriterion("has_the_recipe", RecipeUnlockedTrigger.unlocked(id)) - .rewards(AdvancementRewards.Builder.recipe(id)) - .requirements(AdvancementRequirements.Strategy.OR); + public void save(RecipeOutput recipeOutput, ResourceKey> resourceKey) { + this.ensureValid(resourceKey); + Builder builder = recipeOutput.advancement() + .addCriterion("has_the_recipe", RecipeUnlockedTrigger.unlocked(resourceKey)) + .rewards(AdvancementRewards.Builder.recipe(resourceKey)) + .requirements(Strategy.OR); this.criteria.forEach(builder::addCriterion); ShapelessRecipe shapelessRecipe = new ShapelessRecipe( - (String)Objects.requireNonNullElse(this.group, ""), - RecipeBuilder.determineBookCategory(this.category), - new ItemStack(this.result, this.count), - this.ingredients + (String)Objects.requireNonNullElse(this.group, ""), RecipeBuilder.determineBookCategory(this.category), this.result, this.ingredients ); - recipeOutput.accept(id, shapelessRecipe, builder.build(id.withPrefix("recipes/" + this.category.getFolderName() + "/"))); + recipeOutput.accept(resourceKey, shapelessRecipe, builder.build(resourceKey.location().withPrefix("recipes/" + this.category.getFolderName() + "/"))); } - /** - * Makes sure that this recipe is valid and obtainable. - */ - private void ensureValid(ResourceLocation id) { + private void ensureValid(ResourceKey> resourceKey) { if (this.criteria.isEmpty()) { - throw new IllegalStateException("No way of obtaining recipe " + id); + throw new IllegalStateException("No way of obtaining recipe " + resourceKey.location()); } } } diff --git a/net/minecraft/data/recipes/SimpleCookingRecipeBuilder.java b/net/minecraft/data/recipes/SimpleCookingRecipeBuilder.java index bf9d9ea5..6086101b 100644 --- a/net/minecraft/data/recipes/SimpleCookingRecipeBuilder.java +++ b/net/minecraft/data/recipes/SimpleCookingRecipeBuilder.java @@ -3,13 +3,13 @@ package net.minecraft.data.recipes; import java.util.LinkedHashMap; import java.util.Map; import java.util.Objects; -import net.minecraft.advancements.Advancement; -import net.minecraft.advancements.AdvancementRequirements; import net.minecraft.advancements.AdvancementRewards; import net.minecraft.advancements.Criterion; +import net.minecraft.advancements.Advancement.Builder; +import net.minecraft.advancements.AdvancementRequirements.Strategy; import net.minecraft.advancements.critereon.RecipeUnlockedTrigger; import net.minecraft.core.component.DataComponents; -import net.minecraft.resources.ResourceLocation; +import net.minecraft.resources.ResourceKey; import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; @@ -18,6 +18,7 @@ import net.minecraft.world.item.crafting.BlastingRecipe; import net.minecraft.world.item.crafting.CampfireCookingRecipe; import net.minecraft.world.item.crafting.CookingBookCategory; import net.minecraft.world.item.crafting.Ingredient; +import net.minecraft.world.item.crafting.Recipe; import net.minecraft.world.item.crafting.RecipeSerializer; import net.minecraft.world.item.crafting.SmeltingRecipe; import net.minecraft.world.item.crafting.SmokingRecipe; @@ -98,18 +99,18 @@ public class SimpleCookingRecipeBuilder implements RecipeBuilder { } @Override - public void save(RecipeOutput recipeOutput, ResourceLocation id) { - this.ensureValid(id); - Advancement.Builder builder = recipeOutput.advancement() - .addCriterion("has_the_recipe", RecipeUnlockedTrigger.unlocked(id)) - .rewards(AdvancementRewards.Builder.recipe(id)) - .requirements(AdvancementRequirements.Strategy.OR); + public void save(RecipeOutput recipeOutput, ResourceKey> resourceKey) { + this.ensureValid(resourceKey); + Builder builder = recipeOutput.advancement() + .addCriterion("has_the_recipe", RecipeUnlockedTrigger.unlocked(resourceKey)) + .rewards(AdvancementRewards.Builder.recipe(resourceKey)) + .requirements(Strategy.OR); this.criteria.forEach(builder::addCriterion); AbstractCookingRecipe abstractCookingRecipe = this.factory .create( (String)Objects.requireNonNullElse(this.group, ""), this.bookCategory, this.ingredient, new ItemStack(this.result), this.experience, this.cookingTime ); - recipeOutput.accept(id, abstractCookingRecipe, builder.build(id.withPrefix("recipes/" + this.category.getFolderName() + "/"))); + recipeOutput.accept(resourceKey, abstractCookingRecipe, builder.build(resourceKey.location().withPrefix("recipes/" + this.category.getFolderName() + "/"))); } private static CookingBookCategory determineSmeltingRecipeCategory(ItemLike result) { @@ -136,12 +137,9 @@ public class SimpleCookingRecipeBuilder implements RecipeBuilder { } } - /** - * Makes sure that this obtainable. - */ - private void ensureValid(ResourceLocation id) { + private void ensureValid(ResourceKey> resourceKey) { if (this.criteria.isEmpty()) { - throw new IllegalStateException("No way of obtaining recipe " + id); + throw new IllegalStateException("No way of obtaining recipe " + resourceKey.location()); } } } diff --git a/net/minecraft/data/recipes/SingleItemRecipeBuilder.java b/net/minecraft/data/recipes/SingleItemRecipeBuilder.java index 180e53a1..e4ea0daf 100644 --- a/net/minecraft/data/recipes/SingleItemRecipeBuilder.java +++ b/net/minecraft/data/recipes/SingleItemRecipeBuilder.java @@ -3,15 +3,16 @@ package net.minecraft.data.recipes; import java.util.LinkedHashMap; import java.util.Map; import java.util.Objects; -import net.minecraft.advancements.Advancement; -import net.minecraft.advancements.AdvancementRequirements; import net.minecraft.advancements.AdvancementRewards; import net.minecraft.advancements.Criterion; +import net.minecraft.advancements.Advancement.Builder; +import net.minecraft.advancements.AdvancementRequirements.Strategy; import net.minecraft.advancements.critereon.RecipeUnlockedTrigger; -import net.minecraft.resources.ResourceLocation; +import net.minecraft.resources.ResourceKey; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.crafting.Ingredient; +import net.minecraft.world.item.crafting.Recipe; import net.minecraft.world.item.crafting.SingleItemRecipe; import net.minecraft.world.item.crafting.StonecutterRecipe; import net.minecraft.world.level.ItemLike; @@ -59,21 +60,21 @@ public class SingleItemRecipeBuilder implements RecipeBuilder { } @Override - public void save(RecipeOutput recipeOutput, ResourceLocation id) { - this.ensureValid(id); - Advancement.Builder builder = recipeOutput.advancement() - .addCriterion("has_the_recipe", RecipeUnlockedTrigger.unlocked(id)) - .rewards(AdvancementRewards.Builder.recipe(id)) - .requirements(AdvancementRequirements.Strategy.OR); + public void save(RecipeOutput recipeOutput, ResourceKey> resourceKey) { + this.ensureValid(resourceKey); + Builder builder = recipeOutput.advancement() + .addCriterion("has_the_recipe", RecipeUnlockedTrigger.unlocked(resourceKey)) + .rewards(AdvancementRewards.Builder.recipe(resourceKey)) + .requirements(Strategy.OR); this.criteria.forEach(builder::addCriterion); SingleItemRecipe singleItemRecipe = this.factory .create((String)Objects.requireNonNullElse(this.group, ""), this.ingredient, new ItemStack(this.result, this.count)); - recipeOutput.accept(id, singleItemRecipe, builder.build(id.withPrefix("recipes/" + this.category.getFolderName() + "/"))); + recipeOutput.accept(resourceKey, singleItemRecipe, builder.build(resourceKey.location().withPrefix("recipes/" + this.category.getFolderName() + "/"))); } - private void ensureValid(ResourceLocation id) { + private void ensureValid(ResourceKey> resourceKey) { if (this.criteria.isEmpty()) { - throw new IllegalStateException("No way of obtaining recipe " + id); + throw new IllegalStateException("No way of obtaining recipe " + resourceKey.location()); } } } diff --git a/net/minecraft/data/recipes/SmithingTransformRecipeBuilder.java b/net/minecraft/data/recipes/SmithingTransformRecipeBuilder.java index 2d274353..a935af00 100644 --- a/net/minecraft/data/recipes/SmithingTransformRecipeBuilder.java +++ b/net/minecraft/data/recipes/SmithingTransformRecipeBuilder.java @@ -2,15 +2,19 @@ package net.minecraft.data.recipes; import java.util.LinkedHashMap; import java.util.Map; -import net.minecraft.advancements.Advancement; -import net.minecraft.advancements.AdvancementRequirements; +import java.util.Optional; import net.minecraft.advancements.AdvancementRewards; import net.minecraft.advancements.Criterion; +import net.minecraft.advancements.Advancement.Builder; +import net.minecraft.advancements.AdvancementRequirements.Strategy; import net.minecraft.advancements.critereon.RecipeUnlockedTrigger; +import net.minecraft.core.registries.Registries; +import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.crafting.Ingredient; +import net.minecraft.world.item.crafting.Recipe; import net.minecraft.world.item.crafting.SmithingTransformRecipe; public class SmithingTransformRecipeBuilder { @@ -39,23 +43,25 @@ public class SmithingTransformRecipeBuilder { } public void save(RecipeOutput recipeOutput, String recipeId) { - this.save(recipeOutput, ResourceLocation.parse(recipeId)); + this.save(recipeOutput, ResourceKey.create(Registries.RECIPE, ResourceLocation.parse(recipeId))); } - public void save(RecipeOutput recipeOutput, ResourceLocation recipeId) { - this.ensureValid(recipeId); - Advancement.Builder builder = recipeOutput.advancement() - .addCriterion("has_the_recipe", RecipeUnlockedTrigger.unlocked(recipeId)) - .rewards(AdvancementRewards.Builder.recipe(recipeId)) - .requirements(AdvancementRequirements.Strategy.OR); + public void save(RecipeOutput recipeOutput, ResourceKey> resourceKey) { + this.ensureValid(resourceKey); + Builder builder = recipeOutput.advancement() + .addCriterion("has_the_recipe", RecipeUnlockedTrigger.unlocked(resourceKey)) + .rewards(AdvancementRewards.Builder.recipe(resourceKey)) + .requirements(Strategy.OR); this.criteria.forEach(builder::addCriterion); - SmithingTransformRecipe smithingTransformRecipe = new SmithingTransformRecipe(this.template, this.base, this.addition, new ItemStack(this.result)); - recipeOutput.accept(recipeId, smithingTransformRecipe, builder.build(recipeId.withPrefix("recipes/" + this.category.getFolderName() + "/"))); + SmithingTransformRecipe smithingTransformRecipe = new SmithingTransformRecipe( + Optional.of(this.template), Optional.of(this.base), Optional.of(this.addition), new ItemStack(this.result) + ); + recipeOutput.accept(resourceKey, smithingTransformRecipe, builder.build(resourceKey.location().withPrefix("recipes/" + this.category.getFolderName() + "/"))); } - private void ensureValid(ResourceLocation location) { + private void ensureValid(ResourceKey> resourceKey) { if (this.criteria.isEmpty()) { - throw new IllegalStateException("No way of obtaining recipe " + location); + throw new IllegalStateException("No way of obtaining recipe " + resourceKey.location()); } } } diff --git a/net/minecraft/data/recipes/SmithingTrimRecipeBuilder.java b/net/minecraft/data/recipes/SmithingTrimRecipeBuilder.java index 20e24eb0..44afe6fc 100644 --- a/net/minecraft/data/recipes/SmithingTrimRecipeBuilder.java +++ b/net/minecraft/data/recipes/SmithingTrimRecipeBuilder.java @@ -2,13 +2,15 @@ package net.minecraft.data.recipes; import java.util.LinkedHashMap; import java.util.Map; -import net.minecraft.advancements.Advancement; -import net.minecraft.advancements.AdvancementRequirements; +import java.util.Optional; import net.minecraft.advancements.AdvancementRewards; import net.minecraft.advancements.Criterion; +import net.minecraft.advancements.Advancement.Builder; +import net.minecraft.advancements.AdvancementRequirements.Strategy; import net.minecraft.advancements.critereon.RecipeUnlockedTrigger; -import net.minecraft.resources.ResourceLocation; +import net.minecraft.resources.ResourceKey; import net.minecraft.world.item.crafting.Ingredient; +import net.minecraft.world.item.crafting.Recipe; import net.minecraft.world.item.crafting.SmithingTrimRecipe; public class SmithingTrimRecipeBuilder { @@ -34,20 +36,20 @@ public class SmithingTrimRecipeBuilder { return this; } - public void save(RecipeOutput recipeOutput, ResourceLocation recipeId) { - this.ensureValid(recipeId); - Advancement.Builder builder = recipeOutput.advancement() - .addCriterion("has_the_recipe", RecipeUnlockedTrigger.unlocked(recipeId)) - .rewards(AdvancementRewards.Builder.recipe(recipeId)) - .requirements(AdvancementRequirements.Strategy.OR); + public void save(RecipeOutput recipeOutput, ResourceKey> resourceKey) { + this.ensureValid(resourceKey); + Builder builder = recipeOutput.advancement() + .addCriterion("has_the_recipe", RecipeUnlockedTrigger.unlocked(resourceKey)) + .rewards(AdvancementRewards.Builder.recipe(resourceKey)) + .requirements(Strategy.OR); this.criteria.forEach(builder::addCriterion); - SmithingTrimRecipe smithingTrimRecipe = new SmithingTrimRecipe(this.template, this.base, this.addition); - recipeOutput.accept(recipeId, smithingTrimRecipe, builder.build(recipeId.withPrefix("recipes/" + this.category.getFolderName() + "/"))); + SmithingTrimRecipe smithingTrimRecipe = new SmithingTrimRecipe(Optional.of(this.template), Optional.of(this.base), Optional.of(this.addition)); + recipeOutput.accept(resourceKey, smithingTrimRecipe, builder.build(resourceKey.location().withPrefix("recipes/" + this.category.getFolderName() + "/"))); } - private void ensureValid(ResourceLocation location) { + private void ensureValid(ResourceKey> resourceKey) { if (this.criteria.isEmpty()) { - throw new IllegalStateException("No way of obtaining recipe " + location); + throw new IllegalStateException("No way of obtaining recipe " + resourceKey.location()); } } } diff --git a/net/minecraft/data/recipes/SpecialRecipeBuilder.java b/net/minecraft/data/recipes/SpecialRecipeBuilder.java index 833d7570..962620b3 100644 --- a/net/minecraft/data/recipes/SpecialRecipeBuilder.java +++ b/net/minecraft/data/recipes/SpecialRecipeBuilder.java @@ -1,6 +1,8 @@ package net.minecraft.data.recipes; import java.util.function.Function; +import net.minecraft.core.registries.Registries; +import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.crafting.CraftingBookCategory; import net.minecraft.world.item.crafting.Recipe; @@ -17,10 +19,10 @@ public class SpecialRecipeBuilder { } public void save(RecipeOutput recipeOutput, String recipeId) { - this.save(recipeOutput, ResourceLocation.parse(recipeId)); + this.save(recipeOutput, ResourceKey.create(Registries.RECIPE, ResourceLocation.parse(recipeId))); } - public void save(RecipeOutput recipeOutput, ResourceLocation recipeId) { - recipeOutput.accept(recipeId, (Recipe)this.factory.apply(CraftingBookCategory.MISC), null); + public void save(RecipeOutput recipeOutput, ResourceKey> resourceKey) { + recipeOutput.accept(resourceKey, (Recipe)this.factory.apply(CraftingBookCategory.MISC), null); } } diff --git a/net/minecraft/data/recipes/TransmuteRecipeBuilder.java b/net/minecraft/data/recipes/TransmuteRecipeBuilder.java new file mode 100644 index 00000000..6809f4f9 --- /dev/null +++ b/net/minecraft/data/recipes/TransmuteRecipeBuilder.java @@ -0,0 +1,73 @@ +package net.minecraft.data.recipes; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Objects; +import net.minecraft.advancements.AdvancementRewards; +import net.minecraft.advancements.Criterion; +import net.minecraft.advancements.Advancement.Builder; +import net.minecraft.advancements.AdvancementRequirements.Strategy; +import net.minecraft.advancements.critereon.RecipeUnlockedTrigger; +import net.minecraft.core.Holder; +import net.minecraft.resources.ResourceKey; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.crafting.Ingredient; +import net.minecraft.world.item.crafting.Recipe; +import net.minecraft.world.item.crafting.TransmuteRecipe; +import org.jetbrains.annotations.Nullable; + +public class TransmuteRecipeBuilder implements RecipeBuilder { + private final RecipeCategory category; + private final Holder result; + private final Ingredient input; + private final Ingredient material; + private final Map> criteria = new LinkedHashMap(); + @Nullable + private String group; + + private TransmuteRecipeBuilder(RecipeCategory recipeCategory, Holder holder, Ingredient ingredient, Ingredient ingredient2) { + this.category = recipeCategory; + this.result = holder; + this.input = ingredient; + this.material = ingredient2; + } + + public static TransmuteRecipeBuilder transmute(RecipeCategory recipeCategory, Ingredient ingredient, Ingredient ingredient2, Item item) { + return new TransmuteRecipeBuilder(recipeCategory, item.builtInRegistryHolder(), ingredient, ingredient2); + } + + public TransmuteRecipeBuilder unlockedBy(String string, Criterion criterion) { + this.criteria.put(string, criterion); + return this; + } + + public TransmuteRecipeBuilder group(@Nullable String string) { + this.group = string; + return this; + } + + @Override + public Item getResult() { + return this.result.value(); + } + + @Override + public void save(RecipeOutput recipeOutput, ResourceKey> resourceKey) { + this.ensureValid(resourceKey); + Builder builder = recipeOutput.advancement() + .addCriterion("has_the_recipe", RecipeUnlockedTrigger.unlocked(resourceKey)) + .rewards(AdvancementRewards.Builder.recipe(resourceKey)) + .requirements(Strategy.OR); + this.criteria.forEach(builder::addCriterion); + TransmuteRecipe transmuteRecipe = new TransmuteRecipe( + (String)Objects.requireNonNullElse(this.group, ""), RecipeBuilder.determineBookCategory(this.category), this.input, this.material, this.result + ); + recipeOutput.accept(resourceKey, transmuteRecipe, builder.build(resourceKey.location().withPrefix("recipes/" + this.category.getFolderName() + "/"))); + } + + private void ensureValid(ResourceKey> resourceKey) { + if (this.criteria.isEmpty()) { + throw new IllegalStateException("No way of obtaining recipe " + resourceKey.location()); + } + } +} diff --git a/net/minecraft/data/recipes/packs/BundleRecipeProvider.java b/net/minecraft/data/recipes/packs/BundleRecipeProvider.java deleted file mode 100644 index 8e0a2a5e..00000000 --- a/net/minecraft/data/recipes/packs/BundleRecipeProvider.java +++ /dev/null @@ -1,28 +0,0 @@ -package net.minecraft.data.recipes.packs; - -import java.util.concurrent.CompletableFuture; -import net.minecraft.core.HolderLookup; -import net.minecraft.data.PackOutput; -import net.minecraft.data.recipes.RecipeCategory; -import net.minecraft.data.recipes.RecipeOutput; -import net.minecraft.data.recipes.RecipeProvider; -import net.minecraft.data.recipes.ShapedRecipeBuilder; -import net.minecraft.world.item.Items; - -public class BundleRecipeProvider extends RecipeProvider { - public BundleRecipeProvider(PackOutput packOutput, CompletableFuture completableFuture) { - super(packOutput, completableFuture); - } - - @Override - protected void buildRecipes(RecipeOutput recipeOutput) { - ShapedRecipeBuilder.shaped(RecipeCategory.TOOLS, Items.BUNDLE) - .define('#', Items.RABBIT_HIDE) - .define('-', Items.STRING) - .pattern("-#-") - .pattern("# #") - .pattern("###") - .unlockedBy("has_string", has(Items.STRING)) - .save(recipeOutput); - } -} diff --git a/net/minecraft/data/recipes/packs/VanillaRecipeProvider.java b/net/minecraft/data/recipes/packs/VanillaRecipeProvider.java index 7f9c3374..3b0775e6 100644 --- a/net/minecraft/data/recipes/packs/VanillaRecipeProvider.java +++ b/net/minecraft/data/recipes/packs/VanillaRecipeProvider.java @@ -5,28 +5,30 @@ import java.util.List; import java.util.Optional; import java.util.concurrent.CompletableFuture; import java.util.stream.Stream; -import net.minecraft.advancements.Advancement; import net.minecraft.advancements.CriteriaTriggers; -import net.minecraft.advancements.critereon.ImpossibleTrigger; -import net.minecraft.advancements.critereon.InventoryChangeTrigger; -import net.minecraft.advancements.critereon.MinMaxBounds; import net.minecraft.advancements.critereon.PlayerTrigger; +import net.minecraft.advancements.critereon.InventoryChangeTrigger.TriggerInstance; +import net.minecraft.advancements.critereon.InventoryChangeTrigger.TriggerInstance.Slots; +import net.minecraft.advancements.critereon.MinMaxBounds.Ints; import net.minecraft.core.HolderLookup; -import net.minecraft.data.CachedOutput; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.core.registries.Registries; import net.minecraft.data.PackOutput; -import net.minecraft.data.recipes.RecipeBuilder; import net.minecraft.data.recipes.RecipeCategory; import net.minecraft.data.recipes.RecipeOutput; import net.minecraft.data.recipes.RecipeProvider; -import net.minecraft.data.recipes.ShapedRecipeBuilder; -import net.minecraft.data.recipes.ShapelessRecipeBuilder; import net.minecraft.data.recipes.SimpleCookingRecipeBuilder; import net.minecraft.data.recipes.SingleItemRecipeBuilder; import net.minecraft.data.recipes.SpecialRecipeBuilder; +import net.minecraft.data.recipes.TransmuteRecipeBuilder; +import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.ItemTags; import net.minecraft.world.flag.FeatureFlagSet; import net.minecraft.world.flag.FeatureFlags; +import net.minecraft.world.item.BundleItem; +import net.minecraft.world.item.DyeColor; +import net.minecraft.world.item.DyeItem; import net.minecraft.world.item.Item; import net.minecraft.world.item.Items; import net.minecraft.world.item.crafting.ArmorDyeRecipe; @@ -40,15 +42,16 @@ import net.minecraft.world.item.crafting.FireworkStarRecipe; import net.minecraft.world.item.crafting.Ingredient; import net.minecraft.world.item.crafting.MapCloningRecipe; import net.minecraft.world.item.crafting.MapExtendingRecipe; +import net.minecraft.world.item.crafting.Recipe; import net.minecraft.world.item.crafting.RecipeSerializer; import net.minecraft.world.item.crafting.RepairItemRecipe; import net.minecraft.world.item.crafting.ShieldDecorationRecipe; -import net.minecraft.world.item.crafting.ShulkerBoxColoring; import net.minecraft.world.item.crafting.SmokingRecipe; -import net.minecraft.world.item.crafting.SuspiciousStewRecipe; import net.minecraft.world.item.crafting.TippedArrowRecipe; import net.minecraft.world.level.ItemLike; import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.ShulkerBoxBlock; +import net.minecraft.world.level.block.SuspiciousEffectHolder; public class VanillaRecipeProvider extends RecipeProvider { private static final ImmutableList COAL_SMELTABLES = ImmutableList.of(Items.COAL_ORE, Items.DEEPSLATE_COAL_ORE); @@ -62,61 +65,48 @@ public class VanillaRecipeProvider extends RecipeProvider { private static final ImmutableList REDSTONE_SMELTABLES = ImmutableList.of(Items.REDSTONE_ORE, Items.DEEPSLATE_REDSTONE_ORE); private static final ImmutableList EMERALD_SMELTABLES = ImmutableList.of(Items.EMERALD_ORE, Items.DEEPSLATE_EMERALD_ORE); - public VanillaRecipeProvider(PackOutput output, CompletableFuture registries) { - super(output, registries); + VanillaRecipeProvider(HolderLookup.Provider provider, RecipeOutput recipeOutput) { + super(provider, recipeOutput); } @Override - public CompletableFuture run(CachedOutput output, HolderLookup.Provider registries) { - return CompletableFuture.allOf( - super.run(output, registries), - this.buildAdvancement( - output, - registries, - Advancement.Builder.recipeAdvancement() - .addCriterion("impossible", CriteriaTriggers.IMPOSSIBLE.createCriterion(new ImpossibleTrigger.TriggerInstance())) - .build(RecipeBuilder.ROOT_RECIPE_ADVANCEMENT) - ) - ); - } - - @Override - protected void buildRecipes(RecipeOutput recipeOutput) { - generateForEnabledBlockFamilies(recipeOutput, FeatureFlagSet.of(FeatureFlags.VANILLA)); - planksFromLog(recipeOutput, Blocks.ACACIA_PLANKS, ItemTags.ACACIA_LOGS, 4); - planksFromLogs(recipeOutput, Blocks.BIRCH_PLANKS, ItemTags.BIRCH_LOGS, 4); - planksFromLogs(recipeOutput, Blocks.CRIMSON_PLANKS, ItemTags.CRIMSON_STEMS, 4); - planksFromLog(recipeOutput, Blocks.DARK_OAK_PLANKS, ItemTags.DARK_OAK_LOGS, 4); - planksFromLogs(recipeOutput, Blocks.JUNGLE_PLANKS, ItemTags.JUNGLE_LOGS, 4); - planksFromLogs(recipeOutput, Blocks.OAK_PLANKS, ItemTags.OAK_LOGS, 4); - planksFromLogs(recipeOutput, Blocks.SPRUCE_PLANKS, ItemTags.SPRUCE_LOGS, 4); - planksFromLogs(recipeOutput, Blocks.WARPED_PLANKS, ItemTags.WARPED_STEMS, 4); - planksFromLogs(recipeOutput, Blocks.MANGROVE_PLANKS, ItemTags.MANGROVE_LOGS, 4); - woodFromLogs(recipeOutput, Blocks.ACACIA_WOOD, Blocks.ACACIA_LOG); - woodFromLogs(recipeOutput, Blocks.BIRCH_WOOD, Blocks.BIRCH_LOG); - woodFromLogs(recipeOutput, Blocks.DARK_OAK_WOOD, Blocks.DARK_OAK_LOG); - woodFromLogs(recipeOutput, Blocks.JUNGLE_WOOD, Blocks.JUNGLE_LOG); - woodFromLogs(recipeOutput, Blocks.OAK_WOOD, Blocks.OAK_LOG); - woodFromLogs(recipeOutput, Blocks.SPRUCE_WOOD, Blocks.SPRUCE_LOG); - woodFromLogs(recipeOutput, Blocks.CRIMSON_HYPHAE, Blocks.CRIMSON_STEM); - woodFromLogs(recipeOutput, Blocks.WARPED_HYPHAE, Blocks.WARPED_STEM); - woodFromLogs(recipeOutput, Blocks.MANGROVE_WOOD, Blocks.MANGROVE_LOG); - woodFromLogs(recipeOutput, Blocks.STRIPPED_ACACIA_WOOD, Blocks.STRIPPED_ACACIA_LOG); - woodFromLogs(recipeOutput, Blocks.STRIPPED_BIRCH_WOOD, Blocks.STRIPPED_BIRCH_LOG); - woodFromLogs(recipeOutput, Blocks.STRIPPED_DARK_OAK_WOOD, Blocks.STRIPPED_DARK_OAK_LOG); - woodFromLogs(recipeOutput, Blocks.STRIPPED_JUNGLE_WOOD, Blocks.STRIPPED_JUNGLE_LOG); - woodFromLogs(recipeOutput, Blocks.STRIPPED_OAK_WOOD, Blocks.STRIPPED_OAK_LOG); - woodFromLogs(recipeOutput, Blocks.STRIPPED_SPRUCE_WOOD, Blocks.STRIPPED_SPRUCE_LOG); - woodFromLogs(recipeOutput, Blocks.STRIPPED_CRIMSON_HYPHAE, Blocks.STRIPPED_CRIMSON_STEM); - woodFromLogs(recipeOutput, Blocks.STRIPPED_WARPED_HYPHAE, Blocks.STRIPPED_WARPED_STEM); - woodFromLogs(recipeOutput, Blocks.STRIPPED_MANGROVE_WOOD, Blocks.STRIPPED_MANGROVE_LOG); - woodenBoat(recipeOutput, Items.ACACIA_BOAT, Blocks.ACACIA_PLANKS); - woodenBoat(recipeOutput, Items.BIRCH_BOAT, Blocks.BIRCH_PLANKS); - woodenBoat(recipeOutput, Items.DARK_OAK_BOAT, Blocks.DARK_OAK_PLANKS); - woodenBoat(recipeOutput, Items.JUNGLE_BOAT, Blocks.JUNGLE_PLANKS); - woodenBoat(recipeOutput, Items.OAK_BOAT, Blocks.OAK_PLANKS); - woodenBoat(recipeOutput, Items.SPRUCE_BOAT, Blocks.SPRUCE_PLANKS); - woodenBoat(recipeOutput, Items.MANGROVE_BOAT, Blocks.MANGROVE_PLANKS); + protected void buildRecipes() { + this.output.includeRootAdvancement(); + this.generateForEnabledBlockFamilies(FeatureFlagSet.of(FeatureFlags.VANILLA)); + this.planksFromLog(Blocks.ACACIA_PLANKS, ItemTags.ACACIA_LOGS, 4); + this.planksFromLogs(Blocks.BIRCH_PLANKS, ItemTags.BIRCH_LOGS, 4); + this.planksFromLogs(Blocks.CRIMSON_PLANKS, ItemTags.CRIMSON_STEMS, 4); + this.planksFromLog(Blocks.DARK_OAK_PLANKS, ItemTags.DARK_OAK_LOGS, 4); + this.planksFromLogs(Blocks.JUNGLE_PLANKS, ItemTags.JUNGLE_LOGS, 4); + this.planksFromLogs(Blocks.OAK_PLANKS, ItemTags.OAK_LOGS, 4); + this.planksFromLogs(Blocks.SPRUCE_PLANKS, ItemTags.SPRUCE_LOGS, 4); + this.planksFromLogs(Blocks.WARPED_PLANKS, ItemTags.WARPED_STEMS, 4); + this.planksFromLogs(Blocks.MANGROVE_PLANKS, ItemTags.MANGROVE_LOGS, 4); + this.woodFromLogs(Blocks.ACACIA_WOOD, Blocks.ACACIA_LOG); + this.woodFromLogs(Blocks.BIRCH_WOOD, Blocks.BIRCH_LOG); + this.woodFromLogs(Blocks.DARK_OAK_WOOD, Blocks.DARK_OAK_LOG); + this.woodFromLogs(Blocks.JUNGLE_WOOD, Blocks.JUNGLE_LOG); + this.woodFromLogs(Blocks.OAK_WOOD, Blocks.OAK_LOG); + this.woodFromLogs(Blocks.SPRUCE_WOOD, Blocks.SPRUCE_LOG); + this.woodFromLogs(Blocks.CRIMSON_HYPHAE, Blocks.CRIMSON_STEM); + this.woodFromLogs(Blocks.WARPED_HYPHAE, Blocks.WARPED_STEM); + this.woodFromLogs(Blocks.MANGROVE_WOOD, Blocks.MANGROVE_LOG); + this.woodFromLogs(Blocks.STRIPPED_ACACIA_WOOD, Blocks.STRIPPED_ACACIA_LOG); + this.woodFromLogs(Blocks.STRIPPED_BIRCH_WOOD, Blocks.STRIPPED_BIRCH_LOG); + this.woodFromLogs(Blocks.STRIPPED_DARK_OAK_WOOD, Blocks.STRIPPED_DARK_OAK_LOG); + this.woodFromLogs(Blocks.STRIPPED_JUNGLE_WOOD, Blocks.STRIPPED_JUNGLE_LOG); + this.woodFromLogs(Blocks.STRIPPED_OAK_WOOD, Blocks.STRIPPED_OAK_LOG); + this.woodFromLogs(Blocks.STRIPPED_SPRUCE_WOOD, Blocks.STRIPPED_SPRUCE_LOG); + this.woodFromLogs(Blocks.STRIPPED_CRIMSON_HYPHAE, Blocks.STRIPPED_CRIMSON_STEM); + this.woodFromLogs(Blocks.STRIPPED_WARPED_HYPHAE, Blocks.STRIPPED_WARPED_STEM); + this.woodFromLogs(Blocks.STRIPPED_MANGROVE_WOOD, Blocks.STRIPPED_MANGROVE_LOG); + this.woodenBoat(Items.ACACIA_BOAT, Blocks.ACACIA_PLANKS); + this.woodenBoat(Items.BIRCH_BOAT, Blocks.BIRCH_PLANKS); + this.woodenBoat(Items.DARK_OAK_BOAT, Blocks.DARK_OAK_PLANKS); + this.woodenBoat(Items.JUNGLE_BOAT, Blocks.JUNGLE_PLANKS); + this.woodenBoat(Items.OAK_BOAT, Blocks.OAK_PLANKS); + this.woodenBoat(Items.SPRUCE_BOAT, Blocks.SPRUCE_PLANKS); + this.woodenBoat(Items.MANGROVE_BOAT, Blocks.MANGROVE_PLANKS); List list = List.of( Items.BLACK_DYE, Items.BLUE_DYE, @@ -189,333 +179,325 @@ public class VanillaRecipeProvider extends RecipeProvider { Items.YELLOW_CARPET, Items.WHITE_CARPET ); - colorBlockWithDye(recipeOutput, list, list2, "wool"); - colorBlockWithDye(recipeOutput, list, list3, "bed"); - colorBlockWithDye(recipeOutput, list, list4, "carpet"); - carpet(recipeOutput, Blocks.BLACK_CARPET, Blocks.BLACK_WOOL); - bedFromPlanksAndWool(recipeOutput, Items.BLACK_BED, Blocks.BLACK_WOOL); - banner(recipeOutput, Items.BLACK_BANNER, Blocks.BLACK_WOOL); - carpet(recipeOutput, Blocks.BLUE_CARPET, Blocks.BLUE_WOOL); - bedFromPlanksAndWool(recipeOutput, Items.BLUE_BED, Blocks.BLUE_WOOL); - banner(recipeOutput, Items.BLUE_BANNER, Blocks.BLUE_WOOL); - carpet(recipeOutput, Blocks.BROWN_CARPET, Blocks.BROWN_WOOL); - bedFromPlanksAndWool(recipeOutput, Items.BROWN_BED, Blocks.BROWN_WOOL); - banner(recipeOutput, Items.BROWN_BANNER, Blocks.BROWN_WOOL); - carpet(recipeOutput, Blocks.CYAN_CARPET, Blocks.CYAN_WOOL); - bedFromPlanksAndWool(recipeOutput, Items.CYAN_BED, Blocks.CYAN_WOOL); - banner(recipeOutput, Items.CYAN_BANNER, Blocks.CYAN_WOOL); - carpet(recipeOutput, Blocks.GRAY_CARPET, Blocks.GRAY_WOOL); - bedFromPlanksAndWool(recipeOutput, Items.GRAY_BED, Blocks.GRAY_WOOL); - banner(recipeOutput, Items.GRAY_BANNER, Blocks.GRAY_WOOL); - carpet(recipeOutput, Blocks.GREEN_CARPET, Blocks.GREEN_WOOL); - bedFromPlanksAndWool(recipeOutput, Items.GREEN_BED, Blocks.GREEN_WOOL); - banner(recipeOutput, Items.GREEN_BANNER, Blocks.GREEN_WOOL); - carpet(recipeOutput, Blocks.LIGHT_BLUE_CARPET, Blocks.LIGHT_BLUE_WOOL); - bedFromPlanksAndWool(recipeOutput, Items.LIGHT_BLUE_BED, Blocks.LIGHT_BLUE_WOOL); - banner(recipeOutput, Items.LIGHT_BLUE_BANNER, Blocks.LIGHT_BLUE_WOOL); - carpet(recipeOutput, Blocks.LIGHT_GRAY_CARPET, Blocks.LIGHT_GRAY_WOOL); - bedFromPlanksAndWool(recipeOutput, Items.LIGHT_GRAY_BED, Blocks.LIGHT_GRAY_WOOL); - banner(recipeOutput, Items.LIGHT_GRAY_BANNER, Blocks.LIGHT_GRAY_WOOL); - carpet(recipeOutput, Blocks.LIME_CARPET, Blocks.LIME_WOOL); - bedFromPlanksAndWool(recipeOutput, Items.LIME_BED, Blocks.LIME_WOOL); - banner(recipeOutput, Items.LIME_BANNER, Blocks.LIME_WOOL); - carpet(recipeOutput, Blocks.MAGENTA_CARPET, Blocks.MAGENTA_WOOL); - bedFromPlanksAndWool(recipeOutput, Items.MAGENTA_BED, Blocks.MAGENTA_WOOL); - banner(recipeOutput, Items.MAGENTA_BANNER, Blocks.MAGENTA_WOOL); - carpet(recipeOutput, Blocks.ORANGE_CARPET, Blocks.ORANGE_WOOL); - bedFromPlanksAndWool(recipeOutput, Items.ORANGE_BED, Blocks.ORANGE_WOOL); - banner(recipeOutput, Items.ORANGE_BANNER, Blocks.ORANGE_WOOL); - carpet(recipeOutput, Blocks.PINK_CARPET, Blocks.PINK_WOOL); - bedFromPlanksAndWool(recipeOutput, Items.PINK_BED, Blocks.PINK_WOOL); - banner(recipeOutput, Items.PINK_BANNER, Blocks.PINK_WOOL); - carpet(recipeOutput, Blocks.PURPLE_CARPET, Blocks.PURPLE_WOOL); - bedFromPlanksAndWool(recipeOutput, Items.PURPLE_BED, Blocks.PURPLE_WOOL); - banner(recipeOutput, Items.PURPLE_BANNER, Blocks.PURPLE_WOOL); - carpet(recipeOutput, Blocks.RED_CARPET, Blocks.RED_WOOL); - bedFromPlanksAndWool(recipeOutput, Items.RED_BED, Blocks.RED_WOOL); - banner(recipeOutput, Items.RED_BANNER, Blocks.RED_WOOL); - carpet(recipeOutput, Blocks.WHITE_CARPET, Blocks.WHITE_WOOL); - bedFromPlanksAndWool(recipeOutput, Items.WHITE_BED, Blocks.WHITE_WOOL); - banner(recipeOutput, Items.WHITE_BANNER, Blocks.WHITE_WOOL); - carpet(recipeOutput, Blocks.YELLOW_CARPET, Blocks.YELLOW_WOOL); - bedFromPlanksAndWool(recipeOutput, Items.YELLOW_BED, Blocks.YELLOW_WOOL); - banner(recipeOutput, Items.YELLOW_BANNER, Blocks.YELLOW_WOOL); - carpet(recipeOutput, Blocks.MOSS_CARPET, Blocks.MOSS_BLOCK); - stainedGlassFromGlassAndDye(recipeOutput, Blocks.BLACK_STAINED_GLASS, Items.BLACK_DYE); - stainedGlassPaneFromStainedGlass(recipeOutput, Blocks.BLACK_STAINED_GLASS_PANE, Blocks.BLACK_STAINED_GLASS); - stainedGlassPaneFromGlassPaneAndDye(recipeOutput, Blocks.BLACK_STAINED_GLASS_PANE, Items.BLACK_DYE); - stainedGlassFromGlassAndDye(recipeOutput, Blocks.BLUE_STAINED_GLASS, Items.BLUE_DYE); - stainedGlassPaneFromStainedGlass(recipeOutput, Blocks.BLUE_STAINED_GLASS_PANE, Blocks.BLUE_STAINED_GLASS); - stainedGlassPaneFromGlassPaneAndDye(recipeOutput, Blocks.BLUE_STAINED_GLASS_PANE, Items.BLUE_DYE); - stainedGlassFromGlassAndDye(recipeOutput, Blocks.BROWN_STAINED_GLASS, Items.BROWN_DYE); - stainedGlassPaneFromStainedGlass(recipeOutput, Blocks.BROWN_STAINED_GLASS_PANE, Blocks.BROWN_STAINED_GLASS); - stainedGlassPaneFromGlassPaneAndDye(recipeOutput, Blocks.BROWN_STAINED_GLASS_PANE, Items.BROWN_DYE); - stainedGlassFromGlassAndDye(recipeOutput, Blocks.CYAN_STAINED_GLASS, Items.CYAN_DYE); - stainedGlassPaneFromStainedGlass(recipeOutput, Blocks.CYAN_STAINED_GLASS_PANE, Blocks.CYAN_STAINED_GLASS); - stainedGlassPaneFromGlassPaneAndDye(recipeOutput, Blocks.CYAN_STAINED_GLASS_PANE, Items.CYAN_DYE); - stainedGlassFromGlassAndDye(recipeOutput, Blocks.GRAY_STAINED_GLASS, Items.GRAY_DYE); - stainedGlassPaneFromStainedGlass(recipeOutput, Blocks.GRAY_STAINED_GLASS_PANE, Blocks.GRAY_STAINED_GLASS); - stainedGlassPaneFromGlassPaneAndDye(recipeOutput, Blocks.GRAY_STAINED_GLASS_PANE, Items.GRAY_DYE); - stainedGlassFromGlassAndDye(recipeOutput, Blocks.GREEN_STAINED_GLASS, Items.GREEN_DYE); - stainedGlassPaneFromStainedGlass(recipeOutput, Blocks.GREEN_STAINED_GLASS_PANE, Blocks.GREEN_STAINED_GLASS); - stainedGlassPaneFromGlassPaneAndDye(recipeOutput, Blocks.GREEN_STAINED_GLASS_PANE, Items.GREEN_DYE); - stainedGlassFromGlassAndDye(recipeOutput, Blocks.LIGHT_BLUE_STAINED_GLASS, Items.LIGHT_BLUE_DYE); - stainedGlassPaneFromStainedGlass(recipeOutput, Blocks.LIGHT_BLUE_STAINED_GLASS_PANE, Blocks.LIGHT_BLUE_STAINED_GLASS); - stainedGlassPaneFromGlassPaneAndDye(recipeOutput, Blocks.LIGHT_BLUE_STAINED_GLASS_PANE, Items.LIGHT_BLUE_DYE); - stainedGlassFromGlassAndDye(recipeOutput, Blocks.LIGHT_GRAY_STAINED_GLASS, Items.LIGHT_GRAY_DYE); - stainedGlassPaneFromStainedGlass(recipeOutput, Blocks.LIGHT_GRAY_STAINED_GLASS_PANE, Blocks.LIGHT_GRAY_STAINED_GLASS); - stainedGlassPaneFromGlassPaneAndDye(recipeOutput, Blocks.LIGHT_GRAY_STAINED_GLASS_PANE, Items.LIGHT_GRAY_DYE); - stainedGlassFromGlassAndDye(recipeOutput, Blocks.LIME_STAINED_GLASS, Items.LIME_DYE); - stainedGlassPaneFromStainedGlass(recipeOutput, Blocks.LIME_STAINED_GLASS_PANE, Blocks.LIME_STAINED_GLASS); - stainedGlassPaneFromGlassPaneAndDye(recipeOutput, Blocks.LIME_STAINED_GLASS_PANE, Items.LIME_DYE); - stainedGlassFromGlassAndDye(recipeOutput, Blocks.MAGENTA_STAINED_GLASS, Items.MAGENTA_DYE); - stainedGlassPaneFromStainedGlass(recipeOutput, Blocks.MAGENTA_STAINED_GLASS_PANE, Blocks.MAGENTA_STAINED_GLASS); - stainedGlassPaneFromGlassPaneAndDye(recipeOutput, Blocks.MAGENTA_STAINED_GLASS_PANE, Items.MAGENTA_DYE); - stainedGlassFromGlassAndDye(recipeOutput, Blocks.ORANGE_STAINED_GLASS, Items.ORANGE_DYE); - stainedGlassPaneFromStainedGlass(recipeOutput, Blocks.ORANGE_STAINED_GLASS_PANE, Blocks.ORANGE_STAINED_GLASS); - stainedGlassPaneFromGlassPaneAndDye(recipeOutput, Blocks.ORANGE_STAINED_GLASS_PANE, Items.ORANGE_DYE); - stainedGlassFromGlassAndDye(recipeOutput, Blocks.PINK_STAINED_GLASS, Items.PINK_DYE); - stainedGlassPaneFromStainedGlass(recipeOutput, Blocks.PINK_STAINED_GLASS_PANE, Blocks.PINK_STAINED_GLASS); - stainedGlassPaneFromGlassPaneAndDye(recipeOutput, Blocks.PINK_STAINED_GLASS_PANE, Items.PINK_DYE); - stainedGlassFromGlassAndDye(recipeOutput, Blocks.PURPLE_STAINED_GLASS, Items.PURPLE_DYE); - stainedGlassPaneFromStainedGlass(recipeOutput, Blocks.PURPLE_STAINED_GLASS_PANE, Blocks.PURPLE_STAINED_GLASS); - stainedGlassPaneFromGlassPaneAndDye(recipeOutput, Blocks.PURPLE_STAINED_GLASS_PANE, Items.PURPLE_DYE); - stainedGlassFromGlassAndDye(recipeOutput, Blocks.RED_STAINED_GLASS, Items.RED_DYE); - stainedGlassPaneFromStainedGlass(recipeOutput, Blocks.RED_STAINED_GLASS_PANE, Blocks.RED_STAINED_GLASS); - stainedGlassPaneFromGlassPaneAndDye(recipeOutput, Blocks.RED_STAINED_GLASS_PANE, Items.RED_DYE); - stainedGlassFromGlassAndDye(recipeOutput, Blocks.WHITE_STAINED_GLASS, Items.WHITE_DYE); - stainedGlassPaneFromStainedGlass(recipeOutput, Blocks.WHITE_STAINED_GLASS_PANE, Blocks.WHITE_STAINED_GLASS); - stainedGlassPaneFromGlassPaneAndDye(recipeOutput, Blocks.WHITE_STAINED_GLASS_PANE, Items.WHITE_DYE); - stainedGlassFromGlassAndDye(recipeOutput, Blocks.YELLOW_STAINED_GLASS, Items.YELLOW_DYE); - stainedGlassPaneFromStainedGlass(recipeOutput, Blocks.YELLOW_STAINED_GLASS_PANE, Blocks.YELLOW_STAINED_GLASS); - stainedGlassPaneFromGlassPaneAndDye(recipeOutput, Blocks.YELLOW_STAINED_GLASS_PANE, Items.YELLOW_DYE); - coloredTerracottaFromTerracottaAndDye(recipeOutput, Blocks.BLACK_TERRACOTTA, Items.BLACK_DYE); - coloredTerracottaFromTerracottaAndDye(recipeOutput, Blocks.BLUE_TERRACOTTA, Items.BLUE_DYE); - coloredTerracottaFromTerracottaAndDye(recipeOutput, Blocks.BROWN_TERRACOTTA, Items.BROWN_DYE); - coloredTerracottaFromTerracottaAndDye(recipeOutput, Blocks.CYAN_TERRACOTTA, Items.CYAN_DYE); - coloredTerracottaFromTerracottaAndDye(recipeOutput, Blocks.GRAY_TERRACOTTA, Items.GRAY_DYE); - coloredTerracottaFromTerracottaAndDye(recipeOutput, Blocks.GREEN_TERRACOTTA, Items.GREEN_DYE); - coloredTerracottaFromTerracottaAndDye(recipeOutput, Blocks.LIGHT_BLUE_TERRACOTTA, Items.LIGHT_BLUE_DYE); - coloredTerracottaFromTerracottaAndDye(recipeOutput, Blocks.LIGHT_GRAY_TERRACOTTA, Items.LIGHT_GRAY_DYE); - coloredTerracottaFromTerracottaAndDye(recipeOutput, Blocks.LIME_TERRACOTTA, Items.LIME_DYE); - coloredTerracottaFromTerracottaAndDye(recipeOutput, Blocks.MAGENTA_TERRACOTTA, Items.MAGENTA_DYE); - coloredTerracottaFromTerracottaAndDye(recipeOutput, Blocks.ORANGE_TERRACOTTA, Items.ORANGE_DYE); - coloredTerracottaFromTerracottaAndDye(recipeOutput, Blocks.PINK_TERRACOTTA, Items.PINK_DYE); - coloredTerracottaFromTerracottaAndDye(recipeOutput, Blocks.PURPLE_TERRACOTTA, Items.PURPLE_DYE); - coloredTerracottaFromTerracottaAndDye(recipeOutput, Blocks.RED_TERRACOTTA, Items.RED_DYE); - coloredTerracottaFromTerracottaAndDye(recipeOutput, Blocks.WHITE_TERRACOTTA, Items.WHITE_DYE); - coloredTerracottaFromTerracottaAndDye(recipeOutput, Blocks.YELLOW_TERRACOTTA, Items.YELLOW_DYE); - concretePowder(recipeOutput, Blocks.BLACK_CONCRETE_POWDER, Items.BLACK_DYE); - concretePowder(recipeOutput, Blocks.BLUE_CONCRETE_POWDER, Items.BLUE_DYE); - concretePowder(recipeOutput, Blocks.BROWN_CONCRETE_POWDER, Items.BROWN_DYE); - concretePowder(recipeOutput, Blocks.CYAN_CONCRETE_POWDER, Items.CYAN_DYE); - concretePowder(recipeOutput, Blocks.GRAY_CONCRETE_POWDER, Items.GRAY_DYE); - concretePowder(recipeOutput, Blocks.GREEN_CONCRETE_POWDER, Items.GREEN_DYE); - concretePowder(recipeOutput, Blocks.LIGHT_BLUE_CONCRETE_POWDER, Items.LIGHT_BLUE_DYE); - concretePowder(recipeOutput, Blocks.LIGHT_GRAY_CONCRETE_POWDER, Items.LIGHT_GRAY_DYE); - concretePowder(recipeOutput, Blocks.LIME_CONCRETE_POWDER, Items.LIME_DYE); - concretePowder(recipeOutput, Blocks.MAGENTA_CONCRETE_POWDER, Items.MAGENTA_DYE); - concretePowder(recipeOutput, Blocks.ORANGE_CONCRETE_POWDER, Items.ORANGE_DYE); - concretePowder(recipeOutput, Blocks.PINK_CONCRETE_POWDER, Items.PINK_DYE); - concretePowder(recipeOutput, Blocks.PURPLE_CONCRETE_POWDER, Items.PURPLE_DYE); - concretePowder(recipeOutput, Blocks.RED_CONCRETE_POWDER, Items.RED_DYE); - concretePowder(recipeOutput, Blocks.WHITE_CONCRETE_POWDER, Items.WHITE_DYE); - concretePowder(recipeOutput, Blocks.YELLOW_CONCRETE_POWDER, Items.YELLOW_DYE); - ShapedRecipeBuilder.shaped(RecipeCategory.DECORATIONS, Items.CANDLE) + this.colorBlockWithDye(list, list2, "wool"); + this.colorBlockWithDye(list, list3, "bed"); + this.colorBlockWithDye(list, list4, "carpet"); + this.carpet(Blocks.BLACK_CARPET, Blocks.BLACK_WOOL); + this.bedFromPlanksAndWool(Items.BLACK_BED, Blocks.BLACK_WOOL); + this.banner(Items.BLACK_BANNER, Blocks.BLACK_WOOL); + this.carpet(Blocks.BLUE_CARPET, Blocks.BLUE_WOOL); + this.bedFromPlanksAndWool(Items.BLUE_BED, Blocks.BLUE_WOOL); + this.banner(Items.BLUE_BANNER, Blocks.BLUE_WOOL); + this.carpet(Blocks.BROWN_CARPET, Blocks.BROWN_WOOL); + this.bedFromPlanksAndWool(Items.BROWN_BED, Blocks.BROWN_WOOL); + this.banner(Items.BROWN_BANNER, Blocks.BROWN_WOOL); + this.carpet(Blocks.CYAN_CARPET, Blocks.CYAN_WOOL); + this.bedFromPlanksAndWool(Items.CYAN_BED, Blocks.CYAN_WOOL); + this.banner(Items.CYAN_BANNER, Blocks.CYAN_WOOL); + this.carpet(Blocks.GRAY_CARPET, Blocks.GRAY_WOOL); + this.bedFromPlanksAndWool(Items.GRAY_BED, Blocks.GRAY_WOOL); + this.banner(Items.GRAY_BANNER, Blocks.GRAY_WOOL); + this.carpet(Blocks.GREEN_CARPET, Blocks.GREEN_WOOL); + this.bedFromPlanksAndWool(Items.GREEN_BED, Blocks.GREEN_WOOL); + this.banner(Items.GREEN_BANNER, Blocks.GREEN_WOOL); + this.carpet(Blocks.LIGHT_BLUE_CARPET, Blocks.LIGHT_BLUE_WOOL); + this.bedFromPlanksAndWool(Items.LIGHT_BLUE_BED, Blocks.LIGHT_BLUE_WOOL); + this.banner(Items.LIGHT_BLUE_BANNER, Blocks.LIGHT_BLUE_WOOL); + this.carpet(Blocks.LIGHT_GRAY_CARPET, Blocks.LIGHT_GRAY_WOOL); + this.bedFromPlanksAndWool(Items.LIGHT_GRAY_BED, Blocks.LIGHT_GRAY_WOOL); + this.banner(Items.LIGHT_GRAY_BANNER, Blocks.LIGHT_GRAY_WOOL); + this.carpet(Blocks.LIME_CARPET, Blocks.LIME_WOOL); + this.bedFromPlanksAndWool(Items.LIME_BED, Blocks.LIME_WOOL); + this.banner(Items.LIME_BANNER, Blocks.LIME_WOOL); + this.carpet(Blocks.MAGENTA_CARPET, Blocks.MAGENTA_WOOL); + this.bedFromPlanksAndWool(Items.MAGENTA_BED, Blocks.MAGENTA_WOOL); + this.banner(Items.MAGENTA_BANNER, Blocks.MAGENTA_WOOL); + this.carpet(Blocks.ORANGE_CARPET, Blocks.ORANGE_WOOL); + this.bedFromPlanksAndWool(Items.ORANGE_BED, Blocks.ORANGE_WOOL); + this.banner(Items.ORANGE_BANNER, Blocks.ORANGE_WOOL); + this.carpet(Blocks.PINK_CARPET, Blocks.PINK_WOOL); + this.bedFromPlanksAndWool(Items.PINK_BED, Blocks.PINK_WOOL); + this.banner(Items.PINK_BANNER, Blocks.PINK_WOOL); + this.carpet(Blocks.PURPLE_CARPET, Blocks.PURPLE_WOOL); + this.bedFromPlanksAndWool(Items.PURPLE_BED, Blocks.PURPLE_WOOL); + this.banner(Items.PURPLE_BANNER, Blocks.PURPLE_WOOL); + this.carpet(Blocks.RED_CARPET, Blocks.RED_WOOL); + this.bedFromPlanksAndWool(Items.RED_BED, Blocks.RED_WOOL); + this.banner(Items.RED_BANNER, Blocks.RED_WOOL); + this.carpet(Blocks.WHITE_CARPET, Blocks.WHITE_WOOL); + this.bedFromPlanksAndWool(Items.WHITE_BED, Blocks.WHITE_WOOL); + this.banner(Items.WHITE_BANNER, Blocks.WHITE_WOOL); + this.carpet(Blocks.YELLOW_CARPET, Blocks.YELLOW_WOOL); + this.bedFromPlanksAndWool(Items.YELLOW_BED, Blocks.YELLOW_WOOL); + this.banner(Items.YELLOW_BANNER, Blocks.YELLOW_WOOL); + this.carpet(Blocks.MOSS_CARPET, Blocks.MOSS_BLOCK); + this.stainedGlassFromGlassAndDye(Blocks.BLACK_STAINED_GLASS, Items.BLACK_DYE); + this.stainedGlassPaneFromStainedGlass(Blocks.BLACK_STAINED_GLASS_PANE, Blocks.BLACK_STAINED_GLASS); + this.stainedGlassPaneFromGlassPaneAndDye(Blocks.BLACK_STAINED_GLASS_PANE, Items.BLACK_DYE); + this.stainedGlassFromGlassAndDye(Blocks.BLUE_STAINED_GLASS, Items.BLUE_DYE); + this.stainedGlassPaneFromStainedGlass(Blocks.BLUE_STAINED_GLASS_PANE, Blocks.BLUE_STAINED_GLASS); + this.stainedGlassPaneFromGlassPaneAndDye(Blocks.BLUE_STAINED_GLASS_PANE, Items.BLUE_DYE); + this.stainedGlassFromGlassAndDye(Blocks.BROWN_STAINED_GLASS, Items.BROWN_DYE); + this.stainedGlassPaneFromStainedGlass(Blocks.BROWN_STAINED_GLASS_PANE, Blocks.BROWN_STAINED_GLASS); + this.stainedGlassPaneFromGlassPaneAndDye(Blocks.BROWN_STAINED_GLASS_PANE, Items.BROWN_DYE); + this.stainedGlassFromGlassAndDye(Blocks.CYAN_STAINED_GLASS, Items.CYAN_DYE); + this.stainedGlassPaneFromStainedGlass(Blocks.CYAN_STAINED_GLASS_PANE, Blocks.CYAN_STAINED_GLASS); + this.stainedGlassPaneFromGlassPaneAndDye(Blocks.CYAN_STAINED_GLASS_PANE, Items.CYAN_DYE); + this.stainedGlassFromGlassAndDye(Blocks.GRAY_STAINED_GLASS, Items.GRAY_DYE); + this.stainedGlassPaneFromStainedGlass(Blocks.GRAY_STAINED_GLASS_PANE, Blocks.GRAY_STAINED_GLASS); + this.stainedGlassPaneFromGlassPaneAndDye(Blocks.GRAY_STAINED_GLASS_PANE, Items.GRAY_DYE); + this.stainedGlassFromGlassAndDye(Blocks.GREEN_STAINED_GLASS, Items.GREEN_DYE); + this.stainedGlassPaneFromStainedGlass(Blocks.GREEN_STAINED_GLASS_PANE, Blocks.GREEN_STAINED_GLASS); + this.stainedGlassPaneFromGlassPaneAndDye(Blocks.GREEN_STAINED_GLASS_PANE, Items.GREEN_DYE); + this.stainedGlassFromGlassAndDye(Blocks.LIGHT_BLUE_STAINED_GLASS, Items.LIGHT_BLUE_DYE); + this.stainedGlassPaneFromStainedGlass(Blocks.LIGHT_BLUE_STAINED_GLASS_PANE, Blocks.LIGHT_BLUE_STAINED_GLASS); + this.stainedGlassPaneFromGlassPaneAndDye(Blocks.LIGHT_BLUE_STAINED_GLASS_PANE, Items.LIGHT_BLUE_DYE); + this.stainedGlassFromGlassAndDye(Blocks.LIGHT_GRAY_STAINED_GLASS, Items.LIGHT_GRAY_DYE); + this.stainedGlassPaneFromStainedGlass(Blocks.LIGHT_GRAY_STAINED_GLASS_PANE, Blocks.LIGHT_GRAY_STAINED_GLASS); + this.stainedGlassPaneFromGlassPaneAndDye(Blocks.LIGHT_GRAY_STAINED_GLASS_PANE, Items.LIGHT_GRAY_DYE); + this.stainedGlassFromGlassAndDye(Blocks.LIME_STAINED_GLASS, Items.LIME_DYE); + this.stainedGlassPaneFromStainedGlass(Blocks.LIME_STAINED_GLASS_PANE, Blocks.LIME_STAINED_GLASS); + this.stainedGlassPaneFromGlassPaneAndDye(Blocks.LIME_STAINED_GLASS_PANE, Items.LIME_DYE); + this.stainedGlassFromGlassAndDye(Blocks.MAGENTA_STAINED_GLASS, Items.MAGENTA_DYE); + this.stainedGlassPaneFromStainedGlass(Blocks.MAGENTA_STAINED_GLASS_PANE, Blocks.MAGENTA_STAINED_GLASS); + this.stainedGlassPaneFromGlassPaneAndDye(Blocks.MAGENTA_STAINED_GLASS_PANE, Items.MAGENTA_DYE); + this.stainedGlassFromGlassAndDye(Blocks.ORANGE_STAINED_GLASS, Items.ORANGE_DYE); + this.stainedGlassPaneFromStainedGlass(Blocks.ORANGE_STAINED_GLASS_PANE, Blocks.ORANGE_STAINED_GLASS); + this.stainedGlassPaneFromGlassPaneAndDye(Blocks.ORANGE_STAINED_GLASS_PANE, Items.ORANGE_DYE); + this.stainedGlassFromGlassAndDye(Blocks.PINK_STAINED_GLASS, Items.PINK_DYE); + this.stainedGlassPaneFromStainedGlass(Blocks.PINK_STAINED_GLASS_PANE, Blocks.PINK_STAINED_GLASS); + this.stainedGlassPaneFromGlassPaneAndDye(Blocks.PINK_STAINED_GLASS_PANE, Items.PINK_DYE); + this.stainedGlassFromGlassAndDye(Blocks.PURPLE_STAINED_GLASS, Items.PURPLE_DYE); + this.stainedGlassPaneFromStainedGlass(Blocks.PURPLE_STAINED_GLASS_PANE, Blocks.PURPLE_STAINED_GLASS); + this.stainedGlassPaneFromGlassPaneAndDye(Blocks.PURPLE_STAINED_GLASS_PANE, Items.PURPLE_DYE); + this.stainedGlassFromGlassAndDye(Blocks.RED_STAINED_GLASS, Items.RED_DYE); + this.stainedGlassPaneFromStainedGlass(Blocks.RED_STAINED_GLASS_PANE, Blocks.RED_STAINED_GLASS); + this.stainedGlassPaneFromGlassPaneAndDye(Blocks.RED_STAINED_GLASS_PANE, Items.RED_DYE); + this.stainedGlassFromGlassAndDye(Blocks.WHITE_STAINED_GLASS, Items.WHITE_DYE); + this.stainedGlassPaneFromStainedGlass(Blocks.WHITE_STAINED_GLASS_PANE, Blocks.WHITE_STAINED_GLASS); + this.stainedGlassPaneFromGlassPaneAndDye(Blocks.WHITE_STAINED_GLASS_PANE, Items.WHITE_DYE); + this.stainedGlassFromGlassAndDye(Blocks.YELLOW_STAINED_GLASS, Items.YELLOW_DYE); + this.stainedGlassPaneFromStainedGlass(Blocks.YELLOW_STAINED_GLASS_PANE, Blocks.YELLOW_STAINED_GLASS); + this.stainedGlassPaneFromGlassPaneAndDye(Blocks.YELLOW_STAINED_GLASS_PANE, Items.YELLOW_DYE); + this.coloredTerracottaFromTerracottaAndDye(Blocks.BLACK_TERRACOTTA, Items.BLACK_DYE); + this.coloredTerracottaFromTerracottaAndDye(Blocks.BLUE_TERRACOTTA, Items.BLUE_DYE); + this.coloredTerracottaFromTerracottaAndDye(Blocks.BROWN_TERRACOTTA, Items.BROWN_DYE); + this.coloredTerracottaFromTerracottaAndDye(Blocks.CYAN_TERRACOTTA, Items.CYAN_DYE); + this.coloredTerracottaFromTerracottaAndDye(Blocks.GRAY_TERRACOTTA, Items.GRAY_DYE); + this.coloredTerracottaFromTerracottaAndDye(Blocks.GREEN_TERRACOTTA, Items.GREEN_DYE); + this.coloredTerracottaFromTerracottaAndDye(Blocks.LIGHT_BLUE_TERRACOTTA, Items.LIGHT_BLUE_DYE); + this.coloredTerracottaFromTerracottaAndDye(Blocks.LIGHT_GRAY_TERRACOTTA, Items.LIGHT_GRAY_DYE); + this.coloredTerracottaFromTerracottaAndDye(Blocks.LIME_TERRACOTTA, Items.LIME_DYE); + this.coloredTerracottaFromTerracottaAndDye(Blocks.MAGENTA_TERRACOTTA, Items.MAGENTA_DYE); + this.coloredTerracottaFromTerracottaAndDye(Blocks.ORANGE_TERRACOTTA, Items.ORANGE_DYE); + this.coloredTerracottaFromTerracottaAndDye(Blocks.PINK_TERRACOTTA, Items.PINK_DYE); + this.coloredTerracottaFromTerracottaAndDye(Blocks.PURPLE_TERRACOTTA, Items.PURPLE_DYE); + this.coloredTerracottaFromTerracottaAndDye(Blocks.RED_TERRACOTTA, Items.RED_DYE); + this.coloredTerracottaFromTerracottaAndDye(Blocks.WHITE_TERRACOTTA, Items.WHITE_DYE); + this.coloredTerracottaFromTerracottaAndDye(Blocks.YELLOW_TERRACOTTA, Items.YELLOW_DYE); + this.concretePowder(Blocks.BLACK_CONCRETE_POWDER, Items.BLACK_DYE); + this.concretePowder(Blocks.BLUE_CONCRETE_POWDER, Items.BLUE_DYE); + this.concretePowder(Blocks.BROWN_CONCRETE_POWDER, Items.BROWN_DYE); + this.concretePowder(Blocks.CYAN_CONCRETE_POWDER, Items.CYAN_DYE); + this.concretePowder(Blocks.GRAY_CONCRETE_POWDER, Items.GRAY_DYE); + this.concretePowder(Blocks.GREEN_CONCRETE_POWDER, Items.GREEN_DYE); + this.concretePowder(Blocks.LIGHT_BLUE_CONCRETE_POWDER, Items.LIGHT_BLUE_DYE); + this.concretePowder(Blocks.LIGHT_GRAY_CONCRETE_POWDER, Items.LIGHT_GRAY_DYE); + this.concretePowder(Blocks.LIME_CONCRETE_POWDER, Items.LIME_DYE); + this.concretePowder(Blocks.MAGENTA_CONCRETE_POWDER, Items.MAGENTA_DYE); + this.concretePowder(Blocks.ORANGE_CONCRETE_POWDER, Items.ORANGE_DYE); + this.concretePowder(Blocks.PINK_CONCRETE_POWDER, Items.PINK_DYE); + this.concretePowder(Blocks.PURPLE_CONCRETE_POWDER, Items.PURPLE_DYE); + this.concretePowder(Blocks.RED_CONCRETE_POWDER, Items.RED_DYE); + this.concretePowder(Blocks.WHITE_CONCRETE_POWDER, Items.WHITE_DYE); + this.concretePowder(Blocks.YELLOW_CONCRETE_POWDER, Items.YELLOW_DYE); + this.shaped(RecipeCategory.DECORATIONS, Items.CANDLE) .define('S', Items.STRING) .define('H', Items.HONEYCOMB) .pattern("S") .pattern("H") - .unlockedBy("has_string", has(Items.STRING)) - .unlockedBy("has_honeycomb", has(Items.HONEYCOMB)) - .save(recipeOutput); - candle(recipeOutput, Blocks.BLACK_CANDLE, Items.BLACK_DYE); - candle(recipeOutput, Blocks.BLUE_CANDLE, Items.BLUE_DYE); - candle(recipeOutput, Blocks.BROWN_CANDLE, Items.BROWN_DYE); - candle(recipeOutput, Blocks.CYAN_CANDLE, Items.CYAN_DYE); - candle(recipeOutput, Blocks.GRAY_CANDLE, Items.GRAY_DYE); - candle(recipeOutput, Blocks.GREEN_CANDLE, Items.GREEN_DYE); - candle(recipeOutput, Blocks.LIGHT_BLUE_CANDLE, Items.LIGHT_BLUE_DYE); - candle(recipeOutput, Blocks.LIGHT_GRAY_CANDLE, Items.LIGHT_GRAY_DYE); - candle(recipeOutput, Blocks.LIME_CANDLE, Items.LIME_DYE); - candle(recipeOutput, Blocks.MAGENTA_CANDLE, Items.MAGENTA_DYE); - candle(recipeOutput, Blocks.ORANGE_CANDLE, Items.ORANGE_DYE); - candle(recipeOutput, Blocks.PINK_CANDLE, Items.PINK_DYE); - candle(recipeOutput, Blocks.PURPLE_CANDLE, Items.PURPLE_DYE); - candle(recipeOutput, Blocks.RED_CANDLE, Items.RED_DYE); - candle(recipeOutput, Blocks.WHITE_CANDLE, Items.WHITE_DYE); - candle(recipeOutput, Blocks.YELLOW_CANDLE, Items.YELLOW_DYE); - ShapelessRecipeBuilder.shapeless(RecipeCategory.BUILDING_BLOCKS, Blocks.PACKED_MUD, 1) + .unlockedBy("has_string", this.has(Items.STRING)) + .unlockedBy("has_honeycomb", this.has(Items.HONEYCOMB)) + .save(this.output); + this.candle(Blocks.BLACK_CANDLE, Items.BLACK_DYE); + this.candle(Blocks.BLUE_CANDLE, Items.BLUE_DYE); + this.candle(Blocks.BROWN_CANDLE, Items.BROWN_DYE); + this.candle(Blocks.CYAN_CANDLE, Items.CYAN_DYE); + this.candle(Blocks.GRAY_CANDLE, Items.GRAY_DYE); + this.candle(Blocks.GREEN_CANDLE, Items.GREEN_DYE); + this.candle(Blocks.LIGHT_BLUE_CANDLE, Items.LIGHT_BLUE_DYE); + this.candle(Blocks.LIGHT_GRAY_CANDLE, Items.LIGHT_GRAY_DYE); + this.candle(Blocks.LIME_CANDLE, Items.LIME_DYE); + this.candle(Blocks.MAGENTA_CANDLE, Items.MAGENTA_DYE); + this.candle(Blocks.ORANGE_CANDLE, Items.ORANGE_DYE); + this.candle(Blocks.PINK_CANDLE, Items.PINK_DYE); + this.candle(Blocks.PURPLE_CANDLE, Items.PURPLE_DYE); + this.candle(Blocks.RED_CANDLE, Items.RED_DYE); + this.candle(Blocks.WHITE_CANDLE, Items.WHITE_DYE); + this.candle(Blocks.YELLOW_CANDLE, Items.YELLOW_DYE); + this.shapeless(RecipeCategory.BUILDING_BLOCKS, Blocks.PACKED_MUD, 1) .requires(Blocks.MUD) .requires(Items.WHEAT) - .unlockedBy("has_mud", has(Blocks.MUD)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, Blocks.MUD_BRICKS, 4) + .unlockedBy("has_mud", this.has(Blocks.MUD)) + .save(this.output); + this.shaped(RecipeCategory.BUILDING_BLOCKS, Blocks.MUD_BRICKS, 4) .define('#', Blocks.PACKED_MUD) .pattern("##") .pattern("##") - .unlockedBy("has_packed_mud", has(Blocks.PACKED_MUD)) - .save(recipeOutput); - ShapelessRecipeBuilder.shapeless(RecipeCategory.BUILDING_BLOCKS, Blocks.MUDDY_MANGROVE_ROOTS, 1) + .unlockedBy("has_packed_mud", this.has(Blocks.PACKED_MUD)) + .save(this.output); + this.shapeless(RecipeCategory.BUILDING_BLOCKS, Blocks.MUDDY_MANGROVE_ROOTS, 1) .requires(Blocks.MUD) .requires(Items.MANGROVE_ROOTS) - .unlockedBy("has_mangrove_roots", has(Blocks.MANGROVE_ROOTS)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.TRANSPORTATION, Blocks.ACTIVATOR_RAIL, 6) + .unlockedBy("has_mangrove_roots", this.has(Blocks.MANGROVE_ROOTS)) + .save(this.output); + this.shaped(RecipeCategory.TRANSPORTATION, Blocks.ACTIVATOR_RAIL, 6) .define('#', Blocks.REDSTONE_TORCH) .define('S', Items.STICK) .define('X', Items.IRON_INGOT) .pattern("XSX") .pattern("X#X") .pattern("XSX") - .unlockedBy("has_rail", has(Blocks.RAIL)) - .save(recipeOutput); - ShapelessRecipeBuilder.shapeless(RecipeCategory.BUILDING_BLOCKS, Blocks.ANDESITE, 2) + .unlockedBy("has_rail", this.has(Blocks.RAIL)) + .save(this.output); + this.shapeless(RecipeCategory.BUILDING_BLOCKS, Blocks.ANDESITE, 2) .requires(Blocks.DIORITE) .requires(Blocks.COBBLESTONE) - .unlockedBy("has_stone", has(Blocks.DIORITE)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.DECORATIONS, Blocks.ANVIL) + .unlockedBy("has_stone", this.has(Blocks.DIORITE)) + .save(this.output); + this.shaped(RecipeCategory.DECORATIONS, Blocks.ANVIL) .define('I', Blocks.IRON_BLOCK) .define('i', Items.IRON_INGOT) .pattern("III") .pattern(" i ") .pattern("iii") - .unlockedBy("has_iron_block", has(Blocks.IRON_BLOCK)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.DECORATIONS, Items.ARMOR_STAND) + .unlockedBy("has_iron_block", this.has(Blocks.IRON_BLOCK)) + .save(this.output); + this.shaped(RecipeCategory.DECORATIONS, Items.ARMOR_STAND) .define('/', Items.STICK) .define('_', Blocks.SMOOTH_STONE_SLAB) .pattern("///") .pattern(" / ") .pattern("/_/") - .unlockedBy("has_stone_slab", has(Blocks.SMOOTH_STONE_SLAB)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.COMBAT, Items.ARROW, 4) + .unlockedBy("has_stone_slab", this.has(Blocks.SMOOTH_STONE_SLAB)) + .save(this.output); + this.shaped(RecipeCategory.COMBAT, Items.ARROW, 4) .define('#', Items.STICK) .define('X', Items.FLINT) .define('Y', Items.FEATHER) .pattern("X") .pattern("#") .pattern("Y") - .unlockedBy("has_feather", has(Items.FEATHER)) - .unlockedBy("has_flint", has(Items.FLINT)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.DECORATIONS, Blocks.BARREL, 1) + .unlockedBy("has_feather", this.has(Items.FEATHER)) + .unlockedBy("has_flint", this.has(Items.FLINT)) + .save(this.output); + this.shaped(RecipeCategory.DECORATIONS, Blocks.BARREL, 1) .define('P', ItemTags.PLANKS) .define('S', ItemTags.WOODEN_SLABS) .pattern("PSP") .pattern("P P") .pattern("PSP") - .unlockedBy("has_planks", has(ItemTags.PLANKS)) - .unlockedBy("has_wood_slab", has(ItemTags.WOODEN_SLABS)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.MISC, Blocks.BEACON) + .unlockedBy("has_planks", this.has(ItemTags.PLANKS)) + .unlockedBy("has_wood_slab", this.has(ItemTags.WOODEN_SLABS)) + .save(this.output); + this.shaped(RecipeCategory.MISC, Blocks.BEACON) .define('S', Items.NETHER_STAR) .define('G', Blocks.GLASS) .define('O', Blocks.OBSIDIAN) .pattern("GGG") .pattern("GSG") .pattern("OOO") - .unlockedBy("has_nether_star", has(Items.NETHER_STAR)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.DECORATIONS, Blocks.BEEHIVE) + .unlockedBy("has_nether_star", this.has(Items.NETHER_STAR)) + .save(this.output); + this.shaped(RecipeCategory.DECORATIONS, Blocks.BEEHIVE) .define('P', ItemTags.PLANKS) .define('H', Items.HONEYCOMB) .pattern("PPP") .pattern("HHH") .pattern("PPP") - .unlockedBy("has_honeycomb", has(Items.HONEYCOMB)) - .save(recipeOutput); - ShapelessRecipeBuilder.shapeless(RecipeCategory.FOOD, Items.BEETROOT_SOUP) + .unlockedBy("has_honeycomb", this.has(Items.HONEYCOMB)) + .save(this.output); + this.shapeless(RecipeCategory.FOOD, Items.BEETROOT_SOUP) .requires(Items.BOWL) .requires(Items.BEETROOT, 6) - .unlockedBy("has_beetroot", has(Items.BEETROOT)) - .save(recipeOutput); - ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, Items.BLACK_DYE) + .unlockedBy("has_beetroot", this.has(Items.BEETROOT)) + .save(this.output); + this.shapeless(RecipeCategory.MISC, Items.BLACK_DYE) .requires(Items.INK_SAC) .group("black_dye") - .unlockedBy("has_ink_sac", has(Items.INK_SAC)) - .save(recipeOutput); - oneToOneConversionRecipe(recipeOutput, Items.BLACK_DYE, Blocks.WITHER_ROSE, "black_dye"); - ShapelessRecipeBuilder.shapeless(RecipeCategory.BREWING, Items.BLAZE_POWDER, 2) + .unlockedBy("has_ink_sac", this.has(Items.INK_SAC)) + .save(this.output); + this.oneToOneConversionRecipe(Items.BLACK_DYE, Blocks.WITHER_ROSE, "black_dye"); + this.shapeless(RecipeCategory.BREWING, Items.BLAZE_POWDER, 2) .requires(Items.BLAZE_ROD) - .unlockedBy("has_blaze_rod", has(Items.BLAZE_ROD)) - .save(recipeOutput); - ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, Items.BLUE_DYE) + .unlockedBy("has_blaze_rod", this.has(Items.BLAZE_ROD)) + .save(this.output); + this.shapeless(RecipeCategory.MISC, Items.BLUE_DYE) .requires(Items.LAPIS_LAZULI) .group("blue_dye") - .unlockedBy("has_lapis_lazuli", has(Items.LAPIS_LAZULI)) - .save(recipeOutput); - oneToOneConversionRecipe(recipeOutput, Items.BLUE_DYE, Blocks.CORNFLOWER, "blue_dye"); - threeByThreePacker(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.BLUE_ICE, Blocks.PACKED_ICE); - ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, Items.BONE_MEAL, 3) - .requires(Items.BONE) - .group("bonemeal") - .unlockedBy("has_bone", has(Items.BONE)) - .save(recipeOutput); - nineBlockStorageRecipesRecipesWithCustomUnpacking( - recipeOutput, RecipeCategory.MISC, Items.BONE_MEAL, RecipeCategory.BUILDING_BLOCKS, Items.BONE_BLOCK, "bone_meal_from_bone_block", "bonemeal" + .unlockedBy("has_lapis_lazuli", this.has(Items.LAPIS_LAZULI)) + .save(this.output); + this.oneToOneConversionRecipe(Items.BLUE_DYE, Blocks.CORNFLOWER, "blue_dye"); + this.threeByThreePacker(RecipeCategory.BUILDING_BLOCKS, Blocks.BLUE_ICE, Blocks.PACKED_ICE); + this.shapeless(RecipeCategory.MISC, Items.BONE_MEAL, 3).requires(Items.BONE).group("bonemeal").unlockedBy("has_bone", this.has(Items.BONE)).save(this.output); + this.nineBlockStorageRecipesRecipesWithCustomUnpacking( + RecipeCategory.MISC, Items.BONE_MEAL, RecipeCategory.BUILDING_BLOCKS, Items.BONE_BLOCK, "bone_meal_from_bone_block", "bonemeal" ); - ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, Items.BOOK) + this.shapeless(RecipeCategory.MISC, Items.BOOK) .requires(Items.PAPER, 3) .requires(Items.LEATHER) - .unlockedBy("has_paper", has(Items.PAPER)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, Blocks.BOOKSHELF) + .unlockedBy("has_paper", this.has(Items.PAPER)) + .save(this.output); + this.shaped(RecipeCategory.BUILDING_BLOCKS, Blocks.BOOKSHELF) .define('#', ItemTags.PLANKS) .define('X', Items.BOOK) .pattern("###") .pattern("XXX") .pattern("###") - .unlockedBy("has_book", has(Items.BOOK)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.COMBAT, Items.BOW) + .unlockedBy("has_book", this.has(Items.BOOK)) + .save(this.output); + this.shaped(RecipeCategory.COMBAT, Items.BOW) .define('#', Items.STICK) .define('X', Items.STRING) .pattern(" #X") .pattern("# X") .pattern(" #X") - .unlockedBy("has_string", has(Items.STRING)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.MISC, Items.BOWL, 4) + .unlockedBy("has_string", this.has(Items.STRING)) + .save(this.output); + this.shaped(RecipeCategory.MISC, Items.BOWL, 4) .define('#', ItemTags.PLANKS) .pattern("# #") .pattern(" # ") - .unlockedBy("has_brown_mushroom", has(Blocks.BROWN_MUSHROOM)) - .unlockedBy("has_red_mushroom", has(Blocks.RED_MUSHROOM)) - .unlockedBy("has_mushroom_stew", has(Items.MUSHROOM_STEW)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.FOOD, Items.BREAD) - .define('#', Items.WHEAT) - .pattern("###") - .unlockedBy("has_wheat", has(Items.WHEAT)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.BREWING, Blocks.BREWING_STAND) + .unlockedBy("has_brown_mushroom", this.has(Blocks.BROWN_MUSHROOM)) + .unlockedBy("has_red_mushroom", this.has(Blocks.RED_MUSHROOM)) + .unlockedBy("has_mushroom_stew", this.has(Items.MUSHROOM_STEW)) + .save(this.output); + this.shaped(RecipeCategory.FOOD, Items.BREAD).define('#', Items.WHEAT).pattern("###").unlockedBy("has_wheat", this.has(Items.WHEAT)).save(this.output); + this.shaped(RecipeCategory.BREWING, Blocks.BREWING_STAND) .define('B', Items.BLAZE_ROD) .define('#', ItemTags.STONE_CRAFTING_MATERIALS) .pattern(" B ") .pattern("###") - .unlockedBy("has_blaze_rod", has(Items.BLAZE_ROD)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, Blocks.BRICKS) + .unlockedBy("has_blaze_rod", this.has(Items.BLAZE_ROD)) + .save(this.output); + this.shaped(RecipeCategory.BUILDING_BLOCKS, Blocks.BRICKS) .define('#', Items.BRICK) .pattern("##") .pattern("##") - .unlockedBy("has_brick", has(Items.BRICK)) - .save(recipeOutput); - ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, Items.BROWN_DYE) + .unlockedBy("has_brick", this.has(Items.BRICK)) + .save(this.output); + this.shapeless(RecipeCategory.MISC, Items.BROWN_DYE) .requires(Items.COCOA_BEANS) .group("brown_dye") - .unlockedBy("has_cocoa_beans", has(Items.COCOA_BEANS)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.MISC, Items.BUCKET) + .unlockedBy("has_cocoa_beans", this.has(Items.COCOA_BEANS)) + .save(this.output); + this.shaped(RecipeCategory.MISC, Items.BUCKET) .define('#', Items.IRON_INGOT) .pattern("# #") .pattern(" # ") - .unlockedBy("has_iron_ingot", has(Items.IRON_INGOT)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.FOOD, Blocks.CAKE) + .unlockedBy("has_iron_ingot", this.has(Items.IRON_INGOT)) + .save(this.output); + this.shaped(RecipeCategory.FOOD, Blocks.CAKE) .define('A', Items.MILK_BUCKET) .define('B', Items.SUGAR) .define('C', Items.WHEAT) @@ -523,131 +505,124 @@ public class VanillaRecipeProvider extends RecipeProvider { .pattern("AAA") .pattern("BEB") .pattern("CCC") - .unlockedBy("has_egg", has(Items.EGG)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.DECORATIONS, Blocks.CAMPFIRE) + .unlockedBy("has_egg", this.has(Items.EGG)) + .save(this.output); + this.shaped(RecipeCategory.DECORATIONS, Blocks.CAMPFIRE) .define('L', ItemTags.LOGS) .define('S', Items.STICK) .define('C', ItemTags.COALS) .pattern(" S ") .pattern("SCS") .pattern("LLL") - .unlockedBy("has_stick", has(Items.STICK)) - .unlockedBy("has_coal", has(ItemTags.COALS)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.TRANSPORTATION, Items.CARROT_ON_A_STICK) + .unlockedBy("has_stick", this.has(Items.STICK)) + .unlockedBy("has_coal", this.has(ItemTags.COALS)) + .save(this.output); + this.shaped(RecipeCategory.TRANSPORTATION, Items.CARROT_ON_A_STICK) .define('#', Items.FISHING_ROD) .define('X', Items.CARROT) .pattern("# ") .pattern(" X") - .unlockedBy("has_carrot", has(Items.CARROT)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.TRANSPORTATION, Items.WARPED_FUNGUS_ON_A_STICK) + .unlockedBy("has_carrot", this.has(Items.CARROT)) + .save(this.output); + this.shaped(RecipeCategory.TRANSPORTATION, Items.WARPED_FUNGUS_ON_A_STICK) .define('#', Items.FISHING_ROD) .define('X', Items.WARPED_FUNGUS) .pattern("# ") .pattern(" X") - .unlockedBy("has_warped_fungus", has(Items.WARPED_FUNGUS)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.BREWING, Blocks.CAULDRON) + .unlockedBy("has_warped_fungus", this.has(Items.WARPED_FUNGUS)) + .save(this.output); + this.shaped(RecipeCategory.BREWING, Blocks.CAULDRON) .define('#', Items.IRON_INGOT) .pattern("# #") .pattern("# #") .pattern("###") - .unlockedBy("has_water_bucket", has(Items.WATER_BUCKET)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.DECORATIONS, Blocks.COMPOSTER) + .unlockedBy("has_water_bucket", this.has(Items.WATER_BUCKET)) + .save(this.output); + this.shaped(RecipeCategory.DECORATIONS, Blocks.COMPOSTER) .define('#', ItemTags.WOODEN_SLABS) .pattern("# #") .pattern("# #") .pattern("###") - .unlockedBy("has_wood_slab", has(ItemTags.WOODEN_SLABS)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.DECORATIONS, Blocks.CHEST) + .unlockedBy("has_wood_slab", this.has(ItemTags.WOODEN_SLABS)) + .save(this.output); + this.shaped(RecipeCategory.DECORATIONS, Blocks.CHEST) .define('#', ItemTags.PLANKS) .pattern("###") .pattern("# #") .pattern("###") .unlockedBy( "has_lots_of_items", - CriteriaTriggers.INVENTORY_CHANGED - .createCriterion( - new InventoryChangeTrigger.TriggerInstance( - Optional.empty(), - new InventoryChangeTrigger.TriggerInstance.Slots(MinMaxBounds.Ints.atLeast(10), MinMaxBounds.Ints.ANY, MinMaxBounds.Ints.ANY), - List.of() - ) - ) + CriteriaTriggers.INVENTORY_CHANGED.createCriterion(new TriggerInstance(Optional.empty(), new Slots(Ints.atLeast(10), Ints.ANY, Ints.ANY), List.of())) ) - .save(recipeOutput); - ShapelessRecipeBuilder.shapeless(RecipeCategory.TRANSPORTATION, Items.CHEST_MINECART) + .save(this.output); + this.shapeless(RecipeCategory.TRANSPORTATION, Items.CHEST_MINECART) .requires(Blocks.CHEST) .requires(Items.MINECART) - .unlockedBy("has_minecart", has(Items.MINECART)) - .save(recipeOutput); - chestBoat(recipeOutput, Items.ACACIA_CHEST_BOAT, Items.ACACIA_BOAT); - chestBoat(recipeOutput, Items.BIRCH_CHEST_BOAT, Items.BIRCH_BOAT); - chestBoat(recipeOutput, Items.DARK_OAK_CHEST_BOAT, Items.DARK_OAK_BOAT); - chestBoat(recipeOutput, Items.JUNGLE_CHEST_BOAT, Items.JUNGLE_BOAT); - chestBoat(recipeOutput, Items.OAK_CHEST_BOAT, Items.OAK_BOAT); - chestBoat(recipeOutput, Items.SPRUCE_CHEST_BOAT, Items.SPRUCE_BOAT); - chestBoat(recipeOutput, Items.MANGROVE_CHEST_BOAT, Items.MANGROVE_BOAT); - chiseledBuilder(RecipeCategory.BUILDING_BLOCKS, Blocks.CHISELED_QUARTZ_BLOCK, Ingredient.of(Blocks.QUARTZ_SLAB)) - .unlockedBy("has_chiseled_quartz_block", has(Blocks.CHISELED_QUARTZ_BLOCK)) - .unlockedBy("has_quartz_block", has(Blocks.QUARTZ_BLOCK)) - .unlockedBy("has_quartz_pillar", has(Blocks.QUARTZ_PILLAR)) - .save(recipeOutput); - chiseledBuilder(RecipeCategory.BUILDING_BLOCKS, Blocks.CHISELED_STONE_BRICKS, Ingredient.of(Blocks.STONE_BRICK_SLAB)) - .unlockedBy("has_tag", has(ItemTags.STONE_BRICKS)) - .save(recipeOutput); - twoByTwoPacker(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.CLAY, Items.CLAY_BALL); - ShapedRecipeBuilder.shaped(RecipeCategory.TOOLS, Items.CLOCK) + .unlockedBy("has_minecart", this.has(Items.MINECART)) + .save(this.output); + this.chestBoat(Items.ACACIA_CHEST_BOAT, Items.ACACIA_BOAT); + this.chestBoat(Items.BIRCH_CHEST_BOAT, Items.BIRCH_BOAT); + this.chestBoat(Items.DARK_OAK_CHEST_BOAT, Items.DARK_OAK_BOAT); + this.chestBoat(Items.JUNGLE_CHEST_BOAT, Items.JUNGLE_BOAT); + this.chestBoat(Items.OAK_CHEST_BOAT, Items.OAK_BOAT); + this.chestBoat(Items.SPRUCE_CHEST_BOAT, Items.SPRUCE_BOAT); + this.chestBoat(Items.MANGROVE_CHEST_BOAT, Items.MANGROVE_BOAT); + this.chiseledBuilder(RecipeCategory.BUILDING_BLOCKS, Blocks.CHISELED_QUARTZ_BLOCK, Ingredient.of(Blocks.QUARTZ_SLAB)) + .unlockedBy("has_chiseled_quartz_block", this.has(Blocks.CHISELED_QUARTZ_BLOCK)) + .unlockedBy("has_quartz_block", this.has(Blocks.QUARTZ_BLOCK)) + .unlockedBy("has_quartz_pillar", this.has(Blocks.QUARTZ_PILLAR)) + .save(this.output); + this.chiseledBuilder(RecipeCategory.BUILDING_BLOCKS, Blocks.CHISELED_STONE_BRICKS, Ingredient.of(Blocks.STONE_BRICK_SLAB)) + .unlockedBy("has_tag", this.has(ItemTags.STONE_BRICKS)) + .save(this.output); + this.twoByTwoPacker(RecipeCategory.BUILDING_BLOCKS, Blocks.CLAY, Items.CLAY_BALL); + this.shaped(RecipeCategory.TOOLS, Items.CLOCK) .define('#', Items.GOLD_INGOT) .define('X', Items.REDSTONE) .pattern(" # ") .pattern("#X#") .pattern(" # ") - .unlockedBy("has_redstone", has(Items.REDSTONE)) - .save(recipeOutput); - nineBlockStorageRecipes(recipeOutput, RecipeCategory.MISC, Items.COAL, RecipeCategory.BUILDING_BLOCKS, Items.COAL_BLOCK); - ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, Blocks.COARSE_DIRT, 4) + .unlockedBy("has_redstone", this.has(Items.REDSTONE)) + .save(this.output); + this.nineBlockStorageRecipes(RecipeCategory.MISC, Items.COAL, RecipeCategory.BUILDING_BLOCKS, Items.COAL_BLOCK); + this.shaped(RecipeCategory.BUILDING_BLOCKS, Blocks.COARSE_DIRT, 4) .define('D', Blocks.DIRT) .define('G', Blocks.GRAVEL) .pattern("DG") .pattern("GD") - .unlockedBy("has_gravel", has(Blocks.GRAVEL)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.REDSTONE, Blocks.COMPARATOR) + .unlockedBy("has_gravel", this.has(Blocks.GRAVEL)) + .save(this.output); + this.shaped(RecipeCategory.REDSTONE, Blocks.COMPARATOR) .define('#', Blocks.REDSTONE_TORCH) .define('X', Items.QUARTZ) .define('I', Blocks.STONE) .pattern(" # ") .pattern("#X#") .pattern("III") - .unlockedBy("has_quartz", has(Items.QUARTZ)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.TOOLS, Items.COMPASS) + .unlockedBy("has_quartz", this.has(Items.QUARTZ)) + .save(this.output); + this.shaped(RecipeCategory.TOOLS, Items.COMPASS) .define('#', Items.IRON_INGOT) .define('X', Items.REDSTONE) .pattern(" # ") .pattern("#X#") .pattern(" # ") - .unlockedBy("has_redstone", has(Items.REDSTONE)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.FOOD, Items.COOKIE, 8) + .unlockedBy("has_redstone", this.has(Items.REDSTONE)) + .save(this.output); + this.shaped(RecipeCategory.FOOD, Items.COOKIE, 8) .define('#', Items.WHEAT) .define('X', Items.COCOA_BEANS) .pattern("#X#") - .unlockedBy("has_cocoa", has(Items.COCOA_BEANS)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.DECORATIONS, Blocks.CRAFTING_TABLE) + .unlockedBy("has_cocoa", this.has(Items.COCOA_BEANS)) + .save(this.output); + this.shaped(RecipeCategory.DECORATIONS, Blocks.CRAFTING_TABLE) .define('#', ItemTags.PLANKS) .pattern("##") .pattern("##") .unlockedBy("unlock_right_away", PlayerTrigger.TriggerInstance.tick()) .showNotification(false) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.COMBAT, Items.CROSSBOW) + .save(this.output); + this.shaped(RecipeCategory.COMBAT, Items.CROSSBOW) .define('~', Items.STRING) .define('#', Items.STICK) .define('&', Items.IRON_INGOT) @@ -655,25 +630,24 @@ public class VanillaRecipeProvider extends RecipeProvider { .pattern("#&#") .pattern("~$~") .pattern(" # ") - .unlockedBy("has_string", has(Items.STRING)) - .unlockedBy("has_iron_ingot", has(Items.IRON_INGOT)) - .unlockedBy("has_tripwire_hook", has(Blocks.TRIPWIRE_HOOK)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.DECORATIONS, Blocks.LOOM) + .unlockedBy("has_string", this.has(Items.STRING)) + .unlockedBy("has_iron_ingot", this.has(Items.IRON_INGOT)) + .unlockedBy("has_tripwire_hook", this.has(Blocks.TRIPWIRE_HOOK)) + .save(this.output); + this.shaped(RecipeCategory.DECORATIONS, Blocks.LOOM) .define('#', ItemTags.PLANKS) .define('@', Items.STRING) .pattern("@@") .pattern("##") - .unlockedBy("has_string", has(Items.STRING)) - .save(recipeOutput); - chiseledBuilder(RecipeCategory.BUILDING_BLOCKS, Blocks.CHISELED_RED_SANDSTONE, Ingredient.of(Blocks.RED_SANDSTONE_SLAB)) - .unlockedBy("has_red_sandstone", has(Blocks.RED_SANDSTONE)) - .unlockedBy("has_chiseled_red_sandstone", has(Blocks.CHISELED_RED_SANDSTONE)) - .unlockedBy("has_cut_red_sandstone", has(Blocks.CUT_RED_SANDSTONE)) - .save(recipeOutput); - chiseled(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.CHISELED_SANDSTONE, Blocks.SANDSTONE_SLAB); - nineBlockStorageRecipesRecipesWithCustomUnpacking( - recipeOutput, + .unlockedBy("has_string", this.has(Items.STRING)) + .save(this.output); + this.chiseledBuilder(RecipeCategory.BUILDING_BLOCKS, Blocks.CHISELED_RED_SANDSTONE, Ingredient.of(Blocks.RED_SANDSTONE_SLAB)) + .unlockedBy("has_red_sandstone", this.has(Blocks.RED_SANDSTONE)) + .unlockedBy("has_chiseled_red_sandstone", this.has(Blocks.CHISELED_RED_SANDSTONE)) + .unlockedBy("has_cut_red_sandstone", this.has(Blocks.CUT_RED_SANDSTONE)) + .save(this.output); + this.chiseled(RecipeCategory.BUILDING_BLOCKS, Blocks.CHISELED_SANDSTONE, Blocks.SANDSTONE_SLAB); + this.nineBlockStorageRecipesRecipesWithCustomUnpacking( RecipeCategory.MISC, Items.COPPER_INGOT, RecipeCategory.BUILDING_BLOCKS, @@ -681,743 +655,746 @@ public class VanillaRecipeProvider extends RecipeProvider { getSimpleRecipeName(Items.COPPER_INGOT), getItemName(Items.COPPER_INGOT) ); - ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, Items.COPPER_INGOT, 9) + this.shapeless(RecipeCategory.MISC, Items.COPPER_INGOT, 9) .requires(Blocks.WAXED_COPPER_BLOCK) .group(getItemName(Items.COPPER_INGOT)) - .unlockedBy(getHasName(Blocks.WAXED_COPPER_BLOCK), has(Blocks.WAXED_COPPER_BLOCK)) - .save(recipeOutput, getConversionRecipeName(Items.COPPER_INGOT, Blocks.WAXED_COPPER_BLOCK)); - waxRecipes(recipeOutput, FeatureFlagSet.of(FeatureFlags.VANILLA)); - ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, Items.CYAN_DYE, 2) + .unlockedBy(getHasName(Blocks.WAXED_COPPER_BLOCK), this.has(Blocks.WAXED_COPPER_BLOCK)) + .save(this.output, getConversionRecipeName(Items.COPPER_INGOT, Blocks.WAXED_COPPER_BLOCK)); + this.waxRecipes(FeatureFlagSet.of(FeatureFlags.VANILLA)); + this.shapeless(RecipeCategory.MISC, Items.CYAN_DYE, 2) .requires(Items.BLUE_DYE) .requires(Items.GREEN_DYE) .group("cyan_dye") - .unlockedBy("has_green_dye", has(Items.GREEN_DYE)) - .unlockedBy("has_blue_dye", has(Items.BLUE_DYE)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, Blocks.DARK_PRISMARINE) + .unlockedBy("has_green_dye", this.has(Items.GREEN_DYE)) + .unlockedBy("has_blue_dye", this.has(Items.BLUE_DYE)) + .save(this.output); + this.shaped(RecipeCategory.BUILDING_BLOCKS, Blocks.DARK_PRISMARINE) .define('S', Items.PRISMARINE_SHARD) .define('I', Items.BLACK_DYE) .pattern("SSS") .pattern("SIS") .pattern("SSS") - .unlockedBy("has_prismarine_shard", has(Items.PRISMARINE_SHARD)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.REDSTONE, Blocks.DAYLIGHT_DETECTOR) + .unlockedBy("has_prismarine_shard", this.has(Items.PRISMARINE_SHARD)) + .save(this.output); + this.shaped(RecipeCategory.REDSTONE, Blocks.DAYLIGHT_DETECTOR) .define('Q', Items.QUARTZ) .define('G', Blocks.GLASS) - .define('W', Ingredient.of(ItemTags.WOODEN_SLABS)) + .define('W', ItemTags.WOODEN_SLABS) .pattern("GGG") .pattern("QQQ") .pattern("WWW") - .unlockedBy("has_quartz", has(Items.QUARTZ)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, Blocks.DEEPSLATE_BRICKS, 4) + .unlockedBy("has_quartz", this.has(Items.QUARTZ)) + .save(this.output); + this.shaped(RecipeCategory.BUILDING_BLOCKS, Blocks.DEEPSLATE_BRICKS, 4) .define('S', Blocks.POLISHED_DEEPSLATE) .pattern("SS") .pattern("SS") - .unlockedBy("has_polished_deepslate", has(Blocks.POLISHED_DEEPSLATE)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, Blocks.DEEPSLATE_TILES, 4) + .unlockedBy("has_polished_deepslate", this.has(Blocks.POLISHED_DEEPSLATE)) + .save(this.output); + this.shaped(RecipeCategory.BUILDING_BLOCKS, Blocks.DEEPSLATE_TILES, 4) .define('S', Blocks.DEEPSLATE_BRICKS) .pattern("SS") .pattern("SS") - .unlockedBy("has_deepslate_bricks", has(Blocks.DEEPSLATE_BRICKS)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.TRANSPORTATION, Blocks.DETECTOR_RAIL, 6) + .unlockedBy("has_deepslate_bricks", this.has(Blocks.DEEPSLATE_BRICKS)) + .save(this.output); + this.shaped(RecipeCategory.TRANSPORTATION, Blocks.DETECTOR_RAIL, 6) .define('R', Items.REDSTONE) .define('#', Blocks.STONE_PRESSURE_PLATE) .define('X', Items.IRON_INGOT) .pattern("X X") .pattern("X#X") .pattern("XRX") - .unlockedBy("has_rail", has(Blocks.RAIL)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.TOOLS, Items.DIAMOND_AXE) + .unlockedBy("has_rail", this.has(Blocks.RAIL)) + .save(this.output); + this.shaped(RecipeCategory.TOOLS, Items.DIAMOND_AXE) .define('#', Items.STICK) - .define('X', Items.DIAMOND) + .define('X', ItemTags.DIAMOND_TOOL_MATERIALS) .pattern("XX") .pattern("X#") .pattern(" #") - .unlockedBy("has_diamond", has(Items.DIAMOND)) - .save(recipeOutput); - nineBlockStorageRecipes(recipeOutput, RecipeCategory.MISC, Items.DIAMOND, RecipeCategory.BUILDING_BLOCKS, Items.DIAMOND_BLOCK); - ShapedRecipeBuilder.shaped(RecipeCategory.COMBAT, Items.DIAMOND_BOOTS) + .unlockedBy("has_diamond", this.has(ItemTags.DIAMOND_TOOL_MATERIALS)) + .save(this.output); + this.nineBlockStorageRecipes(RecipeCategory.MISC, Items.DIAMOND, RecipeCategory.BUILDING_BLOCKS, Items.DIAMOND_BLOCK); + this.shaped(RecipeCategory.COMBAT, Items.DIAMOND_BOOTS) .define('X', Items.DIAMOND) .pattern("X X") .pattern("X X") - .unlockedBy("has_diamond", has(Items.DIAMOND)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.COMBAT, Items.DIAMOND_CHESTPLATE) + .unlockedBy("has_diamond", this.has(Items.DIAMOND)) + .save(this.output); + this.shaped(RecipeCategory.COMBAT, Items.DIAMOND_CHESTPLATE) .define('X', Items.DIAMOND) .pattern("X X") .pattern("XXX") .pattern("XXX") - .unlockedBy("has_diamond", has(Items.DIAMOND)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.COMBAT, Items.DIAMOND_HELMET) + .unlockedBy("has_diamond", this.has(Items.DIAMOND)) + .save(this.output); + this.shaped(RecipeCategory.COMBAT, Items.DIAMOND_HELMET) .define('X', Items.DIAMOND) .pattern("XXX") .pattern("X X") - .unlockedBy("has_diamond", has(Items.DIAMOND)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.TOOLS, Items.DIAMOND_HOE) + .unlockedBy("has_diamond", this.has(Items.DIAMOND)) + .save(this.output); + this.shaped(RecipeCategory.TOOLS, Items.DIAMOND_HOE) .define('#', Items.STICK) - .define('X', Items.DIAMOND) + .define('X', ItemTags.DIAMOND_TOOL_MATERIALS) .pattern("XX") .pattern(" #") .pattern(" #") - .unlockedBy("has_diamond", has(Items.DIAMOND)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.COMBAT, Items.DIAMOND_LEGGINGS) + .unlockedBy("has_diamond", this.has(ItemTags.DIAMOND_TOOL_MATERIALS)) + .save(this.output); + this.shaped(RecipeCategory.COMBAT, Items.DIAMOND_LEGGINGS) .define('X', Items.DIAMOND) .pattern("XXX") .pattern("X X") .pattern("X X") - .unlockedBy("has_diamond", has(Items.DIAMOND)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.TOOLS, Items.DIAMOND_PICKAXE) + .unlockedBy("has_diamond", this.has(Items.DIAMOND)) + .save(this.output); + this.shaped(RecipeCategory.TOOLS, Items.DIAMOND_PICKAXE) .define('#', Items.STICK) - .define('X', Items.DIAMOND) + .define('X', ItemTags.DIAMOND_TOOL_MATERIALS) .pattern("XXX") .pattern(" # ") .pattern(" # ") - .unlockedBy("has_diamond", has(Items.DIAMOND)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.TOOLS, Items.DIAMOND_SHOVEL) + .unlockedBy("has_diamond", this.has(ItemTags.DIAMOND_TOOL_MATERIALS)) + .save(this.output); + this.shaped(RecipeCategory.TOOLS, Items.DIAMOND_SHOVEL) .define('#', Items.STICK) - .define('X', Items.DIAMOND) + .define('X', ItemTags.DIAMOND_TOOL_MATERIALS) .pattern("X") .pattern("#") .pattern("#") - .unlockedBy("has_diamond", has(Items.DIAMOND)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.COMBAT, Items.DIAMOND_SWORD) + .unlockedBy("has_diamond", this.has(ItemTags.DIAMOND_TOOL_MATERIALS)) + .save(this.output); + this.shaped(RecipeCategory.COMBAT, Items.DIAMOND_SWORD) .define('#', Items.STICK) - .define('X', Items.DIAMOND) + .define('X', ItemTags.DIAMOND_TOOL_MATERIALS) .pattern("X") .pattern("X") .pattern("#") - .unlockedBy("has_diamond", has(Items.DIAMOND)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, Blocks.DIORITE, 2) + .unlockedBy("has_diamond", this.has(ItemTags.DIAMOND_TOOL_MATERIALS)) + .save(this.output); + this.shaped(RecipeCategory.BUILDING_BLOCKS, Blocks.DIORITE, 2) .define('Q', Items.QUARTZ) .define('C', Blocks.COBBLESTONE) .pattern("CQ") .pattern("QC") - .unlockedBy("has_quartz", has(Items.QUARTZ)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.REDSTONE, Blocks.DISPENSER) + .unlockedBy("has_quartz", this.has(Items.QUARTZ)) + .save(this.output); + this.shaped(RecipeCategory.REDSTONE, Blocks.DISPENSER) .define('R', Items.REDSTONE) .define('#', Blocks.COBBLESTONE) .define('X', Items.BOW) .pattern("###") .pattern("#X#") .pattern("#R#") - .unlockedBy("has_bow", has(Items.BOW)) - .save(recipeOutput); - twoByTwoPacker(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.DRIPSTONE_BLOCK, Items.POINTED_DRIPSTONE); - ShapedRecipeBuilder.shaped(RecipeCategory.REDSTONE, Blocks.DROPPER) + .unlockedBy("has_bow", this.has(Items.BOW)) + .save(this.output); + this.twoByTwoPacker(RecipeCategory.BUILDING_BLOCKS, Blocks.DRIPSTONE_BLOCK, Items.POINTED_DRIPSTONE); + this.shaped(RecipeCategory.REDSTONE, Blocks.DROPPER) .define('R', Items.REDSTONE) .define('#', Blocks.COBBLESTONE) .pattern("###") .pattern("# #") .pattern("#R#") - .unlockedBy("has_redstone", has(Items.REDSTONE)) - .save(recipeOutput); - nineBlockStorageRecipes(recipeOutput, RecipeCategory.MISC, Items.EMERALD, RecipeCategory.BUILDING_BLOCKS, Items.EMERALD_BLOCK); - ShapedRecipeBuilder.shaped(RecipeCategory.DECORATIONS, Blocks.ENCHANTING_TABLE) + .unlockedBy("has_redstone", this.has(Items.REDSTONE)) + .save(this.output); + this.nineBlockStorageRecipes(RecipeCategory.MISC, Items.EMERALD, RecipeCategory.BUILDING_BLOCKS, Items.EMERALD_BLOCK); + this.shaped(RecipeCategory.DECORATIONS, Blocks.ENCHANTING_TABLE) .define('B', Items.BOOK) .define('#', Blocks.OBSIDIAN) .define('D', Items.DIAMOND) .pattern(" B ") .pattern("D#D") .pattern("###") - .unlockedBy("has_obsidian", has(Blocks.OBSIDIAN)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.DECORATIONS, Blocks.ENDER_CHEST) + .unlockedBy("has_obsidian", this.has(Blocks.OBSIDIAN)) + .save(this.output); + this.shaped(RecipeCategory.DECORATIONS, Blocks.ENDER_CHEST) .define('#', Blocks.OBSIDIAN) .define('E', Items.ENDER_EYE) .pattern("###") .pattern("#E#") .pattern("###") - .unlockedBy("has_ender_eye", has(Items.ENDER_EYE)) - .save(recipeOutput); - ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, Items.ENDER_EYE) + .unlockedBy("has_ender_eye", this.has(Items.ENDER_EYE)) + .save(this.output); + this.shapeless(RecipeCategory.MISC, Items.ENDER_EYE) .requires(Items.ENDER_PEARL) .requires(Items.BLAZE_POWDER) - .unlockedBy("has_blaze_powder", has(Items.BLAZE_POWDER)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, Blocks.END_STONE_BRICKS, 4) + .unlockedBy("has_blaze_powder", this.has(Items.BLAZE_POWDER)) + .save(this.output); + this.shaped(RecipeCategory.BUILDING_BLOCKS, Blocks.END_STONE_BRICKS, 4) .define('#', Blocks.END_STONE) .pattern("##") .pattern("##") - .unlockedBy("has_end_stone", has(Blocks.END_STONE)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.DECORATIONS, Items.END_CRYSTAL) + .unlockedBy("has_end_stone", this.has(Blocks.END_STONE)) + .save(this.output); + this.shaped(RecipeCategory.DECORATIONS, Items.END_CRYSTAL) .define('T', Items.GHAST_TEAR) .define('E', Items.ENDER_EYE) .define('G', Blocks.GLASS) .pattern("GGG") .pattern("GEG") .pattern("GTG") - .unlockedBy("has_ender_eye", has(Items.ENDER_EYE)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.DECORATIONS, Blocks.END_ROD, 4) + .unlockedBy("has_ender_eye", this.has(Items.ENDER_EYE)) + .save(this.output); + this.shaped(RecipeCategory.DECORATIONS, Blocks.END_ROD, 4) .define('#', Items.POPPED_CHORUS_FRUIT) .define('/', Items.BLAZE_ROD) .pattern("/") .pattern("#") - .unlockedBy("has_chorus_fruit_popped", has(Items.POPPED_CHORUS_FRUIT)) - .save(recipeOutput); - ShapelessRecipeBuilder.shapeless(RecipeCategory.BREWING, Items.FERMENTED_SPIDER_EYE) + .unlockedBy("has_chorus_fruit_popped", this.has(Items.POPPED_CHORUS_FRUIT)) + .save(this.output); + this.shapeless(RecipeCategory.BREWING, Items.FERMENTED_SPIDER_EYE) .requires(Items.SPIDER_EYE) .requires(Blocks.BROWN_MUSHROOM) .requires(Items.SUGAR) - .unlockedBy("has_spider_eye", has(Items.SPIDER_EYE)) - .save(recipeOutput); - ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, Items.FIRE_CHARGE, 3) + .unlockedBy("has_spider_eye", this.has(Items.SPIDER_EYE)) + .save(this.output); + this.shapeless(RecipeCategory.MISC, Items.FIRE_CHARGE, 3) .requires(Items.GUNPOWDER) .requires(Items.BLAZE_POWDER) .requires(Ingredient.of(Items.COAL, Items.CHARCOAL)) - .unlockedBy("has_blaze_powder", has(Items.BLAZE_POWDER)) - .save(recipeOutput); - ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, Items.FIREWORK_ROCKET, 3) + .unlockedBy("has_blaze_powder", this.has(Items.BLAZE_POWDER)) + .save(this.output); + this.shapeless(RecipeCategory.MISC, Items.FIREWORK_ROCKET, 3) .requires(Items.GUNPOWDER) .requires(Items.PAPER) - .unlockedBy("has_gunpowder", has(Items.GUNPOWDER)) - .save(recipeOutput, "firework_rocket_simple"); - ShapedRecipeBuilder.shaped(RecipeCategory.TOOLS, Items.FISHING_ROD) + .unlockedBy("has_gunpowder", this.has(Items.GUNPOWDER)) + .save(this.output, "firework_rocket_simple"); + this.shaped(RecipeCategory.TOOLS, Items.FISHING_ROD) .define('#', Items.STICK) .define('X', Items.STRING) .pattern(" #") .pattern(" #X") .pattern("# X") - .unlockedBy("has_string", has(Items.STRING)) - .save(recipeOutput); - ShapelessRecipeBuilder.shapeless(RecipeCategory.TOOLS, Items.FLINT_AND_STEEL) + .unlockedBy("has_string", this.has(Items.STRING)) + .save(this.output); + this.shapeless(RecipeCategory.TOOLS, Items.FLINT_AND_STEEL) .requires(Items.IRON_INGOT) .requires(Items.FLINT) - .unlockedBy("has_flint", has(Items.FLINT)) - .unlockedBy("has_obsidian", has(Blocks.OBSIDIAN)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.DECORATIONS, Blocks.FLOWER_POT) + .unlockedBy("has_flint", this.has(Items.FLINT)) + .unlockedBy("has_obsidian", this.has(Blocks.OBSIDIAN)) + .save(this.output); + this.shaped(RecipeCategory.DECORATIONS, Blocks.FLOWER_POT) .define('#', Items.BRICK) .pattern("# #") .pattern(" # ") - .unlockedBy("has_brick", has(Items.BRICK)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.DECORATIONS, Blocks.FURNACE) + .unlockedBy("has_brick", this.has(Items.BRICK)) + .save(this.output); + this.shaped(RecipeCategory.DECORATIONS, Blocks.FURNACE) .define('#', ItemTags.STONE_CRAFTING_MATERIALS) .pattern("###") .pattern("# #") .pattern("###") - .unlockedBy("has_cobblestone", has(ItemTags.STONE_CRAFTING_MATERIALS)) - .save(recipeOutput); - ShapelessRecipeBuilder.shapeless(RecipeCategory.TRANSPORTATION, Items.FURNACE_MINECART) + .unlockedBy("has_cobblestone", this.has(ItemTags.STONE_CRAFTING_MATERIALS)) + .save(this.output); + this.shapeless(RecipeCategory.TRANSPORTATION, Items.FURNACE_MINECART) .requires(Blocks.FURNACE) .requires(Items.MINECART) - .unlockedBy("has_minecart", has(Items.MINECART)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.BREWING, Items.GLASS_BOTTLE, 3) + .unlockedBy("has_minecart", this.has(Items.MINECART)) + .save(this.output); + this.shaped(RecipeCategory.BREWING, Items.GLASS_BOTTLE, 3) .define('#', Blocks.GLASS) .pattern("# #") .pattern(" # ") - .unlockedBy("has_glass", has(Blocks.GLASS)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.DECORATIONS, Blocks.GLASS_PANE, 16) + .unlockedBy("has_glass", this.has(Blocks.GLASS)) + .save(this.output); + this.shaped(RecipeCategory.DECORATIONS, Blocks.GLASS_PANE, 16) .define('#', Blocks.GLASS) .pattern("###") .pattern("###") - .unlockedBy("has_glass", has(Blocks.GLASS)) - .save(recipeOutput); - twoByTwoPacker(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.GLOWSTONE, Items.GLOWSTONE_DUST); - ShapelessRecipeBuilder.shapeless(RecipeCategory.DECORATIONS, Items.GLOW_ITEM_FRAME) + .unlockedBy("has_glass", this.has(Blocks.GLASS)) + .save(this.output); + this.twoByTwoPacker(RecipeCategory.BUILDING_BLOCKS, Blocks.GLOWSTONE, Items.GLOWSTONE_DUST); + this.shapeless(RecipeCategory.DECORATIONS, Items.GLOW_ITEM_FRAME) .requires(Items.ITEM_FRAME) .requires(Items.GLOW_INK_SAC) - .unlockedBy("has_item_frame", has(Items.ITEM_FRAME)) - .unlockedBy("has_glow_ink_sac", has(Items.GLOW_INK_SAC)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.FOOD, Items.GOLDEN_APPLE) + .unlockedBy("has_item_frame", this.has(Items.ITEM_FRAME)) + .unlockedBy("has_glow_ink_sac", this.has(Items.GLOW_INK_SAC)) + .save(this.output); + this.shaped(RecipeCategory.FOOD, Items.GOLDEN_APPLE) .define('#', Items.GOLD_INGOT) .define('X', Items.APPLE) .pattern("###") .pattern("#X#") .pattern("###") - .unlockedBy("has_gold_ingot", has(Items.GOLD_INGOT)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.TOOLS, Items.GOLDEN_AXE) + .unlockedBy("has_gold_ingot", this.has(Items.GOLD_INGOT)) + .save(this.output); + this.shaped(RecipeCategory.TOOLS, Items.GOLDEN_AXE) .define('#', Items.STICK) - .define('X', Items.GOLD_INGOT) + .define('X', ItemTags.GOLD_TOOL_MATERIALS) .pattern("XX") .pattern("X#") .pattern(" #") - .unlockedBy("has_gold_ingot", has(Items.GOLD_INGOT)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.COMBAT, Items.GOLDEN_BOOTS) + .unlockedBy("has_gold_ingot", this.has(ItemTags.GOLD_TOOL_MATERIALS)) + .save(this.output); + this.shaped(RecipeCategory.COMBAT, Items.GOLDEN_BOOTS) .define('X', Items.GOLD_INGOT) .pattern("X X") .pattern("X X") - .unlockedBy("has_gold_ingot", has(Items.GOLD_INGOT)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.BREWING, Items.GOLDEN_CARROT) + .unlockedBy("has_gold_ingot", this.has(Items.GOLD_INGOT)) + .save(this.output); + this.shaped(RecipeCategory.BREWING, Items.GOLDEN_CARROT) .define('#', Items.GOLD_NUGGET) .define('X', Items.CARROT) .pattern("###") .pattern("#X#") .pattern("###") - .unlockedBy("has_gold_nugget", has(Items.GOLD_NUGGET)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.COMBAT, Items.GOLDEN_CHESTPLATE) + .unlockedBy("has_gold_nugget", this.has(Items.GOLD_NUGGET)) + .save(this.output); + this.shaped(RecipeCategory.COMBAT, Items.GOLDEN_CHESTPLATE) .define('X', Items.GOLD_INGOT) .pattern("X X") .pattern("XXX") .pattern("XXX") - .unlockedBy("has_gold_ingot", has(Items.GOLD_INGOT)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.COMBAT, Items.GOLDEN_HELMET) + .unlockedBy("has_gold_ingot", this.has(Items.GOLD_INGOT)) + .save(this.output); + this.shaped(RecipeCategory.COMBAT, Items.GOLDEN_HELMET) .define('X', Items.GOLD_INGOT) .pattern("XXX") .pattern("X X") - .unlockedBy("has_gold_ingot", has(Items.GOLD_INGOT)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.TOOLS, Items.GOLDEN_HOE) + .unlockedBy("has_gold_ingot", this.has(Items.GOLD_INGOT)) + .save(this.output); + this.shaped(RecipeCategory.TOOLS, Items.GOLDEN_HOE) .define('#', Items.STICK) - .define('X', Items.GOLD_INGOT) + .define('X', ItemTags.GOLD_TOOL_MATERIALS) .pattern("XX") .pattern(" #") .pattern(" #") - .unlockedBy("has_gold_ingot", has(Items.GOLD_INGOT)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.COMBAT, Items.GOLDEN_LEGGINGS) + .unlockedBy("has_gold_ingot", this.has(ItemTags.GOLD_TOOL_MATERIALS)) + .save(this.output); + this.shaped(RecipeCategory.COMBAT, Items.GOLDEN_LEGGINGS) .define('X', Items.GOLD_INGOT) .pattern("XXX") .pattern("X X") .pattern("X X") - .unlockedBy("has_gold_ingot", has(Items.GOLD_INGOT)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.TOOLS, Items.GOLDEN_PICKAXE) + .unlockedBy("has_gold_ingot", this.has(Items.GOLD_INGOT)) + .save(this.output); + this.shaped(RecipeCategory.TOOLS, Items.GOLDEN_PICKAXE) .define('#', Items.STICK) - .define('X', Items.GOLD_INGOT) + .define('X', ItemTags.GOLD_TOOL_MATERIALS) .pattern("XXX") .pattern(" # ") .pattern(" # ") - .unlockedBy("has_gold_ingot", has(Items.GOLD_INGOT)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.TRANSPORTATION, Blocks.POWERED_RAIL, 6) + .unlockedBy("has_gold_ingot", this.has(ItemTags.GOLD_TOOL_MATERIALS)) + .save(this.output); + this.shaped(RecipeCategory.TRANSPORTATION, Blocks.POWERED_RAIL, 6) .define('R', Items.REDSTONE) .define('#', Items.STICK) .define('X', Items.GOLD_INGOT) .pattern("X X") .pattern("X#X") .pattern("XRX") - .unlockedBy("has_rail", has(Blocks.RAIL)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.TOOLS, Items.GOLDEN_SHOVEL) + .unlockedBy("has_rail", this.has(Blocks.RAIL)) + .save(this.output); + this.shaped(RecipeCategory.TOOLS, Items.GOLDEN_SHOVEL) .define('#', Items.STICK) - .define('X', Items.GOLD_INGOT) + .define('X', ItemTags.GOLD_TOOL_MATERIALS) .pattern("X") .pattern("#") .pattern("#") - .unlockedBy("has_gold_ingot", has(Items.GOLD_INGOT)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.COMBAT, Items.GOLDEN_SWORD) + .unlockedBy("has_gold_ingot", this.has(ItemTags.GOLD_TOOL_MATERIALS)) + .save(this.output); + this.shaped(RecipeCategory.COMBAT, Items.GOLDEN_SWORD) .define('#', Items.STICK) - .define('X', Items.GOLD_INGOT) + .define('X', ItemTags.GOLD_TOOL_MATERIALS) .pattern("X") .pattern("X") .pattern("#") - .unlockedBy("has_gold_ingot", has(Items.GOLD_INGOT)) - .save(recipeOutput); - nineBlockStorageRecipesRecipesWithCustomUnpacking( - recipeOutput, RecipeCategory.MISC, Items.GOLD_INGOT, RecipeCategory.BUILDING_BLOCKS, Items.GOLD_BLOCK, "gold_ingot_from_gold_block", "gold_ingot" + .unlockedBy("has_gold_ingot", this.has(ItemTags.GOLD_TOOL_MATERIALS)) + .save(this.output); + this.nineBlockStorageRecipesRecipesWithCustomUnpacking( + RecipeCategory.MISC, Items.GOLD_INGOT, RecipeCategory.BUILDING_BLOCKS, Items.GOLD_BLOCK, "gold_ingot_from_gold_block", "gold_ingot" ); - nineBlockStorageRecipesWithCustomPacking( - recipeOutput, RecipeCategory.MISC, Items.GOLD_NUGGET, RecipeCategory.MISC, Items.GOLD_INGOT, "gold_ingot_from_nuggets", "gold_ingot" + this.nineBlockStorageRecipesWithCustomPacking( + RecipeCategory.MISC, Items.GOLD_NUGGET, RecipeCategory.MISC, Items.GOLD_INGOT, "gold_ingot_from_nuggets", "gold_ingot" ); - ShapelessRecipeBuilder.shapeless(RecipeCategory.BUILDING_BLOCKS, Blocks.GRANITE) + this.shapeless(RecipeCategory.BUILDING_BLOCKS, Blocks.GRANITE) .requires(Blocks.DIORITE) .requires(Items.QUARTZ) - .unlockedBy("has_quartz", has(Items.QUARTZ)) - .save(recipeOutput); - ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, Items.GRAY_DYE, 2) + .unlockedBy("has_quartz", this.has(Items.QUARTZ)) + .save(this.output); + this.shapeless(RecipeCategory.MISC, Items.GRAY_DYE, 2) .requires(Items.BLACK_DYE) .requires(Items.WHITE_DYE) - .unlockedBy("has_white_dye", has(Items.WHITE_DYE)) - .unlockedBy("has_black_dye", has(Items.BLACK_DYE)) - .save(recipeOutput); - threeByThreePacker(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.HAY_BLOCK, Items.WHEAT); - pressurePlate(recipeOutput, Blocks.HEAVY_WEIGHTED_PRESSURE_PLATE, Items.IRON_INGOT); - ShapelessRecipeBuilder.shapeless(RecipeCategory.FOOD, Items.HONEY_BOTTLE, 4) + .unlockedBy("has_white_dye", this.has(Items.WHITE_DYE)) + .unlockedBy("has_black_dye", this.has(Items.BLACK_DYE)) + .save(this.output); + this.threeByThreePacker(RecipeCategory.BUILDING_BLOCKS, Blocks.HAY_BLOCK, Items.WHEAT); + this.pressurePlate(Blocks.HEAVY_WEIGHTED_PRESSURE_PLATE, Items.IRON_INGOT); + this.shapeless(RecipeCategory.FOOD, Items.HONEY_BOTTLE, 4) .requires(Items.HONEY_BLOCK) .requires(Items.GLASS_BOTTLE, 4) - .unlockedBy("has_honey_block", has(Blocks.HONEY_BLOCK)) - .save(recipeOutput); - twoByTwoPacker(recipeOutput, RecipeCategory.REDSTONE, Blocks.HONEY_BLOCK, Items.HONEY_BOTTLE); - twoByTwoPacker(recipeOutput, RecipeCategory.DECORATIONS, Blocks.HONEYCOMB_BLOCK, Items.HONEYCOMB); - ShapedRecipeBuilder.shaped(RecipeCategory.REDSTONE, Blocks.HOPPER) + .unlockedBy("has_honey_block", this.has(Blocks.HONEY_BLOCK)) + .save(this.output); + this.twoByTwoPacker(RecipeCategory.REDSTONE, Blocks.HONEY_BLOCK, Items.HONEY_BOTTLE); + this.twoByTwoPacker(RecipeCategory.DECORATIONS, Blocks.HONEYCOMB_BLOCK, Items.HONEYCOMB); + this.shaped(RecipeCategory.REDSTONE, Blocks.HOPPER) .define('C', Blocks.CHEST) .define('I', Items.IRON_INGOT) .pattern("I I") .pattern("ICI") .pattern(" I ") - .unlockedBy("has_iron_ingot", has(Items.IRON_INGOT)) - .save(recipeOutput); - ShapelessRecipeBuilder.shapeless(RecipeCategory.TRANSPORTATION, Items.HOPPER_MINECART) + .unlockedBy("has_iron_ingot", this.has(Items.IRON_INGOT)) + .save(this.output); + this.shapeless(RecipeCategory.TRANSPORTATION, Items.HOPPER_MINECART) .requires(Blocks.HOPPER) .requires(Items.MINECART) - .unlockedBy("has_minecart", has(Items.MINECART)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.TOOLS, Items.IRON_AXE) + .unlockedBy("has_minecart", this.has(Items.MINECART)) + .save(this.output); + this.shaped(RecipeCategory.TOOLS, Items.IRON_AXE) .define('#', Items.STICK) - .define('X', Items.IRON_INGOT) + .define('X', ItemTags.IRON_TOOL_MATERIALS) .pattern("XX") .pattern("X#") .pattern(" #") - .unlockedBy("has_iron_ingot", has(Items.IRON_INGOT)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.DECORATIONS, Blocks.IRON_BARS, 16) + .unlockedBy("has_iron_ingot", this.has(ItemTags.IRON_TOOL_MATERIALS)) + .save(this.output); + this.shaped(RecipeCategory.DECORATIONS, Blocks.IRON_BARS, 16) .define('#', Items.IRON_INGOT) .pattern("###") .pattern("###") - .unlockedBy("has_iron_ingot", has(Items.IRON_INGOT)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.COMBAT, Items.IRON_BOOTS) + .unlockedBy("has_iron_ingot", this.has(Items.IRON_INGOT)) + .save(this.output); + this.shaped(RecipeCategory.COMBAT, Items.IRON_BOOTS) .define('X', Items.IRON_INGOT) .pattern("X X") .pattern("X X") - .unlockedBy("has_iron_ingot", has(Items.IRON_INGOT)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.COMBAT, Items.IRON_CHESTPLATE) + .unlockedBy("has_iron_ingot", this.has(Items.IRON_INGOT)) + .save(this.output); + this.shaped(RecipeCategory.COMBAT, Items.IRON_CHESTPLATE) .define('X', Items.IRON_INGOT) .pattern("X X") .pattern("XXX") .pattern("XXX") - .unlockedBy("has_iron_ingot", has(Items.IRON_INGOT)) - .save(recipeOutput); - doorBuilder(Blocks.IRON_DOOR, Ingredient.of(Items.IRON_INGOT)).unlockedBy(getHasName(Items.IRON_INGOT), has(Items.IRON_INGOT)).save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.COMBAT, Items.IRON_HELMET) + .unlockedBy("has_iron_ingot", this.has(Items.IRON_INGOT)) + .save(this.output); + this.doorBuilder(Blocks.IRON_DOOR, Ingredient.of(Items.IRON_INGOT)).unlockedBy(getHasName(Items.IRON_INGOT), this.has(Items.IRON_INGOT)).save(this.output); + this.shaped(RecipeCategory.COMBAT, Items.IRON_HELMET) .define('X', Items.IRON_INGOT) .pattern("XXX") .pattern("X X") - .unlockedBy("has_iron_ingot", has(Items.IRON_INGOT)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.TOOLS, Items.IRON_HOE) + .unlockedBy("has_iron_ingot", this.has(Items.IRON_INGOT)) + .save(this.output); + this.shaped(RecipeCategory.TOOLS, Items.IRON_HOE) .define('#', Items.STICK) - .define('X', Items.IRON_INGOT) + .define('X', ItemTags.IRON_TOOL_MATERIALS) .pattern("XX") .pattern(" #") .pattern(" #") - .unlockedBy("has_iron_ingot", has(Items.IRON_INGOT)) - .save(recipeOutput); - nineBlockStorageRecipesRecipesWithCustomUnpacking( - recipeOutput, RecipeCategory.MISC, Items.IRON_INGOT, RecipeCategory.BUILDING_BLOCKS, Items.IRON_BLOCK, "iron_ingot_from_iron_block", "iron_ingot" + .unlockedBy("has_iron_ingot", this.has(ItemTags.IRON_TOOL_MATERIALS)) + .save(this.output); + this.nineBlockStorageRecipesRecipesWithCustomUnpacking( + RecipeCategory.MISC, Items.IRON_INGOT, RecipeCategory.BUILDING_BLOCKS, Items.IRON_BLOCK, "iron_ingot_from_iron_block", "iron_ingot" ); - nineBlockStorageRecipesWithCustomPacking( - recipeOutput, RecipeCategory.MISC, Items.IRON_NUGGET, RecipeCategory.MISC, Items.IRON_INGOT, "iron_ingot_from_nuggets", "iron_ingot" + this.nineBlockStorageRecipesWithCustomPacking( + RecipeCategory.MISC, Items.IRON_NUGGET, RecipeCategory.MISC, Items.IRON_INGOT, "iron_ingot_from_nuggets", "iron_ingot" ); - ShapedRecipeBuilder.shaped(RecipeCategory.COMBAT, Items.IRON_LEGGINGS) + this.shaped(RecipeCategory.COMBAT, Items.IRON_LEGGINGS) .define('X', Items.IRON_INGOT) .pattern("XXX") .pattern("X X") .pattern("X X") - .unlockedBy("has_iron_ingot", has(Items.IRON_INGOT)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.TOOLS, Items.IRON_PICKAXE) + .unlockedBy("has_iron_ingot", this.has(Items.IRON_INGOT)) + .save(this.output); + this.shaped(RecipeCategory.TOOLS, Items.IRON_PICKAXE) .define('#', Items.STICK) - .define('X', Items.IRON_INGOT) + .define('X', ItemTags.IRON_TOOL_MATERIALS) .pattern("XXX") .pattern(" # ") .pattern(" # ") - .unlockedBy("has_iron_ingot", has(Items.IRON_INGOT)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.TOOLS, Items.IRON_SHOVEL) + .unlockedBy("has_iron_ingot", this.has(ItemTags.IRON_TOOL_MATERIALS)) + .save(this.output); + this.shaped(RecipeCategory.TOOLS, Items.IRON_SHOVEL) .define('#', Items.STICK) - .define('X', Items.IRON_INGOT) + .define('X', ItemTags.IRON_TOOL_MATERIALS) .pattern("X") .pattern("#") .pattern("#") - .unlockedBy("has_iron_ingot", has(Items.IRON_INGOT)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.COMBAT, Items.IRON_SWORD) + .unlockedBy("has_iron_ingot", this.has(ItemTags.IRON_TOOL_MATERIALS)) + .save(this.output); + this.shaped(RecipeCategory.COMBAT, Items.IRON_SWORD) .define('#', Items.STICK) - .define('X', Items.IRON_INGOT) + .define('X', ItemTags.IRON_TOOL_MATERIALS) .pattern("X") .pattern("X") .pattern("#") - .unlockedBy("has_iron_ingot", has(Items.IRON_INGOT)) - .save(recipeOutput); - twoByTwoPacker(recipeOutput, RecipeCategory.REDSTONE, Blocks.IRON_TRAPDOOR, Items.IRON_INGOT); - ShapedRecipeBuilder.shaped(RecipeCategory.DECORATIONS, Items.ITEM_FRAME) + .unlockedBy("has_iron_ingot", this.has(ItemTags.IRON_TOOL_MATERIALS)) + .save(this.output); + this.twoByTwoPacker(RecipeCategory.REDSTONE, Blocks.IRON_TRAPDOOR, Items.IRON_INGOT); + this.shaped(RecipeCategory.DECORATIONS, Items.ITEM_FRAME) .define('#', Items.STICK) .define('X', Items.LEATHER) .pattern("###") .pattern("#X#") .pattern("###") - .unlockedBy("has_leather", has(Items.LEATHER)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.DECORATIONS, Blocks.JUKEBOX) + .unlockedBy("has_leather", this.has(Items.LEATHER)) + .save(this.output); + this.shaped(RecipeCategory.DECORATIONS, Blocks.JUKEBOX) .define('#', ItemTags.PLANKS) .define('X', Items.DIAMOND) .pattern("###") .pattern("#X#") .pattern("###") - .unlockedBy("has_diamond", has(Items.DIAMOND)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.DECORATIONS, Blocks.LADDER, 3) + .unlockedBy("has_diamond", this.has(Items.DIAMOND)) + .save(this.output); + this.shaped(RecipeCategory.DECORATIONS, Blocks.LADDER, 3) .define('#', Items.STICK) .pattern("# #") .pattern("###") .pattern("# #") - .unlockedBy("has_stick", has(Items.STICK)) - .save(recipeOutput); - nineBlockStorageRecipes(recipeOutput, RecipeCategory.MISC, Items.LAPIS_LAZULI, RecipeCategory.BUILDING_BLOCKS, Items.LAPIS_BLOCK); - ShapedRecipeBuilder.shaped(RecipeCategory.TOOLS, Items.LEAD, 2) + .unlockedBy("has_stick", this.has(Items.STICK)) + .save(this.output); + this.nineBlockStorageRecipes(RecipeCategory.MISC, Items.LAPIS_LAZULI, RecipeCategory.BUILDING_BLOCKS, Items.LAPIS_BLOCK); + this.shaped(RecipeCategory.TOOLS, Items.LEAD, 2) .define('~', Items.STRING) .define('O', Items.SLIME_BALL) .pattern("~~ ") .pattern("~O ") .pattern(" ~") - .unlockedBy("has_slime_ball", has(Items.SLIME_BALL)) - .save(recipeOutput); - twoByTwoPacker(recipeOutput, RecipeCategory.MISC, Items.LEATHER, Items.RABBIT_HIDE); - ShapedRecipeBuilder.shaped(RecipeCategory.COMBAT, Items.LEATHER_BOOTS) + .unlockedBy("has_slime_ball", this.has(Items.SLIME_BALL)) + .save(this.output); + this.twoByTwoPacker(RecipeCategory.MISC, Items.LEATHER, Items.RABBIT_HIDE); + this.shaped(RecipeCategory.COMBAT, Items.LEATHER_BOOTS) .define('X', Items.LEATHER) .pattern("X X") .pattern("X X") - .unlockedBy("has_leather", has(Items.LEATHER)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.COMBAT, Items.LEATHER_CHESTPLATE) + .unlockedBy("has_leather", this.has(Items.LEATHER)) + .save(this.output); + this.shaped(RecipeCategory.COMBAT, Items.LEATHER_CHESTPLATE) .define('X', Items.LEATHER) .pattern("X X") .pattern("XXX") .pattern("XXX") - .unlockedBy("has_leather", has(Items.LEATHER)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.COMBAT, Items.LEATHER_HELMET) + .unlockedBy("has_leather", this.has(Items.LEATHER)) + .save(this.output); + this.shaped(RecipeCategory.COMBAT, Items.LEATHER_HELMET) .define('X', Items.LEATHER) .pattern("XXX") .pattern("X X") - .unlockedBy("has_leather", has(Items.LEATHER)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.COMBAT, Items.LEATHER_LEGGINGS) + .unlockedBy("has_leather", this.has(Items.LEATHER)) + .save(this.output); + this.shaped(RecipeCategory.COMBAT, Items.LEATHER_LEGGINGS) .define('X', Items.LEATHER) .pattern("XXX") .pattern("X X") .pattern("X X") - .unlockedBy("has_leather", has(Items.LEATHER)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.MISC, Items.LEATHER_HORSE_ARMOR) + .unlockedBy("has_leather", this.has(Items.LEATHER)) + .save(this.output); + this.shaped(RecipeCategory.MISC, Items.LEATHER_HORSE_ARMOR) .define('X', Items.LEATHER) .pattern("X X") .pattern("XXX") .pattern("X X") - .unlockedBy("has_leather", has(Items.LEATHER)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.REDSTONE, Blocks.LECTERN) + .unlockedBy("has_leather", this.has(Items.LEATHER)) + .save(this.output); + this.shaped(RecipeCategory.REDSTONE, Blocks.LECTERN) .define('S', ItemTags.WOODEN_SLABS) .define('B', Blocks.BOOKSHELF) .pattern("SSS") .pattern(" B ") .pattern(" S ") - .unlockedBy("has_book", has(Items.BOOK)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.REDSTONE, Blocks.LEVER) + .unlockedBy("has_book", this.has(Items.BOOK)) + .save(this.output); + this.shaped(RecipeCategory.REDSTONE, Blocks.LEVER) .define('#', Blocks.COBBLESTONE) .define('X', Items.STICK) .pattern("X") .pattern("#") - .unlockedBy("has_cobblestone", has(Blocks.COBBLESTONE)) - .save(recipeOutput); - oneToOneConversionRecipe(recipeOutput, Items.LIGHT_BLUE_DYE, Blocks.BLUE_ORCHID, "light_blue_dye"); - ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, Items.LIGHT_BLUE_DYE, 2) + .unlockedBy("has_cobblestone", this.has(Blocks.COBBLESTONE)) + .save(this.output); + this.oneToOneConversionRecipe(Items.LIGHT_BLUE_DYE, Blocks.BLUE_ORCHID, "light_blue_dye"); + this.shapeless(RecipeCategory.MISC, Items.LIGHT_BLUE_DYE, 2) .requires(Items.BLUE_DYE) .requires(Items.WHITE_DYE) .group("light_blue_dye") - .unlockedBy("has_blue_dye", has(Items.BLUE_DYE)) - .unlockedBy("has_white_dye", has(Items.WHITE_DYE)) - .save(recipeOutput, "light_blue_dye_from_blue_white_dye"); - oneToOneConversionRecipe(recipeOutput, Items.LIGHT_GRAY_DYE, Blocks.AZURE_BLUET, "light_gray_dye"); - ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, Items.LIGHT_GRAY_DYE, 2) + .unlockedBy("has_blue_dye", this.has(Items.BLUE_DYE)) + .unlockedBy("has_white_dye", this.has(Items.WHITE_DYE)) + .save(this.output, "light_blue_dye_from_blue_white_dye"); + this.oneToOneConversionRecipe(Items.LIGHT_GRAY_DYE, Blocks.AZURE_BLUET, "light_gray_dye"); + this.shapeless(RecipeCategory.MISC, Items.LIGHT_GRAY_DYE, 2) .requires(Items.GRAY_DYE) .requires(Items.WHITE_DYE) .group("light_gray_dye") - .unlockedBy("has_gray_dye", has(Items.GRAY_DYE)) - .unlockedBy("has_white_dye", has(Items.WHITE_DYE)) - .save(recipeOutput, "light_gray_dye_from_gray_white_dye"); - ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, Items.LIGHT_GRAY_DYE, 3) + .unlockedBy("has_gray_dye", this.has(Items.GRAY_DYE)) + .unlockedBy("has_white_dye", this.has(Items.WHITE_DYE)) + .save(this.output, "light_gray_dye_from_gray_white_dye"); + this.shapeless(RecipeCategory.MISC, Items.LIGHT_GRAY_DYE, 3) .requires(Items.BLACK_DYE) .requires(Items.WHITE_DYE, 2) .group("light_gray_dye") - .unlockedBy("has_white_dye", has(Items.WHITE_DYE)) - .unlockedBy("has_black_dye", has(Items.BLACK_DYE)) - .save(recipeOutput, "light_gray_dye_from_black_white_dye"); - oneToOneConversionRecipe(recipeOutput, Items.LIGHT_GRAY_DYE, Blocks.OXEYE_DAISY, "light_gray_dye"); - oneToOneConversionRecipe(recipeOutput, Items.LIGHT_GRAY_DYE, Blocks.WHITE_TULIP, "light_gray_dye"); - pressurePlate(recipeOutput, Blocks.LIGHT_WEIGHTED_PRESSURE_PLATE, Items.GOLD_INGOT); - ShapedRecipeBuilder.shaped(RecipeCategory.REDSTONE, Blocks.LIGHTNING_ROD) + .unlockedBy("has_white_dye", this.has(Items.WHITE_DYE)) + .unlockedBy("has_black_dye", this.has(Items.BLACK_DYE)) + .save(this.output, "light_gray_dye_from_black_white_dye"); + this.oneToOneConversionRecipe(Items.LIGHT_GRAY_DYE, Blocks.OXEYE_DAISY, "light_gray_dye"); + this.oneToOneConversionRecipe(Items.LIGHT_GRAY_DYE, Blocks.WHITE_TULIP, "light_gray_dye"); + this.pressurePlate(Blocks.LIGHT_WEIGHTED_PRESSURE_PLATE, Items.GOLD_INGOT); + this.shaped(RecipeCategory.REDSTONE, Blocks.LIGHTNING_ROD) .define('#', Items.COPPER_INGOT) .pattern("#") .pattern("#") .pattern("#") - .unlockedBy("has_copper_ingot", has(Items.COPPER_INGOT)) - .save(recipeOutput); - ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, Items.LIME_DYE, 2) + .unlockedBy("has_copper_ingot", this.has(Items.COPPER_INGOT)) + .save(this.output); + this.shapeless(RecipeCategory.MISC, Items.LIME_DYE, 2) .requires(Items.GREEN_DYE) .requires(Items.WHITE_DYE) - .unlockedBy("has_green_dye", has(Items.GREEN_DYE)) - .unlockedBy("has_white_dye", has(Items.WHITE_DYE)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, Blocks.JACK_O_LANTERN) + .unlockedBy("has_green_dye", this.has(Items.GREEN_DYE)) + .unlockedBy("has_white_dye", this.has(Items.WHITE_DYE)) + .save(this.output); + this.shaped(RecipeCategory.BUILDING_BLOCKS, Blocks.JACK_O_LANTERN) .define('A', Blocks.CARVED_PUMPKIN) .define('B', Blocks.TORCH) .pattern("A") .pattern("B") - .unlockedBy("has_carved_pumpkin", has(Blocks.CARVED_PUMPKIN)) - .save(recipeOutput); - oneToOneConversionRecipe(recipeOutput, Items.MAGENTA_DYE, Blocks.ALLIUM, "magenta_dye"); - ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, Items.MAGENTA_DYE, 4) + .unlockedBy("has_carved_pumpkin", this.has(Blocks.CARVED_PUMPKIN)) + .save(this.output); + this.oneToOneConversionRecipe(Items.MAGENTA_DYE, Blocks.ALLIUM, "magenta_dye"); + this.shapeless(RecipeCategory.MISC, Items.MAGENTA_DYE, 4) .requires(Items.BLUE_DYE) .requires(Items.RED_DYE, 2) .requires(Items.WHITE_DYE) .group("magenta_dye") - .unlockedBy("has_blue_dye", has(Items.BLUE_DYE)) - .unlockedBy("has_rose_red", has(Items.RED_DYE)) - .unlockedBy("has_white_dye", has(Items.WHITE_DYE)) - .save(recipeOutput, "magenta_dye_from_blue_red_white_dye"); - ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, Items.MAGENTA_DYE, 3) + .unlockedBy("has_blue_dye", this.has(Items.BLUE_DYE)) + .unlockedBy("has_rose_red", this.has(Items.RED_DYE)) + .unlockedBy("has_white_dye", this.has(Items.WHITE_DYE)) + .save(this.output, "magenta_dye_from_blue_red_white_dye"); + this.shapeless(RecipeCategory.MISC, Items.MAGENTA_DYE, 3) .requires(Items.BLUE_DYE) .requires(Items.RED_DYE) .requires(Items.PINK_DYE) .group("magenta_dye") - .unlockedBy("has_pink_dye", has(Items.PINK_DYE)) - .unlockedBy("has_blue_dye", has(Items.BLUE_DYE)) - .unlockedBy("has_red_dye", has(Items.RED_DYE)) - .save(recipeOutput, "magenta_dye_from_blue_red_pink"); - oneToOneConversionRecipe(recipeOutput, Items.MAGENTA_DYE, Blocks.LILAC, "magenta_dye", 2); - ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, Items.MAGENTA_DYE, 2) + .unlockedBy("has_pink_dye", this.has(Items.PINK_DYE)) + .unlockedBy("has_blue_dye", this.has(Items.BLUE_DYE)) + .unlockedBy("has_red_dye", this.has(Items.RED_DYE)) + .save(this.output, "magenta_dye_from_blue_red_pink"); + this.oneToOneConversionRecipe(Items.MAGENTA_DYE, Blocks.LILAC, "magenta_dye", 2); + this.shapeless(RecipeCategory.MISC, Items.MAGENTA_DYE, 2) .requires(Items.PURPLE_DYE) .requires(Items.PINK_DYE) .group("magenta_dye") - .unlockedBy("has_pink_dye", has(Items.PINK_DYE)) - .unlockedBy("has_purple_dye", has(Items.PURPLE_DYE)) - .save(recipeOutput, "magenta_dye_from_purple_and_pink"); - twoByTwoPacker(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.MAGMA_BLOCK, Items.MAGMA_CREAM); - ShapelessRecipeBuilder.shapeless(RecipeCategory.BREWING, Items.MAGMA_CREAM) + .unlockedBy("has_pink_dye", this.has(Items.PINK_DYE)) + .unlockedBy("has_purple_dye", this.has(Items.PURPLE_DYE)) + .save(this.output, "magenta_dye_from_purple_and_pink"); + this.twoByTwoPacker(RecipeCategory.BUILDING_BLOCKS, Blocks.MAGMA_BLOCK, Items.MAGMA_CREAM); + this.shapeless(RecipeCategory.BREWING, Items.MAGMA_CREAM) .requires(Items.BLAZE_POWDER) .requires(Items.SLIME_BALL) - .unlockedBy("has_blaze_powder", has(Items.BLAZE_POWDER)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.MISC, Items.MAP) + .unlockedBy("has_blaze_powder", this.has(Items.BLAZE_POWDER)) + .save(this.output); + this.shaped(RecipeCategory.MISC, Items.MAP) .define('#', Items.PAPER) .define('X', Items.COMPASS) .pattern("###") .pattern("#X#") .pattern("###") - .unlockedBy("has_compass", has(Items.COMPASS)) - .save(recipeOutput); - threeByThreePacker(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.MELON, Items.MELON_SLICE, "has_melon"); - ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, Items.MELON_SEEDS) - .requires(Items.MELON_SLICE) - .unlockedBy("has_melon", has(Items.MELON_SLICE)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.TRANSPORTATION, Items.MINECART) + .unlockedBy("has_compass", this.has(Items.COMPASS)) + .save(this.output); + this.threeByThreePacker(RecipeCategory.BUILDING_BLOCKS, Blocks.MELON, Items.MELON_SLICE, "has_melon"); + this.shapeless(RecipeCategory.MISC, Items.MELON_SEEDS).requires(Items.MELON_SLICE).unlockedBy("has_melon", this.has(Items.MELON_SLICE)).save(this.output); + this.shaped(RecipeCategory.TRANSPORTATION, Items.MINECART) .define('#', Items.IRON_INGOT) .pattern("# #") .pattern("###") - .unlockedBy("has_iron_ingot", has(Items.IRON_INGOT)) - .save(recipeOutput); - ShapelessRecipeBuilder.shapeless(RecipeCategory.BUILDING_BLOCKS, Blocks.MOSSY_COBBLESTONE) + .unlockedBy("has_iron_ingot", this.has(Items.IRON_INGOT)) + .save(this.output); + this.shapeless(RecipeCategory.BUILDING_BLOCKS, Blocks.MOSSY_COBBLESTONE) .requires(Blocks.COBBLESTONE) .requires(Blocks.VINE) .group("mossy_cobblestone") - .unlockedBy("has_vine", has(Blocks.VINE)) - .save(recipeOutput, getConversionRecipeName(Blocks.MOSSY_COBBLESTONE, Blocks.VINE)); - ShapelessRecipeBuilder.shapeless(RecipeCategory.BUILDING_BLOCKS, Blocks.MOSSY_STONE_BRICKS) + .unlockedBy("has_vine", this.has(Blocks.VINE)) + .save(this.output, getConversionRecipeName(Blocks.MOSSY_COBBLESTONE, Blocks.VINE)); + this.shapeless(RecipeCategory.BUILDING_BLOCKS, Blocks.MOSSY_STONE_BRICKS) .requires(Blocks.STONE_BRICKS) .requires(Blocks.VINE) .group("mossy_stone_bricks") - .unlockedBy("has_vine", has(Blocks.VINE)) - .save(recipeOutput, getConversionRecipeName(Blocks.MOSSY_STONE_BRICKS, Blocks.VINE)); - ShapelessRecipeBuilder.shapeless(RecipeCategory.BUILDING_BLOCKS, Blocks.MOSSY_COBBLESTONE) + .unlockedBy("has_vine", this.has(Blocks.VINE)) + .save(this.output, getConversionRecipeName(Blocks.MOSSY_STONE_BRICKS, Blocks.VINE)); + this.shapeless(RecipeCategory.BUILDING_BLOCKS, Blocks.MOSSY_COBBLESTONE) .requires(Blocks.COBBLESTONE) .requires(Blocks.MOSS_BLOCK) .group("mossy_cobblestone") - .unlockedBy("has_moss_block", has(Blocks.MOSS_BLOCK)) - .save(recipeOutput, getConversionRecipeName(Blocks.MOSSY_COBBLESTONE, Blocks.MOSS_BLOCK)); - ShapelessRecipeBuilder.shapeless(RecipeCategory.BUILDING_BLOCKS, Blocks.MOSSY_STONE_BRICKS) + .unlockedBy("has_moss_block", this.has(Blocks.MOSS_BLOCK)) + .save(this.output, getConversionRecipeName(Blocks.MOSSY_COBBLESTONE, Blocks.MOSS_BLOCK)); + this.shapeless(RecipeCategory.BUILDING_BLOCKS, Blocks.MOSSY_STONE_BRICKS) .requires(Blocks.STONE_BRICKS) .requires(Blocks.MOSS_BLOCK) .group("mossy_stone_bricks") - .unlockedBy("has_moss_block", has(Blocks.MOSS_BLOCK)) - .save(recipeOutput, getConversionRecipeName(Blocks.MOSSY_STONE_BRICKS, Blocks.MOSS_BLOCK)); - ShapelessRecipeBuilder.shapeless(RecipeCategory.FOOD, Items.MUSHROOM_STEW) + .unlockedBy("has_moss_block", this.has(Blocks.MOSS_BLOCK)) + .save(this.output, getConversionRecipeName(Blocks.MOSSY_STONE_BRICKS, Blocks.MOSS_BLOCK)); + this.shapeless(RecipeCategory.FOOD, Items.MUSHROOM_STEW) .requires(Blocks.BROWN_MUSHROOM) .requires(Blocks.RED_MUSHROOM) .requires(Items.BOWL) - .unlockedBy("has_mushroom_stew", has(Items.MUSHROOM_STEW)) - .unlockedBy("has_bowl", has(Items.BOWL)) - .unlockedBy("has_brown_mushroom", has(Blocks.BROWN_MUSHROOM)) - .unlockedBy("has_red_mushroom", has(Blocks.RED_MUSHROOM)) - .save(recipeOutput); - twoByTwoPacker(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.NETHER_BRICKS, Items.NETHER_BRICK); - threeByThreePacker(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.NETHER_WART_BLOCK, Items.NETHER_WART); - ShapedRecipeBuilder.shaped(RecipeCategory.REDSTONE, Blocks.NOTE_BLOCK) + .unlockedBy("has_mushroom_stew", this.has(Items.MUSHROOM_STEW)) + .unlockedBy("has_bowl", this.has(Items.BOWL)) + .unlockedBy("has_brown_mushroom", this.has(Blocks.BROWN_MUSHROOM)) + .unlockedBy("has_red_mushroom", this.has(Blocks.RED_MUSHROOM)) + .save(this.output); + BuiltInRegistries.ITEM.stream().forEach(item -> { + SuspiciousEffectHolder suspiciousEffectHolder = SuspiciousEffectHolder.tryGet(item); + if (suspiciousEffectHolder != null) { + this.suspiciousStew(item, suspiciousEffectHolder); + } + }); + this.twoByTwoPacker(RecipeCategory.BUILDING_BLOCKS, Blocks.NETHER_BRICKS, Items.NETHER_BRICK); + this.threeByThreePacker(RecipeCategory.BUILDING_BLOCKS, Blocks.NETHER_WART_BLOCK, Items.NETHER_WART); + this.shaped(RecipeCategory.REDSTONE, Blocks.NOTE_BLOCK) .define('#', ItemTags.PLANKS) .define('X', Items.REDSTONE) .pattern("###") .pattern("#X#") .pattern("###") - .unlockedBy("has_redstone", has(Items.REDSTONE)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.REDSTONE, Blocks.OBSERVER) + .unlockedBy("has_redstone", this.has(Items.REDSTONE)) + .save(this.output); + this.shaped(RecipeCategory.REDSTONE, Blocks.OBSERVER) .define('Q', Items.QUARTZ) .define('R', Items.REDSTONE) .define('#', Blocks.COBBLESTONE) .pattern("###") .pattern("RRQ") .pattern("###") - .unlockedBy("has_quartz", has(Items.QUARTZ)) - .save(recipeOutput); - oneToOneConversionRecipe(recipeOutput, Items.ORANGE_DYE, Blocks.ORANGE_TULIP, "orange_dye"); - ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, Items.ORANGE_DYE, 2) + .unlockedBy("has_quartz", this.has(Items.QUARTZ)) + .save(this.output); + this.oneToOneConversionRecipe(Items.ORANGE_DYE, Blocks.ORANGE_TULIP, "orange_dye"); + this.shapeless(RecipeCategory.MISC, Items.ORANGE_DYE, 2) .requires(Items.RED_DYE) .requires(Items.YELLOW_DYE) .group("orange_dye") - .unlockedBy("has_red_dye", has(Items.RED_DYE)) - .unlockedBy("has_yellow_dye", has(Items.YELLOW_DYE)) - .save(recipeOutput, "orange_dye_from_red_yellow"); - ShapedRecipeBuilder.shaped(RecipeCategory.DECORATIONS, Items.PAINTING) + .unlockedBy("has_red_dye", this.has(Items.RED_DYE)) + .unlockedBy("has_yellow_dye", this.has(Items.YELLOW_DYE)) + .save(this.output, "orange_dye_from_red_yellow"); + this.shaped(RecipeCategory.DECORATIONS, Items.PAINTING) .define('#', Items.STICK) - .define('X', Ingredient.of(ItemTags.WOOL)) + .define('X', ItemTags.WOOL) .pattern("###") .pattern("#X#") .pattern("###") - .unlockedBy("has_wool", has(ItemTags.WOOL)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.MISC, Items.PAPER, 3) + .unlockedBy("has_wool", this.has(ItemTags.WOOL)) + .save(this.output); + this.shaped(RecipeCategory.MISC, Items.PAPER, 3) .define('#', Blocks.SUGAR_CANE) .pattern("###") - .unlockedBy("has_reeds", has(Blocks.SUGAR_CANE)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, Blocks.QUARTZ_PILLAR, 2) + .unlockedBy("has_reeds", this.has(Blocks.SUGAR_CANE)) + .save(this.output); + this.shaped(RecipeCategory.BUILDING_BLOCKS, Blocks.QUARTZ_PILLAR, 2) .define('#', Blocks.QUARTZ_BLOCK) .pattern("#") .pattern("#") - .unlockedBy("has_chiseled_quartz_block", has(Blocks.CHISELED_QUARTZ_BLOCK)) - .unlockedBy("has_quartz_block", has(Blocks.QUARTZ_BLOCK)) - .unlockedBy("has_quartz_pillar", has(Blocks.QUARTZ_PILLAR)) - .save(recipeOutput); - threeByThreePacker(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.PACKED_ICE, Blocks.ICE); - oneToOneConversionRecipe(recipeOutput, Items.PINK_DYE, Blocks.PEONY, "pink_dye", 2); - oneToOneConversionRecipe(recipeOutput, Items.PINK_DYE, Blocks.PINK_TULIP, "pink_dye"); - ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, Items.PINK_DYE, 2) + .unlockedBy("has_chiseled_quartz_block", this.has(Blocks.CHISELED_QUARTZ_BLOCK)) + .unlockedBy("has_quartz_block", this.has(Blocks.QUARTZ_BLOCK)) + .unlockedBy("has_quartz_pillar", this.has(Blocks.QUARTZ_PILLAR)) + .save(this.output); + this.threeByThreePacker(RecipeCategory.BUILDING_BLOCKS, Blocks.PACKED_ICE, Blocks.ICE); + this.oneToOneConversionRecipe(Items.PINK_DYE, Blocks.PEONY, "pink_dye", 2); + this.oneToOneConversionRecipe(Items.PINK_DYE, Blocks.PINK_TULIP, "pink_dye"); + this.shapeless(RecipeCategory.MISC, Items.PINK_DYE, 2) .requires(Items.RED_DYE) .requires(Items.WHITE_DYE) .group("pink_dye") - .unlockedBy("has_white_dye", has(Items.WHITE_DYE)) - .unlockedBy("has_red_dye", has(Items.RED_DYE)) - .save(recipeOutput, "pink_dye_from_red_white_dye"); - ShapedRecipeBuilder.shaped(RecipeCategory.REDSTONE, Blocks.PISTON) + .unlockedBy("has_white_dye", this.has(Items.WHITE_DYE)) + .unlockedBy("has_red_dye", this.has(Items.RED_DYE)) + .save(this.output, "pink_dye_from_red_white_dye"); + this.shaped(RecipeCategory.REDSTONE, Blocks.PISTON) .define('R', Items.REDSTONE) .define('#', Blocks.COBBLESTONE) .define('T', ItemTags.PLANKS) @@ -1425,680 +1402,679 @@ public class VanillaRecipeProvider extends RecipeProvider { .pattern("TTT") .pattern("#X#") .pattern("#R#") - .unlockedBy("has_redstone", has(Items.REDSTONE)) - .save(recipeOutput); - polished(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.POLISHED_BASALT, Blocks.BASALT); - twoByTwoPacker(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.PRISMARINE, Items.PRISMARINE_SHARD); - threeByThreePacker(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.PRISMARINE_BRICKS, Items.PRISMARINE_SHARD); - ShapelessRecipeBuilder.shapeless(RecipeCategory.FOOD, Items.PUMPKIN_PIE) + .unlockedBy("has_redstone", this.has(Items.REDSTONE)) + .save(this.output); + this.polished(RecipeCategory.BUILDING_BLOCKS, Blocks.POLISHED_BASALT, Blocks.BASALT); + this.twoByTwoPacker(RecipeCategory.BUILDING_BLOCKS, Blocks.PRISMARINE, Items.PRISMARINE_SHARD); + this.threeByThreePacker(RecipeCategory.BUILDING_BLOCKS, Blocks.PRISMARINE_BRICKS, Items.PRISMARINE_SHARD); + this.shapeless(RecipeCategory.FOOD, Items.PUMPKIN_PIE) .requires(Blocks.PUMPKIN) .requires(Items.SUGAR) .requires(Items.EGG) - .unlockedBy("has_carved_pumpkin", has(Blocks.CARVED_PUMPKIN)) - .unlockedBy("has_pumpkin", has(Blocks.PUMPKIN)) - .save(recipeOutput); - ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, Items.PUMPKIN_SEEDS, 4) - .requires(Blocks.PUMPKIN) - .unlockedBy("has_pumpkin", has(Blocks.PUMPKIN)) - .save(recipeOutput); - ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, Items.PURPLE_DYE, 2) + .unlockedBy("has_carved_pumpkin", this.has(Blocks.CARVED_PUMPKIN)) + .unlockedBy("has_pumpkin", this.has(Blocks.PUMPKIN)) + .save(this.output); + this.shapeless(RecipeCategory.MISC, Items.PUMPKIN_SEEDS, 4).requires(Blocks.PUMPKIN).unlockedBy("has_pumpkin", this.has(Blocks.PUMPKIN)).save(this.output); + this.shapeless(RecipeCategory.MISC, Items.PURPLE_DYE, 2) .requires(Items.BLUE_DYE) .requires(Items.RED_DYE) - .unlockedBy("has_blue_dye", has(Items.BLUE_DYE)) - .unlockedBy("has_red_dye", has(Items.RED_DYE)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.DECORATIONS, Blocks.SHULKER_BOX) + .unlockedBy("has_blue_dye", this.has(Items.BLUE_DYE)) + .unlockedBy("has_red_dye", this.has(Items.RED_DYE)) + .save(this.output); + this.shaped(RecipeCategory.DECORATIONS, Blocks.SHULKER_BOX) .define('#', Blocks.CHEST) .define('-', Items.SHULKER_SHELL) .pattern("-") .pattern("#") .pattern("-") - .unlockedBy("has_shulker_shell", has(Items.SHULKER_SHELL)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, Blocks.PURPUR_BLOCK, 4) + .unlockedBy("has_shulker_shell", this.has(Items.SHULKER_SHELL)) + .save(this.output); + this.shulkerBoxRecipes(); + this.shaped(RecipeCategory.BUILDING_BLOCKS, Blocks.PURPUR_BLOCK, 4) .define('F', Items.POPPED_CHORUS_FRUIT) .pattern("FF") .pattern("FF") - .unlockedBy("has_chorus_fruit_popped", has(Items.POPPED_CHORUS_FRUIT)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, Blocks.PURPUR_PILLAR) + .unlockedBy("has_chorus_fruit_popped", this.has(Items.POPPED_CHORUS_FRUIT)) + .save(this.output); + this.shaped(RecipeCategory.BUILDING_BLOCKS, Blocks.PURPUR_PILLAR) .define('#', Blocks.PURPUR_SLAB) .pattern("#") .pattern("#") - .unlockedBy("has_purpur_block", has(Blocks.PURPUR_BLOCK)) - .save(recipeOutput); - slabBuilder(RecipeCategory.BUILDING_BLOCKS, Blocks.PURPUR_SLAB, Ingredient.of(Blocks.PURPUR_BLOCK, Blocks.PURPUR_PILLAR)) - .unlockedBy("has_purpur_block", has(Blocks.PURPUR_BLOCK)) - .save(recipeOutput); - stairBuilder(Blocks.PURPUR_STAIRS, Ingredient.of(Blocks.PURPUR_BLOCK, Blocks.PURPUR_PILLAR)) - .unlockedBy("has_purpur_block", has(Blocks.PURPUR_BLOCK)) - .save(recipeOutput); - twoByTwoPacker(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.QUARTZ_BLOCK, Items.QUARTZ); - ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, Blocks.QUARTZ_BRICKS, 4) + .unlockedBy("has_purpur_block", this.has(Blocks.PURPUR_BLOCK)) + .save(this.output); + this.slabBuilder(RecipeCategory.BUILDING_BLOCKS, Blocks.PURPUR_SLAB, Ingredient.of(Blocks.PURPUR_BLOCK, Blocks.PURPUR_PILLAR)) + .unlockedBy("has_purpur_block", this.has(Blocks.PURPUR_BLOCK)) + .save(this.output); + this.stairBuilder(Blocks.PURPUR_STAIRS, Ingredient.of(Blocks.PURPUR_BLOCK, Blocks.PURPUR_PILLAR)) + .unlockedBy("has_purpur_block", this.has(Blocks.PURPUR_BLOCK)) + .save(this.output); + this.twoByTwoPacker(RecipeCategory.BUILDING_BLOCKS, Blocks.QUARTZ_BLOCK, Items.QUARTZ); + this.shaped(RecipeCategory.BUILDING_BLOCKS, Blocks.QUARTZ_BRICKS, 4) .define('#', Blocks.QUARTZ_BLOCK) .pattern("##") .pattern("##") - .unlockedBy("has_quartz_block", has(Blocks.QUARTZ_BLOCK)) - .save(recipeOutput); - slabBuilder(RecipeCategory.BUILDING_BLOCKS, Blocks.QUARTZ_SLAB, Ingredient.of(Blocks.CHISELED_QUARTZ_BLOCK, Blocks.QUARTZ_BLOCK, Blocks.QUARTZ_PILLAR)) - .unlockedBy("has_chiseled_quartz_block", has(Blocks.CHISELED_QUARTZ_BLOCK)) - .unlockedBy("has_quartz_block", has(Blocks.QUARTZ_BLOCK)) - .unlockedBy("has_quartz_pillar", has(Blocks.QUARTZ_PILLAR)) - .save(recipeOutput); - stairBuilder(Blocks.QUARTZ_STAIRS, Ingredient.of(Blocks.CHISELED_QUARTZ_BLOCK, Blocks.QUARTZ_BLOCK, Blocks.QUARTZ_PILLAR)) - .unlockedBy("has_chiseled_quartz_block", has(Blocks.CHISELED_QUARTZ_BLOCK)) - .unlockedBy("has_quartz_block", has(Blocks.QUARTZ_BLOCK)) - .unlockedBy("has_quartz_pillar", has(Blocks.QUARTZ_PILLAR)) - .save(recipeOutput); - ShapelessRecipeBuilder.shapeless(RecipeCategory.FOOD, Items.RABBIT_STEW) + .unlockedBy("has_quartz_block", this.has(Blocks.QUARTZ_BLOCK)) + .save(this.output); + this.slabBuilder(RecipeCategory.BUILDING_BLOCKS, Blocks.QUARTZ_SLAB, Ingredient.of(Blocks.CHISELED_QUARTZ_BLOCK, Blocks.QUARTZ_BLOCK, Blocks.QUARTZ_PILLAR)) + .unlockedBy("has_chiseled_quartz_block", this.has(Blocks.CHISELED_QUARTZ_BLOCK)) + .unlockedBy("has_quartz_block", this.has(Blocks.QUARTZ_BLOCK)) + .unlockedBy("has_quartz_pillar", this.has(Blocks.QUARTZ_PILLAR)) + .save(this.output); + this.stairBuilder(Blocks.QUARTZ_STAIRS, Ingredient.of(Blocks.CHISELED_QUARTZ_BLOCK, Blocks.QUARTZ_BLOCK, Blocks.QUARTZ_PILLAR)) + .unlockedBy("has_chiseled_quartz_block", this.has(Blocks.CHISELED_QUARTZ_BLOCK)) + .unlockedBy("has_quartz_block", this.has(Blocks.QUARTZ_BLOCK)) + .unlockedBy("has_quartz_pillar", this.has(Blocks.QUARTZ_PILLAR)) + .save(this.output); + this.shapeless(RecipeCategory.FOOD, Items.RABBIT_STEW) .requires(Items.BAKED_POTATO) .requires(Items.COOKED_RABBIT) .requires(Items.BOWL) .requires(Items.CARROT) .requires(Blocks.BROWN_MUSHROOM) .group("rabbit_stew") - .unlockedBy("has_cooked_rabbit", has(Items.COOKED_RABBIT)) - .save(recipeOutput, getConversionRecipeName(Items.RABBIT_STEW, Items.BROWN_MUSHROOM)); - ShapelessRecipeBuilder.shapeless(RecipeCategory.FOOD, Items.RABBIT_STEW) + .unlockedBy("has_cooked_rabbit", this.has(Items.COOKED_RABBIT)) + .save(this.output, getConversionRecipeName(Items.RABBIT_STEW, Items.BROWN_MUSHROOM)); + this.shapeless(RecipeCategory.FOOD, Items.RABBIT_STEW) .requires(Items.BAKED_POTATO) .requires(Items.COOKED_RABBIT) .requires(Items.BOWL) .requires(Items.CARROT) .requires(Blocks.RED_MUSHROOM) .group("rabbit_stew") - .unlockedBy("has_cooked_rabbit", has(Items.COOKED_RABBIT)) - .save(recipeOutput, getConversionRecipeName(Items.RABBIT_STEW, Items.RED_MUSHROOM)); - ShapedRecipeBuilder.shaped(RecipeCategory.TRANSPORTATION, Blocks.RAIL, 16) + .unlockedBy("has_cooked_rabbit", this.has(Items.COOKED_RABBIT)) + .save(this.output, getConversionRecipeName(Items.RABBIT_STEW, Items.RED_MUSHROOM)); + this.shaped(RecipeCategory.TRANSPORTATION, Blocks.RAIL, 16) .define('#', Items.STICK) .define('X', Items.IRON_INGOT) .pattern("X X") .pattern("X#X") .pattern("X X") - .unlockedBy("has_minecart", has(Items.MINECART)) - .save(recipeOutput); - nineBlockStorageRecipes(recipeOutput, RecipeCategory.REDSTONE, Items.REDSTONE, RecipeCategory.REDSTONE, Items.REDSTONE_BLOCK); - ShapedRecipeBuilder.shaped(RecipeCategory.REDSTONE, Blocks.REDSTONE_LAMP) + .unlockedBy("has_minecart", this.has(Items.MINECART)) + .save(this.output); + this.nineBlockStorageRecipes(RecipeCategory.REDSTONE, Items.REDSTONE, RecipeCategory.REDSTONE, Items.REDSTONE_BLOCK); + this.shaped(RecipeCategory.REDSTONE, Blocks.REDSTONE_LAMP) .define('R', Items.REDSTONE) .define('G', Blocks.GLOWSTONE) .pattern(" R ") .pattern("RGR") .pattern(" R ") - .unlockedBy("has_glowstone", has(Blocks.GLOWSTONE)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.REDSTONE, Blocks.REDSTONE_TORCH) + .unlockedBy("has_glowstone", this.has(Blocks.GLOWSTONE)) + .save(this.output); + this.shaped(RecipeCategory.REDSTONE, Blocks.REDSTONE_TORCH) .define('#', Items.STICK) .define('X', Items.REDSTONE) .pattern("X") .pattern("#") - .unlockedBy("has_redstone", has(Items.REDSTONE)) - .save(recipeOutput); - oneToOneConversionRecipe(recipeOutput, Items.RED_DYE, Items.BEETROOT, "red_dye"); - oneToOneConversionRecipe(recipeOutput, Items.RED_DYE, Blocks.POPPY, "red_dye"); - oneToOneConversionRecipe(recipeOutput, Items.RED_DYE, Blocks.ROSE_BUSH, "red_dye", 2); - ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, Items.RED_DYE) + .unlockedBy("has_redstone", this.has(Items.REDSTONE)) + .save(this.output); + this.oneToOneConversionRecipe(Items.RED_DYE, Items.BEETROOT, "red_dye"); + this.oneToOneConversionRecipe(Items.RED_DYE, Blocks.POPPY, "red_dye"); + this.oneToOneConversionRecipe(Items.RED_DYE, Blocks.ROSE_BUSH, "red_dye", 2); + this.shapeless(RecipeCategory.MISC, Items.RED_DYE) .requires(Blocks.RED_TULIP) .group("red_dye") - .unlockedBy("has_red_flower", has(Blocks.RED_TULIP)) - .save(recipeOutput, "red_dye_from_tulip"); - ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, Blocks.RED_NETHER_BRICKS) + .unlockedBy("has_red_flower", this.has(Blocks.RED_TULIP)) + .save(this.output, "red_dye_from_tulip"); + this.shaped(RecipeCategory.BUILDING_BLOCKS, Blocks.RED_NETHER_BRICKS) .define('W', Items.NETHER_WART) .define('N', Items.NETHER_BRICK) .pattern("NW") .pattern("WN") - .unlockedBy("has_nether_wart", has(Items.NETHER_WART)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, Blocks.RED_SANDSTONE) + .unlockedBy("has_nether_wart", this.has(Items.NETHER_WART)) + .save(this.output); + this.shaped(RecipeCategory.BUILDING_BLOCKS, Blocks.RED_SANDSTONE) .define('#', Blocks.RED_SAND) .pattern("##") .pattern("##") - .unlockedBy("has_sand", has(Blocks.RED_SAND)) - .save(recipeOutput); - slabBuilder(RecipeCategory.BUILDING_BLOCKS, Blocks.RED_SANDSTONE_SLAB, Ingredient.of(Blocks.RED_SANDSTONE, Blocks.CHISELED_RED_SANDSTONE)) - .unlockedBy("has_red_sandstone", has(Blocks.RED_SANDSTONE)) - .unlockedBy("has_chiseled_red_sandstone", has(Blocks.CHISELED_RED_SANDSTONE)) - .save(recipeOutput); - stairBuilder(Blocks.RED_SANDSTONE_STAIRS, Ingredient.of(Blocks.RED_SANDSTONE, Blocks.CHISELED_RED_SANDSTONE, Blocks.CUT_RED_SANDSTONE)) - .unlockedBy("has_red_sandstone", has(Blocks.RED_SANDSTONE)) - .unlockedBy("has_chiseled_red_sandstone", has(Blocks.CHISELED_RED_SANDSTONE)) - .unlockedBy("has_cut_red_sandstone", has(Blocks.CUT_RED_SANDSTONE)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.REDSTONE, Blocks.REPEATER) + .unlockedBy("has_sand", this.has(Blocks.RED_SAND)) + .save(this.output); + this.slabBuilder(RecipeCategory.BUILDING_BLOCKS, Blocks.RED_SANDSTONE_SLAB, Ingredient.of(Blocks.RED_SANDSTONE, Blocks.CHISELED_RED_SANDSTONE)) + .unlockedBy("has_red_sandstone", this.has(Blocks.RED_SANDSTONE)) + .unlockedBy("has_chiseled_red_sandstone", this.has(Blocks.CHISELED_RED_SANDSTONE)) + .save(this.output); + this.stairBuilder(Blocks.RED_SANDSTONE_STAIRS, Ingredient.of(Blocks.RED_SANDSTONE, Blocks.CHISELED_RED_SANDSTONE, Blocks.CUT_RED_SANDSTONE)) + .unlockedBy("has_red_sandstone", this.has(Blocks.RED_SANDSTONE)) + .unlockedBy("has_chiseled_red_sandstone", this.has(Blocks.CHISELED_RED_SANDSTONE)) + .unlockedBy("has_cut_red_sandstone", this.has(Blocks.CUT_RED_SANDSTONE)) + .save(this.output); + this.shaped(RecipeCategory.REDSTONE, Blocks.REPEATER) .define('#', Blocks.REDSTONE_TORCH) .define('X', Items.REDSTONE) .define('I', Blocks.STONE) .pattern("#X#") .pattern("III") - .unlockedBy("has_redstone_torch", has(Blocks.REDSTONE_TORCH)) - .save(recipeOutput); - twoByTwoPacker(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.SANDSTONE, Blocks.SAND); - slabBuilder(RecipeCategory.BUILDING_BLOCKS, Blocks.SANDSTONE_SLAB, Ingredient.of(Blocks.SANDSTONE, Blocks.CHISELED_SANDSTONE)) - .unlockedBy("has_sandstone", has(Blocks.SANDSTONE)) - .unlockedBy("has_chiseled_sandstone", has(Blocks.CHISELED_SANDSTONE)) - .save(recipeOutput); - stairBuilder(Blocks.SANDSTONE_STAIRS, Ingredient.of(Blocks.SANDSTONE, Blocks.CHISELED_SANDSTONE, Blocks.CUT_SANDSTONE)) - .unlockedBy("has_sandstone", has(Blocks.SANDSTONE)) - .unlockedBy("has_chiseled_sandstone", has(Blocks.CHISELED_SANDSTONE)) - .unlockedBy("has_cut_sandstone", has(Blocks.CUT_SANDSTONE)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, Blocks.SEA_LANTERN) + .unlockedBy("has_redstone_torch", this.has(Blocks.REDSTONE_TORCH)) + .save(this.output); + this.twoByTwoPacker(RecipeCategory.BUILDING_BLOCKS, Blocks.SANDSTONE, Blocks.SAND); + this.slabBuilder(RecipeCategory.BUILDING_BLOCKS, Blocks.SANDSTONE_SLAB, Ingredient.of(Blocks.SANDSTONE, Blocks.CHISELED_SANDSTONE)) + .unlockedBy("has_sandstone", this.has(Blocks.SANDSTONE)) + .unlockedBy("has_chiseled_sandstone", this.has(Blocks.CHISELED_SANDSTONE)) + .save(this.output); + this.stairBuilder(Blocks.SANDSTONE_STAIRS, Ingredient.of(Blocks.SANDSTONE, Blocks.CHISELED_SANDSTONE, Blocks.CUT_SANDSTONE)) + .unlockedBy("has_sandstone", this.has(Blocks.SANDSTONE)) + .unlockedBy("has_chiseled_sandstone", this.has(Blocks.CHISELED_SANDSTONE)) + .unlockedBy("has_cut_sandstone", this.has(Blocks.CUT_SANDSTONE)) + .save(this.output); + this.shaped(RecipeCategory.BUILDING_BLOCKS, Blocks.SEA_LANTERN) .define('S', Items.PRISMARINE_SHARD) .define('C', Items.PRISMARINE_CRYSTALS) .pattern("SCS") .pattern("CCC") .pattern("SCS") - .unlockedBy("has_prismarine_crystals", has(Items.PRISMARINE_CRYSTALS)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.TOOLS, Items.SHEARS) + .unlockedBy("has_prismarine_crystals", this.has(Items.PRISMARINE_CRYSTALS)) + .save(this.output); + this.shaped(RecipeCategory.TOOLS, Items.SHEARS) .define('#', Items.IRON_INGOT) .pattern(" #") .pattern("# ") - .unlockedBy("has_iron_ingot", has(Items.IRON_INGOT)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.COMBAT, Items.SHIELD) - .define('W', ItemTags.PLANKS) + .unlockedBy("has_iron_ingot", this.has(Items.IRON_INGOT)) + .save(this.output); + this.shaped(RecipeCategory.COMBAT, Items.SHIELD) + .define('W', ItemTags.WOODEN_TOOL_MATERIALS) .define('o', Items.IRON_INGOT) .pattern("WoW") .pattern("WWW") .pattern(" W ") - .unlockedBy("has_iron_ingot", has(Items.IRON_INGOT)) - .save(recipeOutput); - nineBlockStorageRecipes(recipeOutput, RecipeCategory.MISC, Items.SLIME_BALL, RecipeCategory.REDSTONE, Items.SLIME_BLOCK); - cut(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.CUT_RED_SANDSTONE, Blocks.RED_SANDSTONE); - cut(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.CUT_SANDSTONE, Blocks.SANDSTONE); - twoByTwoPacker(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.SNOW_BLOCK, Items.SNOWBALL); - ShapedRecipeBuilder.shaped(RecipeCategory.DECORATIONS, Blocks.SNOW, 6) + .unlockedBy("has_iron_ingot", this.has(Items.IRON_INGOT)) + .save(this.output); + this.nineBlockStorageRecipes(RecipeCategory.MISC, Items.SLIME_BALL, RecipeCategory.REDSTONE, Items.SLIME_BLOCK); + this.cut(RecipeCategory.BUILDING_BLOCKS, Blocks.CUT_RED_SANDSTONE, Blocks.RED_SANDSTONE); + this.cut(RecipeCategory.BUILDING_BLOCKS, Blocks.CUT_SANDSTONE, Blocks.SANDSTONE); + this.twoByTwoPacker(RecipeCategory.BUILDING_BLOCKS, Blocks.SNOW_BLOCK, Items.SNOWBALL); + this.shaped(RecipeCategory.DECORATIONS, Blocks.SNOW, 6) .define('#', Blocks.SNOW_BLOCK) .pattern("###") - .unlockedBy("has_snowball", has(Items.SNOWBALL)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.DECORATIONS, Blocks.SOUL_CAMPFIRE) + .unlockedBy("has_snowball", this.has(Items.SNOWBALL)) + .save(this.output); + this.shaped(RecipeCategory.DECORATIONS, Blocks.SOUL_CAMPFIRE) .define('L', ItemTags.LOGS) .define('S', Items.STICK) .define('#', ItemTags.SOUL_FIRE_BASE_BLOCKS) .pattern(" S ") .pattern("S#S") .pattern("LLL") - .unlockedBy("has_soul_sand", has(ItemTags.SOUL_FIRE_BASE_BLOCKS)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.BREWING, Items.GLISTERING_MELON_SLICE) + .unlockedBy("has_soul_sand", this.has(ItemTags.SOUL_FIRE_BASE_BLOCKS)) + .save(this.output); + this.shaped(RecipeCategory.BREWING, Items.GLISTERING_MELON_SLICE) .define('#', Items.GOLD_NUGGET) .define('X', Items.MELON_SLICE) .pattern("###") .pattern("#X#") .pattern("###") - .unlockedBy("has_melon", has(Items.MELON_SLICE)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.COMBAT, Items.SPECTRAL_ARROW, 2) + .unlockedBy("has_melon", this.has(Items.MELON_SLICE)) + .save(this.output); + this.shaped(RecipeCategory.COMBAT, Items.SPECTRAL_ARROW, 2) .define('#', Items.GLOWSTONE_DUST) .define('X', Items.ARROW) .pattern(" # ") .pattern("#X#") .pattern(" # ") - .unlockedBy("has_glowstone_dust", has(Items.GLOWSTONE_DUST)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.TOOLS, Items.SPYGLASS) + .unlockedBy("has_glowstone_dust", this.has(Items.GLOWSTONE_DUST)) + .save(this.output); + this.shaped(RecipeCategory.TOOLS, Items.SPYGLASS) .define('#', Items.AMETHYST_SHARD) .define('X', Items.COPPER_INGOT) .pattern(" # ") .pattern(" X ") .pattern(" X ") - .unlockedBy("has_amethyst_shard", has(Items.AMETHYST_SHARD)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.MISC, Items.STICK, 4) + .unlockedBy("has_amethyst_shard", this.has(Items.AMETHYST_SHARD)) + .save(this.output); + this.shaped(RecipeCategory.MISC, Items.STICK, 4) .define('#', ItemTags.PLANKS) .pattern("#") .pattern("#") .group("sticks") - .unlockedBy("has_planks", has(ItemTags.PLANKS)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.MISC, Items.STICK, 1) + .unlockedBy("has_planks", this.has(ItemTags.PLANKS)) + .save(this.output); + this.shaped(RecipeCategory.MISC, Items.STICK, 1) .define('#', Blocks.BAMBOO) .pattern("#") .pattern("#") .group("sticks") - .unlockedBy("has_bamboo", has(Blocks.BAMBOO)) - .save(recipeOutput, "stick_from_bamboo_item"); - ShapedRecipeBuilder.shaped(RecipeCategory.REDSTONE, Blocks.STICKY_PISTON) + .unlockedBy("has_bamboo", this.has(Blocks.BAMBOO)) + .save(this.output, "stick_from_bamboo_item"); + this.shaped(RecipeCategory.REDSTONE, Blocks.STICKY_PISTON) .define('P', Blocks.PISTON) .define('S', Items.SLIME_BALL) .pattern("S") .pattern("P") - .unlockedBy("has_slime_ball", has(Items.SLIME_BALL)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, Blocks.STONE_BRICKS, 4) + .unlockedBy("has_slime_ball", this.has(Items.SLIME_BALL)) + .save(this.output); + this.shaped(RecipeCategory.BUILDING_BLOCKS, Blocks.STONE_BRICKS, 4) .define('#', Blocks.STONE) .pattern("##") .pattern("##") - .unlockedBy("has_stone", has(Blocks.STONE)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.TOOLS, Items.STONE_AXE) + .unlockedBy("has_stone", this.has(Blocks.STONE)) + .save(this.output); + this.shaped(RecipeCategory.TOOLS, Items.STONE_AXE) .define('#', Items.STICK) .define('X', ItemTags.STONE_TOOL_MATERIALS) .pattern("XX") .pattern("X#") .pattern(" #") - .unlockedBy("has_cobblestone", has(ItemTags.STONE_TOOL_MATERIALS)) - .save(recipeOutput); - slabBuilder(RecipeCategory.BUILDING_BLOCKS, Blocks.STONE_BRICK_SLAB, Ingredient.of(Blocks.STONE_BRICKS)) - .unlockedBy("has_stone_bricks", has(ItemTags.STONE_BRICKS)) - .save(recipeOutput); - stairBuilder(Blocks.STONE_BRICK_STAIRS, Ingredient.of(Blocks.STONE_BRICKS)).unlockedBy("has_stone_bricks", has(ItemTags.STONE_BRICKS)).save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.TOOLS, Items.STONE_HOE) + .unlockedBy("has_cobblestone", this.has(ItemTags.STONE_TOOL_MATERIALS)) + .save(this.output); + this.slabBuilder(RecipeCategory.BUILDING_BLOCKS, Blocks.STONE_BRICK_SLAB, Ingredient.of(Blocks.STONE_BRICKS)) + .unlockedBy("has_stone_bricks", this.has(ItemTags.STONE_BRICKS)) + .save(this.output); + this.stairBuilder(Blocks.STONE_BRICK_STAIRS, Ingredient.of(Blocks.STONE_BRICKS)) + .unlockedBy("has_stone_bricks", this.has(ItemTags.STONE_BRICKS)) + .save(this.output); + this.shaped(RecipeCategory.TOOLS, Items.STONE_HOE) .define('#', Items.STICK) .define('X', ItemTags.STONE_TOOL_MATERIALS) .pattern("XX") .pattern(" #") .pattern(" #") - .unlockedBy("has_cobblestone", has(ItemTags.STONE_TOOL_MATERIALS)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.TOOLS, Items.STONE_PICKAXE) + .unlockedBy("has_cobblestone", this.has(ItemTags.STONE_TOOL_MATERIALS)) + .save(this.output); + this.shaped(RecipeCategory.TOOLS, Items.STONE_PICKAXE) .define('#', Items.STICK) .define('X', ItemTags.STONE_TOOL_MATERIALS) .pattern("XXX") .pattern(" # ") .pattern(" # ") - .unlockedBy("has_cobblestone", has(ItemTags.STONE_TOOL_MATERIALS)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.TOOLS, Items.STONE_SHOVEL) + .unlockedBy("has_cobblestone", this.has(ItemTags.STONE_TOOL_MATERIALS)) + .save(this.output); + this.shaped(RecipeCategory.TOOLS, Items.STONE_SHOVEL) .define('#', Items.STICK) .define('X', ItemTags.STONE_TOOL_MATERIALS) .pattern("X") .pattern("#") .pattern("#") - .unlockedBy("has_cobblestone", has(ItemTags.STONE_TOOL_MATERIALS)) - .save(recipeOutput); - slab(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.SMOOTH_STONE_SLAB, Blocks.SMOOTH_STONE); - ShapedRecipeBuilder.shaped(RecipeCategory.COMBAT, Items.STONE_SWORD) + .unlockedBy("has_cobblestone", this.has(ItemTags.STONE_TOOL_MATERIALS)) + .save(this.output); + this.slab(RecipeCategory.BUILDING_BLOCKS, Blocks.SMOOTH_STONE_SLAB, Blocks.SMOOTH_STONE); + this.shaped(RecipeCategory.COMBAT, Items.STONE_SWORD) .define('#', Items.STICK) .define('X', ItemTags.STONE_TOOL_MATERIALS) .pattern("X") .pattern("X") .pattern("#") - .unlockedBy("has_cobblestone", has(ItemTags.STONE_TOOL_MATERIALS)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, Blocks.WHITE_WOOL) + .unlockedBy("has_cobblestone", this.has(ItemTags.STONE_TOOL_MATERIALS)) + .save(this.output); + this.shaped(RecipeCategory.BUILDING_BLOCKS, Blocks.WHITE_WOOL) .define('#', Items.STRING) .pattern("##") .pattern("##") - .unlockedBy("has_string", has(Items.STRING)) - .save(recipeOutput, getConversionRecipeName(Blocks.WHITE_WOOL, Items.STRING)); - oneToOneConversionRecipe(recipeOutput, Items.SUGAR, Blocks.SUGAR_CANE, "sugar"); - ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, Items.SUGAR, 3) + .unlockedBy("has_string", this.has(Items.STRING)) + .save(this.output, getConversionRecipeName(Blocks.WHITE_WOOL, Items.STRING)); + this.oneToOneConversionRecipe(Items.SUGAR, Blocks.SUGAR_CANE, "sugar"); + this.shapeless(RecipeCategory.MISC, Items.SUGAR, 3) .requires(Items.HONEY_BOTTLE) .group("sugar") - .unlockedBy("has_honey_bottle", has(Items.HONEY_BOTTLE)) - .save(recipeOutput, getConversionRecipeName(Items.SUGAR, Items.HONEY_BOTTLE)); - ShapedRecipeBuilder.shaped(RecipeCategory.REDSTONE, Blocks.TARGET) + .unlockedBy("has_honey_bottle", this.has(Items.HONEY_BOTTLE)) + .save(this.output, getConversionRecipeName(Items.SUGAR, Items.HONEY_BOTTLE)); + this.shaped(RecipeCategory.REDSTONE, Blocks.TARGET) .define('H', Items.HAY_BLOCK) .define('R', Items.REDSTONE) .pattern(" R ") .pattern("RHR") .pattern(" R ") - .unlockedBy("has_redstone", has(Items.REDSTONE)) - .unlockedBy("has_hay_block", has(Blocks.HAY_BLOCK)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.REDSTONE, Blocks.TNT) + .unlockedBy("has_redstone", this.has(Items.REDSTONE)) + .unlockedBy("has_hay_block", this.has(Blocks.HAY_BLOCK)) + .save(this.output); + this.shaped(RecipeCategory.REDSTONE, Blocks.TNT) .define('#', Ingredient.of(Blocks.SAND, Blocks.RED_SAND)) .define('X', Items.GUNPOWDER) .pattern("X#X") .pattern("#X#") .pattern("X#X") - .unlockedBy("has_gunpowder", has(Items.GUNPOWDER)) - .save(recipeOutput); - ShapelessRecipeBuilder.shapeless(RecipeCategory.TRANSPORTATION, Items.TNT_MINECART) + .unlockedBy("has_gunpowder", this.has(Items.GUNPOWDER)) + .save(this.output); + this.shapeless(RecipeCategory.TRANSPORTATION, Items.TNT_MINECART) .requires(Blocks.TNT) .requires(Items.MINECART) - .unlockedBy("has_minecart", has(Items.MINECART)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.DECORATIONS, Blocks.TORCH, 4) + .unlockedBy("has_minecart", this.has(Items.MINECART)) + .save(this.output); + this.shaped(RecipeCategory.DECORATIONS, Blocks.TORCH, 4) .define('#', Items.STICK) .define('X', Ingredient.of(Items.COAL, Items.CHARCOAL)) .pattern("X") .pattern("#") - .unlockedBy("has_stone_pickaxe", has(Items.STONE_PICKAXE)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.DECORATIONS, Blocks.SOUL_TORCH, 4) + .unlockedBy("has_stone_pickaxe", this.has(Items.STONE_PICKAXE)) + .save(this.output); + this.shaped(RecipeCategory.DECORATIONS, Blocks.SOUL_TORCH, 4) .define('X', Ingredient.of(Items.COAL, Items.CHARCOAL)) .define('#', Items.STICK) .define('S', ItemTags.SOUL_FIRE_BASE_BLOCKS) .pattern("X") .pattern("#") .pattern("S") - .unlockedBy("has_soul_sand", has(ItemTags.SOUL_FIRE_BASE_BLOCKS)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.DECORATIONS, Blocks.LANTERN) + .unlockedBy("has_soul_sand", this.has(ItemTags.SOUL_FIRE_BASE_BLOCKS)) + .save(this.output); + this.shaped(RecipeCategory.DECORATIONS, Blocks.LANTERN) .define('#', Items.TORCH) .define('X', Items.IRON_NUGGET) .pattern("XXX") .pattern("X#X") .pattern("XXX") - .unlockedBy("has_iron_nugget", has(Items.IRON_NUGGET)) - .unlockedBy("has_iron_ingot", has(Items.IRON_INGOT)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.DECORATIONS, Blocks.SOUL_LANTERN) + .unlockedBy("has_iron_nugget", this.has(Items.IRON_NUGGET)) + .unlockedBy("has_iron_ingot", this.has(Items.IRON_INGOT)) + .save(this.output); + this.shaped(RecipeCategory.DECORATIONS, Blocks.SOUL_LANTERN) .define('#', Items.SOUL_TORCH) .define('X', Items.IRON_NUGGET) .pattern("XXX") .pattern("X#X") .pattern("XXX") - .unlockedBy("has_soul_torch", has(Items.SOUL_TORCH)) - .save(recipeOutput); - ShapelessRecipeBuilder.shapeless(RecipeCategory.REDSTONE, Blocks.TRAPPED_CHEST) + .unlockedBy("has_soul_torch", this.has(Items.SOUL_TORCH)) + .save(this.output); + this.shapeless(RecipeCategory.REDSTONE, Blocks.TRAPPED_CHEST) .requires(Blocks.CHEST) .requires(Blocks.TRIPWIRE_HOOK) - .unlockedBy("has_tripwire_hook", has(Blocks.TRIPWIRE_HOOK)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.REDSTONE, Blocks.TRIPWIRE_HOOK, 2) + .unlockedBy("has_tripwire_hook", this.has(Blocks.TRIPWIRE_HOOK)) + .save(this.output); + this.shaped(RecipeCategory.REDSTONE, Blocks.TRIPWIRE_HOOK, 2) .define('#', ItemTags.PLANKS) .define('S', Items.STICK) .define('I', Items.IRON_INGOT) .pattern("I") .pattern("S") .pattern("#") - .unlockedBy("has_string", has(Items.STRING)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.COMBAT, Items.TURTLE_HELMET) + .unlockedBy("has_string", this.has(Items.STRING)) + .save(this.output); + this.shaped(RecipeCategory.COMBAT, Items.TURTLE_HELMET) .define('X', Items.TURTLE_SCUTE) .pattern("XXX") .pattern("X X") - .unlockedBy("has_turtle_scute", has(Items.TURTLE_SCUTE)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.COMBAT, Items.WOLF_ARMOR) + .unlockedBy("has_turtle_scute", this.has(Items.TURTLE_SCUTE)) + .save(this.output); + this.shaped(RecipeCategory.COMBAT, Items.WOLF_ARMOR) .define('X', Items.ARMADILLO_SCUTE) .pattern("X ") .pattern("XXX") .pattern("X X") - .unlockedBy("has_armadillo_scute", has(Items.ARMADILLO_SCUTE)) - .save(recipeOutput); - ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, Items.WHEAT, 9) - .requires(Blocks.HAY_BLOCK) - .unlockedBy("has_hay_block", has(Blocks.HAY_BLOCK)) - .save(recipeOutput); - ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, Items.WHITE_DYE) + .unlockedBy("has_armadillo_scute", this.has(Items.ARMADILLO_SCUTE)) + .save(this.output); + this.shapeless(RecipeCategory.MISC, Items.WHEAT, 9).requires(Blocks.HAY_BLOCK).unlockedBy("has_hay_block", this.has(Blocks.HAY_BLOCK)).save(this.output); + this.shapeless(RecipeCategory.MISC, Items.WHITE_DYE) .requires(Items.BONE_MEAL) .group("white_dye") - .unlockedBy("has_bone_meal", has(Items.BONE_MEAL)) - .save(recipeOutput); - oneToOneConversionRecipe(recipeOutput, Items.WHITE_DYE, Blocks.LILY_OF_THE_VALLEY, "white_dye"); - ShapedRecipeBuilder.shaped(RecipeCategory.TOOLS, Items.WOODEN_AXE) + .unlockedBy("has_bone_meal", this.has(Items.BONE_MEAL)) + .save(this.output); + this.oneToOneConversionRecipe(Items.WHITE_DYE, Blocks.LILY_OF_THE_VALLEY, "white_dye"); + this.shaped(RecipeCategory.TOOLS, Items.WOODEN_AXE) .define('#', Items.STICK) - .define('X', ItemTags.PLANKS) + .define('X', ItemTags.WOODEN_TOOL_MATERIALS) .pattern("XX") .pattern("X#") .pattern(" #") - .unlockedBy("has_stick", has(Items.STICK)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.TOOLS, Items.WOODEN_HOE) + .unlockedBy("has_stick", this.has(Items.STICK)) + .save(this.output); + this.shaped(RecipeCategory.TOOLS, Items.WOODEN_HOE) .define('#', Items.STICK) - .define('X', ItemTags.PLANKS) + .define('X', ItemTags.WOODEN_TOOL_MATERIALS) .pattern("XX") .pattern(" #") .pattern(" #") - .unlockedBy("has_stick", has(Items.STICK)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.TOOLS, Items.WOODEN_PICKAXE) + .unlockedBy("has_stick", this.has(Items.STICK)) + .save(this.output); + this.shaped(RecipeCategory.TOOLS, Items.WOODEN_PICKAXE) .define('#', Items.STICK) - .define('X', ItemTags.PLANKS) + .define('X', ItemTags.WOODEN_TOOL_MATERIALS) .pattern("XXX") .pattern(" # ") .pattern(" # ") - .unlockedBy("has_stick", has(Items.STICK)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.TOOLS, Items.WOODEN_SHOVEL) + .unlockedBy("has_stick", this.has(Items.STICK)) + .save(this.output); + this.shaped(RecipeCategory.TOOLS, Items.WOODEN_SHOVEL) .define('#', Items.STICK) - .define('X', ItemTags.PLANKS) + .define('X', ItemTags.WOODEN_TOOL_MATERIALS) .pattern("X") .pattern("#") .pattern("#") - .unlockedBy("has_stick", has(Items.STICK)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.COMBAT, Items.WOODEN_SWORD) + .unlockedBy("has_stick", this.has(Items.STICK)) + .save(this.output); + this.shaped(RecipeCategory.COMBAT, Items.WOODEN_SWORD) .define('#', Items.STICK) - .define('X', ItemTags.PLANKS) + .define('X', ItemTags.WOODEN_TOOL_MATERIALS) .pattern("X") .pattern("X") .pattern("#") - .unlockedBy("has_stick", has(Items.STICK)) - .save(recipeOutput); - ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, Items.WRITABLE_BOOK) + .unlockedBy("has_stick", this.has(Items.STICK)) + .save(this.output); + this.shapeless(RecipeCategory.MISC, Items.WRITABLE_BOOK) .requires(Items.BOOK) .requires(Items.INK_SAC) .requires(Items.FEATHER) - .unlockedBy("has_book", has(Items.BOOK)) - .save(recipeOutput); - oneToOneConversionRecipe(recipeOutput, Items.YELLOW_DYE, Blocks.DANDELION, "yellow_dye"); - oneToOneConversionRecipe(recipeOutput, Items.YELLOW_DYE, Blocks.SUNFLOWER, "yellow_dye", 2); - nineBlockStorageRecipes(recipeOutput, RecipeCategory.FOOD, Items.DRIED_KELP, RecipeCategory.BUILDING_BLOCKS, Items.DRIED_KELP_BLOCK); - ShapedRecipeBuilder.shaped(RecipeCategory.MISC, Blocks.CONDUIT) + .unlockedBy("has_book", this.has(Items.BOOK)) + .save(this.output); + this.oneToOneConversionRecipe(Items.YELLOW_DYE, Blocks.DANDELION, "yellow_dye"); + this.oneToOneConversionRecipe(Items.YELLOW_DYE, Blocks.SUNFLOWER, "yellow_dye", 2); + this.nineBlockStorageRecipes(RecipeCategory.FOOD, Items.DRIED_KELP, RecipeCategory.BUILDING_BLOCKS, Items.DRIED_KELP_BLOCK); + this.shaped(RecipeCategory.MISC, Blocks.CONDUIT) .define('#', Items.NAUTILUS_SHELL) .define('X', Items.HEART_OF_THE_SEA) .pattern("###") .pattern("#X#") .pattern("###") - .unlockedBy("has_nautilus_core", has(Items.HEART_OF_THE_SEA)) - .unlockedBy("has_nautilus_shell", has(Items.NAUTILUS_SHELL)) - .save(recipeOutput); - wall(recipeOutput, RecipeCategory.DECORATIONS, Blocks.RED_SANDSTONE_WALL, Blocks.RED_SANDSTONE); - wall(recipeOutput, RecipeCategory.DECORATIONS, Blocks.STONE_BRICK_WALL, Blocks.STONE_BRICKS); - wall(recipeOutput, RecipeCategory.DECORATIONS, Blocks.SANDSTONE_WALL, Blocks.SANDSTONE); - ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, Items.CREEPER_BANNER_PATTERN) + .unlockedBy("has_nautilus_core", this.has(Items.HEART_OF_THE_SEA)) + .unlockedBy("has_nautilus_shell", this.has(Items.NAUTILUS_SHELL)) + .save(this.output); + this.wall(RecipeCategory.DECORATIONS, Blocks.RED_SANDSTONE_WALL, Blocks.RED_SANDSTONE); + this.wall(RecipeCategory.DECORATIONS, Blocks.STONE_BRICK_WALL, Blocks.STONE_BRICKS); + this.wall(RecipeCategory.DECORATIONS, Blocks.SANDSTONE_WALL, Blocks.SANDSTONE); + this.shapeless(RecipeCategory.MISC, Items.FIELD_MASONED_BANNER_PATTERN) + .requires(Items.PAPER) + .requires(Blocks.BRICKS) + .unlockedBy("has_bricks", this.has(Blocks.BRICKS)) + .save(this.output); + this.shapeless(RecipeCategory.MISC, Items.BORDURE_INDENTED_BANNER_PATTERN) + .requires(Items.PAPER) + .requires(Blocks.VINE) + .unlockedBy("has_vines", this.has(Blocks.VINE)) + .save(this.output); + this.shapeless(RecipeCategory.MISC, Items.CREEPER_BANNER_PATTERN) .requires(Items.PAPER) .requires(Items.CREEPER_HEAD) - .unlockedBy("has_creeper_head", has(Items.CREEPER_HEAD)) - .save(recipeOutput); - ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, Items.SKULL_BANNER_PATTERN) + .unlockedBy("has_creeper_head", this.has(Items.CREEPER_HEAD)) + .save(this.output); + this.shapeless(RecipeCategory.MISC, Items.SKULL_BANNER_PATTERN) .requires(Items.PAPER) .requires(Items.WITHER_SKELETON_SKULL) - .unlockedBy("has_wither_skeleton_skull", has(Items.WITHER_SKELETON_SKULL)) - .save(recipeOutput); - ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, Items.FLOWER_BANNER_PATTERN) + .unlockedBy("has_wither_skeleton_skull", this.has(Items.WITHER_SKELETON_SKULL)) + .save(this.output); + this.shapeless(RecipeCategory.MISC, Items.FLOWER_BANNER_PATTERN) .requires(Items.PAPER) .requires(Blocks.OXEYE_DAISY) - .unlockedBy("has_oxeye_daisy", has(Blocks.OXEYE_DAISY)) - .save(recipeOutput); - ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, Items.MOJANG_BANNER_PATTERN) + .unlockedBy("has_oxeye_daisy", this.has(Blocks.OXEYE_DAISY)) + .save(this.output); + this.shapeless(RecipeCategory.MISC, Items.MOJANG_BANNER_PATTERN) .requires(Items.PAPER) .requires(Items.ENCHANTED_GOLDEN_APPLE) - .unlockedBy("has_enchanted_golden_apple", has(Items.ENCHANTED_GOLDEN_APPLE)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.DECORATIONS, Blocks.SCAFFOLDING, 6) + .unlockedBy("has_enchanted_golden_apple", this.has(Items.ENCHANTED_GOLDEN_APPLE)) + .save(this.output); + this.shaped(RecipeCategory.DECORATIONS, Blocks.SCAFFOLDING, 6) .define('~', Items.STRING) .define('I', Blocks.BAMBOO) .pattern("I~I") .pattern("I I") .pattern("I I") - .unlockedBy("has_bamboo", has(Blocks.BAMBOO)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.DECORATIONS, Blocks.GRINDSTONE) + .unlockedBy("has_bamboo", this.has(Blocks.BAMBOO)) + .save(this.output); + this.shaped(RecipeCategory.DECORATIONS, Blocks.GRINDSTONE) .define('I', Items.STICK) .define('-', Blocks.STONE_SLAB) .define('#', ItemTags.PLANKS) .pattern("I-I") .pattern("# #") - .unlockedBy("has_stone_slab", has(Blocks.STONE_SLAB)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.DECORATIONS, Blocks.BLAST_FURNACE) + .unlockedBy("has_stone_slab", this.has(Blocks.STONE_SLAB)) + .save(this.output); + this.shaped(RecipeCategory.DECORATIONS, Blocks.BLAST_FURNACE) .define('#', Blocks.SMOOTH_STONE) .define('X', Blocks.FURNACE) .define('I', Items.IRON_INGOT) .pattern("III") .pattern("IXI") .pattern("###") - .unlockedBy("has_smooth_stone", has(Blocks.SMOOTH_STONE)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.DECORATIONS, Blocks.SMOKER) + .unlockedBy("has_smooth_stone", this.has(Blocks.SMOOTH_STONE)) + .save(this.output); + this.shaped(RecipeCategory.DECORATIONS, Blocks.SMOKER) .define('#', ItemTags.LOGS) .define('X', Blocks.FURNACE) .pattern(" # ") .pattern("#X#") .pattern(" # ") - .unlockedBy("has_furnace", has(Blocks.FURNACE)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.DECORATIONS, Blocks.CARTOGRAPHY_TABLE) + .unlockedBy("has_furnace", this.has(Blocks.FURNACE)) + .save(this.output); + this.shaped(RecipeCategory.DECORATIONS, Blocks.CARTOGRAPHY_TABLE) .define('#', ItemTags.PLANKS) .define('@', Items.PAPER) .pattern("@@") .pattern("##") .pattern("##") - .unlockedBy("has_paper", has(Items.PAPER)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.DECORATIONS, Blocks.SMITHING_TABLE) + .unlockedBy("has_paper", this.has(Items.PAPER)) + .save(this.output); + this.shaped(RecipeCategory.DECORATIONS, Blocks.SMITHING_TABLE) .define('#', ItemTags.PLANKS) .define('@', Items.IRON_INGOT) .pattern("@@") .pattern("##") .pattern("##") - .unlockedBy("has_iron_ingot", has(Items.IRON_INGOT)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.DECORATIONS, Blocks.FLETCHING_TABLE) + .unlockedBy("has_iron_ingot", this.has(Items.IRON_INGOT)) + .save(this.output); + this.shaped(RecipeCategory.DECORATIONS, Blocks.FLETCHING_TABLE) .define('#', ItemTags.PLANKS) .define('@', Items.FLINT) .pattern("@@") .pattern("##") .pattern("##") - .unlockedBy("has_flint", has(Items.FLINT)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.DECORATIONS, Blocks.STONECUTTER) + .unlockedBy("has_flint", this.has(Items.FLINT)) + .save(this.output); + this.shaped(RecipeCategory.DECORATIONS, Blocks.STONECUTTER) .define('I', Items.IRON_INGOT) .define('#', Blocks.STONE) .pattern(" I ") .pattern("###") - .unlockedBy("has_stone", has(Blocks.STONE)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.DECORATIONS, Blocks.LODESTONE) + .unlockedBy("has_stone", this.has(Blocks.STONE)) + .save(this.output); + this.shaped(RecipeCategory.DECORATIONS, Blocks.LODESTONE) .define('S', Items.CHISELED_STONE_BRICKS) .define('#', Items.NETHERITE_INGOT) .pattern("SSS") .pattern("S#S") .pattern("SSS") - .unlockedBy("has_netherite_ingot", has(Items.NETHERITE_INGOT)) - .save(recipeOutput); - nineBlockStorageRecipesRecipesWithCustomUnpacking( - recipeOutput, - RecipeCategory.MISC, - Items.NETHERITE_INGOT, - RecipeCategory.BUILDING_BLOCKS, - Items.NETHERITE_BLOCK, - "netherite_ingot_from_netherite_block", - "netherite_ingot" + .unlockedBy("has_netherite_ingot", this.has(Items.NETHERITE_INGOT)) + .save(this.output); + this.nineBlockStorageRecipesRecipesWithCustomUnpacking( + RecipeCategory.MISC, Items.NETHERITE_INGOT, RecipeCategory.BUILDING_BLOCKS, Items.NETHERITE_BLOCK, "netherite_ingot_from_netherite_block", "netherite_ingot" ); - ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, Items.NETHERITE_INGOT) + this.shapeless(RecipeCategory.MISC, Items.NETHERITE_INGOT) .requires(Items.NETHERITE_SCRAP, 4) .requires(Items.GOLD_INGOT, 4) .group("netherite_ingot") - .unlockedBy("has_netherite_scrap", has(Items.NETHERITE_SCRAP)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.DECORATIONS, Blocks.RESPAWN_ANCHOR) + .unlockedBy("has_netherite_scrap", this.has(Items.NETHERITE_SCRAP)) + .save(this.output); + this.shaped(RecipeCategory.DECORATIONS, Blocks.RESPAWN_ANCHOR) .define('O', Blocks.CRYING_OBSIDIAN) .define('G', Blocks.GLOWSTONE) .pattern("OOO") .pattern("GGG") .pattern("OOO") - .unlockedBy("has_obsidian", has(Blocks.CRYING_OBSIDIAN)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.DECORATIONS, Blocks.CHAIN) + .unlockedBy("has_obsidian", this.has(Blocks.CRYING_OBSIDIAN)) + .save(this.output); + this.shaped(RecipeCategory.DECORATIONS, Blocks.CHAIN) .define('I', Items.IRON_INGOT) .define('N', Items.IRON_NUGGET) .pattern("N") .pattern("I") .pattern("N") - .unlockedBy("has_iron_nugget", has(Items.IRON_NUGGET)) - .unlockedBy("has_iron_ingot", has(Items.IRON_INGOT)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, Blocks.TINTED_GLASS, 2) + .unlockedBy("has_iron_nugget", this.has(Items.IRON_NUGGET)) + .unlockedBy("has_iron_ingot", this.has(Items.IRON_INGOT)) + .save(this.output); + this.shaped(RecipeCategory.BUILDING_BLOCKS, Blocks.TINTED_GLASS, 2) .define('G', Blocks.GLASS) .define('S', Items.AMETHYST_SHARD) .pattern(" S ") .pattern("SGS") .pattern(" S ") - .unlockedBy("has_amethyst_shard", has(Items.AMETHYST_SHARD)) - .save(recipeOutput); - twoByTwoPacker(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.AMETHYST_BLOCK, Items.AMETHYST_SHARD); - ShapedRecipeBuilder.shaped(RecipeCategory.TOOLS, Items.RECOVERY_COMPASS) + .unlockedBy("has_amethyst_shard", this.has(Items.AMETHYST_SHARD)) + .save(this.output); + this.twoByTwoPacker(RecipeCategory.BUILDING_BLOCKS, Blocks.AMETHYST_BLOCK, Items.AMETHYST_SHARD); + this.shaped(RecipeCategory.TOOLS, Items.RECOVERY_COMPASS) .define('C', Items.COMPASS) .define('S', Items.ECHO_SHARD) .pattern("SSS") .pattern("SCS") .pattern("SSS") - .unlockedBy("has_echo_shard", has(Items.ECHO_SHARD)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.REDSTONE, Items.CALIBRATED_SCULK_SENSOR) + .unlockedBy("has_echo_shard", this.has(Items.ECHO_SHARD)) + .save(this.output); + this.shaped(RecipeCategory.REDSTONE, Items.CALIBRATED_SCULK_SENSOR) .define('#', Items.AMETHYST_SHARD) .define('X', Items.SCULK_SENSOR) .pattern(" # ") .pattern("#X#") - .unlockedBy("has_amethyst_shard", has(Items.AMETHYST_SHARD)) - .save(recipeOutput); - threeByThreePacker(recipeOutput, RecipeCategory.MISC, Items.MUSIC_DISC_5, Items.DISC_FRAGMENT_5); - SpecialRecipeBuilder.special(ArmorDyeRecipe::new).save(recipeOutput, "armor_dye"); - SpecialRecipeBuilder.special(BannerDuplicateRecipe::new).save(recipeOutput, "banner_duplicate"); - SpecialRecipeBuilder.special(BookCloningRecipe::new).save(recipeOutput, "book_cloning"); - SpecialRecipeBuilder.special(FireworkRocketRecipe::new).save(recipeOutput, "firework_rocket"); - SpecialRecipeBuilder.special(FireworkStarRecipe::new).save(recipeOutput, "firework_star"); - SpecialRecipeBuilder.special(FireworkStarFadeRecipe::new).save(recipeOutput, "firework_star_fade"); - SpecialRecipeBuilder.special(MapCloningRecipe::new).save(recipeOutput, "map_cloning"); - SpecialRecipeBuilder.special(MapExtendingRecipe::new).save(recipeOutput, "map_extending"); - SpecialRecipeBuilder.special(RepairItemRecipe::new).save(recipeOutput, "repair_item"); - SpecialRecipeBuilder.special(ShieldDecorationRecipe::new).save(recipeOutput, "shield_decoration"); - SpecialRecipeBuilder.special(ShulkerBoxColoring::new).save(recipeOutput, "shulker_box_coloring"); - SpecialRecipeBuilder.special(TippedArrowRecipe::new).save(recipeOutput, "tipped_arrow"); - SpecialRecipeBuilder.special(SuspiciousStewRecipe::new).save(recipeOutput, "suspicious_stew"); + .unlockedBy("has_amethyst_shard", this.has(Items.AMETHYST_SHARD)) + .save(this.output); + this.threeByThreePacker(RecipeCategory.MISC, Items.MUSIC_DISC_5, Items.DISC_FRAGMENT_5); + SpecialRecipeBuilder.special(ArmorDyeRecipe::new).save(this.output, "armor_dye"); + SpecialRecipeBuilder.special(BannerDuplicateRecipe::new).save(this.output, "banner_duplicate"); + SpecialRecipeBuilder.special(BookCloningRecipe::new).save(this.output, "book_cloning"); + SpecialRecipeBuilder.special(FireworkRocketRecipe::new).save(this.output, "firework_rocket"); + SpecialRecipeBuilder.special(FireworkStarRecipe::new).save(this.output, "firework_star"); + SpecialRecipeBuilder.special(FireworkStarFadeRecipe::new).save(this.output, "firework_star_fade"); + SpecialRecipeBuilder.special(MapCloningRecipe::new).save(this.output, "map_cloning"); + SpecialRecipeBuilder.special(MapExtendingRecipe::new).save(this.output, "map_extending"); + SpecialRecipeBuilder.special(RepairItemRecipe::new).save(this.output, "repair_item"); + SpecialRecipeBuilder.special(ShieldDecorationRecipe::new).save(this.output, "shield_decoration"); + SpecialRecipeBuilder.special(TippedArrowRecipe::new).save(this.output, "tipped_arrow"); SimpleCookingRecipeBuilder.smelting(Ingredient.of(Items.POTATO), RecipeCategory.FOOD, Items.BAKED_POTATO, 0.35F, 200) - .unlockedBy("has_potato", has(Items.POTATO)) - .save(recipeOutput); + .unlockedBy("has_potato", this.has(Items.POTATO)) + .save(this.output); SimpleCookingRecipeBuilder.smelting(Ingredient.of(Items.CLAY_BALL), RecipeCategory.MISC, Items.BRICK, 0.3F, 200) - .unlockedBy("has_clay_ball", has(Items.CLAY_BALL)) - .save(recipeOutput); - SimpleCookingRecipeBuilder.smelting(Ingredient.of(ItemTags.LOGS_THAT_BURN), RecipeCategory.MISC, Items.CHARCOAL, 0.15F, 200) - .unlockedBy("has_log", has(ItemTags.LOGS_THAT_BURN)) - .save(recipeOutput); + .unlockedBy("has_clay_ball", this.has(Items.CLAY_BALL)) + .save(this.output); + SimpleCookingRecipeBuilder.smelting(this.tag(ItemTags.LOGS_THAT_BURN), RecipeCategory.MISC, Items.CHARCOAL, 0.15F, 200) + .unlockedBy("has_log", this.has(ItemTags.LOGS_THAT_BURN)) + .save(this.output); SimpleCookingRecipeBuilder.smelting(Ingredient.of(Items.CHORUS_FRUIT), RecipeCategory.MISC, Items.POPPED_CHORUS_FRUIT, 0.1F, 200) - .unlockedBy("has_chorus_fruit", has(Items.CHORUS_FRUIT)) - .save(recipeOutput); + .unlockedBy("has_chorus_fruit", this.has(Items.CHORUS_FRUIT)) + .save(this.output); SimpleCookingRecipeBuilder.smelting(Ingredient.of(Items.BEEF), RecipeCategory.FOOD, Items.COOKED_BEEF, 0.35F, 200) - .unlockedBy("has_beef", has(Items.BEEF)) - .save(recipeOutput); + .unlockedBy("has_beef", this.has(Items.BEEF)) + .save(this.output); SimpleCookingRecipeBuilder.smelting(Ingredient.of(Items.CHICKEN), RecipeCategory.FOOD, Items.COOKED_CHICKEN, 0.35F, 200) - .unlockedBy("has_chicken", has(Items.CHICKEN)) - .save(recipeOutput); + .unlockedBy("has_chicken", this.has(Items.CHICKEN)) + .save(this.output); SimpleCookingRecipeBuilder.smelting(Ingredient.of(Items.COD), RecipeCategory.FOOD, Items.COOKED_COD, 0.35F, 200) - .unlockedBy("has_cod", has(Items.COD)) - .save(recipeOutput); + .unlockedBy("has_cod", this.has(Items.COD)) + .save(this.output); SimpleCookingRecipeBuilder.smelting(Ingredient.of(Blocks.KELP), RecipeCategory.FOOD, Items.DRIED_KELP, 0.1F, 200) - .unlockedBy("has_kelp", has(Blocks.KELP)) - .save(recipeOutput, getSmeltingRecipeName(Items.DRIED_KELP)); + .unlockedBy("has_kelp", this.has(Blocks.KELP)) + .save(this.output, getSmeltingRecipeName(Items.DRIED_KELP)); SimpleCookingRecipeBuilder.smelting(Ingredient.of(Items.SALMON), RecipeCategory.FOOD, Items.COOKED_SALMON, 0.35F, 200) - .unlockedBy("has_salmon", has(Items.SALMON)) - .save(recipeOutput); + .unlockedBy("has_salmon", this.has(Items.SALMON)) + .save(this.output); SimpleCookingRecipeBuilder.smelting(Ingredient.of(Items.MUTTON), RecipeCategory.FOOD, Items.COOKED_MUTTON, 0.35F, 200) - .unlockedBy("has_mutton", has(Items.MUTTON)) - .save(recipeOutput); + .unlockedBy("has_mutton", this.has(Items.MUTTON)) + .save(this.output); SimpleCookingRecipeBuilder.smelting(Ingredient.of(Items.PORKCHOP), RecipeCategory.FOOD, Items.COOKED_PORKCHOP, 0.35F, 200) - .unlockedBy("has_porkchop", has(Items.PORKCHOP)) - .save(recipeOutput); + .unlockedBy("has_porkchop", this.has(Items.PORKCHOP)) + .save(this.output); SimpleCookingRecipeBuilder.smelting(Ingredient.of(Items.RABBIT), RecipeCategory.FOOD, Items.COOKED_RABBIT, 0.35F, 200) - .unlockedBy("has_rabbit", has(Items.RABBIT)) - .save(recipeOutput); - oreSmelting(recipeOutput, COAL_SMELTABLES, RecipeCategory.MISC, Items.COAL, 0.1F, 200, "coal"); - oreSmelting(recipeOutput, IRON_SMELTABLES, RecipeCategory.MISC, Items.IRON_INGOT, 0.7F, 200, "iron_ingot"); - oreSmelting(recipeOutput, COPPER_SMELTABLES, RecipeCategory.MISC, Items.COPPER_INGOT, 0.7F, 200, "copper_ingot"); - oreSmelting(recipeOutput, GOLD_SMELTABLES, RecipeCategory.MISC, Items.GOLD_INGOT, 1.0F, 200, "gold_ingot"); - oreSmelting(recipeOutput, DIAMOND_SMELTABLES, RecipeCategory.MISC, Items.DIAMOND, 1.0F, 200, "diamond"); - oreSmelting(recipeOutput, LAPIS_SMELTABLES, RecipeCategory.MISC, Items.LAPIS_LAZULI, 0.2F, 200, "lapis_lazuli"); - oreSmelting(recipeOutput, REDSTONE_SMELTABLES, RecipeCategory.REDSTONE, Items.REDSTONE, 0.7F, 200, "redstone"); - oreSmelting(recipeOutput, EMERALD_SMELTABLES, RecipeCategory.MISC, Items.EMERALD, 1.0F, 200, "emerald"); - nineBlockStorageRecipes(recipeOutput, RecipeCategory.MISC, Items.RAW_IRON, RecipeCategory.BUILDING_BLOCKS, Items.RAW_IRON_BLOCK); - nineBlockStorageRecipes(recipeOutput, RecipeCategory.MISC, Items.RAW_COPPER, RecipeCategory.BUILDING_BLOCKS, Items.RAW_COPPER_BLOCK); - nineBlockStorageRecipes(recipeOutput, RecipeCategory.MISC, Items.RAW_GOLD, RecipeCategory.BUILDING_BLOCKS, Items.RAW_GOLD_BLOCK); - SimpleCookingRecipeBuilder.smelting(Ingredient.of(ItemTags.SMELTS_TO_GLASS), RecipeCategory.BUILDING_BLOCKS, Blocks.GLASS.asItem(), 0.1F, 200) - .unlockedBy("has_smelts_to_glass", has(ItemTags.SMELTS_TO_GLASS)) - .save(recipeOutput); + .unlockedBy("has_rabbit", this.has(Items.RABBIT)) + .save(this.output); + this.oreSmelting(COAL_SMELTABLES, RecipeCategory.MISC, Items.COAL, 0.1F, 200, "coal"); + this.oreSmelting(IRON_SMELTABLES, RecipeCategory.MISC, Items.IRON_INGOT, 0.7F, 200, "iron_ingot"); + this.oreSmelting(COPPER_SMELTABLES, RecipeCategory.MISC, Items.COPPER_INGOT, 0.7F, 200, "copper_ingot"); + this.oreSmelting(GOLD_SMELTABLES, RecipeCategory.MISC, Items.GOLD_INGOT, 1.0F, 200, "gold_ingot"); + this.oreSmelting(DIAMOND_SMELTABLES, RecipeCategory.MISC, Items.DIAMOND, 1.0F, 200, "diamond"); + this.oreSmelting(LAPIS_SMELTABLES, RecipeCategory.MISC, Items.LAPIS_LAZULI, 0.2F, 200, "lapis_lazuli"); + this.oreSmelting(REDSTONE_SMELTABLES, RecipeCategory.REDSTONE, Items.REDSTONE, 0.7F, 200, "redstone"); + this.oreSmelting(EMERALD_SMELTABLES, RecipeCategory.MISC, Items.EMERALD, 1.0F, 200, "emerald"); + this.nineBlockStorageRecipes(RecipeCategory.MISC, Items.RAW_IRON, RecipeCategory.BUILDING_BLOCKS, Items.RAW_IRON_BLOCK); + this.nineBlockStorageRecipes(RecipeCategory.MISC, Items.RAW_COPPER, RecipeCategory.BUILDING_BLOCKS, Items.RAW_COPPER_BLOCK); + this.nineBlockStorageRecipes(RecipeCategory.MISC, Items.RAW_GOLD, RecipeCategory.BUILDING_BLOCKS, Items.RAW_GOLD_BLOCK); + SimpleCookingRecipeBuilder.smelting(this.tag(ItemTags.SMELTS_TO_GLASS), RecipeCategory.BUILDING_BLOCKS, Blocks.GLASS.asItem(), 0.1F, 200) + .unlockedBy("has_smelts_to_glass", this.has(ItemTags.SMELTS_TO_GLASS)) + .save(this.output); SimpleCookingRecipeBuilder.smelting(Ingredient.of(Blocks.SEA_PICKLE), RecipeCategory.MISC, Items.LIME_DYE, 0.1F, 200) - .unlockedBy("has_sea_pickle", has(Blocks.SEA_PICKLE)) - .save(recipeOutput, getSmeltingRecipeName(Items.LIME_DYE)); + .unlockedBy("has_sea_pickle", this.has(Blocks.SEA_PICKLE)) + .save(this.output, getSmeltingRecipeName(Items.LIME_DYE)); SimpleCookingRecipeBuilder.smelting(Ingredient.of(Blocks.CACTUS.asItem()), RecipeCategory.MISC, Items.GREEN_DYE, 1.0F, 200) - .unlockedBy("has_cactus", has(Blocks.CACTUS)) - .save(recipeOutput); + .unlockedBy("has_cactus", this.has(Blocks.CACTUS)) + .save(this.output); SimpleCookingRecipeBuilder.smelting( Ingredient.of( Items.GOLDEN_PICKAXE, @@ -2117,17 +2093,17 @@ public class VanillaRecipeProvider extends RecipeProvider { 0.1F, 200 ) - .unlockedBy("has_golden_pickaxe", has(Items.GOLDEN_PICKAXE)) - .unlockedBy("has_golden_shovel", has(Items.GOLDEN_SHOVEL)) - .unlockedBy("has_golden_axe", has(Items.GOLDEN_AXE)) - .unlockedBy("has_golden_hoe", has(Items.GOLDEN_HOE)) - .unlockedBy("has_golden_sword", has(Items.GOLDEN_SWORD)) - .unlockedBy("has_golden_helmet", has(Items.GOLDEN_HELMET)) - .unlockedBy("has_golden_chestplate", has(Items.GOLDEN_CHESTPLATE)) - .unlockedBy("has_golden_leggings", has(Items.GOLDEN_LEGGINGS)) - .unlockedBy("has_golden_boots", has(Items.GOLDEN_BOOTS)) - .unlockedBy("has_golden_horse_armor", has(Items.GOLDEN_HORSE_ARMOR)) - .save(recipeOutput, getSmeltingRecipeName(Items.GOLD_NUGGET)); + .unlockedBy("has_golden_pickaxe", this.has(Items.GOLDEN_PICKAXE)) + .unlockedBy("has_golden_shovel", this.has(Items.GOLDEN_SHOVEL)) + .unlockedBy("has_golden_axe", this.has(Items.GOLDEN_AXE)) + .unlockedBy("has_golden_hoe", this.has(Items.GOLDEN_HOE)) + .unlockedBy("has_golden_sword", this.has(Items.GOLDEN_SWORD)) + .unlockedBy("has_golden_helmet", this.has(Items.GOLDEN_HELMET)) + .unlockedBy("has_golden_chestplate", this.has(Items.GOLDEN_CHESTPLATE)) + .unlockedBy("has_golden_leggings", this.has(Items.GOLDEN_LEGGINGS)) + .unlockedBy("has_golden_boots", this.has(Items.GOLDEN_BOOTS)) + .unlockedBy("has_golden_horse_armor", this.has(Items.GOLDEN_HORSE_ARMOR)) + .save(this.output, getSmeltingRecipeName(Items.GOLD_NUGGET)); SimpleCookingRecipeBuilder.smelting( Ingredient.of( Items.IRON_PICKAXE, @@ -2150,125 +2126,125 @@ public class VanillaRecipeProvider extends RecipeProvider { 0.1F, 200 ) - .unlockedBy("has_iron_pickaxe", has(Items.IRON_PICKAXE)) - .unlockedBy("has_iron_shovel", has(Items.IRON_SHOVEL)) - .unlockedBy("has_iron_axe", has(Items.IRON_AXE)) - .unlockedBy("has_iron_hoe", has(Items.IRON_HOE)) - .unlockedBy("has_iron_sword", has(Items.IRON_SWORD)) - .unlockedBy("has_iron_helmet", has(Items.IRON_HELMET)) - .unlockedBy("has_iron_chestplate", has(Items.IRON_CHESTPLATE)) - .unlockedBy("has_iron_leggings", has(Items.IRON_LEGGINGS)) - .unlockedBy("has_iron_boots", has(Items.IRON_BOOTS)) - .unlockedBy("has_iron_horse_armor", has(Items.IRON_HORSE_ARMOR)) - .unlockedBy("has_chainmail_helmet", has(Items.CHAINMAIL_HELMET)) - .unlockedBy("has_chainmail_chestplate", has(Items.CHAINMAIL_CHESTPLATE)) - .unlockedBy("has_chainmail_leggings", has(Items.CHAINMAIL_LEGGINGS)) - .unlockedBy("has_chainmail_boots", has(Items.CHAINMAIL_BOOTS)) - .save(recipeOutput, getSmeltingRecipeName(Items.IRON_NUGGET)); + .unlockedBy("has_iron_pickaxe", this.has(Items.IRON_PICKAXE)) + .unlockedBy("has_iron_shovel", this.has(Items.IRON_SHOVEL)) + .unlockedBy("has_iron_axe", this.has(Items.IRON_AXE)) + .unlockedBy("has_iron_hoe", this.has(Items.IRON_HOE)) + .unlockedBy("has_iron_sword", this.has(Items.IRON_SWORD)) + .unlockedBy("has_iron_helmet", this.has(Items.IRON_HELMET)) + .unlockedBy("has_iron_chestplate", this.has(Items.IRON_CHESTPLATE)) + .unlockedBy("has_iron_leggings", this.has(Items.IRON_LEGGINGS)) + .unlockedBy("has_iron_boots", this.has(Items.IRON_BOOTS)) + .unlockedBy("has_iron_horse_armor", this.has(Items.IRON_HORSE_ARMOR)) + .unlockedBy("has_chainmail_helmet", this.has(Items.CHAINMAIL_HELMET)) + .unlockedBy("has_chainmail_chestplate", this.has(Items.CHAINMAIL_CHESTPLATE)) + .unlockedBy("has_chainmail_leggings", this.has(Items.CHAINMAIL_LEGGINGS)) + .unlockedBy("has_chainmail_boots", this.has(Items.CHAINMAIL_BOOTS)) + .save(this.output, getSmeltingRecipeName(Items.IRON_NUGGET)); SimpleCookingRecipeBuilder.smelting(Ingredient.of(Blocks.CLAY), RecipeCategory.BUILDING_BLOCKS, Blocks.TERRACOTTA.asItem(), 0.35F, 200) - .unlockedBy("has_clay_block", has(Blocks.CLAY)) - .save(recipeOutput); + .unlockedBy("has_clay_block", this.has(Blocks.CLAY)) + .save(this.output); SimpleCookingRecipeBuilder.smelting(Ingredient.of(Blocks.NETHERRACK), RecipeCategory.MISC, Items.NETHER_BRICK, 0.1F, 200) - .unlockedBy("has_netherrack", has(Blocks.NETHERRACK)) - .save(recipeOutput); + .unlockedBy("has_netherrack", this.has(Blocks.NETHERRACK)) + .save(this.output); SimpleCookingRecipeBuilder.smelting(Ingredient.of(Blocks.NETHER_QUARTZ_ORE), RecipeCategory.MISC, Items.QUARTZ, 0.2F, 200) - .unlockedBy("has_nether_quartz_ore", has(Blocks.NETHER_QUARTZ_ORE)) - .save(recipeOutput); + .unlockedBy("has_nether_quartz_ore", this.has(Blocks.NETHER_QUARTZ_ORE)) + .save(this.output); SimpleCookingRecipeBuilder.smelting(Ingredient.of(Blocks.WET_SPONGE), RecipeCategory.BUILDING_BLOCKS, Blocks.SPONGE.asItem(), 0.15F, 200) - .unlockedBy("has_wet_sponge", has(Blocks.WET_SPONGE)) - .save(recipeOutput); + .unlockedBy("has_wet_sponge", this.has(Blocks.WET_SPONGE)) + .save(this.output); SimpleCookingRecipeBuilder.smelting(Ingredient.of(Blocks.COBBLESTONE), RecipeCategory.BUILDING_BLOCKS, Blocks.STONE.asItem(), 0.1F, 200) - .unlockedBy("has_cobblestone", has(Blocks.COBBLESTONE)) - .save(recipeOutput); + .unlockedBy("has_cobblestone", this.has(Blocks.COBBLESTONE)) + .save(this.output); SimpleCookingRecipeBuilder.smelting(Ingredient.of(Blocks.STONE), RecipeCategory.BUILDING_BLOCKS, Blocks.SMOOTH_STONE.asItem(), 0.1F, 200) - .unlockedBy("has_stone", has(Blocks.STONE)) - .save(recipeOutput); + .unlockedBy("has_stone", this.has(Blocks.STONE)) + .save(this.output); SimpleCookingRecipeBuilder.smelting(Ingredient.of(Blocks.SANDSTONE), RecipeCategory.BUILDING_BLOCKS, Blocks.SMOOTH_SANDSTONE.asItem(), 0.1F, 200) - .unlockedBy("has_sandstone", has(Blocks.SANDSTONE)) - .save(recipeOutput); + .unlockedBy("has_sandstone", this.has(Blocks.SANDSTONE)) + .save(this.output); SimpleCookingRecipeBuilder.smelting(Ingredient.of(Blocks.RED_SANDSTONE), RecipeCategory.BUILDING_BLOCKS, Blocks.SMOOTH_RED_SANDSTONE.asItem(), 0.1F, 200) - .unlockedBy("has_red_sandstone", has(Blocks.RED_SANDSTONE)) - .save(recipeOutput); + .unlockedBy("has_red_sandstone", this.has(Blocks.RED_SANDSTONE)) + .save(this.output); SimpleCookingRecipeBuilder.smelting(Ingredient.of(Blocks.QUARTZ_BLOCK), RecipeCategory.BUILDING_BLOCKS, Blocks.SMOOTH_QUARTZ.asItem(), 0.1F, 200) - .unlockedBy("has_quartz_block", has(Blocks.QUARTZ_BLOCK)) - .save(recipeOutput); + .unlockedBy("has_quartz_block", this.has(Blocks.QUARTZ_BLOCK)) + .save(this.output); SimpleCookingRecipeBuilder.smelting(Ingredient.of(Blocks.STONE_BRICKS), RecipeCategory.BUILDING_BLOCKS, Blocks.CRACKED_STONE_BRICKS.asItem(), 0.1F, 200) - .unlockedBy("has_stone_bricks", has(Blocks.STONE_BRICKS)) - .save(recipeOutput); + .unlockedBy("has_stone_bricks", this.has(Blocks.STONE_BRICKS)) + .save(this.output); SimpleCookingRecipeBuilder.smelting(Ingredient.of(Blocks.BLACK_TERRACOTTA), RecipeCategory.DECORATIONS, Blocks.BLACK_GLAZED_TERRACOTTA.asItem(), 0.1F, 200) - .unlockedBy("has_black_terracotta", has(Blocks.BLACK_TERRACOTTA)) - .save(recipeOutput); + .unlockedBy("has_black_terracotta", this.has(Blocks.BLACK_TERRACOTTA)) + .save(this.output); SimpleCookingRecipeBuilder.smelting(Ingredient.of(Blocks.BLUE_TERRACOTTA), RecipeCategory.DECORATIONS, Blocks.BLUE_GLAZED_TERRACOTTA.asItem(), 0.1F, 200) - .unlockedBy("has_blue_terracotta", has(Blocks.BLUE_TERRACOTTA)) - .save(recipeOutput); + .unlockedBy("has_blue_terracotta", this.has(Blocks.BLUE_TERRACOTTA)) + .save(this.output); SimpleCookingRecipeBuilder.smelting(Ingredient.of(Blocks.BROWN_TERRACOTTA), RecipeCategory.DECORATIONS, Blocks.BROWN_GLAZED_TERRACOTTA.asItem(), 0.1F, 200) - .unlockedBy("has_brown_terracotta", has(Blocks.BROWN_TERRACOTTA)) - .save(recipeOutput); + .unlockedBy("has_brown_terracotta", this.has(Blocks.BROWN_TERRACOTTA)) + .save(this.output); SimpleCookingRecipeBuilder.smelting(Ingredient.of(Blocks.CYAN_TERRACOTTA), RecipeCategory.DECORATIONS, Blocks.CYAN_GLAZED_TERRACOTTA.asItem(), 0.1F, 200) - .unlockedBy("has_cyan_terracotta", has(Blocks.CYAN_TERRACOTTA)) - .save(recipeOutput); + .unlockedBy("has_cyan_terracotta", this.has(Blocks.CYAN_TERRACOTTA)) + .save(this.output); SimpleCookingRecipeBuilder.smelting(Ingredient.of(Blocks.GRAY_TERRACOTTA), RecipeCategory.DECORATIONS, Blocks.GRAY_GLAZED_TERRACOTTA.asItem(), 0.1F, 200) - .unlockedBy("has_gray_terracotta", has(Blocks.GRAY_TERRACOTTA)) - .save(recipeOutput); + .unlockedBy("has_gray_terracotta", this.has(Blocks.GRAY_TERRACOTTA)) + .save(this.output); SimpleCookingRecipeBuilder.smelting(Ingredient.of(Blocks.GREEN_TERRACOTTA), RecipeCategory.DECORATIONS, Blocks.GREEN_GLAZED_TERRACOTTA.asItem(), 0.1F, 200) - .unlockedBy("has_green_terracotta", has(Blocks.GREEN_TERRACOTTA)) - .save(recipeOutput); + .unlockedBy("has_green_terracotta", this.has(Blocks.GREEN_TERRACOTTA)) + .save(this.output); SimpleCookingRecipeBuilder.smelting( Ingredient.of(Blocks.LIGHT_BLUE_TERRACOTTA), RecipeCategory.DECORATIONS, Blocks.LIGHT_BLUE_GLAZED_TERRACOTTA.asItem(), 0.1F, 200 ) - .unlockedBy("has_light_blue_terracotta", has(Blocks.LIGHT_BLUE_TERRACOTTA)) - .save(recipeOutput); + .unlockedBy("has_light_blue_terracotta", this.has(Blocks.LIGHT_BLUE_TERRACOTTA)) + .save(this.output); SimpleCookingRecipeBuilder.smelting( Ingredient.of(Blocks.LIGHT_GRAY_TERRACOTTA), RecipeCategory.DECORATIONS, Blocks.LIGHT_GRAY_GLAZED_TERRACOTTA.asItem(), 0.1F, 200 ) - .unlockedBy("has_light_gray_terracotta", has(Blocks.LIGHT_GRAY_TERRACOTTA)) - .save(recipeOutput); + .unlockedBy("has_light_gray_terracotta", this.has(Blocks.LIGHT_GRAY_TERRACOTTA)) + .save(this.output); SimpleCookingRecipeBuilder.smelting(Ingredient.of(Blocks.LIME_TERRACOTTA), RecipeCategory.DECORATIONS, Blocks.LIME_GLAZED_TERRACOTTA.asItem(), 0.1F, 200) - .unlockedBy("has_lime_terracotta", has(Blocks.LIME_TERRACOTTA)) - .save(recipeOutput); + .unlockedBy("has_lime_terracotta", this.has(Blocks.LIME_TERRACOTTA)) + .save(this.output); SimpleCookingRecipeBuilder.smelting( Ingredient.of(Blocks.MAGENTA_TERRACOTTA), RecipeCategory.DECORATIONS, Blocks.MAGENTA_GLAZED_TERRACOTTA.asItem(), 0.1F, 200 ) - .unlockedBy("has_magenta_terracotta", has(Blocks.MAGENTA_TERRACOTTA)) - .save(recipeOutput); + .unlockedBy("has_magenta_terracotta", this.has(Blocks.MAGENTA_TERRACOTTA)) + .save(this.output); SimpleCookingRecipeBuilder.smelting(Ingredient.of(Blocks.ORANGE_TERRACOTTA), RecipeCategory.DECORATIONS, Blocks.ORANGE_GLAZED_TERRACOTTA.asItem(), 0.1F, 200) - .unlockedBy("has_orange_terracotta", has(Blocks.ORANGE_TERRACOTTA)) - .save(recipeOutput); + .unlockedBy("has_orange_terracotta", this.has(Blocks.ORANGE_TERRACOTTA)) + .save(this.output); SimpleCookingRecipeBuilder.smelting(Ingredient.of(Blocks.PINK_TERRACOTTA), RecipeCategory.DECORATIONS, Blocks.PINK_GLAZED_TERRACOTTA.asItem(), 0.1F, 200) - .unlockedBy("has_pink_terracotta", has(Blocks.PINK_TERRACOTTA)) - .save(recipeOutput); + .unlockedBy("has_pink_terracotta", this.has(Blocks.PINK_TERRACOTTA)) + .save(this.output); SimpleCookingRecipeBuilder.smelting(Ingredient.of(Blocks.PURPLE_TERRACOTTA), RecipeCategory.DECORATIONS, Blocks.PURPLE_GLAZED_TERRACOTTA.asItem(), 0.1F, 200) - .unlockedBy("has_purple_terracotta", has(Blocks.PURPLE_TERRACOTTA)) - .save(recipeOutput); + .unlockedBy("has_purple_terracotta", this.has(Blocks.PURPLE_TERRACOTTA)) + .save(this.output); SimpleCookingRecipeBuilder.smelting(Ingredient.of(Blocks.RED_TERRACOTTA), RecipeCategory.DECORATIONS, Blocks.RED_GLAZED_TERRACOTTA.asItem(), 0.1F, 200) - .unlockedBy("has_red_terracotta", has(Blocks.RED_TERRACOTTA)) - .save(recipeOutput); + .unlockedBy("has_red_terracotta", this.has(Blocks.RED_TERRACOTTA)) + .save(this.output); SimpleCookingRecipeBuilder.smelting(Ingredient.of(Blocks.WHITE_TERRACOTTA), RecipeCategory.DECORATIONS, Blocks.WHITE_GLAZED_TERRACOTTA.asItem(), 0.1F, 200) - .unlockedBy("has_white_terracotta", has(Blocks.WHITE_TERRACOTTA)) - .save(recipeOutput); + .unlockedBy("has_white_terracotta", this.has(Blocks.WHITE_TERRACOTTA)) + .save(this.output); SimpleCookingRecipeBuilder.smelting(Ingredient.of(Blocks.YELLOW_TERRACOTTA), RecipeCategory.DECORATIONS, Blocks.YELLOW_GLAZED_TERRACOTTA.asItem(), 0.1F, 200) - .unlockedBy("has_yellow_terracotta", has(Blocks.YELLOW_TERRACOTTA)) - .save(recipeOutput); + .unlockedBy("has_yellow_terracotta", this.has(Blocks.YELLOW_TERRACOTTA)) + .save(this.output); SimpleCookingRecipeBuilder.smelting(Ingredient.of(Blocks.ANCIENT_DEBRIS), RecipeCategory.MISC, Items.NETHERITE_SCRAP, 2.0F, 200) - .unlockedBy("has_ancient_debris", has(Blocks.ANCIENT_DEBRIS)) - .save(recipeOutput); + .unlockedBy("has_ancient_debris", this.has(Blocks.ANCIENT_DEBRIS)) + .save(this.output); SimpleCookingRecipeBuilder.smelting(Ingredient.of(Blocks.BASALT), RecipeCategory.BUILDING_BLOCKS, Blocks.SMOOTH_BASALT, 0.1F, 200) - .unlockedBy("has_basalt", has(Blocks.BASALT)) - .save(recipeOutput); + .unlockedBy("has_basalt", this.has(Blocks.BASALT)) + .save(this.output); SimpleCookingRecipeBuilder.smelting(Ingredient.of(Blocks.COBBLED_DEEPSLATE), RecipeCategory.BUILDING_BLOCKS, Blocks.DEEPSLATE, 0.1F, 200) - .unlockedBy("has_cobbled_deepslate", has(Blocks.COBBLED_DEEPSLATE)) - .save(recipeOutput); - oreBlasting(recipeOutput, COAL_SMELTABLES, RecipeCategory.MISC, Items.COAL, 0.1F, 100, "coal"); - oreBlasting(recipeOutput, IRON_SMELTABLES, RecipeCategory.MISC, Items.IRON_INGOT, 0.7F, 100, "iron_ingot"); - oreBlasting(recipeOutput, COPPER_SMELTABLES, RecipeCategory.MISC, Items.COPPER_INGOT, 0.7F, 100, "copper_ingot"); - oreBlasting(recipeOutput, GOLD_SMELTABLES, RecipeCategory.MISC, Items.GOLD_INGOT, 1.0F, 100, "gold_ingot"); - oreBlasting(recipeOutput, DIAMOND_SMELTABLES, RecipeCategory.MISC, Items.DIAMOND, 1.0F, 100, "diamond"); - oreBlasting(recipeOutput, LAPIS_SMELTABLES, RecipeCategory.MISC, Items.LAPIS_LAZULI, 0.2F, 100, "lapis_lazuli"); - oreBlasting(recipeOutput, REDSTONE_SMELTABLES, RecipeCategory.REDSTONE, Items.REDSTONE, 0.7F, 100, "redstone"); - oreBlasting(recipeOutput, EMERALD_SMELTABLES, RecipeCategory.MISC, Items.EMERALD, 1.0F, 100, "emerald"); + .unlockedBy("has_cobbled_deepslate", this.has(Blocks.COBBLED_DEEPSLATE)) + .save(this.output); + this.oreBlasting(COAL_SMELTABLES, RecipeCategory.MISC, Items.COAL, 0.1F, 100, "coal"); + this.oreBlasting(IRON_SMELTABLES, RecipeCategory.MISC, Items.IRON_INGOT, 0.7F, 100, "iron_ingot"); + this.oreBlasting(COPPER_SMELTABLES, RecipeCategory.MISC, Items.COPPER_INGOT, 0.7F, 100, "copper_ingot"); + this.oreBlasting(GOLD_SMELTABLES, RecipeCategory.MISC, Items.GOLD_INGOT, 1.0F, 100, "gold_ingot"); + this.oreBlasting(DIAMOND_SMELTABLES, RecipeCategory.MISC, Items.DIAMOND, 1.0F, 100, "diamond"); + this.oreBlasting(LAPIS_SMELTABLES, RecipeCategory.MISC, Items.LAPIS_LAZULI, 0.2F, 100, "lapis_lazuli"); + this.oreBlasting(REDSTONE_SMELTABLES, RecipeCategory.REDSTONE, Items.REDSTONE, 0.7F, 100, "redstone"); + this.oreBlasting(EMERALD_SMELTABLES, RecipeCategory.MISC, Items.EMERALD, 1.0F, 100, "emerald"); SimpleCookingRecipeBuilder.blasting(Ingredient.of(Blocks.NETHER_QUARTZ_ORE), RecipeCategory.MISC, Items.QUARTZ, 0.2F, 100) - .unlockedBy("has_nether_quartz_ore", has(Blocks.NETHER_QUARTZ_ORE)) - .save(recipeOutput, getBlastingRecipeName(Items.QUARTZ)); + .unlockedBy("has_nether_quartz_ore", this.has(Blocks.NETHER_QUARTZ_ORE)) + .save(this.output, getBlastingRecipeName(Items.QUARTZ)); SimpleCookingRecipeBuilder.blasting( Ingredient.of( Items.GOLDEN_PICKAXE, @@ -2287,17 +2263,17 @@ public class VanillaRecipeProvider extends RecipeProvider { 0.1F, 100 ) - .unlockedBy("has_golden_pickaxe", has(Items.GOLDEN_PICKAXE)) - .unlockedBy("has_golden_shovel", has(Items.GOLDEN_SHOVEL)) - .unlockedBy("has_golden_axe", has(Items.GOLDEN_AXE)) - .unlockedBy("has_golden_hoe", has(Items.GOLDEN_HOE)) - .unlockedBy("has_golden_sword", has(Items.GOLDEN_SWORD)) - .unlockedBy("has_golden_helmet", has(Items.GOLDEN_HELMET)) - .unlockedBy("has_golden_chestplate", has(Items.GOLDEN_CHESTPLATE)) - .unlockedBy("has_golden_leggings", has(Items.GOLDEN_LEGGINGS)) - .unlockedBy("has_golden_boots", has(Items.GOLDEN_BOOTS)) - .unlockedBy("has_golden_horse_armor", has(Items.GOLDEN_HORSE_ARMOR)) - .save(recipeOutput, getBlastingRecipeName(Items.GOLD_NUGGET)); + .unlockedBy("has_golden_pickaxe", this.has(Items.GOLDEN_PICKAXE)) + .unlockedBy("has_golden_shovel", this.has(Items.GOLDEN_SHOVEL)) + .unlockedBy("has_golden_axe", this.has(Items.GOLDEN_AXE)) + .unlockedBy("has_golden_hoe", this.has(Items.GOLDEN_HOE)) + .unlockedBy("has_golden_sword", this.has(Items.GOLDEN_SWORD)) + .unlockedBy("has_golden_helmet", this.has(Items.GOLDEN_HELMET)) + .unlockedBy("has_golden_chestplate", this.has(Items.GOLDEN_CHESTPLATE)) + .unlockedBy("has_golden_leggings", this.has(Items.GOLDEN_LEGGINGS)) + .unlockedBy("has_golden_boots", this.has(Items.GOLDEN_BOOTS)) + .unlockedBy("has_golden_horse_armor", this.has(Items.GOLDEN_HORSE_ARMOR)) + .save(this.output, getBlastingRecipeName(Items.GOLD_NUGGET)); SimpleCookingRecipeBuilder.blasting( Ingredient.of( Items.IRON_PICKAXE, @@ -2320,330 +2296,330 @@ public class VanillaRecipeProvider extends RecipeProvider { 0.1F, 100 ) - .unlockedBy("has_iron_pickaxe", has(Items.IRON_PICKAXE)) - .unlockedBy("has_iron_shovel", has(Items.IRON_SHOVEL)) - .unlockedBy("has_iron_axe", has(Items.IRON_AXE)) - .unlockedBy("has_iron_hoe", has(Items.IRON_HOE)) - .unlockedBy("has_iron_sword", has(Items.IRON_SWORD)) - .unlockedBy("has_iron_helmet", has(Items.IRON_HELMET)) - .unlockedBy("has_iron_chestplate", has(Items.IRON_CHESTPLATE)) - .unlockedBy("has_iron_leggings", has(Items.IRON_LEGGINGS)) - .unlockedBy("has_iron_boots", has(Items.IRON_BOOTS)) - .unlockedBy("has_iron_horse_armor", has(Items.IRON_HORSE_ARMOR)) - .unlockedBy("has_chainmail_helmet", has(Items.CHAINMAIL_HELMET)) - .unlockedBy("has_chainmail_chestplate", has(Items.CHAINMAIL_CHESTPLATE)) - .unlockedBy("has_chainmail_leggings", has(Items.CHAINMAIL_LEGGINGS)) - .unlockedBy("has_chainmail_boots", has(Items.CHAINMAIL_BOOTS)) - .save(recipeOutput, getBlastingRecipeName(Items.IRON_NUGGET)); + .unlockedBy("has_iron_pickaxe", this.has(Items.IRON_PICKAXE)) + .unlockedBy("has_iron_shovel", this.has(Items.IRON_SHOVEL)) + .unlockedBy("has_iron_axe", this.has(Items.IRON_AXE)) + .unlockedBy("has_iron_hoe", this.has(Items.IRON_HOE)) + .unlockedBy("has_iron_sword", this.has(Items.IRON_SWORD)) + .unlockedBy("has_iron_helmet", this.has(Items.IRON_HELMET)) + .unlockedBy("has_iron_chestplate", this.has(Items.IRON_CHESTPLATE)) + .unlockedBy("has_iron_leggings", this.has(Items.IRON_LEGGINGS)) + .unlockedBy("has_iron_boots", this.has(Items.IRON_BOOTS)) + .unlockedBy("has_iron_horse_armor", this.has(Items.IRON_HORSE_ARMOR)) + .unlockedBy("has_chainmail_helmet", this.has(Items.CHAINMAIL_HELMET)) + .unlockedBy("has_chainmail_chestplate", this.has(Items.CHAINMAIL_CHESTPLATE)) + .unlockedBy("has_chainmail_leggings", this.has(Items.CHAINMAIL_LEGGINGS)) + .unlockedBy("has_chainmail_boots", this.has(Items.CHAINMAIL_BOOTS)) + .save(this.output, getBlastingRecipeName(Items.IRON_NUGGET)); SimpleCookingRecipeBuilder.blasting(Ingredient.of(Blocks.ANCIENT_DEBRIS), RecipeCategory.MISC, Items.NETHERITE_SCRAP, 2.0F, 100) - .unlockedBy("has_ancient_debris", has(Blocks.ANCIENT_DEBRIS)) - .save(recipeOutput, getBlastingRecipeName(Items.NETHERITE_SCRAP)); - cookRecipes(recipeOutput, "smoking", RecipeSerializer.SMOKING_RECIPE, SmokingRecipe::new, 100); - cookRecipes(recipeOutput, "campfire_cooking", RecipeSerializer.CAMPFIRE_COOKING_RECIPE, CampfireCookingRecipe::new, 600); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.STONE_SLAB, Blocks.STONE, 2); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.STONE_STAIRS, Blocks.STONE); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.STONE_BRICKS, Blocks.STONE); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.STONE_BRICK_SLAB, Blocks.STONE, 2); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.STONE_BRICK_STAIRS, Blocks.STONE); + .unlockedBy("has_ancient_debris", this.has(Blocks.ANCIENT_DEBRIS)) + .save(this.output, getBlastingRecipeName(Items.NETHERITE_SCRAP)); + this.cookRecipes("smoking", RecipeSerializer.SMOKING_RECIPE, SmokingRecipe::new, 100); + this.cookRecipes("campfire_cooking", RecipeSerializer.CAMPFIRE_COOKING_RECIPE, CampfireCookingRecipe::new, 600); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.STONE_SLAB, Blocks.STONE, 2); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.STONE_STAIRS, Blocks.STONE); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.STONE_BRICKS, Blocks.STONE); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.STONE_BRICK_SLAB, Blocks.STONE, 2); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.STONE_BRICK_STAIRS, Blocks.STONE); SingleItemRecipeBuilder.stonecutting(Ingredient.of(Blocks.STONE), RecipeCategory.BUILDING_BLOCKS, Blocks.CHISELED_STONE_BRICKS) - .unlockedBy("has_stone", has(Blocks.STONE)) - .save(recipeOutput, "chiseled_stone_bricks_stone_from_stonecutting"); + .unlockedBy("has_stone", this.has(Blocks.STONE)) + .save(this.output, "chiseled_stone_bricks_stone_from_stonecutting"); SingleItemRecipeBuilder.stonecutting(Ingredient.of(Blocks.STONE), RecipeCategory.DECORATIONS, Blocks.STONE_BRICK_WALL) - .unlockedBy("has_stone", has(Blocks.STONE)) - .save(recipeOutput, "stone_brick_walls_from_stone_stonecutting"); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.CUT_SANDSTONE, Blocks.SANDSTONE); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.SANDSTONE_SLAB, Blocks.SANDSTONE, 2); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.CUT_SANDSTONE_SLAB, Blocks.SANDSTONE, 2); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.CUT_SANDSTONE_SLAB, Blocks.CUT_SANDSTONE, 2); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.SANDSTONE_STAIRS, Blocks.SANDSTONE); - stonecutterResultFromBase(recipeOutput, RecipeCategory.DECORATIONS, Blocks.SANDSTONE_WALL, Blocks.SANDSTONE); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.CHISELED_SANDSTONE, Blocks.SANDSTONE); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.CUT_RED_SANDSTONE, Blocks.RED_SANDSTONE); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.RED_SANDSTONE_SLAB, Blocks.RED_SANDSTONE, 2); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.CUT_RED_SANDSTONE_SLAB, Blocks.RED_SANDSTONE, 2); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.CUT_RED_SANDSTONE_SLAB, Blocks.CUT_RED_SANDSTONE, 2); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.RED_SANDSTONE_STAIRS, Blocks.RED_SANDSTONE); - stonecutterResultFromBase(recipeOutput, RecipeCategory.DECORATIONS, Blocks.RED_SANDSTONE_WALL, Blocks.RED_SANDSTONE); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.CHISELED_RED_SANDSTONE, Blocks.RED_SANDSTONE); + .unlockedBy("has_stone", this.has(Blocks.STONE)) + .save(this.output, "stone_brick_walls_from_stone_stonecutting"); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.CUT_SANDSTONE, Blocks.SANDSTONE); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.SANDSTONE_SLAB, Blocks.SANDSTONE, 2); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.CUT_SANDSTONE_SLAB, Blocks.SANDSTONE, 2); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.CUT_SANDSTONE_SLAB, Blocks.CUT_SANDSTONE, 2); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.SANDSTONE_STAIRS, Blocks.SANDSTONE); + this.stonecutterResultFromBase(RecipeCategory.DECORATIONS, Blocks.SANDSTONE_WALL, Blocks.SANDSTONE); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.CHISELED_SANDSTONE, Blocks.SANDSTONE); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.CUT_RED_SANDSTONE, Blocks.RED_SANDSTONE); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.RED_SANDSTONE_SLAB, Blocks.RED_SANDSTONE, 2); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.CUT_RED_SANDSTONE_SLAB, Blocks.RED_SANDSTONE, 2); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.CUT_RED_SANDSTONE_SLAB, Blocks.CUT_RED_SANDSTONE, 2); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.RED_SANDSTONE_STAIRS, Blocks.RED_SANDSTONE); + this.stonecutterResultFromBase(RecipeCategory.DECORATIONS, Blocks.RED_SANDSTONE_WALL, Blocks.RED_SANDSTONE); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.CHISELED_RED_SANDSTONE, Blocks.RED_SANDSTONE); SingleItemRecipeBuilder.stonecutting(Ingredient.of(Blocks.QUARTZ_BLOCK), RecipeCategory.BUILDING_BLOCKS, Blocks.QUARTZ_SLAB, 2) - .unlockedBy("has_quartz_block", has(Blocks.QUARTZ_BLOCK)) - .save(recipeOutput, "quartz_slab_from_stonecutting"); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.QUARTZ_STAIRS, Blocks.QUARTZ_BLOCK); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.QUARTZ_PILLAR, Blocks.QUARTZ_BLOCK); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.CHISELED_QUARTZ_BLOCK, Blocks.QUARTZ_BLOCK); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.QUARTZ_BRICKS, Blocks.QUARTZ_BLOCK); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.COBBLESTONE_STAIRS, Blocks.COBBLESTONE); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.COBBLESTONE_SLAB, Blocks.COBBLESTONE, 2); - stonecutterResultFromBase(recipeOutput, RecipeCategory.DECORATIONS, Blocks.COBBLESTONE_WALL, Blocks.COBBLESTONE); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.STONE_BRICK_SLAB, Blocks.STONE_BRICKS, 2); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.STONE_BRICK_STAIRS, Blocks.STONE_BRICKS); + .unlockedBy("has_quartz_block", this.has(Blocks.QUARTZ_BLOCK)) + .save(this.output, "quartz_slab_from_stonecutting"); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.QUARTZ_STAIRS, Blocks.QUARTZ_BLOCK); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.QUARTZ_PILLAR, Blocks.QUARTZ_BLOCK); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.CHISELED_QUARTZ_BLOCK, Blocks.QUARTZ_BLOCK); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.QUARTZ_BRICKS, Blocks.QUARTZ_BLOCK); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.COBBLESTONE_STAIRS, Blocks.COBBLESTONE); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.COBBLESTONE_SLAB, Blocks.COBBLESTONE, 2); + this.stonecutterResultFromBase(RecipeCategory.DECORATIONS, Blocks.COBBLESTONE_WALL, Blocks.COBBLESTONE); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.STONE_BRICK_SLAB, Blocks.STONE_BRICKS, 2); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.STONE_BRICK_STAIRS, Blocks.STONE_BRICKS); SingleItemRecipeBuilder.stonecutting(Ingredient.of(Blocks.STONE_BRICKS), RecipeCategory.DECORATIONS, Blocks.STONE_BRICK_WALL) - .unlockedBy("has_stone_bricks", has(Blocks.STONE_BRICKS)) - .save(recipeOutput, "stone_brick_wall_from_stone_bricks_stonecutting"); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.CHISELED_STONE_BRICKS, Blocks.STONE_BRICKS); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.BRICK_SLAB, Blocks.BRICKS, 2); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.BRICK_STAIRS, Blocks.BRICKS); - stonecutterResultFromBase(recipeOutput, RecipeCategory.DECORATIONS, Blocks.BRICK_WALL, Blocks.BRICKS); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.MUD_BRICK_SLAB, Blocks.MUD_BRICKS, 2); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.MUD_BRICK_STAIRS, Blocks.MUD_BRICKS); - stonecutterResultFromBase(recipeOutput, RecipeCategory.DECORATIONS, Blocks.MUD_BRICK_WALL, Blocks.MUD_BRICKS); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.NETHER_BRICK_SLAB, Blocks.NETHER_BRICKS, 2); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.NETHER_BRICK_STAIRS, Blocks.NETHER_BRICKS); - stonecutterResultFromBase(recipeOutput, RecipeCategory.DECORATIONS, Blocks.NETHER_BRICK_WALL, Blocks.NETHER_BRICKS); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.CHISELED_NETHER_BRICKS, Blocks.NETHER_BRICKS); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.RED_NETHER_BRICK_SLAB, Blocks.RED_NETHER_BRICKS, 2); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.RED_NETHER_BRICK_STAIRS, Blocks.RED_NETHER_BRICKS); - stonecutterResultFromBase(recipeOutput, RecipeCategory.DECORATIONS, Blocks.RED_NETHER_BRICK_WALL, Blocks.RED_NETHER_BRICKS); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.PURPUR_SLAB, Blocks.PURPUR_BLOCK, 2); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.PURPUR_STAIRS, Blocks.PURPUR_BLOCK); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.PURPUR_PILLAR, Blocks.PURPUR_BLOCK); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.PRISMARINE_SLAB, Blocks.PRISMARINE, 2); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.PRISMARINE_STAIRS, Blocks.PRISMARINE); - stonecutterResultFromBase(recipeOutput, RecipeCategory.DECORATIONS, Blocks.PRISMARINE_WALL, Blocks.PRISMARINE); + .unlockedBy("has_stone_bricks", this.has(Blocks.STONE_BRICKS)) + .save(this.output, "stone_brick_wall_from_stone_bricks_stonecutting"); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.CHISELED_STONE_BRICKS, Blocks.STONE_BRICKS); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.BRICK_SLAB, Blocks.BRICKS, 2); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.BRICK_STAIRS, Blocks.BRICKS); + this.stonecutterResultFromBase(RecipeCategory.DECORATIONS, Blocks.BRICK_WALL, Blocks.BRICKS); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.MUD_BRICK_SLAB, Blocks.MUD_BRICKS, 2); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.MUD_BRICK_STAIRS, Blocks.MUD_BRICKS); + this.stonecutterResultFromBase(RecipeCategory.DECORATIONS, Blocks.MUD_BRICK_WALL, Blocks.MUD_BRICKS); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.NETHER_BRICK_SLAB, Blocks.NETHER_BRICKS, 2); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.NETHER_BRICK_STAIRS, Blocks.NETHER_BRICKS); + this.stonecutterResultFromBase(RecipeCategory.DECORATIONS, Blocks.NETHER_BRICK_WALL, Blocks.NETHER_BRICKS); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.CHISELED_NETHER_BRICKS, Blocks.NETHER_BRICKS); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.RED_NETHER_BRICK_SLAB, Blocks.RED_NETHER_BRICKS, 2); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.RED_NETHER_BRICK_STAIRS, Blocks.RED_NETHER_BRICKS); + this.stonecutterResultFromBase(RecipeCategory.DECORATIONS, Blocks.RED_NETHER_BRICK_WALL, Blocks.RED_NETHER_BRICKS); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.PURPUR_SLAB, Blocks.PURPUR_BLOCK, 2); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.PURPUR_STAIRS, Blocks.PURPUR_BLOCK); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.PURPUR_PILLAR, Blocks.PURPUR_BLOCK); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.PRISMARINE_SLAB, Blocks.PRISMARINE, 2); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.PRISMARINE_STAIRS, Blocks.PRISMARINE); + this.stonecutterResultFromBase(RecipeCategory.DECORATIONS, Blocks.PRISMARINE_WALL, Blocks.PRISMARINE); SingleItemRecipeBuilder.stonecutting(Ingredient.of(Blocks.PRISMARINE_BRICKS), RecipeCategory.BUILDING_BLOCKS, Blocks.PRISMARINE_BRICK_SLAB, 2) - .unlockedBy("has_prismarine_brick", has(Blocks.PRISMARINE_BRICKS)) - .save(recipeOutput, "prismarine_brick_slab_from_prismarine_stonecutting"); + .unlockedBy("has_prismarine_brick", this.has(Blocks.PRISMARINE_BRICKS)) + .save(this.output, "prismarine_brick_slab_from_prismarine_stonecutting"); SingleItemRecipeBuilder.stonecutting(Ingredient.of(Blocks.PRISMARINE_BRICKS), RecipeCategory.BUILDING_BLOCKS, Blocks.PRISMARINE_BRICK_STAIRS) - .unlockedBy("has_prismarine_brick", has(Blocks.PRISMARINE_BRICKS)) - .save(recipeOutput, "prismarine_brick_stairs_from_prismarine_stonecutting"); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.DARK_PRISMARINE_SLAB, Blocks.DARK_PRISMARINE, 2); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.DARK_PRISMARINE_STAIRS, Blocks.DARK_PRISMARINE); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.ANDESITE_SLAB, Blocks.ANDESITE, 2); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.ANDESITE_STAIRS, Blocks.ANDESITE); - stonecutterResultFromBase(recipeOutput, RecipeCategory.DECORATIONS, Blocks.ANDESITE_WALL, Blocks.ANDESITE); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.POLISHED_ANDESITE, Blocks.ANDESITE); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.POLISHED_ANDESITE_SLAB, Blocks.ANDESITE, 2); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.POLISHED_ANDESITE_STAIRS, Blocks.ANDESITE); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.POLISHED_ANDESITE_SLAB, Blocks.POLISHED_ANDESITE, 2); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.POLISHED_ANDESITE_STAIRS, Blocks.POLISHED_ANDESITE); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.POLISHED_BASALT, Blocks.BASALT); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.GRANITE_SLAB, Blocks.GRANITE, 2); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.GRANITE_STAIRS, Blocks.GRANITE); - stonecutterResultFromBase(recipeOutput, RecipeCategory.DECORATIONS, Blocks.GRANITE_WALL, Blocks.GRANITE); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.POLISHED_GRANITE, Blocks.GRANITE); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.POLISHED_GRANITE_SLAB, Blocks.GRANITE, 2); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.POLISHED_GRANITE_STAIRS, Blocks.GRANITE); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.POLISHED_GRANITE_SLAB, Blocks.POLISHED_GRANITE, 2); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.POLISHED_GRANITE_STAIRS, Blocks.POLISHED_GRANITE); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.DIORITE_SLAB, Blocks.DIORITE, 2); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.DIORITE_STAIRS, Blocks.DIORITE); - stonecutterResultFromBase(recipeOutput, RecipeCategory.DECORATIONS, Blocks.DIORITE_WALL, Blocks.DIORITE); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.POLISHED_DIORITE, Blocks.DIORITE); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.POLISHED_DIORITE_SLAB, Blocks.DIORITE, 2); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.POLISHED_DIORITE_STAIRS, Blocks.DIORITE); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.POLISHED_DIORITE_SLAB, Blocks.POLISHED_DIORITE, 2); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.POLISHED_DIORITE_STAIRS, Blocks.POLISHED_DIORITE); + .unlockedBy("has_prismarine_brick", this.has(Blocks.PRISMARINE_BRICKS)) + .save(this.output, "prismarine_brick_stairs_from_prismarine_stonecutting"); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.DARK_PRISMARINE_SLAB, Blocks.DARK_PRISMARINE, 2); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.DARK_PRISMARINE_STAIRS, Blocks.DARK_PRISMARINE); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.ANDESITE_SLAB, Blocks.ANDESITE, 2); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.ANDESITE_STAIRS, Blocks.ANDESITE); + this.stonecutterResultFromBase(RecipeCategory.DECORATIONS, Blocks.ANDESITE_WALL, Blocks.ANDESITE); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.POLISHED_ANDESITE, Blocks.ANDESITE); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.POLISHED_ANDESITE_SLAB, Blocks.ANDESITE, 2); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.POLISHED_ANDESITE_STAIRS, Blocks.ANDESITE); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.POLISHED_ANDESITE_SLAB, Blocks.POLISHED_ANDESITE, 2); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.POLISHED_ANDESITE_STAIRS, Blocks.POLISHED_ANDESITE); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.POLISHED_BASALT, Blocks.BASALT); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.GRANITE_SLAB, Blocks.GRANITE, 2); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.GRANITE_STAIRS, Blocks.GRANITE); + this.stonecutterResultFromBase(RecipeCategory.DECORATIONS, Blocks.GRANITE_WALL, Blocks.GRANITE); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.POLISHED_GRANITE, Blocks.GRANITE); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.POLISHED_GRANITE_SLAB, Blocks.GRANITE, 2); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.POLISHED_GRANITE_STAIRS, Blocks.GRANITE); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.POLISHED_GRANITE_SLAB, Blocks.POLISHED_GRANITE, 2); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.POLISHED_GRANITE_STAIRS, Blocks.POLISHED_GRANITE); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.DIORITE_SLAB, Blocks.DIORITE, 2); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.DIORITE_STAIRS, Blocks.DIORITE); + this.stonecutterResultFromBase(RecipeCategory.DECORATIONS, Blocks.DIORITE_WALL, Blocks.DIORITE); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.POLISHED_DIORITE, Blocks.DIORITE); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.POLISHED_DIORITE_SLAB, Blocks.DIORITE, 2); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.POLISHED_DIORITE_STAIRS, Blocks.DIORITE); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.POLISHED_DIORITE_SLAB, Blocks.POLISHED_DIORITE, 2); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.POLISHED_DIORITE_STAIRS, Blocks.POLISHED_DIORITE); SingleItemRecipeBuilder.stonecutting(Ingredient.of(Blocks.MOSSY_STONE_BRICKS), RecipeCategory.BUILDING_BLOCKS, Blocks.MOSSY_STONE_BRICK_SLAB, 2) - .unlockedBy("has_mossy_stone_bricks", has(Blocks.MOSSY_STONE_BRICKS)) - .save(recipeOutput, "mossy_stone_brick_slab_from_mossy_stone_brick_stonecutting"); + .unlockedBy("has_mossy_stone_bricks", this.has(Blocks.MOSSY_STONE_BRICKS)) + .save(this.output, "mossy_stone_brick_slab_from_mossy_stone_brick_stonecutting"); SingleItemRecipeBuilder.stonecutting(Ingredient.of(Blocks.MOSSY_STONE_BRICKS), RecipeCategory.BUILDING_BLOCKS, Blocks.MOSSY_STONE_BRICK_STAIRS) - .unlockedBy("has_mossy_stone_bricks", has(Blocks.MOSSY_STONE_BRICKS)) - .save(recipeOutput, "mossy_stone_brick_stairs_from_mossy_stone_brick_stonecutting"); + .unlockedBy("has_mossy_stone_bricks", this.has(Blocks.MOSSY_STONE_BRICKS)) + .save(this.output, "mossy_stone_brick_stairs_from_mossy_stone_brick_stonecutting"); SingleItemRecipeBuilder.stonecutting(Ingredient.of(Blocks.MOSSY_STONE_BRICKS), RecipeCategory.DECORATIONS, Blocks.MOSSY_STONE_BRICK_WALL) - .unlockedBy("has_mossy_stone_bricks", has(Blocks.MOSSY_STONE_BRICKS)) - .save(recipeOutput, "mossy_stone_brick_wall_from_mossy_stone_brick_stonecutting"); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.MOSSY_COBBLESTONE_SLAB, Blocks.MOSSY_COBBLESTONE, 2); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.MOSSY_COBBLESTONE_STAIRS, Blocks.MOSSY_COBBLESTONE); - stonecutterResultFromBase(recipeOutput, RecipeCategory.DECORATIONS, Blocks.MOSSY_COBBLESTONE_WALL, Blocks.MOSSY_COBBLESTONE); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.SMOOTH_SANDSTONE_SLAB, Blocks.SMOOTH_SANDSTONE, 2); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.SMOOTH_SANDSTONE_STAIRS, Blocks.SMOOTH_SANDSTONE); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.SMOOTH_RED_SANDSTONE_SLAB, Blocks.SMOOTH_RED_SANDSTONE, 2); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.SMOOTH_RED_SANDSTONE_STAIRS, Blocks.SMOOTH_RED_SANDSTONE); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.SMOOTH_QUARTZ_SLAB, Blocks.SMOOTH_QUARTZ, 2); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.SMOOTH_QUARTZ_STAIRS, Blocks.SMOOTH_QUARTZ); + .unlockedBy("has_mossy_stone_bricks", this.has(Blocks.MOSSY_STONE_BRICKS)) + .save(this.output, "mossy_stone_brick_wall_from_mossy_stone_brick_stonecutting"); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.MOSSY_COBBLESTONE_SLAB, Blocks.MOSSY_COBBLESTONE, 2); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.MOSSY_COBBLESTONE_STAIRS, Blocks.MOSSY_COBBLESTONE); + this.stonecutterResultFromBase(RecipeCategory.DECORATIONS, Blocks.MOSSY_COBBLESTONE_WALL, Blocks.MOSSY_COBBLESTONE); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.SMOOTH_SANDSTONE_SLAB, Blocks.SMOOTH_SANDSTONE, 2); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.SMOOTH_SANDSTONE_STAIRS, Blocks.SMOOTH_SANDSTONE); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.SMOOTH_RED_SANDSTONE_SLAB, Blocks.SMOOTH_RED_SANDSTONE, 2); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.SMOOTH_RED_SANDSTONE_STAIRS, Blocks.SMOOTH_RED_SANDSTONE); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.SMOOTH_QUARTZ_SLAB, Blocks.SMOOTH_QUARTZ, 2); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.SMOOTH_QUARTZ_STAIRS, Blocks.SMOOTH_QUARTZ); SingleItemRecipeBuilder.stonecutting(Ingredient.of(Blocks.END_STONE_BRICKS), RecipeCategory.BUILDING_BLOCKS, Blocks.END_STONE_BRICK_SLAB, 2) - .unlockedBy("has_end_stone_brick", has(Blocks.END_STONE_BRICKS)) - .save(recipeOutput, "end_stone_brick_slab_from_end_stone_brick_stonecutting"); + .unlockedBy("has_end_stone_brick", this.has(Blocks.END_STONE_BRICKS)) + .save(this.output, "end_stone_brick_slab_from_end_stone_brick_stonecutting"); SingleItemRecipeBuilder.stonecutting(Ingredient.of(Blocks.END_STONE_BRICKS), RecipeCategory.BUILDING_BLOCKS, Blocks.END_STONE_BRICK_STAIRS) - .unlockedBy("has_end_stone_brick", has(Blocks.END_STONE_BRICKS)) - .save(recipeOutput, "end_stone_brick_stairs_from_end_stone_brick_stonecutting"); + .unlockedBy("has_end_stone_brick", this.has(Blocks.END_STONE_BRICKS)) + .save(this.output, "end_stone_brick_stairs_from_end_stone_brick_stonecutting"); SingleItemRecipeBuilder.stonecutting(Ingredient.of(Blocks.END_STONE_BRICKS), RecipeCategory.DECORATIONS, Blocks.END_STONE_BRICK_WALL) - .unlockedBy("has_end_stone_brick", has(Blocks.END_STONE_BRICKS)) - .save(recipeOutput, "end_stone_brick_wall_from_end_stone_brick_stonecutting"); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.END_STONE_BRICKS, Blocks.END_STONE); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.END_STONE_BRICK_SLAB, Blocks.END_STONE, 2); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.END_STONE_BRICK_STAIRS, Blocks.END_STONE); - stonecutterResultFromBase(recipeOutput, RecipeCategory.DECORATIONS, Blocks.END_STONE_BRICK_WALL, Blocks.END_STONE); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.SMOOTH_STONE_SLAB, Blocks.SMOOTH_STONE, 2); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.BLACKSTONE_SLAB, Blocks.BLACKSTONE, 2); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.BLACKSTONE_STAIRS, Blocks.BLACKSTONE); - stonecutterResultFromBase(recipeOutput, RecipeCategory.DECORATIONS, Blocks.BLACKSTONE_WALL, Blocks.BLACKSTONE); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.POLISHED_BLACKSTONE, Blocks.BLACKSTONE); - stonecutterResultFromBase(recipeOutput, RecipeCategory.DECORATIONS, Blocks.POLISHED_BLACKSTONE_WALL, Blocks.BLACKSTONE); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.POLISHED_BLACKSTONE_SLAB, Blocks.BLACKSTONE, 2); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.POLISHED_BLACKSTONE_STAIRS, Blocks.BLACKSTONE); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.CHISELED_POLISHED_BLACKSTONE, Blocks.BLACKSTONE); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.POLISHED_BLACKSTONE_BRICKS, Blocks.BLACKSTONE); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.POLISHED_BLACKSTONE_BRICK_SLAB, Blocks.BLACKSTONE, 2); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.POLISHED_BLACKSTONE_BRICK_STAIRS, Blocks.BLACKSTONE); - stonecutterResultFromBase(recipeOutput, RecipeCategory.DECORATIONS, Blocks.POLISHED_BLACKSTONE_BRICK_WALL, Blocks.BLACKSTONE); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.POLISHED_BLACKSTONE_SLAB, Blocks.POLISHED_BLACKSTONE, 2); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.POLISHED_BLACKSTONE_STAIRS, Blocks.POLISHED_BLACKSTONE); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.POLISHED_BLACKSTONE_BRICKS, Blocks.POLISHED_BLACKSTONE); - stonecutterResultFromBase(recipeOutput, RecipeCategory.DECORATIONS, Blocks.POLISHED_BLACKSTONE_WALL, Blocks.POLISHED_BLACKSTONE); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.POLISHED_BLACKSTONE_BRICK_SLAB, Blocks.POLISHED_BLACKSTONE, 2); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.POLISHED_BLACKSTONE_BRICK_STAIRS, Blocks.POLISHED_BLACKSTONE); - stonecutterResultFromBase(recipeOutput, RecipeCategory.DECORATIONS, Blocks.POLISHED_BLACKSTONE_BRICK_WALL, Blocks.POLISHED_BLACKSTONE); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.CHISELED_POLISHED_BLACKSTONE, Blocks.POLISHED_BLACKSTONE); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.POLISHED_BLACKSTONE_BRICK_SLAB, Blocks.POLISHED_BLACKSTONE_BRICKS, 2); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.POLISHED_BLACKSTONE_BRICK_STAIRS, Blocks.POLISHED_BLACKSTONE_BRICKS); - stonecutterResultFromBase(recipeOutput, RecipeCategory.DECORATIONS, Blocks.POLISHED_BLACKSTONE_BRICK_WALL, Blocks.POLISHED_BLACKSTONE_BRICKS); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.CUT_COPPER_SLAB, Blocks.CUT_COPPER, 2); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.CUT_COPPER_STAIRS, Blocks.CUT_COPPER); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.EXPOSED_CUT_COPPER_SLAB, Blocks.EXPOSED_CUT_COPPER, 2); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.EXPOSED_CUT_COPPER_STAIRS, Blocks.EXPOSED_CUT_COPPER); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.WEATHERED_CUT_COPPER_SLAB, Blocks.WEATHERED_CUT_COPPER, 2); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.WEATHERED_CUT_COPPER_STAIRS, Blocks.WEATHERED_CUT_COPPER); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.OXIDIZED_CUT_COPPER_SLAB, Blocks.OXIDIZED_CUT_COPPER, 2); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.OXIDIZED_CUT_COPPER_STAIRS, Blocks.OXIDIZED_CUT_COPPER); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.WAXED_CUT_COPPER_SLAB, Blocks.WAXED_CUT_COPPER, 2); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.WAXED_CUT_COPPER_STAIRS, Blocks.WAXED_CUT_COPPER); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.WAXED_EXPOSED_CUT_COPPER_SLAB, Blocks.WAXED_EXPOSED_CUT_COPPER, 2); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.WAXED_EXPOSED_CUT_COPPER_STAIRS, Blocks.WAXED_EXPOSED_CUT_COPPER); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.WAXED_WEATHERED_CUT_COPPER_SLAB, Blocks.WAXED_WEATHERED_CUT_COPPER, 2); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.WAXED_WEATHERED_CUT_COPPER_STAIRS, Blocks.WAXED_WEATHERED_CUT_COPPER); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.WAXED_OXIDIZED_CUT_COPPER_SLAB, Blocks.WAXED_OXIDIZED_CUT_COPPER, 2); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.WAXED_OXIDIZED_CUT_COPPER_STAIRS, Blocks.WAXED_OXIDIZED_CUT_COPPER); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.CUT_COPPER, Blocks.COPPER_BLOCK, 4); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.CUT_COPPER_STAIRS, Blocks.COPPER_BLOCK, 4); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.CUT_COPPER_SLAB, Blocks.COPPER_BLOCK, 8); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.EXPOSED_CUT_COPPER, Blocks.EXPOSED_COPPER, 4); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.EXPOSED_CUT_COPPER_STAIRS, Blocks.EXPOSED_COPPER, 4); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.EXPOSED_CUT_COPPER_SLAB, Blocks.EXPOSED_COPPER, 8); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.WEATHERED_CUT_COPPER, Blocks.WEATHERED_COPPER, 4); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.WEATHERED_CUT_COPPER_STAIRS, Blocks.WEATHERED_COPPER, 4); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.WEATHERED_CUT_COPPER_SLAB, Blocks.WEATHERED_COPPER, 8); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.OXIDIZED_CUT_COPPER, Blocks.OXIDIZED_COPPER, 4); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.OXIDIZED_CUT_COPPER_STAIRS, Blocks.OXIDIZED_COPPER, 4); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.OXIDIZED_CUT_COPPER_SLAB, Blocks.OXIDIZED_COPPER, 8); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.WAXED_CUT_COPPER, Blocks.WAXED_COPPER_BLOCK, 4); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.WAXED_CUT_COPPER_STAIRS, Blocks.WAXED_COPPER_BLOCK, 4); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.WAXED_CUT_COPPER_SLAB, Blocks.WAXED_COPPER_BLOCK, 8); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.WAXED_EXPOSED_CUT_COPPER, Blocks.WAXED_EXPOSED_COPPER, 4); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.WAXED_EXPOSED_CUT_COPPER_STAIRS, Blocks.WAXED_EXPOSED_COPPER, 4); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.WAXED_EXPOSED_CUT_COPPER_SLAB, Blocks.WAXED_EXPOSED_COPPER, 8); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.WAXED_WEATHERED_CUT_COPPER, Blocks.WAXED_WEATHERED_COPPER, 4); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.WAXED_WEATHERED_CUT_COPPER_STAIRS, Blocks.WAXED_WEATHERED_COPPER, 4); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.WAXED_WEATHERED_CUT_COPPER_SLAB, Blocks.WAXED_WEATHERED_COPPER, 8); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.WAXED_OXIDIZED_CUT_COPPER, Blocks.WAXED_OXIDIZED_COPPER, 4); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.WAXED_OXIDIZED_CUT_COPPER_STAIRS, Blocks.WAXED_OXIDIZED_COPPER, 4); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.WAXED_OXIDIZED_CUT_COPPER_SLAB, Blocks.WAXED_OXIDIZED_COPPER, 8); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.COBBLED_DEEPSLATE_SLAB, Blocks.COBBLED_DEEPSLATE, 2); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.COBBLED_DEEPSLATE_STAIRS, Blocks.COBBLED_DEEPSLATE); - stonecutterResultFromBase(recipeOutput, RecipeCategory.DECORATIONS, Blocks.COBBLED_DEEPSLATE_WALL, Blocks.COBBLED_DEEPSLATE); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.CHISELED_DEEPSLATE, Blocks.COBBLED_DEEPSLATE); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.POLISHED_DEEPSLATE, Blocks.COBBLED_DEEPSLATE); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.POLISHED_DEEPSLATE_SLAB, Blocks.COBBLED_DEEPSLATE, 2); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.POLISHED_DEEPSLATE_STAIRS, Blocks.COBBLED_DEEPSLATE); - stonecutterResultFromBase(recipeOutput, RecipeCategory.DECORATIONS, Blocks.POLISHED_DEEPSLATE_WALL, Blocks.COBBLED_DEEPSLATE); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.DEEPSLATE_BRICKS, Blocks.COBBLED_DEEPSLATE); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.DEEPSLATE_BRICK_SLAB, Blocks.COBBLED_DEEPSLATE, 2); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.DEEPSLATE_BRICK_STAIRS, Blocks.COBBLED_DEEPSLATE); - stonecutterResultFromBase(recipeOutput, RecipeCategory.DECORATIONS, Blocks.DEEPSLATE_BRICK_WALL, Blocks.COBBLED_DEEPSLATE); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.DEEPSLATE_TILES, Blocks.COBBLED_DEEPSLATE); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.DEEPSLATE_TILE_SLAB, Blocks.COBBLED_DEEPSLATE, 2); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.DEEPSLATE_TILE_STAIRS, Blocks.COBBLED_DEEPSLATE); - stonecutterResultFromBase(recipeOutput, RecipeCategory.DECORATIONS, Blocks.DEEPSLATE_TILE_WALL, Blocks.COBBLED_DEEPSLATE); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.POLISHED_DEEPSLATE_SLAB, Blocks.POLISHED_DEEPSLATE, 2); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.POLISHED_DEEPSLATE_STAIRS, Blocks.POLISHED_DEEPSLATE); - stonecutterResultFromBase(recipeOutput, RecipeCategory.DECORATIONS, Blocks.POLISHED_DEEPSLATE_WALL, Blocks.POLISHED_DEEPSLATE); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.DEEPSLATE_BRICKS, Blocks.POLISHED_DEEPSLATE); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.DEEPSLATE_BRICK_SLAB, Blocks.POLISHED_DEEPSLATE, 2); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.DEEPSLATE_BRICK_STAIRS, Blocks.POLISHED_DEEPSLATE); - stonecutterResultFromBase(recipeOutput, RecipeCategory.DECORATIONS, Blocks.DEEPSLATE_BRICK_WALL, Blocks.POLISHED_DEEPSLATE); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.DEEPSLATE_TILES, Blocks.POLISHED_DEEPSLATE); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.DEEPSLATE_TILE_SLAB, Blocks.POLISHED_DEEPSLATE, 2); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.DEEPSLATE_TILE_STAIRS, Blocks.POLISHED_DEEPSLATE); - stonecutterResultFromBase(recipeOutput, RecipeCategory.DECORATIONS, Blocks.DEEPSLATE_TILE_WALL, Blocks.POLISHED_DEEPSLATE); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.DEEPSLATE_BRICK_SLAB, Blocks.DEEPSLATE_BRICKS, 2); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.DEEPSLATE_BRICK_STAIRS, Blocks.DEEPSLATE_BRICKS); - stonecutterResultFromBase(recipeOutput, RecipeCategory.DECORATIONS, Blocks.DEEPSLATE_BRICK_WALL, Blocks.DEEPSLATE_BRICKS); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.DEEPSLATE_TILES, Blocks.DEEPSLATE_BRICKS); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.DEEPSLATE_TILE_SLAB, Blocks.DEEPSLATE_BRICKS, 2); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.DEEPSLATE_TILE_STAIRS, Blocks.DEEPSLATE_BRICKS); - stonecutterResultFromBase(recipeOutput, RecipeCategory.DECORATIONS, Blocks.DEEPSLATE_TILE_WALL, Blocks.DEEPSLATE_BRICKS); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.DEEPSLATE_TILE_SLAB, Blocks.DEEPSLATE_TILES, 2); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.DEEPSLATE_TILE_STAIRS, Blocks.DEEPSLATE_TILES); - stonecutterResultFromBase(recipeOutput, RecipeCategory.DECORATIONS, Blocks.DEEPSLATE_TILE_WALL, Blocks.DEEPSLATE_TILES); - smithingTrims().forEach(trimTemplate -> trimSmithing(recipeOutput, trimTemplate.template(), trimTemplate.id())); - netheriteSmithing(recipeOutput, Items.DIAMOND_CHESTPLATE, RecipeCategory.COMBAT, Items.NETHERITE_CHESTPLATE); - netheriteSmithing(recipeOutput, Items.DIAMOND_LEGGINGS, RecipeCategory.COMBAT, Items.NETHERITE_LEGGINGS); - netheriteSmithing(recipeOutput, Items.DIAMOND_HELMET, RecipeCategory.COMBAT, Items.NETHERITE_HELMET); - netheriteSmithing(recipeOutput, Items.DIAMOND_BOOTS, RecipeCategory.COMBAT, Items.NETHERITE_BOOTS); - netheriteSmithing(recipeOutput, Items.DIAMOND_SWORD, RecipeCategory.COMBAT, Items.NETHERITE_SWORD); - netheriteSmithing(recipeOutput, Items.DIAMOND_AXE, RecipeCategory.TOOLS, Items.NETHERITE_AXE); - netheriteSmithing(recipeOutput, Items.DIAMOND_PICKAXE, RecipeCategory.TOOLS, Items.NETHERITE_PICKAXE); - netheriteSmithing(recipeOutput, Items.DIAMOND_HOE, RecipeCategory.TOOLS, Items.NETHERITE_HOE); - netheriteSmithing(recipeOutput, Items.DIAMOND_SHOVEL, RecipeCategory.TOOLS, Items.NETHERITE_SHOVEL); - copySmithingTemplate(recipeOutput, Items.NETHERITE_UPGRADE_SMITHING_TEMPLATE, Items.NETHERRACK); - copySmithingTemplate(recipeOutput, Items.SENTRY_ARMOR_TRIM_SMITHING_TEMPLATE, Items.COBBLESTONE); - copySmithingTemplate(recipeOutput, Items.DUNE_ARMOR_TRIM_SMITHING_TEMPLATE, Items.SANDSTONE); - copySmithingTemplate(recipeOutput, Items.COAST_ARMOR_TRIM_SMITHING_TEMPLATE, Items.COBBLESTONE); - copySmithingTemplate(recipeOutput, Items.WILD_ARMOR_TRIM_SMITHING_TEMPLATE, Items.MOSSY_COBBLESTONE); - copySmithingTemplate(recipeOutput, Items.WARD_ARMOR_TRIM_SMITHING_TEMPLATE, Items.COBBLED_DEEPSLATE); - copySmithingTemplate(recipeOutput, Items.EYE_ARMOR_TRIM_SMITHING_TEMPLATE, Items.END_STONE); - copySmithingTemplate(recipeOutput, Items.VEX_ARMOR_TRIM_SMITHING_TEMPLATE, Items.COBBLESTONE); - copySmithingTemplate(recipeOutput, Items.TIDE_ARMOR_TRIM_SMITHING_TEMPLATE, Items.PRISMARINE); - copySmithingTemplate(recipeOutput, Items.SNOUT_ARMOR_TRIM_SMITHING_TEMPLATE, Items.BLACKSTONE); - copySmithingTemplate(recipeOutput, Items.RIB_ARMOR_TRIM_SMITHING_TEMPLATE, Items.NETHERRACK); - copySmithingTemplate(recipeOutput, Items.SPIRE_ARMOR_TRIM_SMITHING_TEMPLATE, Items.PURPUR_BLOCK); - copySmithingTemplate(recipeOutput, Items.SILENCE_ARMOR_TRIM_SMITHING_TEMPLATE, Items.COBBLED_DEEPSLATE); - copySmithingTemplate(recipeOutput, Items.WAYFINDER_ARMOR_TRIM_SMITHING_TEMPLATE, Items.TERRACOTTA); - copySmithingTemplate(recipeOutput, Items.SHAPER_ARMOR_TRIM_SMITHING_TEMPLATE, Items.TERRACOTTA); - copySmithingTemplate(recipeOutput, Items.RAISER_ARMOR_TRIM_SMITHING_TEMPLATE, Items.TERRACOTTA); - copySmithingTemplate(recipeOutput, Items.HOST_ARMOR_TRIM_SMITHING_TEMPLATE, Items.TERRACOTTA); - copySmithingTemplate(recipeOutput, Items.FLOW_ARMOR_TRIM_SMITHING_TEMPLATE, Items.BREEZE_ROD); - copySmithingTemplate(recipeOutput, Items.BOLT_ARMOR_TRIM_SMITHING_TEMPLATE, Ingredient.of(Items.COPPER_BLOCK, Items.WAXED_COPPER_BLOCK)); - threeByThreePacker(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.BAMBOO_BLOCK, Items.BAMBOO); - planksFromLogs(recipeOutput, Blocks.BAMBOO_PLANKS, ItemTags.BAMBOO_BLOCKS, 2); - mosaicBuilder(recipeOutput, RecipeCategory.DECORATIONS, Blocks.BAMBOO_MOSAIC, Blocks.BAMBOO_SLAB); - woodenBoat(recipeOutput, Items.BAMBOO_RAFT, Blocks.BAMBOO_PLANKS); - chestBoat(recipeOutput, Items.BAMBOO_CHEST_RAFT, Items.BAMBOO_RAFT); - hangingSign(recipeOutput, Items.OAK_HANGING_SIGN, Blocks.STRIPPED_OAK_LOG); - hangingSign(recipeOutput, Items.SPRUCE_HANGING_SIGN, Blocks.STRIPPED_SPRUCE_LOG); - hangingSign(recipeOutput, Items.BIRCH_HANGING_SIGN, Blocks.STRIPPED_BIRCH_LOG); - hangingSign(recipeOutput, Items.JUNGLE_HANGING_SIGN, Blocks.STRIPPED_JUNGLE_LOG); - hangingSign(recipeOutput, Items.ACACIA_HANGING_SIGN, Blocks.STRIPPED_ACACIA_LOG); - hangingSign(recipeOutput, Items.CHERRY_HANGING_SIGN, Blocks.STRIPPED_CHERRY_LOG); - hangingSign(recipeOutput, Items.DARK_OAK_HANGING_SIGN, Blocks.STRIPPED_DARK_OAK_LOG); - hangingSign(recipeOutput, Items.MANGROVE_HANGING_SIGN, Blocks.STRIPPED_MANGROVE_LOG); - hangingSign(recipeOutput, Items.BAMBOO_HANGING_SIGN, Items.STRIPPED_BAMBOO_BLOCK); - hangingSign(recipeOutput, Items.CRIMSON_HANGING_SIGN, Blocks.STRIPPED_CRIMSON_STEM); - hangingSign(recipeOutput, Items.WARPED_HANGING_SIGN, Blocks.STRIPPED_WARPED_STEM); - ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, Blocks.CHISELED_BOOKSHELF) + .unlockedBy("has_end_stone_brick", this.has(Blocks.END_STONE_BRICKS)) + .save(this.output, "end_stone_brick_wall_from_end_stone_brick_stonecutting"); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.END_STONE_BRICKS, Blocks.END_STONE); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.END_STONE_BRICK_SLAB, Blocks.END_STONE, 2); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.END_STONE_BRICK_STAIRS, Blocks.END_STONE); + this.stonecutterResultFromBase(RecipeCategory.DECORATIONS, Blocks.END_STONE_BRICK_WALL, Blocks.END_STONE); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.SMOOTH_STONE_SLAB, Blocks.SMOOTH_STONE, 2); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.BLACKSTONE_SLAB, Blocks.BLACKSTONE, 2); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.BLACKSTONE_STAIRS, Blocks.BLACKSTONE); + this.stonecutterResultFromBase(RecipeCategory.DECORATIONS, Blocks.BLACKSTONE_WALL, Blocks.BLACKSTONE); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.POLISHED_BLACKSTONE, Blocks.BLACKSTONE); + this.stonecutterResultFromBase(RecipeCategory.DECORATIONS, Blocks.POLISHED_BLACKSTONE_WALL, Blocks.BLACKSTONE); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.POLISHED_BLACKSTONE_SLAB, Blocks.BLACKSTONE, 2); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.POLISHED_BLACKSTONE_STAIRS, Blocks.BLACKSTONE); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.CHISELED_POLISHED_BLACKSTONE, Blocks.BLACKSTONE); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.POLISHED_BLACKSTONE_BRICKS, Blocks.BLACKSTONE); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.POLISHED_BLACKSTONE_BRICK_SLAB, Blocks.BLACKSTONE, 2); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.POLISHED_BLACKSTONE_BRICK_STAIRS, Blocks.BLACKSTONE); + this.stonecutterResultFromBase(RecipeCategory.DECORATIONS, Blocks.POLISHED_BLACKSTONE_BRICK_WALL, Blocks.BLACKSTONE); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.POLISHED_BLACKSTONE_SLAB, Blocks.POLISHED_BLACKSTONE, 2); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.POLISHED_BLACKSTONE_STAIRS, Blocks.POLISHED_BLACKSTONE); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.POLISHED_BLACKSTONE_BRICKS, Blocks.POLISHED_BLACKSTONE); + this.stonecutterResultFromBase(RecipeCategory.DECORATIONS, Blocks.POLISHED_BLACKSTONE_WALL, Blocks.POLISHED_BLACKSTONE); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.POLISHED_BLACKSTONE_BRICK_SLAB, Blocks.POLISHED_BLACKSTONE, 2); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.POLISHED_BLACKSTONE_BRICK_STAIRS, Blocks.POLISHED_BLACKSTONE); + this.stonecutterResultFromBase(RecipeCategory.DECORATIONS, Blocks.POLISHED_BLACKSTONE_BRICK_WALL, Blocks.POLISHED_BLACKSTONE); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.CHISELED_POLISHED_BLACKSTONE, Blocks.POLISHED_BLACKSTONE); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.POLISHED_BLACKSTONE_BRICK_SLAB, Blocks.POLISHED_BLACKSTONE_BRICKS, 2); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.POLISHED_BLACKSTONE_BRICK_STAIRS, Blocks.POLISHED_BLACKSTONE_BRICKS); + this.stonecutterResultFromBase(RecipeCategory.DECORATIONS, Blocks.POLISHED_BLACKSTONE_BRICK_WALL, Blocks.POLISHED_BLACKSTONE_BRICKS); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.CUT_COPPER_SLAB, Blocks.CUT_COPPER, 2); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.CUT_COPPER_STAIRS, Blocks.CUT_COPPER); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.EXPOSED_CUT_COPPER_SLAB, Blocks.EXPOSED_CUT_COPPER, 2); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.EXPOSED_CUT_COPPER_STAIRS, Blocks.EXPOSED_CUT_COPPER); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.WEATHERED_CUT_COPPER_SLAB, Blocks.WEATHERED_CUT_COPPER, 2); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.WEATHERED_CUT_COPPER_STAIRS, Blocks.WEATHERED_CUT_COPPER); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.OXIDIZED_CUT_COPPER_SLAB, Blocks.OXIDIZED_CUT_COPPER, 2); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.OXIDIZED_CUT_COPPER_STAIRS, Blocks.OXIDIZED_CUT_COPPER); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.WAXED_CUT_COPPER_SLAB, Blocks.WAXED_CUT_COPPER, 2); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.WAXED_CUT_COPPER_STAIRS, Blocks.WAXED_CUT_COPPER); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.WAXED_EXPOSED_CUT_COPPER_SLAB, Blocks.WAXED_EXPOSED_CUT_COPPER, 2); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.WAXED_EXPOSED_CUT_COPPER_STAIRS, Blocks.WAXED_EXPOSED_CUT_COPPER); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.WAXED_WEATHERED_CUT_COPPER_SLAB, Blocks.WAXED_WEATHERED_CUT_COPPER, 2); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.WAXED_WEATHERED_CUT_COPPER_STAIRS, Blocks.WAXED_WEATHERED_CUT_COPPER); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.WAXED_OXIDIZED_CUT_COPPER_SLAB, Blocks.WAXED_OXIDIZED_CUT_COPPER, 2); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.WAXED_OXIDIZED_CUT_COPPER_STAIRS, Blocks.WAXED_OXIDIZED_CUT_COPPER); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.CUT_COPPER, Blocks.COPPER_BLOCK, 4); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.CUT_COPPER_STAIRS, Blocks.COPPER_BLOCK, 4); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.CUT_COPPER_SLAB, Blocks.COPPER_BLOCK, 8); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.EXPOSED_CUT_COPPER, Blocks.EXPOSED_COPPER, 4); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.EXPOSED_CUT_COPPER_STAIRS, Blocks.EXPOSED_COPPER, 4); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.EXPOSED_CUT_COPPER_SLAB, Blocks.EXPOSED_COPPER, 8); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.WEATHERED_CUT_COPPER, Blocks.WEATHERED_COPPER, 4); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.WEATHERED_CUT_COPPER_STAIRS, Blocks.WEATHERED_COPPER, 4); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.WEATHERED_CUT_COPPER_SLAB, Blocks.WEATHERED_COPPER, 8); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.OXIDIZED_CUT_COPPER, Blocks.OXIDIZED_COPPER, 4); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.OXIDIZED_CUT_COPPER_STAIRS, Blocks.OXIDIZED_COPPER, 4); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.OXIDIZED_CUT_COPPER_SLAB, Blocks.OXIDIZED_COPPER, 8); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.WAXED_CUT_COPPER, Blocks.WAXED_COPPER_BLOCK, 4); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.WAXED_CUT_COPPER_STAIRS, Blocks.WAXED_COPPER_BLOCK, 4); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.WAXED_CUT_COPPER_SLAB, Blocks.WAXED_COPPER_BLOCK, 8); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.WAXED_EXPOSED_CUT_COPPER, Blocks.WAXED_EXPOSED_COPPER, 4); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.WAXED_EXPOSED_CUT_COPPER_STAIRS, Blocks.WAXED_EXPOSED_COPPER, 4); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.WAXED_EXPOSED_CUT_COPPER_SLAB, Blocks.WAXED_EXPOSED_COPPER, 8); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.WAXED_WEATHERED_CUT_COPPER, Blocks.WAXED_WEATHERED_COPPER, 4); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.WAXED_WEATHERED_CUT_COPPER_STAIRS, Blocks.WAXED_WEATHERED_COPPER, 4); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.WAXED_WEATHERED_CUT_COPPER_SLAB, Blocks.WAXED_WEATHERED_COPPER, 8); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.WAXED_OXIDIZED_CUT_COPPER, Blocks.WAXED_OXIDIZED_COPPER, 4); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.WAXED_OXIDIZED_CUT_COPPER_STAIRS, Blocks.WAXED_OXIDIZED_COPPER, 4); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.WAXED_OXIDIZED_CUT_COPPER_SLAB, Blocks.WAXED_OXIDIZED_COPPER, 8); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.COBBLED_DEEPSLATE_SLAB, Blocks.COBBLED_DEEPSLATE, 2); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.COBBLED_DEEPSLATE_STAIRS, Blocks.COBBLED_DEEPSLATE); + this.stonecutterResultFromBase(RecipeCategory.DECORATIONS, Blocks.COBBLED_DEEPSLATE_WALL, Blocks.COBBLED_DEEPSLATE); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.CHISELED_DEEPSLATE, Blocks.COBBLED_DEEPSLATE); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.POLISHED_DEEPSLATE, Blocks.COBBLED_DEEPSLATE); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.POLISHED_DEEPSLATE_SLAB, Blocks.COBBLED_DEEPSLATE, 2); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.POLISHED_DEEPSLATE_STAIRS, Blocks.COBBLED_DEEPSLATE); + this.stonecutterResultFromBase(RecipeCategory.DECORATIONS, Blocks.POLISHED_DEEPSLATE_WALL, Blocks.COBBLED_DEEPSLATE); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.DEEPSLATE_BRICKS, Blocks.COBBLED_DEEPSLATE); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.DEEPSLATE_BRICK_SLAB, Blocks.COBBLED_DEEPSLATE, 2); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.DEEPSLATE_BRICK_STAIRS, Blocks.COBBLED_DEEPSLATE); + this.stonecutterResultFromBase(RecipeCategory.DECORATIONS, Blocks.DEEPSLATE_BRICK_WALL, Blocks.COBBLED_DEEPSLATE); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.DEEPSLATE_TILES, Blocks.COBBLED_DEEPSLATE); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.DEEPSLATE_TILE_SLAB, Blocks.COBBLED_DEEPSLATE, 2); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.DEEPSLATE_TILE_STAIRS, Blocks.COBBLED_DEEPSLATE); + this.stonecutterResultFromBase(RecipeCategory.DECORATIONS, Blocks.DEEPSLATE_TILE_WALL, Blocks.COBBLED_DEEPSLATE); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.POLISHED_DEEPSLATE_SLAB, Blocks.POLISHED_DEEPSLATE, 2); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.POLISHED_DEEPSLATE_STAIRS, Blocks.POLISHED_DEEPSLATE); + this.stonecutterResultFromBase(RecipeCategory.DECORATIONS, Blocks.POLISHED_DEEPSLATE_WALL, Blocks.POLISHED_DEEPSLATE); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.DEEPSLATE_BRICKS, Blocks.POLISHED_DEEPSLATE); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.DEEPSLATE_BRICK_SLAB, Blocks.POLISHED_DEEPSLATE, 2); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.DEEPSLATE_BRICK_STAIRS, Blocks.POLISHED_DEEPSLATE); + this.stonecutterResultFromBase(RecipeCategory.DECORATIONS, Blocks.DEEPSLATE_BRICK_WALL, Blocks.POLISHED_DEEPSLATE); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.DEEPSLATE_TILES, Blocks.POLISHED_DEEPSLATE); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.DEEPSLATE_TILE_SLAB, Blocks.POLISHED_DEEPSLATE, 2); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.DEEPSLATE_TILE_STAIRS, Blocks.POLISHED_DEEPSLATE); + this.stonecutterResultFromBase(RecipeCategory.DECORATIONS, Blocks.DEEPSLATE_TILE_WALL, Blocks.POLISHED_DEEPSLATE); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.DEEPSLATE_BRICK_SLAB, Blocks.DEEPSLATE_BRICKS, 2); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.DEEPSLATE_BRICK_STAIRS, Blocks.DEEPSLATE_BRICKS); + this.stonecutterResultFromBase(RecipeCategory.DECORATIONS, Blocks.DEEPSLATE_BRICK_WALL, Blocks.DEEPSLATE_BRICKS); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.DEEPSLATE_TILES, Blocks.DEEPSLATE_BRICKS); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.DEEPSLATE_TILE_SLAB, Blocks.DEEPSLATE_BRICKS, 2); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.DEEPSLATE_TILE_STAIRS, Blocks.DEEPSLATE_BRICKS); + this.stonecutterResultFromBase(RecipeCategory.DECORATIONS, Blocks.DEEPSLATE_TILE_WALL, Blocks.DEEPSLATE_BRICKS); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.DEEPSLATE_TILE_SLAB, Blocks.DEEPSLATE_TILES, 2); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.DEEPSLATE_TILE_STAIRS, Blocks.DEEPSLATE_TILES); + this.stonecutterResultFromBase(RecipeCategory.DECORATIONS, Blocks.DEEPSLATE_TILE_WALL, Blocks.DEEPSLATE_TILES); + smithingTrims().forEach(trimTemplate -> this.trimSmithing(trimTemplate.template(), trimTemplate.id())); + this.netheriteSmithing(Items.DIAMOND_CHESTPLATE, RecipeCategory.COMBAT, Items.NETHERITE_CHESTPLATE); + this.netheriteSmithing(Items.DIAMOND_LEGGINGS, RecipeCategory.COMBAT, Items.NETHERITE_LEGGINGS); + this.netheriteSmithing(Items.DIAMOND_HELMET, RecipeCategory.COMBAT, Items.NETHERITE_HELMET); + this.netheriteSmithing(Items.DIAMOND_BOOTS, RecipeCategory.COMBAT, Items.NETHERITE_BOOTS); + this.netheriteSmithing(Items.DIAMOND_SWORD, RecipeCategory.COMBAT, Items.NETHERITE_SWORD); + this.netheriteSmithing(Items.DIAMOND_AXE, RecipeCategory.TOOLS, Items.NETHERITE_AXE); + this.netheriteSmithing(Items.DIAMOND_PICKAXE, RecipeCategory.TOOLS, Items.NETHERITE_PICKAXE); + this.netheriteSmithing(Items.DIAMOND_HOE, RecipeCategory.TOOLS, Items.NETHERITE_HOE); + this.netheriteSmithing(Items.DIAMOND_SHOVEL, RecipeCategory.TOOLS, Items.NETHERITE_SHOVEL); + this.copySmithingTemplate(Items.NETHERITE_UPGRADE_SMITHING_TEMPLATE, Items.NETHERRACK); + this.copySmithingTemplate(Items.SENTRY_ARMOR_TRIM_SMITHING_TEMPLATE, Items.COBBLESTONE); + this.copySmithingTemplate(Items.DUNE_ARMOR_TRIM_SMITHING_TEMPLATE, Items.SANDSTONE); + this.copySmithingTemplate(Items.COAST_ARMOR_TRIM_SMITHING_TEMPLATE, Items.COBBLESTONE); + this.copySmithingTemplate(Items.WILD_ARMOR_TRIM_SMITHING_TEMPLATE, Items.MOSSY_COBBLESTONE); + this.copySmithingTemplate(Items.WARD_ARMOR_TRIM_SMITHING_TEMPLATE, Items.COBBLED_DEEPSLATE); + this.copySmithingTemplate(Items.EYE_ARMOR_TRIM_SMITHING_TEMPLATE, Items.END_STONE); + this.copySmithingTemplate(Items.VEX_ARMOR_TRIM_SMITHING_TEMPLATE, Items.COBBLESTONE); + this.copySmithingTemplate(Items.TIDE_ARMOR_TRIM_SMITHING_TEMPLATE, Items.PRISMARINE); + this.copySmithingTemplate(Items.SNOUT_ARMOR_TRIM_SMITHING_TEMPLATE, Items.BLACKSTONE); + this.copySmithingTemplate(Items.RIB_ARMOR_TRIM_SMITHING_TEMPLATE, Items.NETHERRACK); + this.copySmithingTemplate(Items.SPIRE_ARMOR_TRIM_SMITHING_TEMPLATE, Items.PURPUR_BLOCK); + this.copySmithingTemplate(Items.SILENCE_ARMOR_TRIM_SMITHING_TEMPLATE, Items.COBBLED_DEEPSLATE); + this.copySmithingTemplate(Items.WAYFINDER_ARMOR_TRIM_SMITHING_TEMPLATE, Items.TERRACOTTA); + this.copySmithingTemplate(Items.SHAPER_ARMOR_TRIM_SMITHING_TEMPLATE, Items.TERRACOTTA); + this.copySmithingTemplate(Items.RAISER_ARMOR_TRIM_SMITHING_TEMPLATE, Items.TERRACOTTA); + this.copySmithingTemplate(Items.HOST_ARMOR_TRIM_SMITHING_TEMPLATE, Items.TERRACOTTA); + this.copySmithingTemplate(Items.FLOW_ARMOR_TRIM_SMITHING_TEMPLATE, Items.BREEZE_ROD); + this.copySmithingTemplate(Items.BOLT_ARMOR_TRIM_SMITHING_TEMPLATE, Ingredient.of(Items.COPPER_BLOCK, Items.WAXED_COPPER_BLOCK)); + this.threeByThreePacker(RecipeCategory.BUILDING_BLOCKS, Blocks.BAMBOO_BLOCK, Items.BAMBOO); + this.planksFromLogs(Blocks.BAMBOO_PLANKS, ItemTags.BAMBOO_BLOCKS, 2); + this.mosaicBuilder(RecipeCategory.DECORATIONS, Blocks.BAMBOO_MOSAIC, Blocks.BAMBOO_SLAB); + this.woodenBoat(Items.BAMBOO_RAFT, Blocks.BAMBOO_PLANKS); + this.chestBoat(Items.BAMBOO_CHEST_RAFT, Items.BAMBOO_RAFT); + this.hangingSign(Items.OAK_HANGING_SIGN, Blocks.STRIPPED_OAK_LOG); + this.hangingSign(Items.SPRUCE_HANGING_SIGN, Blocks.STRIPPED_SPRUCE_LOG); + this.hangingSign(Items.BIRCH_HANGING_SIGN, Blocks.STRIPPED_BIRCH_LOG); + this.hangingSign(Items.JUNGLE_HANGING_SIGN, Blocks.STRIPPED_JUNGLE_LOG); + this.hangingSign(Items.ACACIA_HANGING_SIGN, Blocks.STRIPPED_ACACIA_LOG); + this.hangingSign(Items.CHERRY_HANGING_SIGN, Blocks.STRIPPED_CHERRY_LOG); + this.hangingSign(Items.DARK_OAK_HANGING_SIGN, Blocks.STRIPPED_DARK_OAK_LOG); + this.hangingSign(Items.MANGROVE_HANGING_SIGN, Blocks.STRIPPED_MANGROVE_LOG); + this.hangingSign(Items.BAMBOO_HANGING_SIGN, Items.STRIPPED_BAMBOO_BLOCK); + this.hangingSign(Items.CRIMSON_HANGING_SIGN, Blocks.STRIPPED_CRIMSON_STEM); + this.hangingSign(Items.WARPED_HANGING_SIGN, Blocks.STRIPPED_WARPED_STEM); + this.shaped(RecipeCategory.BUILDING_BLOCKS, Blocks.CHISELED_BOOKSHELF) .define('#', ItemTags.PLANKS) .define('X', ItemTags.WOODEN_SLABS) .pattern("###") .pattern("XXX") .pattern("###") - .unlockedBy("has_book", has(Items.BOOK)) - .save(recipeOutput); - oneToOneConversionRecipe(recipeOutput, Items.ORANGE_DYE, Blocks.TORCHFLOWER, "orange_dye"); - oneToOneConversionRecipe(recipeOutput, Items.CYAN_DYE, Blocks.PITCHER_PLANT, "cyan_dye", 2); - planksFromLog(recipeOutput, Blocks.CHERRY_PLANKS, ItemTags.CHERRY_LOGS, 4); - woodFromLogs(recipeOutput, Blocks.CHERRY_WOOD, Blocks.CHERRY_LOG); - woodFromLogs(recipeOutput, Blocks.STRIPPED_CHERRY_WOOD, Blocks.STRIPPED_CHERRY_LOG); - woodenBoat(recipeOutput, Items.CHERRY_BOAT, Blocks.CHERRY_PLANKS); - chestBoat(recipeOutput, Items.CHERRY_CHEST_BOAT, Items.CHERRY_BOAT); - oneToOneConversionRecipe(recipeOutput, Items.PINK_DYE, Items.PINK_PETALS, "pink_dye", 1); - ShapedRecipeBuilder.shaped(RecipeCategory.TOOLS, Items.BRUSH) + .unlockedBy("has_book", this.has(Items.BOOK)) + .save(this.output); + this.oneToOneConversionRecipe(Items.ORANGE_DYE, Blocks.TORCHFLOWER, "orange_dye"); + this.oneToOneConversionRecipe(Items.CYAN_DYE, Blocks.PITCHER_PLANT, "cyan_dye", 2); + this.planksFromLog(Blocks.CHERRY_PLANKS, ItemTags.CHERRY_LOGS, 4); + this.woodFromLogs(Blocks.CHERRY_WOOD, Blocks.CHERRY_LOG); + this.woodFromLogs(Blocks.STRIPPED_CHERRY_WOOD, Blocks.STRIPPED_CHERRY_LOG); + this.woodenBoat(Items.CHERRY_BOAT, Blocks.CHERRY_PLANKS); + this.chestBoat(Items.CHERRY_CHEST_BOAT, Items.CHERRY_BOAT); + this.oneToOneConversionRecipe(Items.PINK_DYE, Items.PINK_PETALS, "pink_dye", 1); + this.shaped(RecipeCategory.TOOLS, Items.BRUSH) .define('X', Items.FEATHER) .define('#', Items.COPPER_INGOT) .define('I', Items.STICK) .pattern("X") .pattern("#") .pattern("I") - .unlockedBy("has_copper_ingot", has(Items.COPPER_INGOT)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.DECORATIONS, Items.DECORATED_POT) + .unlockedBy("has_copper_ingot", this.has(Items.COPPER_INGOT)) + .save(this.output); + this.shaped(RecipeCategory.DECORATIONS, Items.DECORATED_POT) .define('#', Items.BRICK) .pattern(" # ") .pattern("# #") .pattern(" # ") - .unlockedBy("has_brick", has(ItemTags.DECORATED_POT_INGREDIENTS)) - .save(recipeOutput, "decorated_pot_simple"); - SpecialRecipeBuilder.special(DecoratedPotRecipe::new).save(recipeOutput, "decorated_pot"); - ShapedRecipeBuilder.shaped(RecipeCategory.REDSTONE, Blocks.CRAFTER) + .unlockedBy("has_brick", this.has(ItemTags.DECORATED_POT_INGREDIENTS)) + .save(this.output, "decorated_pot_simple"); + SpecialRecipeBuilder.special(DecoratedPotRecipe::new).save(this.output, "decorated_pot"); + this.shaped(RecipeCategory.REDSTONE, Blocks.CRAFTER) .define('#', Items.IRON_INGOT) .define('C', Items.CRAFTING_TABLE) .define('R', Items.REDSTONE) @@ -2651,89 +2627,99 @@ public class VanillaRecipeProvider extends RecipeProvider { .pattern("###") .pattern("#C#") .pattern("RDR") - .unlockedBy("has_dropper", has(Items.DROPPER)) - .save(recipeOutput); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.TUFF_SLAB, Blocks.TUFF, 2); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.TUFF_STAIRS, Blocks.TUFF); - stonecutterResultFromBase(recipeOutput, RecipeCategory.DECORATIONS, Blocks.TUFF_WALL, Blocks.TUFF); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.CHISELED_TUFF, Blocks.TUFF); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.POLISHED_TUFF, Blocks.TUFF); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.POLISHED_TUFF_SLAB, Blocks.TUFF, 2); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.POLISHED_TUFF_STAIRS, Blocks.TUFF); - stonecutterResultFromBase(recipeOutput, RecipeCategory.DECORATIONS, Blocks.POLISHED_TUFF_WALL, Blocks.TUFF); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.TUFF_BRICKS, Blocks.TUFF); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.TUFF_BRICK_SLAB, Blocks.TUFF, 2); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.TUFF_BRICK_STAIRS, Blocks.TUFF); - stonecutterResultFromBase(recipeOutput, RecipeCategory.DECORATIONS, Blocks.TUFF_BRICK_WALL, Blocks.TUFF); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.CHISELED_TUFF_BRICKS, Blocks.TUFF); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.POLISHED_TUFF_SLAB, Blocks.POLISHED_TUFF, 2); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.POLISHED_TUFF_STAIRS, Blocks.POLISHED_TUFF); - stonecutterResultFromBase(recipeOutput, RecipeCategory.DECORATIONS, Blocks.POLISHED_TUFF_WALL, Blocks.POLISHED_TUFF); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.TUFF_BRICKS, Blocks.POLISHED_TUFF); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.TUFF_BRICK_SLAB, Blocks.POLISHED_TUFF, 2); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.TUFF_BRICK_STAIRS, Blocks.POLISHED_TUFF); - stonecutterResultFromBase(recipeOutput, RecipeCategory.DECORATIONS, Blocks.TUFF_BRICK_WALL, Blocks.POLISHED_TUFF); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.CHISELED_TUFF_BRICKS, Blocks.POLISHED_TUFF); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.TUFF_BRICK_SLAB, Blocks.TUFF_BRICKS, 2); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.TUFF_BRICK_STAIRS, Blocks.TUFF_BRICKS); - stonecutterResultFromBase(recipeOutput, RecipeCategory.DECORATIONS, Blocks.TUFF_BRICK_WALL, Blocks.TUFF_BRICKS); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.CHISELED_TUFF_BRICKS, Blocks.TUFF_BRICKS); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.CHISELED_COPPER, Blocks.COPPER_BLOCK, 4); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.EXPOSED_CHISELED_COPPER, Blocks.EXPOSED_COPPER, 4); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.WEATHERED_CHISELED_COPPER, Blocks.WEATHERED_COPPER, 4); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.OXIDIZED_CHISELED_COPPER, Blocks.OXIDIZED_COPPER, 4); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.WAXED_CHISELED_COPPER, Blocks.WAXED_COPPER_BLOCK, 4); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.WAXED_EXPOSED_CHISELED_COPPER, Blocks.WAXED_EXPOSED_COPPER, 4); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.WAXED_WEATHERED_CHISELED_COPPER, Blocks.WAXED_WEATHERED_COPPER, 4); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.WAXED_OXIDIZED_CHISELED_COPPER, Blocks.WAXED_OXIDIZED_COPPER, 4); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.CHISELED_COPPER, Blocks.CUT_COPPER, 1); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.EXPOSED_CHISELED_COPPER, Blocks.EXPOSED_CUT_COPPER, 1); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.WEATHERED_CHISELED_COPPER, Blocks.WEATHERED_CUT_COPPER, 1); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.OXIDIZED_CHISELED_COPPER, Blocks.OXIDIZED_CUT_COPPER, 1); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.WAXED_CHISELED_COPPER, Blocks.WAXED_CUT_COPPER, 1); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.WAXED_EXPOSED_CHISELED_COPPER, Blocks.WAXED_EXPOSED_CUT_COPPER, 1); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.WAXED_WEATHERED_CHISELED_COPPER, Blocks.WAXED_WEATHERED_CUT_COPPER, 1); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.WAXED_OXIDIZED_CHISELED_COPPER, Blocks.WAXED_OXIDIZED_CUT_COPPER, 1); - grate(recipeOutput, Blocks.COPPER_GRATE, Blocks.COPPER_BLOCK); - grate(recipeOutput, Blocks.EXPOSED_COPPER_GRATE, Blocks.EXPOSED_COPPER); - grate(recipeOutput, Blocks.WEATHERED_COPPER_GRATE, Blocks.WEATHERED_COPPER); - grate(recipeOutput, Blocks.OXIDIZED_COPPER_GRATE, Blocks.OXIDIZED_COPPER); - grate(recipeOutput, Blocks.WAXED_COPPER_GRATE, Blocks.WAXED_COPPER_BLOCK); - grate(recipeOutput, Blocks.WAXED_EXPOSED_COPPER_GRATE, Blocks.WAXED_EXPOSED_COPPER); - grate(recipeOutput, Blocks.WAXED_WEATHERED_COPPER_GRATE, Blocks.WAXED_WEATHERED_COPPER); - grate(recipeOutput, Blocks.WAXED_OXIDIZED_COPPER_GRATE, Blocks.WAXED_OXIDIZED_COPPER); - copperBulb(recipeOutput, Blocks.COPPER_BULB, Blocks.COPPER_BLOCK); - copperBulb(recipeOutput, Blocks.EXPOSED_COPPER_BULB, Blocks.EXPOSED_COPPER); - copperBulb(recipeOutput, Blocks.WEATHERED_COPPER_BULB, Blocks.WEATHERED_COPPER); - copperBulb(recipeOutput, Blocks.OXIDIZED_COPPER_BULB, Blocks.OXIDIZED_COPPER); - copperBulb(recipeOutput, Blocks.WAXED_COPPER_BULB, Blocks.WAXED_COPPER_BLOCK); - copperBulb(recipeOutput, Blocks.WAXED_EXPOSED_COPPER_BULB, Blocks.WAXED_EXPOSED_COPPER); - copperBulb(recipeOutput, Blocks.WAXED_WEATHERED_COPPER_BULB, Blocks.WAXED_WEATHERED_COPPER); - copperBulb(recipeOutput, Blocks.WAXED_OXIDIZED_COPPER_BULB, Blocks.WAXED_OXIDIZED_COPPER); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.COPPER_GRATE, Blocks.COPPER_BLOCK, 4); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.EXPOSED_COPPER_GRATE, Blocks.EXPOSED_COPPER, 4); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.WEATHERED_COPPER_GRATE, Blocks.WEATHERED_COPPER, 4); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.OXIDIZED_COPPER_GRATE, Blocks.OXIDIZED_COPPER, 4); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.WAXED_COPPER_GRATE, Blocks.WAXED_COPPER_BLOCK, 4); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.WAXED_EXPOSED_COPPER_GRATE, Blocks.WAXED_EXPOSED_COPPER, 4); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.WAXED_WEATHERED_COPPER_GRATE, Blocks.WAXED_WEATHERED_COPPER, 4); - stonecutterResultFromBase(recipeOutput, RecipeCategory.BUILDING_BLOCKS, Blocks.WAXED_OXIDIZED_COPPER_GRATE, Blocks.WAXED_OXIDIZED_COPPER, 4); - ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, Items.WIND_CHARGE, 4) + .unlockedBy("has_dropper", this.has(Items.DROPPER)) + .save(this.output); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.TUFF_SLAB, Blocks.TUFF, 2); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.TUFF_STAIRS, Blocks.TUFF); + this.stonecutterResultFromBase(RecipeCategory.DECORATIONS, Blocks.TUFF_WALL, Blocks.TUFF); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.CHISELED_TUFF, Blocks.TUFF); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.POLISHED_TUFF, Blocks.TUFF); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.POLISHED_TUFF_SLAB, Blocks.TUFF, 2); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.POLISHED_TUFF_STAIRS, Blocks.TUFF); + this.stonecutterResultFromBase(RecipeCategory.DECORATIONS, Blocks.POLISHED_TUFF_WALL, Blocks.TUFF); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.TUFF_BRICKS, Blocks.TUFF); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.TUFF_BRICK_SLAB, Blocks.TUFF, 2); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.TUFF_BRICK_STAIRS, Blocks.TUFF); + this.stonecutterResultFromBase(RecipeCategory.DECORATIONS, Blocks.TUFF_BRICK_WALL, Blocks.TUFF); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.CHISELED_TUFF_BRICKS, Blocks.TUFF); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.POLISHED_TUFF_SLAB, Blocks.POLISHED_TUFF, 2); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.POLISHED_TUFF_STAIRS, Blocks.POLISHED_TUFF); + this.stonecutterResultFromBase(RecipeCategory.DECORATIONS, Blocks.POLISHED_TUFF_WALL, Blocks.POLISHED_TUFF); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.TUFF_BRICKS, Blocks.POLISHED_TUFF); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.TUFF_BRICK_SLAB, Blocks.POLISHED_TUFF, 2); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.TUFF_BRICK_STAIRS, Blocks.POLISHED_TUFF); + this.stonecutterResultFromBase(RecipeCategory.DECORATIONS, Blocks.TUFF_BRICK_WALL, Blocks.POLISHED_TUFF); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.CHISELED_TUFF_BRICKS, Blocks.POLISHED_TUFF); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.TUFF_BRICK_SLAB, Blocks.TUFF_BRICKS, 2); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.TUFF_BRICK_STAIRS, Blocks.TUFF_BRICKS); + this.stonecutterResultFromBase(RecipeCategory.DECORATIONS, Blocks.TUFF_BRICK_WALL, Blocks.TUFF_BRICKS); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.CHISELED_TUFF_BRICKS, Blocks.TUFF_BRICKS); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.CHISELED_COPPER, Blocks.COPPER_BLOCK, 4); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.EXPOSED_CHISELED_COPPER, Blocks.EXPOSED_COPPER, 4); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.WEATHERED_CHISELED_COPPER, Blocks.WEATHERED_COPPER, 4); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.OXIDIZED_CHISELED_COPPER, Blocks.OXIDIZED_COPPER, 4); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.WAXED_CHISELED_COPPER, Blocks.WAXED_COPPER_BLOCK, 4); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.WAXED_EXPOSED_CHISELED_COPPER, Blocks.WAXED_EXPOSED_COPPER, 4); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.WAXED_WEATHERED_CHISELED_COPPER, Blocks.WAXED_WEATHERED_COPPER, 4); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.WAXED_OXIDIZED_CHISELED_COPPER, Blocks.WAXED_OXIDIZED_COPPER, 4); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.CHISELED_COPPER, Blocks.CUT_COPPER, 1); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.EXPOSED_CHISELED_COPPER, Blocks.EXPOSED_CUT_COPPER, 1); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.WEATHERED_CHISELED_COPPER, Blocks.WEATHERED_CUT_COPPER, 1); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.OXIDIZED_CHISELED_COPPER, Blocks.OXIDIZED_CUT_COPPER, 1); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.WAXED_CHISELED_COPPER, Blocks.WAXED_CUT_COPPER, 1); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.WAXED_EXPOSED_CHISELED_COPPER, Blocks.WAXED_EXPOSED_CUT_COPPER, 1); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.WAXED_WEATHERED_CHISELED_COPPER, Blocks.WAXED_WEATHERED_CUT_COPPER, 1); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.WAXED_OXIDIZED_CHISELED_COPPER, Blocks.WAXED_OXIDIZED_CUT_COPPER, 1); + this.grate(Blocks.COPPER_GRATE, Blocks.COPPER_BLOCK); + this.grate(Blocks.EXPOSED_COPPER_GRATE, Blocks.EXPOSED_COPPER); + this.grate(Blocks.WEATHERED_COPPER_GRATE, Blocks.WEATHERED_COPPER); + this.grate(Blocks.OXIDIZED_COPPER_GRATE, Blocks.OXIDIZED_COPPER); + this.grate(Blocks.WAXED_COPPER_GRATE, Blocks.WAXED_COPPER_BLOCK); + this.grate(Blocks.WAXED_EXPOSED_COPPER_GRATE, Blocks.WAXED_EXPOSED_COPPER); + this.grate(Blocks.WAXED_WEATHERED_COPPER_GRATE, Blocks.WAXED_WEATHERED_COPPER); + this.grate(Blocks.WAXED_OXIDIZED_COPPER_GRATE, Blocks.WAXED_OXIDIZED_COPPER); + this.copperBulb(Blocks.COPPER_BULB, Blocks.COPPER_BLOCK); + this.copperBulb(Blocks.EXPOSED_COPPER_BULB, Blocks.EXPOSED_COPPER); + this.copperBulb(Blocks.WEATHERED_COPPER_BULB, Blocks.WEATHERED_COPPER); + this.copperBulb(Blocks.OXIDIZED_COPPER_BULB, Blocks.OXIDIZED_COPPER); + this.copperBulb(Blocks.WAXED_COPPER_BULB, Blocks.WAXED_COPPER_BLOCK); + this.copperBulb(Blocks.WAXED_EXPOSED_COPPER_BULB, Blocks.WAXED_EXPOSED_COPPER); + this.copperBulb(Blocks.WAXED_WEATHERED_COPPER_BULB, Blocks.WAXED_WEATHERED_COPPER); + this.copperBulb(Blocks.WAXED_OXIDIZED_COPPER_BULB, Blocks.WAXED_OXIDIZED_COPPER); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.COPPER_GRATE, Blocks.COPPER_BLOCK, 4); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.EXPOSED_COPPER_GRATE, Blocks.EXPOSED_COPPER, 4); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.WEATHERED_COPPER_GRATE, Blocks.WEATHERED_COPPER, 4); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.OXIDIZED_COPPER_GRATE, Blocks.OXIDIZED_COPPER, 4); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.WAXED_COPPER_GRATE, Blocks.WAXED_COPPER_BLOCK, 4); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.WAXED_EXPOSED_COPPER_GRATE, Blocks.WAXED_EXPOSED_COPPER, 4); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.WAXED_WEATHERED_COPPER_GRATE, Blocks.WAXED_WEATHERED_COPPER, 4); + this.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.WAXED_OXIDIZED_COPPER_GRATE, Blocks.WAXED_OXIDIZED_COPPER, 4); + this.shapeless(RecipeCategory.MISC, Items.WIND_CHARGE, 4) .requires(Items.BREEZE_ROD) - .unlockedBy("has_breeze_rod", has(Items.BREEZE_ROD)) - .save(recipeOutput); - ShapedRecipeBuilder.shaped(RecipeCategory.COMBAT, Items.MACE, 1) + .unlockedBy("has_breeze_rod", this.has(Items.BREEZE_ROD)) + .save(this.output); + this.shaped(RecipeCategory.COMBAT, Items.MACE, 1) .define('I', Items.BREEZE_ROD) .define('#', Blocks.HEAVY_CORE) .pattern(" # ") .pattern(" I ") - .unlockedBy("has_breeze_rod", has(Items.BREEZE_ROD)) - .unlockedBy("has_heavy_core", has(Blocks.HEAVY_CORE)) - .save(recipeOutput); - doorBuilder(Blocks.COPPER_DOOR, Ingredient.of(Items.COPPER_INGOT)).unlockedBy(getHasName(Items.COPPER_INGOT), has(Items.COPPER_INGOT)).save(recipeOutput); - trapdoorBuilder(Blocks.COPPER_TRAPDOOR, Ingredient.of(Items.COPPER_INGOT)) - .unlockedBy(getHasName(Items.COPPER_INGOT), has(Items.COPPER_INGOT)) - .save(recipeOutput); + .unlockedBy("has_breeze_rod", this.has(Items.BREEZE_ROD)) + .unlockedBy("has_heavy_core", this.has(Blocks.HEAVY_CORE)) + .save(this.output); + this.doorBuilder(Blocks.COPPER_DOOR, Ingredient.of(Items.COPPER_INGOT)) + .unlockedBy(getHasName(Items.COPPER_INGOT), this.has(Items.COPPER_INGOT)) + .save(this.output); + this.trapdoorBuilder(Blocks.COPPER_TRAPDOOR, Ingredient.of(Items.COPPER_INGOT)) + .unlockedBy(getHasName(Items.COPPER_INGOT), this.has(Items.COPPER_INGOT)) + .save(this.output); + this.shaped(RecipeCategory.TOOLS, Items.BUNDLE) + .define('-', Items.STRING) + .define('#', Items.LEATHER) + .pattern("-") + .pattern("#") + .unlockedBy("has_string", this.has(Items.STRING)) + .save(this.output); + this.bundleRecipes(); } public static Stream smithingTrims() { @@ -2757,9 +2743,54 @@ public class VanillaRecipeProvider extends RecipeProvider { Items.WAYFINDER_ARMOR_TRIM_SMITHING_TEMPLATE, Items.WILD_ARMOR_TRIM_SMITHING_TEMPLATE ) - .map(item -> new VanillaRecipeProvider.TrimTemplate(item, ResourceLocation.withDefaultNamespace(getItemName(item) + "_smithing_trim"))); + .map( + item -> new VanillaRecipeProvider.TrimTemplate( + item, ResourceKey.create(Registries.RECIPE, ResourceLocation.withDefaultNamespace(getItemName(item) + "_smithing_trim")) + ) + ); } - public record TrimTemplate(Item template, ResourceLocation id) { + private void shulkerBoxRecipes() { + Ingredient ingredient = this.tag(ItemTags.SHULKER_BOXES); + + for (DyeColor dyeColor : DyeColor.values()) { + TransmuteRecipeBuilder.transmute( + RecipeCategory.DECORATIONS, ingredient, Ingredient.of(DyeItem.byColor(dyeColor)), ShulkerBoxBlock.getBlockByColor(dyeColor).asItem() + ) + .group("shulker_box_dye") + .unlockedBy("has_shulker_box", this.has(ItemTags.SHULKER_BOXES)) + .save(this.output); + } + } + + private void bundleRecipes() { + Ingredient ingredient = this.tag(ItemTags.BUNDLES); + + for (DyeColor dyeColor : DyeColor.values()) { + DyeItem dyeItem = DyeItem.byColor(dyeColor); + TransmuteRecipeBuilder.transmute(RecipeCategory.TOOLS, ingredient, Ingredient.of(dyeItem), BundleItem.getByColor(dyeColor)) + .group("bundle_dye") + .unlockedBy(getHasName(dyeItem), this.has(dyeItem)) + .save(this.output); + } + } + + public static class Runner extends RecipeProvider.Runner { + public Runner(PackOutput packOutput, CompletableFuture completableFuture) { + super(packOutput, completableFuture); + } + + @Override + protected RecipeProvider createRecipeProvider(HolderLookup.Provider provider, RecipeOutput recipeOutput) { + return new VanillaRecipeProvider(provider, recipeOutput); + } + + @Override + public String getName() { + return "Vanilla Recipes"; + } + } + + public record TrimTemplate(Item template, ResourceKey> id) { } } diff --git a/net/minecraft/data/recipes/packs/WinterDropRecipeProvider.java b/net/minecraft/data/recipes/packs/WinterDropRecipeProvider.java new file mode 100644 index 00000000..0e117c9d --- /dev/null +++ b/net/minecraft/data/recipes/packs/WinterDropRecipeProvider.java @@ -0,0 +1,46 @@ +package net.minecraft.data.recipes.packs; + +import java.util.concurrent.CompletableFuture; +import net.minecraft.core.HolderLookup; +import net.minecraft.data.PackOutput; +import net.minecraft.data.recipes.RecipeOutput; +import net.minecraft.data.recipes.RecipeProvider; +import net.minecraft.tags.ItemTags; +import net.minecraft.world.flag.FeatureFlagSet; +import net.minecraft.world.flag.FeatureFlags; +import net.minecraft.world.item.Items; +import net.minecraft.world.level.block.Blocks; + +public class WinterDropRecipeProvider extends RecipeProvider { + public WinterDropRecipeProvider(HolderLookup.Provider provider, RecipeOutput recipeOutput) { + super(provider, recipeOutput); + } + + @Override + protected void buildRecipes() { + this.generateForEnabledBlockFamilies(FeatureFlagSet.of(FeatureFlags.WINTER_DROP)); + this.hangingSign(Items.PALE_OAK_HANGING_SIGN, Blocks.STRIPPED_PALE_OAK_LOG); + this.planksFromLog(Blocks.PALE_OAK_PLANKS, ItemTags.PALE_OAK_LOGS, 4); + this.woodFromLogs(Blocks.PALE_OAK_WOOD, Blocks.PALE_OAK_LOG); + this.woodFromLogs(Blocks.STRIPPED_PALE_OAK_WOOD, Blocks.STRIPPED_PALE_OAK_LOG); + this.woodenBoat(Items.PALE_OAK_BOAT, Blocks.PALE_OAK_PLANKS); + this.chestBoat(Items.PALE_OAK_CHEST_BOAT, Items.PALE_OAK_BOAT); + this.carpet(Blocks.PALE_MOSS_CARPET, Blocks.PALE_MOSS_BLOCK); + } + + public static class Runner extends RecipeProvider.Runner { + public Runner(PackOutput packOutput, CompletableFuture completableFuture) { + super(packOutput, completableFuture); + } + + @Override + protected RecipeProvider createRecipeProvider(HolderLookup.Provider provider, RecipeOutput recipeOutput) { + return new WinterDropRecipeProvider(provider, recipeOutput); + } + + @Override + public String getName() { + return "Winter Drop Recipes"; + } + } +} diff --git a/net/minecraft/data/registries/RegistriesDatapackGenerator.java b/net/minecraft/data/registries/RegistriesDatapackGenerator.java index a41147be..55065a56 100644 --- a/net/minecraft/data/registries/RegistriesDatapackGenerator.java +++ b/net/minecraft/data/registries/RegistriesDatapackGenerator.java @@ -12,6 +12,7 @@ import net.minecraft.core.Registry; import net.minecraft.data.CachedOutput; import net.minecraft.data.DataProvider; import net.minecraft.data.PackOutput; +import net.minecraft.data.PackOutput.PathProvider; import net.minecraft.resources.RegistryDataLoader; import net.minecraft.resources.ResourceKey; @@ -47,7 +48,7 @@ public class RegistriesDatapackGenerator implements DataProvider { return registries.lookup(resourceKey) .map( registryLookup -> { - PackOutput.PathProvider pathProvider = this.output.createRegistryElementsPathProvider(resourceKey); + PathProvider pathProvider = this.output.createRegistryElementsPathProvider(resourceKey); return CompletableFuture.allOf( (CompletableFuture[])registryLookup.listElements() .map(reference -> dumpValue(pathProvider.json(reference.key().location()), output, ops, registryData.elementCodec(), (T)reference.value())) diff --git a/net/minecraft/data/registries/RegistryPatchGenerator.java b/net/minecraft/data/registries/RegistryPatchGenerator.java index 02a35224..1cfe8832 100644 --- a/net/minecraft/data/registries/RegistryPatchGenerator.java +++ b/net/minecraft/data/registries/RegistryPatchGenerator.java @@ -1,12 +1,12 @@ package net.minecraft.data.registries; +import com.mojang.datafixers.DataFixUtils; import java.util.Optional; import java.util.concurrent.CompletableFuture; -import net.minecraft.core.Cloner; -import net.minecraft.core.HolderGetter; import net.minecraft.core.HolderLookup; import net.minecraft.core.RegistryAccess; import net.minecraft.core.RegistrySetBuilder; +import net.minecraft.core.Cloner.Factory; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.core.registries.Registries; import net.minecraft.resources.RegistryDataLoader; @@ -20,16 +20,16 @@ public class RegistryPatchGenerator { return lookup.thenApply( provider -> { RegistryAccess.Frozen frozen = RegistryAccess.fromRegistryOfRegistries(BuiltInRegistries.REGISTRY); - Cloner.Factory factory = new Cloner.Factory(); + Factory factory = new Factory(); RegistryDataLoader.WORLDGEN_REGISTRIES.forEach(registryData -> registryData.runWithArguments(factory::addCodec)); RegistrySetBuilder.PatchedRegistries patchedRegistries = registrySetBuilder.buildPatch(frozen, provider, factory); HolderLookup.Provider provider2 = patchedRegistries.full(); - Optional> optional = provider2.lookup(Registries.BIOME); - Optional> optional2 = provider2.lookup(Registries.PLACED_FEATURE); + Optional> optional = provider2.lookup(Registries.BIOME); + Optional> optional2 = provider2.lookup(Registries.PLACED_FEATURE); if (optional.isPresent() || optional2.isPresent()) { VanillaRegistries.validateThatAllBiomeFeaturesHaveBiomeFilter( - (HolderGetter)optional2.orElseGet(() -> provider.lookupOrThrow(Registries.PLACED_FEATURE)), - (HolderLookup)optional.orElseGet(() -> provider.lookupOrThrow(Registries.BIOME)) + DataFixUtils.orElseGet(optional2, () -> provider.lookupOrThrow(Registries.PLACED_FEATURE)), + DataFixUtils.orElseGet(optional, () -> provider.lookupOrThrow(Registries.BIOME)) ); } diff --git a/net/minecraft/data/registries/VanillaRegistries.java b/net/minecraft/data/registries/VanillaRegistries.java index 9f2b1610..f32f984c 100644 --- a/net/minecraft/data/registries/VanillaRegistries.java +++ b/net/minecraft/data/registries/VanillaRegistries.java @@ -25,14 +25,16 @@ import net.minecraft.resources.ResourceLocation; import net.minecraft.world.damagesource.DamageTypes; import net.minecraft.world.entity.animal.WolfVariants; import net.minecraft.world.entity.decoration.PaintingVariants; +import net.minecraft.world.item.Instruments; import net.minecraft.world.item.JukeboxSongs; -import net.minecraft.world.item.armortrim.TrimMaterials; -import net.minecraft.world.item.armortrim.TrimPatterns; import net.minecraft.world.item.enchantment.Enchantments; import net.minecraft.world.item.enchantment.providers.VanillaEnchantmentProviders; +import net.minecraft.world.item.equipment.trim.TrimMaterials; +import net.minecraft.world.item.equipment.trim.TrimPatterns; import net.minecraft.world.level.biome.Biome; import net.minecraft.world.level.biome.MultiNoiseBiomeSourceParameterLists; import net.minecraft.world.level.block.entity.BannerPatterns; +import net.minecraft.world.level.block.entity.trialspawner.TrialSpawnerConfigs; import net.minecraft.world.level.levelgen.NoiseGeneratorSettings; import net.minecraft.world.level.levelgen.NoiseRouterData; import net.minecraft.world.level.levelgen.flat.FlatLevelGeneratorPresets; @@ -60,13 +62,15 @@ public class VanillaRegistries { .add(Registries.CHAT_TYPE, ChatType::bootstrap) .add(Registries.TRIM_PATTERN, TrimPatterns::bootstrap) .add(Registries.TRIM_MATERIAL, TrimMaterials::bootstrap) + .add(Registries.TRIAL_SPAWNER_CONFIG, TrialSpawnerConfigs::bootstrap) .add(Registries.WOLF_VARIANT, WolfVariants::bootstrap) .add(Registries.PAINTING_VARIANT, PaintingVariants::bootstrap) .add(Registries.DAMAGE_TYPE, DamageTypes::bootstrap) .add(Registries.BANNER_PATTERN, BannerPatterns::bootstrap) .add(Registries.ENCHANTMENT, Enchantments::bootstrap) .add(Registries.ENCHANTMENT_PROVIDER, VanillaEnchantmentProviders::bootstrap) - .add(Registries.JUKEBOX_SONG, JukeboxSongs::bootstrap); + .add(Registries.JUKEBOX_SONG, JukeboxSongs::bootstrap) + .add(Registries.INSTRUMENT, Instruments::bootstrap); private static void validateThatAllBiomeFeaturesHaveBiomeFilter(HolderLookup.Provider provider) { validateThatAllBiomeFeaturesHaveBiomeFilter(provider.lookupOrThrow(Registries.PLACED_FEATURE), provider.lookupOrThrow(Registries.BIOME)); diff --git a/net/minecraft/data/registries/WinterDropRegistries.java b/net/minecraft/data/registries/WinterDropRegistries.java new file mode 100644 index 00000000..324a97d0 --- /dev/null +++ b/net/minecraft/data/registries/WinterDropRegistries.java @@ -0,0 +1,26 @@ +package net.minecraft.data.registries; + +import java.util.concurrent.CompletableFuture; +import net.minecraft.core.HolderLookup; +import net.minecraft.core.RegistrySetBuilder; +import net.minecraft.core.registries.Registries; +import net.minecraft.data.worldgen.WinterDropBiomes; +import net.minecraft.world.level.biome.MultiNoiseBiomeSourceParameterLists; + +public class WinterDropRegistries { + private static final RegistrySetBuilder BUILDER = new RegistrySetBuilder() + .add(Registries.BIOME, WinterDropBiomes::bootstrap) + .add(Registries.MULTI_NOISE_BIOME_SOURCE_PARAMETER_LIST, MultiNoiseBiomeSourceParameterLists::winterDrop); + + public static CompletableFuture createLookup(CompletableFuture completableFuture) { + return RegistryPatchGenerator.createLookup(completableFuture, BUILDER) + .thenApply( + patchedRegistries -> { + VanillaRegistries.validateThatAllBiomeFeaturesHaveBiomeFilter( + patchedRegistries.full().lookupOrThrow(Registries.PLACED_FEATURE), patchedRegistries.full().lookupOrThrow(Registries.BIOME) + ); + return patchedRegistries; + } + ); + } +} diff --git a/net/minecraft/data/structures/NbtToSnbt.java b/net/minecraft/data/structures/NbtToSnbt.java index 743c59d4..8a7ba6f6 100644 --- a/net/minecraft/data/structures/NbtToSnbt.java +++ b/net/minecraft/data/structures/NbtToSnbt.java @@ -76,7 +76,7 @@ public class NbtToSnbt implements DataProvider { return CompletableFuture.completedFuture(null); } }, - Util.backgroundExecutor() + Util.backgroundExecutor().forName("NbtToSnbt") ) .thenCompose(completableFuture -> completableFuture) ); diff --git a/net/minecraft/data/structures/SnbtToNbt.java b/net/minecraft/data/structures/SnbtToNbt.java index 66f25302..1fecd018 100644 --- a/net/minecraft/data/structures/SnbtToNbt.java +++ b/net/minecraft/data/structures/SnbtToNbt.java @@ -67,7 +67,7 @@ public class SnbtToNbt implements DataProvider { (CompletableFuture[])stream.filter(pathxx -> pathxx.toString().endsWith(".snbt")).map(path3 -> CompletableFuture.runAsync(() -> { SnbtToNbt.TaskResult taskResult = this.readStructure(path3, this.getName(path2, path3)); this.storeStructureIfChanged(output, taskResult, path); - }, Util.backgroundExecutor())).toArray(CompletableFuture[]::new) + }, Util.backgroundExecutor().forName("SnbtToNbt"))).toArray(CompletableFuture[]::new) ); } catch (Throwable var8) { if (stream != null) { @@ -90,7 +90,7 @@ public class SnbtToNbt implements DataProvider { throw new RuntimeException("Failed to read structure input directory, aborting", var9); } }, - Util.backgroundExecutor() + Util.backgroundExecutor().forName("SnbtToNbt") ) .thenCompose(completableFuture -> completableFuture) ); diff --git a/net/minecraft/data/structures/StructureUpdater.java b/net/minecraft/data/structures/StructureUpdater.java index e4ff514d..fa53239c 100644 --- a/net/minecraft/data/structures/StructureUpdater.java +++ b/net/minecraft/data/structures/StructureUpdater.java @@ -22,13 +22,13 @@ public class StructureUpdater implements SnbtToNbt.Filter { public static CompoundTag update(String structureLocationPath, CompoundTag tag) { StructureTemplate structureTemplate = new StructureTemplate(); int i = NbtUtils.getDataVersion(tag, 500); - int j = 3937; - if (i < 3937) { - LOGGER.warn("SNBT Too old, do not forget to update: {} < {}: {}", i, 3937, structureLocationPath); + int j = 4053; + if (i < 4053) { + LOGGER.warn("SNBT Too old, do not forget to update: {} < {}: {}", i, 4053, structureLocationPath); } CompoundTag compoundTag = DataFixTypes.STRUCTURE.updateToCurrentVersion(DataFixers.getDataFixer(), tag, i); - structureTemplate.load(BuiltInRegistries.BLOCK.asLookup(), compoundTag); + structureTemplate.load(BuiltInRegistries.BLOCK, compoundTag); return structureTemplate.save(new CompoundTag()); } } diff --git a/net/minecraft/data/tags/BannerPatternTagsProvider.java b/net/minecraft/data/tags/BannerPatternTagsProvider.java index d59bbba8..7f9bfeb4 100644 --- a/net/minecraft/data/tags/BannerPatternTagsProvider.java +++ b/net/minecraft/data/tags/BannerPatternTagsProvider.java @@ -47,10 +47,8 @@ public class BannerPatternTagsProvider extends TagsProvider { BannerPatterns.HALF_VERTICAL_MIRROR, BannerPatterns.HALF_HORIZONTAL_MIRROR, BannerPatterns.BORDER, - BannerPatterns.CURLY_BORDER, BannerPatterns.GRADIENT, - BannerPatterns.GRADIENT_UP, - BannerPatterns.BRICKS + BannerPatterns.GRADIENT_UP ); this.tag(BannerPatternTags.PATTERN_ITEM_FLOWER).add(BannerPatterns.FLOWER); this.tag(BannerPatternTags.PATTERN_ITEM_CREEPER).add(BannerPatterns.CREEPER); @@ -60,5 +58,7 @@ public class BannerPatternTagsProvider extends TagsProvider { this.tag(BannerPatternTags.PATTERN_ITEM_PIGLIN).add(BannerPatterns.PIGLIN); this.tag(BannerPatternTags.PATTERN_ITEM_FLOW).add(BannerPatterns.FLOW); this.tag(BannerPatternTags.PATTERN_ITEM_GUSTER).add(BannerPatterns.GUSTER); + this.tag(BannerPatternTags.PATTERN_ITEM_FIELD_MASONED).add(BannerPatterns.BRICKS); + this.tag(BannerPatternTags.PATTERN_ITEM_BORDURE_INDENTED).add(BannerPatterns.CURLY_BORDER); } } diff --git a/net/minecraft/data/tags/DamageTypeTagsProvider.java b/net/minecraft/data/tags/DamageTypeTagsProvider.java index 5d6a3c1a..ff84bf84 100644 --- a/net/minecraft/data/tags/DamageTypeTagsProvider.java +++ b/net/minecraft/data/tags/DamageTypeTagsProvider.java @@ -28,6 +28,7 @@ public class DamageTypeTagsProvider extends TagsProvider { DamageTypes.DRAGON_BREATH, DamageTypes.STARVE, DamageTypes.FALL, + DamageTypes.ENDER_PEARL, DamageTypes.FREEZE, DamageTypes.STALAGMITE, DamageTypes.MAGIC, @@ -65,7 +66,7 @@ public class DamageTypeTagsProvider extends TagsProvider { ); this.tag(DamageTypeTags.WITCH_RESISTANT_TO).add(DamageTypes.MAGIC, DamageTypes.INDIRECT_MAGIC, DamageTypes.SONIC_BOOM, DamageTypes.THORNS); this.tag(DamageTypeTags.IS_EXPLOSION).add(DamageTypes.FIREWORKS, DamageTypes.EXPLOSION, DamageTypes.PLAYER_EXPLOSION, DamageTypes.BAD_RESPAWN_POINT); - this.tag(DamageTypeTags.IS_FALL).add(DamageTypes.FALL, DamageTypes.STALAGMITE); + this.tag(DamageTypeTags.IS_FALL).add(DamageTypes.FALL, DamageTypes.ENDER_PEARL, DamageTypes.STALAGMITE); this.tag(DamageTypeTags.IS_DROWNING).add(DamageTypes.DROWN); this.tag(DamageTypeTags.IS_FREEZING).add(DamageTypes.FREEZE); this.tag(DamageTypeTags.IS_LIGHTNING).add(DamageTypes.LIGHTNING_BOLT); @@ -94,6 +95,7 @@ public class DamageTypeTagsProvider extends TagsProvider { DamageTypes.STARVE, DamageTypes.CACTUS, DamageTypes.FALL, + DamageTypes.ENDER_PEARL, DamageTypes.FLY_INTO_WALL, DamageTypes.FELL_OUT_OF_WORLD, DamageTypes.GENERIC, @@ -110,7 +112,7 @@ public class DamageTypeTagsProvider extends TagsProvider { ); this.tag(DamageTypeTags.ALWAYS_KILLS_ARMOR_STANDS) .add(DamageTypes.ARROW, DamageTypes.TRIDENT, DamageTypes.FIREBALL, DamageTypes.WITHER_SKULL, DamageTypes.WIND_CHARGE); - this.tag(DamageTypeTags.CAN_BREAK_ARMOR_STAND).add(DamageTypes.PLAYER_ATTACK, DamageTypes.PLAYER_EXPLOSION); + this.tag(DamageTypeTags.CAN_BREAK_ARMOR_STAND).add(DamageTypes.PLAYER_EXPLOSION).addTag(DamageTypeTags.IS_PLAYER_ATTACK); this.tag(DamageTypeTags.BYPASSES_WOLF_ARMOR) .addTag(DamageTypeTags.BYPASSES_INVULNERABILITY) .add( @@ -126,7 +128,7 @@ public class DamageTypeTagsProvider extends TagsProvider { DamageTypes.THORNS, DamageTypes.WITHER ); - this.tag(DamageTypeTags.IS_PLAYER_ATTACK).add(DamageTypes.PLAYER_ATTACK); + this.tag(DamageTypeTags.IS_PLAYER_ATTACK).add(DamageTypes.PLAYER_ATTACK, DamageTypes.MACE_SMASH); this.tag(DamageTypeTags.BURN_FROM_STEPPING).add(DamageTypes.CAMPFIRE, DamageTypes.HOT_FLOOR); this.tag(DamageTypeTags.PANIC_ENVIRONMENTAL_CAUSES) .add(DamageTypes.CACTUS, DamageTypes.FREEZE, DamageTypes.HOT_FLOOR, DamageTypes.IN_FIRE, DamageTypes.LAVA, DamageTypes.LIGHTNING_BOLT, DamageTypes.ON_FIRE); @@ -142,7 +144,6 @@ public class DamageTypeTagsProvider extends TagsProvider { DamageTypes.MAGIC, DamageTypes.MOB_ATTACK, DamageTypes.MOB_PROJECTILE, - DamageTypes.PLAYER_ATTACK, DamageTypes.PLAYER_EXPLOSION, DamageTypes.SONIC_BOOM, DamageTypes.STING, @@ -152,6 +153,8 @@ public class DamageTypeTagsProvider extends TagsProvider { DamageTypes.WIND_CHARGE, DamageTypes.WITHER, DamageTypes.WITHER_SKULL - ); + ) + .addTag(DamageTypeTags.IS_PLAYER_ATTACK); + this.tag(DamageTypeTags.IS_MACE_SMASH).add(DamageTypes.MACE_SMASH); } } diff --git a/net/minecraft/data/tags/EntityTypeTagsProvider.java b/net/minecraft/data/tags/EntityTypeTagsProvider.java index 3b34b1dc..82a4f726 100644 --- a/net/minecraft/data/tags/EntityTypeTagsProvider.java +++ b/net/minecraft/data/tags/EntityTypeTagsProvider.java @@ -153,5 +153,17 @@ public class EntityTypeTagsProvider extends IntrinsicHolderTagsProvider implements DataProvider { - protected final PackOutput.PathProvider pathProvider; + protected final PathProvider pathProvider; private final CompletableFuture lookupProvider; private final CompletableFuture contentsDone = new CompletableFuture(); private final CompletableFuture> parentProvider; diff --git a/net/minecraft/data/tags/VanillaBlockTagsProvider.java b/net/minecraft/data/tags/VanillaBlockTagsProvider.java index 74f35447..850d7184 100644 --- a/net/minecraft/data/tags/VanillaBlockTagsProvider.java +++ b/net/minecraft/data/tags/VanillaBlockTagsProvider.java @@ -1598,6 +1598,7 @@ public class VanillaBlockTagsProvider extends IntrinsicHolderTagsProvider this.tag(BlockTags.FOXES_SPAWNABLE_ON).add(Blocks.GRASS_BLOCK, Blocks.SNOW, Blocks.SNOW_BLOCK, Blocks.PODZOL, Blocks.COARSE_DIRT); this.tag(BlockTags.WOLVES_SPAWNABLE_ON).add(Blocks.GRASS_BLOCK, Blocks.SNOW, Blocks.SNOW_BLOCK, Blocks.COARSE_DIRT, Blocks.PODZOL); this.tag(BlockTags.FROGS_SPAWNABLE_ON).add(Blocks.GRASS_BLOCK, Blocks.MUD, Blocks.MANGROVE_ROOTS, Blocks.MUDDY_MANGROVE_ROOTS); + this.tag(BlockTags.BATS_SPAWNABLE_ON).addTag(BlockTags.BASE_STONE_OVERWORLD); this.tag(BlockTags.TERRACOTTA) .add( Blocks.TERRACOTTA, diff --git a/net/minecraft/data/tags/VanillaItemTagsProvider.java b/net/minecraft/data/tags/VanillaItemTagsProvider.java index 6f98bbe4..60568dc4 100644 --- a/net/minecraft/data/tags/VanillaItemTagsProvider.java +++ b/net/minecraft/data/tags/VanillaItemTagsProvider.java @@ -75,6 +75,7 @@ public class VanillaItemTagsProvider extends ItemTagsProvider { this.copy(BlockTags.DIRT, ItemTags.DIRT); this.copy(BlockTags.TERRACOTTA, ItemTags.TERRACOTTA); this.copy(BlockTags.COMPLETES_FIND_TREE_TUTORIAL, ItemTags.COMPLETES_FIND_TREE_TUTORIAL); + this.copy(BlockTags.SHULKER_BOXES, ItemTags.SHULKER_BOXES); this.tag(ItemTags.BANNERS) .add( Items.WHITE_BANNER, @@ -107,6 +108,26 @@ public class VanillaItemTagsProvider extends ItemTagsProvider { Items.CHERRY_BOAT ) .addTag(ItemTags.CHEST_BOATS); + this.tag(ItemTags.BUNDLES) + .add( + Items.BUNDLE, + Items.BLACK_BUNDLE, + Items.BLUE_BUNDLE, + Items.BROWN_BUNDLE, + Items.CYAN_BUNDLE, + Items.GRAY_BUNDLE, + Items.GREEN_BUNDLE, + Items.LIGHT_BLUE_BUNDLE, + Items.LIGHT_GRAY_BUNDLE, + Items.LIME_BUNDLE, + Items.MAGENTA_BUNDLE, + Items.ORANGE_BUNDLE, + Items.PINK_BUNDLE, + Items.PURPLE_BUNDLE, + Items.RED_BUNDLE, + Items.YELLOW_BUNDLE, + Items.WHITE_BUNDLE + ); this.tag(ItemTags.CHEST_BOATS) .add( Items.OAK_CHEST_BOAT, @@ -170,7 +191,10 @@ public class VanillaItemTagsProvider extends ItemTagsProvider { ); this.tag(ItemTags.IGNORED_BY_PIGLIN_BABIES).add(Items.LEATHER); this.tag(ItemTags.PIGLIN_FOOD).add(Items.PORKCHOP, Items.COOKED_PORKCHOP); + this.tag(ItemTags.PIGLIN_SAFE_ARMOR).add(Items.GOLDEN_HELMET, Items.GOLDEN_CHESTPLATE, Items.GOLDEN_LEGGINGS, Items.GOLDEN_BOOTS); this.tag(ItemTags.FOX_FOOD).add(Items.SWEET_BERRIES, Items.GLOW_BERRIES); + this.tag(ItemTags.DUPLICATES_ALLAYS).add(Items.AMETHYST_SHARD); + this.tag(ItemTags.BREWING_FUEL).add(Items.BLAZE_POWDER); this.tag(ItemTags.NON_FLAMMABLE_WOOD) .add( Items.WARPED_STEM, @@ -204,7 +228,20 @@ public class VanillaItemTagsProvider extends ItemTagsProvider { Items.WARPED_HANGING_SIGN, Items.CRIMSON_HANGING_SIGN ); + this.tag(ItemTags.WOODEN_TOOL_MATERIALS).addTag(ItemTags.PLANKS); this.tag(ItemTags.STONE_TOOL_MATERIALS).add(Items.COBBLESTONE, Items.BLACKSTONE, Items.COBBLED_DEEPSLATE); + this.tag(ItemTags.IRON_TOOL_MATERIALS).add(Items.IRON_INGOT); + this.tag(ItemTags.GOLD_TOOL_MATERIALS).add(Items.GOLD_INGOT); + this.tag(ItemTags.DIAMOND_TOOL_MATERIALS).add(Items.DIAMOND); + this.tag(ItemTags.NETHERITE_TOOL_MATERIALS).add(Items.NETHERITE_INGOT); + this.tag(ItemTags.REPAIRS_LEATHER_ARMOR).add(Items.LEATHER); + this.tag(ItemTags.REPAIRS_CHAIN_ARMOR).add(Items.IRON_INGOT); + this.tag(ItemTags.REPAIRS_IRON_ARMOR).add(Items.IRON_INGOT); + this.tag(ItemTags.REPAIRS_GOLD_ARMOR).add(Items.GOLD_INGOT); + this.tag(ItemTags.REPAIRS_DIAMOND_ARMOR).add(Items.DIAMOND); + this.tag(ItemTags.REPAIRS_NETHERITE_ARMOR).add(Items.NETHERITE_INGOT); + this.tag(ItemTags.REPAIRS_TURTLE_HELMET).add(Items.TURTLE_SCUTE); + this.tag(ItemTags.REPAIRS_WOLF_ARMOR).add(Items.ARMADILLO_SCUTE); this.tag(ItemTags.STONE_CRAFTING_MATERIALS).add(Items.COBBLESTONE, Items.BLACKSTONE, Items.COBBLED_DEEPSLATE); this.tag(ItemTags.FREEZE_IMMUNE_WEARABLES) .add(Items.LEATHER_BOOTS, Items.LEATHER_LEGGINGS, Items.LEATHER_CHESTPLATE, Items.LEATHER_HELMET, Items.LEATHER_HORSE_ARMOR); @@ -320,6 +357,7 @@ public class VanillaItemTagsProvider extends ItemTagsProvider { this.tag(ItemTags.SNIFFER_FOOD).add(Items.TORCHFLOWER_SEEDS); this.tag(ItemTags.VILLAGER_PLANTABLE_SEEDS) .add(Items.WHEAT_SEEDS, Items.POTATO, Items.CARROT, Items.BEETROOT_SEEDS, Items.TORCHFLOWER_SEEDS, Items.PITCHER_POD); + this.tag(ItemTags.VILLAGER_PICKS_UP).addTag(ItemTags.VILLAGER_PLANTABLE_SEEDS).add(Items.BREAD, Items.WHEAT, Items.BEETROOT); this.tag(ItemTags.FOOT_ARMOR_ENCHANTABLE).addTag(ItemTags.FOOT_ARMOR); this.tag(ItemTags.LEG_ARMOR_ENCHANTABLE).addTag(ItemTags.LEG_ARMOR); this.tag(ItemTags.CHEST_ARMOR_ENCHANTABLE).addTag(ItemTags.CHEST_ARMOR); @@ -372,6 +410,7 @@ public class VanillaItemTagsProvider extends ItemTagsProvider { this.tag(ItemTags.VANISHING_ENCHANTABLE).addTag(ItemTags.DURABILITY_ENCHANTABLE).add(Items.COMPASS).add(Items.CARVED_PUMPKIN).addTag(ItemTags.SKULLS); this.tag(ItemTags.DYEABLE) .add(Items.LEATHER_HELMET, Items.LEATHER_CHESTPLATE, Items.LEATHER_LEGGINGS, Items.LEATHER_BOOTS, Items.LEATHER_HORSE_ARMOR, Items.WOLF_ARMOR); + this.tag(ItemTags.FURNACE_MINECART_FUEL).add(Items.COAL, Items.CHARCOAL); this.tag(ItemTags.MEAT) .add( Items.BEEF, @@ -386,7 +425,9 @@ public class VanillaItemTagsProvider extends ItemTagsProvider { Items.RABBIT, Items.ROTTEN_FLESH ); - this.tag(ItemTags.WOLF_FOOD).addTag(ItemTags.MEAT); + this.tag(ItemTags.WOLF_FOOD) + .addTag(ItemTags.MEAT) + .add(Items.COD, Items.COOKED_COD, Items.SALMON, Items.COOKED_SALMON, Items.TROPICAL_FISH, Items.PUFFERFISH, Items.RABBIT_STEW); this.tag(ItemTags.OCELOT_FOOD).add(Items.COD, Items.SALMON); this.tag(ItemTags.CAT_FOOD).add(Items.COD, Items.SALMON); this.tag(ItemTags.HORSE_FOOD) @@ -402,6 +443,7 @@ public class VanillaItemTagsProvider extends ItemTagsProvider { this.tag(ItemTags.LLAMA_FOOD).add(Items.WHEAT, Items.HAY_BLOCK); this.tag(ItemTags.LLAMA_TEMPT_ITEMS).add(Items.HAY_BLOCK); this.tag(ItemTags.PANDA_FOOD).add(Items.BAMBOO); + this.tag(ItemTags.PANDA_EATS_FROM_GROUND).addTag(ItemTags.PANDA_FOOD).add(Items.CAKE); this.tag(ItemTags.PIG_FOOD).add(Items.CARROT, Items.POTATO, Items.BEETROOT); this.tag(ItemTags.RABBIT_FOOD).add(Items.CARROT, Items.GOLDEN_CARROT, Items.DANDELION); this.tag(ItemTags.STRIDER_FOOD).add(Items.WARPED_FUNGUS); @@ -413,5 +455,7 @@ public class VanillaItemTagsProvider extends ItemTagsProvider { this.tag(ItemTags.COW_FOOD).add(Items.WHEAT); this.tag(ItemTags.SHEEP_FOOD).add(Items.WHEAT); this.tag(ItemTags.GOAT_FOOD).add(Items.WHEAT); + this.tag(ItemTags.MAP_INVISIBILITY_EQUIPMENT).add(Items.CARVED_PUMPKIN); + this.tag(ItemTags.GAZE_DISGUISE_EQUIPMENT).add(Items.CARVED_PUMPKIN); } } diff --git a/net/minecraft/data/tags/WinterDropBiomeTagsProvider.java b/net/minecraft/data/tags/WinterDropBiomeTagsProvider.java new file mode 100644 index 00000000..83ce2c84 --- /dev/null +++ b/net/minecraft/data/tags/WinterDropBiomeTagsProvider.java @@ -0,0 +1,25 @@ +package net.minecraft.data.tags; + +import java.util.concurrent.CompletableFuture; +import net.minecraft.core.HolderLookup; +import net.minecraft.core.registries.Registries; +import net.minecraft.data.PackOutput; +import net.minecraft.data.worldgen.WinterDropBiomes; +import net.minecraft.tags.BiomeTags; +import net.minecraft.world.level.biome.Biome; + +public class WinterDropBiomeTagsProvider extends TagsProvider { + public WinterDropBiomeTagsProvider( + PackOutput packOutput, CompletableFuture completableFuture, CompletableFuture> completableFuture2 + ) { + super(packOutput, Registries.BIOME, completableFuture, completableFuture2); + } + + @Override + protected void addTags(HolderLookup.Provider provider) { + this.tag(BiomeTags.IS_FOREST).add(WinterDropBiomes.PALE_GARDEN); + this.tag(BiomeTags.STRONGHOLD_BIASED_TO).add(WinterDropBiomes.PALE_GARDEN); + this.tag(BiomeTags.IS_OVERWORLD).add(WinterDropBiomes.PALE_GARDEN); + this.tag(BiomeTags.HAS_TRIAL_CHAMBERS).add(WinterDropBiomes.PALE_GARDEN); + } +} diff --git a/net/minecraft/data/tags/WinterDropBlockTagsProvider.java b/net/minecraft/data/tags/WinterDropBlockTagsProvider.java new file mode 100644 index 00000000..e61a825f --- /dev/null +++ b/net/minecraft/data/tags/WinterDropBlockTagsProvider.java @@ -0,0 +1,45 @@ +package net.minecraft.data.tags; + +import java.util.concurrent.CompletableFuture; +import net.minecraft.core.HolderLookup; +import net.minecraft.core.registries.Registries; +import net.minecraft.data.PackOutput; +import net.minecraft.tags.BlockTags; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; + +public class WinterDropBlockTagsProvider extends IntrinsicHolderTagsProvider { + public WinterDropBlockTagsProvider( + PackOutput packOutput, CompletableFuture completableFuture, CompletableFuture> completableFuture2 + ) { + super(packOutput, Registries.BLOCK, completableFuture, completableFuture2, block -> block.builtInRegistryHolder().key()); + } + + @Override + protected void addTags(HolderLookup.Provider provider) { + this.tag(BlockTags.PLANKS).add(Blocks.PALE_OAK_PLANKS); + this.tag(BlockTags.WOODEN_BUTTONS).add(Blocks.PALE_OAK_BUTTON); + this.tag(BlockTags.WOODEN_DOORS).add(Blocks.PALE_OAK_DOOR); + this.tag(BlockTags.WOODEN_STAIRS).add(Blocks.PALE_OAK_STAIRS); + this.tag(BlockTags.WOODEN_SLABS).add(Blocks.PALE_OAK_SLAB); + this.tag(BlockTags.WOODEN_FENCES).add(Blocks.PALE_OAK_FENCE); + this.tag(BlockTags.SAPLINGS).add(Blocks.PALE_OAK_SAPLING); + this.tag(BlockTags.PALE_OAK_LOGS).add(Blocks.PALE_OAK_LOG, Blocks.PALE_OAK_WOOD, Blocks.STRIPPED_PALE_OAK_LOG, Blocks.STRIPPED_PALE_OAK_WOOD); + this.tag(BlockTags.LOGS_THAT_BURN).addTag(BlockTags.PALE_OAK_LOGS); + this.tag(BlockTags.OVERWORLD_NATURAL_LOGS).add(Blocks.PALE_OAK_LOG); + this.tag(BlockTags.DIRT).add(Blocks.PALE_MOSS_BLOCK); + this.tag(BlockTags.FLOWER_POTS).add(Blocks.POTTED_PALE_OAK_SAPLING); + this.tag(BlockTags.WOODEN_PRESSURE_PLATES).add(Blocks.PALE_OAK_PRESSURE_PLATE); + this.tag(BlockTags.LEAVES).add(Blocks.PALE_OAK_LEAVES); + this.tag(BlockTags.WOODEN_TRAPDOORS).add(Blocks.PALE_OAK_TRAPDOOR); + this.tag(BlockTags.STANDING_SIGNS).add(Blocks.PALE_OAK_SIGN); + this.tag(BlockTags.WALL_SIGNS).add(Blocks.PALE_OAK_WALL_SIGN); + this.tag(BlockTags.CEILING_HANGING_SIGNS).add(Blocks.PALE_OAK_HANGING_SIGN); + this.tag(BlockTags.WALL_HANGING_SIGNS).add(Blocks.PALE_OAK_WALL_HANGING_SIGN); + this.tag(BlockTags.FENCE_GATES).add(Blocks.PALE_OAK_FENCE_GATE); + this.tag(BlockTags.MINEABLE_WITH_HOE).add(Blocks.PALE_OAK_LEAVES, Blocks.PALE_MOSS_BLOCK, Blocks.PALE_MOSS_CARPET); + this.tag(BlockTags.MINEABLE_WITH_AXE).add(Blocks.CREAKING_HEART); + this.tag(BlockTags.SWORD_EFFICIENT).add(Blocks.PALE_MOSS_CARPET); + this.tag(BlockTags.COMBINATION_STEP_SOUND_BLOCKS).add(Blocks.PALE_MOSS_CARPET); + } +} diff --git a/net/minecraft/data/tags/WinterDropEntityTypeTagsProvider.java b/net/minecraft/data/tags/WinterDropEntityTypeTagsProvider.java new file mode 100644 index 00000000..d4d3aba5 --- /dev/null +++ b/net/minecraft/data/tags/WinterDropEntityTypeTagsProvider.java @@ -0,0 +1,19 @@ +package net.minecraft.data.tags; + +import java.util.concurrent.CompletableFuture; +import net.minecraft.core.HolderLookup; +import net.minecraft.core.registries.Registries; +import net.minecraft.data.PackOutput; +import net.minecraft.tags.EntityTypeTags; +import net.minecraft.world.entity.EntityType; + +public class WinterDropEntityTypeTagsProvider extends IntrinsicHolderTagsProvider> { + public WinterDropEntityTypeTagsProvider(PackOutput packOutput, CompletableFuture completableFuture) { + super(packOutput, Registries.ENTITY_TYPE, completableFuture, entityType -> entityType.builtInRegistryHolder().key()); + } + + @Override + protected void addTags(HolderLookup.Provider provider) { + this.tag(EntityTypeTags.BOAT).add(EntityType.PALE_OAK_BOAT); + } +} diff --git a/net/minecraft/data/tags/WinterDropItemTagsProvider.java b/net/minecraft/data/tags/WinterDropItemTagsProvider.java new file mode 100644 index 00000000..47320598 --- /dev/null +++ b/net/minecraft/data/tags/WinterDropItemTagsProvider.java @@ -0,0 +1,43 @@ +package net.minecraft.data.tags; + +import java.util.concurrent.CompletableFuture; +import net.minecraft.core.HolderLookup; +import net.minecraft.data.PackOutput; +import net.minecraft.tags.BlockTags; +import net.minecraft.tags.ItemTags; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.Items; +import net.minecraft.world.level.block.Block; + +public class WinterDropItemTagsProvider extends ItemTagsProvider { + public WinterDropItemTagsProvider( + PackOutput packOutput, + CompletableFuture completableFuture, + CompletableFuture> completableFuture2, + CompletableFuture> completableFuture3 + ) { + super(packOutput, completableFuture, completableFuture2, completableFuture3); + } + + @Override + protected void addTags(HolderLookup.Provider provider) { + this.copy(BlockTags.PLANKS, ItemTags.PLANKS); + this.copy(BlockTags.WOODEN_BUTTONS, ItemTags.WOODEN_BUTTONS); + this.copy(BlockTags.WOODEN_DOORS, ItemTags.WOODEN_DOORS); + this.copy(BlockTags.WOODEN_STAIRS, ItemTags.WOODEN_STAIRS); + this.copy(BlockTags.WOODEN_SLABS, ItemTags.WOODEN_SLABS); + this.copy(BlockTags.WOODEN_FENCES, ItemTags.WOODEN_FENCES); + this.copy(BlockTags.FENCE_GATES, ItemTags.FENCE_GATES); + this.copy(BlockTags.WOODEN_PRESSURE_PLATES, ItemTags.WOODEN_PRESSURE_PLATES); + this.copy(BlockTags.SAPLINGS, ItemTags.SAPLINGS); + this.copy(BlockTags.PALE_OAK_LOGS, ItemTags.PALE_OAK_LOGS); + this.copy(BlockTags.LOGS_THAT_BURN, ItemTags.LOGS_THAT_BURN); + this.copy(BlockTags.LEAVES, ItemTags.LEAVES); + this.copy(BlockTags.WOODEN_TRAPDOORS, ItemTags.WOODEN_TRAPDOORS); + this.copy(BlockTags.DIRT, ItemTags.DIRT); + this.tag(ItemTags.BOATS).add(Items.PALE_OAK_BOAT); + this.tag(ItemTags.CHEST_BOATS).add(Items.PALE_OAK_CHEST_BOAT); + this.copy(BlockTags.STANDING_SIGNS, ItemTags.SIGNS); + this.copy(BlockTags.CEILING_HANGING_SIGNS, ItemTags.HANGING_SIGNS); + } +} diff --git a/net/minecraft/data/worldgen/BiomeDefaultFeatures.java b/net/minecraft/data/worldgen/BiomeDefaultFeatures.java index ccf13eb9..e9c97ee4 100644 --- a/net/minecraft/data/worldgen/BiomeDefaultFeatures.java +++ b/net/minecraft/data/worldgen/BiomeDefaultFeatures.java @@ -8,14 +8,15 @@ import net.minecraft.data.worldgen.placement.VegetationPlacements; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.MobCategory; import net.minecraft.world.level.biome.BiomeGenerationSettings; -import net.minecraft.world.level.biome.MobSpawnSettings; +import net.minecraft.world.level.biome.MobSpawnSettings.Builder; +import net.minecraft.world.level.biome.MobSpawnSettings.SpawnerData; import net.minecraft.world.level.levelgen.GenerationStep; public class BiomeDefaultFeatures { public static void addDefaultCarversAndLakes(BiomeGenerationSettings.Builder builder) { - builder.addCarver(GenerationStep.Carving.AIR, Carvers.CAVE); - builder.addCarver(GenerationStep.Carving.AIR, Carvers.CAVE_EXTRA_UNDERGROUND); - builder.addCarver(GenerationStep.Carving.AIR, Carvers.CANYON); + builder.addCarver(Carvers.CAVE); + builder.addCarver(Carvers.CAVE_EXTRA_UNDERGROUND); + builder.addCarver(Carvers.CANYON); builder.addFeature(GenerationStep.Decoration.LAKES, MiscOverworldPlacements.LAKE_LAVA_UNDERGROUND); builder.addFeature(GenerationStep.Decoration.LAKES, MiscOverworldPlacements.LAKE_LAVA_SURFACE); } @@ -350,10 +351,6 @@ public class BiomeDefaultFeatures { builder.addFeature(GenerationStep.Decoration.VEGETAL_DECORATION, AquaticPlacements.KELP_COLD); } - public static void addDefaultSeagrass(BiomeGenerationSettings.Builder builder) { - builder.addFeature(GenerationStep.Decoration.VEGETAL_DECORATION, AquaticPlacements.SEAGRASS_SIMPLE); - } - public static void addLukeWarmKelp(BiomeGenerationSettings.Builder builder) { builder.addFeature(GenerationStep.Decoration.VEGETAL_DECORATION, AquaticPlacements.KELP_WARM); } @@ -397,94 +394,94 @@ public class BiomeDefaultFeatures { builder.addFeature(GenerationStep.Decoration.LOCAL_MODIFICATIONS, CavePlacements.AMETHYST_GEODE); } - public static void farmAnimals(MobSpawnSettings.Builder builder) { - builder.addSpawn(MobCategory.CREATURE, new MobSpawnSettings.SpawnerData(EntityType.SHEEP, 12, 4, 4)); - builder.addSpawn(MobCategory.CREATURE, new MobSpawnSettings.SpawnerData(EntityType.PIG, 10, 4, 4)); - builder.addSpawn(MobCategory.CREATURE, new MobSpawnSettings.SpawnerData(EntityType.CHICKEN, 10, 4, 4)); - builder.addSpawn(MobCategory.CREATURE, new MobSpawnSettings.SpawnerData(EntityType.COW, 8, 4, 4)); + public static void farmAnimals(Builder builder) { + builder.addSpawn(MobCategory.CREATURE, new SpawnerData(EntityType.SHEEP, 12, 4, 4)); + builder.addSpawn(MobCategory.CREATURE, new SpawnerData(EntityType.PIG, 10, 4, 4)); + builder.addSpawn(MobCategory.CREATURE, new SpawnerData(EntityType.CHICKEN, 10, 4, 4)); + builder.addSpawn(MobCategory.CREATURE, new SpawnerData(EntityType.COW, 8, 4, 4)); } - public static void caveSpawns(MobSpawnSettings.Builder builder) { - builder.addSpawn(MobCategory.AMBIENT, new MobSpawnSettings.SpawnerData(EntityType.BAT, 10, 8, 8)); - builder.addSpawn(MobCategory.UNDERGROUND_WATER_CREATURE, new MobSpawnSettings.SpawnerData(EntityType.GLOW_SQUID, 10, 4, 6)); + public static void caveSpawns(Builder builder) { + builder.addSpawn(MobCategory.AMBIENT, new SpawnerData(EntityType.BAT, 10, 8, 8)); + builder.addSpawn(MobCategory.UNDERGROUND_WATER_CREATURE, new SpawnerData(EntityType.GLOW_SQUID, 10, 4, 6)); } - public static void commonSpawns(MobSpawnSettings.Builder builder) { + public static void commonSpawns(Builder builder) { commonSpawns(builder, 100); } - public static void commonSpawns(MobSpawnSettings.Builder builder, int skeletonWeight) { + public static void commonSpawns(Builder builder, int skeletonWeight) { caveSpawns(builder); monsters(builder, 95, 5, skeletonWeight, false); } - public static void oceanSpawns(MobSpawnSettings.Builder builder, int squidWeight, int squidMaxCount, int codWeight) { - builder.addSpawn(MobCategory.WATER_CREATURE, new MobSpawnSettings.SpawnerData(EntityType.SQUID, squidWeight, 1, squidMaxCount)); - builder.addSpawn(MobCategory.WATER_AMBIENT, new MobSpawnSettings.SpawnerData(EntityType.COD, codWeight, 3, 6)); + public static void oceanSpawns(Builder builder, int squidWeight, int squidMaxCount, int codWeight) { + builder.addSpawn(MobCategory.WATER_CREATURE, new SpawnerData(EntityType.SQUID, squidWeight, 1, squidMaxCount)); + builder.addSpawn(MobCategory.WATER_AMBIENT, new SpawnerData(EntityType.COD, codWeight, 3, 6)); commonSpawns(builder); - builder.addSpawn(MobCategory.MONSTER, new MobSpawnSettings.SpawnerData(EntityType.DROWNED, 5, 1, 1)); + builder.addSpawn(MobCategory.MONSTER, new SpawnerData(EntityType.DROWNED, 5, 1, 1)); } - public static void warmOceanSpawns(MobSpawnSettings.Builder builder, int squidWeight, int squidMinCount) { - builder.addSpawn(MobCategory.WATER_CREATURE, new MobSpawnSettings.SpawnerData(EntityType.SQUID, squidWeight, squidMinCount, 4)); - builder.addSpawn(MobCategory.WATER_AMBIENT, new MobSpawnSettings.SpawnerData(EntityType.TROPICAL_FISH, 25, 8, 8)); - builder.addSpawn(MobCategory.WATER_CREATURE, new MobSpawnSettings.SpawnerData(EntityType.DOLPHIN, 2, 1, 2)); - builder.addSpawn(MobCategory.MONSTER, new MobSpawnSettings.SpawnerData(EntityType.DROWNED, 5, 1, 1)); + public static void warmOceanSpawns(Builder builder, int squidWeight, int squidMinCount) { + builder.addSpawn(MobCategory.WATER_CREATURE, new SpawnerData(EntityType.SQUID, squidWeight, squidMinCount, 4)); + builder.addSpawn(MobCategory.WATER_AMBIENT, new SpawnerData(EntityType.TROPICAL_FISH, 25, 8, 8)); + builder.addSpawn(MobCategory.WATER_CREATURE, new SpawnerData(EntityType.DOLPHIN, 2, 1, 2)); + builder.addSpawn(MobCategory.MONSTER, new SpawnerData(EntityType.DROWNED, 5, 1, 1)); commonSpawns(builder); } - public static void plainsSpawns(MobSpawnSettings.Builder builder) { + public static void plainsSpawns(Builder builder) { farmAnimals(builder); - builder.addSpawn(MobCategory.CREATURE, new MobSpawnSettings.SpawnerData(EntityType.HORSE, 5, 2, 6)); - builder.addSpawn(MobCategory.CREATURE, new MobSpawnSettings.SpawnerData(EntityType.DONKEY, 1, 1, 3)); + builder.addSpawn(MobCategory.CREATURE, new SpawnerData(EntityType.HORSE, 5, 2, 6)); + builder.addSpawn(MobCategory.CREATURE, new SpawnerData(EntityType.DONKEY, 1, 1, 3)); commonSpawns(builder); } - public static void snowySpawns(MobSpawnSettings.Builder builder) { - builder.addSpawn(MobCategory.CREATURE, new MobSpawnSettings.SpawnerData(EntityType.RABBIT, 10, 2, 3)); - builder.addSpawn(MobCategory.CREATURE, new MobSpawnSettings.SpawnerData(EntityType.POLAR_BEAR, 1, 1, 2)); + public static void snowySpawns(Builder builder) { + builder.addSpawn(MobCategory.CREATURE, new SpawnerData(EntityType.RABBIT, 10, 2, 3)); + builder.addSpawn(MobCategory.CREATURE, new SpawnerData(EntityType.POLAR_BEAR, 1, 1, 2)); caveSpawns(builder); monsters(builder, 95, 5, 20, false); - builder.addSpawn(MobCategory.MONSTER, new MobSpawnSettings.SpawnerData(EntityType.STRAY, 80, 4, 4)); + builder.addSpawn(MobCategory.MONSTER, new SpawnerData(EntityType.STRAY, 80, 4, 4)); } - public static void desertSpawns(MobSpawnSettings.Builder builder) { - builder.addSpawn(MobCategory.CREATURE, new MobSpawnSettings.SpawnerData(EntityType.RABBIT, 4, 2, 3)); + public static void desertSpawns(Builder builder) { + builder.addSpawn(MobCategory.CREATURE, new SpawnerData(EntityType.RABBIT, 4, 2, 3)); caveSpawns(builder); monsters(builder, 19, 1, 100, false); - builder.addSpawn(MobCategory.MONSTER, new MobSpawnSettings.SpawnerData(EntityType.HUSK, 80, 4, 4)); + builder.addSpawn(MobCategory.MONSTER, new SpawnerData(EntityType.HUSK, 80, 4, 4)); } - public static void dripstoneCavesSpawns(MobSpawnSettings.Builder builder) { + public static void dripstoneCavesSpawns(Builder builder) { caveSpawns(builder); int i = 95; monsters(builder, 95, 5, 100, false); - builder.addSpawn(MobCategory.MONSTER, new MobSpawnSettings.SpawnerData(EntityType.DROWNED, 95, 4, 4)); + builder.addSpawn(MobCategory.MONSTER, new SpawnerData(EntityType.DROWNED, 95, 4, 4)); } - public static void monsters(MobSpawnSettings.Builder builder, int zombieWeight, int zombieVillagerWeight, int skeletonWeight, boolean isUnderwater) { - builder.addSpawn(MobCategory.MONSTER, new MobSpawnSettings.SpawnerData(EntityType.SPIDER, 100, 4, 4)); - builder.addSpawn(MobCategory.MONSTER, new MobSpawnSettings.SpawnerData(isUnderwater ? EntityType.DROWNED : EntityType.ZOMBIE, zombieWeight, 4, 4)); - builder.addSpawn(MobCategory.MONSTER, new MobSpawnSettings.SpawnerData(EntityType.ZOMBIE_VILLAGER, zombieVillagerWeight, 1, 1)); - builder.addSpawn(MobCategory.MONSTER, new MobSpawnSettings.SpawnerData(EntityType.SKELETON, skeletonWeight, 4, 4)); - builder.addSpawn(MobCategory.MONSTER, new MobSpawnSettings.SpawnerData(EntityType.CREEPER, 100, 4, 4)); - builder.addSpawn(MobCategory.MONSTER, new MobSpawnSettings.SpawnerData(EntityType.SLIME, 100, 4, 4)); - builder.addSpawn(MobCategory.MONSTER, new MobSpawnSettings.SpawnerData(EntityType.ENDERMAN, 10, 1, 4)); - builder.addSpawn(MobCategory.MONSTER, new MobSpawnSettings.SpawnerData(EntityType.WITCH, 5, 1, 1)); + public static void monsters(Builder builder, int zombieWeight, int zombieVillagerWeight, int skeletonWeight, boolean isUnderwater) { + builder.addSpawn(MobCategory.MONSTER, new SpawnerData(EntityType.SPIDER, 100, 4, 4)); + builder.addSpawn(MobCategory.MONSTER, new SpawnerData(isUnderwater ? EntityType.DROWNED : EntityType.ZOMBIE, zombieWeight, 4, 4)); + builder.addSpawn(MobCategory.MONSTER, new SpawnerData(EntityType.ZOMBIE_VILLAGER, zombieVillagerWeight, 1, 1)); + builder.addSpawn(MobCategory.MONSTER, new SpawnerData(EntityType.SKELETON, skeletonWeight, 4, 4)); + builder.addSpawn(MobCategory.MONSTER, new SpawnerData(EntityType.CREEPER, 100, 4, 4)); + builder.addSpawn(MobCategory.MONSTER, new SpawnerData(EntityType.SLIME, 100, 4, 4)); + builder.addSpawn(MobCategory.MONSTER, new SpawnerData(EntityType.ENDERMAN, 10, 1, 4)); + builder.addSpawn(MobCategory.MONSTER, new SpawnerData(EntityType.WITCH, 5, 1, 1)); } - public static void mooshroomSpawns(MobSpawnSettings.Builder builder) { - builder.addSpawn(MobCategory.CREATURE, new MobSpawnSettings.SpawnerData(EntityType.MOOSHROOM, 8, 4, 8)); + public static void mooshroomSpawns(Builder builder) { + builder.addSpawn(MobCategory.CREATURE, new SpawnerData(EntityType.MOOSHROOM, 8, 4, 8)); caveSpawns(builder); } - public static void baseJungleSpawns(MobSpawnSettings.Builder builder) { + public static void baseJungleSpawns(Builder builder) { farmAnimals(builder); - builder.addSpawn(MobCategory.CREATURE, new MobSpawnSettings.SpawnerData(EntityType.CHICKEN, 10, 4, 4)); + builder.addSpawn(MobCategory.CREATURE, new SpawnerData(EntityType.CHICKEN, 10, 4, 4)); commonSpawns(builder); } - public static void endSpawns(MobSpawnSettings.Builder builder) { - builder.addSpawn(MobCategory.MONSTER, new MobSpawnSettings.SpawnerData(EntityType.ENDERMAN, 10, 4, 4)); + public static void endSpawns(Builder builder) { + builder.addSpawn(MobCategory.MONSTER, new SpawnerData(EntityType.ENDERMAN, 10, 4, 4)); } } diff --git a/net/minecraft/data/worldgen/Pools.java b/net/minecraft/data/worldgen/Pools.java index dba3be2c..7ac306ad 100644 --- a/net/minecraft/data/worldgen/Pools.java +++ b/net/minecraft/data/worldgen/Pools.java @@ -11,12 +11,16 @@ import net.minecraft.world.level.levelgen.structure.pools.StructureTemplatePool; public class Pools { public static final ResourceKey EMPTY = createKey("empty"); + public static ResourceKey createKey(ResourceLocation resourceLocation) { + return ResourceKey.create(Registries.TEMPLATE_POOL, resourceLocation); + } + public static ResourceKey createKey(String name) { - return ResourceKey.create(Registries.TEMPLATE_POOL, ResourceLocation.withDefaultNamespace(name)); + return createKey(ResourceLocation.withDefaultNamespace(name)); } public static ResourceKey parseKey(String key) { - return ResourceKey.create(Registries.TEMPLATE_POOL, ResourceLocation.parse(key)); + return createKey(ResourceLocation.parse(key)); } public static void register(BootstrapContext context, String name, StructureTemplatePool pool) { diff --git a/net/minecraft/data/worldgen/TrialChambersStructurePools.java b/net/minecraft/data/worldgen/TrialChambersStructurePools.java index b5f1e6aa..e7a0b4ae 100644 --- a/net/minecraft/data/worldgen/TrialChambersStructurePools.java +++ b/net/minecraft/data/worldgen/TrialChambersStructurePools.java @@ -17,7 +17,6 @@ import net.minecraft.world.level.levelgen.structure.templatesystem.StructureProc public class TrialChambersStructurePools { public static final ResourceKey START = Pools.createKey("trial_chambers/chamber/end"); public static final ResourceKey HALLWAY_FALLBACK = Pools.createKey("trial_chambers/hallway/fallback"); - public static final ResourceKey CHAMBER_CAP_FALLBACK = Pools.createKey("trial_chambers/chamber/entrance_cap"); public static final List ALIAS_BINDINGS = ImmutableList.builder() .add( PoolAliasBinding.randomGroup( @@ -70,16 +69,15 @@ public class TrialChambersStructurePools { HolderGetter holderGetter = context.lookup(Registries.TEMPLATE_POOL); Holder holder = holderGetter.getOrThrow(Pools.EMPTY); Holder holder2 = holderGetter.getOrThrow(HALLWAY_FALLBACK); - Holder holder3 = holderGetter.getOrThrow(CHAMBER_CAP_FALLBACK); HolderGetter holderGetter2 = context.lookup(Registries.PROCESSOR_LIST); - Holder holder4 = holderGetter2.getOrThrow(ProcessorLists.TRIAL_CHAMBERS_COPPER_BULB_DEGRADATION); + Holder holder3 = holderGetter2.getOrThrow(ProcessorLists.TRIAL_CHAMBERS_COPPER_BULB_DEGRADATION); context.register( START, new StructureTemplatePool( holder, List.of( - Pair.of(StructurePoolElement.single("trial_chambers/corridor/end_1", holder4), 1), - Pair.of(StructurePoolElement.single("trial_chambers/corridor/end_2", holder4), 1) + Pair.of(StructurePoolElement.single("trial_chambers/corridor/end_1", holder3), 1), + Pair.of(StructurePoolElement.single("trial_chambers/corridor/end_2", holder3), 1) ), StructureTemplatePool.Projection.RIGID ) @@ -88,7 +86,7 @@ public class TrialChambersStructurePools { context, "trial_chambers/chamber/entrance_cap", new StructureTemplatePool( - holder3, List.of(Pair.of(StructurePoolElement.single("trial_chambers/chamber/entrance_cap", holder4), 1)), StructureTemplatePool.Projection.RIGID + holder, List.of(Pair.of(StructurePoolElement.single("trial_chambers/chamber/entrance_cap", holder3), 1)), StructureTemplatePool.Projection.RIGID ) ); Pools.register( @@ -97,10 +95,10 @@ public class TrialChambersStructurePools { new StructureTemplatePool( holder2, List.of( - Pair.of(StructurePoolElement.single("trial_chambers/chamber/chamber_1", holder4), 1), - Pair.of(StructurePoolElement.single("trial_chambers/chamber/assembly", holder4), 1), - Pair.of(StructurePoolElement.single("trial_chambers/chamber/eruption", holder4), 1), - Pair.of(StructurePoolElement.single("trial_chambers/chamber/slanted", holder4), 1) + Pair.of(StructurePoolElement.single("trial_chambers/chamber/chamber_1", holder3), 1), + Pair.of(StructurePoolElement.single("trial_chambers/chamber/assembly", holder3), 1), + Pair.of(StructurePoolElement.single("trial_chambers/chamber/eruption", holder3), 1), + Pair.of(StructurePoolElement.single("trial_chambers/chamber/slanted", holder3), 1) ), StructureTemplatePool.Projection.RIGID ) @@ -112,14 +110,14 @@ public class TrialChambersStructurePools { holder, List.of( Pair.of(StructurePoolElement.single("trial_chambers/corridor/second_plate"), 1), - Pair.of(StructurePoolElement.single("trial_chambers/intersection/intersection_1", holder4), 1), - Pair.of(StructurePoolElement.single("trial_chambers/intersection/intersection_2", holder4), 1), - Pair.of(StructurePoolElement.single("trial_chambers/intersection/intersection_3", holder4), 1), + Pair.of(StructurePoolElement.single("trial_chambers/intersection/intersection_1", holder3), 1), + Pair.of(StructurePoolElement.single("trial_chambers/intersection/intersection_2", holder3), 1), + Pair.of(StructurePoolElement.single("trial_chambers/intersection/intersection_3", holder3), 1), Pair.of(StructurePoolElement.single("trial_chambers/corridor/first_plate"), 1), - Pair.of(StructurePoolElement.single("trial_chambers/corridor/atrium_1", holder4), 1), - Pair.of(StructurePoolElement.single("trial_chambers/corridor/entrance_1", holder4), 1), - Pair.of(StructurePoolElement.single("trial_chambers/corridor/entrance_2", holder4), 1), - Pair.of(StructurePoolElement.single("trial_chambers/corridor/entrance_3", holder4), 1) + Pair.of(StructurePoolElement.single("trial_chambers/corridor/atrium_1", holder3), 1), + Pair.of(StructurePoolElement.single("trial_chambers/corridor/entrance_1", holder3), 1), + Pair.of(StructurePoolElement.single("trial_chambers/corridor/entrance_2", holder3), 1), + Pair.of(StructurePoolElement.single("trial_chambers/corridor/entrance_3", holder3), 1) ), StructureTemplatePool.Projection.RIGID ) @@ -205,8 +203,6 @@ public class TrialChambersStructurePools { Pair.of(StructurePoolElement.single("trial_chambers/chamber/slanted/hallway_1"), 1), Pair.of(StructurePoolElement.single("trial_chambers/chamber/slanted/hallway_2"), 1), Pair.of(StructurePoolElement.single("trial_chambers/chamber/slanted/hallway_3"), 1), - Pair.of(StructurePoolElement.single("trial_chambers/chamber/slanted/hallway_4"), 1), - Pair.of(StructurePoolElement.single("trial_chambers/chamber/slanted/hallway_5"), 1), Pair.of(StructurePoolElement.single("trial_chambers/chamber/slanted/quadrant_1"), 1), Pair.of(StructurePoolElement.single("trial_chambers/chamber/slanted/quadrant_2"), 1), Pair.of(StructurePoolElement.single("trial_chambers/chamber/slanted/quadrant_3"), 1), @@ -250,14 +246,14 @@ public class TrialChambersStructurePools { new StructureTemplatePool( holder, List.of( - Pair.of(StructurePoolElement.single("trial_chambers/corridor/straight_1", holder4), 1), - Pair.of(StructurePoolElement.single("trial_chambers/corridor/straight_2", holder4), 2), - Pair.of(StructurePoolElement.single("trial_chambers/corridor/straight_3", holder4), 2), - Pair.of(StructurePoolElement.single("trial_chambers/corridor/straight_4", holder4), 2), - Pair.of(StructurePoolElement.single("trial_chambers/corridor/straight_5", holder4), 2), - Pair.of(StructurePoolElement.single("trial_chambers/corridor/straight_6", holder4), 2), - Pair.of(StructurePoolElement.single("trial_chambers/corridor/straight_7", holder4), 1), - Pair.of(StructurePoolElement.single("trial_chambers/corridor/straight_8", holder4), 2) + Pair.of(StructurePoolElement.single("trial_chambers/corridor/straight_1", holder3), 1), + Pair.of(StructurePoolElement.single("trial_chambers/corridor/straight_2", holder3), 2), + Pair.of(StructurePoolElement.single("trial_chambers/corridor/straight_3", holder3), 2), + Pair.of(StructurePoolElement.single("trial_chambers/corridor/straight_4", holder3), 2), + Pair.of(StructurePoolElement.single("trial_chambers/corridor/straight_5", holder3), 2), + Pair.of(StructurePoolElement.single("trial_chambers/corridor/straight_6", holder3), 2), + Pair.of(StructurePoolElement.single("trial_chambers/corridor/straight_7", holder3), 1), + Pair.of(StructurePoolElement.single("trial_chambers/corridor/straight_8", holder3), 2) ), StructureTemplatePool.Projection.RIGID ) @@ -282,29 +278,35 @@ public class TrialChambersStructurePools { holder2, List.of( Pair.of(StructurePoolElement.single("trial_chambers/hallway/corridor_connector_1"), 1), - Pair.of(StructurePoolElement.single("trial_chambers/hallway/upper_hallway_connector", holder4), 1), - Pair.of(StructurePoolElement.single("trial_chambers/hallway/lower_hallway_connector", holder4), 1), + Pair.of(StructurePoolElement.single("trial_chambers/hallway/upper_hallway_connector", holder3), 1), + Pair.of(StructurePoolElement.single("trial_chambers/hallway/lower_hallway_connector", holder3), 1), Pair.of(StructurePoolElement.single("trial_chambers/hallway/rubble"), 1), - Pair.of(StructurePoolElement.single("trial_chambers/chamber/chamber_1", holder4), 150), - Pair.of(StructurePoolElement.single("trial_chambers/chamber/chamber_2", holder4), 150), - Pair.of(StructurePoolElement.single("trial_chambers/chamber/chamber_4", holder4), 150), - Pair.of(StructurePoolElement.single("trial_chambers/chamber/chamber_8", holder4), 150), - Pair.of(StructurePoolElement.single("trial_chambers/chamber/assembly", holder4), 150), - Pair.of(StructurePoolElement.single("trial_chambers/chamber/eruption", holder4), 150), - Pair.of(StructurePoolElement.single("trial_chambers/chamber/slanted", holder4), 150), - Pair.of(StructurePoolElement.single("trial_chambers/chamber/pedestal", holder4), 150), - Pair.of(StructurePoolElement.single("trial_chambers/hallway/rubble_chamber", holder4), 10), - Pair.of(StructurePoolElement.single("trial_chambers/hallway/rubble_chamber_thin", holder4), 1), - Pair.of(StructurePoolElement.single("trial_chambers/hallway/cache_1", holder4), 1), - Pair.of(StructurePoolElement.single("trial_chambers/hallway/left_corner", holder4), 1), - Pair.of(StructurePoolElement.single("trial_chambers/hallway/right_corner", holder4), 1), - Pair.of(StructurePoolElement.single("trial_chambers/hallway/corner_staircase", holder4), 1), - Pair.of(StructurePoolElement.single("trial_chambers/hallway/corner_staircase_down", holder4), 1), - Pair.of(StructurePoolElement.single("trial_chambers/hallway/long_straight_staircase", holder4), 1), - Pair.of(StructurePoolElement.single("trial_chambers/hallway/long_straight_staircase_down", holder4), 1), - Pair.of(StructurePoolElement.single("trial_chambers/hallway/straight", holder4), 1), - Pair.of(StructurePoolElement.single("trial_chambers/hallway/straight_staircase", holder4), 1), - Pair.of(StructurePoolElement.single("trial_chambers/hallway/straight_staircase_down", holder4), 1) + Pair.of(StructurePoolElement.single("trial_chambers/chamber/chamber_1", holder3), 150), + Pair.of(StructurePoolElement.single("trial_chambers/chamber/chamber_2", holder3), 150), + Pair.of(StructurePoolElement.single("trial_chambers/chamber/chamber_4", holder3), 150), + Pair.of(StructurePoolElement.single("trial_chambers/chamber/chamber_8", holder3), 150), + Pair.of(StructurePoolElement.single("trial_chambers/chamber/assembly", holder3), 150), + Pair.of(StructurePoolElement.single("trial_chambers/chamber/eruption", holder3), 150), + Pair.of(StructurePoolElement.single("trial_chambers/chamber/slanted", holder3), 150), + Pair.of(StructurePoolElement.single("trial_chambers/chamber/pedestal", holder3), 150), + Pair.of(StructurePoolElement.single("trial_chambers/hallway/rubble_chamber", holder3), 10), + Pair.of(StructurePoolElement.single("trial_chambers/hallway/rubble_chamber_thin", holder3), 1), + Pair.of(StructurePoolElement.single("trial_chambers/hallway/cache_1", holder3), 1), + Pair.of(StructurePoolElement.single("trial_chambers/hallway/left_corner", holder3), 1), + Pair.of(StructurePoolElement.single("trial_chambers/hallway/right_corner", holder3), 1), + Pair.of(StructurePoolElement.single("trial_chambers/hallway/corner_staircase", holder3), 1), + Pair.of(StructurePoolElement.single("trial_chambers/hallway/corner_staircase_down", holder3), 1), + Pair.of(StructurePoolElement.single("trial_chambers/hallway/long_straight_staircase", holder3), 1), + Pair.of(StructurePoolElement.single("trial_chambers/hallway/long_straight_staircase_down", holder3), 1), + Pair.of(StructurePoolElement.single("trial_chambers/hallway/straight", holder3), 1), + Pair.of(StructurePoolElement.single("trial_chambers/hallway/straight_staircase", holder3), 1), + Pair.of(StructurePoolElement.single("trial_chambers/hallway/straight_staircase_down", holder3), 1), + Pair.of(StructurePoolElement.single("trial_chambers/hallway/trapped_staircase", holder3), 1), + Pair.of(StructurePoolElement.single("trial_chambers/hallway/encounter_1", holder3), 1), + Pair.of(StructurePoolElement.single("trial_chambers/hallway/encounter_2", holder3), 1), + Pair.of(StructurePoolElement.single("trial_chambers/hallway/encounter_3", holder3), 1), + Pair.of(StructurePoolElement.single("trial_chambers/hallway/encounter_4", holder3), 1), + Pair.of(StructurePoolElement.single("trial_chambers/hallway/encounter_5", holder3), 1) ), StructureTemplatePool.Projection.RIGID ) @@ -393,6 +395,37 @@ public class TrialChambersStructurePools { StructureTemplatePool.Projection.RIGID ) ); + Pools.register( + context, + "trial_chambers/decor/disposal", + new StructureTemplatePool(holder, List.of(Pair.of(StructurePoolElement.single("trial_chambers/decor/disposal"), 1)), StructureTemplatePool.Projection.RIGID) + ); + Pools.register( + context, + "trial_chambers/decor/bed", + new StructureTemplatePool( + holder, + List.of( + Pair.of(StructurePoolElement.single("trial_chambers/decor/white_bed"), 3), + Pair.of(StructurePoolElement.single("trial_chambers/decor/light_gray_bed"), 3), + Pair.of(StructurePoolElement.single("trial_chambers/decor/gray_bed"), 3), + Pair.of(StructurePoolElement.single("trial_chambers/decor/black_bed"), 3), + Pair.of(StructurePoolElement.single("trial_chambers/decor/brown_bed"), 3), + Pair.of(StructurePoolElement.single("trial_chambers/decor/red_bed"), 3), + Pair.of(StructurePoolElement.single("trial_chambers/decor/orange_bed"), 3), + Pair.of(StructurePoolElement.single("trial_chambers/decor/yellow_bed"), 3), + Pair.of(StructurePoolElement.single("trial_chambers/decor/lime_bed"), 3), + Pair.of(StructurePoolElement.single("trial_chambers/decor/green_bed"), 3), + Pair.of(StructurePoolElement.single("trial_chambers/decor/cyan_bed"), 3), + Pair.of(StructurePoolElement.single("trial_chambers/decor/light_blue_bed"), 3), + Pair.of(StructurePoolElement.single("trial_chambers/decor/blue_bed"), 3), + Pair.of(StructurePoolElement.single("trial_chambers/decor/purple_bed"), 3), + Pair.of(StructurePoolElement.single("trial_chambers/decor/magenta_bed"), 3), + Pair.of(StructurePoolElement.single("trial_chambers/decor/pink_bed"), 1) + ), + StructureTemplatePool.Projection.RIGID + ) + ); Pools.register( context, "trial_chambers/entrance", diff --git a/net/minecraft/data/worldgen/WinterDropBiomes.java b/net/minecraft/data/worldgen/WinterDropBiomes.java new file mode 100644 index 00000000..72d3bd1e --- /dev/null +++ b/net/minecraft/data/worldgen/WinterDropBiomes.java @@ -0,0 +1,28 @@ +package net.minecraft.data.worldgen; + +import net.minecraft.core.HolderGetter; +import net.minecraft.core.registries.Registries; +import net.minecraft.data.worldgen.biome.OverworldBiomes; +import net.minecraft.resources.ResourceKey; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.level.biome.Biome; +import net.minecraft.world.level.levelgen.carver.ConfiguredWorldCarver; +import net.minecraft.world.level.levelgen.placement.PlacedFeature; + +public class WinterDropBiomes { + public static final ResourceKey PALE_GARDEN = createKey("pale_garden"); + + public static ResourceKey createKey(String string) { + return ResourceKey.create(Registries.BIOME, ResourceLocation.withDefaultNamespace(string)); + } + + public static void register(BootstrapContext bootstrapContext, String string, Biome biome) { + bootstrapContext.register(createKey(string), biome); + } + + public static void bootstrap(BootstrapContext bootstrapContext) { + HolderGetter holderGetter = bootstrapContext.lookup(Registries.PLACED_FEATURE); + HolderGetter> holderGetter2 = bootstrapContext.lookup(Registries.CONFIGURED_CARVER); + bootstrapContext.register(PALE_GARDEN, OverworldBiomes.darkForest(holderGetter, holderGetter2, true)); + } +} diff --git a/net/minecraft/data/worldgen/biome/BiomeData.java b/net/minecraft/data/worldgen/biome/BiomeData.java index 53a403f8..968797c8 100644 --- a/net/minecraft/data/worldgen/biome/BiomeData.java +++ b/net/minecraft/data/worldgen/biome/BiomeData.java @@ -23,7 +23,7 @@ public abstract class BiomeData { context.register(Biomes.FOREST, OverworldBiomes.forest(holderGetter, holderGetter2, false, false, false)); context.register(Biomes.FLOWER_FOREST, OverworldBiomes.forest(holderGetter, holderGetter2, false, false, true)); context.register(Biomes.BIRCH_FOREST, OverworldBiomes.forest(holderGetter, holderGetter2, true, false, false)); - context.register(Biomes.DARK_FOREST, OverworldBiomes.darkForest(holderGetter, holderGetter2)); + context.register(Biomes.DARK_FOREST, OverworldBiomes.darkForest(holderGetter, holderGetter2, false)); context.register(Biomes.OLD_GROWTH_BIRCH_FOREST, OverworldBiomes.forest(holderGetter, holderGetter2, true, true, false)); context.register(Biomes.OLD_GROWTH_PINE_TAIGA, OverworldBiomes.oldGrowthTaiga(holderGetter, holderGetter2, false)); context.register(Biomes.OLD_GROWTH_SPRUCE_TAIGA, OverworldBiomes.oldGrowthTaiga(holderGetter, holderGetter2, true)); diff --git a/net/minecraft/data/worldgen/biome/NetherBiomes.java b/net/minecraft/data/worldgen/biome/NetherBiomes.java index 982344d1..db33a5fb 100644 --- a/net/minecraft/data/worldgen/biome/NetherBiomes.java +++ b/net/minecraft/data/worldgen/biome/NetherBiomes.java @@ -20,22 +20,24 @@ import net.minecraft.world.level.biome.Biome; import net.minecraft.world.level.biome.BiomeGenerationSettings; import net.minecraft.world.level.biome.BiomeSpecialEffects; import net.minecraft.world.level.biome.MobSpawnSettings; +import net.minecraft.world.level.biome.MobSpawnSettings.Builder; +import net.minecraft.world.level.biome.MobSpawnSettings.SpawnerData; import net.minecraft.world.level.levelgen.GenerationStep; import net.minecraft.world.level.levelgen.carver.ConfiguredWorldCarver; import net.minecraft.world.level.levelgen.placement.PlacedFeature; public class NetherBiomes { public static Biome netherWastes(HolderGetter placedFeatures, HolderGetter> worldCarvers) { - MobSpawnSettings mobSpawnSettings = new MobSpawnSettings.Builder() - .addSpawn(MobCategory.MONSTER, new MobSpawnSettings.SpawnerData(EntityType.GHAST, 50, 4, 4)) - .addSpawn(MobCategory.MONSTER, new MobSpawnSettings.SpawnerData(EntityType.ZOMBIFIED_PIGLIN, 100, 4, 4)) - .addSpawn(MobCategory.MONSTER, new MobSpawnSettings.SpawnerData(EntityType.MAGMA_CUBE, 2, 4, 4)) - .addSpawn(MobCategory.MONSTER, new MobSpawnSettings.SpawnerData(EntityType.ENDERMAN, 1, 4, 4)) - .addSpawn(MobCategory.MONSTER, new MobSpawnSettings.SpawnerData(EntityType.PIGLIN, 15, 4, 4)) - .addSpawn(MobCategory.CREATURE, new MobSpawnSettings.SpawnerData(EntityType.STRIDER, 60, 1, 2)) + MobSpawnSettings mobSpawnSettings = new Builder() + .addSpawn(MobCategory.MONSTER, new SpawnerData(EntityType.GHAST, 50, 4, 4)) + .addSpawn(MobCategory.MONSTER, new SpawnerData(EntityType.ZOMBIFIED_PIGLIN, 100, 4, 4)) + .addSpawn(MobCategory.MONSTER, new SpawnerData(EntityType.MAGMA_CUBE, 2, 4, 4)) + .addSpawn(MobCategory.MONSTER, new SpawnerData(EntityType.ENDERMAN, 1, 4, 4)) + .addSpawn(MobCategory.MONSTER, new SpawnerData(EntityType.PIGLIN, 15, 4, 4)) + .addSpawn(MobCategory.CREATURE, new SpawnerData(EntityType.STRIDER, 60, 1, 2)) .build(); BiomeGenerationSettings.Builder builder = new BiomeGenerationSettings.Builder(placedFeatures, worldCarvers) - .addCarver(GenerationStep.Carving.AIR, Carvers.NETHER_CAVE) + .addCarver(Carvers.NETHER_CAVE) .addFeature(GenerationStep.Decoration.VEGETAL_DECORATION, MiscOverworldPlacements.SPRING_LAVA); BiomeDefaultFeatures.addDefaultMushrooms(builder); builder.addFeature(GenerationStep.Decoration.UNDERGROUND_DECORATION, NetherPlacements.SPRING_OPEN) @@ -72,18 +74,18 @@ public class NetherBiomes { public static Biome soulSandValley(HolderGetter placedFeatures, HolderGetter> worldCarvers) { double d = 0.7; double e = 0.15; - MobSpawnSettings mobSpawnSettings = new MobSpawnSettings.Builder() - .addSpawn(MobCategory.MONSTER, new MobSpawnSettings.SpawnerData(EntityType.SKELETON, 20, 5, 5)) - .addSpawn(MobCategory.MONSTER, new MobSpawnSettings.SpawnerData(EntityType.GHAST, 50, 4, 4)) - .addSpawn(MobCategory.MONSTER, new MobSpawnSettings.SpawnerData(EntityType.ENDERMAN, 1, 4, 4)) - .addSpawn(MobCategory.CREATURE, new MobSpawnSettings.SpawnerData(EntityType.STRIDER, 60, 1, 2)) + MobSpawnSettings mobSpawnSettings = new Builder() + .addSpawn(MobCategory.MONSTER, new SpawnerData(EntityType.SKELETON, 20, 5, 5)) + .addSpawn(MobCategory.MONSTER, new SpawnerData(EntityType.GHAST, 50, 4, 4)) + .addSpawn(MobCategory.MONSTER, new SpawnerData(EntityType.ENDERMAN, 1, 4, 4)) + .addSpawn(MobCategory.CREATURE, new SpawnerData(EntityType.STRIDER, 60, 1, 2)) .addMobCharge(EntityType.SKELETON, 0.7, 0.15) .addMobCharge(EntityType.GHAST, 0.7, 0.15) .addMobCharge(EntityType.ENDERMAN, 0.7, 0.15) .addMobCharge(EntityType.STRIDER, 0.7, 0.15) .build(); BiomeGenerationSettings.Builder builder = new BiomeGenerationSettings.Builder(placedFeatures, worldCarvers) - .addCarver(GenerationStep.Carving.AIR, Carvers.NETHER_CAVE) + .addCarver(Carvers.NETHER_CAVE) .addFeature(GenerationStep.Decoration.VEGETAL_DECORATION, MiscOverworldPlacements.SPRING_LAVA) .addFeature(GenerationStep.Decoration.LOCAL_MODIFICATIONS, NetherPlacements.BASALT_PILLAR) .addFeature(GenerationStep.Decoration.UNDERGROUND_DECORATION, NetherPlacements.SPRING_OPEN) @@ -119,13 +121,13 @@ public class NetherBiomes { } public static Biome basaltDeltas(HolderGetter placedFeatures, HolderGetter> worldCarvers) { - MobSpawnSettings mobSpawnSettings = new MobSpawnSettings.Builder() - .addSpawn(MobCategory.MONSTER, new MobSpawnSettings.SpawnerData(EntityType.GHAST, 40, 1, 1)) - .addSpawn(MobCategory.MONSTER, new MobSpawnSettings.SpawnerData(EntityType.MAGMA_CUBE, 100, 2, 5)) - .addSpawn(MobCategory.CREATURE, new MobSpawnSettings.SpawnerData(EntityType.STRIDER, 60, 1, 2)) + MobSpawnSettings mobSpawnSettings = new Builder() + .addSpawn(MobCategory.MONSTER, new SpawnerData(EntityType.GHAST, 40, 1, 1)) + .addSpawn(MobCategory.MONSTER, new SpawnerData(EntityType.MAGMA_CUBE, 100, 2, 5)) + .addSpawn(MobCategory.CREATURE, new SpawnerData(EntityType.STRIDER, 60, 1, 2)) .build(); BiomeGenerationSettings.Builder builder = new BiomeGenerationSettings.Builder(placedFeatures, worldCarvers) - .addCarver(GenerationStep.Carving.AIR, Carvers.NETHER_CAVE) + .addCarver(Carvers.NETHER_CAVE) .addFeature(GenerationStep.Decoration.SURFACE_STRUCTURES, NetherPlacements.DELTA) .addFeature(GenerationStep.Decoration.SURFACE_STRUCTURES, NetherPlacements.SMALL_BASALT_COLUMNS) .addFeature(GenerationStep.Decoration.SURFACE_STRUCTURES, NetherPlacements.LARGE_BASALT_COLUMNS) @@ -166,14 +168,14 @@ public class NetherBiomes { } public static Biome crimsonForest(HolderGetter placedFeatures, HolderGetter> worldCarvers) { - MobSpawnSettings mobSpawnSettings = new MobSpawnSettings.Builder() - .addSpawn(MobCategory.MONSTER, new MobSpawnSettings.SpawnerData(EntityType.ZOMBIFIED_PIGLIN, 1, 2, 4)) - .addSpawn(MobCategory.MONSTER, new MobSpawnSettings.SpawnerData(EntityType.HOGLIN, 9, 3, 4)) - .addSpawn(MobCategory.MONSTER, new MobSpawnSettings.SpawnerData(EntityType.PIGLIN, 5, 3, 4)) - .addSpawn(MobCategory.CREATURE, new MobSpawnSettings.SpawnerData(EntityType.STRIDER, 60, 1, 2)) + MobSpawnSettings mobSpawnSettings = new Builder() + .addSpawn(MobCategory.MONSTER, new SpawnerData(EntityType.ZOMBIFIED_PIGLIN, 1, 2, 4)) + .addSpawn(MobCategory.MONSTER, new SpawnerData(EntityType.HOGLIN, 9, 3, 4)) + .addSpawn(MobCategory.MONSTER, new SpawnerData(EntityType.PIGLIN, 5, 3, 4)) + .addSpawn(MobCategory.CREATURE, new SpawnerData(EntityType.STRIDER, 60, 1, 2)) .build(); BiomeGenerationSettings.Builder builder = new BiomeGenerationSettings.Builder(placedFeatures, worldCarvers) - .addCarver(GenerationStep.Carving.AIR, Carvers.NETHER_CAVE) + .addCarver(Carvers.NETHER_CAVE) .addFeature(GenerationStep.Decoration.VEGETAL_DECORATION, MiscOverworldPlacements.SPRING_LAVA); BiomeDefaultFeatures.addDefaultMushrooms(builder); builder.addFeature(GenerationStep.Decoration.UNDERGROUND_DECORATION, NetherPlacements.SPRING_OPEN) @@ -209,13 +211,13 @@ public class NetherBiomes { } public static Biome warpedForest(HolderGetter placedFeatures, HolderGetter> worldCarvers) { - MobSpawnSettings mobSpawnSettings = new MobSpawnSettings.Builder() - .addSpawn(MobCategory.MONSTER, new MobSpawnSettings.SpawnerData(EntityType.ENDERMAN, 1, 4, 4)) - .addSpawn(MobCategory.CREATURE, new MobSpawnSettings.SpawnerData(EntityType.STRIDER, 60, 1, 2)) + MobSpawnSettings mobSpawnSettings = new Builder() + .addSpawn(MobCategory.MONSTER, new SpawnerData(EntityType.ENDERMAN, 1, 4, 4)) + .addSpawn(MobCategory.CREATURE, new SpawnerData(EntityType.STRIDER, 60, 1, 2)) .addMobCharge(EntityType.ENDERMAN, 1.0, 0.12) .build(); BiomeGenerationSettings.Builder builder = new BiomeGenerationSettings.Builder(placedFeatures, worldCarvers) - .addCarver(GenerationStep.Carving.AIR, Carvers.NETHER_CAVE) + .addCarver(Carvers.NETHER_CAVE) .addFeature(GenerationStep.Decoration.VEGETAL_DECORATION, MiscOverworldPlacements.SPRING_LAVA); BiomeDefaultFeatures.addDefaultMushrooms(builder); builder.addFeature(GenerationStep.Decoration.UNDERGROUND_DECORATION, NetherPlacements.SPRING_OPEN) diff --git a/net/minecraft/data/worldgen/biome/OverworldBiomes.java b/net/minecraft/data/worldgen/biome/OverworldBiomes.java index a509322d..6525e387 100644 --- a/net/minecraft/data/worldgen/biome/OverworldBiomes.java +++ b/net/minecraft/data/worldgen/biome/OverworldBiomes.java @@ -16,7 +16,8 @@ import net.minecraft.world.level.biome.AmbientMoodSettings; import net.minecraft.world.level.biome.Biome; import net.minecraft.world.level.biome.BiomeGenerationSettings; import net.minecraft.world.level.biome.BiomeSpecialEffects; -import net.minecraft.world.level.biome.MobSpawnSettings; +import net.minecraft.world.level.biome.MobSpawnSettings.Builder; +import net.minecraft.world.level.biome.MobSpawnSettings.SpawnerData; import net.minecraft.world.level.levelgen.GenerationStep; import net.minecraft.world.level.levelgen.carver.ConfiguredWorldCarver; import net.minecraft.world.level.levelgen.placement.PlacedFeature; @@ -40,7 +41,7 @@ public class OverworldBiomes { boolean hasPercipitation, float temperature, float downfall, - MobSpawnSettings.Builder mobSpawnSettings, + Builder mobSpawnSettings, BiomeGenerationSettings.Builder generationSettings, @Nullable Music backgroundMusic ) { @@ -55,7 +56,7 @@ public class OverworldBiomes { int waterFogColor, @Nullable Integer grassColorOverride, @Nullable Integer foliageColorOverride, - MobSpawnSettings.Builder mobSpawnSettings, + Builder mobSpawnSettings, BiomeGenerationSettings.Builder generationSettings, @Nullable Music backgroundMusic ) { @@ -94,11 +95,11 @@ public class OverworldBiomes { } public static Biome oldGrowthTaiga(HolderGetter placedFeatures, HolderGetter> worldCarvers, boolean isSpruce) { - MobSpawnSettings.Builder builder = new MobSpawnSettings.Builder(); + Builder builder = new Builder(); BiomeDefaultFeatures.farmAnimals(builder); - builder.addSpawn(MobCategory.CREATURE, new MobSpawnSettings.SpawnerData(EntityType.WOLF, 8, 4, 4)); - builder.addSpawn(MobCategory.CREATURE, new MobSpawnSettings.SpawnerData(EntityType.RABBIT, 4, 2, 3)); - builder.addSpawn(MobCategory.CREATURE, new MobSpawnSettings.SpawnerData(EntityType.FOX, 8, 2, 4)); + builder.addSpawn(MobCategory.CREATURE, new SpawnerData(EntityType.WOLF, 8, 4, 4)); + builder.addSpawn(MobCategory.CREATURE, new SpawnerData(EntityType.RABBIT, 4, 2, 3)); + builder.addSpawn(MobCategory.CREATURE, new SpawnerData(EntityType.FOX, 8, 2, 4)); if (isSpruce) { BiomeDefaultFeatures.commonSpawns(builder); } else { @@ -126,27 +127,27 @@ public class OverworldBiomes { } public static Biome sparseJungle(HolderGetter placedFeatures, HolderGetter> worldCarvers) { - MobSpawnSettings.Builder builder = new MobSpawnSettings.Builder(); + Builder builder = new Builder(); BiomeDefaultFeatures.baseJungleSpawns(builder); - builder.addSpawn(MobCategory.CREATURE, new MobSpawnSettings.SpawnerData(EntityType.WOLF, 8, 2, 4)); + builder.addSpawn(MobCategory.CREATURE, new SpawnerData(EntityType.WOLF, 8, 2, 4)); return baseJungle(placedFeatures, worldCarvers, 0.8F, false, true, false, builder, Musics.createGameMusic(SoundEvents.MUSIC_BIOME_SPARSE_JUNGLE)); } public static Biome jungle(HolderGetter placedFeatures, HolderGetter> worldCarvers) { - MobSpawnSettings.Builder builder = new MobSpawnSettings.Builder(); + Builder builder = new Builder(); BiomeDefaultFeatures.baseJungleSpawns(builder); - builder.addSpawn(MobCategory.CREATURE, new MobSpawnSettings.SpawnerData(EntityType.PARROT, 40, 1, 2)) - .addSpawn(MobCategory.MONSTER, new MobSpawnSettings.SpawnerData(EntityType.OCELOT, 2, 1, 3)) - .addSpawn(MobCategory.CREATURE, new MobSpawnSettings.SpawnerData(EntityType.PANDA, 1, 1, 2)); + builder.addSpawn(MobCategory.CREATURE, new SpawnerData(EntityType.PARROT, 40, 1, 2)) + .addSpawn(MobCategory.MONSTER, new SpawnerData(EntityType.OCELOT, 2, 1, 3)) + .addSpawn(MobCategory.CREATURE, new SpawnerData(EntityType.PANDA, 1, 1, 2)); return baseJungle(placedFeatures, worldCarvers, 0.9F, false, false, true, builder, Musics.createGameMusic(SoundEvents.MUSIC_BIOME_JUNGLE)); } public static Biome bambooJungle(HolderGetter placedFeatures, HolderGetter> worldCarvers) { - MobSpawnSettings.Builder builder = new MobSpawnSettings.Builder(); + Builder builder = new Builder(); BiomeDefaultFeatures.baseJungleSpawns(builder); - builder.addSpawn(MobCategory.CREATURE, new MobSpawnSettings.SpawnerData(EntityType.PARROT, 40, 1, 2)) - .addSpawn(MobCategory.CREATURE, new MobSpawnSettings.SpawnerData(EntityType.PANDA, 80, 1, 2)) - .addSpawn(MobCategory.MONSTER, new MobSpawnSettings.SpawnerData(EntityType.OCELOT, 2, 1, 1)); + builder.addSpawn(MobCategory.CREATURE, new SpawnerData(EntityType.PARROT, 40, 1, 2)) + .addSpawn(MobCategory.CREATURE, new SpawnerData(EntityType.PANDA, 80, 1, 2)) + .addSpawn(MobCategory.MONSTER, new SpawnerData(EntityType.OCELOT, 2, 1, 1)); return baseJungle(placedFeatures, worldCarvers, 0.9F, true, false, true, builder, Musics.createGameMusic(SoundEvents.MUSIC_BIOME_BAMBOO_JUNGLE)); } @@ -157,7 +158,7 @@ public class OverworldBiomes { boolean isBambooJungle, boolean isSparse, boolean addBamboo, - MobSpawnSettings.Builder mobSpawnSettings, + Builder mobSpawnSettings, Music backgroudMusic ) { BiomeGenerationSettings.Builder builder = new BiomeGenerationSettings.Builder(placedFeatures, worldCarvers); @@ -193,9 +194,9 @@ public class OverworldBiomes { } public static Biome windsweptHills(HolderGetter placedFeatures, HolderGetter> worldCarvers, boolean isForest) { - MobSpawnSettings.Builder builder = new MobSpawnSettings.Builder(); + Builder builder = new Builder(); BiomeDefaultFeatures.farmAnimals(builder); - builder.addSpawn(MobCategory.CREATURE, new MobSpawnSettings.SpawnerData(EntityType.LLAMA, 5, 4, 6)); + builder.addSpawn(MobCategory.CREATURE, new SpawnerData(EntityType.LLAMA, 5, 4, 6)); BiomeDefaultFeatures.commonSpawns(builder); BiomeGenerationSettings.Builder builder2 = new BiomeGenerationSettings.Builder(placedFeatures, worldCarvers); globalOverworldGeneration(builder2); @@ -217,7 +218,7 @@ public class OverworldBiomes { } public static Biome desert(HolderGetter placedFeatures, HolderGetter> worldCarvers) { - MobSpawnSettings.Builder builder = new MobSpawnSettings.Builder(); + Builder builder = new Builder(); BiomeDefaultFeatures.desertSpawns(builder); BiomeGenerationSettings.Builder builder2 = new BiomeGenerationSettings.Builder(placedFeatures, worldCarvers); BiomeDefaultFeatures.addFossilDecoration(builder2); @@ -240,7 +241,7 @@ public class OverworldBiomes { boolean isCold, boolean isIceSpikes ) { - MobSpawnSettings.Builder builder = new MobSpawnSettings.Builder(); + Builder builder = new Builder(); BiomeGenerationSettings.Builder builder2 = new BiomeGenerationSettings.Builder(placedFeatures, worldCarvers); globalOverworldGeneration(builder2); if (isCold) { @@ -281,7 +282,7 @@ public class OverworldBiomes { } public static Biome mushroomFields(HolderGetter placedFeatures, HolderGetter> worldCarvers) { - MobSpawnSettings.Builder builder = new MobSpawnSettings.Builder(); + Builder builder = new Builder(); BiomeDefaultFeatures.mooshroomSpawns(builder); BiomeGenerationSettings.Builder builder2 = new BiomeGenerationSettings.Builder(placedFeatures, worldCarvers); globalOverworldGeneration(builder2); @@ -315,27 +316,27 @@ public class OverworldBiomes { BiomeDefaultFeatures.addDefaultMushrooms(builder); BiomeDefaultFeatures.addDefaultExtraVegetation(builder); - MobSpawnSettings.Builder builder2 = new MobSpawnSettings.Builder(); + Builder builder2 = new Builder(); BiomeDefaultFeatures.farmAnimals(builder2); - builder2.addSpawn(MobCategory.CREATURE, new MobSpawnSettings.SpawnerData(EntityType.HORSE, 1, 2, 6)) - .addSpawn(MobCategory.CREATURE, new MobSpawnSettings.SpawnerData(EntityType.DONKEY, 1, 1, 1)) - .addSpawn(MobCategory.CREATURE, new MobSpawnSettings.SpawnerData(EntityType.ARMADILLO, 10, 2, 3)); + builder2.addSpawn(MobCategory.CREATURE, new SpawnerData(EntityType.HORSE, 1, 2, 6)) + .addSpawn(MobCategory.CREATURE, new SpawnerData(EntityType.DONKEY, 1, 1, 1)) + .addSpawn(MobCategory.CREATURE, new SpawnerData(EntityType.ARMADILLO, 10, 2, 3)); BiomeDefaultFeatures.commonSpawns(builder2); if (isPlateau) { - builder2.addSpawn(MobCategory.CREATURE, new MobSpawnSettings.SpawnerData(EntityType.LLAMA, 8, 4, 4)); - builder2.addSpawn(MobCategory.CREATURE, new MobSpawnSettings.SpawnerData(EntityType.WOLF, 8, 4, 8)); + builder2.addSpawn(MobCategory.CREATURE, new SpawnerData(EntityType.LLAMA, 8, 4, 4)); + builder2.addSpawn(MobCategory.CREATURE, new SpawnerData(EntityType.WOLF, 8, 4, 8)); } return biome(false, 2.0F, 0.0F, builder2, builder, NORMAL_MUSIC); } public static Biome badlands(HolderGetter placedFeatures, HolderGetter> worldCarvers, boolean trees) { - MobSpawnSettings.Builder builder = new MobSpawnSettings.Builder(); + Builder builder = new Builder(); BiomeDefaultFeatures.commonSpawns(builder); - builder.addSpawn(MobCategory.CREATURE, new MobSpawnSettings.SpawnerData(EntityType.ARMADILLO, 6, 1, 2)); + builder.addSpawn(MobCategory.CREATURE, new SpawnerData(EntityType.ARMADILLO, 6, 1, 2)); builder.creatureGenerationProbability(0.03F); if (trees) { - builder.addSpawn(MobCategory.CREATURE, new MobSpawnSettings.SpawnerData(EntityType.WOLF, 2, 4, 8)); + builder.addSpawn(MobCategory.CREATURE, new SpawnerData(EntityType.WOLF, 2, 4, 8)); builder.creatureGenerationProbability(0.04F); } @@ -372,9 +373,7 @@ public class OverworldBiomes { .build(); } - private static Biome baseOcean( - MobSpawnSettings.Builder mobSpawnSettings, int waterColor, int waterFogColor, BiomeGenerationSettings.Builder generationSettings - ) { + private static Biome baseOcean(Builder mobSpawnSettings, int waterColor, int waterFogColor, BiomeGenerationSettings.Builder generationSettings) { return biome(true, 0.5F, 0.5F, waterColor, waterFogColor, null, null, mobSpawnSettings, generationSettings, NORMAL_MUSIC); } @@ -394,51 +393,44 @@ public class OverworldBiomes { } public static Biome coldOcean(HolderGetter placedFeatures, HolderGetter> worldCarvers, boolean isDeep) { - MobSpawnSettings.Builder builder = new MobSpawnSettings.Builder(); + Builder builder = new Builder(); BiomeDefaultFeatures.oceanSpawns(builder, 3, 4, 15); - builder.addSpawn(MobCategory.WATER_AMBIENT, new MobSpawnSettings.SpawnerData(EntityType.SALMON, 15, 1, 5)); + builder.addSpawn(MobCategory.WATER_AMBIENT, new SpawnerData(EntityType.SALMON, 15, 1, 5)); BiomeGenerationSettings.Builder builder2 = baseOceanGeneration(placedFeatures, worldCarvers); builder2.addFeature(GenerationStep.Decoration.VEGETAL_DECORATION, isDeep ? AquaticPlacements.SEAGRASS_DEEP_COLD : AquaticPlacements.SEAGRASS_COLD); - BiomeDefaultFeatures.addDefaultSeagrass(builder2); BiomeDefaultFeatures.addColdOceanExtraVegetation(builder2); return baseOcean(builder, 4020182, 329011, builder2); } public static Biome ocean(HolderGetter placedFeatures, HolderGetter> worldCarvers, boolean isDeep) { - MobSpawnSettings.Builder builder = new MobSpawnSettings.Builder(); + Builder builder = new Builder(); BiomeDefaultFeatures.oceanSpawns(builder, 1, 4, 10); - builder.addSpawn(MobCategory.WATER_CREATURE, new MobSpawnSettings.SpawnerData(EntityType.DOLPHIN, 1, 1, 2)); + builder.addSpawn(MobCategory.WATER_CREATURE, new SpawnerData(EntityType.DOLPHIN, 1, 1, 2)); BiomeGenerationSettings.Builder builder2 = baseOceanGeneration(placedFeatures, worldCarvers); builder2.addFeature(GenerationStep.Decoration.VEGETAL_DECORATION, isDeep ? AquaticPlacements.SEAGRASS_DEEP : AquaticPlacements.SEAGRASS_NORMAL); - BiomeDefaultFeatures.addDefaultSeagrass(builder2); BiomeDefaultFeatures.addColdOceanExtraVegetation(builder2); return baseOcean(builder, 4159204, 329011, builder2); } public static Biome lukeWarmOcean(HolderGetter placedFeatures, HolderGetter> worldCarvers, boolean isDeep) { - MobSpawnSettings.Builder builder = new MobSpawnSettings.Builder(); + Builder builder = new Builder(); if (isDeep) { BiomeDefaultFeatures.oceanSpawns(builder, 8, 4, 8); } else { BiomeDefaultFeatures.oceanSpawns(builder, 10, 2, 15); } - builder.addSpawn(MobCategory.WATER_AMBIENT, new MobSpawnSettings.SpawnerData(EntityType.PUFFERFISH, 5, 1, 3)) - .addSpawn(MobCategory.WATER_AMBIENT, new MobSpawnSettings.SpawnerData(EntityType.TROPICAL_FISH, 25, 8, 8)) - .addSpawn(MobCategory.WATER_CREATURE, new MobSpawnSettings.SpawnerData(EntityType.DOLPHIN, 2, 1, 2)); + builder.addSpawn(MobCategory.WATER_AMBIENT, new SpawnerData(EntityType.PUFFERFISH, 5, 1, 3)) + .addSpawn(MobCategory.WATER_AMBIENT, new SpawnerData(EntityType.TROPICAL_FISH, 25, 8, 8)) + .addSpawn(MobCategory.WATER_CREATURE, new SpawnerData(EntityType.DOLPHIN, 2, 1, 2)); BiomeGenerationSettings.Builder builder2 = baseOceanGeneration(placedFeatures, worldCarvers); builder2.addFeature(GenerationStep.Decoration.VEGETAL_DECORATION, isDeep ? AquaticPlacements.SEAGRASS_DEEP_WARM : AquaticPlacements.SEAGRASS_WARM); - if (isDeep) { - BiomeDefaultFeatures.addDefaultSeagrass(builder2); - } - BiomeDefaultFeatures.addLukeWarmKelp(builder2); return baseOcean(builder, 4566514, 267827, builder2); } public static Biome warmOcean(HolderGetter placedFeatures, HolderGetter> worldCarvers) { - MobSpawnSettings.Builder builder = new MobSpawnSettings.Builder() - .addSpawn(MobCategory.WATER_AMBIENT, new MobSpawnSettings.SpawnerData(EntityType.PUFFERFISH, 15, 1, 3)); + Builder builder = new Builder().addSpawn(MobCategory.WATER_AMBIENT, new SpawnerData(EntityType.PUFFERFISH, 15, 1, 3)); BiomeDefaultFeatures.warmOceanSpawns(builder, 10, 4); BiomeGenerationSettings.Builder builder2 = baseOceanGeneration(placedFeatures, worldCarvers) .addFeature(GenerationStep.Decoration.VEGETAL_DECORATION, AquaticPlacements.WARM_OCEAN_VEGETATION) @@ -448,12 +440,12 @@ public class OverworldBiomes { } public static Biome frozenOcean(HolderGetter placedFeatures, HolderGetter> worldCarvers, boolean isDeep) { - MobSpawnSettings.Builder builder = new MobSpawnSettings.Builder() - .addSpawn(MobCategory.WATER_CREATURE, new MobSpawnSettings.SpawnerData(EntityType.SQUID, 1, 1, 4)) - .addSpawn(MobCategory.WATER_AMBIENT, new MobSpawnSettings.SpawnerData(EntityType.SALMON, 15, 1, 5)) - .addSpawn(MobCategory.CREATURE, new MobSpawnSettings.SpawnerData(EntityType.POLAR_BEAR, 1, 1, 2)); + Builder builder = new Builder() + .addSpawn(MobCategory.WATER_CREATURE, new SpawnerData(EntityType.SQUID, 1, 1, 4)) + .addSpawn(MobCategory.WATER_AMBIENT, new SpawnerData(EntityType.SALMON, 15, 1, 5)) + .addSpawn(MobCategory.CREATURE, new SpawnerData(EntityType.POLAR_BEAR, 1, 1, 2)); BiomeDefaultFeatures.commonSpawns(builder); - builder.addSpawn(MobCategory.MONSTER, new MobSpawnSettings.SpawnerData(EntityType.DROWNED, 5, 1, 1)); + builder.addSpawn(MobCategory.MONSTER, new SpawnerData(EntityType.DROWNED, 5, 1, 1)); float f = isDeep ? 0.5F : 0.0F; BiomeGenerationSettings.Builder builder2 = new BiomeGenerationSettings.Builder(placedFeatures, worldCarvers); BiomeDefaultFeatures.addIcebergs(builder2); @@ -526,13 +518,13 @@ public class OverworldBiomes { BiomeDefaultFeatures.addDefaultMushrooms(builder); BiomeDefaultFeatures.addDefaultExtraVegetation(builder); - MobSpawnSettings.Builder builder2 = new MobSpawnSettings.Builder(); + Builder builder2 = new Builder(); BiomeDefaultFeatures.farmAnimals(builder2); BiomeDefaultFeatures.commonSpawns(builder2); if (isFlowerForest) { - builder2.addSpawn(MobCategory.CREATURE, new MobSpawnSettings.SpawnerData(EntityType.RABBIT, 4, 2, 3)); + builder2.addSpawn(MobCategory.CREATURE, new SpawnerData(EntityType.RABBIT, 4, 2, 3)); } else if (!isBirchForest) { - builder2.addSpawn(MobCategory.CREATURE, new MobSpawnSettings.SpawnerData(EntityType.WOLF, 5, 4, 4)); + builder2.addSpawn(MobCategory.CREATURE, new SpawnerData(EntityType.WOLF, 5, 4, 4)); } float f = isBirchForest ? 0.6F : 0.7F; @@ -540,11 +532,11 @@ public class OverworldBiomes { } public static Biome taiga(HolderGetter placedFeatures, HolderGetter> worldCarvers, boolean isCold) { - MobSpawnSettings.Builder builder = new MobSpawnSettings.Builder(); + Builder builder = new Builder(); BiomeDefaultFeatures.farmAnimals(builder); - builder.addSpawn(MobCategory.CREATURE, new MobSpawnSettings.SpawnerData(EntityType.WOLF, 8, 4, 4)) - .addSpawn(MobCategory.CREATURE, new MobSpawnSettings.SpawnerData(EntityType.RABBIT, 4, 2, 3)) - .addSpawn(MobCategory.CREATURE, new MobSpawnSettings.SpawnerData(EntityType.FOX, 8, 2, 4)); + builder.addSpawn(MobCategory.CREATURE, new SpawnerData(EntityType.WOLF, 8, 4, 4)) + .addSpawn(MobCategory.CREATURE, new SpawnerData(EntityType.RABBIT, 4, 2, 3)) + .addSpawn(MobCategory.CREATURE, new SpawnerData(EntityType.FOX, 8, 2, 4)); BiomeDefaultFeatures.commonSpawns(builder); float f = isCold ? -0.5F : 0.25F; BiomeGenerationSettings.Builder builder2 = new BiomeGenerationSettings.Builder(placedFeatures, worldCarvers); @@ -565,19 +557,33 @@ public class OverworldBiomes { return biome(true, f, isCold ? 0.4F : 0.8F, isCold ? 4020182 : 4159204, 329011, null, null, builder, builder2, NORMAL_MUSIC); } - public static Biome darkForest(HolderGetter placedFeatures, HolderGetter> worldCarvers) { - MobSpawnSettings.Builder builder = new MobSpawnSettings.Builder(); - BiomeDefaultFeatures.farmAnimals(builder); + public static Biome darkForest(HolderGetter holderGetter, HolderGetter> holderGetter2, boolean bl) { + Builder builder = new Builder(); + if (!bl) { + BiomeDefaultFeatures.farmAnimals(builder); + } + BiomeDefaultFeatures.commonSpawns(builder); - BiomeGenerationSettings.Builder builder2 = new BiomeGenerationSettings.Builder(placedFeatures, worldCarvers); + BiomeGenerationSettings.Builder builder2 = new BiomeGenerationSettings.Builder(holderGetter, holderGetter2); globalOverworldGeneration(builder2); - builder2.addFeature(GenerationStep.Decoration.VEGETAL_DECORATION, VegetationPlacements.DARK_FOREST_VEGETATION); - BiomeDefaultFeatures.addForestFlowers(builder2); + builder2.addFeature( + GenerationStep.Decoration.VEGETAL_DECORATION, bl ? VegetationPlacements.PALE_GARDEN_VEGETATION : VegetationPlacements.DARK_FOREST_VEGETATION + ); + if (!bl) { + BiomeDefaultFeatures.addForestFlowers(builder2); + } + BiomeDefaultFeatures.addDefaultOres(builder2); BiomeDefaultFeatures.addDefaultSoftDisks(builder2); - BiomeDefaultFeatures.addDefaultFlowers(builder2); + if (!bl) { + BiomeDefaultFeatures.addDefaultFlowers(builder2); + } + BiomeDefaultFeatures.addForestGrass(builder2); - BiomeDefaultFeatures.addDefaultMushrooms(builder2); + if (!bl) { + BiomeDefaultFeatures.addDefaultMushrooms(builder2); + } + BiomeDefaultFeatures.addDefaultExtraVegetation(builder2); Music music = Musics.createGameMusic(SoundEvents.MUSIC_BIOME_FOREST); return new Biome.BiomeBuilder() @@ -585,15 +591,26 @@ public class OverworldBiomes { .temperature(0.7F) .downfall(0.8F) .specialEffects( - new BiomeSpecialEffects.Builder() - .waterColor(4159204) - .waterFogColor(329011) - .fogColor(12638463) - .skyColor(calculateSkyColor(0.7F)) - .grassColorModifier(BiomeSpecialEffects.GrassColorModifier.DARK_FOREST) - .ambientMoodSound(AmbientMoodSettings.LEGACY_CAVE_SETTINGS) - .backgroundMusic(music) - .build() + bl + ? new BiomeSpecialEffects.Builder() + .waterColor(7768221) + .waterFogColor(5597568) + .fogColor(8484720) + .skyColor(12171705) + .grassColorOverride(7832178) + .foliageColorOverride(8883574) + .ambientMoodSound(AmbientMoodSettings.LEGACY_CAVE_SETTINGS) + .backgroundMusic(music) + .build() + : new BiomeSpecialEffects.Builder() + .waterColor(4159204) + .waterFogColor(329011) + .fogColor(12638463) + .skyColor(calculateSkyColor(0.7F)) + .grassColorModifier(BiomeSpecialEffects.GrassColorModifier.DARK_FOREST) + .ambientMoodSound(AmbientMoodSettings.LEGACY_CAVE_SETTINGS) + .backgroundMusic(music) + .build() ) .mobSpawnSettings(builder.build()) .generationSettings(builder2.build()) @@ -601,12 +618,12 @@ public class OverworldBiomes { } public static Biome swamp(HolderGetter placedFeatures, HolderGetter> worldCarvers) { - MobSpawnSettings.Builder builder = new MobSpawnSettings.Builder(); + Builder builder = new Builder(); BiomeDefaultFeatures.farmAnimals(builder); BiomeDefaultFeatures.commonSpawns(builder, 70); - builder.addSpawn(MobCategory.MONSTER, new MobSpawnSettings.SpawnerData(EntityType.SLIME, 1, 1, 1)); - builder.addSpawn(MobCategory.MONSTER, new MobSpawnSettings.SpawnerData(EntityType.BOGGED, 30, 4, 4)); - builder.addSpawn(MobCategory.CREATURE, new MobSpawnSettings.SpawnerData(EntityType.FROG, 10, 2, 5)); + builder.addSpawn(MobCategory.MONSTER, new SpawnerData(EntityType.SLIME, 1, 1, 1)); + builder.addSpawn(MobCategory.MONSTER, new SpawnerData(EntityType.BOGGED, 30, 4, 4)); + builder.addSpawn(MobCategory.CREATURE, new SpawnerData(EntityType.FROG, 10, 2, 5)); BiomeGenerationSettings.Builder builder2 = new BiomeGenerationSettings.Builder(placedFeatures, worldCarvers); BiomeDefaultFeatures.addFossilDecoration(builder2); globalOverworldGeneration(builder2); @@ -639,12 +656,12 @@ public class OverworldBiomes { } public static Biome mangroveSwamp(HolderGetter placedFeatures, HolderGetter> worldCarvers) { - MobSpawnSettings.Builder builder = new MobSpawnSettings.Builder(); + Builder builder = new Builder(); BiomeDefaultFeatures.commonSpawns(builder, 70); - builder.addSpawn(MobCategory.MONSTER, new MobSpawnSettings.SpawnerData(EntityType.SLIME, 1, 1, 1)); - builder.addSpawn(MobCategory.MONSTER, new MobSpawnSettings.SpawnerData(EntityType.BOGGED, 30, 4, 4)); - builder.addSpawn(MobCategory.CREATURE, new MobSpawnSettings.SpawnerData(EntityType.FROG, 10, 2, 5)); - builder.addSpawn(MobCategory.WATER_AMBIENT, new MobSpawnSettings.SpawnerData(EntityType.TROPICAL_FISH, 25, 8, 8)); + builder.addSpawn(MobCategory.MONSTER, new SpawnerData(EntityType.SLIME, 1, 1, 1)); + builder.addSpawn(MobCategory.MONSTER, new SpawnerData(EntityType.BOGGED, 30, 4, 4)); + builder.addSpawn(MobCategory.CREATURE, new SpawnerData(EntityType.FROG, 10, 2, 5)); + builder.addSpawn(MobCategory.WATER_AMBIENT, new SpawnerData(EntityType.TROPICAL_FISH, 25, 8, 8)); BiomeGenerationSettings.Builder builder2 = new BiomeGenerationSettings.Builder(placedFeatures, worldCarvers); BiomeDefaultFeatures.addFossilDecoration(builder2); globalOverworldGeneration(builder2); @@ -675,11 +692,11 @@ public class OverworldBiomes { } public static Biome river(HolderGetter placedFeatures, HolderGetter> worldCarvers, boolean isCold) { - MobSpawnSettings.Builder builder = new MobSpawnSettings.Builder() - .addSpawn(MobCategory.WATER_CREATURE, new MobSpawnSettings.SpawnerData(EntityType.SQUID, 2, 1, 4)) - .addSpawn(MobCategory.WATER_AMBIENT, new MobSpawnSettings.SpawnerData(EntityType.SALMON, 5, 1, 5)); + Builder builder = new Builder() + .addSpawn(MobCategory.WATER_CREATURE, new SpawnerData(EntityType.SQUID, 2, 1, 4)) + .addSpawn(MobCategory.WATER_AMBIENT, new SpawnerData(EntityType.SALMON, 5, 1, 5)); BiomeDefaultFeatures.commonSpawns(builder); - builder.addSpawn(MobCategory.MONSTER, new MobSpawnSettings.SpawnerData(EntityType.DROWNED, isCold ? 1 : 100, 1, 1)); + builder.addSpawn(MobCategory.MONSTER, new SpawnerData(EntityType.DROWNED, isCold ? 1 : 100, 1, 1)); BiomeGenerationSettings.Builder builder2 = new BiomeGenerationSettings.Builder(placedFeatures, worldCarvers); globalOverworldGeneration(builder2); BiomeDefaultFeatures.addDefaultOres(builder2); @@ -698,10 +715,10 @@ public class OverworldBiomes { } public static Biome beach(HolderGetter placedFeatures, HolderGetter> worldCarvers, boolean isCold, boolean isStony) { - MobSpawnSettings.Builder builder = new MobSpawnSettings.Builder(); + Builder builder = new Builder(); boolean bl = !isStony && !isCold; if (bl) { - builder.addSpawn(MobCategory.CREATURE, new MobSpawnSettings.SpawnerData(EntityType.TURTLE, 5, 2, 5)); + builder.addSpawn(MobCategory.CREATURE, new SpawnerData(EntityType.TURTLE, 5, 2, 5)); } BiomeDefaultFeatures.commonSpawns(builder); @@ -728,15 +745,15 @@ public class OverworldBiomes { public static Biome theVoid(HolderGetter placedFeatures, HolderGetter> worldCarvers) { BiomeGenerationSettings.Builder builder = new BiomeGenerationSettings.Builder(placedFeatures, worldCarvers); builder.addFeature(GenerationStep.Decoration.TOP_LAYER_MODIFICATION, MiscOverworldPlacements.VOID_START_PLATFORM); - return biome(false, 0.5F, 0.5F, new MobSpawnSettings.Builder(), builder, NORMAL_MUSIC); + return biome(false, 0.5F, 0.5F, new Builder(), builder, NORMAL_MUSIC); } public static Biome meadowOrCherryGrove(HolderGetter placedFeatures, HolderGetter> worldCarvers, boolean isCherryGrove) { BiomeGenerationSettings.Builder builder = new BiomeGenerationSettings.Builder(placedFeatures, worldCarvers); - MobSpawnSettings.Builder builder2 = new MobSpawnSettings.Builder(); - builder2.addSpawn(MobCategory.CREATURE, new MobSpawnSettings.SpawnerData(isCherryGrove ? EntityType.PIG : EntityType.DONKEY, 1, 1, 2)) - .addSpawn(MobCategory.CREATURE, new MobSpawnSettings.SpawnerData(EntityType.RABBIT, 2, 2, 6)) - .addSpawn(MobCategory.CREATURE, new MobSpawnSettings.SpawnerData(EntityType.SHEEP, 2, 2, 4)); + Builder builder2 = new Builder(); + builder2.addSpawn(MobCategory.CREATURE, new SpawnerData(isCherryGrove ? EntityType.PIG : EntityType.DONKEY, 1, 1, 2)) + .addSpawn(MobCategory.CREATURE, new SpawnerData(EntityType.RABBIT, 2, 2, 6)) + .addSpawn(MobCategory.CREATURE, new SpawnerData(EntityType.SHEEP, 2, 2, 4)); BiomeDefaultFeatures.commonSpawns(builder2); globalOverworldGeneration(builder); BiomeDefaultFeatures.addPlainGrass(builder); @@ -758,8 +775,8 @@ public class OverworldBiomes { public static Biome frozenPeaks(HolderGetter placedFeatures, HolderGetter> worldCarvers) { BiomeGenerationSettings.Builder builder = new BiomeGenerationSettings.Builder(placedFeatures, worldCarvers); - MobSpawnSettings.Builder builder2 = new MobSpawnSettings.Builder(); - builder2.addSpawn(MobCategory.CREATURE, new MobSpawnSettings.SpawnerData(EntityType.GOAT, 5, 1, 3)); + Builder builder2 = new Builder(); + builder2.addSpawn(MobCategory.CREATURE, new SpawnerData(EntityType.GOAT, 5, 1, 3)); BiomeDefaultFeatures.commonSpawns(builder2); globalOverworldGeneration(builder); BiomeDefaultFeatures.addFrozenSprings(builder); @@ -773,8 +790,8 @@ public class OverworldBiomes { public static Biome jaggedPeaks(HolderGetter placedFeatures, HolderGetter> worldCarvers) { BiomeGenerationSettings.Builder builder = new BiomeGenerationSettings.Builder(placedFeatures, worldCarvers); - MobSpawnSettings.Builder builder2 = new MobSpawnSettings.Builder(); - builder2.addSpawn(MobCategory.CREATURE, new MobSpawnSettings.SpawnerData(EntityType.GOAT, 5, 1, 3)); + Builder builder2 = new Builder(); + builder2.addSpawn(MobCategory.CREATURE, new SpawnerData(EntityType.GOAT, 5, 1, 3)); BiomeDefaultFeatures.commonSpawns(builder2); globalOverworldGeneration(builder); BiomeDefaultFeatures.addFrozenSprings(builder); @@ -788,7 +805,7 @@ public class OverworldBiomes { public static Biome stonyPeaks(HolderGetter placedFeatures, HolderGetter> worldCarvers) { BiomeGenerationSettings.Builder builder = new BiomeGenerationSettings.Builder(placedFeatures, worldCarvers); - MobSpawnSettings.Builder builder2 = new MobSpawnSettings.Builder(); + Builder builder2 = new Builder(); BiomeDefaultFeatures.commonSpawns(builder2); globalOverworldGeneration(builder); BiomeDefaultFeatures.addDefaultOres(builder); @@ -801,9 +818,9 @@ public class OverworldBiomes { public static Biome snowySlopes(HolderGetter placedFeatures, HolderGetter> worldCarvers) { BiomeGenerationSettings.Builder builder = new BiomeGenerationSettings.Builder(placedFeatures, worldCarvers); - MobSpawnSettings.Builder builder2 = new MobSpawnSettings.Builder(); - builder2.addSpawn(MobCategory.CREATURE, new MobSpawnSettings.SpawnerData(EntityType.RABBIT, 4, 2, 3)) - .addSpawn(MobCategory.CREATURE, new MobSpawnSettings.SpawnerData(EntityType.GOAT, 5, 1, 3)); + Builder builder2 = new Builder(); + builder2.addSpawn(MobCategory.CREATURE, new SpawnerData(EntityType.RABBIT, 4, 2, 3)) + .addSpawn(MobCategory.CREATURE, new SpawnerData(EntityType.GOAT, 5, 1, 3)); BiomeDefaultFeatures.commonSpawns(builder2); globalOverworldGeneration(builder); BiomeDefaultFeatures.addFrozenSprings(builder); @@ -818,10 +835,10 @@ public class OverworldBiomes { public static Biome grove(HolderGetter placedFeatures, HolderGetter> worldCarvers) { BiomeGenerationSettings.Builder builder = new BiomeGenerationSettings.Builder(placedFeatures, worldCarvers); - MobSpawnSettings.Builder builder2 = new MobSpawnSettings.Builder(); - builder2.addSpawn(MobCategory.CREATURE, new MobSpawnSettings.SpawnerData(EntityType.WOLF, 1, 1, 1)) - .addSpawn(MobCategory.CREATURE, new MobSpawnSettings.SpawnerData(EntityType.RABBIT, 8, 2, 3)) - .addSpawn(MobCategory.CREATURE, new MobSpawnSettings.SpawnerData(EntityType.FOX, 4, 2, 4)); + Builder builder2 = new Builder(); + builder2.addSpawn(MobCategory.CREATURE, new SpawnerData(EntityType.WOLF, 1, 1, 1)) + .addSpawn(MobCategory.CREATURE, new SpawnerData(EntityType.RABBIT, 8, 2, 3)) + .addSpawn(MobCategory.CREATURE, new SpawnerData(EntityType.FOX, 4, 2, 4)); BiomeDefaultFeatures.commonSpawns(builder2); globalOverworldGeneration(builder); BiomeDefaultFeatures.addFrozenSprings(builder); @@ -836,9 +853,9 @@ public class OverworldBiomes { } public static Biome lushCaves(HolderGetter placedFeatures, HolderGetter> worldCarvers) { - MobSpawnSettings.Builder builder = new MobSpawnSettings.Builder(); - builder.addSpawn(MobCategory.AXOLOTLS, new MobSpawnSettings.SpawnerData(EntityType.AXOLOTL, 10, 4, 6)); - builder.addSpawn(MobCategory.WATER_AMBIENT, new MobSpawnSettings.SpawnerData(EntityType.TROPICAL_FISH, 25, 8, 8)); + Builder builder = new Builder(); + builder.addSpawn(MobCategory.AXOLOTLS, new SpawnerData(EntityType.AXOLOTL, 10, 4, 6)); + builder.addSpawn(MobCategory.WATER_AMBIENT, new SpawnerData(EntityType.TROPICAL_FISH, 25, 8, 8)); BiomeDefaultFeatures.commonSpawns(builder); BiomeGenerationSettings.Builder builder2 = new BiomeGenerationSettings.Builder(placedFeatures, worldCarvers); globalOverworldGeneration(builder2); @@ -852,7 +869,7 @@ public class OverworldBiomes { } public static Biome dripstoneCaves(HolderGetter placedFeatures, HolderGetter> worldCarvers) { - MobSpawnSettings.Builder builder = new MobSpawnSettings.Builder(); + Builder builder = new Builder(); BiomeDefaultFeatures.dripstoneCavesSpawns(builder); BiomeGenerationSettings.Builder builder2 = new BiomeGenerationSettings.Builder(placedFeatures, worldCarvers); globalOverworldGeneration(builder2); @@ -868,11 +885,11 @@ public class OverworldBiomes { } public static Biome deepDark(HolderGetter placedFeatures, HolderGetter> worldCarvers) { - MobSpawnSettings.Builder builder = new MobSpawnSettings.Builder(); + Builder builder = new Builder(); BiomeGenerationSettings.Builder builder2 = new BiomeGenerationSettings.Builder(placedFeatures, worldCarvers); - builder2.addCarver(GenerationStep.Carving.AIR, Carvers.CAVE); - builder2.addCarver(GenerationStep.Carving.AIR, Carvers.CAVE_EXTRA_UNDERGROUND); - builder2.addCarver(GenerationStep.Carving.AIR, Carvers.CANYON); + builder2.addCarver(Carvers.CAVE); + builder2.addCarver(Carvers.CAVE_EXTRA_UNDERGROUND); + builder2.addCarver(Carvers.CANYON); BiomeDefaultFeatures.addDefaultCrystalFormations(builder2); BiomeDefaultFeatures.addDefaultMonsterRoom(builder2); BiomeDefaultFeatures.addDefaultUndergroundVariety(builder2); diff --git a/net/minecraft/data/worldgen/features/AquaticFeatures.java b/net/minecraft/data/worldgen/features/AquaticFeatures.java index 0149be43..282c666b 100644 --- a/net/minecraft/data/worldgen/features/AquaticFeatures.java +++ b/net/minecraft/data/worldgen/features/AquaticFeatures.java @@ -4,15 +4,12 @@ import net.minecraft.core.HolderSet; import net.minecraft.data.worldgen.BootstrapContext; import net.minecraft.data.worldgen.placement.PlacementUtils; import net.minecraft.resources.ResourceKey; -import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.levelgen.feature.ConfiguredFeature; import net.minecraft.world.level.levelgen.feature.Feature; import net.minecraft.world.level.levelgen.feature.configurations.CountConfiguration; import net.minecraft.world.level.levelgen.feature.configurations.FeatureConfiguration; import net.minecraft.world.level.levelgen.feature.configurations.ProbabilityFeatureConfiguration; -import net.minecraft.world.level.levelgen.feature.configurations.SimpleBlockConfiguration; import net.minecraft.world.level.levelgen.feature.configurations.SimpleRandomFeatureConfiguration; -import net.minecraft.world.level.levelgen.feature.stateproviders.BlockStateProvider; public class AquaticFeatures { public static final ResourceKey> SEAGRASS_SHORT = FeatureUtils.createKey("seagrass_short"); @@ -20,7 +17,6 @@ public class AquaticFeatures { public static final ResourceKey> SEAGRASS_MID = FeatureUtils.createKey("seagrass_mid"); public static final ResourceKey> SEAGRASS_TALL = FeatureUtils.createKey("seagrass_tall"); public static final ResourceKey> SEA_PICKLE = FeatureUtils.createKey("sea_pickle"); - public static final ResourceKey> SEAGRASS_SIMPLE = FeatureUtils.createKey("seagrass_simple"); public static final ResourceKey> KELP = FeatureUtils.createKey("kelp"); public static final ResourceKey> WARM_OCEAN_VEGETATION = FeatureUtils.createKey("warm_ocean_vegetation"); @@ -30,7 +26,6 @@ public class AquaticFeatures { FeatureUtils.register(context, SEAGRASS_MID, Feature.SEAGRASS, new ProbabilityFeatureConfiguration(0.6F)); FeatureUtils.register(context, SEAGRASS_TALL, Feature.SEAGRASS, new ProbabilityFeatureConfiguration(0.8F)); FeatureUtils.register(context, SEA_PICKLE, Feature.SEA_PICKLE, new CountConfiguration(20)); - FeatureUtils.register(context, SEAGRASS_SIMPLE, Feature.SIMPLE_BLOCK, new SimpleBlockConfiguration(BlockStateProvider.simple(Blocks.SEAGRASS))); FeatureUtils.register(context, KELP, Feature.KELP); FeatureUtils.register( context, diff --git a/net/minecraft/data/worldgen/features/CaveFeatures.java b/net/minecraft/data/worldgen/features/CaveFeatures.java index 7a111b61..f1e89f9c 100644 --- a/net/minecraft/data/worldgen/features/CaveFeatures.java +++ b/net/minecraft/data/worldgen/features/CaveFeatures.java @@ -250,7 +250,7 @@ public class CaveFeatures { BlockPredicate.anyOf( BlockPredicate.matchesBlocks(List.of(Blocks.AIR, Blocks.CAVE_AIR, Blocks.VOID_AIR)), BlockPredicate.matchesTag(BlockTags.REPLACEABLE_BY_TREES) ), - BlockPredicate.matchesTag(Direction.DOWN.getNormal(), BlockTags.AZALEA_GROWS_ON) + BlockPredicate.matchesTag(Direction.DOWN.getUnitVec3i(), BlockTags.AZALEA_GROWS_ON) ) ) ); diff --git a/net/minecraft/data/worldgen/features/FeatureUtils.java b/net/minecraft/data/worldgen/features/FeatureUtils.java index f2722d43..e49e621c 100644 --- a/net/minecraft/data/worldgen/features/FeatureUtils.java +++ b/net/minecraft/data/worldgen/features/FeatureUtils.java @@ -33,7 +33,7 @@ public class FeatureUtils { private static BlockPredicate simplePatchPredicate(List blocks) { BlockPredicate blockPredicate; if (!blocks.isEmpty()) { - blockPredicate = BlockPredicate.allOf(BlockPredicate.ONLY_IN_AIR_PREDICATE, BlockPredicate.matchesBlocks(Direction.DOWN.getNormal(), blocks)); + blockPredicate = BlockPredicate.allOf(BlockPredicate.ONLY_IN_AIR_PREDICATE, BlockPredicate.matchesBlocks(Direction.DOWN.getUnitVec3i(), blocks)); } else { blockPredicate = BlockPredicate.ONLY_IN_AIR_PREDICATE; } diff --git a/net/minecraft/data/worldgen/features/MiscOverworldFeatures.java b/net/minecraft/data/worldgen/features/MiscOverworldFeatures.java index 05a03a96..2431e664 100644 --- a/net/minecraft/data/worldgen/features/MiscOverworldFeatures.java +++ b/net/minecraft/data/worldgen/features/MiscOverworldFeatures.java @@ -17,6 +17,7 @@ import net.minecraft.world.level.levelgen.feature.configurations.DiskConfigurati import net.minecraft.world.level.levelgen.feature.configurations.SpringConfiguration; import net.minecraft.world.level.levelgen.feature.stateproviders.BlockStateProvider; import net.minecraft.world.level.levelgen.feature.stateproviders.RuleBasedBlockStateProvider; +import net.minecraft.world.level.levelgen.feature.stateproviders.RuleBasedBlockStateProvider.Rule; import net.minecraft.world.level.material.Fluids; public class MiscOverworldFeatures { @@ -85,9 +86,7 @@ public class MiscOverworldFeatures { new DiskConfiguration( new RuleBasedBlockStateProvider( BlockStateProvider.simple(Blocks.SAND), - List.of( - new RuleBasedBlockStateProvider.Rule(BlockPredicate.matchesBlocks(Direction.DOWN.getNormal(), Blocks.AIR), BlockStateProvider.simple(Blocks.SANDSTONE)) - ) + List.of(new Rule(BlockPredicate.matchesBlocks(Direction.DOWN.getUnitVec3i(), Blocks.AIR), BlockStateProvider.simple(Blocks.SANDSTONE))) ), BlockPredicate.matchesBlocks(List.of(Blocks.DIRT, Blocks.GRASS_BLOCK)), UniformInt.of(2, 6), @@ -103,9 +102,9 @@ public class MiscOverworldFeatures { new RuleBasedBlockStateProvider( BlockStateProvider.simple(Blocks.DIRT), List.of( - new RuleBasedBlockStateProvider.Rule( + new Rule( BlockPredicate.not( - BlockPredicate.anyOf(BlockPredicate.solid(Direction.UP.getNormal()), BlockPredicate.matchesFluids(Direction.UP.getNormal(), Fluids.WATER)) + BlockPredicate.anyOf(BlockPredicate.solid(Direction.UP.getUnitVec3i()), BlockPredicate.matchesFluids(Direction.UP.getUnitVec3i(), Fluids.WATER)) ), BlockStateProvider.simple(Blocks.GRASS_BLOCK) ) diff --git a/net/minecraft/data/worldgen/features/TreeFeatures.java b/net/minecraft/data/worldgen/features/TreeFeatures.java index 41e21b28..1defb3e3 100644 --- a/net/minecraft/data/worldgen/features/TreeFeatures.java +++ b/net/minecraft/data/worldgen/features/TreeFeatures.java @@ -26,7 +26,7 @@ import net.minecraft.world.level.levelgen.feature.ConfiguredFeature; import net.minecraft.world.level.levelgen.feature.Feature; import net.minecraft.world.level.levelgen.feature.HugeFungusConfiguration; import net.minecraft.world.level.levelgen.feature.configurations.HugeMushroomFeatureConfiguration; -import net.minecraft.world.level.levelgen.feature.configurations.TreeConfiguration; +import net.minecraft.world.level.levelgen.feature.configurations.TreeConfiguration.TreeConfigurationBuilder; import net.minecraft.world.level.levelgen.feature.featuresize.ThreeLayersFeatureSize; import net.minecraft.world.level.levelgen.feature.featuresize.TwoLayersFeatureSize; import net.minecraft.world.level.levelgen.feature.foliageplacers.AcaciaFoliagePlacer; @@ -50,7 +50,9 @@ import net.minecraft.world.level.levelgen.feature.treedecorators.AlterGroundDeco import net.minecraft.world.level.levelgen.feature.treedecorators.AttachedToLeavesDecorator; import net.minecraft.world.level.levelgen.feature.treedecorators.BeehiveDecorator; import net.minecraft.world.level.levelgen.feature.treedecorators.CocoaDecorator; +import net.minecraft.world.level.levelgen.feature.treedecorators.CreakingHeartDecorator; import net.minecraft.world.level.levelgen.feature.treedecorators.LeaveVineDecorator; +import net.minecraft.world.level.levelgen.feature.treedecorators.PaleMossDecorator; import net.minecraft.world.level.levelgen.feature.treedecorators.TrunkVineDecorator; import net.minecraft.world.level.levelgen.feature.trunkplacers.BendingTrunkPlacer; import net.minecraft.world.level.levelgen.feature.trunkplacers.CherryTrunkPlacer; @@ -71,6 +73,8 @@ public class TreeFeatures { public static final ResourceKey> HUGE_RED_MUSHROOM = FeatureUtils.createKey("huge_red_mushroom"); public static final ResourceKey> OAK = FeatureUtils.createKey("oak"); public static final ResourceKey> DARK_OAK = FeatureUtils.createKey("dark_oak"); + public static final ResourceKey> PALE_OAK = FeatureUtils.createKey("pale_oak"); + public static final ResourceKey> PALE_OAK_CREAKING = FeatureUtils.createKey("pale_oak_creaking"); public static final ResourceKey> BIRCH = FeatureUtils.createKey("birch"); public static final ResourceKey> ACACIA = FeatureUtils.createKey("acacia"); public static final ResourceKey> SPRUCE = FeatureUtils.createKey("spruce"); @@ -101,10 +105,8 @@ public class TreeFeatures { public static final ResourceKey> FANCY_OAK_BEES = FeatureUtils.createKey("fancy_oak_bees"); public static final ResourceKey> CHERRY_BEES_005 = FeatureUtils.createKey("cherry_bees_005"); - private static TreeConfiguration.TreeConfigurationBuilder createStraightBlobTree( - Block logBlock, Block leavesBlock, int baseHeight, int heightRandA, int heightRandB, int radius - ) { - return new TreeConfiguration.TreeConfigurationBuilder( + private static TreeConfigurationBuilder createStraightBlobTree(Block logBlock, Block leavesBlock, int baseHeight, int heightRandA, int heightRandB, int radius) { + return new TreeConfigurationBuilder( BlockStateProvider.simple(logBlock), new StraightTrunkPlacer(baseHeight, heightRandA, heightRandB), BlockStateProvider.simple(leavesBlock), @@ -113,24 +115,24 @@ public class TreeFeatures { ); } - private static TreeConfiguration.TreeConfigurationBuilder createOak() { + private static TreeConfigurationBuilder createOak() { return createStraightBlobTree(Blocks.OAK_LOG, Blocks.OAK_LEAVES, 4, 2, 0, 2).ignoreVines(); } - private static TreeConfiguration.TreeConfigurationBuilder createBirch() { + private static TreeConfigurationBuilder createBirch() { return createStraightBlobTree(Blocks.BIRCH_LOG, Blocks.BIRCH_LEAVES, 5, 2, 0, 2).ignoreVines(); } - private static TreeConfiguration.TreeConfigurationBuilder createSuperBirch() { + private static TreeConfigurationBuilder createSuperBirch() { return createStraightBlobTree(Blocks.BIRCH_LOG, Blocks.BIRCH_LEAVES, 5, 2, 6, 2).ignoreVines(); } - private static TreeConfiguration.TreeConfigurationBuilder createJungleTree() { + private static TreeConfigurationBuilder createJungleTree() { return createStraightBlobTree(Blocks.JUNGLE_LOG, Blocks.JUNGLE_LEAVES, 4, 8, 0, 2); } - private static TreeConfiguration.TreeConfigurationBuilder createFancyOak() { - return new TreeConfiguration.TreeConfigurationBuilder( + private static TreeConfigurationBuilder createFancyOak() { + return new TreeConfigurationBuilder( BlockStateProvider.simple(Blocks.OAK_LOG), new FancyTrunkPlacer(3, 11, 0), BlockStateProvider.simple(Blocks.OAK_LEAVES), @@ -140,8 +142,8 @@ public class TreeFeatures { .ignoreVines(); } - private static TreeConfiguration.TreeConfigurationBuilder cherry() { - return new TreeConfiguration.TreeConfigurationBuilder( + private static TreeConfigurationBuilder cherry() { + return new TreeConfigurationBuilder( BlockStateProvider.simple(Blocks.CHERRY_LOG), new CherryTrunkPlacer( 7, @@ -169,6 +171,7 @@ public class TreeFeatures { Blocks.ACACIA_SAPLING, Blocks.CHERRY_SAPLING, Blocks.DARK_OAK_SAPLING, + Blocks.PALE_OAK_SAPLING, Blocks.MANGROVE_PROPAGULE, Blocks.DANDELION, Blocks.TORCHFLOWER, @@ -302,7 +305,7 @@ public class TreeFeatures { context, DARK_OAK, Feature.TREE, - new TreeConfiguration.TreeConfigurationBuilder( + new TreeConfigurationBuilder( BlockStateProvider.simple(Blocks.DARK_OAK_LOG), new DarkOakTrunkPlacer(6, 2, 1), BlockStateProvider.simple(Blocks.DARK_OAK_LEAVES), @@ -312,12 +315,42 @@ public class TreeFeatures { .ignoreVines() .build() ); + FeatureUtils.register( + context, + PALE_OAK, + Feature.TREE, + new TreeConfigurationBuilder( + BlockStateProvider.simple(Blocks.PALE_OAK_LOG), + new DarkOakTrunkPlacer(6, 2, 1), + BlockStateProvider.simple(Blocks.PALE_OAK_LEAVES), + new DarkOakFoliagePlacer(ConstantInt.of(0), ConstantInt.of(0)), + new ThreeLayersFeatureSize(1, 1, 0, 1, 2, OptionalInt.empty()) + ) + .decorators(ImmutableList.of(new PaleMossDecorator(0.15F, 0.4F, 0.8F))) + .ignoreVines() + .build() + ); + FeatureUtils.register( + context, + PALE_OAK_CREAKING, + Feature.TREE, + new TreeConfigurationBuilder( + BlockStateProvider.simple(Blocks.PALE_OAK_LOG), + new DarkOakTrunkPlacer(6, 2, 1), + BlockStateProvider.simple(Blocks.PALE_OAK_LEAVES), + new DarkOakFoliagePlacer(ConstantInt.of(0), ConstantInt.of(0)), + new ThreeLayersFeatureSize(1, 1, 0, 1, 2, OptionalInt.empty()) + ) + .decorators(ImmutableList.of(new PaleMossDecorator(0.15F, 0.4F, 0.8F), new CreakingHeartDecorator(1.0F))) + .ignoreVines() + .build() + ); FeatureUtils.register(context, BIRCH, Feature.TREE, createBirch().build()); FeatureUtils.register( context, ACACIA, Feature.TREE, - new TreeConfiguration.TreeConfigurationBuilder( + new TreeConfigurationBuilder( BlockStateProvider.simple(Blocks.ACACIA_LOG), new ForkingTrunkPlacer(5, 2, 2), BlockStateProvider.simple(Blocks.ACACIA_LEAVES), @@ -333,7 +366,7 @@ public class TreeFeatures { context, SPRUCE, Feature.TREE, - new TreeConfiguration.TreeConfigurationBuilder( + new TreeConfigurationBuilder( BlockStateProvider.simple(Blocks.SPRUCE_LOG), new StraightTrunkPlacer(5, 2, 1), BlockStateProvider.simple(Blocks.SPRUCE_LEAVES), @@ -347,7 +380,7 @@ public class TreeFeatures { context, PINE, Feature.TREE, - new TreeConfiguration.TreeConfigurationBuilder( + new TreeConfigurationBuilder( BlockStateProvider.simple(Blocks.SPRUCE_LOG), new StraightTrunkPlacer(6, 4, 0), BlockStateProvider.simple(Blocks.SPRUCE_LEAVES), @@ -369,7 +402,7 @@ public class TreeFeatures { context, MEGA_JUNGLE_TREE, Feature.TREE, - new TreeConfiguration.TreeConfigurationBuilder( + new TreeConfigurationBuilder( BlockStateProvider.simple(Blocks.JUNGLE_LOG), new MegaJungleTrunkPlacer(10, 2, 19), BlockStateProvider.simple(Blocks.JUNGLE_LEAVES), @@ -383,7 +416,7 @@ public class TreeFeatures { context, MEGA_SPRUCE, Feature.TREE, - new TreeConfiguration.TreeConfigurationBuilder( + new TreeConfigurationBuilder( BlockStateProvider.simple(Blocks.SPRUCE_LOG), new GiantTrunkPlacer(13, 2, 14), BlockStateProvider.simple(Blocks.SPRUCE_LEAVES), @@ -397,7 +430,7 @@ public class TreeFeatures { context, MEGA_PINE, Feature.TREE, - new TreeConfiguration.TreeConfigurationBuilder( + new TreeConfigurationBuilder( BlockStateProvider.simple(Blocks.SPRUCE_LOG), new GiantTrunkPlacer(13, 2, 14), BlockStateProvider.simple(Blocks.SPRUCE_LEAVES), @@ -419,7 +452,7 @@ public class TreeFeatures { context, JUNGLE_BUSH, Feature.TREE, - new TreeConfiguration.TreeConfigurationBuilder( + new TreeConfigurationBuilder( BlockStateProvider.simple(Blocks.JUNGLE_LOG), new StraightTrunkPlacer(1, 0, 0), BlockStateProvider.simple(Blocks.OAK_LEAVES), @@ -432,7 +465,7 @@ public class TreeFeatures { context, AZALEA_TREE, Feature.TREE, - new TreeConfiguration.TreeConfigurationBuilder( + new TreeConfigurationBuilder( BlockStateProvider.simple(Blocks.OAK_LOG), new BendingTrunkPlacer(4, 2, 0, 3, UniformInt.of(1, 2)), new WeightedStateProvider( @@ -451,7 +484,7 @@ public class TreeFeatures { context, MANGROVE, Feature.TREE, - new TreeConfiguration.TreeConfigurationBuilder( + new TreeConfigurationBuilder( BlockStateProvider.simple(Blocks.MANGROVE_LOG), new UpwardsBranchingTrunkPlacer(2, 1, 4, UniformInt.of(1, 4), 0.5F, UniformInt.of(0, 1), holderGetter.getOrThrow(BlockTags.MANGROVE_LOGS_CAN_GROW_THROUGH)), BlockStateProvider.simple(Blocks.MANGROVE_LEAVES), @@ -498,7 +531,7 @@ public class TreeFeatures { context, TALL_MANGROVE, Feature.TREE, - new TreeConfiguration.TreeConfigurationBuilder( + new TreeConfigurationBuilder( BlockStateProvider.simple(Blocks.MANGROVE_LOG), new UpwardsBranchingTrunkPlacer(4, 1, 9, UniformInt.of(1, 6), 0.5F, UniformInt.of(0, 1), holderGetter.getOrThrow(BlockTags.MANGROVE_LOGS_CAN_GROW_THROUGH)), BlockStateProvider.simple(Blocks.MANGROVE_LEAVES), diff --git a/net/minecraft/data/worldgen/features/VegetationFeatures.java b/net/minecraft/data/worldgen/features/VegetationFeatures.java index 4fe21922..67257880 100644 --- a/net/minecraft/data/worldgen/features/VegetationFeatures.java +++ b/net/minecraft/data/worldgen/features/VegetationFeatures.java @@ -11,9 +11,13 @@ import net.minecraft.data.worldgen.BootstrapContext; import net.minecraft.data.worldgen.placement.PlacementUtils; import net.minecraft.data.worldgen.placement.TreePlacements; import net.minecraft.resources.ResourceKey; +import net.minecraft.tags.BlockTags; import net.minecraft.util.InclusiveRange; import net.minecraft.util.random.SimpleWeightedRandomList; +import net.minecraft.util.random.SimpleWeightedRandomList.Builder; import net.minecraft.util.valueproviders.BiasedToBottomInt; +import net.minecraft.util.valueproviders.ConstantInt; +import net.minecraft.util.valueproviders.UniformInt; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.PinkPetalsBlock; import net.minecraft.world.level.block.SweetBerryBushBlock; @@ -29,14 +33,16 @@ import net.minecraft.world.level.levelgen.feature.configurations.RandomFeatureCo import net.minecraft.world.level.levelgen.feature.configurations.RandomPatchConfiguration; import net.minecraft.world.level.levelgen.feature.configurations.SimpleBlockConfiguration; import net.minecraft.world.level.levelgen.feature.configurations.SimpleRandomFeatureConfiguration; +import net.minecraft.world.level.levelgen.feature.configurations.VegetationPatchConfiguration; import net.minecraft.world.level.levelgen.feature.stateproviders.BlockStateProvider; import net.minecraft.world.level.levelgen.feature.stateproviders.DualNoiseProvider; import net.minecraft.world.level.levelgen.feature.stateproviders.NoiseProvider; import net.minecraft.world.level.levelgen.feature.stateproviders.NoiseThresholdProvider; import net.minecraft.world.level.levelgen.feature.stateproviders.WeightedStateProvider; import net.minecraft.world.level.levelgen.placement.BlockPredicateFilter; +import net.minecraft.world.level.levelgen.placement.CaveSurface; import net.minecraft.world.level.levelgen.placement.PlacedFeature; -import net.minecraft.world.level.levelgen.synth.NormalNoise; +import net.minecraft.world.level.levelgen.synth.NormalNoise.NoiseParameters; import net.minecraft.world.level.material.Fluids; public class VegetationFeatures { @@ -67,6 +73,9 @@ public class VegetationFeatures { public static final ResourceKey> FLOWER_CHERRY = FeatureUtils.createKey("flower_cherry"); public static final ResourceKey> FOREST_FLOWERS = FeatureUtils.createKey("forest_flowers"); public static final ResourceKey> DARK_FOREST_VEGETATION = FeatureUtils.createKey("dark_forest_vegetation"); + public static final ResourceKey> PALE_GARDEN_VEGETATION = FeatureUtils.createKey("pale_garden_vegetation"); + public static final ResourceKey> PALE_MOSS_VEGETATION = FeatureUtils.createKey("pale_moss_vegetation"); + public static final ResourceKey> PALE_MOSS_PATCH_BONEMEAL = FeatureUtils.createKey("pale_moss_patch_bonemeal"); public static final ResourceKey> TREES_FLOWER_FOREST = FeatureUtils.createKey("trees_flower_forest"); public static final ResourceKey> MEADOW_TREES = FeatureUtils.createKey("meadow_trees"); public static final ResourceKey> TREES_TAIGA = FeatureUtils.createKey("trees_taiga"); @@ -98,30 +107,32 @@ public class VegetationFeatures { Holder> holder5 = holderGetter.getOrThrow(PATCH_GRASS_JUNGLE); HolderGetter holderGetter2 = context.lookup(Registries.PLACED_FEATURE); Holder holder6 = holderGetter2.getOrThrow(TreePlacements.DARK_OAK_CHECKED); - Holder holder7 = holderGetter2.getOrThrow(TreePlacements.BIRCH_CHECKED); - Holder holder8 = holderGetter2.getOrThrow(TreePlacements.FANCY_OAK_CHECKED); - Holder holder9 = holderGetter2.getOrThrow(TreePlacements.BIRCH_BEES_002); - Holder holder10 = holderGetter2.getOrThrow(TreePlacements.FANCY_OAK_BEES_002); - Holder holder11 = holderGetter2.getOrThrow(TreePlacements.FANCY_OAK_BEES); - Holder holder12 = holderGetter2.getOrThrow(TreePlacements.PINE_CHECKED); - Holder holder13 = holderGetter2.getOrThrow(TreePlacements.SPRUCE_CHECKED); - Holder holder14 = holderGetter2.getOrThrow(TreePlacements.PINE_ON_SNOW); - Holder holder15 = holderGetter2.getOrThrow(TreePlacements.ACACIA_CHECKED); - Holder holder16 = holderGetter2.getOrThrow(TreePlacements.SUPER_BIRCH_BEES_0002); - Holder holder17 = holderGetter2.getOrThrow(TreePlacements.BIRCH_BEES_0002_PLACED); - Holder holder18 = holderGetter2.getOrThrow(TreePlacements.FANCY_OAK_BEES_0002); - Holder holder19 = holderGetter2.getOrThrow(TreePlacements.JUNGLE_BUSH); - Holder holder20 = holderGetter2.getOrThrow(TreePlacements.MEGA_SPRUCE_CHECKED); - Holder holder21 = holderGetter2.getOrThrow(TreePlacements.MEGA_PINE_CHECKED); - Holder holder22 = holderGetter2.getOrThrow(TreePlacements.MEGA_JUNGLE_TREE_CHECKED); - Holder holder23 = holderGetter2.getOrThrow(TreePlacements.TALL_MANGROVE_CHECKED); - Holder holder24 = holderGetter2.getOrThrow(TreePlacements.OAK_CHECKED); - Holder holder25 = holderGetter2.getOrThrow(TreePlacements.OAK_BEES_002); - Holder holder26 = holderGetter2.getOrThrow(TreePlacements.SUPER_BIRCH_BEES); - Holder holder27 = holderGetter2.getOrThrow(TreePlacements.SPRUCE_ON_SNOW); - Holder holder28 = holderGetter2.getOrThrow(TreePlacements.OAK_BEES_0002); - Holder holder29 = holderGetter2.getOrThrow(TreePlacements.JUNGLE_TREE_CHECKED); - Holder holder30 = holderGetter2.getOrThrow(TreePlacements.MANGROVE_CHECKED); + Holder holder7 = holderGetter2.getOrThrow(TreePlacements.PALE_OAK_CHECKED); + Holder holder8 = holderGetter2.getOrThrow(TreePlacements.PALE_OAK_CREAKING_CHECKED); + Holder holder9 = holderGetter2.getOrThrow(TreePlacements.BIRCH_CHECKED); + Holder holder10 = holderGetter2.getOrThrow(TreePlacements.FANCY_OAK_CHECKED); + Holder holder11 = holderGetter2.getOrThrow(TreePlacements.BIRCH_BEES_002); + Holder holder12 = holderGetter2.getOrThrow(TreePlacements.FANCY_OAK_BEES_002); + Holder holder13 = holderGetter2.getOrThrow(TreePlacements.FANCY_OAK_BEES); + Holder holder14 = holderGetter2.getOrThrow(TreePlacements.PINE_CHECKED); + Holder holder15 = holderGetter2.getOrThrow(TreePlacements.SPRUCE_CHECKED); + Holder holder16 = holderGetter2.getOrThrow(TreePlacements.PINE_ON_SNOW); + Holder holder17 = holderGetter2.getOrThrow(TreePlacements.ACACIA_CHECKED); + Holder holder18 = holderGetter2.getOrThrow(TreePlacements.SUPER_BIRCH_BEES_0002); + Holder holder19 = holderGetter2.getOrThrow(TreePlacements.BIRCH_BEES_0002_PLACED); + Holder holder20 = holderGetter2.getOrThrow(TreePlacements.FANCY_OAK_BEES_0002); + Holder holder21 = holderGetter2.getOrThrow(TreePlacements.JUNGLE_BUSH); + Holder holder22 = holderGetter2.getOrThrow(TreePlacements.MEGA_SPRUCE_CHECKED); + Holder holder23 = holderGetter2.getOrThrow(TreePlacements.MEGA_PINE_CHECKED); + Holder holder24 = holderGetter2.getOrThrow(TreePlacements.MEGA_JUNGLE_TREE_CHECKED); + Holder holder25 = holderGetter2.getOrThrow(TreePlacements.TALL_MANGROVE_CHECKED); + Holder holder26 = holderGetter2.getOrThrow(TreePlacements.OAK_CHECKED); + Holder holder27 = holderGetter2.getOrThrow(TreePlacements.OAK_BEES_002); + Holder holder28 = holderGetter2.getOrThrow(TreePlacements.SUPER_BIRCH_BEES); + Holder holder29 = holderGetter2.getOrThrow(TreePlacements.SPRUCE_ON_SNOW); + Holder holder30 = holderGetter2.getOrThrow(TreePlacements.OAK_BEES_0002); + Holder holder31 = holderGetter2.getOrThrow(TreePlacements.JUNGLE_TREE_CHECKED); + Holder holder32 = holderGetter2.getOrThrow(TreePlacements.MANGROVE_CHECKED); FeatureUtils.register(context, BAMBOO_NO_PODZOL, Feature.BAMBOO, new ProbabilityFeatureConfiguration(0.0F)); FeatureUtils.register(context, BAMBOO_SOME_PODZOL, Feature.BAMBOO, new ProbabilityFeatureConfiguration(0.2F)); FeatureUtils.register(context, VINES, Feature.VINES); @@ -188,7 +199,7 @@ public class VegetationFeatures { SimpleWeightedRandomList.builder().add(Blocks.SHORT_GRASS.defaultBlockState(), 3).add(Blocks.FERN.defaultBlockState(), 1) ) ), - BlockPredicate.allOf(BlockPredicate.ONLY_IN_AIR_PREDICATE, BlockPredicate.not(BlockPredicate.matchesBlocks(Direction.DOWN.getNormal(), Blocks.PODZOL))) + BlockPredicate.allOf(BlockPredicate.ONLY_IN_AIR_PREDICATE, BlockPredicate.not(BlockPredicate.matchesBlocks(Direction.DOWN.getUnitVec3i(), Blocks.PODZOL))) ) ) ); @@ -207,7 +218,9 @@ public class VegetationFeatures { PlacementUtils.filtered( Feature.SIMPLE_BLOCK, new SimpleBlockConfiguration(BlockStateProvider.simple(Blocks.MELON)), - BlockPredicate.allOf(BlockPredicate.replaceable(), BlockPredicate.noFluid(), BlockPredicate.matchesBlocks(Direction.DOWN.getNormal(), Blocks.GRASS_BLOCK)) + BlockPredicate.allOf( + BlockPredicate.replaceable(), BlockPredicate.noFluid(), BlockPredicate.matchesBlocks(Direction.DOWN.getUnitVec3i(), Blocks.GRASS_BLOCK) + ) ) ) ); @@ -296,7 +309,7 @@ public class VegetationFeatures { new SimpleBlockConfiguration( new NoiseProvider( 2345L, - new NormalNoise.NoiseParameters(0, 1.0), + new NoiseParameters(0, 1.0), 0.020833334F, List.of( Blocks.DANDELION.defaultBlockState(), @@ -337,7 +350,7 @@ public class VegetationFeatures { new SimpleBlockConfiguration( new NoiseThresholdProvider( 2345L, - new NormalNoise.NoiseParameters(0, 1.0), + new NoiseParameters(0, 1.0), 0.005F, -0.8F, 0.33333334F, @@ -369,10 +382,10 @@ public class VegetationFeatures { new SimpleBlockConfiguration( new DualNoiseProvider( new InclusiveRange(1, 3), - new NormalNoise.NoiseParameters(-10, 1.0), + new NoiseParameters(-10, 1.0), 1.0F, 2345L, - new NormalNoise.NoiseParameters(-3, 1.0), + new NoiseParameters(-3, 1.0), 1.0F, List.of( Blocks.TALL_GRASS.defaultBlockState(), @@ -389,7 +402,7 @@ public class VegetationFeatures { ) ) ); - SimpleWeightedRandomList.Builder builder = SimpleWeightedRandomList.builder(); + Builder builder = SimpleWeightedRandomList.builder(); for (int i = 1; i <= 4; i++) { for (Direction direction : Direction.Plane.HORIZONTAL) { @@ -435,47 +448,83 @@ public class VegetationFeatures { new WeightedPlacedFeature(PlacementUtils.inlinePlaced(holder), 0.025F), new WeightedPlacedFeature(PlacementUtils.inlinePlaced(holder2), 0.05F), new WeightedPlacedFeature(holder6, 0.6666667F), - new WeightedPlacedFeature(holder7, 0.2F), - new WeightedPlacedFeature(holder8, 0.1F) + new WeightedPlacedFeature(holder9, 0.2F), + new WeightedPlacedFeature(holder10, 0.1F) ), - holder24 + holder26 + ) + ); + FeatureUtils.register( + context, + PALE_GARDEN_VEGETATION, + Feature.RANDOM_SELECTOR, + new RandomFeatureConfiguration(List.of(new WeightedPlacedFeature(holder8, 0.2F), new WeightedPlacedFeature(holder7, 0.8F)), holder7) + ); + FeatureUtils.register( + context, + PALE_MOSS_VEGETATION, + Feature.SIMPLE_BLOCK, + new SimpleBlockConfiguration( + new WeightedStateProvider( + SimpleWeightedRandomList.builder() + .add(Blocks.PALE_MOSS_CARPET.defaultBlockState(), 25) + .add(Blocks.SHORT_GRASS.defaultBlockState(), 50) + .add(Blocks.TALL_GRASS.defaultBlockState(), 10) + ) + ) + ); + FeatureUtils.register( + context, + PALE_MOSS_PATCH_BONEMEAL, + Feature.VEGETATION_PATCH, + new VegetationPatchConfiguration( + BlockTags.MOSS_REPLACEABLE, + BlockStateProvider.simple(Blocks.PALE_MOSS_BLOCK), + PlacementUtils.inlinePlaced(holderGetter.getOrThrow(PALE_MOSS_VEGETATION)), + CaveSurface.FLOOR, + ConstantInt.of(1), + 0.0F, + 5, + 0.6F, + UniformInt.of(1, 2), + 0.75F ) ); FeatureUtils.register( context, TREES_FLOWER_FOREST, Feature.RANDOM_SELECTOR, - new RandomFeatureConfiguration(List.of(new WeightedPlacedFeature(holder9, 0.2F), new WeightedPlacedFeature(holder10, 0.1F)), holder25) + new RandomFeatureConfiguration(List.of(new WeightedPlacedFeature(holder11, 0.2F), new WeightedPlacedFeature(holder12, 0.1F)), holder27) ); FeatureUtils.register( - context, MEADOW_TREES, Feature.RANDOM_SELECTOR, new RandomFeatureConfiguration(List.of(new WeightedPlacedFeature(holder11, 0.5F)), holder26) + context, MEADOW_TREES, Feature.RANDOM_SELECTOR, new RandomFeatureConfiguration(List.of(new WeightedPlacedFeature(holder13, 0.5F)), holder28) ); FeatureUtils.register( - context, TREES_TAIGA, Feature.RANDOM_SELECTOR, new RandomFeatureConfiguration(List.of(new WeightedPlacedFeature(holder12, 0.33333334F)), holder13) + context, TREES_TAIGA, Feature.RANDOM_SELECTOR, new RandomFeatureConfiguration(List.of(new WeightedPlacedFeature(holder14, 0.33333334F)), holder15) ); FeatureUtils.register( - context, TREES_GROVE, Feature.RANDOM_SELECTOR, new RandomFeatureConfiguration(List.of(new WeightedPlacedFeature(holder14, 0.33333334F)), holder27) + context, TREES_GROVE, Feature.RANDOM_SELECTOR, new RandomFeatureConfiguration(List.of(new WeightedPlacedFeature(holder16, 0.33333334F)), holder29) ); FeatureUtils.register( - context, TREES_SAVANNA, Feature.RANDOM_SELECTOR, new RandomFeatureConfiguration(List.of(new WeightedPlacedFeature(holder15, 0.8F)), holder24) + context, TREES_SAVANNA, Feature.RANDOM_SELECTOR, new RandomFeatureConfiguration(List.of(new WeightedPlacedFeature(holder17, 0.8F)), holder26) ); FeatureUtils.register( - context, BIRCH_TALL, Feature.RANDOM_SELECTOR, new RandomFeatureConfiguration(List.of(new WeightedPlacedFeature(holder16, 0.5F)), holder17) + context, BIRCH_TALL, Feature.RANDOM_SELECTOR, new RandomFeatureConfiguration(List.of(new WeightedPlacedFeature(holder18, 0.5F)), holder19) ); FeatureUtils.register( context, TREES_WINDSWEPT_HILLS, Feature.RANDOM_SELECTOR, - new RandomFeatureConfiguration(List.of(new WeightedPlacedFeature(holder13, 0.666F), new WeightedPlacedFeature(holder8, 0.1F)), holder24) + new RandomFeatureConfiguration(List.of(new WeightedPlacedFeature(holder15, 0.666F), new WeightedPlacedFeature(holder10, 0.1F)), holder26) ); FeatureUtils.register( - context, TREES_WATER, Feature.RANDOM_SELECTOR, new RandomFeatureConfiguration(List.of(new WeightedPlacedFeature(holder8, 0.1F)), holder24) + context, TREES_WATER, Feature.RANDOM_SELECTOR, new RandomFeatureConfiguration(List.of(new WeightedPlacedFeature(holder10, 0.1F)), holder26) ); FeatureUtils.register( context, TREES_BIRCH_AND_OAK, Feature.RANDOM_SELECTOR, - new RandomFeatureConfiguration(List.of(new WeightedPlacedFeature(holder17, 0.2F), new WeightedPlacedFeature(holder18, 0.1F)), holder28) + new RandomFeatureConfiguration(List.of(new WeightedPlacedFeature(holder19, 0.2F), new WeightedPlacedFeature(holder20, 0.1F)), holder30) ); FeatureUtils.register( context, @@ -487,13 +536,13 @@ public class VegetationFeatures { context, TREES_SPARSE_JUNGLE, Feature.RANDOM_SELECTOR, - new RandomFeatureConfiguration(List.of(new WeightedPlacedFeature(holder8, 0.1F), new WeightedPlacedFeature(holder19, 0.5F)), holder29) + new RandomFeatureConfiguration(List.of(new WeightedPlacedFeature(holder10, 0.1F), new WeightedPlacedFeature(holder21, 0.5F)), holder31) ); FeatureUtils.register( context, TREES_OLD_GROWTH_SPRUCE_TAIGA, Feature.RANDOM_SELECTOR, - new RandomFeatureConfiguration(List.of(new WeightedPlacedFeature(holder20, 0.33333334F), new WeightedPlacedFeature(holder12, 0.33333334F)), holder13) + new RandomFeatureConfiguration(List.of(new WeightedPlacedFeature(holder22, 0.33333334F), new WeightedPlacedFeature(holder14, 0.33333334F)), holder15) ); FeatureUtils.register( context, @@ -501,9 +550,9 @@ public class VegetationFeatures { Feature.RANDOM_SELECTOR, new RandomFeatureConfiguration( List.of( - new WeightedPlacedFeature(holder20, 0.025641026F), new WeightedPlacedFeature(holder21, 0.30769232F), new WeightedPlacedFeature(holder12, 0.33333334F) + new WeightedPlacedFeature(holder22, 0.025641026F), new WeightedPlacedFeature(holder23, 0.30769232F), new WeightedPlacedFeature(holder14, 0.33333334F) ), - holder13 + holder15 ) ); FeatureUtils.register( @@ -511,7 +560,7 @@ public class VegetationFeatures { TREES_JUNGLE, Feature.RANDOM_SELECTOR, new RandomFeatureConfiguration( - List.of(new WeightedPlacedFeature(holder8, 0.1F), new WeightedPlacedFeature(holder19, 0.5F), new WeightedPlacedFeature(holder22, 0.33333334F)), holder29 + List.of(new WeightedPlacedFeature(holder10, 0.1F), new WeightedPlacedFeature(holder21, 0.5F), new WeightedPlacedFeature(holder24, 0.33333334F)), holder31 ) ); FeatureUtils.register( @@ -519,7 +568,7 @@ public class VegetationFeatures { BAMBOO_VEGETATION, Feature.RANDOM_SELECTOR, new RandomFeatureConfiguration( - List.of(new WeightedPlacedFeature(holder8, 0.05F), new WeightedPlacedFeature(holder19, 0.15F), new WeightedPlacedFeature(holder22, 0.7F)), + List.of(new WeightedPlacedFeature(holder10, 0.05F), new WeightedPlacedFeature(holder21, 0.15F), new WeightedPlacedFeature(holder24, 0.7F)), PlacementUtils.inlinePlaced(holder5) ) ); @@ -530,7 +579,7 @@ public class VegetationFeatures { new RandomBooleanFeatureConfiguration(PlacementUtils.inlinePlaced(holder2), PlacementUtils.inlinePlaced(holder)) ); FeatureUtils.register( - context, MANGROVE_VEGETATION, Feature.RANDOM_SELECTOR, new RandomFeatureConfiguration(List.of(new WeightedPlacedFeature(holder23, 0.85F)), holder30) + context, MANGROVE_VEGETATION, Feature.RANDOM_SELECTOR, new RandomFeatureConfiguration(List.of(new WeightedPlacedFeature(holder25, 0.85F)), holder32) ); } } diff --git a/net/minecraft/data/worldgen/placement/AquaticPlacements.java b/net/minecraft/data/worldgen/placement/AquaticPlacements.java index f886ffab..ea401b1f 100644 --- a/net/minecraft/data/worldgen/placement/AquaticPlacements.java +++ b/net/minecraft/data/worldgen/placement/AquaticPlacements.java @@ -1,21 +1,14 @@ package net.minecraft.data.worldgen.placement; import java.util.List; -import net.minecraft.core.BlockPos; -import net.minecraft.core.Direction; import net.minecraft.core.Holder; import net.minecraft.core.HolderGetter; import net.minecraft.core.registries.Registries; import net.minecraft.data.worldgen.BootstrapContext; import net.minecraft.data.worldgen.features.AquaticFeatures; import net.minecraft.resources.ResourceKey; -import net.minecraft.world.level.block.Blocks; -import net.minecraft.world.level.levelgen.GenerationStep; -import net.minecraft.world.level.levelgen.blockpredicates.BlockPredicate; import net.minecraft.world.level.levelgen.feature.ConfiguredFeature; import net.minecraft.world.level.levelgen.placement.BiomeFilter; -import net.minecraft.world.level.levelgen.placement.BlockPredicateFilter; -import net.minecraft.world.level.levelgen.placement.CarvingMaskPlacement; import net.minecraft.world.level.levelgen.placement.CountPlacement; import net.minecraft.world.level.levelgen.placement.InSquarePlacement; import net.minecraft.world.level.levelgen.placement.NoiseBasedCountPlacement; @@ -32,7 +25,6 @@ public class AquaticPlacements { public static final ResourceKey SEAGRASS_DEEP_WARM = PlacementUtils.createKey("seagrass_deep_warm"); public static final ResourceKey SEAGRASS_DEEP = PlacementUtils.createKey("seagrass_deep"); public static final ResourceKey SEAGRASS_DEEP_COLD = PlacementUtils.createKey("seagrass_deep_cold"); - public static final ResourceKey SEAGRASS_SIMPLE = PlacementUtils.createKey("seagrass_simple"); public static final ResourceKey SEA_PICKLE = PlacementUtils.createKey("sea_pickle"); public static final ResourceKey KELP_COLD = PlacementUtils.createKey("kelp_cold"); public static final ResourceKey KELP_WARM = PlacementUtils.createKey("kelp_warm"); @@ -48,10 +40,9 @@ public class AquaticPlacements { Holder.Reference> reference2 = holderGetter.getOrThrow(AquaticFeatures.SEAGRASS_SLIGHTLY_LESS_SHORT); Holder.Reference> reference3 = holderGetter.getOrThrow(AquaticFeatures.SEAGRASS_MID); Holder.Reference> reference4 = holderGetter.getOrThrow(AquaticFeatures.SEAGRASS_TALL); - Holder.Reference> reference5 = holderGetter.getOrThrow(AquaticFeatures.SEAGRASS_SIMPLE); - Holder.Reference> reference6 = holderGetter.getOrThrow(AquaticFeatures.SEA_PICKLE); - Holder.Reference> reference7 = holderGetter.getOrThrow(AquaticFeatures.KELP); - Holder.Reference> reference8 = holderGetter.getOrThrow(AquaticFeatures.WARM_OCEAN_VEGETATION); + Holder.Reference> reference5 = holderGetter.getOrThrow(AquaticFeatures.SEA_PICKLE); + Holder.Reference> reference6 = holderGetter.getOrThrow(AquaticFeatures.KELP); + Holder.Reference> reference7 = holderGetter.getOrThrow(AquaticFeatures.WARM_OCEAN_VEGETATION); PlacementUtils.register(context, SEAGRASS_WARM, reference, seagrassPlacement(80)); PlacementUtils.register(context, SEAGRASS_NORMAL, reference, seagrassPlacement(48)); PlacementUtils.register(context, SEAGRASS_COLD, reference, seagrassPlacement(32)); @@ -61,27 +52,12 @@ public class AquaticPlacements { PlacementUtils.register(context, SEAGRASS_DEEP, reference4, seagrassPlacement(48)); PlacementUtils.register(context, SEAGRASS_DEEP_COLD, reference4, seagrassPlacement(40)); PlacementUtils.register( - context, - SEAGRASS_SIMPLE, - reference5, - CarvingMaskPlacement.forStep(GenerationStep.Carving.LIQUID), - RarityFilter.onAverageOnceEvery(10), - BlockPredicateFilter.forPredicate( - BlockPredicate.allOf( - BlockPredicate.matchesBlocks(Direction.DOWN.getNormal(), Blocks.STONE), - BlockPredicate.matchesBlocks(BlockPos.ZERO, Blocks.WATER), - BlockPredicate.matchesBlocks(Direction.UP.getNormal(), Blocks.WATER) - ) - ), - BiomeFilter.biome() - ); - PlacementUtils.register( - context, SEA_PICKLE, reference6, RarityFilter.onAverageOnceEvery(16), InSquarePlacement.spread(), PlacementUtils.HEIGHTMAP_TOP_SOLID, BiomeFilter.biome() + context, SEA_PICKLE, reference5, RarityFilter.onAverageOnceEvery(16), InSquarePlacement.spread(), PlacementUtils.HEIGHTMAP_TOP_SOLID, BiomeFilter.biome() ); PlacementUtils.register( context, KELP_COLD, - reference7, + reference6, NoiseBasedCountPlacement.of(120, 80.0, 0.0), InSquarePlacement.spread(), PlacementUtils.HEIGHTMAP_TOP_SOLID, @@ -90,7 +66,7 @@ public class AquaticPlacements { PlacementUtils.register( context, KELP_WARM, - reference7, + reference6, NoiseBasedCountPlacement.of(80, 80.0, 0.0), InSquarePlacement.spread(), PlacementUtils.HEIGHTMAP_TOP_SOLID, @@ -99,7 +75,7 @@ public class AquaticPlacements { PlacementUtils.register( context, WARM_OCEAN_VEGETATION, - reference8, + reference7, NoiseBasedCountPlacement.of(20, 400.0, 0.0), InSquarePlacement.spread(), PlacementUtils.HEIGHTMAP_TOP_SOLID, diff --git a/net/minecraft/data/worldgen/placement/TreePlacements.java b/net/minecraft/data/worldgen/placement/TreePlacements.java index 28e73545..d1940357 100644 --- a/net/minecraft/data/worldgen/placement/TreePlacements.java +++ b/net/minecraft/data/worldgen/placement/TreePlacements.java @@ -23,6 +23,8 @@ public class TreePlacements { public static final ResourceKey WARPED_FUNGI = PlacementUtils.createKey("warped_fungi"); public static final ResourceKey OAK_CHECKED = PlacementUtils.createKey("oak_checked"); public static final ResourceKey DARK_OAK_CHECKED = PlacementUtils.createKey("dark_oak_checked"); + public static final ResourceKey PALE_OAK_CHECKED = PlacementUtils.createKey("pale_oak_checked"); + public static final ResourceKey PALE_OAK_CREAKING_CHECKED = PlacementUtils.createKey("pale_oak_creaking_checked"); public static final ResourceKey BIRCH_CHECKED = PlacementUtils.createKey("birch_checked"); public static final ResourceKey ACACIA_CHECKED = PlacementUtils.createKey("acacia_checked"); public static final ResourceKey SPRUCE_CHECKED = PlacementUtils.createKey("spruce_checked"); @@ -55,62 +57,66 @@ public class TreePlacements { Holder> holder2 = holderGetter.getOrThrow(TreeFeatures.WARPED_FUNGUS); Holder> holder3 = holderGetter.getOrThrow(TreeFeatures.OAK); Holder> holder4 = holderGetter.getOrThrow(TreeFeatures.DARK_OAK); - Holder> holder5 = holderGetter.getOrThrow(TreeFeatures.BIRCH); - Holder> holder6 = holderGetter.getOrThrow(TreeFeatures.ACACIA); - Holder> holder7 = holderGetter.getOrThrow(TreeFeatures.SPRUCE); - Holder> holder8 = holderGetter.getOrThrow(TreeFeatures.MANGROVE); - Holder> holder9 = holderGetter.getOrThrow(TreeFeatures.CHERRY); - Holder> holder10 = holderGetter.getOrThrow(TreeFeatures.PINE); - Holder> holder11 = holderGetter.getOrThrow(TreeFeatures.JUNGLE_TREE); - Holder> holder12 = holderGetter.getOrThrow(TreeFeatures.FANCY_OAK); - Holder> holder13 = holderGetter.getOrThrow(TreeFeatures.MEGA_JUNGLE_TREE); - Holder> holder14 = holderGetter.getOrThrow(TreeFeatures.MEGA_SPRUCE); - Holder> holder15 = holderGetter.getOrThrow(TreeFeatures.MEGA_PINE); - Holder> holder16 = holderGetter.getOrThrow(TreeFeatures.TALL_MANGROVE); - Holder> holder17 = holderGetter.getOrThrow(TreeFeatures.JUNGLE_BUSH); - Holder> holder18 = holderGetter.getOrThrow(TreeFeatures.SUPER_BIRCH_BEES_0002); - Holder> holder19 = holderGetter.getOrThrow(TreeFeatures.SUPER_BIRCH_BEES); - Holder> holder20 = holderGetter.getOrThrow(TreeFeatures.OAK_BEES_0002); - Holder> holder21 = holderGetter.getOrThrow(TreeFeatures.OAK_BEES_002); - Holder> holder22 = holderGetter.getOrThrow(TreeFeatures.BIRCH_BEES_0002); - Holder> holder23 = holderGetter.getOrThrow(TreeFeatures.BIRCH_BEES_002); - Holder> holder24 = holderGetter.getOrThrow(TreeFeatures.FANCY_OAK_BEES_0002); - Holder> holder25 = holderGetter.getOrThrow(TreeFeatures.FANCY_OAK_BEES_002); - Holder> holder26 = holderGetter.getOrThrow(TreeFeatures.FANCY_OAK_BEES); - Holder> holder27 = holderGetter.getOrThrow(TreeFeatures.CHERRY_BEES_005); + Holder> holder5 = holderGetter.getOrThrow(TreeFeatures.PALE_OAK); + Holder> holder6 = holderGetter.getOrThrow(TreeFeatures.PALE_OAK_CREAKING); + Holder> holder7 = holderGetter.getOrThrow(TreeFeatures.BIRCH); + Holder> holder8 = holderGetter.getOrThrow(TreeFeatures.ACACIA); + Holder> holder9 = holderGetter.getOrThrow(TreeFeatures.SPRUCE); + Holder> holder10 = holderGetter.getOrThrow(TreeFeatures.MANGROVE); + Holder> holder11 = holderGetter.getOrThrow(TreeFeatures.CHERRY); + Holder> holder12 = holderGetter.getOrThrow(TreeFeatures.PINE); + Holder> holder13 = holderGetter.getOrThrow(TreeFeatures.JUNGLE_TREE); + Holder> holder14 = holderGetter.getOrThrow(TreeFeatures.FANCY_OAK); + Holder> holder15 = holderGetter.getOrThrow(TreeFeatures.MEGA_JUNGLE_TREE); + Holder> holder16 = holderGetter.getOrThrow(TreeFeatures.MEGA_SPRUCE); + Holder> holder17 = holderGetter.getOrThrow(TreeFeatures.MEGA_PINE); + Holder> holder18 = holderGetter.getOrThrow(TreeFeatures.TALL_MANGROVE); + Holder> holder19 = holderGetter.getOrThrow(TreeFeatures.JUNGLE_BUSH); + Holder> holder20 = holderGetter.getOrThrow(TreeFeatures.SUPER_BIRCH_BEES_0002); + Holder> holder21 = holderGetter.getOrThrow(TreeFeatures.SUPER_BIRCH_BEES); + Holder> holder22 = holderGetter.getOrThrow(TreeFeatures.OAK_BEES_0002); + Holder> holder23 = holderGetter.getOrThrow(TreeFeatures.OAK_BEES_002); + Holder> holder24 = holderGetter.getOrThrow(TreeFeatures.BIRCH_BEES_0002); + Holder> holder25 = holderGetter.getOrThrow(TreeFeatures.BIRCH_BEES_002); + Holder> holder26 = holderGetter.getOrThrow(TreeFeatures.FANCY_OAK_BEES_0002); + Holder> holder27 = holderGetter.getOrThrow(TreeFeatures.FANCY_OAK_BEES_002); + Holder> holder28 = holderGetter.getOrThrow(TreeFeatures.FANCY_OAK_BEES); + Holder> holder29 = holderGetter.getOrThrow(TreeFeatures.CHERRY_BEES_005); PlacementUtils.register(context, CRIMSON_FUNGI, holder, CountOnEveryLayerPlacement.of(8), BiomeFilter.biome()); PlacementUtils.register(context, WARPED_FUNGI, holder2, CountOnEveryLayerPlacement.of(8), BiomeFilter.biome()); PlacementUtils.register(context, OAK_CHECKED, holder3, PlacementUtils.filteredByBlockSurvival(Blocks.OAK_SAPLING)); PlacementUtils.register(context, DARK_OAK_CHECKED, holder4, PlacementUtils.filteredByBlockSurvival(Blocks.DARK_OAK_SAPLING)); - PlacementUtils.register(context, BIRCH_CHECKED, holder5, PlacementUtils.filteredByBlockSurvival(Blocks.BIRCH_SAPLING)); - PlacementUtils.register(context, ACACIA_CHECKED, holder6, PlacementUtils.filteredByBlockSurvival(Blocks.ACACIA_SAPLING)); - PlacementUtils.register(context, SPRUCE_CHECKED, holder7, PlacementUtils.filteredByBlockSurvival(Blocks.SPRUCE_SAPLING)); - PlacementUtils.register(context, MANGROVE_CHECKED, holder8, PlacementUtils.filteredByBlockSurvival(Blocks.MANGROVE_PROPAGULE)); - PlacementUtils.register(context, CHERRY_CHECKED, holder9, PlacementUtils.filteredByBlockSurvival(Blocks.CHERRY_SAPLING)); - BlockPredicate blockPredicate = BlockPredicate.matchesBlocks(Direction.DOWN.getNormal(), Blocks.SNOW_BLOCK, Blocks.POWDER_SNOW); + PlacementUtils.register(context, PALE_OAK_CHECKED, holder5, PlacementUtils.filteredByBlockSurvival(Blocks.PALE_OAK_SAPLING)); + PlacementUtils.register(context, PALE_OAK_CREAKING_CHECKED, holder6, PlacementUtils.filteredByBlockSurvival(Blocks.PALE_OAK_SAPLING)); + PlacementUtils.register(context, BIRCH_CHECKED, holder7, PlacementUtils.filteredByBlockSurvival(Blocks.BIRCH_SAPLING)); + PlacementUtils.register(context, ACACIA_CHECKED, holder8, PlacementUtils.filteredByBlockSurvival(Blocks.ACACIA_SAPLING)); + PlacementUtils.register(context, SPRUCE_CHECKED, holder9, PlacementUtils.filteredByBlockSurvival(Blocks.SPRUCE_SAPLING)); + PlacementUtils.register(context, MANGROVE_CHECKED, holder10, PlacementUtils.filteredByBlockSurvival(Blocks.MANGROVE_PROPAGULE)); + PlacementUtils.register(context, CHERRY_CHECKED, holder11, PlacementUtils.filteredByBlockSurvival(Blocks.CHERRY_SAPLING)); + BlockPredicate blockPredicate = BlockPredicate.matchesBlocks(Direction.DOWN.getUnitVec3i(), Blocks.SNOW_BLOCK, Blocks.POWDER_SNOW); List list = List.of( EnvironmentScanPlacement.scanningFor(Direction.UP, BlockPredicate.not(BlockPredicate.matchesBlocks(Blocks.POWDER_SNOW)), 8), BlockPredicateFilter.forPredicate(blockPredicate) ); - PlacementUtils.register(context, PINE_ON_SNOW, holder10, list); - PlacementUtils.register(context, SPRUCE_ON_SNOW, holder7, list); - PlacementUtils.register(context, PINE_CHECKED, holder10, PlacementUtils.filteredByBlockSurvival(Blocks.SPRUCE_SAPLING)); - PlacementUtils.register(context, JUNGLE_TREE_CHECKED, holder11, PlacementUtils.filteredByBlockSurvival(Blocks.JUNGLE_SAPLING)); - PlacementUtils.register(context, FANCY_OAK_CHECKED, holder12, PlacementUtils.filteredByBlockSurvival(Blocks.OAK_SAPLING)); - PlacementUtils.register(context, MEGA_JUNGLE_TREE_CHECKED, holder13, PlacementUtils.filteredByBlockSurvival(Blocks.JUNGLE_SAPLING)); - PlacementUtils.register(context, MEGA_SPRUCE_CHECKED, holder14, PlacementUtils.filteredByBlockSurvival(Blocks.SPRUCE_SAPLING)); - PlacementUtils.register(context, MEGA_PINE_CHECKED, holder15, PlacementUtils.filteredByBlockSurvival(Blocks.SPRUCE_SAPLING)); - PlacementUtils.register(context, TALL_MANGROVE_CHECKED, holder16, PlacementUtils.filteredByBlockSurvival(Blocks.MANGROVE_PROPAGULE)); - PlacementUtils.register(context, JUNGLE_BUSH, holder17, PlacementUtils.filteredByBlockSurvival(Blocks.OAK_SAPLING)); - PlacementUtils.register(context, SUPER_BIRCH_BEES_0002, holder18, PlacementUtils.filteredByBlockSurvival(Blocks.BIRCH_SAPLING)); - PlacementUtils.register(context, SUPER_BIRCH_BEES, holder19, PlacementUtils.filteredByBlockSurvival(Blocks.BIRCH_SAPLING)); - PlacementUtils.register(context, OAK_BEES_0002, holder20, PlacementUtils.filteredByBlockSurvival(Blocks.OAK_SAPLING)); - PlacementUtils.register(context, OAK_BEES_002, holder21, PlacementUtils.filteredByBlockSurvival(Blocks.OAK_SAPLING)); - PlacementUtils.register(context, BIRCH_BEES_0002_PLACED, holder22, PlacementUtils.filteredByBlockSurvival(Blocks.BIRCH_SAPLING)); - PlacementUtils.register(context, BIRCH_BEES_002, holder23, PlacementUtils.filteredByBlockSurvival(Blocks.BIRCH_SAPLING)); - PlacementUtils.register(context, FANCY_OAK_BEES_0002, holder24, PlacementUtils.filteredByBlockSurvival(Blocks.OAK_SAPLING)); - PlacementUtils.register(context, FANCY_OAK_BEES_002, holder25, PlacementUtils.filteredByBlockSurvival(Blocks.OAK_SAPLING)); - PlacementUtils.register(context, FANCY_OAK_BEES, holder26, PlacementUtils.filteredByBlockSurvival(Blocks.OAK_SAPLING)); - PlacementUtils.register(context, CHERRY_BEES_005, holder27, PlacementUtils.filteredByBlockSurvival(Blocks.CHERRY_SAPLING)); + PlacementUtils.register(context, PINE_ON_SNOW, holder12, list); + PlacementUtils.register(context, SPRUCE_ON_SNOW, holder9, list); + PlacementUtils.register(context, PINE_CHECKED, holder12, PlacementUtils.filteredByBlockSurvival(Blocks.SPRUCE_SAPLING)); + PlacementUtils.register(context, JUNGLE_TREE_CHECKED, holder13, PlacementUtils.filteredByBlockSurvival(Blocks.JUNGLE_SAPLING)); + PlacementUtils.register(context, FANCY_OAK_CHECKED, holder14, PlacementUtils.filteredByBlockSurvival(Blocks.OAK_SAPLING)); + PlacementUtils.register(context, MEGA_JUNGLE_TREE_CHECKED, holder15, PlacementUtils.filteredByBlockSurvival(Blocks.JUNGLE_SAPLING)); + PlacementUtils.register(context, MEGA_SPRUCE_CHECKED, holder16, PlacementUtils.filteredByBlockSurvival(Blocks.SPRUCE_SAPLING)); + PlacementUtils.register(context, MEGA_PINE_CHECKED, holder17, PlacementUtils.filteredByBlockSurvival(Blocks.SPRUCE_SAPLING)); + PlacementUtils.register(context, TALL_MANGROVE_CHECKED, holder18, PlacementUtils.filteredByBlockSurvival(Blocks.MANGROVE_PROPAGULE)); + PlacementUtils.register(context, JUNGLE_BUSH, holder19, PlacementUtils.filteredByBlockSurvival(Blocks.OAK_SAPLING)); + PlacementUtils.register(context, SUPER_BIRCH_BEES_0002, holder20, PlacementUtils.filteredByBlockSurvival(Blocks.BIRCH_SAPLING)); + PlacementUtils.register(context, SUPER_BIRCH_BEES, holder21, PlacementUtils.filteredByBlockSurvival(Blocks.BIRCH_SAPLING)); + PlacementUtils.register(context, OAK_BEES_0002, holder22, PlacementUtils.filteredByBlockSurvival(Blocks.OAK_SAPLING)); + PlacementUtils.register(context, OAK_BEES_002, holder23, PlacementUtils.filteredByBlockSurvival(Blocks.OAK_SAPLING)); + PlacementUtils.register(context, BIRCH_BEES_0002_PLACED, holder24, PlacementUtils.filteredByBlockSurvival(Blocks.BIRCH_SAPLING)); + PlacementUtils.register(context, BIRCH_BEES_002, holder25, PlacementUtils.filteredByBlockSurvival(Blocks.BIRCH_SAPLING)); + PlacementUtils.register(context, FANCY_OAK_BEES_0002, holder26, PlacementUtils.filteredByBlockSurvival(Blocks.OAK_SAPLING)); + PlacementUtils.register(context, FANCY_OAK_BEES_002, holder27, PlacementUtils.filteredByBlockSurvival(Blocks.OAK_SAPLING)); + PlacementUtils.register(context, FANCY_OAK_BEES, holder28, PlacementUtils.filteredByBlockSurvival(Blocks.OAK_SAPLING)); + PlacementUtils.register(context, CHERRY_BEES_005, holder29, PlacementUtils.filteredByBlockSurvival(Blocks.CHERRY_SAPLING)); } } diff --git a/net/minecraft/data/worldgen/placement/VegetationPlacements.java b/net/minecraft/data/worldgen/placement/VegetationPlacements.java index c27b836d..d0f21f36 100644 --- a/net/minecraft/data/worldgen/placement/VegetationPlacements.java +++ b/net/minecraft/data/worldgen/placement/VegetationPlacements.java @@ -82,6 +82,7 @@ public class VegetationPlacements { public static final ResourceKey FLOWER_CHERRY = PlacementUtils.createKey("flower_cherry"); public static final ResourceKey TREES_PLAINS = PlacementUtils.createKey("trees_plains"); public static final ResourceKey DARK_FOREST_VEGETATION = PlacementUtils.createKey("dark_forest_vegetation"); + public static final ResourceKey PALE_GARDEN_VEGETATION = PlacementUtils.createKey("pale_garden_vegetation"); public static final ResourceKey FLOWER_FOREST_FLOWERS = PlacementUtils.createKey("flower_forest_flowers"); public static final ResourceKey FOREST_FLOWERS = PlacementUtils.createKey("forest_flowers"); public static final ResourceKey TREES_FLOWER_FOREST = PlacementUtils.createKey("trees_flower_forest"); @@ -177,28 +178,29 @@ public class VegetationPlacements { Holder> holder25 = holderGetter.getOrThrow(VegetationFeatures.FLOWER_CHERRY); Holder> holder26 = holderGetter.getOrThrow(VegetationFeatures.TREES_PLAINS); Holder> holder27 = holderGetter.getOrThrow(VegetationFeatures.DARK_FOREST_VEGETATION); - Holder> holder28 = holderGetter.getOrThrow(VegetationFeatures.FOREST_FLOWERS); - Holder> holder29 = holderGetter.getOrThrow(VegetationFeatures.TREES_FLOWER_FOREST); - Holder> holder30 = holderGetter.getOrThrow(VegetationFeatures.MEADOW_TREES); - Holder> holder31 = holderGetter.getOrThrow(VegetationFeatures.TREES_TAIGA); - Holder> holder32 = holderGetter.getOrThrow(VegetationFeatures.TREES_GROVE); - Holder> holder33 = holderGetter.getOrThrow(TreeFeatures.OAK); - Holder> holder34 = holderGetter.getOrThrow(TreeFeatures.SPRUCE); - Holder> holder35 = holderGetter.getOrThrow(TreeFeatures.CHERRY_BEES_005); - Holder> holder36 = holderGetter.getOrThrow(TreeFeatures.SWAMP_OAK); - Holder> holder37 = holderGetter.getOrThrow(VegetationFeatures.TREES_SAVANNA); - Holder> holder38 = holderGetter.getOrThrow(VegetationFeatures.BIRCH_TALL); - Holder> holder39 = holderGetter.getOrThrow(TreeFeatures.BIRCH_BEES_0002); - Holder> holder40 = holderGetter.getOrThrow(VegetationFeatures.TREES_WINDSWEPT_HILLS); - Holder> holder41 = holderGetter.getOrThrow(VegetationFeatures.TREES_WATER); - Holder> holder42 = holderGetter.getOrThrow(VegetationFeatures.TREES_BIRCH_AND_OAK); - Holder> holder43 = holderGetter.getOrThrow(VegetationFeatures.TREES_SPARSE_JUNGLE); - Holder> holder44 = holderGetter.getOrThrow(VegetationFeatures.TREES_OLD_GROWTH_SPRUCE_TAIGA); - Holder> holder45 = holderGetter.getOrThrow(VegetationFeatures.TREES_OLD_GROWTH_PINE_TAIGA); - Holder> holder46 = holderGetter.getOrThrow(VegetationFeatures.TREES_JUNGLE); - Holder> holder47 = holderGetter.getOrThrow(VegetationFeatures.BAMBOO_VEGETATION); - Holder> holder48 = holderGetter.getOrThrow(VegetationFeatures.MUSHROOM_ISLAND_VEGETATION); - Holder> holder49 = holderGetter.getOrThrow(VegetationFeatures.MANGROVE_VEGETATION); + Holder> holder28 = holderGetter.getOrThrow(VegetationFeatures.PALE_GARDEN_VEGETATION); + Holder> holder29 = holderGetter.getOrThrow(VegetationFeatures.FOREST_FLOWERS); + Holder> holder30 = holderGetter.getOrThrow(VegetationFeatures.TREES_FLOWER_FOREST); + Holder> holder31 = holderGetter.getOrThrow(VegetationFeatures.MEADOW_TREES); + Holder> holder32 = holderGetter.getOrThrow(VegetationFeatures.TREES_TAIGA); + Holder> holder33 = holderGetter.getOrThrow(VegetationFeatures.TREES_GROVE); + Holder> holder34 = holderGetter.getOrThrow(TreeFeatures.OAK); + Holder> holder35 = holderGetter.getOrThrow(TreeFeatures.SPRUCE); + Holder> holder36 = holderGetter.getOrThrow(TreeFeatures.CHERRY_BEES_005); + Holder> holder37 = holderGetter.getOrThrow(TreeFeatures.SWAMP_OAK); + Holder> holder38 = holderGetter.getOrThrow(VegetationFeatures.TREES_SAVANNA); + Holder> holder39 = holderGetter.getOrThrow(VegetationFeatures.BIRCH_TALL); + Holder> holder40 = holderGetter.getOrThrow(TreeFeatures.BIRCH_BEES_0002); + Holder> holder41 = holderGetter.getOrThrow(VegetationFeatures.TREES_WINDSWEPT_HILLS); + Holder> holder42 = holderGetter.getOrThrow(VegetationFeatures.TREES_WATER); + Holder> holder43 = holderGetter.getOrThrow(VegetationFeatures.TREES_BIRCH_AND_OAK); + Holder> holder44 = holderGetter.getOrThrow(VegetationFeatures.TREES_SPARSE_JUNGLE); + Holder> holder45 = holderGetter.getOrThrow(VegetationFeatures.TREES_OLD_GROWTH_SPRUCE_TAIGA); + Holder> holder46 = holderGetter.getOrThrow(VegetationFeatures.TREES_OLD_GROWTH_PINE_TAIGA); + Holder> holder47 = holderGetter.getOrThrow(VegetationFeatures.TREES_JUNGLE); + Holder> holder48 = holderGetter.getOrThrow(VegetationFeatures.BAMBOO_VEGETATION); + Holder> holder49 = holderGetter.getOrThrow(VegetationFeatures.MUSHROOM_ISLAND_VEGETATION); + Holder> holder50 = holderGetter.getOrThrow(VegetationFeatures.MANGROVE_VEGETATION); PlacementUtils.register( context, BAMBOO_LIGHT, holder, RarityFilter.onAverageOnceEvery(4), InSquarePlacement.spread(), PlacementUtils.HEIGHTMAP, BiomeFilter.biome() ); @@ -374,8 +376,18 @@ public class VegetationPlacements { ); PlacementUtils.register( context, - FLOWER_FOREST_FLOWERS, + PALE_GARDEN_VEGETATION, holder28, + CountPlacement.of(16), + InSquarePlacement.spread(), + placementModifier, + PlacementUtils.HEIGHTMAP_OCEAN_FLOOR, + BiomeFilter.biome() + ); + PlacementUtils.register( + context, + FLOWER_FOREST_FLOWERS, + holder29, RarityFilter.onAverageOnceEvery(7), InSquarePlacement.spread(), PlacementUtils.HEIGHTMAP, @@ -385,24 +397,24 @@ public class VegetationPlacements { PlacementUtils.register( context, FOREST_FLOWERS, - holder28, + holder29, RarityFilter.onAverageOnceEvery(7), InSquarePlacement.spread(), PlacementUtils.HEIGHTMAP, CountPlacement.of(ClampedInt.of(UniformInt.of(-3, 1), 0, 1)), BiomeFilter.biome() ); - PlacementUtils.register(context, TREES_FLOWER_FOREST, holder29, treePlacement(PlacementUtils.countExtra(6, 0.1F, 1))); - PlacementUtils.register(context, TREES_MEADOW, holder30, treePlacement(RarityFilter.onAverageOnceEvery(100))); - PlacementUtils.register(context, TREES_CHERRY, holder35, treePlacement(PlacementUtils.countExtra(10, 0.1F, 1), Blocks.CHERRY_SAPLING)); - PlacementUtils.register(context, TREES_TAIGA, holder31, treePlacement(PlacementUtils.countExtra(10, 0.1F, 1))); - PlacementUtils.register(context, TREES_GROVE, holder32, treePlacement(PlacementUtils.countExtra(10, 0.1F, 1))); - PlacementUtils.register(context, TREES_BADLANDS, holder33, treePlacement(PlacementUtils.countExtra(5, 0.1F, 1), Blocks.OAK_SAPLING)); - PlacementUtils.register(context, TREES_SNOWY, holder34, treePlacement(PlacementUtils.countExtra(0, 0.1F, 1), Blocks.SPRUCE_SAPLING)); + PlacementUtils.register(context, TREES_FLOWER_FOREST, holder30, treePlacement(PlacementUtils.countExtra(6, 0.1F, 1))); + PlacementUtils.register(context, TREES_MEADOW, holder31, treePlacement(RarityFilter.onAverageOnceEvery(100))); + PlacementUtils.register(context, TREES_CHERRY, holder36, treePlacement(PlacementUtils.countExtra(10, 0.1F, 1), Blocks.CHERRY_SAPLING)); + PlacementUtils.register(context, TREES_TAIGA, holder32, treePlacement(PlacementUtils.countExtra(10, 0.1F, 1))); + PlacementUtils.register(context, TREES_GROVE, holder33, treePlacement(PlacementUtils.countExtra(10, 0.1F, 1))); + PlacementUtils.register(context, TREES_BADLANDS, holder34, treePlacement(PlacementUtils.countExtra(5, 0.1F, 1), Blocks.OAK_SAPLING)); + PlacementUtils.register(context, TREES_SNOWY, holder35, treePlacement(PlacementUtils.countExtra(0, 0.1F, 1), Blocks.SPRUCE_SAPLING)); PlacementUtils.register( context, TREES_SWAMP, - holder36, + holder37, PlacementUtils.countExtra(2, 0.1F, 1), InSquarePlacement.spread(), SurfaceWaterDepthFilter.forMaxDepth(2), @@ -410,24 +422,24 @@ public class VegetationPlacements { BiomeFilter.biome(), BlockPredicateFilter.forPredicate(BlockPredicate.wouldSurvive(Blocks.OAK_SAPLING.defaultBlockState(), BlockPos.ZERO)) ); - PlacementUtils.register(context, TREES_WINDSWEPT_SAVANNA, holder37, treePlacement(PlacementUtils.countExtra(2, 0.1F, 1))); - PlacementUtils.register(context, TREES_SAVANNA, holder37, treePlacement(PlacementUtils.countExtra(1, 0.1F, 1))); - PlacementUtils.register(context, BIRCH_TALL, holder38, treePlacement(PlacementUtils.countExtra(10, 0.1F, 1))); - PlacementUtils.register(context, TREES_BIRCH, holder39, treePlacement(PlacementUtils.countExtra(10, 0.1F, 1), Blocks.BIRCH_SAPLING)); - PlacementUtils.register(context, TREES_WINDSWEPT_FOREST, holder40, treePlacement(PlacementUtils.countExtra(3, 0.1F, 1))); - PlacementUtils.register(context, TREES_WINDSWEPT_HILLS, holder40, treePlacement(PlacementUtils.countExtra(0, 0.1F, 1))); - PlacementUtils.register(context, TREES_WATER, holder41, treePlacement(PlacementUtils.countExtra(0, 0.1F, 1))); - PlacementUtils.register(context, TREES_BIRCH_AND_OAK, holder42, treePlacement(PlacementUtils.countExtra(10, 0.1F, 1))); - PlacementUtils.register(context, TREES_SPARSE_JUNGLE, holder43, treePlacement(PlacementUtils.countExtra(2, 0.1F, 1))); - PlacementUtils.register(context, TREES_OLD_GROWTH_SPRUCE_TAIGA, holder44, treePlacement(PlacementUtils.countExtra(10, 0.1F, 1))); - PlacementUtils.register(context, TREES_OLD_GROWTH_PINE_TAIGA, holder45, treePlacement(PlacementUtils.countExtra(10, 0.1F, 1))); - PlacementUtils.register(context, TREES_JUNGLE, holder46, treePlacement(PlacementUtils.countExtra(50, 0.1F, 1))); - PlacementUtils.register(context, BAMBOO_VEGETATION, holder47, treePlacement(PlacementUtils.countExtra(30, 0.1F, 1))); - PlacementUtils.register(context, MUSHROOM_ISLAND_VEGETATION, holder48, InSquarePlacement.spread(), PlacementUtils.HEIGHTMAP, BiomeFilter.biome()); + PlacementUtils.register(context, TREES_WINDSWEPT_SAVANNA, holder38, treePlacement(PlacementUtils.countExtra(2, 0.1F, 1))); + PlacementUtils.register(context, TREES_SAVANNA, holder38, treePlacement(PlacementUtils.countExtra(1, 0.1F, 1))); + PlacementUtils.register(context, BIRCH_TALL, holder39, treePlacement(PlacementUtils.countExtra(10, 0.1F, 1))); + PlacementUtils.register(context, TREES_BIRCH, holder40, treePlacement(PlacementUtils.countExtra(10, 0.1F, 1), Blocks.BIRCH_SAPLING)); + PlacementUtils.register(context, TREES_WINDSWEPT_FOREST, holder41, treePlacement(PlacementUtils.countExtra(3, 0.1F, 1))); + PlacementUtils.register(context, TREES_WINDSWEPT_HILLS, holder41, treePlacement(PlacementUtils.countExtra(0, 0.1F, 1))); + PlacementUtils.register(context, TREES_WATER, holder42, treePlacement(PlacementUtils.countExtra(0, 0.1F, 1))); + PlacementUtils.register(context, TREES_BIRCH_AND_OAK, holder43, treePlacement(PlacementUtils.countExtra(10, 0.1F, 1))); + PlacementUtils.register(context, TREES_SPARSE_JUNGLE, holder44, treePlacement(PlacementUtils.countExtra(2, 0.1F, 1))); + PlacementUtils.register(context, TREES_OLD_GROWTH_SPRUCE_TAIGA, holder45, treePlacement(PlacementUtils.countExtra(10, 0.1F, 1))); + PlacementUtils.register(context, TREES_OLD_GROWTH_PINE_TAIGA, holder46, treePlacement(PlacementUtils.countExtra(10, 0.1F, 1))); + PlacementUtils.register(context, TREES_JUNGLE, holder47, treePlacement(PlacementUtils.countExtra(50, 0.1F, 1))); + PlacementUtils.register(context, BAMBOO_VEGETATION, holder48, treePlacement(PlacementUtils.countExtra(30, 0.1F, 1))); + PlacementUtils.register(context, MUSHROOM_ISLAND_VEGETATION, holder49, InSquarePlacement.spread(), PlacementUtils.HEIGHTMAP, BiomeFilter.biome()); PlacementUtils.register( context, TREES_MANGROVE, - holder49, + holder50, CountPlacement.of(25), InSquarePlacement.spread(), SurfaceWaterDepthFilter.forMaxDepth(5), diff --git a/net/minecraft/gametest/framework/GameTestHelper.java b/net/minecraft/gametest/framework/GameTestHelper.java index fe3c5c85..6883914a 100644 --- a/net/minecraft/gametest/framework/GameTestHelper.java +++ b/net/minecraft/gametest/framework/GameTestHelper.java @@ -6,6 +6,7 @@ import com.mojang.datafixers.util.Either; import io.netty.channel.embedded.EmbeddedChannel; import java.util.List; import java.util.Locale; +import java.util.Objects; import java.util.UUID; import java.util.function.Consumer; import java.util.function.Function; @@ -21,16 +22,19 @@ import net.minecraft.core.registries.Registries; import net.minecraft.network.Connection; import net.minecraft.network.protocol.PacketFlow; import net.minecraft.resources.ResourceKey; +import net.minecraft.resources.ResourceLocation; import net.minecraft.server.commands.FillBiomeCommand; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.network.CommonListenerCookie; import net.minecraft.tags.BlockTags; import net.minecraft.world.InteractionHand; -import net.minecraft.world.ItemInteractionResult; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.effect.MobEffect; import net.minecraft.world.effect.MobEffectInstance; import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.Mob; @@ -93,7 +97,7 @@ public class GameTestHelper { public void killAllEntitiesOfClass(Class entityClass) { AABB aABB = this.getBounds(); List list = this.getLevel().getEntitiesOfClass(entityClass, aABB.inflate(1.0), entity -> !(entity instanceof Player)); - list.forEach(Entity::kill); + list.forEach(entity -> entity.kill(this.getLevel())); } public ItemEntity spawnItem(Item item, Vec3 pos) { @@ -119,7 +123,7 @@ public class GameTestHelper { public E spawn(EntityType type, Vec3 pos) { ServerLevel serverLevel = this.getLevel(); - E entity = type.create(serverLevel); + E entity = type.create(serverLevel, EntitySpawnReason.STRUCTURE); if (entity == null) { throw new NullPointerException("Failed to create entity " + type.builtInRegistryHolder().key().location()); } else { @@ -134,6 +138,14 @@ public class GameTestHelper { } } + public void hurt(Entity entity, DamageSource damageSource, float f) { + entity.hurtServer(this.getLevel(), damageSource, f); + } + + public void kill(Entity entity) { + entity.kill(this.getLevel()); + } + public E findOneEntity(EntityType type) { return this.findClosestEntity(type, 0, 0, 0, 2.147483647E9); } @@ -232,9 +244,9 @@ public class GameTestHelper { BlockPos blockPos = this.absolutePos(pos); BlockState blockState = this.getLevel().getBlockState(blockPos); InteractionHand interactionHand = InteractionHand.MAIN_HAND; - ItemInteractionResult itemInteractionResult = blockState.useItemOn(player.getItemInHand(interactionHand), this.getLevel(), player, interactionHand, result); - if (!itemInteractionResult.consumesAction()) { - if (itemInteractionResult != ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION + InteractionResult interactionResult = blockState.useItemOn(player.getItemInHand(interactionHand), this.getLevel(), player, interactionHand, result); + if (!interactionResult.consumesAction()) { + if (!(interactionResult instanceof InteractionResult.TryEmptyHandInteraction) || !blockState.useWithoutItem(this.getLevel(), player, result).consumesAction()) { UseOnContext useOnContext = new UseOnContext(player, interactionHand, result); player.getItemInHand(interactionHand).useOn(useOnContext); @@ -438,11 +450,12 @@ public class GameTestHelper { } } - public void assertEntityPresent(EntityType entityType, Vec3 startPos, Vec3 endPos) { - List list = this.getLevel().getEntities(entityType, new AABB(startPos, endPos), Entity::isAlive); + public void assertEntityPresent(EntityType entityType, AABB aABB) { + AABB aABB2 = this.absoluteAABB(aABB); + List list = this.getLevel().getEntities(entityType, aABB2, Entity::isAlive); if (list.isEmpty()) { throw new GameTestAssertPosException( - "Expected " + entityType.toShortString() + " between ", BlockPos.containing(startPos), BlockPos.containing(endPos), this.testInfo.getTick() + "Expected " + entityType.toShortString(), BlockPos.containing(aABB2.getCenter()), BlockPos.containing(aABB.getCenter()), this.testInfo.getTick() ); } } @@ -511,7 +524,7 @@ public class GameTestHelper { if (i != count) { throw new GameTestAssertPosException( - "Expected " + count + " " + item.getDescription().getString() + " items to exist (found " + i + ")", blockPos, pos, this.testInfo.getTick() + "Expected " + count + " " + item.getName().getString() + " items to exist (found " + i + ")", blockPos, pos, this.testInfo.getTick() ); } } @@ -526,7 +539,7 @@ public class GameTestHelper { } } - throw new GameTestAssertPosException("Expected " + item.getDescription().getString() + " item", blockPos, pos, this.testInfo.getTick()); + throw new GameTestAssertPosException("Expected " + item.getName().getString() + " item", blockPos, pos, this.testInfo.getTick()); } public void assertItemEntityNotPresent(Item item, BlockPos pos, double radius) { @@ -535,7 +548,7 @@ public class GameTestHelper { for (Entity entity : this.getLevel().getEntities(EntityType.ITEM, new AABB(blockPos).inflate(radius), Entity::isAlive)) { ItemEntity itemEntity = (ItemEntity)entity; if (itemEntity.getItem().getItem().equals(item)) { - throw new GameTestAssertPosException("Did not expect " + item.getDescription().getString() + " item", blockPos, pos, this.testInfo.getTick()); + throw new GameTestAssertPosException("Did not expect " + item.getName().getString() + " item", blockPos, pos, this.testInfo.getTick()); } } } @@ -548,14 +561,14 @@ public class GameTestHelper { } } - throw new GameTestAssertException("Expected " + item.getDescription().getString() + " item"); + throw new GameTestAssertException("Expected " + item.getName().getString() + " item"); } public void assertItemEntityNotPresent(Item item) { for (Entity entity : this.getLevel().getEntities(EntityType.ITEM, this.getBounds(), Entity::isAlive)) { ItemEntity itemEntity = (ItemEntity)entity; if (itemEntity.getItem().getItem().equals(item)) { - throw new GameTestAssertException("Did not expect " + item.getDescription().getString() + " item"); + throw new GameTestAssertException("Did not expect " + item.getName().getString() + " item"); } } } @@ -579,11 +592,12 @@ public class GameTestHelper { } } - public void assertEntityNotPresent(EntityType type, Vec3 from, Vec3 to) { - List list = this.getLevel().getEntities(type, new AABB(from, to), Entity::isAlive); + public void assertEntityNotPresent(EntityType entityType, AABB aABB) { + AABB aABB2 = this.absoluteAABB(aABB); + List list = this.getLevel().getEntities(entityType, aABB2, Entity::isAlive); if (!list.isEmpty()) { throw new GameTestAssertPosException( - "Did not expect " + type.toShortString() + " between ", BlockPos.containing(from), BlockPos.containing(to), this.testInfo.getTick() + "Did not expect " + entityType.toShortString(), BlockPos.containing(aABB2.getCenter()), BlockPos.containing(aABB.getCenter()), this.testInfo.getTick() ); } } @@ -608,6 +622,20 @@ public class GameTestHelper { } } + public void assertEntityData(BlockPos blockPos, EntityType entityType, Predicate predicate) { + BlockPos blockPos2 = this.absolutePos(blockPos); + List list = this.getLevel().getEntities(entityType, new AABB(blockPos2), Entity::isAlive); + if (list.isEmpty()) { + throw new GameTestAssertPosException("Expected " + entityType.toShortString(), blockPos2, blockPos, this.testInfo.getTick()); + } else { + for (E entity : list) { + if (!predicate.test(entity)) { + throw new GameTestAssertException("Test failed for entity " + entity); + } + } + } + } + public void assertEntityData(BlockPos pos, EntityType type, Function entityDataGetter, @Nullable T testEntityData) { BlockPos blockPos = this.absolutePos(pos); List list = this.getLevel().getEntities(type, new AABB(blockPos), Entity::isAlive); @@ -616,11 +644,7 @@ public class GameTestHelper { } else { for (E entity : list) { T object = (T)entityDataGetter.apply(entity); - if (object == null) { - if (testEntityData != null) { - throw new GameTestAssertException("Expected entity data to be: " + testEntityData + ", but was: " + object); - } - } else if (!object.equals(testEntityData)) { + if (!Objects.equals(object, testEntityData)) { throw new GameTestAssertException("Expected entity data to be: " + testEntityData + ", but was: " + object); } } @@ -671,7 +695,8 @@ public class GameTestHelper { BlockPos blockPos = this.absolutePos(pos); BlockEntity blockEntity = this.getLevel().getBlockEntity(blockPos); if (!(blockEntity instanceof BaseContainerBlockEntity)) { - throw new GameTestAssertException("Expected a container at " + pos + ", found " + BuiltInRegistries.BLOCK_ENTITY_TYPE.getKey(blockEntity.getType())); + ResourceLocation resourceLocation = blockEntity != null ? BuiltInRegistries.BLOCK_ENTITY_TYPE.getKey(blockEntity.getType()) : null; + throw new GameTestAssertException("Expected a container at " + pos + ", found " + resourceLocation); } else if (((BaseContainerBlockEntity)blockEntity).countItem(item) != 1) { throw new GameTestAssertException("Container should contain: " + item); } @@ -837,26 +862,38 @@ public class GameTestHelper { } public BlockPos absolutePos(BlockPos pos) { - BlockPos blockPos = this.testInfo.getStructureBlockPos(); + BlockPos blockPos = this.testInfo.getTestOrigin(); BlockPos blockPos2 = blockPos.offset(pos); return StructureTemplate.transform(blockPos2, Mirror.NONE, this.testInfo.getRotation(), blockPos); } public BlockPos relativePos(BlockPos pos) { - BlockPos blockPos = this.testInfo.getStructureBlockPos(); + BlockPos blockPos = this.testInfo.getTestOrigin(); Rotation rotation = this.testInfo.getRotation().getRotated(Rotation.CLOCKWISE_180); BlockPos blockPos2 = StructureTemplate.transform(pos, Mirror.NONE, rotation, blockPos); return blockPos2.subtract(blockPos); } + public AABB absoluteAABB(AABB aABB) { + Vec3 vec3 = this.absoluteVec(aABB.getMinPosition()); + Vec3 vec32 = this.absoluteVec(aABB.getMaxPosition()); + return new AABB(vec3, vec32); + } + + public AABB relativeAABB(AABB aABB) { + Vec3 vec3 = this.relativeVec(aABB.getMinPosition()); + Vec3 vec32 = this.relativeVec(aABB.getMaxPosition()); + return new AABB(vec3, vec32); + } + public Vec3 absoluteVec(Vec3 relativeVec3) { - Vec3 vec3 = Vec3.atLowerCornerOf(this.testInfo.getStructureBlockPos()); - return StructureTemplate.transform(vec3.add(relativeVec3), Mirror.NONE, this.testInfo.getRotation(), this.testInfo.getStructureBlockPos()); + Vec3 vec3 = Vec3.atLowerCornerOf(this.testInfo.getTestOrigin()); + return StructureTemplate.transform(vec3.add(relativeVec3), Mirror.NONE, this.testInfo.getRotation(), this.testInfo.getTestOrigin()); } public Vec3 relativeVec(Vec3 absoluteVec3) { - Vec3 vec3 = Vec3.atLowerCornerOf(this.testInfo.getStructureBlockPos()); - return StructureTemplate.transform(absoluteVec3.subtract(vec3), Mirror.NONE, this.testInfo.getRotation(), this.testInfo.getStructureBlockPos()); + Vec3 vec3 = Vec3.atLowerCornerOf(this.testInfo.getTestOrigin()); + return StructureTemplate.transform(absoluteVec3.subtract(vec3), Mirror.NONE, this.testInfo.getRotation(), this.testInfo.getTestOrigin()); } public Rotation getTestRotation() { @@ -891,7 +928,14 @@ public class GameTestHelper { private AABB getRelativeBounds() { AABB aABB = this.testInfo.getStructureBounds(); - return aABB.move(BlockPos.ZERO.subtract(this.absolutePos(BlockPos.ZERO))); + Rotation rotation = this.testInfo.getRotation(); + switch (rotation) { + case COUNTERCLOCKWISE_90: + case CLOCKWISE_90: + return new AABB(0.0, 0.0, 0.0, aABB.getZsize(), aABB.getYsize(), aABB.getXsize()); + default: + return new AABB(0.0, 0.0, 0.0, aABB.getXsize(), aABB.getYsize(), aABB.getZsize()); + } } public void forEveryBlockInStructure(Consumer consumer) { @@ -915,7 +959,7 @@ public class GameTestHelper { BlockPos blockPos = BlockPos.containing(aABB.minX, aABB.minY, aABB.minZ); BlockPos blockPos2 = BlockPos.containing(aABB.maxX, aABB.maxY, aABB.maxZ); Either either = FillBiomeCommand.fill( - this.getLevel(), blockPos, blockPos2, this.getLevel().registryAccess().registryOrThrow(Registries.BIOME).getHolderOrThrow(biome) + this.getLevel(), blockPos, blockPos2, this.getLevel().registryAccess().lookupOrThrow(Registries.BIOME).getOrThrow(biome) ); if (either.right().isPresent()) { this.fail("Failed to set biome for test"); diff --git a/net/minecraft/gametest/framework/GameTestInfo.java b/net/minecraft/gametest/framework/GameTestInfo.java index d30ac34e..fb675f50 100644 --- a/net/minecraft/gametest/framework/GameTestInfo.java +++ b/net/minecraft/gametest/framework/GameTestInfo.java @@ -178,6 +178,10 @@ public class GameTestInfo { return this.structureBlockPos; } + public BlockPos getTestOrigin() { + return StructureUtils.getStructureOrigin(this.structureBlockEntity); + } + public AABB getStructureBounds() { StructureBlockEntity structureBlockEntity = this.getStructureBlockEntity(); return StructureUtils.getStructureBounds(structureBlockEntity); @@ -335,7 +339,7 @@ public class GameTestInfo { return gameTestInfo; } - private BlockPos getOrCalculateNorthwestCorner() { + public BlockPos getOrCalculateNorthwestCorner() { if (this.northWestCorner == null) { BoundingBox boundingBox = StructureUtils.getStructureBoundingBox(this.getStructureBlockEntity()); this.northWestCorner = new BlockPos(boundingBox.minX(), boundingBox.minY(), boundingBox.minZ()); diff --git a/net/minecraft/gametest/framework/GameTestServer.java b/net/minecraft/gametest/framework/GameTestServer.java index ef78bbc4..e97c2788 100644 --- a/net/minecraft/gametest/framework/GameTestServer.java +++ b/net/minecraft/gametest/framework/GameTestServer.java @@ -22,6 +22,7 @@ import net.minecraft.core.LayeredRegistryAccess; import net.minecraft.core.MappedRegistry; import net.minecraft.core.Registry; import net.minecraft.core.registries.Registries; +import net.minecraft.gametest.framework.GameTestRunner.Builder; import net.minecraft.server.MinecraftServer; import net.minecraft.server.RegistryLayer; import net.minecraft.server.Services; @@ -35,6 +36,7 @@ import net.minecraft.util.datafix.DataFixers; import net.minecraft.util.debugchart.LocalSampleLogger; import net.minecraft.util.debugchart.SampleLogger; import net.minecraft.world.Difficulty; +import net.minecraft.world.flag.FeatureFlagSet; import net.minecraft.world.flag.FeatureFlags; import net.minecraft.world.level.DataPackConfig; import net.minecraft.world.level.GameRules; @@ -55,12 +57,15 @@ public class GameTestServer extends MinecraftServer { private static final int PROGRESS_REPORT_INTERVAL = 20; private static final int TEST_POSITION_RANGE = 14999992; private static final Services NO_SERVICES = new Services(null, ServicesKeySet.EMPTY, null, null); + private static final FeatureFlagSet ENABLED_FEATURES = FeatureFlags.REGISTRY + .allFlags() + .subtract(FeatureFlagSet.of(FeatureFlags.REDSTONE_EXPERIMENTS, FeatureFlags.MINECART_IMPROVEMENTS)); private final LocalSampleLogger sampleLogger = new LocalSampleLogger(4); private List testBatches = new ArrayList(); private final List testFunctions; private final BlockPos spawnPos; private final Stopwatch stopwatch = Stopwatch.createUnstarted(); - private static final GameRules TEST_GAME_RULES = Util.make(new GameRules(), gameRules -> { + private static final GameRules TEST_GAME_RULES = Util.make(new GameRules(ENABLED_FEATURES), gameRules -> { gameRules.getRule(GameRules.RULE_DOMOBSPAWNING).set(false, null); gameRules.getRule(GameRules.RULE_WEATHER_CYCLE).set(false, null); gameRules.getRule(GameRules.RULE_RANDOMTICKING).set(0, null); @@ -82,7 +87,7 @@ public class GameTestServer extends MinecraftServer { } else { packRepository.reload(); WorldDataConfiguration worldDataConfiguration = new WorldDataConfiguration( - new DataPackConfig(new ArrayList(packRepository.getAvailableIds()), List.of()), FeatureFlags.REGISTRY.allFlags() + new DataPackConfig(new ArrayList(packRepository.getAvailableIds()), List.of()), ENABLED_FEATURES ); LevelSettings levelSettings = new LevelSettings("Test Level", GameType.CREATIVE, false, Difficulty.NORMAL, true, TEST_GAME_RULES, worldDataConfiguration); WorldLoader.PackConfig packConfig = new WorldLoader.PackConfig(packRepository, worldDataConfiguration, false, true); @@ -97,8 +102,8 @@ public class GameTestServer extends MinecraftServer { dataLoadContext -> { Registry registry = new MappedRegistry<>(Registries.LEVEL_STEM, Lifecycle.stable()).freeze(); WorldDimensions.Complete complete = dataLoadContext.datapackWorldgen() - .registryOrThrow(Registries.WORLD_PRESET) - .getHolderOrThrow(WorldPresets.FLAT) + .lookupOrThrow(Registries.WORLD_PRESET) + .getOrThrow(WorldPresets.FLAT) .value() .createWorldDimensions() .bake(registry); @@ -184,7 +189,9 @@ public class GameTestServer extends MinecraftServer { if (this.testTracker.hasFailedOptional()) { LOGGER.info("{} optional tests failed", this.testTracker.getFailedOptionalCount()); - this.testTracker.getFailedOptional().forEach(gameTestInfo -> LOGGER.info(" - {}", gameTestInfo.getTestName())); + this.testTracker + .getFailedOptional() + .forEach(gameTestInfo -> LOGGER.info(" - {} with rotation: {}", gameTestInfo.getTestName(), gameTestInfo.getRotation())); } LOGGER.info("===================================================="); @@ -230,9 +237,7 @@ public class GameTestServer extends MinecraftServer { BlockPos blockPos = new BlockPos( serverLevel.random.nextIntBetweenInclusive(-14999992, 14999992), -59, serverLevel.random.nextIntBetweenInclusive(-14999992, 14999992) ); - GameTestRunner gameTestRunner = GameTestRunner.Builder.fromBatches(this.testBatches, serverLevel) - .newStructureSpawner(new StructureGridSpawner(blockPos, 8, false)) - .build(); + GameTestRunner gameTestRunner = Builder.fromBatches(this.testBatches, serverLevel).newStructureSpawner(new StructureGridSpawner(blockPos, 8, false)).build(); Collection collection = gameTestRunner.getTestInfos(); this.testTracker = new MultipleTestTracker(collection); LOGGER.info("{} tests are now running at position {}!", this.testTracker.getTotalCount(), blockPos.toShortString()); diff --git a/net/minecraft/gametest/framework/JUnitLikeTestReporter.java b/net/minecraft/gametest/framework/JUnitLikeTestReporter.java index 970e4894..ba7438ae 100644 --- a/net/minecraft/gametest/framework/JUnitLikeTestReporter.java +++ b/net/minecraft/gametest/framework/JUnitLikeTestReporter.java @@ -46,7 +46,7 @@ public class JUnitLikeTestReporter implements TestReporter { String string = testInfo.getTestName(); String string2 = testInfo.getError().getMessage(); Element element = this.document.createElement(testInfo.isRequired() ? "failure" : "skipped"); - element.setAttribute("message", "(" + testInfo.getStructureBlockPos().toShortString() + ") " + string2); + element.setAttribute("message", "(" + testInfo.getTestOrigin().toShortString() + ") " + string2); Element element2 = this.createTestCase(testInfo, string); element2.appendChild(element); } diff --git a/net/minecraft/gametest/framework/LogTestReporter.java b/net/minecraft/gametest/framework/LogTestReporter.java index 6878d129..4ba1c52b 100644 --- a/net/minecraft/gametest/framework/LogTestReporter.java +++ b/net/minecraft/gametest/framework/LogTestReporter.java @@ -9,7 +9,7 @@ public class LogTestReporter implements TestReporter { @Override public void onTestFailed(GameTestInfo testInfo) { - String string = testInfo.getStructureBlockPos().toShortString(); + String string = testInfo.getTestOrigin().toShortString(); if (testInfo.isRequired()) { LOGGER.error("{} failed at {}! {}", testInfo.getTestName(), string, Util.describeError(testInfo.getError())); } else { diff --git a/net/minecraft/gametest/framework/StructureUtils.java b/net/minecraft/gametest/framework/StructureUtils.java index b8396e77..c5707cac 100644 --- a/net/minecraft/gametest/framework/StructureUtils.java +++ b/net/minecraft/gametest/framework/StructureUtils.java @@ -96,32 +96,42 @@ public class StructureUtils { StructureBlockEntity structureBlockEntity = (StructureBlockEntity)serverLevel.getBlockEntity(pos); structureBlockEntity.setIgnoreEntities(false); structureBlockEntity.setStructureName(ResourceLocation.parse(structureName)); + structureBlockEntity.setMetaData(structureName); structureBlockEntity.setStructureSize(size); structureBlockEntity.setMode(StructureMode.SAVE); structureBlockEntity.setShowBoundingBox(true); } + public static BlockPos getStartCorner(GameTestInfo gameTestInfo, BlockPos blockPos, Rotation rotation, ServerLevel serverLevel) { + Vec3i vec3i = ((StructureTemplate)serverLevel.getStructureManager() + .get(ResourceLocation.parse(gameTestInfo.getStructureName())) + .orElseThrow(() -> new IllegalStateException("Missing test structure: " + gameTestInfo.getStructureName()))) + .getSize(); + BlockPos blockPos2; + if (rotation == Rotation.NONE) { + blockPos2 = blockPos; + } else if (rotation == Rotation.CLOCKWISE_90) { + blockPos2 = blockPos.offset(vec3i.getZ() - 1, 0, 0); + } else if (rotation == Rotation.CLOCKWISE_180) { + blockPos2 = blockPos.offset(vec3i.getX() - 1, 0, vec3i.getZ() - 1); + } else { + if (rotation != Rotation.COUNTERCLOCKWISE_90) { + throw new IllegalArgumentException("Invalid rotation: " + rotation); + } + + blockPos2 = blockPos.offset(0, 0, vec3i.getX() - 1); + } + + return blockPos2; + } + public static StructureBlockEntity prepareTestStructure(GameTestInfo gameTestInfo, BlockPos pos, Rotation rotation, ServerLevel level) { Vec3i vec3i = ((StructureTemplate)level.getStructureManager() .get(ResourceLocation.parse(gameTestInfo.getStructureName())) .orElseThrow(() -> new IllegalStateException("Missing test structure: " + gameTestInfo.getStructureName()))) .getSize(); BoundingBox boundingBox = getStructureBoundingBox(pos, vec3i, rotation); - BlockPos blockPos; - if (rotation == Rotation.NONE) { - blockPos = pos; - } else if (rotation == Rotation.CLOCKWISE_90) { - blockPos = pos.offset(vec3i.getZ() - 1, 0, 0); - } else if (rotation == Rotation.CLOCKWISE_180) { - blockPos = pos.offset(vec3i.getX() - 1, 0, vec3i.getZ() - 1); - } else { - if (rotation != Rotation.COUNTERCLOCKWISE_90) { - throw new IllegalArgumentException("Invalid rotation: " + rotation); - } - - blockPos = pos.offset(0, 0, vec3i.getX() - 1); - } - + BlockPos blockPos = getStartCorner(gameTestInfo, pos, rotation, level); forceLoadChunks(boundingBox, level); clearSpaceForStructure(boundingBox, level); return createStructureBlock(gameTestInfo, blockPos.below(), rotation, level); diff --git a/net/minecraft/gametest/framework/TestCommand.java b/net/minecraft/gametest/framework/TestCommand.java index 3504e5a4..e39d422a 100644 --- a/net/minecraft/gametest/framework/TestCommand.java +++ b/net/minecraft/gametest/framework/TestCommand.java @@ -30,6 +30,7 @@ import net.minecraft.core.Direction; import net.minecraft.core.Vec3i; import net.minecraft.data.CachedOutput; import net.minecraft.data.structures.NbtToSnbt; +import net.minecraft.gametest.framework.TestFinder.Builder; import net.minecraft.nbt.NbtIo; import net.minecraft.nbt.NbtUtils; import net.minecraft.network.chat.ClickEvent; @@ -56,6 +57,8 @@ import org.slf4j.Logger; public class TestCommand { public static final int STRUCTURE_BLOCK_NEARBY_SEARCH_RADIUS = 15; public static final int STRUCTURE_BLOCK_FULL_SEARCH_RADIUS = 200; + public static final int VERIFY_TEST_GRID_AXIS_SIZE = 10; + public static final int VERIFY_TEST_BATCH_SIZE = 100; private static final Logger LOGGER = LogUtils.getLogger(); private static final int DEFAULT_CLEAR_RADIUS = 200; private static final int MAX_CLEAR_RADIUS = 1024; @@ -65,7 +68,7 @@ public class TestCommand { private static final int DEFAULT_Y_SIZE = 5; private static final int DEFAULT_Z_SIZE = 5; private static final String STRUCTURE_BLOCK_ENTITY_COULD_NOT_BE_FOUND = "Structure block entity could not be found"; - private static final TestFinder.Builder testFinder = new TestFinder.Builder<>(TestCommand.Runner::new); + private static final Builder testFinder = new Builder<>(TestCommand.Runner::new); private static ArgumentBuilder runWithRetryOptions( ArgumentBuilder argumentBuilder, @@ -550,7 +553,6 @@ public class TestCommand { TestCommand.toGameTestInfo(commandSourceStack, RetryOptions.noRetries(), this.finder, 0) ) .toList(); - int i = 10; GameTestRunner.clearMarkers(serverLevel); GameTestRegistry.forgetFailedTests(); Collection collection2 = new ArrayList(); @@ -559,7 +561,7 @@ public class TestCommand { for (Rotation rotation : Rotation.values()) { Collection collection3 = new ArrayList(); - for (int j = 0; j < 100; j++) { + for (int i = 0; i < 100; i++) { GameTestInfo gameTestInfo2 = new GameTestInfo(gameTestInfo.getTestFunction(), rotation, serverLevel, new RetryOptions(1, true)); collection3.add(gameTestInfo2); } @@ -570,7 +572,7 @@ public class TestCommand { } StructureGridSpawner structureGridSpawner = new StructureGridSpawner(blockPos, 10, true); - GameTestRunner gameTestRunner = GameTestRunner.Builder.fromBatches(collection2, serverLevel) + GameTestRunner gameTestRunner = net.minecraft.gametest.framework.GameTestRunner.Builder.fromBatches(collection2, serverLevel) .batcher(GameTestBatchFactory.fromGameTestInfo(100)) .newStructureSpawner(structureGridSpawner) .existingStructureSpawner(structureGridSpawner) @@ -596,7 +598,7 @@ public class TestCommand { GameTestRunner.clearMarkers(serverLevel); GameTestRegistry.forgetFailedTests(); TestCommand.say(commandSourceStack, "Running " + collection.size() + " tests..."); - GameTestRunner gameTestRunner = GameTestRunner.Builder.fromInfo(collection, serverLevel) + GameTestRunner gameTestRunner = net.minecraft.gametest.framework.GameTestRunner.Builder.fromInfo(collection, serverLevel) .newStructureSpawner(new StructureGridSpawner(blockPos, testsPerRow, false)) .build(); return TestCommand.trackAndStartRunner(commandSourceStack, serverLevel, gameTestRunner); diff --git a/net/minecraft/locale/DeprecatedTranslationsInfo.java b/net/minecraft/locale/DeprecatedTranslationsInfo.java new file mode 100644 index 00000000..a6fb454a --- /dev/null +++ b/net/minecraft/locale/DeprecatedTranslationsInfo.java @@ -0,0 +1,92 @@ +package net.minecraft.locale; + +import com.google.gson.JsonElement; +import com.google.gson.JsonParser; +import com.mojang.logging.LogUtils; +import com.mojang.serialization.Codec; +import com.mojang.serialization.JsonOps; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.nio.charset.StandardCharsets; +import java.util.List; +import java.util.Map; +import org.slf4j.Logger; + +public record DeprecatedTranslationsInfo(List removed, Map renamed) { + private static final Logger LOGGER = LogUtils.getLogger(); + public static final DeprecatedTranslationsInfo EMPTY = new DeprecatedTranslationsInfo(List.of(), Map.of()); + public static final Codec CODEC = RecordCodecBuilder.create( + instance -> instance.group( + Codec.STRING.listOf().fieldOf("removed").forGetter(DeprecatedTranslationsInfo::removed), + Codec.unboundedMap(Codec.STRING, Codec.STRING).fieldOf("renamed").forGetter(DeprecatedTranslationsInfo::renamed) + ) + .apply(instance, DeprecatedTranslationsInfo::new) + ); + + public static DeprecatedTranslationsInfo loadFromJson(InputStream inputStream) { + JsonElement jsonElement = JsonParser.parseReader(new InputStreamReader(inputStream, StandardCharsets.UTF_8)); + return CODEC.parse(JsonOps.INSTANCE, jsonElement).getOrThrow(string -> new IllegalStateException("Failed to parse deprecated language data: " + string)); + } + + public static DeprecatedTranslationsInfo loadFromResource(String string) { + try { + InputStream inputStream = Language.class.getResourceAsStream(string); + + DeprecatedTranslationsInfo var2; + label49: { + try { + if (inputStream != null) { + var2 = loadFromJson(inputStream); + break label49; + } + } catch (Throwable var5) { + if (inputStream != null) { + try { + inputStream.close(); + } catch (Throwable var4) { + var5.addSuppressed(var4); + } + } + + throw var5; + } + + if (inputStream != null) { + inputStream.close(); + } + + return EMPTY; + } + + if (inputStream != null) { + inputStream.close(); + } + + return var2; + } catch (Exception var6) { + LOGGER.error("Failed to read {}", string, var6); + return EMPTY; + } + } + + public static DeprecatedTranslationsInfo loadFromDefaultResource() { + return loadFromResource("/assets/minecraft/lang/deprecated.json"); + } + + public void applyToMap(Map map) { + for (String string : this.removed) { + map.remove(string); + } + + this.renamed.forEach((stringx, string2) -> { + String string3 = (String)map.remove(stringx); + if (string3 == null) { + LOGGER.warn("Missing translation key for rename: {}", stringx); + map.remove(string2); + } else { + map.put(string2, string3); + } + }); + } +} diff --git a/net/minecraft/locale/Language.java b/net/minecraft/locale/Language.java index a3e16142..1709ca5a 100644 --- a/net/minecraft/locale/Language.java +++ b/net/minecraft/locale/Language.java @@ -1,8 +1,6 @@ package net.minecraft.locale; import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.ImmutableMap.Builder; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; @@ -12,6 +10,7 @@ import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.nio.charset.StandardCharsets; +import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Optional; @@ -36,19 +35,21 @@ public abstract class Language { private static volatile Language instance = loadDefault(); private static Language loadDefault() { - Builder builder = ImmutableMap.builder(); - BiConsumer biConsumer = builder::put; + DeprecatedTranslationsInfo deprecatedTranslationsInfo = DeprecatedTranslationsInfo.loadFromDefaultResource(); + Map map = new HashMap(); + BiConsumer biConsumer = map::put; parseTranslations(biConsumer, "/assets/minecraft/lang/en_us.json"); - final Map map = builder.build(); + deprecatedTranslationsInfo.applyToMap(map); + final Map map2 = Map.copyOf(map); return new Language() { @Override public String getOrDefault(String key, String defaultValue) { - return (String)map.getOrDefault(key, defaultValue); + return (String)map2.getOrDefault(key, defaultValue); } @Override public boolean has(String id) { - return map.containsKey(id); + return map2.containsKey(id); } @Override diff --git a/net/minecraft/network/FriendlyByteBuf.java b/net/minecraft/network/FriendlyByteBuf.java index 6c848963..9492596c 100644 --- a/net/minecraft/network/FriendlyByteBuf.java +++ b/net/minecraft/network/FriendlyByteBuf.java @@ -442,6 +442,14 @@ public class FriendlyByteBuf extends ByteBuf { return this; } + public static ChunkPos readChunkPos(ByteBuf byteBuf) { + return new ChunkPos(byteBuf.readLong()); + } + + public static void writeChunkPos(ByteBuf byteBuf, ChunkPos chunkPos) { + byteBuf.writeLong(chunkPos.toLong()); + } + /** * Reads a SectionPos encoded as a long from the buffer. * @@ -509,14 +517,22 @@ public class FriendlyByteBuf extends ByteBuf { buffer.writeFloat(quaternion.w); } + public static Vec3 readVec3(ByteBuf byteBuf) { + return new Vec3(byteBuf.readDouble(), byteBuf.readDouble(), byteBuf.readDouble()); + } + public Vec3 readVec3() { - return new Vec3(this.readDouble(), this.readDouble(), this.readDouble()); + return readVec3(this); + } + + public static void writeVec3(ByteBuf byteBuf, Vec3 vec3) { + byteBuf.writeDouble(vec3.x()); + byteBuf.writeDouble(vec3.y()); + byteBuf.writeDouble(vec3.z()); } public void writeVec3(Vec3 vec3) { - this.writeDouble(vec3.x()); - this.writeDouble(vec3.y()); - this.writeDouble(vec3.z()); + writeVec3(this, vec3); } /** @@ -789,7 +805,8 @@ public class FriendlyByteBuf extends ByteBuf { float g = this.readFloat(); float h = this.readFloat(); boolean bl = this.readBoolean(); - return new BlockHitResult(new Vec3((double)blockPos.getX() + f, (double)blockPos.getY() + g, (double)blockPos.getZ() + h), direction, blockPos, bl); + boolean bl2 = this.readBoolean(); + return new BlockHitResult(new Vec3((double)blockPos.getX() + f, (double)blockPos.getY() + g, (double)blockPos.getZ() + h), direction, blockPos, bl, bl2); } /** @@ -806,6 +823,7 @@ public class FriendlyByteBuf extends ByteBuf { this.writeFloat((float)(vec3.y - blockPos.getY())); this.writeFloat((float)(vec3.z - blockPos.getZ())); this.writeBoolean(result.isInside()); + this.writeBoolean(result.isWorldBorderHit()); } /** @@ -841,6 +859,22 @@ public class FriendlyByteBuf extends ByteBuf { } } + public static int readContainerId(ByteBuf byteBuf) { + return VarInt.read(byteBuf); + } + + public int readContainerId() { + return readContainerId(this.source); + } + + public static void writeContainerId(ByteBuf byteBuf, int i) { + VarInt.write(byteBuf, i); + } + + public void writeContainerId(int i) { + writeContainerId(this.source, i); + } + @Override public boolean isContiguous() { return this.source.isContiguous(); diff --git a/net/minecraft/network/chat/ChatType.java b/net/minecraft/network/chat/ChatType.java index 9c2cc4b8..89cbed8d 100644 --- a/net/minecraft/network/chat/ChatType.java +++ b/net/minecraft/network/chat/ChatType.java @@ -69,8 +69,8 @@ public record ChatType(ChatTypeDecoration chat, ChatTypeDecoration narration) { } public static ChatType.Bound bind(ResourceKey chatTypeKey, RegistryAccess registryAccess, Component name) { - Registry registry = registryAccess.registryOrThrow(Registries.CHAT_TYPE); - return new ChatType.Bound(registry.getHolderOrThrow(chatTypeKey), name); + Registry registry = registryAccess.lookupOrThrow(Registries.CHAT_TYPE); + return new ChatType.Bound(registry.getOrThrow(chatTypeKey), name); } public record Bound(Holder chatType, Component name, Optional targetName) { diff --git a/net/minecraft/network/chat/ChatTypeDecoration.java b/net/minecraft/network/chat/ChatTypeDecoration.java index 4092aaee..27543cc2 100644 --- a/net/minecraft/network/chat/ChatTypeDecoration.java +++ b/net/minecraft/network/chat/ChatTypeDecoration.java @@ -7,17 +7,20 @@ import java.util.List; import java.util.function.IntFunction; import net.minecraft.ChatFormatting; import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.chat.ChatTypeDecoration.Parameter.Selector; +import net.minecraft.network.chat.Style.Serializer; import net.minecraft.network.codec.ByteBufCodecs; import net.minecraft.network.codec.StreamCodec; import net.minecraft.util.ByIdMap; import net.minecraft.util.StringRepresentable; +import net.minecraft.util.ByIdMap.OutOfBoundsStrategy; public record ChatTypeDecoration(String translationKey, List parameters, Style style) { public static final Codec CODEC = RecordCodecBuilder.create( instance -> instance.group( Codec.STRING.fieldOf("translation_key").forGetter(ChatTypeDecoration::translationKey), ChatTypeDecoration.Parameter.CODEC.listOf().fieldOf("parameters").forGetter(ChatTypeDecoration::parameters), - Style.Serializer.CODEC.optionalFieldOf("style", Style.EMPTY).forGetter(ChatTypeDecoration::style) + Serializer.CODEC.optionalFieldOf("style", Style.EMPTY).forGetter(ChatTypeDecoration::style) ) .apply(instance, ChatTypeDecoration::new) ); @@ -26,7 +29,7 @@ public record ChatTypeDecoration(String translationKey, List (Component)bound.targetName().orElse(CommonComponents.EMPTY)), CONTENT(2, "content", (component, bound) -> component); - private static final IntFunction BY_ID = ByIdMap.continuous( - parameter -> parameter.id, values(), ByIdMap.OutOfBoundsStrategy.ZERO - ); + private static final IntFunction BY_ID = ByIdMap.continuous(parameter -> parameter.id, values(), OutOfBoundsStrategy.ZERO); public static final Codec CODEC = StringRepresentable.fromEnum(ChatTypeDecoration.Parameter::values); public static final StreamCodec STREAM_CODEC = ByteBufCodecs.idMapper(BY_ID, parameter -> parameter.id); private final int id; private final String name; - private final ChatTypeDecoration.Parameter.Selector selector; + private final Selector selector; - private Parameter(final int id, final String name, final ChatTypeDecoration.Parameter.Selector selector) { + private Parameter(final int id, final String name, final Selector selector) { this.id = id; this.name = name; this.selector = selector; @@ -95,9 +96,5 @@ public record ChatTypeDecoration(String translationKey, List Optional visit(FormattedText.StyledContentConsumer acceptor, Style style) { + default Optional visit(StyledContentConsumer acceptor, Style style) { Style style2 = this.getStyle().applyTo(style); Optional optional = this.getContents().visit(acceptor, style2); if (optional.isPresent()) { @@ -112,7 +116,7 @@ public interface Component extends Message, FormattedText { } @Override - default Optional visit(FormattedText.ContentConsumer acceptor) { + default Optional visit(ContentConsumer acceptor) { Optional optional = this.getContents().visit(acceptor); if (optional.isPresent()) { return optional; @@ -201,12 +205,16 @@ public interface Component extends Message, FormattedText { return MutableComponent.create(new NbtContents(nbtPathPattern, interpreting, separator, dataSource)); } - static MutableComponent score(String name, String objective) { - return MutableComponent.create(new ScoreContents(name, objective)); + static MutableComponent score(SelectorPattern selectorPattern, String string) { + return MutableComponent.create(new ScoreContents(Either.left(selectorPattern), string)); } - static MutableComponent selector(String pattern, Optional separator) { - return MutableComponent.create(new SelectorContents(pattern, separator)); + static MutableComponent score(String name, String objective) { + return MutableComponent.create(new ScoreContents(Either.right(name), objective)); + } + + static MutableComponent selector(SelectorPattern selectorPattern, Optional optional) { + return MutableComponent.create(new SelectorContents(selectorPattern, optional)); } static Component translationArg(Date date) { diff --git a/net/minecraft/network/chat/ComponentContents.java b/net/minecraft/network/chat/ComponentContents.java index c75b18e4..f6a1fbed 100644 --- a/net/minecraft/network/chat/ComponentContents.java +++ b/net/minecraft/network/chat/ComponentContents.java @@ -4,16 +4,18 @@ import com.mojang.brigadier.exceptions.CommandSyntaxException; import com.mojang.serialization.MapCodec; import java.util.Optional; import net.minecraft.commands.CommandSourceStack; +import net.minecraft.network.chat.FormattedText.ContentConsumer; +import net.minecraft.network.chat.FormattedText.StyledContentConsumer; import net.minecraft.util.StringRepresentable; import net.minecraft.world.entity.Entity; import org.jetbrains.annotations.Nullable; public interface ComponentContents { - default Optional visit(FormattedText.StyledContentConsumer styledContentConsumer, Style style) { + default Optional visit(StyledContentConsumer styledContentConsumer, Style style) { return Optional.empty(); } - default Optional visit(FormattedText.ContentConsumer contentConsumer) { + default Optional visit(ContentConsumer contentConsumer) { return Optional.empty(); } diff --git a/net/minecraft/network/chat/HoverEvent.java b/net/minecraft/network/chat/HoverEvent.java index 441cf09c..29c46287 100644 --- a/net/minecraft/network/chat/HoverEvent.java +++ b/net/minecraft/network/chat/HoverEvent.java @@ -3,7 +3,6 @@ package net.minecraft.network.chat; import com.google.gson.JsonElement; import com.google.gson.JsonParser; import com.mojang.brigadier.exceptions.CommandSyntaxException; -import com.mojang.datafixers.util.Pair; import com.mojang.serialization.Codec; import com.mojang.serialization.DataResult; import com.mojang.serialization.DynamicOps; @@ -23,6 +22,7 @@ import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.NbtOps; import net.minecraft.nbt.Tag; import net.minecraft.nbt.TagParser; +import net.minecraft.network.chat.HoverEvent.Action.1; import net.minecraft.resources.RegistryOps; import net.minecraft.resources.ResourceLocation; import net.minecraft.util.StringRepresentable; @@ -96,25 +96,7 @@ public class HoverEvent { this.allowFromServer = allowFromServer; this.codec = codec.>xmap(object -> new HoverEvent.TypedHoverEvent<>(this, (T)object), typedHoverEvent -> typedHoverEvent.value) .fieldOf("contents"); - this.legacyCodec = (new Codec>() { - @Override - public DataResult, D>> decode(DynamicOps dynamicOps, D object) { - return ComponentSerialization.CODEC.decode(dynamicOps, object).flatMap(pair -> { - DataResult dataResult; - if (dynamicOps instanceof RegistryOps registryOps) { - dataResult = legacyConverter.parse((Component)pair.getFirst(), registryOps); - } else { - dataResult = legacyConverter.parse((Component)pair.getFirst(), null); - } - - return dataResult.map(objectx -> Pair.of(new HoverEvent.TypedHoverEvent<>(Action.this, objectx), pair.getSecond())); - }); - } - - public DataResult encode(HoverEvent.TypedHoverEvent typedHoverEvent, DynamicOps dynamicOps, D object) { - return DataResult.error(() -> "Can't encode in legacy format"); - } - }).fieldOf("value"); + this.legacyCodec = new 1(this, legacyConverter).fieldOf("value"); } /** @@ -176,7 +158,7 @@ public class HoverEvent { CompoundTag compoundTag = TagParser.parseTag(name.getString()); DynamicOps dynamicOps = (DynamicOps)(ops != null ? ops.withParent(JsonOps.INSTANCE) : JsonOps.INSTANCE); DataResult dataResult = ComponentSerialization.CODEC.parse(dynamicOps, JsonParser.parseString(compoundTag.getString("name"))); - EntityType entityType = BuiltInRegistries.ENTITY_TYPE.get(ResourceLocation.parse(compoundTag.getString("type"))); + EntityType entityType = BuiltInRegistries.ENTITY_TYPE.getValue(ResourceLocation.parse(compoundTag.getString("type"))); UUID uUID = UUID.fromString(compoundTag.getString("id")); return dataResult.map(component -> new HoverEvent.EntityTooltipInfo(entityType, uUID, component)); } catch (Exception var7) { diff --git a/net/minecraft/network/chat/contents/ScoreContents.java b/net/minecraft/network/chat/contents/ScoreContents.java index e78f8ab6..64a85c61 100644 --- a/net/minecraft/network/chat/contents/ScoreContents.java +++ b/net/minecraft/network/chat/contents/ScoreContents.java @@ -1,15 +1,15 @@ package net.minecraft.network.chat.contents; -import com.mojang.brigadier.StringReader; import com.mojang.brigadier.exceptions.CommandSyntaxException; +import com.mojang.datafixers.util.Either; import com.mojang.serialization.Codec; import com.mojang.serialization.MapCodec; import com.mojang.serialization.codecs.RecordCodecBuilder; import java.util.List; +import java.util.Optional; import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.arguments.EntityArgument; -import net.minecraft.commands.arguments.selector.EntitySelector; -import net.minecraft.commands.arguments.selector.EntitySelectorParser; +import net.minecraft.commands.arguments.selector.SelectorPattern; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.ComponentContents; import net.minecraft.network.chat.MutableComponent; @@ -22,66 +22,38 @@ import net.minecraft.world.scores.ScoreHolder; import net.minecraft.world.scores.Scoreboard; import org.jetbrains.annotations.Nullable; -public class ScoreContents implements ComponentContents { +public record ScoreContents(Either name, String objective) implements ComponentContents { public static final MapCodec INNER_CODEC = RecordCodecBuilder.mapCodec( instance -> instance.group( - Codec.STRING.fieldOf("name").forGetter(ScoreContents::getName), Codec.STRING.fieldOf("objective").forGetter(ScoreContents::getObjective) + Codec.either(SelectorPattern.CODEC, Codec.STRING).fieldOf("name").forGetter(ScoreContents::name), + Codec.STRING.fieldOf("objective").forGetter(ScoreContents::objective) ) .apply(instance, ScoreContents::new) ); public static final MapCodec CODEC = INNER_CODEC.fieldOf("score"); public static final ComponentContents.Type TYPE = new ComponentContents.Type<>(CODEC, "score"); - private final String name; - @Nullable - private final EntitySelector selector; - private final String objective; - - @Nullable - private static EntitySelector parseSelector(String selector) { - try { - return new EntitySelectorParser(new StringReader(selector), true).parse(); - } catch (CommandSyntaxException var2) { - return null; - } - } - - public ScoreContents(String name, String objective) { - this.name = name; - this.selector = parseSelector(name); - this.objective = objective; - } @Override public ComponentContents.Type type() { return TYPE; } - public String getName() { - return this.name; - } - - @Nullable - public EntitySelector getSelector() { - return this.selector; - } - - public String getObjective() { - return this.objective; - } - private ScoreHolder findTargetName(CommandSourceStack source) throws CommandSyntaxException { - if (this.selector != null) { - List list = this.selector.findEntities(source); + Optional optional = this.name.left(); + if (optional.isPresent()) { + List list = ((SelectorPattern)optional.get()).resolved().findEntities(source); if (!list.isEmpty()) { if (list.size() != 1) { throw EntityArgument.ERROR_NOT_SINGLE_ENTITY.create(); + } else { + return (ScoreHolder)list.getFirst(); } - - return (ScoreHolder)list.get(0); + } else { + return ScoreHolder.forNameOnly(((SelectorPattern)optional.get()).pattern()); } + } else { + return ScoreHolder.forNameOnly((String)this.name.right().orElseThrow()); } - - return ScoreHolder.forNameOnly(this.name); } private MutableComponent getScore(ScoreHolder scoreHolder, CommandSourceStack source) { @@ -111,17 +83,6 @@ public class ScoreContents implements ComponentContents { } } - public boolean equals(Object object) { - return this == object - ? true - : object instanceof ScoreContents scoreContents && this.name.equals(scoreContents.name) && this.objective.equals(scoreContents.objective); - } - - public int hashCode() { - int i = this.name.hashCode(); - return 31 * i + this.objective.hashCode(); - } - public String toString() { return "score{name='" + this.name + "', objective='" + this.objective + "'}"; } diff --git a/net/minecraft/network/chat/contents/SelectorContents.java b/net/minecraft/network/chat/contents/SelectorContents.java index 74f17015..eb232249 100644 --- a/net/minecraft/network/chat/contents/SelectorContents.java +++ b/net/minecraft/network/chat/contents/SelectorContents.java @@ -1,111 +1,58 @@ package net.minecraft.network.chat.contents; -import com.mojang.brigadier.StringReader; import com.mojang.brigadier.exceptions.CommandSyntaxException; -import com.mojang.logging.LogUtils; -import com.mojang.serialization.Codec; import com.mojang.serialization.MapCodec; import com.mojang.serialization.codecs.RecordCodecBuilder; import java.util.Optional; import net.minecraft.commands.CommandSourceStack; -import net.minecraft.commands.arguments.selector.EntitySelector; -import net.minecraft.commands.arguments.selector.EntitySelectorParser; +import net.minecraft.commands.arguments.selector.SelectorPattern; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.ComponentContents; import net.minecraft.network.chat.ComponentSerialization; import net.minecraft.network.chat.ComponentUtils; -import net.minecraft.network.chat.FormattedText; import net.minecraft.network.chat.MutableComponent; import net.minecraft.network.chat.Style; +import net.minecraft.network.chat.FormattedText.ContentConsumer; +import net.minecraft.network.chat.FormattedText.StyledContentConsumer; import net.minecraft.world.entity.Entity; import org.jetbrains.annotations.Nullable; -import org.slf4j.Logger; -public class SelectorContents implements ComponentContents { - private static final Logger LOGGER = LogUtils.getLogger(); +public record SelectorContents(SelectorPattern selector, Optional separator) implements ComponentContents { public static final MapCodec CODEC = RecordCodecBuilder.mapCodec( instance -> instance.group( - Codec.STRING.fieldOf("selector").forGetter(SelectorContents::getPattern), - ComponentSerialization.CODEC.optionalFieldOf("separator").forGetter(SelectorContents::getSeparator) + SelectorPattern.CODEC.fieldOf("selector").forGetter(SelectorContents::selector), + ComponentSerialization.CODEC.optionalFieldOf("separator").forGetter(SelectorContents::separator) ) .apply(instance, SelectorContents::new) ); public static final ComponentContents.Type TYPE = new ComponentContents.Type<>(CODEC, "selector"); - private final String pattern; - @Nullable - private final EntitySelector selector; - protected final Optional separator; - - public SelectorContents(String pattern, Optional separator) { - this.pattern = pattern; - this.separator = separator; - this.selector = parseSelector(pattern); - } - - @Nullable - private static EntitySelector parseSelector(String selector) { - EntitySelector entitySelector = null; - - try { - EntitySelectorParser entitySelectorParser = new EntitySelectorParser(new StringReader(selector), true); - entitySelector = entitySelectorParser.parse(); - } catch (CommandSyntaxException var3) { - LOGGER.warn("Invalid selector component: {}: {}", selector, var3.getMessage()); - } - - return entitySelector; - } @Override public ComponentContents.Type type() { return TYPE; } - public String getPattern() { - return this.pattern; - } - - @Nullable - public EntitySelector getSelector() { - return this.selector; - } - - public Optional getSeparator() { - return this.separator; - } - @Override public MutableComponent resolve(@Nullable CommandSourceStack nbtPathPattern, @Nullable Entity entity, int recursionDepth) throws CommandSyntaxException { - if (nbtPathPattern != null && this.selector != null) { - Optional optional = ComponentUtils.updateForEntity(nbtPathPattern, this.separator, entity, recursionDepth); - return ComponentUtils.formatList(this.selector.findEntities(nbtPathPattern), optional, Entity::getDisplayName); - } else { + if (nbtPathPattern == null) { return Component.empty(); + } else { + Optional optional = ComponentUtils.updateForEntity(nbtPathPattern, this.separator, entity, recursionDepth); + return ComponentUtils.formatList(this.selector.resolved().findEntities(nbtPathPattern), optional, Entity::getDisplayName); } } @Override - public Optional visit(FormattedText.StyledContentConsumer styledContentConsumer, Style style) { - return styledContentConsumer.accept(style, this.pattern); + public Optional visit(StyledContentConsumer styledContentConsumer, Style style) { + return styledContentConsumer.accept(style, this.selector.pattern()); } @Override - public Optional visit(FormattedText.ContentConsumer contentConsumer) { - return contentConsumer.accept(this.pattern); - } - - public boolean equals(Object object) { - return this == object - ? true - : object instanceof SelectorContents selectorContents && this.pattern.equals(selectorContents.pattern) && this.separator.equals(selectorContents.separator); - } - - public int hashCode() { - int i = this.pattern.hashCode(); - return 31 * i + this.separator.hashCode(); + public Optional visit(ContentConsumer contentConsumer) { + return contentConsumer.accept(this.selector.pattern()); } public String toString() { - return "pattern{" + this.pattern + "}"; + return "pattern{" + this.selector + "}"; } } diff --git a/net/minecraft/network/codec/ByteBufCodecs.java b/net/minecraft/network/codec/ByteBufCodecs.java index 20b97aed..d4ddf6af 100644 --- a/net/minecraft/network/codec/ByteBufCodecs.java +++ b/net/minecraft/network/codec/ByteBufCodecs.java @@ -13,6 +13,7 @@ import java.util.Collection; import java.util.List; import java.util.Map; import java.util.Optional; +import java.util.OptionalInt; import java.util.UUID; import java.util.function.Function; import java.util.function.IntFunction; @@ -37,6 +38,7 @@ import net.minecraft.resources.RegistryOps; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.TagKey; +import net.minecraft.util.Mth; import org.joml.Quaternionf; import org.joml.Vector3f; @@ -60,6 +62,7 @@ public interface ByteBufCodecs { byteBuf.writeByte(byte_); } }; + StreamCodec ROTATION_BYTE = BYTE.map(Mth::unpackDegrees, Mth::packDegrees); StreamCodec SHORT = new StreamCodec() { public Short decode(ByteBuf byteBuf) { return byteBuf.readShort(); @@ -96,6 +99,18 @@ public interface ByteBufCodecs { VarInt.write(byteBuf, integer); } }; + StreamCodec OPTIONAL_VAR_INT = VAR_INT.map( + integer -> integer == 0 ? OptionalInt.empty() : OptionalInt.of(integer - 1), optionalInt -> optionalInt.isPresent() ? optionalInt.getAsInt() + 1 : 0 + ); + StreamCodec LONG = new StreamCodec() { + public Long decode(ByteBuf byteBuf) { + return byteBuf.readLong(); + } + + public void encode(ByteBuf byteBuf, Long long_) { + byteBuf.writeLong(long_); + } + }; StreamCodec VAR_LONG = new StreamCodec() { public Long decode(ByteBuf byteBuf) { return VarLong.read(byteBuf); @@ -124,12 +139,12 @@ public interface ByteBufCodecs { } }; StreamCodec BYTE_ARRAY = new StreamCodec() { - public byte[] decode(ByteBuf buffer) { - return FriendlyByteBuf.readByteArray(buffer); + public byte[] decode(ByteBuf byteBuf) { + return FriendlyByteBuf.readByteArray(byteBuf); } - public void encode(ByteBuf buffer, byte[] value) { - FriendlyByteBuf.writeByteArray(buffer, value); + public void encode(ByteBuf byteBuf, byte[] bs) { + FriendlyByteBuf.writeByteArray(byteBuf, bs); } }; StreamCodec STRING_UTF8 = stringUtf8(32767); @@ -164,6 +179,15 @@ public interface ByteBufCodecs { FriendlyByteBuf.writeQuaternion(byteBuf, quaternionf); } }; + StreamCodec CONTAINER_ID = new StreamCodec() { + public Integer decode(ByteBuf byteBuf) { + return FriendlyByteBuf.readContainerId(byteBuf); + } + + public void encode(ByteBuf byteBuf, Integer integer) { + FriendlyByteBuf.writeContainerId(byteBuf, integer); + } + }; StreamCodec GAME_PROFILE_PROPERTIES = new StreamCodec() { private static final int MAX_PROPERTY_NAME_LENGTH = 64; private static final int MAX_PROPERTY_VALUE_LENGTH = 32767; @@ -457,18 +481,18 @@ public interface ByteBufCodecs { ResourceKey> registryKey, Function, IdMap> idGetter ) { return new StreamCodec() { - private IdMap getRegistryOrThrow(RegistryFriendlyByteBuf buffer) { - return (IdMap)idGetter.apply(buffer.registryAccess().registryOrThrow(registryKey)); + private IdMap getRegistryOrThrow(RegistryFriendlyByteBuf registryFriendlyByteBuf) { + return (IdMap)idGetter.apply(registryFriendlyByteBuf.registryAccess().lookupOrThrow(registryKey)); } - public R decode(RegistryFriendlyByteBuf buffer) { - int i = VarInt.read(buffer); - return (R)this.getRegistryOrThrow(buffer).byIdOrThrow(i); + public R decode(RegistryFriendlyByteBuf registryFriendlyByteBuf) { + int i = VarInt.read(registryFriendlyByteBuf); + return (R)this.getRegistryOrThrow(registryFriendlyByteBuf).byIdOrThrow(i); } - public void encode(RegistryFriendlyByteBuf buffer, R value) { - int i = this.getRegistryOrThrow(buffer).getIdOrThrow(value); - VarInt.write(buffer, i); + public void encode(RegistryFriendlyByteBuf registryFriendlyByteBuf, R object) { + int i = this.getRegistryOrThrow(registryFriendlyByteBuf).getIdOrThrow(object); + VarInt.write(registryFriendlyByteBuf, i); } }; } @@ -487,24 +511,24 @@ public interface ByteBufCodecs { return new StreamCodec>() { private static final int DIRECT_HOLDER_ID = 0; - private IdMap> getRegistryOrThrow(RegistryFriendlyByteBuf buffer) { - return buffer.registryAccess().registryOrThrow(registryKey).asHolderIdMap(); + private IdMap> getRegistryOrThrow(RegistryFriendlyByteBuf registryFriendlyByteBuf) { + return registryFriendlyByteBuf.registryAccess().lookupOrThrow(registryKey).asHolderIdMap(); } - public Holder decode(RegistryFriendlyByteBuf buffer) { - int i = VarInt.read(buffer); - return i == 0 ? Holder.direct(codec.decode(buffer)) : (Holder)this.getRegistryOrThrow(buffer).byIdOrThrow(i - 1); + public Holder decode(RegistryFriendlyByteBuf registryFriendlyByteBuf) { + int i = VarInt.read(registryFriendlyByteBuf); + return i == 0 ? Holder.direct(codec.decode(registryFriendlyByteBuf)) : (Holder)this.getRegistryOrThrow(registryFriendlyByteBuf).byIdOrThrow(i - 1); } - public void encode(RegistryFriendlyByteBuf buffer, Holder value) { - switch (value.kind()) { + public void encode(RegistryFriendlyByteBuf registryFriendlyByteBuf, Holder holder) { + switch (holder.kind()) { case REFERENCE: - int i = this.getRegistryOrThrow(buffer).getIdOrThrow(value); - VarInt.write(buffer, i + 1); + int i = this.getRegistryOrThrow(registryFriendlyByteBuf).getIdOrThrow(holder); + VarInt.write(registryFriendlyByteBuf, i + 1); break; case DIRECT: - VarInt.write(buffer, 0); - codec.encode(buffer, value.value()); + VarInt.write(registryFriendlyByteBuf, 0); + codec.encode(registryFriendlyByteBuf, holder.value()); } } }; @@ -518,8 +542,8 @@ public interface ByteBufCodecs { public HolderSet decode(RegistryFriendlyByteBuf registryFriendlyByteBuf) { int i = VarInt.read(registryFriendlyByteBuf) - 1; if (i == -1) { - Registry registry = registryFriendlyByteBuf.registryAccess().registryOrThrow(registryKey); - return (HolderSet)registry.getTag(TagKey.create(registryKey, ResourceLocation.STREAM_CODEC.decode(registryFriendlyByteBuf))).orElseThrow(); + Registry registry = registryFriendlyByteBuf.registryAccess().lookupOrThrow(registryKey); + return (HolderSet)registry.get(TagKey.create(registryKey, ResourceLocation.STREAM_CODEC.decode(registryFriendlyByteBuf))).orElseThrow(); } else { List> list = new ArrayList(Math.min(i, 65536)); diff --git a/net/minecraft/network/codec/StreamCodec.java b/net/minecraft/network/codec/StreamCodec.java index e86309c3..70f9ccbc 100644 --- a/net/minecraft/network/codec/StreamCodec.java +++ b/net/minecraft/network/codec/StreamCodec.java @@ -5,6 +5,8 @@ import com.mojang.datafixers.util.Function3; import com.mojang.datafixers.util.Function4; import com.mojang.datafixers.util.Function5; import com.mojang.datafixers.util.Function6; +import com.mojang.datafixers.util.Function7; +import com.mojang.datafixers.util.Function8; import io.netty.buffer.ByteBuf; import java.util.function.BiFunction; import java.util.function.Function; @@ -275,6 +277,96 @@ public interface StreamCodec extends StreamDecoder, StreamEncoder StreamCodec composite( + StreamCodec streamCodec, + Function function, + StreamCodec streamCodec2, + Function function2, + StreamCodec streamCodec3, + Function function3, + StreamCodec streamCodec4, + Function function4, + StreamCodec streamCodec5, + Function function5, + StreamCodec streamCodec6, + Function function6, + StreamCodec streamCodec7, + Function function7, + Function7 function72 + ) { + return new StreamCodec() { + @Override + public C decode(B object) { + T1 object2 = streamCodec.decode(object); + T2 object3 = streamCodec2.decode(object); + T3 object4 = streamCodec3.decode(object); + T4 object5 = streamCodec4.decode(object); + T5 object6 = streamCodec5.decode(object); + T6 object7 = streamCodec6.decode(object); + T7 object8 = streamCodec7.decode(object); + return function72.apply(object2, object3, object4, object5, object6, object7, object8); + } + + @Override + public void encode(B object, C object2) { + streamCodec.encode(object, (T1)function.apply(object2)); + streamCodec2.encode(object, (T2)function2.apply(object2)); + streamCodec3.encode(object, (T3)function3.apply(object2)); + streamCodec4.encode(object, (T4)function4.apply(object2)); + streamCodec5.encode(object, (T5)function5.apply(object2)); + streamCodec6.encode(object, (T6)function6.apply(object2)); + streamCodec7.encode(object, (T7)function7.apply(object2)); + } + }; + } + + static StreamCodec composite( + StreamCodec streamCodec, + Function function, + StreamCodec streamCodec2, + Function function2, + StreamCodec streamCodec3, + Function function3, + StreamCodec streamCodec4, + Function function4, + StreamCodec streamCodec5, + Function function5, + StreamCodec streamCodec6, + Function function6, + StreamCodec streamCodec7, + Function function7, + StreamCodec streamCodec8, + Function function8, + Function8 function82 + ) { + return new StreamCodec() { + @Override + public C decode(B object) { + T1 object2 = streamCodec.decode(object); + T2 object3 = streamCodec2.decode(object); + T3 object4 = streamCodec3.decode(object); + T4 object5 = streamCodec4.decode(object); + T5 object6 = streamCodec5.decode(object); + T6 object7 = streamCodec6.decode(object); + T7 object8 = streamCodec7.decode(object); + T8 object9 = streamCodec8.decode(object); + return function82.apply(object2, object3, object4, object5, object6, object7, object8, object9); + } + + @Override + public void encode(B object, C object2) { + streamCodec.encode(object, (T1)function.apply(object2)); + streamCodec2.encode(object, (T2)function2.apply(object2)); + streamCodec3.encode(object, (T3)function3.apply(object2)); + streamCodec4.encode(object, (T4)function4.apply(object2)); + streamCodec5.encode(object, (T5)function5.apply(object2)); + streamCodec6.encode(object, (T6)function6.apply(object2)); + streamCodec7.encode(object, (T7)function7.apply(object2)); + streamCodec8.encode(object, (T8)function8.apply(object2)); + } + }; + } + static StreamCodec recursive(UnaryOperator> modifier) { return new StreamCodec() { private final Supplier> inner = Suppliers.memoize(() -> (StreamCodec)modifier.apply(this)); diff --git a/net/minecraft/network/protocol/common/ClientCommonPacketListener.java b/net/minecraft/network/protocol/common/ClientCommonPacketListener.java index 3acc7b83..fb1e25d0 100644 --- a/net/minecraft/network/protocol/common/ClientCommonPacketListener.java +++ b/net/minecraft/network/protocol/common/ClientCommonPacketListener.java @@ -1,9 +1,8 @@ package net.minecraft.network.protocol.common; -import net.minecraft.network.ClientboundPacketListener; import net.minecraft.network.protocol.cookie.ClientCookiePacketListener; -public interface ClientCommonPacketListener extends ClientCookiePacketListener, ClientboundPacketListener { +public interface ClientCommonPacketListener extends ClientCookiePacketListener { void handleKeepAlive(ClientboundKeepAlivePacket packet); void handlePing(ClientboundPingPacket packet); diff --git a/net/minecraft/network/protocol/common/ClientboundCustomPayloadPacket.java b/net/minecraft/network/protocol/common/ClientboundCustomPayloadPacket.java index c0f88551..f7a89736 100644 --- a/net/minecraft/network/protocol/common/ClientboundCustomPayloadPacket.java +++ b/net/minecraft/network/protocol/common/ClientboundCustomPayloadPacket.java @@ -26,6 +26,7 @@ import net.minecraft.network.protocol.common.custom.PoiAddedDebugPayload; import net.minecraft.network.protocol.common.custom.PoiRemovedDebugPayload; import net.minecraft.network.protocol.common.custom.PoiTicketCountDebugPayload; import net.minecraft.network.protocol.common.custom.RaidsDebugPayload; +import net.minecraft.network.protocol.common.custom.RedstoneWireOrientationsDebugPayload; import net.minecraft.network.protocol.common.custom.StructuresDebugPayload; import net.minecraft.network.protocol.common.custom.VillageSectionsDebugPayload; import net.minecraft.network.protocol.common.custom.WorldGenAttemptDebugPayload; @@ -52,6 +53,7 @@ public record ClientboundCustomPayloadPacket(CustomPacketPayload payload) implem new CustomPacketPayload.TypeAndCodec<>(PoiRemovedDebugPayload.TYPE, PoiRemovedDebugPayload.STREAM_CODEC), new CustomPacketPayload.TypeAndCodec<>(PoiTicketCountDebugPayload.TYPE, PoiTicketCountDebugPayload.STREAM_CODEC), new CustomPacketPayload.TypeAndCodec<>(RaidsDebugPayload.TYPE, RaidsDebugPayload.STREAM_CODEC), + new CustomPacketPayload.TypeAndCodec<>(RedstoneWireOrientationsDebugPayload.TYPE, RedstoneWireOrientationsDebugPayload.STREAM_CODEC), new CustomPacketPayload.TypeAndCodec<>(StructuresDebugPayload.TYPE, StructuresDebugPayload.STREAM_CODEC), new CustomPacketPayload.TypeAndCodec<>(VillageSectionsDebugPayload.TYPE, VillageSectionsDebugPayload.STREAM_CODEC), new CustomPacketPayload.TypeAndCodec<>(WorldGenAttemptDebugPayload.TYPE, WorldGenAttemptDebugPayload.STREAM_CODEC) diff --git a/net/minecraft/network/protocol/common/ServerCommonPacketListener.java b/net/minecraft/network/protocol/common/ServerCommonPacketListener.java index 1dc4e4cb..cf24e6fe 100644 --- a/net/minecraft/network/protocol/common/ServerCommonPacketListener.java +++ b/net/minecraft/network/protocol/common/ServerCommonPacketListener.java @@ -1,9 +1,8 @@ package net.minecraft.network.protocol.common; import net.minecraft.network.protocol.cookie.ServerCookiePacketListener; -import net.minecraft.network.protocol.game.ServerPacketListener; -public interface ServerCommonPacketListener extends ServerCookiePacketListener, ServerPacketListener { +public interface ServerCommonPacketListener extends ServerCookiePacketListener { void handleKeepAlive(ServerboundKeepAlivePacket packet); void handlePong(ServerboundPongPacket packet); diff --git a/net/minecraft/network/protocol/common/custom/RedstoneWireOrientationsDebugPayload.java b/net/minecraft/network/protocol/common/custom/RedstoneWireOrientationsDebugPayload.java new file mode 100644 index 00000000..29f369ac --- /dev/null +++ b/net/minecraft/network/protocol/common/custom/RedstoneWireOrientationsDebugPayload.java @@ -0,0 +1,35 @@ +package net.minecraft.network.protocol.common.custom; + +import io.netty.buffer.ByteBuf; +import java.util.List; +import net.minecraft.core.BlockPos; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.world.level.redstone.Orientation; + +public record RedstoneWireOrientationsDebugPayload(long time, List wires) implements CustomPacketPayload { + public static final CustomPacketPayload.Type TYPE = CustomPacketPayload.createType("debug/redstone_update_order"); + public static final StreamCodec STREAM_CODEC = StreamCodec.composite( + ByteBufCodecs.VAR_LONG, + RedstoneWireOrientationsDebugPayload::time, + RedstoneWireOrientationsDebugPayload.Wire.STREAM_CODEC.apply(ByteBufCodecs.list()), + RedstoneWireOrientationsDebugPayload::wires, + RedstoneWireOrientationsDebugPayload::new + ); + + @Override + public CustomPacketPayload.Type type() { + return TYPE; + } + + public record Wire(BlockPos pos, Orientation orientation) { + public static final StreamCodec STREAM_CODEC = StreamCodec.composite( + BlockPos.STREAM_CODEC, + RedstoneWireOrientationsDebugPayload.Wire::pos, + Orientation.STREAM_CODEC, + RedstoneWireOrientationsDebugPayload.Wire::orientation, + RedstoneWireOrientationsDebugPayload.Wire::new + ); + } +} diff --git a/net/minecraft/network/protocol/game/ClientGamePacketListener.java b/net/minecraft/network/protocol/game/ClientGamePacketListener.java index 6d712a00..0e1036fc 100644 --- a/net/minecraft/network/protocol/game/ClientGamePacketListener.java +++ b/net/minecraft/network/protocol/game/ClientGamePacketListener.java @@ -7,7 +7,7 @@ import net.minecraft.network.protocol.ping.ClientPongPacketListener; /** * PacketListener for the client side of the PLAY protocol. */ -public interface ClientGamePacketListener extends ClientPongPacketListener, ClientCommonPacketListener { +public interface ClientGamePacketListener extends ClientCommonPacketListener, ClientPongPacketListener { @Override default ConnectionProtocol protocol() { return ConnectionProtocol.PLAY; @@ -40,7 +40,11 @@ public interface ClientGamePacketListener extends ClientPongPacketListener, Clie */ void handleAwardStats(ClientboundAwardStatsPacket packet); - void handleAddOrRemoveRecipes(ClientboundRecipePacket packet); + void handleRecipeBookAdd(ClientboundRecipeBookAddPacket clientboundRecipeBookAddPacket); + + void handleRecipeBookRemove(ClientboundRecipeBookRemovePacket clientboundRecipeBookRemovePacket); + + void handleRecipeBookSettings(ClientboundRecipeBookSettingsPacket clientboundRecipeBookSettingsPacket); /** * Updates all registered IWorldAccess instances with destroyBlockInWorldPartially @@ -141,8 +145,12 @@ public interface ClientGamePacketListener extends ClientPongPacketListener, Clie */ void handleMoveEntity(ClientboundMoveEntityPacket packet); + void handleMinecartAlongTrack(ClientboundMoveMinecartPacket clientboundMoveMinecartPacket); + void handleMovePlayer(ClientboundPlayerPositionPacket packet); + void handleRotatePlayer(ClientboundPlayerRotationPacket clientboundPlayerRotationPacket); + /** * Spawns a specified number of particles at the specified location with a randomized displacement according to specified bounds */ @@ -165,10 +173,7 @@ public interface ClientGamePacketListener extends ClientPongPacketListener, Clie */ void handleRotateMob(ClientboundRotateHeadPacket packet); - /** - * Updates which hotbar slot of the player is currently selected - */ - void handleSetCarriedItem(ClientboundSetCarriedItemPacket packet); + void handleSetHeldSlot(ClientboundSetHeldSlotPacket clientboundSetHeldSlotPacket); /** * Removes or sets the ScoreObjective to be displayed at a particular scoreboard position (list, sidebar, below name) @@ -213,6 +218,8 @@ public interface ClientGamePacketListener extends ClientPongPacketListener, Clie void handleTakeItemEntity(ClientboundTakeItemEntityPacket packet); + void handleEntityPositionSync(ClientboundEntityPositionSyncPacket clientboundEntityPositionSyncPacket); + /** * Updates an entity's position and rotation as specified by the packet */ @@ -323,4 +330,8 @@ public interface ClientGamePacketListener extends ClientPongPacketListener, Clie void handleDebugSample(ClientboundDebugSamplePacket packet); void handleProjectilePowerPacket(ClientboundProjectilePowerPacket packet); + + void handleSetCursorItem(ClientboundSetCursorItemPacket clientboundSetCursorItemPacket); + + void handleSetPlayerInventory(ClientboundSetPlayerInventoryPacket clientboundSetPlayerInventoryPacket); } diff --git a/net/minecraft/network/protocol/game/ClientboundAddEntityPacket.java b/net/minecraft/network/protocol/game/ClientboundAddEntityPacket.java index f4bce90a..df91518b 100644 --- a/net/minecraft/network/protocol/game/ClientboundAddEntityPacket.java +++ b/net/minecraft/network/protocol/game/ClientboundAddEntityPacket.java @@ -78,9 +78,9 @@ public class ClientboundAddEntityPacket implements Packet STREAM_CODEC = Packet.codec( ClientboundContainerSetSlotPacket::write, ClientboundContainerSetSlotPacket::new ); - public static final int CARRIED_ITEM = -1; - public static final int PLAYER_INVENTORY = -2; private final int containerId; private final int stateId; private final int slot; @@ -25,14 +23,14 @@ public class ClientboundContainerSetSlotPacket implements Packet { +public record ClientboundCooldownPacket(ResourceLocation cooldownGroup, int duration) implements Packet { public static final StreamCodec STREAM_CODEC = StreamCodec.composite( - ByteBufCodecs.registry(Registries.ITEM), - ClientboundCooldownPacket::item, + ResourceLocation.STREAM_CODEC, + ClientboundCooldownPacket::cooldownGroup, ByteBufCodecs.VAR_INT, ClientboundCooldownPacket::duration, ClientboundCooldownPacket::new diff --git a/net/minecraft/network/protocol/game/ClientboundEntityPositionSyncPacket.java b/net/minecraft/network/protocol/game/ClientboundEntityPositionSyncPacket.java new file mode 100644 index 00000000..25db72f5 --- /dev/null +++ b/net/minecraft/network/protocol/game/ClientboundEntityPositionSyncPacket.java @@ -0,0 +1,36 @@ +package net.minecraft.network.protocol.game; + +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.network.protocol.Packet; +import net.minecraft.network.protocol.PacketType; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.PositionMoveRotation; + +public record ClientboundEntityPositionSyncPacket(int id, PositionMoveRotation values, boolean onGround) implements Packet { + public static final StreamCodec STREAM_CODEC = StreamCodec.composite( + ByteBufCodecs.VAR_INT, + ClientboundEntityPositionSyncPacket::id, + PositionMoveRotation.STREAM_CODEC, + ClientboundEntityPositionSyncPacket::values, + ByteBufCodecs.BOOL, + ClientboundEntityPositionSyncPacket::onGround, + ClientboundEntityPositionSyncPacket::new + ); + + public static ClientboundEntityPositionSyncPacket of(Entity entity) { + return new ClientboundEntityPositionSyncPacket( + entity.getId(), new PositionMoveRotation(entity.trackingPosition(), entity.getDeltaMovement(), entity.getYRot(), entity.getXRot()), entity.onGround() + ); + } + + @Override + public PacketType type() { + return GamePacketTypes.CLIENTBOUND_ENTITY_POSITION_SYNC; + } + + public void handle(ClientGamePacketListener clientGamePacketListener) { + clientGamePacketListener.handleEntityPositionSync(this); + } +} diff --git a/net/minecraft/network/protocol/game/ClientboundExplodePacket.java b/net/minecraft/network/protocol/game/ClientboundExplodePacket.java index 60bbd302..45397707 100644 --- a/net/minecraft/network/protocol/game/ClientboundExplodePacket.java +++ b/net/minecraft/network/protocol/game/ClientboundExplodePacket.java @@ -1,118 +1,30 @@ package net.minecraft.network.protocol.game; -import com.google.common.collect.Lists; -import java.util.List; -import net.minecraft.core.BlockPos; +import java.util.Optional; import net.minecraft.core.Holder; import net.minecraft.core.particles.ParticleOptions; import net.minecraft.core.particles.ParticleTypes; import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.codec.ByteBufCodecs; import net.minecraft.network.codec.StreamCodec; import net.minecraft.network.protocol.Packet; import net.minecraft.network.protocol.PacketType; import net.minecraft.sounds.SoundEvent; -import net.minecraft.util.Mth; -import net.minecraft.world.level.Explosion; import net.minecraft.world.phys.Vec3; -import org.jetbrains.annotations.Nullable; -public class ClientboundExplodePacket implements Packet { - public static final StreamCodec STREAM_CODEC = Packet.codec( - ClientboundExplodePacket::write, ClientboundExplodePacket::new +public record ClientboundExplodePacket(Vec3 center, Optional playerKnockback, ParticleOptions explosionParticle, Holder explosionSound) + implements Packet { + public static final StreamCodec STREAM_CODEC = StreamCodec.composite( + Vec3.STREAM_CODEC, + ClientboundExplodePacket::center, + Vec3.STREAM_CODEC.apply(ByteBufCodecs::optional), + ClientboundExplodePacket::playerKnockback, + ParticleTypes.STREAM_CODEC, + ClientboundExplodePacket::explosionParticle, + SoundEvent.STREAM_CODEC, + ClientboundExplodePacket::explosionSound, + ClientboundExplodePacket::new ); - private final double x; - private final double y; - private final double z; - private final float power; - private final List toBlow; - private final float knockbackX; - private final float knockbackY; - private final float knockbackZ; - private final ParticleOptions smallExplosionParticles; - private final ParticleOptions largeExplosionParticles; - private final Explosion.BlockInteraction blockInteraction; - private final Holder explosionSound; - - public ClientboundExplodePacket( - double x, - double y, - double z, - float power, - List toBlow, - @Nullable Vec3 knockback, - Explosion.BlockInteraction blockInteraction, - ParticleOptions smallExplosionParticles, - ParticleOptions largeExplosionParticles, - Holder explosionSound - ) { - this.x = x; - this.y = y; - this.z = z; - this.power = power; - this.toBlow = Lists.newArrayList(toBlow); - this.explosionSound = explosionSound; - if (knockback != null) { - this.knockbackX = (float)knockback.x; - this.knockbackY = (float)knockback.y; - this.knockbackZ = (float)knockback.z; - } else { - this.knockbackX = 0.0F; - this.knockbackY = 0.0F; - this.knockbackZ = 0.0F; - } - - this.blockInteraction = blockInteraction; - this.smallExplosionParticles = smallExplosionParticles; - this.largeExplosionParticles = largeExplosionParticles; - } - - private ClientboundExplodePacket(RegistryFriendlyByteBuf buffer) { - this.x = buffer.readDouble(); - this.y = buffer.readDouble(); - this.z = buffer.readDouble(); - this.power = buffer.readFloat(); - int i = Mth.floor(this.x); - int j = Mth.floor(this.y); - int k = Mth.floor(this.z); - this.toBlow = buffer.readList(friendlyByteBuf -> { - int l = friendlyByteBuf.readByte() + i; - int m = friendlyByteBuf.readByte() + j; - int n = friendlyByteBuf.readByte() + k; - return new BlockPos(l, m, n); - }); - this.knockbackX = buffer.readFloat(); - this.knockbackY = buffer.readFloat(); - this.knockbackZ = buffer.readFloat(); - this.blockInteraction = buffer.readEnum(Explosion.BlockInteraction.class); - this.smallExplosionParticles = ParticleTypes.STREAM_CODEC.decode(buffer); - this.largeExplosionParticles = ParticleTypes.STREAM_CODEC.decode(buffer); - this.explosionSound = SoundEvent.STREAM_CODEC.decode(buffer); - } - - private void write(RegistryFriendlyByteBuf buffer) { - buffer.writeDouble(this.x); - buffer.writeDouble(this.y); - buffer.writeDouble(this.z); - buffer.writeFloat(this.power); - int i = Mth.floor(this.x); - int j = Mth.floor(this.y); - int k = Mth.floor(this.z); - buffer.writeCollection(this.toBlow, (friendlyByteBuf, blockPos) -> { - int l = blockPos.getX() - i; - int m = blockPos.getY() - j; - int n = blockPos.getZ() - k; - friendlyByteBuf.writeByte(l); - friendlyByteBuf.writeByte(m); - friendlyByteBuf.writeByte(n); - }); - buffer.writeFloat(this.knockbackX); - buffer.writeFloat(this.knockbackY); - buffer.writeFloat(this.knockbackZ); - buffer.writeEnum(this.blockInteraction); - ParticleTypes.STREAM_CODEC.encode(buffer, this.smallExplosionParticles); - ParticleTypes.STREAM_CODEC.encode(buffer, this.largeExplosionParticles); - SoundEvent.STREAM_CODEC.encode(buffer, this.explosionSound); - } @Override public PacketType type() { @@ -125,52 +37,4 @@ public class ClientboundExplodePacket implements Packet getToBlow() { - return this.toBlow; - } - - public Explosion.BlockInteraction getBlockInteraction() { - return this.blockInteraction; - } - - public ParticleOptions getSmallExplosionParticles() { - return this.smallExplosionParticles; - } - - public ParticleOptions getLargeExplosionParticles() { - return this.largeExplosionParticles; - } - - public Holder getExplosionSound() { - return this.explosionSound; - } } diff --git a/net/minecraft/network/protocol/game/ClientboundHorseScreenOpenPacket.java b/net/minecraft/network/protocol/game/ClientboundHorseScreenOpenPacket.java index d492b235..2a9f3cf1 100644 --- a/net/minecraft/network/protocol/game/ClientboundHorseScreenOpenPacket.java +++ b/net/minecraft/network/protocol/game/ClientboundHorseScreenOpenPacket.java @@ -20,7 +20,7 @@ public class ClientboundHorseScreenOpenPacket implements Packet lerpSteps) implements Packet { + public static final StreamCodec STREAM_CODEC = StreamCodec.composite( + ByteBufCodecs.VAR_INT, + ClientboundMoveMinecartPacket::entityId, + NewMinecartBehavior.MinecartStep.STREAM_CODEC.apply(ByteBufCodecs.list()), + ClientboundMoveMinecartPacket::lerpSteps, + ClientboundMoveMinecartPacket::new + ); + + @Override + public PacketType type() { + return GamePacketTypes.CLIENTBOUND_MOVE_MINECART_ALONG_TRACK; + } + + public void handle(ClientGamePacketListener clientGamePacketListener) { + clientGamePacketListener.handleMinecartAlongTrack(this); + } + + @Nullable + public Entity getEntity(Level level) { + return level.getEntity(this.entityId); + } +} diff --git a/net/minecraft/network/protocol/game/ClientboundOpenScreenPacket.java b/net/minecraft/network/protocol/game/ClientboundOpenScreenPacket.java index 5e3feb01..02269b84 100644 --- a/net/minecraft/network/protocol/game/ClientboundOpenScreenPacket.java +++ b/net/minecraft/network/protocol/game/ClientboundOpenScreenPacket.java @@ -12,7 +12,7 @@ import net.minecraft.world.inventory.MenuType; public class ClientboundOpenScreenPacket implements Packet { public static final StreamCodec STREAM_CODEC = StreamCodec.composite( - ByteBufCodecs.VAR_INT, + ByteBufCodecs.CONTAINER_ID, ClientboundOpenScreenPacket::getContainerId, ByteBufCodecs.registry(Registries.MENU), ClientboundOpenScreenPacket::getType, diff --git a/net/minecraft/network/protocol/game/ClientboundPlaceGhostRecipePacket.java b/net/minecraft/network/protocol/game/ClientboundPlaceGhostRecipePacket.java index c0045b78..fd974753 100644 --- a/net/minecraft/network/protocol/game/ClientboundPlaceGhostRecipePacket.java +++ b/net/minecraft/network/protocol/game/ClientboundPlaceGhostRecipePacket.java @@ -1,36 +1,20 @@ package net.minecraft.network.protocol.game; -import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.codec.ByteBufCodecs; import net.minecraft.network.codec.StreamCodec; import net.minecraft.network.protocol.Packet; import net.minecraft.network.protocol.PacketType; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.item.crafting.RecipeHolder; +import net.minecraft.world.item.crafting.display.RecipeDisplay; -public class ClientboundPlaceGhostRecipePacket implements Packet { - public static final StreamCodec STREAM_CODEC = Packet.codec( - ClientboundPlaceGhostRecipePacket::write, ClientboundPlaceGhostRecipePacket::new +public record ClientboundPlaceGhostRecipePacket(int containerId, RecipeDisplay recipeDisplay) implements Packet { + public static final StreamCodec STREAM_CODEC = StreamCodec.composite( + ByteBufCodecs.CONTAINER_ID, + ClientboundPlaceGhostRecipePacket::containerId, + RecipeDisplay.STREAM_CODEC, + ClientboundPlaceGhostRecipePacket::recipeDisplay, + ClientboundPlaceGhostRecipePacket::new ); - private final int containerId; - private final ResourceLocation recipe; - - public ClientboundPlaceGhostRecipePacket(int containerId, RecipeHolder recipe) { - this.containerId = containerId; - this.recipe = recipe.id(); - } - - private ClientboundPlaceGhostRecipePacket(FriendlyByteBuf buffer) { - this.containerId = buffer.readByte(); - this.recipe = buffer.readResourceLocation(); - } - - /** - * Writes the raw packet data to the data stream. - */ - private void write(FriendlyByteBuf byteBuf) { - byteBuf.writeByte(this.containerId); - byteBuf.writeResourceLocation(this.recipe); - } @Override public PacketType type() { @@ -43,12 +27,4 @@ public class ClientboundPlaceGhostRecipePacket implements Packet entryBuilder.chatSession = registryFriendlyByteBuf.readNullable(RemoteChatSession.Data::read), - (registryFriendlyByteBuf, entry) -> registryFriendlyByteBuf.writeNullable(entry.chatSession, RemoteChatSession.Data::write) + (entryBuilder, registryFriendlyByteBuf) -> entryBuilder.chatSession = registryFriendlyByteBuf.readNullable(Data::read), + (registryFriendlyByteBuf, entry) -> registryFriendlyByteBuf.writeNullable(entry.chatSession, Data::write) ), UPDATE_GAME_MODE( (entryBuilder, registryFriendlyByteBuf) -> entryBuilder.gameMode = GameType.byId(registryFriendlyByteBuf.readVarInt()), @@ -133,23 +137,19 @@ public class ClientboundPlayerInfoUpdatePacket implements Packet FriendlyByteBuf.writeNullable(registryFriendlyByteBuf, entry.displayName(), ComponentSerialization.TRUSTED_STREAM_CODEC) + ), + UPDATE_LIST_ORDER( + (entryBuilder, registryFriendlyByteBuf) -> entryBuilder.listOrder = registryFriendlyByteBuf.readVarInt(), + (registryFriendlyByteBuf, entry) -> registryFriendlyByteBuf.writeVarInt(entry.listOrder) ); - final ClientboundPlayerInfoUpdatePacket.Action.Reader reader; - final ClientboundPlayerInfoUpdatePacket.Action.Writer writer; + final Reader reader; + final Writer writer; - private Action(final ClientboundPlayerInfoUpdatePacket.Action.Reader reader, final ClientboundPlayerInfoUpdatePacket.Action.Writer writer) { + private Action(final Reader reader, final Writer writer) { this.reader = reader; this.writer = writer; } - - public interface Reader { - void read(ClientboundPlayerInfoUpdatePacket.EntryBuilder entryBuilder, RegistryFriendlyByteBuf registryFriendlyByteBuf); - } - - public interface Writer { - void write(RegistryFriendlyByteBuf registryFriendlyByteBuf, ClientboundPlayerInfoUpdatePacket.Entry entry); - } } public record Entry( @@ -159,7 +159,8 @@ public class ClientboundPlayerInfoUpdatePacket implements Packet { - public static final StreamCodec STREAM_CODEC = Packet.codec( - ClientboundPlayerPositionPacket::write, ClientboundPlayerPositionPacket::new +public record ClientboundPlayerPositionPacket(int id, PositionMoveRotation change, Set relatives) implements Packet { + public static final StreamCodec STREAM_CODEC = StreamCodec.composite( + ByteBufCodecs.VAR_INT, + ClientboundPlayerPositionPacket::id, + PositionMoveRotation.STREAM_CODEC, + ClientboundPlayerPositionPacket::change, + Relative.SET_STREAM_CODEC, + ClientboundPlayerPositionPacket::relatives, + ClientboundPlayerPositionPacket::new ); - private final double x; - private final double y; - private final double z; - private final float yRot; - private final float xRot; - private final Set relativeArguments; - private final int id; - public ClientboundPlayerPositionPacket(double x, double y, double z, float yRot, float xRot, Set relativeArguments, int id) { - this.x = x; - this.y = y; - this.z = z; - this.yRot = yRot; - this.xRot = xRot; - this.relativeArguments = relativeArguments; - this.id = id; - } - - private ClientboundPlayerPositionPacket(FriendlyByteBuf buffer) { - this.x = buffer.readDouble(); - this.y = buffer.readDouble(); - this.z = buffer.readDouble(); - this.yRot = buffer.readFloat(); - this.xRot = buffer.readFloat(); - this.relativeArguments = RelativeMovement.unpack(buffer.readUnsignedByte()); - this.id = buffer.readVarInt(); - } - - /** - * Writes the raw packet data to the data stream. - */ - private void write(FriendlyByteBuf buffer) { - buffer.writeDouble(this.x); - buffer.writeDouble(this.y); - buffer.writeDouble(this.z); - buffer.writeFloat(this.yRot); - buffer.writeFloat(this.xRot); - buffer.writeByte(RelativeMovement.pack(this.relativeArguments)); - buffer.writeVarInt(this.id); + public static ClientboundPlayerPositionPacket of(int i, PositionMoveRotation positionMoveRotation, Set set) { + return new ClientboundPlayerPositionPacket(i, positionMoveRotation, set); } @Override @@ -63,35 +35,4 @@ public class ClientboundPlayerPositionPacket implements Packet getRelativeArguments() { - return this.relativeArguments; - } } diff --git a/net/minecraft/network/protocol/game/ClientboundPlayerRotationPacket.java b/net/minecraft/network/protocol/game/ClientboundPlayerRotationPacket.java new file mode 100644 index 00000000..d00046aa --- /dev/null +++ b/net/minecraft/network/protocol/game/ClientboundPlayerRotationPacket.java @@ -0,0 +1,22 @@ +package net.minecraft.network.protocol.game; + +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.network.protocol.Packet; +import net.minecraft.network.protocol.PacketType; + +public record ClientboundPlayerRotationPacket(float yRot, float xRot) implements Packet { + public static final StreamCodec STREAM_CODEC = StreamCodec.composite( + ByteBufCodecs.FLOAT, ClientboundPlayerRotationPacket::yRot, ByteBufCodecs.FLOAT, ClientboundPlayerRotationPacket::xRot, ClientboundPlayerRotationPacket::new + ); + + @Override + public PacketType type() { + return GamePacketTypes.CLIENTBOUND_PLAYER_ROTATION; + } + + public void handle(ClientGamePacketListener clientGamePacketListener) { + clientGamePacketListener.handleRotatePlayer(this); + } +} diff --git a/net/minecraft/network/protocol/game/ClientboundRecipeBookAddPacket.java b/net/minecraft/network/protocol/game/ClientboundRecipeBookAddPacket.java new file mode 100644 index 00000000..88e85609 --- /dev/null +++ b/net/minecraft/network/protocol/game/ClientboundRecipeBookAddPacket.java @@ -0,0 +1,52 @@ +package net.minecraft.network.protocol.game; + +import java.util.List; +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.network.protocol.Packet; +import net.minecraft.network.protocol.PacketType; +import net.minecraft.world.item.crafting.display.RecipeDisplayEntry; + +public record ClientboundRecipeBookAddPacket(List entries, boolean replace) implements Packet { + public static final StreamCodec STREAM_CODEC = StreamCodec.composite( + ClientboundRecipeBookAddPacket.Entry.STREAM_CODEC.apply(ByteBufCodecs.list()), + ClientboundRecipeBookAddPacket::entries, + ByteBufCodecs.BOOL, + ClientboundRecipeBookAddPacket::replace, + ClientboundRecipeBookAddPacket::new + ); + + @Override + public PacketType type() { + return GamePacketTypes.CLIENTBOUND_RECIPE_BOOK_ADD; + } + + public void handle(ClientGamePacketListener clientGamePacketListener) { + clientGamePacketListener.handleRecipeBookAdd(this); + } + + public record Entry(RecipeDisplayEntry contents, byte flags) { + public static final byte FLAG_NOTIFICATION = 1; + public static final byte FLAG_HIGHLIGHT = 2; + public static final StreamCodec STREAM_CODEC = StreamCodec.composite( + RecipeDisplayEntry.STREAM_CODEC, + ClientboundRecipeBookAddPacket.Entry::contents, + ByteBufCodecs.BYTE, + ClientboundRecipeBookAddPacket.Entry::flags, + ClientboundRecipeBookAddPacket.Entry::new + ); + + public Entry(RecipeDisplayEntry recipeDisplayEntry, boolean bl, boolean bl2) { + this(recipeDisplayEntry, (byte)((bl ? 1 : 0) | (bl2 ? 2 : 0))); + } + + public boolean notification() { + return (this.flags & 1) != 0; + } + + public boolean highlight() { + return (this.flags & 2) != 0; + } + } +} diff --git a/net/minecraft/network/protocol/game/ClientboundRecipeBookRemovePacket.java b/net/minecraft/network/protocol/game/ClientboundRecipeBookRemovePacket.java new file mode 100644 index 00000000..826ace15 --- /dev/null +++ b/net/minecraft/network/protocol/game/ClientboundRecipeBookRemovePacket.java @@ -0,0 +1,24 @@ +package net.minecraft.network.protocol.game; + +import io.netty.buffer.ByteBuf; +import java.util.List; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.network.protocol.Packet; +import net.minecraft.network.protocol.PacketType; +import net.minecraft.world.item.crafting.display.RecipeDisplayId; + +public record ClientboundRecipeBookRemovePacket(List recipes) implements Packet { + public static final StreamCodec STREAM_CODEC = StreamCodec.composite( + RecipeDisplayId.STREAM_CODEC.apply(ByteBufCodecs.list()), ClientboundRecipeBookRemovePacket::recipes, ClientboundRecipeBookRemovePacket::new + ); + + @Override + public PacketType type() { + return GamePacketTypes.CLIENTBOUND_RECIPE_BOOK_REMOVE; + } + + public void handle(ClientGamePacketListener clientGamePacketListener) { + clientGamePacketListener.handleRecipeBookRemove(this); + } +} diff --git a/net/minecraft/network/protocol/game/ClientboundRecipeBookSettingsPacket.java b/net/minecraft/network/protocol/game/ClientboundRecipeBookSettingsPacket.java new file mode 100644 index 00000000..1e0b97c1 --- /dev/null +++ b/net/minecraft/network/protocol/game/ClientboundRecipeBookSettingsPacket.java @@ -0,0 +1,22 @@ +package net.minecraft.network.protocol.game; + +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.network.protocol.Packet; +import net.minecraft.network.protocol.PacketType; +import net.minecraft.stats.RecipeBookSettings; + +public record ClientboundRecipeBookSettingsPacket(RecipeBookSettings bookSettings) implements Packet { + public static final StreamCodec STREAM_CODEC = StreamCodec.composite( + RecipeBookSettings.STREAM_CODEC, ClientboundRecipeBookSettingsPacket::bookSettings, ClientboundRecipeBookSettingsPacket::new + ); + + @Override + public PacketType type() { + return GamePacketTypes.CLIENTBOUND_RECIPE_BOOK_SETTINGS; + } + + public void handle(ClientGamePacketListener clientGamePacketListener) { + clientGamePacketListener.handleRecipeBookSettings(this); + } +} diff --git a/net/minecraft/network/protocol/game/ClientboundRecipePacket.java b/net/minecraft/network/protocol/game/ClientboundRecipePacket.java deleted file mode 100644 index 8322be19..00000000 --- a/net/minecraft/network/protocol/game/ClientboundRecipePacket.java +++ /dev/null @@ -1,87 +0,0 @@ -package net.minecraft.network.protocol.game; - -import com.google.common.collect.ImmutableList; -import java.util.Collection; -import java.util.List; -import net.minecraft.network.FriendlyByteBuf; -import net.minecraft.network.codec.StreamCodec; -import net.minecraft.network.protocol.Packet; -import net.minecraft.network.protocol.PacketType; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.stats.RecipeBookSettings; - -public class ClientboundRecipePacket implements Packet { - public static final StreamCodec STREAM_CODEC = Packet.codec( - ClientboundRecipePacket::write, ClientboundRecipePacket::new - ); - private final ClientboundRecipePacket.State state; - private final List recipes; - private final List toHighlight; - private final RecipeBookSettings bookSettings; - - public ClientboundRecipePacket( - ClientboundRecipePacket.State state, Collection recipes, Collection toHighlight, RecipeBookSettings bookSettings - ) { - this.state = state; - this.recipes = ImmutableList.copyOf(recipes); - this.toHighlight = ImmutableList.copyOf(toHighlight); - this.bookSettings = bookSettings; - } - - private ClientboundRecipePacket(FriendlyByteBuf buffer) { - this.state = buffer.readEnum(ClientboundRecipePacket.State.class); - this.bookSettings = RecipeBookSettings.read(buffer); - this.recipes = buffer.readList(FriendlyByteBuf::readResourceLocation); - if (this.state == ClientboundRecipePacket.State.INIT) { - this.toHighlight = buffer.readList(FriendlyByteBuf::readResourceLocation); - } else { - this.toHighlight = ImmutableList.of(); - } - } - - /** - * Writes the raw packet data to the data stream. - */ - private void write(FriendlyByteBuf buffer) { - buffer.writeEnum(this.state); - this.bookSettings.write(buffer); - buffer.writeCollection(this.recipes, FriendlyByteBuf::writeResourceLocation); - if (this.state == ClientboundRecipePacket.State.INIT) { - buffer.writeCollection(this.toHighlight, FriendlyByteBuf::writeResourceLocation); - } - } - - @Override - public PacketType type() { - return GamePacketTypes.CLIENTBOUND_RECIPE; - } - - /** - * Passes this Packet on to the NetHandler for processing. - */ - public void handle(ClientGamePacketListener handler) { - handler.handleAddOrRemoveRecipes(this); - } - - public List getRecipes() { - return this.recipes; - } - - public List getHighlights() { - return this.toHighlight; - } - - public RecipeBookSettings getBookSettings() { - return this.bookSettings; - } - - public ClientboundRecipePacket.State getState() { - return this.state; - } - - public static enum State { - INIT, - ADD, - REMOVE; - } -} diff --git a/net/minecraft/network/protocol/game/ClientboundRotateHeadPacket.java b/net/minecraft/network/protocol/game/ClientboundRotateHeadPacket.java index 3f3354a1..6adff7ea 100644 --- a/net/minecraft/network/protocol/game/ClientboundRotateHeadPacket.java +++ b/net/minecraft/network/protocol/game/ClientboundRotateHeadPacket.java @@ -4,6 +4,7 @@ import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.codec.StreamCodec; import net.minecraft.network.protocol.Packet; import net.minecraft.network.protocol.PacketType; +import net.minecraft.util.Mth; import net.minecraft.world.entity.Entity; import net.minecraft.world.level.Level; @@ -48,7 +49,7 @@ public class ClientboundRotateHeadPacket implements Packet { - public static final StreamCodec STREAM_CODEC = Packet.codec( - ClientboundSetCarriedItemPacket::write, ClientboundSetCarriedItemPacket::new - ); - private final int slot; - - public ClientboundSetCarriedItemPacket(int slot) { - this.slot = slot; - } - - private ClientboundSetCarriedItemPacket(FriendlyByteBuf buffer) { - this.slot = buffer.readByte(); - } - - /** - * Writes the raw packet data to the data stream. - */ - private void write(FriendlyByteBuf buffer) { - buffer.writeByte(this.slot); - } - - @Override - public PacketType type() { - return GamePacketTypes.CLIENTBOUND_SET_CARRIED_ITEM; - } - - /** - * Passes this Packet on to the NetHandler for processing. - */ - public void handle(ClientGamePacketListener handler) { - handler.handleSetCarriedItem(this); - } - - public int getSlot() { - return this.slot; - } -} diff --git a/net/minecraft/network/protocol/game/ClientboundSetCursorItemPacket.java b/net/minecraft/network/protocol/game/ClientboundSetCursorItemPacket.java new file mode 100644 index 00000000..29c34ba3 --- /dev/null +++ b/net/minecraft/network/protocol/game/ClientboundSetCursorItemPacket.java @@ -0,0 +1,22 @@ +package net.minecraft.network.protocol.game; + +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.network.protocol.Packet; +import net.minecraft.network.protocol.PacketType; +import net.minecraft.world.item.ItemStack; + +public record ClientboundSetCursorItemPacket(ItemStack contents) implements Packet { + public static final StreamCodec STREAM_CODEC = StreamCodec.composite( + ItemStack.OPTIONAL_STREAM_CODEC, ClientboundSetCursorItemPacket::contents, ClientboundSetCursorItemPacket::new + ); + + @Override + public PacketType type() { + return GamePacketTypes.CLIENTBOUND_SET_CURSOR_ITEM; + } + + public void handle(ClientGamePacketListener clientGamePacketListener) { + clientGamePacketListener.handleSetCursorItem(this); + } +} diff --git a/net/minecraft/network/protocol/game/ClientboundSetEquipmentPacket.java b/net/minecraft/network/protocol/game/ClientboundSetEquipmentPacket.java index e506e704..6ed807b4 100644 --- a/net/minecraft/network/protocol/game/ClientboundSetEquipmentPacket.java +++ b/net/minecraft/network/protocol/game/ClientboundSetEquipmentPacket.java @@ -25,13 +25,12 @@ public class ClientboundSetEquipmentPacket implements Packet>newArrayList(); int i; do { i = buffer.readByte(); - EquipmentSlot equipmentSlot = equipmentSlots[i & 127]; + EquipmentSlot equipmentSlot = (EquipmentSlot)EquipmentSlot.VALUES.get(i & 127); ItemStack itemStack = ItemStack.OPTIONAL_STREAM_CODEC.decode(buffer); this.slots.add(Pair.of(equipmentSlot, itemStack)); } while ((i & -128) != 0); diff --git a/net/minecraft/network/protocol/game/ClientboundSetHeldSlotPacket.java b/net/minecraft/network/protocol/game/ClientboundSetHeldSlotPacket.java new file mode 100644 index 00000000..f7ccaf9c --- /dev/null +++ b/net/minecraft/network/protocol/game/ClientboundSetHeldSlotPacket.java @@ -0,0 +1,38 @@ +package net.minecraft.network.protocol.game; + +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.network.protocol.Packet; +import net.minecraft.network.protocol.PacketType; + +public class ClientboundSetHeldSlotPacket implements Packet { + public static final StreamCodec STREAM_CODEC = Packet.codec( + ClientboundSetHeldSlotPacket::write, ClientboundSetHeldSlotPacket::new + ); + private final int slot; + + public ClientboundSetHeldSlotPacket(int i) { + this.slot = i; + } + + private ClientboundSetHeldSlotPacket(FriendlyByteBuf friendlyByteBuf) { + this.slot = friendlyByteBuf.readByte(); + } + + private void write(FriendlyByteBuf friendlyByteBuf) { + friendlyByteBuf.writeByte(this.slot); + } + + @Override + public PacketType type() { + return GamePacketTypes.CLIENTBOUND_SET_HELD_SLOT; + } + + public void handle(ClientGamePacketListener clientGamePacketListener) { + clientGamePacketListener.handleSetHeldSlot(this); + } + + public int getSlot() { + return this.slot; + } +} diff --git a/net/minecraft/network/protocol/game/ClientboundSetPlayerInventoryPacket.java b/net/minecraft/network/protocol/game/ClientboundSetPlayerInventoryPacket.java new file mode 100644 index 00000000..52ece2c3 --- /dev/null +++ b/net/minecraft/network/protocol/game/ClientboundSetPlayerInventoryPacket.java @@ -0,0 +1,27 @@ +package net.minecraft.network.protocol.game; + +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.network.protocol.Packet; +import net.minecraft.network.protocol.PacketType; +import net.minecraft.world.item.ItemStack; + +public record ClientboundSetPlayerInventoryPacket(int slot, ItemStack contents) implements Packet { + public static final StreamCodec STREAM_CODEC = StreamCodec.composite( + ByteBufCodecs.VAR_INT, + ClientboundSetPlayerInventoryPacket::slot, + ItemStack.OPTIONAL_STREAM_CODEC, + ClientboundSetPlayerInventoryPacket::contents, + ClientboundSetPlayerInventoryPacket::new + ); + + @Override + public PacketType type() { + return GamePacketTypes.CLIENTBOUND_SET_PLAYER_INVENTORY; + } + + public void handle(ClientGamePacketListener clientGamePacketListener) { + clientGamePacketListener.handleSetPlayerInventory(this); + } +} diff --git a/net/minecraft/network/protocol/game/ClientboundSetTimePacket.java b/net/minecraft/network/protocol/game/ClientboundSetTimePacket.java index d1262343..e69db991 100644 --- a/net/minecraft/network/protocol/game/ClientboundSetTimePacket.java +++ b/net/minecraft/network/protocol/game/ClientboundSetTimePacket.java @@ -1,42 +1,21 @@ package net.minecraft.network.protocol.game; import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.codec.ByteBufCodecs; import net.minecraft.network.codec.StreamCodec; import net.minecraft.network.protocol.Packet; import net.minecraft.network.protocol.PacketType; -public class ClientboundSetTimePacket implements Packet { - public static final StreamCodec STREAM_CODEC = Packet.codec( - ClientboundSetTimePacket::write, ClientboundSetTimePacket::new +public record ClientboundSetTimePacket(long gameTime, long dayTime, boolean tickDayTime) implements Packet { + public static final StreamCodec STREAM_CODEC = StreamCodec.composite( + ByteBufCodecs.LONG, + ClientboundSetTimePacket::gameTime, + ByteBufCodecs.LONG, + ClientboundSetTimePacket::dayTime, + ByteBufCodecs.BOOL, + ClientboundSetTimePacket::tickDayTime, + ClientboundSetTimePacket::new ); - private final long gameTime; - private final long dayTime; - - public ClientboundSetTimePacket(long gameTime, long dayTime, boolean daylightCycleEnabled) { - this.gameTime = gameTime; - long l = dayTime; - if (!daylightCycleEnabled) { - l = -dayTime; - if (l == 0L) { - l = -1L; - } - } - - this.dayTime = l; - } - - private ClientboundSetTimePacket(FriendlyByteBuf buffer) { - this.gameTime = buffer.readLong(); - this.dayTime = buffer.readLong(); - } - - /** - * Writes the raw packet data to the data stream. - */ - private void write(FriendlyByteBuf buffer) { - buffer.writeLong(this.gameTime); - buffer.writeLong(this.dayTime); - } @Override public PacketType type() { @@ -49,12 +28,4 @@ public class ClientboundSetTimePacket implements Packet { - public static final StreamCodec STREAM_CODEC = Packet.codec( - ClientboundTeleportEntityPacket::write, ClientboundTeleportEntityPacket::new +public record ClientboundTeleportEntityPacket(int id, PositionMoveRotation change, Set relatives, boolean onGround) + implements Packet { + public static final StreamCodec STREAM_CODEC = StreamCodec.composite( + ByteBufCodecs.VAR_INT, + ClientboundTeleportEntityPacket::id, + PositionMoveRotation.STREAM_CODEC, + ClientboundTeleportEntityPacket::change, + Relative.SET_STREAM_CODEC, + ClientboundTeleportEntityPacket::relatives, + ByteBufCodecs.BOOL, + ClientboundTeleportEntityPacket::onGround, + ClientboundTeleportEntityPacket::new ); - private final int id; - private final double x; - private final double y; - private final double z; - private final byte yRot; - private final byte xRot; - private final boolean onGround; - public ClientboundTeleportEntityPacket(Entity entity) { - this.id = entity.getId(); - Vec3 vec3 = entity.trackingPosition(); - this.x = vec3.x; - this.y = vec3.y; - this.z = vec3.z; - this.yRot = (byte)(entity.getYRot() * 256.0F / 360.0F); - this.xRot = (byte)(entity.getXRot() * 256.0F / 360.0F); - this.onGround = entity.onGround(); - } - - private ClientboundTeleportEntityPacket(FriendlyByteBuf buffer) { - this.id = buffer.readVarInt(); - this.x = buffer.readDouble(); - this.y = buffer.readDouble(); - this.z = buffer.readDouble(); - this.yRot = buffer.readByte(); - this.xRot = buffer.readByte(); - this.onGround = buffer.readBoolean(); - } - - /** - * Writes the raw packet data to the data stream. - */ - private void write(FriendlyByteBuf buffer) { - buffer.writeVarInt(this.id); - buffer.writeDouble(this.x); - buffer.writeDouble(this.y); - buffer.writeDouble(this.z); - buffer.writeByte(this.yRot); - buffer.writeByte(this.xRot); - buffer.writeBoolean(this.onGround); + public static ClientboundTeleportEntityPacket teleport(int i, PositionMoveRotation positionMoveRotation, Set set, boolean bl) { + return new ClientboundTeleportEntityPacket(i, positionMoveRotation, set, bl); } @Override @@ -64,32 +38,4 @@ public class ClientboundTeleportEntityPacket implements Packet { +public record ClientboundUpdateRecipesPacket( + Map, RecipePropertySet> itemSets, SelectableRecipe.SingleInputSet stonecutterRecipes +) implements Packet { public static final StreamCodec STREAM_CODEC = StreamCodec.composite( - RecipeHolder.STREAM_CODEC.apply(ByteBufCodecs.list()), - clientboundUpdateRecipesPacket -> clientboundUpdateRecipesPacket.recipes, + ByteBufCodecs.map(HashMap::new, ResourceKey.streamCodec(RecipePropertySet.TYPE_KEY), RecipePropertySet.STREAM_CODEC), + ClientboundUpdateRecipesPacket::itemSets, + SelectableRecipe.SingleInputSet.noRecipeCodec(), + ClientboundUpdateRecipesPacket::stonecutterRecipes, ClientboundUpdateRecipesPacket::new ); - private final List> recipes; - - public ClientboundUpdateRecipesPacket(Collection> recipes) { - this.recipes = List.copyOf(recipes); - } @Override public PacketType type() { @@ -32,8 +34,4 @@ public class ClientboundUpdateRecipesPacket implements Packet> getRecipes() { - return this.recipes; - } } diff --git a/net/minecraft/network/protocol/game/CommonPlayerSpawnInfo.java b/net/minecraft/network/protocol/game/CommonPlayerSpawnInfo.java index 27c38498..8f86aa9c 100644 --- a/net/minecraft/network/protocol/game/CommonPlayerSpawnInfo.java +++ b/net/minecraft/network/protocol/game/CommonPlayerSpawnInfo.java @@ -21,7 +21,8 @@ public record CommonPlayerSpawnInfo( boolean isDebug, boolean isFlat, Optional lastDeathLocation, - int portalCooldown + int portalCooldown, + int seaLevel ) { public CommonPlayerSpawnInfo(RegistryFriendlyByteBuf buffer) { this( @@ -33,6 +34,7 @@ public record CommonPlayerSpawnInfo( buffer.readBoolean(), buffer.readBoolean(), buffer.readOptional(FriendlyByteBuf::readGlobalPos), + buffer.readVarInt(), buffer.readVarInt() ); } @@ -47,5 +49,6 @@ public record CommonPlayerSpawnInfo( buffer.writeBoolean(this.isFlat); buffer.writeOptional(this.lastDeathLocation, FriendlyByteBuf::writeGlobalPos); buffer.writeVarInt(this.portalCooldown); + buffer.writeVarInt(this.seaLevel); } } diff --git a/net/minecraft/network/protocol/game/DebugPackets.java b/net/minecraft/network/protocol/game/DebugPackets.java index 69bd7ece..4bbcee59 100644 --- a/net/minecraft/network/protocol/game/DebugPackets.java +++ b/net/minecraft/network/protocol/game/DebugPackets.java @@ -17,6 +17,7 @@ import net.minecraft.network.protocol.common.ClientboundCustomPayloadPacket; import net.minecraft.network.protocol.common.custom.CustomPacketPayload; import net.minecraft.network.protocol.common.custom.GameTestAddMarkerDebugPayload; import net.minecraft.network.protocol.common.custom.GameTestClearMarkersDebugPayload; +import net.minecraft.network.protocol.common.custom.RedstoneWireOrientationsDebugPayload; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.Nameable; @@ -81,6 +82,12 @@ public class DebugPackets { public static void sendNeighborsUpdatePacket(Level level, BlockPos pos) { } + public static void sendWireUpdates(Level level, RedstoneWireOrientationsDebugPayload redstoneWireOrientationsDebugPayload) { + if (level instanceof ServerLevel serverLevel) { + sendPacketToAllPlayers(serverLevel, redstoneWireOrientationsDebugPayload); + } + } + public static void sendStructurePacket(WorldGenLevel level, StructureStart structureStart) { } diff --git a/net/minecraft/network/protocol/game/GamePacketTypes.java b/net/minecraft/network/protocol/game/GamePacketTypes.java index 1a77583c..9a42fa5c 100644 --- a/net/minecraft/network/protocol/game/GamePacketTypes.java +++ b/net/minecraft/network/protocol/game/GamePacketTypes.java @@ -51,6 +51,7 @@ public class GamePacketTypes { public static final PacketType CLIENTBOUND_MERCHANT_OFFERS = createClientbound("merchant_offers"); public static final PacketType CLIENTBOUND_MOVE_ENTITY_POS = createClientbound("move_entity_pos"); public static final PacketType CLIENTBOUND_MOVE_ENTITY_POS_ROT = createClientbound("move_entity_pos_rot"); + public static final PacketType CLIENTBOUND_MOVE_MINECART_ALONG_TRACK = createClientbound("move_minecart_along_track"); public static final PacketType CLIENTBOUND_MOVE_ENTITY_ROT = createClientbound("move_entity_rot"); public static final PacketType CLIENTBOUND_MOVE_VEHICLE = createClientbound("move_vehicle"); public static final PacketType CLIENTBOUND_OPEN_BOOK = createClientbound("open_book"); @@ -66,7 +67,10 @@ public class GamePacketTypes { public static final PacketType CLIENTBOUND_PLAYER_INFO_UPDATE = createClientbound("player_info_update"); public static final PacketType CLIENTBOUND_PLAYER_LOOK_AT = createClientbound("player_look_at"); public static final PacketType CLIENTBOUND_PLAYER_POSITION = createClientbound("player_position"); - public static final PacketType CLIENTBOUND_RECIPE = createClientbound("recipe"); + public static final PacketType CLIENTBOUND_PLAYER_ROTATION = createClientbound("player_rotation"); + public static final PacketType CLIENTBOUND_RECIPE_BOOK_ADD = createClientbound("recipe_book_add"); + public static final PacketType CLIENTBOUND_RECIPE_BOOK_REMOVE = createClientbound("recipe_book_remove"); + public static final PacketType CLIENTBOUND_RECIPE_BOOK_SETTINGS = createClientbound("recipe_book_settings"); public static final PacketType CLIENTBOUND_REMOVE_ENTITIES = createClientbound("remove_entities"); public static final PacketType CLIENTBOUND_REMOVE_MOB_EFFECT = createClientbound("remove_mob_effect"); public static final PacketType CLIENTBOUND_RESPAWN = createClientbound("respawn"); @@ -83,7 +87,6 @@ public class GamePacketTypes { "set_border_warning_distance" ); public static final PacketType CLIENTBOUND_SET_CAMERA = createClientbound("set_camera"); - public static final PacketType CLIENTBOUND_SET_CARRIED_ITEM = createClientbound("set_carried_item"); public static final PacketType CLIENTBOUND_SET_CHUNK_CACHE_CENTER = createClientbound("set_chunk_cache_center"); public static final PacketType CLIENTBOUND_SET_CHUNK_CACHE_RADIUS = createClientbound("set_chunk_cache_radius"); public static final PacketType CLIENTBOUND_SET_DEFAULT_SPAWN_POSITION = createClientbound( @@ -96,6 +99,7 @@ public class GamePacketTypes { public static final PacketType CLIENTBOUND_SET_EQUIPMENT = createClientbound("set_equipment"); public static final PacketType CLIENTBOUND_SET_EXPERIENCE = createClientbound("set_experience"); public static final PacketType CLIENTBOUND_SET_HEALTH = createClientbound("set_health"); + public static final PacketType CLIENTBOUND_SET_HELD_SLOT = createClientbound("set_held_slot"); public static final PacketType CLIENTBOUND_SET_OBJECTIVE = createClientbound("set_objective"); public static final PacketType CLIENTBOUND_SET_PASSENGERS = createClientbound("set_passengers"); public static final PacketType CLIENTBOUND_SET_PLAYER_TEAM = createClientbound("set_player_team"); @@ -114,6 +118,7 @@ public class GamePacketTypes { public static final PacketType CLIENTBOUND_TAG_QUERY = createClientbound("tag_query"); public static final PacketType CLIENTBOUND_TAKE_ITEM_ENTITY = createClientbound("take_item_entity"); public static final PacketType CLIENTBOUND_TELEPORT_ENTITY = createClientbound("teleport_entity"); + public static final PacketType CLIENTBOUND_ENTITY_POSITION_SYNC = createClientbound("entity_position_sync"); public static final PacketType CLIENTBOUND_UPDATE_ADVANCEMENTS = createClientbound("update_advancements"); public static final PacketType CLIENTBOUND_UPDATE_ATTRIBUTES = createClientbound("update_attributes"); public static final PacketType CLIENTBOUND_UPDATE_MOB_EFFECT = createClientbound("update_mob_effect"); @@ -121,6 +126,7 @@ public class GamePacketTypes { public static final PacketType CLIENTBOUND_PROJECTILE_POWER = createClientbound("projectile_power"); public static final PacketType SERVERBOUND_ACCEPT_TELEPORTATION = createServerbound("accept_teleportation"); public static final PacketType SERVERBOUND_BLOCK_ENTITY_TAG_QUERY = createServerbound("block_entity_tag_query"); + public static final PacketType SERVERBOUND_BUNDLE_ITEM_SELECTED = createServerbound("bundle_item_selected"); public static final PacketType SERVERBOUND_CHANGE_DIFFICULTY = createServerbound("change_difficulty"); public static final PacketType SERVERBOUND_CHAT_ACK = createServerbound("chat_ack"); public static final PacketType SERVERBOUND_CHAT_COMMAND = createServerbound("chat_command"); @@ -129,6 +135,7 @@ public class GamePacketTypes { public static final PacketType SERVERBOUND_CHAT_SESSION_UPDATE = createServerbound("chat_session_update"); public static final PacketType SERVERBOUND_CHUNK_BATCH_RECEIVED = createServerbound("chunk_batch_received"); public static final PacketType SERVERBOUND_CLIENT_COMMAND = createServerbound("client_command"); + public static final PacketType SERVERBOUND_CLIENT_TICK_END = createServerbound("client_tick_end"); public static final PacketType SERVERBOUND_COMMAND_SUGGESTION = createServerbound("command_suggestion"); public static final PacketType SERVERBOUND_CONFIGURATION_ACKNOWLEDGED = createServerbound( "configuration_acknowledged" @@ -179,6 +186,8 @@ public class GamePacketTypes { public static final PacketType CLIENTBOUND_RESET_SCORE = createClientbound("reset_score"); public static final PacketType CLIENTBOUND_TICKING_STATE = createClientbound("ticking_state"); public static final PacketType CLIENTBOUND_TICKING_STEP = createClientbound("ticking_step"); + public static final PacketType CLIENTBOUND_SET_CURSOR_ITEM = createClientbound("set_cursor_item"); + public static final PacketType CLIENTBOUND_SET_PLAYER_INVENTORY = createClientbound("set_player_inventory"); private static > PacketType createClientbound(String id) { return new PacketType<>(PacketFlow.CLIENTBOUND, ResourceLocation.withDefaultNamespace(id)); diff --git a/net/minecraft/network/protocol/game/GameProtocols.java b/net/minecraft/network/protocol/game/GameProtocols.java index 509e8146..4c51596f 100644 --- a/net/minecraft/network/protocol/game/GameProtocols.java +++ b/net/minecraft/network/protocol/game/GameProtocols.java @@ -1,8 +1,8 @@ package net.minecraft.network.protocol.game; import net.minecraft.network.ConnectionProtocol; -import net.minecraft.network.ProtocolInfo; import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.ProtocolInfo.Unbound; import net.minecraft.network.protocol.ProtocolInfoBuilder; import net.minecraft.network.protocol.common.ClientboundCustomPayloadPacket; import net.minecraft.network.protocol.common.ClientboundCustomReportDetailsPacket; @@ -29,10 +29,11 @@ import net.minecraft.network.protocol.ping.PingPacketTypes; import net.minecraft.network.protocol.ping.ServerboundPingRequestPacket; public class GameProtocols { - public static final ProtocolInfo.Unbound SERVERBOUND_TEMPLATE = ProtocolInfoBuilder.serverboundProtocol( + public static final Unbound SERVERBOUND_TEMPLATE = ProtocolInfoBuilder.serverboundProtocol( ConnectionProtocol.PLAY, protocolInfoBuilder -> protocolInfoBuilder.addPacket(GamePacketTypes.SERVERBOUND_ACCEPT_TELEPORTATION, ServerboundAcceptTeleportationPacket.STREAM_CODEC) .addPacket(GamePacketTypes.SERVERBOUND_BLOCK_ENTITY_TAG_QUERY, ServerboundBlockEntityTagQueryPacket.STREAM_CODEC) + .addPacket(GamePacketTypes.SERVERBOUND_BUNDLE_ITEM_SELECTED, ServerboundSelectBundleItemPacket.STREAM_CODEC) .addPacket(GamePacketTypes.SERVERBOUND_CHANGE_DIFFICULTY, ServerboundChangeDifficultyPacket.STREAM_CODEC) .addPacket(GamePacketTypes.SERVERBOUND_CHAT_ACK, ServerboundChatAckPacket.STREAM_CODEC) .addPacket(GamePacketTypes.SERVERBOUND_CHAT_COMMAND, ServerboundChatCommandPacket.STREAM_CODEC) @@ -41,6 +42,7 @@ public class GameProtocols { .addPacket(GamePacketTypes.SERVERBOUND_CHAT_SESSION_UPDATE, ServerboundChatSessionUpdatePacket.STREAM_CODEC) .addPacket(GamePacketTypes.SERVERBOUND_CHUNK_BATCH_RECEIVED, ServerboundChunkBatchReceivedPacket.STREAM_CODEC) .addPacket(GamePacketTypes.SERVERBOUND_CLIENT_COMMAND, ServerboundClientCommandPacket.STREAM_CODEC) + .addPacket(GamePacketTypes.SERVERBOUND_CLIENT_TICK_END, ServerboundClientTickEndPacket.STREAM_CODEC) .addPacket(CommonPacketTypes.SERVERBOUND_CLIENT_INFORMATION, ServerboundClientInformationPacket.STREAM_CODEC) .addPacket(GamePacketTypes.SERVERBOUND_COMMAND_SUGGESTION, ServerboundCommandSuggestionPacket.STREAM_CODEC) .addPacket(GamePacketTypes.SERVERBOUND_CONFIGURATION_ACKNOWLEDGED, ServerboundConfigurationAcknowledgedPacket.STREAM_CODEC) @@ -90,7 +92,7 @@ public class GameProtocols { .addPacket(GamePacketTypes.SERVERBOUND_USE_ITEM_ON, ServerboundUseItemOnPacket.STREAM_CODEC) .addPacket(GamePacketTypes.SERVERBOUND_USE_ITEM, ServerboundUseItemPacket.STREAM_CODEC) ); - public static final ProtocolInfo.Unbound CLIENTBOUND_TEMPLATE = ProtocolInfoBuilder.clientboundProtocol( + public static final Unbound CLIENTBOUND_TEMPLATE = ProtocolInfoBuilder.clientboundProtocol( ConnectionProtocol.PLAY, protocolInfoBuilder -> protocolInfoBuilder.withBundlePacket( GamePacketTypes.CLIENTBOUND_BUNDLE, ClientboundBundlePacket::new, new ClientboundBundleDelimiterPacket() @@ -126,6 +128,7 @@ public class GameProtocols { .addPacket(CommonPacketTypes.CLIENTBOUND_DISCONNECT, ClientboundDisconnectPacket.STREAM_CODEC) .addPacket(GamePacketTypes.CLIENTBOUND_DISGUISED_CHAT, ClientboundDisguisedChatPacket.STREAM_CODEC) .addPacket(GamePacketTypes.CLIENTBOUND_ENTITY_EVENT, ClientboundEntityEventPacket.STREAM_CODEC) + .addPacket(GamePacketTypes.CLIENTBOUND_ENTITY_POSITION_SYNC, ClientboundEntityPositionSyncPacket.STREAM_CODEC) .addPacket(GamePacketTypes.CLIENTBOUND_EXPLODE, ClientboundExplodePacket.STREAM_CODEC) .addPacket(GamePacketTypes.CLIENTBOUND_FORGET_LEVEL_CHUNK, ClientboundForgetLevelChunkPacket.STREAM_CODEC) .addPacket(GamePacketTypes.CLIENTBOUND_GAME_EVENT, ClientboundGameEventPacket.STREAM_CODEC) @@ -142,6 +145,7 @@ public class GameProtocols { .addPacket(GamePacketTypes.CLIENTBOUND_MERCHANT_OFFERS, ClientboundMerchantOffersPacket.STREAM_CODEC) .addPacket(GamePacketTypes.CLIENTBOUND_MOVE_ENTITY_POS, ClientboundMoveEntityPacket.Pos.STREAM_CODEC) .addPacket(GamePacketTypes.CLIENTBOUND_MOVE_ENTITY_POS_ROT, ClientboundMoveEntityPacket.PosRot.STREAM_CODEC) + .addPacket(GamePacketTypes.CLIENTBOUND_MOVE_MINECART_ALONG_TRACK, ClientboundMoveMinecartPacket.STREAM_CODEC) .addPacket(GamePacketTypes.CLIENTBOUND_MOVE_ENTITY_ROT, ClientboundMoveEntityPacket.Rot.STREAM_CODEC) .addPacket(GamePacketTypes.CLIENTBOUND_MOVE_VEHICLE, ClientboundMoveVehiclePacket.STREAM_CODEC) .addPacket(GamePacketTypes.CLIENTBOUND_OPEN_BOOK, ClientboundOpenBookPacket.STREAM_CODEC) @@ -159,7 +163,10 @@ public class GameProtocols { .addPacket(GamePacketTypes.CLIENTBOUND_PLAYER_INFO_UPDATE, ClientboundPlayerInfoUpdatePacket.STREAM_CODEC) .addPacket(GamePacketTypes.CLIENTBOUND_PLAYER_LOOK_AT, ClientboundPlayerLookAtPacket.STREAM_CODEC) .addPacket(GamePacketTypes.CLIENTBOUND_PLAYER_POSITION, ClientboundPlayerPositionPacket.STREAM_CODEC) - .addPacket(GamePacketTypes.CLIENTBOUND_RECIPE, ClientboundRecipePacket.STREAM_CODEC) + .addPacket(GamePacketTypes.CLIENTBOUND_PLAYER_ROTATION, ClientboundPlayerRotationPacket.STREAM_CODEC) + .addPacket(GamePacketTypes.CLIENTBOUND_RECIPE_BOOK_ADD, ClientboundRecipeBookAddPacket.STREAM_CODEC) + .addPacket(GamePacketTypes.CLIENTBOUND_RECIPE_BOOK_REMOVE, ClientboundRecipeBookRemovePacket.STREAM_CODEC) + .addPacket(GamePacketTypes.CLIENTBOUND_RECIPE_BOOK_SETTINGS, ClientboundRecipeBookSettingsPacket.STREAM_CODEC) .addPacket(GamePacketTypes.CLIENTBOUND_REMOVE_ENTITIES, ClientboundRemoveEntitiesPacket.STREAM_CODEC) .addPacket(GamePacketTypes.CLIENTBOUND_REMOVE_MOB_EFFECT, ClientboundRemoveMobEffectPacket.STREAM_CODEC) .addPacket(GamePacketTypes.CLIENTBOUND_RESET_SCORE, ClientboundResetScorePacket.STREAM_CODEC) @@ -177,9 +184,9 @@ public class GameProtocols { .addPacket(GamePacketTypes.CLIENTBOUND_SET_BORDER_WARNING_DELAY, ClientboundSetBorderWarningDelayPacket.STREAM_CODEC) .addPacket(GamePacketTypes.CLIENTBOUND_SET_BORDER_WARNING_DISTANCE, ClientboundSetBorderWarningDistancePacket.STREAM_CODEC) .addPacket(GamePacketTypes.CLIENTBOUND_SET_CAMERA, ClientboundSetCameraPacket.STREAM_CODEC) - .addPacket(GamePacketTypes.CLIENTBOUND_SET_CARRIED_ITEM, ClientboundSetCarriedItemPacket.STREAM_CODEC) .addPacket(GamePacketTypes.CLIENTBOUND_SET_CHUNK_CACHE_CENTER, ClientboundSetChunkCacheCenterPacket.STREAM_CODEC) .addPacket(GamePacketTypes.CLIENTBOUND_SET_CHUNK_CACHE_RADIUS, ClientboundSetChunkCacheRadiusPacket.STREAM_CODEC) + .addPacket(GamePacketTypes.CLIENTBOUND_SET_CURSOR_ITEM, ClientboundSetCursorItemPacket.STREAM_CODEC) .addPacket(GamePacketTypes.CLIENTBOUND_SET_DEFAULT_SPAWN_POSITION, ClientboundSetDefaultSpawnPositionPacket.STREAM_CODEC) .addPacket(GamePacketTypes.CLIENTBOUND_SET_DISPLAY_OBJECTIVE, ClientboundSetDisplayObjectivePacket.STREAM_CODEC) .addPacket(GamePacketTypes.CLIENTBOUND_SET_ENTITY_DATA, ClientboundSetEntityDataPacket.STREAM_CODEC) @@ -188,8 +195,10 @@ public class GameProtocols { .addPacket(GamePacketTypes.CLIENTBOUND_SET_EQUIPMENT, ClientboundSetEquipmentPacket.STREAM_CODEC) .addPacket(GamePacketTypes.CLIENTBOUND_SET_EXPERIENCE, ClientboundSetExperiencePacket.STREAM_CODEC) .addPacket(GamePacketTypes.CLIENTBOUND_SET_HEALTH, ClientboundSetHealthPacket.STREAM_CODEC) + .addPacket(GamePacketTypes.CLIENTBOUND_SET_HELD_SLOT, ClientboundSetHeldSlotPacket.STREAM_CODEC) .addPacket(GamePacketTypes.CLIENTBOUND_SET_OBJECTIVE, ClientboundSetObjectivePacket.STREAM_CODEC) .addPacket(GamePacketTypes.CLIENTBOUND_SET_PASSENGERS, ClientboundSetPassengersPacket.STREAM_CODEC) + .addPacket(GamePacketTypes.CLIENTBOUND_SET_PLAYER_INVENTORY, ClientboundSetPlayerInventoryPacket.STREAM_CODEC) .addPacket(GamePacketTypes.CLIENTBOUND_SET_PLAYER_TEAM, ClientboundSetPlayerTeamPacket.STREAM_CODEC) .addPacket(GamePacketTypes.CLIENTBOUND_SET_SCORE, ClientboundSetScorePacket.STREAM_CODEC) .addPacket(GamePacketTypes.CLIENTBOUND_SET_SIMULATION_DISTANCE, ClientboundSetSimulationDistancePacket.STREAM_CODEC) diff --git a/net/minecraft/network/protocol/game/ServerGamePacketListener.java b/net/minecraft/network/protocol/game/ServerGamePacketListener.java index 552e1699..e7889e21 100644 --- a/net/minecraft/network/protocol/game/ServerGamePacketListener.java +++ b/net/minecraft/network/protocol/game/ServerGamePacketListener.java @@ -7,7 +7,7 @@ import net.minecraft.network.protocol.ping.ServerPingPacketListener; /** * PacketListener for the server side of the PLAY protocol. */ -public interface ServerGamePacketListener extends ServerPingPacketListener, ServerCommonPacketListener { +public interface ServerGamePacketListener extends ServerCommonPacketListener, ServerPingPacketListener { @Override default ConnectionProtocol protocol() { return ConnectionProtocol.PLAY; @@ -107,6 +107,8 @@ public interface ServerGamePacketListener extends ServerPingPacketListener, Serv void handleRecipeBookSeenRecipePacket(ServerboundRecipeBookSeenRecipePacket packet); + void handleBundleItemSelectedPacket(ServerboundSelectBundleItemPacket serverboundSelectBundleItemPacket); + void handleRecipeBookChangeSettingsPacket(ServerboundRecipeBookChangeSettingsPacket packet); void handleSeenAdvancements(ServerboundSeenAdvancementsPacket packet); @@ -153,4 +155,6 @@ public interface ServerGamePacketListener extends ServerPingPacketListener, Serv void handleChunkBatchReceived(ServerboundChunkBatchReceivedPacket packet); void handleDebugSampleSubscription(ServerboundDebugSampleSubscriptionPacket packet); + + void handleClientTickEnd(ServerboundClientTickEndPacket serverboundClientTickEndPacket); } diff --git a/net/minecraft/network/protocol/game/ServerboundClientTickEndPacket.java b/net/minecraft/network/protocol/game/ServerboundClientTickEndPacket.java new file mode 100644 index 00000000..f5055179 --- /dev/null +++ b/net/minecraft/network/protocol/game/ServerboundClientTickEndPacket.java @@ -0,0 +1,20 @@ +package net.minecraft.network.protocol.game; + +import io.netty.buffer.ByteBuf; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.network.protocol.Packet; +import net.minecraft.network.protocol.PacketType; + +public record ServerboundClientTickEndPacket() implements Packet { + public static final ServerboundClientTickEndPacket INSTANCE = new ServerboundClientTickEndPacket(); + public static final StreamCodec STREAM_CODEC = StreamCodec.unit(INSTANCE); + + @Override + public PacketType type() { + return GamePacketTypes.SERVERBOUND_CLIENT_TICK_END; + } + + public void handle(ServerGamePacketListener serverGamePacketListener) { + serverGamePacketListener.handleClientTickEnd(this); + } +} diff --git a/net/minecraft/network/protocol/game/ServerboundContainerButtonClickPacket.java b/net/minecraft/network/protocol/game/ServerboundContainerButtonClickPacket.java index 7d1a5e81..cfefcc06 100644 --- a/net/minecraft/network/protocol/game/ServerboundContainerButtonClickPacket.java +++ b/net/minecraft/network/protocol/game/ServerboundContainerButtonClickPacket.java @@ -8,7 +8,7 @@ import net.minecraft.network.protocol.PacketType; public record ServerboundContainerButtonClickPacket(int containerId, int buttonId) implements Packet { public static final StreamCodec STREAM_CODEC = StreamCodec.composite( - ByteBufCodecs.VAR_INT, + ByteBufCodecs.CONTAINER_ID, ServerboundContainerButtonClickPacket::containerId, ByteBufCodecs.VAR_INT, ServerboundContainerButtonClickPacket::buttonId, diff --git a/net/minecraft/network/protocol/game/ServerboundContainerClickPacket.java b/net/minecraft/network/protocol/game/ServerboundContainerClickPacket.java index d1f09ff6..8a53301f 100644 --- a/net/minecraft/network/protocol/game/ServerboundContainerClickPacket.java +++ b/net/minecraft/network/protocol/game/ServerboundContainerClickPacket.java @@ -52,7 +52,7 @@ public class ServerboundContainerClickPacket implements Packet pages, Optional title) implements Packet { - public static final int MAX_BYTES_PER_CHAR = 4; - private static final int TITLE_MAX_CHARS = 128; - private static final int PAGE_MAX_CHARS = 8192; - private static final int MAX_PAGES_COUNT = 200; public static final StreamCodec STREAM_CODEC = StreamCodec.composite( ByteBufCodecs.VAR_INT, ServerboundEditBookPacket::slot, - ByteBufCodecs.stringUtf8(8192).apply(ByteBufCodecs.list(200)), + ByteBufCodecs.stringUtf8(1024).apply(ByteBufCodecs.list(100)), ServerboundEditBookPacket::pages, - ByteBufCodecs.stringUtf8(128).apply(ByteBufCodecs::optional), + ByteBufCodecs.stringUtf8(32).apply(ByteBufCodecs::optional), ServerboundEditBookPacket::title, ServerboundEditBookPacket::new ); diff --git a/net/minecraft/network/protocol/game/ServerboundMovePlayerPacket.java b/net/minecraft/network/protocol/game/ServerboundMovePlayerPacket.java index 55d334b2..0dc0179e 100644 --- a/net/minecraft/network/protocol/game/ServerboundMovePlayerPacket.java +++ b/net/minecraft/network/protocol/game/ServerboundMovePlayerPacket.java @@ -6,24 +6,49 @@ import net.minecraft.network.protocol.Packet; import net.minecraft.network.protocol.PacketType; public abstract class ServerboundMovePlayerPacket implements Packet { + private static final int FLAG_ON_GROUND = 1; + private static final int FLAG_HORIZONTAL_COLLISION = 2; protected final double x; protected final double y; protected final double z; protected final float yRot; protected final float xRot; protected final boolean onGround; + protected final boolean horizontalCollision; protected final boolean hasPos; protected final boolean hasRot; - protected ServerboundMovePlayerPacket(double x, double y, double z, float yRot, float xRot, boolean onGround, boolean hasPos, boolean hasRot) { - this.x = x; - this.y = y; - this.z = z; - this.yRot = yRot; - this.xRot = xRot; - this.onGround = onGround; - this.hasPos = hasPos; - this.hasRot = hasRot; + static int packFlags(boolean bl, boolean bl2) { + int i = 0; + if (bl) { + i |= 1; + } + + if (bl2) { + i |= 2; + } + + return i; + } + + static boolean unpackOnGround(int i) { + return (i & 1) != 0; + } + + static boolean unpackHorizontalCollision(int i) { + return (i & 2) != 0; + } + + protected ServerboundMovePlayerPacket(double d, double e, double f, float g, float h, boolean bl, boolean bl2, boolean bl3, boolean bl4) { + this.x = d; + this.y = e; + this.z = f; + this.yRot = g; + this.xRot = h; + this.onGround = bl; + this.horizontalCollision = bl2; + this.hasPos = bl3; + this.hasRot = bl4; } @Override @@ -60,6 +85,10 @@ public abstract class ServerboundMovePlayerPacket implements Packet { - public static final StreamCodec STREAM_CODEC = Packet.codec( - ServerboundPlaceRecipePacket::write, ServerboundPlaceRecipePacket::new +public record ServerboundPlaceRecipePacket(int containerId, RecipeDisplayId recipe, boolean useMaxItems) implements Packet { + public static final StreamCodec STREAM_CODEC = StreamCodec.composite( + ByteBufCodecs.CONTAINER_ID, + ServerboundPlaceRecipePacket::containerId, + RecipeDisplayId.STREAM_CODEC, + ServerboundPlaceRecipePacket::recipe, + ByteBufCodecs.BOOL, + ServerboundPlaceRecipePacket::useMaxItems, + ServerboundPlaceRecipePacket::new ); - private final int containerId; - private final ResourceLocation recipe; - private final boolean shiftDown; - - public ServerboundPlaceRecipePacket(int containerId, RecipeHolder recipe, boolean shiftDown) { - this.containerId = containerId; - this.recipe = recipe.id(); - this.shiftDown = shiftDown; - } - - private ServerboundPlaceRecipePacket(FriendlyByteBuf buffer) { - this.containerId = buffer.readByte(); - this.recipe = buffer.readResourceLocation(); - this.shiftDown = buffer.readBoolean(); - } - - /** - * Writes the raw packet data to the data stream. - */ - private void write(FriendlyByteBuf buffer) { - buffer.writeByte(this.containerId); - buffer.writeResourceLocation(this.recipe); - buffer.writeBoolean(this.shiftDown); - } @Override public PacketType type() { @@ -47,16 +29,4 @@ public class ServerboundPlaceRecipePacket implements Packet { - public static final StreamCodec STREAM_CODEC = Packet.codec( - ServerboundPlayerInputPacket::write, ServerboundPlayerInputPacket::new +public record ServerboundPlayerInputPacket(Input input) implements Packet { + public static final StreamCodec STREAM_CODEC = StreamCodec.composite( + Input.STREAM_CODEC, ServerboundPlayerInputPacket::input, ServerboundPlayerInputPacket::new ); - private static final int FLAG_JUMPING = 1; - private static final int FLAG_SHIFT_KEY_DOWN = 2; - /** - * Positive for left strafe, negative for right - */ - private final float xxa; - private final float zza; - private final boolean isJumping; - private final boolean isShiftKeyDown; - - public ServerboundPlayerInputPacket(float xxa, float zza, boolean isJumping, boolean isShiftKeyDown) { - this.xxa = xxa; - this.zza = zza; - this.isJumping = isJumping; - this.isShiftKeyDown = isShiftKeyDown; - } - - private ServerboundPlayerInputPacket(FriendlyByteBuf buffer) { - this.xxa = buffer.readFloat(); - this.zza = buffer.readFloat(); - byte b = buffer.readByte(); - this.isJumping = (b & 1) > 0; - this.isShiftKeyDown = (b & 2) > 0; - } - - /** - * Writes the raw packet data to the data stream. - */ - private void write(FriendlyByteBuf buffer) { - buffer.writeFloat(this.xxa); - buffer.writeFloat(this.zza); - byte b = 0; - if (this.isJumping) { - b = (byte)(b | 1); - } - - if (this.isShiftKeyDown) { - b = (byte)(b | 2); - } - - buffer.writeByte(b); - } @Override public PacketType type() { @@ -63,20 +22,4 @@ public class ServerboundPlayerInputPacket implements Packet { - public static final StreamCodec STREAM_CODEC = Packet.codec( - ServerboundRecipeBookSeenRecipePacket::write, ServerboundRecipeBookSeenRecipePacket::new +public record ServerboundRecipeBookSeenRecipePacket(RecipeDisplayId recipe) implements Packet { + public static final StreamCodec STREAM_CODEC = StreamCodec.composite( + RecipeDisplayId.STREAM_CODEC, ServerboundRecipeBookSeenRecipePacket::recipe, ServerboundRecipeBookSeenRecipePacket::new ); - private final ResourceLocation recipe; - - public ServerboundRecipeBookSeenRecipePacket(RecipeHolder recipe) { - this.recipe = recipe.id(); - } - - private ServerboundRecipeBookSeenRecipePacket(FriendlyByteBuf buffer) { - this.recipe = buffer.readResourceLocation(); - } - - /** - * Writes the raw packet data to the data stream. - */ - private void write(FriendlyByteBuf buffer) { - buffer.writeResourceLocation(this.recipe); - } @Override public PacketType type() { @@ -39,8 +22,4 @@ public class ServerboundRecipeBookSeenRecipePacket implements Packet { + public static final StreamCodec STREAM_CODEC = Packet.codec( + ServerboundSelectBundleItemPacket::write, ServerboundSelectBundleItemPacket::new + ); + + private ServerboundSelectBundleItemPacket(FriendlyByteBuf friendlyByteBuf) { + this(friendlyByteBuf.readVarInt(), friendlyByteBuf.readVarInt()); + } + + private void write(FriendlyByteBuf friendlyByteBuf) { + friendlyByteBuf.writeVarInt(this.slotId); + friendlyByteBuf.writeVarInt(this.selectedItemIndex); + } + + @Override + public PacketType type() { + return GamePacketTypes.SERVERBOUND_BUNDLE_ITEM_SELECTED; + } + + public void handle(ServerGamePacketListener serverGamePacketListener) { + serverGamePacketListener.handleBundleItemSelectedPacket(this); + } +} diff --git a/net/minecraft/network/protocol/game/ServerboundSetJigsawBlockPacket.java b/net/minecraft/network/protocol/game/ServerboundSetJigsawBlockPacket.java index 659aa605..aab1b941 100644 --- a/net/minecraft/network/protocol/game/ServerboundSetJigsawBlockPacket.java +++ b/net/minecraft/network/protocol/game/ServerboundSetJigsawBlockPacket.java @@ -47,7 +47,7 @@ public class ServerboundSetJigsawBlockPacket implements Packet { - public static final StreamCodec STREAM_CODEC = StreamCodec.composite( - ByteBufCodecs.GAME_PROFILE, - ClientboundGameProfilePacket::gameProfile, - ByteBufCodecs.BOOL, - ClientboundGameProfilePacket::strictErrorHandling, - ClientboundGameProfilePacket::new - ); - - @Override - public PacketType type() { - return LoginPacketTypes.CLIENTBOUND_GAME_PROFILE; - } - - /** - * Passes this Packet on to the NetHandler for processing. - */ - public void handle(ClientLoginPacketListener handler) { - handler.handleGameProfile(this); - } - - @Override - public boolean isTerminal() { - return true; - } -} diff --git a/net/minecraft/network/protocol/login/ClientboundLoginFinishedPacket.java b/net/minecraft/network/protocol/login/ClientboundLoginFinishedPacket.java new file mode 100644 index 00000000..4f9fc224 --- /dev/null +++ b/net/minecraft/network/protocol/login/ClientboundLoginFinishedPacket.java @@ -0,0 +1,28 @@ +package net.minecraft.network.protocol.login; + +import com.mojang.authlib.GameProfile; +import io.netty.buffer.ByteBuf; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.network.protocol.Packet; +import net.minecraft.network.protocol.PacketType; + +public record ClientboundLoginFinishedPacket(GameProfile gameProfile) implements Packet { + public static final StreamCodec STREAM_CODEC = StreamCodec.composite( + ByteBufCodecs.GAME_PROFILE, ClientboundLoginFinishedPacket::gameProfile, ClientboundLoginFinishedPacket::new + ); + + @Override + public PacketType type() { + return LoginPacketTypes.CLIENTBOUND_LOGIN_FINISHED; + } + + public void handle(ClientLoginPacketListener clientLoginPacketListener) { + clientLoginPacketListener.handleLoginFinished(this); + } + + @Override + public boolean isTerminal() { + return true; + } +} diff --git a/net/minecraft/network/protocol/login/LoginPacketTypes.java b/net/minecraft/network/protocol/login/LoginPacketTypes.java index 9578a812..d31a7cdf 100644 --- a/net/minecraft/network/protocol/login/LoginPacketTypes.java +++ b/net/minecraft/network/protocol/login/LoginPacketTypes.java @@ -7,7 +7,7 @@ import net.minecraft.resources.ResourceLocation; public class LoginPacketTypes { public static final PacketType CLIENTBOUND_CUSTOM_QUERY = createClientbound("custom_query"); - public static final PacketType CLIENTBOUND_GAME_PROFILE = createClientbound("game_profile"); + public static final PacketType CLIENTBOUND_LOGIN_FINISHED = createClientbound("login_finished"); public static final PacketType CLIENTBOUND_HELLO = createClientbound("hello"); public static final PacketType CLIENTBOUND_LOGIN_COMPRESSION = createClientbound("login_compression"); public static final PacketType CLIENTBOUND_LOGIN_DISCONNECT = createClientbound("login_disconnect"); diff --git a/net/minecraft/network/protocol/login/LoginProtocols.java b/net/minecraft/network/protocol/login/LoginProtocols.java index 5d3b601b..b43b016f 100644 --- a/net/minecraft/network/protocol/login/LoginProtocols.java +++ b/net/minecraft/network/protocol/login/LoginProtocols.java @@ -3,13 +3,14 @@ package net.minecraft.network.protocol.login; import net.minecraft.network.ConnectionProtocol; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.ProtocolInfo; +import net.minecraft.network.ProtocolInfo.Unbound; import net.minecraft.network.protocol.ProtocolInfoBuilder; import net.minecraft.network.protocol.cookie.ClientboundCookieRequestPacket; import net.minecraft.network.protocol.cookie.CookiePacketTypes; import net.minecraft.network.protocol.cookie.ServerboundCookieResponsePacket; public class LoginProtocols { - public static final ProtocolInfo.Unbound SERVERBOUND_TEMPLATE = ProtocolInfoBuilder.serverboundProtocol( + public static final Unbound SERVERBOUND_TEMPLATE = ProtocolInfoBuilder.serverboundProtocol( ConnectionProtocol.LOGIN, protocolInfoBuilder -> protocolInfoBuilder.addPacket(LoginPacketTypes.SERVERBOUND_HELLO, ServerboundHelloPacket.STREAM_CODEC) .addPacket(LoginPacketTypes.SERVERBOUND_KEY, ServerboundKeyPacket.STREAM_CODEC) @@ -18,11 +19,11 @@ public class LoginProtocols { .addPacket(CookiePacketTypes.SERVERBOUND_COOKIE_RESPONSE, ServerboundCookieResponsePacket.STREAM_CODEC) ); public static final ProtocolInfo SERVERBOUND = SERVERBOUND_TEMPLATE.bind(FriendlyByteBuf::new); - public static final ProtocolInfo.Unbound CLIENTBOUND_TEMPLATE = ProtocolInfoBuilder.clientboundProtocol( + public static final Unbound CLIENTBOUND_TEMPLATE = ProtocolInfoBuilder.clientboundProtocol( ConnectionProtocol.LOGIN, protocolInfoBuilder -> protocolInfoBuilder.addPacket(LoginPacketTypes.CLIENTBOUND_LOGIN_DISCONNECT, ClientboundLoginDisconnectPacket.STREAM_CODEC) .addPacket(LoginPacketTypes.CLIENTBOUND_HELLO, ClientboundHelloPacket.STREAM_CODEC) - .addPacket(LoginPacketTypes.CLIENTBOUND_GAME_PROFILE, ClientboundGameProfilePacket.STREAM_CODEC) + .addPacket(LoginPacketTypes.CLIENTBOUND_LOGIN_FINISHED, ClientboundLoginFinishedPacket.STREAM_CODEC) .addPacket(LoginPacketTypes.CLIENTBOUND_LOGIN_COMPRESSION, ClientboundLoginCompressionPacket.STREAM_CODEC) .addPacket(LoginPacketTypes.CLIENTBOUND_CUSTOM_QUERY, ClientboundCustomQueryPacket.STREAM_CODEC) .addPacket(CookiePacketTypes.CLIENTBOUND_COOKIE_REQUEST, ClientboundCookieRequestPacket.STREAM_CODEC) diff --git a/net/minecraft/network/protocol/login/ServerLoginPacketListener.java b/net/minecraft/network/protocol/login/ServerLoginPacketListener.java index 7cc8e6b2..38e76272 100644 --- a/net/minecraft/network/protocol/login/ServerLoginPacketListener.java +++ b/net/minecraft/network/protocol/login/ServerLoginPacketListener.java @@ -2,12 +2,11 @@ package net.minecraft.network.protocol.login; import net.minecraft.network.ConnectionProtocol; import net.minecraft.network.protocol.cookie.ServerCookiePacketListener; -import net.minecraft.network.protocol.game.ServerPacketListener; /** * PacketListener for the server side of the LOGIN protocol. */ -public interface ServerLoginPacketListener extends ServerCookiePacketListener, ServerPacketListener { +public interface ServerLoginPacketListener extends ServerCookiePacketListener { @Override default ConnectionProtocol protocol() { return ConnectionProtocol.LOGIN; diff --git a/net/minecraft/realms/RealmsConnect.java b/net/minecraft/realms/RealmsConnect.java index 34df348a..8682aa80 100644 --- a/net/minecraft/realms/RealmsConnect.java +++ b/net/minecraft/realms/RealmsConnect.java @@ -3,6 +3,7 @@ package net.minecraft.realms; import com.mojang.logging.LogUtils; import com.mojang.realmsclient.dto.RealmsServer; import java.net.InetSocketAddress; +import java.util.Objects; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.Minecraft; @@ -11,7 +12,7 @@ import net.minecraft.client.multiplayer.ClientHandshakePacketListenerImpl; import net.minecraft.client.multiplayer.chat.report.ReportEnvironment; import net.minecraft.client.multiplayer.resolver.ServerAddress; import net.minecraft.client.quickplay.QuickPlayLog; -import net.minecraft.client.resources.server.ServerPackManager; +import net.minecraft.client.resources.server.ServerPackManager.PackPromptStatus; import net.minecraft.network.Connection; import net.minecraft.network.chat.CommonComponents; import net.minecraft.network.chat.Component; @@ -72,8 +73,8 @@ public class RealmsConnect { RealmsConnect.this.connection.send(new ServerboundHelloPacket(minecraft.getUser().getName(), minecraft.getUser().getProfileId())); minecraft.updateReportEnvironment(ReportEnvironment.realm(server)); - minecraft.quickPlayLog().setWorldData(QuickPlayLog.Type.REALMS, String.valueOf(server.id), server.name); - minecraft.getDownloadedPackSource().configureForServerControl(RealmsConnect.this.connection, ServerPackManager.PackPromptStatus.ALLOWED); + minecraft.quickPlayLog().setWorldData(QuickPlayLog.Type.REALMS, String.valueOf(server.id), (String)Objects.requireNonNullElse(server.name, "unknown")); + minecraft.getDownloadedPackSource().configureForServerControl(RealmsConnect.this.connection, PackPromptStatus.ALLOWED); } catch (Exception var5) { minecraft.getDownloadedPackSource().cleanupAfterDisconnect(); if (RealmsConnect.this.aborted) { diff --git a/net/minecraft/realms/RealmsObjectSelectionList.java b/net/minecraft/realms/RealmsObjectSelectionList.java deleted file mode 100644 index ccf97dfd..00000000 --- a/net/minecraft/realms/RealmsObjectSelectionList.java +++ /dev/null @@ -1,64 +0,0 @@ -package net.minecraft.realms; - -import java.util.Collection; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.components.ObjectSelectionList; - -@Environment(EnvType.CLIENT) -public abstract class RealmsObjectSelectionList> extends ObjectSelectionList { - protected RealmsObjectSelectionList(int width, int height, int y, int itemHeight) { - super(Minecraft.getInstance(), width, height, y, itemHeight); - } - - public void setSelectedItem(int index) { - if (index == -1) { - this.setSelected(null); - } else if (super.getItemCount() != 0) { - this.setSelected(this.getEntry(index)); - } - } - - public void selectItem(int index) { - this.setSelectedItem(index); - } - - @Override - public int getMaxPosition() { - return 0; - } - - @Override - public int getRowWidth() { - return (int)(this.width * 0.6); - } - - @Override - public void replaceEntries(Collection entries) { - super.replaceEntries(entries); - } - - @Override - public int getItemCount() { - return super.getItemCount(); - } - - @Override - public int getRowTop(int index) { - return super.getRowTop(index); - } - - @Override - public int getRowLeft() { - return super.getRowLeft(); - } - - public int addEntry(E entry) { - return super.addEntry(entry); - } - - public void clear() { - this.clearEntries(); - } -} diff --git a/net/minecraft/realms/RealmsScreen.java b/net/minecraft/realms/RealmsScreen.java index 53239b8c..8afa790e 100644 --- a/net/minecraft/realms/RealmsScreen.java +++ b/net/minecraft/realms/RealmsScreen.java @@ -21,6 +21,7 @@ public abstract class RealmsScreen extends Screen { protected static final int COLOR_LINK = 3368635; protected static final int COLOR_LINK_HOVER = 7107012; protected static final int SKIN_FACE_SIZE = 32; + protected static final int HARDCORE_HEART_SIZE = 8; private final List labels = Lists.newArrayList(); public RealmsScreen(Component title) { diff --git a/net/minecraft/recipebook/PlaceRecipe.java b/net/minecraft/recipebook/PlaceRecipe.java deleted file mode 100644 index 0f631a20..00000000 --- a/net/minecraft/recipebook/PlaceRecipe.java +++ /dev/null @@ -1,58 +0,0 @@ -package net.minecraft.recipebook; - -import java.util.Iterator; -import net.minecraft.util.Mth; -import net.minecraft.world.item.crafting.RecipeHolder; -import net.minecraft.world.item.crafting.ShapedRecipe; - -public interface PlaceRecipe { - default void placeRecipe(int width, int height, int outputSlot, RecipeHolder recipe, Iterator ingredients, int maxAmount) { - int i = width; - int j = height; - if (recipe.value() instanceof ShapedRecipe shapedRecipe) { - i = shapedRecipe.getWidth(); - j = shapedRecipe.getHeight(); - } - - int k = 0; - - for (int l = 0; l < height; l++) { - if (k == outputSlot) { - k++; - } - - boolean bl = j < height / 2.0F; - int m = Mth.floor(height / 2.0F - j / 2.0F); - if (bl && m > l) { - k += width; - l++; - } - - for (int n = 0; n < width; n++) { - if (!ingredients.hasNext()) { - return; - } - - bl = i < width / 2.0F; - m = Mth.floor(width / 2.0F - i / 2.0F); - int o = i; - boolean bl2 = n < i; - if (bl) { - o = m + i; - bl2 = m <= n && n < m + i; - } - - if (bl2) { - this.addItemToSlot((T)ingredients.next(), k, maxAmount, n, l); - } else if (o == n) { - k += width - n; - break; - } - - k++; - } - } - } - - void addItemToSlot(T item, int slot, int maxAmount, int x, int y); -} diff --git a/net/minecraft/recipebook/PlaceRecipeHelper.java b/net/minecraft/recipebook/PlaceRecipeHelper.java new file mode 100644 index 00000000..decbb150 --- /dev/null +++ b/net/minecraft/recipebook/PlaceRecipeHelper.java @@ -0,0 +1,59 @@ +package net.minecraft.recipebook; + +import java.util.Iterator; +import net.minecraft.util.Mth; +import net.minecraft.world.item.crafting.Recipe; +import net.minecraft.world.item.crafting.ShapedRecipe; + +public interface PlaceRecipeHelper { + static void placeRecipe(int i, int j, Recipe recipe, Iterable iterable, PlaceRecipeHelper.Output output) { + if (recipe instanceof ShapedRecipe shapedRecipe) { + placeRecipe(i, j, shapedRecipe.getWidth(), shapedRecipe.getHeight(), iterable, output); + } else { + placeRecipe(i, j, i, j, iterable, output); + } + } + + static void placeRecipe(int i, int j, int k, int l, Iterable iterable, PlaceRecipeHelper.Output output) { + Iterator iterator = iterable.iterator(); + int m = 0; + + for (int n = 0; n < j; n++) { + boolean bl = l < j / 2.0F; + int o = Mth.floor(j / 2.0F - l / 2.0F); + if (bl && o > n) { + m += i; + n++; + } + + for (int p = 0; p < i; p++) { + if (!iterator.hasNext()) { + return; + } + + bl = k < i / 2.0F; + o = Mth.floor(i / 2.0F - k / 2.0F); + int q = k; + boolean bl2 = p < k; + if (bl) { + q = o + k; + bl2 = o <= p && p < o + k; + } + + if (bl2) { + output.addItemToSlot((T)iterator.next(), m, p, n); + } else if (q == p) { + m += i - p; + break; + } + + m++; + } + } + } + + @FunctionalInterface + public interface Output { + void addItemToSlot(T object, int i, int j, int k); + } +} diff --git a/net/minecraft/recipebook/ServerPlaceRecipe.java b/net/minecraft/recipebook/ServerPlaceRecipe.java index 639ce78e..9553a196 100644 --- a/net/minecraft/recipebook/ServerPlaceRecipe.java +++ b/net/minecraft/recipebook/ServerPlaceRecipe.java @@ -1,159 +1,177 @@ package net.minecraft.recipebook; import com.google.common.collect.Lists; -import it.unimi.dsi.fastutil.ints.IntArrayList; -import it.unimi.dsi.fastutil.ints.IntList; +import java.util.ArrayList; import java.util.List; -import net.minecraft.network.protocol.game.ClientboundPlaceGhostRecipePacket; -import net.minecraft.server.level.ServerPlayer; +import java.util.OptionalInt; +import net.minecraft.core.Holder; import net.minecraft.world.entity.player.Inventory; -import net.minecraft.world.entity.player.StackedContents; +import net.minecraft.world.entity.player.StackedItemContents; import net.minecraft.world.inventory.RecipeBookMenu; import net.minecraft.world.inventory.Slot; +import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.PlacementInfo; import net.minecraft.world.item.crafting.Recipe; import net.minecraft.world.item.crafting.RecipeHolder; import net.minecraft.world.item.crafting.RecipeInput; -import org.jetbrains.annotations.Nullable; -public class ServerPlaceRecipe> implements PlaceRecipe { +public class ServerPlaceRecipe> { private static final int ITEM_NOT_FOUND = -1; - protected final StackedContents stackedContents = new StackedContents(); - protected Inventory inventory; - protected RecipeBookMenu menu; + private final Inventory inventory; + private final ServerPlaceRecipe.CraftingMenuAccess menu; + private final boolean useMaxItems; + private final int gridWidth; + private final int gridHeight; + private final List inputGridSlots; + private final List slotsToClear; - public ServerPlaceRecipe(RecipeBookMenu menu) { - this.menu = menu; - } - - public void recipeClicked(ServerPlayer player, @Nullable RecipeHolder recipe, boolean placeAll) { - if (recipe != null && player.getRecipeBook().contains(recipe)) { - this.inventory = player.getInventory(); - if (this.testClearGrid() || player.isCreative()) { - this.stackedContents.clear(); - player.getInventory().fillStackedContents(this.stackedContents); - this.menu.fillCraftSlotsStackedContents(this.stackedContents); - if (this.stackedContents.canCraft(recipe.value(), null)) { - this.handleRecipeClicked(recipe, placeAll); - } else { - this.clearGrid(); - player.connection.send(new ClientboundPlaceGhostRecipePacket(player.containerMenu.containerId, recipe)); - } - - player.getInventory().setChanged(); - } + public static > RecipeBookMenu.PostPlaceAction placeRecipe( + ServerPlaceRecipe.CraftingMenuAccess craftingMenuAccess, + int i, + int j, + List list, + List list2, + Inventory inventory, + RecipeHolder recipeHolder, + boolean bl, + boolean bl2 + ) { + ServerPlaceRecipe serverPlaceRecipe = new ServerPlaceRecipe<>(craftingMenuAccess, inventory, bl, i, j, list, list2); + if (!bl2 && !serverPlaceRecipe.testClearGrid()) { + return RecipeBookMenu.PostPlaceAction.NOTHING; + } else { + StackedItemContents stackedItemContents = new StackedItemContents(); + inventory.fillStackedContents(stackedItemContents); + craftingMenuAccess.fillCraftSlotsStackedContents(stackedItemContents); + return serverPlaceRecipe.tryPlaceRecipe(recipeHolder, stackedItemContents); } } - protected void clearGrid() { - for (int i = 0; i < this.menu.getSize(); i++) { - if (this.menu.shouldMoveToInventory(i)) { - ItemStack itemStack = this.menu.getSlot(i).getItem().copy(); - this.inventory.placeItemBackInInventory(itemStack, false); - this.menu.getSlot(i).set(itemStack); - } + private ServerPlaceRecipe( + ServerPlaceRecipe.CraftingMenuAccess craftingMenuAccess, Inventory inventory, boolean bl, int i, int j, List list, List list2 + ) { + this.menu = craftingMenuAccess; + this.inventory = inventory; + this.useMaxItems = bl; + this.gridWidth = i; + this.gridHeight = j; + this.inputGridSlots = list; + this.slotsToClear = list2; + } + + private RecipeBookMenu.PostPlaceAction tryPlaceRecipe(RecipeHolder recipeHolder, StackedItemContents stackedItemContents) { + if (stackedItemContents.canCraft(recipeHolder.value(), null)) { + this.placeRecipe(recipeHolder, stackedItemContents); + this.inventory.setChanged(); + return RecipeBookMenu.PostPlaceAction.NOTHING; + } else { + this.clearGrid(); + this.inventory.setChanged(); + return RecipeBookMenu.PostPlaceAction.PLACE_GHOST_RECIPE; + } + } + + private void clearGrid() { + for (Slot slot : this.slotsToClear) { + ItemStack itemStack = slot.getItem().copy(); + this.inventory.placeItemBackInInventory(itemStack, false); + slot.set(itemStack); } this.menu.clearCraftingContent(); } - protected void handleRecipeClicked(RecipeHolder recipe, boolean placeAll) { - boolean bl = this.menu.recipeMatches(recipe); - int i = this.stackedContents.getBiggestCraftableStack(recipe, null); + private void placeRecipe(RecipeHolder recipeHolder, StackedItemContents stackedItemContents) { + boolean bl = this.menu.recipeMatches(recipeHolder); + int i = stackedItemContents.getBiggestCraftableStack(recipeHolder.value(), null); if (bl) { - for (int j = 0; j < this.menu.getGridHeight() * this.menu.getGridWidth() + 1; j++) { - if (j != this.menu.getResultSlotIndex()) { - ItemStack itemStack = this.menu.getSlot(j).getItem(); - if (!itemStack.isEmpty() && Math.min(i, itemStack.getMaxStackSize()) < itemStack.getCount() + 1) { - return; - } - } - } - } - - int jx = this.getStackSize(placeAll, i, bl); - IntList intList = new IntArrayList(); - if (this.stackedContents.canCraft(recipe.value(), intList, jx)) { - int k = jx; - - for (int l : intList) { - ItemStack itemStack2 = StackedContents.fromStackingIndex(l); - if (!itemStack2.isEmpty()) { - int m = itemStack2.getMaxStackSize(); - if (m < k) { - k = m; - } - } - } - - if (this.stackedContents.canCraft(recipe.value(), intList, k)) { - this.clearGrid(); - this.placeRecipe(this.menu.getGridWidth(), this.menu.getGridHeight(), this.menu.getResultSlotIndex(), recipe, intList.iterator(), k); - } - } - } - - public void addItemToSlot(Integer item, int slot, int maxAmount, int x, int y) { - Slot slot2 = this.menu.getSlot(slot); - ItemStack itemStack = StackedContents.fromStackingIndex(item); - if (!itemStack.isEmpty()) { - int i = maxAmount; - - while (i > 0) { - i = this.moveItemToGrid(slot2, itemStack, i); - if (i == -1) { + for (Slot slot : this.inputGridSlots) { + ItemStack itemStack = slot.getItem(); + if (!itemStack.isEmpty() && Math.min(i, itemStack.getMaxStackSize()) < itemStack.getCount() + 1) { return; } } } + + int j = this.calculateAmountToCraft(i, bl); + List> list = new ArrayList(); + if (stackedItemContents.canCraft(recipeHolder.value(), j, list::add)) { + OptionalInt optionalInt = list.stream().mapToInt(holder -> ((Item)holder.value()).getDefaultMaxStackSize()).min(); + if (optionalInt.isPresent()) { + j = Math.min(j, optionalInt.getAsInt()); + } + + list.clear(); + if (stackedItemContents.canCraft(recipeHolder.value(), j, list::add)) { + this.clearGrid(); + int k = j; + PlaceRecipeHelper.placeRecipe( + this.gridWidth, this.gridHeight, recipeHolder.value(), recipeHolder.value().placementInfo().slotInfo(), (optional, jx, kx, l) -> { + if (!optional.isEmpty()) { + Slot slotx = (Slot)this.inputGridSlots.get(jx); + int m = ((PlacementInfo.SlotInfo)optional.get()).placerOutputPosition(); + int n = k; + + while (n > 0) { + Holder holder = (Holder)list.get(m); + n = this.moveItemToGrid(slotx, holder, n); + if (n == -1) { + return; + } + } + } + } + ); + } + } } - protected int getStackSize(boolean placeAll, int maxPossible, boolean recipeMatches) { - int i = 1; - if (placeAll) { - i = maxPossible; - } else if (recipeMatches) { - i = Integer.MAX_VALUE; + private int calculateAmountToCraft(int i, boolean bl) { + if (this.useMaxItems) { + return i; + } else if (bl) { + int j = Integer.MAX_VALUE; - for (int j = 0; j < this.menu.getGridWidth() * this.menu.getGridHeight() + 1; j++) { - if (j != this.menu.getResultSlotIndex()) { - ItemStack itemStack = this.menu.getSlot(j).getItem(); - if (!itemStack.isEmpty() && i > itemStack.getCount()) { - i = itemStack.getCount(); - } + for (Slot slot : this.inputGridSlots) { + ItemStack itemStack = slot.getItem(); + if (!itemStack.isEmpty() && j > itemStack.getCount()) { + j = itemStack.getCount(); } } - if (i != Integer.MAX_VALUE) { - i++; + if (j != Integer.MAX_VALUE) { + j++; } - } - return i; + return j; + } else { + return 1; + } } - protected int moveItemToGrid(Slot slot, ItemStack stack, int maxAmount) { - int i = this.inventory.findSlotMatchingUnusedItem(stack); - if (i == -1) { + private int moveItemToGrid(Slot slot, Holder holder, int i) { + int j = this.inventory.findSlotMatchingCraftingIngredient(holder); + if (j == -1) { return -1; } else { - ItemStack itemStack = this.inventory.getItem(i); - int j; - if (maxAmount < itemStack.getCount()) { - this.inventory.removeItem(i, maxAmount); - j = maxAmount; + ItemStack itemStack = this.inventory.getItem(j); + int k; + if (i < itemStack.getCount()) { + this.inventory.removeItem(j, i); + k = i; } else { - this.inventory.removeItemNoUpdate(i); - j = itemStack.getCount(); + this.inventory.removeItemNoUpdate(j); + k = itemStack.getCount(); } if (slot.getItem().isEmpty()) { - slot.set(itemStack.copyWithCount(j)); + slot.set(itemStack.copyWithCount(k)); } else { - slot.getItem().grow(j); + slot.getItem().grow(k); } - return maxAmount - j; + return i - k; } } @@ -164,32 +182,30 @@ public class ServerPlaceRecipe> imple List list = Lists.newArrayList(); int i = this.getAmountOfFreeSlotsInInventory(); - for (int j = 0; j < this.menu.getGridWidth() * this.menu.getGridHeight() + 1; j++) { - if (j != this.menu.getResultSlotIndex()) { - ItemStack itemStack = this.menu.getSlot(j).getItem().copy(); - if (!itemStack.isEmpty()) { - int k = this.inventory.getSlotWithRemainingSpace(itemStack); - if (k == -1 && list.size() <= i) { - for (ItemStack itemStack2 : list) { - if (ItemStack.isSameItem(itemStack2, itemStack) - && itemStack2.getCount() != itemStack2.getMaxStackSize() - && itemStack2.getCount() + itemStack.getCount() <= itemStack2.getMaxStackSize()) { - itemStack2.grow(itemStack.getCount()); - itemStack.setCount(0); - break; - } + for (Slot slot : this.inputGridSlots) { + ItemStack itemStack = slot.getItem().copy(); + if (!itemStack.isEmpty()) { + int j = this.inventory.getSlotWithRemainingSpace(itemStack); + if (j == -1 && list.size() <= i) { + for (ItemStack itemStack2 : list) { + if (ItemStack.isSameItem(itemStack2, itemStack) + && itemStack2.getCount() != itemStack2.getMaxStackSize() + && itemStack2.getCount() + itemStack.getCount() <= itemStack2.getMaxStackSize()) { + itemStack2.grow(itemStack.getCount()); + itemStack.setCount(0); + break; } - - if (!itemStack.isEmpty()) { - if (list.size() >= i) { - return false; - } - - list.add(itemStack); - } - } else if (k == -1) { - return false; } + + if (!itemStack.isEmpty()) { + if (list.size() >= i) { + return false; + } + + list.add(itemStack); + } + } else if (j == -1) { + return false; } } } @@ -208,4 +224,12 @@ public class ServerPlaceRecipe> imple return i; } + + public interface CraftingMenuAccess> { + void fillCraftSlotsStackedContents(StackedItemContents stackedItemContents); + + void clearCraftingContent(); + + boolean recipeMatches(RecipeHolder recipeHolder); + } } diff --git a/net/minecraft/world/item/armortrim/package-info.java b/net/minecraft/references/package-info.java similarity index 84% rename from net/minecraft/world/item/armortrim/package-info.java rename to net/minecraft/references/package-info.java index e6c318e9..448a2a6f 100644 --- a/net/minecraft/world/item/armortrim/package-info.java +++ b/net/minecraft/references/package-info.java @@ -1,7 +1,7 @@ @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault @FieldsAreNonnullByDefault -package net.minecraft.world.item.armortrim; +package net.minecraft.references; import javax.annotation.ParametersAreNonnullByDefault; import net.minecraft.FieldsAreNonnullByDefault; diff --git a/net/minecraft/resources/DependantName.java b/net/minecraft/resources/DependantName.java new file mode 100644 index 00000000..b6c9f5c7 --- /dev/null +++ b/net/minecraft/resources/DependantName.java @@ -0,0 +1,10 @@ +package net.minecraft.resources; + +@FunctionalInterface +public interface DependantName { + V get(ResourceKey resourceKey); + + static DependantName fixed(V object) { + return resourceKey -> object; + } +} diff --git a/net/minecraft/resources/RegistryDataLoader.java b/net/minecraft/resources/RegistryDataLoader.java index 32b9f57f..72e5502f 100644 --- a/net/minecraft/resources/RegistryDataLoader.java +++ b/net/minecraft/resources/RegistryDataLoader.java @@ -12,6 +12,7 @@ import java.io.IOException; import java.io.PrintWriter; import java.io.Reader; import java.io.StringWriter; +import java.util.Comparator; import java.util.HashMap; import java.util.List; import java.util.Locale; @@ -21,7 +22,12 @@ import java.util.Map.Entry; import java.util.function.BiConsumer; import java.util.function.Function; import java.util.stream.Collectors; +import net.minecraft.CrashReport; +import net.minecraft.CrashReportCategory; +import net.minecraft.CrashReportDetail; +import net.minecraft.ReportedException; import net.minecraft.Util; +import net.minecraft.core.HolderLookup; import net.minecraft.core.MappedRegistry; import net.minecraft.core.RegistrationInfo; import net.minecraft.core.Registry; @@ -32,21 +38,27 @@ import net.minecraft.core.registries.Registries; import net.minecraft.nbt.NbtOps; import net.minecraft.nbt.Tag; import net.minecraft.network.chat.ChatType; +import net.minecraft.resources.RegistryOps.RegistryInfo; +import net.minecraft.resources.RegistryOps.RegistryInfoLookup; import net.minecraft.server.packs.repository.KnownPack; import net.minecraft.server.packs.resources.Resource; import net.minecraft.server.packs.resources.ResourceManager; import net.minecraft.server.packs.resources.ResourceProvider; +import net.minecraft.tags.TagLoader; +import net.minecraft.tags.TagNetworkSerialization; import net.minecraft.world.damagesource.DamageType; import net.minecraft.world.entity.animal.WolfVariant; import net.minecraft.world.entity.decoration.PaintingVariant; +import net.minecraft.world.item.Instrument; import net.minecraft.world.item.JukeboxSong; -import net.minecraft.world.item.armortrim.TrimMaterial; -import net.minecraft.world.item.armortrim.TrimPattern; import net.minecraft.world.item.enchantment.Enchantment; import net.minecraft.world.item.enchantment.providers.EnchantmentProvider; +import net.minecraft.world.item.equipment.trim.TrimMaterial; +import net.minecraft.world.item.equipment.trim.TrimPattern; import net.minecraft.world.level.biome.Biome; import net.minecraft.world.level.biome.MultiNoiseBiomeSourceParameterList; import net.minecraft.world.level.block.entity.BannerPattern; +import net.minecraft.world.level.block.entity.trialspawner.TrialSpawnerConfig; import net.minecraft.world.level.dimension.DimensionType; import net.minecraft.world.level.dimension.LevelStem; import net.minecraft.world.level.levelgen.DensityFunction; @@ -60,11 +72,12 @@ import net.minecraft.world.level.levelgen.structure.Structure; import net.minecraft.world.level.levelgen.structure.StructureSet; import net.minecraft.world.level.levelgen.structure.pools.StructureTemplatePool; import net.minecraft.world.level.levelgen.structure.templatesystem.StructureProcessorType; -import net.minecraft.world.level.levelgen.synth.NormalNoise; +import net.minecraft.world.level.levelgen.synth.NormalNoise.NoiseParameters; import org.slf4j.Logger; public class RegistryDataLoader { private static final Logger LOGGER = LogUtils.getLogger(); + private static final Comparator> ERROR_KEY_COMPARATOR = Comparator.comparing(ResourceKey::registry).thenComparing(ResourceKey::location); private static final RegistrationInfo NETWORK_REGISTRATION_INFO = new RegistrationInfo(Optional.empty(), Lifecycle.experimental()); private static final Function, RegistrationInfo> REGISTRATION_INFO_CACHE = Util.memoize( (Function, RegistrationInfo>)(optional -> { @@ -84,12 +97,13 @@ public class RegistryDataLoader { new RegistryDataLoader.RegistryData<>(Registries.PROCESSOR_LIST, StructureProcessorType.DIRECT_CODEC), new RegistryDataLoader.RegistryData<>(Registries.TEMPLATE_POOL, StructureTemplatePool.DIRECT_CODEC), new RegistryDataLoader.RegistryData<>(Registries.NOISE_SETTINGS, NoiseGeneratorSettings.DIRECT_CODEC), - new RegistryDataLoader.RegistryData<>(Registries.NOISE, NormalNoise.NoiseParameters.DIRECT_CODEC), + new RegistryDataLoader.RegistryData<>(Registries.NOISE, NoiseParameters.DIRECT_CODEC), new RegistryDataLoader.RegistryData<>(Registries.DENSITY_FUNCTION, DensityFunction.DIRECT_CODEC), new RegistryDataLoader.RegistryData<>(Registries.WORLD_PRESET, WorldPreset.DIRECT_CODEC), new RegistryDataLoader.RegistryData<>(Registries.FLAT_LEVEL_GENERATOR_PRESET, FlatLevelGeneratorPreset.DIRECT_CODEC), new RegistryDataLoader.RegistryData<>(Registries.TRIM_PATTERN, TrimPattern.DIRECT_CODEC), new RegistryDataLoader.RegistryData<>(Registries.TRIM_MATERIAL, TrimMaterial.DIRECT_CODEC), + new RegistryDataLoader.RegistryData<>(Registries.TRIAL_SPAWNER_CONFIG, TrialSpawnerConfig.DIRECT_CODEC), new RegistryDataLoader.RegistryData<>(Registries.WOLF_VARIANT, WolfVariant.DIRECT_CODEC, true), new RegistryDataLoader.RegistryData<>(Registries.PAINTING_VARIANT, PaintingVariant.DIRECT_CODEC, true), new RegistryDataLoader.RegistryData<>(Registries.DAMAGE_TYPE, DamageType.DIRECT_CODEC), @@ -97,7 +111,8 @@ public class RegistryDataLoader { new RegistryDataLoader.RegistryData<>(Registries.BANNER_PATTERN, BannerPattern.DIRECT_CODEC), new RegistryDataLoader.RegistryData<>(Registries.ENCHANTMENT, Enchantment.DIRECT_CODEC), new RegistryDataLoader.RegistryData<>(Registries.ENCHANTMENT_PROVIDER, EnchantmentProvider.DIRECT_CODEC), - new RegistryDataLoader.RegistryData<>(Registries.JUKEBOX_SONG, JukeboxSong.DIRECT_CODEC) + new RegistryDataLoader.RegistryData<>(Registries.JUKEBOX_SONG, JukeboxSong.DIRECT_CODEC), + new RegistryDataLoader.RegistryData<>(Registries.INSTRUMENT, Instrument.DIRECT_CODEC) ); public static final List> DIMENSION_REGISTRIES = List.of( new RegistryDataLoader.RegistryData<>(Registries.LEVEL_STEM, LevelStem.CODEC) @@ -113,32 +128,35 @@ public class RegistryDataLoader { new RegistryDataLoader.RegistryData<>(Registries.DAMAGE_TYPE, DamageType.DIRECT_CODEC), new RegistryDataLoader.RegistryData<>(Registries.BANNER_PATTERN, BannerPattern.DIRECT_CODEC), new RegistryDataLoader.RegistryData<>(Registries.ENCHANTMENT, Enchantment.DIRECT_CODEC), - new RegistryDataLoader.RegistryData<>(Registries.JUKEBOX_SONG, JukeboxSong.DIRECT_CODEC) + new RegistryDataLoader.RegistryData<>(Registries.JUKEBOX_SONG, JukeboxSong.DIRECT_CODEC), + new RegistryDataLoader.RegistryData<>(Registries.INSTRUMENT, Instrument.DIRECT_CODEC) ); - public static RegistryAccess.Frozen load(ResourceManager resourceManager, RegistryAccess registryAccess, List> registryData) { - return load((loader, registryInfoLookup) -> loader.loadFromResources(resourceManager, registryInfoLookup), registryAccess, registryData); + public static RegistryAccess.Frozen load( + ResourceManager resourceManager, List> list, List> list2 + ) { + return load((loader, registryInfoLookup) -> loader.loadFromResources(resourceManager, registryInfoLookup), list, list2); } public static RegistryAccess.Frozen load( - Map>, List> elements, + Map>, RegistryDataLoader.NetworkedRegistryData> map, ResourceProvider resourceProvider, - RegistryAccess registryAccess, - List> registryData + List> list, + List> list2 ) { - return load((loader, registryInfoLookup) -> loader.loadFromNetwork(elements, resourceProvider, registryInfoLookup), registryAccess, registryData); + return load((loader, registryInfoLookup) -> loader.loadFromNetwork(map, resourceProvider, registryInfoLookup), list, list2); } private static RegistryAccess.Frozen load( - RegistryDataLoader.LoadingFunction loadingFunction, RegistryAccess registryAccess, List> registryData + RegistryDataLoader.LoadingFunction loadingFunction, List> list, List> list2 ) { Map, Exception> map = new HashMap(); - List> list = (List>)registryData.stream() - .map(registryDatax -> registryDatax.create(Lifecycle.stable(), map)) + List> list3 = (List>)list2.stream() + .map(registryData -> registryData.create(Lifecycle.stable(), map)) .collect(Collectors.toUnmodifiableList()); - RegistryOps.RegistryInfoLookup registryInfoLookup = createContext(registryAccess, list); - list.forEach(loader -> loadingFunction.apply(loader, registryInfoLookup)); - list.forEach(loader -> { + RegistryInfoLookup registryInfoLookup = createContext(list, list3); + list3.forEach(loader -> loadingFunction.apply(loader, registryInfoLookup)); + list3.forEach(loader -> { Registry registry = loader.registry(); try { @@ -152,44 +170,48 @@ public class RegistryDataLoader { } }); if (!map.isEmpty()) { - logErrors(map); - throw new IllegalStateException("Failed to load registries due to above errors"); + throw logErrors(map); } else { - return new RegistryAccess.ImmutableRegistryAccess(list.stream().map(RegistryDataLoader.Loader::registry).toList()).freeze(); + return new RegistryAccess.ImmutableRegistryAccess(list3.stream().map(RegistryDataLoader.Loader::registry).toList()).freeze(); } } - private static RegistryOps.RegistryInfoLookup createContext(RegistryAccess registryAccess, List> registryLoaders) { - final Map>, RegistryOps.RegistryInfo> map = new HashMap(); - registryAccess.registries().forEach(registryEntry -> map.put(registryEntry.key(), createInfoForContextRegistry(registryEntry.value()))); - registryLoaders.forEach(loader -> map.put(loader.registry.key(), createInfoForNewRegistry(loader.registry))); - return new RegistryOps.RegistryInfoLookup() { + private static RegistryInfoLookup createContext(List> list, List> list2) { + final Map>, RegistryInfo> map = new HashMap(); + list.forEach(registryLookup -> map.put(registryLookup.key(), createInfoForContextRegistry(registryLookup))); + list2.forEach(loader -> map.put(loader.registry.key(), createInfoForNewRegistry(loader.registry))); + return new RegistryInfoLookup() { @Override - public Optional> lookup(ResourceKey> registryKey) { - return Optional.ofNullable((RegistryOps.RegistryInfo)map.get(registryKey)); + public Optional> lookup(ResourceKey> registryKey) { + return Optional.ofNullable((RegistryInfo)map.get(registryKey)); } }; } - private static RegistryOps.RegistryInfo createInfoForNewRegistry(WritableRegistry registry) { - return new RegistryOps.RegistryInfo<>(registry.asLookup(), registry.createRegistrationLookup(), registry.registryLifecycle()); + private static RegistryInfo createInfoForNewRegistry(WritableRegistry registry) { + return new RegistryInfo<>(registry, registry.createRegistrationLookup(), registry.registryLifecycle()); } - private static RegistryOps.RegistryInfo createInfoForContextRegistry(Registry registry) { - return new RegistryOps.RegistryInfo<>(registry.asLookup(), registry.asTagAddingLookup(), registry.registryLifecycle()); + private static RegistryInfo createInfoForContextRegistry(HolderLookup.RegistryLookup registryLookup) { + return new RegistryInfo<>(registryLookup, registryLookup, registryLookup.registryLifecycle()); } - private static void logErrors(Map, Exception> errors) { + private static ReportedException logErrors(Map, Exception> map) { + printFullDetailsToLog(map); + return createReportWithBriefInfo(map); + } + + private static void printFullDetailsToLog(Map, Exception> map) { StringWriter stringWriter = new StringWriter(); PrintWriter printWriter = new PrintWriter(stringWriter); - Map> map = (Map>)errors.entrySet() + Map> map2 = (Map>)map.entrySet() .stream() .collect( Collectors.groupingBy( entry -> ((ResourceKey)entry.getKey()).registry(), Collectors.toMap(entry -> ((ResourceKey)entry.getKey()).location(), Entry::getValue) ) ); - map.entrySet().stream().sorted(Entry.comparingByKey()).forEach(entry -> { + map2.entrySet().stream().sorted(Entry.comparingByKey()).forEach(entry -> { printWriter.printf("> Errors in registry %s:%n", entry.getKey()); ((Map)entry.getValue()).entrySet().stream().sorted(Entry.comparingByKey()).forEach(entryx -> { printWriter.printf(">> Errors in element %s:%n", entryx.getKey()); @@ -200,6 +222,30 @@ public class RegistryDataLoader { LOGGER.error("Registry loading errors:\n{}", stringWriter); } + private static ReportedException createReportWithBriefInfo(Map, Exception> map) { + CrashReport crashReport = CrashReport.forThrowable(new IllegalStateException("Failed to load registries due to errors"), "Registry Loading"); + CrashReportCategory crashReportCategory = crashReport.addCategory("Loading info"); + crashReportCategory.setDetail( + "Errors", + (CrashReportDetail)(() -> { + StringBuilder stringBuilder = new StringBuilder(); + map.entrySet() + .stream() + .sorted(Entry.comparingByKey(ERROR_KEY_COMPARATOR)) + .forEach( + entry -> stringBuilder.append("\n\t\t") + .append(((ResourceKey)entry.getKey()).registry()) + .append("/") + .append(((ResourceKey)entry.getKey()).location()) + .append(": ") + .append(((Exception)entry.getValue()).getMessage()) + ); + return stringBuilder.toString(); + }) + ); + return new ReportedException(crashReport); + } + private static void loadElementFromResource( WritableRegistry registry, Decoder codec, @@ -234,7 +280,7 @@ public class RegistryDataLoader { static void loadContentsFromManager( ResourceManager resourceManager, - RegistryOps.RegistryInfoLookup registryInfoLookup, + RegistryInfoLookup registryInfoLookup, WritableRegistry registry, Decoder codec, Map, Exception> loadingErrors @@ -257,24 +303,26 @@ public class RegistryDataLoader { ); } } + + TagLoader.loadTagsForRegistry(resourceManager, registry); } static void loadContentsFromNetwork( - Map>, List> elements, + Map>, RegistryDataLoader.NetworkedRegistryData> elements, ResourceProvider resourceProvider, - RegistryOps.RegistryInfoLookup registryInfoLookup, + RegistryInfoLookup registryInfoLookup, WritableRegistry registry, Decoder codec, Map, Exception> loadingErrors ) { - List list = (List)elements.get(registry.key()); - if (list != null) { + RegistryDataLoader.NetworkedRegistryData networkedRegistryData = (RegistryDataLoader.NetworkedRegistryData)elements.get(registry.key()); + if (networkedRegistryData != null) { RegistryOps registryOps = RegistryOps.create(NbtOps.INSTANCE, registryInfoLookup); RegistryOps registryOps2 = RegistryOps.create(JsonOps.INSTANCE, registryInfoLookup); String string = Registries.elementsDirPath(registry.key()); FileToIdConverter fileToIdConverter = FileToIdConverter.json(string); - for (RegistrySynchronization.PackedRegistryEntry packedRegistryEntry : list) { + for (RegistrySynchronization.PackedRegistryEntry packedRegistryEntry : networkedRegistryData.elements) { ResourceKey resourceKey = ResourceKey.create(registry.key(), packedRegistryEntry.id()); Optional optional = packedRegistryEntry.data(); if (optional.isPresent()) { @@ -296,19 +344,21 @@ public class RegistryDataLoader { } } } + + TagLoader.loadTagsFromNetwork(networkedRegistryData.tags, registry); } } record Loader(RegistryDataLoader.RegistryData data, WritableRegistry registry, Map, Exception> loadingErrors) { - public void loadFromResources(ResourceManager resouceManager, RegistryOps.RegistryInfoLookup registryInfoLookup) { + public void loadFromResources(ResourceManager resouceManager, RegistryInfoLookup registryInfoLookup) { RegistryDataLoader.loadContentsFromManager(resouceManager, registryInfoLookup, this.registry, this.data.elementCodec, this.loadingErrors); } public void loadFromNetwork( - Map>, List> elements, + Map>, RegistryDataLoader.NetworkedRegistryData> elements, ResourceProvider resourceProvider, - RegistryOps.RegistryInfoLookup registryInfoLookup + RegistryInfoLookup registryInfoLookup ) { RegistryDataLoader.loadContentsFromNetwork(elements, resourceProvider, registryInfoLookup, this.registry, this.data.elementCodec, this.loadingErrors); } @@ -316,7 +366,10 @@ public class RegistryDataLoader { @FunctionalInterface interface LoadingFunction { - void apply(RegistryDataLoader.Loader loader, RegistryOps.RegistryInfoLookup registryInfoLookup); + void apply(RegistryDataLoader.Loader loader, RegistryInfoLookup registryInfoLookup); + } + + public record NetworkedRegistryData(List elements, TagNetworkSerialization.NetworkPayload tags) { } public record RegistryData(ResourceKey> key, Codec elementCodec, boolean requiredNonEmpty) { diff --git a/net/minecraft/server/Bootstrap.java b/net/minecraft/server/Bootstrap.java index 29811ead..f973db2c 100644 --- a/net/minecraft/server/Bootstrap.java +++ b/net/minecraft/server/Bootstrap.java @@ -20,12 +20,13 @@ import net.minecraft.world.effect.MobEffect; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.ai.attributes.Attribute; import net.minecraft.world.entity.ai.attributes.DefaultAttributes; +import net.minecraft.world.flag.FeatureFlags; import net.minecraft.world.item.CreativeModeTabs; import net.minecraft.world.item.Item; import net.minecraft.world.level.GameRules; -import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.ComposterBlock; import net.minecraft.world.level.block.FireBlock; +import net.minecraft.world.level.block.state.BlockBehaviour; import org.slf4j.Logger; public class Bootstrap { @@ -76,7 +77,8 @@ public class Bootstrap { private static void checkGameruleTranslations(Set translations) { final Language language = Language.getInstance(); - GameRules.visitGameRuleTypes(new GameRules.GameRuleTypeVisitor() { + GameRules gameRules = new GameRules(FeatureFlags.REGISTRY.allFlags()); + gameRules.visitGameRuleTypes(new GameRules.GameRuleTypeVisitor() { @Override public > void visit(GameRules.Key key, GameRules.Type type) { if (!language.has(key.getDescriptionId())) { @@ -92,7 +94,7 @@ public class Bootstrap { checkTranslations(BuiltInRegistries.ENTITY_TYPE, EntityType::getDescriptionId, set); checkTranslations(BuiltInRegistries.MOB_EFFECT, MobEffect::getDescriptionId, set); checkTranslations(BuiltInRegistries.ITEM, Item::getDescriptionId, set); - checkTranslations(BuiltInRegistries.BLOCK, Block::getDescriptionId, set); + checkTranslations(BuiltInRegistries.BLOCK, BlockBehaviour::getDescriptionId, set); checkTranslations(BuiltInRegistries.CUSTOM_STAT, resourceLocation -> "stat." + resourceLocation.toString().replace(':', '.'), set); checkGameruleTranslations(set); return set; diff --git a/net/minecraft/server/Main.java b/net/minecraft/server/Main.java index 36b6af00..7ed4c44a 100644 --- a/net/minecraft/server/Main.java +++ b/net/minecraft/server/Main.java @@ -177,7 +177,7 @@ public class Main { executor -> WorldLoader.load( initConfig, dataLoadContext -> { - Registry registry = dataLoadContext.datapackDimensions().registryOrThrow(Registries.LEVEL_STEM); + Registry registry = dataLoadContext.datapackDimensions().lookupOrThrow(Registries.LEVEL_STEM); if (dynamic2 != null) { LevelDataAndDimensions levelDataAndDimensions = LevelStorageSource.getLevelDataAndDimensions( dynamic2, dataLoadContext.dataConfiguration(), registry, dataLoadContext.datapackWorldgen() @@ -200,7 +200,7 @@ public class Main { dedicatedServerProperties.hardcore, dedicatedServerProperties.difficulty, false, - new GameRules(), + new GameRules(dataLoadContext.dataConfiguration().enabledFeatures()), dataLoadContext.dataConfiguration() ); worldOptions = optionSet.has(optionSpec4) ? dedicatedServerProperties.worldOptions.withBonusChest(true) : dedicatedServerProperties.worldOptions; @@ -306,28 +306,30 @@ public class Main { boolean recreateRegionFiles ) { LOGGER.info("Forcing world upgrade!"); - WorldUpgrader worldUpgrader = new WorldUpgrader(levelStorage, dataFixer, registryAccess, eraseCache, recreateRegionFiles); - Component component = null; - while (!worldUpgrader.isFinished()) { - Component component2 = worldUpgrader.getStatus(); - if (component != component2) { - component = component2; - LOGGER.info(worldUpgrader.getStatus().getString()); - } + try (WorldUpgrader worldUpgrader = new WorldUpgrader(levelStorage, dataFixer, registryAccess, eraseCache, recreateRegionFiles)) { + Component component = null; - int i = worldUpgrader.getTotalChunks(); - if (i > 0) { - int j = worldUpgrader.getConverted() + worldUpgrader.getSkipped(); - LOGGER.info("{}% completed ({} / {} chunks)...", Mth.floor((float)j / i * 100.0F), j, i); - } + while (!worldUpgrader.isFinished()) { + Component component2 = worldUpgrader.getStatus(); + if (component != component2) { + component = component2; + LOGGER.info(worldUpgrader.getStatus().getString()); + } - if (!shouldContinue.getAsBoolean()) { - worldUpgrader.cancel(); - } else { - try { - Thread.sleep(1000L); - } catch (InterruptedException var11) { + int i = worldUpgrader.getTotalChunks(); + if (i > 0) { + int j = worldUpgrader.getConverted() + worldUpgrader.getSkipped(); + LOGGER.info("{}% completed ({} / {} chunks)...", Mth.floor((float)j / i * 100.0F), j, i); + } + + if (!shouldContinue.getAsBoolean()) { + worldUpgrader.cancel(); + } else { + try { + Thread.sleep(1000L); + } catch (InterruptedException var12) { + } } } } diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java index 182db043..24be9243 100644 --- a/net/minecraft/server/MinecraftServer.java +++ b/net/minecraft/server/MinecraftServer.java @@ -10,6 +10,8 @@ import com.mojang.authlib.GameProfile; import com.mojang.authlib.GameProfileRepository; import com.mojang.authlib.minecraft.MinecraftSessionService; import com.mojang.datafixers.DataFixer; +import com.mojang.jtracy.DiscontinuousFrame; +import com.mojang.jtracy.TracyClient; import com.mojang.logging.LogUtils; import it.unimi.dsi.fastutil.longs.LongIterator; import it.unimi.dsi.fastutil.objects.ObjectArrayList; @@ -29,7 +31,6 @@ import java.nio.file.Path; import java.security.KeyPair; import java.util.Arrays; import java.util.Collection; -import java.util.Collections; import java.util.Comparator; import java.util.Iterator; import java.util.List; @@ -44,6 +45,7 @@ import java.util.concurrent.CompletableFuture; import java.util.concurrent.Executor; import java.util.concurrent.RejectedExecutionException; import java.util.concurrent.atomic.AtomicReference; +import java.util.concurrent.locks.LockSupport; import java.util.function.BooleanSupplier; import java.util.function.Consumer; import java.util.function.Function; @@ -73,12 +75,17 @@ import net.minecraft.gametest.framework.GameTestTicker; import net.minecraft.network.chat.ChatDecorator; import net.minecraft.network.chat.ChatType; import net.minecraft.network.chat.Component; +import net.minecraft.network.protocol.PacketType; import net.minecraft.network.protocol.game.ClientboundChangeDifficultyPacket; import net.minecraft.network.protocol.game.ClientboundSetTimePacket; import net.minecraft.network.protocol.status.ServerStatus; +import net.minecraft.network.protocol.status.ServerStatus.Favicon; +import net.minecraft.network.protocol.status.ServerStatus.Players; +import net.minecraft.network.protocol.status.ServerStatus.Version; import net.minecraft.obfuscate.DontObfuscate; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.MinecraftServer.TimeProfiler.1; import net.minecraft.server.bossevents.CustomBossEvents; import net.minecraft.server.level.DemoMode; import net.minecraft.server.level.PlayerRespawnLogic; @@ -101,6 +108,7 @@ import net.minecraft.server.players.GameProfileCache; import net.minecraft.server.players.PlayerList; import net.minecraft.server.players.ServerOpListEntry; import net.minecraft.server.players.UserWhiteList; +import net.minecraft.tags.TagLoader; import net.minecraft.util.Crypt; import net.minecraft.util.CryptException; import net.minecraft.util.ModCheck; @@ -109,13 +117,14 @@ import net.minecraft.util.NativeModuleLister; import net.minecraft.util.RandomSource; import net.minecraft.util.SignatureValidator; import net.minecraft.util.TimeUtil; +import net.minecraft.util.NativeModuleLister.NativeModuleInfo; import net.minecraft.util.debugchart.RemoteDebugSampleType; import net.minecraft.util.debugchart.SampleLogger; import net.minecraft.util.debugchart.TpsDebugDimensions; import net.minecraft.util.profiling.EmptyProfileResults; import net.minecraft.util.profiling.ProfileResults; +import net.minecraft.util.profiling.Profiler; import net.minecraft.util.profiling.ProfilerFiller; -import net.minecraft.util.profiling.ResultField; import net.minecraft.util.profiling.SingleTickProfiler; import net.minecraft.util.profiling.jfr.JvmProfiler; import net.minecraft.util.profiling.jfr.callback.ProfiledDuration; @@ -146,8 +155,9 @@ import net.minecraft.world.level.LevelSettings; import net.minecraft.world.level.WorldDataConfiguration; import net.minecraft.world.level.biome.BiomeManager; import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.border.BorderChangeListener; +import net.minecraft.world.level.block.entity.FuelValues; import net.minecraft.world.level.border.WorldBorder; +import net.minecraft.world.level.border.BorderChangeListener.DelegateBorderChangeListener; import net.minecraft.world.level.chunk.storage.ChunkIOErrorReporter; import net.minecraft.world.level.chunk.storage.RegionStorageInfo; import net.minecraft.world.level.dimension.LevelStem; @@ -171,7 +181,7 @@ import net.minecraft.world.phys.Vec3; import org.jetbrains.annotations.Nullable; import org.slf4j.Logger; -public abstract class MinecraftServer extends ReentrantBlockableEventLoop implements ServerInfo, ChunkIOErrorReporter, CommandSource, AutoCloseable { +public abstract class MinecraftServer extends ReentrantBlockableEventLoop implements ServerInfo, ChunkIOErrorReporter, CommandSource { private static final Logger LOGGER = LogUtils.getLogger(); public static final String VANILLA_BRAND = "vanilla"; private static final float AVERAGE_TICK_TIME_SMOOTHING = 0.8F; @@ -189,14 +199,13 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop tickables = Lists.newArrayList(); private MetricsRecorder metricsRecorder = InactiveMetricsRecorder.INSTANCE; - private ProfilerFiller profiler = this.metricsRecorder.getProfiler(); private Consumer onMetricsRecordingStopped = profileResults -> this.stopRecordingMetrics(); private Consumer onMetricsRecordingFinished = path -> {}; private boolean willStartRecordingMetrics; @@ -208,7 +217,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop fatalException = new AtomicReference(); + private final SuppressedExceptionCollector suppressedExceptions = new SuppressedExceptionCollector(); + private final DiscontinuousFrame tickFrame; public static S spin(Function threadFunction) { AtomicReference atomicReference = new AtomicReference(); @@ -292,7 +306,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop holderGetter = this.registries - .compositeAccess() - .registryOrThrow(Registries.BLOCK) - .asLookup() - .filterFeatures(this.worldData.enabledFeatures()); + HolderGetter holderGetter = this.registries.compositeAccess().lookupOrThrow(Registries.BLOCK).filterFeatures(this.worldData.enabledFeatures()); this.structureTemplateManager = new StructureTemplateManager(worldStem.resourceManager(), storageSource, fixerUpper, holderGetter); this.serverThread = serverThread; this.executor = Util.backgroundExecutor(); this.potionBrewing = PotionBrewing.bootstrap(this.worldData.enabledFeatures()); + this.resources.managers.getRecipeManager().finalizeRecipeLoading(this.worldData.enabledFeatures()); + this.fuelValues = FuelValues.vanillaBurnTimes(this.registries.compositeAccess(), this.worldData.enabledFeatures()); + this.tickFrame = TracyClient.createDiscontinuousFrame("Server Tick"); } } @@ -361,14 +374,14 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop registry = this.registries.compositeAccess().registryOrThrow(Registries.LEVEL_STEM); + Registry registry = this.registries.compositeAccess().lookupOrThrow(Registries.LEVEL_STEM); WorldOptions worldOptions = this.worldData.worldGenOptions(); long l = worldOptions.seed(); long m = BiomeManager.obfuscateSeed(l); List list = ImmutableList.of( new PhantomSpawner(), new PatrolSpawner(), new CatSpawner(), new VillageSiege(), new WanderingTraderSpawner(serverLevelData) ); - LevelStem levelStem = registry.get(LevelStem.OVERWORLD); + LevelStem levelStem = registry.getValue(LevelStem.OVERWORLD); ServerLevel serverLevel = new ServerLevel( this, this.executor, this.storageSource, serverLevelData, Level.OVERWORLD, levelStem, listener, bl, m, list, true, null ); @@ -424,7 +437,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop registry.getHolder(MiscOverworldFeatures.BONUS_CHEST)) + .lookup(Registries.CONFIGURED_FEATURE) + .flatMap(registry -> registry.get(MiscOverworldFeatures.BONUS_CHEST)) .ifPresent(reference -> ((ConfiguredFeature)reference.value()).place(level, serverChunkCache.getGenerator(), level.random, levelData.getSpawnPos())); } } @@ -687,7 +700,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop false : this::haveTime); - this.profiler.popPush("nextTickWait"); - this.mayHaveDelayedTasks = true; - this.delayedTasksMaxNextTickTimeNanos = Math.max(Util.getNanos() + l, this.nextTickTimeNanos); - this.startMeasuringTaskExecutionTime(); - this.waitUntilNextTick(); - this.finishMeasuringTaskExecutionTime(); - if (bl) { - this.tickRateManager.endTickWork(); + + try (Profiler.Scope scope = Profiler.use(this.createProfiler())) { + ProfilerFiller profilerFiller = Profiler.get(); + profilerFiller.push("tick"); + this.tickFrame.start(); + this.tickServer(bl ? () -> false : this::haveTime); + this.tickFrame.end(); + profilerFiller.popPush("nextTickWait"); + this.mayHaveDelayedTasks = true; + this.delayedTasksMaxNextTickTimeNanos = Math.max(Util.getNanos() + l, this.nextTickTimeNanos); + this.startMeasuringTaskExecutionTime(); + this.waitUntilNextTick(); + this.finishMeasuringTaskExecutionTime(); + if (bl) { + this.tickRateManager.endTickWork(); + } + + profilerFiller.pop(); + this.logFullTickTime(); + } finally { + this.endMetricsRecordingTick(); } - this.profiler.pop(); - this.logFullTickTime(); - this.endMetricsRecordingTick(); this.isReady = true; JvmProfiler.INSTANCE.onServerTick(this.smoothedTickTimeMillis); } - } catch (Throwable var46) { - LOGGER.error("Encountered an unexpected exception", var46); - CrashReport crashReport = constructOrExtractCrashReport(var46); + } catch (Throwable var69) { + LOGGER.error("Encountered an unexpected exception", var69); + CrashReport crashReport = constructOrExtractCrashReport(var69); this.fillSystemReport(crashReport.getSystemReport()); Path path = this.getServerDirectory().resolve("crash-reports").resolve("crash-" + Util.getFilenameFormattedDateTime() + "-server.txt"); if (crashReport.saveToFile(path, ReportType.CRASH)) { @@ -749,8 +769,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop !this.haveTime()); + this.waitingForNextTick = true; + + try { + this.managedBlock(() -> !this.haveTime()); + } finally { + this.waitingForNextTick = false; + } } @Override public void waitForTasks() { boolean bl = this.isTickTimeLoggingEnabled(); long l = bl ? Util.getNanos() : 0L; - super.waitForTasks(); + long m = this.waitingForNextTick ? this.nextTickTimeNanos - Util.getNanos() : 100000L; + LockSupport.parkNanos("waiting for tasks", m); if (bl) { this.idleTimeNanos = this.idleTimeNanos + (Util.getNanos() - l); } } - protected TickTask wrapRunnable(Runnable runnable) { + public TickTask wrapRunnable(Runnable runnable) { return new TickTask(this.tickCount, runnable); } @@ -879,11 +906,11 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop loadStatusIcon() { + private Optional loadStatusIcon() { Optional optional = Optional.of(this.getFile("server-icon.png")) .filter(path -> Files.isRegularFile(path, new LinkOption[0])) .or(() -> this.storageSource.getIconFile().filter(path -> Files.isRegularFile(path, new LinkOption[0]))); @@ -894,7 +921,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop 0) { + if (this.playerList.getPlayerCount() == 0 && !this.tickRateManager.isSprinting()) { + this.emptyTicks++; + } else { + this.emptyTicks = 0; + } + + if (this.emptyTicks >= i) { + if (this.emptyTicks == i) { + LOGGER.info("Server empty for {} seconds, pausing", this.pauseWhileEmptySeconds()); + this.autoSave(); + } + + this.tickConnection(); + return; + } + } + this.tickCount++; this.tickRateManager.tick(); this.tickChildren(hasTimeLeft); @@ -941,23 +987,29 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop list = this.playerList.getPlayers(); int i = this.getMaxPlayers(); if (this.hidesOnlinePlayers()) { - return new ServerStatus.Players(i, list.size(), List.of()); + return new Players(i, list.size(), List.of()); } else { int j = Math.min(list.size(), 12); ObjectArrayList objectArrayList = new ObjectArrayList<>(j); @@ -1017,60 +1065,65 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop serverPlayerx.connection.suspendFlushing()); - this.profiler.push("commandFunctions"); + profilerFiller.push("commandFunctions"); this.getFunctions().tick(); - this.profiler.popPush("levels"); + profilerFiller.popPush("levels"); for (ServerLevel serverLevel : this.getAllLevels()) { - this.profiler.push((Supplier)(() -> serverLevel + " " + serverLevel.dimension().location())); + profilerFiller.push((Supplier)(() -> serverLevel + " " + serverLevel.dimension().location())); if (this.tickCount % 20 == 0) { - this.profiler.push("timeSync"); + profilerFiller.push("timeSync"); this.synchronizeTime(serverLevel); - this.profiler.pop(); + profilerFiller.pop(); } - this.profiler.push("tick"); + profilerFiller.push("tick"); try { serverLevel.tick(hasTimeLeft); - } catch (Throwable var6) { - CrashReport crashReport = CrashReport.forThrowable(var6, "Exception ticking world"); + } catch (Throwable var7) { + CrashReport crashReport = CrashReport.forThrowable(var7, "Exception ticking world"); serverLevel.fillReportDetails(crashReport); throw new ReportedException(crashReport); } - this.profiler.pop(); - this.profiler.pop(); + profilerFiller.pop(); + profilerFiller.pop(); } - this.profiler.popPush("connection"); - this.getConnection().tick(); - this.profiler.popPush("players"); + profilerFiller.popPush("connection"); + this.tickConnection(); + profilerFiller.popPush("players"); this.playerList.tick(); if (SharedConstants.IS_RUNNING_IN_IDE && this.tickRateManager.runsNormally()) { GameTestTicker.SINGLETON.tick(); } - this.profiler.popPush("server gui refresh"); + profilerFiller.popPush("server gui refresh"); for (int i = 0; i < this.tickables.size(); i++) { ((Runnable)this.tickables.get(i)).run(); } - this.profiler.popPush("send chunks"); + profilerFiller.popPush("send chunks"); for (ServerPlayer serverPlayer : this.playerList.getPlayers()) { serverPlayer.connection.chunkSender.sendNextChunks(serverPlayer); serverPlayer.connection.resumeFlushing(); } - this.profiler.pop(); + profilerFiller.pop(); + } + + public void tickConnection() { + this.getConnection().tick(); } private void synchronizeTime(ServerLevel level) { @@ -1081,13 +1134,14 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop)(() -> this.worldData.worldGenSettingsLifecycle().toString())); systemReport.setDetail("World Seed", (Supplier)(() -> String.valueOf(this.worldData.worldGenOptions().seed()))); + systemReport.setDetail("Suppressed Exceptions", this.suppressedExceptions::dump); if (this.serverId != null) { systemReport.setDetail("Server Id", (Supplier)(() -> this.serverId)); } @@ -1250,7 +1305,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop { CloseableResourceManager closeableResourceManager = new MultiPackResourceManager(PackType.SERVER_DATA, immutableList); + List> list = TagLoader.loadTagsForExistingRegistries(closeableResourceManager, this.registries.compositeAccess()); return ReloadableServerResources.loadResources( closeableResourceManager, this.registries, + list, this.worldData.enabledFeatures(), this.isDedicatedServer() ? Commands.CommandSelection.DEDICATED : Commands.CommandSelection.INTEGRATED, this.getFunctionCompilationLevel(), @@ -1547,11 +1596,13 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop list = Lists.newArrayList(); final GameRules gameRules = this.getGameRules(); - GameRules.visitGameRuleTypes(new GameRules.GameRuleTypeVisitor() { + gameRules.visitGameRuleTypes(new GameRules.GameRuleTypeVisitor() { @Override public > void visit(GameRules.Key key, GameRules.Type type) { list.add(String.format(Locale.ROOT, "%s=%s\n", key.getId(), gameRules.getRule(key))); @@ -1927,9 +1974,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop list; + List list; try { - list = Lists.newArrayList(NativeModuleLister.listModules()); + list = Lists.newArrayList(NativeModuleLister.listModules()); } catch (Throwable var7) { LOGGER.warn("Failed to list native modules", var7); break label50; @@ -1943,7 +1990,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop packetType) { + this.suppressedExceptions.addEntry("packet/" + packetType.toString(), throwable); + } + public PotionBrewing potionBrewing() { return this.potionBrewing; } + public FuelValues fuelValues() { + return this.fuelValues; + } + public ServerLinks serverLinks() { return ServerLinks.EMPTY; } + protected int pauseWhileEmptySeconds() { + return 0; + } + record ReloadableResources(CloseableResourceManager resourceManager, ReloadableServerResources managers) implements AutoCloseable { public void close() { @@ -2186,42 +2244,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop getTimes(String sectionPath) { - return Collections.emptyList(); - } - - @Override - public boolean saveResults(Path path) { - return false; - } - - @Override - public long getStartTimeNano() { - return TimeProfiler.this.startNanos; - } - - @Override - public int getStartTimeTicks() { - return TimeProfiler.this.startTick; - } - - @Override - public long getEndTimeNano() { - return endTimeNano; - } - - @Override - public int getEndTimeTicks() { - return endTimeTicks; - } - - @Override - public String getProfilerResults() { - return ""; - } - }; + return new 1(this, endTimeNano, endTimeTicks); } } } diff --git a/net/minecraft/server/PlayerAdvancements.java b/net/minecraft/server/PlayerAdvancements.java index dad36333..424a88d3 100644 --- a/net/minecraft/server/PlayerAdvancements.java +++ b/net/minecraft/server/PlayerAdvancements.java @@ -34,6 +34,7 @@ import net.minecraft.advancements.Criterion; import net.minecraft.advancements.CriterionProgress; import net.minecraft.advancements.CriterionTrigger; import net.minecraft.advancements.CriterionTriggerInstance; +import net.minecraft.advancements.CriterionTrigger.Listener; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.network.protocol.game.ClientboundSelectAdvancementsTabPacket; import net.minecraft.network.protocol.game.ClientboundUpdateAdvancementsPacket; @@ -205,7 +206,7 @@ public class PlayerAdvancements { if (!bl2 && advancementProgress.isDone()) { advancement.value().rewards().grant(this.player); advancement.value().display().ifPresent(displayInfo -> { - if (displayInfo.shouldAnnounceChat() && this.player.level().getGameRules().getBoolean(GameRules.RULE_ANNOUNCE_ADVANCEMENTS)) { + if (displayInfo.shouldAnnounceChat() && this.player.serverLevel().getGameRules().getBoolean(GameRules.RULE_ANNOUNCE_ADVANCEMENTS)) { this.playerList.broadcastSystemMessage(displayInfo.getType().createAnnouncement(advancement, this.player), false); } }); @@ -256,7 +257,7 @@ public class PlayerAdvancements { } private void registerListener(AdvancementHolder advancement, String criterionKey, Criterion criterion) { - criterion.trigger().addPlayerListener(this, new CriterionTrigger.Listener<>(criterion.triggerInstance(), advancement, criterionKey)); + criterion.trigger().addPlayerListener(this, new Listener<>(criterion.triggerInstance(), advancement, criterionKey)); } private void unregisterListeners(AdvancementHolder advancement) { @@ -271,7 +272,7 @@ public class PlayerAdvancements { } private void removeListener(AdvancementHolder advancement, String criterionKey, Criterion criterion) { - criterion.trigger().removePlayerListener(this, new CriterionTrigger.Listener<>(criterion.triggerInstance(), advancement, criterionKey)); + criterion.trigger().removePlayerListener(this, new Listener<>(criterion.triggerInstance(), advancement, criterionKey)); } public void flushDirty(ServerPlayer serverPlayer) { diff --git a/net/minecraft/server/ReloadableServerRegistries.java b/net/minecraft/server/ReloadableServerRegistries.java index cb90ac50..0eafe83d 100644 --- a/net/minecraft/server/ReloadableServerRegistries.java +++ b/net/minecraft/server/ReloadableServerRegistries.java @@ -1,7 +1,5 @@ package net.minecraft.server; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; import com.google.gson.JsonElement; import com.mojang.logging.LogUtils; import com.mojang.serialization.JsonOps; @@ -29,8 +27,8 @@ import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.packs.resources.ResourceManager; import net.minecraft.server.packs.resources.SimpleJsonResourceReloadListener; -import net.minecraft.util.ProblemReporter; -import net.minecraft.world.level.storage.loot.BuiltInLootTables; +import net.minecraft.tags.TagLoader; +import net.minecraft.util.ProblemReporter.Collector; import net.minecraft.world.level.storage.loot.LootDataType; import net.minecraft.world.level.storage.loot.LootTable; import net.minecraft.world.level.storage.loot.ValidationContext; @@ -39,99 +37,86 @@ import org.slf4j.Logger; public class ReloadableServerRegistries { private static final Logger LOGGER = LogUtils.getLogger(); - private static final Gson GSON = new GsonBuilder().create(); private static final RegistrationInfo DEFAULT_REGISTRATION_INFO = new RegistrationInfo(Optional.empty(), Lifecycle.experimental()); - public static CompletableFuture> reload( - LayeredRegistryAccess registries, ResourceManager resourceManager, Executor backgroundExecutor + public static CompletableFuture reload( + LayeredRegistryAccess layeredRegistryAccess, List> list, ResourceManager resourceManager, Executor executor ) { - RegistryAccess.Frozen frozen = registries.getAccessForLoading(RegistryLayer.RELOADABLE); - RegistryOps registryOps = new ReloadableServerRegistries.EmptyTagLookupWrapper(frozen).createSerializationContext(JsonOps.INSTANCE); - List>> list = LootDataType.values() - .map(lootDataType -> scheduleElementParse(lootDataType, registryOps, resourceManager, backgroundExecutor)) + List> list2 = TagLoader.buildUpdatedLookups(layeredRegistryAccess.getAccessForLoading(RegistryLayer.RELOADABLE), list); + HolderLookup.Provider provider = HolderLookup.Provider.create(list2.stream()); + RegistryOps registryOps = provider.createSerializationContext(JsonOps.INSTANCE); + List>> list3 = LootDataType.values() + .map(lootDataType -> scheduleRegistryLoad(lootDataType, registryOps, resourceManager, executor)) .toList(); - CompletableFuture>> completableFuture = Util.sequence(list); - return completableFuture.thenApplyAsync(listx -> apply(registries, listx), backgroundExecutor); + CompletableFuture>> completableFuture = Util.sequence(list3); + return completableFuture.thenApplyAsync(listx -> createAndValidateFullContext(layeredRegistryAccess, provider, listx), executor); } - private static CompletableFuture> scheduleElementParse( - LootDataType lootDataType, RegistryOps registryOps, ResourceManager resourceManager, Executor backgroundExecutor + private static CompletableFuture> scheduleRegistryLoad( + LootDataType lootDataType, RegistryOps registryOps, ResourceManager resourceManager, Executor executor ) { return CompletableFuture.supplyAsync( () -> { WritableRegistry writableRegistry = new MappedRegistry<>(lootDataType.registryKey(), Lifecycle.experimental()); - Map map = new HashMap(); + Map map = new HashMap(); String string = Registries.elementsDirPath(lootDataType.registryKey()); - SimpleJsonResourceReloadListener.scanDirectory(resourceManager, string, GSON, map); + SimpleJsonResourceReloadListener.scanDirectory(resourceManager, string, registryOps, lootDataType.codec(), map); map.forEach( - (resourceLocation, jsonElement) -> lootDataType.deserialize(resourceLocation, registryOps, jsonElement) - .ifPresent(object -> writableRegistry.register(ResourceKey.create(lootDataType.registryKey(), resourceLocation), (T)object, DEFAULT_REGISTRATION_INFO)) + (resourceLocation, object) -> writableRegistry.register( + ResourceKey.create(lootDataType.registryKey(), resourceLocation), (T)object, DEFAULT_REGISTRATION_INFO + ) ); + TagLoader.loadTagsForRegistry(resourceManager, writableRegistry); return writableRegistry; }, - backgroundExecutor + executor ); } - private static LayeredRegistryAccess apply(LayeredRegistryAccess registryAccess, List> registries) { - LayeredRegistryAccess layeredRegistryAccess = createUpdatedRegistries(registryAccess, registries); - ProblemReporter.Collector collector = new ProblemReporter.Collector(); - RegistryAccess.Frozen frozen = layeredRegistryAccess.compositeAccess(); - ValidationContext validationContext = new ValidationContext(collector, LootContextParamSets.ALL_PARAMS, frozen.asGetterLookup()); - LootDataType.values().forEach(lootDataType -> validateRegistry(validationContext, lootDataType, frozen)); + private static ReloadableServerRegistries.LoadResult createAndValidateFullContext( + LayeredRegistryAccess layeredRegistryAccess, HolderLookup.Provider provider, List> list + ) { + LayeredRegistryAccess layeredRegistryAccess2 = createUpdatedRegistries(layeredRegistryAccess, list); + HolderLookup.Provider provider2 = concatenateLookups(provider, layeredRegistryAccess2.getLayer(RegistryLayer.RELOADABLE)); + validateLootRegistries(provider2); + return new ReloadableServerRegistries.LoadResult(layeredRegistryAccess2, provider2); + } + + private static HolderLookup.Provider concatenateLookups(HolderLookup.Provider provider, HolderLookup.Provider provider2) { + return HolderLookup.Provider.create(Stream.concat(provider.listRegistries(), provider2.listRegistries())); + } + + private static void validateLootRegistries(HolderLookup.Provider provider) { + Collector collector = new Collector(); + ValidationContext validationContext = new ValidationContext(collector, LootContextParamSets.ALL_PARAMS, provider); + LootDataType.values().forEach(lootDataType -> validateRegistry(validationContext, lootDataType, provider)); collector.get().forEach((string, string2) -> LOGGER.warn("Found loot table element validation problem in {}: {}", string, string2)); - return layeredRegistryAccess; } private static LayeredRegistryAccess createUpdatedRegistries( LayeredRegistryAccess registryAccess, List> registries ) { - RegistryAccess registryAccess2 = new RegistryAccess.ImmutableRegistryAccess(registries); - ((WritableRegistry)registryAccess2.registryOrThrow(Registries.LOOT_TABLE)) - .register(BuiltInLootTables.EMPTY, LootTable.EMPTY, DEFAULT_REGISTRATION_INFO); - return registryAccess.replaceFrom(RegistryLayer.RELOADABLE, registryAccess2.freeze()); + return registryAccess.replaceFrom(RegistryLayer.RELOADABLE, new RegistryAccess.ImmutableRegistryAccess(registries).freeze()); } - private static void validateRegistry(ValidationContext context, LootDataType lootDataType, RegistryAccess registryAccess) { - Registry registry = registryAccess.registryOrThrow(lootDataType.registryKey()); - registry.holders().forEach(reference -> lootDataType.runValidation(context, reference.key(), (T)reference.value())); - } - - static class EmptyTagLookupWrapper implements HolderLookup.Provider { - private final RegistryAccess registryAccess; - - EmptyTagLookupWrapper(RegistryAccess registryAccess) { - this.registryAccess = registryAccess; - } - - @Override - public Stream>> listRegistries() { - return this.registryAccess.listRegistries(); - } - - @Override - public Optional> lookup(ResourceKey> registryKey) { - return this.registryAccess.registry(registryKey).map(Registry::asTagAddingLookup); - } + private static void validateRegistry(ValidationContext validationContext, LootDataType lootDataType, HolderLookup.Provider provider) { + HolderLookup holderLookup = provider.lookupOrThrow(lootDataType.registryKey()); + holderLookup.listElements().forEach(reference -> lootDataType.runValidation(validationContext, reference.key(), (T)reference.value())); } public static class Holder { - private final RegistryAccess.Frozen registries; + private final HolderLookup.Provider registries; - public Holder(RegistryAccess.Frozen registries) { - this.registries = registries; - } - - public RegistryAccess.Frozen get() { - return this.registries; + public Holder(HolderLookup.Provider provider) { + this.registries = provider; } public HolderGetter.Provider lookup() { - return this.registries.asGetterLookup(); + return this.registries; } public Collection getKeys(ResourceKey> registryKey) { - return this.registries.registry(registryKey).stream().flatMap(registry -> registry.holders().map(reference -> reference.key().location())).toList(); + return this.registries.lookupOrThrow(registryKey).listElementIds().map(ResourceKey::location).toList(); } public LootTable getLootTable(ResourceKey lootTableKey) { @@ -142,4 +127,7 @@ public class ReloadableServerRegistries { .orElse(LootTable.EMPTY); } } + + public record LoadResult(LayeredRegistryAccess layers, HolderLookup.Provider lookupWithUpdatedTags) { + } } diff --git a/net/minecraft/server/ReloadableServerResources.java b/net/minecraft/server/ReloadableServerResources.java index f29b83eb..ca552015 100644 --- a/net/minecraft/server/ReloadableServerResources.java +++ b/net/minecraft/server/ReloadableServerResources.java @@ -1,57 +1,46 @@ package net.minecraft.server; import com.mojang.logging.LogUtils; -import java.util.Collection; import java.util.List; -import java.util.Map; -import java.util.Optional; import java.util.concurrent.CompletableFuture; import java.util.concurrent.Executor; -import java.util.stream.Collectors; -import java.util.stream.Stream; import net.minecraft.commands.CommandBuildContext; import net.minecraft.commands.Commands; -import net.minecraft.core.Holder; import net.minecraft.core.HolderLookup; import net.minecraft.core.LayeredRegistryAccess; import net.minecraft.core.Registry; -import net.minecraft.core.RegistryAccess; -import net.minecraft.resources.ResourceKey; -import net.minecraft.resources.ResourceLocation; import net.minecraft.server.packs.resources.PreparableReloadListener; import net.minecraft.server.packs.resources.ResourceManager; import net.minecraft.server.packs.resources.SimpleReloadInstance; -import net.minecraft.tags.TagKey; -import net.minecraft.tags.TagManager; import net.minecraft.util.Unit; import net.minecraft.world.flag.FeatureFlagSet; import net.minecraft.world.item.crafting.RecipeManager; -import net.minecraft.world.level.block.Blocks; -import net.minecraft.world.level.block.entity.AbstractFurnaceBlockEntity; import org.slf4j.Logger; public class ReloadableServerResources { private static final Logger LOGGER = LogUtils.getLogger(); private static final CompletableFuture DATA_RELOAD_INITIAL_TASK = CompletableFuture.completedFuture(Unit.INSTANCE); private final ReloadableServerRegistries.Holder fullRegistryHolder; - private final ReloadableServerResources.ConfigurableRegistryLookup registryLookup; private final Commands commands; private final RecipeManager recipes; - private final TagManager tagManager; private final ServerAdvancementManager advancements; private final ServerFunctionLibrary functionLibrary; + private final List> postponedTags; private ReloadableServerResources( - RegistryAccess.Frozen registryAccess, FeatureFlagSet enabledFeatures, Commands.CommandSelection commandSelection, int functionCompilationLevel + LayeredRegistryAccess layeredRegistryAccess, + HolderLookup.Provider provider, + FeatureFlagSet featureFlagSet, + Commands.CommandSelection commandSelection, + List> list, + int i ) { - this.fullRegistryHolder = new ReloadableServerRegistries.Holder(registryAccess); - this.registryLookup = new ReloadableServerResources.ConfigurableRegistryLookup(registryAccess); - this.registryLookup.missingTagAccessPolicy(ReloadableServerResources.MissingTagAccessPolicy.CREATE_NEW); - this.recipes = new RecipeManager(this.registryLookup); - this.tagManager = new TagManager(registryAccess); - this.commands = new Commands(commandSelection, CommandBuildContext.simple(this.registryLookup, enabledFeatures)); - this.advancements = new ServerAdvancementManager(this.registryLookup); - this.functionLibrary = new ServerFunctionLibrary(functionCompilationLevel, this.commands.getDispatcher()); + this.fullRegistryHolder = new ReloadableServerRegistries.Holder(layeredRegistryAccess.compositeAccess()); + this.postponedTags = list; + this.recipes = new RecipeManager(provider); + this.commands = new Commands(commandSelection, CommandBuildContext.simple(provider, featureFlagSet)); + this.advancements = new ServerAdvancementManager(provider); + this.functionLibrary = new ServerFunctionLibrary(i, this.commands.getDispatcher()); } public ServerFunctionLibrary getFunctionLibrary() { @@ -75,90 +64,35 @@ public class ReloadableServerResources { } public List listeners() { - return List.of(this.tagManager, this.recipes, this.functionLibrary, this.advancements); + return List.of(this.recipes, this.functionLibrary, this.advancements); } public static CompletableFuture loadResources( ResourceManager resourceManager, - LayeredRegistryAccess registries, - FeatureFlagSet enabledFeatures, + LayeredRegistryAccess layeredRegistryAccess, + List> list, + FeatureFlagSet featureFlagSet, Commands.CommandSelection commandSelection, - int functionCompilationLevel, - Executor backgroundExecutor, - Executor gameExecutor + int i, + Executor executor, + Executor executor2 ) { - return ReloadableServerRegistries.reload(registries, resourceManager, backgroundExecutor) + return ReloadableServerRegistries.reload(layeredRegistryAccess, list, resourceManager, executor) .thenCompose( - layeredRegistryAccess -> { + loadResult -> { ReloadableServerResources reloadableServerResources = new ReloadableServerResources( - layeredRegistryAccess.compositeAccess(), enabledFeatures, commandSelection, functionCompilationLevel + loadResult.layers(), loadResult.lookupWithUpdatedTags(), featureFlagSet, commandSelection, list, i ); return SimpleReloadInstance.create( - resourceManager, reloadableServerResources.listeners(), backgroundExecutor, gameExecutor, DATA_RELOAD_INITIAL_TASK, LOGGER.isDebugEnabled() + resourceManager, reloadableServerResources.listeners(), executor, executor2, DATA_RELOAD_INITIAL_TASK, LOGGER.isDebugEnabled() ) .done() - .whenComplete( - (object, throwable) -> reloadableServerResources.registryLookup.missingTagAccessPolicy(ReloadableServerResources.MissingTagAccessPolicy.FAIL) - ) .thenApply(object -> reloadableServerResources); } ); } - public void updateRegistryTags() { - this.tagManager.getResult().forEach(loadResult -> updateRegistryTags(this.fullRegistryHolder.get(), loadResult)); - AbstractFurnaceBlockEntity.invalidateCache(); - Blocks.rebuildCache(); - } - - private static void updateRegistryTags(RegistryAccess registryAccess, TagManager.LoadResult loadResult) { - ResourceKey> resourceKey = loadResult.key(); - Map, List>> map = (Map, List>>)loadResult.tags() - .entrySet() - .stream() - .collect( - Collectors.toUnmodifiableMap(entry -> TagKey.create(resourceKey, (ResourceLocation)entry.getKey()), entry -> List.copyOf((Collection)entry.getValue())) - ); - registryAccess.registryOrThrow(resourceKey).bindTags(map); - } - - static class ConfigurableRegistryLookup implements HolderLookup.Provider { - private final RegistryAccess registryAccess; - ReloadableServerResources.MissingTagAccessPolicy missingTagAccessPolicy = ReloadableServerResources.MissingTagAccessPolicy.FAIL; - - ConfigurableRegistryLookup(RegistryAccess registryAccess) { - this.registryAccess = registryAccess; - } - - public void missingTagAccessPolicy(ReloadableServerResources.MissingTagAccessPolicy missingTagAccessPolicy) { - this.missingTagAccessPolicy = missingTagAccessPolicy; - } - - @Override - public Stream>> listRegistries() { - return this.registryAccess.listRegistries(); - } - - @Override - public Optional> lookup(ResourceKey> registryKey) { - return this.registryAccess.registry(registryKey).map(registry -> this.createDispatchedLookup(registry.asLookup(), registry.asTagAddingLookup())); - } - - private HolderLookup.RegistryLookup createDispatchedLookup(HolderLookup.RegistryLookup lookup, HolderLookup.RegistryLookup tagAddingLookup) { - return new HolderLookup.RegistryLookup.Delegate() { - @Override - public HolderLookup.RegistryLookup parent() { - return switch (ConfigurableRegistryLookup.this.missingTagAccessPolicy) { - case CREATE_NEW -> tagAddingLookup; - case FAIL -> lookup; - }; - } - }; - } - } - - static enum MissingTagAccessPolicy { - CREATE_NEW, - FAIL; + public void updateStaticRegistryTags() { + this.postponedTags.forEach(Registry.PendingTags::apply); } } diff --git a/net/minecraft/server/ServerAdvancementManager.java b/net/minecraft/server/ServerAdvancementManager.java index 8d90b7ef..69cd6329 100644 --- a/net/minecraft/server/ServerAdvancementManager.java +++ b/net/minecraft/server/ServerAdvancementManager.java @@ -2,12 +2,7 @@ package net.minecraft.server; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap.Builder; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonElement; -import com.google.gson.JsonParseException; import com.mojang.logging.LogUtils; -import com.mojang.serialization.JsonOps; import java.util.Collection; import java.util.Map; import net.minecraft.advancements.Advancement; @@ -17,38 +12,30 @@ import net.minecraft.advancements.AdvancementTree; import net.minecraft.advancements.TreeNodePosition; import net.minecraft.core.HolderLookup; import net.minecraft.core.registries.Registries; -import net.minecraft.resources.RegistryOps; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.packs.resources.ResourceManager; import net.minecraft.server.packs.resources.SimpleJsonResourceReloadListener; -import net.minecraft.util.ProblemReporter; +import net.minecraft.util.ProblemReporter.Collector; import net.minecraft.util.profiling.ProfilerFiller; import org.jetbrains.annotations.Nullable; import org.slf4j.Logger; -public class ServerAdvancementManager extends SimpleJsonResourceReloadListener { +public class ServerAdvancementManager extends SimpleJsonResourceReloadListener { private static final Logger LOGGER = LogUtils.getLogger(); - private static final Gson GSON = new GsonBuilder().create(); private Map advancements = Map.of(); private AdvancementTree tree = new AdvancementTree(); private final HolderLookup.Provider registries; public ServerAdvancementManager(HolderLookup.Provider registries) { - super(GSON, Registries.elementsDirPath(Registries.ADVANCEMENT)); + super(registries, Advancement.CODEC, Registries.elementsDirPath(Registries.ADVANCEMENT)); this.registries = registries; } - protected void apply(Map object, ResourceManager resourceManager, ProfilerFiller profiler) { - RegistryOps registryOps = this.registries.createSerializationContext(JsonOps.INSTANCE); + protected void apply(Map object, ResourceManager resourceManager, ProfilerFiller profiler) { Builder builder = ImmutableMap.builder(); - object.forEach((resourceLocation, jsonElement) -> { - try { - Advancement advancement = Advancement.CODEC.parse(registryOps, jsonElement).getOrThrow(JsonParseException::new); - this.validate(resourceLocation, advancement); - builder.put(resourceLocation, new AdvancementHolder(resourceLocation, advancement)); - } catch (Exception var6x) { - LOGGER.error("Parsing error loading custom advancement {}: {}", resourceLocation, var6x.getMessage()); - } + object.forEach((resourceLocation, advancement) -> { + this.validate(resourceLocation, advancement); + builder.put(resourceLocation, new AdvancementHolder(resourceLocation, advancement)); }); this.advancements = builder.buildOrThrow(); AdvancementTree advancementTree = new AdvancementTree(); @@ -64,8 +51,8 @@ public class ServerAdvancementManager extends SimpleJsonResourceReloadListener { } private void validate(ResourceLocation location, Advancement advancement) { - ProblemReporter.Collector collector = new ProblemReporter.Collector(); - advancement.validate(collector, this.registries.asGetterLookup()); + Collector collector = new Collector(); + advancement.validate(collector, this.registries); collector.getReport().ifPresent(string -> LOGGER.warn("Found validation problems in advancement {}: \n{}", location, string)); } diff --git a/net/minecraft/server/ServerFunctionLibrary.java b/net/minecraft/server/ServerFunctionLibrary.java index e1352e6b..5b4d6f09 100644 --- a/net/minecraft/server/ServerFunctionLibrary.java +++ b/net/minecraft/server/ServerFunctionLibrary.java @@ -8,7 +8,6 @@ import com.mojang.datafixers.util.Pair; import com.mojang.logging.LogUtils; import java.io.BufferedReader; import java.io.IOException; -import java.util.Collection; import java.util.List; import java.util.Map; import java.util.Optional; @@ -29,7 +28,6 @@ import net.minecraft.server.packs.resources.PreparableReloadListener; import net.minecraft.server.packs.resources.Resource; import net.minecraft.server.packs.resources.ResourceManager; import net.minecraft.tags.TagLoader; -import net.minecraft.util.profiling.ProfilerFiller; import net.minecraft.world.phys.Vec2; import net.minecraft.world.phys.Vec3; import org.slf4j.Logger; @@ -41,8 +39,10 @@ public class ServerFunctionLibrary implements PreparableReloadListener { ); private static final FileToIdConverter LISTER = new FileToIdConverter(Registries.elementsDirPath(TYPE_KEY), ".mcfunction"); private volatile Map> functions = ImmutableMap.of(); - private final TagLoader> tagsLoader = new TagLoader<>(this::getFunction, Registries.tagsDirPath(TYPE_KEY)); - private volatile Map>> tags = Map.of(); + private final TagLoader> tagsLoader = new TagLoader<>( + (resourceLocation, bl) -> this.getFunction(resourceLocation), Registries.tagsDirPath(TYPE_KEY) + ); + private volatile Map>> tags = Map.of(); private final int functionCompilationLevel; private final CommandDispatcher dispatcher; @@ -54,8 +54,8 @@ public class ServerFunctionLibrary implements PreparableReloadListener { return this.functions; } - public Collection> getTag(ResourceLocation location) { - return (Collection>)this.tags.getOrDefault(location, List.of()); + public List> getTag(ResourceLocation resourceLocation) { + return (List>)this.tags.getOrDefault(resourceLocation, List.of()); } public Iterable getAvailableTags() { @@ -69,18 +69,13 @@ public class ServerFunctionLibrary implements PreparableReloadListener { @Override public CompletableFuture reload( - PreparableReloadListener.PreparationBarrier preparationBarrier, - ResourceManager resourceManager, - ProfilerFiller preparationsProfiler, - ProfilerFiller reloadProfiler, - Executor backgroundExecutor, - Executor gameExecutor + PreparableReloadListener.PreparationBarrier preparationBarrier, ResourceManager resourceManager, Executor executor, Executor executor2 ) { CompletableFuture>> completableFuture = CompletableFuture.supplyAsync( - () -> this.tagsLoader.load(resourceManager), backgroundExecutor + () -> this.tagsLoader.load(resourceManager), executor ); CompletableFuture>>> completableFuture2 = CompletableFuture.supplyAsync( - () -> LISTER.listMatchingResources(resourceManager), backgroundExecutor + () -> LISTER.listMatchingResources(resourceManager), executor ) .thenCompose( map -> { @@ -95,7 +90,7 @@ public class ServerFunctionLibrary implements PreparableReloadListener { map2.put(resourceLocation2, CompletableFuture.supplyAsync(() -> { List list = readLines((Resource)entry.getValue()); return CommandFunction.fromLines(resourceLocation2, this.dispatcher, commandSourceStack, list); - }, backgroundExecutor)); + }, executor)); } CompletableFuture[] completableFutures = (CompletableFuture[])map2.values().toArray(new CompletableFuture[0]); @@ -120,7 +115,7 @@ public class ServerFunctionLibrary implements PreparableReloadListener { this.functions = builder.build(); this.tags = this.tagsLoader.build((Map>)pair.getFirst()); }, - gameExecutor + executor2 ); } diff --git a/net/minecraft/server/ServerFunctionManager.java b/net/minecraft/server/ServerFunctionManager.java index bb78e824..7c369a48 100644 --- a/net/minecraft/server/ServerFunctionManager.java +++ b/net/minecraft/server/ServerFunctionManager.java @@ -15,6 +15,7 @@ import net.minecraft.commands.execution.ExecutionContext; import net.minecraft.commands.functions.CommandFunction; import net.minecraft.commands.functions.InstantiatedFunction; import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.profiling.Profiler; import net.minecraft.util.profiling.ProfilerFiller; import org.slf4j.Logger; @@ -50,17 +51,17 @@ public class ServerFunctionManager { } private void executeTagFunctions(Collection> functionObjects, ResourceLocation identifier) { - this.server.getProfiler().push(identifier::toString); + Profiler.get().push(identifier::toString); for (CommandFunction commandFunction : functionObjects) { this.execute(commandFunction, this.getGameLoopSender()); } - this.server.getProfiler().pop(); + Profiler.get().pop(); } public void execute(CommandFunction function, CommandSourceStack source) { - ProfilerFiller profilerFiller = this.server.getProfiler(); + ProfilerFiller profilerFiller = Profiler.get(); profilerFiller.push((Supplier)(() -> "function " + function.id())); try { @@ -82,7 +83,7 @@ public class ServerFunctionManager { } private void postReload(ServerFunctionLibrary reloader) { - this.ticking = ImmutableList.copyOf(reloader.getTag(TICK_FUNCTION_TAG)); + this.ticking = List.copyOf(reloader.getTag(TICK_FUNCTION_TAG)); this.postReload = true; } @@ -94,8 +95,8 @@ public class ServerFunctionManager { return this.library.getFunction(functionIdentifier); } - public Collection> getTag(ResourceLocation functionTagIdentifier) { - return this.library.getTag(functionTagIdentifier); + public List> getTag(ResourceLocation resourceLocation) { + return this.library.getTag(resourceLocation); } public Iterable getFunctionNames() { diff --git a/net/minecraft/server/SuppressedExceptionCollector.java b/net/minecraft/server/SuppressedExceptionCollector.java new file mode 100644 index 00000000..4b615cf7 --- /dev/null +++ b/net/minecraft/server/SuppressedExceptionCollector.java @@ -0,0 +1,78 @@ +package net.minecraft.server; + +import it.unimi.dsi.fastutil.objects.Object2IntLinkedOpenHashMap; +import it.unimi.dsi.fastutil.objects.Object2IntMaps; +import it.unimi.dsi.fastutil.objects.Object2IntMap.Entry; +import java.util.Queue; +import net.minecraft.util.ArrayListDeque; + +public class SuppressedExceptionCollector { + private static final int LATEST_ENTRY_COUNT = 8; + private final Queue latestEntries = new ArrayListDeque(); + private final Object2IntLinkedOpenHashMap entryCounts = new Object2IntLinkedOpenHashMap<>(); + + private static long currentTimeMs() { + return System.currentTimeMillis(); + } + + public synchronized void addEntry(String string, Throwable throwable) { + long l = currentTimeMs(); + String string2 = throwable.getMessage(); + this.latestEntries.add(new SuppressedExceptionCollector.LongEntry(l, string, throwable.getClass(), string2)); + + while (this.latestEntries.size() > 8) { + this.latestEntries.remove(); + } + + SuppressedExceptionCollector.ShortEntry shortEntry = new SuppressedExceptionCollector.ShortEntry(string, throwable.getClass()); + int i = this.entryCounts.getInt(shortEntry); + this.entryCounts.putAndMoveToFirst(shortEntry, i + 1); + } + + public synchronized String dump() { + long l = currentTimeMs(); + StringBuilder stringBuilder = new StringBuilder(); + if (!this.latestEntries.isEmpty()) { + stringBuilder.append("\n\t\tLatest entries:\n"); + + for (SuppressedExceptionCollector.LongEntry longEntry : this.latestEntries) { + stringBuilder.append("\t\t\t") + .append(longEntry.location) + .append(":") + .append(longEntry.cls) + .append(": ") + .append(longEntry.message) + .append(" (") + .append(l - longEntry.timestampMs) + .append("ms ago)") + .append("\n"); + } + } + + if (!this.entryCounts.isEmpty()) { + if (stringBuilder.isEmpty()) { + stringBuilder.append("\n"); + } + + stringBuilder.append("\t\tEntry counts:\n"); + + for (Entry entry : Object2IntMaps.fastIterable(this.entryCounts)) { + stringBuilder.append("\t\t\t") + .append(((SuppressedExceptionCollector.ShortEntry)entry.getKey()).location) + .append(":") + .append(((SuppressedExceptionCollector.ShortEntry)entry.getKey()).cls) + .append(" x ") + .append(entry.getIntValue()) + .append("\n"); + } + } + + return stringBuilder.isEmpty() ? "~~NONE~~" : stringBuilder.toString(); + } + + record LongEntry(long timestampMs, String location, Class cls, String message) { + } + + record ShortEntry(String location, Class cls) { + } +} diff --git a/net/minecraft/server/WorldLoader.java b/net/minecraft/server/WorldLoader.java index 9e72026e..eb1254c5 100644 --- a/net/minecraft/server/WorldLoader.java +++ b/net/minecraft/server/WorldLoader.java @@ -5,8 +5,11 @@ import com.mojang.logging.LogUtils; import java.util.List; import java.util.concurrent.CompletableFuture; import java.util.concurrent.Executor; +import java.util.stream.Stream; import net.minecraft.commands.Commands; +import net.minecraft.core.HolderLookup; import net.minecraft.core.LayeredRegistryAccess; +import net.minecraft.core.Registry; import net.minecraft.core.RegistryAccess; import net.minecraft.resources.RegistryDataLoader; import net.minecraft.server.packs.PackResources; @@ -15,6 +18,7 @@ import net.minecraft.server.packs.repository.PackRepository; import net.minecraft.server.packs.resources.CloseableResourceManager; import net.minecraft.server.packs.resources.MultiPackResourceManager; import net.minecraft.server.packs.resources.ResourceManager; +import net.minecraft.tags.TagLoader; import net.minecraft.world.level.WorldDataConfiguration; import org.slf4j.Logger; @@ -32,19 +36,24 @@ public class WorldLoader { Pair pair = initConfig.packConfig.createResourceManager(); CloseableResourceManager closeableResourceManager = pair.getSecond(); LayeredRegistryAccess layeredRegistryAccess = RegistryLayer.createRegistryAccess(); - LayeredRegistryAccess layeredRegistryAccess2 = loadAndReplaceLayer( - closeableResourceManager, layeredRegistryAccess, RegistryLayer.WORLDGEN, RegistryDataLoader.WORLDGEN_REGISTRIES - ); - RegistryAccess.Frozen frozen = layeredRegistryAccess2.getAccessForLoading(RegistryLayer.DIMENSIONS); - RegistryAccess.Frozen frozen2 = RegistryDataLoader.load(closeableResourceManager, frozen, RegistryDataLoader.DIMENSION_REGISTRIES); + List> list = TagLoader.loadTagsForExistingRegistries(closeableResourceManager, layeredRegistryAccess.getLayer(RegistryLayer.STATIC)); + RegistryAccess.Frozen frozen = layeredRegistryAccess.getAccessForLoading(RegistryLayer.WORLDGEN); + List> list2 = TagLoader.buildUpdatedLookups(frozen, list); + RegistryAccess.Frozen frozen2 = RegistryDataLoader.load(closeableResourceManager, list2, RegistryDataLoader.WORLDGEN_REGISTRIES); + List> list3 = Stream.concat(list2.stream(), frozen2.listRegistries()).toList(); + RegistryAccess.Frozen frozen3 = RegistryDataLoader.load(closeableResourceManager, list3, RegistryDataLoader.DIMENSION_REGISTRIES); WorldDataConfiguration worldDataConfiguration = pair.getFirst(); + HolderLookup.Provider provider = HolderLookup.Provider.create(list3.stream()); WorldLoader.DataLoadOutput dataLoadOutput = worldDataSupplier.get( - new WorldLoader.DataLoadContext(closeableResourceManager, worldDataConfiguration, frozen, frozen2) + new WorldLoader.DataLoadContext(closeableResourceManager, worldDataConfiguration, provider, frozen3) + ); + LayeredRegistryAccess layeredRegistryAccess2 = layeredRegistryAccess.replaceFrom( + RegistryLayer.WORLDGEN, frozen2, dataLoadOutput.finalDimensions ); - LayeredRegistryAccess layeredRegistryAccess3 = layeredRegistryAccess2.replaceFrom(RegistryLayer.DIMENSIONS, dataLoadOutput.finalDimensions); return ReloadableServerResources.loadResources( closeableResourceManager, - layeredRegistryAccess3, + layeredRegistryAccess2, + list, worldDataConfiguration.enabledFeatures(), initConfig.commandSelection(), initConfig.functionCompilationLevel(), @@ -57,36 +66,16 @@ public class WorldLoader { } }) .thenApplyAsync(reloadableServerResources -> { - reloadableServerResources.updateRegistryTags(); - return resultFactory.create(closeableResourceManager, reloadableServerResources, layeredRegistryAccess3, dataLoadOutput.cookie); + reloadableServerResources.updateStaticRegistryTags(); + return resultFactory.create(closeableResourceManager, reloadableServerResources, layeredRegistryAccess2, dataLoadOutput.cookie); }, gameExecutor); - } catch (Exception var14) { - return CompletableFuture.failedFuture(var14); + } catch (Exception var18) { + return CompletableFuture.failedFuture(var18); } } - private static RegistryAccess.Frozen loadLayer( - ResourceManager resourceManager, - LayeredRegistryAccess registryAccess, - RegistryLayer registryLayer, - List> registryData - ) { - RegistryAccess.Frozen frozen = registryAccess.getAccessForLoading(registryLayer); - return RegistryDataLoader.load(resourceManager, frozen, registryData); - } - - private static LayeredRegistryAccess loadAndReplaceLayer( - ResourceManager resourceManager, - LayeredRegistryAccess registryAccess, - RegistryLayer registryLayer, - List> registryData - ) { - RegistryAccess.Frozen frozen = loadLayer(resourceManager, registryAccess, registryLayer, registryData); - return registryAccess.replaceFrom(registryLayer, frozen); - } - public record DataLoadContext( - ResourceManager resources, WorldDataConfiguration dataConfiguration, RegistryAccess.Frozen datapackWorldgen, RegistryAccess.Frozen datapackDimensions + ResourceManager resources, WorldDataConfiguration dataConfiguration, HolderLookup.Provider datapackWorldgen, RegistryAccess.Frozen datapackDimensions ) { } diff --git a/net/minecraft/server/chase/ChaseClient.java b/net/minecraft/server/chase/ChaseClient.java index 6091c5b5..95065c40 100644 --- a/net/minecraft/server/chase/ChaseClient.java +++ b/net/minecraft/server/chase/ChaseClient.java @@ -181,7 +181,15 @@ public class ChaseClient { ServerPlayer serverPlayer = (ServerPlayer)list.get(0); ServerLevel serverLevel = this.server.overworld(); CommandSourceStack commandSourceStack = new CommandSourceStack( - serverPlayer, Vec3.atLowerCornerOf(serverLevel.getSharedSpawnPos()), Vec2.ZERO, serverLevel, 4, "", CommonComponents.EMPTY, this.server, serverPlayer + serverPlayer.commandSource(), + Vec3.atLowerCornerOf(serverLevel.getSharedSpawnPos()), + Vec2.ZERO, + serverLevel, + 4, + "", + CommonComponents.EMPTY, + this.server, + serverPlayer ); Commands commands = this.server.getCommands(); commands.performPrefixedCommand(commandSourceStack, command); diff --git a/net/minecraft/server/chase/ChaseServer.java b/net/minecraft/server/chase/ChaseServer.java index 651f5dd1..dc9af1dc 100644 --- a/net/minecraft/server/chase/ChaseServer.java +++ b/net/minecraft/server/chase/ChaseServer.java @@ -65,7 +65,7 @@ public class ChaseServer { for (Socket socket : this.clientSockets) { if (!socket.isClosed()) { - Util.ioPool().submit(() -> { + Util.ioPool().execute(() -> { try { OutputStream outputStream = socket.getOutputStream(); outputStream.write(bs); diff --git a/net/minecraft/server/commands/AdvancementCommands.java b/net/minecraft/server/commands/AdvancementCommands.java index 779187e5..04b5f760 100644 --- a/net/minecraft/server/commands/AdvancementCommands.java +++ b/net/minecraft/server/commands/AdvancementCommands.java @@ -6,20 +6,19 @@ import com.mojang.brigadier.context.CommandContext; import com.mojang.brigadier.exceptions.CommandSyntaxException; import com.mojang.brigadier.exceptions.Dynamic2CommandExceptionType; import com.mojang.brigadier.exceptions.DynamicCommandExceptionType; -import com.mojang.brigadier.suggestion.SuggestionProvider; import java.util.ArrayList; import java.util.Collection; import java.util.List; import net.minecraft.advancements.Advancement; import net.minecraft.advancements.AdvancementHolder; import net.minecraft.advancements.AdvancementNode; -import net.minecraft.advancements.AdvancementProgress; import net.minecraft.advancements.AdvancementTree; import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.Commands; import net.minecraft.commands.SharedSuggestionProvider; import net.minecraft.commands.arguments.EntityArgument; -import net.minecraft.commands.arguments.ResourceLocationArgument; +import net.minecraft.commands.arguments.ResourceKeyArgument; +import net.minecraft.core.registries.Registries; import net.minecraft.network.chat.Component; import net.minecraft.server.level.ServerPlayer; @@ -28,10 +27,6 @@ public class AdvancementCommands { private static final Dynamic2CommandExceptionType ERROR_CRITERION_NOT_FOUND = new Dynamic2CommandExceptionType( (object, object2) -> Component.translatableEscape("commands.advancement.criterionNotFound", object, object2) ); - private static final SuggestionProvider SUGGEST_ADVANCEMENTS = (commandContext, suggestionsBuilder) -> { - Collection collection = commandContext.getSource().getServer().getAdvancements().getAllAdvancements(); - return SharedSuggestionProvider.suggestResource(collection.stream().map(AdvancementHolder::id), suggestionsBuilder); - }; public static void register(CommandDispatcher dispatcher) { dispatcher.register( @@ -44,21 +39,20 @@ public class AdvancementCommands { .then( Commands.literal("only") .then( - Commands.argument("advancement", ResourceLocationArgument.id()) - .suggests(SUGGEST_ADVANCEMENTS) + Commands.argument("advancement", ResourceKeyArgument.key(Registries.ADVANCEMENT)) .executes( commandContext -> perform( commandContext.getSource(), EntityArgument.getPlayers(commandContext, "targets"), AdvancementCommands.Action.GRANT, - getAdvancements(commandContext, ResourceLocationArgument.getAdvancement(commandContext, "advancement"), AdvancementCommands.Mode.ONLY) + getAdvancements(commandContext, ResourceKeyArgument.getAdvancement(commandContext, "advancement"), AdvancementCommands.Mode.ONLY) ) ) .then( Commands.argument("criterion", StringArgumentType.greedyString()) .suggests( (commandContext, suggestionsBuilder) -> SharedSuggestionProvider.suggest( - ResourceLocationArgument.getAdvancement(commandContext, "advancement").value().criteria().keySet(), suggestionsBuilder + ResourceKeyArgument.getAdvancement(commandContext, "advancement").value().criteria().keySet(), suggestionsBuilder ) ) .executes( @@ -66,7 +60,7 @@ public class AdvancementCommands { commandContext.getSource(), EntityArgument.getPlayers(commandContext, "targets"), AdvancementCommands.Action.GRANT, - ResourceLocationArgument.getAdvancement(commandContext, "advancement"), + ResourceKeyArgument.getAdvancement(commandContext, "advancement"), StringArgumentType.getString(commandContext, "criterion") ) ) @@ -76,14 +70,13 @@ public class AdvancementCommands { .then( Commands.literal("from") .then( - Commands.argument("advancement", ResourceLocationArgument.id()) - .suggests(SUGGEST_ADVANCEMENTS) + Commands.argument("advancement", ResourceKeyArgument.key(Registries.ADVANCEMENT)) .executes( commandContext -> perform( commandContext.getSource(), EntityArgument.getPlayers(commandContext, "targets"), AdvancementCommands.Action.GRANT, - getAdvancements(commandContext, ResourceLocationArgument.getAdvancement(commandContext, "advancement"), AdvancementCommands.Mode.FROM) + getAdvancements(commandContext, ResourceKeyArgument.getAdvancement(commandContext, "advancement"), AdvancementCommands.Mode.FROM) ) ) ) @@ -91,14 +84,13 @@ public class AdvancementCommands { .then( Commands.literal("until") .then( - Commands.argument("advancement", ResourceLocationArgument.id()) - .suggests(SUGGEST_ADVANCEMENTS) + Commands.argument("advancement", ResourceKeyArgument.key(Registries.ADVANCEMENT)) .executes( commandContext -> perform( commandContext.getSource(), EntityArgument.getPlayers(commandContext, "targets"), AdvancementCommands.Action.GRANT, - getAdvancements(commandContext, ResourceLocationArgument.getAdvancement(commandContext, "advancement"), AdvancementCommands.Mode.UNTIL) + getAdvancements(commandContext, ResourceKeyArgument.getAdvancement(commandContext, "advancement"), AdvancementCommands.Mode.UNTIL) ) ) ) @@ -106,14 +98,13 @@ public class AdvancementCommands { .then( Commands.literal("through") .then( - Commands.argument("advancement", ResourceLocationArgument.id()) - .suggests(SUGGEST_ADVANCEMENTS) + Commands.argument("advancement", ResourceKeyArgument.key(Registries.ADVANCEMENT)) .executes( commandContext -> perform( commandContext.getSource(), EntityArgument.getPlayers(commandContext, "targets"), AdvancementCommands.Action.GRANT, - getAdvancements(commandContext, ResourceLocationArgument.getAdvancement(commandContext, "advancement"), AdvancementCommands.Mode.THROUGH) + getAdvancements(commandContext, ResourceKeyArgument.getAdvancement(commandContext, "advancement"), AdvancementCommands.Mode.THROUGH) ) ) ) @@ -138,21 +129,20 @@ public class AdvancementCommands { .then( Commands.literal("only") .then( - Commands.argument("advancement", ResourceLocationArgument.id()) - .suggests(SUGGEST_ADVANCEMENTS) + Commands.argument("advancement", ResourceKeyArgument.key(Registries.ADVANCEMENT)) .executes( commandContext -> perform( commandContext.getSource(), EntityArgument.getPlayers(commandContext, "targets"), AdvancementCommands.Action.REVOKE, - getAdvancements(commandContext, ResourceLocationArgument.getAdvancement(commandContext, "advancement"), AdvancementCommands.Mode.ONLY) + getAdvancements(commandContext, ResourceKeyArgument.getAdvancement(commandContext, "advancement"), AdvancementCommands.Mode.ONLY) ) ) .then( Commands.argument("criterion", StringArgumentType.greedyString()) .suggests( (commandContext, suggestionsBuilder) -> SharedSuggestionProvider.suggest( - ResourceLocationArgument.getAdvancement(commandContext, "advancement").value().criteria().keySet(), suggestionsBuilder + ResourceKeyArgument.getAdvancement(commandContext, "advancement").value().criteria().keySet(), suggestionsBuilder ) ) .executes( @@ -160,7 +150,7 @@ public class AdvancementCommands { commandContext.getSource(), EntityArgument.getPlayers(commandContext, "targets"), AdvancementCommands.Action.REVOKE, - ResourceLocationArgument.getAdvancement(commandContext, "advancement"), + ResourceKeyArgument.getAdvancement(commandContext, "advancement"), StringArgumentType.getString(commandContext, "criterion") ) ) @@ -170,14 +160,13 @@ public class AdvancementCommands { .then( Commands.literal("from") .then( - Commands.argument("advancement", ResourceLocationArgument.id()) - .suggests(SUGGEST_ADVANCEMENTS) + Commands.argument("advancement", ResourceKeyArgument.key(Registries.ADVANCEMENT)) .executes( commandContext -> perform( commandContext.getSource(), EntityArgument.getPlayers(commandContext, "targets"), AdvancementCommands.Action.REVOKE, - getAdvancements(commandContext, ResourceLocationArgument.getAdvancement(commandContext, "advancement"), AdvancementCommands.Mode.FROM) + getAdvancements(commandContext, ResourceKeyArgument.getAdvancement(commandContext, "advancement"), AdvancementCommands.Mode.FROM) ) ) ) @@ -185,14 +174,13 @@ public class AdvancementCommands { .then( Commands.literal("until") .then( - Commands.argument("advancement", ResourceLocationArgument.id()) - .suggests(SUGGEST_ADVANCEMENTS) + Commands.argument("advancement", ResourceKeyArgument.key(Registries.ADVANCEMENT)) .executes( commandContext -> perform( commandContext.getSource(), EntityArgument.getPlayers(commandContext, "targets"), AdvancementCommands.Action.REVOKE, - getAdvancements(commandContext, ResourceLocationArgument.getAdvancement(commandContext, "advancement"), AdvancementCommands.Mode.UNTIL) + getAdvancements(commandContext, ResourceKeyArgument.getAdvancement(commandContext, "advancement"), AdvancementCommands.Mode.UNTIL) ) ) ) @@ -200,14 +188,13 @@ public class AdvancementCommands { .then( Commands.literal("through") .then( - Commands.argument("advancement", ResourceLocationArgument.id()) - .suggests(SUGGEST_ADVANCEMENTS) + Commands.argument("advancement", ResourceKeyArgument.key(Registries.ADVANCEMENT)) .executes( commandContext -> perform( commandContext.getSource(), EntityArgument.getPlayers(commandContext, "targets"), AdvancementCommands.Action.REVOKE, - getAdvancements(commandContext, ResourceLocationArgument.getAdvancement(commandContext, "advancement"), AdvancementCommands.Mode.THROUGH) + getAdvancements(commandContext, ResourceKeyArgument.getAdvancement(commandContext, "advancement"), AdvancementCommands.Mode.THROUGH) ) ) ) @@ -373,46 +360,8 @@ public class AdvancementCommands { } static enum Action { - GRANT("grant") { - @Override - protected boolean perform(ServerPlayer player, AdvancementHolder advancement) { - AdvancementProgress advancementProgress = player.getAdvancements().getOrStartProgress(advancement); - if (advancementProgress.isDone()) { - return false; - } else { - for (String string : advancementProgress.getRemainingCriteria()) { - player.getAdvancements().award(advancement, string); - } - - return true; - } - } - - @Override - protected boolean performCriterion(ServerPlayer player, AdvancementHolder advancement, String criterionName) { - return player.getAdvancements().award(advancement, criterionName); - } - }, - REVOKE("revoke") { - @Override - protected boolean perform(ServerPlayer player, AdvancementHolder advancement) { - AdvancementProgress advancementProgress = player.getAdvancements().getOrStartProgress(advancement); - if (!advancementProgress.hasProgress()) { - return false; - } else { - for (String string : advancementProgress.getCompletedCriteria()) { - player.getAdvancements().revoke(advancement, string); - } - - return true; - } - } - - @Override - protected boolean performCriterion(ServerPlayer player, AdvancementHolder advancement, String criterionName) { - return player.getAdvancements().revoke(advancement, criterionName); - } - }; + GRANT("GRANT", 0, "grant"), + REVOKE("REVOKE", 1, "revoke"); private final String key; diff --git a/net/minecraft/server/commands/CloneCommands.java b/net/minecraft/server/commands/CloneCommands.java index f44b60a2..7a027e84 100644 --- a/net/minecraft/server/commands/CloneCommands.java +++ b/net/minecraft/server/commands/CloneCommands.java @@ -257,7 +257,7 @@ public class CloneCommands { ); list2.add(new CloneCommands.CloneBlockInfo(blockPos7, blockState, cloneBlockEntityInfo)); deque.addLast(blockPos6); - } else if (!blockState.isSolidRender(serverLevel, blockPos6) && !blockState.isCollisionShapeFullBlock(serverLevel, blockPos6)) { + } else if (!blockState.isSolidRender() && !blockState.isCollisionShapeFullBlock(serverLevel, blockPos6)) { list3.add(new CloneCommands.CloneBlockInfo(blockPos7, blockState, null)); deque.addFirst(blockPos6); } else { diff --git a/net/minecraft/server/commands/DamageCommand.java b/net/minecraft/server/commands/DamageCommand.java index d260b745..ac482f2e 100644 --- a/net/minecraft/server/commands/DamageCommand.java +++ b/net/minecraft/server/commands/DamageCommand.java @@ -101,7 +101,7 @@ public class DamageCommand { } private static int damage(CommandSourceStack source, Entity target, float amount, DamageSource damageType) throws CommandSyntaxException { - if (target.hurt(damageType, amount)) { + if (target.hurtServer(source.getLevel(), damageType, amount)) { source.sendSuccess(() -> Component.translatable("commands.damage.success", amount, target.getDisplayName()), true); return 1; } else { diff --git a/net/minecraft/server/commands/EnchantCommand.java b/net/minecraft/server/commands/EnchantCommand.java index 597c36e8..f9efbc1f 100644 --- a/net/minecraft/server/commands/EnchantCommand.java +++ b/net/minecraft/server/commands/EnchantCommand.java @@ -81,7 +81,7 @@ public class EnchantCommand { itemStack.enchant(enchantment, level); i++; } else if (targets.size() == 1) { - throw ERROR_INCOMPATIBLE.create(itemStack.getItem().getName(itemStack).getString()); + throw ERROR_INCOMPATIBLE.create(itemStack.getHoverName().getString()); } } else if (targets.size() == 1) { throw ERROR_NO_ITEM.create(livingEntity.getName().getString()); diff --git a/net/minecraft/server/commands/ExecuteCommand.java b/net/minecraft/server/commands/ExecuteCommand.java index e0e355e0..7591f5a4 100644 --- a/net/minecraft/server/commands/ExecuteCommand.java +++ b/net/minecraft/server/commands/ExecuteCommand.java @@ -29,7 +29,6 @@ import java.util.function.IntFunction; import java.util.function.IntPredicate; import java.util.function.Predicate; import java.util.stream.Stream; -import net.minecraft.advancements.critereon.MinMaxBounds; import net.minecraft.commands.CommandBuildContext; import net.minecraft.commands.CommandResultCallback; import net.minecraft.commands.CommandSourceStack; @@ -50,6 +49,9 @@ import net.minecraft.commands.arguments.ResourceOrIdArgument; import net.minecraft.commands.arguments.ResourceOrTagArgument; import net.minecraft.commands.arguments.ScoreHolderArgument; import net.minecraft.commands.arguments.SlotsArgument; +import net.minecraft.commands.arguments.EntityAnchorArgument.Anchor; +import net.minecraft.commands.arguments.NbtPathArgument.NbtPath; +import net.minecraft.commands.arguments.RangeArgument.Ints; import net.minecraft.commands.arguments.blocks.BlockPredicateArgument; import net.minecraft.commands.arguments.coordinates.BlockPosArgument; import net.minecraft.commands.arguments.coordinates.RotationArgument; @@ -58,12 +60,12 @@ import net.minecraft.commands.arguments.coordinates.Vec3Argument; import net.minecraft.commands.arguments.item.FunctionArgument; import net.minecraft.commands.arguments.item.ItemPredicateArgument; import net.minecraft.commands.execution.ChainModifiers; -import net.minecraft.commands.execution.CustomModifierExecutor; import net.minecraft.commands.execution.ExecutionControl; -import net.minecraft.commands.execution.tasks.BuildContexts; +import net.minecraft.commands.execution.CustomModifierExecutor.ModifierAdapter; import net.minecraft.commands.execution.tasks.CallFunction; import net.minecraft.commands.execution.tasks.FallthroughTask; import net.minecraft.commands.execution.tasks.IsolatedCall; +import net.minecraft.commands.execution.tasks.BuildContexts.Continuation; import net.minecraft.commands.functions.CommandFunction; import net.minecraft.commands.functions.InstantiatedFunction; import net.minecraft.commands.synchronization.SuggestionProviders; @@ -85,6 +87,7 @@ import net.minecraft.server.ReloadableServerRegistries; import net.minecraft.server.bossevents.CustomBossEvent; import net.minecraft.server.commands.data.DataAccessor; import net.minecraft.server.commands.data.DataCommands; +import net.minecraft.server.commands.data.DataCommands.DataProvider; import net.minecraft.server.level.FullChunkStatus; import net.minecraft.server.level.ServerLevel; import net.minecraft.util.Mth; @@ -177,8 +180,7 @@ public class ExecuteCommand { .then( Commands.argument("pos", Vec3Argument.vec3()) .redirect( - literalCommandNode, - commandContext -> commandContext.getSource().withPosition(Vec3Argument.getVec3(commandContext, "pos")).withAnchor(EntityAnchorArgument.Anchor.FEET) + literalCommandNode, commandContext -> commandContext.getSource().withPosition(Vec3Argument.getVec3(commandContext, "pos")).withAnchor(Anchor.FEET) ) ) .then(Commands.literal("as").then(Commands.argument("targets", EntityArgument.entities()).fork(literalCommandNode, commandContext -> { @@ -230,7 +232,7 @@ public class ExecuteCommand { Commands.argument("targets", EntityArgument.entities()) .then(Commands.argument("anchor", EntityAnchorArgument.anchor()).fork(literalCommandNode, commandContext -> { List list = Lists.newArrayList(); - EntityAnchorArgument.Anchor anchor = EntityAnchorArgument.getAnchor(commandContext, "anchor"); + Anchor anchor = EntityAnchorArgument.getAnchor(commandContext, "anchor"); for (Entity entity : EntityArgument.getOptionalEntities(commandContext, "targets")) { list.add(commandContext.getSource().facing(entity, anchor)); @@ -323,7 +325,7 @@ public class ExecuteCommand { ) ); - for (DataCommands.DataProvider dataProvider : DataCommands.TARGET_PROVIDERS) { + for (DataProvider dataProvider : DataCommands.TARGET_PROVIDERS) { dataProvider.wrap( literal, argumentBuilder -> argumentBuilder.then( @@ -454,7 +456,7 @@ public class ExecuteCommand { } private static CommandSourceStack storeData( - CommandSourceStack source, DataAccessor accessor, NbtPathArgument.NbtPath path, IntFunction tagConverter, boolean storingResult + CommandSourceStack source, DataAccessor accessor, NbtPath path, IntFunction tagConverter, boolean storingResult ) { return source.withCallback((bl2, i) -> { try { @@ -611,7 +613,7 @@ public class ExecuteCommand { parent, Commands.argument("range", RangeArgument.intRange()), isIf, - commandContext -> checkScore(commandContext, RangeArgument.Ints.getRange(commandContext, "range")) + commandContext -> checkScore(commandContext, Ints.getRange(commandContext, "range")) ) ) ) @@ -735,7 +737,7 @@ public class ExecuteCommand { ) ); - for (DataCommands.DataProvider dataProvider : DataCommands.SOURCE_PROVIDERS) { + for (DataProvider dataProvider : DataCommands.SOURCE_PROVIDERS) { literal.then( dataProvider.wrap( Commands.literal("data"), @@ -818,7 +820,7 @@ public class ExecuteCommand { }; } - private static int checkMatchingData(DataAccessor accessor, NbtPathArgument.NbtPath path) throws CommandSyntaxException { + private static int checkMatchingData(DataAccessor accessor, NbtPath path) throws CommandSyntaxException { return path.countMatching(accessor.getData()); } @@ -833,7 +835,7 @@ public class ExecuteCommand { return readOnlyScoreInfo != null && readOnlyScoreInfo2 != null ? predicate.test(readOnlyScoreInfo.value(), readOnlyScoreInfo2.value()) : false; } - private static boolean checkScore(CommandContext context, MinMaxBounds.Ints bounds) throws CommandSyntaxException { + private static boolean checkScore(CommandContext context, net.minecraft.advancements.critereon.MinMaxBounds.Ints bounds) throws CommandSyntaxException { ScoreHolder scoreHolder = ScoreHolderArgument.getName(context, "target"); Objective objective = ObjectiveArgument.getObjective(context, "targetObjective"); Scoreboard scoreboard = context.getSource().getServer().getScoreboard(); @@ -1092,7 +1094,7 @@ public class ExecuteCommand { ContextChain contextChain2 = contextChain.nextStage(); String string = contextChain.getTopContext().getInput(); - executionControl.queueNext(new BuildContexts.Continuation<>(string, contextChain2, chainModifiers, originalSource, list)); + executionControl.queueNext(new Continuation<>(string, contextChain2, chainModifiers, originalSource, list)); } } @@ -1111,7 +1113,7 @@ public class ExecuteCommand { boolean test(CommandContext commandContext) throws CommandSyntaxException; } - static class ExecuteIfFunctionCustomModifier implements CustomModifierExecutor.ModifierAdapter { + static class ExecuteIfFunctionCustomModifier implements ModifierAdapter { private final IntPredicate check; ExecuteIfFunctionCustomModifier(boolean invert) { diff --git a/net/minecraft/server/commands/ExperienceCommand.java b/net/minecraft/server/commands/ExperienceCommand.java index 683894fe..27ef25e5 100644 --- a/net/minecraft/server/commands/ExperienceCommand.java +++ b/net/minecraft/server/commands/ExperienceCommand.java @@ -29,13 +29,13 @@ public class ExperienceCommand { .then( Commands.literal("add") .then( - Commands.argument("targets", EntityArgument.players()) + Commands.argument("target", EntityArgument.players()) .then( Commands.argument("amount", IntegerArgumentType.integer()) .executes( commandContext -> addExperience( commandContext.getSource(), - EntityArgument.getPlayers(commandContext, "targets"), + EntityArgument.getPlayers(commandContext, "target"), IntegerArgumentType.getInteger(commandContext, "amount"), ExperienceCommand.Type.POINTS ) @@ -45,7 +45,7 @@ public class ExperienceCommand { .executes( commandContext -> addExperience( commandContext.getSource(), - EntityArgument.getPlayers(commandContext, "targets"), + EntityArgument.getPlayers(commandContext, "target"), IntegerArgumentType.getInteger(commandContext, "amount"), ExperienceCommand.Type.POINTS ) @@ -56,7 +56,7 @@ public class ExperienceCommand { .executes( commandContext -> addExperience( commandContext.getSource(), - EntityArgument.getPlayers(commandContext, "targets"), + EntityArgument.getPlayers(commandContext, "target"), IntegerArgumentType.getInteger(commandContext, "amount"), ExperienceCommand.Type.LEVELS ) @@ -68,13 +68,13 @@ public class ExperienceCommand { .then( Commands.literal("set") .then( - Commands.argument("targets", EntityArgument.players()) + Commands.argument("target", EntityArgument.players()) .then( Commands.argument("amount", IntegerArgumentType.integer(0)) .executes( commandContext -> setExperience( commandContext.getSource(), - EntityArgument.getPlayers(commandContext, "targets"), + EntityArgument.getPlayers(commandContext, "target"), IntegerArgumentType.getInteger(commandContext, "amount"), ExperienceCommand.Type.POINTS ) @@ -84,7 +84,7 @@ public class ExperienceCommand { .executes( commandContext -> setExperience( commandContext.getSource(), - EntityArgument.getPlayers(commandContext, "targets"), + EntityArgument.getPlayers(commandContext, "target"), IntegerArgumentType.getInteger(commandContext, "amount"), ExperienceCommand.Type.POINTS ) @@ -95,7 +95,7 @@ public class ExperienceCommand { .executes( commandContext -> setExperience( commandContext.getSource(), - EntityArgument.getPlayers(commandContext, "targets"), + EntityArgument.getPlayers(commandContext, "target"), IntegerArgumentType.getInteger(commandContext, "amount"), ExperienceCommand.Type.LEVELS ) @@ -107,17 +107,17 @@ public class ExperienceCommand { .then( Commands.literal("query") .then( - Commands.argument("targets", EntityArgument.player()) + Commands.argument("target", EntityArgument.player()) .then( Commands.literal("points") .executes( - commandContext -> queryExperience(commandContext.getSource(), EntityArgument.getPlayer(commandContext, "targets"), ExperienceCommand.Type.POINTS) + commandContext -> queryExperience(commandContext.getSource(), EntityArgument.getPlayer(commandContext, "target"), ExperienceCommand.Type.POINTS) ) ) .then( Commands.literal("levels") .executes( - commandContext -> queryExperience(commandContext.getSource(), EntityArgument.getPlayer(commandContext, "targets"), ExperienceCommand.Type.LEVELS) + commandContext -> queryExperience(commandContext.getSource(), EntityArgument.getPlayer(commandContext, "target"), ExperienceCommand.Type.LEVELS) ) ) ) diff --git a/net/minecraft/server/commands/FillBiomeCommand.java b/net/minecraft/server/commands/FillBiomeCommand.java index 37013227..012f1b8b 100644 --- a/net/minecraft/server/commands/FillBiomeCommand.java +++ b/net/minecraft/server/commands/FillBiomeCommand.java @@ -135,7 +135,7 @@ public class FillBiomeCommand { for (ChunkAccess chunkAccess : list) { chunkAccess.fillBiomesFromNoise(makeResolver(mutableInt, chunkAccess, boundingBox, biome, filter), level.getChunkSource().randomState().sampler()); - chunkAccess.setUnsaved(true); + chunkAccess.markUnsaved(); } level.getChunkSource().chunkMap.resendBiomesForChunks(list); diff --git a/net/minecraft/server/commands/GameRuleCommand.java b/net/minecraft/server/commands/GameRuleCommand.java index 1e72abe5..6e711632 100644 --- a/net/minecraft/server/commands/GameRuleCommand.java +++ b/net/minecraft/server/commands/GameRuleCommand.java @@ -3,28 +3,30 @@ package net.minecraft.server.commands; import com.mojang.brigadier.CommandDispatcher; import com.mojang.brigadier.builder.LiteralArgumentBuilder; import com.mojang.brigadier.context.CommandContext; +import net.minecraft.commands.CommandBuildContext; import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.Commands; import net.minecraft.network.chat.Component; import net.minecraft.world.level.GameRules; public class GameRuleCommand { - public static void register(CommandDispatcher dispatcher) { + public static void register(CommandDispatcher commandDispatcher, CommandBuildContext commandBuildContext) { final LiteralArgumentBuilder literalArgumentBuilder = Commands.literal("gamerule") .requires(commandSourceStack -> commandSourceStack.hasPermission(2)); - GameRules.visitGameRuleTypes( - new GameRules.GameRuleTypeVisitor() { - @Override - public > void visit(GameRules.Key key, GameRules.Type type) { - literalArgumentBuilder.then( - Commands.literal(key.getId()) - .executes(commandContext -> GameRuleCommand.queryRule(commandContext.getSource(), key)) - .then(type.createArgument("value").executes(commandContext -> GameRuleCommand.setRule(commandContext, key))) - ); + new GameRules(commandBuildContext.enabledFeatures()) + .visitGameRuleTypes( + new GameRules.GameRuleTypeVisitor() { + @Override + public > void visit(GameRules.Key key, GameRules.Type type) { + LiteralArgumentBuilder literalArgumentBuilderx = Commands.literal(key.getId()); + literalArgumentBuilder.then( + literalArgumentBuilderx.executes(commandContext -> GameRuleCommand.queryRule(commandContext.getSource(), key)) + .then(type.createArgument("value").executes(commandContext -> GameRuleCommand.setRule(commandContext, key))) + ); + } } - } - ); - dispatcher.register(literalArgumentBuilder); + ); + commandDispatcher.register(literalArgumentBuilder); } static > int setRule(CommandContext source, GameRules.Key gameRule) { diff --git a/net/minecraft/server/commands/KillCommand.java b/net/minecraft/server/commands/KillCommand.java index 341624eb..a8731fad 100644 --- a/net/minecraft/server/commands/KillCommand.java +++ b/net/minecraft/server/commands/KillCommand.java @@ -24,7 +24,7 @@ public class KillCommand { private static int kill(CommandSourceStack source, Collection targets) { for (Entity entity : targets) { - entity.kill(); + entity.kill(source.getLevel()); } if (targets.size() == 1) { diff --git a/net/minecraft/server/commands/LocateCommand.java b/net/minecraft/server/commands/LocateCommand.java index 3d4d991c..bd22279a 100644 --- a/net/minecraft/server/commands/LocateCommand.java +++ b/net/minecraft/server/commands/LocateCommand.java @@ -15,6 +15,7 @@ import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.Commands; import net.minecraft.commands.arguments.ResourceOrTagArgument; import net.minecraft.commands.arguments.ResourceOrTagKeyArgument; +import net.minecraft.commands.arguments.ResourceOrTagKeyArgument.Result; import net.minecraft.core.BlockPos; import net.minecraft.core.Holder; import net.minecraft.core.HolderSet; @@ -88,14 +89,12 @@ public class LocateCommand { ); } - private static Optional> getHolders( - ResourceOrTagKeyArgument.Result structure, Registry structureRegistry - ) { - return structure.unwrap().map(resourceKey -> structureRegistry.getHolder(resourceKey).map(holder -> HolderSet.direct(holder)), structureRegistry::getTag); + private static Optional> getHolders(Result structure, Registry structureRegistry) { + return structure.unwrap().map(resourceKey -> structureRegistry.get(resourceKey).map(holder -> HolderSet.direct(holder)), structureRegistry::get); } - private static int locateStructure(CommandSourceStack source, ResourceOrTagKeyArgument.Result structure) throws CommandSyntaxException { - Registry registry = source.getLevel().registryAccess().registryOrThrow(Registries.STRUCTURE); + private static int locateStructure(CommandSourceStack source, Result structure) throws CommandSyntaxException { + Registry registry = source.getLevel().registryAccess().lookupOrThrow(Registries.STRUCTURE); HolderSet holderSet = (HolderSet)getHolders(structure, registry) .orElseThrow(() -> ERROR_STRUCTURE_INVALID.create(structure.asPrintable())); BlockPos blockPos = BlockPos.containing(source.getPosition()); @@ -110,7 +109,7 @@ public class LocateCommand { } } - private static int locateBiome(CommandSourceStack source, ResourceOrTagArgument.Result biome) throws CommandSyntaxException { + private static int locateBiome(CommandSourceStack source, net.minecraft.commands.arguments.ResourceOrTagArgument.Result biome) throws CommandSyntaxException { BlockPos blockPos = BlockPos.containing(source.getPosition()); Stopwatch stopwatch = Stopwatch.createStarted(Util.TICKER); Pair> pair = source.getLevel().findClosestBiome3d(biome, blockPos, 6400, 32, 64); @@ -122,7 +121,7 @@ public class LocateCommand { } } - private static int locatePoi(CommandSourceStack source, ResourceOrTagArgument.Result poiType) throws CommandSyntaxException { + private static int locatePoi(CommandSourceStack source, net.minecraft.commands.arguments.ResourceOrTagArgument.Result poiType) throws CommandSyntaxException { BlockPos blockPos = BlockPos.containing(source.getPosition()); ServerLevel serverLevel = source.getLevel(); Stopwatch stopwatch = Stopwatch.createStarted(Util.TICKER); @@ -137,7 +136,7 @@ public class LocateCommand { public static int showLocateResult( CommandSourceStack source, - ResourceOrTagArgument.Result result, + net.minecraft.commands.arguments.ResourceOrTagArgument.Result result, BlockPos sourcePosition, Pair> resultWithPosition, String translationKey, @@ -151,7 +150,7 @@ public class LocateCommand { public static int showLocateResult( CommandSourceStack source, - ResourceOrTagKeyArgument.Result result, + Result result, BlockPos sourcePosition, Pair> resultWithPosition, String translationKey, diff --git a/net/minecraft/server/commands/LookAt.java b/net/minecraft/server/commands/LookAt.java new file mode 100644 index 00000000..66054c7b --- /dev/null +++ b/net/minecraft/server/commands/LookAt.java @@ -0,0 +1,30 @@ +package net.minecraft.server.commands; + +import net.minecraft.commands.CommandSourceStack; +import net.minecraft.commands.arguments.EntityAnchorArgument.Anchor; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.phys.Vec3; + +@FunctionalInterface +public interface LookAt { + void perform(CommandSourceStack commandSourceStack, Entity entity); + + public record LookAtEntity(Entity entity, Anchor anchor) implements LookAt { + @Override + public void perform(CommandSourceStack commandSourceStack, Entity entity) { + if (entity instanceof ServerPlayer serverPlayer) { + serverPlayer.lookAt(commandSourceStack.getAnchor(), this.entity, this.anchor); + } else { + entity.lookAt(commandSourceStack.getAnchor(), this.anchor.apply(this.entity)); + } + } + } + + public record LookAtPosition(Vec3 position) implements LookAt { + @Override + public void perform(CommandSourceStack commandSourceStack, Entity entity) { + entity.lookAt(commandSourceStack.getAnchor(), this.position); + } + } +} diff --git a/net/minecraft/server/commands/LootCommand.java b/net/minecraft/server/commands/LootCommand.java index dc79b9df..eec6ed48 100644 --- a/net/minecraft/server/commands/LootCommand.java +++ b/net/minecraft/server/commands/LootCommand.java @@ -10,6 +10,7 @@ import com.mojang.brigadier.exceptions.DynamicCommandExceptionType; import com.mojang.brigadier.suggestion.SuggestionProvider; import java.util.Collection; import java.util.List; +import java.util.Optional; import net.minecraft.commands.CommandBuildContext; import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.Commands; @@ -52,8 +53,11 @@ public class LootCommand { private static final DynamicCommandExceptionType ERROR_NO_HELD_ITEMS = new DynamicCommandExceptionType( object -> Component.translatableEscape("commands.drop.no_held_items", object) ); - private static final DynamicCommandExceptionType ERROR_NO_LOOT_TABLE = new DynamicCommandExceptionType( - object -> Component.translatableEscape("commands.drop.no_loot_table", object) + private static final DynamicCommandExceptionType ERROR_NO_ENTITY_LOOT_TABLE = new DynamicCommandExceptionType( + object -> Component.translatableEscape("commands.drop.no_loot_table.entity", object) + ); + private static final DynamicCommandExceptionType ERROR_NO_BLOCK_LOOT_TABLE = new DynamicCommandExceptionType( + object -> Component.translatableEscape("commands.drop.no_loot_table.block", object) ); public static void register(CommandDispatcher dispatcher, CommandBuildContext context) { @@ -433,21 +437,26 @@ public class LootCommand { ServerLevel serverLevel = commandSourceStack.getLevel(); BlockState blockState = serverLevel.getBlockState(pos); BlockEntity blockEntity = serverLevel.getBlockEntity(pos); - LootParams.Builder builder = new LootParams.Builder(serverLevel) - .withParameter(LootContextParams.ORIGIN, Vec3.atCenterOf(pos)) - .withParameter(LootContextParams.BLOCK_STATE, blockState) - .withOptionalParameter(LootContextParams.BLOCK_ENTITY, blockEntity) - .withOptionalParameter(LootContextParams.THIS_ENTITY, commandSourceStack.getEntity()) - .withParameter(LootContextParams.TOOL, tool); - List list = blockState.getDrops(builder); - return dropConsumer.accept(context, list, listx -> callback(commandSourceStack, listx, blockState.getBlock().getLootTable())); + Optional> optional = blockState.getBlock().getLootTable(); + if (optional.isEmpty()) { + throw ERROR_NO_BLOCK_LOOT_TABLE.create(blockState.getBlock().getName()); + } else { + LootParams.Builder builder = new LootParams.Builder(serverLevel) + .withParameter(LootContextParams.ORIGIN, Vec3.atCenterOf(pos)) + .withParameter(LootContextParams.BLOCK_STATE, blockState) + .withOptionalParameter(LootContextParams.BLOCK_ENTITY, blockEntity) + .withOptionalParameter(LootContextParams.THIS_ENTITY, commandSourceStack.getEntity()) + .withParameter(LootContextParams.TOOL, tool); + List list = blockState.getDrops(builder); + return dropConsumer.accept(context, list, listx -> callback(commandSourceStack, listx, (ResourceKey)optional.get())); + } } private static int dropKillLoot(CommandContext context, Entity entity, LootCommand.DropConsumer dropConsumer) throws CommandSyntaxException { - if (!(entity instanceof LivingEntity)) { - throw ERROR_NO_LOOT_TABLE.create(entity.getDisplayName()); + Optional> optional = entity.getLootTable(); + if (optional.isEmpty()) { + throw ERROR_NO_ENTITY_LOOT_TABLE.create(entity.getDisplayName()); } else { - ResourceKey resourceKey = ((LivingEntity)entity).getLootTable(); CommandSourceStack commandSourceStack = context.getSource(); LootParams.Builder builder = new LootParams.Builder(commandSourceStack.getLevel()); Entity entity2 = commandSourceStack.getEntity(); @@ -461,9 +470,9 @@ public class LootCommand { builder.withParameter(LootContextParams.THIS_ENTITY, entity); builder.withParameter(LootContextParams.ORIGIN, commandSourceStack.getPosition()); LootParams lootParams = builder.create(LootContextParamSets.ENTITY); - LootTable lootTable = commandSourceStack.getServer().reloadableRegistries().getLootTable(resourceKey); + LootTable lootTable = commandSourceStack.getServer().reloadableRegistries().getLootTable((ResourceKey)optional.get()); List list = lootTable.getRandomItems(lootParams); - return dropConsumer.accept(context, list, listx -> callback(commandSourceStack, listx, resourceKey)); + return dropConsumer.accept(context, list, listx -> callback(commandSourceStack, listx, (ResourceKey)optional.get())); } } diff --git a/net/minecraft/server/commands/PlaceCommand.java b/net/minecraft/server/commands/PlaceCommand.java index 1d4b5fbf..ebf94eb6 100644 --- a/net/minecraft/server/commands/PlaceCommand.java +++ b/net/minecraft/server/commands/PlaceCommand.java @@ -288,12 +288,7 @@ public class PlaceCommand { chunkGenerator, serverLevel.getRandom(), new BoundingBox( - chunkPosx.getMinBlockX(), - serverLevel.getMinBuildHeight(), - chunkPosx.getMinBlockZ(), - chunkPosx.getMaxBlockX(), - serverLevel.getMaxBuildHeight(), - chunkPosx.getMaxBlockZ() + chunkPosx.getMinBlockX(), serverLevel.getMinY(), chunkPosx.getMinBlockZ(), chunkPosx.getMaxBlockX(), serverLevel.getMaxY() + 1, chunkPosx.getMaxBlockZ() ), chunkPosx ) diff --git a/net/minecraft/server/commands/RaidCommand.java b/net/minecraft/server/commands/RaidCommand.java index b174ad5b..f2c35b59 100644 --- a/net/minecraft/server/commands/RaidCommand.java +++ b/net/minecraft/server/commands/RaidCommand.java @@ -16,9 +16,9 @@ import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; import net.minecraft.world.effect.MobEffectInstance; import net.minecraft.world.effect.MobEffects; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.EquipmentSlot; -import net.minecraft.world.entity.MobSpawnType; import net.minecraft.world.entity.raid.Raid; import net.minecraft.world.entity.raid.Raider; import net.minecraft.world.entity.raid.Raids; @@ -89,15 +89,15 @@ public class RaidCommand { private static int spawnLeader(CommandSourceStack source) { source.sendSuccess(() -> Component.literal("Spawned a raid captain"), false); - Raider raider = EntityType.PILLAGER.create(source.getLevel()); + Raider raider = EntityType.PILLAGER.create(source.getLevel(), EntitySpawnReason.COMMAND); if (raider == null) { source.sendFailure(Component.literal("Pillager failed to spawn")); return 0; } else { raider.setPatrolLeader(true); - raider.setItemSlot(EquipmentSlot.HEAD, Raid.getLeaderBannerInstance(source.registryAccess().lookupOrThrow(Registries.BANNER_PATTERN))); + raider.setItemSlot(EquipmentSlot.HEAD, Raid.getOminousBannerInstance(source.registryAccess().lookupOrThrow(Registries.BANNER_PATTERN))); raider.setPos(source.getPosition().x, source.getPosition().y, source.getPosition().z); - raider.finalizeSpawn(source.getLevel(), source.getLevel().getCurrentDifficultyAt(BlockPos.containing(source.getPosition())), MobSpawnType.COMMAND, null); + raider.finalizeSpawn(source.getLevel(), source.getLevel().getCurrentDifficultyAt(BlockPos.containing(source.getPosition())), EntitySpawnReason.COMMAND, null); source.getLevel().addFreshEntityWithPassengers(raider); return 1; } diff --git a/net/minecraft/server/commands/RecipeCommand.java b/net/minecraft/server/commands/RecipeCommand.java index c9d43c8e..2a2b676d 100644 --- a/net/minecraft/server/commands/RecipeCommand.java +++ b/net/minecraft/server/commands/RecipeCommand.java @@ -8,8 +8,8 @@ import java.util.Collections; import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.Commands; import net.minecraft.commands.arguments.EntityArgument; -import net.minecraft.commands.arguments.ResourceLocationArgument; -import net.minecraft.commands.synchronization.SuggestionProviders; +import net.minecraft.commands.arguments.ResourceKeyArgument; +import net.minecraft.core.registries.Registries; import net.minecraft.network.chat.Component; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.item.crafting.RecipeHolder; @@ -27,13 +27,12 @@ public class RecipeCommand { .then( Commands.argument("targets", EntityArgument.players()) .then( - Commands.argument("recipe", ResourceLocationArgument.id()) - .suggests(SuggestionProviders.ALL_RECIPES) + Commands.argument("recipe", ResourceKeyArgument.key(Registries.RECIPE)) .executes( commandContext -> giveRecipes( commandContext.getSource(), EntityArgument.getPlayers(commandContext, "targets"), - Collections.singleton(ResourceLocationArgument.getRecipe(commandContext, "recipe")) + Collections.singleton(ResourceKeyArgument.getRecipe(commandContext, "recipe")) ) ) ) @@ -54,13 +53,12 @@ public class RecipeCommand { .then( Commands.argument("targets", EntityArgument.players()) .then( - Commands.argument("recipe", ResourceLocationArgument.id()) - .suggests(SuggestionProviders.ALL_RECIPES) + Commands.argument("recipe", ResourceKeyArgument.key(Registries.RECIPE)) .executes( commandContext -> takeRecipes( commandContext.getSource(), EntityArgument.getPlayers(commandContext, "targets"), - Collections.singleton(ResourceLocationArgument.getRecipe(commandContext, "recipe")) + Collections.singleton(ResourceKeyArgument.getRecipe(commandContext, "recipe")) ) ) ) diff --git a/net/minecraft/server/commands/RotateCommand.java b/net/minecraft/server/commands/RotateCommand.java new file mode 100644 index 00000000..a0a71e63 --- /dev/null +++ b/net/minecraft/server/commands/RotateCommand.java @@ -0,0 +1,85 @@ +package net.minecraft.server.commands; + +import com.mojang.brigadier.CommandDispatcher; +import net.minecraft.commands.CommandSourceStack; +import net.minecraft.commands.Commands; +import net.minecraft.commands.arguments.EntityAnchorArgument; +import net.minecraft.commands.arguments.EntityArgument; +import net.minecraft.commands.arguments.EntityAnchorArgument.Anchor; +import net.minecraft.commands.arguments.coordinates.Coordinates; +import net.minecraft.commands.arguments.coordinates.RotationArgument; +import net.minecraft.commands.arguments.coordinates.Vec3Argument; +import net.minecraft.network.chat.Component; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.phys.Vec2; + +public class RotateCommand { + public static void register(CommandDispatcher commandDispatcher) { + commandDispatcher.register( + Commands.literal("rotate") + .requires(commandSourceStack -> commandSourceStack.hasPermission(2)) + .then( + Commands.argument("target", EntityArgument.entity()) + .then( + Commands.argument("rotation", RotationArgument.rotation()) + .executes( + commandContext -> rotate( + commandContext.getSource(), EntityArgument.getEntity(commandContext, "target"), RotationArgument.getRotation(commandContext, "rotation") + ) + ) + ) + .then( + Commands.literal("facing") + .then( + Commands.literal("entity") + .then( + Commands.argument("facingEntity", EntityArgument.entity()) + .executes( + commandContext -> rotate( + commandContext.getSource(), + EntityArgument.getEntity(commandContext, "target"), + new LookAt.LookAtEntity(EntityArgument.getEntity(commandContext, "facingEntity"), Anchor.FEET) + ) + ) + .then( + Commands.argument("facingAnchor", EntityAnchorArgument.anchor()) + .executes( + commandContext -> rotate( + commandContext.getSource(), + EntityArgument.getEntity(commandContext, "target"), + new LookAt.LookAtEntity( + EntityArgument.getEntity(commandContext, "facingEntity"), EntityAnchorArgument.getAnchor(commandContext, "facingAnchor") + ) + ) + ) + ) + ) + ) + .then( + Commands.argument("facingLocation", Vec3Argument.vec3()) + .executes( + commandContext -> rotate( + commandContext.getSource(), + EntityArgument.getEntity(commandContext, "target"), + new LookAt.LookAtPosition(Vec3Argument.getVec3(commandContext, "facingLocation")) + ) + ) + ) + ) + ) + ); + } + + private static int rotate(CommandSourceStack commandSourceStack, Entity entity, Coordinates coordinates) { + Vec2 vec2 = coordinates.getRotation(commandSourceStack); + entity.forceSetRotation(vec2.y, vec2.x); + commandSourceStack.sendSuccess(() -> Component.translatable("commands.rotate.success", entity.getDisplayName()), true); + return 1; + } + + private static int rotate(CommandSourceStack commandSourceStack, Entity entity, LookAt lookAt) { + lookAt.perform(commandSourceStack, entity); + commandSourceStack.sendSuccess(() -> Component.translatable("commands.rotate.success", entity.getDisplayName()), true); + return 1; + } +} diff --git a/net/minecraft/server/commands/ScheduleCommand.java b/net/minecraft/server/commands/ScheduleCommand.java index 27c902d3..b5b86feb 100644 --- a/net/minecraft/server/commands/ScheduleCommand.java +++ b/net/minecraft/server/commands/ScheduleCommand.java @@ -10,12 +10,14 @@ import com.mojang.brigadier.suggestion.SuggestionProvider; import com.mojang.datafixers.util.Either; import com.mojang.datafixers.util.Pair; import java.util.Collection; +import java.util.Optional; import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.Commands; import net.minecraft.commands.SharedSuggestionProvider; import net.minecraft.commands.arguments.TimeArgument; import net.minecraft.commands.arguments.item.FunctionArgument; import net.minecraft.commands.functions.CommandFunction; +import net.minecraft.commands.functions.MacroFunction; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.MinecraftServer; @@ -28,6 +30,7 @@ public class ScheduleCommand { private static final DynamicCommandExceptionType ERROR_CANT_REMOVE = new DynamicCommandExceptionType( object -> Component.translatableEscape("commands.schedule.cleared.failure", object) ); + private static final SimpleCommandExceptionType ERROR_MACRO = new SimpleCommandExceptionType(Component.translatableEscape("commands.schedule.macro")); private static final SuggestionProvider SUGGEST_SCHEDULE = (commandContext, suggestionsBuilder) -> SharedSuggestionProvider.suggest( commandContext.getSource().getServer().getWorldData().overworldData().getScheduledEvents().getEventsIds(), suggestionsBuilder ); @@ -99,7 +102,12 @@ public class ScheduleCommand { long l = source.getLevel().getGameTime() + time; ResourceLocation resourceLocation = function.getFirst(); TimerQueue timerQueue = source.getServer().getWorldData().overworldData().getScheduledEvents(); - function.getSecond().ifLeft(commandFunction -> { + Optional> optional = function.getSecond().left(); + if (optional.isPresent()) { + if (optional.get() instanceof MacroFunction) { + throw ERROR_MACRO.create(); + } + String string = resourceLocation.toString(); if (append) { timerQueue.remove(string); @@ -107,7 +115,7 @@ public class ScheduleCommand { timerQueue.schedule(string, l, new FunctionCallback(resourceLocation)); source.sendSuccess(() -> Component.translatable("commands.schedule.created.function", Component.translationArg(resourceLocation), time, l), true); - }).ifRight(collection -> { + } else { String string = "#" + resourceLocation; if (append) { timerQueue.remove(string); @@ -115,7 +123,8 @@ public class ScheduleCommand { timerQueue.schedule(string, l, new FunctionTagCallback(resourceLocation)); source.sendSuccess(() -> Component.translatable("commands.schedule.created.tag", Component.translationArg(resourceLocation), time, l), true); - }); + } + return Math.floorMod(l, Integer.MAX_VALUE); } } diff --git a/net/minecraft/server/commands/SetPlayerIdleTimeoutCommand.java b/net/minecraft/server/commands/SetPlayerIdleTimeoutCommand.java index 7727d3a9..c8ecfad1 100644 --- a/net/minecraft/server/commands/SetPlayerIdleTimeoutCommand.java +++ b/net/minecraft/server/commands/SetPlayerIdleTimeoutCommand.java @@ -20,7 +20,12 @@ public class SetPlayerIdleTimeoutCommand { private static int setIdleTimeout(CommandSourceStack source, int idleTimeout) { source.getServer().setPlayerIdleTimeout(idleTimeout); - source.sendSuccess(() -> Component.translatable("commands.setidletimeout.success", idleTimeout), true); + if (idleTimeout > 0) { + source.sendSuccess(() -> Component.translatable("commands.setidletimeout.success", idleTimeout), true); + } else { + source.sendSuccess(() -> Component.translatable("commands.setidletimeout.success.disabled"), true); + } + return idleTimeout; } } diff --git a/net/minecraft/server/commands/SpawnArmorTrimsCommand.java b/net/minecraft/server/commands/SpawnArmorTrimsCommand.java index c0eb758b..3086e317 100644 --- a/net/minecraft/server/commands/SpawnArmorTrimsCommand.java +++ b/net/minecraft/server/commands/SpawnArmorTrimsCommand.java @@ -1,65 +1,40 @@ package net.minecraft.server.commands; -import com.google.common.collect.Maps; import com.mojang.brigadier.CommandDispatcher; -import com.mojang.datafixers.util.Pair; import java.util.Comparator; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.function.ToIntFunction; +import java.util.stream.Collectors; import net.minecraft.Util; import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.Commands; import net.minecraft.core.BlockPos; import net.minecraft.core.Holder; +import net.minecraft.core.HolderLookup; import net.minecraft.core.NonNullList; import net.minecraft.core.Registry; import net.minecraft.core.component.DataComponents; import net.minecraft.core.registries.Registries; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceKey; +import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.decoration.ArmorStand; import net.minecraft.world.entity.player.Player; -import net.minecraft.world.item.ArmorItem; -import net.minecraft.world.item.ArmorMaterial; -import net.minecraft.world.item.ArmorMaterials; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; -import net.minecraft.world.item.armortrim.ArmorTrim; -import net.minecraft.world.item.armortrim.TrimMaterial; -import net.minecraft.world.item.armortrim.TrimMaterials; -import net.minecraft.world.item.armortrim.TrimPattern; -import net.minecraft.world.item.armortrim.TrimPatterns; +import net.minecraft.world.item.equipment.Equippable; +import net.minecraft.world.item.equipment.trim.ArmorTrim; +import net.minecraft.world.item.equipment.trim.TrimMaterial; +import net.minecraft.world.item.equipment.trim.TrimMaterials; +import net.minecraft.world.item.equipment.trim.TrimPattern; +import net.minecraft.world.item.equipment.trim.TrimPatterns; import net.minecraft.world.level.Level; public class SpawnArmorTrimsCommand { - private static final Map, EquipmentSlot>, Item> MATERIAL_AND_SLOT_TO_ITEM = Util.make( - Maps., EquipmentSlot>, Item>newHashMap(), hashMap -> { - hashMap.put(Pair.of(ArmorMaterials.CHAIN, EquipmentSlot.HEAD), Items.CHAINMAIL_HELMET); - hashMap.put(Pair.of(ArmorMaterials.CHAIN, EquipmentSlot.CHEST), Items.CHAINMAIL_CHESTPLATE); - hashMap.put(Pair.of(ArmorMaterials.CHAIN, EquipmentSlot.LEGS), Items.CHAINMAIL_LEGGINGS); - hashMap.put(Pair.of(ArmorMaterials.CHAIN, EquipmentSlot.FEET), Items.CHAINMAIL_BOOTS); - hashMap.put(Pair.of(ArmorMaterials.IRON, EquipmentSlot.HEAD), Items.IRON_HELMET); - hashMap.put(Pair.of(ArmorMaterials.IRON, EquipmentSlot.CHEST), Items.IRON_CHESTPLATE); - hashMap.put(Pair.of(ArmorMaterials.IRON, EquipmentSlot.LEGS), Items.IRON_LEGGINGS); - hashMap.put(Pair.of(ArmorMaterials.IRON, EquipmentSlot.FEET), Items.IRON_BOOTS); - hashMap.put(Pair.of(ArmorMaterials.GOLD, EquipmentSlot.HEAD), Items.GOLDEN_HELMET); - hashMap.put(Pair.of(ArmorMaterials.GOLD, EquipmentSlot.CHEST), Items.GOLDEN_CHESTPLATE); - hashMap.put(Pair.of(ArmorMaterials.GOLD, EquipmentSlot.LEGS), Items.GOLDEN_LEGGINGS); - hashMap.put(Pair.of(ArmorMaterials.GOLD, EquipmentSlot.FEET), Items.GOLDEN_BOOTS); - hashMap.put(Pair.of(ArmorMaterials.NETHERITE, EquipmentSlot.HEAD), Items.NETHERITE_HELMET); - hashMap.put(Pair.of(ArmorMaterials.NETHERITE, EquipmentSlot.CHEST), Items.NETHERITE_CHESTPLATE); - hashMap.put(Pair.of(ArmorMaterials.NETHERITE, EquipmentSlot.LEGS), Items.NETHERITE_LEGGINGS); - hashMap.put(Pair.of(ArmorMaterials.NETHERITE, EquipmentSlot.FEET), Items.NETHERITE_BOOTS); - hashMap.put(Pair.of(ArmorMaterials.DIAMOND, EquipmentSlot.HEAD), Items.DIAMOND_HELMET); - hashMap.put(Pair.of(ArmorMaterials.DIAMOND, EquipmentSlot.CHEST), Items.DIAMOND_CHESTPLATE); - hashMap.put(Pair.of(ArmorMaterials.DIAMOND, EquipmentSlot.LEGS), Items.DIAMOND_LEGGINGS); - hashMap.put(Pair.of(ArmorMaterials.DIAMOND, EquipmentSlot.FEET), Items.DIAMOND_BOOTS); - hashMap.put(Pair.of(ArmorMaterials.TURTLE, EquipmentSlot.HEAD), Items.TURTLE_HELMET); - } - ); private static final List> VANILLA_TRIM_PATTERNS = List.of( TrimPatterns.SENTRY, TrimPatterns.DUNE, @@ -106,8 +81,13 @@ public class SpawnArmorTrimsCommand { private static int spawnArmorTrims(CommandSourceStack source, Player player) { Level level = player.level(); NonNullList nonNullList = NonNullList.create(); - Registry registry = level.registryAccess().registryOrThrow(Registries.TRIM_PATTERN); - Registry registry2 = level.registryAccess().registryOrThrow(Registries.TRIM_MATERIAL); + Registry registry = level.registryAccess().lookupOrThrow(Registries.TRIM_PATTERN); + Registry registry2 = level.registryAccess().lookupOrThrow(Registries.TRIM_MATERIAL); + HolderLookup holderLookup = level.holderLookup(Registries.ITEM); + Map> map = (Map>)holderLookup.listElements().map(Holder.Reference::value).filter(itemx -> { + Equippable equippablex = itemx.components().get(DataComponents.EQUIPPABLE); + return equippablex != null && equippablex.slot().getType() == EquipmentSlot.Type.HUMANOID_ARMOR && equippablex.model().isPresent(); + }).collect(Collectors.groupingBy(itemx -> (ResourceLocation)itemx.components().get(DataComponents.EQUIPPABLE).model().get())); registry.stream() .sorted(Comparator.comparing(trimPattern -> TRIM_PATTERN_ORDER.applyAsInt((ResourceKey)registry.getResourceKey(trimPattern).orElse(null)))) .forEachOrdered( @@ -116,42 +96,37 @@ public class SpawnArmorTrimsCommand { .forEachOrdered(trimMaterial -> nonNullList.add(new ArmorTrim(registry2.wrapAsHolder(trimMaterial), registry.wrapAsHolder(trimPattern)))) ); BlockPos blockPos = player.blockPosition().relative(player.getDirection(), 5); - Registry registry3 = source.registryAccess().registryOrThrow(Registries.ARMOR_MATERIAL); - int i = registry3.size() - 1; + int i = map.size() - 1; double d = 3.0; int j = 0; int k = 0; for (ArmorTrim armorTrim : nonNullList) { - for (ArmorMaterial armorMaterial : registry3) { - if (armorMaterial != ArmorMaterials.LEATHER.value()) { - double e = blockPos.getX() + 0.5 - j % registry2.size() * 3.0; - double f = blockPos.getY() + 0.5 + k % i * 3.0; - double g = blockPos.getZ() + 0.5 + j / registry2.size() * 10; - ArmorStand armorStand = new ArmorStand(level, e, f, g); - armorStand.setYRot(180.0F); - armorStand.setNoGravity(true); + for (List list : map.values()) { + double e = blockPos.getX() + 0.5 - j % registry2.size() * 3.0; + double f = blockPos.getY() + 0.5 + k % i * 3.0; + double g = blockPos.getZ() + 0.5 + j / registry2.size() * 10; + ArmorStand armorStand = new ArmorStand(level, e, f, g); + armorStand.setYRot(180.0F); + armorStand.setNoGravity(true); - for (EquipmentSlot equipmentSlot : EquipmentSlot.values()) { - Item item = (Item)MATERIAL_AND_SLOT_TO_ITEM.get(Pair.of(armorMaterial, equipmentSlot)); - if (item != null) { - ItemStack itemStack = new ItemStack(item); - itemStack.set(DataComponents.TRIM, armorTrim); - armorStand.setItemSlot(equipmentSlot, itemStack); - if (item instanceof ArmorItem armorItem && armorItem.getMaterial().is(ArmorMaterials.TURTLE)) { - armorStand.setCustomName( - armorTrim.pattern().value().copyWithStyle(armorTrim.material()).copy().append(" ").append(armorTrim.material().value().description()) - ); - armorStand.setCustomNameVisible(true); - } else { - armorStand.setInvisible(true); - } - } + for (Item item : list) { + Equippable equippable = (Equippable)Objects.requireNonNull(item.components().get(DataComponents.EQUIPPABLE)); + ItemStack itemStack = new ItemStack(item); + itemStack.set(DataComponents.TRIM, armorTrim); + armorStand.setItemSlot(equippable.slot(), itemStack); + if (itemStack.is(Items.TURTLE_HELMET)) { + armorStand.setCustomName( + armorTrim.pattern().value().copyWithStyle(armorTrim.material()).copy().append(" ").append(armorTrim.material().value().description()) + ); + armorStand.setCustomNameVisible(true); + } else { + armorStand.setInvisible(true); } - - level.addFreshEntity(armorStand); - k++; } + + level.addFreshEntity(armorStand); + k++; } j++; diff --git a/net/minecraft/server/commands/SpreadPlayersCommand.java b/net/minecraft/server/commands/SpreadPlayersCommand.java index 62e5f7c6..8d3af53c 100644 --- a/net/minecraft/server/commands/SpreadPlayersCommand.java +++ b/net/minecraft/server/commands/SpreadPlayersCommand.java @@ -63,7 +63,7 @@ public class SpreadPlayersCommand { Vec2Argument.getVec2(commandContext, "center"), FloatArgumentType.getFloat(commandContext, "spreadDistance"), FloatArgumentType.getFloat(commandContext, "maxRange"), - commandContext.getSource().getLevel().getMaxBuildHeight(), + commandContext.getSource().getLevel().getMaxY() + 1, BoolArgumentType.getBool(commandContext, "respectTeams"), EntityArgument.getEntities(commandContext, "targets") ) @@ -103,7 +103,7 @@ public class SpreadPlayersCommand { CommandSourceStack source, Vec2 center, float spreadDistance, float maxRange, int maxHeight, boolean respectTeams, Collection targets ) throws CommandSyntaxException { ServerLevel serverLevel = source.getLevel(); - int i = serverLevel.getMinBuildHeight(); + int i = serverLevel.getMinY(); if (maxHeight < i) { throw ERROR_INVALID_MAX_HEIGHT.create(maxHeight, i); } else { @@ -244,7 +244,7 @@ public class SpreadPlayersCommand { } entity.teleportTo( - level, Mth.floor(position.x) + 0.5, position.getSpawnY(level, maxHeight), Mth.floor(position.z) + 0.5, Set.of(), entity.getYRot(), entity.getXRot() + level, Mth.floor(position.x) + 0.5, position.getSpawnY(level, maxHeight), Mth.floor(position.z) + 0.5, Set.of(), entity.getYRot(), entity.getXRot(), true ); double e = Double.MAX_VALUE; @@ -325,7 +325,7 @@ public class SpreadPlayersCommand { mutableBlockPos.move(Direction.DOWN); boolean bl2 = level.getBlockState(mutableBlockPos).isAir(); - while (mutableBlockPos.getY() > level.getMinBuildHeight()) { + while (mutableBlockPos.getY() > level.getMinY()) { mutableBlockPos.move(Direction.DOWN); boolean bl3 = level.getBlockState(mutableBlockPos).isAir(); if (!bl3 && bl2 && bl) { diff --git a/net/minecraft/server/commands/SummonCommand.java b/net/minecraft/server/commands/SummonCommand.java index 6661d30b..59f5864c 100644 --- a/net/minecraft/server/commands/SummonCommand.java +++ b/net/minecraft/server/commands/SummonCommand.java @@ -17,9 +17,9 @@ import net.minecraft.nbt.CompoundTag; import net.minecraft.network.chat.Component; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.Mob; -import net.minecraft.world.entity.MobSpawnType; import net.minecraft.world.level.Level; import net.minecraft.world.phys.Vec3; @@ -80,7 +80,7 @@ public class SummonCommand { CompoundTag compoundTag = tag.copy(); compoundTag.putString("id", type.key().location().toString()); ServerLevel serverLevel = source.getLevel(); - Entity entity = EntityType.loadEntityRecursive(compoundTag, serverLevel, entityx -> { + Entity entity = EntityType.loadEntityRecursive(compoundTag, serverLevel, EntitySpawnReason.COMMAND, entityx -> { entityx.moveTo(pos.x, pos.y, pos.z, entityx.getYRot(), entityx.getXRot()); return entityx; }); @@ -88,7 +88,7 @@ public class SummonCommand { throw ERROR_FAILED.create(); } else { if (randomizeProperties && entity instanceof Mob) { - ((Mob)entity).finalizeSpawn(source.getLevel(), source.getLevel().getCurrentDifficultyAt(entity.blockPosition()), MobSpawnType.COMMAND, null); + ((Mob)entity).finalizeSpawn(source.getLevel(), source.getLevel().getCurrentDifficultyAt(entity.blockPosition()), EntitySpawnReason.COMMAND, null); } if (!serverLevel.tryAddFreshEntityWithPassengers(entity)) { diff --git a/net/minecraft/server/commands/TeleportCommand.java b/net/minecraft/server/commands/TeleportCommand.java index 833449a7..fd3075e2 100644 --- a/net/minecraft/server/commands/TeleportCommand.java +++ b/net/minecraft/server/commands/TeleportCommand.java @@ -13,19 +13,18 @@ import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.Commands; import net.minecraft.commands.arguments.EntityAnchorArgument; import net.minecraft.commands.arguments.EntityArgument; +import net.minecraft.commands.arguments.EntityAnchorArgument.Anchor; import net.minecraft.commands.arguments.coordinates.Coordinates; import net.minecraft.commands.arguments.coordinates.RotationArgument; import net.minecraft.commands.arguments.coordinates.Vec3Argument; -import net.minecraft.commands.arguments.coordinates.WorldCoordinates; import net.minecraft.core.BlockPos; import net.minecraft.network.chat.Component; import net.minecraft.server.level.ServerLevel; -import net.minecraft.server.level.ServerPlayer; import net.minecraft.util.Mth; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.PathfinderMob; -import net.minecraft.world.entity.RelativeMovement; +import net.minecraft.world.entity.Relative; import net.minecraft.world.level.Level; import net.minecraft.world.phys.Vec2; import net.minecraft.world.phys.Vec3; @@ -46,7 +45,7 @@ public class TeleportCommand { Collections.singleton(commandContext.getSource().getEntityOrException()), commandContext.getSource().getLevel(), Vec3Argument.getCoordinates(commandContext, "location"), - WorldCoordinates.current(), + null, null ) ) @@ -101,7 +100,7 @@ public class TeleportCommand { commandContext.getSource().getLevel(), Vec3Argument.getCoordinates(commandContext, "location"), null, - new TeleportCommand.LookAtEntity(EntityArgument.getEntity(commandContext, "facingEntity"), EntityAnchorArgument.Anchor.FEET) + new LookAt.LookAtEntity(EntityArgument.getEntity(commandContext, "facingEntity"), Anchor.FEET) ) ) .then( @@ -113,7 +112,7 @@ public class TeleportCommand { commandContext.getSource().getLevel(), Vec3Argument.getCoordinates(commandContext, "location"), null, - new TeleportCommand.LookAtEntity( + new LookAt.LookAtEntity( EntityArgument.getEntity(commandContext, "facingEntity"), EntityAnchorArgument.getAnchor(commandContext, "facingAnchor") ) ) @@ -130,7 +129,7 @@ public class TeleportCommand { commandContext.getSource().getLevel(), Vec3Argument.getCoordinates(commandContext, "location"), null, - new TeleportCommand.LookAtPosition(Vec3Argument.getVec3(commandContext, "facingLocation")) + new LookAt.LookAtPosition(Vec3Argument.getVec3(commandContext, "facingLocation")) ) ) ) @@ -158,7 +157,7 @@ public class TeleportCommand { destination.getX(), destination.getY(), destination.getZ(), - EnumSet.noneOf(RelativeMovement.class), + EnumSet.noneOf(Relative.class), destination.getYRot(), destination.getXRot(), null @@ -178,54 +177,30 @@ public class TeleportCommand { } private static int teleportToPos( - CommandSourceStack source, - Collection targets, - ServerLevel level, - Coordinates position, - @Nullable Coordinates rotation, - @Nullable TeleportCommand.LookAt facing + CommandSourceStack commandSourceStack, + Collection collection, + ServerLevel serverLevel, + Coordinates coordinates, + @Nullable Coordinates coordinates2, + @Nullable LookAt lookAt ) throws CommandSyntaxException { - Vec3 vec3 = position.getPosition(source); - Vec2 vec2 = rotation == null ? null : rotation.getRotation(source); - Set set = EnumSet.noneOf(RelativeMovement.class); - if (position.isXRelative()) { - set.add(RelativeMovement.X); - } + Vec3 vec3 = coordinates.getPosition(commandSourceStack); + Vec2 vec2 = coordinates2 == null ? null : coordinates2.getRotation(commandSourceStack); - if (position.isYRelative()) { - set.add(RelativeMovement.Y); - } - - if (position.isZRelative()) { - set.add(RelativeMovement.Z); - } - - if (rotation == null) { - set.add(RelativeMovement.X_ROT); - set.add(RelativeMovement.Y_ROT); - } else { - if (rotation.isXRelative()) { - set.add(RelativeMovement.X_ROT); - } - - if (rotation.isYRelative()) { - set.add(RelativeMovement.Y_ROT); - } - } - - for (Entity entity : targets) { - if (rotation == null) { - performTeleport(source, entity, level, vec3.x, vec3.y, vec3.z, set, entity.getYRot(), entity.getXRot(), facing); + for (Entity entity : collection) { + Set set = getRelatives(coordinates, coordinates2, entity.level().dimension() == serverLevel.dimension()); + if (vec2 == null) { + performTeleport(commandSourceStack, entity, serverLevel, vec3.x, vec3.y, vec3.z, set, entity.getYRot(), entity.getXRot(), lookAt); } else { - performTeleport(source, entity, level, vec3.x, vec3.y, vec3.z, set, vec2.y, vec2.x, facing); + performTeleport(commandSourceStack, entity, serverLevel, vec3.x, vec3.y, vec3.z, set, vec2.y, vec2.x, lookAt); } } - if (targets.size() == 1) { - source.sendSuccess( + if (collection.size() == 1) { + commandSourceStack.sendSuccess( () -> Component.translatable( "commands.teleport.success.location.single", - ((Entity)targets.iterator().next()).getDisplayName(), + ((Entity)collection.iterator().next()).getDisplayName(), formatDouble(vec3.x), formatDouble(vec3.y), formatDouble(vec3.z) @@ -233,15 +208,49 @@ public class TeleportCommand { true ); } else { - source.sendSuccess( + commandSourceStack.sendSuccess( () -> Component.translatable( - "commands.teleport.success.location.multiple", targets.size(), formatDouble(vec3.x), formatDouble(vec3.y), formatDouble(vec3.z) + "commands.teleport.success.location.multiple", collection.size(), formatDouble(vec3.x), formatDouble(vec3.y), formatDouble(vec3.z) ), true ); } - return targets.size(); + return collection.size(); + } + + private static Set getRelatives(Coordinates coordinates, @Nullable Coordinates coordinates2, boolean bl) { + Set set = EnumSet.noneOf(Relative.class); + if (coordinates.isXRelative()) { + set.add(Relative.DELTA_X); + if (bl) { + set.add(Relative.X); + } + } + + if (coordinates.isYRelative()) { + set.add(Relative.DELTA_Y); + if (bl) { + set.add(Relative.Y); + } + } + + if (coordinates.isZRelative()) { + set.add(Relative.DELTA_Z); + if (bl) { + set.add(Relative.Z); + } + } + + if (coordinates2 == null || coordinates2.isXRelative()) { + set.add(Relative.X_ROT); + } + + if (coordinates2 == null || coordinates2.isYRelative()) { + set.add(Relative.Y_ROT); + } + + return set; } private static String formatDouble(double value) { @@ -249,26 +258,31 @@ public class TeleportCommand { } private static void performTeleport( - CommandSourceStack source, + CommandSourceStack commandSourceStack, Entity entity, - ServerLevel level, - double x, - double y, - double z, - Set relativeList, - float yaw, - float pitch, - @Nullable TeleportCommand.LookAt facing + ServerLevel serverLevel, + double d, + double e, + double f, + Set set, + float g, + float h, + @Nullable LookAt lookAt ) throws CommandSyntaxException { - BlockPos blockPos = BlockPos.containing(x, y, z); + BlockPos blockPos = BlockPos.containing(d, e, f); if (!Level.isInSpawnableBounds(blockPos)) { throw INVALID_POSITION.create(); } else { - float f = Mth.wrapDegrees(yaw); - float g = Mth.wrapDegrees(pitch); - if (entity.teleportTo(level, x, y, z, relativeList, f, g)) { - if (facing != null) { - facing.perform(source, entity); + double i = set.contains(Relative.X) ? d - entity.getX() : d; + double j = set.contains(Relative.Y) ? e - entity.getY() : e; + double k = set.contains(Relative.Z) ? f - entity.getZ() : f; + float l = set.contains(Relative.Y_ROT) ? g - entity.getYRot() : g; + float m = set.contains(Relative.X_ROT) ? h - entity.getXRot() : h; + float n = Mth.wrapDegrees(l); + float o = Mth.wrapDegrees(m); + if (entity.teleportTo(serverLevel, i, j, k, set, n, o, true)) { + if (lookAt != null) { + lookAt.perform(commandSourceStack, entity); } if (!(entity instanceof LivingEntity livingEntity && livingEntity.isFallFlying())) { @@ -282,27 +296,4 @@ public class TeleportCommand { } } } - - @FunctionalInterface - interface LookAt { - void perform(CommandSourceStack source, Entity entity); - } - - record LookAtEntity(Entity entity, EntityAnchorArgument.Anchor anchor) implements TeleportCommand.LookAt { - @Override - public void perform(CommandSourceStack commandSourceStack, Entity entity) { - if (entity instanceof ServerPlayer serverPlayer) { - serverPlayer.lookAt(commandSourceStack.getAnchor(), this.entity, this.anchor); - } else { - entity.lookAt(commandSourceStack.getAnchor(), this.anchor.apply(this.entity)); - } - } - } - - record LookAtPosition(Vec3 position) implements TeleportCommand.LookAt { - @Override - public void perform(CommandSourceStack commandSourceStack, Entity entity) { - entity.lookAt(commandSourceStack.getAnchor(), this.position); - } - } } diff --git a/net/minecraft/server/commands/TickCommand.java b/net/minecraft/server/commands/TickCommand.java index 1d40b279..9f872c0c 100644 --- a/net/minecraft/server/commands/TickCommand.java +++ b/net/minecraft/server/commands/TickCommand.java @@ -4,6 +4,7 @@ import com.mojang.brigadier.CommandDispatcher; import com.mojang.brigadier.arguments.FloatArgumentType; import com.mojang.brigadier.arguments.IntegerArgumentType; import java.util.Arrays; +import java.util.Locale; import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.Commands; import net.minecraft.commands.SharedSuggestionProvider; @@ -54,13 +55,13 @@ public class TickCommand { } private static String nanosToMilisString(long nanos) { - return String.format("%.1f", (float)nanos / (float)TimeUtil.NANOSECONDS_PER_MILLISECOND); + return String.format(Locale.ROOT, "%.1f", (float)nanos / (float)TimeUtil.NANOSECONDS_PER_MILLISECOND); } private static int setTickingRate(CommandSourceStack source, float tickRate) { ServerTickRateManager serverTickRateManager = source.getServer().tickRateManager(); serverTickRateManager.setTickRate(tickRate); - String string = String.format("%.1f", tickRate); + String string = String.format(Locale.ROOT, "%.1f", tickRate); source.sendSuccess(() -> Component.translatable("commands.tick.rate.success", string), true); return (int)tickRate; } @@ -69,7 +70,7 @@ public class TickCommand { ServerTickRateManager serverTickRateManager = source.getServer().tickRateManager(); String string = nanosToMilisString(source.getServer().getAverageTickTimeNanos()); float f = serverTickRateManager.tickrate(); - String string2 = String.format("%.1f", f); + String string2 = String.format(Locale.ROOT, "%.1f", f); if (serverTickRateManager.isSprinting()) { source.sendSuccess(() -> Component.translatable("commands.tick.status.sprinting"), false); source.sendSuccess(() -> Component.translatable("commands.tick.query.rate.sprinting", string2, string), false); diff --git a/net/minecraft/server/dedicated/DedicatedServer.java b/net/minecraft/server/dedicated/DedicatedServer.java index 66b3ec17..2ece0b8b 100644 --- a/net/minecraft/server/dedicated/DedicatedServer.java +++ b/net/minecraft/server/dedicated/DedicatedServer.java @@ -18,7 +18,6 @@ import java.util.Collections; import java.util.List; import java.util.Locale; import java.util.Optional; -import java.util.function.BooleanSupplier; import java.util.function.Supplier; import net.minecraft.DefaultUncaughtExceptionHandler; import net.minecraft.DefaultUncaughtExceptionHandlerWithName; @@ -33,12 +32,13 @@ import net.minecraft.server.ServerInterface; import net.minecraft.server.ServerLinks; import net.minecraft.server.Services; import net.minecraft.server.WorldStem; +import net.minecraft.server.ServerLinks.KnownLinkType; import net.minecraft.server.gui.MinecraftServerGui; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.level.progress.ChunkProgressListenerFactory; +import net.minecraft.server.network.ServerTextFilter; import net.minecraft.server.network.TextFilter; -import net.minecraft.server.network.TextFilterClient; import net.minecraft.server.packs.repository.PackRepository; import net.minecraft.server.players.GameProfileCache; import net.minecraft.server.players.OldUsersConverter; @@ -75,7 +75,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface @Nullable private MinecraftServerGui gui; @Nullable - private final TextFilterClient textFilterClient; + private final ServerTextFilter serverTextFilter; @Nullable private RemoteSampleLogger tickTimeLogger; @Nullable @@ -95,7 +95,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface super(serverThread, storageSource, packRepository, worldStem, Proxy.NO_PROXY, fixerUpper, services, progressListenerFactory); this.settings = settings; this.rconConsoleSource = new RconConsoleSource(this); - this.textFilterClient = TextFilterClient.createFromConfig(settings.getProperties().textFilteringConfig); + this.serverTextFilter = ServerTextFilter.createFromConfig(settings.getProperties()); this.serverLinks = createServerLinks(settings); } @@ -219,21 +219,11 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface } } - @Override - public boolean isSpawningAnimals() { - return this.getProperties().spawnAnimals && super.isSpawningAnimals(); - } - @Override public boolean isSpawningMonsters() { return this.settings.getProperties().spawnMonsters && super.isSpawningMonsters(); } - @Override - public boolean areNpcsEnabled() { - return this.settings.getProperties().spawnNpcs && super.areNpcsEnabled(); - } - @Override public DedicatedServerProperties getProperties() { return this.settings.getProperties(); @@ -244,11 +234,6 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface this.setDifficulty(this.getProperties().difficulty, true); } - @Override - public boolean isHardcore() { - return this.getProperties().hardcore; - } - @Override public SystemReport fillServerSystemReport(SystemReport report) { report.setDetail("Is Modded", (Supplier)(() -> this.getModdedStatus().fullDescription())); @@ -267,10 +252,8 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface writer.write(String.format(Locale.ROOT, "spawn-monsters=%s%n", dedicatedServerProperties.spawnMonsters)); writer.write(String.format(Locale.ROOT, "entity-broadcast-range-percentage=%d%n", dedicatedServerProperties.entityBroadcastRangePercentage)); writer.write(String.format(Locale.ROOT, "max-world-size=%d%n", dedicatedServerProperties.maxWorldSize)); - writer.write(String.format(Locale.ROOT, "spawn-npcs=%s%n", dedicatedServerProperties.spawnNpcs)); writer.write(String.format(Locale.ROOT, "view-distance=%d%n", dedicatedServerProperties.viewDistance)); writer.write(String.format(Locale.ROOT, "simulation-distance=%d%n", dedicatedServerProperties.simulationDistance)); - writer.write(String.format(Locale.ROOT, "spawn-animals=%s%n", dedicatedServerProperties.spawnAnimals)); writer.write(String.format(Locale.ROOT, "generate-structures=%s%n", dedicatedServerProperties.worldOptions.generateStructures())); writer.write(String.format(Locale.ROOT, "use-native=%s%n", dedicatedServerProperties.useNativeTransport)); writer.write(String.format(Locale.ROOT, "rate-limit=%d%n", dedicatedServerProperties.rateLimitPacketsPerSecond)); @@ -293,8 +276,8 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface @Override public void onServerExit() { - if (this.textFilterClient != null) { - this.textFilterClient.close(); + if (this.serverTextFilter != null) { + this.serverTextFilter.close(); } if (this.gui != null) { @@ -311,8 +294,8 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface } @Override - public void tickChildren(BooleanSupplier hasTimeLeft) { - super.tickChildren(hasTimeLeft); + public void tickConnection() { + super.tickConnection(); this.handleConsoleInputs(); } @@ -434,7 +417,8 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface @Override public void setPlayerIdleTimeout(int idleTimeout) { super.setPlayerIdleTimeout(idleTimeout); - this.settings.update(dedicatedServerProperties -> dedicatedServerProperties.playerIdleTimeout.update(this.registryAccess(), idleTimeout)); + this.settings + .update(dedicatedServerProperties -> (DedicatedServerProperties)dedicatedServerProperties.playerIdleTimeout.update(this.registryAccess(), idleTimeout)); } @Override @@ -556,7 +540,8 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface } public void storeUsingWhiteList(boolean isStoreUsingWhiteList) { - this.settings.update(dedicatedServerProperties -> dedicatedServerProperties.whiteList.update(this.registryAccess(), isStoreUsingWhiteList)); + this.settings + .update(dedicatedServerProperties -> (DedicatedServerProperties)dedicatedServerProperties.whiteList.update(this.registryAccess(), isStoreUsingWhiteList)); } @Override @@ -588,7 +573,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface @Override public TextFilter createTextFilterForPlayer(ServerPlayer player) { - return this.textFilterClient != null ? this.textFilterClient.createContext(player.getGameProfile()) : TextFilter.DUMMY; + return this.serverTextFilter != null ? this.serverTextFilter.createContext(player.getGameProfile()) : TextFilter.DUMMY; } @Nullable @@ -633,9 +618,14 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface return this.serverLinks; } + @Override + public int pauseWhileEmptySeconds() { + return this.settings.getProperties().pauseWhenEmptySeconds; + } + private static ServerLinks createServerLinks(DedicatedServerSettings settings) { Optional optional = parseBugReportLink(settings.getProperties()); - return (ServerLinks)optional.map(uRI -> new ServerLinks(List.of(ServerLinks.KnownLinkType.BUG_REPORT.create(uRI)))).orElse(ServerLinks.EMPTY); + return (ServerLinks)optional.map(uRI -> new ServerLinks(List.of(KnownLinkType.BUG_REPORT.create(uRI)))).orElse(ServerLinks.EMPTY); } private static Optional parseBugReportLink(DedicatedServerProperties properties) { diff --git a/net/minecraft/server/dedicated/DedicatedServerProperties.java b/net/minecraft/server/dedicated/DedicatedServerProperties.java index 8e366835..7f16b036 100644 --- a/net/minecraft/server/dedicated/DedicatedServerProperties.java +++ b/net/minecraft/server/dedicated/DedicatedServerProperties.java @@ -18,7 +18,7 @@ import java.util.UUID; import java.util.concurrent.TimeUnit; import java.util.regex.Pattern; import net.minecraft.core.Holder; -import net.minecraft.core.Registry; +import net.minecraft.core.HolderLookup; import net.minecraft.core.RegistryAccess; import net.minecraft.core.registries.Registries; import net.minecraft.network.chat.Component; @@ -48,8 +48,6 @@ public class DedicatedServerProperties extends Settings Mth.clamp(integer, 10, 1000), 100); public final String textFilteringConfig = this.get("text-filtering-config", ""); + public final int textFilteringVersion = this.get("text-filtering-version", 0); public final Optional serverResourcePackInfo; public final DataPackConfig initialDataPackConfiguration; public final Settings.MutableValue playerIdleTimeout = this.getMutable("player-idle-timeout", 0); public final Settings.MutableValue whiteList = this.getMutable("white-list", false); public final boolean enforceSecureProfile = this.get("enforce-secure-profile", true); public final boolean logIPs = this.get("log-ips", true); + public final int pauseWhenEmptySeconds = this.get("pause-when-empty-seconds", 60); private final DedicatedServerProperties.WorldDimensionData worldDimensionData; public final WorldOptions worldOptions; public boolean acceptsTransfers = this.get("accepts-transfers", false); @@ -196,8 +196,8 @@ public class DedicatedServerProperties extends Settings registry = registryAccess.registryOrThrow(Registries.WORLD_PRESET); - Holder.Reference reference = (Holder.Reference)registry.getHolder(WorldPresets.NORMAL) - .or(() -> registry.holders().findAny()) + public WorldDimensions create(HolderLookup.Provider provider) { + HolderLookup holderLookup = provider.lookupOrThrow(Registries.WORLD_PRESET); + Holder.Reference reference = (Holder.Reference)holderLookup.get(WorldPresets.NORMAL) + .or(() -> holderLookup.listElements().findAny()) .orElseThrow(() -> new IllegalStateException("Invalid datapack contents: can't find default preset")); Holder holder = (Holder)Optional.ofNullable(ResourceLocation.tryParse(this.levelType)) .map(resourceLocation -> ResourceKey.create(Registries.WORLD_PRESET, resourceLocation)) .or(() -> Optional.ofNullable((ResourceKey)LEGACY_PRESET_NAMES.get(this.levelType))) - .flatMap(registry::getHolder) + .flatMap(holderLookup::get) .orElseGet(() -> { DedicatedServerProperties.LOGGER.warn("Failed to parse level-type {}, defaulting to {}", this.levelType, reference.key().location()); return reference; }); WorldDimensions worldDimensions = holder.value().createWorldDimensions(); if (holder.is(WorldPresets.FLAT)) { - RegistryOps registryOps = registryAccess.createSerializationContext(JsonOps.INSTANCE); + RegistryOps registryOps = provider.createSerializationContext(JsonOps.INSTANCE); Optional optional = FlatLevelGeneratorSettings.CODEC .parse(new Dynamic<>(registryOps, this.generatorSettings())) .resultOrPartial(DedicatedServerProperties.LOGGER::error); if (optional.isPresent()) { - return worldDimensions.replaceOverworldGenerator(registryAccess, new FlatLevelSource((FlatLevelGeneratorSettings)optional.get())); + return worldDimensions.replaceOverworldGenerator(provider, new FlatLevelSource((FlatLevelGeneratorSettings)optional.get())); } } diff --git a/net/minecraft/server/dedicated/ServerWatchdog.java b/net/minecraft/server/dedicated/ServerWatchdog.java index 9ece9dc7..cfa94598 100644 --- a/net/minecraft/server/dedicated/ServerWatchdog.java +++ b/net/minecraft/server/dedicated/ServerWatchdog.java @@ -45,32 +45,16 @@ public class ServerWatchdog implements Runnable { String.format(Locale.ROOT, "%.2f", this.server.tickRateManager().millisecondsPerTick() / (float)TimeUtil.MILLISECONDS_PER_SECOND) ); LOGGER.error(LogUtils.FATAL_MARKER, "Considering it to be crashed, server will forcibly shutdown."); - ThreadMXBean threadMXBean = ManagementFactory.getThreadMXBean(); - ThreadInfo[] threadInfos = threadMXBean.dumpAllThreads(true, true); - StringBuilder stringBuilder = new StringBuilder(); - Error error = new Error("Watchdog"); - - for (ThreadInfo threadInfo : threadInfos) { - if (threadInfo.getThreadId() == this.server.getRunningThread().getId()) { - error.setStackTrace(threadInfo.getStackTrace()); - } - - stringBuilder.append(threadInfo); - stringBuilder.append("\n"); - } - - CrashReport crashReport = new CrashReport("Watching Server", error); + CrashReport crashReport = createWatchdogCrashReport("Watching Server", this.server.getRunningThread().threadId()); this.server.fillSystemReport(crashReport.getSystemReport()); - CrashReportCategory crashReportCategory = crashReport.addCategory("Thread Dump"); - crashReportCategory.setDetail("Threads", stringBuilder); - CrashReportCategory crashReportCategory2 = crashReport.addCategory("Performance stats"); - crashReportCategory2.setDetail( + CrashReportCategory crashReportCategory = crashReport.addCategory("Performance stats"); + crashReportCategory.setDetail( "Random tick rate", (CrashReportDetail)(() -> this.server.getWorldData().getGameRules().getRule(GameRules.RULE_RANDOMTICKING).toString()) ); - crashReportCategory2.setDetail( + crashReportCategory.setDetail( "Level stats", (CrashReportDetail)(() -> (String)Streams.stream(this.server.getAllLevels()) - .map(serverLevel -> serverLevel.dimension() + ": " + serverLevel.getWatchdogStats()) + .map(serverLevel -> serverLevel.dimension().location() + ": " + serverLevel.getWatchdogStats()) .collect(Collectors.joining(",\n"))) ); Bootstrap.realStdoutPrintln("Crash report:\n" + crashReport.getFriendlyReport(ReportType.CRASH)); @@ -86,11 +70,32 @@ public class ServerWatchdog implements Runnable { try { Thread.sleep((l + this.maxTickTimeNanos - m) / TimeUtil.NANOSECONDS_PER_MILLISECOND); - } catch (InterruptedException var15) { + } catch (InterruptedException var10) { } } } + public static CrashReport createWatchdogCrashReport(String string, long l) { + ThreadMXBean threadMXBean = ManagementFactory.getThreadMXBean(); + ThreadInfo[] threadInfos = threadMXBean.dumpAllThreads(true, true); + StringBuilder stringBuilder = new StringBuilder(); + Error error = new Error("Watchdog"); + + for (ThreadInfo threadInfo : threadInfos) { + if (threadInfo.getThreadId() == l) { + error.setStackTrace(threadInfo.getStackTrace()); + } + + stringBuilder.append(threadInfo); + stringBuilder.append("\n"); + } + + CrashReport crashReport = new CrashReport(string, error); + CrashReportCategory crashReportCategory = crashReport.addCategory("Thread Dump"); + crashReportCategory.setDetail("Threads", stringBuilder); + return crashReport; + } + private void exit() { try { Timer timer = new Timer(); diff --git a/net/minecraft/server/level/ChunkGenerationTask.java b/net/minecraft/server/level/ChunkGenerationTask.java index b82db744..0fd96e32 100644 --- a/net/minecraft/server/level/ChunkGenerationTask.java +++ b/net/minecraft/server/level/ChunkGenerationTask.java @@ -4,6 +4,8 @@ import java.util.ArrayList; import java.util.List; import java.util.concurrent.CompletableFuture; import net.minecraft.util.StaticCache2D; +import net.minecraft.util.profiling.Profiler; +import net.minecraft.util.profiling.Zone; import net.minecraft.world.level.ChunkPos; import net.minecraft.world.level.chunk.ChunkAccess; import net.minecraft.world.level.chunk.status.ChunkDependencies; @@ -109,13 +111,16 @@ public class ChunkGenerationTask { } private void scheduleLayer(ChunkStatus status, boolean needsGeneration) { - int i = this.getRadiusForLayer(status, needsGeneration); + try (Zone zone = Profiler.get().zone("scheduleLayer")) { + zone.addText(status::getName); + int i = this.getRadiusForLayer(status, needsGeneration); - for (int j = this.pos.x - i; j <= this.pos.x + i; j++) { - for (int k = this.pos.z - i; k <= this.pos.z + i; k++) { - GenerationChunkHolder generationChunkHolder = this.cache.get(j, k); - if (this.markedForCancellation || !this.scheduleChunkInLayer(status, needsGeneration, generationChunkHolder)) { - return; + for (int j = this.pos.x - i; j <= this.pos.x + i; j++) { + for (int k = this.pos.z - i; k <= this.pos.z + i; k++) { + GenerationChunkHolder generationChunkHolder = this.cache.get(j, k); + if (this.markedForCancellation || !this.scheduleChunkInLayer(status, needsGeneration, generationChunkHolder)) { + return; + } } } } diff --git a/net/minecraft/server/level/ChunkHolder.java b/net/minecraft/server/level/ChunkHolder.java index 4ae43030..acb02cbc 100644 --- a/net/minecraft/server/level/ChunkHolder.java +++ b/net/minecraft/server/level/ChunkHolder.java @@ -118,52 +118,69 @@ public class ChunkHolder extends GenerationChunkHolder { } public boolean isReadyForSaving() { - return this.getGenerationRefCount() == 0 && this.saveSync.isDone(); + return this.saveSync.isDone(); } - private void addSaveDependency(CompletableFuture dependency) { + @Override + protected void addSaveDependency(CompletableFuture completableFuture) { if (this.saveSync.isDone()) { - this.saveSync = dependency; + this.saveSync = completableFuture; } else { - this.saveSync = this.saveSync.thenCombine(dependency, (object, object2) -> null); + this.saveSync = this.saveSync.thenCombine(completableFuture, (object, object2) -> null); } } - public void blockChanged(BlockPos pos) { + public boolean blockChanged(BlockPos blockPos) { LevelChunk levelChunk = this.getTickingChunk(); - if (levelChunk != null) { - int i = this.levelHeightAccessor.getSectionIndex(pos.getY()); + if (levelChunk == null) { + return false; + } else { + boolean bl = this.hasChangedSections; + int i = this.levelHeightAccessor.getSectionIndex(blockPos.getY()); if (this.changedBlocksPerSection[i] == null) { this.hasChangedSections = true; this.changedBlocksPerSection[i] = new ShortOpenHashSet(); } - this.changedBlocksPerSection[i].add(SectionPos.sectionRelativePos(pos)); + this.changedBlocksPerSection[i].add(SectionPos.sectionRelativePos(blockPos)); + return !bl; } } - public void sectionLightChanged(LightLayer type, int sectionY) { + public boolean sectionLightChanged(LightLayer lightLayer, int i) { ChunkAccess chunkAccess = this.getChunkIfPresent(ChunkStatus.INITIALIZE_LIGHT); - if (chunkAccess != null) { - chunkAccess.setUnsaved(true); + if (chunkAccess == null) { + return false; + } else { + chunkAccess.markUnsaved(); LevelChunk levelChunk = this.getTickingChunk(); - if (levelChunk != null) { - int i = this.lightEngine.getMinLightSection(); - int j = this.lightEngine.getMaxLightSection(); - if (sectionY >= i && sectionY <= j) { - int k = sectionY - i; - if (type == LightLayer.SKY) { - this.skyChangedLightSectionFilter.set(k); + if (levelChunk == null) { + return false; + } else { + int j = this.lightEngine.getMinLightSection(); + int k = this.lightEngine.getMaxLightSection(); + if (i >= j && i <= k) { + BitSet bitSet = lightLayer == LightLayer.SKY ? this.skyChangedLightSectionFilter : this.blockChangedLightSectionFilter; + int l = i - j; + if (!bitSet.get(l)) { + bitSet.set(l); + return true; } else { - this.blockChangedLightSectionFilter.set(k); + return false; } + } else { + return false; } } } } + public boolean hasChangesToBroadcast() { + return this.hasChangedSections || !this.skyChangedLightSectionFilter.isEmpty() || !this.blockChangedLightSectionFilter.isEmpty(); + } + public void broadcastChanges(LevelChunk chunk) { - if (this.hasChangedSections || !this.skyChangedLightSectionFilter.isEmpty() || !this.blockChangedLightSectionFilter.isEmpty()) { + if (this.hasChangesToBroadcast()) { Level level = chunk.getLevel(); if (!this.skyChangedLightSectionFilter.isEmpty() || !this.blockChangedLightSectionFilter.isEmpty()) { List list = this.playerProvider.getPlayers(this.pos, true); diff --git a/net/minecraft/server/level/ChunkMap.java b/net/minecraft/server/level/ChunkMap.java index ef8baefd..ab143a8b 100644 --- a/net/minecraft/server/level/ChunkMap.java +++ b/net/minecraft/server/level/ChunkMap.java @@ -16,10 +16,10 @@ import it.unimi.dsi.fastutil.longs.Long2LongMap; import it.unimi.dsi.fastutil.longs.Long2LongOpenHashMap; import it.unimi.dsi.fastutil.longs.Long2ObjectLinkedOpenHashMap; import it.unimi.dsi.fastutil.longs.LongIterator; +import it.unimi.dsi.fastutil.longs.LongLinkedOpenHashSet; import it.unimi.dsi.fastutil.longs.LongOpenHashSet; import it.unimi.dsi.fastutil.longs.LongSet; import it.unimi.dsi.fastutil.longs.Long2ObjectMap.Entry; -import it.unimi.dsi.fastutil.objects.ObjectIterator; import java.io.IOException; import java.io.Writer; import java.nio.file.Path; @@ -39,6 +39,7 @@ import java.util.concurrent.Executor; import java.util.concurrent.atomic.AtomicInteger; import java.util.function.BooleanSupplier; import java.util.function.Consumer; +import java.util.function.IntConsumer; import java.util.function.IntFunction; import java.util.function.IntSupplier; import java.util.function.Supplier; @@ -55,15 +56,16 @@ import net.minecraft.nbt.NbtException; import net.minecraft.network.protocol.Packet; import net.minecraft.network.protocol.game.ClientboundChunksBiomesPacket; import net.minecraft.network.protocol.game.ClientboundSetChunkCacheCenterPacket; +import net.minecraft.server.level.ChunkTrackingView.Positioned; import net.minecraft.server.level.progress.ChunkProgressListener; import net.minecraft.server.network.ServerPlayerConnection; import net.minecraft.util.CsvOutput; import net.minecraft.util.Mth; import net.minecraft.util.StaticCache2D; +import net.minecraft.util.profiling.Profiler; import net.minecraft.util.profiling.ProfilerFiller; import net.minecraft.util.thread.BlockableEventLoop; -import net.minecraft.util.thread.ProcessorHandle; -import net.minecraft.util.thread.ProcessorMailbox; +import net.minecraft.util.thread.ConsecutiveExecutor; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.ai.village.poi.PoiManager; @@ -82,9 +84,9 @@ import net.minecraft.world.level.chunk.status.ChunkStatus; import net.minecraft.world.level.chunk.status.ChunkStep; import net.minecraft.world.level.chunk.status.ChunkType; import net.minecraft.world.level.chunk.status.WorldGenContext; -import net.minecraft.world.level.chunk.storage.ChunkSerializer; import net.minecraft.world.level.chunk.storage.ChunkStorage; import net.minecraft.world.level.chunk.storage.RegionStorageInfo; +import net.minecraft.world.level.chunk.storage.SerializableChunkData; import net.minecraft.world.level.entity.ChunkStatusUpdateListener; import net.minecraft.world.level.levelgen.NoiseBasedChunkGenerator; import net.minecraft.world.level.levelgen.NoiseGeneratorSettings; @@ -110,6 +112,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider private static final int CHUNK_SAVED_PER_TICK = 200; private static final int CHUNK_SAVED_EAGERLY_PER_TICK = 20; private static final int EAGER_CHUNK_SAVE_COOLDOWN_IN_MILLIS = 10000; + private static final int MAX_ACTIVE_CHUNK_WRITES = 128; public static final int MIN_VIEW_DISTANCE = 2; public static final int MAX_VIEW_DISTANCE = 32; public static final int FORCED_TICKET_LEVEL = ChunkLevel.byStatus(FullChunkStatus.ENTITY_TICKING); @@ -138,9 +141,8 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider * True if changes have been made to {@link #loadedChunks} and thus a new copy of the collection has to be made into {@link #immutableLoadedChunks}. */ private boolean modified; - private final ChunkTaskPriorityQueueSorter queueSorter; - private final ProcessorHandle> worldgenMailbox; - private final ProcessorHandle> mainThreadMailbox; + private final ChunkTaskDispatcher worldgenTaskDispatcher; + private final ChunkTaskDispatcher lightTaskDispatcher; private final ChunkProgressListener progressListener; private final ChunkStatusUpdateListener chunkStatusListener; private final ChunkMap.DistanceManager distanceManager; @@ -149,8 +151,10 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider private final PlayerMap playerMap = new PlayerMap(); private final Int2ObjectMap entityMap = new Int2ObjectOpenHashMap<>(); private final Long2ByteMap chunkTypeCache = new Long2ByteOpenHashMap(); - private final Long2LongMap chunkSaveCooldowns = new Long2LongOpenHashMap(); + private final Long2LongMap nextChunkSaveTime = new Long2LongOpenHashMap(); + private final LongSet chunksToEagerlySave = new LongLinkedOpenHashSet(); private final Queue unloadQueue = Queues.newConcurrentLinkedQueue(); + private final AtomicInteger activeChunkWrites = new AtomicInteger(); private int serverViewDistance; private final WorldGenContext worldGenContext; @@ -188,17 +192,13 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider this.chunkGeneratorState = generator.createState(registryAccess.lookupOrThrow(Registries.STRUCTURE_SET), this.randomState, l); this.mainThreadExecutor = mainThreadExecutor; - ProcessorMailbox processorMailbox = ProcessorMailbox.create(dispatcher, "worldgen"); - ProcessorHandle processorHandle = ProcessorHandle.of("main", mainThreadExecutor::tell); + ConsecutiveExecutor consecutiveExecutor = new ConsecutiveExecutor(dispatcher, "worldgen"); this.progressListener = progressListener; this.chunkStatusListener = chunkStatusListener; - ProcessorMailbox processorMailbox2 = ProcessorMailbox.create(dispatcher, "light"); - this.queueSorter = new ChunkTaskPriorityQueueSorter(ImmutableList.of(processorMailbox, processorHandle, processorMailbox2), dispatcher, Integer.MAX_VALUE); - this.worldgenMailbox = this.queueSorter.getProcessor(processorMailbox, false); - this.mainThreadMailbox = this.queueSorter.getProcessor(processorHandle, false); - this.lightEngine = new ThreadedLevelLightEngine( - lightChunk, this, this.level.dimensionType().hasSkyLight(), processorMailbox2, this.queueSorter.getProcessor(processorMailbox2, false) - ); + ConsecutiveExecutor consecutiveExecutor2 = new ConsecutiveExecutor(dispatcher, "light"); + this.worldgenTaskDispatcher = new ChunkTaskDispatcher(consecutiveExecutor, dispatcher); + this.lightTaskDispatcher = new ChunkTaskDispatcher(consecutiveExecutor2, dispatcher); + this.lightEngine = new ThreadedLevelLightEngine(lightChunk, this, this.level.dimensionType().hasSkyLight(), consecutiveExecutor2, this.lightTaskDispatcher); this.distanceManager = new ChunkMap.DistanceManager(dispatcher, mainThreadExecutor); this.overworldDataStorage = overworldDataStorage; this.poiManager = new PoiManager( @@ -211,7 +211,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider level ); this.setServerViewDistance(viewDistance); - this.worldGenContext = new WorldGenContext(level, generator, structureManager, this.lightEngine, this.mainThreadMailbox); + this.worldGenContext = new WorldGenContext(level, generator, structureManager, this.lightEngine, mainThreadExecutor, this::setChunkUnsaved); + } + + private void setChunkUnsaved(ChunkPos chunkPos) { + this.chunksToEagerlySave.add(chunkPos.toLong()); } protected ChunkGenerator generator() { @@ -313,25 +317,26 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider ChunkStatus chunkStatus = (ChunkStatus)statusGetter.apply(0); return chunkHolder.scheduleChunkGenerationTask(chunkStatus, this).thenApply(chunkResult -> chunkResult.map(List::of)); } else { - List>> list = new ArrayList(); + int i = Mth.square(range * 2 + 1); + List>> list = new ArrayList(i); ChunkPos chunkPos = chunkHolder.getPos(); - for (int i = -range; i <= range; i++) { - for (int j = -range; j <= range; j++) { - int k = Math.max(Math.abs(j), Math.abs(i)); - long l = ChunkPos.asLong(chunkPos.x + j, chunkPos.z + i); - ChunkHolder chunkHolder2 = this.getUpdatingChunkIfPresent(l); + for (int j = -range; j <= range; j++) { + for (int k = -range; k <= range; k++) { + int l = Math.max(Math.abs(k), Math.abs(j)); + long m = ChunkPos.asLong(chunkPos.x + k, chunkPos.z + j); + ChunkHolder chunkHolder2 = this.getUpdatingChunkIfPresent(m); if (chunkHolder2 == null) { return UNLOADED_CHUNK_LIST_FUTURE; } - ChunkStatus chunkStatus2 = (ChunkStatus)statusGetter.apply(k); + ChunkStatus chunkStatus2 = (ChunkStatus)statusGetter.apply(l); list.add(chunkHolder2.scheduleChunkGenerationTask(chunkStatus2, this)); } } return Util.sequence(list).thenApply(listx -> { - List list2 = Lists.newArrayList(); + List list2 = new ArrayList(listx.size()); for (ChunkResult chunkResult : listx) { if (chunkResult == null) { @@ -380,8 +385,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider } public CompletableFuture> prepareEntityTickingChunk(ChunkHolder chunk) { - return this.getChunkRangeFuture(chunk, 2, i -> ChunkStatus.FULL) - .thenApplyAsync(chunkResult -> chunkResult.map(list -> (LevelChunk)list.get(list.size() / 2)), this.mainThreadExecutor); + return this.getChunkRangeFuture(chunk, 2, i -> ChunkStatus.FULL).thenApply(chunkResult -> chunkResult.map(list -> (LevelChunk)list.get(list.size() / 2))); } /** @@ -411,7 +415,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider if (holder != null) { holder.setTicketLevel(newLevel); } else { - holder = new ChunkHolder(new ChunkPos(chunkPos), newLevel, this.level, this.lightEngine, this.queueSorter, this); + holder = new ChunkHolder(new ChunkPos(chunkPos), newLevel, this.level, this.lightEngine, this::onLevelChange, this); } this.updatingChunkMap.put(chunkPos, holder); @@ -422,10 +426,16 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider } } + private void onLevelChange(ChunkPos chunkPos, IntSupplier intSupplier, int i, IntConsumer intConsumer) { + this.worldgenTaskDispatcher.onLevelChange(chunkPos, intSupplier, i, intConsumer); + this.lightTaskDispatcher.onLevelChange(chunkPos, intSupplier, i, intConsumer); + } + @Override public void close() throws IOException { try { - this.queueSorter.close(); + this.worldgenTaskDispatcher.close(); + this.lightTaskDispatcher.close(); this.poiManager.close(); } finally { super.close(); @@ -445,24 +455,30 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider do { mutableBoolean.setFalse(); list.stream() - .map(chunkHolder -> { - this.mainThreadExecutor.managedBlock(chunkHolder::isReadyForSaving); - return chunkHolder.getLatestChunk(); + .map(chunkHolderx -> { + this.mainThreadExecutor.managedBlock(chunkHolderx::isReadyForSaving); + return chunkHolderx.getLatestChunk(); }) .filter(chunkAccess -> chunkAccess instanceof ImposterProtoChunk || chunkAccess instanceof LevelChunk) .filter(this::save) .forEach(chunkAccess -> mutableBoolean.setTrue()); } while (mutableBoolean.isTrue()); + this.poiManager.flushAll(); this.processUnloads(() -> true); this.flushWorker(); } else { - this.visibleChunkMap.values().forEach(this::saveChunkIfNeeded); + this.nextChunkSaveTime.clear(); + long l = Util.getMillis(); + + for (ChunkHolder chunkHolder : this.visibleChunkMap.values()) { + this.saveChunkIfNeeded(chunkHolder, l); + } } } protected void tick(BooleanSupplier hasMoreTime) { - ProfilerFiller profilerFiller = this.level.getProfiler(); + ProfilerFiller profilerFiller = Profiler.get(); profilerFiller.push("poi"); this.poiManager.tick(hasMoreTime); profilerFiller.popPush("chunk_unload"); @@ -480,53 +496,57 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider || this.poiManager.hasWork() || !this.toDrop.isEmpty() || !this.unloadQueue.isEmpty() - || this.queueSorter.hasWork() + || this.worldgenTaskDispatcher.hasWork() + || this.lightTaskDispatcher.hasWork() || this.distanceManager.hasTickets(); } private void processUnloads(BooleanSupplier hasMoreTime) { - LongIterator longIterator = this.toDrop.iterator(); - int i = 0; - - while (longIterator.hasNext() && (hasMoreTime.getAsBoolean() || i < 200 || this.toDrop.size() > 2000)) { + for (LongIterator longIterator = this.toDrop.iterator(); longIterator.hasNext(); longIterator.remove()) { long l = longIterator.nextLong(); ChunkHolder chunkHolder = this.updatingChunkMap.get(l); if (chunkHolder != null) { - if (chunkHolder.getGenerationRefCount() != 0) { - continue; - } - this.updatingChunkMap.remove(l); this.pendingUnloads.put(l, chunkHolder); this.modified = true; - i++; this.scheduleUnload(l, chunkHolder); } - - longIterator.remove(); } - int j = Math.max(0, this.unloadQueue.size() - 2000); + int i = Math.max(0, this.unloadQueue.size() - 2000); Runnable runnable; - while ((hasMoreTime.getAsBoolean() || j > 0) && (runnable = (Runnable)this.unloadQueue.poll()) != null) { - j--; + while ((i > 0 || hasMoreTime.getAsBoolean()) && (runnable = (Runnable)this.unloadQueue.poll()) != null) { + i--; runnable.run(); } - int k = 0; - ObjectIterator objectIterator = this.visibleChunkMap.values().iterator(); + this.saveChunksEagerly(hasMoreTime); + } - while (k < 20 && hasMoreTime.getAsBoolean() && objectIterator.hasNext()) { - if (this.saveChunkIfNeeded((ChunkHolder)objectIterator.next())) { - k++; + private void saveChunksEagerly(BooleanSupplier booleanSupplier) { + long l = Util.getMillis(); + int i = 0; + LongIterator longIterator = this.chunksToEagerlySave.iterator(); + + while (i < 20 && this.activeChunkWrites.get() < 128 && booleanSupplier.getAsBoolean() && longIterator.hasNext()) { + long m = longIterator.nextLong(); + ChunkHolder chunkHolder = this.visibleChunkMap.get(m); + ChunkAccess chunkAccess = chunkHolder != null ? chunkHolder.getLatestChunk() : null; + if (chunkAccess == null || !chunkAccess.isUnsaved()) { + longIterator.remove(); + } else if (this.saveChunkIfNeeded(chunkHolder, l)) { + i++; + longIterator.remove(); } } } private void scheduleUnload(long chunkPos, ChunkHolder chunkHolder) { - chunkHolder.getSaveSyncFuture().thenRunAsync(() -> { - if (!chunkHolder.isReadyForSaving()) { + CompletableFuture completableFuture = chunkHolder.getSaveSyncFuture(); + completableFuture.thenRunAsync(() -> { + CompletableFuture completableFuture2 = chunkHolder.getSaveSyncFuture(); + if (completableFuture2 != completableFuture) { this.scheduleUnload(chunkPos, chunkHolder); } else { ChunkAccess chunkAccess = chunkHolder.getLatestChunk(); @@ -543,7 +563,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider this.lightEngine.updateChunkStatus(chunkAccess.getPos()); this.lightEngine.tryScheduleUpdate(); this.progressListener.onStatusChange(chunkAccess.getPos(), null); - this.chunkSaveCooldowns.remove(chunkAccess.getPos().toLong()); + this.nextChunkSaveTime.remove(chunkAccess.getPos().toLong()); } } }, this.unloadQueue::add).whenComplete((void_, throwable) -> { @@ -564,17 +584,19 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider } private CompletableFuture scheduleChunkLoad(ChunkPos chunkPos) { - return this.readChunk(chunkPos).thenApply(optional -> optional.filter(compoundTag -> { - boolean bl = isChunkDataValid(compoundTag); - if (!bl) { + CompletableFuture> completableFuture = this.readChunk(chunkPos).thenApplyAsync(optional -> optional.map(compoundTag -> { + SerializableChunkData serializableChunkData = SerializableChunkData.parse(this.level, this.level.registryAccess(), compoundTag); + if (serializableChunkData == null) { LOGGER.error("Chunk file at {} is missing level data, skipping", chunkPos); } - return bl; - })).thenApplyAsync(optional -> { - this.level.getProfiler().incrementCounter("chunkLoad"); + return serializableChunkData; + }), Util.backgroundExecutor().forName("parseChunk")); + CompletableFuture completableFuture2 = this.poiManager.prefetch(chunkPos); + return completableFuture.thenCombine(completableFuture2, (optional, object) -> optional).thenApplyAsync(optional -> { + Profiler.get().incrementCounter("chunkLoad"); if (optional.isPresent()) { - ChunkAccess chunkAccess = ChunkSerializer.read(this.level, this.poiManager, this.storageInfo(), chunkPos, (CompoundTag)optional.get()); + ChunkAccess chunkAccess = ((SerializableChunkData)optional.get()).read(this.level, this.poiManager, this.storageInfo(), chunkPos); this.markPosition(chunkPos, chunkAccess.getPersistedStatus().getChunkType()); return chunkAccess; } else { @@ -583,10 +605,6 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider }, this.mainThreadExecutor).exceptionallyAsync(throwable -> this.handleChunkLoadFailure(throwable, chunkPos), this.mainThreadExecutor); } - private static boolean isChunkDataValid(CompoundTag tag) { - return tag.contains("Status", 8); - } - private ChunkAccess handleChunkLoadFailure(Throwable exception, ChunkPos chunkPos) { Throwable throwable = exception instanceof CompletionException completionException ? completionException.getCause() : exception; Throwable throwable2 = throwable instanceof ReportedException reportedException ? reportedException.getCause() : throwable; @@ -609,7 +627,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider private ChunkAccess createEmptyChunk(ChunkPos chunkPos) { this.markPositionReplaceable(chunkPos); - return new ProtoChunk(chunkPos, UpgradeData.EMPTY, this.level, this.level.registryAccess().registryOrThrow(Registries.BIOME), null); + return new ProtoChunk(chunkPos, UpgradeData.EMPTY, this.level, this.level.registryAccess().lookupOrThrow(Registries.BIOME), null); } private void markPositionReplaceable(ChunkPos chunkPos) { @@ -672,12 +690,13 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider } private void runGenerationTask(ChunkGenerationTask task) { - this.worldgenMailbox.tell(ChunkTaskPriorityQueueSorter.message(task.getCenter(), (Runnable)(() -> { + GenerationChunkHolder generationChunkHolder = task.getCenter(); + this.worldgenTaskDispatcher.submit(() -> { CompletableFuture completableFuture = task.runUntilWait(); if (completableFuture != null) { completableFuture.thenRun(() -> this.runGenerationTask(task)); } - }))); + }, generationChunkHolder.getPos().toLong(), generationChunkHolder::getQueueLevel); } @Override @@ -688,20 +707,19 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider public CompletableFuture> prepareTickingChunk(ChunkHolder holder) { CompletableFuture>> completableFuture = this.getChunkRangeFuture(holder, 1, i -> ChunkStatus.FULL); - CompletableFuture> completableFuture2 = completableFuture.thenApplyAsync( - chunkResult -> chunkResult.map(list -> (LevelChunk)list.get(list.size() / 2)), - runnable -> this.mainThreadMailbox.tell(ChunkTaskPriorityQueueSorter.message(holder, runnable)) - ) - .thenApplyAsync(chunkResult -> chunkResult.ifSuccess(levelChunk -> { - levelChunk.postProcessGeneration(); - this.level.startTickingChunk(levelChunk); - CompletableFuture completableFuturex = holder.getSendSyncFuture(); - if (completableFuturex.isDone()) { - this.onChunkReadyToSend(levelChunk); - } else { - completableFuturex.thenAcceptAsync(object -> this.onChunkReadyToSend(levelChunk), this.mainThreadExecutor); - } - }), this.mainThreadExecutor); + CompletableFuture> completableFuture2 = completableFuture.thenApplyAsync(chunkResult -> chunkResult.map(list -> { + LevelChunk levelChunk = (LevelChunk)list.get(list.size() / 2); + levelChunk.postProcessGeneration(this.level); + this.level.startTickingChunk(levelChunk); + CompletableFuture completableFuturex = holder.getSendSyncFuture(); + if (completableFuturex.isDone()) { + this.onChunkReadyToSend(holder, levelChunk); + } else { + completableFuturex.thenAcceptAsync(object -> this.onChunkReadyToSend(holder, levelChunk), this.mainThreadExecutor); + } + + return levelChunk; + }), this.mainThreadExecutor); completableFuture2.handle((chunkResult, throwable) -> { this.tickingGenerated.getAndIncrement(); return null; @@ -709,44 +727,44 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider return completableFuture2; } - private void onChunkReadyToSend(LevelChunk chunk) { - ChunkPos chunkPos = chunk.getPos(); + private void onChunkReadyToSend(ChunkHolder chunkHolder, LevelChunk levelChunk) { + ChunkPos chunkPos = levelChunk.getPos(); for (ServerPlayer serverPlayer : this.playerMap.getAllPlayers()) { if (serverPlayer.getChunkTrackingView().contains(chunkPos)) { - markChunkPendingToSend(serverPlayer, chunk); + markChunkPendingToSend(serverPlayer, levelChunk); } } + + this.level.getChunkSource().onChunkReadyToSend(chunkHolder); } public CompletableFuture> prepareAccessibleChunk(ChunkHolder holder) { return this.getChunkRangeFuture(holder, 1, ChunkLevel::getStatusAroundFullChunk) - .thenApplyAsync( - chunkResult -> chunkResult.map(list -> (LevelChunk)list.get(list.size() / 2)), - runnable -> this.mainThreadMailbox.tell(ChunkTaskPriorityQueueSorter.message(holder, runnable)) - ); + .thenApply(chunkResult -> chunkResult.map(list -> (LevelChunk)list.get(list.size() / 2))); } public int getTickingGenerated() { return this.tickingGenerated.get(); } - private boolean saveChunkIfNeeded(ChunkHolder holder) { - if (holder.wasAccessibleSinceLastSave() && holder.isReadyForSaving()) { - ChunkAccess chunkAccess = holder.getLatestChunk(); + private boolean saveChunkIfNeeded(ChunkHolder chunkHolder, long l) { + if (chunkHolder.wasAccessibleSinceLastSave() && chunkHolder.isReadyForSaving()) { + ChunkAccess chunkAccess = chunkHolder.getLatestChunk(); if (!(chunkAccess instanceof ImposterProtoChunk) && !(chunkAccess instanceof LevelChunk)) { return false; + } else if (!chunkAccess.isUnsaved()) { + return false; } else { - long l = chunkAccess.getPos().toLong(); - long m = this.chunkSaveCooldowns.getOrDefault(l, -1L); - long n = System.currentTimeMillis(); - if (n < m) { + long m = chunkAccess.getPos().toLong(); + long n = this.nextChunkSaveTime.getOrDefault(m, -1L); + if (l < n) { return false; } else { boolean bl = this.save(chunkAccess); - holder.refreshAccessibility(); + chunkHolder.refreshAccessibility(); if (bl) { - this.chunkSaveCooldowns.put(l, n + 10000L); + this.nextChunkSaveTime.put(m, l + 10000L); } return bl; @@ -759,10 +777,9 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider private boolean save(ChunkAccess chunk) { this.poiManager.flush(chunk.getPos()); - if (!chunk.isUnsaved()) { + if (!chunk.tryMarkSaved()) { return false; } else { - chunk.setUnsaved(false); ChunkPos chunkPos = chunk.getPos(); try { @@ -777,16 +794,22 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider } } - this.level.getProfiler().incrementCounter("chunkSave"); - CompoundTag compoundTag = ChunkSerializer.write(this.level, chunk); - this.write(chunkPos, compoundTag).exceptionally(throwable -> { - this.level.getServer().reportChunkSaveFailure(throwable, this.storageInfo(), chunkPos); + Profiler.get().incrementCounter("chunkSave"); + this.activeChunkWrites.incrementAndGet(); + SerializableChunkData serializableChunkData = SerializableChunkData.copyOf(this.level, chunk); + CompletableFuture completableFuture = CompletableFuture.supplyAsync(serializableChunkData::write, Util.backgroundExecutor()); + this.write(chunkPos, completableFuture::join).handle((void_, throwable) -> { + if (throwable != null) { + this.level.getServer().reportChunkSaveFailure(throwable, this.storageInfo(), chunkPos); + } + + this.activeChunkWrites.decrementAndGet(); return null; }); this.markPosition(chunkPos, chunkStatus.getChunkType()); return true; - } catch (Exception var5) { - this.level.getServer().reportChunkSaveFailure(var5, this.storageInfo(), chunkPos); + } catch (Exception var6) { + this.level.getServer().reportChunkSaveFailure(var6, this.storageInfo(), chunkPos); return false; } } @@ -810,7 +833,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider return false; } - ChunkType chunkType = ChunkSerializer.getChunkTypeFromTag(compoundTag); + ChunkType chunkType = SerializableChunkData.getChunkTypeFromTag(compoundTag); return this.markPosition(chunkPos, chunkType) == 1; } } @@ -931,27 +954,39 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider } private CompletableFuture> readChunk(ChunkPos pos) { - return this.read(pos).thenApplyAsync(optional -> optional.map(this::upgradeChunkTag), Util.backgroundExecutor()); + return this.read(pos).thenApplyAsync(optional -> optional.map(this::upgradeChunkTag), Util.backgroundExecutor().forName("upgradeChunk")); } private CompoundTag upgradeChunkTag(CompoundTag tag) { return this.upgradeChunkTag(this.level.dimension(), this.overworldDataStorage, tag, this.generator().getTypeNameForDataFixer()); } - boolean anyPlayerCloseEnoughForSpawning(ChunkPos chunkPos) { - if (!this.distanceManager.hasPlayersNearby(chunkPos.toLong())) { - return false; - } else { - for (ServerPlayer serverPlayer : this.playerMap.getAllPlayers()) { - if (this.playerIsCloseEnoughForSpawning(serverPlayer, chunkPos)) { - return true; - } - } + void forEachSpawnCandidateChunk(Consumer consumer) { + LongIterator longIterator = this.distanceManager.getSpawnCandidateChunks(); - return false; + while (longIterator.hasNext()) { + long l = longIterator.nextLong(); + ChunkHolder chunkHolder = this.visibleChunkMap.get(l); + if (chunkHolder != null && this.anyPlayerCloseEnoughForSpawningInternal(chunkHolder.getPos())) { + consumer.accept(chunkHolder); + } } } + boolean anyPlayerCloseEnoughForSpawning(ChunkPos chunkPos) { + return !this.distanceManager.hasPlayersNearby(chunkPos.toLong()) ? false : this.anyPlayerCloseEnoughForSpawningInternal(chunkPos); + } + + private boolean anyPlayerCloseEnoughForSpawningInternal(ChunkPos chunkPos) { + for (ServerPlayer serverPlayer : this.playerMap.getAllPlayers()) { + if (this.playerIsCloseEnoughForSpawning(serverPlayer, chunkPos)) { + return true; + } + } + + return false; + } + public List getPlayersCloseForSpawning(ChunkPos chunkPos) { long l = chunkPos.toLong(); if (!this.distanceManager.hasPlayersNearby(l)) { @@ -1049,9 +1084,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider private void updateChunkTracking(ServerPlayer player) { ChunkPos chunkPos = player.chunkPosition(); int i = this.getPlayerViewDistance(player); - if (!( - player.getChunkTrackingView() instanceof ChunkTrackingView.Positioned positioned && positioned.center().equals(chunkPos) && positioned.viewDistance() == i - )) { + if (!(player.getChunkTrackingView() instanceof Positioned positioned && positioned.center().equals(chunkPos) && positioned.viewDistance() == i)) { this.applyChunkTrackingView(player, ChunkTrackingView.of(chunkPos, i)); } } @@ -1059,8 +1092,8 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider private void applyChunkTrackingView(ServerPlayer player, ChunkTrackingView chunkTrackingView) { if (player.level() == this.level) { ChunkTrackingView chunkTrackingView2 = player.getChunkTrackingView(); - if (chunkTrackingView instanceof ChunkTrackingView.Positioned positioned - && !(chunkTrackingView2 instanceof ChunkTrackingView.Positioned positioned2 && positioned2.center().equals(positioned.center()))) { + if (chunkTrackingView instanceof Positioned positioned + && !(chunkTrackingView2 instanceof Positioned positioned2 && positioned2.center().equals(positioned.center()))) { player.connection.send(new ClientboundSetChunkCacheCenterPacket(positioned.center().x, positioned.center().z)); } diff --git a/net/minecraft/server/level/ChunkTaskDispatcher.java b/net/minecraft/server/level/ChunkTaskDispatcher.java new file mode 100644 index 00000000..d85a6140 --- /dev/null +++ b/net/minecraft/server/level/ChunkTaskDispatcher.java @@ -0,0 +1,97 @@ +package net.minecraft.server.level; + +import com.mojang.logging.LogUtils; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.Executor; +import java.util.function.IntConsumer; +import java.util.function.IntSupplier; +import net.minecraft.util.Unit; +import net.minecraft.util.thread.PriorityConsecutiveExecutor; +import net.minecraft.util.thread.StrictQueue; +import net.minecraft.util.thread.TaskScheduler; +import net.minecraft.world.level.ChunkPos; +import org.jetbrains.annotations.Nullable; +import org.slf4j.Logger; + +public class ChunkTaskDispatcher implements ChunkHolder.LevelChangeListener, AutoCloseable { + public static final int DISPATCHER_PRIORITY_COUNT = 4; + private static final Logger LOGGER = LogUtils.getLogger(); + private final ChunkTaskPriorityQueue queue; + private final TaskScheduler executor; + private final PriorityConsecutiveExecutor dispatcher; + protected boolean sleeping; + + public ChunkTaskDispatcher(TaskScheduler taskScheduler, Executor executor) { + this.queue = new ChunkTaskPriorityQueue(taskScheduler.name() + "_queue"); + this.executor = taskScheduler; + this.dispatcher = new PriorityConsecutiveExecutor(4, executor, "dispatcher"); + this.sleeping = true; + } + + public boolean hasWork() { + return this.dispatcher.hasWork() || this.queue.hasWork(); + } + + @Override + public void onLevelChange(ChunkPos chunkPos, IntSupplier intSupplier, int i, IntConsumer intConsumer) { + this.dispatcher.schedule(new StrictQueue.RunnableWithPriority(0, () -> { + int j = intSupplier.getAsInt(); + this.queue.resortChunkTasks(j, chunkPos, i); + intConsumer.accept(i); + })); + } + + public void release(long l, Runnable runnable, boolean bl) { + this.dispatcher.schedule(new StrictQueue.RunnableWithPriority(1, () -> { + this.queue.release(l, bl); + this.onRelease(l); + if (this.sleeping) { + this.sleeping = false; + this.pollTask(); + } + + runnable.run(); + })); + } + + public void submit(Runnable runnable, long l, IntSupplier intSupplier) { + this.dispatcher.schedule(new StrictQueue.RunnableWithPriority(2, () -> { + int i = intSupplier.getAsInt(); + this.queue.submit(runnable, l, i); + if (this.sleeping) { + this.sleeping = false; + this.pollTask(); + } + })); + } + + protected void pollTask() { + this.dispatcher.schedule(new StrictQueue.RunnableWithPriority(3, () -> { + ChunkTaskPriorityQueue.TasksForChunk tasksForChunk = this.popTasks(); + if (tasksForChunk == null) { + this.sleeping = true; + } else { + this.scheduleForExecution(tasksForChunk); + } + })); + } + + protected void scheduleForExecution(ChunkTaskPriorityQueue.TasksForChunk tasksForChunk) { + CompletableFuture.allOf((CompletableFuture[])tasksForChunk.tasks().stream().map(runnable -> this.executor.scheduleWithResult(completableFuture -> { + runnable.run(); + completableFuture.complete(Unit.INSTANCE); + })).toArray(CompletableFuture[]::new)).thenAccept(void_ -> this.pollTask()); + } + + protected void onRelease(long l) { + } + + @Nullable + protected ChunkTaskPriorityQueue.TasksForChunk popTasks() { + return this.queue.pop(); + } + + public void close() { + this.executor.close(); + } +} diff --git a/net/minecraft/server/level/ChunkTaskPriorityQueue.java b/net/minecraft/server/level/ChunkTaskPriorityQueue.java index a325a736..e2a9ccca 100644 --- a/net/minecraft/server/level/ChunkTaskPriorityQueue.java +++ b/net/minecraft/server/level/ChunkTaskPriorityQueue.java @@ -1,72 +1,58 @@ package net.minecraft.server.level; -import com.google.common.annotations.VisibleForTesting; import com.google.common.collect.Lists; -import com.mojang.datafixers.util.Either; import it.unimi.dsi.fastutil.longs.Long2ObjectFunction; import it.unimi.dsi.fastutil.longs.Long2ObjectLinkedOpenHashMap; -import it.unimi.dsi.fastutil.longs.LongOpenHashSet; -import it.unimi.dsi.fastutil.longs.LongSet; import java.util.List; -import java.util.Optional; -import java.util.stream.Collectors; import java.util.stream.IntStream; -import java.util.stream.Stream; import net.minecraft.world.level.ChunkPos; import org.jetbrains.annotations.Nullable; -public class ChunkTaskPriorityQueue { +public class ChunkTaskPriorityQueue { public static final int PRIORITY_LEVEL_COUNT = ChunkLevel.MAX_LEVEL + 2; - private final List>>> taskQueue = (List>>>)IntStream.range( - 0, PRIORITY_LEVEL_COUNT - ) + private final List>> queuesPerPriority = IntStream.range(0, PRIORITY_LEVEL_COUNT) .mapToObj(i -> new Long2ObjectLinkedOpenHashMap()) - .collect(Collectors.toList()); - private volatile int firstQueue = PRIORITY_LEVEL_COUNT; + .toList(); + private volatile int topPriorityQueueIndex = PRIORITY_LEVEL_COUNT; private final String name; - private final LongSet acquired = new LongOpenHashSet(); - private final int maxTasks; - public ChunkTaskPriorityQueue(String name, int maxTasks) { - this.name = name; - this.maxTasks = maxTasks; + public ChunkTaskPriorityQueue(String string) { + this.name = string; } protected void resortChunkTasks(int queueLevel, ChunkPos chunkPos, int ticketLevel) { if (queueLevel < PRIORITY_LEVEL_COUNT) { - Long2ObjectLinkedOpenHashMap>> long2ObjectLinkedOpenHashMap = (Long2ObjectLinkedOpenHashMap>>)this.taskQueue + Long2ObjectLinkedOpenHashMap> long2ObjectLinkedOpenHashMap = (Long2ObjectLinkedOpenHashMap>)this.queuesPerPriority .get(queueLevel); - List> list = long2ObjectLinkedOpenHashMap.remove(chunkPos.toLong()); - if (queueLevel == this.firstQueue) { - while (this.hasWork() && ((Long2ObjectLinkedOpenHashMap)this.taskQueue.get(this.firstQueue)).isEmpty()) { - this.firstQueue++; + List list = long2ObjectLinkedOpenHashMap.remove(chunkPos.toLong()); + if (queueLevel == this.topPriorityQueueIndex) { + while (this.hasWork() && ((Long2ObjectLinkedOpenHashMap)this.queuesPerPriority.get(this.topPriorityQueueIndex)).isEmpty()) { + this.topPriorityQueueIndex++; } } if (list != null && !list.isEmpty()) { - ((Long2ObjectLinkedOpenHashMap)this.taskQueue.get(ticketLevel)) + ((Long2ObjectLinkedOpenHashMap)this.queuesPerPriority.get(ticketLevel)) .computeIfAbsent(chunkPos.toLong(), (Long2ObjectFunction)(l -> Lists.newArrayList())) .addAll(list); - this.firstQueue = Math.min(this.firstQueue, ticketLevel); + this.topPriorityQueueIndex = Math.min(this.topPriorityQueueIndex, ticketLevel); } } } - protected void submit(Optional task, long chunkPos, int chunkLevel) { - ((Long2ObjectLinkedOpenHashMap)this.taskQueue.get(chunkLevel)) - .computeIfAbsent(chunkPos, (Long2ObjectFunction)(l -> Lists.newArrayList())) - .add(task); - this.firstQueue = Math.min(this.firstQueue, chunkLevel); + protected void submit(Runnable runnable, long l, int i) { + ((Long2ObjectLinkedOpenHashMap)this.queuesPerPriority.get(i)) + .computeIfAbsent(l, (Long2ObjectFunction)(lx -> Lists.newArrayList())) + .add(runnable); + this.topPriorityQueueIndex = Math.min(this.topPriorityQueueIndex, i); } protected void release(long chunkPos, boolean fullClear) { - for (Long2ObjectLinkedOpenHashMap>> long2ObjectLinkedOpenHashMap : this.taskQueue) { - List> list = long2ObjectLinkedOpenHashMap.get(chunkPos); + for (Long2ObjectLinkedOpenHashMap> long2ObjectLinkedOpenHashMap : this.queuesPerPriority) { + List list = long2ObjectLinkedOpenHashMap.get(chunkPos); if (list != null) { if (fullClear) { list.clear(); - } else { - list.removeIf(optional -> optional.isEmpty()); } if (list.isEmpty()) { @@ -75,47 +61,37 @@ public class ChunkTaskPriorityQueue { } } - while (this.hasWork() && ((Long2ObjectLinkedOpenHashMap)this.taskQueue.get(this.firstQueue)).isEmpty()) { - this.firstQueue++; + while (this.hasWork() && ((Long2ObjectLinkedOpenHashMap)this.queuesPerPriority.get(this.topPriorityQueueIndex)).isEmpty()) { + this.topPriorityQueueIndex++; } - - this.acquired.remove(chunkPos); - } - - private Runnable acquire(long chunkPos) { - return () -> this.acquired.add(chunkPos); } @Nullable - public Stream> pop() { - if (this.acquired.size() >= this.maxTasks) { - return null; - } else if (!this.hasWork()) { + public ChunkTaskPriorityQueue.TasksForChunk pop() { + if (!this.hasWork()) { return null; } else { - int i = this.firstQueue; - Long2ObjectLinkedOpenHashMap>> long2ObjectLinkedOpenHashMap = (Long2ObjectLinkedOpenHashMap>>)this.taskQueue.get(i); + int i = this.topPriorityQueueIndex; + Long2ObjectLinkedOpenHashMap> long2ObjectLinkedOpenHashMap = (Long2ObjectLinkedOpenHashMap>)this.queuesPerPriority.get(i); long l = long2ObjectLinkedOpenHashMap.firstLongKey(); - List> list = long2ObjectLinkedOpenHashMap.removeFirst(); + List list = long2ObjectLinkedOpenHashMap.removeFirst(); - while (this.hasWork() && ((Long2ObjectLinkedOpenHashMap)this.taskQueue.get(this.firstQueue)).isEmpty()) { - this.firstQueue++; + while (this.hasWork() && ((Long2ObjectLinkedOpenHashMap)this.queuesPerPriority.get(this.topPriorityQueueIndex)).isEmpty()) { + this.topPriorityQueueIndex++; } - return list.stream().map(optional -> (Either)optional.map(Either::left).orElseGet(() -> Either.right(this.acquire(l)))); + return new ChunkTaskPriorityQueue.TasksForChunk(l, list); } } public boolean hasWork() { - return this.firstQueue < PRIORITY_LEVEL_COUNT; + return this.topPriorityQueueIndex < PRIORITY_LEVEL_COUNT; } public String toString() { - return this.name + " " + this.firstQueue + "..."; + return this.name + " " + this.topPriorityQueueIndex + "..."; } - @VisibleForTesting - LongSet getAcquired() { - return new LongOpenHashSet(this.acquired); + public record TasksForChunk(long chunkPos, List tasks) { } } diff --git a/net/minecraft/server/level/ChunkTaskPriorityQueueSorter.java b/net/minecraft/server/level/ChunkTaskPriorityQueueSorter.java deleted file mode 100644 index e2526f59..00000000 --- a/net/minecraft/server/level/ChunkTaskPriorityQueueSorter.java +++ /dev/null @@ -1,204 +0,0 @@ -package net.minecraft.server.level; - -import com.google.common.annotations.VisibleForTesting; -import com.google.common.collect.Sets; -import com.mojang.datafixers.util.Either; -import com.mojang.logging.LogUtils; -import java.util.List; -import java.util.Map; -import java.util.Optional; -import java.util.Set; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.Executor; -import java.util.function.Function; -import java.util.function.IntConsumer; -import java.util.function.IntSupplier; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import net.minecraft.Util; -import net.minecraft.util.Unit; -import net.minecraft.util.thread.ProcessorHandle; -import net.minecraft.util.thread.ProcessorMailbox; -import net.minecraft.util.thread.StrictQueue; -import net.minecraft.world.level.ChunkPos; -import org.slf4j.Logger; - -public class ChunkTaskPriorityQueueSorter implements ChunkHolder.LevelChangeListener, AutoCloseable { - private static final Logger LOGGER = LogUtils.getLogger(); - private final Map, ChunkTaskPriorityQueue, ?>>> queues; - private final Set> sleeping; - private final ProcessorMailbox mailbox; - - public ChunkTaskPriorityQueueSorter(List> queues, Executor task, int maxTasks) { - this.queues = (Map, ChunkTaskPriorityQueue, ?>>>)queues.stream() - .collect(Collectors.toMap(Function.identity(), processorHandle -> new ChunkTaskPriorityQueue(processorHandle.name() + "_queue", maxTasks))); - this.sleeping = Sets.>newHashSet(queues); - this.mailbox = new ProcessorMailbox<>(new StrictQueue.FixedPriorityQueue(4), task, "sorter"); - } - - public boolean hasWork() { - return this.mailbox.hasWork() || this.queues.values().stream().anyMatch(ChunkTaskPriorityQueue::hasWork); - } - - public static ChunkTaskPriorityQueueSorter.Message message(Function, T> task, long pos, IntSupplier level) { - return new ChunkTaskPriorityQueueSorter.Message<>(task, pos, level); - } - - public static ChunkTaskPriorityQueueSorter.Message message(Runnable task, long pos, IntSupplier level) { - return new ChunkTaskPriorityQueueSorter.Message<>(processorHandle -> () -> { - task.run(); - processorHandle.tell(Unit.INSTANCE); - }, pos, level); - } - - public static ChunkTaskPriorityQueueSorter.Message message(GenerationChunkHolder chunk, Runnable task) { - return message(task, chunk.getPos().toLong(), chunk::getQueueLevel); - } - - public static ChunkTaskPriorityQueueSorter.Message message(GenerationChunkHolder chunk, Function, T> task) { - return message(task, chunk.getPos().toLong(), chunk::getQueueLevel); - } - - public static ChunkTaskPriorityQueueSorter.Release release(Runnable task, long pos, boolean clearQueue) { - return new ChunkTaskPriorityQueueSorter.Release(task, pos, clearQueue); - } - - public ProcessorHandle> getProcessor(ProcessorHandle processor, boolean flush) { - return (ProcessorHandle>)this.mailbox - .ask( - processorHandle2 -> new StrictQueue.IntRunnable( - 0, - () -> { - this.getQueue(processor); - processorHandle2.tell( - ProcessorHandle.of( - "chunk priority sorter around " + processor.name(), message -> this.submit(processor, message.task, message.pos, message.level, flush) - ) - ); - } - ) - ) - .join(); - } - - public ProcessorHandle getReleaseProcessor(ProcessorHandle processor) { - return (ProcessorHandle)this.mailbox - .ask( - processorHandle2 -> new StrictQueue.IntRunnable( - 0, - () -> processorHandle2.tell( - ProcessorHandle.of("chunk priority sorter around " + processor.name(), release -> this.release(processor, release.pos, release.task, release.clearQueue)) - ) - ) - ) - .join(); - } - - @Override - public void onLevelChange(ChunkPos chunkPos, IntSupplier intSupplier, int i, IntConsumer intConsumer) { - this.mailbox.tell(new StrictQueue.IntRunnable(0, () -> { - int j = intSupplier.getAsInt(); - this.queues.values().forEach(chunkTaskPriorityQueue -> chunkTaskPriorityQueue.resortChunkTasks(j, chunkPos, i)); - intConsumer.accept(i); - })); - } - - private void release(ProcessorHandle processor, long chunkPos, Runnable task, boolean clearQueue) { - this.mailbox.tell(new StrictQueue.IntRunnable(1, () -> { - ChunkTaskPriorityQueue, T>> chunkTaskPriorityQueue = this.getQueue(processor); - chunkTaskPriorityQueue.release(chunkPos, clearQueue); - if (this.sleeping.remove(processor)) { - this.pollTask(chunkTaskPriorityQueue, processor); - } - - task.run(); - })); - } - - private void submit(ProcessorHandle processor, Function, T> task, long chunkPos, IntSupplier level, boolean flush) { - this.mailbox.tell(new StrictQueue.IntRunnable(2, () -> { - ChunkTaskPriorityQueue, T>> chunkTaskPriorityQueue = this.getQueue(processor); - int i = level.getAsInt(); - chunkTaskPriorityQueue.submit(Optional.of(task), chunkPos, i); - if (flush) { - chunkTaskPriorityQueue.submit(Optional.empty(), chunkPos, i); - } - - if (this.sleeping.remove(processor)) { - this.pollTask(chunkTaskPriorityQueue, processor); - } - })); - } - - private void pollTask(ChunkTaskPriorityQueue, T>> queue, ProcessorHandle processor) { - this.mailbox.tell(new StrictQueue.IntRunnable(3, () -> { - Stream, T>, Runnable>> stream = queue.pop(); - if (stream == null) { - this.sleeping.add(processor); - } else { - CompletableFuture.allOf((CompletableFuture[])stream.map(either -> either.map(processor::ask, runnable -> { - runnable.run(); - return CompletableFuture.completedFuture(Unit.INSTANCE); - })).toArray(CompletableFuture[]::new)).thenAccept(void_ -> this.pollTask(queue, processor)); - } - })); - } - - private ChunkTaskPriorityQueue, T>> getQueue(ProcessorHandle processor) { - ChunkTaskPriorityQueue, ?>> chunkTaskPriorityQueue = (ChunkTaskPriorityQueue, ?>>)this.queues - .get(processor); - if (chunkTaskPriorityQueue == null) { - throw (IllegalArgumentException)Util.pauseInIde((T)(new IllegalArgumentException("No queue for: " + processor))); - } else { - return (ChunkTaskPriorityQueue, T>>)chunkTaskPriorityQueue; - } - } - - @VisibleForTesting - public String getDebugStatus() { - return (String)this.queues - .entrySet() - .stream() - .map( - entry -> ((ProcessorHandle)entry.getKey()).name() - + "=[" - + (String)((ChunkTaskPriorityQueue)entry.getValue()) - .getAcquired() - .stream() - .map(long_ -> long_ + ":" + new ChunkPos(long_)) - .collect(Collectors.joining(",")) - + "]" - ) - .collect(Collectors.joining(",")) - + ", s=" - + this.sleeping.size(); - } - - public void close() { - this.queues.keySet().forEach(ProcessorHandle::close); - } - - public static final class Message { - final Function, T> task; - final long pos; - final IntSupplier level; - - Message(Function, T> task, long pos, IntSupplier level) { - this.task = task; - this.pos = pos; - this.level = level; - } - } - - public static final class Release { - final Runnable task; - final long pos; - final boolean clearQueue; - - Release(Runnable task, long pos, boolean clearQueue) { - this.task = task; - this.pos = pos; - this.clearQueue = clearQueue; - } - } -} diff --git a/net/minecraft/server/level/ClientInformation.java b/net/minecraft/server/level/ClientInformation.java index 445276b4..24b297b5 100644 --- a/net/minecraft/server/level/ClientInformation.java +++ b/net/minecraft/server/level/ClientInformation.java @@ -13,7 +13,8 @@ public record ClientInformation( int modelCustomisation, HumanoidArm mainHand, boolean textFilteringEnabled, - boolean allowsListing + boolean allowsListing, + ParticleStatus particleStatus ) { public static final int MAX_LANGUAGE_LENGTH = 16; @@ -26,7 +27,8 @@ public record ClientInformation( buffer.readUnsignedByte(), buffer.readEnum(HumanoidArm.class), buffer.readBoolean(), - buffer.readBoolean() + buffer.readBoolean(), + buffer.readEnum(ParticleStatus.class) ); } @@ -39,9 +41,10 @@ public record ClientInformation( buffer.writeEnum(this.mainHand); buffer.writeBoolean(this.textFilteringEnabled); buffer.writeBoolean(this.allowsListing); + buffer.writeEnum(this.particleStatus); } public static ClientInformation createDefault() { - return new ClientInformation("en_us", 2, ChatVisiblity.FULL, true, 0, Player.DEFAULT_MAIN_HAND, false, false); + return new ClientInformation("en_us", 2, ChatVisiblity.FULL, true, 0, Player.DEFAULT_MAIN_HAND, false, false, ParticleStatus.ALL); } } diff --git a/net/minecraft/server/level/DemoMode.java b/net/minecraft/server/level/DemoMode.java index 1338b339..7a2255c5 100644 --- a/net/minecraft/server/level/DemoMode.java +++ b/net/minecraft/server/level/DemoMode.java @@ -4,7 +4,7 @@ import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.network.chat.Component; import net.minecraft.network.protocol.game.ClientboundGameEventPacket; -import net.minecraft.network.protocol.game.ServerboundPlayerActionPacket; +import net.minecraft.network.protocol.game.ServerboundPlayerActionPacket.Action; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.item.ItemStack; @@ -71,7 +71,7 @@ public class DemoMode extends ServerPlayerGameMode { } @Override - public void handleBlockBreakAction(BlockPos pos, ServerboundPlayerActionPacket.Action action, Direction face, int maxBuildHeight, int sequence) { + public void handleBlockBreakAction(BlockPos pos, Action action, Direction face, int maxBuildHeight, int sequence) { if (this.demoHasEnded) { this.outputDemoReminder(); } else { diff --git a/net/minecraft/server/level/DistanceManager.java b/net/minecraft/server/level/DistanceManager.java index 59f521f8..41bc06d2 100644 --- a/net/minecraft/server/level/DistanceManager.java +++ b/net/minecraft/server/level/DistanceManager.java @@ -1,9 +1,7 @@ package net.minecraft.server.level; import com.google.common.annotations.VisibleForTesting; -import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSet; -import com.google.common.collect.Sets; import com.mojang.logging.LogUtils; import it.unimi.dsi.fastutil.longs.Long2ByteMap; import it.unimi.dsi.fastutil.longs.Long2ByteOpenHashMap; @@ -20,6 +18,7 @@ import it.unimi.dsi.fastutil.longs.Long2ObjectMap.Entry; import it.unimi.dsi.fastutil.objects.ObjectIterator; import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; import it.unimi.dsi.fastutil.objects.ObjectSet; +import it.unimi.dsi.fastutil.objects.ReferenceOpenHashSet; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; @@ -30,7 +29,7 @@ import java.util.concurrent.CompletableFuture; import java.util.concurrent.Executor; import net.minecraft.core.SectionPos; import net.minecraft.util.SortedArraySet; -import net.minecraft.util.thread.ProcessorHandle; +import net.minecraft.util.thread.TaskScheduler; import net.minecraft.world.level.ChunkPos; import net.minecraft.world.level.chunk.LevelChunk; import org.jetbrains.annotations.Nullable; @@ -46,21 +45,16 @@ public abstract class DistanceManager { private final DistanceManager.FixedPlayerDistanceChunkTracker naturalSpawnChunkCounter = new DistanceManager.FixedPlayerDistanceChunkTracker(8); private final TickingTracker tickingTicketsTracker = new TickingTracker(); private final DistanceManager.PlayerTicketTracker playerTicketManager = new DistanceManager.PlayerTicketTracker(32); - final Set chunksToUpdateFutures = Sets.newHashSet(); - final ChunkTaskPriorityQueueSorter ticketThrottler; - final ProcessorHandle> ticketThrottlerInput; - final ProcessorHandle ticketThrottlerReleaser; + final Set chunksToUpdateFutures = new ReferenceOpenHashSet<>(); + final ThrottlingChunkTaskDispatcher ticketDispatcher; final LongSet ticketsToRelease = new LongOpenHashSet(); final Executor mainThreadExecutor; private long ticketTickCounter; private int simulationDistance = 10; protected DistanceManager(Executor dispatcher, Executor mainThreadExecutor) { - ProcessorHandle processorHandle = ProcessorHandle.of("player ticket throttler", mainThreadExecutor::execute); - ChunkTaskPriorityQueueSorter chunkTaskPriorityQueueSorter = new ChunkTaskPriorityQueueSorter(ImmutableList.of(processorHandle), dispatcher, 4); - this.ticketThrottler = chunkTaskPriorityQueueSorter; - this.ticketThrottlerInput = chunkTaskPriorityQueueSorter.getProcessor(processorHandle, true); - this.ticketThrottlerReleaser = chunkTaskPriorityQueueSorter.getReleaseProcessor(processorHandle); + TaskScheduler taskScheduler = TaskScheduler.wrapExecutor("player ticket throttler", mainThreadExecutor); + this.ticketDispatcher = new ThrottlingChunkTaskDispatcher(taskScheduler, dispatcher, 4); this.mainThreadExecutor = mainThreadExecutor; } @@ -117,8 +111,14 @@ public abstract class DistanceManager { } if (!this.chunksToUpdateFutures.isEmpty()) { - this.chunksToUpdateFutures.forEach(chunkHolderx -> chunkHolderx.updateHighestAllowedStatus(chunkMap)); - this.chunksToUpdateFutures.forEach(chunkHolderx -> chunkHolderx.updateFutures(chunkMap, this.mainThreadExecutor)); + for (ChunkHolder chunkHolder : this.chunksToUpdateFutures) { + chunkHolder.updateHighestAllowedStatus(chunkMap); + } + + for (ChunkHolder chunkHolder : this.chunksToUpdateFutures) { + chunkHolder.updateFutures(chunkMap, this.mainThreadExecutor); + } + this.chunksToUpdateFutures.clear(); return true; } else { @@ -128,15 +128,13 @@ public abstract class DistanceManager { while (longIterator.hasNext()) { long l = longIterator.nextLong(); if (this.getTickets(l).stream().anyMatch(ticket -> ticket.getType() == TicketType.PLAYER)) { - ChunkHolder chunkHolder = chunkMap.getUpdatingChunkIfPresent(l); - if (chunkHolder == null) { + ChunkHolder chunkHolder2 = chunkMap.getUpdatingChunkIfPresent(l); + if (chunkHolder2 == null) { throw new IllegalStateException(); } - CompletableFuture> completableFuture = chunkHolder.getEntityTickingChunkFuture(); - completableFuture.thenAccept( - chunkResult -> this.mainThreadExecutor.execute(() -> this.ticketThrottlerReleaser.tell(ChunkTaskPriorityQueueSorter.release(() -> {}, l, false))) - ); + CompletableFuture> completableFuture = chunkHolder2.getEntityTickingChunkFuture(); + completableFuture.thenAccept(chunkResult -> this.mainThreadExecutor.execute(() -> this.ticketDispatcher.release(l, () -> {}, false))); } } @@ -272,8 +270,13 @@ public abstract class DistanceManager { return this.naturalSpawnChunkCounter.chunks.containsKey(chunkPos); } + public LongIterator getSpawnCandidateChunks() { + this.naturalSpawnChunkCounter.runAllUpdates(); + return this.naturalSpawnChunkCounter.chunks.keySet().iterator(); + } + public String getDebugStatus() { - return this.ticketThrottler.getDebugStatus(); + return this.ticketDispatcher.getDebugStatus(); } private void dumpTickets(String filename) { @@ -311,6 +314,10 @@ public abstract class DistanceManager { return this.tickingTicketsTracker; } + public LongSet getTickingChunks() { + return this.tickingTicketsTracker.getTickingChunks(); + } + public void removeTicketsOnClosing() { ImmutableSet> immutableSet = ImmutableSet.of(TicketType.UNKNOWN, TicketType.POST_TELEPORT); ObjectIterator>>> objectIterator = this.tickets.long2ObjectEntrySet().fastIterator(); @@ -498,22 +505,17 @@ public abstract class DistanceManager { if (hadTicket != hasTicket) { Ticket ticket = new Ticket<>(TicketType.PLAYER, DistanceManager.PLAYER_TICKET_LEVEL, new ChunkPos(chunkPos)); if (hasTicket) { - DistanceManager.this.ticketThrottlerInput - .tell(ChunkTaskPriorityQueueSorter.message((Runnable)(() -> DistanceManager.this.mainThreadExecutor.execute(() -> { - if (this.haveTicketFor(this.getLevel(chunkPos))) { - DistanceManager.this.addTicket(chunkPos, ticket); - DistanceManager.this.ticketsToRelease.add(chunkPos); - } else { - DistanceManager.this.ticketThrottlerReleaser.tell(ChunkTaskPriorityQueueSorter.release(() -> {}, chunkPos, false)); - } - })), chunkPos, () -> level)); + DistanceManager.this.ticketDispatcher.submit(() -> DistanceManager.this.mainThreadExecutor.execute(() -> { + if (this.haveTicketFor(this.getLevel(chunkPos))) { + DistanceManager.this.addTicket(chunkPos, ticket); + DistanceManager.this.ticketsToRelease.add(chunkPos); + } else { + DistanceManager.this.ticketDispatcher.release(chunkPos, () -> {}, false); + } + }), chunkPos, () -> level); } else { - DistanceManager.this.ticketThrottlerReleaser - .tell( - ChunkTaskPriorityQueueSorter.release( - () -> DistanceManager.this.mainThreadExecutor.execute(() -> DistanceManager.this.removeTicket(chunkPos, ticket)), chunkPos, true - ) - ); + DistanceManager.this.ticketDispatcher + .release(chunkPos, () -> DistanceManager.this.mainThreadExecutor.execute(() -> DistanceManager.this.removeTicket(chunkPos, ticket)), true); } } } @@ -529,7 +531,7 @@ public abstract class DistanceManager { int i = this.queueLevels.get(l); int j = this.getLevel(l); if (i != j) { - DistanceManager.this.ticketThrottler.onLevelChange(new ChunkPos(l), () -> this.queueLevels.get(l), j, ix -> { + DistanceManager.this.ticketDispatcher.onLevelChange(new ChunkPos(l), () -> this.queueLevels.get(l), j, ix -> { if (ix >= this.queueLevels.defaultReturnValue()) { this.queueLevels.remove(l); } else { diff --git a/net/minecraft/server/level/GenerationChunkHolder.java b/net/minecraft/server/level/GenerationChunkHolder.java index 5ac99b52..15dec890 100644 --- a/net/minecraft/server/level/GenerationChunkHolder.java +++ b/net/minecraft/server/level/GenerationChunkHolder.java @@ -33,9 +33,13 @@ public abstract class GenerationChunkHolder { private final AtomicReferenceArray>> futures = new AtomicReferenceArray(CHUNK_STATUSES.size()); private final AtomicReference task = new AtomicReference(); private final AtomicInteger generationRefCount = new AtomicInteger(); + private volatile CompletableFuture generationSaveSyncFuture = CompletableFuture.completedFuture(null); public GenerationChunkHolder(ChunkPos pos) { this.pos = pos; + if (pos.getChessboardDistance(ChunkPos.ZERO) > ChunkPos.MAX_COORDINATE_VALUE) { + throw new IllegalStateException("Trying to create chunk out of reasonable bounds: " + pos); + } } public CompletableFuture> scheduleChunkGenerationTask(ChunkStatus targetStatus, ChunkMap chunkMap) { @@ -228,19 +232,25 @@ public abstract class GenerationChunkHolder { return chunkStatus == null || status.isAfter(chunkStatus); } - public void increaseGenerationRefCount() { - this.generationRefCount.incrementAndGet(); - } + protected abstract void addSaveDependency(CompletableFuture completableFuture); - public void decreaseGenerationRefCount() { - int i = this.generationRefCount.decrementAndGet(); - if (i < 0) { - throw new IllegalStateException("More releases than claims. Count: " + i); + public void increaseGenerationRefCount() { + if (this.generationRefCount.getAndIncrement() == 0) { + this.generationSaveSyncFuture = new CompletableFuture(); + this.addSaveDependency(this.generationSaveSyncFuture); } } - public int getGenerationRefCount() { - return this.generationRefCount.get(); + public void decreaseGenerationRefCount() { + CompletableFuture completableFuture = this.generationSaveSyncFuture; + int i = this.generationRefCount.decrementAndGet(); + if (i == 0) { + completableFuture.complete(null); + } + + if (i < 0) { + throw new IllegalStateException("More releases than claims. Count: " + i); + } } @Nullable diff --git a/net/minecraft/client/ParticleStatus.java b/net/minecraft/server/level/ParticleStatus.java similarity index 57% rename from net/minecraft/client/ParticleStatus.java rename to net/minecraft/server/level/ParticleStatus.java index a2d93403..c89bad3e 100644 --- a/net/minecraft/client/ParticleStatus.java +++ b/net/minecraft/server/level/ParticleStatus.java @@ -1,24 +1,22 @@ -package net.minecraft.client; +package net.minecraft.server.level; import java.util.function.IntFunction; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; import net.minecraft.util.ByIdMap; import net.minecraft.util.OptionEnum; +import net.minecraft.util.ByIdMap.OutOfBoundsStrategy; -@Environment(EnvType.CLIENT) public enum ParticleStatus implements OptionEnum { ALL(0, "options.particles.all"), DECREASED(1, "options.particles.decreased"), MINIMAL(2, "options.particles.minimal"); - private static final IntFunction BY_ID = ByIdMap.continuous(ParticleStatus::getId, values(), ByIdMap.OutOfBoundsStrategy.WRAP); + private static final IntFunction BY_ID = ByIdMap.continuous(ParticleStatus::getId, values(), OutOfBoundsStrategy.WRAP); private final int id; private final String key; - private ParticleStatus(final int id, final String key) { - this.id = id; - this.key = key; + private ParticleStatus(final int j, final String string2) { + this.id = j; + this.key = string2; } @Override @@ -31,7 +29,7 @@ public enum ParticleStatus implements OptionEnum { return this.id; } - public static ParticleStatus byId(int id) { - return (ParticleStatus)BY_ID.apply(id); + public static ParticleStatus byId(int i) { + return (ParticleStatus)BY_ID.apply(i); } } diff --git a/net/minecraft/server/level/PlayerRespawnLogic.java b/net/minecraft/server/level/PlayerRespawnLogic.java index b9956a3e..5d7f7138 100644 --- a/net/minecraft/server/level/PlayerRespawnLogic.java +++ b/net/minecraft/server/level/PlayerRespawnLogic.java @@ -17,7 +17,7 @@ public class PlayerRespawnLogic { boolean bl = level.dimensionType().hasCeiling(); LevelChunk levelChunk = level.getChunk(SectionPos.blockToSectionCoord(x), SectionPos.blockToSectionCoord(z)); int i = bl ? level.getChunkSource().getGenerator().getSpawnHeight(level) : levelChunk.getHeight(Heightmap.Types.MOTION_BLOCKING, x & 15, z & 15); - if (i < level.getMinBuildHeight()) { + if (i < level.getMinY()) { return null; } else { int j = levelChunk.getHeight(Heightmap.Types.WORLD_SURFACE, x & 15, z & 15); @@ -26,7 +26,7 @@ public class PlayerRespawnLogic { } else { BlockPos.MutableBlockPos mutableBlockPos = new BlockPos.MutableBlockPos(); - for (int k = i + 1; k >= level.getMinBuildHeight(); k--) { + for (int k = i + 1; k >= level.getMinY(); k--) { mutableBlockPos.set(x, k, z); BlockState blockState = level.getBlockState(mutableBlockPos); if (!blockState.getFluidState().isEmpty()) { diff --git a/net/minecraft/server/level/ServerChunkCache.java b/net/minecraft/server/level/ServerChunkCache.java index 0c5b3b99..ead6a3c3 100644 --- a/net/minecraft/server/level/ServerChunkCache.java +++ b/net/minecraft/server/level/ServerChunkCache.java @@ -1,17 +1,21 @@ package net.minecraft.server.level; import com.google.common.annotations.VisibleForTesting; -import com.google.common.collect.Lists; import com.mojang.datafixers.DataFixer; -import java.io.File; +import com.mojang.logging.LogUtils; +import it.unimi.dsi.fastutil.objects.ReferenceOpenHashSet; import java.io.IOException; +import java.nio.file.Path; +import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import java.util.Set; import java.util.concurrent.CompletableFuture; import java.util.concurrent.Executor; import java.util.function.BooleanSupplier; import java.util.function.Consumer; import java.util.function.Supplier; +import net.minecraft.FileUtil; import net.minecraft.Util; import net.minecraft.core.BlockPos; import net.minecraft.core.SectionPos; @@ -19,9 +23,11 @@ import net.minecraft.network.protocol.Packet; import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.progress.ChunkProgressListener; import net.minecraft.util.VisibleForDebug; +import net.minecraft.util.profiling.Profiler; import net.minecraft.util.profiling.ProfilerFiller; import net.minecraft.util.thread.BlockableEventLoop; import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.MobCategory; import net.minecraft.world.entity.ai.village.poi.PoiManager; import net.minecraft.world.level.ChunkPos; import net.minecraft.world.level.GameRules; @@ -43,11 +49,12 @@ import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemp import net.minecraft.world.level.storage.DimensionDataStorage; import net.minecraft.world.level.storage.LevelStorageSource; import org.jetbrains.annotations.Nullable; +import org.slf4j.Logger; public class ServerChunkCache extends ChunkSource { - private static final List CHUNK_STATUSES = ChunkStatus.getStatusList(); + private static final Logger LOGGER = LogUtils.getLogger(); private final DistanceManager distanceManager; - final ServerLevel level; + private final ServerLevel level; final Thread mainThread; final ThreadedLevelLightEngine lightEngine; private final ServerChunkCache.MainThreadExecutor mainThreadProcessor; @@ -60,6 +67,8 @@ public class ServerChunkCache extends ChunkSource { private final long[] lastChunkPos = new long[4]; private final ChunkStatus[] lastChunkStatus = new ChunkStatus[4]; private final ChunkAccess[] lastChunk = new ChunkAccess[4]; + private final List tickingChunks = new ArrayList(); + private final Set chunkHoldersToBroadcast = new ReferenceOpenHashSet<>(); @Nullable @VisibleForDebug private NaturalSpawner.SpawnState lastSpawnState; @@ -81,9 +90,15 @@ public class ServerChunkCache extends ChunkSource { this.level = level; this.mainThreadProcessor = new ServerChunkCache.MainThreadExecutor(level); this.mainThread = Thread.currentThread(); - File file = levelStorageAccess.getDimensionPath(level.dimension()).resolve("data").toFile(); - file.mkdirs(); - this.dataStorage = new DimensionDataStorage(file, fixerUpper, level.registryAccess()); + Path path = levelStorageAccess.getDimensionPath(level.dimension()).resolve("data"); + + try { + FileUtil.createDirectoriesSafe(path); + } catch (IOException var15) { + LOGGER.error("Failed to create dimension data storage directory", (Throwable)var15); + } + + this.dataStorage = new DimensionDataStorage(path, fixerUpper, level.registryAccess()); this.chunkMap = new ChunkMap( level, levelStorageAccess, @@ -136,7 +151,7 @@ public class ServerChunkCache extends ChunkSource { if (Thread.currentThread() != this.mainThread) { return (ChunkAccess)CompletableFuture.supplyAsync(() -> this.getChunk(x, z, chunkStatus, requireChunk), this.mainThreadProcessor).join(); } else { - ProfilerFiller profilerFiller = this.level.getProfiler(); + ProfilerFiller profilerFiller = Profiler.get(); profilerFiller.incrementCounter("getChunk"); long l = ChunkPos.asLong(x, z); @@ -169,7 +184,7 @@ public class ServerChunkCache extends ChunkSource { if (Thread.currentThread() != this.mainThread) { return null; } else { - this.level.getProfiler().incrementCounter("getChunkNow"); + Profiler.get().incrementCounter("getChunkNow"); long l = ChunkPos.asLong(chunkX, chunkZ); for (int i = 0; i < 4; i++) { @@ -224,7 +239,7 @@ public class ServerChunkCache extends ChunkSource { if (requireChunk) { this.distanceManager.addTicket(TicketType.UNKNOWN, chunkPos, i, chunkPos); if (this.chunkAbsent(chunkHolder, i)) { - ProfilerFiller profilerFiller = this.level.getProfiler(); + ProfilerFiller profilerFiller = Profiler.get(); profilerFiller.push("chunkLoad"); this.runDistanceManagerUpdates(); chunkHolder = this.getVisibleChunkIfPresent(l); @@ -278,13 +293,11 @@ public class ServerChunkCache extends ChunkSource { } public boolean isPositionTicking(long chunkPos) { - ChunkHolder chunkHolder = this.getVisibleChunkIfPresent(chunkPos); - if (chunkHolder == null) { + if (!this.level.shouldTickBlocksAt(chunkPos)) { return false; } else { - return !this.level.shouldTickBlocksAt(chunkPos) - ? false - : ((ChunkResult)chunkHolder.getTickingChunkFuture().getNow(ChunkHolder.UNLOADED_LEVEL_CHUNK)).isSuccess(); + ChunkHolder chunkHolder = this.getVisibleChunkIfPresent(chunkPos); + return chunkHolder == null ? false : ((ChunkResult)chunkHolder.getTickingChunkFuture().getNow(ChunkHolder.UNLOADED_LEVEL_CHUNK)).isSuccess(); } } @@ -296,27 +309,29 @@ public class ServerChunkCache extends ChunkSource { @Override public void close() throws IOException { this.save(true); + this.dataStorage.close(); this.lightEngine.close(); this.chunkMap.close(); } @Override public void tick(BooleanSupplier hasTimeLeft, boolean tickChunks) { - this.level.getProfiler().push("purge"); + ProfilerFiller profilerFiller = Profiler.get(); + profilerFiller.push("purge"); if (this.level.tickRateManager().runsNormally() || !tickChunks) { this.distanceManager.purgeStaleTickets(); } this.runDistanceManagerUpdates(); - this.level.getProfiler().popPush("chunks"); + profilerFiller.popPush("chunks"); if (tickChunks) { this.tickChunks(); this.chunkMap.tick(); } - this.level.getProfiler().popPush("unload"); + profilerFiller.popPush("unload"); this.chunkMap.tick(hasTimeLeft); - this.level.getProfiler().pop(); + profilerFiller.pop(); this.clearCache(); } @@ -325,59 +340,87 @@ public class ServerChunkCache extends ChunkSource { long m = l - this.lastInhabitedUpdate; this.lastInhabitedUpdate = l; if (!this.level.isDebug()) { - ProfilerFiller profilerFiller = this.level.getProfiler(); + ProfilerFiller profilerFiller = Profiler.get(); profilerFiller.push("pollingChunks"); - profilerFiller.push("filteringLoadedChunks"); - List list = Lists.newArrayListWithCapacity(this.chunkMap.size()); - - for (ChunkHolder chunkHolder : this.chunkMap.getChunks()) { - LevelChunk levelChunk = chunkHolder.getTickingChunk(); - if (levelChunk != null) { - list.add(new ServerChunkCache.ChunkAndHolder(levelChunk, chunkHolder)); - } - } - if (this.level.tickRateManager().runsNormally()) { - profilerFiller.popPush("naturalSpawnCount"); - int i = this.distanceManager.getNaturalSpawnChunkCount(); - NaturalSpawner.SpawnState spawnState = NaturalSpawner.createState( - i, this.level.getAllEntities(), this::getFullChunk, new LocalMobCapCalculator(this.chunkMap) - ); - this.lastSpawnState = spawnState; - profilerFiller.popPush("spawnAndTick"); - boolean bl = this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING); - Util.shuffle(list, this.level.random); - int j = this.level.getGameRules().getInt(GameRules.RULE_RANDOMTICKING); - boolean bl2 = this.level.getLevelData().getGameTime() % 400L == 0L; + List list = this.tickingChunks; - for (ServerChunkCache.ChunkAndHolder chunkAndHolder : list) { - LevelChunk levelChunk2 = chunkAndHolder.chunk; - ChunkPos chunkPos = levelChunk2.getPos(); - if (this.level.isNaturalSpawningAllowed(chunkPos) && this.chunkMap.anyPlayerCloseEnoughForSpawning(chunkPos)) { - levelChunk2.incrementInhabitedTime(m); - if (bl && (this.spawnEnemies || this.spawnFriendlies) && this.level.getWorldBorder().isWithinBounds(chunkPos)) { - NaturalSpawner.spawnForChunk(this.level, levelChunk2, spawnState, this.spawnFriendlies, this.spawnEnemies, bl2); - } - - if (this.level.shouldTickBlocksAt(chunkPos.toLong())) { - this.level.tickChunk(levelChunk2, j); - } - } - } - - profilerFiller.popPush("customSpawners"); - if (bl) { - this.level.tickCustomSpawners(this.spawnEnemies, this.spawnFriendlies); + try { + profilerFiller.push("filteringTickingChunks"); + this.collectTickingChunks(list); + profilerFiller.popPush("shuffleChunks"); + Util.shuffle(list, this.level.random); + this.tickChunks(profilerFiller, m, list); + profilerFiller.pop(); + } finally { + list.clear(); } } - profilerFiller.popPush("broadcast"); - list.forEach(chunkAndHolderx -> chunkAndHolderx.holder.broadcastChanges(chunkAndHolderx.chunk)); - profilerFiller.pop(); + this.broadcastChangedChunks(profilerFiller); profilerFiller.pop(); } } + private void broadcastChangedChunks(ProfilerFiller profilerFiller) { + profilerFiller.push("broadcast"); + + for (ChunkHolder chunkHolder : this.chunkHoldersToBroadcast) { + LevelChunk levelChunk = chunkHolder.getTickingChunk(); + if (levelChunk != null) { + chunkHolder.broadcastChanges(levelChunk); + } + } + + this.chunkHoldersToBroadcast.clear(); + profilerFiller.pop(); + } + + private void collectTickingChunks(List list) { + this.chunkMap.forEachSpawnCandidateChunk(chunkHolder -> { + LevelChunk levelChunk = chunkHolder.getTickingChunk(); + if (levelChunk != null && this.level.isNaturalSpawningAllowed(chunkHolder.getPos())) { + list.add(levelChunk); + } + }); + } + + private void tickChunks(ProfilerFiller profilerFiller, long l, List list) { + profilerFiller.popPush("naturalSpawnCount"); + int i = this.distanceManager.getNaturalSpawnChunkCount(); + NaturalSpawner.SpawnState spawnState = NaturalSpawner.createState( + i, this.level.getAllEntities(), this::getFullChunk, new LocalMobCapCalculator(this.chunkMap) + ); + this.lastSpawnState = spawnState; + profilerFiller.popPush("spawnAndTick"); + boolean bl = this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING); + int j = this.level.getGameRules().getInt(GameRules.RULE_RANDOMTICKING); + List list2; + if (bl && (this.spawnEnemies || this.spawnFriendlies)) { + boolean bl2 = this.level.getLevelData().getGameTime() % 400L == 0L; + list2 = NaturalSpawner.getFilteredSpawningCategories(spawnState, this.spawnFriendlies, this.spawnEnemies, bl2); + } else { + list2 = List.of(); + } + + for (LevelChunk levelChunk : list) { + ChunkPos chunkPos = levelChunk.getPos(); + levelChunk.incrementInhabitedTime(l); + if (!list2.isEmpty() && this.level.getWorldBorder().isWithinBounds(chunkPos)) { + NaturalSpawner.spawnForChunk(this.level, levelChunk, spawnState, list2); + } + + if (this.level.shouldTickBlocksAt(chunkPos.toLong())) { + this.level.tickChunk(levelChunk, j); + } + } + + profilerFiller.popPush("customSpawners"); + if (bl) { + this.level.tickCustomSpawners(this.spawnEnemies, this.spawnFriendlies); + } + } + private void getFullChunk(long chunkPos, Consumer fullChunkGetter) { ChunkHolder chunkHolder = this.getVisibleChunkIfPresent(chunkPos); if (chunkHolder != null) { @@ -416,8 +459,8 @@ public class ServerChunkCache extends ChunkSource { int i = SectionPos.blockToSectionCoord(pos.getX()); int j = SectionPos.blockToSectionCoord(pos.getZ()); ChunkHolder chunkHolder = this.getVisibleChunkIfPresent(ChunkPos.asLong(i, j)); - if (chunkHolder != null) { - chunkHolder.blockChanged(pos); + if (chunkHolder != null && chunkHolder.blockChanged(pos)) { + this.chunkHoldersToBroadcast.add(chunkHolder); } } @@ -425,8 +468,8 @@ public class ServerChunkCache extends ChunkSource { public void onLightUpdate(LightLayer layer, SectionPos pos) { this.mainThreadProcessor.execute(() -> { ChunkHolder chunkHolder = this.getVisibleChunkIfPresent(pos.chunk().toLong()); - if (chunkHolder != null) { - chunkHolder.sectionLightChanged(layer, pos.y()); + if (chunkHolder != null && chunkHolder.sectionLightChanged(layer, pos.y())) { + this.chunkHoldersToBroadcast.add(chunkHolder); } }); } @@ -475,9 +518,9 @@ public class ServerChunkCache extends ChunkSource { } @Override - public void setSpawnSettings(boolean hostile, boolean peaceful) { - this.spawnEnemies = hostile; - this.spawnFriendlies = peaceful; + public void setSpawnSettings(boolean bl) { + this.spawnEnemies = bl; + this.spawnFriendlies = this.spawnFriendlies; } public String getChunkDebugData(ChunkPos chunkPos) { @@ -506,6 +549,12 @@ public class ServerChunkCache extends ChunkSource { this.distanceManager.removeTicketsOnClosing(); } + public void onChunkReadyToSend(ChunkHolder chunkHolder) { + if (chunkHolder.hasChangesToBroadcast()) { + this.chunkHoldersToBroadcast.add(chunkHolder); + } + } + record ChunkAndHolder(LevelChunk chunk, ChunkHolder holder) { } @@ -520,7 +569,7 @@ public class ServerChunkCache extends ChunkSource { } @Override - protected Runnable wrapRunnable(Runnable runnable) { + public Runnable wrapRunnable(Runnable runnable) { return runnable; } @@ -541,7 +590,7 @@ public class ServerChunkCache extends ChunkSource { @Override protected void doRunTask(Runnable task) { - ServerChunkCache.this.level.getProfiler().incrementCounter("runTask"); + Profiler.get().incrementCounter("runTask"); super.doRunTask(task); } diff --git a/net/minecraft/server/level/ServerEntity.java b/net/minecraft/server/level/ServerEntity.java index e95f7dc4..0a9e6fbb 100644 --- a/net/minecraft/server/level/ServerEntity.java +++ b/net/minecraft/server/level/ServerEntity.java @@ -14,7 +14,9 @@ import net.minecraft.core.component.DataComponents; import net.minecraft.network.protocol.Packet; import net.minecraft.network.protocol.game.ClientGamePacketListener; import net.minecraft.network.protocol.game.ClientboundBundlePacket; +import net.minecraft.network.protocol.game.ClientboundEntityPositionSyncPacket; import net.minecraft.network.protocol.game.ClientboundMoveEntityPacket; +import net.minecraft.network.protocol.game.ClientboundMoveMinecartPacket; import net.minecraft.network.protocol.game.ClientboundProjectilePowerPacket; import net.minecraft.network.protocol.game.ClientboundRemoveEntitiesPacket; import net.minecraft.network.protocol.game.ClientboundRotateHeadPacket; @@ -23,10 +25,10 @@ import net.minecraft.network.protocol.game.ClientboundSetEntityLinkPacket; import net.minecraft.network.protocol.game.ClientboundSetEntityMotionPacket; import net.minecraft.network.protocol.game.ClientboundSetEquipmentPacket; import net.minecraft.network.protocol.game.ClientboundSetPassengersPacket; -import net.minecraft.network.protocol.game.ClientboundTeleportEntityPacket; import net.minecraft.network.protocol.game.ClientboundUpdateAttributesPacket; import net.minecraft.network.protocol.game.VecDeltaCodec; import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.network.syncher.SynchedEntityData.DataValue; import net.minecraft.util.Mth; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EquipmentSlot; @@ -36,6 +38,8 @@ import net.minecraft.world.entity.ai.attributes.AttributeInstance; import net.minecraft.world.entity.decoration.ItemFrame; import net.minecraft.world.entity.projectile.AbstractArrow; import net.minecraft.world.entity.projectile.AbstractHurtingProjectile; +import net.minecraft.world.entity.vehicle.AbstractMinecart; +import net.minecraft.world.entity.vehicle.NewMinecartBehavior; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.MapItem; import net.minecraft.world.level.saveddata.maps.MapId; @@ -56,9 +60,9 @@ public class ServerEntity { private final boolean trackDelta; private final Consumer> broadcast; private final VecDeltaCodec positionCodec = new VecDeltaCodec(); - private int lastSentYRot; - private int lastSentXRot; - private int lastSentYHeadRot; + private byte lastSentYRot; + private byte lastSentXRot; + private byte lastSentYHeadRot; private Vec3 lastSentMovement; private int tickCount; private int teleportDelay; @@ -66,7 +70,7 @@ public class ServerEntity { private boolean wasRiding; private boolean wasOnGround; @Nullable - private List> trackedDataValues; + private List> trackedDataValues; public ServerEntity(ServerLevel level, Entity entity, int updateInterval, boolean trackDelta, Consumer> broadcast) { this.level = level; @@ -76,9 +80,9 @@ public class ServerEntity { this.trackDelta = trackDelta; this.positionCodec.setBase(entity.trackingPosition()); this.lastSentMovement = entity.getDeltaMovement(); - this.lastSentYRot = Mth.floor(entity.getYRot() * 256.0F / 360.0F); - this.lastSentXRot = Mth.floor(entity.getXRot() * 256.0F / 360.0F); - this.lastSentYHeadRot = Mth.floor(entity.getYHeadRot() * 256.0F / 360.0F); + this.lastSentYRot = Mth.packDegrees(entity.getYRot()); + this.lastSentXRot = Mth.packDegrees(entity.getXRot()); + this.lastSentYHeadRot = Mth.packDegrees(entity.getYHeadRot()); this.wasOnGround = entity.onGround(); this.trackedDataValues = entity.getEntityData().getNonDefaultValues(); } @@ -115,52 +119,51 @@ public class ServerEntity { } if (this.tickCount % this.updateInterval == 0 || this.entity.hasImpulse || this.entity.getEntityData().isDirty()) { + byte b = Mth.packDegrees(this.entity.getYRot()); + byte c = Mth.packDegrees(this.entity.getXRot()); + boolean bl = Math.abs(b - this.lastSentYRot) >= 1 || Math.abs(c - this.lastSentXRot) >= 1; if (this.entity.isPassenger()) { - int i = Mth.floor(this.entity.getYRot() * 256.0F / 360.0F); - int j = Mth.floor(this.entity.getXRot() * 256.0F / 360.0F); - boolean bl = Math.abs(i - this.lastSentYRot) >= 1 || Math.abs(j - this.lastSentXRot) >= 1; if (bl) { - this.broadcast.accept(new ClientboundMoveEntityPacket.Rot(this.entity.getId(), (byte)i, (byte)j, this.entity.onGround())); - this.lastSentYRot = i; - this.lastSentXRot = j; + this.broadcast.accept(new ClientboundMoveEntityPacket.Rot(this.entity.getId(), b, c, this.entity.onGround())); + this.lastSentYRot = b; + this.lastSentXRot = c; } this.positionCodec.setBase(this.entity.trackingPosition()); this.sendDirtyEntityData(); this.wasRiding = true; + } else if (this.entity instanceof AbstractMinecart abstractMinecart && abstractMinecart.getBehavior() instanceof NewMinecartBehavior newMinecartBehavior) { + this.handleMinecartPosRot(newMinecartBehavior, b, c, bl); } else { this.teleportDelay++; - int i = Mth.floor(this.entity.getYRot() * 256.0F / 360.0F); - int j = Mth.floor(this.entity.getXRot() * 256.0F / 360.0F); Vec3 vec3 = this.entity.trackingPosition(); boolean bl2 = this.positionCodec.delta(vec3).lengthSqr() >= 7.6293945E-6F; Packet packet2 = null; boolean bl3 = bl2 || this.tickCount % 60 == 0; - boolean bl4 = Math.abs(i - this.lastSentYRot) >= 1 || Math.abs(j - this.lastSentXRot) >= 1; + boolean bl4 = false; boolean bl5 = false; - boolean bl6 = false; long l = this.positionCodec.encodeX(vec3); long m = this.positionCodec.encodeY(vec3); long n = this.positionCodec.encodeZ(vec3); - boolean bl7 = l < -32768L || l > 32767L || m < -32768L || m > 32767L || n < -32768L || n > 32767L; - if (bl7 || this.teleportDelay > 400 || this.wasRiding || this.wasOnGround != this.entity.onGround()) { + boolean bl6 = l < -32768L || l > 32767L || m < -32768L || m > 32767L || n < -32768L || n > 32767L; + if (bl6 || this.teleportDelay > 400 || this.wasRiding || this.wasOnGround != this.entity.onGround()) { this.wasOnGround = this.entity.onGround(); this.teleportDelay = 0; - packet2 = new ClientboundTeleportEntityPacket(this.entity); + packet2 = ClientboundEntityPositionSyncPacket.of(this.entity); + bl4 = true; bl5 = true; - bl6 = true; - } else if ((!bl3 || !bl4) && !(this.entity instanceof AbstractArrow)) { + } else if ((!bl3 || !bl) && !(this.entity instanceof AbstractArrow)) { if (bl3) { packet2 = new ClientboundMoveEntityPacket.Pos(this.entity.getId(), (short)l, (short)m, (short)n, this.entity.onGround()); + bl4 = true; + } else if (bl) { + packet2 = new ClientboundMoveEntityPacket.Rot(this.entity.getId(), b, c, this.entity.onGround()); bl5 = true; - } else if (bl4) { - packet2 = new ClientboundMoveEntityPacket.Rot(this.entity.getId(), (byte)i, (byte)j, this.entity.onGround()); - bl6 = true; } } else { - packet2 = new ClientboundMoveEntityPacket.PosRot(this.entity.getId(), (short)l, (short)m, (short)n, (byte)i, (byte)j, this.entity.onGround()); + packet2 = new ClientboundMoveEntityPacket.PosRot(this.entity.getId(), (short)l, (short)m, (short)n, b, c, this.entity.onGround()); + bl4 = true; bl5 = true; - bl6 = true; } if ((this.trackDelta || this.entity.hasImpulse || this.entity instanceof LivingEntity && ((LivingEntity)this.entity).isFallFlying()) && this.tickCount > 0) { @@ -189,22 +192,22 @@ public class ServerEntity { } this.sendDirtyEntityData(); - if (bl5) { + if (bl4) { this.positionCodec.setBase(vec3); } - if (bl6) { - this.lastSentYRot = i; - this.lastSentXRot = j; + if (bl5) { + this.lastSentYRot = b; + this.lastSentXRot = c; } this.wasRiding = false; } - int ix = Mth.floor(this.entity.getYHeadRot() * 256.0F / 360.0F); - if (Math.abs(ix - this.lastSentYHeadRot) >= 1) { - this.broadcast.accept(new ClientboundRotateHeadPacket(this.entity, (byte)ix)); - this.lastSentYHeadRot = ix; + byte e = Mth.packDegrees(this.entity.getYHeadRot()); + if (Math.abs(e - this.lastSentYHeadRot) >= 1) { + this.broadcast.accept(new ClientboundRotateHeadPacket(this.entity, e)); + this.lastSentYHeadRot = e; } this.entity.hasImpulse = false; @@ -217,6 +220,33 @@ public class ServerEntity { } } + private void handleMinecartPosRot(NewMinecartBehavior newMinecartBehavior, byte b, byte c, boolean bl) { + this.sendDirtyEntityData(); + if (newMinecartBehavior.lerpSteps.isEmpty()) { + Vec3 vec3 = this.entity.getDeltaMovement(); + double d = vec3.distanceToSqr(this.lastSentMovement); + Vec3 vec32 = this.entity.trackingPosition(); + boolean bl2 = this.positionCodec.delta(vec32).lengthSqr() >= 7.6293945E-6F; + boolean bl3 = bl2 || this.tickCount % 60 == 0; + if (bl3 || bl || d > 1.0E-7) { + this.broadcast + .accept( + new ClientboundMoveMinecartPacket( + this.entity.getId(), + List.of(new NewMinecartBehavior.MinecartStep(this.entity.position(), this.entity.getDeltaMovement(), this.entity.getYRot(), this.entity.getXRot(), 1.0F)) + ) + ); + } + } else { + this.broadcast.accept(new ClientboundMoveMinecartPacket(this.entity.getId(), List.copyOf(newMinecartBehavior.lerpSteps))); + newMinecartBehavior.lerpSteps.clear(); + } + + this.lastSentYRot = b; + this.lastSentXRot = c; + this.positionCodec.setBase(this.entity.position()); + } + private static Stream removedPassengers(List initialPassengers, List currentPassengers) { return currentPassengers.stream().filter(entity -> !initialPassengers.contains(entity)); } @@ -260,11 +290,11 @@ public class ServerEntity { consumer.accept(new ClientboundSetEntityMotionPacket(this.entity.getId(), this.lastSentMovement)); } - if (this.entity instanceof LivingEntity) { + if (this.entity instanceof LivingEntity livingEntity) { List> list = Lists.>newArrayList(); - for (EquipmentSlot equipmentSlot : EquipmentSlot.values()) { - ItemStack itemStack = ((LivingEntity)this.entity).getItemBySlot(equipmentSlot); + for (EquipmentSlot equipmentSlot : EquipmentSlot.VALUES) { + ItemStack itemStack = livingEntity.getItemBySlot(equipmentSlot); if (!itemStack.isEmpty()) { list.add(Pair.of(equipmentSlot, itemStack.copy())); } @@ -297,20 +327,20 @@ public class ServerEntity { } public float getLastSentXRot() { - return this.lastSentXRot * 360 / 256.0F; + return Mth.unpackDegrees(this.lastSentXRot); } public float getLastSentYRot() { - return this.lastSentYRot * 360 / 256.0F; + return Mth.unpackDegrees(this.lastSentYRot); } public float getLastSentYHeadRot() { - return this.lastSentYHeadRot * 360 / 256.0F; + return Mth.unpackDegrees(this.lastSentYHeadRot); } private void sendDirtyEntityData() { SynchedEntityData synchedEntityData = this.entity.getEntityData(); - List> list = synchedEntityData.packDirty(); + List> list = synchedEntityData.packDirty(); if (list != null) { this.trackedDataValues = synchedEntityData.getNonDefaultValues(); this.broadcastAndSend(new ClientboundSetEntityDataPacket(this.entity.getId(), list)); diff --git a/net/minecraft/server/level/ServerEntityGetter.java b/net/minecraft/server/level/ServerEntityGetter.java new file mode 100644 index 00000000..526e9191 --- /dev/null +++ b/net/minecraft/server/level/ServerEntityGetter.java @@ -0,0 +1,81 @@ +package net.minecraft.server.level; + +import java.util.ArrayList; +import java.util.List; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.ai.targeting.TargetingConditions; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.level.EntityGetter; +import net.minecraft.world.phys.AABB; +import org.jetbrains.annotations.Nullable; + +public interface ServerEntityGetter extends EntityGetter { + ServerLevel getLevel(); + + @Nullable + default Player getNearestPlayer(TargetingConditions targetingConditions, LivingEntity livingEntity) { + return this.getNearestEntity(this.players(), targetingConditions, livingEntity, livingEntity.getX(), livingEntity.getY(), livingEntity.getZ()); + } + + @Nullable + default Player getNearestPlayer(TargetingConditions targetingConditions, LivingEntity livingEntity, double d, double e, double f) { + return this.getNearestEntity(this.players(), targetingConditions, livingEntity, d, e, f); + } + + @Nullable + default Player getNearestPlayer(TargetingConditions targetingConditions, double d, double e, double f) { + return this.getNearestEntity(this.players(), targetingConditions, null, d, e, f); + } + + @Nullable + default T getNearestEntity( + Class class_, TargetingConditions targetingConditions, @Nullable LivingEntity livingEntity, double d, double e, double f, AABB aABB + ) { + return this.getNearestEntity(this.getEntitiesOfClass(class_, aABB, livingEntityx -> true), targetingConditions, livingEntity, d, e, f); + } + + @Nullable + default T getNearestEntity( + List list, TargetingConditions targetingConditions, @Nullable LivingEntity livingEntity, double d, double e, double f + ) { + double g = -1.0; + T livingEntity2 = null; + + for (T livingEntity3 : list) { + if (targetingConditions.test(this.getLevel(), livingEntity, livingEntity3)) { + double h = livingEntity3.distanceToSqr(d, e, f); + if (g == -1.0 || h < g) { + g = h; + livingEntity2 = livingEntity3; + } + } + } + + return livingEntity2; + } + + default List getNearbyPlayers(TargetingConditions targetingConditions, LivingEntity livingEntity, AABB aABB) { + List list = new ArrayList(); + + for (Player player : this.players()) { + if (aABB.contains(player.getX(), player.getY(), player.getZ()) && targetingConditions.test(this.getLevel(), livingEntity, player)) { + list.add(player); + } + } + + return list; + } + + default List getNearbyEntities(Class class_, TargetingConditions targetingConditions, LivingEntity livingEntity, AABB aABB) { + List list = this.getEntitiesOfClass(class_, aABB, livingEntityx -> true); + List list2 = new ArrayList(); + + for (T livingEntity2 : list) { + if (targetingConditions.test(this.getLevel(), livingEntity, livingEntity2)) { + list2.add(livingEntity2); + } + } + + return list2; + } +} diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java index 062d7ea4..b4486e9f 100644 --- a/net/minecraft/server/level/ServerLevel.java +++ b/net/minecraft/server/level/ServerLevel.java @@ -69,13 +69,14 @@ import net.minecraft.server.players.SleepStatus; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundSource; import net.minecraft.tags.TagKey; -import net.minecraft.util.AbortableIterationConsumer; import net.minecraft.util.CsvOutput; import net.minecraft.util.Mth; import net.minecraft.util.ProgressListener; import net.minecraft.util.RandomSource; import net.minecraft.util.Unit; +import net.minecraft.util.AbortableIterationConsumer.Continuation; import net.minecraft.util.datafix.DataFixTypes; +import net.minecraft.util.profiling.Profiler; import net.minecraft.util.profiling.ProfilerFiller; import net.minecraft.util.valueproviders.IntProvider; import net.minecraft.util.valueproviders.UniformInt; @@ -84,6 +85,7 @@ import net.minecraft.world.RandomSequences; import net.minecraft.world.TickRateManager; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LightningBolt; import net.minecraft.world.entity.LivingEntity; @@ -95,12 +97,9 @@ import net.minecraft.world.entity.ai.village.ReputationEventType; import net.minecraft.world.entity.ai.village.poi.PoiManager; import net.minecraft.world.entity.ai.village.poi.PoiType; import net.minecraft.world.entity.ai.village.poi.PoiTypes; -import net.minecraft.world.entity.animal.Animal; -import net.minecraft.world.entity.animal.WaterAnimal; import net.minecraft.world.entity.animal.horse.SkeletonHorse; import net.minecraft.world.entity.boss.EnderDragonPart; import net.minecraft.world.entity.boss.enderdragon.EnderDragon; -import net.minecraft.world.entity.npc.Npc; import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.raid.Raid; import net.minecraft.world.entity.raid.Raids; @@ -116,12 +115,14 @@ import net.minecraft.world.level.ForcedChunksSavedData; import net.minecraft.world.level.GameRules; import net.minecraft.world.level.Level; import net.minecraft.world.level.NaturalSpawner; +import net.minecraft.world.level.ServerExplosion; import net.minecraft.world.level.StructureManager; import net.minecraft.world.level.WorldGenLevel; import net.minecraft.world.level.biome.Biome; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.SnowLayerBlock; +import net.minecraft.world.level.block.entity.FuelValues; import net.minecraft.world.level.block.entity.TickingBlockEntity; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.chunk.ChunkAccess; @@ -143,6 +144,7 @@ import net.minecraft.world.level.entity.PersistentEntitySectionManager; import net.minecraft.world.level.gameevent.DynamicGameEventListener; import net.minecraft.world.level.gameevent.GameEvent; import net.minecraft.world.level.gameevent.GameEventDispatcher; +import net.minecraft.world.level.gameevent.GameEvent.Context; import net.minecraft.world.level.levelgen.Heightmap; import net.minecraft.world.level.levelgen.structure.BoundingBox; import net.minecraft.world.level.levelgen.structure.Structure; @@ -152,6 +154,8 @@ import net.minecraft.world.level.material.Fluid; import net.minecraft.world.level.material.FluidState; import net.minecraft.world.level.pathfinder.PathTypeCache; import net.minecraft.world.level.portal.PortalForcer; +import net.minecraft.world.level.redstone.ExperimentalRedstoneUtils; +import net.minecraft.world.level.redstone.Orientation; import net.minecraft.world.level.saveddata.maps.MapId; import net.minecraft.world.level.saveddata.maps.MapIndex; import net.minecraft.world.level.saveddata.maps.MapItemSavedData; @@ -168,7 +172,7 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.slf4j.Logger; -public class ServerLevel extends Level implements WorldGenLevel { +public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLevel { public static final BlockPos END_SPAWN_POINT = new BlockPos(100, 50, 0); public static final IntProvider RAIN_DELAY = UniformInt.of(12000, 180000); public static final IntProvider RAIN_DURATION = UniformInt.of(12000, 24000); @@ -189,8 +193,8 @@ public class ServerLevel extends Level implements WorldGenLevel { private final SleepStatus sleepStatus; private int emptyTime; private final PortalForcer portalForcer; - private final LevelTicks blockTicks = new LevelTicks<>(this::isPositionTickingWithEntitiesLoaded, this.getProfilerSupplier()); - private final LevelTicks fluidTicks = new LevelTicks<>(this::isPositionTickingWithEntitiesLoaded, this.getProfilerSupplier()); + private final LevelTicks blockTicks = new LevelTicks<>(this::isPositionTickingWithEntitiesLoaded); + private final LevelTicks fluidTicks = new LevelTicks<>(this::isPositionTickingWithEntitiesLoaded); private final PathTypeCache pathTypesByPosCache = new PathTypeCache(); final Set navigatingMobs = new ObjectOpenHashSet<>(); volatile boolean isUpdatingNavigations; @@ -221,17 +225,7 @@ public class ServerLevel extends Level implements WorldGenLevel { boolean tickTime, @Nullable RandomSequences randomSequences ) { - super( - serverLevelData, - dimension, - server.registryAccess(), - levelStem.type(), - server::getProfiler, - false, - isDebug, - biomeZoomSeed, - server.getMaxChainedNeighborUpdates() - ); + super(serverLevelData, dimension, server.registryAccess(), levelStem.type(), false, isDebug, biomeZoomSeed, server.getMaxChainedNeighborUpdates()); this.tickTime = tickTime; this.server = server; this.customSpawners = customSpawners; @@ -329,7 +323,7 @@ public class ServerLevel extends Level implements WorldGenLevel { * Runs a single tick for the world */ public void tick(BooleanSupplier hasTimeLeft) { - ProfilerFiller profilerFiller = this.getProfiler(); + ProfilerFiller profilerFiller = Profiler.get(); this.handlingTick = true; TickRateManager tickRateManager = this.tickRateManager(); boolean bl = tickRateManager.runsNormally(); @@ -338,6 +332,7 @@ public class ServerLevel extends Level implements WorldGenLevel { this.getWorldBorder().tick(); profilerFiller.popPush("weather"); this.advanceWeatherCycle(); + profilerFiller.pop(); } int i = this.getGameRules().getInt(GameRules.RULE_PLAYERS_SLEEPING_PERCENTAGE); @@ -358,7 +353,7 @@ public class ServerLevel extends Level implements WorldGenLevel { this.tickTime(); } - profilerFiller.popPush("tickPending"); + profilerFiller.push("tickPending"); if (!this.isDebug() && bl) { long l = this.getGameTime(); profilerFiller.push("blockTicks"); @@ -397,13 +392,11 @@ public class ServerLevel extends Level implements WorldGenLevel { this.entityTickList.forEach(entity -> { if (!entity.isRemoved()) { - if (this.shouldDiscardEntity(entity)) { - entity.discard(); - } else if (!tickRateManager.isEntityFrozen(entity)) { + if (!tickRateManager.isEntityFrozen(entity)) { profilerFiller.push("checkDespawn"); entity.checkDespawn(); profilerFiller.pop(); - if (this.chunkSource.chunkMap.getDistanceManager().inEntityTickingRange(entity.chunkPosition().toLong())) { + if (entity instanceof ServerPlayer || this.chunkSource.chunkMap.getDistanceManager().inEntityTickingRange(entity.chunkPosition().toLong())) { Entity entity2 = entity.getVehicle(); if (entity2 != null) { if (!entity2.isRemoved() && entity2.hasPassenger(entity)) { @@ -438,8 +431,10 @@ public class ServerLevel extends Level implements WorldGenLevel { if (this.tickTime) { long l = this.levelData.getGameTime() + 1L; this.serverLevelData.setGameTime(l); + Profiler.get().push("scheduledFunctions"); this.serverLevelData.getScheduledEvents().tick(this.server, l); - if (this.levelData.getGameRules().getBoolean(GameRules.RULE_DAYLIGHT)) { + Profiler.get().pop(); + if (this.serverLevelData.getGameRules().getBoolean(GameRules.RULE_DAYLIGHT)) { this.setDayTime(this.levelData.getDayTime() + 1L); } } @@ -455,12 +450,6 @@ public class ServerLevel extends Level implements WorldGenLevel { } } - private boolean shouldDiscardEntity(Entity entity) { - return this.server.isSpawningAnimals() || !(entity instanceof Animal) && !(entity instanceof WaterAnimal) - ? !this.server.areNpcsEnabled() && entity instanceof Npc - : true; - } - private void wakeUpAllPlayers() { this.sleepStatus.removeAllSleepers(); ((List)this.players.stream().filter(LivingEntity::isSleeping).collect(Collectors.toList())) @@ -472,7 +461,7 @@ public class ServerLevel extends Level implements WorldGenLevel { boolean bl = this.isRaining(); int i = chunkPos.getMinBlockX(); int j = chunkPos.getMinBlockZ(); - ProfilerFiller profilerFiller = this.getProfiler(); + ProfilerFiller profilerFiller = Profiler.get(); profilerFiller.push("thunder"); if (bl && this.isThundering() && this.random.nextInt(100000) == 0) { BlockPos blockPos = this.findLightningTargetAround(this.getBlockRandomPos(i, 0, j, 15)); @@ -482,7 +471,7 @@ public class ServerLevel extends Level implements WorldGenLevel { && this.random.nextDouble() < difficultyInstance.getEffectiveDifficulty() * 0.01 && !this.getBlockState(blockPos.below()).is(Blocks.LIGHTNING_ROD); if (bl2) { - SkeletonHorse skeletonHorse = EntityType.SKELETON_HORSE.create(this); + SkeletonHorse skeletonHorse = EntityType.SKELETON_HORSE.create(this, EntitySpawnReason.EVENT); if (skeletonHorse != null) { skeletonHorse.setTrap(true); skeletonHorse.setAge(0); @@ -491,7 +480,7 @@ public class ServerLevel extends Level implements WorldGenLevel { } } - LightningBolt lightningBolt = EntityType.LIGHTNING_BOLT.create(this); + LightningBolt lightningBolt = EntityType.LIGHTNING_BOLT.create(this, EntitySpawnReason.EVENT); if (lightningBolt != null) { lightningBolt.moveTo(Vec3.atBottomCenterOf(blockPos)); lightningBolt.setVisualOnly(bl2); @@ -565,7 +554,7 @@ public class ServerLevel extends Level implements WorldGenLevel { } } - Biome.Precipitation precipitation = biome.getPrecipitationAt(blockPos3); + Biome.Precipitation precipitation = biome.getPrecipitationAt(blockPos3, this.getSeaLevel()); if (precipitation != Biome.Precipitation.NONE) { BlockState blockState3 = this.getBlockState(blockPos3); blockState3.getBlock().handlePrecipitation(blockState3, this, blockPos3, precipitation); @@ -591,14 +580,14 @@ public class ServerLevel extends Level implements WorldGenLevel { if (optional.isPresent()) { return (BlockPos)optional.get(); } else { - AABB aABB = AABB.encapsulatingFullBlocks(blockPos, new BlockPos(blockPos.atY(this.getMaxBuildHeight()))).inflate(3.0); + AABB aABB = AABB.encapsulatingFullBlocks(blockPos, blockPos.atY(this.getMaxY() + 1)).inflate(3.0); List list = this.getEntitiesOfClass( LivingEntity.class, aABB, livingEntity -> livingEntity != null && livingEntity.isAlive() && this.canSeeSky(livingEntity.blockPosition()) ); if (!list.isEmpty()) { return ((LivingEntity)list.get(this.random.nextInt(list.size()))).blockPosition(); } else { - if (blockPos.getY() == this.getMinBuildHeight() - 1) { + if (blockPos.getY() == this.getMinY() - 1) { blockPos = blockPos.above(2); } @@ -746,9 +735,10 @@ public class ServerLevel extends Level implements WorldGenLevel { } private void tickFluid(BlockPos pos, Fluid fluid) { - FluidState fluidState = this.getFluidState(pos); + BlockState blockState = this.getBlockState(pos); + FluidState fluidState = blockState.getFluidState(); if (fluidState.is(fluid)) { - fluidState.tick(this, pos); + fluidState.tick(this, pos, blockState); } } @@ -761,12 +751,12 @@ public class ServerLevel extends Level implements WorldGenLevel { public void tickNonPassenger(Entity entity) { entity.setOldPosAndRot(); - ProfilerFiller profilerFiller = this.getProfiler(); + ProfilerFiller profilerFiller = Profiler.get(); entity.tickCount++; - this.getProfiler().push((Supplier)(() -> BuiltInRegistries.ENTITY_TYPE.getKey(entity.getType()).toString())); + profilerFiller.push((Supplier)(() -> BuiltInRegistries.ENTITY_TYPE.getKey(entity.getType()).toString())); profilerFiller.incrementCounter("tickNonPassenger"); entity.tick(); - this.getProfiler().pop(); + profilerFiller.pop(); for (Entity entity2 : entity.getPassengers()) { this.tickPassenger(entity, entity2); @@ -779,7 +769,7 @@ public class ServerLevel extends Level implements WorldGenLevel { } else if (passengerEntity instanceof Player || this.entityTickList.contains(passengerEntity)) { passengerEntity.setOldPosAndRot(); passengerEntity.tickCount++; - ProfilerFiller profilerFiller = this.getProfiler(); + ProfilerFiller profilerFiller = Profiler.get(); profilerFiller.push((Supplier)(() -> BuiltInRegistries.ENTITY_TYPE.getKey(passengerEntity.getType()).toString())); profilerFiller.incrementCounter("tickPassenger"); passengerEntity.rideTick(); @@ -803,7 +793,7 @@ public class ServerLevel extends Level implements WorldGenLevel { progress.progressStartNoAbort(Component.translatable("menu.savingLevel")); } - this.saveLevelData(); + this.saveLevelData(flush); if (progress != null) { progress.progressStage(Component.translatable("menu.savingChunks")); } @@ -817,15 +807,17 @@ public class ServerLevel extends Level implements WorldGenLevel { } } - /** - * Saves the chunks to disk. - */ - private void saveLevelData() { + private void saveLevelData(boolean bl) { if (this.dragonFight != null) { this.server.getWorldData().setEndDragonFightData(this.dragonFight.saveData()); } - this.getChunkSource().getDataStorage().save(); + DimensionDataStorage dimensionDataStorage = this.getChunkSource().getDataStorage(); + if (bl) { + dimensionDataStorage.saveAndJoin(); + } else { + dimensionDataStorage.scheduleSave(); + } } public List getEntities(EntityTypeTest typeTest, Predicate predicate) { @@ -843,11 +835,11 @@ public class ServerLevel extends Level implements WorldGenLevel { if (predicate.test(entity)) { output.add(entity); if (output.size() >= maxResults) { - return AbortableIterationConsumer.Continuation.ABORT; + return Continuation.ABORT; } } - return AbortableIterationConsumer.Continuation.CONTINUE; + return Continuation.CONTINUE; }); } @@ -993,7 +985,22 @@ public class ServerLevel extends Level implements WorldGenLevel { @Override public void globalLevelEvent(int id, BlockPos pos, int data) { if (this.getGameRules().getBoolean(GameRules.RULE_GLOBAL_SOUND_EVENTS)) { - this.server.getPlayerList().broadcastAll(new ClientboundLevelEventPacket(id, pos, data, true)); + this.server.getPlayerList().getPlayers().forEach(serverPlayer -> { + Vec3 vec32; + if (serverPlayer.level() == this) { + Vec3 vec3 = Vec3.atCenterOf(pos); + if (serverPlayer.distanceToSqr(vec3) < Mth.square(32)) { + vec32 = vec3; + } else { + Vec3 vec33 = vec3.subtract(serverPlayer.position()).normalize(); + vec32 = serverPlayer.position().add(vec33.scale(32.0)); + } + } else { + vec32 = serverPlayer.position(); + } + + serverPlayer.connection.send(new ClientboundLevelEventPacket(id, BlockPos.containing(vec32), data, true)); + }); } else { this.levelEvent(null, id, pos, data); } @@ -1011,7 +1018,7 @@ public class ServerLevel extends Level implements WorldGenLevel { } @Override - public void gameEvent(Holder gameEvent, Vec3 pos, GameEvent.Context context) { + public void gameEvent(Holder gameEvent, Vec3 pos, Context context) { this.gameEventDispatcher.post(gameEvent, pos, context); } @@ -1050,22 +1057,27 @@ public class ServerLevel extends Level implements WorldGenLevel { @Override public void updateNeighborsAt(BlockPos pos, Block block) { - this.neighborUpdater.updateNeighborsAtExceptFromFacing(pos, block, null); + this.updateNeighborsAt(pos, block, ExperimentalRedstoneUtils.initialOrientation(this, null, null)); } @Override - public void updateNeighborsAtExceptFromFacing(BlockPos pos, Block blockType, Direction skipSide) { - this.neighborUpdater.updateNeighborsAtExceptFromFacing(pos, blockType, skipSide); + public void updateNeighborsAt(BlockPos blockPos, Block block, @Nullable Orientation orientation) { + this.neighborUpdater.updateNeighborsAtExceptFromFacing(blockPos, block, null, orientation); } @Override - public void neighborChanged(BlockPos pos, Block block, BlockPos fromPos) { - this.neighborUpdater.neighborChanged(pos, block, fromPos); + public void updateNeighborsAtExceptFromFacing(BlockPos blockPos, Block block, Direction direction, @Nullable Orientation orientation) { + this.neighborUpdater.updateNeighborsAtExceptFromFacing(blockPos, block, direction, orientation); } @Override - public void neighborChanged(BlockState state, BlockPos pos, Block block, BlockPos fromPos, boolean isMoving) { - this.neighborUpdater.neighborChanged(state, pos, block, fromPos, isMoving); + public void neighborChanged(BlockPos blockPos, Block block, @Nullable Orientation orientation) { + this.neighborUpdater.neighborChanged(blockPos, block, orientation); + } + + @Override + public void neighborChanged(BlockState blockState, BlockPos blockPos, Block block, @Nullable Orientation orientation, boolean bl) { + this.neighborUpdater.neighborChanged(blockState, blockPos, block, orientation, bl); } @Override @@ -1086,48 +1098,44 @@ public class ServerLevel extends Level implements WorldGenLevel { } @Override - public Explosion explode( - @Nullable Entity source, + public void explode( + @Nullable Entity entity, @Nullable DamageSource damageSource, - @Nullable ExplosionDamageCalculator damageCalculator, - double x, - double y, - double z, - float radius, - boolean fire, + @Nullable ExplosionDamageCalculator explosionDamageCalculator, + double d, + double e, + double f, + float g, + boolean bl, Level.ExplosionInteraction explosionInteraction, - ParticleOptions smallExplosionParticles, - ParticleOptions largeExplosionParticles, - Holder explosionSound + ParticleOptions particleOptions, + ParticleOptions particleOptions2, + Holder holder ) { - Explosion explosion = this.explode( - source, damageSource, damageCalculator, x, y, z, radius, fire, explosionInteraction, false, smallExplosionParticles, largeExplosionParticles, explosionSound - ); - if (!explosion.interactsWithBlocks()) { - explosion.clearToBlow(); - } + Explosion.BlockInteraction blockInteraction = switch (explosionInteraction) { + case NONE -> Explosion.BlockInteraction.KEEP; + case BLOCK -> this.getDestroyType(GameRules.RULE_BLOCK_EXPLOSION_DROP_DECAY); + case MOB -> this.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) + ? this.getDestroyType(GameRules.RULE_MOB_EXPLOSION_DROP_DECAY) + : Explosion.BlockInteraction.KEEP; + case TNT -> this.getDestroyType(GameRules.RULE_TNT_EXPLOSION_DROP_DECAY); + case TRIGGER -> Explosion.BlockInteraction.TRIGGER_BLOCK; + }; + Vec3 vec3 = new Vec3(d, e, f); + ServerExplosion serverExplosion = new ServerExplosion(this, entity, damageSource, explosionDamageCalculator, vec3, g, bl, blockInteraction); + serverExplosion.explode(); + ParticleOptions particleOptions3 = serverExplosion.isSmall() ? particleOptions : particleOptions2; for (ServerPlayer serverPlayer : this.players) { - if (serverPlayer.distanceToSqr(x, y, z) < 4096.0) { - serverPlayer.connection - .send( - new ClientboundExplodePacket( - x, - y, - z, - radius, - explosion.getToBlow(), - (Vec3)explosion.getHitPlayers().get(serverPlayer), - explosion.getBlockInteraction(), - explosion.getSmallExplosionParticles(), - explosion.getLargeExplosionParticles(), - explosion.getExplosionSound() - ) - ); + if (serverPlayer.distanceToSqr(vec3) < 4096.0) { + Optional optional = Optional.ofNullable((Vec3)serverExplosion.getHitPlayers().get(serverPlayer)); + serverPlayer.connection.send(new ClientboundExplodePacket(vec3, optional, particleOptions3, holder)); } } + } - return explosion; + private Explosion.BlockInteraction getDestroyType(GameRules.Key key) { + return this.getGameRules().getBoolean(key) ? Explosion.BlockInteraction.DESTROY_WITH_DECAY : Explosion.BlockInteraction.DESTROY; } @Override @@ -1263,7 +1271,7 @@ public class ServerLevel extends Level implements WorldGenLevel { if (!this.server.getWorldData().worldGenOptions().generateStructures()) { return null; } else { - Optional> optional = this.registryAccess().registryOrThrow(Registries.STRUCTURE).getTag(structureTag); + Optional> optional = this.registryAccess().lookupOrThrow(Registries.STRUCTURE).get(structureTag); if (optional.isEmpty()) { return null; } else { @@ -1285,8 +1293,7 @@ public class ServerLevel extends Level implements WorldGenLevel { .findClosestBiome3d(pos, radius, horizontalStep, verticalStep, biomePredicate, this.getChunkSource().randomState().sampler(), this); } - @Override - public RecipeManager getRecipeManager() { + public RecipeManager recipeAccess() { return this.server.getRecipeManager(); } @@ -1754,6 +1761,11 @@ public class ServerLevel extends Level implements WorldGenLevel { return this.server.potionBrewing(); } + @Override + public FuelValues fuelValues() { + return this.server.fuelValues(); + } + public RandomSource getRandomSequence(ResourceLocation location) { return this.randomSequences.get(location); } @@ -1762,6 +1774,10 @@ public class ServerLevel extends Level implements WorldGenLevel { return this.randomSequences; } + public GameRules getGameRules() { + return this.serverLevelData.getGameRules(); + } + @Override public CrashReportCategory fillReportDetails(CrashReport report) { CrashReportCategory crashReportCategory = super.fillReportDetails(report); @@ -1769,6 +1785,11 @@ public class ServerLevel extends Level implements WorldGenLevel { return crashReportCategory; } + @Override + public int getSeaLevel() { + return this.chunkSource.getGenerator().getSeaLevel(); + } + final class EntityCallbacks implements LevelCallback { public void onCreated(Entity entity) { } diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java index 1b78cca7..48d98dce 100644 --- a/net/minecraft/server/level/ServerPlayer.java +++ b/net/minecraft/server/level/ServerPlayer.java @@ -7,27 +7,34 @@ import com.mojang.logging.LogUtils; import com.mojang.serialization.Dynamic; import java.net.InetSocketAddress; import java.util.Collection; +import java.util.HashSet; import java.util.List; import java.util.Optional; import java.util.OptionalInt; import java.util.Set; +import java.util.UUID; import java.util.stream.Collectors; import net.minecraft.ChatFormatting; import net.minecraft.CrashReport; import net.minecraft.CrashReportCategory; +import net.minecraft.CrashReportDetail; import net.minecraft.ReportedException; import net.minecraft.Util; import net.minecraft.advancements.CriteriaTriggers; -import net.minecraft.commands.arguments.EntityAnchorArgument; +import net.minecraft.commands.CommandSource; +import net.minecraft.commands.CommandSourceStack; +import net.minecraft.commands.arguments.EntityAnchorArgument.Anchor; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.GlobalPos; import net.minecraft.core.NonNullList; import net.minecraft.core.SectionPos; +import net.minecraft.core.component.DataComponents; import net.minecraft.core.particles.BlockParticleOption; import net.minecraft.core.particles.ParticleTypes; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.ListTag; import net.minecraft.nbt.NbtOps; import net.minecraft.nbt.Tag; import net.minecraft.network.PacketSendListener; @@ -59,10 +66,12 @@ import net.minecraft.network.protocol.game.ClientboundPlayerCombatEndPacket; import net.minecraft.network.protocol.game.ClientboundPlayerCombatEnterPacket; import net.minecraft.network.protocol.game.ClientboundPlayerCombatKillPacket; import net.minecraft.network.protocol.game.ClientboundPlayerLookAtPacket; +import net.minecraft.network.protocol.game.ClientboundPlayerRotationPacket; import net.minecraft.network.protocol.game.ClientboundRemoveMobEffectPacket; import net.minecraft.network.protocol.game.ClientboundRespawnPacket; import net.minecraft.network.protocol.game.ClientboundServerDataPacket; import net.minecraft.network.protocol.game.ClientboundSetCameraPacket; +import net.minecraft.network.protocol.game.ClientboundSetCursorItemPacket; import net.minecraft.network.protocol.game.ClientboundSetExperiencePacket; import net.minecraft.network.protocol.game.ClientboundSetHealthPacket; import net.minecraft.network.protocol.game.ClientboundSoundPacket; @@ -70,6 +79,7 @@ import net.minecraft.network.protocol.game.ClientboundSystemChatPacket; import net.minecraft.network.protocol.game.ClientboundUpdateMobEffectPacket; import net.minecraft.network.protocol.game.CommonPlayerSpawnInfo; import net.minecraft.network.protocol.status.ServerStatus; +import net.minecraft.network.protocol.status.ServerStatus.Favicon; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.MinecraftServer; @@ -88,14 +98,19 @@ import net.minecraft.tags.FluidTags; import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; import net.minecraft.util.Unit; +import net.minecraft.util.profiling.Profiler; +import net.minecraft.util.profiling.ProfilerFiller; import net.minecraft.world.Container; +import net.minecraft.world.Difficulty; import net.minecraft.world.InteractionHand; import net.minecraft.world.MenuProvider; import net.minecraft.world.damagesource.DamageSource; +import net.minecraft.world.damagesource.DamageTypes; import net.minecraft.world.effect.MobEffectInstance; import net.minecraft.world.effect.MobEffects; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntitySelector; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.HumanoidArm; @@ -103,7 +118,8 @@ import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.Mob; import net.minecraft.world.entity.NeutralMob; import net.minecraft.world.entity.Pose; -import net.minecraft.world.entity.RelativeMovement; +import net.minecraft.world.entity.PositionMoveRotation; +import net.minecraft.world.entity.Relative; import net.minecraft.world.entity.ai.attributes.AttributeInstance; import net.minecraft.world.entity.ai.attributes.AttributeModifier; import net.minecraft.world.entity.ai.attributes.Attributes; @@ -114,24 +130,26 @@ import net.minecraft.world.entity.monster.Monster; import net.minecraft.world.entity.monster.Strider; import net.minecraft.world.entity.monster.warden.WardenSpawnTracker; import net.minecraft.world.entity.player.ChatVisiblity; +import net.minecraft.world.entity.player.Input; import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.projectile.AbstractArrow; +import net.minecraft.world.entity.projectile.ThrownEnderpearl; +import net.minecraft.world.entity.vehicle.AbstractBoat; import net.minecraft.world.entity.vehicle.AbstractMinecart; -import net.minecraft.world.entity.vehicle.Boat; import net.minecraft.world.inventory.AbstractContainerMenu; import net.minecraft.world.inventory.ContainerListener; import net.minecraft.world.inventory.ContainerSynchronizer; import net.minecraft.world.inventory.HorseInventoryMenu; import net.minecraft.world.inventory.ResultSlot; import net.minecraft.world.inventory.Slot; -import net.minecraft.world.item.ComplexItem; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemCooldowns; import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.Items; +import net.minecraft.world.item.MapItem; import net.minecraft.world.item.ServerItemCooldowns; import net.minecraft.world.item.WrittenBookItem; +import net.minecraft.world.item.crafting.Recipe; import net.minecraft.world.item.crafting.RecipeHolder; import net.minecraft.world.item.enchantment.EnchantmentHelper; import net.minecraft.world.item.trading.MerchantOffers; @@ -149,7 +167,9 @@ import net.minecraft.world.level.block.entity.CommandBlockEntity; import net.minecraft.world.level.block.entity.SignBlockEntity; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.gameevent.GameEvent; -import net.minecraft.world.level.portal.DimensionTransition; +import net.minecraft.world.level.portal.TeleportTransition; +import net.minecraft.world.level.saveddata.maps.MapId; +import net.minecraft.world.level.saveddata.maps.MapItemSavedData; import net.minecraft.world.level.storage.LevelData; import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.Vec3; @@ -157,6 +177,7 @@ import net.minecraft.world.scores.PlayerTeam; import net.minecraft.world.scores.ScoreAccess; import net.minecraft.world.scores.ScoreHolder; import net.minecraft.world.scores.Team; +import net.minecraft.world.scores.Team.Visibility; import net.minecraft.world.scores.criteria.ObjectiveCriteria; import org.jetbrains.annotations.Nullable; import org.slf4j.Logger; @@ -166,7 +187,11 @@ public class ServerPlayer extends Player { private static final int NEUTRAL_MOB_DEATH_NOTIFICATION_RADII_XZ = 32; private static final int NEUTRAL_MOB_DEATH_NOTIFICATION_RADII_Y = 10; private static final int FLY_STAT_RECORDING_SPEED = 25; - public static final double INTERACTION_DISTANCE_VERIFICATION_BUFFER = 1.0; + public static final double BLOCK_INTERACTION_DISTANCE_VERIFICATION_BUFFER = 1.0; + public static final double ENTITY_INTERACTION_DISTANCE_VERIFICATION_BUFFER = 3.0; + public static final int ENDER_PEARL_TICKET_RADIUS = 2; + public static final String ENDER_PEARLS_TAG = "ender_pearls"; + public static final String ENDER_PEARL_DIMENSION_TAG = "ender_pearl_dimension"; private static final AttributeModifier CREATIVE_BLOCK_INTERACTION_RANGE_MODIFIER = new AttributeModifier( ResourceLocation.withDefaultNamespace("creative_mode_block_range"), 0.5, AttributeModifier.Operation.ADD_VALUE ); @@ -193,6 +218,7 @@ public class ServerPlayer extends Player { private int lastSentExp = -99999999; private int spawnInvulnerableTime = 60; private ChatVisiblity chatVisibility = ChatVisiblity.FULL; + private ParticleStatus particleStatus = ParticleStatus.ALL; private boolean canChatColor = true; private long lastActionTime = Util.getMillis(); /** @@ -202,7 +228,7 @@ public class ServerPlayer extends Player { private Entity camera; private boolean isChangingDimension; public boolean seenCredits; - private final ServerRecipeBook recipeBook = new ServerRecipeBook(); + private final ServerRecipeBook recipeBook; @Nullable private Vec3 levitationStartPos; private int levitationStartTime; @@ -233,6 +259,8 @@ public class ServerPlayer extends Player { @Nullable private BlockPos raidOmenPosition; private Vec3 lastKnownClientMovement = Vec3.ZERO; + private Input lastClientInput = Input.EMPTY; + private final Set enderPearls = new HashSet(); private final ContainerSynchronizer containerSynchronizer = new ContainerSynchronizer() { @Override public void sendInitialData(AbstractContainerMenu container, NonNullList items, ItemStack carriedItem, int[] initialData) { @@ -250,7 +278,7 @@ public class ServerPlayer extends Player { @Override public void sendCarriedChange(AbstractContainerMenu containerMenu, ItemStack stack) { - ServerPlayer.this.connection.send(new ClientboundContainerSetSlotPacket(-1, containerMenu.incrementStateId(), -1, stack)); + ServerPlayer.this.connection.send(new ClientboundSetCursorItemPacket(stack.copy())); } @Override @@ -281,6 +309,27 @@ public class ServerPlayer extends Player { private RemoteChatSession chatSession; @Nullable public final Object object; + private final CommandSource commandSource = new CommandSource() { + @Override + public boolean acceptsSuccess() { + return ServerPlayer.this.serverLevel().getGameRules().getBoolean(GameRules.RULE_SENDCOMMANDFEEDBACK); + } + + @Override + public boolean acceptsFailure() { + return true; + } + + @Override + public boolean shouldInformAdmins() { + return true; + } + + @Override + public void sendSystemMessage(Component component) { + ServerPlayer.this.sendSystemMessage(component); + } + }; private int containerCounter; public boolean wonGame; @@ -288,6 +337,7 @@ public class ServerPlayer extends Player { super(level, level.getSharedSpawnPos(), level.getSharedSpawnAngle(), gameProfile); this.textFilter = server.createTextFilterForPlayer(this); this.gameMode = server.createGameModeForPlayer(this); + this.recipeBook = new ServerRecipeBook((resourceKey, consumer) -> server.getRecipeManager().listDisplaysForRecipe(resourceKey, consumer)); this.server = server; this.stats = server.getPlayerList().getPlayerStats(this); this.advancements = server.getPlayerList().getPlayerAdvancements(this); @@ -321,26 +371,45 @@ public class ServerPlayer extends Player { int q = (o + n * p) % k; int r = q % (i * 2 + 1); int s = q / (i * 2 + 1); - blockPos = PlayerRespawnLogic.getOverworldRespawnPos(level, pos.getX() + r - i, pos.getZ() + s - i); - if (blockPos != null && level.noCollision(this, aABB.move(blockPos.getBottomCenter()))) { - return blockPos; + int t = pos.getX() + r - i; + int u = pos.getZ() + s - i; + + try { + blockPos = PlayerRespawnLogic.getOverworldRespawnPos(level, t, u); + if (blockPos != null && this.noCollisionNoLiquid(level, aABB.move(blockPos.getBottomCenter()))) { + return blockPos; + } + } catch (Exception var25) { + int v = p; + int w = i; + CrashReport crashReport = CrashReport.forThrowable(var25, "Searching for spawn"); + CrashReportCategory crashReportCategory = crashReport.addCategory("Spawn Lookup"); + crashReportCategory.setDetail("Origin", pos::toString); + crashReportCategory.setDetail("Radius", (CrashReportDetail)(() -> Integer.toString(w))); + crashReportCategory.setDetail("Candidate", (CrashReportDetail)(() -> "[" + t + "," + u + "]")); + crashReportCategory.setDetail("Progress", (CrashReportDetail)(() -> v + " out of " + k)); + throw new ReportedException(crashReport); } } blockPos = pos; } - while (!level.noCollision(this, aABB.move(blockPos.getBottomCenter())) && blockPos.getY() < level.getMaxBuildHeight() - 1) { + while (!this.noCollisionNoLiquid(level, aABB.move(blockPos.getBottomCenter())) && blockPos.getY() < level.getMaxY()) { blockPos = blockPos.above(); } - while (level.noCollision(this, aABB.move(blockPos.below().getBottomCenter())) && blockPos.getY() > level.getMinBuildHeight() + 1) { + while (this.noCollisionNoLiquid(level, aABB.move(blockPos.below().getBottomCenter())) && blockPos.getY() > level.getMinY() + 1) { blockPos = blockPos.below(); } return blockPos; } + private boolean noCollisionNoLiquid(ServerLevel serverLevel, AABB aABB) { + return serverLevel.noCollision(this, aABB, true); + } + private int getCoprime(int spawnArea) { return spawnArea <= 16 ? spawnArea - 1 : 17; } @@ -362,7 +431,7 @@ public class ServerPlayer extends Player { this.seenCredits = compound.getBoolean("seenCredits"); if (compound.contains("recipeBook", 10)) { - this.recipeBook.fromNbt(compound.getCompound("recipeBook"), this.server.getRecipeManager()); + this.recipeBook.fromNbt(compound.getCompound("recipeBook"), resourceKey -> this.server.getRecipeManager().byKey(resourceKey).isPresent()); } if (this.isSleeping()) { @@ -405,17 +474,7 @@ public class ServerPlayer extends Player { compound.put("enteredNetherPosition", compoundTag); } - Entity entity = this.getRootVehicle(); - Entity entity2 = this.getVehicle(); - if (entity2 != null && entity != this && entity.hasExactlyOnePlayerPassenger()) { - CompoundTag compoundTag2 = new CompoundTag(); - CompoundTag compoundTag3 = new CompoundTag(); - entity.save(compoundTag3); - compoundTag2.putUUID("Attach", entity2.getUUID()); - compoundTag2.put("Entity", compoundTag3); - compound.put("RootVehicle", compoundTag2); - } - + this.saveParentVehicle(compound); compound.put("recipeBook", this.recipeBook.toNbt()); compound.putString("Dimension", this.level().dimension().location().toString()); if (this.respawnPosition != null) { @@ -434,6 +493,116 @@ public class ServerPlayer extends Player { if (this.raidOmenPosition != null) { BlockPos.CODEC.encodeStart(NbtOps.INSTANCE, this.raidOmenPosition).resultOrPartial(LOGGER::error).ifPresent(tag -> compound.put("raid_omen_position", tag)); } + + this.saveEnderPearls(compound); + } + + private void saveParentVehicle(CompoundTag compoundTag) { + Entity entity = this.getRootVehicle(); + Entity entity2 = this.getVehicle(); + if (entity2 != null && entity != this && entity.hasExactlyOnePlayerPassenger()) { + CompoundTag compoundTag2 = new CompoundTag(); + CompoundTag compoundTag3 = new CompoundTag(); + entity.save(compoundTag3); + compoundTag2.putUUID("Attach", entity2.getUUID()); + compoundTag2.put("Entity", compoundTag3); + compoundTag.put("RootVehicle", compoundTag2); + } + } + + public void loadAndSpawnParentVehicle(Optional optional) { + if (optional.isPresent() && ((CompoundTag)optional.get()).contains("RootVehicle", 10) && this.level() instanceof ServerLevel serverLevel) { + CompoundTag compoundTag = ((CompoundTag)optional.get()).getCompound("RootVehicle"); + Entity entity = EntityType.loadEntityRecursive( + compoundTag.getCompound("Entity"), serverLevel, EntitySpawnReason.LOAD, entityx -> !serverLevel.addWithUUID(entityx) ? null : entityx + ); + if (entity == null) { + return; + } + + UUID uUID; + if (compoundTag.hasUUID("Attach")) { + uUID = compoundTag.getUUID("Attach"); + } else { + uUID = null; + } + + if (entity.getUUID().equals(uUID)) { + this.startRiding(entity, true); + } else { + for (Entity entity2 : entity.getIndirectPassengers()) { + if (entity2.getUUID().equals(uUID)) { + this.startRiding(entity2, true); + break; + } + } + } + + if (!this.isPassenger()) { + LOGGER.warn("Couldn't reattach entity to player"); + entity.discard(); + + for (Entity entity2x : entity.getIndirectPassengers()) { + entity2x.discard(); + } + } + } + } + + private void saveEnderPearls(CompoundTag compoundTag) { + if (!this.enderPearls.isEmpty()) { + ListTag listTag = new ListTag(); + + for (ThrownEnderpearl thrownEnderpearl : this.enderPearls) { + if (thrownEnderpearl.isRemoved()) { + LOGGER.warn("Trying to save removed ender pearl, skipping"); + } else { + CompoundTag compoundTag2 = new CompoundTag(); + thrownEnderpearl.save(compoundTag2); + ResourceLocation.CODEC + .encodeStart(NbtOps.INSTANCE, thrownEnderpearl.level().dimension().location()) + .resultOrPartial(LOGGER::error) + .ifPresent(tag -> compoundTag2.put("ender_pearl_dimension", tag)); + listTag.add(compoundTag2); + } + } + + compoundTag.put("ender_pearls", listTag); + } + } + + public void loadAndSpawnEnderpearls(Optional optional) { + if (optional.isPresent() + && ((CompoundTag)optional.get()).contains("ender_pearls", 9) + && ((CompoundTag)optional.get()).get("ender_pearls") instanceof ListTag listTag) { + listTag.forEach( + tag -> { + if (tag instanceof CompoundTag compoundTag && compoundTag.contains("ender_pearl_dimension")) { + Optional> optionalx = Level.RESOURCE_KEY_CODEC + .parse(NbtOps.INSTANCE, compoundTag.get("ender_pearl_dimension")) + .resultOrPartial(LOGGER::error); + if (optionalx.isEmpty()) { + LOGGER.warn("No dimension defined for ender pearl, skipping"); + return; + } + + ServerLevel serverLevel = this.level().getServer().getLevel((ResourceKey)optionalx.get()); + if (serverLevel != null) { + Entity entity = EntityType.loadEntityRecursive( + compoundTag, serverLevel, EntitySpawnReason.LOAD, entityx -> !serverLevel.addWithUUID(entityx) ? null : entityx + ); + if (entity != null) { + placeEnderPearlTicket(serverLevel, entity.chunkPosition()); + } else { + LOGGER.warn("Failed to spawn player ender pearl in level ({}), skipping", optionalx.get()); + } + } else { + LOGGER.warn("Trying to load ender pearl without level ({}) being loaded, skipping", optionalx.get()); + } + } + } + ); + } } public void setExperiencePoints(int experiencePoints) { @@ -558,11 +727,8 @@ public class ServerPlayer extends Player { for (int i = 0; i < this.getInventory().getContainerSize(); i++) { ItemStack itemStack = this.getInventory().getItem(i); - if (itemStack.getItem().isComplex()) { - Packet packet = ((ComplexItem)itemStack.getItem()).getUpdatePacket(itemStack, this.level(), this); - if (packet != null) { - this.connection.send(packet); - } + if (!itemStack.isEmpty()) { + this.synchronizeSpecialItemUpdates(itemStack); } } @@ -621,6 +787,37 @@ public class ServerPlayer extends Player { } } + private void synchronizeSpecialItemUpdates(ItemStack itemStack) { + MapId mapId = itemStack.get(DataComponents.MAP_ID); + MapItemSavedData mapItemSavedData = MapItem.getSavedData(mapId, this.level()); + if (mapItemSavedData != null) { + Packet packet = mapItemSavedData.getUpdatePacket(mapId, this); + if (packet != null) { + this.connection.send(packet); + } + } + } + + @Override + protected void tickRegeneration() { + if (this.level().getDifficulty() == Difficulty.PEACEFUL && this.serverLevel().getGameRules().getBoolean(GameRules.RULE_NATURAL_REGENERATION)) { + if (this.tickCount % 20 == 0) { + if (this.getHealth() < this.getMaxHealth()) { + this.heal(1.0F); + } + + float f = this.foodData.getSaturationLevel(); + if (f < 20.0F) { + this.foodData.setSaturation(f + 1.0F); + } + } + + if (this.tickCount % 10 == 0 && this.foodData.needsFood()) { + this.foodData.setFoodLevel(this.foodData.getFoodLevel() + 1); + } + } + } + @Override public void resetFallDistance() { if (this.getHealth() > 0.0F && this.startingToFallPosition != null) { @@ -661,7 +858,7 @@ public class ServerPlayer extends Player { @Override public void die(DamageSource damageSource) { this.gameEvent(GameEvent.ENTITY_DIE); - boolean bl = this.level().getGameRules().getBoolean(GameRules.RULE_SHOWDEATHMESSAGES); + boolean bl = this.serverLevel().getGameRules().getBoolean(GameRules.RULE_SHOWDEATHMESSAGES); if (bl) { Component component = this.getCombatTracker().getDeathMessage(); this.connection @@ -679,11 +876,11 @@ public class ServerPlayer extends Player { ) ); Team team = this.getTeam(); - if (team == null || team.getDeathMessageVisibility() == Team.Visibility.ALWAYS) { + if (team == null || team.getDeathMessageVisibility() == Visibility.ALWAYS) { this.server.getPlayerList().broadcastSystemMessage(component, false); - } else if (team.getDeathMessageVisibility() == Team.Visibility.HIDE_FOR_OTHER_TEAMS) { + } else if (team.getDeathMessageVisibility() == Visibility.HIDE_FOR_OTHER_TEAMS) { this.server.getPlayerList().broadcastSystemToTeam(this, component); - } else if (team.getDeathMessageVisibility() == Team.Visibility.HIDE_FOR_OWN_TEAM) { + } else if (team.getDeathMessageVisibility() == Visibility.HIDE_FOR_OWN_TEAM) { this.server.getPlayerList().broadcastSystemToAllExceptTeam(this, component); } } else { @@ -691,7 +888,7 @@ public class ServerPlayer extends Player { } this.removeEntitiesOnShoulder(); - if (this.level().getGameRules().getBoolean(GameRules.RULE_FORGIVE_DEAD_PLAYERS)) { + if (this.serverLevel().getGameRules().getBoolean(GameRules.RULE_FORGIVE_DEAD_PLAYERS)) { this.tellNeutralMobsThatIDied(); } @@ -724,7 +921,7 @@ public class ServerPlayer extends Player { .getEntitiesOfClass(Mob.class, aABB, EntitySelector.NO_SPECTATORS) .stream() .filter(mob -> mob instanceof NeutralMob) - .forEach(mob -> ((NeutralMob)mob).playerDied(this)); + .forEach(mob -> ((NeutralMob)mob).playerDied(this.serverLevel(), this)); } @Override @@ -757,21 +954,21 @@ public class ServerPlayer extends Player { } @Override - public boolean hurt(DamageSource source, float amount) { - if (this.isInvulnerableTo(source)) { + public boolean hurtServer(ServerLevel serverLevel, DamageSource damageSource, float f) { + if (this.isInvulnerableTo(serverLevel, damageSource)) { return false; } else { - boolean bl = this.server.isDedicatedServer() && this.isPvpAllowed() && source.is(DamageTypeTags.IS_FALL); - if (!bl && this.spawnInvulnerableTime > 0 && !source.is(DamageTypeTags.BYPASSES_INVULNERABILITY)) { + boolean bl = this.server.isDedicatedServer() && this.isPvpAllowed() && damageSource.is(DamageTypeTags.IS_FALL); + if (!bl && this.spawnInvulnerableTime > 0 && !damageSource.is(DamageTypeTags.BYPASSES_INVULNERABILITY)) { return false; } else { - Entity entity = source.getEntity(); + Entity entity = damageSource.getEntity(); if (entity instanceof Player player && !this.canHarmPlayer(player)) { return false; } else { return entity instanceof AbstractArrow abstractArrow && abstractArrow.getOwner() instanceof Player player2 && !this.canHarmPlayer(player2) ? false - : super.hurt(source, amount); + : super.hurtServer(serverLevel, damageSource, f); } } } @@ -789,21 +986,21 @@ public class ServerPlayer extends Player { return this.server.isPvpAllowed(); } - public DimensionTransition findRespawnPositionAndUseSpawnBlock(boolean keepInventory, DimensionTransition.PostDimensionTransition postDimensionTransition) { + public TeleportTransition findRespawnPositionAndUseSpawnBlock(boolean bl, TeleportTransition.PostTeleportTransition postTeleportTransition) { BlockPos blockPos = this.getRespawnPosition(); float f = this.getRespawnAngle(); - boolean bl = this.isRespawnForced(); + boolean bl2 = this.isRespawnForced(); ServerLevel serverLevel = this.server.getLevel(this.getRespawnDimension()); if (serverLevel != null && blockPos != null) { - Optional optional = findRespawnAndUseSpawnBlock(serverLevel, blockPos, f, bl, keepInventory); + Optional optional = findRespawnAndUseSpawnBlock(serverLevel, blockPos, f, bl2, bl); if (optional.isPresent()) { ServerPlayer.RespawnPosAngle respawnPosAngle = (ServerPlayer.RespawnPosAngle)optional.get(); - return new DimensionTransition(serverLevel, respawnPosAngle.position(), Vec3.ZERO, respawnPosAngle.yaw(), 0.0F, postDimensionTransition); + return new TeleportTransition(serverLevel, respawnPosAngle.position(), Vec3.ZERO, respawnPosAngle.yaw(), 0.0F, postTeleportTransition); } else { - return DimensionTransition.missingRespawnBlock(this.server.overworld(), this, postDimensionTransition); + return TeleportTransition.missingRespawnBlock(this.server.overworld(), this, postTeleportTransition); } } else { - return new DimensionTransition(this.server.overworld(), this, postDimensionTransition); + return new TeleportTransition(this.server.overworld(), this, postTeleportTransition); } } @@ -814,7 +1011,7 @@ public class ServerPlayer extends Player { Block block = blockState.getBlock(); if (block instanceof RespawnAnchorBlock && (forced || (Integer)blockState.getValue(RespawnAnchorBlock.CHARGE) > 0) && RespawnAnchorBlock.canSetSpawn(level)) { Optional optional = RespawnAnchorBlock.findStandUpPosition(EntityType.PLAYER, level, pos); - if (!forced && !keepInventory && optional.isPresent()) { + if (!forced && keepInventory && optional.isPresent()) { level.setBlock(pos, blockState.setValue(RespawnAnchorBlock.CHARGE, (Integer)blockState.getValue(RespawnAnchorBlock.CHARGE) - 1), 3); } @@ -843,22 +1040,25 @@ public class ServerPlayer extends Player { } @Nullable - @Override - public Entity changeDimension(DimensionTransition transition) { + public ServerPlayer teleport(TeleportTransition teleportTransition) { if (this.isRemoved()) { return null; } else { - if (transition.missingRespawnBlock()) { + if (teleportTransition.missingRespawnBlock()) { this.connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.NO_RESPAWN_BLOCK_AVAILABLE, 0.0F)); } - ServerLevel serverLevel = transition.newLevel(); + ServerLevel serverLevel = teleportTransition.newLevel(); ServerLevel serverLevel2 = this.serverLevel(); ResourceKey resourceKey = serverLevel2.dimension(); + if (!teleportTransition.asPassenger()) { + this.stopRiding(); + } + if (serverLevel.dimension() == resourceKey) { - this.connection.teleport(transition.pos().x, transition.pos().y, transition.pos().z, transition.yRot(), transition.xRot()); + this.connection.teleport(PositionMoveRotation.of(teleportTransition), teleportTransition.relatives()); this.connection.resetPosition(); - transition.postDimensionTransition().onTransition(this); + teleportTransition.postTeleportTransition().onTransition(this); return this; } else { this.isChangingDimension = true; @@ -869,24 +1069,26 @@ public class ServerPlayer extends Player { playerList.sendPlayerPermissionLevel(this); serverLevel2.removePlayerImmediately(this, Entity.RemovalReason.CHANGED_DIMENSION); this.unsetRemoved(); - serverLevel2.getProfiler().push("moving"); + ProfilerFiller profilerFiller = Profiler.get(); + profilerFiller.push("moving"); if (resourceKey == Level.OVERWORLD && serverLevel.dimension() == Level.NETHER) { this.enteredNetherPosition = this.position(); } - serverLevel2.getProfiler().pop(); - serverLevel2.getProfiler().push("placing"); + profilerFiller.pop(); + profilerFiller.push("placing"); this.setServerLevel(serverLevel); - this.connection.teleport(transition.pos().x, transition.pos().y, transition.pos().z, transition.yRot(), transition.xRot()); + this.connection.teleport(PositionMoveRotation.of(teleportTransition), teleportTransition.relatives()); this.connection.resetPosition(); serverLevel.addDuringTeleport(this); - serverLevel2.getProfiler().pop(); + profilerFiller.pop(); this.triggerDimensionChangeTriggers(serverLevel2); + this.stopUsingItem(); this.connection.send(new ClientboundPlayerAbilitiesPacket(this.getAbilities())); playerList.sendLevelInfo(this, serverLevel); playerList.sendAllPlayerInfo(this); playerList.sendActivePlayerEffects(this); - transition.postDimensionTransition().onTransition(this); + teleportTransition.postTeleportTransition().onTransition(this); this.lastSentExp = -1; this.lastSentHealth = -1.0F; this.lastSentFood = -1; @@ -895,6 +1097,11 @@ public class ServerPlayer extends Player { } } + @Override + public void forceSetRotation(float f, float g) { + this.connection.send(new ClientboundPlayerRotationPacket(f, g)); + } + private void triggerDimensionChangeTriggers(ServerLevel level) { ResourceKey resourceKey = level.dimension(); ResourceKey resourceKey2 = this.level().dimension(); @@ -947,7 +1154,7 @@ public class ServerPlayer extends Player { .getEntitiesOfClass( Monster.class, new AABB(vec3.x() - 8.0, vec3.y() - 5.0, vec3.z() - 8.0, vec3.x() + 8.0, vec3.y() + 5.0, vec3.z() + 8.0), - monster -> monster.isPreventingPlayerRest(this) + monster -> monster.isPreventingPlayerRest(this.serverLevel(), this) ); if (!list.isEmpty()) { return Either.left(Player.BedSleepingProblem.NOT_SAFE); @@ -1007,8 +1214,8 @@ public class ServerPlayer extends Player { } @Override - public boolean isInvulnerableTo(DamageSource source) { - return super.isInvulnerableTo(source) || this.isChangingDimension(); + public boolean isInvulnerableTo(ServerLevel serverLevel, DamageSource damageSource) { + return super.isInvulnerableTo(serverLevel, damageSource) || this.isChangingDimension() && !damageSource.is(DamageTypes.ENDER_PEARL); } @Override @@ -1112,7 +1319,7 @@ public class ServerPlayer extends Player { @Override public void openItemGui(ItemStack stack, InteractionHand hand) { - if (stack.is(Items.WRITTEN_BOOK)) { + if (stack.has(DataComponents.WRITTEN_BOOK_CONTENT)) { if (WrittenBookItem.resolveBookComponents(stack, this.createCommandSourceStack(), this)) { this.containerMenu.broadcastChanges(); } @@ -1139,30 +1346,6 @@ public class ServerPlayer extends Player { this.containerMenu = this.inventoryMenu; } - public void setPlayerInput(float strafe, float forward, boolean jumping, boolean sneaking) { - if (this.isPassenger()) { - if (strafe >= -1.0F && strafe <= 1.0F) { - this.xxa = strafe; - } - - if (forward >= -1.0F && forward <= 1.0F) { - this.zza = forward; - } - - this.jumping = jumping; - this.setShiftKeyDown(sneaking); - } - } - - @Override - public void travel(Vec3 travelVector) { - double d = this.getX(); - double e = this.getY(); - double f = this.getZ(); - super.travel(travelVector); - this.checkMovementStatistics(this.getX() - d, this.getY() - e, this.getZ() - f); - } - @Override public void rideTick() { double d = this.getX(); @@ -1228,7 +1411,7 @@ public class ServerPlayer extends Player { Entity entity = this.getVehicle(); if (entity instanceof AbstractMinecart) { this.awardStat(Stats.MINECART_ONE_CM, i); - } else if (entity instanceof Boat) { + } else if (entity instanceof AbstractBoat) { this.awardStat(Stats.BOAT_ONE_CM, i); } else if (entity instanceof Pig) { this.awardStat(Stats.PIG_ONE_CM, i); @@ -1267,9 +1450,9 @@ public class ServerPlayer extends Player { } @Override - public void awardRecipesByKey(List recipes) { + public void awardRecipesByKey(List>> recipes) { List> list = (List>)recipes.stream() - .flatMap(resourceLocation -> this.server.getRecipeManager().byKey(resourceLocation).stream()) + .flatMap(resourceKey -> this.server.getRecipeManager().byKey(resourceKey).stream()) .collect(Collectors.toList()); this.awardRecipes(list); } @@ -1279,6 +1462,17 @@ public class ServerPlayer extends Player { return this.recipeBook.removeRecipes(recipes, this); } + @Override + public void jumpFromGround() { + super.jumpFromGround(); + this.awardStat(Stats.JUMP); + if (this.isSprinting()) { + this.causeFoodExhaustion(0.2F); + } else { + this.causeFoodExhaustion(0.05F); + } + } + @Override public void giveExperiencePoints(int xpPoints) { super.giveExperiencePoints(xpPoints); @@ -1318,12 +1512,12 @@ public class ServerPlayer extends Player { } @Override - public void lookAt(EntityAnchorArgument.Anchor anchor, Vec3 target) { + public void lookAt(Anchor anchor, Vec3 target) { super.lookAt(anchor, target); this.connection.send(new ClientboundPlayerLookAtPacket(anchor, target.x, target.y, target.z)); } - public void lookAt(EntityAnchorArgument.Anchor fromAnchor, Entity entity, EntityAnchorArgument.Anchor toAnchor) { + public void lookAt(Anchor fromAnchor, Entity entity, Anchor toAnchor) { Vec3 vec3 = toAnchor.apply(entity); super.lookAt(fromAnchor, vec3); this.connection.send(new ClientboundPlayerLookAtPacket(fromAnchor, entity, toAnchor)); @@ -1334,10 +1528,9 @@ public class ServerPlayer extends Player { this.chatSession = that.chatSession; this.gameMode.setGameModeForPlayer(that.gameMode.getGameModeForPlayer(), that.gameMode.getPreviousGameModeForPlayer()); this.onUpdateAbilities(); - this.getAttributes().assignBaseValues(that.getAttributes()); - this.setHealth(this.getMaxHealth()); if (keepEverything) { - this.getInventory().replaceWith(that.getInventory()); + this.getAttributes().assignBaseValues(that.getAttributes()); + this.getAttributes().assignPermanentModifiers(that.getAttributes()); this.setHealth(that.getHealth()); this.foodData = that.foodData; @@ -1345,17 +1538,22 @@ public class ServerPlayer extends Player { this.addEffect(new MobEffectInstance(mobEffectInstance)); } - this.experienceLevel = that.experienceLevel; - this.totalExperience = that.totalExperience; - this.experienceProgress = that.experienceProgress; - this.setScore(that.getScore()); - this.portalProcess = that.portalProcess; - } else if (this.level().getGameRules().getBoolean(GameRules.RULE_KEEPINVENTORY) || that.isSpectator()) { this.getInventory().replaceWith(that.getInventory()); this.experienceLevel = that.experienceLevel; this.totalExperience = that.totalExperience; this.experienceProgress = that.experienceProgress; this.setScore(that.getScore()); + this.portalProcess = that.portalProcess; + } else { + this.getAttributes().assignBaseValues(that.getAttributes()); + this.setHealth(this.getMaxHealth()); + if (this.serverLevel().getGameRules().getBoolean(GameRules.RULE_KEEPINVENTORY) || that.isSpectator()) { + this.getInventory().replaceWith(that.getInventory()); + this.experienceLevel = that.experienceLevel; + this.totalExperience = that.totalExperience; + this.experienceProgress = that.experienceProgress; + this.setScore(that.getScore()); + } } this.enchantmentSeed = that.enchantmentSeed; @@ -1393,11 +1591,14 @@ public class ServerPlayer extends Player { } @Override - protected void onEffectRemoved(MobEffectInstance effectInstance) { - super.onEffectRemoved(effectInstance); - this.connection.send(new ClientboundRemoveMobEffectPacket(this.getId(), effectInstance.getEffect())); - if (effectInstance.is(MobEffects.LEVITATION)) { - this.levitationStartPos = null; + protected void onEffectsRemoved(Collection collection) { + super.onEffectsRemoved(collection); + + for (MobEffectInstance mobEffectInstance : collection) { + this.connection.send(new ClientboundRemoveMobEffectPacket(this.getId(), mobEffectInstance.getEffect())); + if (mobEffectInstance.is(MobEffects.LEVITATION)) { + this.levitationStartPos = null; + } } CriteriaTriggers.EFFECTS_CHANGED.trigger(this, null); @@ -1405,31 +1606,32 @@ public class ServerPlayer extends Player { @Override public void teleportTo(double x, double y, double z) { - this.connection.teleport(x, y, z, this.getYRot(), this.getXRot(), RelativeMovement.ROTATION); + this.connection.teleport(new PositionMoveRotation(new Vec3(x, y, z), Vec3.ZERO, 0.0F, 0.0F), Relative.union(Relative.DELTA, Relative.ROTATION)); } @Override public void teleportRelative(double dx, double dy, double dz) { - this.connection.teleport(this.getX() + dx, this.getY() + dy, this.getZ() + dz, this.getYRot(), this.getXRot(), RelativeMovement.ALL); + this.connection.teleport(new PositionMoveRotation(new Vec3(dx, dy, dz), Vec3.ZERO, 0.0F, 0.0F), Relative.ALL); } @Override - public boolean teleportTo(ServerLevel level, double x, double y, double z, Set relativeMovements, float yRot, float xRot) { - ChunkPos chunkPos = new ChunkPos(BlockPos.containing(x, y, z)); - level.getChunkSource().addRegionTicket(TicketType.POST_TELEPORT, chunkPos, 1, this.getId()); - this.stopRiding(); + public boolean teleportTo(ServerLevel serverLevel, double d, double e, double f, Set set, float g, float h, boolean bl) { + ChunkPos chunkPos = new ChunkPos(BlockPos.containing(d, e, f)); + serverLevel.getChunkSource().addRegionTicket(TicketType.POST_TELEPORT, chunkPos, 1, this.getId()); if (this.isSleeping()) { this.stopSleepInBed(true, true); } - if (level == this.level()) { - this.connection.teleport(x, y, z, yRot, xRot, relativeMovements); - } else { - this.teleportTo(level, x, y, z, yRot, xRot); + if (bl) { + this.setCamera(this); } - this.setYHeadRot(yRot); - return true; + boolean bl2 = super.teleportTo(serverLevel, d, e, f, set, g, h, bl); + if (bl2) { + this.setYHeadRot(set.contains(Relative.Y_ROT) ? this.getYHeadRot() + g : g); + } + + return bl2; } @Override @@ -1493,7 +1695,24 @@ public class ServerPlayer extends Player { return this.gameMode.getGameModeForPlayer() == GameType.CREATIVE; } - @Override + public CommandSource commandSource() { + return this.commandSource; + } + + public CommandSourceStack createCommandSourceStack() { + return new CommandSourceStack( + this.commandSource(), + this.position(), + this.getRotationVector(), + this.serverLevel(), + this.getPermissionLevel(), + this.getName().getString(), + this.getDisplayName(), + this.server, + this + ); + } + public void sendSystemMessage(Component component) { this.sendSystemMessage(component, false); } @@ -1535,6 +1754,7 @@ public class ServerPlayer extends Player { this.canChatColor = clientInformation.chatColors(); this.textFilteringEnabled = clientInformation.textFilteringEnabled(); this.allowsListing = clientInformation.allowsListing(); + this.particleStatus = clientInformation.particleStatus(); this.getEntityData().set(DATA_PLAYER_MODE_CUSTOMISATION, (byte)clientInformation.modelCustomisation()); this.getEntityData().set(DATA_PLAYER_MAIN_HAND, (byte)clientInformation.mainHand().getId()); } @@ -1543,7 +1763,15 @@ public class ServerPlayer extends Player { int i = this.getEntityData().get(DATA_PLAYER_MODE_CUSTOMISATION); HumanoidArm humanoidArm = (HumanoidArm)HumanoidArm.BY_ID.apply(this.getEntityData().get(DATA_PLAYER_MAIN_HAND)); return new ClientInformation( - this.language, this.requestedViewDistance, this.chatVisibility, this.canChatColor, i, humanoidArm, this.textFilteringEnabled, this.allowsListing + this.language, + this.requestedViewDistance, + this.chatVisibility, + this.canChatColor, + i, + humanoidArm, + this.textFilteringEnabled, + this.allowsListing, + this.particleStatus ); } @@ -1568,7 +1796,7 @@ public class ServerPlayer extends Player { } public void sendServerStatus(ServerStatus serverStatus) { - this.connection.send(new ClientboundServerDataPacket(serverStatus.description(), serverStatus.favicon().map(ServerStatus.Favicon::iconBytes))); + this.connection.send(new ClientboundServerDataPacket(serverStatus.description(), serverStatus.favicon().map(Favicon::iconBytes))); } @Override @@ -1607,7 +1835,7 @@ public class ServerPlayer extends Player { this.camera = (Entity)(entityToSpectate == null ? this : entityToSpectate); if (entity != this.camera) { if (this.camera.level() instanceof ServerLevel serverLevel) { - this.teleportTo(serverLevel, this.camera.getX(), this.camera.getY(), this.camera.getZ(), Set.of(), this.getYRot(), this.getXRot()); + this.teleportTo(serverLevel, this.camera.getX(), this.camera.getY(), this.camera.getZ(), Set.of(), this.getYRot(), this.getXRot(), false); } if (entityToSpectate != null) { @@ -1647,6 +1875,10 @@ public class ServerPlayer extends Player { return null; } + public int getTabListOrder() { + return 0; + } + @Override public void swing(InteractionHand hand) { super.swing(hand); @@ -1665,16 +1897,6 @@ public class ServerPlayer extends Player { return this.advancements; } - public void teleportTo(ServerLevel newLevel, double x, double y, double z, float yaw, float pitch) { - this.setCamera(this); - this.stopRiding(); - if (newLevel == this.level()) { - this.connection.teleport(x, y, z, yaw, pitch); - } else { - this.changeDimension(new DimensionTransition(newLevel, new Vec3(x, y, z), Vec3.ZERO, yaw, pitch, DimensionTransition.DO_NOTHING)); - } - } - @Nullable public BlockPos getRespawnPosition() { return this.respawnPosition; @@ -1743,7 +1965,7 @@ public class ServerPlayer extends Player { @Override public ItemEntity drop(ItemStack droppedItem, boolean dropAround, boolean includeThrowerName) { - ItemEntity itemEntity = super.drop(droppedItem, dropAround, includeThrowerName); + ItemEntity itemEntity = this.createItemStackToDrop(droppedItem, dropAround, includeThrowerName); if (itemEntity == null) { return null; } else { @@ -1761,6 +1983,39 @@ public class ServerPlayer extends Player { } } + @Nullable + private ItemEntity createItemStackToDrop(ItemStack itemStack, boolean bl, boolean bl2) { + if (itemStack.isEmpty()) { + return null; + } else { + double d = this.getEyeY() - 0.3F; + ItemEntity itemEntity = new ItemEntity(this.level(), this.getX(), d, this.getZ(), itemStack); + itemEntity.setPickUpDelay(40); + if (bl2) { + itemEntity.setThrower(this); + } + + if (bl) { + float f = this.random.nextFloat() * 0.5F; + float g = this.random.nextFloat() * (float) (Math.PI * 2); + itemEntity.setDeltaMovement(-Mth.sin(g) * f, 0.2F, Mth.cos(g) * f); + } else { + float f = 0.3F; + float g = Mth.sin(this.getXRot() * (float) (Math.PI / 180.0)); + float h = Mth.cos(this.getXRot() * (float) (Math.PI / 180.0)); + float i = Mth.sin(this.getYRot() * (float) (Math.PI / 180.0)); + float j = Mth.cos(this.getYRot() * (float) (Math.PI / 180.0)); + float k = this.random.nextFloat() * (float) (Math.PI * 2); + float l = 0.02F * this.random.nextFloat(); + itemEntity.setDeltaMovement( + -i * h * 0.3F + Math.cos(k) * l, -g * 0.3F + 0.1F + (this.random.nextFloat() - this.random.nextFloat()) * 0.1F, j * h * 0.3F + Math.sin(k) * l + ); + } + + return itemEntity; + } + } + public TextFilter getTextFilter() { return this.textFilter; } @@ -1806,8 +2061,8 @@ public class ServerPlayer extends Player { } @Override - public boolean mayInteract(Level level, BlockPos pos) { - return super.mayInteract(level, pos) && level.mayInteract(this, pos); + public boolean mayInteract(ServerLevel serverLevel, BlockPos blockPos) { + return super.mayInteract(serverLevel, blockPos) && serverLevel.mayInteract(this, blockPos); } @Override @@ -1826,6 +2081,13 @@ public class ServerPlayer extends Player { return this.drop(itemStack, false, true) != null; } + @Override + public void handleExtraItemsCreatedOnUse(ItemStack itemStack) { + if (!this.getInventory().add(itemStack)) { + this.drop(itemStack, false); + } + } + public boolean allowsListing() { return this.allowsListing; } @@ -1866,9 +2128,8 @@ public class ServerPlayer extends Player { @Override public boolean startRiding(Entity vehicle, boolean force) { if (super.startRiding(vehicle, force)) { - this.setKnownMovement(Vec3.ZERO); vehicle.positionRider(this); - this.connection.teleport(this.getX(), this.getY(), this.getZ(), this.getYRot(), this.getXRot()); + this.connection.teleport(new PositionMoveRotation(this.position(), Vec3.ZERO, 0.0F, 0.0F), Relative.ROTATION); if (vehicle instanceof LivingEntity livingEntity) { this.server.getPlayerList().sendActiveEffects(livingEntity, this.connection); } @@ -1900,7 +2161,8 @@ public class ServerPlayer extends Player { level.isDebug(), level.isFlat(), this.getLastDeathLocation(), - this.getPortalCooldown() + this.getPortalCooldown(), + level.getSeaLevel() ); } @@ -1938,6 +2200,48 @@ public class ServerPlayer extends Player { this.awardStat(Stats.ITEM_BROKEN.get(item)); } + public Input getLastClientInput() { + return this.lastClientInput; + } + + public void setLastClientInput(Input input) { + this.lastClientInput = input; + } + + public Vec3 getLastClientMoveIntent() { + float f = this.lastClientInput.left() == this.lastClientInput.right() ? 0.0F : (this.lastClientInput.left() ? 1.0F : -1.0F); + float g = this.lastClientInput.forward() == this.lastClientInput.backward() ? 0.0F : (this.lastClientInput.forward() ? 1.0F : -1.0F); + return getInputVector(new Vec3(f, 0.0, g), 1.0F, this.getYRot()); + } + + public void registerEnderPearl(ThrownEnderpearl thrownEnderpearl) { + this.enderPearls.add(thrownEnderpearl); + } + + public void deregisterEnderPearl(ThrownEnderpearl thrownEnderpearl) { + this.enderPearls.remove(thrownEnderpearl); + } + + public Set getEnderPearls() { + return this.enderPearls; + } + + public long registerAndUpdateEnderPearlTicket(ThrownEnderpearl thrownEnderpearl) { + if (thrownEnderpearl.level() instanceof ServerLevel serverLevel) { + ChunkPos chunkPos = thrownEnderpearl.chunkPosition(); + this.registerEnderPearl(thrownEnderpearl); + serverLevel.resetEmptyTime(); + return placeEnderPearlTicket(serverLevel, chunkPos) - 1L; + } else { + return 0L; + } + } + + public static long placeEnderPearlTicket(ServerLevel serverLevel, ChunkPos chunkPos) { + serverLevel.getChunkSource().addRegionTicket(TicketType.ENDER_PEARL, chunkPos, 2, chunkPos); + return TicketType.ENDER_PEARL.timeout(); + } + record RespawnPosAngle(Vec3 position, float yaw) { public static ServerPlayer.RespawnPosAngle of(Vec3 position, BlockPos towardsPos) { return new ServerPlayer.RespawnPosAngle(position, calculateLookAtYaw(position, towardsPos)); diff --git a/net/minecraft/server/level/ServerPlayerGameMode.java b/net/minecraft/server/level/ServerPlayerGameMode.java index 2248016d..1827941e 100644 --- a/net/minecraft/server/level/ServerPlayerGameMode.java +++ b/net/minecraft/server/level/ServerPlayerGameMode.java @@ -7,11 +7,9 @@ import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.network.protocol.game.ClientboundBlockUpdatePacket; import net.minecraft.network.protocol.game.ClientboundPlayerInfoUpdatePacket; -import net.minecraft.network.protocol.game.ServerboundPlayerActionPacket; +import net.minecraft.network.protocol.game.ServerboundPlayerActionPacket.Action; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; -import net.minecraft.world.InteractionResultHolder; -import net.minecraft.world.ItemInteractionResult; import net.minecraft.world.MenuProvider; import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.item.ItemStack; @@ -134,14 +132,14 @@ public class ServerPlayerGameMode { private void debugLogging(BlockPos pos, boolean terminate, int sequence, String message) { } - public void handleBlockBreakAction(BlockPos pos, ServerboundPlayerActionPacket.Action action, Direction face, int maxBuildHeight, int sequence) { + public void handleBlockBreakAction(BlockPos pos, Action action, Direction face, int maxBuildHeight, int sequence) { if (!this.player.canInteractWithBlock(pos, 1.0)) { this.debugLogging(pos, false, sequence, "too far"); - } else if (pos.getY() >= maxBuildHeight) { + } else if (pos.getY() > maxBuildHeight) { this.player.connection.send(new ClientboundBlockUpdatePacket(pos, this.level.getBlockState(pos))); this.debugLogging(pos, false, sequence, "too high"); } else { - if (action == ServerboundPlayerActionPacket.Action.START_DESTROY_BLOCK) { + if (action == Action.START_DESTROY_BLOCK) { if (!this.level.mayInteract(this.player, pos)) { this.player.connection.send(new ClientboundBlockUpdatePacket(pos, this.level.getBlockState(pos))); this.debugLogging(pos, false, sequence, "may not interact"); @@ -192,7 +190,7 @@ public class ServerPlayerGameMode { this.debugLogging(pos, true, sequence, "actual start of destroying"); this.lastSentState = i; } - } else if (action == ServerboundPlayerActionPacket.Action.STOP_DESTROY_BLOCK) { + } else if (action == Action.STOP_DESTROY_BLOCK) { if (pos.equals(this.destroyPos)) { int j = this.gameTicks - this.destroyProgressStart; BlockState blockStatex = this.level.getBlockState(pos); @@ -215,7 +213,7 @@ public class ServerPlayerGameMode { } this.debugLogging(pos, true, sequence, "stopped destroying"); - } else if (action == ServerboundPlayerActionPacket.Action.ABORT_DESTROY_BLOCK) { + } else if (action == Action.ABORT_DESTROY_BLOCK) { this.isDestroyingBlock = false; if (!Objects.equals(this.destroyPos, pos)) { LOGGER.warn("Mismatch in destroy block pos: {} {}", this.destroyPos, pos); @@ -280,17 +278,23 @@ public class ServerPlayerGameMode { public InteractionResult useItem(ServerPlayer player, Level level, ItemStack stack, InteractionHand hand) { if (this.gameModeForPlayer == GameType.SPECTATOR) { return InteractionResult.PASS; - } else if (player.getCooldowns().isOnCooldown(stack.getItem())) { + } else if (player.getCooldowns().isOnCooldown(stack)) { return InteractionResult.PASS; } else { int i = stack.getCount(); int j = stack.getDamageValue(); - InteractionResultHolder interactionResultHolder = stack.use(level, player, hand); - ItemStack itemStack = interactionResultHolder.getObject(); + InteractionResult interactionResult = stack.use(level, player, hand); + ItemStack itemStack; + if (interactionResult instanceof InteractionResult.Success success) { + itemStack = (ItemStack)Objects.requireNonNullElse(success.heldItemTransformedTo(), player.getItemInHand(hand)); + } else { + itemStack = player.getItemInHand(hand); + } + if (itemStack == stack && itemStack.getCount() == i && itemStack.getUseDuration(player) <= 0 && itemStack.getDamageValue() == j) { - return interactionResultHolder.getResult(); - } else if (interactionResultHolder.getResult() == InteractionResult.FAIL && itemStack.getUseDuration(player) > 0 && !player.isUsingItem()) { - return interactionResultHolder.getResult(); + return interactionResult; + } else if (interactionResult instanceof InteractionResult.Fail && itemStack.getUseDuration(player) > 0 && !player.isUsingItem()) { + return interactionResult; } else { if (stack != itemStack) { player.setItemInHand(hand, itemStack); @@ -304,7 +308,7 @@ public class ServerPlayerGameMode { player.inventoryMenu.sendAllDataToRemote(); } - return interactionResultHolder.getResult(); + return interactionResult; } } } @@ -318,7 +322,7 @@ public class ServerPlayerGameMode { MenuProvider menuProvider = blockState.getMenuProvider(level, blockPos); if (menuProvider != null) { player.openMenu(menuProvider); - return InteractionResult.SUCCESS; + return InteractionResult.CONSUME; } else { return InteractionResult.PASS; } @@ -327,37 +331,37 @@ public class ServerPlayerGameMode { boolean bl2 = player.isSecondaryUseActive() && bl; ItemStack itemStack = stack.copy(); if (!bl2) { - ItemInteractionResult itemInteractionResult = blockState.useItemOn(player.getItemInHand(hand), level, player, hand, hitResult); - if (itemInteractionResult.consumesAction()) { + InteractionResult interactionResult = blockState.useItemOn(player.getItemInHand(hand), level, player, hand, hitResult); + if (interactionResult.consumesAction()) { CriteriaTriggers.ITEM_USED_ON_BLOCK.trigger(player, blockPos, itemStack); - return itemInteractionResult.result(); + return interactionResult; } - if (itemInteractionResult == ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION && hand == InteractionHand.MAIN_HAND) { - InteractionResult interactionResult = blockState.useWithoutItem(level, player, hitResult); - if (interactionResult.consumesAction()) { + if (interactionResult instanceof InteractionResult.TryEmptyHandInteraction && hand == InteractionHand.MAIN_HAND) { + InteractionResult interactionResult2 = blockState.useWithoutItem(level, player, hitResult); + if (interactionResult2.consumesAction()) { CriteriaTriggers.DEFAULT_BLOCK_USE.trigger(player, blockPos); - return interactionResult; + return interactionResult2; } } } - if (!stack.isEmpty() && !player.getCooldowns().isOnCooldown(stack.getItem())) { + if (!stack.isEmpty() && !player.getCooldowns().isOnCooldown(stack)) { UseOnContext useOnContext = new UseOnContext(player, hand, hitResult); - InteractionResult interactionResult; + InteractionResult interactionResult2; if (this.isCreative()) { int i = stack.getCount(); - interactionResult = stack.useOn(useOnContext); + interactionResult2 = stack.useOn(useOnContext); stack.setCount(i); } else { - interactionResult = stack.useOn(useOnContext); + interactionResult2 = stack.useOn(useOnContext); } - if (interactionResult.consumesAction()) { + if (interactionResult2.consumesAction()) { CriteriaTriggers.ITEM_USED_ON_BLOCK.trigger(player, blockPos, itemStack); } - return interactionResult; + return interactionResult2; } else { return InteractionResult.PASS; } diff --git a/net/minecraft/server/level/ThreadedLevelLightEngine.java b/net/minecraft/server/level/ThreadedLevelLightEngine.java index ab673075..9cdd3ecd 100644 --- a/net/minecraft/server/level/ThreadedLevelLightEngine.java +++ b/net/minecraft/server/level/ThreadedLevelLightEngine.java @@ -11,8 +11,7 @@ import java.util.function.IntSupplier; import net.minecraft.Util; import net.minecraft.core.BlockPos; import net.minecraft.core.SectionPos; -import net.minecraft.util.thread.ProcessorHandle; -import net.minecraft.util.thread.ProcessorMailbox; +import net.minecraft.util.thread.ConsecutiveExecutor; import net.minecraft.world.level.ChunkPos; import net.minecraft.world.level.LightLayer; import net.minecraft.world.level.chunk.ChunkAccess; @@ -26,24 +25,20 @@ import org.slf4j.Logger; public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCloseable { public static final int DEFAULT_BATCH_SIZE = 1000; private static final Logger LOGGER = LogUtils.getLogger(); - private final ProcessorMailbox taskMailbox; + private final ConsecutiveExecutor consecutiveExecutor; private final ObjectList> lightTasks = new ObjectArrayList<>(); private final ChunkMap chunkMap; - private final ProcessorHandle> sorterMailbox; + private final ChunkTaskDispatcher taskDispatcher; private final int taskPerBatch = 1000; private final AtomicBoolean scheduled = new AtomicBoolean(); public ThreadedLevelLightEngine( - LightChunkGetter lightChunk, - ChunkMap chunkMap, - boolean skyLight, - ProcessorMailbox taskMailbox, - ProcessorHandle> sorterMailbox + LightChunkGetter lightChunkGetter, ChunkMap chunkMap, boolean bl, ConsecutiveExecutor consecutiveExecutor, ChunkTaskDispatcher chunkTaskDispatcher ) { - super(lightChunk, true, skyLight); + super(lightChunkGetter, true, bl); this.chunkMap = chunkMap; - this.sorterMailbox = sorterMailbox; - this.taskMailbox = taskMailbox; + this.taskDispatcher = chunkTaskDispatcher; + this.consecutiveExecutor = consecutiveExecutor; } public void close() { @@ -75,7 +70,7 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl super.queueSectionData(LightLayer.SKY, SectionPos.of(chunkPos, i), null); } - for (int i = this.levelHeightAccessor.getMinSection(); i < this.levelHeightAccessor.getMaxSection(); i++) { + for (int i = this.levelHeightAccessor.getMinSectionY(); i <= this.levelHeightAccessor.getMaxSectionY(); i++) { super.updateSectionStatus(SectionPos.of(chunkPos, i), true); } }), () -> "updateChunkStatus " + chunkPos + " true")); @@ -128,12 +123,12 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl } private void addTask(int chunkX, int chunkZ, IntSupplier queueLevelSupplier, ThreadedLevelLightEngine.TaskType type, Runnable task) { - this.sorterMailbox.tell(ChunkTaskPriorityQueueSorter.message((Runnable)(() -> { + this.taskDispatcher.submit(() -> { this.lightTasks.add(Pair.of(type, task)); if (this.lightTasks.size() >= 1000) { this.runUpdate(); } - }), ChunkPos.asLong(chunkX, chunkZ), queueLevelSupplier)); + }, ChunkPos.asLong(chunkX, chunkZ), queueLevelSupplier); } @Override @@ -179,7 +174,7 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl public void tryScheduleUpdate() { if ((!this.lightTasks.isEmpty() || super.hasLightWork()) && this.scheduled.compareAndSet(false, true)) { - this.taskMailbox.tell(() -> { + this.consecutiveExecutor.schedule(() -> { this.runUpdate(); this.scheduled.set(false); }); diff --git a/net/minecraft/server/level/ThrottlingChunkTaskDispatcher.java b/net/minecraft/server/level/ThrottlingChunkTaskDispatcher.java new file mode 100644 index 00000000..a645c49b --- /dev/null +++ b/net/minecraft/server/level/ThrottlingChunkTaskDispatcher.java @@ -0,0 +1,48 @@ +package net.minecraft.server.level; + +import com.google.common.annotations.VisibleForTesting; +import it.unimi.dsi.fastutil.longs.LongOpenHashSet; +import it.unimi.dsi.fastutil.longs.LongSet; +import java.util.concurrent.Executor; +import java.util.stream.Collectors; +import net.minecraft.util.thread.TaskScheduler; +import net.minecraft.world.level.ChunkPos; +import org.jetbrains.annotations.Nullable; + +public class ThrottlingChunkTaskDispatcher extends ChunkTaskDispatcher { + private final LongSet chunkPositionsInExecution = new LongOpenHashSet(); + private final int maxChunksInExecution; + private final String executorSchedulerName; + + public ThrottlingChunkTaskDispatcher(TaskScheduler taskScheduler, Executor executor, int i) { + super(taskScheduler, executor); + this.maxChunksInExecution = i; + this.executorSchedulerName = taskScheduler.name(); + } + + @Override + protected void onRelease(long l) { + this.chunkPositionsInExecution.remove(l); + } + + @Nullable + @Override + protected ChunkTaskPriorityQueue.TasksForChunk popTasks() { + return this.chunkPositionsInExecution.size() < this.maxChunksInExecution ? super.popTasks() : null; + } + + @Override + protected void scheduleForExecution(ChunkTaskPriorityQueue.TasksForChunk tasksForChunk) { + this.chunkPositionsInExecution.add(tasksForChunk.chunkPos()); + super.scheduleForExecution(tasksForChunk); + } + + @VisibleForTesting + public String getDebugStatus() { + return this.executorSchedulerName + + "=[" + + (String)this.chunkPositionsInExecution.stream().map(long_ -> long_ + ":" + new ChunkPos(long_)).collect(Collectors.joining(",")) + + "], s=" + + this.sleeping; + } +} diff --git a/net/minecraft/server/level/TicketType.java b/net/minecraft/server/level/TicketType.java index 655c1ec0..29ce9292 100644 --- a/net/minecraft/server/level/TicketType.java +++ b/net/minecraft/server/level/TicketType.java @@ -15,6 +15,7 @@ public class TicketType { public static final TicketType PLAYER = create("player", Comparator.comparingLong(ChunkPos::toLong)); public static final TicketType FORCED = create("forced", Comparator.comparingLong(ChunkPos::toLong)); public static final TicketType PORTAL = create("portal", Vec3i::compareTo, 300); + public static final TicketType ENDER_PEARL = create("ender_pearl", Comparator.comparingLong(ChunkPos::toLong), 40); public static final TicketType POST_TELEPORT = create("post_teleport", Integer::compareTo, 5); public static final TicketType UNKNOWN = create("unknown", Comparator.comparingLong(ChunkPos::toLong), 1); diff --git a/net/minecraft/server/level/TickingTracker.java b/net/minecraft/server/level/TickingTracker.java index be55bbe4..3394c611 100644 --- a/net/minecraft/server/level/TickingTracker.java +++ b/net/minecraft/server/level/TickingTracker.java @@ -5,6 +5,7 @@ import it.unimi.dsi.fastutil.longs.Long2ByteMap; import it.unimi.dsi.fastutil.longs.Long2ByteOpenHashMap; import it.unimi.dsi.fastutil.longs.Long2ObjectFunction; import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; +import it.unimi.dsi.fastutil.longs.LongSet; import it.unimi.dsi.fastutil.longs.Long2ObjectMap.Entry; import java.util.ArrayList; import java.util.List; @@ -104,6 +105,10 @@ public class TickingTracker extends ChunkTracker { } } + public LongSet getTickingChunks() { + return this.chunks.keySet(); + } + public void runAllUpdates() { this.runUpdates(Integer.MAX_VALUE); } diff --git a/net/minecraft/server/level/WorldGenRegion.java b/net/minecraft/server/level/WorldGenRegion.java index cb8eb1bf..2cd64c5f 100644 --- a/net/minecraft/server/level/WorldGenRegion.java +++ b/net/minecraft/server/level/WorldGenRegion.java @@ -49,6 +49,7 @@ import net.minecraft.world.level.chunk.status.ChunkType; import net.minecraft.world.level.dimension.DimensionType; import net.minecraft.world.level.entity.EntityTypeTest; import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.level.gameevent.GameEvent.Context; import net.minecraft.world.level.levelgen.Heightmap; import net.minecraft.world.level.lighting.LevelLightEngine; import net.minecraft.world.level.material.Fluid; @@ -252,7 +253,7 @@ public class WorldGenRegion implements WorldGenLevel { if (k <= this.generatingStep.blockStateWriteRadius() && l <= this.generatingStep.blockStateWriteRadius()) { if (this.center.isUpgrading()) { LevelHeightAccessor levelHeightAccessor = this.center.getHeightAccessorForGeneration(); - if (pos.getY() < levelHeightAccessor.getMinBuildHeight() || pos.getY() >= levelHeightAccessor.getMaxBuildHeight()) { + if (levelHeightAccessor.isOutsideBuildHeight(pos.getY())) { return false; } } @@ -424,7 +425,7 @@ public class WorldGenRegion implements WorldGenLevel { } @Override - public void gameEvent(Holder gameEvent, Vec3 pos, GameEvent.Context context) { + public void gameEvent(Holder gameEvent, Vec3 pos, Context context) { } @Override @@ -458,8 +459,8 @@ public class WorldGenRegion implements WorldGenLevel { } @Override - public int getMinBuildHeight() { - return this.level.getMinBuildHeight(); + public int getMinY() { + return this.level.getMinY(); } @Override diff --git a/net/minecraft/server/level/progress/ProcessorChunkProgressListener.java b/net/minecraft/server/level/progress/ProcessorChunkProgressListener.java index 37013875..b9d2bc77 100644 --- a/net/minecraft/server/level/progress/ProcessorChunkProgressListener.java +++ b/net/minecraft/server/level/progress/ProcessorChunkProgressListener.java @@ -1,19 +1,19 @@ package net.minecraft.server.level.progress; import java.util.concurrent.Executor; -import net.minecraft.util.thread.ProcessorMailbox; +import net.minecraft.util.thread.ConsecutiveExecutor; import net.minecraft.world.level.ChunkPos; import net.minecraft.world.level.chunk.status.ChunkStatus; import org.jetbrains.annotations.Nullable; public class ProcessorChunkProgressListener implements ChunkProgressListener { private final ChunkProgressListener delegate; - private final ProcessorMailbox mailbox; + private final ConsecutiveExecutor consecutiveExecutor; private boolean started; private ProcessorChunkProgressListener(ChunkProgressListener delegate, Executor dispatcher) { this.delegate = delegate; - this.mailbox = ProcessorMailbox.create(dispatcher, "progressListener"); + this.consecutiveExecutor = new ConsecutiveExecutor(dispatcher, "progressListener"); } public static ProcessorChunkProgressListener createStarted(ChunkProgressListener delegate, Executor dispatcher) { @@ -24,25 +24,25 @@ public class ProcessorChunkProgressListener implements ChunkProgressListener { @Override public void updateSpawnPos(ChunkPos center) { - this.mailbox.tell(() -> this.delegate.updateSpawnPos(center)); + this.consecutiveExecutor.schedule(() -> this.delegate.updateSpawnPos(center)); } @Override public void onStatusChange(ChunkPos chunkPos, @Nullable ChunkStatus chunkStatus) { if (this.started) { - this.mailbox.tell(() -> this.delegate.onStatusChange(chunkPos, chunkStatus)); + this.consecutiveExecutor.schedule(() -> this.delegate.onStatusChange(chunkPos, chunkStatus)); } } @Override public void start() { this.started = true; - this.mailbox.tell(this.delegate::start); + this.consecutiveExecutor.schedule(this.delegate::start); } @Override public void stop() { this.started = false; - this.mailbox.tell(this.delegate::stop); + this.consecutiveExecutor.schedule(this.delegate::stop); } } diff --git a/net/minecraft/server/network/LegacyTextFilter.java b/net/minecraft/server/network/LegacyTextFilter.java new file mode 100644 index 00000000..4c24cfc5 --- /dev/null +++ b/net/minecraft/server/network/LegacyTextFilter.java @@ -0,0 +1,189 @@ +package net.minecraft.server.network; + +import com.google.gson.JsonArray; +import com.google.gson.JsonObject; +import com.mojang.authlib.GameProfile; +import java.io.IOException; +import java.io.InputStream; +import java.net.HttpURLConnection; +import java.net.URI; +import java.net.URL; +import java.nio.charset.StandardCharsets; +import java.util.Base64; +import java.util.concurrent.Executor; +import java.util.concurrent.ExecutorService; +import net.minecraft.network.chat.FilterMask; +import net.minecraft.util.GsonHelper; +import org.jetbrains.annotations.Nullable; + +public class LegacyTextFilter extends ServerTextFilter { + private static final String ENDPOINT = "v1/chat"; + final URL joinEndpoint; + final LegacyTextFilter.JoinOrLeaveEncoder joinEncoder; + final URL leaveEndpoint; + final LegacyTextFilter.JoinOrLeaveEncoder leaveEncoder; + private final String authKey; + + private LegacyTextFilter( + URL uRL, + ServerTextFilter.MessageEncoder messageEncoder, + URL uRL2, + LegacyTextFilter.JoinOrLeaveEncoder joinOrLeaveEncoder, + URL uRL3, + LegacyTextFilter.JoinOrLeaveEncoder joinOrLeaveEncoder2, + String string, + ServerTextFilter.IgnoreStrategy ignoreStrategy, + ExecutorService executorService + ) { + super(uRL, messageEncoder, ignoreStrategy, executorService); + this.joinEndpoint = uRL2; + this.joinEncoder = joinOrLeaveEncoder; + this.leaveEndpoint = uRL3; + this.leaveEncoder = joinOrLeaveEncoder2; + this.authKey = string; + } + + @Nullable + public static ServerTextFilter createTextFilterFromConfig(String string) { + try { + JsonObject jsonObject = GsonHelper.parse(string); + URI uRI = new URI(GsonHelper.getAsString(jsonObject, "apiServer")); + String string2 = GsonHelper.getAsString(jsonObject, "apiKey"); + if (string2.isEmpty()) { + throw new IllegalArgumentException("Missing API key"); + } else { + int i = GsonHelper.getAsInt(jsonObject, "ruleId", 1); + String string3 = GsonHelper.getAsString(jsonObject, "serverId", ""); + String string4 = GsonHelper.getAsString(jsonObject, "roomId", "Java:Chat"); + int j = GsonHelper.getAsInt(jsonObject, "hashesToDrop", -1); + int k = GsonHelper.getAsInt(jsonObject, "maxConcurrentRequests", 7); + JsonObject jsonObject2 = GsonHelper.getAsJsonObject(jsonObject, "endpoints", null); + String string5 = getEndpointFromConfig(jsonObject2, "chat", "v1/chat"); + boolean bl = string5.equals("v1/chat"); + URL uRL = uRI.resolve("/" + string5).toURL(); + URL uRL2 = getEndpoint(uRI, jsonObject2, "join", "v1/join"); + URL uRL3 = getEndpoint(uRI, jsonObject2, "leave", "v1/leave"); + LegacyTextFilter.JoinOrLeaveEncoder joinOrLeaveEncoder = gameProfile -> { + JsonObject jsonObjectx = new JsonObject(); + jsonObjectx.addProperty("server", string3); + jsonObjectx.addProperty("room", string4); + jsonObjectx.addProperty("user_id", gameProfile.getId().toString()); + jsonObjectx.addProperty("user_display_name", gameProfile.getName()); + return jsonObjectx; + }; + ServerTextFilter.MessageEncoder messageEncoder; + if (bl) { + messageEncoder = (gameProfile, string3x) -> { + JsonObject jsonObjectx = new JsonObject(); + jsonObjectx.addProperty("rule", i); + jsonObjectx.addProperty("server", string3); + jsonObjectx.addProperty("room", string4); + jsonObjectx.addProperty("player", gameProfile.getId().toString()); + jsonObjectx.addProperty("player_display_name", gameProfile.getName()); + jsonObjectx.addProperty("text", string3x); + jsonObjectx.addProperty("language", "*"); + return jsonObjectx; + }; + } else { + String string6 = String.valueOf(i); + messageEncoder = (gameProfile, string4x) -> { + JsonObject jsonObjectx = new JsonObject(); + jsonObjectx.addProperty("rule_id", string6); + jsonObjectx.addProperty("category", string3); + jsonObjectx.addProperty("subcategory", string4); + jsonObjectx.addProperty("user_id", gameProfile.getId().toString()); + jsonObjectx.addProperty("user_display_name", gameProfile.getName()); + jsonObjectx.addProperty("text", string4x); + jsonObjectx.addProperty("language", "*"); + return jsonObjectx; + }; + } + + ServerTextFilter.IgnoreStrategy ignoreStrategy = ServerTextFilter.IgnoreStrategy.select(j); + ExecutorService executorService = createWorkerPool(k); + String string7 = Base64.getEncoder().encodeToString(string2.getBytes(StandardCharsets.US_ASCII)); + return new LegacyTextFilter(uRL, messageEncoder, uRL2, joinOrLeaveEncoder, uRL3, joinOrLeaveEncoder, string7, ignoreStrategy, executorService); + } + } catch (Exception var20) { + LOGGER.warn("Failed to parse chat filter config {}", string, var20); + return null; + } + } + + @Override + public TextFilter createContext(GameProfile gameProfile) { + return new ServerTextFilter.PlayerContext(gameProfile) { + @Override + public void join() { + LegacyTextFilter.this.processJoinOrLeave(this.profile, LegacyTextFilter.this.joinEndpoint, LegacyTextFilter.this.joinEncoder, this.streamExecutor); + } + + @Override + public void leave() { + LegacyTextFilter.this.processJoinOrLeave(this.profile, LegacyTextFilter.this.leaveEndpoint, LegacyTextFilter.this.leaveEncoder, this.streamExecutor); + } + }; + } + + void processJoinOrLeave(GameProfile gameProfile, URL uRL, LegacyTextFilter.JoinOrLeaveEncoder joinOrLeaveEncoder, Executor executor) { + executor.execute(() -> { + JsonObject jsonObject = joinOrLeaveEncoder.encode(gameProfile); + + try { + this.processRequest(jsonObject, uRL); + } catch (Exception var6) { + LOGGER.warn("Failed to send join/leave packet to {} for player {}", uRL, gameProfile, var6); + } + }); + } + + private void processRequest(JsonObject jsonObject, URL uRL) throws IOException { + HttpURLConnection httpURLConnection = this.makeRequest(jsonObject, uRL); + InputStream inputStream = httpURLConnection.getInputStream(); + + try { + this.drainStream(inputStream); + } catch (Throwable var8) { + if (inputStream != null) { + try { + inputStream.close(); + } catch (Throwable var7) { + var8.addSuppressed(var7); + } + } + + throw var8; + } + + if (inputStream != null) { + inputStream.close(); + } + } + + @Override + protected void setAuthorizationProperty(HttpURLConnection httpURLConnection) { + httpURLConnection.setRequestProperty("Authorization", "Basic " + this.authKey); + } + + @Override + protected FilteredText filterText(String string, ServerTextFilter.IgnoreStrategy ignoreStrategy, JsonObject jsonObject) { + boolean bl = GsonHelper.getAsBoolean(jsonObject, "response", false); + if (bl) { + return FilteredText.passThrough(string); + } else { + String string2 = GsonHelper.getAsString(jsonObject, "hashed", null); + if (string2 == null) { + return FilteredText.fullyFiltered(string); + } else { + JsonArray jsonArray = GsonHelper.getAsJsonArray(jsonObject, "hashes"); + FilterMask filterMask = this.parseMask(string, jsonArray, ignoreStrategy); + return new FilteredText(string, filterMask); + } + } + } + + @FunctionalInterface + interface JoinOrLeaveEncoder { + JsonObject encode(GameProfile gameProfile); + } +} diff --git a/net/minecraft/server/network/PlayerSafetyServiceTextFilter.java b/net/minecraft/server/network/PlayerSafetyServiceTextFilter.java new file mode 100644 index 00000000..01332885 --- /dev/null +++ b/net/minecraft/server/network/PlayerSafetyServiceTextFilter.java @@ -0,0 +1,170 @@ +package net.minecraft.server.network; + +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.microsoft.aad.msal4j.ClientCredentialFactory; +import com.microsoft.aad.msal4j.ClientCredentialParameters; +import com.microsoft.aad.msal4j.ConfidentialClientApplication; +import com.microsoft.aad.msal4j.IAuthenticationResult; +import com.microsoft.aad.msal4j.IClientCertificate; +import java.io.InputStream; +import java.net.HttpURLConnection; +import java.net.MalformedURLException; +import java.net.URI; +import java.net.URL; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.HashSet; +import java.util.Locale; +import java.util.Set; +import java.util.concurrent.ExecutorService; +import net.minecraft.util.GsonHelper; +import org.jetbrains.annotations.Nullable; + +public class PlayerSafetyServiceTextFilter extends ServerTextFilter { + private final ConfidentialClientApplication client; + private final ClientCredentialParameters clientParameters; + private final Set fullyFilteredEvents; + private final int connectionReadTimeoutMs; + + private PlayerSafetyServiceTextFilter( + URL uRL, + ServerTextFilter.MessageEncoder messageEncoder, + ServerTextFilter.IgnoreStrategy ignoreStrategy, + ExecutorService executorService, + ConfidentialClientApplication confidentialClientApplication, + ClientCredentialParameters clientCredentialParameters, + Set set, + int i + ) { + super(uRL, messageEncoder, ignoreStrategy, executorService); + this.client = confidentialClientApplication; + this.clientParameters = clientCredentialParameters; + this.fullyFilteredEvents = set; + this.connectionReadTimeoutMs = i; + } + + @Nullable + public static ServerTextFilter createTextFilterFromConfig(String string) { + JsonObject jsonObject = GsonHelper.parse(string); + URI uRI = URI.create(GsonHelper.getAsString(jsonObject, "apiServer")); + String string2 = GsonHelper.getAsString(jsonObject, "apiPath"); + String string3 = GsonHelper.getAsString(jsonObject, "scope"); + String string4 = GsonHelper.getAsString(jsonObject, "serverId", ""); + String string5 = GsonHelper.getAsString(jsonObject, "applicationId"); + String string6 = GsonHelper.getAsString(jsonObject, "tenantId"); + String string7 = GsonHelper.getAsString(jsonObject, "roomId", "Java:Chat"); + String string8 = GsonHelper.getAsString(jsonObject, "certificatePath"); + String string9 = GsonHelper.getAsString(jsonObject, "certificatePassword", ""); + int i = GsonHelper.getAsInt(jsonObject, "hashesToDrop", -1); + int j = GsonHelper.getAsInt(jsonObject, "maxConcurrentRequests", 7); + JsonArray jsonArray = GsonHelper.getAsJsonArray(jsonObject, "fullyFilteredEvents"); + Set set = new HashSet(); + jsonArray.forEach(jsonElement -> set.add(GsonHelper.convertToString(jsonElement, "filteredEvent"))); + int k = GsonHelper.getAsInt(jsonObject, "connectionReadTimeoutMs", 2000); + + URL uRL; + try { + uRL = uRI.resolve(string2).toURL(); + } catch (MalformedURLException var26) { + throw new RuntimeException(var26); + } + + ServerTextFilter.MessageEncoder messageEncoder = (gameProfile, string3x) -> { + JsonObject jsonObjectx = new JsonObject(); + jsonObjectx.addProperty("userId", gameProfile.getId().toString()); + jsonObjectx.addProperty("userDisplayName", gameProfile.getName()); + jsonObjectx.addProperty("server", string4); + jsonObjectx.addProperty("room", string7); + jsonObjectx.addProperty("area", "JavaChatRealms"); + jsonObjectx.addProperty("data", string3x); + jsonObjectx.addProperty("language", "*"); + return jsonObjectx; + }; + ServerTextFilter.IgnoreStrategy ignoreStrategy = ServerTextFilter.IgnoreStrategy.select(i); + ExecutorService executorService = createWorkerPool(j); + + IClientCertificate iClientCertificate; + try { + InputStream inputStream = Files.newInputStream(Path.of(string8)); + + try { + iClientCertificate = ClientCredentialFactory.createFromCertificate(inputStream, string9); + } catch (Throwable var27) { + if (inputStream != null) { + try { + inputStream.close(); + } catch (Throwable var24) { + var27.addSuppressed(var24); + } + } + + throw var27; + } + + if (inputStream != null) { + inputStream.close(); + } + } catch (Exception var28) { + LOGGER.warn("Failed to open certificate file"); + return null; + } + + ConfidentialClientApplication confidentialClientApplication; + try { + confidentialClientApplication = ConfidentialClientApplication.builder(string5, iClientCertificate) + .sendX5c(true) + .executorService(executorService) + .authority(String.format(Locale.ROOT, "https://login.microsoftonline.com/%s/", string6)) + .build(); + } catch (Exception var25) { + LOGGER.warn("Failed to create confidential client application"); + return null; + } + + ClientCredentialParameters clientCredentialParameters = ClientCredentialParameters.builder(Set.of(string3)).build(); + return new PlayerSafetyServiceTextFilter( + uRL, messageEncoder, ignoreStrategy, executorService, confidentialClientApplication, clientCredentialParameters, set, k + ); + } + + private IAuthenticationResult aquireIAuthenticationResult() { + return (IAuthenticationResult)this.client.acquireToken(this.clientParameters).join(); + } + + @Override + protected void setAuthorizationProperty(HttpURLConnection httpURLConnection) { + IAuthenticationResult iAuthenticationResult = this.aquireIAuthenticationResult(); + httpURLConnection.setRequestProperty("Authorization", "Bearer " + iAuthenticationResult.accessToken()); + } + + @Override + protected FilteredText filterText(String string, ServerTextFilter.IgnoreStrategy ignoreStrategy, JsonObject jsonObject) { + JsonObject jsonObject2 = GsonHelper.getAsJsonObject(jsonObject, "result", null); + if (jsonObject2 == null) { + return FilteredText.fullyFiltered(string); + } else { + boolean bl = GsonHelper.getAsBoolean(jsonObject2, "filtered", true); + if (!bl) { + return FilteredText.passThrough(string); + } else { + for (JsonElement jsonElement : GsonHelper.getAsJsonArray(jsonObject2, "events", new JsonArray())) { + JsonObject jsonObject3 = jsonElement.getAsJsonObject(); + String string2 = GsonHelper.getAsString(jsonObject3, "id", ""); + if (this.fullyFilteredEvents.contains(string2)) { + return FilteredText.fullyFiltered(string); + } + } + + JsonArray jsonArray2 = GsonHelper.getAsJsonArray(jsonObject2, "redactedTextIndex", new JsonArray()); + return new FilteredText(string, this.parseMask(string, jsonArray2, ignoreStrategy)); + } + } + } + + @Override + protected int connectionReadTimeout() { + return this.connectionReadTimeoutMs; + } +} diff --git a/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/net/minecraft/server/network/ServerCommonPacketListenerImpl.java index a9e36f51..56b14566 100644 --- a/net/minecraft/server/network/ServerCommonPacketListenerImpl.java +++ b/net/minecraft/server/network/ServerCommonPacketListenerImpl.java @@ -20,10 +20,12 @@ import net.minecraft.network.protocol.common.ServerboundCustomPayloadPacket; import net.minecraft.network.protocol.common.ServerboundKeepAlivePacket; import net.minecraft.network.protocol.common.ServerboundPongPacket; import net.minecraft.network.protocol.common.ServerboundResourcePackPacket; +import net.minecraft.network.protocol.common.ServerboundResourcePackPacket.Action; import net.minecraft.network.protocol.cookie.ServerboundCookieResponsePacket; import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ClientInformation; import net.minecraft.util.VisibleForDebug; +import net.minecraft.util.profiling.Profiler; import org.jetbrains.annotations.Nullable; import org.slf4j.Logger; @@ -67,6 +69,12 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack } } + @Override + public void onPacketError(Packet packet, Exception exception) throws ReportedException { + ServerCommonPacketListener.super.onPacketError(packet, exception); + this.server.reportPacketHandlingException(exception, packet.type()); + } + @Override public void handleKeepAlive(ServerboundKeepAlivePacket packet) { if (this.keepAlivePending && packet.getId() == this.keepAliveChallenge) { @@ -89,7 +97,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack @Override public void handleResourcePackResponse(ServerboundResourcePackPacket packet) { PacketUtils.ensureRunningOnSameThread(packet, this, this.server); - if (packet.action() == ServerboundResourcePackPacket.Action.DECLINED && this.server.isResourcePackRequired()) { + if (packet.action() == Action.DECLINED && this.server.isResourcePackRequired()) { LOGGER.info("Disconnecting {} due to resource pack {} rejection", this.playerProfile().getName(), packet.id()); this.disconnect(Component.translatable("multiplayer.requiredTexturePrompt.disconnect")); } @@ -101,7 +109,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack } protected void keepConnectionAlive() { - this.server.getProfiler().push("keepAlive"); + Profiler.get().push("keepAlive"); long l = Util.getMillis(); if (!this.isSingleplayerOwner() && l - this.keepAliveTime >= 15000L) { if (this.keepAlivePending) { @@ -114,7 +122,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack } } - this.server.getProfiler().pop(); + Profiler.get().pop(); } private boolean checkIfClosed(long time) { diff --git a/net/minecraft/server/network/ServerConfigurationPacketListenerImpl.java b/net/minecraft/server/network/ServerConfigurationPacketListenerImpl.java index 261a5c3e..d7aa58a9 100644 --- a/net/minecraft/server/network/ServerConfigurationPacketListenerImpl.java +++ b/net/minecraft/server/network/ServerConfigurationPacketListenerImpl.java @@ -28,6 +28,7 @@ import net.minecraft.server.RegistryLayer; import net.minecraft.server.ServerLinks; import net.minecraft.server.level.ClientInformation; import net.minecraft.server.level.ServerPlayer; +import net.minecraft.server.network.ConfigurationTask.Type; import net.minecraft.server.network.config.JoinWorldTask; import net.minecraft.server.network.config.ServerResourcePackConfigurationTask; import net.minecraft.server.network.config.SynchronizeRegistriesTask; @@ -167,8 +168,8 @@ public class ServerConfigurationPacketListenerImpl extends ServerCommonPacketLis } } - private void finishCurrentTask(ConfigurationTask.Type taskType) { - ConfigurationTask.Type type = this.currentTask != null ? this.currentTask.type() : null; + private void finishCurrentTask(Type taskType) { + Type type = this.currentTask != null ? this.currentTask.type() : null; if (!taskType.equals(type)) { throw new IllegalStateException("Unexpected request for task finish, current task: " + type + ", requested: " + taskType); } else { diff --git a/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/net/minecraft/server/network/ServerGamePacketListenerImpl.java index 834646f1..519e0a7f 100644 --- a/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -9,7 +9,6 @@ import com.mojang.brigadier.StringReader; import com.mojang.brigadier.suggestion.Suggestions; import com.mojang.logging.LogUtils; import it.unimi.dsi.fastutil.ints.Int2ObjectMaps; -import it.unimi.dsi.fastutil.ints.Int2ObjectMap.Entry; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import java.net.SocketAddress; import java.util.Collections; @@ -33,7 +32,8 @@ import net.minecraft.advancements.CriteriaTriggers; import net.minecraft.commands.CommandSigningContext; import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.Commands; -import net.minecraft.commands.arguments.ArgumentSignatures; +import net.minecraft.commands.CommandSigningContext.SignedArguments; +import net.minecraft.commands.arguments.ArgumentSignatures.Entry; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.component.DataComponents; @@ -52,7 +52,11 @@ import net.minecraft.network.chat.PlayerChatMessage; import net.minecraft.network.chat.RemoteChatSession; import net.minecraft.network.chat.SignableCommand; import net.minecraft.network.chat.SignedMessageBody; -import net.minecraft.network.chat.SignedMessageChain; +import net.minecraft.network.chat.LastSeenMessages.Update; +import net.minecraft.network.chat.RemoteChatSession.Data; +import net.minecraft.network.chat.SignableCommand.Argument; +import net.minecraft.network.chat.SignedMessageChain.DecodeException; +import net.minecraft.network.chat.SignedMessageChain.Decoder; import net.minecraft.network.protocol.Packet; import net.minecraft.network.protocol.PacketUtils; import net.minecraft.network.protocol.common.ServerboundClientInformationPacket; @@ -61,13 +65,13 @@ import net.minecraft.network.protocol.configuration.ConfigurationProtocols; import net.minecraft.network.protocol.game.ClientboundBlockChangedAckPacket; import net.minecraft.network.protocol.game.ClientboundBlockUpdatePacket; import net.minecraft.network.protocol.game.ClientboundCommandSuggestionsPacket; -import net.minecraft.network.protocol.game.ClientboundContainerSetSlotPacket; import net.minecraft.network.protocol.game.ClientboundDisguisedChatPacket; import net.minecraft.network.protocol.game.ClientboundMoveVehiclePacket; +import net.minecraft.network.protocol.game.ClientboundPlaceGhostRecipePacket; import net.minecraft.network.protocol.game.ClientboundPlayerChatPacket; import net.minecraft.network.protocol.game.ClientboundPlayerInfoUpdatePacket; import net.minecraft.network.protocol.game.ClientboundPlayerPositionPacket; -import net.minecraft.network.protocol.game.ClientboundSetCarriedItemPacket; +import net.minecraft.network.protocol.game.ClientboundSetHeldSlotPacket; import net.minecraft.network.protocol.game.ClientboundStartConfigurationPacket; import net.minecraft.network.protocol.game.ClientboundSystemChatPacket; import net.minecraft.network.protocol.game.ClientboundTagQueryPacket; @@ -82,6 +86,7 @@ import net.minecraft.network.protocol.game.ServerboundChatPacket; import net.minecraft.network.protocol.game.ServerboundChatSessionUpdatePacket; import net.minecraft.network.protocol.game.ServerboundChunkBatchReceivedPacket; import net.minecraft.network.protocol.game.ServerboundClientCommandPacket; +import net.minecraft.network.protocol.game.ServerboundClientTickEndPacket; import net.minecraft.network.protocol.game.ServerboundCommandSuggestionPacket; import net.minecraft.network.protocol.game.ServerboundConfigurationAcknowledgedPacket; import net.minecraft.network.protocol.game.ServerboundContainerButtonClickPacket; @@ -107,6 +112,7 @@ import net.minecraft.network.protocol.game.ServerboundRecipeBookChangeSettingsPa import net.minecraft.network.protocol.game.ServerboundRecipeBookSeenRecipePacket; import net.minecraft.network.protocol.game.ServerboundRenameItemPacket; import net.minecraft.network.protocol.game.ServerboundSeenAdvancementsPacket; +import net.minecraft.network.protocol.game.ServerboundSelectBundleItemPacket; import net.minecraft.network.protocol.game.ServerboundSelectTradePacket; import net.minecraft.network.protocol.game.ServerboundSetBeaconPacket; import net.minecraft.network.protocol.game.ServerboundSetCarriedItemPacket; @@ -120,6 +126,8 @@ import net.minecraft.network.protocol.game.ServerboundSwingPacket; import net.minecraft.network.protocol.game.ServerboundTeleportToEntityPacket; import net.minecraft.network.protocol.game.ServerboundUseItemOnPacket; import net.minecraft.network.protocol.game.ServerboundUseItemPacket; +import net.minecraft.network.protocol.game.ServerboundInteractPacket.Handler; +import net.minecraft.network.protocol.game.ServerboundSeenAdvancementsPacket.Action; import net.minecraft.network.protocol.ping.ClientboundPongResponsePacket; import net.minecraft.network.protocol.ping.ServerboundPingRequestPacket; import net.minecraft.resources.ResourceKey; @@ -131,6 +139,7 @@ import net.minecraft.util.FutureChain; import net.minecraft.util.Mth; import net.minecraft.util.SignatureValidator; import net.minecraft.util.StringUtil; +import net.minecraft.util.TickThrottler; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.effect.MobEffects; @@ -140,14 +149,15 @@ import net.minecraft.world.entity.HasCustomInventoryScreen; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.MoverType; import net.minecraft.world.entity.PlayerRideableJumping; -import net.minecraft.world.entity.RelativeMovement; +import net.minecraft.world.entity.PositionMoveRotation; +import net.minecraft.world.entity.Relative; import net.minecraft.world.entity.item.ItemEntity; import net.minecraft.world.entity.player.ChatVisiblity; import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.player.ProfilePublicKey; import net.minecraft.world.entity.projectile.AbstractArrow; -import net.minecraft.world.entity.vehicle.Boat; +import net.minecraft.world.entity.vehicle.AbstractBoat; import net.minecraft.world.inventory.AnvilMenu; import net.minecraft.world.inventory.BeaconMenu; import net.minecraft.world.inventory.CrafterMenu; @@ -161,6 +171,8 @@ import net.minecraft.world.item.Items; import net.minecraft.world.item.component.CustomData; import net.minecraft.world.item.component.WritableBookContent; import net.minecraft.world.item.component.WrittenBookContent; +import net.minecraft.world.item.crafting.RecipeHolder; +import net.minecraft.world.item.crafting.RecipeManager; import net.minecraft.world.level.BaseCommandBlock; import net.minecraft.world.level.GameRules; import net.minecraft.world.level.GameType; @@ -201,11 +213,8 @@ public class ServerGamePacketListenerImpl public final PlayerChunkSender chunkSender; private int tickCount; private int ackBlockChangesUpTo = -1; - /** - * Incremented by 20 each time a user sends a chat message, decreased by one every tick. Non-ops kicked when over 200 - */ - private int chatSpamTickCount; - private int dropSpamTickCount; + private final TickThrottler chatSpamThrottler = new TickThrottler(20, 200); + private final TickThrottler dropSpamThrottler = new TickThrottler(20, 1480); private double firstGoodX; private double firstGoodY; private double firstGoodZ; @@ -233,9 +242,10 @@ public class ServerGamePacketListenerImpl private int aboveGroundVehicleTickCount; private int receivedMovePacketCount; private int knownMovePacketCount; + private boolean receivedMovementThisTick; @Nullable private RemoteChatSession chatSession; - private SignedMessageChain.Decoder signedMessageDecoder; + private Decoder signedMessageDecoder; private final LastSeenMessagesValidator lastSeenMessages = new LastSeenMessagesValidator(20); private final MessageSignatureCache messageSignatureCache = MessageSignatureCache.createDefault(); private final FutureChain chatMessageChain; @@ -247,7 +257,7 @@ public class ServerGamePacketListenerImpl this.player = player; player.connection = this; player.getTextFilter().join(); - this.signedMessageDecoder = SignedMessageChain.Decoder.unsigned(player.getUUID(), server::enforceSecureProfile); + this.signedMessageDecoder = Decoder.unsigned(player.getUUID(), server::enforceSecureProfile); this.chatMessageChain = new FutureChain(server); } @@ -302,14 +312,8 @@ public class ServerGamePacketListenerImpl } this.keepConnectionAlive(); - if (this.chatSpamTickCount > 0) { - this.chatSpamTickCount--; - } - - if (this.dropSpamTickCount > 0) { - this.dropSpamTickCount--; - } - + this.chatSpamThrottler.tick(); + this.dropSpamThrottler.tick(); if (this.player.getLastActionTime() > 0L && this.server.getPlayerIdleTimeout() > 0 && Util.getMillis() - this.player.getLastActionTime() > this.server.getPlayerIdleTimeout() * 1000L * 60L) { @@ -375,7 +379,7 @@ public class ServerGamePacketListenerImpl @Override public void handlePlayerInput(ServerboundPlayerInputPacket packet) { PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); - this.player.setPlayerInput(packet.getXxa(), packet.getZza(), packet.isJumping(), packet.isShiftKeyDown()); + this.player.setLastClientInput(packet.input()); } private static boolean containsInvalidValues(double x, double y, double z, float yRot, float xRot) { @@ -451,8 +455,9 @@ public class ServerGamePacketListenerImpl } this.player.serverLevel().getChunkSource().move(this.player); + entity.recordMovementThroughBlocks(new Vec3(d, e, f), entity.position()); Vec3 vec3 = new Vec3(entity.getX() - d, entity.getY() - e, entity.getZ() - f); - this.player.setKnownMovement(vec3); + this.handlePlayerKnownMovement(vec3); this.player.checkMovementStatistics(vec3.x, vec3.y, vec3.z); this.clientVehicleIsFloating = m >= -0.03125 && !bl2 && !this.server.isFlightAllowed() && !entity.isNoGravity() && this.noBlocksAround(entity); this.vehicleLastGoodX = entity.getX(); @@ -493,7 +498,15 @@ public class ServerGamePacketListenerImpl @Override public void handleRecipeBookSeenRecipePacket(ServerboundRecipeBookSeenRecipePacket packet) { PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); - this.server.getRecipeManager().byKey(packet.getRecipe()).ifPresent(this.player.getRecipeBook()::removeHighlight); + RecipeManager.ServerDisplayInfo serverDisplayInfo = this.server.getRecipeManager().getRecipeFromDisplay(packet.recipe()); + if (serverDisplayInfo != null) { + this.player.getRecipeBook().removeHighlight(serverDisplayInfo.parent().id()); + } + } + + @Override + public void handleBundleItemSelectedPacket(ServerboundSelectBundleItemPacket serverboundSelectBundleItemPacket) { + this.player.containerMenu.setSelectedBundleItemIndex(serverboundSelectBundleItemPacket.slotId(), serverboundSelectBundleItemPacket.selectedItemIndex()); } @Override @@ -505,7 +518,7 @@ public class ServerGamePacketListenerImpl @Override public void handleSeenAdvancements(ServerboundSeenAdvancementsPacket packet) { PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); - if (packet.getAction() == ServerboundSeenAdvancementsPacket.Action.OPENED_TAB) { + if (packet.getAction() == Action.OPENED_TAB) { ResourceLocation resourceLocation = (ResourceLocation)Objects.requireNonNull(packet.getTab()); AdvancementHolder advancementHolder = this.server.getAdvancements().get(resourceLocation); if (advancementHolder != null) { @@ -618,13 +631,10 @@ public class ServerGamePacketListenerImpl public void handlePickItem(ServerboundPickItemPacket packet) { PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); this.player.getInventory().pickSlot(packet.getSlot()); - this.player - .connection - .send( - new ClientboundContainerSetSlotPacket(-2, 0, this.player.getInventory().selected, this.player.getInventory().getItem(this.player.getInventory().selected)) - ); - this.player.connection.send(new ClientboundContainerSetSlotPacket(-2, 0, packet.getSlot(), this.player.getInventory().getItem(packet.getSlot()))); - this.player.connection.send(new ClientboundSetCarriedItemPacket(this.player.getInventory().selected)); + int i = this.player.getInventory().selected; + this.player.connection.send(this.player.getInventory().createInventoryUpdatePacket(i)); + this.player.connection.send(this.player.getInventory().createInventoryUpdatePacket(packet.getSlot())); + this.player.connection.send(new ClientboundSetHeldSlotPacket(i)); } @Override @@ -758,7 +768,7 @@ public class ServerGamePacketListenerImpl List list = Lists.newArrayList(); Optional optional = packet.title(); optional.ifPresent(list::add); - packet.pages().stream().limit(100L).forEach(list::add); + list.addAll(packet.pages()); Consumer> consumer = optional.isPresent() ? listx -> this.signBook((FilteredText)listx.get(0), listx.subList(1, listx.size()), i) : listx -> this.updateBookContents(listx, i); @@ -768,7 +778,7 @@ public class ServerGamePacketListenerImpl private void updateBookContents(List pages, int index) { ItemStack itemStack = this.player.getInventory().getItem(index); - if (itemStack.is(Items.WRITABLE_BOOK)) { + if (itemStack.has(DataComponents.WRITABLE_BOOK_CONTENT)) { List> list = pages.stream().map(this::filterableFromOutgoing).toList(); itemStack.set(DataComponents.WRITABLE_BOOK_CONTENT, new WritableBookContent(list)); } @@ -776,7 +786,7 @@ public class ServerGamePacketListenerImpl private void signBook(FilteredText title, List pages, int index) { ItemStack itemStack = this.player.getInventory().getItem(index); - if (itemStack.is(Items.WRITABLE_BOOK)) { + if (itemStack.has(DataComponents.WRITABLE_BOOK_CONTENT)) { ItemStack itemStack2 = itemStack.transmuteCopy(Items.WRITTEN_BOOK); itemStack2.remove(DataComponents.WRITABLE_BOOK_CONTENT); List> list = pages.stream().map(filteredText -> this.filterableFromOutgoing(filteredText).map(Component::literal)).toList(); @@ -867,9 +877,9 @@ public class ServerGamePacketListenerImpl q = 1; } - if (!this.player.isChangingDimension() && (!this.player.level().getGameRules().getBoolean(GameRules.RULE_DISABLE_ELYTRA_MOVEMENT_CHECK) || !bl)) { + if (this.shouldCheckPlayerMovement(bl)) { float r = bl ? 300.0F : 100.0F; - if (p - o > r * q && !this.isSingleplayerOwner()) { + if (p - o > r * q) { LOGGER.warn("{} moved too quickly! {},{},{}", this.player.getName().getString(), l, m, n); this.teleport(this.player.getX(), this.player.getY(), this.player.getZ(), this.player.getYRot(), this.player.getXRot()); return; @@ -922,9 +932,10 @@ public class ServerGamePacketListenerImpl && this.noBlocksAround(this.player); this.player.serverLevel().getChunkSource().move(this.player); Vec3 vec3 = new Vec3(this.player.getX() - i, this.player.getY() - j, this.player.getZ() - k); - this.player.setOnGroundWithMovement(packet.isOnGround(), vec3); + this.player.setOnGroundWithMovement(packet.isOnGround(), packet.horizontalCollision(), vec3); this.player.doCheckFallDamage(this.player.getX() - i, this.player.getY() - j, this.player.getZ() - k, packet.isOnGround()); - this.player.setKnownMovement(vec3); + this.player.recordMovementThroughBlocks(new Vec3(i, j, k), this.player.position()); + this.handlePlayerKnownMovement(vec3); if (bl2) { this.player.resetFallDistance(); } @@ -948,6 +959,19 @@ public class ServerGamePacketListenerImpl } } + private boolean shouldCheckPlayerMovement(boolean bl) { + if (this.isSingleplayerOwner()) { + return false; + } else if (this.player.isChangingDimension()) { + return false; + } else { + GameRules gameRules = this.player.serverLevel().getGameRules(); + return gameRules.getBoolean(GameRules.RULE_DISABLE_PLAYER_MOVEMENT_CHECK) + ? false + : !bl || !gameRules.getBoolean(GameRules.RULE_DISABLE_ELYTRA_MOVEMENT_CHECK); + } + } + private boolean updateAwaitingTeleport() { if (this.awaitingPositionFromClient != null) { if (this.tickCount - this.awaitingTeleportTime > 20) { @@ -979,26 +1003,18 @@ public class ServerGamePacketListenerImpl } public void teleport(double x, double y, double z, float yaw, float pitch) { - this.teleport(x, y, z, yaw, pitch, Collections.emptySet()); + this.teleport(new PositionMoveRotation(new Vec3(x, y, z), Vec3.ZERO, yaw, pitch), Collections.emptySet()); } - /** - * Teleports the player position to the (relative) values specified, and syncs to the client - */ - public void teleport(double x, double y, double z, float yaw, float pitch, Set relativeSet) { - double d = relativeSet.contains(RelativeMovement.X) ? this.player.getX() : 0.0; - double e = relativeSet.contains(RelativeMovement.Y) ? this.player.getY() : 0.0; - double f = relativeSet.contains(RelativeMovement.Z) ? this.player.getZ() : 0.0; - float g = relativeSet.contains(RelativeMovement.Y_ROT) ? this.player.getYRot() : 0.0F; - float h = relativeSet.contains(RelativeMovement.X_ROT) ? this.player.getXRot() : 0.0F; - this.awaitingPositionFromClient = new Vec3(x, y, z); + public void teleport(PositionMoveRotation positionMoveRotation, Set set) { + this.awaitingTeleportTime = this.tickCount; if (++this.awaitingTeleport == Integer.MAX_VALUE) { this.awaitingTeleport = 0; } - this.awaitingTeleportTime = this.tickCount; - this.player.absMoveTo(x, y, z, yaw, pitch); - this.player.connection.send(new ClientboundPlayerPositionPacket(x - d, y - e, z - f, yaw - g, pitch - h, relativeSet, this.awaitingTeleport)); + this.player.teleportSetPosition(positionMoveRotation, set); + this.awaitingPositionFromClient = this.player.position(); + this.player.connection.send(ClientboundPlayerPositionPacket.of(this.awaitingTeleport, positionMoveRotation, set)); } @Override @@ -1006,7 +1022,7 @@ public class ServerGamePacketListenerImpl PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); BlockPos blockPos = packet.getPos(); this.player.resetLastActionTime(); - ServerboundPlayerActionPacket.Action action = packet.getAction(); + net.minecraft.network.protocol.game.ServerboundPlayerActionPacket.Action action = packet.getAction(); switch (action) { case SWAP_ITEM_WITH_OFFHAND: if (!this.player.isSpectator()) { @@ -1035,7 +1051,7 @@ public class ServerGamePacketListenerImpl case START_DESTROY_BLOCK: case ABORT_DESTROY_BLOCK: case STOP_DESTROY_BLOCK: - this.player.gameMode.handleBlockBreakAction(blockPos, action, packet.getDirection(), this.player.level().getMaxBuildHeight(), packet.getSequence()); + this.player.gameMode.handleBlockBreakAction(blockPos, action, packet.getDirection(), this.player.level().getMaxY(), packet.getSequence()); this.player.connection.ackBlockChangesUpTo(packet.getSequence()); return; default: @@ -1048,7 +1064,7 @@ public class ServerGamePacketListenerImpl return false; } else { Item item = stack.getItem(); - return (item instanceof BlockItem || item instanceof BucketItem) && !player.getCooldowns().isOnCooldown(item); + return (item instanceof BlockItem || item instanceof BucketItem) && !player.getCooldowns().isOnCooldown(stack); } } @@ -1069,23 +1085,23 @@ public class ServerGamePacketListenerImpl if (Math.abs(vec32.x()) < 1.0000001 && Math.abs(vec32.y()) < 1.0000001 && Math.abs(vec32.z()) < 1.0000001) { Direction direction = blockHitResult.getDirection(); this.player.resetLastActionTime(); - int i = this.player.level().getMaxBuildHeight(); - if (blockPos.getY() < i) { + int i = this.player.level().getMaxY(); + if (blockPos.getY() <= i) { if (this.awaitingPositionFromClient == null && serverLevel.mayInteract(this.player, blockPos)) { InteractionResult interactionResult = this.player.gameMode.useItemOn(this.player, serverLevel, itemStack, interactionHand, blockHitResult); if (interactionResult.consumesAction()) { CriteriaTriggers.ANY_BLOCK_USE.trigger(this.player, blockHitResult.getBlockPos(), itemStack.copy()); } - if (direction == Direction.UP && !interactionResult.consumesAction() && blockPos.getY() >= i - 1 && wasBlockPlacementAttempt(this.player, itemStack)) { - Component component = Component.translatable("build.tooHigh", i - 1).withStyle(ChatFormatting.RED); + if (direction == Direction.UP && !interactionResult.consumesAction() && blockPos.getY() >= i && wasBlockPlacementAttempt(this.player, itemStack)) { + Component component = Component.translatable("build.tooHigh", i).withStyle(ChatFormatting.RED); this.player.sendSystemMessage(component, true); - } else if (interactionResult.shouldSwing()) { + } else if (interactionResult instanceof InteractionResult.Success success && success.swingSource() == InteractionResult.SwingSource.SERVER) { this.player.swing(interactionHand, true); } } } else { - Component component2 = Component.translatable("build.tooHigh", i - 1).withStyle(ChatFormatting.RED); + Component component2 = Component.translatable("build.tooHigh", i).withStyle(ChatFormatting.RED); this.player.sendSystemMessage(component2, true); } @@ -1113,8 +1129,8 @@ public class ServerGamePacketListenerImpl this.player.absRotateTo(f, g); } - InteractionResult interactionResult = this.player.gameMode.useItem(this.player, serverLevel, itemStack, interactionHand); - if (interactionResult.shouldSwing()) { + if (this.player.gameMode.useItem(this.player, serverLevel, itemStack, interactionHand) instanceof InteractionResult.Success success + && success.swingSource() == InteractionResult.SwingSource.SERVER) { this.player.swing(interactionHand, true); } } @@ -1127,7 +1143,7 @@ public class ServerGamePacketListenerImpl for (ServerLevel serverLevel : this.server.getAllLevels()) { Entity entity = packet.getEntity(serverLevel); if (entity != null) { - this.player.teleportTo(serverLevel, entity.getX(), entity.getY(), entity.getZ(), entity.getYRot(), entity.getXRot()); + this.player.teleportTo(serverLevel, entity.getX(), entity.getY(), entity.getZ(), Set.of(), entity.getYRot(), entity.getXRot(), true); return; } } @@ -1137,8 +1153,8 @@ public class ServerGamePacketListenerImpl @Override public void handlePaddleBoat(ServerboundPaddleBoatPacket packet) { PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); - if (this.player.getControlledVehicle() instanceof Boat boat) { - boat.setPaddleState(packet.getLeft(), packet.getRight()); + if (this.player.getControlledVehicle() instanceof AbstractBoat abstractBoat) { + abstractBoat.setPaddleState(packet.getLeft(), packet.getRight()); } } @@ -1191,7 +1207,7 @@ public class ServerGamePacketListenerImpl PlayerChatMessage playerChatMessage; try { playerChatMessage = this.getSignedMessage(packet, (LastSeenMessages)optional.get()); - } catch (SignedMessageChain.DecodeException var6) { + } catch (DecodeException var6) { this.handleMessageDecodeFailure(var6); return; } @@ -1241,33 +1257,33 @@ public class ServerGamePacketListenerImpl Map map; try { map = this.collectSignedArguments(packet, SignableCommand.of(parseResults), lastSeenMessages); - } catch (SignedMessageChain.DecodeException var6) { + } catch (DecodeException var6) { this.handleMessageDecodeFailure(var6); return; } - CommandSigningContext commandSigningContext = new CommandSigningContext.SignedArguments(map); + CommandSigningContext commandSigningContext = new SignedArguments(map); parseResults = Commands.mapSource(parseResults, commandSourceStack -> commandSourceStack.withSigningContext(commandSigningContext, this.chatMessageChain)); this.server.getCommands().performCommand(parseResults, packet.command()); } - private void handleMessageDecodeFailure(SignedMessageChain.DecodeException exception) { + private void handleMessageDecodeFailure(DecodeException exception) { LOGGER.warn("Failed to update secure chat state for {}: '{}'", this.player.getGameProfile().getName(), exception.getComponent().getString()); this.player.sendSystemMessage(exception.getComponent().copy().withStyle(ChatFormatting.RED)); } private Map collectSignedArguments( ServerboundChatCommandSignedPacket packet, SignableCommand command, LastSeenMessages lastSeenMessages - ) throws SignedMessageChain.DecodeException { - List list = packet.argumentSignatures().entries(); - List> list2 = command.arguments(); + ) throws DecodeException { + List list = packet.argumentSignatures().entries(); + List> list2 = command.arguments(); if (list.isEmpty()) { return this.collectUnsignedArguments(list2); } else { Map map = new Object2ObjectOpenHashMap<>(); - for (ArgumentSignatures.Entry entry : list) { - SignableCommand.Argument argument = command.getArgument(entry.name()); + for (Entry entry : list) { + Argument argument = command.getArgument(entry.name()); if (argument == null) { this.signedMessageDecoder.setChainBroken(); throw createSignedArgumentMismatchException(packet.command(), list, list2); @@ -1277,7 +1293,7 @@ public class ServerGamePacketListenerImpl map.put(argument.name(), this.signedMessageDecoder.unpack(entry.signature(), signedMessageBody)); } - for (SignableCommand.Argument argument2 : list2) { + for (Argument argument2 : list2) { if (!map.containsKey(argument2.name())) { throw createSignedArgumentMismatchException(packet.command(), list, list2); } @@ -1287,10 +1303,10 @@ public class ServerGamePacketListenerImpl } } - private Map collectUnsignedArguments(List> arguments) throws SignedMessageChain.DecodeException { + private Map collectUnsignedArguments(List> arguments) throws DecodeException { Map map = new HashMap(); - for (SignableCommand.Argument argument : arguments) { + for (Argument argument : arguments) { SignedMessageBody signedMessageBody = SignedMessageBody.unsigned(argument.value()); map.put(argument.name(), this.signedMessageDecoder.unpack(null, signedMessageBody)); } @@ -1298,13 +1314,11 @@ public class ServerGamePacketListenerImpl return map; } - private static SignedMessageChain.DecodeException createSignedArgumentMismatchException( - String command, List signedArguments, List> unsignedArguments - ) { - String string = (String)signedArguments.stream().map(ArgumentSignatures.Entry::name).collect(Collectors.joining(", ")); - String string2 = (String)unsignedArguments.stream().map(SignableCommand.Argument::name).collect(Collectors.joining(", ")); + private static DecodeException createSignedArgumentMismatchException(String command, List signedArguments, List> unsignedArguments) { + String string = (String)signedArguments.stream().map(Entry::name).collect(Collectors.joining(", ")); + String string2 = (String)unsignedArguments.stream().map(Argument::name).collect(Collectors.joining(", ")); LOGGER.error("Signed command mismatch between server and client ('{}'): got [{}] from client, but expected [{}]", command, string, string2); - return new SignedMessageChain.DecodeException(INVALID_COMMAND_SIGNATURE); + return new DecodeException(INVALID_COMMAND_SIGNATURE); } private ParseResults parseCommand(String command) { @@ -1323,7 +1337,7 @@ public class ServerGamePacketListenerImpl } } - private Optional unpackAndApplyLastSeen(LastSeenMessages.Update update) { + private Optional unpackAndApplyLastSeen(Update update) { synchronized (this.lastSeenMessages) { Optional optional = this.lastSeenMessages.applyUpdate(update); if (optional.isEmpty()) { @@ -1345,7 +1359,7 @@ public class ServerGamePacketListenerImpl return false; } - private PlayerChatMessage getSignedMessage(ServerboundChatPacket packet, LastSeenMessages lastSeenMessages) throws SignedMessageChain.DecodeException { + private PlayerChatMessage getSignedMessage(ServerboundChatPacket packet, LastSeenMessages lastSeenMessages) throws DecodeException { SignedMessageBody signedMessageBody = new SignedMessageBody(packet.message(), packet.timeStamp(), packet.salt(), lastSeenMessages); return this.signedMessageDecoder.unpack(packet.signature(), signedMessageBody); } @@ -1356,8 +1370,8 @@ public class ServerGamePacketListenerImpl } private void detectRateSpam() { - this.chatSpamTickCount += 20; - if (this.chatSpamTickCount > 200 + this.chatSpamThrottler.increment(); + if (!this.chatSpamThrottler.isUnderThreshold() && !this.server.getPlayerList().isOp(this.player.getGameProfile()) && !this.server.isSingleplayerOwner(this.player.getGameProfile())) { this.disconnect(Component.translatable("disconnect.spam")); @@ -1496,18 +1510,17 @@ public class ServerGamePacketListenerImpl } AABB aABB = entity.getBoundingBox(); - if (this.player.canInteractWithEntity(aABB, 1.0)) { + if (this.player.canInteractWithEntity(aABB, 3.0)) { packet.dispatch( - new ServerboundInteractPacket.Handler() { + new Handler() { private void performInteraction(InteractionHand hand, ServerGamePacketListenerImpl.EntityInteraction entityInteraction) { ItemStack itemStack = ServerGamePacketListenerImpl.this.player.getItemInHand(hand); if (itemStack.isItemEnabled(serverLevel.enabledFeatures())) { ItemStack itemStack2 = itemStack.copy(); - InteractionResult interactionResult = entityInteraction.run(ServerGamePacketListenerImpl.this.player, entity, hand); - if (interactionResult.consumesAction()) { - CriteriaTriggers.PLAYER_INTERACTED_WITH_ENTITY - .trigger(ServerGamePacketListenerImpl.this.player, interactionResult.indicateItemUse() ? itemStack2 : ItemStack.EMPTY, entity); - if (interactionResult.shouldSwing()) { + if (entityInteraction.run(ServerGamePacketListenerImpl.this.player, entity, hand) instanceof InteractionResult.Success success) { + ItemStack itemStack3 = success.wasItemInteraction() ? itemStack2 : ItemStack.EMPTY; + CriteriaTriggers.PLAYER_INTERACTED_WITH_ENTITY.trigger(ServerGamePacketListenerImpl.this.player, itemStack3, entity); + if (success.swingSource() == InteractionResult.SwingSource.SERVER) { ServerGamePacketListenerImpl.this.player.swing(hand, true); } } @@ -1549,12 +1562,13 @@ public class ServerGamePacketListenerImpl public void handleClientCommand(ServerboundClientCommandPacket packet) { PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); this.player.resetLastActionTime(); - ServerboundClientCommandPacket.Action action = packet.getAction(); + net.minecraft.network.protocol.game.ServerboundClientCommandPacket.Action action = packet.getAction(); switch (action) { case PERFORM_RESPAWN: if (this.player.wonGame) { this.player.wonGame = false; this.player = this.server.getPlayerList().respawn(this.player, true, Entity.RemovalReason.CHANGED_DIMENSION); + this.resetPosition(); CriteriaTriggers.CHANGED_DIMENSION.trigger(this.player, Level.END, Level.OVERWORLD); } else { if (this.player.getHealth() > 0.0F) { @@ -1562,9 +1576,10 @@ public class ServerGamePacketListenerImpl } this.player = this.server.getPlayerList().respawn(this.player, false, Entity.RemovalReason.KILLED); + this.resetPosition(); if (this.server.isHardcore()) { this.player.setGameMode(GameType.SPECTATOR); - this.player.level().getGameRules().getRule(GameRules.RULE_SPECTATORSGENERATECHUNKS).set(false, this.server); + this.player.serverLevel().getGameRules().getRule(GameRules.RULE_SPECTATORSGENERATECHUNKS).set(false, this.server); } } break; @@ -1597,7 +1612,7 @@ public class ServerGamePacketListenerImpl this.player.containerMenu.suppressRemoteUpdates(); this.player.containerMenu.clicked(i, packet.getButtonNum(), packet.getClickType(), this.player); - for (Entry entry : Int2ObjectMaps.fastIterable(packet.getChangedSlots())) { + for (it.unimi.dsi.fastutil.ints.Int2ObjectMap.Entry entry : Int2ObjectMaps.fastIterable(packet.getChangedSlots())) { this.player.containerMenu.setRemoteSlotNoCopy(entry.getIntKey(), (ItemStack)entry.getValue()); } @@ -1617,14 +1632,29 @@ public class ServerGamePacketListenerImpl public void handlePlaceRecipe(ServerboundPlaceRecipePacket packet) { PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); this.player.resetLastActionTime(); - if (!this.player.isSpectator() && this.player.containerMenu.containerId == packet.getContainerId() && this.player.containerMenu instanceof RecipeBookMenu) { + if (!this.player.isSpectator() && this.player.containerMenu.containerId == packet.containerId()) { if (!this.player.containerMenu.stillValid(this.player)) { LOGGER.debug("Player {} interacted with invalid menu {}", this.player, this.player.containerMenu); } else { - this.server - .getRecipeManager() - .byKey(packet.getRecipe()) - .ifPresent(recipeHolder -> ((RecipeBookMenu)this.player.containerMenu).handlePlacement(packet.isShiftDown(), recipeHolder, this.player)); + RecipeManager.ServerDisplayInfo serverDisplayInfo = this.server.getRecipeManager().getRecipeFromDisplay(packet.recipe()); + if (serverDisplayInfo != null) { + RecipeHolder recipeHolder = serverDisplayInfo.parent(); + if (this.player.getRecipeBook().contains(recipeHolder.id())) { + if (this.player.containerMenu instanceof RecipeBookMenu recipeBookMenu) { + if (recipeHolder.value().placementInfo().isImpossibleToPlace()) { + LOGGER.debug("Player {} tried to place impossible recipe {}", this.player, recipeHolder.id().location()); + return; + } + + RecipeBookMenu.PostPlaceAction postPlaceAction = recipeBookMenu.handlePlacement( + packet.useMaxItems(), this.player.isCreative(), recipeHolder, this.player.serverLevel(), this.player.getInventory() + ); + if (postPlaceAction == RecipeBookMenu.PostPlaceAction.PLACE_GHOST_RECIPE) { + this.player.connection.send(new ClientboundPlaceGhostRecipePacket(this.player.containerMenu.containerId, serverDisplayInfo.display().display())); + } + } + } + } } } } @@ -1651,6 +1681,7 @@ public class ServerGamePacketListenerImpl if (this.player.gameMode.isCreative()) { boolean bl = packet.slotNum() < 0; ItemStack itemStack = packet.itemStack(); + ItemStack itemStack2 = itemStack.copy(); if (!itemStack.isItemEnabled(this.player.level().enabledFeatures())) { return; } @@ -1670,10 +1701,15 @@ public class ServerGamePacketListenerImpl boolean bl3 = itemStack.isEmpty() || itemStack.getCount() <= itemStack.getMaxStackSize(); if (bl2 && bl3) { this.player.inventoryMenu.getSlot(packet.slotNum()).setByPlayer(itemStack); + this.player.inventoryMenu.setRemoteSlot(packet.slotNum(), itemStack2); this.player.inventoryMenu.broadcastChanges(); - } else if (bl && bl3 && this.dropSpamTickCount < 200) { - this.dropSpamTickCount += 20; - this.player.drop(itemStack, true); + } else if (bl && bl3) { + if (this.dropSpamThrottler.isUnderThreshold()) { + this.dropSpamThrottler.increment(); + this.player.drop(itemStack, true); + } else { + LOGGER.warn("Player {} was dropping items too fast in creative mode, ignoring.", this.player.getName().getString()); + } } } } @@ -1728,7 +1764,7 @@ public class ServerGamePacketListenerImpl @Override public void handleChatSessionUpdate(ServerboundChatSessionUpdatePacket packet) { PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); - RemoteChatSession.Data data = packet.chatSession(); + Data data = packet.chatSession(); ProfilePublicKey.Data data2 = this.chatSession != null ? this.chatSession.profilePublicKey().data() : null; ProfilePublicKey.Data data3 = data.profilePublicKey(); if (!Objects.equals(data2, data3)) { @@ -1794,6 +1830,25 @@ public class ServerGamePacketListenerImpl public void handleCustomPayload(ServerboundCustomPayloadPacket packet) { } + @Override + public void handleClientTickEnd(ServerboundClientTickEndPacket serverboundClientTickEndPacket) { + PacketUtils.ensureRunningOnSameThread(serverboundClientTickEndPacket, this, this.player.serverLevel()); + if (!this.receivedMovementThisTick) { + this.player.setKnownMovement(Vec3.ZERO); + } + + this.receivedMovementThisTick = false; + } + + private void handlePlayerKnownMovement(Vec3 vec3) { + if (vec3.lengthSqr() > 1.0E-5F) { + this.player.resetLastActionTime(); + } + + this.player.setKnownMovement(vec3); + this.receivedMovementThisTick = true; + } + @Override public ServerPlayer getPlayer() { return this.player; diff --git a/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/net/minecraft/server/network/ServerLoginPacketListenerImpl.java index 794a8e46..2d84d747 100644 --- a/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/net/minecraft/server/network/ServerLoginPacketListenerImpl.java @@ -26,10 +26,10 @@ import net.minecraft.network.TickablePacketListener; import net.minecraft.network.chat.Component; import net.minecraft.network.protocol.configuration.ConfigurationProtocols; import net.minecraft.network.protocol.cookie.ServerboundCookieResponsePacket; -import net.minecraft.network.protocol.login.ClientboundGameProfilePacket; import net.minecraft.network.protocol.login.ClientboundHelloPacket; import net.minecraft.network.protocol.login.ClientboundLoginCompressionPacket; import net.minecraft.network.protocol.login.ClientboundLoginDisconnectPacket; +import net.minecraft.network.protocol.login.ClientboundLoginFinishedPacket; import net.minecraft.network.protocol.login.ServerLoginPacketListener; import net.minecraft.network.protocol.login.ServerboundCustomQueryAnswerPacket; import net.minecraft.network.protocol.login.ServerboundHelloPacket; @@ -164,7 +164,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener, private void finishLoginAndWaitForClient(GameProfile profile) { this.state = ServerLoginPacketListenerImpl.State.PROTOCOL_SWITCHING; - this.connection.send(new ClientboundGameProfilePacket(profile, true)); + this.connection.send(new ClientboundLoginFinishedPacket(profile)); } @Override diff --git a/net/minecraft/server/network/ServerTextFilter.java b/net/minecraft/server/network/ServerTextFilter.java new file mode 100644 index 00000000..3dcc91bf --- /dev/null +++ b/net/minecraft/server/network/ServerTextFilter.java @@ -0,0 +1,295 @@ +package net.minecraft.server.network; + +import com.google.common.collect.ImmutableList; +import com.google.gson.JsonArray; +import com.google.gson.JsonObject; +import com.google.gson.internal.Streams; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.mojang.authlib.GameProfile; +import com.mojang.logging.LogUtils; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.OutputStreamWriter; +import java.net.HttpURLConnection; +import java.net.MalformedURLException; +import java.net.URI; +import java.net.URL; +import java.nio.charset.StandardCharsets; +import java.util.List; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.Executor; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.ThreadFactory; +import java.util.concurrent.atomic.AtomicInteger; +import net.minecraft.SharedConstants; +import net.minecraft.Util; +import net.minecraft.network.chat.FilterMask; +import net.minecraft.server.dedicated.DedicatedServerProperties; +import net.minecraft.util.GsonHelper; +import net.minecraft.util.StringUtil; +import net.minecraft.util.thread.ConsecutiveExecutor; +import org.jetbrains.annotations.Nullable; +import org.slf4j.Logger; + +public abstract class ServerTextFilter implements AutoCloseable { + protected static final Logger LOGGER = LogUtils.getLogger(); + private static final AtomicInteger WORKER_COUNT = new AtomicInteger(1); + private static final ThreadFactory THREAD_FACTORY = runnable -> { + Thread thread = new Thread(runnable); + thread.setName("Chat-Filter-Worker-" + WORKER_COUNT.getAndIncrement()); + return thread; + }; + private final URL chatEndpoint; + private final ServerTextFilter.MessageEncoder chatEncoder; + final ServerTextFilter.IgnoreStrategy chatIgnoreStrategy; + final ExecutorService workerPool; + + protected static ExecutorService createWorkerPool(int i) { + return Executors.newFixedThreadPool(i, THREAD_FACTORY); + } + + protected ServerTextFilter( + URL uRL, ServerTextFilter.MessageEncoder messageEncoder, ServerTextFilter.IgnoreStrategy ignoreStrategy, ExecutorService executorService + ) { + this.chatIgnoreStrategy = ignoreStrategy; + this.workerPool = executorService; + this.chatEndpoint = uRL; + this.chatEncoder = messageEncoder; + } + + protected static URL getEndpoint(URI uRI, @Nullable JsonObject jsonObject, String string, String string2) throws MalformedURLException { + String string3 = getEndpointFromConfig(jsonObject, string, string2); + return uRI.resolve("/" + string3).toURL(); + } + + protected static String getEndpointFromConfig(@Nullable JsonObject jsonObject, String string, String string2) { + return jsonObject != null ? GsonHelper.getAsString(jsonObject, string, string2) : string2; + } + + @Nullable + public static ServerTextFilter createFromConfig(DedicatedServerProperties dedicatedServerProperties) { + String string = dedicatedServerProperties.textFilteringConfig; + if (StringUtil.isBlank(string)) { + return null; + } else { + return switch (dedicatedServerProperties.textFilteringVersion) { + case 0 -> LegacyTextFilter.createTextFilterFromConfig(string); + case 1 -> PlayerSafetyServiceTextFilter.createTextFilterFromConfig(string); + default -> { + LOGGER.warn("Could not create text filter - unsupported text filtering version used"); + yield null; + } + }; + } + } + + protected CompletableFuture requestMessageProcessing( + GameProfile gameProfile, String string, ServerTextFilter.IgnoreStrategy ignoreStrategy, Executor executor + ) { + return string.isEmpty() ? CompletableFuture.completedFuture(FilteredText.EMPTY) : CompletableFuture.supplyAsync(() -> { + JsonObject jsonObject = this.chatEncoder.encode(gameProfile, string); + + try { + JsonObject jsonObject2 = this.processRequestResponse(jsonObject, this.chatEndpoint); + return this.filterText(string, ignoreStrategy, jsonObject2); + } catch (Exception var6) { + LOGGER.warn("Failed to validate message '{}'", string, var6); + return FilteredText.fullyFiltered(string); + } + }, executor); + } + + protected abstract FilteredText filterText(String string, ServerTextFilter.IgnoreStrategy ignoreStrategy, JsonObject jsonObject); + + protected FilterMask parseMask(String string, JsonArray jsonArray, ServerTextFilter.IgnoreStrategy ignoreStrategy) { + if (jsonArray.isEmpty()) { + return FilterMask.PASS_THROUGH; + } else if (ignoreStrategy.shouldIgnore(string, jsonArray.size())) { + return FilterMask.FULLY_FILTERED; + } else { + FilterMask filterMask = new FilterMask(string.length()); + + for (int i = 0; i < jsonArray.size(); i++) { + filterMask.setFiltered(jsonArray.get(i).getAsInt()); + } + + return filterMask; + } + } + + public void close() { + this.workerPool.shutdownNow(); + } + + protected void drainStream(InputStream inputStream) throws IOException { + byte[] bs = new byte[1024]; + + while (inputStream.read(bs) != -1) { + } + } + + private JsonObject processRequestResponse(JsonObject jsonObject, URL uRL) throws IOException { + HttpURLConnection httpURLConnection = this.makeRequest(jsonObject, uRL); + InputStream inputStream = httpURLConnection.getInputStream(); + + JsonObject var13; + label74: { + try { + if (httpURLConnection.getResponseCode() == 204) { + var13 = new JsonObject(); + break label74; + } + + try { + var13 = Streams.parse(new JsonReader(new InputStreamReader(inputStream, StandardCharsets.UTF_8))).getAsJsonObject(); + } finally { + this.drainStream(inputStream); + } + } catch (Throwable var12) { + if (inputStream != null) { + try { + inputStream.close(); + } catch (Throwable var10) { + var12.addSuppressed(var10); + } + } + + throw var12; + } + + if (inputStream != null) { + inputStream.close(); + } + + return var13; + } + + if (inputStream != null) { + inputStream.close(); + } + + return var13; + } + + protected HttpURLConnection makeRequest(JsonObject jsonObject, URL uRL) throws IOException { + HttpURLConnection httpURLConnection = this.getURLConnection(uRL); + this.setAuthorizationProperty(httpURLConnection); + OutputStreamWriter outputStreamWriter = new OutputStreamWriter(httpURLConnection.getOutputStream(), StandardCharsets.UTF_8); + + try { + JsonWriter jsonWriter = new JsonWriter(outputStreamWriter); + + try { + Streams.write(jsonObject, jsonWriter); + } catch (Throwable var10) { + try { + jsonWriter.close(); + } catch (Throwable var9) { + var10.addSuppressed(var9); + } + + throw var10; + } + + jsonWriter.close(); + } catch (Throwable var11) { + try { + outputStreamWriter.close(); + } catch (Throwable var8) { + var11.addSuppressed(var8); + } + + throw var11; + } + + outputStreamWriter.close(); + int i = httpURLConnection.getResponseCode(); + if (i >= 200 && i < 300) { + return httpURLConnection; + } else { + throw new ServerTextFilter.RequestFailedException(i + " " + httpURLConnection.getResponseMessage()); + } + } + + protected abstract void setAuthorizationProperty(HttpURLConnection httpURLConnection); + + protected int connectionReadTimeout() { + return 2000; + } + + protected HttpURLConnection getURLConnection(URL uRL) throws IOException { + HttpURLConnection httpURLConnection = (HttpURLConnection)uRL.openConnection(); + httpURLConnection.setConnectTimeout(15000); + httpURLConnection.setReadTimeout(this.connectionReadTimeout()); + httpURLConnection.setUseCaches(false); + httpURLConnection.setDoOutput(true); + httpURLConnection.setDoInput(true); + httpURLConnection.setRequestMethod("POST"); + httpURLConnection.setRequestProperty("Content-Type", "application/json; charset=utf-8"); + httpURLConnection.setRequestProperty("Accept", "application/json"); + httpURLConnection.setRequestProperty("User-Agent", "Minecraft server" + SharedConstants.getCurrentVersion().getName()); + return httpURLConnection; + } + + public TextFilter createContext(GameProfile gameProfile) { + return new ServerTextFilter.PlayerContext(gameProfile); + } + + @FunctionalInterface + public interface IgnoreStrategy { + ServerTextFilter.IgnoreStrategy NEVER_IGNORE = (string, i) -> false; + ServerTextFilter.IgnoreStrategy IGNORE_FULLY_FILTERED = (string, i) -> string.length() == i; + + static ServerTextFilter.IgnoreStrategy ignoreOverThreshold(int i) { + return (string, j) -> j >= i; + } + + static ServerTextFilter.IgnoreStrategy select(int i) { + return switch (i) { + case -1 -> NEVER_IGNORE; + case 0 -> IGNORE_FULLY_FILTERED; + default -> ignoreOverThreshold(i); + }; + } + + boolean shouldIgnore(String string, int i); + } + + @FunctionalInterface + protected interface MessageEncoder { + JsonObject encode(GameProfile gameProfile, String string); + } + + protected class PlayerContext implements TextFilter { + protected final GameProfile profile; + protected final Executor streamExecutor; + + protected PlayerContext(final GameProfile gameProfile) { + this.profile = gameProfile; + ConsecutiveExecutor consecutiveExecutor = new ConsecutiveExecutor(ServerTextFilter.this.workerPool, "chat stream for " + gameProfile.getName()); + this.streamExecutor = consecutiveExecutor::schedule; + } + + @Override + public CompletableFuture> processMessageBundle(List texts) { + List> list = (List>)texts.stream() + .map(string -> ServerTextFilter.this.requestMessageProcessing(this.profile, string, ServerTextFilter.this.chatIgnoreStrategy, this.streamExecutor)) + .collect(ImmutableList.toImmutableList()); + return Util.sequenceFailFast(list).exceptionally(throwable -> ImmutableList.of()); + } + + @Override + public CompletableFuture processStreamMessage(String text) { + return ServerTextFilter.this.requestMessageProcessing(this.profile, text, ServerTextFilter.this.chatIgnoreStrategy, this.streamExecutor); + } + } + + protected static class RequestFailedException extends RuntimeException { + protected RequestFailedException(String string) { + super(string); + } + } +} diff --git a/net/minecraft/server/network/TextFilter.java b/net/minecraft/server/network/TextFilter.java index 09b73c11..2f342d5d 100644 --- a/net/minecraft/server/network/TextFilter.java +++ b/net/minecraft/server/network/TextFilter.java @@ -6,14 +6,6 @@ import java.util.concurrent.CompletableFuture; public interface TextFilter { TextFilter DUMMY = new TextFilter() { - @Override - public void join() { - } - - @Override - public void leave() { - } - @Override public CompletableFuture processStreamMessage(String text) { return CompletableFuture.completedFuture(FilteredText.passThrough(text)); @@ -25,9 +17,11 @@ public interface TextFilter { } }; - void join(); + default void join() { + } - void leave(); + default void leave() { + } CompletableFuture processStreamMessage(String text); diff --git a/net/minecraft/server/network/TextFilterClient.java b/net/minecraft/server/network/TextFilterClient.java deleted file mode 100644 index 33126f6d..00000000 --- a/net/minecraft/server/network/TextFilterClient.java +++ /dev/null @@ -1,410 +0,0 @@ -package net.minecraft.server.network; - -import com.google.common.base.Strings; -import com.google.common.collect.ImmutableList; -import com.google.gson.JsonArray; -import com.google.gson.JsonObject; -import com.google.gson.internal.Streams; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import com.mojang.authlib.GameProfile; -import com.mojang.logging.LogUtils; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.OutputStreamWriter; -import java.net.HttpURLConnection; -import java.net.MalformedURLException; -import java.net.URI; -import java.net.URL; -import java.nio.charset.StandardCharsets; -import java.util.Base64; -import java.util.List; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.Executor; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.ThreadFactory; -import java.util.concurrent.atomic.AtomicInteger; -import net.minecraft.SharedConstants; -import net.minecraft.Util; -import net.minecraft.network.chat.FilterMask; -import net.minecraft.util.GsonHelper; -import net.minecraft.util.thread.ProcessorMailbox; -import org.jetbrains.annotations.Nullable; -import org.slf4j.Logger; - -public class TextFilterClient implements AutoCloseable { - private static final Logger LOGGER = LogUtils.getLogger(); - private static final AtomicInteger WORKER_COUNT = new AtomicInteger(1); - private static final ThreadFactory THREAD_FACTORY = runnable -> { - Thread thread = new Thread(runnable); - thread.setName("Chat-Filter-Worker-" + WORKER_COUNT.getAndIncrement()); - return thread; - }; - private static final String DEFAULT_ENDPOINT = "v1/chat"; - private final URL chatEndpoint; - private final TextFilterClient.MessageEncoder chatEncoder; - final URL joinEndpoint; - final TextFilterClient.JoinOrLeaveEncoder joinEncoder; - final URL leaveEndpoint; - final TextFilterClient.JoinOrLeaveEncoder leaveEncoder; - private final String authKey; - final TextFilterClient.IgnoreStrategy chatIgnoreStrategy; - final ExecutorService workerPool; - - private TextFilterClient( - URL chatEndpoint, - TextFilterClient.MessageEncoder chatEncoder, - URL joinEndpoint, - TextFilterClient.JoinOrLeaveEncoder joinEncoder, - URL leaveEndpoint, - TextFilterClient.JoinOrLeaveEncoder leaveEncoder, - String authKey, - TextFilterClient.IgnoreStrategy chatIgnoreStrategy, - int workerThreadCount - ) { - this.authKey = authKey; - this.chatIgnoreStrategy = chatIgnoreStrategy; - this.chatEndpoint = chatEndpoint; - this.chatEncoder = chatEncoder; - this.joinEndpoint = joinEndpoint; - this.joinEncoder = joinEncoder; - this.leaveEndpoint = leaveEndpoint; - this.leaveEncoder = leaveEncoder; - this.workerPool = Executors.newFixedThreadPool(workerThreadCount, THREAD_FACTORY); - } - - private static URL getEndpoint(URI uri, @Nullable JsonObject json, String memberName, String fallback) throws MalformedURLException { - String string = getEndpointFromConfig(json, memberName, fallback); - return uri.resolve("/" + string).toURL(); - } - - private static String getEndpointFromConfig(@Nullable JsonObject json, String memberName, String fallback) { - return json != null ? GsonHelper.getAsString(json, memberName, fallback) : fallback; - } - - @Nullable - public static TextFilterClient createFromConfig(String config) { - if (Strings.isNullOrEmpty(config)) { - return null; - } else { - try { - JsonObject jsonObject = GsonHelper.parse(config); - URI uRI = new URI(GsonHelper.getAsString(jsonObject, "apiServer")); - String string = GsonHelper.getAsString(jsonObject, "apiKey"); - if (string.isEmpty()) { - throw new IllegalArgumentException("Missing API key"); - } else { - int i = GsonHelper.getAsInt(jsonObject, "ruleId", 1); - String string2 = GsonHelper.getAsString(jsonObject, "serverId", ""); - String string3 = GsonHelper.getAsString(jsonObject, "roomId", "Java:Chat"); - int j = GsonHelper.getAsInt(jsonObject, "hashesToDrop", -1); - int k = GsonHelper.getAsInt(jsonObject, "maxConcurrentRequests", 7); - JsonObject jsonObject2 = GsonHelper.getAsJsonObject(jsonObject, "endpoints", null); - String string4 = getEndpointFromConfig(jsonObject2, "chat", "v1/chat"); - boolean bl = string4.equals("v1/chat"); - URL uRL = uRI.resolve("/" + string4).toURL(); - URL uRL2 = getEndpoint(uRI, jsonObject2, "join", "v1/join"); - URL uRL3 = getEndpoint(uRI, jsonObject2, "leave", "v1/leave"); - TextFilterClient.JoinOrLeaveEncoder joinOrLeaveEncoder = gameProfile -> { - JsonObject jsonObjectx = new JsonObject(); - jsonObjectx.addProperty("server", string2); - jsonObjectx.addProperty("room", string3); - jsonObjectx.addProperty("user_id", gameProfile.getId().toString()); - jsonObjectx.addProperty("user_display_name", gameProfile.getName()); - return jsonObjectx; - }; - TextFilterClient.MessageEncoder messageEncoder; - if (bl) { - messageEncoder = (gameProfile, string3x) -> { - JsonObject jsonObjectx = new JsonObject(); - jsonObjectx.addProperty("rule", i); - jsonObjectx.addProperty("server", string2); - jsonObjectx.addProperty("room", string3); - jsonObjectx.addProperty("player", gameProfile.getId().toString()); - jsonObjectx.addProperty("player_display_name", gameProfile.getName()); - jsonObjectx.addProperty("text", string3x); - jsonObjectx.addProperty("language", "*"); - return jsonObjectx; - }; - } else { - String string5 = String.valueOf(i); - messageEncoder = (gameProfile, string4x) -> { - JsonObject jsonObjectx = new JsonObject(); - jsonObjectx.addProperty("rule_id", string5); - jsonObjectx.addProperty("category", string2); - jsonObjectx.addProperty("subcategory", string3); - jsonObjectx.addProperty("user_id", gameProfile.getId().toString()); - jsonObjectx.addProperty("user_display_name", gameProfile.getName()); - jsonObjectx.addProperty("text", string4x); - jsonObjectx.addProperty("language", "*"); - return jsonObjectx; - }; - } - - TextFilterClient.IgnoreStrategy ignoreStrategy = TextFilterClient.IgnoreStrategy.select(j); - String string6 = Base64.getEncoder().encodeToString(string.getBytes(StandardCharsets.US_ASCII)); - return new TextFilterClient(uRL, messageEncoder, uRL2, joinOrLeaveEncoder, uRL3, joinOrLeaveEncoder, string6, ignoreStrategy, k); - } - } catch (Exception var19) { - LOGGER.warn("Failed to parse chat filter config {}", config, var19); - return null; - } - } - } - - void processJoinOrLeave(GameProfile profile, URL url, TextFilterClient.JoinOrLeaveEncoder encoder, Executor executor) { - executor.execute(() -> { - JsonObject jsonObject = encoder.encode(profile); - - try { - this.processRequest(jsonObject, url); - } catch (Exception var6) { - LOGGER.warn("Failed to send join/leave packet to {} for player {}", url, profile, var6); - } - }); - } - - CompletableFuture requestMessageProcessing(GameProfile profile, String text, TextFilterClient.IgnoreStrategy ignoreStrategy, Executor executor) { - return text.isEmpty() ? CompletableFuture.completedFuture(FilteredText.EMPTY) : CompletableFuture.supplyAsync(() -> { - JsonObject jsonObject = this.chatEncoder.encode(profile, text); - - try { - JsonObject jsonObject2 = this.processRequestResponse(jsonObject, this.chatEndpoint); - boolean bl = GsonHelper.getAsBoolean(jsonObject2, "response", false); - if (bl) { - return FilteredText.passThrough(text); - } else { - String string2 = GsonHelper.getAsString(jsonObject2, "hashed", null); - if (string2 == null) { - return FilteredText.fullyFiltered(text); - } else { - JsonArray jsonArray = GsonHelper.getAsJsonArray(jsonObject2, "hashes"); - FilterMask filterMask = this.parseMask(text, jsonArray, ignoreStrategy); - return new FilteredText(text, filterMask); - } - } - } catch (Exception var10) { - LOGGER.warn("Failed to validate message '{}'", text, var10); - return FilteredText.fullyFiltered(text); - } - }, executor); - } - - private FilterMask parseMask(String text, JsonArray hashes, TextFilterClient.IgnoreStrategy ignoreStrategy) { - if (hashes.isEmpty()) { - return FilterMask.PASS_THROUGH; - } else if (ignoreStrategy.shouldIgnore(text, hashes.size())) { - return FilterMask.FULLY_FILTERED; - } else { - FilterMask filterMask = new FilterMask(text.length()); - - for (int i = 0; i < hashes.size(); i++) { - filterMask.setFiltered(hashes.get(i).getAsInt()); - } - - return filterMask; - } - } - - public void close() { - this.workerPool.shutdownNow(); - } - - private void drainStream(InputStream stream) throws IOException { - byte[] bs = new byte[1024]; - - while (stream.read(bs) != -1) { - } - } - - private JsonObject processRequestResponse(JsonObject json, URL requestUrl) throws IOException { - HttpURLConnection httpURLConnection = this.makeRequest(json, requestUrl); - InputStream inputStream = httpURLConnection.getInputStream(); - - JsonObject var13; - label74: { - try { - if (httpURLConnection.getResponseCode() == 204) { - var13 = new JsonObject(); - break label74; - } - - try { - var13 = Streams.parse(new JsonReader(new InputStreamReader(inputStream, StandardCharsets.UTF_8))).getAsJsonObject(); - } finally { - this.drainStream(inputStream); - } - } catch (Throwable var12) { - if (inputStream != null) { - try { - inputStream.close(); - } catch (Throwable var10) { - var12.addSuppressed(var10); - } - } - - throw var12; - } - - if (inputStream != null) { - inputStream.close(); - } - - return var13; - } - - if (inputStream != null) { - inputStream.close(); - } - - return var13; - } - - private void processRequest(JsonObject json, URL requestUrl) throws IOException { - HttpURLConnection httpURLConnection = this.makeRequest(json, requestUrl); - InputStream inputStream = httpURLConnection.getInputStream(); - - try { - this.drainStream(inputStream); - } catch (Throwable var8) { - if (inputStream != null) { - try { - inputStream.close(); - } catch (Throwable var7) { - var8.addSuppressed(var7); - } - } - - throw var8; - } - - if (inputStream != null) { - inputStream.close(); - } - } - - private HttpURLConnection makeRequest(JsonObject json, URL requestUrl) throws IOException { - HttpURLConnection httpURLConnection = (HttpURLConnection)requestUrl.openConnection(); - httpURLConnection.setConnectTimeout(15000); - httpURLConnection.setReadTimeout(2000); - httpURLConnection.setUseCaches(false); - httpURLConnection.setDoOutput(true); - httpURLConnection.setDoInput(true); - httpURLConnection.setRequestMethod("POST"); - httpURLConnection.setRequestProperty("Content-Type", "application/json; charset=utf-8"); - httpURLConnection.setRequestProperty("Accept", "application/json"); - httpURLConnection.setRequestProperty("Authorization", "Basic " + this.authKey); - httpURLConnection.setRequestProperty("User-Agent", "Minecraft server" + SharedConstants.getCurrentVersion().getName()); - OutputStreamWriter outputStreamWriter = new OutputStreamWriter(httpURLConnection.getOutputStream(), StandardCharsets.UTF_8); - - try { - JsonWriter jsonWriter = new JsonWriter(outputStreamWriter); - - try { - Streams.write(json, jsonWriter); - } catch (Throwable var10) { - try { - jsonWriter.close(); - } catch (Throwable var9) { - var10.addSuppressed(var9); - } - - throw var10; - } - - jsonWriter.close(); - } catch (Throwable var11) { - try { - outputStreamWriter.close(); - } catch (Throwable var8) { - var11.addSuppressed(var8); - } - - throw var11; - } - - outputStreamWriter.close(); - int i = httpURLConnection.getResponseCode(); - if (i >= 200 && i < 300) { - return httpURLConnection; - } else { - throw new TextFilterClient.RequestFailedException(i + " " + httpURLConnection.getResponseMessage()); - } - } - - public TextFilter createContext(GameProfile profile) { - return new TextFilterClient.PlayerContext(profile); - } - - @FunctionalInterface - public interface IgnoreStrategy { - TextFilterClient.IgnoreStrategy NEVER_IGNORE = (string, i) -> false; - TextFilterClient.IgnoreStrategy IGNORE_FULLY_FILTERED = (string, i) -> string.length() == i; - - static TextFilterClient.IgnoreStrategy ignoreOverThreshold(int threshold) { - return (string, j) -> j >= threshold; - } - - static TextFilterClient.IgnoreStrategy select(int threshold) { - return switch (threshold) { - case -1 -> NEVER_IGNORE; - case 0 -> IGNORE_FULLY_FILTERED; - default -> ignoreOverThreshold(threshold); - }; - } - - boolean shouldIgnore(String string, int i); - } - - @FunctionalInterface - interface JoinOrLeaveEncoder { - JsonObject encode(GameProfile gameProfile); - } - - @FunctionalInterface - interface MessageEncoder { - JsonObject encode(GameProfile gameProfile, String string); - } - - class PlayerContext implements TextFilter { - private final GameProfile profile; - private final Executor streamExecutor; - - PlayerContext(final GameProfile profile) { - this.profile = profile; - ProcessorMailbox processorMailbox = ProcessorMailbox.create(TextFilterClient.this.workerPool, "chat stream for " + profile.getName()); - this.streamExecutor = processorMailbox::tell; - } - - @Override - public void join() { - TextFilterClient.this.processJoinOrLeave(this.profile, TextFilterClient.this.joinEndpoint, TextFilterClient.this.joinEncoder, this.streamExecutor); - } - - @Override - public void leave() { - TextFilterClient.this.processJoinOrLeave(this.profile, TextFilterClient.this.leaveEndpoint, TextFilterClient.this.leaveEncoder, this.streamExecutor); - } - - @Override - public CompletableFuture> processMessageBundle(List texts) { - List> list = (List>)texts.stream() - .map(string -> TextFilterClient.this.requestMessageProcessing(this.profile, string, TextFilterClient.this.chatIgnoreStrategy, this.streamExecutor)) - .collect(ImmutableList.toImmutableList()); - return Util.sequenceFailFast(list).exceptionally(throwable -> ImmutableList.of()); - } - - @Override - public CompletableFuture processStreamMessage(String text) { - return TextFilterClient.this.requestMessageProcessing(this.profile, text, TextFilterClient.this.chatIgnoreStrategy, this.streamExecutor); - } - } - - public static class RequestFailedException extends RuntimeException { - RequestFailedException(String message) { - super(message); - } - } -} diff --git a/net/minecraft/server/packs/DownloadQueue.java b/net/minecraft/server/packs/DownloadQueue.java index 2a82037d..f520384e 100644 --- a/net/minecraft/server/packs/DownloadQueue.java +++ b/net/minecraft/server/packs/DownloadQueue.java @@ -24,8 +24,9 @@ import net.minecraft.Util; import net.minecraft.core.UUIDUtil; import net.minecraft.util.ExtraCodecs; import net.minecraft.util.HttpUtil; +import net.minecraft.util.HttpUtil.DownloadProgressListener; import net.minecraft.util.eventlog.JsonEventLog; -import net.minecraft.util.thread.ProcessorMailbox; +import net.minecraft.util.thread.ConsecutiveExecutor; import org.jetbrains.annotations.Nullable; import org.slf4j.Logger; @@ -34,7 +35,7 @@ public class DownloadQueue implements AutoCloseable { private static final int MAX_KEPT_PACKS = 20; private final Path cacheDir; private final JsonEventLog eventLog; - private final ProcessorMailbox tasks = ProcessorMailbox.create(Util.nonCriticalIoPool(), "download-queue"); + private final ConsecutiveExecutor tasks = new ConsecutiveExecutor(Util.nonCriticalIoPool(), "download-queue"); public DownloadQueue(Path cacheDir) throws IOException { this.cacheDir = cacheDir; @@ -98,7 +99,7 @@ public class DownloadQueue implements AutoCloseable { } public CompletableFuture downloadBatch(DownloadQueue.BatchConfig batchConfig, Map downloads) { - return CompletableFuture.supplyAsync(() -> this.runDownload(batchConfig, downloads), this.tasks::tell); + return CompletableFuture.supplyAsync(() -> this.runDownload(batchConfig, downloads), this.tasks::schedule); } public void close() throws IOException { @@ -106,7 +107,7 @@ public class DownloadQueue implements AutoCloseable { this.eventLog.close(); } - public record BatchConfig(HashFunction hashFunction, int maxSize, Map headers, Proxy proxy, HttpUtil.DownloadProgressListener listener) { + public record BatchConfig(HashFunction hashFunction, int maxSize, Map headers, Proxy proxy, DownloadProgressListener listener) { } public record BatchResult(Map downloaded, Set failed) { diff --git a/net/minecraft/server/packs/repository/PackRepository.java b/net/minecraft/server/packs/repository/PackRepository.java index 50bae806..e8b62d76 100644 --- a/net/minecraft/server/packs/repository/PackRepository.java +++ b/net/minecraft/server/packs/repository/PackRepository.java @@ -46,6 +46,11 @@ public class PackRepository { return ImmutableMap.copyOf(map); } + public boolean isAbleToClearAnyPack() { + List list = this.rebuildSelected(List.of()); + return !this.selected.equals(list); + } + public void setSelected(Collection ids) { this.selected = this.rebuildSelected(ids); } diff --git a/net/minecraft/server/packs/resources/PreparableReloadListener.java b/net/minecraft/server/packs/resources/PreparableReloadListener.java index ee6f0652..5445d9eb 100644 --- a/net/minecraft/server/packs/resources/PreparableReloadListener.java +++ b/net/minecraft/server/packs/resources/PreparableReloadListener.java @@ -2,16 +2,10 @@ package net.minecraft.server.packs.resources; import java.util.concurrent.CompletableFuture; import java.util.concurrent.Executor; -import net.minecraft.util.profiling.ProfilerFiller; public interface PreparableReloadListener { CompletableFuture reload( - PreparableReloadListener.PreparationBarrier preparationBarrier, - ResourceManager resourceManager, - ProfilerFiller preparationsProfiler, - ProfilerFiller reloadProfiler, - Executor backgroundExecutor, - Executor gameExecutor + PreparableReloadListener.PreparationBarrier preparationBarrier, ResourceManager resourceManager, Executor executor, Executor executor2 ); default String getName() { diff --git a/net/minecraft/server/packs/resources/ProfiledReloadInstance.java b/net/minecraft/server/packs/resources/ProfiledReloadInstance.java index 70b4847b..726799f9 100644 --- a/net/minecraft/server/packs/resources/ProfiledReloadInstance.java +++ b/net/minecraft/server/packs/resources/ProfiledReloadInstance.java @@ -9,8 +9,8 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicLong; import net.minecraft.Util; import net.minecraft.util.Unit; -import net.minecraft.util.profiling.ActiveProfiler; -import net.minecraft.util.profiling.ProfileResults; +import net.minecraft.util.profiling.Profiler; +import net.minecraft.util.profiling.ProfilerFiller; import org.slf4j.Logger; public class ProfiledReloadInstance extends SimpleReloadInstance { @@ -32,28 +32,16 @@ public class ProfiledReloadInstance extends SimpleReloadInstance { AtomicLong atomicLong = new AtomicLong(); AtomicLong atomicLong2 = new AtomicLong(); - ActiveProfiler activeProfiler = new ActiveProfiler(Util.timeSource, () -> 0, false); - ActiveProfiler activeProfiler2 = new ActiveProfiler(Util.timeSource, () -> 0, false); CompletableFuture completableFuture = preparableReloadListener.reload( - preparationBarrier, resourceManagerx, activeProfiler, activeProfiler2, runnable -> executor2.execute(() -> { - long l = Util.getNanos(); - runnable.run(); - atomicLong.addAndGet(Util.getNanos() - l); - }), runnable -> executor3.execute(() -> { - long l = Util.getNanos(); - runnable.run(); - atomicLong2.addAndGet(Util.getNanos() - l); - }) - ); - return completableFuture.thenApplyAsync( - void_ -> { - LOGGER.debug("Finished reloading " + preparableReloadListener.getName()); - return new ProfiledReloadInstance.State( - preparableReloadListener.getName(), activeProfiler.getResults(), activeProfiler2.getResults(), atomicLong, atomicLong2 - ); - }, - gameExecutor + preparationBarrier, + resourceManagerx, + profiledExecutor(executor2, atomicLong, preparableReloadListener.getName()), + profiledExecutor(executor3, atomicLong2, preparableReloadListener.getName()) ); + return completableFuture.thenApplyAsync(void_ -> { + LOGGER.debug("Finished reloading {}", preparableReloadListener.getName()); + return new ProfiledReloadInstance.State(preparableReloadListener.getName(), atomicLong, atomicLong2); + }, gameExecutor); }, alsoWaitedFor ); @@ -61,14 +49,23 @@ public class ProfiledReloadInstance extends SimpleReloadInstance executor.execute(() -> { + ProfilerFiller profilerFiller = Profiler.get(); + profilerFiller.push(string); + long l = Util.getNanos(); + runnable.run(); + atomicLong.addAndGet(Util.getNanos() - l); + profilerFiller.pop(); + }); + } + private List finish(List datapoints) { this.total.stop(); long l = 0L; LOGGER.info("Resource reload finished after {} ms", this.total.elapsed(TimeUnit.MILLISECONDS)); for (ProfiledReloadInstance.State state : datapoints) { - ProfileResults profileResults = state.preparationResult; - ProfileResults profileResults2 = state.reloadResult; long m = TimeUnit.NANOSECONDS.toMillis(state.preparationNanos.get()); long n = TimeUnit.NANOSECONDS.toMillis(state.reloadNanos.get()); long o = m + n; @@ -81,19 +78,6 @@ public class ProfiledReloadInstance extends SimpleReloadInstance reload( - PreparableReloadListener.PreparationBarrier preparationBarrier, - ResourceManager resourceManager, - ProfilerFiller preparationsProfiler, - ProfilerFiller reloadProfiler, - Executor backgroundExecutor, - Executor gameExecutor + PreparableReloadListener.PreparationBarrier preparationBarrier, ResourceManager resourceManager, Executor executor, Executor executor2 ) { return preparationBarrier.wait(Unit.INSTANCE).thenRunAsync(() -> { - reloadProfiler.startTick(); - reloadProfiler.push("listener"); + ProfilerFiller profilerFiller = Profiler.get(); + profilerFiller.push("listener"); this.onResourceManagerReload(resourceManager); - reloadProfiler.pop(); - reloadProfiler.endTick(); - }, gameExecutor); + profilerFiller.pop(); + }, executor2); } void onResourceManagerReload(ResourceManager resourceManager); diff --git a/net/minecraft/server/packs/resources/SimpleJsonResourceReloadListener.java b/net/minecraft/server/packs/resources/SimpleJsonResourceReloadListener.java index 530945ec..84f28963 100644 --- a/net/minecraft/server/packs/resources/SimpleJsonResourceReloadListener.java +++ b/net/minecraft/server/packs/resources/SimpleJsonResourceReloadListener.java @@ -1,41 +1,56 @@ package net.minecraft.server.packs.resources; -import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonParseException; +import com.google.gson.JsonParser; import com.mojang.logging.LogUtils; +import com.mojang.serialization.Codec; +import com.mojang.serialization.DynamicOps; +import com.mojang.serialization.JsonOps; import java.io.IOException; import java.io.Reader; import java.util.HashMap; import java.util.Map; import java.util.Map.Entry; +import net.minecraft.core.HolderLookup; import net.minecraft.resources.FileToIdConverter; import net.minecraft.resources.ResourceLocation; -import net.minecraft.util.GsonHelper; import net.minecraft.util.profiling.ProfilerFiller; import org.slf4j.Logger; -public abstract class SimpleJsonResourceReloadListener extends SimplePreparableReloadListener> { +public abstract class SimpleJsonResourceReloadListener extends SimplePreparableReloadListener> { private static final Logger LOGGER = LogUtils.getLogger(); - private final Gson gson; + private final DynamicOps ops; + private final Codec codec; private final String directory; - public SimpleJsonResourceReloadListener(Gson gson, String directory) { - this.gson = gson; - this.directory = directory; + protected SimpleJsonResourceReloadListener(HolderLookup.Provider provider, Codec codec, String string) { + this(provider.createSerializationContext(JsonOps.INSTANCE), codec, string); + } + + protected SimpleJsonResourceReloadListener(Codec codec, String string) { + this(JsonOps.INSTANCE, codec, string); + } + + private SimpleJsonResourceReloadListener(DynamicOps dynamicOps, Codec codec, String string) { + this.ops = dynamicOps; + this.codec = codec; + this.directory = string; } /** * Performs any reloading that can be done off-thread, such as file IO */ - protected Map prepare(ResourceManager resourceManager, ProfilerFiller profiler) { - Map map = new HashMap(); - scanDirectory(resourceManager, this.directory, this.gson, map); + protected Map prepare(ResourceManager resourceManager, ProfilerFiller profiler) { + Map map = new HashMap(); + scanDirectory(resourceManager, this.directory, this.ops, this.codec, map); return map; } - public static void scanDirectory(ResourceManager resourceManager, String name, Gson gson, Map output) { - FileToIdConverter fileToIdConverter = FileToIdConverter.json(name); + public static void scanDirectory( + ResourceManager resourceManager, String string, DynamicOps dynamicOps, Codec codec, Map map + ) { + FileToIdConverter fileToIdConverter = FileToIdConverter.json(string); for (Entry entry : fileToIdConverter.listMatchingResources(resourceManager).entrySet()) { ResourceLocation resourceLocation = (ResourceLocation)entry.getKey(); @@ -45,28 +60,28 @@ public abstract class SimpleJsonResourceReloadListener extends SimplePreparableR Reader reader = ((Resource)entry.getValue()).openAsReader(); try { - JsonElement jsonElement = GsonHelper.fromJson(gson, reader, JsonElement.class); - JsonElement jsonElement2 = (JsonElement)output.put(resourceLocation2, jsonElement); - if (jsonElement2 != null) { - throw new IllegalStateException("Duplicate data file ignored with ID " + resourceLocation2); - } - } catch (Throwable var13) { + codec.parse(dynamicOps, JsonParser.parseReader(reader)).ifSuccess(object -> { + if (map.putIfAbsent(resourceLocation2, object) != null) { + throw new IllegalStateException("Duplicate data file ignored with ID " + resourceLocation2); + } + }).ifError(error -> LOGGER.error("Couldn't parse data file '{}' from '{}': {}", resourceLocation2, resourceLocation, error)); + } catch (Throwable var14) { if (reader != null) { try { reader.close(); - } catch (Throwable var12) { - var13.addSuppressed(var12); + } catch (Throwable var13) { + var14.addSuppressed(var13); } } - throw var13; + throw var14; } if (reader != null) { reader.close(); } - } catch (IllegalArgumentException | IOException | JsonParseException var14) { - LOGGER.error("Couldn't parse data file {} from {}", resourceLocation2, resourceLocation, var14); + } catch (IllegalArgumentException | IOException | JsonParseException var15) { + LOGGER.error("Couldn't parse data file '{}' from '{}'", resourceLocation2, resourceLocation, var15); } } } diff --git a/net/minecraft/server/packs/resources/SimplePreparableReloadListener.java b/net/minecraft/server/packs/resources/SimplePreparableReloadListener.java index 9cbacadd..2422b1a0 100644 --- a/net/minecraft/server/packs/resources/SimplePreparableReloadListener.java +++ b/net/minecraft/server/packs/resources/SimplePreparableReloadListener.java @@ -2,21 +2,17 @@ package net.minecraft.server.packs.resources; import java.util.concurrent.CompletableFuture; import java.util.concurrent.Executor; +import net.minecraft.util.profiling.Profiler; import net.minecraft.util.profiling.ProfilerFiller; public abstract class SimplePreparableReloadListener implements PreparableReloadListener { @Override public final CompletableFuture reload( - PreparableReloadListener.PreparationBarrier preparationBarrier, - ResourceManager resourceManager, - ProfilerFiller preparationsProfiler, - ProfilerFiller reloadProfiler, - Executor backgroundExecutor, - Executor gameExecutor + PreparableReloadListener.PreparationBarrier preparationBarrier, ResourceManager resourceManager, Executor executor, Executor executor2 ) { - return CompletableFuture.supplyAsync(() -> this.prepare(resourceManager, preparationsProfiler), backgroundExecutor) + return CompletableFuture.supplyAsync(() -> this.prepare(resourceManager, Profiler.get()), executor) .thenCompose(preparationBarrier::wait) - .thenAcceptAsync(object -> this.apply((T)object, resourceManager, reloadProfiler), gameExecutor); + .thenAcceptAsync(object -> this.apply((T)object, resourceManager, Profiler.get()), executor2); } /** diff --git a/net/minecraft/server/packs/resources/SimpleReloadInstance.java b/net/minecraft/server/packs/resources/SimpleReloadInstance.java index 07ac6a2d..c8c8d8c3 100644 --- a/net/minecraft/server/packs/resources/SimpleReloadInstance.java +++ b/net/minecraft/server/packs/resources/SimpleReloadInstance.java @@ -9,7 +9,6 @@ import java.util.concurrent.Executor; import java.util.concurrent.atomic.AtomicInteger; import net.minecraft.Util; import net.minecraft.util.Unit; -import net.minecraft.util.profiling.InactiveProfiler; public class SimpleReloadInstance implements ReloadInstance { private static final int PREPARATION_PROGRESS_WEIGHT = 2; @@ -37,7 +36,7 @@ public class SimpleReloadInstance implements ReloadInstance { resourceManager, listeners, (preparationBarrier, resourceManagerx, preparableReloadListener, executor2, executor3) -> preparableReloadListener.reload( - preparationBarrier, resourceManagerx, InactiveProfiler.INSTANCE, InactiveProfiler.INSTANCE, backgroundExecutor, executor3 + preparationBarrier, resourceManagerx, backgroundExecutor, executor3 ), alsoWaitedFor ); diff --git a/net/minecraft/server/players/GameProfileCache.java b/net/minecraft/server/players/GameProfileCache.java index b89d25da..5fd85124 100644 --- a/net/minecraft/server/players/GameProfileCache.java +++ b/net/minecraft/server/players/GameProfileCache.java @@ -168,7 +168,9 @@ public class GameProfileCache { if (completableFuture != null) { return completableFuture; } else { - CompletableFuture> completableFuture2 = CompletableFuture.supplyAsync(() -> this.get(name), Util.backgroundExecutor()) + CompletableFuture> completableFuture2 = CompletableFuture.supplyAsync( + () -> this.get(name), Util.backgroundExecutor().forName("getProfile") + ) .whenCompleteAsync((optional, throwable) -> this.requests.remove(name), this.executor); this.requests.put(name, completableFuture2); return completableFuture2; diff --git a/net/minecraft/server/players/PlayerList.java b/net/minecraft/server/players/PlayerList.java index 74f147f6..b267f016 100644 --- a/net/minecraft/server/players/PlayerList.java +++ b/net/minecraft/server/players/PlayerList.java @@ -49,10 +49,10 @@ import net.minecraft.network.protocol.game.ClientboundSetBorderLerpSizePacket; import net.minecraft.network.protocol.game.ClientboundSetBorderSizePacket; import net.minecraft.network.protocol.game.ClientboundSetBorderWarningDelayPacket; import net.minecraft.network.protocol.game.ClientboundSetBorderWarningDistancePacket; -import net.minecraft.network.protocol.game.ClientboundSetCarriedItemPacket; import net.minecraft.network.protocol.game.ClientboundSetChunkCacheRadiusPacket; import net.minecraft.network.protocol.game.ClientboundSetDefaultSpawnPositionPacket; import net.minecraft.network.protocol.game.ClientboundSetExperiencePacket; +import net.minecraft.network.protocol.game.ClientboundSetHeldSlotPacket; import net.minecraft.network.protocol.game.ClientboundSetPlayerTeamPacket; import net.minecraft.network.protocol.game.ClientboundSetSimulationDistancePacket; import net.minecraft.network.protocol.game.ClientboundSetTimePacket; @@ -78,9 +78,10 @@ import net.minecraft.stats.Stats; import net.minecraft.tags.TagNetworkSerialization; import net.minecraft.world.effect.MobEffectInstance; import net.minecraft.world.entity.Entity; -import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.player.Player; +import net.minecraft.world.entity.projectile.ThrownEnderpearl; +import net.minecraft.world.item.crafting.RecipeManager; import net.minecraft.world.level.GameRules; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Blocks; @@ -88,7 +89,7 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.border.BorderChangeListener; import net.minecraft.world.level.border.WorldBorder; import net.minecraft.world.level.dimension.DimensionType; -import net.minecraft.world.level.portal.DimensionTransition; +import net.minecraft.world.level.portal.TeleportTransition; import net.minecraft.world.level.storage.LevelData; import net.minecraft.world.level.storage.LevelResource; import net.minecraft.world.level.storage.PlayerDataStorage; @@ -153,7 +154,7 @@ public abstract class PlayerList { Optional optional = this.load(player); ResourceKey resourceKey = (ResourceKey)optional.flatMap( - compoundTagx -> DimensionType.parseLegacy(new Dynamic<>(NbtOps.INSTANCE, compoundTagx.get("Dimension"))).resultOrPartial(LOGGER::error) + compoundTag -> DimensionType.parseLegacy(new Dynamic<>(NbtOps.INSTANCE, compoundTag.get("Dimension"))).resultOrPartial(LOGGER::error) ) .orElse(Level.OVERWORLD); ServerLevel serverLevel = this.server.getLevel(resourceKey); @@ -197,8 +198,11 @@ public abstract class PlayerList { ); serverGamePacketListenerImpl.send(new ClientboundChangeDifficultyPacket(levelData.getDifficulty(), levelData.isDifficultyLocked())); serverGamePacketListenerImpl.send(new ClientboundPlayerAbilitiesPacket(player.getAbilities())); - serverGamePacketListenerImpl.send(new ClientboundSetCarriedItemPacket(player.getInventory().selected)); - serverGamePacketListenerImpl.send(new ClientboundUpdateRecipesPacket(this.server.getRecipeManager().getOrderedRecipes())); + serverGamePacketListenerImpl.send(new ClientboundSetHeldSlotPacket(player.getInventory().selected)); + RecipeManager recipeManager = this.server.getRecipeManager(); + serverGamePacketListenerImpl.send( + new ClientboundUpdateRecipesPacket(recipeManager.getSynchronizedItemProperties(), recipeManager.getSynchronizedStonecutterRecipes()) + ); this.sendPlayerPermissionLevel(player); player.getStats().markAllDirty(); player.getRecipeBook().sendInitialRecipeBook(player); @@ -226,41 +230,8 @@ public abstract class PlayerList { serverLevel2.addNewPlayer(player); this.server.getCustomBossEvents().onPlayerConnect(player); this.sendActivePlayerEffects(player); - if (optional.isPresent() && ((CompoundTag)optional.get()).contains("RootVehicle", 10)) { - CompoundTag compoundTag = ((CompoundTag)optional.get()).getCompound("RootVehicle"); - Entity entity = EntityType.loadEntityRecursive( - compoundTag.getCompound("Entity"), serverLevel2, entityx -> !serverLevel2.addWithUUID(entityx) ? null : entityx - ); - if (entity != null) { - UUID uUID; - if (compoundTag.hasUUID("Attach")) { - uUID = compoundTag.getUUID("Attach"); - } else { - uUID = null; - } - - if (entity.getUUID().equals(uUID)) { - player.startRiding(entity, true); - } else { - for (Entity entity2 : entity.getIndirectPassengers()) { - if (entity2.getUUID().equals(uUID)) { - player.startRiding(entity2, true); - break; - } - } - } - - if (!player.isPassenger()) { - LOGGER.warn("Couldn't reattach entity to player"); - entity.discard(); - - for (Entity entity2x : entity.getIndirectPassengers()) { - entity2x.discard(); - } - } - } - } - + player.loadAndSpawnEnderpearls(optional); + player.loadAndSpawnParentVehicle(optional); player.initInventoryMenu(); } @@ -367,6 +338,11 @@ public abstract class PlayerList { } player.unRide(); + + for (ThrownEnderpearl thrownEnderpearl : player.getEnderPearls()) { + thrownEnderpearl.setRemoved(Entity.RemovalReason.UNLOADED_WITH_PLAYER); + } + serverLevel.removePlayerImmediately(player, Entity.RemovalReason.UNLOADED_WITH_PLAYER); player.getAdvancements().stopListening(); this.players.remove(player); @@ -438,14 +414,14 @@ public abstract class PlayerList { public ServerPlayer respawn(ServerPlayer player, boolean keepInventory, Entity.RemovalReason reason) { this.players.remove(player); player.serverLevel().removePlayerImmediately(player, reason); - DimensionTransition dimensionTransition = player.findRespawnPositionAndUseSpawnBlock(keepInventory, DimensionTransition.DO_NOTHING); - ServerLevel serverLevel = dimensionTransition.newLevel(); + TeleportTransition teleportTransition = player.findRespawnPositionAndUseSpawnBlock(!keepInventory, TeleportTransition.DO_NOTHING); + ServerLevel serverLevel = teleportTransition.newLevel(); ServerPlayer serverPlayer = new ServerPlayer(this.server, serverLevel, player.getGameProfile(), player.clientInformation()); serverPlayer.connection = player.connection; serverPlayer.restoreFrom(player, keepInventory); serverPlayer.setId(player.getId()); serverPlayer.setMainArm(player.getMainArm()); - if (!dimensionTransition.missingRespawnBlock()) { + if (!teleportTransition.missingRespawnBlock()) { serverPlayer.copyRespawnPosition(player); } @@ -453,9 +429,9 @@ public abstract class PlayerList { serverPlayer.addTag(string); } - Vec3 vec3 = dimensionTransition.pos(); - serverPlayer.moveTo(vec3.x, vec3.y, vec3.z, dimensionTransition.yRot(), dimensionTransition.xRot()); - if (dimensionTransition.missingRespawnBlock()) { + Vec3 vec3 = teleportTransition.position(); + serverPlayer.moveTo(vec3.x, vec3.y, vec3.z, teleportTransition.yRot(), teleportTransition.xRot()); + if (teleportTransition.missingRespawnBlock()) { serverPlayer.connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.NO_RESPAWN_BLOCK_AVAILABLE, 0.0F)); } @@ -475,9 +451,10 @@ public abstract class PlayerList { this.playersByUUID.put(serverPlayer.getUUID(), serverPlayer); serverPlayer.initInventoryMenu(); serverPlayer.setHealth(serverPlayer.getHealth()); - if (!keepInventory) { - BlockPos blockPos = BlockPos.containing(dimensionTransition.pos()); - BlockState blockState = serverLevel.getBlockState(blockPos); + BlockPos blockPos = serverPlayer.getRespawnPosition(); + ServerLevel serverLevel3 = this.server.getLevel(serverPlayer.getRespawnDimension()); + if (!keepInventory && blockPos != null && serverLevel3 != null) { + BlockState blockState = serverLevel3.getBlockState(blockPos); if (blockState.is(Blocks.RESPAWN_ANCHOR)) { serverPlayer.connection .send( @@ -705,7 +682,7 @@ public abstract class PlayerList { public void sendAllPlayerInfo(ServerPlayer player) { player.inventoryMenu.sendAllDataToRemote(); player.resetSentInfo(); - player.connection.send(new ClientboundSetCarriedItemPacket(player.getInventory().selected)); + player.connection.send(new ClientboundSetHeldSlotPacket(player.getInventory().selected)); } /** @@ -902,7 +879,10 @@ public abstract class PlayerList { } this.broadcastAll(new ClientboundUpdateTagsPacket(TagNetworkSerialization.serializeTagsToNetwork(this.registries))); - ClientboundUpdateRecipesPacket clientboundUpdateRecipesPacket = new ClientboundUpdateRecipesPacket(this.server.getRecipeManager().getOrderedRecipes()); + RecipeManager recipeManager = this.server.getRecipeManager(); + ClientboundUpdateRecipesPacket clientboundUpdateRecipesPacket = new ClientboundUpdateRecipesPacket( + recipeManager.getSynchronizedItemProperties(), recipeManager.getSynchronizedStonecutterRecipes() + ); for (ServerPlayer serverPlayer : this.players) { serverPlayer.connection.send(clientboundUpdateRecipesPacket); diff --git a/net/minecraft/sounds/SoundEvent.java b/net/minecraft/sounds/SoundEvent.java index 7234a0ce..4a28dc55 100644 --- a/net/minecraft/sounds/SoundEvent.java +++ b/net/minecraft/sounds/SoundEvent.java @@ -12,55 +12,32 @@ import net.minecraft.network.codec.StreamCodec; import net.minecraft.resources.RegistryFileCodec; import net.minecraft.resources.ResourceLocation; -public class SoundEvent { +public record SoundEvent(ResourceLocation location, Optional fixedRange) { public static final Codec DIRECT_CODEC = RecordCodecBuilder.create( instance -> instance.group( - ResourceLocation.CODEC.fieldOf("sound_id").forGetter(SoundEvent::getLocation), - Codec.FLOAT.lenientOptionalFieldOf("range").forGetter(SoundEvent::fixedRange) + ResourceLocation.CODEC.fieldOf("sound_id").forGetter(SoundEvent::location), Codec.FLOAT.lenientOptionalFieldOf("range").forGetter(SoundEvent::fixedRange) ) .apply(instance, SoundEvent::create) ); public static final Codec> CODEC = RegistryFileCodec.create(Registries.SOUND_EVENT, DIRECT_CODEC); public static final StreamCodec DIRECT_STREAM_CODEC = StreamCodec.composite( - ResourceLocation.STREAM_CODEC, SoundEvent::getLocation, ByteBufCodecs.FLOAT.apply(ByteBufCodecs::optional), SoundEvent::fixedRange, SoundEvent::create + ResourceLocation.STREAM_CODEC, SoundEvent::location, ByteBufCodecs.FLOAT.apply(ByteBufCodecs::optional), SoundEvent::fixedRange, SoundEvent::create ); public static final StreamCodec> STREAM_CODEC = ByteBufCodecs.holder(Registries.SOUND_EVENT, DIRECT_STREAM_CODEC); - private static final float DEFAULT_RANGE = 16.0F; - private final ResourceLocation location; - private final float range; - private final boolean newSystem; private static SoundEvent create(ResourceLocation location, Optional range) { return (SoundEvent)range.map(float_ -> createFixedRangeEvent(location, float_)).orElseGet(() -> createVariableRangeEvent(location)); } public static SoundEvent createVariableRangeEvent(ResourceLocation location) { - return new SoundEvent(location, 16.0F, false); + return new SoundEvent(location, Optional.empty()); } public static SoundEvent createFixedRangeEvent(ResourceLocation location, float range) { - return new SoundEvent(location, range, true); - } - - private SoundEvent(ResourceLocation location, float range, boolean newSystem) { - this.location = location; - this.range = range; - this.newSystem = newSystem; - } - - public ResourceLocation getLocation() { - return this.location; + return new SoundEvent(location, Optional.of(range)); } public float getRange(float volume) { - if (this.newSystem) { - return this.range; - } else { - return volume > 1.0F ? 16.0F * volume : 16.0F; - } - } - - private Optional fixedRange() { - return this.newSystem ? Optional.of(this.range) : Optional.empty(); + return (Float)this.fixedRange.orElse(volume > 1.0F ? 16.0F * volume : 16.0F); } } diff --git a/net/minecraft/sounds/SoundEvents.java b/net/minecraft/sounds/SoundEvents.java index 03d4b4e7..f47d949a 100644 --- a/net/minecraft/sounds/SoundEvents.java +++ b/net/minecraft/sounds/SoundEvents.java @@ -218,6 +218,7 @@ public class SoundEvents { public static final SoundEvent BUBBLE_COLUMN_UPWARDS_INSIDE = register("block.bubble_column.upwards_inside"); public static final SoundEvent BUBBLE_COLUMN_WHIRLPOOL_AMBIENT = register("block.bubble_column.whirlpool_ambient"); public static final SoundEvent BUBBLE_COLUMN_WHIRLPOOL_INSIDE = register("block.bubble_column.whirlpool_inside"); + public static final SoundEvent BUBBLE_POP = register("ui.hud.bubble_pop"); public static final SoundEvent BUCKET_EMPTY = register("item.bucket.empty"); public static final SoundEvent BUCKET_EMPTY_AXOLOTL = register("item.bucket.empty_axolotl"); public static final SoundEvent BUCKET_EMPTY_FISH = register("item.bucket.empty_fish"); @@ -232,6 +233,7 @@ public class SoundEvents { public static final SoundEvent BUCKET_FILL_TADPOLE = register("item.bucket.fill_tadpole"); public static final SoundEvent BUNDLE_DROP_CONTENTS = register("item.bundle.drop_contents"); public static final SoundEvent BUNDLE_INSERT = register("item.bundle.insert"); + public static final SoundEvent BUNDLE_INSERT_FAIL = register("item.bundle.insert_fail"); public static final SoundEvent BUNDLE_REMOVE_ONE = register("item.bundle.remove_one"); public static final SoundEvent CAKE_ADD_CANDLE = register("block.cake.add_candle"); public static final SoundEvent CALCITE_BREAK = register("block.calcite.break"); @@ -380,6 +382,24 @@ public class SoundEvents { public static final SoundEvent COW_STEP = register("entity.cow.step"); public static final SoundEvent CRAFTER_CRAFT = register("block.crafter.craft"); public static final SoundEvent CRAFTER_FAIL = register("block.crafter.fail"); + public static final SoundEvent CREAKING_AMBIENT = register("entity.creaking.ambient"); + public static final SoundEvent CREAKING_ACTIVATE = register("entity.creaking.activate"); + public static final SoundEvent CREAKING_DEACTIVATE = register("entity.creaking.deactivate"); + public static final SoundEvent CREAKING_ATTACK = register("entity.creaking.attack"); + public static final SoundEvent CREAKING_DEATH = register("entity.creaking.death"); + public static final SoundEvent CREAKING_STEP = register("entity.creaking.step"); + public static final SoundEvent CREAKING_FREEZE = register("entity.creaking.freeze"); + public static final SoundEvent CREAKING_UNFREEZE = register("entity.creaking.unfreeze"); + public static final SoundEvent CREAKING_SPAWN = register("entity.creaking.spawn"); + public static final SoundEvent CREAKING_SWAY = register("entity.creaking.sway"); + public static final SoundEvent CREAKING_HEART_BREAK = register("block.creaking_heart.break"); + public static final SoundEvent CREAKING_HEART_FALL = register("block.creaking_heart.fall"); + public static final SoundEvent CREAKING_HEART_HIT = register("block.creaking_heart.hit"); + public static final SoundEvent CREAKING_HEART_HURT = register("block.creaking_heart.hurt"); + public static final SoundEvent CREAKING_HEART_PLACE = register("block.creaking_heart.place"); + public static final SoundEvent CREAKING_HEART_STEP = register("block.creaking_heart.step"); + public static final SoundEvent CREAKING_HEART_IDLE = register("block.creaking_heart.idle"); + public static final SoundEvent CREAKING_HEART_SPAWN = register("block.creaking_heart.spawn"); public static final SoundEvent CREEPER_DEATH = register("entity.creeper.death"); public static final SoundEvent CREEPER_HURT = register("entity.creeper.hurt"); public static final SoundEvent CREEPER_PRIMED = register("entity.creeper.primed"); @@ -582,8 +602,8 @@ public class SoundEvents { public static final SoundEvent GENERIC_BIG_FALL = register("entity.generic.big_fall"); public static final SoundEvent GENERIC_BURN = register("entity.generic.burn"); public static final SoundEvent GENERIC_DEATH = register("entity.generic.death"); - public static final SoundEvent GENERIC_DRINK = register("entity.generic.drink"); - public static final SoundEvent GENERIC_EAT = register("entity.generic.eat"); + public static final Holder.Reference GENERIC_DRINK = registerForHolder("entity.generic.drink"); + public static final Holder.Reference GENERIC_EAT = registerForHolder("entity.generic.eat"); public static final Holder.Reference GENERIC_EXPLODE = registerForHolder("entity.generic.explode"); public static final SoundEvent GENERIC_EXTINGUISH_FIRE = register("entity.generic.extinguish_fire"); public static final SoundEvent GENERIC_HURT = register("entity.generic.hurt"); @@ -625,7 +645,6 @@ public class SoundEvents { public static final SoundEvent GOAT_PREPARE_RAM = register("entity.goat.prepare_ram"); public static final SoundEvent GOAT_RAM_IMPACT = register("entity.goat.ram_impact"); public static final SoundEvent GOAT_HORN_BREAK = register("entity.goat.horn_break"); - public static final SoundEvent GOAT_HORN_PLAY = register("item.goat_horn.play"); public static final SoundEvent GOAT_SCREAMING_AMBIENT = register("entity.goat.screaming.ambient"); public static final SoundEvent GOAT_SCREAMING_DEATH = register("entity.goat.screaming.death"); public static final SoundEvent GOAT_SCREAMING_EAT = register("entity.goat.screaming.eat"); @@ -634,7 +653,6 @@ public class SoundEvents { public static final SoundEvent GOAT_SCREAMING_MILK = register("entity.goat.screaming.milk"); public static final SoundEvent GOAT_SCREAMING_PREPARE_RAM = register("entity.goat.screaming.prepare_ram"); public static final SoundEvent GOAT_SCREAMING_RAM_IMPACT = register("entity.goat.screaming.ram_impact"); - public static final SoundEvent GOAT_SCREAMING_HORN_BREAK = register("entity.goat.screaming.horn_break"); public static final SoundEvent GOAT_STEP = register("entity.goat.step"); public static final SoundEvent GRASS_BREAK = register("block.grass.break"); public static final SoundEvent GRASS_FALL = register("block.grass.fall"); @@ -713,12 +731,12 @@ public class SoundEvents { public static final SoundEvent HONEY_BLOCK_SLIDE = register("block.honey_block.slide"); public static final SoundEvent HONEY_BLOCK_STEP = register("block.honey_block.step"); public static final SoundEvent HONEYCOMB_WAX_ON = register("item.honeycomb.wax_on"); - public static final SoundEvent HONEY_DRINK = register("item.honey_bottle.drink"); + public static final Holder.Reference HONEY_DRINK = registerForHolder("item.honey_bottle.drink"); public static final int GOAT_HORN_VARIANT_COUNT = 8; public static final ImmutableList> GOAT_HORN_SOUND_VARIANTS = registerGoatHornSoundVariants(); public static final SoundEvent HORSE_AMBIENT = register("entity.horse.ambient"); public static final SoundEvent HORSE_ANGRY = register("entity.horse.angry"); - public static final SoundEvent HORSE_ARMOR = register("entity.horse.armor"); + public static final Holder.Reference HORSE_ARMOR = registerForHolder("entity.horse.armor"); public static final SoundEvent HORSE_BREATHE = register("entity.horse.breathe"); public static final SoundEvent HORSE_DEATH = register("entity.horse.death"); public static final SoundEvent HORSE_EAT = register("entity.horse.eat"); @@ -1013,9 +1031,10 @@ public class SoundEvents { public static final SoundEvent OCELOT_HURT = register("entity.ocelot.hurt"); public static final SoundEvent OCELOT_AMBIENT = register("entity.ocelot.ambient"); public static final SoundEvent OCELOT_DEATH = register("entity.ocelot.death"); - public static final SoundEvent OMINOUS_BOTTLE_DISPOSE = register("item.ominous_bottle.dispose"); + public static final Holder.Reference OMINOUS_BOTTLE_DISPOSE = registerForHolder("item.ominous_bottle.dispose"); public static final SoundEvent PAINTING_BREAK = register("entity.painting.break"); public static final SoundEvent PAINTING_PLACE = register("entity.painting.place"); + public static final SoundEvent PALE_HANGING_MOSS_IDLE = register("block.pale_hanging_moss.idle"); public static final SoundEvent PANDA_PRE_SNEEZE = register("entity.panda.pre_sneeze"); public static final SoundEvent PANDA_SNEEZE = register("entity.panda.sneeze"); public static final SoundEvent PANDA_AMBIENT = register("entity.panda.ambient"); @@ -1035,6 +1054,7 @@ public class SoundEvents { public static final SoundEvent PARROT_IMITATE_BLAZE = register("entity.parrot.imitate.blaze"); public static final SoundEvent PARROT_IMITATE_BOGGED = register("entity.parrot.imitate.bogged"); public static final SoundEvent PARROT_IMITATE_BREEZE = register("entity.parrot.imitate.breeze"); + public static final SoundEvent PARROT_IMITATE_CREAKING = register("entity.parrot.imitate.creaking"); public static final SoundEvent PARROT_IMITATE_CREEPER = register("entity.parrot.imitate.creeper"); public static final SoundEvent PARROT_IMITATE_DROWNED = register("entity.parrot.imitate.drowned"); public static final SoundEvent PARROT_IMITATE_ELDER_GUARDIAN = register("entity.parrot.imitate.elder_guardian"); @@ -1299,6 +1319,11 @@ public class SoundEvents { public static final SoundEvent SOUL_SOIL_HIT = register("block.soul_soil.hit"); public static final SoundEvent SOUL_SOIL_FALL = register("block.soul_soil.fall"); public static final Holder.Reference SOUL_ESCAPE = registerForHolder("particle.soul_escape"); + public static final SoundEvent SPAWNER_BREAK = register("block.spawner.break"); + public static final SoundEvent SPAWNER_FALL = register("block.spawner.fall"); + public static final SoundEvent SPAWNER_HIT = register("block.spawner.hit"); + public static final SoundEvent SPAWNER_PLACE = register("block.spawner.place"); + public static final SoundEvent SPAWNER_STEP = register("block.spawner.step"); public static final SoundEvent SPORE_BLOSSOM_BREAK = register("block.spore_blossom.break"); public static final SoundEvent SPORE_BLOSSOM_FALL = register("block.spore_blossom.fall"); public static final SoundEvent SPORE_BLOSSOM_HIT = register("block.spore_blossom.hit"); diff --git a/net/minecraft/stats/RecipeBook.java b/net/minecraft/stats/RecipeBook.java index 91d83bdb..557314f5 100644 --- a/net/minecraft/stats/RecipeBook.java +++ b/net/minecraft/stats/RecipeBook.java @@ -1,68 +1,9 @@ package net.minecraft.stats; -import com.google.common.collect.Sets; -import java.util.Set; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.inventory.RecipeBookMenu; import net.minecraft.world.inventory.RecipeBookType; -import net.minecraft.world.item.crafting.RecipeHolder; -import org.jetbrains.annotations.Nullable; public class RecipeBook { - protected final Set known = Sets.newHashSet(); - protected final Set highlight = Sets.newHashSet(); - private final RecipeBookSettings bookSettings = new RecipeBookSettings(); - - public void copyOverData(RecipeBook other) { - this.known.clear(); - this.highlight.clear(); - this.bookSettings.replaceFrom(other.bookSettings); - this.known.addAll(other.known); - this.highlight.addAll(other.highlight); - } - - public void add(RecipeHolder recipe) { - if (!recipe.value().isSpecial()) { - this.add(recipe.id()); - } - } - - protected void add(ResourceLocation recipeId) { - this.known.add(recipeId); - } - - public boolean contains(@Nullable RecipeHolder recipe) { - return recipe == null ? false : this.known.contains(recipe.id()); - } - - public boolean contains(ResourceLocation recipeId) { - return this.known.contains(recipeId); - } - - public void remove(RecipeHolder recipe) { - this.remove(recipe.id()); - } - - protected void remove(ResourceLocation recipeId) { - this.known.remove(recipeId); - this.highlight.remove(recipeId); - } - - public boolean willHighlight(RecipeHolder recipe) { - return this.highlight.contains(recipe.id()); - } - - public void removeHighlight(RecipeHolder recipe) { - this.highlight.remove(recipe.id()); - } - - public void addHighlight(RecipeHolder recipe) { - this.addHighlight(recipe.id()); - } - - protected void addHighlight(ResourceLocation recipeId) { - this.highlight.add(recipeId); - } + protected final RecipeBookSettings bookSettings = new RecipeBookSettings(); public boolean isOpen(RecipeBookType bookType) { return this.bookSettings.isOpen(bookType); @@ -72,10 +13,6 @@ public class RecipeBook { this.bookSettings.setOpen(bookType, open); } - public boolean isFiltering(RecipeBookMenu bookMenu) { - return this.isFiltering(bookMenu.getRecipeBookType()); - } - public boolean isFiltering(RecipeBookType bookType) { return this.bookSettings.isFiltering(bookType); } diff --git a/net/minecraft/stats/RecipeBookSettings.java b/net/minecraft/stats/RecipeBookSettings.java index 59d91502..a0e387ba 100644 --- a/net/minecraft/stats/RecipeBookSettings.java +++ b/net/minecraft/stats/RecipeBookSettings.java @@ -1,15 +1,17 @@ package net.minecraft.stats; import com.google.common.collect.ImmutableMap; -import com.google.common.collect.Maps; import com.mojang.datafixers.util.Pair; +import java.util.EnumMap; import java.util.Map; -import net.minecraft.Util; +import java.util.function.UnaryOperator; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.codec.StreamCodec; import net.minecraft.world.inventory.RecipeBookType; public final class RecipeBookSettings { + public static final StreamCodec STREAM_CODEC = StreamCodec.ofMember(RecipeBookSettings::write, RecipeBookSettings::read); private static final Map> TAG_FIELDS = ImmutableMap.of( RecipeBookType.CRAFTING, Pair.of("isGuiOpen", "isFilteringCraftable"), @@ -27,90 +29,97 @@ public final class RecipeBookSettings { } public RecipeBookSettings() { - this(Util.make(Maps.newEnumMap(RecipeBookType.class), enumMap -> { - for (RecipeBookType recipeBookType : RecipeBookType.values()) { - enumMap.put(recipeBookType, new RecipeBookSettings.TypeSettings(false, false)); + this(new EnumMap(RecipeBookType.class)); + } + + private RecipeBookSettings.TypeSettings getSettings(RecipeBookType recipeBookType) { + return (RecipeBookSettings.TypeSettings)this.states.getOrDefault(recipeBookType, RecipeBookSettings.TypeSettings.DEFAULT); + } + + private void updateSettings(RecipeBookType recipeBookType, UnaryOperator unaryOperator) { + this.states.compute(recipeBookType, (recipeBookTypex, typeSettings) -> { + if (typeSettings == null) { + typeSettings = RecipeBookSettings.TypeSettings.DEFAULT; } - })); + + typeSettings = (RecipeBookSettings.TypeSettings)unaryOperator.apply(typeSettings); + if (typeSettings.equals(RecipeBookSettings.TypeSettings.DEFAULT)) { + typeSettings = null; + } + + return typeSettings; + }); } public boolean isOpen(RecipeBookType bookType) { - return ((RecipeBookSettings.TypeSettings)this.states.get(bookType)).open; + return this.getSettings(bookType).open; } public void setOpen(RecipeBookType bookType, boolean open) { - ((RecipeBookSettings.TypeSettings)this.states.get(bookType)).open = open; + this.updateSettings(bookType, typeSettings -> typeSettings.setOpen(open)); } public boolean isFiltering(RecipeBookType bookType) { - return ((RecipeBookSettings.TypeSettings)this.states.get(bookType)).filtering; + return this.getSettings(bookType).filtering; } public void setFiltering(RecipeBookType bookType, boolean filtering) { - ((RecipeBookSettings.TypeSettings)this.states.get(bookType)).filtering = filtering; + this.updateSettings(bookType, typeSettings -> typeSettings.setFiltering(filtering)); } - public static RecipeBookSettings read(FriendlyByteBuf buffer) { - Map map = Maps.newEnumMap(RecipeBookType.class); + private static RecipeBookSettings read(FriendlyByteBuf buffer) { + Map map = new EnumMap(RecipeBookType.class); for (RecipeBookType recipeBookType : RecipeBookType.values()) { boolean bl = buffer.readBoolean(); boolean bl2 = buffer.readBoolean(); - map.put(recipeBookType, new RecipeBookSettings.TypeSettings(bl, bl2)); + if (bl || bl2) { + map.put(recipeBookType, new RecipeBookSettings.TypeSettings(bl, bl2)); + } } return new RecipeBookSettings(map); } - public void write(FriendlyByteBuf buffer) { + private void write(FriendlyByteBuf buffer) { for (RecipeBookType recipeBookType : RecipeBookType.values()) { - RecipeBookSettings.TypeSettings typeSettings = (RecipeBookSettings.TypeSettings)this.states.get(recipeBookType); - if (typeSettings == null) { - buffer.writeBoolean(false); - buffer.writeBoolean(false); - } else { - buffer.writeBoolean(typeSettings.open); - buffer.writeBoolean(typeSettings.filtering); - } + RecipeBookSettings.TypeSettings typeSettings = (RecipeBookSettings.TypeSettings)this.states + .getOrDefault(recipeBookType, RecipeBookSettings.TypeSettings.DEFAULT); + buffer.writeBoolean(typeSettings.open); + buffer.writeBoolean(typeSettings.filtering); } } public static RecipeBookSettings read(CompoundTag tag) { - Map map = Maps.newEnumMap(RecipeBookType.class); + Map map = new EnumMap(RecipeBookType.class); TAG_FIELDS.forEach((recipeBookType, pair) -> { boolean bl = tag.getBoolean((String)pair.getFirst()); boolean bl2 = tag.getBoolean((String)pair.getSecond()); - map.put(recipeBookType, new RecipeBookSettings.TypeSettings(bl, bl2)); + if (bl || bl2) { + map.put(recipeBookType, new RecipeBookSettings.TypeSettings(bl, bl2)); + } }); return new RecipeBookSettings(map); } public void write(CompoundTag tag) { - TAG_FIELDS.forEach((recipeBookType, pair) -> { - RecipeBookSettings.TypeSettings typeSettings = (RecipeBookSettings.TypeSettings)this.states.get(recipeBookType); - tag.putBoolean((String)pair.getFirst(), typeSettings.open); - tag.putBoolean((String)pair.getSecond(), typeSettings.filtering); - }); + TAG_FIELDS.forEach( + (recipeBookType, pair) -> { + RecipeBookSettings.TypeSettings typeSettings = (RecipeBookSettings.TypeSettings)this.states + .getOrDefault(recipeBookType, RecipeBookSettings.TypeSettings.DEFAULT); + tag.putBoolean((String)pair.getFirst(), typeSettings.open); + tag.putBoolean((String)pair.getSecond(), typeSettings.filtering); + } + ); } public RecipeBookSettings copy() { - Map map = Maps.newEnumMap(RecipeBookType.class); - - for (RecipeBookType recipeBookType : RecipeBookType.values()) { - RecipeBookSettings.TypeSettings typeSettings = (RecipeBookSettings.TypeSettings)this.states.get(recipeBookType); - map.put(recipeBookType, typeSettings.copy()); - } - - return new RecipeBookSettings(map); + return new RecipeBookSettings(new EnumMap(this.states)); } public void replaceFrom(RecipeBookSettings other) { this.states.clear(); - - for (RecipeBookType recipeBookType : RecipeBookType.values()) { - RecipeBookSettings.TypeSettings typeSettings = (RecipeBookSettings.TypeSettings)other.states.get(recipeBookType); - this.states.put(recipeBookType, typeSettings.copy()); - } + this.states.putAll(other.states); } public boolean equals(Object object) { @@ -121,36 +130,19 @@ public final class RecipeBookSettings { return this.states.hashCode(); } - static final class TypeSettings { - boolean open; - boolean filtering; - - public TypeSettings(boolean open, boolean filtering) { - this.open = open; - this.filtering = filtering; - } - - public RecipeBookSettings.TypeSettings copy() { - return new RecipeBookSettings.TypeSettings(this.open, this.filtering); - } - - public boolean equals(Object object) { - if (this == object) { - return true; - } else { - return !(object instanceof RecipeBookSettings.TypeSettings typeSettings) - ? false - : this.open == typeSettings.open && this.filtering == typeSettings.filtering; - } - } - - public int hashCode() { - int i = this.open ? 1 : 0; - return 31 * i + (this.filtering ? 1 : 0); - } + record TypeSettings(boolean open, boolean filtering) { + public static final RecipeBookSettings.TypeSettings DEFAULT = new RecipeBookSettings.TypeSettings(false, false); public String toString() { return "[open=" + this.open + ", filtering=" + this.filtering + "]"; } + + public RecipeBookSettings.TypeSettings setOpen(boolean bl) { + return new RecipeBookSettings.TypeSettings(bl, this.filtering); + } + + public RecipeBookSettings.TypeSettings setFiltering(boolean bl) { + return new RecipeBookSettings.TypeSettings(this.open, bl); + } } } diff --git a/net/minecraft/stats/ServerRecipeBook.java b/net/minecraft/stats/ServerRecipeBook.java index 5e1359a2..75d531f3 100644 --- a/net/minecraft/stats/ServerRecipeBook.java +++ b/net/minecraft/stats/ServerRecipeBook.java @@ -1,69 +1,106 @@ package net.minecraft.stats; +import com.google.common.annotations.VisibleForTesting; import com.google.common.collect.Lists; +import com.google.common.collect.Sets; import com.mojang.logging.LogUtils; +import java.util.ArrayList; import java.util.Collection; -import java.util.Collections; import java.util.List; -import java.util.Optional; +import java.util.Set; import java.util.function.Consumer; +import java.util.function.Predicate; import net.minecraft.ResourceLocationException; import net.minecraft.advancements.CriteriaTriggers; +import net.minecraft.core.registries.Registries; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.ListTag; import net.minecraft.nbt.StringTag; -import net.minecraft.network.protocol.game.ClientboundRecipePacket; +import net.minecraft.network.protocol.game.ClientboundRecipeBookAddPacket; +import net.minecraft.network.protocol.game.ClientboundRecipeBookRemovePacket; +import net.minecraft.network.protocol.game.ClientboundRecipeBookSettingsPacket; +import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.item.crafting.Recipe; import net.minecraft.world.item.crafting.RecipeHolder; -import net.minecraft.world.item.crafting.RecipeManager; +import net.minecraft.world.item.crafting.display.RecipeDisplayEntry; +import net.minecraft.world.item.crafting.display.RecipeDisplayId; import org.slf4j.Logger; public class ServerRecipeBook extends RecipeBook { public static final String RECIPE_BOOK_TAG = "recipeBook"; private static final Logger LOGGER = LogUtils.getLogger(); + private final ServerRecipeBook.DisplayResolver displayResolver; + @VisibleForTesting + protected final Set>> known = Sets.newIdentityHashSet(); + @VisibleForTesting + protected final Set>> highlight = Sets.newIdentityHashSet(); + + public ServerRecipeBook(ServerRecipeBook.DisplayResolver displayResolver) { + this.displayResolver = displayResolver; + } + + public void add(ResourceKey> resourceKey) { + this.known.add(resourceKey); + } + + public boolean contains(ResourceKey> resourceKey) { + return this.known.contains(resourceKey); + } + + public void remove(ResourceKey> resourceKey) { + this.known.remove(resourceKey); + this.highlight.remove(resourceKey); + } + + public void removeHighlight(ResourceKey> resourceKey) { + this.highlight.remove(resourceKey); + } + + private void addHighlight(ResourceKey> resourceKey) { + this.highlight.add(resourceKey); + } public int addRecipes(Collection> recipes, ServerPlayer player) { - List list = Lists.newArrayList(); - int i = 0; + List list = new ArrayList(); for (RecipeHolder recipeHolder : recipes) { - ResourceLocation resourceLocation = recipeHolder.id(); - if (!this.known.contains(resourceLocation) && !recipeHolder.value().isSpecial()) { - this.add(resourceLocation); - this.addHighlight(resourceLocation); - list.add(resourceLocation); + ResourceKey> resourceKey = recipeHolder.id(); + if (!this.known.contains(resourceKey) && !recipeHolder.value().isSpecial()) { + this.add(resourceKey); + this.addHighlight(resourceKey); + this.displayResolver + .displaysForRecipe( + resourceKey, recipeDisplayEntry -> list.add(new ClientboundRecipeBookAddPacket.Entry(recipeDisplayEntry, recipeHolder.value().showNotification(), true)) + ); CriteriaTriggers.RECIPE_UNLOCKED.trigger(player, recipeHolder); - i++; } } - if (list.size() > 0) { - this.sendRecipes(ClientboundRecipePacket.State.ADD, player, list); + if (!list.isEmpty()) { + player.connection.send(new ClientboundRecipeBookAddPacket(list, false)); } - return i; + return list.size(); } public int removeRecipes(Collection> recipes, ServerPlayer player) { - List list = Lists.newArrayList(); - int i = 0; + List list = Lists.newArrayList(); for (RecipeHolder recipeHolder : recipes) { - ResourceLocation resourceLocation = recipeHolder.id(); - if (this.known.contains(resourceLocation)) { - this.remove(resourceLocation); - list.add(resourceLocation); - i++; + ResourceKey> resourceKey = recipeHolder.id(); + if (this.known.contains(resourceKey)) { + this.remove(resourceKey); + this.displayResolver.displaysForRecipe(resourceKey, recipeDisplayEntry -> list.add(recipeDisplayEntry.id())); } } - this.sendRecipes(ClientboundRecipePacket.State.REMOVE, player, list); - return i; - } + if (!list.isEmpty()) { + player.connection.send(new ClientboundRecipeBookRemovePacket(list)); + } - private void sendRecipes(ClientboundRecipePacket.State state, ServerPlayer player, List recipes) { - player.connection.send(new ClientboundRecipePacket(state, recipes, Collections.emptyList(), this.getBookSettings())); + return list.size(); } public CompoundTag toNbt() { @@ -71,48 +108,70 @@ public class ServerRecipeBook extends RecipeBook { this.getBookSettings().write(compoundTag); ListTag listTag = new ListTag(); - for (ResourceLocation resourceLocation : this.known) { - listTag.add(StringTag.valueOf(resourceLocation.toString())); + for (ResourceKey> resourceKey : this.known) { + listTag.add(StringTag.valueOf(resourceKey.location().toString())); } compoundTag.put("recipes", listTag); ListTag listTag2 = new ListTag(); - for (ResourceLocation resourceLocation2 : this.highlight) { - listTag2.add(StringTag.valueOf(resourceLocation2.toString())); + for (ResourceKey> resourceKey2 : this.highlight) { + listTag2.add(StringTag.valueOf(resourceKey2.location().toString())); } compoundTag.put("toBeDisplayed", listTag2); return compoundTag; } - public void fromNbt(CompoundTag tag, RecipeManager recipeManager) { - this.setBookSettings(RecipeBookSettings.read(tag)); - ListTag listTag = tag.getList("recipes", 8); - this.loadRecipes(listTag, this::add, recipeManager); - ListTag listTag2 = tag.getList("toBeDisplayed", 8); - this.loadRecipes(listTag2, this::addHighlight, recipeManager); + public void fromNbt(CompoundTag compoundTag, Predicate>> predicate) { + this.setBookSettings(RecipeBookSettings.read(compoundTag)); + ListTag listTag = compoundTag.getList("recipes", 8); + this.loadRecipes(listTag, this::add, predicate); + ListTag listTag2 = compoundTag.getList("toBeDisplayed", 8); + this.loadRecipes(listTag2, this::addHighlight, predicate); } - private void loadRecipes(ListTag tags, Consumer> recipeConsumer, RecipeManager recipeManager) { - for (int i = 0; i < tags.size(); i++) { - String string = tags.getString(i); + private void loadRecipes(ListTag listTag, Consumer>> consumer, Predicate>> predicate) { + for (int i = 0; i < listTag.size(); i++) { + String string = listTag.getString(i); try { - ResourceLocation resourceLocation = ResourceLocation.parse(string); - Optional> optional = recipeManager.byKey(resourceLocation); - if (optional.isEmpty()) { - LOGGER.error("Tried to load unrecognized recipe: {} removed now.", resourceLocation); + ResourceKey> resourceKey = ResourceKey.create(Registries.RECIPE, ResourceLocation.parse(string)); + if (!predicate.test(resourceKey)) { + LOGGER.error("Tried to load unrecognized recipe: {} removed now.", resourceKey); } else { - recipeConsumer.accept((RecipeHolder)optional.get()); + consumer.accept(resourceKey); } - } catch (ResourceLocationException var8) { + } catch (ResourceLocationException var7) { LOGGER.error("Tried to load improperly formatted recipe: {} removed now.", string); } } } public void sendInitialRecipeBook(ServerPlayer player) { - player.connection.send(new ClientboundRecipePacket(ClientboundRecipePacket.State.INIT, this.known, this.highlight, this.getBookSettings())); + player.connection.send(new ClientboundRecipeBookSettingsPacket(this.getBookSettings())); + List list = new ArrayList(this.known.size()); + + for (ResourceKey> resourceKey : this.known) { + this.displayResolver + .displaysForRecipe( + resourceKey, recipeDisplayEntry -> list.add(new ClientboundRecipeBookAddPacket.Entry(recipeDisplayEntry, false, this.highlight.contains(resourceKey))) + ); + } + + player.connection.send(new ClientboundRecipeBookAddPacket(list, true)); + } + + public void copyOverData(ServerRecipeBook serverRecipeBook) { + this.known.clear(); + this.highlight.clear(); + this.bookSettings.replaceFrom(serverRecipeBook.bookSettings); + this.known.addAll(serverRecipeBook.known); + this.highlight.addAll(serverRecipeBook.highlight); + } + + @FunctionalInterface + public interface DisplayResolver { + void displaysForRecipe(ResourceKey> resourceKey, Consumer consumer); } } diff --git a/net/minecraft/stats/StatFormatter.java b/net/minecraft/stats/StatFormatter.java index 18814238..16f9c103 100644 --- a/net/minecraft/stats/StatFormatter.java +++ b/net/minecraft/stats/StatFormatter.java @@ -37,7 +37,7 @@ public interface StatFormatter { } else if (f > 0.5) { return DECIMAL_FORMAT.format(f) + " h"; } else { - return e > 0.5 ? DECIMAL_FORMAT.format(e) + " m" : d + " s"; + return e > 0.5 ? DECIMAL_FORMAT.format(e) + " min" : d + " s"; } }; diff --git a/net/minecraft/tags/BannerPatternTags.java b/net/minecraft/tags/BannerPatternTags.java index 15b2b3e7..f666e5df 100644 --- a/net/minecraft/tags/BannerPatternTags.java +++ b/net/minecraft/tags/BannerPatternTags.java @@ -14,6 +14,8 @@ public class BannerPatternTags { public static final TagKey PATTERN_ITEM_PIGLIN = create("pattern_item/piglin"); public static final TagKey PATTERN_ITEM_FLOW = create("pattern_item/flow"); public static final TagKey PATTERN_ITEM_GUSTER = create("pattern_item/guster"); + public static final TagKey PATTERN_ITEM_FIELD_MASONED = create("pattern_item/field_masoned"); + public static final TagKey PATTERN_ITEM_BORDURE_INDENTED = create("pattern_item/bordure_indented"); private BannerPatternTags() { } diff --git a/net/minecraft/tags/BlockTags.java b/net/minecraft/tags/BlockTags.java index 5d7062ee..5acf5f73 100644 --- a/net/minecraft/tags/BlockTags.java +++ b/net/minecraft/tags/BlockTags.java @@ -27,6 +27,7 @@ public final class BlockTags { public static final TagKey OVERWORLD_NATURAL_LOGS = create("overworld_natural_logs"); public static final TagKey LOGS = create("logs"); public static final TagKey DARK_OAK_LOGS = create("dark_oak_logs"); + public static final TagKey PALE_OAK_LOGS = create("pale_oak_logs"); public static final TagKey OAK_LOGS = create("oak_logs"); public static final TagKey BIRCH_LOGS = create("birch_logs"); public static final TagKey ACACIA_LOGS = create("acacia_logs"); @@ -68,6 +69,7 @@ public final class BlockTags { public static final TagKey BADLANDS_TERRACOTTA = create("badlands_terracotta"); public static final TagKey CONCRETE_POWDER = create("concrete_powder"); public static final TagKey COMPLETES_FIND_TREE_TUTORIAL = create("completes_find_tree_tutorial"); + public static final TagKey SHULKER_BOXES = create("shulker_boxes"); public static final TagKey FLOWER_POTS = create("flower_pots"); public static final TagKey ENDERMAN_HOLDABLE = create("enderman_holdable"); public static final TagKey ICE = create("ice"); @@ -101,7 +103,6 @@ public final class BlockTags { public static final TagKey WALL_POST_OVERRIDE = create("wall_post_override"); public static final TagKey CLIMBABLE = create("climbable"); public static final TagKey FALL_DAMAGE_RESETTING = create("fall_damage_resetting"); - public static final TagKey SHULKER_BOXES = create("shulker_boxes"); public static final TagKey HOGLIN_REPELLENTS = create("hoglin_repellents"); public static final TagKey SOUL_FIRE_BASE_BLOCKS = create("soul_fire_base_blocks"); public static final TagKey STRIDER_WARM_BLOCKS = create("strider_warm_blocks"); @@ -169,6 +170,7 @@ public final class BlockTags { public static final TagKey FOXES_SPAWNABLE_ON = create("foxes_spawnable_on"); public static final TagKey WOLVES_SPAWNABLE_ON = create("wolves_spawnable_on"); public static final TagKey FROGS_SPAWNABLE_ON = create("frogs_spawnable_on"); + public static final TagKey BATS_SPAWNABLE_ON = create("bats_spawnable_on"); public static final TagKey AZALEA_GROWS_ON = create("azalea_grows_on"); public static final TagKey CONVERTABLE_TO_MUD = create("convertable_to_mud"); public static final TagKey MANGROVE_LOGS_CAN_GROW_THROUGH = create("mangrove_logs_can_grow_through"); diff --git a/net/minecraft/tags/DamageTypeTags.java b/net/minecraft/tags/DamageTypeTags.java index 6e85e749..2be0e395 100644 --- a/net/minecraft/tags/DamageTypeTags.java +++ b/net/minecraft/tags/DamageTypeTags.java @@ -38,6 +38,7 @@ public interface DamageTypeTags { TagKey BURN_FROM_STEPPING = create("burn_from_stepping"); TagKey PANIC_CAUSES = create("panic_causes"); TagKey PANIC_ENVIRONMENTAL_CAUSES = create("panic_environmental_causes"); + TagKey IS_MACE_SMASH = create("mace_smash"); private static TagKey create(String name) { return TagKey.create(Registries.DAMAGE_TYPE, ResourceLocation.withDefaultNamespace(name)); diff --git a/net/minecraft/tags/EntityTypeTags.java b/net/minecraft/tags/EntityTypeTags.java index 4a03041e..e7fc7e15 100644 --- a/net/minecraft/tags/EntityTypeTags.java +++ b/net/minecraft/tags/EntityTypeTags.java @@ -39,6 +39,7 @@ public interface EntityTypeTags { TagKey> IMMUNE_TO_OOZING = create("immune_to_oozing"); TagKey> IMMUNE_TO_INFESTED = create("immune_to_infested"); TagKey> REDIRECTABLE_PROJECTILE = create("redirectable_projectile"); + TagKey> BOAT = create("boat"); private static TagKey> create(String name) { return TagKey.create(Registries.ENTITY_TYPE, ResourceLocation.withDefaultNamespace(name)); diff --git a/net/minecraft/tags/ItemTags.java b/net/minecraft/tags/ItemTags.java index 86d74f86..302d0586 100644 --- a/net/minecraft/tags/ItemTags.java +++ b/net/minecraft/tags/ItemTags.java @@ -24,6 +24,7 @@ public final class ItemTags { public static final TagKey LOGS_THAT_BURN = bind("logs_that_burn"); public static final TagKey LOGS = bind("logs"); public static final TagKey DARK_OAK_LOGS = bind("dark_oak_logs"); + public static final TagKey PALE_OAK_LOGS = bind("pale_oak_logs"); public static final TagKey OAK_LOGS = bind("oak_logs"); public static final TagKey BIRCH_LOGS = bind("birch_logs"); public static final TagKey ACACIA_LOGS = bind("acacia_logs"); @@ -53,6 +54,10 @@ public final class ItemTags { public static final TagKey PIGLIN_REPELLENTS = bind("piglin_repellents"); public static final TagKey PIGLIN_LOVED = bind("piglin_loved"); public static final TagKey IGNORED_BY_PIGLIN_BABIES = bind("ignored_by_piglin_babies"); + public static final TagKey PIGLIN_SAFE_ARMOR = bind("piglin_safe_armor"); + public static final TagKey DUPLICATES_ALLAYS = bind("duplicates_allays"); + public static final TagKey BREWING_FUEL = bind("brewing_fuel"); + public static final TagKey SHULKER_BOXES = bind("shulker_boxes"); public static final TagKey MEAT = bind("meat"); public static final TagKey SNIFFER_FOOD = bind("sniffer_food"); public static final TagKey PIGLIN_FOOD = bind("piglin_food"); @@ -74,6 +79,7 @@ public final class ItemTags { public static final TagKey LLAMA_TEMPT_ITEMS = bind("llama_tempt_items"); public static final TagKey OCELOT_FOOD = bind("ocelot_food"); public static final TagKey PANDA_FOOD = bind("panda_food"); + public static final TagKey PANDA_EATS_FROM_GROUND = bind("panda_eats_from_ground"); public static final TagKey PIG_FOOD = bind("pig_food"); public static final TagKey RABBIT_FOOD = bind("rabbit_food"); public static final TagKey STRIDER_FOOD = bind("strider_food"); @@ -106,7 +112,20 @@ public final class ItemTags { public static final TagKey LECTERN_BOOKS = bind("lectern_books"); public static final TagKey BOOKSHELF_BOOKS = bind("bookshelf_books"); public static final TagKey BEACON_PAYMENT_ITEMS = bind("beacon_payment_items"); + public static final TagKey WOODEN_TOOL_MATERIALS = bind("wooden_tool_materials"); public static final TagKey STONE_TOOL_MATERIALS = bind("stone_tool_materials"); + public static final TagKey IRON_TOOL_MATERIALS = bind("iron_tool_materials"); + public static final TagKey GOLD_TOOL_MATERIALS = bind("gold_tool_materials"); + public static final TagKey DIAMOND_TOOL_MATERIALS = bind("diamond_tool_materials"); + public static final TagKey NETHERITE_TOOL_MATERIALS = bind("netherite_tool_materials"); + public static final TagKey REPAIRS_LEATHER_ARMOR = bind("repairs_leather_armor"); + public static final TagKey REPAIRS_CHAIN_ARMOR = bind("repairs_chain_armor"); + public static final TagKey REPAIRS_IRON_ARMOR = bind("repairs_iron_armor"); + public static final TagKey REPAIRS_GOLD_ARMOR = bind("repairs_gold_armor"); + public static final TagKey REPAIRS_DIAMOND_ARMOR = bind("repairs_diamond_armor"); + public static final TagKey REPAIRS_NETHERITE_ARMOR = bind("repairs_netherite_armor"); + public static final TagKey REPAIRS_TURTLE_HELMET = bind("repairs_turtle_helmet"); + public static final TagKey REPAIRS_WOLF_ARMOR = bind("repairs_wolf_armor"); public static final TagKey STONE_CRAFTING_MATERIALS = bind("stone_crafting_materials"); public static final TagKey FREEZE_IMMUNE_WEARABLES = bind("freeze_immune_wearables"); public static final TagKey DAMPENS_VIBRATIONS = bind("dampens_vibrations"); @@ -132,7 +151,10 @@ public final class ItemTags { public static final TagKey SHOVELS = bind("shovels"); public static final TagKey BREAKS_DECORATED_POTS = bind("breaks_decorated_pots"); public static final TagKey VILLAGER_PLANTABLE_SEEDS = bind("villager_plantable_seeds"); + public static final TagKey VILLAGER_PICKS_UP = bind("villager_picks_up"); public static final TagKey DYEABLE = bind("dyeable"); + public static final TagKey FURNACE_MINECART_FUEL = bind("furnace_minecart_fuel"); + public static final TagKey BUNDLES = bind("bundles"); public static final TagKey FOOT_ARMOR_ENCHANTABLE = bind("enchantable/foot_armor"); public static final TagKey LEG_ARMOR_ENCHANTABLE = bind("enchantable/leg_armor"); public static final TagKey CHEST_ARMOR_ENCHANTABLE = bind("enchantable/chest_armor"); @@ -152,6 +174,8 @@ public final class ItemTags { public static final TagKey CROSSBOW_ENCHANTABLE = bind("enchantable/crossbow"); public static final TagKey VANISHING_ENCHANTABLE = bind("enchantable/vanishing"); public static final TagKey MACE_ENCHANTABLE = bind("enchantable/mace"); + public static final TagKey MAP_INVISIBILITY_EQUIPMENT = bind("map_invisibility_equipment"); + public static final TagKey GAZE_DISGUISE_EQUIPMENT = bind("gaze_disguise_equipment"); private ItemTags() { } diff --git a/net/minecraft/tags/TagEntry.java b/net/minecraft/tags/TagEntry.java index 3f83399e..a5796ebf 100644 --- a/net/minecraft/tags/TagEntry.java +++ b/net/minecraft/tags/TagEntry.java @@ -68,7 +68,7 @@ public class TagEntry { collection.forEach(consumer); } else { - T object = lookup.element(this.id); + T object = lookup.element(this.id, this.required); if (object == null) { return !this.required; } @@ -111,7 +111,7 @@ public class TagEntry { public interface Lookup { @Nullable - T element(ResourceLocation elementLocation); + T element(ResourceLocation resourceLocation, boolean bl); @Nullable Collection tag(ResourceLocation tagLocation); diff --git a/net/minecraft/tags/TagKey.java b/net/minecraft/tags/TagKey.java index 7fe43a1c..af849e32 100644 --- a/net/minecraft/tags/TagKey.java +++ b/net/minecraft/tags/TagKey.java @@ -4,8 +4,10 @@ import com.google.common.collect.Interner; import com.google.common.collect.Interners; import com.mojang.serialization.Codec; import com.mojang.serialization.DataResult; +import io.netty.buffer.ByteBuf; import java.util.Optional; import net.minecraft.core.Registry; +import net.minecraft.network.codec.StreamCodec; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; @@ -32,6 +34,10 @@ public record TagKey(ResourceKey> registry, ResourceLoc ); } + public static StreamCodec> streamCodec(ResourceKey> resourceKey) { + return ResourceLocation.STREAM_CODEC.map(resourceLocation -> create(resourceKey, resourceLocation), TagKey::location); + } + public static TagKey create(ResourceKey> registry, ResourceLocation location) { return (TagKey)VALUES.intern(new TagKey<>(registry, location)); } diff --git a/net/minecraft/tags/TagLoader.java b/net/minecraft/tags/TagLoader.java index e641832a..d5a2357c 100644 --- a/net/minecraft/tags/TagLoader.java +++ b/net/minecraft/tags/TagLoader.java @@ -1,8 +1,5 @@ package net.minecraft.tags; -import com.google.common.collect.ImmutableSet; -import com.google.common.collect.Maps; -import com.google.common.collect.ImmutableSet.Builder; import com.google.gson.JsonElement; import com.google.gson.JsonParser; import com.mojang.datafixers.util.Either; @@ -12,15 +9,25 @@ import com.mojang.serialization.JsonOps; import java.io.Reader; import java.util.ArrayList; import java.util.Collection; +import java.util.HashMap; +import java.util.LinkedHashSet; import java.util.List; import java.util.Map; import java.util.Objects; import java.util.Optional; +import java.util.SequencedSet; import java.util.Map.Entry; import java.util.function.Consumer; -import java.util.function.Function; import java.util.stream.Collectors; +import net.minecraft.core.Holder; +import net.minecraft.core.HolderGetter; +import net.minecraft.core.HolderLookup; +import net.minecraft.core.Registry; +import net.minecraft.core.RegistryAccess; +import net.minecraft.core.WritableRegistry; +import net.minecraft.core.registries.Registries; import net.minecraft.resources.FileToIdConverter; +import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.packs.resources.Resource; import net.minecraft.server.packs.resources.ResourceManager; @@ -30,16 +37,16 @@ import org.slf4j.Logger; public class TagLoader { private static final Logger LOGGER = LogUtils.getLogger(); - final Function> idToValue; + final TagLoader.ElementLookup elementLookup; private final String directory; - public TagLoader(Function> idToValue, String directory) { - this.idToValue = idToValue; - this.directory = directory; + public TagLoader(TagLoader.ElementLookup elementLookup, String string) { + this.elementLookup = elementLookup; + this.directory = string; } public Map> load(ResourceManager resourceManager) { - Map> map = Maps.>newHashMap(); + Map> map = new HashMap(); FileToIdConverter fileToIdConverter = FileToIdConverter.json(this.directory); for (Entry> entry : fileToIdConverter.listMatchingResourceStacks(resourceManager).entrySet()) { @@ -84,26 +91,26 @@ public class TagLoader { return map; } - private Either, Collection> build(TagEntry.Lookup lookup, List entries) { - Builder builder = ImmutableSet.builder(); - List list = new ArrayList(); + private Either, List> tryBuildTag(TagEntry.Lookup lookup, List list) { + SequencedSet sequencedSet = new LinkedHashSet(); + List list2 = new ArrayList(); - for (TagLoader.EntryWithSource entryWithSource : entries) { - if (!entryWithSource.entry().build(lookup, builder::add)) { - list.add(entryWithSource); + for (TagLoader.EntryWithSource entryWithSource : list) { + if (!entryWithSource.entry().build(lookup, sequencedSet::add)) { + list2.add(entryWithSource); } } - return list.isEmpty() ? Either.right(builder.build()) : Either.left(list); + return list2.isEmpty() ? Either.right(List.copyOf(sequencedSet)) : Either.left(list2); } - public Map> build(Map> builders) { - final Map> map = Maps.>newHashMap(); + public Map> build(Map> builders) { + final Map> map = new HashMap(); TagEntry.Lookup lookup = new TagEntry.Lookup() { @Nullable @Override - public T element(ResourceLocation elementLocation) { - return (T)((Optional)TagLoader.this.idToValue.apply(elementLocation)).orElse(null); + public T element(ResourceLocation resourceLocation, boolean bl) { + return (T)TagLoader.this.elementLookup.get(resourceLocation, bl).orElse(null); } @Nullable @@ -115,21 +122,83 @@ public class TagLoader { DependencySorter dependencySorter = new DependencySorter<>(); builders.forEach((resourceLocation, list) -> dependencySorter.addEntry(resourceLocation, new TagLoader.SortingEntry(list))); dependencySorter.orderByDependencies( - (resourceLocation, sortingEntry) -> this.build(lookup, sortingEntry.entries) + (resourceLocation, sortingEntry) -> this.tryBuildTag(lookup, sortingEntry.entries) .ifLeft( - collection -> LOGGER.error( + list -> LOGGER.error( "Couldn't load tag {} as it is missing following references: {}", resourceLocation, - collection.stream().map(Objects::toString).collect(Collectors.joining(", ")) + list.stream().map(Objects::toString).collect(Collectors.joining(", ")) ) ) - .ifRight(collection -> map.put(resourceLocation, collection)) + .ifRight(list -> map.put(resourceLocation, list)) ); return map; } - public Map> loadAndBuild(ResourceManager resourceManager) { - return this.build(this.load(resourceManager)); + public static void loadTagsFromNetwork(TagNetworkSerialization.NetworkPayload networkPayload, WritableRegistry writableRegistry) { + networkPayload.resolve(writableRegistry).tags.forEach(writableRegistry::bindTag); + } + + public static List> loadTagsForExistingRegistries(ResourceManager resourceManager, RegistryAccess registryAccess) { + return (List>)registryAccess.registries() + .map(registryEntry -> loadPendingTags(resourceManager, registryEntry.value())) + .flatMap(Optional::stream) + .collect(Collectors.toUnmodifiableList()); + } + + public static void loadTagsForRegistry(ResourceManager resourceManager, WritableRegistry writableRegistry) { + ResourceKey> resourceKey = writableRegistry.key(); + TagLoader> tagLoader = new TagLoader<>(TagLoader.ElementLookup.fromWritableRegistry(writableRegistry), Registries.tagsDirPath(resourceKey)); + tagLoader.build(tagLoader.load(resourceManager)) + .forEach((resourceLocation, list) -> writableRegistry.bindTag(TagKey.create(resourceKey, resourceLocation), list)); + } + + private static Map, List>> wrapTags(ResourceKey> resourceKey, Map>> map) { + return (Map, List>>)map.entrySet() + .stream() + .collect(Collectors.toUnmodifiableMap(entry -> TagKey.create(resourceKey, (ResourceLocation)entry.getKey()), Entry::getValue)); + } + + private static Optional> loadPendingTags(ResourceManager resourceManager, Registry registry) { + ResourceKey> resourceKey = registry.key(); + TagLoader> tagLoader = new TagLoader<>( + (TagLoader.ElementLookup>)TagLoader.ElementLookup.fromFrozenRegistry(registry), Registries.tagsDirPath(resourceKey) + ); + TagLoader.LoadResult loadResult = new TagLoader.LoadResult<>(resourceKey, wrapTags(registry.key(), tagLoader.build(tagLoader.load(resourceManager)))); + return loadResult.tags().isEmpty() ? Optional.empty() : Optional.of(registry.prepareTagReload(loadResult)); + } + + public static List> buildUpdatedLookups(RegistryAccess.Frozen frozen, List> list) { + List> list2 = new ArrayList(); + frozen.registries().forEach(registryEntry -> { + Registry.PendingTags pendingTags = findTagsForRegistry(list, registryEntry.key()); + list2.add(pendingTags != null ? pendingTags.lookup() : registryEntry.value()); + }); + return list2; + } + + @Nullable + private static Registry.PendingTags findTagsForRegistry(List> list, ResourceKey> resourceKey) { + for (Registry.PendingTags pendingTags : list) { + if (pendingTags.key() == resourceKey) { + return pendingTags; + } + } + + return null; + } + + public interface ElementLookup { + Optional get(ResourceLocation resourceLocation, boolean bl); + + static TagLoader.ElementLookup> fromFrozenRegistry(Registry registry) { + return (resourceLocation, bl) -> registry.get(resourceLocation); + } + + static TagLoader.ElementLookup> fromWritableRegistry(WritableRegistry writableRegistry) { + HolderGetter holderGetter = writableRegistry.createRegistrationLookup(); + return (resourceLocation, bl) -> ((HolderGetter)(bl ? holderGetter : writableRegistry)).get(ResourceKey.create(writableRegistry.key(), resourceLocation)); + } } public record EntryWithSource(TagEntry entry, String source) { @@ -139,7 +208,10 @@ public class TagLoader { } } - record SortingEntry(List entries) implements DependencySorter.Entry { + public record LoadResult(ResourceKey> key, Map, List>> tags) { + } + + record SortingEntry(List entries) implements net.minecraft.util.DependencySorter.Entry { @Override public void visitRequiredDependencies(Consumer visitor) { diff --git a/net/minecraft/tags/TagManager.java b/net/minecraft/tags/TagManager.java deleted file mode 100644 index a97d07e9..00000000 --- a/net/minecraft/tags/TagManager.java +++ /dev/null @@ -1,62 +0,0 @@ -package net.minecraft.tags; - -import java.util.Collection; -import java.util.List; -import java.util.Map; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.Executor; -import java.util.stream.Collectors; -import net.minecraft.core.Holder; -import net.minecraft.core.Registry; -import net.minecraft.core.RegistryAccess; -import net.minecraft.core.registries.Registries; -import net.minecraft.resources.ResourceKey; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.server.packs.resources.PreparableReloadListener; -import net.minecraft.server.packs.resources.ResourceManager; -import net.minecraft.util.profiling.ProfilerFiller; - -public class TagManager implements PreparableReloadListener { - private final RegistryAccess registryAccess; - private List> results = List.of(); - - public TagManager(RegistryAccess registryAccess) { - this.registryAccess = registryAccess; - } - - public List> getResult() { - return this.results; - } - - @Override - public CompletableFuture reload( - PreparableReloadListener.PreparationBarrier preparationBarrier, - ResourceManager resourceManager, - ProfilerFiller preparationsProfiler, - ProfilerFiller reloadProfiler, - Executor backgroundExecutor, - Executor gameExecutor - ) { - List>> list = this.registryAccess - .registries() - .map(registryEntry -> this.createLoader(resourceManager, backgroundExecutor, registryEntry)) - .toList(); - return CompletableFuture.allOf((CompletableFuture[])list.toArray(CompletableFuture[]::new)) - .thenCompose(preparationBarrier::wait) - .thenAcceptAsync( - void_ -> this.results = (List>)list.stream().map(CompletableFuture::join).collect(Collectors.toUnmodifiableList()), gameExecutor - ); - } - - private CompletableFuture> createLoader( - ResourceManager resourceManager, Executor backgroundExecutor, RegistryAccess.RegistryEntry entry - ) { - ResourceKey> resourceKey = entry.key(); - Registry registry = entry.value(); - TagLoader> tagLoader = new TagLoader<>(registry::getHolder, Registries.tagsDirPath(resourceKey)); - return CompletableFuture.supplyAsync(() -> new TagManager.LoadResult<>(resourceKey, tagLoader.loadAndBuild(resourceManager)), backgroundExecutor); - } - - public record LoadResult(ResourceKey> key, Map>> tags) { - } -} diff --git a/net/minecraft/tags/TagNetworkSerialization.java b/net/minecraft/tags/TagNetworkSerialization.java index b0a3c2a9..4d9d3cfe 100644 --- a/net/minecraft/tags/TagNetworkSerialization.java +++ b/net/minecraft/tags/TagNetworkSerialization.java @@ -9,7 +9,6 @@ import java.util.Map; import java.util.Optional; import java.util.stream.Collectors; import net.minecraft.core.Holder; -import net.minecraft.core.HolderSet; import net.minecraft.core.LayeredRegistryAccess; import net.minecraft.core.Registry; import net.minecraft.core.RegistrySynchronization; @@ -24,17 +23,16 @@ public class TagNetworkSerialization { ) { return (Map>, TagNetworkSerialization.NetworkPayload>)RegistrySynchronization.networkSafeRegistries(registryAccess) .map(registryEntry -> Pair.of(registryEntry.key(), serializeToNetwork(registryEntry.value()))) - .filter(pair -> ((TagNetworkSerialization.NetworkPayload)pair.getSecond()).size() > 0) + .filter(pair -> !((TagNetworkSerialization.NetworkPayload)pair.getSecond()).isEmpty()) .collect(Collectors.toMap(Pair::getFirst, Pair::getSecond)); } private static TagNetworkSerialization.NetworkPayload serializeToNetwork(Registry registry) { Map map = new HashMap(); - registry.getTags().forEach(pair -> { - HolderSet holderSet = (HolderSet)pair.getSecond(); - IntList intList = new IntArrayList(holderSet.size()); + registry.getTags().forEach(named -> { + IntList intList = new IntArrayList(named.size()); - for (Holder holder : holderSet) { + for (Holder holder : named) { if (holder.kind() != Holder.Kind.REFERENCE) { throw new IllegalStateException("Can't serialize unregistered value " + holder); } @@ -42,25 +40,24 @@ public class TagNetworkSerialization { intList.add(registry.getId(holder.value())); } - map.put(((TagKey)pair.getFirst()).location(), intList); + map.put(named.key().location(), intList); }); return new TagNetworkSerialization.NetworkPayload(map); } - static void deserializeTagsFromNetwork( - ResourceKey> registryKey, - Registry registry, - TagNetworkSerialization.NetworkPayload networkPayload, - TagNetworkSerialization.TagOutput output - ) { + static TagLoader.LoadResult deserializeTagsFromNetwork(Registry registry, TagNetworkSerialization.NetworkPayload networkPayload) { + ResourceKey> resourceKey = registry.key(); + Map, List>> map = new HashMap(); networkPayload.tags.forEach((resourceLocation, intList) -> { - TagKey tagKey = TagKey.create(registryKey, resourceLocation); - List> list = (List>)intList.intStream().mapToObj(registry::getHolder).flatMap(Optional::stream).collect(Collectors.toUnmodifiableList()); - output.accept(tagKey, list); + TagKey tagKey = TagKey.create(resourceKey, resourceLocation); + List> list = (List>)intList.intStream().mapToObj(registry::get).flatMap(Optional::stream).collect(Collectors.toUnmodifiableList()); + map.put(tagKey, list); }); + return new TagLoader.LoadResult<>(resourceKey, map); } public static final class NetworkPayload { + public static final TagNetworkSerialization.NetworkPayload EMPTY = new TagNetworkSerialization.NetworkPayload(Map.of()); final Map tags; NetworkPayload(Map tags) { @@ -75,21 +72,16 @@ public class TagNetworkSerialization { return new TagNetworkSerialization.NetworkPayload(buffer.readMap(FriendlyByteBuf::readResourceLocation, FriendlyByteBuf::readIntIdList)); } + public boolean isEmpty() { + return this.tags.isEmpty(); + } + public int size() { return this.tags.size(); } - public void applyToRegistry(Registry registry) { - if (this.size() != 0) { - Map, List>> map = new HashMap(this.size()); - TagNetworkSerialization.deserializeTagsFromNetwork(registry.key(), registry, this, map::put); - registry.bindTags(map); - } + public TagLoader.LoadResult resolve(Registry registry) { + return TagNetworkSerialization.deserializeTagsFromNetwork(registry, this); } } - - @FunctionalInterface - public interface TagOutput { - void accept(TagKey tagKey, List> list); - } } diff --git a/net/minecraft/util/ARGB.java b/net/minecraft/util/ARGB.java new file mode 100644 index 00000000..112251fb --- /dev/null +++ b/net/minecraft/util/ARGB.java @@ -0,0 +1,116 @@ +package net.minecraft.util; + +import net.minecraft.world.phys.Vec3; +import org.joml.Vector3f; + +public class ARGB { + public static int alpha(int i) { + return i >>> 24; + } + + public static int red(int i) { + return i >> 16 & 0xFF; + } + + public static int green(int i) { + return i >> 8 & 0xFF; + } + + public static int blue(int i) { + return i & 0xFF; + } + + public static int color(int i, int j, int k, int l) { + return i << 24 | j << 16 | k << 8 | l; + } + + public static int color(int i, int j, int k) { + return color(255, i, j, k); + } + + public static int color(Vec3 vec3) { + return color(as8BitChannel((float)vec3.x()), as8BitChannel((float)vec3.y()), as8BitChannel((float)vec3.z())); + } + + public static int multiply(int i, int j) { + if (i == -1) { + return j; + } else { + return j == -1 ? i : color(alpha(i) * alpha(j) / 255, red(i) * red(j) / 255, green(i) * green(j) / 255, blue(i) * blue(j) / 255); + } + } + + public static int scaleRGB(int i, float f) { + return scaleRGB(i, f, f, f); + } + + public static int scaleRGB(int i, float f, float g, float h) { + return color(alpha(i), Math.clamp((int)(red(i) * f), 0, 255), Math.clamp((int)(green(i) * g), 0, 255), Math.clamp((int)(blue(i) * h), 0, 255)); + } + + public static int scaleRGB(int i, int j) { + return color( + alpha(i), Math.clamp((long)red(i) * j / 255L, 0, 255), Math.clamp((long)green(i) * j / 255L, 0, 255), Math.clamp((long)blue(i) * j / 255L, 0, 255) + ); + } + + public static int greyscale(int i) { + int j = (int)(red(i) * 0.3F + green(i) * 0.59F + blue(i) * 0.11F); + return color(j, j, j); + } + + public static int lerp(float f, int i, int j) { + int k = Mth.lerpInt(f, alpha(i), alpha(j)); + int l = Mth.lerpInt(f, red(i), red(j)); + int m = Mth.lerpInt(f, green(i), green(j)); + int n = Mth.lerpInt(f, blue(i), blue(j)); + return color(k, l, m, n); + } + + public static int opaque(int i) { + return i | 0xFF000000; + } + + public static int transparent(int i) { + return i & 16777215; + } + + public static int color(int i, int j) { + return i << 24 | j & 16777215; + } + + public static int white(float f) { + return as8BitChannel(f) << 24 | 16777215; + } + + public static int colorFromFloat(float f, float g, float h, float i) { + return color(as8BitChannel(f), as8BitChannel(g), as8BitChannel(h), as8BitChannel(i)); + } + + public static Vector3f vector3fFromRGB24(int i) { + float f = red(i) / 255.0F; + float g = green(i) / 255.0F; + float h = blue(i) / 255.0F; + return new Vector3f(f, g, h); + } + + public static int average(int i, int j) { + return color((alpha(i) + alpha(j)) / 2, (red(i) + red(j)) / 2, (green(i) + green(j)) / 2, (blue(i) + blue(j)) / 2); + } + + public static int as8BitChannel(float f) { + return Mth.floor(f * 255.0F); + } + + public static float from8BitChannel(int i) { + return i / 255.0F; + } + + public static int toABGR(int i) { + return i & -16711936 | (i & 0xFF0000) >> 16 | (i & 0xFF) << 16; + } + + public static int fromABGR(int i) { + return toABGR(i); + } +} diff --git a/net/minecraft/util/BinaryAnimator.java b/net/minecraft/util/BinaryAnimator.java new file mode 100644 index 00000000..27a05521 --- /dev/null +++ b/net/minecraft/util/BinaryAnimator.java @@ -0,0 +1,37 @@ +package net.minecraft.util; + +public class BinaryAnimator { + private final int animationLength; + private final BinaryAnimator.EasingFunction easingFunction; + private int ticks; + private int ticksOld; + + public BinaryAnimator(int i, BinaryAnimator.EasingFunction easingFunction) { + this.animationLength = i; + this.easingFunction = easingFunction; + } + + public BinaryAnimator(int i) { + this(i, f -> f); + } + + public void tick(boolean bl) { + this.ticksOld = this.ticks; + if (bl) { + if (this.ticks < this.animationLength) { + this.ticks++; + } + } else if (this.ticks > 0) { + this.ticks--; + } + } + + public float getFactor(float f) { + float g = Mth.lerp(f, (float)this.ticksOld, (float)this.ticks) / this.animationLength; + return this.easingFunction.apply(g); + } + + public interface EasingFunction { + float apply(float f); + } +} diff --git a/net/minecraft/util/CommonColors.java b/net/minecraft/util/CommonColors.java index fb2fc47c..0a3e207d 100644 --- a/net/minecraft/util/CommonColors.java +++ b/net/minecraft/util/CommonColors.java @@ -7,9 +7,11 @@ public class CommonColors { public static final int LIGHT_GRAY = -6250336; public static final int LIGHTER_GRAY = -4539718; public static final int RED = -65536; + public static final int SOFT_RED = -2142128; public static final int GREEN = -16711936; public static final int BLUE = -16776961; - public static final int SOFT_RED = -2142128; public static final int YELLOW = -256; public static final int SOFT_YELLOW = -171; + public static final int DARK_PURPLE = -11534256; + public static final int HIGH_CONTRAST_DIAMOND = -11010079; } diff --git a/net/minecraft/util/CommonLinks.java b/net/minecraft/util/CommonLinks.java index ac190243..3cd59efd 100644 --- a/net/minecraft/util/CommonLinks.java +++ b/net/minecraft/util/CommonLinks.java @@ -3,6 +3,7 @@ package net.minecraft.util; import com.mojang.util.UndashedUuid; import java.net.URI; import java.util.UUID; +import org.jetbrains.annotations.Nullable; public class CommonLinks { public static final URI GDPR = URI.create("https://aka.ms/MinecraftGDPR"); @@ -25,12 +26,17 @@ public class CommonLinks { public static final URI BUY_REALMS = URI.create("https://aka.ms/BuyJavaRealms"); public static final URI REALMS_TERMS = URI.create("https://aka.ms/MinecraftRealmsTerms"); public static final URI REALMS_CONTENT_CREATION = URI.create("https://aka.ms/MinecraftRealmsContentCreator"); + public static final String EXTEND_REALMS_LINK = "https://aka.ms/ExtendJavaRealms"; - public static String extendRealms(String subscriptionId, UUID profileId, boolean isTrial) { - return extendRealms(subscriptionId, profileId) + "&ref=" + (isTrial ? "expiredTrial" : "expiredRealm"); + public static String extendRealms(@Nullable String subscriptionId, UUID profileId, boolean isTrial) { + return subscriptionId == null + ? "https://aka.ms/ExtendJavaRealms" + : extendRealms(subscriptionId, profileId) + "&ref=" + (isTrial ? "expiredTrial" : "expiredRealm"); } - public static String extendRealms(String subscriptionId, UUID profileId) { - return "https://aka.ms/ExtendJavaRealms?subscriptionId=" + subscriptionId + "&profileId=" + UndashedUuid.toString(profileId); + public static String extendRealms(@Nullable String subscriptionId, UUID profileId) { + return subscriptionId == null + ? "https://aka.ms/ExtendJavaRealms" + : "https://aka.ms/ExtendJavaRealms?subscriptionId=" + subscriptionId + "&profileId=" + UndashedUuid.toString(profileId); } } diff --git a/net/minecraft/util/ExtraCodecs.java b/net/minecraft/util/ExtraCodecs.java index 0c746ce4..3a5193c4 100644 --- a/net/minecraft/util/ExtraCodecs.java +++ b/net/minecraft/util/ExtraCodecs.java @@ -92,7 +92,7 @@ public class ExtraCodecs { .apply(instance, AxisAngle4f::new) ); public static final Codec QUATERNIONF = Codec.withAlternative(QUATERNIONF_COMPONENTS, AXISANGLE4F.xmap(Quaternionf::new, AxisAngle4f::new)); - public static Codec MATRIX4F = Codec.FLOAT.listOf().comapFlatMap(list -> Util.fixedSize(list, 16).map(listx -> { + public static final Codec MATRIX4F = Codec.FLOAT.listOf().comapFlatMap(list -> Util.fixedSize(list, 16).map(listx -> { Matrix4f matrix4f = new Matrix4f(); for (int i = 0; i < listx.size(); i++) { @@ -109,8 +109,11 @@ public class ExtraCodecs { return floatList; }); + public static final Codec RGB_COLOR_CODEC = Codec.withAlternative( + Codec.INT, VECTOR3F, vector3f -> ARGB.colorFromFloat(1.0F, vector3f.x(), vector3f.y(), vector3f.z()) + ); public static final Codec ARGB_COLOR_CODEC = Codec.withAlternative( - Codec.INT, VECTOR4F, vector4f -> FastColor.ARGB32.colorFromFloat(vector4f.w(), vector4f.x(), vector4f.y(), vector4f.z()) + Codec.INT, VECTOR4F, vector4f -> ARGB.colorFromFloat(vector4f.w(), vector4f.x(), vector4f.y(), vector4f.z()) ); public static final Codec UNSIGNED_BYTE = Codec.BYTE .flatComapMap( @@ -119,6 +122,9 @@ public class ExtraCodecs { ); public static final Codec NON_NEGATIVE_INT = intRangeWithMessage(0, Integer.MAX_VALUE, integer -> "Value must be non-negative: " + integer); public static final Codec POSITIVE_INT = intRangeWithMessage(1, Integer.MAX_VALUE, integer -> "Value must be positive: " + integer); + public static final Codec NON_NEGATIVE_FLOAT = floatRangeMinInclusiveWithMessage( + 0.0F, Float.MAX_VALUE, float_ -> "Value must be non-negative: " + float_ + ); public static final Codec POSITIVE_FLOAT = floatRangeMinExclusiveWithMessage(0.0F, Float.MAX_VALUE, float_ -> "Value must be positive: " + float_); public static final Codec PATTERN = Codec.STRING.comapFlatMap(string -> { try { @@ -199,7 +205,7 @@ public class ExtraCodecs { int[] is = string.codePoints().toArray(); return is.length != 1 ? DataResult.error(() -> "Expected one codepoint, got: " + string) : DataResult.success(is[0]); }, Character::toString); - public static Codec RESOURCE_PATH_CODEC = Codec.STRING + public static final Codec RESOURCE_PATH_CODEC = Codec.STRING .validate( string -> !ResourceLocation.isValidPath(string) ? DataResult.error(() -> "Invalid string to use as a resource path element: " + string) @@ -344,6 +350,13 @@ public class ExtraCodecs { return intRangeWithMessage(min, max, integer -> "Value must be within range [" + min + ";" + max + "]: " + integer); } + private static Codec floatRangeMinInclusiveWithMessage(float f, float g, Function function) { + return Codec.FLOAT + .validate( + float_ -> float_.compareTo(f) >= 0 && float_.compareTo(g) <= 0 ? DataResult.success(float_) : DataResult.error(() -> (String)function.apply(float_)) + ); + } + private static Codec floatRangeMinExclusiveWithMessage(float min, float max, Function errorMessage) { return Codec.FLOAT .validate( @@ -363,6 +376,10 @@ public class ExtraCodecs { ); } + public static > Codec nonEmptyMap(Codec codec) { + return codec.validate(map -> map.isEmpty() ? DataResult.error(() -> "Map must have contents") : DataResult.success(map)); + } + public static MapCodec retrieveContext(Function, DataResult> retriever) { class ContextRetrievalCodec extends MapCodec { @Override diff --git a/net/minecraft/util/FastColor.java b/net/minecraft/util/FastColor.java deleted file mode 100644 index 6ff5d7c4..00000000 --- a/net/minecraft/util/FastColor.java +++ /dev/null @@ -1,104 +0,0 @@ -package net.minecraft.util; - -public class FastColor { - public static int as8BitChannel(float value) { - return Mth.floor(value * 255.0F); - } - - public static class ABGR32 { - public static int alpha(int packedColor) { - return packedColor >>> 24; - } - - public static int red(int packedColor) { - return packedColor & 0xFF; - } - - public static int green(int packedColor) { - return packedColor >> 8 & 0xFF; - } - - public static int blue(int packedColor) { - return packedColor >> 16 & 0xFF; - } - - public static int transparent(int packedColor) { - return packedColor & 16777215; - } - - public static int opaque(int packedColor) { - return packedColor | 0xFF000000; - } - - public static int color(int alpha, int blue, int green, int red) { - return alpha << 24 | blue << 16 | green << 8 | red; - } - - public static int color(int alpha, int packedColor) { - return alpha << 24 | packedColor & 16777215; - } - - public static int fromArgb32(int color) { - return color & -16711936 | (color & 0xFF0000) >> 16 | (color & 0xFF) << 16; - } - } - - public static class ARGB32 { - public static int alpha(int packedColor) { - return packedColor >>> 24; - } - - public static int red(int packedColor) { - return packedColor >> 16 & 0xFF; - } - - public static int green(int packedColor) { - return packedColor >> 8 & 0xFF; - } - - public static int blue(int packedColor) { - return packedColor & 0xFF; - } - - public static int color(int alpha, int red, int green, int blue) { - return alpha << 24 | red << 16 | green << 8 | blue; - } - - public static int color(int red, int green, int blue) { - return color(255, red, green, blue); - } - - public static int multiply(int packedColourOne, int packedColorTwo) { - return color( - alpha(packedColourOne) * alpha(packedColorTwo) / 255, - red(packedColourOne) * red(packedColorTwo) / 255, - green(packedColourOne) * green(packedColorTwo) / 255, - blue(packedColourOne) * blue(packedColorTwo) / 255 - ); - } - - public static int lerp(float delta, int min, int max) { - int i = Mth.lerpInt(delta, alpha(min), alpha(max)); - int j = Mth.lerpInt(delta, red(min), red(max)); - int k = Mth.lerpInt(delta, green(min), green(max)); - int l = Mth.lerpInt(delta, blue(min), blue(max)); - return color(i, j, k, l); - } - - public static int opaque(int color) { - return color | 0xFF000000; - } - - public static int color(int alpha, int color) { - return alpha << 24 | color & 16777215; - } - - public static int colorFromFloat(float alpha, float red, float green, float blue) { - return color(FastColor.as8BitChannel(alpha), FastColor.as8BitChannel(red), FastColor.as8BitChannel(green), FastColor.as8BitChannel(blue)); - } - - public static int average(int color1, int color2) { - return color((alpha(color1) + alpha(color2)) / 2, (red(color1) + red(color2)) / 2, (green(color1) + green(color2)) / 2, (blue(color1) + blue(color2)) / 2); - } - } -} diff --git a/net/minecraft/util/GsonHelper.java b/net/minecraft/util/GsonHelper.java index bc5a22d0..85c3f753 100644 --- a/net/minecraft/util/GsonHelper.java +++ b/net/minecraft/util/GsonHelper.java @@ -133,7 +133,7 @@ public class GsonHelper { if (json.isJsonPrimitive()) { String string = json.getAsString(); return (Holder)BuiltInRegistries.ITEM - .getHolder(ResourceLocation.parse(string)) + .get(ResourceLocation.parse(string)) .orElseThrow(() -> new JsonSyntaxException("Expected " + memberName + " to be an item, was unknown string '" + string + "'")); } else { throw new JsonSyntaxException("Expected " + memberName + " to be an item, was " + getType(json)); diff --git a/net/minecraft/util/MemoryReserve.java b/net/minecraft/util/MemoryReserve.java index 60ff6a90..f19eaa0d 100644 --- a/net/minecraft/util/MemoryReserve.java +++ b/net/minecraft/util/MemoryReserve.java @@ -4,13 +4,22 @@ import org.jetbrains.annotations.Nullable; public class MemoryReserve { @Nullable - private static byte[] reserve = null; + private static byte[] reserve; public static void allocate() { reserve = new byte[10485760]; } public static void release() { - reserve = new byte[0]; + if (reserve != null) { + reserve = null; + + try { + System.gc(); + System.gc(); + System.gc(); + } catch (Throwable var1) { + } + } } } diff --git a/net/minecraft/util/Mth.java b/net/minecraft/util/Mth.java index 4c2b61e5..903c68a9 100644 --- a/net/minecraft/util/Mth.java +++ b/net/minecraft/util/Mth.java @@ -233,6 +233,14 @@ public class Mth { return number % multiple == 0; } + public static byte packDegrees(float f) { + return (byte)floor(f * 256.0F / 360.0F); + } + + public static float unpackDegrees(byte b) { + return b * 360 / 256.0F; + } + /** * Adjust the angle so that its value is in the range [-180;180) */ @@ -249,6 +257,19 @@ public class Mth { return i; } + public static float wrapDegrees(long l) { + float f = (float)(l % 360L); + if (f >= 180.0F) { + f -= 360.0F; + } + + if (f < -180.0F) { + f += 360.0F; + } + + return f; + } + /** * The angle is reduced to an angle between -180 and +180 by mod, and a 360 check. */ @@ -368,13 +389,6 @@ public class Mth { return ceillog2(value) - (isPowerOfTwo(value) ? 0 : 1); } - /** - * Makes an integer color from the given red, green, and blue float values - */ - public static int color(float r, float g, float b) { - return FastColor.ARGB32.color(0, floor(r * 255.0F), floor(g * 255.0F), floor(b * 255.0F)); - } - public static float frac(float number) { return number - floor(number); } @@ -583,7 +597,7 @@ public class Mth { throw new RuntimeException("Something went wrong when converting from HSV to RGB. Input was " + hue + ", " + saturation + ", " + value); } - return FastColor.ARGB32.color(alpha, clamp((int)(k * 255.0F), 0, 255), clamp((int)(l * 255.0F), 0, 255), clamp((int)(m * 255.0F), 0, 255)); + return ARGB.color(alpha, clamp((int)(k * 255.0F), 0, 255), clamp((int)(l * 255.0F), 0, 255), clamp((int)(m * 255.0F), 0, 255)); } public static int murmurHash3Mixer(int input) { @@ -631,6 +645,10 @@ public class Mth { return start + delta * (end - start); } + public static Vec3 lerp(double d, Vec3 vec3, Vec3 vec32) { + return new Vec3(lerp(d, vec3.x, vec32.x), lerp(d, vec3.y, vec32.y), lerp(d, vec3.z, vec32.z)); + } + /** * Method for linear interpolation of doubles * @@ -691,6 +709,20 @@ public class Mth { return start + delta * wrapDegrees(end - start); } + public static float rotLerpRad(float f, float g, float h) { + float i = h - g; + + while (i < (float) -Math.PI) { + i += (float) (Math.PI * 2); + } + + while (i >= (float) Math.PI) { + i -= (float) (Math.PI * 2); + } + + return g + f * i; + } + public static float triangleWave(float input, float period) { return (Math.abs(input % period - period * 0.5F) - period * 0.25F) / (period * 0.25F); } @@ -770,6 +802,10 @@ public class Mth { return Math.sqrt(lengthSquared(xDistance, yDistance)); } + public static float length(float f, float g) { + return (float)Math.sqrt(lengthSquared(f, g)); + } + public static double lengthSquared(double xDistance, double yDistance, double zDistance) { return xDistance * xDistance + yDistance * yDistance + zDistance * zDistance; } @@ -827,6 +863,10 @@ public class Mth { return fraction.getNumerator() * factor / fraction.getDenominator(); } + public static float easeInOutSine(float f) { + return -(cos((float) Math.PI * f) - 1.0F) / 2.0F; + } + static { for (int i = 0; i < 257; i++) { double d = i / 256.0; diff --git a/net/minecraft/util/RandomSource.java b/net/minecraft/util/RandomSource.java index 6080a6ea..b5219919 100644 --- a/net/minecraft/util/RandomSource.java +++ b/net/minecraft/util/RandomSource.java @@ -63,6 +63,10 @@ public interface RandomSource { return center + maxDeviation * (this.nextDouble() - this.nextDouble()); } + default float triangle(float f, float g) { + return f + g * (this.nextFloat() - this.nextFloat()); + } + default void consumeCount(int count) { for (int i = 0; i < count; i++) { this.nextInt(); diff --git a/net/minecraft/util/SpawnUtil.java b/net/minecraft/util/SpawnUtil.java index a7cea91e..b3c6f4c8 100644 --- a/net/minecraft/util/SpawnUtil.java +++ b/net/minecraft/util/SpawnUtil.java @@ -4,9 +4,10 @@ import java.util.Optional; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.server.level.ServerLevel; +import net.minecraft.tags.BlockTags; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.Mob; -import net.minecraft.world.entity.MobSpawnType; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.LeavesBlock; @@ -16,19 +17,19 @@ import net.minecraft.world.level.block.state.BlockState; public class SpawnUtil { public static Optional trySpawnMob( - EntityType entityType, MobSpawnType spawnType, ServerLevel level, BlockPos pos, int attempts, int spread, int yOffset, SpawnUtil.Strategy strategy + EntityType entityType, EntitySpawnReason entitySpawnReason, ServerLevel serverLevel, BlockPos blockPos, int i, int j, int k, SpawnUtil.Strategy strategy ) { - BlockPos.MutableBlockPos mutableBlockPos = pos.mutable(); + BlockPos.MutableBlockPos mutableBlockPos = blockPos.mutable(); - for (int i = 0; i < attempts; i++) { - int j = Mth.randomBetweenInclusive(level.random, -spread, spread); - int k = Mth.randomBetweenInclusive(level.random, -spread, spread); - mutableBlockPos.setWithOffset(pos, j, yOffset, k); - if (level.getWorldBorder().isWithinBounds(mutableBlockPos) && moveToPossibleSpawnPosition(level, yOffset, mutableBlockPos, strategy)) { - T mob = (T)entityType.create(level, null, mutableBlockPos, spawnType, false, false); + for (int l = 0; l < i; l++) { + int m = Mth.randomBetweenInclusive(serverLevel.random, -j, j); + int n = Mth.randomBetweenInclusive(serverLevel.random, -j, j); + mutableBlockPos.setWithOffset(blockPos, m, k, n); + if (serverLevel.getWorldBorder().isWithinBounds(mutableBlockPos) && moveToPossibleSpawnPosition(serverLevel, k, mutableBlockPos, strategy)) { + T mob = (T)entityType.create(serverLevel, null, mutableBlockPos, entitySpawnReason, false, false); if (mob != null) { - if (mob.checkSpawnRules(level, spawnType) && mob.checkSpawnObstruction(level)) { - level.addFreshEntityWithPassengers(mob); + if (mob.checkSpawnRules(serverLevel, entitySpawnReason) && mob.checkSpawnObstruction(serverLevel)) { + serverLevel.addFreshEntityWithPassengers(mob); return Optional.of(mob); } @@ -81,6 +82,12 @@ public class SpawnUtil { SpawnUtil.Strategy ON_TOP_OF_COLLIDER = (serverLevel, blockPos, blockState, blockPos2, blockState2) -> blockState2.getCollisionShape(serverLevel, blockPos2) .isEmpty() && Block.isFaceFull(blockState.getCollisionShape(serverLevel, blockPos), Direction.UP); + SpawnUtil.Strategy ON_TOP_OF_COLLIDER_NO_LEAVES = (serverLevel, blockPos, blockState, blockPos2, blockState2) -> blockState2.getCollisionShape( + serverLevel, blockPos2 + ) + .isEmpty() + && !blockState.is(BlockTags.LEAVES) + && Block.isFaceFull(blockState.getCollisionShape(serverLevel, blockPos), Direction.UP); boolean canSpawnOn(ServerLevel serverLevel, BlockPos blockPos, BlockState blockState, BlockPos blockPos2, BlockState blockState2); } diff --git a/net/minecraft/util/StringRepresentable.java b/net/minecraft/util/StringRepresentable.java index d9e5a23d..7a222fa3 100644 --- a/net/minecraft/util/StringRepresentable.java +++ b/net/minecraft/util/StringRepresentable.java @@ -86,6 +86,10 @@ public interface StringRepresentable { public E byName(@Nullable String name, E defaultValue) { return (E)Objects.requireNonNullElse(this.byName(name), defaultValue); } + + public E byName(@Nullable String string, Supplier supplier) { + return (E)Objects.requireNonNullElseGet(this.byName(string), supplier); + } } public static class StringRepresentableCodec implements Codec { diff --git a/net/minecraft/util/StringUtil.java b/net/minecraft/util/StringUtil.java index 6c706c29..c7ffa3ee 100644 --- a/net/minecraft/util/StringUtil.java +++ b/net/minecraft/util/StringUtil.java @@ -93,6 +93,6 @@ public class StringUtil { } public static boolean isBlank(@Nullable String string) { - return string != null && string.length() != 0 ? string.chars().allMatch(StringUtil::isWhitespace) : true; + return string != null && !string.isEmpty() ? string.chars().allMatch(StringUtil::isWhitespace) : true; } } diff --git a/net/minecraft/util/TickThrottler.java b/net/minecraft/util/TickThrottler.java new file mode 100644 index 00000000..cde73baf --- /dev/null +++ b/net/minecraft/util/TickThrottler.java @@ -0,0 +1,26 @@ +package net.minecraft.util; + +public class TickThrottler { + private final int incrementStep; + private final int threshold; + private int count; + + public TickThrottler(int i, int j) { + this.incrementStep = i; + this.threshold = j; + } + + public void increment() { + this.count = this.count + this.incrementStep; + } + + public void tick() { + if (this.count > 0) { + this.count--; + } + } + + public boolean isUnderThreshold() { + return this.count < this.threshold; + } +} diff --git a/net/minecraft/util/TriState.java b/net/minecraft/util/TriState.java new file mode 100644 index 00000000..c7dd92a0 --- /dev/null +++ b/net/minecraft/util/TriState.java @@ -0,0 +1,15 @@ +package net.minecraft.util; + +public enum TriState { + TRUE, + FALSE, + DEFAULT; + + public boolean toBoolean(boolean bl) { + return switch (this) { + case TRUE -> true; + case FALSE -> false; + default -> bl; + }; + } +} diff --git a/net/minecraft/util/context/ContextKey.java b/net/minecraft/util/context/ContextKey.java new file mode 100644 index 00000000..63246e96 --- /dev/null +++ b/net/minecraft/util/context/ContextKey.java @@ -0,0 +1,23 @@ +package net.minecraft.util.context; + +import net.minecraft.resources.ResourceLocation; + +public class ContextKey { + private final ResourceLocation name; + + public ContextKey(ResourceLocation resourceLocation) { + this.name = resourceLocation; + } + + public static ContextKey vanilla(String string) { + return new ContextKey<>(ResourceLocation.withDefaultNamespace(string)); + } + + public ResourceLocation name() { + return this.name; + } + + public String toString() { + return ""; + } +} diff --git a/net/minecraft/util/context/ContextKeySet.java b/net/minecraft/util/context/ContextKeySet.java new file mode 100644 index 00000000..1d250cc1 --- /dev/null +++ b/net/minecraft/util/context/ContextKeySet.java @@ -0,0 +1,56 @@ +package net.minecraft.util.context; + +import com.google.common.base.Joiner; +import com.google.common.collect.Sets; +import java.util.Set; + +public class ContextKeySet { + private final Set> required; + private final Set> allowed; + + ContextKeySet(Set> set, Set> set2) { + this.required = Set.copyOf(set); + this.allowed = Set.copyOf(Sets.union(set, set2)); + } + + public Set> required() { + return this.required; + } + + public Set> allowed() { + return this.allowed; + } + + public String toString() { + return "[" + + Joiner.on(", ").join(this.allowed.stream().map(contextKey -> (this.required.contains(contextKey) ? "!" : "") + contextKey.name()).iterator()) + + "]"; + } + + public static class Builder { + private final Set> required = Sets.newIdentityHashSet(); + private final Set> optional = Sets.newIdentityHashSet(); + + public ContextKeySet.Builder required(ContextKey contextKey) { + if (this.optional.contains(contextKey)) { + throw new IllegalArgumentException("Parameter " + contextKey.name() + " is already optional"); + } else { + this.required.add(contextKey); + return this; + } + } + + public ContextKeySet.Builder optional(ContextKey contextKey) { + if (this.required.contains(contextKey)) { + throw new IllegalArgumentException("Parameter " + contextKey.name() + " is already required"); + } else { + this.optional.add(contextKey); + return this; + } + } + + public ContextKeySet build() { + return new ContextKeySet(this.required, this.optional); + } + } +} diff --git a/net/minecraft/util/context/ContextMap.java b/net/minecraft/util/context/ContextMap.java new file mode 100644 index 00000000..f9d63555 --- /dev/null +++ b/net/minecraft/util/context/ContextMap.java @@ -0,0 +1,88 @@ +package net.minecraft.util.context; + +import com.google.common.collect.Sets; +import java.util.IdentityHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Set; +import org.jetbrains.annotations.Contract; +import org.jetbrains.annotations.Nullable; + +public class ContextMap { + private final Map, Object> params; + + ContextMap(Map, Object> map) { + this.params = map; + } + + public boolean has(ContextKey contextKey) { + return this.params.containsKey(contextKey); + } + + public T getOrThrow(ContextKey contextKey) { + T object = (T)this.params.get(contextKey); + if (object == null) { + throw new NoSuchElementException(contextKey.name().toString()); + } else { + return object; + } + } + + @Nullable + public T getOptional(ContextKey contextKey) { + return (T)this.params.get(contextKey); + } + + @Nullable + @Contract("_,!null->!null; _,_->_") + public T getOrDefault(ContextKey contextKey, @Nullable T object) { + return (T)this.params.getOrDefault(contextKey, object); + } + + public static class Builder { + private final Map, Object> params = new IdentityHashMap(); + + public ContextMap.Builder withParameter(ContextKey contextKey, T object) { + this.params.put(contextKey, object); + return this; + } + + public ContextMap.Builder withOptionalParameter(ContextKey contextKey, @Nullable T object) { + if (object == null) { + this.params.remove(contextKey); + } else { + this.params.put(contextKey, object); + } + + return this; + } + + public T getParameter(ContextKey contextKey) { + T object = (T)this.params.get(contextKey); + if (object == null) { + throw new NoSuchElementException(contextKey.name().toString()); + } else { + return object; + } + } + + @Nullable + public T getOptionalParameter(ContextKey contextKey) { + return (T)this.params.get(contextKey); + } + + public ContextMap create(ContextKeySet contextKeySet) { + Set> set = Sets.>difference(this.params.keySet(), contextKeySet.allowed()); + if (!set.isEmpty()) { + throw new IllegalArgumentException("Parameters not allowed in this parameter set: " + set); + } else { + Set> set2 = Sets.>difference(contextKeySet.required(), this.params.keySet()); + if (!set2.isEmpty()) { + throw new IllegalArgumentException("Missing required parameters: " + set2); + } else { + return new ContextMap(this.params); + } + } + } + } +} diff --git a/net/minecraft/util/context/package-info.java b/net/minecraft/util/context/package-info.java new file mode 100644 index 00000000..649e2fdb --- /dev/null +++ b/net/minecraft/util/context/package-info.java @@ -0,0 +1,8 @@ +@ParametersAreNonnullByDefault +@MethodsReturnNonnullByDefault +@FieldsAreNonnullByDefault +package net.minecraft.util.context; + +import javax.annotation.ParametersAreNonnullByDefault; +import net.minecraft.FieldsAreNonnullByDefault; +import net.minecraft.MethodsReturnNonnullByDefault; diff --git a/net/minecraft/util/datafix/DataFixers.java b/net/minecraft/util/datafix/DataFixers.java index 6a912438..09bbd4ac 100644 --- a/net/minecraft/util/datafix/DataFixers.java +++ b/net/minecraft/util/datafix/DataFixers.java @@ -29,8 +29,9 @@ import net.minecraft.util.datafix.fixes.AddNewChoices; import net.minecraft.util.datafix.fixes.AdvancementsFix; import net.minecraft.util.datafix.fixes.AdvancementsRenameFix; import net.minecraft.util.datafix.fixes.AreaEffectCloudPotionFix; +import net.minecraft.util.datafix.fixes.AttributeIdPrefixFix; import net.minecraft.util.datafix.fixes.AttributeModifierIdFix; -import net.minecraft.util.datafix.fixes.AttributesRename; +import net.minecraft.util.datafix.fixes.AttributesRenameLegacy; import net.minecraft.util.datafix.fixes.BannerEntityCustomNameToOverrideComponentFix; import net.minecraft.util.datafix.fixes.BannerPatternFormatFix; import net.minecraft.util.datafix.fixes.BedItemColorFix; @@ -54,6 +55,8 @@ import net.minecraft.util.datafix.fixes.BlockNameFlatteningFix; import net.minecraft.util.datafix.fixes.BlockPosFormatAndRenamesFix; import net.minecraft.util.datafix.fixes.BlockRenameFix; import net.minecraft.util.datafix.fixes.BlockStateStructureTemplateFix; +import net.minecraft.util.datafix.fixes.BoatSplitFix; +import net.minecraft.util.datafix.fixes.CarvingStepRemoveFix; import net.minecraft.util.datafix.fixes.CatTypeFix; import net.minecraft.util.datafix.fixes.CauldronRenameFix; import net.minecraft.util.datafix.fixes.CavesAndCliffsRenames; @@ -72,6 +75,7 @@ import net.minecraft.util.datafix.fixes.ChunkStatusFix2; import net.minecraft.util.datafix.fixes.ChunkStructuresTemplateRenameFix; import net.minecraft.util.datafix.fixes.ChunkToProtochunkFix; import net.minecraft.util.datafix.fixes.ColorlessShulkerEntityFix; +import net.minecraft.util.datafix.fixes.ContainerBlockEntityLockPredicateFix; import net.minecraft.util.datafix.fixes.CriteriaRenameFix; import net.minecraft.util.datafix.fixes.DecoratedPotFieldRenameFix; import net.minecraft.util.datafix.fixes.DropInvalidSignDataFix; @@ -117,7 +121,9 @@ import net.minecraft.util.datafix.fixes.EntityZombifiedPiglinRenameFix; import net.minecraft.util.datafix.fixes.FeatureFlagRemoveFix; import net.minecraft.util.datafix.fixes.FilteredBooksFix; import net.minecraft.util.datafix.fixes.FilteredSignsFix; +import net.minecraft.util.datafix.fixes.FireResistantToDamageResistantComponentFix; import net.minecraft.util.datafix.fixes.FixProjectileStoredItem; +import net.minecraft.util.datafix.fixes.FoodToConsumableFix; import net.minecraft.util.datafix.fixes.ForcePoiRebuild; import net.minecraft.util.datafix.fixes.FurnaceRecipeFix; import net.minecraft.util.datafix.fixes.GoatHornIdFix; @@ -152,6 +158,7 @@ import net.minecraft.util.datafix.fixes.LevelDataGeneratorOptionsFix; import net.minecraft.util.datafix.fixes.LevelFlatGeneratorInfoFix; import net.minecraft.util.datafix.fixes.LevelLegacyWorldGenSettingsFix; import net.minecraft.util.datafix.fixes.LevelUUIDFix; +import net.minecraft.util.datafix.fixes.LockComponentPredicateFix; import net.minecraft.util.datafix.fixes.LodestoneCompassComponentFix; import net.minecraft.util.datafix.fixes.MapBannerBlockPosFormatFix; import net.minecraft.util.datafix.fixes.MapIdFix; @@ -165,6 +172,7 @@ import net.minecraft.util.datafix.fixes.NewVillageFix; import net.minecraft.util.datafix.fixes.ObjectiveDisplayNameFix; import net.minecraft.util.datafix.fixes.ObjectiveRenderTypeFix; import net.minecraft.util.datafix.fixes.OminousBannerBlockEntityRenameFix; +import net.minecraft.util.datafix.fixes.OminousBannerRarityFix; import net.minecraft.util.datafix.fixes.OminousBannerRenameFix; import net.minecraft.util.datafix.fixes.OptionsAccessibilityOnboardFix; import net.minecraft.util.datafix.fixes.OptionsAddTextBackgroundFix; @@ -210,10 +218,12 @@ import net.minecraft.util.datafix.fixes.TeamDisplayNameFix; import net.minecraft.util.datafix.fixes.TippedArrowPotionToItemFix; import net.minecraft.util.datafix.fixes.TrappedChestBlockEntityFix; import net.minecraft.util.datafix.fixes.TrialSpawnerConfigFix; +import net.minecraft.util.datafix.fixes.TrialSpawnerConfigInRegistryFix; import net.minecraft.util.datafix.fixes.VariantRenameFix; import net.minecraft.util.datafix.fixes.VillagerDataFix; import net.minecraft.util.datafix.fixes.VillagerFollowRangeFix; import net.minecraft.util.datafix.fixes.VillagerRebuildLevelAndXpFix; +import net.minecraft.util.datafix.fixes.VillagerSetCanPickUpLootFix; import net.minecraft.util.datafix.fixes.VillagerTradeFix; import net.minecraft.util.datafix.fixes.WallPropertyFix; import net.minecraft.util.datafix.fixes.WeaponSmithChestLootTableFix; @@ -302,6 +312,10 @@ import net.minecraft.util.datafix.schemas.V3818_4; import net.minecraft.util.datafix.schemas.V3818_5; import net.minecraft.util.datafix.schemas.V3825; import net.minecraft.util.datafix.schemas.V3938; +import net.minecraft.util.datafix.schemas.V4059; +import net.minecraft.util.datafix.schemas.V4067; +import net.minecraft.util.datafix.schemas.V4070; +import net.minecraft.util.datafix.schemas.V4071; import net.minecraft.util.datafix.schemas.V501; import net.minecraft.util.datafix.schemas.V700; import net.minecraft.util.datafix.schemas.V701; @@ -346,6 +360,7 @@ public class DataFixers { builder.addFixer(new EntityEquipmentToArmorAndHandFix(schema, true)); Schema schema2 = builder.addSchema(101, SAME); builder.addFixer(new BlockEntitySignTextStrictJsonFix(schema2, false)); + builder.addFixer(new VillagerSetCanPickUpLootFix(schema2)); Schema schema3 = builder.addSchema(102, V102::new); builder.addFixer(new ItemIdFix(schema3, true)); builder.addFixer(new ItemPotionFix(schema3, false)); @@ -442,7 +457,7 @@ public class DataFixers { schema42, false, Set.of( - "minecraft:note_block", + "minecraft:noteblock", "minecraft:flower_pot", "minecraft:dandelion", "minecraft:poppy", @@ -776,7 +791,7 @@ public class DataFixers { builder.addFixer(new AddNewChoices(schema111, "Added Zoglin", References.ENTITY)); Schema schema112 = builder.addSchema(2523, SAME_NAMESPACED); builder.addFixer( - new AttributesRename( + new AttributesRenameLegacy( schema112, "Attribute renames", createRenamerNoNamespace( @@ -1268,7 +1283,7 @@ public class DataFixers { builder.addFixer(new BlockPosFormatAndRenamesFix(schema209)); Schema schema210 = builder.addSchema(3814, SAME_NAMESPACED); builder.addFixer( - new AttributesRename(schema210, "Rename jump strength attribute", createRenamer("minecraft:horse.jump_strength", "minecraft:generic.jump_strength")) + new AttributesRenameLegacy(schema210, "Rename jump strength attribute", createRenamer("minecraft:horse.jump_strength", "minecraft:generic.jump_strength")) ); Schema schema211 = builder.addSchema(3816, V3816::new); builder.addFixer(new AddNewChoices(schema211, "Added Bogged", References.ENTITY)); @@ -1308,6 +1323,29 @@ public class DataFixers { Schema schema226 = builder.addSchema(3945, SAME_NAMESPACED); builder.addFixer(new AttributeModifierIdFix(schema226)); builder.addFixer(new JukeboxTicksSinceSongStartedFix(schema226)); + Schema schema227 = builder.addSchema(4054, SAME_NAMESPACED); + builder.addFixer(new OminousBannerRarityFix(schema227)); + Schema schema228 = builder.addSchema(4055, SAME_NAMESPACED); + builder.addFixer(new AttributeIdPrefixFix(schema228)); + Schema schema229 = builder.addSchema(4057, SAME_NAMESPACED); + builder.addFixer(new CarvingStepRemoveFix(schema229)); + Schema schema230 = builder.addSchema(4059, V4059::new); + builder.addFixer(new FoodToConsumableFix(schema230)); + Schema schema231 = builder.addSchema(4061, SAME_NAMESPACED); + builder.addFixer(new TrialSpawnerConfigInRegistryFix(schema231)); + Schema schema232 = builder.addSchema(4064, SAME_NAMESPACED); + builder.addFixer(new FireResistantToDamageResistantComponentFix(schema232)); + Schema schema233 = builder.addSchema(4067, V4067::new); + builder.addFixer(new BoatSplitFix(schema233)); + builder.addFixer(new FeatureFlagRemoveFix(schema233, "Remove Bundle experimental feature flag", Set.of("minecraft:bundle"))); + Schema schema234 = builder.addSchema(4068, SAME_NAMESPACED); + builder.addFixer(new LockComponentPredicateFix(schema234)); + builder.addFixer(new ContainerBlockEntityLockPredicateFix(schema234)); + Schema schema235 = builder.addSchema(4070, V4070::new); + builder.addFixer(new AddNewChoices(schema235, "Added Pale Oak Boat and Pale Oak Chest Boat", References.ENTITY)); + Schema schema236 = builder.addSchema(4071, V4071::new); + builder.addFixer(new AddNewChoices(schema236, "Added Creaking", References.ENTITY)); + builder.addFixer(new AddNewChoices(schema236, "Added Creaking Heart", References.BLOCK_ENTITY)); } private static UnaryOperator createRenamerNoNamespace(Map renameMap) { diff --git a/net/minecraft/util/datafix/ExtraDataFixUtils.java b/net/minecraft/util/datafix/ExtraDataFixUtils.java index 9832ca79..5bd83730 100644 --- a/net/minecraft/util/datafix/ExtraDataFixUtils.java +++ b/net/minecraft/util/datafix/ExtraDataFixUtils.java @@ -1,11 +1,23 @@ package net.minecraft.util.datafix; +import com.mojang.datafixers.DataFixUtils; +import com.mojang.datafixers.RewriteResult; +import com.mojang.datafixers.TypeRewriteRule; import com.mojang.datafixers.Typed; +import com.mojang.datafixers.View; +import com.mojang.datafixers.functions.PointFreeRule; import com.mojang.datafixers.types.Type; import com.mojang.serialization.Dynamic; +import java.util.BitSet; +import java.util.Map; import java.util.Optional; import java.util.function.Function; +import java.util.function.UnaryOperator; +import java.util.stream.Collectors; import java.util.stream.IntStream; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.NbtOps; +import net.minecraft.nbt.Tag; public class ExtraDataFixUtils { public static Dynamic fixBlockPos(Dynamic data) { @@ -23,6 +35,17 @@ public class ExtraDataFixUtils { return new Typed<>(type, data.getOps(), (R)data.getValue()); } + public static Type patchSubType(Type type, Type type2, Type type3) { + return type.all(typePatcher(type2, type3), true, false).view().newType(); + } + + private static TypeRewriteRule typePatcher(Type type, Type type2) { + RewriteResult rewriteResult = RewriteResult.create(View.create("Patcher", type, type2, dynamicOps -> object -> { + throw new UnsupportedOperationException(); + }), new BitSet()); + return TypeRewriteRule.everywhere(TypeRewriteRule.ifSame(type, rewriteResult), PointFreeRule.nop(), true, true); + } + @SafeVarargs public static Function, Typed> chainAllFilters(Function, Typed>... filters) { return typed -> { @@ -33,4 +56,29 @@ public class ExtraDataFixUtils { return typed; }; } + + public static Dynamic blockState(String string, Map map) { + Dynamic dynamic = new Dynamic<>(NbtOps.INSTANCE, new CompoundTag()); + Dynamic dynamic2 = dynamic.set("Name", dynamic.createString(string)); + if (!map.isEmpty()) { + dynamic2 = dynamic2.set( + "Properties", + dynamic.createMap( + (Map, ? extends Dynamic>)map.entrySet() + .stream() + .collect(Collectors.toMap(entry -> dynamic.createString((String)entry.getKey()), entry -> dynamic.createString((String)entry.getValue()))) + ) + ); + } + + return dynamic2; + } + + public static Dynamic blockState(String string) { + return blockState(string, Map.of()); + } + + public static Dynamic fixStringField(Dynamic dynamic, String string, UnaryOperator unaryOperator) { + return dynamic.update(string, dynamic2 -> DataFixUtils.orElse(dynamic2.asString().map(unaryOperator).map(dynamic::createString).result(), dynamic2)); + } } diff --git a/net/minecraft/util/datafix/fixes/AttributeIdPrefixFix.java b/net/minecraft/util/datafix/fixes/AttributeIdPrefixFix.java new file mode 100644 index 00000000..841ca82b --- /dev/null +++ b/net/minecraft/util/datafix/fixes/AttributeIdPrefixFix.java @@ -0,0 +1,26 @@ +package net.minecraft.util.datafix.fixes; + +import com.mojang.datafixers.schemas.Schema; +import java.util.List; +import net.minecraft.util.datafix.schemas.NamespacedSchema; + +public class AttributeIdPrefixFix extends AttributesRenameFix { + private static final List PREFIXES = List.of("generic.", "horse.", "player.", "zombie."); + + public AttributeIdPrefixFix(Schema schema) { + super(schema, "AttributeIdPrefixFix", AttributeIdPrefixFix::replaceId); + } + + private static String replaceId(String string) { + String string2 = NamespacedSchema.ensureNamespaced(string); + + for (String string3 : PREFIXES) { + String string4 = NamespacedSchema.ensureNamespaced(string3); + if (string2.startsWith(string4)) { + return "minecraft:" + string2.substring(string4.length()); + } + } + + return string; + } +} diff --git a/net/minecraft/util/datafix/fixes/AttributesRenameFix.java b/net/minecraft/util/datafix/fixes/AttributesRenameFix.java new file mode 100644 index 00000000..b0cd7e46 --- /dev/null +++ b/net/minecraft/util/datafix/fixes/AttributesRenameFix.java @@ -0,0 +1,62 @@ +package net.minecraft.util.datafix.fixes; + +import com.mojang.datafixers.DSL; +import com.mojang.datafixers.DataFix; +import com.mojang.datafixers.DataFixUtils; +import com.mojang.datafixers.TypeRewriteRule; +import com.mojang.datafixers.Typed; +import com.mojang.datafixers.schemas.Schema; +import com.mojang.serialization.Dynamic; +import java.util.function.UnaryOperator; +import net.minecraft.util.datafix.ExtraDataFixUtils; + +public class AttributesRenameFix extends DataFix { + private final String name; + private final UnaryOperator renames; + + public AttributesRenameFix(Schema schema, String string, UnaryOperator unaryOperator) { + super(schema, false); + this.name = string; + this.renames = unaryOperator; + } + + @Override + protected TypeRewriteRule makeRule() { + return TypeRewriteRule.seq( + this.fixTypeEverywhereTyped(this.name + " (Components)", this.getInputSchema().getType(References.DATA_COMPONENTS), this::fixDataComponents), + this.fixTypeEverywhereTyped(this.name + " (Entity)", this.getInputSchema().getType(References.ENTITY), this::fixEntity), + this.fixTypeEverywhereTyped(this.name + " (Player)", this.getInputSchema().getType(References.PLAYER), this::fixEntity) + ); + } + + private Typed fixDataComponents(Typed typed) { + return typed.update( + DSL.remainderFinder(), + dynamic -> dynamic.update( + "minecraft:attribute_modifiers", + dynamicx -> dynamicx.update( + "modifiers", + dynamicxx -> DataFixUtils.orElse(dynamicxx.asStreamOpt().result().map(stream -> stream.map(this::fixTypeField)).map(dynamicxx::createList), dynamicxx) + ) + ) + ); + } + + private Typed fixEntity(Typed typed) { + return typed.update( + DSL.remainderFinder(), + dynamic -> dynamic.update( + "attributes", + dynamicx -> DataFixUtils.orElse(dynamicx.asStreamOpt().result().map(stream -> stream.map(this::fixIdField)).map(dynamicx::createList), dynamicx) + ) + ); + } + + private Dynamic fixIdField(Dynamic dynamic) { + return ExtraDataFixUtils.fixStringField(dynamic, "id", this.renames); + } + + private Dynamic fixTypeField(Dynamic dynamic) { + return ExtraDataFixUtils.fixStringField(dynamic, "type", this.renames); + } +} diff --git a/net/minecraft/util/datafix/fixes/AttributesRename.java b/net/minecraft/util/datafix/fixes/AttributesRenameLegacy.java similarity index 76% rename from net/minecraft/util/datafix/fixes/AttributesRename.java rename to net/minecraft/util/datafix/fixes/AttributesRenameLegacy.java index 5752e7b8..5cc6abbe 100644 --- a/net/minecraft/util/datafix/fixes/AttributesRename.java +++ b/net/minecraft/util/datafix/fixes/AttributesRenameLegacy.java @@ -11,14 +11,14 @@ import com.mojang.datafixers.types.Type; import com.mojang.serialization.Dynamic; import java.util.function.UnaryOperator; -public class AttributesRename extends DataFix { +public class AttributesRenameLegacy extends DataFix { private final String name; private final UnaryOperator renames; - public AttributesRename(Schema outputSchema, String name, UnaryOperator renames) { - super(outputSchema, false); - this.name = name; - this.renames = renames; + public AttributesRenameLegacy(Schema schema, String string, UnaryOperator unaryOperator) { + super(schema, false); + this.name = string; + this.renames = unaryOperator; } @Override @@ -32,12 +32,12 @@ public class AttributesRename extends DataFix { ); } - private Dynamic fixName(Dynamic data) { - return DataFixUtils.orElse(data.asString().result().map(this.renames).map(data::createString), data); + private Dynamic fixName(Dynamic dynamic) { + return DataFixUtils.orElse(dynamic.asString().result().map(this.renames).map(dynamic::createString), dynamic); } - private Typed fixItemStackTag(Typed data) { - return data.update( + private Typed fixItemStackTag(Typed typed) { + return typed.update( DSL.remainderFinder(), dynamic -> dynamic.update( "AttributeModifiers", @@ -49,8 +49,8 @@ public class AttributesRename extends DataFix { ); } - private Typed fixEntity(Typed data) { - return data.update( + private Typed fixEntity(Typed typed) { + return typed.update( DSL.remainderFinder(), dynamic -> dynamic.update( "Attributes", diff --git a/net/minecraft/util/datafix/fixes/BoatSplitFix.java b/net/minecraft/util/datafix/fixes/BoatSplitFix.java new file mode 100644 index 00000000..5db22510 --- /dev/null +++ b/net/minecraft/util/datafix/fixes/BoatSplitFix.java @@ -0,0 +1,82 @@ +package net.minecraft.util.datafix.fixes; + +import com.mojang.datafixers.DSL; +import com.mojang.datafixers.DataFix; +import com.mojang.datafixers.OpticFinder; +import com.mojang.datafixers.TypeRewriteRule; +import com.mojang.datafixers.schemas.Schema; +import com.mojang.datafixers.types.Type; +import com.mojang.serialization.Dynamic; +import java.util.Optional; +import net.minecraft.util.datafix.ExtraDataFixUtils; +import net.minecraft.util.datafix.schemas.NamespacedSchema; + +public class BoatSplitFix extends DataFix { + public BoatSplitFix(Schema schema) { + super(schema, true); + } + + private static boolean isNormalBoat(String string) { + return string.equals("minecraft:boat"); + } + + private static boolean isChestBoat(String string) { + return string.equals("minecraft:chest_boat"); + } + + private static boolean isAnyBoat(String string) { + return isNormalBoat(string) || isChestBoat(string); + } + + private static String mapVariantToNormalBoat(String string) { + return switch (string) { + case "spruce" -> "minecraft:spruce_boat"; + case "birch" -> "minecraft:birch_boat"; + case "jungle" -> "minecraft:jungle_boat"; + case "acacia" -> "minecraft:acacia_boat"; + case "cherry" -> "minecraft:cherry_boat"; + case "dark_oak" -> "minecraft:dark_oak_boat"; + case "mangrove" -> "minecraft:mangrove_boat"; + case "bamboo" -> "minecraft:bamboo_raft"; + default -> "minecraft:oak_boat"; + }; + } + + private static String mapVariantToChestBoat(String string) { + return switch (string) { + case "spruce" -> "minecraft:spruce_chest_boat"; + case "birch" -> "minecraft:birch_chest_boat"; + case "jungle" -> "minecraft:jungle_chest_boat"; + case "acacia" -> "minecraft:acacia_chest_boat"; + case "cherry" -> "minecraft:cherry_chest_boat"; + case "dark_oak" -> "minecraft:dark_oak_chest_boat"; + case "mangrove" -> "minecraft:mangrove_chest_boat"; + case "bamboo" -> "minecraft:bamboo_chest_raft"; + default -> "minecraft:oak_chest_boat"; + }; + } + + @Override + public TypeRewriteRule makeRule() { + OpticFinder opticFinder = DSL.fieldFinder("id", NamespacedSchema.namespacedString()); + Type type = this.getInputSchema().getType(References.ENTITY); + Type type2 = this.getOutputSchema().getType(References.ENTITY); + return this.fixTypeEverywhereTyped("BoatSplitFix", type, type2, typed -> { + Optional optional = typed.getOptional(opticFinder); + if (optional.isPresent() && isAnyBoat((String)optional.get())) { + Dynamic dynamic = typed.getOrCreate(DSL.remainderFinder()); + Optional optional2 = dynamic.get("Type").asString().result(); + String string; + if (isChestBoat((String)optional.get())) { + string = (String)optional2.map(BoatSplitFix::mapVariantToChestBoat).orElse("minecraft:oak_chest_boat"); + } else { + string = (String)optional2.map(BoatSplitFix::mapVariantToNormalBoat).orElse("minecraft:oak_boat"); + } + + return ExtraDataFixUtils.cast(type2, typed).update(DSL.remainderFinder(), dynamicx -> dynamicx.remove("Type")).set(opticFinder, string); + } else { + return ExtraDataFixUtils.cast(type2, typed); + } + }); + } +} diff --git a/net/minecraft/util/datafix/fixes/CarvingStepRemoveFix.java b/net/minecraft/util/datafix/fixes/CarvingStepRemoveFix.java new file mode 100644 index 00000000..9ef715ef --- /dev/null +++ b/net/minecraft/util/datafix/fixes/CarvingStepRemoveFix.java @@ -0,0 +1,35 @@ +package net.minecraft.util.datafix.fixes; + +import com.mojang.datafixers.DSL; +import com.mojang.datafixers.DataFix; +import com.mojang.datafixers.TypeRewriteRule; +import com.mojang.datafixers.Typed; +import com.mojang.datafixers.schemas.Schema; +import com.mojang.serialization.Dynamic; +import java.util.Optional; + +public class CarvingStepRemoveFix extends DataFix { + public CarvingStepRemoveFix(Schema schema) { + super(schema, false); + } + + @Override + protected TypeRewriteRule makeRule() { + return this.fixTypeEverywhereTyped("CarvingStepRemoveFix", this.getInputSchema().getType(References.CHUNK), CarvingStepRemoveFix::fixChunk); + } + + private static Typed fixChunk(Typed typed) { + return typed.update(DSL.remainderFinder(), dynamic -> { + Dynamic dynamic2 = dynamic; + Optional> optional = dynamic.get("CarvingMasks").result(); + if (optional.isPresent()) { + Optional> optional2 = ((Dynamic)optional.get()).get("AIR").result(); + if (optional2.isPresent()) { + dynamic2 = dynamic.set("carving_mask", (Dynamic)optional2.get()); + } + } + + return dynamic2.remove("CarvingMasks"); + }); + } +} diff --git a/net/minecraft/util/datafix/fixes/ChunkPalettedStorageFix.java b/net/minecraft/util/datafix/fixes/ChunkPalettedStorageFix.java index b53923f7..b5663f2b 100644 --- a/net/minecraft/util/datafix/fixes/ChunkPalettedStorageFix.java +++ b/net/minecraft/util/datafix/fixes/ChunkPalettedStorageFix.java @@ -25,7 +25,10 @@ import java.util.Objects; import java.util.Optional; import java.util.Set; import net.minecraft.util.CrudeIncrementalIntIdentityHashBiMap; +import net.minecraft.util.datafix.ExtraDataFixUtils; import net.minecraft.util.datafix.PackedBitStorage; +import net.minecraft.util.datafix.fixes.ChunkPalettedStorageFix.Direction.Axis; +import net.minecraft.util.datafix.fixes.ChunkPalettedStorageFix.Direction.AxisDirection; import org.jetbrains.annotations.Nullable; import org.slf4j.Logger; @@ -39,364 +42,12 @@ public class ChunkPalettedStorageFix extends DataFix { private static final int NORTH_EAST_MASK = 2; private static final int NORTH_MASK = 1; static final Logger LOGGER = LogUtils.getLogger(); - static final BitSet VIRTUAL = new BitSet(256); - static final BitSet FIX = new BitSet(256); - static final Dynamic PUMPKIN = BlockStateData.parse("{Name:'minecraft:pumpkin'}"); - static final Dynamic SNOWY_PODZOL = BlockStateData.parse("{Name:'minecraft:podzol',Properties:{snowy:'true'}}"); - static final Dynamic SNOWY_GRASS = BlockStateData.parse("{Name:'minecraft:grass_block',Properties:{snowy:'true'}}"); - static final Dynamic SNOWY_MYCELIUM = BlockStateData.parse("{Name:'minecraft:mycelium',Properties:{snowy:'true'}}"); - static final Dynamic UPPER_SUNFLOWER = BlockStateData.parse("{Name:'minecraft:sunflower',Properties:{half:'upper'}}"); - static final Dynamic UPPER_LILAC = BlockStateData.parse("{Name:'minecraft:lilac',Properties:{half:'upper'}}"); - static final Dynamic UPPER_TALL_GRASS = BlockStateData.parse("{Name:'minecraft:tall_grass',Properties:{half:'upper'}}"); - static final Dynamic UPPER_LARGE_FERN = BlockStateData.parse("{Name:'minecraft:large_fern',Properties:{half:'upper'}}"); - static final Dynamic UPPER_ROSE_BUSH = BlockStateData.parse("{Name:'minecraft:rose_bush',Properties:{half:'upper'}}"); - static final Dynamic UPPER_PEONY = BlockStateData.parse("{Name:'minecraft:peony',Properties:{half:'upper'}}"); - static final Map> FLOWER_POT_MAP = DataFixUtils.make(Maps.>newHashMap(), hashMap -> { - hashMap.put("minecraft:air0", BlockStateData.parse("{Name:'minecraft:flower_pot'}")); - hashMap.put("minecraft:red_flower0", BlockStateData.parse("{Name:'minecraft:potted_poppy'}")); - hashMap.put("minecraft:red_flower1", BlockStateData.parse("{Name:'minecraft:potted_blue_orchid'}")); - hashMap.put("minecraft:red_flower2", BlockStateData.parse("{Name:'minecraft:potted_allium'}")); - hashMap.put("minecraft:red_flower3", BlockStateData.parse("{Name:'minecraft:potted_azure_bluet'}")); - hashMap.put("minecraft:red_flower4", BlockStateData.parse("{Name:'minecraft:potted_red_tulip'}")); - hashMap.put("minecraft:red_flower5", BlockStateData.parse("{Name:'minecraft:potted_orange_tulip'}")); - hashMap.put("minecraft:red_flower6", BlockStateData.parse("{Name:'minecraft:potted_white_tulip'}")); - hashMap.put("minecraft:red_flower7", BlockStateData.parse("{Name:'minecraft:potted_pink_tulip'}")); - hashMap.put("minecraft:red_flower8", BlockStateData.parse("{Name:'minecraft:potted_oxeye_daisy'}")); - hashMap.put("minecraft:yellow_flower0", BlockStateData.parse("{Name:'minecraft:potted_dandelion'}")); - hashMap.put("minecraft:sapling0", BlockStateData.parse("{Name:'minecraft:potted_oak_sapling'}")); - hashMap.put("minecraft:sapling1", BlockStateData.parse("{Name:'minecraft:potted_spruce_sapling'}")); - hashMap.put("minecraft:sapling2", BlockStateData.parse("{Name:'minecraft:potted_birch_sapling'}")); - hashMap.put("minecraft:sapling3", BlockStateData.parse("{Name:'minecraft:potted_jungle_sapling'}")); - hashMap.put("minecraft:sapling4", BlockStateData.parse("{Name:'minecraft:potted_acacia_sapling'}")); - hashMap.put("minecraft:sapling5", BlockStateData.parse("{Name:'minecraft:potted_dark_oak_sapling'}")); - hashMap.put("minecraft:red_mushroom0", BlockStateData.parse("{Name:'minecraft:potted_red_mushroom'}")); - hashMap.put("minecraft:brown_mushroom0", BlockStateData.parse("{Name:'minecraft:potted_brown_mushroom'}")); - hashMap.put("minecraft:deadbush0", BlockStateData.parse("{Name:'minecraft:potted_dead_bush'}")); - hashMap.put("minecraft:tallgrass2", BlockStateData.parse("{Name:'minecraft:potted_fern'}")); - hashMap.put("minecraft:cactus0", BlockStateData.getTag(2240)); - }); - static final Map> SKULL_MAP = DataFixUtils.make(Maps.>newHashMap(), hashMap -> { - mapSkull(hashMap, 0, "skeleton", "skull"); - mapSkull(hashMap, 1, "wither_skeleton", "skull"); - mapSkull(hashMap, 2, "zombie", "head"); - mapSkull(hashMap, 3, "player", "head"); - mapSkull(hashMap, 4, "creeper", "head"); - mapSkull(hashMap, 5, "dragon", "head"); - }); - static final Map> DOOR_MAP = DataFixUtils.make(Maps.>newHashMap(), hashMap -> { - mapDoor(hashMap, "oak_door", 1024); - mapDoor(hashMap, "iron_door", 1136); - mapDoor(hashMap, "spruce_door", 3088); - mapDoor(hashMap, "birch_door", 3104); - mapDoor(hashMap, "jungle_door", 3120); - mapDoor(hashMap, "acacia_door", 3136); - mapDoor(hashMap, "dark_oak_door", 3152); - }); - static final Map> NOTE_BLOCK_MAP = DataFixUtils.make(Maps.>newHashMap(), hashMap -> { - for (int i = 0; i < 26; i++) { - hashMap.put("true" + i, BlockStateData.parse("{Name:'minecraft:note_block',Properties:{powered:'true',note:'" + i + "'}}")); - hashMap.put("false" + i, BlockStateData.parse("{Name:'minecraft:note_block',Properties:{powered:'false',note:'" + i + "'}}")); - } - }); - private static final Int2ObjectMap DYE_COLOR_MAP = DataFixUtils.make(new Int2ObjectOpenHashMap<>(), int2ObjectOpenHashMap -> { - int2ObjectOpenHashMap.put(0, "white"); - int2ObjectOpenHashMap.put(1, "orange"); - int2ObjectOpenHashMap.put(2, "magenta"); - int2ObjectOpenHashMap.put(3, "light_blue"); - int2ObjectOpenHashMap.put(4, "yellow"); - int2ObjectOpenHashMap.put(5, "lime"); - int2ObjectOpenHashMap.put(6, "pink"); - int2ObjectOpenHashMap.put(7, "gray"); - int2ObjectOpenHashMap.put(8, "light_gray"); - int2ObjectOpenHashMap.put(9, "cyan"); - int2ObjectOpenHashMap.put(10, "purple"); - int2ObjectOpenHashMap.put(11, "blue"); - int2ObjectOpenHashMap.put(12, "brown"); - int2ObjectOpenHashMap.put(13, "green"); - int2ObjectOpenHashMap.put(14, "red"); - int2ObjectOpenHashMap.put(15, "black"); - }); - static final Map> BED_BLOCK_MAP = DataFixUtils.make(Maps.>newHashMap(), hashMap -> { - for (Entry entry : DYE_COLOR_MAP.int2ObjectEntrySet()) { - if (!Objects.equals(entry.getValue(), "red")) { - addBeds(hashMap, entry.getIntKey(), (String)entry.getValue()); - } - } - }); - static final Map> BANNER_BLOCK_MAP = DataFixUtils.make(Maps.>newHashMap(), hashMap -> { - for (Entry entry : DYE_COLOR_MAP.int2ObjectEntrySet()) { - if (!Objects.equals(entry.getValue(), "white")) { - addBanners(hashMap, 15 - entry.getIntKey(), (String)entry.getValue()); - } - } - }); - static final Dynamic AIR = BlockStateData.getTag(0); private static final int SIZE = 4096; public ChunkPalettedStorageFix(Schema outputSchema, boolean changesType) { super(outputSchema, changesType); } - private static void mapSkull(Map> map, int id, String skullType, String suffix) { - map.put(id + "north", BlockStateData.parse("{Name:'minecraft:" + skullType + "_wall_" + suffix + "',Properties:{facing:'north'}}")); - map.put(id + "east", BlockStateData.parse("{Name:'minecraft:" + skullType + "_wall_" + suffix + "',Properties:{facing:'east'}}")); - map.put(id + "south", BlockStateData.parse("{Name:'minecraft:" + skullType + "_wall_" + suffix + "',Properties:{facing:'south'}}")); - map.put(id + "west", BlockStateData.parse("{Name:'minecraft:" + skullType + "_wall_" + suffix + "',Properties:{facing:'west'}}")); - - for (int i = 0; i < 16; i++) { - map.put("" + id + i, BlockStateData.parse("{Name:'minecraft:" + skullType + "_" + suffix + "',Properties:{rotation:'" + i + "'}}")); - } - } - - private static void mapDoor(Map> map, String doorId, int id) { - map.put( - "minecraft:" + doorId + "eastlowerleftfalsefalse", - BlockStateData.parse("{Name:'minecraft:" + doorId + "',Properties:{facing:'east',half:'lower',hinge:'left',open:'false',powered:'false'}}") - ); - map.put( - "minecraft:" + doorId + "eastlowerleftfalsetrue", - BlockStateData.parse("{Name:'minecraft:" + doorId + "',Properties:{facing:'east',half:'lower',hinge:'left',open:'false',powered:'true'}}") - ); - map.put( - "minecraft:" + doorId + "eastlowerlefttruefalse", - BlockStateData.parse("{Name:'minecraft:" + doorId + "',Properties:{facing:'east',half:'lower',hinge:'left',open:'true',powered:'false'}}") - ); - map.put( - "minecraft:" + doorId + "eastlowerlefttruetrue", - BlockStateData.parse("{Name:'minecraft:" + doorId + "',Properties:{facing:'east',half:'lower',hinge:'left',open:'true',powered:'true'}}") - ); - map.put("minecraft:" + doorId + "eastlowerrightfalsefalse", BlockStateData.getTag(id)); - map.put( - "minecraft:" + doorId + "eastlowerrightfalsetrue", - BlockStateData.parse("{Name:'minecraft:" + doorId + "',Properties:{facing:'east',half:'lower',hinge:'right',open:'false',powered:'true'}}") - ); - map.put("minecraft:" + doorId + "eastlowerrighttruefalse", BlockStateData.getTag(id + 4)); - map.put( - "minecraft:" + doorId + "eastlowerrighttruetrue", - BlockStateData.parse("{Name:'minecraft:" + doorId + "',Properties:{facing:'east',half:'lower',hinge:'right',open:'true',powered:'true'}}") - ); - map.put("minecraft:" + doorId + "eastupperleftfalsefalse", BlockStateData.getTag(id + 8)); - map.put("minecraft:" + doorId + "eastupperleftfalsetrue", BlockStateData.getTag(id + 10)); - map.put( - "minecraft:" + doorId + "eastupperlefttruefalse", - BlockStateData.parse("{Name:'minecraft:" + doorId + "',Properties:{facing:'east',half:'upper',hinge:'left',open:'true',powered:'false'}}") - ); - map.put( - "minecraft:" + doorId + "eastupperlefttruetrue", - BlockStateData.parse("{Name:'minecraft:" + doorId + "',Properties:{facing:'east',half:'upper',hinge:'left',open:'true',powered:'true'}}") - ); - map.put("minecraft:" + doorId + "eastupperrightfalsefalse", BlockStateData.getTag(id + 9)); - map.put("minecraft:" + doorId + "eastupperrightfalsetrue", BlockStateData.getTag(id + 11)); - map.put( - "minecraft:" + doorId + "eastupperrighttruefalse", - BlockStateData.parse("{Name:'minecraft:" + doorId + "',Properties:{facing:'east',half:'upper',hinge:'right',open:'true',powered:'false'}}") - ); - map.put( - "minecraft:" + doorId + "eastupperrighttruetrue", - BlockStateData.parse("{Name:'minecraft:" + doorId + "',Properties:{facing:'east',half:'upper',hinge:'right',open:'true',powered:'true'}}") - ); - map.put( - "minecraft:" + doorId + "northlowerleftfalsefalse", - BlockStateData.parse("{Name:'minecraft:" + doorId + "',Properties:{facing:'north',half:'lower',hinge:'left',open:'false',powered:'false'}}") - ); - map.put( - "minecraft:" + doorId + "northlowerleftfalsetrue", - BlockStateData.parse("{Name:'minecraft:" + doorId + "',Properties:{facing:'north',half:'lower',hinge:'left',open:'false',powered:'true'}}") - ); - map.put( - "minecraft:" + doorId + "northlowerlefttruefalse", - BlockStateData.parse("{Name:'minecraft:" + doorId + "',Properties:{facing:'north',half:'lower',hinge:'left',open:'true',powered:'false'}}") - ); - map.put( - "minecraft:" + doorId + "northlowerlefttruetrue", - BlockStateData.parse("{Name:'minecraft:" + doorId + "',Properties:{facing:'north',half:'lower',hinge:'left',open:'true',powered:'true'}}") - ); - map.put("minecraft:" + doorId + "northlowerrightfalsefalse", BlockStateData.getTag(id + 3)); - map.put( - "minecraft:" + doorId + "northlowerrightfalsetrue", - BlockStateData.parse("{Name:'minecraft:" + doorId + "',Properties:{facing:'north',half:'lower',hinge:'right',open:'false',powered:'true'}}") - ); - map.put("minecraft:" + doorId + "northlowerrighttruefalse", BlockStateData.getTag(id + 7)); - map.put( - "minecraft:" + doorId + "northlowerrighttruetrue", - BlockStateData.parse("{Name:'minecraft:" + doorId + "',Properties:{facing:'north',half:'lower',hinge:'right',open:'true',powered:'true'}}") - ); - map.put( - "minecraft:" + doorId + "northupperleftfalsefalse", - BlockStateData.parse("{Name:'minecraft:" + doorId + "',Properties:{facing:'north',half:'upper',hinge:'left',open:'false',powered:'false'}}") - ); - map.put( - "minecraft:" + doorId + "northupperleftfalsetrue", - BlockStateData.parse("{Name:'minecraft:" + doorId + "',Properties:{facing:'north',half:'upper',hinge:'left',open:'false',powered:'true'}}") - ); - map.put( - "minecraft:" + doorId + "northupperlefttruefalse", - BlockStateData.parse("{Name:'minecraft:" + doorId + "',Properties:{facing:'north',half:'upper',hinge:'left',open:'true',powered:'false'}}") - ); - map.put( - "minecraft:" + doorId + "northupperlefttruetrue", - BlockStateData.parse("{Name:'minecraft:" + doorId + "',Properties:{facing:'north',half:'upper',hinge:'left',open:'true',powered:'true'}}") - ); - map.put( - "minecraft:" + doorId + "northupperrightfalsefalse", - BlockStateData.parse("{Name:'minecraft:" + doorId + "',Properties:{facing:'north',half:'upper',hinge:'right',open:'false',powered:'false'}}") - ); - map.put( - "minecraft:" + doorId + "northupperrightfalsetrue", - BlockStateData.parse("{Name:'minecraft:" + doorId + "',Properties:{facing:'north',half:'upper',hinge:'right',open:'false',powered:'true'}}") - ); - map.put( - "minecraft:" + doorId + "northupperrighttruefalse", - BlockStateData.parse("{Name:'minecraft:" + doorId + "',Properties:{facing:'north',half:'upper',hinge:'right',open:'true',powered:'false'}}") - ); - map.put( - "minecraft:" + doorId + "northupperrighttruetrue", - BlockStateData.parse("{Name:'minecraft:" + doorId + "',Properties:{facing:'north',half:'upper',hinge:'right',open:'true',powered:'true'}}") - ); - map.put( - "minecraft:" + doorId + "southlowerleftfalsefalse", - BlockStateData.parse("{Name:'minecraft:" + doorId + "',Properties:{facing:'south',half:'lower',hinge:'left',open:'false',powered:'false'}}") - ); - map.put( - "minecraft:" + doorId + "southlowerleftfalsetrue", - BlockStateData.parse("{Name:'minecraft:" + doorId + "',Properties:{facing:'south',half:'lower',hinge:'left',open:'false',powered:'true'}}") - ); - map.put( - "minecraft:" + doorId + "southlowerlefttruefalse", - BlockStateData.parse("{Name:'minecraft:" + doorId + "',Properties:{facing:'south',half:'lower',hinge:'left',open:'true',powered:'false'}}") - ); - map.put( - "minecraft:" + doorId + "southlowerlefttruetrue", - BlockStateData.parse("{Name:'minecraft:" + doorId + "',Properties:{facing:'south',half:'lower',hinge:'left',open:'true',powered:'true'}}") - ); - map.put("minecraft:" + doorId + "southlowerrightfalsefalse", BlockStateData.getTag(id + 1)); - map.put( - "minecraft:" + doorId + "southlowerrightfalsetrue", - BlockStateData.parse("{Name:'minecraft:" + doorId + "',Properties:{facing:'south',half:'lower',hinge:'right',open:'false',powered:'true'}}") - ); - map.put("minecraft:" + doorId + "southlowerrighttruefalse", BlockStateData.getTag(id + 5)); - map.put( - "minecraft:" + doorId + "southlowerrighttruetrue", - BlockStateData.parse("{Name:'minecraft:" + doorId + "',Properties:{facing:'south',half:'lower',hinge:'right',open:'true',powered:'true'}}") - ); - map.put( - "minecraft:" + doorId + "southupperleftfalsefalse", - BlockStateData.parse("{Name:'minecraft:" + doorId + "',Properties:{facing:'south',half:'upper',hinge:'left',open:'false',powered:'false'}}") - ); - map.put( - "minecraft:" + doorId + "southupperleftfalsetrue", - BlockStateData.parse("{Name:'minecraft:" + doorId + "',Properties:{facing:'south',half:'upper',hinge:'left',open:'false',powered:'true'}}") - ); - map.put( - "minecraft:" + doorId + "southupperlefttruefalse", - BlockStateData.parse("{Name:'minecraft:" + doorId + "',Properties:{facing:'south',half:'upper',hinge:'left',open:'true',powered:'false'}}") - ); - map.put( - "minecraft:" + doorId + "southupperlefttruetrue", - BlockStateData.parse("{Name:'minecraft:" + doorId + "',Properties:{facing:'south',half:'upper',hinge:'left',open:'true',powered:'true'}}") - ); - map.put( - "minecraft:" + doorId + "southupperrightfalsefalse", - BlockStateData.parse("{Name:'minecraft:" + doorId + "',Properties:{facing:'south',half:'upper',hinge:'right',open:'false',powered:'false'}}") - ); - map.put( - "minecraft:" + doorId + "southupperrightfalsetrue", - BlockStateData.parse("{Name:'minecraft:" + doorId + "',Properties:{facing:'south',half:'upper',hinge:'right',open:'false',powered:'true'}}") - ); - map.put( - "minecraft:" + doorId + "southupperrighttruefalse", - BlockStateData.parse("{Name:'minecraft:" + doorId + "',Properties:{facing:'south',half:'upper',hinge:'right',open:'true',powered:'false'}}") - ); - map.put( - "minecraft:" + doorId + "southupperrighttruetrue", - BlockStateData.parse("{Name:'minecraft:" + doorId + "',Properties:{facing:'south',half:'upper',hinge:'right',open:'true',powered:'true'}}") - ); - map.put( - "minecraft:" + doorId + "westlowerleftfalsefalse", - BlockStateData.parse("{Name:'minecraft:" + doorId + "',Properties:{facing:'west',half:'lower',hinge:'left',open:'false',powered:'false'}}") - ); - map.put( - "minecraft:" + doorId + "westlowerleftfalsetrue", - BlockStateData.parse("{Name:'minecraft:" + doorId + "',Properties:{facing:'west',half:'lower',hinge:'left',open:'false',powered:'true'}}") - ); - map.put( - "minecraft:" + doorId + "westlowerlefttruefalse", - BlockStateData.parse("{Name:'minecraft:" + doorId + "',Properties:{facing:'west',half:'lower',hinge:'left',open:'true',powered:'false'}}") - ); - map.put( - "minecraft:" + doorId + "westlowerlefttruetrue", - BlockStateData.parse("{Name:'minecraft:" + doorId + "',Properties:{facing:'west',half:'lower',hinge:'left',open:'true',powered:'true'}}") - ); - map.put("minecraft:" + doorId + "westlowerrightfalsefalse", BlockStateData.getTag(id + 2)); - map.put( - "minecraft:" + doorId + "westlowerrightfalsetrue", - BlockStateData.parse("{Name:'minecraft:" + doorId + "',Properties:{facing:'west',half:'lower',hinge:'right',open:'false',powered:'true'}}") - ); - map.put("minecraft:" + doorId + "westlowerrighttruefalse", BlockStateData.getTag(id + 6)); - map.put( - "minecraft:" + doorId + "westlowerrighttruetrue", - BlockStateData.parse("{Name:'minecraft:" + doorId + "',Properties:{facing:'west',half:'lower',hinge:'right',open:'true',powered:'true'}}") - ); - map.put( - "minecraft:" + doorId + "westupperleftfalsefalse", - BlockStateData.parse("{Name:'minecraft:" + doorId + "',Properties:{facing:'west',half:'upper',hinge:'left',open:'false',powered:'false'}}") - ); - map.put( - "minecraft:" + doorId + "westupperleftfalsetrue", - BlockStateData.parse("{Name:'minecraft:" + doorId + "',Properties:{facing:'west',half:'upper',hinge:'left',open:'false',powered:'true'}}") - ); - map.put( - "minecraft:" + doorId + "westupperlefttruefalse", - BlockStateData.parse("{Name:'minecraft:" + doorId + "',Properties:{facing:'west',half:'upper',hinge:'left',open:'true',powered:'false'}}") - ); - map.put( - "minecraft:" + doorId + "westupperlefttruetrue", - BlockStateData.parse("{Name:'minecraft:" + doorId + "',Properties:{facing:'west',half:'upper',hinge:'left',open:'true',powered:'true'}}") - ); - map.put( - "minecraft:" + doorId + "westupperrightfalsefalse", - BlockStateData.parse("{Name:'minecraft:" + doorId + "',Properties:{facing:'west',half:'upper',hinge:'right',open:'false',powered:'false'}}") - ); - map.put( - "minecraft:" + doorId + "westupperrightfalsetrue", - BlockStateData.parse("{Name:'minecraft:" + doorId + "',Properties:{facing:'west',half:'upper',hinge:'right',open:'false',powered:'true'}}") - ); - map.put( - "minecraft:" + doorId + "westupperrighttruefalse", - BlockStateData.parse("{Name:'minecraft:" + doorId + "',Properties:{facing:'west',half:'upper',hinge:'right',open:'true',powered:'false'}}") - ); - map.put( - "minecraft:" + doorId + "westupperrighttruetrue", - BlockStateData.parse("{Name:'minecraft:" + doorId + "',Properties:{facing:'west',half:'upper',hinge:'right',open:'true',powered:'true'}}") - ); - } - - private static void addBeds(Map> map, int id, String bedColor) { - map.put("southfalsefoot" + id, BlockStateData.parse("{Name:'minecraft:" + bedColor + "_bed',Properties:{facing:'south',occupied:'false',part:'foot'}}")); - map.put("westfalsefoot" + id, BlockStateData.parse("{Name:'minecraft:" + bedColor + "_bed',Properties:{facing:'west',occupied:'false',part:'foot'}}")); - map.put("northfalsefoot" + id, BlockStateData.parse("{Name:'minecraft:" + bedColor + "_bed',Properties:{facing:'north',occupied:'false',part:'foot'}}")); - map.put("eastfalsefoot" + id, BlockStateData.parse("{Name:'minecraft:" + bedColor + "_bed',Properties:{facing:'east',occupied:'false',part:'foot'}}")); - map.put("southfalsehead" + id, BlockStateData.parse("{Name:'minecraft:" + bedColor + "_bed',Properties:{facing:'south',occupied:'false',part:'head'}}")); - map.put("westfalsehead" + id, BlockStateData.parse("{Name:'minecraft:" + bedColor + "_bed',Properties:{facing:'west',occupied:'false',part:'head'}}")); - map.put("northfalsehead" + id, BlockStateData.parse("{Name:'minecraft:" + bedColor + "_bed',Properties:{facing:'north',occupied:'false',part:'head'}}")); - map.put("eastfalsehead" + id, BlockStateData.parse("{Name:'minecraft:" + bedColor + "_bed',Properties:{facing:'east',occupied:'false',part:'head'}}")); - map.put("southtruehead" + id, BlockStateData.parse("{Name:'minecraft:" + bedColor + "_bed',Properties:{facing:'south',occupied:'true',part:'head'}}")); - map.put("westtruehead" + id, BlockStateData.parse("{Name:'minecraft:" + bedColor + "_bed',Properties:{facing:'west',occupied:'true',part:'head'}}")); - map.put("northtruehead" + id, BlockStateData.parse("{Name:'minecraft:" + bedColor + "_bed',Properties:{facing:'north',occupied:'true',part:'head'}}")); - map.put("easttruehead" + id, BlockStateData.parse("{Name:'minecraft:" + bedColor + "_bed',Properties:{facing:'east',occupied:'true',part:'head'}}")); - } - - private static void addBanners(Map> map, int id, String bannerColor) { - for (int i = 0; i < 16; i++) { - map.put(i + "_" + id, BlockStateData.parse("{Name:'minecraft:" + bannerColor + "_banner',Properties:{rotation:'" + i + "'}}")); - } - - map.put("north_" + id, BlockStateData.parse("{Name:'minecraft:" + bannerColor + "_wall_banner',Properties:{facing:'north'}}")); - map.put("south_" + id, BlockStateData.parse("{Name:'minecraft:" + bannerColor + "_wall_banner',Properties:{facing:'south'}}")); - map.put("west_" + id, BlockStateData.parse("{Name:'minecraft:" + bannerColor + "_wall_banner',Properties:{facing:'west'}}")); - map.put("east_" + id, BlockStateData.parse("{Name:'minecraft:" + bannerColor + "_wall_banner',Properties:{facing:'east'}}")); - } - public static String getName(Dynamic data) { return data.get("Name").asString(""); } @@ -455,69 +106,6 @@ public class ChunkPalettedStorageFix extends DataFix { return i; } - static { - FIX.set(2); - FIX.set(3); - FIX.set(110); - FIX.set(140); - FIX.set(144); - FIX.set(25); - FIX.set(86); - FIX.set(26); - FIX.set(176); - FIX.set(177); - FIX.set(175); - FIX.set(64); - FIX.set(71); - FIX.set(193); - FIX.set(194); - FIX.set(195); - FIX.set(196); - FIX.set(197); - VIRTUAL.set(54); - VIRTUAL.set(146); - VIRTUAL.set(25); - VIRTUAL.set(26); - VIRTUAL.set(51); - VIRTUAL.set(53); - VIRTUAL.set(67); - VIRTUAL.set(108); - VIRTUAL.set(109); - VIRTUAL.set(114); - VIRTUAL.set(128); - VIRTUAL.set(134); - VIRTUAL.set(135); - VIRTUAL.set(136); - VIRTUAL.set(156); - VIRTUAL.set(163); - VIRTUAL.set(164); - VIRTUAL.set(180); - VIRTUAL.set(203); - VIRTUAL.set(55); - VIRTUAL.set(85); - VIRTUAL.set(113); - VIRTUAL.set(188); - VIRTUAL.set(189); - VIRTUAL.set(190); - VIRTUAL.set(191); - VIRTUAL.set(192); - VIRTUAL.set(93); - VIRTUAL.set(94); - VIRTUAL.set(101); - VIRTUAL.set(102); - VIRTUAL.set(160); - VIRTUAL.set(106); - VIRTUAL.set(107); - VIRTUAL.set(183); - VIRTUAL.set(184); - VIRTUAL.set(185); - VIRTUAL.set(186); - VIRTUAL.set(187); - VIRTUAL.set(132); - VIRTUAL.set(139); - VIRTUAL.set(199); - } - static class DataLayer { private static final int SIZE = 2048; private static final int NIBBLE_SIZE = 4; @@ -549,48 +137,485 @@ public class ChunkPalettedStorageFix extends DataFix { } public static enum Direction { - DOWN(ChunkPalettedStorageFix.Direction.AxisDirection.NEGATIVE, ChunkPalettedStorageFix.Direction.Axis.Y), - UP(ChunkPalettedStorageFix.Direction.AxisDirection.POSITIVE, ChunkPalettedStorageFix.Direction.Axis.Y), - NORTH(ChunkPalettedStorageFix.Direction.AxisDirection.NEGATIVE, ChunkPalettedStorageFix.Direction.Axis.Z), - SOUTH(ChunkPalettedStorageFix.Direction.AxisDirection.POSITIVE, ChunkPalettedStorageFix.Direction.Axis.Z), - WEST(ChunkPalettedStorageFix.Direction.AxisDirection.NEGATIVE, ChunkPalettedStorageFix.Direction.Axis.X), - EAST(ChunkPalettedStorageFix.Direction.AxisDirection.POSITIVE, ChunkPalettedStorageFix.Direction.Axis.X); + DOWN(AxisDirection.NEGATIVE, Axis.Y), + UP(AxisDirection.POSITIVE, Axis.Y), + NORTH(AxisDirection.NEGATIVE, Axis.Z), + SOUTH(AxisDirection.POSITIVE, Axis.Z), + WEST(AxisDirection.NEGATIVE, Axis.X), + EAST(AxisDirection.POSITIVE, Axis.X); - private final ChunkPalettedStorageFix.Direction.Axis axis; - private final ChunkPalettedStorageFix.Direction.AxisDirection axisDirection; + private final Axis axis; + private final AxisDirection axisDirection; - private Direction(final ChunkPalettedStorageFix.Direction.AxisDirection axisDirection, final ChunkPalettedStorageFix.Direction.Axis axis) { + private Direction(final AxisDirection axisDirection, final Axis axis) { this.axis = axis; this.axisDirection = axisDirection; } - public ChunkPalettedStorageFix.Direction.AxisDirection getAxisDirection() { + public AxisDirection getAxisDirection() { return this.axisDirection; } - public ChunkPalettedStorageFix.Direction.Axis getAxis() { + public Axis getAxis() { return this.axis; } + } - public static enum Axis { - X, - Y, - Z; + static class MappingConstants { + static final BitSet VIRTUAL = new BitSet(256); + static final BitSet FIX = new BitSet(256); + static final Dynamic PUMPKIN = ExtraDataFixUtils.blockState("minecraft:pumpkin"); + static final Dynamic SNOWY_PODZOL = ExtraDataFixUtils.blockState("minecraft:podzol", Map.of("snowy", "true")); + static final Dynamic SNOWY_GRASS = ExtraDataFixUtils.blockState("minecraft:grass_block", Map.of("snowy", "true")); + static final Dynamic SNOWY_MYCELIUM = ExtraDataFixUtils.blockState("minecraft:mycelium", Map.of("snowy", "true")); + static final Dynamic UPPER_SUNFLOWER = ExtraDataFixUtils.blockState("minecraft:sunflower", Map.of("half", "upper")); + static final Dynamic UPPER_LILAC = ExtraDataFixUtils.blockState("minecraft:lilac", Map.of("half", "upper")); + static final Dynamic UPPER_TALL_GRASS = ExtraDataFixUtils.blockState("minecraft:tall_grass", Map.of("half", "upper")); + static final Dynamic UPPER_LARGE_FERN = ExtraDataFixUtils.blockState("minecraft:large_fern", Map.of("half", "upper")); + static final Dynamic UPPER_ROSE_BUSH = ExtraDataFixUtils.blockState("minecraft:rose_bush", Map.of("half", "upper")); + static final Dynamic UPPER_PEONY = ExtraDataFixUtils.blockState("minecraft:peony", Map.of("half", "upper")); + static final Map> FLOWER_POT_MAP = DataFixUtils.make(Maps.>newHashMap(), hashMap -> { + hashMap.put("minecraft:air0", ExtraDataFixUtils.blockState("minecraft:flower_pot")); + hashMap.put("minecraft:red_flower0", ExtraDataFixUtils.blockState("minecraft:potted_poppy")); + hashMap.put("minecraft:red_flower1", ExtraDataFixUtils.blockState("minecraft:potted_blue_orchid")); + hashMap.put("minecraft:red_flower2", ExtraDataFixUtils.blockState("minecraft:potted_allium")); + hashMap.put("minecraft:red_flower3", ExtraDataFixUtils.blockState("minecraft:potted_azure_bluet")); + hashMap.put("minecraft:red_flower4", ExtraDataFixUtils.blockState("minecraft:potted_red_tulip")); + hashMap.put("minecraft:red_flower5", ExtraDataFixUtils.blockState("minecraft:potted_orange_tulip")); + hashMap.put("minecraft:red_flower6", ExtraDataFixUtils.blockState("minecraft:potted_white_tulip")); + hashMap.put("minecraft:red_flower7", ExtraDataFixUtils.blockState("minecraft:potted_pink_tulip")); + hashMap.put("minecraft:red_flower8", ExtraDataFixUtils.blockState("minecraft:potted_oxeye_daisy")); + hashMap.put("minecraft:yellow_flower0", ExtraDataFixUtils.blockState("minecraft:potted_dandelion")); + hashMap.put("minecraft:sapling0", ExtraDataFixUtils.blockState("minecraft:potted_oak_sapling")); + hashMap.put("minecraft:sapling1", ExtraDataFixUtils.blockState("minecraft:potted_spruce_sapling")); + hashMap.put("minecraft:sapling2", ExtraDataFixUtils.blockState("minecraft:potted_birch_sapling")); + hashMap.put("minecraft:sapling3", ExtraDataFixUtils.blockState("minecraft:potted_jungle_sapling")); + hashMap.put("minecraft:sapling4", ExtraDataFixUtils.blockState("minecraft:potted_acacia_sapling")); + hashMap.put("minecraft:sapling5", ExtraDataFixUtils.blockState("minecraft:potted_dark_oak_sapling")); + hashMap.put("minecraft:red_mushroom0", ExtraDataFixUtils.blockState("minecraft:potted_red_mushroom")); + hashMap.put("minecraft:brown_mushroom0", ExtraDataFixUtils.blockState("minecraft:potted_brown_mushroom")); + hashMap.put("minecraft:deadbush0", ExtraDataFixUtils.blockState("minecraft:potted_dead_bush")); + hashMap.put("minecraft:tallgrass2", ExtraDataFixUtils.blockState("minecraft:potted_fern")); + hashMap.put("minecraft:cactus0", ExtraDataFixUtils.blockState("minecraft:potted_cactus")); + }); + static final Map> SKULL_MAP = DataFixUtils.make(Maps.>newHashMap(), hashMap -> { + mapSkull(hashMap, 0, "skeleton", "skull"); + mapSkull(hashMap, 1, "wither_skeleton", "skull"); + mapSkull(hashMap, 2, "zombie", "head"); + mapSkull(hashMap, 3, "player", "head"); + mapSkull(hashMap, 4, "creeper", "head"); + mapSkull(hashMap, 5, "dragon", "head"); + }); + static final Map> DOOR_MAP = DataFixUtils.make(Maps.>newHashMap(), hashMap -> { + mapDoor(hashMap, "oak_door"); + mapDoor(hashMap, "iron_door"); + mapDoor(hashMap, "spruce_door"); + mapDoor(hashMap, "birch_door"); + mapDoor(hashMap, "jungle_door"); + mapDoor(hashMap, "acacia_door"); + mapDoor(hashMap, "dark_oak_door"); + }); + static final Map> NOTE_BLOCK_MAP = DataFixUtils.make(Maps.>newHashMap(), hashMap -> { + for (int i = 0; i < 26; i++) { + hashMap.put("true" + i, ExtraDataFixUtils.blockState("minecraft:note_block", Map.of("powered", "true", "note", String.valueOf(i)))); + hashMap.put("false" + i, ExtraDataFixUtils.blockState("minecraft:note_block", Map.of("powered", "false", "note", String.valueOf(i)))); + } + }); + private static final Int2ObjectMap DYE_COLOR_MAP = DataFixUtils.make(new Int2ObjectOpenHashMap<>(), int2ObjectOpenHashMap -> { + int2ObjectOpenHashMap.put(0, "white"); + int2ObjectOpenHashMap.put(1, "orange"); + int2ObjectOpenHashMap.put(2, "magenta"); + int2ObjectOpenHashMap.put(3, "light_blue"); + int2ObjectOpenHashMap.put(4, "yellow"); + int2ObjectOpenHashMap.put(5, "lime"); + int2ObjectOpenHashMap.put(6, "pink"); + int2ObjectOpenHashMap.put(7, "gray"); + int2ObjectOpenHashMap.put(8, "light_gray"); + int2ObjectOpenHashMap.put(9, "cyan"); + int2ObjectOpenHashMap.put(10, "purple"); + int2ObjectOpenHashMap.put(11, "blue"); + int2ObjectOpenHashMap.put(12, "brown"); + int2ObjectOpenHashMap.put(13, "green"); + int2ObjectOpenHashMap.put(14, "red"); + int2ObjectOpenHashMap.put(15, "black"); + }); + static final Map> BED_BLOCK_MAP = DataFixUtils.make(Maps.>newHashMap(), hashMap -> { + for (Entry entry : DYE_COLOR_MAP.int2ObjectEntrySet()) { + if (!Objects.equals(entry.getValue(), "red")) { + addBeds(hashMap, entry.getIntKey(), (String)entry.getValue()); + } + } + }); + static final Map> BANNER_BLOCK_MAP = DataFixUtils.make(Maps.>newHashMap(), hashMap -> { + for (Entry entry : DYE_COLOR_MAP.int2ObjectEntrySet()) { + if (!Objects.equals(entry.getValue(), "white")) { + addBanners(hashMap, 15 - entry.getIntKey(), (String)entry.getValue()); + } + } + }); + static final Dynamic AIR = ExtraDataFixUtils.blockState("minecraft:air"); + + private MappingConstants() { } - public static enum AxisDirection { - POSITIVE(1), - NEGATIVE(-1); + private static void mapSkull(Map> map, int i, String string, String string2) { + map.put(i + "north", ExtraDataFixUtils.blockState("minecraft:" + string + "_wall_" + string2, Map.of("facing", "north"))); + map.put(i + "east", ExtraDataFixUtils.blockState("minecraft:" + string + "_wall_" + string2, Map.of("facing", "east"))); + map.put(i + "south", ExtraDataFixUtils.blockState("minecraft:" + string + "_wall_" + string2, Map.of("facing", "south"))); + map.put(i + "west", ExtraDataFixUtils.blockState("minecraft:" + string + "_wall_" + string2, Map.of("facing", "west"))); - private final int step; + for (int j = 0; j < 16; j++) { + map.put("" + i + j, ExtraDataFixUtils.blockState("minecraft:" + string + "_" + string2, Map.of("rotation", String.valueOf(j)))); + } + } - private AxisDirection(final int step) { - this.step = step; + private static void mapDoor(Map> map, String string) { + String string2 = "minecraft:" + string; + map.put( + "minecraft:" + string + "eastlowerleftfalsefalse", + ExtraDataFixUtils.blockState(string2, Map.of("facing", "east", "half", "lower", "hinge", "left", "open", "false", "powered", "false")) + ); + map.put( + "minecraft:" + string + "eastlowerleftfalsetrue", + ExtraDataFixUtils.blockState(string2, Map.of("facing", "east", "half", "lower", "hinge", "left", "open", "false", "powered", "true")) + ); + map.put( + "minecraft:" + string + "eastlowerlefttruefalse", + ExtraDataFixUtils.blockState(string2, Map.of("facing", "east", "half", "lower", "hinge", "left", "open", "true", "powered", "false")) + ); + map.put( + "minecraft:" + string + "eastlowerlefttruetrue", + ExtraDataFixUtils.blockState(string2, Map.of("facing", "east", "half", "lower", "hinge", "left", "open", "true", "powered", "true")) + ); + map.put( + "minecraft:" + string + "eastlowerrightfalsefalse", + ExtraDataFixUtils.blockState(string2, Map.of("facing", "east", "half", "lower", "hinge", "right", "open", "false", "powered", "false")) + ); + map.put( + "minecraft:" + string + "eastlowerrightfalsetrue", + ExtraDataFixUtils.blockState(string2, Map.of("facing", "east", "half", "lower", "hinge", "right", "open", "false", "powered", "true")) + ); + map.put( + "minecraft:" + string + "eastlowerrighttruefalse", + ExtraDataFixUtils.blockState(string2, Map.of("facing", "east", "half", "lower", "hinge", "right", "open", "true", "powered", "false")) + ); + map.put( + "minecraft:" + string + "eastlowerrighttruetrue", + ExtraDataFixUtils.blockState(string2, Map.of("facing", "east", "half", "lower", "hinge", "right", "open", "true", "powered", "true")) + ); + map.put( + "minecraft:" + string + "eastupperleftfalsefalse", + ExtraDataFixUtils.blockState(string2, Map.of("facing", "east", "half", "upper", "hinge", "left", "open", "false", "powered", "false")) + ); + map.put( + "minecraft:" + string + "eastupperleftfalsetrue", + ExtraDataFixUtils.blockState(string2, Map.of("facing", "east", "half", "upper", "hinge", "left", "open", "false", "powered", "true")) + ); + map.put( + "minecraft:" + string + "eastupperlefttruefalse", + ExtraDataFixUtils.blockState(string2, Map.of("facing", "east", "half", "upper", "hinge", "left", "open", "true", "powered", "false")) + ); + map.put( + "minecraft:" + string + "eastupperlefttruetrue", + ExtraDataFixUtils.blockState(string2, Map.of("facing", "east", "half", "upper", "hinge", "left", "open", "true", "powered", "true")) + ); + map.put( + "minecraft:" + string + "eastupperrightfalsefalse", + ExtraDataFixUtils.blockState(string2, Map.of("facing", "east", "half", "upper", "hinge", "right", "open", "false", "powered", "false")) + ); + map.put( + "minecraft:" + string + "eastupperrightfalsetrue", + ExtraDataFixUtils.blockState(string2, Map.of("facing", "east", "half", "upper", "hinge", "right", "open", "false", "powered", "true")) + ); + map.put( + "minecraft:" + string + "eastupperrighttruefalse", + ExtraDataFixUtils.blockState(string2, Map.of("facing", "east", "half", "upper", "hinge", "right", "open", "true", "powered", "false")) + ); + map.put( + "minecraft:" + string + "eastupperrighttruetrue", + ExtraDataFixUtils.blockState(string2, Map.of("facing", "east", "half", "upper", "hinge", "right", "open", "true", "powered", "true")) + ); + map.put( + "minecraft:" + string + "northlowerleftfalsefalse", + ExtraDataFixUtils.blockState(string2, Map.of("facing", "north", "half", "lower", "hinge", "left", "open", "false", "powered", "false")) + ); + map.put( + "minecraft:" + string + "northlowerleftfalsetrue", + ExtraDataFixUtils.blockState(string2, Map.of("facing", "north", "half", "lower", "hinge", "left", "open", "false", "powered", "true")) + ); + map.put( + "minecraft:" + string + "northlowerlefttruefalse", + ExtraDataFixUtils.blockState(string2, Map.of("facing", "north", "half", "lower", "hinge", "left", "open", "true", "powered", "false")) + ); + map.put( + "minecraft:" + string + "northlowerlefttruetrue", + ExtraDataFixUtils.blockState(string2, Map.of("facing", "north", "half", "lower", "hinge", "left", "open", "true", "powered", "true")) + ); + map.put( + "minecraft:" + string + "northlowerrightfalsefalse", + ExtraDataFixUtils.blockState(string2, Map.of("facing", "north", "half", "lower", "hinge", "right", "open", "false", "powered", "false")) + ); + map.put( + "minecraft:" + string + "northlowerrightfalsetrue", + ExtraDataFixUtils.blockState(string2, Map.of("facing", "north", "half", "lower", "hinge", "right", "open", "false", "powered", "true")) + ); + map.put( + "minecraft:" + string + "northlowerrighttruefalse", + ExtraDataFixUtils.blockState(string2, Map.of("facing", "north", "half", "lower", "hinge", "right", "open", "true", "powered", "false")) + ); + map.put( + "minecraft:" + string + "northlowerrighttruetrue", + ExtraDataFixUtils.blockState(string2, Map.of("facing", "north", "half", "lower", "hinge", "right", "open", "true", "powered", "true")) + ); + map.put( + "minecraft:" + string + "northupperleftfalsefalse", + ExtraDataFixUtils.blockState(string2, Map.of("facing", "north", "half", "upper", "hinge", "left", "open", "false", "powered", "false")) + ); + map.put( + "minecraft:" + string + "northupperleftfalsetrue", + ExtraDataFixUtils.blockState(string2, Map.of("facing", "north", "half", "upper", "hinge", "left", "open", "false", "powered", "true")) + ); + map.put( + "minecraft:" + string + "northupperlefttruefalse", + ExtraDataFixUtils.blockState(string2, Map.of("facing", "north", "half", "upper", "hinge", "left", "open", "true", "powered", "false")) + ); + map.put( + "minecraft:" + string + "northupperlefttruetrue", + ExtraDataFixUtils.blockState(string2, Map.of("facing", "north", "half", "upper", "hinge", "left", "open", "true", "powered", "true")) + ); + map.put( + "minecraft:" + string + "northupperrightfalsefalse", + ExtraDataFixUtils.blockState(string2, Map.of("facing", "north", "half", "upper", "hinge", "right", "open", "false", "powered", "false")) + ); + map.put( + "minecraft:" + string + "northupperrightfalsetrue", + ExtraDataFixUtils.blockState(string2, Map.of("facing", "north", "half", "upper", "hinge", "right", "open", "false", "powered", "true")) + ); + map.put( + "minecraft:" + string + "northupperrighttruefalse", + ExtraDataFixUtils.blockState(string2, Map.of("facing", "north", "half", "upper", "hinge", "right", "open", "true", "powered", "false")) + ); + map.put( + "minecraft:" + string + "northupperrighttruetrue", + ExtraDataFixUtils.blockState(string2, Map.of("facing", "north", "half", "upper", "hinge", "right", "open", "true", "powered", "true")) + ); + map.put( + "minecraft:" + string + "southlowerleftfalsefalse", + ExtraDataFixUtils.blockState(string2, Map.of("facing", "south", "half", "lower", "hinge", "left", "open", "false", "powered", "false")) + ); + map.put( + "minecraft:" + string + "southlowerleftfalsetrue", + ExtraDataFixUtils.blockState(string2, Map.of("facing", "south", "half", "lower", "hinge", "left", "open", "false", "powered", "true")) + ); + map.put( + "minecraft:" + string + "southlowerlefttruefalse", + ExtraDataFixUtils.blockState(string2, Map.of("facing", "south", "half", "lower", "hinge", "left", "open", "true", "powered", "false")) + ); + map.put( + "minecraft:" + string + "southlowerlefttruetrue", + ExtraDataFixUtils.blockState(string2, Map.of("facing", "south", "half", "lower", "hinge", "left", "open", "true", "powered", "true")) + ); + map.put( + "minecraft:" + string + "southlowerrightfalsefalse", + ExtraDataFixUtils.blockState(string2, Map.of("facing", "south", "half", "lower", "hinge", "right", "open", "false", "powered", "false")) + ); + map.put( + "minecraft:" + string + "southlowerrightfalsetrue", + ExtraDataFixUtils.blockState(string2, Map.of("facing", "south", "half", "lower", "hinge", "right", "open", "false", "powered", "true")) + ); + map.put( + "minecraft:" + string + "southlowerrighttruefalse", + ExtraDataFixUtils.blockState(string2, Map.of("facing", "south", "half", "lower", "hinge", "right", "open", "true", "powered", "false")) + ); + map.put( + "minecraft:" + string + "southlowerrighttruetrue", + ExtraDataFixUtils.blockState(string2, Map.of("facing", "south", "half", "lower", "hinge", "right", "open", "true", "powered", "true")) + ); + map.put( + "minecraft:" + string + "southupperleftfalsefalse", + ExtraDataFixUtils.blockState(string2, Map.of("facing", "south", "half", "upper", "hinge", "left", "open", "false", "powered", "false")) + ); + map.put( + "minecraft:" + string + "southupperleftfalsetrue", + ExtraDataFixUtils.blockState(string2, Map.of("facing", "south", "half", "upper", "hinge", "left", "open", "false", "powered", "true")) + ); + map.put( + "minecraft:" + string + "southupperlefttruefalse", + ExtraDataFixUtils.blockState(string2, Map.of("facing", "south", "half", "upper", "hinge", "left", "open", "true", "powered", "false")) + ); + map.put( + "minecraft:" + string + "southupperlefttruetrue", + ExtraDataFixUtils.blockState(string2, Map.of("facing", "south", "half", "upper", "hinge", "left", "open", "true", "powered", "true")) + ); + map.put( + "minecraft:" + string + "southupperrightfalsefalse", + ExtraDataFixUtils.blockState(string2, Map.of("facing", "south", "half", "upper", "hinge", "right", "open", "false", "powered", "false")) + ); + map.put( + "minecraft:" + string + "southupperrightfalsetrue", + ExtraDataFixUtils.blockState(string2, Map.of("facing", "south", "half", "upper", "hinge", "right", "open", "false", "powered", "true")) + ); + map.put( + "minecraft:" + string + "southupperrighttruefalse", + ExtraDataFixUtils.blockState(string2, Map.of("facing", "south", "half", "upper", "hinge", "right", "open", "true", "powered", "false")) + ); + map.put( + "minecraft:" + string + "southupperrighttruetrue", + ExtraDataFixUtils.blockState(string2, Map.of("facing", "south", "half", "upper", "hinge", "right", "open", "true", "powered", "true")) + ); + map.put( + "minecraft:" + string + "westlowerleftfalsefalse", + ExtraDataFixUtils.blockState(string2, Map.of("facing", "west", "half", "lower", "hinge", "left", "open", "false", "powered", "false")) + ); + map.put( + "minecraft:" + string + "westlowerleftfalsetrue", + ExtraDataFixUtils.blockState(string2, Map.of("facing", "west", "half", "lower", "hinge", "left", "open", "false", "powered", "true")) + ); + map.put( + "minecraft:" + string + "westlowerlefttruefalse", + ExtraDataFixUtils.blockState(string2, Map.of("facing", "west", "half", "lower", "hinge", "left", "open", "true", "powered", "false")) + ); + map.put( + "minecraft:" + string + "westlowerlefttruetrue", + ExtraDataFixUtils.blockState(string2, Map.of("facing", "west", "half", "lower", "hinge", "left", "open", "true", "powered", "true")) + ); + map.put( + "minecraft:" + string + "westlowerrightfalsefalse", + ExtraDataFixUtils.blockState(string2, Map.of("facing", "west", "half", "lower", "hinge", "right", "open", "false", "powered", "false")) + ); + map.put( + "minecraft:" + string + "westlowerrightfalsetrue", + ExtraDataFixUtils.blockState(string2, Map.of("facing", "west", "half", "lower", "hinge", "right", "open", "false", "powered", "true")) + ); + map.put( + "minecraft:" + string + "westlowerrighttruefalse", + ExtraDataFixUtils.blockState(string2, Map.of("facing", "west", "half", "lower", "hinge", "right", "open", "true", "powered", "false")) + ); + map.put( + "minecraft:" + string + "westlowerrighttruetrue", + ExtraDataFixUtils.blockState(string2, Map.of("facing", "west", "half", "lower", "hinge", "right", "open", "true", "powered", "true")) + ); + map.put( + "minecraft:" + string + "westupperleftfalsefalse", + ExtraDataFixUtils.blockState(string2, Map.of("facing", "west", "half", "upper", "hinge", "left", "open", "false", "powered", "false")) + ); + map.put( + "minecraft:" + string + "westupperleftfalsetrue", + ExtraDataFixUtils.blockState(string2, Map.of("facing", "west", "half", "upper", "hinge", "left", "open", "false", "powered", "true")) + ); + map.put( + "minecraft:" + string + "westupperlefttruefalse", + ExtraDataFixUtils.blockState(string2, Map.of("facing", "west", "half", "upper", "hinge", "left", "open", "true", "powered", "false")) + ); + map.put( + "minecraft:" + string + "westupperlefttruetrue", + ExtraDataFixUtils.blockState(string2, Map.of("facing", "west", "half", "upper", "hinge", "left", "open", "true", "powered", "true")) + ); + map.put( + "minecraft:" + string + "westupperrightfalsefalse", + ExtraDataFixUtils.blockState(string2, Map.of("facing", "west", "half", "upper", "hinge", "right", "open", "false", "powered", "false")) + ); + map.put( + "minecraft:" + string + "westupperrightfalsetrue", + ExtraDataFixUtils.blockState(string2, Map.of("facing", "west", "half", "upper", "hinge", "right", "open", "false", "powered", "true")) + ); + map.put( + "minecraft:" + string + "westupperrighttruefalse", + ExtraDataFixUtils.blockState(string2, Map.of("facing", "west", "half", "upper", "hinge", "right", "open", "true", "powered", "false")) + ); + map.put( + "minecraft:" + string + "westupperrighttruetrue", + ExtraDataFixUtils.blockState(string2, Map.of("facing", "west", "half", "upper", "hinge", "right", "open", "true", "powered", "true")) + ); + } + + private static void addBeds(Map> map, int i, String string) { + map.put("southfalsefoot" + i, ExtraDataFixUtils.blockState("minecraft:" + string + "_bed", Map.of("facing", "south", "occupied", "false", "part", "foot"))); + map.put("westfalsefoot" + i, ExtraDataFixUtils.blockState("minecraft:" + string + "_bed", Map.of("facing", "west", "occupied", "false", "part", "foot"))); + map.put("northfalsefoot" + i, ExtraDataFixUtils.blockState("minecraft:" + string + "_bed", Map.of("facing", "north", "occupied", "false", "part", "foot"))); + map.put("eastfalsefoot" + i, ExtraDataFixUtils.blockState("minecraft:" + string + "_bed", Map.of("facing", "east", "occupied", "false", "part", "foot"))); + map.put("southfalsehead" + i, ExtraDataFixUtils.blockState("minecraft:" + string + "_bed", Map.of("facing", "south", "occupied", "false", "part", "head"))); + map.put("westfalsehead" + i, ExtraDataFixUtils.blockState("minecraft:" + string + "_bed", Map.of("facing", "west", "occupied", "false", "part", "head"))); + map.put("northfalsehead" + i, ExtraDataFixUtils.blockState("minecraft:" + string + "_bed", Map.of("facing", "north", "occupied", "false", "part", "head"))); + map.put("eastfalsehead" + i, ExtraDataFixUtils.blockState("minecraft:" + string + "_bed", Map.of("facing", "east", "occupied", "false", "part", "head"))); + map.put("southtruehead" + i, ExtraDataFixUtils.blockState("minecraft:" + string + "_bed", Map.of("facing", "south", "occupied", "true", "part", "head"))); + map.put("westtruehead" + i, ExtraDataFixUtils.blockState("minecraft:" + string + "_bed", Map.of("facing", "west", "occupied", "true", "part", "head"))); + map.put("northtruehead" + i, ExtraDataFixUtils.blockState("minecraft:" + string + "_bed", Map.of("facing", "north", "occupied", "true", "part", "head"))); + map.put("easttruehead" + i, ExtraDataFixUtils.blockState("minecraft:" + string + "_bed", Map.of("facing", "east", "occupied", "true", "part", "head"))); + } + + private static void addBanners(Map> map, int i, String string) { + for (int j = 0; j < 16; j++) { + map.put(j + "_" + i, ExtraDataFixUtils.blockState("minecraft:" + string + "_banner", Map.of("rotation", String.valueOf(j)))); } - public int getStep() { - return this.step; - } + map.put("north_" + i, ExtraDataFixUtils.blockState("minecraft:" + string + "_wall_banner", Map.of("facing", "north"))); + map.put("south_" + i, ExtraDataFixUtils.blockState("minecraft:" + string + "_wall_banner", Map.of("facing", "south"))); + map.put("west_" + i, ExtraDataFixUtils.blockState("minecraft:" + string + "_wall_banner", Map.of("facing", "west"))); + map.put("east_" + i, ExtraDataFixUtils.blockState("minecraft:" + string + "_wall_banner", Map.of("facing", "east"))); + } + + static { + FIX.set(2); + FIX.set(3); + FIX.set(110); + FIX.set(140); + FIX.set(144); + FIX.set(25); + FIX.set(86); + FIX.set(26); + FIX.set(176); + FIX.set(177); + FIX.set(175); + FIX.set(64); + FIX.set(71); + FIX.set(193); + FIX.set(194); + FIX.set(195); + FIX.set(196); + FIX.set(197); + VIRTUAL.set(54); + VIRTUAL.set(146); + VIRTUAL.set(25); + VIRTUAL.set(26); + VIRTUAL.set(51); + VIRTUAL.set(53); + VIRTUAL.set(67); + VIRTUAL.set(108); + VIRTUAL.set(109); + VIRTUAL.set(114); + VIRTUAL.set(128); + VIRTUAL.set(134); + VIRTUAL.set(135); + VIRTUAL.set(136); + VIRTUAL.set(156); + VIRTUAL.set(163); + VIRTUAL.set(164); + VIRTUAL.set(180); + VIRTUAL.set(203); + VIRTUAL.set(55); + VIRTUAL.set(85); + VIRTUAL.set(113); + VIRTUAL.set(188); + VIRTUAL.set(189); + VIRTUAL.set(190); + VIRTUAL.set(191); + VIRTUAL.set(192); + VIRTUAL.set(93); + VIRTUAL.set(94); + VIRTUAL.set(101); + VIRTUAL.set(102); + VIRTUAL.set(160); + VIRTUAL.set(106); + VIRTUAL.set(107); + VIRTUAL.set(183); + VIRTUAL.set(184); + VIRTUAL.set(185); + VIRTUAL.set(186); + VIRTUAL.set(187); + VIRTUAL.set(132); + VIRTUAL.set(139); + VIRTUAL.set(199); } } @@ -615,15 +640,15 @@ public class ChunkPalettedStorageFix extends DataFix { public Dynamic getBlock(int id) { if (id >= 0 && id <= 4095) { Dynamic dynamic = this.palette.byId(this.buffer[id]); - return dynamic == null ? ChunkPalettedStorageFix.AIR : dynamic; + return dynamic == null ? ChunkPalettedStorageFix.MappingConstants.AIR : dynamic; } else { - return ChunkPalettedStorageFix.AIR; + return ChunkPalettedStorageFix.MappingConstants.AIR; } } public void setBlock(int index, Dynamic data) { if (this.seen.add(data)) { - this.listTag.add("%%FILTER_ME%%".equals(ChunkPalettedStorageFix.getName(data)) ? ChunkPalettedStorageFix.AIR : data); + this.listTag.add("%%FILTER_ME%%".equals(ChunkPalettedStorageFix.getName(data)) ? ChunkPalettedStorageFix.MappingConstants.AIR : data); } this.buffer[index] = ChunkPalettedStorageFix.idFor(this.palette, data); @@ -646,20 +671,20 @@ public class ChunkPalettedStorageFix extends DataFix { .map(byteBufferx -> new ChunkPalettedStorageFix.DataLayer(DataFixUtils.toArray(byteBufferx))) .result() .orElseGet(ChunkPalettedStorageFix.DataLayer::new); - this.seen.add(ChunkPalettedStorageFix.AIR); - ChunkPalettedStorageFix.idFor(this.palette, ChunkPalettedStorageFix.AIR); - this.listTag.add(ChunkPalettedStorageFix.AIR); + this.seen.add(ChunkPalettedStorageFix.MappingConstants.AIR); + ChunkPalettedStorageFix.idFor(this.palette, ChunkPalettedStorageFix.MappingConstants.AIR); + this.listTag.add(ChunkPalettedStorageFix.MappingConstants.AIR); for (int j = 0; j < 4096; j++) { int k = j & 15; int l = j >> 8 & 15; int m = j >> 4 & 15; int n = dataLayer2.get(k, l, m) << 12 | (byteBuffer.get(j) & 255) << 4 | dataLayer.get(k, l, m); - if (ChunkPalettedStorageFix.FIX.get(n >> 4)) { + if (ChunkPalettedStorageFix.MappingConstants.FIX.get(n >> 4)) { this.addFix(n >> 4, j); } - if (ChunkPalettedStorageFix.VIRTUAL.get(n >> 4)) { + if (ChunkPalettedStorageFix.MappingConstants.VIRTUAL.get(n >> 4)) { int o = ChunkPalettedStorageFix.getSideMask(k == 0, k == 15, m == 0, m == 15); if (o == 0) { this.update.add(j); @@ -736,9 +761,9 @@ public class ChunkPalettedStorageFix extends DataFix { for (ChunkPalettedStorageFix.Section section : this.sections) { if (section != null) { - for (java.util.Map.Entry entry : section.toFix.entrySet()) { + for (Entry entry : section.toFix.int2ObjectEntrySet()) { int i = section.y << 12; - switch (entry.getKey()) { + switch (entry.getIntKey()) { case 2: for (int j : (IntList)entry.getValue()) { j |= i; @@ -746,7 +771,7 @@ public class ChunkPalettedStorageFix extends DataFix { if ("minecraft:grass_block".equals(ChunkPalettedStorageFix.getName(dynamic))) { String string = ChunkPalettedStorageFix.getName(this.getBlock(relative(j, ChunkPalettedStorageFix.Direction.UP))); if ("minecraft:snow".equals(string) || "minecraft:snow_layer".equals(string)) { - this.setBlock(j, ChunkPalettedStorageFix.SNOWY_GRASS); + this.setBlock(j, ChunkPalettedStorageFix.MappingConstants.SNOWY_GRASS); } } } @@ -758,7 +783,7 @@ public class ChunkPalettedStorageFix extends DataFix { if ("minecraft:podzol".equals(ChunkPalettedStorageFix.getName(dynamic))) { String string = ChunkPalettedStorageFix.getName(this.getBlock(relative(jxxxxxxxxx, ChunkPalettedStorageFix.Direction.UP))); if ("minecraft:snow".equals(string) || "minecraft:snow_layer".equals(string)) { - this.setBlock(jxxxxxxxxx, ChunkPalettedStorageFix.SNOWY_PODZOL); + this.setBlock(jxxxxxxxxx, ChunkPalettedStorageFix.MappingConstants.SNOWY_PODZOL); } } } @@ -770,7 +795,9 @@ public class ChunkPalettedStorageFix extends DataFix { if (dynamic != null) { String string = Boolean.toString(dynamic.get("powered").asBoolean(false)) + (byte)Math.min(Math.max(dynamic.get("note").asInt(0), 0), 24); this.setBlock( - jxxxxx, (Dynamic)ChunkPalettedStorageFix.NOTE_BLOCK_MAP.getOrDefault(string, (Dynamic)ChunkPalettedStorageFix.NOTE_BLOCK_MAP.get("false0")) + jxxxxx, + (Dynamic)ChunkPalettedStorageFix.MappingConstants.NOTE_BLOCK_MAP + .getOrDefault(string, (Dynamic)ChunkPalettedStorageFix.MappingConstants.NOTE_BLOCK_MAP.get("false0")) ); } } @@ -787,8 +814,8 @@ public class ChunkPalettedStorageFix extends DataFix { + ChunkPalettedStorageFix.getProperty(dynamic2, "occupied") + ChunkPalettedStorageFix.getProperty(dynamic2, "part") + k; - if (ChunkPalettedStorageFix.BED_BLOCK_MAP.containsKey(string2)) { - this.setBlock(jxxxx, (Dynamic)ChunkPalettedStorageFix.BED_BLOCK_MAP.get(string2)); + if (ChunkPalettedStorageFix.MappingConstants.BED_BLOCK_MAP.containsKey(string2)) { + this.setBlock(jxxxx, (Dynamic)ChunkPalettedStorageFix.MappingConstants.BED_BLOCK_MAP.get(string2)); } } } @@ -815,8 +842,8 @@ public class ChunkPalettedStorageFix extends DataFix { String string6 = ChunkPalettedStorageFix.getProperty(dynamic2, "open"); String string7 = bl ? "left" : ChunkPalettedStorageFix.getProperty(dynamic3, "hinge"); String string8 = bl ? "false" : ChunkPalettedStorageFix.getProperty(dynamic3, "powered"); - this.setBlock(jxxx, (Dynamic)ChunkPalettedStorageFix.DOOR_MAP.get(string4 + string5 + "lower" + string7 + string6 + string8)); - this.setBlock(k, (Dynamic)ChunkPalettedStorageFix.DOOR_MAP.get(string4 + string5 + "upper" + string7 + string6 + string8)); + this.setBlock(jxxx, (Dynamic)ChunkPalettedStorageFix.MappingConstants.DOOR_MAP.get(string4 + string5 + "lower" + string7 + string6 + string8)); + this.setBlock(k, (Dynamic)ChunkPalettedStorageFix.MappingConstants.DOOR_MAP.get(string4 + string5 + "upper" + string7 + string6 + string8)); } } } @@ -829,7 +856,7 @@ public class ChunkPalettedStorageFix extends DataFix { if ("minecraft:carved_pumpkin".equals(ChunkPalettedStorageFix.getName(dynamic))) { String string = ChunkPalettedStorageFix.getName(this.getBlock(relative(jxxxxxxxx, ChunkPalettedStorageFix.Direction.DOWN))); if ("minecraft:grass_block".equals(string) || "minecraft:dirt".equals(string)) { - this.setBlock(jxxxxxxxx, ChunkPalettedStorageFix.PUMPKIN); + this.setBlock(jxxxxxxxx, ChunkPalettedStorageFix.MappingConstants.PUMPKIN); } } } @@ -841,7 +868,7 @@ public class ChunkPalettedStorageFix extends DataFix { if ("minecraft:mycelium".equals(ChunkPalettedStorageFix.getName(dynamic))) { String string = ChunkPalettedStorageFix.getName(this.getBlock(relative(jxxxxxxx, ChunkPalettedStorageFix.Direction.UP))); if ("minecraft:snow".equals(string) || "minecraft:snow_layer".equals(string)) { - this.setBlock(jxxxxxxx, ChunkPalettedStorageFix.SNOWY_MYCELIUM); + this.setBlock(jxxxxxxx, ChunkPalettedStorageFix.MappingConstants.SNOWY_MYCELIUM); } } } @@ -853,7 +880,9 @@ public class ChunkPalettedStorageFix extends DataFix { if (dynamic != null) { String string = dynamic.get("Item").asString("") + dynamic.get("Data").asInt(0); this.setBlock( - jxx, (Dynamic)ChunkPalettedStorageFix.FLOWER_POT_MAP.getOrDefault(string, (Dynamic)ChunkPalettedStorageFix.FLOWER_POT_MAP.get("minecraft:air0")) + jxx, + (Dynamic)ChunkPalettedStorageFix.MappingConstants.FLOWER_POT_MAP + .getOrDefault(string, (Dynamic)ChunkPalettedStorageFix.MappingConstants.FLOWER_POT_MAP.get("minecraft:air0")) ); } } @@ -875,7 +904,11 @@ public class ChunkPalettedStorageFix extends DataFix { dynamic.remove("SkullType"); dynamic.remove("facing"); dynamic.remove("Rot"); - this.setBlock(jxxxxxx, (Dynamic)ChunkPalettedStorageFix.SKULL_MAP.getOrDefault(string2, (Dynamic)ChunkPalettedStorageFix.SKULL_MAP.get("0north"))); + this.setBlock( + jxxxxxx, + (Dynamic)ChunkPalettedStorageFix.MappingConstants.SKULL_MAP + .getOrDefault(string2, (Dynamic)ChunkPalettedStorageFix.MappingConstants.SKULL_MAP.get("0north")) + ); } } break; @@ -886,18 +919,24 @@ public class ChunkPalettedStorageFix extends DataFix { if ("upper".equals(ChunkPalettedStorageFix.getProperty(dynamic, "half"))) { Dynamic dynamic2 = this.getBlock(relative(jx, ChunkPalettedStorageFix.Direction.DOWN)); String string3 = ChunkPalettedStorageFix.getName(dynamic2); - if ("minecraft:sunflower".equals(string3)) { - this.setBlock(jx, ChunkPalettedStorageFix.UPPER_SUNFLOWER); - } else if ("minecraft:lilac".equals(string3)) { - this.setBlock(jx, ChunkPalettedStorageFix.UPPER_LILAC); - } else if ("minecraft:tall_grass".equals(string3)) { - this.setBlock(jx, ChunkPalettedStorageFix.UPPER_TALL_GRASS); - } else if ("minecraft:large_fern".equals(string3)) { - this.setBlock(jx, ChunkPalettedStorageFix.UPPER_LARGE_FERN); - } else if ("minecraft:rose_bush".equals(string3)) { - this.setBlock(jx, ChunkPalettedStorageFix.UPPER_ROSE_BUSH); - } else if ("minecraft:peony".equals(string3)) { - this.setBlock(jx, ChunkPalettedStorageFix.UPPER_PEONY); + switch (string3) { + case "minecraft:sunflower": + this.setBlock(jx, ChunkPalettedStorageFix.MappingConstants.UPPER_SUNFLOWER); + break; + case "minecraft:lilac": + this.setBlock(jx, ChunkPalettedStorageFix.MappingConstants.UPPER_LILAC); + break; + case "minecraft:tall_grass": + this.setBlock(jx, ChunkPalettedStorageFix.MappingConstants.UPPER_TALL_GRASS); + break; + case "minecraft:large_fern": + this.setBlock(jx, ChunkPalettedStorageFix.MappingConstants.UPPER_LARGE_FERN); + break; + case "minecraft:rose_bush": + this.setBlock(jx, ChunkPalettedStorageFix.MappingConstants.UPPER_ROSE_BUSH); + break; + case "minecraft:peony": + this.setBlock(jx, ChunkPalettedStorageFix.MappingConstants.UPPER_PEONY); } } } @@ -911,9 +950,9 @@ public class ChunkPalettedStorageFix extends DataFix { if (dynamic != null) { int k = dynamic.get("Base").asInt(0); if (k != 15 && k >= 0 && k < 16) { - String string2 = ChunkPalettedStorageFix.getProperty(dynamic2, entry.getKey() == 176 ? "rotation" : "facing") + "_" + k; - if (ChunkPalettedStorageFix.BANNER_BLOCK_MAP.containsKey(string2)) { - this.setBlock(jxxxxxxxxxx, (Dynamic)ChunkPalettedStorageFix.BANNER_BLOCK_MAP.get(string2)); + String string2 = ChunkPalettedStorageFix.getProperty(dynamic2, entry.getIntKey() == 176 ? "rotation" : "facing") + "_" + k; + if (ChunkPalettedStorageFix.MappingConstants.BANNER_BLOCK_MAP.containsKey(string2)) { + this.setBlock(jxxxxxxxxxx, (Dynamic)ChunkPalettedStorageFix.MappingConstants.BANNER_BLOCK_MAP.get(string2)); } } } @@ -934,20 +973,24 @@ public class ChunkPalettedStorageFix extends DataFix { return this.blockEntities.remove(index); } + // $VF: Unable to simplify switch-on-enum, as the enum class was not able to be found. + // Please report this to the Vineflower issue tracker, at https://github.com/Vineflower/vineflower/issues with a copy of the class file (if you have the rights to distribute it!) public static int relative(int i, ChunkPalettedStorageFix.Direction direction) { - switch (direction.getAxis()) { - case X: + return switch (direction.getAxis().ordinal()) { + case 0 -> { int j = (i & 15) + direction.getAxisDirection().getStep(); - return j >= 0 && j <= 15 ? i & -16 | j : -1; - case Y: - int k = (i >> 8) + direction.getAxisDirection().getStep(); - return k >= 0 && k <= 255 ? i & 0xFF | k << 8 : -1; - case Z: - int l = (i >> 4 & 15) + direction.getAxisDirection().getStep(); - return l >= 0 && l <= 15 ? i & -241 | l << 4 : -1; - default: - return -1; - } + yield j >= 0 && j <= 15 ? i & -16 | j : -1; + } + case 1 -> { + int j = (i >> 8) + direction.getAxisDirection().getStep(); + yield j >= 0 && j <= 255 ? i & 0xFF | j << 8 : -1; + } + case 2 -> { + int j = (i >> 4 & 15) + direction.getAxisDirection().getStep(); + yield j >= 0 && j <= 15 ? i & -241 | j << 4 : -1; + } + default -> throw new MatchException(null, null); + }; } private void setBlock(int i, Dynamic dynamic) { @@ -968,9 +1011,9 @@ public class ChunkPalettedStorageFix extends DataFix { public Dynamic getBlock(int i) { if (i >= 0 && i <= 65535) { ChunkPalettedStorageFix.Section section = this.getSection(i); - return section == null ? ChunkPalettedStorageFix.AIR : section.getBlock(i & 4095); + return section == null ? ChunkPalettedStorageFix.MappingConstants.AIR : section.getBlock(i & 4095); } else { - return ChunkPalettedStorageFix.AIR; + return ChunkPalettedStorageFix.MappingConstants.AIR; } } diff --git a/net/minecraft/util/datafix/fixes/ContainerBlockEntityLockPredicateFix.java b/net/minecraft/util/datafix/fixes/ContainerBlockEntityLockPredicateFix.java new file mode 100644 index 00000000..9bb76b73 --- /dev/null +++ b/net/minecraft/util/datafix/fixes/ContainerBlockEntityLockPredicateFix.java @@ -0,0 +1,24 @@ +package net.minecraft.util.datafix.fixes; + +import com.mojang.datafixers.DSL; +import com.mojang.datafixers.DataFix; +import com.mojang.datafixers.TypeRewriteRule; +import com.mojang.datafixers.Typed; +import com.mojang.datafixers.schemas.Schema; + +public class ContainerBlockEntityLockPredicateFix extends DataFix { + public ContainerBlockEntityLockPredicateFix(Schema schema) { + super(schema, false); + } + + @Override + protected TypeRewriteRule makeRule() { + return this.fixTypeEverywhereTyped( + "ContainerBlockEntityLockPredicateFix", this.getInputSchema().findChoiceType(References.BLOCK_ENTITY), ContainerBlockEntityLockPredicateFix::fixBlockEntity + ); + } + + private static Typed fixBlockEntity(Typed typed) { + return typed.update(DSL.remainderFinder(), dynamic -> dynamic.renameAndFixField("Lock", "lock", LockComponentPredicateFix::fixLock)); + } +} diff --git a/net/minecraft/util/datafix/fixes/EffectDurationFix.java b/net/minecraft/util/datafix/fixes/EffectDurationFix.java index ea46ac5b..ad5228fc 100644 --- a/net/minecraft/util/datafix/fixes/EffectDurationFix.java +++ b/net/minecraft/util/datafix/fixes/EffectDurationFix.java @@ -14,7 +14,7 @@ import java.util.Set; import net.minecraft.util.datafix.schemas.NamespacedSchema; public class EffectDurationFix extends DataFix { - private static final Set ITEM_TYPES = Set.of("minecraft:potion", "minecraft:splash_potion", "minecraft:lingering_potion", "minecraft:tipped_arrow"); + private static final Set POTION_ITEMS = Set.of("minecraft:potion", "minecraft:splash_potion", "minecraft:lingering_potion", "minecraft:tipped_arrow"); public EffectDurationFix(Schema outputSchema) { super(outputSchema, false); @@ -30,12 +30,11 @@ public class EffectDurationFix extends DataFix { this.fixTypeEverywhereTyped("EffectDurationEntity", schema.getType(References.ENTITY), typed -> typed.update(DSL.remainderFinder(), this::updateEntity)), this.fixTypeEverywhereTyped("EffectDurationPlayer", schema.getType(References.PLAYER), typed -> typed.update(DSL.remainderFinder(), this::updateEntity)), this.fixTypeEverywhereTyped("EffectDurationItem", type, typed -> { - Optional> optional = typed.getOptional(opticFinder); - if (optional.filter(ITEM_TYPES::contains).isPresent()) { - Optional> optional2 = typed.getOptionalTyped(opticFinder2); - if (optional2.isPresent()) { - Dynamic dynamic = ((Typed)optional2.get()).get(DSL.remainderFinder()); - Typed typed2 = ((Typed)optional2.get()).set(DSL.remainderFinder(), dynamic.update("CustomPotionEffects", this::fix)); + if (typed.getOptional(opticFinder).filter(pair -> POTION_ITEMS.contains(pair.getSecond())).isPresent()) { + Optional> optional = typed.getOptionalTyped(opticFinder2); + if (optional.isPresent()) { + Dynamic dynamic = ((Typed)optional.get()).get(DSL.remainderFinder()); + Typed typed2 = ((Typed)optional.get()).set(DSL.remainderFinder(), dynamic.update("CustomPotionEffects", this::fix)); return typed.set(opticFinder2, typed2); } } diff --git a/net/minecraft/util/datafix/fixes/EntityRenameFix.java b/net/minecraft/util/datafix/fixes/EntityRenameFix.java index 9b594327..e4662c3e 100644 --- a/net/minecraft/util/datafix/fixes/EntityRenameFix.java +++ b/net/minecraft/util/datafix/fixes/EntityRenameFix.java @@ -9,6 +9,9 @@ import com.mojang.datafixers.types.templates.TaggedChoice.TaggedChoiceType; import com.mojang.datafixers.util.Pair; import com.mojang.serialization.DynamicOps; import java.util.Locale; +import java.util.function.Function; +import net.minecraft.Util; +import net.minecraft.util.datafix.ExtraDataFixUtils; public abstract class EntityRenameFix extends DataFix { protected final String name; @@ -22,9 +25,13 @@ public abstract class EntityRenameFix extends DataFix { public TypeRewriteRule makeRule() { TaggedChoiceType taggedChoiceType = (TaggedChoiceType)this.getInputSchema().findChoiceType(References.ENTITY); TaggedChoiceType taggedChoiceType2 = (TaggedChoiceType)this.getOutputSchema().findChoiceType(References.ENTITY); + Function> function = Util.memoize((Function>)(string -> { + Type type = (Type)taggedChoiceType.types().get(string); + return ExtraDataFixUtils.patchSubType(type, taggedChoiceType, taggedChoiceType2); + })); return this.fixTypeEverywhere(this.name, taggedChoiceType, taggedChoiceType2, dynamicOps -> pair -> { String string = (String)pair.getFirst(); - Type type = (Type)taggedChoiceType.types().get(string); + Type type = (Type)function.apply(string); Pair> pair2 = this.fix(string, this.getEntity(pair.getSecond(), dynamicOps, type)); Type type2 = (Type)taggedChoiceType2.types().get(pair2.getFirst()); if (!type2.equals(pair2.getSecond().getType(), true, true)) { diff --git a/net/minecraft/util/datafix/fixes/FireResistantToDamageResistantComponentFix.java b/net/minecraft/util/datafix/fixes/FireResistantToDamageResistantComponentFix.java new file mode 100644 index 00000000..6ebd68ef --- /dev/null +++ b/net/minecraft/util/datafix/fixes/FireResistantToDamageResistantComponentFix.java @@ -0,0 +1,15 @@ +package net.minecraft.util.datafix.fixes; + +import com.mojang.datafixers.schemas.Schema; +import com.mojang.serialization.Dynamic; + +public class FireResistantToDamageResistantComponentFix extends ItemStackComponentRemainderFix { + public FireResistantToDamageResistantComponentFix(Schema schema) { + super(schema, "FireResistantToDamageResistantComponentFix", "minecraft:fire_resistant", "minecraft:damage_resistant"); + } + + @Override + protected Dynamic fixComponent(Dynamic tag) { + return tag.emptyMap().set("types", tag.createString("#minecraft:is_fire")); + } +} diff --git a/net/minecraft/util/datafix/fixes/FoodToConsumableFix.java b/net/minecraft/util/datafix/fixes/FoodToConsumableFix.java new file mode 100644 index 00000000..7a40a977 --- /dev/null +++ b/net/minecraft/util/datafix/fixes/FoodToConsumableFix.java @@ -0,0 +1,43 @@ +package net.minecraft.util.datafix.fixes; + +import com.mojang.datafixers.DataFix; +import com.mojang.datafixers.TypeRewriteRule; +import com.mojang.datafixers.schemas.Schema; +import com.mojang.serialization.Dynamic; +import java.util.Optional; +import java.util.stream.Stream; + +public class FoodToConsumableFix extends DataFix { + public FoodToConsumableFix(Schema schema) { + super(schema, true); + } + + @Override + protected TypeRewriteRule makeRule() { + return this.writeFixAndRead( + "Food to consumable fix", + this.getInputSchema().getType(References.DATA_COMPONENTS), + this.getOutputSchema().getType(References.DATA_COMPONENTS), + dynamic -> { + Optional> optional = dynamic.get("minecraft:food").result(); + if (optional.isPresent()) { + float f = ((Dynamic)optional.get()).get("eat_seconds").asFloat(1.6F); + Stream> stream = ((Dynamic)optional.get()).get("effects").asStream(); + Stream> stream2 = stream.map( + dynamicx -> dynamicx.emptyMap() + .set("type", dynamicx.createString("minecraft:apply_effects")) + .set("effects", dynamicx.createList(dynamicx.get("effect").result().stream())) + .set("probability", dynamicx.createFloat(dynamicx.get("probability").asFloat(1.0F))) + ); + dynamic = Dynamic.copyField((Dynamic)optional.get(), "using_converts_to", dynamic, "minecraft:use_remainder"); + dynamic = dynamic.set("minecraft:food", ((Dynamic)optional.get()).remove("eat_seconds").remove("effects").remove("using_converts_to")); + return dynamic.set( + "minecraft:consumable", dynamic.emptyMap().set("consume_seconds", dynamic.createFloat(f)).set("on_consume_effects", dynamic.createList(stream2)) + ); + } else { + return dynamic; + } + } + ); + } +} diff --git a/net/minecraft/util/datafix/fixes/LockComponentPredicateFix.java b/net/minecraft/util/datafix/fixes/LockComponentPredicateFix.java new file mode 100644 index 00000000..06ee71c9 --- /dev/null +++ b/net/minecraft/util/datafix/fixes/LockComponentPredicateFix.java @@ -0,0 +1,31 @@ +package net.minecraft.util.datafix.fixes; + +import com.google.common.escape.Escaper; +import com.google.common.escape.Escapers; +import com.mojang.datafixers.schemas.Schema; +import com.mojang.serialization.Dynamic; +import java.util.Optional; + +public class LockComponentPredicateFix extends ItemStackComponentRemainderFix { + public static final Escaper ESCAPER = Escapers.builder().addEscape('"', "\\\"").addEscape('\\', "\\\\").build(); + + public LockComponentPredicateFix(Schema schema) { + super(schema, "LockComponentPredicateFix", "minecraft:lock"); + } + + @Override + protected Dynamic fixComponent(Dynamic tag) { + return fixLock(tag); + } + + public static Dynamic fixLock(Dynamic dynamic) { + Optional optional = dynamic.asString().result(); + if (optional.isPresent()) { + Dynamic dynamic2 = dynamic.createString("\"" + ESCAPER.escape((String)optional.get()) + "\""); + Dynamic dynamic3 = dynamic.emptyMap().set("minecraft:custom_name", dynamic2); + return dynamic.emptyMap().set("components", dynamic3); + } else { + return dynamic.emptyMap(); + } + } +} diff --git a/net/minecraft/util/datafix/fixes/NamedEntityWriteReadFix.java b/net/minecraft/util/datafix/fixes/NamedEntityWriteReadFix.java index 3f990c67..3fcfe025 100644 --- a/net/minecraft/util/datafix/fixes/NamedEntityWriteReadFix.java +++ b/net/minecraft/util/datafix/fixes/NamedEntityWriteReadFix.java @@ -3,17 +3,14 @@ package net.minecraft.util.datafix.fixes; import com.mojang.datafixers.DSL; import com.mojang.datafixers.DataFix; import com.mojang.datafixers.OpticFinder; -import com.mojang.datafixers.RewriteResult; import com.mojang.datafixers.TypeRewriteRule; import com.mojang.datafixers.Typed; -import com.mojang.datafixers.View; import com.mojang.datafixers.DSL.TypeReference; -import com.mojang.datafixers.functions.PointFreeRule; import com.mojang.datafixers.schemas.Schema; import com.mojang.datafixers.types.Type; import com.mojang.serialization.Dynamic; -import java.util.BitSet; import net.minecraft.Util; +import net.minecraft.util.datafix.ExtraDataFixUtils; public abstract class NamedEntityWriteReadFix extends DataFix { private final String name; @@ -34,7 +31,7 @@ public abstract class NamedEntityWriteReadFix extends DataFix { Type type3 = this.getOutputSchema().getType(this.type); Type type4 = this.getOutputSchema().getChoiceType(this.type, this.entityName); OpticFinder opticFinder = DSL.namedChoice(this.entityName, type2); - Type type5 = type2.all(typePatcher(type, type3), true, false).view().newType(); + Type type5 = ExtraDataFixUtils.patchSubType(type2, type, type3); return this.fix(type, type3, opticFinder, type4, type5); } @@ -48,12 +45,5 @@ public abstract class NamedEntityWriteReadFix extends DataFix { }); } - private static TypeRewriteRule typePatcher(Type type, Type newType) { - RewriteResult rewriteResult = RewriteResult.create(View.create("Patcher", type, newType, dynamicOps -> object -> { - throw new UnsupportedOperationException(); - }), new BitSet()); - return TypeRewriteRule.everywhere(TypeRewriteRule.ifSame(type, rewriteResult), PointFreeRule.nop(), true, true); - } - protected abstract Dynamic fix(Dynamic tag); } diff --git a/net/minecraft/util/datafix/fixes/OminousBannerRarityFix.java b/net/minecraft/util/datafix/fixes/OminousBannerRarityFix.java new file mode 100644 index 00000000..d8bc12b8 --- /dev/null +++ b/net/minecraft/util/datafix/fixes/OminousBannerRarityFix.java @@ -0,0 +1,57 @@ +package net.minecraft.util.datafix.fixes; + +import com.mojang.datafixers.DSL; +import com.mojang.datafixers.DataFix; +import com.mojang.datafixers.OpticFinder; +import com.mojang.datafixers.TypeRewriteRule; +import com.mojang.datafixers.Typed; +import com.mojang.datafixers.schemas.Schema; +import com.mojang.datafixers.types.Type; +import com.mojang.datafixers.types.templates.TaggedChoice.TaggedChoiceType; +import com.mojang.datafixers.util.Pair; +import net.minecraft.util.datafix.ComponentDataFixUtils; +import net.minecraft.util.datafix.schemas.NamespacedSchema; + +public class OminousBannerRarityFix extends DataFix { + public OminousBannerRarityFix(Schema schema) { + super(schema, false); + } + + @Override + public TypeRewriteRule makeRule() { + Type type = this.getInputSchema().getType(References.BLOCK_ENTITY); + Type type2 = this.getInputSchema().getType(References.ITEM_STACK); + TaggedChoiceType taggedChoiceType = this.getInputSchema().findChoiceType(References.BLOCK_ENTITY); + OpticFinder> opticFinder = DSL.fieldFinder("id", DSL.named(References.ITEM_NAME.typeName(), NamespacedSchema.namespacedString())); + OpticFinder opticFinder2 = type.findField("components"); + OpticFinder opticFinder3 = type2.findField("components"); + return TypeRewriteRule.seq(this.fixTypeEverywhereTyped("Ominous Banner block entity common rarity to uncommon rarity fix", type, typed -> { + Object object = typed.get(taggedChoiceType.finder()).getFirst(); + return object.equals("minecraft:banner") ? this.fix(typed, opticFinder2) : typed; + }), this.fixTypeEverywhereTyped("Ominous Banner item stack common rarity to uncommon rarity fix", type2, typed -> { + String string = (String)typed.getOptional(opticFinder).map(Pair::getSecond).orElse(""); + return string.equals("minecraft:white_banner") ? this.fix(typed, opticFinder3) : typed; + })); + } + + private Typed fix(Typed typed, OpticFinder opticFinder) { + return typed.updateTyped( + opticFinder, + typedx -> typedx.update( + DSL.remainderFinder(), + dynamic -> { + boolean bl = dynamic.get("minecraft:item_name") + .asString() + .result() + .flatMap(ComponentDataFixUtils::extractTranslationString) + .filter(string -> string.equals("block.minecraft.ominous_banner")) + .isPresent(); + return bl + ? dynamic.set("minecraft:rarity", dynamic.createString("uncommon")) + .set("minecraft:item_name", ComponentDataFixUtils.createTranslatableComponent(dynamic.getOps(), "block.minecraft.ominous_banner")) + : dynamic; + } + ) + ); + } +} diff --git a/net/minecraft/util/datafix/fixes/TrialSpawnerConfigInRegistryFix.java b/net/minecraft/util/datafix/fixes/TrialSpawnerConfigInRegistryFix.java new file mode 100644 index 00000000..88c32c79 --- /dev/null +++ b/net/minecraft/util/datafix/fixes/TrialSpawnerConfigInRegistryFix.java @@ -0,0 +1,190 @@ +package net.minecraft.util.datafix.fixes; + +import com.mojang.brigadier.exceptions.CommandSyntaxException; +import com.mojang.datafixers.DSL; +import com.mojang.datafixers.Typed; +import com.mojang.datafixers.schemas.Schema; +import com.mojang.datafixers.util.Pair; +import com.mojang.logging.LogUtils; +import com.mojang.serialization.Dynamic; +import com.mojang.serialization.DynamicOps; +import java.util.HashMap; +import java.util.Map; +import java.util.Optional; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.NbtOps; +import net.minecraft.nbt.Tag; +import net.minecraft.nbt.TagParser; +import net.minecraft.resources.ResourceLocation; +import org.slf4j.Logger; + +public class TrialSpawnerConfigInRegistryFix extends NamedEntityFix { + private static final Logger LOGGER = LogUtils.getLogger(); + + public TrialSpawnerConfigInRegistryFix(Schema schema) { + super(schema, false, "TrialSpawnerConfigInRegistryFix", References.BLOCK_ENTITY, "minecraft:trial_spawner"); + } + + public Dynamic fixTag(Dynamic dynamic) { + Optional> optional = dynamic.get("normal_config").result(); + if (optional.isEmpty()) { + return dynamic; + } else { + Optional> optional2 = dynamic.get("ominous_config").result(); + if (optional2.isEmpty()) { + return dynamic; + } else { + ResourceLocation resourceLocation = (ResourceLocation)TrialSpawnerConfigInRegistryFix.VanillaTrialChambers.CONFIGS_TO_KEY + .get(Pair.of((Dynamic)optional.get(), (Dynamic)optional2.get())); + return resourceLocation == null + ? dynamic + : dynamic.set("normal_config", dynamic.createString(resourceLocation.withSuffix("/normal").toString())) + .set("ominous_config", dynamic.createString(resourceLocation.withSuffix("/ominous").toString())); + } + } + } + + @Override + protected Typed fix(Typed typed) { + return typed.update(DSL.remainderFinder(), dynamic -> { + DynamicOps dynamicOps = dynamic.getOps(); + Dynamic dynamic2 = this.fixTag(dynamic.convert(NbtOps.INSTANCE)); + return dynamic2.convert(dynamicOps); + }); + } + + static final class VanillaTrialChambers { + public static final Map, Dynamic>, ResourceLocation> CONFIGS_TO_KEY = new HashMap(); + + private VanillaTrialChambers() { + } + + private static void register(ResourceLocation resourceLocation, String string, String string2) { + try { + CompoundTag compoundTag = parse(string); + CompoundTag compoundTag2 = parse(string2); + CompoundTag compoundTag3 = compoundTag.copy().merge(compoundTag2); + CompoundTag compoundTag4 = removeDefaults(compoundTag3.copy()); + Dynamic dynamic = asDynamic(compoundTag); + CONFIGS_TO_KEY.put(Pair.of(dynamic, asDynamic(compoundTag2)), resourceLocation); + CONFIGS_TO_KEY.put(Pair.of(dynamic, asDynamic(compoundTag3)), resourceLocation); + CONFIGS_TO_KEY.put(Pair.of(dynamic, asDynamic(compoundTag4)), resourceLocation); + } catch (RuntimeException var8) { + throw new IllegalStateException("Failed to parse NBT for " + resourceLocation, var8); + } + } + + private static Dynamic asDynamic(CompoundTag compoundTag) { + return new Dynamic<>(NbtOps.INSTANCE, compoundTag); + } + + private static CompoundTag parse(String string) { + try { + return TagParser.parseTag(string); + } catch (CommandSyntaxException var2) { + throw new IllegalArgumentException("Failed to parse Trial Spawner NBT config: " + string, var2); + } + } + + private static CompoundTag removeDefaults(CompoundTag compoundTag) { + if (compoundTag.getInt("spawn_range") == 4) { + compoundTag.remove("spawn_range"); + } + + if (compoundTag.getFloat("total_mobs") == 6.0F) { + compoundTag.remove("total_mobs"); + } + + if (compoundTag.getFloat("simultaneous_mobs") == 2.0F) { + compoundTag.remove("simultaneous_mobs"); + } + + if (compoundTag.getFloat("total_mobs_added_per_player") == 2.0F) { + compoundTag.remove("total_mobs_added_per_player"); + } + + if (compoundTag.getFloat("simultaneous_mobs_added_per_player") == 1.0F) { + compoundTag.remove("simultaneous_mobs_added_per_player"); + } + + if (compoundTag.getInt("ticks_between_spawn") == 40) { + compoundTag.remove("ticks_between_spawn"); + } + + return compoundTag; + } + + static { + register( + ResourceLocation.withDefaultNamespace("trial_chamber/breeze"), + "{simultaneous_mobs: 1.0f, simultaneous_mobs_added_per_player: 0.5f, spawn_potentials: [{data: {entity: {id: \"minecraft:breeze\"}}, weight: 1}], ticks_between_spawn: 20, total_mobs: 2.0f, total_mobs_added_per_player: 1.0f}", + "{loot_tables_to_eject: [{data: \"minecraft:spawners/ominous/trial_chamber/key\", weight: 3}, {data: \"minecraft:spawners/ominous/trial_chamber/consumables\", weight: 7}], simultaneous_mobs: 2.0f, total_mobs: 4.0f}" + ); + register( + ResourceLocation.withDefaultNamespace("trial_chamber/melee/husk"), + "{simultaneous_mobs: 3.0f, simultaneous_mobs_added_per_player: 0.5f, spawn_potentials: [{data: {entity: {id: \"minecraft:husk\"}}, weight: 1}], ticks_between_spawn: 20}", + "{loot_tables_to_eject: [{data: \"minecraft:spawners/ominous/trial_chamber/key\", weight: 3}, {data: \"minecraft:spawners/ominous/trial_chamber/consumables\", weight: 7}], spawn_potentials: [{data: {entity: {id: \"minecraft:husk\"}, equipment: {loot_table: \"minecraft:equipment/trial_chamber_melee\", slot_drop_chances: 0.0f}}, weight: 1}]}" + ); + register( + ResourceLocation.withDefaultNamespace("trial_chamber/melee/spider"), + "{simultaneous_mobs: 3.0f, simultaneous_mobs_added_per_player: 0.5f, spawn_potentials: [{data: {entity: {id: \"minecraft:spider\"}}, weight: 1}], ticks_between_spawn: 20}", + "{loot_tables_to_eject: [{data: \"minecraft:spawners/ominous/trial_chamber/key\", weight: 3}, {data: \"minecraft:spawners/ominous/trial_chamber/consumables\", weight: 7}],simultaneous_mobs: 4.0f, total_mobs: 12.0f}" + ); + register( + ResourceLocation.withDefaultNamespace("trial_chamber/melee/zombie"), + "{simultaneous_mobs: 3.0f, simultaneous_mobs_added_per_player: 0.5f, spawn_potentials: [{data: {entity: {id: \"minecraft:zombie\"}}, weight: 1}], ticks_between_spawn: 20}", + "{loot_tables_to_eject: [{data: \"minecraft:spawners/ominous/trial_chamber/key\", weight: 3}, {data: \"minecraft:spawners/ominous/trial_chamber/consumables\", weight: 7}],spawn_potentials: [{data: {entity: {id: \"minecraft:zombie\"}, equipment: {loot_table: \"minecraft:equipment/trial_chamber_melee\", slot_drop_chances: 0.0f}}, weight: 1}]}" + ); + register( + ResourceLocation.withDefaultNamespace("trial_chamber/ranged/poison_skeleton"), + "{simultaneous_mobs: 3.0f, simultaneous_mobs_added_per_player: 0.5f, spawn_potentials: [{data: {entity: {id: \"minecraft:bogged\"}}, weight: 1}], ticks_between_spawn: 20}", + "{loot_tables_to_eject: [{data: \"minecraft:spawners/ominous/trial_chamber/key\", weight: 3}, {data: \"minecraft:spawners/ominous/trial_chamber/consumables\", weight: 7}],spawn_potentials: [{data: {entity: {id: \"minecraft:bogged\"}, equipment: {loot_table: \"minecraft:equipment/trial_chamber_ranged\", slot_drop_chances: 0.0f}}, weight: 1}]}" + ); + register( + ResourceLocation.withDefaultNamespace("trial_chamber/ranged/skeleton"), + "{simultaneous_mobs: 3.0f, simultaneous_mobs_added_per_player: 0.5f, spawn_potentials: [{data: {entity: {id: \"minecraft:skeleton\"}}, weight: 1}], ticks_between_spawn: 20}", + "{loot_tables_to_eject: [{data: \"minecraft:spawners/ominous/trial_chamber/key\", weight: 3}, {data: \"minecraft:spawners/ominous/trial_chamber/consumables\", weight: 7}], spawn_potentials: [{data: {entity: {id: \"minecraft:skeleton\"}, equipment: {loot_table: \"minecraft:equipment/trial_chamber_ranged\", slot_drop_chances: 0.0f}}, weight: 1}]}" + ); + register( + ResourceLocation.withDefaultNamespace("trial_chamber/ranged/stray"), + "{simultaneous_mobs: 3.0f, simultaneous_mobs_added_per_player: 0.5f, spawn_potentials: [{data: {entity: {id: \"minecraft:stray\"}}, weight: 1}], ticks_between_spawn: 20}", + "{loot_tables_to_eject: [{data: \"minecraft:spawners/ominous/trial_chamber/key\", weight: 3}, {data: \"minecraft:spawners/ominous/trial_chamber/consumables\", weight: 7}], spawn_potentials: [{data: {entity: {id: \"minecraft:stray\"}, equipment: {loot_table: \"minecraft:equipment/trial_chamber_ranged\", slot_drop_chances: 0.0f}}, weight: 1}]}" + ); + register( + ResourceLocation.withDefaultNamespace("trial_chamber/slow_ranged/poison_skeleton"), + "{simultaneous_mobs: 4.0f, simultaneous_mobs_added_per_player: 2.0f, spawn_potentials: [{data: {entity: {id: \"minecraft:bogged\"}}, weight: 1}], ticks_between_spawn: 160}", + "{loot_tables_to_eject: [{data: \"minecraft:spawners/ominous/trial_chamber/key\", weight: 3}, {data: \"minecraft:spawners/ominous/trial_chamber/consumables\", weight: 7}], spawn_potentials: [{data: {entity: {id: \"minecraft:bogged\"}, equipment: {loot_table: \"minecraft:equipment/trial_chamber_ranged\", slot_drop_chances: 0.0f}}, weight: 1}]}" + ); + register( + ResourceLocation.withDefaultNamespace("trial_chamber/slow_ranged/skeleton"), + "{simultaneous_mobs: 4.0f, simultaneous_mobs_added_per_player: 2.0f, spawn_potentials: [{data: {entity: {id: \"minecraft:skeleton\"}}, weight: 1}], ticks_between_spawn: 160}", + "{loot_tables_to_eject: [{data: \"minecraft:spawners/ominous/trial_chamber/key\", weight: 3}, {data: \"minecraft:spawners/ominous/trial_chamber/consumables\", weight: 7}], spawn_potentials: [{data: {entity: {id: \"minecraft:skeleton\"}, equipment: {loot_table: \"minecraft:equipment/trial_chamber_ranged\", slot_drop_chances: 0.0f}}, weight: 1}]}" + ); + register( + ResourceLocation.withDefaultNamespace("trial_chamber/slow_ranged/stray"), + "{simultaneous_mobs: 4.0f, simultaneous_mobs_added_per_player: 2.0f, spawn_potentials: [{data: {entity: {id: \"minecraft:stray\"}}, weight: 1}], ticks_between_spawn: 160}", + "{loot_tables_to_eject: [{data: \"minecraft:spawners/ominous/trial_chamber/key\", weight: 3}, {data: \"minecraft:spawners/ominous/trial_chamber/consumables\", weight: 7}],spawn_potentials: [{data: {entity: {id: \"minecraft:stray\"}, equipment: {loot_table: \"minecraft:equipment/trial_chamber_ranged\", slot_drop_chances: 0.0f}}, weight: 1}]}" + ); + register( + ResourceLocation.withDefaultNamespace("trial_chamber/small_melee/baby_zombie"), + "{simultaneous_mobs: 2.0f, simultaneous_mobs_added_per_player: 0.5f, spawn_potentials: [{data: {entity: {IsBaby: 1b, id: \"minecraft:zombie\"}}, weight: 1}], ticks_between_spawn: 20}", + "{loot_tables_to_eject: [{data: \"minecraft:spawners/ominous/trial_chamber/key\", weight: 3}, {data: \"minecraft:spawners/ominous/trial_chamber/consumables\", weight: 7}], spawn_potentials: [{data: {entity: {IsBaby: 1b, id: \"minecraft:zombie\"}, equipment: {loot_table: \"minecraft:equipment/trial_chamber_melee\", slot_drop_chances: 0.0f}}, weight: 1}]}" + ); + register( + ResourceLocation.withDefaultNamespace("trial_chamber/small_melee/cave_spider"), + "{simultaneous_mobs: 3.0f, simultaneous_mobs_added_per_player: 0.5f, spawn_potentials: [{data: {entity: {id: \"minecraft:cave_spider\"}}, weight: 1}], ticks_between_spawn: 20}", + "{loot_tables_to_eject: [{data: \"minecraft:spawners/ominous/trial_chamber/key\", weight: 3}, {data: \"minecraft:spawners/ominous/trial_chamber/consumables\", weight: 7}], simultaneous_mobs: 4.0f, total_mobs: 12.0f}" + ); + register( + ResourceLocation.withDefaultNamespace("trial_chamber/small_melee/silverfish"), + "{simultaneous_mobs: 3.0f, simultaneous_mobs_added_per_player: 0.5f, spawn_potentials: [{data: {entity: {id: \"minecraft:silverfish\"}}, weight: 1}], ticks_between_spawn: 20}", + "{loot_tables_to_eject: [{data: \"minecraft:spawners/ominous/trial_chamber/key\", weight: 3}, {data: \"minecraft:spawners/ominous/trial_chamber/consumables\", weight: 7}], simultaneous_mobs: 4.0f, total_mobs: 12.0f}" + ); + register( + ResourceLocation.withDefaultNamespace("trial_chamber/small_melee/slime"), + "{simultaneous_mobs: 3.0f, simultaneous_mobs_added_per_player: 0.5f, spawn_potentials: [{data: {entity: {Size: 1, id: \"minecraft:slime\"}}, weight: 3}, {data: {entity: {Size: 2, id: \"minecraft:slime\"}}, weight: 1}], ticks_between_spawn: 20}", + "{loot_tables_to_eject: [{data: \"minecraft:spawners/ominous/trial_chamber/key\", weight: 3}, {data: \"minecraft:spawners/ominous/trial_chamber/consumables\", weight: 7}], simultaneous_mobs: 4.0f, total_mobs: 12.0f}" + ); + } + } +} diff --git a/net/minecraft/util/datafix/fixes/VillagerSetCanPickUpLootFix.java b/net/minecraft/util/datafix/fixes/VillagerSetCanPickUpLootFix.java new file mode 100644 index 00000000..1b38175b --- /dev/null +++ b/net/minecraft/util/datafix/fixes/VillagerSetCanPickUpLootFix.java @@ -0,0 +1,23 @@ +package net.minecraft.util.datafix.fixes; + +import com.mojang.datafixers.DSL; +import com.mojang.datafixers.Typed; +import com.mojang.datafixers.schemas.Schema; +import com.mojang.serialization.Dynamic; + +public class VillagerSetCanPickUpLootFix extends NamedEntityFix { + private static final String CAN_PICK_UP_LOOT = "CanPickUpLoot"; + + public VillagerSetCanPickUpLootFix(Schema schema) { + super(schema, true, "Villager CanPickUpLoot default value", References.ENTITY, "Villager"); + } + + @Override + protected Typed fix(Typed typed) { + return typed.update(DSL.remainderFinder(), VillagerSetCanPickUpLootFix::fixValue); + } + + private static Dynamic fixValue(Dynamic dynamic) { + return dynamic.set("CanPickUpLoot", dynamic.createBoolean(true)); + } +} diff --git a/net/minecraft/util/datafix/schemas/V1022.java b/net/minecraft/util/datafix/schemas/V1022.java index 30f01f63..fdfdaad1 100644 --- a/net/minecraft/util/datafix/schemas/V1022.java +++ b/net/minecraft/util/datafix/schemas/V1022.java @@ -22,6 +22,7 @@ public class V1022 extends Schema { References.PLAYER, () -> DSL.optionalFields( Pair.of("RootVehicle", DSL.optionalFields("Entity", References.ENTITY_TREE.in(schema))), + Pair.of("ender_pearls", DSL.list(References.ENTITY_TREE.in(schema))), Pair.of("Inventory", DSL.list(References.ITEM_STACK.in(schema))), Pair.of("EnderItems", DSL.list(References.ITEM_STACK.in(schema))), Pair.of("ShoulderEntityLeft", References.ENTITY_TREE.in(schema)), diff --git a/net/minecraft/util/datafix/schemas/V135.java b/net/minecraft/util/datafix/schemas/V135.java index 130035ec..72e957bd 100644 --- a/net/minecraft/util/datafix/schemas/V135.java +++ b/net/minecraft/util/datafix/schemas/V135.java @@ -21,6 +21,8 @@ public class V135 extends Schema { () -> DSL.optionalFields( "RootVehicle", DSL.optionalFields("Entity", References.ENTITY_TREE.in(schema)), + "ender_pearls", + DSL.list(References.ENTITY_TREE.in(schema)), "Inventory", DSL.list(References.ITEM_STACK.in(schema)), "EnderItems", diff --git a/net/minecraft/util/datafix/schemas/V1460.java b/net/minecraft/util/datafix/schemas/V1460.java index 4b9741ab..47f78ed1 100644 --- a/net/minecraft/util/datafix/schemas/V1460.java +++ b/net/minecraft/util/datafix/schemas/V1460.java @@ -244,6 +244,7 @@ public class V1460 extends NamespacedSchema { References.PLAYER, () -> DSL.optionalFields( Pair.of("RootVehicle", DSL.optionalFields("Entity", References.ENTITY_TREE.in(schema))), + Pair.of("ender_pearls", DSL.list(References.ENTITY_TREE.in(schema))), Pair.of("Inventory", DSL.list(References.ITEM_STACK.in(schema))), Pair.of("EnderItems", DSL.list(References.ITEM_STACK.in(schema))), Pair.of("ShoulderEntityLeft", References.ENTITY_TREE.in(schema)), diff --git a/net/minecraft/util/datafix/schemas/V3818_3.java b/net/minecraft/util/datafix/schemas/V3818_3.java index 1a3e74a7..3dad4792 100644 --- a/net/minecraft/util/datafix/schemas/V3818_3.java +++ b/net/minecraft/util/datafix/schemas/V3818_3.java @@ -3,8 +3,9 @@ package net.minecraft.util.datafix.schemas; import com.mojang.datafixers.DSL; import com.mojang.datafixers.schemas.Schema; import com.mojang.datafixers.types.templates.TypeTemplate; -import com.mojang.datafixers.util.Pair; +import java.util.LinkedHashMap; import java.util.Map; +import java.util.SequencedMap; import java.util.function.Supplier; import net.minecraft.util.datafix.fixes.References; @@ -13,34 +14,34 @@ public class V3818_3 extends NamespacedSchema { super(versionKey, parent); } + public static SequencedMap> components(Schema schema) { + SequencedMap> sequencedMap = new LinkedHashMap(); + sequencedMap.put("minecraft:bees", (Supplier)() -> DSL.list(DSL.optionalFields("entity_data", References.ENTITY_TREE.in(schema)))); + sequencedMap.put("minecraft:block_entity_data", (Supplier)() -> References.BLOCK_ENTITY.in(schema)); + sequencedMap.put("minecraft:bundle_contents", (Supplier)() -> DSL.list(References.ITEM_STACK.in(schema))); + sequencedMap.put( + "minecraft:can_break", + (Supplier)() -> DSL.optionalFields( + "predicates", DSL.list(DSL.optionalFields("blocks", DSL.or(References.BLOCK_NAME.in(schema), DSL.list(References.BLOCK_NAME.in(schema))))) + ) + ); + sequencedMap.put( + "minecraft:can_place_on", + (Supplier)() -> DSL.optionalFields( + "predicates", DSL.list(DSL.optionalFields("blocks", DSL.or(References.BLOCK_NAME.in(schema), DSL.list(References.BLOCK_NAME.in(schema))))) + ) + ); + sequencedMap.put("minecraft:charged_projectiles", (Supplier)() -> DSL.list(References.ITEM_STACK.in(schema))); + sequencedMap.put("minecraft:container", (Supplier)() -> DSL.list(DSL.optionalFields("item", References.ITEM_STACK.in(schema)))); + sequencedMap.put("minecraft:entity_data", (Supplier)() -> References.ENTITY_TREE.in(schema)); + sequencedMap.put("minecraft:pot_decorations", (Supplier)() -> DSL.list(References.ITEM_NAME.in(schema))); + sequencedMap.put("minecraft:food", (Supplier)() -> DSL.optionalFields("using_converts_to", References.ITEM_STACK.in(schema))); + return sequencedMap; + } + @Override public void registerTypes(Schema schema, Map> map, Map> map2) { super.registerTypes(schema, map, map2); - schema.registerType( - true, - References.DATA_COMPONENTS, - () -> DSL.optionalFields( - Pair.of("minecraft:bees", DSL.list(DSL.optionalFields("entity_data", References.ENTITY_TREE.in(schema)))), - Pair.of("minecraft:block_entity_data", References.BLOCK_ENTITY.in(schema)), - Pair.of("minecraft:bundle_contents", DSL.list(References.ITEM_STACK.in(schema))), - Pair.of( - "minecraft:can_break", - DSL.optionalFields( - "predicates", DSL.list(DSL.optionalFields("blocks", DSL.or(References.BLOCK_NAME.in(schema), DSL.list(References.BLOCK_NAME.in(schema))))) - ) - ), - Pair.of( - "minecraft:can_place_on", - DSL.optionalFields( - "predicates", DSL.list(DSL.optionalFields("blocks", DSL.or(References.BLOCK_NAME.in(schema), DSL.list(References.BLOCK_NAME.in(schema))))) - ) - ), - Pair.of("minecraft:charged_projectiles", DSL.list(References.ITEM_STACK.in(schema))), - Pair.of("minecraft:container", DSL.list(DSL.optionalFields("item", References.ITEM_STACK.in(schema)))), - Pair.of("minecraft:entity_data", References.ENTITY_TREE.in(schema)), - Pair.of("minecraft:pot_decorations", DSL.list(References.ITEM_NAME.in(schema))), - Pair.of("minecraft:food", DSL.optionalFields("using_converts_to", References.ITEM_STACK.in(schema))) - ) - ); + schema.registerType(true, References.DATA_COMPONENTS, () -> DSL.optionalFieldsLazy(components(schema))); } } diff --git a/net/minecraft/util/datafix/schemas/V4059.java b/net/minecraft/util/datafix/schemas/V4059.java new file mode 100644 index 00000000..8a8a612e --- /dev/null +++ b/net/minecraft/util/datafix/schemas/V4059.java @@ -0,0 +1,32 @@ +package net.minecraft.util.datafix.schemas; + +import com.mojang.datafixers.DSL; +import com.mojang.datafixers.schemas.Schema; +import com.mojang.datafixers.types.templates.TypeTemplate; +import java.util.Map; +import java.util.SequencedMap; +import java.util.function.Supplier; +import net.minecraft.util.datafix.fixes.References; + +public class V4059 extends NamespacedSchema { + public V4059(int i, Schema schema) { + super(i, schema); + } + + public static SequencedMap> components(Schema schema) { + SequencedMap> sequencedMap = V3818_3.components(schema); + sequencedMap.remove("minecraft:food"); + sequencedMap.put("minecraft:use_remainder", (Supplier)() -> References.ITEM_STACK.in(schema)); + sequencedMap.put( + "minecraft:equippable", + (Supplier)() -> DSL.optionalFields("allowed_entities", DSL.or(References.ENTITY_NAME.in(schema), DSL.list(References.ENTITY_NAME.in(schema)))) + ); + return sequencedMap; + } + + @Override + public void registerTypes(Schema schema, Map> map, Map> map2) { + super.registerTypes(schema, map, map2); + schema.registerType(true, References.DATA_COMPONENTS, () -> DSL.optionalFieldsLazy(components(schema))); + } +} diff --git a/net/minecraft/util/datafix/schemas/V4067.java b/net/minecraft/util/datafix/schemas/V4067.java new file mode 100644 index 00000000..0ceca95c --- /dev/null +++ b/net/minecraft/util/datafix/schemas/V4067.java @@ -0,0 +1,44 @@ +package net.minecraft.util.datafix.schemas; + +import com.mojang.datafixers.DSL; +import com.mojang.datafixers.schemas.Schema; +import com.mojang.datafixers.types.templates.TypeTemplate; +import java.util.Map; +import java.util.function.Supplier; +import net.minecraft.util.datafix.fixes.References; + +public class V4067 extends NamespacedSchema { + public V4067(int i, Schema schema) { + super(i, schema); + } + + @Override + public Map> registerEntities(Schema schema) { + Map> map = super.registerEntities(schema); + map.remove("minecraft:boat"); + map.remove("minecraft:chest_boat"); + this.registerSimple(map, "minecraft:oak_boat"); + this.registerSimple(map, "minecraft:spruce_boat"); + this.registerSimple(map, "minecraft:birch_boat"); + this.registerSimple(map, "minecraft:jungle_boat"); + this.registerSimple(map, "minecraft:acacia_boat"); + this.registerSimple(map, "minecraft:cherry_boat"); + this.registerSimple(map, "minecraft:dark_oak_boat"); + this.registerSimple(map, "minecraft:mangrove_boat"); + this.registerSimple(map, "minecraft:bamboo_raft"); + this.registerChestBoat(map, "minecraft:oak_chest_boat"); + this.registerChestBoat(map, "minecraft:spruce_chest_boat"); + this.registerChestBoat(map, "minecraft:birch_chest_boat"); + this.registerChestBoat(map, "minecraft:jungle_chest_boat"); + this.registerChestBoat(map, "minecraft:acacia_chest_boat"); + this.registerChestBoat(map, "minecraft:cherry_chest_boat"); + this.registerChestBoat(map, "minecraft:dark_oak_chest_boat"); + this.registerChestBoat(map, "minecraft:mangrove_chest_boat"); + this.registerChestBoat(map, "minecraft:bamboo_chest_raft"); + return map; + } + + private void registerChestBoat(Map> map, String string) { + this.register(map, string, stringx -> DSL.optionalFields("Items", DSL.list(References.ITEM_STACK.in(this)))); + } +} diff --git a/net/minecraft/util/datafix/schemas/V4070.java b/net/minecraft/util/datafix/schemas/V4070.java new file mode 100644 index 00000000..34d28bf4 --- /dev/null +++ b/net/minecraft/util/datafix/schemas/V4070.java @@ -0,0 +1,25 @@ +package net.minecraft.util.datafix.schemas; + +import com.mojang.datafixers.DSL; +import com.mojang.datafixers.schemas.Schema; +import com.mojang.datafixers.types.templates.TypeTemplate; +import java.util.Map; +import java.util.function.Function; +import java.util.function.Supplier; +import net.minecraft.util.datafix.fixes.References; + +public class V4070 extends NamespacedSchema { + public V4070(int i, Schema schema) { + super(i, schema); + } + + @Override + public Map> registerEntities(Schema schema) { + Map> map = super.registerEntities(schema); + schema.registerSimple(map, "minecraft:pale_oak_boat"); + schema.register( + map, "minecraft:pale_oak_chest_boat", (Function)(string -> DSL.optionalFields("Items", DSL.list(References.ITEM_STACK.in(schema)))) + ); + return map; + } +} diff --git a/net/minecraft/util/datafix/schemas/V4071.java b/net/minecraft/util/datafix/schemas/V4071.java new file mode 100644 index 00000000..5cc23bec --- /dev/null +++ b/net/minecraft/util/datafix/schemas/V4071.java @@ -0,0 +1,28 @@ +package net.minecraft.util.datafix.schemas; + +import com.mojang.datafixers.DSL; +import com.mojang.datafixers.schemas.Schema; +import com.mojang.datafixers.types.templates.TypeTemplate; +import java.util.Map; +import java.util.function.Supplier; + +public class V4071 extends NamespacedSchema { + public V4071(int i, Schema schema) { + super(i, schema); + } + + @Override + public Map> registerEntities(Schema schema) { + Map> map = super.registerEntities(schema); + schema.register(map, "minecraft:creaking", (Supplier)(() -> V100.equipment(schema))); + schema.register(map, "minecraft:creaking_transient", (Supplier)(() -> V100.equipment(schema))); + return map; + } + + @Override + public Map> registerBlockEntities(Schema schema) { + Map> map = super.registerBlockEntities(schema); + schema.register(map, "minecraft:creaking_heart", (Supplier)(() -> DSL.optionalFields())); + return map; + } +} diff --git a/net/minecraft/util/datafix/schemas/V705.java b/net/minecraft/util/datafix/schemas/V705.java index 728f58b1..0f3f162b 100644 --- a/net/minecraft/util/datafix/schemas/V705.java +++ b/net/minecraft/util/datafix/schemas/V705.java @@ -99,25 +99,25 @@ public class V705 extends NamespacedSchema { .put("minecraft:zombie_villager_spawn_egg", "minecraft:zombie_villager") .put("minecraft:zombified_piglin_spawn_egg", "minecraft:zombified_piglin") .put("minecraft:item_frame", "minecraft:item_frame") - .put("minecraft:boat", "minecraft:boat") - .put("minecraft:oak_boat", "minecraft:boat") - .put("minecraft:oak_chest_boat", "minecraft:chest_boat") - .put("minecraft:spruce_boat", "minecraft:boat") - .put("minecraft:spruce_chest_boat", "minecraft:chest_boat") - .put("minecraft:birch_boat", "minecraft:boat") - .put("minecraft:birch_chest_boat", "minecraft:chest_boat") - .put("minecraft:jungle_boat", "minecraft:boat") - .put("minecraft:jungle_chest_boat", "minecraft:chest_boat") - .put("minecraft:acacia_boat", "minecraft:boat") - .put("minecraft:acacia_chest_boat", "minecraft:chest_boat") - .put("minecraft:cherry_boat", "minecraft:boat") - .put("minecraft:cherry_chest_boat", "minecraft:chest_boat") - .put("minecraft:dark_oak_boat", "minecraft:boat") - .put("minecraft:dark_oak_chest_boat", "minecraft:chest_boat") - .put("minecraft:mangrove_boat", "minecraft:boat") - .put("minecraft:mangrove_chest_boat", "minecraft:chest_boat") - .put("minecraft:bamboo_raft", "minecraft:boat") - .put("minecraft:bamboo_chest_raft", "minecraft:chest_boat") + .put("minecraft:boat", "minecraft:oak_boat") + .put("minecraft:oak_boat", "minecraft:oak_boat") + .put("minecraft:oak_chest_boat", "minecraft:oak_chest_boat") + .put("minecraft:spruce_boat", "minecraft:spruce_boat") + .put("minecraft:spruce_chest_boat", "minecraft:spruce_chest_boat") + .put("minecraft:birch_boat", "minecraft:birch_boat") + .put("minecraft:birch_chest_boat", "minecraft:birch_chest_boat") + .put("minecraft:jungle_boat", "minecraft:jungle_boat") + .put("minecraft:jungle_chest_boat", "minecraft:jungle_chest_boat") + .put("minecraft:acacia_boat", "minecraft:acacia_boat") + .put("minecraft:acacia_chest_boat", "minecraft:acacia_chest_boat") + .put("minecraft:cherry_boat", "minecraft:cherry_boat") + .put("minecraft:cherry_chest_boat", "minecraft:cherry_chest_boat") + .put("minecraft:dark_oak_boat", "minecraft:dark_oak_boat") + .put("minecraft:dark_oak_chest_boat", "minecraft:dark_oak_chest_boat") + .put("minecraft:mangrove_boat", "minecraft:mangrove_boat") + .put("minecraft:mangrove_chest_boat", "minecraft:mangrove_chest_boat") + .put("minecraft:bamboo_raft", "minecraft:bamboo_raft") + .put("minecraft:bamboo_chest_raft", "minecraft:bamboo_chest_raft") .put("minecraft:minecart", "minecraft:minecart") .put("minecraft:chest_minecart", "minecraft:chest_minecart") .put("minecraft:furnace_minecart", "minecraft:furnace_minecart") diff --git a/net/minecraft/util/debugchart/package-info.java b/net/minecraft/util/debugchart/package-info.java new file mode 100644 index 00000000..097a58d8 --- /dev/null +++ b/net/minecraft/util/debugchart/package-info.java @@ -0,0 +1,8 @@ +@ParametersAreNonnullByDefault +@MethodsReturnNonnullByDefault +@FieldsAreNonnullByDefault +package net.minecraft.util.debugchart; + +import javax.annotation.ParametersAreNonnullByDefault; +import net.minecraft.FieldsAreNonnullByDefault; +import net.minecraft.MethodsReturnNonnullByDefault; diff --git a/net/minecraft/util/profiling/InactiveProfiler.java b/net/minecraft/util/profiling/InactiveProfiler.java index bcab417b..70c074bc 100644 --- a/net/minecraft/util/profiling/InactiveProfiler.java +++ b/net/minecraft/util/profiling/InactiveProfiler.java @@ -3,6 +3,7 @@ package net.minecraft.util.profiling; import com.google.common.collect.ImmutableSet; import java.util.Set; import java.util.function.Supplier; +import net.minecraft.util.profiling.ActiveProfiler.PathEntry; import net.minecraft.util.profiling.metrics.MetricCategory; import org.apache.commons.lang3.tuple.Pair; import org.jetbrains.annotations.Nullable; @@ -45,6 +46,16 @@ public class InactiveProfiler implements ProfileCollector { public void popPush(Supplier nameSupplier) { } + @Override + public Zone zone(String string) { + return Zone.INACTIVE; + } + + @Override + public Zone zone(Supplier supplier) { + return Zone.INACTIVE; + } + @Override public void incrementCounter(String counterName, int increment) { } @@ -60,7 +71,7 @@ public class InactiveProfiler implements ProfileCollector { @Nullable @Override - public ActiveProfiler.PathEntry getEntry(String entryId) { + public PathEntry getEntry(String entryId) { return null; } diff --git a/net/minecraft/util/profiling/ProfileCollector.java b/net/minecraft/util/profiling/ProfileCollector.java index 0298df00..ba0e5e25 100644 --- a/net/minecraft/util/profiling/ProfileCollector.java +++ b/net/minecraft/util/profiling/ProfileCollector.java @@ -1,6 +1,7 @@ package net.minecraft.util.profiling; import java.util.Set; +import net.minecraft.util.profiling.ActiveProfiler.PathEntry; import net.minecraft.util.profiling.metrics.MetricCategory; import org.apache.commons.lang3.tuple.Pair; import org.jetbrains.annotations.Nullable; @@ -9,7 +10,7 @@ public interface ProfileCollector extends ProfilerFiller { ProfileResults getResults(); @Nullable - ActiveProfiler.PathEntry getEntry(String entryId); + PathEntry getEntry(String entryId); Set> getChartedPaths(); } diff --git a/net/minecraft/util/profiling/Profiler.java b/net/minecraft/util/profiling/Profiler.java new file mode 100644 index 00000000..5056d733 --- /dev/null +++ b/net/minecraft/util/profiling/Profiler.java @@ -0,0 +1,57 @@ +package net.minecraft.util.profiling; + +import com.mojang.jtracy.TracyClient; +import java.util.Objects; +import java.util.concurrent.atomic.AtomicInteger; + +public final class Profiler { + private static final ThreadLocal TRACY_FILLER = ThreadLocal.withInitial(TracyZoneFiller::new); + private static final ThreadLocal ACTIVE = new ThreadLocal(); + private static final AtomicInteger ACTIVE_COUNT = new AtomicInteger(); + + private Profiler() { + } + + public static Profiler.Scope use(ProfilerFiller profilerFiller) { + startUsing(profilerFiller); + return Profiler::stopUsing; + } + + private static void startUsing(ProfilerFiller profilerFiller) { + if (ACTIVE.get() != null) { + throw new IllegalStateException("Profiler is already active"); + } else { + ProfilerFiller profilerFiller2 = decorateFiller(profilerFiller); + ACTIVE.set(profilerFiller2); + ACTIVE_COUNT.incrementAndGet(); + profilerFiller2.startTick(); + } + } + + private static void stopUsing() { + ProfilerFiller profilerFiller = (ProfilerFiller)ACTIVE.get(); + if (profilerFiller == null) { + throw new IllegalStateException("Profiler was not active"); + } else { + ACTIVE.remove(); + ACTIVE_COUNT.decrementAndGet(); + profilerFiller.endTick(); + } + } + + private static ProfilerFiller decorateFiller(ProfilerFiller profilerFiller) { + return ProfilerFiller.combine(getDefaultFiller(), profilerFiller); + } + + public static ProfilerFiller get() { + return ACTIVE_COUNT.get() == 0 ? getDefaultFiller() : (ProfilerFiller)Objects.requireNonNullElseGet((ProfilerFiller)ACTIVE.get(), Profiler::getDefaultFiller); + } + + private static ProfilerFiller getDefaultFiller() { + return (ProfilerFiller)(TracyClient.isAvailable() ? (ProfilerFiller)TRACY_FILLER.get() : InactiveProfiler.INSTANCE); + } + + public interface Scope extends AutoCloseable { + void close(); + } +} diff --git a/net/minecraft/util/profiling/ProfilerFiller.java b/net/minecraft/util/profiling/ProfilerFiller.java index e7a06bfc..78b525f3 100644 --- a/net/minecraft/util/profiling/ProfilerFiller.java +++ b/net/minecraft/util/profiling/ProfilerFiller.java @@ -26,6 +26,25 @@ public interface ProfilerFiller { void popPush(Supplier nameSupplier); + default void addZoneText(String string) { + } + + default void addZoneValue(long l) { + } + + default void setZoneColor(int i) { + } + + default Zone zone(String string) { + this.push(string); + return new Zone(this); + } + + default Zone zone(Supplier supplier) { + this.push(supplier); + return new Zone(this); + } + void markForCharting(MetricCategory category); default void incrementCounter(String entryId) { @@ -40,71 +59,101 @@ public interface ProfilerFiller { void incrementCounter(Supplier counterNameSupplier, int increment); - static ProfilerFiller tee(ProfilerFiller first, ProfilerFiller second) { - if (first == InactiveProfiler.INSTANCE) { - return second; + static ProfilerFiller combine(ProfilerFiller profilerFiller, ProfilerFiller profilerFiller2) { + if (profilerFiller == InactiveProfiler.INSTANCE) { + return profilerFiller2; } else { - return second == InactiveProfiler.INSTANCE ? first : new ProfilerFiller() { - @Override - public void startTick() { - first.startTick(); - second.startTick(); - } + return (ProfilerFiller)(profilerFiller2 == InactiveProfiler.INSTANCE + ? profilerFiller + : new ProfilerFiller.CombinedProfileFiller(profilerFiller, profilerFiller2)); + } + } - @Override - public void endTick() { - first.endTick(); - second.endTick(); - } + public static class CombinedProfileFiller implements ProfilerFiller { + private final ProfilerFiller first; + private final ProfilerFiller second; - @Override - public void push(String name) { - first.push(name); - second.push(name); - } + public CombinedProfileFiller(ProfilerFiller profilerFiller, ProfilerFiller profilerFiller2) { + this.first = profilerFiller; + this.second = profilerFiller2; + } - @Override - public void push(Supplier nameSupplier) { - first.push(nameSupplier); - second.push(nameSupplier); - } + @Override + public void startTick() { + this.first.startTick(); + this.second.startTick(); + } - @Override - public void markForCharting(MetricCategory category) { - first.markForCharting(category); - second.markForCharting(category); - } + @Override + public void endTick() { + this.first.endTick(); + this.second.endTick(); + } - @Override - public void pop() { - first.pop(); - second.pop(); - } + @Override + public void push(String name) { + this.first.push(name); + this.second.push(name); + } - @Override - public void popPush(String name) { - first.popPush(name); - second.popPush(name); - } + @Override + public void push(Supplier nameSupplier) { + this.first.push(nameSupplier); + this.second.push(nameSupplier); + } - @Override - public void popPush(Supplier nameSupplier) { - first.popPush(nameSupplier); - second.popPush(nameSupplier); - } + @Override + public void markForCharting(MetricCategory category) { + this.first.markForCharting(category); + this.second.markForCharting(category); + } - @Override - public void incrementCounter(String counterName, int increment) { - first.incrementCounter(counterName, increment); - second.incrementCounter(counterName, increment); - } + @Override + public void pop() { + this.first.pop(); + this.second.pop(); + } - @Override - public void incrementCounter(Supplier counterNameSupplier, int increment) { - first.incrementCounter(counterNameSupplier, increment); - second.incrementCounter(counterNameSupplier, increment); - } - }; + @Override + public void popPush(String name) { + this.first.popPush(name); + this.second.popPush(name); + } + + @Override + public void popPush(Supplier nameSupplier) { + this.first.popPush(nameSupplier); + this.second.popPush(nameSupplier); + } + + @Override + public void incrementCounter(String counterName, int increment) { + this.first.incrementCounter(counterName, increment); + this.second.incrementCounter(counterName, increment); + } + + @Override + public void incrementCounter(Supplier counterNameSupplier, int increment) { + this.first.incrementCounter(counterNameSupplier, increment); + this.second.incrementCounter(counterNameSupplier, increment); + } + + @Override + public void addZoneText(String string) { + this.first.addZoneText(string); + this.second.addZoneText(string); + } + + @Override + public void addZoneValue(long l) { + this.first.addZoneValue(l); + this.second.addZoneValue(l); + } + + @Override + public void setZoneColor(int i) { + this.first.setZoneColor(i); + this.second.setZoneColor(i); } } } diff --git a/net/minecraft/util/profiling/SingleTickProfiler.java b/net/minecraft/util/profiling/SingleTickProfiler.java index f480857e..f926179a 100644 --- a/net/minecraft/util/profiling/SingleTickProfiler.java +++ b/net/minecraft/util/profiling/SingleTickProfiler.java @@ -45,6 +45,6 @@ public class SingleTickProfiler { } public static ProfilerFiller decorateFiller(ProfilerFiller profiler, @Nullable SingleTickProfiler singleTickProfiler) { - return singleTickProfiler != null ? ProfilerFiller.tee(singleTickProfiler.startTick(), profiler) : profiler; + return singleTickProfiler != null ? ProfilerFiller.combine(singleTickProfiler.startTick(), profiler) : profiler; } } diff --git a/net/minecraft/util/profiling/TracyZoneFiller.java b/net/minecraft/util/profiling/TracyZoneFiller.java new file mode 100644 index 00000000..9f755129 --- /dev/null +++ b/net/minecraft/util/profiling/TracyZoneFiller.java @@ -0,0 +1,140 @@ +package net.minecraft.util.profiling; + +import com.mojang.jtracy.Plot; +import com.mojang.jtracy.TracyClient; +import com.mojang.logging.LogUtils; +import java.lang.StackWalker.Option; +import java.lang.StackWalker.StackFrame; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import java.util.function.Supplier; +import net.minecraft.SharedConstants; +import net.minecraft.util.profiling.metrics.MetricCategory; +import org.slf4j.Logger; + +public class TracyZoneFiller implements ProfilerFiller { + private static final Logger LOGGER = LogUtils.getLogger(); + private static final StackWalker STACK_WALKER = StackWalker.getInstance(Set.of(Option.RETAIN_CLASS_REFERENCE), 5); + private final List activeZones = new ArrayList(); + private final Map plots = new HashMap(); + private final String name = Thread.currentThread().getName(); + + @Override + public void startTick() { + } + + @Override + public void endTick() { + for (TracyZoneFiller.PlotAndValue plotAndValue : this.plots.values()) { + plotAndValue.set(0); + } + } + + @Override + public void push(String name) { + String string = ""; + String string2 = ""; + int i = 0; + if (SharedConstants.IS_RUNNING_IN_IDE) { + Optional optional = (Optional)STACK_WALKER.walk( + stream -> stream.filter( + stackFramex -> stackFramex.getDeclaringClass() != TracyZoneFiller.class && stackFramex.getDeclaringClass() != ProfilerFiller.CombinedProfileFiller.class + ) + .findFirst() + ); + if (optional.isPresent()) { + StackFrame stackFrame = (StackFrame)optional.get(); + string = stackFrame.getMethodName(); + string2 = stackFrame.getFileName(); + i = stackFrame.getLineNumber(); + } + } + + com.mojang.jtracy.Zone zone = TracyClient.beginZone(name, string, string2, i); + this.activeZones.add(zone); + } + + @Override + public void push(Supplier nameSupplier) { + this.push((String)nameSupplier.get()); + } + + @Override + public void pop() { + if (this.activeZones.isEmpty()) { + LOGGER.error("Tried to pop one too many times! Mismatched push() and pop()?"); + } else { + com.mojang.jtracy.Zone zone = (com.mojang.jtracy.Zone)this.activeZones.removeLast(); + zone.close(); + } + } + + @Override + public void popPush(String name) { + this.pop(); + this.push(name); + } + + @Override + public void popPush(Supplier nameSupplier) { + this.pop(); + this.push((String)nameSupplier.get()); + } + + @Override + public void markForCharting(MetricCategory category) { + } + + @Override + public void incrementCounter(String counterName, int increment) { + ((TracyZoneFiller.PlotAndValue)this.plots.computeIfAbsent(counterName, string2 -> new TracyZoneFiller.PlotAndValue(this.name + " " + counterName))) + .add(increment); + } + + @Override + public void incrementCounter(Supplier counterNameSupplier, int increment) { + this.incrementCounter((String)counterNameSupplier.get(), increment); + } + + private com.mojang.jtracy.Zone activeZone() { + return (com.mojang.jtracy.Zone)this.activeZones.getLast(); + } + + @Override + public void addZoneText(String string) { + this.activeZone().addText(string); + } + + @Override + public void addZoneValue(long l) { + this.activeZone().addValue(l); + } + + @Override + public void setZoneColor(int i) { + this.activeZone().setColor(i); + } + + static final class PlotAndValue { + private final Plot plot; + private int value; + + PlotAndValue(String string) { + this.plot = TracyClient.createPlot(string); + this.value = 0; + } + + void set(int i) { + this.value = i; + this.plot.setValue(i); + } + + void add(int i) { + this.set(this.value + i); + } + } +} diff --git a/net/minecraft/util/profiling/Zone.java b/net/minecraft/util/profiling/Zone.java new file mode 100644 index 00000000..4d9089e1 --- /dev/null +++ b/net/minecraft/util/profiling/Zone.java @@ -0,0 +1,52 @@ +package net.minecraft.util.profiling; + +import java.util.function.Supplier; +import org.jetbrains.annotations.Nullable; + +public class Zone implements AutoCloseable { + public static final Zone INACTIVE = new Zone(null); + @Nullable + private final ProfilerFiller profiler; + + Zone(@Nullable ProfilerFiller profilerFiller) { + this.profiler = profilerFiller; + } + + public Zone addText(String string) { + if (this.profiler != null) { + this.profiler.addZoneText(string); + } + + return this; + } + + public Zone addText(Supplier supplier) { + if (this.profiler != null) { + this.profiler.addZoneText((String)supplier.get()); + } + + return this; + } + + public Zone addValue(long l) { + if (this.profiler != null) { + this.profiler.addZoneValue(l); + } + + return this; + } + + public Zone setColor(int i) { + if (this.profiler != null) { + this.profiler.setZoneColor(i); + } + + return this; + } + + public void close() { + if (this.profiler != null) { + this.profiler.pop(); + } + } +} diff --git a/net/minecraft/util/profiling/jfr/event/ChunkGenerationEvent.java b/net/minecraft/util/profiling/jfr/event/ChunkGenerationEvent.java index 2778ddd3..ac926386 100644 --- a/net/minecraft/util/profiling/jfr/event/ChunkGenerationEvent.java +++ b/net/minecraft/util/profiling/jfr/event/ChunkGenerationEvent.java @@ -42,7 +42,7 @@ public class ChunkGenerationEvent extends Event { public ChunkGenerationEvent(ChunkPos chunkPos, ResourceKey resourceKey, String string) { this.targetStatus = string; - this.level = resourceKey.toString(); + this.level = resourceKey.location().toString(); this.chunkPosX = chunkPos.x; this.chunkPosZ = chunkPos.z; this.worldPosX = chunkPos.getMinBlockX(); diff --git a/net/minecraft/util/profiling/metrics/MetricCategory.java b/net/minecraft/util/profiling/metrics/MetricCategory.java index c4f0c0f3..9f20053b 100644 --- a/net/minecraft/util/profiling/metrics/MetricCategory.java +++ b/net/minecraft/util/profiling/metrics/MetricCategory.java @@ -3,7 +3,7 @@ package net.minecraft.util.profiling.metrics; public enum MetricCategory { PATH_FINDING("pathfinding"), EVENT_LOOPS("event-loops"), - MAIL_BOXES("mailboxes"), + CONSECUTIVE_EXECUTORS("consecutive-executors"), TICK_LOOP("ticking"), JVM("jvm"), CHUNK_RENDERING("chunk rendering"), diff --git a/net/minecraft/util/profiling/metrics/profiling/ActiveMetricsRecorder.java b/net/minecraft/util/profiling/metrics/profiling/ActiveMetricsRecorder.java index 3dd4b077..229e7a22 100644 --- a/net/minecraft/util/profiling/metrics/profiling/ActiveMetricsRecorder.java +++ b/net/minecraft/util/profiling/metrics/profiling/ActiveMetricsRecorder.java @@ -135,7 +135,7 @@ public class ActiveMetricsRecorder implements MetricsRecorder { @Override public ProfilerFiller getProfiler() { - return ProfilerFiller.tee(this.taskProfiler.getFiller(), this.singleTickProfiler); + return ProfilerFiller.combine(this.taskProfiler.getFiller(), this.singleTickProfiler); } private void verifyStarted() { diff --git a/net/minecraft/util/thread/AbstractConsecutiveExecutor.java b/net/minecraft/util/thread/AbstractConsecutiveExecutor.java new file mode 100644 index 00000000..9a6500ad --- /dev/null +++ b/net/minecraft/util/thread/AbstractConsecutiveExecutor.java @@ -0,0 +1,135 @@ +package net.minecraft.util.thread; + +import com.google.common.collect.ImmutableList; +import com.mojang.logging.LogUtils; +import java.util.List; +import java.util.concurrent.Executor; +import java.util.concurrent.RejectedExecutionException; +import java.util.concurrent.atomic.AtomicReference; +import net.minecraft.Util; +import net.minecraft.util.profiling.metrics.MetricCategory; +import net.minecraft.util.profiling.metrics.MetricSampler; +import net.minecraft.util.profiling.metrics.MetricsRegistry; +import net.minecraft.util.profiling.metrics.ProfilerMeasured; +import org.slf4j.Logger; + +public abstract class AbstractConsecutiveExecutor implements ProfilerMeasured, TaskScheduler, Runnable { + private static final Logger LOGGER = LogUtils.getLogger(); + private final AtomicReference status = new AtomicReference(AbstractConsecutiveExecutor.Status.SLEEPING); + private final StrictQueue queue; + private final Executor executor; + private final String name; + + public AbstractConsecutiveExecutor(StrictQueue strictQueue, Executor executor, String string) { + this.executor = executor; + this.queue = strictQueue; + this.name = string; + MetricsRegistry.INSTANCE.add(this); + } + + private boolean canBeScheduled() { + return !this.isClosed() && !this.queue.isEmpty(); + } + + @Override + public void close() { + this.status.set(AbstractConsecutiveExecutor.Status.CLOSED); + } + + private boolean pollTask() { + if (!this.isRunning()) { + return false; + } else { + Runnable runnable = this.queue.pop(); + if (runnable == null) { + return false; + } else { + Util.runNamed(runnable, this.name); + return true; + } + } + } + + public void run() { + try { + this.pollTask(); + } finally { + this.setSleeping(); + this.registerForExecution(); + } + } + + public void runAll() { + try { + while (this.pollTask()) { + } + } finally { + this.setSleeping(); + this.registerForExecution(); + } + } + + @Override + public void schedule(T runnable) { + this.queue.push(runnable); + this.registerForExecution(); + } + + private void registerForExecution() { + if (this.canBeScheduled() && this.setRunning()) { + try { + this.executor.execute(this); + } catch (RejectedExecutionException var4) { + try { + this.executor.execute(this); + } catch (RejectedExecutionException var3) { + LOGGER.error("Could not schedule ConsecutiveExecutor", (Throwable)var3); + } + } + } + } + + public int size() { + return this.queue.size(); + } + + public boolean hasWork() { + return this.isRunning() && !this.queue.isEmpty(); + } + + public String toString() { + return this.name + " " + this.status.get() + " " + this.queue.isEmpty(); + } + + @Override + public String name() { + return this.name; + } + + @Override + public List profiledMetrics() { + return ImmutableList.of(MetricSampler.create(this.name + "-queue-size", MetricCategory.CONSECUTIVE_EXECUTORS, this::size)); + } + + private boolean setRunning() { + return this.status.compareAndSet(AbstractConsecutiveExecutor.Status.SLEEPING, AbstractConsecutiveExecutor.Status.RUNNING); + } + + private void setSleeping() { + this.status.compareAndSet(AbstractConsecutiveExecutor.Status.RUNNING, AbstractConsecutiveExecutor.Status.SLEEPING); + } + + private boolean isRunning() { + return this.status.get() == AbstractConsecutiveExecutor.Status.RUNNING; + } + + private boolean isClosed() { + return this.status.get() == AbstractConsecutiveExecutor.Status.CLOSED; + } + + static enum Status { + SLEEPING, + RUNNING, + CLOSED; + } +} diff --git a/net/minecraft/util/thread/BlockableEventLoop.java b/net/minecraft/util/thread/BlockableEventLoop.java index 668c2661..cc91040b 100644 --- a/net/minecraft/util/thread/BlockableEventLoop.java +++ b/net/minecraft/util/thread/BlockableEventLoop.java @@ -2,6 +2,8 @@ package net.minecraft.util.thread; import com.google.common.collect.ImmutableList; import com.google.common.collect.Queues; +import com.mojang.jtracy.TracyClient; +import com.mojang.jtracy.Zone; import com.mojang.logging.LogUtils; import java.util.List; import java.util.Queue; @@ -11,13 +13,16 @@ import java.util.concurrent.locks.LockSupport; import java.util.function.BooleanSupplier; import java.util.function.Supplier; import javax.annotation.CheckReturnValue; +import net.minecraft.ReportedException; +import net.minecraft.SharedConstants; import net.minecraft.util.profiling.metrics.MetricCategory; import net.minecraft.util.profiling.metrics.MetricSampler; import net.minecraft.util.profiling.metrics.MetricsRegistry; import net.minecraft.util.profiling.metrics.ProfilerMeasured; import org.slf4j.Logger; -public abstract class BlockableEventLoop implements ProfilerMeasured, ProcessorHandle, Executor { +public abstract class BlockableEventLoop implements ProfilerMeasured, TaskScheduler, Executor { + public static final long BLOCK_TIME_NANOS = 100000L; private final String name; private static final Logger LOGGER = LogUtils.getLogger(); private final Queue pendingRunnables = Queues.newConcurrentLinkedQueue(); @@ -28,8 +33,6 @@ public abstract class BlockableEventLoop implements Profiler MetricsRegistry.INSTANCE.add(this); } - protected abstract R wrapRunnable(Runnable runnable); - protected abstract boolean shouldRun(R runnable); public boolean isSameThread() { @@ -80,14 +83,15 @@ public abstract class BlockableEventLoop implements Profiler } } - public void tell(R task) { - this.pendingRunnables.add(task); + @Override + public void schedule(R runnable) { + this.pendingRunnables.add(runnable); LockSupport.unpark(this.getRunningThread()); } public void execute(Runnable runnable) { if (this.scheduleExecutables()) { - this.tell(this.wrapRunnable(runnable)); + this.schedule(this.wrapRunnable(runnable)); } else { runnable.run(); } @@ -135,16 +139,19 @@ public abstract class BlockableEventLoop implements Profiler } } - public void waitForTasks() { + protected void waitForTasks() { Thread.yield(); LockSupport.parkNanos("waiting for tasks", 100000L); } protected void doRunTask(R task) { - try { + try (Zone zone = TracyClient.beginZone("Task", SharedConstants.IS_RUNNING_IN_IDE)) { task.run(); - } catch (Exception var3) { - LOGGER.error(LogUtils.FATAL_MARKER, "Error executing task on {}", this.name(), var3); + } catch (Exception var7) { + LOGGER.error(LogUtils.FATAL_MARKER, "Error executing task on {}", this.name(), var7); + if (isNonRecoverable(var7)) { + throw var7; + } } } @@ -152,4 +159,10 @@ public abstract class BlockableEventLoop implements Profiler public List profiledMetrics() { return ImmutableList.of(MetricSampler.create(this.name + "-pending-tasks", MetricCategory.EVENT_LOOPS, this::getPendingTasksCount)); } + + public static boolean isNonRecoverable(Throwable throwable) { + return throwable instanceof ReportedException reportedException + ? isNonRecoverable(reportedException.getCause()) + : throwable instanceof OutOfMemoryError || throwable instanceof StackOverflowError; + } } diff --git a/net/minecraft/util/thread/ConsecutiveExecutor.java b/net/minecraft/util/thread/ConsecutiveExecutor.java new file mode 100644 index 00000000..ebc49ee7 --- /dev/null +++ b/net/minecraft/util/thread/ConsecutiveExecutor.java @@ -0,0 +1,15 @@ +package net.minecraft.util.thread; + +import java.util.concurrent.ConcurrentLinkedQueue; +import java.util.concurrent.Executor; + +public class ConsecutiveExecutor extends AbstractConsecutiveExecutor { + public ConsecutiveExecutor(Executor executor, String string) { + super(new StrictQueue.QueueStrictQueue(new ConcurrentLinkedQueue()), executor, string); + } + + @Override + public Runnable wrapRunnable(Runnable runnable) { + return runnable; + } +} diff --git a/net/minecraft/util/thread/PriorityConsecutiveExecutor.java b/net/minecraft/util/thread/PriorityConsecutiveExecutor.java new file mode 100644 index 00000000..7f881dbe --- /dev/null +++ b/net/minecraft/util/thread/PriorityConsecutiveExecutor.java @@ -0,0 +1,23 @@ +package net.minecraft.util.thread; + +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.Executor; +import java.util.function.Consumer; +import net.minecraft.util.profiling.metrics.MetricsRegistry; + +public class PriorityConsecutiveExecutor extends AbstractConsecutiveExecutor { + public PriorityConsecutiveExecutor(int i, Executor executor, String string) { + super(new StrictQueue.FixedPriorityQueue(i), executor, string); + MetricsRegistry.INSTANCE.add(this); + } + + public StrictQueue.RunnableWithPriority wrapRunnable(Runnable runnable) { + return new StrictQueue.RunnableWithPriority(0, runnable); + } + + public CompletableFuture scheduleWithResult(int i, Consumer> consumer) { + CompletableFuture completableFuture = new CompletableFuture(); + this.schedule(new StrictQueue.RunnableWithPriority(i, () -> consumer.accept(completableFuture))); + return completableFuture; + } +} diff --git a/net/minecraft/util/thread/ProcessorHandle.java b/net/minecraft/util/thread/ProcessorHandle.java deleted file mode 100644 index 19a19da2..00000000 --- a/net/minecraft/util/thread/ProcessorHandle.java +++ /dev/null @@ -1,50 +0,0 @@ -package net.minecraft.util.thread; - -import com.mojang.datafixers.util.Either; -import java.util.concurrent.CompletableFuture; -import java.util.function.Consumer; -import java.util.function.Function; - -public interface ProcessorHandle extends AutoCloseable { - String name(); - - void tell(Msg task); - - default void close() { - } - - default CompletableFuture ask(Function, ? extends Msg> task) { - CompletableFuture completableFuture = new CompletableFuture(); - Msg object = (Msg)task.apply(of("ask future procesor handle", completableFuture::complete)); - this.tell(object); - return completableFuture; - } - - default CompletableFuture askEither(Function>, ? extends Msg> task) { - CompletableFuture completableFuture = new CompletableFuture(); - Msg object = (Msg)task.apply(of("ask future procesor handle", either -> { - either.ifLeft(completableFuture::complete); - either.ifRight(completableFuture::completeExceptionally); - })); - this.tell(object); - return completableFuture; - } - - static ProcessorHandle of(String name, Consumer task) { - return new ProcessorHandle() { - @Override - public String name() { - return name; - } - - @Override - public void tell(Msg task) { - task.accept(task); - } - - public String toString() { - return name; - } - }; - } -} diff --git a/net/minecraft/util/thread/ProcessorMailbox.java b/net/minecraft/util/thread/ProcessorMailbox.java deleted file mode 100644 index 7b48bb17..00000000 --- a/net/minecraft/util/thread/ProcessorMailbox.java +++ /dev/null @@ -1,156 +0,0 @@ -package net.minecraft.util.thread; - -import com.google.common.collect.ImmutableList; -import com.mojang.logging.LogUtils; -import it.unimi.dsi.fastutil.ints.Int2BooleanFunction; -import java.util.List; -import java.util.concurrent.ConcurrentLinkedQueue; -import java.util.concurrent.Executor; -import java.util.concurrent.RejectedExecutionException; -import java.util.concurrent.atomic.AtomicInteger; -import net.minecraft.Util; -import net.minecraft.util.profiling.metrics.MetricCategory; -import net.minecraft.util.profiling.metrics.MetricSampler; -import net.minecraft.util.profiling.metrics.MetricsRegistry; -import net.minecraft.util.profiling.metrics.ProfilerMeasured; -import org.slf4j.Logger; - -public class ProcessorMailbox implements ProfilerMeasured, ProcessorHandle, AutoCloseable, Runnable { - private static final Logger LOGGER = LogUtils.getLogger(); - private static final int CLOSED_BIT = 1; - private static final int SCHEDULED_BIT = 2; - private final AtomicInteger status = new AtomicInteger(0); - private final StrictQueue queue; - private final Executor dispatcher; - private final String name; - - public static ProcessorMailbox create(Executor dispatcher, String name) { - return new ProcessorMailbox<>(new StrictQueue.QueueStrictQueue<>(new ConcurrentLinkedQueue()), dispatcher, name); - } - - public ProcessorMailbox(StrictQueue queue, Executor dispatcher, String name) { - this.dispatcher = dispatcher; - this.queue = queue; - this.name = name; - MetricsRegistry.INSTANCE.add(this); - } - - private boolean setAsScheduled() { - int i; - do { - i = this.status.get(); - if ((i & 3) != 0) { - return false; - } - } while (!this.status.compareAndSet(i, i | 2)); - - return true; - } - - private void setAsIdle() { - int i; - do { - i = this.status.get(); - } while (!this.status.compareAndSet(i, i & -3)); - } - - private boolean canBeScheduled() { - return (this.status.get() & 1) != 0 ? false : !this.queue.isEmpty(); - } - - @Override - public void close() { - int i; - do { - i = this.status.get(); - } while (!this.status.compareAndSet(i, i | 1)); - } - - private boolean shouldProcess() { - return (this.status.get() & 2) != 0; - } - - private boolean pollTask() { - if (!this.shouldProcess()) { - return false; - } else { - Runnable runnable = this.queue.pop(); - if (runnable == null) { - return false; - } else { - Util.wrapThreadWithTaskName(this.name, runnable).run(); - return true; - } - } - } - - public void run() { - try { - this.pollUntil(i -> i == 0); - } finally { - this.setAsIdle(); - this.registerForExecution(); - } - } - - public void runAll() { - try { - this.pollUntil(i -> true); - } finally { - this.setAsIdle(); - this.registerForExecution(); - } - } - - @Override - public void tell(T task) { - this.queue.push(task); - this.registerForExecution(); - } - - private void registerForExecution() { - if (this.canBeScheduled() && this.setAsScheduled()) { - try { - this.dispatcher.execute(this); - } catch (RejectedExecutionException var4) { - try { - this.dispatcher.execute(this); - } catch (RejectedExecutionException var3) { - LOGGER.error("Cound not schedule mailbox", (Throwable)var3); - } - } - } - } - - private int pollUntil(Int2BooleanFunction continuePolling) { - int i = 0; - - while (continuePolling.get(i) && this.pollTask()) { - i++; - } - - return i; - } - - public int size() { - return this.queue.size(); - } - - public boolean hasWork() { - return this.shouldProcess() && !this.queue.isEmpty(); - } - - public String toString() { - return this.name + " " + this.status.get() + " " + this.queue.isEmpty(); - } - - @Override - public String name() { - return this.name; - } - - @Override - public List profiledMetrics() { - return ImmutableList.of(MetricSampler.create(this.name + "-queue-size", MetricCategory.MAIL_BOXES, this::size)); - } -} diff --git a/net/minecraft/util/thread/StrictQueue.java b/net/minecraft/util/thread/StrictQueue.java index 1c8156bd..8b940cfb 100644 --- a/net/minecraft/util/thread/StrictQueue.java +++ b/net/minecraft/util/thread/StrictQueue.java @@ -6,17 +6,17 @@ import java.util.Queue; import java.util.concurrent.atomic.AtomicInteger; import org.jetbrains.annotations.Nullable; -public interface StrictQueue { +public interface StrictQueue { @Nullable - F pop(); + Runnable pop(); - boolean push(T value); + boolean push(T runnable); boolean isEmpty(); int size(); - public static final class FixedPriorityQueue implements StrictQueue { + public static final class FixedPriorityQueue implements StrictQueue { private final Queue[] queues; private final AtomicInteger size = new AtomicInteger(); @@ -29,6 +29,7 @@ public interface StrictQueue { } @Nullable + @Override public Runnable pop() { for (Queue queue : this.queues) { Runnable runnable = (Runnable)queue.poll(); @@ -41,10 +42,10 @@ public interface StrictQueue { return null; } - public boolean push(StrictQueue.IntRunnable value) { - int i = value.priority; + public boolean push(StrictQueue.RunnableWithPriority runnableWithPriority) { + int i = runnableWithPriority.priority; if (i < this.queues.length && i >= 0) { - this.queues[i].add(value); + this.queues[i].add(runnableWithPriority); this.size.incrementAndGet(); return true; } else { @@ -63,40 +64,22 @@ public interface StrictQueue { } } - public static final class IntRunnable implements Runnable { - final int priority; - private final Runnable task; + public static final class QueueStrictQueue implements StrictQueue { + private final Queue queue; - public IntRunnable(int priority, Runnable task) { - this.priority = priority; - this.task = task; - } - - public void run() { - this.task.run(); - } - - public int getPriority() { - return this.priority; - } - } - - public static final class QueueStrictQueue implements StrictQueue { - private final Queue queue; - - public QueueStrictQueue(Queue queue) { + public QueueStrictQueue(Queue queue) { this.queue = queue; } @Nullable @Override - public T pop() { - return (T)this.queue.poll(); + public Runnable pop() { + return (Runnable)this.queue.poll(); } @Override - public boolean push(T value) { - return this.queue.add(value); + public boolean push(Runnable runnable) { + return this.queue.add(runnable); } @Override @@ -109,4 +92,11 @@ public interface StrictQueue { return this.queue.size(); } } + + public record RunnableWithPriority(int priority, Runnable task) implements Runnable { + + public void run() { + this.task.run(); + } + } } diff --git a/net/minecraft/util/thread/TaskScheduler.java b/net/minecraft/util/thread/TaskScheduler.java new file mode 100644 index 00000000..86ae045d --- /dev/null +++ b/net/minecraft/util/thread/TaskScheduler.java @@ -0,0 +1,45 @@ +package net.minecraft.util.thread; + +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.Executor; +import java.util.function.Consumer; + +public interface TaskScheduler extends AutoCloseable { + String name(); + + void schedule(R runnable); + + default void close() { + } + + R wrapRunnable(Runnable runnable); + + default CompletableFuture scheduleWithResult(Consumer> consumer) { + CompletableFuture completableFuture = new CompletableFuture(); + this.schedule(this.wrapRunnable(() -> consumer.accept(completableFuture))); + return completableFuture; + } + + static TaskScheduler wrapExecutor(String string, Executor executor) { + return new TaskScheduler() { + @Override + public String name() { + return string; + } + + @Override + public void schedule(Runnable runnable) { + executor.execute(runnable); + } + + @Override + public Runnable wrapRunnable(Runnable runnable) { + return runnable; + } + + public String toString() { + return string; + } + }; + } +} diff --git a/net/minecraft/util/worldupdate/WorldUpgrader.java b/net/minecraft/util/worldupdate/WorldUpgrader.java index ac5e264b..9c6a957c 100644 --- a/net/minecraft/util/worldupdate/WorldUpgrader.java +++ b/net/minecraft/util/worldupdate/WorldUpgrader.java @@ -30,7 +30,6 @@ import net.minecraft.core.registries.Registries; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.ListTag; import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.MutableComponent; import net.minecraft.resources.ResourceKey; import net.minecraft.util.datafix.DataFixTypes; import net.minecraft.world.level.ChunkPos; @@ -48,16 +47,16 @@ import net.minecraft.world.level.storage.LevelStorageSource; import org.jetbrains.annotations.Nullable; import org.slf4j.Logger; -public class WorldUpgrader { +public class WorldUpgrader implements AutoCloseable { static final Logger LOGGER = LogUtils.getLogger(); private static final ThreadFactory THREAD_FACTORY = new ThreadFactoryBuilder().setDaemon(true).build(); private static final String NEW_DIRECTORY_PREFIX = "new_"; - static final MutableComponent STATUS_UPGRADING_POI = Component.translatable("optimizeWorld.stage.upgrading.poi"); - static final MutableComponent STATUS_FINISHED_POI = Component.translatable("optimizeWorld.stage.finished.poi"); - static final MutableComponent STATUS_UPGRADING_ENTITIES = Component.translatable("optimizeWorld.stage.upgrading.entities"); - static final MutableComponent STATUS_FINISHED_ENTITIES = Component.translatable("optimizeWorld.stage.finished.entities"); - static final MutableComponent STATUS_UPGRADING_CHUNKS = Component.translatable("optimizeWorld.stage.upgrading.chunks"); - static final MutableComponent STATUS_FINISHED_CHUNKS = Component.translatable("optimizeWorld.stage.finished.chunks"); + static final Component STATUS_UPGRADING_POI = Component.translatable("optimizeWorld.stage.upgrading.poi"); + static final Component STATUS_FINISHED_POI = Component.translatable("optimizeWorld.stage.finished.poi"); + static final Component STATUS_UPGRADING_ENTITIES = Component.translatable("optimizeWorld.stage.upgrading.entities"); + static final Component STATUS_FINISHED_ENTITIES = Component.translatable("optimizeWorld.stage.finished.entities"); + static final Component STATUS_UPGRADING_CHUNKS = Component.translatable("optimizeWorld.stage.upgrading.chunks"); + static final Component STATUS_FINISHED_CHUNKS = Component.translatable("optimizeWorld.stage.finished.chunks"); final Registry dimensions; final Set> levels; final boolean eraseCache; @@ -80,12 +79,12 @@ public class WorldUpgrader { public WorldUpgrader( LevelStorageSource.LevelStorageAccess levelStorage, DataFixer dataFixer, RegistryAccess registryAccess, boolean eraseCache, boolean recreateRegionFiles ) { - this.dimensions = registryAccess.registryOrThrow(Registries.LEVEL_STEM); + this.dimensions = registryAccess.lookupOrThrow(Registries.LEVEL_STEM); this.levels = (Set>)this.dimensions.registryKeySet().stream().map(Registries::levelStemToLevel).collect(Collectors.toUnmodifiableSet()); this.eraseCache = eraseCache; this.dataFixer = dataFixer; this.levelStorage = levelStorage; - this.overworldDataStorage = new DimensionDataStorage(this.levelStorage.getDimensionPath(Level.OVERWORLD).resolve("data").toFile(), dataFixer, registryAccess); + this.overworldDataStorage = new DimensionDataStorage(this.levelStorage.getDimensionPath(Level.OVERWORLD).resolve("data"), dataFixer, registryAccess); this.recreateRegionFiles = recreateRegionFiles; this.thread = THREAD_FACTORY.newThread(this::work); this.thread.setUncaughtExceptionHandler((thread, throwable) -> { @@ -113,7 +112,7 @@ public class WorldUpgrader { new WorldUpgrader.PoiUpgrader().upgrade(); LOGGER.info("Upgrading blocks"); new WorldUpgrader.ChunkUpgrader().upgrade(); - this.overworldDataStorage.save(); + this.overworldDataStorage.saveAndJoin(); l = Util.getMillis() - l; LOGGER.info("World optimizaton finished after {} seconds", l / 1000L); this.finished = true; @@ -151,27 +150,29 @@ public class WorldUpgrader { return this.status; } + public void close() { + this.overworldDataStorage.close(); + } + static Path resolveRecreateDirectory(Path path) { return path.resolveSibling("new_" + path.getFileName().toString()); } abstract class AbstractUpgrader { - private final MutableComponent upgradingStatus; - private final MutableComponent finishedStatus; + private final Component upgradingStatus; + private final Component finishedStatus; private final String type; private final String folderName; @Nullable protected CompletableFuture previousWriteFuture; protected final DataFixTypes dataFixType; - AbstractUpgrader( - final DataFixTypes dataFixType, final String type, final String folderName, final MutableComponent upgradingStatus, final MutableComponent finishedStatus - ) { - this.dataFixType = dataFixType; - this.type = type; - this.folderName = folderName; - this.upgradingStatus = upgradingStatus; - this.finishedStatus = finishedStatus; + AbstractUpgrader(final DataFixTypes dataFixTypes, final String string, final String string2, final Component component, final Component component2) { + this.dataFixType = dataFixTypes; + this.type = string; + this.folderName = string2; + this.upgradingStatus = component; + this.finishedStatus = component2; } public void upgrade() { @@ -351,7 +352,7 @@ public class WorldUpgrader { CompoundTag compoundTag = (CompoundTag)((Optional)chunkStorage.read(chunkPos).join()).orElse(null); if (compoundTag != null) { int i = ChunkStorage.getVersion(compoundTag); - ChunkGenerator chunkGenerator = WorldUpgrader.this.dimensions.getOrThrow(Registries.levelToLevelStem(resourceKey)).generator(); + ChunkGenerator chunkGenerator = WorldUpgrader.this.dimensions.getValueOrThrow(Registries.levelToLevelStem(resourceKey)).generator(); CompoundTag compoundTag2 = chunkStorage.upgradeChunkTag( resourceKey, () -> WorldUpgrader.this.overworldDataStorage, compoundTag, chunkGenerator.getTypeNameForDataFixer() ); @@ -382,7 +383,7 @@ public class WorldUpgrader { this.previousWriteFuture.join(); } - this.previousWriteFuture = chunkStorage.write(chunkPos, compoundTag2); + this.previousWriteFuture = chunkStorage.write(chunkPos, () -> compoundTag2); return true; } } @@ -433,8 +434,8 @@ public class WorldUpgrader { } abstract class SimpleRegionStorageUpgrader extends WorldUpgrader.AbstractUpgrader { - SimpleRegionStorageUpgrader(final DataFixTypes dataFixType, final String type, final MutableComponent upgradingStatus, final MutableComponent finishedStatus) { - super(dataFixType, type, type, upgradingStatus, finishedStatus); + SimpleRegionStorageUpgrader(final DataFixTypes dataFixTypes, final String string, final Component component, final Component component2) { + super(dataFixTypes, string, string, component, component2); } protected SimpleRegionStorage createStorage(RegionStorageInfo regionStorageInfo, Path path) { diff --git a/net/minecraft/world/Difficulty.java b/net/minecraft/world/Difficulty.java index 7292f991..25de8c14 100644 --- a/net/minecraft/world/Difficulty.java +++ b/net/minecraft/world/Difficulty.java @@ -4,6 +4,7 @@ import java.util.function.IntFunction; import net.minecraft.network.chat.Component; import net.minecraft.util.ByIdMap; import net.minecraft.util.StringRepresentable; +import net.minecraft.util.ByIdMap.OutOfBoundsStrategy; import org.jetbrains.annotations.Nullable; public enum Difficulty implements StringRepresentable { @@ -13,7 +14,7 @@ public enum Difficulty implements StringRepresentable { HARD(3, "hard"); public static final StringRepresentable.EnumCodec CODEC = StringRepresentable.fromEnum(Difficulty::values); - private static final IntFunction BY_ID = ByIdMap.continuous(Difficulty::getId, values(), ByIdMap.OutOfBoundsStrategy.WRAP); + private static final IntFunction BY_ID = ByIdMap.continuous(Difficulty::getId, values(), OutOfBoundsStrategy.WRAP); private final int id; private final String key; diff --git a/net/minecraft/world/InteractionResult.java b/net/minecraft/world/InteractionResult.java index 7ab6d20e..c4cedf6f 100644 --- a/net/minecraft/world/InteractionResult.java +++ b/net/minecraft/world/InteractionResult.java @@ -1,26 +1,65 @@ package net.minecraft.world; -public enum InteractionResult { - SUCCESS, - SUCCESS_NO_ITEM_USED, - CONSUME, - CONSUME_PARTIAL, - PASS, - FAIL; +import net.minecraft.world.item.ItemStack; +import org.jetbrains.annotations.Nullable; - public boolean consumesAction() { - return this == SUCCESS || this == CONSUME || this == CONSUME_PARTIAL || this == SUCCESS_NO_ITEM_USED; +public sealed interface InteractionResult + permits InteractionResult.Success, + InteractionResult.Fail, + InteractionResult.Pass, + InteractionResult.TryEmptyHandInteraction { + InteractionResult.Success SUCCESS = new InteractionResult.Success(InteractionResult.SwingSource.CLIENT, InteractionResult.ItemContext.DEFAULT); + InteractionResult.Success SUCCESS_SERVER = new InteractionResult.Success(InteractionResult.SwingSource.SERVER, InteractionResult.ItemContext.DEFAULT); + InteractionResult.Success CONSUME = new InteractionResult.Success(InteractionResult.SwingSource.NONE, InteractionResult.ItemContext.DEFAULT); + InteractionResult.Fail FAIL = new InteractionResult.Fail(); + InteractionResult.Pass PASS = new InteractionResult.Pass(); + InteractionResult.TryEmptyHandInteraction TRY_WITH_EMPTY_HAND = new InteractionResult.TryEmptyHandInteraction(); + + default boolean consumesAction() { + return false; } - public boolean shouldSwing() { - return this == SUCCESS || this == SUCCESS_NO_ITEM_USED; + public record Fail() implements InteractionResult { } - public boolean indicateItemUse() { - return this == SUCCESS || this == CONSUME; + public record ItemContext(boolean wasItemInteraction, @Nullable ItemStack heldItemTransformedTo) { + static InteractionResult.ItemContext NONE = new InteractionResult.ItemContext(false, null); + static InteractionResult.ItemContext DEFAULT = new InteractionResult.ItemContext(true, null); } - public static InteractionResult sidedSuccess(boolean isClientSide) { - return isClientSide ? SUCCESS : CONSUME; + public record Pass() implements InteractionResult { + } + + public record Success(InteractionResult.SwingSource swingSource, InteractionResult.ItemContext itemContext) implements InteractionResult { + @Override + public boolean consumesAction() { + return true; + } + + public InteractionResult.Success heldItemTransformedTo(ItemStack itemStack) { + return new InteractionResult.Success(this.swingSource, new InteractionResult.ItemContext(true, itemStack)); + } + + public InteractionResult.Success withoutItem() { + return new InteractionResult.Success(this.swingSource, InteractionResult.ItemContext.NONE); + } + + public boolean wasItemInteraction() { + return this.itemContext.wasItemInteraction; + } + + @Nullable + public ItemStack heldItemTransformedTo() { + return this.itemContext.heldItemTransformedTo; + } + } + + public static enum SwingSource { + NONE, + CLIENT, + SERVER; + } + + public record TryEmptyHandInteraction() implements InteractionResult { } } diff --git a/net/minecraft/world/InteractionResultHolder.java b/net/minecraft/world/InteractionResultHolder.java deleted file mode 100644 index 6024f8ca..00000000 --- a/net/minecraft/world/InteractionResultHolder.java +++ /dev/null @@ -1,39 +0,0 @@ -package net.minecraft.world; - -public class InteractionResultHolder { - private final InteractionResult result; - private final T object; - - public InteractionResultHolder(InteractionResult result, T object) { - this.result = result; - this.object = object; - } - - public InteractionResult getResult() { - return this.result; - } - - public T getObject() { - return this.object; - } - - public static InteractionResultHolder success(T type) { - return new InteractionResultHolder<>(InteractionResult.SUCCESS, type); - } - - public static InteractionResultHolder consume(T type) { - return new InteractionResultHolder<>(InteractionResult.CONSUME, type); - } - - public static InteractionResultHolder pass(T type) { - return new InteractionResultHolder<>(InteractionResult.PASS, type); - } - - public static InteractionResultHolder fail(T type) { - return new InteractionResultHolder<>(InteractionResult.FAIL, type); - } - - public static InteractionResultHolder sidedSuccess(T object, boolean isClientSide) { - return isClientSide ? success(object) : consume(object); - } -} diff --git a/net/minecraft/world/ItemInteractionResult.java b/net/minecraft/world/ItemInteractionResult.java deleted file mode 100644 index 22d09dba..00000000 --- a/net/minecraft/world/ItemInteractionResult.java +++ /dev/null @@ -1,28 +0,0 @@ -package net.minecraft.world; - -public enum ItemInteractionResult { - SUCCESS, - CONSUME, - CONSUME_PARTIAL, - PASS_TO_DEFAULT_BLOCK_INTERACTION, - SKIP_DEFAULT_BLOCK_INTERACTION, - FAIL; - - public boolean consumesAction() { - return this.result().consumesAction(); - } - - public static ItemInteractionResult sidedSuccess(boolean clientSide) { - return clientSide ? SUCCESS : CONSUME; - } - - public InteractionResult result() { - return switch (this) { - case SUCCESS -> InteractionResult.SUCCESS; - case CONSUME -> InteractionResult.CONSUME; - case CONSUME_PARTIAL -> InteractionResult.CONSUME_PARTIAL; - case PASS_TO_DEFAULT_BLOCK_INTERACTION, SKIP_DEFAULT_BLOCK_INTERACTION -> InteractionResult.PASS; - case FAIL -> InteractionResult.FAIL; - }; - } -} diff --git a/net/minecraft/world/LockCode.java b/net/minecraft/world/LockCode.java index a806ccb4..9f0cd882 100644 --- a/net/minecraft/world/LockCode.java +++ b/net/minecraft/world/LockCode.java @@ -1,32 +1,39 @@ package net.minecraft.world; +import com.mojang.datafixers.util.Pair; import com.mojang.serialization.Codec; -import net.minecraft.core.component.DataComponents; +import com.mojang.serialization.DataResult; +import net.minecraft.advancements.critereon.ItemPredicate; +import net.minecraft.core.HolderLookup; import net.minecraft.nbt.CompoundTag; -import net.minecraft.network.chat.Component; +import net.minecraft.nbt.NbtOps; +import net.minecraft.nbt.Tag; import net.minecraft.world.item.ItemStack; -public record LockCode(String key) { - public static final LockCode NO_LOCK = new LockCode(""); - public static final Codec CODEC = Codec.STRING.xmap(LockCode::new, LockCode::key); - public static final String TAG_LOCK = "Lock"; +public record LockCode(ItemPredicate predicate) { + public static final LockCode NO_LOCK = new LockCode(ItemPredicate.Builder.item().build()); + public static final Codec CODEC = ItemPredicate.CODEC.xmap(LockCode::new, LockCode::predicate); + public static final String TAG_LOCK = "lock"; public boolean unlocksWith(ItemStack stack) { - if (this.key.isEmpty()) { - return true; - } else { - Component component = stack.get(DataComponents.CUSTOM_NAME); - return component != null && this.key.equals(component.getString()); + return this.predicate.test(stack); + } + + public void addToTag(CompoundTag compoundTag, HolderLookup.Provider provider) { + if (this != NO_LOCK) { + DataResult dataResult = CODEC.encode(this, provider.createSerializationContext(NbtOps.INSTANCE), new CompoundTag()); + dataResult.result().ifPresent(tag -> compoundTag.put("lock", tag)); } } - public void addToTag(CompoundTag nbt) { - if (!this.key.isEmpty()) { - nbt.putString("Lock", this.key); + public static LockCode fromTag(CompoundTag compoundTag, HolderLookup.Provider provider) { + if (compoundTag.contains("lock", 10)) { + DataResult> dataResult = CODEC.decode(provider.createSerializationContext(NbtOps.INSTANCE), compoundTag.get("lock")); + if (dataResult.isSuccess()) { + return dataResult.getOrThrow().getFirst(); + } } - } - public static LockCode fromTag(CompoundTag nbt) { - return nbt.contains("Lock", 8) ? new LockCode(nbt.getString("Lock")) : NO_LOCK; + return NO_LOCK; } } diff --git a/net/minecraft/world/SimpleContainer.java b/net/minecraft/world/SimpleContainer.java index 0f01f351..ca747677 100644 --- a/net/minecraft/world/SimpleContainer.java +++ b/net/minecraft/world/SimpleContainer.java @@ -7,7 +7,7 @@ import net.minecraft.core.HolderLookup; import net.minecraft.core.NonNullList; import net.minecraft.nbt.ListTag; import net.minecraft.world.entity.player.Player; -import net.minecraft.world.entity.player.StackedContents; +import net.minecraft.world.entity.player.StackedItemContents; import net.minecraft.world.inventory.StackedContentsCompatible; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; @@ -175,9 +175,9 @@ public class SimpleContainer implements Container, StackedContentsCompatible { } @Override - public void fillStackedContents(StackedContents contents) { + public void fillStackedContents(StackedItemContents stackedItemContents) { for (ItemStack itemStack : this.items) { - contents.accountStack(itemStack); + stackedItemContents.accountStack(itemStack); } } diff --git a/net/minecraft/world/damagesource/DamageSources.java b/net/minecraft/world/damagesource/DamageSources.java index 90a6641e..4bf4f0a5 100644 --- a/net/minecraft/world/damagesource/DamageSources.java +++ b/net/minecraft/world/damagesource/DamageSources.java @@ -29,6 +29,7 @@ public class DamageSources { private final DamageSource starve; private final DamageSource cactus; private final DamageSource fall; + private final DamageSource enderPearl; private final DamageSource flyIntoWall; private final DamageSource fellOutOfWorld; private final DamageSource generic; @@ -43,7 +44,7 @@ public class DamageSources { private final DamageSource genericKill; public DamageSources(RegistryAccess registry) { - this.damageTypes = registry.registryOrThrow(Registries.DAMAGE_TYPE); + this.damageTypes = registry.lookupOrThrow(Registries.DAMAGE_TYPE); this.inFire = this.source(DamageTypes.IN_FIRE); this.campfire = this.source(DamageTypes.CAMPFIRE); this.lightningBolt = this.source(DamageTypes.LIGHTNING_BOLT); @@ -56,6 +57,7 @@ public class DamageSources { this.starve = this.source(DamageTypes.STARVE); this.cactus = this.source(DamageTypes.CACTUS); this.fall = this.source(DamageTypes.FALL); + this.enderPearl = this.source(DamageTypes.ENDER_PEARL); this.flyIntoWall = this.source(DamageTypes.FLY_INTO_WALL); this.fellOutOfWorld = this.source(DamageTypes.FELL_OUT_OF_WORLD); this.generic = this.source(DamageTypes.GENERIC); @@ -71,15 +73,15 @@ public class DamageSources { } private DamageSource source(ResourceKey damageTypeKey) { - return new DamageSource(this.damageTypes.getHolderOrThrow(damageTypeKey)); + return new DamageSource(this.damageTypes.getOrThrow(damageTypeKey)); } private DamageSource source(ResourceKey damageTypeKey, @Nullable Entity entity) { - return new DamageSource(this.damageTypes.getHolderOrThrow(damageTypeKey), entity); + return new DamageSource(this.damageTypes.getOrThrow(damageTypeKey), entity); } private DamageSource source(ResourceKey damageTypeKey, @Nullable Entity causingEntity, @Nullable Entity directEntity) { - return new DamageSource(this.damageTypes.getHolderOrThrow(damageTypeKey), causingEntity, directEntity); + return new DamageSource(this.damageTypes.getOrThrow(damageTypeKey), causingEntity, directEntity); } public DamageSource inFire() { @@ -130,6 +132,10 @@ public class DamageSources { return this.fall; } + public DamageSource enderPearl() { + return this.enderPearl; + } + public DamageSource flyIntoWall() { return this.flyIntoWall; } @@ -255,7 +261,7 @@ public class DamageSources { } public DamageSource badRespawnPointExplosion(Vec3 position) { - return new DamageSource(this.damageTypes.getHolderOrThrow(DamageTypes.BAD_RESPAWN_POINT), position); + return new DamageSource(this.damageTypes.getOrThrow(DamageTypes.BAD_RESPAWN_POINT), position); } public DamageSource outOfBorder() { @@ -265,4 +271,8 @@ public class DamageSources { public DamageSource genericKill() { return this.genericKill; } + + public DamageSource mace(Entity entity) { + return this.source(DamageTypes.MACE_SMASH, entity); + } } diff --git a/net/minecraft/world/damagesource/DamageTypes.java b/net/minecraft/world/damagesource/DamageTypes.java index c1290cb3..43e6382b 100644 --- a/net/minecraft/world/damagesource/DamageTypes.java +++ b/net/minecraft/world/damagesource/DamageTypes.java @@ -18,6 +18,7 @@ public interface DamageTypes { ResourceKey STARVE = ResourceKey.create(Registries.DAMAGE_TYPE, ResourceLocation.withDefaultNamespace("starve")); ResourceKey CACTUS = ResourceKey.create(Registries.DAMAGE_TYPE, ResourceLocation.withDefaultNamespace("cactus")); ResourceKey FALL = ResourceKey.create(Registries.DAMAGE_TYPE, ResourceLocation.withDefaultNamespace("fall")); + ResourceKey ENDER_PEARL = ResourceKey.create(Registries.DAMAGE_TYPE, ResourceLocation.withDefaultNamespace("ender_pearl")); ResourceKey FLY_INTO_WALL = ResourceKey.create(Registries.DAMAGE_TYPE, ResourceLocation.withDefaultNamespace("fly_into_wall")); ResourceKey FELL_OUT_OF_WORLD = ResourceKey.create(Registries.DAMAGE_TYPE, ResourceLocation.withDefaultNamespace("out_of_world")); ResourceKey GENERIC = ResourceKey.create(Registries.DAMAGE_TYPE, ResourceLocation.withDefaultNamespace("generic")); @@ -53,6 +54,7 @@ public interface DamageTypes { ResourceKey BAD_RESPAWN_POINT = ResourceKey.create(Registries.DAMAGE_TYPE, ResourceLocation.withDefaultNamespace("bad_respawn_point")); ResourceKey OUTSIDE_BORDER = ResourceKey.create(Registries.DAMAGE_TYPE, ResourceLocation.withDefaultNamespace("outside_border")); ResourceKey GENERIC_KILL = ResourceKey.create(Registries.DAMAGE_TYPE, ResourceLocation.withDefaultNamespace("generic_kill")); + ResourceKey MACE_SMASH = ResourceKey.create(Registries.DAMAGE_TYPE, ResourceLocation.withDefaultNamespace("mace_smash")); static void bootstrap(BootstrapContext context) { context.register(IN_FIRE, new DamageType("inFire", 0.1F, DamageEffects.BURNING)); @@ -67,6 +69,9 @@ public interface DamageTypes { context.register(STARVE, new DamageType("starve", 0.0F)); context.register(CACTUS, new DamageType("cactus", 0.1F)); context.register(FALL, new DamageType("fall", DamageScaling.WHEN_CAUSED_BY_LIVING_NON_PLAYER, 0.0F, DamageEffects.HURT, DeathMessageType.FALL_VARIANTS)); + context.register( + ENDER_PEARL, new DamageType("fall", DamageScaling.WHEN_CAUSED_BY_LIVING_NON_PLAYER, 0.0F, DamageEffects.HURT, DeathMessageType.FALL_VARIANTS) + ); context.register(FLY_INTO_WALL, new DamageType("flyIntoWall", 0.0F)); context.register(FELL_OUT_OF_WORLD, new DamageType("outOfWorld", 0.0F)); context.register(GENERIC, new DamageType("generic", 0.0F)); @@ -104,5 +109,6 @@ public interface DamageTypes { context.register(OUTSIDE_BORDER, new DamageType("outsideBorder", 0.0F)); context.register(GENERIC_KILL, new DamageType("genericKill", 0.0F)); context.register(WIND_CHARGE, new DamageType("mob", 0.1F)); + context.register(MACE_SMASH, new DamageType("mace_smash", 0.1F)); } } diff --git a/net/minecraft/world/effect/AbsorptionMobEffect.java b/net/minecraft/world/effect/AbsorptionMobEffect.java index 0feabe72..23d3f1a8 100644 --- a/net/minecraft/world/effect/AbsorptionMobEffect.java +++ b/net/minecraft/world/effect/AbsorptionMobEffect.java @@ -1,5 +1,6 @@ package net.minecraft.world.effect; +import net.minecraft.server.level.ServerLevel; import net.minecraft.world.entity.LivingEntity; class AbsorptionMobEffect extends MobEffect { @@ -8,8 +9,8 @@ class AbsorptionMobEffect extends MobEffect { } @Override - public boolean applyEffectTick(LivingEntity livingEntity, int amplifier) { - return livingEntity.getAbsorptionAmount() > 0.0F || livingEntity.level().isClientSide; + public boolean applyEffectTick(ServerLevel serverLevel, LivingEntity livingEntity, int i) { + return livingEntity.getAbsorptionAmount() > 0.0F; } @Override diff --git a/net/minecraft/world/effect/BadOmenMobEffect.java b/net/minecraft/world/effect/BadOmenMobEffect.java index b038320d..30634be5 100644 --- a/net/minecraft/world/effect/BadOmenMobEffect.java +++ b/net/minecraft/world/effect/BadOmenMobEffect.java @@ -17,16 +17,16 @@ class BadOmenMobEffect extends MobEffect { } @Override - public boolean applyEffectTick(LivingEntity livingEntity, int amplifier) { - if (livingEntity instanceof ServerPlayer serverPlayer && !serverPlayer.isSpectator()) { - ServerLevel serverLevel = serverPlayer.serverLevel(); - if (serverLevel.getDifficulty() != Difficulty.PEACEFUL && serverLevel.isVillage(serverPlayer.blockPosition())) { - Raid raid = serverLevel.getRaidAt(serverPlayer.blockPosition()); - if (raid == null || raid.getRaidOmenLevel() < raid.getMaxRaidOmenLevel()) { - serverPlayer.addEffect(new MobEffectInstance(MobEffects.RAID_OMEN, 600, amplifier)); - serverPlayer.setRaidOmenPosition(serverPlayer.blockPosition()); - return false; - } + public boolean applyEffectTick(ServerLevel serverLevel, LivingEntity livingEntity, int i) { + if (livingEntity instanceof ServerPlayer serverPlayer + && !serverPlayer.isSpectator() + && serverLevel.getDifficulty() != Difficulty.PEACEFUL + && serverLevel.isVillage(serverPlayer.blockPosition())) { + Raid raid = serverLevel.getRaidAt(serverPlayer.blockPosition()); + if (raid == null || raid.getRaidOmenLevel() < raid.getMaxRaidOmenLevel()) { + serverPlayer.addEffect(new MobEffectInstance(MobEffects.RAID_OMEN, 600, i)); + serverPlayer.setRaidOmenPosition(serverPlayer.blockPosition()); + return false; } } diff --git a/net/minecraft/world/effect/HealOrHarmMobEffect.java b/net/minecraft/world/effect/HealOrHarmMobEffect.java index f6b30104..dbe11450 100644 --- a/net/minecraft/world/effect/HealOrHarmMobEffect.java +++ b/net/minecraft/world/effect/HealOrHarmMobEffect.java @@ -1,5 +1,6 @@ package net.minecraft.world.effect; +import net.minecraft.server.level.ServerLevel; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.LivingEntity; import org.jetbrains.annotations.Nullable; @@ -13,27 +14,27 @@ class HealOrHarmMobEffect extends InstantenousMobEffect { } @Override - public boolean applyEffectTick(LivingEntity livingEntity, int amplifier) { + public boolean applyEffectTick(ServerLevel serverLevel, LivingEntity livingEntity, int i) { if (this.isHarm == livingEntity.isInvertedHealAndHarm()) { - livingEntity.heal(Math.max(4 << amplifier, 0)); + livingEntity.heal(Math.max(4 << i, 0)); } else { - livingEntity.hurt(livingEntity.damageSources().magic(), 6 << amplifier); + livingEntity.hurtServer(serverLevel, livingEntity.damageSources().magic(), 6 << i); } return true; } @Override - public void applyInstantenousEffect(@Nullable Entity source, @Nullable Entity indirectSource, LivingEntity livingEntity, int amplifier, double health) { + public void applyInstantenousEffect(ServerLevel serverLevel, @Nullable Entity entity, @Nullable Entity entity2, LivingEntity livingEntity, int i, double d) { if (this.isHarm == livingEntity.isInvertedHealAndHarm()) { - int i = (int)(health * (4 << amplifier) + 0.5); - livingEntity.heal(i); + int j = (int)(d * (4 << i) + 0.5); + livingEntity.heal(j); } else { - int i = (int)(health * (6 << amplifier) + 0.5); - if (source == null) { - livingEntity.hurt(livingEntity.damageSources().magic(), i); + int j = (int)(d * (6 << i) + 0.5); + if (entity == null) { + livingEntity.hurtServer(serverLevel, livingEntity.damageSources().magic(), j); } else { - livingEntity.hurt(livingEntity.damageSources().indirectMagic(source, indirectSource), i); + livingEntity.hurtServer(serverLevel, livingEntity.damageSources().indirectMagic(entity, entity2), j); } } } diff --git a/net/minecraft/world/effect/HungerMobEffect.java b/net/minecraft/world/effect/HungerMobEffect.java index c7f4666f..299ebd4a 100644 --- a/net/minecraft/world/effect/HungerMobEffect.java +++ b/net/minecraft/world/effect/HungerMobEffect.java @@ -1,5 +1,6 @@ package net.minecraft.world.effect; +import net.minecraft.server.level.ServerLevel; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.player.Player; @@ -9,9 +10,9 @@ class HungerMobEffect extends MobEffect { } @Override - public boolean applyEffectTick(LivingEntity livingEntity, int amplifier) { + public boolean applyEffectTick(ServerLevel serverLevel, LivingEntity livingEntity, int i) { if (livingEntity instanceof Player player) { - player.causeFoodExhaustion(0.005F * (amplifier + 1)); + player.causeFoodExhaustion(0.005F * (i + 1)); } return true; diff --git a/net/minecraft/world/effect/InfestedMobEffect.java b/net/minecraft/world/effect/InfestedMobEffect.java index 945ee1e0..0873feeb 100644 --- a/net/minecraft/world/effect/InfestedMobEffect.java +++ b/net/minecraft/world/effect/InfestedMobEffect.java @@ -2,14 +2,15 @@ package net.minecraft.world.effect; import java.util.function.ToIntFunction; import net.minecraft.core.particles.ParticleTypes; +import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundEvents; import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; import net.minecraft.world.damagesource.DamageSource; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.monster.Silverfish; -import net.minecraft.world.level.Level; import net.minecraft.world.phys.Vec3; import org.joml.Vector3f; @@ -24,26 +25,26 @@ class InfestedMobEffect extends MobEffect { } @Override - public void onMobHurt(LivingEntity livingEntity, int amplifier, DamageSource damageSource, float amount) { + public void onMobHurt(ServerLevel serverLevel, LivingEntity livingEntity, int i, DamageSource damageSource, float f) { if (livingEntity.getRandom().nextFloat() <= this.chanceToSpawn) { - int i = this.spawnedCount.applyAsInt(livingEntity.getRandom()); + int j = this.spawnedCount.applyAsInt(livingEntity.getRandom()); - for (int j = 0; j < i; j++) { - this.spawnSilverfish(livingEntity.level(), livingEntity, livingEntity.getX(), livingEntity.getY() + livingEntity.getBbHeight() / 2.0, livingEntity.getZ()); + for (int k = 0; k < j; k++) { + this.spawnSilverfish(serverLevel, livingEntity, livingEntity.getX(), livingEntity.getY() + livingEntity.getBbHeight() / 2.0, livingEntity.getZ()); } } } - private void spawnSilverfish(Level level, LivingEntity entity, double x, double y, double z) { - Silverfish silverfish = EntityType.SILVERFISH.create(level); + private void spawnSilverfish(ServerLevel serverLevel, LivingEntity livingEntity, double d, double e, double f) { + Silverfish silverfish = EntityType.SILVERFISH.create(serverLevel, EntitySpawnReason.TRIGGERED); if (silverfish != null) { - RandomSource randomSource = entity.getRandom(); - float f = (float) (Math.PI / 2); - float g = Mth.randomBetween(randomSource, (float) (-Math.PI / 2), (float) (Math.PI / 2)); - Vector3f vector3f = entity.getLookAngle().toVector3f().mul(0.3F).mul(1.0F, 1.5F, 1.0F).rotateY(g); - silverfish.moveTo(x, y, z, level.getRandom().nextFloat() * 360.0F, 0.0F); + RandomSource randomSource = livingEntity.getRandom(); + float g = (float) (Math.PI / 2); + float h = Mth.randomBetween(randomSource, (float) (-Math.PI / 2), (float) (Math.PI / 2)); + Vector3f vector3f = livingEntity.getLookAngle().toVector3f().mul(0.3F).mul(1.0F, 1.5F, 1.0F).rotateY(h); + silverfish.moveTo(d, e, f, serverLevel.getRandom().nextFloat() * 360.0F, 0.0F); silverfish.setDeltaMovement(new Vec3(vector3f)); - level.addFreshEntity(silverfish); + serverLevel.addFreshEntity(silverfish); silverfish.playSound(SoundEvents.SILVERFISH_HURT); } } diff --git a/net/minecraft/world/effect/MobEffect.java b/net/minecraft/world/effect/MobEffect.java index 8dd03087..39bb8ece 100644 --- a/net/minecraft/world/effect/MobEffect.java +++ b/net/minecraft/world/effect/MobEffect.java @@ -19,8 +19,9 @@ import net.minecraft.network.chat.Component; import net.minecraft.network.codec.ByteBufCodecs; import net.minecraft.network.codec.StreamCodec; import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundEvent; -import net.minecraft.util.FastColor; +import net.minecraft.util.ARGB; import net.minecraft.util.Mth; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.Entity; @@ -57,7 +58,7 @@ public class MobEffect implements FeatureElement { this.color = color; this.particleFactory = mobEffectInstance -> { int j = mobEffectInstance.isAmbient() ? AMBIENT_ALPHA : 255; - return ColorParticleOption.create(ParticleTypes.ENTITY_EFFECT, FastColor.ARGB32.color(j, color)); + return ColorParticleOption.create(ParticleTypes.ENTITY_EFFECT, ARGB.color(j, color)); }; } @@ -71,12 +72,12 @@ public class MobEffect implements FeatureElement { return this.blendDurationTicks; } - public boolean applyEffectTick(LivingEntity livingEntity, int amplifier) { + public boolean applyEffectTick(ServerLevel serverLevel, LivingEntity livingEntity, int i) { return true; } - public void applyInstantenousEffect(@Nullable Entity source, @Nullable Entity indirectSource, LivingEntity livingEntity, int amplifier, double health) { - this.applyEffectTick(livingEntity, amplifier); + public void applyInstantenousEffect(ServerLevel serverLevel, @Nullable Entity entity, @Nullable Entity entity2, LivingEntity livingEntity, int i, double d) { + this.applyEffectTick(serverLevel, livingEntity, i); } public boolean shouldApplyEffectTickThisTick(int duration, int amplifier) { @@ -94,10 +95,10 @@ public class MobEffect implements FeatureElement { ); } - public void onMobRemoved(LivingEntity livingEntity, int amplifier, Entity.RemovalReason reason) { + public void onMobRemoved(ServerLevel serverLevel, LivingEntity livingEntity, int i, Entity.RemovalReason removalReason) { } - public void onMobHurt(LivingEntity livingEntity, int amplifier, DamageSource damageSource, float amount) { + public void onMobHurt(ServerLevel serverLevel, LivingEntity livingEntity, int i, DamageSource damageSource, float f) { } /** diff --git a/net/minecraft/world/effect/MobEffectInstance.java b/net/minecraft/world/effect/MobEffectInstance.java index 3981a0b4..790a2bfb 100644 --- a/net/minecraft/world/effect/MobEffectInstance.java +++ b/net/minecraft/world/effect/MobEffectInstance.java @@ -16,6 +16,7 @@ import net.minecraft.nbt.Tag; import net.minecraft.network.RegistryFriendlyByteBuf; import net.minecraft.network.codec.ByteBufCodecs; import net.minecraft.network.codec.StreamCodec; +import net.minecraft.server.level.ServerLevel; import net.minecraft.util.ExtraCodecs; import net.minecraft.util.Mth; import net.minecraft.world.damagesource.DamageSource; @@ -221,7 +222,9 @@ public class MobEffectInstance implements Comparable { public boolean tick(LivingEntity entity, Runnable onExpirationRunnable) { if (this.hasRemainingDuration()) { int i = this.isInfiniteDuration() ? entity.tickCount : this.duration; - if (this.effect.value().shouldApplyEffectTickThisTick(i, this.amplifier) && !this.effect.value().applyEffectTick(entity, this.amplifier)) { + if (entity.level() instanceof ServerLevel serverLevel + && this.effect.value().shouldApplyEffectTickThisTick(i, this.amplifier) + && !this.effect.value().applyEffectTick(serverLevel, entity, this.amplifier)) { entity.removeEffect(this.effect); } @@ -253,12 +256,12 @@ public class MobEffectInstance implements Comparable { this.effect.value().onEffectStarted(entity, this.amplifier); } - public void onMobRemoved(LivingEntity livingEntity, Entity.RemovalReason reason) { - this.effect.value().onMobRemoved(livingEntity, this.amplifier, reason); + public void onMobRemoved(ServerLevel serverLevel, LivingEntity livingEntity, Entity.RemovalReason removalReason) { + this.effect.value().onMobRemoved(serverLevel, livingEntity, this.amplifier, removalReason); } - public void onMobHurt(LivingEntity livingEntity, DamageSource damageSource, float amount) { - this.effect.value().onMobHurt(livingEntity, this.amplifier, damageSource, amount); + public void onMobHurt(ServerLevel serverLevel, LivingEntity livingEntity, DamageSource damageSource, float f) { + this.effect.value().onMobHurt(serverLevel, livingEntity, this.amplifier, damageSource, f); } public String getDescriptionId() { diff --git a/net/minecraft/world/effect/OozingMobEffect.java b/net/minecraft/world/effect/OozingMobEffect.java index 23ea315d..8d665516 100644 --- a/net/minecraft/world/effect/OozingMobEffect.java +++ b/net/minecraft/world/effect/OozingMobEffect.java @@ -5,9 +5,11 @@ import java.util.ArrayList; import java.util.List; import java.util.function.ToIntFunction; import net.minecraft.core.particles.ParticleTypes; +import net.minecraft.server.level.ServerLevel; import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.monster.Slime; @@ -30,21 +32,20 @@ class OozingMobEffect extends MobEffect { } @Override - public void onMobRemoved(LivingEntity livingEntity, int amplifier, Entity.RemovalReason reason) { - if (reason == Entity.RemovalReason.KILLED) { - int i = this.spawnedCount.applyAsInt(livingEntity.getRandom()); - Level level = livingEntity.level(); - int j = level.getGameRules().getInt(GameRules.RULE_MAX_ENTITY_CRAMMING); - int k = numberOfSlimesToSpawn(j, OozingMobEffect.NearbySlimes.closeTo(livingEntity), i); + public void onMobRemoved(ServerLevel serverLevel, LivingEntity livingEntity, int i, Entity.RemovalReason removalReason) { + if (removalReason == Entity.RemovalReason.KILLED) { + int j = this.spawnedCount.applyAsInt(livingEntity.getRandom()); + int k = serverLevel.getGameRules().getInt(GameRules.RULE_MAX_ENTITY_CRAMMING); + int l = numberOfSlimesToSpawn(k, OozingMobEffect.NearbySlimes.closeTo(livingEntity), j); - for (int l = 0; l < k; l++) { + for (int m = 0; m < l; m++) { this.spawnSlimeOffspring(livingEntity.level(), livingEntity.getX(), livingEntity.getY() + 0.5, livingEntity.getZ()); } } } private void spawnSlimeOffspring(Level level, double x, double y, double z) { - Slime slime = EntityType.SLIME.create(level); + Slime slime = EntityType.SLIME.create(level, EntitySpawnReason.TRIGGERED); if (slime != null) { slime.setSize(2, true); slime.moveTo(x, y, z, level.getRandom().nextFloat() * 360.0F, 0.0F); diff --git a/net/minecraft/world/effect/PoisonMobEffect.java b/net/minecraft/world/effect/PoisonMobEffect.java index 5878083e..e9e519e5 100644 --- a/net/minecraft/world/effect/PoisonMobEffect.java +++ b/net/minecraft/world/effect/PoisonMobEffect.java @@ -1,5 +1,6 @@ package net.minecraft.world.effect; +import net.minecraft.server.level.ServerLevel; import net.minecraft.world.entity.LivingEntity; class PoisonMobEffect extends MobEffect { @@ -8,9 +9,9 @@ class PoisonMobEffect extends MobEffect { } @Override - public boolean applyEffectTick(LivingEntity livingEntity, int amplifier) { + public boolean applyEffectTick(ServerLevel serverLevel, LivingEntity livingEntity, int i) { if (livingEntity.getHealth() > 1.0F) { - livingEntity.hurt(livingEntity.damageSources().magic(), 1.0F); + livingEntity.hurtServer(serverLevel, livingEntity.damageSources().magic(), 1.0F); } return true; diff --git a/net/minecraft/world/effect/RaidOmenMobEffect.java b/net/minecraft/world/effect/RaidOmenMobEffect.java index b3509daf..feb3e0b4 100644 --- a/net/minecraft/world/effect/RaidOmenMobEffect.java +++ b/net/minecraft/world/effect/RaidOmenMobEffect.java @@ -17,9 +17,8 @@ class RaidOmenMobEffect extends MobEffect { } @Override - public boolean applyEffectTick(LivingEntity livingEntity, int amplifier) { + public boolean applyEffectTick(ServerLevel serverLevel, LivingEntity livingEntity, int i) { if (livingEntity instanceof ServerPlayer serverPlayer && !livingEntity.isSpectator()) { - ServerLevel serverLevel = serverPlayer.serverLevel(); BlockPos blockPos = serverPlayer.getRaidOmenPosition(); if (blockPos != null) { serverLevel.getRaids().createOrExtendRaid(serverPlayer, blockPos); diff --git a/net/minecraft/world/effect/RegenerationMobEffect.java b/net/minecraft/world/effect/RegenerationMobEffect.java index 953dbb7d..f4f742b0 100644 --- a/net/minecraft/world/effect/RegenerationMobEffect.java +++ b/net/minecraft/world/effect/RegenerationMobEffect.java @@ -1,5 +1,6 @@ package net.minecraft.world.effect; +import net.minecraft.server.level.ServerLevel; import net.minecraft.world.entity.LivingEntity; class RegenerationMobEffect extends MobEffect { @@ -8,7 +9,7 @@ class RegenerationMobEffect extends MobEffect { } @Override - public boolean applyEffectTick(LivingEntity livingEntity, int amplifier) { + public boolean applyEffectTick(ServerLevel serverLevel, LivingEntity livingEntity, int i) { if (livingEntity.getHealth() < livingEntity.getMaxHealth()) { livingEntity.heal(1.0F); } diff --git a/net/minecraft/world/effect/SaturationMobEffect.java b/net/minecraft/world/effect/SaturationMobEffect.java index 31721d23..6b26fa9d 100644 --- a/net/minecraft/world/effect/SaturationMobEffect.java +++ b/net/minecraft/world/effect/SaturationMobEffect.java @@ -1,5 +1,6 @@ package net.minecraft.world.effect; +import net.minecraft.server.level.ServerLevel; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.player.Player; @@ -9,9 +10,9 @@ class SaturationMobEffect extends InstantenousMobEffect { } @Override - public boolean applyEffectTick(LivingEntity livingEntity, int amplifier) { - if (!livingEntity.level().isClientSide && livingEntity instanceof Player player) { - player.getFoodData().eat(amplifier + 1, 1.0F); + public boolean applyEffectTick(ServerLevel serverLevel, LivingEntity livingEntity, int i) { + if (livingEntity instanceof Player player) { + player.getFoodData().eat(i + 1, 1.0F); } return true; diff --git a/net/minecraft/world/effect/WeavingMobEffect.java b/net/minecraft/world/effect/WeavingMobEffect.java index 57bbe9e0..15d34e75 100644 --- a/net/minecraft/world/effect/WeavingMobEffect.java +++ b/net/minecraft/world/effect/WeavingMobEffect.java @@ -6,12 +6,12 @@ import java.util.function.ToIntFunction; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.particles.ParticleTypes; +import net.minecraft.server.level.ServerLevel; import net.minecraft.util.RandomSource; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.player.Player; import net.minecraft.world.level.GameRules; -import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Blocks; class WeavingMobEffect extends MobEffect { @@ -23,29 +23,31 @@ class WeavingMobEffect extends MobEffect { } @Override - public void onMobRemoved(LivingEntity livingEntity, int amplifier, Entity.RemovalReason reason) { - if (reason == Entity.RemovalReason.KILLED && (livingEntity instanceof Player || livingEntity.level().getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING))) { - this.spawnCobwebsRandomlyAround(livingEntity.level(), livingEntity.getRandom(), livingEntity.getOnPos()); + public void onMobRemoved(ServerLevel serverLevel, LivingEntity livingEntity, int i, Entity.RemovalReason removalReason) { + if (removalReason == Entity.RemovalReason.KILLED && (livingEntity instanceof Player || serverLevel.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING))) { + this.spawnCobwebsRandomlyAround(serverLevel, livingEntity.getRandom(), livingEntity.blockPosition()); } } - private void spawnCobwebsRandomlyAround(Level level, RandomSource random, BlockPos pos) { + private void spawnCobwebsRandomlyAround(ServerLevel serverLevel, RandomSource randomSource, BlockPos blockPos) { Set set = Sets.newHashSet(); - int i = this.maxCobwebs.applyAsInt(random); + int i = this.maxCobwebs.applyAsInt(randomSource); - for (BlockPos blockPos : BlockPos.randomInCube(random, 15, pos, 1)) { - BlockPos blockPos2 = blockPos.below(); - if (!set.contains(blockPos) && level.getBlockState(blockPos).canBeReplaced() && level.getBlockState(blockPos2).isFaceSturdy(level, blockPos2, Direction.UP)) { - set.add(blockPos.immutable()); + for (BlockPos blockPos2 : BlockPos.randomInCube(randomSource, 15, blockPos, 1)) { + BlockPos blockPos3 = blockPos2.below(); + if (!set.contains(blockPos2) + && serverLevel.getBlockState(blockPos2).canBeReplaced() + && serverLevel.getBlockState(blockPos3).isFaceSturdy(serverLevel, blockPos3, Direction.UP)) { + set.add(blockPos2.immutable()); if (set.size() >= i) { break; } } } - for (BlockPos blockPosx : set) { - level.setBlock(blockPosx, Blocks.COBWEB.defaultBlockState(), 3); - level.levelEvent(3018, blockPosx, 0); + for (BlockPos blockPos2x : set) { + serverLevel.setBlock(blockPos2x, Blocks.COBWEB.defaultBlockState(), 3); + serverLevel.levelEvent(3018, blockPos2x, 0); } } } diff --git a/net/minecraft/world/effect/WindChargedMobEffect.java b/net/minecraft/world/effect/WindChargedMobEffect.java index 4bf6a790..f61e6907 100644 --- a/net/minecraft/world/effect/WindChargedMobEffect.java +++ b/net/minecraft/world/effect/WindChargedMobEffect.java @@ -14,8 +14,8 @@ class WindChargedMobEffect extends MobEffect { } @Override - public void onMobRemoved(LivingEntity livingEntity, int amplifier, Entity.RemovalReason reason) { - if (reason == Entity.RemovalReason.KILLED && livingEntity.level() instanceof ServerLevel serverLevel) { + public void onMobRemoved(ServerLevel serverLevel, LivingEntity livingEntity, int i, Entity.RemovalReason removalReason) { + if (removalReason == Entity.RemovalReason.KILLED) { double d = livingEntity.getX(); double e = livingEntity.getY() + livingEntity.getBbHeight() / 2.0F; double f = livingEntity.getZ(); diff --git a/net/minecraft/world/effect/WitherMobEffect.java b/net/minecraft/world/effect/WitherMobEffect.java index 1c670b9a..8d857a15 100644 --- a/net/minecraft/world/effect/WitherMobEffect.java +++ b/net/minecraft/world/effect/WitherMobEffect.java @@ -1,5 +1,6 @@ package net.minecraft.world.effect; +import net.minecraft.server.level.ServerLevel; import net.minecraft.world.entity.LivingEntity; class WitherMobEffect extends MobEffect { @@ -8,8 +9,8 @@ class WitherMobEffect extends MobEffect { } @Override - public boolean applyEffectTick(LivingEntity livingEntity, int amplifier) { - livingEntity.hurt(livingEntity.damageSources().wither(), 1.0F); + public boolean applyEffectTick(ServerLevel serverLevel, LivingEntity livingEntity, int i) { + livingEntity.hurtServer(serverLevel, livingEntity.damageSources().wither(), 1.0F); return true; } diff --git a/net/minecraft/world/entity/AgeableMob.java b/net/minecraft/world/entity/AgeableMob.java index 729bb437..77d2e4fe 100644 --- a/net/minecraft/world/entity/AgeableMob.java +++ b/net/minecraft/world/entity/AgeableMob.java @@ -1,13 +1,15 @@ package net.minecraft.world.entity; +import com.google.common.annotations.VisibleForTesting; import net.minecraft.core.particles.ParticleTypes; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.network.syncher.SynchedEntityData.Builder; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.DifficultyInstance; -import net.minecraft.world.entity.vehicle.Boat; +import net.minecraft.world.entity.vehicle.AbstractBoat; import net.minecraft.world.level.Level; import net.minecraft.world.level.ServerLevelAccessor; import org.jetbrains.annotations.Nullable; @@ -25,7 +27,9 @@ public abstract class AgeableMob extends PathfinderMob { } @Override - public SpawnGroupData finalizeSpawn(ServerLevelAccessor level, DifficultyInstance difficulty, MobSpawnType spawnType, @Nullable SpawnGroupData spawnGroupData) { + public SpawnGroupData finalizeSpawn( + ServerLevelAccessor serverLevelAccessor, DifficultyInstance difficultyInstance, EntitySpawnReason entitySpawnReason, @Nullable SpawnGroupData spawnGroupData + ) { if (spawnGroupData == null) { spawnGroupData = new AgeableMob.AgeableMobGroupData(true); } @@ -33,19 +37,19 @@ public abstract class AgeableMob extends PathfinderMob { AgeableMob.AgeableMobGroupData ageableMobGroupData = (AgeableMob.AgeableMobGroupData)spawnGroupData; if (ageableMobGroupData.isShouldSpawnBaby() && ageableMobGroupData.getGroupSize() > 0 - && level.getRandom().nextFloat() <= ageableMobGroupData.getBabySpawnChance()) { + && serverLevelAccessor.getRandom().nextFloat() <= ageableMobGroupData.getBabySpawnChance()) { this.setAge(-24000); } ageableMobGroupData.increaseGroupSizeByOne(); - return super.finalizeSpawn(level, difficulty, spawnType, spawnGroupData); + return super.finalizeSpawn(serverLevelAccessor, difficultyInstance, entitySpawnReason, spawnGroupData); } @Nullable public abstract AgeableMob getBreedOffspring(ServerLevel level, AgeableMob otherParent); @Override - protected void defineSynchedData(SynchedEntityData.Builder builder) { + protected void defineSynchedData(Builder builder) { super.defineSynchedData(builder); builder.define(DATA_BABY_ID, false); } @@ -141,7 +145,7 @@ public abstract class AgeableMob extends PathfinderMob { } protected void ageBoundaryReached() { - if (!this.isBaby() && this.isPassenger() && this.getVehicle() instanceof Boat boat && !boat.hasEnoughSpaceFor(this)) { + if (!this.isBaby() && this.isPassenger() && this.getVehicle() instanceof AbstractBoat abstractBoat && !abstractBoat.hasEnoughSpaceFor(this)) { this.stopRiding(); } } @@ -160,12 +164,22 @@ public abstract class AgeableMob extends PathfinderMob { return (int)(ticksUntilAdult / 20 * 0.1F); } + @VisibleForTesting + public int getForcedAge() { + return this.forcedAge; + } + + @VisibleForTesting + public int getForcedAgeTimer() { + return this.forcedAgeTimer; + } + public static class AgeableMobGroupData implements SpawnGroupData { private int groupSize; private final boolean shouldSpawnBaby; private final float babySpawnChance; - private AgeableMobGroupData(boolean shouldSpawnBaby, float babySpawnChance) { + public AgeableMobGroupData(boolean shouldSpawnBaby, float babySpawnChance) { this.shouldSpawnBaby = shouldSpawnBaby; this.babySpawnChance = babySpawnChance; } diff --git a/net/minecraft/world/entity/AnimationState.java b/net/minecraft/world/entity/AnimationState.java index 2e5a1e4a..afaf9e2e 100644 --- a/net/minecraft/world/entity/AnimationState.java +++ b/net/minecraft/world/entity/AnimationState.java @@ -1,16 +1,13 @@ package net.minecraft.world.entity; import java.util.function.Consumer; -import net.minecraft.util.Mth; public class AnimationState { - private static final long STOPPED = Long.MAX_VALUE; - private long lastTime = Long.MAX_VALUE; - private long accumulatedTime; + private static final int STOPPED = Integer.MIN_VALUE; + private int startTick = Integer.MIN_VALUE; public void start(int tickCount) { - this.lastTime = tickCount * 1000L / 20L; - this.accumulatedTime = 0L; + this.startTick = tickCount; } public void startIfStopped(int tickCount) { @@ -28,7 +25,7 @@ public class AnimationState { } public void stop() { - this.lastTime = Long.MAX_VALUE; + this.startTick = Integer.MIN_VALUE; } public void ifStarted(Consumer action) { @@ -37,25 +34,22 @@ public class AnimationState { } } - public void updateTime(float ageInTicks, float speed) { - if (this.isStarted()) { - long l = Mth.lfloor(ageInTicks * 1000.0F / 20.0F); - this.accumulatedTime = this.accumulatedTime + (long)((float)(l - this.lastTime) * speed); - this.lastTime = l; - } - } - public void fastForward(int duration, float speed) { if (this.isStarted()) { - this.accumulatedTime += (long)(duration * 1000 * speed) / 20L; + this.startTick -= (int)(duration * speed); } } - public long getAccumulatedTime() { - return this.accumulatedTime; + public long getTimeInMillis(float f) { + float g = f - this.startTick; + return (long)(g * 50.0F); } public boolean isStarted() { - return this.lastTime != Long.MAX_VALUE; + return this.startTick != Integer.MIN_VALUE; + } + + public void copyFrom(AnimationState animationState) { + this.startTick = animationState.startTick; } } diff --git a/net/minecraft/world/entity/AreaEffectCloud.java b/net/minecraft/world/entity/AreaEffectCloud.java index 5496e2b5..7fe1d19d 100644 --- a/net/minecraft/world/entity/AreaEffectCloud.java +++ b/net/minecraft/world/entity/AreaEffectCloud.java @@ -16,10 +16,12 @@ import net.minecraft.nbt.Tag; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.network.syncher.SynchedEntityData.Builder; import net.minecraft.resources.RegistryOps; import net.minecraft.server.level.ServerLevel; -import net.minecraft.util.FastColor; +import net.minecraft.util.ARGB; import net.minecraft.util.Mth; +import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.effect.MobEffectInstance; import net.minecraft.world.item.alchemy.Potion; import net.minecraft.world.item.alchemy.PotionContents; @@ -63,7 +65,7 @@ public class AreaEffectCloud extends Entity implements TraceableEntity { } @Override - protected void defineSynchedData(SynchedEntityData.Builder builder) { + protected void defineSynchedData(Builder builder) { builder.define(DATA_RADIUS, 3.0F); builder.define(DATA_WAITING, false); builder.define(DATA_PARTICLE, ColorParticleOption.create(ParticleTypes.ENTITY_EFFECT, -1)); @@ -97,7 +99,7 @@ public class AreaEffectCloud extends Entity implements TraceableEntity { ParticleOptions particleOptions = this.entityData.get(DATA_PARTICLE); if (particleOptions instanceof ColorParticleOption colorParticleOption) { int i = this.potionContents.equals(PotionContents.EMPTY) ? 0 : this.potionContents.getColor(); - this.entityData.set(DATA_PARTICLE, ColorParticleOption.create(colorParticleOption.getType(), FastColor.ARGB32.opaque(i))); + this.entityData.set(DATA_PARTICLE, ColorParticleOption.create(colorParticleOption.getType(), ARGB.opaque(i))); } } @@ -138,13 +140,17 @@ public class AreaEffectCloud extends Entity implements TraceableEntity { @Override public void tick() { super.tick(); + if (this.level() instanceof ServerLevel serverLevel) { + this.serverTick(serverLevel); + } else { + this.clientTick(); + } + } + + private void clientTick() { boolean bl = this.isWaiting(); float f = this.getRadius(); - if (this.level().isClientSide) { - if (bl && this.random.nextBoolean()) { - return; - } - + if (!bl || !this.random.nextBoolean()) { ParticleOptions particleOptions = this.getParticle(); int i; float g; @@ -174,85 +180,88 @@ public class AreaEffectCloud extends Entity implements TraceableEntity { this.level().addAlwaysVisibleParticle(particleOptions, d, e, l, (0.5 - this.random.nextDouble()) * 0.15, 0.01F, (0.5 - this.random.nextDouble()) * 0.15); } } - } else { - if (this.tickCount >= this.waitTime + this.duration) { - this.discard(); - return; - } + } + } + private void serverTick(ServerLevel serverLevel) { + if (this.tickCount >= this.waitTime + this.duration) { + this.discard(); + } else { + boolean bl = this.isWaiting(); boolean bl2 = this.tickCount < this.waitTime; if (bl != bl2) { this.setWaiting(bl2); } - if (bl2) { - return; - } - - if (this.radiusPerTick != 0.0F) { - f += this.radiusPerTick; - if (f < 0.5F) { - this.discard(); - return; - } - - this.setRadius(f); - } - - if (this.tickCount % 5 == 0) { - this.victims.entrySet().removeIf(entry -> this.tickCount >= (Integer)entry.getValue()); - if (!this.potionContents.hasEffects()) { - this.victims.clear(); - } else { - List list = Lists.newArrayList(); - if (this.potionContents.potion().isPresent()) { - for (MobEffectInstance mobEffectInstance : ((Potion)((Holder)this.potionContents.potion().get()).value()).getEffects()) { - list.add( - new MobEffectInstance( - mobEffectInstance.getEffect(), - mobEffectInstance.mapDuration(i -> i / 4), - mobEffectInstance.getAmplifier(), - mobEffectInstance.isAmbient(), - mobEffectInstance.isVisible() - ) - ); - } + if (!bl2) { + float f = this.getRadius(); + if (this.radiusPerTick != 0.0F) { + f += this.radiusPerTick; + if (f < 0.5F) { + this.discard(); + return; } - list.addAll(this.potionContents.customEffects()); - List list2 = this.level().getEntitiesOfClass(LivingEntity.class, this.getBoundingBox()); - if (!list2.isEmpty()) { - for (LivingEntity livingEntity : list2) { - if (!this.victims.containsKey(livingEntity) && livingEntity.isAffectedByPotions() && !list.stream().noneMatch(livingEntity::canBeAffected)) { - double m = livingEntity.getX() - this.getX(); - double n = livingEntity.getZ() - this.getZ(); - double o = m * m + n * n; - if (o <= f * f) { - this.victims.put(livingEntity, this.tickCount + this.reapplicationDelay); + this.setRadius(f); + } - for (MobEffectInstance mobEffectInstance2 : list) { - if (mobEffectInstance2.getEffect().value().isInstantenous()) { - mobEffectInstance2.getEffect().value().applyInstantenousEffect(this, this.getOwner(), livingEntity, mobEffectInstance2.getAmplifier(), 0.5); - } else { - livingEntity.addEffect(new MobEffectInstance(mobEffectInstance2), this); - } - } + if (this.tickCount % 5 == 0) { + this.victims.entrySet().removeIf(entry -> this.tickCount >= (Integer)entry.getValue()); + if (!this.potionContents.hasEffects()) { + this.victims.clear(); + } else { + List list = Lists.newArrayList(); + if (this.potionContents.potion().isPresent()) { + for (MobEffectInstance mobEffectInstance : ((Potion)((Holder)this.potionContents.potion().get()).value()).getEffects()) { + list.add( + new MobEffectInstance( + mobEffectInstance.getEffect(), + mobEffectInstance.mapDuration(i -> i / 4), + mobEffectInstance.getAmplifier(), + mobEffectInstance.isAmbient(), + mobEffectInstance.isVisible() + ) + ); + } + } - if (this.radiusOnUse != 0.0F) { - f += this.radiusOnUse; - if (f < 0.5F) { - this.discard(); - return; + list.addAll(this.potionContents.customEffects()); + List list2 = this.level().getEntitiesOfClass(LivingEntity.class, this.getBoundingBox()); + if (!list2.isEmpty()) { + for (LivingEntity livingEntity : list2) { + if (!this.victims.containsKey(livingEntity) && livingEntity.isAffectedByPotions() && !list.stream().noneMatch(livingEntity::canBeAffected)) { + double d = livingEntity.getX() - this.getX(); + double e = livingEntity.getZ() - this.getZ(); + double g = d * d + e * e; + if (g <= f * f) { + this.victims.put(livingEntity, this.tickCount + this.reapplicationDelay); + + for (MobEffectInstance mobEffectInstance2 : list) { + if (mobEffectInstance2.getEffect().value().isInstantenous()) { + mobEffectInstance2.getEffect() + .value() + .applyInstantenousEffect(serverLevel, this, this.getOwner(), livingEntity, mobEffectInstance2.getAmplifier(), 0.5); + } else { + livingEntity.addEffect(new MobEffectInstance(mobEffectInstance2), this); + } } - this.setRadius(f); - } + if (this.radiusOnUse != 0.0F) { + f += this.radiusOnUse; + if (f < 0.5F) { + this.discard(); + return; + } - if (this.durationOnUse != 0) { - this.duration = this.duration + this.durationOnUse; - if (this.duration <= 0) { - this.discard(); - return; + this.setRadius(f); + } + + if (this.durationOnUse != 0) { + this.duration = this.duration + this.durationOnUse; + if (this.duration <= 0) { + this.discard(); + return; + } } } } @@ -383,4 +392,9 @@ public class AreaEffectCloud extends Entity implements TraceableEntity { public EntityDimensions getDimensions(Pose pose) { return EntityDimensions.scalable(this.getRadius() * 2.0F, 0.5F); } + + @Override + public final boolean hurtServer(ServerLevel serverLevel, DamageSource damageSource, float f) { + return false; + } } diff --git a/net/minecraft/world/entity/ConversionParams.java b/net/minecraft/world/entity/ConversionParams.java new file mode 100644 index 00000000..ce3864a6 --- /dev/null +++ b/net/minecraft/world/entity/ConversionParams.java @@ -0,0 +1,15 @@ +package net.minecraft.world.entity; + +import net.minecraft.world.scores.PlayerTeam; +import org.jetbrains.annotations.Nullable; + +public record ConversionParams(ConversionType type, boolean keepEquipment, boolean preserveCanPickUpLoot, @Nullable PlayerTeam team) { + public static ConversionParams single(Mob mob, boolean bl, boolean bl2) { + return new ConversionParams(ConversionType.SINGLE, bl, bl2, mob.getTeam()); + } + + @FunctionalInterface + public interface AfterConversion { + void finalizeConversion(T mob); + } +} diff --git a/net/minecraft/world/entity/ConversionType.java b/net/minecraft/world/entity/ConversionType.java new file mode 100644 index 00000000..308cecbe --- /dev/null +++ b/net/minecraft/world/entity/ConversionType.java @@ -0,0 +1,146 @@ +package net.minecraft.world.entity; + +import net.minecraft.world.effect.MobEffectInstance; +import net.minecraft.world.entity.ai.Brain; +import net.minecraft.world.entity.ai.memory.MemoryModuleType; +import net.minecraft.world.entity.ai.memory.MemoryStatus; +import net.minecraft.world.entity.monster.Zombie; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.scores.Scoreboard; + +public enum ConversionType { + SINGLE(true) { + @Override + void convert(Mob mob, Mob mob2, ConversionParams conversionParams) { + Entity entity = mob.getFirstPassenger(); + mob2.copyPosition(mob); + mob2.setDeltaMovement(mob.getDeltaMovement()); + if (entity != null) { + entity.stopRiding(); + entity.boardingCooldown = 0; + + for (Entity entity2 : mob2.getPassengers()) { + entity2.stopRiding(); + entity2.remove(Entity.RemovalReason.DISCARDED); + } + + entity.startRiding(mob2); + } + + Entity entity3 = mob.getVehicle(); + if (entity3 != null) { + mob.stopRiding(); + mob2.startRiding(entity3); + } + + if (conversionParams.keepEquipment()) { + for (EquipmentSlot equipmentSlot : EquipmentSlot.VALUES) { + ItemStack itemStack = mob.getItemBySlot(equipmentSlot); + if (!itemStack.isEmpty()) { + mob2.setItemSlot(equipmentSlot, itemStack.copyAndClear()); + mob2.setDropChance(equipmentSlot, mob.getEquipmentDropChance(equipmentSlot)); + } + } + } + + mob2.fallDistance = mob.fallDistance; + mob2.setSharedFlag(7, mob.isFallFlying()); + mob2.lastHurtByPlayerTime = mob.lastHurtByPlayerTime; + mob2.hurtTime = mob.hurtTime; + mob2.yBodyRot = mob.yBodyRot; + mob2.setOnGround(mob.onGround()); + mob.getSleepingPos().ifPresent(mob2::setSleepingPos); + Entity entity2 = mob.getLeashHolder(); + if (entity2 != null) { + mob2.setLeashedTo(entity2, true); + } + + this.convertCommon(mob, mob2, conversionParams); + } + }, + SPLIT_ON_DEATH(false) { + @Override + void convert(Mob mob, Mob mob2, ConversionParams conversionParams) { + Entity entity = mob.getFirstPassenger(); + if (entity != null) { + entity.stopRiding(); + } + + Entity entity2 = mob.getLeashHolder(); + if (entity2 != null) { + mob.dropLeash(true, true); + } + + this.convertCommon(mob, mob2, conversionParams); + } + }; + + private final boolean discardAfterConversion; + + ConversionType(final boolean bl) { + this.discardAfterConversion = bl; + } + + public boolean shouldDiscardAfterConversion() { + return this.discardAfterConversion; + } + + abstract void convert(Mob mob, Mob mob2, ConversionParams conversionParams); + + void convertCommon(Mob mob, Mob mob2, ConversionParams conversionParams) { + mob2.setAbsorptionAmount(mob.getAbsorptionAmount()); + + for (MobEffectInstance mobEffectInstance : mob.getActiveEffects()) { + mob2.addEffect(new MobEffectInstance(mobEffectInstance)); + } + + if (mob.isBaby()) { + mob2.setBaby(true); + } + + if (mob instanceof AgeableMob ageableMob && mob2 instanceof AgeableMob ageableMob2) { + ageableMob2.setAge(ageableMob.getAge()); + ageableMob2.forcedAge = ageableMob.forcedAge; + ageableMob2.forcedAgeTimer = ageableMob.forcedAgeTimer; + } + + Brain brain = mob.getBrain(); + Brain brain2 = mob2.getBrain(); + if (brain.checkMemory(MemoryModuleType.ANGRY_AT, MemoryStatus.REGISTERED) && brain.hasMemoryValue(MemoryModuleType.ANGRY_AT)) { + brain2.setMemory(MemoryModuleType.ANGRY_AT, brain.getMemory(MemoryModuleType.ANGRY_AT)); + } + + if (conversionParams.preserveCanPickUpLoot()) { + mob2.setCanPickUpLoot(mob.canPickUpLoot()); + } + + mob2.setLeftHanded(mob.isLeftHanded()); + mob2.setNoAi(mob.isNoAi()); + if (mob.isPersistenceRequired()) { + mob2.setPersistenceRequired(); + } + + if (mob.hasCustomName()) { + mob2.setCustomName(mob.getCustomName()); + mob2.setCustomNameVisible(mob.isCustomNameVisible()); + } + + mob2.setSharedFlagOnFire(mob.isOnFire()); + mob2.setInvulnerable(mob.isInvulnerable()); + mob2.setNoGravity(mob.isNoGravity()); + mob2.setPortalCooldown(mob.getPortalCooldown()); + mob2.setSilent(mob.isSilent()); + mob.getTags().forEach(mob2::addTag); + if (conversionParams.team() != null) { + Scoreboard scoreboard = mob2.level().getScoreboard(); + scoreboard.addPlayerToTeam(mob2.getStringUUID(), conversionParams.team()); + if (mob.getTeam() != null && mob.getTeam() == conversionParams.team()) { + scoreboard.removePlayerFromTeam(mob.getStringUUID(), mob.getTeam()); + } + } + + if (mob instanceof Zombie zombie && zombie.canBreakDoors() && mob2 instanceof Zombie zombie2) { + zombie2.setCanBreakDoors(true); + } + } +} diff --git a/net/minecraft/world/entity/Display.java b/net/minecraft/world/entity/Display.java index dbc08e67..37aedca4 100644 --- a/net/minecraft/world/entity/Display.java +++ b/net/minecraft/world/entity/Display.java @@ -19,12 +19,21 @@ import net.minecraft.network.chat.ComponentUtils; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.network.syncher.SynchedEntityData.Builder; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.util.ARGB; import net.minecraft.util.Brightness; import net.minecraft.util.ByIdMap; -import net.minecraft.util.FastColor; -import net.minecraft.util.FormattedCharSequence; import net.minecraft.util.Mth; import net.minecraft.util.StringRepresentable; +import net.minecraft.util.ByIdMap.OutOfBoundsStrategy; +import net.minecraft.world.damagesource.DamageSource; +import net.minecraft.world.entity.Display.BlockDisplay.BlockRenderState; +import net.minecraft.world.entity.Display.ItemDisplay.ItemRenderState; +import net.minecraft.world.entity.Display.TextDisplay.Align; +import net.minecraft.world.entity.Display.TextDisplay.CachedInfo; +import net.minecraft.world.entity.Display.TextDisplay.LineSplitter; +import net.minecraft.world.entity.Display.TextDisplay.TextRenderState; import net.minecraft.world.item.ItemDisplayContext; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; @@ -88,6 +97,7 @@ public abstract class Display extends Entity { private int interpolationDuration; private float lastProgress; private AABB cullingBoundingBox; + private boolean noCulling = true; protected boolean updateRenderState; private boolean updateStartTick; private boolean updateInterpolationDuration; @@ -99,7 +109,6 @@ public abstract class Display extends Entity { public Display(EntityType entityType, Level level) { super(entityType, level); this.noPhysics = true; - this.noCulling = true; this.cullingBoundingBox = this.getBoundingBox(); } @@ -123,6 +132,11 @@ public abstract class Display extends Entity { } } + @Override + public final boolean hurtServer(ServerLevel serverLevel, DamageSource damageSource, float f) { + return false; + } + private static Transformation createTransformation(SynchedEntityData synchedEntityData) { Vector3f vector3f = synchedEntityData.get(DATA_TRANSLATION_ID); Quaternionf quaternionf = synchedEntityData.get(DATA_LEFT_ROTATION_ID); @@ -181,7 +195,7 @@ public abstract class Display extends Entity { protected abstract void updateRenderSubState(boolean interpolate, float partialTick); @Override - protected void defineSynchedData(SynchedEntityData.Builder builder) { + protected void defineSynchedData(Builder builder) { builder.define(DATA_POS_ROT_INTERPOLATION_DURATION_ID, 0); builder.define(DATA_TRANSFORMATION_INTERPOLATION_START_DELTA_TICKS_ID, 0); builder.define(DATA_TRANSFORMATION_INTERPOLATION_DURATION_ID, 0); @@ -289,6 +303,11 @@ public abstract class Display extends Entity { } } + @Override + public void cancelLerp() { + this.posRotInterpolationTarget = null; + } + @Override public void lerpTo(double x, double y, double z, float yRot, float xRot, int steps) { int i = this.getPosRotInterpolationDuration(); @@ -320,11 +339,17 @@ public abstract class Display extends Entity { return this.posRotInterpolationTarget != null ? (float)this.posRotInterpolationTarget.targetYRot : this.getYRot(); } - @Override + /** + * Gets the bounding box of this Entity, adjusted to take auxiliary entities into account (e.g. the tile contained by a minecart, such as a command block). + */ public AABB getBoundingBoxForCulling() { return this.cullingBoundingBox; } + public boolean affectedByCulling() { + return !this.noCulling; + } + @Override public PushReaction getPistonPushReaction() { return PushReaction.IGNORE; @@ -456,16 +481,12 @@ public abstract class Display extends Entity { private void updateCulling() { float f = this.getWidth(); float g = this.getHeight(); - if (f != 0.0F && g != 0.0F) { - this.noCulling = false; - float h = f / 2.0F; - double d = this.getX(); - double e = this.getY(); - double i = this.getZ(); - this.cullingBoundingBox = new AABB(d - h, e, i - h, d + h, e + g, i + h); - } else { - this.noCulling = true; - } + this.noCulling = f == 0.0F || g == 0.0F; + float h = f / 2.0F; + double d = this.getX(); + double e = this.getY(); + double i = this.getZ(); + this.cullingBoundingBox = new AABB(d - h, e, i - h, d + h, e + g, i + h); } @Override @@ -512,7 +533,7 @@ public abstract class Display extends Entity { public static final Codec CODEC = StringRepresentable.fromEnum(Display.BillboardConstraints::values); public static final IntFunction BY_ID = ByIdMap.continuous( - Display.BillboardConstraints::getId, values(), ByIdMap.OutOfBoundsStrategy.ZERO + Display.BillboardConstraints::getId, values(), OutOfBoundsStrategy.ZERO ); private final byte id; private final String name; @@ -538,14 +559,14 @@ public abstract class Display extends Entity { Display.BlockDisplay.class, EntityDataSerializers.BLOCK_STATE ); @Nullable - private Display.BlockDisplay.BlockRenderState blockRenderState; + private BlockRenderState blockRenderState; public BlockDisplay(EntityType entityType, Level level) { super(entityType, level); } @Override - protected void defineSynchedData(SynchedEntityData.Builder builder) { + protected void defineSynchedData(Builder builder) { super.defineSynchedData(builder); builder.define(DATA_BLOCK_STATE_ID, Blocks.AIR.defaultBlockState()); } @@ -579,23 +600,20 @@ public abstract class Display extends Entity { } @Nullable - public Display.BlockDisplay.BlockRenderState blockRenderState() { + public BlockRenderState blockRenderState() { return this.blockRenderState; } @Override protected void updateRenderSubState(boolean interpolate, float partialTick) { - this.blockRenderState = new Display.BlockDisplay.BlockRenderState(this.getBlockState()); - } - - public record BlockRenderState(BlockState blockState) { + this.blockRenderState = new BlockRenderState(this.getBlockState()); } } record ColorInterpolator(int previous, int current) implements Display.IntInterpolator { @Override public int get(float f) { - return FastColor.ARGB32.lerp(f, this.previous, this.current); + return ARGB.lerp(f, this.previous, this.current); } } @@ -635,14 +653,14 @@ public abstract class Display extends Entity { private static final EntityDataAccessor DATA_ITEM_DISPLAY_ID = SynchedEntityData.defineId(Display.ItemDisplay.class, EntityDataSerializers.BYTE); private final SlotAccess slot = SlotAccess.of(this::getItemStack, this::setItemStack); @Nullable - private Display.ItemDisplay.ItemRenderState itemRenderState; + private ItemRenderState itemRenderState; public ItemDisplay(EntityType entityType, Level level) { super(entityType, level); } @Override - protected void defineSynchedData(SynchedEntityData.Builder builder) { + protected void defineSynchedData(Builder builder) { super.defineSynchedData(builder); builder.define(DATA_ITEM_STACK_ID, ItemStack.EMPTY); builder.define(DATA_ITEM_DISPLAY_ID, ItemDisplayContext.NONE.getId()); @@ -705,7 +723,7 @@ public abstract class Display extends Entity { } @Nullable - public Display.ItemDisplay.ItemRenderState itemRenderState() { + public ItemRenderState itemRenderState() { return this.itemRenderState; } @@ -713,10 +731,7 @@ public abstract class Display extends Entity { protected void updateRenderSubState(boolean interpolate, float partialTick) { ItemStack itemStack = this.getItemStack(); itemStack.setEntityRepresentation(this); - this.itemRenderState = new Display.ItemDisplay.ItemRenderState(itemStack, this.getItemTransform()); - } - - public record ItemRenderState(ItemStack itemStack, ItemDisplayContext itemTransform) { + this.itemRenderState = new ItemRenderState(itemStack, this.getItemTransform()); } } @@ -796,16 +811,16 @@ public abstract class Display extends Entity { DATA_TEXT_ID.id(), DATA_LINE_WIDTH_ID.id(), DATA_BACKGROUND_COLOR_ID.id(), DATA_TEXT_OPACITY_ID.id(), DATA_STYLE_FLAGS_ID.id() ); @Nullable - private Display.TextDisplay.CachedInfo clientDisplayCache; + private CachedInfo clientDisplayCache; @Nullable - private Display.TextDisplay.TextRenderState textRenderState; + private TextRenderState textRenderState; public TextDisplay(EntityType entityType, Level level) { super(entityType, level); } @Override - protected void defineSynchedData(SynchedEntityData.Builder builder) { + protected void defineSynchedData(Builder builder) { super.defineSynchedData(builder); builder.define(DATA_TEXT_ID, Component.empty()); builder.define(DATA_LINE_WIDTH_ID, 200); @@ -866,6 +881,8 @@ public abstract class Display extends Entity { return tag.getBoolean(flag) ? (byte)(currentValue | mask) : currentValue; } + // $VF: Unable to simplify switch-on-enum, as the enum class was not able to be found. + // Please report this to the Vineflower issue tracker, at https://github.com/Vineflower/vineflower/issues with a copy of the class file (if you have the rights to distribute it!) @Override protected void readAdditionalSaveData(CompoundTag compound) { super.readAdditionalSaveData(compound); @@ -884,15 +901,16 @@ public abstract class Display extends Entity { byte b = loadFlag((byte)0, compound, "shadow", (byte)1); b = loadFlag(b, compound, "see_through", (byte)2); b = loadFlag(b, compound, "default_background", (byte)4); - Optional optional = Display.TextDisplay.Align.CODEC + Optional optional = Align.CODEC .decode(NbtOps.INSTANCE, compound.get("alignment")) .resultOrPartial(Util.prefix("Display entity", Display.LOGGER::error)) .map(Pair::getFirst); if (optional.isPresent()) { - b = switch ((Display.TextDisplay.Align)optional.get()) { - case CENTER -> b; - case LEFT -> (byte)(b | 8); - case RIGHT -> (byte)(b | 16); + b = switch (((Align)optional.get()).ordinal()) { + case 0 -> b; + case 1 -> (byte)(b | 8); + case 2 -> (byte)(b | 16); + default -> throw new MatchException(null, null); }; } @@ -902,15 +920,15 @@ public abstract class Display extends Entity { try { Component component = Component.Serializer.fromJson(string, this.registryAccess()); - if (component != null) { - CommandSourceStack commandSourceStack = this.createCommandSourceStack().withPermission(2); + if (component != null && this.level() instanceof ServerLevel serverLevel) { + CommandSourceStack commandSourceStack = this.createCommandSourceStackForNameResolution(serverLevel).withPermission(2); Component component2 = ComponentUtils.updateForEntity(commandSourceStack, component, this, 0); this.setText(component2); } else { this.setText(Component.empty()); } - } catch (Exception var8) { - Display.LOGGER.warn("Failed to parse display entity text {}", string, var8); + } catch (Exception var9) { + Display.LOGGER.warn("Failed to parse display entity text {}", string, var9); } } } @@ -930,7 +948,7 @@ public abstract class Display extends Entity { storeFlag(b, compound, "shadow", (byte)1); storeFlag(b, compound, "see_through", (byte)2); storeFlag(b, compound, "default_background", (byte)4); - Display.TextDisplay.Align.CODEC.encodeStart(NbtOps.INSTANCE, getAlign(b)).ifSuccess(tag -> compound.put("alignment", tag)); + Align.CODEC.encodeStart(NbtOps.INSTANCE, getAlign(b)).ifSuccess(tag -> compound.put("alignment", tag)); } @Override @@ -945,12 +963,12 @@ public abstract class Display extends Entity { } @Nullable - public Display.TextDisplay.TextRenderState textRenderState() { + public TextRenderState textRenderState() { return this.textRenderState; } - private Display.TextDisplay.TextRenderState createFreshTextRenderState() { - return new Display.TextDisplay.TextRenderState( + private TextRenderState createFreshTextRenderState() { + return new TextRenderState( this.getText(), this.getLineWidth(), Display.IntInterpolator.constant(this.getTextOpacity()), @@ -959,10 +977,10 @@ public abstract class Display extends Entity { ); } - private Display.TextDisplay.TextRenderState createInterpolatedTextRenderState(Display.TextDisplay.TextRenderState renderState, float partialTick) { + private TextRenderState createInterpolatedTextRenderState(TextRenderState renderState, float partialTick) { int i = renderState.backgroundColor.get(partialTick); int j = renderState.textOpacity.get(partialTick); - return new Display.TextDisplay.TextRenderState( + return new TextRenderState( this.getText(), this.getLineWidth(), new Display.LinearIntInterpolator(j, this.getTextOpacity()), @@ -971,57 +989,25 @@ public abstract class Display extends Entity { ); } - public Display.TextDisplay.CachedInfo cacheDisplay(Display.TextDisplay.LineSplitter splitter) { + public CachedInfo cacheDisplay(LineSplitter splitter) { if (this.clientDisplayCache == null) { if (this.textRenderState != null) { this.clientDisplayCache = splitter.split(this.textRenderState.text(), this.textRenderState.lineWidth()); } else { - this.clientDisplayCache = new Display.TextDisplay.CachedInfo(List.of(), 0); + this.clientDisplayCache = new CachedInfo(List.of(), 0); } } return this.clientDisplayCache; } - public static Display.TextDisplay.Align getAlign(byte flags) { + public static Align getAlign(byte flags) { if ((flags & 8) != 0) { - return Display.TextDisplay.Align.LEFT; + return Align.LEFT; } else { - return (flags & 16) != 0 ? Display.TextDisplay.Align.RIGHT : Display.TextDisplay.Align.CENTER; + return (flags & 16) != 0 ? Align.RIGHT : Align.CENTER; } } - - public static enum Align implements StringRepresentable { - CENTER("center"), - LEFT("left"), - RIGHT("right"); - - public static final Codec CODEC = StringRepresentable.fromEnum(Display.TextDisplay.Align::values); - private final String name; - - private Align(final String name) { - this.name = name; - } - - @Override - public String getSerializedName() { - return this.name; - } - } - - public record CachedInfo(List lines, int width) { - } - - public record CachedLine(FormattedCharSequence contents, int width) { - } - - @FunctionalInterface - public interface LineSplitter { - Display.TextDisplay.CachedInfo split(Component component, int i); - } - - public record TextRenderState(Component text, int lineWidth, Display.IntInterpolator textOpacity, Display.IntInterpolator backgroundColor, byte flags) { - } } record TransformationInterpolator(Transformation previous, Transformation current) implements Display.GenericInterpolator { diff --git a/net/minecraft/world/entity/ElytraAnimationState.java b/net/minecraft/world/entity/ElytraAnimationState.java new file mode 100644 index 00000000..0114da00 --- /dev/null +++ b/net/minecraft/world/entity/ElytraAnimationState.java @@ -0,0 +1,65 @@ +package net.minecraft.world.entity; + +import net.minecraft.util.Mth; +import net.minecraft.world.phys.Vec3; + +public class ElytraAnimationState { + private static final float DEFAULT_X_ROT = (float) (Math.PI / 12); + private static final float DEFAULT_Z_ROT = (float) (-Math.PI / 12); + private float rotX; + private float rotY; + private float rotZ; + private float rotXOld; + private float rotYOld; + private float rotZOld; + private final LivingEntity entity; + + public ElytraAnimationState(LivingEntity livingEntity) { + this.entity = livingEntity; + } + + public void tick() { + this.rotXOld = this.rotX; + this.rotYOld = this.rotY; + this.rotZOld = this.rotZ; + float g; + float h; + float i; + if (this.entity.isFallFlying()) { + float f = 1.0F; + Vec3 vec3 = this.entity.getDeltaMovement(); + if (vec3.y < 0.0) { + Vec3 vec32 = vec3.normalize(); + f = 1.0F - (float)Math.pow(-vec32.y, 1.5); + } + + g = Mth.lerp(f, (float) (Math.PI / 12), (float) (Math.PI / 9)); + h = Mth.lerp(f, (float) (-Math.PI / 12), (float) (-Math.PI / 2)); + i = 0.0F; + } else if (this.entity.isCrouching()) { + g = (float) (Math.PI * 2.0 / 9.0); + h = (float) (-Math.PI / 4); + i = 0.08726646F; + } else { + g = (float) (Math.PI / 12); + h = (float) (-Math.PI / 12); + i = 0.0F; + } + + this.rotX = this.rotX + (g - this.rotX) * 0.3F; + this.rotY = this.rotY + (i - this.rotY) * 0.3F; + this.rotZ = this.rotZ + (h - this.rotZ) * 0.3F; + } + + public float getRotX(float f) { + return Mth.lerp(f, this.rotXOld, this.rotX); + } + + public float getRotY(float f) { + return Mth.lerp(f, this.rotYOld, this.rotY); + } + + public float getRotZ(float f) { + return Mth.lerp(f, this.rotZOld, this.rotZ); + } +} diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java index 93669547..3ceb0aee 100644 --- a/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java @@ -1,6 +1,7 @@ package net.minecraft.world.entity; import com.google.common.collect.ImmutableList; +import com.google.common.collect.Iterables; import com.google.common.collect.Lists; import com.google.common.collect.Sets; import com.google.common.collect.ImmutableList.Builder; @@ -8,8 +9,11 @@ import com.mojang.logging.LogUtils; import it.unimi.dsi.fastutil.floats.FloatArraySet; import it.unimi.dsi.fastutil.floats.FloatArrays; import it.unimi.dsi.fastutil.floats.FloatSet; +import it.unimi.dsi.fastutil.longs.LongOpenHashSet; +import it.unimi.dsi.fastutil.longs.LongSet; import it.unimi.dsi.fastutil.objects.Object2DoubleArrayMap; import it.unimi.dsi.fastutil.objects.Object2DoubleMap; +import it.unimi.dsi.fastutil.objects.ReferenceArraySet; import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; @@ -23,16 +27,16 @@ import java.util.concurrent.atomic.AtomicInteger; import java.util.function.BiConsumer; import java.util.function.Predicate; import java.util.stream.Stream; -import net.minecraft.BlockUtil; import net.minecraft.CrashReport; import net.minecraft.CrashReportCategory; import net.minecraft.CrashReportDetail; import net.minecraft.ReportedException; import net.minecraft.Util; +import net.minecraft.BlockUtil.FoundRectangle; import net.minecraft.advancements.CriteriaTriggers; import net.minecraft.commands.CommandSource; import net.minecraft.commands.CommandSourceStack; -import net.minecraft.commands.arguments.EntityAnchorArgument; +import net.minecraft.commands.arguments.EntityAnchorArgument.Anchor; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.Holder; @@ -51,11 +55,14 @@ import net.minecraft.network.chat.MutableComponent; import net.minecraft.network.protocol.Packet; import net.minecraft.network.protocol.game.ClientGamePacketListener; import net.minecraft.network.protocol.game.ClientboundAddEntityPacket; +import net.minecraft.network.protocol.game.ClientboundTeleportEntityPacket; import net.minecraft.network.protocol.game.VecDeltaCodec; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SyncedDataHolder; import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.network.syncher.SynchedEntityData.DataValue; +import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ServerEntity; @@ -72,6 +79,8 @@ import net.minecraft.tags.FluidTags; import net.minecraft.tags.TagKey; import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; +import net.minecraft.util.profiling.Profiler; +import net.minecraft.util.profiling.ProfilerFiller; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.Nameable; @@ -81,7 +90,7 @@ import net.minecraft.world.entity.item.ItemEntity; import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.projectile.Projectile; import net.minecraft.world.entity.projectile.ProjectileDeflection; -import net.minecraft.world.entity.vehicle.Boat; +import net.minecraft.world.entity.vehicle.AbstractBoat; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; @@ -89,10 +98,9 @@ import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.ChunkPos; import net.minecraft.world.level.ClipContext; import net.minecraft.world.level.Explosion; -import net.minecraft.world.level.GameRules; import net.minecraft.world.level.ItemLike; import net.minecraft.world.level.Level; -import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.ClipContext.Block; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.FenceGateBlock; import net.minecraft.world.level.block.HoneyBlock; @@ -107,17 +115,20 @@ import net.minecraft.world.level.entity.EntityAccess; import net.minecraft.world.level.entity.EntityInLevelCallback; import net.minecraft.world.level.gameevent.DynamicGameEventListener; import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.level.gameevent.GameEvent.Context; import net.minecraft.world.level.levelgen.Heightmap; import net.minecraft.world.level.material.Fluid; import net.minecraft.world.level.material.FluidState; import net.minecraft.world.level.material.PushReaction; -import net.minecraft.world.level.portal.DimensionTransition; import net.minecraft.world.level.portal.PortalShape; +import net.minecraft.world.level.portal.TeleportTransition; +import net.minecraft.world.level.storage.loot.LootTable; import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.HitResult; import net.minecraft.world.phys.Vec2; import net.minecraft.world.phys.Vec3; +import net.minecraft.world.phys.HitResult.Type; import net.minecraft.world.phys.shapes.BooleanOp; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.Shapes; @@ -128,7 +139,7 @@ import net.minecraft.world.scores.Team; import org.jetbrains.annotations.Nullable; import org.slf4j.Logger; -public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess, CommandSource, ScoreHolder { +public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess, ScoreHolder { private static final Logger LOGGER = LogUtils.getLogger(); public static final String ID_TAG = "id"; public static final String PASSENGERS_TAG = "Passengers"; @@ -180,8 +191,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess private Entity.RemovalReason removalReason; public static final float DEFAULT_BB_WIDTH = 0.6F; public static final float DEFAULT_BB_HEIGHT = 1.8F; - public float walkDistO; - public float walkDist; public float moveDist; public float flyDist; public float fallDistance; @@ -190,6 +199,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess public double yOld; public double zOld; public boolean noPhysics; + private boolean wasOnFire; protected final RandomSource random = RandomSource.create(); public int tickCount; private int remainingFireTicks = -this.getFireImmuneTicks(); @@ -219,7 +229,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess private static final EntityDataAccessor DATA_TICKS_FROZEN = SynchedEntityData.defineId(Entity.class, EntityDataSerializers.INT); private EntityInLevelCallback levelCallback = EntityInLevelCallback.NULL; private final VecDeltaCodec packetPositionCodec = new VecDeltaCodec(); - public boolean noCulling; public boolean hasImpulse; @Nullable public PortalProcessor portalProcess; @@ -235,7 +244,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess private float eyeHeight; public boolean isInPowderSnow; public boolean wasInPowderSnow; - public boolean wasOnFire; public Optional mainSupportingBlockPos = Optional.empty(); private boolean onGroundNoBlocks = false; private float crystalSoundIntensity; @@ -243,6 +251,9 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess private boolean hasVisualFire; @Nullable private BlockState inBlockState = null; + private final List movementThisTick = new ArrayList(); + private final Set blocksInside = new ReferenceArraySet<>(); + private final LongSet visitedBlocks = new LongOpenHashSet(); public Entity(EntityType entityType, Level level) { this.type = entityType; @@ -251,7 +262,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess this.position = Vec3.ZERO; this.blockPosition = BlockPos.ZERO; this.chunkPosition = ChunkPos.ZERO; - SynchedEntityData.Builder builder = new SynchedEntityData.Builder(this); + net.minecraft.network.syncher.SynchedEntityData.Builder builder = new net.minecraft.network.syncher.SynchedEntityData.Builder(this); builder.define(DATA_SHARED_FLAGS_ID, (byte)0); builder.define(DATA_AIR_SUPPLY_ID, this.getMaxAirSupply()); builder.define(DATA_CUSTOM_NAME_VISIBLE, false); @@ -327,10 +338,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess return this.tags.remove(tag); } - /** - * Called by the /kill command. - */ - public void kill() { + public void kill(ServerLevel serverLevel) { this.remove(Entity.RemovalReason.KILLED); this.gameEvent(GameEvent.ENTITY_DIE); } @@ -339,7 +347,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess this.remove(Entity.RemovalReason.DISCARDED); } - protected abstract void defineSynchedData(SynchedEntityData.Builder builder); + protected abstract void defineSynchedData(net.minecraft.network.syncher.SynchedEntityData.Builder builder); public SynchedEntityData getEntityData() { return this.entityData; @@ -360,6 +368,9 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess public void onClientRemoval() { } + public void onRemoval(Entity.RemovalReason removalReason) { + } + public void setPose(Pose pose) { this.entityData.set(DATA_POSE, pose); } @@ -439,7 +450,8 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess * Gets called every tick from main Entity class */ public void baseTick() { - this.level().getProfiler().push("entityBaseTick"); + ProfilerFiller profilerFiller = Profiler.get(); + profilerFiller.push("entityBaseTick"); this.inBlockState = null; if (this.isPassenger() && this.getVehicle().isRemoved()) { this.stopRiding(); @@ -449,9 +461,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess this.boardingCooldown--; } - this.walkDistO = this.walkDist; - this.xRotO = this.getXRot(); - this.yRotO = this.getYRot(); this.handlePortal(); if (this.canSpawnSprintParticle()) { this.spawnSprintParticle(); @@ -462,26 +471,28 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess this.updateInWaterStateAndDoFluidPushing(); this.updateFluidOnEyes(); this.updateSwimming(); - if (this.level().isClientSide) { + if (this.level() instanceof ServerLevel serverLevel) { + if (this.remainingFireTicks > 0) { + if (this.fireImmune()) { + this.setRemainingFireTicks(this.remainingFireTicks - 4); + if (this.remainingFireTicks < 0) { + this.clearFire(); + } + } else { + if (this.remainingFireTicks % 20 == 0 && !this.isInLava()) { + this.hurtServer(serverLevel, this.damageSources().onFire(), 1.0F); + } + + this.setRemainingFireTicks(this.remainingFireTicks - 1); + } + + if (this.getTicksFrozen() > 0) { + this.setTicksFrozen(0); + this.level().levelEvent(null, 1009, this.blockPosition, 1); + } + } + } else { this.clearFire(); - } else if (this.remainingFireTicks > 0) { - if (this.fireImmune()) { - this.setRemainingFireTicks(this.remainingFireTicks - 4); - if (this.remainingFireTicks < 0) { - this.clearFire(); - } - } else { - if (this.remainingFireTicks % 20 == 0 && !this.isInLava()) { - this.hurt(this.damageSources().onFire(), 1.0F); - } - - this.setRemainingFireTicks(this.remainingFireTicks - 1); - } - - if (this.getTicksFrozen() > 0) { - this.setTicksFrozen(0); - this.level().levelEvent(null, 1009, this.blockPosition, 1); - } } if (this.isInLava()) { @@ -495,11 +506,11 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } this.firstTick = false; - if (!this.level().isClientSide && this instanceof Leashable) { - Leashable.tickLeash((Entity & Leashable)this); + if (this.level() instanceof ServerLevel serverLevelx && this instanceof Leashable) { + Leashable.tickLeash(serverLevelx, (Entity & Leashable)this); } - this.level().getProfiler().pop(); + profilerFiller.pop(); } public void setSharedFlagOnFire(boolean isOnFire) { @@ -507,7 +518,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } public void checkBelowWorld() { - if (this.getY() < this.level().getMinBuildHeight() - 64) { + if (this.getY() < this.level().getMinY() - 64) { this.onBelowWorld(); } } @@ -543,12 +554,21 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess public void lavaHurt() { if (!this.fireImmune()) { this.igniteForSeconds(15.0F); - if (this.hurt(this.damageSources().lava(), 4.0F)) { - this.playSound(SoundEvents.GENERIC_BURN, 0.4F, 2.0F + this.random.nextFloat() * 0.4F); + if (this.level() instanceof ServerLevel serverLevel + && this.hurtServer(serverLevel, this.damageSources().lava(), 4.0F) + && this.shouldPlayLavaHurtSound() + && !this.isSilent()) { + serverLevel.playSound( + null, this.getX(), this.getY(), this.getZ(), SoundEvents.GENERIC_BURN, this.getSoundSource(), 0.4F, 2.0F + this.random.nextFloat() * 0.4F + ); } } } + protected boolean shouldPlayLavaHurtSound() { + return true; + } + public final void igniteForSeconds(float seconds) { this.igniteForTicks(Mth.floor(seconds * 20.0F)); } @@ -597,9 +617,10 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess this.checkSupportingBlock(onGround, null); } - public void setOnGroundWithMovement(boolean onGround, Vec3 movement) { - this.onGround = onGround; - this.checkSupportingBlock(onGround, movement); + public void setOnGroundWithMovement(boolean bl, boolean bl2, Vec3 vec3) { + this.onGround = bl; + this.horizontalCollision = bl2; + this.checkSupportingBlock(bl, vec3); } public boolean isSupportedBy(BlockPos pos) { @@ -644,7 +665,8 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } } - this.level().getProfiler().push("move"); + ProfilerFiller profilerFiller = Profiler.get(); + profilerFiller.push("move"); if (this.stuckSpeedMultiplier.lengthSqr() > 1.0E-7) { pos = pos.multiply(this.stuckSpeedMultiplier); this.stuckSpeedMultiplier = Vec3.ZERO; @@ -654,11 +676,11 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess pos = this.maybeBackOffFromEdge(pos, type); Vec3 vec3 = this.collide(pos); double d = vec3.lengthSqr(); - if (d > 1.0E-7) { + if (d > 1.0E-7 || pos.lengthSqr() - d < 1.0E-7) { if (this.fallDistance != 0.0F && d >= 1.0) { BlockHitResult blockHitResult = this.level() - .clip(new ClipContext(this.position(), this.position().add(vec3), ClipContext.Block.FALLDAMAGE_RESETTING, ClipContext.Fluid.WATER, this)); - if (blockHitResult.getType() != HitResult.Type.MISS) { + .clip(new ClipContext(this.position(), this.position().add(vec3), Block.FALLDAMAGE_RESETTING, net.minecraft.world.level.ClipContext.Fluid.WATER, this)); + if (blockHitResult.getType() != Type.MISS) { this.resetFallDistance(); } } @@ -666,8 +688,8 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess this.setPos(this.getX() + vec3.x, this.getY() + vec3.y, this.getZ() + vec3.z); } - this.level().getProfiler().pop(); - this.level().getProfiler().push("rest"); + profilerFiller.pop(); + profilerFiller.push("rest"); boolean bl = !Mth.equal(pos.x, vec3.x); boolean bl2 = !Mth.equal(pos.z, vec3.z); this.horizontalCollision = bl || bl2; @@ -679,90 +701,112 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess this.minorHorizontalCollision = false; } - this.setOnGroundWithMovement(this.verticalCollisionBelow, vec3); + this.setOnGroundWithMovement(this.verticalCollisionBelow, this.horizontalCollision, vec3); BlockPos blockPos = this.getOnPosLegacy(); BlockState blockState = this.level().getBlockState(blockPos); - this.checkFallDamage(vec3.y, this.onGround(), blockState, blockPos); + if (!this.level().isClientSide() || this.isControlledByLocalInstance()) { + this.checkFallDamage(vec3.y, this.onGround(), blockState, blockPos); + } + if (this.isRemoved()) { - this.level().getProfiler().pop(); + profilerFiller.pop(); } else { if (this.horizontalCollision) { Vec3 vec32 = this.getDeltaMovement(); this.setDeltaMovement(bl ? 0.0 : vec32.x, vec32.y, bl2 ? 0.0 : vec32.z); } - Block block = blockState.getBlock(); - if (pos.y != vec3.y) { - block.updateEntityAfterFallOn(this.level(), this); - } - - if (this.onGround()) { - block.stepOn(this.level(), blockPos, blockState, this); - } - - Entity.MovementEmission movementEmission = this.getMovementEmission(); - if (movementEmission.emitsAnything() && !this.isPassenger()) { - double e = vec3.x; - double f = vec3.y; - double g = vec3.z; - this.flyDist = this.flyDist + (float)(vec3.length() * 0.6); - BlockPos blockPos2 = this.getOnPos(); - BlockState blockState2 = this.level().getBlockState(blockPos2); - boolean bl3 = this.isStateClimbable(blockState2); - if (!bl3) { - f = 0.0; - } - - this.walkDist = this.walkDist + (float)vec3.horizontalDistance() * 0.6F; - this.moveDist = this.moveDist + (float)Math.sqrt(e * e + f * f + g * g) * 0.6F; - if (this.moveDist > this.nextStep && !blockState2.isAir()) { - boolean bl4 = blockPos2.equals(blockPos); - boolean bl5 = this.vibrationAndSoundEffectsFromBlock(blockPos, blockState, movementEmission.emitsSounds(), bl4, pos); - if (!bl4) { - bl5 |= this.vibrationAndSoundEffectsFromBlock(blockPos2, blockState2, false, movementEmission.emitsEvents(), pos); - } - - if (bl5) { - this.nextStep = this.nextStep(); - } else if (this.isInWater()) { - this.nextStep = this.nextStep(); - if (movementEmission.emitsSounds()) { - this.waterSwimSound(); - } - - if (movementEmission.emitsEvents()) { - this.gameEvent(GameEvent.SWIM); - } - } - } else if (blockState2.isAir()) { - this.processFlappingMovement(); + if (this.isControlledByLocalInstance()) { + net.minecraft.world.level.block.Block block = blockState.getBlock(); + if (pos.y != vec3.y) { + block.updateEntityMovementAfterFallOn(this.level(), this); } } - this.tryCheckInsideBlocks(); - float h = this.getBlockSpeedFactor(); - this.setDeltaMovement(this.getDeltaMovement().multiply(h, 1.0, h)); - if (this.level() - .getBlockStatesIfLoaded(this.getBoundingBox().deflate(1.0E-6)) - .noneMatch(blockStatex -> blockStatex.is(BlockTags.FIRE) || blockStatex.is(Blocks.LAVA))) { - if (this.remainingFireTicks <= 0) { - this.setRemainingFireTicks(-this.getFireImmuneTicks()); - } - - if (this.wasOnFire && (this.isInPowderSnow || this.isInWaterRainOrBubble())) { - this.playEntityOnFireExtinguishedSound(); + if (!this.level().isClientSide() || this.isControlledByLocalInstance()) { + Entity.MovementEmission movementEmission = this.getMovementEmission(); + if (movementEmission.emitsAnything() && !this.isPassenger()) { + this.applyMovementEmissionAndPlaySound(movementEmission, vec3, blockPos, blockState); } } - if (this.isOnFire() && (this.isInPowderSnow || this.isInWaterRainOrBubble())) { + float f = this.getBlockSpeedFactor(); + this.setDeltaMovement(this.getDeltaMovement().multiply(f, 1.0, f)); + profilerFiller.pop(); + } + } + } + + private void applyMovementEmissionAndPlaySound(Entity.MovementEmission movementEmission, Vec3 vec3, BlockPos blockPos, BlockState blockState) { + float f = 0.6F; + float g = (float)(vec3.length() * 0.6F); + float h = (float)(vec3.horizontalDistance() * 0.6F); + BlockPos blockPos2 = this.getOnPos(); + BlockState blockState2 = this.level().getBlockState(blockPos2); + boolean bl = this.isStateClimbable(blockState2); + this.moveDist += bl ? g : h; + this.flyDist += g; + if (this.moveDist > this.nextStep && !blockState2.isAir()) { + boolean bl2 = blockPos2.equals(blockPos); + boolean bl3 = this.vibrationAndSoundEffectsFromBlock(blockPos, blockState, movementEmission.emitsSounds(), bl2, vec3); + if (!bl2) { + bl3 |= this.vibrationAndSoundEffectsFromBlock(blockPos2, blockState2, false, movementEmission.emitsEvents(), vec3); + } + + if (bl3) { + this.nextStep = this.nextStep(); + } else if (this.isInWater()) { + this.nextStep = this.nextStep(); + if (movementEmission.emitsSounds()) { + this.waterSwimSound(); + } + + if (movementEmission.emitsEvents()) { + this.gameEvent(GameEvent.SWIM); + } + } + } else if (blockState2.isAir()) { + this.processFlappingMovement(); + } + } + + public void applyEffectsFromBlocks() { + this.applyEffectsFromBlocks(this.oldPosition(), this.position); + } + + public void applyEffectsFromBlocks(Vec3 vec3, Vec3 vec32) { + if (this.isAffectedByBlocks()) { + if (this.onGround()) { + BlockPos blockPos = this.getOnPosLegacy(); + BlockState blockState = this.level().getBlockState(blockPos); + blockState.getBlock().stepOn(this.level(), blockPos, blockState, this); + } + + this.movementThisTick.add(new Entity.Movement(vec3, vec32)); + this.checkInsideBlocks(this.movementThisTick, this.blocksInside); + boolean bl = Iterables.any(this.blocksInside, blockStatex -> blockStatex.is(BlockTags.FIRE) || blockStatex.is(Blocks.LAVA)); + this.movementThisTick.clear(); + this.blocksInside.clear(); + if (!bl && this.isAlive()) { + if (this.remainingFireTicks <= 0) { this.setRemainingFireTicks(-this.getFireImmuneTicks()); } - this.level().getProfiler().pop(); + if (this.wasOnFire && (this.isInPowderSnow || this.isInWaterRainOrBubble())) { + this.playEntityOnFireExtinguishedSound(); + } + } + + if (this.isOnFire() && (this.isInPowderSnow || this.isInWaterRainOrBubble())) { + this.setRemainingFireTicks(-this.getFireImmuneTicks()); } } } + protected boolean isAffectedByBlocks() { + return !this.isRemoved() && !this.noPhysics; + } + private boolean isStateClimbable(BlockState state) { return state.is(BlockTags.CLIMBABLE) || state.is(Blocks.POWDER_SNOW); } @@ -778,7 +822,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } if (broadcastGameEvent) { - this.level().gameEvent(GameEvent.STEP, this.position(), GameEvent.Context.of(this, state)); + this.level().gameEvent(GameEvent.STEP, this.position(), Context.of(this, state)); } return true; @@ -792,17 +836,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess return false; } - protected void tryCheckInsideBlocks() { - try { - this.checkInsideBlocks(); - } catch (Throwable var4) { - CrashReport crashReport = CrashReport.forThrowable(var4, "Checking entity block collision"); - CrashReportCategory crashReportCategory = crashReport.addCategory("Entity being checked for collision"); - this.fillCrashReportCategory(crashReportCategory); - throw new ReportedException(crashReport); - } - } - protected void playEntityOnFireExtinguishedSound() { this.playSound(SoundEvents.GENERIC_EXTINGUISH_FIRE, 0.7F, 1.6F + (this.random.nextFloat() - this.random.nextFloat()) * 0.4F); } @@ -1038,38 +1071,58 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess return SoundEvents.GENERIC_SPLASH; } - protected void checkInsideBlocks() { - AABB aABB = this.getBoundingBox(); - BlockPos blockPos = BlockPos.containing(aABB.minX + 1.0E-7, aABB.minY + 1.0E-7, aABB.minZ + 1.0E-7); - BlockPos blockPos2 = BlockPos.containing(aABB.maxX - 1.0E-7, aABB.maxY - 1.0E-7, aABB.maxZ - 1.0E-7); - if (this.level().hasChunksAt(blockPos, blockPos2)) { - BlockPos.MutableBlockPos mutableBlockPos = new BlockPos.MutableBlockPos(); + public void recordMovementThroughBlocks(Vec3 vec3, Vec3 vec32) { + this.movementThisTick.add(new Entity.Movement(vec3, vec32)); + } - for (int i = blockPos.getX(); i <= blockPos2.getX(); i++) { - for (int j = blockPos.getY(); j <= blockPos2.getY(); j++) { - for (int k = blockPos.getZ(); k <= blockPos2.getZ(); k++) { - if (!this.isAlive()) { - return; - } + private void checkInsideBlocks(List list, Set set) { + if (this.isAffectedByBlocks()) { + AABB aABB = this.getBoundingBox().deflate(1.0E-5F); + LongSet longSet = this.visitedBlocks; - mutableBlockPos.set(i, j, k); - BlockState blockState = this.level().getBlockState(mutableBlockPos); + for (Entity.Movement movement : list) { + Vec3 vec3 = movement.from(); + Vec3 vec32 = movement.to(); + for (BlockPos blockPos : BlockGetter.boxTraverseBlocks(vec3, vec32, aABB)) { + if (!this.isAlive()) { + return; + } + + BlockState blockState = this.level().getBlockState(blockPos); + if (!blockState.isAir() && longSet.add(blockPos.asLong())) { try { - blockState.entityInside(this.level(), mutableBlockPos, this); + VoxelShape voxelShape = blockState.getEntityInsideCollisionShape(this.level(), blockPos); + if (voxelShape != Shapes.block() && !this.collidedWithShapeMovingFrom(vec3, vec32, blockPos, voxelShape)) { + continue; + } + + blockState.entityInside(this.level(), blockPos, this); this.onInsideBlock(blockState); - } catch (Throwable var12) { - CrashReport crashReport = CrashReport.forThrowable(var12, "Colliding entity with block"); + } catch (Throwable var16) { + CrashReport crashReport = CrashReport.forThrowable(var16, "Colliding entity with block"); CrashReportCategory crashReportCategory = crashReport.addCategory("Block being collided with"); - CrashReportCategory.populateBlockDetails(crashReportCategory, this.level(), mutableBlockPos, blockState); + CrashReportCategory.populateBlockDetails(crashReportCategory, this.level(), blockPos, blockState); + CrashReportCategory crashReportCategory2 = crashReport.addCategory("Entity being checked for collision"); + this.fillCrashReportCategory(crashReportCategory2); throw new ReportedException(crashReport); } + + set.add(blockState); } } } + + longSet.clear(); } } + private boolean collidedWithShapeMovingFrom(Vec3 vec3, Vec3 vec32, BlockPos blockPos, VoxelShape voxelShape) { + AABB aABB = this.getBoundingBox().move(this.getBoundingBox().getCenter().scale(-1.0)).move(vec32); + Vec3 vec33 = vec3.subtract(aABB.getBottomCenter()); + return this.getBoundingBox().collidedAlongVector(vec33, voxelShape.move(new Vec3(blockPos)).toAabbs()); + } + protected void onInsideBlock(BlockState state) { } @@ -1214,7 +1267,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess .gameEvent( GameEvent.HIT_GROUND, this.position, - GameEvent.Context.of(this, (BlockState)this.mainSupportingBlockPos.map(blockPos -> this.level().getBlockState(blockPos)).orElse(state)) + Context.of(this, (BlockState)this.mainSupportingBlockPos.map(blockPos -> this.level().getBlockState(blockPos)).orElse(state)) ); } @@ -1298,7 +1351,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } void updateInWaterStateAndDoWaterCurrentPushing() { - if (this.getVehicle() instanceof Boat boat && !boat.isUnderWater()) { + if (this.getVehicle() instanceof AbstractBoat abstractBoat && !abstractBoat.isUnderWater()) { this.wasTouchingWater = false; } else if (this.updateFluidHeightAndDoFluidPushing(FluidTags.WATER, 0.014)) { if (!this.wasTouchingWater && !this.firstTick) { @@ -1317,7 +1370,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess this.wasEyeInWater = this.isEyeInFluid(FluidTags.WATER); this.fluidOnEyes.clear(); double d = this.getEyeY(); - if (!(this.getVehicle() instanceof Boat boat && !boat.isUnderWater() && boat.getBoundingBox().maxY >= d && boat.getBoundingBox().minY <= d)) { + if (!( + this.getVehicle() instanceof AbstractBoat abstractBoat + && !abstractBoat.isUnderWater() + && abstractBoat.getBoundingBox().maxY >= d + && abstractBoat.getBoundingBox().minY <= d + )) { BlockPos blockPos = BlockPos.containing(this.getX(), d, this.getZ()); FluidState fluidState = this.level().getFluidState(blockPos); double e = blockPos.getY() + fluidState.getHeight(this.level(), blockPos); @@ -1404,7 +1462,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess this.setDeltaMovement(this.getDeltaMovement().add(vec3)); } - private static Vec3 getInputVector(Vec3 relative, float motionScaler, float facing) { + protected static Vec3 getInputVector(Vec3 relative, float motionScaler, float facing) { double d = relative.lengthSqr(); if (d < 1.0E-7) { return Vec3.ZERO; @@ -1475,17 +1533,36 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } public final void setOldPosAndRot() { - double d = this.getX(); - double e = this.getY(); - double f = this.getZ(); - this.xo = d; - this.yo = e; - this.zo = f; - this.xOld = d; - this.yOld = e; - this.zOld = f; - this.yRotO = this.getYRot(); - this.xRotO = this.getXRot(); + this.setOldPos(); + this.setOldRot(); + } + + public final void setOldPosAndRot(Vec3 vec3, float f, float g) { + this.setOldPos(vec3); + this.setOldRot(f, g); + } + + protected void setOldPos() { + this.setOldPos(this.position); + } + + public void setOldRot() { + this.setOldRot(this.getYRot(), this.getXRot()); + } + + private void setOldPos(Vec3 vec3) { + this.xo = this.xOld = vec3.x; + this.yo = this.yOld = vec3.y; + this.zo = this.zOld = vec3.z; + } + + private void setOldRot(float f, float g) { + this.yRotO = f; + this.xRotO = g; + } + + public final Vec3 oldPosition() { + return new Vec3(this.xOld, this.yOld, this.zOld); } /** @@ -1581,18 +1658,24 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess this.hurtMarked = true; } - /** - * Called when the entity is attacked. - */ - public boolean hurt(DamageSource source, float amount) { - if (this.isInvulnerableTo(source)) { - return false; - } else { - this.markHurt(); - return false; + @Deprecated + public final void hurt(DamageSource damageSource, float f) { + if (this.level instanceof ServerLevel serverLevel) { + this.hurtServer(serverLevel, damageSource, f); } } + @Deprecated + public final boolean hurtOrSimulate(DamageSource damageSource, float f) { + return this.level instanceof ServerLevel serverLevel ? this.hurtServer(serverLevel, damageSource, f) : this.hurtClient(damageSource); + } + + public abstract boolean hurtServer(ServerLevel serverLevel, DamageSource damageSource, float f); + + public boolean hurtClient(DamageSource damageSource) { + return false; + } + /** * Gets the interpolated look vector. */ @@ -1601,21 +1684,29 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } public Direction getNearestViewDirection() { - return Direction.getNearest(this.getViewVector(1.0F)); + return Direction.getApproximateNearest(this.getViewVector(1.0F)); } /** * Returns the current X rotation of the entity. */ public float getViewXRot(float partialTicks) { - return partialTicks == 1.0F ? this.getXRot() : Mth.lerp(partialTicks, this.xRotO, this.getXRot()); + return this.getXRot(partialTicks); } /** * Returns the current Y rotation of the entity. */ public float getViewYRot(float partialTick) { - return partialTick == 1.0F ? this.getYRot() : Mth.lerp(partialTick, this.yRotO, this.getYRot()); + return this.getYRot(partialTick); + } + + public float getXRot(float f) { + return f == 1.0F ? this.getXRot() : Mth.lerp(f, this.xRotO, this.getXRot()); + } + + public float getYRot(float f) { + return f == 1.0F ? this.getYRot() : Mth.rotLerp(f, this.yRotO, this.getYRot()); } /** @@ -1665,7 +1756,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess Vec3 vec3 = this.getEyePosition(partialTicks); Vec3 vec32 = this.getViewVector(partialTicks); Vec3 vec33 = vec3.add(vec32.x * hitDistance, vec32.y * hitDistance, vec32.z * hitDistance); - return this.level().clip(new ClipContext(vec3, vec33, ClipContext.Block.OUTLINE, hitFluids ? ClipContext.Fluid.ANY : ClipContext.Fluid.NONE, this)); + return this.level() + .clip( + new ClipContext( + vec3, vec33, Block.OUTLINE, hitFluids ? net.minecraft.world.level.ClipContext.Fluid.ANY : net.minecraft.world.level.ClipContext.Fluid.NONE, this + ) + ); } public boolean canBeHitByProjectile() { @@ -1843,6 +1939,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess double e = listTag2.getDouble(1); double f = listTag2.getDouble(2); this.setDeltaMovement(Math.abs(d) > 10.0 ? 0.0 : d, Math.abs(e) > 10.0 ? 0.0 : e, Math.abs(f) > 10.0 ? 0.0 : f); + this.hasImpulse = true; double g = 3.0000512E7; this.setPosRaw( Mth.clamp(listTag.getDouble(0), -3.0000512E7, 3.0000512E7), @@ -1962,33 +2059,28 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } @Nullable - public ItemEntity spawnAtLocation(ItemLike item) { - return this.spawnAtLocation(item, 0); + public ItemEntity spawnAtLocation(ServerLevel serverLevel, ItemLike itemLike) { + return this.spawnAtLocation(serverLevel, itemLike, 0); } @Nullable - public ItemEntity spawnAtLocation(ItemLike item, int offsetY) { - return this.spawnAtLocation(new ItemStack(item), (float)offsetY); + public ItemEntity spawnAtLocation(ServerLevel serverLevel, ItemLike itemLike, int i) { + return this.spawnAtLocation(serverLevel, new ItemStack(itemLike), (float)i); } @Nullable - public ItemEntity spawnAtLocation(ItemStack stack) { - return this.spawnAtLocation(stack, 0.0F); + public ItemEntity spawnAtLocation(ServerLevel serverLevel, ItemStack itemStack) { + return this.spawnAtLocation(serverLevel, itemStack, 0.0F); } - /** - * Drops an item at the position of the entity. - */ @Nullable - public ItemEntity spawnAtLocation(ItemStack stack, float offsetY) { - if (stack.isEmpty()) { - return null; - } else if (this.level().isClientSide) { + public ItemEntity spawnAtLocation(ServerLevel serverLevel, ItemStack itemStack, float f) { + if (itemStack.isEmpty()) { return null; } else { - ItemEntity itemEntity = new ItemEntity(this.level(), this.getX(), this.getY() + offsetY, this.getZ(), stack); + ItemEntity itemEntity = new ItemEntity(serverLevel, this.getX(), this.getY() + f, this.getZ(), itemStack); itemEntity.setDefaultPickUpDelay(); - this.level().addFreshEntity(itemEntity); + serverLevel.addFreshEntity(itemEntity); return itemEntity; } } @@ -2031,7 +2123,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess this.gameEvent(GameEvent.ENTITY_INTERACT, player); } - return InteractionResult.sidedSuccess(this.level().isClientSide); + return InteractionResult.SUCCESS; } ItemStack itemStack = player.getItemInHand(hand); @@ -2041,7 +2133,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } itemStack.shrink(1); - return InteractionResult.sidedSuccess(this.level().isClientSide); + return InteractionResult.SUCCESS; } } @@ -2115,6 +2207,8 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess return false; } else if (!vehicle.couldAcceptPassenger()) { return false; + } else if (!this.level().isClientSide() && !vehicle.type.canSerialize()) { + return false; } else { for (Entity entity = vehicle; entity.vehicle != null; entity = entity.vehicle) { if (entity.vehicle == this) { @@ -2212,6 +2306,9 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess return true; } + public void cancelLerp() { + } + public void lerpTo(double x, double y, double z, float yRot, float xRot, int steps) { this.setPos(x, y, z); this.setRot(yRot, xRot); @@ -2277,11 +2374,11 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess if (this.isOnPortalCooldown()) { this.setPortalCooldown(); } else { - if (this.portalProcess != null && this.portalProcess.isSamePortal(portal)) { + if (this.portalProcess == null || !this.portalProcess.isSamePortal(portal)) { + this.portalProcess = new PortalProcessor(portal, pos.immutable()); + } else if (!this.portalProcess.isInsidePortalThisTick()) { this.portalProcess.updateEntryPosition(pos.immutable()); this.portalProcess.setAsInsidePortalThisTick(true); - } else { - this.portalProcess = new PortalProcessor(portal, pos.immutable()); } } } @@ -2291,18 +2388,19 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess this.processPortalCooldown(); if (this.portalProcess != null) { if (this.portalProcess.processPortalTeleportation(serverLevel, this, this.canUsePortal(false))) { - serverLevel.getProfiler().push("portal"); + ProfilerFiller profilerFiller = Profiler.get(); + profilerFiller.push("portal"); this.setPortalCooldown(); - DimensionTransition dimensionTransition = this.portalProcess.getPortalDestination(serverLevel, this); - if (dimensionTransition != null) { - ServerLevel serverLevel2 = dimensionTransition.newLevel(); + TeleportTransition teleportTransition = this.portalProcess.getPortalDestination(serverLevel, this); + if (teleportTransition != null) { + ServerLevel serverLevel2 = teleportTransition.newLevel(); if (serverLevel.getServer().isLevelEnabled(serverLevel2) - && (serverLevel2.dimension() == serverLevel.dimension() || this.canChangeDimensions(serverLevel, serverLevel2))) { - this.changeDimension(dimensionTransition); + && (serverLevel2.dimension() == serverLevel.dimension() || this.canTeleport(serverLevel, serverLevel2))) { + this.teleport(teleportTransition); } } - serverLevel.getProfiler().pop(); + profilerFiller.pop(); } else if (this.portalProcess.hasExpired()) { this.portalProcess = null; } @@ -2472,14 +2570,18 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess /** * Returns whether this Entity is on the same team as the given Entity. */ - public boolean isAlliedTo(Entity entity) { + public final boolean isAlliedTo(@Nullable Entity entity) { + return entity == null ? false : this == entity || this.considersEntityAsAlly(entity) || entity.considersEntityAsAlly(this); + } + + protected boolean considersEntityAsAlly(Entity entity) { return this.isAlliedTo(entity.getTeam()); } /** * Returns whether this Entity is on the given scoreboard team. */ - public boolean isAlliedTo(Team team) { + public boolean isAlliedTo(@Nullable Team team) { return this.getTeam() != null ? this.getTeam().isAlliedTo(team) : false; } @@ -2545,7 +2647,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess this.igniteForSeconds(8.0F); } - this.hurt(this.damageSources().lightningBolt(), 5.0F); + this.hurtServer(level, this.damageSources().lightningBolt(), 5.0F); } public void onAboveBubbleCol(boolean downwards) { @@ -2708,14 +2810,11 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess ); } - /** - * Returns whether this Entity is invulnerable to the given DamageSource. - */ - public boolean isInvulnerableTo(DamageSource source) { + protected final boolean isInvulnerableToBase(DamageSource damageSource) { return this.isRemoved() - || this.invulnerable && !source.is(DamageTypeTags.BYPASSES_INVULNERABILITY) && !source.isCreativePlayer() - || source.is(DamageTypeTags.IS_FIRE) && this.fireImmune() - || source.is(DamageTypeTags.IS_FALL) && this.getType().is(EntityTypeTags.FALL_DAMAGE_IMMUNE); + || this.invulnerable && !damageSource.is(DamageTypeTags.BYPASSES_INVULNERABILITY) && !damageSource.isCreativePlayer() + || damageSource.is(DamageTypeTags.IS_FIRE) && this.fireImmune() + || damageSource.is(DamageTypeTags.IS_FALL) && this.getType().is(EntityTypeTags.FALL_DAMAGE_IMMUNE); } public boolean isInvulnerable() { @@ -2748,50 +2847,120 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } @Nullable - public Entity changeDimension(DimensionTransition transition) { + public Entity teleport(TeleportTransition teleportTransition) { if (this.level() instanceof ServerLevel serverLevel && !this.isRemoved()) { - ServerLevel serverLevel2 = transition.newLevel(); - List list = this.getPassengers(); - this.unRide(); - List list2 = new ArrayList(); - - for (Entity entity : list) { - Entity entity2 = entity.changeDimension(transition); - if (entity2 != null) { - list2.add(entity2); - } + ServerLevel serverLevel2 = teleportTransition.newLevel(); + boolean bl = serverLevel2.dimension() != serverLevel.dimension(); + if (!teleportTransition.asPassenger()) { + this.stopRiding(); } - serverLevel.getProfiler().push("changeDimension"); - Entity entity3 = serverLevel2.dimension() == serverLevel.dimension() ? this : this.getType().create(serverLevel2); - if (entity3 != null) { - if (this != entity3) { - entity3.restoreFrom(this); - this.removeAfterChangingDimensions(); - } - - entity3.moveTo(transition.pos().x, transition.pos().y, transition.pos().z, transition.yRot(), entity3.getXRot()); - entity3.setDeltaMovement(transition.speed()); - if (this != entity3) { - serverLevel2.addDuringTeleport(entity3); - } - - for (Entity entity2 : list2) { - entity2.startRiding(entity3, true); - } - - serverLevel.resetEmptyTime(); - serverLevel2.resetEmptyTime(); - transition.postDimensionTransition().onTransition(entity3); - } - - serverLevel.getProfiler().pop(); - return entity3; + return bl ? this.teleportCrossDimension(serverLevel2, teleportTransition) : this.teleportSameDimension(serverLevel, teleportTransition); } else { return null; } } + private Entity teleportSameDimension(ServerLevel serverLevel, TeleportTransition teleportTransition) { + for (Entity entity : this.getPassengers()) { + entity.teleport(this.calculatePassengerTransition(teleportTransition, entity)); + } + + ProfilerFiller profilerFiller = Profiler.get(); + profilerFiller.push("teleportSameDimension"); + this.teleportSetPosition(PositionMoveRotation.of(teleportTransition), teleportTransition.relatives()); + if (!teleportTransition.asPassenger()) { + this.sendTeleportTransitionToRidingPlayers(teleportTransition); + } + + teleportTransition.postTeleportTransition().onTransition(this); + profilerFiller.pop(); + return this; + } + + private Entity teleportCrossDimension(ServerLevel serverLevel, TeleportTransition teleportTransition) { + List list = this.getPassengers(); + List list2 = new ArrayList(list.size()); + this.ejectPassengers(); + + for (Entity entity : list) { + Entity entity2 = entity.teleport(this.calculatePassengerTransition(teleportTransition, entity)); + if (entity2 != null) { + list2.add(entity2); + } + } + + ProfilerFiller profilerFiller = Profiler.get(); + profilerFiller.push("teleportCrossDimension"); + Entity entityx = this.getType().create(serverLevel, EntitySpawnReason.DIMENSION_TRAVEL); + if (entityx == null) { + profilerFiller.pop(); + return null; + } else { + entityx.restoreFrom(this); + this.removeAfterChangingDimensions(); + entityx.teleportSetPosition(PositionMoveRotation.of(teleportTransition), teleportTransition.relatives()); + serverLevel.addDuringTeleport(entityx); + + for (Entity entity3 : list2) { + entity3.startRiding(entityx, true); + } + + serverLevel.resetEmptyTime(); + teleportTransition.postTeleportTransition().onTransition(entityx); + profilerFiller.pop(); + return entityx; + } + } + + private TeleportTransition calculatePassengerTransition(TeleportTransition teleportTransition, Entity entity) { + float f = teleportTransition.yRot() + (teleportTransition.relatives().contains(Relative.Y_ROT) ? 0.0F : entity.getYRot() - this.getYRot()); + float g = teleportTransition.xRot() + (teleportTransition.relatives().contains(Relative.X_ROT) ? 0.0F : entity.getXRot() - this.getXRot()); + Vec3 vec3 = entity.position().subtract(this.position()); + Vec3 vec32 = teleportTransition.position() + .add( + teleportTransition.relatives().contains(Relative.X) ? 0.0 : vec3.x(), + teleportTransition.relatives().contains(Relative.Y) ? 0.0 : vec3.y(), + teleportTransition.relatives().contains(Relative.Z) ? 0.0 : vec3.z() + ); + return teleportTransition.withPosition(vec32).withRotation(f, g).transitionAsPassenger(); + } + + private void sendTeleportTransitionToRidingPlayers(TeleportTransition teleportTransition) { + Entity entity = this.getControllingPassenger(); + + for (Entity entity2 : this.getIndirectPassengers()) { + if (entity2 instanceof ServerPlayer serverPlayer) { + if (entity != null && serverPlayer.getId() == entity.getId()) { + serverPlayer.connection + .send(ClientboundTeleportEntityPacket.teleport(this.getId(), PositionMoveRotation.of(teleportTransition), teleportTransition.relatives(), this.onGround)); + } else { + serverPlayer.connection.send(ClientboundTeleportEntityPacket.teleport(this.getId(), PositionMoveRotation.of(this), Set.of(), this.onGround)); + } + } + } + } + + public void teleportSetPosition(PositionMoveRotation positionMoveRotation, Set set) { + PositionMoveRotation positionMoveRotation2 = PositionMoveRotation.of(this); + PositionMoveRotation positionMoveRotation3 = PositionMoveRotation.calculateAbsolute(positionMoveRotation2, positionMoveRotation, set); + this.setPosRaw(positionMoveRotation3.position().x, positionMoveRotation3.position().y, positionMoveRotation3.position().z); + this.setYRot(positionMoveRotation3.yRot()); + this.setYHeadRot(positionMoveRotation3.yRot()); + this.setXRot(positionMoveRotation3.xRot()); + this.reapplyPosition(); + this.setOldPosAndRot(); + this.setDeltaMovement(positionMoveRotation3.deltaMovement()); + this.movementThisTick.clear(); + } + + public void forceSetRotation(float f, float g) { + this.setYRot(f); + this.setYHeadRot(f); + this.setXRot(g); + this.setOldRot(); + } + public void placePortalTicket(BlockPos pos) { if (this.level() instanceof ServerLevel serverLevel) { serverLevel.getChunkSource().addRegionTicket(TicketType.PORTAL, new ChunkPos(pos), 3, pos); @@ -2805,7 +2974,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } } - public Vec3 getRelativePortalPosition(Direction.Axis axis, BlockUtil.FoundRectangle portal) { + public Vec3 getRelativePortalPosition(Direction.Axis axis, FoundRectangle portal) { return PortalShape.getRelativePosition(portal, axis, this.position(), this.getDimensions(this.getPose())); } @@ -2813,7 +2982,15 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess return (allowPassengers || !this.isPassenger()) && this.isAlive(); } - public boolean canChangeDimensions(Level oldLevel, Level newLevel) { + public boolean canTeleport(Level level, Level level2) { + if (level.dimension() == Level.END && level2.dimension() == Level.OVERWORLD) { + for (Entity entity : this.getPassengers()) { + if (entity instanceof ServerPlayer serverPlayer && !serverPlayer.seenCredits) { + return false; + } + } + } + return true; } @@ -2925,27 +3102,10 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess return this.entityData.get(DATA_CUSTOM_NAME_VISIBLE); } - public boolean teleportTo(ServerLevel level, double x, double y, double z, Set relativeMovements, float yRot, float xRot) { - float f = Mth.clamp(xRot, -90.0F, 90.0F); - if (level == this.level()) { - this.moveTo(x, y, z, yRot, f); - this.teleportPassengers(); - this.setYHeadRot(yRot); - } else { - this.unRide(); - Entity entity = this.getType().create(level); - if (entity == null) { - return false; - } - - entity.restoreFrom(this); - entity.moveTo(x, y, z, yRot, f); - entity.setYHeadRot(yRot); - this.setRemoved(Entity.RemovalReason.CHANGED_DIMENSION); - level.addDuringTeleport(entity); - } - - return true; + public boolean teleportTo(ServerLevel serverLevel, double d, double e, double f, Set set, float g, float h, boolean bl) { + float i = Mth.clamp(h, -90.0F, 90.0F); + Entity entity = this.teleport(new TeleportTransition(serverLevel, new Vec3(d, e, f), Vec3.ZERO, g, i, set, TeleportTransition.DO_NOTHING)); + return entity != null; } public void dismountTo(double x, double y, double z) { @@ -2979,7 +3139,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } @Override - public void onSyncedDataUpdated(List> newData) { + public void onSyncedDataUpdated(List> newData) { } @Override @@ -3004,7 +3164,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess this.dimensions = entityDimensions2; this.eyeHeight = entityDimensions2.eyeHeight(); this.reapplyPosition(); - boolean bl = entityDimensions2.width() <= 4.0 && entityDimensions2.height() <= 4.0; + boolean bl = entityDimensions2.width() <= 4.0F && entityDimensions2.height() <= 4.0F; if (!this.level.isClientSide && !this.firstTick && !this.noPhysics @@ -3066,13 +3226,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess return this.bb; } - /** - * Gets the bounding box of this Entity, adjusted to take auxiliary entities into account (e.g. the tile contained by a minecart, such as a command block). - */ - public AABB getBoundingBoxForCulling() { - return this.getBoundingBox(); - } - public final void setBoundingBox(AABB bb) { this.bb = bb; } @@ -3097,10 +3250,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess return SlotAccess.NULL; } - @Override - public void sendSystemMessage(Component component) { - } - /** * Get the world, if available. {@code null} is not allowed! If you are not an entity in the world, return the overworld */ @@ -3263,10 +3412,19 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } } + public boolean isControlledByOrIsLocalPlayer() { + return this instanceof Player player ? player.isLocalPlayer() : this.isControlledByLocalInstance(); + } + public boolean isControlledByLocalInstance() { return this.getControllingPassenger() instanceof Player player ? player.isLocalPlayer() : this.isEffectiveAi(); } + public boolean isControlledByClient() { + LivingEntity livingEntity = this.getControllingPassenger(); + return livingEntity != null && livingEntity.isControlledByClient(); + } + public boolean isEffectiveAi() { return !this.level().isClientSide; } @@ -3308,44 +3466,21 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess return 1; } - public CommandSourceStack createCommandSourceStack() { + public CommandSourceStack createCommandSourceStackForNameResolution(ServerLevel serverLevel) { return new CommandSourceStack( - this, + CommandSource.NULL, this.position(), this.getRotationVector(), - this.level() instanceof ServerLevel ? (ServerLevel)this.level() : null, - this.getPermissionLevel(), + serverLevel, + 0, this.getName().getString(), this.getDisplayName(), - this.level().getServer(), + serverLevel.getServer(), this ); } - protected int getPermissionLevel() { - return 0; - } - - public boolean hasPermissions(int level) { - return this.getPermissionLevel() >= level; - } - - @Override - public boolean acceptsSuccess() { - return this.level().getGameRules().getBoolean(GameRules.RULE_SENDCOMMANDFEEDBACK); - } - - @Override - public boolean acceptsFailure() { - return true; - } - - @Override - public boolean shouldInformAdmins() { - return true; - } - - public void lookAt(EntityAnchorArgument.Anchor anchor, Vec3 target) { + public void lookAt(Anchor anchor, Vec3 target) { Vec3 vec3 = anchor.apply(this); double d = target.x - vec3.x; double e = target.y - vec3.y; @@ -3596,9 +3731,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess double e = packet.getY(); double f = packet.getZ(); this.syncPacketPositionCodec(d, e, f); - this.moveTo(d, e, f); - this.setXRot(packet.getXRot()); - this.setYRot(packet.getYRot()); + this.moveTo(d, e, f, packet.getYRot(), packet.getXRot()); this.setId(i); this.setUUID(packet.getUUID()); } @@ -3656,7 +3789,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess if (!Float.isFinite(xRot)) { Util.logAndPauseIfInIde("Invalid entity rotation: " + xRot + ", discarding."); } else { - this.xRot = xRot; + this.xRot = Math.clamp(xRot % 360.0F, -90.0F, 90.0F); } } @@ -3692,6 +3825,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess this.getPassengers().forEach(Entity::stopRiding); this.levelCallback.onRemove(removalReason); + this.onRemoval(removalReason); } protected void unsetRemoved() { @@ -3717,7 +3851,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess return false; } - public boolean mayInteract(Level level, BlockPos pos) { + public boolean mayInteract(ServerLevel serverLevel, BlockPos blockPos) { return true; } @@ -3761,11 +3895,18 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess return null; } + public Optional> getLootTable() { + return this.type.getDefaultLootTable(); + } + @FunctionalInterface public interface MoveFunction { void accept(Entity entity, double d, double e, double f); } + record Movement(Vec3 from, Vec3 to) { + } + public static enum MovementEmission { NONE(false, false), SOUNDS(true, false), diff --git a/net/minecraft/world/entity/EntityEvent.java b/net/minecraft/world/entity/EntityEvent.java index 81fd0490..34870586 100644 --- a/net/minecraft/world/entity/EntityEvent.java +++ b/net/minecraft/world/entity/EntityEvent.java @@ -33,7 +33,7 @@ public class EntityEvent { public static final byte FISHING_ROD_REEL_IN = 31; public static final byte ARMORSTAND_WOBBLE = 32; public static final byte STOP_OFFER_FLOWER = 34; - public static final byte TALISMAN_ACTIVATE = 35; + public static final byte PROTECTED_FROM_DEATH = 35; public static final byte DOLPHIN_LOOKING_FOR_TREASURE = 38; public static final byte RAVAGER_STUNNED = 39; public static final byte TRUSTING_FAILED = 40; @@ -59,4 +59,5 @@ public class EntityEvent { public static final byte SNIFFER_DIGGING_SOUND = 63; public static final byte ARMADILLO_PEEK = 64; public static final byte BODY_BREAK = 65; + public static final byte SHAKE = 66; } diff --git a/net/minecraft/world/entity/EntitySelector.java b/net/minecraft/world/entity/EntitySelector.java index ca0a16b0..2a712396 100644 --- a/net/minecraft/world/entity/EntitySelector.java +++ b/net/minecraft/world/entity/EntitySelector.java @@ -4,9 +4,8 @@ import com.google.common.base.Predicates; import java.util.function.Predicate; import net.minecraft.world.Container; import net.minecraft.world.entity.player.Player; -import net.minecraft.world.item.ItemStack; import net.minecraft.world.scores.Team; -import org.jetbrains.annotations.Nullable; +import net.minecraft.world.scores.Team.CollisionRule; public final class EntitySelector { /** @@ -38,6 +37,7 @@ public final class EntitySelector { * Selects entities which are collidable with and aren't spectators */ public static final Predicate CAN_BE_COLLIDED_WITH = NO_SPECTATORS.and(Entity::canBeCollidedWith); + public static final Predicate CAN_BE_PICKED = NO_SPECTATORS.and(Entity::isPickable); private EntitySelector() { } @@ -49,8 +49,8 @@ public final class EntitySelector { public static Predicate pushableBy(Entity entity) { Team team = entity.getTeam(); - Team.CollisionRule collisionRule = team == null ? Team.CollisionRule.ALWAYS : team.getCollisionRule(); - return (Predicate)(collisionRule == Team.CollisionRule.NEVER + CollisionRule collisionRule = team == null ? CollisionRule.ALWAYS : team.getCollisionRule(); + return (Predicate)(collisionRule == CollisionRule.NEVER ? Predicates.alwaysFalse() : NO_SPECTATORS.and( entity2 -> { @@ -58,14 +58,14 @@ public final class EntitySelector { return false; } else if (!entity.level().isClientSide || entity2 instanceof Player && ((Player)entity2).isLocalPlayer()) { Team team2 = entity2.getTeam(); - Team.CollisionRule collisionRule2 = team2 == null ? Team.CollisionRule.ALWAYS : team2.getCollisionRule(); - if (collisionRule2 == Team.CollisionRule.NEVER) { + CollisionRule collisionRule2 = team2 == null ? CollisionRule.ALWAYS : team2.getCollisionRule(); + if (collisionRule2 == CollisionRule.NEVER) { return false; } else { boolean bl = team != null && team.isAlliedTo(team2); - return (collisionRule == Team.CollisionRule.PUSH_OWN_TEAM || collisionRule2 == Team.CollisionRule.PUSH_OWN_TEAM) && bl + return (collisionRule == CollisionRule.PUSH_OWN_TEAM || collisionRule2 == CollisionRule.PUSH_OWN_TEAM) && bl ? false - : collisionRule != Team.CollisionRule.PUSH_OTHER_TEAMS && collisionRule2 != Team.CollisionRule.PUSH_OTHER_TEAMS || bl; + : collisionRule != CollisionRule.PUSH_OTHER_TEAMS && collisionRule2 != CollisionRule.PUSH_OTHER_TEAMS || bl; } } else { return false; @@ -86,20 +86,4 @@ public final class EntitySelector { return true; }; } - - public static class MobCanWearArmorEntitySelector implements Predicate { - private final ItemStack itemStack; - - public MobCanWearArmorEntitySelector(ItemStack stack) { - this.itemStack = stack; - } - - public boolean test(@Nullable Entity entity) { - if (!entity.isAlive()) { - return false; - } else { - return !(entity instanceof LivingEntity livingEntity) ? false : livingEntity.canTakeItem(this.itemStack); - } - } - } } diff --git a/net/minecraft/world/entity/EntitySpawnReason.java b/net/minecraft/world/entity/EntitySpawnReason.java new file mode 100644 index 00000000..bd91ae73 --- /dev/null +++ b/net/minecraft/world/entity/EntitySpawnReason.java @@ -0,0 +1,31 @@ +package net.minecraft.world.entity; + +public enum EntitySpawnReason { + NATURAL, + CHUNK_GENERATION, + SPAWNER, + STRUCTURE, + BREEDING, + MOB_SUMMONED, + JOCKEY, + EVENT, + CONVERSION, + REINFORCEMENT, + TRIGGERED, + BUCKET, + SPAWN_ITEM_USE, + COMMAND, + DISPENSER, + PATROL, + TRIAL_SPAWNER, + LOAD, + DIMENSION_TRAVEL; + + public static boolean isSpawner(EntitySpawnReason entitySpawnReason) { + return entitySpawnReason == SPAWNER || entitySpawnReason == TRIAL_SPAWNER; + } + + public static boolean ignoresLightRequirements(EntitySpawnReason entitySpawnReason) { + return entitySpawnReason == TRIAL_SPAWNER; + } +} diff --git a/net/minecraft/world/entity/EntityType.java b/net/minecraft/world/entity/EntityType.java index 891382d1..dab65127 100644 --- a/net/minecraft/world/entity/EntityType.java +++ b/net/minecraft/world/entity/EntityType.java @@ -7,6 +7,7 @@ import java.util.Optional; import java.util.Spliterator; import java.util.function.Consumer; import java.util.function.Function; +import java.util.function.Supplier; import java.util.stream.Stream; import java.util.stream.StreamSupport; import net.minecraft.Util; @@ -22,6 +23,7 @@ import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.ListTag; import net.minecraft.nbt.Tag; import net.minecraft.network.chat.Component; +import net.minecraft.resources.DependantName; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.MinecraftServer; @@ -113,6 +115,8 @@ import net.minecraft.world.entity.monster.Zombie; import net.minecraft.world.entity.monster.ZombieVillager; import net.minecraft.world.entity.monster.ZombifiedPiglin; import net.minecraft.world.entity.monster.breeze.Breeze; +import net.minecraft.world.entity.monster.creaking.Creaking; +import net.minecraft.world.entity.monster.creaking.CreakingTransient; import net.minecraft.world.entity.monster.hoglin.Hoglin; import net.minecraft.world.entity.monster.piglin.Piglin; import net.minecraft.world.entity.monster.piglin.PiglinBrute; @@ -142,6 +146,7 @@ import net.minecraft.world.entity.projectile.windcharge.BreezeWindCharge; import net.minecraft.world.entity.projectile.windcharge.WindCharge; import net.minecraft.world.entity.vehicle.Boat; import net.minecraft.world.entity.vehicle.ChestBoat; +import net.minecraft.world.entity.vehicle.ChestRaft; import net.minecraft.world.entity.vehicle.Minecart; import net.minecraft.world.entity.vehicle.MinecartChest; import net.minecraft.world.entity.vehicle.MinecartCommandBlock; @@ -149,11 +154,14 @@ import net.minecraft.world.entity.vehicle.MinecartFurnace; import net.minecraft.world.entity.vehicle.MinecartHopper; import net.minecraft.world.entity.vehicle.MinecartSpawner; import net.minecraft.world.entity.vehicle.MinecartTNT; +import net.minecraft.world.entity.vehicle.Raft; import net.minecraft.world.flag.FeatureElement; import net.minecraft.world.flag.FeatureFlag; import net.minecraft.world.flag.FeatureFlagSet; import net.minecraft.world.flag.FeatureFlags; +import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; import net.minecraft.world.item.component.CustomData; import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelReader; @@ -175,6 +183,18 @@ public class EntityType implements FeatureElement, EntityTypeT private final Holder.Reference> builtInRegistryHolder = BuiltInRegistries.ENTITY_TYPE.createIntrusiveHolder(this); private static final float MAGIC_HORSE_WIDTH = 1.3964844F; private static final int DISPLAY_TRACKING_RANGE = 10; + public static final EntityType ACACIA_BOAT = register( + "acacia_boat", + EntityType.Builder.of(boatFactory(() -> Items.ACACIA_BOAT), MobCategory.MISC).noLootTable().sized(1.375F, 0.5625F).eyeHeight(0.5625F).clientTrackingRange(10) + ); + public static final EntityType ACACIA_CHEST_BOAT = register( + "acacia_chest_boat", + EntityType.Builder.of(chestBoatFactory(() -> Items.ACACIA_CHEST_BOAT), MobCategory.MISC) + .noLootTable() + .sized(1.375F, 0.5625F) + .eyeHeight(0.5625F) + .clientTrackingRange(10) + ); public static final EntityType ALLAY = register( "allay", EntityType.Builder.of(Allay::new, MobCategory.CREATURE).sized(0.35F, 0.6F).eyeHeight(0.36F).ridingOffset(0.04F).clientTrackingRange(8).updateInterval(2) @@ -182,6 +202,7 @@ public class EntityType implements FeatureElement, EntityTypeT public static final EntityType AREA_EFFECT_CLOUD = register( "area_effect_cloud", EntityType.Builder.of(AreaEffectCloud::new, MobCategory.MISC) + .noLootTable() .fireImmune() .sized(6.0F, 0.5F) .clientTrackingRange(10) @@ -194,25 +215,47 @@ public class EntityType implements FeatureElement, EntityTypeT "armor_stand", EntityType.Builder.of(ArmorStand::new, MobCategory.MISC).sized(0.5F, 1.975F).eyeHeight(1.7775F).clientTrackingRange(10) ); public static final EntityType ARROW = register( - "arrow", EntityType.Builder.of(Arrow::new, MobCategory.MISC).sized(0.5F, 0.5F).eyeHeight(0.13F).clientTrackingRange(4).updateInterval(20) + "arrow", + EntityType.Builder.of(Arrow::new, MobCategory.MISC).noLootTable().sized(0.5F, 0.5F).eyeHeight(0.13F).clientTrackingRange(4).updateInterval(20) ); public static final EntityType AXOLOTL = register( "axolotl", EntityType.Builder.of(Axolotl::new, MobCategory.AXOLOTLS).sized(0.75F, 0.42F).eyeHeight(0.2751F).clientTrackingRange(10) ); + public static final EntityType BAMBOO_CHEST_RAFT = register( + "bamboo_chest_raft", + EntityType.Builder.of(chestRaftFactory(() -> Items.BAMBOO_CHEST_RAFT), MobCategory.MISC) + .noLootTable() + .sized(1.375F, 0.5625F) + .eyeHeight(0.5625F) + .clientTrackingRange(10) + ); + public static final EntityType BAMBOO_RAFT = register( + "bamboo_raft", + EntityType.Builder.of(raftFactory(() -> Items.BAMBOO_RAFT), MobCategory.MISC).noLootTable().sized(1.375F, 0.5625F).eyeHeight(0.5625F).clientTrackingRange(10) + ); public static final EntityType BAT = register( "bat", EntityType.Builder.of(Bat::new, MobCategory.AMBIENT).sized(0.5F, 0.9F).eyeHeight(0.45F).clientTrackingRange(5) ); public static final EntityType BEE = register( "bee", EntityType.Builder.of(Bee::new, MobCategory.CREATURE).sized(0.7F, 0.6F).eyeHeight(0.3F).clientTrackingRange(8) ); + public static final EntityType BIRCH_BOAT = register( + "birch_boat", + EntityType.Builder.of(boatFactory(() -> Items.BIRCH_BOAT), MobCategory.MISC).noLootTable().sized(1.375F, 0.5625F).eyeHeight(0.5625F).clientTrackingRange(10) + ); + public static final EntityType BIRCH_CHEST_BOAT = register( + "birch_chest_boat", + EntityType.Builder.of(chestBoatFactory(() -> Items.BIRCH_CHEST_BOAT), MobCategory.MISC) + .noLootTable() + .sized(1.375F, 0.5625F) + .eyeHeight(0.5625F) + .clientTrackingRange(10) + ); public static final EntityType BLAZE = register( "blaze", EntityType.Builder.of(Blaze::new, MobCategory.MONSTER).fireImmune().sized(0.6F, 1.8F).clientTrackingRange(8) ); public static final EntityType BLOCK_DISPLAY = register( - "block_display", EntityType.Builder.of(Display.BlockDisplay::new, MobCategory.MISC).sized(0.0F, 0.0F).clientTrackingRange(10).updateInterval(1) - ); - public static final EntityType BOAT = register( - "boat", EntityType.Builder.of(Boat::new, MobCategory.MISC).sized(1.375F, 0.5625F).eyeHeight(0.5625F).clientTrackingRange(10) + "block_display", EntityType.Builder.of(Display.BlockDisplay::new, MobCategory.MISC).noLootTable().sized(0.0F, 0.0F).clientTrackingRange(10).updateInterval(1) ); public static final EntityType BOGGED = register( "bogged", EntityType.Builder.of(Bogged::new, MobCategory.MONSTER).sized(0.6F, 1.99F).eyeHeight(1.74F).ridingOffset(-0.7F).clientTrackingRange(8) @@ -223,6 +266,7 @@ public class EntityType implements FeatureElement, EntityTypeT public static final EntityType BREEZE_WIND_CHARGE = register( "breeze_wind_charge", EntityType.Builder.of(BreezeWindCharge::new, MobCategory.MISC) + .noLootTable() .sized(0.3125F, 0.3125F) .eyeHeight(0.0F) .clientTrackingRange(4) @@ -237,12 +281,21 @@ public class EntityType implements FeatureElement, EntityTypeT public static final EntityType CAVE_SPIDER = register( "cave_spider", EntityType.Builder.of(CaveSpider::new, MobCategory.MONSTER).sized(0.7F, 0.5F).eyeHeight(0.45F).clientTrackingRange(8) ); - public static final EntityType CHEST_BOAT = register( - "chest_boat", EntityType.Builder.of(ChestBoat::new, MobCategory.MISC).sized(1.375F, 0.5625F).eyeHeight(0.5625F).clientTrackingRange(10) + public static final EntityType CHERRY_BOAT = register( + "cherry_boat", + EntityType.Builder.of(boatFactory(() -> Items.CHERRY_BOAT), MobCategory.MISC).noLootTable().sized(1.375F, 0.5625F).eyeHeight(0.5625F).clientTrackingRange(10) + ); + public static final EntityType CHERRY_CHEST_BOAT = register( + "cherry_chest_boat", + EntityType.Builder.of(chestBoatFactory(() -> Items.CHERRY_CHEST_BOAT), MobCategory.MISC) + .noLootTable() + .sized(1.375F, 0.5625F) + .eyeHeight(0.5625F) + .clientTrackingRange(10) ); public static final EntityType CHEST_MINECART = register( "chest_minecart", - EntityType.Builder.of(MinecartChest::new, MobCategory.MISC).sized(0.98F, 0.7F).passengerAttachments(0.1875F).clientTrackingRange(8) + EntityType.Builder.of(MinecartChest::new, MobCategory.MISC).noLootTable().sized(0.98F, 0.7F).passengerAttachments(0.1875F).clientTrackingRange(8) ); public static final EntityType CHICKEN = register( "chicken", @@ -257,17 +310,50 @@ public class EntityType implements FeatureElement, EntityTypeT ); public static final EntityType COMMAND_BLOCK_MINECART = register( "command_block_minecart", - EntityType.Builder.of(MinecartCommandBlock::new, MobCategory.MISC) - .sized(0.98F, 0.7F) - .passengerAttachments(0.1875F) - .clientTrackingRange(8) + EntityType.Builder.of(MinecartCommandBlock::new, MobCategory.MISC).noLootTable().sized(0.98F, 0.7F).passengerAttachments(0.1875F).clientTrackingRange(8) ); public static final EntityType COW = register( "cow", EntityType.Builder.of(Cow::new, MobCategory.CREATURE).sized(0.9F, 1.4F).eyeHeight(1.3F).passengerAttachments(1.36875F).clientTrackingRange(10) ); + public static final EntityType CREAKING = register( + "creaking", + EntityType.Builder.of(Creaking::new, MobCategory.MONSTER) + .fireImmune() + .sized(0.9F, 2.7F) + .eyeHeight(2.3F) + .clientTrackingRange(8) + .requiredFeatures(FeatureFlags.WINTER_DROP) + ); + public static final EntityType CREAKING_TRANSIENT = register( + "creaking_transient", + EntityType.Builder.of(CreakingTransient::new, MobCategory.MONSTER) + .noSave() + .noSummon() + .fireImmune() + .sized(0.9F, 2.7F) + .eyeHeight(2.3F) + .clientTrackingRange(8) + .requiredFeatures(FeatureFlags.WINTER_DROP) + ); public static final EntityType CREEPER = register( "creeper", EntityType.Builder.of(Creeper::new, MobCategory.MONSTER).sized(0.6F, 1.7F).clientTrackingRange(8) ); + public static final EntityType DARK_OAK_BOAT = register( + "dark_oak_boat", + EntityType.Builder.of(boatFactory(() -> Items.DARK_OAK_BOAT), MobCategory.MISC) + .noLootTable() + .sized(1.375F, 0.5625F) + .eyeHeight(0.5625F) + .clientTrackingRange(10) + ); + public static final EntityType DARK_OAK_CHEST_BOAT = register( + "dark_oak_chest_boat", + EntityType.Builder.of(chestBoatFactory(() -> Items.DARK_OAK_CHEST_BOAT), MobCategory.MISC) + .noLootTable() + .sized(1.375F, 0.5625F) + .eyeHeight(0.5625F) + .clientTrackingRange(10) + ); public static final EntityType DOLPHIN = register( "dolphin", EntityType.Builder.of(Dolphin::new, MobCategory.WATER_CREATURE).sized(0.9F, 0.6F).eyeHeight(0.3F) ); @@ -276,7 +362,8 @@ public class EntityType implements FeatureElement, EntityTypeT EntityType.Builder.of(Donkey::new, MobCategory.CREATURE).sized(1.3964844F, 1.5F).eyeHeight(1.425F).passengerAttachments(1.1125F).clientTrackingRange(10) ); public static final EntityType DRAGON_FIREBALL = register( - "dragon_fireball", EntityType.Builder.of(DragonFireball::new, MobCategory.MISC).sized(1.0F, 1.0F).clientTrackingRange(4).updateInterval(10) + "dragon_fireball", + EntityType.Builder.of(DragonFireball::new, MobCategory.MISC).noLootTable().sized(1.0F, 1.0F).clientTrackingRange(4).updateInterval(10) ); public static final EntityType DROWNED = register( "drowned", @@ -288,7 +375,7 @@ public class EntityType implements FeatureElement, EntityTypeT .clientTrackingRange(8) ); public static final EntityType EGG = register( - "egg", EntityType.Builder.of(ThrownEgg::new, MobCategory.MISC).sized(0.25F, 0.25F).clientTrackingRange(4).updateInterval(10) + "egg", EntityType.Builder.of(ThrownEgg::new, MobCategory.MISC).noLootTable().sized(0.25F, 0.25F).clientTrackingRange(4).updateInterval(10) ); public static final EntityType ELDER_GUARDIAN = register( "elder_guardian", @@ -298,17 +385,6 @@ public class EntityType implements FeatureElement, EntityTypeT .passengerAttachments(2.350625F) .clientTrackingRange(10) ); - public static final EntityType END_CRYSTAL = register( - "end_crystal", - EntityType.Builder.of(EndCrystal::new, MobCategory.MISC).fireImmune().sized(2.0F, 2.0F).clientTrackingRange(16).updateInterval(Integer.MAX_VALUE) - ); - public static final EntityType ENDER_DRAGON = register( - "ender_dragon", - EntityType.Builder.of(EnderDragon::new, MobCategory.MONSTER).fireImmune().sized(16.0F, 8.0F).passengerAttachments(3.0F).clientTrackingRange(10) - ); - public static final EntityType ENDER_PEARL = register( - "ender_pearl", EntityType.Builder.of(ThrownEnderpearl::new, MobCategory.MISC).sized(0.25F, 0.25F).clientTrackingRange(4).updateInterval(10) - ); public static final EntityType ENDERMAN = register( "enderman", EntityType.Builder.of(EnderMan::new, MobCategory.MONSTER).sized(0.6F, 2.9F).eyeHeight(2.55F).passengerAttachments(2.80625F).clientTrackingRange(8) @@ -317,29 +393,65 @@ public class EntityType implements FeatureElement, EntityTypeT "endermite", EntityType.Builder.of(Endermite::new, MobCategory.MONSTER).sized(0.4F, 0.3F).eyeHeight(0.13F).passengerAttachments(0.2375F).clientTrackingRange(8) ); + public static final EntityType ENDER_DRAGON = register( + "ender_dragon", + EntityType.Builder.of(EnderDragon::new, MobCategory.MONSTER).fireImmune().sized(16.0F, 8.0F).passengerAttachments(3.0F).clientTrackingRange(10) + ); + public static final EntityType ENDER_PEARL = register( + "ender_pearl", + EntityType.Builder.of(ThrownEnderpearl::new, MobCategory.MISC).noLootTable().sized(0.25F, 0.25F).clientTrackingRange(4).updateInterval(10) + ); + public static final EntityType END_CRYSTAL = register( + "end_crystal", + EntityType.Builder.of(EndCrystal::new, MobCategory.MISC) + .noLootTable() + .fireImmune() + .sized(2.0F, 2.0F) + .clientTrackingRange(16) + .updateInterval(Integer.MAX_VALUE) + ); public static final EntityType EVOKER = register( "evoker", EntityType.Builder.of(Evoker::new, MobCategory.MONSTER).sized(0.6F, 1.95F).passengerAttachments(2.0F).ridingOffset(-0.6F).clientTrackingRange(8) ); public static final EntityType EVOKER_FANGS = register( - "evoker_fangs", EntityType.Builder.of(EvokerFangs::new, MobCategory.MISC).sized(0.5F, 0.8F).clientTrackingRange(6).updateInterval(2) + "evoker_fangs", + EntityType.Builder.of(EvokerFangs::new, MobCategory.MISC).noLootTable().sized(0.5F, 0.8F).clientTrackingRange(6).updateInterval(2) ); public static final EntityType EXPERIENCE_BOTTLE = register( "experience_bottle", - EntityType.Builder.of(ThrownExperienceBottle::new, MobCategory.MISC).sized(0.25F, 0.25F).clientTrackingRange(4).updateInterval(10) + EntityType.Builder.of(ThrownExperienceBottle::new, MobCategory.MISC) + .noLootTable() + .sized(0.25F, 0.25F) + .clientTrackingRange(4) + .updateInterval(10) ); public static final EntityType EXPERIENCE_ORB = register( - "experience_orb", EntityType.Builder.of(ExperienceOrb::new, MobCategory.MISC).sized(0.5F, 0.5F).clientTrackingRange(6).updateInterval(20) + "experience_orb", + EntityType.Builder.of(ExperienceOrb::new, MobCategory.MISC).noLootTable().sized(0.5F, 0.5F).clientTrackingRange(6).updateInterval(20) ); public static final EntityType EYE_OF_ENDER = register( - "eye_of_ender", EntityType.Builder.of(EyeOfEnder::new, MobCategory.MISC).sized(0.25F, 0.25F).clientTrackingRange(4).updateInterval(4) + "eye_of_ender", + EntityType.Builder.of(EyeOfEnder::new, MobCategory.MISC).noLootTable().sized(0.25F, 0.25F).clientTrackingRange(4).updateInterval(4) ); public static final EntityType FALLING_BLOCK = register( "falling_block", - EntityType.Builder.of(FallingBlockEntity::new, MobCategory.MISC).sized(0.98F, 0.98F).clientTrackingRange(10).updateInterval(20) + EntityType.Builder.of(FallingBlockEntity::new, MobCategory.MISC) + .noLootTable() + .sized(0.98F, 0.98F) + .clientTrackingRange(10) + .updateInterval(20) + ); + public static final EntityType FIREBALL = register( + "fireball", + EntityType.Builder.of(LargeFireball::new, MobCategory.MISC).noLootTable().sized(1.0F, 1.0F).clientTrackingRange(4).updateInterval(10) ); public static final EntityType FIREWORK_ROCKET = register( "firework_rocket", - EntityType.Builder.of(FireworkRocketEntity::new, MobCategory.MISC).sized(0.25F, 0.25F).clientTrackingRange(4).updateInterval(10) + EntityType.Builder.of(FireworkRocketEntity::new, MobCategory.MISC) + .noLootTable() + .sized(0.25F, 0.25F) + .clientTrackingRange(4) + .updateInterval(10) ); public static final EntityType FOX = register( "fox", @@ -355,7 +467,7 @@ public class EntityType implements FeatureElement, EntityTypeT ); public static final EntityType FURNACE_MINECART = register( "furnace_minecart", - EntityType.Builder.of(MinecartFurnace::new, MobCategory.MISC).sized(0.98F, 0.7F).passengerAttachments(0.1875F).clientTrackingRange(8) + EntityType.Builder.of(MinecartFurnace::new, MobCategory.MISC).noLootTable().sized(0.98F, 0.7F).passengerAttachments(0.1875F).clientTrackingRange(8) ); public static final EntityType GHAST = register( "ghast", @@ -373,6 +485,7 @@ public class EntityType implements FeatureElement, EntityTypeT public static final EntityType GLOW_ITEM_FRAME = register( "glow_item_frame", EntityType.Builder.of(GlowItemFrame::new, MobCategory.MISC) + .noLootTable() .sized(0.5F, 0.5F) .eyeHeight(0.0F) .clientTrackingRange(10) @@ -393,7 +506,7 @@ public class EntityType implements FeatureElement, EntityTypeT ); public static final EntityType HOPPER_MINECART = register( "hopper_minecart", - EntityType.Builder.of(MinecartHopper::new, MobCategory.MISC).sized(0.98F, 0.7F).passengerAttachments(0.1875F).clientTrackingRange(8) + EntityType.Builder.of(MinecartHopper::new, MobCategory.MISC).noLootTable().sized(0.98F, 0.7F).passengerAttachments(0.1875F).clientTrackingRange(8) ); public static final EntityType HORSE = register( "horse", @@ -413,34 +526,48 @@ public class EntityType implements FeatureElement, EntityTypeT EntityType.Builder.of(Illusioner::new, MobCategory.MONSTER).sized(0.6F, 1.95F).passengerAttachments(2.0F).ridingOffset(-0.6F).clientTrackingRange(8) ); public static final EntityType INTERACTION = register( - "interaction", EntityType.Builder.of(Interaction::new, MobCategory.MISC).sized(0.0F, 0.0F).clientTrackingRange(10) + "interaction", EntityType.Builder.of(Interaction::new, MobCategory.MISC).noLootTable().sized(0.0F, 0.0F).clientTrackingRange(10) ); public static final EntityType IRON_GOLEM = register( "iron_golem", EntityType.Builder.of(IronGolem::new, MobCategory.MISC).sized(1.4F, 2.7F).clientTrackingRange(10) ); public static final EntityType ITEM = register( - "item", EntityType.Builder.of(ItemEntity::new, MobCategory.MISC).sized(0.25F, 0.25F).eyeHeight(0.2125F).clientTrackingRange(6).updateInterval(20) + "item", + EntityType.Builder.of(ItemEntity::new, MobCategory.MISC) + .noLootTable() + .sized(0.25F, 0.25F) + .eyeHeight(0.2125F) + .clientTrackingRange(6) + .updateInterval(20) ); public static final EntityType ITEM_DISPLAY = register( - "item_display", EntityType.Builder.of(Display.ItemDisplay::new, MobCategory.MISC).sized(0.0F, 0.0F).clientTrackingRange(10).updateInterval(1) + "item_display", EntityType.Builder.of(Display.ItemDisplay::new, MobCategory.MISC).noLootTable().sized(0.0F, 0.0F).clientTrackingRange(10).updateInterval(1) ); public static final EntityType ITEM_FRAME = register( "item_frame", EntityType.Builder.of(ItemFrame::new, MobCategory.MISC) + .noLootTable() .sized(0.5F, 0.5F) .eyeHeight(0.0F) .clientTrackingRange(10) .updateInterval(Integer.MAX_VALUE) ); - public static final EntityType OMINOUS_ITEM_SPAWNER = register( - "ominous_item_spawner", EntityType.Builder.of(OminousItemSpawner::new, MobCategory.MISC).sized(0.25F, 0.25F).clientTrackingRange(8) + public static final EntityType JUNGLE_BOAT = register( + "jungle_boat", + EntityType.Builder.of(boatFactory(() -> Items.JUNGLE_BOAT), MobCategory.MISC).noLootTable().sized(1.375F, 0.5625F).eyeHeight(0.5625F).clientTrackingRange(10) ); - public static final EntityType FIREBALL = register( - "fireball", EntityType.Builder.of(LargeFireball::new, MobCategory.MISC).sized(1.0F, 1.0F).clientTrackingRange(4).updateInterval(10) + public static final EntityType JUNGLE_CHEST_BOAT = register( + "jungle_chest_boat", + EntityType.Builder.of(chestBoatFactory(() -> Items.JUNGLE_CHEST_BOAT), MobCategory.MISC) + .noLootTable() + .sized(1.375F, 0.5625F) + .eyeHeight(0.5625F) + .clientTrackingRange(10) ); public static final EntityType LEASH_KNOT = register( "leash_knot", EntityType.Builder.of(LeashFenceKnotEntity::new, MobCategory.MISC) + .noLootTable() .noSave() .sized(0.375F, 0.5F) .eyeHeight(0.0625F) @@ -449,7 +576,12 @@ public class EntityType implements FeatureElement, EntityTypeT ); public static final EntityType LIGHTNING_BOLT = register( "lightning_bolt", - EntityType.Builder.of(LightningBolt::new, MobCategory.MISC).noSave().sized(0.0F, 0.0F).clientTrackingRange(16).updateInterval(Integer.MAX_VALUE) + EntityType.Builder.of(LightningBolt::new, MobCategory.MISC) + .noLootTable() + .noSave() + .sized(0.0F, 0.0F) + .clientTrackingRange(16) + .updateInterval(Integer.MAX_VALUE) ); public static final EntityType LLAMA = register( "llama", @@ -460,7 +592,7 @@ public class EntityType implements FeatureElement, EntityTypeT .clientTrackingRange(10) ); public static final EntityType LLAMA_SPIT = register( - "llama_spit", EntityType.Builder.of(LlamaSpit::new, MobCategory.MISC).sized(0.25F, 0.25F).clientTrackingRange(4).updateInterval(10) + "llama_spit", EntityType.Builder.of(LlamaSpit::new, MobCategory.MISC).noLootTable().sized(0.25F, 0.25F).clientTrackingRange(4).updateInterval(10) ); public static final EntityType MAGMA_CUBE = register( "magma_cube", @@ -471,11 +603,27 @@ public class EntityType implements FeatureElement, EntityTypeT .spawnDimensionsScale(4.0F) .clientTrackingRange(8) ); + public static final EntityType MANGROVE_BOAT = register( + "mangrove_boat", + EntityType.Builder.of(boatFactory(() -> Items.MANGROVE_BOAT), MobCategory.MISC) + .noLootTable() + .sized(1.375F, 0.5625F) + .eyeHeight(0.5625F) + .clientTrackingRange(10) + ); + public static final EntityType MANGROVE_CHEST_BOAT = register( + "mangrove_chest_boat", + EntityType.Builder.of(chestBoatFactory(() -> Items.MANGROVE_CHEST_BOAT), MobCategory.MISC) + .noLootTable() + .sized(1.375F, 0.5625F) + .eyeHeight(0.5625F) + .clientTrackingRange(10) + ); public static final EntityType MARKER = register( - "marker", EntityType.Builder.of(Marker::new, MobCategory.MISC).sized(0.0F, 0.0F).clientTrackingRange(0) + "marker", EntityType.Builder.of(Marker::new, MobCategory.MISC).noLootTable().sized(0.0F, 0.0F).clientTrackingRange(0) ); public static final EntityType MINECART = register( - "minecart", EntityType.Builder.of(Minecart::new, MobCategory.MISC).sized(0.98F, 0.7F).passengerAttachments(0.1875F).clientTrackingRange(8) + "minecart", EntityType.Builder.of(Minecart::new, MobCategory.MISC).noLootTable().sized(0.98F, 0.7F).passengerAttachments(0.1875F).clientTrackingRange(8) ); public static final EntityType MOOSHROOM = register( "mooshroom", @@ -484,11 +632,45 @@ public class EntityType implements FeatureElement, EntityTypeT public static final EntityType MULE = register( "mule", EntityType.Builder.of(Mule::new, MobCategory.CREATURE).sized(1.3964844F, 1.6F).eyeHeight(1.52F).passengerAttachments(1.2125F).clientTrackingRange(8) ); + public static final EntityType OAK_BOAT = register( + "oak_boat", + EntityType.Builder.of(boatFactory(() -> Items.OAK_BOAT), MobCategory.MISC).noLootTable().sized(1.375F, 0.5625F).eyeHeight(0.5625F).clientTrackingRange(10) + ); + public static final EntityType OAK_CHEST_BOAT = register( + "oak_chest_boat", + EntityType.Builder.of(chestBoatFactory(() -> Items.OAK_CHEST_BOAT), MobCategory.MISC) + .noLootTable() + .sized(1.375F, 0.5625F) + .eyeHeight(0.5625F) + .clientTrackingRange(10) + ); public static final EntityType OCELOT = register( "ocelot", EntityType.Builder.of(Ocelot::new, MobCategory.CREATURE).sized(0.6F, 0.7F).passengerAttachments(0.6375F).clientTrackingRange(10) ); + public static final EntityType OMINOUS_ITEM_SPAWNER = register( + "ominous_item_spawner", EntityType.Builder.of(OminousItemSpawner::new, MobCategory.MISC).noLootTable().sized(0.25F, 0.25F).clientTrackingRange(8) + ); public static final EntityType PAINTING = register( - "painting", EntityType.Builder.of(Painting::new, MobCategory.MISC).sized(0.5F, 0.5F).clientTrackingRange(10).updateInterval(Integer.MAX_VALUE) + "painting", + EntityType.Builder.of(Painting::new, MobCategory.MISC).noLootTable().sized(0.5F, 0.5F).clientTrackingRange(10).updateInterval(Integer.MAX_VALUE) + ); + public static final EntityType PALE_OAK_BOAT = register( + "pale_oak_boat", + EntityType.Builder.of(boatFactory(() -> Items.PALE_OAK_BOAT), MobCategory.MISC) + .noLootTable() + .sized(1.375F, 0.5625F) + .eyeHeight(0.5625F) + .clientTrackingRange(10) + .requiredFeatures(FeatureFlags.WINTER_DROP) + ); + public static final EntityType PALE_OAK_CHEST_BOAT = register( + "pale_oak_chest_boat", + EntityType.Builder.of(chestBoatFactory(() -> Items.PALE_OAK_CHEST_BOAT), MobCategory.MISC) + .noLootTable() + .sized(1.375F, 0.5625F) + .eyeHeight(0.5625F) + .clientTrackingRange(10) + .requiredFeatures(FeatureFlags.WINTER_DROP) ); public static final EntityType PANDA = register( "panda", EntityType.Builder.of(Panda::new, MobCategory.CREATURE).sized(1.3F, 1.25F).clientTrackingRange(10) @@ -539,7 +721,8 @@ public class EntityType implements FeatureElement, EntityTypeT "polar_bear", EntityType.Builder.of(PolarBear::new, MobCategory.CREATURE).immuneTo(Blocks.POWDER_SNOW).sized(1.4F, 1.4F).clientTrackingRange(10) ); public static final EntityType POTION = register( - "potion", EntityType.Builder.of(ThrownPotion::new, MobCategory.MISC).sized(0.25F, 0.25F).clientTrackingRange(4).updateInterval(10) + "potion", + EntityType.Builder.of(ThrownPotion::new, MobCategory.MISC).noLootTable().sized(0.25F, 0.25F).clientTrackingRange(4).updateInterval(10) ); public static final EntityType PUFFERFISH = register( "pufferfish", EntityType.Builder.of(Pufferfish::new, MobCategory.WATER_AMBIENT).sized(0.7F, 0.7F).eyeHeight(0.455F).clientTrackingRange(4) @@ -562,7 +745,7 @@ public class EntityType implements FeatureElement, EntityTypeT EntityType.Builder.of(Shulker::new, MobCategory.MONSTER).fireImmune().canSpawnFarFromPlayer().sized(1.0F, 1.0F).eyeHeight(0.5F).clientTrackingRange(10) ); public static final EntityType SHULKER_BULLET = register( - "shulker_bullet", EntityType.Builder.of(ShulkerBullet::new, MobCategory.MISC).sized(0.3125F, 0.3125F).clientTrackingRange(8) + "shulker_bullet", EntityType.Builder.of(ShulkerBullet::new, MobCategory.MISC).noLootTable().sized(0.3125F, 0.3125F).clientTrackingRange(8) ); public static final EntityType SILVERFISH = register( "silverfish", @@ -584,7 +767,7 @@ public class EntityType implements FeatureElement, EntityTypeT ); public static final EntityType SMALL_FIREBALL = register( "small_fireball", - EntityType.Builder.of(SmallFireball::new, MobCategory.MISC).sized(0.3125F, 0.3125F).clientTrackingRange(4).updateInterval(10) + EntityType.Builder.of(SmallFireball::new, MobCategory.MISC).noLootTable().sized(0.3125F, 0.3125F).clientTrackingRange(4).updateInterval(10) ); public static final EntityType SNIFFER = register( "sniffer", @@ -595,23 +778,40 @@ public class EntityType implements FeatureElement, EntityTypeT .nameTagOffset(2.05F) .clientTrackingRange(10) ); + public static final EntityType SNOWBALL = register( + "snowball", EntityType.Builder.of(Snowball::new, MobCategory.MISC).noLootTable().sized(0.25F, 0.25F).clientTrackingRange(4).updateInterval(10) + ); public static final EntityType SNOW_GOLEM = register( "snow_golem", EntityType.Builder.of(SnowGolem::new, MobCategory.MISC).immuneTo(Blocks.POWDER_SNOW).sized(0.7F, 1.9F).eyeHeight(1.7F).clientTrackingRange(8) ); - public static final EntityType SNOWBALL = register( - "snowball", EntityType.Builder.of(Snowball::new, MobCategory.MISC).sized(0.25F, 0.25F).clientTrackingRange(4).updateInterval(10) - ); public static final EntityType SPAWNER_MINECART = register( "spawner_minecart", - EntityType.Builder.of(MinecartSpawner::new, MobCategory.MISC).sized(0.98F, 0.7F).passengerAttachments(0.1875F).clientTrackingRange(8) + EntityType.Builder.of(MinecartSpawner::new, MobCategory.MISC).noLootTable().sized(0.98F, 0.7F).passengerAttachments(0.1875F).clientTrackingRange(8) ); public static final EntityType SPECTRAL_ARROW = register( "spectral_arrow", - EntityType.Builder.of(SpectralArrow::new, MobCategory.MISC).sized(0.5F, 0.5F).eyeHeight(0.13F).clientTrackingRange(4).updateInterval(20) + EntityType.Builder.of(SpectralArrow::new, MobCategory.MISC) + .noLootTable() + .sized(0.5F, 0.5F) + .eyeHeight(0.13F) + .clientTrackingRange(4) + .updateInterval(20) ); public static final EntityType SPIDER = register( "spider", EntityType.Builder.of(Spider::new, MobCategory.MONSTER).sized(1.4F, 0.9F).eyeHeight(0.65F).passengerAttachments(0.765F).clientTrackingRange(8) ); + public static final EntityType SPRUCE_BOAT = register( + "spruce_boat", + EntityType.Builder.of(boatFactory(() -> Items.SPRUCE_BOAT), MobCategory.MISC).noLootTable().sized(1.375F, 0.5625F).eyeHeight(0.5625F).clientTrackingRange(10) + ); + public static final EntityType SPRUCE_CHEST_BOAT = register( + "spruce_chest_boat", + EntityType.Builder.of(chestBoatFactory(() -> Items.SPRUCE_CHEST_BOAT), MobCategory.MISC) + .noLootTable() + .sized(1.375F, 0.5625F) + .eyeHeight(0.5625F) + .clientTrackingRange(10) + ); public static final EntityType SQUID = register( "squid", EntityType.Builder.of(Squid::new, MobCategory.WATER_CREATURE).sized(0.8F, 0.8F).eyeHeight(0.4F).clientTrackingRange(8) ); @@ -631,11 +831,12 @@ public class EntityType implements FeatureElement, EntityTypeT "tadpole", EntityType.Builder.of(Tadpole::new, MobCategory.CREATURE).sized(0.4F, 0.3F).eyeHeight(0.19500001F).clientTrackingRange(10) ); public static final EntityType TEXT_DISPLAY = register( - "text_display", EntityType.Builder.of(Display.TextDisplay::new, MobCategory.MISC).sized(0.0F, 0.0F).clientTrackingRange(10).updateInterval(1) + "text_display", EntityType.Builder.of(Display.TextDisplay::new, MobCategory.MISC).noLootTable().sized(0.0F, 0.0F).clientTrackingRange(10).updateInterval(1) ); public static final EntityType TNT = register( "tnt", EntityType.Builder.of(PrimedTnt::new, MobCategory.MISC) + .noLootTable() .fireImmune() .sized(0.98F, 0.98F) .eyeHeight(0.15F) @@ -644,7 +845,7 @@ public class EntityType implements FeatureElement, EntityTypeT ); public static final EntityType TNT_MINECART = register( "tnt_minecart", - EntityType.Builder.of(MinecartTNT::new, MobCategory.MISC).sized(0.98F, 0.7F).passengerAttachments(0.1875F).clientTrackingRange(8) + EntityType.Builder.of(MinecartTNT::new, MobCategory.MISC).noLootTable().sized(0.98F, 0.7F).passengerAttachments(0.1875F).clientTrackingRange(8) ); public static final EntityType TRADER_LLAMA = register( "trader_llama", @@ -656,7 +857,12 @@ public class EntityType implements FeatureElement, EntityTypeT ); public static final EntityType TRIDENT = register( "trident", - EntityType.Builder.of(ThrownTrident::new, MobCategory.MISC).sized(0.5F, 0.5F).eyeHeight(0.13F).clientTrackingRange(4).updateInterval(20) + EntityType.Builder.of(ThrownTrident::new, MobCategory.MISC) + .noLootTable() + .sized(0.5F, 0.5F) + .eyeHeight(0.13F) + .clientTrackingRange(4) + .updateInterval(20) ); public static final EntityType TROPICAL_FISH = register( "tropical_fish", EntityType.Builder.of(TropicalFish::new, MobCategory.WATER_AMBIENT).sized(0.5F, 0.4F).eyeHeight(0.26F).clientTrackingRange(4) @@ -696,7 +902,12 @@ public class EntityType implements FeatureElement, EntityTypeT ); public static final EntityType WIND_CHARGE = register( "wind_charge", - EntityType.Builder.of(WindCharge::new, MobCategory.MISC).sized(0.3125F, 0.3125F).eyeHeight(0.0F).clientTrackingRange(4).updateInterval(10) + EntityType.Builder.of(WindCharge::new, MobCategory.MISC) + .noLootTable() + .sized(0.3125F, 0.3125F) + .eyeHeight(0.0F) + .clientTrackingRange(4) + .updateInterval(10) ); public static final EntityType WITCH = register( "witch", EntityType.Builder.of(Witch::new, MobCategory.MONSTER).sized(0.6F, 1.95F).eyeHeight(1.62F).passengerAttachments(2.2625F).clientTrackingRange(8) @@ -715,7 +926,8 @@ public class EntityType implements FeatureElement, EntityTypeT .clientTrackingRange(8) ); public static final EntityType WITHER_SKULL = register( - "wither_skull", EntityType.Builder.of(WitherSkull::new, MobCategory.MISC).sized(0.3125F, 0.3125F).clientTrackingRange(4).updateInterval(10) + "wither_skull", + EntityType.Builder.of(WitherSkull::new, MobCategory.MISC).noLootTable().sized(0.3125F, 0.3125F).clientTrackingRange(4).updateInterval(10) ); public static final EntityType WOLF = register( "wolf", @@ -773,7 +985,13 @@ public class EntityType implements FeatureElement, EntityTypeT ); public static final EntityType FISHING_BOBBER = register( "fishing_bobber", - EntityType.Builder.of(FishingHook::new, MobCategory.MISC).noSave().noSummon().sized(0.25F, 0.25F).clientTrackingRange(4).updateInterval(5) + EntityType.Builder.of(FishingHook::new, MobCategory.MISC) + .noLootTable() + .noSave() + .noSummon() + .sized(0.25F, 0.25F) + .clientTrackingRange(4) + .updateInterval(5) ); private final EntityType.EntityFactory factory; private final MobCategory category; @@ -784,18 +1002,24 @@ public class EntityType implements FeatureElement, EntityTypeT private final boolean canSpawnFarFromPlayer; private final int clientTrackingRange; private final int updateInterval; - @Nullable - private String descriptionId; + private final String descriptionId; @Nullable private Component description; - @Nullable - private ResourceKey lootTable; + private final Optional> lootTable; private final EntityDimensions dimensions; private final float spawnDimensionsScale; private final FeatureFlagSet requiredFeatures; + private static EntityType register(ResourceKey> resourceKey, EntityType.Builder builder) { + return Registry.register(BuiltInRegistries.ENTITY_TYPE, resourceKey, builder.build(resourceKey)); + } + + private static ResourceKey> vanillaEntityId(String string) { + return ResourceKey.create(Registries.ENTITY_TYPE, ResourceLocation.withDefaultNamespace(string)); + } + private static EntityType register(String key, EntityType.Builder builder) { - return Registry.register(BuiltInRegistries.ENTITY_TYPE, key, builder.build(key)); + return register(vanillaEntityId(key), builder); } public static ResourceLocation getKey(EntityType entityType) { @@ -810,59 +1034,63 @@ public class EntityType implements FeatureElement, EntityTypeT } public EntityType( - EntityType.EntityFactory factory, - MobCategory category, - boolean serialize, - boolean summon, - boolean fireImmune, - boolean canSpawnFarFromPlayer, - ImmutableSet immuneTo, - EntityDimensions dimensions, - float spawnDimensionsScale, - int clientTrackingRange, - int updateInterval, - FeatureFlagSet requiredFeatures + EntityType.EntityFactory entityFactory, + MobCategory mobCategory, + boolean bl, + boolean bl2, + boolean bl3, + boolean bl4, + ImmutableSet immutableSet, + EntityDimensions entityDimensions, + float f, + int i, + int j, + String string, + Optional> optional, + FeatureFlagSet featureFlagSet ) { - this.factory = factory; - this.category = category; - this.canSpawnFarFromPlayer = canSpawnFarFromPlayer; - this.serialize = serialize; - this.summon = summon; - this.fireImmune = fireImmune; - this.immuneTo = immuneTo; - this.dimensions = dimensions; - this.spawnDimensionsScale = spawnDimensionsScale; - this.clientTrackingRange = clientTrackingRange; - this.updateInterval = updateInterval; - this.requiredFeatures = requiredFeatures; + this.factory = entityFactory; + this.category = mobCategory; + this.canSpawnFarFromPlayer = bl4; + this.serialize = bl; + this.summon = bl2; + this.fireImmune = bl3; + this.immuneTo = immutableSet; + this.dimensions = entityDimensions; + this.spawnDimensionsScale = f; + this.clientTrackingRange = i; + this.updateInterval = j; + this.descriptionId = string; + this.lootTable = optional; + this.requiredFeatures = featureFlagSet; } @Nullable public T spawn( ServerLevel serverLevel, - @Nullable ItemStack stack, + @Nullable ItemStack itemStack, @Nullable Player player, - BlockPos pos, - MobSpawnType spawnType, - boolean shouldOffsetY, - boolean shouldOffsetYMore + BlockPos blockPos, + EntitySpawnReason entitySpawnReason, + boolean bl, + boolean bl2 ) { Consumer consumer; - if (stack != null) { - consumer = createDefaultStackConfig(serverLevel, stack, player); + if (itemStack != null) { + consumer = createDefaultStackConfig(serverLevel, itemStack, player); } else { consumer = entity -> {}; } - return this.spawn(serverLevel, consumer, pos, spawnType, shouldOffsetY, shouldOffsetYMore); + return this.spawn(serverLevel, consumer, blockPos, entitySpawnReason, bl, bl2); } - public static Consumer createDefaultStackConfig(ServerLevel serverLevel, ItemStack stack, @Nullable Player player) { - return appendDefaultStackConfig(entity -> {}, serverLevel, stack, player); + public static Consumer createDefaultStackConfig(Level level, ItemStack itemStack, @Nullable Player player) { + return appendDefaultStackConfig(entity -> {}, level, itemStack, player); } - public static Consumer appendDefaultStackConfig(Consumer consumer, ServerLevel serverLevel, ItemStack stack, @Nullable Player player) { - return appendCustomEntityStackConfig(appendCustomNameConfig(consumer, stack), serverLevel, stack, player); + public static Consumer appendDefaultStackConfig(Consumer consumer, Level level, ItemStack itemStack, @Nullable Player player) { + return appendCustomEntityStackConfig(appendCustomNameConfig(consumer, itemStack), level, itemStack, player); } public static Consumer appendCustomNameConfig(Consumer consumer, ItemStack stack) { @@ -870,45 +1098,45 @@ public class EntityType implements FeatureElement, EntityTypeT return component != null ? consumer.andThen(entity -> entity.setCustomName(component)) : consumer; } - public static Consumer appendCustomEntityStackConfig(Consumer consumer, ServerLevel level, ItemStack stack, @Nullable Player player) { - CustomData customData = stack.getOrDefault(DataComponents.ENTITY_DATA, CustomData.EMPTY); + public static Consumer appendCustomEntityStackConfig(Consumer consumer, Level level, ItemStack itemStack, @Nullable Player player) { + CustomData customData = itemStack.getOrDefault(DataComponents.ENTITY_DATA, CustomData.EMPTY); return !customData.isEmpty() ? consumer.andThen(entity -> updateCustomEntityTag(level, player, entity, customData)) : consumer; } @Nullable - public T spawn(ServerLevel level, BlockPos pos, MobSpawnType spawnType) { - return this.spawn(level, null, pos, spawnType, false, false); + public T spawn(ServerLevel serverLevel, BlockPos blockPos, EntitySpawnReason entitySpawnReason) { + return this.spawn(serverLevel, null, blockPos, entitySpawnReason, false, false); } @Nullable - public T spawn(ServerLevel level, @Nullable Consumer consumer, BlockPos pos, MobSpawnType spawnType, boolean shouldOffsetY, boolean shouldOffsetYMore) { - T entity = this.create(level, consumer, pos, spawnType, shouldOffsetY, shouldOffsetYMore); + public T spawn(ServerLevel serverLevel, @Nullable Consumer consumer, BlockPos blockPos, EntitySpawnReason entitySpawnReason, boolean bl, boolean bl2) { + T entity = this.create(serverLevel, consumer, blockPos, entitySpawnReason, bl, bl2); if (entity != null) { - level.addFreshEntityWithPassengers(entity); + serverLevel.addFreshEntityWithPassengers(entity); } return entity; } @Nullable - public T create(ServerLevel level, @Nullable Consumer consumer, BlockPos pos, MobSpawnType spawnType, boolean shouldOffsetY, boolean shouldOffsetYMore) { - T entity = this.create(level); + public T create(ServerLevel serverLevel, @Nullable Consumer consumer, BlockPos blockPos, EntitySpawnReason entitySpawnReason, boolean bl, boolean bl2) { + T entity = this.create(serverLevel, entitySpawnReason); if (entity == null) { return null; } else { double d; - if (shouldOffsetY) { - entity.setPos(pos.getX() + 0.5, pos.getY() + 1, pos.getZ() + 0.5); - d = getYOffset(level, pos, shouldOffsetYMore, entity.getBoundingBox()); + if (bl) { + entity.setPos(blockPos.getX() + 0.5, blockPos.getY() + 1, blockPos.getZ() + 0.5); + d = getYOffset(serverLevel, blockPos, bl2, entity.getBoundingBox()); } else { d = 0.0; } - entity.moveTo(pos.getX() + 0.5, pos.getY() + d, pos.getZ() + 0.5, Mth.wrapDegrees(level.random.nextFloat() * 360.0F), 0.0F); + entity.moveTo(blockPos.getX() + 0.5, blockPos.getY() + d, blockPos.getZ() + 0.5, Mth.wrapDegrees(serverLevel.random.nextFloat() * 360.0F), 0.0F); if (entity instanceof Mob mob) { mob.yHeadRot = mob.getYRot(); mob.yBodyRot = mob.getYRot(); - mob.finalizeSpawn(level, level.getCurrentDifficultyAt(mob.blockPosition()), spawnType, null); + mob.finalizeSpawn(serverLevel, serverLevel.getCurrentDifficultyAt(mob.blockPosition()), entitySpawnReason, null); mob.playAmbientSound(); } @@ -960,10 +1188,6 @@ public class EntityType implements FeatureElement, EntityTypeT } public String getDescriptionId() { - if (this.descriptionId == null) { - this.descriptionId = Util.makeDescriptionId("entity", BuiltInRegistries.ENTITY_TYPE.getKey(this)); - } - return this.descriptionId; } @@ -984,12 +1208,7 @@ public class EntityType implements FeatureElement, EntityTypeT return i == -1 ? this.getDescriptionId() : this.getDescriptionId().substring(i + 1); } - public ResourceKey getDefaultLootTable() { - if (this.lootTable == null) { - ResourceLocation resourceLocation = BuiltInRegistries.ENTITY_TYPE.getKey(this); - this.lootTable = ResourceKey.create(Registries.LOOT_TABLE, resourceLocation.withPrefix("entities/")); - } - + public Optional> getDefaultLootTable() { return this.lootTable; } @@ -1007,13 +1226,15 @@ public class EntityType implements FeatureElement, EntityTypeT } @Nullable - public T create(Level level) { + public T create(Level level, EntitySpawnReason entitySpawnReason) { return !this.isEnabled(level.enabledFeatures()) ? null : this.factory.create(this, level); } - public static Optional create(CompoundTag tag, Level level) { + public static Optional create(CompoundTag compoundTag, Level level, EntitySpawnReason entitySpawnReason) { return Util.ifElse( - by(tag).map(entityType -> entityType.create(level)), entity -> entity.load(tag), () -> LOGGER.warn("Skipping Entity with id {}", tag.getString("id")) + by(compoundTag).map(entityType -> entityType.create(level, entitySpawnReason)), + entity -> entity.load(compoundTag), + () -> LOGGER.warn("Skipping Entity with id {}", compoundTag.getString("id")) ); } @@ -1042,13 +1263,13 @@ public class EntityType implements FeatureElement, EntityTypeT } @Nullable - public static Entity loadEntityRecursive(CompoundTag compound, Level level, Function entityFunction) { - return (Entity)loadStaticEntity(compound, level).map(entityFunction).map(entity -> { - if (compound.contains("Passengers", 9)) { - ListTag listTag = compound.getList("Passengers", 10); + public static Entity loadEntityRecursive(CompoundTag compoundTag, Level level, EntitySpawnReason entitySpawnReason, Function function) { + return (Entity)loadStaticEntity(compoundTag, level, entitySpawnReason).map(function).map(entity -> { + if (compoundTag.contains("Passengers", 9)) { + ListTag listTag = compoundTag.getList("Passengers", 10); for (int i = 0; i < listTag.size(); i++) { - Entity entity2 = loadEntityRecursive(listTag.getCompound(i), level, entityFunction); + Entity entity2 = loadEntityRecursive(listTag.getCompound(i), level, entitySpawnReason, function); if (entity2 != null) { entity2.startRiding(entity, true); } @@ -1059,11 +1280,11 @@ public class EntityType implements FeatureElement, EntityTypeT }).orElse(null); } - public static Stream loadEntitiesRecursive(List tags, Level level) { - final Spliterator spliterator = tags.spliterator(); + public static Stream loadEntitiesRecursive(List list, Level level, EntitySpawnReason entitySpawnReason) { + final Spliterator spliterator = list.spliterator(); return StreamSupport.stream(new Spliterator() { public boolean tryAdvance(Consumer consumer) { - return spliterator.tryAdvance(tag -> EntityType.loadEntityRecursive((CompoundTag)tag, level, entity -> { + return spliterator.tryAdvance(tag -> EntityType.loadEntityRecursive((CompoundTag)tag, level, entitySpawnReason, entity -> { consumer.accept(entity); return entity; })); @@ -1074,7 +1295,7 @@ public class EntityType implements FeatureElement, EntityTypeT } public long estimateSize() { - return tags.size(); + return list.size(); } public int characteristics() { @@ -1083,11 +1304,11 @@ public class EntityType implements FeatureElement, EntityTypeT }, false); } - private static Optional loadStaticEntity(CompoundTag compound, Level level) { + private static Optional loadStaticEntity(CompoundTag compoundTag, Level level, EntitySpawnReason entitySpawnReason) { try { - return create(compound, level); - } catch (RuntimeException var3) { - LOGGER.warn("Exception loading entity: ", (Throwable)var3); + return create(compoundTag, level, entitySpawnReason); + } catch (RuntimeException var4) { + LOGGER.warn("Exception loading entity: ", (Throwable)var4); return Optional.empty(); } } @@ -1139,6 +1360,22 @@ public class EntityType implements FeatureElement, EntityTypeT return this.builtInRegistryHolder; } + private static EntityType.EntityFactory boatFactory(Supplier supplier) { + return (entityType, level) -> new Boat(entityType, level, supplier); + } + + private static EntityType.EntityFactory chestBoatFactory(Supplier supplier) { + return (entityType, level) -> new ChestBoat(entityType, level, supplier); + } + + private static EntityType.EntityFactory raftFactory(Supplier supplier) { + return (entityType, level) -> new Raft(entityType, level, supplier); + } + + private static EntityType.EntityFactory chestRaftFactory(Supplier supplier) { + return (entityType, level) -> new ChestRaft(entityType, level, supplier); + } + public static class Builder { private final EntityType.EntityFactory factory; private final MobCategory category; @@ -1153,6 +1390,10 @@ public class EntityType implements FeatureElement, EntityTypeT private float spawnDimensionsScale = 1.0F; private EntityAttachments.Builder attachments = EntityAttachments.builder(); private FeatureFlagSet requiredFeatures = FeatureFlags.VANILLA_SET; + private DependantName, Optional>> lootTable = resourceKey -> Optional.of( + ResourceKey.create(Registries.LOOT_TABLE, resourceKey.location().withPrefix("entities/")) + ); + private DependantName, String> descriptionId = resourceKey -> Util.makeDescriptionId("entity", resourceKey.location()); private Builder(EntityType.EntityFactory factory, MobCategory category) { this.factory = factory; @@ -1261,9 +1502,14 @@ public class EntityType implements FeatureElement, EntityTypeT return this; } - public EntityType build(String key) { + public EntityType.Builder noLootTable() { + this.lootTable = DependantName.fixed(Optional.empty()); + return this; + } + + public EntityType build(ResourceKey> resourceKey) { if (this.serialize) { - Util.fetchChoiceType(References.ENTITY_TREE, key); + Util.fetchChoiceType(References.ENTITY_TREE, resourceKey.location().toString()); } return new EntityType<>( @@ -1278,11 +1524,14 @@ public class EntityType implements FeatureElement, EntityTypeT this.spawnDimensionsScale, this.clientTrackingRange, this.updateInterval, + this.descriptionId.get(resourceKey), + this.lootTable.get(resourceKey), this.requiredFeatures ); } } + @FunctionalInterface public interface EntityFactory { T create(EntityType entityType, Level level); } diff --git a/net/minecraft/world/entity/EquipmentSlot.java b/net/minecraft/world/entity/EquipmentSlot.java index 154d5ba5..94e74049 100644 --- a/net/minecraft/world/entity/EquipmentSlot.java +++ b/net/minecraft/world/entity/EquipmentSlot.java @@ -1,6 +1,13 @@ package net.minecraft.world.entity; +import io.netty.buffer.ByteBuf; +import java.util.List; +import java.util.function.IntFunction; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.util.ByIdMap; import net.minecraft.util.StringRepresentable; +import net.minecraft.util.ByIdMap.OutOfBoundsStrategy; import net.minecraft.world.item.ItemStack; public enum EquipmentSlot implements StringRepresentable { @@ -13,18 +20,21 @@ public enum EquipmentSlot implements StringRepresentable { BODY(EquipmentSlot.Type.ANIMAL_ARMOR, 0, 1, 6, "body"); public static final int NO_COUNT_LIMIT = 0; + public static final List VALUES = List.of(values()); + public static final IntFunction BY_ID = ByIdMap.continuous(equipmentSlot -> equipmentSlot.id, values(), OutOfBoundsStrategy.ZERO); public static final StringRepresentable.EnumCodec CODEC = StringRepresentable.fromEnum(EquipmentSlot::values); + public static final StreamCodec STREAM_CODEC = ByteBufCodecs.idMapper(BY_ID, equipmentSlot -> equipmentSlot.id); private final EquipmentSlot.Type type; private final int index; private final int countLimit; - private final int filterFlag; + private final int id; private final String name; private EquipmentSlot(final EquipmentSlot.Type type, final int index, final int countLimit, final int filterFlag, final String name) { this.type = type; this.index = index; this.countLimit = countLimit; - this.filterFlag = filterFlag; + this.id = filterFlag; this.name = name; } @@ -48,11 +58,12 @@ public enum EquipmentSlot implements StringRepresentable { return this.countLimit > 0 ? stack.split(this.countLimit) : stack; } - /** - * Gets the actual slot index. - */ - public int getFilterFlag() { - return this.filterFlag; + public int getId() { + return this.id; + } + + public int getFilterBit(int i) { + return this.id + i; } public String getName() { diff --git a/net/minecraft/world/entity/EquipmentSlotGroup.java b/net/minecraft/world/entity/EquipmentSlotGroup.java index 102da740..ceaef4f9 100644 --- a/net/minecraft/world/entity/EquipmentSlotGroup.java +++ b/net/minecraft/world/entity/EquipmentSlotGroup.java @@ -8,6 +8,7 @@ import net.minecraft.network.codec.ByteBufCodecs; import net.minecraft.network.codec.StreamCodec; import net.minecraft.util.ByIdMap; import net.minecraft.util.StringRepresentable; +import net.minecraft.util.ByIdMap.OutOfBoundsStrategy; public enum EquipmentSlotGroup implements StringRepresentable { ANY(0, "any", equipmentSlot -> true), @@ -21,9 +22,7 @@ public enum EquipmentSlotGroup implements StringRepresentable { ARMOR(8, "armor", EquipmentSlot::isArmor), BODY(9, "body", EquipmentSlot.BODY); - public static final IntFunction BY_ID = ByIdMap.continuous( - equipmentSlotGroup -> equipmentSlotGroup.id, values(), ByIdMap.OutOfBoundsStrategy.ZERO - ); + public static final IntFunction BY_ID = ByIdMap.continuous(equipmentSlotGroup -> equipmentSlotGroup.id, values(), OutOfBoundsStrategy.ZERO); public static final Codec CODEC = StringRepresentable.fromEnum(EquipmentSlotGroup::values); public static final StreamCodec STREAM_CODEC = ByteBufCodecs.idMapper(BY_ID, equipmentSlotGroup -> equipmentSlotGroup.id); private final int id; diff --git a/net/minecraft/world/entity/EquipmentTable.java b/net/minecraft/world/entity/EquipmentTable.java index 1e782f0c..271a1cfd 100644 --- a/net/minecraft/world/entity/EquipmentTable.java +++ b/net/minecraft/world/entity/EquipmentTable.java @@ -4,7 +4,6 @@ import com.google.common.collect.Maps; import com.mojang.datafixers.util.Either; import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; -import java.util.Arrays; import java.util.List; import java.util.Map; import java.util.function.Function; @@ -16,7 +15,7 @@ public record EquipmentTable(ResourceKey lootTable, Map> DROP_CHANCES_CODEC = Codec.either(Codec.FLOAT, Codec.unboundedMap(EquipmentSlot.CODEC, Codec.FLOAT)) .xmap(either -> either.map(EquipmentTable::createForAllSlots, Function.identity()), map -> { boolean bl = map.values().stream().distinct().count() == 1L; - boolean bl2 = map.keySet().containsAll(Arrays.asList(EquipmentSlot.values())); + boolean bl2 = map.keySet().containsAll(EquipmentSlot.VALUES); return bl && bl2 ? Either.left((Float)map.values().stream().findFirst().orElse(0.0F)) : Either.right(map); }); public static final Codec CODEC = RecordCodecBuilder.create( @@ -27,6 +26,10 @@ public record EquipmentTable(ResourceKey lootTable, Map resourceKey, float f) { + this(resourceKey, createForAllSlots(f)); + } + private static Map createForAllSlots(float dropChance) { return createForAllSlots(List.of(EquipmentSlot.values()), dropChance); } diff --git a/net/minecraft/world/entity/EquipmentUser.java b/net/minecraft/world/entity/EquipmentUser.java index f067aa0f..f9d8905a 100644 --- a/net/minecraft/world/entity/EquipmentUser.java +++ b/net/minecraft/world/entity/EquipmentUser.java @@ -3,10 +3,10 @@ package net.minecraft.world.entity; import java.util.ArrayList; import java.util.List; import java.util.Map; +import net.minecraft.core.component.DataComponents; import net.minecraft.resources.ResourceKey; -import net.minecraft.world.item.Equipable; import net.minecraft.world.item.ItemStack; -import net.minecraft.world.level.storage.loot.BuiltInLootTables; +import net.minecraft.world.item.equipment.Equippable; import net.minecraft.world.level.storage.loot.LootParams; import net.minecraft.world.level.storage.loot.LootTable; import org.jetbrains.annotations.Nullable; @@ -27,24 +27,22 @@ public interface EquipmentUser { } default void equip(ResourceKey equipmentLootTable, LootParams params, long seed, Map slotDropChances) { - if (!equipmentLootTable.equals(BuiltInLootTables.EMPTY)) { - LootTable lootTable = params.getLevel().getServer().reloadableRegistries().getLootTable(equipmentLootTable); - if (lootTable != LootTable.EMPTY) { - List list = lootTable.getRandomItems(params, seed); - List list2 = new ArrayList(); + LootTable lootTable = params.getLevel().getServer().reloadableRegistries().getLootTable(equipmentLootTable); + if (lootTable != LootTable.EMPTY) { + List list = lootTable.getRandomItems(params, seed); + List list2 = new ArrayList(); - for (ItemStack itemStack : list) { - EquipmentSlot equipmentSlot = this.resolveSlot(itemStack, list2); - if (equipmentSlot != null) { - ItemStack itemStack2 = equipmentSlot.limit(itemStack); - this.setItemSlot(equipmentSlot, itemStack2); - Float float_ = (Float)slotDropChances.get(equipmentSlot); - if (float_ != null) { - this.setDropChance(equipmentSlot, float_); - } - - list2.add(equipmentSlot); + for (ItemStack itemStack : list) { + EquipmentSlot equipmentSlot = this.resolveSlot(itemStack, list2); + if (equipmentSlot != null) { + ItemStack itemStack2 = equipmentSlot.limit(itemStack); + this.setItemSlot(equipmentSlot, itemStack2); + Float float_ = (Float)slotDropChances.get(equipmentSlot); + if (float_ != null) { + this.setDropChance(equipmentSlot, float_); } + + list2.add(equipmentSlot); } } } @@ -55,9 +53,9 @@ public interface EquipmentUser { if (stack.isEmpty()) { return null; } else { - Equipable equipable = Equipable.get(stack); - if (equipable != null) { - EquipmentSlot equipmentSlot = equipable.getEquipmentSlot(); + Equippable equippable = stack.get(DataComponents.EQUIPPABLE); + if (equippable != null) { + EquipmentSlot equipmentSlot = equippable.slot(); if (!excludedSlots.contains(equipmentSlot)) { return equipmentSlot; } diff --git a/net/minecraft/world/entity/ExperienceOrb.java b/net/minecraft/world/entity/ExperienceOrb.java index 6707f5ca..1ee2229d 100644 --- a/net/minecraft/world/entity/ExperienceOrb.java +++ b/net/minecraft/world/entity/ExperienceOrb.java @@ -7,7 +7,7 @@ import net.minecraft.nbt.CompoundTag; import net.minecraft.network.protocol.Packet; import net.minecraft.network.protocol.game.ClientGamePacketListener; import net.minecraft.network.protocol.game.ClientboundAddExperienceOrbPacket; -import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.network.syncher.SynchedEntityData.Builder; import net.minecraft.server.level.ServerEntity; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; @@ -54,7 +54,7 @@ public class ExperienceOrb extends Entity { } @Override - protected void defineSynchedData(SynchedEntityData.Builder builder) { + protected void defineSynchedData(Builder builder) { } @Override @@ -104,6 +104,7 @@ public class ExperienceOrb extends Entity { } this.move(MoverType.SELF, this.getDeltaMovement()); + this.applyEffectsFromBlocks(); float f = 0.98F; if (this.onGround()) { f = this.level().getBlockState(this.getBlockPosBelowThatAffectsMyMovement()).getBlock().getFriction() * 0.98F; @@ -186,14 +187,17 @@ public class ExperienceOrb extends Entity { } @Override - public boolean hurt(DamageSource source, float amount) { - if (this.isInvulnerableTo(source)) { + public final boolean hurtClient(DamageSource damageSource) { + return !this.isInvulnerableToBase(damageSource); + } + + @Override + public final boolean hurtServer(ServerLevel serverLevel, DamageSource damageSource, float f) { + if (this.isInvulnerableToBase(damageSource)) { return false; - } else if (this.level().isClientSide) { - return true; } else { this.markHurt(); - this.health = (int)(this.health - amount); + this.health = (int)(this.health - f); if (this.health <= 0) { this.discard(); } diff --git a/net/minecraft/world/entity/FlyingMob.java b/net/minecraft/world/entity/FlyingMob.java index 1fe00d28..ce294290 100644 --- a/net/minecraft/world/entity/FlyingMob.java +++ b/net/minecraft/world/entity/FlyingMob.java @@ -42,8 +42,6 @@ public abstract class FlyingMob extends Mob { this.setDeltaMovement(this.getDeltaMovement().scale(f)); } } - - this.calculateEntityAnimation(false); } @Override diff --git a/net/minecraft/world/entity/GlowSquid.java b/net/minecraft/world/entity/GlowSquid.java index 03f0f111..c94d5c2a 100644 --- a/net/minecraft/world/entity/GlowSquid.java +++ b/net/minecraft/world/entity/GlowSquid.java @@ -7,6 +7,8 @@ import net.minecraft.nbt.CompoundTag; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.network.syncher.SynchedEntityData.Builder; +import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; import net.minecraft.util.RandomSource; @@ -15,6 +17,7 @@ import net.minecraft.world.entity.animal.Squid; import net.minecraft.world.level.Level; import net.minecraft.world.level.ServerLevelAccessor; import net.minecraft.world.level.block.Blocks; +import org.jetbrains.annotations.Nullable; public class GlowSquid extends Squid { private static final EntityDataAccessor DATA_DARK_TICKS_REMAINING = SynchedEntityData.defineId(GlowSquid.class, EntityDataSerializers.INT); @@ -29,11 +32,17 @@ public class GlowSquid extends Squid { } @Override - protected void defineSynchedData(SynchedEntityData.Builder builder) { + protected void defineSynchedData(Builder builder) { super.defineSynchedData(builder); builder.define(DATA_DARK_TICKS_REMAINING, 0); } + @Nullable + @Override + public AgeableMob getBreedOffspring(ServerLevel level, AgeableMob otherParent) { + return EntityType.GLOW_SQUID.create(level, EntitySpawnReason.BREEDING); + } + @Override protected SoundEvent getSquirtSound() { return SoundEvents.GLOW_SQUID_SQUIRT; @@ -78,8 +87,8 @@ public class GlowSquid extends Squid { } @Override - public boolean hurt(DamageSource source, float amount) { - boolean bl = super.hurt(source, amount); + public boolean hurtServer(ServerLevel serverLevel, DamageSource damageSource, float f) { + boolean bl = super.hurtServer(serverLevel, damageSource, f); if (bl) { this.setDarkTicks(100); } @@ -96,8 +105,14 @@ public class GlowSquid extends Squid { } public static boolean checkGlowSquidSpawnRules( - EntityType glowSquid, ServerLevelAccessor level, MobSpawnType spawnType, BlockPos pos, RandomSource random + EntityType entityType, + ServerLevelAccessor serverLevelAccessor, + EntitySpawnReason entitySpawnReason, + BlockPos blockPos, + RandomSource randomSource ) { - return pos.getY() <= level.getSeaLevel() - 33 && level.getRawBrightness(pos, 0) == 0 && level.getBlockState(pos).is(Blocks.WATER); + return blockPos.getY() <= serverLevelAccessor.getSeaLevel() - 33 + && serverLevelAccessor.getRawBrightness(blockPos, 0) == 0 + && serverLevelAccessor.getBlockState(blockPos).is(Blocks.WATER); } } diff --git a/net/minecraft/world/entity/HumanoidArm.java b/net/minecraft/world/entity/HumanoidArm.java index 77ade7d3..35bdcf1b 100644 --- a/net/minecraft/world/entity/HumanoidArm.java +++ b/net/minecraft/world/entity/HumanoidArm.java @@ -5,13 +5,14 @@ import java.util.function.IntFunction; import net.minecraft.util.ByIdMap; import net.minecraft.util.OptionEnum; import net.minecraft.util.StringRepresentable; +import net.minecraft.util.ByIdMap.OutOfBoundsStrategy; public enum HumanoidArm implements OptionEnum, StringRepresentable { LEFT(0, "left", "options.mainHand.left"), RIGHT(1, "right", "options.mainHand.right"); public static final Codec CODEC = StringRepresentable.fromEnum(HumanoidArm::values); - public static final IntFunction BY_ID = ByIdMap.continuous(HumanoidArm::getId, values(), ByIdMap.OutOfBoundsStrategy.ZERO); + public static final IntFunction BY_ID = ByIdMap.continuous(HumanoidArm::getId, values(), OutOfBoundsStrategy.ZERO); private final int id; private final String name; private final String translationKey; diff --git a/net/minecraft/world/entity/Interaction.java b/net/minecraft/world/entity/Interaction.java index 5d5b48e9..c2a55cd7 100644 --- a/net/minecraft/world/entity/Interaction.java +++ b/net/minecraft/world/entity/Interaction.java @@ -12,9 +12,12 @@ import net.minecraft.nbt.NbtOps; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.network.syncher.SynchedEntityData.Builder; +import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; +import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.player.Player; import net.minecraft.world.level.Level; import net.minecraft.world.level.material.PushReaction; @@ -43,7 +46,7 @@ public class Interaction extends Entity implements Attackable, Targeting { } @Override - protected void defineSynchedData(SynchedEntityData.Builder builder) { + protected void defineSynchedData(Builder builder) { builder.define(DATA_WIDTH_ID, 1.0F); builder.define(DATA_HEIGHT_ID, 1.0F); builder.define(DATA_RESPONSE_ID, false); @@ -100,7 +103,7 @@ public class Interaction extends Entity implements Attackable, Targeting { public void onSyncedDataUpdated(EntityDataAccessor dataAccessor) { super.onSyncedDataUpdated(dataAccessor); if (DATA_HEIGHT_ID.equals(dataAccessor) || DATA_WIDTH_ID.equals(dataAccessor)) { - this.setBoundingBox(this.makeBoundingBox()); + this.refreshDimensions(); } } @@ -138,6 +141,11 @@ public class Interaction extends Entity implements Attackable, Targeting { } } + @Override + public final boolean hurtServer(ServerLevel serverLevel, DamageSource damageSource, float f) { + return false; + } + @Override public InteractionResult interact(Player player, InteractionHand hand) { if (this.level().isClientSide) { diff --git a/net/minecraft/world/entity/Leashable.java b/net/minecraft/world/entity/Leashable.java index b1efc205..9c238c8f 100644 --- a/net/minecraft/world/entity/Leashable.java +++ b/net/minecraft/world/entity/Leashable.java @@ -10,6 +10,7 @@ import net.minecraft.network.protocol.game.ClientboundSetEntityLinkPacket; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.entity.decoration.LeashFenceKnotEntity; import net.minecraft.world.item.Items; +import net.minecraft.world.level.GameRules; import org.jetbrains.annotations.Nullable; public interface Leashable { @@ -94,7 +95,7 @@ public interface Leashable { } if (entity.tickCount > 100) { - entity.spawnAtLocation(Items.LEAD); + entity.spawnAtLocation(serverLevel, Items.LEAD); entity.setLeashData(null); } } @@ -108,17 +109,19 @@ public interface Leashable { Leashable.LeashData leashData = entity.getLeashData(); if (leashData != null && leashData.leashHolder != null) { entity.setLeashData(null); - if (!entity.level().isClientSide && dropItem) { - entity.spawnAtLocation(Items.LEAD); - } + if (entity.level() instanceof ServerLevel serverLevel) { + if (dropItem) { + entity.spawnAtLocation(serverLevel, Items.LEAD); + } - if (broadcastPacket && entity.level() instanceof ServerLevel serverLevel) { - serverLevel.getChunkSource().broadcast(entity, new ClientboundSetEntityLinkPacket(entity, null)); + if (broadcastPacket) { + serverLevel.getChunkSource().broadcast(entity, new ClientboundSetEntityLinkPacket(entity, null)); + } } } } - static void tickLeash(E entity) { + static void tickLeash(ServerLevel serverLevel, E entity) { Leashable.LeashData leashData = entity.getLeashData(); if (leashData != null && leashData.delayedLeashInfo != null) { restoreLeashFromSave(entity, leashData); @@ -126,7 +129,7 @@ public interface Leashable { if (leashData != null && leashData.leashHolder != null) { if (!entity.isAlive() || !leashData.leashHolder.isAlive()) { - dropLeash(entity, true, true); + dropLeash(entity, true, serverLevel.getGameRules().getBoolean(GameRules.RULE_DOENTITYDROPS)); } Entity entity2 = entity.getLeashHolder(); diff --git a/net/minecraft/world/entity/LerpingModel.java b/net/minecraft/world/entity/LerpingModel.java deleted file mode 100644 index a6001f8d..00000000 --- a/net/minecraft/world/entity/LerpingModel.java +++ /dev/null @@ -1,8 +0,0 @@ -package net.minecraft.world.entity; - -import java.util.Map; -import org.joml.Vector3f; - -public interface LerpingModel { - Map getModelRotationValues(); -} diff --git a/net/minecraft/world/entity/LightningBolt.java b/net/minecraft/world/entity/LightningBolt.java index 1404634a..83ac6990 100644 --- a/net/minecraft/world/entity/LightningBolt.java +++ b/net/minecraft/world/entity/LightningBolt.java @@ -10,12 +10,13 @@ import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.Vec3i; import net.minecraft.nbt.CompoundTag; -import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.network.syncher.SynchedEntityData.Builder; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; import net.minecraft.world.Difficulty; +import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.level.GameRules; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.BaseFireBlock; @@ -43,7 +44,6 @@ public class LightningBolt extends Entity { public LightningBolt(EntityType entityType, Level level) { super(entityType, level); - this.noCulling = true; this.life = 2; this.seed = this.random.nextLong(); this.flashes = this.random.nextInt(3) + 1; @@ -152,7 +152,7 @@ public class LightningBolt extends Entity { } private void spawnFire(int extraIgnitions) { - if (!this.visualOnly && !this.level().isClientSide && this.level().getGameRules().getBoolean(GameRules.RULE_DOFIRETICK)) { + if (!this.visualOnly && this.level() instanceof ServerLevel serverLevel && serverLevel.getGameRules().getBoolean(GameRules.RULE_DOFIRETICK)) { BlockPos blockPos = this.blockPosition(); BlockState blockState = BaseFireBlock.getState(this.level(), blockPos); if (this.level().getBlockState(blockPos).isAir() && blockState.canSurvive(this.level(), blockPos)) { @@ -228,7 +228,7 @@ public class LightningBolt extends Entity { } @Override - protected void defineSynchedData(SynchedEntityData.Builder builder) { + protected void defineSynchedData(Builder builder) { } @Override @@ -246,4 +246,9 @@ public class LightningBolt extends Entity { public Stream getHitEntities() { return this.hitEntities.stream().filter(Entity::isAlive); } + + @Override + public final boolean hurtServer(ServerLevel serverLevel, DamageSource damageSource, float f) { + return false; + } } diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java index 74bbdbeb..d7005a0d 100644 --- a/net/minecraft/world/entity/LivingEntity.java +++ b/net/minecraft/world/entity/LivingEntity.java @@ -16,17 +16,21 @@ import it.unimi.dsi.fastutil.objects.Reference2ObjectArrayMap; import it.unimi.dsi.fastutil.objects.Reference2ObjectMap; import java.util.Collection; import java.util.ConcurrentModificationException; +import java.util.EnumMap; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Optional; import java.util.Set; import java.util.Map.Entry; +import java.util.function.BiConsumer; +import java.util.function.DoubleSupplier; +import java.util.function.Function; import java.util.function.Predicate; -import net.minecraft.BlockUtil; import net.minecraft.Util; +import net.minecraft.BlockUtil.FoundRectangle; import net.minecraft.advancements.CriteriaTriggers; -import net.minecraft.commands.arguments.EntityAnchorArgument; +import net.minecraft.commands.arguments.EntityAnchorArgument.Anchor; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.Holder; @@ -50,6 +54,7 @@ import net.minecraft.network.protocol.game.ClientboundUpdateMobEffectPacket; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.network.syncher.SynchedEntityData.Builder; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.level.ServerChunkCache; @@ -57,7 +62,6 @@ import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; -import net.minecraft.sounds.SoundSource; import net.minecraft.stats.Stats; import net.minecraft.tags.BlockTags; import net.minecraft.tags.DamageTypeTags; @@ -66,6 +70,8 @@ import net.minecraft.tags.FluidTags; import net.minecraft.tags.ItemTags; import net.minecraft.tags.TagKey; import net.minecraft.util.Mth; +import net.minecraft.util.profiling.Profiler; +import net.minecraft.util.profiling.ProfilerFiller; import net.minecraft.world.Difficulty; import net.minecraft.world.InteractionHand; import net.minecraft.world.damagesource.CombatRules; @@ -77,6 +83,7 @@ import net.minecraft.world.effect.MobEffectInstance; import net.minecraft.world.effect.MobEffectUtil; import net.minecraft.world.effect.MobEffects; import net.minecraft.world.entity.ai.Brain; +import net.minecraft.world.entity.ai.Brain.Provider; import net.minecraft.world.entity.ai.attributes.Attribute; import net.minecraft.world.entity.ai.attributes.AttributeInstance; import net.minecraft.world.entity.ai.attributes.AttributeMap; @@ -84,7 +91,6 @@ import net.minecraft.world.entity.ai.attributes.AttributeModifier; import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.entity.ai.attributes.DefaultAttributes; -import net.minecraft.world.entity.ai.targeting.TargetingConditions; import net.minecraft.world.entity.animal.FlyingAnimal; import net.minecraft.world.entity.animal.Wolf; import net.minecraft.world.entity.boss.wither.WitherBoss; @@ -92,21 +98,21 @@ import net.minecraft.world.entity.item.ItemEntity; import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.projectile.AbstractArrow; import net.minecraft.world.entity.projectile.Projectile; -import net.minecraft.world.food.FoodProperties; -import net.minecraft.world.item.ArmorItem; import net.minecraft.world.item.AxeItem; -import net.minecraft.world.item.ElytraItem; -import net.minecraft.world.item.Equipable; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.ItemUseAnimation; import net.minecraft.world.item.Items; -import net.minecraft.world.item.UseAnim; +import net.minecraft.world.item.ShieldItem; +import net.minecraft.world.item.component.DeathProtection; import net.minecraft.world.item.enchantment.Enchantment; import net.minecraft.world.item.enchantment.EnchantmentHelper; import net.minecraft.world.item.enchantment.effects.EnchantmentLocationBasedEffect; +import net.minecraft.world.item.equipment.Equippable; import net.minecraft.world.level.ClipContext; import net.minecraft.world.level.GameRules; import net.minecraft.world.level.Level; +import net.minecraft.world.level.ClipContext.Block; import net.minecraft.world.level.block.BedBlock; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.HoneyBlock; @@ -124,8 +130,10 @@ import net.minecraft.world.level.storage.loot.LootTable; import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets; import net.minecraft.world.level.storage.loot.parameters.LootContextParams; import net.minecraft.world.phys.AABB; -import net.minecraft.world.phys.HitResult; import net.minecraft.world.phys.Vec3; +import net.minecraft.world.phys.HitResult.Type; +import net.minecraft.world.phys.shapes.Shapes; +import net.minecraft.world.phys.shapes.VoxelShape; import net.minecraft.world.scores.PlayerTeam; import net.minecraft.world.scores.Scoreboard; import org.jetbrains.annotations.NotNull; @@ -156,7 +164,6 @@ public abstract class LivingEntity extends Entity implements Attackable { public static final int DEATH_DURATION = 20; private static final int TICKS_PER_ELYTRA_FREE_FALL_EVENT = 10; private static final int FREE_FALL_EVENTS_PER_ELYTRA_BREAK = 2; - public static final int USE_ITEM_INTERVAL = 4; public static final float BASE_JUMP_POWER = 0.42F; private static final double MAX_LINE_OF_SIGHT_TEST_RANGE = 128.0; protected static final int LIVING_ENTITY_FLAG_IS_USING = 1; @@ -177,8 +184,15 @@ public abstract class LivingEntity extends Entity implements Attackable { protected static final EntityDimensions SLEEPING_DIMENSIONS = EntityDimensions.fixed(0.2F, 0.2F).withEyeHeight(0.2F); public static final float EXTRA_RENDER_CULLING_SIZE_WITH_BIG_HAT = 0.5F; public static final float DEFAULT_BABY_SCALE = 0.5F; - private static final float ITEM_USE_EFFECT_START_FRACTION = 0.21875F; public static final String ATTRIBUTES_FIELD = "attributes"; + public static final Predicate PLAYER_NOT_WEARING_DISGUISE_ITEM = livingEntity -> { + if (livingEntity instanceof Player player) { + ItemStack itemStack = player.getItemBySlot(EquipmentSlot.HEAD); + return !itemStack.is(ItemTags.GAZE_DISGUISE_EQUIPMENT); + } else { + return true; + } + }; private final AttributeMap attributes; private final CombatTracker combatTracker = new CombatTracker(this); private final Map, MobEffectInstance> activeEffects = Maps., MobEffectInstance>newHashMap(); @@ -205,6 +219,7 @@ public abstract class LivingEntity extends Entity implements Attackable { public float yBodyRotO; public float yHeadRot; public float yHeadRotO; + public final ElytraAnimationState elytraAnimationState = new ElytraAnimationState(this); @Nullable protected Player lastHurtByPlayer; protected int lastHurtByPlayerTime; @@ -261,7 +276,9 @@ public abstract class LivingEntity extends Entity implements Attackable { private float swimAmountO; protected Brain brain; private boolean skipDropExperience; - private final Reference2ObjectMap> activeLocationDependentEnchantments = new Reference2ObjectArrayMap<>(); + private final EnumMap>> activeLocationDependentEnchantments = new EnumMap( + EquipmentSlot.class + ); protected float appliedScale = 1.0F; protected LivingEntity(EntityType entityType, Level level) { @@ -282,7 +299,7 @@ public abstract class LivingEntity extends Entity implements Attackable { return this.brain; } - protected Brain.Provider brainProvider() { + protected Provider brainProvider() { return Brain.provider(ImmutableList.of(), ImmutableList.of()); } @@ -291,8 +308,8 @@ public abstract class LivingEntity extends Entity implements Attackable { } @Override - public void kill() { - this.hurt(this.damageSources().genericKill(), Float.MAX_VALUE); + public void kill(ServerLevel serverLevel) { + this.hurtServer(serverLevel, this.damageSources().genericKill(), Float.MAX_VALUE); } public boolean canAttackType(EntityType entityType) { @@ -300,7 +317,7 @@ public abstract class LivingEntity extends Entity implements Attackable { } @Override - protected void defineSynchedData(SynchedEntityData.Builder builder) { + protected void defineSynchedData(Builder builder) { builder.define(DATA_LIVING_ENTITY_FLAGS, (byte)0); builder.define(DATA_EFFECT_PARTICLES, List.of()); builder.define(DATA_EFFECT_AMBIENCE_ID, false); @@ -310,7 +327,7 @@ public abstract class LivingEntity extends Entity implements Attackable { builder.define(SLEEPING_POS_ID, Optional.empty()); } - public static AttributeSupplier.Builder createLivingAttributes() { + public static net.minecraft.world.entity.ai.attributes.AttributeSupplier.Builder createLivingAttributes() { return AttributeSupplier.builder() .add(Attributes.MAX_HEALTH) .add(Attributes.KNOCKBACK_RESISTANCE) @@ -357,7 +374,7 @@ public abstract class LivingEntity extends Entity implements Attackable { float k = Mth.ceil(this.fallDistance - d); double l = Math.min(0.2F + k / 15.0F, 2.5); int m = (int)(150.0 * l); - ((ServerLevel)this.level()).sendParticles(new BlockParticleOption(ParticleTypes.BLOCK, state), e, f, g, m, 0.0, 0.0, 0.0, 0.15F); + serverLevel.sendParticles(new BlockParticleOption(ParticleTypes.BLOCK, state), e, f, g, m, 0.0, 0.0, 0.0, 0.15F); } } @@ -391,22 +408,23 @@ public abstract class LivingEntity extends Entity implements Attackable { } super.baseTick(); - this.level().getProfiler().push("livingEntityBaseTick"); + ProfilerFiller profilerFiller = Profiler.get(); + profilerFiller.push("livingEntityBaseTick"); if (this.fireImmune() || this.level().isClientSide) { this.clearFire(); } if (this.isAlive()) { boolean bl = this instanceof Player; - if (!this.level().isClientSide) { + if (this.level() instanceof ServerLevel serverLevel2) { if (this.isInWall()) { - this.hurt(this.damageSources().inWall(), 1.0F); + this.hurtServer(serverLevel2, this.damageSources().inWall(), 1.0F); } else if (bl && !this.level().getWorldBorder().isWithinBounds(this.getBoundingBox())) { double d = this.level().getWorldBorder().getDistanceToBorder(this) + this.level().getWorldBorder().getDamageSafeZone(); if (d < 0.0) { double e = this.level().getWorldBorder().getDamagePerBlock(); if (e > 0.0) { - this.hurt(this.damageSources().outOfBorder(), Math.max(1, Mth.floor(-d * e))); + this.hurtServer(serverLevel2, this.damageSources().outOfBorder(), Math.max(1, Mth.floor(-d * e))); } } } @@ -422,10 +440,10 @@ public abstract class LivingEntity extends Entity implements Attackable { Vec3 vec3 = this.getDeltaMovement(); for (int i = 0; i < 8; i++) { + double e = this.random.nextDouble() - this.random.nextDouble(); double f = this.random.nextDouble() - this.random.nextDouble(); double g = this.random.nextDouble() - this.random.nextDouble(); - double h = this.random.nextDouble() - this.random.nextDouble(); - this.level().addParticle(ParticleTypes.BUBBLE, this.getX() + f, this.getY() + g, this.getZ() + h, vec3.x, vec3.y, vec3.z); + this.level().addParticle(ParticleTypes.BUBBLE, this.getX() + e, this.getY() + f, this.getZ() + g, vec3.x, vec3.y, vec3.z); } this.hurt(this.damageSources().drown(), 2.0F); @@ -439,11 +457,11 @@ public abstract class LivingEntity extends Entity implements Attackable { this.setAirSupply(this.increaseAirSupply(this.getAirSupply())); } - if (this.level() instanceof ServerLevel serverLevel2) { + if (this.level() instanceof ServerLevel serverLevel2x) { BlockPos blockPos = this.blockPosition(); if (!Objects.equal(this.lastPos, blockPos)) { this.lastPos = blockPos; - this.onChangedBlock(serverLevel2, blockPos); + this.onChangedBlock(serverLevel2x, blockPos); } } } @@ -488,7 +506,7 @@ public abstract class LivingEntity extends Entity implements Attackable { this.yHeadRotO = this.yHeadRot; this.yRotO = this.getYRot(); this.xRotO = this.getXRot(); - this.level().getProfiler().pop(); + profilerFiller.pop(); } @Override @@ -535,7 +553,7 @@ public abstract class LivingEntity extends Entity implements Attackable { return this.isBaby() ? 0.5F : 1.0F; } - public float getScale() { + public final float getScale() { AttributeMap attributeMap = this.getAttributes(); return attributeMap == null ? 1.0F : this.sanitizeScale((float)attributeMap.getValue(Attributes.SCALE)); } @@ -593,10 +611,10 @@ public abstract class LivingEntity extends Entity implements Attackable { } public final int getExperienceReward(ServerLevel level, @Nullable Entity killer) { - return EnchantmentHelper.processMobExperience(level, killer, this, this.getBaseExperienceReward()); + return EnchantmentHelper.processMobExperience(level, killer, this, this.getBaseExperienceReward(level)); } - protected int getBaseExperienceReward() { + protected int getBaseExperienceReward(ServerLevel serverLevel) { return 0; } @@ -674,17 +692,17 @@ public abstract class LivingEntity extends Entity implements Attackable { } public void onEquipItem(EquipmentSlot slot, ItemStack oldItem, ItemStack newItem) { - boolean bl = newItem.isEmpty() && oldItem.isEmpty(); - if (!bl && !ItemStack.isSameItemSameComponents(oldItem, newItem) && !this.firstTick) { - Equipable equipable = Equipable.get(newItem); - if (!this.level().isClientSide() && !this.isSpectator()) { - if (!this.isSilent() && equipable != null && equipable.getEquipmentSlot() == slot) { + if (!this.level().isClientSide() && !this.isSpectator()) { + boolean bl = newItem.isEmpty() && oldItem.isEmpty(); + if (!bl && !ItemStack.isSameItemSameComponents(oldItem, newItem) && !this.firstTick) { + Equippable equippable = newItem.get(DataComponents.EQUIPPABLE); + if (!this.isSilent() && equippable != null && slot == equippable.slot()) { this.level() - .playSeededSound(null, this.getX(), this.getY(), this.getZ(), equipable.getEquipSound(), this.getSoundSource(), 1.0F, 1.0F, this.random.nextLong()); + .playSeededSound(null, this.getX(), this.getY(), this.getZ(), equippable.equipSound(), this.getSoundSource(), 1.0F, 1.0F, this.random.nextLong()); } if (this.doesEmitEquipEvent(slot)) { - this.gameEvent(equipable != null ? GameEvent.EQUIP : GameEvent.UNEQUIP); + this.gameEvent(equippable != null ? GameEvent.EQUIP : GameEvent.UNEQUIP); } } } @@ -692,17 +710,17 @@ public abstract class LivingEntity extends Entity implements Attackable { @Override public void remove(Entity.RemovalReason reason) { - if (reason == Entity.RemovalReason.KILLED || reason == Entity.RemovalReason.DISCARDED) { - this.triggerOnDeathMobEffects(reason); + if ((reason == Entity.RemovalReason.KILLED || reason == Entity.RemovalReason.DISCARDED) && this.level() instanceof ServerLevel serverLevel) { + this.triggerOnDeathMobEffects(serverLevel, reason); } super.remove(reason); this.brain.clearMemories(); } - protected void triggerOnDeathMobEffects(Entity.RemovalReason removalReason) { + protected void triggerOnDeathMobEffects(ServerLevel serverLevel, Entity.RemovalReason removalReason) { for (MobEffectInstance mobEffectInstance : this.getActiveEffects()) { - mobEffectInstance.onMobRemoved(this, removalReason); + mobEffectInstance.onMobRemoved(serverLevel, this, removalReason); } this.activeEffects.clear(); @@ -800,7 +818,7 @@ public abstract class LivingEntity extends Entity implements Attackable { if (!mobEffectInstance.tick(this, () -> this.onEffectUpdated(mobEffectInstance, true, null))) { if (!this.level().isClientSide) { iterator.remove(); - this.onEffectRemoved(mobEffectInstance); + this.onEffectsRemoved(List.of(mobEffectInstance)); } } else if (mobEffectInstance.getDuration() % 600 == 0) { this.onEffectUpdated(mobEffectInstance, false, null); @@ -889,10 +907,6 @@ public abstract class LivingEntity extends Entity implements Attackable { return target instanceof Player && this.level().getDifficulty() == Difficulty.PEACEFUL ? false : target.canBeSeenAsEnemy(); } - public boolean canAttack(LivingEntity livingentity, TargetingConditions condition) { - return condition.test(this, livingentity); - } - public boolean canBeSeenAsEnemy() { return !this.isInvulnerable() && this.canBeSeenByAnyone(); } @@ -924,16 +938,13 @@ public abstract class LivingEntity extends Entity implements Attackable { public boolean removeAllEffects() { if (this.level().isClientSide) { return false; + } else if (this.activeEffects.isEmpty()) { + return false; } else { - Iterator iterator = this.activeEffects.values().iterator(); - - boolean bl; - for (bl = false; iterator.hasNext(); bl = true) { - this.onEffectRemoved((MobEffectInstance)iterator.next()); - iterator.remove(); - } - - return bl; + Map, MobEffectInstance> map = Maps., MobEffectInstance>newHashMap(this.activeEffects); + this.activeEffects.clear(); + this.onEffectsRemoved(map.values()); + return true; } } @@ -1018,7 +1029,7 @@ public abstract class LivingEntity extends Entity implements Attackable { public boolean removeEffect(Holder effect) { MobEffectInstance mobEffectInstance = this.removeEffectNoUpdate(effect); if (mobEffectInstance != null) { - this.onEffectRemoved(mobEffectInstance); + this.onEffectsRemoved(List.of(mobEffectInstance)); return true; } else { return false; @@ -1055,17 +1066,20 @@ public abstract class LivingEntity extends Entity implements Attackable { } } - protected void onEffectRemoved(MobEffectInstance effectInstance) { + protected void onEffectsRemoved(Collection collection) { this.effectsDirty = true; if (!this.level().isClientSide) { - effectInstance.getEffect().value().removeAttributeModifiers(this.getAttributes()); - this.refreshDirtyAttributes(); + for (MobEffectInstance mobEffectInstance : collection) { + mobEffectInstance.getEffect().value().removeAttributeModifiers(this.getAttributes()); - for (Entity entity : this.getPassengers()) { - if (entity instanceof ServerPlayer serverPlayer) { - serverPlayer.connection.send(new ClientboundRemoveMobEffectPacket(this.getId(), effectInstance.getEffect())); + for (Entity entity : this.getPassengers()) { + if (entity instanceof ServerPlayer serverPlayer) { + serverPlayer.connection.send(new ClientboundRemoveMobEffectPacket(this.getId(), mobEffectInstance.getEffect())); + } } } + + this.refreshDirtyAttributes(); } } @@ -1079,7 +1093,7 @@ public abstract class LivingEntity extends Entity implements Attackable { set.clear(); } - private void onAttributeUpdated(Holder attribute) { + protected void onAttributeUpdated(Holder attribute) { if (attribute.is(Attributes.MAX_HEALTH)) { float f = this.getMaxHealth(); if (this.getHealth() > f) { @@ -1116,67 +1130,73 @@ public abstract class LivingEntity extends Entity implements Attackable { } @Override - public boolean hurt(DamageSource source, float amount) { - if (this.isInvulnerableTo(source)) { - return false; - } else if (this.level().isClientSide) { + public boolean hurtServer(ServerLevel serverLevel, DamageSource damageSource, float f) { + if (this.isInvulnerableTo(serverLevel, damageSource)) { return false; } else if (this.isDeadOrDying()) { return false; - } else if (source.is(DamageTypeTags.IS_FIRE) && this.hasEffect(MobEffects.FIRE_RESISTANCE)) { + } else if (damageSource.is(DamageTypeTags.IS_FIRE) && this.hasEffect(MobEffects.FIRE_RESISTANCE)) { return false; } else { - if (this.isSleeping() && !this.level().isClientSide) { + if (this.isSleeping()) { this.stopSleeping(); } this.noActionTime = 0; - float f = amount; + if (f < 0.0F) { + f = 0.0F; + } + + float g = f; boolean bl = false; - float g = 0.0F; - if (amount > 0.0F && this.isDamageSourceBlocked(source)) { - this.hurtCurrentlyUsedShield(amount); - g = amount; - amount = 0.0F; - if (!source.is(DamageTypeTags.IS_PROJECTILE) && source.getDirectEntity() instanceof LivingEntity livingEntity) { + float h = 0.0F; + if (f > 0.0F && this.isDamageSourceBlocked(damageSource)) { + this.hurtCurrentlyUsedShield(f); + h = f; + f = 0.0F; + if (!damageSource.is(DamageTypeTags.IS_PROJECTILE) && damageSource.getDirectEntity() instanceof LivingEntity livingEntity) { this.blockUsingShield(livingEntity); } bl = true; } - if (source.is(DamageTypeTags.IS_FREEZING) && this.getType().is(EntityTypeTags.FREEZE_HURTS_EXTRA_TYPES)) { - amount *= 5.0F; + if (damageSource.is(DamageTypeTags.IS_FREEZING) && this.getType().is(EntityTypeTags.FREEZE_HURTS_EXTRA_TYPES)) { + f *= 5.0F; } - if (source.is(DamageTypeTags.DAMAGES_HELMET) && !this.getItemBySlot(EquipmentSlot.HEAD).isEmpty()) { - this.hurtHelmet(source, amount); - amount *= 0.75F; + if (damageSource.is(DamageTypeTags.DAMAGES_HELMET) && !this.getItemBySlot(EquipmentSlot.HEAD).isEmpty()) { + this.hurtHelmet(damageSource, f); + f *= 0.75F; } this.walkAnimation.setSpeed(1.5F); + if (Float.isNaN(f) || Float.isInfinite(f)) { + f = Float.MAX_VALUE; + } + boolean bl2 = true; - if (this.invulnerableTime > 10.0F && !source.is(DamageTypeTags.BYPASSES_COOLDOWN)) { - if (amount <= this.lastHurt) { + if (this.invulnerableTime > 10.0F && !damageSource.is(DamageTypeTags.BYPASSES_COOLDOWN)) { + if (f <= this.lastHurt) { return false; } - this.actuallyHurt(source, amount - this.lastHurt); - this.lastHurt = amount; + this.actuallyHurt(serverLevel, damageSource, f - this.lastHurt); + this.lastHurt = f; bl2 = false; } else { - this.lastHurt = amount; + this.lastHurt = f; this.invulnerableTime = 20; - this.actuallyHurt(source, amount); + this.actuallyHurt(serverLevel, damageSource, f); this.hurtDuration = 10; this.hurtTime = this.hurtDuration; } - Entity entity2 = source.getEntity(); + Entity entity2 = damageSource.getEntity(); if (entity2 != null) { if (entity2 instanceof LivingEntity livingEntity2 - && !source.is(DamageTypeTags.NO_ANGER) - && (!source.is(DamageTypes.WIND_CHARGE) || !this.getType().is(EntityTypeTags.NO_ANGER_FROM_WIND_CHARGE))) { + && !damageSource.is(DamageTypeTags.NO_ANGER) + && (!damageSource.is(DamageTypes.WIND_CHARGE) || !this.getType().is(EntityTypeTags.NO_ANGER_FROM_WIND_CHARGE))) { this.setLastHurtByMob(livingEntity2); } @@ -1195,25 +1215,25 @@ public abstract class LivingEntity extends Entity implements Attackable { if (bl2) { if (bl) { - this.level().broadcastEntityEvent(this, (byte)29); + serverLevel.broadcastEntityEvent(this, (byte)29); } else { - this.level().broadcastDamageEvent(this, source); + serverLevel.broadcastDamageEvent(this, damageSource); } - if (!source.is(DamageTypeTags.NO_IMPACT) && (!bl || amount > 0.0F)) { + if (!damageSource.is(DamageTypeTags.NO_IMPACT) && (!bl || f > 0.0F)) { this.markHurt(); } - if (!source.is(DamageTypeTags.NO_KNOCKBACK)) { + if (!damageSource.is(DamageTypeTags.NO_KNOCKBACK)) { double d = 0.0; double e = 0.0; - if (source.getDirectEntity() instanceof Projectile projectile) { - DoubleDoubleImmutablePair doubleDoubleImmutablePair = projectile.calculateHorizontalHurtKnockbackDirection(this, source); + if (damageSource.getDirectEntity() instanceof Projectile projectile) { + DoubleDoubleImmutablePair doubleDoubleImmutablePair = projectile.calculateHorizontalHurtKnockbackDirection(this, damageSource); d = -doubleDoubleImmutablePair.leftDouble(); e = -doubleDoubleImmutablePair.rightDouble(); - } else if (source.getSourcePosition() != null) { - d = source.getSourcePosition().x() - this.getX(); - e = source.getSourcePosition().z() - this.getZ(); + } else if (damageSource.getSourcePosition() != null) { + d = damageSource.getSourcePosition().x() - this.getX(); + e = damageSource.getSourcePosition().z() - this.getZ(); } this.knockback(0.4F, d, e); @@ -1224,36 +1244,36 @@ public abstract class LivingEntity extends Entity implements Attackable { } if (this.isDeadOrDying()) { - if (!this.checkTotemDeathProtection(source)) { + if (!this.checkTotemDeathProtection(damageSource)) { if (bl2) { this.makeSound(this.getDeathSound()); } - this.die(source); + this.die(damageSource); } } else if (bl2) { - this.playHurtSound(source); + this.playHurtSound(damageSource); } - boolean bl3 = !bl || amount > 0.0F; + boolean bl3 = !bl || f > 0.0F; if (bl3) { - this.lastDamageSource = source; + this.lastDamageSource = damageSource; this.lastDamageStamp = this.level().getGameTime(); for (MobEffectInstance mobEffectInstance : this.getActiveEffects()) { - mobEffectInstance.onMobHurt(this, source, amount); + mobEffectInstance.onMobHurt(serverLevel, this, damageSource, f); } } - if (this instanceof ServerPlayer) { - CriteriaTriggers.ENTITY_HURT_PLAYER.trigger((ServerPlayer)this, source, f, amount, bl); - if (g > 0.0F && g < 3.4028235E37F) { - ((ServerPlayer)this).awardStat(Stats.DAMAGE_BLOCKED_BY_SHIELD, Math.round(g * 10.0F)); + if (this instanceof ServerPlayer serverPlayer) { + CriteriaTriggers.ENTITY_HURT_PLAYER.trigger(serverPlayer, damageSource, g, f, bl); + if (h > 0.0F && h < 3.4028235E37F) { + serverPlayer.awardStat(Stats.DAMAGE_BLOCKED_BY_SHIELD, Math.round(h * 10.0F)); } } - if (entity2 instanceof ServerPlayer) { - CriteriaTriggers.PLAYER_HURT_ENTITY.trigger((ServerPlayer)entity2, this, source, f, amount, bl); + if (entity2 instanceof ServerPlayer serverPlayerx) { + CriteriaTriggers.PLAYER_HURT_ENTITY.trigger(serverPlayerx, this, damageSource, g, f, bl); } return bl3; @@ -1273,10 +1293,12 @@ public abstract class LivingEntity extends Entity implements Attackable { return false; } else { ItemStack itemStack = null; + DeathProtection deathProtection = null; for (InteractionHand interactionHand : InteractionHand.values()) { ItemStack itemStack2 = this.getItemInHand(interactionHand); - if (itemStack2.is(Items.TOTEM_OF_UNDYING)) { + deathProtection = itemStack2.get(DataComponents.DEATH_PROTECTION); + if (deathProtection != null) { itemStack = itemStack2.copy(); itemStack2.shrink(1); break; @@ -1285,20 +1307,17 @@ public abstract class LivingEntity extends Entity implements Attackable { if (itemStack != null) { if (this instanceof ServerPlayer serverPlayer) { - serverPlayer.awardStat(Stats.ITEM_USED.get(Items.TOTEM_OF_UNDYING)); + serverPlayer.awardStat(Stats.ITEM_USED.get(itemStack.getItem())); CriteriaTriggers.USED_TOTEM.trigger(serverPlayer, itemStack); this.gameEvent(GameEvent.ITEM_INTERACT_FINISH); } this.setHealth(1.0F); - this.removeAllEffects(); - this.addEffect(new MobEffectInstance(MobEffects.REGENERATION, 900, 1)); - this.addEffect(new MobEffectInstance(MobEffects.ABSORPTION, 100, 1)); - this.addEffect(new MobEffectInstance(MobEffects.FIRE_RESISTANCE, 800, 0)); + deathProtection.applyEffects(itemStack, this); this.level().broadcastEntityEvent(this, (byte)35); } - return itemStack != null; + return deathProtection != null; } } @@ -1331,7 +1350,8 @@ public abstract class LivingEntity extends Entity implements Attackable { bl = true; } - if (!damageSource.is(DamageTypeTags.BYPASSES_SHIELD) && this.isBlocking() && !bl) { + ItemStack itemStack = this.getItemBlockingWith(); + if (!damageSource.is(DamageTypeTags.BYPASSES_SHIELD) && itemStack != null && itemStack.getItem() instanceof ShieldItem && !bl) { Vec3 vec3 = damageSource.getSourcePosition(); if (vec3 != null) { Vec3 vec32 = this.calculateViewVector(0.0F, this.getYHeadRot()); @@ -1396,19 +1416,19 @@ public abstract class LivingEntity extends Entity implements Attackable { } protected void createWitherRose(@Nullable LivingEntity entitySource) { - if (!this.level().isClientSide) { - boolean bl = false; + if (this.level() instanceof ServerLevel serverLevel) { + boolean var6 = false; if (entitySource instanceof WitherBoss) { - if (this.level().getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { + if (serverLevel.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { BlockPos blockPos = this.blockPosition(); BlockState blockState = Blocks.WITHER_ROSE.defaultBlockState(); if (this.level().getBlockState(blockPos).isAir() && blockState.canSurvive(this.level(), blockPos)) { this.level().setBlock(blockPos, blockState, 3); - bl = true; + var6 = true; } } - if (!bl) { + if (!var6) { ItemEntity itemEntity = new ItemEntity(this.level(), this.getX(), this.getY(), this.getZ(), new ItemStack(Items.WITHER_ROSE)); this.level().addFreshEntity(itemEntity); } @@ -1419,23 +1439,22 @@ public abstract class LivingEntity extends Entity implements Attackable { protected void dropAllDeathLoot(ServerLevel level, DamageSource damageSource) { boolean bl = this.lastHurtByPlayerTime > 0; if (this.shouldDropLoot() && level.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) { - this.dropFromLootTable(damageSource, bl); + this.dropFromLootTable(level, damageSource, bl); this.dropCustomDeathLoot(level, damageSource, bl); } - this.dropEquipment(); - this.dropExperience(damageSource.getEntity()); + this.dropEquipment(level); + this.dropExperience(level, damageSource.getEntity()); } - protected void dropEquipment() { + protected void dropEquipment(ServerLevel serverLevel) { } - protected void dropExperience(@Nullable Entity entity) { - if (this.level() instanceof ServerLevel serverLevel - && !this.wasExperienceConsumed() + protected void dropExperience(ServerLevel serverLevel, @Nullable Entity entity) { + if (!this.wasExperienceConsumed() && ( this.isAlwaysExperienceDropper() - || this.lastHurtByPlayerTime > 0 && this.shouldDropExperience() && this.level().getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT) + || this.lastHurtByPlayerTime > 0 && this.shouldDropExperience() && serverLevel.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT) )) { ExperienceOrb.award(serverLevel, this.position(), this.getExperienceReward(serverLevel, entity)); } @@ -1444,10 +1463,6 @@ public abstract class LivingEntity extends Entity implements Attackable { protected void dropCustomDeathLoot(ServerLevel level, DamageSource damageSource, boolean recentlyHit) { } - public ResourceKey getLootTable() { - return this.getType().getDefaultLootTable(); - } - public long getLootTableSeed() { return 0L; } @@ -1457,21 +1472,62 @@ public abstract class LivingEntity extends Entity implements Attackable { return this.level() instanceof ServerLevel serverLevel ? EnchantmentHelper.modifyKnockback(serverLevel, this.getWeaponItem(), attacker, damageSource, f) : f; } - protected void dropFromLootTable(DamageSource damageSource, boolean hitByPlayer) { - ResourceKey resourceKey = this.getLootTable(); - LootTable lootTable = this.level().getServer().reloadableRegistries().getLootTable(resourceKey); - LootParams.Builder builder = new LootParams.Builder((ServerLevel)this.level()) - .withParameter(LootContextParams.THIS_ENTITY, this) - .withParameter(LootContextParams.ORIGIN, this.position()) - .withParameter(LootContextParams.DAMAGE_SOURCE, damageSource) - .withOptionalParameter(LootContextParams.ATTACKING_ENTITY, damageSource.getEntity()) - .withOptionalParameter(LootContextParams.DIRECT_ATTACKING_ENTITY, damageSource.getDirectEntity()); - if (hitByPlayer && this.lastHurtByPlayer != null) { - builder = builder.withParameter(LootContextParams.LAST_DAMAGE_PLAYER, this.lastHurtByPlayer).withLuck(this.lastHurtByPlayer.getLuck()); - } + protected void dropFromLootTable(ServerLevel serverLevel, DamageSource damageSource, boolean bl) { + Optional> optional = this.getLootTable(); + if (!optional.isEmpty()) { + LootTable lootTable = serverLevel.getServer().reloadableRegistries().getLootTable((ResourceKey)optional.get()); + LootParams.Builder builder = new LootParams.Builder(serverLevel) + .withParameter(LootContextParams.THIS_ENTITY, this) + .withParameter(LootContextParams.ORIGIN, this.position()) + .withParameter(LootContextParams.DAMAGE_SOURCE, damageSource) + .withOptionalParameter(LootContextParams.ATTACKING_ENTITY, damageSource.getEntity()) + .withOptionalParameter(LootContextParams.DIRECT_ATTACKING_ENTITY, damageSource.getDirectEntity()); + if (bl && this.lastHurtByPlayer != null) { + builder = builder.withParameter(LootContextParams.LAST_DAMAGE_PLAYER, this.lastHurtByPlayer).withLuck(this.lastHurtByPlayer.getLuck()); + } - LootParams lootParams = builder.create(LootContextParamSets.ENTITY); - lootTable.getRandomItems(lootParams, this.getLootTableSeed(), this::spawnAtLocation); + LootParams lootParams = builder.create(LootContextParamSets.ENTITY); + lootTable.getRandomItems(lootParams, this.getLootTableSeed(), itemStack -> this.spawnAtLocation(serverLevel, itemStack)); + } + } + + public boolean dropFromGiftLootTable(ServerLevel serverLevel, ResourceKey resourceKey, BiConsumer biConsumer) { + return this.dropFromLootTable( + serverLevel, + resourceKey, + builder -> builder.withParameter(LootContextParams.ORIGIN, this.position()) + .withParameter(LootContextParams.THIS_ENTITY, this) + .create(LootContextParamSets.GIFT), + biConsumer + ); + } + + protected void dropFromShearingLootTable( + ServerLevel serverLevel, ResourceKey resourceKey, ItemStack itemStack, BiConsumer biConsumer + ) { + this.dropFromLootTable( + serverLevel, + resourceKey, + builder -> builder.withParameter(LootContextParams.ORIGIN, this.position()) + .withParameter(LootContextParams.THIS_ENTITY, this) + .withParameter(LootContextParams.TOOL, itemStack) + .create(LootContextParamSets.SHEARING), + biConsumer + ); + } + + protected boolean dropFromLootTable( + ServerLevel serverLevel, ResourceKey resourceKey, Function function, BiConsumer biConsumer + ) { + LootTable lootTable = serverLevel.getServer().reloadableRegistries().getLootTable(resourceKey); + LootParams lootParams = (LootParams)function.apply(new LootParams.Builder(serverLevel)); + List list = lootTable.getRandomItems(lootParams); + if (!list.isEmpty()) { + list.forEach(itemStack -> biConsumer.accept(serverLevel, itemStack)); + return true; + } else { + return false; + } } public void knockback(double strength, double x, double z) { @@ -1530,22 +1586,15 @@ public abstract class LivingEntity extends Entity implements Attackable { } } - public Map> activeLocationDependentEnchantments() { - return this.activeLocationDependentEnchantments; + public Map> activeLocationDependentEnchantments(EquipmentSlot equipmentSlot) { + return (Map>)this.activeLocationDependentEnchantments + .computeIfAbsent(equipmentSlot, equipmentSlotx -> new Reference2ObjectArrayMap()); } public LivingEntity.Fallsounds getFallSounds() { return new LivingEntity.Fallsounds(SoundEvents.GENERIC_SMALL_FALL, SoundEvents.GENERIC_BIG_FALL); } - protected SoundEvent getDrinkingSound(ItemStack stack) { - return stack.getDrinkingSound(); - } - - public SoundEvent getEatingSound(ItemStack stack) { - return stack.getEatingSound(); - } - public Optional getLastClimbablePos() { return this.lastClimbablePos; } @@ -1585,6 +1634,28 @@ public abstract class LivingEntity extends Entity implements Attackable { return !this.isRemoved() && this.getHealth() > 0.0F; } + public boolean isLookingAtMe( + LivingEntity livingEntity, double d, boolean bl, boolean bl2, Predicate predicate, DoubleSupplier... doubleSuppliers + ) { + if (!predicate.test(livingEntity)) { + return false; + } else { + Vec3 vec3 = livingEntity.getViewVector(1.0F).normalize(); + + for (DoubleSupplier doubleSupplier : doubleSuppliers) { + Vec3 vec32 = new Vec3(this.getX() - livingEntity.getX(), doubleSupplier.getAsDouble() - livingEntity.getEyeY(), this.getZ() - livingEntity.getZ()); + double e = vec32.length(); + vec32 = vec32.normalize(); + double f = vec3.dot(vec32); + if (f > 1.0 - d / (bl ? e : 1.0)) { + return livingEntity.hasLineOfSight(this, bl2 ? Block.VISUAL : Block.COLLIDER, net.minecraft.world.level.ClipContext.Fluid.NONE, doubleSupplier); + } + } + + return false; + } + } + @Override public int getMaxFallDistance() { return this.getComfortableFallDistance(0.0F); @@ -1662,7 +1733,8 @@ public abstract class LivingEntity extends Entity implements Attackable { for (EquipmentSlot equipmentSlot : slots) { ItemStack itemStack = this.getItemBySlot(equipmentSlot); - if (itemStack.getItem() instanceof ArmorItem && itemStack.canBeHurtBy(damageSource)) { + Equippable equippable = itemStack.get(DataComponents.EQUIPPABLE); + if (equippable != null && equippable.damageOnHurt() && itemStack.isDamageableItem() && itemStack.canBeHurtBy(damageSource)) { itemStack.hurtAndBreak(i, this, equipmentSlot); } } @@ -1727,24 +1799,21 @@ public abstract class LivingEntity extends Entity implements Attackable { } } - /** - * Deals damage to the entity. This will take the armor of the entity into consideration before damaging the health bar. - */ - protected void actuallyHurt(DamageSource damageSource, float damageAmount) { - if (!this.isInvulnerableTo(damageSource)) { - damageAmount = this.getDamageAfterArmorAbsorb(damageSource, damageAmount); - damageAmount = this.getDamageAfterMagicAbsorb(damageSource, damageAmount); - float var9 = Math.max(damageAmount - this.getAbsorptionAmount(), 0.0F); - this.setAbsorptionAmount(this.getAbsorptionAmount() - (damageAmount - var9)); - float g = damageAmount - var9; - if (g > 0.0F && g < 3.4028235E37F && damageSource.getEntity() instanceof ServerPlayer serverPlayer) { - serverPlayer.awardStat(Stats.DAMAGE_DEALT_ABSORBED, Math.round(g * 10.0F)); + protected void actuallyHurt(ServerLevel serverLevel, DamageSource damageSource, float f) { + if (!this.isInvulnerableTo(serverLevel, damageSource)) { + f = this.getDamageAfterArmorAbsorb(damageSource, f); + f = this.getDamageAfterMagicAbsorb(damageSource, f); + float var10 = Math.max(f - this.getAbsorptionAmount(), 0.0F); + this.setAbsorptionAmount(this.getAbsorptionAmount() - (f - var10)); + float h = f - var10; + if (h > 0.0F && h < 3.4028235E37F && damageSource.getEntity() instanceof ServerPlayer serverPlayer) { + serverPlayer.awardStat(Stats.DAMAGE_DEALT_ABSORBED, Math.round(h * 10.0F)); } - if (var9 != 0.0F) { - this.getCombatTracker().recordDamage(damageSource, var9); - this.setHealth(this.getHealth() - var9); - this.setAbsorptionAmount(this.getAbsorptionAmount() - var9); + if (var10 != 0.0F) { + this.getCombatTracker().recordDamage(damageSource, var10); + this.setHealth(this.getHealth() - var10); + this.setAbsorptionAmount(this.getAbsorptionAmount() - var10); this.gameEvent(GameEvent.ENTITY_DAMAGE); } } @@ -1842,7 +1911,6 @@ public abstract class LivingEntity extends Entity implements Attackable { this.playSound(soundEvent, this.getSoundVolume(), (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F); } - this.hurt(this.damageSources().generic(), 0.0F); this.lastDamageSource = damageSource; this.lastDamageStamp = this.level().getGameTime(); } @@ -1916,12 +1984,13 @@ public abstract class LivingEntity extends Entity implements Attackable { } } - private void makePoofParticles() { + public void makePoofParticles() { for (int i = 0; i < 20; i++) { double d = this.random.nextGaussian() * 0.02; double e = this.random.nextGaussian() * 0.02; double f = this.random.nextGaussian() * 0.02; - this.level().addParticle(ParticleTypes.POOF, this.getRandomX(1.0), this.getRandomY(), this.getRandomZ(1.0), d, e, f); + double g = 10.0; + this.level().addParticle(ParticleTypes.POOF, this.getRandomX(1.0) - d * 10.0, this.getRandomY() - e * 10.0, this.getRandomZ(1.0) - f * 10.0, d, e, f); } } @@ -1979,6 +2048,10 @@ public abstract class LivingEntity extends Entity implements Attackable { return this.getItemBySlot(EquipmentSlot.OFFHAND); } + public ItemStack getItemHeldByArm(HumanoidArm humanoidArm) { + return this.getMainArm() == humanoidArm ? this.getMainHandItem() : this.getOffhandItem(); + } + @NotNull @Override public ItemStack getWeaponItem() { @@ -2108,6 +2181,16 @@ public abstract class LivingEntity extends Entity implements Attackable { } else { double d = Math.max(this.getY(), vehicle.getY()); vec3 = new Vec3(this.getX(), d, this.getZ()); + boolean bl = this.getBbWidth() <= 4.0F && this.getBbHeight() <= 4.0F; + if (bl) { + double e = this.getBbHeight() / 2.0; + Vec3 vec32 = vec3.add(0.0, e, 0.0); + VoxelShape voxelShape = Shapes.create(AABB.ofSize(vec32, this.getBbWidth(), this.getBbHeight(), this.getBbWidth())); + vec3 = (Vec3)this.level() + .findFreePosition(this, voxelShape, vec32, this.getBbWidth(), this.getBbHeight(), this.getBbWidth()) + .map(vec3x -> vec3x.add(0.0, -e, 0.0)) + .orElse(vec3); + } } this.dismountTo(vec3.x, vec3.y, vec3.z); @@ -2138,7 +2221,7 @@ public abstract class LivingEntity extends Entity implements Attackable { float f = this.getJumpPower(); if (!(f <= 1.0E-5F)) { Vec3 vec3 = this.getDeltaMovement(); - this.setDeltaMovement(vec3.x, f, vec3.z); + this.setDeltaMovement(vec3.x, Math.max(f, vec3.y), vec3.z); if (this.isSprinting()) { float g = this.getYRot() * (float) (Math.PI / 180.0); this.addDeltaMovement(new Vec3(-Mth.sin(g) * 0.2, 0.0, Mth.cos(g) * 0.2)); @@ -2169,131 +2252,146 @@ public abstract class LivingEntity extends Entity implements Attackable { return this.getAttributeValue(Attributes.GRAVITY); } + protected double getEffectiveGravity() { + boolean bl = this.getDeltaMovement().y <= 0.0; + return bl && this.hasEffect(MobEffects.SLOW_FALLING) ? Math.min(this.getGravity(), 0.01) : this.getGravity(); + } + public void travel(Vec3 travelVector) { if (this.isControlledByLocalInstance()) { - double d = this.getGravity(); - boolean bl = this.getDeltaMovement().y <= 0.0; - if (bl && this.hasEffect(MobEffects.SLOW_FALLING)) { - d = Math.min(d, 0.01); + FluidState fluidState = this.level().getFluidState(this.blockPosition()); + if ((this.isInWater() || this.isInLava()) && this.isAffectedByFluids() && !this.canStandOnFluid(fluidState)) { + this.travelInFluid(travelVector); + } else if (this.isFallFlying()) { + this.travelFallFlying(); + } else { + this.travelInAir(travelVector); + } + } + } + + private void travelInAir(Vec3 vec3) { + BlockPos blockPos = this.getBlockPosBelowThatAffectsMyMovement(); + float f = this.onGround() ? this.level().getBlockState(blockPos).getBlock().getFriction() : 1.0F; + float g = f * 0.91F; + Vec3 vec32 = this.handleRelativeFrictionAndCalculateMovement(vec3, f); + double d = vec32.y; + MobEffectInstance mobEffectInstance = this.getEffect(MobEffects.LEVITATION); + if (mobEffectInstance != null) { + d += (0.05 * (mobEffectInstance.getAmplifier() + 1) - vec32.y) * 0.2; + } else if (!this.level().isClientSide || this.level().hasChunkAt(blockPos)) { + d -= this.getEffectiveGravity(); + } else if (this.getY() > this.level().getMinY()) { + d = -0.1; + } else { + d = 0.0; + } + + if (this.shouldDiscardFriction()) { + this.setDeltaMovement(vec32.x, d, vec32.z); + } else { + float h = this instanceof FlyingAnimal ? g : 0.98F; + this.setDeltaMovement(vec32.x * g, d * h, vec32.z * g); + } + } + + private void travelInFluid(Vec3 vec3) { + boolean bl = this.getDeltaMovement().y <= 0.0; + double d = this.getY(); + double e = this.getEffectiveGravity(); + if (this.isInWater()) { + float f = this.isSprinting() ? 0.9F : this.getWaterSlowDown(); + float g = 0.02F; + float h = (float)this.getAttributeValue(Attributes.WATER_MOVEMENT_EFFICIENCY); + if (!this.onGround()) { + h *= 0.5F; } - FluidState fluidState = this.level().getFluidState(this.blockPosition()); - if (this.isInWater() && this.isAffectedByFluids() && !this.canStandOnFluid(fluidState)) { - double e = this.getY(); - float f = this.isSprinting() ? 0.9F : this.getWaterSlowDown(); - float g = 0.02F; - float h = (float)this.getAttributeValue(Attributes.WATER_MOVEMENT_EFFICIENCY); - if (!this.onGround()) { - h *= 0.5F; - } + if (h > 0.0F) { + f += (0.54600006F - f) * h; + g += (this.getSpeed() - g) * h; + } - if (h > 0.0F) { - f += (0.54600006F - f) * h; - g += (this.getSpeed() - g) * h; - } + if (this.hasEffect(MobEffects.DOLPHINS_GRACE)) { + f = 0.96F; + } - if (this.hasEffect(MobEffects.DOLPHINS_GRACE)) { - f = 0.96F; - } + this.moveRelative(g, vec3); + this.move(MoverType.SELF, this.getDeltaMovement()); + Vec3 vec32 = this.getDeltaMovement(); + if (this.horizontalCollision && this.onClimbable()) { + vec32 = new Vec3(vec32.x, 0.2, vec32.z); + } - this.moveRelative(g, travelVector); - this.move(MoverType.SELF, this.getDeltaMovement()); - Vec3 vec3 = this.getDeltaMovement(); - if (this.horizontalCollision && this.onClimbable()) { - vec3 = new Vec3(vec3.x, 0.2, vec3.z); - } - - this.setDeltaMovement(vec3.multiply(f, 0.8F, f)); - Vec3 vec32 = this.getFluidFallingAdjustedMovement(d, bl, this.getDeltaMovement()); - this.setDeltaMovement(vec32); - if (this.horizontalCollision && this.isFree(vec32.x, vec32.y + 0.6F - this.getY() + e, vec32.z)) { - this.setDeltaMovement(vec32.x, 0.3F, vec32.z); - } - } else if (this.isInLava() && this.isAffectedByFluids() && !this.canStandOnFluid(fluidState)) { - double ex = this.getY(); - this.moveRelative(0.02F, travelVector); - this.move(MoverType.SELF, this.getDeltaMovement()); - if (this.getFluidHeight(FluidTags.LAVA) <= this.getFluidJumpThreshold()) { - this.setDeltaMovement(this.getDeltaMovement().multiply(0.5, 0.8F, 0.5)); - Vec3 vec33 = this.getFluidFallingAdjustedMovement(d, bl, this.getDeltaMovement()); - this.setDeltaMovement(vec33); - } else { - this.setDeltaMovement(this.getDeltaMovement().scale(0.5)); - } - - if (d != 0.0) { - this.setDeltaMovement(this.getDeltaMovement().add(0.0, -d / 4.0, 0.0)); - } - - Vec3 vec33 = this.getDeltaMovement(); - if (this.horizontalCollision && this.isFree(vec33.x, vec33.y + 0.6F - this.getY() + ex, vec33.z)) { - this.setDeltaMovement(vec33.x, 0.3F, vec33.z); - } - } else if (this.isFallFlying()) { - this.checkSlowFallDistance(); - Vec3 vec34 = this.getDeltaMovement(); - Vec3 vec35 = this.getLookAngle(); - float fx = this.getXRot() * (float) (Math.PI / 180.0); - double i = Math.sqrt(vec35.x * vec35.x + vec35.z * vec35.z); - double j = vec34.horizontalDistance(); - double k = vec35.length(); - double l = Math.cos(fx); - l = l * l * Math.min(1.0, k / 0.4); - vec34 = this.getDeltaMovement().add(0.0, d * (-1.0 + l * 0.75), 0.0); - if (vec34.y < 0.0 && i > 0.0) { - double m = vec34.y * -0.1 * l; - vec34 = vec34.add(vec35.x * m / i, m, vec35.z * m / i); - } - - if (fx < 0.0F && i > 0.0) { - double m = j * -Mth.sin(fx) * 0.04; - vec34 = vec34.add(-vec35.x * m / i, m * 3.2, -vec35.z * m / i); - } - - if (i > 0.0) { - vec34 = vec34.add((vec35.x / i * j - vec34.x) * 0.1, 0.0, (vec35.z / i * j - vec34.z) * 0.1); - } - - this.setDeltaMovement(vec34.multiply(0.99F, 0.98F, 0.99F)); - this.move(MoverType.SELF, this.getDeltaMovement()); - if (this.horizontalCollision && !this.level().isClientSide) { - double m = this.getDeltaMovement().horizontalDistance(); - double n = j - m; - float o = (float)(n * 10.0 - 3.0); - if (o > 0.0F) { - this.playSound(this.getFallDamageSound((int)o), 1.0F, 1.0F); - this.hurt(this.damageSources().flyIntoWall(), o); - } - } - - if (this.onGround() && !this.level().isClientSide) { - this.setSharedFlag(7, false); - } + vec32 = vec32.multiply(f, 0.8F, f); + this.setDeltaMovement(this.getFluidFallingAdjustedMovement(e, bl, vec32)); + } else { + this.moveRelative(0.02F, vec3); + this.move(MoverType.SELF, this.getDeltaMovement()); + if (this.getFluidHeight(FluidTags.LAVA) <= this.getFluidJumpThreshold()) { + this.setDeltaMovement(this.getDeltaMovement().multiply(0.5, 0.8F, 0.5)); + Vec3 vec33 = this.getFluidFallingAdjustedMovement(e, bl, this.getDeltaMovement()); + this.setDeltaMovement(vec33); } else { - BlockPos blockPos = this.getBlockPosBelowThatAffectsMyMovement(); - float p = this.level().getBlockState(blockPos).getBlock().getFriction(); - float fxx = this.onGround() ? p * 0.91F : 0.91F; - Vec3 vec36 = this.handleRelativeFrictionAndCalculateMovement(travelVector, p); - double q = vec36.y; - if (this.hasEffect(MobEffects.LEVITATION)) { - q += (0.05 * (this.getEffect(MobEffects.LEVITATION).getAmplifier() + 1) - vec36.y) * 0.2; - } else if (!this.level().isClientSide || this.level().hasChunkAt(blockPos)) { - q -= d; - } else if (this.getY() > this.level().getMinBuildHeight()) { - q = -0.1; - } else { - q = 0.0; - } + this.setDeltaMovement(this.getDeltaMovement().scale(0.5)); + } - if (this.shouldDiscardFriction()) { - this.setDeltaMovement(vec36.x, q, vec36.z); - } else { - this.setDeltaMovement(vec36.x * fxx, this instanceof FlyingAnimal ? q * fxx : q * 0.98F, vec36.z * fxx); - } + if (e != 0.0) { + this.setDeltaMovement(this.getDeltaMovement().add(0.0, -e / 4.0, 0.0)); } } - this.calculateEntityAnimation(this instanceof FlyingAnimal); + Vec3 vec33 = this.getDeltaMovement(); + if (this.horizontalCollision && this.isFree(vec33.x, vec33.y + 0.6F - this.getY() + d, vec33.z)) { + this.setDeltaMovement(vec33.x, 0.3F, vec33.z); + } + } + + private void travelFallFlying() { + Vec3 vec3 = this.getDeltaMovement(); + double d = vec3.horizontalDistance(); + this.setDeltaMovement(this.updateFallFlyingMovement(vec3)); + this.move(MoverType.SELF, this.getDeltaMovement()); + if (!this.level().isClientSide) { + double e = this.getDeltaMovement().horizontalDistance(); + this.handleFallFlyingCollisions(d, e); + } + } + + private Vec3 updateFallFlyingMovement(Vec3 vec3) { + Vec3 vec32 = this.getLookAngle(); + float f = this.getXRot() * (float) (Math.PI / 180.0); + double d = Math.sqrt(vec32.x * vec32.x + vec32.z * vec32.z); + double e = vec3.horizontalDistance(); + double g = this.getEffectiveGravity(); + double h = Mth.square(Math.cos(f)); + vec3 = vec3.add(0.0, g * (-1.0 + h * 0.75), 0.0); + if (vec3.y < 0.0 && d > 0.0) { + double i = vec3.y * -0.1 * h; + vec3 = vec3.add(vec32.x * i / d, i, vec32.z * i / d); + } + + if (f < 0.0F && d > 0.0) { + double i = e * -Mth.sin(f) * 0.04; + vec3 = vec3.add(-vec32.x * i / d, i * 3.2, -vec32.z * i / d); + } + + if (d > 0.0) { + vec3 = vec3.add((vec32.x / d * e - vec3.x) * 0.1, 0.0, (vec32.z / d * e - vec3.z) * 0.1); + } + + return vec3.multiply(0.99F, 0.98F, 0.99F); + } + + private void handleFallFlyingCollisions(double d, double e) { + if (this.horizontalCollision) { + double f = d - e; + float g = (float)(f * 10.0 - 3.0); + if (g > 0.0F) { + this.playSound(this.getFallDamageSound((int)g), 1.0F, 1.0F); + this.hurt(this.damageSources().flyIntoWall(), g); + } + } } private void travelRidden(Player player, Vec3 travelVector) { @@ -2303,9 +2401,7 @@ public abstract class LivingEntity extends Entity implements Attackable { this.setSpeed(this.getRiddenSpeed(player)); this.travel(vec3); } else { - this.calculateEntityAnimation(false); this.setDeltaMovement(Vec3.ZERO); - this.tryCheckInsideBlocks(); } } @@ -2322,15 +2418,19 @@ public abstract class LivingEntity extends Entity implements Attackable { public void calculateEntityAnimation(boolean includeHeight) { float f = (float)Mth.length(this.getX() - this.xo, includeHeight ? this.getY() - this.yo : 0.0, this.getZ() - this.zo); - this.updateWalkAnimation(f); + if (!this.isPassenger() && this.isAlive()) { + this.updateWalkAnimation(f); + } else { + this.walkAnimation.stop(); + } } protected void updateWalkAnimation(float partialTick) { float f = Math.min(partialTick * 4.0F, 1.0F); - this.walkAnimation.update(f, 0.4F); + this.walkAnimation.update(f, 0.4F, this.isBaby() ? 3.0F : 1.0F); } - public Vec3 handleRelativeFrictionAndCalculateMovement(Vec3 deltaMovement, float friction) { + private Vec3 handleRelativeFrictionAndCalculateMovement(Vec3 deltaMovement, float friction) { this.moveRelative(this.getFrictionInfluencedSpeed(friction), deltaMovement); this.setDeltaMovement(this.handleOnClimbable(this.getDeltaMovement())); this.move(MoverType.SELF, this.getDeltaMovement()); @@ -2397,8 +2497,8 @@ public abstract class LivingEntity extends Entity implements Attackable { this.speed = speed; } - public boolean doHurtTarget(Entity target) { - this.setLastHurtMob(target); + public boolean doHurtTarget(ServerLevel serverLevel, Entity entity) { + this.setLastHurtMob(entity); return false; } @@ -2474,10 +2574,11 @@ public abstract class LivingEntity extends Entity implements Attackable { } this.run = this.run + (k - this.run) * 0.3F; - this.level().getProfiler().push("headTurn"); + ProfilerFiller profilerFiller = Profiler.get(); + profilerFiller.push("headTurn"); h = this.tickHeadTurn(g, h); - this.level().getProfiler().pop(); - this.level().getProfiler().push("rangeChecks"); + profilerFiller.pop(); + profilerFiller.push("rangeChecks"); while (this.getYRot() - this.yRotO < -180.0F) { this.yRotO -= 360.0F; @@ -2511,7 +2612,7 @@ public abstract class LivingEntity extends Entity implements Attackable { this.yHeadRotO += 360.0F; } - this.level().getProfiler().pop(); + profilerFiller.pop(); this.animStep += h; if (this.isFallFlying()) { this.fallFlyTicks++; @@ -2524,11 +2625,13 @@ public abstract class LivingEntity extends Entity implements Attackable { } this.refreshDirtyAttributes(); - float l = this.getScale(); - if (l != this.appliedScale) { - this.appliedScale = l; + float m = this.getScale(); + if (m != this.appliedScale) { + this.appliedScale = m; this.refreshDimensions(); } + + this.elytraAnimationState.tick(); } private void detectEquipmentUpdates() { @@ -2545,7 +2648,7 @@ public abstract class LivingEntity extends Entity implements Attackable { private Map collectEquipmentChanges() { Map map = null; - for (EquipmentSlot equipmentSlot : EquipmentSlot.values()) { + for (EquipmentSlot equipmentSlot : EquipmentSlot.VALUES) { ItemStack itemStack = switch (equipmentSlot.getType()) { case HAND -> this.getLastHandItem(equipmentSlot); case HUMANOID_ARMOR -> this.getLastArmorItem(equipmentSlot); @@ -2560,14 +2663,7 @@ public abstract class LivingEntity extends Entity implements Attackable { map.put(equipmentSlot, itemStack2); AttributeMap attributeMap = this.getAttributes(); if (!itemStack.isEmpty()) { - itemStack.forEachModifier(equipmentSlot, (holder, attributeModifier) -> { - AttributeInstance attributeInstance = attributeMap.getInstance(holder); - if (attributeInstance != null) { - attributeInstance.removeModifier(attributeModifier); - } - - EnchantmentHelper.stopLocationBasedEffects(itemStack, this, equipmentSlot); - }); + this.stopLocationBasedEffects(itemStack, equipmentSlot, attributeMap); } } } @@ -2575,19 +2671,18 @@ public abstract class LivingEntity extends Entity implements Attackable { if (map != null) { for (Entry entry : map.entrySet()) { EquipmentSlot equipmentSlot2 = (EquipmentSlot)entry.getKey(); - ItemStack itemStack3 = (ItemStack)entry.getValue(); - if (!itemStack3.isEmpty()) { - itemStack3.forEachModifier(equipmentSlot2, (holder, attributeModifier) -> { + ItemStack itemStack2 = (ItemStack)entry.getValue(); + if (!itemStack2.isEmpty() && !itemStack2.isBroken()) { + itemStack2.forEachModifier(equipmentSlot2, (holder, attributeModifier) -> { AttributeInstance attributeInstance = this.attributes.getInstance(holder); if (attributeInstance != null) { attributeInstance.removeModifier(attributeModifier.id()); attributeInstance.addTransientModifier(attributeModifier); } - - if (this.level() instanceof ServerLevel serverLevel) { - EnchantmentHelper.runLocationChangedEffects(serverLevel, itemStack3, this, equipmentSlot2); - } }); + if (this.level() instanceof ServerLevel serverLevel) { + EnchantmentHelper.runLocationChangedEffects(serverLevel, itemStack2, this, equipmentSlot2); + } } } } @@ -2678,11 +2773,6 @@ public abstract class LivingEntity extends Entity implements Attackable { this.noJumpDelay--; } - if (this.isControlledByLocalInstance()) { - this.lerpSteps = 0; - this.syncPacketPositionCodec(this.getX(), this.getY(), this.getZ()); - } - if (this.lerpSteps > 0) { this.lerpPositionAndRotationStep(this.lerpSteps, this.lerpX, this.lerpY, this.lerpZ, this.lerpYRot, this.lerpXRot); this.lerpSteps--; @@ -2712,19 +2802,20 @@ public abstract class LivingEntity extends Entity implements Attackable { } this.setDeltaMovement(d, e, f); - this.level().getProfiler().push("ai"); + ProfilerFiller profilerFiller = Profiler.get(); + profilerFiller.push("ai"); if (this.isImmobile()) { this.jumping = false; this.xxa = 0.0F; this.zza = 0.0F; } else if (this.isEffectiveAi()) { - this.level().getProfiler().push("newAi"); + profilerFiller.push("newAi"); this.serverAiStep(); - this.level().getProfiler().pop(); + profilerFiller.pop(); } - this.level().getProfiler().pop(); - this.level().getProfiler().push("jump"); + profilerFiller.pop(); + profilerFiller.push("jump"); if (this.jumping && this.isAffectedByFluids()) { double g; if (this.isInLava()) { @@ -2751,11 +2842,14 @@ public abstract class LivingEntity extends Entity implements Attackable { this.noJumpDelay = 0; } - this.level().getProfiler().pop(); - this.level().getProfiler().push("travel"); + profilerFiller.pop(); + profilerFiller.push("travel"); this.xxa *= 0.98F; this.zza *= 0.98F; - this.updateFallFlying(); + if (this.isFallFlying()) { + this.updateFallFlying(); + } + AABB aABB = this.getBoundingBox(); Vec3 vec32 = new Vec3(this.xxa, this.yya, this.zza); if (this.hasEffect(MobEffects.SLOW_FALLING) || this.hasEffect(MobEffects.LEVITATION)) { @@ -2768,8 +2862,13 @@ public abstract class LivingEntity extends Entity implements Attackable { this.travel(vec32); } - this.level().getProfiler().pop(); - this.level().getProfiler().push("freezing"); + if (!this.level().isClientSide() || this.isControlledByLocalInstance()) { + this.applyEffectsFromBlocks(); + } + + this.calculateEntityAnimation(this instanceof FlyingAnimal); + profilerFiller.pop(); + profilerFiller.push("freezing"); if (!this.level().isClientSide && !this.isDeadOrDying()) { int i = this.getTicksFrozen(); if (this.isInPowderSnow && this.canFreeze()) { @@ -2781,21 +2880,21 @@ public abstract class LivingEntity extends Entity implements Attackable { this.removeFrost(); this.tryAddFrost(); - if (!this.level().isClientSide && this.tickCount % 40 == 0 && this.isFullyFrozen() && this.canFreeze()) { - this.hurt(this.damageSources().freeze(), 1.0F); + if (this.level() instanceof ServerLevel serverLevel && this.tickCount % 40 == 0 && this.isFullyFrozen() && this.canFreeze()) { + this.hurtServer(serverLevel, this.damageSources().freeze(), 1.0F); } - this.level().getProfiler().pop(); - this.level().getProfiler().push("push"); + profilerFiller.pop(); + profilerFiller.push("push"); if (this.autoSpinAttackTicks > 0) { this.autoSpinAttackTicks--; this.checkAutoSpinAttack(aABB, this.getBoundingBox()); } this.pushEntities(); - this.level().getProfiler().pop(); - if (!this.level().isClientSide && this.isSensitiveToWater() && this.isInWaterRainOrBubble()) { - this.hurt(this.damageSources().drown(), 1.0F); + profilerFiller.pop(); + if (this.level() instanceof ServerLevel serverLevel && this.isSensitiveToWater() && this.isInWaterRainOrBubble()) { + this.hurtServer(serverLevel, this.damageSources().drown(), 1.0F); } } @@ -2806,30 +2905,42 @@ public abstract class LivingEntity extends Entity implements Attackable { /** * Called each tick. Updates state for the elytra. */ - private void updateFallFlying() { - boolean bl = this.getSharedFlag(7); - if (bl && !this.onGround() && !this.isPassenger() && !this.hasEffect(MobEffects.LEVITATION)) { - ItemStack itemStack = this.getItemBySlot(EquipmentSlot.CHEST); - if (itemStack.is(Items.ELYTRA) && ElytraItem.isFlyEnabled(itemStack)) { - bl = true; - int i = this.fallFlyTicks + 1; - if (!this.level().isClientSide && i % 10 == 0) { - int j = i / 10; - if (j % 2 == 0) { - itemStack.hurtAndBreak(1, this, EquipmentSlot.CHEST); - } - - this.gameEvent(GameEvent.ELYTRA_GLIDE); - } - } else { - bl = false; - } - } else { - bl = false; - } - + protected void updateFallFlying() { + this.checkSlowFallDistance(); if (!this.level().isClientSide) { - this.setSharedFlag(7, bl); + if (!this.canGlide()) { + this.setSharedFlag(7, false); + return; + } + + int i = this.fallFlyTicks + 1; + if (i % 10 == 0) { + int j = i / 10; + if (j % 2 == 0) { + List list = EquipmentSlot.VALUES + .stream() + .filter(equipmentSlotx -> canGlideUsing(this.getItemBySlot(equipmentSlotx), equipmentSlotx)) + .toList(); + EquipmentSlot equipmentSlot = Util.getRandom(list, this.random); + this.getItemBySlot(equipmentSlot).hurtAndBreak(1, this, equipmentSlot); + } + + this.gameEvent(GameEvent.ELYTRA_GLIDE); + } + } + } + + protected boolean canGlide() { + if (!this.onGround() && !this.isPassenger() && !this.hasEffect(MobEffects.LEVITATION)) { + for (EquipmentSlot equipmentSlot : EquipmentSlot.VALUES) { + if (canGlideUsing(this.getItemBySlot(equipmentSlot), equipmentSlot)) { + return true; + } + } + + return false; + } else { + return false; } } @@ -2837,12 +2948,12 @@ public abstract class LivingEntity extends Entity implements Attackable { } protected void pushEntities() { - if (this.level().isClientSide()) { + if (!(this.level() instanceof ServerLevel serverLevel)) { this.level().getEntities(EntityTypeTest.forClass(Player.class), this.getBoundingBox(), EntitySelector.pushableBy(this)).forEach(this::doPush); } else { List list = this.level().getEntities(this, this.getBoundingBox(), EntitySelector.pushableBy(this)); if (!list.isEmpty()) { - int i = this.level().getGameRules().getInt(GameRules.RULE_MAX_ENTITY_CRAMMING); + int i = serverLevel.getGameRules().getInt(GameRules.RULE_MAX_ENTITY_CRAMMING); if (i > 0 && list.size() > i - 1 && this.random.nextInt(4) == 0) { int j = 0; @@ -2853,7 +2964,7 @@ public abstract class LivingEntity extends Entity implements Attackable { } if (j > i - 1) { - this.hurt(this.damageSources().cramming(), 6.0F); + this.hurtServer(serverLevel, this.damageSources().cramming(), 6.0F); } } @@ -2915,6 +3026,11 @@ public abstract class LivingEntity extends Entity implements Attackable { this.resetFallDistance(); } + @Override + public void cancelLerp() { + this.lerpSteps = 0; + } + @Override public void lerpTo(double x, double y, double z, float yRot, float xRot, int steps) { this.lerpX = x; @@ -2979,20 +3095,22 @@ public abstract class LivingEntity extends Entity implements Attackable { } public boolean hasLineOfSight(Entity entity) { + return this.hasLineOfSight(entity, Block.COLLIDER, net.minecraft.world.level.ClipContext.Fluid.NONE, entity::getEyeY); + } + + public boolean hasLineOfSight(Entity entity, Block block, net.minecraft.world.level.ClipContext.Fluid fluid, DoubleSupplier doubleSupplier) { if (entity.level() != this.level()) { return false; } else { Vec3 vec3 = new Vec3(this.getX(), this.getEyeY(), this.getZ()); - Vec3 vec32 = new Vec3(entity.getX(), entity.getEyeY(), entity.getZ()); - return vec32.distanceTo(vec3) > 128.0 - ? false - : this.level().clip(new ClipContext(vec3, vec32, ClipContext.Block.COLLIDER, ClipContext.Fluid.NONE, this)).getType() == HitResult.Type.MISS; + Vec3 vec32 = new Vec3(entity.getX(), doubleSupplier.getAsDouble(), entity.getZ()); + return vec32.distanceTo(vec3) > 128.0 ? false : this.level().clip(new ClipContext(vec3, vec32, block, fluid, this)).getType() == Type.MISS; } } @Override public float getViewYRot(float partialTick) { - return partialTick == 1.0F ? this.yHeadRot : Mth.lerp(partialTick, this.yHeadRotO, this.yHeadRot); + return partialTick == 1.0F ? this.yHeadRot : Mth.rotLerp(partialTick, this.yHeadRotO, this.yHeadRot); } /** @@ -3033,7 +3151,7 @@ public abstract class LivingEntity extends Entity implements Attackable { } @Override - public Vec3 getRelativePortalPosition(Direction.Axis axis, BlockUtil.FoundRectangle portal) { + public Vec3 getRelativePortalPosition(Direction.Axis axis, FoundRectangle portal) { return resetForwardDirectionOfRelativePortalPosition(super.getRelativePortalPosition(axis, portal)); } @@ -3095,22 +3213,11 @@ public abstract class LivingEntity extends Entity implements Attackable { protected void updateUsingItem(ItemStack usingItem) { usingItem.onUseTick(this.level(), this, this.getUseItemRemainingTicks()); - if (this.shouldTriggerItemUseEffects()) { - this.triggerItemUseEffects(usingItem, 5); - } - if (--this.useItemRemaining == 0 && !this.level().isClientSide && !usingItem.useOnRelease()) { this.completeUsingItem(); } } - private boolean shouldTriggerItemUseEffects() { - int i = this.useItem.getUseDuration(this) - this.getUseItemRemainingTicks(); - int j = (int)(this.useItem.getUseDuration(this) * 0.21875F); - boolean bl = i > j; - return bl && this.getUseItemRemainingTicks() % 4 == 0; - } - private void updateSwimAmount() { this.swimAmountO = this.swimAmount; if (this.isVisuallySwimming()) { @@ -3165,7 +3272,7 @@ public abstract class LivingEntity extends Entity implements Attackable { } @Override - public void lookAt(EntityAnchorArgument.Anchor anchor, Vec3 target) { + public void lookAt(Anchor anchor, Vec3 target) { super.lookAt(anchor, target); this.yHeadRotO = this.yHeadRot; this.yBodyRot = this.yHeadRot; @@ -3177,20 +3284,7 @@ public abstract class LivingEntity extends Entity implements Attackable { return Mth.lerp(partialTick, this.yBodyRotO, this.yBodyRot); } - protected void triggerItemUseEffects(ItemStack stack, int amount) { - if (!stack.isEmpty() && this.isUsingItem()) { - if (stack.getUseAnimation() == UseAnim.DRINK) { - this.playSound(this.getDrinkingSound(stack), 0.5F, this.level().random.nextFloat() * 0.1F + 0.9F); - } - - if (stack.getUseAnimation() == UseAnim.EAT) { - this.spawnItemParticles(stack, amount); - this.playSound(this.getEatingSound(stack), 0.5F + 0.5F * this.random.nextInt(2), (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F); - } - } - } - - private void spawnItemParticles(ItemStack stack, int amount) { + public void spawnItemParticles(ItemStack stack, int amount) { for (int i = 0; i < amount; i++) { Vec3 vec3 = new Vec3((this.random.nextFloat() - 0.5) * 0.1, Math.random() * 0.1 + 0.1, 0.0); vec3 = vec3.xRot(-this.getXRot() * (float) (Math.PI / 180.0)); @@ -3214,7 +3308,6 @@ public abstract class LivingEntity extends Entity implements Attackable { this.releaseUsingItem(); } else { if (!this.useItem.isEmpty() && this.isUsingItem()) { - this.triggerItemUseEffects(this.useItem, 16); ItemStack itemStack = this.useItem.finishUsingItem(this.level(), this); if (itemStack != this.useItem) { this.setItemInHand(interactionHand, itemStack); @@ -3226,6 +3319,9 @@ public abstract class LivingEntity extends Entity implements Attackable { } } + public void handleExtraItemsCreatedOnUse(ItemStack itemStack) { + } + public ItemStack getUseItem() { return this.useItem; } @@ -3263,11 +3359,20 @@ public abstract class LivingEntity extends Entity implements Attackable { } public boolean isBlocking() { + return this.getItemBlockingWith() != null; + } + + @Nullable + public ItemStack getItemBlockingWith() { if (this.isUsingItem() && !this.useItem.isEmpty()) { Item item = this.useItem.getItem(); - return item.getUseAnimation(this.useItem) != UseAnim.BLOCK ? false : item.getUseDuration(this.useItem, this) - this.useItemRemaining >= 5; + if (item.getUseAnimation(this.useItem) != ItemUseAnimation.BLOCK) { + return null; + } else { + return item.getUseDuration(this.useItem, this) - this.useItemRemaining < 5 ? null : this.useItem; + } } else { - return false; + return null; } } @@ -3299,7 +3404,7 @@ public abstract class LivingEntity extends Entity implements Attackable { if (level.hasChunkAt(blockPos)) { boolean bl2 = false; - while (!bl2 && blockPos.getY() > level.getMinBuildHeight()) { + while (!bl2 && blockPos.getY() > level.getMinY()) { BlockPos blockPos2 = blockPos.below(); BlockState blockState = level.getBlockState(blockPos2); if (blockState.blocksMotion()) { @@ -3351,7 +3456,7 @@ public abstract class LivingEntity extends Entity implements Attackable { public void setRecordPlayingNearby(BlockPos jukebox, boolean partyParrot) { } - public boolean canTakeItem(ItemStack stack) { + public boolean canPickUpLoot() { return false; } @@ -3481,38 +3586,6 @@ public abstract class LivingEntity extends Entity implements Attackable { return ItemStack.EMPTY; } - public final ItemStack eat(Level level, ItemStack food) { - FoodProperties foodProperties = food.get(DataComponents.FOOD); - return foodProperties != null ? this.eat(level, food, foodProperties) : food; - } - - public ItemStack eat(Level level, ItemStack food, FoodProperties foodProperties) { - level.playSound( - null, - this.getX(), - this.getY(), - this.getZ(), - this.getEatingSound(food), - SoundSource.NEUTRAL, - 1.0F, - 1.0F + (level.random.nextFloat() - level.random.nextFloat()) * 0.4F - ); - this.addEatEffect(foodProperties); - food.consume(1, this); - this.gameEvent(GameEvent.EAT); - return food; - } - - private void addEatEffect(FoodProperties foodProperties) { - if (!this.level().isClientSide()) { - for (FoodProperties.PossibleEffect possibleEffect : foodProperties.effects()) { - if (this.random.nextFloat() < possibleEffect.probability()) { - this.addEffect(possibleEffect.effect()); - } - } - } - } - private static byte entityEventForEquipmentBreak(EquipmentSlot slot) { return switch (slot) { case MAINHAND -> 47; @@ -3527,32 +3600,53 @@ public abstract class LivingEntity extends Entity implements Attackable { public void onEquippedItemBroken(Item item, EquipmentSlot slot) { this.level().broadcastEntityEvent(this, entityEventForEquipmentBreak(slot)); + this.stopLocationBasedEffects(this.getItemBySlot(slot), slot, this.attributes); + } + + private void stopLocationBasedEffects(ItemStack itemStack, EquipmentSlot equipmentSlot, AttributeMap attributeMap) { + itemStack.forEachModifier(equipmentSlot, (holder, attributeModifier) -> { + AttributeInstance attributeInstance = attributeMap.getInstance(holder); + if (attributeInstance != null) { + attributeInstance.removeModifier(attributeModifier); + } + }); + EnchantmentHelper.stopLocationBasedEffects(itemStack, this, equipmentSlot); } public static EquipmentSlot getSlotForHand(InteractionHand hand) { return hand == InteractionHand.MAIN_HAND ? EquipmentSlot.MAINHAND : EquipmentSlot.OFFHAND; } - @Override - public AABB getBoundingBoxForCulling() { - if (this.getItemBySlot(EquipmentSlot.HEAD).is(Items.DRAGON_HEAD)) { - float f = 0.5F; - return this.getBoundingBox().inflate(0.5, 0.5, 0.5); + public final boolean canEquipWithDispenser(ItemStack itemStack) { + if (this.isAlive() && !this.isSpectator()) { + Equippable equippable = itemStack.get(DataComponents.EQUIPPABLE); + if (equippable != null && equippable.dispensable()) { + EquipmentSlot equipmentSlot = equippable.slot(); + return this.canUseSlot(equipmentSlot) && equippable.canBeEquippedBy(this.getType()) + ? this.getItemBySlot(equipmentSlot).isEmpty() && this.canDispenserEquipIntoSlot(equipmentSlot) + : false; + } else { + return false; + } } else { - return super.getBoundingBoxForCulling(); + return false; } } - public EquipmentSlot getEquipmentSlotForItem(ItemStack stack) { - Equipable equipable = Equipable.get(stack); - if (equipable != null) { - EquipmentSlot equipmentSlot = equipable.getEquipmentSlot(); - if (this.canUseSlot(equipmentSlot)) { - return equipmentSlot; - } - } + protected boolean canDispenserEquipIntoSlot(EquipmentSlot equipmentSlot) { + return true; + } - return EquipmentSlot.MAINHAND; + public final EquipmentSlot getEquipmentSlotForItem(ItemStack stack) { + Equippable equippable = stack.get(DataComponents.EQUIPPABLE); + return equippable != null && this.canUseSlot(equippable.slot()) ? equippable.slot() : EquipmentSlot.MAINHAND; + } + + public final boolean isEquippableInSlot(ItemStack itemStack, EquipmentSlot equipmentSlot) { + Equippable equippable = itemStack.get(DataComponents.EQUIPPABLE); + return equippable == null + ? equipmentSlot == EquipmentSlot.MAINHAND && this.canUseSlot(EquipmentSlot.MAINHAND) + : equipmentSlot == equippable.slot() && this.canUseSlot(equippable.slot()) && equippable.canBeEquippedBy(this.getType()); } private static SlotAccess createEquipmentSlotAccess(LivingEntity entity, EquipmentSlot slot) { @@ -3656,9 +3750,22 @@ public abstract class LivingEntity extends Entity implements Attackable { return false; } - @Override - public boolean isInvulnerableTo(DamageSource source) { - return super.isInvulnerableTo(source) || this.level() instanceof ServerLevel serverLevel && EnchantmentHelper.isImmuneToDamage(serverLevel, this, source); + public boolean isInvulnerableTo(ServerLevel serverLevel, DamageSource damageSource) { + return this.isInvulnerableToBase(damageSource) || EnchantmentHelper.isImmuneToDamage(serverLevel, this, damageSource); + } + + public static boolean canGlideUsing(ItemStack itemStack, EquipmentSlot equipmentSlot) { + if (!itemStack.has(DataComponents.GLIDER)) { + return false; + } else { + Equippable equippable = itemStack.get(DataComponents.EQUIPPABLE); + return equippable != null && equipmentSlot == equippable.slot() && !itemStack.nextDamageWillBreak(); + } + } + + @VisibleForTesting + public int getLastHurtByPlayerTime() { + return this.lastHurtByPlayerTime; } public record Fallsounds(SoundEvent small, SoundEvent big) { diff --git a/net/minecraft/world/entity/Marker.java b/net/minecraft/world/entity/Marker.java index d2c20de8..100c7f86 100644 --- a/net/minecraft/world/entity/Marker.java +++ b/net/minecraft/world/entity/Marker.java @@ -3,8 +3,10 @@ package net.minecraft.world.entity; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.protocol.Packet; import net.minecraft.network.protocol.game.ClientGamePacketListener; -import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.network.syncher.SynchedEntityData.Builder; import net.minecraft.server.level.ServerEntity; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.level.Level; import net.minecraft.world.level.material.PushReaction; @@ -22,7 +24,7 @@ public class Marker extends Entity { } @Override - protected void defineSynchedData(SynchedEntityData.Builder builder) { + protected void defineSynchedData(Builder builder) { } @Override @@ -64,4 +66,9 @@ public class Marker extends Entity { public boolean isIgnoringBlockTriggers() { return true; } + + @Override + public final boolean hurtServer(ServerLevel serverLevel, DamageSource damageSource, float f) { + return false; + } } diff --git a/net/minecraft/world/entity/Mob.java b/net/minecraft/world/entity/Mob.java index 9849079b..daa99937 100644 --- a/net/minecraft/world/entity/Mob.java +++ b/net/minecraft/world/entity/Mob.java @@ -12,11 +12,11 @@ import java.util.Optional; import java.util.Set; import java.util.function.Predicate; import net.minecraft.core.BlockPos; +import net.minecraft.core.Holder; import net.minecraft.core.NonNullList; import net.minecraft.core.Vec3i; import net.minecraft.core.component.DataComponentMap; import net.minecraft.core.component.DataComponents; -import net.minecraft.core.particles.ParticleTypes; import net.minecraft.core.registries.Registries; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.FloatTag; @@ -32,16 +32,18 @@ import net.minecraft.sounds.SoundEvent; import net.minecraft.tags.TagKey; import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; +import net.minecraft.util.profiling.Profiler; import net.minecraft.util.profiling.ProfilerFiller; import net.minecraft.world.Difficulty; import net.minecraft.world.DifficultyInstance; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.damagesource.DamageSource; +import net.minecraft.world.entity.ai.attributes.Attribute; import net.minecraft.world.entity.ai.attributes.AttributeInstance; import net.minecraft.world.entity.ai.attributes.AttributeModifier; -import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.entity.ai.attributes.AttributeSupplier.Builder; import net.minecraft.world.entity.ai.control.BodyRotationControl; import net.minecraft.world.entity.ai.control.JumpControl; import net.minecraft.world.entity.ai.control.LookControl; @@ -55,7 +57,7 @@ import net.minecraft.world.entity.ai.sensing.Sensing; import net.minecraft.world.entity.item.ItemEntity; import net.minecraft.world.entity.monster.Enemy; import net.minecraft.world.entity.player.Player; -import net.minecraft.world.entity.vehicle.Boat; +import net.minecraft.world.entity.vehicle.AbstractBoat; import net.minecraft.world.item.ArmorItem; import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.BowItem; @@ -93,6 +95,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab private static final int MOB_FLAG_AGGRESSIVE = 4; protected static final int PICKUP_REACH = 1; private static final Vec3i ITEM_PICKUP_REACH = new Vec3i(1, 0, 1); + private static final List EQUIPMENT_POPULATION_ORDER = List.of(EquipmentSlot.HEAD, EquipmentSlot.CHEST, EquipmentSlot.LEGS, EquipmentSlot.FEET); public static final float MAX_WEARING_ARMOR_CHANCE = 0.15F; public static final float MAX_PICKUP_LOOT_CHANCE = 0.55F; public static final float MAX_ENCHANTED_ARMOR_CHANCE = 0.5F; @@ -124,8 +127,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab private boolean canPickUpLoot; private boolean persistenceRequired; private final Map pathfindingMalus = Maps.newEnumMap(PathType.class); - @Nullable - private ResourceKey lootTable; + private Optional> lootTable = Optional.empty(); private long lootTableSeed; @Nullable private Leashable.LeashData leashData; @@ -134,8 +136,8 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab protected Mob(EntityType entityType, Level level) { super(entityType, level); - this.goalSelector = new GoalSelector(level.getProfilerSupplier()); - this.targetSelector = new GoalSelector(level.getProfilerSupplier()); + this.goalSelector = new GoalSelector(); + this.targetSelector = new GoalSelector(); this.lookControl = new LookControl(this); this.moveControl = new MoveControl(this); this.jumpControl = new JumpControl(this); @@ -145,7 +147,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab Arrays.fill(this.armorDropChances, 0.085F); Arrays.fill(this.handDropChances, 0.085F); this.bodyArmorDropChance = 0.085F; - if (level != null && !level.isClientSide) { + if (level instanceof ServerLevel) { this.registerGoals(); } } @@ -153,7 +155,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab protected void registerGoals() { } - public static AttributeSupplier.Builder createMobAttributes() { + public static Builder createMobAttributes() { return LivingEntity.createLivingAttributes().add(Attributes.FOLLOW_RANGE, 16.0); } @@ -253,7 +255,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab } @Override - protected void defineSynchedData(SynchedEntityData.Builder builder) { + protected void defineSynchedData(net.minecraft.network.syncher.SynchedEntityData.Builder builder) { super.defineSynchedData(builder); builder.define(DATA_MOB_FLAGS_ID, (byte)0); } @@ -275,13 +277,14 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab @Override public void baseTick() { super.baseTick(); - this.level().getProfiler().push("mobBaseTick"); + ProfilerFiller profilerFiller = Profiler.get(); + profilerFiller.push("mobBaseTick"); if (this.isAlive() && this.random.nextInt(1000) < this.ambientSoundTime++) { this.resetAmbientSoundTime(); this.playAmbientSound(); } - this.level().getProfiler().pop(); + profilerFiller.pop(); } @Override @@ -295,7 +298,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab } @Override - protected int getBaseExperienceReward() { + protected int getBaseExperienceReward(ServerLevel serverLevel) { if (this.xpReward > 0) { int i = this.xpReward; @@ -326,13 +329,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab */ public void spawnAnim() { if (this.level().isClientSide) { - for (int i = 0; i < 20; i++) { - double d = this.random.nextGaussian() * 0.02; - double e = this.random.nextGaussian() * 0.02; - double f = this.random.nextGaussian() * 0.02; - double g = 10.0; - this.level().addParticle(ParticleTypes.POOF, this.getX(1.0) - d * 10.0, this.getRandomY() - e * 10.0, this.getRandomZ(1.0) - f * 10.0, d, e, f); - } + this.makePoofParticles(); } else { this.level().broadcastEntityEvent(this, (byte)20); } @@ -360,7 +357,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab */ protected void updateControlFlags() { boolean bl = !(this.getControllingPassenger() instanceof Mob); - boolean bl2 = !(this.getVehicle() instanceof Boat); + boolean bl2 = !(this.getVehicle() instanceof AbstractBoat); this.goalSelector.setControlFlag(Goal.Flag.MOVE, bl); this.goalSelector.setControlFlag(Goal.Flag.JUMP, bl && bl2); this.goalSelector.setControlFlag(Goal.Flag.LOOK, bl); @@ -425,8 +422,8 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab this.writeLeashData(compound, this.leashData); compound.putBoolean("LeftHanded", this.isLeftHanded()); - if (this.lootTable != null) { - compound.putString("DeathLootTable", this.lootTable.location().toString()); + if (this.lootTable.isPresent()) { + compound.putString("DeathLootTable", ((ResourceKey)this.lootTable.get()).location().toString()); if (this.lootTableSeed != 0L) { compound.putLong("DeathLootTableSeed", this.lootTableSeed); } @@ -440,7 +437,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab @Override public void readAdditionalSaveData(CompoundTag compound) { super.readAdditionalSaveData(compound); - if (compound.contains("CanPickUpLoot", 1)) { + if (compound.contains("CanPickUpLoot", 99)) { this.setCanPickUpLoot(compound.getBoolean("CanPickUpLoot")); } @@ -489,7 +486,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab this.leashData = this.readLeashData(compound); this.setLeftHanded(compound.getBoolean("LeftHanded")); if (compound.contains("DeathLootTable", 8)) { - this.lootTable = ResourceKey.create(Registries.LOOT_TABLE, ResourceLocation.parse(compound.getString("DeathLootTable"))); + this.lootTable = Optional.of(ResourceKey.create(Registries.LOOT_TABLE, ResourceLocation.parse(compound.getString("DeathLootTable")))); this.lootTableSeed = compound.getLong("DeathLootTableSeed"); } @@ -497,18 +494,14 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab } @Override - protected void dropFromLootTable(DamageSource damageSource, boolean hitByPlayer) { - super.dropFromLootTable(damageSource, hitByPlayer); - this.lootTable = null; + protected void dropFromLootTable(ServerLevel serverLevel, DamageSource damageSource, boolean bl) { + super.dropFromLootTable(serverLevel, damageSource, bl); + this.lootTable = Optional.empty(); } @Override - public final ResourceKey getLootTable() { - return this.lootTable == null ? this.getDefaultLootTable() : this.lootTable; - } - - protected ResourceKey getDefaultLootTable() { - return super.getLootTable(); + public final Optional> getLootTable() { + return this.lootTable.isPresent() ? this.lootTable : super.getLootTable(); } @Override @@ -544,30 +537,32 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab @Override public void aiStep() { super.aiStep(); - this.level().getProfiler().push("looting"); - if (!this.level().isClientSide && this.canPickUpLoot() && this.isAlive() && !this.dead && this.level().getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { + ProfilerFiller profilerFiller = Profiler.get(); + profilerFiller.push("looting"); + if (this.level() instanceof ServerLevel serverLevel + && this.canPickUpLoot() + && this.isAlive() + && !this.dead + && serverLevel.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { Vec3i vec3i = this.getPickupReach(); for (ItemEntity itemEntity : this.level().getEntitiesOfClass(ItemEntity.class, this.getBoundingBox().inflate(vec3i.getX(), vec3i.getY(), vec3i.getZ()))) { - if (!itemEntity.isRemoved() && !itemEntity.getItem().isEmpty() && !itemEntity.hasPickUpDelay() && this.wantsToPickUp(itemEntity.getItem())) { - this.pickUpItem(itemEntity); + if (!itemEntity.isRemoved() && !itemEntity.getItem().isEmpty() && !itemEntity.hasPickUpDelay() && this.wantsToPickUp(serverLevel, itemEntity.getItem())) { + this.pickUpItem(serverLevel, itemEntity); } } } - this.level().getProfiler().pop(); + profilerFiller.pop(); } protected Vec3i getPickupReach() { return ITEM_PICKUP_REACH; } - /** - * Tests if this entity should pick up a weapon or an armor piece. Entity drops current weapon or armor if the new one is better. - */ - protected void pickUpItem(ItemEntity itemEntity) { + protected void pickUpItem(ServerLevel serverLevel, ItemEntity itemEntity) { ItemStack itemStack = itemEntity.getItem(); - ItemStack itemStack2 = this.equipItemIfPossible(itemStack.copy()); + ItemStack itemStack2 = this.equipItemIfPossible(serverLevel, itemStack.copy()); if (!itemStack2.isEmpty()) { this.onItemPickup(itemEntity); this.take(itemEntity, itemStack2.getCount()); @@ -578,25 +573,25 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab } } - public ItemStack equipItemIfPossible(ItemStack stack) { - EquipmentSlot equipmentSlot = this.getEquipmentSlotForItem(stack); - ItemStack itemStack = this.getItemBySlot(equipmentSlot); - boolean bl = this.canReplaceCurrentItem(stack, itemStack); + public ItemStack equipItemIfPossible(ServerLevel serverLevel, ItemStack itemStack) { + EquipmentSlot equipmentSlot = this.getEquipmentSlotForItem(itemStack); + ItemStack itemStack2 = this.getItemBySlot(equipmentSlot); + boolean bl = this.canReplaceCurrentItem(itemStack, itemStack2, equipmentSlot); if (equipmentSlot.isArmor() && !bl) { equipmentSlot = EquipmentSlot.MAINHAND; - itemStack = this.getItemBySlot(equipmentSlot); - bl = itemStack.isEmpty(); + itemStack2 = this.getItemBySlot(equipmentSlot); + bl = itemStack2.isEmpty(); } - if (bl && this.canHoldItem(stack)) { + if (bl && this.canHoldItem(itemStack)) { double d = this.getEquipmentDropChance(equipmentSlot); - if (!itemStack.isEmpty() && Math.max(this.random.nextFloat() - 0.1F, 0.0F) < d) { - this.spawnAtLocation(itemStack); + if (!itemStack2.isEmpty() && Math.max(this.random.nextFloat() - 0.1F, 0.0F) < d) { + this.spawnAtLocation(serverLevel, itemStack2); } - ItemStack itemStack2 = equipmentSlot.limit(stack); - this.setItemSlotAndDropWhenKilled(equipmentSlot, itemStack2); - return itemStack2; + ItemStack itemStack3 = equipmentSlot.limit(itemStack); + this.setItemSlotAndDropWhenKilled(equipmentSlot, itemStack3); + return itemStack3; } else { return ItemStack.EMPTY; } @@ -621,50 +616,51 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab } } - protected boolean canReplaceCurrentItem(ItemStack candidate, ItemStack existing) { - if (existing.isEmpty()) { + protected boolean canReplaceCurrentItem(ItemStack itemStack, ItemStack itemStack2, EquipmentSlot equipmentSlot) { + if (itemStack2.isEmpty()) { return true; - } else if (candidate.getItem() instanceof SwordItem) { - if (!(existing.getItem() instanceof SwordItem)) { + } else if (itemStack.getItem() instanceof SwordItem) { + if (!(itemStack2.getItem() instanceof SwordItem)) { return true; } else { - double d = this.getApproximateAttackDamageWithItem(candidate); - double e = this.getApproximateAttackDamageWithItem(existing); - return d != e ? d > e : this.canReplaceEqualItem(candidate, existing); + double d = this.getApproximateAttributeWith(itemStack, Attributes.ATTACK_DAMAGE, equipmentSlot); + double e = this.getApproximateAttributeWith(itemStack2, Attributes.ATTACK_DAMAGE, equipmentSlot); + return d != e ? d > e : this.canReplaceEqualItem(itemStack, itemStack2); } - } else if (candidate.getItem() instanceof BowItem && existing.getItem() instanceof BowItem) { - return this.canReplaceEqualItem(candidate, existing); - } else if (candidate.getItem() instanceof CrossbowItem && existing.getItem() instanceof CrossbowItem) { - return this.canReplaceEqualItem(candidate, existing); - } else if (candidate.getItem() instanceof ArmorItem armorItem) { - if (EnchantmentHelper.has(existing, EnchantmentEffectComponents.PREVENT_ARMOR_CHANGE)) { + } else if (itemStack.getItem() instanceof BowItem && itemStack2.getItem() instanceof BowItem) { + return this.canReplaceEqualItem(itemStack, itemStack2); + } else if (itemStack.getItem() instanceof CrossbowItem && itemStack2.getItem() instanceof CrossbowItem) { + return this.canReplaceEqualItem(itemStack, itemStack2); + } else if (itemStack.getItem() instanceof ArmorItem) { + if (EnchantmentHelper.has(itemStack2, EnchantmentEffectComponents.PREVENT_ARMOR_CHANGE)) { return false; - } else if (!(existing.getItem() instanceof ArmorItem)) { + } else if (!(itemStack2.getItem() instanceof ArmorItem)) { return true; } else { - ArmorItem armorItem2 = (ArmorItem)existing.getItem(); - if (armorItem.getDefense() != armorItem2.getDefense()) { - return armorItem.getDefense() > armorItem2.getDefense(); + double d = this.getApproximateAttributeWith(itemStack, Attributes.ARMOR, equipmentSlot); + double e = this.getApproximateAttributeWith(itemStack2, Attributes.ARMOR, equipmentSlot); + double f = this.getApproximateAttributeWith(itemStack, Attributes.ARMOR_TOUGHNESS, equipmentSlot); + double g = this.getApproximateAttributeWith(itemStack2, Attributes.ARMOR_TOUGHNESS, equipmentSlot); + if (d != e) { + return d > e; } else { - return armorItem.getToughness() != armorItem2.getToughness() - ? armorItem.getToughness() > armorItem2.getToughness() - : this.canReplaceEqualItem(candidate, existing); + return f != g ? f > g : this.canReplaceEqualItem(itemStack, itemStack2); } } } else { - if (candidate.getItem() instanceof DiggerItem) { - if (existing.getItem() instanceof BlockItem) { + if (itemStack.getItem() instanceof DiggerItem) { + if (itemStack2.getItem() instanceof BlockItem) { return true; } - if (existing.getItem() instanceof DiggerItem) { - double d = this.getApproximateAttackDamageWithItem(candidate); - double e = this.getApproximateAttackDamageWithItem(existing); + if (itemStack2.getItem() instanceof DiggerItem) { + double d = this.getApproximateAttributeWith(itemStack, Attributes.ATTACK_DAMAGE, equipmentSlot); + double e = this.getApproximateAttributeWith(itemStack2, Attributes.ATTACK_DAMAGE, equipmentSlot); if (d != e) { return d > e; } - return this.canReplaceEqualItem(candidate, existing); + return this.canReplaceEqualItem(itemStack, itemStack2); } } @@ -672,9 +668,10 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab } } - private double getApproximateAttackDamageWithItem(ItemStack itemStack) { + private double getApproximateAttributeWith(ItemStack itemStack, Holder holder, EquipmentSlot equipmentSlot) { + double d = this.getAttributes().hasAttribute(holder) ? this.getAttributeBaseValue(holder) : 0.0; ItemAttributeModifiers itemAttributeModifiers = itemStack.getOrDefault(DataComponents.ATTRIBUTE_MODIFIERS, ItemAttributeModifiers.EMPTY); - return itemAttributeModifiers.compute(this.getAttributeBaseValue(Attributes.ATTACK_DAMAGE), EquipmentSlot.MAINHAND); + return itemAttributeModifiers.compute(d, equipmentSlot); } public boolean canReplaceEqualItem(ItemStack candidate, ItemStack existing) { @@ -691,8 +688,8 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab return true; } - public boolean wantsToPickUp(ItemStack stack) { - return this.canHoldItem(stack); + public boolean wantsToPickUp(ServerLevel serverLevel, ItemStack itemStack) { + return this.canHoldItem(itemStack); } public boolean removeWhenFarAway(double distanceToClosestPlayer) { @@ -737,7 +734,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab @Override protected final void serverAiStep() { this.noActionTime++; - ProfilerFiller profilerFiller = this.level().getProfiler(); + ProfilerFiller profilerFiller = Profiler.get(); profilerFiller.push("sensing"); this.sensing.tick(); profilerFiller.pop(); @@ -762,7 +759,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab this.navigation.tick(); profilerFiller.pop(); profilerFiller.push("mob tick"); - this.customServerAiStep(); + this.customServerAiStep((ServerLevel)this.level()); profilerFiller.pop(); profilerFiller.push("controls"); profilerFiller.push("move"); @@ -780,7 +777,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab DebugPackets.sendGoalSelector(this.level(), this, this.goalSelector); } - protected void customServerAiStep() { + protected void customServerAiStep(ServerLevel serverLevel) { } /** @@ -843,12 +840,14 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab return angle + f; } - public static boolean checkMobSpawnRules(EntityType type, LevelAccessor level, MobSpawnType spawnType, BlockPos pos, RandomSource random) { - BlockPos blockPos = pos.below(); - return spawnType == MobSpawnType.SPAWNER || level.getBlockState(blockPos).isValidSpawn(level, blockPos, type); + public static boolean checkMobSpawnRules( + EntityType entityType, LevelAccessor levelAccessor, EntitySpawnReason entitySpawnReason, BlockPos blockPos, RandomSource randomSource + ) { + BlockPos blockPos2 = blockPos.below(); + return EntitySpawnReason.isSpawner(entitySpawnReason) || levelAccessor.getBlockState(blockPos2).isValidSpawn(levelAccessor, blockPos2, entityType); } - public boolean checkSpawnRules(LevelAccessor level, MobSpawnType reason) { + public boolean checkSpawnRules(LevelAccessor levelAccessor, EntitySpawnReason entitySpawnReason) { return true; } @@ -905,10 +904,6 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab return !this.getItemBySlot(EquipmentSlot.BODY).isEmpty(); } - public boolean isBodyArmorItem(ItemStack stack) { - return false; - } - public void setBodyArmorItem(ItemStack stack) { this.setItemSlotAndDropWhenKilled(EquipmentSlot.BODY, stack); } @@ -948,7 +943,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab protected void dropCustomDeathLoot(ServerLevel level, DamageSource damageSource, boolean recentlyHit) { super.dropCustomDeathLoot(level, damageSource, recentlyHit); - for (EquipmentSlot equipmentSlot : EquipmentSlot.values()) { + for (EquipmentSlot equipmentSlot : EquipmentSlot.VALUES) { ItemStack itemStack = this.getItemBySlot(equipmentSlot); float f = this.getEquipmentDropChance(equipmentSlot); if (f != 0.0F) { @@ -965,7 +960,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab itemStack.setDamageValue(itemStack.getMaxDamage() - this.random.nextInt(1 + this.random.nextInt(Math.max(itemStack.getMaxDamage() - 3, 1)))); } - this.spawnAtLocation(itemStack); + this.spawnAtLocation(level, itemStack); this.setItemSlot(equipmentSlot, ItemStack.EMPTY); } } @@ -980,14 +975,14 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab }; } - public void dropPreservedEquipment() { - this.dropPreservedEquipment(itemStack -> true); + public void dropPreservedEquipment(ServerLevel serverLevel) { + this.dropPreservedEquipment(serverLevel, itemStack -> true); } - public Set dropPreservedEquipment(Predicate predicate) { + public Set dropPreservedEquipment(ServerLevel serverLevel, Predicate predicate) { Set set = new HashSet(); - for (EquipmentSlot equipmentSlot : EquipmentSlot.values()) { + for (EquipmentSlot equipmentSlot : EquipmentSlot.VALUES) { ItemStack itemStack = this.getItemBySlot(equipmentSlot); if (!itemStack.isEmpty()) { if (!predicate.test(itemStack)) { @@ -996,7 +991,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab double d = this.getEquipmentDropChance(equipmentSlot); if (d > 1.0) { this.setItemSlot(equipmentSlot, ItemStack.EMPTY); - this.spawnAtLocation(itemStack); + this.spawnAtLocation(serverLevel, itemStack); } } } @@ -1040,19 +1035,17 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab boolean bl = true; - for (EquipmentSlot equipmentSlot : EquipmentSlot.values()) { - if (equipmentSlot.getType() == EquipmentSlot.Type.HUMANOID_ARMOR) { - ItemStack itemStack = this.getItemBySlot(equipmentSlot); - if (!bl && random.nextFloat() < f) { - break; - } + for (EquipmentSlot equipmentSlot : EQUIPMENT_POPULATION_ORDER) { + ItemStack itemStack = this.getItemBySlot(equipmentSlot); + if (!bl && random.nextFloat() < f) { + break; + } - bl = false; - if (itemStack.isEmpty()) { - Item item = getEquipmentForSlot(equipmentSlot, i); - if (item != null) { - this.setItemSlot(equipmentSlot, new ItemStack(item)); - } + bl = false; + if (itemStack.isEmpty()) { + Item item = getEquipmentForSlot(equipmentSlot, i); + if (item != null) { + this.setItemSlot(equipmentSlot, new ItemStack(item)); } } } @@ -1118,7 +1111,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab protected void populateDefaultEquipmentEnchantments(ServerLevelAccessor level, RandomSource random, DifficultyInstance difficulty) { this.enchantSpawnedWeapon(level, random, difficulty); - for (EquipmentSlot equipmentSlot : EquipmentSlot.values()) { + for (EquipmentSlot equipmentSlot : EquipmentSlot.VALUES) { if (equipmentSlot.getType() == EquipmentSlot.Type.HUMANOID_ARMOR) { this.enchantSpawnedArmor(level, random, equipmentSlot, difficulty); } @@ -1142,8 +1135,10 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab } @Nullable - public SpawnGroupData finalizeSpawn(ServerLevelAccessor level, DifficultyInstance difficulty, MobSpawnType spawnType, @Nullable SpawnGroupData spawnGroupData) { - RandomSource randomSource = level.getRandom(); + public SpawnGroupData finalizeSpawn( + ServerLevelAccessor serverLevelAccessor, DifficultyInstance difficultyInstance, EntitySpawnReason entitySpawnReason, @Nullable SpawnGroupData spawnGroupData + ) { + RandomSource randomSource = serverLevelAccessor.getRandom(); AttributeInstance attributeInstance = (AttributeInstance)Objects.requireNonNull(this.getAttribute(Attributes.FOLLOW_RANGE)); if (!attributeInstance.hasModifier(RANDOM_SPAWN_BONUS_ID)) { attributeInstance.addPermanentModifier( @@ -1176,6 +1171,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab } } + @Override public boolean canPickUpLoot() { return this.canPickUpLoot; } @@ -1185,9 +1181,8 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab } @Override - public boolean canTakeItem(ItemStack stack) { - EquipmentSlot equipmentSlot = this.getEquipmentSlotForItem(stack); - return this.getItemBySlot(equipmentSlot).isEmpty() && this.canPickUpLoot(); + protected boolean canDispenserEquipIntoSlot(EquipmentSlot equipmentSlot) { + return this.canPickUpLoot(); } /** @@ -1239,10 +1234,12 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab player, this, (EntityType)this.getType(), (ServerLevel)this.level(), this.position(), itemStack ); optional.ifPresent(mob -> this.onOffspringSpawnedFromEgg(player, mob)); - return optional.isPresent() ? InteractionResult.SUCCESS : InteractionResult.PASS; - } else { - return InteractionResult.CONSUME; + if (optional.isEmpty()) { + return InteractionResult.PASS; + } } + + return InteractionResult.SUCCESS_SERVER; } else { return InteractionResult.PASS; } @@ -1285,52 +1282,36 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab } @Nullable - public T convertTo(EntityType entityType, boolean transferInventory) { + public T convertTo( + EntityType entityType, ConversionParams conversionParams, EntitySpawnReason entitySpawnReason, ConversionParams.AfterConversion afterConversion + ) { if (this.isRemoved()) { return null; } else { - T mob = (T)entityType.create(this.level()); + T mob = (T)entityType.create(this.level(), entitySpawnReason); if (mob == null) { return null; } else { - mob.copyPosition(this); - mob.setBaby(this.isBaby()); - mob.setNoAi(this.isNoAi()); - if (this.hasCustomName()) { - mob.setCustomName(this.getCustomName()); - mob.setCustomNameVisible(this.isCustomNameVisible()); + conversionParams.type().convert(this, mob, conversionParams); + afterConversion.finalizeConversion(mob); + if (this.level() instanceof ServerLevel serverLevel) { + serverLevel.addFreshEntity(mob); } - if (this.isPersistenceRequired()) { - mob.setPersistenceRequired(); + if (conversionParams.type().shouldDiscardAfterConversion()) { + this.discard(); } - mob.setInvulnerable(this.isInvulnerable()); - if (transferInventory) { - mob.setCanPickUpLoot(this.canPickUpLoot()); - - for (EquipmentSlot equipmentSlot : EquipmentSlot.values()) { - ItemStack itemStack = this.getItemBySlot(equipmentSlot); - if (!itemStack.isEmpty()) { - mob.setItemSlot(equipmentSlot, itemStack.copyAndClear()); - mob.setDropChance(equipmentSlot, this.getEquipmentDropChance(equipmentSlot)); - } - } - } - - this.level().addFreshEntity(mob); - if (this.isPassenger()) { - Entity entity = this.getVehicle(); - this.stopRiding(); - mob.startRiding(entity, true); - } - - this.discard(); return mob; } } } + @Nullable + public T convertTo(EntityType entityType, ConversionParams conversionParams, ConversionParams.AfterConversion afterConversion) { + return this.convertTo(entityType, conversionParams, EntitySpawnReason.CONVERSION, afterConversion); + } + @Nullable @Override public Leashable.LeashData getLeashData() { @@ -1441,26 +1422,26 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab } @Override - public boolean doHurtTarget(Entity target) { + public boolean doHurtTarget(ServerLevel serverLevel, Entity entity) { float f = (float)this.getAttributeValue(Attributes.ATTACK_DAMAGE); - DamageSource damageSource = this.damageSources().mobAttack(this); - if (this.level() instanceof ServerLevel serverLevel) { - f = EnchantmentHelper.modifyDamage(serverLevel, this.getWeaponItem(), target, damageSource, f); - } - - boolean bl = target.hurt(damageSource, f); + ItemStack itemStack = this.getWeaponItem(); + DamageSource damageSource = (DamageSource)Optional.ofNullable(itemStack.getItem().getDamageSource(this)).orElse(this.damageSources().mobAttack(this)); + f = EnchantmentHelper.modifyDamage(serverLevel, itemStack, entity, damageSource, f); + f += itemStack.getItem().getAttackDamageBonus(entity, f, damageSource); + boolean bl = entity.hurtServer(serverLevel, damageSource, f); if (bl) { - float g = this.getKnockback(target, damageSource); - if (g > 0.0F && target instanceof LivingEntity livingEntity) { + float g = this.getKnockback(entity, damageSource); + if (g > 0.0F && entity instanceof LivingEntity livingEntity) { livingEntity.knockback(g * 0.5F, Mth.sin(this.getYRot() * (float) (Math.PI / 180.0)), -Mth.cos(this.getYRot() * (float) (Math.PI / 180.0))); this.setDeltaMovement(this.getDeltaMovement().multiply(0.6, 1.0, 0.6)); } - if (this.level() instanceof ServerLevel serverLevel2) { - EnchantmentHelper.doPostAttackEffects(serverLevel2, target, damageSource); + if (entity instanceof LivingEntity livingEntity) { + itemStack.hurtEnemy(livingEntity, this); } - this.setLastHurtMob(target); + EnchantmentHelper.doPostAttackEffects(serverLevel, entity, damageSource); + this.setLastHurtMob(entity); this.playAttackSound(); } @@ -1518,4 +1499,22 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab SpawnEggItem spawnEggItem = SpawnEggItem.byId(this.getType()); return spawnEggItem == null ? null : new ItemStack(spawnEggItem); } + + @Override + protected void onAttributeUpdated(Holder attribute) { + super.onAttributeUpdated(attribute); + if (attribute.is(Attributes.FOLLOW_RANGE) || attribute.is(Attributes.TEMPT_RANGE)) { + this.getNavigation().updatePathfinderMaxVisitedNodes(); + } + } + + @VisibleForTesting + public float[] getHandDropChances() { + return this.handDropChances; + } + + @VisibleForTesting + public float[] getArmorDropChances() { + return this.armorDropChances; + } } diff --git a/net/minecraft/world/entity/MobSpawnType.java b/net/minecraft/world/entity/MobSpawnType.java deleted file mode 100644 index 189d0fd8..00000000 --- a/net/minecraft/world/entity/MobSpawnType.java +++ /dev/null @@ -1,29 +0,0 @@ -package net.minecraft.world.entity; - -public enum MobSpawnType { - NATURAL, - CHUNK_GENERATION, - SPAWNER, - STRUCTURE, - BREEDING, - MOB_SUMMONED, - JOCKEY, - EVENT, - CONVERSION, - REINFORCEMENT, - TRIGGERED, - BUCKET, - SPAWN_EGG, - COMMAND, - DISPENSER, - PATROL, - TRIAL_SPAWNER; - - public static boolean isSpawner(MobSpawnType spawnType) { - return spawnType == SPAWNER || spawnType == TRIAL_SPAWNER; - } - - public static boolean ignoresLightRequirements(MobSpawnType spawnType) { - return spawnType == TRIAL_SPAWNER; - } -} diff --git a/net/minecraft/world/entity/NeutralMob.java b/net/minecraft/world/entity/NeutralMob.java index 061a2582..cce694d3 100644 --- a/net/minecraft/world/entity/NeutralMob.java +++ b/net/minecraft/world/entity/NeutralMob.java @@ -75,24 +75,26 @@ public interface NeutralMob { } } - default boolean isAngryAt(LivingEntity target) { - if (!this.canAttack(target)) { + default boolean isAngryAt(LivingEntity livingEntity, ServerLevel serverLevel) { + if (!this.canAttack(livingEntity)) { return false; } else { - return target.getType() == EntityType.PLAYER && this.isAngryAtAllPlayers(target.level()) ? true : target.getUUID().equals(this.getPersistentAngerTarget()); + return livingEntity.getType() == EntityType.PLAYER && this.isAngryAtAllPlayers(serverLevel) + ? true + : livingEntity.getUUID().equals(this.getPersistentAngerTarget()); } } - default boolean isAngryAtAllPlayers(Level level) { - return level.getGameRules().getBoolean(GameRules.RULE_UNIVERSAL_ANGER) && this.isAngry() && this.getPersistentAngerTarget() == null; + default boolean isAngryAtAllPlayers(ServerLevel serverLevel) { + return serverLevel.getGameRules().getBoolean(GameRules.RULE_UNIVERSAL_ANGER) && this.isAngry() && this.getPersistentAngerTarget() == null; } default boolean isAngry() { return this.getRemainingPersistentAngerTime() > 0; } - default void playerDied(Player player) { - if (player.level().getGameRules().getBoolean(GameRules.RULE_FORGIVE_DEAD_PLAYERS)) { + default void playerDied(ServerLevel serverLevel, Player player) { + if (serverLevel.getGameRules().getBoolean(GameRules.RULE_FORGIVE_DEAD_PLAYERS)) { if (player.getUUID().equals(this.getPersistentAngerTarget())) { this.stopBeingAngry(); } diff --git a/net/minecraft/world/entity/OminousItemSpawner.java b/net/minecraft/world/entity/OminousItemSpawner.java index 2d60c044..0b7f3f73 100644 --- a/net/minecraft/world/entity/OminousItemSpawner.java +++ b/net/minecraft/world/entity/OminousItemSpawner.java @@ -6,12 +6,16 @@ import net.minecraft.nbt.CompoundTag; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.network.syncher.SynchedEntityData.Builder; +import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; +import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.item.ItemEntity; import net.minecraft.world.entity.projectile.Projectile; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ProjectileItem; +import net.minecraft.world.item.ProjectileItem.DispenseConfig; import net.minecraft.world.level.Level; import net.minecraft.world.level.gameevent.GameEvent; import net.minecraft.world.level.material.PushReaction; @@ -41,21 +45,21 @@ public class OminousItemSpawner extends Entity { @Override public void tick() { super.tick(); - if (this.level().isClientSide) { - this.tickClient(); + if (this.level() instanceof ServerLevel serverLevel) { + this.tickServer(serverLevel); } else { - this.tickServer(); + this.tickClient(); } } - private void tickServer() { + private void tickServer(ServerLevel serverLevel) { if (this.tickCount == this.spawnItemAfterTicks - 36L) { - this.level().playSound(null, this.blockPosition(), SoundEvents.TRIAL_SPAWNER_ABOUT_TO_SPAWN_ITEM, SoundSource.NEUTRAL); + serverLevel.playSound(null, this.blockPosition(), SoundEvents.TRIAL_SPAWNER_ABOUT_TO_SPAWN_ITEM, SoundSource.NEUTRAL); } if (this.tickCount >= this.spawnItemAfterTicks) { this.spawnItem(); - this.kill(); + this.kill(serverLevel); } } @@ -66,31 +70,44 @@ public class OminousItemSpawner extends Entity { } private void spawnItem() { - Level level = this.level(); - ItemStack itemStack = this.getItem(); - if (!itemStack.isEmpty()) { - Entity entity; - if (itemStack.getItem() instanceof ProjectileItem projectileItem) { - Direction direction = Direction.DOWN; - Projectile projectile = projectileItem.asProjectile(level, this.position(), itemStack, direction); - projectile.setOwner(this); - ProjectileItem.DispenseConfig dispenseConfig = projectileItem.createDispenseConfig(); - projectileItem.shoot(projectile, direction.getStepX(), direction.getStepY(), direction.getStepZ(), dispenseConfig.power(), dispenseConfig.uncertainty()); - dispenseConfig.overrideDispenseEvent().ifPresent(i -> level.levelEvent(i, this.blockPosition(), 0)); - entity = projectile; - } else { - entity = new ItemEntity(level, this.getX(), this.getY(), this.getZ(), itemStack); - } + if (this.level() instanceof ServerLevel serverLevel) { + ItemStack itemStack = this.getItem(); + if (!itemStack.isEmpty()) { + Entity entity; + if (itemStack.getItem() instanceof ProjectileItem projectileItem) { + entity = this.spawnProjectile(serverLevel, projectileItem, itemStack); + } else { + entity = new ItemEntity(serverLevel, this.getX(), this.getY(), this.getZ(), itemStack); + serverLevel.addFreshEntity(entity); + } - level.addFreshEntity(entity); - level.levelEvent(3021, this.blockPosition(), 1); - level.gameEvent(entity, GameEvent.ENTITY_PLACE, this.position()); - this.setItem(ItemStack.EMPTY); + serverLevel.levelEvent(3021, this.blockPosition(), 1); + serverLevel.gameEvent(entity, GameEvent.ENTITY_PLACE, this.position()); + this.setItem(ItemStack.EMPTY); + } } } + private Entity spawnProjectile(ServerLevel serverLevel, ProjectileItem projectileItem, ItemStack itemStack) { + DispenseConfig dispenseConfig = projectileItem.createDispenseConfig(); + dispenseConfig.overrideDispenseEvent().ifPresent(i -> serverLevel.levelEvent(i, this.blockPosition(), 0)); + Direction direction = Direction.DOWN; + Projectile projectile = Projectile.spawnProjectileUsingShoot( + projectileItem.asProjectile(serverLevel, this.position(), itemStack, direction), + serverLevel, + itemStack, + direction.getStepX(), + direction.getStepY(), + direction.getStepZ(), + dispenseConfig.power(), + dispenseConfig.uncertainty() + ); + projectile.setOwner(this); + return projectile; + } + @Override - protected void defineSynchedData(SynchedEntityData.Builder builder) { + protected void defineSynchedData(Builder builder) { builder.define(DATA_ITEM, ItemStack.EMPTY); } @@ -160,4 +177,9 @@ public class OminousItemSpawner extends Entity { private void setItem(ItemStack item) { this.getEntityData().set(DATA_ITEM, item); } + + @Override + public final boolean hurtServer(ServerLevel serverLevel, DamageSource damageSource, float f) { + return false; + } } diff --git a/net/minecraft/world/entity/PathfinderMob.java b/net/minecraft/world/entity/PathfinderMob.java index d2bac3b6..41106bc8 100644 --- a/net/minecraft/world/entity/PathfinderMob.java +++ b/net/minecraft/world/entity/PathfinderMob.java @@ -26,8 +26,8 @@ public abstract class PathfinderMob extends Mob { } @Override - public boolean checkSpawnRules(LevelAccessor level, MobSpawnType reason) { - return this.getWalkTargetValue(this.blockPosition(), level) >= 0.0F; + public boolean checkSpawnRules(LevelAccessor levelAccessor, EntitySpawnReason entitySpawnReason) { + return this.getWalkTargetValue(this.blockPosition(), levelAccessor) >= 0.0F; } /** diff --git a/net/minecraft/world/entity/PortalProcessor.java b/net/minecraft/world/entity/PortalProcessor.java index 81eb25f6..5cfb342b 100644 --- a/net/minecraft/world/entity/PortalProcessor.java +++ b/net/minecraft/world/entity/PortalProcessor.java @@ -3,11 +3,11 @@ package net.minecraft.world.entity; import net.minecraft.core.BlockPos; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.level.block.Portal; -import net.minecraft.world.level.portal.DimensionTransition; +import net.minecraft.world.level.portal.TeleportTransition; import org.jetbrains.annotations.Nullable; public class PortalProcessor { - private Portal portal; + private final Portal portal; private BlockPos entryPosition; private int portalTime; private boolean insidePortalThisTick; @@ -29,8 +29,8 @@ public class PortalProcessor { } @Nullable - public DimensionTransition getPortalDestination(ServerLevel level, Entity entity) { - return this.portal.getPortalDestination(level, entity, this.entryPosition); + public TeleportTransition getPortalDestination(ServerLevel serverLevel, Entity entity) { + return this.portal.getPortalDestination(serverLevel, entity, this.entryPosition); } public Portal.Transition getPortalLocalTransition() { diff --git a/net/minecraft/world/entity/PositionMoveRotation.java b/net/minecraft/world/entity/PositionMoveRotation.java new file mode 100644 index 00000000..d13497d2 --- /dev/null +++ b/net/minecraft/world/entity/PositionMoveRotation.java @@ -0,0 +1,65 @@ +package net.minecraft.world.entity; + +import java.util.Set; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.world.level.portal.TeleportTransition; +import net.minecraft.world.phys.Vec3; + +public record PositionMoveRotation(Vec3 position, Vec3 deltaMovement, float yRot, float xRot) { + public static final StreamCodec STREAM_CODEC = StreamCodec.composite( + Vec3.STREAM_CODEC, + PositionMoveRotation::position, + Vec3.STREAM_CODEC, + PositionMoveRotation::deltaMovement, + ByteBufCodecs.FLOAT, + PositionMoveRotation::yRot, + ByteBufCodecs.FLOAT, + PositionMoveRotation::xRot, + PositionMoveRotation::new + ); + + public static PositionMoveRotation of(Entity entity) { + return new PositionMoveRotation(entity.position(), entity.getKnownMovement(), entity.getYRot(), entity.getXRot()); + } + + public static PositionMoveRotation ofEntityUsingLerpTarget(Entity entity) { + return new PositionMoveRotation( + new Vec3(entity.lerpTargetX(), entity.lerpTargetY(), entity.lerpTargetZ()), entity.getKnownMovement(), entity.getYRot(), entity.getXRot() + ); + } + + public static PositionMoveRotation of(TeleportTransition teleportTransition) { + return new PositionMoveRotation(teleportTransition.position(), teleportTransition.deltaMovement(), teleportTransition.yRot(), teleportTransition.xRot()); + } + + public static PositionMoveRotation calculateAbsolute(PositionMoveRotation positionMoveRotation, PositionMoveRotation positionMoveRotation2, Set set) { + double d = set.contains(Relative.X) ? positionMoveRotation.position.x : 0.0; + double e = set.contains(Relative.Y) ? positionMoveRotation.position.y : 0.0; + double f = set.contains(Relative.Z) ? positionMoveRotation.position.z : 0.0; + float g = set.contains(Relative.Y_ROT) ? positionMoveRotation.yRot : 0.0F; + float h = set.contains(Relative.X_ROT) ? positionMoveRotation.xRot : 0.0F; + Vec3 vec3 = new Vec3(d + positionMoveRotation2.position.x, e + positionMoveRotation2.position.y, f + positionMoveRotation2.position.z); + float i = g + positionMoveRotation2.yRot; + float j = h + positionMoveRotation2.xRot; + Vec3 vec32 = positionMoveRotation.deltaMovement; + if (set.contains(Relative.ROTATE_DELTA)) { + float k = positionMoveRotation.yRot - i; + float l = positionMoveRotation.xRot - j; + vec32 = vec32.xRot((float)Math.toRadians(l)); + vec32 = vec32.yRot((float)Math.toRadians(k)); + } + + Vec3 vec33 = new Vec3( + calculateDelta(vec32.x, positionMoveRotation2.deltaMovement.x, set, Relative.DELTA_X), + calculateDelta(vec32.y, positionMoveRotation2.deltaMovement.y, set, Relative.DELTA_Y), + calculateDelta(vec32.z, positionMoveRotation2.deltaMovement.z, set, Relative.DELTA_Z) + ); + return new PositionMoveRotation(vec3, vec33, i, j); + } + + private static double calculateDelta(double d, double e, Set set, Relative relative) { + return set.contains(relative) ? d + e : e; + } +} diff --git a/net/minecraft/world/entity/PowerableMob.java b/net/minecraft/world/entity/PowerableMob.java deleted file mode 100644 index 34728cb8..00000000 --- a/net/minecraft/world/entity/PowerableMob.java +++ /dev/null @@ -1,5 +0,0 @@ -package net.minecraft.world.entity; - -public interface PowerableMob { - boolean isPowered(); -} diff --git a/net/minecraft/world/entity/Relative.java b/net/minecraft/world/entity/Relative.java new file mode 100644 index 00000000..288acc80 --- /dev/null +++ b/net/minecraft/world/entity/Relative.java @@ -0,0 +1,71 @@ +package net.minecraft.world.entity; + +import io.netty.buffer.ByteBuf; +import java.util.EnumSet; +import java.util.HashSet; +import java.util.Set; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.network.codec.StreamCodec; + +public enum Relative { + X(0), + Y(1), + Z(2), + Y_ROT(3), + X_ROT(4), + DELTA_X(5), + DELTA_Y(6), + DELTA_Z(7), + ROTATE_DELTA(8); + + public static final Set ALL = Set.of(values()); + public static final Set ROTATION = Set.of(X_ROT, Y_ROT); + public static final Set DELTA = Set.of(DELTA_X, DELTA_Y, DELTA_Z, ROTATE_DELTA); + public static final StreamCodec> SET_STREAM_CODEC = ByteBufCodecs.INT.map(Relative::unpack, Relative::pack); + private final int bit; + + @SafeVarargs + public static Set union(Set... sets) { + HashSet hashSet = new HashSet(); + + for (Set set : sets) { + hashSet.addAll(set); + } + + return hashSet; + } + + private Relative(final int j) { + this.bit = j; + } + + private int getMask() { + return 1 << this.bit; + } + + private boolean isSet(int i) { + return (i & this.getMask()) == this.getMask(); + } + + public static Set unpack(int i) { + Set set = EnumSet.noneOf(Relative.class); + + for (Relative relative : values()) { + if (relative.isSet(i)) { + set.add(relative); + } + } + + return set; + } + + public static int pack(Set set) { + int i = 0; + + for (Relative relative : set) { + i |= relative.getMask(); + } + + return i; + } +} diff --git a/net/minecraft/world/entity/RelativeMovement.java b/net/minecraft/world/entity/RelativeMovement.java deleted file mode 100644 index 721eae3e..00000000 --- a/net/minecraft/world/entity/RelativeMovement.java +++ /dev/null @@ -1,50 +0,0 @@ -package net.minecraft.world.entity; - -import java.util.EnumSet; -import java.util.Set; - -public enum RelativeMovement { - X(0), - Y(1), - Z(2), - Y_ROT(3), - X_ROT(4); - - public static final Set ALL = Set.of(values()); - public static final Set ROTATION = Set.of(X_ROT, Y_ROT); - private final int bit; - - private RelativeMovement(final int bit) { - this.bit = bit; - } - - private int getMask() { - return 1 << this.bit; - } - - private boolean isSet(int packedMovements) { - return (packedMovements & this.getMask()) == this.getMask(); - } - - public static Set unpack(int packedMovements) { - Set set = EnumSet.noneOf(RelativeMovement.class); - - for (RelativeMovement relativeMovement : values()) { - if (relativeMovement.isSet(packedMovements)) { - set.add(relativeMovement); - } - } - - return set; - } - - public static int pack(Set movements) { - int i = 0; - - for (RelativeMovement relativeMovement : movements) { - i |= relativeMovement.getMask(); - } - - return i; - } -} diff --git a/net/minecraft/world/entity/Shearable.java b/net/minecraft/world/entity/Shearable.java index 2f00e649..51d7eb6a 100644 --- a/net/minecraft/world/entity/Shearable.java +++ b/net/minecraft/world/entity/Shearable.java @@ -1,9 +1,11 @@ package net.minecraft.world.entity; +import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundSource; +import net.minecraft.world.item.ItemStack; public interface Shearable { - void shear(SoundSource source); + void shear(ServerLevel serverLevel, SoundSource soundSource, ItemStack itemStack); boolean readyForShearing(); } diff --git a/net/minecraft/world/entity/SpawnPlacements.java b/net/minecraft/world/entity/SpawnPlacements.java index 28afc569..bd0636ab 100644 --- a/net/minecraft/world/entity/SpawnPlacements.java +++ b/net/minecraft/world/entity/SpawnPlacements.java @@ -6,6 +6,7 @@ import net.minecraft.core.BlockPos; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.util.RandomSource; import net.minecraft.world.entity.ambient.Bat; +import net.minecraft.world.entity.animal.AgeableWaterCreature; import net.minecraft.world.entity.animal.Animal; import net.minecraft.world.entity.animal.Fox; import net.minecraft.world.entity.animal.MushroomCow; @@ -70,26 +71,34 @@ public class SpawnPlacements { } public static boolean checkSpawnRules( - EntityType entityType, ServerLevelAccessor serverLevel, MobSpawnType spawnType, BlockPos pos, RandomSource random + EntityType entityType, ServerLevelAccessor serverLevelAccessor, EntitySpawnReason entitySpawnReason, BlockPos blockPos, RandomSource randomSource ) { SpawnPlacements.Data data = (SpawnPlacements.Data)DATA_BY_TYPE.get(entityType); - return data == null || data.predicate.test(entityType, serverLevel, spawnType, pos, random); + return data == null || data.predicate.test(entityType, serverLevelAccessor, entitySpawnReason, blockPos, randomSource); } static { register(EntityType.AXOLOTL, SpawnPlacementTypes.IN_WATER, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, Axolotl::checkAxolotlSpawnRules); register(EntityType.COD, SpawnPlacementTypes.IN_WATER, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, WaterAnimal::checkSurfaceWaterAnimalSpawnRules); - register(EntityType.DOLPHIN, SpawnPlacementTypes.IN_WATER, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, WaterAnimal::checkSurfaceWaterAnimalSpawnRules); + register( + EntityType.DOLPHIN, + SpawnPlacementTypes.IN_WATER, + Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, + AgeableWaterCreature::checkSurfaceAgeableWaterCreatureSpawnRules + ); register(EntityType.DROWNED, SpawnPlacementTypes.IN_WATER, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, Drowned::checkDrownedSpawnRules); register(EntityType.GUARDIAN, SpawnPlacementTypes.IN_WATER, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, Guardian::checkGuardianSpawnRules); register(EntityType.PUFFERFISH, SpawnPlacementTypes.IN_WATER, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, WaterAnimal::checkSurfaceWaterAnimalSpawnRules); register(EntityType.SALMON, SpawnPlacementTypes.IN_WATER, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, WaterAnimal::checkSurfaceWaterAnimalSpawnRules); - register(EntityType.SQUID, SpawnPlacementTypes.IN_WATER, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, WaterAnimal::checkSurfaceWaterAnimalSpawnRules); + register( + EntityType.SQUID, SpawnPlacementTypes.IN_WATER, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, AgeableWaterCreature::checkSurfaceAgeableWaterCreatureSpawnRules + ); register(EntityType.TROPICAL_FISH, SpawnPlacementTypes.IN_WATER, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, TropicalFish::checkTropicalFishSpawnRules); register(EntityType.ARMADILLO, SpawnPlacementTypes.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, Armadillo::checkArmadilloSpawnRules); register(EntityType.BAT, SpawnPlacementTypes.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, Bat::checkBatSpawnRules); register(EntityType.BLAZE, SpawnPlacementTypes.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, Monster::checkAnyLightMonsterSpawnRules); register(EntityType.BOGGED, SpawnPlacementTypes.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, Monster::checkMonsterSpawnRules); + register(EntityType.BREEZE, SpawnPlacementTypes.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, Monster::checkAnyLightMonsterSpawnRules); register(EntityType.CAVE_SPIDER, SpawnPlacementTypes.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, Monster::checkMonsterSpawnRules); register(EntityType.CHICKEN, SpawnPlacementTypes.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, Animal::checkAnimalSpawnRules); register(EntityType.COW, SpawnPlacementTypes.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, Animal::checkAnimalSpawnRules); @@ -133,6 +142,9 @@ public class SpawnPlacements { register(EntityType.WITHER, SpawnPlacementTypes.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, Monster::checkMonsterSpawnRules); register(EntityType.WITHER_SKELETON, SpawnPlacementTypes.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, Monster::checkMonsterSpawnRules); register(EntityType.WOLF, SpawnPlacementTypes.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, Wolf::checkWolfSpawnRules); + register(EntityType.ZOGLIN, SpawnPlacementTypes.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, Monster::checkAnyLightMonsterSpawnRules); + register(EntityType.CREAKING, SpawnPlacementTypes.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, Monster::checkMonsterSpawnRules); + register(EntityType.CREAKING_TRANSIENT, SpawnPlacementTypes.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, Monster::checkMonsterSpawnRules); register(EntityType.ZOMBIE, SpawnPlacementTypes.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, Monster::checkMonsterSpawnRules); register(EntityType.ZOMBIE_HORSE, SpawnPlacementTypes.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, ZombieHorse::checkZombieHorseSpawnRules); register( @@ -152,7 +164,7 @@ public class SpawnPlacements { register(EntityType.VEX, SpawnPlacementTypes.NO_RESTRICTIONS, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, Monster::checkMonsterSpawnRules); register(EntityType.VINDICATOR, SpawnPlacementTypes.NO_RESTRICTIONS, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, Monster::checkMonsterSpawnRules); register(EntityType.WANDERING_TRADER, SpawnPlacementTypes.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, Mob::checkMobSpawnRules); - register(EntityType.WARDEN, SpawnPlacementTypes.NO_RESTRICTIONS, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, Mob::checkMobSpawnRules); + register(EntityType.WARDEN, SpawnPlacementTypes.NO_RESTRICTIONS, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, Monster::checkMonsterSpawnRules); } record Data(Heightmap.Types heightMap, SpawnPlacementType placement, SpawnPlacements.SpawnPredicate predicate) { @@ -160,6 +172,8 @@ public class SpawnPlacements { @FunctionalInterface public interface SpawnPredicate { - boolean test(EntityType entityType, ServerLevelAccessor serverLevelAccessor, MobSpawnType mobSpawnType, BlockPos blockPos, RandomSource randomSource); + boolean test( + EntityType entityType, ServerLevelAccessor serverLevelAccessor, EntitySpawnReason entitySpawnReason, BlockPos blockPos, RandomSource randomSource + ); } } diff --git a/net/minecraft/world/entity/TamableAnimal.java b/net/minecraft/world/entity/TamableAnimal.java index 04268ae4..c00a9ec5 100644 --- a/net/minecraft/world/entity/TamableAnimal.java +++ b/net/minecraft/world/entity/TamableAnimal.java @@ -10,6 +10,8 @@ import net.minecraft.nbt.CompoundTag; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.network.syncher.SynchedEntityData.Builder; +import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.players.OldUsersConverter; import net.minecraft.tags.TagKey; @@ -43,7 +45,7 @@ public abstract class TamableAnimal extends Animal implements OwnableEntity { } @Override - protected void defineSynchedData(SynchedEntityData.Builder builder) { + protected void defineSynchedData(Builder builder) { super.defineSynchedData(builder); builder.define(DATA_FLAGS_ID, (byte)0); builder.define(DATA_OWNERUUID_ID, Optional.empty()); @@ -206,7 +208,7 @@ public abstract class TamableAnimal extends Animal implements OwnableEntity { } @Override - public boolean isAlliedTo(Entity entity) { + protected boolean considersEntityAsAlly(Entity entity) { if (this.isTame()) { LivingEntity livingEntity = this.getOwner(); if (entity == livingEntity) { @@ -214,17 +216,19 @@ public abstract class TamableAnimal extends Animal implements OwnableEntity { } if (livingEntity != null) { - return livingEntity.isAlliedTo(entity); + return livingEntity.considersEntityAsAlly(entity); } } - return super.isAlliedTo(entity); + return super.considersEntityAsAlly(entity); } @Override public void die(DamageSource damageSource) { - if (!this.level().isClientSide && this.level().getGameRules().getBoolean(GameRules.RULE_SHOWDEATHMESSAGES) && this.getOwner() instanceof ServerPlayer) { - this.getOwner().sendSystemMessage(this.getCombatTracker().getDeathMessage()); + if (this.level() instanceof ServerLevel serverLevel + && serverLevel.getGameRules().getBoolean(GameRules.RULE_SHOWDEATHMESSAGES) + && this.getOwner() instanceof ServerPlayer serverPlayer) { + serverPlayer.sendSystemMessage(this.getCombatTracker().getDeathMessage()); } super.die(damageSource); diff --git a/net/minecraft/world/entity/WalkAnimationState.java b/net/minecraft/world/entity/WalkAnimationState.java index 9bee5f4c..32fd811e 100644 --- a/net/minecraft/world/entity/WalkAnimationState.java +++ b/net/minecraft/world/entity/WalkAnimationState.java @@ -6,15 +6,23 @@ public class WalkAnimationState { private float speedOld; private float speed; private float position; + private float positionScale = 1.0F; public void setSpeed(float speed) { this.speed = speed; } - public void update(float newSpeed, float partialTick) { + public void update(float f, float g, float h) { this.speedOld = this.speed; - this.speed = this.speed + (newSpeed - this.speed) * partialTick; + this.speed = this.speed + (f - this.speed) * g; this.position = this.position + this.speed; + this.positionScale = h; + } + + public void stop() { + this.speedOld = 0.0F; + this.speed = 0.0F; + this.position = 0.0F; } public float speed() { @@ -22,15 +30,15 @@ public class WalkAnimationState { } public float speed(float partialTick) { - return Mth.lerp(partialTick, this.speedOld, this.speed); + return Math.min(Mth.lerp(partialTick, this.speedOld, this.speed), 1.0F); } public float position() { - return this.position; + return this.position * this.positionScale; } public float position(float partialTick) { - return this.position - this.speed * (1.0F - partialTick); + return (this.position - this.speed * (1.0F - partialTick)) * this.positionScale; } public boolean isMoving() { diff --git a/net/minecraft/world/entity/ai/attributes/AttributeInstance.java b/net/minecraft/world/entity/ai/attributes/AttributeInstance.java index 6cc988ac..e5b4771c 100644 --- a/net/minecraft/world/entity/ai/attributes/AttributeInstance.java +++ b/net/minecraft/world/entity/ai/attributes/AttributeInstance.java @@ -64,6 +64,10 @@ public class AttributeInstance { return ImmutableSet.copyOf(this.modifierById.values()); } + public Set getPermanentModifiers() { + return ImmutableSet.copyOf(this.permanentModifiers.values()); + } + @Nullable public AttributeModifier getModifier(ResourceLocation id) { return (AttributeModifier)this.modifierById.get(id); @@ -106,6 +110,12 @@ public class AttributeInstance { this.permanentModifiers.put(modifier.id(), modifier); } + public void addPermanentModifiers(Collection collection) { + for (AttributeModifier attributeModifier : collection) { + this.addPermanentModifier(attributeModifier); + } + } + protected void setDirty() { this.dirty = true; this.onDirty.accept(this); diff --git a/net/minecraft/world/entity/ai/attributes/AttributeMap.java b/net/minecraft/world/entity/ai/attributes/AttributeMap.java index 102ba15c..c2b154c4 100644 --- a/net/minecraft/world/entity/ai/attributes/AttributeMap.java +++ b/net/minecraft/world/entity/ai/attributes/AttributeMap.java @@ -117,6 +117,15 @@ public class AttributeMap { }); } + public void assignPermanentModifiers(AttributeMap attributeMap) { + attributeMap.attributes.values().forEach(attributeInstance -> { + AttributeInstance attributeInstance2 = this.getInstance(attributeInstance.getAttribute()); + if (attributeInstance2 != null) { + attributeInstance2.addPermanentModifiers(attributeInstance.getPermanentModifiers()); + } + }); + } + public ListTag save() { ListTag listTag = new ListTag(); @@ -133,7 +142,7 @@ public class AttributeMap { String string = compoundTag.getString("id"); ResourceLocation resourceLocation = ResourceLocation.tryParse(string); if (resourceLocation != null) { - Util.ifElse(BuiltInRegistries.ATTRIBUTE.getHolder(resourceLocation), reference -> { + Util.ifElse(BuiltInRegistries.ATTRIBUTE.get(resourceLocation), reference -> { AttributeInstance attributeInstance = this.getInstance(reference); if (attributeInstance != null) { attributeInstance.load(compoundTag); diff --git a/net/minecraft/world/entity/ai/attributes/AttributeModifier.java b/net/minecraft/world/entity/ai/attributes/AttributeModifier.java index 0b3efece..c7c5bf7f 100644 --- a/net/minecraft/world/entity/ai/attributes/AttributeModifier.java +++ b/net/minecraft/world/entity/ai/attributes/AttributeModifier.java @@ -16,6 +16,7 @@ import net.minecraft.network.codec.StreamCodec; import net.minecraft.resources.ResourceLocation; import net.minecraft.util.ByIdMap; import net.minecraft.util.StringRepresentable; +import net.minecraft.util.ByIdMap.OutOfBoundsStrategy; import org.jetbrains.annotations.Nullable; import org.slf4j.Logger; @@ -65,9 +66,7 @@ public record AttributeModifier(ResourceLocation id, double amount, AttributeMod ADD_MULTIPLIED_BASE("add_multiplied_base", 1), ADD_MULTIPLIED_TOTAL("add_multiplied_total", 2); - public static final IntFunction BY_ID = ByIdMap.continuous( - AttributeModifier.Operation::id, values(), ByIdMap.OutOfBoundsStrategy.ZERO - ); + public static final IntFunction BY_ID = ByIdMap.continuous(AttributeModifier.Operation::id, values(), OutOfBoundsStrategy.ZERO); public static final StreamCodec STREAM_CODEC = ByteBufCodecs.idMapper(BY_ID, AttributeModifier.Operation::id); public static final Codec CODEC = StringRepresentable.fromEnum(AttributeModifier.Operation::values); private final String name; diff --git a/net/minecraft/world/entity/ai/attributes/Attributes.java b/net/minecraft/world/entity/ai/attributes/Attributes.java index c7930472..68e57567 100644 --- a/net/minecraft/world/entity/ai/attributes/Attributes.java +++ b/net/minecraft/world/entity/ai/attributes/Attributes.java @@ -4,6 +4,7 @@ import net.minecraft.core.Holder; import net.minecraft.core.Registry; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.ai.attributes.Attribute.Sentiment; /** * Contains all entity attributes defined and registered by the vanilla game. @@ -12,134 +13,125 @@ public class Attributes { /** * Handles the armor points for an entity. Each point represents half a chestplate of armor on the armor bar. */ - public static final Holder ARMOR = register("generic.armor", new RangedAttribute("attribute.name.generic.armor", 0.0, 0.0, 30.0).setSyncable(true)); + public static final Holder ARMOR = register("armor", new RangedAttribute("attribute.name.armor", 0.0, 0.0, 30.0).setSyncable(true)); /** * Handles the amount of damage mitigated by wearing armor. */ public static final Holder ARMOR_TOUGHNESS = register( - "generic.armor_toughness", new RangedAttribute("attribute.name.generic.armor_toughness", 0.0, 0.0, 20.0).setSyncable(true) + "armor_toughness", new RangedAttribute("attribute.name.armor_toughness", 0.0, 0.0, 20.0).setSyncable(true) ); /** * Handles the attack damage inflicted by entities. The value of this attribute represents half hearts. */ - public static final Holder ATTACK_DAMAGE = register( - "generic.attack_damage", new RangedAttribute("attribute.name.generic.attack_damage", 2.0, 0.0, 2048.0) - ); + public static final Holder ATTACK_DAMAGE = register("attack_damage", new RangedAttribute("attribute.name.attack_damage", 2.0, 0.0, 2048.0)); /** * Handles additional horizontal knockback when damaging another entity. */ - public static final Holder ATTACK_KNOCKBACK = register( - "generic.attack_knockback", new RangedAttribute("attribute.name.generic.attack_knockback", 0.0, 0.0, 5.0) - ); + public static final Holder ATTACK_KNOCKBACK = register("attack_knockback", new RangedAttribute("attribute.name.attack_knockback", 0.0, 0.0, 5.0)); /** * Handles the cooldown rate when attacking with an item. The value represents the number of full strength attacks that can be performed per second. */ public static final Holder ATTACK_SPEED = register( - "generic.attack_speed", new RangedAttribute("attribute.name.generic.attack_speed", 4.0, 0.0, 1024.0).setSyncable(true) + "attack_speed", new RangedAttribute("attribute.name.attack_speed", 4.0, 0.0, 1024.0).setSyncable(true) ); public static final Holder BLOCK_BREAK_SPEED = register( - "player.block_break_speed", new RangedAttribute("attribute.name.player.block_break_speed", 1.0, 0.0, 1024.0).setSyncable(true) + "block_break_speed", new RangedAttribute("attribute.name.block_break_speed", 1.0, 0.0, 1024.0).setSyncable(true) ); public static final Holder BLOCK_INTERACTION_RANGE = register( - "player.block_interaction_range", new RangedAttribute("attribute.name.player.block_interaction_range", 4.5, 0.0, 64.0).setSyncable(true) + "block_interaction_range", new RangedAttribute("attribute.name.block_interaction_range", 4.5, 0.0, 64.0).setSyncable(true) ); public static final Holder BURNING_TIME = register( - "generic.burning_time", - new RangedAttribute("attribute.name.generic.burning_time", 1.0, 0.0, 1024.0).setSyncable(true).setSentiment(Attribute.Sentiment.NEGATIVE) + "burning_time", new RangedAttribute("attribute.name.burning_time", 1.0, 0.0, 1024.0).setSyncable(true).setSentiment(Sentiment.NEGATIVE) ); public static final Holder EXPLOSION_KNOCKBACK_RESISTANCE = register( - "generic.explosion_knockback_resistance", new RangedAttribute("attribute.name.generic.explosion_knockback_resistance", 0.0, 0.0, 1.0).setSyncable(true) + "explosion_knockback_resistance", new RangedAttribute("attribute.name.explosion_knockback_resistance", 0.0, 0.0, 1.0).setSyncable(true) ); public static final Holder ENTITY_INTERACTION_RANGE = register( - "player.entity_interaction_range", new RangedAttribute("attribute.name.player.entity_interaction_range", 3.0, 0.0, 64.0).setSyncable(true) + "entity_interaction_range", new RangedAttribute("attribute.name.entity_interaction_range", 3.0, 0.0, 64.0).setSyncable(true) ); public static final Holder FALL_DAMAGE_MULTIPLIER = register( - "generic.fall_damage_multiplier", - new RangedAttribute("attribute.name.generic.fall_damage_multiplier", 1.0, 0.0, 100.0).setSyncable(true).setSentiment(Attribute.Sentiment.NEGATIVE) + "fall_damage_multiplier", new RangedAttribute("attribute.name.fall_damage_multiplier", 1.0, 0.0, 100.0).setSyncable(true).setSentiment(Sentiment.NEGATIVE) ); /** * Handles the movement speed of flying entities such as parrots and bees. */ public static final Holder FLYING_SPEED = register( - "generic.flying_speed", new RangedAttribute("attribute.name.generic.flying_speed", 0.4, 0.0, 1024.0).setSyncable(true) + "flying_speed", new RangedAttribute("attribute.name.flying_speed", 0.4, 0.0, 1024.0).setSyncable(true) ); /** * Handles the range in blocks that a mob will notice and track players and other potential targets. */ - public static final Holder FOLLOW_RANGE = register( - "generic.follow_range", new RangedAttribute("attribute.name.generic.follow_range", 32.0, 0.0, 2048.0) - ); + public static final Holder FOLLOW_RANGE = register("follow_range", new RangedAttribute("attribute.name.follow_range", 32.0, 0.0, 2048.0)); public static final Holder GRAVITY = register( - "generic.gravity", new RangedAttribute("attribute.name.generic.gravity", 0.08, -1.0, 1.0).setSyncable(true).setSentiment(Attribute.Sentiment.NEUTRAL) + "gravity", new RangedAttribute("attribute.name.gravity", 0.08, -1.0, 1.0).setSyncable(true).setSentiment(Sentiment.NEUTRAL) ); /** * Handles the jump strength for horses. */ public static final Holder JUMP_STRENGTH = register( - "generic.jump_strength", new RangedAttribute("attribute.name.generic.jump_strength", 0.42F, 0.0, 32.0).setSyncable(true) + "jump_strength", new RangedAttribute("attribute.name.jump_strength", 0.42F, 0.0, 32.0).setSyncable(true) ); /** * Handles the reduction of horizontal knockback when damaged by attacks or projectiles. */ public static final Holder KNOCKBACK_RESISTANCE = register( - "generic.knockback_resistance", new RangedAttribute("attribute.name.generic.knockback_resistance", 0.0, 0.0, 1.0) + "knockback_resistance", new RangedAttribute("attribute.name.knockback_resistance", 0.0, 0.0, 1.0) ); /** * Handles luck when a player generates loot from a loot table. This can impact the quality of loot and influence bonus rolls. */ - public static final Holder LUCK = register( - "generic.luck", new RangedAttribute("attribute.name.generic.luck", 0.0, -1024.0, 1024.0).setSyncable(true) - ); + public static final Holder LUCK = register("luck", new RangedAttribute("attribute.name.luck", 0.0, -1024.0, 1024.0).setSyncable(true)); public static final Holder MAX_ABSORPTION = register( - "generic.max_absorption", new RangedAttribute("attribute.name.generic.max_absorption", 0.0, 0.0, 2048.0).setSyncable(true) + "max_absorption", new RangedAttribute("attribute.name.max_absorption", 0.0, 0.0, 2048.0).setSyncable(true) ); /** * Handles the maximum health of an entity. */ public static final Holder MAX_HEALTH = register( - "generic.max_health", new RangedAttribute("attribute.name.generic.max_health", 20.0, 1.0, 1024.0).setSyncable(true) + "max_health", new RangedAttribute("attribute.name.max_health", 20.0, 1.0, 1024.0).setSyncable(true) ); public static final Holder MINING_EFFICIENCY = register( - "player.mining_efficiency", new RangedAttribute("attribute.name.player.mining_efficiency", 0.0, 0.0, 1024.0).setSyncable(true) + "mining_efficiency", new RangedAttribute("attribute.name.mining_efficiency", 0.0, 0.0, 1024.0).setSyncable(true) ); public static final Holder MOVEMENT_EFFICIENCY = register( - "generic.movement_efficiency", new RangedAttribute("attribute.name.generic.movement_efficiency", 0.0, 0.0, 1.0).setSyncable(true) + "movement_efficiency", new RangedAttribute("attribute.name.movement_efficiency", 0.0, 0.0, 1.0).setSyncable(true) ); /** * Handles the movement speed of entities. */ public static final Holder MOVEMENT_SPEED = register( - "generic.movement_speed", new RangedAttribute("attribute.name.generic.movement_speed", 0.7, 0.0, 1024.0).setSyncable(true) + "movement_speed", new RangedAttribute("attribute.name.movement_speed", 0.7, 0.0, 1024.0).setSyncable(true) ); public static final Holder OXYGEN_BONUS = register( - "generic.oxygen_bonus", new RangedAttribute("attribute.name.generic.oxygen_bonus", 0.0, 0.0, 1024.0).setSyncable(true) + "oxygen_bonus", new RangedAttribute("attribute.name.oxygen_bonus", 0.0, 0.0, 1024.0).setSyncable(true) ); public static final Holder SAFE_FALL_DISTANCE = register( - "generic.safe_fall_distance", new RangedAttribute("attribute.name.generic.safe_fall_distance", 3.0, -1024.0, 1024.0).setSyncable(true) + "safe_fall_distance", new RangedAttribute("attribute.name.safe_fall_distance", 3.0, -1024.0, 1024.0).setSyncable(true) ); public static final Holder SCALE = register( - "generic.scale", new RangedAttribute("attribute.name.generic.scale", 1.0, 0.0625, 16.0).setSyncable(true).setSentiment(Attribute.Sentiment.NEUTRAL) + "scale", new RangedAttribute("attribute.name.scale", 1.0, 0.0625, 16.0).setSyncable(true).setSentiment(Sentiment.NEUTRAL) ); public static final Holder SNEAKING_SPEED = register( - "player.sneaking_speed", new RangedAttribute("attribute.name.player.sneaking_speed", 0.3, 0.0, 1.0).setSyncable(true) + "sneaking_speed", new RangedAttribute("attribute.name.sneaking_speed", 0.3, 0.0, 1.0).setSyncable(true) ); /** * Handles the chance for a zombie to summon reinforcements when attacked. */ public static final Holder SPAWN_REINFORCEMENTS_CHANCE = register( - "zombie.spawn_reinforcements", new RangedAttribute("attribute.name.zombie.spawn_reinforcements", 0.0, 0.0, 1.0) + "spawn_reinforcements", new RangedAttribute("attribute.name.spawn_reinforcements", 0.0, 0.0, 1.0) ); public static final Holder STEP_HEIGHT = register( - "generic.step_height", new RangedAttribute("attribute.name.generic.step_height", 0.6, 0.0, 10.0).setSyncable(true) + "step_height", new RangedAttribute("attribute.name.step_height", 0.6, 0.0, 10.0).setSyncable(true) ); public static final Holder SUBMERGED_MINING_SPEED = register( - "player.submerged_mining_speed", new RangedAttribute("attribute.name.player.submerged_mining_speed", 0.2, 0.0, 20.0).setSyncable(true) + "submerged_mining_speed", new RangedAttribute("attribute.name.submerged_mining_speed", 0.2, 0.0, 20.0).setSyncable(true) ); public static final Holder SWEEPING_DAMAGE_RATIO = register( - "player.sweeping_damage_ratio", new RangedAttribute("attribute.name.player.sweeping_damage_ratio", 0.0, 0.0, 1.0).setSyncable(true) + "sweeping_damage_ratio", new RangedAttribute("attribute.name.sweeping_damage_ratio", 0.0, 0.0, 1.0).setSyncable(true) ); + public static final Holder TEMPT_RANGE = register("tempt_range", new RangedAttribute("attribute.name.tempt_range", 10.0, 0.0, 2048.0)); public static final Holder WATER_MOVEMENT_EFFICIENCY = register( - "generic.water_movement_efficiency", new RangedAttribute("attribute.name.generic.water_movement_efficiency", 0.0, 0.0, 1.0).setSyncable(true) + "water_movement_efficiency", new RangedAttribute("attribute.name.water_movement_efficiency", 0.0, 0.0, 1.0).setSyncable(true) ); private static Holder register(String name, Attribute attribute) { diff --git a/net/minecraft/world/entity/ai/attributes/DefaultAttributes.java b/net/minecraft/world/entity/ai/attributes/DefaultAttributes.java index 04ee4b41..9410fb40 100644 --- a/net/minecraft/world/entity/ai/attributes/DefaultAttributes.java +++ b/net/minecraft/world/entity/ai/attributes/DefaultAttributes.java @@ -75,6 +75,7 @@ import net.minecraft.world.entity.monster.Zoglin; import net.minecraft.world.entity.monster.Zombie; import net.minecraft.world.entity.monster.ZombifiedPiglin; import net.minecraft.world.entity.monster.breeze.Breeze; +import net.minecraft.world.entity.monster.creaking.Creaking; import net.minecraft.world.entity.monster.hoglin.Hoglin; import net.minecraft.world.entity.monster.piglin.Piglin; import net.minecraft.world.entity.monster.piglin.PiglinBrute; @@ -166,6 +167,8 @@ public class DefaultAttributes { .put(EntityType.WITHER_SKELETON, AbstractSkeleton.createAttributes().build()) .put(EntityType.WOLF, Wolf.createAttributes().build()) .put(EntityType.ZOGLIN, Zoglin.createAttributes().build()) + .put(EntityType.CREAKING, Creaking.createAttributes().build()) + .put(EntityType.CREAKING_TRANSIENT, Creaking.createAttributes().build()) .put(EntityType.ZOMBIE, Zombie.createAttributes().build()) .put(EntityType.ZOMBIE_HORSE, ZombieHorse.createAttributes().build()) .put(EntityType.ZOMBIE_VILLAGER, Zombie.createAttributes().build()) diff --git a/net/minecraft/world/entity/ai/behavior/CelebrateVillagersSurvivedRaid.java b/net/minecraft/world/entity/ai/behavior/CelebrateVillagersSurvivedRaid.java index 2b1f2383..dca46400 100644 --- a/net/minecraft/world/entity/ai/behavior/CelebrateVillagersSurvivedRaid.java +++ b/net/minecraft/world/entity/ai/behavior/CelebrateVillagersSurvivedRaid.java @@ -10,6 +10,7 @@ import net.minecraft.server.level.ServerLevel; import net.minecraft.util.RandomSource; import net.minecraft.world.entity.npc.Villager; import net.minecraft.world.entity.projectile.FireworkRocketEntity; +import net.minecraft.world.entity.projectile.Projectile; import net.minecraft.world.entity.raid.Raid; import net.minecraft.world.item.DyeColor; import net.minecraft.world.item.ItemStack; @@ -51,8 +52,7 @@ public class CelebrateVillagersSurvivedRaid extends Behavior { DyeColor dyeColor = Util.getRandom(DyeColor.values(), randomSource); int i = randomSource.nextInt(3); ItemStack itemStack = this.getFirework(dyeColor, i); - FireworkRocketEntity fireworkRocketEntity = new FireworkRocketEntity(owner.level(), owner, owner.getX(), owner.getEyeY(), owner.getZ(), itemStack); - owner.level().addFreshEntity(fireworkRocketEntity); + Projectile.spawnProjectile(new FireworkRocketEntity(owner.level(), owner, owner.getX(), owner.getEyeY(), owner.getZ(), itemStack), level, itemStack); } } diff --git a/net/minecraft/world/entity/ai/behavior/GiveGiftToHero.java b/net/minecraft/world/entity/ai/behavior/GiveGiftToHero.java index 0e3e0c58..2c376f28 100644 --- a/net/minecraft/world/entity/ai/behavior/GiveGiftToHero.java +++ b/net/minecraft/world/entity/ai/behavior/GiveGiftToHero.java @@ -1,12 +1,8 @@ package net.minecraft.world.entity.ai.behavior; -import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; -import com.google.common.collect.Maps; -import java.util.List; import java.util.Map; import java.util.Optional; -import net.minecraft.Util; import net.minecraft.core.BlockPos; import net.minecraft.resources.ResourceKey; import net.minecraft.server.level.ServerLevel; @@ -17,36 +13,29 @@ import net.minecraft.world.entity.ai.memory.MemoryStatus; import net.minecraft.world.entity.npc.Villager; import net.minecraft.world.entity.npc.VillagerProfession; import net.minecraft.world.entity.player.Player; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.Items; import net.minecraft.world.level.storage.loot.BuiltInLootTables; -import net.minecraft.world.level.storage.loot.LootParams; import net.minecraft.world.level.storage.loot.LootTable; -import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets; -import net.minecraft.world.level.storage.loot.parameters.LootContextParams; public class GiveGiftToHero extends Behavior { private static final int THROW_GIFT_AT_DISTANCE = 5; private static final int MIN_TIME_BETWEEN_GIFTS = 600; private static final int MAX_TIME_BETWEEN_GIFTS = 6600; private static final int TIME_TO_DELAY_FOR_HEAD_TO_FINISH_TURNING = 20; - private static final Map> GIFTS = Util.make( - Maps.>newHashMap(), hashMap -> { - hashMap.put(VillagerProfession.ARMORER, BuiltInLootTables.ARMORER_GIFT); - hashMap.put(VillagerProfession.BUTCHER, BuiltInLootTables.BUTCHER_GIFT); - hashMap.put(VillagerProfession.CARTOGRAPHER, BuiltInLootTables.CARTOGRAPHER_GIFT); - hashMap.put(VillagerProfession.CLERIC, BuiltInLootTables.CLERIC_GIFT); - hashMap.put(VillagerProfession.FARMER, BuiltInLootTables.FARMER_GIFT); - hashMap.put(VillagerProfession.FISHERMAN, BuiltInLootTables.FISHERMAN_GIFT); - hashMap.put(VillagerProfession.FLETCHER, BuiltInLootTables.FLETCHER_GIFT); - hashMap.put(VillagerProfession.LEATHERWORKER, BuiltInLootTables.LEATHERWORKER_GIFT); - hashMap.put(VillagerProfession.LIBRARIAN, BuiltInLootTables.LIBRARIAN_GIFT); - hashMap.put(VillagerProfession.MASON, BuiltInLootTables.MASON_GIFT); - hashMap.put(VillagerProfession.SHEPHERD, BuiltInLootTables.SHEPHERD_GIFT); - hashMap.put(VillagerProfession.TOOLSMITH, BuiltInLootTables.TOOLSMITH_GIFT); - hashMap.put(VillagerProfession.WEAPONSMITH, BuiltInLootTables.WEAPONSMITH_GIFT); - } - ); + private static final Map> GIFTS = ImmutableMap.>builder() + .put(VillagerProfession.ARMORER, BuiltInLootTables.ARMORER_GIFT) + .put(VillagerProfession.BUTCHER, BuiltInLootTables.BUTCHER_GIFT) + .put(VillagerProfession.CARTOGRAPHER, BuiltInLootTables.CARTOGRAPHER_GIFT) + .put(VillagerProfession.CLERIC, BuiltInLootTables.CLERIC_GIFT) + .put(VillagerProfession.FARMER, BuiltInLootTables.FARMER_GIFT) + .put(VillagerProfession.FISHERMAN, BuiltInLootTables.FISHERMAN_GIFT) + .put(VillagerProfession.FLETCHER, BuiltInLootTables.FLETCHER_GIFT) + .put(VillagerProfession.LEATHERWORKER, BuiltInLootTables.LEATHERWORKER_GIFT) + .put(VillagerProfession.LIBRARIAN, BuiltInLootTables.LIBRARIAN_GIFT) + .put(VillagerProfession.MASON, BuiltInLootTables.MASON_GIFT) + .put(VillagerProfession.SHEPHERD, BuiltInLootTables.SHEPHERD_GIFT) + .put(VillagerProfession.TOOLSMITH, BuiltInLootTables.TOOLSMITH_GIFT) + .put(VillagerProfession.WEAPONSMITH, BuiltInLootTables.WEAPONSMITH_GIFT) + .build(); private static final float SPEED_MODIFIER = 0.5F; private int timeUntilNextGift = 600; private boolean giftGivenDuringThisRun; @@ -96,7 +85,7 @@ public class GiveGiftToHero extends Behavior { BehaviorUtils.lookAtEntity(owner, player); if (this.isWithinThrowingDistance(owner, player)) { if (gameTime - this.timeSinceStart > 20L) { - this.throwGift(owner, player); + this.throwGift(level, owner, player); this.giftGivenDuringThisRun = true; } } else { @@ -111,27 +100,18 @@ public class GiveGiftToHero extends Behavior { entity.getBrain().eraseMemory(MemoryModuleType.LOOK_TARGET); } - private void throwGift(Villager villager, LivingEntity hero) { - for (ItemStack itemStack : this.getItemToThrow(villager)) { - BehaviorUtils.throwItem(villager, itemStack, hero.position()); - } + private void throwGift(ServerLevel serverLevel, Villager villager, LivingEntity livingEntity) { + villager.dropFromGiftLootTable( + serverLevel, getLootTableToThrow(villager), (serverLevelx, itemStack) -> BehaviorUtils.throwItem(villager, itemStack, livingEntity.position()) + ); } - private List getItemToThrow(Villager villager) { + private static ResourceKey getLootTableToThrow(Villager villager) { if (villager.isBaby()) { - return ImmutableList.of(new ItemStack(Items.POPPY)); + return BuiltInLootTables.BABY_VILLAGER_GIFT; } else { VillagerProfession villagerProfession = villager.getVillagerData().getProfession(); - if (GIFTS.containsKey(villagerProfession)) { - LootTable lootTable = villager.level().getServer().reloadableRegistries().getLootTable((ResourceKey)GIFTS.get(villagerProfession)); - LootParams lootParams = new LootParams.Builder((ServerLevel)villager.level()) - .withParameter(LootContextParams.ORIGIN, villager.position()) - .withParameter(LootContextParams.THIS_ENTITY, villager) - .create(LootContextParamSets.GIFT); - return lootTable.getRandomItems(lootParams); - } else { - return ImmutableList.of(new ItemStack(Items.WHEAT_SEEDS)); - } + return (ResourceKey)GIFTS.getOrDefault(villagerProfession, BuiltInLootTables.UNEMPLOYED_GIFT); } } diff --git a/net/minecraft/world/entity/ai/behavior/GoToWantedItem.java b/net/minecraft/world/entity/ai/behavior/GoToWantedItem.java index 2eef4dc9..2ebd5ce9 100644 --- a/net/minecraft/world/entity/ai/behavior/GoToWantedItem.java +++ b/net/minecraft/world/entity/ai/behavior/GoToWantedItem.java @@ -33,7 +33,8 @@ public class GoToWantedItem { if (instance.tryGet(memoryAccessor4).isEmpty() && canWalkToItem.test(livingEntity) && itemEntity.closerThan(livingEntity, maxDistToWalk) - && livingEntity.level().getWorldBorder().isWithinBounds(itemEntity.blockPosition())) { + && livingEntity.level().getWorldBorder().isWithinBounds(itemEntity.blockPosition()) + && livingEntity.canPickUpLoot()) { WalkTarget walkTarget = new WalkTarget(new EntityTracker(itemEntity, false), speedModifier, 0); memoryAccessor.set(new EntityTracker(itemEntity, true)); memoryAccessor2.set(walkTarget); diff --git a/net/minecraft/world/entity/ai/behavior/LongJumpToRandomPos.java b/net/minecraft/world/entity/ai/behavior/LongJumpToRandomPos.java index d7101bbf..5f2db422 100644 --- a/net/minecraft/world/entity/ai/behavior/LongJumpToRandomPos.java +++ b/net/minecraft/world/entity/ai/behavior/LongJumpToRandomPos.java @@ -13,8 +13,8 @@ import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundSource; import net.minecraft.util.Mth; -import net.minecraft.util.random.WeightedEntry; import net.minecraft.util.random.WeightedRandom; +import net.minecraft.util.random.WeightedEntry.IntrusiveBase; import net.minecraft.util.valueproviders.UniformInt; import net.minecraft.world.entity.Mob; import net.minecraft.world.entity.ai.attributes.Attributes; @@ -56,7 +56,7 @@ public class LongJumpToRandomPos extends Behavior { public static boolean defaultAcceptableLandingSpot(E mob, BlockPos pos) { Level level = mob.level(); BlockPos blockPos = pos.below(); - return level.getBlockState(blockPos).isSolidRender(level, blockPos) && mob.getPathfindingMalus(WalkNodeEvaluator.getPathTypeStatic(mob, pos)) == 0.0F; + return level.getBlockState(blockPos).isSolidRender() && mob.getPathfindingMalus(WalkNodeEvaluator.getPathTypeStatic(mob, pos)) == 0.0F; } public LongJumpToRandomPos( @@ -200,7 +200,7 @@ public class LongJumpToRandomPos extends Behavior { return null; } - public static class PossibleJump extends WeightedEntry.IntrusiveBase { + public static class PossibleJump extends IntrusiveBase { private final BlockPos jumpTarget; public PossibleJump(BlockPos jumpTarget, int weight) { diff --git a/net/minecraft/world/entity/ai/behavior/MeleeAttack.java b/net/minecraft/world/entity/ai/behavior/MeleeAttack.java index ada40b36..85d033b7 100644 --- a/net/minecraft/world/entity/ai/behavior/MeleeAttack.java +++ b/net/minecraft/world/entity/ai/behavior/MeleeAttack.java @@ -1,5 +1,6 @@ package net.minecraft.world.entity.ai.behavior; +import java.util.function.Predicate; import net.minecraft.world.InteractionHand; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.Mob; @@ -10,7 +11,11 @@ import net.minecraft.world.item.Item; import net.minecraft.world.item.ProjectileWeaponItem; public class MeleeAttack { - public static OneShot create(int cooldownBetweenAttacks) { + public static OneShot create(int cooldownBetweenAttacks) { + return create(mob -> true, cooldownBetweenAttacks); + } + + public static OneShot create(Predicate predicate, int i) { return BehaviorBuilder.create( instance -> instance.group( instance.registered(MemoryModuleType.LOOK_TARGET), @@ -22,13 +27,14 @@ public class MeleeAttack { instance, (memoryAccessor, memoryAccessor2, memoryAccessor3, memoryAccessor4) -> (serverLevel, mob, l) -> { LivingEntity livingEntity = instance.get(memoryAccessor2); - if (!isHoldingUsableProjectileWeapon(mob) + if (predicate.test(mob) + && !isHoldingUsableProjectileWeapon(mob) && mob.isWithinMeleeAttackRange(livingEntity) && instance.get(memoryAccessor4).contains(livingEntity)) { memoryAccessor.set(new EntityTracker(livingEntity, true)); mob.swing(InteractionHand.MAIN_HAND); - mob.doHurtTarget(livingEntity); - memoryAccessor3.setWithExpiry(true, cooldownBetweenAttacks); + mob.doHurtTarget(serverLevel, livingEntity); + memoryAccessor3.setWithExpiry(true, i); return true; } else { return false; diff --git a/net/minecraft/world/entity/ai/behavior/PrepareRamNearestTarget.java b/net/minecraft/world/entity/ai/behavior/PrepareRamNearestTarget.java index 6a082455..5d3dc459 100644 --- a/net/minecraft/world/entity/ai/behavior/PrepareRamNearestTarget.java +++ b/net/minecraft/world/entity/ai/behavior/PrepareRamNearestTarget.java @@ -71,7 +71,7 @@ public class PrepareRamNearestTarget extends Behavior brain = entity.getBrain(); brain.getMemory(MemoryModuleType.NEAREST_VISIBLE_LIVING_ENTITIES) - .flatMap(nearestVisibleLivingEntities -> nearestVisibleLivingEntities.findClosest(livingEntity -> this.ramTargeting.test(entity, livingEntity))) + .flatMap(nearestVisibleLivingEntities -> nearestVisibleLivingEntities.findClosest(livingEntity -> this.ramTargeting.test(level, entity, livingEntity))) .ifPresent(livingEntity -> this.chooseRamPosition(entity, livingEntity)); } diff --git a/net/minecraft/world/entity/ai/behavior/RamTarget.java b/net/minecraft/world/entity/ai/behavior/RamTarget.java index 72902097..e07956cf 100644 --- a/net/minecraft/world/entity/ai/behavior/RamTarget.java +++ b/net/minecraft/world/entity/ai/behavior/RamTarget.java @@ -77,7 +77,7 @@ public class RamTarget extends Behavior { if (!list.isEmpty()) { LivingEntity livingEntity = (LivingEntity)list.get(0); DamageSource damageSource = level.damageSources().noAggroMobAttack(owner); - if (livingEntity.hurt(damageSource, (float)owner.getAttributeValue(Attributes.ATTACK_DAMAGE))) { + if (livingEntity.hurtServer(level, damageSource, (float)owner.getAttributeValue(Attributes.ATTACK_DAMAGE))) { EnchantmentHelper.doPostAttackEffects(level, livingEntity, damageSource); } diff --git a/net/minecraft/world/entity/ai/behavior/StartAttacking.java b/net/minecraft/world/entity/ai/behavior/StartAttacking.java index ad35be4f..e79565d6 100644 --- a/net/minecraft/world/entity/ai/behavior/StartAttacking.java +++ b/net/minecraft/world/entity/ai/behavior/StartAttacking.java @@ -1,26 +1,27 @@ package net.minecraft.world.entity.ai.behavior; import java.util.Optional; -import java.util.function.Function; -import java.util.function.Predicate; +import net.minecraft.server.level.ServerLevel; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.Mob; import net.minecraft.world.entity.ai.behavior.declarative.BehaviorBuilder; import net.minecraft.world.entity.ai.memory.MemoryModuleType; public class StartAttacking { - public static BehaviorControl create(Function> targetFinder) { - return create(mob -> true, targetFinder); + public static BehaviorControl create(StartAttacking.TargetFinder targetFinder) { + return create((serverLevel, mob) -> true, targetFinder); } - public static BehaviorControl create(Predicate canAttack, Function> targetFinder) { + public static BehaviorControl create( + StartAttacking.StartAttackingCondition startAttackingCondition, StartAttacking.TargetFinder targetFinder + ) { return BehaviorBuilder.create( instance -> instance.group(instance.absent(MemoryModuleType.ATTACK_TARGET), instance.registered(MemoryModuleType.CANT_REACH_WALK_TARGET_SINCE)) .apply(instance, (memoryAccessor, memoryAccessor2) -> (serverLevel, mob, l) -> { - if (!canAttack.test(mob)) { + if (!startAttackingCondition.test(serverLevel, (E)mob)) { return false; } else { - Optional optional = (Optional)targetFinder.apply(mob); + Optional optional = targetFinder.get(serverLevel, (E)mob); if (optional.isEmpty()) { return false; } else { @@ -37,4 +38,14 @@ public class StartAttacking { }) ); } + + @FunctionalInterface + public interface StartAttackingCondition { + boolean test(ServerLevel serverLevel, E object); + } + + @FunctionalInterface + public interface TargetFinder { + Optional get(ServerLevel serverLevel, E object); + } } diff --git a/net/minecraft/world/entity/ai/behavior/StopAttackingIfTargetInvalid.java b/net/minecraft/world/entity/ai/behavior/StopAttackingIfTargetInvalid.java index bbe7588b..c9818452 100644 --- a/net/minecraft/world/entity/ai/behavior/StopAttackingIfTargetInvalid.java +++ b/net/minecraft/world/entity/ai/behavior/StopAttackingIfTargetInvalid.java @@ -1,8 +1,7 @@ package net.minecraft.world.entity.ai.behavior; import java.util.Optional; -import java.util.function.BiConsumer; -import java.util.function.Predicate; +import net.minecraft.server.level.ServerLevel; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.Mob; import net.minecraft.world.entity.ai.behavior.declarative.BehaviorBuilder; @@ -11,20 +10,20 @@ import net.minecraft.world.entity.ai.memory.MemoryModuleType; public class StopAttackingIfTargetInvalid { private static final int TIMEOUT_TO_GET_WITHIN_ATTACK_RANGE = 200; - public static BehaviorControl create(BiConsumer onStopAttacking) { - return create(livingEntity -> false, onStopAttacking, true); + public static BehaviorControl create(StopAttackingIfTargetInvalid.TargetErasedCallback targetErasedCallback) { + return create((serverLevel, livingEntity) -> false, targetErasedCallback, true); } - public static BehaviorControl create(Predicate canStopAttacking) { - return create(canStopAttacking, (mob, livingEntity) -> {}, true); + public static BehaviorControl create(StopAttackingIfTargetInvalid.StopAttackCondition stopAttackCondition) { + return create(stopAttackCondition, (serverLevel, mob, livingEntity) -> {}, true); } public static BehaviorControl create() { - return create(livingEntity -> false, (mob, livingEntity) -> {}, true); + return create((serverLevel, livingEntity) -> false, (serverLevel, mob, livingEntity) -> {}, true); } public static BehaviorControl create( - Predicate canStopAttacking, BiConsumer onStopAttacking, boolean canGrowTiredOfTryingToReachTarget + StopAttackingIfTargetInvalid.StopAttackCondition stopAttackCondition, StopAttackingIfTargetInvalid.TargetErasedCallback targetErasedCallback, boolean bl ) { return BehaviorBuilder.create( instance -> instance.group(instance.present(MemoryModuleType.ATTACK_TARGET), instance.registered(MemoryModuleType.CANT_REACH_WALK_TARGET_SINCE)) @@ -33,13 +32,13 @@ public class StopAttackingIfTargetInvalid { (memoryAccessor, memoryAccessor2) -> (serverLevel, mob, l) -> { LivingEntity livingEntity = instance.get(memoryAccessor); if (mob.canAttack(livingEntity) - && (!canGrowTiredOfTryingToReachTarget || !isTiredOfTryingToReachTarget(mob, instance.tryGet(memoryAccessor2))) + && (!bl || !isTiredOfTryingToReachTarget(mob, instance.tryGet(memoryAccessor2))) && livingEntity.isAlive() && livingEntity.level() == mob.level() - && !canStopAttacking.test(livingEntity)) { + && !stopAttackCondition.test(serverLevel, livingEntity)) { return true; } else { - onStopAttacking.accept(mob, livingEntity); + targetErasedCallback.accept(serverLevel, (E)mob, livingEntity); memoryAccessor.erase(); return true; } @@ -51,4 +50,14 @@ public class StopAttackingIfTargetInvalid { private static boolean isTiredOfTryingToReachTarget(LivingEntity entity, Optional timeSinceInvalidTarget) { return timeSinceInvalidTarget.isPresent() && entity.level().getGameTime() - (Long)timeSinceInvalidTarget.get() > 200L; } + + @FunctionalInterface + public interface StopAttackCondition { + boolean test(ServerLevel serverLevel, LivingEntity livingEntity); + } + + @FunctionalInterface + public interface TargetErasedCallback { + void accept(ServerLevel serverLevel, E object, LivingEntity livingEntity); + } } diff --git a/net/minecraft/world/entity/ai/behavior/Swim.java b/net/minecraft/world/entity/ai/behavior/Swim.java index d98d0299..5fe8eef6 100644 --- a/net/minecraft/world/entity/ai/behavior/Swim.java +++ b/net/minecraft/world/entity/ai/behavior/Swim.java @@ -5,7 +5,7 @@ import net.minecraft.server.level.ServerLevel; import net.minecraft.tags.FluidTags; import net.minecraft.world.entity.Mob; -public class Swim extends Behavior { +public class Swim extends Behavior { private final float chance; public Swim(float chance) { @@ -13,7 +13,7 @@ public class Swim extends Behavior { this.chance = chance; } - public static boolean shouldSwim(Mob mob) { + public static boolean shouldSwim(T mob) { return mob.isInWater() && mob.getFluidHeight(FluidTags.WATER) > mob.getFluidJumpThreshold() || mob.isInLava(); } diff --git a/net/minecraft/world/entity/ai/behavior/WorkAtComposter.java b/net/minecraft/world/entity/ai/behavior/WorkAtComposter.java index 2052c231..87270545 100644 --- a/net/minecraft/world/entity/ai/behavior/WorkAtComposter.java +++ b/net/minecraft/world/entity/ai/behavior/WorkAtComposter.java @@ -26,7 +26,7 @@ public class WorkAtComposter extends WorkAtPoi { GlobalPos globalPos = (GlobalPos)optional.get(); BlockState blockState = level.getBlockState(globalPos.pos()); if (blockState.is(Blocks.COMPOSTER)) { - this.makeBread(villager); + this.makeBread(level, villager); this.compostItems(level, villager, globalPos, blockState); } } @@ -74,7 +74,7 @@ public class WorkAtComposter extends WorkAtPoi { level.levelEvent(1500, pos, postState != preState ? 1 : 0); } - private void makeBread(Villager villager) { + private void makeBread(ServerLevel serverLevel, Villager villager) { SimpleContainer simpleContainer = villager.getInventory(); if (simpleContainer.countItem(Items.BREAD) <= 36) { int i = simpleContainer.countItem(Items.WHEAT); @@ -86,7 +86,7 @@ public class WorkAtComposter extends WorkAtPoi { simpleContainer.removeItemType(Items.WHEAT, m); ItemStack itemStack = simpleContainer.addItem(new ItemStack(Items.BREAD, l)); if (!itemStack.isEmpty()) { - villager.spawnAtLocation(itemStack, 0.5F); + villager.spawnAtLocation(serverLevel, itemStack, 0.5F); } } } diff --git a/net/minecraft/world/entity/ai/behavior/warden/SonicBoom.java b/net/minecraft/world/entity/ai/behavior/warden/SonicBoom.java index d8a05c7a..d214e6d4 100644 --- a/net/minecraft/world/entity/ai/behavior/warden/SonicBoom.java +++ b/net/minecraft/world/entity/ai/behavior/warden/SonicBoom.java @@ -78,7 +78,7 @@ public class SonicBoom extends Behavior { } owner.playSound(SoundEvents.WARDEN_SONIC_BOOM, 3.0F, 1.0F); - if (livingEntity.hurt(level.damageSources().sonicBoom(owner), 10.0F)) { + if (livingEntity.hurtServer(level, level.damageSources().sonicBoom(owner), 10.0F)) { double d = 0.5 * (1.0 - livingEntity.getAttributeValue(Attributes.KNOCKBACK_RESISTANCE)); double e = 2.5 * (1.0 - livingEntity.getAttributeValue(Attributes.KNOCKBACK_RESISTANCE)); livingEntity.push(vec33.x() * e, vec33.y() * d, vec33.z() * e); diff --git a/net/minecraft/world/entity/ai/control/Control.java b/net/minecraft/world/entity/ai/control/Control.java index ecf29519..49b686ea 100644 --- a/net/minecraft/world/entity/ai/control/Control.java +++ b/net/minecraft/world/entity/ai/control/Control.java @@ -1,4 +1,11 @@ package net.minecraft.world.entity.ai.control; +import net.minecraft.util.Mth; + public interface Control { + default float rotateTowards(float f, float g, float h) { + float i = Mth.degreesDifference(f, g); + float j = Mth.clamp(i, -h, h); + return f + j; + } } diff --git a/net/minecraft/world/entity/ai/control/LookControl.java b/net/minecraft/world/entity/ai/control/LookControl.java index 15125ced..3a2900a3 100644 --- a/net/minecraft/world/entity/ai/control/LookControl.java +++ b/net/minecraft/world/entity/ai/control/LookControl.java @@ -116,15 +116,6 @@ public class LookControl implements Control { return !(Math.abs(e) > 1.0E-5F) && !(Math.abs(d) > 1.0E-5F) ? Optional.empty() : Optional.of((float)(Mth.atan2(e, d) * 180.0F / (float)Math.PI) - 90.0F); } - /** - * Rotate as much as possible from {@code from} to {@code to} within the bounds of {@code maxDelta} - */ - protected float rotateTowards(float from, float to, float maxDelta) { - float f = Mth.degreesDifference(from, to); - float g = Mth.clamp(f, -maxDelta, maxDelta); - return from + g; - } - private static double getWantedY(Entity entity) { return entity instanceof LivingEntity ? entity.getEyeY() : (entity.getBoundingBox().minY + entity.getBoundingBox().maxY) / 2.0; } diff --git a/net/minecraft/world/entity/ai/control/SmoothSwimmingMoveControl.java b/net/minecraft/world/entity/ai/control/SmoothSwimmingMoveControl.java index e436d85a..e5dc8ae8 100644 --- a/net/minecraft/world/entity/ai/control/SmoothSwimmingMoveControl.java +++ b/net/minecraft/world/entity/ai/control/SmoothSwimmingMoveControl.java @@ -47,7 +47,7 @@ public class SmoothSwimmingMoveControl extends MoveControl { if (Math.abs(e) > 1.0E-5F || Math.abs(j) > 1.0E-5F) { float k = -((float)(Mth.atan2(e, j) * 180.0F / (float)Math.PI)); k = Mth.clamp(Mth.wrapDegrees(k), (float)(-this.maxTurnX), (float)this.maxTurnX); - this.mob.setXRot(this.rotlerp(this.mob.getXRot(), k, 5.0F)); + this.mob.setXRot(this.rotateTowards(this.mob.getXRot(), k, 5.0F)); } float k = Mth.cos(this.mob.getXRot() * (float) (Math.PI / 180.0)); diff --git a/net/minecraft/world/entity/ai/goal/AvoidEntityGoal.java b/net/minecraft/world/entity/ai/goal/AvoidEntityGoal.java index d0ffe175..9106ae81 100644 --- a/net/minecraft/world/entity/ai/goal/AvoidEntityGoal.java +++ b/net/minecraft/world/entity/ai/goal/AvoidEntityGoal.java @@ -55,7 +55,9 @@ public class AvoidEntityGoal extends Goal { this.predicateOnAvoidEntity = predicateOnAvoidEntity; this.pathNav = mob.getNavigation(); this.setFlags(EnumSet.of(Goal.Flag.MOVE)); - this.avoidEntityTargeting = TargetingConditions.forCombat().range(maxDistance).selector(predicateOnAvoidEntity.and(avoidPredicate)); + this.avoidEntityTargeting = TargetingConditions.forCombat() + .range(maxDistance) + .selector((livingEntity, serverLevel) -> predicateOnAvoidEntity.test(livingEntity) && avoidPredicate.test(livingEntity)); } public AvoidEntityGoal( @@ -71,8 +73,7 @@ public class AvoidEntityGoal extends Goal { @Override public boolean canUse() { - this.toAvoid = this.mob - .level() + this.toAvoid = getServerLevel(this.mob) .getNearestEntity( this.mob.level().getEntitiesOfClass(this.avoidClass, this.mob.getBoundingBox().inflate(this.maxDist, 3.0, this.maxDist), livingEntity -> true), this.avoidEntityTargeting, diff --git a/net/minecraft/world/entity/ai/goal/BegGoal.java b/net/minecraft/world/entity/ai/goal/BegGoal.java index ad214d67..a4a5f3a3 100644 --- a/net/minecraft/world/entity/ai/goal/BegGoal.java +++ b/net/minecraft/world/entity/ai/goal/BegGoal.java @@ -1,27 +1,27 @@ package net.minecraft.world.entity.ai.goal; import java.util.EnumSet; +import net.minecraft.server.level.ServerLevel; import net.minecraft.world.InteractionHand; import net.minecraft.world.entity.ai.targeting.TargetingConditions; import net.minecraft.world.entity.animal.Wolf; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; -import net.minecraft.world.level.Level; import org.jetbrains.annotations.Nullable; public class BegGoal extends Goal { private final Wolf wolf; @Nullable private Player player; - private final Level level; + private final ServerLevel level; private final float lookDistance; private int lookTime; private final TargetingConditions begTargeting; public BegGoal(Wolf wolf, float lookDistance) { this.wolf = wolf; - this.level = wolf.level(); + this.level = getServerLevel(wolf); this.lookDistance = lookDistance; this.begTargeting = TargetingConditions.forNonCombat().range(lookDistance); this.setFlags(EnumSet.of(Goal.Flag.LOOK)); diff --git a/net/minecraft/world/entity/ai/goal/BreakDoorGoal.java b/net/minecraft/world/entity/ai/goal/BreakDoorGoal.java index a4381bf4..83b887d3 100644 --- a/net/minecraft/world/entity/ai/goal/BreakDoorGoal.java +++ b/net/minecraft/world/entity/ai/goal/BreakDoorGoal.java @@ -32,7 +32,7 @@ public class BreakDoorGoal extends DoorInteractGoal { if (!super.canUse()) { return false; } else { - return !this.mob.level().getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) + return !getServerLevel(this.mob).getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) ? false : this.isValidDifficulty(this.mob.level().getDifficulty()) && !this.isOpen(); } diff --git a/net/minecraft/world/entity/ai/goal/BreedGoal.java b/net/minecraft/world/entity/ai/goal/BreedGoal.java index 76687854..405a8352 100644 --- a/net/minecraft/world/entity/ai/goal/BreedGoal.java +++ b/net/minecraft/world/entity/ai/goal/BreedGoal.java @@ -5,14 +5,13 @@ import java.util.List; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.entity.ai.targeting.TargetingConditions; import net.minecraft.world.entity.animal.Animal; -import net.minecraft.world.level.Level; import org.jetbrains.annotations.Nullable; public class BreedGoal extends Goal { private static final TargetingConditions PARTNER_TARGETING = TargetingConditions.forNonCombat().range(8.0).ignoreLineOfSight(); protected final Animal animal; private final Class partnerClass; - protected final Level level; + protected final ServerLevel level; @Nullable protected Animal partner; private int loveTime; @@ -24,7 +23,7 @@ public class BreedGoal extends Goal { public BreedGoal(Animal animal, double speedModifier, Class partnerClass) { this.animal = animal; - this.level = animal.level(); + this.level = getServerLevel(animal); this.partnerClass = partnerClass; this.speedModifier = speedModifier; this.setFlags(EnumSet.of(Goal.Flag.MOVE, Goal.Flag.LOOK)); @@ -84,6 +83,6 @@ public class BreedGoal extends Goal { * Spawns a baby animal of the same type. */ protected void breed() { - this.animal.spawnChildFromBreeding((ServerLevel)this.level, this.partner); + this.animal.spawnChildFromBreeding(this.level, this.partner); } } diff --git a/net/minecraft/world/entity/ai/goal/EatBlockGoal.java b/net/minecraft/world/entity/ai/goal/EatBlockGoal.java index 023e5c3f..25787949 100644 --- a/net/minecraft/world/entity/ai/goal/EatBlockGoal.java +++ b/net/minecraft/world/entity/ai/goal/EatBlockGoal.java @@ -73,7 +73,7 @@ public class EatBlockGoal extends Goal { if (this.eatAnimationTick == this.adjustedTickDelay(4)) { BlockPos blockPos = this.mob.blockPosition(); if (IS_TALL_GRASS.test(this.level.getBlockState(blockPos))) { - if (this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { + if (getServerLevel(this.level).getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { this.level.destroyBlock(blockPos, false); } @@ -81,7 +81,7 @@ public class EatBlockGoal extends Goal { } else { BlockPos blockPos2 = blockPos.below(); if (this.level.getBlockState(blockPos2).is(Blocks.GRASS_BLOCK)) { - if (this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { + if (getServerLevel(this.level).getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { this.level.levelEvent(2001, blockPos2, Block.getId(Blocks.GRASS_BLOCK.defaultBlockState())); this.level.setBlock(blockPos2, Blocks.DIRT.defaultBlockState(), 2); } diff --git a/net/minecraft/world/entity/ai/goal/FollowBoatGoal.java b/net/minecraft/world/entity/ai/goal/FollowBoatGoal.java index 68c54fd0..c15a36cb 100644 --- a/net/minecraft/world/entity/ai/goal/FollowBoatGoal.java +++ b/net/minecraft/world/entity/ai/goal/FollowBoatGoal.java @@ -8,7 +8,7 @@ import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.MoverType; import net.minecraft.world.entity.PathfinderMob; import net.minecraft.world.entity.player.Player; -import net.minecraft.world.entity.vehicle.Boat; +import net.minecraft.world.entity.vehicle.AbstractBoat; import net.minecraft.world.phys.Vec3; import org.jetbrains.annotations.Nullable; @@ -25,11 +25,11 @@ public class FollowBoatGoal extends Goal { @Override public boolean canUse() { - List list = this.mob.level().getEntitiesOfClass(Boat.class, this.mob.getBoundingBox().inflate(5.0)); + List list = this.mob.level().getEntitiesOfClass(AbstractBoat.class, this.mob.getBoundingBox().inflate(5.0)); boolean bl = false; - for (Boat boat : list) { - Entity entity = boat.getControllingPassenger(); + for (AbstractBoat abstractBoat : list) { + Entity entity = abstractBoat.getControllingPassenger(); if (entity instanceof Player && (Mth.abs(((Player)entity).xxa) > 0.0F || Mth.abs(((Player)entity).zza) > 0.0F)) { bl = true; break; @@ -51,8 +51,8 @@ public class FollowBoatGoal extends Goal { @Override public void start() { - for (Boat boat : this.mob.level().getEntitiesOfClass(Boat.class, this.mob.getBoundingBox().inflate(5.0))) { - if (boat.getControllingPassenger() instanceof Player player) { + for (AbstractBoat abstractBoat : this.mob.level().getEntitiesOfClass(AbstractBoat.class, this.mob.getBoundingBox().inflate(5.0))) { + if (abstractBoat.getControllingPassenger() instanceof Player player) { this.following = player; break; } diff --git a/net/minecraft/world/entity/ai/goal/Goal.java b/net/minecraft/world/entity/ai/goal/Goal.java index 47c4213a..a7f80f9d 100644 --- a/net/minecraft/world/entity/ai/goal/Goal.java +++ b/net/minecraft/world/entity/ai/goal/Goal.java @@ -1,7 +1,10 @@ package net.minecraft.world.entity.ai.goal; import java.util.EnumSet; +import net.minecraft.server.level.ServerLevel; import net.minecraft.util.Mth; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.level.Level; public abstract class Goal { private final EnumSet flags = EnumSet.noneOf(Goal.Flag.class); @@ -65,6 +68,14 @@ public abstract class Goal { return Mth.positiveCeilDiv(reduction, 2); } + protected static ServerLevel getServerLevel(Entity entity) { + return (ServerLevel)entity.level(); + } + + protected static ServerLevel getServerLevel(Level level) { + return (ServerLevel)level; + } + public static enum Flag { MOVE, LOOK, diff --git a/net/minecraft/world/entity/ai/goal/GoalSelector.java b/net/minecraft/world/entity/ai/goal/GoalSelector.java index 8b766018..32cb9169 100644 --- a/net/minecraft/world/entity/ai/goal/GoalSelector.java +++ b/net/minecraft/world/entity/ai/goal/GoalSelector.java @@ -7,7 +7,7 @@ import java.util.EnumSet; import java.util.Map; import java.util.Set; import java.util.function.Predicate; -import java.util.function.Supplier; +import net.minecraft.util.profiling.Profiler; import net.minecraft.util.profiling.ProfilerFiller; public class GoalSelector { @@ -27,13 +27,8 @@ public class GoalSelector { */ private final Map lockedFlags = new EnumMap(Goal.Flag.class); private final Set availableGoals = new ObjectLinkedOpenHashSet<>(); - private final Supplier profiler; private final EnumSet disabledFlags = EnumSet.noneOf(Goal.Flag.class); - public GoalSelector(Supplier profiler) { - this.profiler = profiler; - } - /** * Add a goal to the GoalSelector with a certain priority. Lower numbers are higher priority. */ @@ -84,7 +79,7 @@ public class GoalSelector { * Attempts to start each goal based on if it can be used, or stop it if it can't. */ public void tick() { - ProfilerFiller profilerFiller = (ProfilerFiller)this.profiler.get(); + ProfilerFiller profilerFiller = Profiler.get(); profilerFiller.push("goalCleanup"); for (WrappedGoal wrappedGoal : this.availableGoals) { @@ -117,7 +112,7 @@ public class GoalSelector { } public void tickRunningGoals(boolean tickAllRunning) { - ProfilerFiller profilerFiller = (ProfilerFiller)this.profiler.get(); + ProfilerFiller profilerFiller = Profiler.get(); profilerFiller.push("goalTick"); for (WrappedGoal wrappedGoal : this.availableGoals) { diff --git a/net/minecraft/world/entity/ai/goal/LookAtPlayerGoal.java b/net/minecraft/world/entity/ai/goal/LookAtPlayerGoal.java index 836e1d09..d1b1cb2e 100644 --- a/net/minecraft/world/entity/ai/goal/LookAtPlayerGoal.java +++ b/net/minecraft/world/entity/ai/goal/LookAtPlayerGoal.java @@ -1,6 +1,8 @@ package net.minecraft.world.entity.ai.goal; import java.util.EnumSet; +import java.util.function.Predicate; +import net.minecraft.server.level.ServerLevel; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntitySelector; import net.minecraft.world.entity.LivingEntity; @@ -37,7 +39,8 @@ public class LookAtPlayerGoal extends Goal { this.onlyHorizontal = onlyHorizontal; this.setFlags(EnumSet.of(Goal.Flag.LOOK)); if (lookAtType == Player.class) { - this.lookAtContext = TargetingConditions.forNonCombat().range(lookDistance).selector(livingEntity -> EntitySelector.notRiding(mob).test(livingEntity)); + Predicate predicate = EntitySelector.notRiding(mob); + this.lookAtContext = TargetingConditions.forNonCombat().range(lookDistance).selector((livingEntity, serverLevel) -> predicate.test(livingEntity)); } else { this.lookAtContext = TargetingConditions.forNonCombat().range(lookDistance); } @@ -52,19 +55,18 @@ public class LookAtPlayerGoal extends Goal { this.lookAt = this.mob.getTarget(); } + ServerLevel serverLevel = getServerLevel(this.mob); if (this.lookAtType == Player.class) { - this.lookAt = this.mob.level().getNearestPlayer(this.lookAtContext, this.mob, this.mob.getX(), this.mob.getEyeY(), this.mob.getZ()); + this.lookAt = serverLevel.getNearestPlayer(this.lookAtContext, this.mob, this.mob.getX(), this.mob.getEyeY(), this.mob.getZ()); } else { - this.lookAt = this.mob - .level() - .getNearestEntity( - this.mob.level().getEntitiesOfClass(this.lookAtType, this.mob.getBoundingBox().inflate(this.lookDistance, 3.0, this.lookDistance), livingEntity -> true), - this.lookAtContext, - this.mob, - this.mob.getX(), - this.mob.getEyeY(), - this.mob.getZ() - ); + this.lookAt = serverLevel.getNearestEntity( + this.mob.level().getEntitiesOfClass(this.lookAtType, this.mob.getBoundingBox().inflate(this.lookDistance, 3.0, this.lookDistance), livingEntity -> true), + this.lookAtContext, + this.mob, + this.mob.getX(), + this.mob.getEyeY(), + this.mob.getZ() + ); } return this.lookAt != null; diff --git a/net/minecraft/world/entity/ai/goal/MeleeAttackGoal.java b/net/minecraft/world/entity/ai/goal/MeleeAttackGoal.java index 60704b49..01e2c459 100644 --- a/net/minecraft/world/entity/ai/goal/MeleeAttackGoal.java +++ b/net/minecraft/world/entity/ai/goal/MeleeAttackGoal.java @@ -128,7 +128,7 @@ public class MeleeAttackGoal extends Goal { if (this.canPerformAttack(target)) { this.resetAttackCooldown(); this.mob.swing(InteractionHand.MAIN_HAND); - this.mob.doHurtTarget(target); + this.mob.doHurtTarget(getServerLevel(this.mob), target); } } diff --git a/net/minecraft/world/entity/ai/goal/OcelotAttackGoal.java b/net/minecraft/world/entity/ai/goal/OcelotAttackGoal.java index 74ff7d71..7840622f 100644 --- a/net/minecraft/world/entity/ai/goal/OcelotAttackGoal.java +++ b/net/minecraft/world/entity/ai/goal/OcelotAttackGoal.java @@ -62,7 +62,7 @@ public class OcelotAttackGoal extends Goal { if (!(e > d)) { if (this.attackTime <= 0) { this.attackTime = 20; - this.mob.doHurtTarget(this.target); + this.mob.doHurtTarget(getServerLevel(this.mob), this.target); } } } diff --git a/net/minecraft/world/entity/ai/goal/OfferFlowerGoal.java b/net/minecraft/world/entity/ai/goal/OfferFlowerGoal.java index b2813814..d1897945 100644 --- a/net/minecraft/world/entity/ai/goal/OfferFlowerGoal.java +++ b/net/minecraft/world/entity/ai/goal/OfferFlowerGoal.java @@ -24,8 +24,7 @@ public class OfferFlowerGoal extends Goal { } else if (this.golem.getRandom().nextInt(8000) != 0) { return false; } else { - this.villager = this.golem - .level() + this.villager = getServerLevel(this.golem) .getNearestEntity( Villager.class, OFFER_TARGER_CONTEXT, diff --git a/net/minecraft/world/entity/ai/goal/RemoveBlockGoal.java b/net/minecraft/world/entity/ai/goal/RemoveBlockGoal.java index c4baf63b..09d65867 100644 --- a/net/minecraft/world/entity/ai/goal/RemoveBlockGoal.java +++ b/net/minecraft/world/entity/ai/goal/RemoveBlockGoal.java @@ -35,7 +35,7 @@ public class RemoveBlockGoal extends MoveToBlockGoal { @Override public boolean canUse() { - if (!this.removerMob.level().getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { + if (!getServerLevel(this.removerMob).getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { return false; } else if (this.nextStartTick > 0) { this.nextStartTick--; diff --git a/net/minecraft/world/entity/ai/goal/TemptGoal.java b/net/minecraft/world/entity/ai/goal/TemptGoal.java index e6827c52..e1a2ef4a 100644 --- a/net/minecraft/world/entity/ai/goal/TemptGoal.java +++ b/net/minecraft/world/entity/ai/goal/TemptGoal.java @@ -4,13 +4,14 @@ import java.util.EnumSet; import java.util.function.Predicate; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.PathfinderMob; +import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.entity.ai.targeting.TargetingConditions; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; import org.jetbrains.annotations.Nullable; public class TemptGoal extends Goal { - private static final TargetingConditions TEMP_TARGETING = TargetingConditions.forNonCombat().range(10.0).ignoreLineOfSight(); + private static final TargetingConditions TEMPT_TARGETING = TargetingConditions.forNonCombat().ignoreLineOfSight(); private final TargetingConditions targetingConditions; protected final PathfinderMob mob; private final double speedModifier; @@ -32,7 +33,7 @@ public class TemptGoal extends Goal { this.items = items; this.canScare = canScare; this.setFlags(EnumSet.of(Goal.Flag.MOVE, Goal.Flag.LOOK)); - this.targetingConditions = TEMP_TARGETING.copy().selector(this::shouldFollow); + this.targetingConditions = TEMPT_TARGETING.copy().selector((livingEntity, serverLevel) -> this.shouldFollow(livingEntity)); } @Override @@ -41,7 +42,7 @@ public class TemptGoal extends Goal { this.calmDown--; return false; } else { - this.player = this.mob.level().getNearestPlayer(this.targetingConditions, this.mob); + this.player = getServerLevel(this.mob).getNearestPlayer(this.targetingConditions.range(this.mob.getAttributeValue(Attributes.TEMPT_RANGE)), this.mob); return this.player != null; } } diff --git a/net/minecraft/world/entity/ai/goal/target/DefendVillageTargetGoal.java b/net/minecraft/world/entity/ai/goal/target/DefendVillageTargetGoal.java index 7d249cbc..0d758141 100644 --- a/net/minecraft/world/entity/ai/goal/target/DefendVillageTargetGoal.java +++ b/net/minecraft/world/entity/ai/goal/target/DefendVillageTargetGoal.java @@ -2,6 +2,7 @@ package net.minecraft.world.entity.ai.goal.target; import java.util.EnumSet; import java.util.List; +import net.minecraft.server.level.ServerLevel; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.ai.goal.Goal; import net.minecraft.world.entity.ai.targeting.TargetingConditions; @@ -26,8 +27,9 @@ public class DefendVillageTargetGoal extends TargetGoal { @Override public boolean canUse() { AABB aABB = this.golem.getBoundingBox().inflate(10.0, 8.0, 10.0); - List list = this.golem.level().getNearbyEntities(Villager.class, this.attackTargeting, this.golem, aABB); - List list2 = this.golem.level().getNearbyPlayers(this.attackTargeting, this.golem, aABB); + ServerLevel serverLevel = getServerLevel(this.golem); + List list = serverLevel.getNearbyEntities(Villager.class, this.attackTargeting, this.golem, aABB); + List list2 = serverLevel.getNearbyPlayers(this.attackTargeting, this.golem, aABB); for (LivingEntity livingEntity : list) { Villager villager = (Villager)livingEntity; diff --git a/net/minecraft/world/entity/ai/goal/target/HurtByTargetGoal.java b/net/minecraft/world/entity/ai/goal/target/HurtByTargetGoal.java index cb50a586..ee23f37d 100644 --- a/net/minecraft/world/entity/ai/goal/target/HurtByTargetGoal.java +++ b/net/minecraft/world/entity/ai/goal/target/HurtByTargetGoal.java @@ -38,7 +38,7 @@ public class HurtByTargetGoal extends TargetGoal { int i = this.mob.getLastHurtByMobTimestamp(); LivingEntity livingEntity = this.mob.getLastHurtByMob(); if (i != this.timestamp && livingEntity != null) { - if (livingEntity.getType() == EntityType.PLAYER && this.mob.level().getGameRules().getBoolean(GameRules.RULE_UNIVERSAL_ANGER)) { + if (livingEntity.getType() == EntityType.PLAYER && getServerLevel(this.mob).getGameRules().getBoolean(GameRules.RULE_UNIVERSAL_ANGER)) { return false; } else { for (Class class_ : this.toIgnoreDamage) { diff --git a/net/minecraft/world/entity/ai/goal/target/NearestAttackableTargetGoal.java b/net/minecraft/world/entity/ai/goal/target/NearestAttackableTargetGoal.java index e08b6e07..d48de988 100644 --- a/net/minecraft/world/entity/ai/goal/target/NearestAttackableTargetGoal.java +++ b/net/minecraft/world/entity/ai/goal/target/NearestAttackableTargetGoal.java @@ -1,7 +1,7 @@ package net.minecraft.world.entity.ai.goal.target; import java.util.EnumSet; -import java.util.function.Predicate; +import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.Mob; @@ -26,22 +26,20 @@ public class NearestAttackableTargetGoal extends TargetG this(mob, targetType, 10, mustSee, false, null); } - public NearestAttackableTargetGoal(Mob mob, Class targetType, boolean mustSee, Predicate targetPredicate) { - this(mob, targetType, 10, mustSee, false, targetPredicate); + public NearestAttackableTargetGoal(Mob mob, Class class_, boolean bl, TargetingConditions.Selector selector) { + this(mob, class_, 10, bl, false, selector); } public NearestAttackableTargetGoal(Mob mob, Class targetType, boolean mustSee, boolean mustReach) { this(mob, targetType, 10, mustSee, mustReach, null); } - public NearestAttackableTargetGoal( - Mob mob, Class targetType, int randomInterval, boolean mustSee, boolean mustReach, @Nullable Predicate targetPredicate - ) { - super(mob, mustSee, mustReach); - this.targetType = targetType; - this.randomInterval = reducedTickDelay(randomInterval); + public NearestAttackableTargetGoal(Mob mob, Class class_, int i, boolean bl, boolean bl2, @Nullable TargetingConditions.Selector selector) { + super(mob, bl, bl2); + this.targetType = class_; + this.randomInterval = reducedTickDelay(i); this.setFlags(EnumSet.of(Goal.Flag.TARGET)); - this.targetConditions = TargetingConditions.forCombat().range(this.getFollowDistance()).selector(targetPredicate); + this.targetConditions = TargetingConditions.forCombat().range(this.getFollowDistance()).selector(selector); } @Override @@ -55,23 +53,22 @@ public class NearestAttackableTargetGoal extends TargetG } protected AABB getTargetSearchArea(double targetDistance) { - return this.mob.getBoundingBox().inflate(targetDistance, 4.0, targetDistance); + return this.mob.getBoundingBox().inflate(targetDistance, targetDistance, targetDistance); } protected void findTarget() { + ServerLevel serverLevel = getServerLevel(this.mob); if (this.targetType != Player.class && this.targetType != ServerPlayer.class) { - this.target = this.mob - .level() - .getNearestEntity( - this.mob.level().getEntitiesOfClass(this.targetType, this.getTargetSearchArea(this.getFollowDistance()), livingEntity -> true), - this.targetConditions, - this.mob, - this.mob.getX(), - this.mob.getEyeY(), - this.mob.getZ() - ); + this.target = serverLevel.getNearestEntity( + this.mob.level().getEntitiesOfClass(this.targetType, this.getTargetSearchArea(this.getFollowDistance()), livingEntity -> true), + this.getTargetConditions(), + this.mob, + this.mob.getX(), + this.mob.getEyeY(), + this.mob.getZ() + ); } else { - this.target = this.mob.level().getNearestPlayer(this.targetConditions, this.mob, this.mob.getX(), this.mob.getEyeY(), this.mob.getZ()); + this.target = serverLevel.getNearestPlayer(this.getTargetConditions(), this.mob, this.mob.getX(), this.mob.getEyeY(), this.mob.getZ()); } } @@ -84,4 +81,8 @@ public class NearestAttackableTargetGoal extends TargetG public void setTarget(@Nullable LivingEntity target) { this.target = target; } + + private TargetingConditions getTargetConditions() { + return this.targetConditions.range(this.getFollowDistance()); + } } diff --git a/net/minecraft/world/entity/ai/goal/target/NearestAttackableWitchTargetGoal.java b/net/minecraft/world/entity/ai/goal/target/NearestAttackableWitchTargetGoal.java index ab3cc9bd..ebc577c4 100644 --- a/net/minecraft/world/entity/ai/goal/target/NearestAttackableWitchTargetGoal.java +++ b/net/minecraft/world/entity/ai/goal/target/NearestAttackableWitchTargetGoal.java @@ -1,17 +1,15 @@ package net.minecraft.world.entity.ai.goal.target; -import java.util.function.Predicate; import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.ai.targeting.TargetingConditions; import net.minecraft.world.entity.raid.Raider; import org.jetbrains.annotations.Nullable; public class NearestAttackableWitchTargetGoal extends NearestAttackableTargetGoal { private boolean canAttack = true; - public NearestAttackableWitchTargetGoal( - Raider mob, Class targetType, int randomInterval, boolean mustSee, boolean mustReach, @Nullable Predicate targetPredicate - ) { - super(mob, targetType, randomInterval, mustSee, mustReach, targetPredicate); + public NearestAttackableWitchTargetGoal(Raider raider, Class class_, int i, boolean bl, boolean bl2, @Nullable TargetingConditions.Selector selector) { + super(raider, class_, i, bl, bl2, selector); } public void setCanAttack(boolean active) { diff --git a/net/minecraft/world/entity/ai/goal/target/NearestHealableRaiderTargetGoal.java b/net/minecraft/world/entity/ai/goal/target/NearestHealableRaiderTargetGoal.java index 022cc2ab..ccdb135d 100644 --- a/net/minecraft/world/entity/ai/goal/target/NearestHealableRaiderTargetGoal.java +++ b/net/minecraft/world/entity/ai/goal/target/NearestHealableRaiderTargetGoal.java @@ -1,7 +1,7 @@ package net.minecraft.world.entity.ai.goal.target; -import java.util.function.Predicate; import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.ai.targeting.TargetingConditions; import net.minecraft.world.entity.raid.Raider; import org.jetbrains.annotations.Nullable; @@ -9,8 +9,8 @@ public class NearestHealableRaiderTargetGoal extends Nea private static final int DEFAULT_COOLDOWN = 200; private int cooldown = 0; - public NearestHealableRaiderTargetGoal(Raider mob, Class targetType, boolean mustSee, @Nullable Predicate targetPredicate) { - super(mob, targetType, 500, mustSee, false, targetPredicate); + public NearestHealableRaiderTargetGoal(Raider raider, Class class_, boolean bl, @Nullable TargetingConditions.Selector selector) { + super(raider, class_, 500, bl, false, selector); } public int getCooldown() { diff --git a/net/minecraft/world/entity/ai/goal/target/NonTameRandomTargetGoal.java b/net/minecraft/world/entity/ai/goal/target/NonTameRandomTargetGoal.java index 44cbf9cf..9848f704 100644 --- a/net/minecraft/world/entity/ai/goal/target/NonTameRandomTargetGoal.java +++ b/net/minecraft/world/entity/ai/goal/target/NonTameRandomTargetGoal.java @@ -1,16 +1,16 @@ package net.minecraft.world.entity.ai.goal.target; -import java.util.function.Predicate; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.TamableAnimal; +import net.minecraft.world.entity.ai.targeting.TargetingConditions; import org.jetbrains.annotations.Nullable; public class NonTameRandomTargetGoal extends NearestAttackableTargetGoal { private final TamableAnimal tamableMob; - public NonTameRandomTargetGoal(TamableAnimal tamableMob, Class targetType, boolean mustSee, @Nullable Predicate targetPredicate) { - super(tamableMob, targetType, 10, mustSee, false, targetPredicate); - this.tamableMob = tamableMob; + public NonTameRandomTargetGoal(TamableAnimal tamableAnimal, Class class_, boolean bl, @Nullable TargetingConditions.Selector selector) { + super(tamableAnimal, class_, 10, bl, false, selector); + this.tamableMob = tamableAnimal; } @Override @@ -20,6 +20,6 @@ public class NonTameRandomTargetGoal extends NearestAtta @Override public boolean canContinueToUse() { - return this.targetConditions != null ? this.targetConditions.test(this.mob, this.target) : super.canContinueToUse(); + return this.targetConditions != null ? this.targetConditions.test(getServerLevel(this.mob), this.mob, this.target) : super.canContinueToUse(); } } diff --git a/net/minecraft/world/entity/ai/goal/target/ResetUniversalAngerTargetGoal.java b/net/minecraft/world/entity/ai/goal/target/ResetUniversalAngerTargetGoal.java index a929d4ba..78e5ec94 100644 --- a/net/minecraft/world/entity/ai/goal/target/ResetUniversalAngerTargetGoal.java +++ b/net/minecraft/world/entity/ai/goal/target/ResetUniversalAngerTargetGoal.java @@ -23,7 +23,7 @@ public class ResetUniversalAngerTargetGoal extends G @Override public boolean canUse() { - return this.mob.level().getGameRules().getBoolean(GameRules.RULE_UNIVERSAL_ANGER) && this.wasHurtByPlayer(); + return getServerLevel(this.mob).getGameRules().getBoolean(GameRules.RULE_UNIVERSAL_ANGER) && this.wasHurtByPlayer(); } private boolean wasHurtByPlayer() { diff --git a/net/minecraft/world/entity/ai/goal/target/TargetGoal.java b/net/minecraft/world/entity/ai/goal/target/TargetGoal.java index 4ab4a27b..4cc98d18 100644 --- a/net/minecraft/world/entity/ai/goal/target/TargetGoal.java +++ b/net/minecraft/world/entity/ai/goal/target/TargetGoal.java @@ -96,7 +96,7 @@ public abstract class TargetGoal extends Goal { protected boolean canAttack(@Nullable LivingEntity potentialTarget, TargetingConditions targetPredicate) { if (potentialTarget == null) { return false; - } else if (!targetPredicate.test(this.mob, potentialTarget)) { + } else if (!targetPredicate.test(getServerLevel(this.mob), this.mob, potentialTarget)) { return false; } else if (!this.mob.isWithinRestriction(potentialTarget.blockPosition())) { return false; diff --git a/net/minecraft/world/entity/ai/memory/NearestVisibleLivingEntities.java b/net/minecraft/world/entity/ai/memory/NearestVisibleLivingEntities.java index 504674b5..845f37cb 100644 --- a/net/minecraft/world/entity/ai/memory/NearestVisibleLivingEntities.java +++ b/net/minecraft/world/entity/ai/memory/NearestVisibleLivingEntities.java @@ -6,6 +6,7 @@ import java.util.List; import java.util.Optional; import java.util.function.Predicate; import java.util.stream.Stream; +import net.minecraft.server.level.ServerLevel; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.ai.sensing.Sensor; @@ -19,10 +20,10 @@ public class NearestVisibleLivingEntities { this.lineOfSightTest = livingEntity -> false; } - public NearestVisibleLivingEntities(LivingEntity livingEntity, List nearbyLivingEntities) { - this.nearbyEntities = nearbyLivingEntities; - Object2BooleanOpenHashMap object2BooleanOpenHashMap = new Object2BooleanOpenHashMap<>(nearbyLivingEntities.size()); - Predicate predicate = livingEntity2 -> Sensor.isEntityTargetable(livingEntity, livingEntity2); + public NearestVisibleLivingEntities(ServerLevel serverLevel, LivingEntity livingEntity, List list) { + this.nearbyEntities = list; + Object2BooleanOpenHashMap object2BooleanOpenHashMap = new Object2BooleanOpenHashMap<>(list.size()); + Predicate predicate = livingEntity2 -> Sensor.isEntityTargetable(serverLevel, livingEntity, livingEntity2); this.lineOfSightTest = livingEntityx -> object2BooleanOpenHashMap.computeIfAbsent(livingEntityx, predicate); } diff --git a/net/minecraft/world/entity/ai/navigation/GroundPathNavigation.java b/net/minecraft/world/entity/ai/navigation/GroundPathNavigation.java index c07fe296..bc5d24fc 100644 --- a/net/minecraft/world/entity/ai/navigation/GroundPathNavigation.java +++ b/net/minecraft/world/entity/ai/navigation/GroundPathNavigation.java @@ -1,6 +1,7 @@ package net.minecraft.world.entity.ai.navigation; import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; import net.minecraft.core.SectionPos; import net.minecraft.util.Mth; import net.minecraft.world.entity.Entity; @@ -47,33 +48,35 @@ public class GroundPathNavigation extends PathNavigation { return null; } else { if (levelChunk.getBlockState(pos).isAir()) { - BlockPos blockPos = pos.below(); + BlockPos.MutableBlockPos mutableBlockPos = pos.mutable().move(Direction.DOWN); - while (blockPos.getY() > this.level.getMinBuildHeight() && levelChunk.getBlockState(blockPos).isAir()) { - blockPos = blockPos.below(); + while (mutableBlockPos.getY() > this.level.getMinY() && levelChunk.getBlockState(mutableBlockPos).isAir()) { + mutableBlockPos.move(Direction.DOWN); } - if (blockPos.getY() > this.level.getMinBuildHeight()) { - return super.createPath(blockPos.above(), accuracy); + if (mutableBlockPos.getY() > this.level.getMinY()) { + return super.createPath(mutableBlockPos.above(), accuracy); } - while (blockPos.getY() < this.level.getMaxBuildHeight() && levelChunk.getBlockState(blockPos).isAir()) { - blockPos = blockPos.above(); + mutableBlockPos.setY(pos.getY() + 1); + + while (mutableBlockPos.getY() <= this.level.getMaxY() && levelChunk.getBlockState(mutableBlockPos).isAir()) { + mutableBlockPos.move(Direction.UP); } - pos = blockPos; + pos = mutableBlockPos; } if (!levelChunk.getBlockState(pos).isSolid()) { return super.createPath(pos, accuracy); } else { - BlockPos blockPos = pos.above(); + BlockPos.MutableBlockPos mutableBlockPos = pos.mutable().move(Direction.UP); - while (blockPos.getY() < this.level.getMaxBuildHeight() && levelChunk.getBlockState(blockPos).isSolid()) { - blockPos = blockPos.above(); + while (mutableBlockPos.getY() <= this.level.getMaxY() && levelChunk.getBlockState(mutableBlockPos).isSolid()) { + mutableBlockPos.move(Direction.UP); } - return super.createPath(blockPos, accuracy); + return super.createPath(mutableBlockPos.immutable(), accuracy); } } } diff --git a/net/minecraft/world/entity/ai/navigation/PathNavigation.java b/net/minecraft/world/entity/ai/navigation/PathNavigation.java index c8128202..4fd8564e 100644 --- a/net/minecraft/world/entity/ai/navigation/PathNavigation.java +++ b/net/minecraft/world/entity/ai/navigation/PathNavigation.java @@ -9,12 +9,16 @@ import net.minecraft.core.Vec3i; import net.minecraft.network.protocol.game.DebugPackets; import net.minecraft.tags.BlockTags; import net.minecraft.util.Mth; +import net.minecraft.util.profiling.Profiler; +import net.minecraft.util.profiling.ProfilerFiller; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Mob; import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.level.ClipContext; import net.minecraft.world.level.Level; import net.minecraft.world.level.PathNavigationRegion; +import net.minecraft.world.level.ClipContext.Block; +import net.minecraft.world.level.ClipContext.Fluid; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.pathfinder.Node; import net.minecraft.world.level.pathfinder.NodeEvaluator; @@ -22,8 +26,8 @@ import net.minecraft.world.level.pathfinder.Path; import net.minecraft.world.level.pathfinder.PathFinder; import net.minecraft.world.level.pathfinder.PathType; import net.minecraft.world.level.pathfinder.WalkNodeEvaluator; -import net.minecraft.world.phys.HitResult; import net.minecraft.world.phys.Vec3; +import net.minecraft.world.phys.HitResult.Type; import org.jetbrains.annotations.Nullable; public abstract class PathNavigation { @@ -58,12 +62,26 @@ public abstract class PathNavigation { private float maxVisitedNodesMultiplier = 1.0F; private final PathFinder pathFinder; private boolean isStuck; + private float requiredPathLength = 16.0F; public PathNavigation(Mob mob, Level level) { this.mob = mob; this.level = level; - int i = Mth.floor(mob.getAttributeValue(Attributes.FOLLOW_RANGE) * 16.0); - this.pathFinder = this.createPathFinder(i); + this.pathFinder = this.createPathFinder(Mth.floor(mob.getAttributeBaseValue(Attributes.FOLLOW_RANGE) * 16.0)); + } + + public void updatePathfinderMaxVisitedNodes() { + int i = Mth.floor(this.getMaxPathLength() * 16.0F); + this.pathFinder.setMaxVisitedNodes(i); + } + + public void setRequiredPathLength(float f) { + this.requiredPathLength = f; + this.updatePathfinderMaxVisitedNodes(); + } + + private float getMaxPathLength() { + return Math.max((float)this.mob.getAttributeValue(Attributes.FOLLOW_RANGE), this.requiredPathLength); } public void resetMaxVisitedNodesMultiplier() { @@ -148,26 +166,27 @@ public abstract class PathNavigation { */ @Nullable protected Path createPath(Set targets, int regionOffset, boolean offsetUpward, int accuracy) { - return this.createPath(targets, regionOffset, offsetUpward, accuracy, (float)this.mob.getAttributeValue(Attributes.FOLLOW_RANGE)); + return this.createPath(targets, regionOffset, offsetUpward, accuracy, this.getMaxPathLength()); } @Nullable protected Path createPath(Set targets, int regionOffset, boolean offsetUpward, int accuracy, float followRange) { if (targets.isEmpty()) { return null; - } else if (this.mob.getY() < this.level.getMinBuildHeight()) { + } else if (this.mob.getY() < this.level.getMinY()) { return null; } else if (!this.canUpdatePath()) { return null; } else if (this.path != null && !this.path.isDone() && targets.contains(this.targetPos)) { return this.path; } else { - this.level.getProfiler().push("pathfind"); + ProfilerFiller profilerFiller = Profiler.get(); + profilerFiller.push("pathfind"); BlockPos blockPos = offsetUpward ? this.mob.blockPosition().above() : this.mob.blockPosition(); int i = (int)(followRange + regionOffset); PathNavigationRegion pathNavigationRegion = new PathNavigationRegion(this.level, blockPos.offset(-i, -i, -i), blockPos.offset(i, i, i)); Path path = this.pathFinder.findPath(pathNavigationRegion, this.mob, targets, followRange, accuracy, this.maxVisitedNodesMultiplier); - this.level.getProfiler().pop(); + profilerFiller.pop(); if (path != null && path.getTarget() != null) { this.targetPos = path.getTarget(); this.reachRange = accuracy; @@ -413,15 +432,12 @@ public abstract class PathNavigation { protected static boolean isClearForMovementBetween(Mob mob, Vec3 pos1, Vec3 pos2, boolean allowSwimming) { Vec3 vec3 = new Vec3(pos2.x, pos2.y + mob.getBbHeight() * 0.5, pos2.z); - return mob.level() - .clip(new ClipContext(pos1, vec3, ClipContext.Block.COLLIDER, allowSwimming ? ClipContext.Fluid.ANY : ClipContext.Fluid.NONE, mob)) - .getType() - == HitResult.Type.MISS; + return mob.level().clip(new ClipContext(pos1, vec3, Block.COLLIDER, allowSwimming ? Fluid.ANY : Fluid.NONE, mob)).getType() == Type.MISS; } public boolean isStableDestination(BlockPos pos) { BlockPos blockPos = pos.below(); - return this.level.getBlockState(blockPos).isSolidRender(this.level, blockPos); + return this.level.getBlockState(blockPos).isSolidRender(); } public NodeEvaluator getNodeEvaluator() { diff --git a/net/minecraft/world/entity/ai/navigation/WaterBoundPathNavigation.java b/net/minecraft/world/entity/ai/navigation/WaterBoundPathNavigation.java index 1fa58d5d..5e6bb6e6 100644 --- a/net/minecraft/world/entity/ai/navigation/WaterBoundPathNavigation.java +++ b/net/minecraft/world/entity/ai/navigation/WaterBoundPathNavigation.java @@ -44,7 +44,7 @@ public class WaterBoundPathNavigation extends PathNavigation { @Override public boolean isStableDestination(BlockPos pos) { - return !this.level.getBlockState(pos).isSolidRender(this.level, pos); + return !this.level.getBlockState(pos).isSolidRender(); } @Override diff --git a/net/minecraft/world/entity/ai/sensing/AxolotlAttackablesSensor.java b/net/minecraft/world/entity/ai/sensing/AxolotlAttackablesSensor.java index fcdc8c89..13559d30 100644 --- a/net/minecraft/world/entity/ai/sensing/AxolotlAttackablesSensor.java +++ b/net/minecraft/world/entity/ai/sensing/AxolotlAttackablesSensor.java @@ -1,5 +1,6 @@ package net.minecraft.world.entity.ai.sensing; +import net.minecraft.server.level.ServerLevel; import net.minecraft.tags.EntityTypeTags; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.ai.memory.MemoryModuleType; @@ -8,11 +9,11 @@ public class AxolotlAttackablesSensor extends NearestVisibleLivingEntitySensor { public static final float TARGET_DETECTION_DISTANCE = 8.0F; @Override - protected boolean isMatchingEntity(LivingEntity attacker, LivingEntity target) { - return this.isClose(attacker, target) - && target.isInWaterOrBubble() - && (this.isHostileTarget(target) || this.isHuntTarget(attacker, target)) - && Sensor.isEntityAttackable(attacker, target); + protected boolean isMatchingEntity(ServerLevel serverLevel, LivingEntity livingEntity, LivingEntity livingEntity2) { + return this.isClose(livingEntity, livingEntity2) + && livingEntity2.isInWaterOrBubble() + && (this.isHostileTarget(livingEntity2) || this.isHuntTarget(livingEntity, livingEntity2)) + && Sensor.isEntityAttackable(serverLevel, livingEntity, livingEntity2); } private boolean isHuntTarget(LivingEntity attacker, LivingEntity target) { diff --git a/net/minecraft/world/entity/ai/sensing/BreezeAttackEntitySensor.java b/net/minecraft/world/entity/ai/sensing/BreezeAttackEntitySensor.java index 4eba758e..e9eb8b0d 100644 --- a/net/minecraft/world/entity/ai/sensing/BreezeAttackEntitySensor.java +++ b/net/minecraft/world/entity/ai/sensing/BreezeAttackEntitySensor.java @@ -11,8 +11,6 @@ import net.minecraft.world.entity.ai.memory.MemoryModuleType; import net.minecraft.world.entity.monster.breeze.Breeze; public class BreezeAttackEntitySensor extends NearestLivingEntitySensor { - public static final int BREEZE_SENSOR_RADIUS = 24; - @Override public Set> requires() { return ImmutableSet.copyOf(Iterables.concat(super.requires(), List.of(MemoryModuleType.NEAREST_ATTACKABLE))); @@ -25,21 +23,11 @@ public class BreezeAttackEntitySensor extends NearestLivingEntitySensor .stream() .flatMap(Collection::stream) .filter(EntitySelector.NO_CREATIVE_OR_SPECTATOR) - .filter(livingEntity -> Sensor.isEntityAttackable(breeze, livingEntity)) + .filter(livingEntity -> Sensor.isEntityAttackable(serverLevel, breeze, livingEntity)) .findFirst() .ifPresentOrElse( livingEntity -> breeze.getBrain().setMemory(MemoryModuleType.NEAREST_ATTACKABLE, livingEntity), () -> breeze.getBrain().eraseMemory(MemoryModuleType.NEAREST_ATTACKABLE) ); } - - @Override - protected int radiusXZ() { - return 24; - } - - @Override - protected int radiusY() { - return 24; - } } diff --git a/net/minecraft/world/entity/ai/sensing/FrogAttackablesSensor.java b/net/minecraft/world/entity/ai/sensing/FrogAttackablesSensor.java index a4d7216b..6bc23ad4 100644 --- a/net/minecraft/world/entity/ai/sensing/FrogAttackablesSensor.java +++ b/net/minecraft/world/entity/ai/sensing/FrogAttackablesSensor.java @@ -3,6 +3,7 @@ package net.minecraft.world.entity.ai.sensing; import java.util.ArrayList; import java.util.List; import java.util.UUID; +import net.minecraft.server.level.ServerLevel; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.ai.memory.MemoryModuleType; import net.minecraft.world.entity.animal.frog.Frog; @@ -11,12 +12,12 @@ public class FrogAttackablesSensor extends NearestVisibleLivingEntitySensor { public static final float TARGET_DETECTION_DISTANCE = 10.0F; @Override - protected boolean isMatchingEntity(LivingEntity attacker, LivingEntity target) { - return !attacker.getBrain().hasMemoryValue(MemoryModuleType.HAS_HUNTING_COOLDOWN) - && Sensor.isEntityAttackable(attacker, target) - && Frog.canEat(target) - && !this.isUnreachableAttackTarget(attacker, target) - ? target.closerThan(attacker, 10.0) + protected boolean isMatchingEntity(ServerLevel serverLevel, LivingEntity livingEntity, LivingEntity livingEntity2) { + return !livingEntity.getBrain().hasMemoryValue(MemoryModuleType.HAS_HUNTING_COOLDOWN) + && Sensor.isEntityAttackable(serverLevel, livingEntity, livingEntity2) + && Frog.canEat(livingEntity2) + && !this.isUnreachableAttackTarget(livingEntity, livingEntity2) + ? livingEntity2.closerThan(livingEntity, 10.0) : false; } diff --git a/net/minecraft/world/entity/ai/sensing/NearestItemSensor.java b/net/minecraft/world/entity/ai/sensing/NearestItemSensor.java index 16ab462f..8ab5b571 100644 --- a/net/minecraft/world/entity/ai/sensing/NearestItemSensor.java +++ b/net/minecraft/world/entity/ai/sensing/NearestItemSensor.java @@ -26,7 +26,7 @@ public class NearestItemSensor extends Sensor { List list = level.getEntitiesOfClass(ItemEntity.class, entity.getBoundingBox().inflate(32.0, 16.0, 32.0), itemEntity -> true); list.sort(Comparator.comparingDouble(entity::distanceToSqr)); Optional optional = list.stream() - .filter(itemEntity -> entity.wantsToPickUp(itemEntity.getItem())) + .filter(itemEntity -> entity.wantsToPickUp(level, itemEntity.getItem())) .filter(itemEntity -> itemEntity.closerThan(entity, 32.0)) .filter(entity::hasLineOfSight) .findFirst(); diff --git a/net/minecraft/world/entity/ai/sensing/NearestLivingEntitySensor.java b/net/minecraft/world/entity/ai/sensing/NearestLivingEntitySensor.java index cf4f5c4c..2b4fff45 100644 --- a/net/minecraft/world/entity/ai/sensing/NearestLivingEntitySensor.java +++ b/net/minecraft/world/entity/ai/sensing/NearestLivingEntitySensor.java @@ -7,6 +7,7 @@ import java.util.Set; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.ai.Brain; +import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.entity.ai.memory.MemoryModuleType; import net.minecraft.world.entity.ai.memory.NearestVisibleLivingEntities; import net.minecraft.world.phys.AABB; @@ -14,20 +15,13 @@ import net.minecraft.world.phys.AABB; public class NearestLivingEntitySensor extends Sensor { @Override protected void doTick(ServerLevel level, T entity) { - AABB aABB = entity.getBoundingBox().inflate(this.radiusXZ(), this.radiusY(), this.radiusXZ()); + double d = entity.getAttributeValue(Attributes.FOLLOW_RANGE); + AABB aABB = entity.getBoundingBox().inflate(d, d, d); List list = level.getEntitiesOfClass(LivingEntity.class, aABB, livingEntity2 -> livingEntity2 != entity && livingEntity2.isAlive()); list.sort(Comparator.comparingDouble(entity::distanceToSqr)); Brain brain = entity.getBrain(); brain.setMemory(MemoryModuleType.NEAREST_LIVING_ENTITIES, list); - brain.setMemory(MemoryModuleType.NEAREST_VISIBLE_LIVING_ENTITIES, new NearestVisibleLivingEntities(entity, list)); - } - - protected int radiusXZ() { - return 16; - } - - protected int radiusY() { - return 16; + brain.setMemory(MemoryModuleType.NEAREST_VISIBLE_LIVING_ENTITIES, new NearestVisibleLivingEntities(level, entity, list)); } @Override diff --git a/net/minecraft/world/entity/ai/sensing/NearestVisibleLivingEntitySensor.java b/net/minecraft/world/entity/ai/sensing/NearestVisibleLivingEntitySensor.java index 6f1967bb..1a907b88 100644 --- a/net/minecraft/world/entity/ai/sensing/NearestVisibleLivingEntitySensor.java +++ b/net/minecraft/world/entity/ai/sensing/NearestVisibleLivingEntitySensor.java @@ -9,7 +9,7 @@ import net.minecraft.world.entity.ai.memory.MemoryModuleType; import net.minecraft.world.entity.ai.memory.NearestVisibleLivingEntities; public abstract class NearestVisibleLivingEntitySensor extends Sensor { - protected abstract boolean isMatchingEntity(LivingEntity attacker, LivingEntity target); + protected abstract boolean isMatchingEntity(ServerLevel serverLevel, LivingEntity livingEntity, LivingEntity livingEntity2); protected abstract MemoryModuleType getMemory(); @@ -20,12 +20,14 @@ public abstract class NearestVisibleLivingEntitySensor extends Sensor getNearestEntity(LivingEntity entity) { - return this.getVisibleEntities(entity) - .flatMap(nearestVisibleLivingEntities -> nearestVisibleLivingEntities.findClosest(livingEntity2 -> this.isMatchingEntity(entity, livingEntity2))); + private Optional getNearestEntity(ServerLevel serverLevel, LivingEntity livingEntity) { + return this.getVisibleEntities(livingEntity) + .flatMap( + nearestVisibleLivingEntities -> nearestVisibleLivingEntities.findClosest(livingEntity2 -> this.isMatchingEntity(serverLevel, livingEntity, livingEntity2)) + ); } protected Optional getVisibleEntities(LivingEntity entity) { diff --git a/net/minecraft/world/entity/ai/sensing/PiglinSpecificSensor.java b/net/minecraft/world/entity/ai/sensing/PiglinSpecificSensor.java index 33118fb3..6ade6ccb 100644 --- a/net/minecraft/world/entity/ai/sensing/PiglinSpecificSensor.java +++ b/net/minecraft/world/entity/ai/sensing/PiglinSpecificSensor.java @@ -81,7 +81,7 @@ public class PiglinSpecificSensor extends Sensor { list.add(piglin); } } else if (livingEntity instanceof Player player) { - if (optional6.isEmpty() && !PiglinAi.isWearingGold(player) && entity.canAttack(livingEntity)) { + if (optional6.isEmpty() && !PiglinAi.isWearingSafeArmor(player) && entity.canAttack(livingEntity)) { optional6 = Optional.of(player); } diff --git a/net/minecraft/world/entity/ai/sensing/PlayerSensor.java b/net/minecraft/world/entity/ai/sensing/PlayerSensor.java index 0fc656e7..91ee8020 100644 --- a/net/minecraft/world/entity/ai/sensing/PlayerSensor.java +++ b/net/minecraft/world/entity/ai/sensing/PlayerSensor.java @@ -10,6 +10,7 @@ import net.minecraft.server.level.ServerLevel; import net.minecraft.world.entity.EntitySelector; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.ai.Brain; +import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.entity.ai.memory.MemoryModuleType; import net.minecraft.world.entity.player.Player; @@ -24,14 +25,18 @@ public class PlayerSensor extends Sensor { List list = (List)level.players() .stream() .filter(EntitySelector.NO_SPECTATORS) - .filter(serverPlayer -> entity.closerThan(serverPlayer, 16.0)) + .filter(serverPlayer -> entity.closerThan(serverPlayer, this.getFollowDistance(entity))) .sorted(Comparator.comparingDouble(entity::distanceToSqr)) .collect(Collectors.toList()); Brain brain = entity.getBrain(); brain.setMemory(MemoryModuleType.NEAREST_PLAYERS, list); - List list2 = (List)list.stream().filter(player -> isEntityTargetable(entity, player)).collect(Collectors.toList()); + List list2 = (List)list.stream().filter(player -> isEntityTargetable(level, entity, player)).collect(Collectors.toList()); brain.setMemory(MemoryModuleType.NEAREST_VISIBLE_PLAYER, list2.isEmpty() ? null : (Player)list2.get(0)); - Optional optional = list2.stream().filter(player -> isEntityAttackable(entity, player)).findFirst(); + Optional optional = list2.stream().filter(player -> isEntityAttackable(level, entity, player)).findFirst(); brain.setMemory(MemoryModuleType.NEAREST_VISIBLE_ATTACKABLE_PLAYER, optional); } + + protected double getFollowDistance(LivingEntity livingEntity) { + return livingEntity.getAttributeValue(Attributes.FOLLOW_RANGE); + } } diff --git a/net/minecraft/world/entity/ai/sensing/Sensing.java b/net/minecraft/world/entity/ai/sensing/Sensing.java index fc5cb702..b60c3654 100644 --- a/net/minecraft/world/entity/ai/sensing/Sensing.java +++ b/net/minecraft/world/entity/ai/sensing/Sensing.java @@ -2,6 +2,8 @@ package net.minecraft.world.entity.ai.sensing; import it.unimi.dsi.fastutil.ints.IntOpenHashSet; import it.unimi.dsi.fastutil.ints.IntSet; +import net.minecraft.util.profiling.Profiler; +import net.minecraft.util.profiling.ProfilerFiller; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Mob; @@ -32,9 +34,10 @@ public class Sensing { } else if (this.unseen.contains(i)) { return false; } else { - this.mob.level().getProfiler().push("hasLineOfSight"); + ProfilerFiller profilerFiller = Profiler.get(); + profilerFiller.push("hasLineOfSight"); boolean bl = this.mob.hasLineOfSight(entity); - this.mob.level().getProfiler().pop(); + profilerFiller.pop(); if (bl) { this.seen.add(i); } else { diff --git a/net/minecraft/world/entity/ai/sensing/Sensor.java b/net/minecraft/world/entity/ai/sensing/Sensor.java index ecb5e5b2..c793a4a7 100644 --- a/net/minecraft/world/entity/ai/sensing/Sensor.java +++ b/net/minecraft/world/entity/ai/sensing/Sensor.java @@ -1,16 +1,19 @@ package net.minecraft.world.entity.ai.sensing; import java.util.Set; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.function.BiPredicate; import net.minecraft.server.level.ServerLevel; import net.minecraft.util.RandomSource; import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.entity.ai.memory.MemoryModuleType; import net.minecraft.world.entity.ai.targeting.TargetingConditions; public abstract class Sensor { private static final RandomSource RANDOM = RandomSource.createThreadSafe(); private static final int DEFAULT_SCAN_RATE = 20; - protected static final int TARGETING_RANGE = 16; + private static final int DEFAULT_TARGETING_RANGE = 16; private static final TargetingConditions TARGET_CONDITIONS = TargetingConditions.forNonCombat().range(16.0); private static final TargetingConditions TARGET_CONDITIONS_IGNORE_INVISIBILITY_TESTING = TargetingConditions.forNonCombat() .range(16.0) @@ -39,35 +42,56 @@ public abstract class Sensor { public final void tick(ServerLevel level, E entity) { if (--this.timeToTick <= 0L) { this.timeToTick = this.scanRate; + this.updateTargetingConditionRanges(entity); this.doTick(level, entity); } } + private void updateTargetingConditionRanges(E livingEntity) { + double d = livingEntity.getAttributeValue(Attributes.FOLLOW_RANGE); + TARGET_CONDITIONS.range(d); + TARGET_CONDITIONS_IGNORE_INVISIBILITY_TESTING.range(d); + ATTACK_TARGET_CONDITIONS.range(d); + ATTACK_TARGET_CONDITIONS_IGNORE_INVISIBILITY_TESTING.range(d); + ATTACK_TARGET_CONDITIONS_IGNORE_LINE_OF_SIGHT.range(d); + ATTACK_TARGET_CONDITIONS_IGNORE_INVISIBILITY_AND_LINE_OF_SIGHT.range(d); + } + protected abstract void doTick(ServerLevel level, E entity); public abstract Set> requires(); - /** - * @return if the entity is remembered as a target and then tests the condition - */ - public static boolean isEntityTargetable(LivingEntity livingEntity, LivingEntity target) { - return livingEntity.getBrain().isMemoryValue(MemoryModuleType.ATTACK_TARGET, target) - ? TARGET_CONDITIONS_IGNORE_INVISIBILITY_TESTING.test(livingEntity, target) - : TARGET_CONDITIONS.test(livingEntity, target); + public static boolean isEntityTargetable(ServerLevel serverLevel, LivingEntity livingEntity, LivingEntity livingEntity2) { + return livingEntity.getBrain().isMemoryValue(MemoryModuleType.ATTACK_TARGET, livingEntity2) + ? TARGET_CONDITIONS_IGNORE_INVISIBILITY_TESTING.test(serverLevel, livingEntity, livingEntity2) + : TARGET_CONDITIONS.test(serverLevel, livingEntity, livingEntity2); } - /** - * @return if entity is remembered as an attack target and is valid to attack - */ - public static boolean isEntityAttackable(LivingEntity attacker, LivingEntity target) { - return attacker.getBrain().isMemoryValue(MemoryModuleType.ATTACK_TARGET, target) - ? ATTACK_TARGET_CONDITIONS_IGNORE_INVISIBILITY_TESTING.test(attacker, target) - : ATTACK_TARGET_CONDITIONS.test(attacker, target); + public static boolean isEntityAttackable(ServerLevel serverLevel, LivingEntity livingEntity, LivingEntity livingEntity2) { + return livingEntity.getBrain().isMemoryValue(MemoryModuleType.ATTACK_TARGET, livingEntity2) + ? ATTACK_TARGET_CONDITIONS_IGNORE_INVISIBILITY_TESTING.test(serverLevel, livingEntity, livingEntity2) + : ATTACK_TARGET_CONDITIONS.test(serverLevel, livingEntity, livingEntity2); } - public static boolean isEntityAttackableIgnoringLineOfSight(LivingEntity attacker, LivingEntity target) { - return attacker.getBrain().isMemoryValue(MemoryModuleType.ATTACK_TARGET, target) - ? ATTACK_TARGET_CONDITIONS_IGNORE_INVISIBILITY_AND_LINE_OF_SIGHT.test(attacker, target) - : ATTACK_TARGET_CONDITIONS_IGNORE_LINE_OF_SIGHT.test(attacker, target); + public static BiPredicate wasEntityAttackableLastNTicks(LivingEntity livingEntity, int i) { + return rememberPositives(i, (serverLevel, livingEntity2) -> isEntityAttackable(serverLevel, livingEntity, livingEntity2)); + } + + public static boolean isEntityAttackableIgnoringLineOfSight(ServerLevel serverLevel, LivingEntity livingEntity, LivingEntity livingEntity2) { + return livingEntity.getBrain().isMemoryValue(MemoryModuleType.ATTACK_TARGET, livingEntity2) + ? ATTACK_TARGET_CONDITIONS_IGNORE_INVISIBILITY_AND_LINE_OF_SIGHT.test(serverLevel, livingEntity, livingEntity2) + : ATTACK_TARGET_CONDITIONS_IGNORE_LINE_OF_SIGHT.test(serverLevel, livingEntity, livingEntity2); + } + + static BiPredicate rememberPositives(int i, BiPredicate biPredicate) { + AtomicInteger atomicInteger = new AtomicInteger(0); + return (object, object2) -> { + if (biPredicate.test(object, object2)) { + atomicInteger.set(i); + return true; + } else { + return atomicInteger.decrementAndGet() >= 0; + } + }; } } diff --git a/net/minecraft/world/entity/ai/sensing/TemptingSensor.java b/net/minecraft/world/entity/ai/sensing/TemptingSensor.java index 5bc44cb9..63830043 100644 --- a/net/minecraft/world/entity/ai/sensing/TemptingSensor.java +++ b/net/minecraft/world/entity/ai/sensing/TemptingSensor.java @@ -10,14 +10,14 @@ import net.minecraft.server.level.ServerLevel; import net.minecraft.world.entity.EntitySelector; import net.minecraft.world.entity.PathfinderMob; import net.minecraft.world.entity.ai.Brain; +import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.entity.ai.memory.MemoryModuleType; import net.minecraft.world.entity.ai.targeting.TargetingConditions; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; public class TemptingSensor extends Sensor { - public static final int TEMPTATION_RANGE = 10; - private static final TargetingConditions TEMPT_TARGETING = TargetingConditions.forNonCombat().range(10.0).ignoreLineOfSight(); + private static final TargetingConditions TEMPT_TARGETING = TargetingConditions.forNonCombat().ignoreLineOfSight(); private final Predicate temptations; public TemptingSensor(Predicate temptations) { @@ -26,11 +26,11 @@ public class TemptingSensor extends Sensor { protected void doTick(ServerLevel level, PathfinderMob entity) { Brain brain = entity.getBrain(); + TargetingConditions targetingConditions = TEMPT_TARGETING.copy().range((float)entity.getAttributeValue(Attributes.TEMPT_RANGE)); List list = (List)level.players() .stream() .filter(EntitySelector.NO_SPECTATORS) - .filter(serverPlayer -> TEMPT_TARGETING.test(entity, serverPlayer)) - .filter(serverPlayer -> entity.closerThan(serverPlayer, 10.0)) + .filter(serverPlayer -> targetingConditions.test(level, entity, serverPlayer)) .filter(this::playerHoldingTemptation) .filter(serverPlayer -> !entity.hasPassenger(serverPlayer)) .sorted(Comparator.comparingDouble(entity::distanceToSqr)) diff --git a/net/minecraft/world/entity/ai/sensing/VillagerHostilesSensor.java b/net/minecraft/world/entity/ai/sensing/VillagerHostilesSensor.java index 66fb1976..f1019f80 100644 --- a/net/minecraft/world/entity/ai/sensing/VillagerHostilesSensor.java +++ b/net/minecraft/world/entity/ai/sensing/VillagerHostilesSensor.java @@ -1,6 +1,7 @@ package net.minecraft.world.entity.ai.sensing; import com.google.common.collect.ImmutableMap; +import net.minecraft.server.level.ServerLevel; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.ai.memory.MemoryModuleType; @@ -21,8 +22,8 @@ public class VillagerHostilesSensor extends NearestVisibleLivingEntitySensor { .build(); @Override - protected boolean isMatchingEntity(LivingEntity attacker, LivingEntity target) { - return this.isHostile(target) && this.isClose(attacker, target); + protected boolean isMatchingEntity(ServerLevel serverLevel, LivingEntity livingEntity, LivingEntity livingEntity2) { + return this.isHostile(livingEntity2) && this.isClose(livingEntity, livingEntity2); } private boolean isClose(LivingEntity attacker, LivingEntity target) { diff --git a/net/minecraft/world/entity/ai/sensing/WardenEntitySensor.java b/net/minecraft/world/entity/ai/sensing/WardenEntitySensor.java index 3ba66910..37e2b40f 100644 --- a/net/minecraft/world/entity/ai/sensing/WardenEntitySensor.java +++ b/net/minecraft/world/entity/ai/sensing/WardenEntitySensor.java @@ -38,14 +38,4 @@ public class WardenEntitySensor extends NearestLivingEntitySensor { .filter(predicate) .findFirst(); } - - @Override - protected int radiusXZ() { - return 24; - } - - @Override - protected int radiusY() { - return 24; - } } diff --git a/net/minecraft/world/entity/ai/targeting/TargetingConditions.java b/net/minecraft/world/entity/ai/targeting/TargetingConditions.java index 3124f96f..487c6630 100644 --- a/net/minecraft/world/entity/ai/targeting/TargetingConditions.java +++ b/net/minecraft/world/entity/ai/targeting/TargetingConditions.java @@ -1,6 +1,6 @@ package net.minecraft.world.entity.ai.targeting; -import java.util.function.Predicate; +import net.minecraft.server.level.ServerLevel; import net.minecraft.world.Difficulty; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.Mob; @@ -14,7 +14,7 @@ public class TargetingConditions { private boolean checkLineOfSight = true; private boolean testInvisible = true; @Nullable - private Predicate selector; + private TargetingConditions.Selector selector; private TargetingConditions(boolean isCombat) { this.isCombat = isCombat; @@ -52,38 +52,39 @@ public class TargetingConditions { return this; } - public TargetingConditions selector(@Nullable Predicate customPredicate) { - this.selector = customPredicate; + public TargetingConditions selector(@Nullable TargetingConditions.Selector selector) { + this.selector = selector; return this; } - public boolean test(@Nullable LivingEntity attacker, LivingEntity target) { - if (attacker == target) { + public boolean test(ServerLevel serverLevel, @Nullable LivingEntity livingEntity, LivingEntity livingEntity2) { + if (livingEntity == livingEntity2) { return false; - } else if (!target.canBeSeenByAnyone()) { + } else if (!livingEntity2.canBeSeenByAnyone()) { return false; - } else if (this.selector != null && !this.selector.test(target)) { + } else if (this.selector != null && !this.selector.test(livingEntity2, serverLevel)) { return false; } else { - if (attacker == null) { - if (this.isCombat && (!target.canBeSeenAsEnemy() || target.level().getDifficulty() == Difficulty.PEACEFUL)) { + if (livingEntity == null) { + if (this.isCombat && (!livingEntity2.canBeSeenAsEnemy() || serverLevel.getDifficulty() == Difficulty.PEACEFUL)) { return false; } } else { - if (this.isCombat && (!attacker.canAttack(target) || !attacker.canAttackType(target.getType()) || attacker.isAlliedTo(target))) { + if (this.isCombat + && (!livingEntity.canAttack(livingEntity2) || !livingEntity.canAttackType(livingEntity2.getType()) || livingEntity.isAlliedTo(livingEntity2))) { return false; } if (this.range > 0.0) { - double d = this.testInvisible ? target.getVisibilityPercent(attacker) : 1.0; + double d = this.testInvisible ? livingEntity2.getVisibilityPercent(livingEntity) : 1.0; double e = Math.max(this.range * d, 2.0); - double f = attacker.distanceToSqr(target.getX(), target.getY(), target.getZ()); + double f = livingEntity.distanceToSqr(livingEntity2.getX(), livingEntity2.getY(), livingEntity2.getZ()); if (f > e * e) { return false; } } - if (this.checkLineOfSight && attacker instanceof Mob mob && !mob.getSensing().hasLineOfSight(target)) { + if (this.checkLineOfSight && livingEntity instanceof Mob mob && !mob.getSensing().hasLineOfSight(livingEntity2)) { return false; } } @@ -91,4 +92,9 @@ public class TargetingConditions { return true; } } + + @FunctionalInterface + public interface Selector { + boolean test(LivingEntity livingEntity, ServerLevel serverLevel); + } } diff --git a/net/minecraft/world/entity/ai/util/AirAndWaterRandomPos.java b/net/minecraft/world/entity/ai/util/AirAndWaterRandomPos.java index 7cc7397c..41fa873d 100644 --- a/net/minecraft/world/entity/ai/util/AirAndWaterRandomPos.java +++ b/net/minecraft/world/entity/ai/util/AirAndWaterRandomPos.java @@ -20,7 +20,7 @@ public class AirAndWaterRandomPos { } else { BlockPos blockPos2 = RandomPos.generateRandomPosTowardDirection(mob, maxDistance, mob.getRandom(), blockPos); if (!GoalUtils.isOutsideLimits(blockPos2, mob) && !GoalUtils.isRestricted(shortCircuit, mob, blockPos2)) { - blockPos2 = RandomPos.moveUpOutOfSolid(blockPos2, mob.level().getMaxBuildHeight(), blockPosx -> GoalUtils.isSolid(mob, blockPosx)); + blockPos2 = RandomPos.moveUpOutOfSolid(blockPos2, mob.level().getMaxY(), blockPosx -> GoalUtils.isSolid(mob, blockPosx)); return GoalUtils.hasMalus(mob, blockPos2) ? null : blockPos2; } else { return null; diff --git a/net/minecraft/world/entity/ai/util/GoalUtils.java b/net/minecraft/world/entity/ai/util/GoalUtils.java index 7dd5dbe1..21eb3b25 100644 --- a/net/minecraft/world/entity/ai/util/GoalUtils.java +++ b/net/minecraft/world/entity/ai/util/GoalUtils.java @@ -24,7 +24,7 @@ public class GoalUtils { * @return if a mob is above or below the map */ public static boolean isOutsideLimits(BlockPos pos, PathfinderMob mob) { - return pos.getY() < mob.level().getMinBuildHeight() || pos.getY() > mob.level().getMaxBuildHeight(); + return mob.level().isOutsideBuildHeight(pos.getY()); } /** diff --git a/net/minecraft/world/entity/ai/util/HoverRandomPos.java b/net/minecraft/world/entity/ai/util/HoverRandomPos.java index 4c3b26e2..fbbe18d9 100644 --- a/net/minecraft/world/entity/ai/util/HoverRandomPos.java +++ b/net/minecraft/world/entity/ai/util/HoverRandomPos.java @@ -24,10 +24,7 @@ public class HoverRandomPos { return null; } else { blockPos2 = RandomPos.moveUpToAboveSolid( - blockPos2, - mob.getRandom().nextInt(maxSwimUp - minSwimUp + 1) + minSwimUp, - mob.level().getMaxBuildHeight(), - blockPosx -> GoalUtils.isSolid(mob, blockPosx) + blockPos2, mob.getRandom().nextInt(maxSwimUp - minSwimUp + 1) + minSwimUp, mob.level().getMaxY(), blockPosx -> GoalUtils.isSolid(mob, blockPosx) ); return !GoalUtils.isWater(mob, blockPos2) && !GoalUtils.hasMalus(mob, blockPos2) ? blockPos2 : null; } diff --git a/net/minecraft/world/entity/ai/util/LandRandomPos.java b/net/minecraft/world/entity/ai/util/LandRandomPos.java index 083582e3..dc6e6c6b 100644 --- a/net/minecraft/world/entity/ai/util/LandRandomPos.java +++ b/net/minecraft/world/entity/ai/util/LandRandomPos.java @@ -56,7 +56,7 @@ public class LandRandomPos { @Nullable public static BlockPos movePosUpOutOfSolid(PathfinderMob mob, BlockPos pos) { - pos = RandomPos.moveUpOutOfSolid(pos, mob.level().getMaxBuildHeight(), blockPos -> GoalUtils.isSolid(mob, blockPos)); + pos = RandomPos.moveUpOutOfSolid(pos, mob.level().getMaxY(), blockPos -> GoalUtils.isSolid(mob, blockPos)); return !GoalUtils.isWater(mob, pos) && !GoalUtils.hasMalus(mob, pos) ? pos : null; } diff --git a/net/minecraft/world/entity/ai/util/RandomPos.java b/net/minecraft/world/entity/ai/util/RandomPos.java index 52fdbcc2..6bd02984 100644 --- a/net/minecraft/world/entity/ai/util/RandomPos.java +++ b/net/minecraft/world/entity/ai/util/RandomPos.java @@ -5,6 +5,7 @@ import java.util.function.Predicate; import java.util.function.Supplier; import java.util.function.ToDoubleFunction; import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; import net.minecraft.world.entity.PathfinderMob; @@ -59,13 +60,13 @@ public class RandomPos { if (!posPredicate.test(pos)) { return pos; } else { - BlockPos blockPos = pos.above(); + BlockPos.MutableBlockPos mutableBlockPos = pos.mutable().move(Direction.UP); - while (blockPos.getY() < maxY && posPredicate.test(blockPos)) { - blockPos = blockPos.above(); + while (mutableBlockPos.getY() <= maxY && posPredicate.test(mutableBlockPos)) { + mutableBlockPos.move(Direction.UP); } - return blockPos; + return mutableBlockPos.immutable(); } } @@ -81,24 +82,23 @@ public class RandomPos { } else if (!posPredicate.test(pos)) { return pos; } else { - BlockPos blockPos = pos.above(); + BlockPos.MutableBlockPos mutableBlockPos = pos.mutable().move(Direction.UP); - while (blockPos.getY() < maxY && posPredicate.test(blockPos)) { - blockPos = blockPos.above(); + while (mutableBlockPos.getY() <= maxY && posPredicate.test(mutableBlockPos)) { + mutableBlockPos.move(Direction.UP); } - BlockPos blockPos2 = blockPos; + int i = mutableBlockPos.getY(); - while (blockPos2.getY() < maxY && blockPos2.getY() - blockPos.getY() < aboveSolidAmount) { - BlockPos blockPos3 = blockPos2.above(); - if (posPredicate.test(blockPos3)) { + while (mutableBlockPos.getY() <= maxY && mutableBlockPos.getY() - i < aboveSolidAmount) { + mutableBlockPos.move(Direction.UP); + if (posPredicate.test(mutableBlockPos)) { + mutableBlockPos.move(Direction.DOWN); break; } - - blockPos2 = blockPos3; } - return blockPos2; + return mutableBlockPos.immutable(); } } diff --git a/net/minecraft/world/entity/ai/village/VillageSiege.java b/net/minecraft/world/entity/ai/village/VillageSiege.java index 9368fd9a..a2794c86 100644 --- a/net/minecraft/world/entity/ai/village/VillageSiege.java +++ b/net/minecraft/world/entity/ai/village/VillageSiege.java @@ -5,8 +5,8 @@ import net.minecraft.core.BlockPos; import net.minecraft.server.level.ServerLevel; import net.minecraft.tags.BiomeTags; import net.minecraft.util.Mth; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; -import net.minecraft.world.entity.MobSpawnType; import net.minecraft.world.entity.monster.Monster; import net.minecraft.world.entity.monster.Zombie; import net.minecraft.world.entity.player.Player; @@ -98,7 +98,7 @@ public class VillageSiege implements CustomSpawner { Zombie zombie; try { zombie = new Zombie(level); - zombie.finalizeSpawn(level, level.getCurrentDifficultyAt(zombie.blockPosition()), MobSpawnType.EVENT, null); + zombie.finalizeSpawn(level, level.getCurrentDifficultyAt(zombie.blockPosition()), EntitySpawnReason.EVENT, null); } catch (Exception var5) { LOGGER.warn("Failed to create zombie for village siege at {}", vec3, var5); return; @@ -116,7 +116,7 @@ public class VillageSiege implements CustomSpawner { int k = pos.getZ() + level.random.nextInt(16) - 8; int l = level.getHeight(Heightmap.Types.WORLD_SURFACE, j, k); BlockPos blockPos = new BlockPos(j, l, k); - if (level.isVillage(blockPos) && Monster.checkMonsterSpawnRules(EntityType.ZOMBIE, level, MobSpawnType.EVENT, blockPos, level.random)) { + if (level.isVillage(blockPos) && Monster.checkMonsterSpawnRules(EntityType.ZOMBIE, level, EntitySpawnReason.EVENT, blockPos, level.random)) { return Vec3.atBottomCenterOf(blockPos); } } diff --git a/net/minecraft/world/entity/ai/village/poi/PoiManager.java b/net/minecraft/world/entity/ai/village/poi/PoiManager.java index 908ca888..7c26c5a7 100644 --- a/net/minecraft/world/entity/ai/village/poi/PoiManager.java +++ b/net/minecraft/world/entity/ai/village/poi/PoiManager.java @@ -38,7 +38,7 @@ import net.minecraft.world.level.chunk.storage.RegionStorageInfo; import net.minecraft.world.level.chunk.storage.SectionStorage; import net.minecraft.world.level.chunk.storage.SimpleRegionStorage; -public class PoiManager extends SectionStorage { +public class PoiManager extends SectionStorage { public static final int MAX_VILLAGE_DISTANCE = 6; public static final int VILLAGE_SECTION_SIZE = 1; private final PoiManager.DistanceTracker distanceTracker; @@ -55,7 +55,9 @@ public class PoiManager extends SectionStorage { ) { super( new SimpleRegionStorage(info, folder, fixerUpper, sync, DataFixTypes.POI_CHUNK), - PoiSection::codec, + PoiSection.Packed.CODEC, + PoiSection::pack, + PoiSection.Packed::unpack, PoiSection::new, registryAccess, errorReporter, @@ -95,7 +97,7 @@ public class PoiManager extends SectionStorage { @VisibleForDebug public Stream getInChunk(Predicate> typePredicate, ChunkPos posChunk, PoiManager.Occupancy status) { - return IntStream.range(this.levelHeightAccessor.getMinSection(), this.levelHeightAccessor.getMaxSection()) + return IntStream.rangeClosed(this.levelHeightAccessor.getMinSectionY(), this.levelHeightAccessor.getMaxSectionY()) .boxed() .map(integer -> this.getOrLoad(SectionPos.of(posChunk, integer).asLong())) .filter(Optional::isPresent) @@ -252,7 +254,7 @@ public class PoiManager extends SectionStorage { public void ensureLoadedAndValid(LevelReader levelReader, BlockPos pos, int coordinateOffset) { SectionPos.aroundChunk( - new ChunkPos(pos), Math.floorDiv(coordinateOffset, 16), this.levelHeightAccessor.getMinSection(), this.levelHeightAccessor.getMaxSection() + new ChunkPos(pos), Math.floorDiv(coordinateOffset, 16), this.levelHeightAccessor.getMinSectionY(), this.levelHeightAccessor.getMaxSectionY() ) .map(sectionPos -> Pair.of(sectionPos, this.getOrLoad(sectionPos.asLong()))) .filter(pair -> !(Boolean)((Optional)pair.getSecond()).map(PoiSection::isValid).orElse(false)) diff --git a/net/minecraft/world/entity/ai/village/poi/PoiRecord.java b/net/minecraft/world/entity/ai/village/poi/PoiRecord.java index 230bdfbd..cdfc39e5 100644 --- a/net/minecraft/world/entity/ai/village/poi/PoiRecord.java +++ b/net/minecraft/world/entity/ai/village/poi/PoiRecord.java @@ -15,19 +15,7 @@ public class PoiRecord { private int freeTickets; private final Runnable setDirty; - public static Codec codec(Runnable executable) { - return RecordCodecBuilder.create( - instance -> instance.group( - BlockPos.CODEC.fieldOf("pos").forGetter(poiRecord -> poiRecord.pos), - RegistryFixedCodec.create(Registries.POINT_OF_INTEREST_TYPE).fieldOf("type").forGetter(poiRecord -> poiRecord.poiType), - Codec.INT.fieldOf("free_tickets").orElse(0).forGetter(poiRecord -> poiRecord.freeTickets), - RecordCodecBuilder.point(executable) - ) - .apply(instance, PoiRecord::new) - ); - } - - private PoiRecord(BlockPos pos, Holder poiType, int freeTickets, Runnable setDirty) { + PoiRecord(BlockPos pos, Holder poiType, int freeTickets, Runnable setDirty) { this.pos = pos.immutable(); this.poiType = poiType; this.freeTickets = freeTickets; @@ -38,6 +26,10 @@ public class PoiRecord { this(pod, poiType, poiType.value().maxTickets(), setDirty); } + public PoiRecord.Packed pack() { + return new PoiRecord.Packed(this.pos, this.poiType, this.freeTickets); + } + @Deprecated @VisibleForDebug public int getFreeTickets() { @@ -91,4 +83,19 @@ public class PoiRecord { public int hashCode() { return this.pos.hashCode(); } + + public record Packed(BlockPos pos, Holder poiType, int freeTickets) { + public static final Codec CODEC = RecordCodecBuilder.create( + instance -> instance.group( + BlockPos.CODEC.fieldOf("pos").forGetter(PoiRecord.Packed::pos), + RegistryFixedCodec.create(Registries.POINT_OF_INTEREST_TYPE).fieldOf("type").forGetter(PoiRecord.Packed::poiType), + Codec.INT.fieldOf("free_tickets").orElse(0).forGetter(PoiRecord.Packed::freeTickets) + ) + .apply(instance, PoiRecord.Packed::new) + ); + + public PoiRecord unpack(Runnable runnable) { + return new PoiRecord(this.pos, this.poiType, this.freeTickets, runnable); + } + } } diff --git a/net/minecraft/world/entity/ai/village/poi/PoiSection.java b/net/minecraft/world/entity/ai/village/poi/PoiSection.java index 69bfe695..e48bb39b 100644 --- a/net/minecraft/world/entity/ai/village/poi/PoiSection.java +++ b/net/minecraft/world/entity/ai/village/poi/PoiSection.java @@ -31,28 +31,20 @@ public class PoiSection { private final Runnable setDirty; private boolean isValid; - public static Codec codec(Runnable executable) { - return RecordCodecBuilder.create( - instance -> instance.group( - RecordCodecBuilder.point(executable), - Codec.BOOL.lenientOptionalFieldOf("Valid", false).forGetter(poiSection -> poiSection.isValid), - PoiRecord.codec(executable).listOf().fieldOf("Records").forGetter(poiSection -> ImmutableList.copyOf(poiSection.records.values())) - ) - .apply(instance, PoiSection::new) - ) - .orElseGet(Util.prefix("Failed to read POI section: ", LOGGER::error), () -> new PoiSection(executable, false, ImmutableList.of())); - } - public PoiSection(Runnable setDirty) { this(setDirty, true, ImmutableList.of()); } - private PoiSection(Runnable setDirty, boolean isValid, List records) { + PoiSection(Runnable setDirty, boolean isValid, List records) { this.setDirty = setDirty; this.isValid = isValid; records.forEach(this::add); } + public PoiSection.Packed pack() { + return new PoiSection.Packed(this.isValid, this.records.values().stream().map(PoiRecord::pack).toList()); + } + public Stream getRecords(Predicate> typePredicate, PoiManager.Occupancy status) { return this.byType .entrySet() @@ -149,4 +141,18 @@ public class PoiSection { boolean isValid() { return this.isValid; } + + public record Packed(boolean isValid, List records) { + public static final Codec CODEC = RecordCodecBuilder.create( + instance -> instance.group( + Codec.BOOL.lenientOptionalFieldOf("Valid", false).forGetter(PoiSection.Packed::isValid), + PoiRecord.Packed.CODEC.listOf().fieldOf("Records").forGetter(PoiSection.Packed::records) + ) + .apply(instance, PoiSection.Packed::new) + ); + + public PoiSection unpack(Runnable runnable) { + return new PoiSection(runnable, this.isValid, this.records.stream().map(packed -> packed.unpack(runnable)).toList()); + } + } } diff --git a/net/minecraft/world/entity/ai/village/poi/PoiTypes.java b/net/minecraft/world/entity/ai/village/poi/PoiTypes.java index b9924419..7166d59a 100644 --- a/net/minecraft/world/entity/ai/village/poi/PoiTypes.java +++ b/net/minecraft/world/entity/ai/village/poi/PoiTypes.java @@ -81,7 +81,7 @@ public class PoiTypes { private static PoiType register(Registry key, ResourceKey value, Set matchingStates, int maxTickets, int validRange) { PoiType poiType = new PoiType(matchingStates, maxTickets, validRange); Registry.register(key, value, poiType); - registerBlockStates(key.getHolderOrThrow(value), matchingStates); + registerBlockStates(key.getOrThrow(value), matchingStates); return poiType; } diff --git a/net/minecraft/world/entity/ambient/Bat.java b/net/minecraft/world/entity/ambient/Bat.java index fd931421..755882ce 100644 --- a/net/minecraft/world/entity/ambient/Bat.java +++ b/net/minecraft/world/entity/ambient/Bat.java @@ -7,22 +7,25 @@ import net.minecraft.nbt.CompoundTag; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.network.syncher.SynchedEntityData.Builder; +import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; +import net.minecraft.tags.BlockTags; import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.AnimationState; import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.Mob; -import net.minecraft.world.entity.MobSpawnType; -import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.entity.ai.targeting.TargetingConditions; import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.levelgen.Heightmap; import net.minecraft.world.phys.Vec3; import org.jetbrains.annotations.Nullable; @@ -50,7 +53,7 @@ public class Bat extends AmbientCreature { } @Override - protected void defineSynchedData(SynchedEntityData.Builder builder) { + protected void defineSynchedData(Builder builder) { super.defineSynchedData(builder); builder.define(DATA_ID_FLAGS, (byte)0); } @@ -94,7 +97,7 @@ public class Bat extends AmbientCreature { protected void pushEntities() { } - public static AttributeSupplier.Builder createAttributes() { + public static net.minecraft.world.entity.ai.attributes.AttributeSupplier.Builder createAttributes() { return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 6.0); } @@ -125,31 +128,31 @@ public class Bat extends AmbientCreature { } @Override - protected void customServerAiStep() { - super.customServerAiStep(); + protected void customServerAiStep(ServerLevel serverLevel) { + super.customServerAiStep(serverLevel); BlockPos blockPos = this.blockPosition(); BlockPos blockPos2 = blockPos.above(); if (this.isResting()) { boolean bl = this.isSilent(); - if (this.level().getBlockState(blockPos2).isRedstoneConductor(this.level(), blockPos)) { + if (serverLevel.getBlockState(blockPos2).isRedstoneConductor(serverLevel, blockPos)) { if (this.random.nextInt(200) == 0) { this.yHeadRot = this.random.nextInt(360); } - if (this.level().getNearestPlayer(BAT_RESTING_TARGETING, this) != null) { + if (serverLevel.getNearestPlayer(BAT_RESTING_TARGETING, this) != null) { this.setResting(false); if (!bl) { - this.level().levelEvent(null, 1025, blockPos, 0); + serverLevel.levelEvent(null, 1025, blockPos, 0); } } } else { this.setResting(false); if (!bl) { - this.level().levelEvent(null, 1025, blockPos, 0); + serverLevel.levelEvent(null, 1025, blockPos, 0); } } } else { - if (this.targetPosition != null && (!this.level().isEmptyBlock(this.targetPosition) || this.targetPosition.getY() <= this.level().getMinBuildHeight())) { + if (this.targetPosition != null && (!serverLevel.isEmptyBlock(this.targetPosition) || this.targetPosition.getY() <= serverLevel.getMinY())) { this.targetPosition = null; } @@ -171,7 +174,7 @@ public class Bat extends AmbientCreature { float h = Mth.wrapDegrees(g - this.getYRot()); this.zza = 0.5F; this.setYRot(this.getYRot() + h); - if (this.random.nextInt(100) == 0 && this.level().getBlockState(blockPos2).isRedstoneConductor(this.level(), blockPos2)) { + if (this.random.nextInt(100) == 0 && serverLevel.getBlockState(blockPos2).isRedstoneConductor(serverLevel, blockPos2)) { this.setResting(true); } } @@ -192,15 +195,15 @@ public class Bat extends AmbientCreature { } @Override - public boolean hurt(DamageSource source, float amount) { - if (this.isInvulnerableTo(source)) { + public boolean hurtServer(ServerLevel serverLevel, DamageSource damageSource, float f) { + if (this.isInvulnerableTo(serverLevel, damageSource)) { return false; } else { - if (!this.level().isClientSide && this.isResting()) { + if (this.isResting()) { this.setResting(false); } - return super.hurt(source, amount); + return super.hurtServer(serverLevel, damageSource, f); } } @@ -216,19 +219,27 @@ public class Bat extends AmbientCreature { compound.putByte("BatFlags", this.entityData.get(DATA_ID_FLAGS)); } - public static boolean checkBatSpawnRules(EntityType bat, LevelAccessor level, MobSpawnType spawnType, BlockPos pos, RandomSource random) { - if (pos.getY() >= level.getSeaLevel()) { + public static boolean checkBatSpawnRules( + EntityType entityType, LevelAccessor levelAccessor, EntitySpawnReason entitySpawnReason, BlockPos blockPos, RandomSource randomSource + ) { + if (blockPos.getY() >= levelAccessor.getHeightmapPos(Heightmap.Types.WORLD_SURFACE, blockPos).getY()) { return false; } else { - int i = level.getMaxLocalRawBrightness(pos); + int i = levelAccessor.getMaxLocalRawBrightness(blockPos); int j = 4; if (isHalloween()) { j = 7; - } else if (random.nextBoolean()) { + } else if (randomSource.nextBoolean()) { return false; } - return i > random.nextInt(j) ? false : checkMobSpawnRules(bat, level, spawnType, pos, random); + if (i > randomSource.nextInt(j)) { + return false; + } else { + return !levelAccessor.getBlockState(blockPos.below()).is(BlockTags.BATS_SPAWNABLE_ON) + ? false + : checkMobSpawnRules(entityType, levelAccessor, entitySpawnReason, blockPos, randomSource); + } } } diff --git a/net/minecraft/world/entity/animal/AbstractFish.java b/net/minecraft/world/entity/animal/AbstractFish.java index 7a3e2403..aa68f422 100644 --- a/net/minecraft/world/entity/animal/AbstractFish.java +++ b/net/minecraft/world/entity/animal/AbstractFish.java @@ -15,8 +15,8 @@ import net.minecraft.world.entity.EntitySelector; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.Mob; import net.minecraft.world.entity.MoverType; -import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.entity.ai.attributes.AttributeSupplier.Builder; import net.minecraft.world.entity.ai.control.MoveControl; import net.minecraft.world.entity.ai.goal.AvoidEntityGoal; import net.minecraft.world.entity.ai.goal.PanicGoal; @@ -37,7 +37,7 @@ public abstract class AbstractFish extends WaterAnimal implements Bucketable { this.moveControl = new AbstractFish.FishMoveControl(this); } - public static AttributeSupplier.Builder createAttributes() { + public static Builder createAttributes() { return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 3.0); } @@ -57,7 +57,7 @@ public abstract class AbstractFish extends WaterAnimal implements Bucketable { } @Override - protected void defineSynchedData(SynchedEntityData.Builder builder) { + protected void defineSynchedData(net.minecraft.network.syncher.SynchedEntityData.Builder builder) { super.defineSynchedData(builder); builder.define(FROM_BUCKET, false); } @@ -99,7 +99,7 @@ public abstract class AbstractFish extends WaterAnimal implements Bucketable { @Override public void travel(Vec3 travelVector) { - if (this.isEffectiveAi() && this.isInWater()) { + if (this.isControlledByLocalInstance() && this.isInWater()) { this.moveRelative(0.01F, travelVector); this.move(MoverType.SELF, this.getDeltaMovement()); this.setDeltaMovement(this.getDeltaMovement().scale(0.9)); diff --git a/net/minecraft/world/entity/animal/AbstractSchoolingFish.java b/net/minecraft/world/entity/animal/AbstractSchoolingFish.java index 8ecd9f9b..7a02bf60 100644 --- a/net/minecraft/world/entity/animal/AbstractSchoolingFish.java +++ b/net/minecraft/world/entity/animal/AbstractSchoolingFish.java @@ -3,8 +3,8 @@ package net.minecraft.world.entity.animal; import java.util.List; import java.util.stream.Stream; import net.minecraft.world.DifficultyInstance; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; -import net.minecraft.world.entity.MobSpawnType; import net.minecraft.world.entity.SpawnGroupData; import net.minecraft.world.entity.ai.goal.FollowFlockLeaderGoal; import net.minecraft.world.level.Level; @@ -100,8 +100,10 @@ public abstract class AbstractSchoolingFish extends AbstractFish { @Nullable @Override - public SpawnGroupData finalizeSpawn(ServerLevelAccessor level, DifficultyInstance difficulty, MobSpawnType spawnType, @Nullable SpawnGroupData spawnGroupData) { - super.finalizeSpawn(level, difficulty, spawnType, spawnGroupData); + public SpawnGroupData finalizeSpawn( + ServerLevelAccessor serverLevelAccessor, DifficultyInstance difficultyInstance, EntitySpawnReason entitySpawnReason, @Nullable SpawnGroupData spawnGroupData + ) { + super.finalizeSpawn(serverLevelAccessor, difficultyInstance, entitySpawnReason, spawnGroupData); if (spawnGroupData == null) { spawnGroupData = new AbstractSchoolingFish.SchoolSpawnGroupData(this); } else { diff --git a/net/minecraft/world/entity/animal/AgeableWaterCreature.java b/net/minecraft/world/entity/animal/AgeableWaterCreature.java new file mode 100644 index 00000000..bff3bb29 --- /dev/null +++ b/net/minecraft/world/entity/animal/AgeableWaterCreature.java @@ -0,0 +1,80 @@ +package net.minecraft.world.entity.animal; + +import net.minecraft.core.BlockPos; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.tags.FluidTags; +import net.minecraft.util.RandomSource; +import net.minecraft.world.entity.AgeableMob; +import net.minecraft.world.entity.EntitySpawnReason; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.pathfinder.PathType; + +public abstract class AgeableWaterCreature extends AgeableMob { + protected AgeableWaterCreature(EntityType entityType, Level level) { + super(entityType, level); + this.setPathfindingMalus(PathType.WATER, 0.0F); + } + + @Override + public boolean checkSpawnObstruction(LevelReader level) { + return level.isUnobstructed(this); + } + + @Override + public int getAmbientSoundInterval() { + return 120; + } + + @Override + public int getBaseExperienceReward(ServerLevel serverLevel) { + return 1 + this.random.nextInt(3); + } + + protected void handleAirSupply(int i) { + if (this.isAlive() && !this.isInWaterOrBubble()) { + this.setAirSupply(i - 1); + if (this.getAirSupply() == -20) { + this.setAirSupply(0); + this.hurt(this.damageSources().drown(), 2.0F); + } + } else { + this.setAirSupply(300); + } + } + + @Override + public void baseTick() { + int i = this.getAirSupply(); + super.baseTick(); + this.handleAirSupply(i); + } + + @Override + public boolean isPushedByFluid() { + return false; + } + + @Override + public boolean canBeLeashed() { + return false; + } + + public static boolean checkSurfaceAgeableWaterCreatureSpawnRules( + EntityType entityType, + LevelAccessor levelAccessor, + EntitySpawnReason entitySpawnReason, + BlockPos blockPos, + RandomSource randomSource + ) { + int i = levelAccessor.getSeaLevel(); + int j = i - 13; + return blockPos.getY() >= j + && blockPos.getY() <= i + && levelAccessor.getFluidState(blockPos.below()).is(FluidTags.WATER) + && levelAccessor.getBlockState(blockPos.above()).is(Blocks.WATER); + } +} diff --git a/net/minecraft/world/entity/animal/Animal.java b/net/minecraft/world/entity/animal/Animal.java index 2eba205b..90cb8f02 100644 --- a/net/minecraft/world/entity/animal/Animal.java +++ b/net/minecraft/world/entity/animal/Animal.java @@ -4,6 +4,7 @@ import java.util.Optional; import java.util.UUID; import net.minecraft.advancements.CriteriaTriggers; import net.minecraft.core.BlockPos; +import net.minecraft.core.component.DataComponents; import net.minecraft.core.particles.ParticleTypes; import net.minecraft.nbt.CompoundTag; import net.minecraft.server.level.ServerLevel; @@ -15,11 +16,15 @@ import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.AgeableMob; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.ExperienceOrb; -import net.minecraft.world.entity.MobSpawnType; +import net.minecraft.world.entity.Mob; +import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.entity.ai.attributes.AttributeSupplier.Builder; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.component.UseRemainder; import net.minecraft.world.level.BlockAndTintGetter; import net.minecraft.world.level.GameRules; import net.minecraft.world.level.Level; @@ -41,13 +46,17 @@ public abstract class Animal extends AgeableMob { this.setPathfindingMalus(PathType.DAMAGE_FIRE, -1.0F); } + public static Builder createAnimalAttributes() { + return Mob.createMobAttributes().add(Attributes.TEMPT_RANGE, 10.0); + } + @Override - protected void customServerAiStep() { + protected void customServerAiStep(ServerLevel serverLevel) { if (this.getAge() != 0) { this.inLove = 0; } - super.customServerAiStep(); + super.customServerAiStep(serverLevel); } @Override @@ -69,9 +78,9 @@ public abstract class Animal extends AgeableMob { } @Override - protected void actuallyHurt(DamageSource damageSource, float damageAmount) { + protected void actuallyHurt(ServerLevel serverLevel, DamageSource damageSource, float f) { this.resetLove(); - super.actuallyHurt(damageSource, damageAmount); + super.actuallyHurt(serverLevel, damageSource, f); } @Override @@ -96,10 +105,10 @@ public abstract class Animal extends AgeableMob { } public static boolean checkAnimalSpawnRules( - EntityType animal, LevelAccessor level, MobSpawnType spawnType, BlockPos pos, RandomSource random + EntityType entityType, LevelAccessor levelAccessor, EntitySpawnReason entitySpawnReason, BlockPos blockPos, RandomSource randomSource ) { - boolean bl = MobSpawnType.ignoresLightRequirements(spawnType) || isBrightEnoughToSpawn(level, pos); - return level.getBlockState(pos.below()).is(BlockTags.ANIMALS_SPAWNABLE_ON) && bl; + boolean bl = EntitySpawnReason.ignoresLightRequirements(entitySpawnReason) || isBrightEnoughToSpawn(levelAccessor, blockPos); + return levelAccessor.getBlockState(blockPos.below()).is(BlockTags.ANIMALS_SPAWNABLE_ON) && bl; } protected static boolean isBrightEnoughToSpawn(BlockAndTintGetter level, BlockPos pos) { @@ -117,8 +126,8 @@ public abstract class Animal extends AgeableMob { } @Override - protected int getBaseExperienceReward() { - return 1 + this.level().random.nextInt(3); + protected int getBaseExperienceReward(ServerLevel serverLevel) { + return 1 + this.random.nextInt(3); } /** @@ -134,13 +143,15 @@ public abstract class Animal extends AgeableMob { if (!this.level().isClientSide && i == 0 && this.canFallInLove()) { this.usePlayerItem(player, hand, itemStack); this.setInLove(player); - return InteractionResult.SUCCESS; + this.playEatingSound(); + return InteractionResult.SUCCESS_SERVER; } if (this.isBaby()) { this.usePlayerItem(player, hand, itemStack); this.ageUp(getSpeedUpSecondsWhenFeeding(-i), true); - return InteractionResult.sidedSuccess(this.level().isClientSide); + this.playEatingSound(); + return InteractionResult.SUCCESS; } if (this.level().isClientSide) { @@ -151,8 +162,17 @@ public abstract class Animal extends AgeableMob { return super.mobInteract(player, hand); } + protected void playEatingSound() { + } + protected void usePlayerItem(Player player, InteractionHand hand, ItemStack stack) { + int i = stack.getCount(); + UseRemainder useRemainder = stack.get(DataComponents.USE_REMAINDER); stack.consume(1, player); + if (useRemainder != null) { + ItemStack itemStack = useRemainder.convertIntoRemainder(stack, i, player.hasInfiniteMaterials(), player::handleExtraItemsCreatedOnUse); + player.setItemInHand(hand, itemStack); + } } public boolean canFallInLove() { diff --git a/net/minecraft/world/entity/animal/Bee.java b/net/minecraft/world/entity/animal/Bee.java index 563d880d..7f8e80dc 100644 --- a/net/minecraft/world/entity/animal/Bee.java +++ b/net/minecraft/world/entity/animal/Bee.java @@ -1,6 +1,7 @@ package net.minecraft.world.entity.animal; import com.google.common.collect.Lists; +import it.unimi.dsi.fastutil.longs.Long2LongOpenHashMap; import java.util.Comparator; import java.util.EnumSet; import java.util.List; @@ -18,6 +19,7 @@ import net.minecraft.network.protocol.game.DebugPackets; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.network.syncher.SynchedEntityData.Builder; import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; @@ -35,12 +37,12 @@ import net.minecraft.world.effect.MobEffectInstance; import net.minecraft.world.effect.MobEffects; import net.minecraft.world.entity.AgeableMob; import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.Mob; import net.minecraft.world.entity.NeutralMob; import net.minecraft.world.entity.PathfinderMob; -import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.entity.ai.control.FlyingMoveControl; import net.minecraft.world.entity.ai.control.LookControl; @@ -94,14 +96,16 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { private static final int FLAG_HAS_STUNG = 4; private static final int FLAG_HAS_NECTAR = 8; private static final int STING_DEATH_COUNTDOWN = 1200; - private static final int TICKS_BEFORE_GOING_TO_KNOWN_FLOWER = 2400; + private static final int TICKS_BEFORE_GOING_TO_KNOWN_FLOWER = 600; private static final int TICKS_WITHOUT_NECTAR_BEFORE_GOING_HOME = 3600; private static final int MIN_ATTACK_DIST = 4; private static final int MAX_CROPS_GROWABLE = 10; private static final int POISON_SECONDS_NORMAL = 10; private static final int POISON_SECONDS_HARD = 18; - private static final int TOO_FAR_DISTANCE = 32; + private static final int TOO_FAR_DISTANCE = 48; private static final int HIVE_CLOSE_ENOUGH_DISTANCE = 2; + private static final int RESTRICTED_WANDER_DISTANCE_REDUCTION = 24; + private static final int DEFAULT_WANDER_DISTANCE_REDUCTION = 16; private static final int PATHFIND_TO_HIVE_WHEN_CLOSER_THAN = 16; private static final int HIVE_SEARCH_DISTANCE = 20; public static final String TAG_CROPS_GROWN_SINCE_POLLINATION = "CropsGrownSincePollination"; @@ -123,6 +127,8 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { private static final int COOLDOWN_BEFORE_LOCATING_NEW_HIVE = 200; int remainingCooldownBeforeLocatingNewHive; private static final int COOLDOWN_BEFORE_LOCATING_NEW_FLOWER = 200; + private static final int MIN_FIND_FLOWER_RETRY_COOLDOWN = 20; + private static final int MAX_FIND_FLOWER_RETRY_COOLDOWN = 60; int remainingCooldownBeforeLocatingNewFlower = Mth.nextInt(this.random, 20, 60); @Nullable BlockPos savedFlowerPos; @@ -145,7 +151,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { } @Override - protected void defineSynchedData(SynchedEntityData.Builder builder) { + protected void defineSynchedData(Builder builder) { super.defineSynchedData(builder); builder.define(DATA_FLAGS_ID, (byte)0); builder.define(DATA_REMAINING_ANGER_TIME, 0); @@ -162,6 +168,8 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { this.goalSelector.addGoal(1, new Bee.BeeEnterHiveGoal()); this.goalSelector.addGoal(2, new BreedGoal(this, 1.0)); this.goalSelector.addGoal(3, new TemptGoal(this, 1.25, itemStack -> itemStack.is(ItemTags.BEE_FOOD), false)); + this.goalSelector.addGoal(3, new Bee.ValidateHiveGoal()); + this.goalSelector.addGoal(3, new Bee.ValidateFlowerGoal()); this.beePollinateGoal = new Bee.BeePollinateGoal(); this.goalSelector.addGoal(4, this.beePollinateGoal); this.goalSelector.addGoal(5, new FollowParentGoal(this, 1.25)); @@ -199,27 +207,24 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { @Override public void readAdditionalSaveData(CompoundTag compound) { - this.hivePos = (BlockPos)NbtUtils.readBlockPos(compound, "hive_pos").orElse(null); - this.savedFlowerPos = (BlockPos)NbtUtils.readBlockPos(compound, "flower_pos").orElse(null); super.readAdditionalSaveData(compound); this.setHasNectar(compound.getBoolean("HasNectar")); this.setHasStung(compound.getBoolean("HasStung")); this.ticksWithoutNectarSinceExitingHive = compound.getInt("TicksSincePollination"); this.stayOutOfHiveCountdown = compound.getInt("CannotEnterHiveTicks"); this.numCropsGrownSincePollination = compound.getInt("CropsGrownSincePollination"); + this.hivePos = (BlockPos)NbtUtils.readBlockPos(compound, "hive_pos").orElse(null); + this.savedFlowerPos = (BlockPos)NbtUtils.readBlockPos(compound, "flower_pos").orElse(null); this.readPersistentAngerSaveData(this.level(), compound); } @Override - public boolean doHurtTarget(Entity target) { + public boolean doHurtTarget(ServerLevel serverLevel, Entity entity) { DamageSource damageSource = this.damageSources().sting(this); - boolean bl = target.hurt(damageSource, (int)this.getAttributeValue(Attributes.ATTACK_DAMAGE)); + boolean bl = entity.hurtServer(serverLevel, damageSource, (int)this.getAttributeValue(Attributes.ATTACK_DAMAGE)); if (bl) { - if (this.level() instanceof ServerLevel serverLevel) { - EnchantmentHelper.doPostAttackEffects(serverLevel, target, damageSource); - } - - if (target instanceof LivingEntity livingEntity) { + EnchantmentHelper.doPostAttackEffects(serverLevel, entity, damageSource); + if (entity instanceof LivingEntity livingEntity) { livingEntity.setStingerCount(livingEntity.getStingerCount() + 1); int i = 0; if (this.level().getDifficulty() == Difficulty.NORMAL) { @@ -312,15 +317,29 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { return this.ticksWithoutNectarSinceExitingHive > 3600; } + void dropHive() { + this.hivePos = null; + this.remainingCooldownBeforeLocatingNewHive = 200; + } + + void dropFlower() { + this.savedFlowerPos = null; + this.remainingCooldownBeforeLocatingNewFlower = Mth.nextInt(this.random, 20, 60); + } + boolean wantsToEnterHive() { if (this.stayOutOfHiveCountdown <= 0 && !this.beePollinateGoal.isPollinating() && !this.hasStung() && this.getTarget() == null) { - boolean bl = this.isTiredOfLookingForNectar() || this.level().isRaining() || this.level().isNight() || this.hasNectar(); + boolean bl = this.isTiredOfLookingForNectar() || isNightOrRaining(this.level()) || this.hasNectar(); return bl && !this.isHiveNearFire(); } else { return false; } } + public static boolean isNightOrRaining(Level level) { + return level.dimensionType().hasSkyLight() && (level.isNight() || level.isRaining()); + } + public void setStayOutOfHiveCountdown(int stayOutOfHiveCountdown) { this.stayOutOfHiveCountdown = stayOutOfHiveCountdown; } @@ -339,7 +358,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { } @Override - protected void customServerAiStep() { + protected void customServerAiStep(ServerLevel serverLevel) { boolean bl = this.hasStung(); if (this.isInWaterOrBubble()) { this.underWaterTicks++; @@ -348,13 +367,13 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { } if (this.underWaterTicks > 20) { - this.hurt(this.damageSources().drown(), 1.0F); + this.hurtServer(serverLevel, this.damageSources().drown(), 1.0F); } if (bl) { this.timeSinceSting++; if (this.timeSinceSting % 5 == 0 && this.random.nextInt(Mth.clamp(1200 - this.timeSinceSting, 1, 1200)) == 0) { - this.hurt(this.damageSources().generic(), this.getHealth()); + this.hurtServer(serverLevel, this.damageSources().generic(), this.getHealth()); } } @@ -362,9 +381,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { this.ticksWithoutNectarSinceExitingHive++; } - if (!this.level().isClientSide) { - this.updatePersistentAnger((ServerLevel)this.level(), false); - } + this.updatePersistentAnger(serverLevel, false); } public void resetTicksWithoutNectarSinceExitingHive() { @@ -372,12 +389,8 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { } private boolean isHiveNearFire() { - if (this.hivePos == null) { - return false; - } else { - BlockEntity blockEntity = this.level().getBlockEntity(this.hivePos); - return blockEntity instanceof BeehiveBlockEntity && ((BeehiveBlockEntity)blockEntity).isFireNearby(); - } + BeehiveBlockEntity beehiveBlockEntity = this.getBeehiveBlockEntity(); + return beehiveBlockEntity != null && beehiveBlockEntity.isFireNearby(); } @Override @@ -469,17 +482,19 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { } } - boolean isHiveValid() { - if (!this.hasHive()) { - return false; - } else if (this.isTooFarAway(this.hivePos)) { - return false; + @Nullable + BeehiveBlockEntity getBeehiveBlockEntity() { + if (this.hivePos == null) { + return null; } else { - BlockEntity blockEntity = this.level().getBlockEntity(this.hivePos); - return blockEntity != null && blockEntity.getType() == BlockEntityType.BEEHIVE; + return this.isTooFarAway(this.hivePos) ? null : (BeehiveBlockEntity)this.level().getBlockEntity(this.hivePos, BlockEntityType.BEEHIVE).orElse(null); } } + boolean isHiveValid() { + return this.getBeehiveBlockEntity() != null; + } + public boolean hasNectar() { return this.getFlag(8); } @@ -509,7 +524,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { } boolean isTooFarAway(BlockPos pos) { - return !this.closerThan(pos, 32); + return !this.closerThan(pos, 48); } private void setFlag(int flagId, boolean value) { @@ -524,13 +539,12 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { return (this.entityData.get(DATA_FLAGS_ID) & flagId) != 0; } - public static AttributeSupplier.Builder createAttributes() { - return Mob.createMobAttributes() + public static net.minecraft.world.entity.ai.attributes.AttributeSupplier.Builder createAttributes() { + return Animal.createAnimalAttributes() .add(Attributes.MAX_HEALTH, 10.0) .add(Attributes.FLYING_SPEED, 0.6F) .add(Attributes.MOVEMENT_SPEED, 0.3F) - .add(Attributes.ATTACK_DAMAGE, 2.0) - .add(Attributes.FOLLOW_RANGE, 48.0); + .add(Attributes.ATTACK_DAMAGE, 2.0); } @Override @@ -551,6 +565,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { flyingPathNavigation.setCanOpenDoors(false); flyingPathNavigation.setCanFloat(false); flyingPathNavigation.setCanPassDoors(true); + flyingPathNavigation.setRequiredPathLength(48.0F); return flyingPathNavigation; } @@ -559,10 +574,6 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { return stack.is(ItemTags.BEE_FOOD); } - boolean isFlowerValid(BlockPos pos) { - return this.level().isLoaded(pos) && this.level().getBlockState(pos).is(BlockTags.FLOWERS); - } - @Override protected void playStepSound(BlockPos pos, BlockState state) { } @@ -589,7 +600,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { @Nullable public Bee getBreedOffspring(ServerLevel level, AgeableMob otherParent) { - return EntityType.BEE.create(level); + return EntityType.BEE.create(level, EntitySpawnReason.BREEDING); } @Override @@ -612,15 +623,12 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { } @Override - public boolean hurt(DamageSource source, float amount) { - if (this.isInvulnerableTo(source)) { + public boolean hurtServer(ServerLevel serverLevel, DamageSource damageSource, float f) { + if (this.isInvulnerableTo(serverLevel, damageSource)) { return false; } else { - if (!this.level().isClientSide) { - this.beePollinateGoal.stopPollinating(); - } - - return super.hurt(source, amount); + this.beePollinateGoal.stopPollinating(); + return super.hurtServer(serverLevel, damageSource, f); } } @@ -704,15 +712,15 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { class BeeEnterHiveGoal extends Bee.BaseBeeGoal { @Override public boolean canBeeUse() { - if (Bee.this.hasHive() - && Bee.this.wantsToEnterHive() - && Bee.this.hivePos.closerToCenterThan(Bee.this.position(), 2.0) - && Bee.this.level().getBlockEntity(Bee.this.hivePos) instanceof BeehiveBlockEntity beehiveBlockEntity) { - if (!beehiveBlockEntity.isFull()) { - return true; - } + if (Bee.this.hivePos != null && Bee.this.wantsToEnterHive() && Bee.this.hivePos.closerToCenterThan(Bee.this.position(), 2.0)) { + BeehiveBlockEntity beehiveBlockEntity = Bee.this.getBeehiveBlockEntity(); + if (beehiveBlockEntity != null) { + if (!beehiveBlockEntity.isFull()) { + return true; + } - Bee.this.hivePos = null; + Bee.this.hivePos = null; + } } return false; @@ -725,7 +733,8 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { @Override public void start() { - if (Bee.this.level().getBlockEntity(Bee.this.hivePos) instanceof BeehiveBlockEntity beehiveBlockEntity) { + BeehiveBlockEntity beehiveBlockEntity = Bee.this.getBeehiveBlockEntity(); + if (beehiveBlockEntity != null) { beehiveBlockEntity.addOccupant(Bee.this); } } @@ -733,7 +742,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { @VisibleForDebug public class BeeGoToHiveGoal extends Bee.BaseBeeGoal { - public static final int MAX_TRAVELLING_TICKS = 600; + public static final int MAX_TRAVELLING_TICKS = 2400; int travellingTicks = Bee.this.level().random.nextInt(10); private static final int MAX_BLACKLISTED_TARGETS = 3; final List blacklistedTargets = Lists.newArrayList(); @@ -749,6 +758,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { @Override public boolean canBeeUse() { return Bee.this.hivePos != null + && !Bee.this.isTooFarAway(Bee.this.hivePos) && !Bee.this.hasRestriction() && Bee.this.wantsToEnterHive() && !this.hasReachedTarget(Bee.this.hivePos) @@ -779,12 +789,12 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { public void tick() { if (Bee.this.hivePos != null) { this.travellingTicks++; - if (this.travellingTicks > this.adjustedTickDelay(600)) { + if (this.travellingTicks > this.adjustedTickDelay(2400)) { this.dropAndBlacklistHive(); } else if (!Bee.this.navigation.isInProgress()) { if (!Bee.this.closerThan(Bee.this.hivePos, 16)) { if (Bee.this.isTooFarAway(Bee.this.hivePos)) { - this.dropHive(); + Bee.this.dropHive(); } else { Bee.this.pathfindRandomlyTowards(Bee.this.hivePos); } @@ -795,7 +805,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { } else if (this.lastPath != null && Bee.this.navigation.getPath().sameAs(this.lastPath)) { this.ticksStuck++; if (this.ticksStuck > 60) { - this.dropHive(); + Bee.this.dropHive(); this.ticksStuck = 0; } } else { @@ -807,8 +817,9 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { } private boolean pathfindDirectlyTowards(BlockPos pos) { + int i = Bee.this.closerThan(pos, 3) ? 1 : 2; Bee.this.navigation.setMaxVisitedNodesMultiplier(10.0F); - Bee.this.navigation.moveTo(pos.getX(), pos.getY(), pos.getZ(), 2, 1.0); + Bee.this.navigation.moveTo(pos.getX(), pos.getY(), pos.getZ(), i, 1.0); return Bee.this.navigation.getPath() != null && Bee.this.navigation.getPath().canReach(); } @@ -833,12 +844,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { this.blacklistTarget(Bee.this.hivePos); } - this.dropHive(); - } - - private void dropHive() { - Bee.this.hivePos = null; - Bee.this.remainingCooldownBeforeLocatingNewHive = 200; + Bee.this.dropHive(); } private boolean hasReachedTarget(BlockPos pos) { @@ -852,7 +858,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { } public class BeeGoToKnownFlowerGoal extends Bee.BaseBeeGoal { - private static final int MAX_TRAVELLING_TICKS = 600; + private static final int MAX_TRAVELLING_TICKS = 2400; int travellingTicks = Bee.this.level().random.nextInt(10); BeeGoToKnownFlowerGoal() { @@ -861,11 +867,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { @Override public boolean canBeeUse() { - return Bee.this.savedFlowerPos != null - && !Bee.this.hasRestriction() - && this.wantsToGoToKnownFlower() - && Bee.this.isFlowerValid(Bee.this.savedFlowerPos) - && !Bee.this.closerThan(Bee.this.savedFlowerPos, 2); + return Bee.this.savedFlowerPos != null && !Bee.this.hasRestriction() && this.wantsToGoToKnownFlower() && !Bee.this.closerThan(Bee.this.savedFlowerPos, 2); } @Override @@ -890,11 +892,11 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { public void tick() { if (Bee.this.savedFlowerPos != null) { this.travellingTicks++; - if (this.travellingTicks > this.adjustedTickDelay(600)) { - Bee.this.savedFlowerPos = null; + if (this.travellingTicks > this.adjustedTickDelay(2400)) { + Bee.this.dropFlower(); } else if (!Bee.this.navigation.isInProgress()) { if (Bee.this.isTooFarAway(Bee.this.savedFlowerPos)) { - Bee.this.savedFlowerPos = null; + Bee.this.dropFlower(); } else { Bee.this.pathfindRandomlyTowards(Bee.this.savedFlowerPos); } @@ -903,7 +905,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { } private boolean wantsToGoToKnownFlower() { - return Bee.this.ticksWithoutNectarSinceExitingHive > 2400; + return Bee.this.ticksWithoutNectarSinceExitingHive > 600; } } @@ -948,7 +950,11 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { blockState2 = blockState.setValue(SweetBerryBushBlock.AGE, j + 1); } } else if (blockState.is(Blocks.CAVE_VINES) || blockState.is(Blocks.CAVE_VINES_PLANT)) { - ((BonemealableBlock)blockState.getBlock()).performBonemeal((ServerLevel)Bee.this.level(), Bee.this.random, blockPos, blockState); + BonemealableBlock bonemealableBlock = (BonemealableBlock)blockState.getBlock(); + if (bonemealableBlock.isValidBonemealTarget(Bee.this.level(), blockPos, blockState)) { + bonemealableBlock.performBonemeal((ServerLevel)Bee.this.level(), Bee.this.random, blockPos, blockState); + blockState2 = Bee.this.level().getBlockState(blockPos); + } } if (blockState2 != null) { @@ -1039,8 +1045,6 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { class BeePollinateGoal extends Bee.BaseBeeGoal { private static final int MIN_POLLINATION_TICKS = 400; - private static final int MIN_FIND_FLOWER_RETRY_COOLDOWN = 20; - private static final int MAX_FIND_FLOWER_RETRY_COOLDOWN = 60; private final Predicate VALID_POLLINATION_BLOCKS = blockState -> { if (blockState.hasProperty(BlockStateProperties.WATERLOGGED) && (Boolean)blockState.getValue(BlockStateProperties.WATERLOGGED)) { return false; @@ -1055,6 +1059,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { private static final float SPEED_MODIFIER = 0.35F; private static final float HOVER_HEIGHT_WITHIN_FLOWER = 0.6F; private static final float HOVER_POS_OFFSET = 0.33333334F; + private static final int FLOWER_SEARCH_RADIUS = 5; private int successfulPollinatingTicks; private int lastSoundPlayedTick; private boolean pollinating; @@ -1062,6 +1067,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { private Vec3 hoverPos; private int pollinatingTicks; private static final int MAX_POLLINATING_TICKS = 600; + private Long2LongOpenHashMap unreachableFlowerCache = new Long2LongOpenHashMap(); BeePollinateGoal() { this.setFlags(EnumSet.of(Goal.Flag.MOVE)); @@ -1096,13 +1102,8 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { return false; } else if (Bee.this.level().isRaining()) { return false; - } else if (this.hasPollinatedLongEnough()) { - return Bee.this.random.nextFloat() < 0.2F; - } else if (Bee.this.tickCount % 20 == 0 && !Bee.this.isFlowerValid(Bee.this.savedFlowerPos)) { - Bee.this.savedFlowerPos = null; - return false; } else { - return true; + return this.hasPollinatedLongEnough() ? Bee.this.random.nextFloat() < 0.2F : true; } } @@ -1145,44 +1146,48 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { @Override public void tick() { - this.pollinatingTicks++; - if (this.pollinatingTicks > 600) { - Bee.this.savedFlowerPos = null; - } else { - Vec3 vec3 = Vec3.atBottomCenterOf(Bee.this.savedFlowerPos).add(0.0, 0.6F, 0.0); - if (vec3.distanceTo(Bee.this.position()) > 1.0) { - this.hoverPos = vec3; - this.setWantedPos(); + if (Bee.this.hasSavedFlowerPos()) { + this.pollinatingTicks++; + if (this.pollinatingTicks > 600) { + Bee.this.dropFlower(); + this.pollinating = false; + Bee.this.remainingCooldownBeforeLocatingNewFlower = 200; } else { - if (this.hoverPos == null) { + Vec3 vec3 = Vec3.atBottomCenterOf(Bee.this.savedFlowerPos).add(0.0, 0.6F, 0.0); + if (vec3.distanceTo(Bee.this.position()) > 1.0) { this.hoverPos = vec3; - } - - boolean bl = Bee.this.position().distanceTo(this.hoverPos) <= 0.1; - boolean bl2 = true; - if (!bl && this.pollinatingTicks > 600) { - Bee.this.savedFlowerPos = null; + this.setWantedPos(); } else { - if (bl) { - boolean bl3 = Bee.this.random.nextInt(25) == 0; - if (bl3) { - this.hoverPos = new Vec3(vec3.x() + this.getOffset(), vec3.y(), vec3.z() + this.getOffset()); - Bee.this.navigation.stop(); - } else { - bl2 = false; + if (this.hoverPos == null) { + this.hoverPos = vec3; + } + + boolean bl = Bee.this.position().distanceTo(this.hoverPos) <= 0.1; + boolean bl2 = true; + if (!bl && this.pollinatingTicks > 600) { + Bee.this.dropFlower(); + } else { + if (bl) { + boolean bl3 = Bee.this.random.nextInt(25) == 0; + if (bl3) { + this.hoverPos = new Vec3(vec3.x() + this.getOffset(), vec3.y(), vec3.z() + this.getOffset()); + Bee.this.navigation.stop(); + } else { + bl2 = false; + } + + Bee.this.getLookControl().setLookAt(vec3.x(), vec3.y(), vec3.z()); } - Bee.this.getLookControl().setLookAt(vec3.x(), vec3.y(), vec3.z()); - } + if (bl2) { + this.setWantedPos(); + } - if (bl2) { - this.setWantedPos(); - } - - this.successfulPollinatingTicks++; - if (Bee.this.random.nextFloat() < 0.05F && this.successfulPollinatingTicks > this.lastSoundPlayedTick + 60) { - this.lastSoundPlayedTick = this.successfulPollinatingTicks; - Bee.this.playSound(SoundEvents.BEE_POLLINATE, 1.0F, 1.0F); + this.successfulPollinatingTicks++; + if (Bee.this.random.nextFloat() < 0.05F && this.successfulPollinatingTicks > this.lastSoundPlayedTick + 60) { + this.lastSoundPlayedTick = this.successfulPollinatingTicks; + Bee.this.playSound(SoundEvents.BEE_POLLINATE, 1.0F, 1.0F); + } } } } @@ -1198,33 +1203,29 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { } private Optional findNearbyFlower() { - return this.findNearestBlock(this.VALID_POLLINATION_BLOCKS, 5.0); - } + Iterable iterable = BlockPos.withinManhattan(Bee.this.blockPosition(), 5, 5, 5); + Long2LongOpenHashMap long2LongOpenHashMap = new Long2LongOpenHashMap(); - private Optional findNearestBlock(Predicate predicate, double distance) { - BlockPos blockPos = Bee.this.blockPosition(); - BlockPos.MutableBlockPos mutableBlockPos = new BlockPos.MutableBlockPos(); - - for (int i = 0; i <= distance; i = i > 0 ? -i : 1 - i) { - for (int j = 0; j < distance; j++) { - for (int k = 0; k <= j; k = k > 0 ? -k : 1 - k) { - for (int l = k < j && k > -j ? j : 0; l <= j; l = l > 0 ? -l : 1 - l) { - mutableBlockPos.setWithOffset(blockPos, k, i - 1, l); - if (blockPos.closerThan(mutableBlockPos, distance) && predicate.test(Bee.this.level().getBlockState(mutableBlockPos))) { - return Optional.of(mutableBlockPos); - } - } + for (BlockPos blockPos : iterable) { + long l = this.unreachableFlowerCache.getOrDefault(blockPos.asLong(), Long.MIN_VALUE); + if (Bee.this.level().getGameTime() < l) { + long2LongOpenHashMap.put(blockPos.asLong(), l); + } else if (this.VALID_POLLINATION_BLOCKS.test(Bee.this.level().getBlockState(blockPos))) { + Path path = Bee.this.navigation.createPath(blockPos, 1); + if (path != null && path.canReach()) { + return Optional.of(blockPos); } + + long2LongOpenHashMap.put(blockPos.asLong(), Bee.this.level().getGameTime() + 600L); } } + this.unreachableFlowerCache = long2LongOpenHashMap; return Optional.empty(); } } class BeeWanderGoal extends Goal { - private static final int WANDER_THRESHOLD = 22; - BeeWanderGoal() { this.setFlags(EnumSet.of(Goal.Flag.MOVE)); } @@ -1250,7 +1251,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { @Nullable private Vec3 findPos() { Vec3 vec32; - if (Bee.this.isHiveValid() && !Bee.this.closerThan(Bee.this.hivePos, 22)) { + if (Bee.this.isHiveValid() && !Bee.this.closerThan(Bee.this.hivePos, this.getWanderThreshold())) { Vec3 vec3 = Vec3.atCenterOf(Bee.this.hivePos); vec32 = vec3.subtract(Bee.this.position()).normalize(); } else { @@ -1261,5 +1262,62 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { Vec3 vec33 = HoverRandomPos.getPos(Bee.this, 8, 7, vec32.x, vec32.z, (float) (Math.PI / 2), 3, 1); return vec33 != null ? vec33 : AirAndWaterRandomPos.getPos(Bee.this, 8, 4, -2, vec32.x, vec32.z, (float) (Math.PI / 2)); } + + private int getWanderThreshold() { + int i = !Bee.this.hasHive() && !Bee.this.hasSavedFlowerPos() ? 16 : 24; + return 48 - i; + } + } + + class ValidateFlowerGoal extends Bee.BaseBeeGoal { + private final int validateFlowerCooldown = Mth.nextInt(Bee.this.random, 20, 40); + private long lastValidateTick = -1L; + + @Override + public void start() { + if (Bee.this.savedFlowerPos != null && Bee.this.level().isLoaded(Bee.this.savedFlowerPos) && !this.isFlower(Bee.this.savedFlowerPos)) { + Bee.this.dropFlower(); + } + + this.lastValidateTick = Bee.this.level().getGameTime(); + } + + @Override + public boolean canBeeUse() { + return Bee.this.level().getGameTime() > this.lastValidateTick + this.validateFlowerCooldown; + } + + @Override + public boolean canBeeContinueToUse() { + return false; + } + + private boolean isFlower(BlockPos blockPos) { + return Bee.this.level().getBlockState(blockPos).is(BlockTags.FLOWERS); + } + } + + class ValidateHiveGoal extends Bee.BaseBeeGoal { + private final int VALIDATE_HIVE_COOLDOWN = Mth.nextInt(Bee.this.random, 20, 40); + private long lastValidateTick = -1L; + + @Override + public void start() { + if (Bee.this.hivePos != null && Bee.this.level().isLoaded(Bee.this.hivePos) && !Bee.this.isHiveValid()) { + Bee.this.dropHive(); + } + + this.lastValidateTick = Bee.this.level().getGameTime(); + } + + @Override + public boolean canBeeUse() { + return Bee.this.level().getGameTime() > this.lastValidateTick + this.VALIDATE_HIVE_COOLDOWN; + } + + @Override + public boolean canBeeContinueToUse() { + return false; + } } } diff --git a/net/minecraft/world/entity/animal/Bucketable.java b/net/minecraft/world/entity/animal/Bucketable.java index 456c342e..531566fd 100644 --- a/net/minecraft/world/entity/animal/Bucketable.java +++ b/net/minecraft/world/entity/animal/Bucketable.java @@ -99,7 +99,7 @@ public interface Bucketable { } entity.discard(); - return Optional.of(InteractionResult.sidedSuccess(level.isClientSide)); + return Optional.of(InteractionResult.SUCCESS); } else { return Optional.empty(); } diff --git a/net/minecraft/world/entity/animal/Cat.java b/net/minecraft/world/entity/animal/Cat.java index a7ec6cdf..300d6577 100644 --- a/net/minecraft/world/entity/animal/Cat.java +++ b/net/minecraft/world/entity/animal/Cat.java @@ -11,6 +11,7 @@ import net.minecraft.nbt.CompoundTag; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.network.syncher.SynchedEntityData.Builder; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.level.ServerLevel; @@ -29,15 +30,13 @@ import net.minecraft.world.InteractionResult; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.AgeableMob; import net.minecraft.world.entity.EntitySelector; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.entity.Mob; -import net.minecraft.world.entity.MobSpawnType; import net.minecraft.world.entity.Pose; import net.minecraft.world.entity.SpawnGroupData; import net.minecraft.world.entity.TamableAnimal; import net.minecraft.world.entity.VariantHolder; -import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.entity.ai.goal.AvoidEntityGoal; import net.minecraft.world.entity.ai.goal.BreedGoal; @@ -65,10 +64,6 @@ import net.minecraft.world.level.ServerLevelAccessor; import net.minecraft.world.level.block.BedBlock; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.storage.loot.BuiltInLootTables; -import net.minecraft.world.level.storage.loot.LootParams; -import net.minecraft.world.level.storage.loot.LootTable; -import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets; -import net.minecraft.world.level.storage.loot.parameters.LootContextParams; import net.minecraft.world.phys.AABB; import org.jetbrains.annotations.Nullable; @@ -89,6 +84,7 @@ public class Cat extends TamableAnimal implements VariantHolder itemStack.is(ItemTags.CAT_FOOD), true); @@ -154,9 +146,9 @@ public class Cat extends TamableAnimal implements VariantHolder ResourceKey.create(Registries.CAT_VARIANT, resourceLocation)) - .flatMap(BuiltInRegistries.CAT_VARIANT::getHolder) + .flatMap(BuiltInRegistries.CAT_VARIANT::get) .ifPresent(this::setVariant); if (compound.contains("CollarColor", 99)) { this.setCollarColor(DyeColor.byId(compound.getInt("CollarColor"))); @@ -182,7 +174,7 @@ public class Cat extends TamableAnimal implements VariantHolder 0.9F; + public SpawnGroupData finalizeSpawn( + ServerLevelAccessor serverLevelAccessor, DifficultyInstance difficultyInstance, EntitySpawnReason entitySpawnReason, @Nullable SpawnGroupData spawnGroupData + ) { + spawnGroupData = super.finalizeSpawn(serverLevelAccessor, difficultyInstance, entitySpawnReason, spawnGroupData); + boolean bl = serverLevelAccessor.getMoonBrightness() > 0.9F; TagKey tagKey = bl ? CatVariantTags.FULL_MOON_SPAWNS : CatVariantTags.DEFAULT_SPAWNS; - BuiltInRegistries.CAT_VARIANT.getRandomElementOf(tagKey, level.getRandom()).ifPresent(this::setVariant); - ServerLevel serverLevel = level.getLevel(); + BuiltInRegistries.CAT_VARIANT.getRandomElementOf(tagKey, serverLevelAccessor.getRandom()).ifPresent(this::setVariant); + ServerLevel serverLevel = serverLevelAccessor.getLevel(); if (serverLevel.structureManager().getStructureWithPieceAt(this.blockPosition(), StructureTags.CATS_SPAWN_AS_BLACK).isValid()) { - this.setVariant(BuiltInRegistries.CAT_VARIANT.getHolderOrThrow(CatVariant.ALL_BLACK)); + this.setVariant(BuiltInRegistries.CAT_VARIANT.getOrThrow(CatVariant.ALL_BLACK)); this.setPersistenceRequired(); } @@ -363,22 +368,23 @@ public class Cat extends TamableAnimal implements VariantHolder serverLevel.addFreshEntity( new ItemEntity( - this.cat.level(), + serverLevel, (double)mutableBlockPos.getX() - Mth.sin(this.cat.yBodyRot * (float) (Math.PI / 180.0)), mutableBlockPos.getY(), (double)mutableBlockPos.getZ() + Mth.cos(this.cat.yBodyRot * (float) (Math.PI / 180.0)), itemStack ) - ); - } + ) + ); } @Override diff --git a/net/minecraft/world/entity/animal/Chicken.java b/net/minecraft/world/entity/animal/Chicken.java index f5468974..b4056dbf 100644 --- a/net/minecraft/world/entity/animal/Chicken.java +++ b/net/minecraft/world/entity/animal/Chicken.java @@ -11,12 +11,12 @@ import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.AgeableMob; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityDimensions; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.entity.Mob; import net.minecraft.world.entity.Pose; -import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.entity.ai.attributes.AttributeSupplier.Builder; import net.minecraft.world.entity.ai.goal.BreedGoal; import net.minecraft.world.entity.ai.goal.FloatGoal; import net.minecraft.world.entity.ai.goal.FollowParentGoal; @@ -27,11 +27,11 @@ import net.minecraft.world.entity.ai.goal.TemptGoal; import net.minecraft.world.entity.ai.goal.WaterAvoidingRandomStrollGoal; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.Items; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.gameevent.GameEvent; import net.minecraft.world.level.pathfinder.PathType; +import net.minecraft.world.level.storage.loot.BuiltInLootTables; import net.minecraft.world.phys.Vec3; import org.jetbrains.annotations.Nullable; @@ -68,8 +68,8 @@ public class Chicken extends Animal { return this.isBaby() ? BABY_DIMENSIONS : super.getDefaultDimensions(pose); } - public static AttributeSupplier.Builder createAttributes() { - return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 4.0).add(Attributes.MOVEMENT_SPEED, 0.25); + public static Builder createAttributes() { + return Animal.createAnimalAttributes().add(Attributes.MAX_HEALTH, 4.0).add(Attributes.MOVEMENT_SPEED, 0.25); } @Override @@ -90,10 +90,12 @@ public class Chicken extends Animal { } this.flap = this.flap + this.flapping * 2.0F; - if (!this.level().isClientSide && this.isAlive() && !this.isBaby() && !this.isChickenJockey() && --this.eggTime <= 0) { - this.playSound(SoundEvents.CHICKEN_EGG, 1.0F, (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F); - this.spawnAtLocation(Items.EGG); - this.gameEvent(GameEvent.ENTITY_PLACE); + if (this.level() instanceof ServerLevel serverLevel && this.isAlive() && !this.isBaby() && !this.isChickenJockey() && --this.eggTime <= 0) { + if (this.dropFromGiftLootTable(serverLevel, BuiltInLootTables.CHICKEN_LAY, this::spawnAtLocation)) { + this.playSound(SoundEvents.CHICKEN_EGG, 1.0F, (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F); + this.gameEvent(GameEvent.ENTITY_PLACE); + } + this.eggTime = this.random.nextInt(6000) + 6000; } } @@ -130,7 +132,7 @@ public class Chicken extends Animal { @Nullable public Chicken getBreedOffspring(ServerLevel level, AgeableMob otherParent) { - return EntityType.CHICKEN.create(level); + return EntityType.CHICKEN.create(level, EntitySpawnReason.BREEDING); } @Override @@ -139,8 +141,8 @@ public class Chicken extends Animal { } @Override - protected int getBaseExperienceReward() { - return this.isChickenJockey() ? 10 : super.getBaseExperienceReward(); + protected int getBaseExperienceReward(ServerLevel serverLevel) { + return this.isChickenJockey() ? 10 : super.getBaseExperienceReward(serverLevel); } @Override diff --git a/net/minecraft/world/entity/animal/Cow.java b/net/minecraft/world/entity/animal/Cow.java index 137621fe..86e1917b 100644 --- a/net/minecraft/world/entity/animal/Cow.java +++ b/net/minecraft/world/entity/animal/Cow.java @@ -10,11 +10,11 @@ import net.minecraft.world.InteractionResult; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.AgeableMob; import net.minecraft.world.entity.EntityDimensions; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; -import net.minecraft.world.entity.Mob; import net.minecraft.world.entity.Pose; -import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.entity.ai.attributes.AttributeSupplier.Builder; import net.minecraft.world.entity.ai.goal.BreedGoal; import net.minecraft.world.entity.ai.goal.FloatGoal; import net.minecraft.world.entity.ai.goal.FollowParentGoal; @@ -55,8 +55,8 @@ public class Cow extends Animal { return stack.is(ItemTags.COW_FOOD); } - public static AttributeSupplier.Builder createAttributes() { - return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 10.0).add(Attributes.MOVEMENT_SPEED, 0.2F); + public static Builder createAttributes() { + return Animal.createAnimalAttributes().add(Attributes.MAX_HEALTH, 10.0).add(Attributes.MOVEMENT_SPEED, 0.2F); } @Override @@ -91,7 +91,7 @@ public class Cow extends Animal { player.playSound(SoundEvents.COW_MILK, 1.0F, 1.0F); ItemStack itemStack2 = ItemUtils.createFilledResult(itemStack, player, Items.MILK_BUCKET.getDefaultInstance()); player.setItemInHand(hand, itemStack2); - return InteractionResult.sidedSuccess(this.level().isClientSide); + return InteractionResult.SUCCESS; } else { return super.mobInteract(player, hand); } @@ -99,7 +99,7 @@ public class Cow extends Animal { @Nullable public Cow getBreedOffspring(ServerLevel level, AgeableMob otherParent) { - return EntityType.COW.create(level); + return EntityType.COW.create(level, EntitySpawnReason.BREEDING); } @Override diff --git a/net/minecraft/world/entity/animal/Dolphin.java b/net/minecraft/world/entity/animal/Dolphin.java index d2f9dd81..148bf7b1 100644 --- a/net/minecraft/world/entity/animal/Dolphin.java +++ b/net/minecraft/world/entity/animal/Dolphin.java @@ -2,6 +2,7 @@ package net.minecraft.world.entity.animal; import java.util.EnumSet; import java.util.List; +import java.util.Objects; import java.util.function.Predicate; import net.minecraft.core.BlockPos; import net.minecraft.core.particles.ParticleOptions; @@ -10,6 +11,7 @@ import net.minecraft.nbt.CompoundTag; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.network.syncher.SynchedEntityData.Builder; import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; @@ -23,14 +25,15 @@ import net.minecraft.world.InteractionResult; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.effect.MobEffectInstance; import net.minecraft.world.effect.MobEffects; +import net.minecraft.world.entity.AgeableMob; import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.EquipmentSlot; +import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.Mob; -import net.minecraft.world.entity.MobSpawnType; import net.minecraft.world.entity.MoverType; import net.minecraft.world.entity.SpawnGroupData; -import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.entity.ai.control.SmoothSwimmingLookControl; import net.minecraft.world.entity.ai.control.SmoothSwimmingMoveControl; @@ -59,7 +62,7 @@ import net.minecraft.world.level.pathfinder.PathComputationType; import net.minecraft.world.phys.Vec3; import org.jetbrains.annotations.Nullable; -public class Dolphin extends WaterAnimal { +public class Dolphin extends AgeableWaterCreature { private static final EntityDataAccessor TREASURE_POS = SynchedEntityData.defineId(Dolphin.class, EntityDataSerializers.BLOCK_POS); private static final EntityDataAccessor GOT_FISH = SynchedEntityData.defineId(Dolphin.class, EntityDataSerializers.BOOLEAN); private static final EntityDataAccessor MOISTNESS_LEVEL = SynchedEntityData.defineId(Dolphin.class, EntityDataSerializers.INT); @@ -67,6 +70,7 @@ public class Dolphin extends WaterAnimal { public static final int TOTAL_AIR_SUPPLY = 4800; private static final int TOTAL_MOISTNESS_LEVEL = 2400; public static final Predicate ALLOWED_ITEMS = itemEntity -> !itemEntity.hasPickUpDelay() && itemEntity.isAlive() && itemEntity.isInWater(); + public static final float BABY_SCALE = 0.65F; public Dolphin(EntityType entityType, Level level) { super(entityType, level); @@ -77,14 +81,27 @@ public class Dolphin extends WaterAnimal { @Nullable @Override - public SpawnGroupData finalizeSpawn(ServerLevelAccessor level, DifficultyInstance difficulty, MobSpawnType spawnType, @Nullable SpawnGroupData spawnGroupData) { + public SpawnGroupData finalizeSpawn( + ServerLevelAccessor serverLevelAccessor, DifficultyInstance difficultyInstance, EntitySpawnReason entitySpawnReason, @Nullable SpawnGroupData spawnGroupData + ) { this.setAirSupply(this.getMaxAirSupply()); this.setXRot(0.0F); - return super.finalizeSpawn(level, difficulty, spawnType, spawnGroupData); + SpawnGroupData spawnGroupData2 = (SpawnGroupData)Objects.requireNonNullElseGet(spawnGroupData, () -> new AgeableMob.AgeableMobGroupData(0.1F)); + return super.finalizeSpawn(serverLevelAccessor, difficultyInstance, entitySpawnReason, spawnGroupData2); + } + + @Nullable + public Dolphin getBreedOffspring(ServerLevel serverLevel, AgeableMob ageableMob) { + return EntityType.DOLPHIN.create(serverLevel, EntitySpawnReason.BREEDING); } @Override - protected void handleAirSupply(int airSupply) { + public float getAgeScale() { + return this.isBaby() ? 0.65F : 1.0F; + } + + @Override + protected void handleAirSupply(int i) { } public void setTreasurePos(BlockPos pos) { @@ -112,7 +129,7 @@ public class Dolphin extends WaterAnimal { } @Override - protected void defineSynchedData(SynchedEntityData.Builder builder) { + protected void defineSynchedData(Builder builder) { super.defineSynchedData(builder); builder.define(TREASURE_POS, BlockPos.ZERO); builder.define(GOT_FISH, false); @@ -157,7 +174,7 @@ public class Dolphin extends WaterAnimal { this.targetSelector.addGoal(1, new HurtByTargetGoal(this, Guardian.class).setAlertOthers()); } - public static AttributeSupplier.Builder createAttributes() { + public static net.minecraft.world.entity.ai.attributes.AttributeSupplier.Builder createAttributes() { return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 10.0).add(Attributes.MOVEMENT_SPEED, 1.2F).add(Attributes.ATTACK_DAMAGE, 3.0); } @@ -171,6 +188,11 @@ public class Dolphin extends WaterAnimal { this.playSound(SoundEvents.DOLPHIN_ATTACK, 1.0F, 1.0F); } + @Override + public boolean canAttack(LivingEntity target) { + return !this.isBaby() && super.canAttack(target); + } + @Override public int getMaxAirSupply() { return 4800; @@ -197,13 +219,12 @@ public class Dolphin extends WaterAnimal { } @Override - public boolean canTakeItem(ItemStack stack) { - EquipmentSlot equipmentSlot = this.getEquipmentSlotForItem(stack); - return !this.getItemBySlot(equipmentSlot).isEmpty() ? false : equipmentSlot == EquipmentSlot.MAINHAND && super.canTakeItem(stack); + protected boolean canDispenserEquipIntoSlot(EquipmentSlot equipmentSlot) { + return equipmentSlot == EquipmentSlot.MAINHAND && this.canPickUpLoot(); } @Override - protected void pickUpItem(ItemEntity itemEntity) { + protected void pickUpItem(ServerLevel serverLevel, ItemEntity itemEntity) { if (this.getItemBySlot(EquipmentSlot.MAINHAND).isEmpty()) { ItemStack itemStack = itemEntity.getItem(); if (this.canHoldItem(itemStack)) { @@ -278,9 +299,15 @@ public class Dolphin extends WaterAnimal { this.playSound(SoundEvents.DOLPHIN_EAT, 1.0F, 1.0F); } - this.setGotFish(true); - itemStack.consume(1, player); - return InteractionResult.sidedSuccess(this.level().isClientSide); + if (this.isBaby()) { + itemStack.consume(1, player); + this.ageUp(getSpeedUpSecondsWhenFeeding(-this.age), true); + } else { + this.setGotFish(true); + itemStack.consume(1, player); + } + + return InteractionResult.SUCCESS; } else { return super.mobInteract(player, hand); } @@ -320,7 +347,7 @@ public class Dolphin extends WaterAnimal { @Override public void travel(Vec3 travelVector) { - if (this.isEffectiveAi() && this.isInWater()) { + if (this.isControlledByLocalInstance() && this.isInWater()) { this.moveRelative(this.getSpeed(), travelVector); this.move(MoverType.SELF, this.getDeltaMovement()); this.setDeltaMovement(this.getDeltaMovement().scale(0.9)); @@ -434,7 +461,7 @@ public class Dolphin extends WaterAnimal { @Override public boolean canUse() { - this.player = this.dolphin.level().getNearestPlayer(Dolphin.SWIM_WITH_PLAYER_TARGETING, this.dolphin); + this.player = getServerLevel(this.dolphin).getNearestPlayer(Dolphin.SWIM_WITH_PLAYER_TARGETING, this.dolphin); return this.player == null ? false : this.player.isSwimming() && this.dolphin.getTarget() != this.player; } diff --git a/net/minecraft/world/entity/animal/Fox.java b/net/minecraft/world/entity/animal/Fox.java index 39667a30..9e70ade0 100644 --- a/net/minecraft/world/entity/animal/Fox.java +++ b/net/minecraft/world/entity/animal/Fox.java @@ -1,6 +1,5 @@ package net.minecraft.world.entity.animal; -import com.google.common.collect.Lists; import java.util.EnumSet; import java.util.List; import java.util.Optional; @@ -20,6 +19,7 @@ import net.minecraft.nbt.Tag; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.network.syncher.SynchedEntityData.Builder; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.sounds.SoundEvent; @@ -33,24 +33,23 @@ import net.minecraft.util.ByIdMap; import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; import net.minecraft.util.StringRepresentable; +import net.minecraft.util.ByIdMap.OutOfBoundsStrategy; import net.minecraft.world.DifficultyInstance; -import net.minecraft.world.InteractionHand; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.AgeableMob; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityDimensions; import net.minecraft.world.entity.EntitySelector; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.ExperienceOrb; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.Mob; -import net.minecraft.world.entity.MobSpawnType; import net.minecraft.world.entity.Pose; import net.minecraft.world.entity.SpawnGroupData; import net.minecraft.world.entity.TamableAnimal; import net.minecraft.world.entity.VariantHolder; -import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.entity.ai.control.LookControl; import net.minecraft.world.entity.ai.control.MoveControl; @@ -88,11 +87,12 @@ import net.minecraft.world.level.block.CaveVines; import net.minecraft.world.level.block.SweetBerryBushBlock; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.level.gameevent.GameEvent.Context; import net.minecraft.world.level.pathfinder.PathType; import net.minecraft.world.phys.Vec3; import org.jetbrains.annotations.Nullable; -public class Fox extends Animal implements VariantHolder { +public class Fox extends Animal implements VariantHolder { private static final EntityDataAccessor DATA_TYPE_ID = SynchedEntityData.defineId(Fox.class, EntityDataSerializers.INT); private static final EntityDataAccessor DATA_FLAGS_ID = SynchedEntityData.defineId(Fox.class, EntityDataSerializers.BYTE); private static final int FLAG_SITTING = 1; @@ -128,10 +128,11 @@ public class Fox extends Animal implements VariantHolder { this.setPathfindingMalus(PathType.DANGER_OTHER, 0.0F); this.setPathfindingMalus(PathType.DAMAGE_OTHER, 0.0F); this.setCanPickUpLoot(true); + this.getNavigation().setRequiredPathLength(32.0F); } @Override - protected void defineSynchedData(SynchedEntityData.Builder builder) { + protected void defineSynchedData(Builder builder) { super.defineSynchedData(builder); builder.define(DATA_TRUSTED_ID_0, Optional.empty()); builder.define(DATA_TRUSTED_ID_1, Optional.empty()); @@ -142,11 +143,11 @@ public class Fox extends Animal implements VariantHolder { @Override protected void registerGoals() { this.landTargetGoal = new NearestAttackableTargetGoal( - this, Animal.class, 10, false, false, livingEntity -> livingEntity instanceof Chicken || livingEntity instanceof Rabbit + this, Animal.class, 10, false, false, (livingEntity, serverLevel) -> livingEntity instanceof Chicken || livingEntity instanceof Rabbit ); this.turtleEggTargetGoal = new NearestAttackableTargetGoal(this, Turtle.class, 10, false, false, Turtle.BABY_ON_LAND_SELECTOR); this.fishTargetGoal = new NearestAttackableTargetGoal( - this, AbstractFish.class, 20, false, false, livingEntity -> livingEntity instanceof AbstractSchoolingFish + this, AbstractFish.class, 20, false, false, (livingEntity, serverLevel) -> livingEntity instanceof AbstractSchoolingFish ); this.goalSelector.addGoal(0, new Fox.FoxFloatGoal()); this.goalSelector.addGoal(0, new ClimbOnTopOfPowderSnowGoal(this, this.level())); @@ -179,16 +180,11 @@ public class Fox extends Animal implements VariantHolder { .addGoal( 3, new Fox.DefendTrustedTargetGoal( - LivingEntity.class, false, false, livingEntity -> TRUSTED_TARGET_SELECTOR.test(livingEntity) && !this.trusts(livingEntity.getUUID()) + LivingEntity.class, false, false, (livingEntity, serverLevel) -> TRUSTED_TARGET_SELECTOR.test(livingEntity) && !this.trusts(livingEntity.getUUID()) ) ); } - @Override - public SoundEvent getEatingSound(ItemStack stack) { - return SoundEvents.FOX_EAT; - } - @Override public void aiStep() { if (!this.level().isClientSide && this.isAlive() && this.isEffectiveAi()) { @@ -203,7 +199,7 @@ public class Fox extends Animal implements VariantHolder { this.ticksSinceEaten = 0; } else if (this.ticksSinceEaten > 560 && this.random.nextFloat() < 0.1F) { - this.playSound(this.getEatingSound(itemStack), 1.0F, 1.0F); + this.playEatingSound(); this.level().broadcastEntityEvent(this, (byte)45); } } @@ -285,18 +281,18 @@ public class Fox extends Animal implements VariantHolder { } } - public static AttributeSupplier.Builder createAttributes() { - return Mob.createMobAttributes() + public static net.minecraft.world.entity.ai.attributes.AttributeSupplier.Builder createAttributes() { + return Animal.createAnimalAttributes() .add(Attributes.MOVEMENT_SPEED, 0.3F) .add(Attributes.MAX_HEALTH, 10.0) - .add(Attributes.FOLLOW_RANGE, 32.0) .add(Attributes.ATTACK_DAMAGE, 2.0) - .add(Attributes.SAFE_FALL_DISTANCE, 5.0); + .add(Attributes.SAFE_FALL_DISTANCE, 5.0) + .add(Attributes.FOLLOW_RANGE, 32.0); } @Nullable public Fox getBreedOffspring(ServerLevel level, AgeableMob otherParent) { - Fox fox = EntityType.FOX.create(level); + Fox fox = EntityType.FOX.create(level, EntitySpawnReason.BREEDING); if (fox != null) { fox.setVariant(this.random.nextBoolean() ? this.getVariant() : ((Fox)otherParent).getVariant()); } @@ -304,40 +300,44 @@ public class Fox extends Animal implements VariantHolder { return fox; } - public static boolean checkFoxSpawnRules(EntityType fox, LevelAccessor level, MobSpawnType spawnType, BlockPos pos, RandomSource random) { - return level.getBlockState(pos.below()).is(BlockTags.FOXES_SPAWNABLE_ON) && isBrightEnoughToSpawn(level, pos); + public static boolean checkFoxSpawnRules( + EntityType entityType, LevelAccessor levelAccessor, EntitySpawnReason entitySpawnReason, BlockPos blockPos, RandomSource randomSource + ) { + return levelAccessor.getBlockState(blockPos.below()).is(BlockTags.FOXES_SPAWNABLE_ON) && isBrightEnoughToSpawn(levelAccessor, blockPos); } @Nullable @Override - public SpawnGroupData finalizeSpawn(ServerLevelAccessor level, DifficultyInstance difficulty, MobSpawnType spawnType, @Nullable SpawnGroupData spawnGroupData) { - Holder holder = level.getBiome(this.blockPosition()); - Fox.Type type = Fox.Type.byBiome(holder); + public SpawnGroupData finalizeSpawn( + ServerLevelAccessor serverLevelAccessor, DifficultyInstance difficultyInstance, EntitySpawnReason entitySpawnReason, @Nullable SpawnGroupData spawnGroupData + ) { + Holder holder = serverLevelAccessor.getBiome(this.blockPosition()); + Fox.Variant variant = Fox.Variant.byBiome(holder); boolean bl = false; if (spawnGroupData instanceof Fox.FoxGroupData foxGroupData) { - type = foxGroupData.type; + variant = foxGroupData.variant; if (foxGroupData.getGroupSize() >= 2) { bl = true; } } else { - spawnGroupData = new Fox.FoxGroupData(type); + spawnGroupData = new Fox.FoxGroupData(variant); } - this.setVariant(type); + this.setVariant(variant); if (bl) { this.setAge(-24000); } - if (level instanceof ServerLevel) { + if (serverLevelAccessor instanceof ServerLevel) { this.setTargetGoals(); } - this.populateDefaultEquipmentSlots(level.getRandom(), difficulty); - return super.finalizeSpawn(level, difficulty, spawnType, spawnGroupData); + this.populateDefaultEquipmentSlots(serverLevelAccessor.getRandom(), difficultyInstance); + return super.finalizeSpawn(serverLevelAccessor, difficultyInstance, entitySpawnReason, spawnGroupData); } private void setTargetGoals() { - if (this.getVariant() == Fox.Type.RED) { + if (this.getVariant() == Fox.Variant.RED) { this.targetSelector.addGoal(4, this.landTargetGoal); this.targetSelector.addGoal(4, this.turtleEggTargetGoal); this.targetSelector.addGoal(6, this.fishTargetGoal); @@ -349,12 +349,8 @@ public class Fox extends Animal implements VariantHolder { } @Override - protected void usePlayerItem(Player player, InteractionHand hand, ItemStack stack) { - if (this.isFood(stack)) { - this.playSound(this.getEatingSound(stack), 1.0F, 1.0F); - } - - super.usePlayerItem(player, hand, stack); + protected void playEatingSound() { + this.playSound(SoundEvents.FOX_EAT, 1.0F, 1.0F); } @Override @@ -362,19 +358,24 @@ public class Fox extends Animal implements VariantHolder { return this.isBaby() ? BABY_DIMENSIONS : super.getDefaultDimensions(pose); } - public Fox.Type getVariant() { - return Fox.Type.byId(this.entityData.get(DATA_TYPE_ID)); + public Fox.Variant getVariant() { + return Fox.Variant.byId(this.entityData.get(DATA_TYPE_ID)); } - public void setVariant(Fox.Type variant) { + public void setVariant(Fox.Variant variant) { this.entityData.set(DATA_TYPE_ID, variant.getId()); } List getTrustedUUIDs() { - List list = Lists.newArrayList(); - list.add((UUID)this.entityData.get(DATA_TRUSTED_ID_0).orElse(null)); - list.add((UUID)this.entityData.get(DATA_TRUSTED_ID_1).orElse(null)); - return list; + Optional optional = this.entityData.get(DATA_TRUSTED_ID_0); + Optional optional2 = this.entityData.get(DATA_TRUSTED_ID_1); + if (optional.isPresent() && optional2.isPresent()) { + return List.of((UUID)optional.get(), (UUID)optional2.get()); + } else if (optional.isPresent()) { + return List.of((UUID)optional.get()); + } else { + return optional2.isPresent() ? List.of((UUID)optional2.get()) : List.of(); + } } void addTrustedUUID(@Nullable UUID uuid) { @@ -392,9 +393,7 @@ public class Fox extends Animal implements VariantHolder { ListTag listTag = new ListTag(); for (UUID uUID : list) { - if (uUID != null) { - listTag.add(NbtUtils.createUUID(uUID)); - } + listTag.add(NbtUtils.createUUID(uUID)); } compound.put("Trusted", listTag); @@ -413,7 +412,7 @@ public class Fox extends Animal implements VariantHolder { } this.setSleeping(compound.getBoolean("Sleeping")); - this.setVariant(Fox.Type.byName(compound.getString("Type"))); + this.setVariant(Fox.Variant.byName(compound.getString("Type"))); this.setSitting(compound.getBoolean("Sitting")); this.setIsCrouching(compound.getBoolean("Crouching")); if (this.level() instanceof ServerLevel) { @@ -467,9 +466,8 @@ public class Fox extends Animal implements VariantHolder { } @Override - public boolean canTakeItem(ItemStack stack) { - EquipmentSlot equipmentSlot = this.getEquipmentSlotForItem(stack); - return !this.getItemBySlot(equipmentSlot).isEmpty() ? false : equipmentSlot == EquipmentSlot.MAINHAND && super.canTakeItem(stack); + protected boolean canDispenserEquipIntoSlot(EquipmentSlot equipmentSlot) { + return equipmentSlot == EquipmentSlot.MAINHAND && this.canPickUpLoot(); } @Override @@ -494,7 +492,7 @@ public class Fox extends Animal implements VariantHolder { } @Override - protected void pickUpItem(ItemEntity itemEntity) { + protected void pickUpItem(ServerLevel serverLevel, ItemEntity itemEntity) { ItemStack itemStack = itemEntity.getItem(); if (this.canHoldItem(itemStack)) { int i = itemStack.getCount(); @@ -602,12 +600,12 @@ public class Fox extends Animal implements VariantHolder { } @Override - public void setTarget(@Nullable LivingEntity target) { - if (this.isDefending() && target == null) { + public void setTarget(@Nullable LivingEntity livingEntity) { + if (this.isDefending() && livingEntity == null) { this.setDefending(false); } - super.setTarget(target); + super.setTarget(livingEntity); } void wakeUp() { @@ -674,7 +672,7 @@ public class Fox extends Animal implements VariantHolder { protected void dropAllDeathLoot(ServerLevel level, DamageSource damageSource) { ItemStack itemStack = this.getItemBySlot(EquipmentSlot.MAINHAND); if (!itemStack.isEmpty()) { - this.spawnAtLocation(itemStack); + this.spawnAtLocation(level, itemStack); this.setItemSlot(EquipmentSlot.MAINHAND, ItemStack.EMPTY); } @@ -713,10 +711,8 @@ public class Fox extends Animal implements VariantHolder { private LivingEntity trustedLastHurt; private int timestamp; - public DefendTrustedTargetGoal( - final Class targetType, final boolean mustSee, final boolean mustReach, @Nullable final Predicate predicate - ) { - super(Fox.this, targetType, 10, mustSee, mustReach, predicate); + public DefendTrustedTargetGoal(final Class class_, final boolean bl, final boolean bl2, @Nullable final TargetingConditions.Selector selector) { + super(Fox.this, class_, 10, bl, bl2, selector); } @Override @@ -724,8 +720,10 @@ public class Fox extends Animal implements VariantHolder { if (this.randomInterval > 0 && this.mob.getRandom().nextInt(this.randomInterval) != 0) { return false; } else { + ServerLevel serverLevel = getServerLevel(Fox.this.level()); + for (UUID uUID : Fox.this.getTrustedUUIDs()) { - if (uUID != null && Fox.this.level() instanceof ServerLevel && ((ServerLevel)Fox.this.level()).getEntity(uUID) instanceof LivingEntity livingEntity) { + if (serverLevel.getEntity(uUID) instanceof LivingEntity livingEntity) { this.trustedLastHurt = livingEntity; this.trustedLastHurtBy = livingEntity.getLastHurtByMob(); int i = livingEntity.getLastHurtByMobTimestamp(); @@ -785,16 +783,17 @@ public class Fox extends Animal implements VariantHolder { } } - public class FoxAlertableEntitiesSelector implements Predicate { - public boolean test(LivingEntity entity) { - if (entity instanceof Fox) { + public class FoxAlertableEntitiesSelector implements TargetingConditions.Selector { + @Override + public boolean test(LivingEntity livingEntity, ServerLevel serverLevel) { + if (livingEntity instanceof Fox) { return false; - } else if (entity instanceof Chicken || entity instanceof Rabbit || entity instanceof Monster) { + } else if (livingEntity instanceof Chicken || livingEntity instanceof Rabbit || livingEntity instanceof Monster) { return true; - } else if (entity instanceof TamableAnimal) { - return !((TamableAnimal)entity).isTame(); - } else if (!(entity instanceof Player) || !entity.isSpectator() && !((Player)entity).isCreative()) { - return Fox.this.trusts(entity.getUUID()) ? false : !entity.isSleeping() && !entity.isDiscrete(); + } else if (livingEntity instanceof TamableAnimal) { + return !((TamableAnimal)livingEntity).isTame(); + } else if (!(livingEntity instanceof Player) || !livingEntity.isSpectator() && !((Player)livingEntity).isCreative()) { + return Fox.this.trusts(livingEntity.getUUID()) ? false : !livingEntity.isSleeping() && !livingEntity.isDiscrete(); } else { return false; } @@ -813,7 +812,7 @@ public class Fox extends Animal implements VariantHolder { } protected boolean alertable() { - return !Fox.this.level() + return !getServerLevel(Fox.this.level()) .getNearbyEntities(LivingEntity.class, this.alertableTargeting, Fox.this, Fox.this.getBoundingBox().inflate(12.0, 6.0, 12.0)) .isEmpty(); } @@ -833,7 +832,7 @@ public class Fox extends Animal implements VariantHolder { @Override protected void breed() { - ServerLevel serverLevel = (ServerLevel)this.level; + ServerLevel serverLevel = this.level; Fox fox = (Fox)this.animal.getBreedOffspring(serverLevel, this.partner); if (fox != null) { ServerPlayer serverPlayer = this.animal.getLoveCause(); @@ -862,7 +861,7 @@ public class Fox extends Animal implements VariantHolder { fox.moveTo(this.animal.getX(), this.animal.getY(), this.animal.getZ(), 0.0F, 0.0F); serverLevel.addFreshEntityWithPassengers(fox); this.level.broadcastEntityEvent(this.animal, (byte)18); - if (this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) { + if (serverLevel.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) { this.level .addFreshEntity(new ExperienceOrb(this.level, this.animal.getX(), this.animal.getY(), this.animal.getZ(), this.animal.getRandom().nextInt(7) + 1)); } @@ -910,7 +909,7 @@ public class Fox extends Animal implements VariantHolder { } protected void onReachedTarget() { - if (Fox.this.level().getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { + if (getServerLevel(Fox.this.level()).getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { BlockState blockState = Fox.this.level().getBlockState(this.blockPos); if (blockState.is(Blocks.SWEET_BERRY_BUSH)) { this.pickSweetBerries(blockState); @@ -940,7 +939,7 @@ public class Fox extends Animal implements VariantHolder { Fox.this.playSound(SoundEvents.SWEET_BERRY_BUSH_PICK_BERRIES, 1.0F, 1.0F); Fox.this.level().setBlock(this.blockPos, state.setValue(SweetBerryBushBlock.AGE, 1), 2); - Fox.this.level().gameEvent(GameEvent.BLOCK_CHANGE, this.blockPos, GameEvent.Context.of(Fox.this)); + Fox.this.level().gameEvent(GameEvent.BLOCK_CHANGE, this.blockPos, Context.of(Fox.this)); } @Override @@ -999,11 +998,11 @@ public class Fox extends Animal implements VariantHolder { } public static class FoxGroupData extends AgeableMob.AgeableMobGroupData { - public final Fox.Type type; + public final Fox.Variant variant; - public FoxGroupData(Fox.Type type) { + public FoxGroupData(Fox.Variant variant) { super(false); - this.type = type; + this.variant = variant; } } @@ -1050,7 +1049,7 @@ public class Fox extends Animal implements VariantHolder { protected void checkAndPerformAttack(LivingEntity target) { if (this.canPerformAttack(target)) { this.resetAttackCooldown(); - this.mob.doHurtTarget(target); + this.mob.doHurtTarget(getServerLevel(this.mob), target); Fox.this.playSound(SoundEvents.FOX_BITE, 1.0F, 1.0F); } } @@ -1176,7 +1175,7 @@ public class Fox extends Animal implements VariantHolder { } if (livingEntity != null && Fox.this.distanceTo(livingEntity) <= 2.0F) { - Fox.this.doHurtTarget(livingEntity); + Fox.this.doHurtTarget(getServerLevel(Fox.this.level()), livingEntity); } else if (Fox.this.getXRot() > 0.0F && Fox.this.onGround() && (float)Fox.this.getDeltaMovement().y != 0.0F @@ -1447,18 +1446,18 @@ public class Fox extends Animal implements VariantHolder { } } - public static enum Type implements StringRepresentable { + public static enum Variant implements StringRepresentable { RED(0, "red"), SNOW(1, "snow"); - public static final StringRepresentable.EnumCodec CODEC = StringRepresentable.fromEnum(Fox.Type::values); - private static final IntFunction BY_ID = ByIdMap.continuous(Fox.Type::getId, values(), ByIdMap.OutOfBoundsStrategy.ZERO); + public static final StringRepresentable.EnumCodec CODEC = StringRepresentable.fromEnum(Fox.Variant::values); + private static final IntFunction BY_ID = ByIdMap.continuous(Fox.Variant::getId, values(), OutOfBoundsStrategy.ZERO); private final int id; private final String name; - private Type(final int id, final String name) { - this.id = id; - this.name = name; + private Variant(final int j, final String string2) { + this.id = j; + this.name = string2; } @Override @@ -1470,16 +1469,16 @@ public class Fox extends Animal implements VariantHolder { return this.id; } - public static Fox.Type byName(String name) { - return (Fox.Type)CODEC.byName(name, RED); + public static Fox.Variant byName(String string) { + return (Fox.Variant)CODEC.byName(string, RED); } - public static Fox.Type byId(int index) { - return (Fox.Type)BY_ID.apply(index); + public static Fox.Variant byId(int i) { + return (Fox.Variant)BY_ID.apply(i); } - public static Fox.Type byBiome(Holder biome) { - return biome.is(BiomeTags.SPAWNS_SNOW_FOXES) ? SNOW : RED; + public static Fox.Variant byBiome(Holder holder) { + return holder.is(BiomeTags.SPAWNS_SNOW_FOXES) ? SNOW : RED; } } } diff --git a/net/minecraft/world/entity/animal/IronGolem.java b/net/minecraft/world/entity/animal/IronGolem.java index 099f980c..956b1f4c 100644 --- a/net/minecraft/world/entity/animal/IronGolem.java +++ b/net/minecraft/world/entity/animal/IronGolem.java @@ -6,6 +6,7 @@ import net.minecraft.nbt.CompoundTag; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.network.syncher.SynchedEntityData.Builder; import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; @@ -20,7 +21,6 @@ import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.Mob; import net.minecraft.world.entity.NeutralMob; -import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.entity.ai.goal.GolemRandomStrollInVillageGoal; import net.minecraft.world.entity.ai.goal.LookAtPlayerGoal; @@ -75,18 +75,21 @@ public class IronGolem extends AbstractGolem implements NeutralMob { this.targetSelector.addGoal(3, new NearestAttackableTargetGoal(this, Player.class, 10, true, false, this::isAngryAt)); this.targetSelector .addGoal( - 3, new NearestAttackableTargetGoal(this, Mob.class, 5, false, false, livingEntity -> livingEntity instanceof Enemy && !(livingEntity instanceof Creeper)) + 3, + new NearestAttackableTargetGoal( + this, Mob.class, 5, false, false, (livingEntity, serverLevel) -> livingEntity instanceof Enemy && !(livingEntity instanceof Creeper) + ) ); this.targetSelector.addGoal(4, new ResetUniversalAngerTargetGoal<>(this, false)); } @Override - protected void defineSynchedData(SynchedEntityData.Builder builder) { + protected void defineSynchedData(Builder builder) { super.defineSynchedData(builder); builder.define(DATA_FLAGS_ID, (byte)0); } - public static AttributeSupplier.Builder createAttributes() { + public static net.minecraft.world.entity.ai.attributes.AttributeSupplier.Builder createAttributes() { return Mob.createMobAttributes() .add(Attributes.MAX_HEALTH, 100.0) .add(Attributes.MOVEMENT_SPEED, 0.25) @@ -184,20 +187,18 @@ public class IronGolem extends AbstractGolem implements NeutralMob { } @Override - public boolean doHurtTarget(Entity target) { + public boolean doHurtTarget(ServerLevel serverLevel, Entity entity) { this.attackAnimationTick = 10; - this.level().broadcastEntityEvent(this, (byte)4); + serverLevel.broadcastEntityEvent(this, (byte)4); float f = this.getAttackDamage(); float g = (int)f > 0 ? f / 2.0F + this.random.nextInt((int)f) : f; DamageSource damageSource = this.damageSources().mobAttack(this); - boolean bl = target.hurt(damageSource, g); + boolean bl = entity.hurtServer(serverLevel, damageSource, g); if (bl) { - double d = target instanceof LivingEntity livingEntity ? livingEntity.getAttributeValue(Attributes.KNOCKBACK_RESISTANCE) : 0.0; + double d = entity instanceof LivingEntity livingEntity ? livingEntity.getAttributeValue(Attributes.KNOCKBACK_RESISTANCE) : 0.0; double e = Math.max(0.0, 1.0 - d); - target.setDeltaMovement(target.getDeltaMovement().add(0.0, 0.4F * e, 0.0)); - if (this.level() instanceof ServerLevel serverLevel) { - EnchantmentHelper.doPostAttackEffects(serverLevel, target, damageSource); - } + entity.setDeltaMovement(entity.getDeltaMovement().add(0.0, 0.4F * e, 0.0)); + EnchantmentHelper.doPostAttackEffects(serverLevel, entity, damageSource); } this.playSound(SoundEvents.IRON_GOLEM_ATTACK, 1.0F, 1.0F); @@ -205,9 +206,9 @@ public class IronGolem extends AbstractGolem implements NeutralMob { } @Override - public boolean hurt(DamageSource source, float amount) { - Crackiness.Level level = this.getCrackiness(); - boolean bl = super.hurt(source, amount); + public boolean hurtServer(ServerLevel serverLevel, DamageSource damageSource, float f) { + net.minecraft.world.entity.Crackiness.Level level = this.getCrackiness(); + boolean bl = super.hurtServer(serverLevel, damageSource, f); if (bl && this.getCrackiness() != level) { this.playSound(SoundEvents.IRON_GOLEM_DAMAGE, 1.0F, 1.0F); } @@ -215,7 +216,7 @@ public class IronGolem extends AbstractGolem implements NeutralMob { return bl; } - public Crackiness.Level getCrackiness() { + public net.minecraft.world.entity.Crackiness.Level getCrackiness() { return Crackiness.GOLEM.byFraction(this.getHealth() / this.getMaxHealth()); } @@ -271,7 +272,7 @@ public class IronGolem extends AbstractGolem implements NeutralMob { float g = 1.0F + (this.random.nextFloat() - this.random.nextFloat()) * 0.2F; this.playSound(SoundEvents.IRON_GOLEM_REPAIR, 1.0F, g); itemStack.consume(1, player); - return InteractionResult.sidedSuccess(this.level().isClientSide); + return InteractionResult.SUCCESS; } } } diff --git a/net/minecraft/world/entity/animal/MushroomCow.java b/net/minecraft/world/entity/animal/MushroomCow.java index 7431b142..9872d3df 100644 --- a/net/minecraft/world/entity/animal/MushroomCow.java +++ b/net/minecraft/world/entity/animal/MushroomCow.java @@ -10,6 +10,7 @@ import net.minecraft.nbt.NbtOps; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.network.syncher.SynchedEntityData.Builder; import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; @@ -21,9 +22,10 @@ import net.minecraft.util.StringRepresentable; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.AgeableMob; +import net.minecraft.world.entity.ConversionParams; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LightningBolt; -import net.minecraft.world.entity.MobSpawnType; import net.minecraft.world.entity.Shearable; import net.minecraft.world.entity.VariantHolder; import net.minecraft.world.entity.item.ItemEntity; @@ -39,9 +41,10 @@ import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.SuspiciousEffectHolder; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.level.storage.loot.BuiltInLootTables; import org.jetbrains.annotations.Nullable; -public class MushroomCow extends Cow implements Shearable, VariantHolder { +public class MushroomCow extends Cow implements Shearable, VariantHolder { private static final EntityDataAccessor DATA_TYPE = SynchedEntityData.defineId(MushroomCow.class, EntityDataSerializers.STRING); private static final int MUTATE_CHANCE = 1024; private static final String TAG_STEW_EFFECTS = "stew_effects"; @@ -63,25 +66,25 @@ public class MushroomCow extends Cow implements Shearable, VariantHolder mushroomCow, LevelAccessor level, MobSpawnType spawnType, BlockPos pos, RandomSource randomSource + EntityType entityType, LevelAccessor levelAccessor, EntitySpawnReason entitySpawnReason, BlockPos blockPos, RandomSource randomSource ) { - return level.getBlockState(pos.below()).is(BlockTags.MOOSHROOMS_SPAWNABLE_ON) && isBrightEnoughToSpawn(level, pos); + return levelAccessor.getBlockState(blockPos.below()).is(BlockTags.MOOSHROOMS_SPAWNABLE_ON) && isBrightEnoughToSpawn(levelAccessor, blockPos); } @Override public void thunderHit(ServerLevel level, LightningBolt lightning) { UUID uUID = lightning.getUUID(); if (!uUID.equals(this.lastLightningBoltUUID)) { - this.setVariant(this.getVariant() == MushroomCow.MushroomType.RED ? MushroomCow.MushroomType.BROWN : MushroomCow.MushroomType.RED); + this.setVariant(this.getVariant() == MushroomCow.Variant.RED ? MushroomCow.Variant.BROWN : MushroomCow.Variant.RED); this.lastLightningBoltUUID = uUID; this.playSound(SoundEvents.MOOSHROOM_CONVERT, 2.0F, 1.0F); } } @Override - protected void defineSynchedData(SynchedEntityData.Builder builder) { + protected void defineSynchedData(Builder builder) { super.defineSynchedData(builder); - builder.define(DATA_TYPE, MushroomCow.MushroomType.RED.type); + builder.define(DATA_TYPE, MushroomCow.Variant.RED.type); } @Override @@ -109,16 +112,16 @@ public class MushroomCow extends Cow implements Shearable, VariantHolder { + serverLevel.sendParticles(ParticleTypes.EXPLOSION, this.getX(), this.getY(0.5), this.getZ(), 1, 0.0, 0.0, 0.0, 0.0); + this.dropFromShearingLootTable(serverLevel, BuiltInLootTables.SHEAR_MOOSHROOM, itemStack, (serverLevelxx, itemStackxx) -> { + for (int i = 0; i < itemStackxx.getCount(); i++) { + serverLevelxx.addFreshEntity(new ItemEntity(this.level(), this.getX(), this.getY(1.0), this.getZ(), itemStackxx.copyWithCount(1))); } - - if (this.isPersistenceRequired()) { - cow.setPersistenceRequired(); - } - - cow.setInvulnerable(this.isInvulnerable()); - this.level().addFreshEntity(cow); - - for (int i = 0; i < 5; i++) { - this.level() - .addFreshEntity(new ItemEntity(this.level(), this.getX(), this.getY(1.0), this.getZ(), new ItemStack(this.getVariant().blockState.getBlock()))); - } - } - } + }); + }); } @Override @@ -211,7 +196,7 @@ public class MushroomCow extends Cow implements Shearable, VariantHolder CODEC = StringRepresentable.fromEnum(MushroomCow.MushroomType::values); + public static final StringRepresentable.EnumCodec CODEC = StringRepresentable.fromEnum(MushroomCow.Variant::values); final String type; - final BlockState blockState; + private final BlockState blockState; - private MushroomType(final String type, final BlockState blockState) { - this.type = type; + private Variant(final String string2, final BlockState blockState) { + this.type = string2; this.blockState = blockState; } - /** - * A block state that is rendered on the back of the mooshroom. - */ public BlockState getBlockState() { return this.blockState; } @@ -280,8 +262,8 @@ public class MushroomCow extends Cow implements Shearable, VariantHolder 2400; } - public static AttributeSupplier.Builder createAttributes() { - return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 10.0).add(Attributes.MOVEMENT_SPEED, 0.3F).add(Attributes.ATTACK_DAMAGE, 3.0); + public static net.minecraft.world.entity.ai.attributes.AttributeSupplier.Builder createAttributes() { + return Animal.createAnimalAttributes().add(Attributes.MAX_HEALTH, 10.0).add(Attributes.MOVEMENT_SPEED, 0.3F).add(Attributes.ATTACK_DAMAGE, 3.0); } @Nullable @@ -170,7 +169,7 @@ public class Ocelot extends Animal { } } - return InteractionResult.sidedSuccess(this.level().isClientSide); + return InteractionResult.SUCCESS; } else { return super.mobInteract(player, hand); } @@ -214,7 +213,7 @@ public class Ocelot extends Animal { @Nullable public Ocelot getBreedOffspring(ServerLevel level, AgeableMob otherParent) { - return EntityType.OCELOT.create(level); + return EntityType.OCELOT.create(level, EntitySpawnReason.BREEDING); } @Override @@ -222,8 +221,10 @@ public class Ocelot extends Animal { return stack.is(ItemTags.OCELOT_FOOD); } - public static boolean checkOcelotSpawnRules(EntityType ocelot, LevelAccessor level, MobSpawnType spawnType, BlockPos pos, RandomSource random) { - return random.nextInt(3) != 0; + public static boolean checkOcelotSpawnRules( + EntityType entityType, LevelAccessor levelAccessor, EntitySpawnReason entitySpawnReason, BlockPos blockPos, RandomSource randomSource + ) { + return randomSource.nextInt(3) != 0; } @Override @@ -245,12 +246,14 @@ public class Ocelot extends Animal { @Nullable @Override - public SpawnGroupData finalizeSpawn(ServerLevelAccessor level, DifficultyInstance difficulty, MobSpawnType spawnType, @Nullable SpawnGroupData spawnGroupData) { + public SpawnGroupData finalizeSpawn( + ServerLevelAccessor serverLevelAccessor, DifficultyInstance difficultyInstance, EntitySpawnReason entitySpawnReason, @Nullable SpawnGroupData spawnGroupData + ) { if (spawnGroupData == null) { spawnGroupData = new AgeableMob.AgeableMobGroupData(1.0F); } - return super.finalizeSpawn(level, difficulty, spawnType, spawnGroupData); + return super.finalizeSpawn(serverLevelAccessor, difficultyInstance, entitySpawnReason, spawnGroupData); } @Override diff --git a/net/minecraft/world/entity/animal/Panda.java b/net/minecraft/world/entity/animal/Panda.java index cf7955bf..3161e3e8 100644 --- a/net/minecraft/world/entity/animal/Panda.java +++ b/net/minecraft/world/entity/animal/Panda.java @@ -3,7 +3,6 @@ package net.minecraft.world.entity.animal; import java.util.EnumSet; import java.util.List; import java.util.function.IntFunction; -import java.util.function.Predicate; import net.minecraft.core.BlockPos; import net.minecraft.core.particles.ItemParticleOption; import net.minecraft.core.particles.ParticleTypes; @@ -11,6 +10,7 @@ import net.minecraft.nbt.CompoundTag; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.network.syncher.SynchedEntityData.Builder; import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; @@ -20,6 +20,7 @@ import net.minecraft.util.ByIdMap; import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; import net.minecraft.util.StringRepresentable; +import net.minecraft.util.ByIdMap.OutOfBoundsStrategy; import net.minecraft.world.DifficultyInstance; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; @@ -30,14 +31,13 @@ import net.minecraft.world.entity.EntityAttachment; import net.minecraft.world.entity.EntityAttachments; import net.minecraft.world.entity.EntityDimensions; import net.minecraft.world.entity.EntitySelector; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.Mob; -import net.minecraft.world.entity.MobSpawnType; import net.minecraft.world.entity.Pose; import net.minecraft.world.entity.SpawnGroupData; -import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.entity.ai.control.MoveControl; import net.minecraft.world.entity.ai.goal.AvoidEntityGoal; @@ -64,10 +64,6 @@ import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.gameevent.GameEvent; import net.minecraft.world.level.storage.loot.BuiltInLootTables; -import net.minecraft.world.level.storage.loot.LootParams; -import net.minecraft.world.level.storage.loot.LootTable; -import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets; -import net.minecraft.world.level.storage.loot.parameters.LootContextParams; import net.minecraft.world.phys.Vec3; import org.jetbrains.annotations.Nullable; @@ -101,10 +97,6 @@ public class Panda extends Animal { private float rollAmount; private float rollAmountO; Panda.PandaLookAtPlayerGoal lookAtPlayerGoal; - static final Predicate PANDA_ITEMS = itemEntity -> { - ItemStack itemStack = itemEntity.getItem(); - return (itemStack.is(Blocks.BAMBOO.asItem()) || itemStack.is(Blocks.CAKE.asItem())) && itemEntity.isAlive() && !itemEntity.hasPickUpDelay(); - }; public Panda(EntityType entityType, Level level) { super(entityType, level); @@ -115,9 +107,8 @@ public class Panda extends Animal { } @Override - public boolean canTakeItem(ItemStack stack) { - EquipmentSlot equipmentSlot = this.getEquipmentSlotForItem(stack); - return !this.getItemBySlot(equipmentSlot).isEmpty() ? false : equipmentSlot == EquipmentSlot.MAINHAND && super.canTakeItem(stack); + protected boolean canDispenserEquipIntoSlot(EquipmentSlot equipmentSlot) { + return equipmentSlot == EquipmentSlot.MAINHAND && this.canPickUpLoot(); } public int getUnhappyCounter() { @@ -212,7 +203,7 @@ public class Panda extends Animal { } @Override - protected void defineSynchedData(SynchedEntityData.Builder builder) { + protected void defineSynchedData(Builder builder) { super.defineSynchedData(builder); builder.define(UNHAPPY_COUNTER, 0); builder.define(SNEEZE_COUNTER, 0); @@ -252,7 +243,7 @@ public class Panda extends Animal { @Nullable @Override public AgeableMob getBreedOffspring(ServerLevel level, AgeableMob otherParent) { - Panda panda = EntityType.PANDA.create(level); + Panda panda = EntityType.PANDA.create(level, EntitySpawnReason.BREEDING); if (panda != null) { if (otherParent instanceof Panda panda2) { panda.setGeneFromParents(this, panda2); @@ -285,8 +276,8 @@ public class Panda extends Animal { this.targetSelector.addGoal(1, new Panda.PandaHurtByTargetGoal(this).setAlertOthers(new Class[0])); } - public static AttributeSupplier.Builder createAttributes() { - return Mob.createMobAttributes().add(Attributes.MOVEMENT_SPEED, 0.15F).add(Attributes.ATTACK_DAMAGE, 6.0); + public static net.minecraft.world.entity.ai.attributes.AttributeSupplier.Builder createAttributes() { + return Animal.createAnimalAttributes().add(Attributes.MOVEMENT_SPEED, 0.15F).add(Attributes.ATTACK_DAMAGE, 6.0); } public Panda.Gene getVariant() { @@ -324,12 +315,12 @@ public class Panda extends Animal { } @Override - public boolean doHurtTarget(Entity target) { + public boolean doHurtTarget(ServerLevel serverLevel, Entity entity) { if (!this.isAggressive()) { this.didBite = true; } - return super.doHurtTarget(target); + return super.doHurtTarget(serverLevel, entity); } @Override @@ -407,7 +398,7 @@ public class Panda extends Animal { if (this.isEating()) { this.addEatingParticles(); if (!this.level().isClientSide && this.getEatCounter() > 80 && this.random.nextInt(20) == 1) { - if (this.getEatCounter() > 100 && this.isFoodOrCake(this.getItemBySlot(EquipmentSlot.MAINHAND))) { + if (this.getEatCounter() > 100 && this.getItemBySlot(EquipmentSlot.MAINHAND).is(ItemTags.PANDA_EATS_FROM_GROUND)) { if (!this.level().isClientSide) { this.setItemSlot(EquipmentSlot.MAINHAND, ItemStack.EMPTY); this.gameEvent(GameEvent.EAT); @@ -524,23 +515,14 @@ public class Panda extends Animal { } } - if (!level.isClientSide() && level.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) { - ServerLevel serverLevel = (ServerLevel)level; - LootTable lootTable = serverLevel.getServer().reloadableRegistries().getLootTable(BuiltInLootTables.PANDA_SNEEZE); - LootParams lootParams = new LootParams.Builder(serverLevel) - .withParameter(LootContextParams.ORIGIN, this.position()) - .withParameter(LootContextParams.THIS_ENTITY, this) - .create(LootContextParamSets.GIFT); - - for (ItemStack itemStack : lootTable.getRandomItems(lootParams)) { - this.spawnAtLocation(itemStack); - } + if (this.level() instanceof ServerLevel serverLevel && serverLevel.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) { + this.dropFromGiftLootTable(serverLevel, BuiltInLootTables.PANDA_SNEEZE, this::spawnAtLocation); } } @Override - protected void pickUpItem(ItemEntity itemEntity) { - if (this.getItemBySlot(EquipmentSlot.MAINHAND).isEmpty() && PANDA_ITEMS.test(itemEntity)) { + protected void pickUpItem(ServerLevel serverLevel, ItemEntity itemEntity) { + if (this.getItemBySlot(EquipmentSlot.MAINHAND).isEmpty() && canPickUpAndEat(itemEntity)) { this.onItemPickup(itemEntity); ItemStack itemStack = itemEntity.getItem(); this.setItemSlot(EquipmentSlot.MAINHAND, itemStack); @@ -551,18 +533,17 @@ public class Panda extends Animal { } @Override - public boolean hurt(DamageSource source, float amount) { - if (!this.level().isClientSide) { - this.sit(false); - } - - return super.hurt(source, amount); + public boolean hurtServer(ServerLevel serverLevel, DamageSource damageSource, float f) { + this.sit(false); + return super.hurtServer(serverLevel, damageSource, f); } @Nullable @Override - public SpawnGroupData finalizeSpawn(ServerLevelAccessor level, DifficultyInstance difficulty, MobSpawnType spawnType, @Nullable SpawnGroupData spawnGroupData) { - RandomSource randomSource = level.getRandom(); + public SpawnGroupData finalizeSpawn( + ServerLevelAccessor serverLevelAccessor, DifficultyInstance difficultyInstance, EntitySpawnReason entitySpawnReason, @Nullable SpawnGroupData spawnGroupData + ) { + RandomSource randomSource = serverLevelAccessor.getRandom(); this.setMainGene(Panda.Gene.getRandom(randomSource)); this.setHiddenGene(Panda.Gene.getRandom(randomSource)); this.setAttributes(); @@ -570,7 +551,7 @@ public class Panda extends Animal { spawnGroupData = new AgeableMob.AgeableMobGroupData(0.2F); } - return super.finalizeSpawn(level, difficulty, spawnType, spawnGroupData); + return super.finalizeSpawn(serverLevelAccessor, difficultyInstance, entitySpawnReason, spawnGroupData); } public void setGeneFromParents(Panda father, @Nullable Panda mother) { @@ -628,7 +609,7 @@ public class Panda extends Animal { return InteractionResult.PASS; } else if (this.isOnBack()) { this.setOnBack(false); - return InteractionResult.sidedSuccess(this.level().isClientSide); + return InteractionResult.SUCCESS; } else if (this.isFood(itemStack)) { if (this.getTarget() != null) { this.gotBamboo = true; @@ -641,7 +622,7 @@ public class Panda extends Animal { this.usePlayerItem(player, hand, itemStack); this.setInLove(player); } else { - if (this.level().isClientSide || this.isSitting() || this.isInWater()) { + if (!(this.level() instanceof ServerLevel serverLevel) || this.isSitting() || this.isInWater()) { return InteractionResult.PASS; } @@ -649,14 +630,14 @@ public class Panda extends Animal { this.eat(true); ItemStack itemStack2 = this.getItemBySlot(EquipmentSlot.MAINHAND); if (!itemStack2.isEmpty() && !player.hasInfiniteMaterials()) { - this.spawnAtLocation(itemStack2); + this.spawnAtLocation(serverLevel, itemStack2); } this.setItemSlot(EquipmentSlot.MAINHAND, new ItemStack(itemStack.getItem(), 1)); this.usePlayerItem(player, hand, itemStack); } - return InteractionResult.SUCCESS; + return InteractionResult.SUCCESS_SERVER; } else { return InteractionResult.PASS; } @@ -682,10 +663,6 @@ public class Panda extends Animal { return stack.is(ItemTags.PANDA_FOOD); } - private boolean isFoodOrCake(ItemStack stack) { - return this.isFood(stack) || stack.is(Blocks.CAKE.asItem()); - } - @Nullable @Override protected SoundEvent getDeathSound() { @@ -707,6 +684,10 @@ public class Panda extends Animal { return this.isBaby() ? BABY_DIMENSIONS : super.getDefaultDimensions(pose); } + private static boolean canPickUpAndEat(ItemEntity itemEntity) { + return itemEntity.getItem().is(ItemTags.PANDA_EATS_FROM_GROUND) && itemEntity.isAlive() && !itemEntity.hasPickUpDelay(); + } + public static enum Gene implements StringRepresentable { NORMAL(0, "normal", false), LAZY(1, "lazy", false), @@ -717,7 +698,7 @@ public class Panda extends Animal { AGGRESSIVE(6, "aggressive", false); public static final StringRepresentable.EnumCodec CODEC = StringRepresentable.fromEnum(Panda.Gene::values); - private static final IntFunction BY_ID = ByIdMap.continuous(Panda.Gene::getId, values(), ByIdMap.OutOfBoundsStrategy.ZERO); + private static final IntFunction BY_ID = ByIdMap.continuous(Panda.Gene::getId, values(), OutOfBoundsStrategy.ZERO); private static final int MAX_GENE = 6; private final int id; private final String name; @@ -936,21 +917,18 @@ public class Panda extends Animal { return false; } else { if (this.lookAt == null) { + ServerLevel serverLevel = getServerLevel(this.mob); if (this.lookAtType == Player.class) { - this.lookAt = this.mob.level().getNearestPlayer(this.lookAtContext, this.mob, this.mob.getX(), this.mob.getEyeY(), this.mob.getZ()); + this.lookAt = serverLevel.getNearestPlayer(this.lookAtContext, this.mob, this.mob.getX(), this.mob.getEyeY(), this.mob.getZ()); } else { - this.lookAt = this.mob - .level() - .getNearestEntity( - this.mob - .level() - .getEntitiesOfClass(this.lookAtType, this.mob.getBoundingBox().inflate(this.lookDistance, 3.0, this.lookDistance), livingEntity -> true), - this.lookAtContext, - this.mob, - this.mob.getX(), - this.mob.getEyeY(), - this.mob.getZ() - ); + this.lookAt = serverLevel.getNearestEntity( + this.mob.level().getEntitiesOfClass(this.lookAtType, this.mob.getBoundingBox().inflate(this.lookDistance, 3.0, this.lookDistance), livingEntity -> true), + this.lookAtContext, + this.mob, + this.mob.getX(), + this.mob.getEyeY(), + this.mob.getZ() + ); } } @@ -1056,15 +1034,16 @@ public class Panda extends Animal { @Override public boolean canUse() { - if (this.cooldown <= Panda.this.tickCount - && !Panda.this.isBaby() - && !Panda.this.isInWater() - && Panda.this.canPerformAction() - && Panda.this.getUnhappyCounter() <= 0) { - List list = Panda.this.level().getEntitiesOfClass(ItemEntity.class, Panda.this.getBoundingBox().inflate(6.0, 6.0, 6.0), Panda.PANDA_ITEMS); - return !list.isEmpty() || !Panda.this.getItemBySlot(EquipmentSlot.MAINHAND).isEmpty(); - } else { + if (this.cooldown > Panda.this.tickCount + || Panda.this.isBaby() + || Panda.this.isInWater() + || !Panda.this.canPerformAction() + || Panda.this.getUnhappyCounter() > 0) { return false; + } else { + return !Panda.this.getItemBySlot(EquipmentSlot.MAINHAND).isEmpty() + ? true + : !Panda.this.level().getEntitiesOfClass(ItemEntity.class, Panda.this.getBoundingBox().inflate(6.0, 6.0, 6.0), Panda::canPickUpAndEat).isEmpty(); } } @@ -1084,10 +1063,12 @@ public class Panda extends Animal { @Override public void start() { - List list = Panda.this.level().getEntitiesOfClass(ItemEntity.class, Panda.this.getBoundingBox().inflate(8.0, 8.0, 8.0), Panda.PANDA_ITEMS); - if (!list.isEmpty() && Panda.this.getItemBySlot(EquipmentSlot.MAINHAND).isEmpty()) { - Panda.this.getNavigation().moveTo((Entity)list.get(0), 1.2F); - } else if (!Panda.this.getItemBySlot(EquipmentSlot.MAINHAND).isEmpty()) { + if (Panda.this.getItemBySlot(EquipmentSlot.MAINHAND).isEmpty()) { + List list = Panda.this.level().getEntitiesOfClass(ItemEntity.class, Panda.this.getBoundingBox().inflate(8.0, 8.0, 8.0), Panda::canPickUpAndEat); + if (!list.isEmpty()) { + Panda.this.getNavigation().moveTo((Entity)list.getFirst(), 1.2F); + } + } else { Panda.this.tryToSit(); } @@ -1098,7 +1079,7 @@ public class Panda extends Animal { public void stop() { ItemStack itemStack = Panda.this.getItemBySlot(EquipmentSlot.MAINHAND); if (!itemStack.isEmpty()) { - Panda.this.spawnAtLocation(itemStack); + Panda.this.spawnAtLocation(getServerLevel(Panda.this.level()), itemStack); Panda.this.setItemSlot(EquipmentSlot.MAINHAND, ItemStack.EMPTY); int i = Panda.this.isLazy() ? Panda.this.random.nextInt(50) + 10 : Panda.this.random.nextInt(150) + 10; this.cooldown = Panda.this.tickCount + i * 20; diff --git a/net/minecraft/world/entity/animal/Parrot.java b/net/minecraft/world/entity/animal/Parrot.java index d2961077..fa859962 100644 --- a/net/minecraft/world/entity/animal/Parrot.java +++ b/net/minecraft/world/entity/animal/Parrot.java @@ -24,6 +24,7 @@ import net.minecraft.util.ByIdMap; import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; import net.minecraft.util.StringRepresentable; +import net.minecraft.util.ByIdMap.OutOfBoundsStrategy; import net.minecraft.world.Difficulty; import net.minecraft.world.DifficultyInstance; import net.minecraft.world.InteractionHand; @@ -33,15 +34,15 @@ import net.minecraft.world.effect.MobEffectInstance; import net.minecraft.world.effect.MobEffects; import net.minecraft.world.entity.AgeableMob; import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.Mob; -import net.minecraft.world.entity.MobSpawnType; import net.minecraft.world.entity.PathfinderMob; import net.minecraft.world.entity.SpawnGroupData; import net.minecraft.world.entity.TamableAnimal; import net.minecraft.world.entity.VariantHolder; -import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.entity.ai.attributes.AttributeSupplier.Builder; import net.minecraft.world.entity.ai.control.FlyingMoveControl; import net.minecraft.world.entity.ai.goal.FloatGoal; import net.minecraft.world.entity.ai.goal.FollowMobGoal; @@ -107,6 +108,8 @@ public class Parrot extends ShoulderRidingEntity implements VariantHolder parrot, LevelAccessor level, MobSpawnType spawnType, BlockPos pos, RandomSource random) { - return level.getBlockState(pos.below()).is(BlockTags.PARROTS_SPAWNABLE_ON) && isBrightEnoughToSpawn(level, pos); + public static boolean checkParrotSpawnRules( + EntityType entityType, LevelAccessor levelAccessor, EntitySpawnReason entitySpawnReason, BlockPos blockPos, RandomSource randomSource + ) { + return levelAccessor.getBlockState(blockPos.below()).is(BlockTags.PARROTS_SPAWNABLE_ON) && isBrightEnoughToSpawn(levelAccessor, blockPos); } @Override @@ -380,15 +387,12 @@ public class Parrot extends ShoulderRidingEntity implements VariantHolder CODEC = StringRepresentable.fromEnum(Parrot.Variant::values); - private static final IntFunction BY_ID = ByIdMap.continuous(Parrot.Variant::getId, values(), ByIdMap.OutOfBoundsStrategy.CLAMP); + private static final IntFunction BY_ID = ByIdMap.continuous(Parrot.Variant::getId, values(), OutOfBoundsStrategy.CLAMP); final int id; private final String name; diff --git a/net/minecraft/world/entity/animal/Pig.java b/net/minecraft/world/entity/animal/Pig.java index 9ae5cb4c..66f3fe0a 100644 --- a/net/minecraft/world/entity/animal/Pig.java +++ b/net/minecraft/world/entity/animal/Pig.java @@ -16,17 +16,18 @@ import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.AgeableMob; +import net.minecraft.world.entity.ConversionParams; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.ItemBasedSteering; import net.minecraft.world.entity.ItemSteerable; import net.minecraft.world.entity.LightningBolt; import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.entity.Mob; import net.minecraft.world.entity.Pose; import net.minecraft.world.entity.Saddleable; -import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.entity.ai.attributes.AttributeSupplier.Builder; import net.minecraft.world.entity.ai.goal.BreedGoal; import net.minecraft.world.entity.ai.goal.FloatGoal; import net.minecraft.world.entity.ai.goal.FollowParentGoal; @@ -68,8 +69,8 @@ public class Pig extends Animal implements ItemSteerable, Saddleable { this.goalSelector.addGoal(8, new RandomLookAroundGoal(this)); } - public static AttributeSupplier.Builder createAttributes() { - return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 10.0).add(Attributes.MOVEMENT_SPEED, 0.25); + public static Builder createAttributes() { + return Animal.createAnimalAttributes().add(Attributes.MAX_HEALTH, 10.0).add(Attributes.MOVEMENT_SPEED, 0.25); } @Nullable @@ -90,7 +91,7 @@ public class Pig extends Animal implements ItemSteerable, Saddleable { } @Override - protected void defineSynchedData(SynchedEntityData.Builder builder) { + protected void defineSynchedData(net.minecraft.network.syncher.SynchedEntityData.Builder builder) { super.defineSynchedData(builder); builder.define(DATA_SADDLE_ID, false); builder.define(DATA_BOOST_TIME, 0); @@ -136,12 +137,12 @@ public class Pig extends Animal implements ItemSteerable, Saddleable { player.startRiding(this); } - return InteractionResult.sidedSuccess(this.level().isClientSide); + return InteractionResult.SUCCESS; } else { InteractionResult interactionResult = super.mobInteract(player, hand); if (!interactionResult.consumesAction()) { ItemStack itemStack = player.getItemInHand(hand); - return itemStack.is(Items.SADDLE) ? itemStack.interactLivingEntity(player, this, hand) : InteractionResult.PASS; + return (InteractionResult)(itemStack.is(Items.SADDLE) ? itemStack.interactLivingEntity(player, this, hand) : InteractionResult.PASS); } else { return interactionResult; } @@ -154,10 +155,10 @@ public class Pig extends Animal implements ItemSteerable, Saddleable { } @Override - protected void dropEquipment() { - super.dropEquipment(); + protected void dropEquipment(ServerLevel serverLevel) { + super.dropEquipment(serverLevel); if (this.isSaddled()) { - this.spawnAtLocation(Items.SADDLE); + this.spawnAtLocation(serverLevel, Items.SADDLE); } } @@ -207,21 +208,14 @@ public class Pig extends Animal implements ItemSteerable, Saddleable { @Override public void thunderHit(ServerLevel level, LightningBolt lightning) { if (level.getDifficulty() != Difficulty.PEACEFUL) { - ZombifiedPiglin zombifiedPiglin = EntityType.ZOMBIFIED_PIGLIN.create(level); - if (zombifiedPiglin != null) { - zombifiedPiglin.setItemSlot(EquipmentSlot.MAINHAND, new ItemStack(Items.GOLDEN_SWORD)); - zombifiedPiglin.moveTo(this.getX(), this.getY(), this.getZ(), this.getYRot(), this.getXRot()); - zombifiedPiglin.setNoAi(this.isNoAi()); - zombifiedPiglin.setBaby(this.isBaby()); - if (this.hasCustomName()) { - zombifiedPiglin.setCustomName(this.getCustomName()); - zombifiedPiglin.setCustomNameVisible(this.isCustomNameVisible()); + ZombifiedPiglin zombifiedPiglin = this.convertTo(EntityType.ZOMBIFIED_PIGLIN, ConversionParams.single(this, false, true), zombifiedPiglinx -> { + if (this.getMainHandItem().isEmpty()) { + zombifiedPiglinx.setItemSlot(EquipmentSlot.MAINHAND, new ItemStack(Items.GOLDEN_SWORD)); } - zombifiedPiglin.setPersistenceRequired(); - level.addFreshEntity(zombifiedPiglin); - this.discard(); - } else { + zombifiedPiglinx.setPersistenceRequired(); + }); + if (zombifiedPiglin == null) { super.thunderHit(level, lightning); } } else { @@ -254,7 +248,7 @@ public class Pig extends Animal implements ItemSteerable, Saddleable { @Nullable public Pig getBreedOffspring(ServerLevel level, AgeableMob otherParent) { - return EntityType.PIG.create(level); + return EntityType.PIG.create(level, EntitySpawnReason.BREEDING); } @Override diff --git a/net/minecraft/world/entity/animal/PolarBear.java b/net/minecraft/world/entity/animal/PolarBear.java index 4b3fcee1..870b3354 100644 --- a/net/minecraft/world/entity/animal/PolarBear.java +++ b/net/minecraft/world/entity/animal/PolarBear.java @@ -21,15 +21,15 @@ import net.minecraft.world.DifficultyInstance; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.AgeableMob; import net.minecraft.world.entity.EntityDimensions; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.Mob; -import net.minecraft.world.entity.MobSpawnType; import net.minecraft.world.entity.NeutralMob; import net.minecraft.world.entity.Pose; import net.minecraft.world.entity.SpawnGroupData; -import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.entity.ai.attributes.AttributeSupplier.Builder; import net.minecraft.world.entity.ai.goal.FloatGoal; import net.minecraft.world.entity.ai.goal.FollowParentGoal; import net.minecraft.world.entity.ai.goal.LookAtPlayerGoal; @@ -67,7 +67,7 @@ public class PolarBear extends Animal implements NeutralMob { @Nullable @Override public AgeableMob getBreedOffspring(ServerLevel level, AgeableMob otherParent) { - return EntityType.POLAR_BEAR.create(level); + return EntityType.POLAR_BEAR.create(level, EntitySpawnReason.BREEDING); } @Override @@ -93,19 +93,21 @@ public class PolarBear extends Animal implements NeutralMob { this.targetSelector.addGoal(5, new ResetUniversalAngerTargetGoal<>(this, false)); } - public static AttributeSupplier.Builder createAttributes() { - return Mob.createMobAttributes() + public static Builder createAttributes() { + return Animal.createAnimalAttributes() .add(Attributes.MAX_HEALTH, 30.0) .add(Attributes.FOLLOW_RANGE, 20.0) .add(Attributes.MOVEMENT_SPEED, 0.25) .add(Attributes.ATTACK_DAMAGE, 6.0); } - public static boolean checkPolarBearSpawnRules(EntityType polarBear, LevelAccessor level, MobSpawnType spawnType, BlockPos pos, RandomSource random) { - Holder holder = level.getBiome(pos); + public static boolean checkPolarBearSpawnRules( + EntityType entityType, LevelAccessor levelAccessor, EntitySpawnReason entitySpawnReason, BlockPos blockPos, RandomSource randomSource + ) { + Holder holder = levelAccessor.getBiome(blockPos); return !holder.is(BiomeTags.POLAR_BEARS_SPAWN_ON_ALTERNATE_BLOCKS) - ? checkAnimalSpawnRules(polarBear, level, spawnType, pos, random) - : isBrightEnoughToSpawn(level, pos) && level.getBlockState(pos.below()).is(BlockTags.POLAR_BEARS_SPAWNABLE_ON_ALTERNATE); + ? checkAnimalSpawnRules(entityType, levelAccessor, entitySpawnReason, blockPos, randomSource) + : isBrightEnoughToSpawn(levelAccessor, blockPos) && levelAccessor.getBlockState(blockPos.below()).is(BlockTags.POLAR_BEARS_SPAWNABLE_ON_ALTERNATE); } @Override @@ -174,7 +176,7 @@ public class PolarBear extends Animal implements NeutralMob { } @Override - protected void defineSynchedData(SynchedEntityData.Builder builder) { + protected void defineSynchedData(net.minecraft.network.syncher.SynchedEntityData.Builder builder) { super.defineSynchedData(builder); builder.define(DATA_STANDING_ID, false); } @@ -233,12 +235,14 @@ public class PolarBear extends Animal implements NeutralMob { } @Override - public SpawnGroupData finalizeSpawn(ServerLevelAccessor level, DifficultyInstance difficulty, MobSpawnType spawnType, @Nullable SpawnGroupData spawnGroupData) { + public SpawnGroupData finalizeSpawn( + ServerLevelAccessor serverLevelAccessor, DifficultyInstance difficultyInstance, EntitySpawnReason entitySpawnReason, @Nullable SpawnGroupData spawnGroupData + ) { if (spawnGroupData == null) { spawnGroupData = new AgeableMob.AgeableMobGroupData(1.0F); } - return super.finalizeSpawn(level, difficulty, spawnType, spawnGroupData); + return super.finalizeSpawn(serverLevelAccessor, difficultyInstance, entitySpawnReason, spawnGroupData); } class PolarBearAttackPlayersGoal extends NearestAttackableTargetGoal { @@ -300,7 +304,7 @@ public class PolarBear extends Animal implements NeutralMob { protected void checkAndPerformAttack(LivingEntity target) { if (this.canPerformAttack(target)) { this.resetAttackCooldown(); - this.mob.doHurtTarget(target); + this.mob.doHurtTarget(getServerLevel(this.mob), target); PolarBear.this.setStanding(false); } else if (this.mob.distanceToSqr(target) < (target.getBbWidth() + 3.0F) * (target.getBbWidth() + 3.0F)) { if (this.isTimeToAttack()) { diff --git a/net/minecraft/world/entity/animal/Pufferfish.java b/net/minecraft/world/entity/animal/Pufferfish.java index b06d3806..16a6c12c 100644 --- a/net/minecraft/world/entity/animal/Pufferfish.java +++ b/net/minecraft/world/entity/animal/Pufferfish.java @@ -1,12 +1,13 @@ package net.minecraft.world.entity.animal; import java.util.List; -import java.util.function.Predicate; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.protocol.game.ClientboundGameEventPacket; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.network.syncher.SynchedEntityData.Builder; +import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; @@ -30,10 +31,10 @@ public class Pufferfish extends AbstractFish { private static final EntityDataAccessor PUFF_STATE = SynchedEntityData.defineId(Pufferfish.class, EntityDataSerializers.INT); int inflateCounter; int deflateTimer; - private static final Predicate SCARY_MOB = livingEntity -> livingEntity instanceof Player player && player.isCreative() + private static final TargetingConditions.Selector SCARY_MOB = (livingEntity, serverLevel) -> livingEntity instanceof Player player && player.isCreative() ? false : !livingEntity.getType().is(EntityTypeTags.NOT_SCARY_FOR_PUFFERFISH); - static final TargetingConditions targetingConditions = TargetingConditions.forNonCombat().ignoreInvisibilityTesting().ignoreLineOfSight().selector(SCARY_MOB); + static final TargetingConditions TARGETING_CONDITIONS = TargetingConditions.forNonCombat().ignoreInvisibilityTesting().ignoreLineOfSight().selector(SCARY_MOB); public static final int STATE_SMALL = 0; public static final int STATE_MID = 1; public static final int STATE_FULL = 2; @@ -44,7 +45,7 @@ public class Pufferfish extends AbstractFish { } @Override - protected void defineSynchedData(SynchedEntityData.Builder builder) { + protected void defineSynchedData(Builder builder) { super.defineSynchedData(builder); builder.define(PUFF_STATE, 0); } @@ -121,18 +122,18 @@ public class Pufferfish extends AbstractFish { @Override public void aiStep() { super.aiStep(); - if (this.isAlive() && this.getPuffState() > 0) { - for (Mob mob : this.level().getEntitiesOfClass(Mob.class, this.getBoundingBox().inflate(0.3), mobx -> targetingConditions.test(this, mobx))) { + if (this.level() instanceof ServerLevel serverLevel && this.isAlive() && this.getPuffState() > 0) { + for (Mob mob : this.level().getEntitiesOfClass(Mob.class, this.getBoundingBox().inflate(0.3), mobx -> TARGETING_CONDITIONS.test(serverLevel, this, mobx))) { if (mob.isAlive()) { - this.touch(mob); + this.touch(serverLevel, mob); } } } } - private void touch(Mob mob) { + private void touch(ServerLevel serverLevel, Mob mob) { int i = this.getPuffState(); - if (mob.hurt(this.damageSources().mobAttack(this), 1 + i)) { + if (mob.hurtServer(serverLevel, this.damageSources().mobAttack(this), 1 + i)) { mob.addEffect(new MobEffectInstance(MobEffects.POISON, 60 * i, 0), this); this.playSound(SoundEvents.PUFFER_FISH_STING, 1.0F, 1.0F); } @@ -141,9 +142,9 @@ public class Pufferfish extends AbstractFish { @Override public void playerTouch(Player player) { int i = this.getPuffState(); - if (player instanceof ServerPlayer && i > 0 && player.hurt(this.damageSources().mobAttack(this), 1 + i)) { + if (player instanceof ServerPlayer serverPlayer && i > 0 && player.hurtServer(serverPlayer.serverLevel(), this.damageSources().mobAttack(this), 1 + i)) { if (!this.isSilent()) { - ((ServerPlayer)player).connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.PUFFER_FISH_STING, 0.0F)); + serverPlayer.connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.PUFFER_FISH_STING, 0.0F)); } player.addEffect(new MobEffectInstance(MobEffects.POISON, 60 * i, 0), this); @@ -198,7 +199,9 @@ public class Pufferfish extends AbstractFish { List list = this.fish .level() .getEntitiesOfClass( - LivingEntity.class, this.fish.getBoundingBox().inflate(2.0), livingEntity -> Pufferfish.targetingConditions.test(this.fish, livingEntity) + LivingEntity.class, + this.fish.getBoundingBox().inflate(2.0), + livingEntity -> Pufferfish.TARGETING_CONDITIONS.test(getServerLevel(this.fish), this.fish, livingEntity) ); return !list.isEmpty(); } diff --git a/net/minecraft/world/entity/animal/Rabbit.java b/net/minecraft/world/entity/animal/Rabbit.java index 4b62beea..b055c926 100644 --- a/net/minecraft/world/entity/animal/Rabbit.java +++ b/net/minecraft/world/entity/animal/Rabbit.java @@ -10,6 +10,7 @@ import net.minecraft.network.chat.Component; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.network.syncher.SynchedEntityData.Builder; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundEvent; @@ -25,14 +26,12 @@ import net.minecraft.util.StringRepresentable; import net.minecraft.world.DifficultyInstance; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.AgeableMob; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.entity.Mob; -import net.minecraft.world.entity.MobSpawnType; import net.minecraft.world.entity.SpawnGroupData; import net.minecraft.world.entity.VariantHolder; import net.minecraft.world.entity.ai.attributes.AttributeModifier; -import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.entity.ai.control.JumpControl; import net.minecraft.world.entity.ai.control.MoveControl; @@ -62,6 +61,7 @@ import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.CarrotBlock; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.level.gameevent.GameEvent.Context; import net.minecraft.world.level.pathfinder.Path; import net.minecraft.world.phys.Vec3; import org.jetbrains.annotations.Nullable; @@ -169,13 +169,13 @@ public class Rabbit extends Animal implements VariantHolder { } @Override - protected void defineSynchedData(SynchedEntityData.Builder builder) { + protected void defineSynchedData(Builder builder) { super.defineSynchedData(builder); builder.define(DATA_TYPE_ID, Rabbit.Variant.BROWN.id); } @Override - public void customServerAiStep() { + public void customServerAiStep(ServerLevel serverLevel) { if (this.jumpDelayTicks > 0) { this.jumpDelayTicks--; } @@ -265,8 +265,8 @@ public class Rabbit extends Animal implements VariantHolder { } } - public static AttributeSupplier.Builder createAttributes() { - return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 3.0).add(Attributes.MOVEMENT_SPEED, 0.3F).add(Attributes.ATTACK_DAMAGE, 3.0); + public static net.minecraft.world.entity.ai.attributes.AttributeSupplier.Builder createAttributes() { + return Animal.createAnimalAttributes().add(Attributes.MAX_HEALTH, 3.0).add(Attributes.MOVEMENT_SPEED, 0.3F).add(Attributes.ATTACK_DAMAGE, 3.0); } @Override @@ -316,7 +316,7 @@ public class Rabbit extends Animal implements VariantHolder { @Nullable public Rabbit getBreedOffspring(ServerLevel level, AgeableMob otherParent) { - Rabbit rabbit = EntityType.RABBIT.create(level); + Rabbit rabbit = EntityType.RABBIT.create(level, EntitySpawnReason.BREEDING); if (rabbit != null) { Rabbit.Variant variant = getRandomRabbitVariant(level, this.blockPosition()); if (this.random.nextInt(20) != 0) { @@ -363,8 +363,10 @@ public class Rabbit extends Animal implements VariantHolder { @Nullable @Override - public SpawnGroupData finalizeSpawn(ServerLevelAccessor level, DifficultyInstance difficulty, MobSpawnType spawnType, @Nullable SpawnGroupData spawnGroupData) { - Rabbit.Variant variant = getRandomRabbitVariant(level, this.blockPosition()); + public SpawnGroupData finalizeSpawn( + ServerLevelAccessor serverLevelAccessor, DifficultyInstance difficultyInstance, EntitySpawnReason entitySpawnReason, @Nullable SpawnGroupData spawnGroupData + ) { + Rabbit.Variant variant = getRandomRabbitVariant(serverLevelAccessor, this.blockPosition()); if (spawnGroupData instanceof Rabbit.RabbitGroupData) { variant = ((Rabbit.RabbitGroupData)spawnGroupData).variant; } else { @@ -372,7 +374,7 @@ public class Rabbit extends Animal implements VariantHolder { } this.setVariant(variant); - return super.finalizeSpawn(level, difficulty, spawnType, spawnGroupData); + return super.finalizeSpawn(serverLevelAccessor, difficultyInstance, entitySpawnReason, spawnGroupData); } private static Rabbit.Variant getRandomRabbitVariant(LevelAccessor level, BlockPos pos) { @@ -387,8 +389,10 @@ public class Rabbit extends Animal implements VariantHolder { } } - public static boolean checkRabbitSpawnRules(EntityType rabbit, LevelAccessor level, MobSpawnType spawnType, BlockPos pos, RandomSource random) { - return level.getBlockState(pos.below()).is(BlockTags.RABBITS_SPAWNABLE_ON) && isBrightEnoughToSpawn(level, pos); + public static boolean checkRabbitSpawnRules( + EntityType entityType, LevelAccessor levelAccessor, EntitySpawnReason entitySpawnReason, BlockPos blockPos, RandomSource randomSource + ) { + return levelAccessor.getBlockState(blockPos.below()).is(BlockTags.RABBITS_SPAWNABLE_ON) && isBrightEnoughToSpawn(levelAccessor, blockPos); } /** @@ -528,7 +532,7 @@ public class Rabbit extends Animal implements VariantHolder { @Override public boolean canUse() { if (this.nextStartTick <= 0) { - if (!this.rabbit.level().getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { + if (!getServerLevel(this.rabbit).getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { return false; } @@ -562,7 +566,7 @@ public class Rabbit extends Animal implements VariantHolder { level.destroyBlock(blockPos, true, this.rabbit); } else { level.setBlock(blockPos, blockState.setValue(CarrotBlock.AGE, i - 1), 2); - level.gameEvent(GameEvent.BLOCK_CHANGE, blockPos, GameEvent.Context.of(this.rabbit)); + level.gameEvent(GameEvent.BLOCK_CHANGE, blockPos, Context.of(this.rabbit)); level.levelEvent(2001, blockPos, Block.getId(blockState)); } diff --git a/net/minecraft/world/entity/animal/Salmon.java b/net/minecraft/world/entity/animal/Salmon.java index 3c07e468..3ece0b72 100644 --- a/net/minecraft/world/entity/animal/Salmon.java +++ b/net/minecraft/world/entity/animal/Salmon.java @@ -1,16 +1,36 @@ package net.minecraft.world.entity.animal; +import net.minecraft.core.component.DataComponents; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.syncher.EntityDataAccessor; +import net.minecraft.network.syncher.EntityDataSerializers; +import net.minecraft.network.syncher.SynchedEntityData; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; +import net.minecraft.util.StringRepresentable; +import net.minecraft.util.random.SimpleWeightedRandomList; +import net.minecraft.util.random.SimpleWeightedRandomList.Builder; +import net.minecraft.world.DifficultyInstance; import net.minecraft.world.damagesource.DamageSource; +import net.minecraft.world.entity.EntityDimensions; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.Pose; +import net.minecraft.world.entity.SpawnGroupData; +import net.minecraft.world.entity.VariantHolder; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; +import net.minecraft.world.item.component.CustomData; import net.minecraft.world.level.Level; +import net.minecraft.world.level.ServerLevelAccessor; +import org.jetbrains.annotations.Nullable; + +public class Salmon extends AbstractSchoolingFish implements VariantHolder { + private static final EntityDataAccessor DATA_TYPE = SynchedEntityData.defineId(Salmon.class, EntityDataSerializers.STRING); -public class Salmon extends AbstractSchoolingFish { public Salmon(EntityType entityType, Level level) { super(entityType, level); + this.refreshDimensions(); } @Override @@ -42,4 +62,96 @@ public class Salmon extends AbstractSchoolingFish { protected SoundEvent getFlopSound() { return SoundEvents.SALMON_FLOP; } + + @Override + protected void defineSynchedData(net.minecraft.network.syncher.SynchedEntityData.Builder builder) { + super.defineSynchedData(builder); + builder.define(DATA_TYPE, Salmon.Variant.MEDIUM.type); + } + + @Override + public void onSyncedDataUpdated(EntityDataAccessor dataAccessor) { + super.onSyncedDataUpdated(dataAccessor); + if (DATA_TYPE.equals(dataAccessor)) { + this.refreshDimensions(); + } + } + + @Override + public void addAdditionalSaveData(CompoundTag compound) { + super.addAdditionalSaveData(compound); + compound.putString("type", this.getVariant().getSerializedName()); + } + + @Override + public void readAdditionalSaveData(CompoundTag compound) { + super.readAdditionalSaveData(compound); + this.setVariant(Salmon.Variant.byName(compound.getString("type"))); + } + + @Override + public void saveToBucketTag(ItemStack stack) { + Bucketable.saveDefaultDataToBucketTag(this, stack); + CustomData.update(DataComponents.BUCKET_ENTITY_DATA, stack, compoundTag -> compoundTag.putString("type", this.getVariant().getSerializedName())); + } + + @Override + public void loadFromBucketTag(CompoundTag tag) { + Bucketable.loadDefaultDataFromBucketTag(this, tag); + this.setVariant(Salmon.Variant.byName(tag.getString("type"))); + } + + public void setVariant(Salmon.Variant variant) { + this.entityData.set(DATA_TYPE, variant.type); + } + + public Salmon.Variant getVariant() { + return Salmon.Variant.byName(this.entityData.get(DATA_TYPE)); + } + + @Nullable + @Override + public SpawnGroupData finalizeSpawn( + ServerLevelAccessor serverLevelAccessor, DifficultyInstance difficultyInstance, EntitySpawnReason entitySpawnReason, @Nullable SpawnGroupData spawnGroupData + ) { + Builder builder = SimpleWeightedRandomList.builder(); + builder.add(Salmon.Variant.SMALL, 30); + builder.add(Salmon.Variant.MEDIUM, 50); + builder.add(Salmon.Variant.LARGE, 15); + builder.build().getRandomValue(this.random).ifPresent(this::setVariant); + return super.finalizeSpawn(serverLevelAccessor, difficultyInstance, entitySpawnReason, spawnGroupData); + } + + public float getSalmonScale() { + return this.getVariant().boundingBoxScale; + } + + @Override + protected EntityDimensions getDefaultDimensions(Pose pose) { + return super.getDefaultDimensions(pose).scale(this.getSalmonScale()); + } + + public static enum Variant implements StringRepresentable { + SMALL("small", 0.5F), + MEDIUM("medium", 1.0F), + LARGE("large", 1.5F); + + public static final StringRepresentable.EnumCodec CODEC = StringRepresentable.fromEnum(Salmon.Variant::values); + final String type; + final float boundingBoxScale; + + private Variant(final String string2, final float f) { + this.type = string2; + this.boundingBoxScale = f; + } + + @Override + public String getSerializedName() { + return this.type; + } + + static Salmon.Variant byName(String string) { + return (Salmon.Variant)CODEC.byName(string, SMALL); + } + } } diff --git a/net/minecraft/world/entity/animal/Sheep.java b/net/minecraft/world/entity/animal/Sheep.java index 57ac603a..024c45ea 100644 --- a/net/minecraft/world/entity/animal/Sheep.java +++ b/net/minecraft/world/entity/animal/Sheep.java @@ -5,19 +5,17 @@ import java.util.Arrays; import java.util.List; import java.util.Map; import java.util.stream.Collectors; -import net.minecraft.Util; import net.minecraft.core.BlockPos; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; -import net.minecraft.resources.ResourceKey; import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; import net.minecraft.tags.ItemTags; -import net.minecraft.util.FastColor; +import net.minecraft.util.ARGB; import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; import net.minecraft.world.DifficultyInstance; @@ -25,13 +23,12 @@ import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.AgeableMob; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; -import net.minecraft.world.entity.Mob; -import net.minecraft.world.entity.MobSpawnType; import net.minecraft.world.entity.Shearable; import net.minecraft.world.entity.SpawnGroupData; -import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.entity.ai.attributes.AttributeSupplier.Builder; import net.minecraft.world.entity.ai.goal.BreedGoal; import net.minecraft.world.entity.ai.goal.EatBlockGoal; import net.minecraft.world.entity.ai.goal.FloatGoal; @@ -50,37 +47,16 @@ import net.minecraft.world.item.Items; import net.minecraft.world.item.crafting.CraftingInput; import net.minecraft.world.item.crafting.CraftingRecipe; import net.minecraft.world.item.crafting.RecipeType; -import net.minecraft.world.level.ItemLike; import net.minecraft.world.level.Level; import net.minecraft.world.level.ServerLevelAccessor; -import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.gameevent.GameEvent; import net.minecraft.world.level.storage.loot.BuiltInLootTables; -import net.minecraft.world.level.storage.loot.LootTable; import org.jetbrains.annotations.Nullable; public class Sheep extends Animal implements Shearable { private static final int EAT_ANIMATION_TICKS = 40; private static final EntityDataAccessor DATA_WOOL_ID = SynchedEntityData.defineId(Sheep.class, EntityDataSerializers.BYTE); - private static final Map ITEM_BY_DYE = Util.make(Maps.newEnumMap(DyeColor.class), enumMap -> { - enumMap.put(DyeColor.WHITE, Blocks.WHITE_WOOL); - enumMap.put(DyeColor.ORANGE, Blocks.ORANGE_WOOL); - enumMap.put(DyeColor.MAGENTA, Blocks.MAGENTA_WOOL); - enumMap.put(DyeColor.LIGHT_BLUE, Blocks.LIGHT_BLUE_WOOL); - enumMap.put(DyeColor.YELLOW, Blocks.YELLOW_WOOL); - enumMap.put(DyeColor.LIME, Blocks.LIME_WOOL); - enumMap.put(DyeColor.PINK, Blocks.PINK_WOOL); - enumMap.put(DyeColor.GRAY, Blocks.GRAY_WOOL); - enumMap.put(DyeColor.LIGHT_GRAY, Blocks.LIGHT_GRAY_WOOL); - enumMap.put(DyeColor.CYAN, Blocks.CYAN_WOOL); - enumMap.put(DyeColor.PURPLE, Blocks.PURPLE_WOOL); - enumMap.put(DyeColor.BLUE, Blocks.BLUE_WOOL); - enumMap.put(DyeColor.BROWN, Blocks.BROWN_WOOL); - enumMap.put(DyeColor.GREEN, Blocks.GREEN_WOOL); - enumMap.put(DyeColor.RED, Blocks.RED_WOOL); - enumMap.put(DyeColor.BLACK, Blocks.BLACK_WOOL); - }); private static final Map COLOR_BY_DYE = Maps.newEnumMap( (Map)Arrays.stream(DyeColor.values()).collect(Collectors.toMap(dyeColor -> dyeColor, Sheep::createSheepColor)) ); @@ -93,9 +69,7 @@ public class Sheep extends Animal implements Shearable { } else { int i = dyeColor.getTextureDiffuseColor(); float f = 0.75F; - return FastColor.ARGB32.color( - 255, Mth.floor(FastColor.ARGB32.red(i) * 0.75F), Mth.floor(FastColor.ARGB32.green(i) * 0.75F), Mth.floor(FastColor.ARGB32.blue(i) * 0.75F) - ); + return ARGB.color(255, Mth.floor(ARGB.red(i) * 0.75F), Mth.floor(ARGB.green(i) * 0.75F), Mth.floor(ARGB.blue(i) * 0.75F)); } } @@ -127,9 +101,9 @@ public class Sheep extends Animal implements Shearable { } @Override - protected void customServerAiStep() { + protected void customServerAiStep(ServerLevel serverLevel) { this.eatAnimationTick = this.eatBlockGoal.getEatAnimationTick(); - super.customServerAiStep(); + super.customServerAiStep(serverLevel); } @Override @@ -141,42 +115,16 @@ public class Sheep extends Animal implements Shearable { super.aiStep(); } - public static AttributeSupplier.Builder createAttributes() { - return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 8.0).add(Attributes.MOVEMENT_SPEED, 0.23F); + public static Builder createAttributes() { + return Animal.createAnimalAttributes().add(Attributes.MAX_HEALTH, 8.0).add(Attributes.MOVEMENT_SPEED, 0.23F); } @Override - protected void defineSynchedData(SynchedEntityData.Builder builder) { + protected void defineSynchedData(net.minecraft.network.syncher.SynchedEntityData.Builder builder) { super.defineSynchedData(builder); builder.define(DATA_WOOL_ID, (byte)0); } - @Override - public ResourceKey getDefaultLootTable() { - if (this.isSheared()) { - return this.getType().getDefaultLootTable(); - } else { - return switch (this.getColor()) { - case WHITE -> BuiltInLootTables.SHEEP_WHITE; - case ORANGE -> BuiltInLootTables.SHEEP_ORANGE; - case MAGENTA -> BuiltInLootTables.SHEEP_MAGENTA; - case LIGHT_BLUE -> BuiltInLootTables.SHEEP_LIGHT_BLUE; - case YELLOW -> BuiltInLootTables.SHEEP_YELLOW; - case LIME -> BuiltInLootTables.SHEEP_LIME; - case PINK -> BuiltInLootTables.SHEEP_PINK; - case GRAY -> BuiltInLootTables.SHEEP_GRAY; - case LIGHT_GRAY -> BuiltInLootTables.SHEEP_LIGHT_GRAY; - case CYAN -> BuiltInLootTables.SHEEP_CYAN; - case PURPLE -> BuiltInLootTables.SHEEP_PURPLE; - case BLUE -> BuiltInLootTables.SHEEP_BLUE; - case BROWN -> BuiltInLootTables.SHEEP_BROWN; - case GREEN -> BuiltInLootTables.SHEEP_GREEN; - case RED -> BuiltInLootTables.SHEEP_RED; - case BLACK -> BuiltInLootTables.SHEEP_BLACK; - }; - } - } - @Override public void handleEntityEvent(byte id) { if (id == 10) { @@ -209,11 +157,11 @@ public class Sheep extends Animal implements Shearable { public InteractionResult mobInteract(Player player, InteractionHand hand) { ItemStack itemStack = player.getItemInHand(hand); if (itemStack.is(Items.SHEARS)) { - if (!this.level().isClientSide && this.readyForShearing()) { - this.shear(SoundSource.PLAYERS); + if (this.level() instanceof ServerLevel serverLevel && this.readyForShearing()) { + this.shear(serverLevel, SoundSource.PLAYERS, itemStack); this.gameEvent(GameEvent.SHEAR, player); itemStack.hurtAndBreak(1, player, getSlotForHand(hand)); - return InteractionResult.SUCCESS; + return InteractionResult.SUCCESS_SERVER; } else { return InteractionResult.CONSUME; } @@ -223,22 +171,29 @@ public class Sheep extends Animal implements Shearable { } @Override - public void shear(SoundSource source) { - this.level().playSound(null, this, SoundEvents.SHEEP_SHEAR, source, 1.0F, 1.0F); - this.setSheared(true); - int i = 1 + this.random.nextInt(3); - - for (int j = 0; j < i; j++) { - ItemEntity itemEntity = this.spawnAtLocation((ItemLike)ITEM_BY_DYE.get(this.getColor()), 1); - if (itemEntity != null) { - itemEntity.setDeltaMovement( - itemEntity.getDeltaMovement() - .add( - (this.random.nextFloat() - this.random.nextFloat()) * 0.1F, this.random.nextFloat() * 0.05F, (this.random.nextFloat() - this.random.nextFloat()) * 0.1F - ) - ); + public void shear(ServerLevel serverLevel, SoundSource soundSource, ItemStack itemStack) { + serverLevel.playSound(null, this, SoundEvents.SHEEP_SHEAR, soundSource, 1.0F, 1.0F); + this.dropFromShearingLootTable( + serverLevel, + BuiltInLootTables.SHEAR_SHEEP, + itemStack, + (serverLevelx, itemStackx) -> { + for (int i = 0; i < itemStackx.getCount(); i++) { + ItemEntity itemEntity = this.spawnAtLocation(serverLevelx, itemStackx.copyWithCount(1), 1.0F); + if (itemEntity != null) { + itemEntity.setDeltaMovement( + itemEntity.getDeltaMovement() + .add( + (this.random.nextFloat() - this.random.nextFloat()) * 0.1F, + this.random.nextFloat() * 0.05F, + (this.random.nextFloat() - this.random.nextFloat()) * 0.1F + ) + ); + } + } } - } + ); + this.setSheared(true); } @Override @@ -331,9 +286,9 @@ public class Sheep extends Animal implements Shearable { @Nullable public Sheep getBreedOffspring(ServerLevel level, AgeableMob otherParent) { - Sheep sheep = EntityType.SHEEP.create(level); + Sheep sheep = EntityType.SHEEP.create(level, EntitySpawnReason.BREEDING); if (sheep != null) { - sheep.setColor(this.getOffspringColor(this, (Sheep)otherParent)); + sheep.setColor(this.getOffspringColor(level, this, (Sheep)otherParent)); } return sheep; @@ -350,27 +305,25 @@ public class Sheep extends Animal implements Shearable { @Nullable @Override - public SpawnGroupData finalizeSpawn(ServerLevelAccessor level, DifficultyInstance difficulty, MobSpawnType spawnType, @Nullable SpawnGroupData spawnGroupData) { - this.setColor(getRandomSheepColor(level.getRandom())); - return super.finalizeSpawn(level, difficulty, spawnType, spawnGroupData); + public SpawnGroupData finalizeSpawn( + ServerLevelAccessor serverLevelAccessor, DifficultyInstance difficultyInstance, EntitySpawnReason entitySpawnReason, @Nullable SpawnGroupData spawnGroupData + ) { + this.setColor(getRandomSheepColor(serverLevelAccessor.getRandom())); + return super.finalizeSpawn(serverLevelAccessor, difficultyInstance, entitySpawnReason, spawnGroupData); } - /** - * Attempts to mix both parent sheep to come up with a mixed dye color. - */ - private DyeColor getOffspringColor(Animal father, Animal mother) { - DyeColor dyeColor = ((Sheep)father).getColor(); - DyeColor dyeColor2 = ((Sheep)mother).getColor(); + private DyeColor getOffspringColor(ServerLevel serverLevel, Sheep sheep, Sheep sheep2) { + DyeColor dyeColor = sheep.getColor(); + DyeColor dyeColor2 = sheep2.getColor(); CraftingInput craftingInput = makeCraftInput(dyeColor, dyeColor2); - return (DyeColor)this.level() - .getRecipeManager() - .getRecipeFor(RecipeType.CRAFTING, craftingInput, this.level()) - .map(recipeHolder -> ((CraftingRecipe)recipeHolder.value()).assemble(craftingInput, this.level().registryAccess())) + return (DyeColor)serverLevel.recipeAccess() + .getRecipeFor(RecipeType.CRAFTING, craftingInput, serverLevel) + .map(recipeHolder -> ((CraftingRecipe)recipeHolder.value()).assemble(craftingInput, serverLevel.registryAccess())) .map(ItemStack::getItem) .filter(DyeItem.class::isInstance) .map(DyeItem.class::cast) .map(DyeItem::getDyeColor) - .orElseGet(() -> this.level().random.nextBoolean() ? dyeColor : dyeColor2); + .orElseGet(() -> serverLevel.random.nextBoolean() ? dyeColor : dyeColor2); } private static CraftingInput makeCraftInput(DyeColor color1, DyeColor color2) { diff --git a/net/minecraft/world/entity/animal/SnowGolem.java b/net/minecraft/world/entity/animal/SnowGolem.java index da4844d6..5e7b2f13 100644 --- a/net/minecraft/world/entity/animal/SnowGolem.java +++ b/net/minecraft/world/entity/animal/SnowGolem.java @@ -5,6 +5,7 @@ import net.minecraft.nbt.CompoundTag; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; @@ -17,8 +18,8 @@ import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.Mob; import net.minecraft.world.entity.Shearable; -import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.entity.ai.attributes.AttributeSupplier.Builder; import net.minecraft.world.entity.ai.goal.LookAtPlayerGoal; import net.minecraft.world.entity.ai.goal.RandomLookAroundGoal; import net.minecraft.world.entity.ai.goal.RangedAttackGoal; @@ -27,6 +28,7 @@ import net.minecraft.world.entity.ai.goal.target.NearestAttackableTargetGoal; import net.minecraft.world.entity.monster.Enemy; import net.minecraft.world.entity.monster.RangedAttackMob; import net.minecraft.world.entity.player.Player; +import net.minecraft.world.entity.projectile.Projectile; import net.minecraft.world.entity.projectile.Snowball; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; @@ -35,6 +37,8 @@ import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.level.gameevent.GameEvent.Context; +import net.minecraft.world.level.storage.loot.BuiltInLootTables; import net.minecraft.world.phys.Vec3; import org.jetbrains.annotations.Nullable; @@ -52,15 +56,16 @@ public class SnowGolem extends AbstractGolem implements Shearable, RangedAttackM this.goalSelector.addGoal(2, new WaterAvoidingRandomStrollGoal(this, 1.0, 1.0000001E-5F)); this.goalSelector.addGoal(3, new LookAtPlayerGoal(this, Player.class, 6.0F)); this.goalSelector.addGoal(4, new RandomLookAroundGoal(this)); - this.targetSelector.addGoal(1, new NearestAttackableTargetGoal(this, Mob.class, 10, true, false, livingEntity -> livingEntity instanceof Enemy)); + this.targetSelector + .addGoal(1, new NearestAttackableTargetGoal(this, Mob.class, 10, true, false, (livingEntity, serverLevel) -> livingEntity instanceof Enemy)); } - public static AttributeSupplier.Builder createAttributes() { + public static Builder createAttributes() { return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 4.0).add(Attributes.MOVEMENT_SPEED, 0.2F); } @Override - protected void defineSynchedData(SynchedEntityData.Builder builder) { + protected void defineSynchedData(net.minecraft.network.syncher.SynchedEntityData.Builder builder) { super.defineSynchedData(builder); builder.define(DATA_PUMPKIN_ID, (byte)16); } @@ -87,12 +92,12 @@ public class SnowGolem extends AbstractGolem implements Shearable, RangedAttackM @Override public void aiStep() { super.aiStep(); - if (!this.level().isClientSide) { + if (this.level() instanceof ServerLevel serverLevel) { if (this.level().getBiome(this.blockPosition()).is(BiomeTags.SNOW_GOLEM_MELTS)) { - this.hurt(this.damageSources().onFire(), 1.0F); + this.hurtServer(serverLevel, this.damageSources().onFire(), 1.0F); } - if (!this.level().getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { + if (!serverLevel.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { return; } @@ -105,7 +110,7 @@ public class SnowGolem extends AbstractGolem implements Shearable, RangedAttackM BlockPos blockPos = new BlockPos(j, k, l); if (this.level().getBlockState(blockPos).isAir() && blockState.canSurvive(this.level(), blockPos)) { this.level().setBlockAndUpdate(blockPos, blockState); - this.level().gameEvent(GameEvent.BLOCK_PLACE, blockPos, GameEvent.Context.of(this, blockState)); + this.level().gameEvent(GameEvent.BLOCK_PLACE, blockPos, Context.of(this, blockState)); } } } @@ -113,40 +118,46 @@ public class SnowGolem extends AbstractGolem implements Shearable, RangedAttackM @Override public void performRangedAttack(LivingEntity target, float velocity) { - Snowball snowball = new Snowball(this.level(), this); - double d = target.getEyeY() - 1.1F; - double e = target.getX() - this.getX(); - double f = d - snowball.getY(); - double g = target.getZ() - this.getZ(); - double h = Math.sqrt(e * e + g * g) * 0.2F; - snowball.shoot(e, f + h, g, 1.6F, 12.0F); + double d = target.getX() - this.getX(); + double e = target.getEyeY() - 1.1F; + double f = target.getZ() - this.getZ(); + double g = Math.sqrt(d * d + f * f) * 0.2F; + if (this.level() instanceof ServerLevel serverLevel) { + ItemStack itemStack = new ItemStack(Items.SNOWBALL); + Projectile.spawnProjectile( + new Snowball(serverLevel, this, itemStack), serverLevel, itemStack, snowball -> snowball.shoot(d, e + g - snowball.getY(), f, 1.6F, 12.0F) + ); + } + this.playSound(SoundEvents.SNOW_GOLEM_SHOOT, 1.0F, 0.4F / (this.getRandom().nextFloat() * 0.4F + 0.8F)); - this.level().addFreshEntity(snowball); } @Override protected InteractionResult mobInteract(Player player, InteractionHand hand) { ItemStack itemStack = player.getItemInHand(hand); if (itemStack.is(Items.SHEARS) && this.readyForShearing()) { - this.shear(SoundSource.PLAYERS); - this.gameEvent(GameEvent.SHEAR, player); - if (!this.level().isClientSide) { + if (this.level() instanceof ServerLevel serverLevel) { + this.shear(serverLevel, SoundSource.PLAYERS, itemStack); + this.gameEvent(GameEvent.SHEAR, player); itemStack.hurtAndBreak(1, player, getSlotForHand(hand)); } - return InteractionResult.sidedSuccess(this.level().isClientSide); + return InteractionResult.SUCCESS; } else { return InteractionResult.PASS; } } @Override - public void shear(SoundSource source) { - this.level().playSound(null, this, SoundEvents.SNOW_GOLEM_SHEAR, source, 1.0F, 1.0F); - if (!this.level().isClientSide()) { - this.setPumpkin(false); - this.spawnAtLocation(new ItemStack(Items.CARVED_PUMPKIN), this.getEyeHeight()); - } + public void shear(ServerLevel serverLevel, SoundSource soundSource, ItemStack itemStack) { + serverLevel.playSound(null, this, SoundEvents.SNOW_GOLEM_SHEAR, soundSource, 1.0F, 1.0F); + this.setPumpkin(false); + this.dropFromShearingLootTable( + serverLevel, + BuiltInLootTables.SHEAR_SNOW_GOLEM, + itemStack, + (serverLevelx, itemStackx) -> this.spawnAtLocation(serverLevelx, itemStackx, this.getEyeHeight()) + ); } @Override diff --git a/net/minecraft/world/entity/animal/Squid.java b/net/minecraft/world/entity/animal/Squid.java index c18fbaa2..92fa3641 100644 --- a/net/minecraft/world/entity/animal/Squid.java +++ b/net/minecraft/world/entity/animal/Squid.java @@ -1,5 +1,6 @@ package net.minecraft.world.entity.animal; +import java.util.Objects; import net.minecraft.core.BlockPos; import net.minecraft.core.particles.ParticleOptions; import net.minecraft.core.particles.ParticleTypes; @@ -8,22 +9,28 @@ import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; import net.minecraft.tags.FluidTags; import net.minecraft.util.Mth; +import net.minecraft.world.DifficultyInstance; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.effect.MobEffects; +import net.minecraft.world.entity.AgeableMob; import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.Mob; import net.minecraft.world.entity.MoverType; -import net.minecraft.world.entity.ai.attributes.AttributeSupplier; +import net.minecraft.world.entity.SpawnGroupData; import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.entity.ai.attributes.AttributeSupplier.Builder; import net.minecraft.world.entity.ai.goal.Goal; import net.minecraft.world.level.Level; +import net.minecraft.world.level.ServerLevelAccessor; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.material.FluidState; import net.minecraft.world.phys.Vec3; +import org.jetbrains.annotations.Nullable; -public class Squid extends WaterAnimal { +public class Squid extends AgeableWaterCreature { public float xBodyRot; public float xBodyRotO; public float zBodyRot; @@ -35,9 +42,7 @@ public class Squid extends WaterAnimal { private float speed; private float tentacleSpeed; private float rotateSpeed; - private float tx; - private float ty; - private float tz; + Vec3 movementVector = Vec3.ZERO; public Squid(EntityType entityType, Level level) { super(entityType, level); @@ -51,7 +56,7 @@ public class Squid extends WaterAnimal { this.goalSelector.addGoal(1, new Squid.SquidFleeGoal()); } - public static AttributeSupplier.Builder createAttributes() { + public static Builder createAttributes() { return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 10.0); } @@ -89,6 +94,12 @@ public class Squid extends WaterAnimal { return Entity.MovementEmission.EVENTS; } + @Nullable + @Override + public AgeableMob getBreedOffspring(ServerLevel level, AgeableMob otherParent) { + return EntityType.SQUID.create(level, EntitySpawnReason.BREEDING); + } + @Override protected double getDefaultGravity() { return 0.08; @@ -120,19 +131,21 @@ public class Squid extends WaterAnimal { float f = this.tentacleMovement / (float) Math.PI; this.tentacleAngle = Mth.sin(f * f * (float) Math.PI) * (float) Math.PI * 0.25F; if (f > 0.75) { - this.speed = 1.0F; + if (this.isControlledByLocalInstance()) { + this.setDeltaMovement(this.movementVector); + } + this.rotateSpeed = 1.0F; } else { this.rotateSpeed *= 0.8F; } } else { this.tentacleAngle = 0.0F; - this.speed *= 0.9F; - this.rotateSpeed *= 0.99F; - } + if (this.isControlledByLocalInstance()) { + this.setDeltaMovement(this.getDeltaMovement().scale(0.9)); + } - if (!this.level().isClientSide) { - this.setDeltaMovement(this.tx * this.speed, this.ty * this.speed, this.tz * this.speed); + this.rotateSpeed *= 0.99F; } Vec3 vec3 = this.getDeltaMovement(); @@ -159,12 +172,9 @@ public class Squid extends WaterAnimal { } @Override - public boolean hurt(DamageSource source, float amount) { - if (super.hurt(source, amount) && this.getLastHurtByMob() != null) { - if (!this.level().isClientSide) { - this.spawnInk(); - } - + public boolean hurtServer(ServerLevel serverLevel, DamageSource damageSource, float f) { + if (super.hurtServer(serverLevel, damageSource, f) && this.getLastHurtByMob() != null) { + this.spawnInk(); return true; } else { return false; @@ -182,7 +192,8 @@ public class Squid extends WaterAnimal { for (int i = 0; i < 30; i++) { Vec3 vec32 = this.rotateVector(new Vec3(this.random.nextFloat() * 0.6 - 0.3, -1.0, this.random.nextFloat() * 0.6 - 0.3)); - Vec3 vec33 = vec32.scale(0.3 + this.random.nextFloat() * 2.0F); + float f = this.isBaby() ? 0.1F : 0.3F; + Vec3 vec33 = vec32.scale(f + this.random.nextFloat() * 2.0F); ((ServerLevel)this.level()).sendParticles(this.getInkParticle(), vec3.x, vec3.y + 0.5, vec3.z, 0, vec33.x, vec33.y, vec33.z, 0.1F); } } @@ -193,7 +204,9 @@ public class Squid extends WaterAnimal { @Override public void travel(Vec3 travelVector) { - this.move(MoverType.SELF, this.getDeltaMovement()); + if (this.isControlledByLocalInstance()) { + this.move(MoverType.SELF, this.getDeltaMovement()); + } } @Override @@ -205,14 +218,17 @@ public class Squid extends WaterAnimal { } } - public void setMovementVector(float tx, float ty, float tz) { - this.tx = tx; - this.ty = ty; - this.tz = tz; + public boolean hasMovementVector() { + return this.movementVector.lengthSqr() > 1.0E-5F; } - public boolean hasMovementVector() { - return this.tx != 0.0F || this.ty != 0.0F || this.tz != 0.0F; + @Nullable + @Override + public SpawnGroupData finalizeSpawn( + ServerLevelAccessor serverLevelAccessor, DifficultyInstance difficultyInstance, EntitySpawnReason entitySpawnReason, @Nullable SpawnGroupData spawnGroupData + ) { + SpawnGroupData spawnGroupData2 = (SpawnGroupData)Objects.requireNonNullElseGet(spawnGroupData, () -> new AgeableMob.AgeableMobGroupData(0.05F)); + return super.finalizeSpawn(serverLevelAccessor, difficultyInstance, entitySpawnReason, spawnGroupData2); } class SquidFleeGoal extends Goal { @@ -265,7 +281,7 @@ public class Squid extends WaterAnimal { vec3 = vec3.subtract(0.0, vec3.y, 0.0); } - Squid.this.setMovementVector((float)vec3.x / 20.0F, (float)vec3.y / 20.0F, (float)vec3.z / 20.0F); + Squid.this.movementVector = new Vec3(vec3.x / 20.0, vec3.y / 20.0, vec3.z / 20.0); } if (this.fleeTicks % 10 == 5) { @@ -291,13 +307,10 @@ public class Squid extends WaterAnimal { public void tick() { int i = this.squid.getNoActionTime(); if (i > 100) { - this.squid.setMovementVector(0.0F, 0.0F, 0.0F); + this.squid.movementVector = Vec3.ZERO; } else if (this.squid.getRandom().nextInt(reducedTickDelay(50)) == 0 || !this.squid.wasTouchingWater || !this.squid.hasMovementVector()) { float f = this.squid.getRandom().nextFloat() * (float) (Math.PI * 2); - float g = Mth.cos(f) * 0.2F; - float h = -0.1F + this.squid.getRandom().nextFloat() * 0.2F; - float j = Mth.sin(f) * 0.2F; - this.squid.setMovementVector(g, h, j); + this.squid.movementVector = new Vec3(Mth.cos(f) * 0.2F, -0.1F + this.squid.getRandom().nextFloat() * 0.2F, Mth.sin(f) * 0.2F); } } } diff --git a/net/minecraft/world/entity/animal/TropicalFish.java b/net/minecraft/world/entity/animal/TropicalFish.java index 9ea05a46..8eeabf84 100644 --- a/net/minecraft/world/entity/animal/TropicalFish.java +++ b/net/minecraft/world/entity/animal/TropicalFish.java @@ -11,6 +11,7 @@ import net.minecraft.network.chat.Component; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.network.syncher.SynchedEntityData.Builder; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; import net.minecraft.tags.BiomeTags; @@ -20,8 +21,8 @@ import net.minecraft.util.RandomSource; import net.minecraft.util.StringRepresentable; import net.minecraft.world.DifficultyInstance; import net.minecraft.world.damagesource.DamageSource; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; -import net.minecraft.world.entity.MobSpawnType; import net.minecraft.world.entity.SpawnGroupData; import net.minecraft.world.entity.VariantHolder; import net.minecraft.world.item.DyeColor; @@ -88,7 +89,7 @@ public class TropicalFish extends AbstractSchoolingFish implements VariantHolder } @Override - protected void defineSynchedData(SynchedEntityData.Builder builder) { + protected void defineSynchedData(Builder builder) { super.defineSynchedData(builder); builder.define(DATA_ID_TYPE_VARIANT, 0); } @@ -178,9 +179,11 @@ public class TropicalFish extends AbstractSchoolingFish implements VariantHolder @Nullable @Override - public SpawnGroupData finalizeSpawn(ServerLevelAccessor level, DifficultyInstance difficulty, MobSpawnType spawnType, @Nullable SpawnGroupData spawnGroupData) { - spawnGroupData = super.finalizeSpawn(level, difficulty, spawnType, spawnGroupData); - RandomSource randomSource = level.getRandom(); + public SpawnGroupData finalizeSpawn( + ServerLevelAccessor serverLevelAccessor, DifficultyInstance difficultyInstance, EntitySpawnReason entitySpawnReason, @Nullable SpawnGroupData spawnGroupData + ) { + spawnGroupData = super.finalizeSpawn(serverLevelAccessor, difficultyInstance, entitySpawnReason, spawnGroupData); + RandomSource randomSource = serverLevelAccessor.getRandom(); TropicalFish.Variant variant; if (spawnGroupData instanceof TropicalFish.TropicalFishGroupData tropicalFishGroupData) { variant = tropicalFishGroupData.variant; @@ -202,13 +205,13 @@ public class TropicalFish extends AbstractSchoolingFish implements VariantHolder } public static boolean checkTropicalFishSpawnRules( - EntityType tropicalFish, LevelAccessor level, MobSpawnType spawnType, BlockPos pos, RandomSource random + EntityType entityType, LevelAccessor levelAccessor, EntitySpawnReason entitySpawnReason, BlockPos blockPos, RandomSource randomSource ) { - return level.getFluidState(pos.below()).is(FluidTags.WATER) - && level.getBlockState(pos.above()).is(Blocks.WATER) + return levelAccessor.getFluidState(blockPos.below()).is(FluidTags.WATER) + && levelAccessor.getBlockState(blockPos.above()).is(Blocks.WATER) && ( - level.getBiome(pos).is(BiomeTags.ALLOWS_TROPICAL_FISH_SPAWNS_AT_ANY_HEIGHT) - || WaterAnimal.checkSurfaceWaterAnimalSpawnRules(tropicalFish, level, spawnType, pos, random) + levelAccessor.getBiome(blockPos).is(BiomeTags.ALLOWS_TROPICAL_FISH_SPAWNS_AT_ANY_HEIGHT) + || WaterAnimal.checkSurfaceWaterAnimalSpawnRules(entityType, levelAccessor, entitySpawnReason, blockPos, randomSource) ); } diff --git a/net/minecraft/world/entity/animal/Turtle.java b/net/minecraft/world/entity/animal/Turtle.java index c921e8d1..22af76c0 100644 --- a/net/minecraft/world/entity/animal/Turtle.java +++ b/net/minecraft/world/entity/animal/Turtle.java @@ -1,12 +1,12 @@ package net.minecraft.world.entity.animal; -import java.util.function.Predicate; import net.minecraft.advancements.CriteriaTriggers; import net.minecraft.core.BlockPos; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.network.syncher.SynchedEntityData.Builder; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.sounds.SoundEvent; @@ -23,16 +23,13 @@ import net.minecraft.world.entity.AgeableMob; import net.minecraft.world.entity.EntityAttachment; import net.minecraft.world.entity.EntityAttachments; import net.minecraft.world.entity.EntityDimensions; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.ExperienceOrb; import net.minecraft.world.entity.LightningBolt; -import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.entity.Mob; -import net.minecraft.world.entity.MobSpawnType; import net.minecraft.world.entity.MoverType; import net.minecraft.world.entity.Pose; import net.minecraft.world.entity.SpawnGroupData; -import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.entity.ai.control.MoveControl; import net.minecraft.world.entity.ai.goal.BreedGoal; @@ -44,6 +41,7 @@ import net.minecraft.world.entity.ai.goal.RandomStrollGoal; import net.minecraft.world.entity.ai.goal.TemptGoal; import net.minecraft.world.entity.ai.navigation.AmphibiousPathNavigation; import net.minecraft.world.entity.ai.navigation.PathNavigation; +import net.minecraft.world.entity.ai.targeting.TargetingConditions; import net.minecraft.world.entity.ai.util.DefaultRandomPos; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; @@ -58,6 +56,7 @@ import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.TurtleEggBlock; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.level.gameevent.GameEvent.Context; import net.minecraft.world.level.pathfinder.PathType; import net.minecraft.world.phys.Vec3; import org.jetbrains.annotations.Nullable; @@ -75,7 +74,7 @@ public class Turtle extends Animal { .withAttachments(EntityAttachments.builder().attach(EntityAttachment.PASSENGER, 0.0F, EntityType.TURTLE.getHeight(), -0.25F)) .scale(0.3F); int layEggCounter; - public static final Predicate BABY_ON_LAND_SELECTOR = livingEntity -> livingEntity.isBaby() && !livingEntity.isInWater(); + public static final TargetingConditions.Selector BABY_ON_LAND_SELECTOR = (livingEntity, serverLevel) -> livingEntity.isBaby() && !livingEntity.isInWater(); public Turtle(EntityType entityType, Level level) { super(entityType, level); @@ -136,7 +135,7 @@ public class Turtle extends Animal { } @Override - protected void defineSynchedData(SynchedEntityData.Builder builder) { + protected void defineSynchedData(Builder builder) { super.defineSynchedData(builder); builder.define(HOME_POS, BlockPos.ZERO); builder.define(HAS_EGG, false); @@ -174,14 +173,18 @@ public class Turtle extends Animal { @Nullable @Override - public SpawnGroupData finalizeSpawn(ServerLevelAccessor level, DifficultyInstance difficulty, MobSpawnType spawnType, @Nullable SpawnGroupData spawnGroupData) { + public SpawnGroupData finalizeSpawn( + ServerLevelAccessor serverLevelAccessor, DifficultyInstance difficultyInstance, EntitySpawnReason entitySpawnReason, @Nullable SpawnGroupData spawnGroupData + ) { this.setHomePos(this.blockPosition()); this.setTravelPos(BlockPos.ZERO); - return super.finalizeSpawn(level, difficulty, spawnType, spawnGroupData); + return super.finalizeSpawn(serverLevelAccessor, difficultyInstance, entitySpawnReason, spawnGroupData); } - public static boolean checkTurtleSpawnRules(EntityType turtle, LevelAccessor level, MobSpawnType spawnType, BlockPos pos, RandomSource random) { - return pos.getY() < level.getSeaLevel() + 4 && TurtleEggBlock.onSand(level, pos) && isBrightEnoughToSpawn(level, pos); + public static boolean checkTurtleSpawnRules( + EntityType entityType, LevelAccessor levelAccessor, EntitySpawnReason entitySpawnReason, BlockPos blockPos, RandomSource randomSource + ) { + return blockPos.getY() < levelAccessor.getSeaLevel() + 4 && TurtleEggBlock.onSand(levelAccessor, blockPos) && isBrightEnoughToSpawn(levelAccessor, blockPos); } @Override @@ -197,8 +200,8 @@ public class Turtle extends Animal { this.goalSelector.addGoal(9, new Turtle.TurtleRandomStrollGoal(this, 1.0, 100)); } - public static AttributeSupplier.Builder createAttributes() { - return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 30.0).add(Attributes.MOVEMENT_SPEED, 0.25).add(Attributes.STEP_HEIGHT, 1.0); + public static net.minecraft.world.entity.ai.attributes.AttributeSupplier.Builder createAttributes() { + return Animal.createAnimalAttributes().add(Attributes.MAX_HEALTH, 30.0).add(Attributes.MOVEMENT_SPEED, 0.25).add(Attributes.STEP_HEIGHT, 1.0); } @Override @@ -268,7 +271,7 @@ public class Turtle extends Animal { @Nullable @Override public AgeableMob getBreedOffspring(ServerLevel level, AgeableMob otherParent) { - return EntityType.TURTLE.create(level); + return EntityType.TURTLE.create(level, EntitySpawnReason.BREEDING); } @Override @@ -300,8 +303,8 @@ public class Turtle extends Animal { @Override protected void ageBoundaryReached() { super.ageBoundaryReached(); - if (!this.isBaby() && this.level().getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) { - this.spawnAtLocation(Items.TURTLE_SCUTE, 1); + if (!this.isBaby() && this.level() instanceof ServerLevel serverLevel && serverLevel.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) { + this.spawnAtLocation(serverLevel, Items.TURTLE_SCUTE, 1); } } @@ -326,7 +329,7 @@ public class Turtle extends Animal { @Override public void thunderHit(ServerLevel level, LightningBolt lightning) { - this.hurt(this.damageSources().lightningBolt(), Float.MAX_VALUE); + this.hurtServer(level, this.damageSources().lightningBolt(), Float.MAX_VALUE); } @Override @@ -365,7 +368,7 @@ public class Turtle extends Animal { this.animal.resetLove(); this.partner.resetLove(); RandomSource randomSource = this.animal.getRandom(); - if (this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) { + if (getServerLevel(this.level).getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) { this.level.addFreshEntity(new ExperienceOrb(this.level, this.animal.getX(), this.animal.getY(), this.animal.getZ(), randomSource.nextInt(7) + 1)); } } @@ -506,7 +509,7 @@ public class Turtle extends Animal { BlockPos blockPos2 = this.blockPos.above(); BlockState blockState = Blocks.TURTLE_EGG.defaultBlockState().setValue(TurtleEggBlock.EGGS, this.turtle.random.nextInt(4) + 1); level.setBlock(blockPos2, blockState, 3); - level.gameEvent(GameEvent.BLOCK_PLACE, blockPos2, GameEvent.Context.of(this.turtle, blockState)); + level.gameEvent(GameEvent.BLOCK_PLACE, blockPos2, Context.of(this.turtle, blockState)); this.turtle.setHasEgg(false); this.turtle.setLayingEgg(false); this.turtle.setInLoveTime(600); diff --git a/net/minecraft/world/entity/animal/WaterAnimal.java b/net/minecraft/world/entity/animal/WaterAnimal.java index 9ae0b781..a7cd9cb1 100644 --- a/net/minecraft/world/entity/animal/WaterAnimal.java +++ b/net/minecraft/world/entity/animal/WaterAnimal.java @@ -1,10 +1,11 @@ package net.minecraft.world.entity.animal; import net.minecraft.core.BlockPos; +import net.minecraft.server.level.ServerLevel; import net.minecraft.tags.FluidTags; import net.minecraft.util.RandomSource; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; -import net.minecraft.world.entity.MobSpawnType; import net.minecraft.world.entity.PathfinderMob; import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelAccessor; @@ -13,6 +14,8 @@ import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.pathfinder.PathType; public abstract class WaterAnimal extends PathfinderMob { + public static final int AMBIENT_SOUND_INTERVAL = 120; + protected WaterAnimal(EntityType entityType, Level level) { super(entityType, level); this.setPathfindingMalus(PathType.WATER, 0.0F); @@ -29,8 +32,8 @@ public abstract class WaterAnimal extends PathfinderMob { } @Override - protected int getBaseExperienceReward() { - return 1 + this.level().random.nextInt(3); + protected int getBaseExperienceReward(ServerLevel serverLevel) { + return 1 + this.random.nextInt(3); } protected void handleAirSupply(int airSupply) { @@ -63,10 +66,13 @@ public abstract class WaterAnimal extends PathfinderMob { } public static boolean checkSurfaceWaterAnimalSpawnRules( - EntityType waterAnimal, LevelAccessor level, MobSpawnType spawnType, BlockPos pos, RandomSource random + EntityType entityType, LevelAccessor levelAccessor, EntitySpawnReason entitySpawnReason, BlockPos blockPos, RandomSource randomSource ) { - int i = level.getSeaLevel(); + int i = levelAccessor.getSeaLevel(); int j = i - 13; - return pos.getY() >= j && pos.getY() <= i && level.getFluidState(pos.below()).is(FluidTags.WATER) && level.getBlockState(pos.above()).is(Blocks.WATER); + return blockPos.getY() >= j + && blockPos.getY() <= i + && levelAccessor.getFluidState(blockPos.below()).is(FluidTags.WATER) + && levelAccessor.getBlockState(blockPos.above()).is(Blocks.WATER); } } diff --git a/net/minecraft/world/entity/animal/Wolf.java b/net/minecraft/world/entity/animal/Wolf.java index 842bdf42..c5550a24 100644 --- a/net/minecraft/world/entity/animal/Wolf.java +++ b/net/minecraft/world/entity/animal/Wolf.java @@ -2,7 +2,6 @@ package net.minecraft.world.entity.animal; import java.util.Optional; import java.util.UUID; -import java.util.function.Predicate; import net.minecraft.core.BlockPos; import net.minecraft.core.Holder; import net.minecraft.core.Registry; @@ -33,17 +32,16 @@ import net.minecraft.world.InteractionResult; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.AgeableMob; import net.minecraft.world.entity.Crackiness; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.entity.Mob; -import net.minecraft.world.entity.MobSpawnType; import net.minecraft.world.entity.NeutralMob; import net.minecraft.world.entity.SpawnGroupData; import net.minecraft.world.entity.TamableAnimal; import net.minecraft.world.entity.VariantHolder; -import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.entity.ai.attributes.AttributeSupplier.Builder; import net.minecraft.world.entity.ai.goal.AvoidEntityGoal; import net.minecraft.world.entity.ai.goal.BegGoal; import net.minecraft.world.entity.ai.goal.BreedGoal; @@ -61,6 +59,7 @@ import net.minecraft.world.entity.ai.goal.target.NonTameRandomTargetGoal; import net.minecraft.world.entity.ai.goal.target.OwnerHurtByTargetGoal; import net.minecraft.world.entity.ai.goal.target.OwnerHurtTargetGoal; import net.minecraft.world.entity.ai.goal.target.ResetUniversalAngerTargetGoal; +import net.minecraft.world.entity.ai.targeting.TargetingConditions; import net.minecraft.world.entity.animal.horse.AbstractHorse; import net.minecraft.world.entity.animal.horse.Llama; import net.minecraft.world.entity.decoration.ArmorStand; @@ -69,13 +68,11 @@ import net.minecraft.world.entity.monster.Creeper; import net.minecraft.world.entity.monster.Ghast; import net.minecraft.world.entity.player.Player; import net.minecraft.world.food.FoodProperties; -import net.minecraft.world.item.ArmorMaterials; import net.minecraft.world.item.DyeColor; import net.minecraft.world.item.DyeItem; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; -import net.minecraft.world.item.crafting.Ingredient; import net.minecraft.world.item.enchantment.EnchantmentEffectComponents; import net.minecraft.world.item.enchantment.EnchantmentHelper; import net.minecraft.world.level.Level; @@ -93,13 +90,14 @@ public class Wolf extends TamableAnimal implements NeutralMob, VariantHolder DATA_COLLAR_COLOR = SynchedEntityData.defineId(Wolf.class, EntityDataSerializers.INT); private static final EntityDataAccessor DATA_REMAINING_ANGER_TIME = SynchedEntityData.defineId(Wolf.class, EntityDataSerializers.INT); private static final EntityDataAccessor> DATA_VARIANT_ID = SynchedEntityData.defineId(Wolf.class, EntityDataSerializers.WOLF_VARIANT); - public static final Predicate PREY_SELECTOR = livingEntity -> { + public static final TargetingConditions.Selector PREY_SELECTOR = (livingEntity, serverLevel) -> { EntityType entityType = livingEntity.getType(); return entityType == EntityType.SHEEP || entityType == EntityType.RABBIT || entityType == EntityType.FOX; }; private static final float START_HEALTH = 8.0F; private static final float TAME_HEALTH = 40.0F; private static final float ARMOR_REPAIR_UNIT = 0.125F; + public static final float DEFAULT_TAIL_ANGLE = (float) (Math.PI / 5); private float interestedAngle; private float interestedAngleO; private boolean isWet; @@ -158,16 +156,16 @@ public class Wolf extends TamableAnimal implements NeutralMob, VariantHolder registry = registryAccess.registryOrThrow(Registries.WOLF_VARIANT); - builder.define(DATA_VARIANT_ID, (Holder)registry.getHolder(WolfVariants.DEFAULT).or(registry::getAny).orElseThrow()); + Registry registry = registryAccess.lookupOrThrow(Registries.WOLF_VARIANT); + builder.define(DATA_VARIANT_ID, (Holder)registry.get(WolfVariants.DEFAULT).or(registry::getAny).orElseThrow()); builder.define(DATA_INTERESTED_ID, false); builder.define(DATA_COLLAR_COLOR, DyeColor.RED.getId()); builder.define(DATA_REMAINING_ANGER_TIME, 0); @@ -191,7 +189,7 @@ public class Wolf extends TamableAnimal implements NeutralMob, VariantHolder ResourceKey.create(Registries.WOLF_VARIANT, resourceLocation)) - .flatMap(resourceKey -> this.registryAccess().registryOrThrow(Registries.WOLF_VARIANT).getHolder(resourceKey)) + .flatMap(resourceKey -> this.registryAccess().lookupOrThrow(Registries.WOLF_VARIANT).get(resourceKey)) .ifPresent(this::setVariant); if (compound.contains("CollarColor", 99)) { this.setCollarColor(DyeColor.byId(compound.getInt("CollarColor"))); @@ -202,8 +200,10 @@ public class Wolf extends TamableAnimal implements NeutralMob, VariantHolder holder = level.getBiome(this.blockPosition()); + public SpawnGroupData finalizeSpawn( + ServerLevelAccessor serverLevelAccessor, DifficultyInstance difficultyInstance, EntitySpawnReason entitySpawnReason, @Nullable SpawnGroupData spawnGroupData + ) { + Holder holder = serverLevelAccessor.getBiome(this.blockPosition()); Holder holder2; if (spawnGroupData instanceof Wolf.WolfPackData wolfPackData) { holder2 = wolfPackData.type; @@ -213,7 +213,7 @@ public class Wolf extends TamableAnimal implements NeutralMob, VariantHolder 1.0F) { - f = 1.0F; - } - - return Mth.sin(f * (float) Math.PI) * Mth.sin(f * (float) Math.PI * 11.0F) * 0.15F * (float) Math.PI; + public float getShakeAnim(float f) { + return Mth.lerp(f, this.shakeAnimO, this.shakeAnim); } public float getHeadRollAngle(float partialTicks) { @@ -354,15 +340,12 @@ public class Wolf extends TamableAnimal implements NeutralMob, VariantHolder wolf, LevelAccessor level, MobSpawnType spawnType, BlockPos pos, RandomSource random) { - return level.getBlockState(pos.below()).is(BlockTags.WOLVES_SPAWNABLE_ON) && isBrightEnoughToSpawn(level, pos); + public static boolean checkWolfSpawnRules( + EntityType entityType, LevelAccessor levelAccessor, EntitySpawnReason entitySpawnReason, BlockPos blockPos, RandomSource randomSource + ) { + return levelAccessor.getBlockState(blockPos.below()).is(BlockTags.WOLVES_SPAWNABLE_ON) && isBrightEnoughToSpawn(levelAccessor, blockPos); } class WolfAvoidEntityGoal extends AvoidEntityGoal { diff --git a/net/minecraft/world/entity/animal/WolfVariants.java b/net/minecraft/world/entity/animal/WolfVariants.java index 838609b6..49fffe18 100644 --- a/net/minecraft/world/entity/animal/WolfVariants.java +++ b/net/minecraft/world/entity/animal/WolfVariants.java @@ -45,11 +45,11 @@ public class WolfVariants { } public static Holder getSpawnVariant(RegistryAccess registryAccess, Holder biome) { - Registry registry = registryAccess.registryOrThrow(Registries.WOLF_VARIANT); - return (Holder)registry.holders() + Registry registry = registryAccess.lookupOrThrow(Registries.WOLF_VARIANT); + return (Holder)registry.listElements() .filter(reference -> ((WolfVariant)reference.value()).biomes().contains(biome)) .findFirst() - .or(() -> registry.getHolder(DEFAULT)) + .or(() -> registry.get(DEFAULT)) .or(registry::getAny) .orElseThrow(); } diff --git a/net/minecraft/world/entity/animal/allay/Allay.java b/net/minecraft/world/entity/animal/allay/Allay.java index feb02b9c..10954c0e 100644 --- a/net/minecraft/world/entity/animal/allay/Allay.java +++ b/net/minecraft/world/entity/animal/allay/Allay.java @@ -26,21 +26,26 @@ import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; import net.minecraft.tags.GameEventTags; +import net.minecraft.tags.ItemTags; import net.minecraft.tags.TagKey; import net.minecraft.util.Mth; +import net.minecraft.util.profiling.Profiler; +import net.minecraft.util.profiling.ProfilerFiller; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.SimpleContainer; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.Mob; import net.minecraft.world.entity.MoverType; import net.minecraft.world.entity.PathfinderMob; import net.minecraft.world.entity.ai.Brain; -import net.minecraft.world.entity.ai.attributes.AttributeSupplier; +import net.minecraft.world.entity.ai.Brain.Provider; import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.entity.ai.attributes.AttributeSupplier.Builder; import net.minecraft.world.entity.ai.behavior.BehaviorUtils; import net.minecraft.world.entity.ai.control.FlyingMoveControl; import net.minecraft.world.entity.ai.memory.MemoryModuleType; @@ -53,9 +58,7 @@ import net.minecraft.world.entity.item.ItemEntity; import net.minecraft.world.entity.npc.InventoryCarrier; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.Items; import net.minecraft.world.item.alchemy.PotionContents; -import net.minecraft.world.item.crafting.Ingredient; import net.minecraft.world.item.enchantment.EnchantmentEffectComponents; import net.minecraft.world.item.enchantment.EnchantmentHelper; import net.minecraft.world.level.GameRules; @@ -67,7 +70,12 @@ import net.minecraft.world.level.gameevent.EntityPositionSource; import net.minecraft.world.level.gameevent.GameEvent; import net.minecraft.world.level.gameevent.GameEventListener; import net.minecraft.world.level.gameevent.PositionSource; +import net.minecraft.world.level.gameevent.GameEvent.Context; import net.minecraft.world.level.gameevent.vibrations.VibrationSystem; +import net.minecraft.world.level.gameevent.vibrations.VibrationSystem.Data; +import net.minecraft.world.level.gameevent.vibrations.VibrationSystem.Listener; +import net.minecraft.world.level.gameevent.vibrations.VibrationSystem.Ticker; +import net.minecraft.world.level.gameevent.vibrations.VibrationSystem.User; import net.minecraft.world.phys.Vec3; import org.jetbrains.annotations.Nullable; import org.slf4j.Logger; @@ -78,9 +86,9 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS private static final int LIFTING_ITEM_ANIMATION_DURATION = 5; private static final float DANCING_LOOP_DURATION = 55.0F; private static final float SPINNING_ANIMATION_DURATION = 15.0F; - private static final Ingredient DUPLICATION_ITEM = Ingredient.of(Items.AMETHYST_SHARD); private static final int DUPLICATION_COOLDOWN_TICKS = 6000; private static final int NUM_OF_DUPLICATION_HEARTS = 3; + public static final int MAX_NOTEBLOCK_DISTANCE = 1024; private static final EntityDataAccessor DATA_DANCING = SynchedEntityData.defineId(Allay.class, EntityDataSerializers.BOOLEAN); private static final EntityDataAccessor DATA_CAN_DUPLICATE = SynchedEntityData.defineId(Allay.class, EntityDataSerializers.BOOLEAN); protected static final ImmutableList>> SENSOR_TYPES = ImmutableList.of( @@ -103,9 +111,9 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS public static final ImmutableList THROW_SOUND_PITCHES = ImmutableList.of( 0.5625F, 0.625F, 0.75F, 0.9375F, 1.0F, 1.0F, 1.125F, 1.25F, 1.5F, 1.875F, 2.0F, 2.25F, 2.5F, 3.0F, 3.75F, 4.0F ); - private final DynamicGameEventListener dynamicVibrationListener; - private VibrationSystem.Data vibrationData; - private final VibrationSystem.User vibrationUser; + private final DynamicGameEventListener dynamicVibrationListener; + private Data vibrationData; + private final User vibrationUser; private final DynamicGameEventListener dynamicJukeboxListener; private final SimpleContainer inventory = new SimpleContainer(1); @Nullable @@ -122,15 +130,15 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS this.moveControl = new FlyingMoveControl(this, 20, true); this.setCanPickUpLoot(this.canPickUpLoot()); this.vibrationUser = new Allay.VibrationUser(); - this.vibrationData = new VibrationSystem.Data(); - this.dynamicVibrationListener = new DynamicGameEventListener<>(new VibrationSystem.Listener(this)); + this.vibrationData = new Data(); + this.dynamicVibrationListener = new DynamicGameEventListener<>(new Listener(this)); this.dynamicJukeboxListener = new DynamicGameEventListener<>( new Allay.JukeboxListener(this.vibrationUser.getPositionSource(), GameEvent.JUKEBOX_PLAY.value().notificationRadius()) ); } @Override - protected Brain.Provider brainProvider() { + protected Provider brainProvider() { return Brain.provider(MEMORY_TYPES, SENSOR_TYPES); } @@ -144,13 +152,12 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS return (Brain)super.getBrain(); } - public static AttributeSupplier.Builder createAttributes() { + public static Builder createAttributes() { return Mob.createMobAttributes() .add(Attributes.MAX_HEALTH, 20.0) .add(Attributes.FLYING_SPEED, 0.1F) .add(Attributes.MOVEMENT_SPEED, 0.1F) - .add(Attributes.ATTACK_DAMAGE, 2.0) - .add(Attributes.FOLLOW_RANGE, 48.0); + .add(Attributes.ATTACK_DAMAGE, 2.0); } @Override @@ -159,11 +166,12 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS flyingPathNavigation.setCanOpenDoors(false); flyingPathNavigation.setCanFloat(true); flyingPathNavigation.setCanPassDoors(true); + flyingPathNavigation.setRequiredPathLength(48.0F); return flyingPathNavigation; } @Override - protected void defineSynchedData(SynchedEntityData.Builder builder) { + protected void defineSynchedData(net.minecraft.network.syncher.SynchedEntityData.Builder builder) { super.defineSynchedData(builder); builder.define(DATA_DANCING, false); builder.define(DATA_CAN_DUPLICATE, true); @@ -186,20 +194,18 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS this.setDeltaMovement(this.getDeltaMovement().scale(0.91F)); } } - - this.calculateEntityAnimation(false); } @Override - public boolean hurt(DamageSource source, float amount) { - if (source.getEntity() instanceof Player player) { + public boolean hurtServer(ServerLevel serverLevel, DamageSource damageSource, float f) { + if (damageSource.getEntity() instanceof Player player) { Optional optional = this.getBrain().getMemory(MemoryModuleType.LIKED_PLAYER); if (optional.isPresent() && player.getUUID().equals(optional.get())) { return false; } } - return super.hurt(source, amount); + return super.hurtServer(serverLevel, damageSource, f); } @Override @@ -231,14 +237,15 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS } @Override - protected void customServerAiStep() { - this.level().getProfiler().push("allayBrain"); - this.getBrain().tick((ServerLevel)this.level(), this); - this.level().getProfiler().pop(); - this.level().getProfiler().push("allayActivityUpdate"); + protected void customServerAiStep(ServerLevel serverLevel) { + ProfilerFiller profilerFiller = Profiler.get(); + profilerFiller.push("allayBrain"); + this.getBrain().tick(serverLevel, this); + profilerFiller.pop(); + profilerFiller.push("allayActivityUpdate"); AllayAi.updateActivity(this); - this.level().getProfiler().pop(); - super.customServerAiStep(); + profilerFiller.pop(); + super.customServerAiStep(serverLevel); } @Override @@ -283,7 +290,7 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS this.spinningAnimationTicks0 = 0.0F; } } else { - VibrationSystem.Ticker.tick(this.level(), this.vibrationData, this.vibrationUser); + Ticker.tick(this.level(), this.vibrationData, this.vibrationUser); if (this.isPanicking()) { this.setDancing(false); } @@ -300,7 +307,7 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS } @Override - public boolean canTakeItem(ItemStack stack) { + protected boolean canDispenserEquipIntoSlot(EquipmentSlot equipmentSlot) { return false; } @@ -312,7 +319,7 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS protected InteractionResult mobInteract(Player player, InteractionHand hand) { ItemStack itemStack = player.getItemInHand(hand); ItemStack itemStack2 = this.getItemInHand(InteractionHand.MAIN_HAND); - if (this.isDancing() && this.isDuplicationItem(itemStack) && this.canDuplicate()) { + if (this.isDancing() && itemStack.is(ItemTags.DUPLICATES_ALLAYS) && this.canDuplicate()) { this.duplicateAllay(); this.level().broadcastEntityEvent(this, (byte)18); this.level().playSound(player, this, SoundEvents.AMETHYST_BLOCK_CHIME, SoundSource.NEUTRAL, 2.0F, 1.0F); @@ -365,12 +372,12 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS } @Override - public boolean wantsToPickUp(ItemStack stack) { - ItemStack itemStack = this.getItemInHand(InteractionHand.MAIN_HAND); - return !itemStack.isEmpty() - && this.level().getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) - && this.inventory.canAddItem(stack) - && this.allayConsidersItemEqual(itemStack, stack); + public boolean wantsToPickUp(ServerLevel serverLevel, ItemStack itemStack) { + ItemStack itemStack2 = this.getItemInHand(InteractionHand.MAIN_HAND); + return !itemStack2.isEmpty() + && serverLevel.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) + && this.inventory.canAddItem(itemStack) + && this.allayConsidersItemEqual(itemStack2, itemStack); } private boolean allayConsidersItemEqual(ItemStack first, ItemStack second) { @@ -384,8 +391,8 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS } @Override - protected void pickUpItem(ItemEntity itemEntity) { - InventoryCarrier.pickUpItem(this, this, itemEntity); + protected void pickUpItem(ServerLevel serverLevel, ItemEntity itemEntity) { + InventoryCarrier.pickUpItem(serverLevel, this, this, itemEntity); } @Override @@ -442,12 +449,12 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS } @Override - protected void dropEquipment() { - super.dropEquipment(); - this.inventory.removeAllItems().forEach(this::spawnAtLocation); + protected void dropEquipment(ServerLevel serverLevel) { + super.dropEquipment(serverLevel); + this.inventory.removeAllItems().forEach(itemStackx -> this.spawnAtLocation(serverLevel, itemStackx)); ItemStack itemStack = this.getItemBySlot(EquipmentSlot.MAINHAND); if (!itemStack.isEmpty() && !EnchantmentHelper.has(itemStack, EnchantmentEffectComponents.PREVENT_EQUIPMENT_DROP)) { - this.spawnAtLocation(itemStack); + this.spawnAtLocation(serverLevel, itemStack); this.setItemSlot(EquipmentSlot.MAINHAND, ItemStack.EMPTY); } } @@ -462,7 +469,7 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS super.addAdditionalSaveData(compound); this.writeInventoryToTag(compound, this.registryAccess()); RegistryOps registryOps = this.registryAccess().createSerializationContext(NbtOps.INSTANCE); - VibrationSystem.Data.CODEC + Data.CODEC .encodeStart(registryOps, this.vibrationData) .resultOrPartial(string -> LOGGER.error("Failed to encode vibration listener for Allay: '{}'", string)) .ifPresent(tag -> compound.put("listener", tag)); @@ -476,7 +483,7 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS this.readInventoryFromTag(compound, this.registryAccess()); RegistryOps registryOps = this.registryAccess().createSerializationContext(NbtOps.INSTANCE); if (compound.contains("listener", 10)) { - VibrationSystem.Data.CODEC + Data.CODEC .parse(registryOps, compound.getCompound("listener")) .resultOrPartial(string -> LOGGER.error("Failed to parse vibration listener for Allay: '{}'", string)) .ifPresent(data -> this.vibrationData = data); @@ -501,12 +508,8 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS } } - private boolean isDuplicationItem(ItemStack stack) { - return DUPLICATION_ITEM.test(stack); - } - private void duplicateAllay() { - Allay allay = EntityType.ALLAY.create(this.level()); + Allay allay = EntityType.ALLAY.create(this.level(), EntitySpawnReason.BREEDING); if (allay != null) { allay.moveTo(this.position()); allay.setPersistenceRequired(); @@ -553,12 +556,12 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS } @Override - public VibrationSystem.Data getVibrationData() { + public Data getVibrationData() { return this.vibrationData; } @Override - public VibrationSystem.User getVibrationUser() { + public User getVibrationUser() { return this.vibrationUser; } @@ -582,7 +585,7 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS } @Override - public boolean handleGameEvent(ServerLevel level, Holder gameEvent, GameEvent.Context context, Vec3 pos) { + public boolean handleGameEvent(ServerLevel level, Holder gameEvent, Context context, Vec3 pos) { if (gameEvent.is(GameEvent.JUKEBOX_PLAY)) { Allay.this.setJukeboxPlaying(BlockPos.containing(pos), true); return true; @@ -595,7 +598,7 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS } } - class VibrationUser implements VibrationSystem.User { + class VibrationUser implements User { private static final int VIBRATION_EVENT_LISTENER_RANGE = 16; private final PositionSource positionSource = new EntityPositionSource(Allay.this, Allay.this.getEyeHeight()); @@ -610,7 +613,7 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS } @Override - public boolean canReceiveVibration(ServerLevel level, BlockPos pos, Holder gameEvent, GameEvent.Context context) { + public boolean canReceiveVibration(ServerLevel level, BlockPos pos, Holder gameEvent, Context context) { if (Allay.this.isNoAi()) { return false; } else { @@ -619,7 +622,7 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS return true; } else { GlobalPos globalPos = (GlobalPos)optional.get(); - return globalPos.dimension().equals(level.dimension()) && globalPos.pos().equals(pos); + return globalPos.isCloseEnough(level.dimension(), Allay.this.blockPosition(), 1024) && globalPos.pos().equals(pos); } } } diff --git a/net/minecraft/world/entity/animal/allay/AllayAi.java b/net/minecraft/world/entity/animal/allay/AllayAi.java index d7c087b4..b454f303 100644 --- a/net/minecraft/world/entity/animal/allay/AllayAi.java +++ b/net/minecraft/world/entity/animal/allay/AllayAi.java @@ -62,8 +62,8 @@ public class AllayAi { Activity.CORE, 0, ImmutableList.of( - new Swim(0.8F), - new AnimalPanic<>(2.5F), + new Swim<>(0.8F), + new AnimalPanic(2.5F), new LookAtTargetSink(45, 90), new MoveToTargetSink(), new CountDownCooldownTicks(MemoryModuleType.LIKED_NOTEBLOCK_COOLDOWN_TICKS), @@ -130,7 +130,7 @@ public class AllayAi { private static boolean shouldDepositItemsAtLikedNoteblock(LivingEntity entity, Brain brain, GlobalPos pos) { Optional optional = brain.getMemory(MemoryModuleType.LIKED_NOTEBLOCK_COOLDOWN_TICKS); Level level = entity.level(); - return level.dimension() == pos.dimension() && level.getBlockState(pos.pos()).is(Blocks.NOTE_BLOCK) && optional.isPresent(); + return pos.isCloseEnough(level.dimension(), entity.blockPosition(), 1024) && level.getBlockState(pos.pos()).is(Blocks.NOTE_BLOCK) && optional.isPresent(); } private static Optional getLikedPlayerPositionTracker(LivingEntity entity) { diff --git a/net/minecraft/world/entity/animal/armadillo/Armadillo.java b/net/minecraft/world/entity/animal/armadillo/Armadillo.java index d44e096c..e30ef362 100644 --- a/net/minecraft/world/entity/animal/armadillo/Armadillo.java +++ b/net/minecraft/world/entity/animal/armadillo/Armadillo.java @@ -22,18 +22,21 @@ import net.minecraft.util.ByIdMap; import net.minecraft.util.RandomSource; import net.minecraft.util.StringRepresentable; import net.minecraft.util.TimeUtil; +import net.minecraft.util.ByIdMap.OutOfBoundsStrategy; +import net.minecraft.util.profiling.Profiler; +import net.minecraft.util.profiling.ProfilerFiller; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.AgeableMob; import net.minecraft.world.entity.AnimationState; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.entity.Mob; -import net.minecraft.world.entity.MobSpawnType; import net.minecraft.world.entity.ai.Brain; -import net.minecraft.world.entity.ai.attributes.AttributeSupplier; +import net.minecraft.world.entity.ai.Brain.Provider; import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.entity.ai.attributes.AttributeSupplier.Builder; import net.minecraft.world.entity.ai.control.BodyRotationControl; import net.minecraft.world.entity.ai.memory.MemoryModuleType; import net.minecraft.world.entity.animal.Animal; @@ -44,6 +47,7 @@ import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.level.storage.loot.BuiltInLootTables; import org.jetbrains.annotations.Nullable; public class Armadillo extends Animal { @@ -71,15 +75,15 @@ public class Armadillo extends Animal { @Nullable @Override public AgeableMob getBreedOffspring(ServerLevel level, AgeableMob otherParent) { - return EntityType.ARMADILLO.create(level); + return EntityType.ARMADILLO.create(level, EntitySpawnReason.BREEDING); } - public static AttributeSupplier.Builder createAttributes() { - return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 12.0).add(Attributes.MOVEMENT_SPEED, 0.14); + public static Builder createAttributes() { + return Animal.createAnimalAttributes().add(Attributes.MAX_HEALTH, 12.0).add(Attributes.MOVEMENT_SPEED, 0.14); } @Override - protected void defineSynchedData(SynchedEntityData.Builder builder) { + protected void defineSynchedData(net.minecraft.network.syncher.SynchedEntityData.Builder builder) { super.defineSynchedData(builder); builder.define(ARMADILLO_STATE, Armadillo.ArmadilloState.IDLE); } @@ -120,7 +124,7 @@ public class Armadillo extends Animal { } @Override - protected Brain.Provider brainProvider() { + protected Provider brainProvider() { return ArmadilloAi.brainProvider(); } @@ -130,21 +134,24 @@ public class Armadillo extends Animal { } @Override - protected void customServerAiStep() { - this.level().getProfiler().push("armadilloBrain"); - ((Brain)this.brain).tick((ServerLevel)this.level(), this); - this.level().getProfiler().pop(); - this.level().getProfiler().push("armadilloActivityUpdate"); + protected void customServerAiStep(ServerLevel serverLevel) { + ProfilerFiller profilerFiller = Profiler.get(); + profilerFiller.push("armadilloBrain"); + ((Brain)this.brain).tick(serverLevel, this); + profilerFiller.pop(); + profilerFiller.push("armadilloActivityUpdate"); ArmadilloAi.updateActivity(this); - this.level().getProfiler().pop(); + profilerFiller.pop(); if (this.isAlive() && !this.isBaby() && --this.scuteTime <= 0) { - this.playSound(SoundEvents.ARMADILLO_SCUTE_DROP, 1.0F, (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F); - this.spawnAtLocation(Items.ARMADILLO_SCUTE); - this.gameEvent(GameEvent.ENTITY_PLACE); + if (this.dropFromGiftLootTable(serverLevel, BuiltInLootTables.ARMADILLO_SHED, this::spawnAtLocation)) { + this.playSound(SoundEvents.ARMADILLO_SCUTE_DROP, 1.0F, (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F); + this.gameEvent(GameEvent.ENTITY_PLACE); + } + this.scuteTime = this.pickNextScuteDropTime(); } - super.customServerAiStep(); + super.customServerAiStep(serverLevel); } private int pickNextScuteDropTime() { @@ -220,9 +227,9 @@ public class Armadillo extends Animal { } public static boolean checkArmadilloSpawnRules( - EntityType entityType, LevelAccessor level, MobSpawnType spawnType, BlockPos pos, RandomSource random + EntityType entityType, LevelAccessor levelAccessor, EntitySpawnReason entitySpawnReason, BlockPos blockPos, RandomSource randomSource ) { - return level.getBlockState(pos.below()).is(BlockTags.ARMADILLO_SPAWNABLE_ON) && isBrightEnoughToSpawn(level, pos); + return levelAccessor.getBlockState(blockPos.below()).is(BlockTags.ARMADILLO_SPAWNABLE_ON) && isBrightEnoughToSpawn(levelAccessor, blockPos); } public boolean isScaredBy(LivingEntity entity) { @@ -274,17 +281,17 @@ public class Armadillo extends Animal { } @Override - public boolean hurt(DamageSource source, float amount) { + public boolean hurtServer(ServerLevel serverLevel, DamageSource damageSource, float f) { if (this.isScared()) { - amount = (amount - 1.0F) / 2.0F; + f = (f - 1.0F) / 2.0F; } - return super.hurt(source, amount); + return super.hurtServer(serverLevel, damageSource, f); } @Override - protected void actuallyHurt(DamageSource damageSource, float damageAmount) { - super.actuallyHurt(damageSource, damageAmount); + protected void actuallyHurt(ServerLevel serverLevel, DamageSource damageSource, float f) { + super.actuallyHurt(serverLevel, damageSource, f); if (!this.isNoAi() && !this.isDeadOrDying()) { if (damageSource.getEntity() instanceof LivingEntity) { this.getBrain().setMemoryWithExpiry(MemoryModuleType.DANGER_DETECTED_RECENTLY, true, 80L); @@ -302,28 +309,22 @@ public class Armadillo extends Animal { ItemStack itemStack = player.getItemInHand(hand); if (itemStack.is(Items.BRUSH) && this.brushOffScute()) { itemStack.hurtAndBreak(16, player, getSlotForHand(hand)); - return InteractionResult.sidedSuccess(this.level().isClientSide); + return InteractionResult.SUCCESS; } else { - return this.isScared() ? InteractionResult.FAIL : super.mobInteract(player, hand); + return (InteractionResult)(this.isScared() ? InteractionResult.FAIL : super.mobInteract(player, hand)); } } - @Override - public void ageUp(int amount, boolean forced) { - if (this.isBaby() && forced) { - this.makeSound(SoundEvents.ARMADILLO_EAT); - } - - super.ageUp(amount, forced); - } - public boolean brushOffScute() { if (this.isBaby()) { return false; } else { - this.spawnAtLocation(new ItemStack(Items.ARMADILLO_SCUTE)); - this.gameEvent(GameEvent.ENTITY_INTERACT); - this.playSound(SoundEvents.ARMADILLO_BRUSH); + if (this.level() instanceof ServerLevel serverLevel) { + this.spawnAtLocation(serverLevel, new ItemStack(Items.ARMADILLO_SCUTE)); + this.gameEvent(GameEvent.ENTITY_INTERACT); + this.playSound(SoundEvents.ARMADILLO_BRUSH); + } + return true; } } @@ -332,25 +333,19 @@ public class Armadillo extends Animal { return !this.isPanicking() && !this.isInLiquid() && !this.isLeashed() && !this.isPassenger() && !this.isVehicle(); } - @Override - public void setInLove(@Nullable Player player) { - super.setInLove(player); - this.makeSound(SoundEvents.ARMADILLO_EAT); - } - @Override public boolean canFallInLove() { return super.canFallInLove() && !this.isScared(); } @Override - public SoundEvent getEatingSound(ItemStack stack) { - return SoundEvents.ARMADILLO_EAT; + protected SoundEvent getAmbientSound() { + return this.isScared() ? null : SoundEvents.ARMADILLO_AMBIENT; } @Override - protected SoundEvent getAmbientSound() { - return this.isScared() ? null : SoundEvents.ARMADILLO_AMBIENT; + protected void playEatingSound() { + this.makeSound(SoundEvents.ARMADILLO_EAT); } @Override @@ -386,35 +381,13 @@ public class Armadillo extends Animal { } public static enum ArmadilloState implements StringRepresentable { - IDLE("idle", false, 0, 0) { - @Override - public boolean shouldHideInShell(long inStateTicks) { - return false; - } - }, - ROLLING("rolling", true, 10, 1) { - @Override - public boolean shouldHideInShell(long inStateTicks) { - return inStateTicks > 5L; - } - }, - SCARED("scared", true, 50, 2) { - @Override - public boolean shouldHideInShell(long inStateTicks) { - return true; - } - }, - UNROLLING("unrolling", true, 30, 3) { - @Override - public boolean shouldHideInShell(long inStateTicks) { - return inStateTicks < 26L; - } - }; + IDLE("IDLE", 0, "idle", false, 0, 0), + ROLLING("ROLLING", 1, "rolling", true, 10, 1), + SCARED("SCARED", 2, "scared", true, 50, 2), + UNROLLING("UNROLLING", 3, "unrolling", true, 30, 3); private static final StringRepresentable.EnumCodec CODEC = StringRepresentable.fromEnum(Armadillo.ArmadilloState::values); - private static final IntFunction BY_ID = ByIdMap.continuous( - Armadillo.ArmadilloState::id, values(), ByIdMap.OutOfBoundsStrategy.ZERO - ); + private static final IntFunction BY_ID = ByIdMap.continuous(Armadillo.ArmadilloState::id, values(), OutOfBoundsStrategy.ZERO); public static final StreamCodec STREAM_CODEC = ByteBufCodecs.idMapper(BY_ID, Armadillo.ArmadilloState::id); private final String name; private final boolean isThreatened; diff --git a/net/minecraft/world/entity/animal/axolotl/Axolotl.java b/net/minecraft/world/entity/animal/axolotl/Axolotl.java index 96f593b9..c5c5c272 100644 --- a/net/minecraft/world/entity/animal/axolotl/Axolotl.java +++ b/net/minecraft/world/entity/animal/axolotl/Axolotl.java @@ -1,12 +1,10 @@ package net.minecraft.world.entity.animal.axolotl; import com.google.common.collect.ImmutableList; -import com.google.common.collect.Maps; import com.mojang.serialization.Codec; import com.mojang.serialization.Dynamic; import java.util.Arrays; import java.util.List; -import java.util.Map; import java.util.Optional; import java.util.function.IntFunction; import net.minecraft.Util; @@ -17,14 +15,20 @@ import net.minecraft.network.protocol.game.DebugPackets; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.network.syncher.SynchedEntityData.Builder; import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; import net.minecraft.tags.BlockTags; import net.minecraft.tags.ItemTags; +import net.minecraft.util.BinaryAnimator; import net.minecraft.util.ByIdMap; +import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; import net.minecraft.util.StringRepresentable; +import net.minecraft.util.ByIdMap.OutOfBoundsStrategy; +import net.minecraft.util.profiling.Profiler; +import net.minecraft.util.profiling.ProfilerFiller; import net.minecraft.world.DifficultyInstance; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; @@ -33,16 +37,14 @@ import net.minecraft.world.effect.MobEffectInstance; import net.minecraft.world.effect.MobEffects; import net.minecraft.world.entity.AgeableMob; import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; -import net.minecraft.world.entity.LerpingModel; import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.entity.Mob; -import net.minecraft.world.entity.MobSpawnType; import net.minecraft.world.entity.MoverType; import net.minecraft.world.entity.SpawnGroupData; import net.minecraft.world.entity.VariantHolder; import net.minecraft.world.entity.ai.Brain; -import net.minecraft.world.entity.ai.attributes.AttributeSupplier; +import net.minecraft.world.entity.ai.Brain.Provider; import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.entity.ai.control.SmoothSwimmingLookControl; import net.minecraft.world.entity.ai.control.SmoothSwimmingMoveControl; @@ -64,10 +66,10 @@ import net.minecraft.world.level.ServerLevelAccessor; import net.minecraft.world.level.pathfinder.PathType; import net.minecraft.world.phys.Vec3; import org.jetbrains.annotations.Nullable; -import org.joml.Vector3f; -public class Axolotl extends Animal implements LerpingModel, VariantHolder, Bucketable { +public class Axolotl extends Animal implements VariantHolder, Bucketable { public static final int TOTAL_PLAYDEAD_TIME = 200; + private static final int POSE_ANIMATION_TICKS = 10; protected static final ImmutableList>> SENSOR_TYPES = ImmutableList.of( SensorType.NEAREST_LIVING_ENTITIES, SensorType.NEAREST_ADULT, SensorType.HURT_BY, SensorType.AXOLOTL_ATTACKABLES, SensorType.AXOLOTL_TEMPTATIONS ); @@ -102,7 +104,10 @@ public class Axolotl extends Animal implements LerpingModel, VariantHolder modelRotationValues = Maps.newHashMap(); + public final BinaryAnimator playingDeadAnimator = new BinaryAnimator(10, Mth::easeInOutSine); + public final BinaryAnimator inWaterAnimator = new BinaryAnimator(10, Mth::easeInOutSine); + public final BinaryAnimator onGroundAnimator = new BinaryAnimator(10, Mth::easeInOutSine); + public final BinaryAnimator movingAnimator = new BinaryAnimator(10, Mth::easeInOutSine); private static final int REGEN_BUFF_BASE_DURATION = 100; public Axolotl(EntityType entityType, Level level) { @@ -112,18 +117,13 @@ public class Axolotl extends Animal implements LerpingModel, VariantHolder getModelRotationValues() { - return this.modelRotationValues; - } - @Override public float getWalkTargetValue(BlockPos pos, LevelReader level) { return 0.0F; } @Override - protected void defineSynchedData(SynchedEntityData.Builder builder) { + protected void defineSynchedData(Builder builder) { super.defineSynchedData(builder); builder.define(DATA_VARIANT, 0); builder.define(DATA_PLAYING_DEAD, false); @@ -152,12 +152,14 @@ public class Axolotl extends Animal implements LerpingModel, VariantHolder= 2) { bl = true; @@ -171,7 +173,7 @@ public class Axolotl extends Animal implements LerpingModel, VariantHolder optional = this.getBrain().getMemory(MemoryModuleType.PLAY_DEAD_TICKS); this.setPlayingDead(optional.isPresent() && (Integer)optional.get() > 0); } } - public static AttributeSupplier.Builder createAttributes() { - return Mob.createMobAttributes() + public static net.minecraft.world.entity.ai.attributes.AttributeSupplier.Builder createAttributes() { + return Animal.createAnimalAttributes() .add(Attributes.MAX_HEALTH, 14.0) .add(Attributes.MOVEMENT_SPEED, 1.0) .add(Attributes.ATTACK_DAMAGE, 2.0) @@ -308,20 +334,19 @@ public class Axolotl extends Animal implements LerpingModel, VariantHolder list = level.getEntitiesOfClass(Player.class, axolotl.getBoundingBox().inflate(20.0)); + List list = serverLevel.getEntitiesOfClass(Player.class, axolotl.getBoundingBox().inflate(20.0)); if (list.contains(player)) { axolotl.applySupportingEffects(player); } @@ -441,7 +465,7 @@ public class Axolotl extends Animal implements LerpingModel, VariantHolder brainProvider() { + protected Provider brainProvider() { return Brain.provider(MEMORY_TYPES, SENSOR_TYPES); } @@ -493,9 +517,20 @@ public class Axolotl extends Animal implements LerpingModel, VariantHolder axolotl, ServerLevelAccessor level, MobSpawnType spawnType, BlockPos pos, RandomSource random + EntityType entityType, + ServerLevelAccessor serverLevelAccessor, + EntitySpawnReason entitySpawnReason, + BlockPos blockPos, + RandomSource randomSource ) { - return level.getBlockState(pos.below()).is(BlockTags.AXOLOTLS_SPAWNABLE_ON); + return serverLevelAccessor.getBlockState(blockPos.below()).is(BlockTags.AXOLOTLS_SPAWNABLE_ON); + } + + public static enum AnimationState { + PLAYING_DEAD, + IN_WATER, + ON_GROUND, + IN_AIR; } public static class AxolotlGroupData extends AgeableMob.AgeableMobGroupData { @@ -547,7 +582,7 @@ public class Axolotl extends Animal implements LerpingModel, VariantHolder BY_ID = ByIdMap.continuous(Axolotl.Variant::getId, values(), ByIdMap.OutOfBoundsStrategy.ZERO); + private static final IntFunction BY_ID = ByIdMap.continuous(Axolotl.Variant::getId, values(), OutOfBoundsStrategy.ZERO); public static final Codec CODEC = StringRepresentable.fromEnum(Axolotl.Variant::values); private final int id; private final String name; diff --git a/net/minecraft/world/entity/animal/axolotl/AxolotlAi.java b/net/minecraft/world/entity/animal/axolotl/AxolotlAi.java index 27225ffb..6dd5454f 100644 --- a/net/minecraft/world/entity/animal/axolotl/AxolotlAi.java +++ b/net/minecraft/world/entity/animal/axolotl/AxolotlAi.java @@ -7,12 +7,12 @@ import com.mojang.datafixers.util.Pair; import java.util.Optional; import java.util.function.Predicate; import net.minecraft.core.BlockPos; +import net.minecraft.server.level.ServerLevel; import net.minecraft.tags.ItemTags; import net.minecraft.util.valueproviders.UniformInt; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.entity.Mob; import net.minecraft.world.entity.ai.Brain; import net.minecraft.world.entity.ai.behavior.AnimalMakeLove; import net.minecraft.world.entity.ai.behavior.BabyFollowAdult; @@ -33,6 +33,8 @@ import net.minecraft.world.entity.ai.behavior.SetWalkTargetFromLookTarget; import net.minecraft.world.entity.ai.behavior.StartAttacking; import net.minecraft.world.entity.ai.behavior.StopAttackingIfTargetInvalid; import net.minecraft.world.entity.ai.behavior.TryFindWater; +import net.minecraft.world.entity.ai.behavior.GateBehavior.OrderPolicy; +import net.minecraft.world.entity.ai.behavior.GateBehavior.RunningPolicy; import net.minecraft.world.entity.ai.behavior.declarative.BehaviorBuilder; import net.minecraft.world.entity.ai.memory.MemoryModuleType; import net.minecraft.world.entity.ai.memory.MemoryStatus; @@ -73,10 +75,10 @@ public class AxolotlAi { Activity.FIGHT, 0, ImmutableList.of( - StopAttackingIfTargetInvalid.create(Axolotl::onStopAttacking), + StopAttackingIfTargetInvalid.create(Axolotl::onStopAttacking), SetWalkTargetFromAttackTargetIfTargetOutOfReach.create(AxolotlAi::getSpeedModifierChasing), MeleeAttack.create(20), - EraseMemoryIf.create(BehaviorUtils::isBreeding, MemoryModuleType.ATTACK_TARGET) + EraseMemoryIf.create(BehaviorUtils::isBreeding, MemoryModuleType.ATTACK_TARGET) ), MemoryModuleType.ATTACK_TARGET ); @@ -114,8 +116,8 @@ public class AxolotlAi { new GateBehavior<>( ImmutableMap.of(MemoryModuleType.WALK_TARGET, MemoryStatus.VALUE_ABSENT), ImmutableSet.of(), - GateBehavior.OrderPolicy.ORDERED, - GateBehavior.RunningPolicy.TRY_ALL, + OrderPolicy.ORDERED, + RunningPolicy.TRY_ALL, ImmutableList.of( Pair.of(RandomStroll.swim(0.5F), 2), Pair.of(RandomStroll.stroll(0.15F, false), 2), @@ -163,7 +165,7 @@ public class AxolotlAi { return entity.isInWaterOrBubble() ? 0.5F : 0.15F; } - private static Optional findNearestValidAttackTarget(Axolotl axolotl) { + private static Optional findNearestValidAttackTarget(ServerLevel serverLevel, Axolotl axolotl) { return BehaviorUtils.isBreeding(axolotl) ? Optional.empty() : axolotl.getBrain().getMemory(MemoryModuleType.NEAREST_ATTACKABLE); } diff --git a/net/minecraft/world/entity/animal/camel/Camel.java b/net/minecraft/world/entity/animal/camel/Camel.java index fe520aa3..72209ccc 100644 --- a/net/minecraft/world/entity/animal/camel/Camel.java +++ b/net/minecraft/world/entity/animal/camel/Camel.java @@ -16,6 +16,8 @@ import net.minecraft.sounds.SoundSource; import net.minecraft.tags.BlockTags; import net.minecraft.tags.ItemTags; import net.minecraft.util.Mth; +import net.minecraft.util.profiling.Profiler; +import net.minecraft.util.profiling.ProfilerFiller; import net.minecraft.world.DifficultyInstance; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; @@ -24,16 +26,15 @@ import net.minecraft.world.entity.AgeableMob; import net.minecraft.world.entity.AnimationState; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityDimensions; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.entity.MobSpawnType; -import net.minecraft.world.entity.PlayerRideableJumping; import net.minecraft.world.entity.Pose; -import net.minecraft.world.entity.Saddleable; import net.minecraft.world.entity.SpawnGroupData; import net.minecraft.world.entity.ai.Brain; -import net.minecraft.world.entity.ai.attributes.AttributeSupplier; +import net.minecraft.world.entity.ai.Brain.Provider; import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.entity.ai.attributes.AttributeSupplier.Builder; import net.minecraft.world.entity.ai.control.BodyRotationControl; import net.minecraft.world.entity.ai.control.LookControl; import net.minecraft.world.entity.ai.control.MoveControl; @@ -50,7 +51,7 @@ import net.minecraft.world.phys.Vec2; import net.minecraft.world.phys.Vec3; import org.jetbrains.annotations.Nullable; -public class Camel extends AbstractHorse implements PlayerRideableJumping, Saddleable { +public class Camel extends AbstractHorse { public static final float BABY_SCALE = 0.45F; public static final int DASH_COOLDOWN_TICKS = 55; public static final int MAX_HEAD_Y_ROT = 30; @@ -100,7 +101,7 @@ public class Camel extends AbstractHorse implements PlayerRideableJumping, Saddl this.resetLastPoseChangeTick(l); } - public static AttributeSupplier.Builder createAttributes() { + public static Builder createAttributes() { return createBaseHorseAttributes() .add(Attributes.MAX_HEALTH, 32.0) .add(Attributes.MOVEMENT_SPEED, 0.09F) @@ -109,21 +110,23 @@ public class Camel extends AbstractHorse implements PlayerRideableJumping, Saddl } @Override - protected void defineSynchedData(SynchedEntityData.Builder builder) { + protected void defineSynchedData(net.minecraft.network.syncher.SynchedEntityData.Builder builder) { super.defineSynchedData(builder); builder.define(DASH, false); builder.define(LAST_POSE_CHANGE_TICK, 0L); } @Override - public SpawnGroupData finalizeSpawn(ServerLevelAccessor level, DifficultyInstance difficulty, MobSpawnType spawnType, @Nullable SpawnGroupData spawnGroupData) { - CamelAi.initMemories(this, level.getRandom()); - this.resetLastPoseChangeTickToFullStand(level.getLevel().getGameTime()); - return super.finalizeSpawn(level, difficulty, spawnType, spawnGroupData); + public SpawnGroupData finalizeSpawn( + ServerLevelAccessor serverLevelAccessor, DifficultyInstance difficultyInstance, EntitySpawnReason entitySpawnReason, @Nullable SpawnGroupData spawnGroupData + ) { + CamelAi.initMemories(this, serverLevelAccessor.getRandom()); + this.resetLastPoseChangeTickToFullStand(serverLevelAccessor.getLevel().getGameTime()); + return super.finalizeSpawn(serverLevelAccessor, difficultyInstance, entitySpawnReason, spawnGroupData); } @Override - protected Brain.Provider brainProvider() { + protected Provider brainProvider() { return CamelAi.brainProvider(); } @@ -142,15 +145,16 @@ public class Camel extends AbstractHorse implements PlayerRideableJumping, Saddl } @Override - protected void customServerAiStep() { - this.level().getProfiler().push("camelBrain"); + protected void customServerAiStep(ServerLevel serverLevel) { + ProfilerFiller profilerFiller = Profiler.get(); + profilerFiller.push("camelBrain"); Brain brain = this.getBrain(); - ((Brain)brain).tick((ServerLevel)this.level(), this); - this.level().getProfiler().pop(); - this.level().getProfiler().push("camelActivityUpdate"); + ((Brain)brain).tick(serverLevel, this); + profilerFiller.pop(); + profilerFiller.push("camelActivityUpdate"); CamelAi.updateActivity(this); - this.level().getProfiler().pop(); - super.customServerAiStep(); + profilerFiller.pop(); + super.customServerAiStep(serverLevel); } @Override @@ -215,7 +219,7 @@ public class Camel extends AbstractHorse implements PlayerRideableJumping, Saddl f = 0.0F; } - this.walkAnimation.update(f, 0.2F); + this.walkAnimation.update(f, 0.2F, this.isBaby() ? 3.0F : 1.0F); } @Override @@ -346,7 +350,7 @@ public class Camel extends AbstractHorse implements PlayerRideableJumping, Saddl ItemStack itemStack = player.getItemInHand(hand); if (player.isSecondaryUseActive() && !this.isBaby()) { this.openCustomInventoryScreen(player); - return InteractionResult.sidedSuccess(this.level().isClientSide); + return InteractionResult.SUCCESS; } else { InteractionResult interactionResult = itemStack.interactLivingEntity(player, this, hand); if (interactionResult.consumesAction()) { @@ -358,7 +362,7 @@ public class Camel extends AbstractHorse implements PlayerRideableJumping, Saddl this.doPlayerRide(player); } - return InteractionResult.sidedSuccess(this.level().isClientSide); + return InteractionResult.SUCCESS; } } } @@ -430,7 +434,7 @@ public class Camel extends AbstractHorse implements PlayerRideableJumping, Saddl @Nullable public Camel getBreedOffspring(ServerLevel level, AgeableMob otherParent) { - return EntityType.CAMEL.create(level); + return EntityType.CAMEL.create(level, EntitySpawnReason.BREEDING); } @Nullable @@ -440,9 +444,9 @@ public class Camel extends AbstractHorse implements PlayerRideableJumping, Saddl } @Override - protected void actuallyHurt(DamageSource damageSource, float damageAmount) { + protected void actuallyHurt(ServerLevel serverLevel, DamageSource damageSource, float f) { this.standUpInstantly(); - super.actuallyHurt(damageSource, damageAmount); + super.actuallyHurt(serverLevel, damageSource, f); } @Override diff --git a/net/minecraft/world/entity/animal/frog/Frog.java b/net/minecraft/world/entity/animal/frog/Frog.java index 6a2fd002..9e2dde66 100644 --- a/net/minecraft/world/entity/animal/frog/Frog.java +++ b/net/minecraft/world/entity/animal/frog/Frog.java @@ -14,11 +14,13 @@ import net.minecraft.network.protocol.game.DebugPackets; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.network.syncher.SynchedEntityData.Builder; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; +import net.minecraft.sounds.SoundSource; import net.minecraft.tags.BiomeTags; import net.minecraft.tags.BlockTags; import net.minecraft.tags.EntityTypeTags; @@ -26,21 +28,23 @@ import net.minecraft.tags.ItemTags; import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; import net.minecraft.util.Unit; +import net.minecraft.util.profiling.Profiler; +import net.minecraft.util.profiling.ProfilerFiller; import net.minecraft.world.DifficultyInstance; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.AgeableMob; import net.minecraft.world.entity.AnimationState; import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.Mob; -import net.minecraft.world.entity.MobSpawnType; import net.minecraft.world.entity.MoverType; import net.minecraft.world.entity.Pose; import net.minecraft.world.entity.SpawnGroupData; import net.minecraft.world.entity.VariantHolder; import net.minecraft.world.entity.ai.Brain; -import net.minecraft.world.entity.ai.attributes.AttributeSupplier; +import net.minecraft.world.entity.ai.Brain.Provider; import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.entity.ai.control.LookControl; import net.minecraft.world.entity.ai.control.SmoothSwimmingMoveControl; @@ -113,7 +117,7 @@ public class Frog extends Animal implements VariantHolder> { } @Override - protected Brain.Provider brainProvider() { + protected Provider brainProvider() { return Brain.provider(MEMORY_TYPES, SENSOR_TYPES); } @@ -128,9 +132,9 @@ public class Frog extends Animal implements VariantHolder> { } @Override - protected void defineSynchedData(SynchedEntityData.Builder builder) { + protected void defineSynchedData(Builder builder) { super.defineSynchedData(builder); - builder.define(DATA_VARIANT_ID, BuiltInRegistries.FROG_VARIANT.getHolderOrThrow(DEFAULT_VARIANT)); + builder.define(DATA_VARIANT_ID, BuiltInRegistries.FROG_VARIANT.getOrThrow(DEFAULT_VARIANT)); builder.define(DATA_TONGUE_TARGET_ID, OptionalInt.empty()); } @@ -175,19 +179,20 @@ public class Frog extends Animal implements VariantHolder> { super.readAdditionalSaveData(compound); Optional.ofNullable(ResourceLocation.tryParse(compound.getString("variant"))) .map(resourceLocation -> ResourceKey.create(Registries.FROG_VARIANT, resourceLocation)) - .flatMap(BuiltInRegistries.FROG_VARIANT::getHolder) + .flatMap(BuiltInRegistries.FROG_VARIANT::get) .ifPresent(this::setVariant); } @Override - protected void customServerAiStep() { - this.level().getProfiler().push("frogBrain"); - this.getBrain().tick((ServerLevel)this.level(), this); - this.level().getProfiler().pop(); - this.level().getProfiler().push("frogActivityUpdate"); + protected void customServerAiStep(ServerLevel serverLevel) { + ProfilerFiller profilerFiller = Profiler.get(); + profilerFiller.push("frogBrain"); + this.getBrain().tick(serverLevel, this); + profilerFiller.pop(); + profilerFiller.push("frogActivityUpdate"); FrogAi.updateActivity(this); - this.level().getProfiler().pop(); - super.customServerAiStep(); + profilerFiller.pop(); + super.customServerAiStep(serverLevel); } @Override @@ -234,13 +239,18 @@ public class Frog extends Animal implements VariantHolder> { f = Math.min(partialTick * 25.0F, 1.0F); } - this.walkAnimation.update(f, 0.4F); + this.walkAnimation.update(f, 0.4F, this.isBaby() ? 3.0F : 1.0F); + } + + @Override + public void playEatingSound() { + this.level().playSound(null, this, SoundEvents.FROG_EAT, SoundSource.NEUTRAL, 2.0F, 1.0F); } @Nullable @Override public AgeableMob getBreedOffspring(ServerLevel level, AgeableMob otherParent) { - Frog frog = EntityType.FROG.create(level); + Frog frog = EntityType.FROG.create(level, EntitySpawnReason.BREEDING); if (frog != null) { FrogAi.initMemories(frog, level.getRandom()); } @@ -264,22 +274,24 @@ public class Frog extends Animal implements VariantHolder> { } @Override - public SpawnGroupData finalizeSpawn(ServerLevelAccessor level, DifficultyInstance difficulty, MobSpawnType spawnType, @Nullable SpawnGroupData spawnGroupData) { - Holder holder = level.getBiome(this.blockPosition()); + public SpawnGroupData finalizeSpawn( + ServerLevelAccessor serverLevelAccessor, DifficultyInstance difficultyInstance, EntitySpawnReason entitySpawnReason, @Nullable SpawnGroupData spawnGroupData + ) { + Holder holder = serverLevelAccessor.getBiome(this.blockPosition()); if (holder.is(BiomeTags.SPAWNS_COLD_VARIANT_FROGS)) { - this.setVariant(BuiltInRegistries.FROG_VARIANT.getHolderOrThrow(FrogVariant.COLD)); + this.setVariant(BuiltInRegistries.FROG_VARIANT.getOrThrow(FrogVariant.COLD)); } else if (holder.is(BiomeTags.SPAWNS_WARM_VARIANT_FROGS)) { - this.setVariant(BuiltInRegistries.FROG_VARIANT.getHolderOrThrow(FrogVariant.WARM)); + this.setVariant(BuiltInRegistries.FROG_VARIANT.getOrThrow(FrogVariant.WARM)); } else { - this.setVariant(BuiltInRegistries.FROG_VARIANT.getHolderOrThrow(DEFAULT_VARIANT)); + this.setVariant(BuiltInRegistries.FROG_VARIANT.getOrThrow(DEFAULT_VARIANT)); } - FrogAi.initMemories(this, level.getRandom()); - return super.finalizeSpawn(level, difficulty, spawnType, spawnGroupData); + FrogAi.initMemories(this, serverLevelAccessor.getRandom()); + return super.finalizeSpawn(serverLevelAccessor, difficultyInstance, entitySpawnReason, spawnGroupData); } - public static AttributeSupplier.Builder createAttributes() { - return Mob.createMobAttributes() + public static net.minecraft.world.entity.ai.attributes.AttributeSupplier.Builder createAttributes() { + return Animal.createAnimalAttributes() .add(Attributes.MOVEMENT_SPEED, 1.0) .add(Attributes.MAX_HEALTH, 10.0) .add(Attributes.ATTACK_DAMAGE, 10.0) @@ -356,8 +368,10 @@ public class Frog extends Animal implements VariantHolder> { return stack.is(ItemTags.FROG_FOOD); } - public static boolean checkFrogSpawnRules(EntityType animal, LevelAccessor level, MobSpawnType spawnType, BlockPos pos, RandomSource random) { - return level.getBlockState(pos.below()).is(BlockTags.FROGS_SPAWNABLE_ON) && isBrightEnoughToSpawn(level, pos); + public static boolean checkFrogSpawnRules( + EntityType entityType, LevelAccessor levelAccessor, EntitySpawnReason entitySpawnReason, BlockPos blockPos, RandomSource randomSource + ) { + return levelAccessor.getBlockState(blockPos.below()).is(BlockTags.FROGS_SPAWNABLE_ON) && isBrightEnoughToSpawn(levelAccessor, blockPos); } class FrogLookControl extends LookControl { diff --git a/net/minecraft/world/entity/animal/frog/FrogAi.java b/net/minecraft/world/entity/animal/frog/FrogAi.java index 07432787..3f53b0ea 100644 --- a/net/minecraft/world/entity/animal/frog/FrogAi.java +++ b/net/minecraft/world/entity/animal/frog/FrogAi.java @@ -36,6 +36,8 @@ import net.minecraft.world.entity.ai.behavior.StopAttackingIfTargetInvalid; import net.minecraft.world.entity.ai.behavior.TryFindLand; import net.minecraft.world.entity.ai.behavior.TryFindLandNearWater; import net.minecraft.world.entity.ai.behavior.TryLaySpawnOnWaterNearLand; +import net.minecraft.world.entity.ai.behavior.GateBehavior.OrderPolicy; +import net.minecraft.world.entity.ai.behavior.GateBehavior.RunningPolicy; import net.minecraft.world.entity.ai.behavior.declarative.BehaviorBuilder; import net.minecraft.world.entity.ai.memory.MemoryModuleType; import net.minecraft.world.entity.ai.memory.MemoryStatus; @@ -97,7 +99,9 @@ public class FrogAi { Pair.of(0, SetEntityLookTargetSometimes.create(EntityType.PLAYER, 6.0F, UniformInt.of(30, 60))), Pair.of(0, new AnimalMakeLove(EntityType.FROG)), Pair.of(1, new FollowTemptation(livingEntity -> 1.25F)), - Pair.of(2, StartAttacking.create(FrogAi::canAttack, frog -> frog.getBrain().getMemory(MemoryModuleType.NEAREST_ATTACKABLE))), + Pair.of( + 2, StartAttacking.create((serverLevel, frog) -> canAttack(frog), (serverLevel, frog) -> frog.getBrain().getMemory(MemoryModuleType.NEAREST_ATTACKABLE)) + ), Pair.of(3, TryFindLand.create(6, 1.0F)), Pair.of( 4, @@ -122,15 +126,17 @@ public class FrogAi { ImmutableList.of( Pair.of(0, SetEntityLookTargetSometimes.create(EntityType.PLAYER, 6.0F, UniformInt.of(30, 60))), Pair.of(1, new FollowTemptation(livingEntity -> 1.25F)), - Pair.of(2, StartAttacking.create(FrogAi::canAttack, frog -> frog.getBrain().getMemory(MemoryModuleType.NEAREST_ATTACKABLE))), + Pair.of( + 2, StartAttacking.create((serverLevel, frog) -> canAttack(frog), (serverLevel, frog) -> frog.getBrain().getMemory(MemoryModuleType.NEAREST_ATTACKABLE)) + ), Pair.of(3, TryFindLand.create(8, 1.5F)), Pair.of( 5, new GateBehavior<>( ImmutableMap.of(MemoryModuleType.WALK_TARGET, MemoryStatus.VALUE_ABSENT), ImmutableSet.of(), - GateBehavior.OrderPolicy.ORDERED, - GateBehavior.RunningPolicy.TRY_ALL, + OrderPolicy.ORDERED, + RunningPolicy.TRY_ALL, ImmutableList.of( Pair.of(RandomStroll.swim(0.75F), 1), Pair.of(RandomStroll.stroll(1.0F, true), 1), @@ -149,7 +155,9 @@ public class FrogAi { Activity.LAY_SPAWN, ImmutableList.of( Pair.of(0, SetEntityLookTargetSometimes.create(EntityType.PLAYER, 6.0F, UniformInt.of(30, 60))), - Pair.of(1, StartAttacking.create(FrogAi::canAttack, frog -> frog.getBrain().getMemory(MemoryModuleType.NEAREST_ATTACKABLE))), + Pair.of( + 1, StartAttacking.create((serverLevel, frog) -> canAttack(frog), (serverLevel, frog) -> frog.getBrain().getMemory(MemoryModuleType.NEAREST_ATTACKABLE)) + ), Pair.of(2, TryFindLandNearWater.create(8, 1.0F)), Pair.of(3, TryLaySpawnOnWaterNearLand.create(Blocks.FROGSPAWN)), Pair.of( diff --git a/net/minecraft/world/entity/animal/frog/ShootTongue.java b/net/minecraft/world/entity/animal/frog/ShootTongue.java index 0c8a255f..a50c09c8 100644 --- a/net/minecraft/world/entity/animal/frog/ShootTongue.java +++ b/net/minecraft/world/entity/animal/frog/ShootTongue.java @@ -90,7 +90,7 @@ public class ShootTongue extends Behavior { if (optional.isPresent()) { Entity entity = (Entity)optional.get(); if (entity.isAlive()) { - frog.doHurtTarget(entity); + frog.doHurtTarget(level, entity); if (!entity.isAlive()) { entity.remove(Entity.RemovalReason.KILLED); } diff --git a/net/minecraft/world/entity/animal/frog/Tadpole.java b/net/minecraft/world/entity/animal/frog/Tadpole.java index d3952647..9b844be9 100644 --- a/net/minecraft/world/entity/animal/frog/Tadpole.java +++ b/net/minecraft/world/entity/animal/frog/Tadpole.java @@ -11,16 +11,19 @@ import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; import net.minecraft.tags.ItemTags; +import net.minecraft.util.profiling.Profiler; +import net.minecraft.util.profiling.ProfilerFiller; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.AgeableMob; +import net.minecraft.world.entity.ConversionParams; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; -import net.minecraft.world.entity.Mob; -import net.minecraft.world.entity.MobSpawnType; import net.minecraft.world.entity.ai.Brain; -import net.minecraft.world.entity.ai.attributes.AttributeSupplier; +import net.minecraft.world.entity.ai.Brain.Provider; import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.entity.ai.attributes.AttributeSupplier.Builder; import net.minecraft.world.entity.ai.control.SmoothSwimmingLookControl; import net.minecraft.world.entity.ai.control.SmoothSwimmingMoveControl; import net.minecraft.world.entity.ai.memory.MemoryModuleType; @@ -29,6 +32,7 @@ import net.minecraft.world.entity.ai.navigation.WaterBoundPathNavigation; import net.minecraft.world.entity.ai.sensing.Sensor; import net.minecraft.world.entity.ai.sensing.SensorType; import net.minecraft.world.entity.animal.AbstractFish; +import net.minecraft.world.entity.animal.Animal; import net.minecraft.world.entity.animal.Bucketable; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; @@ -72,7 +76,7 @@ public class Tadpole extends AbstractFish { } @Override - protected Brain.Provider brainProvider() { + protected Provider brainProvider() { return Brain.provider(MEMORY_TYPES, SENSOR_TYPES); } @@ -92,18 +96,19 @@ public class Tadpole extends AbstractFish { } @Override - protected void customServerAiStep() { - this.level().getProfiler().push("tadpoleBrain"); - this.getBrain().tick((ServerLevel)this.level(), this); - this.level().getProfiler().pop(); - this.level().getProfiler().push("tadpoleActivityUpdate"); + protected void customServerAiStep(ServerLevel serverLevel) { + ProfilerFiller profilerFiller = Profiler.get(); + profilerFiller.push("tadpoleBrain"); + this.getBrain().tick(serverLevel, this); + profilerFiller.pop(); + profilerFiller.push("tadpoleActivityUpdate"); TadpoleAi.updateActivity(this); - this.level().getProfiler().pop(); - super.customServerAiStep(); + profilerFiller.pop(); + super.customServerAiStep(serverLevel); } - public static AttributeSupplier.Builder createAttributes() { - return Mob.createMobAttributes().add(Attributes.MOVEMENT_SPEED, 1.0).add(Attributes.MAX_HEALTH, 6.0); + public static Builder createAttributes() { + return Animal.createAnimalAttributes().add(Attributes.MOVEMENT_SPEED, 1.0).add(Attributes.MAX_HEALTH, 6.0); } @Override @@ -149,7 +154,7 @@ public class Tadpole extends AbstractFish { ItemStack itemStack = player.getItemInHand(hand); if (this.isFood(itemStack)) { this.feed(player, itemStack); - return InteractionResult.sidedSuccess(this.level().isClientSide); + return InteractionResult.SUCCESS; } else { return (InteractionResult)Bucketable.bucketMobPickup(player, hand, this).orElse(super.mobInteract(player, hand)); } @@ -225,22 +230,12 @@ public class Tadpole extends AbstractFish { private void ageUp() { if (this.level() instanceof ServerLevel serverLevel) { - Frog frog = EntityType.FROG.create(this.level()); - if (frog != null) { - frog.moveTo(this.getX(), this.getY(), this.getZ(), this.getYRot(), this.getXRot()); - frog.finalizeSpawn(serverLevel, this.level().getCurrentDifficultyAt(frog.blockPosition()), MobSpawnType.CONVERSION, null); - frog.setNoAi(this.isNoAi()); - if (this.hasCustomName()) { - frog.setCustomName(this.getCustomName()); - frog.setCustomNameVisible(this.isCustomNameVisible()); - } - + this.convertTo(EntityType.FROG, ConversionParams.single(this, false, false), frog -> { + frog.finalizeSpawn(serverLevel, this.level().getCurrentDifficultyAt(frog.blockPosition()), EntitySpawnReason.CONVERSION, null); frog.setPersistenceRequired(); frog.fudgePositionAfterSizeChange(this.getDimensions(this.getPose())); this.playSound(SoundEvents.TADPOLE_GROW_UP, 0.15F, 1.0F); - serverLevel.addFreshEntityWithPassengers(frog); - this.discard(); - } + }); } } diff --git a/net/minecraft/world/entity/animal/goat/Goat.java b/net/minecraft/world/entity/animal/goat/Goat.java index 44f76e6e..2a71a223 100644 --- a/net/minecraft/world/entity/animal/goat/Goat.java +++ b/net/minecraft/world/entity/animal/goat/Goat.java @@ -3,9 +3,7 @@ package net.minecraft.world.entity.animal.goat; import com.google.common.collect.ImmutableList; import com.mojang.serialization.Dynamic; import net.minecraft.core.BlockPos; -import net.minecraft.core.Holder; -import net.minecraft.core.HolderSet; -import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.core.registries.Registries; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.protocol.game.DebugPackets; import net.minecraft.network.syncher.EntityDataAccessor; @@ -21,20 +19,22 @@ import net.minecraft.tags.ItemTags; import net.minecraft.tags.TagKey; import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; +import net.minecraft.util.profiling.Profiler; +import net.minecraft.util.profiling.ProfilerFiller; import net.minecraft.world.DifficultyInstance; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.AgeableMob; import net.minecraft.world.entity.EntityDimensions; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; -import net.minecraft.world.entity.Mob; -import net.minecraft.world.entity.MobSpawnType; import net.minecraft.world.entity.Pose; import net.minecraft.world.entity.SpawnGroupData; import net.minecraft.world.entity.ai.Brain; -import net.minecraft.world.entity.ai.attributes.AttributeSupplier; +import net.minecraft.world.entity.ai.Brain.Provider; import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.entity.ai.attributes.AttributeSupplier.Builder; import net.minecraft.world.entity.ai.memory.MemoryModuleType; import net.minecraft.world.entity.ai.sensing.Sensor; import net.minecraft.world.entity.ai.sensing.SensorType; @@ -103,12 +103,16 @@ public class Goat extends Animal { public ItemStack createHorn() { RandomSource randomSource = RandomSource.create(this.getUUID().hashCode()); TagKey tagKey = this.isScreamingGoat() ? InstrumentTags.SCREAMING_GOAT_HORNS : InstrumentTags.REGULAR_GOAT_HORNS; - HolderSet holderSet = BuiltInRegistries.INSTRUMENT.getOrCreateTag(tagKey); - return InstrumentItem.create(Items.GOAT_HORN, (Holder)holderSet.getRandomElement(randomSource).get()); + return (ItemStack)this.level() + .registryAccess() + .lookupOrThrow(Registries.INSTRUMENT) + .getRandomElementOf(tagKey, randomSource) + .map(holder -> InstrumentItem.create(Items.GOAT_HORN, holder)) + .orElseGet(() -> new ItemStack(Items.GOAT_HORN)); } @Override - protected Brain.Provider brainProvider() { + protected Provider brainProvider() { return Brain.provider(MEMORY_TYPES, SENSOR_TYPES); } @@ -117,8 +121,8 @@ public class Goat extends Animal { return GoatAi.makeBrain(this.brainProvider().makeBrain(dynamic)); } - public static AttributeSupplier.Builder createAttributes() { - return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 10.0).add(Attributes.MOVEMENT_SPEED, 0.2F).add(Attributes.ATTACK_DAMAGE, 2.0); + public static Builder createAttributes() { + return Animal.createAnimalAttributes().add(Attributes.MAX_HEALTH, 10.0).add(Attributes.MOVEMENT_SPEED, 0.2F).add(Attributes.ATTACK_DAMAGE, 2.0); } @Override @@ -163,7 +167,7 @@ public class Goat extends Animal { @Nullable public Goat getBreedOffspring(ServerLevel level, AgeableMob otherParent) { - Goat goat = EntityType.GOAT.create(level); + Goat goat = EntityType.GOAT.create(level, EntitySpawnReason.BREEDING); if (goat != null) { GoatAi.initMemories(goat, level.getRandom()); AgeableMob ageableMob = (AgeableMob)(level.getRandom().nextBoolean() ? this : otherParent); @@ -180,14 +184,15 @@ public class Goat extends Animal { } @Override - protected void customServerAiStep() { - this.level().getProfiler().push("goatBrain"); - this.getBrain().tick((ServerLevel)this.level(), this); - this.level().getProfiler().pop(); - this.level().getProfiler().push("goatActivityUpdate"); + protected void customServerAiStep(ServerLevel serverLevel) { + ProfilerFiller profilerFiller = Profiler.get(); + profilerFiller.push("goatBrain"); + this.getBrain().tick(serverLevel, this); + profilerFiller.pop(); + profilerFiller.push("goatActivityUpdate"); GoatAi.updateActivity(this); - this.level().getProfiler().pop(); - super.customServerAiStep(); + profilerFiller.pop(); + super.customServerAiStep(serverLevel); } @Override @@ -204,8 +209,16 @@ public class Goat extends Animal { } @Override - public SoundEvent getEatingSound(ItemStack stack) { - return this.isScreamingGoat() ? SoundEvents.GOAT_SCREAMING_EAT : SoundEvents.GOAT_EAT; + protected void playEatingSound() { + this.level() + .playSound( + null, + this, + this.isScreamingGoat() ? SoundEvents.GOAT_SCREAMING_EAT : SoundEvents.GOAT_EAT, + SoundSource.NEUTRAL, + 1.0F, + Mth.randomBetween(this.level().random, 0.8F, 1.2F) + ); } @Override @@ -220,11 +233,11 @@ public class Goat extends Animal { player.playSound(this.getMilkingSound(), 1.0F, 1.0F); ItemStack itemStack2 = ItemUtils.createFilledResult(itemStack, player, Items.MILK_BUCKET.getDefaultInstance()); player.setItemInHand(hand, itemStack2); - return InteractionResult.sidedSuccess(this.level().isClientSide); + return InteractionResult.SUCCESS; } else { InteractionResult interactionResult = super.mobInteract(player, hand); if (interactionResult.consumesAction() && this.isFood(itemStack)) { - this.level().playSound(null, this, this.getEatingSound(itemStack), SoundSource.NEUTRAL, 1.0F, Mth.randomBetween(this.level().random, 0.8F, 1.2F)); + this.playEatingSound(); } return interactionResult; @@ -232,8 +245,10 @@ public class Goat extends Animal { } @Override - public SpawnGroupData finalizeSpawn(ServerLevelAccessor level, DifficultyInstance difficulty, MobSpawnType spawnType, @Nullable SpawnGroupData spawnGroupData) { - RandomSource randomSource = level.getRandom(); + public SpawnGroupData finalizeSpawn( + ServerLevelAccessor serverLevelAccessor, DifficultyInstance difficultyInstance, EntitySpawnReason entitySpawnReason, @Nullable SpawnGroupData spawnGroupData + ) { + RandomSource randomSource = serverLevelAccessor.getRandom(); GoatAi.initMemories(this, randomSource); this.setScreamingGoat(randomSource.nextDouble() < 0.02); this.ageBoundaryReached(); @@ -242,7 +257,7 @@ public class Goat extends Animal { this.entityData.set(entityDataAccessor, false); } - return super.finalizeSpawn(level, difficulty, spawnType, spawnGroupData); + return super.finalizeSpawn(serverLevelAccessor, difficultyInstance, entitySpawnReason, spawnGroupData); } @Override @@ -296,7 +311,7 @@ public class Goat extends Animal { } @Override - protected void defineSynchedData(SynchedEntityData.Builder builder) { + protected void defineSynchedData(net.minecraft.network.syncher.SynchedEntityData.Builder builder) { super.defineSynchedData(builder); builder.define(DATA_IS_SCREAMING_GOAT, false); builder.define(DATA_HAS_LEFT_HORN, true); @@ -360,7 +375,9 @@ public class Goat extends Animal { return this.lowerHeadTick / 20.0F * 30.0F * (float) (Math.PI / 180.0); } - public static boolean checkGoatSpawnRules(EntityType goat, LevelAccessor level, MobSpawnType spawnType, BlockPos pos, RandomSource random) { - return level.getBlockState(pos.below()).is(BlockTags.GOATS_SPAWNABLE_ON) && isBrightEnoughToSpawn(level, pos); + public static boolean checkGoatSpawnRules( + EntityType entityType, LevelAccessor levelAccessor, EntitySpawnReason entitySpawnReason, BlockPos blockPos, RandomSource randomSource + ) { + return levelAccessor.getBlockState(blockPos.below()).is(BlockTags.GOATS_SPAWNABLE_ON) && isBrightEnoughToSpawn(levelAccessor, blockPos); } } diff --git a/net/minecraft/world/entity/animal/goat/GoatAi.java b/net/minecraft/world/entity/animal/goat/GoatAi.java index e8525eb3..e4333dd5 100644 --- a/net/minecraft/world/entity/animal/goat/GoatAi.java +++ b/net/minecraft/world/entity/animal/goat/GoatAi.java @@ -32,6 +32,7 @@ import net.minecraft.world.entity.ai.memory.MemoryStatus; import net.minecraft.world.entity.ai.targeting.TargetingConditions; import net.minecraft.world.entity.schedule.Activity; import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.GameRules; public class GoatAi { public static final int RAM_PREPARE_TIME = 20; @@ -50,7 +51,9 @@ public class GoatAi { private static final UniformInt TIME_BETWEEN_RAMS_SCREAMER = UniformInt.of(100, 300); private static final TargetingConditions RAM_TARGET_CONDITIONS = TargetingConditions.forCombat() .selector( - livingEntity -> !livingEntity.getType().equals(EntityType.GOAT) && livingEntity.level().getWorldBorder().isWithinBounds(livingEntity.getBoundingBox()) + (livingEntity, serverLevel) -> !livingEntity.getType().equals(EntityType.GOAT) + && (!serverLevel.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) || !livingEntity.getType().equals(EntityType.ARMOR_STAND)) + && serverLevel.getWorldBorder().isWithinBounds(livingEntity.getBoundingBox()) ); private static final float SPEED_MULTIPLIER_WHEN_RAMMING = 3.0F; public static final int RAM_MIN_DISTANCE = 4; @@ -78,8 +81,8 @@ public class GoatAi { Activity.CORE, 0, ImmutableList.of( - new Swim(0.8F), - new AnimalPanic<>(2.0F), + new Swim<>(0.8F), + new AnimalPanic(2.0F), new LookAtTargetSink(45, 90), new MoveToTargetSink(), new CountDownCooldownTicks(MemoryModuleType.TEMPTATION_COOLDOWN_TICKS), @@ -141,7 +144,7 @@ public class GoatAi { 3.0F, goat -> goat.isBaby() ? 1.0 : 2.5, goat -> goat.isScreamingGoat() ? SoundEvents.GOAT_SCREAMING_RAM_IMPACT : SoundEvents.GOAT_RAM_IMPACT, - goat -> goat.isScreamingGoat() ? SoundEvents.GOAT_SCREAMING_HORN_BREAK : SoundEvents.GOAT_HORN_BREAK + goat -> SoundEvents.GOAT_HORN_BREAK ) ), Pair.of( diff --git a/net/minecraft/world/entity/animal/horse/AbstractChestedHorse.java b/net/minecraft/world/entity/animal/horse/AbstractChestedHorse.java index 87262cfb..2ffab9d6 100644 --- a/net/minecraft/world/entity/animal/horse/AbstractChestedHorse.java +++ b/net/minecraft/world/entity/animal/horse/AbstractChestedHorse.java @@ -5,6 +5,8 @@ import net.minecraft.nbt.ListTag; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.network.syncher.SynchedEntityData.Builder; +import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundEvents; import net.minecraft.util.RandomSource; import net.minecraft.world.InteractionHand; @@ -15,7 +17,6 @@ import net.minecraft.world.entity.EntityDimensions; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.Pose; import net.minecraft.world.entity.SlotAccess; -import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; @@ -41,12 +42,12 @@ public abstract class AbstractChestedHorse extends AbstractHorse { } @Override - protected void defineSynchedData(SynchedEntityData.Builder builder) { + protected void defineSynchedData(Builder builder) { super.defineSynchedData(builder); builder.define(DATA_ID_CHEST, false); } - public static AttributeSupplier.Builder createBaseChestedHorseAttributes() { + public static net.minecraft.world.entity.ai.attributes.AttributeSupplier.Builder createBaseChestedHorseAttributes() { return createBaseHorseAttributes().add(Attributes.MOVEMENT_SPEED, 0.175F).add(Attributes.JUMP_STRENGTH, 0.5); } @@ -64,13 +65,10 @@ public abstract class AbstractChestedHorse extends AbstractHorse { } @Override - protected void dropEquipment() { - super.dropEquipment(); + protected void dropEquipment(ServerLevel serverLevel) { + super.dropEquipment(serverLevel); if (this.hasChest()) { - if (!this.level().isClientSide) { - this.spawnAtLocation(Blocks.CHEST); - } - + this.spawnAtLocation(serverLevel, Blocks.CHEST); this.setChest(false); } } @@ -158,12 +156,12 @@ public abstract class AbstractChestedHorse extends AbstractHorse { if (!this.isTamed()) { this.makeMad(); - return InteractionResult.sidedSuccess(this.level().isClientSide); + return InteractionResult.SUCCESS; } if (!this.hasChest() && itemStack.is(Items.CHEST)) { this.equipChest(player, itemStack); - return InteractionResult.sidedSuccess(this.level().isClientSide); + return InteractionResult.SUCCESS; } } diff --git a/net/minecraft/world/entity/animal/horse/AbstractHorse.java b/net/minecraft/world/entity/animal/horse/AbstractHorse.java index 267d7d78..99586506 100644 --- a/net/minecraft/world/entity/animal/horse/AbstractHorse.java +++ b/net/minecraft/world/entity/animal/horse/AbstractHorse.java @@ -3,7 +3,6 @@ package net.minecraft.world.entity.animal.horse; import java.util.UUID; import java.util.function.DoubleSupplier; import java.util.function.IntUnaryOperator; -import java.util.function.Predicate; import net.minecraft.advancements.CriteriaTriggers; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -14,6 +13,7 @@ import net.minecraft.nbt.CompoundTag; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.network.syncher.SynchedEntityData.Builder; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.players.OldUsersConverter; @@ -33,13 +33,12 @@ import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.AgeableMob; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityDimensions; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.HasCustomInventoryScreen; import net.minecraft.world.entity.HumanoidArm; import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.entity.Mob; -import net.minecraft.world.entity.MobSpawnType; import net.minecraft.world.entity.OwnableEntity; import net.minecraft.world.entity.PlayerRideableJumping; import net.minecraft.world.entity.Pose; @@ -47,7 +46,6 @@ import net.minecraft.world.entity.Saddleable; import net.minecraft.world.entity.SlotAccess; import net.minecraft.world.entity.SpawnGroupData; import net.minecraft.world.entity.ai.attributes.Attribute; -import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.entity.ai.goal.BreedGoal; import net.minecraft.world.entity.ai.goal.FloatGoal; @@ -92,8 +90,8 @@ public abstract class AbstractHorse extends Animal implements ContainerListener, private static final float MAX_HEALTH = generateMaxHealth(i -> i - 1); private static final float BACKWARDS_MOVE_SPEED_FACTOR = 0.25F; private static final float SIDEWAYS_MOVE_SPEED_FACTOR = 0.5F; - private static final Predicate PARENT_HORSE_SELECTOR = livingEntity -> livingEntity instanceof AbstractHorse - && ((AbstractHorse)livingEntity).isBred(); + private static final TargetingConditions.Selector PARENT_HORSE_SELECTOR = (livingEntity, serverLevel) -> livingEntity instanceof AbstractHorse abstractHorse + && abstractHorse.isBred(); private static final TargetingConditions MOMMY_TARGETING = TargetingConditions.forNonCombat().range(16.0).ignoreLineOfSight().selector(PARENT_HORSE_SELECTOR); private static final EntityDataAccessor DATA_ID_FLAGS = SynchedEntityData.defineId(AbstractHorse.class, EntityDataSerializers.BYTE); private static final int FLAG_TAME = 2; @@ -104,6 +102,7 @@ public abstract class AbstractHorse extends Animal implements ContainerListener, private static final int FLAG_OPEN_MOUTH = 64; public static final int INV_SLOT_SADDLE = 0; public static final int INV_BASE_COUNT = 1; + public static final int INVENTORY_ROWS = 3; private int eatingCounter; private int mouthCounter; private int standCounter; @@ -178,7 +177,7 @@ public abstract class AbstractHorse extends Animal implements ContainerListener, } @Override - protected void defineSynchedData(SynchedEntityData.Builder builder) { + protected void defineSynchedData(Builder builder) { super.defineSynchedData(builder); builder.define(DATA_ID_FLAGS, (byte)0); } @@ -258,12 +257,16 @@ public abstract class AbstractHorse extends Animal implements ContainerListener, } public void equipBodyArmor(Player player, ItemStack stack) { - if (this.isBodyArmorItem(stack)) { - this.setBodyArmorItem(stack.copyWithCount(1)); - stack.consume(1, player); + if (this.isEquippableInSlot(stack, EquipmentSlot.BODY)) { + this.setBodyArmorItem(stack.consumeAndReturn(1, player)); } } + @Override + protected boolean canDispenserEquipIntoSlot(EquipmentSlot equipmentSlot) { + return equipmentSlot == EquipmentSlot.BODY && this.isTamed() || super.canDispenserEquipIntoSlot(equipmentSlot); + } + @Override public boolean isSaddled() { return this.getFlag(4); @@ -366,8 +369,8 @@ public abstract class AbstractHorse extends Animal implements ContainerListener, } @Override - public boolean hurt(DamageSource source, float amount) { - boolean bl = super.hurt(source, amount); + public boolean hurtServer(ServerLevel serverLevel, DamageSource damageSource, float f) { + boolean bl = super.hurtServer(serverLevel, damageSource, f); if (bl && this.random.nextInt(3) == 0) { this.standIfPossible(); } @@ -425,8 +428,8 @@ public abstract class AbstractHorse extends Animal implements ContainerListener, this.playSound(SoundEvents.HORSE_GALLOP, soundType.getVolume() * 0.15F, soundType.getPitch()); } - public static AttributeSupplier.Builder createBaseHorseAttributes() { - return Mob.createMobAttributes() + public static net.minecraft.world.entity.ai.attributes.AttributeSupplier.Builder createBaseHorseAttributes() { + return Animal.createAnimalAttributes() .add(Attributes.JUMP_STRENGTH, 0.7) .add(Attributes.MAX_HEALTH, 53.0) .add(Attributes.MOVEMENT_SPEED, 0.225F) @@ -467,11 +470,7 @@ public abstract class AbstractHorse extends Animal implements ContainerListener, stack.consume(1, player); } - if (this.level().isClientSide) { - return InteractionResult.CONSUME; - } else { - return bl ? InteractionResult.SUCCESS : InteractionResult.PASS; - } + return (InteractionResult)(!bl && !this.level().isClientSide ? InteractionResult.PASS : InteractionResult.SUCCESS_SERVER); } protected boolean handleEating(Player player, ItemStack stack) { @@ -563,13 +562,13 @@ public abstract class AbstractHorse extends Animal implements ContainerListener, } @Override - protected void dropEquipment() { - super.dropEquipment(); + protected void dropEquipment(ServerLevel serverLevel) { + super.dropEquipment(serverLevel); if (this.inventory != null) { for (int i = 0; i < this.inventory.getContainerSize(); i++) { ItemStack itemStack = this.inventory.getItem(i); if (!itemStack.isEmpty() && !EnchantmentHelper.has(itemStack, EnchantmentEffectComponents.PREVENT_EQUIPMENT_DROP)) { - this.spawnAtLocation(itemStack); + this.spawnAtLocation(serverLevel, itemStack); } } } @@ -582,7 +581,7 @@ public abstract class AbstractHorse extends Animal implements ContainerListener, } super.aiStep(); - if (!this.level().isClientSide && this.isAlive()) { + if (this.level() instanceof ServerLevel serverLevel && this.isAlive()) { if (this.random.nextInt(900) == 0 && this.deathTime == 0) { this.heal(1.0F); } @@ -591,7 +590,7 @@ public abstract class AbstractHorse extends Animal implements ContainerListener, if (!this.isEating() && !this.isVehicle() && this.random.nextInt(300) == 0 - && this.level().getBlockState(this.blockPosition().below()).is(Blocks.GRASS_BLOCK)) { + && serverLevel.getBlockState(this.blockPosition().below()).is(Blocks.GRASS_BLOCK)) { this.setEating(true); } @@ -601,14 +600,15 @@ public abstract class AbstractHorse extends Animal implements ContainerListener, } } - this.followMommy(); + this.followMommy(serverLevel); } } - protected void followMommy() { + protected void followMommy(ServerLevel serverLevel) { if (this.isBred() && this.isBaby() && !this.isEating()) { - LivingEntity livingEntity = this.level() - .getNearestEntity(AbstractHorse.class, MOMMY_TARGETING, this, this.getX(), this.getY(), this.getZ(), this.getBoundingBox().inflate(16.0)); + LivingEntity livingEntity = serverLevel.getNearestEntity( + AbstractHorse.class, MOMMY_TARGETING, this, this.getX(), this.getY(), this.getZ(), this.getBoundingBox().inflate(16.0) + ); if (livingEntity != null && this.distanceToSqr(livingEntity) > 4.0) { this.navigation.createPath(livingEntity, 0); } @@ -692,7 +692,7 @@ public abstract class AbstractHorse extends Animal implements ContainerListener, return super.mobInteract(player, hand); } else if (this.isTamed() && player.isSecondaryUseActive()) { this.openCustomInventoryScreen(player); - return InteractionResult.sidedSuccess(this.level().isClientSide); + return InteractionResult.SUCCESS; } else { ItemStack itemStack = player.getItemInHand(hand); if (!itemStack.isEmpty()) { @@ -701,14 +701,14 @@ public abstract class AbstractHorse extends Animal implements ContainerListener, return interactionResult; } - if (this.canUseSlot(EquipmentSlot.BODY) && this.isBodyArmorItem(itemStack) && !this.isWearingBodyArmor()) { + if (this.isEquippableInSlot(itemStack, EquipmentSlot.BODY) && !this.isWearingBodyArmor()) { this.equipBodyArmor(player, itemStack); - return InteractionResult.sidedSuccess(this.level().isClientSide); + return InteractionResult.SUCCESS; } } this.doPlayerRide(player); - return InteractionResult.sidedSuccess(this.level().isClientSide); + return InteractionResult.SUCCESS; } } @@ -1107,13 +1107,15 @@ public abstract class AbstractHorse extends Animal implements ContainerListener, @Nullable @Override - public SpawnGroupData finalizeSpawn(ServerLevelAccessor level, DifficultyInstance difficulty, MobSpawnType spawnType, @Nullable SpawnGroupData spawnGroupData) { + public SpawnGroupData finalizeSpawn( + ServerLevelAccessor serverLevelAccessor, DifficultyInstance difficultyInstance, EntitySpawnReason entitySpawnReason, @Nullable SpawnGroupData spawnGroupData + ) { if (spawnGroupData == null) { spawnGroupData = new AgeableMob.AgeableMobGroupData(0.2F); } - this.randomizeAttributes(level.getRandom()); - return super.finalizeSpawn(level, difficulty, spawnType, spawnGroupData); + this.randomizeAttributes(serverLevelAccessor.getRandom()); + return super.finalizeSpawn(serverLevelAccessor, difficultyInstance, entitySpawnReason, spawnGroupData); } public boolean hasInventoryChanged(Container inventory) { diff --git a/net/minecraft/world/entity/animal/horse/Donkey.java b/net/minecraft/world/entity/animal/horse/Donkey.java index bec0736a..51c59537 100644 --- a/net/minecraft/world/entity/animal/horse/Donkey.java +++ b/net/minecraft/world/entity/animal/horse/Donkey.java @@ -5,6 +5,7 @@ import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.AgeableMob; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.animal.Animal; import net.minecraft.world.level.Level; @@ -59,7 +60,7 @@ public class Donkey extends AbstractChestedHorse { @Override public AgeableMob getBreedOffspring(ServerLevel level, AgeableMob otherParent) { EntityType entityType = otherParent instanceof Horse ? EntityType.MULE : EntityType.DONKEY; - AbstractHorse abstractHorse = entityType.create(level); + AbstractHorse abstractHorse = entityType.create(level, EntitySpawnReason.BREEDING); if (abstractHorse != null) { this.setOffspringAttributes(otherParent, abstractHorse); } diff --git a/net/minecraft/world/entity/animal/horse/Horse.java b/net/minecraft/world/entity/animal/horse/Horse.java index a73fc238..e482dc91 100644 --- a/net/minecraft/world/entity/animal/horse/Horse.java +++ b/net/minecraft/world/entity/animal/horse/Horse.java @@ -5,11 +5,11 @@ import net.minecraft.nbt.CompoundTag; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.network.syncher.SynchedEntityData.Builder; import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; import net.minecraft.util.RandomSource; -import net.minecraft.world.Container; import net.minecraft.world.DifficultyInstance; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; @@ -18,16 +18,15 @@ import net.minecraft.world.entity.AgeableMob; import net.minecraft.world.entity.EntityAttachment; import net.minecraft.world.entity.EntityAttachments; import net.minecraft.world.entity.EntityDimensions; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.EquipmentSlot; -import net.minecraft.world.entity.MobSpawnType; import net.minecraft.world.entity.Pose; import net.minecraft.world.entity.SpawnGroupData; import net.minecraft.world.entity.VariantHolder; import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.entity.animal.Animal; import net.minecraft.world.entity.player.Player; -import net.minecraft.world.item.AnimalArmorItem; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; import net.minecraft.world.level.ServerLevelAccessor; @@ -53,7 +52,7 @@ public class Horse extends AbstractHorse implements VariantHolder { } @Override - protected void defineSynchedData(SynchedEntityData.Builder builder) { + protected void defineSynchedData(Builder builder) { super.defineSynchedData(builder); builder.define(DATA_ID_TYPE_VARIANT, 0); } @@ -94,16 +93,6 @@ public class Horse extends AbstractHorse implements VariantHolder { return Markings.byId((this.getTypeVariant() & 0xFF00) >> 8); } - @Override - public void containerChanged(Container container) { - ItemStack itemStack = this.getBodyArmorItem(); - super.containerChanged(container); - ItemStack itemStack2 = this.getBodyArmorItem(); - if (this.tickCount > 20 && this.isBodyArmorItem(itemStack2) && itemStack != itemStack2) { - this.playSound(SoundEvents.HORSE_ARMOR, 0.5F, 1.0F); - } - } - @Override protected void playGallopSound(SoundType soundType) { super.playGallopSound(soundType); @@ -150,7 +139,7 @@ public class Horse extends AbstractHorse implements VariantHolder { if (!this.isTamed()) { this.makeMad(); - return InteractionResult.sidedSuccess(this.level().isClientSide); + return InteractionResult.SUCCESS; } } @@ -173,7 +162,7 @@ public class Horse extends AbstractHorse implements VariantHolder { @Override public AgeableMob getBreedOffspring(ServerLevel level, AgeableMob otherParent) { if (otherParent instanceof Donkey) { - Mule mule = EntityType.MULE.create(level); + Mule mule = EntityType.MULE.create(level, EntitySpawnReason.BREEDING); if (mule != null) { this.setOffspringAttributes(otherParent, mule); } @@ -181,7 +170,7 @@ public class Horse extends AbstractHorse implements VariantHolder { return mule; } else { Horse horse = (Horse)otherParent; - Horse horse2 = EntityType.HORSE.create(level); + Horse horse2 = EntityType.HORSE.create(level, EntitySpawnReason.BREEDING); if (horse2 != null) { int i = this.random.nextInt(9); Variant variant; @@ -217,14 +206,16 @@ public class Horse extends AbstractHorse implements VariantHolder { } @Override - public boolean isBodyArmorItem(ItemStack stack) { - return stack.getItem() instanceof AnimalArmorItem animalArmorItem && animalArmorItem.getBodyType() == AnimalArmorItem.BodyType.EQUESTRIAN; + protected void hurtArmor(DamageSource damageSource, float damageAmount) { + this.doHurtEquipment(damageSource, damageAmount, new EquipmentSlot[]{EquipmentSlot.BODY}); } @Nullable @Override - public SpawnGroupData finalizeSpawn(ServerLevelAccessor level, DifficultyInstance difficulty, MobSpawnType spawnType, @Nullable SpawnGroupData spawnGroupData) { - RandomSource randomSource = level.getRandom(); + public SpawnGroupData finalizeSpawn( + ServerLevelAccessor serverLevelAccessor, DifficultyInstance difficultyInstance, EntitySpawnReason entitySpawnReason, @Nullable SpawnGroupData spawnGroupData + ) { + RandomSource randomSource = serverLevelAccessor.getRandom(); Variant variant; if (spawnGroupData instanceof Horse.HorseGroupData) { variant = ((Horse.HorseGroupData)spawnGroupData).variant; @@ -234,7 +225,7 @@ public class Horse extends AbstractHorse implements VariantHolder { } this.setVariantAndMarkings(variant, Util.getRandom(Markings.values(), randomSource)); - return super.finalizeSpawn(level, difficulty, spawnType, spawnGroupData); + return super.finalizeSpawn(serverLevelAccessor, difficultyInstance, entitySpawnReason, spawnGroupData); } @Override diff --git a/net/minecraft/world/entity/animal/horse/Llama.java b/net/minecraft/world/entity/animal/horse/Llama.java index bb5f295c..72347f43 100644 --- a/net/minecraft/world/entity/animal/horse/Llama.java +++ b/net/minecraft/world/entity/animal/horse/Llama.java @@ -16,6 +16,7 @@ import net.minecraft.tags.ItemTags; import net.minecraft.util.ByIdMap; import net.minecraft.util.RandomSource; import net.minecraft.util.StringRepresentable; +import net.minecraft.util.ByIdMap.OutOfBoundsStrategy; import net.minecraft.world.DifficultyInstance; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.AgeableMob; @@ -23,15 +24,14 @@ import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityAttachment; import net.minecraft.world.entity.EntityAttachments; import net.minecraft.world.entity.EntityDimensions; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.entity.MobSpawnType; import net.minecraft.world.entity.Pose; import net.minecraft.world.entity.SpawnGroupData; import net.minecraft.world.entity.VariantHolder; -import net.minecraft.world.entity.ai.attributes.AttributeSupplier; -import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.entity.ai.attributes.AttributeSupplier.Builder; import net.minecraft.world.entity.ai.goal.BreedGoal; import net.minecraft.world.entity.ai.goal.FloatGoal; import net.minecraft.world.entity.ai.goal.FollowParentGoal; @@ -50,14 +50,12 @@ import net.minecraft.world.entity.animal.Wolf; import net.minecraft.world.entity.monster.RangedAttackMob; import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.projectile.LlamaSpit; -import net.minecraft.world.item.DyeColor; +import net.minecraft.world.entity.projectile.Projectile; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.level.Level; import net.minecraft.world.level.ServerLevelAccessor; -import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; -import net.minecraft.world.level.block.WoolCarpetBlock; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.Vec3; import org.jetbrains.annotations.Nullable; @@ -78,6 +76,7 @@ public class Llama extends AbstractChestedHorse implements VariantHolder entityType, Level level) { super(entityType, level); + this.getNavigation().setRequiredPathLength(40.0F); } public boolean isTraderLlama() { @@ -128,12 +127,12 @@ public class Llama extends AbstractChestedHorse implements VariantHolder { public LlamaAttackWolfGoal(Llama llama) { - super(llama, Wolf.class, 16, false, true, livingEntity -> !((Wolf)livingEntity).isTame()); + super(llama, Wolf.class, 16, false, true, (livingEntity, serverLevel) -> !((Wolf)livingEntity).isTame()); } @Override @@ -495,7 +482,7 @@ public class Llama extends AbstractChestedHorse implements VariantHolder CODEC = StringRepresentable.fromEnum(Llama.Variant::values); - private static final IntFunction BY_ID = ByIdMap.continuous(Llama.Variant::getId, values(), ByIdMap.OutOfBoundsStrategy.CLAMP); + private static final IntFunction BY_ID = ByIdMap.continuous(Llama.Variant::getId, values(), OutOfBoundsStrategy.CLAMP); final int id; private final String name; diff --git a/net/minecraft/world/entity/animal/horse/Mule.java b/net/minecraft/world/entity/animal/horse/Mule.java index eb4ae139..3b97ad5d 100644 --- a/net/minecraft/world/entity/animal/horse/Mule.java +++ b/net/minecraft/world/entity/animal/horse/Mule.java @@ -5,6 +5,7 @@ import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.AgeableMob; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; import net.minecraft.world.level.Level; import org.jetbrains.annotations.Nullable; @@ -53,6 +54,6 @@ public class Mule extends AbstractChestedHorse { @Nullable @Override public AgeableMob getBreedOffspring(ServerLevel level, AgeableMob otherParent) { - return EntityType.MULE.create(level); + return EntityType.MULE.create(level, EntitySpawnReason.BREEDING); } } diff --git a/net/minecraft/world/entity/animal/horse/SkeletonHorse.java b/net/minecraft/world/entity/animal/horse/SkeletonHorse.java index 18cb11c4..c7de2154 100644 --- a/net/minecraft/world/entity/animal/horse/SkeletonHorse.java +++ b/net/minecraft/world/entity/animal/horse/SkeletonHorse.java @@ -14,11 +14,11 @@ import net.minecraft.world.entity.AgeableMob; import net.minecraft.world.entity.EntityAttachment; import net.minecraft.world.entity.EntityAttachments; import net.minecraft.world.entity.EntityDimensions; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; -import net.minecraft.world.entity.MobSpawnType; import net.minecraft.world.entity.Pose; -import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.entity.ai.attributes.AttributeSupplier.Builder; import net.minecraft.world.entity.animal.Animal; import net.minecraft.world.entity.player.Player; import net.minecraft.world.level.Level; @@ -39,16 +39,16 @@ public class SkeletonHorse extends AbstractHorse { super(entityType, level); } - public static AttributeSupplier.Builder createAttributes() { + public static Builder createAttributes() { return createBaseHorseAttributes().add(Attributes.MAX_HEALTH, 15.0).add(Attributes.MOVEMENT_SPEED, 0.2F); } public static boolean checkSkeletonHorseSpawnRules( - EntityType animal, LevelAccessor level, MobSpawnType spawnType, BlockPos pos, RandomSource random + EntityType entityType, LevelAccessor levelAccessor, EntitySpawnReason entitySpawnReason, BlockPos blockPos, RandomSource randomSource ) { - return !MobSpawnType.isSpawner(spawnType) - ? Animal.checkAnimalSpawnRules(animal, level, spawnType, pos, random) - : MobSpawnType.ignoresLightRequirements(spawnType) || isBrightEnoughToSpawn(level, pos); + return !EntitySpawnReason.isSpawner(entitySpawnReason) + ? Animal.checkAnimalSpawnRules(entityType, levelAccessor, entitySpawnReason, blockPos, randomSource) + : EntitySpawnReason.ignoresLightRequirements(entitySpawnReason) || isBrightEnoughToSpawn(levelAccessor, blockPos); } @Override @@ -163,11 +163,11 @@ public class SkeletonHorse extends AbstractHorse { @Nullable @Override public AgeableMob getBreedOffspring(ServerLevel level, AgeableMob otherParent) { - return EntityType.SKELETON_HORSE.create(level); + return EntityType.SKELETON_HORSE.create(level, EntitySpawnReason.BREEDING); } @Override public InteractionResult mobInteract(Player player, InteractionHand hand) { - return !this.isTamed() ? InteractionResult.PASS : super.mobInteract(player, hand); + return (InteractionResult)(!this.isTamed() ? InteractionResult.PASS : super.mobInteract(player, hand)); } } diff --git a/net/minecraft/world/entity/animal/horse/SkeletonTrapGoal.java b/net/minecraft/world/entity/animal/horse/SkeletonTrapGoal.java index 61821fbe..c9fc9a1a 100644 --- a/net/minecraft/world/entity/animal/horse/SkeletonTrapGoal.java +++ b/net/minecraft/world/entity/animal/horse/SkeletonTrapGoal.java @@ -3,10 +3,10 @@ package net.minecraft.world.entity.animal.horse; import net.minecraft.core.component.DataComponents; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.DifficultyInstance; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.LightningBolt; -import net.minecraft.world.entity.MobSpawnType; import net.minecraft.world.entity.ai.goal.Goal; import net.minecraft.world.entity.monster.Skeleton; import net.minecraft.world.item.ItemStack; @@ -35,7 +35,7 @@ public class SkeletonTrapGoal extends Goal { this.horse.setTrap(false); this.horse.setTamed(true); this.horse.setAge(0); - LightningBolt lightningBolt = EntityType.LIGHTNING_BOLT.create(serverLevel); + LightningBolt lightningBolt = EntityType.LIGHTNING_BOLT.create(serverLevel, EntitySpawnReason.TRIGGERED); if (lightningBolt != null) { lightningBolt.moveTo(this.horse.getX(), this.horse.getY(), this.horse.getZ()); lightningBolt.setVisualOnly(true); @@ -62,9 +62,9 @@ public class SkeletonTrapGoal extends Goal { @Nullable private AbstractHorse createHorse(DifficultyInstance difficulty) { - SkeletonHorse skeletonHorse = EntityType.SKELETON_HORSE.create(this.horse.level()); + SkeletonHorse skeletonHorse = EntityType.SKELETON_HORSE.create(this.horse.level(), EntitySpawnReason.TRIGGERED); if (skeletonHorse != null) { - skeletonHorse.finalizeSpawn((ServerLevel)this.horse.level(), difficulty, MobSpawnType.TRIGGERED, null); + skeletonHorse.finalizeSpawn((ServerLevel)this.horse.level(), difficulty, EntitySpawnReason.TRIGGERED, null); skeletonHorse.setPos(this.horse.getX(), this.horse.getY(), this.horse.getZ()); skeletonHorse.invulnerableTime = 60; skeletonHorse.setPersistenceRequired(); @@ -77,9 +77,9 @@ public class SkeletonTrapGoal extends Goal { @Nullable private Skeleton createSkeleton(DifficultyInstance difficulty, AbstractHorse horse) { - Skeleton skeleton = EntityType.SKELETON.create(horse.level()); + Skeleton skeleton = EntityType.SKELETON.create(horse.level(), EntitySpawnReason.TRIGGERED); if (skeleton != null) { - skeleton.finalizeSpawn((ServerLevel)horse.level(), difficulty, MobSpawnType.TRIGGERED, null); + skeleton.finalizeSpawn((ServerLevel)horse.level(), difficulty, EntitySpawnReason.TRIGGERED, null); skeleton.setPos(horse.getX(), horse.getY(), horse.getZ()); skeleton.invulnerableTime = 60; skeleton.setPersistenceRequired(); diff --git a/net/minecraft/world/entity/animal/horse/TraderLlama.java b/net/minecraft/world/entity/animal/horse/TraderLlama.java index 78298eb0..cde24cf6 100644 --- a/net/minecraft/world/entity/animal/horse/TraderLlama.java +++ b/net/minecraft/world/entity/animal/horse/TraderLlama.java @@ -5,14 +5,17 @@ import net.minecraft.nbt.CompoundTag; import net.minecraft.world.DifficultyInstance; import net.minecraft.world.entity.AgeableMob; import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.entity.MobSpawnType; import net.minecraft.world.entity.SpawnGroupData; import net.minecraft.world.entity.ai.goal.Goal; import net.minecraft.world.entity.ai.goal.PanicGoal; +import net.minecraft.world.entity.ai.goal.target.NearestAttackableTargetGoal; import net.minecraft.world.entity.ai.goal.target.TargetGoal; import net.minecraft.world.entity.ai.targeting.TargetingConditions; +import net.minecraft.world.entity.monster.AbstractIllager; +import net.minecraft.world.entity.monster.Zombie; import net.minecraft.world.entity.npc.WanderingTrader; import net.minecraft.world.entity.player.Player; import net.minecraft.world.level.Level; @@ -34,7 +37,7 @@ public class TraderLlama extends Llama { @Nullable @Override protected Llama makeNewLlama() { - return EntityType.TRADER_LLAMA.create(this.level()); + return EntityType.TRADER_LLAMA.create(this.level(), EntitySpawnReason.BREEDING); } @Override @@ -56,6 +59,9 @@ public class TraderLlama extends Llama { super.registerGoals(); this.goalSelector.addGoal(1, new PanicGoal(this, 2.0)); this.targetSelector.addGoal(1, new TraderLlama.TraderLlamaDefendWanderingTraderGoal(this)); + this.targetSelector + .addGoal(2, new NearestAttackableTargetGoal(this, Zombie.class, true, (livingEntity, serverLevel) -> livingEntity.getType() != EntityType.ZOMBIFIED_PIGLIN)); + this.targetSelector.addGoal(2, new NearestAttackableTargetGoal(this, AbstractIllager.class, true)); } public void setDespawnDelay(int despawnDelay) { @@ -102,8 +108,10 @@ public class TraderLlama extends Llama { @Nullable @Override - public SpawnGroupData finalizeSpawn(ServerLevelAccessor level, DifficultyInstance difficulty, MobSpawnType spawnType, @Nullable SpawnGroupData spawnGroupData) { - if (spawnType == MobSpawnType.EVENT) { + public SpawnGroupData finalizeSpawn( + ServerLevelAccessor serverLevelAccessor, DifficultyInstance difficultyInstance, EntitySpawnReason entitySpawnReason, @Nullable SpawnGroupData spawnGroupData + ) { + if (entitySpawnReason == EntitySpawnReason.EVENT) { this.setAge(0); } @@ -111,7 +119,7 @@ public class TraderLlama extends Llama { spawnGroupData = new AgeableMob.AgeableMobGroupData(false); } - return super.finalizeSpawn(level, difficulty, spawnType, spawnGroupData); + return super.finalizeSpawn(serverLevelAccessor, difficultyInstance, entitySpawnReason, spawnGroupData); } protected static class TraderLlamaDefendWanderingTraderGoal extends TargetGoal { diff --git a/net/minecraft/world/entity/animal/horse/Variant.java b/net/minecraft/world/entity/animal/horse/Variant.java index 1ef7685b..e291868c 100644 --- a/net/minecraft/world/entity/animal/horse/Variant.java +++ b/net/minecraft/world/entity/animal/horse/Variant.java @@ -4,6 +4,7 @@ import com.mojang.serialization.Codec; import java.util.function.IntFunction; import net.minecraft.util.ByIdMap; import net.minecraft.util.StringRepresentable; +import net.minecraft.util.ByIdMap.OutOfBoundsStrategy; public enum Variant implements StringRepresentable { WHITE(0, "white"), @@ -15,7 +16,7 @@ public enum Variant implements StringRepresentable { DARK_BROWN(6, "dark_brown"); public static final Codec CODEC = StringRepresentable.fromEnum(Variant::values); - private static final IntFunction BY_ID = ByIdMap.continuous(Variant::getId, values(), ByIdMap.OutOfBoundsStrategy.WRAP); + private static final IntFunction BY_ID = ByIdMap.continuous(Variant::getId, values(), OutOfBoundsStrategy.WRAP); private final int id; private final String name; diff --git a/net/minecraft/world/entity/animal/horse/ZombieHorse.java b/net/minecraft/world/entity/animal/horse/ZombieHorse.java index 9d186729..3179a4a7 100644 --- a/net/minecraft/world/entity/animal/horse/ZombieHorse.java +++ b/net/minecraft/world/entity/animal/horse/ZombieHorse.java @@ -12,11 +12,11 @@ import net.minecraft.world.entity.AgeableMob; import net.minecraft.world.entity.EntityAttachment; import net.minecraft.world.entity.EntityAttachments; import net.minecraft.world.entity.EntityDimensions; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; -import net.minecraft.world.entity.MobSpawnType; import net.minecraft.world.entity.Pose; -import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.entity.ai.attributes.AttributeSupplier.Builder; import net.minecraft.world.entity.animal.Animal; import net.minecraft.world.entity.player.Player; import net.minecraft.world.level.Level; @@ -33,16 +33,16 @@ public class ZombieHorse extends AbstractHorse { super(entityType, level); } - public static AttributeSupplier.Builder createAttributes() { + public static Builder createAttributes() { return createBaseHorseAttributes().add(Attributes.MAX_HEALTH, 15.0).add(Attributes.MOVEMENT_SPEED, 0.2F); } public static boolean checkZombieHorseSpawnRules( - EntityType animal, LevelAccessor level, MobSpawnType spawnType, BlockPos pos, RandomSource random + EntityType entityType, LevelAccessor levelAccessor, EntitySpawnReason entitySpawnReason, BlockPos blockPos, RandomSource randomSource ) { - return !MobSpawnType.isSpawner(spawnType) - ? Animal.checkAnimalSpawnRules(animal, level, spawnType, pos, random) - : MobSpawnType.ignoresLightRequirements(spawnType) || isBrightEnoughToSpawn(level, pos); + return !EntitySpawnReason.isSpawner(entitySpawnReason) + ? Animal.checkAnimalSpawnRules(entityType, levelAccessor, entitySpawnReason, blockPos, randomSource) + : EntitySpawnReason.ignoresLightRequirements(entitySpawnReason) || isBrightEnoughToSpawn(levelAccessor, blockPos); } @Override @@ -68,12 +68,12 @@ public class ZombieHorse extends AbstractHorse { @Nullable @Override public AgeableMob getBreedOffspring(ServerLevel level, AgeableMob otherParent) { - return EntityType.ZOMBIE_HORSE.create(level); + return EntityType.ZOMBIE_HORSE.create(level, EntitySpawnReason.BREEDING); } @Override public InteractionResult mobInteract(Player player, InteractionHand hand) { - return !this.isTamed() ? InteractionResult.PASS : super.mobInteract(player, hand); + return (InteractionResult)(!this.isTamed() ? InteractionResult.PASS : super.mobInteract(player, hand)); } @Override diff --git a/net/minecraft/world/entity/animal/sniffer/Sniffer.java b/net/minecraft/world/entity/animal/sniffer/Sniffer.java index 9b9788cc..84679e6b 100644 --- a/net/minecraft/world/entity/animal/sniffer/Sniffer.java +++ b/net/minecraft/world/entity/animal/sniffer/Sniffer.java @@ -29,18 +29,22 @@ import net.minecraft.tags.BlockTags; import net.minecraft.tags.ItemTags; import net.minecraft.util.ByIdMap; import net.minecraft.util.Mth; +import net.minecraft.util.ByIdMap.OutOfBoundsStrategy; +import net.minecraft.util.profiling.Profiler; +import net.minecraft.util.profiling.ProfilerFiller; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.AgeableMob; import net.minecraft.world.entity.AnimationState; import net.minecraft.world.entity.EntityDimensions; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; -import net.minecraft.world.entity.Mob; import net.minecraft.world.entity.Pose; import net.minecraft.world.entity.ai.Brain; -import net.minecraft.world.entity.ai.attributes.AttributeSupplier; +import net.minecraft.world.entity.ai.Brain.Provider; import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.entity.ai.attributes.AttributeSupplier.Builder; import net.minecraft.world.entity.ai.memory.MemoryModuleType; import net.minecraft.world.entity.ai.util.LandRandomPos; import net.minecraft.world.entity.animal.Animal; @@ -52,14 +56,10 @@ import net.minecraft.world.level.Level; import net.minecraft.world.level.block.RenderShape; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.level.gameevent.GameEvent.Context; import net.minecraft.world.level.pathfinder.Path; import net.minecraft.world.level.pathfinder.PathType; import net.minecraft.world.level.storage.loot.BuiltInLootTables; -import net.minecraft.world.level.storage.loot.LootParams; -import net.minecraft.world.level.storage.loot.LootTable; -import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets; -import net.minecraft.world.level.storage.loot.parameters.LootContextParams; -import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.Vec3; public class Sniffer extends Animal { @@ -79,8 +79,8 @@ public class Sniffer extends Animal { public final AnimationState diggingAnimationState = new AnimationState(); public final AnimationState risingAnimationState = new AnimationState(); - public static AttributeSupplier.Builder createAttributes() { - return Mob.createMobAttributes().add(Attributes.MOVEMENT_SPEED, 0.1F).add(Attributes.MAX_HEALTH, 14.0); + public static Builder createAttributes() { + return Animal.createAnimalAttributes().add(Attributes.MOVEMENT_SPEED, 0.1F).add(Attributes.MAX_HEALTH, 14.0); } public Sniffer(EntityType entityType, Level level) { @@ -92,7 +92,7 @@ public class Sniffer extends Animal { } @Override - protected void defineSynchedData(SynchedEntityData.Builder builder) { + protected void defineSynchedData(net.minecraft.network.syncher.SynchedEntityData.Builder builder) { super.defineSynchedData(builder); builder.define(DATA_STATE, Sniffer.State.IDLING); builder.define(DATA_DROP_SEED_AT_TICK, 0); @@ -265,28 +265,19 @@ public class Sniffer extends Animal { } private void dropSeed() { - if (!this.level().isClientSide() && this.entityData.get(DATA_DROP_SEED_AT_TICK) == this.tickCount) { - ServerLevel serverLevel = (ServerLevel)this.level(); - LootTable lootTable = serverLevel.getServer().reloadableRegistries().getLootTable(BuiltInLootTables.SNIFFER_DIGGING); - LootParams lootParams = new LootParams.Builder(serverLevel) - .withParameter(LootContextParams.ORIGIN, this.getHeadPosition()) - .withParameter(LootContextParams.THIS_ENTITY, this) - .create(LootContextParamSets.GIFT); - List list = lootTable.getRandomItems(lootParams); + if (this.level() instanceof ServerLevel serverLevel && this.entityData.get(DATA_DROP_SEED_AT_TICK) == this.tickCount) { BlockPos blockPos = this.getHeadBlock(); - - for (ItemStack itemStack : list) { - ItemEntity itemEntity = new ItemEntity(serverLevel, blockPos.getX(), blockPos.getY(), blockPos.getZ(), itemStack); + this.dropFromGiftLootTable(serverLevel, BuiltInLootTables.SNIFFER_DIGGING, (serverLevelx, itemStack) -> { + ItemEntity itemEntity = new ItemEntity(this.level(), blockPos.getX(), blockPos.getY(), blockPos.getZ(), itemStack); itemEntity.setDefaultPickUpDelay(); - serverLevel.addFreshEntity(itemEntity); - } - + serverLevelx.addFreshEntity(itemEntity); + }); this.playSound(SoundEvents.SNIFFER_DROP_SEED, 1.0F, 1.0F); } } private Sniffer emitDiggingParticles(AnimationState animationState) { - boolean bl = animationState.getAccumulatedTime() > 1700L && animationState.getAccumulatedTime() < 6000L; + boolean bl = animationState.getTimeInMillis(this.tickCount) > 1700L && animationState.getTimeInMillis(this.tickCount) < 6000L; if (bl) { BlockPos blockPos = this.getHeadBlock(); BlockState blockState = this.level().getBlockState(blockPos.below()); @@ -303,7 +294,7 @@ public class Sniffer extends Animal { } if (this.tickCount % 10 == 0) { - this.level().gameEvent(GameEvent.ENTITY_ACTION, this.getHeadBlock(), GameEvent.Context.of(this)); + this.level().gameEvent(GameEvent.ENTITY_ACTION, this.getHeadBlock(), Context.of(this)); } return this; @@ -367,12 +358,17 @@ public class Sniffer extends Animal { boolean bl = this.isFood(itemStack); InteractionResult interactionResult = super.mobInteract(player, hand); if (interactionResult.consumesAction() && bl) { - this.level().playSound(null, this, this.getEatingSound(itemStack), SoundSource.NEUTRAL, 1.0F, Mth.randomBetween(this.level().random, 0.8F, 1.2F)); + this.playEatingSound(); } return interactionResult; } + @Override + protected void playEatingSound() { + this.level().playSound(null, this, SoundEvents.SNIFFER_EAT, SoundSource.NEUTRAL, 1.0F, Mth.randomBetween(this.level().random, 0.8F, 1.2F)); + } + private void playSearchingSound() { if (this.level().isClientSide() && this.tickCount % 20 == 0) { this.level().playLocalSound(this.getX(), this.getY(), this.getZ(), SoundEvents.SNIFFER_SEARCHING, this.getSoundSource(), 1.0F, 1.0F, false); @@ -384,11 +380,6 @@ public class Sniffer extends Animal { this.playSound(SoundEvents.SNIFFER_STEP, 0.15F, 1.0F); } - @Override - public SoundEvent getEatingSound(ItemStack stack) { - return SoundEvents.SNIFFER_EAT; - } - @Override protected SoundEvent getAmbientSound() { return Set.of(Sniffer.State.DIGGING, Sniffer.State.SEARCHING).contains(this.getState()) ? null : SoundEvents.SNIFFER_IDLE; @@ -416,7 +407,7 @@ public class Sniffer extends Animal { @Override public AgeableMob getBreedOffspring(ServerLevel level, AgeableMob otherParent) { - return EntityType.SNIFFER.create(level); + return EntityType.SNIFFER.create(level, EntitySpawnReason.BREEDING); } @Override @@ -429,11 +420,6 @@ public class Sniffer extends Animal { } } - @Override - public AABB getBoundingBoxForCulling() { - return super.getBoundingBoxForCulling().inflate(0.6F); - } - @Override public boolean isFood(ItemStack stack) { return stack.is(ItemTags.SNIFFER_FOOD); @@ -450,18 +436,19 @@ public class Sniffer extends Animal { } @Override - protected Brain.Provider brainProvider() { + protected Provider brainProvider() { return Brain.provider(SnifferAi.MEMORY_TYPES, SnifferAi.SENSOR_TYPES); } @Override - protected void customServerAiStep() { - this.level().getProfiler().push("snifferBrain"); - this.getBrain().tick((ServerLevel)this.level(), this); - this.level().getProfiler().popPush("snifferActivityUpdate"); + protected void customServerAiStep(ServerLevel serverLevel) { + ProfilerFiller profilerFiller = Profiler.get(); + profilerFiller.push("snifferBrain"); + this.getBrain().tick(serverLevel, this); + profilerFiller.popPush("snifferActivityUpdate"); SnifferAi.updateActivity(this); - this.level().getProfiler().pop(); - super.customServerAiStep(); + profilerFiller.pop(); + super.customServerAiStep(serverLevel); } @Override @@ -479,7 +466,7 @@ public class Sniffer extends Animal { DIGGING(5), RISING(6); - public static final IntFunction BY_ID = ByIdMap.continuous(Sniffer.State::id, values(), ByIdMap.OutOfBoundsStrategy.ZERO); + public static final IntFunction BY_ID = ByIdMap.continuous(Sniffer.State::id, values(), OutOfBoundsStrategy.ZERO); public static final StreamCodec STREAM_CODEC = ByteBufCodecs.idMapper(BY_ID, Sniffer.State::id); private final int id; diff --git a/net/minecraft/world/entity/boss/EnderDragonPart.java b/net/minecraft/world/entity/boss/EnderDragonPart.java index 656ac0c0..fc5444ff 100644 --- a/net/minecraft/world/entity/boss/EnderDragonPart.java +++ b/net/minecraft/world/entity/boss/EnderDragonPart.java @@ -3,8 +3,9 @@ package net.minecraft.world.entity.boss; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.protocol.Packet; import net.minecraft.network.protocol.game.ClientGamePacketListener; -import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.network.syncher.SynchedEntityData.Builder; import net.minecraft.server.level.ServerEntity; +import net.minecraft.server.level.ServerLevel; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityDimensions; @@ -27,7 +28,7 @@ public class EnderDragonPart extends Entity { } @Override - protected void defineSynchedData(SynchedEntityData.Builder builder) { + protected void defineSynchedData(Builder builder) { } @Override @@ -50,8 +51,8 @@ public class EnderDragonPart extends Entity { } @Override - public boolean hurt(DamageSource source, float amount) { - return this.isInvulnerableTo(source) ? false : this.parentMob.hurt(this, source, amount); + public final boolean hurtServer(ServerLevel serverLevel, DamageSource damageSource, float f) { + return this.isInvulnerableToBase(damageSource) ? false : this.parentMob.hurt(serverLevel, this, damageSource, f); } @Override diff --git a/net/minecraft/world/entity/boss/enderdragon/DragonFlightHistory.java b/net/minecraft/world/entity/boss/enderdragon/DragonFlightHistory.java new file mode 100644 index 00000000..90e0cf0d --- /dev/null +++ b/net/minecraft/world/entity/boss/enderdragon/DragonFlightHistory.java @@ -0,0 +1,46 @@ +package net.minecraft.world.entity.boss.enderdragon; + +import java.util.Arrays; +import net.minecraft.util.Mth; + +public class DragonFlightHistory { + public static final int LENGTH = 64; + private static final int MASK = 63; + private final DragonFlightHistory.Sample[] samples = new DragonFlightHistory.Sample[64]; + private int head = -1; + + public DragonFlightHistory() { + Arrays.fill(this.samples, new DragonFlightHistory.Sample(0.0, 0.0F)); + } + + public void copyFrom(DragonFlightHistory dragonFlightHistory) { + System.arraycopy(dragonFlightHistory.samples, 0, this.samples, 0, 64); + this.head = dragonFlightHistory.head; + } + + public void record(double d, float f) { + DragonFlightHistory.Sample sample = new DragonFlightHistory.Sample(d, f); + if (this.head < 0) { + Arrays.fill(this.samples, sample); + } + + if (++this.head == 64) { + this.head = 0; + } + + this.samples[this.head] = sample; + } + + public DragonFlightHistory.Sample get(int i) { + return this.samples[this.head - i & 63]; + } + + public DragonFlightHistory.Sample get(int i, float f) { + DragonFlightHistory.Sample sample = this.get(i); + DragonFlightHistory.Sample sample2 = this.get(i + 1); + return new DragonFlightHistory.Sample(Mth.lerp((double)f, sample2.y, sample.y), Mth.rotLerp(f, sample2.yRot, sample.yRot)); + } + + public record Sample(double y, float yRot) { + } +} diff --git a/net/minecraft/world/entity/boss/enderdragon/EndCrystal.java b/net/minecraft/world/entity/boss/enderdragon/EndCrystal.java index ad3a7b1e..df8507ec 100644 --- a/net/minecraft/world/entity/boss/enderdragon/EndCrystal.java +++ b/net/minecraft/world/entity/boss/enderdragon/EndCrystal.java @@ -7,6 +7,7 @@ import net.minecraft.nbt.NbtUtils; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.network.syncher.SynchedEntityData.Builder; import net.minecraft.server.level.ServerLevel; import net.minecraft.tags.DamageTypeTags; import net.minecraft.world.damagesource.DamageSource; @@ -43,7 +44,7 @@ public class EndCrystal extends Entity { } @Override - protected void defineSynchedData(SynchedEntityData.Builder builder) { + protected void defineSynchedData(Builder builder) { builder.define(DATA_BEAM_TARGET, Optional.empty()); builder.define(DATA_SHOW_BOTTOM, true); } @@ -51,7 +52,7 @@ public class EndCrystal extends Entity { @Override public void tick() { this.time++; - this.checkInsideBlocks(); + this.applyEffectsFromBlocks(); this.handlePortal(); if (this.level() instanceof ServerLevel) { BlockPos blockPos = this.blockPosition(); @@ -84,20 +85,25 @@ public class EndCrystal extends Entity { } @Override - public boolean hurt(DamageSource source, float amount) { - if (this.isInvulnerableTo(source)) { + public final boolean hurtClient(DamageSource damageSource) { + return this.isInvulnerableToBase(damageSource) ? false : !(damageSource.getEntity() instanceof EnderDragon); + } + + @Override + public final boolean hurtServer(ServerLevel serverLevel, DamageSource damageSource, float f) { + if (this.isInvulnerableToBase(damageSource)) { return false; - } else if (source.getEntity() instanceof EnderDragon) { + } else if (damageSource.getEntity() instanceof EnderDragon) { return false; } else { - if (!this.isRemoved() && !this.level().isClientSide) { + if (!this.isRemoved()) { this.remove(Entity.RemovalReason.KILLED); - if (!source.is(DamageTypeTags.IS_EXPLOSION)) { - DamageSource damageSource = source.getEntity() != null ? this.damageSources().explosion(this, source.getEntity()) : null; - this.level().explode(this, damageSource, null, this.getX(), this.getY(), this.getZ(), 6.0F, false, Level.ExplosionInteraction.BLOCK); + if (!damageSource.is(DamageTypeTags.IS_EXPLOSION)) { + DamageSource damageSource2 = damageSource.getEntity() != null ? this.damageSources().explosion(this, damageSource.getEntity()) : null; + serverLevel.explode(this, damageSource2, null, this.getX(), this.getY(), this.getZ(), 6.0F, false, Level.ExplosionInteraction.BLOCK); } - this.onDestroyedBy(source); + this.onDestroyedBy(serverLevel, damageSource); } return true; @@ -105,17 +111,15 @@ public class EndCrystal extends Entity { } @Override - public void kill() { - this.onDestroyedBy(this.damageSources().generic()); - super.kill(); + public void kill(ServerLevel serverLevel) { + this.onDestroyedBy(serverLevel, this.damageSources().generic()); + super.kill(serverLevel); } - private void onDestroyedBy(DamageSource source) { - if (this.level() instanceof ServerLevel) { - EndDragonFight endDragonFight = ((ServerLevel)this.level()).getDragonFight(); - if (endDragonFight != null) { - endDragonFight.onCrystalDestroyed(this, source); - } + private void onDestroyedBy(ServerLevel serverLevel, DamageSource damageSource) { + EndDragonFight endDragonFight = serverLevel.getDragonFight(); + if (endDragonFight != null) { + endDragonFight.onCrystalDestroyed(this, damageSource); } } diff --git a/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java b/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java index 315bdc25..a579aaf6 100644 --- a/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java +++ b/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java @@ -26,8 +26,8 @@ import net.minecraft.world.entity.ExperienceOrb; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.Mob; import net.minecraft.world.entity.MoverType; -import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.entity.ai.attributes.AttributeSupplier.Builder; import net.minecraft.world.entity.ai.targeting.TargetingConditions; import net.minecraft.world.entity.boss.EnderDragonPart; import net.minecraft.world.entity.boss.enderdragon.phases.DragonPhaseInstance; @@ -60,8 +60,7 @@ public class EnderDragon extends Mob implements Enemy { private static final float SITTING_ALLOWED_DAMAGE_PERCENTAGE = 0.25F; private static final String DRAGON_DEATH_TIME_KEY = "DragonDeathTime"; private static final String DRAGON_PHASE_KEY = "DragonPhase"; - public final double[][] positions = new double[64][3]; - public int posPointer = -1; + public final DragonFlightHistory flightHistory = new DragonFlightHistory(); private final EnderDragonPart[] subEntities; public final EnderDragonPart head; private final EnderDragonPart neck; @@ -101,7 +100,6 @@ public class EnderDragon extends Mob implements Enemy { this.subEntities = new EnderDragonPart[]{this.head, this.neck, this.body, this.tail1, this.tail2, this.tail3, this.wing1, this.wing2}; this.setHealth(this.getMaxHealth()); this.noPhysics = true; - this.noCulling = true; this.phaseManager = new EnderDragonPhaseManager(this); } @@ -117,7 +115,7 @@ public class EnderDragon extends Mob implements Enemy { return this.fightOrigin; } - public static AttributeSupplier.Builder createAttributes() { + public static Builder createAttributes() { return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 200.0); } @@ -139,33 +137,11 @@ public class EnderDragon extends Mob implements Enemy { } @Override - protected void defineSynchedData(SynchedEntityData.Builder builder) { + protected void defineSynchedData(net.minecraft.network.syncher.SynchedEntityData.Builder builder) { super.defineSynchedData(builder); builder.define(DATA_PHASE, EnderDragonPhase.HOVERING.getId()); } - /** - * Returns a double[3] array with movement offsets, used to calculate trailing tail/neck positions. [0] = yaw offset, [1] = y offset, [2] = unused, always 0. Parameters: buffer index offset, partial ticks. - */ - public double[] getLatencyPos(int bufferIndexOffset, float partialTicks) { - if (this.isDeadOrDying()) { - partialTicks = 0.0F; - } - - partialTicks = 1.0F - partialTicks; - int i = this.posPointer - bufferIndexOffset & 63; - int j = this.posPointer - bufferIndexOffset - 1 & 63; - double[] ds = new double[3]; - double d = this.positions[i][0]; - double e = Mth.wrapDegrees(this.positions[j][0] - d); - ds[0] = d + e * partialTicks; - d = this.positions[i][1]; - e = this.positions[j][1] - d; - ds[1] = d + e * partialTicks; - ds[2] = Mth.lerp((double)partialTicks, this.positions[i][2], this.positions[j][2]); - return ds; - } - @Override public void aiStep() { this.processFlappingMovement(); @@ -210,44 +186,25 @@ public class EnderDragon extends Mob implements Enemy { if (this.isNoAi()) { this.flapTime = 0.5F; } else { - if (this.posPointer < 0) { - for (int i = 0; i < this.positions.length; i++) { - this.positions[i][0] = this.getYRot(); - this.positions[i][1] = this.getY(); - } - } - - if (++this.posPointer == this.positions.length) { - this.posPointer = 0; - } - - this.positions[this.posPointer][0] = this.getYRot(); - this.positions[this.posPointer][1] = this.getY(); - if (this.level().isClientSide) { - if (this.lerpSteps > 0) { - this.lerpPositionAndRotationStep(this.lerpSteps, this.lerpX, this.lerpY, this.lerpZ, this.lerpYRot, this.lerpXRot); - this.lerpSteps--; - } - - this.phaseManager.getCurrentPhase().doClientTick(); - } else { + this.flightHistory.record(this.getY(), this.getYRot()); + if (this.level() instanceof ServerLevel serverLevel2) { DragonPhaseInstance dragonPhaseInstance = this.phaseManager.getCurrentPhase(); - dragonPhaseInstance.doServerTick(); + dragonPhaseInstance.doServerTick(serverLevel2); if (this.phaseManager.getCurrentPhase() != dragonPhaseInstance) { dragonPhaseInstance = this.phaseManager.getCurrentPhase(); - dragonPhaseInstance.doServerTick(); + dragonPhaseInstance.doServerTick(serverLevel2); } Vec3 vec32 = dragonPhaseInstance.getFlyTargetLocation(); if (vec32 != null) { double d = vec32.x - this.getX(); double e = vec32.y - this.getY(); - double j = vec32.z - this.getZ(); - double k = d * d + e * e + j * j; - float l = dragonPhaseInstance.getFlySpeed(); - double m = Math.sqrt(d * d + j * j); - if (m > 0.0) { - e = Mth.clamp(e / m, (double)(-l), (double)l); + double i = vec32.z - this.getZ(); + double j = d * d + e * e + i * i; + float k = dragonPhaseInstance.getFlySpeed(); + double l = Math.sqrt(d * d + i * i); + if (l > 0.0) { + e = Mth.clamp(e / l, (double)(-k), (double)k); } this.setDeltaMovement(this.getDeltaMovement().add(0.0, e * 0.01, 0.0)); @@ -257,17 +214,17 @@ public class EnderDragon extends Mob implements Enemy { Mth.sin(this.getYRot() * (float) (Math.PI / 180.0)), this.getDeltaMovement().y, -Mth.cos(this.getYRot() * (float) (Math.PI / 180.0)) ) .normalize(); - float n = Math.max(((float)vec34.dot(vec33) + 0.5F) / 1.5F, 0.0F); - if (Math.abs(d) > 1.0E-5F || Math.abs(j) > 1.0E-5F) { - float o = Mth.clamp(Mth.wrapDegrees(180.0F - (float)Mth.atan2(d, j) * (180.0F / (float)Math.PI) - this.getYRot()), -50.0F, 50.0F); + float m = Math.max(((float)vec34.dot(vec33) + 0.5F) / 1.5F, 0.0F); + if (Math.abs(d) > 1.0E-5F || Math.abs(i) > 1.0E-5F) { + float n = Mth.clamp(Mth.wrapDegrees(180.0F - (float)Mth.atan2(d, i) * (180.0F / (float)Math.PI) - this.getYRot()), -50.0F, 50.0F); this.yRotA *= 0.8F; - this.yRotA = this.yRotA + o * dragonPhaseInstance.getTurnSpeed(); + this.yRotA = this.yRotA + n * dragonPhaseInstance.getTurnSpeed(); this.setYRot(this.getYRot() + this.yRotA * 0.1F); } - float o = (float)(2.0 / (k + 1.0)); - float p = 0.06F; - this.moveRelative(0.06F * (n * o + (1.0F - o)), new Vec3(0.0, 0.0, -1.0)); + float n = (float)(2.0 / (j + 1.0)); + float o = 0.06F; + this.moveRelative(0.06F * (m * n + (1.0F - n)), new Vec3(0.0, 0.0, -1.0)); if (this.inWall) { this.move(MoverType.SELF, this.getDeltaMovement().scale(0.8F)); } else { @@ -275,84 +232,97 @@ public class EnderDragon extends Mob implements Enemy { } Vec3 vec35 = this.getDeltaMovement().normalize(); - double q = 0.8 + 0.15 * (vec35.dot(vec34) + 1.0) / 2.0; - this.setDeltaMovement(this.getDeltaMovement().multiply(q, 0.91F, q)); + double p = 0.8 + 0.15 * (vec35.dot(vec34) + 1.0) / 2.0; + this.setDeltaMovement(this.getDeltaMovement().multiply(p, 0.91F, p)); } + } else { + if (this.lerpSteps > 0) { + this.lerpPositionAndRotationStep(this.lerpSteps, this.lerpX, this.lerpY, this.lerpZ, this.lerpYRot, this.lerpXRot); + this.lerpSteps--; + } + + this.phaseManager.getCurrentPhase().doClientTick(); + } + + if (!this.level().isClientSide()) { + this.applyEffectsFromBlocks(); } this.yBodyRot = this.getYRot(); Vec3[] vec3s = new Vec3[this.subEntities.length]; - for (int r = 0; r < this.subEntities.length; r++) { - vec3s[r] = new Vec3(this.subEntities[r].getX(), this.subEntities[r].getY(), this.subEntities[r].getZ()); + for (int q = 0; q < this.subEntities.length; q++) { + vec3s[q] = new Vec3(this.subEntities[q].getX(), this.subEntities[q].getY(), this.subEntities[q].getZ()); } - float s = (float)(this.getLatencyPos(5, 1.0F)[1] - this.getLatencyPos(10, 1.0F)[1]) * 10.0F * (float) (Math.PI / 180.0); - float t = Mth.cos(s); - float u = Mth.sin(s); - float v = this.getYRot() * (float) (Math.PI / 180.0); - float w = Mth.sin(v); - float x = Mth.cos(v); - this.tickPart(this.body, w * 0.5F, 0.0, -x * 0.5F); - this.tickPart(this.wing1, x * 4.5F, 2.0, w * 4.5F); - this.tickPart(this.wing2, x * -4.5F, 2.0, w * -4.5F); - if (this.level() instanceof ServerLevel serverLevel2 && this.hurtTime == 0) { + float r = (float)(this.flightHistory.get(5).y() - this.flightHistory.get(10).y()) * 10.0F * (float) (Math.PI / 180.0); + float s = Mth.cos(r); + float t = Mth.sin(r); + float u = this.getYRot() * (float) (Math.PI / 180.0); + float v = Mth.sin(u); + float w = Mth.cos(u); + this.tickPart(this.body, v * 0.5F, 0.0, -w * 0.5F); + this.tickPart(this.wing1, w * 4.5F, 2.0, v * 4.5F); + this.tickPart(this.wing2, w * -4.5F, 2.0, v * -4.5F); + if (this.level() instanceof ServerLevel serverLevel3 && this.hurtTime == 0) { this.knockBack( - serverLevel2, - serverLevel2.getEntities(this, this.wing1.getBoundingBox().inflate(4.0, 2.0, 4.0).move(0.0, -2.0, 0.0), EntitySelector.NO_CREATIVE_OR_SPECTATOR) + serverLevel3, + serverLevel3.getEntities(this, this.wing1.getBoundingBox().inflate(4.0, 2.0, 4.0).move(0.0, -2.0, 0.0), EntitySelector.NO_CREATIVE_OR_SPECTATOR) ); this.knockBack( - serverLevel2, - serverLevel2.getEntities(this, this.wing2.getBoundingBox().inflate(4.0, 2.0, 4.0).move(0.0, -2.0, 0.0), EntitySelector.NO_CREATIVE_OR_SPECTATOR) + serverLevel3, + serverLevel3.getEntities(this, this.wing2.getBoundingBox().inflate(4.0, 2.0, 4.0).move(0.0, -2.0, 0.0), EntitySelector.NO_CREATIVE_OR_SPECTATOR) ); - this.hurt(serverLevel2.getEntities(this, this.head.getBoundingBox().inflate(1.0), EntitySelector.NO_CREATIVE_OR_SPECTATOR)); - this.hurt(serverLevel2.getEntities(this, this.neck.getBoundingBox().inflate(1.0), EntitySelector.NO_CREATIVE_OR_SPECTATOR)); + this.hurt(serverLevel3, serverLevel3.getEntities(this, this.head.getBoundingBox().inflate(1.0), EntitySelector.NO_CREATIVE_OR_SPECTATOR)); + this.hurt(serverLevel3, serverLevel3.getEntities(this, this.neck.getBoundingBox().inflate(1.0), EntitySelector.NO_CREATIVE_OR_SPECTATOR)); } - float y = Mth.sin(this.getYRot() * (float) (Math.PI / 180.0) - this.yRotA * 0.01F); - float z = Mth.cos(this.getYRot() * (float) (Math.PI / 180.0) - this.yRotA * 0.01F); - float aa = this.getHeadYOffset(); - this.tickPart(this.head, y * 6.5F * t, aa + u * 6.5F, -z * 6.5F * t); - this.tickPart(this.neck, y * 5.5F * t, aa + u * 5.5F, -z * 5.5F * t); - double[] ds = this.getLatencyPos(5, 1.0F); + float x = Mth.sin(this.getYRot() * (float) (Math.PI / 180.0) - this.yRotA * 0.01F); + float y = Mth.cos(this.getYRot() * (float) (Math.PI / 180.0) - this.yRotA * 0.01F); + float z = this.getHeadYOffset(); + this.tickPart(this.head, x * 6.5F * s, z + t * 6.5F, -y * 6.5F * s); + this.tickPart(this.neck, x * 5.5F * s, z + t * 5.5F, -y * 5.5F * s); + DragonFlightHistory.Sample sample = this.flightHistory.get(5); - for (int ab = 0; ab < 3; ab++) { + for (int aa = 0; aa < 3; aa++) { EnderDragonPart enderDragonPart = null; - if (ab == 0) { + if (aa == 0) { enderDragonPart = this.tail1; } - if (ab == 1) { + if (aa == 1) { enderDragonPart = this.tail2; } - if (ab == 2) { + if (aa == 2) { enderDragonPart = this.tail3; } - double[] es = this.getLatencyPos(12 + ab * 2, 1.0F); - float ac = this.getYRot() * (float) (Math.PI / 180.0) + this.rotWrap(es[0] - ds[0]) * (float) (Math.PI / 180.0); - float nx = Mth.sin(ac); - float o = Mth.cos(ac); - float p = 1.5F; - float ad = (ab + 1) * 2.0F; - this.tickPart(enderDragonPart, -(w * 1.5F + nx * ad) * t, es[1] - ds[1] - (ad + 1.5F) * u + 1.5, (x * 1.5F + o * ad) * t); + DragonFlightHistory.Sample sample2 = this.flightHistory.get(12 + aa * 2); + float ab = this.getYRot() * (float) (Math.PI / 180.0) + this.rotWrap(sample2.yRot() - sample.yRot()) * (float) (Math.PI / 180.0); + float ac = Mth.sin(ab); + float mx = Mth.cos(ab); + float n = 1.5F; + float o = (aa + 1) * 2.0F; + this.tickPart(enderDragonPart, -(v * 1.5F + ac * o) * s, sample2.y() - sample.y() - (o + 1.5F) * t + 1.5, (w * 1.5F + mx * o) * s); } - if (!this.level().isClientSide) { - this.inWall = this.checkWalls(this.head.getBoundingBox()) | this.checkWalls(this.neck.getBoundingBox()) | this.checkWalls(this.body.getBoundingBox()); + if (this.level() instanceof ServerLevel serverLevel4) { + this.inWall = this.checkWalls(serverLevel4, this.head.getBoundingBox()) + | this.checkWalls(serverLevel4, this.neck.getBoundingBox()) + | this.checkWalls(serverLevel4, this.body.getBoundingBox()); if (this.dragonFight != null) { this.dragonFight.updateDragon(this); } } - for (int ab = 0; ab < this.subEntities.length; ab++) { - this.subEntities[ab].xo = vec3s[ab].x; - this.subEntities[ab].yo = vec3s[ab].y; - this.subEntities[ab].zo = vec3s[ab].z; - this.subEntities[ab].xOld = vec3s[ab].x; - this.subEntities[ab].yOld = vec3s[ab].y; - this.subEntities[ab].zOld = vec3s[ab].z; + for (int aa = 0; aa < this.subEntities.length; aa++) { + this.subEntities[aa].xo = vec3s[aa].x; + this.subEntities[aa].yo = vec3s[aa].y; + this.subEntities[aa].zo = vec3s[aa].z; + this.subEntities[aa].xOld = vec3s[aa].x; + this.subEntities[aa].yOld = vec3s[aa].y; + this.subEntities[aa].zOld = vec3s[aa].z; } } } @@ -366,9 +336,9 @@ public class EnderDragon extends Mob implements Enemy { if (this.phaseManager.getCurrentPhase().isSitting()) { return -1.0F; } else { - double[] ds = this.getLatencyPos(5, 1.0F); - double[] es = this.getLatencyPos(0, 1.0F); - return (float)(ds[1] - es[1]); + DragonFlightHistory.Sample sample = this.flightHistory.get(5); + DragonFlightHistory.Sample sample2 = this.flightHistory.get(0); + return (float)(sample.y() - sample2.y()); } } @@ -413,24 +383,19 @@ public class EnderDragon extends Mob implements Enemy { entity.push(f / h * 4.0, 0.2F, g / h * 4.0); if (!this.phaseManager.getCurrentPhase().isSitting() && livingEntity.getLastHurtByMobTimestamp() < entity.tickCount - 2) { DamageSource damageSource = this.damageSources().mobAttack(this); - entity.hurt(damageSource, 5.0F); + entity.hurtServer(level, damageSource, 5.0F); EnchantmentHelper.doPostAttackEffects(level, entity, damageSource); } } } } - /** - * Attacks all entities inside this list, dealing 5 hearts of damage. - */ - private void hurt(List entities) { - for (Entity entity : entities) { + private void hurt(ServerLevel serverLevel, List list) { + for (Entity entity : list) { if (entity instanceof LivingEntity) { DamageSource damageSource = this.damageSources().mobAttack(this); - entity.hurt(damageSource, 10.0F); - if (this.level() instanceof ServerLevel serverLevel) { - EnchantmentHelper.doPostAttackEffects(serverLevel, entity, damageSource); - } + entity.hurtServer(serverLevel, damageSource, 10.0F); + EnchantmentHelper.doPostAttackEffects(serverLevel, entity, damageSource); } } } @@ -442,16 +407,13 @@ public class EnderDragon extends Mob implements Enemy { return (float)Mth.wrapDegrees(angle); } - /** - * Destroys all blocks that aren't associated with 'The End' inside the given bounding box. - */ - private boolean checkWalls(AABB area) { - int i = Mth.floor(area.minX); - int j = Mth.floor(area.minY); - int k = Mth.floor(area.minZ); - int l = Mth.floor(area.maxX); - int m = Mth.floor(area.maxY); - int n = Mth.floor(area.maxZ); + private boolean checkWalls(ServerLevel serverLevel, AABB aABB) { + int i = Mth.floor(aABB.minX); + int j = Mth.floor(aABB.minY); + int k = Mth.floor(aABB.minZ); + int l = Mth.floor(aABB.maxX); + int m = Mth.floor(aABB.maxY); + int n = Mth.floor(aABB.maxZ); boolean bl = false; boolean bl2 = false; @@ -459,10 +421,10 @@ public class EnderDragon extends Mob implements Enemy { for (int p = j; p <= m; p++) { for (int q = k; q <= n; q++) { BlockPos blockPos = new BlockPos(o, p, q); - BlockState blockState = this.level().getBlockState(blockPos); + BlockState blockState = serverLevel.getBlockState(blockPos); if (!blockState.isAir() && !blockState.is(BlockTags.DRAGON_TRANSPARENT)) { - if (this.level().getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) && !blockState.is(BlockTags.DRAGON_IMMUNE)) { - bl2 = this.level().removeBlock(blockPos, false) || bl2; + if (serverLevel.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) && !blockState.is(BlockTags.DRAGON_IMMUNE)) { + bl2 = serverLevel.removeBlock(blockPos, false) || bl2; } else { bl = true; } @@ -473,34 +435,34 @@ public class EnderDragon extends Mob implements Enemy { if (bl2) { BlockPos blockPos2 = new BlockPos(i + this.random.nextInt(l - i + 1), j + this.random.nextInt(m - j + 1), k + this.random.nextInt(n - k + 1)); - this.level().levelEvent(2008, blockPos2, 0); + serverLevel.levelEvent(2008, blockPos2, 0); } return bl; } - public boolean hurt(EnderDragonPart part, DamageSource source, float damage) { + public boolean hurt(ServerLevel serverLevel, EnderDragonPart enderDragonPart, DamageSource damageSource, float f) { if (this.phaseManager.getCurrentPhase().getPhase() == EnderDragonPhase.DYING) { return false; } else { - damage = this.phaseManager.getCurrentPhase().onHurt(source, damage); - if (part != this.head) { - damage = damage / 4.0F + Math.min(damage, 1.0F); + f = this.phaseManager.getCurrentPhase().onHurt(damageSource, f); + if (enderDragonPart != this.head) { + f = f / 4.0F + Math.min(f, 1.0F); } - if (damage < 0.01F) { + if (f < 0.01F) { return false; } else { - if (source.getEntity() instanceof Player || source.is(DamageTypeTags.ALWAYS_HURTS_ENDER_DRAGONS)) { - float f = this.getHealth(); - this.reallyHurt(source, damage); + if (damageSource.getEntity() instanceof Player || damageSource.is(DamageTypeTags.ALWAYS_HURTS_ENDER_DRAGONS)) { + float g = this.getHealth(); + this.reallyHurt(serverLevel, damageSource, f); if (this.isDeadOrDying() && !this.phaseManager.getCurrentPhase().isSitting()) { this.setHealth(1.0F); this.phaseManager.setPhase(EnderDragonPhase.DYING); } if (this.phaseManager.getCurrentPhase().isSitting()) { - this.sittingDamageReceived = this.sittingDamageReceived + f - this.getHealth(); + this.sittingDamageReceived = this.sittingDamageReceived + g - this.getHealth(); if (this.sittingDamageReceived > 0.25F * this.getMaxHealth()) { this.sittingDamageReceived = 0.0F; this.phaseManager.setPhase(EnderDragonPhase.TAKEOFF); @@ -514,19 +476,16 @@ public class EnderDragon extends Mob implements Enemy { } @Override - public boolean hurt(DamageSource source, float amount) { - return !this.level().isClientSide ? this.hurt(this.body, source, amount) : false; + public boolean hurtServer(ServerLevel serverLevel, DamageSource damageSource, float f) { + return this.hurt(serverLevel, this.body, damageSource, f); } - /** - * Provides a way to cause damage to an ender dragon. - */ - protected boolean reallyHurt(DamageSource damageSource, float amount) { - return super.hurt(damageSource, amount); + protected void reallyHurt(ServerLevel serverLevel, DamageSource damageSource, float f) { + super.hurtServer(serverLevel, damageSource, f); } @Override - public void kill() { + public void kill(ServerLevel serverLevel) { this.remove(Entity.RemovalReason.KILLED); this.gameEvent(GameEvent.ENTITY_DIE); if (this.dragonFight != null) { @@ -549,26 +508,25 @@ public class EnderDragon extends Mob implements Enemy { this.level().addParticle(ParticleTypes.EXPLOSION_EMITTER, this.getX() + f, this.getY() + 2.0 + g, this.getZ() + h, 0.0, 0.0, 0.0); } - boolean bl = this.level().getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT); int i = 500; if (this.dragonFight != null && !this.dragonFight.hasPreviouslyKilledDragon()) { i = 12000; } - if (this.level() instanceof ServerLevel) { - if (this.dragonDeathTime > 150 && this.dragonDeathTime % 5 == 0 && bl) { - ExperienceOrb.award((ServerLevel)this.level(), this.position(), Mth.floor(i * 0.08F)); + if (this.level() instanceof ServerLevel serverLevel) { + if (this.dragonDeathTime > 150 && this.dragonDeathTime % 5 == 0 && serverLevel.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) { + ExperienceOrb.award(serverLevel, this.position(), Mth.floor(i * 0.08F)); } if (this.dragonDeathTime == 1 && !this.isSilent()) { - this.level().globalLevelEvent(1028, this.blockPosition(), 0); + serverLevel.globalLevelEvent(1028, this.blockPosition(), 0); } } this.move(MoverType.SELF, new Vec3(0.0, 0.1F, 0.0)); - if (this.dragonDeathTime == 200 && this.level() instanceof ServerLevel) { - if (bl) { - ExperienceOrb.award((ServerLevel)this.level(), this.position(), Mth.floor(i * 0.2F)); + if (this.dragonDeathTime == 200 && this.level() instanceof ServerLevel serverLevel) { + if (serverLevel.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) { + ExperienceOrb.award(serverLevel, this.position(), Mth.floor(i * 0.2F)); } if (this.dragonFight != null) { @@ -603,7 +561,7 @@ public class EnderDragon extends Mob implements Enemy { m = Mth.floor(20.0F * Mth.sin(2.0F * ((float) -Math.PI + (float) (Math.PI / 4) * var7))); } - int n = Math.max(this.level().getSeaLevel() + 10, this.level().getHeightmapPos(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, new BlockPos(l, 0, m)).getY() + j); + int n = Math.max(73, this.level().getHeightmapPos(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, new BlockPos(l, 0, m)).getY() + j); this.nodes[i] = new Node(l, n, m); } @@ -818,25 +776,6 @@ public class EnderDragon extends Mob implements Enemy { return 5.0F; } - public float getHeadPartYOffset(int partIndex, double[] spineEndOffsets, double[] headPartOffsets) { - DragonPhaseInstance dragonPhaseInstance = this.phaseManager.getCurrentPhase(); - EnderDragonPhase enderDragonPhase = dragonPhaseInstance.getPhase(); - double e; - if (enderDragonPhase == EnderDragonPhase.LANDING || enderDragonPhase == EnderDragonPhase.TAKEOFF) { - BlockPos blockPos = this.level().getHeightmapPos(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, EndPodiumFeature.getLocation(this.fightOrigin)); - double d = Math.max(Math.sqrt(blockPos.distToCenterSqr(this.position())) / 4.0, 1.0); - e = partIndex / d; - } else if (dragonPhaseInstance.isSitting()) { - e = partIndex; - } else if (partIndex == 6) { - e = 0.0; - } else { - e = headPartOffsets[1] - spineEndOffsets[1]; - } - - return (float)e; - } - public Vec3 getHeadLookVector(float partialTicks) { DragonPhaseInstance dragonPhaseInstance = this.phaseManager.getCurrentPhase(); EnderDragonPhase enderDragonPhase = dragonPhaseInstance.getPhase(); @@ -863,19 +802,19 @@ public class EnderDragon extends Mob implements Enemy { return vec3; } - public void onCrystalDestroyed(EndCrystal crystal, BlockPos pos, DamageSource damageSource) { + public void onCrystalDestroyed(ServerLevel serverLevel, EndCrystal endCrystal, BlockPos blockPos, DamageSource damageSource) { Player player; if (damageSource.getEntity() instanceof Player) { player = (Player)damageSource.getEntity(); } else { - player = this.level().getNearestPlayer(CRYSTAL_DESTROY_TARGETING, pos.getX(), pos.getY(), pos.getZ()); + player = serverLevel.getNearestPlayer(CRYSTAL_DESTROY_TARGETING, blockPos.getX(), blockPos.getY(), blockPos.getZ()); } - if (crystal == this.nearestCrystal) { - this.hurt(this.head, this.damageSources().explosion(crystal, player), 10.0F); + if (endCrystal == this.nearestCrystal) { + this.hurt(serverLevel, this.head, this.damageSources().explosion(endCrystal, player), 10.0F); } - this.phaseManager.getCurrentPhase().onCrystalDestroyed(crystal, pos, damageSource, player); + this.phaseManager.getCurrentPhase().onCrystalDestroyed(endCrystal, blockPos, damageSource, player); } @Override diff --git a/net/minecraft/world/entity/boss/enderdragon/phases/AbstractDragonPhaseInstance.java b/net/minecraft/world/entity/boss/enderdragon/phases/AbstractDragonPhaseInstance.java index 03257b82..2d0bce60 100644 --- a/net/minecraft/world/entity/boss/enderdragon/phases/AbstractDragonPhaseInstance.java +++ b/net/minecraft/world/entity/boss/enderdragon/phases/AbstractDragonPhaseInstance.java @@ -1,6 +1,7 @@ package net.minecraft.world.entity.boss.enderdragon.phases; import net.minecraft.core.BlockPos; +import net.minecraft.server.level.ServerLevel; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.boss.enderdragon.EndCrystal; import net.minecraft.world.entity.boss.enderdragon.EnderDragon; @@ -25,7 +26,7 @@ public abstract class AbstractDragonPhaseInstance implements DragonPhaseInstance } @Override - public void doServerTick() { + public void doServerTick(ServerLevel serverLevel) { } @Override diff --git a/net/minecraft/world/entity/boss/enderdragon/phases/DragonChargePlayerPhase.java b/net/minecraft/world/entity/boss/enderdragon/phases/DragonChargePlayerPhase.java index 0b2f2e9d..87f6efbb 100644 --- a/net/minecraft/world/entity/boss/enderdragon/phases/DragonChargePlayerPhase.java +++ b/net/minecraft/world/entity/boss/enderdragon/phases/DragonChargePlayerPhase.java @@ -1,6 +1,7 @@ package net.minecraft.world.entity.boss.enderdragon.phases; import com.mojang.logging.LogUtils; +import net.minecraft.server.level.ServerLevel; import net.minecraft.world.entity.boss.enderdragon.EnderDragon; import net.minecraft.world.phys.Vec3; import org.jetbrains.annotations.Nullable; @@ -18,7 +19,7 @@ public class DragonChargePlayerPhase extends AbstractDragonPhaseInstance { } @Override - public void doServerTick() { + public void doServerTick(ServerLevel serverLevel) { if (this.targetLocation == null) { LOGGER.warn("Aborting charge player as no target was set."); this.dragon.getPhaseManager().setPhase(EnderDragonPhase.HOLDING_PATTERN); diff --git a/net/minecraft/world/entity/boss/enderdragon/phases/DragonDeathPhase.java b/net/minecraft/world/entity/boss/enderdragon/phases/DragonDeathPhase.java index cf46061e..0acf1706 100644 --- a/net/minecraft/world/entity/boss/enderdragon/phases/DragonDeathPhase.java +++ b/net/minecraft/world/entity/boss/enderdragon/phases/DragonDeathPhase.java @@ -2,6 +2,7 @@ package net.minecraft.world.entity.boss.enderdragon.phases; import net.minecraft.core.BlockPos; import net.minecraft.core.particles.ParticleTypes; +import net.minecraft.server.level.ServerLevel; import net.minecraft.world.entity.boss.enderdragon.EnderDragon; import net.minecraft.world.level.levelgen.Heightmap; import net.minecraft.world.level.levelgen.feature.EndPodiumFeature; @@ -30,10 +31,10 @@ public class DragonDeathPhase extends AbstractDragonPhaseInstance { } @Override - public void doServerTick() { + public void doServerTick(ServerLevel serverLevel) { this.time++; if (this.targetLocation == null) { - BlockPos blockPos = this.dragon.level().getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, EndPodiumFeature.getLocation(this.dragon.getFightOrigin())); + BlockPos blockPos = serverLevel.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, EndPodiumFeature.getLocation(this.dragon.getFightOrigin())); this.targetLocation = Vec3.atBottomCenterOf(blockPos); } diff --git a/net/minecraft/world/entity/boss/enderdragon/phases/DragonHoldingPatternPhase.java b/net/minecraft/world/entity/boss/enderdragon/phases/DragonHoldingPatternPhase.java index 704ef864..ff6f6d09 100644 --- a/net/minecraft/world/entity/boss/enderdragon/phases/DragonHoldingPatternPhase.java +++ b/net/minecraft/world/entity/boss/enderdragon/phases/DragonHoldingPatternPhase.java @@ -2,6 +2,7 @@ package net.minecraft.world.entity.boss.enderdragon.phases; import net.minecraft.core.BlockPos; import net.minecraft.core.Vec3i; +import net.minecraft.server.level.ServerLevel; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.ai.targeting.TargetingConditions; import net.minecraft.world.entity.boss.enderdragon.EndCrystal; @@ -31,10 +32,10 @@ public class DragonHoldingPatternPhase extends AbstractDragonPhaseInstance { } @Override - public void doServerTick() { + public void doServerTick(ServerLevel serverLevel) { double d = this.targetLocation == null ? 0.0 : this.targetLocation.distanceToSqr(this.dragon.getX(), this.dragon.getY(), this.dragon.getZ()); if (d < 100.0 || d > 22500.0 || this.dragon.horizontalCollision || this.dragon.verticalCollision) { - this.findNewTarget(); + this.findNewTarget(serverLevel); } } @@ -50,18 +51,16 @@ public class DragonHoldingPatternPhase extends AbstractDragonPhaseInstance { return this.targetLocation; } - private void findNewTarget() { + private void findNewTarget(ServerLevel serverLevel) { if (this.currentPath != null && this.currentPath.isDone()) { - BlockPos blockPos = this.dragon - .level() - .getHeightmapPos(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, new BlockPos(EndPodiumFeature.getLocation(this.dragon.getFightOrigin()))); + BlockPos blockPos = serverLevel.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, EndPodiumFeature.getLocation(this.dragon.getFightOrigin())); int i = this.dragon.getDragonFight() == null ? 0 : this.dragon.getDragonFight().getCrystalsAlive(); if (this.dragon.getRandom().nextInt(i + 3) == 0) { this.dragon.getPhaseManager().setPhase(EnderDragonPhase.LANDING_APPROACH); return; } - Player player = this.dragon.level().getNearestPlayer(NEW_TARGET_TARGETING, this.dragon, blockPos.getX(), blockPos.getY(), blockPos.getZ()); + Player player = serverLevel.getNearestPlayer(NEW_TARGET_TARGETING, this.dragon, blockPos.getX(), blockPos.getY(), blockPos.getZ()); double d; if (player != null) { d = blockPos.distToCenterSqr(player.position()) / 512.0; diff --git a/net/minecraft/world/entity/boss/enderdragon/phases/DragonHoverPhase.java b/net/minecraft/world/entity/boss/enderdragon/phases/DragonHoverPhase.java index ead1446b..525f6cf7 100644 --- a/net/minecraft/world/entity/boss/enderdragon/phases/DragonHoverPhase.java +++ b/net/minecraft/world/entity/boss/enderdragon/phases/DragonHoverPhase.java @@ -1,5 +1,6 @@ package net.minecraft.world.entity.boss.enderdragon.phases; +import net.minecraft.server.level.ServerLevel; import net.minecraft.world.entity.boss.enderdragon.EnderDragon; import net.minecraft.world.phys.Vec3; import org.jetbrains.annotations.Nullable; @@ -13,7 +14,7 @@ public class DragonHoverPhase extends AbstractDragonPhaseInstance { } @Override - public void doServerTick() { + public void doServerTick(ServerLevel serverLevel) { if (this.targetLocation == null) { this.targetLocation = this.dragon.position(); } diff --git a/net/minecraft/world/entity/boss/enderdragon/phases/DragonLandingApproachPhase.java b/net/minecraft/world/entity/boss/enderdragon/phases/DragonLandingApproachPhase.java index cfd64c5e..6e8f14b3 100644 --- a/net/minecraft/world/entity/boss/enderdragon/phases/DragonLandingApproachPhase.java +++ b/net/minecraft/world/entity/boss/enderdragon/phases/DragonLandingApproachPhase.java @@ -2,6 +2,7 @@ package net.minecraft.world.entity.boss.enderdragon.phases; import net.minecraft.core.BlockPos; import net.minecraft.core.Vec3i; +import net.minecraft.server.level.ServerLevel; import net.minecraft.world.entity.ai.targeting.TargetingConditions; import net.minecraft.world.entity.boss.enderdragon.EnderDragon; import net.minecraft.world.entity.player.Player; @@ -35,10 +36,10 @@ public class DragonLandingApproachPhase extends AbstractDragonPhaseInstance { } @Override - public void doServerTick() { + public void doServerTick(ServerLevel serverLevel) { double d = this.targetLocation == null ? 0.0 : this.targetLocation.distanceToSqr(this.dragon.getX(), this.dragon.getY(), this.dragon.getZ()); if (d < 100.0 || d > 22500.0 || this.dragon.horizontalCollision || this.dragon.verticalCollision) { - this.findNewTarget(); + this.findNewTarget(serverLevel); } } @@ -48,13 +49,11 @@ public class DragonLandingApproachPhase extends AbstractDragonPhaseInstance { return this.targetLocation; } - private void findNewTarget() { + private void findNewTarget(ServerLevel serverLevel) { if (this.currentPath == null || this.currentPath.isDone()) { int i = this.dragon.findClosestNode(); - BlockPos blockPos = this.dragon - .level() - .getHeightmapPos(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, EndPodiumFeature.getLocation(this.dragon.getFightOrigin())); - Player player = this.dragon.level().getNearestPlayer(NEAR_EGG_TARGETING, this.dragon, blockPos.getX(), blockPos.getY(), blockPos.getZ()); + BlockPos blockPos = serverLevel.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, EndPodiumFeature.getLocation(this.dragon.getFightOrigin())); + Player player = serverLevel.getNearestPlayer(NEAR_EGG_TARGETING, this.dragon, blockPos.getX(), blockPos.getY(), blockPos.getZ()); int j; if (player != null) { Vec3 vec3 = new Vec3(player.getX(), 0.0, player.getZ()).normalize(); diff --git a/net/minecraft/world/entity/boss/enderdragon/phases/DragonLandingPhase.java b/net/minecraft/world/entity/boss/enderdragon/phases/DragonLandingPhase.java index 1d46d592..1ada9384 100644 --- a/net/minecraft/world/entity/boss/enderdragon/phases/DragonLandingPhase.java +++ b/net/minecraft/world/entity/boss/enderdragon/phases/DragonLandingPhase.java @@ -1,6 +1,7 @@ package net.minecraft.world.entity.boss.enderdragon.phases; import net.minecraft.core.particles.ParticleTypes; +import net.minecraft.server.level.ServerLevel; import net.minecraft.util.RandomSource; import net.minecraft.world.entity.boss.enderdragon.EnderDragon; import net.minecraft.world.level.levelgen.Heightmap; @@ -36,10 +37,10 @@ public class DragonLandingPhase extends AbstractDragonPhaseInstance { } @Override - public void doServerTick() { + public void doServerTick(ServerLevel serverLevel) { if (this.targetLocation == null) { this.targetLocation = Vec3.atBottomCenterOf( - this.dragon.level().getHeightmapPos(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, EndPodiumFeature.getLocation(this.dragon.getFightOrigin())) + serverLevel.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, EndPodiumFeature.getLocation(this.dragon.getFightOrigin())) ); } diff --git a/net/minecraft/world/entity/boss/enderdragon/phases/DragonPhaseInstance.java b/net/minecraft/world/entity/boss/enderdragon/phases/DragonPhaseInstance.java index f6189501..a534ef87 100644 --- a/net/minecraft/world/entity/boss/enderdragon/phases/DragonPhaseInstance.java +++ b/net/minecraft/world/entity/boss/enderdragon/phases/DragonPhaseInstance.java @@ -1,6 +1,7 @@ package net.minecraft.world.entity.boss.enderdragon.phases; import net.minecraft.core.BlockPos; +import net.minecraft.server.level.ServerLevel; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.boss.enderdragon.EndCrystal; import net.minecraft.world.entity.player.Player; @@ -16,11 +17,7 @@ public interface DragonPhaseInstance { */ void doClientTick(); - /** - * Gives the phase a chance to update its status. - * Called by dragon's onLivingUpdate. Only used when !worldObj.isRemote. - */ - void doServerTick(); + void doServerTick(ServerLevel serverLevel); void onCrystalDestroyed(EndCrystal crystal, BlockPos pos, DamageSource damageSource, @Nullable Player player); diff --git a/net/minecraft/world/entity/boss/enderdragon/phases/DragonSittingAttackingPhase.java b/net/minecraft/world/entity/boss/enderdragon/phases/DragonSittingAttackingPhase.java index 54ba2548..6141f111 100644 --- a/net/minecraft/world/entity/boss/enderdragon/phases/DragonSittingAttackingPhase.java +++ b/net/minecraft/world/entity/boss/enderdragon/phases/DragonSittingAttackingPhase.java @@ -1,5 +1,6 @@ package net.minecraft.world.entity.boss.enderdragon.phases; +import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundEvents; import net.minecraft.world.entity.boss.enderdragon.EnderDragon; @@ -28,7 +29,7 @@ public class DragonSittingAttackingPhase extends AbstractDragonSittingPhase { } @Override - public void doServerTick() { + public void doServerTick(ServerLevel serverLevel) { if (this.attackingTicks++ >= 40) { this.dragon.getPhaseManager().setPhase(EnderDragonPhase.SITTING_FLAMING); } diff --git a/net/minecraft/world/entity/boss/enderdragon/phases/DragonSittingFlamingPhase.java b/net/minecraft/world/entity/boss/enderdragon/phases/DragonSittingFlamingPhase.java index deb2a588..017cf1df 100644 --- a/net/minecraft/world/entity/boss/enderdragon/phases/DragonSittingFlamingPhase.java +++ b/net/minecraft/world/entity/boss/enderdragon/phases/DragonSittingFlamingPhase.java @@ -2,6 +2,7 @@ package net.minecraft.world.entity.boss.enderdragon.phases; import net.minecraft.core.BlockPos; import net.minecraft.core.particles.ParticleTypes; +import net.minecraft.server.level.ServerLevel; import net.minecraft.util.Mth; import net.minecraft.world.effect.MobEffectInstance; import net.minecraft.world.effect.MobEffects; @@ -48,7 +49,7 @@ public class DragonSittingFlamingPhase extends AbstractDragonSittingPhase { } @Override - public void doServerTick() { + public void doServerTick(ServerLevel serverLevel) { this.flameTicks++; if (this.flameTicks >= 200) { if (this.flameCount >= 4) { @@ -65,7 +66,7 @@ public class DragonSittingFlamingPhase extends AbstractDragonSittingPhase { double h = g; BlockPos.MutableBlockPos mutableBlockPos = new BlockPos.MutableBlockPos(d, g, e); - while (this.dragon.level().isEmptyBlock(mutableBlockPos)) { + while (serverLevel.isEmptyBlock(mutableBlockPos)) { if (--h < 0.0) { h = g; break; @@ -75,13 +76,13 @@ public class DragonSittingFlamingPhase extends AbstractDragonSittingPhase { } h = Mth.floor(h) + 1; - this.flame = new AreaEffectCloud(this.dragon.level(), d, h, e); + this.flame = new AreaEffectCloud(serverLevel, d, h, e); this.flame.setOwner(this.dragon); this.flame.setRadius(5.0F); this.flame.setDuration(200); this.flame.setParticle(ParticleTypes.DRAGON_BREATH); this.flame.addEffect(new MobEffectInstance(MobEffects.HARM)); - this.dragon.level().addFreshEntity(this.flame); + serverLevel.addFreshEntity(this.flame); } } diff --git a/net/minecraft/world/entity/boss/enderdragon/phases/DragonSittingScanningPhase.java b/net/minecraft/world/entity/boss/enderdragon/phases/DragonSittingScanningPhase.java index 2d70a214..eb667489 100644 --- a/net/minecraft/world/entity/boss/enderdragon/phases/DragonSittingScanningPhase.java +++ b/net/minecraft/world/entity/boss/enderdragon/phases/DragonSittingScanningPhase.java @@ -1,5 +1,6 @@ package net.minecraft.world.entity.boss.enderdragon.phases; +import net.minecraft.server.level.ServerLevel; import net.minecraft.util.Mth; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.ai.targeting.TargetingConditions; @@ -17,13 +18,15 @@ public class DragonSittingScanningPhase extends AbstractDragonSittingPhase { public DragonSittingScanningPhase(EnderDragon dragon) { super(dragon); - this.scanTargeting = TargetingConditions.forCombat().range(20.0).selector(livingEntity -> Math.abs(livingEntity.getY() - dragon.getY()) <= 10.0); + this.scanTargeting = TargetingConditions.forCombat() + .range(20.0) + .selector((livingEntity, serverLevel) -> Math.abs(livingEntity.getY() - dragon.getY()) <= 10.0); } @Override - public void doServerTick() { + public void doServerTick(ServerLevel serverLevel) { this.scanningTime++; - LivingEntity livingEntity = this.dragon.level().getNearestPlayer(this.scanTargeting, this.dragon, this.dragon.getX(), this.dragon.getY(), this.dragon.getZ()); + LivingEntity livingEntity = serverLevel.getNearestPlayer(this.scanTargeting, this.dragon, this.dragon.getX(), this.dragon.getY(), this.dragon.getZ()); if (livingEntity != null) { if (this.scanningTime > 25) { this.dragon.getPhaseManager().setPhase(EnderDragonPhase.SITTING_ATTACKING); @@ -49,7 +52,7 @@ public class DragonSittingScanningPhase extends AbstractDragonSittingPhase { } } } else if (this.scanningTime >= 100) { - livingEntity = this.dragon.level().getNearestPlayer(CHARGE_TARGETING, this.dragon, this.dragon.getX(), this.dragon.getY(), this.dragon.getZ()); + livingEntity = serverLevel.getNearestPlayer(CHARGE_TARGETING, this.dragon, this.dragon.getX(), this.dragon.getY(), this.dragon.getZ()); this.dragon.getPhaseManager().setPhase(EnderDragonPhase.TAKEOFF); if (livingEntity != null) { this.dragon.getPhaseManager().setPhase(EnderDragonPhase.CHARGING_PLAYER); diff --git a/net/minecraft/world/entity/boss/enderdragon/phases/DragonStrafePlayerPhase.java b/net/minecraft/world/entity/boss/enderdragon/phases/DragonStrafePlayerPhase.java index 53bb4912..6017c21e 100644 --- a/net/minecraft/world/entity/boss/enderdragon/phases/DragonStrafePlayerPhase.java +++ b/net/minecraft/world/entity/boss/enderdragon/phases/DragonStrafePlayerPhase.java @@ -2,6 +2,7 @@ package net.minecraft.world.entity.boss.enderdragon.phases; import com.mojang.logging.LogUtils; import net.minecraft.core.Vec3i; +import net.minecraft.server.level.ServerLevel; import net.minecraft.util.Mth; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.boss.enderdragon.EnderDragon; @@ -29,7 +30,7 @@ public class DragonStrafePlayerPhase extends AbstractDragonPhaseInstance { } @Override - public void doServerTick() { + public void doServerTick(ServerLevel serverLevel) { if (this.attackTarget == null) { LOGGER.warn("Skipping player strafe phase because no player was found"); this.dragon.getPhaseManager().setPhase(EnderDragonPhase.HOLDING_PATTERN); @@ -70,12 +71,12 @@ public class DragonStrafePlayerPhase extends AbstractDragonPhaseInstance { double q = this.attackTarget.getZ() - n; Vec3 vec34 = new Vec3(o, p, q); if (!this.dragon.isSilent()) { - this.dragon.level().levelEvent(null, 1017, this.dragon.blockPosition(), 0); + serverLevel.levelEvent(null, 1017, this.dragon.blockPosition(), 0); } - DragonFireball dragonFireball = new DragonFireball(this.dragon.level(), this.dragon, vec34.normalize()); + DragonFireball dragonFireball = new DragonFireball(serverLevel, this.dragon, vec34.normalize()); dragonFireball.moveTo(l, m, n, 0.0F, 0.0F); - this.dragon.level().addFreshEntity(dragonFireball); + serverLevel.addFreshEntity(dragonFireball); this.fireballCharge = 0; if (this.currentPath != null) { while (!this.currentPath.isDone()) { diff --git a/net/minecraft/world/entity/boss/enderdragon/phases/DragonTakeoffPhase.java b/net/minecraft/world/entity/boss/enderdragon/phases/DragonTakeoffPhase.java index 72569b7a..0412e0a2 100644 --- a/net/minecraft/world/entity/boss/enderdragon/phases/DragonTakeoffPhase.java +++ b/net/minecraft/world/entity/boss/enderdragon/phases/DragonTakeoffPhase.java @@ -2,6 +2,7 @@ package net.minecraft.world.entity.boss.enderdragon.phases; import net.minecraft.core.BlockPos; import net.minecraft.core.Vec3i; +import net.minecraft.server.level.ServerLevel; import net.minecraft.world.entity.boss.enderdragon.EnderDragon; import net.minecraft.world.level.levelgen.Heightmap; import net.minecraft.world.level.levelgen.feature.EndPodiumFeature; @@ -21,11 +22,9 @@ public class DragonTakeoffPhase extends AbstractDragonPhaseInstance { } @Override - public void doServerTick() { + public void doServerTick(ServerLevel serverLevel) { if (!this.firstTick && this.currentPath != null) { - BlockPos blockPos = this.dragon - .level() - .getHeightmapPos(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, EndPodiumFeature.getLocation(this.dragon.getFightOrigin())); + BlockPos blockPos = serverLevel.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, EndPodiumFeature.getLocation(this.dragon.getFightOrigin())); if (!blockPos.closerToCenterThan(this.dragon.position(), 10.0)) { this.dragon.getPhaseManager().setPhase(EnderDragonPhase.HOLDING_PATTERN); } diff --git a/net/minecraft/world/entity/boss/wither/WitherBoss.java b/net/minecraft/world/entity/boss/wither/WitherBoss.java index 0afe7499..1360203f 100644 --- a/net/minecraft/world/entity/boss/wither/WitherBoss.java +++ b/net/minecraft/world/entity/boss/wither/WitherBoss.java @@ -3,7 +3,6 @@ package net.minecraft.world.entity.boss.wither; import com.google.common.collect.ImmutableList; import java.util.EnumSet; import java.util.List; -import java.util.function.Predicate; import net.minecraft.core.BlockPos; import net.minecraft.core.particles.ColorParticleOption; import net.minecraft.core.particles.ParticleTypes; @@ -12,6 +11,7 @@ import net.minecraft.network.chat.Component; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.network.syncher.SynchedEntityData.Builder; import net.minecraft.server.level.ServerBossEvent; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; @@ -21,16 +21,15 @@ import net.minecraft.tags.BlockTags; import net.minecraft.tags.DamageTypeTags; import net.minecraft.tags.EntityTypeTags; import net.minecraft.util.Mth; -import net.minecraft.world.BossEvent; import net.minecraft.world.Difficulty; +import net.minecraft.world.BossEvent.BossBarColor; +import net.minecraft.world.BossEvent.BossBarOverlay; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.effect.MobEffectInstance; import net.minecraft.world.effect.MobEffects; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.entity.PowerableMob; -import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.entity.ai.control.FlyingMoveControl; import net.minecraft.world.entity.ai.goal.Goal; @@ -57,7 +56,7 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.Vec3; import org.jetbrains.annotations.Nullable; -public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob { +public class WitherBoss extends Monster implements RangedAttackMob { private static final EntityDataAccessor DATA_TARGET_A = SynchedEntityData.defineId(WitherBoss.class, EntityDataSerializers.INT); private static final EntityDataAccessor DATA_TARGET_B = SynchedEntityData.defineId(WitherBoss.class, EntityDataSerializers.INT); private static final EntityDataAccessor DATA_TARGET_C = SynchedEntityData.defineId(WitherBoss.class, EntityDataSerializers.INT); @@ -71,11 +70,10 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob private final int[] nextHeadUpdate = new int[2]; private final int[] idleHeadUpdates = new int[2]; private int destroyBlocksTick; - private final ServerBossEvent bossEvent = (ServerBossEvent)new ServerBossEvent( - this.getDisplayName(), BossEvent.BossBarColor.PURPLE, BossEvent.BossBarOverlay.PROGRESS - ) + private final ServerBossEvent bossEvent = (ServerBossEvent)new ServerBossEvent(this.getDisplayName(), BossBarColor.PURPLE, BossBarOverlay.PROGRESS) .setDarkenScreen(true); - private static final Predicate LIVING_ENTITY_SELECTOR = livingEntity -> !livingEntity.getType().is(EntityTypeTags.WITHER_FRIENDS) + private static final TargetingConditions.Selector LIVING_ENTITY_SELECTOR = (livingEntity, serverLevel) -> !livingEntity.getType() + .is(EntityTypeTags.WITHER_FRIENDS) && livingEntity.attackable(); private static final TargetingConditions TARGETING_CONDITIONS = TargetingConditions.forCombat().range(20.0).selector(LIVING_ENTITY_SELECTOR); @@ -107,7 +105,7 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob } @Override - protected void defineSynchedData(SynchedEntityData.Builder builder) { + protected void defineSynchedData(Builder builder) { super.defineSynchedData(builder); builder.define(DATA_TARGET_A, 0); builder.define(DATA_TARGET_B, 0); @@ -250,14 +248,14 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob } @Override - protected void customServerAiStep() { + protected void customServerAiStep(ServerLevel serverLevel) { if (this.getInvulnerableTicks() > 0) { int i = this.getInvulnerableTicks() - 1; this.bossEvent.setProgress(1.0F - i / 220.0F); if (i <= 0) { - this.level().explode(this, this.getX(), this.getEyeY(), this.getZ(), 7.0F, false, Level.ExplosionInteraction.MOB); + serverLevel.explode(this, this.getX(), this.getEyeY(), this.getZ(), 7.0F, false, Level.ExplosionInteraction.MOB); if (!this.isSilent()) { - this.level().globalLevelEvent(1023, this.blockPosition(), 0); + serverLevel.globalLevelEvent(1023, this.blockPosition(), 0); } } @@ -266,12 +264,12 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob this.heal(10.0F); } } else { - super.customServerAiStep(); + super.customServerAiStep(serverLevel); for (int ix = 1; ix < 3; ix++) { if (this.tickCount >= this.nextHeadUpdate[ix - 1]) { this.nextHeadUpdate[ix - 1] = this.tickCount + 10 + this.random.nextInt(10); - if ((this.level().getDifficulty() == Difficulty.NORMAL || this.level().getDifficulty() == Difficulty.HARD) && this.idleHeadUpdates[ix - 1]++ > 15) { + if ((serverLevel.getDifficulty() == Difficulty.NORMAL || serverLevel.getDifficulty() == Difficulty.HARD) && this.idleHeadUpdates[ix - 1]++ > 15) { float f = 10.0F; float g = 5.0F; double d = Mth.nextDouble(this.random, this.getX() - 10.0, this.getX() + 10.0); @@ -283,7 +281,7 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob int j = this.getAlternativeTarget(ix); if (j > 0) { - LivingEntity livingEntity = (LivingEntity)this.level().getEntity(j); + LivingEntity livingEntity = (LivingEntity)serverLevel.getEntity(j); if (livingEntity != null && this.canAttack(livingEntity) && !(this.distanceToSqr(livingEntity) > 900.0) && this.hasLineOfSight(livingEntity)) { this.performRangedAttack(ix + 1, livingEntity); this.nextHeadUpdate[ix - 1] = this.tickCount + 40 + this.random.nextInt(20); @@ -292,7 +290,7 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob this.setAlternativeTarget(ix, 0); } } else { - List list = this.level().getNearbyEntities(LivingEntity.class, TARGETING_CONDITIONS, this, this.getBoundingBox().inflate(20.0, 8.0, 20.0)); + List list = serverLevel.getNearbyEntities(LivingEntity.class, TARGETING_CONDITIONS, this, this.getBoundingBox().inflate(20.0, 8.0, 20.0)); if (!list.isEmpty()) { LivingEntity livingEntity2 = (LivingEntity)list.get(this.random.nextInt(list.size())); this.setAlternativeTarget(ix, livingEntity2.getId()); @@ -309,7 +307,7 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob if (this.destroyBlocksTick > 0) { this.destroyBlocksTick--; - if (this.destroyBlocksTick == 0 && this.level().getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { + if (this.destroyBlocksTick == 0 && serverLevel.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { boolean bl = false; int j = Mth.floor(this.getBbWidth() / 2.0F + 1.0F); int k = Mth.floor(this.getBbHeight()); @@ -317,14 +315,14 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob for (BlockPos blockPos : BlockPos.betweenClosed( this.getBlockX() - j, this.getBlockY(), this.getBlockZ() - j, this.getBlockX() + j, this.getBlockY() + k, this.getBlockZ() + j )) { - BlockState blockState = this.level().getBlockState(blockPos); + BlockState blockState = serverLevel.getBlockState(blockPos); if (canDestroy(blockState)) { - bl = this.level().destroyBlock(blockPos, true, this) || bl; + bl = serverLevel.destroyBlock(blockPos, true, this) || bl; } } if (bl) { - this.level().levelEvent(null, 1022, this.blockPosition(), 0); + serverLevel.levelEvent(null, 1022, this.blockPosition(), 0); } } } @@ -429,7 +427,7 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob witherSkull.setDangerous(true); } - witherSkull.setPosRaw(d, e, f); + witherSkull.setPos(d, e, f); this.level().addFreshEntity(witherSkull); } @@ -439,22 +437,22 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob } @Override - public boolean hurt(DamageSource source, float amount) { - if (this.isInvulnerableTo(source)) { + public boolean hurtServer(ServerLevel serverLevel, DamageSource damageSource, float f) { + if (this.isInvulnerableTo(serverLevel, damageSource)) { return false; - } else if (source.is(DamageTypeTags.WITHER_IMMUNE_TO) || source.getEntity() instanceof WitherBoss) { + } else if (damageSource.is(DamageTypeTags.WITHER_IMMUNE_TO) || damageSource.getEntity() instanceof WitherBoss) { return false; - } else if (this.getInvulnerableTicks() > 0 && !source.is(DamageTypeTags.BYPASSES_INVULNERABILITY)) { + } else if (this.getInvulnerableTicks() > 0 && !damageSource.is(DamageTypeTags.BYPASSES_INVULNERABILITY)) { return false; } else { if (this.isPowered()) { - Entity entity = source.getDirectEntity(); + Entity entity = damageSource.getDirectEntity(); if (entity instanceof AbstractArrow || entity instanceof WindCharge) { return false; } } - Entity entity = source.getEntity(); + Entity entity = damageSource.getEntity(); if (entity != null && entity.getType().is(EntityTypeTags.WITHER_FRIENDS)) { return false; } else { @@ -466,7 +464,7 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob this.idleHeadUpdates[i] = this.idleHeadUpdates[i] + 3; } - return super.hurt(source, amount); + return super.hurtServer(serverLevel, damageSource, f); } } } @@ -474,7 +472,7 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob @Override protected void dropCustomDeathLoot(ServerLevel level, DamageSource damageSource, boolean recentlyHit) { super.dropCustomDeathLoot(level, damageSource, recentlyHit); - ItemEntity itemEntity = this.spawnAtLocation(Items.NETHER_STAR); + ItemEntity itemEntity = this.spawnAtLocation(level, Items.NETHER_STAR); if (itemEntity != null) { itemEntity.setExtendedLifetime(); } @@ -494,7 +492,7 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob return false; } - public static AttributeSupplier.Builder createAttributes() { + public static net.minecraft.world.entity.ai.attributes.AttributeSupplier.Builder createAttributes() { return Monster.createMonsterAttributes() .add(Attributes.MAX_HEALTH, 300.0) .add(Attributes.MOVEMENT_SPEED, 0.6F) @@ -503,12 +501,12 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob .add(Attributes.ARMOR, 4.0); } - public float getHeadYRot(int head) { - return this.yRotHeads[head]; + public float[] getHeadYRots() { + return this.yRotHeads; } - public float getHeadXRot(int head) { - return this.xRotHeads[head]; + public float[] getHeadXRots() { + return this.xRotHeads; } public int getInvulnerableTicks() { @@ -535,7 +533,6 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob this.entityData.set((EntityDataAccessor)DATA_TARGETS.get(targetOffset), newId); } - @Override public boolean isPowered() { return this.getHealth() <= this.getMaxHealth() / 2.0F; } diff --git a/net/minecraft/world/entity/decoration/ArmorStand.java b/net/minecraft/world/entity/decoration/ArmorStand.java index 5041428d..14821afc 100644 --- a/net/minecraft/world/entity/decoration/ArmorStand.java +++ b/net/minecraft/world/entity/decoration/ArmorStand.java @@ -26,14 +26,16 @@ import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.HumanoidArm; import net.minecraft.world.entity.LightningBolt; import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.Mob; import net.minecraft.world.entity.Pose; -import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.entity.ai.attributes.AttributeSupplier.Builder; import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.vehicle.AbstractMinecart; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.level.Explosion; +import net.minecraft.world.level.GameRules; import net.minecraft.world.level.Level; import net.minecraft.world.level.LightLayer; import net.minecraft.world.level.block.Block; @@ -47,12 +49,12 @@ import org.jetbrains.annotations.Nullable; public class ArmorStand extends LivingEntity { public static final int WOBBLE_TIME = 5; private static final boolean ENABLE_ARMS = true; - private static final Rotations DEFAULT_HEAD_POSE = new Rotations(0.0F, 0.0F, 0.0F); - private static final Rotations DEFAULT_BODY_POSE = new Rotations(0.0F, 0.0F, 0.0F); - private static final Rotations DEFAULT_LEFT_ARM_POSE = new Rotations(-10.0F, 0.0F, -10.0F); - private static final Rotations DEFAULT_RIGHT_ARM_POSE = new Rotations(-15.0F, 0.0F, 10.0F); - private static final Rotations DEFAULT_LEFT_LEG_POSE = new Rotations(-1.0F, 0.0F, -1.0F); - private static final Rotations DEFAULT_RIGHT_LEG_POSE = new Rotations(1.0F, 0.0F, 1.0F); + public static final Rotations DEFAULT_HEAD_POSE = new Rotations(0.0F, 0.0F, 0.0F); + public static final Rotations DEFAULT_BODY_POSE = new Rotations(0.0F, 0.0F, 0.0F); + public static final Rotations DEFAULT_LEFT_ARM_POSE = new Rotations(-10.0F, 0.0F, -10.0F); + public static final Rotations DEFAULT_RIGHT_ARM_POSE = new Rotations(-15.0F, 0.0F, 10.0F); + public static final Rotations DEFAULT_LEFT_LEG_POSE = new Rotations(-1.0F, 0.0F, -1.0F); + public static final Rotations DEFAULT_RIGHT_LEG_POSE = new Rotations(1.0F, 0.0F, 1.0F); private static final EntityDimensions MARKER_DIMENSIONS = EntityDimensions.fixed(0.0F, 0.0F); private static final EntityDimensions BABY_DIMENSIONS = EntityType.ARMOR_STAND.getDimensions().scale(0.5F).withEyeHeight(0.9875F); private static final double FEET_OFFSET = 0.1; @@ -72,8 +74,7 @@ public class ArmorStand extends LivingEntity { public static final EntityDataAccessor DATA_RIGHT_ARM_POSE = SynchedEntityData.defineId(ArmorStand.class, EntityDataSerializers.ROTATIONS); public static final EntityDataAccessor DATA_LEFT_LEG_POSE = SynchedEntityData.defineId(ArmorStand.class, EntityDataSerializers.ROTATIONS); public static final EntityDataAccessor DATA_RIGHT_LEG_POSE = SynchedEntityData.defineId(ArmorStand.class, EntityDataSerializers.ROTATIONS); - private static final Predicate RIDABLE_MINECARTS = entity -> entity instanceof AbstractMinecart - && ((AbstractMinecart)entity).getMinecartType() == AbstractMinecart.Type.RIDEABLE; + private static final Predicate RIDABLE_MINECARTS = entity -> entity instanceof AbstractMinecart abstractMinecart && abstractMinecart.isRideable(); private final NonNullList handItems = NonNullList.withSize(2, ItemStack.EMPTY); private final NonNullList armorItems = NonNullList.withSize(4, ItemStack.EMPTY); private boolean invisible; @@ -98,7 +99,7 @@ public class ArmorStand extends LivingEntity { this.setPos(x, y, z); } - public static AttributeSupplier.Builder createAttributes() { + public static Builder createAttributes() { return createLivingAttributes().add(Attributes.STEP_HEIGHT, 0.0); } @@ -121,7 +122,7 @@ public class ArmorStand extends LivingEntity { } @Override - protected void defineSynchedData(SynchedEntityData.Builder builder) { + protected void defineSynchedData(net.minecraft.network.syncher.SynchedEntityData.Builder builder) { super.defineSynchedData(builder); builder.define(DATA_CLIENT_FLAGS, (byte)0); builder.define(DATA_HEAD_POSE, DEFAULT_HEAD_POSE); @@ -156,7 +157,7 @@ public class ArmorStand extends LivingEntity { @Override public boolean canUseSlot(EquipmentSlot slot) { - return slot != EquipmentSlot.BODY; + return slot != EquipmentSlot.BODY && !this.isDisabled(slot); } @Override @@ -171,12 +172,6 @@ public class ArmorStand extends LivingEntity { } } - @Override - public boolean canTakeItem(ItemStack stack) { - EquipmentSlot equipmentSlot = this.getEquipmentSlotForItem(stack); - return this.getItemBySlot(equipmentSlot).isEmpty() && !this.isDisabled(equipmentSlot); - } - @Override public void addAdditionalSaveData(CompoundTag compound) { super.addAdditionalSaveData(compound); @@ -196,9 +191,9 @@ public class ArmorStand extends LivingEntity { compound.put("HandItems", listTag2); compound.putBoolean("Invisible", this.isInvisible()); compound.putBoolean("Small", this.isSmall()); - compound.putBoolean("ShowArms", this.isShowArms()); + compound.putBoolean("ShowArms", this.showArms()); compound.putInt("DisabledSlots", this.disabledSlots); - compound.putBoolean("NoBasePlate", this.isNoBasePlate()); + compound.putBoolean("NoBasePlate", !this.showBasePlate()); if (this.isMarker()) { compound.putBoolean("Marker", this.isMarker()); } @@ -308,26 +303,26 @@ public class ArmorStand extends LivingEntity { } else if (player.isSpectator()) { return InteractionResult.SUCCESS; } else if (player.level().isClientSide) { - return InteractionResult.CONSUME; + return InteractionResult.SUCCESS_SERVER; } else { EquipmentSlot equipmentSlot = this.getEquipmentSlotForItem(itemStack); if (itemStack.isEmpty()) { EquipmentSlot equipmentSlot2 = this.getClickedSlot(vec); EquipmentSlot equipmentSlot3 = this.isDisabled(equipmentSlot2) ? equipmentSlot : equipmentSlot2; if (this.hasItemInSlot(equipmentSlot3) && this.swapItem(player, equipmentSlot3, itemStack, hand)) { - return InteractionResult.SUCCESS; + return InteractionResult.SUCCESS_SERVER; } } else { if (this.isDisabled(equipmentSlot)) { return InteractionResult.FAIL; } - if (equipmentSlot.getType() == EquipmentSlot.Type.HAND && !this.isShowArms()) { + if (equipmentSlot.getType() == EquipmentSlot.Type.HAND && !this.showArms()) { return InteractionResult.FAIL; } if (this.swapItem(player, equipmentSlot, itemStack, hand)) { - return InteractionResult.SUCCESS; + return InteractionResult.SUCCESS_SERVER; } } @@ -356,14 +351,14 @@ public class ArmorStand extends LivingEntity { } private boolean isDisabled(EquipmentSlot slot) { - return (this.disabledSlots & 1 << slot.getFilterFlag()) != 0 || slot.getType() == EquipmentSlot.Type.HAND && !this.isShowArms(); + return (this.disabledSlots & 1 << slot.getFilterBit(0)) != 0 || slot.getType() == EquipmentSlot.Type.HAND && !this.showArms(); } private boolean swapItem(Player player, EquipmentSlot slot, ItemStack stack, InteractionHand hand) { ItemStack itemStack = this.getItemBySlot(slot); - if (!itemStack.isEmpty() && (this.disabledSlots & 1 << slot.getFilterFlag() + 8) != 0) { + if (!itemStack.isEmpty() && (this.disabledSlots & 1 << slot.getFilterBit(8)) != 0) { return false; - } else if (itemStack.isEmpty() && (this.disabledSlots & 1 << slot.getFilterFlag() + 16) != 0) { + } else if (itemStack.isEmpty() && (this.disabledSlots & 1 << slot.getFilterBit(16)) != 0) { return false; } else if (player.hasInfiniteMaterials() && itemStack.isEmpty() && !stack.isEmpty()) { this.setItemSlot(slot, stack.copyWithCount(1)); @@ -381,59 +376,57 @@ public class ArmorStand extends LivingEntity { } @Override - public boolean hurt(DamageSource source, float amount) { + public boolean hurtServer(ServerLevel serverLevel, DamageSource damageSource, float f) { if (this.isRemoved()) { return false; - } else if (this.level() instanceof ServerLevel serverLevel) { - if (source.is(DamageTypeTags.BYPASSES_INVULNERABILITY)) { - this.kill(); - return false; - } else if (this.isInvulnerableTo(source) || this.invisible || this.isMarker()) { - return false; - } else if (source.is(DamageTypeTags.IS_EXPLOSION)) { - this.brokenByAnything(serverLevel, source); - this.kill(); - return false; - } else if (source.is(DamageTypeTags.IGNITES_ARMOR_STANDS)) { - if (this.isOnFire()) { - this.causeDamage(serverLevel, source, 0.15F); - } else { - this.igniteForSeconds(5.0F); - } - - return false; - } else if (source.is(DamageTypeTags.BURNS_ARMOR_STANDS) && this.getHealth() > 0.5F) { - this.causeDamage(serverLevel, source, 4.0F); - return false; - } else { - boolean bl = source.is(DamageTypeTags.CAN_BREAK_ARMOR_STAND); - boolean bl2 = source.is(DamageTypeTags.ALWAYS_KILLS_ARMOR_STANDS); - if (!bl && !bl2) { - return false; - } else if (source.getEntity() instanceof Player player && !player.getAbilities().mayBuild) { - return false; - } else if (source.isCreativePlayer()) { - this.playBrokenSound(); - this.showBreakingParticles(); - this.kill(); - return true; - } else { - long l = serverLevel.getGameTime(); - if (l - this.lastHit > 5L && !bl2) { - serverLevel.broadcastEntityEvent(this, (byte)32); - this.gameEvent(GameEvent.ENTITY_DAMAGE, source.getEntity()); - this.lastHit = l; - } else { - this.brokenByPlayer(serverLevel, source); - this.showBreakingParticles(); - this.kill(); - } - - return true; - } - } - } else { + } else if (!serverLevel.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) && damageSource.getEntity() instanceof Mob) { return false; + } else if (damageSource.is(DamageTypeTags.BYPASSES_INVULNERABILITY)) { + this.kill(serverLevel); + return false; + } else if (this.isInvulnerableTo(serverLevel, damageSource) || this.invisible || this.isMarker()) { + return false; + } else if (damageSource.is(DamageTypeTags.IS_EXPLOSION)) { + this.brokenByAnything(serverLevel, damageSource); + this.kill(serverLevel); + return false; + } else if (damageSource.is(DamageTypeTags.IGNITES_ARMOR_STANDS)) { + if (this.isOnFire()) { + this.causeDamage(serverLevel, damageSource, 0.15F); + } else { + this.igniteForSeconds(5.0F); + } + + return false; + } else if (damageSource.is(DamageTypeTags.BURNS_ARMOR_STANDS) && this.getHealth() > 0.5F) { + this.causeDamage(serverLevel, damageSource, 4.0F); + return false; + } else { + boolean bl = damageSource.is(DamageTypeTags.CAN_BREAK_ARMOR_STAND); + boolean bl2 = damageSource.is(DamageTypeTags.ALWAYS_KILLS_ARMOR_STANDS); + if (!bl && !bl2) { + return false; + } else if (damageSource.getEntity() instanceof Player player && !player.getAbilities().mayBuild) { + return false; + } else if (damageSource.isCreativePlayer()) { + this.playBrokenSound(); + this.showBreakingParticles(); + this.kill(serverLevel); + return true; + } else { + long l = serverLevel.getGameTime(); + if (l - this.lastHit > 5L && !bl2) { + serverLevel.broadcastEntityEvent(this, (byte)32); + this.gameEvent(GameEvent.ENTITY_DAMAGE, damageSource.getEntity()); + this.lastHit = l; + } else { + this.brokenByPlayer(serverLevel, damageSource); + this.showBreakingParticles(); + this.kill(serverLevel); + } + + return true; + } } } @@ -482,7 +475,7 @@ public class ArmorStand extends LivingEntity { f -= damageAmount; if (f <= 0.5F) { this.brokenByAnything(level, damageSource); - this.kill(); + this.kill(level); } else { this.setHealth(f); this.gameEvent(GameEvent.ENTITY_DAMAGE, damageSource.getEntity()); @@ -598,14 +591,14 @@ public class ArmorStand extends LivingEntity { } @Override - public void kill() { + public void kill(ServerLevel serverLevel) { this.remove(Entity.RemovalReason.KILLED); this.gameEvent(GameEvent.ENTITY_DIE); } @Override public boolean ignoreExplosion(Explosion explosion) { - return this.isInvisible(); + return explosion.shouldAffectBlocklikeEntities() ? this.isInvisible() : true; } @Override @@ -630,7 +623,7 @@ public class ArmorStand extends LivingEntity { this.entityData.set(DATA_CLIENT_FLAGS, this.setBit(this.entityData.get(DATA_CLIENT_FLAGS), 4, showArms)); } - public boolean isShowArms() { + public boolean showArms() { return (this.entityData.get(DATA_CLIENT_FLAGS) & 4) != 0; } @@ -638,8 +631,8 @@ public class ArmorStand extends LivingEntity { this.entityData.set(DATA_CLIENT_FLAGS, this.setBit(this.entityData.get(DATA_CLIENT_FLAGS), 8, noBasePlate)); } - public boolean isNoBasePlate() { - return (this.entityData.get(DATA_CLIENT_FLAGS) & 8) != 0; + public boolean showBasePlate() { + return (this.entityData.get(DATA_CLIENT_FLAGS) & 8) == 0; } /** diff --git a/net/minecraft/world/entity/decoration/BlockAttachedEntity.java b/net/minecraft/world/entity/decoration/BlockAttachedEntity.java index b12627bc..118b7367 100644 --- a/net/minecraft/world/entity/decoration/BlockAttachedEntity.java +++ b/net/minecraft/world/entity/decoration/BlockAttachedEntity.java @@ -8,8 +8,11 @@ import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LightningBolt; +import net.minecraft.world.entity.Mob; import net.minecraft.world.entity.MoverType; import net.minecraft.world.entity.player.Player; +import net.minecraft.world.level.Explosion; +import net.minecraft.world.level.GameRules; import net.minecraft.world.level.Level; import net.minecraft.world.phys.Vec3; import org.jetbrains.annotations.Nullable; @@ -33,13 +36,13 @@ public abstract class BlockAttachedEntity extends Entity { @Override public void tick() { - if (!this.level().isClientSide) { + if (this.level() instanceof ServerLevel serverLevel) { this.checkBelowWorld(); if (this.checkInterval++ == 100) { this.checkInterval = 0; if (!this.isRemoved() && !this.survives()) { this.discard(); - this.dropItem(null); + this.dropItem(serverLevel, null); } } } @@ -55,40 +58,52 @@ public abstract class BlockAttachedEntity extends Entity { @Override public boolean skipAttackInteraction(Entity entity) { if (entity instanceof Player player) { - return !this.level().mayInteract(player, this.pos) ? true : this.hurt(this.damageSources().playerAttack(player), 0.0F); + return !this.level().mayInteract(player, this.pos) ? true : this.hurtOrSimulate(this.damageSources().playerAttack(player), 0.0F); } else { return false; } } @Override - public boolean hurt(DamageSource source, float amount) { - if (this.isInvulnerableTo(source)) { + public boolean hurtClient(DamageSource damageSource) { + return !this.isInvulnerableToBase(damageSource); + } + + @Override + public boolean hurtServer(ServerLevel serverLevel, DamageSource damageSource, float f) { + if (this.isInvulnerableToBase(damageSource)) { + return false; + } else if (!serverLevel.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) && damageSource.getEntity() instanceof Mob) { return false; } else { - if (!this.isRemoved() && !this.level().isClientSide) { - this.kill(); + if (!this.isRemoved()) { + this.kill(serverLevel); this.markHurt(); - this.dropItem(source.getEntity()); + this.dropItem(serverLevel, damageSource.getEntity()); } return true; } } + @Override + public boolean ignoreExplosion(Explosion explosion) { + return explosion.shouldAffectBlocklikeEntities() ? super.ignoreExplosion(explosion) : true; + } + @Override public void move(MoverType type, Vec3 pos) { - if (!this.level().isClientSide && !this.isRemoved() && pos.lengthSqr() > 0.0) { - this.kill(); - this.dropItem(null); + if (this.level() instanceof ServerLevel serverLevel && !this.isRemoved() && pos.lengthSqr() > 0.0) { + this.kill(serverLevel); + this.dropItem(serverLevel, null); } } @Override public void push(double x, double y, double z) { - if (!this.level().isClientSide && !this.isRemoved() && x * x + y * y + z * z > 0.0) { - this.kill(); - this.dropItem(null); + if (this.level() instanceof ServerLevel serverLevel && !this.isRemoved() && x * x + y * y + z * z > 0.0) { + this.kill(serverLevel); + this.dropItem(serverLevel, null); } } @@ -110,7 +125,7 @@ public abstract class BlockAttachedEntity extends Entity { } } - public abstract void dropItem(@Nullable Entity entity); + public abstract void dropItem(ServerLevel serverLevel, @Nullable Entity entity); @Override protected boolean repositionEntityAfterLoad() { diff --git a/net/minecraft/world/entity/decoration/HangingEntity.java b/net/minecraft/world/entity/decoration/HangingEntity.java index c4760746..abd7f833 100644 --- a/net/minecraft/world/entity/decoration/HangingEntity.java +++ b/net/minecraft/world/entity/decoration/HangingEntity.java @@ -4,6 +4,7 @@ import java.util.Objects; import java.util.function.Predicate; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; +import net.minecraft.server.level.ServerLevel; import net.minecraft.util.Mth; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; @@ -83,9 +84,9 @@ public abstract class HangingEntity extends BlockAttachedEntity { public abstract void playPlacementSound(); @Override - public ItemEntity spawnAtLocation(ItemStack stack, float offsetY) { + public ItemEntity spawnAtLocation(ServerLevel serverLevel, ItemStack itemStack, float f) { ItemEntity itemEntity = new ItemEntity( - this.level(), this.getX() + this.direction.getStepX() * 0.15F, this.getY() + offsetY, this.getZ() + this.direction.getStepZ() * 0.15F, stack + this.level(), this.getX() + this.direction.getStepX() * 0.15F, this.getY() + f, this.getZ() + this.direction.getStepZ() * 0.15F, itemStack ); itemEntity.setDefaultPickUpDelay(); this.level().addFreshEntity(itemEntity); diff --git a/net/minecraft/world/entity/decoration/ItemFrame.java b/net/minecraft/world/entity/decoration/ItemFrame.java index ca29ece9..dbf19167 100644 --- a/net/minecraft/world/entity/decoration/ItemFrame.java +++ b/net/minecraft/world/entity/decoration/ItemFrame.java @@ -10,7 +10,9 @@ import net.minecraft.network.protocol.game.ClientboundAddEntityPacket; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.network.syncher.SynchedEntityData.Builder; import net.minecraft.server.level.ServerEntity; +import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; import net.minecraft.tags.DamageTypeTags; @@ -63,7 +65,7 @@ public class ItemFrame extends HangingEntity { } @Override - protected void defineSynchedData(SynchedEntityData.Builder builder) { + protected void defineSynchedData(Builder builder) { builder.define(DATA_ITEM, ItemStack.EMPTY); builder.define(DATA_ROTATION, 0); } @@ -125,27 +127,39 @@ public class ItemFrame extends HangingEntity { } @Override - public void kill() { + public void kill(ServerLevel serverLevel) { this.removeFramedMap(this.getItem()); - super.kill(); + super.kill(serverLevel); + } + + private boolean shouldDamageDropItem(DamageSource damageSource) { + return !damageSource.is(DamageTypeTags.IS_EXPLOSION) && !this.getItem().isEmpty(); + } + + private static boolean canHurtWhenFixed(DamageSource damageSource) { + return damageSource.is(DamageTypeTags.BYPASSES_INVULNERABILITY) || damageSource.isCreativePlayer(); } @Override - public boolean hurt(DamageSource source, float amount) { - if (this.fixed) { - return !source.is(DamageTypeTags.BYPASSES_INVULNERABILITY) && !source.isCreativePlayer() ? false : super.hurt(source, amount); - } else if (this.isInvulnerableTo(source)) { - return false; - } else if (!source.is(DamageTypeTags.IS_EXPLOSION) && !this.getItem().isEmpty()) { - if (!this.level().isClientSide) { - this.dropItem(source.getEntity(), false); - this.gameEvent(GameEvent.BLOCK_CHANGE, source.getEntity()); - this.playSound(this.getRemoveItemSound(), 1.0F, 1.0F); - } + public boolean hurtClient(DamageSource damageSource) { + return this.fixed && !canHurtWhenFixed(damageSource) ? false : !this.isInvulnerableToBase(damageSource); + } - return true; + @Override + public boolean hurtServer(ServerLevel serverLevel, DamageSource damageSource, float f) { + if (!this.fixed) { + if (this.isInvulnerableToBase(damageSource)) { + return false; + } else if (this.shouldDamageDropItem(damageSource)) { + this.dropItem(serverLevel, damageSource.getEntity(), false); + this.gameEvent(GameEvent.BLOCK_CHANGE, damageSource.getEntity()); + this.playSound(this.getRemoveItemSound(), 1.0F, 1.0F); + return true; + } else { + return super.hurtServer(serverLevel, damageSource, f); + } } else { - return super.hurt(source, amount); + return canHurtWhenFixed(damageSource) && super.hurtServer(serverLevel, damageSource, f); } } @@ -161,9 +175,9 @@ public class ItemFrame extends HangingEntity { } @Override - public void dropItem(@Nullable Entity entity) { + public void dropItem(ServerLevel serverLevel, @Nullable Entity entity) { this.playSound(this.getBreakSound(), 1.0F, 1.0F); - this.dropItem(entity, true); + this.dropItem(serverLevel, entity, true); this.gameEvent(GameEvent.BLOCK_CHANGE, entity); } @@ -180,26 +194,26 @@ public class ItemFrame extends HangingEntity { return SoundEvents.ITEM_FRAME_PLACE; } - private void dropItem(@Nullable Entity entity, boolean dropSelf) { + private void dropItem(ServerLevel serverLevel, @Nullable Entity entity, boolean bl) { if (!this.fixed) { ItemStack itemStack = this.getItem(); this.setItem(ItemStack.EMPTY); - if (!this.level().getGameRules().getBoolean(GameRules.RULE_DOENTITYDROPS)) { + if (!serverLevel.getGameRules().getBoolean(GameRules.RULE_DOENTITYDROPS)) { if (entity == null) { this.removeFramedMap(itemStack); } } else if (entity instanceof Player player && player.hasInfiniteMaterials()) { this.removeFramedMap(itemStack); } else { - if (dropSelf) { - this.spawnAtLocation(this.getFrameItemStack()); + if (bl) { + this.spawnAtLocation(serverLevel, this.getFrameItemStack()); } if (!itemStack.isEmpty()) { itemStack = itemStack.copy(); this.removeFramedMap(itemStack); if (this.random.nextFloat() < this.dropChance) { - this.spawnAtLocation(itemStack); + this.spawnAtLocation(serverLevel, itemStack); } } } @@ -215,7 +229,6 @@ public class ItemFrame extends HangingEntity { MapItemSavedData mapItemSavedData = MapItem.getSavedData(mapId, this.level()); if (mapItemSavedData != null) { mapItemSavedData.removedFromFrame(this.pos, this.getId()); - mapItemSavedData.setDirty(true); } } @@ -347,29 +360,29 @@ public class ItemFrame extends HangingEntity { boolean bl2 = !itemStack.isEmpty(); if (this.fixed) { return InteractionResult.PASS; - } else if (!this.level().isClientSide) { + } else if (!player.level().isClientSide) { if (!bl) { if (bl2 && !this.isRemoved()) { - if (itemStack.is(Items.FILLED_MAP)) { - MapItemSavedData mapItemSavedData = MapItem.getSavedData(itemStack, this.level()); - if (mapItemSavedData != null && mapItemSavedData.isTrackedCountOverLimit(256)) { - return InteractionResult.FAIL; - } + MapItemSavedData mapItemSavedData = MapItem.getSavedData(itemStack, this.level()); + if (mapItemSavedData != null && mapItemSavedData.isTrackedCountOverLimit(256)) { + return InteractionResult.FAIL; + } else { + this.setItem(itemStack); + this.gameEvent(GameEvent.BLOCK_CHANGE, player); + itemStack.consume(1, player); + return InteractionResult.SUCCESS; } - - this.setItem(itemStack); - this.gameEvent(GameEvent.BLOCK_CHANGE, player); - itemStack.consume(1, player); + } else { + return InteractionResult.PASS; } } else { this.playSound(this.getRotateItemSound(), 1.0F, 1.0F); this.setRotation(this.getRotation() + 1); this.gameEvent(GameEvent.BLOCK_CHANGE, player); + return InteractionResult.SUCCESS; } - - return InteractionResult.CONSUME; } else { - return !bl && !bl2 ? InteractionResult.PASS : InteractionResult.SUCCESS; + return (InteractionResult)(!bl && !bl2 ? InteractionResult.PASS : InteractionResult.SUCCESS); } } diff --git a/net/minecraft/world/entity/decoration/LeashFenceKnotEntity.java b/net/minecraft/world/entity/decoration/LeashFenceKnotEntity.java index 13f8dbd4..45784cbb 100644 --- a/net/minecraft/world/entity/decoration/LeashFenceKnotEntity.java +++ b/net/minecraft/world/entity/decoration/LeashFenceKnotEntity.java @@ -6,8 +6,9 @@ import net.minecraft.nbt.CompoundTag; import net.minecraft.network.protocol.Packet; import net.minecraft.network.protocol.game.ClientGamePacketListener; import net.minecraft.network.protocol.game.ClientboundAddEntityPacket; -import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.network.syncher.SynchedEntityData.Builder; import net.minecraft.server.level.ServerEntity; +import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundEvents; import net.minecraft.tags.BlockTags; import net.minecraft.world.InteractionHand; @@ -38,7 +39,7 @@ public class LeashFenceKnotEntity extends BlockAttachedEntity { } @Override - protected void defineSynchedData(SynchedEntityData.Builder builder) { + protected void defineSynchedData(Builder builder) { } @Override @@ -55,7 +56,7 @@ public class LeashFenceKnotEntity extends BlockAttachedEntity { } @Override - public void dropItem(@Nullable Entity entity) { + public void dropItem(ServerLevel serverLevel, @Nullable Entity entity) { this.playSound(SoundEvents.LEASH_KNOT_BREAK, 1.0F, 1.0F); } @@ -102,7 +103,7 @@ public class LeashFenceKnotEntity extends BlockAttachedEntity { this.gameEvent(GameEvent.BLOCK_ATTACH, player); } - return InteractionResult.CONSUME; + return InteractionResult.SUCCESS; } } diff --git a/net/minecraft/world/entity/decoration/Painting.java b/net/minecraft/world/entity/decoration/Painting.java index c23a3db7..24eda521 100644 --- a/net/minecraft/world/entity/decoration/Painting.java +++ b/net/minecraft/world/entity/decoration/Painting.java @@ -18,7 +18,9 @@ import net.minecraft.network.protocol.game.ClientboundAddEntityPacket; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.network.syncher.SynchedEntityData.Builder; import net.minecraft.server.level.ServerEntity; +import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundEvents; import net.minecraft.tags.PaintingVariantTags; import net.minecraft.world.entity.Entity; @@ -46,8 +48,8 @@ public class Painting extends HangingEntity implements VariantHolder)this.registryAccess().registryOrThrow(Registries.PAINTING_VARIANT).getAny().orElseThrow()); + protected void defineSynchedData(Builder builder) { + builder.define(DATA_PAINTING_VARIANT_ID, (Holder)this.registryAccess().lookupOrThrow(Registries.PAINTING_VARIANT).getAny().orElseThrow()); } @Override @@ -68,7 +70,7 @@ public class Painting extends HangingEntity implements VariantHolder create(Level level, BlockPos pos, Direction direction) { Painting painting = new Painting(level, pos); List> list = new ArrayList(); - level.registryAccess().registryOrThrow(Registries.PAINTING_VARIANT).getTagOrEmpty(PaintingVariantTags.PLACEABLE).forEach(list::add); + level.registryAccess().lookupOrThrow(Registries.PAINTING_VARIANT).getTagOrEmpty(PaintingVariantTags.PLACEABLE).forEach(list::add); if (list.isEmpty()) { return Optional.empty(); } else { @@ -145,11 +147,11 @@ public class Painting extends HangingEntity implements VariantHolder title, Optional author) { public static final Codec DIRECT_CODEC = RecordCodecBuilder.create( instance -> instance.group( ExtraCodecs.intRange(1, 16).fieldOf("width").forGetter(PaintingVariant::width), ExtraCodecs.intRange(1, 16).fieldOf("height").forGetter(PaintingVariant::height), - ResourceLocation.CODEC.fieldOf("asset_id").forGetter(PaintingVariant::assetId) + ResourceLocation.CODEC.fieldOf("asset_id").forGetter(PaintingVariant::assetId), + ComponentSerialization.CODEC.optionalFieldOf("title").forGetter(PaintingVariant::title), + ComponentSerialization.CODEC.optionalFieldOf("author").forGetter(PaintingVariant::author) ) .apply(instance, PaintingVariant::new) ); - public static final StreamCodec DIRECT_STREAM_CODEC = StreamCodec.composite( + public static final StreamCodec DIRECT_STREAM_CODEC = StreamCodec.composite( ByteBufCodecs.VAR_INT, PaintingVariant::width, ByteBufCodecs.VAR_INT, PaintingVariant::height, ResourceLocation.STREAM_CODEC, PaintingVariant::assetId, + ComponentSerialization.TRUSTED_OPTIONAL_STREAM_CODEC, + PaintingVariant::title, + ComponentSerialization.TRUSTED_OPTIONAL_STREAM_CODEC, + PaintingVariant::author, PaintingVariant::new ); public static final Codec> CODEC = RegistryFileCodec.create(Registries.PAINTING_VARIANT, DIRECT_CODEC); diff --git a/net/minecraft/world/entity/decoration/PaintingVariants.java b/net/minecraft/world/entity/decoration/PaintingVariants.java index cf09aecb..b7a7d59a 100644 --- a/net/minecraft/world/entity/decoration/PaintingVariants.java +++ b/net/minecraft/world/entity/decoration/PaintingVariants.java @@ -1,7 +1,10 @@ package net.minecraft.world.entity.decoration; +import java.util.Optional; +import net.minecraft.ChatFormatting; import net.minecraft.core.registries.Registries; import net.minecraft.data.worldgen.BootstrapContext; +import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; @@ -77,16 +80,16 @@ public class PaintingVariants { register(context, STAGE, 2, 2); register(context, VOID, 2, 2); register(context, SKULL_AND_ROSES, 2, 2); - register(context, WITHER, 2, 2); + register(context, WITHER, 2, 2, false); register(context, FIGHTERS, 4, 2); register(context, POINTER, 4, 4); register(context, PIGSCENE, 4, 4); register(context, BURNING_SKULL, 4, 4); register(context, SKELETON, 4, 3); - register(context, EARTH, 2, 2); - register(context, WIND, 2, 2); - register(context, WATER, 2, 2); - register(context, FIRE, 2, 2); + register(context, EARTH, 2, 2, false); + register(context, WIND, 2, 2, false); + register(context, WATER, 2, 2, false); + register(context, FIRE, 2, 2, false); register(context, DONKEY_KONG, 4, 3); register(context, BAROQUE, 2, 2); register(context, HUMBLE, 2, 2); @@ -111,7 +114,20 @@ public class PaintingVariants { } private static void register(BootstrapContext context, ResourceKey key, int width, int height) { - context.register(key, new PaintingVariant(width, height, key.location())); + register(context, key, width, height, true); + } + + private static void register(BootstrapContext bootstrapContext, ResourceKey resourceKey, int i, int j, boolean bl) { + bootstrapContext.register( + resourceKey, + new PaintingVariant( + i, + j, + resourceKey.location(), + Optional.of(Component.translatable(resourceKey.location().toLanguageKey("painting", "title")).withStyle(ChatFormatting.YELLOW)), + bl ? Optional.of(Component.translatable(resourceKey.location().toLanguageKey("painting", "author")).withStyle(ChatFormatting.GRAY)) : Optional.empty() + ) + ); } private static ResourceKey create(String name) { diff --git a/net/minecraft/world/entity/item/FallingBlockEntity.java b/net/minecraft/world/entity/item/FallingBlockEntity.java index a7e36021..79685d05 100644 --- a/net/minecraft/world/entity/item/FallingBlockEntity.java +++ b/net/minecraft/world/entity/item/FallingBlockEntity.java @@ -16,6 +16,7 @@ import net.minecraft.network.protocol.game.ClientboundBlockUpdatePacket; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.network.syncher.SynchedEntityData.Builder; import net.minecraft.resources.ResourceKey; import net.minecraft.server.level.ServerEntity; import net.minecraft.server.level.ServerLevel; @@ -32,6 +33,7 @@ import net.minecraft.world.item.context.DirectionalPlaceContext; import net.minecraft.world.level.ClipContext; import net.minecraft.world.level.GameRules; import net.minecraft.world.level.Level; +import net.minecraft.world.level.ClipContext.Fluid; import net.minecraft.world.level.block.AnvilBlock; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; @@ -42,10 +44,10 @@ import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.material.Fluids; -import net.minecraft.world.level.portal.DimensionTransition; +import net.minecraft.world.level.portal.TeleportTransition; import net.minecraft.world.phys.BlockHitResult; -import net.minecraft.world.phys.HitResult; import net.minecraft.world.phys.Vec3; +import net.minecraft.world.phys.HitResult.Type; import org.jetbrains.annotations.Nullable; import org.slf4j.Logger; @@ -97,6 +99,15 @@ public class FallingBlockEntity extends Entity { return false; } + @Override + public final boolean hurtServer(ServerLevel serverLevel, DamageSource damageSource, float f) { + if (!this.isInvulnerableToBase(damageSource)) { + this.markHurt(); + } + + return false; + } + public void setStartPos(BlockPos startPos) { this.entityData.set(DATA_START_POS, startPos); } @@ -111,7 +122,7 @@ public class FallingBlockEntity extends Entity { } @Override - protected void defineSynchedData(SynchedEntityData.Builder builder) { + protected void defineSynchedData(Builder builder) { builder.define(DATA_START_POS, BlockPos.ZERO); } @@ -134,22 +145,33 @@ public class FallingBlockEntity extends Entity { this.time++; this.applyGravity(); this.move(MoverType.SELF, this.getDeltaMovement()); + this.applyEffectsFromBlocks(); this.handlePortal(); - if (!this.level().isClientSide && (this.isAlive() || this.forceTickAfterTeleportToDuplicate)) { + if (this.level() instanceof ServerLevel serverLevel && (this.isAlive() || this.forceTickAfterTeleportToDuplicate)) { BlockPos blockPos = this.blockPosition(); boolean bl = this.blockState.getBlock() instanceof ConcretePowderBlock; boolean bl2 = bl && this.level().getFluidState(blockPos).is(FluidTags.WATER); double d = this.getDeltaMovement().lengthSqr(); if (bl && d > 1.0) { BlockHitResult blockHitResult = this.level() - .clip(new ClipContext(new Vec3(this.xo, this.yo, this.zo), this.position(), ClipContext.Block.COLLIDER, ClipContext.Fluid.SOURCE_ONLY, this)); - if (blockHitResult.getType() != HitResult.Type.MISS && this.level().getFluidState(blockHitResult.getBlockPos()).is(FluidTags.WATER)) { + .clip( + new ClipContext(new Vec3(this.xo, this.yo, this.zo), this.position(), net.minecraft.world.level.ClipContext.Block.COLLIDER, Fluid.SOURCE_ONLY, this) + ); + if (blockHitResult.getType() != Type.MISS && this.level().getFluidState(blockHitResult.getBlockPos()).is(FluidTags.WATER)) { blockPos = blockHitResult.getBlockPos(); bl2 = true; } } - if (this.onGround() || bl2) { + if (!this.onGround() && !bl2) { + if (this.time > 100 && (blockPos.getY() <= this.level().getMinY() || blockPos.getY() > this.level().getMaxY()) || this.time > 600) { + if (this.dropItem && serverLevel.getGameRules().getBoolean(GameRules.RULE_DOENTITYDROPS)) { + this.spawnAtLocation(serverLevel, block); + } + + this.discard(); + } + } else { BlockState blockState = this.level().getBlockState(blockPos); this.setDeltaMovement(this.getDeltaMovement().multiply(0.7, -0.5, 0.7)); if (!blockState.is(Blocks.MOVING_PISTON)) { @@ -183,23 +205,23 @@ public class FallingBlockEntity extends Entity { try { blockEntity.loadWithComponents(compoundTag, this.level().registryAccess()); - } catch (Exception var15) { - LOGGER.error("Failed to load block entity from falling block", (Throwable)var15); + } catch (Exception var16) { + LOGGER.error("Failed to load block entity from falling block", (Throwable)var16); } blockEntity.setChanged(); } } - } else if (this.dropItem && this.level().getGameRules().getBoolean(GameRules.RULE_DOENTITYDROPS)) { + } else if (this.dropItem && serverLevel.getGameRules().getBoolean(GameRules.RULE_DOENTITYDROPS)) { this.discard(); this.callOnBrokenAfterFall(block, blockPos); - this.spawnAtLocation(block); + this.spawnAtLocation(serverLevel, block); } } else { this.discard(); - if (this.dropItem && this.level().getGameRules().getBoolean(GameRules.RULE_DOENTITYDROPS)) { + if (this.dropItem && serverLevel.getGameRules().getBoolean(GameRules.RULE_DOENTITYDROPS)) { this.callOnBrokenAfterFall(block, blockPos); - this.spawnAtLocation(block); + this.spawnAtLocation(serverLevel, block); } } } else { @@ -207,13 +229,6 @@ public class FallingBlockEntity extends Entity { this.callOnBrokenAfterFall(block, blockPos); } } - } else if (!this.level().isClientSide - && (this.time > 100 && (blockPos.getY() <= this.level().getMinBuildHeight() || blockPos.getY() > this.level().getMaxBuildHeight()) || this.time > 600)) { - if (this.dropItem && this.level().getGameRules().getBoolean(GameRules.RULE_DOENTITYDROPS)) { - this.spawnAtLocation(block); - } - - this.discard(); } } @@ -352,11 +367,11 @@ public class FallingBlockEntity extends Entity { @Nullable @Override - public Entity changeDimension(DimensionTransition transition) { - ResourceKey resourceKey = transition.newLevel().dimension(); + public Entity teleport(TeleportTransition teleportTransition) { + ResourceKey resourceKey = teleportTransition.newLevel().dimension(); ResourceKey resourceKey2 = this.level().dimension(); boolean bl = (resourceKey2 == Level.END || resourceKey == Level.END) && resourceKey2 != resourceKey; - Entity entity = super.changeDimension(transition); + Entity entity = super.teleport(teleportTransition); this.forceTickAfterTeleportToDuplicate = entity != null && bl; return entity; } diff --git a/net/minecraft/world/entity/item/ItemEntity.java b/net/minecraft/world/entity/item/ItemEntity.java index 427bf00c..4b7c2ecc 100644 --- a/net/minecraft/world/entity/item/ItemEntity.java +++ b/net/minecraft/world/entity/item/ItemEntity.java @@ -3,32 +3,33 @@ package net.minecraft.world.entity.item; import java.util.Objects; import java.util.UUID; import net.minecraft.core.BlockPos; -import net.minecraft.core.component.DataComponents; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.chat.Component; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.network.syncher.SynchedEntityData.Builder; import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundSource; import net.minecraft.stats.Stats; -import net.minecraft.tags.DamageTypeTags; import net.minecraft.tags.FluidTags; import net.minecraft.tags.ItemTags; import net.minecraft.util.Mth; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.Mob; import net.minecraft.world.entity.MoverType; import net.minecraft.world.entity.SlotAccess; import net.minecraft.world.entity.TraceableEntity; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.Items; +import net.minecraft.world.level.Explosion; +import net.minecraft.world.level.GameRules; import net.minecraft.world.level.Level; import net.minecraft.world.level.gameevent.GameEvent; -import net.minecraft.world.level.portal.DimensionTransition; +import net.minecraft.world.level.portal.TeleportTransition; import net.minecraft.world.phys.Vec3; import org.jetbrains.annotations.Nullable; @@ -107,7 +108,7 @@ public class ItemEntity extends Entity implements TraceableEntity { } @Override - protected void defineSynchedData(SynchedEntityData.Builder builder) { + protected void defineSynchedData(Builder builder) { builder.define(DATA_ITEM, ItemStack.EMPTY); } @@ -149,6 +150,7 @@ public class ItemEntity extends Entity implements TraceableEntity { if (!this.onGround() || this.getDeltaMovement().horizontalDistanceSqr() > 1.0E-5F || (this.tickCount + this.getId()) % 4 == 0) { this.move(MoverType.SELF, this.getDeltaMovement()); + this.applyEffectsFromBlocks(); float f = 0.98F; if (this.onGround()) { f = this.level().getBlockState(this.getBlockPosBelowThatAffectsMyMovement()).getBlock().getFriction() * 0.98F; @@ -193,13 +195,16 @@ public class ItemEntity extends Entity implements TraceableEntity { } private void setUnderwaterMovement() { - Vec3 vec3 = this.getDeltaMovement(); - this.setDeltaMovement(vec3.x * 0.99F, vec3.y + (vec3.y < 0.06F ? 5.0E-4F : 0.0F), vec3.z * 0.99F); + this.setFluidMovement(0.99F); } private void setUnderLavaMovement() { + this.setFluidMovement(0.95F); + } + + private void setFluidMovement(double d) { Vec3 vec3 = this.getDeltaMovement(); - this.setDeltaMovement(vec3.x * 0.95F, vec3.y + (vec3.y < 0.06F ? 5.0E-4F : 0.0F), vec3.z * 0.95F); + this.setDeltaMovement(vec3.x * d, vec3.y + (vec3.y < 0.06F ? 5.0E-4F : 0.0F), vec3.z * d); } /** @@ -265,23 +270,31 @@ public class ItemEntity extends Entity implements TraceableEntity { @Override public boolean fireImmune() { - return this.getItem().has(DataComponents.FIRE_RESISTANT) || super.fireImmune(); + return !this.getItem().canBeHurtBy(this.damageSources().inFire()) || super.fireImmune(); } @Override - public boolean hurt(DamageSource source, float amount) { - if (this.isInvulnerableTo(source)) { + protected boolean shouldPlayLavaHurtSound() { + return this.health <= 0 ? true : this.tickCount % 10 == 0; + } + + @Override + public final boolean hurtClient(DamageSource damageSource) { + return this.isInvulnerableToBase(damageSource) ? false : this.getItem().canBeHurtBy(damageSource); + } + + @Override + public final boolean hurtServer(ServerLevel serverLevel, DamageSource damageSource, float f) { + if (this.isInvulnerableToBase(damageSource)) { return false; - } else if (!this.getItem().isEmpty() && this.getItem().is(Items.NETHER_STAR) && source.is(DamageTypeTags.IS_EXPLOSION)) { + } else if (!serverLevel.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) && damageSource.getEntity() instanceof Mob) { return false; - } else if (!this.getItem().canBeHurtBy(source)) { + } else if (!this.getItem().canBeHurtBy(damageSource)) { return false; - } else if (this.level().isClientSide) { - return true; } else { this.markHurt(); - this.health = (int)(this.health - amount); - this.gameEvent(GameEvent.ENTITY_DAMAGE, source.getEntity()); + this.health = (int)(this.health - f); + this.gameEvent(GameEvent.ENTITY_DAMAGE, damageSource.getEntity()); if (this.health <= 0) { this.getItem().onDestroyed(this); this.discard(); @@ -291,6 +304,11 @@ public class ItemEntity extends Entity implements TraceableEntity { } } + @Override + public boolean ignoreExplosion(Explosion explosion) { + return explosion.shouldAffectBlocklikeEntities() ? super.ignoreExplosion(explosion) : true; + } + @Override public void addAdditionalSaveData(CompoundTag compound) { compound.putShort("Health", (short)this.health); @@ -360,7 +378,7 @@ public class ItemEntity extends Entity implements TraceableEntity { @Override public Component getName() { Component component = this.getCustomName(); - return (Component)(component != null ? component : Component.translatable(this.getItem().getDescriptionId())); + return component != null ? component : this.getItem().getItemName(); } @Override @@ -370,8 +388,8 @@ public class ItemEntity extends Entity implements TraceableEntity { @Nullable @Override - public Entity changeDimension(DimensionTransition transition) { - Entity entity = super.changeDimension(transition); + public Entity teleport(TeleportTransition teleportTransition) { + Entity entity = super.teleport(teleportTransition); if (!this.level().isClientSide && entity instanceof ItemEntity itemEntity) { itemEntity.mergeWithNeighbours(); } @@ -447,8 +465,8 @@ public class ItemEntity extends Entity implements TraceableEntity { this.age = 5999; } - public float getSpin(float partialTicks) { - return (this.getAge() + partialTicks) / 20.0F + this.bobOffs; + public static float getSpin(float f, float g) { + return f / 20.0F + g; } public ItemEntity copy() { @@ -462,7 +480,7 @@ public class ItemEntity extends Entity implements TraceableEntity { @Override public float getVisualRotationYInDegrees() { - return 180.0F - this.getSpin(0.5F) / (float) (Math.PI * 2) * 360.0F; + return 180.0F - getSpin(this.getAge() + 0.5F, this.bobOffs) / (float) (Math.PI * 2) * 360.0F; } @Override diff --git a/net/minecraft/world/entity/item/PrimedTnt.java b/net/minecraft/world/entity/item/PrimedTnt.java index 004ea938..7c057f3c 100644 --- a/net/minecraft/world/entity/item/PrimedTnt.java +++ b/net/minecraft/world/entity/item/PrimedTnt.java @@ -9,6 +9,10 @@ import net.minecraft.nbt.NbtUtils; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.network.syncher.SynchedEntityData.Builder; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.util.Mth; +import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LivingEntity; @@ -21,15 +25,17 @@ import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.material.FluidState; -import net.minecraft.world.level.portal.DimensionTransition; +import net.minecraft.world.level.portal.TeleportTransition; import org.jetbrains.annotations.Nullable; public class PrimedTnt extends Entity implements TraceableEntity { private static final EntityDataAccessor DATA_FUSE_ID = SynchedEntityData.defineId(PrimedTnt.class, EntityDataSerializers.INT); private static final EntityDataAccessor DATA_BLOCK_STATE_ID = SynchedEntityData.defineId(PrimedTnt.class, EntityDataSerializers.BLOCK_STATE); private static final int DEFAULT_FUSE_TIME = 80; + private static final float DEFAULT_EXPLOSION_POWER = 4.0F; private static final String TAG_BLOCK_STATE = "block_state"; - public static final String TAG_FUSE = "fuse"; + private static final String TAG_FUSE = "fuse"; + private static final String TAG_EXPLOSION_POWER = "explosion_power"; private static final ExplosionDamageCalculator USED_PORTAL_DAMAGE_CALCULATOR = new ExplosionDamageCalculator() { @Override public boolean shouldBlockExplode(Explosion explosion, BlockGetter reader, BlockPos pos, BlockState state, float power) { @@ -44,6 +50,7 @@ public class PrimedTnt extends Entity implements TraceableEntity { @Nullable private LivingEntity owner; private boolean usedPortal; + private float explosionPower = 4.0F; public PrimedTnt(EntityType entityType, Level level) { super(entityType, level); @@ -63,7 +70,7 @@ public class PrimedTnt extends Entity implements TraceableEntity { } @Override - protected void defineSynchedData(SynchedEntityData.Builder builder) { + protected void defineSynchedData(Builder builder) { builder.define(DATA_FUSE_ID, 80); builder.define(DATA_BLOCK_STATE_ID, Blocks.TNT.defaultBlockState()); } @@ -88,6 +95,7 @@ public class PrimedTnt extends Entity implements TraceableEntity { this.handlePortal(); this.applyGravity(); this.move(MoverType.SELF, this.getDeltaMovement()); + this.applyEffectsFromBlocks(); this.setDeltaMovement(this.getDeltaMovement().scale(0.98)); if (this.onGround()) { this.setDeltaMovement(this.getDeltaMovement().multiply(0.7, -0.5, 0.7)); @@ -109,7 +117,6 @@ public class PrimedTnt extends Entity implements TraceableEntity { } private void explode() { - float f = 4.0F; this.level() .explode( this, @@ -118,7 +125,7 @@ public class PrimedTnt extends Entity implements TraceableEntity { this.getX(), this.getY(0.0625), this.getZ(), - 4.0F, + this.explosionPower, false, Level.ExplosionInteraction.TNT ); @@ -128,6 +135,9 @@ public class PrimedTnt extends Entity implements TraceableEntity { protected void addAdditionalSaveData(CompoundTag compound) { compound.putShort("fuse", (short)this.getFuse()); compound.put("block_state", NbtUtils.writeBlockState(this.getBlockState())); + if (this.explosionPower != 4.0F) { + compound.putFloat("explosion_power", this.explosionPower); + } } @Override @@ -136,6 +146,10 @@ public class PrimedTnt extends Entity implements TraceableEntity { if (compound.contains("block_state", 10)) { this.setBlockState(NbtUtils.readBlockState(this.level().holderLookup(Registries.BLOCK), compound.getCompound("block_state"))); } + + if (compound.contains("explosion_power", 99)) { + this.explosionPower = Mth.clamp(compound.getFloat("explosion_power"), 0.0F, 128.0F); + } } /** @@ -179,12 +193,17 @@ public class PrimedTnt extends Entity implements TraceableEntity { @Nullable @Override - public Entity changeDimension(DimensionTransition transition) { - Entity entity = super.changeDimension(transition); + public Entity teleport(TeleportTransition teleportTransition) { + Entity entity = super.teleport(teleportTransition); if (entity instanceof PrimedTnt primedTnt) { primedTnt.setUsedPortal(true); } return entity; } + + @Override + public final boolean hurtServer(ServerLevel serverLevel, DamageSource damageSource, float f) { + return false; + } } diff --git a/net/minecraft/world/entity/monster/AbstractIllager.java b/net/minecraft/world/entity/monster/AbstractIllager.java index 759ef69c..d37340cc 100644 --- a/net/minecraft/world/entity/monster/AbstractIllager.java +++ b/net/minecraft/world/entity/monster/AbstractIllager.java @@ -29,8 +29,8 @@ public abstract class AbstractIllager extends Raider { } @Override - public boolean isAlliedTo(Entity entity) { - if (super.isAlliedTo(entity)) { + protected boolean considersEntityAsAlly(Entity entity) { + if (super.considersEntityAsAlly(entity)) { return true; } else { return !entity.getType().is(EntityTypeTags.ILLAGER_FRIENDS) ? false : this.getTeam() == null && entity.getTeam() == null; diff --git a/net/minecraft/world/entity/monster/AbstractSkeleton.java b/net/minecraft/world/entity/monster/AbstractSkeleton.java index aa2d2f75..e812cc11 100644 --- a/net/minecraft/world/entity/monster/AbstractSkeleton.java +++ b/net/minecraft/world/entity/monster/AbstractSkeleton.java @@ -4,19 +4,20 @@ import java.time.LocalDate; import java.time.temporal.ChronoField; import net.minecraft.core.BlockPos; import net.minecraft.nbt.CompoundTag; +import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; import net.minecraft.util.RandomSource; import net.minecraft.world.Difficulty; import net.minecraft.world.DifficultyInstance; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.entity.MobSpawnType; import net.minecraft.world.entity.PathfinderMob; import net.minecraft.world.entity.SpawnGroupData; -import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.entity.ai.attributes.AttributeSupplier.Builder; import net.minecraft.world.entity.ai.goal.AvoidEntityGoal; import net.minecraft.world.entity.ai.goal.FleeSunGoal; import net.minecraft.world.entity.ai.goal.LookAtPlayerGoal; @@ -32,6 +33,7 @@ import net.minecraft.world.entity.animal.Turtle; import net.minecraft.world.entity.animal.Wolf; import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.projectile.AbstractArrow; +import net.minecraft.world.entity.projectile.Projectile; import net.minecraft.world.entity.projectile.ProjectileUtil; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; @@ -80,7 +82,7 @@ public abstract class AbstractSkeleton extends Monster implements RangedAttackMo this.targetSelector.addGoal(3, new NearestAttackableTargetGoal(this, Turtle.class, 10, true, false, Turtle.BABY_ON_LAND_SELECTOR)); } - public static AttributeSupplier.Builder createAttributes() { + public static Builder createAttributes() { return Monster.createMonsterAttributes().add(Attributes.MOVEMENT_SPEED, 0.25); } @@ -133,13 +135,15 @@ public abstract class AbstractSkeleton extends Monster implements RangedAttackMo @Nullable @Override - public SpawnGroupData finalizeSpawn(ServerLevelAccessor level, DifficultyInstance difficulty, MobSpawnType spawnType, @Nullable SpawnGroupData spawnGroupData) { - spawnGroupData = super.finalizeSpawn(level, difficulty, spawnType, spawnGroupData); - RandomSource randomSource = level.getRandom(); - this.populateDefaultEquipmentSlots(randomSource, difficulty); - this.populateDefaultEquipmentEnchantments(level, randomSource, difficulty); + public SpawnGroupData finalizeSpawn( + ServerLevelAccessor serverLevelAccessor, DifficultyInstance difficultyInstance, EntitySpawnReason entitySpawnReason, @Nullable SpawnGroupData spawnGroupData + ) { + spawnGroupData = super.finalizeSpawn(serverLevelAccessor, difficultyInstance, entitySpawnReason, spawnGroupData); + RandomSource randomSource = serverLevelAccessor.getRandom(); + this.populateDefaultEquipmentSlots(randomSource, difficultyInstance); + this.populateDefaultEquipmentEnchantments(serverLevelAccessor, randomSource, difficultyInstance); this.reassessWeaponGoal(); - this.setCanPickUpLoot(randomSource.nextFloat() < 0.55F * difficulty.getSpecialMultiplier()); + this.setCanPickUpLoot(randomSource.nextFloat() < 0.55F * difficultyInstance.getSpecialMultiplier()); if (this.getItemBySlot(EquipmentSlot.HEAD).isEmpty()) { LocalDate localDate = LocalDate.now(); int i = localDate.get(ChronoField.DAY_OF_MONTH); @@ -192,9 +196,11 @@ public abstract class AbstractSkeleton extends Monster implements RangedAttackMo double e = target.getY(0.3333333333333333) - abstractArrow.getY(); double f = target.getZ() - this.getZ(); double g = Math.sqrt(d * d + f * f); - abstractArrow.shoot(d, e + g * 0.2F, f, 1.6F, 14 - this.level().getDifficulty().getId() * 4); + if (this.level() instanceof ServerLevel serverLevel) { + Projectile.spawnProjectileUsingShoot(abstractArrow, serverLevel, itemStack2, d, e + g * 0.2F, f, 1.6F, 14 - serverLevel.getDifficulty().getId() * 4); + } + this.playSound(SoundEvents.SKELETON_SHOOT, 1.0F, 1.0F / (this.getRandom().nextFloat() * 0.4F + 0.8F)); - this.level().addFreshEntity(abstractArrow); } protected AbstractArrow getArrow(ItemStack arrow, float velocity, @Nullable ItemStack weapon) { diff --git a/net/minecraft/world/entity/monster/Blaze.java b/net/minecraft/world/entity/monster/Blaze.java index f90933ee..aa913cb1 100644 --- a/net/minecraft/world/entity/monster/Blaze.java +++ b/net/minecraft/world/entity/monster/Blaze.java @@ -5,13 +5,14 @@ import net.minecraft.core.particles.ParticleTypes; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.entity.ai.attributes.AttributeSupplier.Builder; import net.minecraft.world.entity.ai.goal.Goal; import net.minecraft.world.entity.ai.goal.LookAtPlayerGoal; import net.minecraft.world.entity.ai.goal.MoveTowardsRestrictionGoal; @@ -50,12 +51,12 @@ public class Blaze extends Monster { this.targetSelector.addGoal(2, new NearestAttackableTargetGoal(this, Player.class, true)); } - public static AttributeSupplier.Builder createAttributes() { + public static Builder createAttributes() { return Monster.createMonsterAttributes().add(Attributes.ATTACK_DAMAGE, 6.0).add(Attributes.MOVEMENT_SPEED, 0.23F).add(Attributes.FOLLOW_RANGE, 48.0); } @Override - protected void defineSynchedData(SynchedEntityData.Builder builder) { + protected void defineSynchedData(net.minecraft.network.syncher.SynchedEntityData.Builder builder) { super.defineSynchedData(builder); builder.define(DATA_FLAGS_ID, (byte)0); } @@ -115,7 +116,7 @@ public class Blaze extends Monster { } @Override - protected void customServerAiStep() { + protected void customServerAiStep(ServerLevel serverLevel) { this.nextHeightOffsetChangeTick--; if (this.nextHeightOffsetChangeTick <= 0) { this.nextHeightOffsetChangeTick = 100; @@ -129,7 +130,7 @@ public class Blaze extends Monster { this.hasImpulse = true; } - super.customServerAiStep(); + super.customServerAiStep(serverLevel); } @Override @@ -205,7 +206,7 @@ public class Blaze extends Monster { if (this.attackTime <= 0) { this.attackTime = 20; - this.blaze.doHurtTarget(livingEntity); + this.blaze.doHurtTarget(getServerLevel(this.blaze), livingEntity); } this.blaze.getMoveControl().setWantedPosition(livingEntity.getX(), livingEntity.getY(), livingEntity.getZ(), 1.0); diff --git a/net/minecraft/world/entity/monster/Bogged.java b/net/minecraft/world/entity/monster/Bogged.java index 5d2b6244..69d3f9d8 100644 --- a/net/minecraft/world/entity/monster/Bogged.java +++ b/net/minecraft/world/entity/monster/Bogged.java @@ -15,8 +15,8 @@ import net.minecraft.world.effect.MobEffectInstance; import net.minecraft.world.effect.MobEffects; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.Shearable; -import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.entity.ai.attributes.AttributeSupplier.Builder; import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.projectile.AbstractArrow; import net.minecraft.world.entity.projectile.Arrow; @@ -25,10 +25,6 @@ import net.minecraft.world.item.Items; import net.minecraft.world.level.Level; import net.minecraft.world.level.gameevent.GameEvent; import net.minecraft.world.level.storage.loot.BuiltInLootTables; -import net.minecraft.world.level.storage.loot.LootParams; -import net.minecraft.world.level.storage.loot.LootTable; -import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets; -import net.minecraft.world.level.storage.loot.parameters.LootContextParams; import org.jetbrains.annotations.Nullable; public class Bogged extends AbstractSkeleton implements Shearable { @@ -37,7 +33,7 @@ public class Bogged extends AbstractSkeleton implements Shearable { private static final EntityDataAccessor DATA_SHEARED = SynchedEntityData.defineId(Bogged.class, EntityDataSerializers.BOOLEAN); public static final String SHEARED_TAG_NAME = "sheared"; - public static AttributeSupplier.Builder createAttributes() { + public static Builder createAttributes() { return AbstractSkeleton.createAttributes().add(Attributes.MAX_HEALTH, 16.0); } @@ -46,7 +42,7 @@ public class Bogged extends AbstractSkeleton implements Shearable { } @Override - protected void defineSynchedData(SynchedEntityData.Builder builder) { + protected void defineSynchedData(net.minecraft.network.syncher.SynchedEntityData.Builder builder) { super.defineSynchedData(builder); builder.define(DATA_SHEARED, false); } @@ -75,13 +71,13 @@ public class Bogged extends AbstractSkeleton implements Shearable { protected InteractionResult mobInteract(Player player, InteractionHand hand) { ItemStack itemStack = player.getItemInHand(hand); if (itemStack.is(Items.SHEARS) && this.readyForShearing()) { - this.shear(SoundSource.PLAYERS); - this.gameEvent(GameEvent.SHEAR, player); - if (!this.level().isClientSide) { + if (this.level() instanceof ServerLevel serverLevel) { + this.shear(serverLevel, SoundSource.PLAYERS, itemStack); + this.gameEvent(GameEvent.SHEAR, player); itemStack.hurtAndBreak(1, player, getSlotForHand(hand)); } - return InteractionResult.sidedSuccess(this.level().isClientSide); + return InteractionResult.SUCCESS; } else { return super.mobInteract(player, hand); } @@ -128,24 +124,16 @@ public class Bogged extends AbstractSkeleton implements Shearable { } @Override - public void shear(SoundSource source) { - this.level().playSound(null, this, SoundEvents.BOGGED_SHEAR, source, 1.0F, 1.0F); - this.spawnShearedMushrooms(); + public void shear(ServerLevel serverLevel, SoundSource soundSource, ItemStack itemStack) { + serverLevel.playSound(null, this, SoundEvents.BOGGED_SHEAR, soundSource, 1.0F, 1.0F); + this.spawnShearedMushrooms(serverLevel, itemStack); this.setSheared(true); } - private void spawnShearedMushrooms() { - if (this.level() instanceof ServerLevel serverLevel) { - LootTable lootTable = serverLevel.getServer().reloadableRegistries().getLootTable(BuiltInLootTables.BOGGED_SHEAR); - LootParams lootParams = new LootParams.Builder(serverLevel) - .withParameter(LootContextParams.ORIGIN, this.position()) - .withParameter(LootContextParams.THIS_ENTITY, this) - .create(LootContextParamSets.SHEARING); - - for (ItemStack itemStack : lootTable.getRandomItems(lootParams)) { - this.spawnAtLocation(itemStack, this.getBbHeight()); - } - } + private void spawnShearedMushrooms(ServerLevel serverLevel, ItemStack itemStack) { + this.dropFromShearingLootTable( + serverLevel, BuiltInLootTables.BOGGED_SHEAR, itemStack, (serverLevelx, itemStackx) -> this.spawnAtLocation(serverLevelx, itemStackx, this.getBbHeight()) + ); } @Override diff --git a/net/minecraft/world/entity/monster/CaveSpider.java b/net/minecraft/world/entity/monster/CaveSpider.java index 84bb3ca3..79704161 100644 --- a/net/minecraft/world/entity/monster/CaveSpider.java +++ b/net/minecraft/world/entity/monster/CaveSpider.java @@ -1,16 +1,17 @@ package net.minecraft.world.entity.monster; +import net.minecraft.server.level.ServerLevel; import net.minecraft.world.Difficulty; import net.minecraft.world.DifficultyInstance; import net.minecraft.world.effect.MobEffectInstance; import net.minecraft.world.effect.MobEffects; import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.entity.MobSpawnType; import net.minecraft.world.entity.SpawnGroupData; -import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.entity.ai.attributes.AttributeSupplier.Builder; import net.minecraft.world.level.Level; import net.minecraft.world.level.ServerLevelAccessor; import net.minecraft.world.phys.Vec3; @@ -21,14 +22,14 @@ public class CaveSpider extends Spider { super(entityType, level); } - public static AttributeSupplier.Builder createCaveSpider() { + public static Builder createCaveSpider() { return Spider.createAttributes().add(Attributes.MAX_HEALTH, 12.0); } @Override - public boolean doHurtTarget(Entity target) { - if (super.doHurtTarget(target)) { - if (target instanceof LivingEntity) { + public boolean doHurtTarget(ServerLevel serverLevel, Entity entity) { + if (super.doHurtTarget(serverLevel, entity)) { + if (entity instanceof LivingEntity) { int i = 0; if (this.level().getDifficulty() == Difficulty.NORMAL) { i = 7; @@ -37,7 +38,7 @@ public class CaveSpider extends Spider { } if (i > 0) { - ((LivingEntity)target).addEffect(new MobEffectInstance(MobEffects.POISON, i * 20, 0), this); + ((LivingEntity)entity).addEffect(new MobEffectInstance(MobEffects.POISON, i * 20, 0), this); } } @@ -49,7 +50,9 @@ public class CaveSpider extends Spider { @Nullable @Override - public SpawnGroupData finalizeSpawn(ServerLevelAccessor level, DifficultyInstance difficulty, MobSpawnType spawnType, @Nullable SpawnGroupData spawnGroupData) { + public SpawnGroupData finalizeSpawn( + ServerLevelAccessor serverLevelAccessor, DifficultyInstance difficultyInstance, EntitySpawnReason entitySpawnReason, @Nullable SpawnGroupData spawnGroupData + ) { return spawnGroupData; } diff --git a/net/minecraft/world/entity/monster/Creeper.java b/net/minecraft/world/entity/monster/Creeper.java index 1a5c596b..c8e5e7ed 100644 --- a/net/minecraft/world/entity/monster/Creeper.java +++ b/net/minecraft/world/entity/monster/Creeper.java @@ -19,9 +19,8 @@ import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LightningBolt; import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.entity.PowerableMob; -import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.entity.ai.attributes.AttributeSupplier.Builder; import net.minecraft.world.entity.ai.goal.AvoidEntityGoal; import net.minecraft.world.entity.ai.goal.FloatGoal; import net.minecraft.world.entity.ai.goal.LookAtPlayerGoal; @@ -41,7 +40,7 @@ import net.minecraft.world.level.Level; import net.minecraft.world.level.gameevent.GameEvent; import org.jetbrains.annotations.Nullable; -public class Creeper extends Monster implements PowerableMob { +public class Creeper extends Monster { private static final EntityDataAccessor DATA_SWELL_DIR = SynchedEntityData.defineId(Creeper.class, EntityDataSerializers.INT); private static final EntityDataAccessor DATA_IS_POWERED = SynchedEntityData.defineId(Creeper.class, EntityDataSerializers.BOOLEAN); private static final EntityDataAccessor DATA_IS_IGNITED = SynchedEntityData.defineId(Creeper.class, EntityDataSerializers.BOOLEAN); @@ -69,7 +68,7 @@ public class Creeper extends Monster implements PowerableMob { this.targetSelector.addGoal(2, new HurtByTargetGoal(this)); } - public static AttributeSupplier.Builder createAttributes() { + public static Builder createAttributes() { return Monster.createMonsterAttributes().add(Attributes.MOVEMENT_SPEED, 0.25); } @@ -90,7 +89,7 @@ public class Creeper extends Monster implements PowerableMob { } @Override - protected void defineSynchedData(SynchedEntityData.Builder builder) { + protected void defineSynchedData(net.minecraft.network.syncher.SynchedEntityData.Builder builder) { super.defineSynchedData(builder); builder.define(DATA_SWELL_DIR, -1); builder.define(DATA_IS_POWERED, false); @@ -155,9 +154,9 @@ public class Creeper extends Monster implements PowerableMob { } @Override - public void setTarget(@Nullable LivingEntity target) { - if (!(target instanceof Goat)) { - super.setTarget(target); + public void setTarget(@Nullable LivingEntity livingEntity) { + if (!(livingEntity instanceof Goat)) { + super.setTarget(livingEntity); } } @@ -177,16 +176,15 @@ public class Creeper extends Monster implements PowerableMob { Entity entity = damageSource.getEntity(); if (entity != this && entity instanceof Creeper creeper && creeper.canDropMobsSkull()) { creeper.increaseDroppedSkulls(); - this.spawnAtLocation(Items.CREEPER_HEAD); + this.spawnAtLocation(level, Items.CREEPER_HEAD); } } @Override - public boolean doHurtTarget(Entity target) { + public boolean doHurtTarget(ServerLevel serverLevel, Entity entity) { return true; } - @Override public boolean isPowered() { return this.entityData.get(DATA_IS_POWERED); } @@ -233,7 +231,7 @@ public class Creeper extends Monster implements PowerableMob { } } - return InteractionResult.sidedSuccess(this.level().isClientSide); + return InteractionResult.SUCCESS; } else { return super.mobInteract(player, hand); } @@ -243,12 +241,12 @@ public class Creeper extends Monster implements PowerableMob { * Creates an explosion as determined by this creeper's power and explosion radius. */ private void explodeCreeper() { - if (!this.level().isClientSide) { + if (this.level() instanceof ServerLevel serverLevel) { float f = this.isPowered() ? 2.0F : 1.0F; this.dead = true; - this.level().explode(this, this.getX(), this.getY(), this.getZ(), this.explosionRadius * f, Level.ExplosionInteraction.MOB); + serverLevel.explode(this, this.getX(), this.getY(), this.getZ(), this.explosionRadius * f, Level.ExplosionInteraction.MOB); this.spawnLingeringCloud(); - this.triggerOnDeathMobEffects(Entity.RemovalReason.KILLED); + this.triggerOnDeathMobEffects(serverLevel, Entity.RemovalReason.KILLED); this.discard(); } } diff --git a/net/minecraft/world/entity/monster/Drowned.java b/net/minecraft/world/entity/monster/Drowned.java index ebf3e5f7..7c457a97 100644 --- a/net/minecraft/world/entity/monster/Drowned.java +++ b/net/minecraft/world/entity/monster/Drowned.java @@ -3,6 +3,7 @@ package net.minecraft.world.entity.monster; import java.util.EnumSet; import net.minecraft.core.BlockPos; import net.minecraft.core.Holder; +import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; import net.minecraft.tags.BiomeTags; @@ -13,15 +14,15 @@ import net.minecraft.world.Difficulty; import net.minecraft.world.DifficultyInstance; import net.minecraft.world.InteractionHand; import net.minecraft.world.damagesource.DamageSource; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.entity.MobSpawnType; import net.minecraft.world.entity.MoverType; import net.minecraft.world.entity.PathfinderMob; import net.minecraft.world.entity.SpawnGroupData; -import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.entity.ai.attributes.AttributeSupplier.Builder; import net.minecraft.world.entity.ai.control.MoveControl; import net.minecraft.world.entity.ai.goal.Goal; import net.minecraft.world.entity.ai.goal.MoveToBlockGoal; @@ -38,6 +39,7 @@ import net.minecraft.world.entity.animal.Turtle; import net.minecraft.world.entity.animal.axolotl.Axolotl; import net.minecraft.world.entity.npc.AbstractVillager; import net.minecraft.world.entity.player.Player; +import net.minecraft.world.entity.projectile.Projectile; import net.minecraft.world.entity.projectile.ThrownTrident; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; @@ -66,7 +68,7 @@ public class Drowned extends Zombie implements RangedAttackMob { this.groundNavigation = new GroundPathNavigation(this, level); } - public static AttributeSupplier.Builder createAttributes() { + public static Builder createAttributes() { return Zombie.createAttributes().add(Attributes.STEP_HEIGHT, 1.0); } @@ -79,7 +81,8 @@ public class Drowned extends Zombie implements RangedAttackMob { this.goalSelector.addGoal(6, new Drowned.DrownedSwimUpGoal(this, 1.0, this.level().getSeaLevel())); this.goalSelector.addGoal(7, new RandomStrollGoal(this, 1.0)); this.targetSelector.addGoal(1, new HurtByTargetGoal(this, Drowned.class).setAlertOthers(ZombifiedPiglin.class)); - this.targetSelector.addGoal(2, new NearestAttackableTargetGoal(this, Player.class, 10, true, false, this::okTarget)); + this.targetSelector + .addGoal(2, new NearestAttackableTargetGoal(this, Player.class, 10, true, false, (livingEntity, serverLevel) -> this.okTarget(livingEntity))); this.targetSelector.addGoal(3, new NearestAttackableTargetGoal(this, AbstractVillager.class, false)); this.targetSelector.addGoal(3, new NearestAttackableTargetGoal(this, IronGolem.class, true)); this.targetSelector.addGoal(3, new NearestAttackableTargetGoal(this, Axolotl.class, true, false)); @@ -87,9 +90,11 @@ public class Drowned extends Zombie implements RangedAttackMob { } @Override - public SpawnGroupData finalizeSpawn(ServerLevelAccessor level, DifficultyInstance difficulty, MobSpawnType spawnType, @Nullable SpawnGroupData spawnGroupData) { - spawnGroupData = super.finalizeSpawn(level, difficulty, spawnType, spawnGroupData); - if (this.getItemBySlot(EquipmentSlot.OFFHAND).isEmpty() && level.getRandom().nextFloat() < 0.03F) { + public SpawnGroupData finalizeSpawn( + ServerLevelAccessor serverLevelAccessor, DifficultyInstance difficultyInstance, EntitySpawnReason entitySpawnReason, @Nullable SpawnGroupData spawnGroupData + ) { + spawnGroupData = super.finalizeSpawn(serverLevelAccessor, difficultyInstance, entitySpawnReason, spawnGroupData); + if (this.getItemBySlot(EquipmentSlot.OFFHAND).isEmpty() && serverLevelAccessor.getRandom().nextFloat() < 0.03F) { this.setItemSlot(EquipmentSlot.OFFHAND, new ItemStack(Items.NAUTILUS_SHELL)); this.setGuaranteedDrop(EquipmentSlot.OFFHAND); } @@ -98,21 +103,21 @@ public class Drowned extends Zombie implements RangedAttackMob { } public static boolean checkDrownedSpawnRules( - EntityType drowned, ServerLevelAccessor serverLevel, MobSpawnType mobSpawnType, BlockPos pos, RandomSource random + EntityType entityType, ServerLevelAccessor serverLevelAccessor, EntitySpawnReason entitySpawnReason, BlockPos blockPos, RandomSource randomSource ) { - if (!serverLevel.getFluidState(pos.below()).is(FluidTags.WATER) && !MobSpawnType.isSpawner(mobSpawnType)) { + if (!serverLevelAccessor.getFluidState(blockPos.below()).is(FluidTags.WATER) && !EntitySpawnReason.isSpawner(entitySpawnReason)) { return false; } else { - Holder holder = serverLevel.getBiome(pos); - boolean bl = serverLevel.getDifficulty() != Difficulty.PEACEFUL - && (MobSpawnType.ignoresLightRequirements(mobSpawnType) || isDarkEnoughToSpawn(serverLevel, pos, random)) - && (MobSpawnType.isSpawner(mobSpawnType) || serverLevel.getFluidState(pos).is(FluidTags.WATER)); - if (bl && MobSpawnType.isSpawner(mobSpawnType)) { - return true; - } else { + Holder holder = serverLevelAccessor.getBiome(blockPos); + boolean bl = serverLevelAccessor.getDifficulty() != Difficulty.PEACEFUL + && (EntitySpawnReason.ignoresLightRequirements(entitySpawnReason) || isDarkEnoughToSpawn(serverLevelAccessor, blockPos, randomSource)) + && (EntitySpawnReason.isSpawner(entitySpawnReason) || serverLevelAccessor.getFluidState(blockPos).is(FluidTags.WATER)); + if (!bl || !EntitySpawnReason.isSpawner(entitySpawnReason) && entitySpawnReason != EntitySpawnReason.REINFORCEMENT) { return holder.is(BiomeTags.MORE_FREQUENT_DROWNED_SPAWNS) - ? random.nextInt(15) == 0 && bl - : random.nextInt(40) == 0 && isDeepEnoughToSpawn(serverLevel, pos) && bl; + ? randomSource.nextInt(15) == 0 && bl + : randomSource.nextInt(40) == 0 && isDeepEnoughToSpawn(serverLevelAccessor, blockPos) && bl; + } else { + return true; } } } @@ -121,11 +126,6 @@ public class Drowned extends Zombie implements RangedAttackMob { return pos.getY() < level.getSeaLevel() - 5; } - @Override - protected boolean supportsBreakDoorGoal() { - return false; - } - @Override protected SoundEvent getAmbientSound() { return this.isInWater() ? SoundEvents.DROWNED_AMBIENT_WATER : SoundEvents.DROWNED_AMBIENT; @@ -151,6 +151,11 @@ public class Drowned extends Zombie implements RangedAttackMob { return SoundEvents.DROWNED_SWIM; } + @Override + protected boolean canSpawnInLiquids() { + return true; + } + @Override protected ItemStack getSkull() { return ItemStack.EMPTY; @@ -169,13 +174,13 @@ public class Drowned extends Zombie implements RangedAttackMob { } @Override - protected boolean canReplaceCurrentItem(ItemStack candidate, ItemStack existing) { - if (existing.is(Items.NAUTILUS_SHELL)) { + protected boolean canReplaceCurrentItem(ItemStack itemStack, ItemStack itemStack2, EquipmentSlot equipmentSlot) { + if (itemStack2.is(Items.NAUTILUS_SHELL)) { return false; - } else if (existing.is(Items.TRIDENT)) { - return candidate.is(Items.TRIDENT) ? candidate.getDamageValue() < existing.getDamageValue() : false; + } else if (itemStack2.is(Items.TRIDENT)) { + return itemStack.is(Items.TRIDENT) ? itemStack.getDamageValue() < itemStack2.getDamageValue() : false; } else { - return candidate.is(Items.TRIDENT) ? true : super.canReplaceCurrentItem(candidate, existing); + return itemStack.is(Items.TRIDENT) ? true : super.canReplaceCurrentItem(itemStack, itemStack2, equipmentSlot); } } @@ -209,7 +214,7 @@ public class Drowned extends Zombie implements RangedAttackMob { @Override public void travel(Vec3 travelVector) { - if (this.isControlledByLocalInstance() && this.isInWater() && this.wantsToSwim()) { + if (this.isControlledByLocalInstance() && this.isUnderWater() && this.wantsToSwim()) { this.moveRelative(0.01F, travelVector); this.move(MoverType.SELF, this.getDeltaMovement()); this.setDeltaMovement(this.getDeltaMovement().scale(0.9)); @@ -221,7 +226,7 @@ public class Drowned extends Zombie implements RangedAttackMob { @Override public void updateSwimming() { if (!this.level().isClientSide) { - if (this.isEffectiveAi() && this.isInWater() && this.wantsToSwim()) { + if (this.isEffectiveAi() && this.isUnderWater() && this.wantsToSwim()) { this.navigation = this.waterNavigation; this.setSwimming(true); } else { @@ -253,14 +258,18 @@ public class Drowned extends Zombie implements RangedAttackMob { @Override public void performRangedAttack(LivingEntity target, float velocity) { - ThrownTrident thrownTrident = new ThrownTrident(this.level(), this, new ItemStack(Items.TRIDENT)); + ItemStack itemStack = this.getMainHandItem(); + ItemStack itemStack2 = itemStack.is(Items.TRIDENT) ? itemStack : new ItemStack(Items.TRIDENT); + ThrownTrident thrownTrident = new ThrownTrident(this.level(), this, itemStack2); double d = target.getX() - this.getX(); double e = target.getY(0.3333333333333333) - thrownTrident.getY(); double f = target.getZ() - this.getZ(); double g = Math.sqrt(d * d + f * f); - thrownTrident.shoot(d, e + g * 0.2F, f, 1.6F, 14 - this.level().getDifficulty().getId() * 4); + if (this.level() instanceof ServerLevel serverLevel) { + Projectile.spawnProjectileUsingShoot(thrownTrident, serverLevel, itemStack2, d, e + g * 0.2F, f, 1.6F, 14 - this.level().getDifficulty().getId() * 4); + } + this.playSound(SoundEvents.DROWNED_SHOOT, 1.0F, 1.0F / (this.getRandom().nextFloat() * 0.4F + 0.8F)); - this.level().addFreshEntity(thrownTrident); } public void setSearchingForLand(boolean searchingForLand) { diff --git a/net/minecraft/world/entity/monster/ElderGuardian.java b/net/minecraft/world/entity/monster/ElderGuardian.java index a482ddbc..a29de57c 100644 --- a/net/minecraft/world/entity/monster/ElderGuardian.java +++ b/net/minecraft/world/entity/monster/ElderGuardian.java @@ -11,8 +11,8 @@ import net.minecraft.world.effect.MobEffectInstance; import net.minecraft.world.effect.MobEffectUtil; import net.minecraft.world.effect.MobEffects; import net.minecraft.world.entity.EntityType; -import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.entity.ai.attributes.AttributeSupplier.Builder; import net.minecraft.world.level.Level; public class ElderGuardian extends Guardian { @@ -31,7 +31,7 @@ public class ElderGuardian extends Guardian { } } - public static AttributeSupplier.Builder createAttributes() { + public static Builder createAttributes() { return Guardian.createAttributes().add(Attributes.MOVEMENT_SPEED, 0.3F).add(Attributes.ATTACK_DAMAGE, 8.0).add(Attributes.MAX_HEALTH, 80.0); } @@ -61,11 +61,11 @@ public class ElderGuardian extends Guardian { } @Override - protected void customServerAiStep() { - super.customServerAiStep(); + protected void customServerAiStep(ServerLevel serverLevel) { + super.customServerAiStep(serverLevel); if ((this.tickCount + this.getId()) % 1200 == 0) { MobEffectInstance mobEffectInstance = new MobEffectInstance(MobEffects.DIG_SLOWDOWN, 6000, 2); - List list = MobEffectUtil.addEffectToPlayersAround((ServerLevel)this.level(), this, this.position(), 50.0, mobEffectInstance, 1200); + List list = MobEffectUtil.addEffectToPlayersAround(serverLevel, this, this.position(), 50.0, mobEffectInstance, 1200); list.forEach( serverPlayer -> serverPlayer.connection .send(new ClientboundGameEventPacket(ClientboundGameEventPacket.GUARDIAN_ELDER_EFFECT, this.isSilent() ? 0.0F : 1.0F)) diff --git a/net/minecraft/world/entity/monster/EnderMan.java b/net/minecraft/world/entity/monster/EnderMan.java index e766b7e4..64cc1e94 100644 --- a/net/minecraft/world/entity/monster/EnderMan.java +++ b/net/minecraft/world/entity/monster/EnderMan.java @@ -3,7 +3,7 @@ package net.minecraft.world.entity.monster; import java.util.EnumSet; import java.util.Optional; import java.util.UUID; -import java.util.function.Predicate; +import java.util.function.DoubleSupplier; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.component.DataComponents; @@ -32,8 +32,8 @@ import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.NeutralMob; import net.minecraft.world.entity.ai.attributes.AttributeInstance; import net.minecraft.world.entity.ai.attributes.AttributeModifier; -import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.entity.ai.attributes.AttributeSupplier.Builder; import net.minecraft.world.entity.ai.goal.FloatGoal; import net.minecraft.world.entity.ai.goal.Goal; import net.minecraft.world.entity.ai.goal.LookAtPlayerGoal; @@ -55,10 +55,12 @@ import net.minecraft.world.item.enchantment.providers.VanillaEnchantmentProvider import net.minecraft.world.level.ClipContext; import net.minecraft.world.level.GameRules; import net.minecraft.world.level.Level; +import net.minecraft.world.level.ClipContext.Fluid; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.level.gameevent.GameEvent.Context; import net.minecraft.world.level.pathfinder.PathType; import net.minecraft.world.level.storage.loot.LootParams; import net.minecraft.world.level.storage.loot.parameters.LootContextParams; @@ -107,7 +109,7 @@ public class EnderMan extends Monster implements NeutralMob { this.targetSelector.addGoal(4, new ResetUniversalAngerTargetGoal<>(this, false)); } - public static AttributeSupplier.Builder createAttributes() { + public static Builder createAttributes() { return Monster.createMonsterAttributes() .add(Attributes.MAX_HEALTH, 40.0) .add(Attributes.MOVEMENT_SPEED, 0.3F) @@ -117,10 +119,10 @@ public class EnderMan extends Monster implements NeutralMob { } @Override - public void setTarget(@Nullable LivingEntity target) { - super.setTarget(target); + public void setTarget(@Nullable LivingEntity livingEntity) { + super.setTarget(livingEntity); AttributeInstance attributeInstance = this.getAttribute(Attributes.MOVEMENT_SPEED); - if (target == null) { + if (livingEntity == null) { this.targetChangeTime = 0; this.entityData.set(DATA_CREEPY, false); this.entityData.set(DATA_STARED_AT, false); @@ -135,7 +137,7 @@ public class EnderMan extends Monster implements NeutralMob { } @Override - protected void defineSynchedData(SynchedEntityData.Builder builder) { + protected void defineSynchedData(net.minecraft.network.syncher.SynchedEntityData.Builder builder) { super.defineSynchedData(builder); builder.define(DATA_CARRY_STATE, Optional.empty()); builder.define(DATA_CREEPY, false); @@ -212,21 +214,8 @@ public class EnderMan extends Monster implements NeutralMob { this.readPersistentAngerSaveData(this.level(), compound); } - /** - * Checks to see if this enderman should be attacking this player - */ - boolean isLookingAtMe(Player player) { - ItemStack itemStack = player.getInventory().armor.get(3); - if (itemStack.is(Blocks.CARVED_PUMPKIN.asItem())) { - return false; - } else { - Vec3 vec3 = player.getViewVector(1.0F).normalize(); - Vec3 vec32 = new Vec3(this.getX() - player.getX(), this.getEyeY() - player.getEyeY(), this.getZ() - player.getZ()); - double d = vec32.length(); - vec32 = vec32.normalize(); - double e = vec3.dot(vec32); - return e > 1.0 - 0.025 / d ? player.hasLineOfSight(this) : false; - } + boolean isBeingStaredBy(Player player) { + return this.isLookingAtMe(player, 0.025, true, false, LivingEntity.PLAYER_NOT_WEARING_DISGUISE_ITEM, new DoubleSupplier[]{this::getEyeY}); } @Override @@ -260,16 +249,16 @@ public class EnderMan extends Monster implements NeutralMob { } @Override - protected void customServerAiStep() { - if (this.level().isDay() && this.tickCount >= this.targetChangeTime + 600) { + protected void customServerAiStep(ServerLevel serverLevel) { + if (serverLevel.isDay() && this.tickCount >= this.targetChangeTime + 600) { float f = this.getLightLevelDependentMagicValue(); - if (f > 0.5F && this.level().canSeeSky(this.blockPosition()) && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F) { + if (f > 0.5F && serverLevel.canSeeSky(this.blockPosition()) && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F) { this.setTarget(null); this.teleport(); } } - super.customServerAiStep(); + super.customServerAiStep(serverLevel); } /** @@ -305,7 +294,7 @@ public class EnderMan extends Monster implements NeutralMob { private boolean teleport(double x, double y, double z) { BlockPos.MutableBlockPos mutableBlockPos = new BlockPos.MutableBlockPos(x, y, z); - while (mutableBlockPos.getY() > this.level().getMinBuildHeight() && !this.level().getBlockState(mutableBlockPos).blocksMotion()) { + while (mutableBlockPos.getY() > this.level().getMinY() && !this.level().getBlockState(mutableBlockPos).blocksMotion()) { mutableBlockPos.move(Direction.DOWN); } @@ -316,7 +305,7 @@ public class EnderMan extends Monster implements NeutralMob { Vec3 vec3 = this.position(); boolean bl3 = this.randomTeleport(x, y, z, true); if (bl3) { - this.level().gameEvent(GameEvent.TELEPORT, vec3, GameEvent.Context.of(this)); + this.level().gameEvent(GameEvent.TELEPORT, vec3, Context.of(this)); if (!this.isSilent()) { this.level().playSound(null, this.xo, this.yo, this.zo, SoundEvents.ENDERMAN_TELEPORT, this.getSoundSource(), 1.0F, 1.0F); this.playSound(SoundEvents.ENDERMAN_TELEPORT, 1.0F, 1.0F); @@ -359,7 +348,7 @@ public class EnderMan extends Monster implements NeutralMob { .withOptionalParameter(LootContextParams.THIS_ENTITY, this); for (ItemStack itemStack2 : blockState.getDrops(builder)) { - this.spawnAtLocation(itemStack2); + this.spawnAtLocation(level, itemStack2); } } } @@ -374,20 +363,20 @@ public class EnderMan extends Monster implements NeutralMob { } @Override - public boolean hurt(DamageSource source, float amount) { - if (this.isInvulnerableTo(source)) { + public boolean hurtServer(ServerLevel serverLevel, DamageSource damageSource, float f) { + if (this.isInvulnerableTo(serverLevel, damageSource)) { return false; } else { - boolean bl = source.getDirectEntity() instanceof ThrownPotion; - if (!source.is(DamageTypeTags.IS_PROJECTILE) && !bl) { - boolean bl2 = super.hurt(source, amount); - if (!this.level().isClientSide() && !(source.getEntity() instanceof LivingEntity) && this.random.nextInt(10) != 0) { + boolean bl = damageSource.getDirectEntity() instanceof ThrownPotion; + if (!damageSource.is(DamageTypeTags.IS_PROJECTILE) && !bl) { + boolean bl2 = super.hurtServer(serverLevel, damageSource, f); + if (!(damageSource.getEntity() instanceof LivingEntity) && this.random.nextInt(10) != 0) { this.teleport(); } return bl2; } else { - boolean bl2 = bl && this.hurtWithCleanWater(source, (ThrownPotion)source.getDirectEntity(), amount); + boolean bl2 = bl && this.hurtWithCleanWater(serverLevel, damageSource, (ThrownPotion)damageSource.getDirectEntity(), f); for (int i = 0; i < 64; i++) { if (this.teleport()) { @@ -400,10 +389,10 @@ public class EnderMan extends Monster implements NeutralMob { } } - private boolean hurtWithCleanWater(DamageSource source, ThrownPotion potion, float amount) { - ItemStack itemStack = potion.getItem(); + private boolean hurtWithCleanWater(ServerLevel serverLevel, DamageSource damageSource, ThrownPotion thrownPotion, float f) { + ItemStack itemStack = thrownPotion.getItem(); PotionContents potionContents = itemStack.getOrDefault(DataComponents.POTION_CONTENTS, PotionContents.EMPTY); - return potionContents.is(Potions.WATER) ? super.hurt(source, amount) : false; + return potionContents.is(Potions.WATER) ? super.hurtServer(serverLevel, damageSource, f) : false; } public boolean isCreepy() { @@ -440,7 +429,7 @@ public class EnderMan extends Monster implements NeutralMob { return false; } else { double d = this.target.distanceToSqr(this.enderman); - return d > 256.0 ? false : this.enderman.isLookingAtMe((Player)this.target); + return d > 256.0 ? false : this.enderman.isBeingStaredBy((Player)this.target); } } @@ -467,7 +456,7 @@ public class EnderMan extends Monster implements NeutralMob { if (this.enderman.getCarriedBlock() == null) { return false; } else { - return !this.enderman.level().getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) + return !getServerLevel(this.enderman).getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) ? false : this.enderman.getRandom().nextInt(reducedTickDelay(2000)) == 0; } @@ -489,7 +478,7 @@ public class EnderMan extends Monster implements NeutralMob { blockState3 = Block.updateFromNeighbourShapes(blockState3, this.enderman.level(), blockPos); if (this.canPlaceBlock(level, blockPos, blockState3, blockState, blockState2, blockPos2)) { level.setBlock(blockPos, blockState3, 3); - level.gameEvent(GameEvent.BLOCK_PLACE, blockPos, GameEvent.Context.of(this.enderman, blockState3)); + level.gameEvent(GameEvent.BLOCK_PLACE, blockPos, Context.of(this.enderman, blockState3)); this.enderman.setCarriedBlock(null); } } @@ -518,19 +507,19 @@ public class EnderMan extends Monster implements NeutralMob { private int teleportTime; private final TargetingConditions startAggroTargetConditions; private final TargetingConditions continueAggroTargetConditions = TargetingConditions.forCombat().ignoreLineOfSight(); - private final Predicate isAngerInducing; + private final TargetingConditions.Selector isAngerInducing; - public EndermanLookForPlayerGoal(EnderMan enderman, @Nullable Predicate selectionPredicate) { - super(enderman, Player.class, 10, false, false, selectionPredicate); - this.enderman = enderman; - this.isAngerInducing = livingEntity -> (enderman.isLookingAtMe((Player)livingEntity) || enderman.isAngryAt(livingEntity)) - && !enderman.hasIndirectPassenger(livingEntity); + public EndermanLookForPlayerGoal(EnderMan enderMan, @Nullable TargetingConditions.Selector selector) { + super(enderMan, Player.class, 10, false, false, selector); + this.enderman = enderMan; + this.isAngerInducing = (livingEntity, serverLevel) -> (enderMan.isBeingStaredBy((Player)livingEntity) || enderMan.isAngryAt(livingEntity, serverLevel)) + && !enderMan.hasIndirectPassenger(livingEntity); this.startAggroTargetConditions = TargetingConditions.forCombat().range(this.getFollowDistance()).selector(this.isAngerInducing); } @Override public boolean canUse() { - this.pendingTarget = this.enderman.level().getNearestPlayer(this.startAggroTargetConditions, this.enderman); + this.pendingTarget = getServerLevel(this.enderman).getNearestPlayer(this.startAggroTargetConditions.range(this.getFollowDistance()), this.enderman); return this.pendingTarget != null; } @@ -550,7 +539,7 @@ public class EnderMan extends Monster implements NeutralMob { @Override public boolean canContinueToUse() { if (this.pendingTarget != null) { - if (!this.isAngerInducing.test(this.pendingTarget)) { + if (!this.isAngerInducing.test(this.pendingTarget, getServerLevel(this.enderman))) { return false; } else { this.enderman.lookAt(this.pendingTarget, 10.0F, 10.0F); @@ -562,7 +551,7 @@ public class EnderMan extends Monster implements NeutralMob { return false; } - if (this.continueAggroTargetConditions.test(this.enderman, this.target)) { + if (this.continueAggroTargetConditions.test(getServerLevel(this.enderman), this.enderman, this.target)) { return true; } } @@ -585,7 +574,7 @@ public class EnderMan extends Monster implements NeutralMob { } } else { if (this.target != null && !this.enderman.isPassenger()) { - if (this.enderman.isLookingAtMe((Player)this.target)) { + if (this.enderman.isBeingStaredBy((Player)this.target)) { if (this.target.distanceToSqr(this.enderman) < 16.0) { this.enderman.teleport(); } @@ -615,7 +604,9 @@ public class EnderMan extends Monster implements NeutralMob { if (this.enderman.getCarriedBlock() != null) { return false; } else { - return !this.enderman.level().getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) ? false : this.enderman.getRandom().nextInt(reducedTickDelay(20)) == 0; + return !getServerLevel(this.enderman).getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) + ? false + : this.enderman.getRandom().nextInt(reducedTickDelay(20)) == 0; } } @@ -630,11 +621,11 @@ public class EnderMan extends Monster implements NeutralMob { BlockState blockState = level.getBlockState(blockPos); Vec3 vec3 = new Vec3(this.enderman.getBlockX() + 0.5, j + 0.5, this.enderman.getBlockZ() + 0.5); Vec3 vec32 = new Vec3(i + 0.5, j + 0.5, k + 0.5); - BlockHitResult blockHitResult = level.clip(new ClipContext(vec3, vec32, ClipContext.Block.OUTLINE, ClipContext.Fluid.NONE, this.enderman)); + BlockHitResult blockHitResult = level.clip(new ClipContext(vec3, vec32, net.minecraft.world.level.ClipContext.Block.OUTLINE, Fluid.NONE, this.enderman)); boolean bl = blockHitResult.getBlockPos().equals(blockPos); if (blockState.is(BlockTags.ENDERMAN_HOLDABLE) && bl) { level.removeBlock(blockPos, false); - level.gameEvent(GameEvent.BLOCK_DESTROY, blockPos, GameEvent.Context.of(this.enderman, blockState)); + level.gameEvent(GameEvent.BLOCK_DESTROY, blockPos, Context.of(this.enderman, blockState)); this.enderman.setCarriedBlock(blockState.getBlock().defaultBlockState()); } } diff --git a/net/minecraft/world/entity/monster/Endermite.java b/net/minecraft/world/entity/monster/Endermite.java index 7539ab57..6815ccbe 100644 --- a/net/minecraft/world/entity/monster/Endermite.java +++ b/net/minecraft/world/entity/monster/Endermite.java @@ -8,10 +8,10 @@ import net.minecraft.sounds.SoundEvents; import net.minecraft.util.RandomSource; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; -import net.minecraft.world.entity.MobSpawnType; -import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.entity.ai.attributes.AttributeSupplier.Builder; import net.minecraft.world.entity.ai.goal.ClimbOnTopOfPowderSnowGoal; import net.minecraft.world.entity.ai.goal.FloatGoal; import net.minecraft.world.entity.ai.goal.LookAtPlayerGoal; @@ -46,7 +46,7 @@ public class Endermite extends Monster { this.targetSelector.addGoal(2, new NearestAttackableTargetGoal(this, Player.class, true)); } - public static AttributeSupplier.Builder createAttributes() { + public static Builder createAttributes() { return Monster.createMonsterAttributes().add(Attributes.MAX_HEALTH, 8.0).add(Attributes.MOVEMENT_SPEED, 0.25).add(Attributes.ATTACK_DAMAGE, 2.0); } @@ -127,13 +127,15 @@ public class Endermite extends Monster { } public static boolean checkEndermiteSpawnRules( - EntityType endermite, LevelAccessor serverLevel, MobSpawnType spawnType, BlockPos pos, RandomSource random + EntityType entityType, LevelAccessor levelAccessor, EntitySpawnReason entitySpawnReason, BlockPos blockPos, RandomSource randomSource ) { - if (checkAnyLightMonsterSpawnRules(endermite, serverLevel, spawnType, pos, random)) { - Player player = serverLevel.getNearestPlayer(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, 5.0, true); - return player == null; - } else { + if (!checkAnyLightMonsterSpawnRules(entityType, levelAccessor, entitySpawnReason, blockPos, randomSource)) { return false; + } else if (EntitySpawnReason.isSpawner(entitySpawnReason)) { + return true; + } else { + Player player = levelAccessor.getNearestPlayer(blockPos.getX() + 0.5, blockPos.getY() + 0.5, blockPos.getZ() + 0.5, 5.0, true); + return player == null; } } } diff --git a/net/minecraft/world/entity/monster/Evoker.java b/net/minecraft/world/entity/monster/Evoker.java index e0bbf0cf..db057748 100644 --- a/net/minecraft/world/entity/monster/Evoker.java +++ b/net/minecraft/world/entity/monster/Evoker.java @@ -4,19 +4,18 @@ import java.util.List; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.nbt.CompoundTag; -import net.minecraft.network.syncher.SynchedEntityData; import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; import net.minecraft.util.Mth; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.Mob; -import net.minecraft.world.entity.MobSpawnType; -import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.entity.ai.attributes.AttributeSupplier.Builder; import net.minecraft.world.entity.ai.goal.AvoidEntityGoal; import net.minecraft.world.entity.ai.goal.FloatGoal; import net.minecraft.world.entity.ai.goal.LookAtPlayerGoal; @@ -26,6 +25,7 @@ import net.minecraft.world.entity.ai.goal.target.NearestAttackableTargetGoal; import net.minecraft.world.entity.ai.targeting.TargetingConditions; import net.minecraft.world.entity.animal.IronGolem; import net.minecraft.world.entity.animal.Sheep; +import net.minecraft.world.entity.monster.creaking.Creaking; import net.minecraft.world.entity.npc.AbstractVillager; import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.projectile.EvokerFangs; @@ -35,6 +35,7 @@ import net.minecraft.world.level.GameRules; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.level.gameevent.GameEvent.Context; import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.shapes.VoxelShape; import net.minecraft.world.scores.PlayerTeam; @@ -55,6 +56,7 @@ public class Evoker extends SpellcasterIllager { this.goalSelector.addGoal(0, new FloatGoal(this)); this.goalSelector.addGoal(1, new Evoker.EvokerCastingSpellGoal()); this.goalSelector.addGoal(2, new AvoidEntityGoal(this, Player.class, 8.0F, 0.6, 1.0)); + this.goalSelector.addGoal(3, new AvoidEntityGoal(this, Creaking.class, 8.0F, 1.0, 1.2)); this.goalSelector.addGoal(4, new Evoker.EvokerSummonSpellGoal()); this.goalSelector.addGoal(5, new Evoker.EvokerAttackSpellGoal()); this.goalSelector.addGoal(6, new Evoker.EvokerWololoSpellGoal()); @@ -67,12 +69,12 @@ public class Evoker extends SpellcasterIllager { this.targetSelector.addGoal(3, new NearestAttackableTargetGoal(this, IronGolem.class, false)); } - public static AttributeSupplier.Builder createAttributes() { + public static Builder createAttributes() { return Monster.createMonsterAttributes().add(Attributes.MOVEMENT_SPEED, 0.5).add(Attributes.FOLLOW_RANGE, 12.0).add(Attributes.MAX_HEALTH, 24.0); } @Override - protected void defineSynchedData(SynchedEntityData.Builder builder) { + protected void defineSynchedData(net.minecraft.network.syncher.SynchedEntityData.Builder builder) { super.defineSynchedData(builder); } @@ -92,20 +94,13 @@ public class Evoker extends SpellcasterIllager { } @Override - protected void customServerAiStep() { - super.customServerAiStep(); - } - - @Override - public boolean isAlliedTo(Entity entity) { - if (entity == null) { - return false; - } else if (entity == this) { + protected boolean considersEntityAsAlly(Entity entity) { + if (entity == this) { return true; - } else if (super.isAlliedTo(entity)) { + } else if (super.considersEntityAsAlly(entity)) { return true; } else { - return entity instanceof Vex vex ? this.isAlliedTo(vex.getOwner()) : false; + return entity instanceof Vex vex && vex.getOwner() != null ? this.considersEntityAsAlly(vex.getOwner()) : false; } } @@ -204,7 +199,7 @@ public class Evoker extends SpellcasterIllager { if (bl) { Evoker.this.level().addFreshEntity(new EvokerFangs(Evoker.this.level(), x, blockPos.getY() + d, z, yRot, warmupDelay, Evoker.this)); - Evoker.this.level().gameEvent(GameEvent.ENTITY_PLACE, new Vec3(x, blockPos.getY() + d, z), GameEvent.Context.of(Evoker.this)); + Evoker.this.level().gameEvent(GameEvent.ENTITY_PLACE, new Vec3(x, blockPos.getY() + d, z), Context.of(Evoker.this)); } } @@ -238,7 +233,9 @@ public class Evoker extends SpellcasterIllager { if (!super.canUse()) { return false; } else { - int i = Evoker.this.level().getNearbyEntities(Vex.class, this.vexCountTargeting, Evoker.this, Evoker.this.getBoundingBox().inflate(16.0)).size(); + int i = getServerLevel(Evoker.this.level()) + .getNearbyEntities(Vex.class, this.vexCountTargeting, Evoker.this, Evoker.this.getBoundingBox().inflate(16.0)) + .size(); return Evoker.this.random.nextInt(8) + 1 > i; } } @@ -260,10 +257,10 @@ public class Evoker extends SpellcasterIllager { for (int i = 0; i < 3; i++) { BlockPos blockPos = Evoker.this.blockPosition().offset(-2 + Evoker.this.random.nextInt(5), 1, -2 + Evoker.this.random.nextInt(5)); - Vex vex = EntityType.VEX.create(Evoker.this.level()); + Vex vex = EntityType.VEX.create(Evoker.this.level(), EntitySpawnReason.MOB_SUMMONED); if (vex != null) { vex.moveTo(blockPos, 0.0F, 0.0F); - vex.finalizeSpawn(serverLevel, Evoker.this.level().getCurrentDifficultyAt(blockPos), MobSpawnType.MOB_SUMMONED, null); + vex.finalizeSpawn(serverLevel, Evoker.this.level().getCurrentDifficultyAt(blockPos), EntitySpawnReason.MOB_SUMMONED, null); vex.setOwner(Evoker.this); vex.setBoundOrigin(blockPos); vex.setLimitedLife(20 * (30 + Evoker.this.random.nextInt(90))); @@ -272,7 +269,7 @@ public class Evoker extends SpellcasterIllager { } serverLevel.addFreshEntityWithPassengers(vex); - serverLevel.gameEvent(GameEvent.ENTITY_PLACE, blockPos, GameEvent.Context.of(Evoker.this)); + serverLevel.gameEvent(GameEvent.ENTITY_PLACE, blockPos, Context.of(Evoker.this)); } } } @@ -291,7 +288,7 @@ public class Evoker extends SpellcasterIllager { public class EvokerWololoSpellGoal extends SpellcasterIllager.SpellcasterUseSpellGoal { private final TargetingConditions wololoTargeting = TargetingConditions.forNonCombat() .range(16.0) - .selector(livingEntity -> ((Sheep)livingEntity).getColor() == DyeColor.BLUE); + .selector((livingEntity, serverLevel) -> ((Sheep)livingEntity).getColor() == DyeColor.BLUE); @Override public boolean canUse() { @@ -301,16 +298,18 @@ public class Evoker extends SpellcasterIllager { return false; } else if (Evoker.this.tickCount < this.nextAttackTickCount) { return false; - } else if (!Evoker.this.level().getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { - return false; } else { - List list = Evoker.this.level() - .getNearbyEntities(Sheep.class, this.wololoTargeting, Evoker.this, Evoker.this.getBoundingBox().inflate(16.0, 4.0, 16.0)); - if (list.isEmpty()) { + ServerLevel serverLevel = getServerLevel(Evoker.this.level()); + if (!serverLevel.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { return false; } else { - Evoker.this.setWololoTarget((Sheep)list.get(Evoker.this.random.nextInt(list.size()))); - return true; + List list = serverLevel.getNearbyEntities(Sheep.class, this.wololoTargeting, Evoker.this, Evoker.this.getBoundingBox().inflate(16.0, 4.0, 16.0)); + if (list.isEmpty()) { + return false; + } else { + Evoker.this.setWololoTarget((Sheep)list.get(Evoker.this.random.nextInt(list.size()))); + return true; + } } } } diff --git a/net/minecraft/world/entity/monster/Ghast.java b/net/minecraft/world/entity/monster/Ghast.java index aa619679..c277273a 100644 --- a/net/minecraft/world/entity/monster/Ghast.java +++ b/net/minecraft/world/entity/monster/Ghast.java @@ -6,6 +6,8 @@ import net.minecraft.nbt.CompoundTag; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.network.syncher.SynchedEntityData.Builder; +import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; @@ -14,12 +16,11 @@ import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; import net.minecraft.world.Difficulty; import net.minecraft.world.damagesource.DamageSource; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.FlyingMob; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.Mob; -import net.minecraft.world.entity.MobSpawnType; -import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.entity.ai.control.MoveControl; import net.minecraft.world.entity.ai.goal.Goal; @@ -47,7 +48,9 @@ public class Ghast extends FlyingMob implements Enemy { this.goalSelector.addGoal(7, new Ghast.GhastLookGoal(this)); this.goalSelector.addGoal(7, new Ghast.GhastShootFireballGoal(this)); this.targetSelector - .addGoal(1, new NearestAttackableTargetGoal(this, Player.class, 10, true, false, livingEntity -> Math.abs(livingEntity.getY() - this.getY()) <= 4.0)); + .addGoal( + 1, new NearestAttackableTargetGoal(this, Player.class, 10, true, false, (livingEntity, serverLevel) -> Math.abs(livingEntity.getY() - this.getY()) <= 4.0) + ); } public boolean isCharging() { @@ -72,27 +75,28 @@ public class Ghast extends FlyingMob implements Enemy { } @Override - public boolean isInvulnerableTo(DamageSource source) { - return this.isInvulnerable() && !source.is(DamageTypeTags.BYPASSES_INVULNERABILITY) || !isReflectedFireball(source) && super.isInvulnerableTo(source); + public boolean isInvulnerableTo(ServerLevel serverLevel, DamageSource damageSource) { + return this.isInvulnerable() && !damageSource.is(DamageTypeTags.BYPASSES_INVULNERABILITY) + || !isReflectedFireball(damageSource) && super.isInvulnerableTo(serverLevel, damageSource); } @Override - public boolean hurt(DamageSource source, float amount) { - if (isReflectedFireball(source)) { - super.hurt(source, 1000.0F); + public boolean hurtServer(ServerLevel serverLevel, DamageSource damageSource, float f) { + if (isReflectedFireball(damageSource)) { + super.hurtServer(serverLevel, damageSource, 1000.0F); return true; } else { - return this.isInvulnerableTo(source) ? false : super.hurt(source, amount); + return this.isInvulnerableTo(serverLevel, damageSource) ? false : super.hurtServer(serverLevel, damageSource, f); } } @Override - protected void defineSynchedData(SynchedEntityData.Builder builder) { + protected void defineSynchedData(Builder builder) { super.defineSynchedData(builder); builder.define(DATA_IS_CHARGING, false); } - public static AttributeSupplier.Builder createAttributes() { + public static net.minecraft.world.entity.ai.attributes.AttributeSupplier.Builder createAttributes() { return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 10.0).add(Attributes.FOLLOW_RANGE, 100.0); } @@ -121,8 +125,12 @@ public class Ghast extends FlyingMob implements Enemy { return 5.0F; } - public static boolean checkGhastSpawnRules(EntityType ghast, LevelAccessor level, MobSpawnType spawnType, BlockPos pos, RandomSource random) { - return level.getDifficulty() != Difficulty.PEACEFUL && random.nextInt(20) == 0 && checkMobSpawnRules(ghast, level, spawnType, pos, random); + public static boolean checkGhastSpawnRules( + EntityType entityType, LevelAccessor levelAccessor, EntitySpawnReason entitySpawnReason, BlockPos blockPos, RandomSource randomSource + ) { + return levelAccessor.getDifficulty() != Difficulty.PEACEFUL + && randomSource.nextInt(20) == 0 + && checkMobSpawnRules(entityType, levelAccessor, entitySpawnReason, blockPos, randomSource); } @Override diff --git a/net/minecraft/world/entity/monster/Giant.java b/net/minecraft/world/entity/monster/Giant.java index c8e67db4..430745e6 100644 --- a/net/minecraft/world/entity/monster/Giant.java +++ b/net/minecraft/world/entity/monster/Giant.java @@ -2,8 +2,8 @@ package net.minecraft.world.entity.monster; import net.minecraft.core.BlockPos; import net.minecraft.world.entity.EntityType; -import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.entity.ai.attributes.AttributeSupplier.Builder; import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelReader; @@ -12,7 +12,7 @@ public class Giant extends Monster { super(entityType, level); } - public static AttributeSupplier.Builder createAttributes() { + public static Builder createAttributes() { return Monster.createMonsterAttributes().add(Attributes.MAX_HEALTH, 100.0).add(Attributes.MOVEMENT_SPEED, 0.5).add(Attributes.ATTACK_DAMAGE, 50.0); } diff --git a/net/minecraft/world/entity/monster/Guardian.java b/net/minecraft/world/entity/monster/Guardian.java index d7ebde66..713cb79f 100644 --- a/net/minecraft/world/entity/monster/Guardian.java +++ b/net/minecraft/world/entity/monster/Guardian.java @@ -1,12 +1,12 @@ package net.minecraft.world.entity.monster; import java.util.EnumSet; -import java.util.function.Predicate; import net.minecraft.core.BlockPos; import net.minecraft.core.particles.ParticleTypes; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; import net.minecraft.tags.DamageTypeTags; @@ -17,12 +17,12 @@ import net.minecraft.world.Difficulty; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.damagesource.DamageTypes; import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.entity.MobSpawnType; import net.minecraft.world.entity.MoverType; -import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.entity.ai.attributes.AttributeSupplier.Builder; import net.minecraft.world.entity.ai.control.LookControl; import net.minecraft.world.entity.ai.control.MoveControl; import net.minecraft.world.entity.ai.goal.Goal; @@ -33,6 +33,7 @@ import net.minecraft.world.entity.ai.goal.RandomStrollGoal; import net.minecraft.world.entity.ai.goal.target.NearestAttackableTargetGoal; import net.minecraft.world.entity.ai.navigation.PathNavigation; import net.minecraft.world.entity.ai.navigation.WaterBoundPathNavigation; +import net.minecraft.world.entity.ai.targeting.TargetingConditions; import net.minecraft.world.entity.animal.Squid; import net.minecraft.world.entity.animal.axolotl.Axolotl; import net.minecraft.world.entity.player.Player; @@ -83,12 +84,8 @@ public class Guardian extends Monster { this.targetSelector.addGoal(1, new NearestAttackableTargetGoal(this, LivingEntity.class, 10, true, false, new Guardian.GuardianAttackSelector(this))); } - public static AttributeSupplier.Builder createAttributes() { - return Monster.createMonsterAttributes() - .add(Attributes.ATTACK_DAMAGE, 6.0) - .add(Attributes.MOVEMENT_SPEED, 0.5) - .add(Attributes.FOLLOW_RANGE, 16.0) - .add(Attributes.MAX_HEALTH, 30.0); + public static Builder createAttributes() { + return Monster.createMonsterAttributes().add(Attributes.ATTACK_DAMAGE, 6.0).add(Attributes.MOVEMENT_SPEED, 0.5).add(Attributes.MAX_HEALTH, 30.0); } @Override @@ -97,7 +94,7 @@ public class Guardian extends Monster { } @Override - protected void defineSynchedData(SynchedEntityData.Builder builder) { + protected void defineSynchedData(net.minecraft.network.syncher.SynchedEntityData.Builder builder) { super.defineSynchedData(builder); builder.define(DATA_ID_MOVING, false); builder.define(DATA_ID_ATTACK_TARGET, 0); @@ -297,32 +294,28 @@ public class Guardian extends Monster { } public static boolean checkGuardianSpawnRules( - EntityType guardian, LevelAccessor level, MobSpawnType spawnType, BlockPos pos, RandomSource random + EntityType entityType, LevelAccessor levelAccessor, EntitySpawnReason entitySpawnReason, BlockPos blockPos, RandomSource randomSource ) { - return (random.nextInt(20) == 0 || !level.canSeeSkyFromBelowWater(pos)) - && level.getDifficulty() != Difficulty.PEACEFUL - && (MobSpawnType.isSpawner(spawnType) || level.getFluidState(pos).is(FluidTags.WATER)) - && level.getFluidState(pos.below()).is(FluidTags.WATER); + return (randomSource.nextInt(20) == 0 || !levelAccessor.canSeeSkyFromBelowWater(blockPos)) + && levelAccessor.getDifficulty() != Difficulty.PEACEFUL + && (EntitySpawnReason.isSpawner(entitySpawnReason) || levelAccessor.getFluidState(blockPos).is(FluidTags.WATER)) + && levelAccessor.getFluidState(blockPos.below()).is(FluidTags.WATER); } @Override - public boolean hurt(DamageSource source, float amount) { - if (this.level().isClientSide) { - return false; - } else { - if (!this.isMoving() - && !source.is(DamageTypeTags.AVOIDS_GUARDIAN_THORNS) - && !source.is(DamageTypes.THORNS) - && source.getDirectEntity() instanceof LivingEntity livingEntity) { - livingEntity.hurt(this.damageSources().thorns(this), 2.0F); - } - - if (this.randomStrollGoal != null) { - this.randomStrollGoal.trigger(); - } - - return super.hurt(source, amount); + public boolean hurtServer(ServerLevel serverLevel, DamageSource damageSource, float f) { + if (!this.isMoving() + && !damageSource.is(DamageTypeTags.AVOIDS_GUARDIAN_THORNS) + && !damageSource.is(DamageTypes.THORNS) + && damageSource.getDirectEntity() instanceof LivingEntity livingEntity) { + livingEntity.hurtServer(serverLevel, this.damageSources().thorns(this), 2.0F); } + + if (this.randomStrollGoal != null) { + this.randomStrollGoal.trigger(); + } + + return super.hurtServer(serverLevel, damageSource, f); } @Override @@ -415,8 +408,9 @@ public class Guardian extends Monster { f += 2.0F; } - livingEntity.hurt(this.guardian.damageSources().indirectMagic(this.guardian, this.guardian), f); - this.guardian.doHurtTarget(livingEntity); + ServerLevel serverLevel = getServerLevel(this.guardian); + livingEntity.hurtServer(serverLevel, this.guardian.damageSources().indirectMagic(this.guardian, this.guardian), f); + this.guardian.doHurtTarget(serverLevel, livingEntity); this.guardian.setTarget(null); } @@ -426,15 +420,17 @@ public class Guardian extends Monster { } } - static class GuardianAttackSelector implements Predicate { + static class GuardianAttackSelector implements TargetingConditions.Selector { private final Guardian guardian; public GuardianAttackSelector(Guardian guardian) { this.guardian = guardian; } - public boolean test(@Nullable LivingEntity entity) { - return (entity instanceof Player || entity instanceof Squid || entity instanceof Axolotl) && entity.distanceToSqr(this.guardian) > 9.0; + @Override + public boolean test(@Nullable LivingEntity livingEntity, ServerLevel serverLevel) { + return (livingEntity instanceof Player || livingEntity instanceof Squid || livingEntity instanceof Axolotl) + && livingEntity.distanceToSqr(this.guardian) > 9.0; } } diff --git a/net/minecraft/world/entity/monster/Husk.java b/net/minecraft/world/entity/monster/Husk.java index 628af907..487e7ba0 100644 --- a/net/minecraft/world/entity/monster/Husk.java +++ b/net/minecraft/world/entity/monster/Husk.java @@ -1,6 +1,7 @@ package net.minecraft.world.entity.monster; import net.minecraft.core.BlockPos; +import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; import net.minecraft.util.RandomSource; @@ -8,9 +9,9 @@ import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.effect.MobEffectInstance; import net.minecraft.world.effect.MobEffects; import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.entity.MobSpawnType; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; import net.minecraft.world.level.ServerLevelAccessor; @@ -20,8 +21,11 @@ public class Husk extends Zombie { super(entityType, level); } - public static boolean checkHuskSpawnRules(EntityType husk, ServerLevelAccessor level, MobSpawnType spawnType, BlockPos pos, RandomSource random) { - return checkMonsterSpawnRules(husk, level, spawnType, pos, random) && (MobSpawnType.isSpawner(spawnType) || level.canSeeSky(pos)); + public static boolean checkHuskSpawnRules( + EntityType entityType, ServerLevelAccessor serverLevelAccessor, EntitySpawnReason entitySpawnReason, BlockPos blockPos, RandomSource randomSource + ) { + return checkMonsterSpawnRules(entityType, serverLevelAccessor, entitySpawnReason, blockPos, randomSource) + && (EntitySpawnReason.isSpawner(entitySpawnReason) || serverLevelAccessor.canSeeSky(blockPos)); } @Override @@ -50,11 +54,11 @@ public class Husk extends Zombie { } @Override - public boolean doHurtTarget(Entity target) { - boolean bl = super.doHurtTarget(target); - if (bl && this.getMainHandItem().isEmpty() && target instanceof LivingEntity) { + public boolean doHurtTarget(ServerLevel serverLevel, Entity entity) { + boolean bl = super.doHurtTarget(serverLevel, entity); + if (bl && this.getMainHandItem().isEmpty() && entity instanceof LivingEntity) { float f = this.level().getCurrentDifficultyAt(this.blockPosition()).getEffectiveDifficulty(); - ((LivingEntity)target).addEffect(new MobEffectInstance(MobEffects.HUNGER, 140 * (int)f), this); + ((LivingEntity)entity).addEffect(new MobEffectInstance(MobEffects.HUNGER, 140 * (int)f), this); } return bl; diff --git a/net/minecraft/world/entity/monster/Illusioner.java b/net/minecraft/world/entity/monster/Illusioner.java index 83d02066..9bbd4b80 100644 --- a/net/minecraft/world/entity/monster/Illusioner.java +++ b/net/minecraft/world/entity/monster/Illusioner.java @@ -9,14 +9,15 @@ import net.minecraft.world.DifficultyInstance; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.effect.MobEffectInstance; import net.minecraft.world.effect.MobEffects; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.Mob; -import net.minecraft.world.entity.MobSpawnType; import net.minecraft.world.entity.SpawnGroupData; -import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.entity.ai.attributes.AttributeSupplier.Builder; +import net.minecraft.world.entity.ai.goal.AvoidEntityGoal; import net.minecraft.world.entity.ai.goal.FloatGoal; import net.minecraft.world.entity.ai.goal.LookAtPlayerGoal; import net.minecraft.world.entity.ai.goal.RandomStrollGoal; @@ -24,23 +25,24 @@ import net.minecraft.world.entity.ai.goal.RangedBowAttackGoal; import net.minecraft.world.entity.ai.goal.target.HurtByTargetGoal; import net.minecraft.world.entity.ai.goal.target.NearestAttackableTargetGoal; import net.minecraft.world.entity.animal.IronGolem; +import net.minecraft.world.entity.monster.creaking.Creaking; import net.minecraft.world.entity.npc.AbstractVillager; import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.projectile.AbstractArrow; +import net.minecraft.world.entity.projectile.Projectile; import net.minecraft.world.entity.projectile.ProjectileUtil; import net.minecraft.world.entity.raid.Raider; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.level.Level; import net.minecraft.world.level.ServerLevelAccessor; -import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.Vec3; import org.jetbrains.annotations.Nullable; public class Illusioner extends SpellcasterIllager implements RangedAttackMob { private static final int NUM_ILLUSIONS = 4; private static final int ILLUSION_TRANSITION_TICKS = 3; - private static final int ILLUSION_SPREAD = 3; + public static final int ILLUSION_SPREAD = 3; private int clientSideIllusionTicks; private final Vec3[][] clientSideIllusionOffsets; @@ -60,6 +62,7 @@ public class Illusioner extends SpellcasterIllager implements RangedAttackMob { super.registerGoals(); this.goalSelector.addGoal(0, new FloatGoal(this)); this.goalSelector.addGoal(1, new SpellcasterIllager.SpellcasterCastingSpellGoal()); + this.goalSelector.addGoal(3, new AvoidEntityGoal(this, Creaking.class, 8.0F, 1.0, 1.2)); this.goalSelector.addGoal(4, new Illusioner.IllusionerMirrorSpellGoal()); this.goalSelector.addGoal(5, new Illusioner.IllusionerBlindnessSpellGoal()); this.goalSelector.addGoal(6, new RangedBowAttackGoal<>(this, 0.5, 20, 15.0F)); @@ -72,19 +75,16 @@ public class Illusioner extends SpellcasterIllager implements RangedAttackMob { this.targetSelector.addGoal(3, new NearestAttackableTargetGoal(this, IronGolem.class, false).setUnseenMemoryTicks(300)); } - public static AttributeSupplier.Builder createAttributes() { + public static Builder createAttributes() { return Monster.createMonsterAttributes().add(Attributes.MOVEMENT_SPEED, 0.5).add(Attributes.FOLLOW_RANGE, 18.0).add(Attributes.MAX_HEALTH, 32.0); } @Override - public SpawnGroupData finalizeSpawn(ServerLevelAccessor level, DifficultyInstance difficulty, MobSpawnType spawnType, @Nullable SpawnGroupData spawnGroupData) { + public SpawnGroupData finalizeSpawn( + ServerLevelAccessor serverLevelAccessor, DifficultyInstance difficultyInstance, EntitySpawnReason entitySpawnReason, @Nullable SpawnGroupData spawnGroupData + ) { this.setItemSlot(EquipmentSlot.MAINHAND, new ItemStack(Items.BOW)); - return super.finalizeSpawn(level, difficulty, spawnType, spawnGroupData); - } - - @Override - public AABB getBoundingBoxForCulling() { - return this.getBoundingBox().inflate(3.0, 0.0, 3.0); + return super.finalizeSpawn(serverLevelAccessor, difficultyInstance, entitySpawnReason, spawnGroupData); } @Override @@ -178,9 +178,11 @@ public class Illusioner extends SpellcasterIllager implements RangedAttackMob { double e = target.getY(0.3333333333333333) - abstractArrow.getY(); double f = target.getZ() - this.getZ(); double g = Math.sqrt(d * d + f * f); - abstractArrow.shoot(d, e + g * 0.2F, f, 1.6F, 14 - this.level().getDifficulty().getId() * 4); + if (this.level() instanceof ServerLevel serverLevel) { + Projectile.spawnProjectileUsingShoot(abstractArrow, serverLevel, itemStack2, d, e + g * 0.2F, f, 1.6F, 14 - serverLevel.getDifficulty().getId() * 4); + } + this.playSound(SoundEvents.SKELETON_SHOOT, 1.0F, 1.0F / (this.getRandom().nextFloat() * 0.4F + 0.8F)); - this.level().addFreshEntity(abstractArrow); } @Override diff --git a/net/minecraft/world/entity/monster/MagmaCube.java b/net/minecraft/world/entity/monster/MagmaCube.java index 5c48ab68..90521238 100644 --- a/net/minecraft/world/entity/monster/MagmaCube.java +++ b/net/minecraft/world/entity/monster/MagmaCube.java @@ -10,10 +10,10 @@ import net.minecraft.tags.TagKey; import net.minecraft.util.RandomSource; import net.minecraft.world.Difficulty; import net.minecraft.world.damagesource.DamageSource; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; -import net.minecraft.world.entity.MobSpawnType; -import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.entity.ai.attributes.AttributeSupplier.Builder; import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.material.Fluid; @@ -24,12 +24,14 @@ public class MagmaCube extends Slime { super(entityType, level); } - public static AttributeSupplier.Builder createAttributes() { + public static Builder createAttributes() { return Monster.createMonsterAttributes().add(Attributes.MOVEMENT_SPEED, 0.2F); } - public static boolean checkMagmaCubeSpawnRules(EntityType magmaCube, LevelAccessor level, MobSpawnType spawnType, BlockPos pos, RandomSource random) { - return level.getDifficulty() != Difficulty.PEACEFUL; + public static boolean checkMagmaCubeSpawnRules( + EntityType entityType, LevelAccessor levelAccessor, EntitySpawnReason entitySpawnReason, BlockPos blockPos, RandomSource randomSource + ) { + return levelAccessor.getDifficulty() != Difficulty.PEACEFUL; } @Override diff --git a/net/minecraft/world/entity/monster/Monster.java b/net/minecraft/world/entity/monster/Monster.java index 2393da16..eabf799d 100644 --- a/net/minecraft/world/entity/monster/Monster.java +++ b/net/minecraft/world/entity/monster/Monster.java @@ -2,19 +2,20 @@ package net.minecraft.world.entity.monster; import java.util.function.Predicate; import net.minecraft.core.BlockPos; +import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; import net.minecraft.util.RandomSource; import net.minecraft.world.Difficulty; import net.minecraft.world.damagesource.DamageSource; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.Mob; -import net.minecraft.world.entity.MobSpawnType; import net.minecraft.world.entity.PathfinderMob; -import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.entity.ai.attributes.AttributeSupplier.Builder; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; @@ -104,27 +105,25 @@ public abstract class Monster extends PathfinderMob implements Enemy { } } - /** - * Static predicate for determining whether a monster can spawn at the provided location, incorporating a check of the current light level at the location. - */ public static boolean checkMonsterSpawnRules( - EntityType type, ServerLevelAccessor level, MobSpawnType spawnType, BlockPos pos, RandomSource random + EntityType entityType, + ServerLevelAccessor serverLevelAccessor, + EntitySpawnReason entitySpawnReason, + BlockPos blockPos, + RandomSource randomSource ) { - return level.getDifficulty() != Difficulty.PEACEFUL - && (MobSpawnType.ignoresLightRequirements(spawnType) || isDarkEnoughToSpawn(level, pos, random)) - && checkMobSpawnRules(type, level, spawnType, pos, random); + return serverLevelAccessor.getDifficulty() != Difficulty.PEACEFUL + && (EntitySpawnReason.ignoresLightRequirements(entitySpawnReason) || isDarkEnoughToSpawn(serverLevelAccessor, blockPos, randomSource)) + && checkMobSpawnRules(entityType, serverLevelAccessor, entitySpawnReason, blockPos, randomSource); } - /** - * Static predicate for determining whether a monster can spawn at the provided location. - */ public static boolean checkAnyLightMonsterSpawnRules( - EntityType type, LevelAccessor level, MobSpawnType spawnType, BlockPos pos, RandomSource random + EntityType entityType, LevelAccessor levelAccessor, EntitySpawnReason entitySpawnReason, BlockPos blockPos, RandomSource randomSource ) { - return level.getDifficulty() != Difficulty.PEACEFUL && checkMobSpawnRules(type, level, spawnType, pos, random); + return levelAccessor.getDifficulty() != Difficulty.PEACEFUL && checkMobSpawnRules(entityType, levelAccessor, entitySpawnReason, blockPos, randomSource); } - public static AttributeSupplier.Builder createMonsterAttributes() { + public static Builder createMonsterAttributes() { return Mob.createMobAttributes().add(Attributes.ATTACK_DAMAGE); } @@ -138,7 +137,7 @@ public abstract class Monster extends PathfinderMob implements Enemy { return true; } - public boolean isPreventingPlayerRest(Player player) { + public boolean isPreventingPlayerRest(ServerLevel serverLevel, Player player) { return true; } diff --git a/net/minecraft/world/entity/monster/PatrollingMonster.java b/net/minecraft/world/entity/monster/PatrollingMonster.java index 72efb4a9..f8e3a343 100644 --- a/net/minecraft/world/entity/monster/PatrollingMonster.java +++ b/net/minecraft/world/entity/monster/PatrollingMonster.java @@ -8,9 +8,9 @@ import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.NbtUtils; import net.minecraft.util.RandomSource; import net.minecraft.world.DifficultyInstance; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.EquipmentSlot; -import net.minecraft.world.entity.MobSpawnType; import net.minecraft.world.entity.SpawnGroupData; import net.minecraft.world.entity.ai.goal.Goal; import net.minecraft.world.entity.ai.navigation.PathNavigation; @@ -64,31 +64,39 @@ public abstract class PatrollingMonster extends Monster { @Nullable @Override - public SpawnGroupData finalizeSpawn(ServerLevelAccessor level, DifficultyInstance difficulty, MobSpawnType spawnType, @Nullable SpawnGroupData spawnGroupData) { - if (spawnType != MobSpawnType.PATROL - && spawnType != MobSpawnType.EVENT - && spawnType != MobSpawnType.STRUCTURE - && level.getRandom().nextFloat() < 0.06F + public SpawnGroupData finalizeSpawn( + ServerLevelAccessor serverLevelAccessor, DifficultyInstance difficultyInstance, EntitySpawnReason entitySpawnReason, @Nullable SpawnGroupData spawnGroupData + ) { + if (entitySpawnReason != EntitySpawnReason.PATROL + && entitySpawnReason != EntitySpawnReason.EVENT + && entitySpawnReason != EntitySpawnReason.STRUCTURE + && serverLevelAccessor.getRandom().nextFloat() < 0.06F && this.canBeLeader()) { this.patrolLeader = true; } if (this.isPatrolLeader()) { - this.setItemSlot(EquipmentSlot.HEAD, Raid.getLeaderBannerInstance(this.registryAccess().lookupOrThrow(Registries.BANNER_PATTERN))); + this.setItemSlot(EquipmentSlot.HEAD, Raid.getOminousBannerInstance(this.registryAccess().lookupOrThrow(Registries.BANNER_PATTERN))); this.setDropChance(EquipmentSlot.HEAD, 2.0F); } - if (spawnType == MobSpawnType.PATROL) { + if (entitySpawnReason == EntitySpawnReason.PATROL) { this.patrolling = true; } - return super.finalizeSpawn(level, difficulty, spawnType, spawnGroupData); + return super.finalizeSpawn(serverLevelAccessor, difficultyInstance, entitySpawnReason, spawnGroupData); } public static boolean checkPatrollingMonsterSpawnRules( - EntityType patrollingMonster, LevelAccessor level, MobSpawnType spawnType, BlockPos pos, RandomSource random + EntityType entityType, + LevelAccessor levelAccessor, + EntitySpawnReason entitySpawnReason, + BlockPos blockPos, + RandomSource randomSource ) { - return level.getBrightness(LightLayer.BLOCK, pos) > 8 ? false : checkAnyLightMonsterSpawnRules(patrollingMonster, level, spawnType, pos, random); + return levelAccessor.getBrightness(LightLayer.BLOCK, blockPos) > 8 + ? false + : checkAnyLightMonsterSpawnRules(entityType, levelAccessor, entitySpawnReason, blockPos, randomSource); } @Override diff --git a/net/minecraft/world/entity/monster/Phantom.java b/net/minecraft/world/entity/monster/Phantom.java index 464a4cc3..9f3af96d 100644 --- a/net/minecraft/world/entity/monster/Phantom.java +++ b/net/minecraft/world/entity/monster/Phantom.java @@ -9,6 +9,8 @@ import net.minecraft.nbt.CompoundTag; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.network.syncher.SynchedEntityData.Builder; +import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; @@ -18,11 +20,11 @@ import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityDimensions; import net.minecraft.world.entity.EntitySelector; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.FlyingMob; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.Mob; -import net.minecraft.world.entity.MobSpawnType; import net.minecraft.world.entity.Pose; import net.minecraft.world.entity.SpawnGroupData; import net.minecraft.world.entity.ai.attributes.Attributes; @@ -73,7 +75,7 @@ public class Phantom extends FlyingMob implements Enemy { } @Override - protected void defineSynchedData(SynchedEntityData.Builder builder) { + protected void defineSynchedData(Builder builder) { super.defineSynchedData(builder); builder.define(ID_SIZE, 0); } @@ -148,15 +150,12 @@ public class Phantom extends FlyingMob implements Enemy { } @Override - protected void customServerAiStep() { - super.customServerAiStep(); - } - - @Override - public SpawnGroupData finalizeSpawn(ServerLevelAccessor level, DifficultyInstance difficulty, MobSpawnType spawnType, @Nullable SpawnGroupData spawnGroupData) { + public SpawnGroupData finalizeSpawn( + ServerLevelAccessor serverLevelAccessor, DifficultyInstance difficultyInstance, EntitySpawnReason entitySpawnReason, @Nullable SpawnGroupData spawnGroupData + ) { this.anchorPoint = this.blockPosition().above(5); this.setPhantomSize(0); - return super.finalizeSpawn(level, difficulty, spawnType, spawnGroupData); + return super.finalizeSpawn(serverLevelAccessor, difficultyInstance, entitySpawnReason, spawnGroupData); } @Override @@ -220,6 +219,10 @@ public class Phantom extends FlyingMob implements Enemy { return entityDimensions.scale(1.0F + 0.15F * i); } + boolean canAttack(ServerLevel serverLevel, LivingEntity livingEntity, TargetingConditions targetingConditions) { + return targetingConditions.test(serverLevel, this, livingEntity); + } + static enum AttackPhase { CIRCLE, SWOOP; @@ -236,12 +239,13 @@ public class Phantom extends FlyingMob implements Enemy { return false; } else { this.nextScanTick = reducedTickDelay(60); - List list = Phantom.this.level().getNearbyPlayers(this.attackTargeting, Phantom.this, Phantom.this.getBoundingBox().inflate(16.0, 64.0, 16.0)); + ServerLevel serverLevel = getServerLevel(Phantom.this.level()); + List list = serverLevel.getNearbyPlayers(this.attackTargeting, Phantom.this, Phantom.this.getBoundingBox().inflate(16.0, 64.0, 16.0)); if (!list.isEmpty()) { list.sort(Comparator.comparing(Entity::getY).reversed()); for (Player player : list) { - if (Phantom.this.canAttack(player, TargetingConditions.DEFAULT)) { + if (Phantom.this.canAttack(serverLevel, player, TargetingConditions.DEFAULT)) { Phantom.this.setTarget(player); return true; } @@ -255,7 +259,7 @@ public class Phantom extends FlyingMob implements Enemy { @Override public boolean canContinueToUse() { LivingEntity livingEntity = Phantom.this.getTarget(); - return livingEntity != null ? Phantom.this.canAttack(livingEntity, TargetingConditions.DEFAULT) : false; + return livingEntity != null ? Phantom.this.canAttack(getServerLevel(Phantom.this.level()), livingEntity, TargetingConditions.DEFAULT) : false; } } @@ -265,7 +269,7 @@ public class Phantom extends FlyingMob implements Enemy { @Override public boolean canUse() { LivingEntity livingEntity = Phantom.this.getTarget(); - return livingEntity != null ? Phantom.this.canAttack(livingEntity, TargetingConditions.DEFAULT) : false; + return livingEntity != null ? Phantom.this.canAttack(getServerLevel(Phantom.this.level()), livingEntity, TargetingConditions.DEFAULT) : false; } @Override @@ -500,7 +504,7 @@ public class Phantom extends FlyingMob implements Enemy { if (livingEntity != null) { Phantom.this.moveTargetPoint = new Vec3(livingEntity.getX(), livingEntity.getY(0.5), livingEntity.getZ()); if (Phantom.this.getBoundingBox().inflate(0.2F).intersects(livingEntity.getBoundingBox())) { - Phantom.this.doHurtTarget(livingEntity); + Phantom.this.doHurtTarget(getServerLevel(Phantom.this.level()), livingEntity); Phantom.this.attackPhase = Phantom.AttackPhase.CIRCLE; if (!Phantom.this.isSilent()) { Phantom.this.level().levelEvent(1039, Phantom.this.blockPosition(), 0); diff --git a/net/minecraft/world/entity/monster/Pillager.java b/net/minecraft/world/entity/monster/Pillager.java index fdc52b1b..f9b590d0 100644 --- a/net/minecraft/world/entity/monster/Pillager.java +++ b/net/minecraft/world/entity/monster/Pillager.java @@ -14,15 +14,16 @@ import net.minecraft.world.Difficulty; import net.minecraft.world.DifficultyInstance; import net.minecraft.world.SimpleContainer; import net.minecraft.world.damagesource.DamageSource; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.Mob; -import net.minecraft.world.entity.MobSpawnType; import net.minecraft.world.entity.SlotAccess; import net.minecraft.world.entity.SpawnGroupData; -import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.entity.ai.attributes.AttributeSupplier.Builder; +import net.minecraft.world.entity.ai.goal.AvoidEntityGoal; import net.minecraft.world.entity.ai.goal.FloatGoal; import net.minecraft.world.entity.ai.goal.LookAtPlayerGoal; import net.minecraft.world.entity.ai.goal.RandomStrollGoal; @@ -31,6 +32,7 @@ import net.minecraft.world.entity.ai.goal.target.HurtByTargetGoal; import net.minecraft.world.entity.ai.goal.target.NearestAttackableTargetGoal; import net.minecraft.world.entity.animal.IronGolem; import net.minecraft.world.entity.item.ItemEntity; +import net.minecraft.world.entity.monster.creaking.Creaking; import net.minecraft.world.entity.npc.AbstractVillager; import net.minecraft.world.entity.npc.InventoryCarrier; import net.minecraft.world.entity.player.Player; @@ -62,6 +64,7 @@ public class Pillager extends AbstractIllager implements CrossbowAttackMob, Inve protected void registerGoals() { super.registerGoals(); this.goalSelector.addGoal(0, new FloatGoal(this)); + this.goalSelector.addGoal(1, new AvoidEntityGoal(this, Creaking.class, 8.0F, 1.0, 1.2)); this.goalSelector.addGoal(2, new Raider.HoldGroundAttackGoal(this, 10.0F)); this.goalSelector.addGoal(3, new RangedCrossbowAttackGoal<>(this, 1.0, 8.0F)); this.goalSelector.addGoal(8, new RandomStrollGoal(this, 0.6)); @@ -73,7 +76,7 @@ public class Pillager extends AbstractIllager implements CrossbowAttackMob, Inve this.targetSelector.addGoal(3, new NearestAttackableTargetGoal(this, IronGolem.class, true)); } - public static AttributeSupplier.Builder createAttributes() { + public static Builder createAttributes() { return Monster.createMonsterAttributes() .add(Attributes.MOVEMENT_SPEED, 0.35F) .add(Attributes.MAX_HEALTH, 24.0) @@ -82,7 +85,7 @@ public class Pillager extends AbstractIllager implements CrossbowAttackMob, Inve } @Override - protected void defineSynchedData(SynchedEntityData.Builder builder) { + protected void defineSynchedData(net.minecraft.network.syncher.SynchedEntityData.Builder builder) { super.defineSynchedData(builder); builder.define(IS_CHARGING_CROSSBOW, false); } @@ -142,11 +145,13 @@ public class Pillager extends AbstractIllager implements CrossbowAttackMob, Inve @Nullable @Override - public SpawnGroupData finalizeSpawn(ServerLevelAccessor level, DifficultyInstance difficulty, MobSpawnType spawnType, @Nullable SpawnGroupData spawnGroupData) { - RandomSource randomSource = level.getRandom(); - this.populateDefaultEquipmentSlots(randomSource, difficulty); - this.populateDefaultEquipmentEnchantments(level, randomSource, difficulty); - return super.finalizeSpawn(level, difficulty, spawnType, spawnGroupData); + public SpawnGroupData finalizeSpawn( + ServerLevelAccessor serverLevelAccessor, DifficultyInstance difficultyInstance, EntitySpawnReason entitySpawnReason, @Nullable SpawnGroupData spawnGroupData + ) { + RandomSource randomSource = serverLevelAccessor.getRandom(); + this.populateDefaultEquipmentSlots(randomSource, difficultyInstance); + this.populateDefaultEquipmentEnchantments(serverLevelAccessor, randomSource, difficultyInstance); + return super.finalizeSpawn(serverLevelAccessor, difficultyInstance, entitySpawnReason, spawnGroupData); } @Override @@ -191,10 +196,10 @@ public class Pillager extends AbstractIllager implements CrossbowAttackMob, Inve } @Override - protected void pickUpItem(ItemEntity itemEntity) { + protected void pickUpItem(ServerLevel serverLevel, ItemEntity itemEntity) { ItemStack itemStack = itemEntity.getItem(); if (itemStack.getItem() instanceof BannerItem) { - super.pickUpItem(itemEntity); + super.pickUpItem(serverLevel, itemEntity); } else if (this.wantsItem(itemStack)) { this.onItemPickup(itemEntity); ItemStack itemStack2 = this.inventory.addItem(itemStack); diff --git a/net/minecraft/world/entity/monster/Ravager.java b/net/minecraft/world/entity/monster/Ravager.java index 578cf169..8f4b48bc 100644 --- a/net/minecraft/world/entity/monster/Ravager.java +++ b/net/minecraft/world/entity/monster/Ravager.java @@ -15,8 +15,9 @@ import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.Mob; -import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.entity.ai.attributes.AttributeSupplier.Builder; +import net.minecraft.world.entity.ai.goal.AvoidEntityGoal; import net.minecraft.world.entity.ai.goal.FloatGoal; import net.minecraft.world.entity.ai.goal.Goal; import net.minecraft.world.entity.ai.goal.LookAtPlayerGoal; @@ -25,10 +26,11 @@ import net.minecraft.world.entity.ai.goal.WaterAvoidingRandomStrollGoal; import net.minecraft.world.entity.ai.goal.target.HurtByTargetGoal; import net.minecraft.world.entity.ai.goal.target.NearestAttackableTargetGoal; import net.minecraft.world.entity.animal.IronGolem; +import net.minecraft.world.entity.monster.creaking.Creaking; import net.minecraft.world.entity.npc.AbstractVillager; import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.raid.Raider; -import net.minecraft.world.entity.vehicle.Boat; +import net.minecraft.world.entity.vehicle.AbstractBoat; import net.minecraft.world.level.GameRules; import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelReader; @@ -42,14 +44,19 @@ import net.minecraft.world.phys.Vec3; import org.jetbrains.annotations.Nullable; public class Ravager extends Raider { - private static final Predicate NO_RAVAGER_AND_ALIVE = entity -> entity.isAlive() && !(entity instanceof Ravager); + private static final Predicate ROAR_TARGET_WITH_GRIEFING = entity -> !(entity instanceof Ravager) && entity.isAlive(); + private static final Predicate ROAR_TARGET_WITHOUT_GRIEFING = entity -> ROAR_TARGET_WITH_GRIEFING.test(entity) + && !entity.getType().equals(EntityType.ARMOR_STAND); + private static final Predicate ROAR_TARGET_ON_CLIENT = livingEntity -> !(livingEntity instanceof Ravager) + && livingEntity.isAlive() + && livingEntity.isControlledByLocalInstance(); private static final double BASE_MOVEMENT_SPEED = 0.3; private static final double ATTACK_MOVEMENT_SPEED = 0.35; private static final int STUNNED_COLOR = 8356754; private static final float STUNNED_COLOR_BLUE = 0.57254905F; private static final float STUNNED_COLOR_GREEN = 0.5137255F; private static final float STUNNED_COLOR_RED = 0.49803922F; - private static final int ATTACK_DURATION = 10; + public static final int ATTACK_DURATION = 10; public static final int STUN_DURATION = 40; private int attackTick; private int stunnedTick; @@ -65,27 +72,28 @@ public class Ravager extends Raider { protected void registerGoals() { super.registerGoals(); this.goalSelector.addGoal(0, new FloatGoal(this)); + this.goalSelector.addGoal(3, new AvoidEntityGoal(this, Creaking.class, 8.0F, 1.0, 1.2)); this.goalSelector.addGoal(4, new MeleeAttackGoal(this, 1.0, true)); this.goalSelector.addGoal(5, new WaterAvoidingRandomStrollGoal(this, 0.4)); this.goalSelector.addGoal(6, new LookAtPlayerGoal(this, Player.class, 6.0F)); this.goalSelector.addGoal(10, new LookAtPlayerGoal(this, Mob.class, 8.0F)); this.targetSelector.addGoal(2, new HurtByTargetGoal(this, Raider.class).setAlertOthers()); this.targetSelector.addGoal(3, new NearestAttackableTargetGoal(this, Player.class, true)); - this.targetSelector.addGoal(4, new NearestAttackableTargetGoal(this, AbstractVillager.class, true, livingEntity -> !livingEntity.isBaby())); + this.targetSelector.addGoal(4, new NearestAttackableTargetGoal(this, AbstractVillager.class, true, (livingEntity, serverLevel) -> !livingEntity.isBaby())); this.targetSelector.addGoal(4, new NearestAttackableTargetGoal(this, IronGolem.class, true)); } @Override protected void updateControlFlags() { boolean bl = !(this.getControllingPassenger() instanceof Mob) || this.getControllingPassenger().getType().is(EntityTypeTags.RAIDERS); - boolean bl2 = !(this.getVehicle() instanceof Boat); + boolean bl2 = !(this.getVehicle() instanceof AbstractBoat); this.goalSelector.setControlFlag(Goal.Flag.MOVE, bl); this.goalSelector.setControlFlag(Goal.Flag.JUMP, bl && bl2); this.goalSelector.setControlFlag(Goal.Flag.LOOK, bl); this.goalSelector.setControlFlag(Goal.Flag.TARGET, bl); } - public static AttributeSupplier.Builder createAttributes() { + public static Builder createAttributes() { return Monster.createMonsterAttributes() .add(Attributes.MAX_HEALTH, 100.0) .add(Attributes.MOVEMENT_SPEED, 0.3) @@ -134,17 +142,17 @@ public class Ravager extends Raider { this.getAttribute(Attributes.MOVEMENT_SPEED).setBaseValue(Mth.lerp(0.1, e, d)); } - if (this.horizontalCollision && this.level().getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { + if (this.level() instanceof ServerLevel serverLevel && this.horizontalCollision && serverLevel.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { boolean bl = false; AABB aABB = this.getBoundingBox().inflate(0.2); for (BlockPos blockPos : BlockPos.betweenClosed( Mth.floor(aABB.minX), Mth.floor(aABB.minY), Mth.floor(aABB.minZ), Mth.floor(aABB.maxX), Mth.floor(aABB.maxY), Mth.floor(aABB.maxZ) )) { - BlockState blockState = this.level().getBlockState(blockPos); + BlockState blockState = serverLevel.getBlockState(blockPos); Block block = blockState.getBlock(); if (block instanceof LeavesBlock) { - bl = this.level().destroyBlock(blockPos, true, this) || bl; + bl = serverLevel.destroyBlock(blockPos, true, this) || bl; } } @@ -212,24 +220,34 @@ public class Ravager extends Raider { private void roar() { if (this.isAlive()) { - for (LivingEntity livingEntity : this.level().getEntitiesOfClass(LivingEntity.class, this.getBoundingBox().inflate(4.0), NO_RAVAGER_AND_ALIVE)) { - if (!(livingEntity instanceof AbstractIllager)) { - livingEntity.hurt(this.damageSources().mobAttack(this), 6.0F); + if (this.level() instanceof ServerLevel serverLevel) { + Predicate predicate = serverLevel.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) ? ROAR_TARGET_WITH_GRIEFING : ROAR_TARGET_WITHOUT_GRIEFING; + + for (LivingEntity livingEntity : this.level().getEntitiesOfClass(LivingEntity.class, this.getBoundingBox().inflate(4.0), predicate)) { + if (!(livingEntity instanceof AbstractIllager)) { + livingEntity.hurtServer(serverLevel, this.damageSources().mobAttack(this), 6.0F); + } + + if (!(livingEntity instanceof Player)) { + this.strongKnockback(livingEntity); + } } - this.strongKnockback(livingEntity); + this.gameEvent(GameEvent.ENTITY_ACTION); + } else { + for (LivingEntity livingEntity2 : this.level().getEntitiesOfClass(LivingEntity.class, this.getBoundingBox().inflate(4.0), ROAR_TARGET_ON_CLIENT)) { + this.strongKnockback(livingEntity2); + } + + Vec3 vec3 = this.getBoundingBox().getCenter(); + + for (int i = 0; i < 40; i++) { + double d = this.random.nextGaussian() * 0.2; + double e = this.random.nextGaussian() * 0.2; + double f = this.random.nextGaussian() * 0.2; + this.level().addParticle(ParticleTypes.POOF, vec3.x, vec3.y, vec3.z, d, e, f); + } } - - Vec3 vec3 = this.getBoundingBox().getCenter(); - - for (int i = 0; i < 40; i++) { - double d = this.random.nextGaussian() * 0.2; - double e = this.random.nextGaussian() * 0.2; - double f = this.random.nextGaussian() * 0.2; - this.level().addParticle(ParticleTypes.POOF, vec3.x, vec3.y, vec3.z, d, e, f); - } - - this.gameEvent(GameEvent.ENTITY_ACTION); } } @@ -265,11 +283,11 @@ public class Ravager extends Raider { } @Override - public boolean doHurtTarget(Entity target) { + public boolean doHurtTarget(ServerLevel serverLevel, Entity entity) { this.attackTick = 10; - this.level().broadcastEntityEvent(this, (byte)4); + serverLevel.broadcastEntityEvent(this, (byte)4); this.playSound(SoundEvents.RAVAGER_ATTACK, 1.0F, 1.0F); - return super.doHurtTarget(target); + return super.doHurtTarget(serverLevel, entity); } @Nullable diff --git a/net/minecraft/world/entity/monster/Shulker.java b/net/minecraft/world/entity/monster/Shulker.java index b74cf2ee..5a388172 100644 --- a/net/minecraft/world/entity/monster/Shulker.java +++ b/net/minecraft/world/entity/monster/Shulker.java @@ -11,7 +11,9 @@ import net.minecraft.network.protocol.game.ClientboundAddEntityPacket; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.network.syncher.SynchedEntityData.Builder; import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; @@ -22,15 +24,14 @@ import net.minecraft.world.DifficultyInstance; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntitySelector; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.Mob; -import net.minecraft.world.entity.MobSpawnType; import net.minecraft.world.entity.MoverType; import net.minecraft.world.entity.SpawnGroupData; import net.minecraft.world.entity.VariantHolder; import net.minecraft.world.entity.ai.attributes.AttributeModifier; -import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.entity.ai.control.BodyRotationControl; import net.minecraft.world.entity.ai.control.LookControl; @@ -49,6 +50,7 @@ import net.minecraft.world.level.ServerLevelAccessor; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.level.gameevent.GameEvent.Context; import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.Vec3; import org.jetbrains.annotations.Nullable; @@ -68,7 +70,7 @@ public class Shulker extends AbstractGolem implements VariantHolder { - Vec3i vec3i = Direction.SOUTH.getNormal(); + Vec3i vec3i = Direction.SOUTH.getUnitVec3i(); return new Vector3f(vec3i.getX(), vec3i.getY(), vec3i.getZ()); }); private static final float MAX_SCALE = 3.0F; @@ -129,14 +131,14 @@ public class Shulker extends AbstractGolem implements VariantHolder this.level().getMinBuildHeight() + if (blockPos2.getY() > this.level().getMinY() && this.level().isEmptyBlock(blockPos2) && this.level().getWorldBorder().isWithinBounds(blockPos2) && this.level().noCollision(this, new AABB(blockPos2).deflate(1.0E-6))) { @@ -381,7 +385,7 @@ public class Shulker extends AbstractGolem implements VariantHolder getRenderPosition(float partial) { + @Nullable + public Vec3 getRenderPosition(float f) { if (this.clientOldAttachPosition != null && this.clientSideTeleportInterpolation > 0) { - double d = (this.clientSideTeleportInterpolation - partial) / 6.0; + double d = (this.clientSideTeleportInterpolation - f) / 6.0; d *= d; + d *= this.getScale(); BlockPos blockPos = this.blockPosition(); double e = (blockPos.getX() - this.clientOldAttachPosition.getX()) * d; - double f = (blockPos.getY() - this.clientOldAttachPosition.getY()) * d; - double g = (blockPos.getZ() - this.clientOldAttachPosition.getZ()) * d; - return Optional.of(new Vec3(-e, -f, -g)); + double g = (blockPos.getY() - this.clientOldAttachPosition.getY()) * d; + double h = (blockPos.getZ() - this.clientOldAttachPosition.getZ()) * d; + return new Vec3(-e, -g, -h); } else { - return Optional.empty(); + return null; } } @@ -616,7 +622,7 @@ public class Shulker extends AbstractGolem implements VariantHolder { public ShulkerDefenseAttackGoal(Shulker shulker) { - super(shulker, LivingEntity.class, 10, true, false, livingEntity -> livingEntity instanceof Enemy); + super(shulker, LivingEntity.class, 10, true, false, (livingEntity, serverLevel) -> livingEntity instanceof Enemy); } @Override @@ -650,7 +656,7 @@ public class Shulker extends AbstractGolem implements VariantHolder getYRotD() { Direction direction = Shulker.this.getAttachFace().getOpposite(); Vector3f vector3f = direction.getRotation().transform(new Vector3f(Shulker.FORWARD)); - Vec3i vec3i = direction.getNormal(); + Vec3i vec3i = direction.getUnitVec3i(); Vector3f vector3f2 = new Vector3f(vec3i.getX(), vec3i.getY(), vec3i.getZ()); vector3f2.cross(vector3f); double d = this.wantedX - this.mob.getX(); diff --git a/net/minecraft/world/entity/monster/Silverfish.java b/net/minecraft/world/entity/monster/Silverfish.java index 5dbc5830..e3629765 100644 --- a/net/minecraft/world/entity/monster/Silverfish.java +++ b/net/minecraft/world/entity/monster/Silverfish.java @@ -3,16 +3,17 @@ package net.minecraft.world.entity.monster; import java.util.EnumSet; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; +import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; import net.minecraft.tags.DamageTypeTags; import net.minecraft.util.RandomSource; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; -import net.minecraft.world.entity.MobSpawnType; -import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.entity.ai.attributes.AttributeSupplier.Builder; import net.minecraft.world.entity.ai.goal.ClimbOnTopOfPowderSnowGoal; import net.minecraft.world.entity.ai.goal.FloatGoal; import net.minecraft.world.entity.ai.goal.Goal; @@ -50,7 +51,7 @@ public class Silverfish extends Monster { this.targetSelector.addGoal(2, new NearestAttackableTargetGoal(this, Player.class, true)); } - public static AttributeSupplier.Builder createAttributes() { + public static Builder createAttributes() { return Monster.createMonsterAttributes().add(Attributes.MAX_HEALTH, 8.0).add(Attributes.MOVEMENT_SPEED, 0.25).add(Attributes.ATTACK_DAMAGE, 1.0); } @@ -80,15 +81,15 @@ public class Silverfish extends Monster { } @Override - public boolean hurt(DamageSource source, float amount) { - if (this.isInvulnerableTo(source)) { + public boolean hurtServer(ServerLevel serverLevel, DamageSource damageSource, float f) { + if (this.isInvulnerableTo(serverLevel, damageSource)) { return false; } else { - if ((source.getEntity() != null || source.is(DamageTypeTags.ALWAYS_TRIGGERS_SILVERFISH)) && this.friendsGoal != null) { + if ((damageSource.getEntity() != null || damageSource.is(DamageTypeTags.ALWAYS_TRIGGERS_SILVERFISH)) && this.friendsGoal != null) { this.friendsGoal.notifyHurt(); } - return super.hurt(source, amount); + return super.hurtServer(serverLevel, damageSource, f); } } @@ -110,13 +111,15 @@ public class Silverfish extends Monster { } public static boolean checkSilverfishSpawnRules( - EntityType silverfish, LevelAccessor level, MobSpawnType spawnType, BlockPos pos, RandomSource random + EntityType entityType, LevelAccessor levelAccessor, EntitySpawnReason entitySpawnReason, BlockPos blockPos, RandomSource randomSource ) { - if (checkAnyLightMonsterSpawnRules(silverfish, level, spawnType, pos, random)) { - Player player = level.getNearestPlayer(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, 5.0, true); - return player == null; - } else { + if (!checkAnyLightMonsterSpawnRules(entityType, levelAccessor, entitySpawnReason, blockPos, randomSource)) { return false; + } else if (EntitySpawnReason.isSpawner(entitySpawnReason)) { + return true; + } else { + Player player = levelAccessor.getNearestPlayer(blockPos.getX() + 0.5, blockPos.getY() + 0.5, blockPos.getZ() + 0.5, 5.0, true); + return player == null; } } @@ -138,7 +141,7 @@ public class Silverfish extends Monster { return false; } else { RandomSource randomSource = this.mob.getRandom(); - if (this.mob.level().getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) && randomSource.nextInt(reducedTickDelay(10)) == 0) { + if (getServerLevel(this.mob).getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) && randomSource.nextInt(reducedTickDelay(10)) == 0) { this.selectedDirection = Direction.getRandom(randomSource); BlockPos blockPos = BlockPos.containing(this.mob.getX(), this.mob.getY() + 0.5, this.mob.getZ()).relative(this.selectedDirection); BlockState blockState = this.mob.level().getBlockState(blockPos); @@ -209,7 +212,7 @@ public class Silverfish extends Monster { BlockState blockState = level.getBlockState(blockPos2); Block block = blockState.getBlock(); if (block instanceof InfestedBlock) { - if (level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { + if (getServerLevel(level).getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { level.destroyBlock(blockPos2, true, this.silverfish); } else { level.setBlock(blockPos2, ((InfestedBlock)block).hostStateByInfested(level.getBlockState(blockPos2)), 3); diff --git a/net/minecraft/world/entity/monster/Skeleton.java b/net/minecraft/world/entity/monster/Skeleton.java index 692a38be..60073f71 100644 --- a/net/minecraft/world/entity/monster/Skeleton.java +++ b/net/minecraft/world/entity/monster/Skeleton.java @@ -1,13 +1,16 @@ package net.minecraft.world.entity.monster; +import com.google.common.annotations.VisibleForTesting; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.network.syncher.SynchedEntityData.Builder; import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; import net.minecraft.world.damagesource.DamageSource; +import net.minecraft.world.entity.ConversionParams; import net.minecraft.world.entity.EntityType; import net.minecraft.world.item.Items; import net.minecraft.world.level.Level; @@ -24,7 +27,7 @@ public class Skeleton extends AbstractSkeleton { } @Override - protected void defineSynchedData(SynchedEntityData.Builder builder) { + protected void defineSynchedData(Builder builder) { super.defineSynchedData(builder); builder.define(DATA_STRAY_CONVERSION_ID, false); } @@ -80,16 +83,18 @@ public class Skeleton extends AbstractSkeleton { } } - private void startFreezeConversion(int conversionTime) { + @VisibleForTesting + public void startFreezeConversion(int conversionTime) { this.conversionTime = conversionTime; this.setFreezeConverting(true); } protected void doFreezeConversion() { - this.convertTo(EntityType.STRAY, true); - if (!this.isSilent()) { - this.level().levelEvent(null, 1048, this.blockPosition(), 0); - } + this.convertTo(EntityType.STRAY, ConversionParams.single(this, true, true), stray -> { + if (!this.isSilent()) { + this.level().levelEvent(null, 1048, this.blockPosition(), 0); + } + }); } @Override @@ -122,7 +127,7 @@ public class Skeleton extends AbstractSkeleton { super.dropCustomDeathLoot(level, damageSource, recentlyHit); if (damageSource.getEntity() instanceof Creeper creeper && creeper.canDropMobsSkull()) { creeper.increaseDroppedSkulls(); - this.spawnAtLocation(Items.SKELETON_SKULL); + this.spawnAtLocation(level, Items.SKELETON_SKULL); } } } diff --git a/net/minecraft/world/entity/monster/Slime.java b/net/minecraft/world/entity/monster/Slime.java index 3645cb76..ea893ab5 100644 --- a/net/minecraft/world/entity/monster/Slime.java +++ b/net/minecraft/world/entity/monster/Slime.java @@ -6,10 +6,10 @@ import net.minecraft.core.BlockPos; import net.minecraft.core.particles.ParticleOptions; import net.minecraft.core.particles.ParticleTypes; import net.minecraft.nbt.CompoundTag; -import net.minecraft.network.chat.Component; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.network.syncher.SynchedEntityData.Builder; import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; @@ -21,12 +21,14 @@ import net.minecraft.world.Difficulty; import net.minecraft.world.DifficultyInstance; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.effect.MobEffects; +import net.minecraft.world.entity.ConversionParams; +import net.minecraft.world.entity.ConversionType; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityDimensions; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.Mob; -import net.minecraft.world.entity.MobSpawnType; import net.minecraft.world.entity.Pose; import net.minecraft.world.entity.SpawnGroupData; import net.minecraft.world.entity.ai.attributes.Attributes; @@ -43,6 +45,7 @@ import net.minecraft.world.level.ServerLevelAccessor; import net.minecraft.world.level.WorldGenLevel; import net.minecraft.world.level.levelgen.WorldgenRandom; import net.minecraft.world.phys.Vec3; +import net.minecraft.world.scores.PlayerTeam; import org.jetbrains.annotations.Nullable; public class Slime extends Mob implements Enemy { @@ -68,7 +71,9 @@ public class Slime extends Mob implements Enemy { this.goalSelector.addGoal(3, new Slime.SlimeRandomDirectionGoal(this)); this.goalSelector.addGoal(5, new Slime.SlimeKeepOnJumpingGoal(this)); this.targetSelector - .addGoal(1, new NearestAttackableTargetGoal(this, Player.class, 10, true, false, livingEntity -> Math.abs(livingEntity.getY() - this.getY()) <= 4.0)); + .addGoal( + 1, new NearestAttackableTargetGoal(this, Player.class, 10, true, false, (livingEntity, serverLevel) -> Math.abs(livingEntity.getY() - this.getY()) <= 4.0) + ); this.targetSelector.addGoal(3, new NearestAttackableTargetGoal(this, IronGolem.class, true)); } @@ -78,7 +83,7 @@ public class Slime extends Mob implements Enemy { } @Override - protected void defineSynchedData(SynchedEntityData.Builder builder) { + protected void defineSynchedData(Builder builder) { super.defineSynchedData(builder); builder.define(ID_SIZE, 1); } @@ -135,8 +140,8 @@ public class Slime extends Mob implements Enemy { @Override public void tick() { - this.squish = this.squish + (this.targetSquish - this.squish) * 0.5F; this.oSquish = this.squish; + this.squish = this.squish + (this.targetSquish - this.squish) * 0.5F; super.tick(); if (this.onGround() && !this.wasOnGround) { float f = this.getDimensions(this.getPose()).width() * 2.0F; @@ -203,29 +208,19 @@ public class Slime extends Mob implements Enemy { public void remove(Entity.RemovalReason reason) { int i = this.getSize(); if (!this.level().isClientSide && i > 1 && this.isDeadOrDying()) { - Component component = this.getCustomName(); - boolean bl = this.isNoAi(); float f = this.getDimensions(this.getPose()).width(); float g = f / 2.0F; int j = i / 2; int k = 2 + this.random.nextInt(3); + PlayerTeam playerTeam = this.getTeam(); for (int l = 0; l < k; l++) { float h = (l % 2 - 0.5F) * g; float m = (l / 2 - 0.5F) * g; - Slime slime = this.getType().create(this.level()); - if (slime != null) { - if (this.isPersistenceRequired()) { - slime.setPersistenceRequired(); - } - - slime.setCustomName(component); - slime.setNoAi(bl); - slime.setInvulnerable(this.isInvulnerable()); + this.convertTo(this.getType(), new ConversionParams(ConversionType.SPLIT_ON_DEATH, false, false, playerTeam), EntitySpawnReason.TRIGGERED, slime -> { slime.setSize(j, true); slime.moveTo(this.getX() + h, this.getY() + 0.5, this.getZ() + m, this.random.nextFloat() * 360.0F, 0.0F); - this.level().addFreshEntity(slime); - } + }); } } @@ -248,13 +243,11 @@ public class Slime extends Mob implements Enemy { } protected void dealDamage(LivingEntity livingEntity) { - if (this.isAlive() && this.isWithinMeleeAttackRange(livingEntity) && this.hasLineOfSight(livingEntity)) { + if (this.level() instanceof ServerLevel serverLevel && this.isAlive() && this.isWithinMeleeAttackRange(livingEntity) && this.hasLineOfSight(livingEntity)) { DamageSource damageSource = this.damageSources().mobAttack(this); - if (livingEntity.hurt(damageSource, this.getAttackDamage())) { + if (livingEntity.hurtServer(serverLevel, damageSource, this.getAttackDamage())) { this.playSound(SoundEvents.SLIME_ATTACK, 1.0F, (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F); - if (this.level() instanceof ServerLevel serverLevel) { - EnchantmentHelper.doPostAttackEffects(serverLevel, livingEntity, damageSource); - } + EnchantmentHelper.doPostAttackEffects(serverLevel, livingEntity, damageSource); } } } @@ -289,37 +282,35 @@ public class Slime extends Mob implements Enemy { return this.isTiny() ? SoundEvents.SLIME_SQUISH_SMALL : SoundEvents.SLIME_SQUISH; } - public static boolean checkSlimeSpawnRules(EntityType slime, LevelAccessor level, MobSpawnType spawnType, BlockPos pos, RandomSource random) { - if (MobSpawnType.isSpawner(spawnType)) { - return checkMobSpawnRules(slime, level, spawnType, pos, random); - } else { - if (level.getDifficulty() != Difficulty.PEACEFUL) { - if (spawnType == MobSpawnType.SPAWNER) { - return checkMobSpawnRules(slime, level, spawnType, pos, random); - } - - if (level.getBiome(pos).is(BiomeTags.ALLOWS_SURFACE_SLIME_SPAWNS) - && pos.getY() > 50 - && pos.getY() < 70 - && random.nextFloat() < 0.5F - && random.nextFloat() < level.getMoonBrightness() - && level.getMaxLocalRawBrightness(pos) <= random.nextInt(8)) { - return checkMobSpawnRules(slime, level, spawnType, pos, random); - } - - if (!(level instanceof WorldGenLevel)) { - return false; - } - - ChunkPos chunkPos = new ChunkPos(pos); - boolean bl = WorldgenRandom.seedSlimeChunk(chunkPos.x, chunkPos.z, ((WorldGenLevel)level).getSeed(), 987234911L).nextInt(10) == 0; - if (random.nextInt(10) == 0 && bl && pos.getY() < 40) { - return checkMobSpawnRules(slime, level, spawnType, pos, random); - } + public static boolean checkSlimeSpawnRules( + EntityType entityType, LevelAccessor levelAccessor, EntitySpawnReason entitySpawnReason, BlockPos blockPos, RandomSource randomSource + ) { + if (levelAccessor.getDifficulty() != Difficulty.PEACEFUL) { + if (EntitySpawnReason.isSpawner(entitySpawnReason)) { + return checkMobSpawnRules(entityType, levelAccessor, entitySpawnReason, blockPos, randomSource); } - return false; + if (levelAccessor.getBiome(blockPos).is(BiomeTags.ALLOWS_SURFACE_SLIME_SPAWNS) + && blockPos.getY() > 50 + && blockPos.getY() < 70 + && randomSource.nextFloat() < 0.5F + && randomSource.nextFloat() < levelAccessor.getMoonBrightness() + && levelAccessor.getMaxLocalRawBrightness(blockPos) <= randomSource.nextInt(8)) { + return checkMobSpawnRules(entityType, levelAccessor, entitySpawnReason, blockPos, randomSource); + } + + if (!(levelAccessor instanceof WorldGenLevel)) { + return false; + } + + ChunkPos chunkPos = new ChunkPos(blockPos); + boolean bl = WorldgenRandom.seedSlimeChunk(chunkPos.x, chunkPos.z, ((WorldGenLevel)levelAccessor).getSeed(), 987234911L).nextInt(10) == 0; + if (randomSource.nextInt(10) == 0 && bl && blockPos.getY() < 40) { + return checkMobSpawnRules(entityType, levelAccessor, entitySpawnReason, blockPos, randomSource); + } } + + return false; } @Override @@ -348,16 +339,18 @@ public class Slime extends Mob implements Enemy { @Nullable @Override - public SpawnGroupData finalizeSpawn(ServerLevelAccessor level, DifficultyInstance difficulty, MobSpawnType spawnType, @Nullable SpawnGroupData spawnGroupData) { - RandomSource randomSource = level.getRandom(); + public SpawnGroupData finalizeSpawn( + ServerLevelAccessor serverLevelAccessor, DifficultyInstance difficultyInstance, EntitySpawnReason entitySpawnReason, @Nullable SpawnGroupData spawnGroupData + ) { + RandomSource randomSource = serverLevelAccessor.getRandom(); int i = randomSource.nextInt(3); - if (i < 2 && randomSource.nextFloat() < 0.5F * difficulty.getSpecialMultiplier()) { + if (i < 2 && randomSource.nextFloat() < 0.5F * difficultyInstance.getSpecialMultiplier()) { i++; } int j = 1 << i; this.setSize(j, true); - return super.finalizeSpawn(level, difficulty, spawnType, spawnGroupData); + return super.finalizeSpawn(serverLevelAccessor, difficultyInstance, entitySpawnReason, spawnGroupData); } float getSoundPitch() { diff --git a/net/minecraft/world/entity/monster/SpellcasterIllager.java b/net/minecraft/world/entity/monster/SpellcasterIllager.java index 1a434185..e98f842f 100644 --- a/net/minecraft/world/entity/monster/SpellcasterIllager.java +++ b/net/minecraft/world/entity/monster/SpellcasterIllager.java @@ -8,9 +8,12 @@ import net.minecraft.nbt.CompoundTag; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.network.syncher.SynchedEntityData.Builder; +import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundEvent; import net.minecraft.util.ByIdMap; import net.minecraft.util.Mth; +import net.minecraft.util.ByIdMap.OutOfBoundsStrategy; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.ai.goal.Goal; @@ -27,7 +30,7 @@ public abstract class SpellcasterIllager extends AbstractIllager { } @Override - protected void defineSynchedData(SynchedEntityData.Builder builder) { + protected void defineSynchedData(Builder builder) { super.defineSynchedData(builder); builder.define(DATA_SPELL_CASTING_ID, (byte)0); } @@ -67,8 +70,8 @@ public abstract class SpellcasterIllager extends AbstractIllager { } @Override - protected void customServerAiStep() { - super.customServerAiStep(); + protected void customServerAiStep(ServerLevel serverLevel) { + super.customServerAiStep(serverLevel); if (this.spellCastingTickCount > 0) { this.spellCastingTickCount--; } @@ -109,7 +112,7 @@ public abstract class SpellcasterIllager extends AbstractIllager { BLINDNESS(5, 0.1, 0.1, 0.2); private static final IntFunction BY_ID = ByIdMap.continuous( - illagerSpell -> illagerSpell.id, values(), ByIdMap.OutOfBoundsStrategy.ZERO + illagerSpell -> illagerSpell.id, values(), OutOfBoundsStrategy.ZERO ); final int id; final double[] spellColor; diff --git a/net/minecraft/world/entity/monster/Spider.java b/net/minecraft/world/entity/monster/Spider.java index 0e0e1a08..135b6a86 100644 --- a/net/minecraft/world/entity/monster/Spider.java +++ b/net/minecraft/world/entity/monster/Spider.java @@ -5,6 +5,7 @@ import net.minecraft.core.Holder; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.network.syncher.SynchedEntityData.Builder; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; import net.minecraft.util.RandomSource; @@ -15,11 +16,10 @@ import net.minecraft.world.effect.MobEffect; import net.minecraft.world.effect.MobEffectInstance; import net.minecraft.world.effect.MobEffects; import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.entity.MobSpawnType; import net.minecraft.world.entity.SpawnGroupData; -import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.entity.ai.goal.AvoidEntityGoal; import net.minecraft.world.entity.ai.goal.FloatGoal; @@ -70,7 +70,7 @@ public class Spider extends Monster { } @Override - protected void defineSynchedData(SynchedEntityData.Builder builder) { + protected void defineSynchedData(Builder builder) { super.defineSynchedData(builder); builder.define(DATA_FLAGS_ID, (byte)0); } @@ -83,7 +83,7 @@ public class Spider extends Monster { } } - public static AttributeSupplier.Builder createAttributes() { + public static net.minecraft.world.entity.ai.attributes.AttributeSupplier.Builder createAttributes() { return Monster.createMonsterAttributes().add(Attributes.MAX_HEALTH, 16.0).add(Attributes.MOVEMENT_SPEED, 0.3F); } @@ -147,21 +147,23 @@ public class Spider extends Monster { @Nullable @Override - public SpawnGroupData finalizeSpawn(ServerLevelAccessor level, DifficultyInstance difficulty, MobSpawnType spawnType, @Nullable SpawnGroupData spawnGroupData) { - spawnGroupData = super.finalizeSpawn(level, difficulty, spawnType, spawnGroupData); - RandomSource randomSource = level.getRandom(); + public SpawnGroupData finalizeSpawn( + ServerLevelAccessor serverLevelAccessor, DifficultyInstance difficultyInstance, EntitySpawnReason entitySpawnReason, @Nullable SpawnGroupData spawnGroupData + ) { + spawnGroupData = super.finalizeSpawn(serverLevelAccessor, difficultyInstance, entitySpawnReason, spawnGroupData); + RandomSource randomSource = serverLevelAccessor.getRandom(); if (randomSource.nextInt(100) == 0) { - Skeleton skeleton = EntityType.SKELETON.create(this.level()); + Skeleton skeleton = EntityType.SKELETON.create(this.level(), EntitySpawnReason.JOCKEY); if (skeleton != null) { skeleton.moveTo(this.getX(), this.getY(), this.getZ(), this.getYRot(), 0.0F); - skeleton.finalizeSpawn(level, difficulty, spawnType, null); + skeleton.finalizeSpawn(serverLevelAccessor, difficultyInstance, entitySpawnReason, null); skeleton.startRiding(this); } } if (spawnGroupData == null) { spawnGroupData = new Spider.SpiderEffectsGroupData(); - if (level.getDifficulty() == Difficulty.HARD && randomSource.nextFloat() < 0.1F * difficulty.getSpecialMultiplier()) { + if (serverLevelAccessor.getDifficulty() == Difficulty.HARD && randomSource.nextFloat() < 0.1F * difficultyInstance.getSpecialMultiplier()) { ((Spider.SpiderEffectsGroupData)spawnGroupData).setRandomEffect(randomSource); } } diff --git a/net/minecraft/world/entity/monster/Stray.java b/net/minecraft/world/entity/monster/Stray.java index 40d85768..628eefb6 100644 --- a/net/minecraft/world/entity/monster/Stray.java +++ b/net/minecraft/world/entity/monster/Stray.java @@ -7,8 +7,8 @@ import net.minecraft.util.RandomSource; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.effect.MobEffectInstance; import net.minecraft.world.effect.MobEffects; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; -import net.minecraft.world.entity.MobSpawnType; import net.minecraft.world.entity.projectile.AbstractArrow; import net.minecraft.world.entity.projectile.Arrow; import net.minecraft.world.item.ItemStack; @@ -22,14 +22,17 @@ public class Stray extends AbstractSkeleton { super(entityType, level); } - public static boolean checkStraySpawnRules(EntityType stray, ServerLevelAccessor level, MobSpawnType spawnType, BlockPos pos, RandomSource random) { - BlockPos blockPos = pos; + public static boolean checkStraySpawnRules( + EntityType entityType, ServerLevelAccessor serverLevelAccessor, EntitySpawnReason entitySpawnReason, BlockPos blockPos, RandomSource randomSource + ) { + BlockPos blockPos2 = blockPos; do { - blockPos = blockPos.above(); - } while (level.getBlockState(blockPos).is(Blocks.POWDER_SNOW)); + blockPos2 = blockPos2.above(); + } while (serverLevelAccessor.getBlockState(blockPos2).is(Blocks.POWDER_SNOW)); - return checkMonsterSpawnRules(stray, level, spawnType, pos, random) && (MobSpawnType.isSpawner(spawnType) || level.canSeeSky(blockPos.below())); + return checkMonsterSpawnRules(entityType, serverLevelAccessor, entitySpawnReason, blockPos, randomSource) + && (EntitySpawnReason.isSpawner(entitySpawnReason) || serverLevelAccessor.canSeeSky(blockPos2.below())); } @Override diff --git a/net/minecraft/world/entity/monster/Strider.java b/net/minecraft/world/entity/monster/Strider.java index b5412f8b..846aa20c 100644 --- a/net/minecraft/world/entity/monster/Strider.java +++ b/net/minecraft/world/entity/monster/Strider.java @@ -8,6 +8,7 @@ import net.minecraft.nbt.CompoundTag; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.network.syncher.SynchedEntityData.Builder; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundEvent; @@ -25,19 +26,18 @@ import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.AgeableMob; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityDimensions; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.ItemBasedSteering; import net.minecraft.world.entity.ItemSteerable; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.Mob; -import net.minecraft.world.entity.MobSpawnType; import net.minecraft.world.entity.Pose; import net.minecraft.world.entity.Saddleable; import net.minecraft.world.entity.SpawnGroupData; import net.minecraft.world.entity.ai.attributes.AttributeInstance; import net.minecraft.world.entity.ai.attributes.AttributeModifier; -import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.entity.ai.goal.BreedGoal; import net.minecraft.world.entity.ai.goal.FollowParentGoal; @@ -94,14 +94,16 @@ public class Strider extends Animal implements ItemSteerable, Saddleable { this.setPathfindingMalus(PathType.DAMAGE_FIRE, 0.0F); } - public static boolean checkStriderSpawnRules(EntityType strider, LevelAccessor level, MobSpawnType spawnType, BlockPos pos, RandomSource random) { - BlockPos.MutableBlockPos mutableBlockPos = pos.mutable(); + public static boolean checkStriderSpawnRules( + EntityType entityType, LevelAccessor levelAccessor, EntitySpawnReason entitySpawnReason, BlockPos blockPos, RandomSource randomSource + ) { + BlockPos.MutableBlockPos mutableBlockPos = blockPos.mutable(); do { mutableBlockPos.move(Direction.UP); - } while (level.getFluidState(mutableBlockPos).is(FluidTags.LAVA)); + } while (levelAccessor.getFluidState(mutableBlockPos).is(FluidTags.LAVA)); - return level.getBlockState(mutableBlockPos).isAir(); + return levelAccessor.getBlockState(mutableBlockPos).isAir(); } @Override @@ -114,7 +116,7 @@ public class Strider extends Animal implements ItemSteerable, Saddleable { } @Override - protected void defineSynchedData(SynchedEntityData.Builder builder) { + protected void defineSynchedData(Builder builder) { super.defineSynchedData(builder); builder.define(DATA_BOOST_TIME, 0); builder.define(DATA_SUFFOCATING, false); @@ -285,7 +287,6 @@ public class Strider extends Animal implements ItemSteerable, Saddleable { @Override protected void checkFallDamage(double y, boolean onGround, BlockState state, BlockPos pos) { - this.checkInsideBlocks(); if (this.isInLava()) { this.resetFallDistance(); } else { @@ -311,7 +312,6 @@ public class Strider extends Animal implements ItemSteerable, Saddleable { super.tick(); this.floatStrider(); - this.checkInsideBlocks(); } private boolean isBeingTempted() { @@ -335,8 +335,8 @@ public class Strider extends Animal implements ItemSteerable, Saddleable { } } - public static AttributeSupplier.Builder createAttributes() { - return Mob.createMobAttributes().add(Attributes.MOVEMENT_SPEED, 0.175F).add(Attributes.FOLLOW_RANGE, 16.0); + public static net.minecraft.world.entity.ai.attributes.AttributeSupplier.Builder createAttributes() { + return Animal.createAnimalAttributes().add(Attributes.MOVEMENT_SPEED, 0.175F); } @Override @@ -385,7 +385,7 @@ public class Strider extends Animal implements ItemSteerable, Saddleable { @Nullable public Strider getBreedOffspring(ServerLevel level, AgeableMob otherParent) { - return EntityType.STRIDER.create(level); + return EntityType.STRIDER.create(level, EntitySpawnReason.BREEDING); } @Override @@ -394,10 +394,10 @@ public class Strider extends Animal implements ItemSteerable, Saddleable { } @Override - protected void dropEquipment() { - super.dropEquipment(); + protected void dropEquipment(ServerLevel serverLevel) { + super.dropEquipment(serverLevel); if (this.isSaddled()) { - this.spawnAtLocation(Items.SADDLE); + this.spawnAtLocation(serverLevel, Items.SADDLE); } } @@ -409,12 +409,12 @@ public class Strider extends Animal implements ItemSteerable, Saddleable { player.startRiding(this); } - return InteractionResult.sidedSuccess(this.level().isClientSide); + return InteractionResult.SUCCESS; } else { InteractionResult interactionResult = super.mobInteract(player, hand); if (!interactionResult.consumesAction()) { ItemStack itemStack = player.getItemInHand(hand); - return itemStack.is(Items.SADDLE) ? itemStack.interactLivingEntity(player, this, hand) : InteractionResult.PASS; + return (InteractionResult)(itemStack.is(Items.SADDLE) ? itemStack.interactLivingEntity(player, this, hand) : InteractionResult.PASS); } else { if (bl && !this.isSilent()) { this.level() @@ -442,35 +442,37 @@ public class Strider extends Animal implements ItemSteerable, Saddleable { @Nullable @Override - public SpawnGroupData finalizeSpawn(ServerLevelAccessor level, DifficultyInstance difficulty, MobSpawnType spawnType, @Nullable SpawnGroupData spawnGroupData) { + public SpawnGroupData finalizeSpawn( + ServerLevelAccessor serverLevelAccessor, DifficultyInstance difficultyInstance, EntitySpawnReason entitySpawnReason, @Nullable SpawnGroupData spawnGroupData + ) { if (this.isBaby()) { - return super.finalizeSpawn(level, difficulty, spawnType, spawnGroupData); + return super.finalizeSpawn(serverLevelAccessor, difficultyInstance, entitySpawnReason, spawnGroupData); } else { - RandomSource randomSource = level.getRandom(); + RandomSource randomSource = serverLevelAccessor.getRandom(); if (randomSource.nextInt(30) == 0) { - Mob mob = EntityType.ZOMBIFIED_PIGLIN.create(level.getLevel()); + Mob mob = EntityType.ZOMBIFIED_PIGLIN.create(serverLevelAccessor.getLevel(), EntitySpawnReason.JOCKEY); if (mob != null) { - spawnGroupData = this.spawnJockey(level, difficulty, mob, new Zombie.ZombieGroupData(Zombie.getSpawnAsBabyOdds(randomSource), false)); + spawnGroupData = this.spawnJockey(serverLevelAccessor, difficultyInstance, mob, new Zombie.ZombieGroupData(Zombie.getSpawnAsBabyOdds(randomSource), false)); mob.setItemSlot(EquipmentSlot.MAINHAND, new ItemStack(Items.WARPED_FUNGUS_ON_A_STICK)); this.equipSaddle(new ItemStack(Items.SADDLE), null); } } else if (randomSource.nextInt(10) == 0) { - AgeableMob ageableMob = EntityType.STRIDER.create(level.getLevel()); + AgeableMob ageableMob = EntityType.STRIDER.create(serverLevelAccessor.getLevel(), EntitySpawnReason.JOCKEY); if (ageableMob != null) { ageableMob.setAge(-24000); - spawnGroupData = this.spawnJockey(level, difficulty, ageableMob, null); + spawnGroupData = this.spawnJockey(serverLevelAccessor, difficultyInstance, ageableMob, null); } } else { spawnGroupData = new AgeableMob.AgeableMobGroupData(0.5F); } - return super.finalizeSpawn(level, difficulty, spawnType, spawnGroupData); + return super.finalizeSpawn(serverLevelAccessor, difficultyInstance, entitySpawnReason, spawnGroupData); } } private SpawnGroupData spawnJockey(ServerLevelAccessor serverLevel, DifficultyInstance difficulty, Mob jockey, @Nullable SpawnGroupData spawnData) { jockey.moveTo(this.getX(), this.getY(), this.getZ(), this.getYRot(), 0.0F); - jockey.finalizeSpawn(serverLevel, difficulty, MobSpawnType.JOCKEY, spawnData); + jockey.finalizeSpawn(serverLevel, difficulty, EntitySpawnReason.JOCKEY, spawnData); jockey.startRiding(this, true); return new AgeableMob.AgeableMobGroupData(0.0F); } diff --git a/net/minecraft/world/entity/monster/Vex.java b/net/minecraft/world/entity/monster/Vex.java index acbdd426..db9df8c8 100644 --- a/net/minecraft/world/entity/monster/Vex.java +++ b/net/minecraft/world/entity/monster/Vex.java @@ -13,17 +13,16 @@ import net.minecraft.util.RandomSource; import net.minecraft.world.DifficultyInstance; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.Mob; -import net.minecraft.world.entity.MobSpawnType; -import net.minecraft.world.entity.MoverType; import net.minecraft.world.entity.PathfinderMob; import net.minecraft.world.entity.SpawnGroupData; import net.minecraft.world.entity.TraceableEntity; -import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.entity.ai.attributes.AttributeSupplier.Builder; import net.minecraft.world.entity.ai.control.MoveControl; import net.minecraft.world.entity.ai.goal.FloatGoal; import net.minecraft.world.entity.ai.goal.Goal; @@ -65,9 +64,8 @@ public class Vex extends Monster implements TraceableEntity { } @Override - public void move(MoverType type, Vec3 pos) { - super.move(type, pos); - this.checkInsideBlocks(); + protected boolean isAffectedByBlocks() { + return !this.isRemoved(); } @Override @@ -95,12 +93,12 @@ public class Vex extends Monster implements TraceableEntity { this.targetSelector.addGoal(3, new NearestAttackableTargetGoal(this, Player.class, true)); } - public static AttributeSupplier.Builder createAttributes() { + public static Builder createAttributes() { return Monster.createMonsterAttributes().add(Attributes.MAX_HEALTH, 14.0).add(Attributes.ATTACK_DAMAGE, 4.0); } @Override - protected void defineSynchedData(SynchedEntityData.Builder builder) { + protected void defineSynchedData(net.minecraft.network.syncher.SynchedEntityData.Builder builder) { super.defineSynchedData(builder); builder.define(DATA_FLAGS_ID, (byte)0); } @@ -208,11 +206,13 @@ public class Vex extends Monster implements TraceableEntity { @Nullable @Override - public SpawnGroupData finalizeSpawn(ServerLevelAccessor level, DifficultyInstance difficulty, MobSpawnType spawnType, @Nullable SpawnGroupData spawnGroupData) { - RandomSource randomSource = level.getRandom(); - this.populateDefaultEquipmentSlots(randomSource, difficulty); - this.populateDefaultEquipmentEnchantments(level, randomSource, difficulty); - return super.finalizeSpawn(level, difficulty, spawnType, spawnGroupData); + public SpawnGroupData finalizeSpawn( + ServerLevelAccessor serverLevelAccessor, DifficultyInstance difficultyInstance, EntitySpawnReason entitySpawnReason, @Nullable SpawnGroupData spawnGroupData + ) { + RandomSource randomSource = serverLevelAccessor.getRandom(); + this.populateDefaultEquipmentSlots(randomSource, difficultyInstance); + this.populateDefaultEquipmentEnchantments(serverLevelAccessor, randomSource, difficultyInstance); + return super.finalizeSpawn(serverLevelAccessor, difficultyInstance, entitySpawnReason, spawnGroupData); } @Override @@ -266,7 +266,7 @@ public class Vex extends Monster implements TraceableEntity { LivingEntity livingEntity = Vex.this.getTarget(); if (livingEntity != null) { if (Vex.this.getBoundingBox().intersects(livingEntity.getBoundingBox())) { - Vex.this.doHurtTarget(livingEntity); + Vex.this.doHurtTarget(getServerLevel(Vex.this.level()), livingEntity); Vex.this.setIsCharging(false); } else { double d = Vex.this.distanceToSqr(livingEntity); diff --git a/net/minecraft/world/entity/monster/Vindicator.java b/net/minecraft/world/entity/monster/Vindicator.java index c195720b..97c8db98 100644 --- a/net/minecraft/world/entity/monster/Vindicator.java +++ b/net/minecraft/world/entity/monster/Vindicator.java @@ -12,14 +12,15 @@ import net.minecraft.util.RandomSource; import net.minecraft.world.Difficulty; import net.minecraft.world.DifficultyInstance; import net.minecraft.world.damagesource.DamageSource; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.Mob; -import net.minecraft.world.entity.MobSpawnType; import net.minecraft.world.entity.SpawnGroupData; -import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.entity.ai.attributes.AttributeSupplier.Builder; +import net.minecraft.world.entity.ai.goal.AvoidEntityGoal; import net.minecraft.world.entity.ai.goal.BreakDoorGoal; import net.minecraft.world.entity.ai.goal.FloatGoal; import net.minecraft.world.entity.ai.goal.Goal; @@ -31,6 +32,7 @@ import net.minecraft.world.entity.ai.goal.target.NearestAttackableTargetGoal; import net.minecraft.world.entity.ai.navigation.GroundPathNavigation; import net.minecraft.world.entity.ai.util.GoalUtils; import net.minecraft.world.entity.animal.IronGolem; +import net.minecraft.world.entity.monster.creaking.Creaking; import net.minecraft.world.entity.npc.AbstractVillager; import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.raid.Raid; @@ -57,10 +59,11 @@ public class Vindicator extends AbstractIllager { protected void registerGoals() { super.registerGoals(); this.goalSelector.addGoal(0, new FloatGoal(this)); - this.goalSelector.addGoal(1, new Vindicator.VindicatorBreakDoorGoal(this)); - this.goalSelector.addGoal(2, new AbstractIllager.RaiderOpenDoorGoal(this)); - this.goalSelector.addGoal(3, new Raider.HoldGroundAttackGoal(this, 10.0F)); - this.goalSelector.addGoal(4, new MeleeAttackGoal(this, 1.0, false)); + this.goalSelector.addGoal(1, new AvoidEntityGoal(this, Creaking.class, 8.0F, 1.0, 1.2)); + this.goalSelector.addGoal(2, new Vindicator.VindicatorBreakDoorGoal(this)); + this.goalSelector.addGoal(3, new AbstractIllager.RaiderOpenDoorGoal(this)); + this.goalSelector.addGoal(4, new Raider.HoldGroundAttackGoal(this, 10.0F)); + this.goalSelector.addGoal(5, new MeleeAttackGoal(this, 1.0, false)); this.targetSelector.addGoal(1, new HurtByTargetGoal(this, Raider.class).setAlertOthers()); this.targetSelector.addGoal(2, new NearestAttackableTargetGoal(this, Player.class, true)); this.targetSelector.addGoal(3, new NearestAttackableTargetGoal(this, AbstractVillager.class, true)); @@ -72,16 +75,16 @@ public class Vindicator extends AbstractIllager { } @Override - protected void customServerAiStep() { + protected void customServerAiStep(ServerLevel serverLevel) { if (!this.isNoAi() && GoalUtils.hasGroundPathNavigation(this)) { - boolean bl = ((ServerLevel)this.level()).isRaided(this.blockPosition()); + boolean bl = serverLevel.isRaided(this.blockPosition()); ((GroundPathNavigation)this.getNavigation()).setCanOpenDoors(bl); } - super.customServerAiStep(); + super.customServerAiStep(serverLevel); } - public static AttributeSupplier.Builder createAttributes() { + public static Builder createAttributes() { return Monster.createMonsterAttributes() .add(Attributes.MOVEMENT_SPEED, 0.35F) .add(Attributes.FOLLOW_RANGE, 12.0) @@ -121,12 +124,14 @@ public class Vindicator extends AbstractIllager { @Nullable @Override - public SpawnGroupData finalizeSpawn(ServerLevelAccessor level, DifficultyInstance difficulty, MobSpawnType spawnType, @Nullable SpawnGroupData spawnGroupData) { - SpawnGroupData spawnGroupData2 = super.finalizeSpawn(level, difficulty, spawnType, spawnGroupData); + public SpawnGroupData finalizeSpawn( + ServerLevelAccessor serverLevelAccessor, DifficultyInstance difficultyInstance, EntitySpawnReason entitySpawnReason, @Nullable SpawnGroupData spawnGroupData + ) { + SpawnGroupData spawnGroupData2 = super.finalizeSpawn(serverLevelAccessor, difficultyInstance, entitySpawnReason, spawnGroupData); ((GroundPathNavigation)this.getNavigation()).setCanOpenDoors(true); - RandomSource randomSource = level.getRandom(); - this.populateDefaultEquipmentSlots(randomSource, difficulty); - this.populateDefaultEquipmentEnchantments(level, randomSource, difficulty); + RandomSource randomSource = serverLevelAccessor.getRandom(); + this.populateDefaultEquipmentSlots(randomSource, difficultyInstance); + this.populateDefaultEquipmentEnchantments(serverLevelAccessor, randomSource, difficultyInstance); return spawnGroupData2; } @@ -202,7 +207,7 @@ public class Vindicator extends AbstractIllager { static class VindicatorJohnnyAttackGoal extends NearestAttackableTargetGoal { public VindicatorJohnnyAttackGoal(Vindicator vindicator) { - super(vindicator, LivingEntity.class, 0, true, true, LivingEntity::attackable); + super(vindicator, LivingEntity.class, 0, true, true, (livingEntity, serverLevel) -> livingEntity.attackable()); } @Override diff --git a/net/minecraft/world/entity/monster/Witch.java b/net/minecraft/world/entity/monster/Witch.java index 2abc4ef5..222d40e2 100644 --- a/net/minecraft/world/entity/monster/Witch.java +++ b/net/minecraft/world/entity/monster/Witch.java @@ -6,6 +6,7 @@ import net.minecraft.core.particles.ParticleTypes; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.network.syncher.SynchedEntityData.Builder; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundEvent; @@ -19,7 +20,6 @@ import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.ai.attributes.AttributeInstance; import net.minecraft.world.entity.ai.attributes.AttributeModifier; -import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.entity.ai.goal.FloatGoal; import net.minecraft.world.entity.ai.goal.LookAtPlayerGoal; @@ -30,6 +30,7 @@ import net.minecraft.world.entity.ai.goal.target.HurtByTargetGoal; import net.minecraft.world.entity.ai.goal.target.NearestAttackableWitchTargetGoal; import net.minecraft.world.entity.ai.goal.target.NearestHealableRaiderTargetGoal; import net.minecraft.world.entity.player.Player; +import net.minecraft.world.entity.projectile.Projectile; import net.minecraft.world.entity.projectile.ThrownPotion; import net.minecraft.world.entity.raid.Raider; import net.minecraft.world.item.ItemStack; @@ -59,7 +60,7 @@ public class Witch extends Raider implements RangedAttackMob { protected void registerGoals() { super.registerGoals(); this.healRaidersGoal = new NearestHealableRaiderTargetGoal<>( - this, Raider.class, true, livingEntity -> livingEntity != null && this.hasActiveRaid() && livingEntity.getType() != EntityType.WITCH + this, Raider.class, true, (livingEntity, serverLevel) -> this.hasActiveRaid() && livingEntity.getType() != EntityType.WITCH ); this.attackPlayersGoal = new NearestAttackableWitchTargetGoal<>(this, Player.class, 10, true, false, null); this.goalSelector.addGoal(1, new FloatGoal(this)); @@ -73,7 +74,7 @@ public class Witch extends Raider implements RangedAttackMob { } @Override - protected void defineSynchedData(SynchedEntityData.Builder builder) { + protected void defineSynchedData(Builder builder) { super.defineSynchedData(builder); builder.define(DATA_USING_ITEM, false); } @@ -104,7 +105,7 @@ public class Witch extends Raider implements RangedAttackMob { return this.getEntityData().get(DATA_USING_ITEM); } - public static AttributeSupplier.Builder createAttributes() { + public static net.minecraft.world.entity.ai.attributes.AttributeSupplier.Builder createAttributes() { return Monster.createMonsterAttributes().add(Attributes.MAX_HEALTH, 26.0).add(Attributes.MOVEMENT_SPEED, 0.25); } @@ -235,16 +236,15 @@ public class Witch extends Raider implements RangedAttackMob { holder = Potions.WEAKNESS; } - ThrownPotion thrownPotion = new ThrownPotion(this.level(), this); - thrownPotion.setItem(PotionContents.createItemStack(Items.SPLASH_POTION, holder)); - thrownPotion.setXRot(thrownPotion.getXRot() - -20.0F); - thrownPotion.shoot(d, e + g * 0.2, f, 0.75F, 8.0F); + if (this.level() instanceof ServerLevel serverLevel) { + ItemStack itemStack = PotionContents.createItemStack(Items.SPLASH_POTION, holder); + Projectile.spawnProjectileUsingShoot(ThrownPotion::new, serverLevel, itemStack, this, d, e + g * 0.2, f, 0.75F, 8.0F); + } + if (!this.isSilent()) { this.level() .playSound(null, this.getX(), this.getY(), this.getZ(), SoundEvents.WITCH_THROW, this.getSoundSource(), 1.0F, 0.8F + this.random.nextFloat() * 0.4F); } - - this.level().addFreshEntity(thrownPotion); } } diff --git a/net/minecraft/world/entity/monster/WitherSkeleton.java b/net/minecraft/world/entity/monster/WitherSkeleton.java index a67a09ce..3fb32f37 100644 --- a/net/minecraft/world/entity/monster/WitherSkeleton.java +++ b/net/minecraft/world/entity/monster/WitherSkeleton.java @@ -9,10 +9,10 @@ import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.effect.MobEffectInstance; import net.minecraft.world.effect.MobEffects; import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.entity.MobSpawnType; import net.minecraft.world.entity.SpawnGroupData; import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.entity.ai.goal.target.NearestAttackableTargetGoal; @@ -62,7 +62,7 @@ public class WitherSkeleton extends AbstractSkeleton { super.dropCustomDeathLoot(level, damageSource, recentlyHit); if (damageSource.getEntity() instanceof Creeper creeper && creeper.canDropMobsSkull()) { creeper.increaseDroppedSkulls(); - this.spawnAtLocation(Items.WITHER_SKELETON_SKULL); + this.spawnAtLocation(level, Items.WITHER_SKELETON_SKULL); } } @@ -77,20 +77,22 @@ public class WitherSkeleton extends AbstractSkeleton { @Nullable @Override - public SpawnGroupData finalizeSpawn(ServerLevelAccessor level, DifficultyInstance difficulty, MobSpawnType spawnType, @Nullable SpawnGroupData spawnGroupData) { - SpawnGroupData spawnGroupData2 = super.finalizeSpawn(level, difficulty, spawnType, spawnGroupData); + public SpawnGroupData finalizeSpawn( + ServerLevelAccessor serverLevelAccessor, DifficultyInstance difficultyInstance, EntitySpawnReason entitySpawnReason, @Nullable SpawnGroupData spawnGroupData + ) { + SpawnGroupData spawnGroupData2 = super.finalizeSpawn(serverLevelAccessor, difficultyInstance, entitySpawnReason, spawnGroupData); this.getAttribute(Attributes.ATTACK_DAMAGE).setBaseValue(4.0); this.reassessWeaponGoal(); return spawnGroupData2; } @Override - public boolean doHurtTarget(Entity target) { - if (!super.doHurtTarget(target)) { + public boolean doHurtTarget(ServerLevel serverLevel, Entity entity) { + if (!super.doHurtTarget(serverLevel, entity)) { return false; } else { - if (target instanceof LivingEntity) { - ((LivingEntity)target).addEffect(new MobEffectInstance(MobEffects.WITHER, 200), this); + if (entity instanceof LivingEntity) { + ((LivingEntity)entity).addEffect(new MobEffectInstance(MobEffects.WITHER, 200), this); } return true; diff --git a/net/minecraft/world/entity/monster/Zoglin.java b/net/minecraft/world/entity/monster/Zoglin.java index 6382b963..d6c9ccd2 100644 --- a/net/minecraft/world/entity/monster/Zoglin.java +++ b/net/minecraft/world/entity/monster/Zoglin.java @@ -11,16 +11,22 @@ import net.minecraft.network.protocol.game.DebugPackets; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.network.syncher.SynchedEntityData.Builder; import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; +import net.minecraft.util.profiling.Profiler; +import net.minecraft.util.profiling.ProfilerFiller; import net.minecraft.util.valueproviders.UniformInt; +import net.minecraft.world.DifficultyInstance; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.SpawnGroupData; import net.minecraft.world.entity.ai.Brain; -import net.minecraft.world.entity.ai.attributes.AttributeSupplier; +import net.minecraft.world.entity.ai.Brain.Provider; import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.entity.ai.behavior.BehaviorUtils; import net.minecraft.world.entity.ai.behavior.DoNothing; @@ -42,10 +48,11 @@ import net.minecraft.world.entity.ai.sensing.SensorType; import net.minecraft.world.entity.monster.hoglin.HoglinBase; import net.minecraft.world.entity.schedule.Activity; import net.minecraft.world.level.Level; +import net.minecraft.world.level.ServerLevelAccessor; import net.minecraft.world.level.block.state.BlockState; import org.jetbrains.annotations.Nullable; -public class Zoglin extends Monster implements Enemy, HoglinBase { +public class Zoglin extends Monster implements HoglinBase { private static final EntityDataAccessor DATA_BABY_ID = SynchedEntityData.defineId(Zoglin.class, EntityDataSerializers.BOOLEAN); private static final int MAX_HEALTH = 40; private static final int ATTACK_KNOCKBACK = 1; @@ -80,7 +87,7 @@ public class Zoglin extends Monster implements Enemy, HoglinBase { } @Override - protected Brain.Provider brainProvider() { + protected Provider brainProvider() { return Brain.provider(MEMORY_TYPES, SENSOR_TYPES); } @@ -105,7 +112,7 @@ public class Zoglin extends Monster implements Enemy, HoglinBase { Activity.IDLE, 10, ImmutableList.of( - StartAttacking.create(Zoglin::findNearestValidAttackTarget), + StartAttacking.create((serverLevel, zoglin) -> zoglin.findNearestValidAttackTarget(serverLevel)), SetEntityLookTargetSometimes.create(8.0F, UniformInt.of(30, 60)), new RunOne<>( ImmutableList.of(Pair.of(RandomStroll.stroll(0.4F), 2), Pair.of(SetWalkTargetFromLookTarget.create(0.4F, 3), 2), Pair.of(new DoNothing(30, 60), 1)) @@ -128,20 +135,20 @@ public class Zoglin extends Monster implements Enemy, HoglinBase { ); } - private Optional findNearestValidAttackTarget() { + private Optional findNearestValidAttackTarget(ServerLevel serverLevel) { return ((NearestVisibleLivingEntities)this.getBrain() .getMemory(MemoryModuleType.NEAREST_VISIBLE_LIVING_ENTITIES) .orElse(NearestVisibleLivingEntities.empty())) - .findClosest(this::isTargetable); + .findClosest(livingEntity -> this.isTargetable(serverLevel, livingEntity)); } - private boolean isTargetable(LivingEntity livingEntity) { + private boolean isTargetable(ServerLevel serverLevel, LivingEntity livingEntity) { EntityType entityType = livingEntity.getType(); - return entityType != EntityType.ZOGLIN && entityType != EntityType.CREEPER && Sensor.isEntityAttackable(this, livingEntity); + return entityType != EntityType.ZOGLIN && entityType != EntityType.CREEPER && Sensor.isEntityAttackable(serverLevel, this, livingEntity); } @Override - protected void defineSynchedData(SynchedEntityData.Builder builder) { + protected void defineSynchedData(Builder builder) { super.defineSynchedData(builder); builder.define(DATA_BABY_ID, false); } @@ -154,7 +161,19 @@ public class Zoglin extends Monster implements Enemy, HoglinBase { } } - public static AttributeSupplier.Builder createAttributes() { + @Nullable + @Override + public SpawnGroupData finalizeSpawn( + ServerLevelAccessor serverLevelAccessor, DifficultyInstance difficultyInstance, EntitySpawnReason entitySpawnReason, @Nullable SpawnGroupData spawnGroupData + ) { + if (serverLevelAccessor.getRandom().nextFloat() < 0.2F) { + this.setBaby(true); + } + + return super.finalizeSpawn(serverLevelAccessor, difficultyInstance, entitySpawnReason, spawnGroupData); + } + + public static net.minecraft.world.entity.ai.attributes.AttributeSupplier.Builder createAttributes() { return Monster.createMonsterAttributes() .add(Attributes.MAX_HEALTH, 40.0) .add(Attributes.MOVEMENT_SPEED, 0.3F) @@ -168,14 +187,14 @@ public class Zoglin extends Monster implements Enemy, HoglinBase { } @Override - public boolean doHurtTarget(Entity target) { - if (!(target instanceof LivingEntity)) { - return false; - } else { + public boolean doHurtTarget(ServerLevel serverLevel, Entity entity) { + if (entity instanceof LivingEntity livingEntity) { this.attackAnimationRemainingTicks = 10; - this.level().broadcastEntityEvent(this, (byte)4); + serverLevel.broadcastEntityEvent(this, (byte)4); this.makeSound(SoundEvents.ZOGLIN_ATTACK); - return HoglinBase.hurtAndThrowTarget(this, (LivingEntity)target); + return HoglinBase.hurtAndThrowTarget(serverLevel, this, livingEntity); + } else { + return false; } } @@ -192,17 +211,14 @@ public class Zoglin extends Monster implements Enemy, HoglinBase { } @Override - public boolean hurt(DamageSource source, float amount) { - boolean bl = super.hurt(source, amount); - if (this.level().isClientSide) { - return false; - } else if (bl && source.getEntity() instanceof LivingEntity) { - LivingEntity livingEntity = (LivingEntity)source.getEntity(); + public boolean hurtServer(ServerLevel serverLevel, DamageSource damageSource, float f) { + boolean bl = super.hurtServer(serverLevel, damageSource, f); + if (bl && damageSource.getEntity() instanceof LivingEntity livingEntity) { if (this.canAttack(livingEntity) && !BehaviorUtils.isOtherTargetMuchFurtherAwayThanCurrentAttackTarget(this, livingEntity, 4.0)) { this.setAttackTarget(livingEntity); } - return bl; + return true; } else { return bl; } @@ -230,10 +246,11 @@ public class Zoglin extends Monster implements Enemy, HoglinBase { } @Override - protected void customServerAiStep() { - this.level().getProfiler().push("zoglinBrain"); - this.getBrain().tick((ServerLevel)this.level(), this); - this.level().getProfiler().pop(); + protected void customServerAiStep(ServerLevel serverLevel) { + ProfilerFiller profilerFiller = Profiler.get(); + profilerFiller.push("zoglinBrain"); + this.getBrain().tick(serverLevel, this); + profilerFiller.pop(); this.updateActivity(); } diff --git a/net/minecraft/world/entity/monster/Zombie.java b/net/minecraft/world/entity/monster/Zombie.java index b6aa2e0d..ef7728e7 100644 --- a/net/minecraft/world/entity/monster/Zombie.java +++ b/net/minecraft/world/entity/monster/Zombie.java @@ -1,5 +1,6 @@ package net.minecraft.world.entity.monster; +import com.google.common.annotations.VisibleForTesting; import java.time.LocalDate; import java.time.temporal.ChronoField; import java.util.List; @@ -21,21 +22,22 @@ import net.minecraft.util.RandomSource; import net.minecraft.world.Difficulty; import net.minecraft.world.DifficultyInstance; import net.minecraft.world.damagesource.DamageSource; +import net.minecraft.world.entity.ConversionParams; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityDimensions; import net.minecraft.world.entity.EntitySelector; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.entity.MobSpawnType; import net.minecraft.world.entity.PathfinderMob; import net.minecraft.world.entity.Pose; import net.minecraft.world.entity.SpawnGroupData; import net.minecraft.world.entity.SpawnPlacements; import net.minecraft.world.entity.ai.attributes.AttributeInstance; import net.minecraft.world.entity.ai.attributes.AttributeModifier; -import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.entity.ai.attributes.AttributeSupplier.Builder; import net.minecraft.world.entity.ai.goal.BreakDoorGoal; import net.minecraft.world.entity.ai.goal.LookAtPlayerGoal; import net.minecraft.world.entity.ai.goal.MoveThroughVillageGoal; @@ -117,7 +119,7 @@ public class Zombie extends Monster { this.targetSelector.addGoal(5, new NearestAttackableTargetGoal(this, Turtle.class, 10, true, false, Turtle.BABY_ON_LAND_SELECTOR)); } - public static AttributeSupplier.Builder createAttributes() { + public static Builder createAttributes() { return Monster.createMonsterAttributes() .add(Attributes.FOLLOW_RANGE, 35.0) .add(Attributes.MOVEMENT_SPEED, 0.23F) @@ -127,7 +129,7 @@ public class Zombie extends Monster { } @Override - protected void defineSynchedData(SynchedEntityData.Builder builder) { + protected void defineSynchedData(net.minecraft.network.syncher.SynchedEntityData.Builder builder) { super.defineSynchedData(builder); builder.define(DATA_BABY_ID, false); builder.define(DATA_SPECIAL_TYPE_ID, 0); @@ -146,7 +148,7 @@ public class Zombie extends Monster { * Sets or removes EntityAIBreakDoor task */ public void setCanBreakDoors(boolean canBreakDoors) { - if (this.supportsBreakDoorGoal() && GoalUtils.hasGroundPathNavigation(this)) { + if (GoalUtils.hasGroundPathNavigation(this)) { if (this.canBreakDoors != canBreakDoors) { this.canBreakDoors = canBreakDoors; ((GroundPathNavigation)this.getNavigation()).setCanOpenDoors(canBreakDoors); @@ -162,22 +164,18 @@ public class Zombie extends Monster { } } - protected boolean supportsBreakDoorGoal() { - return true; - } - @Override public boolean isBaby() { return this.getEntityData().get(DATA_BABY_ID); } @Override - protected int getBaseExperienceReward() { + protected int getBaseExperienceReward(ServerLevel serverLevel) { if (this.isBaby()) { this.xpReward = (int)(this.xpReward * 2.5); } - return super.getBaseExperienceReward(); + return super.getBaseExperienceReward(serverLevel); } @Override @@ -269,11 +267,32 @@ public class Zombie extends Monster { } protected void convertToZombieType(EntityType entityType) { - Zombie zombie = this.convertTo(entityType, true); - if (zombie != null) { - zombie.handleAttributes(zombie.level().getCurrentDifficultyAt(zombie.blockPosition()).getSpecialMultiplier()); - zombie.setCanBreakDoors(zombie.supportsBreakDoorGoal() && this.canBreakDoors()); - } + this.convertTo( + entityType, + ConversionParams.single(this, true, true), + zombie -> zombie.handleAttributes(zombie.level().getCurrentDifficultyAt(zombie.blockPosition()).getSpecialMultiplier()) + ); + } + + @VisibleForTesting + public boolean convertVillagerToZombieVillager(ServerLevel serverLevel, Villager villager) { + ZombieVillager zombieVillager = villager.convertTo( + EntityType.ZOMBIE_VILLAGER, + ConversionParams.single(villager, true, true), + zombieVillagerx -> { + zombieVillagerx.finalizeSpawn( + serverLevel, serverLevel.getCurrentDifficultyAt(zombieVillagerx.blockPosition()), EntitySpawnReason.CONVERSION, new Zombie.ZombieGroupData(false, true) + ); + zombieVillagerx.setVillagerData(villager.getVillagerData()); + zombieVillagerx.setGossips(villager.getGossips().store(NbtOps.INSTANCE)); + zombieVillagerx.setTradeOffers(villager.getOffers().copy()); + zombieVillagerx.setVillagerXp(villager.getVillagerXp()); + if (!this.isSilent()) { + serverLevel.levelEvent(null, 1026, this.blockPosition(), 0); + } + } + ); + return zombieVillager != null; } protected boolean isSunSensitive() { @@ -281,42 +300,42 @@ public class Zombie extends Monster { } @Override - public boolean hurt(DamageSource source, float amount) { - if (!super.hurt(source, amount)) { - return false; - } else if (!(this.level() instanceof ServerLevel)) { + public boolean hurtServer(ServerLevel serverLevel, DamageSource damageSource, float f) { + if (!super.hurtServer(serverLevel, damageSource, f)) { return false; } else { - ServerLevel serverLevel = (ServerLevel)this.level(); LivingEntity livingEntity = this.getTarget(); - if (livingEntity == null && source.getEntity() instanceof LivingEntity) { - livingEntity = (LivingEntity)source.getEntity(); + if (livingEntity == null && damageSource.getEntity() instanceof LivingEntity) { + livingEntity = (LivingEntity)damageSource.getEntity(); } if (livingEntity != null - && this.level().getDifficulty() == Difficulty.HARD + && serverLevel.getDifficulty() == Difficulty.HARD && this.random.nextFloat() < this.getAttributeValue(Attributes.SPAWN_REINFORCEMENTS_CHANCE) - && this.level().getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING)) { + && serverLevel.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING)) { int i = Mth.floor(this.getX()); int j = Mth.floor(this.getY()); int k = Mth.floor(this.getZ()); - Zombie zombie = new Zombie(this.level()); + EntityType entityType = this.getType(); + Zombie zombie = entityType.create(serverLevel, EntitySpawnReason.REINFORCEMENT); + if (zombie == null) { + return true; + } for (int l = 0; l < 50; l++) { int m = i + Mth.nextInt(this.random, 7, 40) * Mth.nextInt(this.random, -1, 1); int n = j + Mth.nextInt(this.random, 7, 40) * Mth.nextInt(this.random, -1, 1); int o = k + Mth.nextInt(this.random, 7, 40) * Mth.nextInt(this.random, -1, 1); BlockPos blockPos = new BlockPos(m, n, o); - EntityType entityType = zombie.getType(); - if (SpawnPlacements.isSpawnPositionOk(entityType, this.level(), blockPos) - && SpawnPlacements.checkSpawnRules(entityType, serverLevel, MobSpawnType.REINFORCEMENT, blockPos, this.level().random)) { + if (SpawnPlacements.isSpawnPositionOk(entityType, serverLevel, blockPos) + && SpawnPlacements.checkSpawnRules(entityType, serverLevel, EntitySpawnReason.REINFORCEMENT, blockPos, serverLevel.random)) { zombie.setPos(m, n, o); - if (!this.level().hasNearbyAlivePlayer(m, n, o, 7.0) - && this.level().isUnobstructed(zombie) - && this.level().noCollision(zombie) - && !this.level().containsAnyLiquid(zombie.getBoundingBox())) { + if (!serverLevel.hasNearbyAlivePlayer(m, n, o, 7.0) + && serverLevel.isUnobstructed(zombie) + && serverLevel.noCollision(zombie) + && (zombie.canSpawnInLiquids() || !serverLevel.containsAnyLiquid(zombie.getBoundingBox()))) { zombie.setTarget(livingEntity); - zombie.finalizeSpawn(serverLevel, this.level().getCurrentDifficultyAt(zombie.blockPosition()), MobSpawnType.REINFORCEMENT, null); + zombie.finalizeSpawn(serverLevel, serverLevel.getCurrentDifficultyAt(zombie.blockPosition()), EntitySpawnReason.REINFORCEMENT, null); serverLevel.addFreshEntityWithPassengers(zombie); AttributeInstance attributeInstance = this.getAttribute(Attributes.SPAWN_REINFORCEMENTS_CHANCE); AttributeModifier attributeModifier = attributeInstance.getModifier(REINFORCEMENT_CALLER_CHARGE_ID); @@ -335,12 +354,12 @@ public class Zombie extends Monster { } @Override - public boolean doHurtTarget(Entity target) { - boolean bl = super.doHurtTarget(target); + public boolean doHurtTarget(ServerLevel serverLevel, Entity entity) { + boolean bl = super.doHurtTarget(serverLevel, entity); if (bl) { float f = this.level().getCurrentDifficultyAt(this.blockPosition()).getEffectiveDifficulty(); if (this.getMainHandItem().isEmpty() && this.isOnFire() && this.random.nextFloat() < f * 0.3F) { - target.igniteForSeconds(2 * (int)f); + entity.igniteForSeconds(2 * (int)f); } } @@ -371,6 +390,15 @@ public class Zombie extends Monster { this.playSound(this.getStepSound(), 0.15F, 1.0F); } + @Override + public EntityType getType() { + return (EntityType)super.getType(); + } + + protected boolean canSpawnInLiquids() { + return false; + } + @Override protected void populateDefaultEquipmentSlots(RandomSource random, DifficultyInstance difficulty) { super.populateDefaultEquipmentSlots(random, difficulty); @@ -412,19 +440,7 @@ public class Zombie extends Monster { return bl; } - ZombieVillager zombieVillager = villager.convertTo(EntityType.ZOMBIE_VILLAGER, false); - if (zombieVillager != null) { - zombieVillager.finalizeSpawn( - level, level.getCurrentDifficultyAt(zombieVillager.blockPosition()), MobSpawnType.CONVERSION, new Zombie.ZombieGroupData(false, true) - ); - zombieVillager.setVillagerData(villager.getVillagerData()); - zombieVillager.setGossips(villager.getGossips().store(NbtOps.INSTANCE)); - zombieVillager.setTradeOffers(villager.getOffers().copy()); - zombieVillager.setVillagerXp(villager.getVillagerXp()); - if (!this.isSilent()) { - level.levelEvent(null, 1026, this.blockPosition(), 0); - } - + if (this.convertVillagerToZombieVillager(level, villager)) { bl = false; } } @@ -443,17 +459,22 @@ public class Zombie extends Monster { } @Override - public boolean wantsToPickUp(ItemStack stack) { - return stack.is(Items.GLOW_INK_SAC) ? false : super.wantsToPickUp(stack); + public boolean wantsToPickUp(ServerLevel serverLevel, ItemStack itemStack) { + return itemStack.is(Items.GLOW_INK_SAC) ? false : super.wantsToPickUp(serverLevel, itemStack); } @Nullable @Override - public SpawnGroupData finalizeSpawn(ServerLevelAccessor level, DifficultyInstance difficulty, MobSpawnType spawnType, @Nullable SpawnGroupData spawnGroupData) { - RandomSource randomSource = level.getRandom(); - spawnGroupData = super.finalizeSpawn(level, difficulty, spawnType, spawnGroupData); - float f = difficulty.getSpecialMultiplier(); - this.setCanPickUpLoot(randomSource.nextFloat() < 0.55F * f); + public SpawnGroupData finalizeSpawn( + ServerLevelAccessor serverLevelAccessor, DifficultyInstance difficultyInstance, EntitySpawnReason entitySpawnReason, @Nullable SpawnGroupData spawnGroupData + ) { + RandomSource randomSource = serverLevelAccessor.getRandom(); + spawnGroupData = super.finalizeSpawn(serverLevelAccessor, difficultyInstance, entitySpawnReason, spawnGroupData); + float f = difficultyInstance.getSpecialMultiplier(); + if (entitySpawnReason != EntitySpawnReason.CONVERSION) { + this.setCanPickUpLoot(randomSource.nextFloat() < 0.55F * f); + } + if (spawnGroupData == null) { spawnGroupData = new Zombie.ZombieGroupData(getSpawnAsBabyOdds(randomSource), true); } @@ -463,28 +484,32 @@ public class Zombie extends Monster { this.setBaby(true); if (zombieGroupData.canSpawnJockey) { if (randomSource.nextFloat() < 0.05) { - List list = level.getEntitiesOfClass(Chicken.class, this.getBoundingBox().inflate(5.0, 3.0, 5.0), EntitySelector.ENTITY_NOT_BEING_RIDDEN); + List list = serverLevelAccessor.getEntitiesOfClass( + Chicken.class, this.getBoundingBox().inflate(5.0, 3.0, 5.0), EntitySelector.ENTITY_NOT_BEING_RIDDEN + ); if (!list.isEmpty()) { Chicken chicken = (Chicken)list.get(0); chicken.setChickenJockey(true); this.startRiding(chicken); } } else if (randomSource.nextFloat() < 0.05) { - Chicken chicken2 = EntityType.CHICKEN.create(this.level()); + Chicken chicken2 = EntityType.CHICKEN.create(this.level(), EntitySpawnReason.JOCKEY); if (chicken2 != null) { chicken2.moveTo(this.getX(), this.getY(), this.getZ(), this.getYRot(), 0.0F); - chicken2.finalizeSpawn(level, difficulty, MobSpawnType.JOCKEY, null); + chicken2.finalizeSpawn(serverLevelAccessor, difficultyInstance, EntitySpawnReason.JOCKEY, null); chicken2.setChickenJockey(true); this.startRiding(chicken2); - level.addFreshEntity(chicken2); + serverLevelAccessor.addFreshEntity(chicken2); } } } } - this.setCanBreakDoors(this.supportsBreakDoorGoal() && randomSource.nextFloat() < f * 0.1F); - this.populateDefaultEquipmentSlots(randomSource, difficulty); - this.populateDefaultEquipmentEnchantments(level, randomSource, difficulty); + this.setCanBreakDoors(randomSource.nextFloat() < f * 0.1F); + if (entitySpawnReason != EntitySpawnReason.CONVERSION) { + this.populateDefaultEquipmentSlots(randomSource, difficultyInstance); + this.populateDefaultEquipmentEnchantments(serverLevelAccessor, randomSource, difficultyInstance); + } } if (this.getItemBySlot(EquipmentSlot.HEAD).isEmpty()) { @@ -501,6 +526,16 @@ public class Zombie extends Monster { return spawnGroupData; } + @VisibleForTesting + public void setInWaterTime(int i) { + this.inWaterTime = i; + } + + @VisibleForTesting + public void setConversionTime(int i) { + this.conversionTime = i; + } + public static boolean getSpawnAsBabyOdds(RandomSource random) { return random.nextFloat() < 0.05F; } @@ -522,7 +557,7 @@ public class Zombie extends Monster { .addOrReplacePermanentModifier( new AttributeModifier(LEADER_ZOMBIE_BONUS_ID, this.random.nextDouble() * 3.0 + 1.0, AttributeModifier.Operation.ADD_MULTIPLIED_TOTAL) ); - this.setCanBreakDoors(this.supportsBreakDoorGoal()); + this.setCanBreakDoors(true); } } @@ -537,7 +572,7 @@ public class Zombie extends Monster { ItemStack itemStack = this.getSkull(); if (!itemStack.isEmpty()) { creeper.increaseDroppedSkulls(); - this.spawnAtLocation(itemStack); + this.spawnAtLocation(level, itemStack); } } } diff --git a/net/minecraft/world/entity/monster/ZombieVillager.java b/net/minecraft/world/entity/monster/ZombieVillager.java index 110066c7..8f987605 100644 --- a/net/minecraft/world/entity/monster/ZombieVillager.java +++ b/net/minecraft/world/entity/monster/ZombieVillager.java @@ -1,5 +1,6 @@ package net.minecraft.world.entity.monster; +import com.google.common.annotations.VisibleForTesting; import com.mojang.logging.LogUtils; import com.mojang.serialization.DataResult; import com.mojang.serialization.Dynamic; @@ -14,6 +15,7 @@ import net.minecraft.nbt.Tag; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.network.syncher.SynchedEntityData.Builder; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.sounds.SoundEvent; @@ -24,13 +26,13 @@ import net.minecraft.world.InteractionResult; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.effect.MobEffectInstance; import net.minecraft.world.effect.MobEffects; +import net.minecraft.world.entity.ConversionParams; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.EquipmentSlot; -import net.minecraft.world.entity.MobSpawnType; import net.minecraft.world.entity.SlotAccess; import net.minecraft.world.entity.SpawnGroupData; import net.minecraft.world.entity.ai.village.ReputationEventType; -import net.minecraft.world.entity.npc.Villager; import net.minecraft.world.entity.npc.VillagerData; import net.minecraft.world.entity.npc.VillagerDataHolder; import net.minecraft.world.entity.npc.VillagerProfession; @@ -76,7 +78,7 @@ public class ZombieVillager extends Zombie implements VillagerDataHolder { } @Override - protected void defineSynchedData(SynchedEntityData.Builder builder) { + protected void defineSynchedData(Builder builder) { super.defineSynchedData(builder); builder.define(DATA_CONVERTING_ID, false); builder.define(DATA_VILLAGER_DATA, new VillagerData(VillagerType.PLAINS, VillagerProfession.NONE, 1)); @@ -153,7 +155,7 @@ public class ZombieVillager extends Zombie implements VillagerDataHolder { this.startConverting(player.getUUID(), this.random.nextInt(2401) + 3600); } - return InteractionResult.SUCCESS; + return InteractionResult.SUCCESS_SERVER; } else { return InteractionResult.CONSUME; } @@ -213,40 +215,48 @@ public class ZombieVillager extends Zombie implements VillagerDataHolder { } private void finishConversion(ServerLevel serverLevel) { - Villager villager = this.convertTo(EntityType.VILLAGER, false); - if (villager != null) { - for (EquipmentSlot equipmentSlot : this.dropPreservedEquipment( - itemStack -> !EnchantmentHelper.has(itemStack, EnchantmentEffectComponents.PREVENT_ARMOR_CHANGE) - )) { - SlotAccess slotAccess = villager.getSlot(equipmentSlot.getIndex() + 300); - slotAccess.set(this.getItemBySlot(equipmentSlot)); - } + this.convertTo( + EntityType.VILLAGER, + ConversionParams.single(this, false, false), + villager -> { + for (EquipmentSlot equipmentSlot : this.dropPreservedEquipment( + serverLevel, itemStack -> !EnchantmentHelper.has(itemStack, EnchantmentEffectComponents.PREVENT_ARMOR_CHANGE) + )) { + SlotAccess slotAccess = villager.getSlot(equipmentSlot.getIndex() + 300); + slotAccess.set(this.getItemBySlot(equipmentSlot)); + } - villager.setVillagerData(this.getVillagerData()); - if (this.gossips != null) { - villager.setGossips(this.gossips); - } + villager.setVillagerData(this.getVillagerData()); + if (this.gossips != null) { + villager.setGossips(this.gossips); + } - if (this.tradeOffers != null) { - villager.setOffers(this.tradeOffers.copy()); - } + if (this.tradeOffers != null) { + villager.setOffers(this.tradeOffers.copy()); + } - villager.setVillagerXp(this.villagerXp); - villager.finalizeSpawn(serverLevel, serverLevel.getCurrentDifficultyAt(villager.blockPosition()), MobSpawnType.CONVERSION, null); - villager.refreshBrain(serverLevel); - if (this.conversionStarter != null) { - Player player = serverLevel.getPlayerByUUID(this.conversionStarter); - if (player instanceof ServerPlayer) { - CriteriaTriggers.CURED_ZOMBIE_VILLAGER.trigger((ServerPlayer)player, this, villager); - serverLevel.onReputationEvent(ReputationEventType.ZOMBIE_VILLAGER_CURED, player, villager); + villager.setVillagerXp(this.villagerXp); + villager.finalizeSpawn(serverLevel, serverLevel.getCurrentDifficultyAt(villager.blockPosition()), EntitySpawnReason.CONVERSION, null); + villager.refreshBrain(serverLevel); + if (this.conversionStarter != null) { + Player player = serverLevel.getPlayerByUUID(this.conversionStarter); + if (player instanceof ServerPlayer) { + CriteriaTriggers.CURED_ZOMBIE_VILLAGER.trigger((ServerPlayer)player, this, villager); + serverLevel.onReputationEvent(ReputationEventType.ZOMBIE_VILLAGER_CURED, player, villager); + } + } + + villager.addEffect(new MobEffectInstance(MobEffects.CONFUSION, 200, 0)); + if (!this.isSilent()) { + serverLevel.levelEvent(null, 1027, this.blockPosition(), 0); } } + ); + } - villager.addEffect(new MobEffectInstance(MobEffects.CONFUSION, 200, 0)); - if (!this.isSilent()) { - serverLevel.levelEvent(null, 1027, this.blockPosition(), 0); - } - } + @VisibleForTesting + public void setVillagerConversionTime(int i) { + this.villagerConversionTime = i; } private int getConversionProgress() { @@ -314,9 +324,11 @@ public class ZombieVillager extends Zombie implements VillagerDataHolder { @Nullable @Override - public SpawnGroupData finalizeSpawn(ServerLevelAccessor level, DifficultyInstance difficulty, MobSpawnType spawnType, @Nullable SpawnGroupData spawnGroupData) { - this.setVillagerData(this.getVillagerData().setType(VillagerType.byBiome(level.getBiome(this.blockPosition())))); - return super.finalizeSpawn(level, difficulty, spawnType, spawnGroupData); + public SpawnGroupData finalizeSpawn( + ServerLevelAccessor serverLevelAccessor, DifficultyInstance difficultyInstance, EntitySpawnReason entitySpawnReason, @Nullable SpawnGroupData spawnGroupData + ) { + this.setVillagerData(this.getVillagerData().setType(VillagerType.byBiome(serverLevelAccessor.getBiome(this.blockPosition())))); + return super.finalizeSpawn(serverLevelAccessor, difficultyInstance, entitySpawnReason, spawnGroupData); } @Override diff --git a/net/minecraft/world/entity/monster/ZombifiedPiglin.java b/net/minecraft/world/entity/monster/ZombifiedPiglin.java index a2dcc7df..4a887f31 100644 --- a/net/minecraft/world/entity/monster/ZombifiedPiglin.java +++ b/net/minecraft/world/entity/monster/ZombifiedPiglin.java @@ -15,16 +15,16 @@ import net.minecraft.world.DifficultyInstance; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.EntityDimensions; import net.minecraft.world.entity.EntitySelector; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.entity.MobSpawnType; import net.minecraft.world.entity.NeutralMob; import net.minecraft.world.entity.Pose; import net.minecraft.world.entity.ai.attributes.AttributeInstance; import net.minecraft.world.entity.ai.attributes.AttributeModifier; -import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.entity.ai.attributes.AttributeSupplier.Builder; import net.minecraft.world.entity.ai.goal.WaterAvoidingRandomStrollGoal; import net.minecraft.world.entity.ai.goal.ZombieAttackGoal; import net.minecraft.world.entity.ai.goal.target.HurtByTargetGoal; @@ -76,7 +76,7 @@ public class ZombifiedPiglin extends Zombie implements NeutralMob { this.targetSelector.addGoal(3, new ResetUniversalAngerTargetGoal<>(this, true)); } - public static AttributeSupplier.Builder createAttributes() { + public static Builder createAttributes() { return Zombie.createAttributes().add(Attributes.SPAWN_REINFORCEMENTS_CHANCE, 0.0).add(Attributes.MOVEMENT_SPEED, 0.23F).add(Attributes.ATTACK_DAMAGE, 5.0); } @@ -91,7 +91,7 @@ public class ZombifiedPiglin extends Zombie implements NeutralMob { } @Override - protected void customServerAiStep() { + protected void customServerAiStep(ServerLevel serverLevel) { AttributeInstance attributeInstance = this.getAttribute(Attributes.MOVEMENT_SPEED); if (this.isAngry()) { if (!this.isBaby() && !attributeInstance.hasModifier(SPEED_MODIFIER_ATTACKING_ID)) { @@ -103,7 +103,7 @@ public class ZombifiedPiglin extends Zombie implements NeutralMob { attributeInstance.removeModifier(SPEED_MODIFIER_ATTACKING_ID); } - this.updatePersistentAnger((ServerLevel)this.level(), true); + this.updatePersistentAnger(serverLevel, true); if (this.getTarget() != null) { this.maybeAlertOthers(); } @@ -112,7 +112,7 @@ public class ZombifiedPiglin extends Zombie implements NeutralMob { this.lastHurtByPlayerTime = this.tickCount; } - super.customServerAiStep(); + super.customServerAiStep(serverLevel); } private void maybePlayFirstAngerSound() { @@ -153,17 +153,17 @@ public class ZombifiedPiglin extends Zombie implements NeutralMob { } @Override - public void setTarget(@Nullable LivingEntity target) { - if (this.getTarget() == null && target != null) { + public void setTarget(@Nullable LivingEntity livingEntity) { + if (this.getTarget() == null && livingEntity != null) { this.playFirstAngerSoundIn = FIRST_ANGER_SOUND_DELAY.sample(this.random); this.ticksUntilNextAlert = ALERT_INTERVAL.sample(this.random); } - if (target instanceof Player) { - this.setLastHurtByPlayer((Player)target); + if (livingEntity instanceof Player) { + this.setLastHurtByPlayer((Player)livingEntity); } - super.setTarget(target); + super.setTarget(livingEntity); } @Override @@ -172,9 +172,9 @@ public class ZombifiedPiglin extends Zombie implements NeutralMob { } public static boolean checkZombifiedPiglinSpawnRules( - EntityType zombifiedPiglin, LevelAccessor level, MobSpawnType spawnType, BlockPos pos, RandomSource random + EntityType entityType, LevelAccessor levelAccessor, EntitySpawnReason entitySpawnReason, BlockPos blockPos, RandomSource randomSource ) { - return level.getDifficulty() != Difficulty.PEACEFUL && !level.getBlockState(pos.below()).is(Blocks.NETHER_WART_BLOCK); + return levelAccessor.getDifficulty() != Difficulty.PEACEFUL && !levelAccessor.getBlockState(blockPos.below()).is(Blocks.NETHER_WART_BLOCK); } @Override @@ -241,12 +241,12 @@ public class ZombifiedPiglin extends Zombie implements NeutralMob { } @Override - public boolean isPreventingPlayerRest(Player player) { - return this.isAngryAt(player); + public boolean isPreventingPlayerRest(ServerLevel serverLevel, Player player) { + return this.isAngryAt(player, serverLevel); } @Override - public boolean wantsToPickUp(ItemStack stack) { - return this.canHoldItem(stack); + public boolean wantsToPickUp(ServerLevel serverLevel, ItemStack itemStack) { + return this.canHoldItem(itemStack); } } diff --git a/net/minecraft/world/entity/monster/breeze/Breeze.java b/net/minecraft/world/entity/monster/breeze/Breeze.java index e64dfe18..6c9f5e47 100644 --- a/net/minecraft/world/entity/monster/breeze/Breeze.java +++ b/net/minecraft/world/entity/monster/breeze/Breeze.java @@ -11,6 +11,8 @@ import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; import net.minecraft.tags.EntityTypeTags; +import net.minecraft.util.profiling.Profiler; +import net.minecraft.util.profiling.ProfilerFiller; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.AnimationState; import net.minecraft.world.entity.Entity; @@ -19,8 +21,9 @@ import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.Mob; import net.minecraft.world.entity.Pose; import net.minecraft.world.entity.ai.Brain; -import net.minecraft.world.entity.ai.attributes.AttributeSupplier; +import net.minecraft.world.entity.ai.Brain.Provider; import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.entity.ai.attributes.AttributeSupplier.Builder; import net.minecraft.world.entity.ai.memory.MemoryModuleType; import net.minecraft.world.entity.monster.Monster; import net.minecraft.world.entity.projectile.Projectile; @@ -55,7 +58,7 @@ public class Breeze extends Monster { ProjectileDeflection.REVERSE.deflect(projectile, entity, randomSource); }; - public static AttributeSupplier.Builder createAttributes() { + public static Builder createAttributes() { return Mob.createMobAttributes() .add(Attributes.MOVEMENT_SPEED, 0.63F) .add(Attributes.MAX_HEALTH, 30.0) @@ -81,7 +84,7 @@ public class Breeze extends Monster { } @Override - protected Brain.Provider brainProvider() { + protected Provider brainProvider() { return Brain.provider(BreezeAi.MEMORY_TYPES, BreezeAi.SENSOR_TYPES); } @@ -95,7 +98,7 @@ public class Breeze extends Monster { this.shoot.startIfStopped(this.tickCount); break; case INHALING: - this.longJump.startIfStopped(this.tickCount); + this.inhale.startIfStopped(this.tickCount); break; case SLIDING: this.slide.startIfStopped(this.tickCount); @@ -125,6 +128,7 @@ public class Breeze extends Monster { this.emitGroundParticles(20); break; case LONG_JUMPING: + this.longJump.startIfStopped(this.tickCount); this.emitJumpTrailParticles(); } @@ -133,6 +137,10 @@ public class Breeze extends Monster { this.slide.stop(); } + if (pose == Pose.STANDING) { + this.idle.startIfStopped(this.tickCount); + } + this.soundTick = this.soundTick == 0 ? this.random.nextIntBetweenInclusive(1, 80) : this.soundTick - 1; if (this.soundTick == 0) { this.playWhirlSound(); @@ -227,13 +235,14 @@ public class Breeze extends Monster { } @Override - protected void customServerAiStep() { - this.level().getProfiler().push("breezeBrain"); - this.getBrain().tick((ServerLevel)this.level(), this); - this.level().getProfiler().popPush("breezeActivityUpdate"); + protected void customServerAiStep(ServerLevel serverLevel) { + ProfilerFiller profilerFiller = Profiler.get(); + profilerFiller.push("breezeBrain"); + this.getBrain().tick(serverLevel, this); + profilerFiller.popPush("breezeActivityUpdate"); BreezeAi.updateActivity(this); - this.level().getProfiler().pop(); - super.customServerAiStep(); + profilerFiller.pop(); + super.customServerAiStep(serverLevel); } @Override @@ -258,13 +267,13 @@ public class Breeze extends Monster { return 25; } - public double getSnoutYPosition() { - return this.getEyeY() - 0.4; + public double getFiringYPosition() { + return this.getY() + this.getBbHeight() / 2.0F + 0.3F; } @Override - public boolean isInvulnerableTo(DamageSource source) { - return source.getEntity() instanceof Breeze || super.isInvulnerableTo(source); + public boolean isInvulnerableTo(ServerLevel serverLevel, DamageSource damageSource) { + return damageSource.getEntity() instanceof Breeze || super.isInvulnerableTo(serverLevel, damageSource); } @Override diff --git a/net/minecraft/world/entity/monster/breeze/BreezeAi.java b/net/minecraft/world/entity/monster/breeze/BreezeAi.java index 1e3effd1..da44b797 100644 --- a/net/minecraft/world/entity/monster/breeze/BreezeAi.java +++ b/net/minecraft/world/entity/monster/breeze/BreezeAi.java @@ -6,11 +6,9 @@ import com.google.common.collect.ImmutableSet; import com.mojang.datafixers.util.Pair; import java.util.List; import java.util.Set; -import java.util.function.Predicate; import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundEvents; import net.minecraft.util.Unit; -import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.Mob; import net.minecraft.world.entity.Pose; import net.minecraft.world.entity.ai.Brain; @@ -32,7 +30,7 @@ public class BreezeAi { public static final float SPEED_MULTIPLIER_WHEN_SLIDING = 0.6F; public static final float JUMP_CIRCLE_INNER_RADIUS = 4.0F; public static final float JUMP_CIRCLE_MIDDLE_RADIUS = 8.0F; - public static final float JUMP_CIRCLE_OUTER_RADIUS = 20.0F; + public static final float JUMP_CIRCLE_OUTER_RADIUS = 24.0F; static final List>> SENSOR_TYPES = ImmutableList.of( SensorType.NEAREST_LIVING_ENTITIES, SensorType.HURT_BY, SensorType.NEAREST_PLAYERS, SensorType.BREEZE_ATTACK_ENTITY_SENSOR ); @@ -55,6 +53,7 @@ public class BreezeAi { MemoryModuleType.HURT_BY_ENTITY, MemoryModuleType.PATH ); + private static final int TICKS_TO_REMEMBER_SEEN_TARGET = 100; protected static Brain makeBrain(Breeze breeze, Brain brain) { initCoreActivity(brain); @@ -67,15 +66,15 @@ public class BreezeAi { } private static void initCoreActivity(Brain brain) { - brain.addActivity(Activity.CORE, 0, ImmutableList.of(new Swim(0.8F), new LookAtTargetSink(45, 90))); + brain.addActivity(Activity.CORE, 0, ImmutableList.of(new Swim<>(0.8F), new LookAtTargetSink(45, 90))); } private static void initIdleActivity(Brain brain) { brain.addActivity( Activity.IDLE, ImmutableList.of( - Pair.of(0, StartAttacking.create(breeze -> breeze.getBrain().getMemory(MemoryModuleType.NEAREST_ATTACKABLE))), - Pair.of(1, StartAttacking.create(Breeze::getHurtBy)), + Pair.of(0, StartAttacking.create((serverLevel, breeze) -> breeze.getBrain().getMemory(MemoryModuleType.NEAREST_ATTACKABLE))), + Pair.of(1, StartAttacking.create((serverLevel, breeze) -> breeze.getHurtBy())), Pair.of(2, new BreezeAi.SlideToTargetSink(20, 40)), Pair.of(3, new RunOne<>(ImmutableList.of(Pair.of(new DoNothing(20, 100), 1), Pair.of(RandomStroll.stroll(0.6F), 2)))) ) @@ -86,7 +85,7 @@ public class BreezeAi { brain.addActivityWithConditions( Activity.FIGHT, ImmutableList.of( - Pair.of(0, StopAttackingIfTargetInvalid.create((Predicate)(livingEntity -> !Sensor.isEntityAttackable(breeze, livingEntity)))), + Pair.of(0, StopAttackingIfTargetInvalid.create(Sensor.wasEntityAttackableLastNTicks(breeze, 100).negate()::test)), Pair.of(1, new Shoot()), Pair.of(2, new LongJump()), Pair.of(3, new ShootWhenStuck()), diff --git a/net/minecraft/world/entity/monster/breeze/BreezeUtil.java b/net/minecraft/world/entity/monster/breeze/BreezeUtil.java index 2e0dd854..288a61dd 100644 --- a/net/minecraft/world/entity/monster/breeze/BreezeUtil.java +++ b/net/minecraft/world/entity/monster/breeze/BreezeUtil.java @@ -3,9 +3,12 @@ package net.minecraft.world.entity.monster.breeze; import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.level.ClipContext; -import net.minecraft.world.phys.HitResult; +import net.minecraft.world.level.ClipContext.Block; +import net.minecraft.world.level.ClipContext.Fluid; import net.minecraft.world.phys.Vec3; +import net.minecraft.world.phys.HitResult.Type; public class BreezeUtil { private static final double MAX_LINE_OF_SIGHT_TEST_RANGE = 50.0; @@ -20,8 +23,12 @@ public class BreezeUtil { public static boolean hasLineOfSight(Breeze breeze, Vec3 pos) { Vec3 vec3 = new Vec3(breeze.getX(), breeze.getY(), breeze.getZ()); - return pos.distanceTo(vec3) > 50.0 + return pos.distanceTo(vec3) > getMaxLineOfSightTestRange(breeze) ? false - : breeze.level().clip(new ClipContext(vec3, pos, ClipContext.Block.COLLIDER, ClipContext.Fluid.NONE, breeze)).getType() == HitResult.Type.MISS; + : breeze.level().clip(new ClipContext(vec3, pos, Block.COLLIDER, Fluid.NONE, breeze)).getType() == Type.MISS; + } + + private static double getMaxLineOfSightTestRange(Breeze breeze) { + return Math.max(50.0, breeze.getAttributeValue(Attributes.FOLLOW_RANGE)); } } diff --git a/net/minecraft/world/entity/monster/breeze/LongJump.java b/net/minecraft/world/entity/monster/breeze/LongJump.java index 01829640..fd51de54 100644 --- a/net/minecraft/world/entity/monster/breeze/LongJump.java +++ b/net/minecraft/world/entity/monster/breeze/LongJump.java @@ -6,7 +6,7 @@ import it.unimi.dsi.fastutil.objects.ObjectArrayList; import java.util.Map; import java.util.Optional; import net.minecraft.Util; -import net.minecraft.commands.arguments.EntityAnchorArgument; +import net.minecraft.commands.arguments.EntityAnchorArgument.Anchor; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.server.level.ServerLevel; @@ -15,17 +15,23 @@ import net.minecraft.sounds.SoundSource; import net.minecraft.tags.FluidTags; import net.minecraft.util.RandomSource; import net.minecraft.util.Unit; +import net.minecraft.world.effect.MobEffects; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.Pose; +import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.entity.ai.behavior.Behavior; import net.minecraft.world.entity.ai.behavior.LongJumpUtil; import net.minecraft.world.entity.ai.behavior.Swim; import net.minecraft.world.entity.ai.memory.MemoryModuleType; import net.minecraft.world.entity.ai.memory.MemoryStatus; import net.minecraft.world.level.ClipContext; +import net.minecraft.world.level.ClipContext.Block; +import net.minecraft.world.level.ClipContext.Fluid; +import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.HitResult; import net.minecraft.world.phys.Vec3; +import net.minecraft.world.phys.HitResult.Type; import org.jetbrains.annotations.Nullable; public class LongJump extends Behavior { @@ -33,7 +39,9 @@ public class LongJump extends Behavior { private static final int JUMP_COOLDOWN_TICKS = 10; private static final int JUMP_COOLDOWN_WHEN_HURT_TICKS = 2; private static final int INHALING_DURATION_TICKS = Math.round(10.0F); - private static final float MAX_JUMP_VELOCITY = 1.4F; + private static final float DEFAULT_FOLLOW_RANGE = 24.0F; + private static final float DEFAULT_MAX_JUMP_VELOCITY = 1.4F; + private static final float MAX_JUMP_VELOCITY_MULTIPLIER = 0.058333334F; private static final ObjectArrayList ALLOWED_ANGLES = new ObjectArrayList<>(Lists.newArrayList(40, 55, 60, 75, 80)); @VisibleForTesting @@ -111,7 +119,7 @@ public class LongJump extends Behavior { entity.setPose(Pose.INHALING); level.playSound(null, entity, SoundEvents.BREEZE_CHARGE, SoundSource.HOSTILE, 1.0F, 1.0F); - entity.getBrain().getMemory(MemoryModuleType.BREEZE_JUMP_TARGET).ifPresent(blockPos -> entity.lookAt(EntityAnchorArgument.Anchor.EYES, blockPos.getCenter())); + entity.getBrain().getMemory(MemoryModuleType.BREEZE_JUMP_TARGET).ifPresent(blockPos -> entity.lookAt(Anchor.EYES, blockPos.getCenter())); } protected void tick(ServerLevel level, Breeze owner, long gameTime) { @@ -172,19 +180,19 @@ public class LongJump extends Behavior { @Nullable private static BlockPos snapToSurface(LivingEntity owner, Vec3 targetPos) { - ClipContext clipContext = new ClipContext(targetPos, targetPos.relative(Direction.DOWN, 10.0), ClipContext.Block.COLLIDER, ClipContext.Fluid.NONE, owner); + ClipContext clipContext = new ClipContext(targetPos, targetPos.relative(Direction.DOWN, 10.0), Block.COLLIDER, Fluid.NONE, owner); HitResult hitResult = owner.level().clip(clipContext); - if (hitResult.getType() == HitResult.Type.BLOCK) { + if (hitResult.getType() == Type.BLOCK) { return BlockPos.containing(hitResult.getLocation()).above(); } else { - ClipContext clipContext2 = new ClipContext(targetPos, targetPos.relative(Direction.UP, 10.0), ClipContext.Block.COLLIDER, ClipContext.Fluid.NONE, owner); + ClipContext clipContext2 = new ClipContext(targetPos, targetPos.relative(Direction.UP, 10.0), Block.COLLIDER, Fluid.NONE, owner); HitResult hitResult2 = owner.level().clip(clipContext2); - return hitResult2.getType() == HitResult.Type.BLOCK ? BlockPos.containing(hitResult2.getLocation()).above() : null; + return hitResult2.getType() == Type.BLOCK ? BlockPos.containing(hitResult2.getLocation()).above() : null; } } private static boolean outOfAggroRange(Breeze breeze, LivingEntity target) { - return !target.closerThan(breeze, 24.0); + return !target.closerThan(breeze, breeze.getAttributeValue(Attributes.FOLLOW_RANGE)); } private static boolean tooCloseForJump(Breeze breeze, LivingEntity target) { @@ -193,21 +201,30 @@ public class LongJump extends Behavior { private static boolean canJumpFromCurrentPosition(ServerLevel level, Breeze breeze) { BlockPos blockPos = breeze.blockPosition(); - - for (int i = 1; i <= 4; i++) { - BlockPos blockPos2 = blockPos.relative(Direction.UP, i); - if (!level.getBlockState(blockPos2).isAir() && !level.getFluidState(blockPos2).is(FluidTags.WATER)) { - return false; + if (level.getBlockState(blockPos).is(Blocks.HONEY_BLOCK)) { + return false; + } else { + for (int i = 1; i <= 4; i++) { + BlockPos blockPos2 = blockPos.relative(Direction.UP, i); + if (!level.getBlockState(blockPos2).isAir() && !level.getFluidState(blockPos2).is(FluidTags.WATER)) { + return false; + } } - } - return true; + return true; + } } private static Optional calculateOptimalJumpVector(Breeze breeze, RandomSource random, Vec3 target) { for (int i : Util.shuffledCopy(ALLOWED_ANGLES, random)) { - Optional optional = LongJumpUtil.calculateJumpVectorForAngle(breeze, target, 1.4F, i, false); + float f = 0.058333334F * (float)breeze.getAttributeValue(Attributes.FOLLOW_RANGE); + Optional optional = LongJumpUtil.calculateJumpVectorForAngle(breeze, target, f, i, false); if (optional.isPresent()) { + if (breeze.hasEffect(MobEffects.JUMP)) { + double d = ((Vec3)optional.get()).normalize().y * breeze.getJumpBoostPower(); + return optional.map(vec3 -> vec3.add(0.0, d, 0.0)); + } + return optional; } } diff --git a/net/minecraft/world/entity/monster/breeze/Shoot.java b/net/minecraft/world/entity/monster/breeze/Shoot.java index d0234b0d..71b30751 100644 --- a/net/minecraft/world/entity/monster/breeze/Shoot.java +++ b/net/minecraft/world/entity/monster/breeze/Shoot.java @@ -2,7 +2,7 @@ package net.minecraft.world.entity.monster.breeze; import com.google.common.annotations.VisibleForTesting; import com.google.common.collect.ImmutableMap; -import net.minecraft.commands.arguments.EntityAnchorArgument; +import net.minecraft.commands.arguments.EntityAnchorArgument.Anchor; import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundEvents; import net.minecraft.util.Unit; @@ -12,11 +12,11 @@ import net.minecraft.world.entity.ai.Brain; import net.minecraft.world.entity.ai.behavior.Behavior; import net.minecraft.world.entity.ai.memory.MemoryModuleType; import net.minecraft.world.entity.ai.memory.MemoryStatus; +import net.minecraft.world.entity.projectile.Projectile; import net.minecraft.world.entity.projectile.windcharge.BreezeWindCharge; -import net.minecraft.world.phys.Vec3; +import net.minecraft.world.item.ItemStack; public class Shoot extends Behavior { - private static final int ATTACK_RANGE_MIN_SQRT = 4; private static final int ATTACK_RANGE_MAX_SQRT = 256; private static final int UNCERTAINTY_BASE = 5; private static final int UNCERTAINTY_MULTIPLIER = 4; @@ -83,31 +83,20 @@ public class Shoot extends Behavior { Brain brain = owner.getBrain(); LivingEntity livingEntity = (LivingEntity)brain.getMemory(MemoryModuleType.ATTACK_TARGET).orElse(null); if (livingEntity != null) { - owner.lookAt(EntityAnchorArgument.Anchor.EYES, livingEntity.position()); + owner.lookAt(Anchor.EYES, livingEntity.position()); if (!brain.getMemory(MemoryModuleType.BREEZE_SHOOT_CHARGING).isPresent() && !brain.getMemory(MemoryModuleType.BREEZE_SHOOT_RECOVERING).isPresent()) { brain.setMemoryWithExpiry(MemoryModuleType.BREEZE_SHOOT_RECOVERING, Unit.INSTANCE, SHOOT_RECOVER_DELAY_TICKS); - if (isFacingTarget(owner, livingEntity)) { - double d = livingEntity.getX() - owner.getX(); - double e = livingEntity.getY(livingEntity.isPassenger() ? 0.8 : 0.3) - owner.getY(0.5); - double f = livingEntity.getZ() - owner.getZ(); - BreezeWindCharge breezeWindCharge = new BreezeWindCharge(owner, level); - owner.playSound(SoundEvents.BREEZE_SHOOT, 1.5F, 1.0F); - breezeWindCharge.shoot(d, e, f, 0.7F, 5 - level.getDifficulty().getId() * 4); - level.addFreshEntity(breezeWindCharge); - } + double d = livingEntity.getX() - owner.getX(); + double e = livingEntity.getY(livingEntity.isPassenger() ? 0.8 : 0.3) - owner.getFiringYPosition(); + double f = livingEntity.getZ() - owner.getZ(); + Projectile.spawnProjectileUsingShoot(new BreezeWindCharge(owner, level), level, ItemStack.EMPTY, d, e, f, 0.7F, 5 - level.getDifficulty().getId() * 4); + owner.playSound(SoundEvents.BREEZE_SHOOT, 1.5F, 1.0F); } } } - @VisibleForTesting - public static boolean isFacingTarget(Breeze breeze, LivingEntity target) { - Vec3 vec3 = breeze.getViewVector(1.0F); - Vec3 vec32 = target.position().subtract(breeze.position()).normalize(); - return vec3.dot(vec32) > 0.5; - } - private static boolean isTargetWithinRange(Breeze breeze, LivingEntity target) { double d = breeze.position().distanceToSqr(target.position()); - return d > 4.0 && d < 256.0; + return d < 256.0; } } diff --git a/net/minecraft/world/entity/monster/creaking/Creaking.java b/net/minecraft/world/entity/monster/creaking/Creaking.java new file mode 100644 index 00000000..f6a33e6e --- /dev/null +++ b/net/minecraft/world/entity/monster/creaking/Creaking.java @@ -0,0 +1,323 @@ +package net.minecraft.world.entity.monster.creaking; + +import com.mojang.serialization.Dynamic; +import java.util.List; +import java.util.function.DoubleSupplier; +import java.util.function.Predicate; +import net.minecraft.core.BlockPos; +import net.minecraft.network.protocol.game.DebugPackets; +import net.minecraft.network.syncher.EntityDataAccessor; +import net.minecraft.network.syncher.EntityDataSerializers; +import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.network.syncher.SynchedEntityData.Builder; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.sounds.SoundEvent; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.util.profiling.Profiler; +import net.minecraft.util.profiling.ProfilerFiller; +import net.minecraft.world.damagesource.DamageSource; +import net.minecraft.world.entity.AnimationState; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.ai.Brain; +import net.minecraft.world.entity.ai.Brain.Provider; +import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.entity.ai.control.BodyRotationControl; +import net.minecraft.world.entity.ai.control.JumpControl; +import net.minecraft.world.entity.ai.control.LookControl; +import net.minecraft.world.entity.ai.control.MoveControl; +import net.minecraft.world.entity.ai.memory.MemoryModuleType; +import net.minecraft.world.entity.ai.navigation.GroundPathNavigation; +import net.minecraft.world.entity.monster.Monster; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.gameevent.GameEvent; +import org.jetbrains.annotations.Nullable; + +public class Creaking extends Monster { + private static final EntityDataAccessor CAN_MOVE = SynchedEntityData.defineId(Creaking.class, EntityDataSerializers.BOOLEAN); + private static final EntityDataAccessor IS_ACTIVE = SynchedEntityData.defineId(Creaking.class, EntityDataSerializers.BOOLEAN); + private static final int ATTACK_ANIMATION_DURATION = 20; + private static final int MAX_HEALTH = 1; + private static final float ATTACK_DAMAGE = 2.0F; + private static final float FOLLOW_RANGE = 32.0F; + private static final float ACTIVATION_RANGE_SQ = 144.0F; + public static final int ATTACK_INTERVAL = 40; + private static final float MOVEMENT_SPEED_WHEN_FIGHTING = 0.3F; + public static final float SPEED_MULTIPLIER_WHEN_IDLING = 0.2F; + public static final int CREAKING_ORANGE = 16545810; + public static final int CREAKING_GRAY = 6250335; + private int attackAnimationRemainingTicks; + public final AnimationState attackAnimationState = new AnimationState(); + public final AnimationState invulnerabilityAnimationState = new AnimationState(); + + public Creaking(EntityType entityType, Level level) { + super(entityType, level); + this.lookControl = new Creaking.CreakingLookControl(this); + this.moveControl = new Creaking.CreakingMoveControl(this); + this.jumpControl = new Creaking.CreakingJumpControl(this); + GroundPathNavigation groundPathNavigation = (GroundPathNavigation)this.getNavigation(); + groundPathNavigation.setCanFloat(true); + this.xpReward = 0; + } + + @Override + protected BodyRotationControl createBodyControl() { + return new Creaking.CreakingBodyRotationControl(this); + } + + @Override + protected Provider brainProvider() { + return CreakingAi.brainProvider(); + } + + @Override + protected Brain makeBrain(Dynamic dynamic) { + return CreakingAi.makeBrain(this.brainProvider().makeBrain(dynamic)); + } + + @Override + protected void defineSynchedData(Builder builder) { + super.defineSynchedData(builder); + builder.define(CAN_MOVE, true); + builder.define(IS_ACTIVE, false); + } + + public static net.minecraft.world.entity.ai.attributes.AttributeSupplier.Builder createAttributes() { + return Monster.createMonsterAttributes() + .add(Attributes.MAX_HEALTH, 1.0) + .add(Attributes.MOVEMENT_SPEED, 0.3F) + .add(Attributes.ATTACK_DAMAGE, 2.0) + .add(Attributes.FOLLOW_RANGE, 32.0) + .add(Attributes.STEP_HEIGHT, 1.0); + } + + public boolean canMove() { + return this.entityData.get(CAN_MOVE); + } + + @Override + public boolean doHurtTarget(ServerLevel serverLevel, Entity entity) { + if (!(entity instanceof LivingEntity)) { + return false; + } else { + this.attackAnimationRemainingTicks = 20; + this.level().broadcastEntityEvent(this, (byte)4); + return super.doHurtTarget(serverLevel, entity); + } + } + + @Override + public boolean isPushable() { + return super.isPushable() && this.canMove(); + } + + @Override + public Brain getBrain() { + return (Brain)super.getBrain(); + } + + @Override + protected void customServerAiStep(ServerLevel serverLevel) { + ProfilerFiller profilerFiller = Profiler.get(); + profilerFiller.push("creakingBrain"); + this.getBrain().tick((ServerLevel)this.level(), this); + profilerFiller.pop(); + CreakingAi.updateActivity(this); + } + + @Override + public void aiStep() { + if (this.attackAnimationRemainingTicks > 0) { + this.attackAnimationRemainingTicks--; + } + + if (!this.level().isClientSide) { + boolean bl = this.entityData.get(CAN_MOVE); + boolean bl2 = this.checkCanMove(); + if (bl2 != bl) { + this.gameEvent(GameEvent.ENTITY_ACTION); + if (bl2) { + this.makeSound(SoundEvents.CREAKING_UNFREEZE); + } else { + this.stopInPlace(); + this.makeSound(SoundEvents.CREAKING_FREEZE); + } + } + + this.entityData.set(CAN_MOVE, bl2); + } + + super.aiStep(); + } + + @Override + public void tick() { + super.tick(); + if (this.level().isClientSide) { + this.setupAnimationStates(); + } + } + + private void setupAnimationStates() { + this.attackAnimationState.animateWhen(this.attackAnimationRemainingTicks > 0, this.tickCount); + } + + @Override + public void handleEntityEvent(byte id) { + if (id == 4) { + this.attackAnimationRemainingTicks = 20; + this.playAttackSound(); + } else { + super.handleEntityEvent(id); + } + } + + @Override + public void playAttackSound() { + this.makeSound(SoundEvents.CREAKING_ATTACK); + } + + @Override + protected SoundEvent getAmbientSound() { + return this.isActive() ? null : SoundEvents.CREAKING_AMBIENT; + } + + @Override + protected SoundEvent getHurtSound(DamageSource damageSource) { + return SoundEvents.CREAKING_SWAY; + } + + @Override + protected SoundEvent getDeathSound() { + return SoundEvents.CREAKING_DEATH; + } + + @Override + protected void playStepSound(BlockPos pos, BlockState state) { + this.playSound(SoundEvents.CREAKING_STEP, 0.15F, 1.0F); + } + + @Nullable + @Override + public LivingEntity getTarget() { + return this.getTargetFromBrain(); + } + + @Override + protected void sendDebugPackets() { + super.sendDebugPackets(); + DebugPackets.sendEntityBrain(this); + } + + @Override + public void knockback(double strength, double x, double z) { + if (this.canMove()) { + super.knockback(strength, x, z); + } + } + + public boolean checkCanMove() { + List list = (List)this.brain.getMemory(MemoryModuleType.NEAREST_PLAYERS).orElse(List.of()); + if (list.isEmpty()) { + if (this.isActive()) { + this.gameEvent(GameEvent.ENTITY_ACTION); + this.makeSound(SoundEvents.CREAKING_DEACTIVATE); + this.setIsActive(false); + } + + return true; + } else { + Predicate predicate = this.isActive() ? LivingEntity.PLAYER_NOT_WEARING_DISGUISE_ITEM : livingEntity -> true; + + for (Player player : list) { + if (!player.isCreative() + && this.isLookingAtMe(player, 0.5, false, true, predicate, new DoubleSupplier[]{this::getEyeY, this::getY, () -> (this.getEyeY() + this.getY()) / 2.0})) { + if (this.isActive()) { + return false; + } + + if (player.distanceToSqr(this) < 144.0) { + this.gameEvent(GameEvent.ENTITY_ACTION); + this.makeSound(SoundEvents.CREAKING_ACTIVATE); + this.setIsActive(true); + this.getBrain().setMemory(MemoryModuleType.ATTACK_TARGET, player); + return false; + } + } + } + + return true; + } + } + + public void setIsActive(boolean bl) { + this.entityData.set(IS_ACTIVE, bl); + } + + public boolean isActive() { + return this.entityData.get(IS_ACTIVE); + } + + @Override + public float getWalkTargetValue(BlockPos pos, LevelReader level) { + return 0.0F; + } + + class CreakingBodyRotationControl extends BodyRotationControl { + public CreakingBodyRotationControl(final Creaking creaking2) { + super(creaking2); + } + + @Override + public void clientTick() { + if (Creaking.this.canMove()) { + super.clientTick(); + } + } + } + + class CreakingJumpControl extends JumpControl { + public CreakingJumpControl(final Creaking creaking2) { + super(creaking2); + } + + @Override + public void tick() { + if (Creaking.this.canMove()) { + super.tick(); + } else { + Creaking.this.setJumping(false); + } + } + } + + class CreakingLookControl extends LookControl { + public CreakingLookControl(final Creaking creaking2) { + super(creaking2); + } + + @Override + public void tick() { + if (Creaking.this.canMove()) { + super.tick(); + } + } + } + + class CreakingMoveControl extends MoveControl { + public CreakingMoveControl(final Creaking creaking2) { + super(creaking2); + } + + @Override + public void tick() { + if (Creaking.this.canMove()) { + super.tick(); + } + } + } +} diff --git a/net/minecraft/world/entity/monster/creaking/CreakingAi.java b/net/minecraft/world/entity/monster/creaking/CreakingAi.java new file mode 100644 index 00000000..0cbd86fc --- /dev/null +++ b/net/minecraft/world/entity/monster/creaking/CreakingAi.java @@ -0,0 +1,102 @@ +package net.minecraft.world.entity.monster.creaking; + +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableSet; +import com.mojang.datafixers.util.Pair; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.util.valueproviders.UniformInt; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.ai.Brain; +import net.minecraft.world.entity.ai.Brain.Provider; +import net.minecraft.world.entity.ai.behavior.DoNothing; +import net.minecraft.world.entity.ai.behavior.LookAtTargetSink; +import net.minecraft.world.entity.ai.behavior.MeleeAttack; +import net.minecraft.world.entity.ai.behavior.MoveToTargetSink; +import net.minecraft.world.entity.ai.behavior.RandomStroll; +import net.minecraft.world.entity.ai.behavior.RunOne; +import net.minecraft.world.entity.ai.behavior.SetEntityLookTargetSometimes; +import net.minecraft.world.entity.ai.behavior.SetWalkTargetFromAttackTargetIfTargetOutOfReach; +import net.minecraft.world.entity.ai.behavior.SetWalkTargetFromLookTarget; +import net.minecraft.world.entity.ai.behavior.StartAttacking; +import net.minecraft.world.entity.ai.behavior.StopAttackingIfTargetInvalid; +import net.minecraft.world.entity.ai.behavior.Swim; +import net.minecraft.world.entity.ai.memory.MemoryModuleType; +import net.minecraft.world.entity.ai.sensing.Sensor; +import net.minecraft.world.entity.ai.sensing.SensorType; +import net.minecraft.world.entity.schedule.Activity; + +public class CreakingAi { + protected static final ImmutableList>> SENSOR_TYPES = ImmutableList.of( + SensorType.NEAREST_LIVING_ENTITIES, SensorType.NEAREST_PLAYERS + ); + protected static final ImmutableList> MEMORY_TYPES = ImmutableList.of( + MemoryModuleType.NEAREST_LIVING_ENTITIES, + MemoryModuleType.NEAREST_VISIBLE_LIVING_ENTITIES, + MemoryModuleType.NEAREST_VISIBLE_PLAYER, + MemoryModuleType.NEAREST_VISIBLE_ATTACKABLE_PLAYER, + MemoryModuleType.LOOK_TARGET, + MemoryModuleType.WALK_TARGET, + MemoryModuleType.CANT_REACH_WALK_TARGET_SINCE, + MemoryModuleType.PATH, + MemoryModuleType.ATTACK_TARGET, + MemoryModuleType.ATTACK_COOLING_DOWN + ); + + static void initCoreActivity(Brain brain) { + brain.addActivity(Activity.CORE, 0, ImmutableList.of(new Swim(0.8F) { + protected boolean checkExtraStartConditions(ServerLevel serverLevel, Creaking creaking) { + return creaking.canMove() && super.checkExtraStartConditions(serverLevel, (LivingEntity)creaking); + } + }, new LookAtTargetSink(45, 90), new MoveToTargetSink())); + } + + static void initIdleActivity(Brain brain) { + brain.addActivity( + Activity.IDLE, + 10, + ImmutableList.of( + StartAttacking.create( + (serverLevel, creaking) -> creaking.isActive(), + (serverLevel, creaking) -> creaking.getBrain().getMemory(MemoryModuleType.NEAREST_VISIBLE_ATTACKABLE_PLAYER) + ), + SetEntityLookTargetSometimes.create(8.0F, UniformInt.of(30, 60)), + new RunOne<>( + ImmutableList.of(Pair.of(RandomStroll.stroll(0.2F), 2), Pair.of(SetWalkTargetFromLookTarget.create(0.2F, 3), 2), Pair.of(new DoNothing(30, 60), 1)) + ) + ) + ); + } + + static void initFightActivity(Brain brain) { + brain.addActivityAndRemoveMemoryWhenStopped( + Activity.FIGHT, + 10, + ImmutableList.of( + SetWalkTargetFromAttackTargetIfTargetOutOfReach.create(1.0F), MeleeAttack.create(Creaking::canMove, 40), StopAttackingIfTargetInvalid.create() + ), + MemoryModuleType.ATTACK_TARGET + ); + } + + public static Provider brainProvider() { + return Brain.provider(MEMORY_TYPES, SENSOR_TYPES); + } + + public static Brain makeBrain(Brain brain) { + initCoreActivity(brain); + initIdleActivity(brain); + initFightActivity(brain); + brain.setCoreActivities(ImmutableSet.of(Activity.CORE)); + brain.setDefaultActivity(Activity.IDLE); + brain.useDefaultActivity(); + return brain; + } + + public static void updateActivity(Creaking creaking) { + if (!creaking.canMove()) { + creaking.getBrain().useDefaultActivity(); + } else { + creaking.getBrain().setActiveActivityToFirstValid(ImmutableList.of(Activity.FIGHT, Activity.IDLE)); + } + } +} diff --git a/net/minecraft/world/entity/monster/creaking/CreakingTransient.java b/net/minecraft/world/entity/monster/creaking/CreakingTransient.java new file mode 100644 index 00000000..d327131c --- /dev/null +++ b/net/minecraft/world/entity/monster/creaking/CreakingTransient.java @@ -0,0 +1,194 @@ +package net.minecraft.world.entity.monster.creaking; + +import net.minecraft.core.BlockPos; +import net.minecraft.core.Vec3i; +import net.minecraft.core.particles.BlockParticleOption; +import net.minecraft.core.particles.ParticleTypes; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.tags.DamageTypeTags; +import net.minecraft.world.damagesource.DamageSource; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.ai.navigation.GroundPathNavigation; +import net.minecraft.world.entity.ai.navigation.PathNavigation; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.CreakingHeartBlock; +import net.minecraft.world.level.block.entity.CreakingHeartBlockEntity; +import net.minecraft.world.level.pathfinder.PathFinder; +import net.minecraft.world.level.pathfinder.PathType; +import net.minecraft.world.level.pathfinder.PathfindingContext; +import net.minecraft.world.level.pathfinder.WalkNodeEvaluator; +import net.minecraft.world.phys.AABB; +import net.minecraft.world.phys.Vec3; +import org.jetbrains.annotations.Nullable; + +public class CreakingTransient extends Creaking { + public static final int INVULNERABILITY_ANIMATION_DURATION = 8; + private int invulnerabilityAnimationRemainingTicks; + @Nullable + BlockPos homePos; + + public CreakingTransient(EntityType entityType, Level level) { + super(entityType, level); + } + + public void bindToCreakingHeart(BlockPos blockPos) { + this.homePos = blockPos; + } + + @Override + public boolean hurtServer(ServerLevel serverLevel, DamageSource damageSource, float f) { + if (this.level().isClientSide) { + return super.hurtServer(serverLevel, damageSource, f); + } else if (damageSource.is(DamageTypeTags.BYPASSES_INVULNERABILITY)) { + return super.hurtServer(serverLevel, damageSource, f); + } else if (!this.isInvulnerableTo(serverLevel, damageSource) && this.invulnerabilityAnimationRemainingTicks <= 0) { + this.invulnerabilityAnimationRemainingTicks = 8; + this.level().broadcastEntityEvent(this, (byte)66); + if (this.level().getBlockEntity(this.homePos) instanceof CreakingHeartBlockEntity creakingHeartBlockEntity && creakingHeartBlockEntity.isProtector(this)) { + if (damageSource.getEntity() instanceof Player) { + creakingHeartBlockEntity.creakingHurt(); + } + + this.playHurtSound(damageSource); + } + + return true; + } else { + return false; + } + } + + @Override + public void aiStep() { + if (this.invulnerabilityAnimationRemainingTicks > 0) { + this.invulnerabilityAnimationRemainingTicks--; + } + + super.aiStep(); + } + + @Override + public void tick() { + if (this.level().isClientSide + || this.homePos != null + && this.level().getBlockEntity(this.homePos) instanceof CreakingHeartBlockEntity creakingHeartBlockEntity + && creakingHeartBlockEntity.isProtector(this)) { + super.tick(); + if (this.level().isClientSide) { + this.setupAnimationStates(); + } + } else { + this.setRemoved(Entity.RemovalReason.DISCARDED); + } + } + + @Override + public void handleEntityEvent(byte id) { + if (id == 66) { + this.invulnerabilityAnimationRemainingTicks = 8; + this.playHurtSound(this.damageSources().generic()); + } else { + super.handleEntityEvent(id); + } + } + + private void setupAnimationStates() { + this.invulnerabilityAnimationState.animateWhen(this.invulnerabilityAnimationRemainingTicks > 0, this.tickCount); + } + + public void tearDown(@Nullable DamageSource damageSource) { + if (this.level() instanceof ServerLevel serverLevel) { + AABB aABB = this.getBoundingBox(); + Vec3 vec3 = aABB.getCenter(); + double d = aABB.getXsize() * 0.3; + double e = aABB.getYsize() * 0.3; + double f = aABB.getZsize() * 0.3; + serverLevel.sendParticles( + new BlockParticleOption(ParticleTypes.BLOCK_CRUMBLE, Blocks.PALE_OAK_WOOD.defaultBlockState()), vec3.x, vec3.y, vec3.z, 100, d, e, f, 0.0 + ); + serverLevel.sendParticles( + new BlockParticleOption( + ParticleTypes.BLOCK_CRUMBLE, Blocks.CREAKING_HEART.defaultBlockState().setValue(CreakingHeartBlock.CREAKING, CreakingHeartBlock.CreakingHeartState.ACTIVE) + ), + vec3.x, + vec3.y, + vec3.z, + 10, + d, + e, + f, + 0.0 + ); + } + + this.makeSound(this.getDeathSound()); + if (this.deathScore >= 0 && damageSource != null && damageSource.getEntity() instanceof LivingEntity livingEntity) { + livingEntity.awardKillScore(this, this.deathScore, damageSource); + } + + this.remove(Entity.RemovalReason.DISCARDED); + } + + @Override + protected boolean canAddPassenger(Entity passenger) { + return false; + } + + @Override + protected boolean couldAcceptPassenger() { + return false; + } + + @Override + protected void addPassenger(Entity passenger) { + throw new IllegalStateException("Should never addPassenger without checking couldAcceptPassenger()"); + } + + @Override + public boolean canUsePortal(boolean allowPassengers) { + return false; + } + + @Override + protected PathNavigation createNavigation(Level level) { + return new CreakingTransient.CreakingPathNavigation(this, level); + } + + class CreakingPathNavigation extends GroundPathNavigation { + CreakingPathNavigation(final Creaking creaking, final Level level) { + super(creaking, level); + } + + @Override + public void tick() { + if (CreakingTransient.this.canMove()) { + super.tick(); + } + } + + @Override + protected PathFinder createPathFinder(int maxVisitedNodes) { + this.nodeEvaluator = CreakingTransient.this.new HomeNodeEvaluator(); + return new PathFinder(this.nodeEvaluator, maxVisitedNodes); + } + } + + class HomeNodeEvaluator extends WalkNodeEvaluator { + private static final int MAX_DISTANCE_TO_HOME_SQ = 1024; + + @Override + public PathType getPathType(PathfindingContext context, int x, int y, int z) { + BlockPos blockPos = CreakingTransient.this.homePos; + if (blockPos == null) { + return super.getPathType(context, x, y, z); + } else { + double d = blockPos.distSqr(new Vec3i(x, y, z)); + return d > 1024.0 && d >= blockPos.distSqr(context.mobPosition()) ? PathType.BLOCKED : super.getPathType(context, x, y, z); + } + } + } +} diff --git a/net/minecraft/world/entity/monster/creaking/package-info.java b/net/minecraft/world/entity/monster/creaking/package-info.java new file mode 100644 index 00000000..c24a3b60 --- /dev/null +++ b/net/minecraft/world/entity/monster/creaking/package-info.java @@ -0,0 +1,8 @@ +@ParametersAreNonnullByDefault +@MethodsReturnNonnullByDefault +@FieldsAreNonnullByDefault +package net.minecraft.world.entity.monster.creaking; + +import javax.annotation.ParametersAreNonnullByDefault; +import net.minecraft.FieldsAreNonnullByDefault; +import net.minecraft.MethodsReturnNonnullByDefault; diff --git a/net/minecraft/world/entity/monster/hoglin/Hoglin.java b/net/minecraft/world/entity/monster/hoglin/Hoglin.java index b75a1fe6..4a48465b 100644 --- a/net/minecraft/world/entity/monster/hoglin/Hoglin.java +++ b/net/minecraft/world/entity/monster/hoglin/Hoglin.java @@ -1,5 +1,6 @@ package net.minecraft.world.entity.monster.hoglin; +import com.google.common.annotations.VisibleForTesting; import com.google.common.collect.ImmutableList; import com.mojang.serialization.Dynamic; import net.minecraft.core.BlockPos; @@ -14,6 +15,8 @@ import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; import net.minecraft.tags.ItemTags; import net.minecraft.util.RandomSource; +import net.minecraft.util.profiling.Profiler; +import net.minecraft.util.profiling.ProfilerFiller; import net.minecraft.world.DifficultyInstance; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; @@ -21,21 +24,22 @@ import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.effect.MobEffectInstance; import net.minecraft.world.effect.MobEffects; import net.minecraft.world.entity.AgeableMob; +import net.minecraft.world.entity.ConversionParams; import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.entity.MobSpawnType; import net.minecraft.world.entity.SpawnGroupData; import net.minecraft.world.entity.ai.Brain; -import net.minecraft.world.entity.ai.attributes.AttributeSupplier; +import net.minecraft.world.entity.ai.Brain.Provider; import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.entity.ai.attributes.AttributeSupplier.Builder; import net.minecraft.world.entity.ai.memory.MemoryModuleType; import net.minecraft.world.entity.ai.sensing.Sensor; import net.minecraft.world.entity.ai.sensing.SensorType; import net.minecraft.world.entity.animal.Animal; import net.minecraft.world.entity.monster.Enemy; import net.minecraft.world.entity.monster.Monster; -import net.minecraft.world.entity.monster.Zoglin; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; @@ -48,14 +52,13 @@ import org.jetbrains.annotations.Nullable; public class Hoglin extends Animal implements Enemy, HoglinBase { private static final EntityDataAccessor DATA_IMMUNE_TO_ZOMBIFICATION = SynchedEntityData.defineId(Hoglin.class, EntityDataSerializers.BOOLEAN); - private static final float PROBABILITY_OF_SPAWNING_AS_BABY = 0.2F; private static final int MAX_HEALTH = 40; private static final float MOVEMENT_SPEED_WHEN_FIGHTING = 0.3F; private static final int ATTACK_KNOCKBACK = 1; private static final float KNOCKBACK_RESISTANCE = 0.6F; private static final int ATTACK_DAMAGE = 6; private static final float BABY_ATTACK_DAMAGE = 0.5F; - private static final int CONVERSION_TIME = 300; + public static final int CONVERSION_TIME = 300; private int attackAnimationRemainingTicks; private int timeInOverworld; private boolean cannotBeHunted; @@ -90,12 +93,17 @@ public class Hoglin extends Animal implements Enemy, HoglinBase { this.xpReward = 5; } + @VisibleForTesting + public void setTimeInOverworld(int i) { + this.timeInOverworld = i; + } + @Override public boolean canBeLeashed() { return true; } - public static AttributeSupplier.Builder createAttributes() { + public static Builder createAttributes() { return Monster.createMonsterAttributes() .add(Attributes.MAX_HEALTH, 40.0) .add(Attributes.MOVEMENT_SPEED, 0.3F) @@ -105,15 +113,15 @@ public class Hoglin extends Animal implements Enemy, HoglinBase { } @Override - public boolean doHurtTarget(Entity target) { - if (!(target instanceof LivingEntity)) { - return false; - } else { + public boolean doHurtTarget(ServerLevel serverLevel, Entity entity) { + if (entity instanceof LivingEntity livingEntity) { this.attackAnimationRemainingTicks = 10; this.level().broadcastEntityEvent(this, (byte)4); this.makeSound(SoundEvents.HOGLIN_ATTACK); - HoglinAi.onHitTarget(this, (LivingEntity)target); - return HoglinBase.hurtAndThrowTarget(this, (LivingEntity)target); + HoglinAi.onHitTarget(this, livingEntity); + return HoglinBase.hurtAndThrowTarget(serverLevel, this, livingEntity); + } else { + return false; } } @@ -125,21 +133,17 @@ public class Hoglin extends Animal implements Enemy, HoglinBase { } @Override - public boolean hurt(DamageSource source, float amount) { - boolean bl = super.hurt(source, amount); - if (this.level().isClientSide) { - return false; - } else { - if (bl && source.getEntity() instanceof LivingEntity) { - HoglinAi.wasHurtBy(this, (LivingEntity)source.getEntity()); - } - - return bl; + public boolean hurtServer(ServerLevel serverLevel, DamageSource damageSource, float f) { + boolean bl = super.hurtServer(serverLevel, damageSource, f); + if (bl && damageSource.getEntity() instanceof LivingEntity livingEntity) { + HoglinAi.wasHurtBy(serverLevel, this, livingEntity); } + + return bl; } @Override - protected Brain.Provider brainProvider() { + protected Provider brainProvider() { return Brain.provider(MEMORY_TYPES, SENSOR_TYPES); } @@ -154,16 +158,17 @@ public class Hoglin extends Animal implements Enemy, HoglinBase { } @Override - protected void customServerAiStep() { - this.level().getProfiler().push("hoglinBrain"); - this.getBrain().tick((ServerLevel)this.level(), this); - this.level().getProfiler().pop(); + protected void customServerAiStep(ServerLevel serverLevel) { + ProfilerFiller profilerFiller = Profiler.get(); + profilerFiller.push("hoglinBrain"); + this.getBrain().tick(serverLevel, this); + profilerFiller.pop(); HoglinAi.updateActivity(this); if (this.isConverting()) { this.timeInOverworld++; if (this.timeInOverworld > 300) { this.makeSound(SoundEvents.HOGLIN_CONVERTED_TO_ZOMBIFIED); - this.finishConversion((ServerLevel)this.level()); + this.finishConversion(); } } else { this.timeInOverworld = 0; @@ -190,18 +195,22 @@ public class Hoglin extends Animal implements Enemy, HoglinBase { } } - public static boolean checkHoglinSpawnRules(EntityType hoglin, LevelAccessor level, MobSpawnType spawnType, BlockPos pos, RandomSource random) { - return !level.getBlockState(pos.below()).is(Blocks.NETHER_WART_BLOCK); + public static boolean checkHoglinSpawnRules( + EntityType entityType, LevelAccessor levelAccessor, EntitySpawnReason entitySpawnReason, BlockPos blockPos, RandomSource randomSource + ) { + return !levelAccessor.getBlockState(blockPos.below()).is(Blocks.NETHER_WART_BLOCK); } @Nullable @Override - public SpawnGroupData finalizeSpawn(ServerLevelAccessor level, DifficultyInstance difficulty, MobSpawnType spawnType, @Nullable SpawnGroupData spawnGroupData) { - if (level.getRandom().nextFloat() < 0.2F) { + public SpawnGroupData finalizeSpawn( + ServerLevelAccessor serverLevelAccessor, DifficultyInstance difficultyInstance, EntitySpawnReason entitySpawnReason, @Nullable SpawnGroupData spawnGroupData + ) { + if (serverLevelAccessor.getRandom().nextFloat() < 0.2F) { this.setBaby(true); } - return super.finalizeSpawn(level, difficulty, spawnType, spawnGroupData); + return super.finalizeSpawn(serverLevelAccessor, difficultyInstance, entitySpawnReason, spawnGroupData); } @Override @@ -249,15 +258,12 @@ public class Hoglin extends Animal implements Enemy, HoglinBase { } @Override - protected int getBaseExperienceReward() { + protected int getBaseExperienceReward(ServerLevel serverLevel) { return this.xpReward; } - private void finishConversion(ServerLevel serverLevel) { - Zoglin zoglin = this.convertTo(EntityType.ZOGLIN, true); - if (zoglin != null) { - zoglin.addEffect(new MobEffectInstance(MobEffects.CONFUSION, 200, 0)); - } + private void finishConversion() { + this.convertTo(EntityType.ZOGLIN, ConversionParams.single(this, true, false), zoglin -> zoglin.addEffect(new MobEffectInstance(MobEffects.CONFUSION, 200, 0))); } @Override @@ -270,7 +276,7 @@ public class Hoglin extends Animal implements Enemy, HoglinBase { } @Override - protected void defineSynchedData(SynchedEntityData.Builder builder) { + protected void defineSynchedData(net.minecraft.network.syncher.SynchedEntityData.Builder builder) { super.defineSynchedData(builder); builder.define(DATA_IMMUNE_TO_ZOMBIFICATION, false); } @@ -319,7 +325,7 @@ public class Hoglin extends Animal implements Enemy, HoglinBase { @Nullable @Override public AgeableMob getBreedOffspring(ServerLevel level, AgeableMob otherParent) { - Hoglin hoglin = EntityType.HOGLIN.create(level); + Hoglin hoglin = EntityType.HOGLIN.create(level, EntitySpawnReason.BREEDING); if (hoglin != null) { hoglin.setPersistenceRequired(); } diff --git a/net/minecraft/world/entity/monster/hoglin/HoglinAi.java b/net/minecraft/world/entity/monster/hoglin/HoglinAi.java index 407ab9c2..e2dbe24d 100644 --- a/net/minecraft/world/entity/monster/hoglin/HoglinAi.java +++ b/net/minecraft/world/entity/monster/hoglin/HoglinAi.java @@ -6,6 +6,7 @@ import com.mojang.datafixers.util.Pair; import java.util.List; import java.util.Optional; import net.minecraft.core.BlockPos; +import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; import net.minecraft.util.TimeUtil; @@ -163,7 +164,7 @@ public class HoglinAi { hoglin.getBrain().setMemoryWithExpiry(MemoryModuleType.AVOID_TARGET, target, RETREAT_DURATION.sample(hoglin.level().random)); } - private static Optional findNearestValidAttackTarget(Hoglin hoglin) { + private static Optional findNearestValidAttackTarget(ServerLevel serverLevel, Hoglin hoglin) { return !isPacified(hoglin) && !isBreeding(hoglin) ? hoglin.getBrain().getMemory(MemoryModuleType.NEAREST_VISIBLE_ATTACKABLE_PLAYER) : Optional.empty(); } @@ -186,22 +187,22 @@ public class HoglinAi { } } - protected static void wasHurtBy(Hoglin hoglin, LivingEntity livingEntity) { + protected static void wasHurtBy(ServerLevel serverLevel, Hoglin hoglin, LivingEntity livingEntity) { Brain brain = hoglin.getBrain(); brain.eraseMemory(MemoryModuleType.PACIFIED); brain.eraseMemory(MemoryModuleType.BREED_TARGET); if (hoglin.isBaby()) { retreatFromNearestTarget(hoglin, livingEntity); } else { - maybeRetaliate(hoglin, livingEntity); + maybeRetaliate(serverLevel, hoglin, livingEntity); } } - private static void maybeRetaliate(Hoglin hoglin, LivingEntity livingEntity) { + private static void maybeRetaliate(ServerLevel serverLevel, Hoglin hoglin, LivingEntity livingEntity) { if (!hoglin.getBrain().isActive(Activity.AVOID) || livingEntity.getType() != EntityType.PIGLIN) { if (livingEntity.getType() != EntityType.HOGLIN) { if (!BehaviorUtils.isOtherTargetMuchFurtherAwayThanCurrentAttackTarget(hoglin, livingEntity, 4.0)) { - if (Sensor.isEntityAttackable(hoglin, livingEntity)) { + if (Sensor.isEntityAttackable(serverLevel, hoglin, livingEntity)) { setAttackTarget(hoglin, livingEntity); broadcastAttackTarget(hoglin, livingEntity); } diff --git a/net/minecraft/world/entity/monster/hoglin/HoglinBase.java b/net/minecraft/world/entity/monster/hoglin/HoglinBase.java index 84a6bac3..b122b850 100644 --- a/net/minecraft/world/entity/monster/hoglin/HoglinBase.java +++ b/net/minecraft/world/entity/monster/hoglin/HoglinBase.java @@ -9,27 +9,25 @@ import net.minecraft.world.phys.Vec3; public interface HoglinBase { int ATTACK_ANIMATION_DURATION = 10; + float PROBABILITY_OF_SPAWNING_AS_BABY = 0.2F; int getAttackAnimationRemainingTicks(); - static boolean hurtAndThrowTarget(LivingEntity hoglin, LivingEntity target) { - float f = (float)hoglin.getAttributeValue(Attributes.ATTACK_DAMAGE); + static boolean hurtAndThrowTarget(ServerLevel serverLevel, LivingEntity livingEntity, LivingEntity livingEntity2) { + float f = (float)livingEntity.getAttributeValue(Attributes.ATTACK_DAMAGE); float g; - if (!hoglin.isBaby() && (int)f > 0) { - g = f / 2.0F + hoglin.level().random.nextInt((int)f); + if (!livingEntity.isBaby() && (int)f > 0) { + g = f / 2.0F + serverLevel.random.nextInt((int)f); } else { g = f; } - DamageSource damageSource = hoglin.damageSources().mobAttack(hoglin); - boolean bl = target.hurt(damageSource, g); + DamageSource damageSource = livingEntity.damageSources().mobAttack(livingEntity); + boolean bl = livingEntity2.hurtServer(serverLevel, damageSource, g); if (bl) { - if (hoglin.level() instanceof ServerLevel serverLevel) { - EnchantmentHelper.doPostAttackEffects(serverLevel, target, damageSource); - } - - if (!hoglin.isBaby()) { - throwTarget(hoglin, target); + EnchantmentHelper.doPostAttackEffects(serverLevel, livingEntity2, damageSource); + if (!livingEntity.isBaby()) { + throwTarget(livingEntity, livingEntity2); } } diff --git a/net/minecraft/world/entity/monster/piglin/AbstractPiglin.java b/net/minecraft/world/entity/monster/piglin/AbstractPiglin.java index 2525ba64..f30ed6bb 100644 --- a/net/minecraft/world/entity/monster/piglin/AbstractPiglin.java +++ b/net/minecraft/world/entity/monster/piglin/AbstractPiglin.java @@ -1,20 +1,22 @@ package net.minecraft.world.entity.monster.piglin; +import com.google.common.annotations.VisibleForTesting; +import net.minecraft.core.component.DataComponents; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.protocol.game.DebugPackets; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.network.syncher.SynchedEntityData.Builder; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.effect.MobEffectInstance; import net.minecraft.world.effect.MobEffects; +import net.minecraft.world.entity.ConversionParams; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.ai.navigation.GroundPathNavigation; import net.minecraft.world.entity.ai.util.GoalUtils; import net.minecraft.world.entity.monster.Monster; -import net.minecraft.world.entity.monster.ZombifiedPiglin; -import net.minecraft.world.item.TieredItem; import net.minecraft.world.level.Level; import net.minecraft.world.level.pathfinder.PathType; import org.jetbrains.annotations.Nullable; @@ -23,7 +25,7 @@ public abstract class AbstractPiglin extends Monster { protected static final EntityDataAccessor DATA_IMMUNE_TO_ZOMBIFICATION = SynchedEntityData.defineId( AbstractPiglin.class, EntityDataSerializers.BOOLEAN ); - protected static final int CONVERSION_TIME = 300; + public static final int CONVERSION_TIME = 300; protected int timeInOverworld; public AbstractPiglin(EntityType entityType, Level level) { @@ -51,7 +53,7 @@ public abstract class AbstractPiglin extends Monster { } @Override - protected void defineSynchedData(SynchedEntityData.Builder builder) { + protected void defineSynchedData(Builder builder) { super.defineSynchedData(builder); builder.define(DATA_IMMUNE_TO_ZOMBIFICATION, false); } @@ -74,8 +76,8 @@ public abstract class AbstractPiglin extends Monster { } @Override - protected void customServerAiStep() { - super.customServerAiStep(); + protected void customServerAiStep(ServerLevel serverLevel) { + super.customServerAiStep(serverLevel); if (this.isConverting()) { this.timeInOverworld++; } else { @@ -84,19 +86,25 @@ public abstract class AbstractPiglin extends Monster { if (this.timeInOverworld > 300) { this.playConvertedSound(); - this.finishConversion((ServerLevel)this.level()); + this.finishConversion(serverLevel); } } + @VisibleForTesting + public void setTimeInOverworld(int i) { + this.timeInOverworld = i; + } + public boolean isConverting() { return !this.level().dimensionType().piglinSafe() && !this.isImmuneToZombification() && !this.isNoAi(); } protected void finishConversion(ServerLevel serverLevel) { - ZombifiedPiglin zombifiedPiglin = this.convertTo(EntityType.ZOMBIFIED_PIGLIN, true); - if (zombifiedPiglin != null) { - zombifiedPiglin.addEffect(new MobEffectInstance(MobEffects.CONFUSION, 200, 0)); - } + this.convertTo( + EntityType.ZOMBIFIED_PIGLIN, + ConversionParams.single(this, true, true), + zombifiedPiglin -> zombifiedPiglin.addEffect(new MobEffectInstance(MobEffects.CONFUSION, 200, 0)) + ); } public boolean isAdult() { @@ -112,7 +120,7 @@ public abstract class AbstractPiglin extends Monster { } protected boolean isHoldingMeleeWeapon() { - return this.getMainHandItem().getItem() instanceof TieredItem; + return this.getMainHandItem().has(DataComponents.TOOL); } @Override diff --git a/net/minecraft/world/entity/monster/piglin/Piglin.java b/net/minecraft/world/entity/monster/piglin/Piglin.java index 895a93d9..bf8c9bf0 100644 --- a/net/minecraft/world/entity/monster/piglin/Piglin.java +++ b/net/minecraft/world/entity/monster/piglin/Piglin.java @@ -8,12 +8,15 @@ import net.minecraft.nbt.CompoundTag; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.network.syncher.SynchedEntityData.Builder; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; import net.minecraft.util.RandomSource; import net.minecraft.util.VisibleForDebug; +import net.minecraft.util.profiling.Profiler; +import net.minecraft.util.profiling.ProfilerFiller; import net.minecraft.world.DifficultyInstance; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; @@ -21,16 +24,16 @@ import net.minecraft.world.SimpleContainer; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityDimensions; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.entity.MobSpawnType; import net.minecraft.world.entity.Pose; import net.minecraft.world.entity.SpawnGroupData; import net.minecraft.world.entity.ai.Brain; +import net.minecraft.world.entity.ai.Brain.Provider; import net.minecraft.world.entity.ai.attributes.AttributeInstance; import net.minecraft.world.entity.ai.attributes.AttributeModifier; -import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.entity.ai.memory.MemoryModuleType; import net.minecraft.world.entity.ai.sensing.Sensor; @@ -41,6 +44,7 @@ import net.minecraft.world.entity.monster.CrossbowAttackMob; import net.minecraft.world.entity.monster.Monster; import net.minecraft.world.entity.npc.InventoryCarrier; import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.CrossbowItem; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.item.ProjectileWeaponItem; @@ -156,10 +160,10 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento if (damageSource.getEntity() instanceof Creeper creeper && creeper.canDropMobsSkull()) { ItemStack itemStack = new ItemStack(Items.PIGLIN_HEAD); creeper.increaseDroppedSkulls(); - this.spawnAtLocation(itemStack); + this.spawnAtLocation(level, itemStack); } - this.inventory.removeAllItems().forEach(this::spawnAtLocation); + this.inventory.removeAllItems().forEach(itemStackx -> this.spawnAtLocation(level, itemStackx)); } protected ItemStack addToInventory(ItemStack stack) { @@ -171,7 +175,7 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento } @Override - protected void defineSynchedData(SynchedEntityData.Builder builder) { + protected void defineSynchedData(Builder builder) { super.defineSynchedData(builder); builder.define(DATA_BABY_ID, false); builder.define(DATA_IS_CHARGING_CROSSBOW, false); @@ -186,19 +190,23 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento } } - public static AttributeSupplier.Builder createAttributes() { + public static net.minecraft.world.entity.ai.attributes.AttributeSupplier.Builder createAttributes() { return Monster.createMonsterAttributes().add(Attributes.MAX_HEALTH, 16.0).add(Attributes.MOVEMENT_SPEED, 0.35F).add(Attributes.ATTACK_DAMAGE, 5.0); } - public static boolean checkPiglinSpawnRules(EntityType piglin, LevelAccessor level, MobSpawnType spawnType, BlockPos pos, RandomSource random) { - return !level.getBlockState(pos.below()).is(Blocks.NETHER_WART_BLOCK); + public static boolean checkPiglinSpawnRules( + EntityType entityType, LevelAccessor levelAccessor, EntitySpawnReason entitySpawnReason, BlockPos blockPos, RandomSource randomSource + ) { + return !levelAccessor.getBlockState(blockPos.below()).is(Blocks.NETHER_WART_BLOCK); } @Nullable @Override - public SpawnGroupData finalizeSpawn(ServerLevelAccessor level, DifficultyInstance difficulty, MobSpawnType spawnType, @Nullable SpawnGroupData spawnGroupData) { - RandomSource randomSource = level.getRandom(); - if (spawnType != MobSpawnType.STRUCTURE) { + public SpawnGroupData finalizeSpawn( + ServerLevelAccessor serverLevelAccessor, DifficultyInstance difficultyInstance, EntitySpawnReason entitySpawnReason, @Nullable SpawnGroupData spawnGroupData + ) { + RandomSource randomSource = serverLevelAccessor.getRandom(); + if (entitySpawnReason != EntitySpawnReason.STRUCTURE) { if (randomSource.nextFloat() < 0.2F) { this.setBaby(true); } else if (this.isAdult()) { @@ -206,10 +214,10 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento } } - PiglinAi.initMemories(this, level.getRandom()); - this.populateDefaultEquipmentSlots(randomSource, difficulty); - this.populateDefaultEquipmentEnchantments(level, randomSource, difficulty); - return super.finalizeSpawn(level, difficulty, spawnType, spawnGroupData); + PiglinAi.initMemories(this, serverLevelAccessor.getRandom()); + this.populateDefaultEquipmentSlots(randomSource, difficultyInstance); + this.populateDefaultEquipmentEnchantments(serverLevelAccessor, randomSource, difficultyInstance); + return super.finalizeSpawn(serverLevelAccessor, difficultyInstance, entitySpawnReason, spawnGroupData); } @Override @@ -239,7 +247,7 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento } @Override - protected Brain.Provider brainProvider() { + protected Provider brainProvider() { return Brain.provider(MEMORY_TYPES, SENSOR_TYPES); } @@ -258,11 +266,11 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento InteractionResult interactionResult = super.mobInteract(player, hand); if (interactionResult.consumesAction()) { return interactionResult; - } else if (!this.level().isClientSide) { - return PiglinAi.mobInteract(this, player, hand); + } else if (this.level() instanceof ServerLevel serverLevel) { + return PiglinAi.mobInteract(serverLevel, this, player, hand); } else { boolean bl = PiglinAi.canAdmire(this, player.getItemInHand(hand)) && this.getArmPose() != PiglinArmPose.ADMIRING_ITEM; - return bl ? InteractionResult.SUCCESS : InteractionResult.PASS; + return (InteractionResult)(bl ? InteractionResult.SUCCESS : InteractionResult.PASS); } } @@ -298,23 +306,24 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento } @Override - protected void customServerAiStep() { - this.level().getProfiler().push("piglinBrain"); - this.getBrain().tick((ServerLevel)this.level(), this); - this.level().getProfiler().pop(); + protected void customServerAiStep(ServerLevel serverLevel) { + ProfilerFiller profilerFiller = Profiler.get(); + profilerFiller.push("piglinBrain"); + this.getBrain().tick(serverLevel, this); + profilerFiller.pop(); PiglinAi.updateActivity(this); - super.customServerAiStep(); + super.customServerAiStep(serverLevel); } @Override - protected int getBaseExperienceReward() { + protected int getBaseExperienceReward(ServerLevel serverLevel) { return this.xpReward; } @Override protected void finishConversion(ServerLevel serverLevel) { - PiglinAi.cancelAdmiring(this); - this.inventory.removeAllItems().forEach(this::spawnAtLocation); + PiglinAi.cancelAdmiring(serverLevel, this); + this.inventory.removeAllItems().forEach(itemStack -> this.spawnAtLocation(serverLevel, itemStack)); super.finishConversion(serverLevel); } @@ -347,7 +356,7 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento } else if (this.isChargingCrossbow()) { return PiglinArmPose.CROSSBOW_CHARGE; } else { - return this.isAggressive() && this.isHolding(Items.CROSSBOW) ? PiglinArmPose.CROSSBOW_HOLD : PiglinArmPose.DEFAULT; + return this.isHolding(Items.CROSSBOW) && CrossbowItem.isCharged(this.getWeaponItem()) ? PiglinArmPose.CROSSBOW_HOLD : PiglinArmPose.DEFAULT; } } @@ -360,17 +369,13 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento } @Override - public boolean hurt(DamageSource source, float amount) { - boolean bl = super.hurt(source, amount); - if (this.level().isClientSide) { - return false; - } else { - if (bl && source.getEntity() instanceof LivingEntity) { - PiglinAi.wasHurtBy(this, (LivingEntity)source.getEntity()); - } - - return bl; + public boolean hurtServer(ServerLevel serverLevel, DamageSource damageSource, float f) { + boolean bl = super.hurtServer(serverLevel, damageSource, f); + if (bl && damageSource.getEntity() instanceof LivingEntity livingEntity) { + PiglinAi.wasHurtBy(serverLevel, this, livingEntity); } + + return bl; } @Override @@ -397,37 +402,39 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento } @Override - public boolean wantsToPickUp(ItemStack stack) { - return this.level().getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) && this.canPickUpLoot() && PiglinAi.wantsToPickup(this, stack); + public boolean wantsToPickUp(ServerLevel serverLevel, ItemStack itemStack) { + return serverLevel.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) && this.canPickUpLoot() && PiglinAi.wantsToPickup(this, itemStack); } protected boolean canReplaceCurrentItem(ItemStack candidate) { EquipmentSlot equipmentSlot = this.getEquipmentSlotForItem(candidate); ItemStack itemStack = this.getItemBySlot(equipmentSlot); - return this.canReplaceCurrentItem(candidate, itemStack); + return this.canReplaceCurrentItem(candidate, itemStack, equipmentSlot); } @Override - protected boolean canReplaceCurrentItem(ItemStack candidate, ItemStack existing) { - if (EnchantmentHelper.has(existing, EnchantmentEffectComponents.PREVENT_ARMOR_CHANGE)) { + protected boolean canReplaceCurrentItem(ItemStack itemStack, ItemStack itemStack2, EquipmentSlot equipmentSlot) { + if (EnchantmentHelper.has(itemStack2, EnchantmentEffectComponents.PREVENT_ARMOR_CHANGE)) { return false; } else { - boolean bl = PiglinAi.isLovedItem(candidate) || candidate.is(Items.CROSSBOW); - boolean bl2 = PiglinAi.isLovedItem(existing) || existing.is(Items.CROSSBOW); + boolean bl = PiglinAi.isLovedItem(itemStack) || itemStack.is(Items.CROSSBOW); + boolean bl2 = PiglinAi.isLovedItem(itemStack2) || itemStack2.is(Items.CROSSBOW); if (bl && !bl2) { return true; } else if (!bl && bl2) { return false; } else { - return this.isAdult() && !candidate.is(Items.CROSSBOW) && existing.is(Items.CROSSBOW) ? false : super.canReplaceCurrentItem(candidate, existing); + return this.isAdult() && !itemStack.is(Items.CROSSBOW) && itemStack2.is(Items.CROSSBOW) + ? false + : super.canReplaceCurrentItem(itemStack, itemStack2, equipmentSlot); } } } @Override - protected void pickUpItem(ItemEntity itemEntity) { + protected void pickUpItem(ServerLevel serverLevel, ItemEntity itemEntity) { this.onItemPickup(itemEntity); - PiglinAi.pickUpItem(this, itemEntity); + PiglinAi.pickUpItem(serverLevel, this, itemEntity); } @Override diff --git a/net/minecraft/world/entity/monster/piglin/PiglinAi.java b/net/minecraft/world/entity/monster/piglin/PiglinAi.java index 6009aa38..3726b915 100644 --- a/net/minecraft/world/entity/monster/piglin/PiglinAi.java +++ b/net/minecraft/world/entity/monster/piglin/PiglinAi.java @@ -42,7 +42,6 @@ import net.minecraft.world.entity.ai.behavior.OneShot; import net.minecraft.world.entity.ai.behavior.RandomStroll; import net.minecraft.world.entity.ai.behavior.RunOne; import net.minecraft.world.entity.ai.behavior.SetEntityLookTarget; -import net.minecraft.world.entity.ai.behavior.SetEntityLookTargetSometimes; import net.minecraft.world.entity.ai.behavior.SetLookAndInteract; import net.minecraft.world.entity.ai.behavior.SetWalkTargetAwayFrom; import net.minecraft.world.entity.ai.behavior.SetWalkTargetFromAttackTargetIfTargetOutOfReach; @@ -52,6 +51,7 @@ import net.minecraft.world.entity.ai.behavior.StartCelebratingIfTargetDead; import net.minecraft.world.entity.ai.behavior.StopAttackingIfTargetInvalid; import net.minecraft.world.entity.ai.behavior.StopBeingAngryIfTargetDead; import net.minecraft.world.entity.ai.behavior.TriggerGate; +import net.minecraft.world.entity.ai.behavior.SetEntityLookTargetSometimes.Ticker; import net.minecraft.world.entity.ai.behavior.declarative.BehaviorBuilder; import net.minecraft.world.entity.ai.behavior.declarative.Trigger; import net.minecraft.world.entity.ai.memory.MemoryModuleType; @@ -61,8 +61,6 @@ import net.minecraft.world.entity.item.ItemEntity; import net.minecraft.world.entity.monster.hoglin.Hoglin; import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.schedule.Activity; -import net.minecraft.world.item.ArmorItem; -import net.minecraft.world.item.ArmorMaterials; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; @@ -155,7 +153,7 @@ public class PiglinAi { 10, ImmutableList.of( SetEntityLookTarget.create(PiglinAi::isPlayerHoldingLovedItem, 14.0F), - StartAttacking.create(AbstractPiglin::isAdult, PiglinAi::findNearestValidAttackTarget), + StartAttacking.create((serverLevel, piglin) -> piglin.isAdult(), PiglinAi::findNearestValidAttackTarget), BehaviorBuilder.triggerIf(Piglin::canHunt, StartHuntingHoglin.create()), avoidRepellent(), babySometimesRideBabyHoglin(), @@ -171,7 +169,7 @@ public class PiglinAi { Activity.FIGHT, 10, ImmutableList.of( - StopAttackingIfTargetInvalid.create((Predicate)(livingEntity -> !isNearestValidAttackTarget(piglin, livingEntity))), + StopAttackingIfTargetInvalid.create((serverLevel, livingEntity) -> !isNearestValidAttackTarget(serverLevel, piglin, livingEntity)), BehaviorBuilder.triggerIf(PiglinAi::hasCrossbow, BackUpIfTooClose.create(5, 0.75F)), SetWalkTargetFromAttackTargetIfTargetOutOfReach.create(1.0F), MeleeAttack.create(20), @@ -190,7 +188,7 @@ public class PiglinAi { ImmutableList.of( avoidRepellent(), SetEntityLookTarget.create(PiglinAi::isPlayerHoldingLovedItem, 14.0F), - StartAttacking.create(AbstractPiglin::isAdult, PiglinAi::findNearestValidAttackTarget), + StartAttacking.create((serverLevel, piglin) -> piglin.isAdult(), PiglinAi::findNearestValidAttackTarget), BehaviorBuilder.triggerIf(piglin -> !piglin.isDancing(), GoToTargetLocation.create(MemoryModuleType.CELEBRATE_LOCATION, 2, 1.0F)), BehaviorBuilder.triggerIf(Piglin::isDancing, GoToTargetLocation.create(MemoryModuleType.CELEBRATE_LOCATION, 4, 0.6F)), new RunOne( @@ -324,7 +322,7 @@ public class PiglinAi { } } - protected static void pickUpItem(Piglin piglin, ItemEntity itemEntity) { + protected static void pickUpItem(ServerLevel serverLevel, Piglin piglin, ItemEntity itemEntity) { stopWalking(piglin); ItemStack itemStack; if (itemEntity.getItem().is(Items.GOLD_NUGGET)) { @@ -338,24 +336,24 @@ public class PiglinAi { if (isLovedItem(itemStack)) { piglin.getBrain().eraseMemory(MemoryModuleType.TIME_TRYING_TO_REACH_ADMIRE_ITEM); - holdInOffhand(piglin, itemStack); + holdInOffhand(serverLevel, piglin, itemStack); admireGoldItem(piglin); } else if (isFood(itemStack) && !hasEatenRecently(piglin)) { eat(piglin); } else { - boolean bl = !piglin.equipItemIfPossible(itemStack).equals(ItemStack.EMPTY); + boolean bl = !piglin.equipItemIfPossible(serverLevel, itemStack).equals(ItemStack.EMPTY); if (!bl) { putInInventory(piglin, itemStack); } } } - private static void holdInOffhand(Piglin piglin, ItemStack stack) { + private static void holdInOffhand(ServerLevel serverLevel, Piglin piglin, ItemStack itemStack) { if (isHoldingItemInOffHand(piglin)) { - piglin.spawnAtLocation(piglin.getItemInHand(InteractionHand.OFF_HAND)); + piglin.spawnAtLocation(serverLevel, piglin.getItemInHand(InteractionHand.OFF_HAND)); } - piglin.holdInOffHand(stack); + piglin.holdInOffHand(itemStack); } private static ItemStack removeOneItemFromItemEntity(ItemEntity itemEntity) { @@ -370,22 +368,22 @@ public class PiglinAi { return itemStack2; } - protected static void stopHoldingOffHandItem(Piglin piglin, boolean shouldBarter) { + protected static void stopHoldingOffHandItem(ServerLevel serverLevel, Piglin piglin, boolean bl) { ItemStack itemStack = piglin.getItemInHand(InteractionHand.OFF_HAND); piglin.setItemInHand(InteractionHand.OFF_HAND, ItemStack.EMPTY); if (piglin.isAdult()) { - boolean bl = isBarterCurrency(itemStack); - if (shouldBarter && bl) { + boolean bl2 = isBarterCurrency(itemStack); + if (bl && bl2) { throwItems(piglin, getBarterResponseItems(piglin)); - } else if (!bl) { - boolean bl2 = !piglin.equipItemIfPossible(itemStack).isEmpty(); - if (!bl2) { + } else if (!bl2) { + boolean bl3 = !piglin.equipItemIfPossible(serverLevel, itemStack).isEmpty(); + if (!bl3) { putInInventory(piglin, itemStack); } } } else { - boolean bl = !piglin.equipItemIfPossible(itemStack).isEmpty(); - if (!bl) { + boolean bl2 = !piglin.equipItemIfPossible(serverLevel, itemStack).isEmpty(); + if (!bl2) { ItemStack itemStack2 = piglin.getMainHandItem(); if (isLovedItem(itemStack2)) { putInInventory(piglin, itemStack2); @@ -398,9 +396,9 @@ public class PiglinAi { } } - protected static void cancelAdmiring(Piglin piglin) { + protected static void cancelAdmiring(ServerLevel serverLevel, Piglin piglin) { if (isAdmiringItem(piglin) && !piglin.getOffhandItem().isEmpty()) { - piglin.spawnAtLocation(piglin.getOffhandItem()); + piglin.spawnAtLocation(serverLevel, piglin.getOffhandItem()); piglin.setItemInHand(InteractionHand.OFF_HAND, ItemStack.EMPTY); } } @@ -480,8 +478,8 @@ public class PiglinAi { : !mob.isBaby() || !mob.isAlive() || wasHurtRecently(piglin) || wasHurtRecently(mob) || mob instanceof Piglin && mob.getVehicle() == null; } - private static boolean isNearestValidAttackTarget(Piglin piglin, LivingEntity target) { - return findNearestValidAttackTarget(piglin).filter(livingEntity2 -> livingEntity2 == target).isPresent(); + private static boolean isNearestValidAttackTarget(ServerLevel serverLevel, Piglin piglin, LivingEntity livingEntity) { + return findNearestValidAttackTarget(serverLevel, piglin).filter(livingEntity2 -> livingEntity2 == livingEntity).isPresent(); } private static boolean isNearZombified(Piglin piglin) { @@ -494,13 +492,13 @@ public class PiglinAi { } } - private static Optional findNearestValidAttackTarget(Piglin piglin) { + private static Optional findNearestValidAttackTarget(ServerLevel serverLevel, Piglin piglin) { Brain brain = piglin.getBrain(); if (isNearZombified(piglin)) { return Optional.empty(); } else { Optional optional = BehaviorUtils.getLivingEntityFromUUIDMemory(piglin, MemoryModuleType.ANGRY_AT); - if (optional.isPresent() && Sensor.isEntityAttackableIgnoringLineOfSight(piglin, (LivingEntity)optional.get())) { + if (optional.isPresent() && Sensor.isEntityAttackableIgnoringLineOfSight(serverLevel, piglin, (LivingEntity)optional.get())) { return optional; } else { if (brain.hasMemoryValue(MemoryModuleType.UNIVERSAL_ANGER)) { @@ -515,31 +513,31 @@ public class PiglinAi { return optional2; } else { Optional optional3 = brain.getMemory(MemoryModuleType.NEAREST_TARGETABLE_PLAYER_NOT_WEARING_GOLD); - return optional3.isPresent() && Sensor.isEntityAttackable(piglin, (LivingEntity)optional3.get()) ? optional3 : Optional.empty(); + return optional3.isPresent() && Sensor.isEntityAttackable(serverLevel, piglin, (LivingEntity)optional3.get()) ? optional3 : Optional.empty(); } } } } - public static void angerNearbyPiglins(Player player, boolean angerOnlyIfCanSee) { + public static void angerNearbyPiglins(ServerLevel serverLevel, Player player, boolean bl) { List list = player.level().getEntitiesOfClass(Piglin.class, player.getBoundingBox().inflate(16.0)); - list.stream().filter(PiglinAi::isIdle).filter(piglin -> !angerOnlyIfCanSee || BehaviorUtils.canSee(piglin, player)).forEach(piglin -> { - if (piglin.level().getGameRules().getBoolean(GameRules.RULE_UNIVERSAL_ANGER)) { - setAngerTargetToNearestTargetablePlayerIfFound(piglin, player); + list.stream().filter(PiglinAi::isIdle).filter(piglin -> !bl || BehaviorUtils.canSee(piglin, player)).forEach(piglin -> { + if (serverLevel.getGameRules().getBoolean(GameRules.RULE_UNIVERSAL_ANGER)) { + setAngerTargetToNearestTargetablePlayerIfFound(serverLevel, piglin, player); } else { - setAngerTarget(piglin, player); + setAngerTarget(serverLevel, piglin, player); } }); } - public static InteractionResult mobInteract(Piglin piglin, Player player, InteractionHand hand) { - ItemStack itemStack = player.getItemInHand(hand); + public static InteractionResult mobInteract(ServerLevel serverLevel, Piglin piglin, Player player, InteractionHand interactionHand) { + ItemStack itemStack = player.getItemInHand(interactionHand); if (canAdmire(piglin, itemStack)) { ItemStack itemStack2 = itemStack.consumeAndReturn(1, player); - holdInOffhand(piglin, itemStack2); + holdInOffhand(serverLevel, piglin, itemStack2); admireGoldItem(piglin); stopWalking(piglin); - return InteractionResult.CONSUME; + return InteractionResult.SUCCESS; } else { return InteractionResult.PASS; } @@ -549,49 +547,49 @@ public class PiglinAi { return !isAdmiringDisabled(piglin) && !isAdmiringItem(piglin) && piglin.isAdult() && isBarterCurrency(stack); } - protected static void wasHurtBy(Piglin piglin, LivingEntity target) { - if (!(target instanceof Piglin)) { + protected static void wasHurtBy(ServerLevel serverLevel, Piglin piglin, LivingEntity livingEntity) { + if (!(livingEntity instanceof Piglin)) { if (isHoldingItemInOffHand(piglin)) { - stopHoldingOffHandItem(piglin, false); + stopHoldingOffHandItem(serverLevel, piglin, false); } Brain brain = piglin.getBrain(); brain.eraseMemory(MemoryModuleType.CELEBRATE_LOCATION); brain.eraseMemory(MemoryModuleType.DANCING); brain.eraseMemory(MemoryModuleType.ADMIRING_ITEM); - if (target instanceof Player) { + if (livingEntity instanceof Player) { brain.setMemoryWithExpiry(MemoryModuleType.ADMIRING_DISABLED, true, 400L); } getAvoidTarget(piglin).ifPresent(livingEntity2 -> { - if (livingEntity2.getType() != target.getType()) { + if (livingEntity2.getType() != livingEntity.getType()) { brain.eraseMemory(MemoryModuleType.AVOID_TARGET); } }); if (piglin.isBaby()) { - brain.setMemoryWithExpiry(MemoryModuleType.AVOID_TARGET, target, 100L); - if (Sensor.isEntityAttackableIgnoringLineOfSight(piglin, target)) { - broadcastAngerTarget(piglin, target); + brain.setMemoryWithExpiry(MemoryModuleType.AVOID_TARGET, livingEntity, 100L); + if (Sensor.isEntityAttackableIgnoringLineOfSight(serverLevel, piglin, livingEntity)) { + broadcastAngerTarget(serverLevel, piglin, livingEntity); } - } else if (target.getType() == EntityType.HOGLIN && hoglinsOutnumberPiglins(piglin)) { - setAvoidTargetAndDontHuntForAWhile(piglin, target); - broadcastRetreat(piglin, target); + } else if (livingEntity.getType() == EntityType.HOGLIN && hoglinsOutnumberPiglins(piglin)) { + setAvoidTargetAndDontHuntForAWhile(piglin, livingEntity); + broadcastRetreat(piglin, livingEntity); } else { - maybeRetaliate(piglin, target); + maybeRetaliate(serverLevel, piglin, livingEntity); } } } - protected static void maybeRetaliate(AbstractPiglin piglin, LivingEntity target) { - if (!piglin.getBrain().isActive(Activity.AVOID)) { - if (Sensor.isEntityAttackableIgnoringLineOfSight(piglin, target)) { - if (!BehaviorUtils.isOtherTargetMuchFurtherAwayThanCurrentAttackTarget(piglin, target, 4.0)) { - if (target.getType() == EntityType.PLAYER && piglin.level().getGameRules().getBoolean(GameRules.RULE_UNIVERSAL_ANGER)) { - setAngerTargetToNearestTargetablePlayerIfFound(piglin, target); - broadcastUniversalAnger(piglin); + protected static void maybeRetaliate(ServerLevel serverLevel, AbstractPiglin abstractPiglin, LivingEntity livingEntity) { + if (!abstractPiglin.getBrain().isActive(Activity.AVOID)) { + if (Sensor.isEntityAttackableIgnoringLineOfSight(serverLevel, abstractPiglin, livingEntity)) { + if (!BehaviorUtils.isOtherTargetMuchFurtherAwayThanCurrentAttackTarget(abstractPiglin, livingEntity, 4.0)) { + if (livingEntity.getType() == EntityType.PLAYER && serverLevel.getGameRules().getBoolean(GameRules.RULE_UNIVERSAL_ANGER)) { + setAngerTargetToNearestTargetablePlayerIfFound(serverLevel, abstractPiglin, livingEntity); + broadcastUniversalAnger(serverLevel, abstractPiglin); } else { - setAngerTarget(piglin, target); - broadcastAngerTarget(piglin, target); + setAngerTarget(serverLevel, abstractPiglin, livingEntity); + broadcastAngerTarget(serverLevel, abstractPiglin, livingEntity); } } } @@ -635,10 +633,9 @@ public class PiglinAi { return (List)piglin.getBrain().getMemory(MemoryModuleType.NEARBY_ADULT_PIGLINS).orElse(ImmutableList.of()); } - public static boolean isWearingGold(LivingEntity livingEntity) { + public static boolean isWearingSafeArmor(LivingEntity livingEntity) { for (ItemStack itemStack : livingEntity.getArmorAndBodyArmorSlots()) { - Item item = itemStack.getItem(); - if (item instanceof ArmorItem && ((ArmorItem)item).getMaterial().is(ArmorMaterials.GOLD)) { + if (itemStack.is(ItemTags.PIGLIN_SAFE_ARMOR)) { return true; } } @@ -652,7 +649,7 @@ public class PiglinAi { } private static BehaviorControl babySometimesRideBabyHoglin() { - SetEntityLookTargetSometimes.Ticker ticker = new SetEntityLookTargetSometimes.Ticker(RIDE_START_INTERVAL); + Ticker ticker = new Ticker(RIDE_START_INTERVAL); return CopyMemoryWithExpiry.create( livingEntity -> livingEntity.isBaby() && ticker.tickDownAndCheck(livingEntity.level().random), MemoryModuleType.NEAREST_VISIBLE_BABY_HOGLIN, @@ -661,47 +658,47 @@ public class PiglinAi { ); } - protected static void broadcastAngerTarget(AbstractPiglin piglin, LivingEntity target) { - getAdultPiglins(piglin).forEach(abstractPiglin -> { - if (target.getType() != EntityType.HOGLIN || abstractPiglin.canHunt() && ((Hoglin)target).canBeHunted()) { - setAngerTargetIfCloserThanCurrent(abstractPiglin, target); + protected static void broadcastAngerTarget(ServerLevel serverLevel, AbstractPiglin abstractPiglin, LivingEntity livingEntity) { + getAdultPiglins(abstractPiglin).forEach(abstractPiglinx -> { + if (livingEntity.getType() != EntityType.HOGLIN || abstractPiglinx.canHunt() && ((Hoglin)livingEntity).canBeHunted()) { + setAngerTargetIfCloserThanCurrent(serverLevel, abstractPiglinx, livingEntity); } }); } - protected static void broadcastUniversalAnger(AbstractPiglin piglin) { - getAdultPiglins(piglin) - .forEach(abstractPiglin -> getNearestVisibleTargetablePlayer(abstractPiglin).ifPresent(player -> setAngerTarget(abstractPiglin, player))); + protected static void broadcastUniversalAnger(ServerLevel serverLevel, AbstractPiglin abstractPiglin) { + getAdultPiglins(abstractPiglin) + .forEach(abstractPiglinx -> getNearestVisibleTargetablePlayer(abstractPiglinx).ifPresent(player -> setAngerTarget(serverLevel, abstractPiglinx, player))); } - protected static void setAngerTarget(AbstractPiglin piglin, LivingEntity target) { - if (Sensor.isEntityAttackableIgnoringLineOfSight(piglin, target)) { - piglin.getBrain().eraseMemory(MemoryModuleType.CANT_REACH_WALK_TARGET_SINCE); - piglin.getBrain().setMemoryWithExpiry(MemoryModuleType.ANGRY_AT, target.getUUID(), 600L); - if (target.getType() == EntityType.HOGLIN && piglin.canHunt()) { - dontKillAnyMoreHoglinsForAWhile(piglin); + protected static void setAngerTarget(ServerLevel serverLevel, AbstractPiglin abstractPiglin, LivingEntity livingEntity) { + if (Sensor.isEntityAttackableIgnoringLineOfSight(serverLevel, abstractPiglin, livingEntity)) { + abstractPiglin.getBrain().eraseMemory(MemoryModuleType.CANT_REACH_WALK_TARGET_SINCE); + abstractPiglin.getBrain().setMemoryWithExpiry(MemoryModuleType.ANGRY_AT, livingEntity.getUUID(), 600L); + if (livingEntity.getType() == EntityType.HOGLIN && abstractPiglin.canHunt()) { + dontKillAnyMoreHoglinsForAWhile(abstractPiglin); } - if (target.getType() == EntityType.PLAYER && piglin.level().getGameRules().getBoolean(GameRules.RULE_UNIVERSAL_ANGER)) { - piglin.getBrain().setMemoryWithExpiry(MemoryModuleType.UNIVERSAL_ANGER, true, 600L); + if (livingEntity.getType() == EntityType.PLAYER && serverLevel.getGameRules().getBoolean(GameRules.RULE_UNIVERSAL_ANGER)) { + abstractPiglin.getBrain().setMemoryWithExpiry(MemoryModuleType.UNIVERSAL_ANGER, true, 600L); } } } - private static void setAngerTargetToNearestTargetablePlayerIfFound(AbstractPiglin piglin, LivingEntity currentTarget) { - Optional optional = getNearestVisibleTargetablePlayer(piglin); + private static void setAngerTargetToNearestTargetablePlayerIfFound(ServerLevel serverLevel, AbstractPiglin abstractPiglin, LivingEntity livingEntity) { + Optional optional = getNearestVisibleTargetablePlayer(abstractPiglin); if (optional.isPresent()) { - setAngerTarget(piglin, (LivingEntity)optional.get()); + setAngerTarget(serverLevel, abstractPiglin, (LivingEntity)optional.get()); } else { - setAngerTarget(piglin, currentTarget); + setAngerTarget(serverLevel, abstractPiglin, livingEntity); } } - private static void setAngerTargetIfCloserThanCurrent(AbstractPiglin piglin, LivingEntity currentTarget) { - Optional optional = getAngerTarget(piglin); - LivingEntity livingEntity = BehaviorUtils.getNearestTarget(piglin, optional, currentTarget); - if (!optional.isPresent() || optional.get() != livingEntity) { - setAngerTarget(piglin, livingEntity); + private static void setAngerTargetIfCloserThanCurrent(ServerLevel serverLevel, AbstractPiglin abstractPiglin, LivingEntity livingEntity) { + Optional optional = getAngerTarget(abstractPiglin); + LivingEntity livingEntity2 = BehaviorUtils.getNearestTarget(abstractPiglin, optional, livingEntity); + if (!optional.isPresent() || optional.get() != livingEntity2) { + setAngerTarget(serverLevel, abstractPiglin, livingEntity2); } } diff --git a/net/minecraft/world/entity/monster/piglin/PiglinBrute.java b/net/minecraft/world/entity/monster/piglin/PiglinBrute.java index 0d45d386..b5aeb993 100644 --- a/net/minecraft/world/entity/monster/piglin/PiglinBrute.java +++ b/net/minecraft/world/entity/monster/piglin/PiglinBrute.java @@ -7,16 +7,19 @@ import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; import net.minecraft.util.RandomSource; +import net.minecraft.util.profiling.Profiler; +import net.minecraft.util.profiling.ProfilerFiller; import net.minecraft.world.DifficultyInstance; import net.minecraft.world.damagesource.DamageSource; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.entity.MobSpawnType; import net.minecraft.world.entity.SpawnGroupData; import net.minecraft.world.entity.ai.Brain; -import net.minecraft.world.entity.ai.attributes.AttributeSupplier; +import net.minecraft.world.entity.ai.Brain.Provider; import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.entity.ai.attributes.AttributeSupplier.Builder; import net.minecraft.world.entity.ai.memory.MemoryModuleType; import net.minecraft.world.entity.ai.sensing.Sensor; import net.minecraft.world.entity.ai.sensing.SensorType; @@ -32,6 +35,7 @@ public class PiglinBrute extends AbstractPiglin { private static final int MAX_HEALTH = 50; private static final float MOVEMENT_SPEED_WHEN_FIGHTING = 0.35F; private static final int ATTACK_DAMAGE = 7; + private static final double TARGETING_RANGE = 12.0; protected static final ImmutableList>> SENSOR_TYPES = ImmutableList.of( SensorType.NEAREST_LIVING_ENTITIES, SensorType.NEAREST_PLAYERS, SensorType.NEAREST_ITEMS, SensorType.HURT_BY, SensorType.PIGLIN_BRUTE_SPECIFIC_SENSOR ); @@ -62,16 +66,22 @@ public class PiglinBrute extends AbstractPiglin { this.xpReward = 20; } - public static AttributeSupplier.Builder createAttributes() { - return Monster.createMonsterAttributes().add(Attributes.MAX_HEALTH, 50.0).add(Attributes.MOVEMENT_SPEED, 0.35F).add(Attributes.ATTACK_DAMAGE, 7.0); + public static Builder createAttributes() { + return Monster.createMonsterAttributes() + .add(Attributes.MAX_HEALTH, 50.0) + .add(Attributes.MOVEMENT_SPEED, 0.35F) + .add(Attributes.ATTACK_DAMAGE, 7.0) + .add(Attributes.FOLLOW_RANGE, 12.0); } @Nullable @Override - public SpawnGroupData finalizeSpawn(ServerLevelAccessor level, DifficultyInstance difficulty, MobSpawnType spawnType, @Nullable SpawnGroupData spawnGroupData) { + public SpawnGroupData finalizeSpawn( + ServerLevelAccessor serverLevelAccessor, DifficultyInstance difficultyInstance, EntitySpawnReason entitySpawnReason, @Nullable SpawnGroupData spawnGroupData + ) { PiglinBruteAi.initMemories(this); - this.populateDefaultEquipmentSlots(level.getRandom(), difficulty); - return super.finalizeSpawn(level, difficulty, spawnType, spawnGroupData); + this.populateDefaultEquipmentSlots(serverLevelAccessor.getRandom(), difficultyInstance); + return super.finalizeSpawn(serverLevelAccessor, difficultyInstance, entitySpawnReason, spawnGroupData); } @Override @@ -80,7 +90,7 @@ public class PiglinBrute extends AbstractPiglin { } @Override - protected Brain.Provider brainProvider() { + protected Provider brainProvider() { return Brain.provider(MEMORY_TYPES, SENSOR_TYPES); } @@ -100,18 +110,19 @@ public class PiglinBrute extends AbstractPiglin { } @Override - public boolean wantsToPickUp(ItemStack stack) { - return stack.is(Items.GOLDEN_AXE) ? super.wantsToPickUp(stack) : false; + public boolean wantsToPickUp(ServerLevel serverLevel, ItemStack itemStack) { + return itemStack.is(Items.GOLDEN_AXE) ? super.wantsToPickUp(serverLevel, itemStack) : false; } @Override - protected void customServerAiStep() { - this.level().getProfiler().push("piglinBruteBrain"); - this.getBrain().tick((ServerLevel)this.level(), this); - this.level().getProfiler().pop(); + protected void customServerAiStep(ServerLevel serverLevel) { + ProfilerFiller profilerFiller = Profiler.get(); + profilerFiller.push("piglinBruteBrain"); + this.getBrain().tick(serverLevel, this); + profilerFiller.pop(); PiglinBruteAi.updateActivity(this); PiglinBruteAi.maybePlayActivitySound(this); - super.customServerAiStep(); + super.customServerAiStep(serverLevel); } @Override @@ -120,17 +131,13 @@ public class PiglinBrute extends AbstractPiglin { } @Override - public boolean hurt(DamageSource source, float amount) { - boolean bl = super.hurt(source, amount); - if (this.level().isClientSide) { - return false; - } else { - if (bl && source.getEntity() instanceof LivingEntity) { - PiglinBruteAi.wasHurtBy(this, (LivingEntity)source.getEntity()); - } - - return bl; + public boolean hurtServer(ServerLevel serverLevel, DamageSource damageSource, float f) { + boolean bl = super.hurtServer(serverLevel, damageSource, f); + if (bl && damageSource.getEntity() instanceof LivingEntity livingEntity) { + PiglinBruteAi.wasHurtBy(serverLevel, this, livingEntity); } + + return bl; } @Override diff --git a/net/minecraft/world/entity/monster/piglin/PiglinBruteAi.java b/net/minecraft/world/entity/monster/piglin/PiglinBruteAi.java index 2c166e76..ecb2741a 100644 --- a/net/minecraft/world/entity/monster/piglin/PiglinBruteAi.java +++ b/net/minecraft/world/entity/monster/piglin/PiglinBruteAi.java @@ -4,11 +4,10 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSet; import com.mojang.datafixers.util.Pair; import java.util.Optional; -import java.util.function.Predicate; import net.minecraft.core.GlobalPos; +import net.minecraft.server.level.ServerLevel; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.entity.Mob; import net.minecraft.world.entity.ai.Brain; import net.minecraft.world.entity.ai.behavior.BehaviorUtils; import net.minecraft.world.entity.ai.behavior.DoNothing; @@ -37,7 +36,6 @@ public class PiglinBruteAi { private static final double ACTIVITY_SOUND_LIKELIHOOD_PER_TICK = 0.0125; private static final int MAX_LOOK_DIST = 8; private static final int INTERACTION_RANGE = 8; - private static final double TARGETING_RANGE = 12.0; private static final float SPEED_MULTIPLIER_WHEN_IDLING = 0.6F; private static final int HOME_CLOSE_ENOUGH_DISTANCE = 2; private static final int HOME_TOO_FAR_DISTANCE = 100; @@ -82,7 +80,7 @@ public class PiglinBruteAi { Activity.FIGHT, 10, ImmutableList.of( - StopAttackingIfTargetInvalid.create((Predicate)(livingEntity -> !isNearestValidAttackTarget(piglinBrute, livingEntity))), + StopAttackingIfTargetInvalid.create((serverLevel, livingEntity) -> !isNearestValidAttackTarget(serverLevel, piglinBrute, livingEntity)), SetWalkTargetFromAttackTargetIfTargetOutOfReach.create(1.0F), MeleeAttack.create(20) ), @@ -127,27 +125,23 @@ public class PiglinBruteAi { piglinBrute.setAggressive(brain.hasMemoryValue(MemoryModuleType.ATTACK_TARGET)); } - private static boolean isNearestValidAttackTarget(AbstractPiglin piglinBrute, LivingEntity target) { - return findNearestValidAttackTarget(piglinBrute).filter(livingEntity2 -> livingEntity2 == target).isPresent(); + private static boolean isNearestValidAttackTarget(ServerLevel serverLevel, AbstractPiglin abstractPiglin, LivingEntity livingEntity) { + return findNearestValidAttackTarget(serverLevel, abstractPiglin).filter(livingEntity2 -> livingEntity2 == livingEntity).isPresent(); } - private static Optional findNearestValidAttackTarget(AbstractPiglin piglinBrute) { - Optional optional = BehaviorUtils.getLivingEntityFromUUIDMemory(piglinBrute, MemoryModuleType.ANGRY_AT); - if (optional.isPresent() && Sensor.isEntityAttackableIgnoringLineOfSight(piglinBrute, (LivingEntity)optional.get())) { + private static Optional findNearestValidAttackTarget(ServerLevel serverLevel, AbstractPiglin abstractPiglin) { + Optional optional = BehaviorUtils.getLivingEntityFromUUIDMemory(abstractPiglin, MemoryModuleType.ANGRY_AT); + if (optional.isPresent() && Sensor.isEntityAttackableIgnoringLineOfSight(serverLevel, abstractPiglin, (LivingEntity)optional.get())) { return optional; } else { - Optional optional2 = getTargetIfWithinRange(piglinBrute, MemoryModuleType.NEAREST_VISIBLE_ATTACKABLE_PLAYER); - return optional2.isPresent() ? optional2 : piglinBrute.getBrain().getMemory(MemoryModuleType.NEAREST_VISIBLE_NEMESIS); + Optional optional2 = abstractPiglin.getBrain().getMemory(MemoryModuleType.NEAREST_VISIBLE_ATTACKABLE_PLAYER); + return optional2.isPresent() ? optional2 : abstractPiglin.getBrain().getMemory(MemoryModuleType.NEAREST_VISIBLE_NEMESIS); } } - private static Optional getTargetIfWithinRange(AbstractPiglin piglinBrute, MemoryModuleType memoryType) { - return piglinBrute.getBrain().getMemory(memoryType).filter(livingEntity -> livingEntity.closerThan(piglinBrute, 12.0)); - } - - protected static void wasHurtBy(PiglinBrute piglinBrute, LivingEntity target) { - if (!(target instanceof AbstractPiglin)) { - PiglinAi.maybeRetaliate(piglinBrute, target); + protected static void wasHurtBy(ServerLevel serverLevel, PiglinBrute piglinBrute, LivingEntity livingEntity) { + if (!(livingEntity instanceof AbstractPiglin)) { + PiglinAi.maybeRetaliate(serverLevel, piglinBrute, livingEntity); } } diff --git a/net/minecraft/world/entity/monster/piglin/StartHuntingHoglin.java b/net/minecraft/world/entity/monster/piglin/StartHuntingHoglin.java index c7ef73e5..9246bffc 100644 --- a/net/minecraft/world/entity/monster/piglin/StartHuntingHoglin.java +++ b/net/minecraft/world/entity/monster/piglin/StartHuntingHoglin.java @@ -17,9 +17,9 @@ public class StartHuntingHoglin { .apply(instance, (memoryAccessor, memoryAccessor2, memoryAccessor3, memoryAccessor4) -> (serverLevel, piglin, l) -> { if (!piglin.isBaby() && !instance.tryGet(memoryAccessor4).map(list -> list.stream().anyMatch(StartHuntingHoglin::hasHuntedRecently)).isPresent()) { Hoglin hoglin = instance.get(memoryAccessor); - PiglinAi.setAngerTarget(piglin, hoglin); + PiglinAi.setAngerTarget(serverLevel, piglin, hoglin); PiglinAi.dontKillAnyMoreHoglinsForAWhile(piglin); - PiglinAi.broadcastAngerTarget(piglin, hoglin); + PiglinAi.broadcastAngerTarget(serverLevel, piglin, hoglin); instance.tryGet(memoryAccessor4).ifPresent(list -> list.forEach(PiglinAi::dontKillAnyMoreHoglinsForAWhile)); return true; } else { diff --git a/net/minecraft/world/entity/monster/piglin/StopHoldingItemIfNoLongerAdmiring.java b/net/minecraft/world/entity/monster/piglin/StopHoldingItemIfNoLongerAdmiring.java index 1f76e57e..bcd8d8b1 100644 --- a/net/minecraft/world/entity/monster/piglin/StopHoldingItemIfNoLongerAdmiring.java +++ b/net/minecraft/world/entity/monster/piglin/StopHoldingItemIfNoLongerAdmiring.java @@ -10,7 +10,7 @@ public class StopHoldingItemIfNoLongerAdmiring { return BehaviorBuilder.create( instance -> instance.group(instance.absent(MemoryModuleType.ADMIRING_ITEM)).apply(instance, memoryAccessor -> (serverLevel, piglin, l) -> { if (!piglin.getOffhandItem().isEmpty() && !piglin.getOffhandItem().is(Items.SHIELD)) { - PiglinAi.stopHoldingOffHandItem(piglin, true); + PiglinAi.stopHoldingOffHandItem(serverLevel, piglin, true); return true; } else { return false; diff --git a/net/minecraft/world/entity/monster/warden/Warden.java b/net/minecraft/world/entity/monster/warden/Warden.java index 87fc8353..51d71da5 100644 --- a/net/minecraft/world/entity/monster/warden/Warden.java +++ b/net/minecraft/world/entity/monster/warden/Warden.java @@ -31,6 +31,8 @@ import net.minecraft.tags.TagKey; import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; import net.minecraft.util.Unit; +import net.minecraft.util.profiling.Profiler; +import net.minecraft.util.profiling.ProfilerFiller; import net.minecraft.world.DifficultyInstance; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.effect.MobEffectInstance; @@ -40,19 +42,20 @@ import net.minecraft.world.entity.AnimationState; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityDimensions; import net.minecraft.world.entity.EntitySelector; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.entity.MobSpawnType; import net.minecraft.world.entity.Pose; import net.minecraft.world.entity.SpawnGroupData; import net.minecraft.world.entity.ai.Brain; -import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.entity.ai.attributes.AttributeSupplier.Builder; import net.minecraft.world.entity.ai.behavior.warden.SonicBoom; import net.minecraft.world.entity.ai.memory.MemoryModuleType; import net.minecraft.world.entity.ai.navigation.GroundPathNavigation; import net.minecraft.world.entity.ai.navigation.PathNavigation; import net.minecraft.world.entity.monster.Monster; +import net.minecraft.world.entity.monster.warden.Warden.1.1; import net.minecraft.world.entity.player.Player; import net.minecraft.world.level.Explosion; import net.minecraft.world.level.Level; @@ -64,8 +67,12 @@ import net.minecraft.world.level.gameevent.DynamicGameEventListener; import net.minecraft.world.level.gameevent.EntityPositionSource; import net.minecraft.world.level.gameevent.GameEvent; import net.minecraft.world.level.gameevent.PositionSource; +import net.minecraft.world.level.gameevent.GameEvent.Context; import net.minecraft.world.level.gameevent.vibrations.VibrationSystem; -import net.minecraft.world.level.pathfinder.Node; +import net.minecraft.world.level.gameevent.vibrations.VibrationSystem.Data; +import net.minecraft.world.level.gameevent.vibrations.VibrationSystem.Listener; +import net.minecraft.world.level.gameevent.vibrations.VibrationSystem.Ticker; +import net.minecraft.world.level.gameevent.vibrations.VibrationSystem.User; import net.minecraft.world.level.pathfinder.PathFinder; import net.minecraft.world.level.pathfinder.PathType; import net.minecraft.world.level.pathfinder.WalkNodeEvaluator; @@ -83,6 +90,7 @@ public class Warden extends Monster implements VibrationSystem { private static final float KNOCKBACK_RESISTANCE = 1.0F; private static final float ATTACK_KNOCKBACK = 1.5F; private static final int ATTACK_DAMAGE = 30; + private static final int FOLLOW_RANGE = 24; private static final EntityDataAccessor CLIENT_ANGER_LEVEL = SynchedEntityData.defineId(Warden.class, EntityDataSerializers.INT); private static final int DARKNESS_DISPLAY_LIMIT = 200; private static final int DARKNESS_DURATION = 260; @@ -108,16 +116,16 @@ public class Warden extends Monster implements VibrationSystem { public AnimationState diggingAnimationState = new AnimationState(); public AnimationState attackAnimationState = new AnimationState(); public AnimationState sonicBoomAnimationState = new AnimationState(); - private final DynamicGameEventListener dynamicGameEventListener; - private final VibrationSystem.User vibrationUser; - private VibrationSystem.Data vibrationData; + private final DynamicGameEventListener dynamicGameEventListener; + private final User vibrationUser; + private Data vibrationData; AngerManagement angerManagement = new AngerManagement(this::canTargetEntity, Collections.emptyList()); public Warden(EntityType entityType, Level level) { super(entityType, level); this.vibrationUser = new Warden.VibrationUser(); - this.vibrationData = new VibrationSystem.Data(); - this.dynamicGameEventListener = new DynamicGameEventListener<>(new VibrationSystem.Listener(this)); + this.vibrationData = new Data(); + this.dynamicGameEventListener = new DynamicGameEventListener<>(new Listener(this)); this.xpReward = 5; this.getNavigation().setCanFloat(true); this.setPathfindingMalus(PathType.UNPASSABLE_RAIL, 0.0F); @@ -152,8 +160,8 @@ public class Warden extends Monster implements VibrationSystem { } @Override - public boolean isInvulnerableTo(DamageSource source) { - return this.isDiggingOrEmerging() && !source.is(DamageTypeTags.BYPASSES_INVULNERABILITY) ? true : super.isInvulnerableTo(source); + public boolean isInvulnerableTo(ServerLevel serverLevel, DamageSource damageSource) { + return this.isDiggingOrEmerging() && !damageSource.is(DamageTypeTags.BYPASSES_INVULNERABILITY) ? true : super.isInvulnerableTo(serverLevel, damageSource); } boolean isDiggingOrEmerging() { @@ -175,13 +183,14 @@ public class Warden extends Monster implements VibrationSystem { return this.moveDist + 0.55F; } - public static AttributeSupplier.Builder createAttributes() { + public static Builder createAttributes() { return Monster.createMonsterAttributes() .add(Attributes.MAX_HEALTH, 500.0) .add(Attributes.MOVEMENT_SPEED, 0.3F) .add(Attributes.KNOCKBACK_RESISTANCE, 1.0) .add(Attributes.ATTACK_KNOCKBACK, 1.5) - .add(Attributes.ATTACK_DAMAGE, 30.0); + .add(Attributes.ATTACK_DAMAGE, 30.0) + .add(Attributes.FOLLOW_RANGE, 24.0); } @Override @@ -216,15 +225,15 @@ public class Warden extends Monster implements VibrationSystem { } @Override - public boolean doHurtTarget(Entity target) { - this.level().broadcastEntityEvent(this, (byte)4); + public boolean doHurtTarget(ServerLevel serverLevel, Entity entity) { + serverLevel.broadcastEntityEvent(this, (byte)4); this.playSound(SoundEvents.WARDEN_ATTACK_IMPACT, 10.0F, this.getVoicePitch()); SonicBoom.setCooldown(this, 40); - return super.doHurtTarget(target); + return super.doHurtTarget(serverLevel, entity); } @Override - protected void defineSynchedData(SynchedEntityData.Builder builder) { + protected void defineSynchedData(net.minecraft.network.syncher.SynchedEntityData.Builder builder) { super.defineSynchedData(builder); builder.define(CLIENT_ANGER_LEVEL, 0); } @@ -240,7 +249,7 @@ public class Warden extends Monster implements VibrationSystem { @Override public void tick() { if (this.level() instanceof ServerLevel serverLevel) { - VibrationSystem.Ticker.tick(serverLevel, this.vibrationData, this.vibrationUser); + Ticker.tick(serverLevel, this.vibrationData, this.vibrationUser); if (this.isPersistenceRequired() || this.requiresCustomPersistence()) { WardenAi.setDigCooldown(this); } @@ -276,12 +285,12 @@ public class Warden extends Monster implements VibrationSystem { } @Override - protected void customServerAiStep() { - ServerLevel serverLevel = (ServerLevel)this.level(); - serverLevel.getProfiler().push("wardenBrain"); + protected void customServerAiStep(ServerLevel serverLevel) { + ProfilerFiller profilerFiller = Profiler.get(); + profilerFiller.push("wardenBrain"); this.getBrain().tick(serverLevel, this); - this.level().getProfiler().pop(); - super.customServerAiStep(); + profilerFiller.pop(); + super.customServerAiStep(serverLevel); if ((this.tickCount + this.getId()) % 120 == 0) { applyDarknessAround(serverLevel, this.position(), this, 20); } @@ -322,7 +331,7 @@ public class Warden extends Monster implements VibrationSystem { } private void clientDiggingParticles(AnimationState animationState) { - if ((float)animationState.getAccumulatedTime() < 4500.0F) { + if ((float)animationState.getTimeInMillis(this.tickCount) < 4500.0F) { RandomSource randomSource = this.getRandom(); BlockState blockState = this.getBlockStateOn(); if (blockState.getRenderShape() != RenderShape.INVISIBLE) { @@ -411,7 +420,7 @@ public class Warden extends Monster implements VibrationSystem { .encodeStart(registryOps, this.angerManagement) .resultOrPartial(string -> LOGGER.error("Failed to encode anger state for Warden: '{}'", string)) .ifPresent(tag -> compound.put("anger", tag)); - VibrationSystem.Data.CODEC + Data.CODEC .encodeStart(registryOps, this.vibrationData) .resultOrPartial(string -> LOGGER.error("Failed to encode vibration listener for Warden: '{}'", string)) .ifPresent(tag -> compound.put("listener", tag)); @@ -430,7 +439,7 @@ public class Warden extends Monster implements VibrationSystem { } if (compound.contains("listener", 10)) { - VibrationSystem.Data.CODEC + Data.CODEC .parse(registryOps, compound.getCompound("listener")) .resultOrPartial(string -> LOGGER.error("Failed to parse vibration listener for Warden: '{}'", string)) .ifPresent(data -> this.vibrationData = data); @@ -492,26 +501,28 @@ public class Warden extends Monster implements VibrationSystem { @Nullable @Override - public SpawnGroupData finalizeSpawn(ServerLevelAccessor level, DifficultyInstance difficulty, MobSpawnType spawnType, @Nullable SpawnGroupData spawnGroupData) { + public SpawnGroupData finalizeSpawn( + ServerLevelAccessor serverLevelAccessor, DifficultyInstance difficultyInstance, EntitySpawnReason entitySpawnReason, @Nullable SpawnGroupData spawnGroupData + ) { this.getBrain().setMemoryWithExpiry(MemoryModuleType.DIG_COOLDOWN, Unit.INSTANCE, 1200L); - if (spawnType == MobSpawnType.TRIGGERED) { + if (entitySpawnReason == EntitySpawnReason.TRIGGERED) { this.setPose(Pose.EMERGING); this.getBrain().setMemoryWithExpiry(MemoryModuleType.IS_EMERGING, Unit.INSTANCE, WardenAi.EMERGE_DURATION); this.playSound(SoundEvents.WARDEN_AGITATED, 5.0F, 1.0F); } - return super.finalizeSpawn(level, difficulty, spawnType, spawnGroupData); + return super.finalizeSpawn(serverLevelAccessor, difficultyInstance, entitySpawnReason, spawnGroupData); } @Override - public boolean hurt(DamageSource source, float amount) { - boolean bl = super.hurt(source, amount); - if (!this.level().isClientSide && !this.isNoAi() && !this.isDiggingOrEmerging()) { - Entity entity = source.getEntity(); + public boolean hurtServer(ServerLevel serverLevel, DamageSource damageSource, float f) { + boolean bl = super.hurtServer(serverLevel, damageSource, f); + if (!this.isNoAi() && !this.isDiggingOrEmerging()) { + Entity entity = damageSource.getEntity(); this.increaseAngerAt(entity, AngerLevel.ANGRY.getMinimumAnger() + 20, false); if (this.brain.getMemory(MemoryModuleType.ATTACK_TARGET).isEmpty() && entity instanceof LivingEntity livingEntity - && (source.isDirect() || this.closerThan(livingEntity, 5.0))) { + && (damageSource.isDirect() || this.closerThan(livingEntity, 5.0))) { this.setAttackTarget(livingEntity); } } @@ -560,27 +571,22 @@ public class Warden extends Monster implements VibrationSystem { protected PathFinder createPathFinder(int maxVisitedNodes) { this.nodeEvaluator = new WalkNodeEvaluator(); this.nodeEvaluator.setCanPassDoors(true); - return new PathFinder(this.nodeEvaluator, maxVisitedNodes) { - @Override - protected float distance(Node first, Node second) { - return first.distanceToXZ(second); - } - }; + return new 1(this, this.nodeEvaluator, maxVisitedNodes); } }; } @Override - public VibrationSystem.Data getVibrationData() { + public Data getVibrationData() { return this.vibrationData; } @Override - public VibrationSystem.User getVibrationUser() { + public User getVibrationUser() { return this.vibrationUser; } - class VibrationUser implements VibrationSystem.User { + class VibrationUser implements User { private static final int GAME_EVENT_LISTENER_RANGE = 16; private final PositionSource positionSource = new EntityPositionSource(Warden.this, Warden.this.getEyeHeight()); @@ -605,7 +611,7 @@ public class Warden extends Monster implements VibrationSystem { } @Override - public boolean canReceiveVibration(ServerLevel level, BlockPos pos, Holder gameEvent, GameEvent.Context context) { + public boolean canReceiveVibration(ServerLevel level, BlockPos pos, Holder gameEvent, Context context) { return !Warden.this.isNoAi() && !Warden.this.isDeadOrDying() && !Warden.this.getBrain().hasMemoryValue(MemoryModuleType.VIBRATION_COOLDOWN) diff --git a/net/minecraft/world/entity/monster/warden/WardenAi.java b/net/minecraft/world/entity/monster/warden/WardenAi.java index d4d3a91d..9dea602e 100644 --- a/net/minecraft/world/entity/monster/warden/WardenAi.java +++ b/net/minecraft/world/entity/monster/warden/WardenAi.java @@ -7,10 +7,12 @@ import com.mojang.datafixers.util.Pair; import com.mojang.serialization.Dynamic; import java.util.List; import net.minecraft.core.BlockPos; +import net.minecraft.server.level.ServerLevel; import net.minecraft.util.Mth; import net.minecraft.util.Unit; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.ai.Brain; +import net.minecraft.world.entity.ai.Brain.Provider; import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.entity.ai.behavior.BehaviorControl; import net.minecraft.world.entity.ai.behavior.BlockPosTracker; @@ -99,7 +101,7 @@ public class WardenAi { } protected static Brain makeBrain(Warden warden, Dynamic ops) { - Brain.Provider provider = Brain.provider(MEMORY_TYPES, SENSOR_TYPES); + Provider provider = Brain.provider(MEMORY_TYPES, SENSOR_TYPES); Brain brain = provider.makeBrain(ops); initCoreActivity(brain); initEmergeActivity(brain); @@ -116,7 +118,7 @@ public class WardenAi { } private static void initCoreActivity(Brain brain) { - brain.addActivity(Activity.CORE, 0, ImmutableList.of(new Swim(0.8F), SetWardenLookTarget.create(), new LookAtTargetSink(45, 90), new MoveToTargetSink())); + brain.addActivity(Activity.CORE, 0, ImmutableList.of(new Swim<>(0.8F), SetWardenLookTarget.create(), new LookAtTargetSink(45, 90), new MoveToTargetSink())); } private static void initEmergeActivity(Brain brain) { @@ -171,8 +173,8 @@ public class WardenAi { 10, ImmutableList.of( DIG_COOLDOWN_SETTER, - StopAttackingIfTargetInvalid.create( - livingEntity -> !warden.getAngerLevel().isAngry() || !warden.canTargetEntity(livingEntity), WardenAi::onTargetInvalid, false + StopAttackingIfTargetInvalid.create( + (serverLevel, livingEntity) -> !warden.getAngerLevel().isAngry() || !warden.canTargetEntity(livingEntity), WardenAi::onTargetInvalid, false ), SetEntityLookTarget.create(livingEntity -> isTarget(warden, livingEntity), (float)warden.getAttributeValue(Attributes.FOLLOW_RANGE)), SetWalkTargetFromAttackTargetIfTargetOutOfReach.create(1.2F), @@ -187,9 +189,9 @@ public class WardenAi { return warden.getBrain().getMemory(MemoryModuleType.ATTACK_TARGET).filter(livingEntity2 -> livingEntity2 == entity).isPresent(); } - private static void onTargetInvalid(Warden warden, LivingEntity target) { - if (!warden.canTargetEntity(target)) { - warden.clearAnger(target); + private static void onTargetInvalid(ServerLevel serverLevel, Warden warden, LivingEntity livingEntity) { + if (!warden.canTargetEntity(livingEntity)) { + warden.clearAnger(livingEntity); } setDigCooldown(warden); diff --git a/net/minecraft/world/entity/monster/warden/WardenSpawnTracker.java b/net/minecraft/world/entity/monster/warden/WardenSpawnTracker.java index 38f05baa..35dff552 100644 --- a/net/minecraft/world/entity/monster/warden/WardenSpawnTracker.java +++ b/net/minecraft/world/entity/monster/warden/WardenSpawnTracker.java @@ -6,14 +6,11 @@ import java.util.Comparator; import java.util.List; import java.util.Optional; import java.util.OptionalInt; -import java.util.function.Predicate; import net.minecraft.core.BlockPos; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.util.ExtraCodecs; import net.minecraft.util.Mth; -import net.minecraft.world.entity.EntitySelector; -import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.Vec3; @@ -98,8 +95,7 @@ public class WardenSpawnTracker { private static List getNearbyPlayers(ServerLevel level, BlockPos pos) { Vec3 vec3 = Vec3.atCenterOf(pos); - Predicate predicate = serverPlayer -> serverPlayer.position().closerThan(vec3, 16.0); - return level.getPlayers(predicate.and(LivingEntity::isAlive).and(EntitySelector.NO_SPECTATORS)); + return level.getPlayers(serverPlayer -> !serverPlayer.isSpectator() && serverPlayer.position().closerThan(vec3, 16.0) && serverPlayer.isAlive()); } private void increaseWarningLevel() { diff --git a/net/minecraft/world/entity/npc/AbstractVillager.java b/net/minecraft/world/entity/npc/AbstractVillager.java index eb5bb3ac..bd1fcb91 100644 --- a/net/minecraft/world/entity/npc/AbstractVillager.java +++ b/net/minecraft/world/entity/npc/AbstractVillager.java @@ -11,6 +11,7 @@ import net.minecraft.nbt.NbtOps; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.network.syncher.SynchedEntityData.Builder; import net.minecraft.server.level.ServerPlayer; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; @@ -20,8 +21,8 @@ import net.minecraft.world.SimpleContainer; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.AgeableMob; import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; -import net.minecraft.world.entity.MobSpawnType; import net.minecraft.world.entity.SlotAccess; import net.minecraft.world.entity.SpawnGroupData; import net.minecraft.world.entity.player.Player; @@ -32,7 +33,7 @@ import net.minecraft.world.item.trading.MerchantOffers; import net.minecraft.world.level.Level; import net.minecraft.world.level.ServerLevelAccessor; import net.minecraft.world.level.pathfinder.PathType; -import net.minecraft.world.level.portal.DimensionTransition; +import net.minecraft.world.level.portal.TeleportTransition; import net.minecraft.world.phys.Vec3; import org.jetbrains.annotations.Nullable; import org.slf4j.Logger; @@ -55,12 +56,14 @@ public abstract class AbstractVillager extends AgeableMob implements InventoryCa } @Override - public SpawnGroupData finalizeSpawn(ServerLevelAccessor level, DifficultyInstance difficulty, MobSpawnType spawnType, @Nullable SpawnGroupData spawnGroupData) { + public SpawnGroupData finalizeSpawn( + ServerLevelAccessor serverLevelAccessor, DifficultyInstance difficultyInstance, EntitySpawnReason entitySpawnReason, @Nullable SpawnGroupData spawnGroupData + ) { if (spawnGroupData == null) { spawnGroupData = new AgeableMob.AgeableMobGroupData(false); } - return super.finalizeSpawn(level, difficulty, spawnType, spawnGroupData); + return super.finalizeSpawn(serverLevelAccessor, difficultyInstance, entitySpawnReason, spawnGroupData); } public int getUnhappyCounter() { @@ -77,7 +80,7 @@ public abstract class AbstractVillager extends AgeableMob implements InventoryCa } @Override - protected void defineSynchedData(SynchedEntityData.Builder builder) { + protected void defineSynchedData(Builder builder) { super.defineSynchedData(builder); builder.define(DATA_UNHAPPY_COUNTER, 0); } @@ -185,9 +188,9 @@ public abstract class AbstractVillager extends AgeableMob implements InventoryCa @Nullable @Override - public Entity changeDimension(DimensionTransition transition) { + public Entity teleport(TeleportTransition teleportTransition) { this.stopTrading(); - return super.changeDimension(transition); + return super.teleport(teleportTransition); } protected void stopTrading() { diff --git a/net/minecraft/world/entity/npc/CatSpawner.java b/net/minecraft/world/entity/npc/CatSpawner.java index 117b52cd..126ba5d3 100644 --- a/net/minecraft/world/entity/npc/CatSpawner.java +++ b/net/minecraft/world/entity/npc/CatSpawner.java @@ -5,8 +5,8 @@ import net.minecraft.core.BlockPos; import net.minecraft.server.level.ServerLevel; import net.minecraft.tags.StructureTags; import net.minecraft.util.RandomSource; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; -import net.minecraft.world.entity.MobSpawnType; import net.minecraft.world.entity.SpawnPlacements; import net.minecraft.world.entity.ai.village.poi.PoiManager; import net.minecraft.world.entity.ai.village.poi.PoiTypes; @@ -78,11 +78,11 @@ public class CatSpawner implements CustomSpawner { } private int spawnCat(BlockPos pos, ServerLevel serverLevel) { - Cat cat = EntityType.CAT.create(serverLevel); + Cat cat = EntityType.CAT.create(serverLevel, EntitySpawnReason.NATURAL); if (cat == null) { return 0; } else { - cat.finalizeSpawn(serverLevel, serverLevel.getCurrentDifficultyAt(pos), MobSpawnType.NATURAL, null); + cat.finalizeSpawn(serverLevel, serverLevel.getCurrentDifficultyAt(pos), EntitySpawnReason.NATURAL, null); cat.moveTo(pos, 0.0F, 0.0F); serverLevel.addFreshEntityWithPassengers(cat); return 1; diff --git a/net/minecraft/world/entity/npc/InventoryCarrier.java b/net/minecraft/world/entity/npc/InventoryCarrier.java index 5f1a2d57..9a52f1e7 100644 --- a/net/minecraft/world/entity/npc/InventoryCarrier.java +++ b/net/minecraft/world/entity/npc/InventoryCarrier.java @@ -2,6 +2,7 @@ package net.minecraft.world.entity.npc; import net.minecraft.core.HolderLookup; import net.minecraft.nbt.CompoundTag; +import net.minecraft.server.level.ServerLevel; import net.minecraft.world.SimpleContainer; import net.minecraft.world.entity.Mob; import net.minecraft.world.entity.item.ItemEntity; @@ -12,10 +13,10 @@ public interface InventoryCarrier { SimpleContainer getInventory(); - static void pickUpItem(Mob mob, InventoryCarrier carrier, ItemEntity itemEntity) { + static void pickUpItem(ServerLevel serverLevel, Mob mob, InventoryCarrier inventoryCarrier, ItemEntity itemEntity) { ItemStack itemStack = itemEntity.getItem(); - if (mob.wantsToPickUp(itemStack)) { - SimpleContainer simpleContainer = carrier.getInventory(); + if (mob.wantsToPickUp(serverLevel, itemStack)) { + SimpleContainer simpleContainer = inventoryCarrier.getInventory(); boolean bl = simpleContainer.canAddItem(itemStack); if (!bl) { return; diff --git a/net/minecraft/world/entity/npc/Villager.java b/net/minecraft/world/entity/npc/Villager.java index 64d533a3..98968687 100644 --- a/net/minecraft/world/entity/npc/Villager.java +++ b/net/minecraft/world/entity/npc/Villager.java @@ -11,9 +11,7 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import java.util.List; import java.util.Map; import java.util.Optional; -import java.util.Set; import java.util.function.BiPredicate; -import java.util.stream.Collectors; import net.minecraft.core.BlockPos; import net.minecraft.core.GlobalPos; import net.minecraft.core.Holder; @@ -36,6 +34,8 @@ import net.minecraft.stats.Stats; import net.minecraft.tags.ItemTags; import net.minecraft.util.Mth; import net.minecraft.util.SpawnUtil; +import net.minecraft.util.profiling.Profiler; +import net.minecraft.util.profiling.ProfilerFiller; import net.minecraft.world.Difficulty; import net.minecraft.world.DifficultyInstance; import net.minecraft.world.InteractionHand; @@ -45,18 +45,20 @@ import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.effect.MobEffectInstance; import net.minecraft.world.effect.MobEffects; import net.minecraft.world.entity.AgeableMob; +import net.minecraft.world.entity.ConversionParams; import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.ExperienceOrb; import net.minecraft.world.entity.LightningBolt; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.Mob; -import net.minecraft.world.entity.MobSpawnType; import net.minecraft.world.entity.ReputationEventHandler; import net.minecraft.world.entity.SpawnGroupData; import net.minecraft.world.entity.ai.Brain; -import net.minecraft.world.entity.ai.attributes.AttributeSupplier; +import net.minecraft.world.entity.ai.Brain.Provider; import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.entity.ai.attributes.AttributeSupplier.Builder; import net.minecraft.world.entity.ai.behavior.VillagerGoalPackages; import net.minecraft.world.entity.ai.gossip.GossipContainer; import net.minecraft.world.entity.ai.gossip.GossipType; @@ -98,16 +100,9 @@ public class Villager extends AbstractVillager implements ReputationEventHandler */ public static final Map FOOD_POINTS = ImmutableMap.of(Items.BREAD, 4, Items.POTATO, 1, Items.CARROT, 1, Items.BEETROOT, 1); private static final int TRADES_PER_LEVEL = 2; - /** - * Defaults items a villager regardless of its profession can pick up. - */ - private static final Set WANTED_ITEMS = ImmutableSet.of( - Items.BREAD, Items.POTATO, Items.CARROT, Items.WHEAT, Items.WHEAT_SEEDS, Items.BEETROOT, Items.BEETROOT_SEEDS, Items.TORCHFLOWER_SEEDS, Items.PITCHER_POD - ); private static final int MAX_GOSSIP_TOPICS = 10; private static final int GOSSIP_COOLDOWN = 1200; private static final int GOSSIP_DECAY_INTERVAL = 24000; - private static final int REPUTATION_CHANGE_PER_EVENT = 25; private static final int HOW_FAR_AWAY_TO_TALK_TO_OTHER_VILLAGERS_ABOUT_GOLEMS = 10; private static final int HOW_MANY_VILLAGERS_NEED_TO_AGREE_TO_SPAWN_A_GOLEM = 5; private static final long TIME_SINCE_SLEEPING_FOR_GOLEM_SPAWNING = 24000L; @@ -189,6 +184,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler super(entityType, level); ((GroundPathNavigation)this.getNavigation()).setCanOpenDoors(true); this.getNavigation().setCanFloat(true); + this.getNavigation().setRequiredPathLength(48.0F); this.setCanPickUpLoot(true); this.setVillagerData(this.getVillagerData().setType(villagerType).setProfession(VillagerProfession.NONE)); } @@ -199,7 +195,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler } @Override - protected Brain.Provider brainProvider() { + protected Provider brainProvider() { return Brain.provider(MEMORY_TYPES, SENSOR_TYPES); } @@ -257,8 +253,8 @@ public class Villager extends AbstractVillager implements ReputationEventHandler } } - public static AttributeSupplier.Builder createAttributes() { - return Mob.createMobAttributes().add(Attributes.MOVEMENT_SPEED, 0.5).add(Attributes.FOLLOW_RANGE, 48.0); + public static Builder createAttributes() { + return Mob.createMobAttributes().add(Attributes.MOVEMENT_SPEED, 0.5); } public boolean assignProfessionWhenSpawned() { @@ -266,10 +262,11 @@ public class Villager extends AbstractVillager implements ReputationEventHandler } @Override - protected void customServerAiStep() { - this.level().getProfiler().push("villagerBrain"); - this.getBrain().tick((ServerLevel)this.level(), this); - this.level().getProfiler().pop(); + protected void customServerAiStep(ServerLevel serverLevel) { + ProfilerFiller profilerFiller = Profiler.get(); + profilerFiller.push("villagerBrain"); + this.getBrain().tick(serverLevel, this); + profilerFiller.pop(); if (this.assignProfessionWhenSpawned) { this.assignProfessionWhenSpawned = false; } @@ -286,16 +283,16 @@ public class Villager extends AbstractVillager implements ReputationEventHandler } } - if (this.lastTradedPlayer != null && this.level() instanceof ServerLevel) { - ((ServerLevel)this.level()).onReputationEvent(ReputationEventType.TRADE, this.lastTradedPlayer, this); - this.level().broadcastEntityEvent(this, (byte)14); + if (this.lastTradedPlayer != null) { + serverLevel.onReputationEvent(ReputationEventType.TRADE, this.lastTradedPlayer, this); + serverLevel.broadcastEntityEvent(this, (byte)14); this.lastTradedPlayer = null; } if (!this.isNoAi() && this.random.nextInt(100) == 0) { - Raid raid = ((ServerLevel)this.level()).getRaidAt(this.blockPosition()); + Raid raid = serverLevel.getRaidAt(this.blockPosition()); if (raid != null && raid.isActive() && !raid.isOver()) { - this.level().broadcastEntityEvent(this, (byte)42); + serverLevel.broadcastEntityEvent(this, (byte)42); } } @@ -303,7 +300,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler this.stopTrading(); } - super.customServerAiStep(); + super.customServerAiStep(serverLevel); } @Override @@ -323,7 +320,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler return super.mobInteract(player, hand); } else if (this.isBaby()) { this.setUnhappy(); - return InteractionResult.sidedSuccess(this.level().isClientSide); + return InteractionResult.SUCCESS; } else { if (!this.level().isClientSide) { boolean bl = this.getOffers().isEmpty(); @@ -342,7 +339,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler this.startTrading(player); } - return InteractionResult.sidedSuccess(this.level().isClientSide); + return InteractionResult.SUCCESS; } } @@ -387,11 +384,6 @@ public class Villager extends AbstractVillager implements ReputationEventHandler return true; } - @Override - public boolean isClientSide() { - return this.level().isClientSide; - } - public void restock() { this.updateDemand(); @@ -490,7 +482,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler } @Override - protected void defineSynchedData(SynchedEntityData.Builder builder) { + protected void defineSynchedData(net.minecraft.network.syncher.SynchedEntityData.Builder builder) { super.defineSynchedData(builder); builder.define(DATA_VILLAGER_DATA, new VillagerData(VillagerType.PLAINS, VillagerProfession.NONE, 1)); } @@ -532,7 +524,6 @@ public class Villager extends AbstractVillager implements ReputationEventHandler this.lastRestockGameTime = compound.getLong("LastRestock"); this.lastGossipDecayTime = compound.getLong("LastGossipDecay"); - this.setCanPickUpLoot(true); if (this.level() instanceof ServerLevel) { this.refreshBrain((ServerLevel)this.level()); } @@ -603,14 +594,6 @@ public class Villager extends AbstractVillager implements ReputationEventHandler } } - public void setChasing(boolean chasing) { - this.chasing = chasing; - } - - public boolean isChasing() { - return this.chasing; - } - @Override public void setLastHurtByMob(@Nullable LivingEntity livingEntity) { if (livingEntity != null && this.level() instanceof ServerLevel) { @@ -753,20 +736,25 @@ public class Villager extends AbstractVillager implements ReputationEventHandler @Nullable @Override - public SpawnGroupData finalizeSpawn(ServerLevelAccessor level, DifficultyInstance difficulty, MobSpawnType spawnType, @Nullable SpawnGroupData spawnGroupData) { - if (spawnType == MobSpawnType.BREEDING) { + public SpawnGroupData finalizeSpawn( + ServerLevelAccessor serverLevelAccessor, DifficultyInstance difficultyInstance, EntitySpawnReason entitySpawnReason, @Nullable SpawnGroupData spawnGroupData + ) { + if (entitySpawnReason == EntitySpawnReason.BREEDING) { this.setVillagerData(this.getVillagerData().setProfession(VillagerProfession.NONE)); } - if (spawnType == MobSpawnType.COMMAND || spawnType == MobSpawnType.SPAWN_EGG || MobSpawnType.isSpawner(spawnType) || spawnType == MobSpawnType.DISPENSER) { - this.setVillagerData(this.getVillagerData().setType(VillagerType.byBiome(level.getBiome(this.blockPosition())))); + if (entitySpawnReason == EntitySpawnReason.COMMAND + || entitySpawnReason == EntitySpawnReason.SPAWN_ITEM_USE + || EntitySpawnReason.isSpawner(entitySpawnReason) + || entitySpawnReason == EntitySpawnReason.DISPENSER) { + this.setVillagerData(this.getVillagerData().setType(VillagerType.byBiome(serverLevelAccessor.getBiome(this.blockPosition())))); } - if (spawnType == MobSpawnType.STRUCTURE) { + if (entitySpawnReason == EntitySpawnReason.STRUCTURE) { this.assignProfessionWhenSpawned = true; } - return super.finalizeSpawn(level, difficulty, spawnType, spawnGroupData); + return super.finalizeSpawn(serverLevelAccessor, difficultyInstance, entitySpawnReason, spawnGroupData); } @Nullable @@ -782,7 +770,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler } Villager villager = new Villager(EntityType.VILLAGER, level, villagerType); - villager.finalizeSpawn(level, level.getCurrentDifficultyAt(villager.blockPosition()), MobSpawnType.BREEDING, null); + villager.finalizeSpawn(level, level.getCurrentDifficultyAt(villager.blockPosition()), EntitySpawnReason.BREEDING, null); return villager; } @@ -790,21 +778,12 @@ public class Villager extends AbstractVillager implements ReputationEventHandler public void thunderHit(ServerLevel level, LightningBolt lightning) { if (level.getDifficulty() != Difficulty.PEACEFUL) { LOGGER.info("Villager {} was struck by lightning {}.", this, lightning); - Witch witch = EntityType.WITCH.create(level); - if (witch != null) { - witch.moveTo(this.getX(), this.getY(), this.getZ(), this.getYRot(), this.getXRot()); - witch.finalizeSpawn(level, level.getCurrentDifficultyAt(witch.blockPosition()), MobSpawnType.CONVERSION, null); - witch.setNoAi(this.isNoAi()); - if (this.hasCustomName()) { - witch.setCustomName(this.getCustomName()); - witch.setCustomNameVisible(this.isCustomNameVisible()); - } - - witch.setPersistenceRequired(); - level.addFreshEntityWithPassengers(witch); + Witch witch = this.convertTo(EntityType.WITCH, ConversionParams.single(this, false, false), witchx -> { + witchx.finalizeSpawn(level, level.getCurrentDifficultyAt(witchx.blockPosition()), EntitySpawnReason.CONVERSION, null); + witchx.setPersistenceRequired(); this.releaseAllPois(); - this.discard(); - } else { + }); + if (witch == null) { super.thunderHit(level, lightning); } } else { @@ -813,14 +792,15 @@ public class Villager extends AbstractVillager implements ReputationEventHandler } @Override - protected void pickUpItem(ItemEntity itemEntity) { - InventoryCarrier.pickUpItem(this, this, itemEntity); + protected void pickUpItem(ServerLevel serverLevel, ItemEntity itemEntity) { + InventoryCarrier.pickUpItem(serverLevel, this, this, itemEntity); } @Override - public boolean wantsToPickUp(ItemStack stack) { - Item item = stack.getItem(); - return (WANTED_ITEMS.contains(item) || this.getVillagerData().getProfession().requestedItems().contains(item)) && this.getInventory().canAddItem(stack); + public boolean wantsToPickUp(ServerLevel serverLevel, ItemStack itemStack) { + Item item = itemStack.getItem(); + return (itemStack.is(ItemTags.VILLAGER_PICKS_UP) || this.getVillagerData().getProfession().requestedItems().contains(item)) + && this.getInventory().canAddItem(itemStack); } /** @@ -894,10 +874,10 @@ public class Villager extends AbstractVillager implements ReputationEventHandler if (this.wantsToSpawnGolem(gameTime)) { AABB aABB = this.getBoundingBox().inflate(10.0, 10.0, 10.0); List list = serverLevel.getEntitiesOfClass(Villager.class, aABB); - List list2 = (List)list.stream().filter(villager -> villager.wantsToSpawnGolem(gameTime)).limit(5L).collect(Collectors.toList()); + List list2 = list.stream().filter(villager -> villager.wantsToSpawnGolem(gameTime)).limit(5L).toList(); if (list2.size() >= minVillagerAmount) { if (!SpawnUtil.trySpawnMob( - EntityType.IRON_GOLEM, MobSpawnType.MOB_SUMMONED, serverLevel, this.blockPosition(), 10, 8, 6, SpawnUtil.Strategy.LEGACY_IRON_GOLEM + EntityType.IRON_GOLEM, EntitySpawnReason.MOB_SUMMONED, serverLevel, this.blockPosition(), 10, 8, 6, SpawnUtil.Strategy.LEGACY_IRON_GOLEM ) .isEmpty()) { list.forEach(GolemSensor::golemDetected); @@ -968,6 +948,6 @@ public class Villager extends AbstractVillager implements ReputationEventHandler private boolean golemSpawnConditionsMet(long gameTime) { Optional optional = this.brain.getMemory(MemoryModuleType.LAST_SLEPT); - return optional.isPresent() ? gameTime - (Long)optional.get() < 24000L : false; + return optional.filter(long_ -> gameTime - long_ < 24000L).isPresent(); } } diff --git a/net/minecraft/world/entity/npc/VillagerTrades.java b/net/minecraft/world/entity/npc/VillagerTrades.java index 80e70ae9..93619daa 100644 --- a/net/minecraft/world/entity/npc/VillagerTrades.java +++ b/net/minecraft/world/entity/npc/VillagerTrades.java @@ -33,7 +33,6 @@ import net.minecraft.world.effect.MobEffects; import net.minecraft.world.entity.Entity; import net.minecraft.world.item.DyeColor; import net.minecraft.world.item.DyeItem; -import net.minecraft.world.item.EnchantedBookItem; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; @@ -1384,7 +1383,7 @@ public class VillagerTrades { public MerchantOffer getOffer(Entity trader, RandomSource random) { Optional> optional = trader.level() .registryAccess() - .registryOrThrow(Registries.ENCHANTMENT) + .lookupOrThrow(Registries.ENCHANTMENT) .getRandomElementOf(this.tradeableEnchantments, random); int l; ItemStack itemStack; @@ -1394,7 +1393,7 @@ public class VillagerTrades { int i = Math.max(enchantment.getMinLevel(), this.minLevel); int j = Math.min(enchantment.getMaxLevel(), this.maxLevel); int k = Mth.nextInt(random, i, j); - itemStack = EnchantedBookItem.createForEnchantment(new EnchantmentInstance(holder, k)); + itemStack = EnchantmentHelper.createBook(new EnchantmentInstance(holder, k)); l = 2 + random.nextInt(5 + k * 10) + 3 * k; if (holder.is(EnchantmentTags.DOUBLE_TRADE_PRICE)) { l *= 2; @@ -1435,7 +1434,7 @@ public class VillagerTrades { public MerchantOffer getOffer(Entity trader, RandomSource random) { int i = 5 + random.nextInt(15); RegistryAccess registryAccess = trader.level().registryAccess(); - Optional> optional = registryAccess.registryOrThrow(Registries.ENCHANTMENT).getTag(EnchantmentTags.ON_TRADED_EQUIPMENT); + Optional> optional = registryAccess.lookupOrThrow(Registries.ENCHANTMENT).get(EnchantmentTags.ON_TRADED_EQUIPMENT); ItemStack itemStack = EnchantmentHelper.enchantItem(random, new ItemStack(this.itemStack.getItem()), i, registryAccess, optional); int j = Math.min(this.baseEmeraldCost + i, 64); ItemCost itemCost = new ItemCost(Items.EMERALD, j); @@ -1655,7 +1654,7 @@ public class VillagerTrades { public MerchantOffer getOffer(Entity trader, RandomSource random) { ItemCost itemCost = new ItemCost(Items.EMERALD, this.emeraldCost); List> list = (List>)BuiltInRegistries.POTION - .holders() + .listElements() .filter(reference -> !((Potion)reference.value()).getEffects().isEmpty() && trader.level().potionBrewing().isBrewablePotion(reference)) .collect(Collectors.toList()); Holder holder = Util.getRandom(list, random); diff --git a/net/minecraft/world/entity/npc/WanderingTrader.java b/net/minecraft/world/entity/npc/WanderingTrader.java index 0709d3a3..21738ed2 100644 --- a/net/minecraft/world/entity/npc/WanderingTrader.java +++ b/net/minecraft/world/entity/npc/WanderingTrader.java @@ -39,6 +39,7 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.item.alchemy.PotionContents; import net.minecraft.world.item.alchemy.Potions; +import net.minecraft.world.item.component.Consumable; import net.minecraft.world.item.trading.MerchantOffer; import net.minecraft.world.item.trading.MerchantOffers; import net.minecraft.world.level.Level; @@ -46,7 +47,7 @@ import net.minecraft.world.phys.Vec3; import org.apache.commons.lang3.tuple.Pair; import org.jetbrains.annotations.Nullable; -public class WanderingTrader extends AbstractVillager { +public class WanderingTrader extends AbstractVillager implements Consumable.OverrideConsumeSound { private static final int NUMBER_OF_TRADE_OFFERS = 5; @Nullable private BlockPos wanderTarget; @@ -121,7 +122,7 @@ public class WanderingTrader extends AbstractVillager { this.openTradingScreen(player, this.getDisplayName(), 1); } - return InteractionResult.sidedSuccess(this.level().isClientSide); + return InteractionResult.SUCCESS; } else { return super.mobInteract(player, hand); } @@ -205,8 +206,8 @@ public class WanderingTrader extends AbstractVillager { } @Override - protected SoundEvent getDrinkingSound(ItemStack stack) { - return stack.is(Items.MILK_BUCKET) ? SoundEvents.WANDERING_TRADER_DRINK_MILK : SoundEvents.WANDERING_TRADER_DRINK_POTION; + public SoundEvent getConsumeSound(ItemStack itemStack) { + return itemStack.is(Items.MILK_BUCKET) ? SoundEvents.WANDERING_TRADER_DRINK_MILK : SoundEvents.WANDERING_TRADER_DRINK_POTION; } @Override diff --git a/net/minecraft/world/entity/npc/WanderingTraderSpawner.java b/net/minecraft/world/entity/npc/WanderingTraderSpawner.java index 46b387f6..2305f5b6 100644 --- a/net/minecraft/world/entity/npc/WanderingTraderSpawner.java +++ b/net/minecraft/world/entity/npc/WanderingTraderSpawner.java @@ -6,8 +6,8 @@ import net.minecraft.server.level.ServerLevel; import net.minecraft.tags.BiomeTags; import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; -import net.minecraft.world.entity.MobSpawnType; import net.minecraft.world.entity.SpawnPlacementType; import net.minecraft.world.entity.SpawnPlacements; import net.minecraft.world.entity.ai.village.poi.PoiManager; @@ -100,7 +100,7 @@ public class WanderingTraderSpawner implements CustomSpawner { return false; } - WanderingTrader wanderingTrader = EntityType.WANDERING_TRADER.spawn(serverLevel, blockPos3, MobSpawnType.EVENT); + WanderingTrader wanderingTrader = EntityType.WANDERING_TRADER.spawn(serverLevel, blockPos3, EntitySpawnReason.EVENT); if (wanderingTrader != null) { for (int j = 0; j < 2; j++) { this.tryToSpawnLlamaFor(serverLevel, wanderingTrader, 4); @@ -121,7 +121,7 @@ public class WanderingTraderSpawner implements CustomSpawner { private void tryToSpawnLlamaFor(ServerLevel serverLevel, WanderingTrader trader, int maxDistance) { BlockPos blockPos = this.findSpawnPositionNear(serverLevel, trader.blockPosition(), maxDistance); if (blockPos != null) { - TraderLlama traderLlama = EntityType.TRADER_LLAMA.spawn(serverLevel, blockPos, MobSpawnType.EVENT); + TraderLlama traderLlama = EntityType.TRADER_LLAMA.spawn(serverLevel, blockPos, EntitySpawnReason.EVENT); if (traderLlama != null) { traderLlama.setLeashedTo(trader, true); } diff --git a/net/minecraft/world/entity/player/Input.java b/net/minecraft/world/entity/player/Input.java new file mode 100644 index 00000000..eba9d96c --- /dev/null +++ b/net/minecraft/world/entity/player/Input.java @@ -0,0 +1,40 @@ +package net.minecraft.world.entity.player; + +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.codec.StreamCodec; + +public record Input(boolean forward, boolean backward, boolean left, boolean right, boolean jump, boolean shift, boolean sprint) { + private static final byte FLAG_FORWARD = 1; + private static final byte FLAG_BACKWARD = 2; + private static final byte FLAG_LEFT = 4; + private static final byte FLAG_RIGHT = 8; + private static final byte FLAG_JUMP = 16; + private static final byte FLAG_SHIFT = 32; + private static final byte FLAG_SPRINT = 64; + public static final StreamCodec STREAM_CODEC = new StreamCodec() { + public void encode(FriendlyByteBuf friendlyByteBuf, Input input) { + byte b = 0; + b = (byte)(b | (input.forward() ? 1 : 0)); + b = (byte)(b | (input.backward() ? 2 : 0)); + b = (byte)(b | (input.left() ? 4 : 0)); + b = (byte)(b | (input.right() ? 8 : 0)); + b = (byte)(b | (input.jump() ? 16 : 0)); + b = (byte)(b | (input.shift() ? 32 : 0)); + b = (byte)(b | (input.sprint() ? 64 : 0)); + friendlyByteBuf.writeByte(b); + } + + public Input decode(FriendlyByteBuf friendlyByteBuf) { + byte b = friendlyByteBuf.readByte(); + boolean bl = (b & 1) != 0; + boolean bl2 = (b & 2) != 0; + boolean bl3 = (b & 4) != 0; + boolean bl4 = (b & 8) != 0; + boolean bl5 = (b & 16) != 0; + boolean bl6 = (b & 32) != 0; + boolean bl7 = (b & 64) != 0; + return new Input(bl, bl2, bl3, bl4, bl5, bl6, bl7); + } + }; + public static Input EMPTY = new Input(false, false, false, false, false, false, false); +} diff --git a/net/minecraft/world/entity/player/Inventory.java b/net/minecraft/world/entity/player/Inventory.java index 821d7512..7b2cebfe 100644 --- a/net/minecraft/world/entity/player/Inventory.java +++ b/net/minecraft/world/entity/player/Inventory.java @@ -7,12 +7,13 @@ import net.minecraft.CrashReport; import net.minecraft.CrashReportCategory; import net.minecraft.CrashReportDetail; import net.minecraft.ReportedException; +import net.minecraft.core.Holder; import net.minecraft.core.NonNullList; import net.minecraft.core.component.DataComponents; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.ListTag; import net.minecraft.network.chat.Component; -import net.minecraft.network.protocol.game.ClientboundContainerSetSlotPacket; +import net.minecraft.network.protocol.game.ClientboundSetPlayerInventoryPacket; import net.minecraft.server.level.ServerPlayer; import net.minecraft.tags.TagKey; import net.minecraft.world.Container; @@ -25,11 +26,9 @@ import net.minecraft.world.level.block.state.BlockState; public class Inventory implements Container, Nameable { public static final int POP_TIME_DURATION = 5; public static final int INVENTORY_SIZE = 36; - private static final int SELECTION_SIZE = 9; + public static final int SELECTION_SIZE = 9; public static final int SLOT_OFFHAND = 40; public static final int NOT_FOUND_INDEX = -1; - public static final int[] ALL_ARMOR_SLOTS = new int[]{0, 1, 2, 3}; - public static final int[] HELMET_SLOT_ONLY = new int[]{3}; public final NonNullList items = NonNullList.withSize(36, ItemStack.EMPTY); public final NonNullList armor = NonNullList.withSize(4, ItemStack.EMPTY); public final NonNullList offhand = NonNullList.withSize(1, ItemStack.EMPTY); @@ -121,14 +120,14 @@ public class Inventory implements Container, Nameable { return -1; } - public int findSlotMatchingUnusedItem(ItemStack stack) { + public static boolean isUsableForCrafting(ItemStack itemStack) { + return !itemStack.isDamaged() && !itemStack.isEnchanted() && !itemStack.has(DataComponents.CUSTOM_NAME); + } + + public int findSlotMatchingCraftingIngredient(Holder holder) { for (int i = 0; i < this.items.size(); i++) { ItemStack itemStack = this.items.get(i); - if (!itemStack.isEmpty() - && ItemStack.isSameItemSameComponents(stack, itemStack) - && !itemStack.isDamaged() - && !itemStack.isEnchanted() - && !itemStack.has(DataComponents.CUSTOM_NAME)) { + if (!itemStack.isEmpty() && itemStack.is(holder) && isUsableForCrafting(itemStack)) { return i; } } @@ -154,20 +153,8 @@ public class Inventory implements Container, Nameable { return this.selected; } - /** - * Change the selected item in the hotbar after a mouse scroll. Select the slot to the left if {@code direction} is positive, or to the right if negative. - */ - public void swapPaint(double direction) { - int i = (int)Math.signum(direction); - this.selected -= i; - - while (this.selected < 0) { - this.selected += 9; - } - - while (this.selected >= 9) { - this.selected -= 9; - } + public void setSelectedHotbarSlot(int i) { + this.selected = i; } public int clearOrCountMatchingItems(Predicate stackPredicate, int maxCount, Container inventory) { @@ -324,12 +311,16 @@ public class Inventory implements Container, Nameable { } int j = stack.getMaxStackSize() - this.getItem(i).getCount(); - if (this.add(i, stack.split(j)) && sendPacket && this.player instanceof ServerPlayer) { - ((ServerPlayer)this.player).connection.send(new ClientboundContainerSetSlotPacket(-2, 0, i, this.getItem(i))); + if (this.add(i, stack.split(j)) && sendPacket && this.player instanceof ServerPlayer serverPlayer) { + serverPlayer.connection.send(this.createInventoryUpdatePacket(i)); } } } + public ClientboundSetPlayerInventoryPacket createInventoryUpdatePacket(int i) { + return new ClientboundSetPlayerInventoryPacket(i, this.getItem(i).copy()); + } + @Override public ItemStack removeItem(int slot, int amount) { List list = null; @@ -596,9 +587,9 @@ public class Inventory implements Container, Nameable { } } - public void fillStackedContents(StackedContents stackedContent) { + public void fillStackedContents(StackedItemContents stackedItemContents) { for (ItemStack itemStack : this.items) { - stackedContent.accountSimpleStack(itemStack); + stackedItemContents.accountSimpleStack(itemStack); } } diff --git a/net/minecraft/world/entity/player/Player.java b/net/minecraft/world/entity/player/Player.java index d910b4e0..684f626a 100644 --- a/net/minecraft/world/entity/player/Player.java +++ b/net/minecraft/world/entity/player/Player.java @@ -3,6 +3,7 @@ package net.minecraft.world.entity.player; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Lists; +import com.google.common.math.IntMath; import com.mojang.authlib.GameProfile; import com.mojang.datafixers.util.Either; import com.mojang.logging.LogUtils; @@ -13,10 +14,10 @@ import java.util.Optional; import java.util.OptionalInt; import java.util.function.Predicate; import net.minecraft.Util; -import net.minecraft.advancements.CriteriaTriggers; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.GlobalPos; +import net.minecraft.core.component.DataComponents; import net.minecraft.core.particles.ParticleTypes; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.ListTag; @@ -29,6 +30,7 @@ import net.minecraft.network.protocol.game.ClientboundSetEntityMotionPacket; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; @@ -41,6 +43,7 @@ import net.minecraft.tags.BlockTags; import net.minecraft.tags.DamageTypeTags; import net.minecraft.tags.EntityTypeTags; import net.minecraft.tags.FluidTags; +import net.minecraft.tags.ItemTags; import net.minecraft.util.Mth; import net.minecraft.util.Unit; import net.minecraft.world.Container; @@ -56,6 +59,7 @@ import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityAttachment; import net.minecraft.world.entity.EntityAttachments; import net.minecraft.world.entity.EntityDimensions; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.HumanoidArm; @@ -64,8 +68,8 @@ import net.minecraft.world.entity.MoverType; import net.minecraft.world.entity.Pose; import net.minecraft.world.entity.SlotAccess; import net.minecraft.world.entity.TamableAnimal; -import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.entity.ai.attributes.AttributeSupplier.Builder; import net.minecraft.world.entity.animal.Parrot; import net.minecraft.world.entity.animal.horse.AbstractHorse; import net.minecraft.world.entity.boss.EnderDragonPart; @@ -76,20 +80,20 @@ import net.minecraft.world.entity.projectile.FishingHook; import net.minecraft.world.entity.projectile.Projectile; import net.minecraft.world.entity.projectile.ProjectileDeflection; import net.minecraft.world.food.FoodData; -import net.minecraft.world.food.FoodProperties; import net.minecraft.world.inventory.AbstractContainerMenu; import net.minecraft.world.inventory.ClickAction; import net.minecraft.world.inventory.InventoryMenu; import net.minecraft.world.inventory.PlayerEnderChestContainer; -import net.minecraft.world.item.ElytraItem; +import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemCooldowns; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.item.ProjectileWeaponItem; -import net.minecraft.world.item.SwordItem; +import net.minecraft.world.item.crafting.Recipe; import net.minecraft.world.item.crafting.RecipeHolder; import net.minecraft.world.item.enchantment.EnchantmentEffectComponents; import net.minecraft.world.item.enchantment.EnchantmentHelper; +import net.minecraft.world.item.equipment.Equippable; import net.minecraft.world.item.trading.MerchantOffers; import net.minecraft.world.level.BaseCommandBlock; import net.minecraft.world.level.GameRules; @@ -102,6 +106,7 @@ import net.minecraft.world.level.block.entity.StructureBlockEntity; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.pattern.BlockInWorld; import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.level.gameevent.GameEvent.Context; import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.Vec3; import net.minecraft.world.scores.PlayerTeam; @@ -218,7 +223,7 @@ public abstract class Player extends LivingEntity { } } - public static AttributeSupplier.Builder createAttributes() { + public static Builder createAttributes() { return LivingEntity.createLivingAttributes() .add(Attributes.ATTACK_DAMAGE, 1.0) .add(Attributes.MOVEMENT_SPEED, 0.1F) @@ -234,7 +239,7 @@ public abstract class Player extends LivingEntity { } @Override - protected void defineSynchedData(SynchedEntityData.Builder builder) { + protected void defineSynchedData(net.minecraft.network.syncher.SynchedEntityData.Builder builder) { super.defineSynchedData(builder); builder.define(DATA_PLAYER_ABSORPTION_ID, 0.0F); builder.define(DATA_SCORE_ID, 0); @@ -279,8 +284,8 @@ public abstract class Player extends LivingEntity { } this.moveCloak(); - if (!this.level().isClientSide) { - this.foodData.tick(this); + if (this instanceof ServerPlayer serverPlayer) { + this.foodData.tick(serverPlayer); this.awardStat(Stats.PLAY_TIME); this.awardStat(Stats.TOTAL_WORLD_TIME); if (this.isAlive()) { @@ -313,7 +318,10 @@ public abstract class Player extends LivingEntity { this.lastItemInMainHand = itemStack.copy(); } - this.turtleHelmetTick(); + if (!this.isEyeInFluid(FluidTags.WATER) && this.isEquipped(Items.TURTLE_HELMET)) { + this.turtleHelmetTick(); + } + this.cooldowns.tick(); this.updatePlayerPose(); if (this.currentImpulseContextResetGraceTime > 0) { @@ -343,13 +351,36 @@ public abstract class Player extends LivingEntity { return this.wasUnderwater; } - private void turtleHelmetTick() { - ItemStack itemStack = this.getItemBySlot(EquipmentSlot.HEAD); - if (itemStack.is(Items.TURTLE_HELMET) && !this.isEyeInFluid(FluidTags.WATER)) { - this.addEffect(new MobEffectInstance(MobEffects.WATER_BREATHING, 200, 0, false, false, true)); + @Override + public void onAboveBubbleCol(boolean downwards) { + if (!this.getAbilities().flying) { + super.onAboveBubbleCol(downwards); } } + @Override + public void onInsideBubbleColumn(boolean downwards) { + if (!this.getAbilities().flying) { + super.onInsideBubbleColumn(downwards); + } + } + + private void turtleHelmetTick() { + this.addEffect(new MobEffectInstance(MobEffects.WATER_BREATHING, 200, 0, false, false, true)); + } + + private boolean isEquipped(Item item) { + for (EquipmentSlot equipmentSlot : EquipmentSlot.VALUES) { + ItemStack itemStack = this.getItemBySlot(equipmentSlot); + Equippable equippable = itemStack.get(DataComponents.EQUIPPABLE); + if (itemStack.is(item) && equippable != null && equippable.slot() == equipmentSlot) { + return true; + } + } + + return false; + } + protected ItemCooldowns createItemCooldowns() { return new ItemCooldowns(); } @@ -517,22 +548,13 @@ public abstract class Player extends LivingEntity { this.jumpTriggerTime--; } - if (this.level().getDifficulty() == Difficulty.PEACEFUL && this.level().getGameRules().getBoolean(GameRules.RULE_NATURAL_REGENERATION)) { - if (this.getHealth() < this.getMaxHealth() && this.tickCount % 20 == 0) { - this.heal(1.0F); - } - - if (this.foodData.getSaturationLevel() < 20.0F && this.tickCount % 20 == 0) { - this.foodData.setSaturation(this.foodData.getSaturationLevel() + 1.0F); - } - - if (this.foodData.needsFood() && this.tickCount % 10 == 0) { - this.foodData.setFoodLevel(this.foodData.getFoodLevel() + 1); - } - } - + this.tickRegeneration(); this.inventory.tick(); this.oBob = this.bob; + if (this.abilities.flying && !this.isPassenger()) { + this.resetFallDistance(); + } + super.aiStep(); this.setSpeed((float)this.getAttributeValue(Attributes.MOVEMENT_SPEED)); float f; @@ -574,6 +596,9 @@ public abstract class Player extends LivingEntity { } } + protected void tickRegeneration() { + } + private void playShoulderEntityAmbientSound(@Nullable CompoundTag entityCompound) { if (entityCompound != null && (!entityCompound.contains("Silent") || !entityCompound.getBoolean("Silent")) && this.level().random.nextInt(200) == 0) { String string = entityCompound.getString("id"); @@ -668,9 +693,9 @@ public abstract class Player extends LivingEntity { } @Override - protected void dropEquipment() { - super.dropEquipment(); - if (!this.level().getGameRules().getBoolean(GameRules.RULE_KEEPINVENTORY)) { + protected void dropEquipment(ServerLevel serverLevel) { + super.dropEquipment(serverLevel); + if (!serverLevel.getGameRules().getBoolean(GameRules.RULE_KEEPINVENTORY)) { this.destroyVanishingCursedItems(); this.inventory.dropAll(); } @@ -695,6 +720,9 @@ public abstract class Player extends LivingEntity { return SoundEvents.PLAYER_DEATH; } + public void handleCreativeModeItemDrop(ItemStack itemStack) { + } + /** * Drops an item into the world. */ @@ -708,39 +736,11 @@ public abstract class Player extends LivingEntity { */ @Nullable public ItemEntity drop(ItemStack droppedItem, boolean dropAround, boolean includeThrowerName) { - if (droppedItem.isEmpty()) { - return null; - } else { - if (this.level().isClientSide) { - this.swing(InteractionHand.MAIN_HAND); - } - - double d = this.getEyeY() - 0.3F; - ItemEntity itemEntity = new ItemEntity(this.level(), this.getX(), d, this.getZ(), droppedItem); - itemEntity.setPickUpDelay(40); - if (includeThrowerName) { - itemEntity.setThrower(this); - } - - if (dropAround) { - float f = this.random.nextFloat() * 0.5F; - float g = this.random.nextFloat() * (float) (Math.PI * 2); - itemEntity.setDeltaMovement(-Mth.sin(g) * f, 0.2F, Mth.cos(g) * f); - } else { - float f = 0.3F; - float g = Mth.sin(this.getXRot() * (float) (Math.PI / 180.0)); - float h = Mth.cos(this.getXRot() * (float) (Math.PI / 180.0)); - float i = Mth.sin(this.getYRot() * (float) (Math.PI / 180.0)); - float j = Mth.cos(this.getYRot() * (float) (Math.PI / 180.0)); - float k = this.random.nextFloat() * (float) (Math.PI * 2); - float l = 0.02F * this.random.nextFloat(); - itemEntity.setDeltaMovement( - -i * h * 0.3F + Math.cos(k) * l, -g * 0.3F + 0.1F + (this.random.nextFloat() - this.random.nextFloat()) * 0.1F, j * h * 0.3F + Math.sin(k) * l - ); - } - - return itemEntity; + if (!droppedItem.isEmpty() && this.level().isClientSide) { + this.swing(InteractionHand.MAIN_HAND); } + + return null; } public float getDestroySpeed(BlockState state) { @@ -754,12 +754,13 @@ public abstract class Player extends LivingEntity { } if (this.hasEffect(MobEffects.DIG_SLOWDOWN)) { - f *= switch (this.getEffect(MobEffects.DIG_SLOWDOWN).getAmplifier()) { + float g = switch (this.getEffect(MobEffects.DIG_SLOWDOWN).getAmplifier()) { case 0 -> 0.3F; case 1 -> 0.09F; case 2 -> 0.0027F; default -> 8.1E-4F; }; + f *= g; } f *= (float)this.getAttributeValue(Attributes.BLOCK_BREAK_SPEED); @@ -860,50 +861,47 @@ public abstract class Player extends LivingEntity { } @Override - public boolean isInvulnerableTo(DamageSource source) { - if (super.isInvulnerableTo(source)) { + public boolean isInvulnerableTo(ServerLevel serverLevel, DamageSource damageSource) { + if (super.isInvulnerableTo(serverLevel, damageSource)) { return true; - } else if (source.is(DamageTypeTags.IS_DROWNING)) { - return !this.level().getGameRules().getBoolean(GameRules.RULE_DROWNING_DAMAGE); - } else if (source.is(DamageTypeTags.IS_FALL)) { - return !this.level().getGameRules().getBoolean(GameRules.RULE_FALL_DAMAGE); - } else if (source.is(DamageTypeTags.IS_FIRE)) { - return !this.level().getGameRules().getBoolean(GameRules.RULE_FIRE_DAMAGE); + } else if (damageSource.is(DamageTypeTags.IS_DROWNING)) { + return !serverLevel.getGameRules().getBoolean(GameRules.RULE_DROWNING_DAMAGE); + } else if (damageSource.is(DamageTypeTags.IS_FALL)) { + return !serverLevel.getGameRules().getBoolean(GameRules.RULE_FALL_DAMAGE); + } else if (damageSource.is(DamageTypeTags.IS_FIRE)) { + return !serverLevel.getGameRules().getBoolean(GameRules.RULE_FIRE_DAMAGE); } else { - return source.is(DamageTypeTags.IS_FREEZING) ? !this.level().getGameRules().getBoolean(GameRules.RULE_FREEZE_DAMAGE) : false; + return damageSource.is(DamageTypeTags.IS_FREEZING) ? !serverLevel.getGameRules().getBoolean(GameRules.RULE_FREEZE_DAMAGE) : false; } } @Override - public boolean hurt(DamageSource source, float amount) { - if (this.isInvulnerableTo(source)) { + public boolean hurtServer(ServerLevel serverLevel, DamageSource damageSource, float f) { + if (this.isInvulnerableTo(serverLevel, damageSource)) { return false; - } else if (this.abilities.invulnerable && !source.is(DamageTypeTags.BYPASSES_INVULNERABILITY)) { + } else if (this.abilities.invulnerable && !damageSource.is(DamageTypeTags.BYPASSES_INVULNERABILITY)) { return false; } else { this.noActionTime = 0; if (this.isDeadOrDying()) { return false; } else { - if (!this.level().isClientSide) { - this.removeEntitiesOnShoulder(); - } - - if (source.scalesWithDifficulty()) { - if (this.level().getDifficulty() == Difficulty.PEACEFUL) { - amount = 0.0F; + this.removeEntitiesOnShoulder(); + if (damageSource.scalesWithDifficulty()) { + if (serverLevel.getDifficulty() == Difficulty.PEACEFUL) { + f = 0.0F; } - if (this.level().getDifficulty() == Difficulty.EASY) { - amount = Math.min(amount / 2.0F + 1.0F, amount); + if (serverLevel.getDifficulty() == Difficulty.EASY) { + f = Math.min(f / 2.0F + 1.0F, f); } - if (this.level().getDifficulty() == Difficulty.HARD) { - amount = amount * 3.0F / 2.0F; + if (serverLevel.getDifficulty() == Difficulty.HARD) { + f = f * 3.0F / 2.0F; } } - return amount == 0.0F ? false : super.hurt(source, amount); + return f == 0.0F ? false : super.hurtServer(serverLevel, damageSource, f); } } } @@ -911,8 +909,9 @@ public abstract class Player extends LivingEntity { @Override protected void blockUsingShield(LivingEntity attacker) { super.blockUsingShield(attacker); - if (attacker.canDisableShield()) { - this.disableShield(); + ItemStack itemStack = this.getItemBlockingWith(); + if (attacker.canDisableShield() && itemStack != null) { + this.disableShield(itemStack); } } @@ -967,23 +966,23 @@ public abstract class Player extends LivingEntity { } @Override - protected void actuallyHurt(DamageSource damageSource, float damageAmount) { - if (!this.isInvulnerableTo(damageSource)) { - damageAmount = this.getDamageAfterArmorAbsorb(damageSource, damageAmount); - damageAmount = this.getDamageAfterMagicAbsorb(damageSource, damageAmount); - float var7 = Math.max(damageAmount - this.getAbsorptionAmount(), 0.0F); - this.setAbsorptionAmount(this.getAbsorptionAmount() - (damageAmount - var7)); - float g = damageAmount - var7; - if (g > 0.0F && g < 3.4028235E37F) { - this.awardStat(Stats.DAMAGE_ABSORBED, Math.round(g * 10.0F)); + protected void actuallyHurt(ServerLevel serverLevel, DamageSource damageSource, float f) { + if (!this.isInvulnerableTo(serverLevel, damageSource)) { + f = this.getDamageAfterArmorAbsorb(damageSource, f); + f = this.getDamageAfterMagicAbsorb(damageSource, f); + float var8 = Math.max(f - this.getAbsorptionAmount(), 0.0F); + this.setAbsorptionAmount(this.getAbsorptionAmount() - (f - var8)); + float h = f - var8; + if (h > 0.0F && h < 3.4028235E37F) { + this.awardStat(Stats.DAMAGE_ABSORBED, Math.round(h * 10.0F)); } - if (var7 != 0.0F) { + if (var8 != 0.0F) { this.causeFoodExhaustion(damageSource.getFoodExhaustion()); - this.getCombatTracker().recordDamage(damageSource, var7); - this.setHealth(this.getHealth() - var7); - if (var7 < 3.4028235E37F) { - this.awardStat(Stats.DAMAGE_TAKEN, Math.round(var7 * 10.0F)); + this.getCombatTracker().recordDamage(damageSource, var8); + this.setHealth(this.getHealth() - var8); + if (var8 < 3.4028235E37F) { + this.awardStat(Stats.DAMAGE_TAKEN, Math.round(var8 * 10.0F)); } this.gameEvent(GameEvent.ENTITY_DAMAGE); @@ -1048,7 +1047,7 @@ public abstract class Player extends LivingEntity { InteractionResult interactionResult2 = itemStack.interactLivingEntity(this, (LivingEntity)entityToInteractOn, hand); if (interactionResult2.consumesAction()) { - this.level().gameEvent(GameEvent.ENTITY_INTERACT, entityToInteractOn.position(), GameEvent.Context.of(this)); + this.level().gameEvent(GameEvent.ENTITY_INTERACT, entityToInteractOn.position(), Context.of(this)); if (itemStack.isEmpty() && !this.abilities.instabuild) { this.setItemInHand(hand, ItemStack.EMPTY); } @@ -1145,7 +1144,7 @@ public abstract class Player extends LivingEntity { if (!target.skipAttackInteraction(this)) { float f = this.isAutoSpinAttack() ? this.autoSpinAttackDmg : (float)this.getAttributeValue(Attributes.ATTACK_DAMAGE); ItemStack itemStack = this.getWeaponItem(); - DamageSource damageSource = this.damageSources().playerAttack(this); + DamageSource damageSource = (DamageSource)Optional.ofNullable(itemStack.getItem().getDamageSource(this)).orElse(this.damageSources().playerAttack(this)); float g = this.getEnchantedDamage(target, f, damageSource) - f; float h = this.getAttackStrengthScale(0.5F); f *= 0.2F + h * h * 0.8F; @@ -1182,10 +1181,10 @@ public abstract class Player extends LivingEntity { float i = f + g; boolean bl4 = false; - double d = this.walkDist - this.walkDistO; - if (bl && !bl3 && !bl2 && this.onGround() && d < this.getSpeed()) { - ItemStack itemStack2 = this.getItemInHand(InteractionHand.MAIN_HAND); - if (itemStack2.getItem() instanceof SwordItem) { + if (bl && !bl3 && !bl2 && this.onGround()) { + double d = this.getKnownMovement().horizontalDistanceSqr(); + double e = this.getSpeed() * 2.5; + if (d < Mth.square(e) && this.getItemInHand(InteractionHand.MAIN_HAND).is(ItemTags.SWORDS)) { bl4 = true; } } @@ -1196,7 +1195,7 @@ public abstract class Player extends LivingEntity { } Vec3 vec3 = target.getDeltaMovement(); - boolean bl5 = target.hurt(damageSource, i); + boolean bl5 = target.hurtOrSimulate(damageSource, i); if (bl5) { float k = this.getKnockback(target, damageSource) + (bl2 ? 1.0F : 0.0F); if (k > 0.0F) { @@ -1312,8 +1311,8 @@ public abstract class Player extends LivingEntity { this.attack(target); } - public void disableShield() { - this.getCooldowns().addCooldown(Items.SHIELD, 100); + public void disableShield(ItemStack itemStack) { + this.getCooldowns().addCooldown(itemStack, 100); this.stopUsingItem(); this.level().broadcastEntityEvent(this, (byte)30); } @@ -1384,6 +1383,10 @@ public abstract class Player extends LivingEntity { return this.containerMenu != this.inventoryMenu; } + public boolean canDropItems() { + return true; + } + public Either startSleepInBed(BlockPos bedPos) { this.startSleeping(bedPos); this.sleepCounter = 0; @@ -1449,7 +1452,7 @@ public abstract class Player extends LivingEntity { public void triggerRecipeCrafted(RecipeHolder recipe, List items) { } - public void awardRecipesByKey(List recipes) { + public void awardRecipesByKey(List>> recipes) { } public int resetRecipes(Collection> recipes) { @@ -1457,39 +1460,32 @@ public abstract class Player extends LivingEntity { } @Override - public void jumpFromGround() { - super.jumpFromGround(); - this.awardStat(Stats.JUMP); - if (this.isSprinting()) { - this.causeFoodExhaustion(0.2F); + public void travel(Vec3 travelVector) { + if (this.isPassenger()) { + super.travel(travelVector); } else { - this.causeFoodExhaustion(0.05F); + if (this.isSwimming()) { + double d = this.getLookAngle().y; + double e = d < -0.2 ? 0.085 : 0.06; + if (d <= 0.0 || this.jumping || !this.level().getFluidState(BlockPos.containing(this.getX(), this.getY() + 1.0 - 0.1, this.getZ())).isEmpty()) { + Vec3 vec3 = this.getDeltaMovement(); + this.setDeltaMovement(vec3.add(0.0, (d - vec3.y) * e, 0.0)); + } + } + + if (this.getAbilities().flying) { + double d = this.getDeltaMovement().y; + super.travel(travelVector); + this.setDeltaMovement(this.getDeltaMovement().with(Direction.Axis.Y, d * 0.6)); + } else { + super.travel(travelVector); + } } } @Override - public void travel(Vec3 travelVector) { - if (this.isSwimming() && !this.isPassenger()) { - double d = this.getLookAngle().y; - double e = d < -0.2 ? 0.085 : 0.06; - if (d <= 0.0 - || this.jumping - || !this.level().getBlockState(BlockPos.containing(this.getX(), this.getY() + 1.0 - 0.1, this.getZ())).getFluidState().isEmpty()) { - Vec3 vec3 = this.getDeltaMovement(); - this.setDeltaMovement(vec3.add(0.0, (d - vec3.y) * e, 0.0)); - } - } - - if (this.abilities.flying && !this.isPassenger()) { - double d = this.getDeltaMovement().y; - super.travel(travelVector); - Vec3 vec32 = this.getDeltaMovement(); - this.setDeltaMovement(vec32.x, d * 0.6, vec32.z); - this.resetFallDistance(); - this.setSharedFlag(7, false); - } else { - super.travel(travelVector); - } + protected boolean canGlide() { + return !this.abilities.flying && super.canGlide(); } @Override @@ -1519,38 +1515,36 @@ public abstract class Player extends LivingEntity { this.awardStat(Stats.FALL_ONE_CM, (int)Math.round(fallDistance * 100.0)); } - boolean bl; - if (this.ignoreFallDamageFromCurrentImpulse && this.currentImpulseImpactPos != null) { - double d = this.currentImpulseImpactPos.y; - this.tryResetCurrentImpulseContext(); - if (d < this.getY()) { - return false; - } - - float f = Math.min(fallDistance, (float)(d - this.getY())); - bl = super.causeFallDamage(f, multiplier, source); - } else { - bl = super.causeFallDamage(fallDistance, multiplier, source); - } - + boolean bl = this.currentImpulseImpactPos != null && this.ignoreFallDamageFromCurrentImpulse; + float f; if (bl) { - this.resetCurrentImpulseContext(); + f = Math.min(fallDistance, (float)(this.currentImpulseImpactPos.y - this.getY())); + boolean bl2 = f <= 0.0F; + if (bl2) { + this.resetCurrentImpulseContext(); + } else { + this.tryResetCurrentImpulseContext(); + } + } else { + f = fallDistance; } - return bl; + if (f > 0.0F && super.causeFallDamage(f, multiplier, source)) { + this.resetCurrentImpulseContext(); + return true; + } else { + return false; + } } } public boolean tryToStartFallFlying() { - if (!this.onGround() && !this.isFallFlying() && !this.isInWater() && !this.hasEffect(MobEffects.LEVITATION)) { - ItemStack itemStack = this.getItemBySlot(EquipmentSlot.CHEST); - if (itemStack.is(Items.ELYTRA) && ElytraItem.isFlyEnabled(itemStack)) { - this.startFallFlying(); - return true; - } + if (!this.isFallFlying() && this.canGlide() && !this.isInWater()) { + this.startFallFlying(); + return true; + } else { + return false; } - - return false; } public void startFallFlying() { @@ -1651,7 +1645,7 @@ public abstract class Player extends LivingEntity { * Add experience levels to this player. */ public void giveExperienceLevels(int levels) { - this.experienceLevel += levels; + this.experienceLevel = IntMath.saturatedAdd(this.experienceLevel, levels); if (this.experienceLevel < 0) { this.experienceLevel = 0; this.experienceProgress = 0.0F; @@ -1734,13 +1728,8 @@ public abstract class Player extends LivingEntity { } @Override - protected int getBaseExperienceReward() { - if (!this.level().getGameRules().getBoolean(GameRules.RULE_KEEPINVENTORY) && !this.isSpectator()) { - int i = this.experienceLevel * 7; - return i > 100 ? 100 : i; - } else { - return 0; - } + protected int getBaseExperienceReward(ServerLevel serverLevel) { + return !serverLevel.getGameRules().getBoolean(GameRules.RULE_KEEPINVENTORY) && !this.isSpectator() ? Math.min(this.experienceLevel * 7, 100) : 0; } @Override @@ -1781,7 +1770,7 @@ public abstract class Player extends LivingEntity { if (slot == EquipmentSlot.MAINHAND) { return this.inventory.getSelected(); } else if (slot == EquipmentSlot.OFFHAND) { - return this.inventory.offhand.get(0); + return (ItemStack)this.inventory.offhand.getFirst(); } else { return slot.getType() == EquipmentSlot.Type.HUMANOID_ARMOR ? this.inventory.armor.get(slot.getIndex()) : ItemStack.EMPTY; } @@ -1850,7 +1839,7 @@ public abstract class Player extends LivingEntity { private void respawnEntityOnShoulder(CompoundTag entityCompound) { if (!this.level().isClientSide && !entityCompound.isEmpty()) { - EntityType.create(entityCompound, this.level()).ifPresent(entity -> { + EntityType.create(entityCompound, this.level(), EntitySpawnReason.LOAD).ifPresent(entity -> { if (entity instanceof TamableAnimal) { ((TamableAnimal)entity).setOwnerUUID(this.uuid); } @@ -2032,10 +2021,12 @@ public abstract class Player extends LivingEntity { return this.abilities.instabuild && this.getPermissionLevel() >= 2; } - @Override - public boolean canTakeItem(ItemStack stack) { - EquipmentSlot equipmentSlot = this.getEquipmentSlotForItem(stack); - return this.getItemBySlot(equipmentSlot).isEmpty(); + protected int getPermissionLevel() { + return 0; + } + + public boolean hasPermissions(int i) { + return this.getPermissionLevel() >= i; } @Override @@ -2072,30 +2063,6 @@ public abstract class Player extends LivingEntity { } } - @Override - public ItemStack eat(Level level, ItemStack food, FoodProperties foodProperties) { - this.getFoodData().eat(foodProperties); - this.awardStat(Stats.ITEM_USED.get(food.getItem())); - level.playSound(null, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_BURP, SoundSource.PLAYERS, 0.5F, level.random.nextFloat() * 0.1F + 0.9F); - if (this instanceof ServerPlayer) { - CriteriaTriggers.CONSUME_ITEM.trigger((ServerPlayer)this, food); - } - - ItemStack itemStack = super.eat(level, food, foodProperties); - Optional optional = foodProperties.usingConvertsTo(); - if (optional.isPresent() && !this.hasInfiniteMaterials()) { - if (itemStack.isEmpty()) { - return ((ItemStack)optional.get()).copy(); - } - - if (!this.level().isClientSide()) { - this.getInventory().add(((ItemStack)optional.get()).copy()); - } - } - - return itemStack; - } - @Override public Vec3 getRopeHoldPosition(float partialTicks) { double d = 0.22 * (this.getMainArm() == HumanoidArm.RIGHT ? -1.0 : 1.0); @@ -2220,6 +2187,15 @@ public abstract class Player extends LivingEntity { this.ignoreFallDamageFromCurrentImpulse = false; } + public boolean shouldRotateWithMinecart() { + return false; + } + + @Override + public boolean isControlledByClient() { + return true; + } + public static enum BedSleepingProblem { NOT_POSSIBLE_HERE, NOT_POSSIBLE_NOW(Component.translatable("block.minecraft.bed.no_sleep")), diff --git a/net/minecraft/world/entity/player/ProfilePublicKey.java b/net/minecraft/world/entity/player/ProfilePublicKey.java index 6ce83990..b71ffdb7 100644 --- a/net/minecraft/world/entity/player/ProfilePublicKey.java +++ b/net/minecraft/world/entity/player/ProfilePublicKey.java @@ -18,7 +18,7 @@ import net.minecraft.util.SignatureValidator; public record ProfilePublicKey(ProfilePublicKey.Data data) { public static final Component EXPIRED_PROFILE_PUBLIC_KEY = Component.translatable("multiplayer.disconnect.expired_public_key"); - private static final Component INVALID_SIGNATURE = Component.translatable("multiplayer.disconnect.invalid_public_key_signature.new"); + private static final Component INVALID_SIGNATURE = Component.translatable("multiplayer.disconnect.invalid_public_key_signature"); public static final Duration EXPIRY_GRACE_PERIOD = Duration.ofHours(8L); public static final Codec TRUSTED_CODEC = ProfilePublicKey.Data.CODEC.xmap(ProfilePublicKey::new, ProfilePublicKey::data); diff --git a/net/minecraft/world/entity/player/StackedContents.java b/net/minecraft/world/entity/player/StackedContents.java index b3377956..b6da1b1a 100644 --- a/net/minecraft/world/entity/player/StackedContents.java +++ b/net/minecraft/world/entity/player/StackedContents.java @@ -1,231 +1,262 @@ package net.minecraft.world.entity.player; -import com.google.common.collect.Lists; -import it.unimi.dsi.fastutil.ints.Int2IntMap; -import it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap; -import it.unimi.dsi.fastutil.ints.IntAVLTreeSet; import it.unimi.dsi.fastutil.ints.IntArrayList; -import it.unimi.dsi.fastutil.ints.IntCollection; -import it.unimi.dsi.fastutil.ints.IntIterator; import it.unimi.dsi.fastutil.ints.IntList; +import it.unimi.dsi.fastutil.objects.Reference2IntOpenHashMap; +import it.unimi.dsi.fastutil.objects.ReferenceOpenHashSet; import java.util.BitSet; import java.util.List; -import net.minecraft.core.component.DataComponents; -import net.minecraft.core.registries.BuiltInRegistries; -import net.minecraft.world.item.Item; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.crafting.Ingredient; -import net.minecraft.world.item.crafting.Recipe; -import net.minecraft.world.item.crafting.RecipeHolder; +import java.util.Set; import org.jetbrains.annotations.Nullable; -public class StackedContents { - private static final int EMPTY = 0; - public final Int2IntMap contents = new Int2IntOpenHashMap(); +public class StackedContents { + public final Reference2IntOpenHashMap amounts = new Reference2IntOpenHashMap<>(); - public void accountSimpleStack(ItemStack stack) { - if (!stack.isDamaged() && !stack.isEnchanted() && !stack.has(DataComponents.CUSTOM_NAME)) { - this.accountStack(stack); + boolean hasAnyAmount(T object) { + return this.amounts.getInt(object) > 0; + } + + boolean hasAtLeast(T object, int i) { + return this.amounts.getInt(object) >= i; + } + + void take(T object, int i) { + int j = this.amounts.addTo(object, -i); + if (j < i) { + throw new IllegalStateException("Took " + i + " items, but only had " + j); } } - public void accountStack(ItemStack stack) { - this.accountStack(stack, stack.getMaxStackSize()); + void put(T object, int i) { + this.amounts.addTo(object, i); } - public void accountStack(ItemStack stack, int amount) { - if (!stack.isEmpty()) { - int i = getStackingIndex(stack); - int j = Math.min(amount, stack.getCount()); - this.put(i, j); - } + public boolean tryPick(List> list, int i, @Nullable StackedContents.Output output) { + return new StackedContents.RecipePicker(list).tryPick(i, output); } - public static int getStackingIndex(ItemStack stack) { - return BuiltInRegistries.ITEM.getId(stack.getItem()); - } - - boolean has(int stackingIndex) { - return this.contents.get(stackingIndex) > 0; - } - - int take(int stackingIndex, int amount) { - int i = this.contents.get(stackingIndex); - if (i >= amount) { - this.contents.put(stackingIndex, i - amount); - return stackingIndex; - } else { - return 0; - } - } - - void put(int stackingIndex, int increment) { - this.contents.put(stackingIndex, this.contents.get(stackingIndex) + increment); - } - - public boolean canCraft(Recipe recipe, @Nullable IntList stackingIndexList) { - return this.canCraft(recipe, stackingIndexList, 1); - } - - public boolean canCraft(Recipe recipe, @Nullable IntList stackingIndexList, int amount) { - return new StackedContents.RecipePicker(recipe).tryPick(amount, stackingIndexList); - } - - public int getBiggestCraftableStack(RecipeHolder recipe, @Nullable IntList stackingIndexList) { - return this.getBiggestCraftableStack(recipe, Integer.MAX_VALUE, stackingIndexList); - } - - public int getBiggestCraftableStack(RecipeHolder recipe, int amount, @Nullable IntList stackingIndexList) { - return new StackedContents.RecipePicker(recipe.value()).tryPickAll(amount, stackingIndexList); - } - - public static ItemStack fromStackingIndex(int stackingIndex) { - return stackingIndex == 0 ? ItemStack.EMPTY : new ItemStack(Item.byId(stackingIndex)); + public int tryPickAll(List> list, int i, @Nullable StackedContents.Output output) { + return new StackedContents.RecipePicker(list).tryPickAll(i, output); } public void clear() { - this.contents.clear(); + this.amounts.clear(); + } + + public void account(T object, int i) { + this.put(object, i); + } + + public record IngredientInfo(List allowedItems) { + public IngredientInfo(List allowedItems) { + if (allowedItems.isEmpty()) { + throw new IllegalArgumentException("Ingredients can't be empty"); + } else { + this.allowedItems = allowedItems; + } + } + } + + @FunctionalInterface + public interface Output { + void accept(T object); } class RecipePicker { - private final Recipe recipe; - private final List ingredients = Lists.newArrayList(); + private final List> ingredients; private final int ingredientCount; - private final int[] items; + private final List items; private final int itemCount; private final BitSet data; private final IntList path = new IntArrayList(); - public RecipePicker(final Recipe recipe) { - this.recipe = recipe; - this.ingredients.addAll(recipe.getIngredients()); - this.ingredients.removeIf(Ingredient::isEmpty); + public RecipePicker(final List> list) { + this.ingredients = list; this.ingredientCount = this.ingredients.size(); this.items = this.getUniqueAvailableIngredientItems(); - this.itemCount = this.items.length; - this.data = new BitSet(this.ingredientCount + this.itemCount + this.ingredientCount + this.ingredientCount * this.itemCount); + this.itemCount = this.items.size(); + this.data = new BitSet(this.visitedIngredientCount() + this.visitedItemCount() + this.satisfiedCount() + this.connectionCount() + this.residualCount()); + this.setInitialConnections(); + } - for (int i = 0; i < this.ingredients.size(); i++) { - IntList intList = ((Ingredient)this.ingredients.get(i)).getStackingIds(); + private void setInitialConnections() { + for (int i = 0; i < this.ingredientCount; i++) { + List list = ((StackedContents.IngredientInfo)this.ingredients.get(i)).allowedItems(); for (int j = 0; j < this.itemCount; j++) { - if (intList.contains(this.items[j])) { - this.data.set(this.getIndex(true, j, i)); + if (list.contains(this.items.get(j))) { + this.setConnection(j, i); } } } } - public boolean tryPick(int amount, @Nullable IntList stackingIndexList) { - if (amount <= 0) { + public boolean tryPick(int i, @Nullable StackedContents.Output output) { + if (i <= 0) { return true; } else { - int i; - for (i = 0; this.dfs(amount); i++) { - StackedContents.this.take(this.items[this.path.getInt(0)], amount); - int j = this.path.size() - 1; - this.setSatisfied(this.path.getInt(j)); + int j = 0; - for (int k = 0; k < j; k++) { - this.toggleResidual((k & 1) == 0, this.path.get(k), this.path.get(k + 1)); - } + while (true) { + IntList intList = this.tryAssigningNewItem(i); + if (intList == null) { + boolean bl = j == this.ingredientCount; + boolean bl2 = bl && output != null; + this.clearAllVisited(); + this.clearSatisfied(); - this.path.clear(); - this.data.clear(0, this.ingredientCount + this.itemCount); - } - - boolean bl = i == this.ingredientCount; - boolean bl2 = bl && stackingIndexList != null; - if (bl2) { - stackingIndexList.clear(); - } - - this.data.clear(0, this.ingredientCount + this.itemCount + this.ingredientCount); - int l = 0; - - for (Ingredient ingredient : this.recipe.getIngredients()) { - if (bl2 && ingredient.isEmpty()) { - stackingIndexList.add(0); - } else { - for (int m = 0; m < this.itemCount; m++) { - if (this.hasResidual(false, l, m)) { - this.toggleResidual(true, m, l); - StackedContents.this.put(this.items[m], amount); - if (bl2) { - stackingIndexList.add(this.items[m]); + for (int l = 0; l < this.ingredientCount; l++) { + for (int m = 0; m < this.itemCount; m++) { + if (this.isAssigned(m, l)) { + this.unassign(m, l); + StackedContents.this.put((T)this.items.get(m), i); + if (bl2) { + output.accept((T)this.items.get(m)); + } + break; } } } - l++; + assert this.data.get(this.residualOffset(), this.residualOffset() + this.residualCount()).isEmpty(); + + return bl; + } + + int k = intList.getInt(0); + StackedContents.this.take((T)this.items.get(k), i); + int l = intList.size() - 1; + this.setSatisfied(intList.getInt(l)); + j++; + + for (int mx = 0; mx < intList.size() - 1; mx++) { + if (isPathIndexItem(mx)) { + int n = intList.getInt(mx); + int o = intList.getInt(mx + 1); + this.assign(n, o); + } else { + int n = intList.getInt(mx + 1); + int o = intList.getInt(mx); + this.unassign(n, o); + } } } - - return bl; } } - private int[] getUniqueAvailableIngredientItems() { - IntCollection intCollection = new IntAVLTreeSet(); - - for (Ingredient ingredient : this.ingredients) { - intCollection.addAll(ingredient.getStackingIds()); - } - - IntIterator intIterator = intCollection.iterator(); - - while (intIterator.hasNext()) { - if (!StackedContents.this.has(intIterator.nextInt())) { - intIterator.remove(); - } - } - - return intCollection.toIntArray(); + private static boolean isPathIndexItem(int i) { + return (i & 1) == 0; } - private boolean dfs(int amount) { - int i = this.itemCount; + private List getUniqueAvailableIngredientItems() { + Set set = new ReferenceOpenHashSet<>(); - for (int j = 0; j < i; j++) { - if (StackedContents.this.contents.get(this.items[j]) >= amount) { - this.visit(false, j); + for (StackedContents.IngredientInfo ingredientInfo : this.ingredients) { + set.addAll(ingredientInfo.allowedItems()); + } - while (!this.path.isEmpty()) { - int k = this.path.size(); - boolean bl = (k & 1) == 1; - int l = this.path.getInt(k - 1); - if (!bl && !this.isSatisfied(l)) { - break; - } + set.removeIf(object -> !StackedContents.this.hasAnyAmount((T)object)); + return List.copyOf(set); + } - int m = bl ? this.ingredientCount : i; - int n = 0; + @Nullable + private IntList tryAssigningNewItem(int i) { + this.clearAllVisited(); - while (true) { - if (n < m) { - if (this.hasVisited(bl, n) || !this.hasConnection(bl, l, n) || !this.hasResidual(bl, l, n)) { - n++; - continue; - } - - this.visit(bl, n); - } - - n = this.path.size(); - if (n == k) { - this.path.removeInt(n - 1); - } - break; - } - } - - if (!this.path.isEmpty()) { - return true; + for (int j = 0; j < this.itemCount; j++) { + if (StackedContents.this.hasAtLeast((T)this.items.get(j), i)) { + IntList intList = this.findNewItemAssignmentPath(j); + if (intList != null) { + return intList; } } } - return false; + return null; + } + + @Nullable + private IntList findNewItemAssignmentPath(int i) { + this.path.clear(); + this.visitItem(i); + this.path.add(i); + + while (!this.path.isEmpty()) { + int j = this.path.size(); + if (isPathIndexItem(j - 1)) { + int k = this.path.getInt(j - 1); + + for (int l = 0; l < this.ingredientCount; l++) { + if (!this.hasVisitedIngredient(l) && this.hasConnection(k, l) && !this.isAssigned(k, l)) { + this.visitIngredient(l); + this.path.add(l); + break; + } + } + } else { + int k = this.path.getInt(j - 1); + if (!this.isSatisfied(k)) { + return this.path; + } + + for (int lx = 0; lx < this.itemCount; lx++) { + if (!this.hasVisitedItem(lx) && this.isAssigned(lx, k)) { + assert this.hasConnection(lx, k); + + this.visitItem(lx); + this.path.add(lx); + break; + } + } + } + + int k = this.path.size(); + if (k == j) { + this.path.removeInt(k - 1); + } + } + + return null; + } + + private int visitedIngredientOffset() { + return 0; + } + + private int visitedIngredientCount() { + return this.ingredientCount; + } + + private int visitedItemOffset() { + return this.visitedIngredientOffset() + this.visitedIngredientCount(); + } + + private int visitedItemCount() { + return this.itemCount; + } + + private int satisfiedOffset() { + return this.visitedItemOffset() + this.visitedItemCount(); + } + + private int satisfiedCount() { + return this.ingredientCount; + } + + private int connectionOffset() { + return this.satisfiedOffset() + this.satisfiedCount(); + } + + private int connectionCount() { + return this.ingredientCount * this.itemCount; + } + + private int residualOffset() { + return this.connectionOffset() + this.connectionCount(); + } + + private int residualCount() { + return this.ingredientCount * this.itemCount; } private boolean isSatisfied(int stackingIndex) { @@ -237,57 +268,114 @@ public class StackedContents { } private int getSatisfiedIndex(int stackingIndex) { - return this.ingredientCount + this.itemCount + stackingIndex; + assert stackingIndex >= 0 && stackingIndex < this.ingredientCount; + + return this.satisfiedOffset() + stackingIndex; } - private boolean hasConnection(boolean isIngredientPath, int stackingIndex, int pathIndex) { - return this.data.get(this.getIndex(isIngredientPath, stackingIndex, pathIndex)); + private void clearSatisfied() { + this.clearRange(this.satisfiedOffset(), this.satisfiedCount()); } - private boolean hasResidual(boolean isIngredientPath, int stackingIndex, int pathIndex) { - return isIngredientPath != this.data.get(1 + this.getIndex(isIngredientPath, stackingIndex, pathIndex)); + private void setConnection(int i, int j) { + this.data.set(this.getConnectionIndex(i, j)); } - private void toggleResidual(boolean isIngredientPath, int stackingIndex, int pathIndex) { - this.data.flip(1 + this.getIndex(isIngredientPath, stackingIndex, pathIndex)); + private boolean hasConnection(int i, int j) { + return this.data.get(this.getConnectionIndex(i, j)); } - private int getIndex(boolean isIngredientPath, int stackingIndex, int pathIndex) { - int i = isIngredientPath ? stackingIndex * this.ingredientCount + pathIndex : pathIndex * this.ingredientCount + stackingIndex; - return this.ingredientCount + this.itemCount + this.ingredientCount + 2 * i; + private int getConnectionIndex(int i, int j) { + assert i >= 0 && i < this.itemCount; + + assert j >= 0 && j < this.ingredientCount; + + return this.connectionOffset() + i * this.ingredientCount + j; } - private void visit(boolean isIngredientPath, int pathIndex) { - this.data.set(this.getVisitedIndex(isIngredientPath, pathIndex)); - this.path.add(pathIndex); + private boolean isAssigned(int i, int j) { + return this.data.get(this.getResidualIndex(i, j)); } - private boolean hasVisited(boolean isIngredientPath, int pathIndex) { - return this.data.get(this.getVisitedIndex(isIngredientPath, pathIndex)); + private void assign(int i, int j) { + int k = this.getResidualIndex(i, j); + + assert !this.data.get(k); + + this.data.set(k); } - private int getVisitedIndex(boolean isIngredientPath, int pathIndex) { - return (isIngredientPath ? 0 : this.ingredientCount) + pathIndex; + private void unassign(int i, int j) { + int k = this.getResidualIndex(i, j); + + assert this.data.get(k); + + this.data.clear(k); } - public int tryPickAll(int amount, @Nullable IntList stackingIndexList) { - int i = 0; - int j = Math.min(amount, this.getMinIngredientCount()) + 1; + private int getResidualIndex(int i, int j) { + assert i >= 0 && i < this.itemCount; + + assert j >= 0 && j < this.ingredientCount; + + return this.residualOffset() + i * this.ingredientCount + j; + } + + private void visitIngredient(int i) { + this.data.set(this.getVisitedIngredientIndex(i)); + } + + private boolean hasVisitedIngredient(int i) { + return this.data.get(this.getVisitedIngredientIndex(i)); + } + + private int getVisitedIngredientIndex(int i) { + assert i >= 0 && i < this.ingredientCount; + + return this.visitedIngredientOffset() + i; + } + + private void visitItem(int i) { + this.data.set(this.getVisitiedItemIndex(i)); + } + + private boolean hasVisitedItem(int i) { + return this.data.get(this.getVisitiedItemIndex(i)); + } + + private int getVisitiedItemIndex(int i) { + assert i >= 0 && i < this.itemCount; + + return this.visitedItemOffset() + i; + } + + private void clearAllVisited() { + this.clearRange(this.visitedIngredientOffset(), this.visitedIngredientCount()); + this.clearRange(this.visitedItemOffset(), this.visitedItemCount()); + } + + private void clearRange(int i, int j) { + this.data.clear(i, i + j); + } + + public int tryPickAll(int i, @Nullable StackedContents.Output output) { + int j = 0; + int k = Math.min(i, this.getMinIngredientCount()) + 1; while (true) { - int k = (i + j) / 2; - if (this.tryPick(k, null)) { - if (j - i <= 1) { - if (k > 0) { - this.tryPick(k, stackingIndexList); + int l = (j + k) / 2; + if (this.tryPick(l, null)) { + if (k - j <= 1) { + if (l > 0) { + this.tryPick(l, output); } - return k; + return l; } - i = k; + j = l; } else { - j = k; + k = l; } } } @@ -295,11 +383,11 @@ public class StackedContents { private int getMinIngredientCount() { int i = Integer.MAX_VALUE; - for (Ingredient ingredient : this.ingredients) { + for (StackedContents.IngredientInfo ingredientInfo : this.ingredients) { int j = 0; - for (int k : ingredient.getStackingIds()) { - j = Math.max(j, StackedContents.this.contents.get(k)); + for (T object : ingredientInfo.allowedItems()) { + j = Math.max(j, StackedContents.this.amounts.getInt(object)); } if (i > 0) { diff --git a/net/minecraft/world/entity/player/StackedItemContents.java b/net/minecraft/world/entity/player/StackedItemContents.java new file mode 100644 index 00000000..f95c3cbf --- /dev/null +++ b/net/minecraft/world/entity/player/StackedItemContents.java @@ -0,0 +1,67 @@ +package net.minecraft.world.entity.player; + +import java.util.Comparator; +import java.util.List; +import java.util.stream.Stream; +import net.minecraft.core.Holder; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.PlacementInfo; +import net.minecraft.world.item.crafting.Recipe; +import org.jetbrains.annotations.Nullable; + +public class StackedItemContents { + private final StackedContents> raw = new StackedContents<>(); + + public void accountSimpleStack(ItemStack itemStack) { + if (Inventory.isUsableForCrafting(itemStack)) { + this.accountStack(itemStack); + } + } + + public void accountStack(ItemStack itemStack) { + this.accountStack(itemStack, itemStack.getMaxStackSize()); + } + + public void accountStack(ItemStack itemStack, int i) { + if (!itemStack.isEmpty()) { + int j = Math.min(i, itemStack.getCount()); + this.raw.account(itemStack.getItemHolder(), j); + } + } + + public static StackedContents.IngredientInfo> convertIngredientContents(Stream> stream) { + List> list = stream.sorted(Comparator.comparingInt(holder -> BuiltInRegistries.ITEM.getId((Item)holder.value()))).toList(); + return new StackedContents.IngredientInfo<>(list); + } + + public boolean canCraft(Recipe recipe, @Nullable StackedContents.Output> output) { + return this.canCraft(recipe, 1, output); + } + + public boolean canCraft(Recipe recipe, int i, @Nullable StackedContents.Output> output) { + PlacementInfo placementInfo = recipe.placementInfo(); + return placementInfo.isImpossibleToPlace() ? false : this.canCraft(placementInfo.unpackedIngredients(), i, output); + } + + public boolean canCraft(List>> list, @Nullable StackedContents.Output> output) { + return this.canCraft(list, 1, output); + } + + private boolean canCraft(List>> list, int i, @Nullable StackedContents.Output> output) { + return this.raw.tryPick(list, i, output); + } + + public int getBiggestCraftableStack(Recipe recipe, @Nullable StackedContents.Output> output) { + return this.getBiggestCraftableStack(recipe, Integer.MAX_VALUE, output); + } + + public int getBiggestCraftableStack(Recipe recipe, int i, @Nullable StackedContents.Output> output) { + return this.raw.tryPickAll(recipe.placementInfo().unpackedIngredients(), i, output); + } + + public void clear() { + this.raw.clear(); + } +} diff --git a/net/minecraft/world/entity/projectile/AbstractArrow.java b/net/minecraft/world/entity/projectile/AbstractArrow.java index 9905fc43..395531bc 100644 --- a/net/minecraft/world/entity/projectile/AbstractArrow.java +++ b/net/minecraft/world/entity/projectile/AbstractArrow.java @@ -2,8 +2,8 @@ package net.minecraft.world.entity.projectile; import com.google.common.collect.Lists; import it.unimi.dsi.fastutil.ints.IntOpenHashSet; -import java.util.Arrays; import java.util.List; +import java.util.Objects; import net.minecraft.advancements.CriteriaTriggers; import net.minecraft.core.BlockPos; import net.minecraft.core.component.DataComponents; @@ -16,6 +16,7 @@ import net.minecraft.network.protocol.game.ClientboundGameEventPacket; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.network.syncher.SynchedEntityData.Builder; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; @@ -33,11 +34,13 @@ import net.minecraft.world.entity.OminousItemSpawner; import net.minecraft.world.entity.SlotAccess; import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.Items; import net.minecraft.world.item.enchantment.EnchantmentHelper; import net.minecraft.world.level.ClipContext; import net.minecraft.world.level.Level; +import net.minecraft.world.level.ClipContext.Block; +import net.minecraft.world.level.ClipContext.Fluid; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.AABB; @@ -45,18 +48,20 @@ import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.EntityHitResult; import net.minecraft.world.phys.HitResult; import net.minecraft.world.phys.Vec3; +import net.minecraft.world.phys.HitResult.Type; import net.minecraft.world.phys.shapes.VoxelShape; import org.jetbrains.annotations.Nullable; public abstract class AbstractArrow extends Projectile { private static final double ARROW_BASE_DAMAGE = 2.0; + public static final int SHAKE_TIME = 7; private static final EntityDataAccessor ID_FLAGS = SynchedEntityData.defineId(AbstractArrow.class, EntityDataSerializers.BYTE); private static final EntityDataAccessor PIERCE_LEVEL = SynchedEntityData.defineId(AbstractArrow.class, EntityDataSerializers.BYTE); + private static final EntityDataAccessor IN_GROUND = SynchedEntityData.defineId(AbstractArrow.class, EntityDataSerializers.BOOLEAN); private static final int FLAG_CRIT = 1; private static final int FLAG_NOPHYSICS = 2; @Nullable private BlockState lastState; - protected boolean inGround; protected int inGroundTime; public AbstractArrow.Pickup pickup = AbstractArrow.Pickup.DISALLOWED; public int shakeTime; @@ -97,8 +102,6 @@ public abstract class AbstractArrow extends Projectile { if (i > 0) { this.setPierceLevel((byte)i); } - - EnchantmentHelper.onProjectileSpawned(serverLevel, firedFromWeapon, this, item -> this.firedFromWeapon = null); } } @@ -125,9 +128,10 @@ public abstract class AbstractArrow extends Projectile { } @Override - protected void defineSynchedData(SynchedEntityData.Builder builder) { + protected void defineSynchedData(Builder builder) { builder.define(ID_FLAGS, (byte)0); builder.define(PIERCE_LEVEL, (byte)0); + builder.define(IN_GROUND, false); } @Override @@ -144,33 +148,35 @@ public abstract class AbstractArrow extends Projectile { @Override public void lerpMotion(double x, double y, double z) { - super.lerpMotion(x, y, z); + this.setDeltaMovement(x, y, z); this.life = 0; + if (this.isInGround() && Mth.lengthSquared(x, y, z) > 0.0) { + this.setInGround(false); + } + } + + @Override + public void onSyncedDataUpdated(EntityDataAccessor dataAccessor) { + super.onSyncedDataUpdated(dataAccessor); + if (!this.firstTick && this.shakeTime <= 0 && dataAccessor.equals(IN_GROUND) && this.isInGround()) { + this.shakeTime = 7; + } } @Override public void tick() { - super.tick(); - boolean bl = this.isNoPhysics(); + boolean bl = !this.isNoPhysics(); Vec3 vec3 = this.getDeltaMovement(); - if (this.xRotO == 0.0F && this.yRotO == 0.0F) { - double d = vec3.horizontalDistance(); - this.setYRot((float)(Mth.atan2(vec3.x, vec3.z) * 180.0F / (float)Math.PI)); - this.setXRot((float)(Mth.atan2(vec3.y, d) * 180.0F / (float)Math.PI)); - this.yRotO = this.getYRot(); - this.xRotO = this.getXRot(); - } - BlockPos blockPos = this.blockPosition(); BlockState blockState = this.level().getBlockState(blockPos); - if (!blockState.isAir() && !bl) { + if (!blockState.isAir() && bl) { VoxelShape voxelShape = blockState.getCollisionShape(this.level(), blockPos); if (!voxelShape.isEmpty()) { Vec3 vec32 = this.position(); for (AABB aABB : voxelShape.toAabbs()) { if (aABB.move(blockPos).contains(vec32)) { - this.inGround = true; + this.setInGround(true); break; } } @@ -185,93 +191,104 @@ public abstract class AbstractArrow extends Projectile { this.clearFire(); } - if (this.inGround && !bl) { - if (this.lastState != blockState && this.shouldFall()) { - this.startFalling(); - } else if (!this.level().isClientSide) { - this.tickDespawn(); + if (this.isInGround() && bl) { + if (!this.level().isClientSide()) { + if (this.lastState != blockState && this.shouldFall()) { + this.startFalling(); + } else { + this.tickDespawn(); + } } this.inGroundTime++; + if (this.isAlive()) { + this.applyEffectsFromBlocks(); + } } else { this.inGroundTime = 0; Vec3 vec33 = this.position(); - Vec3 vec32 = vec33.add(vec3); - HitResult hitResult = this.level().clip(new ClipContext(vec33, vec32, ClipContext.Block.COLLIDER, ClipContext.Fluid.NONE, this)); - if (hitResult.getType() != HitResult.Type.MISS) { - vec32 = hitResult.getLocation(); + if (this.isInWater()) { + this.addBubbleParticles(vec33); } - while (!this.isRemoved()) { - EntityHitResult entityHitResult = this.findHitEntity(vec33, vec32); - if (entityHitResult != null) { - hitResult = entityHitResult; - } - - if (hitResult != null && hitResult.getType() == HitResult.Type.ENTITY) { - Entity entity = ((EntityHitResult)hitResult).getEntity(); - Entity entity2 = this.getOwner(); - if (entity instanceof Player && entity2 instanceof Player && !((Player)entity2).canHarmPlayer((Player)entity)) { - hitResult = null; - entityHitResult = null; - } - } - - if (hitResult != null && !bl) { - ProjectileDeflection projectileDeflection = this.hitTargetOrDeflectSelf(hitResult); - this.hasImpulse = true; - if (projectileDeflection != ProjectileDeflection.NONE) { - break; - } - } - - if (entityHitResult == null || this.getPierceLevel() <= 0) { - break; - } - - hitResult = null; - } - - vec3 = this.getDeltaMovement(); - double e = vec3.x; - double f = vec3.y; - double g = vec3.z; if (this.isCritArrow()) { for (int i = 0; i < 4; i++) { - this.level().addParticle(ParticleTypes.CRIT, this.getX() + e * i / 4.0, this.getY() + f * i / 4.0, this.getZ() + g * i / 4.0, -e, -f + 0.2, -g); + this.level() + .addParticle(ParticleTypes.CRIT, vec33.x + vec3.x * i / 4.0, vec33.y + vec3.y * i / 4.0, vec33.z + vec3.z * i / 4.0, -vec3.x, -vec3.y + 0.2, -vec3.z); } } - double h = this.getX() + e; - double j = this.getY() + f; - double k = this.getZ() + g; - double l = vec3.horizontalDistance(); - if (bl) { - this.setYRot((float)(Mth.atan2(-e, -g) * 180.0F / (float)Math.PI)); - } else { - this.setYRot((float)(Mth.atan2(e, g) * 180.0F / (float)Math.PI)); - } - - this.setXRot((float)(Mth.atan2(f, l) * 180.0F / (float)Math.PI)); - this.setXRot(lerpRotation(this.xRotO, this.getXRot())); - this.setYRot(lerpRotation(this.yRotO, this.getYRot())); - float m = 0.99F; - if (this.isInWater()) { - for (int n = 0; n < 4; n++) { - float o = 0.25F; - this.level().addParticle(ParticleTypes.BUBBLE, h - e * 0.25, j - f * 0.25, k - g * 0.25, e, f, g); - } - - m = this.getWaterInertia(); - } - - this.setDeltaMovement(vec3.scale(m)); + float f; if (!bl) { + f = (float)(Mth.atan2(-vec3.x, -vec3.z) * 180.0F / (float)Math.PI); + } else { + f = (float)(Mth.atan2(vec3.x, vec3.z) * 180.0F / (float)Math.PI); + } + + float g = (float)(Mth.atan2(vec3.y, vec3.horizontalDistance()) * 180.0F / (float)Math.PI); + this.setXRot(lerpRotation(this.getXRot(), g)); + this.setYRot(lerpRotation(this.getYRot(), f)); + if (bl) { + BlockHitResult blockHitResult = this.level().clipIncludingBorder(new ClipContext(vec33, vec33.add(vec3), Block.COLLIDER, Fluid.NONE, this)); + this.stepMoveAndHit(blockHitResult); + } else { + this.setPos(vec33.add(vec3)); + this.applyEffectsFromBlocks(); + } + + this.applyInertia(); + if (bl && !this.isInGround()) { this.applyGravity(); } - this.setPos(h, j, k); - this.checkInsideBlocks(); + super.tick(); + } + } + + private void stepMoveAndHit(BlockHitResult blockHitResult) { + while (this.isAlive()) { + Vec3 vec3 = this.position(); + EntityHitResult entityHitResult = this.findHitEntity(vec3, blockHitResult.getLocation()); + Vec3 vec32 = ((HitResult)Objects.requireNonNullElse(entityHitResult, blockHitResult)).getLocation(); + this.setPos(vec32); + this.applyEffectsFromBlocks(vec3, vec32); + if (this.portalProcess != null && this.portalProcess.isInsidePortalThisTick()) { + this.handlePortal(); + } + + if (entityHitResult == null) { + if (this.isAlive() && blockHitResult.getType() != Type.MISS) { + this.hitTargetOrDeflectSelf(blockHitResult); + this.hasImpulse = true; + } + break; + } else if (this.isAlive() && !this.noPhysics) { + ProjectileDeflection projectileDeflection = this.hitTargetOrDeflectSelf(entityHitResult); + this.hasImpulse = true; + if (this.getPierceLevel() > 0 && projectileDeflection == ProjectileDeflection.NONE) { + continue; + } + break; + } + } + } + + private void applyInertia() { + Vec3 vec3 = this.getDeltaMovement(); + float f = 0.99F; + if (this.isInWater()) { + f = this.getWaterInertia(); + } + + this.setDeltaMovement(vec3.scale(f)); + } + + private void addBubbleParticles(Vec3 vec3) { + Vec3 vec32 = this.getDeltaMovement(); + + for (int i = 0; i < 4; i++) { + float f = 0.25F; + this.level().addParticle(ParticleTypes.BUBBLE, vec3.x - vec32.x * 0.25, vec3.y - vec32.y * 0.25, vec3.z - vec32.z * 0.25, vec32.x, vec32.y, vec32.z); } } @@ -281,16 +298,24 @@ public abstract class AbstractArrow extends Projectile { } private boolean shouldFall() { - return this.inGround && this.level().noCollision(new AABB(this.position(), this.position()).inflate(0.06)); + return this.isInGround() && this.level().noCollision(new AABB(this.position(), this.position()).inflate(0.06)); } private void startFalling() { - this.inGround = false; + this.setInGround(false); Vec3 vec3 = this.getDeltaMovement(); this.setDeltaMovement(vec3.multiply(this.random.nextFloat() * 0.2F, this.random.nextFloat() * 0.2F, this.random.nextFloat() * 0.2F)); this.life = 0; } + protected boolean isInGround() { + return this.entityData.get(IN_GROUND); + } + + protected void setInGround(boolean bl) { + this.entityData.set(IN_GROUND, bl); + } + @Override public void move(MoverType type, Vec3 pos) { super.move(type, pos); @@ -316,6 +341,11 @@ public abstract class AbstractArrow extends Projectile { } } + @Override + protected void onItemBreak(Item item) { + this.firedFromWeapon = null; + } + @Override protected void onHitEntity(EntityHitResult result) { super.onHitEntity(result); @@ -361,7 +391,7 @@ public abstract class AbstractArrow extends Projectile { entity.igniteForSeconds(5.0F); } - if (entity.hurt(damageSource, i)) { + if (entity.hurtOrSimulate(damageSource, i)) { if (bl) { return; } @@ -386,10 +416,10 @@ public abstract class AbstractArrow extends Projectile { } if (!this.level().isClientSide && entity2 instanceof ServerPlayer serverPlayer) { - if (this.piercedAndKilledEntities != null && this.shotFromCrossbow()) { - CriteriaTriggers.KILLED_BY_CROSSBOW.trigger(serverPlayer, this.piercedAndKilledEntities); - } else if (!entity.isAlive() && this.shotFromCrossbow()) { - CriteriaTriggers.KILLED_BY_CROSSBOW.trigger(serverPlayer, Arrays.asList(entity)); + if (this.piercedAndKilledEntities != null) { + CriteriaTriggers.KILLED_BY_ARROW.trigger(serverPlayer, this.piercedAndKilledEntities, this.firedFromWeapon); + } else if (!entity.isAlive()) { + CriteriaTriggers.KILLED_BY_ARROW.trigger(serverPlayer, List.of(entity), this.firedFromWeapon); } } } @@ -402,9 +432,9 @@ public abstract class AbstractArrow extends Projectile { entity.setRemainingFireTicks(j); this.deflect(ProjectileDeflection.REVERSE, entity, this.getOwner(), false); this.setDeltaMovement(this.getDeltaMovement().scale(0.2)); - if (!this.level().isClientSide && this.getDeltaMovement().lengthSqr() < 1.0E-7) { + if (this.level() instanceof ServerLevel serverLevel3 && this.getDeltaMovement().lengthSqr() < 1.0E-7) { if (this.pickup == AbstractArrow.Pickup.ALLOWED) { - this.spawnAtLocation(this.getPickupItem(), 0.1F); + this.spawnAtLocation(serverLevel3, this.getPickupItem(), 0.1F); } this.discard(); @@ -429,17 +459,18 @@ public abstract class AbstractArrow extends Projectile { protected void onHitBlock(BlockHitResult result) { this.lastState = this.level().getBlockState(result.getBlockPos()); super.onHitBlock(result); - Vec3 vec3 = result.getLocation().subtract(this.getX(), this.getY(), this.getZ()); - this.setDeltaMovement(vec3); ItemStack itemStack = this.getWeaponItem(); if (this.level() instanceof ServerLevel serverLevel && itemStack != null) { this.hitBlockEnchantmentEffects(serverLevel, result, itemStack); } - Vec3 vec32 = vec3.normalize().scale(0.05F); - this.setPosRaw(this.getX() - vec32.x, this.getY() - vec32.y, this.getZ() - vec32.z); + Vec3 vec3 = this.getDeltaMovement(); + Vec3 vec32 = new Vec3(Math.signum(vec3.x), Math.signum(vec3.y), Math.signum(vec3.z)); + Vec3 vec33 = vec32.scale(0.05F); + this.setPos(this.position().subtract(vec33)); + this.setDeltaMovement(Vec3.ZERO); this.playSound(this.getHitGroundSoundEvent(), 1.0F, 1.2F / (this.random.nextFloat() * 0.2F + 0.9F)); - this.inGround = true; + this.setInGround(true); this.shakeTime = 7; this.setCritArrow(false); this.setPierceLevel((byte)0); @@ -492,7 +523,9 @@ public abstract class AbstractArrow extends Projectile { @Override protected boolean canHitEntity(Entity target) { - return super.canHitEntity(target) && (this.piercingIgnoreEntityIds == null || !this.piercingIgnoreEntityIds.contains(target.getId())); + return target instanceof Player && this.getOwner() instanceof Player player && !player.canHarmPlayer((Player)target) + ? false + : super.canHitEntity(target) && (this.piercingIgnoreEntityIds == null || !this.piercingIgnoreEntityIds.contains(target.getId())); } @Override @@ -504,7 +537,7 @@ public abstract class AbstractArrow extends Projectile { } compound.putByte("shake", (byte)this.shakeTime); - compound.putBoolean("inGround", this.inGround); + compound.putBoolean("inGround", this.isInGround()); compound.putByte("pickup", (byte)this.pickup.ordinal()); compound.putDouble("damage", this.baseDamage); compound.putBoolean("crit", this.isCritArrow()); @@ -525,7 +558,7 @@ public abstract class AbstractArrow extends Projectile { } this.shakeTime = compound.getByte("shake") & 255; - this.inGround = compound.getBoolean("inGround"); + this.setInGround(compound.getBoolean("inGround")); if (compound.contains("damage", 99)) { this.baseDamage = compound.getDouble("damage"); } @@ -565,7 +598,7 @@ public abstract class AbstractArrow extends Projectile { @Override public void playerTouch(Player player) { - if (!this.level().isClientSide && (this.inGround || this.isNoPhysics()) && this.shakeTime <= 0) { + if (!this.level().isClientSide && (this.isInGround() || this.isNoPhysics()) && this.shakeTime <= 0) { if (this.tryPickup(player)) { player.take(this, 1); this.discard(); @@ -645,13 +678,6 @@ public abstract class AbstractArrow extends Projectile { return (b & 1) != 0; } - /** - * Whether the arrow was shot from a crossbow. - */ - public boolean shotFromCrossbow() { - return this.firedFromWeapon != null && this.firedFromWeapon.is(Items.CROSSBOW); - } - public byte getPierceLevel() { return this.entityData.get(PIERCE_LEVEL); } @@ -681,7 +707,7 @@ public abstract class AbstractArrow extends Projectile { @Override public boolean isPickable() { - return super.isPickable() && !this.inGround; + return super.isPickable() && !this.isInGround(); } @Override @@ -689,6 +715,11 @@ public abstract class AbstractArrow extends Projectile { return slot == 0 ? SlotAccess.of(this::getPickupItemStackOrigin, this::setPickupItemStack) : super.getSlot(slot); } + @Override + protected boolean shouldBounceOnWorldBorder() { + return true; + } + public static enum Pickup { DISALLOWED, ALLOWED, diff --git a/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java b/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java index f4beac93..0b8eec03 100644 --- a/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java +++ b/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java @@ -6,16 +6,18 @@ import net.minecraft.nbt.CompoundTag; import net.minecraft.network.protocol.Packet; import net.minecraft.network.protocol.game.ClientGamePacketListener; import net.minecraft.network.protocol.game.ClientboundAddEntityPacket; -import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.network.syncher.SynchedEntityData.Builder; import net.minecraft.server.level.ServerEntity; +import net.minecraft.server.level.ServerLevel; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.level.ClipContext; import net.minecraft.world.level.Level; +import net.minecraft.world.level.ClipContext.Block; import net.minecraft.world.phys.HitResult; import net.minecraft.world.phys.Vec3; +import net.minecraft.world.phys.HitResult.Type; import org.jetbrains.annotations.Nullable; public abstract class AbstractHurtingProjectile extends Projectile { @@ -46,7 +48,7 @@ public abstract class AbstractHurtingProjectile extends Projectile { } @Override - protected void defineSynchedData(SynchedEntityData.Builder builder) { + protected void defineSynchedData(Builder builder) { } @Override @@ -60,57 +62,70 @@ public abstract class AbstractHurtingProjectile extends Projectile { return distance < d * d; } - protected ClipContext.Block getClipType() { - return ClipContext.Block.COLLIDER; + protected Block getClipType() { + return Block.COLLIDER; } @Override public void tick() { Entity entity = this.getOwner(); + this.applyInertia(); if (this.level().isClientSide || (entity == null || !entity.isRemoved()) && this.level().hasChunkAt(this.blockPosition())) { + HitResult hitResult = ProjectileUtil.getHitResultOnMoveVector(this, this::canHitEntity, this.getClipType()); + Vec3 vec3; + if (hitResult.getType() != Type.MISS) { + vec3 = hitResult.getLocation(); + } else { + vec3 = this.position().add(this.getDeltaMovement()); + } + + ProjectileUtil.rotateTowardsMovement(this, 0.2F); + this.setPos(vec3); + this.applyEffectsFromBlocks(); super.tick(); if (this.shouldBurn()) { this.igniteForSeconds(1.0F); } - HitResult hitResult = ProjectileUtil.getHitResultOnMoveVector(this, this::canHitEntity, this.getClipType()); - if (hitResult.getType() != HitResult.Type.MISS) { + if (hitResult.getType() != Type.MISS && this.isAlive()) { this.hitTargetOrDeflectSelf(hitResult); } - this.checkInsideBlocks(); - Vec3 vec3 = this.getDeltaMovement(); - double d = this.getX() + vec3.x; - double e = this.getY() + vec3.y; - double f = this.getZ() + vec3.z; - ProjectileUtil.rotateTowardsMovement(this, 0.2F); - float h; - if (this.isInWater()) { - for (int i = 0; i < 4; i++) { - float g = 0.25F; - this.level().addParticle(ParticleTypes.BUBBLE, d - vec3.x * 0.25, e - vec3.y * 0.25, f - vec3.z * 0.25, vec3.x, vec3.y, vec3.z); - } - - h = this.getLiquidInertia(); - } else { - h = this.getInertia(); - } - - this.setDeltaMovement(vec3.add(vec3.normalize().scale(this.accelerationPower)).scale(h)); - ParticleOptions particleOptions = this.getTrailParticle(); - if (particleOptions != null) { - this.level().addParticle(particleOptions, d, e + 0.5, f, 0.0, 0.0, 0.0); - } - - this.setPos(d, e, f); + this.createParticleTrail(); } else { this.discard(); } } + private void applyInertia() { + Vec3 vec3 = this.getDeltaMovement(); + Vec3 vec32 = this.position(); + float g; + if (this.isInWater()) { + for (int i = 0; i < 4; i++) { + float f = 0.25F; + this.level().addParticle(ParticleTypes.BUBBLE, vec32.x - vec3.x * 0.25, vec32.y - vec3.y * 0.25, vec32.z - vec3.z * 0.25, vec3.x, vec3.y, vec3.z); + } + + g = this.getLiquidInertia(); + } else { + g = this.getInertia(); + } + + this.setDeltaMovement(vec3.add(vec3.normalize().scale(this.accelerationPower)).scale(g)); + } + + private void createParticleTrail() { + ParticleOptions particleOptions = this.getTrailParticle(); + Vec3 vec3 = this.position(); + if (particleOptions != null) { + this.level().addParticle(particleOptions, vec3.x, vec3.y + 0.5, vec3.z, 0.0, 0.0, 0.0); + } + } + @Override - public boolean hurt(DamageSource source, float amount) { - return !this.isInvulnerableTo(source); + public boolean hurtServer(ServerLevel serverLevel, DamageSource damageSource, float f) { + return false; } @Override diff --git a/net/minecraft/world/entity/projectile/Arrow.java b/net/minecraft/world/entity/projectile/Arrow.java index 44f986fc..a24f5233 100644 --- a/net/minecraft/world/entity/projectile/Arrow.java +++ b/net/minecraft/world/entity/projectile/Arrow.java @@ -7,6 +7,7 @@ import net.minecraft.core.particles.ParticleTypes; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.network.syncher.SynchedEntityData.Builder; import net.minecraft.world.effect.MobEffectInstance; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; @@ -63,7 +64,7 @@ public class Arrow extends AbstractArrow { } @Override - protected void defineSynchedData(SynchedEntityData.Builder builder) { + protected void defineSynchedData(Builder builder) { super.defineSynchedData(builder); builder.define(ID_EFFECT_COLOR, -1); } @@ -72,14 +73,14 @@ public class Arrow extends AbstractArrow { public void tick() { super.tick(); if (this.level().isClientSide) { - if (this.inGround) { + if (this.isInGround()) { if (this.inGroundTime % 5 == 0) { this.makeParticle(1); } } else { this.makeParticle(2); } - } else if (this.inGround && this.inGroundTime != 0 && !this.getPotionContents().equals(PotionContents.EMPTY) && this.inGroundTime >= 600) { + } else if (this.isInGround() && this.inGroundTime != 0 && !this.getPotionContents().equals(PotionContents.EMPTY) && this.inGroundTime >= 600) { this.level().broadcastEntityEvent(this, (byte)0); this.setPickupItemStack(new ItemStack(Items.ARROW)); } diff --git a/net/minecraft/world/entity/projectile/DragonFireball.java b/net/minecraft/world/entity/projectile/DragonFireball.java index 0eeced55..8f916bf3 100644 --- a/net/minecraft/world/entity/projectile/DragonFireball.java +++ b/net/minecraft/world/entity/projectile/DragonFireball.java @@ -3,7 +3,6 @@ package net.minecraft.world.entity.projectile; import java.util.List; import net.minecraft.core.particles.ParticleOptions; import net.minecraft.core.particles.ParticleTypes; -import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.effect.MobEffectInstance; import net.minecraft.world.effect.MobEffects; import net.minecraft.world.entity.AreaEffectCloud; @@ -14,6 +13,7 @@ import net.minecraft.world.level.Level; import net.minecraft.world.phys.EntityHitResult; import net.minecraft.world.phys.HitResult; import net.minecraft.world.phys.Vec3; +import net.minecraft.world.phys.HitResult.Type; public class DragonFireball extends AbstractHurtingProjectile { public static final float SPLASH_RANGE = 4.0F; @@ -29,7 +29,7 @@ public class DragonFireball extends AbstractHurtingProjectile { @Override protected void onHit(HitResult result) { super.onHit(result); - if (result.getType() != HitResult.Type.ENTITY || !this.ownedBy(((EntityHitResult)result).getEntity())) { + if (result.getType() != Type.ENTITY || !this.ownedBy(((EntityHitResult)result).getEntity())) { if (!this.level().isClientSide) { List list = this.level().getEntitiesOfClass(LivingEntity.class, this.getBoundingBox().inflate(4.0, 2.0, 4.0)); AreaEffectCloud areaEffectCloud = new AreaEffectCloud(this.level(), this.getX(), this.getY(), this.getZ()); @@ -60,11 +60,6 @@ public class DragonFireball extends AbstractHurtingProjectile { } } - @Override - public boolean hurt(DamageSource source, float amount) { - return false; - } - @Override protected ParticleOptions getTrailParticle() { return ParticleTypes.DRAGON_BREATH; diff --git a/net/minecraft/world/entity/projectile/EvokerFangs.java b/net/minecraft/world/entity/projectile/EvokerFangs.java index 88a103e6..d9cc67c7 100644 --- a/net/minecraft/world/entity/projectile/EvokerFangs.java +++ b/net/minecraft/world/entity/projectile/EvokerFangs.java @@ -3,7 +3,7 @@ package net.minecraft.world.entity.projectile; import java.util.UUID; import net.minecraft.core.particles.ParticleTypes; import net.minecraft.nbt.CompoundTag; -import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.network.syncher.SynchedEntityData.Builder; import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundEvents; import net.minecraft.world.damagesource.DamageSource; @@ -41,7 +41,7 @@ public class EvokerFangs extends Entity implements TraceableEntity { } @Override - protected void defineSynchedData(SynchedEntityData.Builder builder) { + protected void defineSynchedData(Builder builder) { } public void setOwner(@Nullable LivingEntity owner) { @@ -124,7 +124,7 @@ public class EvokerFangs extends Entity implements TraceableEntity { } DamageSource damageSource = this.damageSources().indirectMagic(this, livingEntity); - if (target.hurt(damageSource, 6.0F) && this.level() instanceof ServerLevel serverLevel) { + if (this.level() instanceof ServerLevel serverLevel && target.hurtServer(serverLevel, damageSource, 6.0F)) { EnchantmentHelper.doPostAttackEffects(serverLevel, target, damageSource); } } @@ -153,4 +153,9 @@ public class EvokerFangs extends Entity implements TraceableEntity { return i <= 0 ? 1.0F : 1.0F - (i - partialTicks) / 20.0F; } } + + @Override + public boolean hurtServer(ServerLevel serverLevel, DamageSource damageSource, float f) { + return false; + } } diff --git a/net/minecraft/world/entity/projectile/EyeOfEnder.java b/net/minecraft/world/entity/projectile/EyeOfEnder.java index dbf7047a..3d9780f3 100644 --- a/net/minecraft/world/entity/projectile/EyeOfEnder.java +++ b/net/minecraft/world/entity/projectile/EyeOfEnder.java @@ -6,8 +6,11 @@ import net.minecraft.nbt.CompoundTag; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.network.syncher.SynchedEntityData.Builder; +import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundEvents; import net.minecraft.util.Mth; +import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.item.ItemEntity; @@ -17,6 +20,7 @@ import net.minecraft.world.level.Level; import net.minecraft.world.phys.Vec3; public class EyeOfEnder extends Entity implements ItemSupplier { + private static final float MIN_CAMERA_DISTANCE_SQUARED = 12.25F; private static final EntityDataAccessor DATA_ITEM_STACK = SynchedEntityData.defineId(EyeOfEnder.class, EntityDataSerializers.ITEM_STACK); private double tx; private double ty; @@ -47,19 +51,23 @@ public class EyeOfEnder extends Entity implements ItemSupplier { } @Override - protected void defineSynchedData(SynchedEntityData.Builder builder) { + protected void defineSynchedData(Builder builder) { builder.define(DATA_ITEM_STACK, this.getDefaultItem()); } @Override public boolean shouldRenderAtSqrDistance(double distance) { - double d = this.getBoundingBox().getSize() * 4.0; - if (Double.isNaN(d)) { - d = 4.0; - } + if (this.tickCount < 2 && distance < 12.25) { + return false; + } else { + double d = this.getBoundingBox().getSize() * 4.0; + if (Double.isNaN(d)) { + d = 4.0; + } - d *= 64.0; - return distance < d * d; + d *= 64.0; + return distance < d * d; + } } public void signalTo(BlockPos pos) { @@ -184,4 +192,9 @@ public class EyeOfEnder extends Entity implements ItemSupplier { public boolean isAttackable() { return false; } + + @Override + public boolean hurtServer(ServerLevel serverLevel, DamageSource damageSource, float f) { + return false; + } } diff --git a/net/minecraft/world/entity/projectile/Fireball.java b/net/minecraft/world/entity/projectile/Fireball.java index e0b8844f..09a467c1 100644 --- a/net/minecraft/world/entity/projectile/Fireball.java +++ b/net/minecraft/world/entity/projectile/Fireball.java @@ -4,7 +4,7 @@ import net.minecraft.nbt.CompoundTag; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; -import net.minecraft.world.damagesource.DamageSource; +import net.minecraft.network.syncher.SynchedEntityData.Builder; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.SlotAccess; @@ -14,6 +14,7 @@ import net.minecraft.world.level.Level; import net.minecraft.world.phys.Vec3; public abstract class Fireball extends AbstractHurtingProjectile implements ItemSupplier { + private static final float MIN_CAMERA_DISTANCE_SQUARED = 12.25F; private static final EntityDataAccessor DATA_ITEM_STACK = SynchedEntityData.defineId(Fireball.class, EntityDataSerializers.ITEM_STACK); public Fireball(EntityType entityType, Level level) { @@ -36,13 +37,17 @@ public abstract class Fireball extends AbstractHurtingProjectile implements Item } } + @Override + protected void playEntityOnFireExtinguishedSound() { + } + @Override public ItemStack getItem() { return this.getEntityData().get(DATA_ITEM_STACK); } @Override - protected void defineSynchedData(SynchedEntityData.Builder builder) { + protected void defineSynchedData(Builder builder) { builder.define(DATA_ITEM_STACK, this.getDefaultItem()); } @@ -72,7 +77,7 @@ public abstract class Fireball extends AbstractHurtingProjectile implements Item } @Override - public boolean hurt(DamageSource source, float amount) { - return false; + public boolean shouldRenderAtSqrDistance(double distance) { + return this.tickCount < 2 && distance < 12.25 ? false : super.shouldRenderAtSqrDistance(distance); } } diff --git a/net/minecraft/world/entity/projectile/FireworkRocketEntity.java b/net/minecraft/world/entity/projectile/FireworkRocketEntity.java index cbc78b00..41acea4e 100644 --- a/net/minecraft/world/entity/projectile/FireworkRocketEntity.java +++ b/net/minecraft/world/entity/projectile/FireworkRocketEntity.java @@ -10,6 +10,8 @@ import net.minecraft.nbt.CompoundTag; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.network.syncher.SynchedEntityData.Builder; +import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; import net.minecraft.world.damagesource.DamageSource; @@ -23,11 +25,14 @@ import net.minecraft.world.item.component.FireworkExplosion; import net.minecraft.world.item.component.Fireworks; import net.minecraft.world.level.ClipContext; import net.minecraft.world.level.Level; +import net.minecraft.world.level.ClipContext.Block; +import net.minecraft.world.level.ClipContext.Fluid; import net.minecraft.world.level.gameevent.GameEvent; import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.EntityHitResult; import net.minecraft.world.phys.HitResult; import net.minecraft.world.phys.Vec3; +import net.minecraft.world.phys.HitResult.Type; import org.jetbrains.annotations.Nullable; public class FireworkRocketEntity extends Projectile implements ItemSupplier { @@ -84,7 +89,7 @@ public class FireworkRocketEntity extends Projectile implements ItemSupplier { } @Override - protected void defineSynchedData(SynchedEntityData.Builder builder) { + protected void defineSynchedData(Builder builder) { builder.define(DATA_ID_FIREWORKS_ITEM, getDefaultItem()); builder.define(DATA_ATTACHED_TO_TARGET, OptionalInt.empty()); builder.define(DATA_SHOT_AT_ANGLE, false); @@ -103,6 +108,7 @@ public class FireworkRocketEntity extends Projectile implements ItemSupplier { @Override public void tick() { super.tick(); + HitResult hitResult; if (this.isAttachedToEntity()) { if (this.attachedToEntity == null) { this.entityData.get(DATA_ATTACHED_TO_TARGET).ifPresent(i -> { @@ -132,6 +138,8 @@ public class FireworkRocketEntity extends Projectile implements ItemSupplier { this.setPos(this.attachedToEntity.getX() + vec33.x, this.attachedToEntity.getY() + vec33.y, this.attachedToEntity.getZ() + vec33.z); this.setDeltaMovement(this.attachedToEntity.getDeltaMovement()); } + + hitResult = ProjectileUtil.getHitResultOnMoveVector(this, this::canHitEntity); } else { if (!this.isShotAtAngle()) { double f = this.horizontalCollision ? 1.0 : 1.15; @@ -139,12 +147,13 @@ public class FireworkRocketEntity extends Projectile implements ItemSupplier { } Vec3 vec33 = this.getDeltaMovement(); + hitResult = ProjectileUtil.getHitResultOnMoveVector(this, this::canHitEntity); this.move(MoverType.SELF, vec33); + this.applyEffectsFromBlocks(); this.setDeltaMovement(vec33); } - HitResult hitResult = ProjectileUtil.getHitResultOnMoveVector(this, this::canHitEntity); - if (!this.noPhysics) { + if (!this.noPhysics && this.isAlive() && hitResult.getType() != Type.MISS) { this.hitTargetOrDeflectSelf(hitResult); this.hasImpulse = true; } @@ -168,23 +177,23 @@ public class FireworkRocketEntity extends Projectile implements ItemSupplier { ); } - if (!this.level().isClientSide && this.life > this.lifetime) { - this.explode(); + if (this.life > this.lifetime && this.level() instanceof ServerLevel serverLevel) { + this.explode(serverLevel); } } - private void explode() { - this.level().broadcastEntityEvent(this, (byte)17); + private void explode(ServerLevel serverLevel) { + serverLevel.broadcastEntityEvent(this, (byte)17); this.gameEvent(GameEvent.EXPLODE, this.getOwner()); - this.dealExplosionDamage(); + this.dealExplosionDamage(serverLevel); this.discard(); } @Override protected void onHitEntity(EntityHitResult result) { super.onHitEntity(result); - if (!this.level().isClientSide) { - this.explode(); + if (this.level() instanceof ServerLevel serverLevel) { + this.explode(serverLevel); } } @@ -192,8 +201,8 @@ public class FireworkRocketEntity extends Projectile implements ItemSupplier { protected void onHitBlock(BlockHitResult result) { BlockPos blockPos = new BlockPos(result.getBlockPos()); this.level().getBlockState(blockPos).entityInside(this.level(), blockPos, this); - if (!this.level().isClientSide() && this.hasExplosion()) { - this.explode(); + if (this.level() instanceof ServerLevel serverLevel && this.hasExplosion()) { + this.explode(serverLevel); } super.onHitBlock(result); @@ -203,7 +212,7 @@ public class FireworkRocketEntity extends Projectile implements ItemSupplier { return !this.getExplosions().isEmpty(); } - private void dealExplosionDamage() { + private void dealExplosionDamage(ServerLevel serverLevel) { float f = 0.0F; List list = this.getExplosions(); if (!list.isEmpty()) { @@ -212,7 +221,7 @@ public class FireworkRocketEntity extends Projectile implements ItemSupplier { if (f > 0.0F) { if (this.attachedToEntity != null) { - this.attachedToEntity.hurt(this.damageSources().fireworks(this, this.getOwner()), 5.0F + list.size() * 2); + this.attachedToEntity.hurtServer(serverLevel, this.damageSources().fireworks(this, this.getOwner()), 5.0F + list.size() * 2); } double d = 5.0; @@ -224,8 +233,8 @@ public class FireworkRocketEntity extends Projectile implements ItemSupplier { for (int i = 0; i < 2; i++) { Vec3 vec32 = new Vec3(livingEntity.getX(), livingEntity.getY(0.5 * i), livingEntity.getZ()); - HitResult hitResult = this.level().clip(new ClipContext(vec3, vec32, ClipContext.Block.COLLIDER, ClipContext.Fluid.NONE, this)); - if (hitResult.getType() == HitResult.Type.MISS) { + HitResult hitResult = this.level().clip(new ClipContext(vec3, vec32, Block.COLLIDER, Fluid.NONE, this)); + if (hitResult.getType() == Type.MISS) { bl = true; break; } @@ -233,7 +242,7 @@ public class FireworkRocketEntity extends Projectile implements ItemSupplier { if (bl) { float g = f * (float)Math.sqrt((5.0 - this.distanceTo(livingEntity)) / 5.0); - livingEntity.hurt(this.damageSources().fireworks(this, this.getOwner()), g); + livingEntity.hurtServer(serverLevel, this.damageSources().fireworks(this, this.getOwner()), g); } } } diff --git a/net/minecraft/world/entity/projectile/FishingHook.java b/net/minecraft/world/entity/projectile/FishingHook.java index 87eed09e..e001f962 100644 --- a/net/minecraft/world/entity/projectile/FishingHook.java +++ b/net/minecraft/world/entity/projectile/FishingHook.java @@ -13,6 +13,7 @@ import net.minecraft.network.protocol.game.ClientboundAddEntityPacket; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.network.syncher.SynchedEntityData.Builder; import net.minecraft.server.level.ServerEntity; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; @@ -68,7 +69,6 @@ public class FishingHook extends Projectile { private FishingHook(EntityType entityType, Level level, int luck, int lureSpeed) { super(entityType, level); - this.noCulling = true; this.luck = Math.max(0, luck); this.lureSpeed = Math.max(0, lureSpeed); } @@ -77,23 +77,23 @@ public class FishingHook extends Projectile { this(entityType, level, 0, 0); } - public FishingHook(Player player, Level level, int luck, int lureSpeed) { - this(EntityType.FISHING_BOBBER, level, luck, lureSpeed); + public FishingHook(Player player, Level level, int i, int j, ItemStack itemStack) { + this(EntityType.FISHING_BOBBER, level, i, j); this.setOwner(player); float f = player.getXRot(); float g = player.getYRot(); float h = Mth.cos(-g * (float) (Math.PI / 180.0) - (float) Math.PI); - float i = Mth.sin(-g * (float) (Math.PI / 180.0) - (float) Math.PI); - float j = -Mth.cos(-f * (float) (Math.PI / 180.0)); - float k = Mth.sin(-f * (float) (Math.PI / 180.0)); - double d = player.getX() - i * 0.3; + float k = Mth.sin(-g * (float) (Math.PI / 180.0) - (float) Math.PI); + float l = -Mth.cos(-f * (float) (Math.PI / 180.0)); + float m = Mth.sin(-f * (float) (Math.PI / 180.0)); + double d = player.getX() - k * 0.3; double e = player.getEyeY(); - double l = player.getZ() - h * 0.3; - this.moveTo(d, e, l, g, f); - Vec3 vec3 = new Vec3(-i, Mth.clamp(-(k / j), -5.0F, 5.0F), -h); - double m = vec3.length(); + double n = player.getZ() - h * 0.3; + this.moveTo(d, e, n, g, f); + Vec3 vec3 = new Vec3(-k, Mth.clamp(-(m / l), -5.0F, 5.0F), -h); + double o = vec3.length(); vec3 = vec3.multiply( - 0.6 / m + this.random.triangle(0.5, 0.0103365), 0.6 / m + this.random.triangle(0.5, 0.0103365), 0.6 / m + this.random.triangle(0.5, 0.0103365) + 0.6 / o + this.random.triangle(0.5, 0.0103365), 0.6 / o + this.random.triangle(0.5, 0.0103365), 0.6 / o + this.random.triangle(0.5, 0.0103365) ); this.setDeltaMovement(vec3); this.setYRot((float)(Mth.atan2(vec3.x, vec3.z) * 180.0F / (float)Math.PI)); @@ -103,11 +103,16 @@ public class FishingHook extends Projectile { } @Override - protected void defineSynchedData(SynchedEntityData.Builder builder) { + protected void defineSynchedData(Builder builder) { builder.define(DATA_HOOKED_ENTITY, 0); builder.define(DATA_BITING, false); } + @Override + protected boolean shouldBounceOnWorldBorder() { + return true; + } + @Override public void onSyncedDataUpdated(EntityDataAccessor dataAccessor) { if (DATA_HOOKED_ENTITY.equals(dataAccessor)) { @@ -223,6 +228,7 @@ public class FishingHook extends Projectile { } this.move(MoverType.SELF, this.getDeltaMovement()); + this.applyEffectsFromBlocks(); this.updateRotation(); if (this.currentState == FishingHook.FishHookState.FLYING && (this.onGround() || this.horizontalCollision)) { this.setDeltaMovement(Vec3.ZERO); @@ -540,7 +546,7 @@ public class FishingHook extends Projectile { if (this.getPlayerOwner() == null) { int i = packet.getData(); LOGGER.error("Failed to recreate fishing hook on client. {} (id: {}) is not a valid owner.", this.level().getEntity(i), i); - this.kill(); + this.discard(); } } diff --git a/net/minecraft/world/entity/projectile/LargeFireball.java b/net/minecraft/world/entity/projectile/LargeFireball.java index 8b8cb667..7d91bc6e 100644 --- a/net/minecraft/world/entity/projectile/LargeFireball.java +++ b/net/minecraft/world/entity/projectile/LargeFireball.java @@ -28,8 +28,8 @@ public class LargeFireball extends Fireball { @Override protected void onHit(HitResult result) { super.onHit(result); - if (!this.level().isClientSide) { - boolean bl = this.level().getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING); + if (this.level() instanceof ServerLevel serverLevel) { + boolean bl = serverLevel.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING); this.level().explode(this, this.getX(), this.getY(), this.getZ(), this.explosionPower, bl, Level.ExplosionInteraction.MOB); this.discard(); } @@ -42,7 +42,7 @@ public class LargeFireball extends Fireball { Entity var6 = result.getEntity(); Entity entity2 = this.getOwner(); DamageSource damageSource = this.damageSources().fireball(this, entity2); - var6.hurt(damageSource, 6.0F); + var6.hurtServer(serverLevel, damageSource, 6.0F); EnchantmentHelper.doPostAttackEffects(serverLevel, var6, damageSource); } } diff --git a/net/minecraft/world/entity/projectile/LlamaSpit.java b/net/minecraft/world/entity/projectile/LlamaSpit.java index 76e009f2..0e90101f 100644 --- a/net/minecraft/world/entity/projectile/LlamaSpit.java +++ b/net/minecraft/world/entity/projectile/LlamaSpit.java @@ -2,7 +2,7 @@ package net.minecraft.world.entity.projectile; import net.minecraft.core.particles.ParticleTypes; import net.minecraft.network.protocol.game.ClientboundAddEntityPacket; -import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.network.syncher.SynchedEntityData.Builder; import net.minecraft.server.level.ServerLevel; import net.minecraft.util.Mth; import net.minecraft.world.damagesource.DamageSource; @@ -66,7 +66,7 @@ public class LlamaSpit extends Projectile { if (this.getOwner() instanceof LivingEntity livingEntity) { Entity entity = result.getEntity(); DamageSource damageSource = this.damageSources().spit(this, livingEntity); - if (entity.hurt(damageSource, 1.0F) && this.level() instanceof ServerLevel serverLevel) { + if (this.level() instanceof ServerLevel serverLevel && entity.hurtServer(serverLevel, damageSource, 1.0F)) { EnchantmentHelper.doPostAttackEffects(serverLevel, entity, damageSource); } } @@ -81,7 +81,7 @@ public class LlamaSpit extends Projectile { } @Override - protected void defineSynchedData(SynchedEntityData.Builder builder) { + protected void defineSynchedData(Builder builder) { } @Override diff --git a/net/minecraft/world/entity/projectile/Projectile.java b/net/minecraft/world/entity/projectile/Projectile.java index d96e270f..04bf4da5 100644 --- a/net/minecraft/world/entity/projectile/Projectile.java +++ b/net/minecraft/world/entity/projectile/Projectile.java @@ -3,6 +3,7 @@ package net.minecraft.world.entity.projectile; import com.google.common.base.MoreObjects; import it.unimi.dsi.fastutil.doubles.DoubleDoubleImmutablePair; import java.util.UUID; +import java.util.function.Consumer; import net.minecraft.core.BlockPos; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.protocol.Packet; @@ -14,18 +15,25 @@ import net.minecraft.tags.EntityTypeTags; import net.minecraft.util.Mth; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntitySelector; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.TraceableEntity; import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.enchantment.EnchantmentHelper; import net.minecraft.world.level.GameRules; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.level.gameevent.GameEvent.Context; +import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.EntityHitResult; import net.minecraft.world.phys.HitResult; import net.minecraft.world.phys.Vec3; +import net.minecraft.world.phys.HitResult.Type; import org.jetbrains.annotations.Nullable; public abstract class Projectile extends Entity implements TraceableEntity { @@ -54,14 +62,19 @@ public abstract class Projectile extends Entity implements TraceableEntity { public Entity getOwner() { if (this.cachedOwner != null && !this.cachedOwner.isRemoved()) { return this.cachedOwner; - } else if (this.ownerUUID != null && this.level() instanceof ServerLevel serverLevel) { - this.cachedOwner = serverLevel.getEntity(this.ownerUUID); + } else if (this.ownerUUID != null) { + this.cachedOwner = this.findOwner(this.ownerUUID); return this.cachedOwner; } else { return null; } } + @Nullable + protected Entity findOwner(UUID uUID) { + return this.level() instanceof ServerLevel serverLevel ? serverLevel.getEntity(uUID) : null; + } + public Entity getEffectSource() { return MoreObjects.firstNonNull(this.getOwner(), this); } @@ -86,18 +99,25 @@ public abstract class Projectile extends Entity implements TraceableEntity { @Override protected void readAdditionalSaveData(CompoundTag compound) { if (compound.hasUUID("Owner")) { - this.ownerUUID = compound.getUUID("Owner"); - this.cachedOwner = null; + this.setOwnerThroughUUID(compound.getUUID("Owner")); } this.leftOwner = compound.getBoolean("LeftOwner"); this.hasBeenShot = compound.getBoolean("HasBeenShot"); } + protected void setOwnerThroughUUID(UUID uUID) { + if (this.ownerUUID != uUID) { + this.ownerUUID = uUID; + this.cachedOwner = this.findOwner(uUID); + } + } + @Override public void restoreFrom(Entity entity) { super.restoreFrom(entity); if (entity instanceof Projectile projectile) { + this.ownerUUID = projectile.ownerUUID; this.cachedOwner = projectile.cachedOwner; } } @@ -119,15 +139,11 @@ public abstract class Projectile extends Entity implements TraceableEntity { private boolean checkLeftOwner() { Entity entity = this.getOwner(); if (entity != null) { - for (Entity entity2 : this.level() - .getEntities(this, this.getBoundingBox().expandTowards(this.getDeltaMovement()).inflate(1.0), entityx -> !entityx.isSpectator() && entityx.isPickable())) { - if (entity2.getRootVehicle() == entity.getRootVehicle()) { - return false; - } - } + AABB aABB = this.getBoundingBox().expandTowards(this.getDeltaMovement()).inflate(1.0); + return entity.getRootVehicle().getSelfAndPassengers().filter(EntitySelector.CAN_BE_PICKED).noneMatch(entityx -> aABB.intersects(entityx.getBoundingBox())); + } else { + return true; } - - return true; } public Vec3 getMovementToShoot(double x, double y, double z, float velocity, float inaccuracy) { @@ -160,8 +176,60 @@ public abstract class Projectile extends Entity implements TraceableEntity { this.setDeltaMovement(this.getDeltaMovement().add(vec3.x, shooter.onGround() ? 0.0 : vec3.y, vec3.z)); } + public static T spawnProjectileFromRotation( + Projectile.ProjectileFactory projectileFactory, ServerLevel serverLevel, ItemStack itemStack, LivingEntity livingEntity, float f, float g, float h + ) { + return spawnProjectile( + projectileFactory.create(serverLevel, livingEntity, itemStack), + serverLevel, + itemStack, + projectile -> projectile.shootFromRotation(livingEntity, livingEntity.getXRot(), livingEntity.getYRot(), f, g, h) + ); + } + + public static T spawnProjectileUsingShoot( + Projectile.ProjectileFactory projectileFactory, + ServerLevel serverLevel, + ItemStack itemStack, + LivingEntity livingEntity, + double d, + double e, + double f, + float g, + float h + ) { + return spawnProjectile(projectileFactory.create(serverLevel, livingEntity, itemStack), serverLevel, itemStack, projectile -> projectile.shoot(d, e, f, g, h)); + } + + public static T spawnProjectileUsingShoot( + T projectile, ServerLevel serverLevel, ItemStack itemStack, double d, double e, double f, float g, float h + ) { + return spawnProjectile(projectile, serverLevel, itemStack, projectile2 -> projectile.shoot(d, e, f, g, h)); + } + + public static T spawnProjectile(T projectile, ServerLevel serverLevel, ItemStack itemStack) { + return spawnProjectile(projectile, serverLevel, itemStack, projectilex -> {}); + } + + public static T spawnProjectile(T projectile, ServerLevel serverLevel, ItemStack itemStack, Consumer consumer) { + consumer.accept(projectile); + serverLevel.addFreshEntity(projectile); + projectile.applyOnProjectileSpawned(serverLevel, itemStack); + return projectile; + } + + public void applyOnProjectileSpawned(ServerLevel serverLevel, ItemStack itemStack) { + EnchantmentHelper.onProjectileSpawned(serverLevel, itemStack, this, item -> {}); + if (this instanceof AbstractArrow abstractArrow) { + ItemStack itemStack2 = abstractArrow.getWeaponItem(); + if (itemStack2 != null && !itemStack2.isEmpty() && !itemStack.getItem().equals(itemStack2.getItem())) { + EnchantmentHelper.onProjectileSpawned(serverLevel, itemStack2, this, abstractArrow::onItemBreak); + } + } + } + protected ProjectileDeflection hitTargetOrDeflectSelf(HitResult hitResult) { - if (hitResult.getType() == HitResult.Type.ENTITY) { + if (hitResult.getType() == Type.ENTITY) { EntityHitResult entityHitResult = (EntityHitResult)hitResult; Entity entity = entityHitResult.getEntity(); ProjectileDeflection projectileDeflection = entity.deflection(this); @@ -172,15 +240,25 @@ public abstract class Projectile extends Entity implements TraceableEntity { return projectileDeflection; } + } else if (this.shouldBounceOnWorldBorder() && hitResult instanceof BlockHitResult blockHitResult && blockHitResult.isWorldBorderHit()) { + ProjectileDeflection projectileDeflection2 = ProjectileDeflection.REVERSE; + if (this.deflect(projectileDeflection2, null, this.getOwner(), false)) { + this.setDeltaMovement(this.getDeltaMovement().scale(0.2)); + return projectileDeflection2; + } } this.onHit(hitResult); return ProjectileDeflection.NONE; } + protected boolean shouldBounceOnWorldBorder() { + return false; + } + public boolean deflect(ProjectileDeflection deflection, @Nullable Entity entity, @Nullable Entity owner, boolean deflectedByPlayer) { + deflection.deflect(this, entity, this.random); if (!this.level().isClientSide) { - deflection.deflect(this, entity, this.random); this.setOwner(owner); this.onDeflection(entity, deflectedByPlayer); } @@ -191,12 +269,15 @@ public abstract class Projectile extends Entity implements TraceableEntity { protected void onDeflection(@Nullable Entity entity, boolean deflectedByPlayer) { } + protected void onItemBreak(Item item) { + } + /** * Called when this EntityFireball hits a block or entity. */ protected void onHit(HitResult result) { - HitResult.Type type = result.getType(); - if (type == HitResult.Type.ENTITY) { + Type type = result.getType(); + if (type == Type.ENTITY) { EntityHitResult entityHitResult = (EntityHitResult)result; Entity entity = entityHitResult.getEntity(); if (entity.getType().is(EntityTypeTags.REDIRECTABLE_PROJECTILE) && entity instanceof Projectile projectile) { @@ -204,12 +285,12 @@ public abstract class Projectile extends Entity implements TraceableEntity { } this.onHitEntity(entityHitResult); - this.level().gameEvent(GameEvent.PROJECTILE_LAND, result.getLocation(), GameEvent.Context.of(this, null)); - } else if (type == HitResult.Type.BLOCK) { + this.level().gameEvent(GameEvent.PROJECTILE_LAND, result.getLocation(), Context.of(this, null)); + } else if (type == Type.BLOCK) { BlockHitResult blockHitResult = (BlockHitResult)result; this.onHitBlock(blockHitResult); BlockPos blockPos = blockHitResult.getBlockPos(); - this.level().gameEvent(GameEvent.PROJECTILE_LAND, blockPos, GameEvent.Context.of(this, this.level().getBlockState(blockPos))); + this.level().gameEvent(GameEvent.PROJECTILE_LAND, blockPos, Context.of(this, this.level().getBlockState(blockPos))); } } @@ -281,13 +362,15 @@ public abstract class Projectile extends Entity implements TraceableEntity { } @Override - public boolean mayInteract(Level level, BlockPos pos) { + public boolean mayInteract(ServerLevel serverLevel, BlockPos blockPos) { Entity entity = this.getOwner(); - return entity instanceof Player ? entity.mayInteract(level, pos) : entity == null || level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING); + return entity instanceof Player + ? entity.mayInteract(serverLevel, blockPos) + : entity == null || serverLevel.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING); } - public boolean mayBreak(Level level) { - return this.getType().is(EntityTypeTags.IMPACT_PROJECTILES) && level.getGameRules().getBoolean(GameRules.RULE_PROJECTILESCANBREAKBLOCKS); + public boolean mayBreak(ServerLevel serverLevel) { + return this.getType().is(EntityTypeTags.IMPACT_PROJECTILES) && serverLevel.getGameRules().getBoolean(GameRules.RULE_PROJECTILESCANBREAKBLOCKS); } @Override @@ -305,4 +388,23 @@ public abstract class Projectile extends Entity implements TraceableEntity { double e = this.getDeltaMovement().z; return DoubleDoubleImmutablePair.of(d, e); } + + @Override + public int getDimensionChangingDelay() { + return 2; + } + + @Override + public boolean hurtServer(ServerLevel serverLevel, DamageSource damageSource, float f) { + if (!this.isInvulnerableToBase(damageSource)) { + this.markHurt(); + } + + return false; + } + + @FunctionalInterface + public interface ProjectileFactory { + T create(ServerLevel serverLevel, LivingEntity livingEntity, ItemStack itemStack); + } } diff --git a/net/minecraft/world/entity/projectile/ProjectileUtil.java b/net/minecraft/world/entity/projectile/ProjectileUtil.java index bd579176..c1bf25fc 100644 --- a/net/minecraft/world/entity/projectile/ProjectileUtil.java +++ b/net/minecraft/world/entity/projectile/ProjectileUtil.java @@ -12,10 +12,13 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.level.ClipContext; import net.minecraft.world.level.Level; +import net.minecraft.world.level.ClipContext.Block; +import net.minecraft.world.level.ClipContext.Fluid; import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.EntityHitResult; import net.minecraft.world.phys.HitResult; import net.minecraft.world.phys.Vec3; +import net.minecraft.world.phys.HitResult.Type; import org.jetbrains.annotations.Nullable; public final class ProjectileUtil { @@ -25,10 +28,10 @@ public final class ProjectileUtil { Vec3 vec3 = projectile.getDeltaMovement(); Level level = projectile.level(); Vec3 vec32 = projectile.position(); - return getHitResult(vec32, projectile, filter, vec3, level, 0.3F, ClipContext.Block.COLLIDER); + return getHitResult(vec32, projectile, filter, vec3, level, 0.3F, Block.COLLIDER); } - public static HitResult getHitResultOnMoveVector(Entity projectile, Predicate filter, ClipContext.Block clipContext) { + public static HitResult getHitResultOnMoveVector(Entity projectile, Predicate filter, Block clipContext) { Vec3 vec3 = projectile.getDeltaMovement(); Level level = projectile.level(); Vec3 vec32 = projectile.position(); @@ -39,15 +42,13 @@ public final class ProjectileUtil { Vec3 vec3 = projectile.getViewVector(0.0F).scale(scale); Level level = projectile.level(); Vec3 vec32 = projectile.getEyePosition(); - return getHitResult(vec32, projectile, filter, vec3, level, 0.0F, ClipContext.Block.COLLIDER); + return getHitResult(vec32, projectile, filter, vec3, level, 0.0F, Block.COLLIDER); } - private static HitResult getHitResult( - Vec3 pos, Entity projectile, Predicate filter, Vec3 deltaMovement, Level level, float margin, ClipContext.Block clipContext - ) { + private static HitResult getHitResult(Vec3 pos, Entity projectile, Predicate filter, Vec3 deltaMovement, Level level, float margin, Block clipContext) { Vec3 vec3 = pos.add(deltaMovement); - HitResult hitResult = level.clip(new ClipContext(pos, vec3, clipContext, ClipContext.Fluid.NONE, projectile)); - if (hitResult.getType() != HitResult.Type.MISS) { + HitResult hitResult = level.clipIncludingBorder(new ClipContext(pos, vec3, clipContext, Fluid.NONE, projectile)); + if (hitResult.getType() != Type.MISS) { vec3 = hitResult.getLocation(); } @@ -115,21 +116,23 @@ public final class ProjectileUtil { Level level, Entity projectile, Vec3 startVec, Vec3 endVec, AABB boundingBox, Predicate filter, float inflationAmount ) { double d = Double.MAX_VALUE; + Optional optional = Optional.empty(); Entity entity = null; for (Entity entity2 : level.getEntities(projectile, boundingBox, filter)) { AABB aABB = entity2.getBoundingBox().inflate(inflationAmount); - Optional optional = aABB.clip(startVec, endVec); - if (optional.isPresent()) { - double e = startVec.distanceToSqr((Vec3)optional.get()); + Optional optional2 = aABB.clip(startVec, endVec); + if (optional2.isPresent()) { + double e = startVec.distanceToSqr((Vec3)optional2.get()); if (e < d) { entity = entity2; d = e; + optional = optional2; } } } - return entity == null ? null : new EntityHitResult(entity); + return entity == null ? null : new EntityHitResult(entity, (Vec3)optional.get()); } public static void rotateTowardsMovement(Entity projectile, float rotationSpeed) { diff --git a/net/minecraft/world/entity/projectile/ShulkerBullet.java b/net/minecraft/world/entity/projectile/ShulkerBullet.java index 33ec6cf0..4fed5c4c 100644 --- a/net/minecraft/world/entity/projectile/ShulkerBullet.java +++ b/net/minecraft/world/entity/projectile/ShulkerBullet.java @@ -9,7 +9,7 @@ import net.minecraft.core.Direction; import net.minecraft.core.particles.ParticleTypes; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.protocol.game.ClientboundAddEntityPacket; -import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.network.syncher.SynchedEntityData.Builder; import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; @@ -25,10 +25,12 @@ import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.enchantment.EnchantmentHelper; import net.minecraft.world.level.Level; import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.level.gameevent.GameEvent.Context; import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.EntityHitResult; import net.minecraft.world.phys.HitResult; import net.minecraft.world.phys.Vec3; +import net.minecraft.world.phys.HitResult.Type; import org.jetbrains.annotations.Nullable; public class ShulkerBullet extends Projectile { @@ -98,7 +100,7 @@ public class ShulkerBullet extends Projectile { } @Override - protected void defineSynchedData(SynchedEntityData.Builder builder) { + protected void defineSynchedData(Builder builder) { } @Nullable @@ -199,6 +201,7 @@ public class ShulkerBullet extends Projectile { @Override public void tick() { super.tick(); + HitResult hitResult = null; if (!this.level().isClientSide) { if (this.finalTarget == null && this.targetId != null) { this.finalTarget = ((ServerLevel)this.level()).getEntity(this.targetId); @@ -217,15 +220,20 @@ public class ShulkerBullet extends Projectile { this.setDeltaMovement(vec3.add((this.targetDeltaX - vec3.x) * 0.2, (this.targetDeltaY - vec3.y) * 0.2, (this.targetDeltaZ - vec3.z) * 0.2)); } - HitResult hitResult = ProjectileUtil.getHitResultOnMoveVector(this, this::canHitEntity); - if (hitResult.getType() != HitResult.Type.MISS) { - this.hitTargetOrDeflectSelf(hitResult); - } + hitResult = ProjectileUtil.getHitResultOnMoveVector(this, this::canHitEntity); } - this.checkInsideBlocks(); Vec3 vec3 = this.getDeltaMovement(); - this.setPos(this.getX() + vec3.x, this.getY() + vec3.y, this.getZ() + vec3.z); + this.setPos(this.position().add(vec3)); + this.applyEffectsFromBlocks(); + if (this.portalProcess != null && this.portalProcess.isInsidePortalThisTick()) { + this.handlePortal(); + } + + if (hitResult != null && this.isAlive() && hitResult.getType() != Type.MISS) { + this.hitTargetOrDeflectSelf(hitResult); + } + ProjectileUtil.rotateTowardsMovement(this, 0.5F); if (this.level().isClientSide) { this.level().addParticle(ParticleTypes.END_ROD, this.getX() - vec3.x, this.getY() - vec3.y + 0.15, this.getZ() - vec3.z, 0.0, 0.0, 0.0); @@ -281,7 +289,7 @@ public class ShulkerBullet extends Projectile { Entity entity2 = this.getOwner(); LivingEntity livingEntity = entity2 instanceof LivingEntity ? (LivingEntity)entity2 : null; DamageSource damageSource = this.damageSources().mobProjectile(this, livingEntity); - boolean bl = entity.hurt(damageSource, 4.0F); + boolean bl = entity.hurtOrSimulate(damageSource, 4.0F); if (bl) { if (this.level() instanceof ServerLevel serverLevel) { EnchantmentHelper.doPostAttackEffects(serverLevel, entity, damageSource); @@ -302,7 +310,7 @@ public class ShulkerBullet extends Projectile { private void destroy() { this.discard(); - this.level().gameEvent(GameEvent.ENTITY_DAMAGE, this.position(), GameEvent.Context.of(this)); + this.level().gameEvent(GameEvent.ENTITY_DAMAGE, this.position(), Context.of(this)); } @Override @@ -317,13 +325,15 @@ public class ShulkerBullet extends Projectile { } @Override - public boolean hurt(DamageSource source, float amount) { - if (!this.level().isClientSide) { - this.playSound(SoundEvents.SHULKER_BULLET_HURT, 1.0F, 1.0F); - ((ServerLevel)this.level()).sendParticles(ParticleTypes.CRIT, this.getX(), this.getY(), this.getZ(), 15, 0.2, 0.2, 0.2, 0.0); - this.destroy(); - } + public boolean hurtClient(DamageSource damageSource) { + return true; + } + @Override + public boolean hurtServer(ServerLevel serverLevel, DamageSource damageSource, float f) { + this.playSound(SoundEvents.SHULKER_BULLET_HURT, 1.0F, 1.0F); + serverLevel.sendParticles(ParticleTypes.CRIT, this.getX(), this.getY(), this.getZ(), 15, 0.2, 0.2, 0.2, 0.0); + this.destroy(); return true; } diff --git a/net/minecraft/world/entity/projectile/SmallFireball.java b/net/minecraft/world/entity/projectile/SmallFireball.java index 0a122799..3db7b3fc 100644 --- a/net/minecraft/world/entity/projectile/SmallFireball.java +++ b/net/minecraft/world/entity/projectile/SmallFireball.java @@ -38,7 +38,7 @@ public class SmallFireball extends Fireball { int i = var7.getRemainingFireTicks(); var7.igniteForSeconds(5.0F); DamageSource damageSource = this.damageSources().fireball(this, entity2); - if (!var7.hurt(damageSource, 5.0F)) { + if (!var7.hurtServer(serverLevel, damageSource, 5.0F)) { var7.setRemainingFireTicks(i); } else { EnchantmentHelper.doPostAttackEffects(serverLevel, var7, damageSource); @@ -49,9 +49,9 @@ public class SmallFireball extends Fireball { @Override protected void onHitBlock(BlockHitResult result) { super.onHitBlock(result); - if (!this.level().isClientSide) { + if (this.level() instanceof ServerLevel serverLevel) { Entity entity = this.getOwner(); - if (!(entity instanceof Mob) || this.level().getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { + if (!(entity instanceof Mob) || serverLevel.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { BlockPos blockPos = result.getBlockPos().relative(result.getDirection()); if (this.level().isEmptyBlock(blockPos)) { this.level().setBlockAndUpdate(blockPos, BaseFireBlock.getState(this.level(), blockPos)); @@ -67,9 +67,4 @@ public class SmallFireball extends Fireball { this.discard(); } } - - @Override - public boolean hurt(DamageSource source, float amount) { - return false; - } } diff --git a/net/minecraft/world/entity/projectile/Snowball.java b/net/minecraft/world/entity/projectile/Snowball.java index 3d83dfb9..8161b653 100644 --- a/net/minecraft/world/entity/projectile/Snowball.java +++ b/net/minecraft/world/entity/projectile/Snowball.java @@ -19,12 +19,12 @@ public class Snowball extends ThrowableItemProjectile { super(entityType, level); } - public Snowball(Level level, LivingEntity shooter) { - super(EntityType.SNOWBALL, shooter, level); + public Snowball(Level level, LivingEntity livingEntity, ItemStack itemStack) { + super(EntityType.SNOWBALL, livingEntity, level, itemStack); } - public Snowball(Level level, double x, double y, double z) { - super(EntityType.SNOWBALL, x, y, z, level); + public Snowball(Level level, double d, double e, double f, ItemStack itemStack) { + super(EntityType.SNOWBALL, d, e, f, level, itemStack); } @Override diff --git a/net/minecraft/world/entity/projectile/SpectralArrow.java b/net/minecraft/world/entity/projectile/SpectralArrow.java index af97b750..c5c7a9e5 100644 --- a/net/minecraft/world/entity/projectile/SpectralArrow.java +++ b/net/minecraft/world/entity/projectile/SpectralArrow.java @@ -29,7 +29,7 @@ public class SpectralArrow extends AbstractArrow { @Override public void tick() { super.tick(); - if (this.level().isClientSide && !this.inGround) { + if (this.level().isClientSide && !this.isInGround()) { this.level().addParticle(ParticleTypes.INSTANT_EFFECT, this.getX(), this.getY(), this.getZ(), 0.0, 0.0, 0.0); } } diff --git a/net/minecraft/world/entity/projectile/ThrowableItemProjectile.java b/net/minecraft/world/entity/projectile/ThrowableItemProjectile.java index 0590dbc9..9c38c9ab 100644 --- a/net/minecraft/world/entity/projectile/ThrowableItemProjectile.java +++ b/net/minecraft/world/entity/projectile/ThrowableItemProjectile.java @@ -4,6 +4,7 @@ import net.minecraft.nbt.CompoundTag; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.network.syncher.SynchedEntityData.Builder; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.item.Item; @@ -19,12 +20,14 @@ public abstract class ThrowableItemProjectile extends ThrowableProjectile implem super(entityType, level); } - public ThrowableItemProjectile(EntityType entityType, double x, double y, double z, Level level) { - super(entityType, x, y, z, level); + public ThrowableItemProjectile(EntityType entityType, double d, double e, double f, Level level, ItemStack itemStack) { + super(entityType, d, e, f, level); + this.setItem(itemStack); } - public ThrowableItemProjectile(EntityType entityType, LivingEntity shooter, Level level) { - super(entityType, shooter, level); + public ThrowableItemProjectile(EntityType entityType, LivingEntity livingEntity, Level level, ItemStack itemStack) { + this(entityType, livingEntity.getX(), livingEntity.getEyeY() - 0.1F, livingEntity.getZ(), level, itemStack); + this.setOwner(livingEntity); } public void setItem(ItemStack stack) { @@ -39,7 +42,7 @@ public abstract class ThrowableItemProjectile extends ThrowableProjectile implem } @Override - protected void defineSynchedData(SynchedEntityData.Builder builder) { + protected void defineSynchedData(Builder builder) { builder.define(DATA_ITEM_STACK, new ItemStack(this.getDefaultItem())); } diff --git a/net/minecraft/world/entity/projectile/ThrowableProjectile.java b/net/minecraft/world/entity/projectile/ThrowableProjectile.java index 08283833..742559a0 100644 --- a/net/minecraft/world/entity/projectile/ThrowableProjectile.java +++ b/net/minecraft/world/entity/projectile/ThrowableProjectile.java @@ -1,13 +1,18 @@ package net.minecraft.world.entity.projectile; +import net.minecraft.core.BlockPos; import net.minecraft.core.particles.ParticleTypes; import net.minecraft.world.entity.EntityType; -import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.HitResult; import net.minecraft.world.phys.Vec3; +import net.minecraft.world.phys.HitResult.Type; public abstract class ThrowableProjectile extends Projectile { + private static final float MIN_CAMERA_DISTANCE_SQUARED = 12.25F; + protected ThrowableProjectile(EntityType entityType, Level level) { super(entityType, level); } @@ -17,20 +22,19 @@ public abstract class ThrowableProjectile extends Projectile { this.setPos(x, y, z); } - protected ThrowableProjectile(EntityType entityType, LivingEntity shooter, Level level) { - this(entityType, shooter.getX(), shooter.getEyeY() - 0.1F, shooter.getZ(), level); - this.setOwner(shooter); - } - @Override public boolean shouldRenderAtSqrDistance(double distance) { - double d = this.getBoundingBox().getSize() * 4.0; - if (Double.isNaN(d)) { - d = 4.0; - } + if (this.tickCount < 2 && distance < 12.25) { + return false; + } else { + double d = this.getBoundingBox().getSize() * 4.0; + if (Double.isNaN(d)) { + d = 4.0; + } - d *= 64.0; - return distance < d * d; + d *= 64.0; + return distance < d * d; + } } @Override @@ -40,33 +44,53 @@ public abstract class ThrowableProjectile extends Projectile { @Override public void tick() { - super.tick(); + this.handleFirstTickBubbleColumn(); + this.applyGravity(); + this.applyInertia(); HitResult hitResult = ProjectileUtil.getHitResultOnMoveVector(this, this::canHitEntity); - if (hitResult.getType() != HitResult.Type.MISS) { + Vec3 vec3; + if (hitResult.getType() != Type.MISS) { + vec3 = hitResult.getLocation(); + } else { + vec3 = this.position().add(this.getDeltaMovement()); + } + + this.setPos(vec3); + this.updateRotation(); + this.applyEffectsFromBlocks(); + super.tick(); + if (hitResult.getType() != Type.MISS && this.isAlive()) { this.hitTargetOrDeflectSelf(hitResult); } + } - this.checkInsideBlocks(); + private void applyInertia() { Vec3 vec3 = this.getDeltaMovement(); - double d = this.getX() + vec3.x; - double e = this.getY() + vec3.y; - double f = this.getZ() + vec3.z; - this.updateRotation(); - float h; + Vec3 vec32 = this.position(); + float g; if (this.isInWater()) { for (int i = 0; i < 4; i++) { - float g = 0.25F; - this.level().addParticle(ParticleTypes.BUBBLE, d - vec3.x * 0.25, e - vec3.y * 0.25, f - vec3.z * 0.25, vec3.x, vec3.y, vec3.z); + float f = 0.25F; + this.level().addParticle(ParticleTypes.BUBBLE, vec32.x - vec3.x * 0.25, vec32.y - vec3.y * 0.25, vec32.z - vec3.z * 0.25, vec3.x, vec3.y, vec3.z); } - h = 0.8F; + g = 0.8F; } else { - h = 0.99F; + g = 0.99F; } - this.setDeltaMovement(vec3.scale(h)); - this.applyGravity(); - this.setPos(d, e, f); + this.setDeltaMovement(vec3.scale(g)); + } + + private void handleFirstTickBubbleColumn() { + if (this.firstTick) { + for (BlockPos blockPos : BlockPos.betweenClosed(this.getBoundingBox())) { + BlockState blockState = this.level().getBlockState(blockPos); + if (blockState.is(Blocks.BUBBLE_COLUMN)) { + blockState.entityInside(this.level(), blockPos, this); + } + } + } } @Override diff --git a/net/minecraft/world/entity/projectile/ThrownEgg.java b/net/minecraft/world/entity/projectile/ThrownEgg.java index a9b38d02..59cc1a47 100644 --- a/net/minecraft/world/entity/projectile/ThrownEgg.java +++ b/net/minecraft/world/entity/projectile/ThrownEgg.java @@ -3,10 +3,12 @@ package net.minecraft.world.entity.projectile; import net.minecraft.core.particles.ItemParticleOption; import net.minecraft.core.particles.ParticleTypes; import net.minecraft.world.entity.EntityDimensions; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.animal.Chicken; import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.level.Level; import net.minecraft.world.phys.EntityHitResult; @@ -19,12 +21,12 @@ public class ThrownEgg extends ThrowableItemProjectile { super(entityType, level); } - public ThrownEgg(Level level, LivingEntity shooter) { - super(EntityType.EGG, shooter, level); + public ThrownEgg(Level level, LivingEntity livingEntity, ItemStack itemStack) { + super(EntityType.EGG, livingEntity, level, itemStack); } - public ThrownEgg(Level level, double x, double y, double z) { - super(EntityType.EGG, x, y, z, level); + public ThrownEgg(Level level, double d, double e, double f, ItemStack itemStack) { + super(EntityType.EGG, d, e, f, level, itemStack); } @Override @@ -64,7 +66,7 @@ public class ThrownEgg extends ThrowableItemProjectile { } for (int j = 0; j < i; j++) { - Chicken chicken = EntityType.CHICKEN.create(this.level()); + Chicken chicken = EntityType.CHICKEN.create(this.level(), EntitySpawnReason.TRIGGERED); if (chicken != null) { chicken.setAge(-24000); chicken.moveTo(this.getX(), this.getY(), this.getZ(), this.getYRot(), 0.0F); diff --git a/net/minecraft/world/entity/projectile/ThrownEnderpearl.java b/net/minecraft/world/entity/projectile/ThrownEnderpearl.java index 72e296da..1a73efb7 100644 --- a/net/minecraft/world/entity/projectile/ThrownEnderpearl.java +++ b/net/minecraft/world/entity/projectile/ThrownEnderpearl.java @@ -1,32 +1,41 @@ package net.minecraft.world.entity.projectile; +import java.util.UUID; +import net.minecraft.core.BlockPos; +import net.minecraft.core.SectionPos; import net.minecraft.core.particles.ParticleTypes; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.Relative; import net.minecraft.world.entity.monster.Endermite; import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.level.GameRules; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.world.level.portal.DimensionTransition; +import net.minecraft.world.level.portal.TeleportTransition; import net.minecraft.world.phys.EntityHitResult; import net.minecraft.world.phys.HitResult; import net.minecraft.world.phys.Vec3; +import org.jetbrains.annotations.Nullable; public class ThrownEnderpearl extends ThrowableItemProjectile { + private long ticketTimer = 0L; + public ThrownEnderpearl(EntityType entityType, Level level) { super(entityType, level); } - public ThrownEnderpearl(Level level, LivingEntity shooter) { - super(EntityType.ENDER_PEARL, shooter, level); + public ThrownEnderpearl(Level level, LivingEntity livingEntity, ItemStack itemStack) { + super(EntityType.ENDER_PEARL, livingEntity, level, itemStack); } @Override @@ -34,6 +43,56 @@ public class ThrownEnderpearl extends ThrowableItemProjectile { return Items.ENDER_PEARL; } + @Override + protected void setOwnerThroughUUID(UUID uUID) { + this.deregisterFromCurrentOwner(); + super.setOwnerThroughUUID(uUID); + this.registerToCurrentOwner(); + } + + @Override + public void setOwner(@Nullable Entity owner) { + this.deregisterFromCurrentOwner(); + super.setOwner(owner); + this.registerToCurrentOwner(); + } + + private void deregisterFromCurrentOwner() { + if (this.getOwner() instanceof ServerPlayer serverPlayer) { + serverPlayer.deregisterEnderPearl(this); + } + } + + private void registerToCurrentOwner() { + if (this.getOwner() instanceof ServerPlayer serverPlayer) { + serverPlayer.registerEnderPearl(this); + } + } + + @Nullable + @Override + protected Entity findOwner(UUID uUID) { + if (this.level() instanceof ServerLevel serverLevel) { + Entity entity = super.findOwner(uUID); + if (entity != null) { + return entity; + } else { + for (ServerLevel serverLevel2 : serverLevel.getServer().getAllLevels()) { + if (serverLevel2 != serverLevel) { + entity = serverLevel2.getEntity(uUID); + if (entity != null) { + return entity; + } + } + } + + return null; + } + } else { + return null; + } + } + @Override protected void onHitEntity(EntityHitResult result) { super.onHitEntity(result); @@ -58,30 +117,41 @@ public class ThrownEnderpearl extends ThrowableItemProjectile { entity.unRide(); } + Vec3 vec3 = this.oldPosition(); if (entity instanceof ServerPlayer serverPlayer) { if (serverPlayer.connection.isAcceptingMessages()) { if (this.random.nextFloat() < 0.05F && serverLevel.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING)) { - Endermite endermite = EntityType.ENDERMITE.create(serverLevel); + Endermite endermite = EntityType.ENDERMITE.create(serverLevel, EntitySpawnReason.TRIGGERED); if (endermite != null) { endermite.moveTo(entity.getX(), entity.getY(), entity.getZ(), entity.getYRot(), entity.getXRot()); serverLevel.addFreshEntity(endermite); } } - entity.changeDimension( - new DimensionTransition(serverLevel, this.position(), entity.getDeltaMovement(), entity.getYRot(), entity.getXRot(), DimensionTransition.DO_NOTHING) + if (this.isOnPortalCooldown()) { + entity.setPortalCooldown(); + } + + ServerPlayer serverPlayer2 = serverPlayer.teleport( + new TeleportTransition(serverLevel, vec3, Vec3.ZERO, 0.0F, 0.0F, Relative.union(Relative.ROTATION, Relative.DELTA), TeleportTransition.DO_NOTHING) ); - entity.resetFallDistance(); - serverPlayer.resetCurrentImpulseContext(); - entity.hurt(this.damageSources().fall(), 5.0F); - this.playSound(serverLevel, this.position()); + if (serverPlayer2 != null) { + serverPlayer2.resetFallDistance(); + serverPlayer2.resetCurrentImpulseContext(); + serverPlayer2.hurtServer(serverPlayer.serverLevel(), this.damageSources().enderPearl(), 5.0F); + } + + this.playSound(serverLevel, vec3); } } else { - entity.changeDimension( - new DimensionTransition(serverLevel, this.position(), entity.getDeltaMovement(), entity.getYRot(), entity.getXRot(), DimensionTransition.DO_NOTHING) + Entity entity2 = entity.teleport( + new TeleportTransition(serverLevel, vec3, entity.getDeltaMovement(), entity.getYRot(), entity.getXRot(), TeleportTransition.DO_NOTHING) ); - entity.resetFallDistance(); - this.playSound(serverLevel, this.position()); + if (entity2 != null) { + entity2.resetFallDistance(); + } + + this.playSound(serverLevel, vec3); } this.discard(); @@ -101,23 +171,46 @@ public class ThrownEnderpearl extends ThrowableItemProjectile { @Override public void tick() { + int i = SectionPos.blockToSectionCoord(this.position().x()); + int j = SectionPos.blockToSectionCoord(this.position().z()); Entity entity = this.getOwner(); - if (entity instanceof ServerPlayer && !entity.isAlive() && this.level().getGameRules().getBoolean(GameRules.RULE_ENDER_PEARLS_VANISH_ON_DEATH)) { + if (entity instanceof ServerPlayer serverPlayer + && !entity.isAlive() + && serverPlayer.serverLevel().getGameRules().getBoolean(GameRules.RULE_ENDER_PEARLS_VANISH_ON_DEATH)) { this.discard(); } else { super.tick(); } + + if (this.isAlive()) { + BlockPos blockPos = BlockPos.containing(this.position()); + if ((--this.ticketTimer <= 0L || i != SectionPos.blockToSectionCoord(blockPos.getX()) || j != SectionPos.blockToSectionCoord(blockPos.getZ())) + && entity instanceof ServerPlayer serverPlayer2) { + this.ticketTimer = serverPlayer2.registerAndUpdateEnderPearlTicket(this); + } + } } private void playSound(Level level, Vec3 pos) { level.playSound(null, pos.x, pos.y, pos.z, SoundEvents.PLAYER_TELEPORT, SoundSource.PLAYERS); } + @Nullable @Override - public boolean canChangeDimensions(Level oldLevel, Level newLevel) { - return oldLevel.dimension() == Level.END && this.getOwner() instanceof ServerPlayer serverPlayer - ? super.canChangeDimensions(oldLevel, newLevel) && serverPlayer.seenCredits - : super.canChangeDimensions(oldLevel, newLevel); + public Entity teleport(TeleportTransition teleportTransition) { + Entity entity = super.teleport(teleportTransition); + if (entity != null) { + entity.placePortalTicket(BlockPos.containing(entity.position())); + } + + return entity; + } + + @Override + public boolean canTeleport(Level level, Level level2) { + return level.dimension() == Level.END && level2.dimension() == Level.OVERWORLD && this.getOwner() instanceof ServerPlayer serverPlayer + ? super.canTeleport(level, level2) && serverPlayer.seenCredits + : super.canTeleport(level, level2); } @Override @@ -127,4 +220,13 @@ public class ThrownEnderpearl extends ThrowableItemProjectile { serverPlayer.onInsideBlock(state); } } + + @Override + public void onRemoval(Entity.RemovalReason removalReason) { + if (removalReason != Entity.RemovalReason.UNLOADED_WITH_PLAYER) { + this.deregisterFromCurrentOwner(); + } + + super.onRemoval(removalReason); + } } diff --git a/net/minecraft/world/entity/projectile/ThrownExperienceBottle.java b/net/minecraft/world/entity/projectile/ThrownExperienceBottle.java index c4e77096..3513b5f6 100644 --- a/net/minecraft/world/entity/projectile/ThrownExperienceBottle.java +++ b/net/minecraft/world/entity/projectile/ThrownExperienceBottle.java @@ -5,6 +5,7 @@ import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.ExperienceOrb; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.item.alchemy.PotionContents; import net.minecraft.world.item.alchemy.Potions; @@ -16,12 +17,12 @@ public class ThrownExperienceBottle extends ThrowableItemProjectile { super(entityType, level); } - public ThrownExperienceBottle(Level level, LivingEntity shooter) { - super(EntityType.EXPERIENCE_BOTTLE, shooter, level); + public ThrownExperienceBottle(Level level, LivingEntity livingEntity, ItemStack itemStack) { + super(EntityType.EXPERIENCE_BOTTLE, livingEntity, level, itemStack); } - public ThrownExperienceBottle(Level level, double x, double y, double z) { - super(EntityType.EXPERIENCE_BOTTLE, x, y, z, level); + public ThrownExperienceBottle(Level level, double d, double e, double f, ItemStack itemStack) { + super(EntityType.EXPERIENCE_BOTTLE, d, e, f, level, itemStack); } @Override diff --git a/net/minecraft/world/entity/projectile/ThrownPotion.java b/net/minecraft/world/entity/projectile/ThrownPotion.java index 5af7cfe9..4dd379d9 100644 --- a/net/minecraft/world/entity/projectile/ThrownPotion.java +++ b/net/minecraft/world/entity/projectile/ThrownPotion.java @@ -7,6 +7,7 @@ import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.Holder; import net.minecraft.core.component.DataComponents; +import net.minecraft.server.level.ServerLevel; import net.minecraft.tags.BlockTags; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.effect.MobEffect; @@ -30,9 +31,10 @@ import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.EntityHitResult; import net.minecraft.world.phys.HitResult; +import net.minecraft.world.phys.HitResult.Type; import org.jetbrains.annotations.Nullable; -public class ThrownPotion extends ThrowableItemProjectile implements ItemSupplier { +public class ThrownPotion extends ThrowableItemProjectile { public static final double SPLASH_RANGE = 4.0; private static final double SPLASH_RANGE_SQ = 16.0; public static final Predicate WATER_SENSITIVE_OR_ON_FIRE = livingEntity -> livingEntity.isSensitiveToWater() || livingEntity.isOnFire(); @@ -41,12 +43,12 @@ public class ThrownPotion extends ThrowableItemProjectile implements ItemSupplie super(entityType, level); } - public ThrownPotion(Level level, LivingEntity shooter) { - super(EntityType.POTION, shooter, level); + public ThrownPotion(Level level, LivingEntity livingEntity, ItemStack itemStack) { + super(EntityType.POTION, livingEntity, level, itemStack); } - public ThrownPotion(Level level, double x, double y, double z) { - super(EntityType.POTION, x, y, z, level); + public ThrownPotion(Level level, double d, double e, double f, ItemStack itemStack) { + super(EntityType.POTION, d, e, f, level, itemStack); } @Override @@ -82,33 +84,33 @@ public class ThrownPotion extends ThrowableItemProjectile implements ItemSupplie @Override protected void onHit(HitResult result) { super.onHit(result); - if (!this.level().isClientSide) { + if (this.level() instanceof ServerLevel serverLevel) { ItemStack itemStack = this.getItem(); PotionContents potionContents = itemStack.getOrDefault(DataComponents.POTION_CONTENTS, PotionContents.EMPTY); if (potionContents.is(Potions.WATER)) { - this.applyWater(); + this.applyWater(serverLevel); } else if (potionContents.hasEffects()) { if (this.isLingering()) { this.makeAreaOfEffectCloud(potionContents); } else { - this.applySplash(potionContents.getAllEffects(), result.getType() == HitResult.Type.ENTITY ? ((EntityHitResult)result).getEntity() : null); + this.applySplash(serverLevel, potionContents.getAllEffects(), result.getType() == Type.ENTITY ? ((EntityHitResult)result).getEntity() : null); } } int i = potionContents.potion().isPresent() && ((Potion)((Holder)potionContents.potion().get()).value()).hasInstantEffects() ? 2007 : 2002; - this.level().levelEvent(i, this.blockPosition(), potionContents.getColor()); + serverLevel.levelEvent(i, this.blockPosition(), potionContents.getColor()); this.discard(); } } - private void applyWater() { + private void applyWater(ServerLevel serverLevel) { AABB aABB = this.getBoundingBox().inflate(4.0, 2.0, 4.0); for (LivingEntity livingEntity : this.level().getEntitiesOfClass(LivingEntity.class, aABB, WATER_SENSITIVE_OR_ON_FIRE)) { double d = this.distanceToSqr(livingEntity); if (d < 16.0) { if (livingEntity.isSensitiveToWater()) { - livingEntity.hurt(this.damageSources().indirectMagic(this, this.getOwner()), 1.0F); + livingEntity.hurtServer(serverLevel, this.damageSources().indirectMagic(this, this.getOwner()), 1.0F); } if (livingEntity.isOnFire() && livingEntity.isAlive()) { @@ -122,9 +124,9 @@ public class ThrownPotion extends ThrowableItemProjectile implements ItemSupplie } } - private void applySplash(Iterable effects, @Nullable Entity entity) { + private void applySplash(ServerLevel serverLevel, Iterable iterable, @Nullable Entity entity) { AABB aABB = this.getBoundingBox().inflate(4.0, 2.0, 4.0); - List list = this.level().getEntitiesOfClass(LivingEntity.class, aABB); + List list = serverLevel.getEntitiesOfClass(LivingEntity.class, aABB); if (!list.isEmpty()) { Entity entity2 = this.getEffectSource(); @@ -139,10 +141,10 @@ public class ThrownPotion extends ThrowableItemProjectile implements ItemSupplie e = 1.0 - Math.sqrt(d) / 4.0; } - for (MobEffectInstance mobEffectInstance : effects) { + for (MobEffectInstance mobEffectInstance : iterable) { Holder holder = mobEffectInstance.getEffect(); if (holder.value().isInstantenous()) { - holder.value().applyInstantenousEffect(this, this.getOwner(), livingEntity, mobEffectInstance.getAmplifier(), e); + holder.value().applyInstantenousEffect(serverLevel, this, this.getOwner(), livingEntity, mobEffectInstance.getAmplifier(), e); } else { int i = mobEffectInstance.mapDuration(ix -> (int)(e * ix + 0.5)); MobEffectInstance mobEffectInstance2 = new MobEffectInstance( diff --git a/net/minecraft/world/entity/projectile/ThrownTrident.java b/net/minecraft/world/entity/projectile/ThrownTrident.java index 545d0d23..c0812ee1 100644 --- a/net/minecraft/world/entity/projectile/ThrownTrident.java +++ b/net/minecraft/world/entity/projectile/ThrownTrident.java @@ -4,6 +4,7 @@ import net.minecraft.nbt.CompoundTag; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.network.syncher.SynchedEntityData.Builder; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.sounds.SoundEvent; @@ -46,7 +47,7 @@ public class ThrownTrident extends AbstractArrow { } @Override - protected void defineSynchedData(SynchedEntityData.Builder builder) { + protected void defineSynchedData(Builder builder) { super.defineSynchedData(builder); builder.define(ID_LOYALTY, (byte)0); builder.define(ID_FOIL, false); @@ -62,19 +63,20 @@ public class ThrownTrident extends AbstractArrow { int i = this.entityData.get(ID_LOYALTY); if (i > 0 && (this.dealtDamage || this.isNoPhysics()) && entity != null) { if (!this.isAcceptibleReturnOwner()) { - if (!this.level().isClientSide && this.pickup == AbstractArrow.Pickup.ALLOWED) { - this.spawnAtLocation(this.getPickupItem(), 0.1F); + if (this.level() instanceof ServerLevel serverLevel && this.pickup == AbstractArrow.Pickup.ALLOWED) { + this.spawnAtLocation(serverLevel, this.getPickupItem(), 0.1F); } this.discard(); } else { + if (!(entity instanceof Player) && this.position().distanceTo(entity.getEyePosition()) < entity.getBbWidth() + 1.0) { + this.discard(); + return; + } + this.setNoPhysics(true); Vec3 vec3 = entity.getEyePosition().subtract(this.position()); this.setPosRaw(this.getX(), this.getY() + vec3.y * 0.015 * i, this.getZ()); - if (this.level().isClientSide) { - this.yOld = this.getY(); - } - double d = 0.05 * i; this.setDeltaMovement(this.getDeltaMovement().scale(0.95).add(vec3.normalize().scale(d))); if (this.clientSideReturnTridentTickCount == 0) { @@ -114,13 +116,13 @@ public class ThrownTrident extends AbstractArrow { } this.dealtDamage = true; - if (entity.hurt(damageSource, f)) { + if (entity.hurtOrSimulate(damageSource, f)) { if (entity.getType() == EntityType.ENDERMAN) { return; } if (this.level() instanceof ServerLevel serverLevel) { - EnchantmentHelper.doPostAttackEffectsWithItemSource(serverLevel, entity, damageSource, this.getWeaponItem()); + EnchantmentHelper.doPostAttackEffectsWithItemSourceOnBreak(serverLevel, entity, damageSource, this.getWeaponItem(), item -> this.kill(serverLevel)); } if (entity instanceof LivingEntity livingEntity) { @@ -129,7 +131,8 @@ public class ThrownTrident extends AbstractArrow { } } - this.setDeltaMovement(this.getDeltaMovement().multiply(-0.01, -0.1, -0.01)); + this.deflect(ProjectileDeflection.REVERSE, entity, this.getOwner(), false); + this.setDeltaMovement(this.getDeltaMovement().multiply(0.02, 0.2, 0.02)); this.playSound(SoundEvents.TRIDENT_HIT, 1.0F, 1.0F); } @@ -144,7 +147,7 @@ public class ThrownTrident extends AbstractArrow { null, vec3, level.getBlockState(hitResult.getBlockPos()), - item -> this.kill() + item -> this.kill(level) ); } diff --git a/net/minecraft/world/entity/projectile/WitherSkull.java b/net/minecraft/world/entity/projectile/WitherSkull.java index 67df6064..88e6fbef 100644 --- a/net/minecraft/world/entity/projectile/WitherSkull.java +++ b/net/minecraft/world/entity/projectile/WitherSkull.java @@ -5,6 +5,7 @@ import net.minecraft.nbt.CompoundTag; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.network.syncher.SynchedEntityData.Builder; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.Difficulty; import net.minecraft.world.damagesource.DamageSource; @@ -60,7 +61,7 @@ public class WitherSkull extends AbstractHurtingProjectile { boolean bl; if (this.getOwner() instanceof LivingEntity livingEntity) { DamageSource damageSource = this.damageSources().witherSkull(this, livingEntity); - bl = var8.hurt(damageSource, 8.0F); + bl = var8.hurtServer(serverLevel, damageSource, 8.0F); if (bl) { if (var8.isAlive()) { EnchantmentHelper.doPostAttackEffects(serverLevel, var8, damageSource); @@ -69,7 +70,7 @@ public class WitherSkull extends AbstractHurtingProjectile { } } } else { - bl = var8.hurt(this.damageSources().magic(), 5.0F); + bl = var8.hurtServer(serverLevel, this.damageSources().magic(), 5.0F); } if (bl && var8 instanceof LivingEntity livingEntityx) { @@ -97,12 +98,7 @@ public class WitherSkull extends AbstractHurtingProjectile { } @Override - public boolean hurt(DamageSource source, float amount) { - return false; - } - - @Override - protected void defineSynchedData(SynchedEntityData.Builder builder) { + protected void defineSynchedData(Builder builder) { builder.define(DATA_DANGEROUS, false); } diff --git a/net/minecraft/world/entity/projectile/windcharge/AbstractWindCharge.java b/net/minecraft/world/entity/projectile/windcharge/AbstractWindCharge.java index 45c9f3b6..fbf7685d 100644 --- a/net/minecraft/world/entity/projectile/windcharge/AbstractWindCharge.java +++ b/net/minecraft/world/entity/projectile/windcharge/AbstractWindCharge.java @@ -27,7 +27,7 @@ import org.jetbrains.annotations.Nullable; public abstract class AbstractWindCharge extends AbstractHurtingProjectile implements ItemSupplier { public static final ExplosionDamageCalculator EXPLOSION_DAMAGE_CALCULATOR = new SimpleExplosionDamageCalculator( - true, false, Optional.empty(), BuiltInRegistries.BLOCK.getTag(BlockTags.BLOCKS_WIND_CHARGE_EXPLOSIONS).map(Function.identity()) + true, false, Optional.empty(), BuiltInRegistries.BLOCK.get(BlockTags.BLOCKS_WIND_CHARGE_EXPLOSIONS).map(Function.identity()) ); public static final double JUMP_SCALE = 0.25; @@ -74,7 +74,7 @@ public abstract class AbstractWindCharge extends AbstractHurtingProjectile imple @Override protected void onHitEntity(EntityHitResult result) { super.onHitEntity(result); - if (!this.level().isClientSide) { + if (this.level() instanceof ServerLevel serverLevel) { LivingEntity livingEntity2 = this.getOwner() instanceof LivingEntity livingEntity ? livingEntity : null; Entity entity = result.getEntity(); if (livingEntity2 != null) { @@ -82,8 +82,8 @@ public abstract class AbstractWindCharge extends AbstractHurtingProjectile imple } DamageSource damageSource = this.damageSources().windCharge(this, livingEntity2); - if (entity.hurt(damageSource, 1.0F) && entity instanceof LivingEntity livingEntity3) { - EnchantmentHelper.doPostAttackEffects((ServerLevel)this.level(), livingEntity3, damageSource); + if (entity.hurtServer(serverLevel, damageSource, 1.0F) && entity instanceof LivingEntity livingEntity3) { + EnchantmentHelper.doPostAttackEffects(serverLevel, livingEntity3, damageSource); } this.explode(this.position()); @@ -100,7 +100,7 @@ public abstract class AbstractWindCharge extends AbstractHurtingProjectile imple protected void onHitBlock(BlockHitResult result) { super.onHitBlock(result); if (!this.level().isClientSide) { - Vec3i vec3i = result.getDirection().getNormal(); + Vec3i vec3i = result.getDirection().getUnitVec3i(); Vec3 vec3 = Vec3.atLowerCornerOf(vec3i).multiply(0.25, 0.25, 0.25); Vec3 vec32 = result.getLocation().add(vec3); this.explode(vec32); @@ -144,16 +144,11 @@ public abstract class AbstractWindCharge extends AbstractHurtingProjectile imple @Override public void tick() { - if (!this.level().isClientSide && this.getBlockY() > this.level().getMaxBuildHeight() + 30) { + if (!this.level().isClientSide && this.getBlockY() > this.level().getMaxY() + 30) { this.explode(this.position()); this.discard(); } else { super.tick(); } } - - @Override - public boolean hurt(DamageSource source, float amount) { - return false; - } } diff --git a/net/minecraft/world/entity/projectile/windcharge/BreezeWindCharge.java b/net/minecraft/world/entity/projectile/windcharge/BreezeWindCharge.java index 5cc5fe64..bc57a033 100644 --- a/net/minecraft/world/entity/projectile/windcharge/BreezeWindCharge.java +++ b/net/minecraft/world/entity/projectile/windcharge/BreezeWindCharge.java @@ -15,7 +15,7 @@ public class BreezeWindCharge extends AbstractWindCharge { } public BreezeWindCharge(Breeze breeze, Level level) { - super(EntityType.BREEZE_WIND_CHARGE, level, breeze, breeze.getX(), breeze.getSnoutYPosition(), breeze.getZ()); + super(EntityType.BREEZE_WIND_CHARGE, level, breeze, breeze.getX(), breeze.getFiringYPosition(), breeze.getZ()); } @Override diff --git a/net/minecraft/world/entity/projectile/windcharge/WindCharge.java b/net/minecraft/world/entity/projectile/windcharge/WindCharge.java index 78cff0c9..52a4c2c7 100644 --- a/net/minecraft/world/entity/projectile/windcharge/WindCharge.java +++ b/net/minecraft/world/entity/projectile/windcharge/WindCharge.java @@ -6,6 +6,7 @@ import net.minecraft.core.particles.ParticleTypes; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.sounds.SoundEvents; import net.minecraft.tags.BlockTags; +import net.minecraft.util.Mth; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.player.Player; @@ -18,9 +19,10 @@ import org.jetbrains.annotations.Nullable; public class WindCharge extends AbstractWindCharge { private static final ExplosionDamageCalculator EXPLOSION_DAMAGE_CALCULATOR = new SimpleExplosionDamageCalculator( - true, false, Optional.of(1.22F), BuiltInRegistries.BLOCK.getTag(BlockTags.BLOCKS_WIND_CHARGE_EXPLOSIONS).map(Function.identity()) + true, false, Optional.of(1.22F), BuiltInRegistries.BLOCK.get(BlockTags.BLOCKS_WIND_CHARGE_EXPLOSIONS).map(Function.identity()) ); private static final float RADIUS = 1.2F; + private static final float MIN_CAMERA_DISTANCE_SQUARED = Mth.square(3.5F); private int noDeflectTicks = 5; public WindCharge(EntityType entityType, Level level) { @@ -66,4 +68,9 @@ public class WindCharge extends AbstractWindCharge { SoundEvents.WIND_CHARGE_BURST ); } + + @Override + public boolean shouldRenderAtSqrDistance(double distance) { + return this.tickCount < 2 && distance < MIN_CAMERA_DISTANCE_SQUARED ? false : super.shouldRenderAtSqrDistance(distance); + } } diff --git a/net/minecraft/world/entity/projectile/windcharge/package-info.java b/net/minecraft/world/entity/projectile/windcharge/package-info.java new file mode 100644 index 00000000..16bc306c --- /dev/null +++ b/net/minecraft/world/entity/projectile/windcharge/package-info.java @@ -0,0 +1,8 @@ +@ParametersAreNonnullByDefault +@MethodsReturnNonnullByDefault +@FieldsAreNonnullByDefault +package net.minecraft.world.entity.projectile.windcharge; + +import javax.annotation.ParametersAreNonnullByDefault; +import net.minecraft.FieldsAreNonnullByDefault; +import net.minecraft.MethodsReturnNonnullByDefault; diff --git a/net/minecraft/world/entity/raid/Raid.java b/net/minecraft/world/entity/raid/Raid.java index d461e4d4..54a7745d 100644 --- a/net/minecraft/world/entity/raid/Raid.java +++ b/net/minecraft/world/entity/raid/Raid.java @@ -13,7 +13,6 @@ import java.util.Set; import java.util.UUID; import java.util.function.Predicate; import java.util.stream.Stream; -import net.minecraft.ChatFormatting; import net.minecraft.advancements.CriteriaTriggers; import net.minecraft.core.BlockPos; import net.minecraft.core.HolderGetter; @@ -35,39 +34,41 @@ import net.minecraft.stats.Stats; import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; import net.minecraft.util.Unit; -import net.minecraft.world.BossEvent; import net.minecraft.world.Difficulty; import net.minecraft.world.DifficultyInstance; +import net.minecraft.world.BossEvent.BossBarColor; +import net.minecraft.world.BossEvent.BossBarOverlay; import net.minecraft.world.effect.MobEffectInstance; import net.minecraft.world.effect.MobEffects; import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.entity.MobSpawnType; import net.minecraft.world.entity.SpawnPlacementType; import net.minecraft.world.entity.SpawnPlacements; import net.minecraft.world.item.DyeColor; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; +import net.minecraft.world.item.Rarity; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.entity.BannerPattern; import net.minecraft.world.level.block.entity.BannerPatternLayers; import net.minecraft.world.level.block.entity.BannerPatterns; +import net.minecraft.world.level.block.entity.BannerPatternLayers.Builder; import net.minecraft.world.level.levelgen.Heightmap; import net.minecraft.world.phys.Vec3; import org.jetbrains.annotations.Nullable; public class Raid { + public static final SpawnPlacementType RAVAGER_SPAWN_PLACEMENT_TYPE = SpawnPlacements.getPlacementType(EntityType.RAVAGER); + private static final int ALLOW_SPAWNING_WITHIN_VILLAGE_SECONDS_THRESHOLD = 7; private static final int SECTION_RADIUS_FOR_FINDING_NEW_VILLAGE_CENTER = 2; - private static final int ATTEMPT_RAID_FARTHEST = 0; - private static final int ATTEMPT_RAID_CLOSE = 1; - private static final int ATTEMPT_RAID_INSIDE = 2; private static final int VILLAGE_SEARCH_RADIUS = 32; private static final int RAID_TIMEOUT_TICKS = 48000; - private static final int NUM_SPAWN_ATTEMPTS = 3; - private static final Component OMINOUS_BANNER_PATTERN_NAME = Component.translatable("block.minecraft.ominous_banner").withStyle(ChatFormatting.GOLD); + private static final int NUM_SPAWN_ATTEMPTS = 5; + private static final Component OMINOUS_BANNER_PATTERN_NAME = Component.translatable("block.minecraft.ominous_banner"); private static final String RAIDERS_REMAINING = "event.minecraft.raid.raiders_remaining"; public static final int VILLAGE_RADIUS_BUFFER = 16; private static final int POST_RAID_TICK_LIMIT = 40; @@ -82,6 +83,7 @@ public class Raid { private static final Component RAID_BAR_VICTORY_COMPONENT = Component.translatable("event.minecraft.raid.victory.full"); private static final Component RAID_BAR_DEFEAT_COMPONENT = Component.translatable("event.minecraft.raid.defeat.full"); private static final int HERO_OF_THE_VILLAGE_DURATION = 48000; + private static final int VALID_RAID_RADIUS = 96; public static final int VALID_RAID_RADIUS_SQR = 9216; public static final int RAID_REMOVAL_THRESHOLD_SQR = 12544; private final Map groupToLeaderMap = Maps.newHashMap(); @@ -96,7 +98,7 @@ public class Raid { private int raidOmenLevel; private boolean active; private int groupsSpawned; - private final ServerBossEvent raidEvent = new ServerBossEvent(RAID_NAME_COMPONENT, BossEvent.BossBarColor.RED, BossEvent.BossBarOverlay.NOTCHED_10); + private final ServerBossEvent raidEvent = new ServerBossEvent(RAID_NAME_COMPONENT, BossBarColor.RED, BossBarOverlay.NOTCHED_10); private int postRaidTicks; private int raidCooldownTicks; private final RandomSource random = RandomSource.create(); @@ -298,14 +300,7 @@ public class Raid { } if (bl3) { - int j = 0; - if (this.raidCooldownTicks < 100) { - j = 1; - } else if (this.raidCooldownTicks < 40) { - j = 2; - } - - this.waveSpawnPos = this.getValidSpawnPos(j); + this.waveSpawnPos = this.getValidSpawnPos(); } if (this.raidCooldownTicks == 300 || this.raidCooldownTicks % 20 == 0) { @@ -332,10 +327,10 @@ public class Raid { } boolean bl2x = false; - int k = 0; + int j = 0; while (this.shouldSpawnGroup()) { - BlockPos blockPos = this.waveSpawnPos.isPresent() ? (BlockPos)this.waveSpawnPos.get() : this.findRandomSpawnPos(k, 20); + BlockPos blockPos = (BlockPos)this.waveSpawnPos.orElseGet(() -> this.findRandomSpawnPos(20)); if (blockPos != null) { this.started = true; this.spawnGroup(blockPos); @@ -344,10 +339,10 @@ public class Raid { bl2x = true; } } else { - k++; + j++; } - if (k > 3) { + if (j > 5) { this.stop(); break; } @@ -402,15 +397,9 @@ public class Raid { .ifPresent(this::setCenter); } - private Optional getValidSpawnPos(int offsetMultiplier) { - for (int i = 0; i < 3; i++) { - BlockPos blockPos = this.findRandomSpawnPos(offsetMultiplier, 1); - if (blockPos != null) { - return Optional.of(blockPos); - } - } - - return Optional.empty(); + private Optional getValidSpawnPos() { + BlockPos blockPos = this.findRandomSpawnPos(8); + return blockPos != null ? Optional.of(blockPos) : Optional.empty(); } private boolean hasMoreWaves() { @@ -462,6 +451,9 @@ public class Raid { for (Raider raider2 : set) { this.removeFromRaid(raider2, true); + if (raider2.isPatrolLeader()) { + this.removeLeader(raider2.getWave()); + } } } @@ -495,7 +487,7 @@ public class Raid { int k = 0; for (int l = 0; l < j; l++) { - Raider raider = raiderType.entityType.create(this.level); + Raider raider = raiderType.entityType.create(this.level, EntitySpawnReason.EVENT); if (raider == null) { break; } @@ -510,12 +502,12 @@ public class Raid { if (raiderType.entityType == EntityType.RAVAGER) { Raider raider2 = null; if (i == this.getNumGroups(Difficulty.NORMAL)) { - raider2 = EntityType.PILLAGER.create(this.level); + raider2 = EntityType.PILLAGER.create(this.level, EntitySpawnReason.EVENT); } else if (i >= this.getNumGroups(Difficulty.HARD)) { if (k == 0) { - raider2 = EntityType.EVOKER.create(this.level); + raider2 = EntityType.EVOKER.create(this.level, EntitySpawnReason.EVENT); } else { - raider2 = EntityType.VINDICATOR.create(this.level); + raider2 = EntityType.VINDICATOR.create(this.level, EntitySpawnReason.EVENT); } } @@ -544,7 +536,7 @@ public class Raid { raider.setTicksOutsideRaid(0); if (!isRecruited && pos != null) { raider.setPos(pos.getX() + 0.5, pos.getY() + 1.0, pos.getZ() + 0.5); - raider.finalizeSpawn(this.level, this.level.getCurrentDifficultyAt(pos), MobSpawnType.EVENT, null); + raider.finalizeSpawn(this.level, this.level.getCurrentDifficultyAt(pos), EntitySpawnReason.EVENT, null); raider.applyRaidBuffs(this.level, wave, false); raider.setOnGround(true); this.level.addFreshEntityWithPassengers(raider); @@ -596,21 +588,22 @@ public class Raid { this.level.getRaids().setDirty(); } - public static ItemStack getLeaderBannerInstance(HolderGetter patternRegistry) { + public static ItemStack getOminousBannerInstance(HolderGetter holderGetter) { ItemStack itemStack = new ItemStack(Items.WHITE_BANNER); - BannerPatternLayers bannerPatternLayers = new BannerPatternLayers.Builder() - .addIfRegistered(patternRegistry, BannerPatterns.RHOMBUS_MIDDLE, DyeColor.CYAN) - .addIfRegistered(patternRegistry, BannerPatterns.STRIPE_BOTTOM, DyeColor.LIGHT_GRAY) - .addIfRegistered(patternRegistry, BannerPatterns.STRIPE_CENTER, DyeColor.GRAY) - .addIfRegistered(patternRegistry, BannerPatterns.BORDER, DyeColor.LIGHT_GRAY) - .addIfRegistered(patternRegistry, BannerPatterns.STRIPE_MIDDLE, DyeColor.BLACK) - .addIfRegistered(patternRegistry, BannerPatterns.HALF_HORIZONTAL, DyeColor.LIGHT_GRAY) - .addIfRegistered(patternRegistry, BannerPatterns.CIRCLE_MIDDLE, DyeColor.LIGHT_GRAY) - .addIfRegistered(patternRegistry, BannerPatterns.BORDER, DyeColor.BLACK) + BannerPatternLayers bannerPatternLayers = new Builder() + .addIfRegistered(holderGetter, BannerPatterns.RHOMBUS_MIDDLE, DyeColor.CYAN) + .addIfRegistered(holderGetter, BannerPatterns.STRIPE_BOTTOM, DyeColor.LIGHT_GRAY) + .addIfRegistered(holderGetter, BannerPatterns.STRIPE_CENTER, DyeColor.GRAY) + .addIfRegistered(holderGetter, BannerPatterns.BORDER, DyeColor.LIGHT_GRAY) + .addIfRegistered(holderGetter, BannerPatterns.STRIPE_MIDDLE, DyeColor.BLACK) + .addIfRegistered(holderGetter, BannerPatterns.HALF_HORIZONTAL, DyeColor.LIGHT_GRAY) + .addIfRegistered(holderGetter, BannerPatterns.CIRCLE_MIDDLE, DyeColor.LIGHT_GRAY) + .addIfRegistered(holderGetter, BannerPatterns.BORDER, DyeColor.BLACK) .build(); itemStack.set(DataComponents.BANNER_PATTERNS, bannerPatternLayers); itemStack.set(DataComponents.HIDE_ADDITIONAL_TOOLTIP, Unit.INSTANCE); itemStack.set(DataComponents.ITEM_NAME, OMINOUS_BANNER_PATTERN_NAME); + itemStack.set(DataComponents.RARITY, Rarity.UNCOMMON); return itemStack; } @@ -620,26 +613,29 @@ public class Raid { } @Nullable - private BlockPos findRandomSpawnPos(int offsetMultiplier, int maxTry) { - int i = offsetMultiplier == 0 ? 2 : 2 - offsetMultiplier; + private BlockPos findRandomSpawnPos(int i) { + int j = this.raidCooldownTicks / 20; + float f = 0.22F * j - 0.24F; BlockPos.MutableBlockPos mutableBlockPos = new BlockPos.MutableBlockPos(); - SpawnPlacementType spawnPlacementType = SpawnPlacements.getPlacementType(EntityType.RAVAGER); + float g = this.level.random.nextFloat() * (float) (Math.PI * 2); - for (int j = 0; j < maxTry; j++) { - float f = this.level.random.nextFloat() * (float) (Math.PI * 2); - int k = this.center.getX() + Mth.floor(Mth.cos(f) * 32.0F * i) + this.level.random.nextInt(5); - int l = this.center.getZ() + Mth.floor(Mth.sin(f) * 32.0F * i) + this.level.random.nextInt(5); - int m = this.level.getHeight(Heightmap.Types.WORLD_SURFACE, k, l); - mutableBlockPos.set(k, m, l); - if (!this.level.isVillage(mutableBlockPos) || offsetMultiplier >= 2) { - int n = 10; - if (this.level.hasChunksAt(mutableBlockPos.getX() - 10, mutableBlockPos.getZ() - 10, mutableBlockPos.getX() + 10, mutableBlockPos.getZ() + 10) - && this.level.isPositionEntityTicking(mutableBlockPos) - && ( - spawnPlacementType.isSpawnPositionOk(this.level, mutableBlockPos, EntityType.RAVAGER) - || this.level.getBlockState(mutableBlockPos.below()).is(Blocks.SNOW) && this.level.getBlockState(mutableBlockPos).isAir() - )) { - return mutableBlockPos; + for (int k = 0; k < i; k++) { + float h = g + (float) Math.PI * k / 8.0F; + int l = this.center.getX() + Mth.floor(Mth.cos(h) * 32.0F * f) + this.level.random.nextInt(3) * Mth.floor(f); + int m = this.center.getZ() + Mth.floor(Mth.sin(h) * 32.0F * f) + this.level.random.nextInt(3) * Mth.floor(f); + int n = this.level.getHeight(Heightmap.Types.WORLD_SURFACE, l, m); + if (Mth.abs(n - this.center.getY()) <= 96) { + mutableBlockPos.set(l, n, m); + if (!this.level.isVillage(mutableBlockPos) || j <= 7) { + int o = 10; + if (this.level.hasChunksAt(mutableBlockPos.getX() - 10, mutableBlockPos.getZ() - 10, mutableBlockPos.getX() + 10, mutableBlockPos.getZ() + 10) + && this.level.isPositionEntityTicking(mutableBlockPos) + && ( + RAVAGER_SPAWN_PLACEMENT_TYPE.isSpawnPositionOk(this.level, mutableBlockPos, EntityType.RAVAGER) + || this.level.getBlockState(mutableBlockPos.below()).is(Blocks.SNOW) && this.level.getBlockState(mutableBlockPos).isAir() + )) { + return mutableBlockPos; + } } } } @@ -680,7 +676,7 @@ public class Raid { public void setLeader(int wave, Raider raider) { this.groupToLeaderMap.put(wave, raider); - raider.setItemSlot(EquipmentSlot.HEAD, getLeaderBannerInstance(raider.registryAccess().lookupOrThrow(Registries.BANNER_PATTERN))); + raider.setItemSlot(EquipmentSlot.HEAD, getOminousBannerInstance(raider.registryAccess().lookupOrThrow(Registries.BANNER_PATTERN))); raider.setDropChance(EquipmentSlot.HEAD, 2.0F); } diff --git a/net/minecraft/world/entity/raid/Raider.java b/net/minecraft/world/entity/raid/Raider.java index c6128155..d6dd58c9 100644 --- a/net/minecraft/world/entity/raid/Raider.java +++ b/net/minecraft/world/entity/raid/Raider.java @@ -1,6 +1,7 @@ package net.minecraft.world.entity.raid; import com.google.common.collect.Lists; +import it.unimi.dsi.fastutil.ints.Int2LongOpenHashMap; import java.util.EnumSet; import java.util.List; import java.util.Objects; @@ -12,16 +13,18 @@ import net.minecraft.nbt.CompoundTag; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.network.syncher.SynchedEntityData.Builder; import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundEvent; import net.minecraft.world.DifficultyInstance; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.entity.MobSpawnType; import net.minecraft.world.entity.SpawnGroupData; +import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.entity.ai.goal.Goal; import net.minecraft.world.entity.ai.goal.PathfindToRaidGoal; import net.minecraft.world.entity.ai.targeting.TargetingConditions; @@ -34,6 +37,7 @@ import net.minecraft.world.entity.monster.PatrollingMonster; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; import net.minecraft.world.level.ServerLevelAccessor; +import net.minecraft.world.level.pathfinder.Path; import net.minecraft.world.phys.Vec3; import org.jetbrains.annotations.Nullable; @@ -41,7 +45,7 @@ public abstract class Raider extends PatrollingMonster { protected static final EntityDataAccessor IS_CELEBRATING = SynchedEntityData.defineId(Raider.class, EntityDataSerializers.BOOLEAN); static final Predicate ALLOWED_ITEMS = itemEntity -> !itemEntity.hasPickUpDelay() && itemEntity.isAlive() - && ItemStack.matches(itemEntity.getItem(), Raid.getLeaderBannerInstance(itemEntity.registryAccess().lookupOrThrow(Registries.BANNER_PATTERN))); + && ItemStack.matches(itemEntity.getItem(), Raid.getOminousBannerInstance(itemEntity.registryAccess().lookupOrThrow(Registries.BANNER_PATTERN))); @Nullable protected Raid raid; private int wave; @@ -62,7 +66,7 @@ public abstract class Raider extends PatrollingMonster { } @Override - protected void defineSynchedData(SynchedEntityData.Builder builder) { + protected void defineSynchedData(Builder builder) { super.defineSynchedData(builder); builder.define(IS_CELEBRATING, false); } @@ -144,7 +148,7 @@ public abstract class Raider extends PatrollingMonster { public boolean isCaptain() { ItemStack itemStack = this.getItemBySlot(EquipmentSlot.HEAD); boolean bl = !itemStack.isEmpty() - && ItemStack.matches(itemStack, Raid.getLeaderBannerInstance(this.registryAccess().lookupOrThrow(Registries.BANNER_PATTERN))); + && ItemStack.matches(itemStack, Raid.getOminousBannerInstance(this.registryAccess().lookupOrThrow(Registries.BANNER_PATTERN))); boolean bl2 = this.isPatrolLeader(); return bl && bl2; } @@ -203,17 +207,17 @@ public abstract class Raider extends PatrollingMonster { } @Override - protected void pickUpItem(ItemEntity itemEntity) { + protected void pickUpItem(ServerLevel serverLevel, ItemEntity itemEntity) { ItemStack itemStack = itemEntity.getItem(); boolean bl = this.hasActiveRaid() && this.getCurrentRaid().getLeader(this.getWave()) != null; - if (this.hasActiveRaid() && !bl && ItemStack.matches(itemStack, Raid.getLeaderBannerInstance(this.registryAccess().lookupOrThrow(Registries.BANNER_PATTERN))) - ) - { + if (this.hasActiveRaid() + && !bl + && ItemStack.matches(itemStack, Raid.getOminousBannerInstance(this.registryAccess().lookupOrThrow(Registries.BANNER_PATTERN)))) { EquipmentSlot equipmentSlot = EquipmentSlot.HEAD; ItemStack itemStack2 = this.getItemBySlot(equipmentSlot); double d = this.getEquipmentDropChance(equipmentSlot); if (!itemStack2.isEmpty() && Math.max(this.random.nextFloat() - 0.1F, 0.0F) < d) { - this.spawnAtLocation(itemStack2); + this.spawnAtLocation(serverLevel, itemStack2); } this.onItemPickup(itemEntity); @@ -223,7 +227,7 @@ public abstract class Raider extends PatrollingMonster { this.getCurrentRaid().setLeader(this.getWave(), this); this.setPatrolLeader(true); } else { - super.pickUpItem(itemEntity); + super.pickUpItem(serverLevel, itemEntity); } } @@ -246,19 +250,21 @@ public abstract class Raider extends PatrollingMonster { } @Override - public boolean hurt(DamageSource source, float amount) { + public boolean hurtServer(ServerLevel serverLevel, DamageSource damageSource, float f) { if (this.hasActiveRaid()) { this.getCurrentRaid().updateBossbar(); } - return super.hurt(source, amount); + return super.hurtServer(serverLevel, damageSource, f); } @Nullable @Override - public SpawnGroupData finalizeSpawn(ServerLevelAccessor level, DifficultyInstance difficulty, MobSpawnType spawnType, @Nullable SpawnGroupData spawnGroupData) { - this.setCanJoinRaid(this.getType() != EntityType.WITCH || spawnType != MobSpawnType.NATURAL); - return super.finalizeSpawn(level, difficulty, spawnType, spawnGroupData); + public SpawnGroupData finalizeSpawn( + ServerLevelAccessor serverLevelAccessor, DifficultyInstance difficultyInstance, EntitySpawnReason entitySpawnReason, @Nullable SpawnGroupData spawnGroupData + ) { + this.setCanJoinRaid(this.getType() != EntityType.WITCH || entitySpawnReason != EntitySpawnReason.NATURAL); + return super.finalizeSpawn(serverLevelAccessor, difficultyInstance, entitySpawnReason, spawnGroupData); } public abstract SoundEvent getCelebrateSound(); @@ -289,7 +295,8 @@ public abstract class Raider extends PatrollingMonster { super.start(); this.mob.getNavigation().stop(); - for (Raider raider : this.mob.level().getNearbyEntities(Raider.class, this.shoutTargeting, this.mob, this.mob.getBoundingBox().inflate(8.0, 8.0, 8.0))) { + for (Raider raider : getServerLevel(this.mob) + .getNearbyEntities(Raider.class, this.shoutTargeting, this.mob, this.mob.getBoundingBox().inflate(8.0, 8.0, 8.0))) { raider.setTarget(this.mob.getTarget()); } } @@ -299,7 +306,8 @@ public abstract class Raider extends PatrollingMonster { super.stop(); LivingEntity livingEntity = this.mob.getTarget(); if (livingEntity != null) { - for (Raider raider : this.mob.level().getNearbyEntities(Raider.class, this.shoutTargeting, this.mob, this.mob.getBoundingBox().inflate(8.0, 8.0, 8.0))) { + for (Raider raider : getServerLevel(this.mob) + .getNearbyEntities(Raider.class, this.shoutTargeting, this.mob, this.mob.getBoundingBox().inflate(8.0, 8.0, 8.0))) { raider.setTarget(livingEntity); raider.setAggressive(true); } @@ -333,6 +341,11 @@ public abstract class Raider extends PatrollingMonster { public class ObtainRaidLeaderBannerGoal extends Goal { private final T mob; + private Int2LongOpenHashMap unreachableBannerCache = new Int2LongOpenHashMap(); + @Nullable + private Path pathToBanner; + @Nullable + private ItemEntity pursuedBannerItemEntity; public ObtainRaidLeaderBannerGoal(final T mob) { this.mob = mob; @@ -341,34 +354,78 @@ public abstract class Raider extends PatrollingMonster { @Override public boolean canUse() { - Raid raid = this.mob.getCurrentRaid(); - if (this.mob.hasActiveRaid() - && !this.mob.getCurrentRaid().isOver() - && this.mob.canBeLeader() - && !ItemStack.matches( - this.mob.getItemBySlot(EquipmentSlot.HEAD), Raid.getLeaderBannerInstance(this.mob.registryAccess().lookupOrThrow(Registries.BANNER_PATTERN)) - )) { - Raider raider = raid.getLeader(this.mob.getWave()); - if (raider == null || !raider.isAlive()) { - List list = this.mob.level().getEntitiesOfClass(ItemEntity.class, this.mob.getBoundingBox().inflate(16.0, 8.0, 16.0), Raider.ALLOWED_ITEMS); - if (!list.isEmpty()) { - return this.mob.getNavigation().moveTo((Entity)list.get(0), 1.15F); + if (this.cannotPickUpBanner()) { + return false; + } else { + Int2LongOpenHashMap int2LongOpenHashMap = new Int2LongOpenHashMap(); + double d = Raider.this.getAttributeValue(Attributes.FOLLOW_RANGE); + + for (ItemEntity itemEntity : this.mob + .level() + .getEntitiesOfClass((Class)ItemEntity.class, this.mob.getBoundingBox().inflate(d, 8.0, d), Raider.ALLOWED_ITEMS)) { + long l = this.unreachableBannerCache.getOrDefault(itemEntity.getId(), Long.MIN_VALUE); + if (Raider.this.level().getGameTime() < l) { + int2LongOpenHashMap.put(itemEntity.getId(), l); + } else { + Path path = this.mob.getNavigation().createPath(itemEntity, 1); + if (path != null && path.canReach()) { + this.pathToBanner = path; + this.pursuedBannerItemEntity = itemEntity; + return true; + } + + int2LongOpenHashMap.put(itemEntity.getId(), Raider.this.level().getGameTime() + 600L); } } - return false; - } else { + this.unreachableBannerCache = int2LongOpenHashMap; return false; } } + @Override + public boolean canContinueToUse() { + if (this.pursuedBannerItemEntity == null || this.pathToBanner == null) { + return false; + } else if (this.pursuedBannerItemEntity.isRemoved()) { + return false; + } else { + return this.pathToBanner.isDone() ? false : !this.cannotPickUpBanner(); + } + } + + private boolean cannotPickUpBanner() { + if (!this.mob.hasActiveRaid()) { + return true; + } else if (this.mob.getCurrentRaid().isOver()) { + return true; + } else if (!this.mob.canBeLeader()) { + return true; + } else if (ItemStack.matches( + this.mob.getItemBySlot(EquipmentSlot.HEAD), Raid.getOminousBannerInstance(this.mob.registryAccess().lookupOrThrow(Registries.BANNER_PATTERN)) + )) { + return true; + } else { + Raider raider = Raider.this.raid.getLeader(this.mob.getWave()); + return raider != null && raider.isAlive(); + } + } + + @Override + public void start() { + this.mob.getNavigation().moveTo(this.pathToBanner, 1.15F); + } + + @Override + public void stop() { + this.pathToBanner = null; + this.pursuedBannerItemEntity = null; + } + @Override public void tick() { - if (this.mob.getNavigation().getTargetPos().closerToCenterThan(this.mob.position(), 1.414)) { - List list = this.mob.level().getEntitiesOfClass(ItemEntity.class, this.mob.getBoundingBox().inflate(4.0, 4.0, 4.0), Raider.ALLOWED_ITEMS); - if (!list.isEmpty()) { - this.mob.pickUpItem((ItemEntity)list.get(0)); - } + if (this.pursuedBannerItemEntity != null && this.pursuedBannerItemEntity.closerThan(this.mob, 1.414)) { + this.mob.pickUpItem(getServerLevel(Raider.this.level()), this.pursuedBannerItemEntity); } } } diff --git a/net/minecraft/world/entity/vehicle/AbstractBoat.java b/net/minecraft/world/entity/vehicle/AbstractBoat.java new file mode 100644 index 00000000..08f0a356 --- /dev/null +++ b/net/minecraft/world/entity/vehicle/AbstractBoat.java @@ -0,0 +1,828 @@ +package net.minecraft.world.entity.vehicle; + +import com.google.common.collect.Lists; +import java.util.List; +import java.util.function.Supplier; +import net.minecraft.BlockUtil.FoundRectangle; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.core.particles.ParticleTypes; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.protocol.game.ServerboundPaddleBoatPacket; +import net.minecraft.network.syncher.EntityDataAccessor; +import net.minecraft.network.syncher.EntityDataSerializers; +import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.network.syncher.SynchedEntityData.Builder; +import net.minecraft.sounds.SoundEvent; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.tags.EntityTypeTags; +import net.minecraft.tags.FluidTags; +import net.minecraft.util.Mth; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntityDimensions; +import net.minecraft.world.entity.EntitySelector; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.Leashable; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.MoverType; +import net.minecraft.world.entity.Pose; +import net.minecraft.world.entity.animal.Animal; +import net.minecraft.world.entity.animal.WaterAnimal; +import net.minecraft.world.entity.monster.creaking.Creaking; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.ItemLike; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.WaterlilyBlock; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.level.material.FluidState; +import net.minecraft.world.phys.AABB; +import net.minecraft.world.phys.Vec3; +import net.minecraft.world.phys.shapes.BooleanOp; +import net.minecraft.world.phys.shapes.Shapes; +import net.minecraft.world.phys.shapes.VoxelShape; +import org.jetbrains.annotations.Nullable; + +public abstract class AbstractBoat extends VehicleEntity implements Leashable { + private static final EntityDataAccessor DATA_ID_PADDLE_LEFT = SynchedEntityData.defineId(AbstractBoat.class, EntityDataSerializers.BOOLEAN); + private static final EntityDataAccessor DATA_ID_PADDLE_RIGHT = SynchedEntityData.defineId(AbstractBoat.class, EntityDataSerializers.BOOLEAN); + private static final EntityDataAccessor DATA_ID_BUBBLE_TIME = SynchedEntityData.defineId(AbstractBoat.class, EntityDataSerializers.INT); + public static final int PADDLE_LEFT = 0; + public static final int PADDLE_RIGHT = 1; + private static final int TIME_TO_EJECT = 60; + private static final float PADDLE_SPEED = (float) (Math.PI / 8); + public static final double PADDLE_SOUND_TIME = (float) (Math.PI / 4); + public static final int BUBBLE_TIME = 60; + private final float[] paddlePositions = new float[2]; + private float invFriction; + private float outOfControlTicks; + private float deltaRotation; + private int lerpSteps; + private double lerpX; + private double lerpY; + private double lerpZ; + private double lerpYRot; + private double lerpXRot; + private boolean inputLeft; + private boolean inputRight; + private boolean inputUp; + private boolean inputDown; + private double waterLevel; + private float landFriction; + private AbstractBoat.Status status; + private AbstractBoat.Status oldStatus; + private double lastYd; + private boolean isAboveBubbleColumn; + private boolean bubbleColumnDirectionIsDown; + private float bubbleMultiplier; + private float bubbleAngle; + private float bubbleAngleO; + @Nullable + private Leashable.LeashData leashData; + private final Supplier dropItem; + + public AbstractBoat(EntityType entityType, Level level, Supplier supplier) { + super(entityType, level); + this.dropItem = supplier; + this.blocksBuilding = true; + } + + public void setInitialPos(double d, double e, double f) { + this.setPos(d, e, f); + this.xo = d; + this.yo = e; + this.zo = f; + } + + @Override + protected Entity.MovementEmission getMovementEmission() { + return Entity.MovementEmission.EVENTS; + } + + @Override + protected void defineSynchedData(Builder builder) { + super.defineSynchedData(builder); + builder.define(DATA_ID_PADDLE_LEFT, false); + builder.define(DATA_ID_PADDLE_RIGHT, false); + builder.define(DATA_ID_BUBBLE_TIME, 0); + } + + @Override + public boolean canCollideWith(Entity entity) { + return canVehicleCollide(this, entity); + } + + public static boolean canVehicleCollide(Entity entity, Entity entity2) { + return (entity2.canBeCollidedWith() || entity2.isPushable()) && !entity.isPassengerOfSameVehicle(entity2); + } + + @Override + public boolean canBeCollidedWith() { + return true; + } + + @Override + public boolean isPushable() { + return true; + } + + @Override + public Vec3 getRelativePortalPosition(Direction.Axis axis, FoundRectangle portal) { + return LivingEntity.resetForwardDirectionOfRelativePortalPosition(super.getRelativePortalPosition(axis, portal)); + } + + protected abstract double rideHeight(EntityDimensions entityDimensions); + + @Override + protected Vec3 getPassengerAttachmentPoint(Entity entity, EntityDimensions dimensions, float partialTick) { + float f = this.getSinglePassengerXOffset(); + if (this.getPassengers().size() > 1) { + int i = this.getPassengers().indexOf(entity); + if (i == 0) { + f = 0.2F; + } else { + f = -0.6F; + } + + if (entity instanceof Animal) { + f += 0.2F; + } + } + + return new Vec3(0.0, this.rideHeight(dimensions), f).yRot(-this.getYRot() * (float) (Math.PI / 180.0)); + } + + @Override + public void onAboveBubbleCol(boolean downwards) { + if (!this.level().isClientSide) { + this.isAboveBubbleColumn = true; + this.bubbleColumnDirectionIsDown = downwards; + if (this.getBubbleTime() == 0) { + this.setBubbleTime(60); + } + } + + this.level() + .addParticle(ParticleTypes.SPLASH, this.getX() + this.random.nextFloat(), this.getY() + 0.7, this.getZ() + this.random.nextFloat(), 0.0, 0.0, 0.0); + if (this.random.nextInt(20) == 0) { + this.level() + .playLocalSound(this.getX(), this.getY(), this.getZ(), this.getSwimSplashSound(), this.getSoundSource(), 1.0F, 0.8F + 0.4F * this.random.nextFloat(), false); + this.gameEvent(GameEvent.SPLASH, this.getControllingPassenger()); + } + } + + @Override + public void push(Entity entity) { + if (entity instanceof AbstractBoat) { + if (entity.getBoundingBox().minY < this.getBoundingBox().maxY) { + super.push(entity); + } + } else if (entity.getBoundingBox().minY <= this.getBoundingBox().minY) { + super.push(entity); + } + } + + @Override + public void animateHurt(float yaw) { + this.setHurtDir(-this.getHurtDir()); + this.setHurtTime(10); + this.setDamage(this.getDamage() * 11.0F); + } + + @Override + public boolean isPickable() { + return !this.isRemoved(); + } + + @Override + public void cancelLerp() { + this.lerpSteps = 0; + } + + @Override + public void lerpTo(double x, double y, double z, float yRot, float xRot, int steps) { + this.lerpX = x; + this.lerpY = y; + this.lerpZ = z; + this.lerpYRot = yRot; + this.lerpXRot = xRot; + this.lerpSteps = steps; + } + + @Override + public double lerpTargetX() { + return this.lerpSteps > 0 ? this.lerpX : this.getX(); + } + + @Override + public double lerpTargetY() { + return this.lerpSteps > 0 ? this.lerpY : this.getY(); + } + + @Override + public double lerpTargetZ() { + return this.lerpSteps > 0 ? this.lerpZ : this.getZ(); + } + + @Override + public float lerpTargetXRot() { + return this.lerpSteps > 0 ? (float)this.lerpXRot : this.getXRot(); + } + + @Override + public float lerpTargetYRot() { + return this.lerpSteps > 0 ? (float)this.lerpYRot : this.getYRot(); + } + + @Override + public Direction getMotionDirection() { + return this.getDirection().getClockWise(); + } + + @Override + public void tick() { + this.oldStatus = this.status; + this.status = this.getStatus(); + if (this.status != AbstractBoat.Status.UNDER_WATER && this.status != AbstractBoat.Status.UNDER_FLOWING_WATER) { + this.outOfControlTicks = 0.0F; + } else { + this.outOfControlTicks++; + } + + if (!this.level().isClientSide && this.outOfControlTicks >= 60.0F) { + this.ejectPassengers(); + } + + if (this.getHurtTime() > 0) { + this.setHurtTime(this.getHurtTime() - 1); + } + + if (this.getDamage() > 0.0F) { + this.setDamage(this.getDamage() - 1.0F); + } + + super.tick(); + this.tickLerp(); + if (this.isControlledByLocalInstance()) { + if (!(this.getFirstPassenger() instanceof Player)) { + this.setPaddleState(false, false); + } + + this.floatBoat(); + if (this.level().isClientSide) { + this.controlBoat(); + this.level().sendPacketToServer(new ServerboundPaddleBoatPacket(this.getPaddleState(0), this.getPaddleState(1))); + } + + this.move(MoverType.SELF, this.getDeltaMovement()); + } else { + this.setDeltaMovement(Vec3.ZERO); + } + + this.applyEffectsFromBlocks(); + this.applyEffectsFromBlocks(); + this.tickBubbleColumn(); + + for (int i = 0; i <= 1; i++) { + if (this.getPaddleState(i)) { + if (!this.isSilent() + && this.paddlePositions[i] % (float) (Math.PI * 2) <= (float) (Math.PI / 4) + && (this.paddlePositions[i] + (float) (Math.PI / 8)) % (float) (Math.PI * 2) >= (float) (Math.PI / 4)) { + SoundEvent soundEvent = this.getPaddleSound(); + if (soundEvent != null) { + Vec3 vec3 = this.getViewVector(1.0F); + double d = i == 1 ? -vec3.z : vec3.z; + double e = i == 1 ? vec3.x : -vec3.x; + this.level() + .playSound(null, this.getX() + d, this.getY(), this.getZ() + e, soundEvent, this.getSoundSource(), 1.0F, 0.8F + 0.4F * this.random.nextFloat()); + } + } + + this.paddlePositions[i] = this.paddlePositions[i] + (float) (Math.PI / 8); + } else { + this.paddlePositions[i] = 0.0F; + } + } + + List list = this.level().getEntities(this, this.getBoundingBox().inflate(0.2F, -0.01F, 0.2F), EntitySelector.pushableBy(this)); + if (!list.isEmpty()) { + boolean bl = !this.level().isClientSide && !(this.getControllingPassenger() instanceof Player); + + for (Entity entity : list) { + if (!entity.hasPassenger(this)) { + if (bl + && this.getPassengers().size() < this.getMaxPassengers() + && !entity.isPassenger() + && this.hasEnoughSpaceFor(entity) + && entity instanceof LivingEntity + && !(entity instanceof WaterAnimal) + && !(entity instanceof Player) + && !(entity instanceof Creaking)) { + entity.startRiding(this); + } else { + this.push(entity); + } + } + } + } + } + + private void tickBubbleColumn() { + if (this.level().isClientSide) { + int i = this.getBubbleTime(); + if (i > 0) { + this.bubbleMultiplier += 0.05F; + } else { + this.bubbleMultiplier -= 0.1F; + } + + this.bubbleMultiplier = Mth.clamp(this.bubbleMultiplier, 0.0F, 1.0F); + this.bubbleAngleO = this.bubbleAngle; + this.bubbleAngle = 10.0F * (float)Math.sin(0.5F * (float)this.level().getGameTime()) * this.bubbleMultiplier; + } else { + if (!this.isAboveBubbleColumn) { + this.setBubbleTime(0); + } + + int i = this.getBubbleTime(); + if (i > 0) { + this.setBubbleTime(--i); + int j = 60 - i - 1; + if (j > 0 && i == 0) { + this.setBubbleTime(0); + Vec3 vec3 = this.getDeltaMovement(); + if (this.bubbleColumnDirectionIsDown) { + this.setDeltaMovement(vec3.add(0.0, -0.7, 0.0)); + this.ejectPassengers(); + } else { + this.setDeltaMovement(vec3.x, this.hasPassenger(entity -> entity instanceof Player) ? 2.7 : 0.6, vec3.z); + } + } + + this.isAboveBubbleColumn = false; + } + } + } + + @Nullable + protected SoundEvent getPaddleSound() { + switch (this.getStatus()) { + case IN_WATER: + case UNDER_WATER: + case UNDER_FLOWING_WATER: + return SoundEvents.BOAT_PADDLE_WATER; + case ON_LAND: + return SoundEvents.BOAT_PADDLE_LAND; + case IN_AIR: + default: + return null; + } + } + + private void tickLerp() { + if (this.lerpSteps > 0) { + this.lerpPositionAndRotationStep(this.lerpSteps, this.lerpX, this.lerpY, this.lerpZ, this.lerpYRot, this.lerpXRot); + this.lerpSteps--; + } + } + + public void setPaddleState(boolean bl, boolean bl2) { + this.entityData.set(DATA_ID_PADDLE_LEFT, bl); + this.entityData.set(DATA_ID_PADDLE_RIGHT, bl2); + } + + public float getRowingTime(int i, float f) { + return this.getPaddleState(i) ? Mth.clampedLerp(this.paddlePositions[i] - (float) (Math.PI / 8), this.paddlePositions[i], f) : 0.0F; + } + + @Nullable + @Override + public Leashable.LeashData getLeashData() { + return this.leashData; + } + + @Override + public void setLeashData(@Nullable Leashable.LeashData leashData) { + this.leashData = leashData; + } + + @Override + public Vec3 getLeashOffset() { + return new Vec3(0.0, 0.88F * this.getEyeHeight(), this.getBbWidth() * 0.64F); + } + + @Override + public void elasticRangeLeashBehaviour(Entity leashHolder, float distance) { + Vec3 vec3 = leashHolder.position().subtract(this.position()).normalize().scale(distance - 6.0); + Vec3 vec32 = this.getDeltaMovement(); + boolean bl = vec32.dot(vec3) > 0.0; + this.setDeltaMovement(vec32.add(vec3.scale(bl ? 0.15F : 0.2F))); + } + + private AbstractBoat.Status getStatus() { + AbstractBoat.Status status = this.isUnderwater(); + if (status != null) { + this.waterLevel = this.getBoundingBox().maxY; + return status; + } else if (this.checkInWater()) { + return AbstractBoat.Status.IN_WATER; + } else { + float f = this.getGroundFriction(); + if (f > 0.0F) { + this.landFriction = f; + return AbstractBoat.Status.ON_LAND; + } else { + return AbstractBoat.Status.IN_AIR; + } + } + } + + public float getWaterLevelAbove() { + AABB aABB = this.getBoundingBox(); + int i = Mth.floor(aABB.minX); + int j = Mth.ceil(aABB.maxX); + int k = Mth.floor(aABB.maxY); + int l = Mth.ceil(aABB.maxY - this.lastYd); + int m = Mth.floor(aABB.minZ); + int n = Mth.ceil(aABB.maxZ); + BlockPos.MutableBlockPos mutableBlockPos = new BlockPos.MutableBlockPos(); + + label39: + for (int o = k; o < l; o++) { + float f = 0.0F; + + for (int p = i; p < j; p++) { + for (int q = m; q < n; q++) { + mutableBlockPos.set(p, o, q); + FluidState fluidState = this.level().getFluidState(mutableBlockPos); + if (fluidState.is(FluidTags.WATER)) { + f = Math.max(f, fluidState.getHeight(this.level(), mutableBlockPos)); + } + + if (f >= 1.0F) { + continue label39; + } + } + } + + if (f < 1.0F) { + return mutableBlockPos.getY() + f; + } + } + + return l + 1; + } + + public float getGroundFriction() { + AABB aABB = this.getBoundingBox(); + AABB aABB2 = new AABB(aABB.minX, aABB.minY - 0.001, aABB.minZ, aABB.maxX, aABB.minY, aABB.maxZ); + int i = Mth.floor(aABB2.minX) - 1; + int j = Mth.ceil(aABB2.maxX) + 1; + int k = Mth.floor(aABB2.minY) - 1; + int l = Mth.ceil(aABB2.maxY) + 1; + int m = Mth.floor(aABB2.minZ) - 1; + int n = Mth.ceil(aABB2.maxZ) + 1; + VoxelShape voxelShape = Shapes.create(aABB2); + float f = 0.0F; + int o = 0; + BlockPos.MutableBlockPos mutableBlockPos = new BlockPos.MutableBlockPos(); + + for (int p = i; p < j; p++) { + for (int q = m; q < n; q++) { + int r = (p != i && p != j - 1 ? 0 : 1) + (q != m && q != n - 1 ? 0 : 1); + if (r != 2) { + for (int s = k; s < l; s++) { + if (r <= 0 || s != k && s != l - 1) { + mutableBlockPos.set(p, s, q); + BlockState blockState = this.level().getBlockState(mutableBlockPos); + if (!(blockState.getBlock() instanceof WaterlilyBlock) + && Shapes.joinIsNotEmpty(blockState.getCollisionShape(this.level(), mutableBlockPos).move(p, s, q), voxelShape, BooleanOp.AND)) { + f += blockState.getBlock().getFriction(); + o++; + } + } + } + } + } + } + + return f / o; + } + + private boolean checkInWater() { + AABB aABB = this.getBoundingBox(); + int i = Mth.floor(aABB.minX); + int j = Mth.ceil(aABB.maxX); + int k = Mth.floor(aABB.minY); + int l = Mth.ceil(aABB.minY + 0.001); + int m = Mth.floor(aABB.minZ); + int n = Mth.ceil(aABB.maxZ); + boolean bl = false; + this.waterLevel = -Double.MAX_VALUE; + BlockPos.MutableBlockPos mutableBlockPos = new BlockPos.MutableBlockPos(); + + for (int o = i; o < j; o++) { + for (int p = k; p < l; p++) { + for (int q = m; q < n; q++) { + mutableBlockPos.set(o, p, q); + FluidState fluidState = this.level().getFluidState(mutableBlockPos); + if (fluidState.is(FluidTags.WATER)) { + float f = p + fluidState.getHeight(this.level(), mutableBlockPos); + this.waterLevel = Math.max(f, this.waterLevel); + bl |= aABB.minY < f; + } + } + } + } + + return bl; + } + + @Nullable + private AbstractBoat.Status isUnderwater() { + AABB aABB = this.getBoundingBox(); + double d = aABB.maxY + 0.001; + int i = Mth.floor(aABB.minX); + int j = Mth.ceil(aABB.maxX); + int k = Mth.floor(aABB.maxY); + int l = Mth.ceil(d); + int m = Mth.floor(aABB.minZ); + int n = Mth.ceil(aABB.maxZ); + boolean bl = false; + BlockPos.MutableBlockPos mutableBlockPos = new BlockPos.MutableBlockPos(); + + for (int o = i; o < j; o++) { + for (int p = k; p < l; p++) { + for (int q = m; q < n; q++) { + mutableBlockPos.set(o, p, q); + FluidState fluidState = this.level().getFluidState(mutableBlockPos); + if (fluidState.is(FluidTags.WATER) && d < mutableBlockPos.getY() + fluidState.getHeight(this.level(), mutableBlockPos)) { + if (!fluidState.isSource()) { + return AbstractBoat.Status.UNDER_FLOWING_WATER; + } + + bl = true; + } + } + } + } + + return bl ? AbstractBoat.Status.UNDER_WATER : null; + } + + @Override + protected double getDefaultGravity() { + return 0.04; + } + + private void floatBoat() { + double d = -this.getGravity(); + double e = 0.0; + this.invFriction = 0.05F; + if (this.oldStatus == AbstractBoat.Status.IN_AIR && this.status != AbstractBoat.Status.IN_AIR && this.status != AbstractBoat.Status.ON_LAND) { + this.waterLevel = this.getY(1.0); + double f = this.getWaterLevelAbove() - this.getBbHeight() + 0.101; + if (this.level().noCollision(this, this.getBoundingBox().move(0.0, f - this.getY(), 0.0))) { + this.setPos(this.getX(), f, this.getZ()); + this.setDeltaMovement(this.getDeltaMovement().multiply(1.0, 0.0, 1.0)); + this.lastYd = 0.0; + } + + this.status = AbstractBoat.Status.IN_WATER; + } else { + if (this.status == AbstractBoat.Status.IN_WATER) { + e = (this.waterLevel - this.getY()) / this.getBbHeight(); + this.invFriction = 0.9F; + } else if (this.status == AbstractBoat.Status.UNDER_FLOWING_WATER) { + d = -7.0E-4; + this.invFriction = 0.9F; + } else if (this.status == AbstractBoat.Status.UNDER_WATER) { + e = 0.01F; + this.invFriction = 0.45F; + } else if (this.status == AbstractBoat.Status.IN_AIR) { + this.invFriction = 0.9F; + } else if (this.status == AbstractBoat.Status.ON_LAND) { + this.invFriction = this.landFriction; + if (this.getControllingPassenger() instanceof Player) { + this.landFriction /= 2.0F; + } + } + + Vec3 vec3 = this.getDeltaMovement(); + this.setDeltaMovement(vec3.x * this.invFriction, vec3.y + d, vec3.z * this.invFriction); + this.deltaRotation = this.deltaRotation * this.invFriction; + if (e > 0.0) { + Vec3 vec32 = this.getDeltaMovement(); + this.setDeltaMovement(vec32.x, (vec32.y + e * (this.getDefaultGravity() / 0.65)) * 0.75, vec32.z); + } + } + } + + private void controlBoat() { + if (this.isVehicle()) { + float f = 0.0F; + if (this.inputLeft) { + this.deltaRotation--; + } + + if (this.inputRight) { + this.deltaRotation++; + } + + if (this.inputRight != this.inputLeft && !this.inputUp && !this.inputDown) { + f += 0.005F; + } + + this.setYRot(this.getYRot() + this.deltaRotation); + if (this.inputUp) { + f += 0.04F; + } + + if (this.inputDown) { + f -= 0.005F; + } + + this.setDeltaMovement( + this.getDeltaMovement().add(Mth.sin(-this.getYRot() * (float) (Math.PI / 180.0)) * f, 0.0, Mth.cos(this.getYRot() * (float) (Math.PI / 180.0)) * f) + ); + this.setPaddleState(this.inputRight && !this.inputLeft || this.inputUp, this.inputLeft && !this.inputRight || this.inputUp); + } + } + + protected float getSinglePassengerXOffset() { + return 0.0F; + } + + public boolean hasEnoughSpaceFor(Entity entity) { + return entity.getBbWidth() < this.getBbWidth(); + } + + @Override + protected void positionRider(Entity passenger, Entity.MoveFunction callback) { + super.positionRider(passenger, callback); + if (!passenger.getType().is(EntityTypeTags.CAN_TURN_IN_BOATS)) { + passenger.setYRot(passenger.getYRot() + this.deltaRotation); + passenger.setYHeadRot(passenger.getYHeadRot() + this.deltaRotation); + this.clampRotation(passenger); + if (passenger instanceof Animal && this.getPassengers().size() == this.getMaxPassengers()) { + int i = passenger.getId() % 2 == 0 ? 90 : 270; + passenger.setYBodyRot(((Animal)passenger).yBodyRot + i); + passenger.setYHeadRot(passenger.getYHeadRot() + i); + } + } + } + + @Override + public Vec3 getDismountLocationForPassenger(LivingEntity passenger) { + Vec3 vec3 = getCollisionHorizontalEscapeVector(this.getBbWidth() * Mth.SQRT_OF_TWO, passenger.getBbWidth(), passenger.getYRot()); + double d = this.getX() + vec3.x; + double e = this.getZ() + vec3.z; + BlockPos blockPos = BlockPos.containing(d, this.getBoundingBox().maxY, e); + BlockPos blockPos2 = blockPos.below(); + if (!this.level().isWaterAt(blockPos2)) { + List list = Lists.newArrayList(); + double f = this.level().getBlockFloorHeight(blockPos); + if (DismountHelper.isBlockFloorValid(f)) { + list.add(new Vec3(d, blockPos.getY() + f, e)); + } + + double g = this.level().getBlockFloorHeight(blockPos2); + if (DismountHelper.isBlockFloorValid(g)) { + list.add(new Vec3(d, blockPos2.getY() + g, e)); + } + + for (Pose pose : passenger.getDismountPoses()) { + for (Vec3 vec32 : list) { + if (DismountHelper.canDismountTo(this.level(), vec32, passenger, pose)) { + passenger.setPose(pose); + return vec32; + } + } + } + } + + return super.getDismountLocationForPassenger(passenger); + } + + protected void clampRotation(Entity entity) { + entity.setYBodyRot(this.getYRot()); + float f = Mth.wrapDegrees(entity.getYRot() - this.getYRot()); + float g = Mth.clamp(f, -105.0F, 105.0F); + entity.yRotO += g - f; + entity.setYRot(entity.getYRot() + g - f); + entity.setYHeadRot(entity.getYRot()); + } + + @Override + public void onPassengerTurned(Entity entityToUpdate) { + this.clampRotation(entityToUpdate); + } + + @Override + protected void addAdditionalSaveData(CompoundTag compound) { + this.writeLeashData(compound, this.leashData); + } + + @Override + protected void readAdditionalSaveData(CompoundTag compound) { + this.leashData = this.readLeashData(compound); + } + + @Override + public InteractionResult interact(Player player, InteractionHand hand) { + InteractionResult interactionResult = super.interact(player, hand); + if (interactionResult != InteractionResult.PASS) { + return interactionResult; + } else { + return (InteractionResult)(player.isSecondaryUseActive() || !(this.outOfControlTicks < 60.0F) || !this.level().isClientSide && !player.startRiding(this) + ? InteractionResult.PASS + : InteractionResult.SUCCESS); + } + } + + @Override + public void remove(Entity.RemovalReason reason) { + if (!this.level().isClientSide && reason.shouldDestroy() && this.isLeashed()) { + this.dropLeash(true, true); + } + + super.remove(reason); + } + + @Override + protected void checkFallDamage(double y, boolean onGround, BlockState state, BlockPos pos) { + this.lastYd = this.getDeltaMovement().y; + if (!this.isPassenger()) { + if (onGround) { + this.resetFallDistance(); + } else if (!this.level().getFluidState(this.blockPosition().below()).is(FluidTags.WATER) && y < 0.0) { + this.fallDistance -= (float)y; + } + } + } + + public boolean getPaddleState(int i) { + return this.entityData.get(i == 0 ? DATA_ID_PADDLE_LEFT : DATA_ID_PADDLE_RIGHT) && this.getControllingPassenger() != null; + } + + private void setBubbleTime(int i) { + this.entityData.set(DATA_ID_BUBBLE_TIME, i); + } + + private int getBubbleTime() { + return this.entityData.get(DATA_ID_BUBBLE_TIME); + } + + public float getBubbleAngle(float f) { + return Mth.lerp(f, this.bubbleAngleO, this.bubbleAngle); + } + + @Override + protected boolean canAddPassenger(Entity passenger) { + return this.getPassengers().size() < this.getMaxPassengers() && !this.isEyeInFluid(FluidTags.WATER); + } + + protected int getMaxPassengers() { + return 2; + } + + @Nullable + @Override + public LivingEntity getControllingPassenger() { + return this.getFirstPassenger() instanceof LivingEntity livingEntity ? livingEntity : super.getControllingPassenger(); + } + + public void setInput(boolean bl, boolean bl2, boolean bl3, boolean bl4) { + this.inputLeft = bl; + this.inputRight = bl2; + this.inputUp = bl3; + this.inputDown = bl4; + } + + @Override + public boolean isUnderWater() { + return this.status == AbstractBoat.Status.UNDER_WATER || this.status == AbstractBoat.Status.UNDER_FLOWING_WATER; + } + + @Override + protected final Item getDropItem() { + return (Item)this.dropItem.get(); + } + + @Override + public final ItemStack getPickResult() { + return new ItemStack((ItemLike)this.dropItem.get()); + } + + public static enum Status { + IN_WATER, + UNDER_WATER, + UNDER_FLOWING_WATER, + ON_LAND, + IN_AIR; + } +} diff --git a/net/minecraft/world/entity/vehicle/AbstractChestBoat.java b/net/minecraft/world/entity/vehicle/AbstractChestBoat.java new file mode 100644 index 00000000..da0cca59 --- /dev/null +++ b/net/minecraft/world/entity/vehicle/AbstractChestBoat.java @@ -0,0 +1,202 @@ +package net.minecraft.world.entity.vehicle; + +import java.util.function.Supplier; +import net.minecraft.core.NonNullList; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.resources.ResourceKey; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.Containers; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.damagesource.DamageSource; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.HasCustomInventoryScreen; +import net.minecraft.world.entity.SlotAccess; +import net.minecraft.world.entity.monster.piglin.PiglinAi; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.inventory.ChestMenu; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.level.gameevent.GameEvent.Context; +import net.minecraft.world.level.storage.loot.LootTable; +import org.jetbrains.annotations.Nullable; + +public abstract class AbstractChestBoat extends AbstractBoat implements HasCustomInventoryScreen, ContainerEntity { + private static final int CONTAINER_SIZE = 27; + private NonNullList itemStacks = NonNullList.withSize(27, ItemStack.EMPTY); + @Nullable + private ResourceKey lootTable; + private long lootTableSeed; + + public AbstractChestBoat(EntityType entityType, Level level, Supplier supplier) { + super(entityType, level, supplier); + } + + @Override + protected float getSinglePassengerXOffset() { + return 0.15F; + } + + @Override + protected int getMaxPassengers() { + return 1; + } + + @Override + protected void addAdditionalSaveData(CompoundTag compound) { + super.addAdditionalSaveData(compound); + this.addChestVehicleSaveData(compound, this.registryAccess()); + } + + @Override + protected void readAdditionalSaveData(CompoundTag compound) { + super.readAdditionalSaveData(compound); + this.readChestVehicleSaveData(compound, this.registryAccess()); + } + + @Override + public void destroy(ServerLevel serverLevel, DamageSource damageSource) { + this.destroy(serverLevel, this.getDropItem()); + this.chestVehicleDestroyed(damageSource, serverLevel, this); + } + + @Override + public void remove(Entity.RemovalReason reason) { + if (!this.level().isClientSide && reason.shouldDestroy()) { + Containers.dropContents(this.level(), this, this); + } + + super.remove(reason); + } + + @Override + public InteractionResult interact(Player player, InteractionHand hand) { + if (!player.isSecondaryUseActive()) { + InteractionResult interactionResult = super.interact(player, hand); + if (interactionResult != InteractionResult.PASS) { + return interactionResult; + } + } + + if (this.canAddPassenger(player) && !player.isSecondaryUseActive()) { + return InteractionResult.PASS; + } else { + InteractionResult interactionResult = this.interactWithContainerVehicle(player); + if (interactionResult.consumesAction() && player.level() instanceof ServerLevel serverLevel) { + this.gameEvent(GameEvent.CONTAINER_OPEN, player); + PiglinAi.angerNearbyPiglins(serverLevel, player, true); + } + + return interactionResult; + } + } + + @Override + public void openCustomInventoryScreen(Player player) { + player.openMenu(this); + if (player.level() instanceof ServerLevel serverLevel) { + this.gameEvent(GameEvent.CONTAINER_OPEN, player); + PiglinAi.angerNearbyPiglins(serverLevel, player, true); + } + } + + @Override + public void clearContent() { + this.clearChestVehicleContent(); + } + + @Override + public int getContainerSize() { + return 27; + } + + @Override + public ItemStack getItem(int slot) { + return this.getChestVehicleItem(slot); + } + + @Override + public ItemStack removeItem(int slot, int amount) { + return this.removeChestVehicleItem(slot, amount); + } + + @Override + public ItemStack removeItemNoUpdate(int slot) { + return this.removeChestVehicleItemNoUpdate(slot); + } + + @Override + public void setItem(int slot, ItemStack stack) { + this.setChestVehicleItem(slot, stack); + } + + @Override + public SlotAccess getSlot(int slot) { + return this.getChestVehicleSlot(slot); + } + + @Override + public void setChanged() { + } + + @Override + public boolean stillValid(Player player) { + return this.isChestVehicleStillValid(player); + } + + @Nullable + @Override + public AbstractContainerMenu createMenu(int i, Inventory inventory, Player player) { + if (this.lootTable != null && player.isSpectator()) { + return null; + } else { + this.unpackLootTable(inventory.player); + return ChestMenu.threeRows(i, inventory, this); + } + } + + public void unpackLootTable(@Nullable Player player) { + this.unpackChestVehicleLootTable(player); + } + + @Nullable + @Override + public ResourceKey getContainerLootTable() { + return this.lootTable; + } + + @Override + public void setContainerLootTable(@Nullable ResourceKey resourceKey) { + this.lootTable = resourceKey; + } + + @Override + public long getContainerLootTableSeed() { + return this.lootTableSeed; + } + + @Override + public void setContainerLootTableSeed(long l) { + this.lootTableSeed = l; + } + + @Override + public NonNullList getItemStacks() { + return this.itemStacks; + } + + @Override + public void clearItemStacks() { + this.itemStacks = NonNullList.withSize(this.getContainerSize(), ItemStack.EMPTY); + } + + @Override + public void stopOpen(Player player) { + this.level().gameEvent(GameEvent.CONTAINER_CLOSE, this.position(), Context.of(player)); + } +} diff --git a/net/minecraft/world/entity/vehicle/AbstractMinecart.java b/net/minecraft/world/entity/vehicle/AbstractMinecart.java index f78f49db..3fb8c0fd 100644 --- a/net/minecraft/world/entity/vehicle/AbstractMinecart.java +++ b/net/minecraft/world/entity/vehicle/AbstractMinecart.java @@ -4,10 +4,9 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Maps; import com.mojang.datafixers.util.Pair; -import java.util.List; import java.util.Map; -import net.minecraft.BlockUtil; import net.minecraft.Util; +import net.minecraft.BlockUtil.FoundRectangle; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.Vec3i; @@ -17,22 +16,22 @@ import net.minecraft.nbt.NbtUtils; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.network.syncher.SynchedEntityData.Builder; import net.minecraft.server.level.ServerLevel; import net.minecraft.tags.BlockTags; import net.minecraft.util.Mth; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityDimensions; -import net.minecraft.world.entity.EntitySelector; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.MoverType; import net.minecraft.world.entity.Pose; -import net.minecraft.world.entity.animal.IronGolem; import net.minecraft.world.entity.npc.Villager; import net.minecraft.world.entity.npc.WanderingTrader; import net.minecraft.world.entity.player.Player; +import net.minecraft.world.flag.FeatureFlags; import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.Items; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.BaseRailBlock; import net.minecraft.world.level.block.Block; @@ -53,20 +52,14 @@ public abstract class AbstractMinecart extends VehicleEntity { Pose.STANDING, ImmutableList.of(0, 1, -1), Pose.CROUCHING, ImmutableList.of(0, 1, -1), Pose.SWIMMING, ImmutableList.of(0, 1) ); protected static final float WATER_SLOWDOWN_FACTOR = 0.95F; - private boolean flipped; private boolean onRails; - private int lerpSteps; - private double lerpX; - private double lerpY; - private double lerpZ; - private double lerpYRot; - private double lerpXRot; - private Vec3 targetDeltaMovement = Vec3.ZERO; + private boolean flipped; + private final MinecartBehavior behavior; private static final Map> EXITS = Util.make(Maps.newEnumMap(RailShape.class), enumMap -> { - Vec3i vec3i = Direction.WEST.getNormal(); - Vec3i vec3i2 = Direction.EAST.getNormal(); - Vec3i vec3i3 = Direction.NORTH.getNormal(); - Vec3i vec3i4 = Direction.SOUTH.getNormal(); + Vec3i vec3i = Direction.WEST.getUnitVec3i(); + Vec3i vec3i2 = Direction.EAST.getUnitVec3i(); + Vec3i vec3i3 = Direction.NORTH.getUnitVec3i(); + Vec3i vec3i4 = Direction.SOUTH.getUnitVec3i(); Vec3i vec3i5 = vec3i.below(); Vec3i vec3i6 = vec3i2.below(); Vec3i vec3i7 = vec3i3.below(); @@ -86,39 +79,54 @@ public abstract class AbstractMinecart extends VehicleEntity { protected AbstractMinecart(EntityType entityType, Level level) { super(entityType, level); this.blocksBuilding = true; + if (useExperimentalMovement(level)) { + this.behavior = new NewMinecartBehavior(this); + } else { + this.behavior = new OldMinecartBehavior(this); + } } protected AbstractMinecart(EntityType entityType, Level level, double x, double y, double z) { this(entityType, level); - this.setPos(x, y, z); - this.xo = x; - this.yo = y; - this.zo = z; + this.setInitialPos(x, y, z); } - public static AbstractMinecart createMinecart( - ServerLevel level, double x, double y, double z, AbstractMinecart.Type type, ItemStack stack, @Nullable Player player + public void setInitialPos(double d, double e, double f) { + this.setPos(d, e, f); + this.xo = d; + this.yo = e; + this.zo = f; + } + + @Nullable + public static T createMinecart( + Level level, double d, double e, double f, EntityType entityType, EntitySpawnReason entitySpawnReason, ItemStack itemStack, @Nullable Player player ) { - AbstractMinecart abstractMinecart = (AbstractMinecart)(switch (type) { - case CHEST -> new MinecartChest(level, x, y, z); - case FURNACE -> new MinecartFurnace(level, x, y, z); - case TNT -> new MinecartTNT(level, x, y, z); - case SPAWNER -> new MinecartSpawner(level, x, y, z); - case HOPPER -> new MinecartHopper(level, x, y, z); - case COMMAND_BLOCK -> new MinecartCommandBlock(level, x, y, z); - default -> new Minecart(level, x, y, z); - }); - EntityType.createDefaultStackConfig(level, stack, player).accept(abstractMinecart); + T abstractMinecart = (T)entityType.create(level, entitySpawnReason); + if (abstractMinecart != null) { + abstractMinecart.setInitialPos(d, e, f); + EntityType.createDefaultStackConfig(level, itemStack, player).accept(abstractMinecart); + if (abstractMinecart.getBehavior() instanceof NewMinecartBehavior newMinecartBehavior) { + BlockPos blockPos = abstractMinecart.getCurrentBlockPosOrRailBelow(); + BlockState blockState = level.getBlockState(blockPos); + newMinecartBehavior.adjustToRails(blockPos, blockState, true); + } + } + return abstractMinecart; } + public MinecartBehavior getBehavior() { + return this.behavior; + } + @Override protected Entity.MovementEmission getMovementEmission() { return Entity.MovementEmission.EVENTS; } @Override - protected void defineSynchedData(SynchedEntityData.Builder builder) { + protected void defineSynchedData(Builder builder) { super.defineSynchedData(builder); builder.define(DATA_ID_DISPLAY_BLOCK, Block.getId(Blocks.AIR.defaultBlockState())); builder.define(DATA_ID_DISPLAY_OFFSET, 6); @@ -127,7 +135,7 @@ public abstract class AbstractMinecart extends VehicleEntity { @Override public boolean canCollideWith(Entity entity) { - return Boat.canVehicleCollide(this, entity); + return AbstractBoat.canVehicleCollide(this, entity); } @Override @@ -136,7 +144,7 @@ public abstract class AbstractMinecart extends VehicleEntity { } @Override - public Vec3 getRelativePortalPosition(Direction.Axis axis, BlockUtil.FoundRectangle portal) { + public Vec3 getRelativePortalPosition(Direction.Axis axis, FoundRectangle portal) { return LivingEntity.resetForwardDirectionOfRelativePortalPosition(super.getRelativePortalPosition(axis, portal)); } @@ -215,13 +223,13 @@ public abstract class AbstractMinecart extends VehicleEntity { return !this.isRemoved(); } - private static Pair exits(RailShape shape) { + public static Pair exits(RailShape shape) { return (Pair)EXITS.get(shape); } @Override public Direction getMotionDirection() { - return this.flipped ? this.getDirection().getOpposite().getClockWise() : this.getDirection().getClockWise(); + return this.behavior.getMotionDirection(); } @Override @@ -241,87 +249,38 @@ public abstract class AbstractMinecart extends VehicleEntity { this.checkBelowWorld(); this.handlePortal(); - if (this.level().isClientSide) { - if (this.lerpSteps > 0) { - this.lerpPositionAndRotationStep(this.lerpSteps, this.lerpX, this.lerpY, this.lerpZ, this.lerpYRot, this.lerpXRot); - this.lerpSteps--; - } else { - this.reapplyPosition(); - this.setRot(this.getYRot(), this.getXRot()); - } - } else { - this.applyGravity(); - int i = Mth.floor(this.getX()); - int j = Mth.floor(this.getY()); - int k = Mth.floor(this.getZ()); - if (this.level().getBlockState(new BlockPos(i, j - 1, k)).is(BlockTags.RAILS)) { - j--; - } - - BlockPos blockPos = new BlockPos(i, j, k); - BlockState blockState = this.level().getBlockState(blockPos); - this.onRails = BaseRailBlock.isRail(blockState); - if (this.onRails) { - this.moveAlongTrack(blockPos, blockState); - if (blockState.is(Blocks.ACTIVATOR_RAIL)) { - this.activateMinecart(i, j, k, (Boolean)blockState.getValue(PoweredRailBlock.POWERED)); - } - } else { - this.comeOffTrack(); - } - - this.checkInsideBlocks(); - this.setXRot(0.0F); - double d = this.xo - this.getX(); - double e = this.zo - this.getZ(); - if (d * d + e * e > 0.001) { - this.setYRot((float)(Mth.atan2(e, d) * 180.0 / Math.PI)); - if (this.flipped) { - this.setYRot(this.getYRot() + 180.0F); - } - } - - double f = Mth.wrapDegrees(this.getYRot() - this.yRotO); - if (f < -170.0 || f >= 170.0) { - this.setYRot(this.getYRot() + 180.0F); - this.flipped = !this.flipped; - } - - this.setRot(this.getYRot(), this.getXRot()); - if (this.getMinecartType() == AbstractMinecart.Type.RIDEABLE && this.getDeltaMovement().horizontalDistanceSqr() > 0.01) { - List list = this.level().getEntities(this, this.getBoundingBox().inflate(0.2F, 0.0, 0.2F), EntitySelector.pushableBy(this)); - if (!list.isEmpty()) { - for (Entity entity : list) { - if (!(entity instanceof Player) && !(entity instanceof IronGolem) && !(entity instanceof AbstractMinecart) && !this.isVehicle() && !entity.isPassenger()) { - entity.startRiding(this); - } else { - entity.push(this); - } - } - } - } else { - for (Entity entity2 : this.level().getEntities(this, this.getBoundingBox().inflate(0.2F, 0.0, 0.2F))) { - if (!this.hasPassenger(entity2) && entity2.isPushable() && entity2 instanceof AbstractMinecart) { - entity2.push(this); - } - } - } - - this.updateInWaterStateAndDoFluidPushing(); - if (this.isInLava()) { - this.lavaHurt(); - this.fallDistance *= 0.5F; - } - - this.firstTick = false; + this.behavior.tick(); + this.updateInWaterStateAndDoFluidPushing(); + if (this.isInLava()) { + this.lavaHurt(); + this.fallDistance *= 0.5F; } + + this.firstTick = false; } - /** - * Gets the maximum speed for a minecart - */ - protected double getMaxSpeed() { - return (this.isInWater() ? 4.0 : 8.0) / 20.0; + public boolean isFirstTick() { + return this.firstTick; + } + + public BlockPos getCurrentBlockPosOrRailBelow() { + int i = Mth.floor(this.getX()); + int j = Mth.floor(this.getY()); + int k = Mth.floor(this.getZ()); + if (useExperimentalMovement(this.level())) { + double d = this.getY() - 0.1 - 1.0E-5F; + if (this.level().getBlockState(BlockPos.containing(i, d, k)).is(BlockTags.RAILS)) { + j = Mth.floor(d); + } + } else if (this.level().getBlockState(new BlockPos(i, j - 1, k)).is(BlockTags.RAILS)) { + j--; + } + + return new BlockPos(i, j, k); + } + + protected double getMaxSpeed(ServerLevel serverLevel) { + return this.behavior.getMaxSpeed(serverLevel); } /** @@ -330,11 +289,77 @@ public abstract class AbstractMinecart extends VehicleEntity { public void activateMinecart(int x, int y, int z, boolean powered) { } - /** - * Moves a minecart that is not attached to a rail - */ - protected void comeOffTrack() { - double d = this.getMaxSpeed(); + @Override + public void lerpPositionAndRotationStep(int steps, double targetX, double targetY, double targetZ, double targetYRot, double targetXRot) { + super.lerpPositionAndRotationStep(steps, targetX, targetY, targetZ, targetYRot, targetXRot); + } + + @Override + public void applyGravity() { + super.applyGravity(); + } + + @Override + public void reapplyPosition() { + super.reapplyPosition(); + } + + @Override + public boolean updateInWaterStateAndDoFluidPushing() { + return super.updateInWaterStateAndDoFluidPushing(); + } + + @Override + public Vec3 getKnownMovement() { + return this.behavior.getKnownMovement(super.getKnownMovement()); + } + + @Override + public void cancelLerp() { + this.behavior.cancelLerp(); + } + + @Override + public void lerpTo(double x, double y, double z, float yRot, float xRot, int steps) { + this.behavior.lerpTo(x, y, z, yRot, xRot, steps); + } + + @Override + public double lerpTargetX() { + return this.behavior.lerpTargetX(); + } + + @Override + public double lerpTargetY() { + return this.behavior.lerpTargetY(); + } + + @Override + public double lerpTargetZ() { + return this.behavior.lerpTargetZ(); + } + + @Override + public float lerpTargetXRot() { + return this.behavior.lerpTargetXRot(); + } + + @Override + public float lerpTargetYRot() { + return this.behavior.lerpTargetYRot(); + } + + @Override + public void lerpMotion(double x, double y, double z) { + this.behavior.lerpMotion(x, y, z); + } + + protected void moveAlongTrack(ServerLevel serverLevel) { + this.behavior.moveAlongTrack(serverLevel); + } + + protected void comeOffTrack(ServerLevel serverLevel) { + double d = this.getMaxSpeed(serverLevel); Vec3 vec3 = this.getDeltaMovement(); this.setDeltaMovement(Mth.clamp(vec3.x, -d, d), vec3.y, Mth.clamp(vec3.z, -d, d)); if (this.onGround()) { @@ -347,162 +372,35 @@ public abstract class AbstractMinecart extends VehicleEntity { } } - protected void moveAlongTrack(BlockPos pos, BlockState state) { - this.resetFallDistance(); - double d = this.getX(); - double e = this.getY(); - double f = this.getZ(); - Vec3 vec3 = this.getPos(d, e, f); - e = pos.getY(); - boolean bl = false; - boolean bl2 = false; - if (state.is(Blocks.POWERED_RAIL)) { - bl = (Boolean)state.getValue(PoweredRailBlock.POWERED); - bl2 = !bl; - } + protected double makeStepAlongTrack(BlockPos blockPos, RailShape railShape, double d) { + return this.behavior.stepAlongTrack(blockPos, railShape, d); + } - double g = 0.0078125; - if (this.isInWater()) { - g *= 0.2; - } - - Vec3 vec32 = this.getDeltaMovement(); - RailShape railShape = state.getValue(((BaseRailBlock)state.getBlock()).getShapeProperty()); - switch (railShape) { - case ASCENDING_EAST: - this.setDeltaMovement(vec32.add(-g, 0.0, 0.0)); - e++; - break; - case ASCENDING_WEST: - this.setDeltaMovement(vec32.add(g, 0.0, 0.0)); - e++; - break; - case ASCENDING_NORTH: - this.setDeltaMovement(vec32.add(0.0, 0.0, g)); - e++; - break; - case ASCENDING_SOUTH: - this.setDeltaMovement(vec32.add(0.0, 0.0, -g)); - e++; - } - - vec32 = this.getDeltaMovement(); - Pair pair = exits(railShape); - Vec3i vec3i = pair.getFirst(); - Vec3i vec3i2 = pair.getSecond(); - double h = vec3i2.getX() - vec3i.getX(); - double i = vec3i2.getZ() - vec3i.getZ(); - double j = Math.sqrt(h * h + i * i); - double k = vec32.x * h + vec32.z * i; - if (k < 0.0) { - h = -h; - i = -i; - } - - double l = Math.min(2.0, vec32.horizontalDistance()); - vec32 = new Vec3(l * h / j, vec32.y, l * i / j); - this.setDeltaMovement(vec32); - Entity entity = this.getFirstPassenger(); - if (entity instanceof Player) { - Vec3 vec33 = entity.getDeltaMovement(); - double m = vec33.horizontalDistanceSqr(); - double n = this.getDeltaMovement().horizontalDistanceSqr(); - if (m > 1.0E-4 && n < 0.01) { - this.setDeltaMovement(this.getDeltaMovement().add(vec33.x * 0.1, 0.0, vec33.z * 0.1)); - bl2 = false; + @Override + public void move(MoverType type, Vec3 pos) { + if (useExperimentalMovement(this.level())) { + Vec3 vec3 = this.position().add(pos); + super.move(type, pos); + boolean bl = this.behavior.pushAndPickupEntities(); + if (bl) { + super.move(type, vec3.subtract(this.position())); } - } - if (bl2) { - double o = this.getDeltaMovement().horizontalDistance(); - if (o < 0.03) { - this.setDeltaMovement(Vec3.ZERO); - } else { - this.setDeltaMovement(this.getDeltaMovement().multiply(0.5, 0.0, 0.5)); + if (type.equals(MoverType.PISTON)) { + this.onRails = false; } - } - - double o = pos.getX() + 0.5 + vec3i.getX() * 0.5; - double p = pos.getZ() + 0.5 + vec3i.getZ() * 0.5; - double q = pos.getX() + 0.5 + vec3i2.getX() * 0.5; - double r = pos.getZ() + 0.5 + vec3i2.getZ() * 0.5; - h = q - o; - i = r - p; - double s; - if (h == 0.0) { - s = f - pos.getZ(); - } else if (i == 0.0) { - s = d - pos.getX(); } else { - double t = d - o; - double u = f - p; - s = (t * h + u * i) * 2.0; + super.move(type, pos); + this.applyEffectsFromBlocks(); } + } - d = o + h * s; - f = p + i * s; - this.setPos(d, e, f); - double t = this.isVehicle() ? 0.75 : 1.0; - double u = this.getMaxSpeed(); - vec32 = this.getDeltaMovement(); - this.move(MoverType.SELF, new Vec3(Mth.clamp(t * vec32.x, -u, u), 0.0, Mth.clamp(t * vec32.z, -u, u))); - if (vec3i.getY() != 0 && Mth.floor(this.getX()) - pos.getX() == vec3i.getX() && Mth.floor(this.getZ()) - pos.getZ() == vec3i.getZ()) { - this.setPos(this.getX(), this.getY() + vec3i.getY(), this.getZ()); - } else if (vec3i2.getY() != 0 && Mth.floor(this.getX()) - pos.getX() == vec3i2.getX() && Mth.floor(this.getZ()) - pos.getZ() == vec3i2.getZ()) { - this.setPos(this.getX(), this.getY() + vec3i2.getY(), this.getZ()); - } - - this.applyNaturalSlowdown(); - Vec3 vec34 = this.getPos(this.getX(), this.getY(), this.getZ()); - if (vec34 != null && vec3 != null) { - double v = (vec3.y - vec34.y) * 0.05; - Vec3 vec35 = this.getDeltaMovement(); - double w = vec35.horizontalDistance(); - if (w > 0.0) { - this.setDeltaMovement(vec35.multiply((w + v) / w, 1.0, (w + v) / w)); - } - - this.setPos(this.getX(), vec34.y, this.getZ()); - } - - int x = Mth.floor(this.getX()); - int y = Mth.floor(this.getZ()); - if (x != pos.getX() || y != pos.getZ()) { - Vec3 vec35 = this.getDeltaMovement(); - double w = vec35.horizontalDistance(); - this.setDeltaMovement(w * (x - pos.getX()), vec35.y, w * (y - pos.getZ())); - } - - if (bl) { - Vec3 vec35 = this.getDeltaMovement(); - double w = vec35.horizontalDistance(); - if (w > 0.01) { - double z = 0.06; - this.setDeltaMovement(vec35.add(vec35.x / w * 0.06, 0.0, vec35.z / w * 0.06)); - } else { - Vec3 vec36 = this.getDeltaMovement(); - double aa = vec36.x; - double ab = vec36.z; - if (railShape == RailShape.EAST_WEST) { - if (this.isRedstoneConductor(pos.west())) { - aa = 0.02; - } else if (this.isRedstoneConductor(pos.east())) { - aa = -0.02; - } - } else { - if (railShape != RailShape.NORTH_SOUTH) { - return; - } - - if (this.isRedstoneConductor(pos.north())) { - ab = 0.02; - } else if (this.isRedstoneConductor(pos.south())) { - ab = -0.02; - } - } - - this.setDeltaMovement(aa, vec36.y, ab); - } + @Override + public void applyEffectsFromBlocks() { + if (!useExperimentalMovement(this.level())) { + this.applyEffectsFromBlocks(this.position(), this.position()); + } else { + super.applyEffectsFromBlocks(); } } @@ -511,114 +409,58 @@ public abstract class AbstractMinecart extends VehicleEntity { return this.onRails; } - private boolean isRedstoneConductor(BlockPos pos) { + public void setOnRails(boolean bl) { + this.onRails = bl; + } + + public boolean isFlipped() { + return this.flipped; + } + + public void setFlipped(boolean bl) { + this.flipped = bl; + } + + public Vec3 getRedstoneDirection(BlockPos blockPos) { + BlockState blockState = this.level().getBlockState(blockPos); + if (blockState.is(Blocks.POWERED_RAIL) && (Boolean)blockState.getValue(PoweredRailBlock.POWERED)) { + RailShape railShape = blockState.getValue(((BaseRailBlock)blockState.getBlock()).getShapeProperty()); + if (railShape == RailShape.EAST_WEST) { + if (this.isRedstoneConductor(blockPos.west())) { + return new Vec3(1.0, 0.0, 0.0); + } + + if (this.isRedstoneConductor(blockPos.east())) { + return new Vec3(-1.0, 0.0, 0.0); + } + } else if (railShape == RailShape.NORTH_SOUTH) { + if (this.isRedstoneConductor(blockPos.north())) { + return new Vec3(0.0, 0.0, 1.0); + } + + if (this.isRedstoneConductor(blockPos.south())) { + return new Vec3(0.0, 0.0, -1.0); + } + } + + return Vec3.ZERO; + } else { + return Vec3.ZERO; + } + } + + public boolean isRedstoneConductor(BlockPos pos) { return this.level().getBlockState(pos).isRedstoneConductor(this.level(), pos); } - protected void applyNaturalSlowdown() { - double d = this.isVehicle() ? 0.997 : 0.96; - Vec3 vec3 = this.getDeltaMovement(); - vec3 = vec3.multiply(d, 0.0, d); + protected Vec3 applyNaturalSlowdown(Vec3 vec3) { + double d = this.behavior.getSlowdownFactor(); + Vec3 vec32 = vec3.multiply(d, 0.0, d); if (this.isInWater()) { - vec3 = vec3.scale(0.95F); + vec32 = vec32.scale(0.95F); } - this.setDeltaMovement(vec3); - } - - @Nullable - public Vec3 getPosOffs(double x, double y, double z, double offset) { - int i = Mth.floor(x); - int j = Mth.floor(y); - int k = Mth.floor(z); - if (this.level().getBlockState(new BlockPos(i, j - 1, k)).is(BlockTags.RAILS)) { - j--; - } - - BlockState blockState = this.level().getBlockState(new BlockPos(i, j, k)); - if (BaseRailBlock.isRail(blockState)) { - RailShape railShape = blockState.getValue(((BaseRailBlock)blockState.getBlock()).getShapeProperty()); - y = j; - if (railShape.isAscending()) { - y = j + 1; - } - - Pair pair = exits(railShape); - Vec3i vec3i = pair.getFirst(); - Vec3i vec3i2 = pair.getSecond(); - double d = vec3i2.getX() - vec3i.getX(); - double e = vec3i2.getZ() - vec3i.getZ(); - double f = Math.sqrt(d * d + e * e); - d /= f; - e /= f; - x += d * offset; - z += e * offset; - if (vec3i.getY() != 0 && Mth.floor(x) - i == vec3i.getX() && Mth.floor(z) - k == vec3i.getZ()) { - y += vec3i.getY(); - } else if (vec3i2.getY() != 0 && Mth.floor(x) - i == vec3i2.getX() && Mth.floor(z) - k == vec3i2.getZ()) { - y += vec3i2.getY(); - } - - return this.getPos(x, y, z); - } else { - return null; - } - } - - @Nullable - public Vec3 getPos(double x, double y, double z) { - int i = Mth.floor(x); - int j = Mth.floor(y); - int k = Mth.floor(z); - if (this.level().getBlockState(new BlockPos(i, j - 1, k)).is(BlockTags.RAILS)) { - j--; - } - - BlockState blockState = this.level().getBlockState(new BlockPos(i, j, k)); - if (BaseRailBlock.isRail(blockState)) { - RailShape railShape = blockState.getValue(((BaseRailBlock)blockState.getBlock()).getShapeProperty()); - Pair pair = exits(railShape); - Vec3i vec3i = pair.getFirst(); - Vec3i vec3i2 = pair.getSecond(); - double d = i + 0.5 + vec3i.getX() * 0.5; - double e = j + 0.0625 + vec3i.getY() * 0.5; - double f = k + 0.5 + vec3i.getZ() * 0.5; - double g = i + 0.5 + vec3i2.getX() * 0.5; - double h = j + 0.0625 + vec3i2.getY() * 0.5; - double l = k + 0.5 + vec3i2.getZ() * 0.5; - double m = g - d; - double n = (h - e) * 2.0; - double o = l - f; - double p; - if (m == 0.0) { - p = z - k; - } else if (o == 0.0) { - p = x - i; - } else { - double q = x - d; - double r = z - f; - p = (q * m + r * o) * 2.0; - } - - x = d + m * p; - y = e + n * p; - z = f + o * p; - if (n < 0.0) { - y++; - } else if (n > 0.0) { - y += 0.5; - } - - return new Vec3(x, y, z); - } else { - return null; - } - } - - @Override - public AABB getBoundingBoxForCulling() { - AABB aABB = this.getBoundingBox(); - return this.hasCustomDisplay() ? aABB.inflate(Math.abs(this.getDisplayOffset()) / 16.0) : aABB; + return vec32; } @Override @@ -627,6 +469,9 @@ public abstract class AbstractMinecart extends VehicleEntity { this.setDisplayBlockState(NbtUtils.readBlockState(this.level().holderLookup(Registries.BLOCK), compound.getCompound("DisplayState"))); this.setDisplayOffset(compound.getInt("DisplayOffset")); } + + this.flipped = compound.getBoolean("FlippedRotation"); + this.firstTick = compound.getBoolean("HasTicked"); } @Override @@ -636,6 +481,9 @@ public abstract class AbstractMinecart extends VehicleEntity { compound.put("DisplayState", NbtUtils.writeBlockState(this.getDisplayBlockState())); compound.putInt("DisplayOffset", this.getDisplayOffset()); } + + compound.putBoolean("FlippedRotation", this.flipped); + compound.putBoolean("HasTicked", this.firstTick); } @Override @@ -661,34 +509,8 @@ public abstract class AbstractMinecart extends VehicleEntity { e *= 0.1F; d *= 0.5; e *= 0.5; - if (entity instanceof AbstractMinecart) { - double h = entity.getX() - this.getX(); - double i = entity.getZ() - this.getZ(); - Vec3 vec3 = new Vec3(h, 0.0, i).normalize(); - Vec3 vec32 = new Vec3(Mth.cos(this.getYRot() * (float) (Math.PI / 180.0)), 0.0, Mth.sin(this.getYRot() * (float) (Math.PI / 180.0))).normalize(); - double j = Math.abs(vec3.dot(vec32)); - if (j < 0.8F) { - return; - } - - Vec3 vec33 = this.getDeltaMovement(); - Vec3 vec34 = entity.getDeltaMovement(); - if (((AbstractMinecart)entity).getMinecartType() == AbstractMinecart.Type.FURNACE && this.getMinecartType() != AbstractMinecart.Type.FURNACE) { - this.setDeltaMovement(vec33.multiply(0.2, 1.0, 0.2)); - this.push(vec34.x - d, 0.0, vec34.z - e); - entity.setDeltaMovement(vec34.multiply(0.95, 1.0, 0.95)); - } else if (((AbstractMinecart)entity).getMinecartType() != AbstractMinecart.Type.FURNACE && this.getMinecartType() == AbstractMinecart.Type.FURNACE) { - entity.setDeltaMovement(vec34.multiply(0.2, 1.0, 0.2)); - entity.push(vec33.x + d, 0.0, vec33.z + e); - this.setDeltaMovement(vec33.multiply(0.95, 1.0, 0.95)); - } else { - double k = (vec34.x + vec33.x) / 2.0; - double l = (vec34.z + vec33.z) / 2.0; - this.setDeltaMovement(vec33.multiply(0.2, 1.0, 0.2)); - this.push(k - d, 0.0, l - e); - entity.setDeltaMovement(vec34.multiply(0.2, 1.0, 0.2)); - entity.push(k + d, 0.0, l + e); - } + if (entity instanceof AbstractMinecart abstractMinecart) { + this.pushOtherMinecart(abstractMinecart, d, e); } else { this.push(-d, 0.0, -e); entity.push(d / 4.0, 0.0, e / 4.0); @@ -699,50 +521,42 @@ public abstract class AbstractMinecart extends VehicleEntity { } } - @Override - public void lerpTo(double x, double y, double z, float yRot, float xRot, int steps) { - this.lerpX = x; - this.lerpY = y; - this.lerpZ = z; - this.lerpYRot = yRot; - this.lerpXRot = xRot; - this.lerpSteps = steps + 2; - this.setDeltaMovement(this.targetDeltaMovement); - } + private void pushOtherMinecart(AbstractMinecart abstractMinecart, double d, double e) { + double f; + double g; + if (useExperimentalMovement(this.level())) { + f = this.getDeltaMovement().x; + g = this.getDeltaMovement().z; + } else { + f = abstractMinecart.getX() - this.getX(); + g = abstractMinecart.getZ() - this.getZ(); + } - @Override - public double lerpTargetX() { - return this.lerpSteps > 0 ? this.lerpX : this.getX(); + Vec3 vec3 = new Vec3(f, 0.0, g).normalize(); + Vec3 vec32 = new Vec3(Mth.cos(this.getYRot() * (float) (Math.PI / 180.0)), 0.0, Mth.sin(this.getYRot() * (float) (Math.PI / 180.0))).normalize(); + double h = Math.abs(vec3.dot(vec32)); + if (!(h < 0.8F) || useExperimentalMovement(this.level())) { + Vec3 vec33 = this.getDeltaMovement(); + Vec3 vec34 = abstractMinecart.getDeltaMovement(); + if (abstractMinecart.isFurnace() && !this.isFurnace()) { + this.setDeltaMovement(vec33.multiply(0.2, 1.0, 0.2)); + this.push(vec34.x - d, 0.0, vec34.z - e); + abstractMinecart.setDeltaMovement(vec34.multiply(0.95, 1.0, 0.95)); + } else if (!abstractMinecart.isFurnace() && this.isFurnace()) { + abstractMinecart.setDeltaMovement(vec34.multiply(0.2, 1.0, 0.2)); + abstractMinecart.push(vec33.x + d, 0.0, vec33.z + e); + this.setDeltaMovement(vec33.multiply(0.95, 1.0, 0.95)); + } else { + double i = (vec34.x + vec33.x) / 2.0; + double j = (vec34.z + vec33.z) / 2.0; + this.setDeltaMovement(vec33.multiply(0.2, 1.0, 0.2)); + this.push(i - d, 0.0, j - e); + abstractMinecart.setDeltaMovement(vec34.multiply(0.2, 1.0, 0.2)); + abstractMinecart.push(i + d, 0.0, j + e); + } + } } - @Override - public double lerpTargetY() { - return this.lerpSteps > 0 ? this.lerpY : this.getY(); - } - - @Override - public double lerpTargetZ() { - return this.lerpSteps > 0 ? this.lerpZ : this.getZ(); - } - - @Override - public float lerpTargetXRot() { - return this.lerpSteps > 0 ? (float)this.lerpXRot : this.getXRot(); - } - - @Override - public float lerpTargetYRot() { - return this.lerpSteps > 0 ? (float)this.lerpYRot : this.getYRot(); - } - - @Override - public void lerpMotion(double x, double y, double z) { - this.targetDeltaMovement = new Vec3(x, y, z); - this.setDeltaMovement(this.targetDeltaMovement); - } - - public abstract AbstractMinecart.Type getMinecartType(); - public BlockState getDisplayBlockState() { return !this.hasCustomDisplay() ? this.getDefaultDisplayBlockState() : Block.stateById(this.getEntityData().get(DATA_ID_DISPLAY_BLOCK)); } @@ -777,25 +591,18 @@ public abstract class AbstractMinecart extends VehicleEntity { this.getEntityData().set(DATA_ID_CUSTOM_DISPLAY, customDisplay); } - @Override - public ItemStack getPickResult() { - return new ItemStack(switch (this.getMinecartType()) { - case CHEST -> Items.CHEST_MINECART; - case FURNACE -> Items.FURNACE_MINECART; - case TNT -> Items.TNT_MINECART; - default -> Items.MINECART; - case HOPPER -> Items.HOPPER_MINECART; - case COMMAND_BLOCK -> Items.COMMAND_BLOCK_MINECART; - }); + public static boolean useExperimentalMovement(Level level) { + return level.enabledFeatures().contains(FeatureFlags.MINECART_IMPROVEMENTS); } - public static enum Type { - RIDEABLE, - CHEST, - FURNACE, - TNT, - SPAWNER, - HOPPER, - COMMAND_BLOCK; + @Override + public abstract ItemStack getPickResult(); + + public boolean isRideable() { + return false; + } + + public boolean isFurnace() { + return false; } } diff --git a/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java b/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java index db224706..a2750c2c 100644 --- a/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java +++ b/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java @@ -3,6 +3,7 @@ package net.minecraft.world.entity.vehicle; import net.minecraft.core.NonNullList; import net.minecraft.nbt.CompoundTag; import net.minecraft.resources.ResourceKey; +import net.minecraft.server.level.ServerLevel; import net.minecraft.world.Containers; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; @@ -16,6 +17,7 @@ import net.minecraft.world.inventory.AbstractContainerMenu; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; import net.minecraft.world.level.storage.loot.LootTable; +import net.minecraft.world.phys.Vec3; import org.jetbrains.annotations.Nullable; public abstract class AbstractMinecartContainer extends AbstractMinecart implements ContainerEntity { @@ -28,14 +30,10 @@ public abstract class AbstractMinecartContainer extends AbstractMinecart impleme super(entityType, level); } - protected AbstractMinecartContainer(EntityType entityType, double x, double y, double z, Level level) { - super(entityType, level, x, y, z); - } - @Override - public void destroy(DamageSource source) { - super.destroy(source); - this.chestVehicleDestroyed(source, this.level(), this); + public void destroy(ServerLevel serverLevel, DamageSource damageSource) { + super.destroy(serverLevel, damageSource); + this.chestVehicleDestroyed(damageSource, serverLevel, this); } @Override @@ -99,7 +97,7 @@ public abstract class AbstractMinecartContainer extends AbstractMinecart impleme } @Override - protected void applyNaturalSlowdown() { + protected Vec3 applyNaturalSlowdown(Vec3 vec3) { float f = 0.98F; if (this.lootTable == null) { int i = 15 - AbstractContainerMenu.getRedstoneSignalFromContainer(this); @@ -110,7 +108,7 @@ public abstract class AbstractMinecartContainer extends AbstractMinecart impleme f *= 0.95F; } - this.setDeltaMovement(this.getDeltaMovement().multiply(f, 0.0, f)); + return vec3.multiply(f, 0.0, f); } @Override @@ -138,23 +136,23 @@ public abstract class AbstractMinecartContainer extends AbstractMinecart impleme @Nullable @Override - public ResourceKey getLootTable() { + public ResourceKey getContainerLootTable() { return this.lootTable; } @Override - public void setLootTable(@Nullable ResourceKey lootTable) { - this.lootTable = lootTable; + public void setContainerLootTable(@Nullable ResourceKey resourceKey) { + this.lootTable = resourceKey; } @Override - public long getLootTableSeed() { + public long getContainerLootTableSeed() { return this.lootTableSeed; } @Override - public void setLootTableSeed(long lootTableSeed) { - this.lootTableSeed = lootTableSeed; + public void setContainerLootTableSeed(long l) { + this.lootTableSeed = l; } @Override diff --git a/net/minecraft/world/entity/vehicle/Boat.java b/net/minecraft/world/entity/vehicle/Boat.java index 281d90a2..ce1cbb46 100644 --- a/net/minecraft/world/entity/vehicle/Boat.java +++ b/net/minecraft/world/entity/vehicle/Boat.java @@ -1,950 +1,18 @@ package net.minecraft.world.entity.vehicle; -import com.google.common.collect.Lists; -import java.util.List; -import java.util.function.IntFunction; -import net.minecraft.BlockUtil; -import net.minecraft.core.BlockPos; -import net.minecraft.core.Direction; -import net.minecraft.core.particles.ParticleTypes; -import net.minecraft.nbt.CompoundTag; -import net.minecraft.network.chat.Component; -import net.minecraft.network.protocol.game.ServerboundPaddleBoatPacket; -import net.minecraft.network.syncher.EntityDataAccessor; -import net.minecraft.network.syncher.EntityDataSerializers; -import net.minecraft.network.syncher.SynchedEntityData; -import net.minecraft.sounds.SoundEvent; -import net.minecraft.sounds.SoundEvents; -import net.minecraft.tags.EntityTypeTags; -import net.minecraft.tags.FluidTags; -import net.minecraft.util.ByIdMap; -import net.minecraft.util.Mth; -import net.minecraft.util.StringRepresentable; -import net.minecraft.world.InteractionHand; -import net.minecraft.world.InteractionResult; -import net.minecraft.world.entity.Entity; +import java.util.function.Supplier; import net.minecraft.world.entity.EntityDimensions; -import net.minecraft.world.entity.EntitySelector; import net.minecraft.world.entity.EntityType; -import net.minecraft.world.entity.Leashable; -import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.entity.MoverType; -import net.minecraft.world.entity.Pose; -import net.minecraft.world.entity.VariantHolder; -import net.minecraft.world.entity.animal.Animal; -import net.minecraft.world.entity.animal.WaterAnimal; -import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.Item; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.Items; -import net.minecraft.world.level.GameRules; import net.minecraft.world.level.Level; -import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.block.Blocks; -import net.minecraft.world.level.block.WaterlilyBlock; -import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.world.level.gameevent.GameEvent; -import net.minecraft.world.level.material.FluidState; -import net.minecraft.world.phys.AABB; -import net.minecraft.world.phys.Vec3; -import net.minecraft.world.phys.shapes.BooleanOp; -import net.minecraft.world.phys.shapes.Shapes; -import net.minecraft.world.phys.shapes.VoxelShape; -import org.jetbrains.annotations.Nullable; -public class Boat extends VehicleEntity implements Leashable, VariantHolder { - private static final EntityDataAccessor DATA_ID_TYPE = SynchedEntityData.defineId(Boat.class, EntityDataSerializers.INT); - private static final EntityDataAccessor DATA_ID_PADDLE_LEFT = SynchedEntityData.defineId(Boat.class, EntityDataSerializers.BOOLEAN); - private static final EntityDataAccessor DATA_ID_PADDLE_RIGHT = SynchedEntityData.defineId(Boat.class, EntityDataSerializers.BOOLEAN); - private static final EntityDataAccessor DATA_ID_BUBBLE_TIME = SynchedEntityData.defineId(Boat.class, EntityDataSerializers.INT); - public static final int PADDLE_LEFT = 0; - public static final int PADDLE_RIGHT = 1; - private static final int TIME_TO_EJECT = 60; - private static final float PADDLE_SPEED = (float) (Math.PI / 8); - public static final double PADDLE_SOUND_TIME = (float) (Math.PI / 4); - public static final int BUBBLE_TIME = 60; - private final float[] paddlePositions = new float[2]; - private float invFriction; - private float outOfControlTicks; - private float deltaRotation; - private int lerpSteps; - private double lerpX; - private double lerpY; - private double lerpZ; - private double lerpYRot; - private double lerpXRot; - private boolean inputLeft; - private boolean inputRight; - private boolean inputUp; - private boolean inputDown; - private double waterLevel; - private float landFriction; - private Boat.Status status; - private Boat.Status oldStatus; - private double lastYd; - private boolean isAboveBubbleColumn; - private boolean bubbleColumnDirectionIsDown; - private float bubbleMultiplier; - private float bubbleAngle; - private float bubbleAngleO; - @Nullable - private Leashable.LeashData leashData; - - public Boat(EntityType entityType, Level level) { - super(entityType, level); - this.blocksBuilding = true; - } - - public Boat(Level level, double x, double y, double z) { - this(EntityType.BOAT, level); - this.setPos(x, y, z); - this.xo = x; - this.yo = y; - this.zo = z; +public class Boat extends AbstractBoat { + public Boat(EntityType entityType, Level level, Supplier supplier) { + super(entityType, level, supplier); } @Override - protected Entity.MovementEmission getMovementEmission() { - return Entity.MovementEmission.EVENTS; - } - - @Override - protected void defineSynchedData(SynchedEntityData.Builder builder) { - super.defineSynchedData(builder); - builder.define(DATA_ID_TYPE, Boat.Type.OAK.ordinal()); - builder.define(DATA_ID_PADDLE_LEFT, false); - builder.define(DATA_ID_PADDLE_RIGHT, false); - builder.define(DATA_ID_BUBBLE_TIME, 0); - } - - @Override - public boolean canCollideWith(Entity entity) { - return canVehicleCollide(this, entity); - } - - public static boolean canVehicleCollide(Entity vehicle, Entity entity) { - return (entity.canBeCollidedWith() || entity.isPushable()) && !vehicle.isPassengerOfSameVehicle(entity); - } - - @Override - public boolean canBeCollidedWith() { - return true; - } - - @Override - public boolean isPushable() { - return true; - } - - @Override - public Vec3 getRelativePortalPosition(Direction.Axis axis, BlockUtil.FoundRectangle portal) { - return LivingEntity.resetForwardDirectionOfRelativePortalPosition(super.getRelativePortalPosition(axis, portal)); - } - - @Override - protected Vec3 getPassengerAttachmentPoint(Entity entity, EntityDimensions dimensions, float partialTick) { - float f = this.getSinglePassengerXOffset(); - if (this.getPassengers().size() > 1) { - int i = this.getPassengers().indexOf(entity); - if (i == 0) { - f = 0.2F; - } else { - f = -0.6F; - } - - if (entity instanceof Animal) { - f += 0.2F; - } - } - - return new Vec3(0.0, this.getVariant() == Boat.Type.BAMBOO ? dimensions.height() * 0.8888889F : dimensions.height() / 3.0F, f) - .yRot(-this.getYRot() * (float) (Math.PI / 180.0)); - } - - @Override - public void onAboveBubbleCol(boolean downwards) { - if (!this.level().isClientSide) { - this.isAboveBubbleColumn = true; - this.bubbleColumnDirectionIsDown = downwards; - if (this.getBubbleTime() == 0) { - this.setBubbleTime(60); - } - } - - this.level() - .addParticle(ParticleTypes.SPLASH, this.getX() + this.random.nextFloat(), this.getY() + 0.7, this.getZ() + this.random.nextFloat(), 0.0, 0.0, 0.0); - if (this.random.nextInt(20) == 0) { - this.level() - .playLocalSound(this.getX(), this.getY(), this.getZ(), this.getSwimSplashSound(), this.getSoundSource(), 1.0F, 0.8F + 0.4F * this.random.nextFloat(), false); - this.gameEvent(GameEvent.SPLASH, this.getControllingPassenger()); - } - } - - @Override - public void push(Entity entity) { - if (entity instanceof Boat) { - if (entity.getBoundingBox().minY < this.getBoundingBox().maxY) { - super.push(entity); - } - } else if (entity.getBoundingBox().minY <= this.getBoundingBox().minY) { - super.push(entity); - } - } - - @Override - public Item getDropItem() { - return switch (this.getVariant()) { - case SPRUCE -> Items.SPRUCE_BOAT; - case BIRCH -> Items.BIRCH_BOAT; - case JUNGLE -> Items.JUNGLE_BOAT; - case ACACIA -> Items.ACACIA_BOAT; - case CHERRY -> Items.CHERRY_BOAT; - case DARK_OAK -> Items.DARK_OAK_BOAT; - case MANGROVE -> Items.MANGROVE_BOAT; - case BAMBOO -> Items.BAMBOO_RAFT; - default -> Items.OAK_BOAT; - }; - } - - @Override - public void animateHurt(float yaw) { - this.setHurtDir(-this.getHurtDir()); - this.setHurtTime(10); - this.setDamage(this.getDamage() * 11.0F); - } - - @Override - public boolean isPickable() { - return !this.isRemoved(); - } - - @Override - public void lerpTo(double x, double y, double z, float yRot, float xRot, int steps) { - this.lerpX = x; - this.lerpY = y; - this.lerpZ = z; - this.lerpYRot = yRot; - this.lerpXRot = xRot; - this.lerpSteps = 10; - } - - @Override - public double lerpTargetX() { - return this.lerpSteps > 0 ? this.lerpX : this.getX(); - } - - @Override - public double lerpTargetY() { - return this.lerpSteps > 0 ? this.lerpY : this.getY(); - } - - @Override - public double lerpTargetZ() { - return this.lerpSteps > 0 ? this.lerpZ : this.getZ(); - } - - @Override - public float lerpTargetXRot() { - return this.lerpSteps > 0 ? (float)this.lerpXRot : this.getXRot(); - } - - @Override - public float lerpTargetYRot() { - return this.lerpSteps > 0 ? (float)this.lerpYRot : this.getYRot(); - } - - @Override - public Direction getMotionDirection() { - return this.getDirection().getClockWise(); - } - - @Override - public void tick() { - this.oldStatus = this.status; - this.status = this.getStatus(); - if (this.status != Boat.Status.UNDER_WATER && this.status != Boat.Status.UNDER_FLOWING_WATER) { - this.outOfControlTicks = 0.0F; - } else { - this.outOfControlTicks++; - } - - if (!this.level().isClientSide && this.outOfControlTicks >= 60.0F) { - this.ejectPassengers(); - } - - if (this.getHurtTime() > 0) { - this.setHurtTime(this.getHurtTime() - 1); - } - - if (this.getDamage() > 0.0F) { - this.setDamage(this.getDamage() - 1.0F); - } - - super.tick(); - this.tickLerp(); - if (this.isControlledByLocalInstance()) { - if (!(this.getFirstPassenger() instanceof Player)) { - this.setPaddleState(false, false); - } - - this.floatBoat(); - if (this.level().isClientSide) { - this.controlBoat(); - this.level().sendPacketToServer(new ServerboundPaddleBoatPacket(this.getPaddleState(0), this.getPaddleState(1))); - } - - this.move(MoverType.SELF, this.getDeltaMovement()); - } else { - this.setDeltaMovement(Vec3.ZERO); - } - - this.tickBubbleColumn(); - - for (int i = 0; i <= 1; i++) { - if (this.getPaddleState(i)) { - if (!this.isSilent() - && this.paddlePositions[i] % (float) (Math.PI * 2) <= (float) (Math.PI / 4) - && (this.paddlePositions[i] + (float) (Math.PI / 8)) % (float) (Math.PI * 2) >= (float) (Math.PI / 4)) { - SoundEvent soundEvent = this.getPaddleSound(); - if (soundEvent != null) { - Vec3 vec3 = this.getViewVector(1.0F); - double d = i == 1 ? -vec3.z : vec3.z; - double e = i == 1 ? vec3.x : -vec3.x; - this.level() - .playSound(null, this.getX() + d, this.getY(), this.getZ() + e, soundEvent, this.getSoundSource(), 1.0F, 0.8F + 0.4F * this.random.nextFloat()); - } - } - - this.paddlePositions[i] = this.paddlePositions[i] + (float) (Math.PI / 8); - } else { - this.paddlePositions[i] = 0.0F; - } - } - - this.checkInsideBlocks(); - List list = this.level().getEntities(this, this.getBoundingBox().inflate(0.2F, -0.01F, 0.2F), EntitySelector.pushableBy(this)); - if (!list.isEmpty()) { - boolean bl = !this.level().isClientSide && !(this.getControllingPassenger() instanceof Player); - - for (Entity entity : list) { - if (!entity.hasPassenger(this)) { - if (bl - && this.getPassengers().size() < this.getMaxPassengers() - && !entity.isPassenger() - && this.hasEnoughSpaceFor(entity) - && entity instanceof LivingEntity - && !(entity instanceof WaterAnimal) - && !(entity instanceof Player)) { - entity.startRiding(this); - } else { - this.push(entity); - } - } - } - } - } - - private void tickBubbleColumn() { - if (this.level().isClientSide) { - int i = this.getBubbleTime(); - if (i > 0) { - this.bubbleMultiplier += 0.05F; - } else { - this.bubbleMultiplier -= 0.1F; - } - - this.bubbleMultiplier = Mth.clamp(this.bubbleMultiplier, 0.0F, 1.0F); - this.bubbleAngleO = this.bubbleAngle; - this.bubbleAngle = 10.0F * (float)Math.sin(0.5F * (float)this.level().getGameTime()) * this.bubbleMultiplier; - } else { - if (!this.isAboveBubbleColumn) { - this.setBubbleTime(0); - } - - int i = this.getBubbleTime(); - if (i > 0) { - this.setBubbleTime(--i); - int j = 60 - i - 1; - if (j > 0 && i == 0) { - this.setBubbleTime(0); - Vec3 vec3 = this.getDeltaMovement(); - if (this.bubbleColumnDirectionIsDown) { - this.setDeltaMovement(vec3.add(0.0, -0.7, 0.0)); - this.ejectPassengers(); - } else { - this.setDeltaMovement(vec3.x, this.hasPassenger(entity -> entity instanceof Player) ? 2.7 : 0.6, vec3.z); - } - } - - this.isAboveBubbleColumn = false; - } - } - } - - @Nullable - protected SoundEvent getPaddleSound() { - switch (this.getStatus()) { - case IN_WATER: - case UNDER_WATER: - case UNDER_FLOWING_WATER: - return SoundEvents.BOAT_PADDLE_WATER; - case ON_LAND: - return SoundEvents.BOAT_PADDLE_LAND; - case IN_AIR: - default: - return null; - } - } - - private void tickLerp() { - if (this.isControlledByLocalInstance()) { - this.lerpSteps = 0; - this.syncPacketPositionCodec(this.getX(), this.getY(), this.getZ()); - } - - if (this.lerpSteps > 0) { - this.lerpPositionAndRotationStep(this.lerpSteps, this.lerpX, this.lerpY, this.lerpZ, this.lerpYRot, this.lerpXRot); - this.lerpSteps--; - } - } - - public void setPaddleState(boolean left, boolean right) { - this.entityData.set(DATA_ID_PADDLE_LEFT, left); - this.entityData.set(DATA_ID_PADDLE_RIGHT, right); - } - - public float getRowingTime(int side, float limbSwing) { - return this.getPaddleState(side) ? Mth.clampedLerp(this.paddlePositions[side] - (float) (Math.PI / 8), this.paddlePositions[side], limbSwing) : 0.0F; - } - - @Nullable - @Override - public Leashable.LeashData getLeashData() { - return this.leashData; - } - - @Override - public void setLeashData(@Nullable Leashable.LeashData leashData) { - this.leashData = leashData; - } - - @Override - public Vec3 getLeashOffset() { - return new Vec3(0.0, 0.88F * this.getEyeHeight(), this.getBbWidth() * 0.64F); - } - - @Override - public void elasticRangeLeashBehaviour(Entity leashHolder, float distance) { - Vec3 vec3 = leashHolder.position().subtract(this.position()).normalize().scale(distance - 6.0); - Vec3 vec32 = this.getDeltaMovement(); - boolean bl = vec32.dot(vec3) > 0.0; - this.setDeltaMovement(vec32.add(vec3.scale(bl ? 0.15F : 0.2F))); - } - - /** - * Determines whether the boat is in water, gliding on land, or in air - */ - private Boat.Status getStatus() { - Boat.Status status = this.isUnderwater(); - if (status != null) { - this.waterLevel = this.getBoundingBox().maxY; - return status; - } else if (this.checkInWater()) { - return Boat.Status.IN_WATER; - } else { - float f = this.getGroundFriction(); - if (f > 0.0F) { - this.landFriction = f; - return Boat.Status.ON_LAND; - } else { - return Boat.Status.IN_AIR; - } - } - } - - public float getWaterLevelAbove() { - AABB aABB = this.getBoundingBox(); - int i = Mth.floor(aABB.minX); - int j = Mth.ceil(aABB.maxX); - int k = Mth.floor(aABB.maxY); - int l = Mth.ceil(aABB.maxY - this.lastYd); - int m = Mth.floor(aABB.minZ); - int n = Mth.ceil(aABB.maxZ); - BlockPos.MutableBlockPos mutableBlockPos = new BlockPos.MutableBlockPos(); - - label39: - for (int o = k; o < l; o++) { - float f = 0.0F; - - for (int p = i; p < j; p++) { - for (int q = m; q < n; q++) { - mutableBlockPos.set(p, o, q); - FluidState fluidState = this.level().getFluidState(mutableBlockPos); - if (fluidState.is(FluidTags.WATER)) { - f = Math.max(f, fluidState.getHeight(this.level(), mutableBlockPos)); - } - - if (f >= 1.0F) { - continue label39; - } - } - } - - if (f < 1.0F) { - return mutableBlockPos.getY() + f; - } - } - - return l + 1; - } - - /** - * Decides how much the boat should be gliding on the land (based on any slippery blocks) - */ - public float getGroundFriction() { - AABB aABB = this.getBoundingBox(); - AABB aABB2 = new AABB(aABB.minX, aABB.minY - 0.001, aABB.minZ, aABB.maxX, aABB.minY, aABB.maxZ); - int i = Mth.floor(aABB2.minX) - 1; - int j = Mth.ceil(aABB2.maxX) + 1; - int k = Mth.floor(aABB2.minY) - 1; - int l = Mth.ceil(aABB2.maxY) + 1; - int m = Mth.floor(aABB2.minZ) - 1; - int n = Mth.ceil(aABB2.maxZ) + 1; - VoxelShape voxelShape = Shapes.create(aABB2); - float f = 0.0F; - int o = 0; - BlockPos.MutableBlockPos mutableBlockPos = new BlockPos.MutableBlockPos(); - - for (int p = i; p < j; p++) { - for (int q = m; q < n; q++) { - int r = (p != i && p != j - 1 ? 0 : 1) + (q != m && q != n - 1 ? 0 : 1); - if (r != 2) { - for (int s = k; s < l; s++) { - if (r <= 0 || s != k && s != l - 1) { - mutableBlockPos.set(p, s, q); - BlockState blockState = this.level().getBlockState(mutableBlockPos); - if (!(blockState.getBlock() instanceof WaterlilyBlock) - && Shapes.joinIsNotEmpty(blockState.getCollisionShape(this.level(), mutableBlockPos).move(p, s, q), voxelShape, BooleanOp.AND)) { - f += blockState.getBlock().getFriction(); - o++; - } - } - } - } - } - } - - return f / o; - } - - private boolean checkInWater() { - AABB aABB = this.getBoundingBox(); - int i = Mth.floor(aABB.minX); - int j = Mth.ceil(aABB.maxX); - int k = Mth.floor(aABB.minY); - int l = Mth.ceil(aABB.minY + 0.001); - int m = Mth.floor(aABB.minZ); - int n = Mth.ceil(aABB.maxZ); - boolean bl = false; - this.waterLevel = -Double.MAX_VALUE; - BlockPos.MutableBlockPos mutableBlockPos = new BlockPos.MutableBlockPos(); - - for (int o = i; o < j; o++) { - for (int p = k; p < l; p++) { - for (int q = m; q < n; q++) { - mutableBlockPos.set(o, p, q); - FluidState fluidState = this.level().getFluidState(mutableBlockPos); - if (fluidState.is(FluidTags.WATER)) { - float f = p + fluidState.getHeight(this.level(), mutableBlockPos); - this.waterLevel = Math.max(f, this.waterLevel); - bl |= aABB.minY < f; - } - } - } - } - - return bl; - } - - /** - * Decides whether the boat is currently underwater. - */ - @Nullable - private Boat.Status isUnderwater() { - AABB aABB = this.getBoundingBox(); - double d = aABB.maxY + 0.001; - int i = Mth.floor(aABB.minX); - int j = Mth.ceil(aABB.maxX); - int k = Mth.floor(aABB.maxY); - int l = Mth.ceil(d); - int m = Mth.floor(aABB.minZ); - int n = Mth.ceil(aABB.maxZ); - boolean bl = false; - BlockPos.MutableBlockPos mutableBlockPos = new BlockPos.MutableBlockPos(); - - for (int o = i; o < j; o++) { - for (int p = k; p < l; p++) { - for (int q = m; q < n; q++) { - mutableBlockPos.set(o, p, q); - FluidState fluidState = this.level().getFluidState(mutableBlockPos); - if (fluidState.is(FluidTags.WATER) && d < mutableBlockPos.getY() + fluidState.getHeight(this.level(), mutableBlockPos)) { - if (!fluidState.isSource()) { - return Boat.Status.UNDER_FLOWING_WATER; - } - - bl = true; - } - } - } - } - - return bl ? Boat.Status.UNDER_WATER : null; - } - - @Override - protected double getDefaultGravity() { - return 0.04; - } - - /** - * Update the boat's speed, based on momentum. - */ - private void floatBoat() { - double d = -this.getGravity(); - double e = 0.0; - this.invFriction = 0.05F; - if (this.oldStatus == Boat.Status.IN_AIR && this.status != Boat.Status.IN_AIR && this.status != Boat.Status.ON_LAND) { - this.waterLevel = this.getY(1.0); - double f = this.getWaterLevelAbove() - this.getBbHeight() + 0.101; - if (this.level().noCollision(this, this.getBoundingBox().move(0.0, f - this.getY(), 0.0))) { - this.setPos(this.getX(), f, this.getZ()); - this.setDeltaMovement(this.getDeltaMovement().multiply(1.0, 0.0, 1.0)); - this.lastYd = 0.0; - } - - this.status = Boat.Status.IN_WATER; - } else { - if (this.status == Boat.Status.IN_WATER) { - e = (this.waterLevel - this.getY()) / this.getBbHeight(); - this.invFriction = 0.9F; - } else if (this.status == Boat.Status.UNDER_FLOWING_WATER) { - d = -7.0E-4; - this.invFriction = 0.9F; - } else if (this.status == Boat.Status.UNDER_WATER) { - e = 0.01F; - this.invFriction = 0.45F; - } else if (this.status == Boat.Status.IN_AIR) { - this.invFriction = 0.9F; - } else if (this.status == Boat.Status.ON_LAND) { - this.invFriction = this.landFriction; - if (this.getControllingPassenger() instanceof Player) { - this.landFriction /= 2.0F; - } - } - - Vec3 vec3 = this.getDeltaMovement(); - this.setDeltaMovement(vec3.x * this.invFriction, vec3.y + d, vec3.z * this.invFriction); - this.deltaRotation = this.deltaRotation * this.invFriction; - if (e > 0.0) { - Vec3 vec32 = this.getDeltaMovement(); - this.setDeltaMovement(vec32.x, (vec32.y + e * (this.getDefaultGravity() / 0.65)) * 0.75, vec32.z); - } - } - } - - private void controlBoat() { - if (this.isVehicle()) { - float f = 0.0F; - if (this.inputLeft) { - this.deltaRotation--; - } - - if (this.inputRight) { - this.deltaRotation++; - } - - if (this.inputRight != this.inputLeft && !this.inputUp && !this.inputDown) { - f += 0.005F; - } - - this.setYRot(this.getYRot() + this.deltaRotation); - if (this.inputUp) { - f += 0.04F; - } - - if (this.inputDown) { - f -= 0.005F; - } - - this.setDeltaMovement( - this.getDeltaMovement().add(Mth.sin(-this.getYRot() * (float) (Math.PI / 180.0)) * f, 0.0, Mth.cos(this.getYRot() * (float) (Math.PI / 180.0)) * f) - ); - this.setPaddleState(this.inputRight && !this.inputLeft || this.inputUp, this.inputLeft && !this.inputRight || this.inputUp); - } - } - - protected float getSinglePassengerXOffset() { - return 0.0F; - } - - public boolean hasEnoughSpaceFor(Entity entity) { - return entity.getBbWidth() < this.getBbWidth(); - } - - @Override - protected void positionRider(Entity passenger, Entity.MoveFunction callback) { - super.positionRider(passenger, callback); - if (!passenger.getType().is(EntityTypeTags.CAN_TURN_IN_BOATS)) { - passenger.setYRot(passenger.getYRot() + this.deltaRotation); - passenger.setYHeadRot(passenger.getYHeadRot() + this.deltaRotation); - this.clampRotation(passenger); - if (passenger instanceof Animal && this.getPassengers().size() == this.getMaxPassengers()) { - int i = passenger.getId() % 2 == 0 ? 90 : 270; - passenger.setYBodyRot(((Animal)passenger).yBodyRot + i); - passenger.setYHeadRot(passenger.getYHeadRot() + i); - } - } - } - - @Override - public Vec3 getDismountLocationForPassenger(LivingEntity passenger) { - Vec3 vec3 = getCollisionHorizontalEscapeVector(this.getBbWidth() * Mth.SQRT_OF_TWO, passenger.getBbWidth(), passenger.getYRot()); - double d = this.getX() + vec3.x; - double e = this.getZ() + vec3.z; - BlockPos blockPos = BlockPos.containing(d, this.getBoundingBox().maxY, e); - BlockPos blockPos2 = blockPos.below(); - if (!this.level().isWaterAt(blockPos2)) { - List list = Lists.newArrayList(); - double f = this.level().getBlockFloorHeight(blockPos); - if (DismountHelper.isBlockFloorValid(f)) { - list.add(new Vec3(d, blockPos.getY() + f, e)); - } - - double g = this.level().getBlockFloorHeight(blockPos2); - if (DismountHelper.isBlockFloorValid(g)) { - list.add(new Vec3(d, blockPos2.getY() + g, e)); - } - - for (Pose pose : passenger.getDismountPoses()) { - for (Vec3 vec32 : list) { - if (DismountHelper.canDismountTo(this.level(), vec32, passenger, pose)) { - passenger.setPose(pose); - return vec32; - } - } - } - } - - return super.getDismountLocationForPassenger(passenger); - } - - /** - * Applies this boat's yaw to the given entity. Used to update the orientation of its passenger. - */ - protected void clampRotation(Entity entityToUpdate) { - entityToUpdate.setYBodyRot(this.getYRot()); - float f = Mth.wrapDegrees(entityToUpdate.getYRot() - this.getYRot()); - float g = Mth.clamp(f, -105.0F, 105.0F); - entityToUpdate.yRotO += g - f; - entityToUpdate.setYRot(entityToUpdate.getYRot() + g - f); - entityToUpdate.setYHeadRot(entityToUpdate.getYRot()); - } - - @Override - public void onPassengerTurned(Entity entityToUpdate) { - this.clampRotation(entityToUpdate); - } - - @Override - protected void addAdditionalSaveData(CompoundTag compound) { - this.writeLeashData(compound, this.leashData); - compound.putString("Type", this.getVariant().getSerializedName()); - } - - @Override - protected void readAdditionalSaveData(CompoundTag compound) { - this.leashData = this.readLeashData(compound); - if (compound.contains("Type", 8)) { - this.setVariant(Boat.Type.byName(compound.getString("Type"))); - } - } - - @Override - public InteractionResult interact(Player player, InteractionHand hand) { - InteractionResult interactionResult = super.interact(player, hand); - if (interactionResult != InteractionResult.PASS) { - return interactionResult; - } else if (player.isSecondaryUseActive()) { - return InteractionResult.PASS; - } else if (this.outOfControlTicks < 60.0F) { - if (!this.level().isClientSide) { - return player.startRiding(this) ? InteractionResult.CONSUME : InteractionResult.PASS; - } else { - return InteractionResult.SUCCESS; - } - } else { - return InteractionResult.PASS; - } - } - - @Override - public void remove(Entity.RemovalReason reason) { - if (!this.level().isClientSide && reason.shouldDestroy() && this.isLeashed()) { - this.dropLeash(true, true); - } - - super.remove(reason); - } - - @Override - protected void checkFallDamage(double y, boolean onGround, BlockState state, BlockPos pos) { - this.lastYd = this.getDeltaMovement().y; - if (!this.isPassenger()) { - if (onGround) { - if (this.fallDistance > 3.0F) { - if (this.status != Boat.Status.ON_LAND) { - this.resetFallDistance(); - return; - } - - this.causeFallDamage(this.fallDistance, 1.0F, this.damageSources().fall()); - if (!this.level().isClientSide && !this.isRemoved()) { - this.kill(); - if (this.level().getGameRules().getBoolean(GameRules.RULE_DOENTITYDROPS)) { - for (int i = 0; i < 3; i++) { - this.spawnAtLocation(this.getVariant().getPlanks()); - } - - for (int i = 0; i < 2; i++) { - this.spawnAtLocation(Items.STICK); - } - } - } - } - - this.resetFallDistance(); - } else if (!this.level().getFluidState(this.blockPosition().below()).is(FluidTags.WATER) && y < 0.0) { - this.fallDistance -= (float)y; - } - } - } - - public boolean getPaddleState(int side) { - return this.entityData.get(side == 0 ? DATA_ID_PADDLE_LEFT : DATA_ID_PADDLE_RIGHT) && this.getControllingPassenger() != null; - } - - private void setBubbleTime(int bubbleTime) { - this.entityData.set(DATA_ID_BUBBLE_TIME, bubbleTime); - } - - private int getBubbleTime() { - return this.entityData.get(DATA_ID_BUBBLE_TIME); - } - - public float getBubbleAngle(float partialTicks) { - return Mth.lerp(partialTicks, this.bubbleAngleO, this.bubbleAngle); - } - - public void setVariant(Boat.Type variant) { - this.entityData.set(DATA_ID_TYPE, variant.ordinal()); - } - - public Boat.Type getVariant() { - return Boat.Type.byId(this.entityData.get(DATA_ID_TYPE)); - } - - @Override - protected boolean canAddPassenger(Entity passenger) { - return this.getPassengers().size() < this.getMaxPassengers() && !this.isEyeInFluid(FluidTags.WATER); - } - - protected int getMaxPassengers() { - return 2; - } - - @Nullable - @Override - public LivingEntity getControllingPassenger() { - return this.getFirstPassenger() instanceof LivingEntity livingEntity ? livingEntity : super.getControllingPassenger(); - } - - public void setInput(boolean inputLeft, boolean inputRight, boolean inputUp, boolean inputDown) { - this.inputLeft = inputLeft; - this.inputRight = inputRight; - this.inputUp = inputUp; - this.inputDown = inputDown; - } - - @Override - protected Component getTypeName() { - return Component.translatable(this.getDropItem().getDescriptionId()); - } - - @Override - public boolean isUnderWater() { - return this.status == Boat.Status.UNDER_WATER || this.status == Boat.Status.UNDER_FLOWING_WATER; - } - - @Override - public ItemStack getPickResult() { - return new ItemStack(this.getDropItem()); - } - - public static enum Status { - IN_WATER, - UNDER_WATER, - UNDER_FLOWING_WATER, - ON_LAND, - IN_AIR; - } - - public static enum Type implements StringRepresentable { - OAK(Blocks.OAK_PLANKS, "oak"), - SPRUCE(Blocks.SPRUCE_PLANKS, "spruce"), - BIRCH(Blocks.BIRCH_PLANKS, "birch"), - JUNGLE(Blocks.JUNGLE_PLANKS, "jungle"), - ACACIA(Blocks.ACACIA_PLANKS, "acacia"), - CHERRY(Blocks.CHERRY_PLANKS, "cherry"), - DARK_OAK(Blocks.DARK_OAK_PLANKS, "dark_oak"), - MANGROVE(Blocks.MANGROVE_PLANKS, "mangrove"), - BAMBOO(Blocks.BAMBOO_PLANKS, "bamboo"); - - private final String name; - private final Block planks; - public static final StringRepresentable.EnumCodec CODEC = StringRepresentable.fromEnum(Boat.Type::values); - private static final IntFunction BY_ID = ByIdMap.continuous(Enum::ordinal, values(), ByIdMap.OutOfBoundsStrategy.ZERO); - - private Type(final Block planks, final String name) { - this.name = name; - this.planks = planks; - } - - @Override - public String getSerializedName() { - return this.name; - } - - public String getName() { - return this.name; - } - - public Block getPlanks() { - return this.planks; - } - - public String toString() { - return this.name; - } - - /** - * Get a boat type by its enum ordinal - */ - public static Boat.Type byId(int id) { - return (Boat.Type)BY_ID.apply(id); - } - - public static Boat.Type byName(String name) { - return (Boat.Type)CODEC.byName(name, OAK); - } + protected double rideHeight(EntityDimensions entityDimensions) { + return entityDimensions.height() / 3.0F; } } diff --git a/net/minecraft/world/entity/vehicle/ChestBoat.java b/net/minecraft/world/entity/vehicle/ChestBoat.java index b73484af..344d79a2 100644 --- a/net/minecraft/world/entity/vehicle/ChestBoat.java +++ b/net/minecraft/world/entity/vehicle/ChestBoat.java @@ -1,223 +1,18 @@ package net.minecraft.world.entity.vehicle; -import net.minecraft.core.NonNullList; -import net.minecraft.nbt.CompoundTag; -import net.minecraft.resources.ResourceKey; -import net.minecraft.world.Containers; -import net.minecraft.world.InteractionHand; -import net.minecraft.world.InteractionResult; -import net.minecraft.world.damagesource.DamageSource; -import net.minecraft.world.entity.Entity; +import java.util.function.Supplier; +import net.minecraft.world.entity.EntityDimensions; import net.minecraft.world.entity.EntityType; -import net.minecraft.world.entity.HasCustomInventoryScreen; -import net.minecraft.world.entity.SlotAccess; -import net.minecraft.world.entity.monster.piglin.PiglinAi; -import net.minecraft.world.entity.player.Inventory; -import net.minecraft.world.entity.player.Player; -import net.minecraft.world.inventory.AbstractContainerMenu; -import net.minecraft.world.inventory.ChestMenu; import net.minecraft.world.item.Item; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.Items; import net.minecraft.world.level.Level; -import net.minecraft.world.level.gameevent.GameEvent; -import net.minecraft.world.level.storage.loot.LootTable; -import org.jetbrains.annotations.Nullable; -public class ChestBoat extends Boat implements HasCustomInventoryScreen, ContainerEntity { - private static final int CONTAINER_SIZE = 27; - private NonNullList itemStacks = NonNullList.withSize(27, ItemStack.EMPTY); - @Nullable - private ResourceKey lootTable; - private long lootTableSeed; - - public ChestBoat(EntityType entityType, Level level) { - super(entityType, level); - } - - public ChestBoat(Level level, double x, double y, double z) { - super(EntityType.CHEST_BOAT, level); - this.setPos(x, y, z); - this.xo = x; - this.yo = y; - this.zo = z; +public class ChestBoat extends AbstractChestBoat { + public ChestBoat(EntityType entityType, Level level, Supplier supplier) { + super(entityType, level, supplier); } @Override - protected float getSinglePassengerXOffset() { - return 0.15F; - } - - @Override - protected int getMaxPassengers() { - return 1; - } - - @Override - protected void addAdditionalSaveData(CompoundTag compound) { - super.addAdditionalSaveData(compound); - this.addChestVehicleSaveData(compound, this.registryAccess()); - } - - @Override - protected void readAdditionalSaveData(CompoundTag compound) { - super.readAdditionalSaveData(compound); - this.readChestVehicleSaveData(compound, this.registryAccess()); - } - - @Override - public void destroy(DamageSource source) { - this.destroy(this.getDropItem()); - this.chestVehicleDestroyed(source, this.level(), this); - } - - @Override - public void remove(Entity.RemovalReason reason) { - if (!this.level().isClientSide && reason.shouldDestroy()) { - Containers.dropContents(this.level(), this, this); - } - - super.remove(reason); - } - - @Override - public InteractionResult interact(Player player, InteractionHand hand) { - if (!player.isSecondaryUseActive()) { - InteractionResult interactionResult = super.interact(player, hand); - if (interactionResult != InteractionResult.PASS) { - return interactionResult; - } - } - - if (this.canAddPassenger(player) && !player.isSecondaryUseActive()) { - return InteractionResult.PASS; - } else { - InteractionResult interactionResult = this.interactWithContainerVehicle(player); - if (interactionResult.consumesAction()) { - this.gameEvent(GameEvent.CONTAINER_OPEN, player); - PiglinAi.angerNearbyPiglins(player, true); - } - - return interactionResult; - } - } - - @Override - public void openCustomInventoryScreen(Player player) { - player.openMenu(this); - if (!player.level().isClientSide) { - this.gameEvent(GameEvent.CONTAINER_OPEN, player); - PiglinAi.angerNearbyPiglins(player, true); - } - } - - @Override - public Item getDropItem() { - return switch (this.getVariant()) { - case SPRUCE -> Items.SPRUCE_CHEST_BOAT; - case BIRCH -> Items.BIRCH_CHEST_BOAT; - case JUNGLE -> Items.JUNGLE_CHEST_BOAT; - case ACACIA -> Items.ACACIA_CHEST_BOAT; - case CHERRY -> Items.CHERRY_CHEST_BOAT; - case DARK_OAK -> Items.DARK_OAK_CHEST_BOAT; - case MANGROVE -> Items.MANGROVE_CHEST_BOAT; - case BAMBOO -> Items.BAMBOO_CHEST_RAFT; - default -> Items.OAK_CHEST_BOAT; - }; - } - - @Override - public void clearContent() { - this.clearChestVehicleContent(); - } - - @Override - public int getContainerSize() { - return 27; - } - - @Override - public ItemStack getItem(int slot) { - return this.getChestVehicleItem(slot); - } - - @Override - public ItemStack removeItem(int slot, int amount) { - return this.removeChestVehicleItem(slot, amount); - } - - @Override - public ItemStack removeItemNoUpdate(int slot) { - return this.removeChestVehicleItemNoUpdate(slot); - } - - @Override - public void setItem(int slot, ItemStack stack) { - this.setChestVehicleItem(slot, stack); - } - - @Override - public SlotAccess getSlot(int slot) { - return this.getChestVehicleSlot(slot); - } - - @Override - public void setChanged() { - } - - @Override - public boolean stillValid(Player player) { - return this.isChestVehicleStillValid(player); - } - - @Nullable - @Override - public AbstractContainerMenu createMenu(int i, Inventory inventory, Player player) { - if (this.lootTable != null && player.isSpectator()) { - return null; - } else { - this.unpackLootTable(inventory.player); - return ChestMenu.threeRows(i, inventory, this); - } - } - - public void unpackLootTable(@Nullable Player player) { - this.unpackChestVehicleLootTable(player); - } - - @Nullable - @Override - public ResourceKey getLootTable() { - return this.lootTable; - } - - @Override - public void setLootTable(@Nullable ResourceKey lootTable) { - this.lootTable = lootTable; - } - - @Override - public long getLootTableSeed() { - return this.lootTableSeed; - } - - @Override - public void setLootTableSeed(long lootTableSeed) { - this.lootTableSeed = lootTableSeed; - } - - @Override - public NonNullList getItemStacks() { - return this.itemStacks; - } - - @Override - public void clearItemStacks() { - this.itemStacks = NonNullList.withSize(this.getContainerSize(), ItemStack.EMPTY); - } - - @Override - public void stopOpen(Player player) { - this.level().gameEvent(GameEvent.CONTAINER_CLOSE, this.position(), GameEvent.Context.of(player)); + protected double rideHeight(EntityDimensions entityDimensions) { + return entityDimensions.height() / 3.0F; } } diff --git a/net/minecraft/world/entity/vehicle/ChestRaft.java b/net/minecraft/world/entity/vehicle/ChestRaft.java new file mode 100644 index 00000000..d7f40eb8 --- /dev/null +++ b/net/minecraft/world/entity/vehicle/ChestRaft.java @@ -0,0 +1,18 @@ +package net.minecraft.world.entity.vehicle; + +import java.util.function.Supplier; +import net.minecraft.world.entity.EntityDimensions; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.item.Item; +import net.minecraft.world.level.Level; + +public class ChestRaft extends AbstractChestBoat { + public ChestRaft(EntityType entityType, Level level, Supplier supplier) { + super(entityType, level, supplier); + } + + @Override + protected double rideHeight(EntityDimensions entityDimensions) { + return entityDimensions.height() * 0.8888889F; + } +} diff --git a/net/minecraft/world/entity/vehicle/ContainerEntity.java b/net/minecraft/world/entity/vehicle/ContainerEntity.java index 67c873f9..1b31b507 100644 --- a/net/minecraft/world/entity/vehicle/ContainerEntity.java +++ b/net/minecraft/world/entity/vehicle/ContainerEntity.java @@ -38,13 +38,13 @@ public interface ContainerEntity extends Container, MenuProvider { AABB getBoundingBox(); @Nullable - ResourceKey getLootTable(); + ResourceKey getContainerLootTable(); - void setLootTable(@Nullable ResourceKey lootTable); + void setContainerLootTable(@Nullable ResourceKey resourceKey); - long getLootTableSeed(); + long getContainerLootTableSeed(); - void setLootTableSeed(long lootTableSeed); + void setContainerLootTableSeed(long l); NonNullList getItemStacks(); @@ -60,10 +60,10 @@ public interface ContainerEntity extends Container, MenuProvider { } default void addChestVehicleSaveData(CompoundTag tag, HolderLookup.Provider levelRegistry) { - if (this.getLootTable() != null) { - tag.putString("LootTable", this.getLootTable().location().toString()); - if (this.getLootTableSeed() != 0L) { - tag.putLong("LootTableSeed", this.getLootTableSeed()); + if (this.getContainerLootTable() != null) { + tag.putString("LootTable", this.getContainerLootTable().location().toString()); + if (this.getContainerLootTableSeed() != 0L) { + tag.putLong("LootTableSeed", this.getContainerLootTableSeed()); } } else { ContainerHelper.saveAllItems(tag, this.getItemStacks(), levelRegistry); @@ -73,45 +73,43 @@ public interface ContainerEntity extends Container, MenuProvider { default void readChestVehicleSaveData(CompoundTag tag, HolderLookup.Provider levelRegistry) { this.clearItemStacks(); if (tag.contains("LootTable", 8)) { - this.setLootTable(ResourceKey.create(Registries.LOOT_TABLE, ResourceLocation.parse(tag.getString("LootTable")))); - this.setLootTableSeed(tag.getLong("LootTableSeed")); + this.setContainerLootTable(ResourceKey.create(Registries.LOOT_TABLE, ResourceLocation.parse(tag.getString("LootTable")))); + this.setContainerLootTableSeed(tag.getLong("LootTableSeed")); } else { ContainerHelper.loadAllItems(tag, this.getItemStacks(), levelRegistry); } } - default void chestVehicleDestroyed(DamageSource damageSource, Level level, Entity entity) { - if (level.getGameRules().getBoolean(GameRules.RULE_DOENTITYDROPS)) { - Containers.dropContents(level, entity, this); - if (!level.isClientSide) { - Entity entity2 = damageSource.getDirectEntity(); - if (entity2 != null && entity2.getType() == EntityType.PLAYER) { - PiglinAi.angerNearbyPiglins((Player)entity2, true); - } + default void chestVehicleDestroyed(DamageSource damageSource, ServerLevel serverLevel, Entity entity) { + if (serverLevel.getGameRules().getBoolean(GameRules.RULE_DOENTITYDROPS)) { + Containers.dropContents(serverLevel, entity, this); + Entity entity2 = damageSource.getDirectEntity(); + if (entity2 != null && entity2.getType() == EntityType.PLAYER) { + PiglinAi.angerNearbyPiglins(serverLevel, (Player)entity2, true); } } } default InteractionResult interactWithContainerVehicle(Player player) { player.openMenu(this); - return !player.level().isClientSide ? InteractionResult.CONSUME : InteractionResult.SUCCESS; + return InteractionResult.SUCCESS; } default void unpackChestVehicleLootTable(@Nullable Player player) { MinecraftServer minecraftServer = this.level().getServer(); - if (this.getLootTable() != null && minecraftServer != null) { - LootTable lootTable = minecraftServer.reloadableRegistries().getLootTable(this.getLootTable()); + if (this.getContainerLootTable() != null && minecraftServer != null) { + LootTable lootTable = minecraftServer.reloadableRegistries().getLootTable(this.getContainerLootTable()); if (player != null) { - CriteriaTriggers.GENERATE_LOOT.trigger((ServerPlayer)player, this.getLootTable()); + CriteriaTriggers.GENERATE_LOOT.trigger((ServerPlayer)player, this.getContainerLootTable()); } - this.setLootTable(null); + this.setContainerLootTable(null); LootParams.Builder builder = new LootParams.Builder((ServerLevel)this.level()).withParameter(LootContextParams.ORIGIN, this.position()); if (player != null) { builder.withLuck(player.getLuck()).withParameter(LootContextParams.THIS_ENTITY, player); } - lootTable.fill(this, builder.create(LootContextParamSets.CHEST), this.getLootTableSeed()); + lootTable.fill(this, builder.create(LootContextParamSets.CHEST), this.getContainerLootTableSeed()); } } diff --git a/net/minecraft/world/entity/vehicle/Minecart.java b/net/minecraft/world/entity/vehicle/Minecart.java index 422133e2..61127e0f 100644 --- a/net/minecraft/world/entity/vehicle/Minecart.java +++ b/net/minecraft/world/entity/vehicle/Minecart.java @@ -1,32 +1,36 @@ package net.minecraft.world.entity.vehicle; +import net.minecraft.util.Mth; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.level.Level; +import net.minecraft.world.phys.Vec3; public class Minecart extends AbstractMinecart { + private float rotationOffset; + private float playerRotationOffset; + public Minecart(EntityType entityType, Level level) { super(entityType, level); } - public Minecart(Level level, double x, double y, double z) { - super(EntityType.MINECART, level, x, y, z); - } - @Override public InteractionResult interact(Player player, InteractionHand hand) { - if (player.isSecondaryUseActive()) { - return InteractionResult.PASS; - } else if (this.isVehicle()) { - return InteractionResult.PASS; - } else if (!this.level().isClientSide) { - return player.startRiding(this) ? InteractionResult.CONSUME : InteractionResult.PASS; + if (!player.isSecondaryUseActive() && !this.isVehicle() && (this.level().isClientSide || player.startRiding(this))) { + this.playerRotationOffset = this.rotationOffset; + if (!this.level().isClientSide) { + return (InteractionResult)(player.startRiding(this) ? InteractionResult.CONSUME : InteractionResult.PASS); + } else { + return InteractionResult.SUCCESS; + } } else { - return InteractionResult.SUCCESS; + return InteractionResult.PASS; } } @@ -35,6 +39,11 @@ public class Minecart extends AbstractMinecart { return Items.MINECART; } + @Override + public ItemStack getPickResult() { + return new ItemStack(Items.MINECART); + } + @Override public void activateMinecart(int x, int y, int z, boolean powered) { if (powered) { @@ -52,7 +61,29 @@ public class Minecart extends AbstractMinecart { } @Override - public AbstractMinecart.Type getMinecartType() { - return AbstractMinecart.Type.RIDEABLE; + public boolean isRideable() { + return true; + } + + @Override + public void tick() { + double d = this.getYRot(); + Vec3 vec3 = this.position(); + super.tick(); + double e = (this.getYRot() - d) % 360.0; + if (this.level().isClientSide && vec3.distanceTo(this.position()) > 0.01) { + this.rotationOffset += (float)e; + this.rotationOffset %= 360.0F; + } + } + + @Override + protected void positionRider(Entity passenger, Entity.MoveFunction callback) { + super.positionRider(passenger, callback); + if (this.level().isClientSide && passenger instanceof Player player && player.shouldRotateWithMinecart() && useExperimentalMovement(this.level())) { + float f = (float)Mth.rotLerp(0.5, (double)this.playerRotationOffset, (double)this.rotationOffset); + player.setYRot(player.getYRot() - (f - this.playerRotationOffset)); + this.playerRotationOffset = f; + } } } diff --git a/net/minecraft/world/entity/vehicle/MinecartBehavior.java b/net/minecraft/world/entity/vehicle/MinecartBehavior.java new file mode 100644 index 00000000..4c30f82f --- /dev/null +++ b/net/minecraft/world/entity/vehicle/MinecartBehavior.java @@ -0,0 +1,125 @@ +package net.minecraft.world.entity.vehicle; + +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.state.properties.RailShape; +import net.minecraft.world.phys.Vec3; + +public abstract class MinecartBehavior { + protected final AbstractMinecart minecart; + + protected MinecartBehavior(AbstractMinecart abstractMinecart) { + this.minecart = abstractMinecart; + } + + public void cancelLerp() { + } + + public void lerpTo(double d, double e, double f, float g, float h, int i) { + this.setPos(d, e, f); + this.setYRot(g % 360.0F); + this.setXRot(h % 360.0F); + } + + public double lerpTargetX() { + return this.getX(); + } + + public double lerpTargetY() { + return this.getY(); + } + + public double lerpTargetZ() { + return this.getZ(); + } + + public float lerpTargetXRot() { + return this.getXRot(); + } + + public float lerpTargetYRot() { + return this.getYRot(); + } + + public void lerpMotion(double d, double e, double f) { + this.setDeltaMovement(d, e, f); + } + + public abstract void tick(); + + public Level level() { + return this.minecart.level(); + } + + public abstract void moveAlongTrack(ServerLevel serverLevel); + + public abstract double stepAlongTrack(BlockPos blockPos, RailShape railShape, double d); + + public abstract boolean pushAndPickupEntities(); + + public Vec3 getDeltaMovement() { + return this.minecart.getDeltaMovement(); + } + + public void setDeltaMovement(Vec3 vec3) { + this.minecart.setDeltaMovement(vec3); + } + + public void setDeltaMovement(double d, double e, double f) { + this.minecart.setDeltaMovement(d, e, f); + } + + public Vec3 position() { + return this.minecart.position(); + } + + public double getX() { + return this.minecart.getX(); + } + + public double getY() { + return this.minecart.getY(); + } + + public double getZ() { + return this.minecart.getZ(); + } + + public void setPos(Vec3 vec3) { + this.minecart.setPos(vec3); + } + + public void setPos(double d, double e, double f) { + this.minecart.setPos(d, e, f); + } + + public float getXRot() { + return this.minecart.getXRot(); + } + + public void setXRot(float f) { + this.minecart.setXRot(f); + } + + public float getYRot() { + return this.minecart.getYRot(); + } + + public void setYRot(float f) { + this.minecart.setYRot(f); + } + + public Direction getMotionDirection() { + return this.minecart.getDirection(); + } + + public Vec3 getKnownMovement(Vec3 vec3) { + return vec3; + } + + public abstract double getMaxSpeed(ServerLevel serverLevel); + + public abstract double getSlowdownFactor(); +} diff --git a/net/minecraft/world/entity/vehicle/MinecartChest.java b/net/minecraft/world/entity/vehicle/MinecartChest.java index 8da8e6f1..6e16e1a8 100644 --- a/net/minecraft/world/entity/vehicle/MinecartChest.java +++ b/net/minecraft/world/entity/vehicle/MinecartChest.java @@ -1,6 +1,7 @@ package net.minecraft.world.entity.vehicle; import net.minecraft.core.Direction; +import net.minecraft.server.level.ServerLevel; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.EntityType; @@ -10,35 +11,33 @@ import net.minecraft.world.entity.player.Player; import net.minecraft.world.inventory.AbstractContainerMenu; import net.minecraft.world.inventory.ChestMenu; import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.ChestBlock; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.level.gameevent.GameEvent.Context; public class MinecartChest extends AbstractMinecartContainer { public MinecartChest(EntityType entityType, Level level) { super(entityType, level); } - public MinecartChest(Level level, double x, double y, double z) { - super(EntityType.CHEST_MINECART, x, y, z, level); - } - @Override protected Item getDropItem() { return Items.CHEST_MINECART; } @Override - public int getContainerSize() { - return 27; + public ItemStack getPickResult() { + return new ItemStack(Items.CHEST_MINECART); } @Override - public AbstractMinecart.Type getMinecartType() { - return AbstractMinecart.Type.CHEST; + public int getContainerSize() { + return 27; } @Override @@ -58,15 +57,15 @@ public class MinecartChest extends AbstractMinecartContainer { @Override public void stopOpen(Player player) { - this.level().gameEvent(GameEvent.CONTAINER_CLOSE, this.position(), GameEvent.Context.of(player)); + this.level().gameEvent(GameEvent.CONTAINER_CLOSE, this.position(), Context.of(player)); } @Override public InteractionResult interact(Player player, InteractionHand hand) { InteractionResult interactionResult = this.interactWithContainerVehicle(player); - if (interactionResult.consumesAction()) { + if (interactionResult.consumesAction() && player.level() instanceof ServerLevel serverLevel) { this.gameEvent(GameEvent.CONTAINER_OPEN, player); - PiglinAi.angerNearbyPiglins(player, true); + PiglinAi.angerNearbyPiglins(serverLevel, player, true); } return interactionResult; diff --git a/net/minecraft/world/entity/vehicle/MinecartCommandBlock.java b/net/minecraft/world/entity/vehicle/MinecartCommandBlock.java index 34bdc078..c51ce05a 100644 --- a/net/minecraft/world/entity/vehicle/MinecartCommandBlock.java +++ b/net/minecraft/world/entity/vehicle/MinecartCommandBlock.java @@ -7,12 +7,14 @@ import net.minecraft.network.chat.Component; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.network.syncher.SynchedEntityData.Builder; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.level.BaseCommandBlock; import net.minecraft.world.level.Level; @@ -34,17 +36,18 @@ public class MinecartCommandBlock extends AbstractMinecart { super(entityType, level); } - public MinecartCommandBlock(Level level, double x, double y, double z) { - super(EntityType.COMMAND_BLOCK_MINECART, level, x, y, z); - } - @Override protected Item getDropItem() { return Items.MINECART; } @Override - protected void defineSynchedData(SynchedEntityData.Builder builder) { + public ItemStack getPickResult() { + return new ItemStack(Items.COMMAND_BLOCK_MINECART); + } + + @Override + protected void defineSynchedData(Builder builder) { super.defineSynchedData(builder); builder.define(DATA_ID_COMMAND_NAME, ""); builder.define(DATA_ID_LAST_OUTPUT, CommonComponents.EMPTY); @@ -64,11 +67,6 @@ public class MinecartCommandBlock extends AbstractMinecart { this.commandBlock.save(compound, this.registryAccess()); } - @Override - public AbstractMinecart.Type getMinecartType() { - return AbstractMinecart.Type.COMMAND_BLOCK; - } - @Override public BlockState getDefaultDisplayBlockState() { return Blocks.COMMAND_BLOCK.defaultBlockState(); diff --git a/net/minecraft/world/entity/vehicle/MinecartFurnace.java b/net/minecraft/world/entity/vehicle/MinecartFurnace.java index 88dca43d..eb01e1c8 100644 --- a/net/minecraft/world/entity/vehicle/MinecartFurnace.java +++ b/net/minecraft/world/entity/vehicle/MinecartFurnace.java @@ -1,12 +1,14 @@ package net.minecraft.world.entity.vehicle; -import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.particles.ParticleTypes; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.network.syncher.SynchedEntityData.Builder; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.tags.ItemTags; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.EntityType; @@ -14,7 +16,6 @@ import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; -import net.minecraft.world.item.crafting.Ingredient; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.FurnaceBlock; @@ -23,29 +24,22 @@ import net.minecraft.world.phys.Vec3; public class MinecartFurnace extends AbstractMinecart { private static final EntityDataAccessor DATA_ID_FUEL = SynchedEntityData.defineId(MinecartFurnace.class, EntityDataSerializers.BOOLEAN); + private static final int FUEL_TICKS_PER_ITEM = 3600; + private static final int MAX_FUEL_TICKS = 32000; private int fuel; - public double xPush; - public double zPush; - /** - * The fuel item used to make the minecart move. - */ - private static final Ingredient INGREDIENT = Ingredient.of(Items.COAL, Items.CHARCOAL); + public Vec3 push = Vec3.ZERO; public MinecartFurnace(EntityType entityType, Level level) { super(entityType, level); } - public MinecartFurnace(Level level, double x, double y, double z) { - super(EntityType.FURNACE_MINECART, level, x, y, z); + @Override + public boolean isFurnace() { + return true; } @Override - public AbstractMinecart.Type getMinecartType() { - return AbstractMinecart.Type.FURNACE; - } - - @Override - protected void defineSynchedData(SynchedEntityData.Builder builder) { + protected void defineSynchedData(Builder builder) { super.defineSynchedData(builder); builder.define(DATA_ID_FUEL, false); } @@ -59,8 +53,7 @@ public class MinecartFurnace extends AbstractMinecart { } if (this.fuel <= 0) { - this.xPush = 0.0; - this.zPush = 0.0; + this.push = Vec3.ZERO; } this.setHasFuel(this.fuel > 0); @@ -72,8 +65,8 @@ public class MinecartFurnace extends AbstractMinecart { } @Override - protected double getMaxSpeed() { - return (this.isInWater() ? 3.0 : 4.0) / 20.0; + protected double getMaxSpeed(ServerLevel serverLevel) { + return this.isInWater() ? super.getMaxSpeed(serverLevel) * 0.75 : super.getMaxSpeed(serverLevel) * 0.5; } @Override @@ -82,70 +75,63 @@ public class MinecartFurnace extends AbstractMinecart { } @Override - protected void moveAlongTrack(BlockPos pos, BlockState state) { - double d = 1.0E-4; - double e = 0.001; - super.moveAlongTrack(pos, state); - Vec3 vec3 = this.getDeltaMovement(); - double f = vec3.horizontalDistanceSqr(); - double g = this.xPush * this.xPush + this.zPush * this.zPush; - if (g > 1.0E-4 && f > 0.001) { - double h = Math.sqrt(f); - double i = Math.sqrt(g); - this.xPush = vec3.x / h * i; - this.zPush = vec3.z / h * i; - } + public ItemStack getPickResult() { + return new ItemStack(Items.FURNACE_MINECART); } @Override - protected void applyNaturalSlowdown() { - double d = this.xPush * this.xPush + this.zPush * this.zPush; - if (d > 1.0E-7) { - d = Math.sqrt(d); - this.xPush /= d; - this.zPush /= d; - Vec3 vec3 = this.getDeltaMovement().multiply(0.8, 0.0, 0.8).add(this.xPush, 0.0, this.zPush); + protected Vec3 applyNaturalSlowdown(Vec3 vec3) { + Vec3 vec32; + if (this.push.lengthSqr() > 1.0E-7) { + this.push = this.calculateNewPushAlong(vec3); + vec32 = vec3.multiply(0.8, 0.0, 0.8).add(this.push); if (this.isInWater()) { - vec3 = vec3.scale(0.1); + vec32 = vec32.scale(0.1); } - - this.setDeltaMovement(vec3); } else { - this.setDeltaMovement(this.getDeltaMovement().multiply(0.98, 0.0, 0.98)); + vec32 = vec3.multiply(0.98, 0.0, 0.98); } - super.applyNaturalSlowdown(); + return super.applyNaturalSlowdown(vec32); + } + + private Vec3 calculateNewPushAlong(Vec3 vec3) { + double d = 1.0E-4; + double e = 0.001; + return this.push.horizontalDistanceSqr() > 1.0E-4 && vec3.horizontalDistanceSqr() > 0.001 + ? this.push.projectedOn(vec3).normalize().scale(this.push.length()) + : this.push; } @Override public InteractionResult interact(Player player, InteractionHand hand) { ItemStack itemStack = player.getItemInHand(hand); - if (INGREDIENT.test(itemStack) && this.fuel + 3600 <= 32000) { + if (itemStack.is(ItemTags.FURNACE_MINECART_FUEL) && this.fuel + 3600 <= 32000) { itemStack.consume(1, player); this.fuel += 3600; } if (this.fuel > 0) { - this.xPush = this.getX() - player.getX(); - this.zPush = this.getZ() - player.getZ(); + this.push = this.position().subtract(player.position()).horizontal(); } - return InteractionResult.sidedSuccess(this.level().isClientSide); + return InteractionResult.SUCCESS; } @Override protected void addAdditionalSaveData(CompoundTag compound) { super.addAdditionalSaveData(compound); - compound.putDouble("PushX", this.xPush); - compound.putDouble("PushZ", this.zPush); + compound.putDouble("PushX", this.push.x); + compound.putDouble("PushZ", this.push.z); compound.putShort("Fuel", (short)this.fuel); } @Override protected void readAdditionalSaveData(CompoundTag compound) { super.readAdditionalSaveData(compound); - this.xPush = compound.getDouble("PushX"); - this.zPush = compound.getDouble("PushZ"); + double d = compound.getDouble("PushX"); + double e = compound.getDouble("PushZ"); + this.push = new Vec3(d, 0.0, e); this.fuel = compound.getShort("Fuel"); } diff --git a/net/minecraft/world/entity/vehicle/MinecartHopper.java b/net/minecraft/world/entity/vehicle/MinecartHopper.java index 6a81e2dd..6b6096cc 100644 --- a/net/minecraft/world/entity/vehicle/MinecartHopper.java +++ b/net/minecraft/world/entity/vehicle/MinecartHopper.java @@ -1,5 +1,6 @@ package net.minecraft.world.entity.vehicle; +import net.minecraft.core.BlockPos; import net.minecraft.nbt.CompoundTag; import net.minecraft.world.entity.EntitySelector; import net.minecraft.world.entity.EntityType; @@ -8,29 +9,23 @@ import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.inventory.AbstractContainerMenu; import net.minecraft.world.inventory.HopperMenu; import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.entity.Hopper; import net.minecraft.world.level.block.entity.HopperBlockEntity; import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.properties.RailShape; public class MinecartHopper extends AbstractMinecartContainer implements Hopper { private boolean enabled = true; + private boolean consumedItemThisFrame = false; public MinecartHopper(EntityType entityType, Level level) { super(entityType, level); } - public MinecartHopper(Level level, double x, double y, double z) { - super(EntityType.HOPPER_MINECART, x, y, z, level); - } - - @Override - public AbstractMinecart.Type getMinecartType() { - return AbstractMinecart.Type.HOPPER; - } - @Override public BlockState getDefaultDisplayBlockState() { return Blocks.HOPPER.defaultBlockState(); @@ -90,8 +85,21 @@ public class MinecartHopper extends AbstractMinecartContainer implements Hopper @Override public void tick() { + this.consumedItemThisFrame = false; super.tick(); - if (!this.level().isClientSide && this.isAlive() && this.isEnabled() && this.suckInItems()) { + this.tryConsumeItems(); + } + + @Override + protected double makeStepAlongTrack(BlockPos blockPos, RailShape railShape, double d) { + double e = super.makeStepAlongTrack(blockPos, railShape, d); + this.tryConsumeItems(); + return e; + } + + private void tryConsumeItems() { + if (!this.level().isClientSide && this.isAlive() && this.isEnabled() && !this.consumedItemThisFrame && this.suckInItems()) { + this.consumedItemThisFrame = true; this.setChanged(); } } @@ -116,6 +124,11 @@ public class MinecartHopper extends AbstractMinecartContainer implements Hopper return Items.HOPPER_MINECART; } + @Override + public ItemStack getPickResult() { + return new ItemStack(Items.HOPPER_MINECART); + } + @Override protected void addAdditionalSaveData(CompoundTag compound) { super.addAdditionalSaveData(compound); diff --git a/net/minecraft/world/entity/vehicle/MinecartSpawner.java b/net/minecraft/world/entity/vehicle/MinecartSpawner.java index 9aa81f2a..381c5d76 100644 --- a/net/minecraft/world/entity/vehicle/MinecartSpawner.java +++ b/net/minecraft/world/entity/vehicle/MinecartSpawner.java @@ -5,6 +5,7 @@ import net.minecraft.nbt.CompoundTag; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.entity.EntityType; import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.level.BaseSpawner; import net.minecraft.world.level.Level; @@ -25,27 +26,22 @@ public class MinecartSpawner extends AbstractMinecart { this.ticker = this.createTicker(level); } - public MinecartSpawner(Level level, double x, double y, double z) { - super(EntityType.SPAWNER_MINECART, level, x, y, z); - this.ticker = this.createTicker(level); - } - @Override protected Item getDropItem() { return Items.MINECART; } + @Override + public ItemStack getPickResult() { + return new ItemStack(Items.MINECART); + } + private Runnable createTicker(Level level) { return level instanceof ServerLevel ? () -> this.spawner.serverTick((ServerLevel)level, this.blockPosition()) : () -> this.spawner.clientTick(level, this.blockPosition()); } - @Override - public AbstractMinecart.Type getMinecartType() { - return AbstractMinecart.Type.SPAWNER; - } - @Override public BlockState getDefaultDisplayBlockState() { return Blocks.SPAWNER.defaultBlockState(); diff --git a/net/minecraft/world/entity/vehicle/MinecartTNT.java b/net/minecraft/world/entity/vehicle/MinecartTNT.java index c187050a..c6d2cc04 100644 --- a/net/minecraft/world/entity/vehicle/MinecartTNT.java +++ b/net/minecraft/world/entity/vehicle/MinecartTNT.java @@ -3,14 +3,17 @@ package net.minecraft.world.entity.vehicle; import net.minecraft.core.BlockPos; import net.minecraft.core.particles.ParticleTypes; import net.minecraft.nbt.CompoundTag; +import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; import net.minecraft.tags.BlockTags; import net.minecraft.tags.DamageTypeTags; +import net.minecraft.util.Mth; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.projectile.AbstractArrow; import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Explosion; @@ -22,21 +25,15 @@ import org.jetbrains.annotations.Nullable; public class MinecartTNT extends AbstractMinecart { private static final byte EVENT_PRIME = 10; + private static final String TAG_EXPLOSION_POWER = "explosion_power"; + private static final float DEFAULT_EXPLOSION_POWER_BASE = 4.0F; private int fuse = -1; + private float explosionPowerBase = 4.0F; public MinecartTNT(EntityType entityType, Level level) { super(entityType, level); } - public MinecartTNT(Level level, double x, double y, double z) { - super(EntityType.TNT_MINECART, level, x, y, z); - } - - @Override - public AbstractMinecart.Type getMinecartType() { - return AbstractMinecart.Type.TNT; - } - @Override public BlockState getDefaultDisplayBlockState() { return Blocks.TNT.defaultBlockState(); @@ -61,20 +58,20 @@ public class MinecartTNT extends AbstractMinecart { } @Override - public boolean hurt(DamageSource source, float amount) { - if (source.getDirectEntity() instanceof AbstractArrow abstractArrow && abstractArrow.isOnFire()) { - DamageSource damageSource = this.damageSources().explosion(this, source.getEntity()); - this.explode(damageSource, abstractArrow.getDeltaMovement().lengthSqr()); + public boolean hurtServer(ServerLevel serverLevel, DamageSource damageSource, float f) { + if (damageSource.getDirectEntity() instanceof AbstractArrow abstractArrow && abstractArrow.isOnFire()) { + DamageSource damageSource2 = this.damageSources().explosion(this, damageSource.getEntity()); + this.explode(damageSource2, abstractArrow.getDeltaMovement().lengthSqr()); } - return super.hurt(source, amount); + return super.hurtServer(serverLevel, damageSource, f); } @Override - public void destroy(DamageSource source) { + public void destroy(ServerLevel serverLevel, DamageSource damageSource) { double d = this.getDeltaMovement().horizontalDistanceSqr(); - if (!damageSourceIgnitesTnt(source) && !(d >= 0.01F)) { - this.destroy(this.getDropItem()); + if (!damageSourceIgnitesTnt(damageSource) && !(d >= 0.01F)) { + this.destroy(serverLevel, this.getDropItem()); } else { if (this.fuse < 0) { this.primeFuse(); @@ -88,6 +85,11 @@ public class MinecartTNT extends AbstractMinecart { return Items.TNT_MINECART; } + @Override + public ItemStack getPickResult() { + return new ItemStack(Items.TNT_MINECART); + } + /** * Makes the minecart explode. */ @@ -96,16 +98,19 @@ public class MinecartTNT extends AbstractMinecart { } protected void explode(@Nullable DamageSource damageSource, double radiusModifier) { - if (!this.level().isClientSide) { - double d = Math.sqrt(radiusModifier); - if (d > 5.0) { - d = 5.0; - } - - this.level() - .explode( - this, damageSource, null, this.getX(), this.getY(), this.getZ(), (float)(4.0 + this.random.nextDouble() * 1.5 * d), false, Level.ExplosionInteraction.TNT - ); + if (this.level() instanceof ServerLevel serverLevel) { + double d = Math.min(Math.sqrt(radiusModifier), 5.0); + serverLevel.explode( + this, + damageSource, + null, + this.getX(), + this.getY(), + this.getZ(), + (float)(this.explosionPowerBase + this.random.nextDouble() * 1.5 * d), + false, + Level.ExplosionInteraction.TNT + ); this.discard(); } } @@ -185,12 +190,19 @@ public class MinecartTNT extends AbstractMinecart { if (compound.contains("TNTFuse", 99)) { this.fuse = compound.getInt("TNTFuse"); } + + if (compound.contains("explosion_power", 99)) { + this.explosionPowerBase = Mth.clamp(compound.getFloat("explosion_power"), 0.0F, 128.0F); + } } @Override protected void addAdditionalSaveData(CompoundTag compound) { super.addAdditionalSaveData(compound); compound.putInt("TNTFuse", this.fuse); + if (this.explosionPowerBase != 4.0F) { + compound.putFloat("explosion_power", this.explosionPowerBase); + } } @Override diff --git a/net/minecraft/world/entity/vehicle/NewMinecartBehavior.java b/net/minecraft/world/entity/vehicle/NewMinecartBehavior.java new file mode 100644 index 00000000..80223bca --- /dev/null +++ b/net/minecraft/world/entity/vehicle/NewMinecartBehavior.java @@ -0,0 +1,575 @@ +package net.minecraft.world.entity.vehicle; + +import com.mojang.datafixers.util.Pair; +import io.netty.buffer.ByteBuf; +import java.util.LinkedList; +import java.util.List; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Vec3i; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.util.Mth; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntitySelector; +import net.minecraft.world.entity.MoverType; +import net.minecraft.world.entity.animal.IronGolem; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.level.GameRules; +import net.minecraft.world.level.block.BaseRailBlock; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.PoweredRailBlock; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.properties.RailShape; +import net.minecraft.world.phys.AABB; +import net.minecraft.world.phys.Vec3; +import org.jetbrains.annotations.Nullable; + +public class NewMinecartBehavior extends MinecartBehavior { + public static final int POS_ROT_LERP_TICKS = 3; + public static final double ON_RAIL_Y_OFFSET = 0.1; + public static final double OPPOSING_SLOPES_REST_AT_SPEED_THRESHOLD = 0.005; + @Nullable + private NewMinecartBehavior.StepPartialTicks cacheIndexAlpha; + private int cachedLerpDelay; + private float cachedPartialTick; + private int lerpDelay = 0; + public final List lerpSteps = new LinkedList(); + public final List currentLerpSteps = new LinkedList(); + public double currentLerpStepsTotalWeight = 0.0; + public NewMinecartBehavior.MinecartStep oldLerp = NewMinecartBehavior.MinecartStep.ZERO; + + public NewMinecartBehavior(AbstractMinecart abstractMinecart) { + super(abstractMinecart); + } + + @Override + public void tick() { + if (this.level() instanceof ServerLevel serverLevel) { + BlockPos var5 = this.minecart.getCurrentBlockPosOrRailBelow(); + BlockState blockState = this.level().getBlockState(var5); + if (this.minecart.isFirstTick()) { + this.minecart.setOnRails(BaseRailBlock.isRail(blockState)); + this.adjustToRails(var5, blockState, true); + } + + this.minecart.applyGravity(); + this.minecart.moveAlongTrack(serverLevel); + } else { + this.lerpClientPositionAndRotation(); + boolean bl = BaseRailBlock.isRail(this.level().getBlockState(this.minecart.getCurrentBlockPosOrRailBelow())); + this.minecart.setOnRails(bl); + } + } + + private void lerpClientPositionAndRotation() { + if (--this.lerpDelay <= 0) { + this.setOldLerpValues(); + this.currentLerpSteps.clear(); + if (!this.lerpSteps.isEmpty()) { + this.currentLerpSteps.addAll(this.lerpSteps); + this.lerpSteps.clear(); + this.currentLerpStepsTotalWeight = 0.0; + + for (NewMinecartBehavior.MinecartStep minecartStep : this.currentLerpSteps) { + this.currentLerpStepsTotalWeight = this.currentLerpStepsTotalWeight + minecartStep.weight; + } + + this.lerpDelay = this.currentLerpStepsTotalWeight == 0.0 ? 0 : 3; + } + } + + if (this.cartHasPosRotLerp()) { + this.setPos(this.getCartLerpPosition(1.0F)); + this.setDeltaMovement(this.getCartLerpMovements(1.0F)); + this.setXRot(this.getCartLerpXRot(1.0F)); + this.setYRot(this.getCartLerpYRot(1.0F)); + } + } + + public void setOldLerpValues() { + this.oldLerp = new NewMinecartBehavior.MinecartStep(this.position(), this.getDeltaMovement(), this.getYRot(), this.getXRot(), 0.0F); + } + + public boolean cartHasPosRotLerp() { + return !this.currentLerpSteps.isEmpty(); + } + + public float getCartLerpXRot(float f) { + NewMinecartBehavior.StepPartialTicks stepPartialTicks = this.getCurrentLerpStep(f); + return Mth.rotLerp(stepPartialTicks.partialTicksInStep, stepPartialTicks.previousStep.xRot, stepPartialTicks.currentStep.xRot); + } + + public float getCartLerpYRot(float f) { + NewMinecartBehavior.StepPartialTicks stepPartialTicks = this.getCurrentLerpStep(f); + return Mth.rotLerp(stepPartialTicks.partialTicksInStep, stepPartialTicks.previousStep.yRot, stepPartialTicks.currentStep.yRot); + } + + public Vec3 getCartLerpPosition(float f) { + NewMinecartBehavior.StepPartialTicks stepPartialTicks = this.getCurrentLerpStep(f); + return Mth.lerp(stepPartialTicks.partialTicksInStep, stepPartialTicks.previousStep.position, stepPartialTicks.currentStep.position); + } + + public Vec3 getCartLerpMovements(float f) { + NewMinecartBehavior.StepPartialTicks stepPartialTicks = this.getCurrentLerpStep(f); + return Mth.lerp(stepPartialTicks.partialTicksInStep, stepPartialTicks.previousStep.movement, stepPartialTicks.currentStep.movement); + } + + private NewMinecartBehavior.StepPartialTicks getCurrentLerpStep(float f) { + if (f == this.cachedPartialTick && this.lerpDelay == this.cachedLerpDelay && this.cacheIndexAlpha != null) { + return this.cacheIndexAlpha; + } else { + float g = (3 - this.lerpDelay + f) / 3.0F; + float h = 0.0F; + float i = 1.0F; + boolean bl = false; + + int j; + for (j = 0; j < this.currentLerpSteps.size(); j++) { + float k = ((NewMinecartBehavior.MinecartStep)this.currentLerpSteps.get(j)).weight; + if (!(k <= 0.0F)) { + h += k; + if (h >= this.currentLerpStepsTotalWeight * g) { + float l = h - k; + i = (float)((g * this.currentLerpStepsTotalWeight - l) / k); + bl = true; + break; + } + } + } + + if (!bl) { + j = this.currentLerpSteps.size() - 1; + } + + NewMinecartBehavior.MinecartStep minecartStep = (NewMinecartBehavior.MinecartStep)this.currentLerpSteps.get(j); + NewMinecartBehavior.MinecartStep minecartStep2 = j > 0 ? (NewMinecartBehavior.MinecartStep)this.currentLerpSteps.get(j - 1) : this.oldLerp; + this.cacheIndexAlpha = new NewMinecartBehavior.StepPartialTicks(i, minecartStep, minecartStep2); + this.cachedLerpDelay = this.lerpDelay; + this.cachedPartialTick = f; + return this.cacheIndexAlpha; + } + } + + public void adjustToRails(BlockPos blockPos, BlockState blockState, boolean bl) { + if (BaseRailBlock.isRail(blockState)) { + RailShape railShape = blockState.getValue(((BaseRailBlock)blockState.getBlock()).getShapeProperty()); + Pair pair = AbstractMinecart.exits(railShape); + Vec3 vec3 = new Vec3(pair.getFirst()).scale(0.5); + Vec3 vec32 = new Vec3(pair.getSecond()).scale(0.5); + Vec3 vec33 = vec3.horizontal(); + Vec3 vec34 = vec32.horizontal(); + if (this.getDeltaMovement().length() > 1.0E-5F && this.getDeltaMovement().dot(vec33) < this.getDeltaMovement().dot(vec34) + || this.isDecending(vec34, railShape)) { + Vec3 vec35 = vec33; + vec33 = vec34; + vec34 = vec35; + } + + float f = 180.0F - (float)(Math.atan2(vec33.z, vec33.x) * 180.0 / Math.PI); + f += this.minecart.isFlipped() ? 180.0F : 0.0F; + Vec3 vec36 = this.position(); + boolean bl2 = vec3.x() != vec32.x() && vec3.z() != vec32.z(); + Vec3 vec310; + if (bl2) { + Vec3 vec37 = vec32.subtract(vec3); + Vec3 vec38 = vec36.subtract(blockPos.getBottomCenter()).subtract(vec3); + Vec3 vec39 = vec37.scale(vec37.dot(vec38) / vec37.dot(vec37)); + vec310 = blockPos.getBottomCenter().add(vec3).add(vec39); + f = 180.0F - (float)(Math.atan2(vec39.z, vec39.x) * 180.0 / Math.PI); + f += this.minecart.isFlipped() ? 180.0F : 0.0F; + } else { + boolean bl3 = vec3.subtract(vec32).x != 0.0; + boolean bl4 = vec3.subtract(vec32).z != 0.0; + vec310 = new Vec3(bl4 ? blockPos.getCenter().x : vec36.x, blockPos.getY(), bl3 ? blockPos.getCenter().z : vec36.z); + } + + Vec3 vec37 = vec310.subtract(vec36); + this.setPos(vec36.add(vec37)); + float g = 0.0F; + boolean bl5 = vec3.y() != vec32.y(); + if (bl5) { + Vec3 vec311 = blockPos.getBottomCenter().add(vec34); + double d = vec311.distanceTo(this.position()); + this.setPos(this.position().add(0.0, d + 0.1, 0.0)); + g = this.minecart.isFlipped() ? 45.0F : -45.0F; + } else { + this.setPos(this.position().add(0.0, 0.1, 0.0)); + } + + this.setRotation(f, g); + double e = vec36.distanceTo(this.position()); + if (e > 0.0) { + this.lerpSteps.add(new NewMinecartBehavior.MinecartStep(this.position(), this.getDeltaMovement(), this.getYRot(), this.getXRot(), bl ? 0.0F : (float)e)); + } + } + } + + private void setRotation(float f, float g) { + double d = Math.abs(f - this.getYRot()); + if (d >= 175.0 && d <= 185.0) { + this.minecart.setFlipped(!this.minecart.isFlipped()); + f -= 180.0F; + g *= -1.0F; + } + + g = Math.clamp(g, -45.0F, 45.0F); + this.setXRot(g % 360.0F); + this.setYRot(f % 360.0F); + } + + @Override + public void moveAlongTrack(ServerLevel serverLevel) { + for (NewMinecartBehavior.TrackIteration trackIteration = new NewMinecartBehavior.TrackIteration(); + trackIteration.shouldIterate() && this.minecart.isAlive(); + trackIteration.firstIteration = false + ) { + Vec3 vec3 = this.getDeltaMovement(); + BlockPos blockPos = this.minecart.getCurrentBlockPosOrRailBelow(); + BlockState blockState = this.level().getBlockState(blockPos); + boolean bl = BaseRailBlock.isRail(blockState); + if (this.minecart.isOnRails() != bl) { + this.minecart.setOnRails(bl); + this.adjustToRails(blockPos, blockState, false); + } + + if (bl) { + this.minecart.resetFallDistance(); + this.minecart.setOldPosAndRot(); + if (blockState.is(Blocks.ACTIVATOR_RAIL)) { + this.minecart.activateMinecart(blockPos.getX(), blockPos.getY(), blockPos.getZ(), (Boolean)blockState.getValue(PoweredRailBlock.POWERED)); + } + + RailShape railShape = blockState.getValue(((BaseRailBlock)blockState.getBlock()).getShapeProperty()); + Vec3 vec32 = this.calculateTrackSpeed(serverLevel, vec3.horizontal(), trackIteration, blockPos, blockState, railShape); + if (trackIteration.firstIteration) { + trackIteration.movementLeft = vec32.horizontalDistance(); + } else { + trackIteration.movementLeft = trackIteration.movementLeft + (vec32.horizontalDistance() - vec3.horizontalDistance()); + } + + this.setDeltaMovement(vec32); + trackIteration.movementLeft = this.minecart.makeStepAlongTrack(blockPos, railShape, trackIteration.movementLeft); + } else { + this.minecart.comeOffTrack(serverLevel); + trackIteration.movementLeft = 0.0; + } + + Vec3 vec33 = this.position(); + Vec3 vec32 = vec33.subtract(this.minecart.oldPosition()); + double d = vec32.length(); + if (d > 1.0E-5F) { + if (!(vec32.horizontalDistanceSqr() > 1.0E-5F)) { + if (!this.minecart.isOnRails()) { + this.setXRot(this.minecart.onGround() ? 0.0F : Mth.rotLerp(0.2F, this.getXRot(), 0.0F)); + } + } else { + float f = 180.0F - (float)(Math.atan2(vec32.z, vec32.x) * 180.0 / Math.PI); + float g = this.minecart.onGround() && !this.minecart.isOnRails() + ? 0.0F + : 90.0F - (float)(Math.atan2(vec32.horizontalDistance(), vec32.y) * 180.0 / Math.PI); + f += this.minecart.isFlipped() ? 180.0F : 0.0F; + g *= this.minecart.isFlipped() ? -1.0F : 1.0F; + this.setRotation(f, g); + } + + this.lerpSteps + .add( + new NewMinecartBehavior.MinecartStep(vec33, this.getDeltaMovement(), this.getYRot(), this.getXRot(), (float)Math.min(d, this.getMaxSpeed(serverLevel))) + ); + } else if (vec3.horizontalDistanceSqr() > 0.0) { + this.lerpSteps.add(new NewMinecartBehavior.MinecartStep(vec33, this.getDeltaMovement(), this.getYRot(), this.getXRot(), 1.0F)); + } + + if (d > 1.0E-5F || trackIteration.firstIteration) { + this.minecart.applyEffectsFromBlocks(); + this.minecart.applyEffectsFromBlocks(); + } + } + } + + private Vec3 calculateTrackSpeed( + ServerLevel serverLevel, Vec3 vec3, NewMinecartBehavior.TrackIteration trackIteration, BlockPos blockPos, BlockState blockState, RailShape railShape + ) { + Vec3 vec32 = vec3; + if (!trackIteration.hasGainedSlopeSpeed) { + Vec3 vec33 = this.calculateSlopeSpeed(vec3, railShape); + if (vec33.horizontalDistanceSqr() != vec3.horizontalDistanceSqr()) { + trackIteration.hasGainedSlopeSpeed = true; + vec32 = vec33; + } + } + + if (trackIteration.firstIteration) { + Vec3 vec33 = this.calculatePlayerInputSpeed(vec32); + if (vec33.horizontalDistanceSqr() != vec32.horizontalDistanceSqr()) { + trackIteration.hasHalted = true; + vec32 = vec33; + } + } + + if (!trackIteration.hasHalted) { + Vec3 vec33 = this.calculateHaltTrackSpeed(vec32, blockState); + if (vec33.horizontalDistanceSqr() != vec32.horizontalDistanceSqr()) { + trackIteration.hasHalted = true; + vec32 = vec33; + } + } + + if (trackIteration.firstIteration) { + vec32 = this.minecart.applyNaturalSlowdown(vec32); + if (vec32.lengthSqr() > 0.0) { + double d = Math.min(vec32.length(), this.minecart.getMaxSpeed(serverLevel)); + vec32 = vec32.normalize().scale(d); + } + } + + if (!trackIteration.hasBoosted) { + Vec3 vec33 = this.calculateBoostTrackSpeed(vec32, blockPos, blockState); + if (vec33.horizontalDistanceSqr() != vec32.horizontalDistanceSqr()) { + trackIteration.hasBoosted = true; + vec32 = vec33; + } + } + + return vec32; + } + + private Vec3 calculateSlopeSpeed(Vec3 vec3, RailShape railShape) { + double d = Math.max(0.0078125, vec3.horizontalDistance() * 0.02); + if (this.minecart.isInWater()) { + d *= 0.2; + } + return switch (railShape) { + case ASCENDING_EAST -> vec3.add(-d, 0.0, 0.0); + case ASCENDING_WEST -> vec3.add(d, 0.0, 0.0); + case ASCENDING_NORTH -> vec3.add(0.0, 0.0, d); + case ASCENDING_SOUTH -> vec3.add(0.0, 0.0, -d); + default -> vec3; + }; + } + + private Vec3 calculatePlayerInputSpeed(Vec3 vec3) { + if (this.minecart.getFirstPassenger() instanceof ServerPlayer serverPlayer) { + Vec3 vec32 = serverPlayer.getLastClientMoveIntent(); + if (vec32.lengthSqr() > 0.0) { + Vec3 vec33 = vec32.normalize(); + double d = vec3.horizontalDistanceSqr(); + if (vec33.lengthSqr() > 0.0 && d < 0.01) { + return vec3.add(new Vec3(vec33.x, 0.0, vec33.z).normalize().scale(0.001)); + } + } + + return vec3; + } else { + return vec3; + } + } + + private Vec3 calculateHaltTrackSpeed(Vec3 vec3, BlockState blockState) { + if (blockState.is(Blocks.POWERED_RAIL) && !(Boolean)blockState.getValue(PoweredRailBlock.POWERED)) { + return vec3.length() < 0.03 ? Vec3.ZERO : vec3.scale(0.5); + } else { + return vec3; + } + } + + private Vec3 calculateBoostTrackSpeed(Vec3 vec3, BlockPos blockPos, BlockState blockState) { + if (blockState.is(Blocks.POWERED_RAIL) && (Boolean)blockState.getValue(PoweredRailBlock.POWERED)) { + if (vec3.length() > 0.01) { + return vec3.normalize().scale(vec3.length() + 0.06); + } else { + Vec3 vec32 = this.minecart.getRedstoneDirection(blockPos); + return vec32.lengthSqr() <= 0.0 ? vec3 : vec32.scale(vec3.length() + 0.2); + } + } else { + return vec3; + } + } + + @Override + public double stepAlongTrack(BlockPos blockPos, RailShape railShape, double d) { + if (d < 1.0E-5F) { + return 0.0; + } else { + Vec3 vec3 = this.position(); + Pair pair = AbstractMinecart.exits(railShape); + Vec3i vec3i = pair.getFirst(); + Vec3i vec3i2 = pair.getSecond(); + Vec3 vec32 = this.getDeltaMovement().horizontal(); + if (vec32.length() < 1.0E-5F) { + this.setDeltaMovement(Vec3.ZERO); + return 0.0; + } else { + boolean bl = vec3i.getY() != vec3i2.getY(); + Vec3 vec33 = new Vec3(vec3i2).scale(0.5).horizontal(); + Vec3 vec34 = new Vec3(vec3i).scale(0.5).horizontal(); + if (vec32.dot(vec34) < vec32.dot(vec33)) { + vec34 = vec33; + } + + Vec3 vec35 = blockPos.getBottomCenter().add(vec34).add(0.0, 0.1, 0.0).add(vec34.normalize().scale(1.0E-5F)); + if (bl && !this.isDecending(vec32, railShape)) { + vec35 = vec35.add(0.0, 1.0, 0.0); + } + + Vec3 vec36 = vec35.subtract(this.position()).normalize(); + vec32 = vec36.scale(vec32.length() / vec36.horizontalDistance()); + Vec3 vec37 = vec3.add(vec32.normalize().scale(d * (bl ? Mth.SQRT_OF_TWO : 1.0F))); + if (vec3.distanceToSqr(vec35) <= vec3.distanceToSqr(vec37)) { + d = vec35.subtract(vec37).horizontalDistance(); + vec37 = vec35; + } else { + d = 0.0; + } + + this.minecart.move(MoverType.SELF, vec37.subtract(vec3)); + BlockState blockState = this.level().getBlockState(BlockPos.containing(vec37)); + if (bl) { + if (BaseRailBlock.isRail(blockState)) { + RailShape railShape2 = blockState.getValue(((BaseRailBlock)blockState.getBlock()).getShapeProperty()); + if (this.restAtVShape(railShape, railShape2)) { + return 0.0; + } + } + + double e = vec35.horizontal().distanceTo(this.position().horizontal()); + double f = vec35.y + (this.isDecending(vec32, railShape) ? e : -e); + if (this.position().y < f) { + this.setPos(this.position().x, f, this.position().z); + } + } + + if (this.position().distanceTo(vec3) < 1.0E-5F && vec37.distanceTo(vec3) > 1.0E-5F) { + this.setDeltaMovement(Vec3.ZERO); + return 0.0; + } else { + this.setDeltaMovement(vec32); + return d; + } + } + } + } + + private boolean restAtVShape(RailShape railShape, RailShape railShape2) { + if (this.getDeltaMovement().lengthSqr() < 0.005 + && railShape2.isSlope() + && this.isDecending(this.getDeltaMovement(), railShape) + && !this.isDecending(this.getDeltaMovement(), railShape2)) { + this.setDeltaMovement(Vec3.ZERO); + return true; + } else { + return false; + } + } + + @Override + public double getMaxSpeed(ServerLevel serverLevel) { + return serverLevel.getGameRules().getInt(GameRules.RULE_MINECART_MAX_SPEED) * (this.minecart.isInWater() ? 0.5 : 1.0) / 20.0; + } + + private boolean isDecending(Vec3 vec3, RailShape railShape) { + return switch (railShape) { + case ASCENDING_EAST -> vec3.x < 0.0; + case ASCENDING_WEST -> vec3.x > 0.0; + case ASCENDING_NORTH -> vec3.z > 0.0; + case ASCENDING_SOUTH -> vec3.z < 0.0; + default -> false; + }; + } + + @Override + public double getSlowdownFactor() { + return this.minecart.isVehicle() ? 0.997 : 0.975; + } + + @Override + public boolean pushAndPickupEntities() { + boolean bl = this.pickupEntities(this.minecart.getBoundingBox().inflate(0.2, 0.0, 0.2)); + if (!this.minecart.horizontalCollision && !this.minecart.verticalCollision) { + return false; + } else { + boolean bl2 = this.pushEntities(this.minecart.getBoundingBox().inflate(1.0E-7)); + return bl && !bl2; + } + } + + public boolean pickupEntities(AABB aABB) { + if (this.minecart.isRideable() && !this.minecart.isVehicle()) { + List list = this.level().getEntities(this.minecart, aABB, EntitySelector.pushableBy(this.minecart)); + if (!list.isEmpty()) { + for (Entity entity : list) { + if (!(entity instanceof Player) + && !(entity instanceof IronGolem) + && !(entity instanceof AbstractMinecart) + && !this.minecart.isVehicle() + && !entity.isPassenger()) { + boolean bl = entity.startRiding(this.minecart); + if (bl) { + return true; + } + } + } + } + } + + return false; + } + + public boolean pushEntities(AABB aABB) { + boolean bl = false; + if (this.minecart.isRideable()) { + List list = this.level().getEntities(this.minecart, aABB, EntitySelector.pushableBy(this.minecart)); + if (!list.isEmpty()) { + for (Entity entity : list) { + if (entity instanceof Player || entity instanceof IronGolem || entity instanceof AbstractMinecart || this.minecart.isVehicle() || entity.isPassenger()) { + entity.push(this.minecart); + bl = true; + } + } + } + } else { + for (Entity entity2 : this.level().getEntities(this.minecart, aABB)) { + if (!this.minecart.hasPassenger(entity2) && entity2.isPushable() && entity2 instanceof AbstractMinecart) { + entity2.push(this.minecart); + bl = true; + } + } + } + + return bl; + } + + public record MinecartStep(Vec3 position, Vec3 movement, float yRot, float xRot, float weight) { + public static final StreamCodec STREAM_CODEC = StreamCodec.composite( + Vec3.STREAM_CODEC, + NewMinecartBehavior.MinecartStep::position, + Vec3.STREAM_CODEC, + NewMinecartBehavior.MinecartStep::movement, + ByteBufCodecs.ROTATION_BYTE, + NewMinecartBehavior.MinecartStep::yRot, + ByteBufCodecs.ROTATION_BYTE, + NewMinecartBehavior.MinecartStep::xRot, + ByteBufCodecs.FLOAT, + NewMinecartBehavior.MinecartStep::weight, + NewMinecartBehavior.MinecartStep::new + ); + public static NewMinecartBehavior.MinecartStep ZERO = new NewMinecartBehavior.MinecartStep(Vec3.ZERO, Vec3.ZERO, 0.0F, 0.0F, 0.0F); + } + + record StepPartialTicks(float partialTicksInStep, NewMinecartBehavior.MinecartStep currentStep, NewMinecartBehavior.MinecartStep previousStep) { + } + + static class TrackIteration { + double movementLeft = 0.0; + boolean firstIteration = true; + boolean hasGainedSlopeSpeed = false; + boolean hasHalted = false; + boolean hasBoosted = false; + + public boolean shouldIterate() { + return this.firstIteration || this.movementLeft > 1.0E-5F; + } + } +} diff --git a/net/minecraft/world/entity/vehicle/OldMinecartBehavior.java b/net/minecraft/world/entity/vehicle/OldMinecartBehavior.java new file mode 100644 index 00000000..1b4917e0 --- /dev/null +++ b/net/minecraft/world/entity/vehicle/OldMinecartBehavior.java @@ -0,0 +1,453 @@ +package net.minecraft.world.entity.vehicle; + +import com.mojang.datafixers.util.Pair; +import java.util.List; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.core.Vec3i; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.tags.BlockTags; +import net.minecraft.util.Mth; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntitySelector; +import net.minecraft.world.entity.MoverType; +import net.minecraft.world.entity.animal.IronGolem; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.level.block.BaseRailBlock; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.PoweredRailBlock; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.properties.RailShape; +import net.minecraft.world.phys.AABB; +import net.minecraft.world.phys.Vec3; +import org.jetbrains.annotations.Nullable; + +public class OldMinecartBehavior extends MinecartBehavior { + private static final double MINECART_RIDABLE_THRESHOLD = 0.01; + private static final double MAX_SPEED_IN_WATER = 0.2; + private static final double MAX_SPEED_ON_LAND = 0.4; + private static final double ABSOLUTE_MAX_SPEED = 0.4; + private int lerpSteps; + private double lerpX; + private double lerpY; + private double lerpZ; + private double lerpYRot; + private double lerpXRot; + private Vec3 targetDeltaMovement = Vec3.ZERO; + + public OldMinecartBehavior(AbstractMinecart abstractMinecart) { + super(abstractMinecart); + } + + @Override + public void cancelLerp() { + this.lerpSteps = 0; + } + + @Override + public void lerpTo(double d, double e, double f, float g, float h, int i) { + this.lerpX = d; + this.lerpY = e; + this.lerpZ = f; + this.lerpYRot = g; + this.lerpXRot = h; + this.lerpSteps = i + 2; + this.setDeltaMovement(this.targetDeltaMovement); + } + + @Override + public double lerpTargetX() { + return this.lerpSteps > 0 ? this.lerpX : this.minecart.getX(); + } + + @Override + public double lerpTargetY() { + return this.lerpSteps > 0 ? this.lerpY : this.minecart.getY(); + } + + @Override + public double lerpTargetZ() { + return this.lerpSteps > 0 ? this.lerpZ : this.minecart.getZ(); + } + + @Override + public float lerpTargetXRot() { + return this.lerpSteps > 0 ? (float)this.lerpXRot : this.getXRot(); + } + + @Override + public float lerpTargetYRot() { + return this.lerpSteps > 0 ? (float)this.lerpYRot : this.getYRot(); + } + + @Override + public void lerpMotion(double d, double e, double f) { + this.targetDeltaMovement = new Vec3(d, e, f); + this.setDeltaMovement(this.targetDeltaMovement); + } + + @Override + public void tick() { + if (this.level() instanceof ServerLevel serverLevel) { + this.minecart.applyGravity(); + BlockPos var11 = this.minecart.getCurrentBlockPosOrRailBelow(); + BlockState blockState = this.level().getBlockState(var11); + boolean bl = BaseRailBlock.isRail(blockState); + this.minecart.setOnRails(bl); + if (bl) { + this.moveAlongTrack(serverLevel); + if (blockState.is(Blocks.ACTIVATOR_RAIL)) { + this.minecart.activateMinecart(var11.getX(), var11.getY(), var11.getZ(), (Boolean)blockState.getValue(PoweredRailBlock.POWERED)); + } + } else { + this.minecart.comeOffTrack(serverLevel); + } + + this.minecart.applyEffectsFromBlocks(); + this.setXRot(0.0F); + double d = this.minecart.xo - this.getX(); + double e = this.minecart.zo - this.getZ(); + if (d * d + e * e > 0.001) { + this.setYRot((float)(Mth.atan2(e, d) * 180.0 / Math.PI)); + if (this.minecart.isFlipped()) { + this.setYRot(this.getYRot() + 180.0F); + } + } + + double f = Mth.wrapDegrees(this.getYRot() - this.minecart.yRotO); + if (f < -170.0 || f >= 170.0) { + this.setYRot(this.getYRot() + 180.0F); + this.minecart.setFlipped(!this.minecart.isFlipped()); + } + + this.setXRot(this.getXRot() % 360.0F); + this.setYRot(this.getYRot() % 360.0F); + this.pushAndPickupEntities(); + } else { + if (this.lerpSteps > 0) { + this.minecart.lerpPositionAndRotationStep(this.lerpSteps, this.lerpX, this.lerpY, this.lerpZ, this.lerpYRot, this.lerpXRot); + this.lerpSteps--; + } else { + this.minecart.reapplyPosition(); + this.setXRot(this.getXRot() % 360.0F); + this.setYRot(this.getYRot() % 360.0F); + } + } + } + + @Override + public void moveAlongTrack(ServerLevel serverLevel) { + BlockPos blockPos = this.minecart.getCurrentBlockPosOrRailBelow(); + BlockState blockState = this.level().getBlockState(blockPos); + this.minecart.resetFallDistance(); + double d = this.minecart.getX(); + double e = this.minecart.getY(); + double f = this.minecart.getZ(); + Vec3 vec3 = this.getPos(d, e, f); + e = blockPos.getY(); + boolean bl = false; + boolean bl2 = false; + if (blockState.is(Blocks.POWERED_RAIL)) { + bl = (Boolean)blockState.getValue(PoweredRailBlock.POWERED); + bl2 = !bl; + } + + double g = 0.0078125; + if (this.minecart.isInWater()) { + g *= 0.2; + } + + Vec3 vec32 = this.getDeltaMovement(); + RailShape railShape = blockState.getValue(((BaseRailBlock)blockState.getBlock()).getShapeProperty()); + switch (railShape) { + case ASCENDING_EAST: + this.setDeltaMovement(vec32.add(-g, 0.0, 0.0)); + e++; + break; + case ASCENDING_WEST: + this.setDeltaMovement(vec32.add(g, 0.0, 0.0)); + e++; + break; + case ASCENDING_NORTH: + this.setDeltaMovement(vec32.add(0.0, 0.0, g)); + e++; + break; + case ASCENDING_SOUTH: + this.setDeltaMovement(vec32.add(0.0, 0.0, -g)); + e++; + } + + vec32 = this.getDeltaMovement(); + Pair pair = AbstractMinecart.exits(railShape); + Vec3i vec3i = pair.getFirst(); + Vec3i vec3i2 = pair.getSecond(); + double h = vec3i2.getX() - vec3i.getX(); + double i = vec3i2.getZ() - vec3i.getZ(); + double j = Math.sqrt(h * h + i * i); + double k = vec32.x * h + vec32.z * i; + if (k < 0.0) { + h = -h; + i = -i; + } + + double l = Math.min(2.0, vec32.horizontalDistance()); + vec32 = new Vec3(l * h / j, vec32.y, l * i / j); + this.setDeltaMovement(vec32); + Entity entity = this.minecart.getFirstPassenger(); + Vec3 vec33; + if (this.minecart.getFirstPassenger() instanceof ServerPlayer serverPlayer) { + vec33 = serverPlayer.getLastClientMoveIntent(); + } else { + vec33 = Vec3.ZERO; + } + + if (entity instanceof Player && vec33.lengthSqr() > 0.0) { + Vec3 vec34 = vec33.normalize(); + double m = this.getDeltaMovement().horizontalDistanceSqr(); + if (vec34.lengthSqr() > 0.0 && m < 0.01) { + this.setDeltaMovement(this.getDeltaMovement().add(vec33.x * 0.001, 0.0, vec33.z * 0.001)); + bl2 = false; + } + } + + if (bl2) { + double n = this.getDeltaMovement().horizontalDistance(); + if (n < 0.03) { + this.setDeltaMovement(Vec3.ZERO); + } else { + this.setDeltaMovement(this.getDeltaMovement().multiply(0.5, 0.0, 0.5)); + } + } + + double n = blockPos.getX() + 0.5 + vec3i.getX() * 0.5; + double o = blockPos.getZ() + 0.5 + vec3i.getZ() * 0.5; + double p = blockPos.getX() + 0.5 + vec3i2.getX() * 0.5; + double q = blockPos.getZ() + 0.5 + vec3i2.getZ() * 0.5; + h = p - n; + i = q - o; + double r; + if (h == 0.0) { + r = f - blockPos.getZ(); + } else if (i == 0.0) { + r = d - blockPos.getX(); + } else { + double s = d - n; + double t = f - o; + r = (s * h + t * i) * 2.0; + } + + d = n + h * r; + f = o + i * r; + this.setPos(d, e, f); + double s = this.minecart.isVehicle() ? 0.75 : 1.0; + double t = this.minecart.getMaxSpeed(serverLevel); + vec32 = this.getDeltaMovement(); + this.minecart.move(MoverType.SELF, new Vec3(Mth.clamp(s * vec32.x, -t, t), 0.0, Mth.clamp(s * vec32.z, -t, t))); + if (vec3i.getY() != 0 + && Mth.floor(this.minecart.getX()) - blockPos.getX() == vec3i.getX() + && Mth.floor(this.minecart.getZ()) - blockPos.getZ() == vec3i.getZ()) { + this.setPos(this.minecart.getX(), this.minecart.getY() + vec3i.getY(), this.minecart.getZ()); + } else if (vec3i2.getY() != 0 + && Mth.floor(this.minecart.getX()) - blockPos.getX() == vec3i2.getX() + && Mth.floor(this.minecart.getZ()) - blockPos.getZ() == vec3i2.getZ()) { + this.setPos(this.minecart.getX(), this.minecart.getY() + vec3i2.getY(), this.minecart.getZ()); + } + + this.setDeltaMovement(this.minecart.applyNaturalSlowdown(this.getDeltaMovement())); + Vec3 vec35 = this.getPos(this.minecart.getX(), this.minecart.getY(), this.minecart.getZ()); + if (vec35 != null && vec3 != null) { + double u = (vec3.y - vec35.y) * 0.05; + Vec3 vec36 = this.getDeltaMovement(); + double v = vec36.horizontalDistance(); + if (v > 0.0) { + this.setDeltaMovement(vec36.multiply((v + u) / v, 1.0, (v + u) / v)); + } + + this.setPos(this.minecart.getX(), vec35.y, this.minecart.getZ()); + } + + int w = Mth.floor(this.minecart.getX()); + int x = Mth.floor(this.minecart.getZ()); + if (w != blockPos.getX() || x != blockPos.getZ()) { + Vec3 vec36 = this.getDeltaMovement(); + double v = vec36.horizontalDistance(); + this.setDeltaMovement(v * (w - blockPos.getX()), vec36.y, v * (x - blockPos.getZ())); + } + + if (bl) { + Vec3 vec36 = this.getDeltaMovement(); + double v = vec36.horizontalDistance(); + if (v > 0.01) { + double y = 0.06; + this.setDeltaMovement(vec36.add(vec36.x / v * 0.06, 0.0, vec36.z / v * 0.06)); + } else { + Vec3 vec37 = this.getDeltaMovement(); + double z = vec37.x; + double aa = vec37.z; + if (railShape == RailShape.EAST_WEST) { + if (this.minecart.isRedstoneConductor(blockPos.west())) { + z = 0.02; + } else if (this.minecart.isRedstoneConductor(blockPos.east())) { + z = -0.02; + } + } else { + if (railShape != RailShape.NORTH_SOUTH) { + return; + } + + if (this.minecart.isRedstoneConductor(blockPos.north())) { + aa = 0.02; + } else if (this.minecart.isRedstoneConductor(blockPos.south())) { + aa = -0.02; + } + } + + this.setDeltaMovement(z, vec37.y, aa); + } + } + } + + @Nullable + public Vec3 getPosOffs(double d, double e, double f, double g) { + int i = Mth.floor(d); + int j = Mth.floor(e); + int k = Mth.floor(f); + if (this.level().getBlockState(new BlockPos(i, j - 1, k)).is(BlockTags.RAILS)) { + j--; + } + + BlockState blockState = this.level().getBlockState(new BlockPos(i, j, k)); + if (BaseRailBlock.isRail(blockState)) { + RailShape railShape = blockState.getValue(((BaseRailBlock)blockState.getBlock()).getShapeProperty()); + e = j; + if (railShape.isSlope()) { + e = j + 1; + } + + Pair pair = AbstractMinecart.exits(railShape); + Vec3i vec3i = pair.getFirst(); + Vec3i vec3i2 = pair.getSecond(); + double h = vec3i2.getX() - vec3i.getX(); + double l = vec3i2.getZ() - vec3i.getZ(); + double m = Math.sqrt(h * h + l * l); + h /= m; + l /= m; + d += h * g; + f += l * g; + if (vec3i.getY() != 0 && Mth.floor(d) - i == vec3i.getX() && Mth.floor(f) - k == vec3i.getZ()) { + e += vec3i.getY(); + } else if (vec3i2.getY() != 0 && Mth.floor(d) - i == vec3i2.getX() && Mth.floor(f) - k == vec3i2.getZ()) { + e += vec3i2.getY(); + } + + return this.getPos(d, e, f); + } else { + return null; + } + } + + @Nullable + public Vec3 getPos(double d, double e, double f) { + int i = Mth.floor(d); + int j = Mth.floor(e); + int k = Mth.floor(f); + if (this.level().getBlockState(new BlockPos(i, j - 1, k)).is(BlockTags.RAILS)) { + j--; + } + + BlockState blockState = this.level().getBlockState(new BlockPos(i, j, k)); + if (BaseRailBlock.isRail(blockState)) { + RailShape railShape = blockState.getValue(((BaseRailBlock)blockState.getBlock()).getShapeProperty()); + Pair pair = AbstractMinecart.exits(railShape); + Vec3i vec3i = pair.getFirst(); + Vec3i vec3i2 = pair.getSecond(); + double g = i + 0.5 + vec3i.getX() * 0.5; + double h = j + 0.0625 + vec3i.getY() * 0.5; + double l = k + 0.5 + vec3i.getZ() * 0.5; + double m = i + 0.5 + vec3i2.getX() * 0.5; + double n = j + 0.0625 + vec3i2.getY() * 0.5; + double o = k + 0.5 + vec3i2.getZ() * 0.5; + double p = m - g; + double q = (n - h) * 2.0; + double r = o - l; + double s; + if (p == 0.0) { + s = f - k; + } else if (r == 0.0) { + s = d - i; + } else { + double t = d - g; + double u = f - l; + s = (t * p + u * r) * 2.0; + } + + d = g + p * s; + e = h + q * s; + f = l + r * s; + if (q < 0.0) { + e++; + } else if (q > 0.0) { + e += 0.5; + } + + return new Vec3(d, e, f); + } else { + return null; + } + } + + @Override + public double stepAlongTrack(BlockPos blockPos, RailShape railShape, double d) { + return 0.0; + } + + @Override + public boolean pushAndPickupEntities() { + AABB aABB = this.minecart.getBoundingBox().inflate(0.2F, 0.0, 0.2F); + if (this.minecart.isRideable() && this.getDeltaMovement().horizontalDistanceSqr() >= 0.01) { + List list = this.level().getEntities(this.minecart, aABB, EntitySelector.pushableBy(this.minecart)); + if (!list.isEmpty()) { + for (Entity entity : list) { + if (!(entity instanceof Player) + && !(entity instanceof IronGolem) + && !(entity instanceof AbstractMinecart) + && !this.minecart.isVehicle() + && !entity.isPassenger()) { + entity.startRiding(this.minecart); + } else { + entity.push(this.minecart); + } + } + } + } else { + for (Entity entity2 : this.level().getEntities(this.minecart, aABB)) { + if (!this.minecart.hasPassenger(entity2) && entity2.isPushable() && entity2 instanceof AbstractMinecart) { + entity2.push(this.minecart); + } + } + } + + return false; + } + + @Override + public Direction getMotionDirection() { + return this.minecart.isFlipped() ? this.minecart.getDirection().getOpposite().getClockWise() : this.minecart.getDirection().getClockWise(); + } + + @Override + public Vec3 getKnownMovement(Vec3 vec3) { + return new Vec3(Mth.clamp(vec3.x, -0.4, 0.4), vec3.y, Mth.clamp(vec3.z, -0.4, 0.4)); + } + + @Override + public double getMaxSpeed(ServerLevel serverLevel) { + return this.minecart.isInWater() ? 0.2 : 0.4; + } + + @Override + public double getSlowdownFactor() { + return this.minecart.isVehicle() ? 0.997 : 0.96; + } +} diff --git a/net/minecraft/world/entity/vehicle/Raft.java b/net/minecraft/world/entity/vehicle/Raft.java new file mode 100644 index 00000000..9a53d7a9 --- /dev/null +++ b/net/minecraft/world/entity/vehicle/Raft.java @@ -0,0 +1,18 @@ +package net.minecraft.world.entity.vehicle; + +import java.util.function.Supplier; +import net.minecraft.world.entity.EntityDimensions; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.item.Item; +import net.minecraft.world.level.Level; + +public class Raft extends AbstractBoat { + public Raft(EntityType entityType, Level level, Supplier supplier) { + super(entityType, level, supplier); + } + + @Override + protected double rideHeight(EntityDimensions entityDimensions) { + return entityDimensions.height() * 0.8888889F; + } +} diff --git a/net/minecraft/world/entity/vehicle/VehicleEntity.java b/net/minecraft/world/entity/vehicle/VehicleEntity.java index c8cbf38e..239eaffa 100644 --- a/net/minecraft/world/entity/vehicle/VehicleEntity.java +++ b/net/minecraft/world/entity/vehicle/VehicleEntity.java @@ -4,12 +4,16 @@ import net.minecraft.core.component.DataComponents; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.network.syncher.SynchedEntityData.Builder; +import net.minecraft.server.level.ServerLevel; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.Mob; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Explosion; import net.minecraft.world.level.GameRules; import net.minecraft.world.level.Level; import net.minecraft.world.level.gameevent.GameEvent; @@ -24,24 +28,29 @@ public abstract class VehicleEntity extends Entity { } @Override - public boolean hurt(DamageSource source, float amount) { - if (this.level().isClientSide || this.isRemoved()) { + public boolean hurtClient(DamageSource damageSource) { + return true; + } + + @Override + public boolean hurtServer(ServerLevel serverLevel, DamageSource damageSource, float f) { + if (this.isRemoved()) { return true; - } else if (this.isInvulnerableTo(source)) { + } else if (this.isInvulnerableToBase(damageSource)) { return false; } else { this.setHurtDir(-this.getHurtDir()); this.setHurtTime(10); this.markHurt(); - this.setDamage(this.getDamage() + amount * 10.0F); - this.gameEvent(GameEvent.ENTITY_DAMAGE, source.getEntity()); - boolean bl = source.getEntity() instanceof Player && ((Player)source.getEntity()).getAbilities().instabuild; - if ((bl || !(this.getDamage() > 40.0F)) && !this.shouldSourceDestroy(source)) { + this.setDamage(this.getDamage() + f * 10.0F); + this.gameEvent(GameEvent.ENTITY_DAMAGE, damageSource.getEntity()); + boolean bl = damageSource.getEntity() instanceof Player player && player.getAbilities().instabuild; + if ((bl || !(this.getDamage() > 40.0F)) && !this.shouldSourceDestroy(damageSource)) { if (bl) { this.discard(); } } else { - this.destroy(source); + this.destroy(serverLevel, damageSource); } return true; @@ -52,17 +61,22 @@ public abstract class VehicleEntity extends Entity { return false; } - public void destroy(Item dropItem) { - this.kill(); - if (this.level().getGameRules().getBoolean(GameRules.RULE_DOENTITYDROPS)) { - ItemStack itemStack = new ItemStack(dropItem); + @Override + public boolean ignoreExplosion(Explosion explosion) { + return explosion.getIndirectSourceEntity() instanceof Mob && !explosion.level().getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING); + } + + public void destroy(ServerLevel serverLevel, Item item) { + this.kill(serverLevel); + if (serverLevel.getGameRules().getBoolean(GameRules.RULE_DOENTITYDROPS)) { + ItemStack itemStack = new ItemStack(item); itemStack.set(DataComponents.CUSTOM_NAME, this.getCustomName()); - this.spawnAtLocation(itemStack); + this.spawnAtLocation(serverLevel, itemStack); } } @Override - protected void defineSynchedData(SynchedEntityData.Builder builder) { + protected void defineSynchedData(Builder builder) { builder.define(DATA_ID_HURT, 0); builder.define(DATA_ID_HURTDIR, 1); builder.define(DATA_ID_DAMAGE, 0.0F); @@ -92,9 +106,14 @@ public abstract class VehicleEntity extends Entity { return this.entityData.get(DATA_ID_HURTDIR); } - protected void destroy(DamageSource source) { - this.destroy(this.getDropItem()); + protected void destroy(ServerLevel serverLevel, DamageSource damageSource) { + this.destroy(serverLevel, this.getDropItem()); } - abstract Item getDropItem(); + @Override + public int getDimensionChangingDelay() { + return 10; + } + + protected abstract Item getDropItem(); } diff --git a/net/minecraft/world/flag/FeatureFlags.java b/net/minecraft/world/flag/FeatureFlags.java index 640b140b..0d73cbcb 100644 --- a/net/minecraft/world/flag/FeatureFlags.java +++ b/net/minecraft/world/flag/FeatureFlags.java @@ -4,11 +4,14 @@ import com.mojang.serialization.Codec; import java.util.Set; import java.util.stream.Collectors; import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.flag.FeatureFlagRegistry.Builder; public class FeatureFlags { public static final FeatureFlag VANILLA; - public static final FeatureFlag BUNDLE; + public static final FeatureFlag WINTER_DROP; public static final FeatureFlag TRADE_REBALANCE; + public static final FeatureFlag REDSTONE_EXPERIMENTS; + public static final FeatureFlag MINECART_IMPROVEMENTS; public static final FeatureFlagRegistry REGISTRY; public static final Codec CODEC; public static final FeatureFlagSet VANILLA_SET; @@ -29,10 +32,12 @@ public class FeatureFlags { } static { - FeatureFlagRegistry.Builder builder = new FeatureFlagRegistry.Builder("main"); + Builder builder = new Builder("main"); VANILLA = builder.createVanilla("vanilla"); - BUNDLE = builder.createVanilla("bundle"); + WINTER_DROP = builder.createVanilla("winter_drop"); TRADE_REBALANCE = builder.createVanilla("trade_rebalance"); + REDSTONE_EXPERIMENTS = builder.createVanilla("redstone_experiments"); + MINECART_IMPROVEMENTS = builder.createVanilla("minecart_improvements"); REGISTRY = builder.build(); CODEC = REGISTRY.codec(); VANILLA_SET = FeatureFlagSet.of(VANILLA); diff --git a/net/minecraft/world/food/FoodData.java b/net/minecraft/world/food/FoodData.java index 48e65c58..67164c52 100644 --- a/net/minecraft/world/food/FoodData.java +++ b/net/minecraft/world/food/FoodData.java @@ -1,21 +1,17 @@ package net.minecraft.world.food; import net.minecraft.nbt.CompoundTag; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.server.level.ServerPlayer; import net.minecraft.util.Mth; import net.minecraft.world.Difficulty; -import net.minecraft.world.entity.player.Player; import net.minecraft.world.level.GameRules; public class FoodData { private int foodLevel = 20; - private float saturationLevel; + private float saturationLevel = 5.0F; private float exhaustionLevel; private int tickTimer; - private int lastFoodLevel = 20; - - public FoodData() { - this.saturationLevel = 5.0F; - } private void add(int foodLevel, float saturationLevel) { this.foodLevel = Mth.clamp(foodLevel + this.foodLevel, 0, 20); @@ -33,12 +29,9 @@ public class FoodData { this.add(foodProperties.nutrition(), foodProperties.saturation()); } - /** - * Handles the food game logic. - */ - public void tick(Player player) { - Difficulty difficulty = player.level().getDifficulty(); - this.lastFoodLevel = this.foodLevel; + public void tick(ServerPlayer serverPlayer) { + ServerLevel serverLevel = serverPlayer.serverLevel(); + Difficulty difficulty = serverLevel.getDifficulty(); if (this.exhaustionLevel > 4.0F) { this.exhaustionLevel -= 4.0F; if (this.saturationLevel > 0.0F) { @@ -48,27 +41,27 @@ public class FoodData { } } - boolean bl = player.level().getGameRules().getBoolean(GameRules.RULE_NATURAL_REGENERATION); - if (bl && this.saturationLevel > 0.0F && player.isHurt() && this.foodLevel >= 20) { + boolean bl = serverLevel.getGameRules().getBoolean(GameRules.RULE_NATURAL_REGENERATION); + if (bl && this.saturationLevel > 0.0F && serverPlayer.isHurt() && this.foodLevel >= 20) { this.tickTimer++; if (this.tickTimer >= 10) { float f = Math.min(this.saturationLevel, 6.0F); - player.heal(f / 6.0F); + serverPlayer.heal(f / 6.0F); this.addExhaustion(f); this.tickTimer = 0; } - } else if (bl && this.foodLevel >= 18 && player.isHurt()) { + } else if (bl && this.foodLevel >= 18 && serverPlayer.isHurt()) { this.tickTimer++; if (this.tickTimer >= 80) { - player.heal(1.0F); + serverPlayer.heal(1.0F); this.addExhaustion(6.0F); this.tickTimer = 0; } } else if (this.foodLevel <= 0) { this.tickTimer++; if (this.tickTimer >= 80) { - if (player.getHealth() > 10.0F || difficulty == Difficulty.HARD || player.getHealth() > 1.0F && difficulty == Difficulty.NORMAL) { - player.hurt(player.damageSources().starve(), 1.0F); + if (serverPlayer.getHealth() > 10.0F || difficulty == Difficulty.HARD || serverPlayer.getHealth() > 1.0F && difficulty == Difficulty.NORMAL) { + serverPlayer.hurtServer(serverLevel, serverPlayer.damageSources().starve(), 1.0F); } this.tickTimer = 0; @@ -107,10 +100,6 @@ public class FoodData { return this.foodLevel; } - public int getLastFoodLevel() { - return this.lastFoodLevel; - } - /** * Get whether the player must eat food. */ @@ -125,10 +114,6 @@ public class FoodData { this.exhaustionLevel = Math.min(this.exhaustionLevel + exhaustion, 40.0F); } - public float getExhaustionLevel() { - return this.exhaustionLevel; - } - /** * Get the player's food saturation level. */ @@ -143,8 +128,4 @@ public class FoodData { public void setSaturation(float saturationLevel) { this.saturationLevel = saturationLevel; } - - public void setExhaustion(float exhaustionLevel) { - this.exhaustionLevel = exhaustionLevel; - } } diff --git a/net/minecraft/world/food/FoodProperties.java b/net/minecraft/world/food/FoodProperties.java index e0576eb5..3ad87031 100644 --- a/net/minecraft/world/food/FoodProperties.java +++ b/net/minecraft/world/food/FoodProperties.java @@ -1,30 +1,28 @@ package net.minecraft.world.food; -import com.google.common.collect.ImmutableList; import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; -import java.util.List; -import java.util.Optional; import net.minecraft.network.RegistryFriendlyByteBuf; import net.minecraft.network.codec.ByteBufCodecs; import net.minecraft.network.codec.StreamCodec; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.sounds.SoundSource; import net.minecraft.util.ExtraCodecs; -import net.minecraft.world.effect.MobEffectInstance; +import net.minecraft.util.Mth; +import net.minecraft.util.RandomSource; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; -import net.minecraft.world.level.ItemLike; +import net.minecraft.world.item.component.Consumable; +import net.minecraft.world.item.component.ConsumableListener; +import net.minecraft.world.level.Level; -public record FoodProperties( - int nutrition, float saturation, boolean canAlwaysEat, float eatSeconds, Optional usingConvertsTo, List effects -) { - private static final float DEFAULT_EAT_SECONDS = 1.6F; +public record FoodProperties(int nutrition, float saturation, boolean canAlwaysEat) implements ConsumableListener { public static final Codec DIRECT_CODEC = RecordCodecBuilder.create( instance -> instance.group( ExtraCodecs.NON_NEGATIVE_INT.fieldOf("nutrition").forGetter(FoodProperties::nutrition), Codec.FLOAT.fieldOf("saturation").forGetter(FoodProperties::saturation), - Codec.BOOL.optionalFieldOf("can_always_eat", false).forGetter(FoodProperties::canAlwaysEat), - ExtraCodecs.POSITIVE_FLOAT.optionalFieldOf("eat_seconds", 1.6F).forGetter(FoodProperties::eatSeconds), - ItemStack.SINGLE_ITEM_CODEC.optionalFieldOf("using_converts_to").forGetter(FoodProperties::usingConvertsTo), - FoodProperties.PossibleEffect.CODEC.listOf().optionalFieldOf("effects", List.of()).forGetter(FoodProperties::effects) + Codec.BOOL.optionalFieldOf("can_always_eat", false).forGetter(FoodProperties::canAlwaysEat) ) .apply(instance, FoodProperties::new) ); @@ -35,26 +33,34 @@ public record FoodProperties( FoodProperties::saturation, ByteBufCodecs.BOOL, FoodProperties::canAlwaysEat, - ByteBufCodecs.FLOAT, - FoodProperties::eatSeconds, - ItemStack.STREAM_CODEC.apply(ByteBufCodecs::optional), - FoodProperties::usingConvertsTo, - FoodProperties.PossibleEffect.STREAM_CODEC.apply(ByteBufCodecs.list()), - FoodProperties::effects, FoodProperties::new ); - public int eatDurationTicks() { - return (int)(this.eatSeconds * 20.0F); + @Override + public void onConsume(Level level, LivingEntity livingEntity, ItemStack itemStack, Consumable consumable) { + RandomSource randomSource = livingEntity.getRandom(); + level.playSound( + null, + livingEntity.getX(), + livingEntity.getY(), + livingEntity.getZ(), + consumable.sound().value(), + SoundSource.NEUTRAL, + 1.0F, + randomSource.triangle(1.0F, 0.4F) + ); + if (livingEntity instanceof Player player) { + player.getFoodData().eat(this); + level.playSound( + null, player.getX(), player.getY(), player.getZ(), SoundEvents.PLAYER_BURP, SoundSource.PLAYERS, 0.5F, Mth.randomBetween(randomSource, 0.9F, 1.0F) + ); + } } public static class Builder { private int nutrition; private float saturationModifier; private boolean canAlwaysEat; - private float eatSeconds = 1.6F; - private Optional usingConvertsTo = Optional.empty(); - private final ImmutableList.Builder effects = ImmutableList.builder(); public FoodProperties.Builder nutrition(int nutrition) { this.nutrition = nutrition; @@ -71,45 +77,9 @@ public record FoodProperties( return this; } - public FoodProperties.Builder fast() { - this.eatSeconds = 0.8F; - return this; - } - - public FoodProperties.Builder effect(MobEffectInstance effect, float probability) { - this.effects.add(new FoodProperties.PossibleEffect(effect, probability)); - return this; - } - - public FoodProperties.Builder usingConvertsTo(ItemLike item) { - this.usingConvertsTo = Optional.of(new ItemStack(item)); - return this; - } - public FoodProperties build() { float f = FoodConstants.saturationByModifier(this.nutrition, this.saturationModifier); - return new FoodProperties(this.nutrition, f, this.canAlwaysEat, this.eatSeconds, this.usingConvertsTo, this.effects.build()); - } - } - - public record PossibleEffect(MobEffectInstance effect, float probability) { - public static final Codec CODEC = RecordCodecBuilder.create( - instance -> instance.group( - MobEffectInstance.CODEC.fieldOf("effect").forGetter(FoodProperties.PossibleEffect::effect), - Codec.floatRange(0.0F, 1.0F).optionalFieldOf("probability", 1.0F).forGetter(FoodProperties.PossibleEffect::probability) - ) - .apply(instance, FoodProperties.PossibleEffect::new) - ); - public static final StreamCodec STREAM_CODEC = StreamCodec.composite( - MobEffectInstance.STREAM_CODEC, - FoodProperties.PossibleEffect::effect, - ByteBufCodecs.FLOAT, - FoodProperties.PossibleEffect::probability, - FoodProperties.PossibleEffect::new - ); - - public MobEffectInstance effect() { - return new MobEffectInstance(this.effect); + return new FoodProperties(this.nutrition, f, this.canAlwaysEat); } } } diff --git a/net/minecraft/world/food/Foods.java b/net/minecraft/world/food/Foods.java index e0d2f929..bf9a3b43 100644 --- a/net/minecraft/world/food/Foods.java +++ b/net/minecraft/world/food/Foods.java @@ -1,9 +1,5 @@ package net.minecraft.world.food; -import net.minecraft.world.effect.MobEffectInstance; -import net.minecraft.world.effect.MobEffects; -import net.minecraft.world.item.Items; - public class Foods { public static final FoodProperties APPLE = new FoodProperties.Builder().nutrition(4).saturationModifier(0.3F).build(); public static final FoodProperties BAKED_POTATO = new FoodProperties.Builder().nutrition(5).saturationModifier(0.6F).build(); @@ -12,11 +8,7 @@ public class Foods { public static final FoodProperties BEETROOT_SOUP = stew(6).build(); public static final FoodProperties BREAD = new FoodProperties.Builder().nutrition(5).saturationModifier(0.6F).build(); public static final FoodProperties CARROT = new FoodProperties.Builder().nutrition(3).saturationModifier(0.6F).build(); - public static final FoodProperties CHICKEN = new FoodProperties.Builder() - .nutrition(2) - .saturationModifier(0.3F) - .effect(new MobEffectInstance(MobEffects.HUNGER, 600, 0), 0.3F) - .build(); + public static final FoodProperties CHICKEN = new FoodProperties.Builder().nutrition(2).saturationModifier(0.3F).build(); public static final FoodProperties CHORUS_FRUIT = new FoodProperties.Builder().nutrition(4).saturationModifier(0.3F).alwaysEdible().build(); public static final FoodProperties COD = new FoodProperties.Builder().nutrition(2).saturationModifier(0.1F).build(); public static final FoodProperties COOKED_BEEF = new FoodProperties.Builder().nutrition(8).saturationModifier(0.8F).build(); @@ -27,63 +19,30 @@ public class Foods { public static final FoodProperties COOKED_RABBIT = new FoodProperties.Builder().nutrition(5).saturationModifier(0.6F).build(); public static final FoodProperties COOKED_SALMON = new FoodProperties.Builder().nutrition(6).saturationModifier(0.8F).build(); public static final FoodProperties COOKIE = new FoodProperties.Builder().nutrition(2).saturationModifier(0.1F).build(); - public static final FoodProperties DRIED_KELP = new FoodProperties.Builder().nutrition(1).saturationModifier(0.3F).fast().build(); - public static final FoodProperties ENCHANTED_GOLDEN_APPLE = new FoodProperties.Builder() - .nutrition(4) - .saturationModifier(1.2F) - .effect(new MobEffectInstance(MobEffects.REGENERATION, 400, 1), 1.0F) - .effect(new MobEffectInstance(MobEffects.DAMAGE_RESISTANCE, 6000, 0), 1.0F) - .effect(new MobEffectInstance(MobEffects.FIRE_RESISTANCE, 6000, 0), 1.0F) - .effect(new MobEffectInstance(MobEffects.ABSORPTION, 2400, 3), 1.0F) - .alwaysEdible() - .build(); - public static final FoodProperties GOLDEN_APPLE = new FoodProperties.Builder() - .nutrition(4) - .saturationModifier(1.2F) - .effect(new MobEffectInstance(MobEffects.REGENERATION, 100, 1), 1.0F) - .effect(new MobEffectInstance(MobEffects.ABSORPTION, 2400, 0), 1.0F) - .alwaysEdible() - .build(); + public static final FoodProperties DRIED_KELP = new FoodProperties.Builder().nutrition(1).saturationModifier(0.3F).build(); + public static final FoodProperties ENCHANTED_GOLDEN_APPLE = new FoodProperties.Builder().nutrition(4).saturationModifier(1.2F).alwaysEdible().build(); + public static final FoodProperties GOLDEN_APPLE = new FoodProperties.Builder().nutrition(4).saturationModifier(1.2F).alwaysEdible().build(); public static final FoodProperties GOLDEN_CARROT = new FoodProperties.Builder().nutrition(6).saturationModifier(1.2F).build(); - public static final FoodProperties HONEY_BOTTLE = new FoodProperties.Builder().nutrition(6).saturationModifier(0.1F).build(); + public static final FoodProperties HONEY_BOTTLE = new FoodProperties.Builder().nutrition(6).saturationModifier(0.1F).alwaysEdible().build(); public static final FoodProperties MELON_SLICE = new FoodProperties.Builder().nutrition(2).saturationModifier(0.3F).build(); public static final FoodProperties MUSHROOM_STEW = stew(6).build(); public static final FoodProperties MUTTON = new FoodProperties.Builder().nutrition(2).saturationModifier(0.3F).build(); - public static final FoodProperties POISONOUS_POTATO = new FoodProperties.Builder() - .nutrition(2) - .saturationModifier(0.3F) - .effect(new MobEffectInstance(MobEffects.POISON, 100, 0), 0.6F) - .build(); + public static final FoodProperties POISONOUS_POTATO = new FoodProperties.Builder().nutrition(2).saturationModifier(0.3F).build(); public static final FoodProperties PORKCHOP = new FoodProperties.Builder().nutrition(3).saturationModifier(0.3F).build(); public static final FoodProperties POTATO = new FoodProperties.Builder().nutrition(1).saturationModifier(0.3F).build(); - public static final FoodProperties PUFFERFISH = new FoodProperties.Builder() - .nutrition(1) - .saturationModifier(0.1F) - .effect(new MobEffectInstance(MobEffects.POISON, 1200, 1), 1.0F) - .effect(new MobEffectInstance(MobEffects.HUNGER, 300, 2), 1.0F) - .effect(new MobEffectInstance(MobEffects.CONFUSION, 300, 0), 1.0F) - .build(); + public static final FoodProperties PUFFERFISH = new FoodProperties.Builder().nutrition(1).saturationModifier(0.1F).build(); public static final FoodProperties PUMPKIN_PIE = new FoodProperties.Builder().nutrition(8).saturationModifier(0.3F).build(); public static final FoodProperties RABBIT = new FoodProperties.Builder().nutrition(3).saturationModifier(0.3F).build(); public static final FoodProperties RABBIT_STEW = stew(10).build(); - public static final FoodProperties ROTTEN_FLESH = new FoodProperties.Builder() - .nutrition(4) - .saturationModifier(0.1F) - .effect(new MobEffectInstance(MobEffects.HUNGER, 600, 0), 0.8F) - .build(); + public static final FoodProperties ROTTEN_FLESH = new FoodProperties.Builder().nutrition(4).saturationModifier(0.1F).build(); public static final FoodProperties SALMON = new FoodProperties.Builder().nutrition(2).saturationModifier(0.1F).build(); - public static final FoodProperties SPIDER_EYE = new FoodProperties.Builder() - .nutrition(2) - .saturationModifier(0.8F) - .effect(new MobEffectInstance(MobEffects.POISON, 100, 0), 1.0F) - .build(); + public static final FoodProperties SPIDER_EYE = new FoodProperties.Builder().nutrition(2).saturationModifier(0.8F).build(); public static final FoodProperties SUSPICIOUS_STEW = stew(6).alwaysEdible().build(); public static final FoodProperties SWEET_BERRIES = new FoodProperties.Builder().nutrition(2).saturationModifier(0.1F).build(); public static final FoodProperties GLOW_BERRIES = new FoodProperties.Builder().nutrition(2).saturationModifier(0.1F).build(); public static final FoodProperties TROPICAL_FISH = new FoodProperties.Builder().nutrition(1).saturationModifier(0.1F).build(); - public static final FoodProperties OMINOUS_BOTTLE = new FoodProperties.Builder().nutrition(1).saturationModifier(0.1F).build(); private static FoodProperties.Builder stew(int nutrition) { - return new FoodProperties.Builder().nutrition(nutrition).saturationModifier(0.6F).usingConvertsTo(Items.BOWL); + return new FoodProperties.Builder().nutrition(nutrition).saturationModifier(0.6F); } } diff --git a/net/minecraft/world/inventory/AbstractContainerMenu.java b/net/minecraft/world/inventory/AbstractContainerMenu.java index 9734c348..37f79704 100644 --- a/net/minecraft/world/inventory/AbstractContainerMenu.java +++ b/net/minecraft/world/inventory/AbstractContainerMenu.java @@ -22,10 +22,12 @@ import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.server.level.ServerPlayer; import net.minecraft.util.Mth; import net.minecraft.world.Container; +import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.SlotAccess; import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.entity.player.Player; import net.minecraft.world.flag.FeatureFlagSet; +import net.minecraft.world.item.BundleItem; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.entity.BlockEntity; @@ -42,6 +44,8 @@ public abstract class AbstractContainerMenu { public static final int QUICKCRAFT_HEADER_CONTINUE = 1; public static final int QUICKCRAFT_HEADER_END = 2; public static final int CARRIED_SLOT_SIZE = Integer.MAX_VALUE; + public static final int SLOTS_PER_ROW = 9; + public static final int SLOT_SIZE = 18; private final NonNullList lastSlots = NonNullList.create(); public final NonNullList slots = NonNullList.create(); private final List dataSlots = Lists.newArrayList(); @@ -66,6 +70,27 @@ public abstract class AbstractContainerMenu { this.containerId = containerId; } + protected void addInventoryHotbarSlots(Container container, int i, int j) { + for (int k = 0; k < 9; k++) { + this.addSlot(new Slot(container, k, i + k * 18, j)); + } + } + + protected void addInventoryExtendedSlots(Container container, int i, int j) { + for (int k = 0; k < 3; k++) { + for (int l = 0; l < 9; l++) { + this.addSlot(new Slot(container, l + (k + 1) * 9, i + l * 18, j + k * 18)); + } + } + } + + protected void addStandardInventorySlots(Container container, int i, int j) { + this.addInventoryExtendedSlots(container, i, j); + int k = 4; + int l = 58; + this.addInventoryHotbarSlots(container, i, j + 58); + } + protected static boolean stillValid(ContainerLevelAccess access, Player player, Block targetBlock) { return access.evaluate((level, blockPos) -> !level.getBlockState(blockPos).is(targetBlock) ? false : player.canInteractWithBlock(blockPos, 4.0), true); } @@ -296,6 +321,13 @@ public abstract class AbstractContainerMenu { */ public abstract ItemStack quickMoveStack(Player player, int index); + public void setSelectedBundleItemIndex(int i, int j) { + if (i >= 0 && i < this.slots.size()) { + ItemStack itemStack = this.slots.get(i).getItem(); + BundleItem.toggleSelectedItem(itemStack, j); + } + } + public void clicked(int slotId, int button, ClickType clickType, Player player) { try { this.doClick(slotId, button, clickType, player); @@ -497,12 +529,28 @@ public abstract class AbstractContainerMenu { } else if (clickType == ClickType.THROW && this.getCarried().isEmpty() && slotId >= 0) { Slot slot3 = this.slots.get(slotId); int j = button == 0 ? 1 : slot3.getItem().getCount(); + if (!player.canDropItems()) { + return; + } + ItemStack itemStack = slot3.safeTake(j, Integer.MAX_VALUE, player); player.drop(itemStack, true); + player.handleCreativeModeItemDrop(itemStack); + if (button == 1) { + while (!itemStack.isEmpty() && ItemStack.isSameItem(slot3.getItem(), itemStack)) { + if (!player.canDropItems()) { + return; + } + + itemStack = slot3.safeTake(j, Integer.MAX_VALUE, player); + player.drop(itemStack, true); + player.handleCreativeModeItemDrop(itemStack); + } + } } else if (clickType == ClickType.PICKUP_ALL && slotId >= 0) { - Slot slot3 = this.slots.get(slotId); + Slot slot3x = this.slots.get(slotId); ItemStack itemStack2 = this.getCarried(); - if (!itemStack2.isEmpty() && (!slot3.hasItem() || !slot3.mayPickup(player))) { + if (!itemStack2.isEmpty() && (!slot3x.hasItem() || !slot3x.mayPickup(player))) { int k = button == 0 ? 0 : this.slots.size() - 1; int p = button == 0 ? 1 : -1; @@ -558,29 +606,25 @@ public abstract class AbstractContainerMenu { if (player instanceof ServerPlayer) { ItemStack itemStack = this.getCarried(); if (!itemStack.isEmpty()) { - if (player.isAlive() && !((ServerPlayer)player).hasDisconnected()) { - player.getInventory().placeItemBackInInventory(itemStack); - } else { - player.drop(itemStack, false); - } - + dropOrPlaceInInventory(player, itemStack); this.setCarried(ItemStack.EMPTY); } } } + private static void dropOrPlaceInInventory(Player player, ItemStack itemStack) { + boolean bl = player.isRemoved() && player.getRemovalReason() != Entity.RemovalReason.CHANGED_DIMENSION; + boolean bl2 = player instanceof ServerPlayer serverPlayer && serverPlayer.hasDisconnected(); + if (bl || bl2) { + player.drop(itemStack, false); + } else if (player instanceof ServerPlayer) { + player.getInventory().placeItemBackInInventory(itemStack); + } + } + protected void clearContainer(Player player, Container container) { - if (!player.isAlive() || player instanceof ServerPlayer && ((ServerPlayer)player).hasDisconnected()) { - for (int i = 0; i < container.getContainerSize(); i++) { - player.drop(container.removeItemNoUpdate(i), false); - } - } else { - for (int i = 0; i < container.getContainerSize(); i++) { - Inventory inventory = player.getInventory(); - if (inventory.player instanceof ServerPlayer) { - inventory.placeItemBackInInventory(container.removeItemNoUpdate(i)); - } - } + for (int i = 0; i < container.getContainerSize(); i++) { + dropOrPlaceInInventory(player, container.removeItemNoUpdate(i)); } } diff --git a/net/minecraft/world/inventory/AbstractCraftingMenu.java b/net/minecraft/world/inventory/AbstractCraftingMenu.java new file mode 100644 index 00000000..6397719d --- /dev/null +++ b/net/minecraft/world/inventory/AbstractCraftingMenu.java @@ -0,0 +1,93 @@ +package net.minecraft.world.inventory; + +import java.util.List; +import net.minecraft.recipebook.ServerPlaceRecipe; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.entity.player.StackedItemContents; +import net.minecraft.world.item.crafting.CraftingRecipe; +import net.minecraft.world.item.crafting.RecipeHolder; + +public abstract class AbstractCraftingMenu extends RecipeBookMenu { + private final int width; + private final int height; + protected final CraftingContainer craftSlots; + protected final ResultContainer resultSlots = new ResultContainer(); + + public AbstractCraftingMenu(MenuType menuType, int i, int j, int k) { + super(menuType, i); + this.width = j; + this.height = k; + this.craftSlots = new TransientCraftingContainer(this, j, k); + } + + protected Slot addResultSlot(Player player, int i, int j) { + return this.addSlot(new ResultSlot(player, this.craftSlots, this.resultSlots, 0, i, j)); + } + + protected void addCraftingGridSlots(int i, int j) { + for (int k = 0; k < this.width; k++) { + for (int l = 0; l < this.height; l++) { + this.addSlot(new Slot(this.craftSlots, l + k * this.width, i + l * 18, j + k * 18)); + } + } + } + + @Override + public RecipeBookMenu.PostPlaceAction handlePlacement(boolean bl, boolean bl2, RecipeHolder recipeHolder, ServerLevel serverLevel, Inventory inventory) { + RecipeHolder recipeHolder2 = (RecipeHolder)recipeHolder; + this.beginPlacingRecipe(); + + RecipeBookMenu.PostPlaceAction var8; + try { + List list = this.getInputGridSlots(); + var8 = ServerPlaceRecipe.placeRecipe(new ServerPlaceRecipe.CraftingMenuAccess() { + @Override + public void fillCraftSlotsStackedContents(StackedItemContents stackedItemContents) { + AbstractCraftingMenu.this.fillCraftSlotsStackedContents(stackedItemContents); + } + + @Override + public void clearCraftingContent() { + AbstractCraftingMenu.this.resultSlots.clearContent(); + AbstractCraftingMenu.this.craftSlots.clearContent(); + } + + @Override + public boolean recipeMatches(RecipeHolder recipeHolder) { + return recipeHolder.value().matches(AbstractCraftingMenu.this.craftSlots.asCraftInput(), AbstractCraftingMenu.this.owner().level()); + } + }, this.width, this.height, list, list, inventory, recipeHolder2, bl, bl2); + } finally { + this.finishPlacingRecipe(serverLevel, (RecipeHolder)recipeHolder); + } + + return var8; + } + + protected void beginPlacingRecipe() { + } + + protected void finishPlacingRecipe(ServerLevel serverLevel, RecipeHolder recipeHolder) { + } + + public abstract Slot getResultSlot(); + + public abstract List getInputGridSlots(); + + public int getGridWidth() { + return this.width; + } + + public int getGridHeight() { + return this.height; + } + + protected abstract Player owner(); + + @Override + public void fillCraftSlotsStackedContents(StackedItemContents stackedItemContents) { + this.craftSlots.fillStackedContents(stackedItemContents); + } +} diff --git a/net/minecraft/world/inventory/AbstractFurnaceMenu.java b/net/minecraft/world/inventory/AbstractFurnaceMenu.java index 22673d45..e827625d 100644 --- a/net/minecraft/world/inventory/AbstractFurnaceMenu.java +++ b/net/minecraft/world/inventory/AbstractFurnaceMenu.java @@ -1,20 +1,24 @@ package net.minecraft.world.inventory; +import java.util.List; +import net.minecraft.recipebook.ServerPlaceRecipe; +import net.minecraft.resources.ResourceKey; +import net.minecraft.server.level.ServerLevel; import net.minecraft.util.Mth; import net.minecraft.world.Container; import net.minecraft.world.SimpleContainer; import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.entity.player.Player; -import net.minecraft.world.entity.player.StackedContents; +import net.minecraft.world.entity.player.StackedItemContents; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.crafting.AbstractCookingRecipe; import net.minecraft.world.item.crafting.RecipeHolder; +import net.minecraft.world.item.crafting.RecipePropertySet; import net.minecraft.world.item.crafting.RecipeType; import net.minecraft.world.item.crafting.SingleRecipeInput; import net.minecraft.world.level.Level; -import net.minecraft.world.level.block.entity.AbstractFurnaceBlockEntity; -public abstract class AbstractFurnaceMenu extends RecipeBookMenu { +public abstract class AbstractFurnaceMenu extends RecipeBookMenu { public static final int INGREDIENT_SLOT = 0; public static final int FUEL_SLOT = 1; public static final int RESULT_SLOT = 2; @@ -24,88 +28,59 @@ public abstract class AbstractFurnaceMenu extends RecipeBookMenu recipeType; + private final RecipePropertySet acceptedInputs; private final RecipeBookType recipeBookType; protected AbstractFurnaceMenu( - MenuType menuType, RecipeType recipeType, RecipeBookType recipeBookType, int containerId, Inventory playerInventory + MenuType menuType, + RecipeType recipeType, + ResourceKey resourceKey, + RecipeBookType recipeBookType, + int i, + Inventory inventory ) { - this(menuType, recipeType, recipeBookType, containerId, playerInventory, new SimpleContainer(3), new SimpleContainerData(4)); + this(menuType, recipeType, resourceKey, recipeBookType, i, inventory, new SimpleContainer(3), new SimpleContainerData(4)); } protected AbstractFurnaceMenu( MenuType menuType, RecipeType recipeType, + ResourceKey resourceKey, RecipeBookType recipeBookType, - int containerId, - Inventory playerInventory, + int i, + Inventory inventory, Container container, - ContainerData data + ContainerData containerData ) { - super(menuType, containerId); + super(menuType, i); this.recipeType = recipeType; this.recipeBookType = recipeBookType; checkContainerSize(container, 3); - checkContainerDataCount(data, 4); + checkContainerDataCount(containerData, 4); this.container = container; - this.data = data; - this.level = playerInventory.player.level(); + this.data = containerData; + this.level = inventory.player.level(); + this.acceptedInputs = this.level.recipeAccess().propertySet(resourceKey); this.addSlot(new Slot(container, 0, 56, 17)); this.addSlot(new FurnaceFuelSlot(this, container, 1, 56, 53)); - this.addSlot(new FurnaceResultSlot(playerInventory.player, container, 2, 116, 35)); - - for (int i = 0; i < 3; i++) { - for (int j = 0; j < 9; j++) { - this.addSlot(new Slot(playerInventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18)); - } - } - - for (int i = 0; i < 9; i++) { - this.addSlot(new Slot(playerInventory, i, 8 + i * 18, 142)); - } - - this.addDataSlots(data); + this.addSlot(new FurnaceResultSlot(inventory.player, container, 2, 116, 35)); + this.addStandardInventorySlots(inventory, 8, 84); + this.addDataSlots(containerData); } @Override - public void fillCraftSlotsStackedContents(StackedContents itemHelper) { + public void fillCraftSlotsStackedContents(StackedItemContents stackedItemContents) { if (this.container instanceof StackedContentsCompatible) { - ((StackedContentsCompatible)this.container).fillStackedContents(itemHelper); + ((StackedContentsCompatible)this.container).fillStackedContents(stackedItemContents); } } - @Override - public void clearCraftingContent() { - this.getSlot(0).set(ItemStack.EMPTY); - this.getSlot(2).set(ItemStack.EMPTY); - } - - @Override - public boolean recipeMatches(RecipeHolder recipe) { - return recipe.value().matches(new SingleRecipeInput(this.container.getItem(0)), this.level); - } - - @Override - public int getResultSlotIndex() { - return 2; - } - - @Override - public int getGridWidth() { - return 1; - } - - @Override - public int getGridHeight() { - return 1; - } - - @Override - public int getSize() { - return 3; + public Slot getResultSlot() { + return this.slots.get(2); } @Override @@ -163,11 +138,11 @@ public abstract class AbstractFurnaceMenu extends RecipeBookMenu recipeHolder, ServerLevel serverLevel, Inventory inventory) { + final List list = List.of(this.getSlot(0), this.getSlot(2)); + return ServerPlaceRecipe.placeRecipe(new ServerPlaceRecipe.CraftingMenuAccess() { + @Override + public void fillCraftSlotsStackedContents(StackedItemContents stackedItemContents) { + AbstractFurnaceMenu.this.fillCraftSlotsStackedContents(stackedItemContents); + } + + @Override + public void clearCraftingContent() { + list.forEach(slot -> slot.set(ItemStack.EMPTY)); + } + + @Override + public boolean recipeMatches(RecipeHolder recipeHolder) { + return recipeHolder.value().matches(new SingleRecipeInput(AbstractFurnaceMenu.this.container.getItem(0)), serverLevel); + } + }, 1, 1, List.of(this.getSlot(0)), list, inventory, (RecipeHolder)recipeHolder, bl, bl2); } } diff --git a/net/minecraft/world/inventory/AnvilMenu.java b/net/minecraft/world/inventory/AnvilMenu.java index d7cc8093..9c9f0bd4 100644 --- a/net/minecraft/world/inventory/AnvilMenu.java +++ b/net/minecraft/world/inventory/AnvilMenu.java @@ -31,6 +31,7 @@ public class AnvilMenu extends ItemCombinerMenu { @Nullable private String itemName; private final DataSlot cost = DataSlot.standalone(); + private boolean onlyRenaming = false; private static final int COST_FAIL = 0; private static final int COST_BASE = 1; private static final int COST_ADDED_BASE = 1; @@ -48,12 +49,11 @@ public class AnvilMenu extends ItemCombinerMenu { } public AnvilMenu(int containerId, Inventory playerInventory, ContainerLevelAccess access) { - super(MenuType.ANVIL, containerId, playerInventory, access); + super(MenuType.ANVIL, containerId, playerInventory, access, createInputSlotDefinitions()); this.addDataSlot(this.cost); } - @Override - protected ItemCombinerMenuSlotDefinition createInputSlotDefinitions() { + private static ItemCombinerMenuSlotDefinition createInputSlotDefinitions() { return ItemCombinerMenuSlotDefinition.create() .withSlot(0, 27, 47, itemStack -> true) .withSlot(1, 76, 47, itemStack -> true) @@ -77,7 +77,6 @@ public class AnvilMenu extends ItemCombinerMenu { player.giveExperienceLevels(-this.cost.get()); } - this.inputSlots.setItem(0, ItemStack.EMPTY); if (this.repairItemCountCost > 0) { ItemStack itemStack = this.inputSlots.getItem(1); if (!itemStack.isEmpty() && itemStack.getCount() > this.repairItemCountCost) { @@ -86,11 +85,12 @@ public class AnvilMenu extends ItemCombinerMenu { } else { this.inputSlots.setItem(1, ItemStack.EMPTY); } - } else { + } else if (!this.onlyRenaming) { this.inputSlots.setItem(1, ItemStack.EMPTY); } this.cost.set(0); + this.inputSlots.setItem(0, ItemStack.EMPTY); this.access.execute((level, blockPos) -> { BlockState blockState = level.getBlockState(blockPos); if (!player.hasInfiniteMaterials() && blockState.is(BlockTags.ANVIL) && player.getRandom().nextFloat() < 0.12F) { @@ -111,6 +111,7 @@ public class AnvilMenu extends ItemCombinerMenu { @Override public void createResult() { ItemStack itemStack = this.inputSlots.getItem(0); + this.onlyRenaming = false; this.cost.set(1); int i = 0; long l = 0L; @@ -123,7 +124,7 @@ public class AnvilMenu extends ItemCombinerMenu { this.repairItemCountCost = 0; if (!itemStack3.isEmpty()) { boolean bl = itemStack3.has(DataComponents.STORED_ENCHANTMENTS); - if (itemStack2.isDamageableItem() && itemStack2.getItem().isValidRepairItem(itemStack, itemStack3)) { + if (itemStack2.isDamageableItem() && itemStack.isValidRepairItem(itemStack3)) { int k = Math.min(itemStack2.getDamageValue(), itemStack2.getMaxDamage() / 4); if (k <= 0) { this.resultSlots.setItem(0, ItemStack.EMPTY); @@ -226,14 +227,18 @@ public class AnvilMenu extends ItemCombinerMenu { itemStack2.remove(DataComponents.CUSTOM_NAME); } - int t = (int)Mth.clamp(l + i, 0L, 2147483647L); + int t = i <= 0 ? 0 : (int)Mth.clamp(l + i, 0L, 2147483647L); this.cost.set(t); if (i <= 0) { itemStack2 = ItemStack.EMPTY; } - if (j == i && j > 0 && this.cost.get() >= 40) { - this.cost.set(39); + if (j == i && j > 0) { + if (this.cost.get() >= 40) { + this.cost.set(39); + } + + this.onlyRenaming = true; } if (this.cost.get() >= 40 && !this.player.getAbilities().instabuild) { diff --git a/net/minecraft/world/inventory/BeaconMenu.java b/net/minecraft/world/inventory/BeaconMenu.java index 6baa8451..98bc7617 100644 --- a/net/minecraft/world/inventory/BeaconMenu.java +++ b/net/minecraft/world/inventory/BeaconMenu.java @@ -49,18 +49,7 @@ public class BeaconMenu extends AbstractContainerMenu { this.paymentSlot = new BeaconMenu.PaymentSlot(this.beacon, 0, 136, 110); this.addSlot(this.paymentSlot); this.addDataSlots(beaconData); - int i = 36; - int j = 137; - - for (int k = 0; k < 3; k++) { - for (int l = 0; l < 9; l++) { - this.addSlot(new Slot(container, l + k * 9 + 9, 36 + l * 18, 137 + k * 18)); - } - } - - for (int k = 0; k < 9; k++) { - this.addSlot(new Slot(container, k, 36 + k * 18, 195)); - } + this.addStandardInventorySlots(container, 36, 137); } @Override diff --git a/net/minecraft/world/inventory/BlastFurnaceMenu.java b/net/minecraft/world/inventory/BlastFurnaceMenu.java index 16abc216..e452e2b5 100644 --- a/net/minecraft/world/inventory/BlastFurnaceMenu.java +++ b/net/minecraft/world/inventory/BlastFurnaceMenu.java @@ -2,14 +2,24 @@ package net.minecraft.world.inventory; import net.minecraft.world.Container; import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.item.crafting.RecipePropertySet; import net.minecraft.world.item.crafting.RecipeType; public class BlastFurnaceMenu extends AbstractFurnaceMenu { public BlastFurnaceMenu(int containerId, Inventory playerInventory) { - super(MenuType.BLAST_FURNACE, RecipeType.BLASTING, RecipeBookType.BLAST_FURNACE, containerId, playerInventory); + super(MenuType.BLAST_FURNACE, RecipeType.BLASTING, RecipePropertySet.BLAST_FURNACE_INPUT, RecipeBookType.BLAST_FURNACE, containerId, playerInventory); } public BlastFurnaceMenu(int containerId, Inventory playerInventory, Container blastFurnaceContainer, ContainerData blastFurnaceData) { - super(MenuType.BLAST_FURNACE, RecipeType.BLASTING, RecipeBookType.BLAST_FURNACE, containerId, playerInventory, blastFurnaceContainer, blastFurnaceData); + super( + MenuType.BLAST_FURNACE, + RecipeType.BLASTING, + RecipePropertySet.BLAST_FURNACE_INPUT, + RecipeBookType.BLAST_FURNACE, + containerId, + playerInventory, + blastFurnaceContainer, + blastFurnaceData + ); } } diff --git a/net/minecraft/world/inventory/BrewingStandMenu.java b/net/minecraft/world/inventory/BrewingStandMenu.java index 3217bb3d..047a5f64 100644 --- a/net/minecraft/world/inventory/BrewingStandMenu.java +++ b/net/minecraft/world/inventory/BrewingStandMenu.java @@ -5,6 +5,7 @@ import net.minecraft.advancements.CriteriaTriggers; import net.minecraft.core.Holder; import net.minecraft.core.component.DataComponents; import net.minecraft.server.level.ServerPlayer; +import net.minecraft.tags.ItemTags; import net.minecraft.world.Container; import net.minecraft.world.SimpleContainer; import net.minecraft.world.entity.player.Inventory; @@ -47,16 +48,7 @@ public class BrewingStandMenu extends AbstractContainerMenu { this.ingredientSlot = this.addSlot(new BrewingStandMenu.IngredientsSlot(potionBrewing, brewingStandContainer, 3, 79, 17)); this.addSlot(new BrewingStandMenu.FuelSlot(brewingStandContainer, 4, 17, 17)); this.addDataSlots(brewingStandData); - - for (int i = 0; i < 3; i++) { - for (int j = 0; j < 9; j++) { - this.addSlot(new Slot(playerInventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18)); - } - } - - for (int i = 0; i < 9; i++) { - this.addSlot(new Slot(playerInventory, i, 8 + i * 18, 142)); - } + this.addStandardInventorySlots(playerInventory, 8, 84); } @Override @@ -141,7 +133,7 @@ public class BrewingStandMenu extends AbstractContainerMenu { * Returns {@code true} if the given {@link net.minecraft.world.item.ItemStack} is usable as fuel in the brewing stand. */ public static boolean mayPlaceItem(ItemStack itemStack) { - return itemStack.is(Items.BLAZE_POWDER); + return itemStack.is(ItemTags.BREWING_FUEL); } } diff --git a/net/minecraft/world/inventory/CartographyTableMenu.java b/net/minecraft/world/inventory/CartographyTableMenu.java index 26278e08..92f0b235 100644 --- a/net/minecraft/world/inventory/CartographyTableMenu.java +++ b/net/minecraft/world/inventory/CartographyTableMenu.java @@ -49,7 +49,7 @@ public class CartographyTableMenu extends AbstractContainerMenu { this.addSlot(new Slot(this.container, 0, 15, 15) { @Override public boolean mayPlace(ItemStack stack) { - return stack.is(Items.FILLED_MAP); + return stack.has(DataComponents.MAP_ID); } }); this.addSlot(new Slot(this.container, 1, 15, 52) { @@ -79,16 +79,7 @@ public class CartographyTableMenu extends AbstractContainerMenu { super.onTake(player, stack); } }); - - for (int i = 0; i < 3; i++) { - for (int j = 0; j < 9; j++) { - this.addSlot(new Slot(playerInventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18)); - } - } - - for (int i = 0; i < 9; i++) { - this.addSlot(new Slot(playerInventory, i, 8 + i * 18, 142)); - } + this.addStandardInventorySlots(playerInventory, 8, 84); } @Override @@ -162,7 +153,7 @@ public class CartographyTableMenu extends AbstractContainerMenu { slot.onQuickCraft(itemStack2, itemStack); } else if (index != 1 && index != 0) { - if (itemStack2.is(Items.FILLED_MAP)) { + if (itemStack2.has(DataComponents.MAP_ID)) { if (!this.moveItemStackTo(itemStack2, 0, 1, false)) { return ItemStack.EMPTY; } diff --git a/net/minecraft/world/inventory/ChestMenu.java b/net/minecraft/world/inventory/ChestMenu.java index 2dbf49e1..2ffce967 100644 --- a/net/minecraft/world/inventory/ChestMenu.java +++ b/net/minecraft/world/inventory/ChestMenu.java @@ -7,7 +7,6 @@ import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; public class ChestMenu extends AbstractContainerMenu { - private static final int SLOTS_PER_ROW = 9; private final Container container; private final int containerRows; @@ -53,23 +52,18 @@ public class ChestMenu extends AbstractContainerMenu { this.container = container; this.containerRows = rows; container.startOpen(playerInventory.player); - int i = (this.containerRows - 4) * 18; + int i = 18; + this.addChestGrid(container, 8, 18); + int j = 18 + this.containerRows * 18 + 13; + this.addStandardInventorySlots(playerInventory, 8, j); + } - for (int j = 0; j < this.containerRows; j++) { - for (int k = 0; k < 9; k++) { - this.addSlot(new Slot(container, k + j * 9, 8 + k * 18, 18 + j * 18)); + private void addChestGrid(Container container, int i, int j) { + for (int k = 0; k < this.containerRows; k++) { + for (int l = 0; l < 9; l++) { + this.addSlot(new Slot(container, l + k * 9, i + l * 18, j + k * 18)); } } - - for (int j = 0; j < 3; j++) { - for (int k = 0; k < 9; k++) { - this.addSlot(new Slot(playerInventory, k + j * 9 + 9, 8 + k * 18, 103 + j * 18 + i)); - } - } - - for (int j = 0; j < 9; j++) { - this.addSlot(new Slot(playerInventory, j, 8 + j * 18, 161 + i)); - } } @Override diff --git a/net/minecraft/world/inventory/CrafterMenu.java b/net/minecraft/world/inventory/CrafterMenu.java index 90570c82..fbfb9add 100644 --- a/net/minecraft/world/inventory/CrafterMenu.java +++ b/net/minecraft/world/inventory/CrafterMenu.java @@ -1,5 +1,6 @@ package net.minecraft.world.inventory; +import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.Container; import net.minecraft.world.entity.player.Inventory; @@ -7,7 +8,6 @@ import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.crafting.CraftingInput; import net.minecraft.world.item.crafting.CraftingRecipe; -import net.minecraft.world.level.Level; import net.minecraft.world.level.block.CrafterBlock; public class CrafterMenu extends AbstractContainerMenu implements ContainerListener { @@ -48,16 +48,7 @@ public class CrafterMenu extends AbstractContainerMenu implements ContainerListe } } - for (int i = 0; i < 3; i++) { - for (int j = 0; j < 9; j++) { - this.addSlot(new Slot(playerInventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18)); - } - } - - for (int i = 0; i < 9; i++) { - this.addSlot(new Slot(playerInventory, i, 8 + i * 18, 142)); - } - + this.addStandardInventorySlots(playerInventory, 8, 84); this.addSlot(new NonInteractiveResultSlot(this.resultContainer, 0, 134, 35)); this.addDataSlots(this.containerData); this.refreshRecipeResult(); @@ -115,10 +106,10 @@ public class CrafterMenu extends AbstractContainerMenu implements ContainerListe private void refreshRecipeResult() { if (this.player instanceof ServerPlayer serverPlayer) { - Level level = serverPlayer.level(); + ServerLevel serverLevel = serverPlayer.serverLevel(); CraftingInput craftingInput = this.container.asCraftInput(); - ItemStack itemStack = (ItemStack)CrafterBlock.getPotentialResults(level, craftingInput) - .map(recipeHolder -> ((CraftingRecipe)recipeHolder.value()).assemble(craftingInput, level.registryAccess())) + ItemStack itemStack = (ItemStack)CrafterBlock.getPotentialResults(serverLevel, craftingInput) + .map(recipeHolder -> ((CraftingRecipe)recipeHolder.value()).assemble(craftingInput, serverLevel.registryAccess())) .orElse(ItemStack.EMPTY); this.resultContainer.setItem(0, itemStack); } diff --git a/net/minecraft/world/inventory/CraftingMenu.java b/net/minecraft/world/inventory/CraftingMenu.java index a38165a4..a82c0025 100644 --- a/net/minecraft/world/inventory/CraftingMenu.java +++ b/net/minecraft/world/inventory/CraftingMenu.java @@ -1,31 +1,32 @@ package net.minecraft.world.inventory; +import java.util.List; import java.util.Optional; import net.minecraft.network.protocol.game.ClientboundContainerSetSlotPacket; +import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.Container; import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.entity.player.Player; -import net.minecraft.world.entity.player.StackedContents; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.crafting.CraftingInput; import net.minecraft.world.item.crafting.CraftingRecipe; import net.minecraft.world.item.crafting.RecipeHolder; import net.minecraft.world.item.crafting.RecipeType; -import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Blocks; import org.jetbrains.annotations.Nullable; -public class CraftingMenu extends RecipeBookMenu { +public class CraftingMenu extends AbstractCraftingMenu { + private static final int CRAFTING_GRID_WIDTH = 3; + private static final int CRAFTING_GRID_HEIGHT = 3; public static final int RESULT_SLOT = 0; private static final int CRAFT_SLOT_START = 1; + private static final int CRAFT_SLOT_COUNT = 9; private static final int CRAFT_SLOT_END = 10; private static final int INV_SLOT_START = 10; private static final int INV_SLOT_END = 37; private static final int USE_ROW_SLOT_START = 37; private static final int USE_ROW_SLOT_END = 46; - private final CraftingContainer craftSlots = new TransientCraftingContainer(this, 3, 3); - private final ResultContainer resultSlots = new ResultContainer(); private final ContainerLevelAccess access; private final Player player; private boolean placingRecipe; @@ -35,62 +36,53 @@ public class CraftingMenu extends RecipeBookMenu } public CraftingMenu(int containerId, Inventory playerInventory, ContainerLevelAccess access) { - super(MenuType.CRAFTING, containerId); + super(MenuType.CRAFTING, containerId, 3, 3); this.access = access; this.player = playerInventory.player; - this.addSlot(new ResultSlot(playerInventory.player, this.craftSlots, this.resultSlots, 0, 124, 35)); - - for (int i = 0; i < 3; i++) { - for (int j = 0; j < 3; j++) { - this.addSlot(new Slot(this.craftSlots, j + i * 3, 30 + j * 18, 17 + i * 18)); - } - } - - for (int i = 0; i < 3; i++) { - for (int j = 0; j < 9; j++) { - this.addSlot(new Slot(playerInventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18)); - } - } - - for (int i = 0; i < 9; i++) { - this.addSlot(new Slot(playerInventory, i, 8 + i * 18, 142)); - } + this.addResultSlot(this.player, 124, 35); + this.addCraftingGridSlots(30, 17); + this.addStandardInventorySlots(playerInventory, 8, 84); } protected static void slotChangedCraftingGrid( - AbstractContainerMenu menu, - Level level, + AbstractContainerMenu abstractContainerMenu, + ServerLevel serverLevel, Player player, - CraftingContainer craftSlots, - ResultContainer resultSlots, - @Nullable RecipeHolder recipe + CraftingContainer craftingContainer, + ResultContainer resultContainer, + @Nullable RecipeHolder recipeHolder ) { - if (!level.isClientSide) { - CraftingInput craftingInput = craftSlots.asCraftInput(); - ServerPlayer serverPlayer = (ServerPlayer)player; - ItemStack itemStack = ItemStack.EMPTY; - Optional> optional = level.getServer().getRecipeManager().getRecipeFor(RecipeType.CRAFTING, craftingInput, level, recipe); - if (optional.isPresent()) { - RecipeHolder recipeHolder = (RecipeHolder)optional.get(); - CraftingRecipe craftingRecipe = recipeHolder.value(); - if (resultSlots.setRecipeUsed(level, serverPlayer, recipeHolder)) { - ItemStack itemStack2 = craftingRecipe.assemble(craftingInput, level.registryAccess()); - if (itemStack2.isItemEnabled(level.enabledFeatures())) { - itemStack = itemStack2; - } + CraftingInput craftingInput = craftingContainer.asCraftInput(); + ServerPlayer serverPlayer = (ServerPlayer)player; + ItemStack itemStack = ItemStack.EMPTY; + Optional> optional = serverLevel.getServer() + .getRecipeManager() + .getRecipeFor(RecipeType.CRAFTING, craftingInput, serverLevel, recipeHolder); + if (optional.isPresent()) { + RecipeHolder recipeHolder2 = (RecipeHolder)optional.get(); + CraftingRecipe craftingRecipe = recipeHolder2.value(); + if (resultContainer.setRecipeUsed(serverPlayer, recipeHolder2)) { + ItemStack itemStack2 = craftingRecipe.assemble(craftingInput, serverLevel.registryAccess()); + if (itemStack2.isItemEnabled(serverLevel.enabledFeatures())) { + itemStack = itemStack2; } } - - resultSlots.setItem(0, itemStack); - menu.setRemoteSlot(0, itemStack); - serverPlayer.connection.send(new ClientboundContainerSetSlotPacket(menu.containerId, menu.incrementStateId(), 0, itemStack)); } + + resultContainer.setItem(0, itemStack); + abstractContainerMenu.setRemoteSlot(0, itemStack); + serverPlayer.connection + .send(new ClientboundContainerSetSlotPacket(abstractContainerMenu.containerId, abstractContainerMenu.incrementStateId(), 0, itemStack)); } @Override public void slotsChanged(Container container) { if (!this.placingRecipe) { - this.access.execute((level, blockPos) -> slotChangedCraftingGrid(this, level, this.player, this.craftSlots, this.resultSlots, null)); + this.access.execute((level, blockPos) -> { + if (level instanceof ServerLevel serverLevel) { + slotChangedCraftingGrid(this, serverLevel, this.player, this.craftSlots, this.resultSlots, null); + } + }); } } @@ -100,25 +92,9 @@ public class CraftingMenu extends RecipeBookMenu } @Override - public void finishPlacingRecipe(RecipeHolder recipe) { + public void finishPlacingRecipe(ServerLevel serverLevel, RecipeHolder recipeHolder) { this.placingRecipe = false; - this.access.execute((level, blockPos) -> slotChangedCraftingGrid(this, level, this.player, this.craftSlots, this.resultSlots, recipe)); - } - - @Override - public void fillCraftSlotsStackedContents(StackedContents itemHelper) { - this.craftSlots.fillStackedContents(itemHelper); - } - - @Override - public void clearCraftingContent() { - this.craftSlots.clearContent(); - this.resultSlots.clearContent(); - } - - @Override - public boolean recipeMatches(RecipeHolder recipe) { - return recipe.value().matches(this.craftSlots.asCraftInput(), this.player.level()); + slotChangedCraftingGrid(this, serverLevel, this.player, this.craftSlots, this.resultSlots, recipeHolder); } @Override @@ -185,23 +161,13 @@ public class CraftingMenu extends RecipeBookMenu } @Override - public int getResultSlotIndex() { - return 0; + public Slot getResultSlot() { + return this.slots.get(0); } @Override - public int getGridWidth() { - return this.craftSlots.getWidth(); - } - - @Override - public int getGridHeight() { - return this.craftSlots.getHeight(); - } - - @Override - public int getSize() { - return 10; + public List getInputGridSlots() { + return this.slots.subList(1, 10); } @Override @@ -210,7 +176,7 @@ public class CraftingMenu extends RecipeBookMenu } @Override - public boolean shouldMoveToInventory(int slotIndex) { - return slotIndex != this.getResultSlotIndex(); + protected Player owner() { + return this.player; } } diff --git a/net/minecraft/world/inventory/DispenserMenu.java b/net/minecraft/world/inventory/DispenserMenu.java index 06104a95..8f88d3e3 100644 --- a/net/minecraft/world/inventory/DispenserMenu.java +++ b/net/minecraft/world/inventory/DispenserMenu.java @@ -23,22 +23,17 @@ public class DispenserMenu extends AbstractContainerMenu { checkContainerSize(container, 9); this.dispenser = container; container.startOpen(playerInventory.player); + this.add3x3GridSlots(container, 62, 17); + this.addStandardInventorySlots(playerInventory, 8, 84); + } - for (int i = 0; i < 3; i++) { - for (int j = 0; j < 3; j++) { - this.addSlot(new Slot(container, j + i * 3, 62 + j * 18, 17 + i * 18)); + protected void add3x3GridSlots(Container container, int i, int j) { + for (int k = 0; k < 3; k++) { + for (int l = 0; l < 3; l++) { + int m = l + k * 3; + this.addSlot(new Slot(container, m, i + l * 18, j + k * 18)); } } - - for (int i = 0; i < 3; i++) { - for (int j = 0; j < 9; j++) { - this.addSlot(new Slot(playerInventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18)); - } - } - - for (int i = 0; i < 9; i++) { - this.addSlot(new Slot(playerInventory, i, 8 + i * 18, 142)); - } } @Override diff --git a/net/minecraft/world/inventory/EnchantmentMenu.java b/net/minecraft/world/inventory/EnchantmentMenu.java index ff213dd8..5f2898c0 100644 --- a/net/minecraft/world/inventory/EnchantmentMenu.java +++ b/net/minecraft/world/inventory/EnchantmentMenu.java @@ -70,17 +70,7 @@ public class EnchantmentMenu extends AbstractContainerMenu { return Pair.of(InventoryMenu.BLOCK_ATLAS, EnchantmentMenu.EMPTY_SLOT_LAPIS_LAZULI); } }); - - for (int i = 0; i < 3; i++) { - for (int j = 0; j < 9; j++) { - this.addSlot(new Slot(playerInventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18)); - } - } - - for (int i = 0; i < 9; i++) { - this.addSlot(new Slot(playerInventory, i, 8 + i * 18, 142)); - } - + this.addStandardInventorySlots(playerInventory, 8, 84); this.addDataSlot(DataSlot.shared(this.costs, 0)); this.addDataSlot(DataSlot.shared(this.costs, 1)); this.addDataSlot(DataSlot.shared(this.costs, 2)); @@ -99,7 +89,7 @@ public class EnchantmentMenu extends AbstractContainerMenu { ItemStack itemStack = container.getItem(0); if (!itemStack.isEmpty() && itemStack.isEnchantable()) { this.access.execute((level, blockPos) -> { - IdMap> idMap = level.registryAccess().registryOrThrow(Registries.ENCHANTMENT).asHolderIdMap(); + IdMap> idMap = level.registryAccess().lookupOrThrow(Registries.ENCHANTMENT).asHolderIdMap(); int ix = 0; for (BlockPos blockPos2 : EnchantingTableBlock.BOOKSHELF_OFFSETS) { @@ -195,7 +185,7 @@ public class EnchantmentMenu extends AbstractContainerMenu { private List getEnchantmentList(RegistryAccess registryAccess, ItemStack stack, int slot, int cost) { this.random.setSeed(this.enchantmentSeed.get() + slot); - Optional> optional = registryAccess.registryOrThrow(Registries.ENCHANTMENT).getTag(EnchantmentTags.IN_ENCHANTING_TABLE); + Optional> optional = registryAccess.lookupOrThrow(Registries.ENCHANTMENT).get(EnchantmentTags.IN_ENCHANTING_TABLE); if (optional.isEmpty()) { return List.of(); } else { diff --git a/net/minecraft/world/inventory/FurnaceMenu.java b/net/minecraft/world/inventory/FurnaceMenu.java index 1ef5c9df..f6063016 100644 --- a/net/minecraft/world/inventory/FurnaceMenu.java +++ b/net/minecraft/world/inventory/FurnaceMenu.java @@ -2,14 +2,17 @@ package net.minecraft.world.inventory; import net.minecraft.world.Container; import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.item.crafting.RecipePropertySet; import net.minecraft.world.item.crafting.RecipeType; public class FurnaceMenu extends AbstractFurnaceMenu { public FurnaceMenu(int containerId, Inventory playerInventory) { - super(MenuType.FURNACE, RecipeType.SMELTING, RecipeBookType.FURNACE, containerId, playerInventory); + super(MenuType.FURNACE, RecipeType.SMELTING, RecipePropertySet.FURNACE_INPUT, RecipeBookType.FURNACE, containerId, playerInventory); } public FurnaceMenu(int containerId, Inventory playerInventory, Container furnaceContainer, ContainerData furnaceData) { - super(MenuType.FURNACE, RecipeType.SMELTING, RecipeBookType.FURNACE, containerId, playerInventory, furnaceContainer, furnaceData); + super( + MenuType.FURNACE, RecipeType.SMELTING, RecipePropertySet.FURNACE_INPUT, RecipeBookType.FURNACE, containerId, playerInventory, furnaceContainer, furnaceData + ); } } diff --git a/net/minecraft/world/inventory/GrindstoneMenu.java b/net/minecraft/world/inventory/GrindstoneMenu.java index 18b1dd10..918f8683 100644 --- a/net/minecraft/world/inventory/GrindstoneMenu.java +++ b/net/minecraft/world/inventory/GrindstoneMenu.java @@ -114,16 +114,7 @@ public class GrindstoneMenu extends AbstractContainerMenu { } } ); - - for (int i = 0; i < 3; i++) { - for (int j = 0; j < 9; j++) { - this.addSlot(new Slot(playerInventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18)); - } - } - - for (int i = 0; i < 9; i++) { - this.addSlot(new Slot(playerInventory, i, 8 + i * 18, 142)); - } + this.addStandardInventorySlots(playerInventory, 8, 84); } @Override diff --git a/net/minecraft/world/inventory/HopperMenu.java b/net/minecraft/world/inventory/HopperMenu.java index 9e8090f8..8124c218 100644 --- a/net/minecraft/world/inventory/HopperMenu.java +++ b/net/minecraft/world/inventory/HopperMenu.java @@ -19,21 +19,12 @@ public class HopperMenu extends AbstractContainerMenu { this.hopper = container; checkContainerSize(container, 5); container.startOpen(playerInventory.player); - int i = 51; - for (int j = 0; j < 5; j++) { - this.addSlot(new Slot(container, j, 44 + j * 18, 20)); + for (int i = 0; i < 5; i++) { + this.addSlot(new Slot(container, i, 44 + i * 18, 20)); } - for (int j = 0; j < 3; j++) { - for (int k = 0; k < 9; k++) { - this.addSlot(new Slot(playerInventory, k + j * 9 + 9, 8 + k * 18, j * 18 + 51)); - } - } - - for (int j = 0; j < 9; j++) { - this.addSlot(new Slot(playerInventory, j, 8 + j * 18, 109)); - } + this.addStandardInventorySlots(playerInventory, 8, 51); } @Override diff --git a/net/minecraft/world/inventory/HorseInventoryMenu.java b/net/minecraft/world/inventory/HorseInventoryMenu.java index e7ab92bd..1c6ab3d4 100644 --- a/net/minecraft/world/inventory/HorseInventoryMenu.java +++ b/net/minecraft/world/inventory/HorseInventoryMenu.java @@ -20,9 +20,7 @@ public class HorseInventoryMenu extends AbstractContainerMenu { this.horseContainer = horseContainer; this.armorContainer = horse.getBodyArmorAccess(); this.horse = horse; - int i = 3; horseContainer.startOpen(inventory.player); - int j = -18; this.addSlot(new Slot(horseContainer, 0, 8, 18) { @Override public boolean mayPlace(ItemStack stack) { @@ -37,7 +35,7 @@ public class HorseInventoryMenu extends AbstractContainerMenu { this.addSlot(new ArmorSlot(this.armorContainer, horse, EquipmentSlot.BODY, 0, 8, 36, null) { @Override public boolean mayPlace(ItemStack stack) { - return horse.isBodyArmorItem(stack); + return horse.isEquippableInSlot(stack, EquipmentSlot.BODY); } @Override @@ -46,22 +44,14 @@ public class HorseInventoryMenu extends AbstractContainerMenu { } }); if (columns > 0) { - for (int k = 0; k < 3; k++) { - for (int l = 0; l < columns; l++) { - this.addSlot(new Slot(horseContainer, 1 + l + k * columns, 80 + l * 18, 18 + k * 18)); + for (int i = 0; i < 3; i++) { + for (int j = 0; j < columns; j++) { + this.addSlot(new Slot(horseContainer, 1 + j + i * columns, 80 + j * 18, 18 + i * 18)); } } } - for (int k = 0; k < 3; k++) { - for (int l = 0; l < 9; l++) { - this.addSlot(new Slot(inventory, l + k * 9 + 9, 8 + l * 18, 102 + k * 18 + -18)); - } - } - - for (int k = 0; k < 9; k++) { - this.addSlot(new Slot(inventory, k, 8 + k * 18, 142)); - } + this.addStandardInventorySlots(inventory, 8, 84); } @Override diff --git a/net/minecraft/world/inventory/InventoryMenu.java b/net/minecraft/world/inventory/InventoryMenu.java index 31376502..089df57b 100644 --- a/net/minecraft/world/inventory/InventoryMenu.java +++ b/net/minecraft/world/inventory/InventoryMenu.java @@ -1,21 +1,21 @@ package net.minecraft.world.inventory; import com.mojang.datafixers.util.Pair; +import java.util.List; import java.util.Map; import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.level.ServerLevel; import net.minecraft.world.Container; import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.entity.player.Player; -import net.minecraft.world.entity.player.StackedContents; import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.crafting.CraftingInput; -import net.minecraft.world.item.crafting.CraftingRecipe; -import net.minecraft.world.item.crafting.RecipeHolder; -public class InventoryMenu extends RecipeBookMenu { +public class InventoryMenu extends AbstractCraftingMenu { public static final int CONTAINER_ID = 0; public static final int RESULT_SLOT = 0; + private static final int CRAFTING_GRID_WIDTH = 2; + private static final int CRAFTING_GRID_HEIGHT = 2; public static final int CRAFT_SLOT_START = 1; public static final int CRAFT_SLOT_COUNT = 4; public static final int CRAFT_SLOT_END = 5; @@ -44,22 +44,15 @@ public class InventoryMenu extends RecipeBookMenu EMPTY_ARMOR_SLOT_HELMET ); private static final EquipmentSlot[] SLOT_IDS = new EquipmentSlot[]{EquipmentSlot.HEAD, EquipmentSlot.CHEST, EquipmentSlot.LEGS, EquipmentSlot.FEET}; - private final CraftingContainer craftSlots = new TransientCraftingContainer(this, 2, 2); - private final ResultContainer resultSlots = new ResultContainer(); public final boolean active; private final Player owner; public InventoryMenu(Inventory playerInventory, boolean active, Player owner) { - super(null, 0); + super(null, 0, 2, 2); this.active = active; this.owner = owner; - this.addSlot(new ResultSlot(playerInventory.player, this.craftSlots, this.resultSlots, 0, 154, 28)); - - for (int i = 0; i < 2; i++) { - for (int j = 0; j < 2; j++) { - this.addSlot(new Slot(this.craftSlots, j + i * 2, 98 + j * 18, 18 + i * 18)); - } - } + this.addResultSlot(owner, 154, 28); + this.addCraftingGridSlots(98, 18); for (int i = 0; i < 4; i++) { EquipmentSlot equipmentSlot = SLOT_IDS[i]; @@ -67,16 +60,7 @@ public class InventoryMenu extends RecipeBookMenu this.addSlot(new ArmorSlot(playerInventory, owner, equipmentSlot, 39 - i, 8, 8 + i * 18, resourceLocation)); } - for (int i = 0; i < 3; i++) { - for (int j = 0; j < 9; j++) { - this.addSlot(new Slot(playerInventory, j + (i + 1) * 9, 8 + j * 18, 84 + i * 18)); - } - } - - for (int i = 0; i < 9; i++) { - this.addSlot(new Slot(playerInventory, i, 8 + i * 18, 142)); - } - + this.addStandardInventorySlots(playerInventory, 8, 84); this.addSlot(new Slot(playerInventory, 40, 77, 62) { @Override public void setByPlayer(ItemStack newStack, ItemStack oldStack) { @@ -95,25 +79,11 @@ public class InventoryMenu extends RecipeBookMenu return index >= 36 && index < 45 || index == 45; } - @Override - public void fillCraftSlotsStackedContents(StackedContents itemHelper) { - this.craftSlots.fillStackedContents(itemHelper); - } - - @Override - public void clearCraftingContent() { - this.resultSlots.clearContent(); - this.craftSlots.clearContent(); - } - - @Override - public boolean recipeMatches(RecipeHolder recipe) { - return recipe.value().matches(this.craftSlots.asCraftInput(), this.owner.level()); - } - @Override public void slotsChanged(Container container) { - CraftingMenu.slotChangedCraftingGrid(this, this.owner.level(), this.owner, this.craftSlots, this.resultSlots, null); + if (this.owner.level() instanceof ServerLevel serverLevel) { + CraftingMenu.slotChangedCraftingGrid(this, serverLevel, this.owner, this.craftSlots, this.resultSlots, null); + } } @Override @@ -198,23 +168,13 @@ public class InventoryMenu extends RecipeBookMenu } @Override - public int getResultSlotIndex() { - return 0; + public Slot getResultSlot() { + return this.slots.get(0); } @Override - public int getGridWidth() { - return this.craftSlots.getWidth(); - } - - @Override - public int getGridHeight() { - return this.craftSlots.getHeight(); - } - - @Override - public int getSize() { - return 5; + public List getInputGridSlots() { + return this.slots.subList(1, 5); } public CraftingContainer getCraftSlots() { @@ -227,7 +187,7 @@ public class InventoryMenu extends RecipeBookMenu } @Override - public boolean shouldMoveToInventory(int slotIndex) { - return slotIndex != this.getResultSlotIndex(); + protected Player owner() { + return this.owner; } } diff --git a/net/minecraft/world/inventory/ItemCombinerMenu.java b/net/minecraft/world/inventory/ItemCombinerMenu.java index a6a0391c..3782086a 100644 --- a/net/minecraft/world/inventory/ItemCombinerMenu.java +++ b/net/minecraft/world/inventory/ItemCombinerMenu.java @@ -1,6 +1,5 @@ package net.minecraft.world.inventory; -import java.util.List; import net.minecraft.world.Container; import net.minecraft.world.SimpleContainer; import net.minecraft.world.entity.player.Inventory; @@ -11,31 +10,42 @@ import org.jetbrains.annotations.Nullable; public abstract class ItemCombinerMenu extends AbstractContainerMenu { private static final int INVENTORY_SLOTS_PER_ROW = 9; - private static final int INVENTORY_SLOTS_PER_COLUMN = 3; + private static final int INVENTORY_ROWS = 3; + private static final int INPUT_SLOT_START = 0; protected final ContainerLevelAccess access; protected final Player player; protected final Container inputSlots; - private final List inputSlotIndexes; - protected final ResultContainer resultSlots = new ResultContainer(); + protected final ResultContainer resultSlots = new ResultContainer() { + @Override + public void setChanged() { + ItemCombinerMenu.this.slotsChanged(this); + } + }; private final int resultSlotIndex; - protected abstract boolean mayPickup(Player player, boolean hasStack); + protected boolean mayPickup(Player player, boolean hasStack) { + return true; + } protected abstract void onTake(Player player, ItemStack stack); protected abstract boolean isValidBlock(BlockState state); - public ItemCombinerMenu(@Nullable MenuType type, int containerId, Inventory playerInventory, ContainerLevelAccess access) { - super(type, containerId); - this.access = access; - this.player = playerInventory.player; - ItemCombinerMenuSlotDefinition itemCombinerMenuSlotDefinition = this.createInputSlotDefinitions(); + public ItemCombinerMenu( + @Nullable MenuType menuType, + int i, + Inventory inventory, + ContainerLevelAccess containerLevelAccess, + ItemCombinerMenuSlotDefinition itemCombinerMenuSlotDefinition + ) { + super(menuType, i); + this.access = containerLevelAccess; + this.player = inventory.player; this.inputSlots = this.createContainer(itemCombinerMenuSlotDefinition.getNumOfInputSlots()); - this.inputSlotIndexes = itemCombinerMenuSlotDefinition.getInputSlotIndexes(); this.resultSlotIndex = itemCombinerMenuSlotDefinition.getResultSlotIndex(); this.createInputSlots(itemCombinerMenuSlotDefinition); this.createResultSlot(itemCombinerMenuSlotDefinition); - this.createInventorySlots(playerInventory); + this.addStandardInventorySlots(inventory, 8, 84); } private void createInputSlots(ItemCombinerMenuSlotDefinition slotDefinition) { @@ -68,25 +78,11 @@ public abstract class ItemCombinerMenu extends AbstractContainerMenu { }); } - private void createInventorySlots(Inventory inventory) { - for (int i = 0; i < 3; i++) { - for (int j = 0; j < 9; j++) { - this.addSlot(new Slot(inventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18)); - } - } - - for (int i = 0; i < 9; i++) { - this.addSlot(new Slot(inventory, i, 8 + i * 18, 142)); - } - } - /** * Called when the Anvil Input Slot changes, calculates the new result and puts it in the output slot. */ public abstract void createResult(); - protected abstract ItemCombinerMenuSlotDefinition createInputSlotDefinitions(); - private SimpleContainer createContainer(int size) { return new SimpleContainer(size) { @Override @@ -132,13 +128,12 @@ public abstract class ItemCombinerMenu extends AbstractContainerMenu { } slot.onQuickCraft(itemStack2, itemStack); - } else if (this.inputSlotIndexes.contains(index)) { + } else if (index >= 0 && index < this.getResultSlot()) { if (!this.moveItemStackTo(itemStack2, i, j, false)) { return ItemStack.EMPTY; } } else if (this.canMoveIntoInputSlots(itemStack2) && index >= this.getInventorySlotStart() && index < this.getUseRowEnd()) { - int k = this.getSlotToQuickMoveTo(itemStack); - if (!this.moveItemStackTo(itemStack2, k, this.getResultSlot(), false)) { + if (!this.moveItemStackTo(itemStack2, 0, this.getResultSlot(), false)) { return ItemStack.EMPTY; } } else if (index >= this.getInventorySlotStart() && index < this.getInventorySlotEnd()) { @@ -171,10 +166,6 @@ public abstract class ItemCombinerMenu extends AbstractContainerMenu { return true; } - public int getSlotToQuickMoveTo(ItemStack stack) { - return this.inputSlots.isEmpty() ? 0 : (Integer)this.inputSlotIndexes.get(0); - } - public int getResultSlot() { return this.resultSlotIndex; } diff --git a/net/minecraft/world/inventory/ItemCombinerMenuSlotDefinition.java b/net/minecraft/world/inventory/ItemCombinerMenuSlotDefinition.java index 580067f1..fe32e85c 100644 --- a/net/minecraft/world/inventory/ItemCombinerMenuSlotDefinition.java +++ b/net/minecraft/world/inventory/ItemCombinerMenuSlotDefinition.java @@ -3,7 +3,6 @@ package net.minecraft.world.inventory; import java.util.ArrayList; import java.util.List; import java.util.function.Predicate; -import java.util.stream.Collectors; import net.minecraft.world.item.ItemStack; public class ItemCombinerMenuSlotDefinition { @@ -23,10 +22,6 @@ public class ItemCombinerMenuSlotDefinition { return new ItemCombinerMenuSlotDefinition.Builder(); } - public boolean hasSlot(int slot) { - return this.slots.size() >= slot; - } - public ItemCombinerMenuSlotDefinition.SlotDefinition getSlot(int slot) { return (ItemCombinerMenuSlotDefinition.SlotDefinition)this.slots.get(slot); } @@ -47,16 +42,12 @@ public class ItemCombinerMenuSlotDefinition { return this.getNumOfInputSlots(); } - public List getInputSlotIndexes() { - return (List)this.slots.stream().map(ItemCombinerMenuSlotDefinition.SlotDefinition::slotIndex).collect(Collectors.toList()); - } - public static class Builder { - private final List slots = new ArrayList(); + private final List inputSlots = new ArrayList(); private ItemCombinerMenuSlotDefinition.SlotDefinition resultSlot = ItemCombinerMenuSlotDefinition.SlotDefinition.EMPTY; public ItemCombinerMenuSlotDefinition.Builder withSlot(int slotIndex, int x, int y, Predicate mayPlace) { - this.slots.add(new ItemCombinerMenuSlotDefinition.SlotDefinition(slotIndex, x, y, mayPlace)); + this.inputSlots.add(new ItemCombinerMenuSlotDefinition.SlotDefinition(slotIndex, x, y, mayPlace)); return this; } @@ -66,7 +57,20 @@ public class ItemCombinerMenuSlotDefinition { } public ItemCombinerMenuSlotDefinition build() { - return new ItemCombinerMenuSlotDefinition(this.slots, this.resultSlot); + int i = this.inputSlots.size(); + + for (int j = 0; j < i; j++) { + ItemCombinerMenuSlotDefinition.SlotDefinition slotDefinition = (ItemCombinerMenuSlotDefinition.SlotDefinition)this.inputSlots.get(j); + if (slotDefinition.slotIndex != j) { + throw new IllegalArgumentException("Expected input slots to have continous indexes"); + } + } + + if (this.resultSlot.slotIndex != i) { + throw new IllegalArgumentException("Expected result slot index to follow last input slot"); + } else { + return new ItemCombinerMenuSlotDefinition(this.inputSlots, this.resultSlot); + } } } diff --git a/net/minecraft/world/inventory/LoomMenu.java b/net/minecraft/world/inventory/LoomMenu.java index 372e7c78..6ba38ef0 100644 --- a/net/minecraft/world/inventory/LoomMenu.java +++ b/net/minecraft/world/inventory/LoomMenu.java @@ -21,6 +21,7 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.entity.BannerPattern; import net.minecraft.world.level.block.entity.BannerPatternLayers; +import net.minecraft.world.level.block.entity.BannerPatternLayers.Builder; public class LoomMenu extends AbstractContainerMenu { private static final int PATTERN_NOT_SET = -1; @@ -103,17 +104,7 @@ public class LoomMenu extends AbstractContainerMenu { super.onTake(player, stack); } }); - - for (int i = 0; i < 3; i++) { - for (int j = 0; j < 9; j++) { - this.addSlot(new Slot(playerInventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18)); - } - } - - for (int i = 0; i < 9; i++) { - this.addSlot(new Slot(playerInventory, i, 8 + i * 18, 142)); - } - + this.addStandardInventorySlots(playerInventory, 8, 84); this.addDataSlot(this.selectedBannerPatternIndex); this.patternGetter = playerInventory.player.registryAccess().lookupOrThrow(Registries.BANNER_PATTERN); } @@ -280,9 +271,7 @@ public class LoomMenu extends AbstractContainerMenu { itemStack3 = itemStack.copyWithCount(1); DyeColor dyeColor = ((DyeItem)itemStack2.getItem()).getDyeColor(); itemStack3.update( - DataComponents.BANNER_PATTERNS, - BannerPatternLayers.EMPTY, - bannerPatternLayers -> new BannerPatternLayers.Builder().addAll(bannerPatternLayers).add(pattern, dyeColor).build() + DataComponents.BANNER_PATTERNS, BannerPatternLayers.EMPTY, bannerPatternLayers -> new Builder().addAll(bannerPatternLayers).add(pattern, dyeColor).build() ); } diff --git a/net/minecraft/world/inventory/MerchantMenu.java b/net/minecraft/world/inventory/MerchantMenu.java index 72599ce3..9f500425 100644 --- a/net/minecraft/world/inventory/MerchantMenu.java +++ b/net/minecraft/world/inventory/MerchantMenu.java @@ -42,16 +42,7 @@ public class MerchantMenu extends AbstractContainerMenu { this.addSlot(new Slot(this.tradeContainer, 0, 136, 37)); this.addSlot(new Slot(this.tradeContainer, 1, 162, 37)); this.addSlot(new MerchantResultSlot(playerInventory.player, trader, this.tradeContainer, 2, 220, 37)); - - for (int i = 0; i < 3; i++) { - for (int j = 0; j < 9; j++) { - this.addSlot(new Slot(playerInventory, j + i * 9 + 9, 108 + j * 18, 84 + i * 18)); - } - } - - for (int i = 0; i < 9; i++) { - this.addSlot(new Slot(playerInventory, i, 108 + i * 18, 142)); - } + this.addStandardInventorySlots(playerInventory, 108, 84); } public void setShowProgressBar(boolean showProgressBar) { diff --git a/net/minecraft/world/inventory/RecipeBookMenu.java b/net/minecraft/world/inventory/RecipeBookMenu.java index a62fb10f..93719dbd 100644 --- a/net/minecraft/world/inventory/RecipeBookMenu.java +++ b/net/minecraft/world/inventory/RecipeBookMenu.java @@ -1,49 +1,25 @@ package net.minecraft.world.inventory; -import net.minecraft.recipebook.ServerPlaceRecipe; -import net.minecraft.server.level.ServerPlayer; -import net.minecraft.world.entity.player.StackedContents; -import net.minecraft.world.item.crafting.Recipe; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.StackedItemContents; import net.minecraft.world.item.crafting.RecipeHolder; -import net.minecraft.world.item.crafting.RecipeInput; -public abstract class RecipeBookMenu> extends AbstractContainerMenu { +public abstract class RecipeBookMenu extends AbstractContainerMenu { public RecipeBookMenu(MenuType menuType, int containerId) { super(menuType, containerId); } - public void handlePlacement(boolean placeAll, RecipeHolder recipe, ServerPlayer player) { - RecipeHolder recipeHolder = (RecipeHolder)recipe; - this.beginPlacingRecipe(); + public abstract RecipeBookMenu.PostPlaceAction handlePlacement( + boolean bl, boolean bl2, RecipeHolder recipeHolder, ServerLevel serverLevel, Inventory inventory + ); - try { - new ServerPlaceRecipe<>(this).recipeClicked(player, recipeHolder, placeAll); - } finally { - this.finishPlacingRecipe((RecipeHolder)recipe); - } - } - - protected void beginPlacingRecipe() { - } - - protected void finishPlacingRecipe(RecipeHolder recipe) { - } - - public abstract void fillCraftSlotsStackedContents(StackedContents itemHelper); - - public abstract void clearCraftingContent(); - - public abstract boolean recipeMatches(RecipeHolder recipe); - - public abstract int getResultSlotIndex(); - - public abstract int getGridWidth(); - - public abstract int getGridHeight(); - - public abstract int getSize(); + public abstract void fillCraftSlotsStackedContents(StackedItemContents stackedItemContents); public abstract RecipeBookType getRecipeBookType(); - public abstract boolean shouldMoveToInventory(int slotIndex); + public static enum PostPlaceAction { + NOTHING, + PLACE_GHOST_RECIPE; + } } diff --git a/net/minecraft/world/inventory/RecipeCraftingHolder.java b/net/minecraft/world/inventory/RecipeCraftingHolder.java index af2c917e..957983e5 100644 --- a/net/minecraft/world/inventory/RecipeCraftingHolder.java +++ b/net/minecraft/world/inventory/RecipeCraftingHolder.java @@ -7,7 +7,6 @@ import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.crafting.RecipeHolder; import net.minecraft.world.level.GameRules; -import net.minecraft.world.level.Level; import org.jetbrains.annotations.Nullable; public interface RecipeCraftingHolder { @@ -27,11 +26,13 @@ public interface RecipeCraftingHolder { } } - default boolean setRecipeUsed(Level level, ServerPlayer players, RecipeHolder recipe) { - if (!recipe.value().isSpecial() && level.getGameRules().getBoolean(GameRules.RULE_LIMITED_CRAFTING) && !players.getRecipeBook().contains(recipe)) { + default boolean setRecipeUsed(ServerPlayer serverPlayer, RecipeHolder recipeHolder) { + if (!recipeHolder.value().isSpecial() + && serverPlayer.serverLevel().getGameRules().getBoolean(GameRules.RULE_LIMITED_CRAFTING) + && !serverPlayer.getRecipeBook().contains(recipeHolder.id())) { return false; } else { - this.setRecipeUsed(recipe); + this.setRecipeUsed(recipeHolder); return true; } } diff --git a/net/minecraft/world/inventory/ResultSlot.java b/net/minecraft/world/inventory/ResultSlot.java index 8739b4c0..95920ef6 100644 --- a/net/minecraft/world/inventory/ResultSlot.java +++ b/net/minecraft/world/inventory/ResultSlot.java @@ -1,11 +1,14 @@ package net.minecraft.world.inventory; import net.minecraft.core.NonNullList; +import net.minecraft.server.level.ServerLevel; import net.minecraft.world.Container; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.crafting.CraftingInput; +import net.minecraft.world.item.crafting.CraftingRecipe; import net.minecraft.world.item.crafting.RecipeType; +import net.minecraft.world.level.Level; public class ResultSlot extends Slot { private final CraftingContainer craftSlots; @@ -56,6 +59,25 @@ public class ResultSlot extends Slot { this.removeCount = 0; } + private static NonNullList copyAllInputItems(CraftingInput craftingInput) { + NonNullList nonNullList = NonNullList.withSize(craftingInput.size(), ItemStack.EMPTY); + + for (int i = 0; i < nonNullList.size(); i++) { + nonNullList.set(i, craftingInput.getItem(i)); + } + + return nonNullList; + } + + private NonNullList getRemainingItems(CraftingInput craftingInput, Level level) { + return level instanceof ServerLevel serverLevel + ? (NonNullList)serverLevel.recipeAccess() + .getRecipeFor(RecipeType.CRAFTING, craftingInput, serverLevel) + .map(recipeHolder -> ((CraftingRecipe)recipeHolder.value()).getRemainingItems(craftingInput)) + .orElseGet(() -> copyAllInputItems(craftingInput)) + : CraftingRecipe.defaultCraftingReminder(craftingInput); + } + @Override public void onTake(Player player, ItemStack stack) { this.checkTakeAchievements(stack); @@ -63,7 +85,7 @@ public class ResultSlot extends Slot { CraftingInput craftingInput = positioned.input(); int i = positioned.left(); int j = positioned.top(); - NonNullList nonNullList = player.level().getRecipeManager().getRemainingItemsFor(RecipeType.CRAFTING, craftingInput, player.level()); + NonNullList nonNullList = this.getRemainingItems(craftingInput, player.level()); for (int k = 0; k < craftingInput.height(); k++) { for (int l = 0; l < craftingInput.width(); l++) { diff --git a/net/minecraft/world/inventory/ShulkerBoxMenu.java b/net/minecraft/world/inventory/ShulkerBoxMenu.java index 38bfd1a5..ddf12d04 100644 --- a/net/minecraft/world/inventory/ShulkerBoxMenu.java +++ b/net/minecraft/world/inventory/ShulkerBoxMenu.java @@ -28,15 +28,7 @@ public class ShulkerBoxMenu extends AbstractContainerMenu { } } - for (int k = 0; k < 3; k++) { - for (int l = 0; l < 9; l++) { - this.addSlot(new Slot(playerInventory, l + k * 9 + 9, 8 + l * 18, 84 + k * 18)); - } - } - - for (int k = 0; k < 9; k++) { - this.addSlot(new Slot(playerInventory, k, 8 + k * 18, 142)); - } + this.addStandardInventorySlots(playerInventory, 8, 84); } @Override diff --git a/net/minecraft/world/inventory/Slot.java b/net/minecraft/world/inventory/Slot.java index 0d76af4d..e1be102e 100644 --- a/net/minecraft/world/inventory/Slot.java +++ b/net/minecraft/world/inventory/Slot.java @@ -168,15 +168,19 @@ public class Slot { if (!stack.isEmpty() && this.mayPlace(stack)) { ItemStack itemStack = this.getItem(); int i = Math.min(Math.min(increment, stack.getCount()), this.getMaxStackSize(stack) - itemStack.getCount()); - if (itemStack.isEmpty()) { - this.setByPlayer(stack.split(i)); - } else if (ItemStack.isSameItemSameComponents(itemStack, stack)) { - stack.shrink(i); - itemStack.grow(i); - this.setByPlayer(itemStack); - } + if (i <= 0) { + return stack; + } else { + if (itemStack.isEmpty()) { + this.setByPlayer(stack.split(i)); + } else if (ItemStack.isSameItemSameComponents(itemStack, stack)) { + stack.shrink(i); + itemStack.grow(i); + this.setByPlayer(itemStack); + } - return stack; + return stack; + } } else { return stack; } diff --git a/net/minecraft/world/inventory/SmithingMenu.java b/net/minecraft/world/inventory/SmithingMenu.java index a77c29d4..aeb995c4 100644 --- a/net/minecraft/world/inventory/SmithingMenu.java +++ b/net/minecraft/world/inventory/SmithingMenu.java @@ -1,18 +1,21 @@ package net.minecraft.world.inventory; import java.util.List; -import java.util.OptionalInt; +import java.util.Optional; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.Container; import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.RecipeAccess; import net.minecraft.world.item.crafting.RecipeHolder; +import net.minecraft.world.item.crafting.RecipePropertySet; import net.minecraft.world.item.crafting.RecipeType; import net.minecraft.world.item.crafting.SmithingRecipe; import net.minecraft.world.item.crafting.SmithingRecipeInput; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.state.BlockState; -import org.jetbrains.annotations.Nullable; public class SmithingMenu extends ItemCombinerMenu { public static final int TEMPLATE_SLOT = 0; @@ -25,26 +28,36 @@ public class SmithingMenu extends ItemCombinerMenu { private static final int RESULT_SLOT_X_PLACEMENT = 98; public static final int SLOT_Y_PLACEMENT = 48; private final Level level; - @Nullable - private RecipeHolder selectedRecipe; - private final List> recipes; + private final RecipePropertySet baseItemTest; + private final RecipePropertySet templateItemTest; + private final RecipePropertySet additionItemTest; + private final DataSlot hasRecipeError = DataSlot.standalone(); public SmithingMenu(int containerId, Inventory playerInventory) { this(containerId, playerInventory, ContainerLevelAccess.NULL); } public SmithingMenu(int containerId, Inventory playerInventory, ContainerLevelAccess access) { - super(MenuType.SMITHING, containerId, playerInventory, access); - this.level = playerInventory.player.level(); - this.recipes = this.level.getRecipeManager().getAllRecipesFor(RecipeType.SMITHING); + this(containerId, playerInventory, access, playerInventory.player.level()); } - @Override - protected ItemCombinerMenuSlotDefinition createInputSlotDefinitions() { + private SmithingMenu(int i, Inventory inventory, ContainerLevelAccess containerLevelAccess, Level level) { + super(MenuType.SMITHING, i, inventory, containerLevelAccess, createInputSlotDefinitions(level.recipeAccess())); + this.level = level; + this.baseItemTest = level.recipeAccess().propertySet(RecipePropertySet.SMITHING_BASE); + this.templateItemTest = level.recipeAccess().propertySet(RecipePropertySet.SMITHING_TEMPLATE); + this.additionItemTest = level.recipeAccess().propertySet(RecipePropertySet.SMITHING_ADDITION); + this.addDataSlot(this.hasRecipeError).set(0); + } + + private static ItemCombinerMenuSlotDefinition createInputSlotDefinitions(RecipeAccess recipeAccess) { + RecipePropertySet recipePropertySet = recipeAccess.propertySet(RecipePropertySet.SMITHING_BASE); + RecipePropertySet recipePropertySet2 = recipeAccess.propertySet(RecipePropertySet.SMITHING_TEMPLATE); + RecipePropertySet recipePropertySet3 = recipeAccess.propertySet(RecipePropertySet.SMITHING_ADDITION); return ItemCombinerMenuSlotDefinition.create() - .withSlot(0, 8, 48, itemStack -> this.recipes.stream().anyMatch(recipeHolder -> ((SmithingRecipe)recipeHolder.value()).isTemplateIngredient(itemStack))) - .withSlot(1, 26, 48, itemStack -> this.recipes.stream().anyMatch(recipeHolder -> ((SmithingRecipe)recipeHolder.value()).isBaseIngredient(itemStack))) - .withSlot(2, 44, 48, itemStack -> this.recipes.stream().anyMatch(recipeHolder -> ((SmithingRecipe)recipeHolder.value()).isAdditionIngredient(itemStack))) + .withSlot(0, 8, 48, recipePropertySet2::test) + .withSlot(1, 26, 48, recipePropertySet::test) + .withSlot(2, 44, 48, recipePropertySet3::test) .withResultSlot(3, 98, 48) .build(); } @@ -54,11 +67,6 @@ public class SmithingMenu extends ItemCombinerMenu { return state.is(Blocks.SMITHING_TABLE); } - @Override - protected boolean mayPickup(Player player, boolean hasStack) { - return this.selectedRecipe != null && this.selectedRecipe.value().matches(this.createRecipeInput(), this.level); - } - @Override protected void onTake(Player player, ItemStack stack) { stack.onCraftedBy(player.level(), player, stack.getCount()); @@ -86,35 +94,32 @@ public class SmithingMenu extends ItemCombinerMenu { } @Override - public void createResult() { - SmithingRecipeInput smithingRecipeInput = this.createRecipeInput(); - List> list = this.level.getRecipeManager().getRecipesFor(RecipeType.SMITHING, smithingRecipeInput, this.level); - if (list.isEmpty()) { - this.resultSlots.setItem(0, ItemStack.EMPTY); - } else { - RecipeHolder recipeHolder = (RecipeHolder)list.get(0); - ItemStack itemStack = recipeHolder.value().assemble(smithingRecipeInput, this.level.registryAccess()); - if (itemStack.isItemEnabled(this.level.enabledFeatures())) { - this.selectedRecipe = recipeHolder; - this.resultSlots.setRecipeUsed(recipeHolder); - this.resultSlots.setItem(0, itemStack); - } + public void slotsChanged(Container container) { + super.slotsChanged(container); + if (this.level instanceof ServerLevel) { + boolean bl = this.getSlot(0).hasItem() && this.getSlot(1).hasItem() && this.getSlot(2).hasItem() && !this.getSlot(this.getResultSlot()).hasItem(); + this.hasRecipeError.set(bl ? 1 : 0); } } @Override - public int getSlotToQuickMoveTo(ItemStack stack) { - return this.findSlotToQuickMoveTo(stack).orElse(0); - } - - private static OptionalInt findSlotMatchingIngredient(SmithingRecipe recipe, ItemStack stack) { - if (recipe.isTemplateIngredient(stack)) { - return OptionalInt.of(0); - } else if (recipe.isBaseIngredient(stack)) { - return OptionalInt.of(1); + public void createResult() { + SmithingRecipeInput smithingRecipeInput = this.createRecipeInput(); + Optional> optional; + if (this.level instanceof ServerLevel serverLevel) { + optional = serverLevel.recipeAccess().getRecipeFor(RecipeType.SMITHING, smithingRecipeInput, serverLevel); } else { - return recipe.isAdditionIngredient(stack) ? OptionalInt.of(2) : OptionalInt.empty(); + optional = Optional.empty(); } + + optional.ifPresentOrElse(recipeHolder -> { + ItemStack itemStack = ((SmithingRecipe)recipeHolder.value()).assemble(smithingRecipeInput, this.level.registryAccess()); + this.resultSlots.setRecipeUsed(recipeHolder); + this.resultSlots.setItem(0, itemStack); + }, () -> { + this.resultSlots.setRecipeUsed(null); + this.resultSlots.setItem(0, ItemStack.EMPTY); + }); } @Override @@ -124,14 +129,14 @@ public class SmithingMenu extends ItemCombinerMenu { @Override public boolean canMoveIntoInputSlots(ItemStack stack) { - return this.findSlotToQuickMoveTo(stack).isPresent(); + if (this.templateItemTest.test(stack) && !this.getSlot(0).hasItem()) { + return true; + } else { + return this.baseItemTest.test(stack) && !this.getSlot(1).hasItem() ? true : this.additionItemTest.test(stack) && !this.getSlot(2).hasItem(); + } } - private OptionalInt findSlotToQuickMoveTo(ItemStack stack) { - return this.recipes - .stream() - .flatMapToInt(recipeHolder -> findSlotMatchingIngredient((SmithingRecipe)recipeHolder.value(), stack).stream()) - .filter(i -> !this.getSlot(i).hasItem()) - .findFirst(); + public boolean hasRecipeError() { + return this.hasRecipeError.get() > 0; } } diff --git a/net/minecraft/world/inventory/SmokerMenu.java b/net/minecraft/world/inventory/SmokerMenu.java index a7c572ea..a7119f49 100644 --- a/net/minecraft/world/inventory/SmokerMenu.java +++ b/net/minecraft/world/inventory/SmokerMenu.java @@ -2,14 +2,15 @@ package net.minecraft.world.inventory; import net.minecraft.world.Container; import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.item.crafting.RecipePropertySet; import net.minecraft.world.item.crafting.RecipeType; public class SmokerMenu extends AbstractFurnaceMenu { public SmokerMenu(int containerId, Inventory playerInventory) { - super(MenuType.SMOKER, RecipeType.SMOKING, RecipeBookType.SMOKER, containerId, playerInventory); + super(MenuType.SMOKER, RecipeType.SMOKING, RecipePropertySet.SMOKER_INPUT, RecipeBookType.SMOKER, containerId, playerInventory); } public SmokerMenu(int containerId, Inventory playerInventory, Container smokerContainer, ContainerData smokerData) { - super(MenuType.SMOKER, RecipeType.SMOKING, RecipeBookType.SMOKER, containerId, playerInventory, smokerContainer, smokerData); + super(MenuType.SMOKER, RecipeType.SMOKING, RecipePropertySet.SMOKER_INPUT, RecipeBookType.SMOKER, containerId, playerInventory, smokerContainer, smokerData); } } diff --git a/net/minecraft/world/inventory/StackedContentsCompatible.java b/net/minecraft/world/inventory/StackedContentsCompatible.java index 2e002a9f..afeb60d0 100644 --- a/net/minecraft/world/inventory/StackedContentsCompatible.java +++ b/net/minecraft/world/inventory/StackedContentsCompatible.java @@ -1,7 +1,8 @@ package net.minecraft.world.inventory; -import net.minecraft.world.entity.player.StackedContents; +import net.minecraft.world.entity.player.StackedItemContents; +@FunctionalInterface public interface StackedContentsCompatible { - void fillStackedContents(StackedContents contents); + void fillStackedContents(StackedItemContents stackedItemContents); } diff --git a/net/minecraft/world/inventory/StonecutterMenu.java b/net/minecraft/world/inventory/StonecutterMenu.java index b07a7cf6..9e8589f4 100644 --- a/net/minecraft/world/inventory/StonecutterMenu.java +++ b/net/minecraft/world/inventory/StonecutterMenu.java @@ -1,7 +1,7 @@ package net.minecraft.world.inventory; -import com.google.common.collect.Lists; import java.util.List; +import java.util.Optional; import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; import net.minecraft.world.Container; @@ -11,7 +11,7 @@ import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.crafting.RecipeHolder; -import net.minecraft.world.item.crafting.RecipeType; +import net.minecraft.world.item.crafting.SelectableRecipe; import net.minecraft.world.item.crafting.SingleRecipeInput; import net.minecraft.world.item.crafting.StonecutterRecipe; import net.minecraft.world.level.Level; @@ -28,9 +28,9 @@ public class StonecutterMenu extends AbstractContainerMenu { /** * The index of the selected recipe in the GUI. */ - private final DataSlot selectedRecipeIndex = DataSlot.standalone(); + final DataSlot selectedRecipeIndex = DataSlot.standalone(); private final Level level; - private List> recipes = Lists.>newArrayList(); + private SelectableRecipe.SingleInputSet recipesForInput = SelectableRecipe.SingleInputSet.empty(); /** * The {@linkplain net.minecraft.world.item.ItemStack} set in the input slot by the player. */ @@ -79,7 +79,7 @@ public class StonecutterMenu extends AbstractContainerMenu { StonecutterMenu.this.resultContainer.awardUsedRecipes(player, this.getRelevantItems()); ItemStack itemStack = StonecutterMenu.this.inputSlot.remove(1); if (!itemStack.isEmpty()) { - StonecutterMenu.this.setupResultSlot(); + StonecutterMenu.this.setupResultSlot(StonecutterMenu.this.selectedRecipeIndex.get()); } access.execute((level, blockPos) -> { @@ -96,17 +96,7 @@ public class StonecutterMenu extends AbstractContainerMenu { return List.of(StonecutterMenu.this.inputSlot.getItem()); } }); - - for (int i = 0; i < 3; i++) { - for (int j = 0; j < 9; j++) { - this.addSlot(new Slot(playerInventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18)); - } - } - - for (int i = 0; i < 9; i++) { - this.addSlot(new Slot(playerInventory, i, 8 + i * 18, 142)); - } - + this.addStandardInventorySlots(playerInventory, 8, 84); this.addDataSlot(this.selectedRecipeIndex); } @@ -117,16 +107,16 @@ public class StonecutterMenu extends AbstractContainerMenu { return this.selectedRecipeIndex.get(); } - public List> getRecipes() { - return this.recipes; + public SelectableRecipe.SingleInputSet getVisibleRecipes() { + return this.recipesForInput; } - public int getNumRecipes() { - return this.recipes.size(); + public int getNumberOfVisibleRecipes() { + return this.recipesForInput.size(); } public boolean hasInputItem() { - return this.inputSlot.hasItem() && !this.recipes.isEmpty(); + return this.inputSlot.hasItem() && !this.recipesForInput.isEmpty(); } @Override @@ -138,14 +128,14 @@ public class StonecutterMenu extends AbstractContainerMenu { public boolean clickMenuButton(Player player, int id) { if (this.isValidRecipeIndex(id)) { this.selectedRecipeIndex.set(id); - this.setupResultSlot(); + this.setupResultSlot(id); } return true; } private boolean isValidRecipeIndex(int recipeIndex) { - return recipeIndex >= 0 && recipeIndex < this.recipes.size(); + return recipeIndex >= 0 && recipeIndex < this.recipesForInput.size(); } @Override @@ -153,37 +143,38 @@ public class StonecutterMenu extends AbstractContainerMenu { ItemStack itemStack = this.inputSlot.getItem(); if (!itemStack.is(this.input.getItem())) { this.input = itemStack.copy(); - this.setupRecipeList(container, itemStack); + this.setupRecipeList(itemStack); } } - private static SingleRecipeInput createRecipeInput(Container container) { - return new SingleRecipeInput(container.getItem(0)); - } - - private void setupRecipeList(Container container, ItemStack stack) { - this.recipes.clear(); + private void setupRecipeList(ItemStack itemStack) { this.selectedRecipeIndex.set(-1); this.resultSlot.set(ItemStack.EMPTY); - if (!stack.isEmpty()) { - this.recipes = this.level.getRecipeManager().getRecipesFor(RecipeType.STONECUTTING, createRecipeInput(container), this.level); + if (!itemStack.isEmpty()) { + this.recipesForInput = this.level.recipeAccess().stonecutterRecipes().selectByInput(itemStack); + } else { + this.recipesForInput = SelectableRecipe.SingleInputSet.empty(); } } - void setupResultSlot() { - if (!this.recipes.isEmpty() && this.isValidRecipeIndex(this.selectedRecipeIndex.get())) { - RecipeHolder recipeHolder = (RecipeHolder)this.recipes.get(this.selectedRecipeIndex.get()); - ItemStack itemStack = recipeHolder.value().assemble(createRecipeInput(this.container), this.level.registryAccess()); - if (itemStack.isItemEnabled(this.level.enabledFeatures())) { - this.resultContainer.setRecipeUsed(recipeHolder); - this.resultSlot.set(itemStack); - } else { - this.resultSlot.set(ItemStack.EMPTY); - } + void setupResultSlot(int i) { + Optional> optional; + if (!this.recipesForInput.isEmpty() && this.isValidRecipeIndex(i)) { + SelectableRecipe.SingleInputEntry singleInputEntry = (SelectableRecipe.SingleInputEntry)this.recipesForInput + .entries() + .get(i); + optional = singleInputEntry.recipe().recipe(); } else { - this.resultSlot.set(ItemStack.EMPTY); + optional = Optional.empty(); } + optional.ifPresentOrElse(recipeHolder -> { + this.resultContainer.setRecipeUsed(recipeHolder); + this.resultSlot.set(((StonecutterRecipe)recipeHolder.value()).assemble(new SingleRecipeInput(this.container.getItem(0)), this.level.registryAccess())); + }, () -> { + this.resultSlot.set(ItemStack.EMPTY); + this.resultContainer.setRecipeUsed(null); + }); this.broadcastChanges(); } @@ -220,7 +211,7 @@ public class StonecutterMenu extends AbstractContainerMenu { if (!this.moveItemStackTo(itemStack2, 2, 38, false)) { return ItemStack.EMPTY; } - } else if (this.level.getRecipeManager().getRecipeFor(RecipeType.STONECUTTING, new SingleRecipeInput(itemStack2), this.level).isPresent()) { + } else if (this.level.recipeAccess().stonecutterRecipes().acceptsInput(itemStack2)) { if (!this.moveItemStackTo(itemStack2, 0, 1, false)) { return ItemStack.EMPTY; } @@ -242,6 +233,10 @@ public class StonecutterMenu extends AbstractContainerMenu { } slot.onTake(player, itemStack2); + if (index == 1) { + player.drop(itemStack2, false); + } + this.broadcastChanges(); } diff --git a/net/minecraft/world/inventory/TransientCraftingContainer.java b/net/minecraft/world/inventory/TransientCraftingContainer.java index a58329e6..fe664389 100644 --- a/net/minecraft/world/inventory/TransientCraftingContainer.java +++ b/net/minecraft/world/inventory/TransientCraftingContainer.java @@ -4,7 +4,7 @@ import java.util.List; import net.minecraft.core.NonNullList; import net.minecraft.world.ContainerHelper; import net.minecraft.world.entity.player.Player; -import net.minecraft.world.entity.player.StackedContents; +import net.minecraft.world.entity.player.StackedItemContents; import net.minecraft.world.item.ItemStack; public class TransientCraftingContainer implements CraftingContainer { @@ -17,7 +17,7 @@ public class TransientCraftingContainer implements CraftingContainer { this(menu, width, height, NonNullList.withSize(width * height, ItemStack.EMPTY)); } - public TransientCraftingContainer(AbstractContainerMenu menu, int width, int height, NonNullList items) { + private TransientCraftingContainer(AbstractContainerMenu menu, int width, int height, NonNullList items) { this.items = items; this.menu = menu; this.width = width; @@ -96,9 +96,9 @@ public class TransientCraftingContainer implements CraftingContainer { } @Override - public void fillStackedContents(StackedContents contents) { + public void fillStackedContents(StackedItemContents stackedItemContents) { for (ItemStack itemStack : this.items) { - contents.accountSimpleStack(itemStack); + stackedItemContents.accountSimpleStack(itemStack); } } } diff --git a/net/minecraft/world/item/AdventureModePredicate.java b/net/minecraft/world/item/AdventureModePredicate.java index d794f62c..01cea154 100644 --- a/net/minecraft/world/item/AdventureModePredicate.java +++ b/net/minecraft/world/item/AdventureModePredicate.java @@ -42,22 +42,16 @@ public class AdventureModePredicate { private static final Component UNKNOWN_USE = Component.translatable("item.canUse.unknown").withStyle(ChatFormatting.GRAY); private final List predicates; private final boolean showInTooltip; - private final List tooltip; + @Nullable + private List cachedTooltip; @Nullable private BlockInWorld lastCheckedBlock; private boolean lastResult; private boolean checksBlockEntity; - private AdventureModePredicate(List predicates, boolean showInTooltip, List tooltip) { - this.predicates = predicates; - this.showInTooltip = showInTooltip; - this.tooltip = tooltip; - } - public AdventureModePredicate(List predicates, boolean showInTooltip) { this.predicates = predicates; this.showInTooltip = showInTooltip; - this.tooltip = computeTooltip(predicates); } private static boolean areSameBlocks(BlockInWorld first, @Nullable BlockInWorld second, boolean checkNbt) { @@ -95,12 +89,20 @@ public class AdventureModePredicate { } } + private List tooltip() { + if (this.cachedTooltip == null) { + this.cachedTooltip = computeTooltip(this.predicates); + } + + return this.cachedTooltip; + } + public void addToTooltip(Consumer tooltipAdder) { - this.tooltip.forEach(tooltipAdder); + this.tooltip().forEach(tooltipAdder); } public AdventureModePredicate withTooltip(boolean showInTooltip) { - return new AdventureModePredicate(this.predicates, showInTooltip, this.tooltip); + return new AdventureModePredicate(this.predicates, showInTooltip); } private static List computeTooltip(List predicates) { diff --git a/net/minecraft/world/item/AirItem.java b/net/minecraft/world/item/AirItem.java index 5196b182..dac333c8 100644 --- a/net/minecraft/world/item/AirItem.java +++ b/net/minecraft/world/item/AirItem.java @@ -12,14 +12,14 @@ public class AirItem extends Item { this.block = block; } - @Override - public String getDescriptionId() { - return this.block.getDescriptionId(); - } - @Override public void appendHoverText(ItemStack stack, Item.TooltipContext context, List tooltipComponents, TooltipFlag tooltipFlag) { super.appendHoverText(stack, context, tooltipComponents, tooltipFlag); this.block.appendHoverText(stack, context, tooltipComponents, tooltipFlag); } + + @Override + public Component getName(ItemStack stack) { + return this.getName(); + } } diff --git a/net/minecraft/world/item/AnimalArmorItem.java b/net/minecraft/world/item/AnimalArmorItem.java index c434ae75..3be0a117 100644 --- a/net/minecraft/world/item/AnimalArmorItem.java +++ b/net/minecraft/world/item/AnimalArmorItem.java @@ -1,43 +1,23 @@ package net.minecraft.world.item; -import java.util.function.Function; -import java.util.function.UnaryOperator; import net.minecraft.core.Holder; -import net.minecraft.resources.ResourceKey; -import net.minecraft.resources.ResourceLocation; +import net.minecraft.core.HolderSet; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; -import org.jetbrains.annotations.Nullable; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.item.equipment.ArmorMaterial; -public class AnimalArmorItem extends ArmorItem { - private final ResourceLocation textureLocation; - @Nullable - private final ResourceLocation overlayTextureLocation; +public class AnimalArmorItem extends Item { private final AnimalArmorItem.BodyType bodyType; - public AnimalArmorItem(Holder armorMaterial, AnimalArmorItem.BodyType bodyType, boolean hasOverlay, Item.Properties properties) { - super(armorMaterial, ArmorItem.Type.BODY, properties); + public AnimalArmorItem(ArmorMaterial armorMaterial, AnimalArmorItem.BodyType bodyType, Item.Properties properties) { + super(armorMaterial.animalProperties(properties, bodyType.allowedEntities)); this.bodyType = bodyType; - ResourceLocation resourceLocation = (ResourceLocation)bodyType.textureLocator.apply(((ResourceKey)armorMaterial.unwrapKey().orElseThrow()).location()); - this.textureLocation = resourceLocation.withSuffix(".png"); - if (hasOverlay) { - this.overlayTextureLocation = resourceLocation.withSuffix("_overlay.png"); - } else { - this.overlayTextureLocation = null; - } } - public ResourceLocation getTexture() { - return this.textureLocation; - } - - @Nullable - public ResourceLocation getOverlayTexture() { - return this.overlayTextureLocation; - } - - public AnimalArmorItem.BodyType getBodyType() { - return this.bodyType; + public AnimalArmorItem(ArmorMaterial armorMaterial, AnimalArmorItem.BodyType bodyType, Holder holder, boolean bl, Item.Properties properties) { + super(armorMaterial.animalProperties(properties, holder, bl, bodyType.allowedEntities)); + this.bodyType = bodyType; } @Override @@ -45,24 +25,16 @@ public class AnimalArmorItem extends ArmorItem { return this.bodyType.breakingSound; } - @Override - public boolean isEnchantable(ItemStack stack) { - return false; - } - public static enum BodyType { - EQUESTRIAN( - resourceLocation -> resourceLocation.withPath((UnaryOperator)(string -> "textures/entity/horse/armor/horse_armor_" + string)), - SoundEvents.ITEM_BREAK - ), - CANINE(resourceLocation -> resourceLocation.withPath("textures/entity/wolf/wolf_armor"), SoundEvents.WOLF_ARMOR_BREAK); + EQUESTRIAN(SoundEvents.ITEM_BREAK, EntityType.HORSE), + CANINE(SoundEvents.WOLF_ARMOR_BREAK, EntityType.WOLF); - final Function textureLocator; final SoundEvent breakingSound; + final HolderSet> allowedEntities; - private BodyType(final Function textureLocator, final SoundEvent breakingSound) { - this.textureLocator = textureLocator; - this.breakingSound = breakingSound; + private BodyType(final SoundEvent soundEvent, final EntityType... entityTypes) { + this.breakingSound = soundEvent; + this.allowedEntities = HolderSet.direct(EntityType::builtInRegistryHolder, entityTypes); } } } diff --git a/net/minecraft/world/item/ArmorItem.java b/net/minecraft/world/item/ArmorItem.java index 5549266d..1fa798ee 100644 --- a/net/minecraft/world/item/ArmorItem.java +++ b/net/minecraft/world/item/ArmorItem.java @@ -1,169 +1,10 @@ package net.minecraft.world.item; -import com.google.common.base.Suppliers; -import com.mojang.serialization.Codec; -import java.util.List; -import java.util.function.Supplier; -import net.minecraft.core.BlockPos; -import net.minecraft.core.Holder; -import net.minecraft.core.dispenser.BlockSource; -import net.minecraft.core.dispenser.DefaultDispenseItemBehavior; -import net.minecraft.core.dispenser.DispenseItemBehavior; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.sounds.SoundEvent; -import net.minecraft.util.StringRepresentable; -import net.minecraft.world.InteractionHand; -import net.minecraft.world.InteractionResultHolder; -import net.minecraft.world.entity.EntitySelector; -import net.minecraft.world.entity.EquipmentSlot; -import net.minecraft.world.entity.EquipmentSlotGroup; -import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.entity.Mob; -import net.minecraft.world.entity.ai.attributes.AttributeModifier; -import net.minecraft.world.entity.ai.attributes.Attributes; -import net.minecraft.world.entity.player.Player; -import net.minecraft.world.item.component.ItemAttributeModifiers; -import net.minecraft.world.item.crafting.Ingredient; -import net.minecraft.world.level.Level; -import net.minecraft.world.level.block.DispenserBlock; -import net.minecraft.world.phys.AABB; +import net.minecraft.world.item.equipment.ArmorMaterial; +import net.minecraft.world.item.equipment.ArmorType; -public class ArmorItem extends Item implements Equipable { - public static final DispenseItemBehavior DISPENSE_ITEM_BEHAVIOR = new DefaultDispenseItemBehavior() { - @Override - protected ItemStack execute(BlockSource blockSource, ItemStack item) { - return ArmorItem.dispenseArmor(blockSource, item) ? item : super.execute(blockSource, item); - } - }; - protected final ArmorItem.Type type; - protected final Holder material; - private final Supplier defaultModifiers; - - public static boolean dispenseArmor(BlockSource blockSource, ItemStack armorItem) { - BlockPos blockPos = blockSource.pos().relative(blockSource.state().getValue(DispenserBlock.FACING)); - List list = blockSource.level() - .getEntitiesOfClass(LivingEntity.class, new AABB(blockPos), EntitySelector.NO_SPECTATORS.and(new EntitySelector.MobCanWearArmorEntitySelector(armorItem))); - if (list.isEmpty()) { - return false; - } else { - LivingEntity livingEntity = (LivingEntity)list.get(0); - EquipmentSlot equipmentSlot = livingEntity.getEquipmentSlotForItem(armorItem); - ItemStack itemStack = armorItem.split(1); - livingEntity.setItemSlot(equipmentSlot, itemStack); - if (livingEntity instanceof Mob) { - ((Mob)livingEntity).setDropChance(equipmentSlot, 2.0F); - ((Mob)livingEntity).setPersistenceRequired(); - } - - return true; - } - } - - public ArmorItem(Holder material, ArmorItem.Type type, Item.Properties properties) { - super(properties); - this.material = material; - this.type = type; - DispenserBlock.registerBehavior(this, DISPENSE_ITEM_BEHAVIOR); - this.defaultModifiers = Suppliers.memoize(() -> { - int i = material.value().getDefense(type); - float f = material.value().toughness(); - ItemAttributeModifiers.Builder builder = ItemAttributeModifiers.builder(); - EquipmentSlotGroup equipmentSlotGroup = EquipmentSlotGroup.bySlot(type.getSlot()); - ResourceLocation resourceLocation = ResourceLocation.withDefaultNamespace("armor." + type.getName()); - builder.add(Attributes.ARMOR, new AttributeModifier(resourceLocation, i, AttributeModifier.Operation.ADD_VALUE), equipmentSlotGroup); - builder.add(Attributes.ARMOR_TOUGHNESS, new AttributeModifier(resourceLocation, f, AttributeModifier.Operation.ADD_VALUE), equipmentSlotGroup); - float g = material.value().knockbackResistance(); - if (g > 0.0F) { - builder.add(Attributes.KNOCKBACK_RESISTANCE, new AttributeModifier(resourceLocation, g, AttributeModifier.Operation.ADD_VALUE), equipmentSlotGroup); - } - - return builder.build(); - }); - } - - public ArmorItem.Type getType() { - return this.type; - } - - @Override - public int getEnchantmentValue() { - return this.material.value().enchantmentValue(); - } - - public Holder getMaterial() { - return this.material; - } - - @Override - public boolean isValidRepairItem(ItemStack stack, ItemStack repairCandidate) { - return ((Ingredient)this.material.value().repairIngredient().get()).test(repairCandidate) || super.isValidRepairItem(stack, repairCandidate); - } - - @Override - public InteractionResultHolder use(Level level, Player player, InteractionHand usedHand) { - return this.swapWithEquipmentSlot(this, level, player, usedHand); - } - - @Override - public ItemAttributeModifiers getDefaultAttributeModifiers() { - return (ItemAttributeModifiers)this.defaultModifiers.get(); - } - - public int getDefense() { - return this.material.value().getDefense(this.type); - } - - public float getToughness() { - return this.material.value().toughness(); - } - - @Override - public EquipmentSlot getEquipmentSlot() { - return this.type.getSlot(); - } - - @Override - public Holder getEquipSound() { - return this.getMaterial().value().equipSound(); - } - - public static enum Type implements StringRepresentable { - HELMET(EquipmentSlot.HEAD, 11, "helmet"), - CHESTPLATE(EquipmentSlot.CHEST, 16, "chestplate"), - LEGGINGS(EquipmentSlot.LEGS, 15, "leggings"), - BOOTS(EquipmentSlot.FEET, 13, "boots"), - BODY(EquipmentSlot.BODY, 16, "body"); - - public static final Codec CODEC = StringRepresentable.fromValues(ArmorItem.Type::values); - private final EquipmentSlot slot; - private final String name; - private final int durability; - - private Type(final EquipmentSlot slot, final int durability, final String name) { - this.slot = slot; - this.name = name; - this.durability = durability; - } - - public int getDurability(int durabilityFactor) { - return this.durability * durabilityFactor; - } - - public EquipmentSlot getSlot() { - return this.slot; - } - - public String getName() { - return this.name; - } - - public boolean hasTrims() { - return this == HELMET || this == CHESTPLATE || this == LEGGINGS || this == BOOTS; - } - - @Override - public String getSerializedName() { - return this.name; - } +public class ArmorItem extends Item { + public ArmorItem(ArmorMaterial armorMaterial, ArmorType armorType, Item.Properties properties) { + super(armorMaterial.humanoidProperties(properties, armorType)); } } diff --git a/net/minecraft/world/item/ArmorMaterial.java b/net/minecraft/world/item/ArmorMaterial.java deleted file mode 100644 index 73507da9..00000000 --- a/net/minecraft/world/item/ArmorMaterial.java +++ /dev/null @@ -1,63 +0,0 @@ -package net.minecraft.world.item; - -import com.mojang.serialization.Codec; -import java.util.List; -import java.util.Map; -import java.util.function.Supplier; -import java.util.function.UnaryOperator; -import net.minecraft.core.Holder; -import net.minecraft.core.registries.BuiltInRegistries; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.sounds.SoundEvent; -import net.minecraft.world.item.crafting.Ingredient; - -public record ArmorMaterial( - Map defense, - int enchantmentValue, - Holder equipSound, - Supplier repairIngredient, - List layers, - float toughness, - float knockbackResistance -) { - public static final Codec> CODEC = BuiltInRegistries.ARMOR_MATERIAL.holderByNameCodec(); - - public int getDefense(ArmorItem.Type type) { - return (Integer)this.defense.getOrDefault(type, 0); - } - - public static final class Layer { - private final ResourceLocation assetName; - private final String suffix; - private final boolean dyeable; - private final ResourceLocation innerTexture; - private final ResourceLocation outerTexture; - - public Layer(ResourceLocation assetName, String suffix, boolean dyeable) { - this.assetName = assetName; - this.suffix = suffix; - this.dyeable = dyeable; - this.innerTexture = this.resolveTexture(true); - this.outerTexture = this.resolveTexture(false); - } - - public Layer(ResourceLocation assetName) { - this(assetName, "", false); - } - - private ResourceLocation resolveTexture(boolean innerTexture) { - return this.assetName - .withPath( - (UnaryOperator)(string -> "textures/models/armor/" + this.assetName.getPath() + "_layer_" + (innerTexture ? 2 : 1) + this.suffix + ".png") - ); - } - - public ResourceLocation texture(boolean innerTexture) { - return innerTexture ? this.innerTexture : this.outerTexture; - } - - public boolean dyeable() { - return this.dyeable; - } - } -} diff --git a/net/minecraft/world/item/ArmorMaterials.java b/net/minecraft/world/item/ArmorMaterials.java deleted file mode 100644 index 6041b9be..00000000 --- a/net/minecraft/world/item/ArmorMaterials.java +++ /dev/null @@ -1,124 +0,0 @@ -package net.minecraft.world.item; - -import java.util.EnumMap; -import java.util.List; -import java.util.function.Supplier; -import net.minecraft.Util; -import net.minecraft.core.Holder; -import net.minecraft.core.Registry; -import net.minecraft.core.registries.BuiltInRegistries; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.sounds.SoundEvent; -import net.minecraft.sounds.SoundEvents; -import net.minecraft.world.item.crafting.Ingredient; - -public class ArmorMaterials { - public static final Holder LEATHER = register( - "leather", - Util.make(new EnumMap(ArmorItem.Type.class), enumMap -> { - enumMap.put(ArmorItem.Type.BOOTS, 1); - enumMap.put(ArmorItem.Type.LEGGINGS, 2); - enumMap.put(ArmorItem.Type.CHESTPLATE, 3); - enumMap.put(ArmorItem.Type.HELMET, 1); - enumMap.put(ArmorItem.Type.BODY, 3); - }), - 15, - SoundEvents.ARMOR_EQUIP_LEATHER, - 0.0F, - 0.0F, - () -> Ingredient.of(Items.LEATHER), - List.of( - new ArmorMaterial.Layer(ResourceLocation.withDefaultNamespace("leather"), "", true), - new ArmorMaterial.Layer(ResourceLocation.withDefaultNamespace("leather"), "_overlay", false) - ) - ); - public static final Holder CHAIN = register("chainmail", Util.make(new EnumMap(ArmorItem.Type.class), enumMap -> { - enumMap.put(ArmorItem.Type.BOOTS, 1); - enumMap.put(ArmorItem.Type.LEGGINGS, 4); - enumMap.put(ArmorItem.Type.CHESTPLATE, 5); - enumMap.put(ArmorItem.Type.HELMET, 2); - enumMap.put(ArmorItem.Type.BODY, 4); - }), 12, SoundEvents.ARMOR_EQUIP_CHAIN, 0.0F, 0.0F, () -> Ingredient.of(Items.IRON_INGOT)); - public static final Holder IRON = register("iron", Util.make(new EnumMap(ArmorItem.Type.class), enumMap -> { - enumMap.put(ArmorItem.Type.BOOTS, 2); - enumMap.put(ArmorItem.Type.LEGGINGS, 5); - enumMap.put(ArmorItem.Type.CHESTPLATE, 6); - enumMap.put(ArmorItem.Type.HELMET, 2); - enumMap.put(ArmorItem.Type.BODY, 5); - }), 9, SoundEvents.ARMOR_EQUIP_IRON, 0.0F, 0.0F, () -> Ingredient.of(Items.IRON_INGOT)); - public static final Holder GOLD = register("gold", Util.make(new EnumMap(ArmorItem.Type.class), enumMap -> { - enumMap.put(ArmorItem.Type.BOOTS, 1); - enumMap.put(ArmorItem.Type.LEGGINGS, 3); - enumMap.put(ArmorItem.Type.CHESTPLATE, 5); - enumMap.put(ArmorItem.Type.HELMET, 2); - enumMap.put(ArmorItem.Type.BODY, 7); - }), 25, SoundEvents.ARMOR_EQUIP_GOLD, 0.0F, 0.0F, () -> Ingredient.of(Items.GOLD_INGOT)); - public static final Holder DIAMOND = register("diamond", Util.make(new EnumMap(ArmorItem.Type.class), enumMap -> { - enumMap.put(ArmorItem.Type.BOOTS, 3); - enumMap.put(ArmorItem.Type.LEGGINGS, 6); - enumMap.put(ArmorItem.Type.CHESTPLATE, 8); - enumMap.put(ArmorItem.Type.HELMET, 3); - enumMap.put(ArmorItem.Type.BODY, 11); - }), 10, SoundEvents.ARMOR_EQUIP_DIAMOND, 2.0F, 0.0F, () -> Ingredient.of(Items.DIAMOND)); - public static final Holder TURTLE = register("turtle", Util.make(new EnumMap(ArmorItem.Type.class), enumMap -> { - enumMap.put(ArmorItem.Type.BOOTS, 2); - enumMap.put(ArmorItem.Type.LEGGINGS, 5); - enumMap.put(ArmorItem.Type.CHESTPLATE, 6); - enumMap.put(ArmorItem.Type.HELMET, 2); - enumMap.put(ArmorItem.Type.BODY, 5); - }), 9, SoundEvents.ARMOR_EQUIP_TURTLE, 0.0F, 0.0F, () -> Ingredient.of(Items.TURTLE_SCUTE)); - public static final Holder NETHERITE = register("netherite", Util.make(new EnumMap(ArmorItem.Type.class), enumMap -> { - enumMap.put(ArmorItem.Type.BOOTS, 3); - enumMap.put(ArmorItem.Type.LEGGINGS, 6); - enumMap.put(ArmorItem.Type.CHESTPLATE, 8); - enumMap.put(ArmorItem.Type.HELMET, 3); - enumMap.put(ArmorItem.Type.BODY, 11); - }), 15, SoundEvents.ARMOR_EQUIP_NETHERITE, 3.0F, 0.1F, () -> Ingredient.of(Items.NETHERITE_INGOT)); - public static final Holder ARMADILLO = register("armadillo", Util.make(new EnumMap(ArmorItem.Type.class), enumMap -> { - enumMap.put(ArmorItem.Type.BOOTS, 3); - enumMap.put(ArmorItem.Type.LEGGINGS, 6); - enumMap.put(ArmorItem.Type.CHESTPLATE, 8); - enumMap.put(ArmorItem.Type.HELMET, 3); - enumMap.put(ArmorItem.Type.BODY, 11); - }), 10, SoundEvents.ARMOR_EQUIP_WOLF, 0.0F, 0.0F, () -> Ingredient.of(Items.ARMADILLO_SCUTE)); - - public static Holder bootstrap(Registry registry) { - return LEATHER; - } - - private static Holder register( - String name, - EnumMap defense, - int enchantmentValue, - Holder equipSound, - float toughness, - float knockbackResistance, - Supplier repairIngredient - ) { - List list = List.of(new ArmorMaterial.Layer(ResourceLocation.withDefaultNamespace(name))); - return register(name, defense, enchantmentValue, equipSound, toughness, knockbackResistance, repairIngredient, list); - } - - private static Holder register( - String name, - EnumMap defense, - int enchantmentValue, - Holder equipSound, - float toughness, - float knockbackResistance, - Supplier repairIngridient, - List layers - ) { - EnumMap enumMap = new EnumMap(ArmorItem.Type.class); - - for (ArmorItem.Type type : ArmorItem.Type.values()) { - enumMap.put(type, (Integer)defense.get(type)); - } - - return Registry.registerForHolder( - BuiltInRegistries.ARMOR_MATERIAL, - ResourceLocation.withDefaultNamespace(name), - new ArmorMaterial(enumMap, enchantmentValue, equipSound, repairIngridient, layers, toughness, knockbackResistance) - ); - } -} diff --git a/net/minecraft/world/item/ArmorStandItem.java b/net/minecraft/world/item/ArmorStandItem.java index 123e149e..48e2a5e5 100644 --- a/net/minecraft/world/item/ArmorStandItem.java +++ b/net/minecraft/world/item/ArmorStandItem.java @@ -8,8 +8,8 @@ import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; import net.minecraft.util.Mth; import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; -import net.minecraft.world.entity.MobSpawnType; import net.minecraft.world.entity.decoration.ArmorStand; import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.item.context.UseOnContext; @@ -38,7 +38,7 @@ public class ArmorStandItem extends Item { if (level.noCollision(null, aABB) && level.getEntities(null, aABB).isEmpty()) { if (level instanceof ServerLevel serverLevel) { Consumer consumer = EntityType.createDefaultStackConfig(serverLevel, itemStack, context.getPlayer()); - ArmorStand armorStand = EntityType.ARMOR_STAND.create(serverLevel, consumer, blockPos, MobSpawnType.SPAWN_EGG, true, true); + ArmorStand armorStand = EntityType.ARMOR_STAND.create(serverLevel, consumer, blockPos, EntitySpawnReason.SPAWN_ITEM_USE, true, true); if (armorStand == null) { return InteractionResult.FAIL; } @@ -51,7 +51,7 @@ public class ArmorStandItem extends Item { } itemStack.shrink(1); - return InteractionResult.sidedSuccess(level.isClientSide); + return InteractionResult.SUCCESS; } else { return InteractionResult.FAIL; } diff --git a/net/minecraft/world/item/AxeItem.java b/net/minecraft/world/item/AxeItem.java index bd63d188..b30e2d1b 100644 --- a/net/minecraft/world/item/AxeItem.java +++ b/net/minecraft/world/item/AxeItem.java @@ -23,6 +23,7 @@ import net.minecraft.world.level.block.RotatedPillarBlock; import net.minecraft.world.level.block.WeatheringCopper; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.level.gameevent.GameEvent.Context; import org.jetbrains.annotations.Nullable; public class AxeItem extends DiggerItem { @@ -31,6 +32,8 @@ public class AxeItem extends DiggerItem { .put(Blocks.OAK_LOG, Blocks.STRIPPED_OAK_LOG) .put(Blocks.DARK_OAK_WOOD, Blocks.STRIPPED_DARK_OAK_WOOD) .put(Blocks.DARK_OAK_LOG, Blocks.STRIPPED_DARK_OAK_LOG) + .put(Blocks.PALE_OAK_WOOD, Blocks.STRIPPED_PALE_OAK_WOOD) + .put(Blocks.PALE_OAK_LOG, Blocks.STRIPPED_PALE_OAK_LOG) .put(Blocks.ACACIA_WOOD, Blocks.STRIPPED_ACACIA_WOOD) .put(Blocks.ACACIA_LOG, Blocks.STRIPPED_ACACIA_LOG) .put(Blocks.CHERRY_WOOD, Blocks.STRIPPED_CHERRY_WOOD) @@ -50,8 +53,8 @@ public class AxeItem extends DiggerItem { .put(Blocks.BAMBOO_BLOCK, Blocks.STRIPPED_BAMBOO_BLOCK) .build(); - public AxeItem(Tier tier, Item.Properties properties) { - super(tier, BlockTags.MINEABLE_WITH_AXE, properties); + public AxeItem(ToolMaterial toolMaterial, float f, float g, Item.Properties properties) { + super(toolMaterial, BlockTags.MINEABLE_WITH_AXE, f, g, properties); } @Override @@ -72,12 +75,12 @@ public class AxeItem extends DiggerItem { } level.setBlock(blockPos, (BlockState)optional.get(), 11); - level.gameEvent(GameEvent.BLOCK_CHANGE, blockPos, GameEvent.Context.of(player, (BlockState)optional.get())); + level.gameEvent(GameEvent.BLOCK_CHANGE, blockPos, Context.of(player, (BlockState)optional.get())); if (player != null) { itemStack.hurtAndBreak(1, player, LivingEntity.getSlotForHand(context.getHand())); } - return InteractionResult.sidedSuccess(level.isClientSide); + return InteractionResult.SUCCESS; } } } diff --git a/net/minecraft/world/item/BannerItem.java b/net/minecraft/world/item/BannerItem.java index 7c2af64f..772d018f 100644 --- a/net/minecraft/world/item/BannerItem.java +++ b/net/minecraft/world/item/BannerItem.java @@ -8,11 +8,12 @@ import net.minecraft.network.chat.Component; import net.minecraft.world.level.block.AbstractBannerBlock; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.entity.BannerPatternLayers; +import net.minecraft.world.level.block.entity.BannerPatternLayers.Layer; import org.apache.commons.lang3.Validate; public class BannerItem extends StandingAndWallBlockItem { public BannerItem(Block block, Block wallBlock, Item.Properties properties) { - super(block, wallBlock, properties, Direction.DOWN); + super(block, wallBlock, Direction.DOWN, properties); Validate.isInstanceOf(AbstractBannerBlock.class, block); Validate.isInstanceOf(AbstractBannerBlock.class, wallBlock); } @@ -21,7 +22,7 @@ public class BannerItem extends StandingAndWallBlockItem { BannerPatternLayers bannerPatternLayers = stack.get(DataComponents.BANNER_PATTERNS); if (bannerPatternLayers != null) { for (int i = 0; i < Math.min(bannerPatternLayers.layers().size(), 6); i++) { - BannerPatternLayers.Layer layer = (BannerPatternLayers.Layer)bannerPatternLayers.layers().get(i); + Layer layer = (Layer)bannerPatternLayers.layers().get(i); tooltipComponents.add(layer.description().withStyle(ChatFormatting.GRAY)); } } diff --git a/net/minecraft/world/item/BannerPatternItem.java b/net/minecraft/world/item/BannerPatternItem.java index 4a0995ad..4f37b0d3 100644 --- a/net/minecraft/world/item/BannerPatternItem.java +++ b/net/minecraft/world/item/BannerPatternItem.java @@ -1,9 +1,5 @@ package net.minecraft.world.item; -import java.util.List; -import net.minecraft.ChatFormatting; -import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.MutableComponent; import net.minecraft.tags.TagKey; import net.minecraft.world.level.block.entity.BannerPattern; @@ -18,13 +14,4 @@ public class BannerPatternItem extends Item { public TagKey getBannerPattern() { return this.bannerPattern; } - - @Override - public void appendHoverText(ItemStack stack, Item.TooltipContext context, List tooltipComponents, TooltipFlag tooltipFlag) { - tooltipComponents.add(this.getDisplayName().withStyle(ChatFormatting.GRAY)); - } - - public MutableComponent getDisplayName() { - return Component.translatable(this.getDescriptionId() + ".desc"); - } } diff --git a/net/minecraft/world/item/BlockItem.java b/net/minecraft/world/item/BlockItem.java index 54f49f0a..e7f13e95 100644 --- a/net/minecraft/world/item/BlockItem.java +++ b/net/minecraft/world/item/BlockItem.java @@ -28,6 +28,7 @@ import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.level.gameevent.GameEvent.Context; import net.minecraft.world.phys.shapes.CollisionContext; import org.jetbrains.annotations.Nullable; @@ -43,12 +44,9 @@ public class BlockItem extends Item { @Override public InteractionResult useOn(UseOnContext context) { InteractionResult interactionResult = this.place(new BlockPlaceContext(context)); - if (!interactionResult.consumesAction() && context.getItemInHand().has(DataComponents.FOOD)) { - InteractionResult interactionResult2 = super.use(context.getLevel(), context.getPlayer(), context.getHand()).getResult(); - return interactionResult2 == InteractionResult.CONSUME ? InteractionResult.CONSUME_PARTIAL : interactionResult2; - } else { - return interactionResult; - } + return !interactionResult.consumesAction() && context.getItemInHand().has(DataComponents.CONSUMABLE) + ? super.use(context.getLevel(), context.getPlayer(), context.getHand()) + : interactionResult; } public InteractionResult place(BlockPlaceContext context) { @@ -84,9 +82,9 @@ public class BlockItem extends Item { SoundType soundType = blockState2.getSoundType(); level.playSound(player, blockPos, this.getPlaceSound(blockState2), SoundSource.BLOCKS, (soundType.getVolume() + 1.0F) / 2.0F, soundType.getPitch() * 0.8F); - level.gameEvent(GameEvent.BLOCK_PLACE, blockPos, GameEvent.Context.of(player, blockState2)); + level.gameEvent(GameEvent.BLOCK_PLACE, blockPos, Context.of(player, blockState2)); itemStack.consume(1, player); - return InteractionResult.sidedSuccess(level.isClientSide); + return InteractionResult.SUCCESS; } } } @@ -169,11 +167,6 @@ public class BlockItem extends Item { } } - @Override - public String getDescriptionId() { - return this.getBlock().getDescriptionId(); - } - @Override public void appendHoverText(ItemStack stack, Item.TooltipContext context, List tooltipComponents, TooltipFlag tooltipFlag) { super.appendHoverText(stack, context, tooltipComponents, tooltipFlag); diff --git a/net/minecraft/world/item/BoatItem.java b/net/minecraft/world/item/BoatItem.java index ff5b039f..575c4a0f 100644 --- a/net/minecraft/world/item/BoatItem.java +++ b/net/minecraft/world/item/BoatItem.java @@ -1,85 +1,90 @@ package net.minecraft.world.item; import java.util.List; -import java.util.function.Predicate; import net.minecraft.server.level.ServerLevel; import net.minecraft.stats.Stats; import net.minecraft.world.InteractionHand; -import net.minecraft.world.InteractionResultHolder; +import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntitySelector; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.player.Player; -import net.minecraft.world.entity.vehicle.Boat; -import net.minecraft.world.entity.vehicle.ChestBoat; -import net.minecraft.world.level.ClipContext; +import net.minecraft.world.entity.vehicle.AbstractBoat; import net.minecraft.world.level.Level; +import net.minecraft.world.level.ClipContext.Fluid; import net.minecraft.world.level.gameevent.GameEvent; import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.HitResult; import net.minecraft.world.phys.Vec3; +import net.minecraft.world.phys.HitResult.Type; +import org.jetbrains.annotations.Nullable; public class BoatItem extends Item { - private static final Predicate ENTITY_PREDICATE = EntitySelector.NO_SPECTATORS.and(Entity::isPickable); - private final Boat.Type type; - private final boolean hasChest; + private final EntityType entityType; - public BoatItem(boolean hasChest, Boat.Type type, Item.Properties properties) { + public BoatItem(EntityType entityType, Item.Properties properties) { super(properties); - this.hasChest = hasChest; - this.type = type; + this.entityType = entityType; } @Override - public InteractionResultHolder use(Level level, Player player, InteractionHand usedHand) { - ItemStack itemStack = player.getItemInHand(usedHand); - HitResult hitResult = getPlayerPOVHitResult(level, player, ClipContext.Fluid.ANY); - if (hitResult.getType() == HitResult.Type.MISS) { - return InteractionResultHolder.pass(itemStack); + public InteractionResult use(Level level, Player player, InteractionHand interactionHand) { + ItemStack itemStack = player.getItemInHand(interactionHand); + HitResult hitResult = getPlayerPOVHitResult(level, player, Fluid.ANY); + if (hitResult.getType() == Type.MISS) { + return InteractionResult.PASS; } else { Vec3 vec3 = player.getViewVector(1.0F); double d = 5.0; - List list = level.getEntities(player, player.getBoundingBox().expandTowards(vec3.scale(5.0)).inflate(1.0), ENTITY_PREDICATE); + List list = level.getEntities(player, player.getBoundingBox().expandTowards(vec3.scale(5.0)).inflate(1.0), EntitySelector.CAN_BE_PICKED); if (!list.isEmpty()) { Vec3 vec32 = player.getEyePosition(); for (Entity entity : list) { AABB aABB = entity.getBoundingBox().inflate(entity.getPickRadius()); if (aABB.contains(vec32)) { - return InteractionResultHolder.pass(itemStack); + return InteractionResult.PASS; } } } - if (hitResult.getType() == HitResult.Type.BLOCK) { - Boat boat = this.getBoat(level, hitResult, itemStack, player); - boat.setVariant(this.type); - boat.setYRot(player.getYRot()); - if (!level.noCollision(boat, boat.getBoundingBox())) { - return InteractionResultHolder.fail(itemStack); + if (hitResult.getType() == Type.BLOCK) { + AbstractBoat abstractBoat = this.getBoat(level, hitResult, itemStack, player); + if (abstractBoat == null) { + return InteractionResult.FAIL; } else { - if (!level.isClientSide) { - level.addFreshEntity(boat); - level.gameEvent(player, GameEvent.ENTITY_PLACE, hitResult.getLocation()); - itemStack.consume(1, player); - } + abstractBoat.setYRot(player.getYRot()); + if (!level.noCollision(abstractBoat, abstractBoat.getBoundingBox())) { + return InteractionResult.FAIL; + } else { + if (!level.isClientSide) { + level.addFreshEntity(abstractBoat); + level.gameEvent(player, GameEvent.ENTITY_PLACE, hitResult.getLocation()); + itemStack.consume(1, player); + } - player.awardStat(Stats.ITEM_USED.get(this)); - return InteractionResultHolder.sidedSuccess(itemStack, level.isClientSide()); + player.awardStat(Stats.ITEM_USED.get(this)); + return InteractionResult.SUCCESS; + } } } else { - return InteractionResultHolder.pass(itemStack); + return InteractionResult.PASS; } } } - private Boat getBoat(Level level, HitResult hitResult, ItemStack stack, Player player) { - Vec3 vec3 = hitResult.getLocation(); - Boat boat = (Boat)(this.hasChest ? new ChestBoat(level, vec3.x, vec3.y, vec3.z) : new Boat(level, vec3.x, vec3.y, vec3.z)); - if (level instanceof ServerLevel serverLevel) { - EntityType.createDefaultStackConfig(serverLevel, stack, player).accept(boat); + @Nullable + private AbstractBoat getBoat(Level level, HitResult hitResult, ItemStack itemStack, Player player) { + AbstractBoat abstractBoat = this.entityType.create(level, EntitySpawnReason.SPAWN_ITEM_USE); + if (abstractBoat != null) { + Vec3 vec3 = hitResult.getLocation(); + abstractBoat.setInitialPos(vec3.x, vec3.y, vec3.z); + if (level instanceof ServerLevel serverLevel) { + EntityType.createDefaultStackConfig(serverLevel, itemStack, player).accept(abstractBoat); + } } - return boat; + return abstractBoat; } } diff --git a/net/minecraft/world/item/BoneMealItem.java b/net/minecraft/world/item/BoneMealItem.java index 368bc8eb..24957d3b 100644 --- a/net/minecraft/world/item/BoneMealItem.java +++ b/net/minecraft/world/item/BoneMealItem.java @@ -43,7 +43,7 @@ public class BoneMealItem extends Item { level.levelEvent(1505, blockPos, 15); } - return InteractionResult.sidedSuccess(level.isClientSide); + return InteractionResult.SUCCESS; } else { BlockState blockState = level.getBlockState(blockPos); boolean bl = blockState.isFaceSturdy(level, blockPos, context.getClickedFace()); @@ -53,7 +53,7 @@ public class BoneMealItem extends Item { level.levelEvent(1505, blockPos2, 15); } - return InteractionResult.sidedSuccess(level.isClientSide); + return InteractionResult.SUCCESS; } else { return InteractionResult.PASS; } @@ -84,7 +84,7 @@ public class BoneMealItem extends Item { } else { RandomSource randomSource = level.getRandom(); - label78: + label80: for (int i = 0; i < 128; i++) { BlockPos blockPos = pos; BlockState blockState = Blocks.SEAGRASS.defaultBlockState(); @@ -92,7 +92,7 @@ public class BoneMealItem extends Item { for (int j = 0; j < i / 16; j++) { blockPos = blockPos.offset(randomSource.nextInt(3) - 1, (randomSource.nextInt(3) - 1) * randomSource.nextInt(3) / 2, randomSource.nextInt(3) - 1); if (level.getBlockState(blockPos).isCollisionShapeFullBlock(level, blockPos)) { - continue label78; + continue label80; } } @@ -124,7 +124,9 @@ public class BoneMealItem extends Item { BlockState blockState2 = level.getBlockState(blockPos); if (blockState2.is(Blocks.WATER) && level.getFluidState(blockPos).getAmount() == 8) { level.setBlock(blockPos, blockState, 3); - } else if (blockState2.is(Blocks.SEAGRASS) && randomSource.nextInt(10) == 0) { + } else if (blockState2.is(Blocks.SEAGRASS) + && ((BonemealableBlock)Blocks.SEAGRASS).isValidBonemealTarget(level, blockPos, blockState2) + && randomSource.nextInt(10) == 0) { ((BonemealableBlock)Blocks.SEAGRASS).performBonemeal((ServerLevel)level, randomSource, blockPos, blockState2); } } diff --git a/net/minecraft/world/item/BookItem.java b/net/minecraft/world/item/BookItem.java deleted file mode 100644 index 3dc6704d..00000000 --- a/net/minecraft/world/item/BookItem.java +++ /dev/null @@ -1,17 +0,0 @@ -package net.minecraft.world.item; - -public class BookItem extends Item { - public BookItem(Item.Properties properties) { - super(properties); - } - - @Override - public boolean isEnchantable(ItemStack stack) { - return stack.getCount() == 1; - } - - @Override - public int getEnchantmentValue() { - return 1; - } -} diff --git a/net/minecraft/world/item/BottleItem.java b/net/minecraft/world/item/BottleItem.java index f507cd69..4e99dbb8 100644 --- a/net/minecraft/world/item/BottleItem.java +++ b/net/minecraft/world/item/BottleItem.java @@ -9,17 +9,17 @@ import net.minecraft.sounds.SoundSource; import net.minecraft.stats.Stats; import net.minecraft.tags.FluidTags; import net.minecraft.world.InteractionHand; -import net.minecraft.world.InteractionResultHolder; +import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.AreaEffectCloud; import net.minecraft.world.entity.boss.enderdragon.EnderDragon; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.alchemy.PotionContents; import net.minecraft.world.item.alchemy.Potions; -import net.minecraft.world.level.ClipContext; import net.minecraft.world.level.Level; +import net.minecraft.world.level.ClipContext.Fluid; import net.minecraft.world.level.gameevent.GameEvent; import net.minecraft.world.phys.BlockHitResult; -import net.minecraft.world.phys.HitResult; +import net.minecraft.world.phys.HitResult.Type; public class BottleItem extends Item { public BottleItem(Item.Properties properties) { @@ -27,13 +27,13 @@ public class BottleItem extends Item { } @Override - public InteractionResultHolder use(Level level, Player player, InteractionHand usedHand) { + public InteractionResult use(Level level, Player player, InteractionHand interactionHand) { List list = level.getEntitiesOfClass( AreaEffectCloud.class, player.getBoundingBox().inflate(2.0), areaEffectCloud -> areaEffectCloud != null && areaEffectCloud.isAlive() && areaEffectCloud.getOwner() instanceof EnderDragon ); - ItemStack itemStack = player.getItemInHand(usedHand); + ItemStack itemStack = player.getItemInHand(interactionHand); if (!list.isEmpty()) { AreaEffectCloud areaEffectCloud = (AreaEffectCloud)list.get(0); areaEffectCloud.setRadius(areaEffectCloud.getRadius() - 0.5F); @@ -43,28 +43,27 @@ public class BottleItem extends Item { CriteriaTriggers.PLAYER_INTERACTED_WITH_ENTITY.trigger(serverPlayer, itemStack, areaEffectCloud); } - return InteractionResultHolder.sidedSuccess(this.turnBottleIntoItem(itemStack, player, new ItemStack(Items.DRAGON_BREATH)), level.isClientSide()); + return InteractionResult.SUCCESS.heldItemTransformedTo(this.turnBottleIntoItem(itemStack, player, new ItemStack(Items.DRAGON_BREATH))); } else { - BlockHitResult blockHitResult = getPlayerPOVHitResult(level, player, ClipContext.Fluid.SOURCE_ONLY); - if (blockHitResult.getType() == HitResult.Type.MISS) { - return InteractionResultHolder.pass(itemStack); + BlockHitResult blockHitResult = getPlayerPOVHitResult(level, player, Fluid.SOURCE_ONLY); + if (blockHitResult.getType() == Type.MISS) { + return InteractionResult.PASS; } else { - if (blockHitResult.getType() == HitResult.Type.BLOCK) { + if (blockHitResult.getType() == Type.BLOCK) { BlockPos blockPos = blockHitResult.getBlockPos(); if (!level.mayInteract(player, blockPos)) { - return InteractionResultHolder.pass(itemStack); + return InteractionResult.PASS; } if (level.getFluidState(blockPos).is(FluidTags.WATER)) { level.playSound(player, player.getX(), player.getY(), player.getZ(), SoundEvents.BOTTLE_FILL, SoundSource.NEUTRAL, 1.0F, 1.0F); level.gameEvent(player, GameEvent.FLUID_PICKUP, blockPos); - return InteractionResultHolder.sidedSuccess( - this.turnBottleIntoItem(itemStack, player, PotionContents.createItemStack(Items.POTION, Potions.WATER)), level.isClientSide() - ); + return InteractionResult.SUCCESS + .heldItemTransformedTo(this.turnBottleIntoItem(itemStack, player, PotionContents.createItemStack(Items.POTION, Potions.WATER))); } } - return InteractionResultHolder.pass(itemStack); + return InteractionResult.PASS; } } } diff --git a/net/minecraft/world/item/BowItem.java b/net/minecraft/world/item/BowItem.java index dc42aed5..9d5230e4 100644 --- a/net/minecraft/world/item/BowItem.java +++ b/net/minecraft/world/item/BowItem.java @@ -7,7 +7,7 @@ import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; import net.minecraft.stats.Stats; import net.minecraft.world.InteractionHand; -import net.minecraft.world.InteractionResultHolder; +import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.projectile.Projectile; @@ -23,16 +23,22 @@ public class BowItem extends ProjectileWeaponItem { } @Override - public void releaseUsing(ItemStack stack, Level level, LivingEntity livingEntity, int timeCharged) { - if (livingEntity instanceof Player player) { - ItemStack itemStack = player.getProjectile(stack); - if (!itemStack.isEmpty()) { - int i = this.getUseDuration(stack, livingEntity) - timeCharged; - float f = getPowerForTime(i); - if (!(f < 0.1)) { - List list = draw(stack, itemStack, player); + public boolean releaseUsing(ItemStack itemStack, Level level, LivingEntity livingEntity, int i) { + if (!(livingEntity instanceof Player player)) { + return false; + } else { + ItemStack itemStack2 = player.getProjectile(itemStack); + if (itemStack2.isEmpty()) { + return false; + } else { + int j = this.getUseDuration(itemStack, livingEntity) - i; + float f = getPowerForTime(j); + if (f < 0.1) { + return false; + } else { + List list = draw(itemStack, itemStack2, player); if (level instanceof ServerLevel serverLevel && !list.isEmpty()) { - this.shoot(serverLevel, player, player.getUsedItemHand(), stack, list, f * 3.0F, 1.0F, f == 1.0F, null); + this.shoot(serverLevel, player, player.getUsedItemHand(), itemStack, list, f * 3.0F, 1.0F, f == 1.0F, null); } level.playSound( @@ -46,6 +52,7 @@ public class BowItem extends ProjectileWeaponItem { 1.0F / (level.getRandom().nextFloat() * 0.4F + 1.2F) + f * 0.5F ); player.awardStat(Stats.ITEM_USED.get(this)); + return true; } } } @@ -77,19 +84,19 @@ public class BowItem extends ProjectileWeaponItem { } @Override - public UseAnim getUseAnimation(ItemStack stack) { - return UseAnim.BOW; + public ItemUseAnimation getUseAnimation(ItemStack itemStack) { + return ItemUseAnimation.BOW; } @Override - public InteractionResultHolder use(Level level, Player player, InteractionHand usedHand) { - ItemStack itemStack = player.getItemInHand(usedHand); + public InteractionResult use(Level level, Player player, InteractionHand interactionHand) { + ItemStack itemStack = player.getItemInHand(interactionHand); boolean bl = !player.getProjectile(itemStack).isEmpty(); if (!player.hasInfiniteMaterials() && !bl) { - return InteractionResultHolder.fail(itemStack); + return InteractionResult.FAIL; } else { - player.startUsingItem(usedHand); - return InteractionResultHolder.consume(itemStack); + player.startUsingItem(interactionHand); + return InteractionResult.CONSUME; } } diff --git a/net/minecraft/world/item/BrushItem.java b/net/minecraft/world/item/BrushItem.java index ef807baf..d17675bb 100644 --- a/net/minecraft/world/item/BrushItem.java +++ b/net/minecraft/world/item/BrushItem.java @@ -4,11 +4,13 @@ import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.particles.BlockParticleOption; import net.minecraft.core.particles.ParticleTypes; +import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.EntitySelector; import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.HumanoidArm; import net.minecraft.world.entity.LivingEntity; @@ -23,6 +25,7 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.HitResult; import net.minecraft.world.phys.Vec3; +import net.minecraft.world.phys.HitResult.Type; public class BrushItem extends Item { public static final int ANIMATION_DURATION = 10; @@ -35,7 +38,7 @@ public class BrushItem extends Item { @Override public InteractionResult useOn(UseOnContext context) { Player player = context.getPlayer(); - if (player != null && this.calculateHitResult(player).getType() == HitResult.Type.BLOCK) { + if (player != null && this.calculateHitResult(player).getType() == Type.BLOCK) { player.startUsingItem(context.getHand()); } @@ -43,8 +46,8 @@ public class BrushItem extends Item { } @Override - public UseAnim getUseAnimation(ItemStack stack) { - return UseAnim.BRUSH; + public ItemUseAnimation getUseAnimation(ItemStack itemStack) { + return ItemUseAnimation.BRUSH; } @Override @@ -56,7 +59,7 @@ public class BrushItem extends Item { public void onUseTick(Level level, LivingEntity livingEntity, ItemStack stack, int remainingUseDuration) { if (remainingUseDuration >= 0 && livingEntity instanceof Player player) { HitResult hitResult = this.calculateHitResult(player); - if (hitResult instanceof BlockHitResult blockHitResult && hitResult.getType() == HitResult.Type.BLOCK) { + if (hitResult instanceof BlockHitResult blockHitResult && hitResult.getType() == Type.BLOCK) { int i = this.getUseDuration(stack, livingEntity) - remainingUseDuration + 1; boolean bl = i % 10 == 5; if (bl) { @@ -75,11 +78,11 @@ public class BrushItem extends Item { } level.playSound(player, blockPos, soundEvent, SoundSource.BLOCKS); - if (!level.isClientSide() && level.getBlockEntity(blockPos) instanceof BrushableBlockEntity brushableBlockEntity) { - boolean bl2 = brushableBlockEntity.brush(level.getGameTime(), player, blockHitResult.getDirection()); + if (level instanceof ServerLevel serverLevel && level.getBlockEntity(blockPos) instanceof BrushableBlockEntity brushableBlockEntity) { + boolean bl2 = brushableBlockEntity.brush(level.getGameTime(), serverLevel, player, blockHitResult.getDirection(), stack); if (bl2) { EquipmentSlot equipmentSlot = stack.equals(player.getItemBySlot(EquipmentSlot.OFFHAND)) ? EquipmentSlot.OFFHAND : EquipmentSlot.MAINHAND; - stack.hurtAndBreak(1, livingEntity, equipmentSlot); + stack.hurtAndBreak(1, player, equipmentSlot); } } } @@ -92,7 +95,7 @@ public class BrushItem extends Item { } private HitResult calculateHitResult(Player player) { - return ProjectileUtil.getHitResultOnViewVector(player, entity -> !entity.isSpectator() && entity.isPickable(), player.blockInteractionRange()); + return ProjectileUtil.getHitResultOnViewVector(player, EntitySelector.CAN_BE_PICKED, player.blockInteractionRange()); } private void spawnDustParticles(Level level, BlockHitResult hitResult, BlockState state, Vec3 pos, HumanoidArm arm) { diff --git a/net/minecraft/world/item/BucketItem.java b/net/minecraft/world/item/BucketItem.java index cea45caf..6ec2f333 100644 --- a/net/minecraft/world/item/BucketItem.java +++ b/net/minecraft/world/item/BucketItem.java @@ -11,9 +11,8 @@ import net.minecraft.sounds.SoundSource; import net.minecraft.stats.Stats; import net.minecraft.tags.FluidTags; import net.minecraft.world.InteractionHand; -import net.minecraft.world.InteractionResultHolder; +import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.player.Player; -import net.minecraft.world.level.ClipContext; import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.block.Block; @@ -25,7 +24,7 @@ import net.minecraft.world.level.material.FlowingFluid; import net.minecraft.world.level.material.Fluid; import net.minecraft.world.level.material.Fluids; import net.minecraft.world.phys.BlockHitResult; -import net.minecraft.world.phys.HitResult; +import net.minecraft.world.phys.HitResult.Type; import org.jetbrains.annotations.Nullable; public class BucketItem extends Item implements DispensibleContainerItem { @@ -37,19 +36,21 @@ public class BucketItem extends Item implements DispensibleContainerItem { } @Override - public InteractionResultHolder use(Level level, Player player, InteractionHand usedHand) { - ItemStack itemStack = player.getItemInHand(usedHand); - BlockHitResult blockHitResult = getPlayerPOVHitResult(level, player, this.content == Fluids.EMPTY ? ClipContext.Fluid.SOURCE_ONLY : ClipContext.Fluid.NONE); - if (blockHitResult.getType() == HitResult.Type.MISS) { - return InteractionResultHolder.pass(itemStack); - } else if (blockHitResult.getType() != HitResult.Type.BLOCK) { - return InteractionResultHolder.pass(itemStack); + public InteractionResult use(Level level, Player player, InteractionHand interactionHand) { + ItemStack itemStack = player.getItemInHand(interactionHand); + BlockHitResult blockHitResult = getPlayerPOVHitResult( + level, player, this.content == Fluids.EMPTY ? net.minecraft.world.level.ClipContext.Fluid.SOURCE_ONLY : net.minecraft.world.level.ClipContext.Fluid.NONE + ); + if (blockHitResult.getType() == Type.MISS) { + return InteractionResult.PASS; + } else if (blockHitResult.getType() != Type.BLOCK) { + return InteractionResult.PASS; } else { BlockPos blockPos = blockHitResult.getBlockPos(); Direction direction = blockHitResult.getDirection(); BlockPos blockPos2 = blockPos.relative(direction); if (!level.mayInteract(player, blockPos) || !player.mayUseItemAt(blockPos2, direction, itemStack)) { - return InteractionResultHolder.fail(itemStack); + return InteractionResult.FAIL; } else if (this.content == Fluids.EMPTY) { BlockState blockState = level.getBlockState(blockPos); if (blockState.getBlock() instanceof BucketPickup bucketPickup) { @@ -63,11 +64,11 @@ public class BucketItem extends Item implements DispensibleContainerItem { CriteriaTriggers.FILLED_BUCKET.trigger((ServerPlayer)player, itemStack2); } - return InteractionResultHolder.sidedSuccess(itemStack3, level.isClientSide()); + return InteractionResult.SUCCESS.heldItemTransformedTo(itemStack3); } } - return InteractionResultHolder.fail(itemStack); + return InteractionResult.FAIL; } else { BlockState blockState = level.getBlockState(blockPos); BlockPos blockPos3 = blockState.getBlock() instanceof LiquidBlockContainer && this.content == Fluids.WATER ? blockPos : blockPos2; @@ -79,9 +80,9 @@ public class BucketItem extends Item implements DispensibleContainerItem { player.awardStat(Stats.ITEM_USED.get(this)); ItemStack itemStack2 = ItemUtils.createFilledResult(itemStack, player, getEmptySuccessItem(itemStack, player)); - return InteractionResultHolder.sidedSuccess(itemStack2, level.isClientSide()); + return InteractionResult.SUCCESS.heldItemTransformedTo(itemStack2); } else { - return InteractionResultHolder.fail(itemStack); + return InteractionResult.FAIL; } } } diff --git a/net/minecraft/world/item/BundleItem.java b/net/minecraft/world/item/BundleItem.java index 077fb09e..eb4118e1 100644 --- a/net/minecraft/world/item/BundleItem.java +++ b/net/minecraft/world/item/BundleItem.java @@ -2,19 +2,22 @@ package net.minecraft.world.item; import java.util.List; import java.util.Optional; -import net.minecraft.ChatFormatting; +import java.util.stream.Stream; import net.minecraft.core.component.DataComponents; -import net.minecraft.network.chat.Component; -import net.minecraft.server.level.ServerPlayer; +import net.minecraft.resources.ResourceLocation; import net.minecraft.sounds.SoundEvents; +import net.minecraft.sounds.SoundSource; import net.minecraft.stats.Stats; +import net.minecraft.util.ARGB; import net.minecraft.util.Mth; import net.minecraft.world.InteractionHand; -import net.minecraft.world.InteractionResultHolder; +import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.SlotAccess; import net.minecraft.world.entity.item.ItemEntity; import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.AbstractContainerMenu; import net.minecraft.world.inventory.ClickAction; import net.minecraft.world.inventory.Slot; import net.minecraft.world.inventory.tooltip.BundleTooltip; @@ -24,11 +27,22 @@ import net.minecraft.world.level.Level; import org.apache.commons.lang3.math.Fraction; public class BundleItem extends Item { - private static final int BAR_COLOR = Mth.color(0.4F, 0.4F, 1.0F); - private static final int TOOLTIP_MAX_WEIGHT = 64; + public static final int MAX_SHOWN_GRID_ITEMS_X = 4; + public static final int MAX_SHOWN_GRID_ITEMS_Y = 3; + public static final int MAX_SHOWN_GRID_ITEMS = 12; + public static final int OVERFLOWING_MAX_SHOWN_GRID_ITEMS = 11; + private static final int FULL_BAR_COLOR = ARGB.colorFromFloat(1.0F, 1.0F, 0.33F, 0.33F); + private static final int BAR_COLOR = ARGB.colorFromFloat(1.0F, 0.44F, 0.53F, 1.0F); + private static final int TICKS_AFTER_FIRST_THROW = 10; + private static final int TICKS_BETWEEN_THROWS = 2; + private static final int TICKS_MAX_THROW_DURATION = 200; + private final ResourceLocation openFrontModel; + private final ResourceLocation openBackModel; - public BundleItem(Item.Properties properties) { + public BundleItem(ResourceLocation resourceLocation, ResourceLocation resourceLocation2, Item.Properties properties) { super(properties); + this.openFrontModel = resourceLocation; + this.openBackModel = resourceLocation2; } public static float getFullnessDisplay(ItemStack stack) { @@ -36,75 +50,107 @@ public class BundleItem extends Item { return bundleContents.weight().floatValue(); } + public ResourceLocation openFrontModel() { + return this.openFrontModel; + } + + public ResourceLocation openBackModel() { + return this.openBackModel; + } + @Override public boolean overrideStackedOnOther(ItemStack stack, Slot slot, ClickAction action, Player player) { - if (action != ClickAction.SECONDARY) { + BundleContents bundleContents = stack.get(DataComponents.BUNDLE_CONTENTS); + if (bundleContents == null) { return false; } else { - BundleContents bundleContents = stack.get(DataComponents.BUNDLE_CONTENTS); - if (bundleContents == null) { - return false; - } else { - ItemStack itemStack = slot.getItem(); - BundleContents.Mutable mutable = new BundleContents.Mutable(bundleContents); - if (itemStack.isEmpty()) { - this.playRemoveOneSound(player); - ItemStack itemStack2 = mutable.removeOne(); - if (itemStack2 != null) { - ItemStack itemStack3 = slot.safeInsert(itemStack2); + ItemStack itemStack = slot.getItem(); + BundleContents.Mutable mutable = new BundleContents.Mutable(bundleContents); + if (action == ClickAction.PRIMARY && !itemStack.isEmpty()) { + if (mutable.tryTransfer(slot, player) > 0) { + playInsertSound(player); + } else { + playInsertFailSound(player); + } + + stack.set(DataComponents.BUNDLE_CONTENTS, mutable.toImmutable()); + this.broadcastChangesOnContainerMenu(player); + return true; + } else if (action == ClickAction.SECONDARY && itemStack.isEmpty()) { + ItemStack itemStack2 = mutable.removeOne(); + if (itemStack2 != null) { + ItemStack itemStack3 = slot.safeInsert(itemStack2); + if (itemStack3.getCount() > 0) { mutable.tryInsert(itemStack3); - } - } else if (itemStack.getItem().canFitInsideContainerItems()) { - int i = mutable.tryTransfer(slot, player); - if (i > 0) { - this.playInsertSound(player); + } else { + playRemoveOneSound(player); } } stack.set(DataComponents.BUNDLE_CONTENTS, mutable.toImmutable()); + this.broadcastChangesOnContainerMenu(player); return true; + } else { + return false; } } } @Override public boolean overrideOtherStackedOnMe(ItemStack stack, ItemStack other, Slot slot, ClickAction action, Player player, SlotAccess access) { - if (action == ClickAction.SECONDARY && slot.allowModification(player)) { + if (action == ClickAction.PRIMARY && other.isEmpty()) { + toggleSelectedItem(stack, -1); + return false; + } else { BundleContents bundleContents = stack.get(DataComponents.BUNDLE_CONTENTS); if (bundleContents == null) { return false; } else { BundleContents.Mutable mutable = new BundleContents.Mutable(bundleContents); - if (other.isEmpty()) { - ItemStack itemStack = mutable.removeOne(); - if (itemStack != null) { - this.playRemoveOneSound(player); - access.set(itemStack); + if (action == ClickAction.PRIMARY && !other.isEmpty()) { + if (slot.allowModification(player) && mutable.tryInsert(other) > 0) { + playInsertSound(player); + } else { + playInsertFailSound(player); } - } else { - int i = mutable.tryInsert(other); - if (i > 0) { - this.playInsertSound(player); - } - } - stack.set(DataComponents.BUNDLE_CONTENTS, mutable.toImmutable()); - return true; + stack.set(DataComponents.BUNDLE_CONTENTS, mutable.toImmutable()); + this.broadcastChangesOnContainerMenu(player); + return true; + } else if (action == ClickAction.SECONDARY && other.isEmpty()) { + if (slot.allowModification(player)) { + ItemStack itemStack = mutable.removeOne(); + if (itemStack != null) { + playRemoveOneSound(player); + access.set(itemStack); + } + } + + stack.set(DataComponents.BUNDLE_CONTENTS, mutable.toImmutable()); + this.broadcastChangesOnContainerMenu(player); + return true; + } else { + toggleSelectedItem(stack, -1); + return false; + } } - } else { - return false; } } @Override - public InteractionResultHolder use(Level level, Player player, InteractionHand usedHand) { - ItemStack itemStack = player.getItemInHand(usedHand); - if (dropContents(itemStack, player)) { - this.playDropContentsSound(player); - player.awardStat(Stats.ITEM_USED.get(this)); - return InteractionResultHolder.sidedSuccess(itemStack, level.isClientSide()); + public InteractionResult use(Level level, Player player, InteractionHand interactionHand) { + if (level.isClientSide) { + return InteractionResult.CONSUME; } else { - return InteractionResultHolder.fail(itemStack); + player.startUsingItem(interactionHand); + return InteractionResult.SUCCESS_SERVER; + } + } + + private void dropContent(Level level, Player player, ItemStack itemStack) { + if (this.dropContent(itemStack, player)) { + playDropContentsSound(level, player); + player.awardStat(Stats.ITEM_USED.get(this)); } } @@ -122,23 +168,82 @@ public class BundleItem extends Item { @Override public int getBarColor(ItemStack stack) { - return BAR_COLOR; + BundleContents bundleContents = stack.getOrDefault(DataComponents.BUNDLE_CONTENTS, BundleContents.EMPTY); + return bundleContents.weight().compareTo(Fraction.ONE) >= 0 ? FULL_BAR_COLOR : BAR_COLOR; } - private static boolean dropContents(ItemStack stack, Player player) { - BundleContents bundleContents = stack.get(DataComponents.BUNDLE_CONTENTS); - if (bundleContents != null && !bundleContents.isEmpty()) { - stack.set(DataComponents.BUNDLE_CONTENTS, BundleContents.EMPTY); - if (player instanceof ServerPlayer) { - bundleContents.itemsCopy().forEach(itemStack -> player.drop(itemStack, true)); - } + public static void toggleSelectedItem(ItemStack itemStack, int i) { + BundleContents bundleContents = itemStack.get(DataComponents.BUNDLE_CONTENTS); + if (bundleContents != null) { + BundleContents.Mutable mutable = new BundleContents.Mutable(bundleContents); + mutable.toggleSelectedItem(i); + itemStack.set(DataComponents.BUNDLE_CONTENTS, mutable.toImmutable()); + } + } - return true; + public static boolean hasSelectedItem(ItemStack itemStack) { + BundleContents bundleContents = itemStack.getOrDefault(DataComponents.BUNDLE_CONTENTS, BundleContents.EMPTY); + return bundleContents.getSelectedItem() != -1; + } + + public static int getSelectedItem(ItemStack itemStack) { + BundleContents bundleContents = itemStack.getOrDefault(DataComponents.BUNDLE_CONTENTS, BundleContents.EMPTY); + return bundleContents.getSelectedItem(); + } + + public static ItemStack getSelectedItemStack(ItemStack itemStack) { + BundleContents bundleContents = itemStack.getOrDefault(DataComponents.BUNDLE_CONTENTS, BundleContents.EMPTY); + return bundleContents.getItemUnsafe(bundleContents.getSelectedItem()); + } + + public static int getNumberOfItemsToShow(ItemStack itemStack) { + BundleContents bundleContents = itemStack.getOrDefault(DataComponents.BUNDLE_CONTENTS, BundleContents.EMPTY); + return bundleContents.getNumberOfItemsToShow(); + } + + private boolean dropContent(ItemStack itemStack, Player player) { + BundleContents bundleContents = itemStack.get(DataComponents.BUNDLE_CONTENTS); + if (bundleContents != null && !bundleContents.isEmpty()) { + Optional optional = removeOneItemFromBundle(itemStack, player, bundleContents); + if (optional.isPresent()) { + player.drop((ItemStack)optional.get(), true); + return true; + } else { + return false; + } } else { return false; } } + private static Optional removeOneItemFromBundle(ItemStack itemStack, Player player, BundleContents bundleContents) { + BundleContents.Mutable mutable = new BundleContents.Mutable(bundleContents); + ItemStack itemStack2 = mutable.removeOne(); + if (itemStack2 != null) { + playRemoveOneSound(player); + itemStack.set(DataComponents.BUNDLE_CONTENTS, mutable.toImmutable()); + return Optional.of(itemStack2); + } else { + return Optional.empty(); + } + } + + @Override + public void onUseTick(Level level, LivingEntity livingEntity, ItemStack stack, int remainingUseDuration) { + if (!level.isClientSide && livingEntity instanceof Player player) { + int i = this.getUseDuration(stack, livingEntity); + boolean bl = remainingUseDuration == i; + if (bl || remainingUseDuration < i - 10 && remainingUseDuration % 2 == 0) { + this.dropContent(level, player, stack); + } + } + } + + @Override + public int getUseDuration(ItemStack stack, LivingEntity entity) { + return 200; + } + @Override public Optional getTooltipImage(ItemStack stack) { return !stack.has(DataComponents.HIDE_TOOLTIP) && !stack.has(DataComponents.HIDE_ADDITIONAL_TOOLTIP) @@ -146,15 +251,6 @@ public class BundleItem extends Item { : Optional.empty(); } - @Override - public void appendHoverText(ItemStack stack, Item.TooltipContext context, List tooltipComponents, TooltipFlag tooltipFlag) { - BundleContents bundleContents = stack.get(DataComponents.BUNDLE_CONTENTS); - if (bundleContents != null) { - int i = Mth.mulAndTruncate(bundleContents.weight(), 64); - tooltipComponents.add(Component.translatable("item.minecraft.bundle.fullness", i, 64).withStyle(ChatFormatting.GRAY)); - } - } - @Override public void onDestroyed(ItemEntity itemEntity) { BundleContents bundleContents = itemEntity.getItem().get(DataComponents.BUNDLE_CONTENTS); @@ -164,15 +260,73 @@ public class BundleItem extends Item { } } - private void playRemoveOneSound(Entity entity) { + public static List getAllBundleItemColors() { + return Stream.of( + Items.BUNDLE, + Items.WHITE_BUNDLE, + Items.ORANGE_BUNDLE, + Items.MAGENTA_BUNDLE, + Items.LIGHT_BLUE_BUNDLE, + Items.YELLOW_BUNDLE, + Items.LIME_BUNDLE, + Items.PINK_BUNDLE, + Items.GRAY_BUNDLE, + Items.LIGHT_GRAY_BUNDLE, + Items.CYAN_BUNDLE, + Items.BLACK_BUNDLE, + Items.BROWN_BUNDLE, + Items.GREEN_BUNDLE, + Items.RED_BUNDLE, + Items.BLUE_BUNDLE, + Items.PURPLE_BUNDLE + ) + .map(item -> (BundleItem)item) + .toList(); + } + + public static Item getByColor(DyeColor dyeColor) { + return switch (dyeColor) { + case WHITE -> Items.WHITE_BUNDLE; + case ORANGE -> Items.ORANGE_BUNDLE; + case MAGENTA -> Items.MAGENTA_BUNDLE; + case LIGHT_BLUE -> Items.LIGHT_BLUE_BUNDLE; + case YELLOW -> Items.YELLOW_BUNDLE; + case LIME -> Items.LIME_BUNDLE; + case PINK -> Items.PINK_BUNDLE; + case GRAY -> Items.GRAY_BUNDLE; + case LIGHT_GRAY -> Items.LIGHT_GRAY_BUNDLE; + case CYAN -> Items.CYAN_BUNDLE; + case BLUE -> Items.BLUE_BUNDLE; + case BROWN -> Items.BROWN_BUNDLE; + case GREEN -> Items.GREEN_BUNDLE; + case RED -> Items.RED_BUNDLE; + case BLACK -> Items.BLACK_BUNDLE; + case PURPLE -> Items.PURPLE_BUNDLE; + }; + } + + private static void playRemoveOneSound(Entity entity) { entity.playSound(SoundEvents.BUNDLE_REMOVE_ONE, 0.8F, 0.8F + entity.level().getRandom().nextFloat() * 0.4F); } - private void playInsertSound(Entity entity) { + private static void playInsertSound(Entity entity) { entity.playSound(SoundEvents.BUNDLE_INSERT, 0.8F, 0.8F + entity.level().getRandom().nextFloat() * 0.4F); } - private void playDropContentsSound(Entity entity) { - entity.playSound(SoundEvents.BUNDLE_DROP_CONTENTS, 0.8F, 0.8F + entity.level().getRandom().nextFloat() * 0.4F); + private static void playInsertFailSound(Entity entity) { + entity.playSound(SoundEvents.BUNDLE_INSERT_FAIL, 1.0F, 1.0F); + } + + private static void playDropContentsSound(Level level, Entity entity) { + level.playSound( + null, entity.blockPosition(), SoundEvents.BUNDLE_DROP_CONTENTS, SoundSource.PLAYERS, 0.8F, 0.8F + entity.level().getRandom().nextFloat() * 0.4F + ); + } + + private void broadcastChangesOnContainerMenu(Player player) { + AbstractContainerMenu abstractContainerMenu = player.containerMenu; + if (abstractContainerMenu != null) { + abstractContainerMenu.slotsChanged(player.getInventory()); + } } } diff --git a/net/minecraft/world/item/ChorusFruitItem.java b/net/minecraft/world/item/ChorusFruitItem.java deleted file mode 100644 index 952b8bad..00000000 --- a/net/minecraft/world/item/ChorusFruitItem.java +++ /dev/null @@ -1,63 +0,0 @@ -package net.minecraft.world.item; - -import net.minecraft.server.level.ServerLevel; -import net.minecraft.sounds.SoundEvent; -import net.minecraft.sounds.SoundEvents; -import net.minecraft.sounds.SoundSource; -import net.minecraft.util.Mth; -import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.entity.animal.Fox; -import net.minecraft.world.entity.player.Player; -import net.minecraft.world.level.Level; -import net.minecraft.world.level.gameevent.GameEvent; -import net.minecraft.world.phys.Vec3; - -public class ChorusFruitItem extends Item { - public ChorusFruitItem(Item.Properties properties) { - super(properties); - } - - @Override - public ItemStack finishUsingItem(ItemStack stack, Level level, LivingEntity livingEntity) { - ItemStack itemStack = super.finishUsingItem(stack, level, livingEntity); - if (!level.isClientSide) { - for (int i = 0; i < 16; i++) { - double d = livingEntity.getX() + (livingEntity.getRandom().nextDouble() - 0.5) * 16.0; - double e = Mth.clamp( - livingEntity.getY() + (livingEntity.getRandom().nextInt(16) - 8), - (double)level.getMinBuildHeight(), - (double)(level.getMinBuildHeight() + ((ServerLevel)level).getLogicalHeight() - 1) - ); - double f = livingEntity.getZ() + (livingEntity.getRandom().nextDouble() - 0.5) * 16.0; - if (livingEntity.isPassenger()) { - livingEntity.stopRiding(); - } - - Vec3 vec3 = livingEntity.position(); - if (livingEntity.randomTeleport(d, e, f, true)) { - level.gameEvent(GameEvent.TELEPORT, vec3, GameEvent.Context.of(livingEntity)); - SoundSource soundSource; - SoundEvent soundEvent; - if (livingEntity instanceof Fox) { - soundEvent = SoundEvents.FOX_TELEPORT; - soundSource = SoundSource.NEUTRAL; - } else { - soundEvent = SoundEvents.CHORUS_FRUIT_TELEPORT; - soundSource = SoundSource.PLAYERS; - } - - level.playSound(null, livingEntity.getX(), livingEntity.getY(), livingEntity.getZ(), soundEvent, soundSource); - livingEntity.resetFallDistance(); - break; - } - } - - if (livingEntity instanceof Player player) { - player.resetCurrentImpulseContext(); - player.getCooldowns().addCooldown(this, 20); - } - } - - return itemStack; - } -} diff --git a/net/minecraft/world/item/CompassItem.java b/net/minecraft/world/item/CompassItem.java index 2c817809..7aa9d9c3 100644 --- a/net/minecraft/world/item/CompassItem.java +++ b/net/minecraft/world/item/CompassItem.java @@ -4,6 +4,7 @@ import java.util.Optional; import net.minecraft.core.BlockPos; import net.minecraft.core.GlobalPos; import net.minecraft.core.component.DataComponents; +import net.minecraft.network.chat.Component; import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; @@ -17,6 +18,8 @@ import net.minecraft.world.level.block.Blocks; import org.jetbrains.annotations.Nullable; public class CompassItem extends Item { + private static final Component LODESTONE_COMPASS_NAME = Component.translatable("item.minecraft.lodestone_compass"); + public CompassItem(Item.Properties properties) { super(properties); } @@ -67,12 +70,12 @@ public class CompassItem extends Item { } } - return InteractionResult.sidedSuccess(level.isClientSide); + return InteractionResult.SUCCESS; } } @Override - public String getDescriptionId(ItemStack stack) { - return stack.has(DataComponents.LODESTONE_TRACKER) ? "item.minecraft.lodestone_compass" : super.getDescriptionId(stack); + public Component getName(ItemStack stack) { + return stack.has(DataComponents.LODESTONE_TRACKER) ? LODESTONE_COMPASS_NAME : super.getName(stack); } } diff --git a/net/minecraft/world/item/ComplexItem.java b/net/minecraft/world/item/ComplexItem.java deleted file mode 100644 index 146ee57c..00000000 --- a/net/minecraft/world/item/ComplexItem.java +++ /dev/null @@ -1,22 +0,0 @@ -package net.minecraft.world.item; - -import net.minecraft.network.protocol.Packet; -import net.minecraft.world.entity.player.Player; -import net.minecraft.world.level.Level; -import org.jetbrains.annotations.Nullable; - -public class ComplexItem extends Item { - public ComplexItem(Item.Properties properties) { - super(properties); - } - - @Override - public boolean isComplex() { - return true; - } - - @Nullable - public Packet getUpdatePacket(ItemStack stack, Level level, Player player) { - return null; - } -} diff --git a/net/minecraft/world/item/CreativeModeTabs.java b/net/minecraft/world/item/CreativeModeTabs.java index 1a010542..03822279 100644 --- a/net/minecraft/world/item/CreativeModeTabs.java +++ b/net/minecraft/world/item/CreativeModeTabs.java @@ -28,12 +28,18 @@ import net.minecraft.world.entity.decoration.Painting; import net.minecraft.world.entity.decoration.PaintingVariant; import net.minecraft.world.entity.raid.Raid; import net.minecraft.world.flag.FeatureFlagSet; -import net.minecraft.world.flag.FeatureFlags; +import net.minecraft.world.item.CreativeModeTab.ItemDisplayParameters; +import net.minecraft.world.item.CreativeModeTab.Output; +import net.minecraft.world.item.CreativeModeTab.Row; +import net.minecraft.world.item.CreativeModeTab.TabVisibility; +import net.minecraft.world.item.CreativeModeTab.Type; import net.minecraft.world.item.alchemy.Potion; import net.minecraft.world.item.alchemy.PotionContents; import net.minecraft.world.item.component.CustomData; import net.minecraft.world.item.component.Fireworks; +import net.minecraft.world.item.component.OminousBottleAmplifier; import net.minecraft.world.item.enchantment.Enchantment; +import net.minecraft.world.item.enchantment.EnchantmentHelper; import net.minecraft.world.item.enchantment.EnchantmentInstance; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.LightBlock; @@ -61,7 +67,7 @@ public class CreativeModeTabs { Holder::value, Comparator.comparingInt(PaintingVariant::area).thenComparing(PaintingVariant::width) ); @Nullable - private static CreativeModeTab.ItemDisplayParameters CACHED_PARAMETERS; + private static ItemDisplayParameters CACHED_PARAMETERS; private static ResourceKey createKey(String name) { return ResourceKey.create(Registries.CREATIVE_MODE_TAB, ResourceLocation.withDefaultNamespace(name)); @@ -71,7 +77,7 @@ public class CreativeModeTabs { Registry.register( registry, BUILDING_BLOCKS, - CreativeModeTab.builder(CreativeModeTab.Row.TOP, 0) + CreativeModeTab.builder(Row.TOP, 0) .title(Component.translatable("itemGroup.buildingBlocks")) .icon(() -> new ItemStack(Blocks.BRICKS)) .displayItems((itemDisplayParameters, output) -> { @@ -179,6 +185,19 @@ public class CreativeModeTabs { output.accept(Items.CHERRY_TRAPDOOR); output.accept(Items.CHERRY_PRESSURE_PLATE); output.accept(Items.CHERRY_BUTTON); + output.accept(Items.PALE_OAK_LOG); + output.accept(Items.PALE_OAK_WOOD); + output.accept(Items.STRIPPED_PALE_OAK_LOG); + output.accept(Items.STRIPPED_PALE_OAK_WOOD); + output.accept(Items.PALE_OAK_PLANKS); + output.accept(Items.PALE_OAK_STAIRS); + output.accept(Items.PALE_OAK_SLAB); + output.accept(Items.PALE_OAK_FENCE); + output.accept(Items.PALE_OAK_FENCE_GATE); + output.accept(Items.PALE_OAK_DOOR); + output.accept(Items.PALE_OAK_TRAPDOOR); + output.accept(Items.PALE_OAK_PRESSURE_PLATE); + output.accept(Items.PALE_OAK_BUTTON); output.accept(Items.BAMBOO_BLOCK); output.accept(Items.STRIPPED_BAMBOO_BLOCK); output.accept(Items.BAMBOO_PLANKS); @@ -483,7 +502,7 @@ public class CreativeModeTabs { Registry.register( registry, COLORED_BLOCKS, - CreativeModeTab.builder(CreativeModeTab.Row.TOP, 1) + CreativeModeTab.builder(Row.TOP, 1) .title(Component.translatable("itemGroup.coloredBlocks")) .icon(() -> new ItemStack(Blocks.CYAN_WOOL)) .displayItems((itemDisplayParameters, output) -> { @@ -691,7 +710,7 @@ public class CreativeModeTabs { Registry.register( registry, NATURAL_BLOCKS, - CreativeModeTab.builder(CreativeModeTab.Row.TOP, 2) + CreativeModeTab.builder(Row.TOP, 2) .title(Component.translatable("itemGroup.natural")) .icon(() -> new ItemStack(Blocks.GRASS_BLOCK)) .displayItems((itemDisplayParameters, output) -> { @@ -717,6 +736,9 @@ public class CreativeModeTabs { output.accept(Items.SNOW); output.accept(Items.MOSS_BLOCK); output.accept(Items.MOSS_CARPET); + output.accept(Items.PALE_MOSS_BLOCK); + output.accept(Items.PALE_MOSS_CARPET); + output.accept(Items.PALE_HANGING_MOSS); output.accept(Items.STONE); output.accept(Items.DEEPSLATE); output.accept(Items.GRANITE); @@ -779,6 +801,7 @@ public class CreativeModeTabs { output.accept(Items.MANGROVE_ROOTS); output.accept(Items.MUDDY_MANGROVE_ROOTS); output.accept(Items.CHERRY_LOG); + output.accept(Items.PALE_OAK_LOG); output.accept(Items.MUSHROOM_STEM); output.accept(Items.CRIMSON_STEM); output.accept(Items.WARPED_STEM); @@ -790,6 +813,7 @@ public class CreativeModeTabs { output.accept(Items.DARK_OAK_LEAVES); output.accept(Items.MANGROVE_LEAVES); output.accept(Items.CHERRY_LEAVES); + output.accept(Items.PALE_OAK_LEAVES); output.accept(Items.AZALEA_LEAVES); output.accept(Items.FLOWERING_AZALEA_LEAVES); output.accept(Items.BROWN_MUSHROOM_BLOCK); @@ -805,6 +829,7 @@ public class CreativeModeTabs { output.accept(Items.DARK_OAK_SAPLING); output.accept(Items.MANGROVE_PROPAGULE); output.accept(Items.CHERRY_SAPLING); + output.accept(Items.PALE_OAK_SAPLING); output.accept(Items.AZALEA); output.accept(Items.FLOWERING_AZALEA); output.accept(Items.BROWN_MUSHROOM); @@ -927,7 +952,7 @@ public class CreativeModeTabs { Registry.register( registry, FUNCTIONAL_BLOCKS, - CreativeModeTab.builder(CreativeModeTab.Row.TOP, 3) + CreativeModeTab.builder(Row.TOP, 3) .title(Component.translatable("itemGroup.functional")) .icon(() -> new ItemStack(Items.OAK_SIGN)) .displayItems( @@ -1000,11 +1025,7 @@ public class CreativeModeTabs { .lookup(Registries.PAINTING_VARIANT) .ifPresent( registryLookup -> generatePresetPaintings( - output, - itemDisplayParameters.holders(), - registryLookup, - holder -> holder.is(PaintingVariantTags.PLACEABLE), - CreativeModeTab.TabVisibility.PARENT_AND_SEARCH_TABS + output, itemDisplayParameters.holders(), registryLookup, holder -> holder.is(PaintingVariantTags.PLACEABLE), TabVisibility.PARENT_AND_SEARCH_TABS ) ); output.accept(Items.BOOKSHELF); @@ -1027,6 +1048,8 @@ public class CreativeModeTabs { output.accept(Items.MANGROVE_HANGING_SIGN); output.accept(Items.CHERRY_SIGN); output.accept(Items.CHERRY_HANGING_SIGN); + output.accept(Items.PALE_OAK_SIGN); + output.accept(Items.PALE_OAK_HANGING_SIGN); output.accept(Items.BAMBOO_SIGN); output.accept(Items.BAMBOO_HANGING_SIGN); output.accept(Items.CRIMSON_SIGN); @@ -1103,7 +1126,7 @@ public class CreativeModeTabs { output.accept(Items.PURPLE_BANNER); output.accept(Items.MAGENTA_BANNER); output.accept(Items.PINK_BANNER); - output.accept(Raid.getLeaderBannerInstance(itemDisplayParameters.holders().lookupOrThrow(Registries.BANNER_PATTERN))); + output.accept(Raid.getOminousBannerInstance(itemDisplayParameters.holders().lookupOrThrow(Registries.BANNER_PATTERN))); output.accept(Items.SKELETON_SKULL); output.accept(Items.WITHER_SKELETON_SKULL); output.accept(Items.PLAYER_HEAD); @@ -1129,7 +1152,7 @@ public class CreativeModeTabs { Registry.register( registry, REDSTONE_BLOCKS, - CreativeModeTab.builder(CreativeModeTab.Row.TOP, 4) + CreativeModeTab.builder(Row.TOP, 4) .title(Component.translatable("itemGroup.redstone")) .icon(() -> new ItemStack(Items.REDSTONE)) .displayItems((itemDisplayParameters, output) -> { @@ -1207,24 +1230,24 @@ public class CreativeModeTabs { Registry.register( registry, HOTBAR, - CreativeModeTab.builder(CreativeModeTab.Row.TOP, 5) + CreativeModeTab.builder(Row.TOP, 5) .title(Component.translatable("itemGroup.hotbar")) .icon(() -> new ItemStack(Blocks.BOOKSHELF)) .alignedRight() - .type(CreativeModeTab.Type.HOTBAR) + .type(Type.HOTBAR) .build() ); Registry.register( registry, SEARCH, - CreativeModeTab.builder(CreativeModeTab.Row.TOP, 6) + CreativeModeTab.builder(Row.TOP, 6) .title(Component.translatable("itemGroup.search")) .icon(() -> new ItemStack(Items.COMPASS)) .displayItems((itemDisplayParameters, output) -> { Set set = ItemStackLinkedSet.createTypeAndComponentsSet(); for (CreativeModeTab creativeModeTab : registry) { - if (creativeModeTab.getType() != CreativeModeTab.Type.SEARCH) { + if (creativeModeTab.getType() != Type.SEARCH) { set.addAll(creativeModeTab.getSearchTabDisplayItems()); } } @@ -1233,13 +1256,13 @@ public class CreativeModeTabs { }) .backgroundTexture(SEARCH_BACKGROUND) .alignedRight() - .type(CreativeModeTab.Type.SEARCH) + .type(Type.SEARCH) .build() ); Registry.register( registry, TOOLS_AND_UTILITIES, - CreativeModeTab.builder(CreativeModeTab.Row.BOTTOM, 0) + CreativeModeTab.builder(Row.BOTTOM, 0) .title(Component.translatable("itemGroup.tools")) .icon(() -> new ItemStack(Items.DIAMOND_PICKAXE)) .displayItems( @@ -1287,10 +1310,23 @@ public class CreativeModeTabs { output.accept(Items.BRUSH); output.accept(Items.NAME_TAG); output.accept(Items.LEAD); - if (itemDisplayParameters.enabledFeatures().contains(FeatureFlags.BUNDLE)) { - output.accept(Items.BUNDLE); - } - + output.accept(Items.BUNDLE); + output.accept(Items.WHITE_BUNDLE); + output.accept(Items.LIGHT_GRAY_BUNDLE); + output.accept(Items.GRAY_BUNDLE); + output.accept(Items.BLACK_BUNDLE); + output.accept(Items.BROWN_BUNDLE); + output.accept(Items.RED_BUNDLE); + output.accept(Items.ORANGE_BUNDLE); + output.accept(Items.YELLOW_BUNDLE); + output.accept(Items.LIME_BUNDLE); + output.accept(Items.GREEN_BUNDLE); + output.accept(Items.CYAN_BUNDLE); + output.accept(Items.LIGHT_BLUE_BUNDLE); + output.accept(Items.BLUE_BUNDLE); + output.accept(Items.PURPLE_BUNDLE); + output.accept(Items.MAGENTA_BUNDLE); + output.accept(Items.PINK_BUNDLE); output.accept(Items.COMPASS); output.accept(Items.RECOVERY_COMPASS); output.accept(Items.CLOCK); @@ -1301,7 +1337,7 @@ public class CreativeModeTabs { output.accept(Items.ENDER_PEARL); output.accept(Items.ENDER_EYE); output.accept(Items.ELYTRA); - generateFireworksAllDurations(output, CreativeModeTab.TabVisibility.PARENT_AND_SEARCH_TABS); + generateFireworksAllDurations(output, TabVisibility.PARENT_AND_SEARCH_TABS); output.accept(Items.SADDLE); output.accept(Items.CARROT_ON_A_STICK); output.accept(Items.WARPED_FUNGUS_ON_A_STICK); @@ -1321,6 +1357,8 @@ public class CreativeModeTabs { output.accept(Items.MANGROVE_CHEST_BOAT); output.accept(Items.CHERRY_BOAT); output.accept(Items.CHERRY_CHEST_BOAT); + output.accept(Items.PALE_OAK_BOAT); + output.accept(Items.PALE_OAK_CHEST_BOAT); output.accept(Items.BAMBOO_RAFT); output.accept(Items.BAMBOO_CHEST_RAFT); output.accept(Items.RAIL); @@ -1335,9 +1373,7 @@ public class CreativeModeTabs { itemDisplayParameters.holders() .lookup(Registries.INSTRUMENT) .ifPresent( - registryLookup -> generateInstrumentTypes( - output, registryLookup, Items.GOAT_HORN, InstrumentTags.GOAT_HORNS, CreativeModeTab.TabVisibility.PARENT_AND_SEARCH_TABS - ) + registryLookup -> generateInstrumentTypes(output, registryLookup, Items.GOAT_HORN, InstrumentTags.GOAT_HORNS, TabVisibility.PARENT_AND_SEARCH_TABS) ); output.accept(Items.MUSIC_DISC_13); output.accept(Items.MUSIC_DISC_CAT); @@ -1365,7 +1401,7 @@ public class CreativeModeTabs { Registry.register( registry, COMBAT, - CreativeModeTab.builder(CreativeModeTab.Row.BOTTOM, 1) + CreativeModeTab.builder(Row.BOTTOM, 1) .title(Component.translatable("itemGroup.combat")) .icon(() -> new ItemStack(Items.NETHERITE_SWORD)) .displayItems( @@ -1423,14 +1459,14 @@ public class CreativeModeTabs { output.accept(Items.WIND_CHARGE); output.accept(Items.BOW); output.accept(Items.CROSSBOW); - generateFireworksAllDurations(output, CreativeModeTab.TabVisibility.PARENT_AND_SEARCH_TABS); + generateFireworksAllDurations(output, TabVisibility.PARENT_AND_SEARCH_TABS); output.accept(Items.ARROW); output.accept(Items.SPECTRAL_ARROW); itemDisplayParameters.holders() .lookup(Registries.POTION) .ifPresent( registryLookup -> generatePotionEffectTypes( - output, registryLookup, Items.TIPPED_ARROW, CreativeModeTab.TabVisibility.PARENT_AND_SEARCH_TABS, itemDisplayParameters.enabledFeatures() + output, registryLookup, Items.TIPPED_ARROW, TabVisibility.PARENT_AND_SEARCH_TABS, itemDisplayParameters.enabledFeatures() ) ); } @@ -1440,77 +1476,65 @@ public class CreativeModeTabs { Registry.register( registry, FOOD_AND_DRINKS, - CreativeModeTab.builder(CreativeModeTab.Row.BOTTOM, 2) + CreativeModeTab.builder(Row.BOTTOM, 2) .title(Component.translatable("itemGroup.foodAndDrink")) .icon(() -> new ItemStack(Items.GOLDEN_APPLE)) - .displayItems( - (itemDisplayParameters, output) -> { - output.accept(Items.APPLE); - output.accept(Items.GOLDEN_APPLE); - output.accept(Items.ENCHANTED_GOLDEN_APPLE); - output.accept(Items.MELON_SLICE); - output.accept(Items.SWEET_BERRIES); - output.accept(Items.GLOW_BERRIES); - output.accept(Items.CHORUS_FRUIT); - output.accept(Items.CARROT); - output.accept(Items.GOLDEN_CARROT); - output.accept(Items.POTATO); - output.accept(Items.BAKED_POTATO); - output.accept(Items.POISONOUS_POTATO); - output.accept(Items.BEETROOT); - output.accept(Items.DRIED_KELP); - output.accept(Items.BEEF); - output.accept(Items.COOKED_BEEF); - output.accept(Items.PORKCHOP); - output.accept(Items.COOKED_PORKCHOP); - output.accept(Items.MUTTON); - output.accept(Items.COOKED_MUTTON); - output.accept(Items.CHICKEN); - output.accept(Items.COOKED_CHICKEN); - output.accept(Items.RABBIT); - output.accept(Items.COOKED_RABBIT); - output.accept(Items.COD); - output.accept(Items.COOKED_COD); - output.accept(Items.SALMON); - output.accept(Items.COOKED_SALMON); - output.accept(Items.TROPICAL_FISH); - output.accept(Items.PUFFERFISH); - output.accept(Items.BREAD); - output.accept(Items.COOKIE); - output.accept(Items.CAKE); - output.accept(Items.PUMPKIN_PIE); - output.accept(Items.ROTTEN_FLESH); - output.accept(Items.SPIDER_EYE); - output.accept(Items.MUSHROOM_STEW); - output.accept(Items.BEETROOT_SOUP); - output.accept(Items.RABBIT_STEW); - generateSuspiciousStews(output, CreativeModeTab.TabVisibility.PARENT_AND_SEARCH_TABS); - output.accept(Items.MILK_BUCKET); - output.accept(Items.HONEY_BOTTLE); - generateOminousVials(output, CreativeModeTab.TabVisibility.PARENT_AND_SEARCH_TABS); - itemDisplayParameters.holders() - .lookup(Registries.POTION) - .ifPresent( - registryLookup -> { - generatePotionEffectTypes( - output, registryLookup, Items.POTION, CreativeModeTab.TabVisibility.PARENT_AND_SEARCH_TABS, itemDisplayParameters.enabledFeatures() - ); - generatePotionEffectTypes( - output, registryLookup, Items.SPLASH_POTION, CreativeModeTab.TabVisibility.PARENT_AND_SEARCH_TABS, itemDisplayParameters.enabledFeatures() - ); - generatePotionEffectTypes( - output, registryLookup, Items.LINGERING_POTION, CreativeModeTab.TabVisibility.PARENT_AND_SEARCH_TABS, itemDisplayParameters.enabledFeatures() - ); - } - ); - } - ) + .displayItems((itemDisplayParameters, output) -> { + output.accept(Items.APPLE); + output.accept(Items.GOLDEN_APPLE); + output.accept(Items.ENCHANTED_GOLDEN_APPLE); + output.accept(Items.MELON_SLICE); + output.accept(Items.SWEET_BERRIES); + output.accept(Items.GLOW_BERRIES); + output.accept(Items.CHORUS_FRUIT); + output.accept(Items.CARROT); + output.accept(Items.GOLDEN_CARROT); + output.accept(Items.POTATO); + output.accept(Items.BAKED_POTATO); + output.accept(Items.POISONOUS_POTATO); + output.accept(Items.BEETROOT); + output.accept(Items.DRIED_KELP); + output.accept(Items.BEEF); + output.accept(Items.COOKED_BEEF); + output.accept(Items.PORKCHOP); + output.accept(Items.COOKED_PORKCHOP); + output.accept(Items.MUTTON); + output.accept(Items.COOKED_MUTTON); + output.accept(Items.CHICKEN); + output.accept(Items.COOKED_CHICKEN); + output.accept(Items.RABBIT); + output.accept(Items.COOKED_RABBIT); + output.accept(Items.COD); + output.accept(Items.COOKED_COD); + output.accept(Items.SALMON); + output.accept(Items.COOKED_SALMON); + output.accept(Items.TROPICAL_FISH); + output.accept(Items.PUFFERFISH); + output.accept(Items.BREAD); + output.accept(Items.COOKIE); + output.accept(Items.CAKE); + output.accept(Items.PUMPKIN_PIE); + output.accept(Items.ROTTEN_FLESH); + output.accept(Items.SPIDER_EYE); + output.accept(Items.MUSHROOM_STEW); + output.accept(Items.BEETROOT_SOUP); + output.accept(Items.RABBIT_STEW); + generateSuspiciousStews(output, TabVisibility.PARENT_AND_SEARCH_TABS); + output.accept(Items.MILK_BUCKET); + output.accept(Items.HONEY_BOTTLE); + generateOminousBottles(output, TabVisibility.PARENT_AND_SEARCH_TABS); + itemDisplayParameters.holders().lookup(Registries.POTION).ifPresent(registryLookup -> { + generatePotionEffectTypes(output, registryLookup, Items.POTION, TabVisibility.PARENT_AND_SEARCH_TABS, itemDisplayParameters.enabledFeatures()); + generatePotionEffectTypes(output, registryLookup, Items.SPLASH_POTION, TabVisibility.PARENT_AND_SEARCH_TABS, itemDisplayParameters.enabledFeatures()); + generatePotionEffectTypes(output, registryLookup, Items.LINGERING_POTION, TabVisibility.PARENT_AND_SEARCH_TABS, itemDisplayParameters.enabledFeatures()); + }); + }) .build() ); Registry.register( registry, INGREDIENTS, - CreativeModeTab.builder(CreativeModeTab.Row.BOTTOM, 3) + CreativeModeTab.builder(Row.BOTTOM, 3) .title(Component.translatable("itemGroup.ingredients")) .icon(() -> new ItemStack(Items.IRON_INGOT)) .displayItems((itemDisplayParameters, output) -> { @@ -1605,6 +1629,8 @@ public class CreativeModeTabs { output.accept(Items.GHAST_TEAR); output.accept(Items.TURTLE_HELMET); output.accept(Items.PHANTOM_MEMBRANE); + output.accept(Items.FIELD_MASONED_BANNER_PATTERN); + output.accept(Items.BORDURE_INDENTED_BANNER_PATTERN); output.accept(Items.FLOWER_BANNER_PATTERN); output.accept(Items.CREEPER_BANNER_PATTERN); output.accept(Items.SKULL_BANNER_PATTERN); @@ -1659,8 +1685,8 @@ public class CreativeModeTabs { output.accept(Items.TRIAL_KEY); output.accept(Items.OMINOUS_TRIAL_KEY); itemDisplayParameters.holders().lookup(Registries.ENCHANTMENT).ifPresent(registryLookup -> { - generateEnchantmentBookTypesOnlyMaxLevel(output, registryLookup, CreativeModeTab.TabVisibility.PARENT_TAB_ONLY); - generateEnchantmentBookTypesAllLevels(output, registryLookup, CreativeModeTab.TabVisibility.SEARCH_TAB_ONLY); + generateEnchantmentBookTypesOnlyMaxLevel(output, registryLookup, TabVisibility.PARENT_TAB_ONLY); + generateEnchantmentBookTypesAllLevels(output, registryLookup, TabVisibility.SEARCH_TAB_ONLY); }); }) .build() @@ -1668,12 +1694,13 @@ public class CreativeModeTabs { Registry.register( registry, SPAWN_EGGS, - CreativeModeTab.builder(CreativeModeTab.Row.BOTTOM, 4) + CreativeModeTab.builder(Row.BOTTOM, 4) .title(Component.translatable("itemGroup.spawnEggs")) .icon(() -> new ItemStack(Items.PIG_SPAWN_EGG)) .displayItems((itemDisplayParameters, output) -> { output.accept(Items.SPAWNER); output.accept(Items.TRIAL_SPAWNER); + output.accept(Items.CREAKING_HEART); output.accept(Items.ALLAY_SPAWN_EGG); output.accept(Items.ARMADILLO_SPAWN_EGG); output.accept(Items.AXOLOTL_SPAWN_EGG); @@ -1688,6 +1715,7 @@ public class CreativeModeTabs { output.accept(Items.CHICKEN_SPAWN_EGG); output.accept(Items.COD_SPAWN_EGG); output.accept(Items.COW_SPAWN_EGG); + output.accept(Items.CREAKING_SPAWN_EGG); output.accept(Items.CREEPER_SPAWN_EGG); output.accept(Items.DOLPHIN_SPAWN_EGG); output.accept(Items.DONKEY_SPAWN_EGG); @@ -1758,7 +1786,7 @@ public class CreativeModeTabs { Registry.register( registry, OP_BLOCKS, - CreativeModeTab.builder(CreativeModeTab.Row.BOTTOM, 5) + CreativeModeTab.builder(Row.BOTTOM, 5) .title(Component.translatable("itemGroup.op")) .icon(() -> new ItemStack(Items.COMMAND_BLOCK)) .alignedRight() @@ -1783,11 +1811,7 @@ public class CreativeModeTabs { .lookup(Registries.PAINTING_VARIANT) .ifPresent( registryLookup -> generatePresetPaintings( - output, - itemDisplayParameters.holders(), - registryLookup, - holder -> !holder.is(PaintingVariantTags.PLACEABLE), - CreativeModeTab.TabVisibility.PARENT_AND_SEARCH_TABS + output, itemDisplayParameters.holders(), registryLookup, holder -> !holder.is(PaintingVariantTags.PLACEABLE), TabVisibility.PARENT_AND_SEARCH_TABS ) ); } @@ -1798,23 +1822,23 @@ public class CreativeModeTabs { return Registry.register( registry, INVENTORY, - CreativeModeTab.builder(CreativeModeTab.Row.BOTTOM, 6) + CreativeModeTab.builder(Row.BOTTOM, 6) .title(Component.translatable("itemGroup.inventory")) .icon(() -> new ItemStack(Blocks.CHEST)) .backgroundTexture(INVENTORY_BACKGROUND) .hideTitle() .alignedRight() - .type(CreativeModeTab.Type.INVENTORY) + .type(Type.INVENTORY) .noScrollBar() .build() ); } public static void validate() { - Map, String> map = new HashMap(); + Map, String> map = new HashMap(); for (ResourceKey resourceKey : BuiltInRegistries.CREATIVE_MODE_TAB.registryKeySet()) { - CreativeModeTab creativeModeTab = BuiltInRegistries.CREATIVE_MODE_TAB.getOrThrow(resourceKey); + CreativeModeTab creativeModeTab = BuiltInRegistries.CREATIVE_MODE_TAB.getValueOrThrow(resourceKey); String string = creativeModeTab.getDisplayName().getString(); String string2 = (String)map.put(Pair.of(creativeModeTab.row(), creativeModeTab.column()), string); if (string2 != null) { @@ -1824,11 +1848,11 @@ public class CreativeModeTabs { } public static CreativeModeTab getDefaultTab() { - return BuiltInRegistries.CREATIVE_MODE_TAB.getOrThrow(BUILDING_BLOCKS); + return BuiltInRegistries.CREATIVE_MODE_TAB.getValueOrThrow(BUILDING_BLOCKS); } private static void generatePotionEffectTypes( - CreativeModeTab.Output output, HolderLookup potions, Item item, CreativeModeTab.TabVisibility tabVisibility, FeatureFlagSet requiredFeatures + Output output, HolderLookup potions, Item item, TabVisibility tabVisibility, FeatureFlagSet requiredFeatures ) { potions.listElements() .filter(reference -> ((Potion)reference.value()).isEnabled(requiredFeatures)) @@ -1836,33 +1860,29 @@ public class CreativeModeTabs { .forEach(itemStack -> output.accept(itemStack, tabVisibility)); } - private static void generateEnchantmentBookTypesOnlyMaxLevel( - CreativeModeTab.Output output, HolderLookup enchantments, CreativeModeTab.TabVisibility tabVisibility - ) { + private static void generateEnchantmentBookTypesOnlyMaxLevel(Output output, HolderLookup enchantments, TabVisibility tabVisibility) { enchantments.listElements() - .map(reference -> EnchantedBookItem.createForEnchantment(new EnchantmentInstance(reference, ((Enchantment)reference.value()).getMaxLevel()))) + .map(reference -> EnchantmentHelper.createBook(new EnchantmentInstance(reference, ((Enchantment)reference.value()).getMaxLevel()))) .forEach(itemStack -> output.accept(itemStack, tabVisibility)); } - private static void generateEnchantmentBookTypesAllLevels( - CreativeModeTab.Output output, HolderLookup enchantments, CreativeModeTab.TabVisibility tabVisibility - ) { + private static void generateEnchantmentBookTypesAllLevels(Output output, HolderLookup enchantments, TabVisibility tabVisibility) { enchantments.listElements() .flatMap( reference -> IntStream.rangeClosed(((Enchantment)reference.value()).getMinLevel(), ((Enchantment)reference.value()).getMaxLevel()) - .mapToObj(i -> EnchantedBookItem.createForEnchantment(new EnchantmentInstance(reference, i))) + .mapToObj(i -> EnchantmentHelper.createBook(new EnchantmentInstance(reference, i))) ) .forEach(itemStack -> output.accept(itemStack, tabVisibility)); } private static void generateInstrumentTypes( - CreativeModeTab.Output output, HolderLookup instruments, Item item, TagKey instrument, CreativeModeTab.TabVisibility tabVisibility + Output output, HolderLookup instruments, Item item, TagKey instrument, TabVisibility tabVisibility ) { instruments.get(instrument) .ifPresent(named -> named.stream().map(holder -> InstrumentItem.create(item, holder)).forEach(itemStack -> output.accept(itemStack, tabVisibility))); } - private static void generateSuspiciousStews(CreativeModeTab.Output output, CreativeModeTab.TabVisibility tabVisibility) { + private static void generateSuspiciousStews(Output output, TabVisibility tabVisibility) { List list = SuspiciousEffectHolder.getAllEffectHolders(); Set set = ItemStackLinkedSet.createTypeAndComponentsSet(); @@ -1875,15 +1895,15 @@ public class CreativeModeTabs { output.acceptAll(set, tabVisibility); } - private static void generateOminousVials(CreativeModeTab.Output output, CreativeModeTab.TabVisibility tabVisibility) { + private static void generateOminousBottles(Output output, TabVisibility tabVisibility) { for (int i = 0; i <= 4; i++) { ItemStack itemStack = new ItemStack(Items.OMINOUS_BOTTLE); - itemStack.set(DataComponents.OMINOUS_BOTTLE_AMPLIFIER, i); + itemStack.set(DataComponents.OMINOUS_BOTTLE_AMPLIFIER, new OminousBottleAmplifier(i)); output.accept(itemStack, tabVisibility); } } - private static void generateFireworksAllDurations(CreativeModeTab.Output output, CreativeModeTab.TabVisibility tabVisibility) { + private static void generateFireworksAllDurations(Output output, TabVisibility tabVisibility) { for (byte b : FireworkRocketItem.CRAFTABLE_DURATIONS) { ItemStack itemStack = new ItemStack(Items.FIREWORK_ROCKET); itemStack.set(DataComponents.FIREWORKS, new Fireworks(b, List.of())); @@ -1892,11 +1912,11 @@ public class CreativeModeTabs { } private static void generatePresetPaintings( - CreativeModeTab.Output output, + Output output, HolderLookup.Provider registries, HolderLookup.RegistryLookup paintingVariants, Predicate> predicate, - CreativeModeTab.TabVisibility tabVisibility + TabVisibility tabVisibility ) { RegistryOps registryOps = registries.createSerializationContext(NbtOps.INSTANCE); paintingVariants.listElements() @@ -1928,23 +1948,19 @@ public class CreativeModeTabs { } public static CreativeModeTab searchTab() { - return BuiltInRegistries.CREATIVE_MODE_TAB.getOrThrow(SEARCH); + return BuiltInRegistries.CREATIVE_MODE_TAB.getValueOrThrow(SEARCH); } - private static void buildAllTabContents(CreativeModeTab.ItemDisplayParameters parameters) { - streamAllTabs() - .filter(creativeModeTab -> creativeModeTab.getType() == CreativeModeTab.Type.CATEGORY) - .forEach(creativeModeTab -> creativeModeTab.buildContents(parameters)); - streamAllTabs() - .filter(creativeModeTab -> creativeModeTab.getType() != CreativeModeTab.Type.CATEGORY) - .forEach(creativeModeTab -> creativeModeTab.buildContents(parameters)); + private static void buildAllTabContents(ItemDisplayParameters parameters) { + streamAllTabs().filter(creativeModeTab -> creativeModeTab.getType() == Type.CATEGORY).forEach(creativeModeTab -> creativeModeTab.buildContents(parameters)); + streamAllTabs().filter(creativeModeTab -> creativeModeTab.getType() != Type.CATEGORY).forEach(creativeModeTab -> creativeModeTab.buildContents(parameters)); } public static boolean tryRebuildTabContents(FeatureFlagSet enabledFeatures, boolean hasPermissions, HolderLookup.Provider registries) { if (CACHED_PARAMETERS != null && !CACHED_PARAMETERS.needsUpdate(enabledFeatures, hasPermissions, registries)) { return false; } else { - CACHED_PARAMETERS = new CreativeModeTab.ItemDisplayParameters(enabledFeatures, hasPermissions, registries); + CACHED_PARAMETERS = new ItemDisplayParameters(enabledFeatures, hasPermissions, registries); buildAllTabContents(CACHED_PARAMETERS); return true; } diff --git a/net/minecraft/world/item/CrossbowItem.java b/net/minecraft/world/item/CrossbowItem.java index 309c7bc5..4e3d9c0b 100644 --- a/net/minecraft/world/item/CrossbowItem.java +++ b/net/minecraft/world/item/CrossbowItem.java @@ -21,7 +21,7 @@ import net.minecraft.stats.Stats; import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; import net.minecraft.world.InteractionHand; -import net.minecraft.world.InteractionResultHolder; +import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.projectile.AbstractArrow; @@ -71,19 +71,19 @@ public class CrossbowItem extends ProjectileWeaponItem { } @Override - public InteractionResultHolder use(Level level, Player player, InteractionHand usedHand) { - ItemStack itemStack = player.getItemInHand(usedHand); + public InteractionResult use(Level level, Player player, InteractionHand interactionHand) { + ItemStack itemStack = player.getItemInHand(interactionHand); ChargedProjectiles chargedProjectiles = itemStack.get(DataComponents.CHARGED_PROJECTILES); if (chargedProjectiles != null && !chargedProjectiles.isEmpty()) { - this.performShooting(level, player, usedHand, itemStack, getShootingPower(chargedProjectiles), 1.0F, null); - return InteractionResultHolder.consume(itemStack); + this.performShooting(level, player, interactionHand, itemStack, getShootingPower(chargedProjectiles), 1.0F, null); + return InteractionResult.CONSUME; } else if (!player.getProjectile(itemStack).isEmpty()) { this.startSoundPlayed = false; this.midLoadSoundPlayed = false; - player.startUsingItem(usedHand); - return InteractionResultHolder.consume(itemStack); + player.startUsingItem(interactionHand); + return InteractionResult.CONSUME; } else { - return InteractionResultHolder.fail(itemStack); + return InteractionResult.FAIL; } } @@ -92,11 +92,11 @@ public class CrossbowItem extends ProjectileWeaponItem { } @Override - public void releaseUsing(ItemStack stack, Level level, LivingEntity livingEntity, int timeCharged) { - int i = this.getUseDuration(stack, livingEntity) - timeCharged; - float f = getPowerForTime(i, stack, livingEntity); - if (f >= 1.0F && !isCharged(stack) && tryLoadProjectiles(livingEntity, stack)) { - CrossbowItem.ChargingSounds chargingSounds = this.getChargingSounds(stack); + public boolean releaseUsing(ItemStack itemStack, Level level, LivingEntity livingEntity, int i) { + int j = this.getUseDuration(itemStack, livingEntity) - i; + float f = getPowerForTime(j, itemStack, livingEntity); + if (f >= 1.0F && !isCharged(itemStack) && tryLoadProjectiles(livingEntity, itemStack)) { + CrossbowItem.ChargingSounds chargingSounds = this.getChargingSounds(itemStack); chargingSounds.end() .ifPresent( holder -> level.playSound( @@ -110,6 +110,9 @@ public class CrossbowItem extends ProjectileWeaponItem { 1.0F / (level.getRandom().nextFloat() * 0.5F + 1.0F) + 0.2F ) ); + return true; + } else { + return false; } } @@ -249,8 +252,8 @@ public class CrossbowItem extends ProjectileWeaponItem { } @Override - public UseAnim getUseAnimation(ItemStack stack) { - return UseAnim.CROSSBOW; + public ItemUseAnimation getUseAnimation(ItemStack itemStack) { + return ItemUseAnimation.CROSSBOW; } CrossbowItem.ChargingSounds getChargingSounds(ItemStack stack) { diff --git a/net/minecraft/world/item/DebugStickItem.java b/net/minecraft/world/item/DebugStickItem.java index 3d79eed8..d0530e9e 100644 --- a/net/minecraft/world/item/DebugStickItem.java +++ b/net/minecraft/world/item/DebugStickItem.java @@ -45,7 +45,7 @@ public class DebugStickItem extends Item { } } - return InteractionResult.sidedSuccess(level.isClientSide); + return InteractionResult.SUCCESS; } private boolean handleInteraction(Player player, BlockState stateClicked, LevelAccessor accessor, BlockPos pos, boolean shouldCycleState, ItemStack debugStack) { @@ -56,7 +56,7 @@ public class DebugStickItem extends Item { StateDefinition stateDefinition = holder.value().getStateDefinition(); Collection> collection = stateDefinition.getProperties(); if (collection.isEmpty()) { - message(player, Component.translatable(this.getDescriptionId() + ".empty", holder.getRegisteredName())); + message(player, Component.translatable(this.descriptionId + ".empty", holder.getRegisteredName())); return false; } else { DebugStickState debugStickState = debugStack.get(DataComponents.DEBUG_STICK_STATE); @@ -71,11 +71,11 @@ public class DebugStickItem extends Item { BlockState blockState = cycleState(stateClicked, property, player.isSecondaryUseActive()); accessor.setBlock(pos, blockState, 18); - message(player, Component.translatable(this.getDescriptionId() + ".update", property.getName(), getNameHelper(blockState, property))); + message(player, Component.translatable(this.descriptionId + ".update", property.getName(), getNameHelper(blockState, property))); } else { property = getRelative(collection, property, player.isSecondaryUseActive()); debugStack.set(DataComponents.DEBUG_STICK_STATE, debugStickState.withProperty(holder, property)); - message(player, Component.translatable(this.getDescriptionId() + ".select", property.getName(), getNameHelper(stateClicked, property))); + message(player, Component.translatable(this.descriptionId + ".select", property.getName(), getNameHelper(stateClicked, property))); } return true; diff --git a/net/minecraft/world/item/DiggerItem.java b/net/minecraft/world/item/DiggerItem.java index ae76ba2c..3f805419 100644 --- a/net/minecraft/world/item/DiggerItem.java +++ b/net/minecraft/world/item/DiggerItem.java @@ -1,29 +1,13 @@ package net.minecraft.world.item; -import net.minecraft.core.component.DataComponents; import net.minecraft.tags.TagKey; import net.minecraft.world.entity.EquipmentSlot; -import net.minecraft.world.entity.EquipmentSlotGroup; import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.entity.ai.attributes.AttributeModifier; -import net.minecraft.world.entity.ai.attributes.Attributes; -import net.minecraft.world.item.component.ItemAttributeModifiers; import net.minecraft.world.level.block.Block; -public class DiggerItem extends TieredItem { - protected DiggerItem(Tier tier, TagKey blocks, Item.Properties properties) { - super(tier, properties.component(DataComponents.TOOL, tier.createToolProperties(blocks))); - } - - public static ItemAttributeModifiers createAttributes(Tier tier, float attackDamage, float attackSpeed) { - return ItemAttributeModifiers.builder() - .add( - Attributes.ATTACK_DAMAGE, - new AttributeModifier(BASE_ATTACK_DAMAGE_ID, attackDamage + tier.getAttackDamageBonus(), AttributeModifier.Operation.ADD_VALUE), - EquipmentSlotGroup.MAINHAND - ) - .add(Attributes.ATTACK_SPEED, new AttributeModifier(BASE_ATTACK_SPEED_ID, attackSpeed, AttributeModifier.Operation.ADD_VALUE), EquipmentSlotGroup.MAINHAND) - .build(); +public class DiggerItem extends Item { + protected DiggerItem(ToolMaterial toolMaterial, TagKey tagKey, float f, float g, Item.Properties properties) { + super(toolMaterial.applyToolProperties(properties, tagKey, f, g)); } @Override diff --git a/net/minecraft/world/item/DiscFragmentItem.java b/net/minecraft/world/item/DiscFragmentItem.java index 594ba50e..efc48e47 100644 --- a/net/minecraft/world/item/DiscFragmentItem.java +++ b/net/minecraft/world/item/DiscFragmentItem.java @@ -16,6 +16,6 @@ public class DiscFragmentItem extends Item { } public MutableComponent getDisplayName() { - return Component.translatable(this.getDescriptionId() + ".desc"); + return Component.translatable(this.descriptionId + ".desc"); } } diff --git a/net/minecraft/world/item/DyeColor.java b/net/minecraft/world/item/DyeColor.java index cdf5c6d9..3e79f04e 100644 --- a/net/minecraft/world/item/DyeColor.java +++ b/net/minecraft/world/item/DyeColor.java @@ -8,9 +8,10 @@ import java.util.function.IntFunction; import java.util.stream.Collectors; import net.minecraft.network.codec.ByteBufCodecs; import net.minecraft.network.codec.StreamCodec; +import net.minecraft.util.ARGB; import net.minecraft.util.ByIdMap; -import net.minecraft.util.FastColor; import net.minecraft.util.StringRepresentable; +import net.minecraft.util.ByIdMap.OutOfBoundsStrategy; import net.minecraft.world.level.material.MapColor; import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.Nullable; @@ -33,7 +34,7 @@ public enum DyeColor implements StringRepresentable { RED(14, "red", 11546150, MapColor.COLOR_RED, 11743532, 16711680), BLACK(15, "black", 1908001, MapColor.COLOR_BLACK, 1973019, 0); - private static final IntFunction BY_ID = ByIdMap.continuous(DyeColor::getId, values(), ByIdMap.OutOfBoundsStrategy.ZERO); + private static final IntFunction BY_ID = ByIdMap.continuous(DyeColor::getId, values(), OutOfBoundsStrategy.ZERO); private static final Int2ObjectOpenHashMap BY_FIREWORK_COLOR = new Int2ObjectOpenHashMap<>( (Map)Arrays.stream(values()).collect(Collectors.toMap(dyeColor -> dyeColor.fireworkColor, dyeColor -> dyeColor)) ); @@ -51,7 +52,7 @@ public enum DyeColor implements StringRepresentable { this.name = name; this.mapColor = mapColor; this.textColor = textColor; - this.textureDiffuseColor = FastColor.ARGB32.opaque(textureDefuseColor); + this.textureDiffuseColor = ARGB.opaque(textureDefuseColor); this.fireworkColor = fireworkColor; } diff --git a/net/minecraft/world/item/DyeItem.java b/net/minecraft/world/item/DyeItem.java index cbe053fe..230cede4 100644 --- a/net/minecraft/world/item/DyeItem.java +++ b/net/minecraft/world/item/DyeItem.java @@ -31,7 +31,7 @@ public class DyeItem extends Item implements SignApplicator { stack.shrink(1); } - return InteractionResult.sidedSuccess(player.level().isClientSide); + return InteractionResult.SUCCESS; } else { return InteractionResult.PASS; } diff --git a/net/minecraft/world/item/EggItem.java b/net/minecraft/world/item/EggItem.java index 967f397e..c9bca140 100644 --- a/net/minecraft/world/item/EggItem.java +++ b/net/minecraft/world/item/EggItem.java @@ -2,11 +2,12 @@ package net.minecraft.world.item; import net.minecraft.core.Direction; import net.minecraft.core.Position; +import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; import net.minecraft.stats.Stats; import net.minecraft.world.InteractionHand; -import net.minecraft.world.InteractionResultHolder; +import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.projectile.Projectile; import net.minecraft.world.entity.projectile.ThrownEgg; @@ -18,27 +19,22 @@ public class EggItem extends Item implements ProjectileItem { } @Override - public InteractionResultHolder use(Level level, Player player, InteractionHand usedHand) { - ItemStack itemStack = player.getItemInHand(usedHand); + public InteractionResult use(Level level, Player player, InteractionHand interactionHand) { + ItemStack itemStack = player.getItemInHand(interactionHand); level.playSound( null, player.getX(), player.getY(), player.getZ(), SoundEvents.EGG_THROW, SoundSource.PLAYERS, 0.5F, 0.4F / (level.getRandom().nextFloat() * 0.4F + 0.8F) ); - if (!level.isClientSide) { - ThrownEgg thrownEgg = new ThrownEgg(level, player); - thrownEgg.setItem(itemStack); - thrownEgg.shootFromRotation(player, player.getXRot(), player.getYRot(), 0.0F, 1.5F, 1.0F); - level.addFreshEntity(thrownEgg); + if (level instanceof ServerLevel serverLevel) { + Projectile.spawnProjectileFromRotation(ThrownEgg::new, serverLevel, itemStack, player, 0.0F, 1.5F, 1.0F); } player.awardStat(Stats.ITEM_USED.get(this)); itemStack.consume(1, player); - return InteractionResultHolder.sidedSuccess(itemStack, level.isClientSide()); + return InteractionResult.SUCCESS; } @Override public Projectile asProjectile(Level level, Position pos, ItemStack stack, Direction direction) { - ThrownEgg thrownEgg = new ThrownEgg(level, pos.x(), pos.y(), pos.z()); - thrownEgg.setItem(stack); - return thrownEgg; + return new ThrownEgg(level, pos.x(), pos.y(), pos.z(), stack); } } diff --git a/net/minecraft/world/item/ElytraItem.java b/net/minecraft/world/item/ElytraItem.java deleted file mode 100644 index 2d74a4b9..00000000 --- a/net/minecraft/world/item/ElytraItem.java +++ /dev/null @@ -1,42 +0,0 @@ -package net.minecraft.world.item; - -import net.minecraft.core.Holder; -import net.minecraft.sounds.SoundEvent; -import net.minecraft.sounds.SoundEvents; -import net.minecraft.world.InteractionHand; -import net.minecraft.world.InteractionResultHolder; -import net.minecraft.world.entity.EquipmentSlot; -import net.minecraft.world.entity.player.Player; -import net.minecraft.world.level.Level; -import net.minecraft.world.level.block.DispenserBlock; - -public class ElytraItem extends Item implements Equipable { - public ElytraItem(Item.Properties properties) { - super(properties); - DispenserBlock.registerBehavior(this, ArmorItem.DISPENSE_ITEM_BEHAVIOR); - } - - public static boolean isFlyEnabled(ItemStack elytraStack) { - return elytraStack.getDamageValue() < elytraStack.getMaxDamage() - 1; - } - - @Override - public boolean isValidRepairItem(ItemStack stack, ItemStack repairCandidate) { - return repairCandidate.is(Items.PHANTOM_MEMBRANE); - } - - @Override - public InteractionResultHolder use(Level level, Player player, InteractionHand usedHand) { - return this.swapWithEquipmentSlot(this, level, player, usedHand); - } - - @Override - public Holder getEquipSound() { - return SoundEvents.ARMOR_EQUIP_ELYTRA; - } - - @Override - public EquipmentSlot getEquipmentSlot() { - return EquipmentSlot.CHEST; - } -} diff --git a/net/minecraft/world/item/EmptyMapItem.java b/net/minecraft/world/item/EmptyMapItem.java index ab102f47..49a8b0b4 100644 --- a/net/minecraft/world/item/EmptyMapItem.java +++ b/net/minecraft/world/item/EmptyMapItem.java @@ -3,33 +3,33 @@ package net.minecraft.world.item; import net.minecraft.sounds.SoundEvents; import net.minecraft.stats.Stats; import net.minecraft.world.InteractionHand; -import net.minecraft.world.InteractionResultHolder; +import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.player.Player; import net.minecraft.world.level.Level; -public class EmptyMapItem extends ComplexItem { +public class EmptyMapItem extends Item { public EmptyMapItem(Item.Properties properties) { super(properties); } @Override - public InteractionResultHolder use(Level level, Player player, InteractionHand usedHand) { - ItemStack itemStack = player.getItemInHand(usedHand); + public InteractionResult use(Level level, Player player, InteractionHand interactionHand) { + ItemStack itemStack = player.getItemInHand(interactionHand); if (level.isClientSide) { - return InteractionResultHolder.success(itemStack); + return InteractionResult.SUCCESS; } else { itemStack.consume(1, player); player.awardStat(Stats.ITEM_USED.get(this)); player.level().playSound(null, player, SoundEvents.UI_CARTOGRAPHY_TABLE_TAKE_RESULT, player.getSoundSource(), 1.0F, 1.0F); ItemStack itemStack2 = MapItem.create(level, player.getBlockX(), player.getBlockZ(), (byte)0, true, false); if (itemStack.isEmpty()) { - return InteractionResultHolder.consume(itemStack2); + return InteractionResult.SUCCESS.heldItemTransformedTo(itemStack2); } else { if (!player.getInventory().add(itemStack2.copy())) { player.drop(itemStack2, false); } - return InteractionResultHolder.consume(itemStack); + return InteractionResult.SUCCESS; } } } diff --git a/net/minecraft/world/item/EnchantedBookItem.java b/net/minecraft/world/item/EnchantedBookItem.java deleted file mode 100644 index 67ffdae5..00000000 --- a/net/minecraft/world/item/EnchantedBookItem.java +++ /dev/null @@ -1,23 +0,0 @@ -package net.minecraft.world.item; - -import net.minecraft.world.item.enchantment.EnchantmentInstance; - -public class EnchantedBookItem extends Item { - public EnchantedBookItem(Item.Properties properties) { - super(properties); - } - - @Override - public boolean isEnchantable(ItemStack stack) { - return false; - } - - /** - * Returns the ItemStack of an enchanted version of this item. - */ - public static ItemStack createForEnchantment(EnchantmentInstance instance) { - ItemStack itemStack = new ItemStack(Items.ENCHANTED_BOOK); - itemStack.enchant(instance.enchantment, instance.level); - return itemStack; - } -} diff --git a/net/minecraft/world/item/EndCrystalItem.java b/net/minecraft/world/item/EndCrystalItem.java index d20a0215..d0598ebd 100644 --- a/net/minecraft/world/item/EndCrystalItem.java +++ b/net/minecraft/world/item/EndCrystalItem.java @@ -50,7 +50,7 @@ public class EndCrystalItem extends Item { } context.getItemInHand().shrink(1); - return InteractionResult.sidedSuccess(level.isClientSide); + return InteractionResult.SUCCESS; } } } diff --git a/net/minecraft/world/item/EnderEyeItem.java b/net/minecraft/world/item/EnderEyeItem.java index f7c64ce3..5c0b869c 100644 --- a/net/minecraft/world/item/EnderEyeItem.java +++ b/net/minecraft/world/item/EnderEyeItem.java @@ -11,21 +11,21 @@ import net.minecraft.tags.StructureTags; import net.minecraft.util.Mth; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; -import net.minecraft.world.InteractionResultHolder; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.projectile.EyeOfEnder; import net.minecraft.world.item.context.UseOnContext; -import net.minecraft.world.level.ClipContext; import net.minecraft.world.level.Level; +import net.minecraft.world.level.ClipContext.Fluid; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.EndPortalFrameBlock; import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.world.level.block.state.pattern.BlockPattern; +import net.minecraft.world.level.block.state.pattern.BlockPattern.BlockPatternMatch; import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.level.gameevent.GameEvent.Context; import net.minecraft.world.phys.BlockHitResult; -import net.minecraft.world.phys.HitResult; +import net.minecraft.world.phys.HitResult.Type; public class EnderEyeItem extends Item { public EnderEyeItem(Item.Properties properties) { @@ -48,7 +48,7 @@ public class EnderEyeItem extends Item { level.updateNeighbourForOutputSignal(blockPos, Blocks.END_PORTAL_FRAME); context.getItemInHand().shrink(1); level.levelEvent(1503, blockPos, 0); - BlockPattern.BlockPatternMatch blockPatternMatch = EndPortalFrameBlock.getOrCreatePortalShape().find(level, blockPos); + BlockPatternMatch blockPatternMatch = EndPortalFrameBlock.getOrCreatePortalShape().find(level, blockPos); if (blockPatternMatch != null) { BlockPos blockPos2 = blockPatternMatch.getFrontTopLeft().offset(-3, 0, -3); @@ -61,7 +61,7 @@ public class EnderEyeItem extends Item { level.globalLevelEvent(1038, blockPos2.offset(1, 0, 1), 0); } - return InteractionResult.CONSUME; + return InteractionResult.SUCCESS; } } @@ -71,35 +71,35 @@ public class EnderEyeItem extends Item { } @Override - public InteractionResultHolder use(Level level, Player player, InteractionHand usedHand) { - ItemStack itemStack = player.getItemInHand(usedHand); - BlockHitResult blockHitResult = getPlayerPOVHitResult(level, player, ClipContext.Fluid.NONE); - if (blockHitResult.getType() == HitResult.Type.BLOCK && level.getBlockState(blockHitResult.getBlockPos()).is(Blocks.END_PORTAL_FRAME)) { - return InteractionResultHolder.pass(itemStack); + public InteractionResult use(Level level, Player player, InteractionHand interactionHand) { + ItemStack itemStack = player.getItemInHand(interactionHand); + BlockHitResult blockHitResult = getPlayerPOVHitResult(level, player, Fluid.NONE); + if (blockHitResult.getType() == Type.BLOCK && level.getBlockState(blockHitResult.getBlockPos()).is(Blocks.END_PORTAL_FRAME)) { + return InteractionResult.PASS; } else { - player.startUsingItem(usedHand); + player.startUsingItem(interactionHand); if (level instanceof ServerLevel serverLevel) { BlockPos blockPos = serverLevel.findNearestMapStructure(StructureTags.EYE_OF_ENDER_LOCATED, player.blockPosition(), 100, false); - if (blockPos != null) { - EyeOfEnder eyeOfEnder = new EyeOfEnder(level, player.getX(), player.getY(0.5), player.getZ()); - eyeOfEnder.setItem(itemStack); - eyeOfEnder.signalTo(blockPos); - level.gameEvent(GameEvent.PROJECTILE_SHOOT, eyeOfEnder.position(), GameEvent.Context.of(player)); - level.addFreshEntity(eyeOfEnder); - if (player instanceof ServerPlayer serverPlayer) { - CriteriaTriggers.USED_ENDER_EYE.trigger(serverPlayer, blockPos); - } - - float f = Mth.lerp(level.random.nextFloat(), 0.33F, 0.5F); - level.playSound(null, player.getX(), player.getY(), player.getZ(), SoundEvents.ENDER_EYE_LAUNCH, SoundSource.NEUTRAL, 1.0F, f); - itemStack.consume(1, player); - player.awardStat(Stats.ITEM_USED.get(this)); - player.swing(usedHand, true); - return InteractionResultHolder.success(itemStack); + if (blockPos == null) { + return InteractionResult.CONSUME; } + + EyeOfEnder eyeOfEnder = new EyeOfEnder(level, player.getX(), player.getY(0.5), player.getZ()); + eyeOfEnder.setItem(itemStack); + eyeOfEnder.signalTo(blockPos); + level.gameEvent(GameEvent.PROJECTILE_SHOOT, eyeOfEnder.position(), Context.of(player)); + level.addFreshEntity(eyeOfEnder); + if (player instanceof ServerPlayer serverPlayer) { + CriteriaTriggers.USED_ENDER_EYE.trigger(serverPlayer, blockPos); + } + + float f = Mth.lerp(level.random.nextFloat(), 0.33F, 0.5F); + level.playSound(null, player.getX(), player.getY(), player.getZ(), SoundEvents.ENDER_EYE_LAUNCH, SoundSource.NEUTRAL, 1.0F, f); + itemStack.consume(1, player); + player.awardStat(Stats.ITEM_USED.get(this)); } - return InteractionResultHolder.consume(itemStack); + return InteractionResult.SUCCESS_SERVER; } } } diff --git a/net/minecraft/world/item/EnderpearlItem.java b/net/minecraft/world/item/EnderpearlItem.java index 79a4d820..8108f124 100644 --- a/net/minecraft/world/item/EnderpearlItem.java +++ b/net/minecraft/world/item/EnderpearlItem.java @@ -1,11 +1,13 @@ package net.minecraft.world.item; +import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; import net.minecraft.stats.Stats; import net.minecraft.world.InteractionHand; -import net.minecraft.world.InteractionResultHolder; +import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.player.Player; +import net.minecraft.world.entity.projectile.Projectile; import net.minecraft.world.entity.projectile.ThrownEnderpearl; import net.minecraft.world.level.Level; @@ -15,8 +17,8 @@ public class EnderpearlItem extends Item { } @Override - public InteractionResultHolder use(Level level, Player player, InteractionHand usedHand) { - ItemStack itemStack = player.getItemInHand(usedHand); + public InteractionResult use(Level level, Player player, InteractionHand interactionHand) { + ItemStack itemStack = player.getItemInHand(interactionHand); level.playSound( null, player.getX(), @@ -27,16 +29,12 @@ public class EnderpearlItem extends Item { 0.5F, 0.4F / (level.getRandom().nextFloat() * 0.4F + 0.8F) ); - player.getCooldowns().addCooldown(this, 20); - if (!level.isClientSide) { - ThrownEnderpearl thrownEnderpearl = new ThrownEnderpearl(level, player); - thrownEnderpearl.setItem(itemStack); - thrownEnderpearl.shootFromRotation(player, player.getXRot(), player.getYRot(), 0.0F, 1.5F, 1.0F); - level.addFreshEntity(thrownEnderpearl); + if (level instanceof ServerLevel serverLevel) { + Projectile.spawnProjectileFromRotation(ThrownEnderpearl::new, serverLevel, itemStack, player, 0.0F, 1.5F, 1.0F); } player.awardStat(Stats.ITEM_USED.get(this)); itemStack.consume(1, player); - return InteractionResultHolder.sidedSuccess(itemStack, level.isClientSide()); + return InteractionResult.SUCCESS; } } diff --git a/net/minecraft/world/item/Equipable.java b/net/minecraft/world/item/Equipable.java deleted file mode 100644 index e856c8cc..00000000 --- a/net/minecraft/world/item/Equipable.java +++ /dev/null @@ -1,54 +0,0 @@ -package net.minecraft.world.item; - -import net.minecraft.core.Holder; -import net.minecraft.sounds.SoundEvent; -import net.minecraft.sounds.SoundEvents; -import net.minecraft.stats.Stats; -import net.minecraft.world.InteractionHand; -import net.minecraft.world.InteractionResultHolder; -import net.minecraft.world.entity.EquipmentSlot; -import net.minecraft.world.entity.player.Player; -import net.minecraft.world.item.enchantment.EnchantmentEffectComponents; -import net.minecraft.world.item.enchantment.EnchantmentHelper; -import net.minecraft.world.level.Level; -import org.jetbrains.annotations.Nullable; - -public interface Equipable { - EquipmentSlot getEquipmentSlot(); - - default Holder getEquipSound() { - return SoundEvents.ARMOR_EQUIP_GENERIC; - } - - default InteractionResultHolder swapWithEquipmentSlot(Item item, Level level, Player player, InteractionHand hand) { - ItemStack itemStack = player.getItemInHand(hand); - EquipmentSlot equipmentSlot = player.getEquipmentSlotForItem(itemStack); - if (!player.canUseSlot(equipmentSlot)) { - return InteractionResultHolder.pass(itemStack); - } else { - ItemStack itemStack2 = player.getItemBySlot(equipmentSlot); - if ((!EnchantmentHelper.has(itemStack2, EnchantmentEffectComponents.PREVENT_ARMOR_CHANGE) || player.isCreative()) - && !ItemStack.matches(itemStack, itemStack2)) { - if (!level.isClientSide()) { - player.awardStat(Stats.ITEM_USED.get(item)); - } - - ItemStack itemStack3 = itemStack2.isEmpty() ? itemStack : itemStack2.copyAndClear(); - ItemStack itemStack4 = player.isCreative() ? itemStack.copy() : itemStack.copyAndClear(); - player.setItemSlot(equipmentSlot, itemStack4); - return InteractionResultHolder.sidedSuccess(itemStack3, level.isClientSide()); - } else { - return InteractionResultHolder.fail(itemStack); - } - } - } - - @Nullable - static Equipable get(ItemStack stack) { - if (stack.getItem() instanceof Equipable equipable) { - return equipable; - } else { - return stack.getItem() instanceof BlockItem blockItem && blockItem.getBlock() instanceof Equipable equipable2 ? equipable2 : null; - } - } -} diff --git a/net/minecraft/world/item/ExperienceBottleItem.java b/net/minecraft/world/item/ExperienceBottleItem.java index 96f6d5c3..0553ff0c 100644 --- a/net/minecraft/world/item/ExperienceBottleItem.java +++ b/net/minecraft/world/item/ExperienceBottleItem.java @@ -2,14 +2,16 @@ package net.minecraft.world.item; import net.minecraft.core.Direction; import net.minecraft.core.Position; +import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; import net.minecraft.stats.Stats; import net.minecraft.world.InteractionHand; -import net.minecraft.world.InteractionResultHolder; +import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.projectile.Projectile; import net.minecraft.world.entity.projectile.ThrownExperienceBottle; +import net.minecraft.world.item.ProjectileItem.DispenseConfig; import net.minecraft.world.level.Level; public class ExperienceBottleItem extends Item implements ProjectileItem { @@ -18,8 +20,8 @@ public class ExperienceBottleItem extends Item implements ProjectileItem { } @Override - public InteractionResultHolder use(Level level, Player player, InteractionHand usedHand) { - ItemStack itemStack = player.getItemInHand(usedHand); + public InteractionResult use(Level level, Player player, InteractionHand interactionHand) { + ItemStack itemStack = player.getItemInHand(interactionHand); level.playSound( null, player.getX(), @@ -30,30 +32,22 @@ public class ExperienceBottleItem extends Item implements ProjectileItem { 0.5F, 0.4F / (level.getRandom().nextFloat() * 0.4F + 0.8F) ); - if (!level.isClientSide) { - ThrownExperienceBottle thrownExperienceBottle = new ThrownExperienceBottle(level, player); - thrownExperienceBottle.setItem(itemStack); - thrownExperienceBottle.shootFromRotation(player, player.getXRot(), player.getYRot(), -20.0F, 0.7F, 1.0F); - level.addFreshEntity(thrownExperienceBottle); + if (level instanceof ServerLevel serverLevel) { + Projectile.spawnProjectileFromRotation(ThrownExperienceBottle::new, serverLevel, itemStack, player, -20.0F, 0.7F, 1.0F); } player.awardStat(Stats.ITEM_USED.get(this)); itemStack.consume(1, player); - return InteractionResultHolder.sidedSuccess(itemStack, level.isClientSide()); + return InteractionResult.SUCCESS; } @Override public Projectile asProjectile(Level level, Position pos, ItemStack stack, Direction direction) { - ThrownExperienceBottle thrownExperienceBottle = new ThrownExperienceBottle(level, pos.x(), pos.y(), pos.z()); - thrownExperienceBottle.setItem(stack); - return thrownExperienceBottle; + return new ThrownExperienceBottle(level, pos.x(), pos.y(), pos.z(), stack); } @Override - public ProjectileItem.DispenseConfig createDispenseConfig() { - return ProjectileItem.DispenseConfig.builder() - .uncertainty(ProjectileItem.DispenseConfig.DEFAULT.uncertainty() * 0.5F) - .power(ProjectileItem.DispenseConfig.DEFAULT.power() * 1.25F) - .build(); + public DispenseConfig createDispenseConfig() { + return DispenseConfig.builder().uncertainty(DispenseConfig.DEFAULT.uncertainty() * 0.5F).power(DispenseConfig.DEFAULT.power() * 1.25F).build(); } } diff --git a/net/minecraft/world/item/FireChargeItem.java b/net/minecraft/world/item/FireChargeItem.java index 8bac1cb0..dc0d2e06 100644 --- a/net/minecraft/world/item/FireChargeItem.java +++ b/net/minecraft/world/item/FireChargeItem.java @@ -9,6 +9,7 @@ import net.minecraft.util.RandomSource; import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.projectile.Projectile; import net.minecraft.world.entity.projectile.SmallFireball; +import net.minecraft.world.item.ProjectileItem.DispenseConfig; import net.minecraft.world.item.context.UseOnContext; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.BaseFireBlock; @@ -49,7 +50,7 @@ public class FireChargeItem extends Item implements ProjectileItem { if (bl) { context.getItemInHand().shrink(1); - return InteractionResult.sidedSuccess(level.isClientSide); + return InteractionResult.SUCCESS; } else { return InteractionResult.FAIL; } @@ -63,9 +64,9 @@ public class FireChargeItem extends Item implements ProjectileItem { @Override public Projectile asProjectile(Level level, Position pos, ItemStack stack, Direction direction) { RandomSource randomSource = level.getRandom(); - double d = randomSource.triangle(direction.getStepX(), 0.11485000000000001); - double e = randomSource.triangle(direction.getStepY(), 0.11485000000000001); - double f = randomSource.triangle(direction.getStepZ(), 0.11485000000000001); + double d = randomSource.triangle((double)direction.getStepX(), 0.11485000000000001); + double e = randomSource.triangle((double)direction.getStepY(), 0.11485000000000001); + double f = randomSource.triangle((double)direction.getStepZ(), 0.11485000000000001); Vec3 vec3 = new Vec3(d, e, f); SmallFireball smallFireball = new SmallFireball(level, pos.x(), pos.y(), pos.z(), vec3.normalize()); smallFireball.setItem(stack); @@ -77,8 +78,8 @@ public class FireChargeItem extends Item implements ProjectileItem { } @Override - public ProjectileItem.DispenseConfig createDispenseConfig() { - return ProjectileItem.DispenseConfig.builder() + public DispenseConfig createDispenseConfig() { + return DispenseConfig.builder() .positionFunction((blockSource, direction) -> DispenserBlock.getDispensePosition(blockSource, 1.0, Vec3.ZERO)) .uncertainty(6.6666665F) .power(1.0F) diff --git a/net/minecraft/world/item/FireworkRocketItem.java b/net/minecraft/world/item/FireworkRocketItem.java index e83eb1ad..f1329dd2 100644 --- a/net/minecraft/world/item/FireworkRocketItem.java +++ b/net/minecraft/world/item/FireworkRocketItem.java @@ -6,14 +6,14 @@ import net.minecraft.core.Position; import net.minecraft.core.component.DataComponents; import net.minecraft.core.dispenser.BlockSource; import net.minecraft.network.chat.Component; +import net.minecraft.server.level.ServerLevel; import net.minecraft.stats.Stats; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; -import net.minecraft.world.InteractionResultHolder; -import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.projectile.FireworkRocketEntity; import net.minecraft.world.entity.projectile.Projectile; +import net.minecraft.world.item.ProjectileItem.DispenseConfig; import net.minecraft.world.item.component.Fireworks; import net.minecraft.world.item.context.UseOnContext; import net.minecraft.world.level.Level; @@ -30,34 +30,36 @@ public class FireworkRocketItem extends Item implements ProjectileItem { @Override public InteractionResult useOn(UseOnContext context) { Level level = context.getLevel(); - if (!level.isClientSide) { + if (level instanceof ServerLevel serverLevel) { ItemStack itemStack = context.getItemInHand(); Vec3 vec3 = context.getClickLocation(); Direction direction = context.getClickedFace(); - FireworkRocketEntity fireworkRocketEntity = new FireworkRocketEntity( - level, context.getPlayer(), vec3.x + direction.getStepX() * 0.15, vec3.y + direction.getStepY() * 0.15, vec3.z + direction.getStepZ() * 0.15, itemStack + Projectile.spawnProjectile( + new FireworkRocketEntity( + level, context.getPlayer(), vec3.x + direction.getStepX() * 0.15, vec3.y + direction.getStepY() * 0.15, vec3.z + direction.getStepZ() * 0.15, itemStack + ), + serverLevel, + itemStack ); - level.addFreshEntity(fireworkRocketEntity); itemStack.shrink(1); } - return InteractionResult.sidedSuccess(level.isClientSide); + return InteractionResult.SUCCESS; } @Override - public InteractionResultHolder use(Level level, Player player, InteractionHand usedHand) { + public InteractionResult use(Level level, Player player, InteractionHand interactionHand) { if (player.isFallFlying()) { - ItemStack itemStack = player.getItemInHand(usedHand); - if (!level.isClientSide) { - FireworkRocketEntity fireworkRocketEntity = new FireworkRocketEntity(level, itemStack, player); - level.addFreshEntity(fireworkRocketEntity); + ItemStack itemStack = player.getItemInHand(interactionHand); + if (level instanceof ServerLevel serverLevel) { + Projectile.spawnProjectile(new FireworkRocketEntity(level, itemStack, player), serverLevel, itemStack); itemStack.consume(1, player); player.awardStat(Stats.ITEM_USED.get(this)); } - return InteractionResultHolder.sidedSuccess(player.getItemInHand(usedHand), level.isClientSide()); + return InteractionResult.SUCCESS; } else { - return InteractionResultHolder.pass(player.getItemInHand(usedHand)); + return InteractionResult.PASS; } } @@ -75,21 +77,17 @@ public class FireworkRocketItem extends Item implements ProjectileItem { } @Override - public ProjectileItem.DispenseConfig createDispenseConfig() { - return ProjectileItem.DispenseConfig.builder() - .positionFunction(FireworkRocketItem::getEntityPokingOutOfBlockPos) + public DispenseConfig createDispenseConfig() { + return DispenseConfig.builder() + .positionFunction(FireworkRocketItem::getEntityJustOutsideOfBlockPos) .uncertainty(1.0F) .power(0.5F) .overrideDispenseEvent(1004) .build(); } - private static Vec3 getEntityPokingOutOfBlockPos(BlockSource source, Direction direction) { - return source.center() - .add( - direction.getStepX() * (0.5000099999997474 - EntityType.FIREWORK_ROCKET.getWidth() / 2.0), - direction.getStepY() * (0.5000099999997474 - EntityType.FIREWORK_ROCKET.getHeight() / 2.0) - EntityType.FIREWORK_ROCKET.getHeight() / 2.0, - direction.getStepZ() * (0.5000099999997474 - EntityType.FIREWORK_ROCKET.getWidth() / 2.0) - ); + private static Vec3 getEntityJustOutsideOfBlockPos(BlockSource blockSource, Direction direction) { + return blockSource.center() + .add(direction.getStepX() * 0.5000099999997474, direction.getStepY() * 0.5000099999997474, direction.getStepZ() * 0.5000099999997474); } } diff --git a/net/minecraft/world/item/FishingRodItem.java b/net/minecraft/world/item/FishingRodItem.java index 1013e6b5..983f1b9c 100644 --- a/net/minecraft/world/item/FishingRodItem.java +++ b/net/minecraft/world/item/FishingRodItem.java @@ -5,10 +5,11 @@ import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; import net.minecraft.stats.Stats; import net.minecraft.world.InteractionHand; -import net.minecraft.world.InteractionResultHolder; +import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.projectile.FishingHook; +import net.minecraft.world.entity.projectile.Projectile; import net.minecraft.world.item.enchantment.EnchantmentHelper; import net.minecraft.world.level.Level; import net.minecraft.world.level.gameevent.GameEvent; @@ -19,12 +20,12 @@ public class FishingRodItem extends Item { } @Override - public InteractionResultHolder use(Level level, Player player, InteractionHand usedHand) { - ItemStack itemStack = player.getItemInHand(usedHand); + public InteractionResult use(Level level, Player player, InteractionHand interactionHand) { + ItemStack itemStack = player.getItemInHand(interactionHand); if (player.fishing != null) { if (!level.isClientSide) { int i = player.fishing.retrieve(itemStack); - itemStack.hurtAndBreak(i, player, LivingEntity.getSlotForHand(usedHand)); + itemStack.hurtAndBreak(i, player, LivingEntity.getSlotForHand(interactionHand)); } level.playSound( @@ -52,18 +53,13 @@ public class FishingRodItem extends Item { if (level instanceof ServerLevel serverLevel) { int j = (int)(EnchantmentHelper.getFishingTimeReduction(serverLevel, itemStack, player) * 20.0F); int k = EnchantmentHelper.getFishingLuckBonus(serverLevel, itemStack, player); - level.addFreshEntity(new FishingHook(player, level, k, j)); + Projectile.spawnProjectile(new FishingHook(player, level, k, j, itemStack), serverLevel, itemStack); } player.awardStat(Stats.ITEM_USED.get(this)); player.gameEvent(GameEvent.ITEM_INTERACT_START); } - return InteractionResultHolder.sidedSuccess(itemStack, level.isClientSide()); - } - - @Override - public int getEnchantmentValue() { - return 1; + return InteractionResult.SUCCESS; } } diff --git a/net/minecraft/world/item/FlintAndSteelItem.java b/net/minecraft/world/item/FlintAndSteelItem.java index c8338605..2de55e0c 100644 --- a/net/minecraft/world/item/FlintAndSteelItem.java +++ b/net/minecraft/world/item/FlintAndSteelItem.java @@ -42,7 +42,7 @@ public class FlintAndSteelItem extends Item { itemStack.hurtAndBreak(1, player, LivingEntity.getSlotForHand(context.getHand())); } - return InteractionResult.sidedSuccess(level.isClientSide()); + return InteractionResult.SUCCESS; } else { return InteractionResult.FAIL; } @@ -54,7 +54,7 @@ public class FlintAndSteelItem extends Item { context.getItemInHand().hurtAndBreak(1, player, LivingEntity.getSlotForHand(context.getHand())); } - return InteractionResult.sidedSuccess(level.isClientSide()); + return InteractionResult.SUCCESS; } } } diff --git a/net/minecraft/world/item/FoodOnAStickItem.java b/net/minecraft/world/item/FoodOnAStickItem.java index c5348478..2cc6802b 100644 --- a/net/minecraft/world/item/FoodOnAStickItem.java +++ b/net/minecraft/world/item/FoodOnAStickItem.java @@ -2,7 +2,7 @@ package net.minecraft.world.item; import net.minecraft.stats.Stats; import net.minecraft.world.InteractionHand; -import net.minecraft.world.InteractionResultHolder; +import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.EquipmentSlot; @@ -15,26 +15,26 @@ public class FoodOnAStickItem extends Item { private final EntityType canInteractWith; private final int consumeItemDamage; - public FoodOnAStickItem(Item.Properties properties, EntityType canInteractWith, int consumeItemDamage) { + public FoodOnAStickItem(EntityType entityType, int i, Item.Properties properties) { super(properties); - this.canInteractWith = canInteractWith; - this.consumeItemDamage = consumeItemDamage; + this.canInteractWith = entityType; + this.consumeItemDamage = i; } @Override - public InteractionResultHolder use(Level level, Player player, InteractionHand usedHand) { - ItemStack itemStack = player.getItemInHand(usedHand); + public InteractionResult use(Level level, Player player, InteractionHand interactionHand) { + ItemStack itemStack = player.getItemInHand(interactionHand); if (level.isClientSide) { - return InteractionResultHolder.pass(itemStack); + return InteractionResult.PASS; } else { Entity entity = player.getControlledVehicle(); if (player.isPassenger() && entity instanceof ItemSteerable itemSteerable && entity.getType() == this.canInteractWith && itemSteerable.boost()) { - EquipmentSlot equipmentSlot = LivingEntity.getSlotForHand(usedHand); + EquipmentSlot equipmentSlot = LivingEntity.getSlotForHand(interactionHand); ItemStack itemStack2 = itemStack.hurtAndConvertOnBreak(this.consumeItemDamage, Items.FISHING_ROD, player, equipmentSlot); - return InteractionResultHolder.success(itemStack2); + return InteractionResult.SUCCESS_SERVER.heldItemTransformedTo(itemStack2); } else { player.awardStat(Stats.ITEM_USED.get(this)); - return InteractionResultHolder.pass(itemStack); + return InteractionResult.PASS; } } } diff --git a/net/minecraft/world/item/HangingEntityItem.java b/net/minecraft/world/item/HangingEntityItem.java index 5fc758fa..4f3063fa 100644 --- a/net/minecraft/world/item/HangingEntityItem.java +++ b/net/minecraft/world/item/HangingEntityItem.java @@ -54,7 +54,7 @@ public class HangingEntityItem extends Item { hangingEntity = new ItemFrame(level, blockPos2, direction); } else { if (this.type != EntityType.GLOW_ITEM_FRAME) { - return InteractionResult.sidedSuccess(level.isClientSide); + return InteractionResult.SUCCESS; } hangingEntity = new GlowItemFrame(level, blockPos2, direction); @@ -73,7 +73,7 @@ public class HangingEntityItem extends Item { } itemStack.shrink(1); - return InteractionResult.sidedSuccess(level.isClientSide); + return InteractionResult.SUCCESS; } else { return InteractionResult.CONSUME; } @@ -95,10 +95,8 @@ public class HangingEntityItem extends Item { .result() .ifPresentOrElse( holder -> { - holder.unwrapKey().ifPresent(resourceKey -> { - tooltipComponents.add(Component.translatable(resourceKey.location().toLanguageKey("painting", "title")).withStyle(ChatFormatting.YELLOW)); - tooltipComponents.add(Component.translatable(resourceKey.location().toLanguageKey("painting", "author")).withStyle(ChatFormatting.GRAY)); - }); + ((PaintingVariant)holder.value()).title().ifPresent(tooltipComponents::add); + ((PaintingVariant)holder.value()).author().ifPresent(tooltipComponents::add); tooltipComponents.add( Component.translatable("painting.dimensions", ((PaintingVariant)holder.value()).width(), ((PaintingVariant)holder.value()).height()) ); diff --git a/net/minecraft/world/item/HoeItem.java b/net/minecraft/world/item/HoeItem.java index 19be6e88..f94265d4 100644 --- a/net/minecraft/world/item/HoeItem.java +++ b/net/minecraft/world/item/HoeItem.java @@ -21,6 +21,7 @@ import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.level.gameevent.GameEvent.Context; public class HoeItem extends DiggerItem { protected static final Map, Consumer>> TILLABLES = Maps., Consumer>>newHashMap( @@ -38,8 +39,8 @@ public class HoeItem extends DiggerItem { ) ); - public HoeItem(Tier tier, Item.Properties properties) { - super(tier, BlockTags.MINEABLE_WITH_HOE, properties); + public HoeItem(ToolMaterial toolMaterial, float f, float g, Item.Properties properties) { + super(toolMaterial, BlockTags.MINEABLE_WITH_HOE, f, g, properties); } @Override @@ -64,7 +65,7 @@ public class HoeItem extends DiggerItem { } } - return InteractionResult.sidedSuccess(level.isClientSide); + return InteractionResult.SUCCESS; } else { return InteractionResult.PASS; } @@ -74,14 +75,14 @@ public class HoeItem extends DiggerItem { public static Consumer changeIntoState(BlockState state) { return useOnContext -> { useOnContext.getLevel().setBlock(useOnContext.getClickedPos(), state, 11); - useOnContext.getLevel().gameEvent(GameEvent.BLOCK_CHANGE, useOnContext.getClickedPos(), GameEvent.Context.of(useOnContext.getPlayer(), state)); + useOnContext.getLevel().gameEvent(GameEvent.BLOCK_CHANGE, useOnContext.getClickedPos(), Context.of(useOnContext.getPlayer(), state)); }; } public static Consumer changeIntoStateAndDropItem(BlockState state, ItemLike itemToDrop) { return useOnContext -> { useOnContext.getLevel().setBlock(useOnContext.getClickedPos(), state, 11); - useOnContext.getLevel().gameEvent(GameEvent.BLOCK_CHANGE, useOnContext.getClickedPos(), GameEvent.Context.of(useOnContext.getPlayer(), state)); + useOnContext.getLevel().gameEvent(GameEvent.BLOCK_CHANGE, useOnContext.getClickedPos(), Context.of(useOnContext.getPlayer(), state)); Block.popResourceFromFace(useOnContext.getLevel(), useOnContext.getClickedPos(), useOnContext.getClickedFace(), new ItemStack(itemToDrop)); }; } diff --git a/net/minecraft/world/item/HoneyBottleItem.java b/net/minecraft/world/item/HoneyBottleItem.java deleted file mode 100644 index 52b16cfb..00000000 --- a/net/minecraft/world/item/HoneyBottleItem.java +++ /dev/null @@ -1,72 +0,0 @@ -package net.minecraft.world.item; - -import net.minecraft.advancements.CriteriaTriggers; -import net.minecraft.server.level.ServerPlayer; -import net.minecraft.sounds.SoundEvent; -import net.minecraft.sounds.SoundEvents; -import net.minecraft.stats.Stats; -import net.minecraft.world.InteractionHand; -import net.minecraft.world.InteractionResultHolder; -import net.minecraft.world.effect.MobEffects; -import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.entity.player.Player; -import net.minecraft.world.level.Level; - -public class HoneyBottleItem extends Item { - private static final int DRINK_DURATION = 40; - - public HoneyBottleItem(Item.Properties properties) { - super(properties); - } - - @Override - public ItemStack finishUsingItem(ItemStack stack, Level level, LivingEntity livingEntity) { - super.finishUsingItem(stack, level, livingEntity); - if (livingEntity instanceof ServerPlayer serverPlayer) { - CriteriaTriggers.CONSUME_ITEM.trigger(serverPlayer, stack); - serverPlayer.awardStat(Stats.ITEM_USED.get(this)); - } - - if (!level.isClientSide) { - livingEntity.removeEffect(MobEffects.POISON); - } - - if (stack.isEmpty()) { - return new ItemStack(Items.GLASS_BOTTLE); - } else { - if (livingEntity instanceof Player player && !player.hasInfiniteMaterials()) { - ItemStack itemStack = new ItemStack(Items.GLASS_BOTTLE); - if (!player.getInventory().add(itemStack)) { - player.drop(itemStack, false); - } - } - - return stack; - } - } - - @Override - public int getUseDuration(ItemStack stack, LivingEntity entity) { - return 40; - } - - @Override - public UseAnim getUseAnimation(ItemStack stack) { - return UseAnim.DRINK; - } - - @Override - public SoundEvent getDrinkingSound() { - return SoundEvents.HONEY_DRINK; - } - - @Override - public SoundEvent getEatingSound() { - return SoundEvents.HONEY_DRINK; - } - - @Override - public InteractionResultHolder use(Level level, Player player, InteractionHand usedHand) { - return ItemUtils.startUsingInstantly(level, player, usedHand); - } -} diff --git a/net/minecraft/world/item/HoneycombItem.java b/net/minecraft/world/item/HoneycombItem.java index a045a7ca..479b0979 100644 --- a/net/minecraft/world/item/HoneycombItem.java +++ b/net/minecraft/world/item/HoneycombItem.java @@ -18,6 +18,7 @@ import net.minecraft.world.level.block.entity.SignBlockEntity; import net.minecraft.world.level.block.entity.SignText; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.level.gameevent.GameEvent.Context; public class HoneycombItem extends Item implements SignApplicator { public static final Supplier> WAXABLES = Suppliers.memoize( @@ -74,15 +75,15 @@ public class HoneycombItem extends Item implements SignApplicator { return (InteractionResult)getWaxed(blockState).map(blockStatex -> { Player player = context.getPlayer(); ItemStack itemStack = context.getItemInHand(); - if (player instanceof ServerPlayer) { - CriteriaTriggers.ITEM_USED_ON_BLOCK.trigger((ServerPlayer)player, blockPos, itemStack); + if (player instanceof ServerPlayer serverPlayer) { + CriteriaTriggers.ITEM_USED_ON_BLOCK.trigger(serverPlayer, blockPos, itemStack); } itemStack.shrink(1); level.setBlock(blockPos, blockStatex, 11); - level.gameEvent(GameEvent.BLOCK_CHANGE, blockPos, GameEvent.Context.of(player, blockStatex)); + level.gameEvent(GameEvent.BLOCK_CHANGE, blockPos, Context.of(player, blockStatex)); level.levelEvent(player, 3003, blockPos, 0); - return InteractionResult.sidedSuccess(level.isClientSide); + return InteractionResult.SUCCESS; }).orElse(InteractionResult.PASS); } diff --git a/net/minecraft/world/item/Instrument.java b/net/minecraft/world/item/Instrument.java index 5ac7c17e..fc9c3306 100644 --- a/net/minecraft/world/item/Instrument.java +++ b/net/minecraft/world/item/Instrument.java @@ -5,23 +5,34 @@ import com.mojang.serialization.codecs.RecordCodecBuilder; import net.minecraft.core.Holder; import net.minecraft.core.registries.Registries; import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.ComponentSerialization; import net.minecraft.network.codec.ByteBufCodecs; import net.minecraft.network.codec.StreamCodec; import net.minecraft.resources.RegistryFileCodec; import net.minecraft.sounds.SoundEvent; import net.minecraft.util.ExtraCodecs; -public record Instrument(Holder soundEvent, int useDuration, float range) { +public record Instrument(Holder soundEvent, float useDuration, float range, Component description) { public static final Codec DIRECT_CODEC = RecordCodecBuilder.create( instance -> instance.group( SoundEvent.CODEC.fieldOf("sound_event").forGetter(Instrument::soundEvent), - ExtraCodecs.POSITIVE_INT.fieldOf("use_duration").forGetter(Instrument::useDuration), - ExtraCodecs.POSITIVE_FLOAT.fieldOf("range").forGetter(Instrument::range) + ExtraCodecs.POSITIVE_FLOAT.fieldOf("use_duration").forGetter(Instrument::useDuration), + ExtraCodecs.POSITIVE_FLOAT.fieldOf("range").forGetter(Instrument::range), + ComponentSerialization.CODEC.fieldOf("description").forGetter(Instrument::description) ) .apply(instance, Instrument::new) ); public static final StreamCodec DIRECT_STREAM_CODEC = StreamCodec.composite( - SoundEvent.STREAM_CODEC, Instrument::soundEvent, ByteBufCodecs.VAR_INT, Instrument::useDuration, ByteBufCodecs.FLOAT, Instrument::range, Instrument::new + SoundEvent.STREAM_CODEC, + Instrument::soundEvent, + ByteBufCodecs.FLOAT, + Instrument::useDuration, + ByteBufCodecs.FLOAT, + Instrument::range, + ComponentSerialization.STREAM_CODEC, + Instrument::description, + Instrument::new ); public static final Codec> CODEC = RegistryFileCodec.create(Registries.INSTRUMENT, DIRECT_CODEC); public static final StreamCodec> STREAM_CODEC = ByteBufCodecs.holder(Registries.INSTRUMENT, DIRECT_STREAM_CODEC); diff --git a/net/minecraft/world/item/InstrumentItem.java b/net/minecraft/world/item/InstrumentItem.java index 00fe1bc4..cfd40a01 100644 --- a/net/minecraft/world/item/InstrumentItem.java +++ b/net/minecraft/world/item/InstrumentItem.java @@ -4,40 +4,47 @@ import java.util.Iterator; import java.util.List; import java.util.Optional; import net.minecraft.ChatFormatting; -import net.minecraft.Util; import net.minecraft.core.Holder; +import net.minecraft.core.HolderLookup; +import net.minecraft.core.HolderSet; import net.minecraft.core.component.DataComponents; -import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.core.registries.Registries; import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.ComponentUtils; import net.minecraft.network.chat.MutableComponent; -import net.minecraft.resources.ResourceKey; +import net.minecraft.network.chat.Style; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundSource; import net.minecraft.stats.Stats; import net.minecraft.tags.TagKey; -import net.minecraft.util.RandomSource; +import net.minecraft.util.Mth; import net.minecraft.world.InteractionHand; -import net.minecraft.world.InteractionResultHolder; +import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.player.Player; import net.minecraft.world.level.Level; import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.level.gameevent.GameEvent.Context; public class InstrumentItem extends Item { private final TagKey instruments; - public InstrumentItem(Item.Properties properties, TagKey instruments) { + public InstrumentItem(TagKey tagKey, Item.Properties properties) { super(properties); - this.instruments = instruments; + this.instruments = tagKey; } @Override public void appendHoverText(ItemStack stack, Item.TooltipContext context, List tooltipComponents, TooltipFlag tooltipFlag) { super.appendHoverText(stack, context, tooltipComponents, tooltipFlag); - Optional> optional = this.getInstrument(stack).flatMap(Holder::unwrapKey); - if (optional.isPresent()) { - MutableComponent mutableComponent = Component.translatable(Util.makeDescriptionId("instrument", ((ResourceKey)optional.get()).location())); - tooltipComponents.add(mutableComponent.withStyle(ChatFormatting.GRAY)); + HolderLookup.Provider provider = context.registries(); + if (provider != null) { + Optional> optional = this.getInstrument(stack, provider); + if (optional.isPresent()) { + MutableComponent mutableComponent = ((Instrument)((Holder)optional.get()).value()).description().copy(); + ComponentUtils.mergeStyles(mutableComponent, Style.EMPTY.withColor(ChatFormatting.GRAY)); + tooltipComponents.add(mutableComponent); + } } } @@ -47,52 +54,54 @@ public class InstrumentItem extends Item { return itemStack; } - public static void setRandom(ItemStack stack, TagKey instrumentTag, RandomSource random) { - Optional> optional = BuiltInRegistries.INSTRUMENT.getRandomElementOf(instrumentTag, random); - optional.ifPresent(holder -> stack.set(DataComponents.INSTRUMENT, holder)); - } - @Override - public InteractionResultHolder use(Level level, Player player, InteractionHand usedHand) { - ItemStack itemStack = player.getItemInHand(usedHand); - Optional> optional = this.getInstrument(itemStack); + public InteractionResult use(Level level, Player player, InteractionHand interactionHand) { + ItemStack itemStack = player.getItemInHand(interactionHand); + Optional> optional = this.getInstrument(itemStack, player.registryAccess()); if (optional.isPresent()) { Instrument instrument = (Instrument)((Holder)optional.get()).value(); - player.startUsingItem(usedHand); + player.startUsingItem(interactionHand); play(level, player, instrument); - player.getCooldowns().addCooldown(this, instrument.useDuration()); + player.getCooldowns().addCooldown(itemStack, Mth.floor(instrument.useDuration() * 20.0F)); player.awardStat(Stats.ITEM_USED.get(this)); - return InteractionResultHolder.consume(itemStack); + return InteractionResult.CONSUME; } else { - return InteractionResultHolder.fail(itemStack); + return InteractionResult.FAIL; } } @Override public int getUseDuration(ItemStack stack, LivingEntity entity) { - Optional> optional = this.getInstrument(stack); - return (Integer)optional.map(holder -> ((Instrument)holder.value()).useDuration()).orElse(0); + Optional> optional = this.getInstrument(stack, entity.registryAccess()); + return (Integer)optional.map(holder -> Mth.floor(((Instrument)holder.value()).useDuration() * 20.0F)).orElse(0); } - private Optional> getInstrument(ItemStack stack) { - Holder holder = stack.get(DataComponents.INSTRUMENT); + private Optional> getInstrument(ItemStack itemStack, HolderLookup.Provider provider) { + Holder holder = itemStack.get(DataComponents.INSTRUMENT); if (holder != null) { return Optional.of(holder); } else { - Iterator> iterator = BuiltInRegistries.INSTRUMENT.getTagOrEmpty(this.instruments).iterator(); - return iterator.hasNext() ? Optional.of((Holder)iterator.next()) : Optional.empty(); + Optional> optional = provider.lookupOrThrow(Registries.INSTRUMENT).get(this.instruments); + if (optional.isPresent()) { + Iterator> iterator = ((HolderSet.Named)optional.get()).iterator(); + if (iterator.hasNext()) { + return Optional.of((Holder)iterator.next()); + } + } + + return Optional.empty(); } } @Override - public UseAnim getUseAnimation(ItemStack stack) { - return UseAnim.TOOT_HORN; + public ItemUseAnimation getUseAnimation(ItemStack itemStack) { + return ItemUseAnimation.TOOT_HORN; } private static void play(Level level, Player player, Instrument instrument) { SoundEvent soundEvent = instrument.soundEvent().value(); float f = instrument.range() / 16.0F; level.playSound(player, player, soundEvent, SoundSource.RECORDS, f, 1.0F); - level.gameEvent(GameEvent.INSTRUMENT_PLAY, player.position(), GameEvent.Context.of(player)); + level.gameEvent(GameEvent.INSTRUMENT_PLAY, player.position(), Context.of(player)); } } diff --git a/net/minecraft/world/item/Instruments.java b/net/minecraft/world/item/Instruments.java index 957068d2..a047b171 100644 --- a/net/minecraft/world/item/Instruments.java +++ b/net/minecraft/world/item/Instruments.java @@ -1,8 +1,11 @@ package net.minecraft.world.item; +import net.minecraft.Util; import net.minecraft.core.Holder; -import net.minecraft.core.Registry; import net.minecraft.core.registries.Registries; +import net.minecraft.data.worldgen.BootstrapContext; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.MutableComponent; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; import net.minecraft.sounds.SoundEvent; @@ -10,7 +13,7 @@ import net.minecraft.sounds.SoundEvents; public interface Instruments { int GOAT_HORN_RANGE_BLOCKS = 256; - int GOAT_HORN_DURATION = 140; + float GOAT_HORN_DURATION = 7.0F; ResourceKey PONDER_GOAT_HORN = create("ponder_goat_horn"); ResourceKey SING_GOAT_HORN = create("sing_goat_horn"); ResourceKey SEEK_GOAT_HORN = create("seek_goat_horn"); @@ -24,14 +27,19 @@ public interface Instruments { return ResourceKey.create(Registries.INSTRUMENT, ResourceLocation.withDefaultNamespace(name)); } - static Instrument bootstrap(Registry registry) { - Registry.register(registry, PONDER_GOAT_HORN, new Instrument((Holder)SoundEvents.GOAT_HORN_SOUND_VARIANTS.get(0), 140, 256.0F)); - Registry.register(registry, SING_GOAT_HORN, new Instrument((Holder)SoundEvents.GOAT_HORN_SOUND_VARIANTS.get(1), 140, 256.0F)); - Registry.register(registry, SEEK_GOAT_HORN, new Instrument((Holder)SoundEvents.GOAT_HORN_SOUND_VARIANTS.get(2), 140, 256.0F)); - Registry.register(registry, FEEL_GOAT_HORN, new Instrument((Holder)SoundEvents.GOAT_HORN_SOUND_VARIANTS.get(3), 140, 256.0F)); - Registry.register(registry, ADMIRE_GOAT_HORN, new Instrument((Holder)SoundEvents.GOAT_HORN_SOUND_VARIANTS.get(4), 140, 256.0F)); - Registry.register(registry, CALL_GOAT_HORN, new Instrument((Holder)SoundEvents.GOAT_HORN_SOUND_VARIANTS.get(5), 140, 256.0F)); - Registry.register(registry, YEARN_GOAT_HORN, new Instrument((Holder)SoundEvents.GOAT_HORN_SOUND_VARIANTS.get(6), 140, 256.0F)); - return Registry.register(registry, DREAM_GOAT_HORN, new Instrument((Holder)SoundEvents.GOAT_HORN_SOUND_VARIANTS.get(7), 140, 256.0F)); + static void bootstrap(BootstrapContext bootstrapContext) { + register(bootstrapContext, PONDER_GOAT_HORN, (Holder)SoundEvents.GOAT_HORN_SOUND_VARIANTS.get(0), 7.0F, 256.0F); + register(bootstrapContext, SING_GOAT_HORN, (Holder)SoundEvents.GOAT_HORN_SOUND_VARIANTS.get(1), 7.0F, 256.0F); + register(bootstrapContext, SEEK_GOAT_HORN, (Holder)SoundEvents.GOAT_HORN_SOUND_VARIANTS.get(2), 7.0F, 256.0F); + register(bootstrapContext, FEEL_GOAT_HORN, (Holder)SoundEvents.GOAT_HORN_SOUND_VARIANTS.get(3), 7.0F, 256.0F); + register(bootstrapContext, ADMIRE_GOAT_HORN, (Holder)SoundEvents.GOAT_HORN_SOUND_VARIANTS.get(4), 7.0F, 256.0F); + register(bootstrapContext, CALL_GOAT_HORN, (Holder)SoundEvents.GOAT_HORN_SOUND_VARIANTS.get(5), 7.0F, 256.0F); + register(bootstrapContext, YEARN_GOAT_HORN, (Holder)SoundEvents.GOAT_HORN_SOUND_VARIANTS.get(6), 7.0F, 256.0F); + register(bootstrapContext, DREAM_GOAT_HORN, (Holder)SoundEvents.GOAT_HORN_SOUND_VARIANTS.get(7), 7.0F, 256.0F); + } + + static void register(BootstrapContext bootstrapContext, ResourceKey resourceKey, Holder holder, float f, float g) { + MutableComponent mutableComponent = Component.translatable(Util.makeDescriptionId("instrument", resourceKey.location())); + bootstrapContext.register(resourceKey, new Instrument(holder, f, g, mutableComponent)); } } diff --git a/net/minecraft/world/item/Item.java b/net/minecraft/world/item/Item.java index 7d9bb31c..7a3301ab 100644 --- a/net/minecraft/world/item/Item.java +++ b/net/minecraft/world/item/Item.java @@ -1,31 +1,38 @@ package net.minecraft.world.item; -import com.google.common.collect.Interner; -import com.google.common.collect.Interners; +import com.google.common.annotations.VisibleForTesting; import com.google.common.collect.Maps; import com.mojang.logging.LogUtils; +import com.mojang.serialization.Codec; +import com.mojang.serialization.DataResult; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.Optional; import net.minecraft.SharedConstants; import net.minecraft.Util; import net.minecraft.core.BlockPos; import net.minecraft.core.Holder; +import net.minecraft.core.HolderGetter; import net.minecraft.core.HolderLookup; +import net.minecraft.core.HolderSet; import net.minecraft.core.component.DataComponentMap; import net.minecraft.core.component.DataComponentType; import net.minecraft.core.component.DataComponents; +import net.minecraft.core.component.DataComponentMap.Builder; import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.network.chat.CommonComponents; import net.minecraft.network.chat.Component; +import net.minecraft.resources.DependantName; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; +import net.minecraft.tags.DamageTypeTags; +import net.minecraft.tags.TagKey; import net.minecraft.util.Mth; -import net.minecraft.util.Unit; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; -import net.minecraft.world.InteractionResultHolder; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EquipmentSlot; @@ -41,12 +48,24 @@ import net.minecraft.world.food.FoodProperties; import net.minecraft.world.inventory.ClickAction; import net.minecraft.world.inventory.Slot; import net.minecraft.world.inventory.tooltip.TooltipComponent; +import net.minecraft.world.item.Item.TooltipContext.1; +import net.minecraft.world.item.Item.TooltipContext.2; +import net.minecraft.world.item.Item.TooltipContext.3; +import net.minecraft.world.item.component.Consumable; +import net.minecraft.world.item.component.Consumables; +import net.minecraft.world.item.component.DamageResistant; import net.minecraft.world.item.component.ItemAttributeModifiers; import net.minecraft.world.item.component.Tool; +import net.minecraft.world.item.component.UseCooldown; +import net.minecraft.world.item.component.UseRemainder; import net.minecraft.world.item.context.UseOnContext; +import net.minecraft.world.item.enchantment.Enchantable; +import net.minecraft.world.item.enchantment.Repairable; +import net.minecraft.world.item.equipment.Equippable; import net.minecraft.world.level.ClipContext; import net.minecraft.world.level.ItemLike; import net.minecraft.world.level.Level; +import net.minecraft.world.level.ClipContext.Fluid; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.saveddata.maps.MapId; @@ -57,6 +76,9 @@ import org.jetbrains.annotations.Nullable; import org.slf4j.Logger; public class Item implements FeatureElement, ItemLike { + public static final Codec> CODEC = BuiltInRegistries.ITEM + .holderByNameCodec() + .validate(holder -> holder.is(Items.AIR.builtInRegistryHolder()) ? DataResult.error(() -> "Item must not be minecraft:air") : DataResult.success(holder)); private static final Logger LOGGER = LogUtils.getLogger(); public static final Map BY_BLOCK = Maps.newHashMap(); public static final ResourceLocation BASE_ATTACK_DAMAGE_ID = ResourceLocation.withDefaultNamespace("base_attack_damage"); @@ -68,8 +90,7 @@ public class Item implements FeatureElement, ItemLike { private final DataComponentMap components; @Nullable private final Item craftingRemainingItem; - @Nullable - private String descriptionId; + protected final String descriptionId; private final FeatureFlagSet requiredFeatures; public static int getId(Item item) { @@ -86,7 +107,8 @@ public class Item implements FeatureElement, ItemLike { } public Item(Item.Properties properties) { - this.components = properties.buildAndValidateComponents(); + this.descriptionId = properties.effectiveDescriptionId(); + this.components = properties.buildAndValidateComponents(Component.translatable(this.descriptionId), properties.effectiveModel()); this.craftingRemainingItem = properties.craftingRemainingItem; this.requiredFeatures = properties.requiredFeatures; if (SharedConstants.IS_RUNNING_IN_IDE) { @@ -143,21 +165,14 @@ public class Item implements FeatureElement, ItemLike { return tool != null ? tool.getMiningSpeed(state) : 1.0F; } - /** - * Called to trigger the item's "innate" right click behavior. To handle when this item is used on a Block, see {@link net.minecraft.world.item.Item#useOn(net.minecraft.world.item.context.UseOnContext)}. - */ - public InteractionResultHolder use(Level level, Player player, InteractionHand usedHand) { - ItemStack itemStack = player.getItemInHand(usedHand); - FoodProperties foodProperties = itemStack.get(DataComponents.FOOD); - if (foodProperties != null) { - if (player.canEat(foodProperties.canAlwaysEat())) { - player.startUsingItem(usedHand); - return InteractionResultHolder.consume(itemStack); - } else { - return InteractionResultHolder.fail(itemStack); - } + public InteractionResult use(Level level, Player player, InteractionHand interactionHand) { + ItemStack itemStack = player.getItemInHand(interactionHand); + Consumable consumable = itemStack.get(DataComponents.CONSUMABLE); + if (consumable != null) { + return consumable.startConsuming(player, itemStack, interactionHand); } else { - return InteractionResultHolder.pass(player.getItemInHand(usedHand)); + Equippable equippable = itemStack.get(DataComponents.EQUIPPABLE); + return (InteractionResult)(equippable != null && equippable.swappable() ? equippable.swapWithEquipmentSlot(itemStack, player) : InteractionResult.PASS); } } @@ -165,8 +180,8 @@ public class Item implements FeatureElement, ItemLike { * Called when the player finishes using this Item (E.g. finishes eating.). Not called when the player stops using the Item before the action is complete. */ public ItemStack finishUsingItem(ItemStack stack, Level level, LivingEntity livingEntity) { - FoodProperties foodProperties = stack.get(DataComponents.FOOD); - return foodProperties != null ? livingEntity.eat(level, stack, foodProperties) : stack; + Consumable consumable = stack.get(DataComponents.CONSUMABLE); + return consumable != null ? consumable.onConsume(level, livingEntity, stack) : stack; } public boolean isBarVisible(ItemStack stack) { @@ -195,6 +210,11 @@ public class Item implements FeatureElement, ItemLike { return 0.0F; } + @Nullable + public DamageSource getDamageSource(LivingEntity livingEntity) { + return null; + } + /** * Current implementations of this method in child classes do not use the entry argument beside ev. They just raise the damage on the stack. */ @@ -233,46 +253,12 @@ public class Item implements FeatureElement, ItemLike { return InteractionResult.PASS; } - public Component getDescription() { - return Component.translatable(this.getDescriptionId()); - } - public String toString() { return BuiltInRegistries.ITEM.wrapAsHolder(this).getRegisteredName(); } - protected String getOrCreateDescriptionId() { - if (this.descriptionId == null) { - this.descriptionId = Util.makeDescriptionId("item", BuiltInRegistries.ITEM.getKey(this)); - } - - return this.descriptionId; - } - - /** - * Returns the unlocalized name of this item. - */ - public String getDescriptionId() { - return this.getOrCreateDescriptionId(); - } - - /** - * Returns the unlocalized name of this item. This version accepts an ItemStack so different stacks can have different names based on their damage or NBT. - */ - public String getDescriptionId(ItemStack stack) { - return this.getDescriptionId(); - } - - @Nullable - public final Item getCraftingRemainingItem() { - return this.craftingRemainingItem; - } - - /** - * True if this Item has a container item (a.k.a. crafting result) - */ - public boolean hasCraftingRemainingItem() { - return this.craftingRemainingItem != null; + public final ItemStack getCraftingRemainder() { + return this.craftingRemainingItem == null ? ItemStack.EMPTY : new ItemStack(this.craftingRemainingItem); } /** @@ -291,29 +277,18 @@ public class Item implements FeatureElement, ItemLike { public void onCraftedPostProcess(ItemStack stack, Level level) { } - /** - * Returns {@code true} if this is a complex item. - */ - public boolean isComplex() { - return false; - } - - /** - * Returns the action that specifies what animation to play when the item is being used. - */ - public UseAnim getUseAnimation(ItemStack stack) { - return stack.has(DataComponents.FOOD) ? UseAnim.EAT : UseAnim.NONE; + public ItemUseAnimation getUseAnimation(ItemStack itemStack) { + Consumable consumable = itemStack.get(DataComponents.CONSUMABLE); + return consumable != null ? consumable.animation() : ItemUseAnimation.NONE; } public int getUseDuration(ItemStack stack, LivingEntity entity) { - FoodProperties foodProperties = stack.get(DataComponents.FOOD); - return foodProperties != null ? foodProperties.eatDurationTicks() : 0; + Consumable consumable = stack.get(DataComponents.CONSUMABLE); + return consumable != null ? consumable.consumeTicks() : 0; } - /** - * Called when the player stops using an Item (stops holding the right mouse button). - */ - public void releaseUsing(ItemStack stack, Level level, LivingEntity livingEntity, int timeCharged) { + public boolean releaseUsing(ItemStack itemStack, Level level, LivingEntity livingEntity, int i) { + return false; } public void appendHoverText(ItemStack stack, Item.TooltipContext context, List tooltipComponents, TooltipFlag tooltipFlag) { @@ -323,8 +298,20 @@ public class Item implements FeatureElement, ItemLike { return Optional.empty(); } + /** + * Returns the unlocalized name of this item. + */ + @VisibleForTesting + public final String getDescriptionId() { + return this.descriptionId; + } + + public final Component getName() { + return this.components.getOrDefault(DataComponents.ITEM_NAME, CommonComponents.EMPTY); + } + public Component getName(ItemStack stack) { - return Component.translatable(this.getDescriptionId(stack)); + return stack.getComponents().getOrDefault(DataComponents.ITEM_NAME, CommonComponents.EMPTY); } /** @@ -336,36 +323,10 @@ public class Item implements FeatureElement, ItemLike { return stack.isEnchanted(); } - /** - * Checks isDamagable and if it cannot be stacked - */ - public boolean isEnchantable(ItemStack stack) { - return stack.getMaxStackSize() == 1 && stack.has(DataComponents.MAX_DAMAGE); - } - - protected static BlockHitResult getPlayerPOVHitResult(Level level, Player player, ClipContext.Fluid fluidMode) { + protected static BlockHitResult getPlayerPOVHitResult(Level level, Player player, Fluid fluidMode) { Vec3 vec3 = player.getEyePosition(); Vec3 vec32 = vec3.add(player.calculateViewVector(player.getXRot(), player.getYRot()).scale(player.blockInteractionRange())); - return level.clip(new ClipContext(vec3, vec32, ClipContext.Block.OUTLINE, fluidMode, player)); - } - - /** - * Return the enchantability factor of the item, most of the time is based on material. - */ - public int getEnchantmentValue() { - return 0; - } - - /** - * Return whether this item is repairable in an anvil. - */ - public boolean isValidRepairItem(ItemStack stack, ItemStack repairCandidate) { - return false; - } - - @Deprecated - public ItemAttributeModifiers getDefaultAttributeModifiers() { - return ItemAttributeModifiers.EMPTY; + return level.clip(new ClipContext(vec3, vec32, net.minecraft.world.level.ClipContext.Block.OUTLINE, fluidMode, player)); } /** @@ -379,14 +340,6 @@ public class Item implements FeatureElement, ItemLike { return new ItemStack(this); } - public SoundEvent getDrinkingSound() { - return SoundEvents.GENERIC_DRINK; - } - - public SoundEvent getEatingSound() { - return SoundEvents.GENERIC_EAT; - } - public SoundEvent getBreakingSound() { return SoundEvents.ITEM_BREAK; } @@ -401,15 +354,31 @@ public class Item implements FeatureElement, ItemLike { } public static class Properties { - private static final Interner COMPONENT_INTERNER = Interners.newStrongInterner(); - @Nullable - private DataComponentMap.Builder components; + private static final DependantName BLOCK_DESCRIPTION_ID = resourceKey -> Util.makeDescriptionId("block", resourceKey.location()); + private static final DependantName ITEM_DESCRIPTION_ID = resourceKey -> Util.makeDescriptionId("item", resourceKey.location()); + private final Builder components = DataComponentMap.builder().addAll(DataComponents.COMMON_ITEM_COMPONENTS); @Nullable Item craftingRemainingItem; FeatureFlagSet requiredFeatures = FeatureFlags.VANILLA_SET; + @Nullable + private ResourceKey id; + private DependantName descriptionId = ITEM_DESCRIPTION_ID; + private DependantName model = ResourceKey::location; public Item.Properties food(FoodProperties food) { - return this.component(DataComponents.FOOD, food); + return this.food(food, Consumables.DEFAULT_FOOD); + } + + public Item.Properties food(FoodProperties foodProperties, Consumable consumable) { + return this.component(DataComponents.FOOD, foodProperties).component(DataComponents.CONSUMABLE, consumable); + } + + public Item.Properties usingConvertsTo(Item item) { + return this.component(DataComponents.USE_REMAINDER, new UseRemainder(new ItemStack(item))); + } + + public Item.Properties useCooldown(float f) { + return this.component(DataComponents.USE_COOLDOWN, new UseCooldown(f)); } public Item.Properties stacksTo(int maxStackSize) { @@ -433,23 +402,73 @@ public class Item implements FeatureElement, ItemLike { } public Item.Properties fireResistant() { - return this.component(DataComponents.FIRE_RESISTANT, Unit.INSTANCE); + return this.component(DataComponents.DAMAGE_RESISTANT, new DamageResistant(DamageTypeTags.IS_FIRE)); } public Item.Properties jukeboxPlayable(ResourceKey song) { return this.component(DataComponents.JUKEBOX_PLAYABLE, new JukeboxPlayable(new EitherHolder<>(song), true)); } + public Item.Properties enchantable(int i) { + return this.component(DataComponents.ENCHANTABLE, new Enchantable(i)); + } + + public Item.Properties repairable(Item item) { + return this.component(DataComponents.REPAIRABLE, new Repairable(HolderSet.direct(item.builtInRegistryHolder()))); + } + + public Item.Properties repairable(TagKey tagKey) { + HolderGetter holderGetter = BuiltInRegistries.acquireBootstrapRegistrationLookup(BuiltInRegistries.ITEM); + return this.component(DataComponents.REPAIRABLE, new Repairable(holderGetter.getOrThrow(tagKey))); + } + + public Item.Properties equippable(EquipmentSlot equipmentSlot) { + return this.component(DataComponents.EQUIPPABLE, Equippable.builder(equipmentSlot).build()); + } + + public Item.Properties equippableUnswappable(EquipmentSlot equipmentSlot) { + return this.component(DataComponents.EQUIPPABLE, Equippable.builder(equipmentSlot).setSwappable(false).build()); + } + public Item.Properties requiredFeatures(FeatureFlag... requiredFeatures) { this.requiredFeatures = FeatureFlags.REGISTRY.subset(requiredFeatures); return this; } - public Item.Properties component(DataComponentType component, T value) { - if (this.components == null) { - this.components = DataComponentMap.builder().addAll(DataComponents.COMMON_ITEM_COMPONENTS); - } + public Item.Properties setId(ResourceKey resourceKey) { + this.id = resourceKey; + return this; + } + public Item.Properties overrideDescription(String string) { + this.descriptionId = DependantName.fixed(string); + return this; + } + + public Item.Properties useBlockDescriptionPrefix() { + this.descriptionId = BLOCK_DESCRIPTION_ID; + return this; + } + + public Item.Properties useItemDescriptionPrefix() { + this.descriptionId = ITEM_DESCRIPTION_ID; + return this; + } + + protected String effectiveDescriptionId() { + return this.descriptionId.get((ResourceKey)Objects.requireNonNull(this.id, "Item id not set")); + } + + public Item.Properties overrideModel(ResourceLocation resourceLocation) { + this.model = DependantName.fixed(resourceLocation); + return this; + } + + public ResourceLocation effectiveModel() { + return this.model.get((ResourceKey)Objects.requireNonNull(this.id, "Item id not set")); + } + + public Item.Properties component(DataComponentType component, T value) { this.components.set(component, value); return this; } @@ -458,39 +477,18 @@ public class Item implements FeatureElement, ItemLike { return this.component(DataComponents.ATTRIBUTE_MODIFIERS, attributes); } - DataComponentMap buildAndValidateComponents() { - DataComponentMap dataComponentMap = this.buildComponents(); + DataComponentMap buildAndValidateComponents(Component component, ResourceLocation resourceLocation) { + DataComponentMap dataComponentMap = this.components.set(DataComponents.ITEM_NAME, component).set(DataComponents.ITEM_MODEL, resourceLocation).build(); if (dataComponentMap.has(DataComponents.DAMAGE) && dataComponentMap.getOrDefault(DataComponents.MAX_STACK_SIZE, 1) > 1) { throw new IllegalStateException("Item cannot have both durability and be stackable"); } else { return dataComponentMap; } } - - private DataComponentMap buildComponents() { - return this.components == null ? DataComponents.COMMON_ITEM_COMPONENTS : COMPONENT_INTERNER.intern(this.components.build()); - } } public interface TooltipContext { - Item.TooltipContext EMPTY = new Item.TooltipContext() { - @Nullable - @Override - public HolderLookup.Provider registries() { - return null; - } - - @Override - public float tickRate() { - return 20.0F; - } - - @Nullable - @Override - public MapItemSavedData mapData(MapId mapId) { - return null; - } - }; + Item.TooltipContext EMPTY = new 1(); @Nullable HolderLookup.Provider registries(); @@ -501,42 +499,11 @@ public class Item implements FeatureElement, ItemLike { MapItemSavedData mapData(MapId mapId); static Item.TooltipContext of(@Nullable Level level) { - return level == null ? EMPTY : new Item.TooltipContext() { - @Override - public HolderLookup.Provider registries() { - return level.registryAccess(); - } - - @Override - public float tickRate() { - return level.tickRateManager().tickrate(); - } - - @Override - public MapItemSavedData mapData(MapId mapId) { - return level.getMapData(mapId); - } - }; + return (Item.TooltipContext)(level == null ? EMPTY : new 2(level)); } static Item.TooltipContext of(HolderLookup.Provider registries) { - return new Item.TooltipContext() { - @Override - public HolderLookup.Provider registries() { - return registries; - } - - @Override - public float tickRate() { - return 20.0F; - } - - @Nullable - @Override - public MapItemSavedData mapData(MapId mapId) { - return null; - } - }; + return new 3(registries); } } } diff --git a/net/minecraft/world/item/ItemCooldowns.java b/net/minecraft/world/item/ItemCooldowns.java index 18a137ac..f37b25ac 100644 --- a/net/minecraft/world/item/ItemCooldowns.java +++ b/net/minecraft/world/item/ItemCooldowns.java @@ -4,22 +4,27 @@ import com.google.common.collect.Maps; import java.util.Iterator; import java.util.Map; import java.util.Map.Entry; +import net.minecraft.core.component.DataComponents; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.resources.ResourceLocation; import net.minecraft.util.Mth; +import net.minecraft.world.item.component.UseCooldown; public class ItemCooldowns { - private final Map cooldowns = Maps.newHashMap(); + private final Map cooldowns = Maps.newHashMap(); private int tickCount; - public boolean isOnCooldown(Item item) { - return this.getCooldownPercent(item, 0.0F) > 0.0F; + public boolean isOnCooldown(ItemStack itemStack) { + return this.getCooldownPercent(itemStack, 0.0F) > 0.0F; } - public float getCooldownPercent(Item item, float partialTicks) { - ItemCooldowns.CooldownInstance cooldownInstance = (ItemCooldowns.CooldownInstance)this.cooldowns.get(item); + public float getCooldownPercent(ItemStack itemStack, float f) { + ResourceLocation resourceLocation = this.getCooldownGroup(itemStack); + ItemCooldowns.CooldownInstance cooldownInstance = (ItemCooldowns.CooldownInstance)this.cooldowns.get(resourceLocation); if (cooldownInstance != null) { - float f = cooldownInstance.endTime - cooldownInstance.startTime; - float g = cooldownInstance.endTime - (this.tickCount + partialTicks); - return Mth.clamp(g / f, 0.0F, 1.0F); + float g = cooldownInstance.endTime - cooldownInstance.startTime; + float h = cooldownInstance.endTime - (this.tickCount + f); + return Mth.clamp(h / g, 0.0F, 1.0F); } else { return 0.0F; } @@ -28,41 +33,44 @@ public class ItemCooldowns { public void tick() { this.tickCount++; if (!this.cooldowns.isEmpty()) { - Iterator> iterator = this.cooldowns.entrySet().iterator(); + Iterator> iterator = this.cooldowns.entrySet().iterator(); while (iterator.hasNext()) { - Entry entry = (Entry)iterator.next(); + Entry entry = (Entry)iterator.next(); if (((ItemCooldowns.CooldownInstance)entry.getValue()).endTime <= this.tickCount) { iterator.remove(); - this.onCooldownEnded((Item)entry.getKey()); + this.onCooldownEnded((ResourceLocation)entry.getKey()); } } } } - public void addCooldown(Item item, int ticks) { - this.cooldowns.put(item, new ItemCooldowns.CooldownInstance(this.tickCount, this.tickCount + ticks)); - this.onCooldownStarted(item, ticks); + public ResourceLocation getCooldownGroup(ItemStack itemStack) { + UseCooldown useCooldown = itemStack.get(DataComponents.USE_COOLDOWN); + ResourceLocation resourceLocation = BuiltInRegistries.ITEM.getKey(itemStack.getItem()); + return useCooldown == null ? resourceLocation : (ResourceLocation)useCooldown.cooldownGroup().orElse(resourceLocation); } - public void removeCooldown(Item item) { - this.cooldowns.remove(item); - this.onCooldownEnded(item); + public void addCooldown(ItemStack itemStack, int i) { + this.addCooldown(this.getCooldownGroup(itemStack), i); } - protected void onCooldownStarted(Item item, int ticks) { + public void addCooldown(ResourceLocation resourceLocation, int i) { + this.cooldowns.put(resourceLocation, new ItemCooldowns.CooldownInstance(this.tickCount, this.tickCount + i)); + this.onCooldownStarted(resourceLocation, i); } - protected void onCooldownEnded(Item item) { + public void removeCooldown(ResourceLocation resourceLocation) { + this.cooldowns.remove(resourceLocation); + this.onCooldownEnded(resourceLocation); } - static class CooldownInstance { - final int startTime; - final int endTime; + protected void onCooldownStarted(ResourceLocation resourceLocation, int i) { + } - CooldownInstance(int startTime, int endTime) { - this.startTime = startTime; - this.endTime = endTime; - } + protected void onCooldownEnded(ResourceLocation resourceLocation) { + } + + record CooldownInstance(int startTime, int endTime) { } } diff --git a/net/minecraft/world/item/ItemDisplayContext.java b/net/minecraft/world/item/ItemDisplayContext.java index 04e675ab..5de0709d 100644 --- a/net/minecraft/world/item/ItemDisplayContext.java +++ b/net/minecraft/world/item/ItemDisplayContext.java @@ -4,6 +4,7 @@ import com.mojang.serialization.Codec; import java.util.function.IntFunction; import net.minecraft.util.ByIdMap; import net.minecraft.util.StringRepresentable; +import net.minecraft.util.ByIdMap.OutOfBoundsStrategy; public enum ItemDisplayContext implements StringRepresentable { NONE(0, "none"), @@ -17,7 +18,7 @@ public enum ItemDisplayContext implements StringRepresentable { FIXED(8, "fixed"); public static final Codec CODEC = StringRepresentable.fromEnum(ItemDisplayContext::values); - public static final IntFunction BY_ID = ByIdMap.continuous(ItemDisplayContext::getId, values(), ByIdMap.OutOfBoundsStrategy.ZERO); + public static final IntFunction BY_ID = ByIdMap.continuous(ItemDisplayContext::getId, values(), OutOfBoundsStrategy.ZERO); private final byte id; private final String name; diff --git a/net/minecraft/world/item/ItemNameBlockItem.java b/net/minecraft/world/item/ItemNameBlockItem.java deleted file mode 100644 index eabd12f8..00000000 --- a/net/minecraft/world/item/ItemNameBlockItem.java +++ /dev/null @@ -1,14 +0,0 @@ -package net.minecraft.world.item; - -import net.minecraft.world.level.block.Block; - -public class ItemNameBlockItem extends BlockItem { - public ItemNameBlockItem(Block block, Item.Properties properties) { - super(block, properties); - } - - @Override - public String getDescriptionId() { - return this.getOrCreateDescriptionId(); - } -} diff --git a/net/minecraft/world/item/ItemStack.java b/net/minecraft/world/item/ItemStack.java index 13b2ee03..a6d6ee50 100644 --- a/net/minecraft/world/item/ItemStack.java +++ b/net/minecraft/world/item/ItemStack.java @@ -49,15 +49,14 @@ import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.sounds.SoundEvent; import net.minecraft.stats.Stats; -import net.minecraft.tags.DamageTypeTags; import net.minecraft.tags.TagKey; import net.minecraft.util.ExtraCodecs; import net.minecraft.util.Mth; import net.minecraft.util.NullOps; +import net.minecraft.util.StringUtil; import net.minecraft.util.Unit; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; -import net.minecraft.world.InteractionResultHolder; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EquipmentSlot; @@ -74,13 +73,19 @@ import net.minecraft.world.flag.FeatureFlagSet; import net.minecraft.world.inventory.ClickAction; import net.minecraft.world.inventory.Slot; import net.minecraft.world.inventory.tooltip.TooltipComponent; +import net.minecraft.world.item.component.Consumable; +import net.minecraft.world.item.component.DamageResistant; import net.minecraft.world.item.component.ItemAttributeModifiers; import net.minecraft.world.item.component.ItemContainerContents; import net.minecraft.world.item.component.TooltipProvider; +import net.minecraft.world.item.component.UseCooldown; +import net.minecraft.world.item.component.UseRemainder; +import net.minecraft.world.item.component.WrittenBookContent; import net.minecraft.world.item.context.UseOnContext; import net.minecraft.world.item.enchantment.Enchantment; import net.minecraft.world.item.enchantment.EnchantmentHelper; import net.minecraft.world.item.enchantment.ItemEnchantments; +import net.minecraft.world.item.enchantment.Repairable; import net.minecraft.world.level.ItemLike; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.state.BlockState; @@ -91,13 +96,10 @@ import org.jetbrains.annotations.Nullable; import org.slf4j.Logger; public final class ItemStack implements DataComponentHolder { - public static final Codec> ITEM_NON_AIR_CODEC = BuiltInRegistries.ITEM - .holderByNameCodec() - .validate(holder -> holder.is(Items.AIR.builtInRegistryHolder()) ? DataResult.error(() -> "Item must not be minecraft:air") : DataResult.success(holder)); public static final Codec CODEC = Codec.lazyInitialized( () -> RecordCodecBuilder.create( instance -> instance.group( - ITEM_NON_AIR_CODEC.fieldOf("id").forGetter(ItemStack::getItemHolder), + Item.CODEC.fieldOf("id").forGetter(ItemStack::getItemHolder), ExtraCodecs.intRange(1, 99).fieldOf("count").orElse(1).forGetter(ItemStack::getCount), DataComponentPatch.CODEC.optionalFieldOf("components", DataComponentPatch.EMPTY).forGetter(itemStack -> itemStack.components.asPatch()) ) @@ -107,7 +109,7 @@ public final class ItemStack implements DataComponentHolder { public static final Codec SINGLE_ITEM_CODEC = Codec.lazyInitialized( () -> RecordCodecBuilder.create( instance -> instance.group( - ITEM_NON_AIR_CODEC.fieldOf("id").forGetter(ItemStack::getItemHolder), + Item.CODEC.fieldOf("id").forGetter(ItemStack::getItemHolder), DataComponentPatch.CODEC.optionalFieldOf("components", DataComponentPatch.EMPTY).forGetter(itemStack -> itemStack.components.asPatch()) ) .apply(instance, (holder, dataComponentPatch) -> new ItemStack(holder, 1, dataComponentPatch)) @@ -117,7 +119,7 @@ public final class ItemStack implements DataComponentHolder { public static final Codec STRICT_SINGLE_ITEM_CODEC = SINGLE_ITEM_CODEC.validate(ItemStack::validateStrict); public static final Codec OPTIONAL_CODEC = ExtraCodecs.optionalEmptyMap(CODEC) .xmap(optional -> (ItemStack)optional.orElse(ItemStack.EMPTY), itemStack -> itemStack.isEmpty() ? Optional.empty() : Optional.of(itemStack)); - public static final Codec SIMPLE_ITEM_CODEC = ITEM_NON_AIR_CODEC.xmap(ItemStack::new, ItemStack::getItemHolder); + public static final Codec SIMPLE_ITEM_CODEC = Item.CODEC.xmap(ItemStack::new, ItemStack::getItemHolder); public static final StreamCodec OPTIONAL_STREAM_CODEC = new StreamCodec() { private static final StreamCodec> ITEM_STREAM_CODEC = ByteBufCodecs.holderRegistry(Registries.ITEM); @@ -163,9 +165,6 @@ public final class ItemStack implements DataComponentHolder { public static final StreamCodec> OPTIONAL_LIST_STREAM_CODEC = OPTIONAL_STREAM_CODEC.apply( ByteBufCodecs.collection(NonNullList::createWithCapacity) ); - public static final StreamCodec> LIST_STREAM_CODEC = STREAM_CODEC.apply( - ByteBufCodecs.collection(NonNullList::createWithCapacity) - ); private static final Logger LOGGER = LogUtils.getLogger(); public static final ItemStack EMPTY = new ItemStack((Void)null); private static final Component DISABLED_ITEM_TOOLTIP = Component.translatable("item.disabled").withStyle(ChatFormatting.RED); @@ -219,6 +218,10 @@ public final class ItemStack implements DataComponentHolder { return (DataComponentMap)(!this.isEmpty() ? this.components : DataComponentMap.EMPTY); } + public void clearComponents() { + this.components.clearPatch(); + } + public DataComponentMap getPrototype() { return !this.isEmpty() ? this.getItem().components() : DataComponentMap.EMPTY; } @@ -357,7 +360,7 @@ public final class ItemStack implements DataComponentHolder { } else { Item item = this.getItem(); InteractionResult interactionResult = item.useOn(context); - if (player != null && interactionResult.indicateItemUse()) { + if (player != null && interactionResult instanceof InteractionResult.Success success && success.wasItemInteraction()) { player.awardStat(Stats.ITEM_USED.get(item)); } @@ -369,18 +372,42 @@ public final class ItemStack implements DataComponentHolder { return this.getItem().getDestroySpeed(this, state); } - /** - * Called when the {@code ItemStack} is equipped and right-clicked. Replaces the {@code ItemStack} with the return value. - */ - public InteractionResultHolder use(Level level, Player player, InteractionHand usedHand) { - return this.getItem().use(level, player, usedHand); + public InteractionResult use(Level level, Player player, InteractionHand interactionHand) { + ItemStack itemStack = this.copy(); + boolean bl = this.getUseDuration(player) <= 0; + InteractionResult interactionResult = this.getItem().use(level, player, interactionHand); + return (InteractionResult)(bl && interactionResult instanceof InteractionResult.Success success + ? success.heldItemTransformedTo( + success.heldItemTransformedTo() == null + ? this.applyAfterUseComponentSideEffects(player, itemStack) + : success.heldItemTransformedTo().applyAfterUseComponentSideEffects(player, itemStack) + ) + : interactionResult); } /** * Called when the item in use count reach 0, e.g. item food eaten. Return the new ItemStack. Args : world, entity */ public ItemStack finishUsingItem(Level level, LivingEntity livingEntity) { - return this.getItem().finishUsingItem(this, level, livingEntity); + ItemStack itemStack = this.copy(); + ItemStack itemStack2 = this.getItem().finishUsingItem(this, level, livingEntity); + return itemStack2.applyAfterUseComponentSideEffects(livingEntity, itemStack); + } + + private ItemStack applyAfterUseComponentSideEffects(LivingEntity livingEntity, ItemStack itemStack) { + UseRemainder useRemainder = itemStack.get(DataComponents.USE_REMAINDER); + UseCooldown useCooldown = itemStack.get(DataComponents.USE_COOLDOWN); + int i = itemStack.getCount(); + ItemStack itemStack2 = this; + if (useRemainder != null) { + itemStack2 = useRemainder.convertIntoRemainder(this, i, livingEntity.hasInfiniteMaterials(), livingEntity::handleExtraItemsCreatedOnUse); + } + + if (useCooldown != null) { + useCooldown.apply(itemStack, livingEntity); + } + + return itemStack2; } public Tag save(HolderLookup.Provider levelRegistryAccess, Tag outputTag) { @@ -446,28 +473,53 @@ public final class ItemStack implements DataComponentHolder { return this.getOrDefault(DataComponents.MAX_DAMAGE, 0); } + public boolean isBroken() { + return this.isDamageableItem() && this.getDamageValue() >= this.getMaxDamage(); + } + + public boolean nextDamageWillBreak() { + return this.isDamageableItem() && this.getDamageValue() >= this.getMaxDamage() - 1; + } + public void hurtAndBreak(int damage, ServerLevel level, @Nullable ServerPlayer player, Consumer onBreak) { - if (this.isDamageableItem()) { - if (player == null || !player.hasInfiniteMaterials()) { - if (damage > 0) { - damage = EnchantmentHelper.processDurabilityChange(level, this, damage); - if (damage <= 0) { - return; - } - } + int i = this.processDurabilityChange(damage, level, player); + if (i != 0) { + this.applyDamage(this.getDamageValue() + i, player, onBreak); + } + } - if (player != null && damage != 0) { - CriteriaTriggers.ITEM_DURABILITY_CHANGED.trigger(player, this, this.getDamageValue() + damage); - } + private int processDurabilityChange(int i, ServerLevel serverLevel, @Nullable ServerPlayer serverPlayer) { + if (!this.isDamageableItem()) { + return 0; + } else if (serverPlayer != null && serverPlayer.hasInfiniteMaterials()) { + return 0; + } else { + return i > 0 ? EnchantmentHelper.processDurabilityChange(serverLevel, this, i) : i; + } + } - int i = this.getDamageValue() + damage; - this.setDamageValue(i); - if (i >= this.getMaxDamage()) { - Item item = this.getItem(); - this.shrink(1); - onBreak.accept(item); - } + private void applyDamage(int i, @Nullable ServerPlayer serverPlayer, Consumer consumer) { + if (serverPlayer != null) { + CriteriaTriggers.ITEM_DURABILITY_CHANGED.trigger(serverPlayer, this, i); + } + + this.setDamageValue(i); + if (this.isBroken()) { + Item item = this.getItem(); + this.shrink(1); + consumer.accept(item); + } + } + + public void hurtWithoutBreaking(int i, Player player) { + if (player instanceof ServerPlayer serverPlayer) { + int j = this.processDurabilityChange(i, serverPlayer.serverLevel(), serverPlayer); + if (j == 0) { + return; } + + int k = Math.min(this.getDamageValue() + j, this.getMaxDamage() - 1); + this.applyDamage(k, serverPlayer, item -> {}); } } @@ -511,18 +563,21 @@ public final class ItemStack implements DataComponentHolder { return this.getItem().overrideOtherStackedOnMe(this, stack, slot, action, player, access); } - public boolean hurtEnemy(LivingEntity target, Player attacker) { + public boolean hurtEnemy(LivingEntity livingEntity, LivingEntity livingEntity2) { Item item = this.getItem(); - if (item.hurtEnemy(this, target, attacker)) { - attacker.awardStat(Stats.ITEM_USED.get(item)); + if (item.hurtEnemy(this, livingEntity, livingEntity2)) { + if (livingEntity2 instanceof Player player) { + player.awardStat(Stats.ITEM_USED.get(item)); + } + return true; } else { return false; } } - public void postHurtEnemy(LivingEntity target, Player attacker) { - this.getItem().postHurtEnemy(this, target, attacker); + public void postHurtEnemy(LivingEntity livingEntity, LivingEntity livingEntity2) { + this.getItem().postHurtEnemy(this, livingEntity, livingEntity2); } /** @@ -644,10 +699,6 @@ public final class ItemStack implements DataComponentHolder { return i; } - public String getDescriptionId() { - return this.getItem().getDescriptionId(this); - } - public String toString() { return this.getCount() + " " + this.getItem(); } @@ -678,7 +729,7 @@ public final class ItemStack implements DataComponentHolder { return this.getItem().getUseDuration(this, entity); } - public UseAnim getUseAnimation() { + public ItemUseAnimation getUseAnimation() { return this.getItem().getUseAnimation(this); } @@ -686,7 +737,13 @@ public final class ItemStack implements DataComponentHolder { * Called when the player releases the use item button. */ public void releaseUsing(Level level, LivingEntity livingEntity, int timeLeft) { - this.getItem().releaseUsing(this, level, livingEntity, timeLeft); + ItemStack itemStack = this.copy(); + if (this.getItem().releaseUsing(this, level, livingEntity, timeLeft)) { + ItemStack itemStack2 = this.applyAfterUseComponentSideEffects(livingEntity, itemStack); + if (itemStack2 != this) { + livingEntity.setItemInHand(livingEntity.getUsedItemHand(), itemStack2); + } + } } public boolean useOnRelease() { @@ -741,11 +798,31 @@ public final class ItemStack implements DataComponentHolder { if (component != null) { return component; } else { - Component component2 = this.get(DataComponents.ITEM_NAME); - return component2 != null ? component2 : this.getItem().getName(this); + WrittenBookContent writtenBookContent = this.get(DataComponents.WRITTEN_BOOK_CONTENT); + if (writtenBookContent != null) { + String string = writtenBookContent.title().raw(); + if (!StringUtil.isBlank(string)) { + return Component.literal(string); + } + } + + return this.getItemName(); } } + public Component getItemName() { + return this.getItem().getName(this); + } + + public Component getStyledHoverName() { + MutableComponent mutableComponent = Component.empty().append(this.getHoverName()).withStyle(this.getRarity().color()); + if (this.has(DataComponents.CUSTOM_NAME)) { + mutableComponent.withStyle(ChatFormatting.ITALIC); + } + + return mutableComponent; + } + private void addToTooltip( DataComponentType component, Item.TooltipContext context, Consumer tooltipAdder, TooltipFlag tooltipFlag ) { @@ -760,13 +837,8 @@ public final class ItemStack implements DataComponentHolder { return List.of(); } else { List list = Lists.newArrayList(); - MutableComponent mutableComponent = Component.empty().append(this.getHoverName()).withStyle(this.getRarity().color()); - if (this.has(DataComponents.CUSTOM_NAME)) { - mutableComponent.withStyle(ChatFormatting.ITALIC); - } - - list.add(mutableComponent); - if (!tooltipFlag.isAdvanced() && !this.has(DataComponents.CUSTOM_NAME) && this.is(Items.FILLED_MAP)) { + list.add(this.getStyledHoverName()); + if (!tooltipFlag.isAdvanced() && !this.has(DataComponents.CUSTOM_NAME)) { MapId mapId = this.get(DataComponents.MAP_ID); if (mapId != null) { list.add(MapItem.getTooltipForId(mapId)); @@ -786,6 +858,8 @@ public final class ItemStack implements DataComponentHolder { this.addToTooltip(DataComponents.LORE, tooltipContext, consumer, tooltipFlag); this.addAttributeTooltips(consumer, player); this.addToTooltip(DataComponents.UNBREAKABLE, tooltipContext, consumer, tooltipFlag); + this.addToTooltip(DataComponents.OMINOUS_BOTTLE_AMPLIFIER, tooltipContext, consumer, tooltipFlag); + this.addToTooltip(DataComponents.SUSPICIOUS_STEW_EFFECTS, tooltipContext, consumer, tooltipFlag); AdventureModePredicate adventureModePredicate = this.get(DataComponents.CAN_BREAK); if (adventureModePredicate != null && adventureModePredicate.showInTooltip()) { consumer.accept(CommonComponents.EMPTY); @@ -915,7 +989,7 @@ public final class ItemStack implements DataComponentHolder { * True if it is a tool and has no enchantments to begin with */ public boolean isEnchantable() { - if (!this.getItem().isEnchantable(this)) { + if (!this.has(DataComponents.ENCHANTABLE)) { return false; } else { ItemEnchantments itemEnchantments = this.get(DataComponents.ENCHANTMENTS); @@ -969,23 +1043,13 @@ public final class ItemStack implements DataComponentHolder { public void forEachModifier(EquipmentSlotGroup slotGroup, BiConsumer, AttributeModifier> action) { ItemAttributeModifiers itemAttributeModifiers = this.getOrDefault(DataComponents.ATTRIBUTE_MODIFIERS, ItemAttributeModifiers.EMPTY); - if (!itemAttributeModifiers.modifiers().isEmpty()) { - itemAttributeModifiers.forEach(slotGroup, action); - } else { - this.getItem().getDefaultAttributeModifiers().forEach(slotGroup, action); - } - + itemAttributeModifiers.forEach(slotGroup, action); EnchantmentHelper.forEachModifier(this, slotGroup, action); } public void forEachModifier(EquipmentSlot equipmentSLot, BiConsumer, AttributeModifier> action) { ItemAttributeModifiers itemAttributeModifiers = this.getOrDefault(DataComponents.ATTRIBUTE_MODIFIERS, ItemAttributeModifiers.EMPTY); - if (!itemAttributeModifiers.modifiers().isEmpty()) { - itemAttributeModifiers.forEach(equipmentSLot, action); - } else { - this.getItem().getDefaultAttributeModifiers().forEach(equipmentSLot, action); - } - + itemAttributeModifiers.forEach(equipmentSLot, action); EnchantmentHelper.forEachModifier(this, equipmentSLot, action); } @@ -1063,6 +1127,11 @@ public final class ItemStack implements DataComponentHolder { * Called as the stack is being used by an entity. */ public void onUseTick(Level level, LivingEntity livingEntity, int count) { + Consumable consumable = this.get(DataComponents.CONSUMABLE); + if (consumable != null && consumable.shouldEmitParticlesAndSounds(count)) { + consumable.emitParticlesAndSounds(livingEntity.getRandom(), livingEntity, this, 5); + } + this.getItem().onUseTick(level, livingEntity, this, count); } @@ -1070,19 +1139,17 @@ public final class ItemStack implements DataComponentHolder { this.getItem().onDestroyed(itemEntity); } - public SoundEvent getDrinkingSound() { - return this.getItem().getDrinkingSound(); - } - - public SoundEvent getEatingSound() { - return this.getItem().getEatingSound(); - } - public SoundEvent getBreakingSound() { return this.getItem().getBreakingSound(); } public boolean canBeHurtBy(DamageSource damageSource) { - return !this.has(DataComponents.FIRE_RESISTANT) || !damageSource.is(DamageTypeTags.IS_FIRE); + DamageResistant damageResistant = this.get(DataComponents.DAMAGE_RESISTANT); + return damageResistant == null || !damageResistant.isResistantTo(damageSource); + } + + public boolean isValidRepairItem(ItemStack itemStack) { + Repairable repairable = this.get(DataComponents.REPAIRABLE); + return repairable != null && repairable.isValidRepairItem(itemStack); } } diff --git a/net/minecraft/world/item/ItemUseAnimation.java b/net/minecraft/world/item/ItemUseAnimation.java new file mode 100644 index 00000000..bf9184de --- /dev/null +++ b/net/minecraft/world/item/ItemUseAnimation.java @@ -0,0 +1,43 @@ +package net.minecraft.world.item; + +import com.mojang.serialization.Codec; +import io.netty.buffer.ByteBuf; +import java.util.function.IntFunction; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.util.ByIdMap; +import net.minecraft.util.StringRepresentable; +import net.minecraft.util.ByIdMap.OutOfBoundsStrategy; + +public enum ItemUseAnimation implements StringRepresentable { + NONE(0, "none"), + EAT(1, "eat"), + DRINK(2, "drink"), + BLOCK(3, "block"), + BOW(4, "bow"), + SPEAR(5, "spear"), + CROSSBOW(6, "crossbow"), + SPYGLASS(7, "spyglass"), + TOOT_HORN(8, "toot_horn"), + BRUSH(9, "brush"); + + private static final IntFunction BY_ID = ByIdMap.continuous(ItemUseAnimation::getId, values(), OutOfBoundsStrategy.ZERO); + public static final Codec CODEC = StringRepresentable.fromEnum(ItemUseAnimation::values); + public static final StreamCodec STREAM_CODEC = ByteBufCodecs.idMapper(BY_ID, ItemUseAnimation::getId); + private final int id; + private final String name; + + private ItemUseAnimation(final int j, final String string2) { + this.id = j; + this.name = string2; + } + + public int getId() { + return this.id; + } + + @Override + public String getSerializedName() { + return this.name; + } +} diff --git a/net/minecraft/world/item/ItemUtils.java b/net/minecraft/world/item/ItemUtils.java index 5ce83d5e..d493f1b8 100644 --- a/net/minecraft/world/item/ItemUtils.java +++ b/net/minecraft/world/item/ItemUtils.java @@ -1,15 +1,15 @@ package net.minecraft.world.item; import net.minecraft.world.InteractionHand; -import net.minecraft.world.InteractionResultHolder; +import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.item.ItemEntity; import net.minecraft.world.entity.player.Player; import net.minecraft.world.level.Level; public class ItemUtils { - public static InteractionResultHolder startUsingInstantly(Level level, Player player, InteractionHand hand) { - player.startUsingItem(hand); - return InteractionResultHolder.consume(player.getItemInHand(hand)); + public static InteractionResult startUsingInstantly(Level level, Player player, InteractionHand interactionHand) { + player.startUsingItem(interactionHand); + return InteractionResult.CONSUME; } public static ItemStack createFilledResult(ItemStack emptyStack, Player player, ItemStack filledStack, boolean preventDuplicates) { diff --git a/net/minecraft/world/item/Items.java b/net/minecraft/world/item/Items.java index 14f675d2..158baa17 100644 --- a/net/minecraft/world/item/Items.java +++ b/net/minecraft/world/item/Items.java @@ -1,33 +1,46 @@ package net.minecraft.world.item; import java.util.List; +import java.util.function.BiFunction; +import java.util.function.Function; import java.util.function.UnaryOperator; import net.minecraft.core.Direction; import net.minecraft.core.Registry; import net.minecraft.core.component.DataComponents; import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.core.registries.Registries; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; import net.minecraft.sounds.SoundEvents; import net.minecraft.tags.BannerPatternTags; +import net.minecraft.tags.DamageTypeTags; import net.minecraft.tags.InstrumentTags; +import net.minecraft.tags.ItemTags; +import net.minecraft.util.Unit; import net.minecraft.world.entity.EntityType; -import net.minecraft.world.entity.vehicle.AbstractMinecart; -import net.minecraft.world.entity.vehicle.Boat; +import net.minecraft.world.entity.EquipmentSlot; +import net.minecraft.world.flag.FeatureFlags; import net.minecraft.world.food.Foods; import net.minecraft.world.item.alchemy.PotionContents; -import net.minecraft.world.item.armortrim.TrimPatterns; import net.minecraft.world.item.component.BundleContents; import net.minecraft.world.item.component.ChargedProjectiles; +import net.minecraft.world.item.component.Consumables; import net.minecraft.world.item.component.CustomData; +import net.minecraft.world.item.component.DamageResistant; +import net.minecraft.world.item.component.DeathProtection; import net.minecraft.world.item.component.DebugStickState; import net.minecraft.world.item.component.Fireworks; import net.minecraft.world.item.component.ItemContainerContents; import net.minecraft.world.item.component.MapDecorations; import net.minecraft.world.item.component.MapItemColor; +import net.minecraft.world.item.component.OminousBottleAmplifier; import net.minecraft.world.item.component.SuspiciousStewEffects; import net.minecraft.world.item.component.WritableBookContent; import net.minecraft.world.item.enchantment.ItemEnchantments; +import net.minecraft.world.item.equipment.ArmorMaterials; +import net.minecraft.world.item.equipment.ArmorType; +import net.minecraft.world.item.equipment.EquipmentModels; +import net.minecraft.world.item.equipment.Equippable; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.entity.BannerPatternLayers; @@ -35,7 +48,7 @@ import net.minecraft.world.level.block.entity.PotDecorations; import net.minecraft.world.level.material.Fluids; public class Items { - public static final Item AIR = registerBlock(Blocks.AIR, new AirItem(Blocks.AIR, new Item.Properties())); + public static final Item AIR = registerBlock(Blocks.AIR, AirItem::new); public static final Item STONE = registerBlock(Blocks.STONE); public static final Item GRANITE = registerBlock(Blocks.GRANITE); public static final Item POLISHED_GRANITE = registerBlock(Blocks.POLISHED_GRANITE); @@ -78,6 +91,7 @@ public class Items { public static final Item ACACIA_PLANKS = registerBlock(Blocks.ACACIA_PLANKS); public static final Item CHERRY_PLANKS = registerBlock(Blocks.CHERRY_PLANKS); public static final Item DARK_OAK_PLANKS = registerBlock(Blocks.DARK_OAK_PLANKS); + public static final Item PALE_OAK_PLANKS = registerBlock(Blocks.PALE_OAK_PLANKS); public static final Item MANGROVE_PLANKS = registerBlock(Blocks.MANGROVE_PLANKS); public static final Item BAMBOO_PLANKS = registerBlock(Blocks.BAMBOO_PLANKS); public static final Item CRIMSON_PLANKS = registerBlock(Blocks.CRIMSON_PLANKS); @@ -90,11 +104,12 @@ public class Items { public static final Item ACACIA_SAPLING = registerBlock(Blocks.ACACIA_SAPLING); public static final Item CHERRY_SAPLING = registerBlock(Blocks.CHERRY_SAPLING); public static final Item DARK_OAK_SAPLING = registerBlock(Blocks.DARK_OAK_SAPLING); + public static final Item PALE_OAK_SAPLING = registerBlock(Blocks.PALE_OAK_SAPLING); public static final Item MANGROVE_PROPAGULE = registerBlock(Blocks.MANGROVE_PROPAGULE); public static final Item BEDROCK = registerBlock(Blocks.BEDROCK); public static final Item SAND = registerBlock(Blocks.SAND); - public static final Item SUSPICIOUS_SAND = registerBlock(new BlockItem(Blocks.SUSPICIOUS_SAND, new Item.Properties())); - public static final Item SUSPICIOUS_GRAVEL = registerBlock(new BlockItem(Blocks.SUSPICIOUS_GRAVEL, new Item.Properties())); + public static final Item SUSPICIOUS_SAND = registerBlock(Blocks.SUSPICIOUS_SAND); + public static final Item SUSPICIOUS_GRAVEL = registerBlock(Blocks.SUSPICIOUS_GRAVEL); public static final Item RED_SAND = registerBlock(Blocks.RED_SAND); public static final Item GRAVEL = registerBlock(Blocks.GRAVEL); public static final Item COAL_ORE = registerBlock(Blocks.COAL_ORE); @@ -115,19 +130,19 @@ public class Items { public static final Item DEEPSLATE_DIAMOND_ORE = registerBlock(Blocks.DEEPSLATE_DIAMOND_ORE); public static final Item NETHER_GOLD_ORE = registerBlock(Blocks.NETHER_GOLD_ORE); public static final Item NETHER_QUARTZ_ORE = registerBlock(Blocks.NETHER_QUARTZ_ORE); - public static final Item ANCIENT_DEBRIS = registerBlock(new BlockItem(Blocks.ANCIENT_DEBRIS, new Item.Properties().fireResistant())); + public static final Item ANCIENT_DEBRIS = registerBlock(Blocks.ANCIENT_DEBRIS, new Item.Properties().fireResistant()); public static final Item COAL_BLOCK = registerBlock(Blocks.COAL_BLOCK); public static final Item RAW_IRON_BLOCK = registerBlock(Blocks.RAW_IRON_BLOCK); public static final Item RAW_COPPER_BLOCK = registerBlock(Blocks.RAW_COPPER_BLOCK); public static final Item RAW_GOLD_BLOCK = registerBlock(Blocks.RAW_GOLD_BLOCK); - public static final Item HEAVY_CORE = registerBlock(new BlockItem(Blocks.HEAVY_CORE, new Item.Properties().rarity(Rarity.EPIC))); + public static final Item HEAVY_CORE = registerBlock(Blocks.HEAVY_CORE, new Item.Properties().rarity(Rarity.EPIC)); public static final Item AMETHYST_BLOCK = registerBlock(Blocks.AMETHYST_BLOCK); public static final Item BUDDING_AMETHYST = registerBlock(Blocks.BUDDING_AMETHYST); public static final Item IRON_BLOCK = registerBlock(Blocks.IRON_BLOCK); public static final Item COPPER_BLOCK = registerBlock(Blocks.COPPER_BLOCK); public static final Item GOLD_BLOCK = registerBlock(Blocks.GOLD_BLOCK); public static final Item DIAMOND_BLOCK = registerBlock(Blocks.DIAMOND_BLOCK); - public static final Item NETHERITE_BLOCK = registerBlock(new BlockItem(Blocks.NETHERITE_BLOCK, new Item.Properties().fireResistant())); + public static final Item NETHERITE_BLOCK = registerBlock(Blocks.NETHERITE_BLOCK, new Item.Properties().fireResistant()); public static final Item EXPOSED_COPPER = registerBlock(Blocks.EXPOSED_COPPER); public static final Item WEATHERED_COPPER = registerBlock(Blocks.WEATHERED_COPPER); public static final Item OXIDIZED_COPPER = registerBlock(Blocks.OXIDIZED_COPPER); @@ -173,6 +188,7 @@ public class Items { public static final Item JUNGLE_LOG = registerBlock(Blocks.JUNGLE_LOG); public static final Item ACACIA_LOG = registerBlock(Blocks.ACACIA_LOG); public static final Item CHERRY_LOG = registerBlock(Blocks.CHERRY_LOG); + public static final Item PALE_OAK_LOG = registerBlock(Blocks.PALE_OAK_LOG); public static final Item DARK_OAK_LOG = registerBlock(Blocks.DARK_OAK_LOG); public static final Item MANGROVE_LOG = registerBlock(Blocks.MANGROVE_LOG); public static final Item MANGROVE_ROOTS = registerBlock(Blocks.MANGROVE_ROOTS); @@ -187,6 +203,7 @@ public class Items { public static final Item STRIPPED_ACACIA_LOG = registerBlock(Blocks.STRIPPED_ACACIA_LOG); public static final Item STRIPPED_CHERRY_LOG = registerBlock(Blocks.STRIPPED_CHERRY_LOG); public static final Item STRIPPED_DARK_OAK_LOG = registerBlock(Blocks.STRIPPED_DARK_OAK_LOG); + public static final Item STRIPPED_PALE_OAK_LOG = registerBlock(Blocks.STRIPPED_PALE_OAK_LOG); public static final Item STRIPPED_MANGROVE_LOG = registerBlock(Blocks.STRIPPED_MANGROVE_LOG); public static final Item STRIPPED_CRIMSON_STEM = registerBlock(Blocks.STRIPPED_CRIMSON_STEM); public static final Item STRIPPED_WARPED_STEM = registerBlock(Blocks.STRIPPED_WARPED_STEM); @@ -197,6 +214,7 @@ public class Items { public static final Item STRIPPED_ACACIA_WOOD = registerBlock(Blocks.STRIPPED_ACACIA_WOOD); public static final Item STRIPPED_CHERRY_WOOD = registerBlock(Blocks.STRIPPED_CHERRY_WOOD); public static final Item STRIPPED_DARK_OAK_WOOD = registerBlock(Blocks.STRIPPED_DARK_OAK_WOOD); + public static final Item STRIPPED_PALE_OAK_WOOD = registerBlock(Blocks.STRIPPED_PALE_OAK_WOOD); public static final Item STRIPPED_MANGROVE_WOOD = registerBlock(Blocks.STRIPPED_MANGROVE_WOOD); public static final Item STRIPPED_CRIMSON_HYPHAE = registerBlock(Blocks.STRIPPED_CRIMSON_HYPHAE); public static final Item STRIPPED_WARPED_HYPHAE = registerBlock(Blocks.STRIPPED_WARPED_HYPHAE); @@ -207,6 +225,7 @@ public class Items { public static final Item JUNGLE_WOOD = registerBlock(Blocks.JUNGLE_WOOD); public static final Item ACACIA_WOOD = registerBlock(Blocks.ACACIA_WOOD); public static final Item CHERRY_WOOD = registerBlock(Blocks.CHERRY_WOOD); + public static final Item PALE_OAK_WOOD = registerBlock(Blocks.PALE_OAK_WOOD); public static final Item DARK_OAK_WOOD = registerBlock(Blocks.DARK_OAK_WOOD); public static final Item MANGROVE_WOOD = registerBlock(Blocks.MANGROVE_WOOD); public static final Item CRIMSON_HYPHAE = registerBlock(Blocks.CRIMSON_HYPHAE); @@ -218,6 +237,7 @@ public class Items { public static final Item ACACIA_LEAVES = registerBlock(Blocks.ACACIA_LEAVES); public static final Item CHERRY_LEAVES = registerBlock(Blocks.CHERRY_LEAVES); public static final Item DARK_OAK_LEAVES = registerBlock(Blocks.DARK_OAK_LEAVES); + public static final Item PALE_OAK_LEAVES = registerBlock(Blocks.PALE_OAK_LEAVES); public static final Item MANGROVE_LEAVES = registerBlock(Blocks.MANGROVE_LEAVES); public static final Item AZALEA_LEAVES = registerBlock(Blocks.AZALEA_LEAVES); public static final Item FLOWERING_AZALEA_LEAVES = registerBlock(Blocks.FLOWERING_AZALEA_LEAVES); @@ -280,12 +300,15 @@ public class Items { public static final Item TWISTING_VINES = registerBlock(Blocks.TWISTING_VINES); public static final Item SUGAR_CANE = registerBlock(Blocks.SUGAR_CANE); public static final Item KELP = registerBlock(Blocks.KELP); - public static final Item MOSS_CARPET = registerBlock(Blocks.MOSS_CARPET); public static final Item PINK_PETALS = registerBlock(Blocks.PINK_PETALS); + public static final Item MOSS_CARPET = registerBlock(Blocks.MOSS_CARPET); public static final Item MOSS_BLOCK = registerBlock(Blocks.MOSS_BLOCK); + public static final Item PALE_MOSS_CARPET = registerBlock(Blocks.PALE_MOSS_CARPET); + public static final Item PALE_HANGING_MOSS = registerBlock(Blocks.PALE_HANGING_MOSS); + public static final Item PALE_MOSS_BLOCK = registerBlock(Blocks.PALE_MOSS_BLOCK); public static final Item HANGING_ROOTS = registerBlock(Blocks.HANGING_ROOTS); public static final Item BIG_DRIPLEAF = registerBlock(Blocks.BIG_DRIPLEAF, Blocks.BIG_DRIPLEAF_STEM); - public static final Item SMALL_DRIPLEAF = registerBlock(new DoubleHighBlockItem(Blocks.SMALL_DRIPLEAF, new Item.Properties())); + public static final Item SMALL_DRIPLEAF = registerBlock(Blocks.SMALL_DRIPLEAF, DoubleHighBlockItem::new); public static final Item BAMBOO = registerBlock(Blocks.BAMBOO); public static final Item OAK_SLAB = registerBlock(Blocks.OAK_SLAB); public static final Item SPRUCE_SLAB = registerBlock(Blocks.SPRUCE_SLAB); @@ -294,6 +317,7 @@ public class Items { public static final Item ACACIA_SLAB = registerBlock(Blocks.ACACIA_SLAB); public static final Item CHERRY_SLAB = registerBlock(Blocks.CHERRY_SLAB); public static final Item DARK_OAK_SLAB = registerBlock(Blocks.DARK_OAK_SLAB); + public static final Item PALE_OAK_SLAB = registerBlock(Blocks.PALE_OAK_SLAB); public static final Item MANGROVE_SLAB = registerBlock(Blocks.MANGROVE_SLAB); public static final Item BAMBOO_SLAB = registerBlock(Blocks.BAMBOO_SLAB); public static final Item BAMBOO_MOSAIC_SLAB = registerBlock(Blocks.BAMBOO_MOSAIC_SLAB); @@ -323,14 +347,17 @@ public class Items { public static final Item BRICKS = registerBlock(Blocks.BRICKS); public static final Item BOOKSHELF = registerBlock(Blocks.BOOKSHELF); public static final Item CHISELED_BOOKSHELF = registerBlock( - Blocks.CHISELED_BOOKSHELF, properties -> properties.component(DataComponents.CONTAINER, ItemContainerContents.EMPTY) + Blocks.CHISELED_BOOKSHELF, (UnaryOperator)(properties -> properties.component(DataComponents.CONTAINER, ItemContainerContents.EMPTY)) ); public static final Item DECORATED_POT = registerBlock( - new BlockItem(Blocks.DECORATED_POT, new Item.Properties().component(DataComponents.POT_DECORATIONS, PotDecorations.EMPTY)) + Blocks.DECORATED_POT, new Item.Properties().component(DataComponents.POT_DECORATIONS, PotDecorations.EMPTY) ); public static final Item MOSSY_COBBLESTONE = registerBlock(Blocks.MOSSY_COBBLESTONE); public static final Item OBSIDIAN = registerBlock(Blocks.OBSIDIAN); - public static final Item TORCH = registerBlock(new StandingAndWallBlockItem(Blocks.TORCH, Blocks.WALL_TORCH, new Item.Properties(), Direction.DOWN)); + public static final Item TORCH = registerBlock( + Blocks.TORCH, + (BiFunction)((block, properties) -> new StandingAndWallBlockItem(block, Blocks.WALL_TORCH, Direction.DOWN, properties)) + ); public static final Item END_ROD = registerBlock(Blocks.END_ROD); public static final Item CHORUS_PLANT = registerBlock(Blocks.CHORUS_PLANT); public static final Item CHORUS_FLOWER = registerBlock(Blocks.CHORUS_FLOWER); @@ -338,10 +365,15 @@ public class Items { public static final Item PURPUR_PILLAR = registerBlock(Blocks.PURPUR_PILLAR); public static final Item PURPUR_STAIRS = registerBlock(Blocks.PURPUR_STAIRS); public static final Item SPAWNER = registerBlock(Blocks.SPAWNER); - public static final Item CHEST = registerBlock(Blocks.CHEST, properties -> properties.component(DataComponents.CONTAINER, ItemContainerContents.EMPTY)); + public static final Item CREAKING_HEART = registerBlock(Blocks.CREAKING_HEART); + public static final Item CHEST = registerBlock( + Blocks.CHEST, (UnaryOperator)(properties -> properties.component(DataComponents.CONTAINER, ItemContainerContents.EMPTY)) + ); public static final Item CRAFTING_TABLE = registerBlock(Blocks.CRAFTING_TABLE); public static final Item FARMLAND = registerBlock(Blocks.FARMLAND); - public static final Item FURNACE = registerBlock(Blocks.FURNACE, properties -> properties.component(DataComponents.CONTAINER, ItemContainerContents.EMPTY)); + public static final Item FURNACE = registerBlock( + Blocks.FURNACE, (UnaryOperator)(properties -> properties.component(DataComponents.CONTAINER, ItemContainerContents.EMPTY)) + ); public static final Item LADDER = registerBlock(Blocks.LADDER); public static final Item COBBLESTONE_STAIRS = registerBlock(Blocks.COBBLESTONE_STAIRS); public static final Item SNOW = registerBlock(Blocks.SNOW); @@ -357,12 +389,19 @@ public class Items { public static final Item ACACIA_FENCE = registerBlock(Blocks.ACACIA_FENCE); public static final Item CHERRY_FENCE = registerBlock(Blocks.CHERRY_FENCE); public static final Item DARK_OAK_FENCE = registerBlock(Blocks.DARK_OAK_FENCE); + public static final Item PALE_OAK_FENCE = registerBlock(Blocks.PALE_OAK_FENCE); public static final Item MANGROVE_FENCE = registerBlock(Blocks.MANGROVE_FENCE); public static final Item BAMBOO_FENCE = registerBlock(Blocks.BAMBOO_FENCE); public static final Item CRIMSON_FENCE = registerBlock(Blocks.CRIMSON_FENCE); public static final Item WARPED_FENCE = registerBlock(Blocks.WARPED_FENCE); public static final Item PUMPKIN = registerBlock(Blocks.PUMPKIN); - public static final Item CARVED_PUMPKIN = registerBlock(Blocks.CARVED_PUMPKIN); + public static final Item CARVED_PUMPKIN = registerBlock( + Blocks.CARVED_PUMPKIN, + (UnaryOperator)(properties -> properties.component( + DataComponents.EQUIPPABLE, + Equippable.builder(EquipmentSlot.HEAD).setSwappable(false).setCameraOverlay(ResourceLocation.withDefaultNamespace("misc/pumpkinblur")).build() + )) + ); public static final Item JACK_O_LANTERN = registerBlock(Blocks.JACK_O_LANTERN); public static final Item NETHERRACK = registerBlock(Blocks.NETHERRACK); public static final Item SOUL_SAND = registerBlock(Blocks.SOUL_SAND); @@ -371,7 +410,8 @@ public class Items { public static final Item POLISHED_BASALT = registerBlock(Blocks.POLISHED_BASALT); public static final Item SMOOTH_BASALT = registerBlock(Blocks.SMOOTH_BASALT); public static final Item SOUL_TORCH = registerBlock( - new StandingAndWallBlockItem(Blocks.SOUL_TORCH, Blocks.SOUL_WALL_TORCH, new Item.Properties(), Direction.DOWN) + Blocks.SOUL_TORCH, + (BiFunction)((block, properties) -> new StandingAndWallBlockItem(block, Blocks.SOUL_WALL_TORCH, Direction.DOWN, properties)) ); public static final Item GLOWSTONE = registerBlock(Blocks.GLOWSTONE); public static final Item INFESTED_STONE = registerBlock(Blocks.INFESTED_STONE); @@ -406,7 +446,7 @@ public class Items { public static final Item STONE_BRICK_STAIRS = registerBlock(Blocks.STONE_BRICK_STAIRS); public static final Item MUD_BRICK_STAIRS = registerBlock(Blocks.MUD_BRICK_STAIRS); public static final Item MYCELIUM = registerBlock(Blocks.MYCELIUM); - public static final Item LILY_PAD = registerBlock(new PlaceOnWaterBlockItem(Blocks.LILY_PAD, new Item.Properties())); + public static final Item LILY_PAD = registerBlock(Blocks.LILY_PAD, PlaceOnWaterBlockItem::new); public static final Item NETHER_BRICKS = registerBlock(Blocks.NETHER_BRICKS); public static final Item CRACKED_NETHER_BRICKS = registerBlock(Blocks.CRACKED_NETHER_BRICKS); public static final Item CHISELED_NETHER_BRICKS = registerBlock(Blocks.CHISELED_NETHER_BRICKS); @@ -420,11 +460,9 @@ public class Items { public static final Item END_PORTAL_FRAME = registerBlock(Blocks.END_PORTAL_FRAME); public static final Item END_STONE = registerBlock(Blocks.END_STONE); public static final Item END_STONE_BRICKS = registerBlock(Blocks.END_STONE_BRICKS); - public static final Item DRAGON_EGG = registerBlock(new BlockItem(Blocks.DRAGON_EGG, new Item.Properties().rarity(Rarity.EPIC))); + public static final Item DRAGON_EGG = registerBlock(Blocks.DRAGON_EGG, new Item.Properties().rarity(Rarity.EPIC)); public static final Item SANDSTONE_STAIRS = registerBlock(Blocks.SANDSTONE_STAIRS); - public static final Item ENDER_CHEST = registerBlock( - Blocks.ENDER_CHEST, properties -> properties.component(DataComponents.CONTAINER, ItemContainerContents.EMPTY) - ); + public static final Item ENDER_CHEST = registerBlock(Blocks.ENDER_CHEST); public static final Item EMERALD_BLOCK = registerBlock(Blocks.EMERALD_BLOCK); public static final Item OAK_STAIRS = registerBlock(Blocks.OAK_STAIRS); public static final Item SPRUCE_STAIRS = registerBlock(Blocks.SPRUCE_STAIRS); @@ -433,13 +471,14 @@ public class Items { public static final Item ACACIA_STAIRS = registerBlock(Blocks.ACACIA_STAIRS); public static final Item CHERRY_STAIRS = registerBlock(Blocks.CHERRY_STAIRS); public static final Item DARK_OAK_STAIRS = registerBlock(Blocks.DARK_OAK_STAIRS); + public static final Item PALE_OAK_STAIRS = registerBlock(Blocks.PALE_OAK_STAIRS); public static final Item MANGROVE_STAIRS = registerBlock(Blocks.MANGROVE_STAIRS); public static final Item BAMBOO_STAIRS = registerBlock(Blocks.BAMBOO_STAIRS); public static final Item BAMBOO_MOSAIC_STAIRS = registerBlock(Blocks.BAMBOO_MOSAIC_STAIRS); public static final Item CRIMSON_STAIRS = registerBlock(Blocks.CRIMSON_STAIRS); public static final Item WARPED_STAIRS = registerBlock(Blocks.WARPED_STAIRS); - public static final Item COMMAND_BLOCK = registerBlock(new GameMasterBlockItem(Blocks.COMMAND_BLOCK, new Item.Properties().rarity(Rarity.EPIC))); - public static final Item BEACON = registerBlock(new BlockItem(Blocks.BEACON, new Item.Properties().rarity(Rarity.RARE))); + public static final Item COMMAND_BLOCK = registerBlock(Blocks.COMMAND_BLOCK, GameMasterBlockItem::new, new Item.Properties().rarity(Rarity.EPIC)); + public static final Item BEACON = registerBlock(Blocks.BEACON, new Item.Properties().rarity(Rarity.RARE)); public static final Item COBBLESTONE_WALL = registerBlock(Blocks.COBBLESTONE_WALL); public static final Item MOSSY_COBBLESTONE_WALL = registerBlock(Blocks.MOSSY_COBBLESTONE_WALL); public static final Item BRICK_WALL = registerBlock(Blocks.BRICK_WALL); @@ -486,34 +525,69 @@ public class Items { public static final Item GREEN_TERRACOTTA = registerBlock(Blocks.GREEN_TERRACOTTA); public static final Item RED_TERRACOTTA = registerBlock(Blocks.RED_TERRACOTTA); public static final Item BLACK_TERRACOTTA = registerBlock(Blocks.BLACK_TERRACOTTA); - public static final Item BARRIER = registerBlock(new BlockItem(Blocks.BARRIER, new Item.Properties().rarity(Rarity.EPIC))); - public static final Item LIGHT = registerBlock(new BlockItem(Blocks.LIGHT, new Item.Properties().rarity(Rarity.EPIC))); + public static final Item BARRIER = registerBlock(Blocks.BARRIER, new Item.Properties().rarity(Rarity.EPIC)); + public static final Item LIGHT = registerBlock(Blocks.LIGHT, new Item.Properties().rarity(Rarity.EPIC)); public static final Item HAY_BLOCK = registerBlock(Blocks.HAY_BLOCK); - public static final Item WHITE_CARPET = registerBlock(Blocks.WHITE_CARPET); - public static final Item ORANGE_CARPET = registerBlock(Blocks.ORANGE_CARPET); - public static final Item MAGENTA_CARPET = registerBlock(Blocks.MAGENTA_CARPET); - public static final Item LIGHT_BLUE_CARPET = registerBlock(Blocks.LIGHT_BLUE_CARPET); - public static final Item YELLOW_CARPET = registerBlock(Blocks.YELLOW_CARPET); - public static final Item LIME_CARPET = registerBlock(Blocks.LIME_CARPET); - public static final Item PINK_CARPET = registerBlock(Blocks.PINK_CARPET); - public static final Item GRAY_CARPET = registerBlock(Blocks.GRAY_CARPET); - public static final Item LIGHT_GRAY_CARPET = registerBlock(Blocks.LIGHT_GRAY_CARPET); - public static final Item CYAN_CARPET = registerBlock(Blocks.CYAN_CARPET); - public static final Item PURPLE_CARPET = registerBlock(Blocks.PURPLE_CARPET); - public static final Item BLUE_CARPET = registerBlock(Blocks.BLUE_CARPET); - public static final Item BROWN_CARPET = registerBlock(Blocks.BROWN_CARPET); - public static final Item GREEN_CARPET = registerBlock(Blocks.GREEN_CARPET); - public static final Item RED_CARPET = registerBlock(Blocks.RED_CARPET); - public static final Item BLACK_CARPET = registerBlock(Blocks.BLACK_CARPET); + public static final Item WHITE_CARPET = registerBlock( + Blocks.WHITE_CARPET, (UnaryOperator)(properties -> properties.component(DataComponents.EQUIPPABLE, Equippable.llamaSwag(DyeColor.WHITE))) + ); + public static final Item ORANGE_CARPET = registerBlock( + Blocks.ORANGE_CARPET, (UnaryOperator)(properties -> properties.component(DataComponents.EQUIPPABLE, Equippable.llamaSwag(DyeColor.ORANGE))) + ); + public static final Item MAGENTA_CARPET = registerBlock( + Blocks.MAGENTA_CARPET, + (UnaryOperator)(properties -> properties.component(DataComponents.EQUIPPABLE, Equippable.llamaSwag(DyeColor.MAGENTA))) + ); + public static final Item LIGHT_BLUE_CARPET = registerBlock( + Blocks.LIGHT_BLUE_CARPET, + (UnaryOperator)(properties -> properties.component(DataComponents.EQUIPPABLE, Equippable.llamaSwag(DyeColor.LIGHT_BLUE))) + ); + public static final Item YELLOW_CARPET = registerBlock( + Blocks.YELLOW_CARPET, (UnaryOperator)(properties -> properties.component(DataComponents.EQUIPPABLE, Equippable.llamaSwag(DyeColor.YELLOW))) + ); + public static final Item LIME_CARPET = registerBlock( + Blocks.LIME_CARPET, (UnaryOperator)(properties -> properties.component(DataComponents.EQUIPPABLE, Equippable.llamaSwag(DyeColor.LIME))) + ); + public static final Item PINK_CARPET = registerBlock( + Blocks.PINK_CARPET, (UnaryOperator)(properties -> properties.component(DataComponents.EQUIPPABLE, Equippable.llamaSwag(DyeColor.PINK))) + ); + public static final Item GRAY_CARPET = registerBlock( + Blocks.GRAY_CARPET, (UnaryOperator)(properties -> properties.component(DataComponents.EQUIPPABLE, Equippable.llamaSwag(DyeColor.GRAY))) + ); + public static final Item LIGHT_GRAY_CARPET = registerBlock( + Blocks.LIGHT_GRAY_CARPET, + (UnaryOperator)(properties -> properties.component(DataComponents.EQUIPPABLE, Equippable.llamaSwag(DyeColor.LIGHT_GRAY))) + ); + public static final Item CYAN_CARPET = registerBlock( + Blocks.CYAN_CARPET, (UnaryOperator)(properties -> properties.component(DataComponents.EQUIPPABLE, Equippable.llamaSwag(DyeColor.CYAN))) + ); + public static final Item PURPLE_CARPET = registerBlock( + Blocks.PURPLE_CARPET, (UnaryOperator)(properties -> properties.component(DataComponents.EQUIPPABLE, Equippable.llamaSwag(DyeColor.PURPLE))) + ); + public static final Item BLUE_CARPET = registerBlock( + Blocks.BLUE_CARPET, (UnaryOperator)(properties -> properties.component(DataComponents.EQUIPPABLE, Equippable.llamaSwag(DyeColor.BLUE))) + ); + public static final Item BROWN_CARPET = registerBlock( + Blocks.BROWN_CARPET, (UnaryOperator)(properties -> properties.component(DataComponents.EQUIPPABLE, Equippable.llamaSwag(DyeColor.BROWN))) + ); + public static final Item GREEN_CARPET = registerBlock( + Blocks.GREEN_CARPET, (UnaryOperator)(properties -> properties.component(DataComponents.EQUIPPABLE, Equippable.llamaSwag(DyeColor.GREEN))) + ); + public static final Item RED_CARPET = registerBlock( + Blocks.RED_CARPET, (UnaryOperator)(properties -> properties.component(DataComponents.EQUIPPABLE, Equippable.llamaSwag(DyeColor.RED))) + ); + public static final Item BLACK_CARPET = registerBlock( + Blocks.BLACK_CARPET, (UnaryOperator)(properties -> properties.component(DataComponents.EQUIPPABLE, Equippable.llamaSwag(DyeColor.BLACK))) + ); public static final Item TERRACOTTA = registerBlock(Blocks.TERRACOTTA); public static final Item PACKED_ICE = registerBlock(Blocks.PACKED_ICE); public static final Item DIRT_PATH = registerBlock(Blocks.DIRT_PATH); - public static final Item SUNFLOWER = registerBlock(new DoubleHighBlockItem(Blocks.SUNFLOWER, new Item.Properties())); - public static final Item LILAC = registerBlock(new DoubleHighBlockItem(Blocks.LILAC, new Item.Properties())); - public static final Item ROSE_BUSH = registerBlock(new DoubleHighBlockItem(Blocks.ROSE_BUSH, new Item.Properties())); - public static final Item PEONY = registerBlock(new DoubleHighBlockItem(Blocks.PEONY, new Item.Properties())); - public static final Item TALL_GRASS = registerBlock(new DoubleHighBlockItem(Blocks.TALL_GRASS, new Item.Properties())); - public static final Item LARGE_FERN = registerBlock(new DoubleHighBlockItem(Blocks.LARGE_FERN, new Item.Properties())); + public static final Item SUNFLOWER = registerBlock(Blocks.SUNFLOWER, DoubleHighBlockItem::new); + public static final Item LILAC = registerBlock(Blocks.LILAC, DoubleHighBlockItem::new); + public static final Item ROSE_BUSH = registerBlock(Blocks.ROSE_BUSH, DoubleHighBlockItem::new); + public static final Item PEONY = registerBlock(Blocks.PEONY, DoubleHighBlockItem::new); + public static final Item TALL_GRASS = registerBlock(Blocks.TALL_GRASS, DoubleHighBlockItem::new); + public static final Item LARGE_FERN = registerBlock(Blocks.LARGE_FERN, DoubleHighBlockItem::new); public static final Item WHITE_STAINED_GLASS = registerBlock(Blocks.WHITE_STAINED_GLASS); public static final Item ORANGE_STAINED_GLASS = registerBlock(Blocks.ORANGE_STAINED_GLASS); public static final Item MAGENTA_STAINED_GLASS = registerBlock(Blocks.MAGENTA_STAINED_GLASS); @@ -558,65 +632,65 @@ public class Items { public static final Item CUT_RED_SANDSTONE = registerBlock(Blocks.CUT_RED_SANDSTONE); public static final Item RED_SANDSTONE_STAIRS = registerBlock(Blocks.RED_SANDSTONE_STAIRS); public static final Item REPEATING_COMMAND_BLOCK = registerBlock( - new GameMasterBlockItem(Blocks.REPEATING_COMMAND_BLOCK, new Item.Properties().rarity(Rarity.EPIC)) + Blocks.REPEATING_COMMAND_BLOCK, GameMasterBlockItem::new, new Item.Properties().rarity(Rarity.EPIC) ); - public static final Item CHAIN_COMMAND_BLOCK = registerBlock(new GameMasterBlockItem(Blocks.CHAIN_COMMAND_BLOCK, new Item.Properties().rarity(Rarity.EPIC))); + public static final Item CHAIN_COMMAND_BLOCK = registerBlock(Blocks.CHAIN_COMMAND_BLOCK, GameMasterBlockItem::new, new Item.Properties().rarity(Rarity.EPIC)); public static final Item MAGMA_BLOCK = registerBlock(Blocks.MAGMA_BLOCK); public static final Item NETHER_WART_BLOCK = registerBlock(Blocks.NETHER_WART_BLOCK); public static final Item WARPED_WART_BLOCK = registerBlock(Blocks.WARPED_WART_BLOCK); public static final Item RED_NETHER_BRICKS = registerBlock(Blocks.RED_NETHER_BRICKS); public static final Item BONE_BLOCK = registerBlock(Blocks.BONE_BLOCK); - public static final Item STRUCTURE_VOID = registerBlock(new BlockItem(Blocks.STRUCTURE_VOID, new Item.Properties().rarity(Rarity.EPIC))); + public static final Item STRUCTURE_VOID = registerBlock(Blocks.STRUCTURE_VOID, new Item.Properties().rarity(Rarity.EPIC)); public static final Item SHULKER_BOX = registerBlock( - new BlockItem(Blocks.SHULKER_BOX, new Item.Properties().stacksTo(1).component(DataComponents.CONTAINER, ItemContainerContents.EMPTY)) + Blocks.SHULKER_BOX, new Item.Properties().stacksTo(1).component(DataComponents.CONTAINER, ItemContainerContents.EMPTY) ); public static final Item WHITE_SHULKER_BOX = registerBlock( - new BlockItem(Blocks.WHITE_SHULKER_BOX, new Item.Properties().stacksTo(1).component(DataComponents.CONTAINER, ItemContainerContents.EMPTY)) + Blocks.WHITE_SHULKER_BOX, new Item.Properties().stacksTo(1).component(DataComponents.CONTAINER, ItemContainerContents.EMPTY) ); public static final Item ORANGE_SHULKER_BOX = registerBlock( - new BlockItem(Blocks.ORANGE_SHULKER_BOX, new Item.Properties().stacksTo(1).component(DataComponents.CONTAINER, ItemContainerContents.EMPTY)) + Blocks.ORANGE_SHULKER_BOX, new Item.Properties().stacksTo(1).component(DataComponents.CONTAINER, ItemContainerContents.EMPTY) ); public static final Item MAGENTA_SHULKER_BOX = registerBlock( - new BlockItem(Blocks.MAGENTA_SHULKER_BOX, new Item.Properties().stacksTo(1).component(DataComponents.CONTAINER, ItemContainerContents.EMPTY)) + Blocks.MAGENTA_SHULKER_BOX, new Item.Properties().stacksTo(1).component(DataComponents.CONTAINER, ItemContainerContents.EMPTY) ); public static final Item LIGHT_BLUE_SHULKER_BOX = registerBlock( - new BlockItem(Blocks.LIGHT_BLUE_SHULKER_BOX, new Item.Properties().stacksTo(1).component(DataComponents.CONTAINER, ItemContainerContents.EMPTY)) + Blocks.LIGHT_BLUE_SHULKER_BOX, new Item.Properties().stacksTo(1).component(DataComponents.CONTAINER, ItemContainerContents.EMPTY) ); public static final Item YELLOW_SHULKER_BOX = registerBlock( - new BlockItem(Blocks.YELLOW_SHULKER_BOX, new Item.Properties().stacksTo(1).component(DataComponents.CONTAINER, ItemContainerContents.EMPTY)) + Blocks.YELLOW_SHULKER_BOX, new Item.Properties().stacksTo(1).component(DataComponents.CONTAINER, ItemContainerContents.EMPTY) ); public static final Item LIME_SHULKER_BOX = registerBlock( - new BlockItem(Blocks.LIME_SHULKER_BOX, new Item.Properties().stacksTo(1).component(DataComponents.CONTAINER, ItemContainerContents.EMPTY)) + Blocks.LIME_SHULKER_BOX, new Item.Properties().stacksTo(1).component(DataComponents.CONTAINER, ItemContainerContents.EMPTY) ); public static final Item PINK_SHULKER_BOX = registerBlock( - new BlockItem(Blocks.PINK_SHULKER_BOX, new Item.Properties().stacksTo(1).component(DataComponents.CONTAINER, ItemContainerContents.EMPTY)) + Blocks.PINK_SHULKER_BOX, new Item.Properties().stacksTo(1).component(DataComponents.CONTAINER, ItemContainerContents.EMPTY) ); public static final Item GRAY_SHULKER_BOX = registerBlock( - new BlockItem(Blocks.GRAY_SHULKER_BOX, new Item.Properties().stacksTo(1).component(DataComponents.CONTAINER, ItemContainerContents.EMPTY)) + Blocks.GRAY_SHULKER_BOX, new Item.Properties().stacksTo(1).component(DataComponents.CONTAINER, ItemContainerContents.EMPTY) ); public static final Item LIGHT_GRAY_SHULKER_BOX = registerBlock( - new BlockItem(Blocks.LIGHT_GRAY_SHULKER_BOX, new Item.Properties().stacksTo(1).component(DataComponents.CONTAINER, ItemContainerContents.EMPTY)) + Blocks.LIGHT_GRAY_SHULKER_BOX, new Item.Properties().stacksTo(1).component(DataComponents.CONTAINER, ItemContainerContents.EMPTY) ); public static final Item CYAN_SHULKER_BOX = registerBlock( - new BlockItem(Blocks.CYAN_SHULKER_BOX, new Item.Properties().stacksTo(1).component(DataComponents.CONTAINER, ItemContainerContents.EMPTY)) + Blocks.CYAN_SHULKER_BOX, new Item.Properties().stacksTo(1).component(DataComponents.CONTAINER, ItemContainerContents.EMPTY) ); public static final Item PURPLE_SHULKER_BOX = registerBlock( - new BlockItem(Blocks.PURPLE_SHULKER_BOX, new Item.Properties().stacksTo(1).component(DataComponents.CONTAINER, ItemContainerContents.EMPTY)) + Blocks.PURPLE_SHULKER_BOX, new Item.Properties().stacksTo(1).component(DataComponents.CONTAINER, ItemContainerContents.EMPTY) ); public static final Item BLUE_SHULKER_BOX = registerBlock( - new BlockItem(Blocks.BLUE_SHULKER_BOX, new Item.Properties().stacksTo(1).component(DataComponents.CONTAINER, ItemContainerContents.EMPTY)) + Blocks.BLUE_SHULKER_BOX, new Item.Properties().stacksTo(1).component(DataComponents.CONTAINER, ItemContainerContents.EMPTY) ); public static final Item BROWN_SHULKER_BOX = registerBlock( - new BlockItem(Blocks.BROWN_SHULKER_BOX, new Item.Properties().stacksTo(1).component(DataComponents.CONTAINER, ItemContainerContents.EMPTY)) + Blocks.BROWN_SHULKER_BOX, new Item.Properties().stacksTo(1).component(DataComponents.CONTAINER, ItemContainerContents.EMPTY) ); public static final Item GREEN_SHULKER_BOX = registerBlock( - new BlockItem(Blocks.GREEN_SHULKER_BOX, new Item.Properties().stacksTo(1).component(DataComponents.CONTAINER, ItemContainerContents.EMPTY)) + Blocks.GREEN_SHULKER_BOX, new Item.Properties().stacksTo(1).component(DataComponents.CONTAINER, ItemContainerContents.EMPTY) ); public static final Item RED_SHULKER_BOX = registerBlock( - new BlockItem(Blocks.RED_SHULKER_BOX, new Item.Properties().stacksTo(1).component(DataComponents.CONTAINER, ItemContainerContents.EMPTY)) + Blocks.RED_SHULKER_BOX, new Item.Properties().stacksTo(1).component(DataComponents.CONTAINER, ItemContainerContents.EMPTY) ); public static final Item BLACK_SHULKER_BOX = registerBlock( - new BlockItem(Blocks.BLACK_SHULKER_BOX, new Item.Properties().stacksTo(1).component(DataComponents.CONTAINER, ItemContainerContents.EMPTY)) + Blocks.BLACK_SHULKER_BOX, new Item.Properties().stacksTo(1).component(DataComponents.CONTAINER, ItemContainerContents.EMPTY) ); public static final Item WHITE_GLAZED_TERRACOTTA = registerBlock(Blocks.WHITE_GLAZED_TERRACOTTA); public static final Item ORANGE_GLAZED_TERRACOTTA = registerBlock(Blocks.ORANGE_GLAZED_TERRACOTTA); @@ -667,7 +741,7 @@ public class Items { public static final Item RED_CONCRETE_POWDER = registerBlock(Blocks.RED_CONCRETE_POWDER); public static final Item BLACK_CONCRETE_POWDER = registerBlock(Blocks.BLACK_CONCRETE_POWDER); public static final Item TURTLE_EGG = registerBlock(Blocks.TURTLE_EGG); - public static final Item SNIFFER_EGG = registerBlock(Blocks.SNIFFER_EGG); + public static final Item SNIFFER_EGG = registerBlock(Blocks.SNIFFER_EGG, (UnaryOperator)(properties -> properties.rarity(Rarity.UNCOMMON))); public static final Item DEAD_TUBE_CORAL_BLOCK = registerBlock(Blocks.DEAD_TUBE_CORAL_BLOCK); public static final Item DEAD_BRAIN_CORAL_BLOCK = registerBlock(Blocks.DEAD_BRAIN_CORAL_BLOCK); public static final Item DEAD_BUBBLE_CORAL_BLOCK = registerBlock(Blocks.DEAD_BUBBLE_CORAL_BLOCK); @@ -689,37 +763,59 @@ public class Items { public static final Item DEAD_HORN_CORAL = registerBlock(Blocks.DEAD_HORN_CORAL); public static final Item DEAD_TUBE_CORAL = registerBlock(Blocks.DEAD_TUBE_CORAL); public static final Item TUBE_CORAL_FAN = registerBlock( - new StandingAndWallBlockItem(Blocks.TUBE_CORAL_FAN, Blocks.TUBE_CORAL_WALL_FAN, new Item.Properties(), Direction.DOWN) + Blocks.TUBE_CORAL_FAN, + (BiFunction)((block, properties) -> new StandingAndWallBlockItem(block, Blocks.TUBE_CORAL_WALL_FAN, Direction.DOWN, properties)) ); public static final Item BRAIN_CORAL_FAN = registerBlock( - new StandingAndWallBlockItem(Blocks.BRAIN_CORAL_FAN, Blocks.BRAIN_CORAL_WALL_FAN, new Item.Properties(), Direction.DOWN) + Blocks.BRAIN_CORAL_FAN, + (BiFunction)((block, properties) -> new StandingAndWallBlockItem(block, Blocks.BRAIN_CORAL_WALL_FAN, Direction.DOWN, properties)) ); public static final Item BUBBLE_CORAL_FAN = registerBlock( - new StandingAndWallBlockItem(Blocks.BUBBLE_CORAL_FAN, Blocks.BUBBLE_CORAL_WALL_FAN, new Item.Properties(), Direction.DOWN) + Blocks.BUBBLE_CORAL_FAN, + (BiFunction)((block, properties) -> new StandingAndWallBlockItem( + block, Blocks.BUBBLE_CORAL_WALL_FAN, Direction.DOWN, properties + )) ); public static final Item FIRE_CORAL_FAN = registerBlock( - new StandingAndWallBlockItem(Blocks.FIRE_CORAL_FAN, Blocks.FIRE_CORAL_WALL_FAN, new Item.Properties(), Direction.DOWN) + Blocks.FIRE_CORAL_FAN, + (BiFunction)((block, properties) -> new StandingAndWallBlockItem(block, Blocks.FIRE_CORAL_WALL_FAN, Direction.DOWN, properties)) ); public static final Item HORN_CORAL_FAN = registerBlock( - new StandingAndWallBlockItem(Blocks.HORN_CORAL_FAN, Blocks.HORN_CORAL_WALL_FAN, new Item.Properties(), Direction.DOWN) + Blocks.HORN_CORAL_FAN, + (BiFunction)((block, properties) -> new StandingAndWallBlockItem(block, Blocks.HORN_CORAL_WALL_FAN, Direction.DOWN, properties)) ); public static final Item DEAD_TUBE_CORAL_FAN = registerBlock( - new StandingAndWallBlockItem(Blocks.DEAD_TUBE_CORAL_FAN, Blocks.DEAD_TUBE_CORAL_WALL_FAN, new Item.Properties(), Direction.DOWN) + Blocks.DEAD_TUBE_CORAL_FAN, + (BiFunction)((block, properties) -> new StandingAndWallBlockItem( + block, Blocks.DEAD_TUBE_CORAL_WALL_FAN, Direction.DOWN, properties + )) ); public static final Item DEAD_BRAIN_CORAL_FAN = registerBlock( - new StandingAndWallBlockItem(Blocks.DEAD_BRAIN_CORAL_FAN, Blocks.DEAD_BRAIN_CORAL_WALL_FAN, new Item.Properties(), Direction.DOWN) + Blocks.DEAD_BRAIN_CORAL_FAN, + (BiFunction)((block, properties) -> new StandingAndWallBlockItem( + block, Blocks.DEAD_BRAIN_CORAL_WALL_FAN, Direction.DOWN, properties + )) ); public static final Item DEAD_BUBBLE_CORAL_FAN = registerBlock( - new StandingAndWallBlockItem(Blocks.DEAD_BUBBLE_CORAL_FAN, Blocks.DEAD_BUBBLE_CORAL_WALL_FAN, new Item.Properties(), Direction.DOWN) + Blocks.DEAD_BUBBLE_CORAL_FAN, + (BiFunction)((block, properties) -> new StandingAndWallBlockItem( + block, Blocks.DEAD_BUBBLE_CORAL_WALL_FAN, Direction.DOWN, properties + )) ); public static final Item DEAD_FIRE_CORAL_FAN = registerBlock( - new StandingAndWallBlockItem(Blocks.DEAD_FIRE_CORAL_FAN, Blocks.DEAD_FIRE_CORAL_WALL_FAN, new Item.Properties(), Direction.DOWN) + Blocks.DEAD_FIRE_CORAL_FAN, + (BiFunction)((block, properties) -> new StandingAndWallBlockItem( + block, Blocks.DEAD_FIRE_CORAL_WALL_FAN, Direction.DOWN, properties + )) ); public static final Item DEAD_HORN_CORAL_FAN = registerBlock( - new StandingAndWallBlockItem(Blocks.DEAD_HORN_CORAL_FAN, Blocks.DEAD_HORN_CORAL_WALL_FAN, new Item.Properties(), Direction.DOWN) + Blocks.DEAD_HORN_CORAL_FAN, + (BiFunction)((block, properties) -> new StandingAndWallBlockItem( + block, Blocks.DEAD_HORN_CORAL_WALL_FAN, Direction.DOWN, properties + )) ); public static final Item BLUE_ICE = registerBlock(Blocks.BLUE_ICE); - public static final Item CONDUIT = registerBlock(new BlockItem(Blocks.CONDUIT, new Item.Properties().rarity(Rarity.RARE))); + public static final Item CONDUIT = registerBlock(Blocks.CONDUIT, new Item.Properties().rarity(Rarity.UNCOMMON)); public static final Item POLISHED_GRANITE_STAIRS = registerBlock(Blocks.POLISHED_GRANITE_STAIRS); public static final Item SMOOTH_RED_SANDSTONE_STAIRS = registerBlock(Blocks.SMOOTH_RED_SANDSTONE_STAIRS); public static final Item MOSSY_STONE_BRICK_STAIRS = registerBlock(Blocks.MOSSY_STONE_BRICK_STAIRS); @@ -755,10 +851,11 @@ public class Items { public static final Item POLISHED_DEEPSLATE_SLAB = registerBlock(Blocks.POLISHED_DEEPSLATE_SLAB); public static final Item DEEPSLATE_BRICK_SLAB = registerBlock(Blocks.DEEPSLATE_BRICK_SLAB); public static final Item DEEPSLATE_TILE_SLAB = registerBlock(Blocks.DEEPSLATE_TILE_SLAB); - public static final Item SCAFFOLDING = registerBlock(new ScaffoldingBlockItem(Blocks.SCAFFOLDING, new Item.Properties())); - public static final Item REDSTONE = registerItem("redstone", new ItemNameBlockItem(Blocks.REDSTONE_WIRE, new Item.Properties())); + public static final Item SCAFFOLDING = registerBlock(Blocks.SCAFFOLDING, ScaffoldingBlockItem::new); + public static final Item REDSTONE = registerItem("redstone", createBlockItemWithCustomItemName(Blocks.REDSTONE_WIRE)); public static final Item REDSTONE_TORCH = registerBlock( - new StandingAndWallBlockItem(Blocks.REDSTONE_TORCH, Blocks.REDSTONE_WALL_TORCH, new Item.Properties(), Direction.DOWN) + Blocks.REDSTONE_TORCH, + (BiFunction)((block, properties) -> new StandingAndWallBlockItem(block, Blocks.REDSTONE_WALL_TORCH, Direction.DOWN, properties)) ); public static final Item REDSTONE_BLOCK = registerBlock(Blocks.REDSTONE_BLOCK); public static final Item REPEATER = registerBlock(Blocks.REPEATER); @@ -768,9 +865,15 @@ public class Items { public static final Item SLIME_BLOCK = registerBlock(Blocks.SLIME_BLOCK); public static final Item HONEY_BLOCK = registerBlock(Blocks.HONEY_BLOCK); public static final Item OBSERVER = registerBlock(Blocks.OBSERVER); - public static final Item HOPPER = registerBlock(Blocks.HOPPER, properties -> properties.component(DataComponents.CONTAINER, ItemContainerContents.EMPTY)); - public static final Item DISPENSER = registerBlock(Blocks.DISPENSER, properties -> properties.component(DataComponents.CONTAINER, ItemContainerContents.EMPTY)); - public static final Item DROPPER = registerBlock(Blocks.DROPPER, properties -> properties.component(DataComponents.CONTAINER, ItemContainerContents.EMPTY)); + public static final Item HOPPER = registerBlock( + Blocks.HOPPER, (UnaryOperator)(properties -> properties.component(DataComponents.CONTAINER, ItemContainerContents.EMPTY)) + ); + public static final Item DISPENSER = registerBlock( + Blocks.DISPENSER, (UnaryOperator)(properties -> properties.component(DataComponents.CONTAINER, ItemContainerContents.EMPTY)) + ); + public static final Item DROPPER = registerBlock( + Blocks.DROPPER, (UnaryOperator)(properties -> properties.component(DataComponents.CONTAINER, ItemContainerContents.EMPTY)) + ); public static final Item LECTERN = registerBlock(Blocks.LECTERN); public static final Item TARGET = registerBlock(Blocks.TARGET); public static final Item LEVER = registerBlock(Blocks.LEVER); @@ -780,7 +883,7 @@ public class Items { public static final Item CALIBRATED_SCULK_SENSOR = registerBlock(Blocks.CALIBRATED_SCULK_SENSOR); public static final Item TRIPWIRE_HOOK = registerBlock(Blocks.TRIPWIRE_HOOK); public static final Item TRAPPED_CHEST = registerBlock( - Blocks.TRAPPED_CHEST, properties -> properties.component(DataComponents.CONTAINER, ItemContainerContents.EMPTY) + Blocks.TRAPPED_CHEST, (UnaryOperator)(properties -> properties.component(DataComponents.CONTAINER, ItemContainerContents.EMPTY)) ); public static final Item TNT = registerBlock(Blocks.TNT); public static final Item REDSTONE_LAMP = registerBlock(Blocks.REDSTONE_LAMP); @@ -794,6 +897,7 @@ public class Items { public static final Item ACACIA_BUTTON = registerBlock(Blocks.ACACIA_BUTTON); public static final Item CHERRY_BUTTON = registerBlock(Blocks.CHERRY_BUTTON); public static final Item DARK_OAK_BUTTON = registerBlock(Blocks.DARK_OAK_BUTTON); + public static final Item PALE_OAK_BUTTON = registerBlock(Blocks.PALE_OAK_BUTTON); public static final Item MANGROVE_BUTTON = registerBlock(Blocks.MANGROVE_BUTTON); public static final Item BAMBOO_BUTTON = registerBlock(Blocks.BAMBOO_BUTTON); public static final Item CRIMSON_BUTTON = registerBlock(Blocks.CRIMSON_BUTTON); @@ -809,30 +913,32 @@ public class Items { public static final Item ACACIA_PRESSURE_PLATE = registerBlock(Blocks.ACACIA_PRESSURE_PLATE); public static final Item CHERRY_PRESSURE_PLATE = registerBlock(Blocks.CHERRY_PRESSURE_PLATE); public static final Item DARK_OAK_PRESSURE_PLATE = registerBlock(Blocks.DARK_OAK_PRESSURE_PLATE); + public static final Item PALE_OAK_PRESSURE_PLATE = registerBlock(Blocks.PALE_OAK_PRESSURE_PLATE); public static final Item MANGROVE_PRESSURE_PLATE = registerBlock(Blocks.MANGROVE_PRESSURE_PLATE); public static final Item BAMBOO_PRESSURE_PLATE = registerBlock(Blocks.BAMBOO_PRESSURE_PLATE); public static final Item CRIMSON_PRESSURE_PLATE = registerBlock(Blocks.CRIMSON_PRESSURE_PLATE); public static final Item WARPED_PRESSURE_PLATE = registerBlock(Blocks.WARPED_PRESSURE_PLATE); - public static final Item IRON_DOOR = registerBlock(new DoubleHighBlockItem(Blocks.IRON_DOOR, new Item.Properties())); - public static final Item OAK_DOOR = registerBlock(new DoubleHighBlockItem(Blocks.OAK_DOOR, new Item.Properties())); - public static final Item SPRUCE_DOOR = registerBlock(new DoubleHighBlockItem(Blocks.SPRUCE_DOOR, new Item.Properties())); - public static final Item BIRCH_DOOR = registerBlock(new DoubleHighBlockItem(Blocks.BIRCH_DOOR, new Item.Properties())); - public static final Item JUNGLE_DOOR = registerBlock(new DoubleHighBlockItem(Blocks.JUNGLE_DOOR, new Item.Properties())); - public static final Item ACACIA_DOOR = registerBlock(new DoubleHighBlockItem(Blocks.ACACIA_DOOR, new Item.Properties())); - public static final Item CHERRY_DOOR = registerBlock(new DoubleHighBlockItem(Blocks.CHERRY_DOOR, new Item.Properties())); - public static final Item DARK_OAK_DOOR = registerBlock(new DoubleHighBlockItem(Blocks.DARK_OAK_DOOR, new Item.Properties())); - public static final Item MANGROVE_DOOR = registerBlock(new DoubleHighBlockItem(Blocks.MANGROVE_DOOR, new Item.Properties())); - public static final Item BAMBOO_DOOR = registerBlock(new DoubleHighBlockItem(Blocks.BAMBOO_DOOR, new Item.Properties())); - public static final Item CRIMSON_DOOR = registerBlock(new DoubleHighBlockItem(Blocks.CRIMSON_DOOR, new Item.Properties())); - public static final Item WARPED_DOOR = registerBlock(new DoubleHighBlockItem(Blocks.WARPED_DOOR, new Item.Properties())); - public static final Item COPPER_DOOR = registerBlock(new DoubleHighBlockItem(Blocks.COPPER_DOOR, new Item.Properties())); - public static final Item EXPOSED_COPPER_DOOR = registerBlock(new DoubleHighBlockItem(Blocks.EXPOSED_COPPER_DOOR, new Item.Properties())); - public static final Item WEATHERED_COPPER_DOOR = registerBlock(new DoubleHighBlockItem(Blocks.WEATHERED_COPPER_DOOR, new Item.Properties())); - public static final Item OXIDIZED_COPPER_DOOR = registerBlock(new DoubleHighBlockItem(Blocks.OXIDIZED_COPPER_DOOR, new Item.Properties())); - public static final Item WAXED_COPPER_DOOR = registerBlock(new DoubleHighBlockItem(Blocks.WAXED_COPPER_DOOR, new Item.Properties())); - public static final Item WAXED_EXPOSED_COPPER_DOOR = registerBlock(new DoubleHighBlockItem(Blocks.WAXED_EXPOSED_COPPER_DOOR, new Item.Properties())); - public static final Item WAXED_WEATHERED_COPPER_DOOR = registerBlock(new DoubleHighBlockItem(Blocks.WAXED_WEATHERED_COPPER_DOOR, new Item.Properties())); - public static final Item WAXED_OXIDIZED_COPPER_DOOR = registerBlock(new DoubleHighBlockItem(Blocks.WAXED_OXIDIZED_COPPER_DOOR, new Item.Properties())); + public static final Item IRON_DOOR = registerBlock(Blocks.IRON_DOOR, DoubleHighBlockItem::new); + public static final Item OAK_DOOR = registerBlock(Blocks.OAK_DOOR, DoubleHighBlockItem::new); + public static final Item SPRUCE_DOOR = registerBlock(Blocks.SPRUCE_DOOR, DoubleHighBlockItem::new); + public static final Item BIRCH_DOOR = registerBlock(Blocks.BIRCH_DOOR, DoubleHighBlockItem::new); + public static final Item JUNGLE_DOOR = registerBlock(Blocks.JUNGLE_DOOR, DoubleHighBlockItem::new); + public static final Item ACACIA_DOOR = registerBlock(Blocks.ACACIA_DOOR, DoubleHighBlockItem::new); + public static final Item CHERRY_DOOR = registerBlock(Blocks.CHERRY_DOOR, DoubleHighBlockItem::new); + public static final Item DARK_OAK_DOOR = registerBlock(Blocks.DARK_OAK_DOOR, DoubleHighBlockItem::new); + public static final Item PALE_OAK_DOOR = registerBlock(Blocks.PALE_OAK_DOOR, DoubleHighBlockItem::new); + public static final Item MANGROVE_DOOR = registerBlock(Blocks.MANGROVE_DOOR, DoubleHighBlockItem::new); + public static final Item BAMBOO_DOOR = registerBlock(Blocks.BAMBOO_DOOR, DoubleHighBlockItem::new); + public static final Item CRIMSON_DOOR = registerBlock(Blocks.CRIMSON_DOOR, DoubleHighBlockItem::new); + public static final Item WARPED_DOOR = registerBlock(Blocks.WARPED_DOOR, DoubleHighBlockItem::new); + public static final Item COPPER_DOOR = registerBlock(Blocks.COPPER_DOOR, DoubleHighBlockItem::new); + public static final Item EXPOSED_COPPER_DOOR = registerBlock(Blocks.EXPOSED_COPPER_DOOR, DoubleHighBlockItem::new); + public static final Item WEATHERED_COPPER_DOOR = registerBlock(Blocks.WEATHERED_COPPER_DOOR, DoubleHighBlockItem::new); + public static final Item OXIDIZED_COPPER_DOOR = registerBlock(Blocks.OXIDIZED_COPPER_DOOR, DoubleHighBlockItem::new); + public static final Item WAXED_COPPER_DOOR = registerBlock(Blocks.WAXED_COPPER_DOOR, DoubleHighBlockItem::new); + public static final Item WAXED_EXPOSED_COPPER_DOOR = registerBlock(Blocks.WAXED_EXPOSED_COPPER_DOOR, DoubleHighBlockItem::new); + public static final Item WAXED_WEATHERED_COPPER_DOOR = registerBlock(Blocks.WAXED_WEATHERED_COPPER_DOOR, DoubleHighBlockItem::new); + public static final Item WAXED_OXIDIZED_COPPER_DOOR = registerBlock(Blocks.WAXED_OXIDIZED_COPPER_DOOR, DoubleHighBlockItem::new); public static final Item IRON_TRAPDOOR = registerBlock(Blocks.IRON_TRAPDOOR); public static final Item OAK_TRAPDOOR = registerBlock(Blocks.OAK_TRAPDOOR); public static final Item SPRUCE_TRAPDOOR = registerBlock(Blocks.SPRUCE_TRAPDOOR); @@ -841,6 +947,7 @@ public class Items { public static final Item ACACIA_TRAPDOOR = registerBlock(Blocks.ACACIA_TRAPDOOR); public static final Item CHERRY_TRAPDOOR = registerBlock(Blocks.CHERRY_TRAPDOOR); public static final Item DARK_OAK_TRAPDOOR = registerBlock(Blocks.DARK_OAK_TRAPDOOR); + public static final Item PALE_OAK_TRAPDOOR = registerBlock(Blocks.PALE_OAK_TRAPDOOR); public static final Item MANGROVE_TRAPDOOR = registerBlock(Blocks.MANGROVE_TRAPDOOR); public static final Item BAMBOO_TRAPDOOR = registerBlock(Blocks.BAMBOO_TRAPDOOR); public static final Item CRIMSON_TRAPDOOR = registerBlock(Blocks.CRIMSON_TRAPDOOR); @@ -860,6 +967,7 @@ public class Items { public static final Item ACACIA_FENCE_GATE = registerBlock(Blocks.ACACIA_FENCE_GATE); public static final Item CHERRY_FENCE_GATE = registerBlock(Blocks.CHERRY_FENCE_GATE); public static final Item DARK_OAK_FENCE_GATE = registerBlock(Blocks.DARK_OAK_FENCE_GATE); + public static final Item PALE_OAK_FENCE_GATE = registerBlock(Blocks.PALE_OAK_FENCE_GATE); public static final Item MANGROVE_FENCE_GATE = registerBlock(Blocks.MANGROVE_FENCE_GATE); public static final Item BAMBOO_FENCE_GATE = registerBlock(Blocks.BAMBOO_FENCE_GATE); public static final Item CRIMSON_FENCE_GATE = registerBlock(Blocks.CRIMSON_FENCE_GATE); @@ -868,972 +976,1161 @@ public class Items { public static final Item DETECTOR_RAIL = registerBlock(Blocks.DETECTOR_RAIL); public static final Item RAIL = registerBlock(Blocks.RAIL); public static final Item ACTIVATOR_RAIL = registerBlock(Blocks.ACTIVATOR_RAIL); - public static final Item SADDLE = registerItem("saddle", new SaddleItem(new Item.Properties().stacksTo(1))); - public static final Item MINECART = registerItem("minecart", new MinecartItem(AbstractMinecart.Type.RIDEABLE, new Item.Properties().stacksTo(1))); - public static final Item CHEST_MINECART = registerItem("chest_minecart", new MinecartItem(AbstractMinecart.Type.CHEST, new Item.Properties().stacksTo(1))); + public static final Item SADDLE = registerItem("saddle", SaddleItem::new, new Item.Properties().stacksTo(1)); + public static final Item MINECART = registerItem( + "minecart", properties -> new MinecartItem(EntityType.MINECART, properties), new Item.Properties().stacksTo(1) + ); + public static final Item CHEST_MINECART = registerItem( + "chest_minecart", properties -> new MinecartItem(EntityType.CHEST_MINECART, properties), new Item.Properties().stacksTo(1) + ); public static final Item FURNACE_MINECART = registerItem( - "furnace_minecart", new MinecartItem(AbstractMinecart.Type.FURNACE, new Item.Properties().stacksTo(1)) + "furnace_minecart", properties -> new MinecartItem(EntityType.FURNACE_MINECART, properties), new Item.Properties().stacksTo(1) + ); + public static final Item TNT_MINECART = registerItem( + "tnt_minecart", properties -> new MinecartItem(EntityType.TNT_MINECART, properties), new Item.Properties().stacksTo(1) + ); + public static final Item HOPPER_MINECART = registerItem( + "hopper_minecart", properties -> new MinecartItem(EntityType.HOPPER_MINECART, properties), new Item.Properties().stacksTo(1) + ); + public static final Item CARROT_ON_A_STICK = registerItem( + "carrot_on_a_stick", properties -> new FoodOnAStickItem<>(EntityType.PIG, 7, properties), new Item.Properties().durability(25) ); - public static final Item TNT_MINECART = registerItem("tnt_minecart", new MinecartItem(AbstractMinecart.Type.TNT, new Item.Properties().stacksTo(1))); - public static final Item HOPPER_MINECART = registerItem("hopper_minecart", new MinecartItem(AbstractMinecart.Type.HOPPER, new Item.Properties().stacksTo(1))); - public static final Item CARROT_ON_A_STICK = registerItem("carrot_on_a_stick", new FoodOnAStickItem<>(new Item.Properties().durability(25), EntityType.PIG, 7)); public static final Item WARPED_FUNGUS_ON_A_STICK = registerItem( - "warped_fungus_on_a_stick", new FoodOnAStickItem<>(new Item.Properties().durability(100), EntityType.STRIDER, 1) + "warped_fungus_on_a_stick", properties -> new FoodOnAStickItem<>(EntityType.STRIDER, 1, properties), new Item.Properties().durability(100) ); - public static final Item ELYTRA = registerItem("elytra", new ElytraItem(new Item.Properties().durability(432).rarity(Rarity.UNCOMMON))); - public static final Item OAK_BOAT = registerItem("oak_boat", new BoatItem(false, Boat.Type.OAK, new Item.Properties().stacksTo(1))); - public static final Item OAK_CHEST_BOAT = registerItem("oak_chest_boat", new BoatItem(true, Boat.Type.OAK, new Item.Properties().stacksTo(1))); - public static final Item SPRUCE_BOAT = registerItem("spruce_boat", new BoatItem(false, Boat.Type.SPRUCE, new Item.Properties().stacksTo(1))); - public static final Item SPRUCE_CHEST_BOAT = registerItem("spruce_chest_boat", new BoatItem(true, Boat.Type.SPRUCE, new Item.Properties().stacksTo(1))); - public static final Item BIRCH_BOAT = registerItem("birch_boat", new BoatItem(false, Boat.Type.BIRCH, new Item.Properties().stacksTo(1))); - public static final Item BIRCH_CHEST_BOAT = registerItem("birch_chest_boat", new BoatItem(true, Boat.Type.BIRCH, new Item.Properties().stacksTo(1))); - public static final Item JUNGLE_BOAT = registerItem("jungle_boat", new BoatItem(false, Boat.Type.JUNGLE, new Item.Properties().stacksTo(1))); - public static final Item JUNGLE_CHEST_BOAT = registerItem("jungle_chest_boat", new BoatItem(true, Boat.Type.JUNGLE, new Item.Properties().stacksTo(1))); - public static final Item ACACIA_BOAT = registerItem("acacia_boat", new BoatItem(false, Boat.Type.ACACIA, new Item.Properties().stacksTo(1))); - public static final Item ACACIA_CHEST_BOAT = registerItem("acacia_chest_boat", new BoatItem(true, Boat.Type.ACACIA, new Item.Properties().stacksTo(1))); - public static final Item CHERRY_BOAT = registerItem("cherry_boat", new BoatItem(false, Boat.Type.CHERRY, new Item.Properties().stacksTo(1))); - public static final Item CHERRY_CHEST_BOAT = registerItem("cherry_chest_boat", new BoatItem(true, Boat.Type.CHERRY, new Item.Properties().stacksTo(1))); - public static final Item DARK_OAK_BOAT = registerItem("dark_oak_boat", new BoatItem(false, Boat.Type.DARK_OAK, new Item.Properties().stacksTo(1))); - public static final Item DARK_OAK_CHEST_BOAT = registerItem("dark_oak_chest_boat", new BoatItem(true, Boat.Type.DARK_OAK, new Item.Properties().stacksTo(1))); - public static final Item MANGROVE_BOAT = registerItem("mangrove_boat", new BoatItem(false, Boat.Type.MANGROVE, new Item.Properties().stacksTo(1))); - public static final Item MANGROVE_CHEST_BOAT = registerItem("mangrove_chest_boat", new BoatItem(true, Boat.Type.MANGROVE, new Item.Properties().stacksTo(1))); - public static final Item BAMBOO_RAFT = registerItem("bamboo_raft", new BoatItem(false, Boat.Type.BAMBOO, new Item.Properties().stacksTo(1))); - public static final Item BAMBOO_CHEST_RAFT = registerItem("bamboo_chest_raft", new BoatItem(true, Boat.Type.BAMBOO, new Item.Properties().stacksTo(1))); - public static final Item STRUCTURE_BLOCK = registerBlock(new GameMasterBlockItem(Blocks.STRUCTURE_BLOCK, new Item.Properties().rarity(Rarity.EPIC))); - public static final Item JIGSAW = registerBlock(new GameMasterBlockItem(Blocks.JIGSAW, new Item.Properties().rarity(Rarity.EPIC))); - public static final Item TURTLE_HELMET = registerItem( - "turtle_helmet", new ArmorItem(ArmorMaterials.TURTLE, ArmorItem.Type.HELMET, new Item.Properties().durability(ArmorItem.Type.HELMET.getDurability(25))) + public static final Item PHANTOM_MEMBRANE = registerItem("phantom_membrane"); + public static final Item ELYTRA = registerItem( + "elytra", + new Item.Properties() + .durability(432) + .rarity(Rarity.EPIC) + .component(DataComponents.GLIDER, Unit.INSTANCE) + .component( + DataComponents.EQUIPPABLE, + Equippable.builder(EquipmentSlot.CHEST).setEquipSound(SoundEvents.ARMOR_EQUIP_ELYTRA).setModel(EquipmentModels.ELYTRA).setDamageOnHurt(false).build() + ) + .repairable(PHANTOM_MEMBRANE) ); - public static final Item TURTLE_SCUTE = registerItem("turtle_scute", new Item(new Item.Properties())); - public static final Item ARMADILLO_SCUTE = registerItem("armadillo_scute", new Item(new Item.Properties())); + public static final Item OAK_BOAT = registerItem("oak_boat", properties -> new BoatItem(EntityType.OAK_BOAT, properties), new Item.Properties().stacksTo(1)); + public static final Item OAK_CHEST_BOAT = registerItem( + "oak_chest_boat", properties -> new BoatItem(EntityType.OAK_CHEST_BOAT, properties), new Item.Properties().stacksTo(1) + ); + public static final Item SPRUCE_BOAT = registerItem( + "spruce_boat", properties -> new BoatItem(EntityType.SPRUCE_BOAT, properties), new Item.Properties().stacksTo(1) + ); + public static final Item SPRUCE_CHEST_BOAT = registerItem( + "spruce_chest_boat", properties -> new BoatItem(EntityType.SPRUCE_CHEST_BOAT, properties), new Item.Properties().stacksTo(1) + ); + public static final Item BIRCH_BOAT = registerItem( + "birch_boat", properties -> new BoatItem(EntityType.BIRCH_BOAT, properties), new Item.Properties().stacksTo(1) + ); + public static final Item BIRCH_CHEST_BOAT = registerItem( + "birch_chest_boat", properties -> new BoatItem(EntityType.BIRCH_CHEST_BOAT, properties), new Item.Properties().stacksTo(1) + ); + public static final Item JUNGLE_BOAT = registerItem( + "jungle_boat", properties -> new BoatItem(EntityType.JUNGLE_BOAT, properties), new Item.Properties().stacksTo(1) + ); + public static final Item JUNGLE_CHEST_BOAT = registerItem( + "jungle_chest_boat", properties -> new BoatItem(EntityType.JUNGLE_CHEST_BOAT, properties), new Item.Properties().stacksTo(1) + ); + public static final Item ACACIA_BOAT = registerItem( + "acacia_boat", properties -> new BoatItem(EntityType.ACACIA_BOAT, properties), new Item.Properties().stacksTo(1) + ); + public static final Item ACACIA_CHEST_BOAT = registerItem( + "acacia_chest_boat", properties -> new BoatItem(EntityType.ACACIA_CHEST_BOAT, properties), new Item.Properties().stacksTo(1) + ); + public static final Item CHERRY_BOAT = registerItem( + "cherry_boat", properties -> new BoatItem(EntityType.CHERRY_BOAT, properties), new Item.Properties().stacksTo(1) + ); + public static final Item CHERRY_CHEST_BOAT = registerItem( + "cherry_chest_boat", properties -> new BoatItem(EntityType.CHERRY_CHEST_BOAT, properties), new Item.Properties().stacksTo(1) + ); + public static final Item DARK_OAK_BOAT = registerItem( + "dark_oak_boat", properties -> new BoatItem(EntityType.DARK_OAK_BOAT, properties), new Item.Properties().stacksTo(1) + ); + public static final Item DARK_OAK_CHEST_BOAT = registerItem( + "dark_oak_chest_boat", properties -> new BoatItem(EntityType.DARK_OAK_CHEST_BOAT, properties), new Item.Properties().stacksTo(1) + ); + public static final Item PALE_OAK_BOAT = registerItem( + "pale_oak_boat", + properties -> new BoatItem(EntityType.PALE_OAK_BOAT, properties), + new Item.Properties().stacksTo(1).requiredFeatures(FeatureFlags.WINTER_DROP) + ); + public static final Item PALE_OAK_CHEST_BOAT = registerItem( + "pale_oak_chest_boat", + properties -> new BoatItem(EntityType.PALE_OAK_CHEST_BOAT, properties), + new Item.Properties().stacksTo(1).requiredFeatures(FeatureFlags.WINTER_DROP) + ); + public static final Item MANGROVE_BOAT = registerItem( + "mangrove_boat", properties -> new BoatItem(EntityType.MANGROVE_BOAT, properties), new Item.Properties().stacksTo(1) + ); + public static final Item MANGROVE_CHEST_BOAT = registerItem( + "mangrove_chest_boat", properties -> new BoatItem(EntityType.MANGROVE_CHEST_BOAT, properties), new Item.Properties().stacksTo(1) + ); + public static final Item BAMBOO_RAFT = registerItem( + "bamboo_raft", properties -> new BoatItem(EntityType.BAMBOO_RAFT, properties), new Item.Properties().stacksTo(1) + ); + public static final Item BAMBOO_CHEST_RAFT = registerItem( + "bamboo_chest_raft", properties -> new BoatItem(EntityType.BAMBOO_CHEST_RAFT, properties), new Item.Properties().stacksTo(1) + ); + public static final Item STRUCTURE_BLOCK = registerBlock(Blocks.STRUCTURE_BLOCK, GameMasterBlockItem::new, new Item.Properties().rarity(Rarity.EPIC)); + public static final Item JIGSAW = registerBlock(Blocks.JIGSAW, GameMasterBlockItem::new, new Item.Properties().rarity(Rarity.EPIC)); + public static final Item TURTLE_HELMET = registerItem("turtle_helmet", properties -> new ArmorItem(ArmorMaterials.TURTLE_SCUTE, ArmorType.HELMET, properties)); + public static final Item TURTLE_SCUTE = registerItem("turtle_scute"); + public static final Item ARMADILLO_SCUTE = registerItem("armadillo_scute"); public static final Item WOLF_ARMOR = registerItem( - "wolf_armor", - new AnimalArmorItem(ArmorMaterials.ARMADILLO, AnimalArmorItem.BodyType.CANINE, true, new Item.Properties().durability(ArmorItem.Type.BODY.getDurability(4))) - ); - public static final Item FLINT_AND_STEEL = registerItem("flint_and_steel", new FlintAndSteelItem(new Item.Properties().durability(64))); - public static final Item BOWL = registerItem("bowl", new Item(new Item.Properties())); - public static final Item APPLE = registerItem("apple", new Item(new Item.Properties().food(Foods.APPLE))); - public static final Item BOW = registerItem("bow", new BowItem(new Item.Properties().durability(384))); - public static final Item ARROW = registerItem("arrow", new ArrowItem(new Item.Properties())); - public static final Item COAL = registerItem("coal", new Item(new Item.Properties())); - public static final Item CHARCOAL = registerItem("charcoal", new Item(new Item.Properties())); - public static final Item DIAMOND = registerItem("diamond", new Item(new Item.Properties())); - public static final Item EMERALD = registerItem("emerald", new Item(new Item.Properties())); - public static final Item LAPIS_LAZULI = registerItem("lapis_lazuli", new Item(new Item.Properties())); - public static final Item QUARTZ = registerItem("quartz", new Item(new Item.Properties())); - public static final Item AMETHYST_SHARD = registerItem("amethyst_shard", new Item(new Item.Properties())); - public static final Item RAW_IRON = registerItem("raw_iron", new Item(new Item.Properties())); - public static final Item IRON_INGOT = registerItem("iron_ingot", new Item(new Item.Properties())); - public static final Item RAW_COPPER = registerItem("raw_copper", new Item(new Item.Properties())); - public static final Item COPPER_INGOT = registerItem("copper_ingot", new Item(new Item.Properties())); - public static final Item RAW_GOLD = registerItem("raw_gold", new Item(new Item.Properties())); - public static final Item GOLD_INGOT = registerItem("gold_ingot", new Item(new Item.Properties())); - public static final Item NETHERITE_INGOT = registerItem("netherite_ingot", new Item(new Item.Properties().fireResistant())); - public static final Item NETHERITE_SCRAP = registerItem("netherite_scrap", new Item(new Item.Properties().fireResistant())); - public static final Item WOODEN_SWORD = registerItem( - "wooden_sword", new SwordItem(Tiers.WOOD, new Item.Properties().attributes(SwordItem.createAttributes(Tiers.WOOD, 3, -2.4F))) - ); - public static final Item WOODEN_SHOVEL = registerItem( - "wooden_shovel", new ShovelItem(Tiers.WOOD, new Item.Properties().attributes(ShovelItem.createAttributes(Tiers.WOOD, 1.5F, -3.0F))) - ); - public static final Item WOODEN_PICKAXE = registerItem( - "wooden_pickaxe", new PickaxeItem(Tiers.WOOD, new Item.Properties().attributes(PickaxeItem.createAttributes(Tiers.WOOD, 1.0F, -2.8F))) - ); - public static final Item WOODEN_AXE = registerItem( - "wooden_axe", new AxeItem(Tiers.WOOD, new Item.Properties().attributes(AxeItem.createAttributes(Tiers.WOOD, 6.0F, -3.2F))) - ); - public static final Item WOODEN_HOE = registerItem( - "wooden_hoe", new HoeItem(Tiers.WOOD, new Item.Properties().attributes(HoeItem.createAttributes(Tiers.WOOD, 0.0F, -3.0F))) - ); - public static final Item STONE_SWORD = registerItem( - "stone_sword", new SwordItem(Tiers.STONE, new Item.Properties().attributes(SwordItem.createAttributes(Tiers.STONE, 3, -2.4F))) - ); - public static final Item STONE_SHOVEL = registerItem( - "stone_shovel", new ShovelItem(Tiers.STONE, new Item.Properties().attributes(ShovelItem.createAttributes(Tiers.STONE, 1.5F, -3.0F))) - ); - public static final Item STONE_PICKAXE = registerItem( - "stone_pickaxe", new PickaxeItem(Tiers.STONE, new Item.Properties().attributes(PickaxeItem.createAttributes(Tiers.STONE, 1.0F, -2.8F))) - ); - public static final Item STONE_AXE = registerItem( - "stone_axe", new AxeItem(Tiers.STONE, new Item.Properties().attributes(AxeItem.createAttributes(Tiers.STONE, 7.0F, -3.2F))) - ); - public static final Item STONE_HOE = registerItem( - "stone_hoe", new HoeItem(Tiers.STONE, new Item.Properties().attributes(HoeItem.createAttributes(Tiers.STONE, -1.0F, -2.0F))) - ); - public static final Item GOLDEN_SWORD = registerItem( - "golden_sword", new SwordItem(Tiers.GOLD, new Item.Properties().attributes(SwordItem.createAttributes(Tiers.GOLD, 3, -2.4F))) - ); - public static final Item GOLDEN_SHOVEL = registerItem( - "golden_shovel", new ShovelItem(Tiers.GOLD, new Item.Properties().attributes(ShovelItem.createAttributes(Tiers.GOLD, 1.5F, -3.0F))) - ); - public static final Item GOLDEN_PICKAXE = registerItem( - "golden_pickaxe", new PickaxeItem(Tiers.GOLD, new Item.Properties().attributes(PickaxeItem.createAttributes(Tiers.GOLD, 1.0F, -2.8F))) - ); - public static final Item GOLDEN_AXE = registerItem( - "golden_axe", new AxeItem(Tiers.GOLD, new Item.Properties().attributes(AxeItem.createAttributes(Tiers.GOLD, 6.0F, -3.0F))) - ); - public static final Item GOLDEN_HOE = registerItem( - "golden_hoe", new HoeItem(Tiers.GOLD, new Item.Properties().attributes(HoeItem.createAttributes(Tiers.GOLD, 0.0F, -3.0F))) - ); - public static final Item IRON_SWORD = registerItem( - "iron_sword", new SwordItem(Tiers.IRON, new Item.Properties().attributes(SwordItem.createAttributes(Tiers.IRON, 3, -2.4F))) - ); - public static final Item IRON_SHOVEL = registerItem( - "iron_shovel", new ShovelItem(Tiers.IRON, new Item.Properties().attributes(ShovelItem.createAttributes(Tiers.IRON, 1.5F, -3.0F))) - ); - public static final Item IRON_PICKAXE = registerItem( - "iron_pickaxe", new PickaxeItem(Tiers.IRON, new Item.Properties().attributes(PickaxeItem.createAttributes(Tiers.IRON, 1.0F, -2.8F))) - ); - public static final Item IRON_AXE = registerItem( - "iron_axe", new AxeItem(Tiers.IRON, new Item.Properties().attributes(AxeItem.createAttributes(Tiers.IRON, 6.0F, -3.1F))) - ); - public static final Item IRON_HOE = registerItem( - "iron_hoe", new HoeItem(Tiers.IRON, new Item.Properties().attributes(HoeItem.createAttributes(Tiers.IRON, -2.0F, -1.0F))) - ); - public static final Item DIAMOND_SWORD = registerItem( - "diamond_sword", new SwordItem(Tiers.DIAMOND, new Item.Properties().attributes(SwordItem.createAttributes(Tiers.DIAMOND, 3, -2.4F))) - ); - public static final Item DIAMOND_SHOVEL = registerItem( - "diamond_shovel", new ShovelItem(Tiers.DIAMOND, new Item.Properties().attributes(ShovelItem.createAttributes(Tiers.DIAMOND, 1.5F, -3.0F))) - ); - public static final Item DIAMOND_PICKAXE = registerItem( - "diamond_pickaxe", new PickaxeItem(Tiers.DIAMOND, new Item.Properties().attributes(PickaxeItem.createAttributes(Tiers.DIAMOND, 1.0F, -2.8F))) - ); - public static final Item DIAMOND_AXE = registerItem( - "diamond_axe", new AxeItem(Tiers.DIAMOND, new Item.Properties().attributes(AxeItem.createAttributes(Tiers.DIAMOND, 5.0F, -3.0F))) - ); - public static final Item DIAMOND_HOE = registerItem( - "diamond_hoe", new HoeItem(Tiers.DIAMOND, new Item.Properties().attributes(HoeItem.createAttributes(Tiers.DIAMOND, -3.0F, 0.0F))) + "wolf_armor", properties -> new AnimalArmorItem(ArmorMaterials.ARMADILLO_SCUTE, AnimalArmorItem.BodyType.CANINE, properties) ); + public static final Item FLINT_AND_STEEL = registerItem("flint_and_steel", FlintAndSteelItem::new, new Item.Properties().durability(64)); + public static final Item BOWL = registerItem("bowl"); + public static final Item APPLE = registerItem("apple", new Item.Properties().food(Foods.APPLE)); + public static final Item BOW = registerItem("bow", BowItem::new, new Item.Properties().durability(384).enchantable(1)); + public static final Item ARROW = registerItem("arrow", ArrowItem::new); + public static final Item COAL = registerItem("coal"); + public static final Item CHARCOAL = registerItem("charcoal"); + public static final Item DIAMOND = registerItem("diamond"); + public static final Item EMERALD = registerItem("emerald"); + public static final Item LAPIS_LAZULI = registerItem("lapis_lazuli"); + public static final Item QUARTZ = registerItem("quartz"); + public static final Item AMETHYST_SHARD = registerItem("amethyst_shard"); + public static final Item RAW_IRON = registerItem("raw_iron"); + public static final Item IRON_INGOT = registerItem("iron_ingot"); + public static final Item RAW_COPPER = registerItem("raw_copper"); + public static final Item COPPER_INGOT = registerItem("copper_ingot"); + public static final Item RAW_GOLD = registerItem("raw_gold"); + public static final Item GOLD_INGOT = registerItem("gold_ingot"); + public static final Item NETHERITE_INGOT = registerItem("netherite_ingot", new Item.Properties().fireResistant()); + public static final Item NETHERITE_SCRAP = registerItem("netherite_scrap", new Item.Properties().fireResistant()); + public static final Item WOODEN_SWORD = registerItem("wooden_sword", properties -> new SwordItem(ToolMaterial.WOOD, 3.0F, -2.4F, properties)); + public static final Item WOODEN_SHOVEL = registerItem("wooden_shovel", properties -> new ShovelItem(ToolMaterial.WOOD, 1.5F, -3.0F, properties)); + public static final Item WOODEN_PICKAXE = registerItem("wooden_pickaxe", properties -> new PickaxeItem(ToolMaterial.WOOD, 1.0F, -2.8F, properties)); + public static final Item WOODEN_AXE = registerItem("wooden_axe", properties -> new AxeItem(ToolMaterial.WOOD, 6.0F, -3.2F, properties)); + public static final Item WOODEN_HOE = registerItem("wooden_hoe", properties -> new HoeItem(ToolMaterial.WOOD, 0.0F, -3.0F, properties)); + public static final Item STONE_SWORD = registerItem("stone_sword", properties -> new SwordItem(ToolMaterial.STONE, 3.0F, -2.4F, properties)); + public static final Item STONE_SHOVEL = registerItem("stone_shovel", properties -> new ShovelItem(ToolMaterial.STONE, 1.5F, -3.0F, properties)); + public static final Item STONE_PICKAXE = registerItem("stone_pickaxe", properties -> new PickaxeItem(ToolMaterial.STONE, 1.0F, -2.8F, properties)); + public static final Item STONE_AXE = registerItem("stone_axe", properties -> new AxeItem(ToolMaterial.STONE, 7.0F, -3.2F, properties)); + public static final Item STONE_HOE = registerItem("stone_hoe", properties -> new HoeItem(ToolMaterial.STONE, -1.0F, -2.0F, properties)); + public static final Item GOLDEN_SWORD = registerItem("golden_sword", properties -> new SwordItem(ToolMaterial.GOLD, 3.0F, -2.4F, properties)); + public static final Item GOLDEN_SHOVEL = registerItem("golden_shovel", properties -> new ShovelItem(ToolMaterial.GOLD, 1.5F, -3.0F, properties)); + public static final Item GOLDEN_PICKAXE = registerItem("golden_pickaxe", properties -> new PickaxeItem(ToolMaterial.GOLD, 1.0F, -2.8F, properties)); + public static final Item GOLDEN_AXE = registerItem("golden_axe", properties -> new AxeItem(ToolMaterial.GOLD, 6.0F, -3.0F, properties)); + public static final Item GOLDEN_HOE = registerItem("golden_hoe", properties -> new HoeItem(ToolMaterial.GOLD, 0.0F, -3.0F, properties)); + public static final Item IRON_SWORD = registerItem("iron_sword", properties -> new SwordItem(ToolMaterial.IRON, 3.0F, -2.4F, properties)); + public static final Item IRON_SHOVEL = registerItem("iron_shovel", properties -> new ShovelItem(ToolMaterial.IRON, 1.5F, -3.0F, properties)); + public static final Item IRON_PICKAXE = registerItem("iron_pickaxe", properties -> new PickaxeItem(ToolMaterial.IRON, 1.0F, -2.8F, properties)); + public static final Item IRON_AXE = registerItem("iron_axe", properties -> new AxeItem(ToolMaterial.IRON, 6.0F, -3.1F, properties)); + public static final Item IRON_HOE = registerItem("iron_hoe", properties -> new HoeItem(ToolMaterial.IRON, -2.0F, -1.0F, properties)); + public static final Item DIAMOND_SWORD = registerItem("diamond_sword", properties -> new SwordItem(ToolMaterial.DIAMOND, 3.0F, -2.4F, properties)); + public static final Item DIAMOND_SHOVEL = registerItem("diamond_shovel", properties -> new ShovelItem(ToolMaterial.DIAMOND, 1.5F, -3.0F, properties)); + public static final Item DIAMOND_PICKAXE = registerItem("diamond_pickaxe", properties -> new PickaxeItem(ToolMaterial.DIAMOND, 1.0F, -2.8F, properties)); + public static final Item DIAMOND_AXE = registerItem("diamond_axe", properties -> new AxeItem(ToolMaterial.DIAMOND, 5.0F, -3.0F, properties)); + public static final Item DIAMOND_HOE = registerItem("diamond_hoe", properties -> new HoeItem(ToolMaterial.DIAMOND, -3.0F, 0.0F, properties)); public static final Item NETHERITE_SWORD = registerItem( - "netherite_sword", new SwordItem(Tiers.NETHERITE, new Item.Properties().fireResistant().attributes(SwordItem.createAttributes(Tiers.NETHERITE, 3, -2.4F))) + "netherite_sword", properties -> new SwordItem(ToolMaterial.NETHERITE, 3.0F, -2.4F, properties), new Item.Properties().fireResistant() ); public static final Item NETHERITE_SHOVEL = registerItem( - "netherite_shovel", - new ShovelItem(Tiers.NETHERITE, new Item.Properties().fireResistant().attributes(ShovelItem.createAttributes(Tiers.NETHERITE, 1.5F, -3.0F))) + "netherite_shovel", properties -> new ShovelItem(ToolMaterial.NETHERITE, 1.5F, -3.0F, properties), new Item.Properties().fireResistant() ); public static final Item NETHERITE_PICKAXE = registerItem( - "netherite_pickaxe", - new PickaxeItem(Tiers.NETHERITE, new Item.Properties().fireResistant().attributes(PickaxeItem.createAttributes(Tiers.NETHERITE, 1.0F, -2.8F))) + "netherite_pickaxe", properties -> new PickaxeItem(ToolMaterial.NETHERITE, 1.0F, -2.8F, properties), new Item.Properties().fireResistant() ); public static final Item NETHERITE_AXE = registerItem( - "netherite_axe", new AxeItem(Tiers.NETHERITE, new Item.Properties().fireResistant().attributes(AxeItem.createAttributes(Tiers.NETHERITE, 5.0F, -3.0F))) + "netherite_axe", properties -> new AxeItem(ToolMaterial.NETHERITE, 5.0F, -3.0F, properties), new Item.Properties().fireResistant() ); public static final Item NETHERITE_HOE = registerItem( - "netherite_hoe", new HoeItem(Tiers.NETHERITE, new Item.Properties().fireResistant().attributes(HoeItem.createAttributes(Tiers.NETHERITE, -4.0F, 0.0F))) - ); - public static final Item STICK = registerItem("stick", new Item(new Item.Properties())); - public static final Item MUSHROOM_STEW = registerItem("mushroom_stew", new Item(new Item.Properties().stacksTo(1).food(Foods.MUSHROOM_STEW))); - public static final Item STRING = registerItem("string", new ItemNameBlockItem(Blocks.TRIPWIRE, new Item.Properties())); - public static final Item FEATHER = registerItem("feather", new Item(new Item.Properties())); - public static final Item GUNPOWDER = registerItem("gunpowder", new Item(new Item.Properties())); - public static final Item WHEAT_SEEDS = registerItem("wheat_seeds", new ItemNameBlockItem(Blocks.WHEAT, new Item.Properties())); - public static final Item WHEAT = registerItem("wheat", new Item(new Item.Properties())); - public static final Item BREAD = registerItem("bread", new Item(new Item.Properties().food(Foods.BREAD))); - public static final Item LEATHER_HELMET = registerItem( - "leather_helmet", new ArmorItem(ArmorMaterials.LEATHER, ArmorItem.Type.HELMET, new Item.Properties().durability(ArmorItem.Type.HELMET.getDurability(5))) + "netherite_hoe", properties -> new HoeItem(ToolMaterial.NETHERITE, -4.0F, 0.0F, properties), new Item.Properties().fireResistant() ); + public static final Item STICK = registerItem("stick"); + public static final Item MUSHROOM_STEW = registerItem("mushroom_stew", new Item.Properties().stacksTo(1).food(Foods.MUSHROOM_STEW).usingConvertsTo(BOWL)); + public static final Item STRING = registerItem("string", createBlockItemWithCustomItemName(Blocks.TRIPWIRE)); + public static final Item FEATHER = registerItem("feather"); + public static final Item GUNPOWDER = registerItem("gunpowder"); + public static final Item WHEAT_SEEDS = registerItem("wheat_seeds", createBlockItemWithCustomItemName(Blocks.WHEAT)); + public static final Item WHEAT = registerItem("wheat"); + public static final Item BREAD = registerItem("bread", new Item.Properties().food(Foods.BREAD)); + public static final Item LEATHER_HELMET = registerItem("leather_helmet", properties -> new ArmorItem(ArmorMaterials.LEATHER, ArmorType.HELMET, properties)); public static final Item LEATHER_CHESTPLATE = registerItem( - "leather_chestplate", - new ArmorItem(ArmorMaterials.LEATHER, ArmorItem.Type.CHESTPLATE, new Item.Properties().durability(ArmorItem.Type.CHESTPLATE.getDurability(5))) + "leather_chestplate", properties -> new ArmorItem(ArmorMaterials.LEATHER, ArmorType.CHESTPLATE, properties) ); public static final Item LEATHER_LEGGINGS = registerItem( - "leather_leggings", - new ArmorItem(ArmorMaterials.LEATHER, ArmorItem.Type.LEGGINGS, new Item.Properties().durability(ArmorItem.Type.LEGGINGS.getDurability(5))) - ); - public static final Item LEATHER_BOOTS = registerItem( - "leather_boots", new ArmorItem(ArmorMaterials.LEATHER, ArmorItem.Type.BOOTS, new Item.Properties().durability(ArmorItem.Type.BOOTS.getDurability(5))) + "leather_leggings", properties -> new ArmorItem(ArmorMaterials.LEATHER, ArmorType.LEGGINGS, properties) ); + public static final Item LEATHER_BOOTS = registerItem("leather_boots", properties -> new ArmorItem(ArmorMaterials.LEATHER, ArmorType.BOOTS, properties)); public static final Item CHAINMAIL_HELMET = registerItem( - "chainmail_helmet", new ArmorItem(ArmorMaterials.CHAIN, ArmorItem.Type.HELMET, new Item.Properties().durability(ArmorItem.Type.HELMET.getDurability(15))) + "chainmail_helmet", properties -> new ArmorItem(ArmorMaterials.CHAINMAIL, ArmorType.HELMET, properties), new Item.Properties().rarity(Rarity.UNCOMMON) ); public static final Item CHAINMAIL_CHESTPLATE = registerItem( "chainmail_chestplate", - new ArmorItem(ArmorMaterials.CHAIN, ArmorItem.Type.CHESTPLATE, new Item.Properties().durability(ArmorItem.Type.CHESTPLATE.getDurability(15))) + properties -> new ArmorItem(ArmorMaterials.CHAINMAIL, ArmorType.CHESTPLATE, properties), + new Item.Properties().rarity(Rarity.UNCOMMON) ); public static final Item CHAINMAIL_LEGGINGS = registerItem( - "chainmail_leggings", - new ArmorItem(ArmorMaterials.CHAIN, ArmorItem.Type.LEGGINGS, new Item.Properties().durability(ArmorItem.Type.LEGGINGS.getDurability(15))) + "chainmail_leggings", properties -> new ArmorItem(ArmorMaterials.CHAINMAIL, ArmorType.LEGGINGS, properties), new Item.Properties().rarity(Rarity.UNCOMMON) ); public static final Item CHAINMAIL_BOOTS = registerItem( - "chainmail_boots", new ArmorItem(ArmorMaterials.CHAIN, ArmorItem.Type.BOOTS, new Item.Properties().durability(ArmorItem.Type.BOOTS.getDurability(15))) - ); - public static final Item IRON_HELMET = registerItem( - "iron_helmet", new ArmorItem(ArmorMaterials.IRON, ArmorItem.Type.HELMET, new Item.Properties().durability(ArmorItem.Type.HELMET.getDurability(15))) - ); - public static final Item IRON_CHESTPLATE = registerItem( - "iron_chestplate", - new ArmorItem(ArmorMaterials.IRON, ArmorItem.Type.CHESTPLATE, new Item.Properties().durability(ArmorItem.Type.CHESTPLATE.getDurability(15))) - ); - public static final Item IRON_LEGGINGS = registerItem( - "iron_leggings", new ArmorItem(ArmorMaterials.IRON, ArmorItem.Type.LEGGINGS, new Item.Properties().durability(ArmorItem.Type.LEGGINGS.getDurability(15))) - ); - public static final Item IRON_BOOTS = registerItem( - "iron_boots", new ArmorItem(ArmorMaterials.IRON, ArmorItem.Type.BOOTS, new Item.Properties().durability(ArmorItem.Type.BOOTS.getDurability(15))) - ); - public static final Item DIAMOND_HELMET = registerItem( - "diamond_helmet", new ArmorItem(ArmorMaterials.DIAMOND, ArmorItem.Type.HELMET, new Item.Properties().durability(ArmorItem.Type.HELMET.getDurability(33))) + "chainmail_boots", properties -> new ArmorItem(ArmorMaterials.CHAINMAIL, ArmorType.BOOTS, properties), new Item.Properties().rarity(Rarity.UNCOMMON) ); + public static final Item IRON_HELMET = registerItem("iron_helmet", properties -> new ArmorItem(ArmorMaterials.IRON, ArmorType.HELMET, properties)); + public static final Item IRON_CHESTPLATE = registerItem("iron_chestplate", properties -> new ArmorItem(ArmorMaterials.IRON, ArmorType.CHESTPLATE, properties)); + public static final Item IRON_LEGGINGS = registerItem("iron_leggings", properties -> new ArmorItem(ArmorMaterials.IRON, ArmorType.LEGGINGS, properties)); + public static final Item IRON_BOOTS = registerItem("iron_boots", properties -> new ArmorItem(ArmorMaterials.IRON, ArmorType.BOOTS, properties)); + public static final Item DIAMOND_HELMET = registerItem("diamond_helmet", properties -> new ArmorItem(ArmorMaterials.DIAMOND, ArmorType.HELMET, properties)); public static final Item DIAMOND_CHESTPLATE = registerItem( - "diamond_chestplate", - new ArmorItem(ArmorMaterials.DIAMOND, ArmorItem.Type.CHESTPLATE, new Item.Properties().durability(ArmorItem.Type.CHESTPLATE.getDurability(33))) + "diamond_chestplate", properties -> new ArmorItem(ArmorMaterials.DIAMOND, ArmorType.CHESTPLATE, properties) ); public static final Item DIAMOND_LEGGINGS = registerItem( - "diamond_leggings", - new ArmorItem(ArmorMaterials.DIAMOND, ArmorItem.Type.LEGGINGS, new Item.Properties().durability(ArmorItem.Type.LEGGINGS.getDurability(33))) - ); - public static final Item DIAMOND_BOOTS = registerItem( - "diamond_boots", new ArmorItem(ArmorMaterials.DIAMOND, ArmorItem.Type.BOOTS, new Item.Properties().durability(ArmorItem.Type.BOOTS.getDurability(33))) - ); - public static final Item GOLDEN_HELMET = registerItem( - "golden_helmet", new ArmorItem(ArmorMaterials.GOLD, ArmorItem.Type.HELMET, new Item.Properties().durability(ArmorItem.Type.HELMET.getDurability(7))) + "diamond_leggings", properties -> new ArmorItem(ArmorMaterials.DIAMOND, ArmorType.LEGGINGS, properties) ); + public static final Item DIAMOND_BOOTS = registerItem("diamond_boots", properties -> new ArmorItem(ArmorMaterials.DIAMOND, ArmorType.BOOTS, properties)); + public static final Item GOLDEN_HELMET = registerItem("golden_helmet", properties -> new ArmorItem(ArmorMaterials.GOLD, ArmorType.HELMET, properties)); public static final Item GOLDEN_CHESTPLATE = registerItem( - "golden_chestplate", - new ArmorItem(ArmorMaterials.GOLD, ArmorItem.Type.CHESTPLATE, new Item.Properties().durability(ArmorItem.Type.CHESTPLATE.getDurability(7))) - ); - public static final Item GOLDEN_LEGGINGS = registerItem( - "golden_leggings", new ArmorItem(ArmorMaterials.GOLD, ArmorItem.Type.LEGGINGS, new Item.Properties().durability(ArmorItem.Type.LEGGINGS.getDurability(7))) - ); - public static final Item GOLDEN_BOOTS = registerItem( - "golden_boots", new ArmorItem(ArmorMaterials.GOLD, ArmorItem.Type.BOOTS, new Item.Properties().durability(ArmorItem.Type.BOOTS.getDurability(7))) + "golden_chestplate", properties -> new ArmorItem(ArmorMaterials.GOLD, ArmorType.CHESTPLATE, properties) ); + public static final Item GOLDEN_LEGGINGS = registerItem("golden_leggings", properties -> new ArmorItem(ArmorMaterials.GOLD, ArmorType.LEGGINGS, properties)); + public static final Item GOLDEN_BOOTS = registerItem("golden_boots", properties -> new ArmorItem(ArmorMaterials.GOLD, ArmorType.BOOTS, properties)); public static final Item NETHERITE_HELMET = registerItem( - "netherite_helmet", - new ArmorItem(ArmorMaterials.NETHERITE, ArmorItem.Type.HELMET, new Item.Properties().fireResistant().durability(ArmorItem.Type.HELMET.getDurability(37))) + "netherite_helmet", properties -> new ArmorItem(ArmorMaterials.NETHERITE, ArmorType.HELMET, properties), new Item.Properties().fireResistant() ); public static final Item NETHERITE_CHESTPLATE = registerItem( - "netherite_chestplate", - new ArmorItem( - ArmorMaterials.NETHERITE, ArmorItem.Type.CHESTPLATE, new Item.Properties().fireResistant().durability(ArmorItem.Type.CHESTPLATE.getDurability(37)) - ) + "netherite_chestplate", properties -> new ArmorItem(ArmorMaterials.NETHERITE, ArmorType.CHESTPLATE, properties), new Item.Properties().fireResistant() ); public static final Item NETHERITE_LEGGINGS = registerItem( - "netherite_leggings", - new ArmorItem(ArmorMaterials.NETHERITE, ArmorItem.Type.LEGGINGS, new Item.Properties().fireResistant().durability(ArmorItem.Type.LEGGINGS.getDurability(37))) + "netherite_leggings", properties -> new ArmorItem(ArmorMaterials.NETHERITE, ArmorType.LEGGINGS, properties), new Item.Properties().fireResistant() ); public static final Item NETHERITE_BOOTS = registerItem( - "netherite_boots", - new ArmorItem(ArmorMaterials.NETHERITE, ArmorItem.Type.BOOTS, new Item.Properties().fireResistant().durability(ArmorItem.Type.BOOTS.getDurability(37))) + "netherite_boots", properties -> new ArmorItem(ArmorMaterials.NETHERITE, ArmorType.BOOTS, properties), new Item.Properties().fireResistant() ); - public static final Item FLINT = registerItem("flint", new Item(new Item.Properties())); - public static final Item PORKCHOP = registerItem("porkchop", new Item(new Item.Properties().food(Foods.PORKCHOP))); - public static final Item COOKED_PORKCHOP = registerItem("cooked_porkchop", new Item(new Item.Properties().food(Foods.COOKED_PORKCHOP))); - public static final Item PAINTING = registerItem("painting", new HangingEntityItem(EntityType.PAINTING, new Item.Properties())); - public static final Item GOLDEN_APPLE = registerItem("golden_apple", new Item(new Item.Properties().rarity(Rarity.RARE).food(Foods.GOLDEN_APPLE))); + public static final Item FLINT = registerItem("flint"); + public static final Item PORKCHOP = registerItem("porkchop", new Item.Properties().food(Foods.PORKCHOP)); + public static final Item COOKED_PORKCHOP = registerItem("cooked_porkchop", new Item.Properties().food(Foods.COOKED_PORKCHOP)); + public static final Item PAINTING = registerItem("painting", properties -> new HangingEntityItem(EntityType.PAINTING, properties)); + public static final Item GOLDEN_APPLE = registerItem("golden_apple", new Item.Properties().food(Foods.GOLDEN_APPLE, Consumables.GOLDEN_APPLE)); public static final Item ENCHANTED_GOLDEN_APPLE = registerItem( "enchanted_golden_apple", - new Item(new Item.Properties().rarity(Rarity.EPIC).food(Foods.ENCHANTED_GOLDEN_APPLE).component(DataComponents.ENCHANTMENT_GLINT_OVERRIDE, true)) + new Item.Properties() + .rarity(Rarity.RARE) + .food(Foods.ENCHANTED_GOLDEN_APPLE, Consumables.ENCHANTED_GOLDEN_APPLE) + .component(DataComponents.ENCHANTMENT_GLINT_OVERRIDE, true) ); - public static final Item OAK_SIGN = registerItem("oak_sign", new SignItem(new Item.Properties().stacksTo(16), Blocks.OAK_SIGN, Blocks.OAK_WALL_SIGN)); - public static final Item SPRUCE_SIGN = registerItem( - "spruce_sign", new SignItem(new Item.Properties().stacksTo(16), Blocks.SPRUCE_SIGN, Blocks.SPRUCE_WALL_SIGN) + public static final Item OAK_SIGN = registerBlock( + Blocks.OAK_SIGN, (block, properties) -> new SignItem(block, Blocks.OAK_WALL_SIGN, properties), new Item.Properties().stacksTo(16) ); - public static final Item BIRCH_SIGN = registerItem("birch_sign", new SignItem(new Item.Properties().stacksTo(16), Blocks.BIRCH_SIGN, Blocks.BIRCH_WALL_SIGN)); - public static final Item JUNGLE_SIGN = registerItem( - "jungle_sign", new SignItem(new Item.Properties().stacksTo(16), Blocks.JUNGLE_SIGN, Blocks.JUNGLE_WALL_SIGN) + public static final Item SPRUCE_SIGN = registerBlock( + Blocks.SPRUCE_SIGN, (block, properties) -> new SignItem(block, Blocks.SPRUCE_WALL_SIGN, properties), new Item.Properties().stacksTo(16) ); - public static final Item ACACIA_SIGN = registerItem( - "acacia_sign", new SignItem(new Item.Properties().stacksTo(16), Blocks.ACACIA_SIGN, Blocks.ACACIA_WALL_SIGN) + public static final Item BIRCH_SIGN = registerBlock( + Blocks.BIRCH_SIGN, (block, properties) -> new SignItem(block, Blocks.BIRCH_WALL_SIGN, properties), new Item.Properties().stacksTo(16) ); - public static final Item CHERRY_SIGN = registerItem( - "cherry_sign", new SignItem(new Item.Properties().stacksTo(16), Blocks.CHERRY_SIGN, Blocks.CHERRY_WALL_SIGN) + public static final Item JUNGLE_SIGN = registerBlock( + Blocks.JUNGLE_SIGN, (block, properties) -> new SignItem(block, Blocks.JUNGLE_WALL_SIGN, properties), new Item.Properties().stacksTo(16) ); - public static final Item DARK_OAK_SIGN = registerItem( - "dark_oak_sign", new SignItem(new Item.Properties().stacksTo(16), Blocks.DARK_OAK_SIGN, Blocks.DARK_OAK_WALL_SIGN) + public static final Item ACACIA_SIGN = registerBlock( + Blocks.ACACIA_SIGN, (block, properties) -> new SignItem(block, Blocks.ACACIA_WALL_SIGN, properties), new Item.Properties().stacksTo(16) ); - public static final Item MANGROVE_SIGN = registerItem( - "mangrove_sign", new SignItem(new Item.Properties().stacksTo(16), Blocks.MANGROVE_SIGN, Blocks.MANGROVE_WALL_SIGN) + public static final Item CHERRY_SIGN = registerBlock( + Blocks.CHERRY_SIGN, (block, properties) -> new SignItem(block, Blocks.CHERRY_WALL_SIGN, properties), new Item.Properties().stacksTo(16) ); - public static final Item BAMBOO_SIGN = registerItem( - "bamboo_sign", new SignItem(new Item.Properties().stacksTo(16), Blocks.BAMBOO_SIGN, Blocks.BAMBOO_WALL_SIGN) + public static final Item DARK_OAK_SIGN = registerBlock( + Blocks.DARK_OAK_SIGN, (block, properties) -> new SignItem(block, Blocks.DARK_OAK_WALL_SIGN, properties), new Item.Properties().stacksTo(16) ); - public static final Item CRIMSON_SIGN = registerItem( - "crimson_sign", new SignItem(new Item.Properties().stacksTo(16), Blocks.CRIMSON_SIGN, Blocks.CRIMSON_WALL_SIGN) + public static final Item PALE_OAK_SIGN = registerBlock( + Blocks.PALE_OAK_SIGN, (block, properties) -> new SignItem(block, Blocks.PALE_OAK_WALL_SIGN, properties), new Item.Properties().stacksTo(16) ); - public static final Item WARPED_SIGN = registerItem( - "warped_sign", new SignItem(new Item.Properties().stacksTo(16), Blocks.WARPED_SIGN, Blocks.WARPED_WALL_SIGN) + public static final Item MANGROVE_SIGN = registerBlock( + Blocks.MANGROVE_SIGN, (block, properties) -> new SignItem(block, Blocks.MANGROVE_WALL_SIGN, properties), new Item.Properties().stacksTo(16) ); - public static final Item OAK_HANGING_SIGN = registerItem( - "oak_hanging_sign", new HangingSignItem(Blocks.OAK_HANGING_SIGN, Blocks.OAK_WALL_HANGING_SIGN, new Item.Properties().stacksTo(16)) + public static final Item BAMBOO_SIGN = registerBlock( + Blocks.BAMBOO_SIGN, (block, properties) -> new SignItem(block, Blocks.BAMBOO_WALL_SIGN, properties), new Item.Properties().stacksTo(16) ); - public static final Item SPRUCE_HANGING_SIGN = registerItem( - "spruce_hanging_sign", new HangingSignItem(Blocks.SPRUCE_HANGING_SIGN, Blocks.SPRUCE_WALL_HANGING_SIGN, new Item.Properties().stacksTo(16)) + public static final Item CRIMSON_SIGN = registerBlock( + Blocks.CRIMSON_SIGN, (block, properties) -> new SignItem(block, Blocks.CRIMSON_WALL_SIGN, properties), new Item.Properties().stacksTo(16) ); - public static final Item BIRCH_HANGING_SIGN = registerItem( - "birch_hanging_sign", new HangingSignItem(Blocks.BIRCH_HANGING_SIGN, Blocks.BIRCH_WALL_HANGING_SIGN, new Item.Properties().stacksTo(16)) + public static final Item WARPED_SIGN = registerBlock( + Blocks.WARPED_SIGN, (block, properties) -> new SignItem(block, Blocks.WARPED_WALL_SIGN, properties), new Item.Properties().stacksTo(16) ); - public static final Item JUNGLE_HANGING_SIGN = registerItem( - "jungle_hanging_sign", new HangingSignItem(Blocks.JUNGLE_HANGING_SIGN, Blocks.JUNGLE_WALL_HANGING_SIGN, new Item.Properties().stacksTo(16)) + public static final Item OAK_HANGING_SIGN = registerBlock( + Blocks.OAK_HANGING_SIGN, (block, properties) -> new HangingSignItem(block, Blocks.OAK_WALL_HANGING_SIGN, properties), new Item.Properties().stacksTo(16) ); - public static final Item ACACIA_HANGING_SIGN = registerItem( - "acacia_hanging_sign", new HangingSignItem(Blocks.ACACIA_HANGING_SIGN, Blocks.ACACIA_WALL_HANGING_SIGN, new Item.Properties().stacksTo(16)) + public static final Item SPRUCE_HANGING_SIGN = registerBlock( + Blocks.SPRUCE_HANGING_SIGN, + (block, properties) -> new HangingSignItem(block, Blocks.SPRUCE_WALL_HANGING_SIGN, properties), + new Item.Properties().stacksTo(16) ); - public static final Item CHERRY_HANGING_SIGN = registerItem( - "cherry_hanging_sign", new HangingSignItem(Blocks.CHERRY_HANGING_SIGN, Blocks.CHERRY_WALL_HANGING_SIGN, new Item.Properties().stacksTo(16)) + public static final Item BIRCH_HANGING_SIGN = registerBlock( + Blocks.BIRCH_HANGING_SIGN, (block, properties) -> new HangingSignItem(block, Blocks.BIRCH_WALL_HANGING_SIGN, properties), new Item.Properties().stacksTo(16) ); - public static final Item DARK_OAK_HANGING_SIGN = registerItem( - "dark_oak_hanging_sign", new HangingSignItem(Blocks.DARK_OAK_HANGING_SIGN, Blocks.DARK_OAK_WALL_HANGING_SIGN, new Item.Properties().stacksTo(16)) + public static final Item JUNGLE_HANGING_SIGN = registerBlock( + Blocks.JUNGLE_HANGING_SIGN, + (block, properties) -> new HangingSignItem(block, Blocks.JUNGLE_WALL_HANGING_SIGN, properties), + new Item.Properties().stacksTo(16) ); - public static final Item MANGROVE_HANGING_SIGN = registerItem( - "mangrove_hanging_sign", new HangingSignItem(Blocks.MANGROVE_HANGING_SIGN, Blocks.MANGROVE_WALL_HANGING_SIGN, new Item.Properties().stacksTo(16)) + public static final Item ACACIA_HANGING_SIGN = registerBlock( + Blocks.ACACIA_HANGING_SIGN, + (block, properties) -> new HangingSignItem(block, Blocks.ACACIA_WALL_HANGING_SIGN, properties), + new Item.Properties().stacksTo(16) ); - public static final Item BAMBOO_HANGING_SIGN = registerItem( - "bamboo_hanging_sign", new HangingSignItem(Blocks.BAMBOO_HANGING_SIGN, Blocks.BAMBOO_WALL_HANGING_SIGN, new Item.Properties().stacksTo(16)) + public static final Item CHERRY_HANGING_SIGN = registerBlock( + Blocks.CHERRY_HANGING_SIGN, + (block, properties) -> new HangingSignItem(block, Blocks.CHERRY_WALL_HANGING_SIGN, properties), + new Item.Properties().stacksTo(16) ); - public static final Item CRIMSON_HANGING_SIGN = registerItem( - "crimson_hanging_sign", new HangingSignItem(Blocks.CRIMSON_HANGING_SIGN, Blocks.CRIMSON_WALL_HANGING_SIGN, new Item.Properties().stacksTo(16)) + public static final Item DARK_OAK_HANGING_SIGN = registerBlock( + Blocks.DARK_OAK_HANGING_SIGN, + (block, properties) -> new HangingSignItem(block, Blocks.DARK_OAK_WALL_HANGING_SIGN, properties), + new Item.Properties().stacksTo(16) ); - public static final Item WARPED_HANGING_SIGN = registerItem( - "warped_hanging_sign", new HangingSignItem(Blocks.WARPED_HANGING_SIGN, Blocks.WARPED_WALL_HANGING_SIGN, new Item.Properties().stacksTo(16)) + public static final Item PALE_OAK_HANGING_SIGN = registerBlock( + Blocks.PALE_OAK_HANGING_SIGN, + (block, properties) -> new HangingSignItem(block, Blocks.PALE_OAK_WALL_HANGING_SIGN, properties), + new Item.Properties().stacksTo(16) + ); + public static final Item MANGROVE_HANGING_SIGN = registerBlock( + Blocks.MANGROVE_HANGING_SIGN, + (block, properties) -> new HangingSignItem(block, Blocks.MANGROVE_WALL_HANGING_SIGN, properties), + new Item.Properties().stacksTo(16) + ); + public static final Item BAMBOO_HANGING_SIGN = registerBlock( + Blocks.BAMBOO_HANGING_SIGN, + (block, properties) -> new HangingSignItem(block, Blocks.BAMBOO_WALL_HANGING_SIGN, properties), + new Item.Properties().stacksTo(16) + ); + public static final Item CRIMSON_HANGING_SIGN = registerBlock( + Blocks.CRIMSON_HANGING_SIGN, + (block, properties) -> new HangingSignItem(block, Blocks.CRIMSON_WALL_HANGING_SIGN, properties), + new Item.Properties().stacksTo(16) + ); + public static final Item WARPED_HANGING_SIGN = registerBlock( + Blocks.WARPED_HANGING_SIGN, + (block, properties) -> new HangingSignItem(block, Blocks.WARPED_WALL_HANGING_SIGN, properties), + new Item.Properties().stacksTo(16) + ); + public static final Item BUCKET = registerItem("bucket", properties -> new BucketItem(Fluids.EMPTY, properties), new Item.Properties().stacksTo(16)); + public static final Item WATER_BUCKET = registerItem( + "water_bucket", properties -> new BucketItem(Fluids.WATER, properties), new Item.Properties().craftRemainder(BUCKET).stacksTo(1) + ); + public static final Item LAVA_BUCKET = registerItem( + "lava_bucket", properties -> new BucketItem(Fluids.LAVA, properties), new Item.Properties().craftRemainder(BUCKET).stacksTo(1) ); - public static final Item BUCKET = registerItem("bucket", new BucketItem(Fluids.EMPTY, new Item.Properties().stacksTo(16))); - public static final Item WATER_BUCKET = registerItem("water_bucket", new BucketItem(Fluids.WATER, new Item.Properties().craftRemainder(BUCKET).stacksTo(1))); - public static final Item LAVA_BUCKET = registerItem("lava_bucket", new BucketItem(Fluids.LAVA, new Item.Properties().craftRemainder(BUCKET).stacksTo(1))); public static final Item POWDER_SNOW_BUCKET = registerItem( - "powder_snow_bucket", new SolidBucketItem(Blocks.POWDER_SNOW, SoundEvents.BUCKET_EMPTY_POWDER_SNOW, new Item.Properties().stacksTo(1)) + "powder_snow_bucket", + properties -> new SolidBucketItem(Blocks.POWDER_SNOW, SoundEvents.BUCKET_EMPTY_POWDER_SNOW, properties), + new Item.Properties().stacksTo(1).useItemDescriptionPrefix() + ); + public static final Item SNOWBALL = registerItem("snowball", SnowballItem::new, new Item.Properties().stacksTo(16)); + public static final Item LEATHER = registerItem("leather"); + public static final Item MILK_BUCKET = registerItem( + "milk_bucket", new Item.Properties().craftRemainder(BUCKET).component(DataComponents.CONSUMABLE, Consumables.MILK_BUCKET).usingConvertsTo(BUCKET).stacksTo(1) ); - public static final Item SNOWBALL = registerItem("snowball", new SnowballItem(new Item.Properties().stacksTo(16))); - public static final Item LEATHER = registerItem("leather", new Item(new Item.Properties())); - public static final Item MILK_BUCKET = registerItem("milk_bucket", new MilkBucketItem(new Item.Properties().craftRemainder(BUCKET).stacksTo(1))); public static final Item PUFFERFISH_BUCKET = registerItem( "pufferfish_bucket", - new MobBucketItem( - EntityType.PUFFERFISH, - Fluids.WATER, - SoundEvents.BUCKET_EMPTY_FISH, - new Item.Properties().stacksTo(1).component(DataComponents.BUCKET_ENTITY_DATA, CustomData.EMPTY) - ) + properties -> new MobBucketItem(EntityType.PUFFERFISH, Fluids.WATER, SoundEvents.BUCKET_EMPTY_FISH, properties), + new Item.Properties().stacksTo(1).component(DataComponents.BUCKET_ENTITY_DATA, CustomData.EMPTY) ); public static final Item SALMON_BUCKET = registerItem( "salmon_bucket", - new MobBucketItem( - EntityType.SALMON, - Fluids.WATER, - SoundEvents.BUCKET_EMPTY_FISH, - new Item.Properties().stacksTo(1).component(DataComponents.BUCKET_ENTITY_DATA, CustomData.EMPTY) - ) + properties -> new MobBucketItem(EntityType.SALMON, Fluids.WATER, SoundEvents.BUCKET_EMPTY_FISH, properties), + new Item.Properties().stacksTo(1).component(DataComponents.BUCKET_ENTITY_DATA, CustomData.EMPTY) ); public static final Item COD_BUCKET = registerItem( "cod_bucket", - new MobBucketItem( - EntityType.COD, - Fluids.WATER, - SoundEvents.BUCKET_EMPTY_FISH, - new Item.Properties().stacksTo(1).component(DataComponents.BUCKET_ENTITY_DATA, CustomData.EMPTY) - ) + properties -> new MobBucketItem(EntityType.COD, Fluids.WATER, SoundEvents.BUCKET_EMPTY_FISH, properties), + new Item.Properties().stacksTo(1).component(DataComponents.BUCKET_ENTITY_DATA, CustomData.EMPTY) ); public static final Item TROPICAL_FISH_BUCKET = registerItem( "tropical_fish_bucket", - new MobBucketItem( - EntityType.TROPICAL_FISH, - Fluids.WATER, - SoundEvents.BUCKET_EMPTY_FISH, - new Item.Properties().stacksTo(1).component(DataComponents.BUCKET_ENTITY_DATA, CustomData.EMPTY) - ) + properties -> new MobBucketItem(EntityType.TROPICAL_FISH, Fluids.WATER, SoundEvents.BUCKET_EMPTY_FISH, properties), + new Item.Properties().stacksTo(1).component(DataComponents.BUCKET_ENTITY_DATA, CustomData.EMPTY) ); public static final Item AXOLOTL_BUCKET = registerItem( "axolotl_bucket", - new MobBucketItem( - EntityType.AXOLOTL, - Fluids.WATER, - SoundEvents.BUCKET_EMPTY_AXOLOTL, - new Item.Properties().stacksTo(1).component(DataComponents.BUCKET_ENTITY_DATA, CustomData.EMPTY) - ) + properties -> new MobBucketItem(EntityType.AXOLOTL, Fluids.WATER, SoundEvents.BUCKET_EMPTY_AXOLOTL, properties), + new Item.Properties().stacksTo(1).component(DataComponents.BUCKET_ENTITY_DATA, CustomData.EMPTY) ); public static final Item TADPOLE_BUCKET = registerItem( "tadpole_bucket", - new MobBucketItem( - EntityType.TADPOLE, - Fluids.WATER, - SoundEvents.BUCKET_EMPTY_TADPOLE, - new Item.Properties().stacksTo(1).component(DataComponents.BUCKET_ENTITY_DATA, CustomData.EMPTY) - ) + properties -> new MobBucketItem(EntityType.TADPOLE, Fluids.WATER, SoundEvents.BUCKET_EMPTY_TADPOLE, properties), + new Item.Properties().stacksTo(1).component(DataComponents.BUCKET_ENTITY_DATA, CustomData.EMPTY) ); - public static final Item BRICK = registerItem("brick", new Item(new Item.Properties())); - public static final Item CLAY_BALL = registerItem("clay_ball", new Item(new Item.Properties())); + public static final Item BRICK = registerItem("brick"); + public static final Item CLAY_BALL = registerItem("clay_ball"); public static final Item DRIED_KELP_BLOCK = registerBlock(Blocks.DRIED_KELP_BLOCK); - public static final Item PAPER = registerItem("paper", new Item(new Item.Properties())); - public static final Item BOOK = registerItem("book", new BookItem(new Item.Properties())); - public static final Item SLIME_BALL = registerItem("slime_ball", new Item(new Item.Properties())); - public static final Item EGG = registerItem("egg", new EggItem(new Item.Properties().stacksTo(16))); - public static final Item COMPASS = registerItem("compass", new CompassItem(new Item.Properties())); - public static final Item RECOVERY_COMPASS = registerItem("recovery_compass", new Item(new Item.Properties())); + public static final Item PAPER = registerItem("paper"); + public static final Item BOOK = registerItem("book", new Item.Properties().enchantable(1)); + public static final Item SLIME_BALL = registerItem("slime_ball"); + public static final Item EGG = registerItem("egg", EggItem::new, new Item.Properties().stacksTo(16)); + public static final Item COMPASS = registerItem("compass", CompassItem::new); + public static final Item RECOVERY_COMPASS = registerItem("recovery_compass", new Item.Properties().rarity(Rarity.UNCOMMON)); public static final Item BUNDLE = registerItem( - "bundle", new BundleItem(new Item.Properties().stacksTo(1).component(DataComponents.BUNDLE_CONTENTS, BundleContents.EMPTY)) + "bundle", + properties -> new BundleItem( + ResourceLocation.withDefaultNamespace("bundle_open_front"), ResourceLocation.withDefaultNamespace("bundle_open_back"), properties + ), + new Item.Properties().stacksTo(1).component(DataComponents.BUNDLE_CONTENTS, BundleContents.EMPTY) + ); + public static final Item WHITE_BUNDLE = registerItem( + "white_bundle", + properties -> new BundleItem( + ResourceLocation.withDefaultNamespace("white_bundle_open_front"), ResourceLocation.withDefaultNamespace("white_bundle_open_back"), properties + ), + new Item.Properties().stacksTo(1).component(DataComponents.BUNDLE_CONTENTS, BundleContents.EMPTY) + ); + public static final Item ORANGE_BUNDLE = registerItem( + "orange_bundle", + properties -> new BundleItem( + ResourceLocation.withDefaultNamespace("orange_bundle_open_front"), ResourceLocation.withDefaultNamespace("orange_bundle_open_back"), properties + ), + new Item.Properties().stacksTo(1).component(DataComponents.BUNDLE_CONTENTS, BundleContents.EMPTY) + ); + public static final Item MAGENTA_BUNDLE = registerItem( + "magenta_bundle", + properties -> new BundleItem( + ResourceLocation.withDefaultNamespace("magenta_bundle_open_front"), ResourceLocation.withDefaultNamespace("magenta_bundle_open_back"), properties + ), + new Item.Properties().stacksTo(1).component(DataComponents.BUNDLE_CONTENTS, BundleContents.EMPTY) + ); + public static final Item LIGHT_BLUE_BUNDLE = registerItem( + "light_blue_bundle", + properties -> new BundleItem( + ResourceLocation.withDefaultNamespace("light_blue_bundle_open_front"), ResourceLocation.withDefaultNamespace("light_blue_bundle_open_back"), properties + ), + new Item.Properties().stacksTo(1).component(DataComponents.BUNDLE_CONTENTS, BundleContents.EMPTY) + ); + public static final Item YELLOW_BUNDLE = registerItem( + "yellow_bundle", + properties -> new BundleItem( + ResourceLocation.withDefaultNamespace("yellow_bundle_open_front"), ResourceLocation.withDefaultNamespace("yellow_bundle_open_back"), properties + ), + new Item.Properties().stacksTo(1).component(DataComponents.BUNDLE_CONTENTS, BundleContents.EMPTY) + ); + public static final Item LIME_BUNDLE = registerItem( + "lime_bundle", + properties -> new BundleItem( + ResourceLocation.withDefaultNamespace("lime_bundle_open_front"), ResourceLocation.withDefaultNamespace("lime_bundle_open_back"), properties + ), + new Item.Properties().stacksTo(1).component(DataComponents.BUNDLE_CONTENTS, BundleContents.EMPTY) + ); + public static final Item PINK_BUNDLE = registerItem( + "pink_bundle", + properties -> new BundleItem( + ResourceLocation.withDefaultNamespace("pink_bundle_open_front"), ResourceLocation.withDefaultNamespace("pink_bundle_open_back"), properties + ), + new Item.Properties().stacksTo(1).component(DataComponents.BUNDLE_CONTENTS, BundleContents.EMPTY) + ); + public static final Item GRAY_BUNDLE = registerItem( + "gray_bundle", + properties -> new BundleItem( + ResourceLocation.withDefaultNamespace("gray_bundle_open_front"), ResourceLocation.withDefaultNamespace("gray_bundle_open_back"), properties + ), + new Item.Properties().stacksTo(1).component(DataComponents.BUNDLE_CONTENTS, BundleContents.EMPTY) + ); + public static final Item LIGHT_GRAY_BUNDLE = registerItem( + "light_gray_bundle", + properties -> new BundleItem( + ResourceLocation.withDefaultNamespace("light_gray_bundle_open_front"), ResourceLocation.withDefaultNamespace("light_gray_bundle_open_back"), properties + ), + new Item.Properties().stacksTo(1).component(DataComponents.BUNDLE_CONTENTS, BundleContents.EMPTY) + ); + public static final Item CYAN_BUNDLE = registerItem( + "cyan_bundle", + properties -> new BundleItem( + ResourceLocation.withDefaultNamespace("cyan_bundle_open_front"), ResourceLocation.withDefaultNamespace("cyan_bundle_open_back"), properties + ), + new Item.Properties().stacksTo(1).component(DataComponents.BUNDLE_CONTENTS, BundleContents.EMPTY) + ); + public static final Item PURPLE_BUNDLE = registerItem( + "purple_bundle", + properties -> new BundleItem( + ResourceLocation.withDefaultNamespace("purple_bundle_open_front"), ResourceLocation.withDefaultNamespace("purple_bundle_open_back"), properties + ), + new Item.Properties().stacksTo(1).component(DataComponents.BUNDLE_CONTENTS, BundleContents.EMPTY) + ); + public static final Item BLUE_BUNDLE = registerItem( + "blue_bundle", + properties -> new BundleItem( + ResourceLocation.withDefaultNamespace("blue_bundle_open_front"), ResourceLocation.withDefaultNamespace("blue_bundle_open_back"), properties + ), + new Item.Properties().stacksTo(1).component(DataComponents.BUNDLE_CONTENTS, BundleContents.EMPTY) + ); + public static final Item BROWN_BUNDLE = registerItem( + "brown_bundle", + properties -> new BundleItem( + ResourceLocation.withDefaultNamespace("brown_bundle_open_front"), ResourceLocation.withDefaultNamespace("brown_bundle_open_back"), properties + ), + new Item.Properties().stacksTo(1).component(DataComponents.BUNDLE_CONTENTS, BundleContents.EMPTY) + ); + public static final Item GREEN_BUNDLE = registerItem( + "green_bundle", + properties -> new BundleItem( + ResourceLocation.withDefaultNamespace("green_bundle_open_front"), ResourceLocation.withDefaultNamespace("green_bundle_open_back"), properties + ), + new Item.Properties().stacksTo(1).component(DataComponents.BUNDLE_CONTENTS, BundleContents.EMPTY) + ); + public static final Item RED_BUNDLE = registerItem( + "red_bundle", + properties -> new BundleItem( + ResourceLocation.withDefaultNamespace("red_bundle_open_front"), ResourceLocation.withDefaultNamespace("red_bundle_open_back"), properties + ), + new Item.Properties().stacksTo(1).component(DataComponents.BUNDLE_CONTENTS, BundleContents.EMPTY) + ); + public static final Item BLACK_BUNDLE = registerItem( + "black_bundle", + properties -> new BundleItem( + ResourceLocation.withDefaultNamespace("black_bundle_open_front"), ResourceLocation.withDefaultNamespace("black_bundle_open_back"), properties + ), + new Item.Properties().stacksTo(1).component(DataComponents.BUNDLE_CONTENTS, BundleContents.EMPTY) + ); + public static final Item FISHING_ROD = registerItem("fishing_rod", FishingRodItem::new, new Item.Properties().durability(64).enchantable(1)); + public static final Item CLOCK = registerItem("clock"); + public static final Item SPYGLASS = registerItem( + "spyglass", SpyglassItem::new, new Item.Properties().stacksTo(1).overrideModel(ResourceLocation.withDefaultNamespace("spyglass_in_hand")) + ); + public static final Item GLOWSTONE_DUST = registerItem("glowstone_dust"); + public static final Item COD = registerItem("cod", new Item.Properties().food(Foods.COD)); + public static final Item SALMON = registerItem("salmon", new Item.Properties().food(Foods.SALMON)); + public static final Item TROPICAL_FISH = registerItem("tropical_fish", new Item.Properties().food(Foods.TROPICAL_FISH)); + public static final Item PUFFERFISH = registerItem("pufferfish", new Item.Properties().food(Foods.PUFFERFISH, Consumables.PUFFERFISH)); + public static final Item COOKED_COD = registerItem("cooked_cod", new Item.Properties().food(Foods.COOKED_COD)); + public static final Item COOKED_SALMON = registerItem("cooked_salmon", new Item.Properties().food(Foods.COOKED_SALMON)); + public static final Item INK_SAC = registerItem("ink_sac", InkSacItem::new); + public static final Item GLOW_INK_SAC = registerItem("glow_ink_sac", GlowInkSacItem::new); + public static final Item COCOA_BEANS = registerItem("cocoa_beans", createBlockItemWithCustomItemName(Blocks.COCOA)); + public static final Item WHITE_DYE = registerItem("white_dye", properties -> new DyeItem(DyeColor.WHITE, properties)); + public static final Item ORANGE_DYE = registerItem("orange_dye", properties -> new DyeItem(DyeColor.ORANGE, properties)); + public static final Item MAGENTA_DYE = registerItem("magenta_dye", properties -> new DyeItem(DyeColor.MAGENTA, properties)); + public static final Item LIGHT_BLUE_DYE = registerItem("light_blue_dye", properties -> new DyeItem(DyeColor.LIGHT_BLUE, properties)); + public static final Item YELLOW_DYE = registerItem("yellow_dye", properties -> new DyeItem(DyeColor.YELLOW, properties)); + public static final Item LIME_DYE = registerItem("lime_dye", properties -> new DyeItem(DyeColor.LIME, properties)); + public static final Item PINK_DYE = registerItem("pink_dye", properties -> new DyeItem(DyeColor.PINK, properties)); + public static final Item GRAY_DYE = registerItem("gray_dye", properties -> new DyeItem(DyeColor.GRAY, properties)); + public static final Item LIGHT_GRAY_DYE = registerItem("light_gray_dye", properties -> new DyeItem(DyeColor.LIGHT_GRAY, properties)); + public static final Item CYAN_DYE = registerItem("cyan_dye", properties -> new DyeItem(DyeColor.CYAN, properties)); + public static final Item PURPLE_DYE = registerItem("purple_dye", properties -> new DyeItem(DyeColor.PURPLE, properties)); + public static final Item BLUE_DYE = registerItem("blue_dye", properties -> new DyeItem(DyeColor.BLUE, properties)); + public static final Item BROWN_DYE = registerItem("brown_dye", properties -> new DyeItem(DyeColor.BROWN, properties)); + public static final Item GREEN_DYE = registerItem("green_dye", properties -> new DyeItem(DyeColor.GREEN, properties)); + public static final Item RED_DYE = registerItem("red_dye", properties -> new DyeItem(DyeColor.RED, properties)); + public static final Item BLACK_DYE = registerItem("black_dye", properties -> new DyeItem(DyeColor.BLACK, properties)); + public static final Item BONE_MEAL = registerItem("bone_meal", BoneMealItem::new); + public static final Item BONE = registerItem("bone"); + public static final Item SUGAR = registerItem("sugar"); + public static final Item CAKE = registerBlock(Blocks.CAKE, new Item.Properties().stacksTo(1)); + public static final Item WHITE_BED = registerBlock(Blocks.WHITE_BED, BedItem::new, new Item.Properties().stacksTo(1)); + public static final Item ORANGE_BED = registerBlock(Blocks.ORANGE_BED, BedItem::new, new Item.Properties().stacksTo(1)); + public static final Item MAGENTA_BED = registerBlock(Blocks.MAGENTA_BED, BedItem::new, new Item.Properties().stacksTo(1)); + public static final Item LIGHT_BLUE_BED = registerBlock(Blocks.LIGHT_BLUE_BED, BedItem::new, new Item.Properties().stacksTo(1)); + public static final Item YELLOW_BED = registerBlock(Blocks.YELLOW_BED, BedItem::new, new Item.Properties().stacksTo(1)); + public static final Item LIME_BED = registerBlock(Blocks.LIME_BED, BedItem::new, new Item.Properties().stacksTo(1)); + public static final Item PINK_BED = registerBlock(Blocks.PINK_BED, BedItem::new, new Item.Properties().stacksTo(1)); + public static final Item GRAY_BED = registerBlock(Blocks.GRAY_BED, BedItem::new, new Item.Properties().stacksTo(1)); + public static final Item LIGHT_GRAY_BED = registerBlock(Blocks.LIGHT_GRAY_BED, BedItem::new, new Item.Properties().stacksTo(1)); + public static final Item CYAN_BED = registerBlock(Blocks.CYAN_BED, BedItem::new, new Item.Properties().stacksTo(1)); + public static final Item PURPLE_BED = registerBlock(Blocks.PURPLE_BED, BedItem::new, new Item.Properties().stacksTo(1)); + public static final Item BLUE_BED = registerBlock(Blocks.BLUE_BED, BedItem::new, new Item.Properties().stacksTo(1)); + public static final Item BROWN_BED = registerBlock(Blocks.BROWN_BED, BedItem::new, new Item.Properties().stacksTo(1)); + public static final Item GREEN_BED = registerBlock(Blocks.GREEN_BED, BedItem::new, new Item.Properties().stacksTo(1)); + public static final Item RED_BED = registerBlock(Blocks.RED_BED, BedItem::new, new Item.Properties().stacksTo(1)); + public static final Item BLACK_BED = registerBlock(Blocks.BLACK_BED, BedItem::new, new Item.Properties().stacksTo(1)); + public static final Item COOKIE = registerItem("cookie", new Item.Properties().food(Foods.COOKIE)); + public static final Item CRAFTER = registerBlock( + Blocks.CRAFTER, (UnaryOperator)(properties -> properties.component(DataComponents.CONTAINER, ItemContainerContents.EMPTY)) ); - public static final Item FISHING_ROD = registerItem("fishing_rod", new FishingRodItem(new Item.Properties().durability(64))); - public static final Item CLOCK = registerItem("clock", new Item(new Item.Properties())); - public static final Item SPYGLASS = registerItem("spyglass", new SpyglassItem(new Item.Properties().stacksTo(1))); - public static final Item GLOWSTONE_DUST = registerItem("glowstone_dust", new Item(new Item.Properties())); - public static final Item COD = registerItem("cod", new Item(new Item.Properties().food(Foods.COD))); - public static final Item SALMON = registerItem("salmon", new Item(new Item.Properties().food(Foods.SALMON))); - public static final Item TROPICAL_FISH = registerItem("tropical_fish", new Item(new Item.Properties().food(Foods.TROPICAL_FISH))); - public static final Item PUFFERFISH = registerItem("pufferfish", new Item(new Item.Properties().food(Foods.PUFFERFISH))); - public static final Item COOKED_COD = registerItem("cooked_cod", new Item(new Item.Properties().food(Foods.COOKED_COD))); - public static final Item COOKED_SALMON = registerItem("cooked_salmon", new Item(new Item.Properties().food(Foods.COOKED_SALMON))); - public static final Item INK_SAC = registerItem("ink_sac", new InkSacItem(new Item.Properties())); - public static final Item GLOW_INK_SAC = registerItem("glow_ink_sac", new GlowInkSacItem(new Item.Properties())); - public static final Item COCOA_BEANS = registerItem("cocoa_beans", new ItemNameBlockItem(Blocks.COCOA, new Item.Properties())); - public static final Item WHITE_DYE = registerItem("white_dye", new DyeItem(DyeColor.WHITE, new Item.Properties())); - public static final Item ORANGE_DYE = registerItem("orange_dye", new DyeItem(DyeColor.ORANGE, new Item.Properties())); - public static final Item MAGENTA_DYE = registerItem("magenta_dye", new DyeItem(DyeColor.MAGENTA, new Item.Properties())); - public static final Item LIGHT_BLUE_DYE = registerItem("light_blue_dye", new DyeItem(DyeColor.LIGHT_BLUE, new Item.Properties())); - public static final Item YELLOW_DYE = registerItem("yellow_dye", new DyeItem(DyeColor.YELLOW, new Item.Properties())); - public static final Item LIME_DYE = registerItem("lime_dye", new DyeItem(DyeColor.LIME, new Item.Properties())); - public static final Item PINK_DYE = registerItem("pink_dye", new DyeItem(DyeColor.PINK, new Item.Properties())); - public static final Item GRAY_DYE = registerItem("gray_dye", new DyeItem(DyeColor.GRAY, new Item.Properties())); - public static final Item LIGHT_GRAY_DYE = registerItem("light_gray_dye", new DyeItem(DyeColor.LIGHT_GRAY, new Item.Properties())); - public static final Item CYAN_DYE = registerItem("cyan_dye", new DyeItem(DyeColor.CYAN, new Item.Properties())); - public static final Item PURPLE_DYE = registerItem("purple_dye", new DyeItem(DyeColor.PURPLE, new Item.Properties())); - public static final Item BLUE_DYE = registerItem("blue_dye", new DyeItem(DyeColor.BLUE, new Item.Properties())); - public static final Item BROWN_DYE = registerItem("brown_dye", new DyeItem(DyeColor.BROWN, new Item.Properties())); - public static final Item GREEN_DYE = registerItem("green_dye", new DyeItem(DyeColor.GREEN, new Item.Properties())); - public static final Item RED_DYE = registerItem("red_dye", new DyeItem(DyeColor.RED, new Item.Properties())); - public static final Item BLACK_DYE = registerItem("black_dye", new DyeItem(DyeColor.BLACK, new Item.Properties())); - public static final Item BONE_MEAL = registerItem("bone_meal", new BoneMealItem(new Item.Properties())); - public static final Item BONE = registerItem("bone", new Item(new Item.Properties())); - public static final Item SUGAR = registerItem("sugar", new Item(new Item.Properties())); - public static final Item CAKE = registerBlock(new BlockItem(Blocks.CAKE, new Item.Properties().stacksTo(1))); - public static final Item WHITE_BED = registerBlock(new BedItem(Blocks.WHITE_BED, new Item.Properties().stacksTo(1))); - public static final Item ORANGE_BED = registerBlock(new BedItem(Blocks.ORANGE_BED, new Item.Properties().stacksTo(1))); - public static final Item MAGENTA_BED = registerBlock(new BedItem(Blocks.MAGENTA_BED, new Item.Properties().stacksTo(1))); - public static final Item LIGHT_BLUE_BED = registerBlock(new BedItem(Blocks.LIGHT_BLUE_BED, new Item.Properties().stacksTo(1))); - public static final Item YELLOW_BED = registerBlock(new BedItem(Blocks.YELLOW_BED, new Item.Properties().stacksTo(1))); - public static final Item LIME_BED = registerBlock(new BedItem(Blocks.LIME_BED, new Item.Properties().stacksTo(1))); - public static final Item PINK_BED = registerBlock(new BedItem(Blocks.PINK_BED, new Item.Properties().stacksTo(1))); - public static final Item GRAY_BED = registerBlock(new BedItem(Blocks.GRAY_BED, new Item.Properties().stacksTo(1))); - public static final Item LIGHT_GRAY_BED = registerBlock(new BedItem(Blocks.LIGHT_GRAY_BED, new Item.Properties().stacksTo(1))); - public static final Item CYAN_BED = registerBlock(new BedItem(Blocks.CYAN_BED, new Item.Properties().stacksTo(1))); - public static final Item PURPLE_BED = registerBlock(new BedItem(Blocks.PURPLE_BED, new Item.Properties().stacksTo(1))); - public static final Item BLUE_BED = registerBlock(new BedItem(Blocks.BLUE_BED, new Item.Properties().stacksTo(1))); - public static final Item BROWN_BED = registerBlock(new BedItem(Blocks.BROWN_BED, new Item.Properties().stacksTo(1))); - public static final Item GREEN_BED = registerBlock(new BedItem(Blocks.GREEN_BED, new Item.Properties().stacksTo(1))); - public static final Item RED_BED = registerBlock(new BedItem(Blocks.RED_BED, new Item.Properties().stacksTo(1))); - public static final Item BLACK_BED = registerBlock(new BedItem(Blocks.BLACK_BED, new Item.Properties().stacksTo(1))); - public static final Item COOKIE = registerItem("cookie", new Item(new Item.Properties().food(Foods.COOKIE))); - public static final Item CRAFTER = registerBlock(Blocks.CRAFTER, properties -> properties.component(DataComponents.CONTAINER, ItemContainerContents.EMPTY)); public static final Item FILLED_MAP = registerItem( "filled_map", - new MapItem(new Item.Properties().component(DataComponents.MAP_COLOR, MapItemColor.DEFAULT).component(DataComponents.MAP_DECORATIONS, MapDecorations.EMPTY)) + MapItem::new, + new Item.Properties().component(DataComponents.MAP_COLOR, MapItemColor.DEFAULT).component(DataComponents.MAP_DECORATIONS, MapDecorations.EMPTY) ); public static final Item SHEARS = registerItem( - "shears", new ShearsItem(new Item.Properties().durability(238).component(DataComponents.TOOL, ShearsItem.createToolProperties())) + "shears", ShearsItem::new, new Item.Properties().durability(238).component(DataComponents.TOOL, ShearsItem.createToolProperties()) ); - public static final Item MELON_SLICE = registerItem("melon_slice", new Item(new Item.Properties().food(Foods.MELON_SLICE))); - public static final Item DRIED_KELP = registerItem("dried_kelp", new Item(new Item.Properties().food(Foods.DRIED_KELP))); - public static final Item PUMPKIN_SEEDS = registerItem( - net.minecraft.references.Items.PUMPKIN_SEEDS, new ItemNameBlockItem(Blocks.PUMPKIN_STEM, new Item.Properties()) - ); - public static final Item MELON_SEEDS = registerItem( - net.minecraft.references.Items.MELON_SEEDS, new ItemNameBlockItem(Blocks.MELON_STEM, new Item.Properties()) - ); - public static final Item BEEF = registerItem("beef", new Item(new Item.Properties().food(Foods.BEEF))); - public static final Item COOKED_BEEF = registerItem("cooked_beef", new Item(new Item.Properties().food(Foods.COOKED_BEEF))); - public static final Item CHICKEN = registerItem("chicken", new Item(new Item.Properties().food(Foods.CHICKEN))); - public static final Item COOKED_CHICKEN = registerItem("cooked_chicken", new Item(new Item.Properties().food(Foods.COOKED_CHICKEN))); - public static final Item ROTTEN_FLESH = registerItem("rotten_flesh", new Item(new Item.Properties().food(Foods.ROTTEN_FLESH))); - public static final Item ENDER_PEARL = registerItem("ender_pearl", new EnderpearlItem(new Item.Properties().stacksTo(16))); - public static final Item BLAZE_ROD = registerItem("blaze_rod", new Item(new Item.Properties())); - public static final Item GHAST_TEAR = registerItem("ghast_tear", new Item(new Item.Properties())); - public static final Item GOLD_NUGGET = registerItem("gold_nugget", new Item(new Item.Properties())); - public static final Item NETHER_WART = registerItem("nether_wart", new ItemNameBlockItem(Blocks.NETHER_WART, new Item.Properties())); + public static final Item MELON_SLICE = registerItem("melon_slice", new Item.Properties().food(Foods.MELON_SLICE)); + public static final Item DRIED_KELP = registerItem("dried_kelp", new Item.Properties().food(Foods.DRIED_KELP, Consumables.DRIED_KELP)); + public static final Item PUMPKIN_SEEDS = registerItem(net.minecraft.references.Items.PUMPKIN_SEEDS, createBlockItemWithCustomItemName(Blocks.PUMPKIN_STEM)); + public static final Item MELON_SEEDS = registerItem(net.minecraft.references.Items.MELON_SEEDS, createBlockItemWithCustomItemName(Blocks.MELON_STEM)); + public static final Item BEEF = registerItem("beef", new Item.Properties().food(Foods.BEEF)); + public static final Item COOKED_BEEF = registerItem("cooked_beef", new Item.Properties().food(Foods.COOKED_BEEF)); + public static final Item CHICKEN = registerItem("chicken", new Item.Properties().food(Foods.CHICKEN, Consumables.CHICKEN)); + public static final Item COOKED_CHICKEN = registerItem("cooked_chicken", new Item.Properties().food(Foods.COOKED_CHICKEN)); + public static final Item ROTTEN_FLESH = registerItem("rotten_flesh", new Item.Properties().food(Foods.ROTTEN_FLESH, Consumables.ROTTEN_FLESH)); + public static final Item ENDER_PEARL = registerItem("ender_pearl", EnderpearlItem::new, new Item.Properties().stacksTo(16).useCooldown(1.0F)); + public static final Item BLAZE_ROD = registerItem("blaze_rod"); + public static final Item GHAST_TEAR = registerItem("ghast_tear"); + public static final Item GOLD_NUGGET = registerItem("gold_nugget"); + public static final Item NETHER_WART = registerItem("nether_wart", createBlockItemWithCustomItemName(Blocks.NETHER_WART)); + public static final Item GLASS_BOTTLE = registerItem("glass_bottle", BottleItem::new); public static final Item POTION = registerItem( - "potion", new PotionItem(new Item.Properties().stacksTo(1).component(DataComponents.POTION_CONTENTS, PotionContents.EMPTY)) + "potion", + PotionItem::new, + new Item.Properties() + .stacksTo(1) + .component(DataComponents.POTION_CONTENTS, PotionContents.EMPTY) + .component(DataComponents.CONSUMABLE, Consumables.DEFAULT_DRINK) + .usingConvertsTo(GLASS_BOTTLE) ); - public static final Item GLASS_BOTTLE = registerItem("glass_bottle", new BottleItem(new Item.Properties())); - public static final Item SPIDER_EYE = registerItem("spider_eye", new Item(new Item.Properties().food(Foods.SPIDER_EYE))); - public static final Item FERMENTED_SPIDER_EYE = registerItem("fermented_spider_eye", new Item(new Item.Properties())); - public static final Item BLAZE_POWDER = registerItem("blaze_powder", new Item(new Item.Properties())); - public static final Item MAGMA_CREAM = registerItem("magma_cream", new Item(new Item.Properties())); + public static final Item SPIDER_EYE = registerItem("spider_eye", new Item.Properties().food(Foods.SPIDER_EYE, Consumables.SPIDER_EYE)); + public static final Item FERMENTED_SPIDER_EYE = registerItem("fermented_spider_eye"); + public static final Item BLAZE_POWDER = registerItem("blaze_powder"); + public static final Item MAGMA_CREAM = registerItem("magma_cream"); public static final Item BREWING_STAND = registerBlock( - Blocks.BREWING_STAND, properties -> properties.component(DataComponents.CONTAINER, ItemContainerContents.EMPTY) + Blocks.BREWING_STAND, (UnaryOperator)(properties -> properties.component(DataComponents.CONTAINER, ItemContainerContents.EMPTY)) ); public static final Item CAULDRON = registerBlock(Blocks.CAULDRON, Blocks.WATER_CAULDRON, Blocks.LAVA_CAULDRON, Blocks.POWDER_SNOW_CAULDRON); - public static final Item ENDER_EYE = registerItem("ender_eye", new EnderEyeItem(new Item.Properties())); - public static final Item GLISTERING_MELON_SLICE = registerItem("glistering_melon_slice", new Item(new Item.Properties())); + public static final Item ENDER_EYE = registerItem("ender_eye", EnderEyeItem::new); + public static final Item GLISTERING_MELON_SLICE = registerItem("glistering_melon_slice"); public static final Item ARMADILLO_SPAWN_EGG = registerItem( - "armadillo_spawn_egg", new SpawnEggItem(EntityType.ARMADILLO, 11366765, 8538184, new Item.Properties()) + "armadillo_spawn_egg", properties -> new SpawnEggItem(EntityType.ARMADILLO, 11366765, 8538184, properties) ); - public static final Item ALLAY_SPAWN_EGG = registerItem("allay_spawn_egg", new SpawnEggItem(EntityType.ALLAY, 56063, 44543, new Item.Properties())); - public static final Item AXOLOTL_SPAWN_EGG = registerItem("axolotl_spawn_egg", new SpawnEggItem(EntityType.AXOLOTL, 16499171, 10890612, new Item.Properties())); - public static final Item BAT_SPAWN_EGG = registerItem("bat_spawn_egg", new SpawnEggItem(EntityType.BAT, 4996656, 986895, new Item.Properties())); - public static final Item BEE_SPAWN_EGG = registerItem("bee_spawn_egg", new SpawnEggItem(EntityType.BEE, 15582019, 4400155, new Item.Properties())); - public static final Item BLAZE_SPAWN_EGG = registerItem("blaze_spawn_egg", new SpawnEggItem(EntityType.BLAZE, 16167425, 16775294, new Item.Properties())); - public static final Item BOGGED_SPAWN_EGG = registerItem("bogged_spawn_egg", new SpawnEggItem(EntityType.BOGGED, 9084018, 3231003, new Item.Properties())); - public static final Item BREEZE_SPAWN_EGG = registerItem("breeze_spawn_egg", new SpawnEggItem(EntityType.BREEZE, 11506911, 9529055, new Item.Properties())); - public static final Item CAT_SPAWN_EGG = registerItem("cat_spawn_egg", new SpawnEggItem(EntityType.CAT, 15714446, 9794134, new Item.Properties())); - public static final Item CAMEL_SPAWN_EGG = registerItem("camel_spawn_egg", new SpawnEggItem(EntityType.CAMEL, 16565097, 13341495, new Item.Properties())); + public static final Item ALLAY_SPAWN_EGG = registerItem("allay_spawn_egg", properties -> new SpawnEggItem(EntityType.ALLAY, 56063, 44543, properties)); + public static final Item AXOLOTL_SPAWN_EGG = registerItem( + "axolotl_spawn_egg", properties -> new SpawnEggItem(EntityType.AXOLOTL, 16499171, 10890612, properties) + ); + public static final Item BAT_SPAWN_EGG = registerItem("bat_spawn_egg", properties -> new SpawnEggItem(EntityType.BAT, 4996656, 986895, properties)); + public static final Item BEE_SPAWN_EGG = registerItem("bee_spawn_egg", properties -> new SpawnEggItem(EntityType.BEE, 15582019, 4400155, properties)); + public static final Item BLAZE_SPAWN_EGG = registerItem("blaze_spawn_egg", properties -> new SpawnEggItem(EntityType.BLAZE, 16167425, 16775294, properties)); + public static final Item BOGGED_SPAWN_EGG = registerItem("bogged_spawn_egg", properties -> new SpawnEggItem(EntityType.BOGGED, 9084018, 3231003, properties)); + public static final Item BREEZE_SPAWN_EGG = registerItem("breeze_spawn_egg", properties -> new SpawnEggItem(EntityType.BREEZE, 11506911, 9529055, properties)); + public static final Item CAT_SPAWN_EGG = registerItem("cat_spawn_egg", properties -> new SpawnEggItem(EntityType.CAT, 15714446, 9794134, properties)); + public static final Item CAMEL_SPAWN_EGG = registerItem("camel_spawn_egg", properties -> new SpawnEggItem(EntityType.CAMEL, 16565097, 13341495, properties)); public static final Item CAVE_SPIDER_SPAWN_EGG = registerItem( - "cave_spider_spawn_egg", new SpawnEggItem(EntityType.CAVE_SPIDER, 803406, 11013646, new Item.Properties()) + "cave_spider_spawn_egg", properties -> new SpawnEggItem(EntityType.CAVE_SPIDER, 803406, 11013646, properties) + ); + public static final Item CHICKEN_SPAWN_EGG = registerItem( + "chicken_spawn_egg", properties -> new SpawnEggItem(EntityType.CHICKEN, 10592673, 16711680, properties) + ); + public static final Item COD_SPAWN_EGG = registerItem("cod_spawn_egg", properties -> new SpawnEggItem(EntityType.COD, 12691306, 15058059, properties)); + public static final Item COW_SPAWN_EGG = registerItem("cow_spawn_egg", properties -> new SpawnEggItem(EntityType.COW, 4470310, 10592673, properties)); + public static final Item CREEPER_SPAWN_EGG = registerItem("creeper_spawn_egg", properties -> new SpawnEggItem(EntityType.CREEPER, 894731, 0, properties)); + public static final Item DOLPHIN_SPAWN_EGG = registerItem( + "dolphin_spawn_egg", properties -> new SpawnEggItem(EntityType.DOLPHIN, 2243405, 16382457, properties) + ); + public static final Item DONKEY_SPAWN_EGG = registerItem("donkey_spawn_egg", properties -> new SpawnEggItem(EntityType.DONKEY, 5457209, 8811878, properties)); + public static final Item DROWNED_SPAWN_EGG = registerItem( + "drowned_spawn_egg", properties -> new SpawnEggItem(EntityType.DROWNED, 9433559, 7969893, properties) ); - public static final Item CHICKEN_SPAWN_EGG = registerItem("chicken_spawn_egg", new SpawnEggItem(EntityType.CHICKEN, 10592673, 16711680, new Item.Properties())); - public static final Item COD_SPAWN_EGG = registerItem("cod_spawn_egg", new SpawnEggItem(EntityType.COD, 12691306, 15058059, new Item.Properties())); - public static final Item COW_SPAWN_EGG = registerItem("cow_spawn_egg", new SpawnEggItem(EntityType.COW, 4470310, 10592673, new Item.Properties())); - public static final Item CREEPER_SPAWN_EGG = registerItem("creeper_spawn_egg", new SpawnEggItem(EntityType.CREEPER, 894731, 0, new Item.Properties())); - public static final Item DOLPHIN_SPAWN_EGG = registerItem("dolphin_spawn_egg", new SpawnEggItem(EntityType.DOLPHIN, 2243405, 16382457, new Item.Properties())); - public static final Item DONKEY_SPAWN_EGG = registerItem("donkey_spawn_egg", new SpawnEggItem(EntityType.DONKEY, 5457209, 8811878, new Item.Properties())); - public static final Item DROWNED_SPAWN_EGG = registerItem("drowned_spawn_egg", new SpawnEggItem(EntityType.DROWNED, 9433559, 7969893, new Item.Properties())); public static final Item ELDER_GUARDIAN_SPAWN_EGG = registerItem( - "elder_guardian_spawn_egg", new SpawnEggItem(EntityType.ELDER_GUARDIAN, 13552826, 7632531, new Item.Properties()) + "elder_guardian_spawn_egg", properties -> new SpawnEggItem(EntityType.ELDER_GUARDIAN, 13552826, 7632531, properties) ); public static final Item ENDER_DRAGON_SPAWN_EGG = registerItem( - "ender_dragon_spawn_egg", new SpawnEggItem(EntityType.ENDER_DRAGON, 1842204, 14711290, new Item.Properties()) + "ender_dragon_spawn_egg", properties -> new SpawnEggItem(EntityType.ENDER_DRAGON, 1842204, 14711290, properties) ); - public static final Item ENDERMAN_SPAWN_EGG = registerItem("enderman_spawn_egg", new SpawnEggItem(EntityType.ENDERMAN, 1447446, 0, new Item.Properties())); + public static final Item ENDERMAN_SPAWN_EGG = registerItem("enderman_spawn_egg", properties -> new SpawnEggItem(EntityType.ENDERMAN, 1447446, 0, properties)); public static final Item ENDERMITE_SPAWN_EGG = registerItem( - "endermite_spawn_egg", new SpawnEggItem(EntityType.ENDERMITE, 1447446, 7237230, new Item.Properties()) + "endermite_spawn_egg", properties -> new SpawnEggItem(EntityType.ENDERMITE, 1447446, 7237230, properties) ); - public static final Item EVOKER_SPAWN_EGG = registerItem("evoker_spawn_egg", new SpawnEggItem(EntityType.EVOKER, 9804699, 1973274, new Item.Properties())); - public static final Item FOX_SPAWN_EGG = registerItem("fox_spawn_egg", new SpawnEggItem(EntityType.FOX, 14005919, 13396256, new Item.Properties())); - public static final Item FROG_SPAWN_EGG = registerItem("frog_spawn_egg", new SpawnEggItem(EntityType.FROG, 13661252, 16762748, new Item.Properties())); - public static final Item GHAST_SPAWN_EGG = registerItem("ghast_spawn_egg", new SpawnEggItem(EntityType.GHAST, 16382457, 12369084, new Item.Properties())); + public static final Item EVOKER_SPAWN_EGG = registerItem("evoker_spawn_egg", properties -> new SpawnEggItem(EntityType.EVOKER, 9804699, 1973274, properties)); + public static final Item FOX_SPAWN_EGG = registerItem("fox_spawn_egg", properties -> new SpawnEggItem(EntityType.FOX, 14005919, 13396256, properties)); + public static final Item FROG_SPAWN_EGG = registerItem("frog_spawn_egg", properties -> new SpawnEggItem(EntityType.FROG, 13661252, 16762748, properties)); + public static final Item GHAST_SPAWN_EGG = registerItem("ghast_spawn_egg", properties -> new SpawnEggItem(EntityType.GHAST, 16382457, 12369084, properties)); public static final Item GLOW_SQUID_SPAWN_EGG = registerItem( - "glow_squid_spawn_egg", new SpawnEggItem(EntityType.GLOW_SQUID, 611926, 8778172, new Item.Properties()) + "glow_squid_spawn_egg", properties -> new SpawnEggItem(EntityType.GLOW_SQUID, 611926, 8778172, properties) ); - public static final Item GOAT_SPAWN_EGG = registerItem("goat_spawn_egg", new SpawnEggItem(EntityType.GOAT, 10851452, 5589310, new Item.Properties())); + public static final Item GOAT_SPAWN_EGG = registerItem("goat_spawn_egg", properties -> new SpawnEggItem(EntityType.GOAT, 10851452, 5589310, properties)); public static final Item GUARDIAN_SPAWN_EGG = registerItem( - "guardian_spawn_egg", new SpawnEggItem(EntityType.GUARDIAN, 5931634, 15826224, new Item.Properties()) + "guardian_spawn_egg", properties -> new SpawnEggItem(EntityType.GUARDIAN, 5931634, 15826224, properties) ); - public static final Item HOGLIN_SPAWN_EGG = registerItem("hoglin_spawn_egg", new SpawnEggItem(EntityType.HOGLIN, 13004373, 6251620, new Item.Properties())); - public static final Item HORSE_SPAWN_EGG = registerItem("horse_spawn_egg", new SpawnEggItem(EntityType.HORSE, 12623485, 15656192, new Item.Properties())); - public static final Item HUSK_SPAWN_EGG = registerItem("husk_spawn_egg", new SpawnEggItem(EntityType.HUSK, 7958625, 15125652, new Item.Properties())); + public static final Item HOGLIN_SPAWN_EGG = registerItem("hoglin_spawn_egg", properties -> new SpawnEggItem(EntityType.HOGLIN, 13004373, 6251620, properties)); + public static final Item HORSE_SPAWN_EGG = registerItem("horse_spawn_egg", properties -> new SpawnEggItem(EntityType.HORSE, 12623485, 15656192, properties)); + public static final Item HUSK_SPAWN_EGG = registerItem("husk_spawn_egg", properties -> new SpawnEggItem(EntityType.HUSK, 7958625, 15125652, properties)); public static final Item IRON_GOLEM_SPAWN_EGG = registerItem( - "iron_golem_spawn_egg", new SpawnEggItem(EntityType.IRON_GOLEM, 14405058, 7643954, new Item.Properties()) + "iron_golem_spawn_egg", properties -> new SpawnEggItem(EntityType.IRON_GOLEM, 14405058, 7643954, properties) ); - public static final Item LLAMA_SPAWN_EGG = registerItem("llama_spawn_egg", new SpawnEggItem(EntityType.LLAMA, 12623485, 10051392, new Item.Properties())); + public static final Item LLAMA_SPAWN_EGG = registerItem("llama_spawn_egg", properties -> new SpawnEggItem(EntityType.LLAMA, 12623485, 10051392, properties)); public static final Item MAGMA_CUBE_SPAWN_EGG = registerItem( - "magma_cube_spawn_egg", new SpawnEggItem(EntityType.MAGMA_CUBE, 3407872, 16579584, new Item.Properties()) + "magma_cube_spawn_egg", properties -> new SpawnEggItem(EntityType.MAGMA_CUBE, 3407872, 16579584, properties) ); public static final Item MOOSHROOM_SPAWN_EGG = registerItem( - "mooshroom_spawn_egg", new SpawnEggItem(EntityType.MOOSHROOM, 10489616, 12040119, new Item.Properties()) + "mooshroom_spawn_egg", properties -> new SpawnEggItem(EntityType.MOOSHROOM, 10489616, 12040119, properties) ); - public static final Item MULE_SPAWN_EGG = registerItem("mule_spawn_egg", new SpawnEggItem(EntityType.MULE, 1769984, 5321501, new Item.Properties())); - public static final Item OCELOT_SPAWN_EGG = registerItem("ocelot_spawn_egg", new SpawnEggItem(EntityType.OCELOT, 15720061, 5653556, new Item.Properties())); - public static final Item PANDA_SPAWN_EGG = registerItem("panda_spawn_egg", new SpawnEggItem(EntityType.PANDA, 15198183, 1776418, new Item.Properties())); - public static final Item PARROT_SPAWN_EGG = registerItem("parrot_spawn_egg", new SpawnEggItem(EntityType.PARROT, 894731, 16711680, new Item.Properties())); - public static final Item PHANTOM_SPAWN_EGG = registerItem("phantom_spawn_egg", new SpawnEggItem(EntityType.PHANTOM, 4411786, 8978176, new Item.Properties())); - public static final Item PIG_SPAWN_EGG = registerItem("pig_spawn_egg", new SpawnEggItem(EntityType.PIG, 15771042, 14377823, new Item.Properties())); - public static final Item PIGLIN_SPAWN_EGG = registerItem("piglin_spawn_egg", new SpawnEggItem(EntityType.PIGLIN, 10051392, 16380836, new Item.Properties())); + public static final Item MULE_SPAWN_EGG = registerItem("mule_spawn_egg", properties -> new SpawnEggItem(EntityType.MULE, 1769984, 5321501, properties)); + public static final Item OCELOT_SPAWN_EGG = registerItem("ocelot_spawn_egg", properties -> new SpawnEggItem(EntityType.OCELOT, 15720061, 5653556, properties)); + public static final Item PANDA_SPAWN_EGG = registerItem("panda_spawn_egg", properties -> new SpawnEggItem(EntityType.PANDA, 15198183, 1776418, properties)); + public static final Item PARROT_SPAWN_EGG = registerItem("parrot_spawn_egg", properties -> new SpawnEggItem(EntityType.PARROT, 894731, 16711680, properties)); + public static final Item PHANTOM_SPAWN_EGG = registerItem( + "phantom_spawn_egg", properties -> new SpawnEggItem(EntityType.PHANTOM, 4411786, 8978176, properties) + ); + public static final Item PIG_SPAWN_EGG = registerItem("pig_spawn_egg", properties -> new SpawnEggItem(EntityType.PIG, 15771042, 14377823, properties)); + public static final Item PIGLIN_SPAWN_EGG = registerItem("piglin_spawn_egg", properties -> new SpawnEggItem(EntityType.PIGLIN, 10051392, 16380836, properties)); public static final Item PIGLIN_BRUTE_SPAWN_EGG = registerItem( - "piglin_brute_spawn_egg", new SpawnEggItem(EntityType.PIGLIN_BRUTE, 5843472, 16380836, new Item.Properties()) + "piglin_brute_spawn_egg", properties -> new SpawnEggItem(EntityType.PIGLIN_BRUTE, 5843472, 16380836, properties) ); public static final Item PILLAGER_SPAWN_EGG = registerItem( - "pillager_spawn_egg", new SpawnEggItem(EntityType.PILLAGER, 5451574, 9804699, new Item.Properties()) + "pillager_spawn_egg", properties -> new SpawnEggItem(EntityType.PILLAGER, 5451574, 9804699, properties) ); public static final Item POLAR_BEAR_SPAWN_EGG = registerItem( - "polar_bear_spawn_egg", new SpawnEggItem(EntityType.POLAR_BEAR, 15658718, 14014157, new Item.Properties()) + "polar_bear_spawn_egg", properties -> new SpawnEggItem(EntityType.POLAR_BEAR, 15658718, 14014157, properties) ); public static final Item PUFFERFISH_SPAWN_EGG = registerItem( - "pufferfish_spawn_egg", new SpawnEggItem(EntityType.PUFFERFISH, 16167425, 3654642, new Item.Properties()) + "pufferfish_spawn_egg", properties -> new SpawnEggItem(EntityType.PUFFERFISH, 16167425, 3654642, properties) + ); + public static final Item RABBIT_SPAWN_EGG = registerItem("rabbit_spawn_egg", properties -> new SpawnEggItem(EntityType.RABBIT, 10051392, 7555121, properties)); + public static final Item RAVAGER_SPAWN_EGG = registerItem( + "ravager_spawn_egg", properties -> new SpawnEggItem(EntityType.RAVAGER, 7697520, 5984329, properties) + ); + public static final Item SALMON_SPAWN_EGG = registerItem("salmon_spawn_egg", properties -> new SpawnEggItem(EntityType.SALMON, 10489616, 951412, properties)); + public static final Item SHEEP_SPAWN_EGG = registerItem("sheep_spawn_egg", properties -> new SpawnEggItem(EntityType.SHEEP, 15198183, 16758197, properties)); + public static final Item SHULKER_SPAWN_EGG = registerItem( + "shulker_spawn_egg", properties -> new SpawnEggItem(EntityType.SHULKER, 9725844, 5060690, properties) ); - public static final Item RABBIT_SPAWN_EGG = registerItem("rabbit_spawn_egg", new SpawnEggItem(EntityType.RABBIT, 10051392, 7555121, new Item.Properties())); - public static final Item RAVAGER_SPAWN_EGG = registerItem("ravager_spawn_egg", new SpawnEggItem(EntityType.RAVAGER, 7697520, 5984329, new Item.Properties())); - public static final Item SALMON_SPAWN_EGG = registerItem("salmon_spawn_egg", new SpawnEggItem(EntityType.SALMON, 10489616, 951412, new Item.Properties())); - public static final Item SHEEP_SPAWN_EGG = registerItem("sheep_spawn_egg", new SpawnEggItem(EntityType.SHEEP, 15198183, 16758197, new Item.Properties())); - public static final Item SHULKER_SPAWN_EGG = registerItem("shulker_spawn_egg", new SpawnEggItem(EntityType.SHULKER, 9725844, 5060690, new Item.Properties())); public static final Item SILVERFISH_SPAWN_EGG = registerItem( - "silverfish_spawn_egg", new SpawnEggItem(EntityType.SILVERFISH, 7237230, 3158064, new Item.Properties()) + "silverfish_spawn_egg", properties -> new SpawnEggItem(EntityType.SILVERFISH, 7237230, 3158064, properties) ); public static final Item SKELETON_SPAWN_EGG = registerItem( - "skeleton_spawn_egg", new SpawnEggItem(EntityType.SKELETON, 12698049, 4802889, new Item.Properties()) + "skeleton_spawn_egg", properties -> new SpawnEggItem(EntityType.SKELETON, 12698049, 4802889, properties) ); public static final Item SKELETON_HORSE_SPAWN_EGG = registerItem( - "skeleton_horse_spawn_egg", new SpawnEggItem(EntityType.SKELETON_HORSE, 6842447, 15066584, new Item.Properties()) + "skeleton_horse_spawn_egg", properties -> new SpawnEggItem(EntityType.SKELETON_HORSE, 6842447, 15066584, properties) + ); + public static final Item SLIME_SPAWN_EGG = registerItem("slime_spawn_egg", properties -> new SpawnEggItem(EntityType.SLIME, 5349438, 8306542, properties)); + public static final Item SNIFFER_SPAWN_EGG = registerItem( + "sniffer_spawn_egg", properties -> new SpawnEggItem(EntityType.SNIFFER, 8855049, 2468720, properties) ); - public static final Item SLIME_SPAWN_EGG = registerItem("slime_spawn_egg", new SpawnEggItem(EntityType.SLIME, 5349438, 8306542, new Item.Properties())); - public static final Item SNIFFER_SPAWN_EGG = registerItem("sniffer_spawn_egg", new SpawnEggItem(EntityType.SNIFFER, 8855049, 2468720, new Item.Properties())); public static final Item SNOW_GOLEM_SPAWN_EGG = registerItem( - "snow_golem_spawn_egg", new SpawnEggItem(EntityType.SNOW_GOLEM, 14283506, 8496292, new Item.Properties()) + "snow_golem_spawn_egg", properties -> new SpawnEggItem(EntityType.SNOW_GOLEM, 14283506, 8496292, properties) + ); + public static final Item SPIDER_SPAWN_EGG = registerItem("spider_spawn_egg", properties -> new SpawnEggItem(EntityType.SPIDER, 3419431, 11013646, properties)); + public static final Item SQUID_SPAWN_EGG = registerItem("squid_spawn_egg", properties -> new SpawnEggItem(EntityType.SQUID, 2243405, 7375001, properties)); + public static final Item STRAY_SPAWN_EGG = registerItem("stray_spawn_egg", properties -> new SpawnEggItem(EntityType.STRAY, 6387319, 14543594, properties)); + public static final Item STRIDER_SPAWN_EGG = registerItem( + "strider_spawn_egg", properties -> new SpawnEggItem(EntityType.STRIDER, 10236982, 5065037, properties) + ); + public static final Item TADPOLE_SPAWN_EGG = registerItem( + "tadpole_spawn_egg", properties -> new SpawnEggItem(EntityType.TADPOLE, 7164733, 1444352, properties) ); - public static final Item SPIDER_SPAWN_EGG = registerItem("spider_spawn_egg", new SpawnEggItem(EntityType.SPIDER, 3419431, 11013646, new Item.Properties())); - public static final Item SQUID_SPAWN_EGG = registerItem("squid_spawn_egg", new SpawnEggItem(EntityType.SQUID, 2243405, 7375001, new Item.Properties())); - public static final Item STRAY_SPAWN_EGG = registerItem("stray_spawn_egg", new SpawnEggItem(EntityType.STRAY, 6387319, 14543594, new Item.Properties())); - public static final Item STRIDER_SPAWN_EGG = registerItem("strider_spawn_egg", new SpawnEggItem(EntityType.STRIDER, 10236982, 5065037, new Item.Properties())); - public static final Item TADPOLE_SPAWN_EGG = registerItem("tadpole_spawn_egg", new SpawnEggItem(EntityType.TADPOLE, 7164733, 1444352, new Item.Properties())); public static final Item TRADER_LLAMA_SPAWN_EGG = registerItem( - "trader_llama_spawn_egg", new SpawnEggItem(EntityType.TRADER_LLAMA, 15377456, 4547222, new Item.Properties()) + "trader_llama_spawn_egg", properties -> new SpawnEggItem(EntityType.TRADER_LLAMA, 15377456, 4547222, properties) ); public static final Item TROPICAL_FISH_SPAWN_EGG = registerItem( - "tropical_fish_spawn_egg", new SpawnEggItem(EntityType.TROPICAL_FISH, 15690005, 16775663, new Item.Properties()) + "tropical_fish_spawn_egg", properties -> new SpawnEggItem(EntityType.TROPICAL_FISH, 15690005, 16775663, properties) ); - public static final Item TURTLE_SPAWN_EGG = registerItem("turtle_spawn_egg", new SpawnEggItem(EntityType.TURTLE, 15198183, 44975, new Item.Properties())); - public static final Item VEX_SPAWN_EGG = registerItem("vex_spawn_egg", new SpawnEggItem(EntityType.VEX, 8032420, 15265265, new Item.Properties())); + public static final Item TURTLE_SPAWN_EGG = registerItem("turtle_spawn_egg", properties -> new SpawnEggItem(EntityType.TURTLE, 15198183, 44975, properties)); + public static final Item VEX_SPAWN_EGG = registerItem("vex_spawn_egg", properties -> new SpawnEggItem(EntityType.VEX, 8032420, 15265265, properties)); public static final Item VILLAGER_SPAWN_EGG = registerItem( - "villager_spawn_egg", new SpawnEggItem(EntityType.VILLAGER, 5651507, 12422002, new Item.Properties()) + "villager_spawn_egg", properties -> new SpawnEggItem(EntityType.VILLAGER, 5651507, 12422002, properties) ); public static final Item VINDICATOR_SPAWN_EGG = registerItem( - "vindicator_spawn_egg", new SpawnEggItem(EntityType.VINDICATOR, 9804699, 2580065, new Item.Properties()) + "vindicator_spawn_egg", properties -> new SpawnEggItem(EntityType.VINDICATOR, 9804699, 2580065, properties) ); public static final Item WANDERING_TRADER_SPAWN_EGG = registerItem( - "wandering_trader_spawn_egg", new SpawnEggItem(EntityType.WANDERING_TRADER, 4547222, 15377456, new Item.Properties()) + "wandering_trader_spawn_egg", properties -> new SpawnEggItem(EntityType.WANDERING_TRADER, 4547222, 15377456, properties) ); - public static final Item WARDEN_SPAWN_EGG = registerItem("warden_spawn_egg", new SpawnEggItem(EntityType.WARDEN, 1001033, 3790560, new Item.Properties())); - public static final Item WITCH_SPAWN_EGG = registerItem("witch_spawn_egg", new SpawnEggItem(EntityType.WITCH, 3407872, 5349438, new Item.Properties())); - public static final Item WITHER_SPAWN_EGG = registerItem("wither_spawn_egg", new SpawnEggItem(EntityType.WITHER, 1315860, 5075616, new Item.Properties())); + public static final Item WARDEN_SPAWN_EGG = registerItem("warden_spawn_egg", properties -> new SpawnEggItem(EntityType.WARDEN, 1001033, 3790560, properties)); + public static final Item WITCH_SPAWN_EGG = registerItem("witch_spawn_egg", properties -> new SpawnEggItem(EntityType.WITCH, 3407872, 5349438, properties)); + public static final Item WITHER_SPAWN_EGG = registerItem("wither_spawn_egg", properties -> new SpawnEggItem(EntityType.WITHER, 1315860, 5075616, properties)); public static final Item WITHER_SKELETON_SPAWN_EGG = registerItem( - "wither_skeleton_spawn_egg", new SpawnEggItem(EntityType.WITHER_SKELETON, 1315860, 4672845, new Item.Properties()) + "wither_skeleton_spawn_egg", properties -> new SpawnEggItem(EntityType.WITHER_SKELETON, 1315860, 4672845, properties) ); - public static final Item WOLF_SPAWN_EGG = registerItem("wolf_spawn_egg", new SpawnEggItem(EntityType.WOLF, 14144467, 13545366, new Item.Properties())); - public static final Item ZOGLIN_SPAWN_EGG = registerItem("zoglin_spawn_egg", new SpawnEggItem(EntityType.ZOGLIN, 13004373, 15132390, new Item.Properties())); - public static final Item ZOMBIE_SPAWN_EGG = registerItem("zombie_spawn_egg", new SpawnEggItem(EntityType.ZOMBIE, 44975, 7969893, new Item.Properties())); + public static final Item WOLF_SPAWN_EGG = registerItem("wolf_spawn_egg", properties -> new SpawnEggItem(EntityType.WOLF, 14144467, 13545366, properties)); + public static final Item ZOGLIN_SPAWN_EGG = registerItem("zoglin_spawn_egg", properties -> new SpawnEggItem(EntityType.ZOGLIN, 13004373, 15132390, properties)); + public static final Item CREAKING_SPAWN_EGG = registerItem( + "creaking_spawn_egg", properties -> new SpawnEggItem(EntityType.CREAKING, 6250335, 16545810, properties) + ); + public static final Item ZOMBIE_SPAWN_EGG = registerItem("zombie_spawn_egg", properties -> new SpawnEggItem(EntityType.ZOMBIE, 44975, 7969893, properties)); public static final Item ZOMBIE_HORSE_SPAWN_EGG = registerItem( - "zombie_horse_spawn_egg", new SpawnEggItem(EntityType.ZOMBIE_HORSE, 3232308, 9945732, new Item.Properties()) + "zombie_horse_spawn_egg", properties -> new SpawnEggItem(EntityType.ZOMBIE_HORSE, 3232308, 9945732, properties) ); public static final Item ZOMBIE_VILLAGER_SPAWN_EGG = registerItem( - "zombie_villager_spawn_egg", new SpawnEggItem(EntityType.ZOMBIE_VILLAGER, 5651507, 7969893, new Item.Properties()) + "zombie_villager_spawn_egg", properties -> new SpawnEggItem(EntityType.ZOMBIE_VILLAGER, 5651507, 7969893, properties) ); public static final Item ZOMBIFIED_PIGLIN_SPAWN_EGG = registerItem( - "zombified_piglin_spawn_egg", new SpawnEggItem(EntityType.ZOMBIFIED_PIGLIN, 15373203, 5009705, new Item.Properties()) + "zombified_piglin_spawn_egg", properties -> new SpawnEggItem(EntityType.ZOMBIFIED_PIGLIN, 15373203, 5009705, properties) ); public static final Item EXPERIENCE_BOTTLE = registerItem( - "experience_bottle", new ExperienceBottleItem(new Item.Properties().rarity(Rarity.UNCOMMON).component(DataComponents.ENCHANTMENT_GLINT_OVERRIDE, true)) + "experience_bottle", ExperienceBottleItem::new, new Item.Properties().rarity(Rarity.UNCOMMON).component(DataComponents.ENCHANTMENT_GLINT_OVERRIDE, true) ); - public static final Item FIRE_CHARGE = registerItem("fire_charge", new FireChargeItem(new Item.Properties())); - public static final Item WIND_CHARGE = registerItem("wind_charge", new WindChargeItem(new Item.Properties())); + public static final Item FIRE_CHARGE = registerItem("fire_charge", FireChargeItem::new); + public static final Item WIND_CHARGE = registerItem("wind_charge", WindChargeItem::new, new Item.Properties().useCooldown(0.5F)); public static final Item WRITABLE_BOOK = registerItem( - "writable_book", new WritableBookItem(new Item.Properties().stacksTo(1).component(DataComponents.WRITABLE_BOOK_CONTENT, WritableBookContent.EMPTY)) + "writable_book", WritableBookItem::new, new Item.Properties().stacksTo(1).component(DataComponents.WRITABLE_BOOK_CONTENT, WritableBookContent.EMPTY) ); public static final Item WRITTEN_BOOK = registerItem( - "written_book", new WrittenBookItem(new Item.Properties().stacksTo(16).component(DataComponents.ENCHANTMENT_GLINT_OVERRIDE, true)) + "written_book", WrittenBookItem::new, new Item.Properties().stacksTo(16).component(DataComponents.ENCHANTMENT_GLINT_OVERRIDE, true) ); + public static final Item BREEZE_ROD = registerItem("breeze_rod"); public static final Item MACE = registerItem( "mace", - new MaceItem( - new Item.Properties() - .rarity(Rarity.EPIC) - .durability(500) - .component(DataComponents.TOOL, MaceItem.createToolProperties()) - .attributes(MaceItem.createAttributes()) - ) + MaceItem::new, + new Item.Properties() + .rarity(Rarity.EPIC) + .durability(500) + .component(DataComponents.TOOL, MaceItem.createToolProperties()) + .repairable(BREEZE_ROD) + .attributes(MaceItem.createAttributes()) + .enchantable(15) ); - public static final Item ITEM_FRAME = registerItem("item_frame", new ItemFrameItem(EntityType.ITEM_FRAME, new Item.Properties())); - public static final Item GLOW_ITEM_FRAME = registerItem("glow_item_frame", new ItemFrameItem(EntityType.GLOW_ITEM_FRAME, new Item.Properties())); + public static final Item ITEM_FRAME = registerItem("item_frame", properties -> new ItemFrameItem(EntityType.ITEM_FRAME, properties)); + public static final Item GLOW_ITEM_FRAME = registerItem("glow_item_frame", properties -> new ItemFrameItem(EntityType.GLOW_ITEM_FRAME, properties)); public static final Item FLOWER_POT = registerBlock(Blocks.FLOWER_POT); - public static final Item CARROT = registerItem("carrot", new ItemNameBlockItem(Blocks.CARROTS, new Item.Properties().food(Foods.CARROT))); - public static final Item POTATO = registerItem("potato", new ItemNameBlockItem(Blocks.POTATOES, new Item.Properties().food(Foods.POTATO))); - public static final Item BAKED_POTATO = registerItem("baked_potato", new Item(new Item.Properties().food(Foods.BAKED_POTATO))); - public static final Item POISONOUS_POTATO = registerItem("poisonous_potato", new Item(new Item.Properties().food(Foods.POISONOUS_POTATO))); - public static final Item MAP = registerItem("map", new EmptyMapItem(new Item.Properties())); - public static final Item GOLDEN_CARROT = registerItem("golden_carrot", new Item(new Item.Properties().food(Foods.GOLDEN_CARROT))); + public static final Item CARROT = registerItem("carrot", createBlockItemWithCustomItemName(Blocks.CARROTS), new Item.Properties().food(Foods.CARROT)); + public static final Item POTATO = registerItem("potato", createBlockItemWithCustomItemName(Blocks.POTATOES), new Item.Properties().food(Foods.POTATO)); + public static final Item BAKED_POTATO = registerItem("baked_potato", new Item.Properties().food(Foods.BAKED_POTATO)); + public static final Item POISONOUS_POTATO = registerItem("poisonous_potato", new Item.Properties().food(Foods.POISONOUS_POTATO, Consumables.POISONOUS_POTATO)); + public static final Item MAP = registerItem("map", EmptyMapItem::new); + public static final Item GOLDEN_CARROT = registerItem("golden_carrot", new Item.Properties().food(Foods.GOLDEN_CARROT)); public static final Item SKELETON_SKULL = registerBlock( - new StandingAndWallBlockItem(Blocks.SKELETON_SKULL, Blocks.SKELETON_WALL_SKULL, new Item.Properties().rarity(Rarity.UNCOMMON), Direction.DOWN) + Blocks.SKELETON_SKULL, + (block, properties) -> new StandingAndWallBlockItem(block, Blocks.SKELETON_WALL_SKULL, Direction.DOWN, properties), + new Item.Properties().rarity(Rarity.UNCOMMON).equippableUnswappable(EquipmentSlot.HEAD) ); public static final Item WITHER_SKELETON_SKULL = registerBlock( - new StandingAndWallBlockItem(Blocks.WITHER_SKELETON_SKULL, Blocks.WITHER_SKELETON_WALL_SKULL, new Item.Properties().rarity(Rarity.UNCOMMON), Direction.DOWN) + Blocks.WITHER_SKELETON_SKULL, + (block, properties) -> new StandingAndWallBlockItem(block, Blocks.WITHER_SKELETON_WALL_SKULL, Direction.DOWN, properties), + new Item.Properties().rarity(Rarity.RARE).equippableUnswappable(EquipmentSlot.HEAD) ); public static final Item PLAYER_HEAD = registerBlock( - new PlayerHeadItem(Blocks.PLAYER_HEAD, Blocks.PLAYER_WALL_HEAD, new Item.Properties().rarity(Rarity.UNCOMMON)) + Blocks.PLAYER_HEAD, + (block, properties) -> new PlayerHeadItem(block, Blocks.PLAYER_WALL_HEAD, properties), + new Item.Properties().rarity(Rarity.UNCOMMON).equippableUnswappable(EquipmentSlot.HEAD) ); public static final Item ZOMBIE_HEAD = registerBlock( - new StandingAndWallBlockItem(Blocks.ZOMBIE_HEAD, Blocks.ZOMBIE_WALL_HEAD, new Item.Properties().rarity(Rarity.UNCOMMON), Direction.DOWN) + Blocks.ZOMBIE_HEAD, + (block, properties) -> new StandingAndWallBlockItem(block, Blocks.ZOMBIE_WALL_HEAD, Direction.DOWN, properties), + new Item.Properties().rarity(Rarity.UNCOMMON).equippableUnswappable(EquipmentSlot.HEAD) ); public static final Item CREEPER_HEAD = registerBlock( - new StandingAndWallBlockItem(Blocks.CREEPER_HEAD, Blocks.CREEPER_WALL_HEAD, new Item.Properties().rarity(Rarity.UNCOMMON), Direction.DOWN) + Blocks.CREEPER_HEAD, + (block, properties) -> new StandingAndWallBlockItem(block, Blocks.CREEPER_WALL_HEAD, Direction.DOWN, properties), + new Item.Properties().rarity(Rarity.UNCOMMON).equippableUnswappable(EquipmentSlot.HEAD) ); public static final Item DRAGON_HEAD = registerBlock( - new StandingAndWallBlockItem(Blocks.DRAGON_HEAD, Blocks.DRAGON_WALL_HEAD, new Item.Properties().rarity(Rarity.UNCOMMON), Direction.DOWN) + Blocks.DRAGON_HEAD, + (block, properties) -> new StandingAndWallBlockItem(block, Blocks.DRAGON_WALL_HEAD, Direction.DOWN, properties), + new Item.Properties().rarity(Rarity.EPIC).equippableUnswappable(EquipmentSlot.HEAD) ); public static final Item PIGLIN_HEAD = registerBlock( - new StandingAndWallBlockItem(Blocks.PIGLIN_HEAD, Blocks.PIGLIN_WALL_HEAD, new Item.Properties().rarity(Rarity.UNCOMMON), Direction.DOWN) + Blocks.PIGLIN_HEAD, + (block, properties) -> new StandingAndWallBlockItem(block, Blocks.PIGLIN_WALL_HEAD, Direction.DOWN, properties), + new Item.Properties().rarity(Rarity.UNCOMMON).equippableUnswappable(EquipmentSlot.HEAD) ); public static final Item NETHER_STAR = registerItem( - "nether_star", new Item(new Item.Properties().rarity(Rarity.UNCOMMON).component(DataComponents.ENCHANTMENT_GLINT_OVERRIDE, true)) + "nether_star", + new Item.Properties() + .rarity(Rarity.RARE) + .component(DataComponents.ENCHANTMENT_GLINT_OVERRIDE, true) + .component(DataComponents.DAMAGE_RESISTANT, new DamageResistant(DamageTypeTags.IS_EXPLOSION)) ); - public static final Item PUMPKIN_PIE = registerItem("pumpkin_pie", new Item(new Item.Properties().food(Foods.PUMPKIN_PIE))); + public static final Item PUMPKIN_PIE = registerItem("pumpkin_pie", new Item.Properties().food(Foods.PUMPKIN_PIE)); public static final Item FIREWORK_ROCKET = registerItem( - "firework_rocket", new FireworkRocketItem(new Item.Properties().component(DataComponents.FIREWORKS, new Fireworks(1, List.of()))) + "firework_rocket", FireworkRocketItem::new, new Item.Properties().component(DataComponents.FIREWORKS, new Fireworks(1, List.of())) ); - public static final Item FIREWORK_STAR = registerItem("firework_star", new FireworkStarItem(new Item.Properties())); + public static final Item FIREWORK_STAR = registerItem("firework_star", FireworkStarItem::new); public static final Item ENCHANTED_BOOK = registerItem( "enchanted_book", - new EnchantedBookItem( - new Item.Properties() - .stacksTo(1) - .rarity(Rarity.UNCOMMON) - .component(DataComponents.STORED_ENCHANTMENTS, ItemEnchantments.EMPTY) - .component(DataComponents.ENCHANTMENT_GLINT_OVERRIDE, true) - ) + new Item.Properties() + .stacksTo(1) + .rarity(Rarity.UNCOMMON) + .component(DataComponents.STORED_ENCHANTMENTS, ItemEnchantments.EMPTY) + .component(DataComponents.ENCHANTMENT_GLINT_OVERRIDE, true) ); - public static final Item NETHER_BRICK = registerItem("nether_brick", new Item(new Item.Properties())); - public static final Item PRISMARINE_SHARD = registerItem("prismarine_shard", new Item(new Item.Properties())); - public static final Item PRISMARINE_CRYSTALS = registerItem("prismarine_crystals", new Item(new Item.Properties())); - public static final Item RABBIT = registerItem("rabbit", new Item(new Item.Properties().food(Foods.RABBIT))); - public static final Item COOKED_RABBIT = registerItem("cooked_rabbit", new Item(new Item.Properties().food(Foods.COOKED_RABBIT))); - public static final Item RABBIT_STEW = registerItem("rabbit_stew", new Item(new Item.Properties().stacksTo(1).food(Foods.RABBIT_STEW))); - public static final Item RABBIT_FOOT = registerItem("rabbit_foot", new Item(new Item.Properties())); - public static final Item RABBIT_HIDE = registerItem("rabbit_hide", new Item(new Item.Properties())); - public static final Item ARMOR_STAND = registerItem("armor_stand", new ArmorStandItem(new Item.Properties().stacksTo(16))); + public static final Item NETHER_BRICK = registerItem("nether_brick"); + public static final Item PRISMARINE_SHARD = registerItem("prismarine_shard"); + public static final Item PRISMARINE_CRYSTALS = registerItem("prismarine_crystals"); + public static final Item RABBIT = registerItem("rabbit", new Item.Properties().food(Foods.RABBIT)); + public static final Item COOKED_RABBIT = registerItem("cooked_rabbit", new Item.Properties().food(Foods.COOKED_RABBIT)); + public static final Item RABBIT_STEW = registerItem("rabbit_stew", new Item.Properties().stacksTo(1).food(Foods.RABBIT_STEW).usingConvertsTo(BOWL)); + public static final Item RABBIT_FOOT = registerItem("rabbit_foot"); + public static final Item RABBIT_HIDE = registerItem("rabbit_hide"); + public static final Item ARMOR_STAND = registerItem("armor_stand", ArmorStandItem::new, new Item.Properties().stacksTo(16)); public static final Item IRON_HORSE_ARMOR = registerItem( - "iron_horse_armor", new AnimalArmorItem(ArmorMaterials.IRON, AnimalArmorItem.BodyType.EQUESTRIAN, false, new Item.Properties().stacksTo(1)) + "iron_horse_armor", + properties -> new AnimalArmorItem(ArmorMaterials.IRON, AnimalArmorItem.BodyType.EQUESTRIAN, SoundEvents.HORSE_ARMOR, false, properties), + new Item.Properties().stacksTo(1) ); public static final Item GOLDEN_HORSE_ARMOR = registerItem( - "golden_horse_armor", new AnimalArmorItem(ArmorMaterials.GOLD, AnimalArmorItem.BodyType.EQUESTRIAN, false, new Item.Properties().stacksTo(1)) + "golden_horse_armor", + properties -> new AnimalArmorItem(ArmorMaterials.GOLD, AnimalArmorItem.BodyType.EQUESTRIAN, SoundEvents.HORSE_ARMOR, false, properties), + new Item.Properties().stacksTo(1) ); public static final Item DIAMOND_HORSE_ARMOR = registerItem( - "diamond_horse_armor", new AnimalArmorItem(ArmorMaterials.DIAMOND, AnimalArmorItem.BodyType.EQUESTRIAN, false, new Item.Properties().stacksTo(1)) + "diamond_horse_armor", + properties -> new AnimalArmorItem(ArmorMaterials.DIAMOND, AnimalArmorItem.BodyType.EQUESTRIAN, SoundEvents.HORSE_ARMOR, false, properties), + new Item.Properties().stacksTo(1) ); public static final Item LEATHER_HORSE_ARMOR = registerItem( - "leather_horse_armor", new AnimalArmorItem(ArmorMaterials.LEATHER, AnimalArmorItem.BodyType.EQUESTRIAN, false, new Item.Properties().stacksTo(1)) + "leather_horse_armor", + properties -> new AnimalArmorItem(ArmorMaterials.LEATHER, AnimalArmorItem.BodyType.EQUESTRIAN, SoundEvents.HORSE_ARMOR, false, properties), + new Item.Properties().stacksTo(1) ); - public static final Item LEAD = registerItem("lead", new LeadItem(new Item.Properties())); - public static final Item NAME_TAG = registerItem("name_tag", new NameTagItem(new Item.Properties())); + public static final Item LEAD = registerItem("lead", LeadItem::new); + public static final Item NAME_TAG = registerItem("name_tag", NameTagItem::new); public static final Item COMMAND_BLOCK_MINECART = registerItem( - "command_block_minecart", new MinecartItem(AbstractMinecart.Type.COMMAND_BLOCK, new Item.Properties().stacksTo(1).rarity(Rarity.EPIC)) + "command_block_minecart", + properties -> new MinecartItem(EntityType.COMMAND_BLOCK_MINECART, properties), + new Item.Properties().stacksTo(1).rarity(Rarity.EPIC) ); - public static final Item MUTTON = registerItem("mutton", new Item(new Item.Properties().food(Foods.MUTTON))); - public static final Item COOKED_MUTTON = registerItem("cooked_mutton", new Item(new Item.Properties().food(Foods.COOKED_MUTTON))); - public static final Item WHITE_BANNER = registerItem( - "white_banner", - new BannerItem( - Blocks.WHITE_BANNER, Blocks.WHITE_WALL_BANNER, new Item.Properties().stacksTo(16).component(DataComponents.BANNER_PATTERNS, BannerPatternLayers.EMPTY) - ) + public static final Item MUTTON = registerItem("mutton", new Item.Properties().food(Foods.MUTTON)); + public static final Item COOKED_MUTTON = registerItem("cooked_mutton", new Item.Properties().food(Foods.COOKED_MUTTON)); + public static final Item WHITE_BANNER = registerBlock( + Blocks.WHITE_BANNER, + (block, properties) -> new BannerItem(block, Blocks.WHITE_WALL_BANNER, properties), + new Item.Properties().stacksTo(16).component(DataComponents.BANNER_PATTERNS, BannerPatternLayers.EMPTY) ); - public static final Item ORANGE_BANNER = registerItem( - "orange_banner", - new BannerItem( - Blocks.ORANGE_BANNER, Blocks.ORANGE_WALL_BANNER, new Item.Properties().stacksTo(16).component(DataComponents.BANNER_PATTERNS, BannerPatternLayers.EMPTY) - ) + public static final Item ORANGE_BANNER = registerBlock( + Blocks.ORANGE_BANNER, + (block, properties) -> new BannerItem(block, Blocks.ORANGE_WALL_BANNER, properties), + new Item.Properties().stacksTo(16).component(DataComponents.BANNER_PATTERNS, BannerPatternLayers.EMPTY) ); - public static final Item MAGENTA_BANNER = registerItem( - "magenta_banner", - new BannerItem( - Blocks.MAGENTA_BANNER, Blocks.MAGENTA_WALL_BANNER, new Item.Properties().stacksTo(16).component(DataComponents.BANNER_PATTERNS, BannerPatternLayers.EMPTY) - ) + public static final Item MAGENTA_BANNER = registerBlock( + Blocks.MAGENTA_BANNER, + (block, properties) -> new BannerItem(block, Blocks.MAGENTA_WALL_BANNER, properties), + new Item.Properties().stacksTo(16).component(DataComponents.BANNER_PATTERNS, BannerPatternLayers.EMPTY) ); - public static final Item LIGHT_BLUE_BANNER = registerItem( - "light_blue_banner", - new BannerItem( - Blocks.LIGHT_BLUE_BANNER, - Blocks.LIGHT_BLUE_WALL_BANNER, - new Item.Properties().stacksTo(16).component(DataComponents.BANNER_PATTERNS, BannerPatternLayers.EMPTY) - ) + public static final Item LIGHT_BLUE_BANNER = registerBlock( + Blocks.LIGHT_BLUE_BANNER, + (block, properties) -> new BannerItem(block, Blocks.LIGHT_BLUE_WALL_BANNER, properties), + new Item.Properties().stacksTo(16).component(DataComponents.BANNER_PATTERNS, BannerPatternLayers.EMPTY) ); - public static final Item YELLOW_BANNER = registerItem( - "yellow_banner", - new BannerItem( - Blocks.YELLOW_BANNER, Blocks.YELLOW_WALL_BANNER, new Item.Properties().stacksTo(16).component(DataComponents.BANNER_PATTERNS, BannerPatternLayers.EMPTY) - ) + public static final Item YELLOW_BANNER = registerBlock( + Blocks.YELLOW_BANNER, + (block, properties) -> new BannerItem(block, Blocks.YELLOW_WALL_BANNER, properties), + new Item.Properties().stacksTo(16).component(DataComponents.BANNER_PATTERNS, BannerPatternLayers.EMPTY) ); - public static final Item LIME_BANNER = registerItem( - "lime_banner", - new BannerItem( - Blocks.LIME_BANNER, Blocks.LIME_WALL_BANNER, new Item.Properties().stacksTo(16).component(DataComponents.BANNER_PATTERNS, BannerPatternLayers.EMPTY) - ) + public static final Item LIME_BANNER = registerBlock( + Blocks.LIME_BANNER, + (block, properties) -> new BannerItem(block, Blocks.LIME_WALL_BANNER, properties), + new Item.Properties().stacksTo(16).component(DataComponents.BANNER_PATTERNS, BannerPatternLayers.EMPTY) ); - public static final Item PINK_BANNER = registerItem( - "pink_banner", - new BannerItem( - Blocks.PINK_BANNER, Blocks.PINK_WALL_BANNER, new Item.Properties().stacksTo(16).component(DataComponents.BANNER_PATTERNS, BannerPatternLayers.EMPTY) - ) + public static final Item PINK_BANNER = registerBlock( + Blocks.PINK_BANNER, + (block, properties) -> new BannerItem(block, Blocks.PINK_WALL_BANNER, properties), + new Item.Properties().stacksTo(16).component(DataComponents.BANNER_PATTERNS, BannerPatternLayers.EMPTY) ); - public static final Item GRAY_BANNER = registerItem( - "gray_banner", - new BannerItem( - Blocks.GRAY_BANNER, Blocks.GRAY_WALL_BANNER, new Item.Properties().stacksTo(16).component(DataComponents.BANNER_PATTERNS, BannerPatternLayers.EMPTY) - ) + public static final Item GRAY_BANNER = registerBlock( + Blocks.GRAY_BANNER, + (block, properties) -> new BannerItem(block, Blocks.GRAY_WALL_BANNER, properties), + new Item.Properties().stacksTo(16).component(DataComponents.BANNER_PATTERNS, BannerPatternLayers.EMPTY) ); - public static final Item LIGHT_GRAY_BANNER = registerItem( - "light_gray_banner", - new BannerItem( - Blocks.LIGHT_GRAY_BANNER, - Blocks.LIGHT_GRAY_WALL_BANNER, - new Item.Properties().stacksTo(16).component(DataComponents.BANNER_PATTERNS, BannerPatternLayers.EMPTY) - ) + public static final Item LIGHT_GRAY_BANNER = registerBlock( + Blocks.LIGHT_GRAY_BANNER, + (block, properties) -> new BannerItem(block, Blocks.LIGHT_GRAY_WALL_BANNER, properties), + new Item.Properties().stacksTo(16).component(DataComponents.BANNER_PATTERNS, BannerPatternLayers.EMPTY) ); - public static final Item CYAN_BANNER = registerItem( - "cyan_banner", - new BannerItem( - Blocks.CYAN_BANNER, Blocks.CYAN_WALL_BANNER, new Item.Properties().stacksTo(16).component(DataComponents.BANNER_PATTERNS, BannerPatternLayers.EMPTY) - ) + public static final Item CYAN_BANNER = registerBlock( + Blocks.CYAN_BANNER, + (block, properties) -> new BannerItem(block, Blocks.CYAN_WALL_BANNER, properties), + new Item.Properties().stacksTo(16).component(DataComponents.BANNER_PATTERNS, BannerPatternLayers.EMPTY) ); - public static final Item PURPLE_BANNER = registerItem( - "purple_banner", - new BannerItem( - Blocks.PURPLE_BANNER, Blocks.PURPLE_WALL_BANNER, new Item.Properties().stacksTo(16).component(DataComponents.BANNER_PATTERNS, BannerPatternLayers.EMPTY) - ) + public static final Item PURPLE_BANNER = registerBlock( + Blocks.PURPLE_BANNER, + (block, properties) -> new BannerItem(block, Blocks.PURPLE_WALL_BANNER, properties), + new Item.Properties().stacksTo(16).component(DataComponents.BANNER_PATTERNS, BannerPatternLayers.EMPTY) ); - public static final Item BLUE_BANNER = registerItem( - "blue_banner", - new BannerItem( - Blocks.BLUE_BANNER, Blocks.BLUE_WALL_BANNER, new Item.Properties().stacksTo(16).component(DataComponents.BANNER_PATTERNS, BannerPatternLayers.EMPTY) - ) + public static final Item BLUE_BANNER = registerBlock( + Blocks.BLUE_BANNER, + (block, properties) -> new BannerItem(block, Blocks.BLUE_WALL_BANNER, properties), + new Item.Properties().stacksTo(16).component(DataComponents.BANNER_PATTERNS, BannerPatternLayers.EMPTY) ); - public static final Item BROWN_BANNER = registerItem( - "brown_banner", - new BannerItem( - Blocks.BROWN_BANNER, Blocks.BROWN_WALL_BANNER, new Item.Properties().stacksTo(16).component(DataComponents.BANNER_PATTERNS, BannerPatternLayers.EMPTY) - ) + public static final Item BROWN_BANNER = registerBlock( + Blocks.BROWN_BANNER, + (block, properties) -> new BannerItem(block, Blocks.BROWN_WALL_BANNER, properties), + new Item.Properties().stacksTo(16).component(DataComponents.BANNER_PATTERNS, BannerPatternLayers.EMPTY) ); - public static final Item GREEN_BANNER = registerItem( - "green_banner", - new BannerItem( - Blocks.GREEN_BANNER, Blocks.GREEN_WALL_BANNER, new Item.Properties().stacksTo(16).component(DataComponents.BANNER_PATTERNS, BannerPatternLayers.EMPTY) - ) + public static final Item GREEN_BANNER = registerBlock( + Blocks.GREEN_BANNER, + (block, properties) -> new BannerItem(block, Blocks.GREEN_WALL_BANNER, properties), + new Item.Properties().stacksTo(16).component(DataComponents.BANNER_PATTERNS, BannerPatternLayers.EMPTY) ); - public static final Item RED_BANNER = registerItem( - "red_banner", - new BannerItem( - Blocks.RED_BANNER, Blocks.RED_WALL_BANNER, new Item.Properties().stacksTo(16).component(DataComponents.BANNER_PATTERNS, BannerPatternLayers.EMPTY) - ) + public static final Item RED_BANNER = registerBlock( + Blocks.RED_BANNER, + (block, properties) -> new BannerItem(block, Blocks.RED_WALL_BANNER, properties), + new Item.Properties().stacksTo(16).component(DataComponents.BANNER_PATTERNS, BannerPatternLayers.EMPTY) ); - public static final Item BLACK_BANNER = registerItem( - "black_banner", - new BannerItem( - Blocks.BLACK_BANNER, Blocks.BLACK_WALL_BANNER, new Item.Properties().stacksTo(16).component(DataComponents.BANNER_PATTERNS, BannerPatternLayers.EMPTY) - ) + public static final Item BLACK_BANNER = registerBlock( + Blocks.BLACK_BANNER, + (block, properties) -> new BannerItem(block, Blocks.BLACK_WALL_BANNER, properties), + new Item.Properties().stacksTo(16).component(DataComponents.BANNER_PATTERNS, BannerPatternLayers.EMPTY) ); public static final Item END_CRYSTAL = registerItem( - "end_crystal", new EndCrystalItem(new Item.Properties().rarity(Rarity.RARE).component(DataComponents.ENCHANTMENT_GLINT_OVERRIDE, true)) + "end_crystal", EndCrystalItem::new, new Item.Properties().component(DataComponents.ENCHANTMENT_GLINT_OVERRIDE, true) ); - public static final Item CHORUS_FRUIT = registerItem("chorus_fruit", new ChorusFruitItem(new Item.Properties().food(Foods.CHORUS_FRUIT))); - public static final Item POPPED_CHORUS_FRUIT = registerItem("popped_chorus_fruit", new Item(new Item.Properties())); - public static final Item TORCHFLOWER_SEEDS = registerItem("torchflower_seeds", new ItemNameBlockItem(Blocks.TORCHFLOWER_CROP, new Item.Properties())); - public static final Item PITCHER_POD = registerItem("pitcher_pod", new ItemNameBlockItem(Blocks.PITCHER_CROP, new Item.Properties())); - public static final Item BEETROOT = registerItem("beetroot", new Item(new Item.Properties().food(Foods.BEETROOT))); - public static final Item BEETROOT_SEEDS = registerItem("beetroot_seeds", new ItemNameBlockItem(Blocks.BEETROOTS, new Item.Properties())); - public static final Item BEETROOT_SOUP = registerItem("beetroot_soup", new Item(new Item.Properties().stacksTo(1).food(Foods.BEETROOT_SOUP))); - public static final Item DRAGON_BREATH = registerItem("dragon_breath", new Item(new Item.Properties().craftRemainder(GLASS_BOTTLE).rarity(Rarity.UNCOMMON))); + public static final Item CHORUS_FRUIT = registerItem( + "chorus_fruit", new Item.Properties().food(Foods.CHORUS_FRUIT, Consumables.CHORUS_FRUIT).useCooldown(1.0F) + ); + public static final Item POPPED_CHORUS_FRUIT = registerItem("popped_chorus_fruit"); + public static final Item TORCHFLOWER_SEEDS = registerItem("torchflower_seeds", createBlockItemWithCustomItemName(Blocks.TORCHFLOWER_CROP)); + public static final Item PITCHER_POD = registerItem("pitcher_pod", createBlockItemWithCustomItemName(Blocks.PITCHER_CROP)); + public static final Item BEETROOT = registerItem("beetroot", new Item.Properties().food(Foods.BEETROOT)); + public static final Item BEETROOT_SEEDS = registerItem("beetroot_seeds", createBlockItemWithCustomItemName(Blocks.BEETROOTS)); + public static final Item BEETROOT_SOUP = registerItem("beetroot_soup", new Item.Properties().stacksTo(1).food(Foods.BEETROOT_SOUP).usingConvertsTo(BOWL)); + public static final Item DRAGON_BREATH = registerItem("dragon_breath", new Item.Properties().craftRemainder(GLASS_BOTTLE).rarity(Rarity.UNCOMMON)); public static final Item SPLASH_POTION = registerItem( - "splash_potion", new SplashPotionItem(new Item.Properties().stacksTo(1).component(DataComponents.POTION_CONTENTS, PotionContents.EMPTY)) + "splash_potion", SplashPotionItem::new, new Item.Properties().stacksTo(1).component(DataComponents.POTION_CONTENTS, PotionContents.EMPTY) ); - public static final Item SPECTRAL_ARROW = registerItem("spectral_arrow", new SpectralArrowItem(new Item.Properties())); + public static final Item SPECTRAL_ARROW = registerItem("spectral_arrow", SpectralArrowItem::new); public static final Item TIPPED_ARROW = registerItem( - "tipped_arrow", new TippedArrowItem(new Item.Properties().component(DataComponents.POTION_CONTENTS, PotionContents.EMPTY)) + "tipped_arrow", TippedArrowItem::new, new Item.Properties().component(DataComponents.POTION_CONTENTS, PotionContents.EMPTY) ); public static final Item LINGERING_POTION = registerItem( - "lingering_potion", new LingeringPotionItem(new Item.Properties().stacksTo(1).component(DataComponents.POTION_CONTENTS, PotionContents.EMPTY)) + "lingering_potion", LingeringPotionItem::new, new Item.Properties().stacksTo(1).component(DataComponents.POTION_CONTENTS, PotionContents.EMPTY) ); public static final Item SHIELD = registerItem( - "shield", new ShieldItem(new Item.Properties().durability(336).component(DataComponents.BANNER_PATTERNS, BannerPatternLayers.EMPTY)) + "shield", + ShieldItem::new, + new Item.Properties() + .durability(336) + .component(DataComponents.BANNER_PATTERNS, BannerPatternLayers.EMPTY) + .repairable(ItemTags.WOODEN_TOOL_MATERIALS) + .equippableUnswappable(EquipmentSlot.OFFHAND) ); - public static final Item TOTEM_OF_UNDYING = registerItem("totem_of_undying", new Item(new Item.Properties().stacksTo(1).rarity(Rarity.UNCOMMON))); - public static final Item SHULKER_SHELL = registerItem("shulker_shell", new Item(new Item.Properties())); - public static final Item IRON_NUGGET = registerItem("iron_nugget", new Item(new Item.Properties())); + public static final Item TOTEM_OF_UNDYING = registerItem( + "totem_of_undying", new Item.Properties().stacksTo(1).rarity(Rarity.UNCOMMON).component(DataComponents.DEATH_PROTECTION, DeathProtection.TOTEM_OF_UNDYING) + ); + public static final Item SHULKER_SHELL = registerItem("shulker_shell"); + public static final Item IRON_NUGGET = registerItem("iron_nugget"); public static final Item KNOWLEDGE_BOOK = registerItem( - "knowledge_book", new KnowledgeBookItem(new Item.Properties().stacksTo(1).rarity(Rarity.EPIC).component(DataComponents.RECIPES, List.of())) + "knowledge_book", KnowledgeBookItem::new, new Item.Properties().stacksTo(1).rarity(Rarity.EPIC).component(DataComponents.RECIPES, List.of()) ); public static final Item DEBUG_STICK = registerItem( "debug_stick", - new DebugStickItem( - new Item.Properties() - .stacksTo(1) - .rarity(Rarity.EPIC) - .component(DataComponents.DEBUG_STICK_STATE, DebugStickState.EMPTY) - .component(DataComponents.ENCHANTMENT_GLINT_OVERRIDE, true) - ) + DebugStickItem::new, + new Item.Properties() + .stacksTo(1) + .rarity(Rarity.EPIC) + .component(DataComponents.DEBUG_STICK_STATE, DebugStickState.EMPTY) + .component(DataComponents.ENCHANTMENT_GLINT_OVERRIDE, true) ); public static final Item MUSIC_DISC_13 = registerItem( - "music_disc_13", new Item(new Item.Properties().stacksTo(1).rarity(Rarity.RARE).jukeboxPlayable(JukeboxSongs.THIRTEEN)) + "music_disc_13", new Item.Properties().stacksTo(1).rarity(Rarity.UNCOMMON).jukeboxPlayable(JukeboxSongs.THIRTEEN) ); public static final Item MUSIC_DISC_CAT = registerItem( - "music_disc_cat", new Item(new Item.Properties().stacksTo(1).rarity(Rarity.RARE).jukeboxPlayable(JukeboxSongs.CAT)) + "music_disc_cat", new Item.Properties().stacksTo(1).rarity(Rarity.UNCOMMON).jukeboxPlayable(JukeboxSongs.CAT) ); public static final Item MUSIC_DISC_BLOCKS = registerItem( - "music_disc_blocks", new Item(new Item.Properties().stacksTo(1).rarity(Rarity.RARE).jukeboxPlayable(JukeboxSongs.BLOCKS)) + "music_disc_blocks", new Item.Properties().stacksTo(1).rarity(Rarity.UNCOMMON).jukeboxPlayable(JukeboxSongs.BLOCKS) ); public static final Item MUSIC_DISC_CHIRP = registerItem( - "music_disc_chirp", new Item(new Item.Properties().stacksTo(1).rarity(Rarity.RARE).jukeboxPlayable(JukeboxSongs.CHIRP)) + "music_disc_chirp", new Item.Properties().stacksTo(1).rarity(Rarity.UNCOMMON).jukeboxPlayable(JukeboxSongs.CHIRP) ); public static final Item MUSIC_DISC_CREATOR = registerItem( - "music_disc_creator", new Item(new Item.Properties().stacksTo(1).rarity(Rarity.RARE).jukeboxPlayable(JukeboxSongs.CREATOR)) + "music_disc_creator", new Item.Properties().stacksTo(1).rarity(Rarity.RARE).jukeboxPlayable(JukeboxSongs.CREATOR) ); public static final Item MUSIC_DISC_CREATOR_MUSIC_BOX = registerItem( - "music_disc_creator_music_box", new Item(new Item.Properties().stacksTo(1).rarity(Rarity.RARE).jukeboxPlayable(JukeboxSongs.CREATOR_MUSIC_BOX)) + "music_disc_creator_music_box", new Item.Properties().stacksTo(1).rarity(Rarity.UNCOMMON).jukeboxPlayable(JukeboxSongs.CREATOR_MUSIC_BOX) ); public static final Item MUSIC_DISC_FAR = registerItem( - "music_disc_far", new Item(new Item.Properties().stacksTo(1).rarity(Rarity.RARE).jukeboxPlayable(JukeboxSongs.FAR)) + "music_disc_far", new Item.Properties().stacksTo(1).rarity(Rarity.UNCOMMON).jukeboxPlayable(JukeboxSongs.FAR) ); public static final Item MUSIC_DISC_MALL = registerItem( - "music_disc_mall", new Item(new Item.Properties().stacksTo(1).rarity(Rarity.RARE).jukeboxPlayable(JukeboxSongs.MALL)) + "music_disc_mall", new Item.Properties().stacksTo(1).rarity(Rarity.UNCOMMON).jukeboxPlayable(JukeboxSongs.MALL) ); public static final Item MUSIC_DISC_MELLOHI = registerItem( - "music_disc_mellohi", new Item(new Item.Properties().stacksTo(1).rarity(Rarity.RARE).jukeboxPlayable(JukeboxSongs.MELLOHI)) + "music_disc_mellohi", new Item.Properties().stacksTo(1).rarity(Rarity.UNCOMMON).jukeboxPlayable(JukeboxSongs.MELLOHI) ); public static final Item MUSIC_DISC_STAL = registerItem( - "music_disc_stal", new Item(new Item.Properties().stacksTo(1).rarity(Rarity.RARE).jukeboxPlayable(JukeboxSongs.STAL)) + "music_disc_stal", new Item.Properties().stacksTo(1).rarity(Rarity.UNCOMMON).jukeboxPlayable(JukeboxSongs.STAL) ); public static final Item MUSIC_DISC_STRAD = registerItem( - "music_disc_strad", new Item(new Item.Properties().stacksTo(1).rarity(Rarity.RARE).jukeboxPlayable(JukeboxSongs.STRAD)) + "music_disc_strad", new Item.Properties().stacksTo(1).rarity(Rarity.UNCOMMON).jukeboxPlayable(JukeboxSongs.STRAD) ); public static final Item MUSIC_DISC_WARD = registerItem( - "music_disc_ward", new Item(new Item.Properties().stacksTo(1).rarity(Rarity.RARE).jukeboxPlayable(JukeboxSongs.WARD)) + "music_disc_ward", new Item.Properties().stacksTo(1).rarity(Rarity.UNCOMMON).jukeboxPlayable(JukeboxSongs.WARD) ); public static final Item MUSIC_DISC_11 = registerItem( - "music_disc_11", new Item(new Item.Properties().stacksTo(1).rarity(Rarity.RARE).jukeboxPlayable(JukeboxSongs.ELEVEN)) + "music_disc_11", new Item.Properties().stacksTo(1).rarity(Rarity.UNCOMMON).jukeboxPlayable(JukeboxSongs.ELEVEN) ); public static final Item MUSIC_DISC_WAIT = registerItem( - "music_disc_wait", new Item(new Item.Properties().stacksTo(1).rarity(Rarity.RARE).jukeboxPlayable(JukeboxSongs.WAIT)) + "music_disc_wait", new Item.Properties().stacksTo(1).rarity(Rarity.UNCOMMON).jukeboxPlayable(JukeboxSongs.WAIT) ); public static final Item MUSIC_DISC_OTHERSIDE = registerItem( - "music_disc_otherside", new Item(new Item.Properties().stacksTo(1).rarity(Rarity.RARE).jukeboxPlayable(JukeboxSongs.OTHERSIDE)) + "music_disc_otherside", new Item.Properties().stacksTo(1).rarity(Rarity.RARE).jukeboxPlayable(JukeboxSongs.OTHERSIDE) ); public static final Item MUSIC_DISC_RELIC = registerItem( - "music_disc_relic", new Item(new Item.Properties().stacksTo(1).rarity(Rarity.RARE).jukeboxPlayable(JukeboxSongs.RELIC)) + "music_disc_relic", new Item.Properties().stacksTo(1).rarity(Rarity.UNCOMMON).jukeboxPlayable(JukeboxSongs.RELIC) ); public static final Item MUSIC_DISC_5 = registerItem( - "music_disc_5", new Item(new Item.Properties().stacksTo(1).rarity(Rarity.RARE).jukeboxPlayable(JukeboxSongs.FIVE)) + "music_disc_5", new Item.Properties().stacksTo(1).rarity(Rarity.UNCOMMON).jukeboxPlayable(JukeboxSongs.FIVE) ); public static final Item MUSIC_DISC_PIGSTEP = registerItem( - "music_disc_pigstep", new Item(new Item.Properties().stacksTo(1).rarity(Rarity.RARE).jukeboxPlayable(JukeboxSongs.PIGSTEP)) + "music_disc_pigstep", new Item.Properties().stacksTo(1).rarity(Rarity.RARE).jukeboxPlayable(JukeboxSongs.PIGSTEP) ); public static final Item MUSIC_DISC_PRECIPICE = registerItem( - "music_disc_precipice", new Item(new Item.Properties().stacksTo(1).rarity(Rarity.RARE).jukeboxPlayable(JukeboxSongs.PRECIPICE)) + "music_disc_precipice", new Item.Properties().stacksTo(1).rarity(Rarity.UNCOMMON).jukeboxPlayable(JukeboxSongs.PRECIPICE) ); - public static final Item DISC_FRAGMENT_5 = registerItem("disc_fragment_5", new DiscFragmentItem(new Item.Properties())); + public static final Item DISC_FRAGMENT_5 = registerItem("disc_fragment_5", DiscFragmentItem::new, new Item.Properties().rarity(Rarity.UNCOMMON)); public static final Item TRIDENT = registerItem( "trident", - new TridentItem( - new Item.Properties() - .rarity(Rarity.EPIC) - .durability(250) - .attributes(TridentItem.createAttributes()) - .component(DataComponents.TOOL, TridentItem.createToolProperties()) - ) + TridentItem::new, + new Item.Properties() + .rarity(Rarity.RARE) + .durability(250) + .attributes(TridentItem.createAttributes()) + .component(DataComponents.TOOL, TridentItem.createToolProperties()) + .enchantable(1) + .overrideModel(ResourceLocation.withDefaultNamespace("trident_in_hand")) ); - public static final Item PHANTOM_MEMBRANE = registerItem("phantom_membrane", new Item(new Item.Properties())); - public static final Item NAUTILUS_SHELL = registerItem("nautilus_shell", new Item(new Item.Properties())); - public static final Item HEART_OF_THE_SEA = registerItem("heart_of_the_sea", new Item(new Item.Properties().rarity(Rarity.UNCOMMON))); + public static final Item NAUTILUS_SHELL = registerItem("nautilus_shell", new Item.Properties().rarity(Rarity.UNCOMMON)); + public static final Item HEART_OF_THE_SEA = registerItem("heart_of_the_sea", new Item.Properties().rarity(Rarity.UNCOMMON)); public static final Item CROSSBOW = registerItem( - "crossbow", new CrossbowItem(new Item.Properties().stacksTo(1).durability(465).component(DataComponents.CHARGED_PROJECTILES, ChargedProjectiles.EMPTY)) + "crossbow", + CrossbowItem::new, + new Item.Properties().stacksTo(1).durability(465).component(DataComponents.CHARGED_PROJECTILES, ChargedProjectiles.EMPTY).enchantable(1) ); public static final Item SUSPICIOUS_STEW = registerItem( "suspicious_stew", - new SuspiciousStewItem( - new Item.Properties().stacksTo(1).food(Foods.SUSPICIOUS_STEW).component(DataComponents.SUSPICIOUS_STEW_EFFECTS, SuspiciousStewEffects.EMPTY) - ) + new Item.Properties() + .stacksTo(1) + .food(Foods.SUSPICIOUS_STEW) + .component(DataComponents.SUSPICIOUS_STEW_EFFECTS, SuspiciousStewEffects.EMPTY) + .usingConvertsTo(BOWL) ); public static final Item LOOM = registerBlock(Blocks.LOOM); public static final Item FLOWER_BANNER_PATTERN = registerItem( - "flower_banner_pattern", new BannerPatternItem(BannerPatternTags.PATTERN_ITEM_FLOWER, new Item.Properties().stacksTo(1)) + "flower_banner_pattern", properties -> new BannerPatternItem(BannerPatternTags.PATTERN_ITEM_FLOWER, properties), new Item.Properties().stacksTo(1) ); public static final Item CREEPER_BANNER_PATTERN = registerItem( - "creeper_banner_pattern", new BannerPatternItem(BannerPatternTags.PATTERN_ITEM_CREEPER, new Item.Properties().stacksTo(1).rarity(Rarity.UNCOMMON)) + "creeper_banner_pattern", + properties -> new BannerPatternItem(BannerPatternTags.PATTERN_ITEM_CREEPER, properties), + new Item.Properties().stacksTo(1).rarity(Rarity.UNCOMMON) ); public static final Item SKULL_BANNER_PATTERN = registerItem( - "skull_banner_pattern", new BannerPatternItem(BannerPatternTags.PATTERN_ITEM_SKULL, new Item.Properties().stacksTo(1).rarity(Rarity.UNCOMMON)) + "skull_banner_pattern", + properties -> new BannerPatternItem(BannerPatternTags.PATTERN_ITEM_SKULL, properties), + new Item.Properties().stacksTo(1).rarity(Rarity.RARE) ); public static final Item MOJANG_BANNER_PATTERN = registerItem( - "mojang_banner_pattern", new BannerPatternItem(BannerPatternTags.PATTERN_ITEM_MOJANG, new Item.Properties().stacksTo(1).rarity(Rarity.EPIC)) + "mojang_banner_pattern", + properties -> new BannerPatternItem(BannerPatternTags.PATTERN_ITEM_MOJANG, properties), + new Item.Properties().stacksTo(1).rarity(Rarity.RARE) ); public static final Item GLOBE_BANNER_PATTERN = registerItem( - "globe_banner_pattern", new BannerPatternItem(BannerPatternTags.PATTERN_ITEM_GLOBE, new Item.Properties().stacksTo(1)) + "globe_banner_pattern", properties -> new BannerPatternItem(BannerPatternTags.PATTERN_ITEM_GLOBE, properties), new Item.Properties().stacksTo(1) ); public static final Item PIGLIN_BANNER_PATTERN = registerItem( - "piglin_banner_pattern", new BannerPatternItem(BannerPatternTags.PATTERN_ITEM_PIGLIN, new Item.Properties().stacksTo(1).rarity(Rarity.UNCOMMON)) + "piglin_banner_pattern", + properties -> new BannerPatternItem(BannerPatternTags.PATTERN_ITEM_PIGLIN, properties), + new Item.Properties().stacksTo(1).rarity(Rarity.UNCOMMON) ); public static final Item FLOW_BANNER_PATTERN = registerItem( - "flow_banner_pattern", new BannerPatternItem(BannerPatternTags.PATTERN_ITEM_FLOW, new Item.Properties().stacksTo(1).rarity(Rarity.RARE)) + "flow_banner_pattern", + properties -> new BannerPatternItem(BannerPatternTags.PATTERN_ITEM_FLOW, properties), + new Item.Properties().stacksTo(1).rarity(Rarity.RARE) ); public static final Item GUSTER_BANNER_PATTERN = registerItem( - "guster_banner_pattern", new BannerPatternItem(BannerPatternTags.PATTERN_ITEM_GUSTER, new Item.Properties().stacksTo(1).rarity(Rarity.RARE)) + "guster_banner_pattern", + properties -> new BannerPatternItem(BannerPatternTags.PATTERN_ITEM_GUSTER, properties), + new Item.Properties().stacksTo(1).rarity(Rarity.RARE) + ); + public static final Item FIELD_MASONED_BANNER_PATTERN = registerItem( + "field_masoned_banner_pattern", + properties -> new BannerPatternItem(BannerPatternTags.PATTERN_ITEM_FIELD_MASONED, properties), + new Item.Properties().stacksTo(1) + ); + public static final Item BORDURE_INDENTED_BANNER_PATTERN = registerItem( + "bordure_indented_banner_pattern", + properties -> new BannerPatternItem(BannerPatternTags.PATTERN_ITEM_BORDURE_INDENTED, properties), + new Item.Properties().stacksTo(1) + ); + public static final Item GOAT_HORN = registerItem( + "goat_horn", properties -> new InstrumentItem(InstrumentTags.GOAT_HORNS, properties), new Item.Properties().rarity(Rarity.UNCOMMON).stacksTo(1) ); - public static final Item GOAT_HORN = registerItem("goat_horn", new InstrumentItem(new Item.Properties().stacksTo(1), InstrumentTags.GOAT_HORNS)); public static final Item COMPOSTER = registerBlock(Blocks.COMPOSTER); - public static final Item BARREL = registerBlock(Blocks.BARREL, properties -> properties.component(DataComponents.CONTAINER, ItemContainerContents.EMPTY)); - public static final Item SMOKER = registerBlock(Blocks.SMOKER, properties -> properties.component(DataComponents.CONTAINER, ItemContainerContents.EMPTY)); + public static final Item BARREL = registerBlock( + Blocks.BARREL, (UnaryOperator)(properties -> properties.component(DataComponents.CONTAINER, ItemContainerContents.EMPTY)) + ); + public static final Item SMOKER = registerBlock( + Blocks.SMOKER, (UnaryOperator)(properties -> properties.component(DataComponents.CONTAINER, ItemContainerContents.EMPTY)) + ); public static final Item BLAST_FURNACE = registerBlock( - Blocks.BLAST_FURNACE, properties -> properties.component(DataComponents.CONTAINER, ItemContainerContents.EMPTY) + Blocks.BLAST_FURNACE, (UnaryOperator)(properties -> properties.component(DataComponents.CONTAINER, ItemContainerContents.EMPTY)) ); public static final Item CARTOGRAPHY_TABLE = registerBlock(Blocks.CARTOGRAPHY_TABLE); public static final Item FLETCHING_TABLE = registerBlock(Blocks.FLETCHING_TABLE); @@ -1844,19 +2141,24 @@ public class Items { public static final Item LANTERN = registerBlock(Blocks.LANTERN); public static final Item SOUL_LANTERN = registerBlock(Blocks.SOUL_LANTERN); public static final Item SWEET_BERRIES = registerItem( - "sweet_berries", new ItemNameBlockItem(Blocks.SWEET_BERRY_BUSH, new Item.Properties().food(Foods.SWEET_BERRIES)) + "sweet_berries", createBlockItemWithCustomItemName(Blocks.SWEET_BERRY_BUSH), new Item.Properties().food(Foods.SWEET_BERRIES) + ); + public static final Item GLOW_BERRIES = registerItem( + "glow_berries", createBlockItemWithCustomItemName(Blocks.CAVE_VINES), new Item.Properties().food(Foods.GLOW_BERRIES) + ); + public static final Item CAMPFIRE = registerBlock( + Blocks.CAMPFIRE, (UnaryOperator)(properties -> properties.component(DataComponents.CONTAINER, ItemContainerContents.EMPTY)) ); - public static final Item GLOW_BERRIES = registerItem("glow_berries", new ItemNameBlockItem(Blocks.CAVE_VINES, new Item.Properties().food(Foods.GLOW_BERRIES))); - public static final Item CAMPFIRE = registerBlock(Blocks.CAMPFIRE, properties -> properties.component(DataComponents.CONTAINER, ItemContainerContents.EMPTY)); public static final Item SOUL_CAMPFIRE = registerBlock( - Blocks.SOUL_CAMPFIRE, properties -> properties.component(DataComponents.CONTAINER, ItemContainerContents.EMPTY) + Blocks.SOUL_CAMPFIRE, (UnaryOperator)(properties -> properties.component(DataComponents.CONTAINER, ItemContainerContents.EMPTY)) ); public static final Item SHROOMLIGHT = registerBlock(Blocks.SHROOMLIGHT); - public static final Item HONEYCOMB = registerItem("honeycomb", new HoneycombItem(new Item.Properties())); - public static final Item BEE_NEST = registerBlock(new BlockItem(Blocks.BEE_NEST, new Item.Properties().component(DataComponents.BEES, List.of()))); - public static final Item BEEHIVE = registerBlock(new BlockItem(Blocks.BEEHIVE, new Item.Properties().component(DataComponents.BEES, List.of()))); + public static final Item HONEYCOMB = registerItem("honeycomb", HoneycombItem::new); + public static final Item BEE_NEST = registerBlock(Blocks.BEE_NEST, new Item.Properties().component(DataComponents.BEES, List.of())); + public static final Item BEEHIVE = registerBlock(Blocks.BEEHIVE, new Item.Properties().component(DataComponents.BEES, List.of())); public static final Item HONEY_BOTTLE = registerItem( - "honey_bottle", new HoneyBottleItem(new Item.Properties().craftRemainder(GLASS_BOTTLE).food(Foods.HONEY_BOTTLE).stacksTo(16)) + "honey_bottle", + new Item.Properties().craftRemainder(GLASS_BOTTLE).food(Foods.HONEY_BOTTLE, Consumables.HONEY_BOTTLE).usingConvertsTo(GLASS_BOTTLE).stacksTo(16) ); public static final Item HONEYCOMB_BLOCK = registerBlock(Blocks.HONEYCOMB_BLOCK); public static final Item LODESTONE = registerBlock(Blocks.LODESTONE); @@ -1899,89 +2201,89 @@ public class Items { public static final Item OCHRE_FROGLIGHT = registerBlock(Blocks.OCHRE_FROGLIGHT); public static final Item VERDANT_FROGLIGHT = registerBlock(Blocks.VERDANT_FROGLIGHT); public static final Item PEARLESCENT_FROGLIGHT = registerBlock(Blocks.PEARLESCENT_FROGLIGHT); - public static final Item FROGSPAWN = registerBlock(new PlaceOnWaterBlockItem(Blocks.FROGSPAWN, new Item.Properties())); - public static final Item ECHO_SHARD = registerItem("echo_shard", new Item(new Item.Properties())); - public static final Item BRUSH = registerItem("brush", new BrushItem(new Item.Properties().durability(64))); + public static final Item FROGSPAWN = registerBlock(Blocks.FROGSPAWN, PlaceOnWaterBlockItem::new); + public static final Item ECHO_SHARD = registerItem("echo_shard", new Item.Properties().rarity(Rarity.UNCOMMON)); + public static final Item BRUSH = registerItem("brush", BrushItem::new, new Item.Properties().durability(64)); public static final Item NETHERITE_UPGRADE_SMITHING_TEMPLATE = registerItem( - "netherite_upgrade_smithing_template", SmithingTemplateItem.createNetheriteUpgradeTemplate() + "netherite_upgrade_smithing_template", SmithingTemplateItem::createNetheriteUpgradeTemplate, new Item.Properties().rarity(Rarity.UNCOMMON) ); public static final Item SENTRY_ARMOR_TRIM_SMITHING_TEMPLATE = registerItem( - "sentry_armor_trim_smithing_template", SmithingTemplateItem.createArmorTrimTemplate(TrimPatterns.SENTRY) + "sentry_armor_trim_smithing_template", SmithingTemplateItem::createArmorTrimTemplate, new Item.Properties().rarity(Rarity.UNCOMMON) ); public static final Item DUNE_ARMOR_TRIM_SMITHING_TEMPLATE = registerItem( - "dune_armor_trim_smithing_template", SmithingTemplateItem.createArmorTrimTemplate(TrimPatterns.DUNE) + "dune_armor_trim_smithing_template", SmithingTemplateItem::createArmorTrimTemplate, new Item.Properties().rarity(Rarity.UNCOMMON) ); public static final Item COAST_ARMOR_TRIM_SMITHING_TEMPLATE = registerItem( - "coast_armor_trim_smithing_template", SmithingTemplateItem.createArmorTrimTemplate(TrimPatterns.COAST) + "coast_armor_trim_smithing_template", SmithingTemplateItem::createArmorTrimTemplate, new Item.Properties().rarity(Rarity.UNCOMMON) ); public static final Item WILD_ARMOR_TRIM_SMITHING_TEMPLATE = registerItem( - "wild_armor_trim_smithing_template", SmithingTemplateItem.createArmorTrimTemplate(TrimPatterns.WILD) + "wild_armor_trim_smithing_template", SmithingTemplateItem::createArmorTrimTemplate, new Item.Properties().rarity(Rarity.UNCOMMON) ); public static final Item WARD_ARMOR_TRIM_SMITHING_TEMPLATE = registerItem( - "ward_armor_trim_smithing_template", SmithingTemplateItem.createArmorTrimTemplate(TrimPatterns.WARD) + "ward_armor_trim_smithing_template", SmithingTemplateItem::createArmorTrimTemplate, new Item.Properties().rarity(Rarity.RARE) ); public static final Item EYE_ARMOR_TRIM_SMITHING_TEMPLATE = registerItem( - "eye_armor_trim_smithing_template", SmithingTemplateItem.createArmorTrimTemplate(TrimPatterns.EYE) + "eye_armor_trim_smithing_template", SmithingTemplateItem::createArmorTrimTemplate, new Item.Properties().rarity(Rarity.RARE) ); public static final Item VEX_ARMOR_TRIM_SMITHING_TEMPLATE = registerItem( - "vex_armor_trim_smithing_template", SmithingTemplateItem.createArmorTrimTemplate(TrimPatterns.VEX) + "vex_armor_trim_smithing_template", SmithingTemplateItem::createArmorTrimTemplate, new Item.Properties().rarity(Rarity.RARE) ); public static final Item TIDE_ARMOR_TRIM_SMITHING_TEMPLATE = registerItem( - "tide_armor_trim_smithing_template", SmithingTemplateItem.createArmorTrimTemplate(TrimPatterns.TIDE) + "tide_armor_trim_smithing_template", SmithingTemplateItem::createArmorTrimTemplate, new Item.Properties().rarity(Rarity.UNCOMMON) ); public static final Item SNOUT_ARMOR_TRIM_SMITHING_TEMPLATE = registerItem( - "snout_armor_trim_smithing_template", SmithingTemplateItem.createArmorTrimTemplate(TrimPatterns.SNOUT) + "snout_armor_trim_smithing_template", SmithingTemplateItem::createArmorTrimTemplate, new Item.Properties().rarity(Rarity.UNCOMMON) ); public static final Item RIB_ARMOR_TRIM_SMITHING_TEMPLATE = registerItem( - "rib_armor_trim_smithing_template", SmithingTemplateItem.createArmorTrimTemplate(TrimPatterns.RIB) + "rib_armor_trim_smithing_template", SmithingTemplateItem::createArmorTrimTemplate, new Item.Properties().rarity(Rarity.UNCOMMON) ); public static final Item SPIRE_ARMOR_TRIM_SMITHING_TEMPLATE = registerItem( - "spire_armor_trim_smithing_template", SmithingTemplateItem.createArmorTrimTemplate(TrimPatterns.SPIRE) + "spire_armor_trim_smithing_template", SmithingTemplateItem::createArmorTrimTemplate, new Item.Properties().rarity(Rarity.RARE) ); public static final Item WAYFINDER_ARMOR_TRIM_SMITHING_TEMPLATE = registerItem( - "wayfinder_armor_trim_smithing_template", SmithingTemplateItem.createArmorTrimTemplate(TrimPatterns.WAYFINDER) + "wayfinder_armor_trim_smithing_template", SmithingTemplateItem::createArmorTrimTemplate, new Item.Properties().rarity(Rarity.UNCOMMON) ); public static final Item SHAPER_ARMOR_TRIM_SMITHING_TEMPLATE = registerItem( - "shaper_armor_trim_smithing_template", SmithingTemplateItem.createArmorTrimTemplate(TrimPatterns.SHAPER) + "shaper_armor_trim_smithing_template", SmithingTemplateItem::createArmorTrimTemplate, new Item.Properties().rarity(Rarity.UNCOMMON) ); public static final Item SILENCE_ARMOR_TRIM_SMITHING_TEMPLATE = registerItem( - "silence_armor_trim_smithing_template", SmithingTemplateItem.createArmorTrimTemplate(TrimPatterns.SILENCE) + "silence_armor_trim_smithing_template", SmithingTemplateItem::createArmorTrimTemplate, new Item.Properties().rarity(Rarity.EPIC) ); public static final Item RAISER_ARMOR_TRIM_SMITHING_TEMPLATE = registerItem( - "raiser_armor_trim_smithing_template", SmithingTemplateItem.createArmorTrimTemplate(TrimPatterns.RAISER) + "raiser_armor_trim_smithing_template", SmithingTemplateItem::createArmorTrimTemplate, new Item.Properties().rarity(Rarity.UNCOMMON) ); public static final Item HOST_ARMOR_TRIM_SMITHING_TEMPLATE = registerItem( - "host_armor_trim_smithing_template", SmithingTemplateItem.createArmorTrimTemplate(TrimPatterns.HOST) + "host_armor_trim_smithing_template", SmithingTemplateItem::createArmorTrimTemplate, new Item.Properties().rarity(Rarity.UNCOMMON) ); public static final Item FLOW_ARMOR_TRIM_SMITHING_TEMPLATE = registerItem( - "flow_armor_trim_smithing_template", SmithingTemplateItem.createArmorTrimTemplate(TrimPatterns.FLOW) + "flow_armor_trim_smithing_template", SmithingTemplateItem::createArmorTrimTemplate, new Item.Properties().rarity(Rarity.UNCOMMON) ); public static final Item BOLT_ARMOR_TRIM_SMITHING_TEMPLATE = registerItem( - "bolt_armor_trim_smithing_template", SmithingTemplateItem.createArmorTrimTemplate(TrimPatterns.BOLT) + "bolt_armor_trim_smithing_template", SmithingTemplateItem::createArmorTrimTemplate, new Item.Properties().rarity(Rarity.UNCOMMON) ); - public static final Item ANGLER_POTTERY_SHERD = registerItem("angler_pottery_sherd", new Item(new Item.Properties())); - public static final Item ARCHER_POTTERY_SHERD = registerItem("archer_pottery_sherd", new Item(new Item.Properties())); - public static final Item ARMS_UP_POTTERY_SHERD = registerItem("arms_up_pottery_sherd", new Item(new Item.Properties())); - public static final Item BLADE_POTTERY_SHERD = registerItem("blade_pottery_sherd", new Item(new Item.Properties())); - public static final Item BREWER_POTTERY_SHERD = registerItem("brewer_pottery_sherd", new Item(new Item.Properties())); - public static final Item BURN_POTTERY_SHERD = registerItem("burn_pottery_sherd", new Item(new Item.Properties())); - public static final Item DANGER_POTTERY_SHERD = registerItem("danger_pottery_sherd", new Item(new Item.Properties())); - public static final Item EXPLORER_POTTERY_SHERD = registerItem("explorer_pottery_sherd", new Item(new Item.Properties())); - public static final Item FLOW_POTTERY_SHERD = registerItem("flow_pottery_sherd", new Item(new Item.Properties())); - public static final Item FRIEND_POTTERY_SHERD = registerItem("friend_pottery_sherd", new Item(new Item.Properties())); - public static final Item GUSTER_POTTERY_SHERD = registerItem("guster_pottery_sherd", new Item(new Item.Properties())); - public static final Item HEART_POTTERY_SHERD = registerItem("heart_pottery_sherd", new Item(new Item.Properties())); - public static final Item HEARTBREAK_POTTERY_SHERD = registerItem("heartbreak_pottery_sherd", new Item(new Item.Properties())); - public static final Item HOWL_POTTERY_SHERD = registerItem("howl_pottery_sherd", new Item(new Item.Properties())); - public static final Item MINER_POTTERY_SHERD = registerItem("miner_pottery_sherd", new Item(new Item.Properties())); - public static final Item MOURNER_POTTERY_SHERD = registerItem("mourner_pottery_sherd", new Item(new Item.Properties())); - public static final Item PLENTY_POTTERY_SHERD = registerItem("plenty_pottery_sherd", new Item(new Item.Properties())); - public static final Item PRIZE_POTTERY_SHERD = registerItem("prize_pottery_sherd", new Item(new Item.Properties())); - public static final Item SCRAPE_POTTERY_SHERD = registerItem("scrape_pottery_sherd", new Item(new Item.Properties())); - public static final Item SHEAF_POTTERY_SHERD = registerItem("sheaf_pottery_sherd", new Item(new Item.Properties())); - public static final Item SHELTER_POTTERY_SHERD = registerItem("shelter_pottery_sherd", new Item(new Item.Properties())); - public static final Item SKULL_POTTERY_SHERD = registerItem("skull_pottery_sherd", new Item(new Item.Properties())); - public static final Item SNORT_POTTERY_SHERD = registerItem("snort_pottery_sherd", new Item(new Item.Properties())); + public static final Item ANGLER_POTTERY_SHERD = registerItem("angler_pottery_sherd", new Item.Properties().rarity(Rarity.UNCOMMON)); + public static final Item ARCHER_POTTERY_SHERD = registerItem("archer_pottery_sherd", new Item.Properties().rarity(Rarity.UNCOMMON)); + public static final Item ARMS_UP_POTTERY_SHERD = registerItem("arms_up_pottery_sherd", new Item.Properties().rarity(Rarity.UNCOMMON)); + public static final Item BLADE_POTTERY_SHERD = registerItem("blade_pottery_sherd", new Item.Properties().rarity(Rarity.UNCOMMON)); + public static final Item BREWER_POTTERY_SHERD = registerItem("brewer_pottery_sherd", new Item.Properties().rarity(Rarity.UNCOMMON)); + public static final Item BURN_POTTERY_SHERD = registerItem("burn_pottery_sherd", new Item.Properties().rarity(Rarity.UNCOMMON)); + public static final Item DANGER_POTTERY_SHERD = registerItem("danger_pottery_sherd", new Item.Properties().rarity(Rarity.UNCOMMON)); + public static final Item EXPLORER_POTTERY_SHERD = registerItem("explorer_pottery_sherd", new Item.Properties().rarity(Rarity.UNCOMMON)); + public static final Item FLOW_POTTERY_SHERD = registerItem("flow_pottery_sherd", new Item.Properties().rarity(Rarity.UNCOMMON)); + public static final Item FRIEND_POTTERY_SHERD = registerItem("friend_pottery_sherd", new Item.Properties().rarity(Rarity.UNCOMMON)); + public static final Item GUSTER_POTTERY_SHERD = registerItem("guster_pottery_sherd", new Item.Properties().rarity(Rarity.UNCOMMON)); + public static final Item HEART_POTTERY_SHERD = registerItem("heart_pottery_sherd", new Item.Properties().rarity(Rarity.UNCOMMON)); + public static final Item HEARTBREAK_POTTERY_SHERD = registerItem("heartbreak_pottery_sherd", new Item.Properties().rarity(Rarity.UNCOMMON)); + public static final Item HOWL_POTTERY_SHERD = registerItem("howl_pottery_sherd", new Item.Properties().rarity(Rarity.UNCOMMON)); + public static final Item MINER_POTTERY_SHERD = registerItem("miner_pottery_sherd", new Item.Properties().rarity(Rarity.UNCOMMON)); + public static final Item MOURNER_POTTERY_SHERD = registerItem("mourner_pottery_sherd", new Item.Properties().rarity(Rarity.UNCOMMON)); + public static final Item PLENTY_POTTERY_SHERD = registerItem("plenty_pottery_sherd", new Item.Properties().rarity(Rarity.UNCOMMON)); + public static final Item PRIZE_POTTERY_SHERD = registerItem("prize_pottery_sherd", new Item.Properties().rarity(Rarity.UNCOMMON)); + public static final Item SCRAPE_POTTERY_SHERD = registerItem("scrape_pottery_sherd", new Item.Properties().rarity(Rarity.UNCOMMON)); + public static final Item SHEAF_POTTERY_SHERD = registerItem("sheaf_pottery_sherd", new Item.Properties().rarity(Rarity.UNCOMMON)); + public static final Item SHELTER_POTTERY_SHERD = registerItem("shelter_pottery_sherd", new Item.Properties().rarity(Rarity.UNCOMMON)); + public static final Item SKULL_POTTERY_SHERD = registerItem("skull_pottery_sherd", new Item.Properties().rarity(Rarity.UNCOMMON)); + public static final Item SNORT_POTTERY_SHERD = registerItem("snort_pottery_sherd", new Item.Properties().rarity(Rarity.UNCOMMON)); public static final Item COPPER_GRATE = registerBlock(Blocks.COPPER_GRATE); public static final Item EXPOSED_COPPER_GRATE = registerBlock(Blocks.EXPOSED_COPPER_GRATE); public static final Item WEATHERED_COPPER_GRATE = registerBlock(Blocks.WEATHERED_COPPER_GRATE); @@ -1999,53 +2301,89 @@ public class Items { public static final Item WAXED_WEATHERED_COPPER_BULB = registerBlock(Blocks.WAXED_WEATHERED_COPPER_BULB); public static final Item WAXED_OXIDIZED_COPPER_BULB = registerBlock(Blocks.WAXED_OXIDIZED_COPPER_BULB); public static final Item TRIAL_SPAWNER = registerBlock(Blocks.TRIAL_SPAWNER); - public static final Item TRIAL_KEY = registerItem("trial_key", new Item(new Item.Properties())); - public static final Item OMINOUS_TRIAL_KEY = registerItem("ominous_trial_key", new Item(new Item.Properties())); + public static final Item TRIAL_KEY = registerItem("trial_key"); + public static final Item OMINOUS_TRIAL_KEY = registerItem("ominous_trial_key"); public static final Item VAULT = registerBlock(Blocks.VAULT); public static final Item OMINOUS_BOTTLE = registerItem( - "ominous_bottle", new OminousBottleItem(new Item.Properties().food(Foods.OMINOUS_BOTTLE).component(DataComponents.OMINOUS_BOTTLE_AMPLIFIER, 0)) + "ominous_bottle", + new Item.Properties() + .rarity(Rarity.UNCOMMON) + .component(DataComponents.CONSUMABLE, Consumables.OMINOUS_BOTTLE) + .component(DataComponents.OMINOUS_BOTTLE_AMPLIFIER, new OminousBottleAmplifier(0)) ); - public static final Item BREEZE_ROD = registerItem("breeze_rod", new Item(new Item.Properties())); + + private static Function createBlockItemWithCustomItemName(Block block) { + return properties -> new BlockItem(block, properties.useItemDescriptionPrefix()); + } + + private static ResourceKey vanillaItemId(String string) { + return ResourceKey.create(Registries.ITEM, ResourceLocation.withDefaultNamespace(string)); + } + + private static ResourceKey blockIdToItemId(ResourceKey resourceKey) { + return ResourceKey.create(Registries.ITEM, resourceKey.location()); + } public static Item registerBlock(Block block) { - return registerBlock(new BlockItem(block, new Item.Properties())); + return registerBlock(block, BlockItem::new); + } + + public static Item registerBlock(Block block, Item.Properties properties) { + return registerBlock(block, BlockItem::new, properties); } public static Item registerBlock(Block block, UnaryOperator propertiesModifier) { - return registerBlock(new BlockItem(block, (Item.Properties)propertiesModifier.apply(new Item.Properties()))); + return registerBlock( + block, (BiFunction)((blockx, properties) -> new BlockItem(blockx, (Item.Properties)propertiesModifier.apply(properties))) + ); } public static Item registerBlock(Block block, Block... others) { - BlockItem blockItem = new BlockItem(block, new Item.Properties()); + Item item = registerBlock(block); for (Block block2 : others) { - Item.BY_BLOCK.put(block2, blockItem); + Item.BY_BLOCK.put(block2, item); } - return registerBlock(blockItem); + return item; } - public static Item registerBlock(BlockItem item) { - return registerBlock(item.getBlock(), item); + public static Item registerBlock(Block block, BiFunction biFunction) { + return registerBlock(block, biFunction, new Item.Properties()); } - public static Item registerBlock(Block block, Item item) { - return registerItem(BuiltInRegistries.BLOCK.getKey(block), item); + public static Item registerBlock(Block block, BiFunction biFunction, Item.Properties properties) { + return registerItem( + blockIdToItemId(block.builtInRegistryHolder().key()), propertiesx -> (Item)biFunction.apply(block, propertiesx), properties.useBlockDescriptionPrefix() + ); } - public static Item registerItem(String key, Item item) { - return registerItem(ResourceLocation.withDefaultNamespace(key), item); + public static Item registerItem(String string, Function function) { + return registerItem(vanillaItemId(string), function, new Item.Properties()); } - public static Item registerItem(ResourceLocation key, Item item) { - return registerItem(ResourceKey.create(BuiltInRegistries.ITEM.key(), key), item); + public static Item registerItem(String string, Function function, Item.Properties properties) { + return registerItem(vanillaItemId(string), function, properties); } - public static Item registerItem(ResourceKey key, Item item) { - if (item instanceof BlockItem) { - ((BlockItem)item).registerBlocks(Item.BY_BLOCK, item); + public static Item registerItem(String string, Item.Properties properties) { + return registerItem(vanillaItemId(string), Item::new, properties); + } + + public static Item registerItem(String string) { + return registerItem(vanillaItemId(string), Item::new, new Item.Properties()); + } + + public static Item registerItem(ResourceKey resourceKey, Function function) { + return registerItem(resourceKey, function, new Item.Properties()); + } + + public static Item registerItem(ResourceKey resourceKey, Function function, Item.Properties properties) { + Item item = (Item)function.apply(properties.setId(resourceKey)); + if (item instanceof BlockItem blockItem) { + blockItem.registerBlocks(Item.BY_BLOCK, item); } - return Registry.register(BuiltInRegistries.ITEM, key, item); + return Registry.register(BuiltInRegistries.ITEM, resourceKey, item); } } diff --git a/net/minecraft/world/item/JukeboxPlayable.java b/net/minecraft/world/item/JukeboxPlayable.java index 6bb23328..5adee898 100644 --- a/net/minecraft/world/item/JukeboxPlayable.java +++ b/net/minecraft/world/item/JukeboxPlayable.java @@ -16,7 +16,7 @@ import net.minecraft.network.chat.Style; import net.minecraft.network.codec.ByteBufCodecs; import net.minecraft.network.codec.StreamCodec; import net.minecraft.stats.Stats; -import net.minecraft.world.ItemInteractionResult; +import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.component.TooltipProvider; import net.minecraft.world.level.Level; @@ -25,6 +25,7 @@ import net.minecraft.world.level.block.JukeboxBlock; import net.minecraft.world.level.block.entity.JukeboxBlockEntity; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.level.gameevent.GameEvent.Context; public record JukeboxPlayable(EitherHolder song, boolean showInTooltip) implements TooltipProvider { public static final Codec CODEC = RecordCodecBuilder.create( @@ -58,26 +59,26 @@ public record JukeboxPlayable(EitherHolder song, boolean showInTool return new JukeboxPlayable(this.song, showInTooltip); } - public static ItemInteractionResult tryInsertIntoJukebox(Level level, BlockPos pos, ItemStack stack, Player player) { - JukeboxPlayable jukeboxPlayable = stack.get(DataComponents.JUKEBOX_PLAYABLE); + public static InteractionResult tryInsertIntoJukebox(Level level, BlockPos blockPos, ItemStack itemStack, Player player) { + JukeboxPlayable jukeboxPlayable = itemStack.get(DataComponents.JUKEBOX_PLAYABLE); if (jukeboxPlayable == null) { - return ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION; + return InteractionResult.TRY_WITH_EMPTY_HAND; } else { - BlockState blockState = level.getBlockState(pos); + BlockState blockState = level.getBlockState(blockPos); if (blockState.is(Blocks.JUKEBOX) && !(Boolean)blockState.getValue(JukeboxBlock.HAS_RECORD)) { if (!level.isClientSide) { - ItemStack itemStack = stack.consumeAndReturn(1, player); - if (level.getBlockEntity(pos) instanceof JukeboxBlockEntity jukeboxBlockEntity) { - jukeboxBlockEntity.setTheItem(itemStack); - level.gameEvent(GameEvent.BLOCK_CHANGE, pos, GameEvent.Context.of(player, blockState)); + ItemStack itemStack2 = itemStack.consumeAndReturn(1, player); + if (level.getBlockEntity(blockPos) instanceof JukeboxBlockEntity jukeboxBlockEntity) { + jukeboxBlockEntity.setTheItem(itemStack2); + level.gameEvent(GameEvent.BLOCK_CHANGE, blockPos, Context.of(player, blockState)); } player.awardStat(Stats.PLAY_RECORD); } - return ItemInteractionResult.sidedSuccess(level.isClientSide); + return InteractionResult.SUCCESS; } else { - return ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION; + return InteractionResult.TRY_WITH_EMPTY_HAND; } } } diff --git a/net/minecraft/world/item/JukeboxSongPlayer.java b/net/minecraft/world/item/JukeboxSongPlayer.java index 7c9c2ca6..25131a0a 100644 --- a/net/minecraft/world/item/JukeboxSongPlayer.java +++ b/net/minecraft/world/item/JukeboxSongPlayer.java @@ -8,6 +8,7 @@ import net.minecraft.server.level.ServerLevel; import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.level.gameevent.GameEvent.Context; import net.minecraft.world.phys.Vec3; import org.jetbrains.annotations.Nullable; @@ -47,7 +48,7 @@ public class JukeboxSongPlayer { public void play(LevelAccessor level, Holder song) { this.song = song; this.ticksSinceSongStarted = 0L; - int i = level.registryAccess().registryOrThrow(Registries.JUKEBOX_SONG).getId(this.song.value()); + int i = level.registryAccess().lookupOrThrow(Registries.JUKEBOX_SONG).getId(this.song.value()); level.levelEvent(null, 1010, this.blockPos, i); this.onSongChanged.notifyChange(); } @@ -56,7 +57,7 @@ public class JukeboxSongPlayer { if (this.song != null) { this.song = null; this.ticksSinceSongStarted = 0L; - level.gameEvent(GameEvent.JUKEBOX_STOP_PLAY, this.blockPos, GameEvent.Context.of(state)); + level.gameEvent(GameEvent.JUKEBOX_STOP_PLAY, this.blockPos, Context.of(state)); level.levelEvent(1011, this.blockPos, 0); this.onSongChanged.notifyChange(); } @@ -68,7 +69,7 @@ public class JukeboxSongPlayer { this.stop(level, state); } else { if (this.shouldEmitJukeboxPlayingEvent()) { - level.gameEvent(GameEvent.JUKEBOX_PLAY, this.blockPos, GameEvent.Context.of(state)); + level.gameEvent(GameEvent.JUKEBOX_PLAY, this.blockPos, Context.of(state)); spawnMusicParticles(level, this.blockPos); } diff --git a/net/minecraft/world/item/KnowledgeBookItem.java b/net/minecraft/world/item/KnowledgeBookItem.java index 83e22b18..cd0b7768 100644 --- a/net/minecraft/world/item/KnowledgeBookItem.java +++ b/net/minecraft/world/item/KnowledgeBookItem.java @@ -5,11 +5,12 @@ import java.util.ArrayList; import java.util.List; import java.util.Optional; import net.minecraft.core.component.DataComponents; -import net.minecraft.resources.ResourceLocation; +import net.minecraft.resources.ResourceKey; import net.minecraft.stats.Stats; import net.minecraft.world.InteractionHand; -import net.minecraft.world.InteractionResultHolder; +import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.crafting.Recipe; import net.minecraft.world.item.crafting.RecipeHolder; import net.minecraft.world.item.crafting.RecipeManager; import net.minecraft.world.level.Level; @@ -23,22 +24,22 @@ public class KnowledgeBookItem extends Item { } @Override - public InteractionResultHolder use(Level level, Player player, InteractionHand usedHand) { - ItemStack itemStack = player.getItemInHand(usedHand); - List list = itemStack.getOrDefault(DataComponents.RECIPES, List.of()); + public InteractionResult use(Level level, Player player, InteractionHand interactionHand) { + ItemStack itemStack = player.getItemInHand(interactionHand); + List>> list = itemStack.getOrDefault(DataComponents.RECIPES, List.of()); itemStack.consume(1, player); if (list.isEmpty()) { - return InteractionResultHolder.fail(itemStack); + return InteractionResult.FAIL; } else { if (!level.isClientSide) { RecipeManager recipeManager = level.getServer().getRecipeManager(); List> list2 = new ArrayList(list.size()); - for (ResourceLocation resourceLocation : list) { - Optional> optional = recipeManager.byKey(resourceLocation); + for (ResourceKey> resourceKey : list) { + Optional> optional = recipeManager.byKey(resourceKey); if (!optional.isPresent()) { - LOGGER.error("Invalid recipe: {}", resourceLocation); - return InteractionResultHolder.fail(itemStack); + LOGGER.error("Invalid recipe: {}", resourceKey); + return InteractionResult.FAIL; } list2.add((RecipeHolder)optional.get()); @@ -48,7 +49,7 @@ public class KnowledgeBookItem extends Item { player.awardStat(Stats.ITEM_USED.get(this)); } - return InteractionResultHolder.sidedSuccess(itemStack, level.isClientSide()); + return InteractionResult.SUCCESS; } } } diff --git a/net/minecraft/world/item/LeadItem.java b/net/minecraft/world/item/LeadItem.java index a16b0fd8..8258adc0 100644 --- a/net/minecraft/world/item/LeadItem.java +++ b/net/minecraft/world/item/LeadItem.java @@ -13,6 +13,7 @@ import net.minecraft.world.item.context.UseOnContext; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.level.gameevent.GameEvent.Context; import net.minecraft.world.phys.AABB; public class LeadItem extends Item { @@ -28,13 +29,11 @@ public class LeadItem extends Item { if (blockState.is(BlockTags.FENCES)) { Player player = context.getPlayer(); if (!level.isClientSide && player != null) { - bindPlayerMobs(player, level, blockPos); + return bindPlayerMobs(player, level, blockPos); } - - return InteractionResult.sidedSuccess(level.isClientSide); - } else { - return InteractionResult.PASS; } + + return InteractionResult.PASS; } public static InteractionResult bindPlayerMobs(Player player, Level level, BlockPos pos) { @@ -51,8 +50,8 @@ public class LeadItem extends Item { } if (!list.isEmpty()) { - level.gameEvent(GameEvent.BLOCK_ATTACH, pos, GameEvent.Context.of(player)); - return InteractionResult.SUCCESS; + level.gameEvent(GameEvent.BLOCK_ATTACH, pos, Context.of(player)); + return InteractionResult.SUCCESS_SERVER; } else { return InteractionResult.PASS; } diff --git a/net/minecraft/world/item/LingeringPotionItem.java b/net/minecraft/world/item/LingeringPotionItem.java index 23e68c2b..80b30e98 100644 --- a/net/minecraft/world/item/LingeringPotionItem.java +++ b/net/minecraft/world/item/LingeringPotionItem.java @@ -6,7 +6,7 @@ import net.minecraft.network.chat.Component; import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; import net.minecraft.world.InteractionHand; -import net.minecraft.world.InteractionResultHolder; +import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.alchemy.PotionContents; import net.minecraft.world.level.Level; @@ -23,7 +23,7 @@ public class LingeringPotionItem extends ThrowablePotionItem { } @Override - public InteractionResultHolder use(Level level, Player player, InteractionHand usedHand) { + public InteractionResult use(Level level, Player player, InteractionHand interactionHand) { level.playSound( null, player.getX(), @@ -34,6 +34,6 @@ public class LingeringPotionItem extends ThrowablePotionItem { 0.5F, 0.4F / (level.getRandom().nextFloat() * 0.4F + 0.8F) ); - return super.use(level, player, usedHand); + return super.use(level, player, interactionHand); } } diff --git a/net/minecraft/world/item/MaceItem.java b/net/minecraft/world/item/MaceItem.java index 49661e41..e7977a1c 100644 --- a/net/minecraft/world/item/MaceItem.java +++ b/net/minecraft/world/item/MaceItem.java @@ -25,6 +25,7 @@ import net.minecraft.world.item.enchantment.EnchantmentHelper; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.Vec3; +import org.jetbrains.annotations.Nullable; public class MaceItem extends Item { private static final int DEFAULT_ATTACK_DAMAGE = 5; @@ -54,42 +55,42 @@ public class MaceItem extends Item { return !player.isCreative(); } - @Override - public int getEnchantmentValue() { - return 15; - } - @Override public boolean hurtEnemy(ItemStack stack, LivingEntity target, LivingEntity attacker) { - if (attacker instanceof ServerPlayer serverPlayer && canSmashAttack(serverPlayer)) { + if (canSmashAttack(attacker)) { ServerLevel serverLevel = (ServerLevel)attacker.level(); - if (serverPlayer.isIgnoringFallDamageFromCurrentImpulse() && serverPlayer.currentImpulseImpactPos != null) { - if (serverPlayer.currentImpulseImpactPos.y > serverPlayer.position().y) { - serverPlayer.currentImpulseImpactPos = serverPlayer.position(); - } - } else { - serverPlayer.currentImpulseImpactPos = serverPlayer.position(); + attacker.setDeltaMovement(attacker.getDeltaMovement().with(Direction.Axis.Y, 0.01F)); + if (attacker instanceof ServerPlayer serverPlayer) { + serverPlayer.currentImpulseImpactPos = this.calculateImpactPosition(serverPlayer); + serverPlayer.setIgnoreFallDamageFromCurrentImpulse(true); + serverPlayer.connection.send(new ClientboundSetEntityMotionPacket(serverPlayer)); } - serverPlayer.setIgnoreFallDamageFromCurrentImpulse(true); - serverPlayer.setDeltaMovement(serverPlayer.getDeltaMovement().with(Direction.Axis.Y, 0.01F)); - serverPlayer.connection.send(new ClientboundSetEntityMotionPacket(serverPlayer)); if (target.onGround()) { - serverPlayer.setSpawnExtraParticlesOnFall(true); - SoundEvent soundEvent = serverPlayer.fallDistance > 5.0F ? SoundEvents.MACE_SMASH_GROUND_HEAVY : SoundEvents.MACE_SMASH_GROUND; - serverLevel.playSound(null, serverPlayer.getX(), serverPlayer.getY(), serverPlayer.getZ(), soundEvent, serverPlayer.getSoundSource(), 1.0F, 1.0F); + if (attacker instanceof ServerPlayer serverPlayer) { + serverPlayer.setSpawnExtraParticlesOnFall(true); + } + + SoundEvent soundEvent = attacker.fallDistance > 5.0F ? SoundEvents.MACE_SMASH_GROUND_HEAVY : SoundEvents.MACE_SMASH_GROUND; + serverLevel.playSound(null, attacker.getX(), attacker.getY(), attacker.getZ(), soundEvent, attacker.getSoundSource(), 1.0F, 1.0F); } else { - serverLevel.playSound( - null, serverPlayer.getX(), serverPlayer.getY(), serverPlayer.getZ(), SoundEvents.MACE_SMASH_AIR, serverPlayer.getSoundSource(), 1.0F, 1.0F - ); + serverLevel.playSound(null, attacker.getX(), attacker.getY(), attacker.getZ(), SoundEvents.MACE_SMASH_AIR, attacker.getSoundSource(), 1.0F, 1.0F); } - knockback(serverLevel, serverPlayer, target); + knockback(serverLevel, attacker, target); } return true; } + private Vec3 calculateImpactPosition(ServerPlayer serverPlayer) { + return serverPlayer.isIgnoringFallDamageFromCurrentImpulse() + && serverPlayer.currentImpulseImpactPos != null + && serverPlayer.currentImpulseImpactPos.y <= serverPlayer.position().y + ? serverPlayer.currentImpulseImpactPos + : serverPlayer.position(); + } + @Override public void postHurtEnemy(ItemStack stack, LivingEntity target, LivingEntity attacker) { stack.hurtAndBreak(1, attacker, EquipmentSlot.MAINHAND); @@ -98,11 +99,6 @@ public class MaceItem extends Item { } } - @Override - public boolean isValidRepairItem(ItemStack stack, ItemStack repairCandidate) { - return repairCandidate.is(Items.BREEZE_ROD); - } - @Override public float getAttackDamageBonus(Entity target, float damage, DamageSource damageSource) { if (damageSource.getDirectEntity() instanceof LivingEntity livingEntity) { @@ -130,11 +126,11 @@ public class MaceItem extends Item { } } - private static void knockback(Level level, Player player, Entity entity) { - level.levelEvent(2013, entity.getOnPos(), 750); - level.getEntitiesOfClass(LivingEntity.class, entity.getBoundingBox().inflate(3.5), knockbackPredicate(player, entity)).forEach(livingEntity -> { - Vec3 vec3 = livingEntity.position().subtract(entity.position()); - double d = getKnockbackPower(player, livingEntity, vec3); + private static void knockback(Level level, Entity entity, Entity entity2) { + level.levelEvent(2013, entity2.getOnPos(), 750); + level.getEntitiesOfClass(LivingEntity.class, entity2.getBoundingBox().inflate(3.5), knockbackPredicate(entity, entity2)).forEach(livingEntity -> { + Vec3 vec3 = livingEntity.position().subtract(entity2.position()); + double d = getKnockbackPower(entity, livingEntity, vec3); Vec3 vec32 = vec3.normalize().scale(d); if (d > 0.0) { livingEntity.push(vec32.x, 0.7F, vec32.z); @@ -145,23 +141,29 @@ public class MaceItem extends Item { }); } - private static Predicate knockbackPredicate(Player player, Entity entity) { + private static Predicate knockbackPredicate(Entity entity, Entity entity2) { return livingEntity -> { boolean bl = !livingEntity.isSpectator(); - boolean bl2 = livingEntity != player && livingEntity != entity; - boolean bl3 = !player.isAlliedTo(livingEntity); - boolean bl4 = !(livingEntity instanceof TamableAnimal tamableAnimal && tamableAnimal.isTame() && player.getUUID().equals(tamableAnimal.getOwnerUUID())); + boolean bl2 = livingEntity != entity && livingEntity != entity2; + boolean bl3 = !entity.isAlliedTo(livingEntity); + boolean bl4 = !(livingEntity instanceof TamableAnimal tamableAnimal && tamableAnimal.isTame() && entity.getUUID().equals(tamableAnimal.getOwnerUUID())); boolean bl5 = !(livingEntity instanceof ArmorStand armorStand && armorStand.isMarker()); - boolean bl6 = entity.distanceToSqr(livingEntity) <= Math.pow(3.5, 2.0); + boolean bl6 = entity2.distanceToSqr(livingEntity) <= Math.pow(3.5, 2.0); return bl && bl2 && bl3 && bl4 && bl5 && bl6; }; } - private static double getKnockbackPower(Player player, LivingEntity entity, Vec3 entityPos) { - return (3.5 - entityPos.length()) * 0.7F * (player.fallDistance > 5.0F ? 2 : 1) * (1.0 - entity.getAttributeValue(Attributes.KNOCKBACK_RESISTANCE)); + private static double getKnockbackPower(Entity entity, LivingEntity livingEntity, Vec3 vec3) { + return (3.5 - vec3.length()) * 0.7F * (entity.fallDistance > 5.0F ? 2 : 1) * (1.0 - livingEntity.getAttributeValue(Attributes.KNOCKBACK_RESISTANCE)); } public static boolean canSmashAttack(LivingEntity entity) { return entity.fallDistance > 1.5F && !entity.isFallFlying(); } + + @Nullable + @Override + public DamageSource getDamageSource(LivingEntity livingEntity) { + return canSmashAttack(livingEntity) ? livingEntity.damageSources().mace(livingEntity) : super.getDamageSource(livingEntity); + } } diff --git a/net/minecraft/world/item/MapItem.java b/net/minecraft/world/item/MapItem.java index 5f7ed3d7..b2d3354d 100644 --- a/net/minecraft/world/item/MapItem.java +++ b/net/minecraft/world/item/MapItem.java @@ -12,7 +12,6 @@ import net.minecraft.core.Holder; import net.minecraft.core.SectionPos; import net.minecraft.core.component.DataComponents; import net.minecraft.network.chat.Component; -import net.minecraft.network.protocol.Packet; import net.minecraft.resources.ResourceKey; import net.minecraft.server.level.ServerLevel; import net.minecraft.tags.BiomeTags; @@ -35,7 +34,7 @@ import net.minecraft.world.level.saveddata.maps.MapId; import net.minecraft.world.level.saveddata.maps.MapItemSavedData; import org.jetbrains.annotations.Nullable; -public class MapItem extends ComplexItem { +public class MapItem extends Item { public static final int IMAGE_WIDTH = 128; public static final int IMAGE_HEIGHT = 128; @@ -120,15 +119,15 @@ public class MapItem extends ComplexItem { mutableBlockPos.set(r + u, 0, s + v); int w = levelChunk.getHeight(Heightmap.Types.WORLD_SURFACE, mutableBlockPos.getX(), mutableBlockPos.getZ()) + 1; BlockState blockState; - if (w <= level.getMinBuildHeight() + 1) { + if (w <= level.getMinY() + 1) { blockState = Blocks.BEDROCK.defaultBlockState(); } else { do { mutableBlockPos.setY(--w); blockState = levelChunk.getBlockState(mutableBlockPos); - } while (blockState.getMapColor(level, mutableBlockPos) == MapColor.NONE && w > level.getMinBuildHeight()); + } while (blockState.getMapColor(level, mutableBlockPos) == MapColor.NONE && w > level.getMinY()); - if (w > level.getMinBuildHeight() && !blockState.getFluidState().isEmpty()) { + if (w > level.getMinY() && !blockState.getFluidState().isEmpty()) { int x = w - 1; mutableBlockPos2.set(mutableBlockPos); @@ -137,7 +136,7 @@ public class MapItem extends ComplexItem { mutableBlockPos2.setY(x--); blockState2 = levelChunk.getBlockState(mutableBlockPos2); t++; - } while (x > level.getMinBuildHeight() && !blockState2.getFluidState().isEmpty()); + } while (x > level.getMinY() && !blockState2.getFluidState().isEmpty()); blockState = this.getCorrectStateForFluidBlock(level, blockState, mutableBlockPos); } @@ -285,14 +284,6 @@ public class MapItem extends ComplexItem { } } - @Nullable - @Override - public Packet getUpdatePacket(ItemStack stack, Level level, Player player) { - MapId mapId = stack.get(DataComponents.MAP_ID); - MapItemSavedData mapItemSavedData = getSavedData(mapId, level); - return mapItemSavedData != null ? mapItemSavedData.getUpdatePacket(mapId, player) : null; - } - @Override public void onCraftedPostProcess(ItemStack stack, Level level) { MapPostProcessing mapPostProcessing = stack.remove(DataComponents.MAP_POST_PROCESSING); @@ -366,7 +357,7 @@ public class MapItem extends ComplexItem { } } - return InteractionResult.sidedSuccess(context.getLevel().isClientSide); + return InteractionResult.SUCCESS; } else { return super.useOn(context); } diff --git a/net/minecraft/world/item/MilkBucketItem.java b/net/minecraft/world/item/MilkBucketItem.java deleted file mode 100644 index 626ce044..00000000 --- a/net/minecraft/world/item/MilkBucketItem.java +++ /dev/null @@ -1,52 +0,0 @@ -package net.minecraft.world.item; - -import net.minecraft.advancements.CriteriaTriggers; -import net.minecraft.server.level.ServerPlayer; -import net.minecraft.stats.Stats; -import net.minecraft.world.InteractionHand; -import net.minecraft.world.InteractionResultHolder; -import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.entity.player.Player; -import net.minecraft.world.level.Level; - -public class MilkBucketItem extends Item { - private static final int DRINK_DURATION = 32; - - public MilkBucketItem(Item.Properties properties) { - super(properties); - } - - @Override - public ItemStack finishUsingItem(ItemStack stack, Level level, LivingEntity livingEntity) { - if (livingEntity instanceof ServerPlayer serverPlayer) { - CriteriaTriggers.CONSUME_ITEM.trigger(serverPlayer, stack); - serverPlayer.awardStat(Stats.ITEM_USED.get(this)); - } - - if (!level.isClientSide) { - livingEntity.removeAllEffects(); - } - - if (livingEntity instanceof Player player) { - return ItemUtils.createFilledResult(stack, player, new ItemStack(Items.BUCKET), false); - } else { - stack.consume(1, livingEntity); - return stack; - } - } - - @Override - public int getUseDuration(ItemStack stack, LivingEntity entity) { - return 32; - } - - @Override - public UseAnim getUseAnimation(ItemStack stack) { - return UseAnim.DRINK; - } - - @Override - public InteractionResultHolder use(Level level, Player player, InteractionHand usedHand) { - return ItemUtils.startUsingInstantly(level, player, usedHand); - } -} diff --git a/net/minecraft/world/item/MinecartItem.java b/net/minecraft/world/item/MinecartItem.java index da12c242..017f4968 100644 --- a/net/minecraft/world/item/MinecartItem.java +++ b/net/minecraft/world/item/MinecartItem.java @@ -1,80 +1,28 @@ package net.minecraft.world.item; import net.minecraft.core.BlockPos; -import net.minecraft.core.Direction; -import net.minecraft.core.dispenser.BlockSource; -import net.minecraft.core.dispenser.DefaultDispenseItemBehavior; -import net.minecraft.core.dispenser.DispenseItemBehavior; import net.minecraft.server.level.ServerLevel; import net.minecraft.tags.BlockTags; import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntitySpawnReason; +import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.vehicle.AbstractMinecart; import net.minecraft.world.item.context.UseOnContext; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.BaseRailBlock; -import net.minecraft.world.level.block.DispenserBlock; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.properties.RailShape; import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.level.gameevent.GameEvent.Context; import net.minecraft.world.phys.Vec3; public class MinecartItem extends Item { - private static final DispenseItemBehavior DISPENSE_ITEM_BEHAVIOR = new DefaultDispenseItemBehavior() { - private final DefaultDispenseItemBehavior defaultDispenseItemBehavior = new DefaultDispenseItemBehavior(); + private final EntityType type; - @Override - public ItemStack execute(BlockSource blockSource, ItemStack item) { - Direction direction = blockSource.state().getValue(DispenserBlock.FACING); - ServerLevel serverLevel = blockSource.level(); - Vec3 vec3 = blockSource.center(); - double d = vec3.x() + direction.getStepX() * 1.125; - double e = Math.floor(vec3.y()) + direction.getStepY(); - double f = vec3.z() + direction.getStepZ() * 1.125; - BlockPos blockPos = blockSource.pos().relative(direction); - BlockState blockState = serverLevel.getBlockState(blockPos); - RailShape railShape = blockState.getBlock() instanceof BaseRailBlock - ? blockState.getValue(((BaseRailBlock)blockState.getBlock()).getShapeProperty()) - : RailShape.NORTH_SOUTH; - double g; - if (blockState.is(BlockTags.RAILS)) { - if (railShape.isAscending()) { - g = 0.6; - } else { - g = 0.1; - } - } else { - if (!blockState.isAir() || !serverLevel.getBlockState(blockPos.below()).is(BlockTags.RAILS)) { - return this.defaultDispenseItemBehavior.dispense(blockSource, item); - } - - BlockState blockState2 = serverLevel.getBlockState(blockPos.below()); - RailShape railShape2 = blockState2.getBlock() instanceof BaseRailBlock - ? blockState2.getValue(((BaseRailBlock)blockState2.getBlock()).getShapeProperty()) - : RailShape.NORTH_SOUTH; - if (direction != Direction.DOWN && railShape2.isAscending()) { - g = -0.4; - } else { - g = -0.9; - } - } - - AbstractMinecart abstractMinecart = AbstractMinecart.createMinecart(serverLevel, d, e + g, f, ((MinecartItem)item.getItem()).type, item, null); - serverLevel.addFreshEntity(abstractMinecart); - item.shrink(1); - return item; - } - - @Override - protected void playSound(BlockSource blockSource) { - blockSource.level().levelEvent(1000, blockSource.pos(), 0); - } - }; - final AbstractMinecart.Type type; - - public MinecartItem(AbstractMinecart.Type type, Item.Properties properties) { + public MinecartItem(EntityType entityType, Item.Properties properties) { super(properties); - this.type = type; - DispenserBlock.registerBehavior(this, DISPENSE_ITEM_BEHAVIOR); + this.type = entityType; } @Override @@ -86,24 +34,37 @@ public class MinecartItem extends Item { return InteractionResult.FAIL; } else { ItemStack itemStack = context.getItemInHand(); - if (level instanceof ServerLevel serverLevel) { - RailShape railShape = blockState.getBlock() instanceof BaseRailBlock - ? blockState.getValue(((BaseRailBlock)blockState.getBlock()).getShapeProperty()) - : RailShape.NORTH_SOUTH; - double d = 0.0; - if (railShape.isAscending()) { - d = 0.5; - } - - AbstractMinecart abstractMinecart = AbstractMinecart.createMinecart( - serverLevel, blockPos.getX() + 0.5, blockPos.getY() + 0.0625 + d, blockPos.getZ() + 0.5, this.type, itemStack, context.getPlayer() - ); - serverLevel.addFreshEntity(abstractMinecart); - serverLevel.gameEvent(GameEvent.ENTITY_PLACE, blockPos, GameEvent.Context.of(context.getPlayer(), serverLevel.getBlockState(blockPos.below()))); + RailShape railShape = blockState.getBlock() instanceof BaseRailBlock + ? blockState.getValue(((BaseRailBlock)blockState.getBlock()).getShapeProperty()) + : RailShape.NORTH_SOUTH; + double d = 0.0; + if (railShape.isSlope()) { + d = 0.5; } - itemStack.shrink(1); - return InteractionResult.sidedSuccess(level.isClientSide); + Vec3 vec3 = new Vec3(blockPos.getX() + 0.5, blockPos.getY() + 0.0625 + d, blockPos.getZ() + 0.5); + AbstractMinecart abstractMinecart = AbstractMinecart.createMinecart( + level, vec3.x, vec3.y, vec3.z, this.type, EntitySpawnReason.DISPENSER, itemStack, context.getPlayer() + ); + if (abstractMinecart == null) { + return InteractionResult.FAIL; + } else { + if (AbstractMinecart.useExperimentalMovement(level)) { + for (Entity entity : level.getEntities(null, abstractMinecart.getBoundingBox())) { + if (entity instanceof AbstractMinecart) { + return InteractionResult.FAIL; + } + } + } + + if (level instanceof ServerLevel serverLevel) { + serverLevel.addFreshEntity(abstractMinecart); + serverLevel.gameEvent(GameEvent.ENTITY_PLACE, blockPos, Context.of(context.getPlayer(), serverLevel.getBlockState(blockPos.below()))); + } + + itemStack.shrink(1); + return InteractionResult.SUCCESS; + } } } } diff --git a/net/minecraft/world/item/MobBucketItem.java b/net/minecraft/world/item/MobBucketItem.java index 270b5af8..ebdada9e 100644 --- a/net/minecraft/world/item/MobBucketItem.java +++ b/net/minecraft/world/item/MobBucketItem.java @@ -11,8 +11,9 @@ import net.minecraft.network.chat.MutableComponent; import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundSource; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; -import net.minecraft.world.entity.MobSpawnType; import net.minecraft.world.entity.animal.Bucketable; import net.minecraft.world.entity.animal.TropicalFish; import net.minecraft.world.entity.player.Player; @@ -48,11 +49,17 @@ public class MobBucketItem extends BucketItem { } private void spawn(ServerLevel serverLevel, ItemStack bucketedMobStack, BlockPos pos) { - if (this.type.spawn(serverLevel, bucketedMobStack, null, pos, MobSpawnType.BUCKET, true, false) instanceof Bucketable bucketable) { + Entity entity = this.type + .create(serverLevel, EntityType.createDefaultStackConfig(serverLevel, bucketedMobStack, null), pos, EntitySpawnReason.BUCKET, true, false); + if (entity instanceof Bucketable bucketable) { CustomData customData = bucketedMobStack.getOrDefault(DataComponents.BUCKET_ENTITY_DATA, CustomData.EMPTY); bucketable.loadFromBucketTag(customData.copyTag()); bucketable.setFromBucket(true); } + + if (entity != null) { + serverLevel.addFreshEntityWithPassengers(entity); + } } @Override diff --git a/net/minecraft/world/item/NameTagItem.java b/net/minecraft/world/item/NameTagItem.java index ed713e86..0fe7030f 100644 --- a/net/minecraft/world/item/NameTagItem.java +++ b/net/minecraft/world/item/NameTagItem.java @@ -16,7 +16,7 @@ public class NameTagItem extends Item { @Override public InteractionResult interactLivingEntity(ItemStack stack, Player player, LivingEntity interactionTarget, InteractionHand usedHand) { Component component = stack.get(DataComponents.CUSTOM_NAME); - if (component != null && !(interactionTarget instanceof Player)) { + if (component != null && interactionTarget.getType().canSerialize()) { if (!player.level().isClientSide && interactionTarget.isAlive()) { interactionTarget.setCustomName(component); if (interactionTarget instanceof Mob mob) { @@ -26,7 +26,7 @@ public class NameTagItem extends Item { stack.shrink(1); } - return InteractionResult.sidedSuccess(player.level().isClientSide); + return InteractionResult.SUCCESS; } else { return InteractionResult.PASS; } diff --git a/net/minecraft/world/item/OminousBottleItem.java b/net/minecraft/world/item/OminousBottleItem.java deleted file mode 100644 index a813aaba..00000000 --- a/net/minecraft/world/item/OminousBottleItem.java +++ /dev/null @@ -1,68 +0,0 @@ -package net.minecraft.world.item; - -import java.util.List; -import net.minecraft.advancements.CriteriaTriggers; -import net.minecraft.core.component.DataComponents; -import net.minecraft.network.chat.Component; -import net.minecraft.server.level.ServerPlayer; -import net.minecraft.sounds.SoundEvents; -import net.minecraft.stats.Stats; -import net.minecraft.world.InteractionHand; -import net.minecraft.world.InteractionResultHolder; -import net.minecraft.world.effect.MobEffectInstance; -import net.minecraft.world.effect.MobEffects; -import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.entity.player.Player; -import net.minecraft.world.item.alchemy.PotionContents; -import net.minecraft.world.level.Level; - -public class OminousBottleItem extends Item { - private static final int DRINK_DURATION = 32; - public static final int EFFECT_DURATION = 120000; - public static final int MIN_AMPLIFIER = 0; - public static final int MAX_AMPLIFIER = 4; - - public OminousBottleItem(Item.Properties properties) { - super(properties); - } - - @Override - public ItemStack finishUsingItem(ItemStack stack, Level level, LivingEntity livingEntity) { - if (livingEntity instanceof ServerPlayer serverPlayer) { - CriteriaTriggers.CONSUME_ITEM.trigger(serverPlayer, stack); - serverPlayer.awardStat(Stats.ITEM_USED.get(this)); - } - - if (!level.isClientSide) { - level.playSound(null, livingEntity.blockPosition(), SoundEvents.OMINOUS_BOTTLE_DISPOSE, livingEntity.getSoundSource(), 1.0F, 1.0F); - Integer integer = stack.getOrDefault(DataComponents.OMINOUS_BOTTLE_AMPLIFIER, 0); - livingEntity.addEffect(new MobEffectInstance(MobEffects.BAD_OMEN, 120000, integer, false, false, true)); - } - - stack.consume(1, livingEntity); - return stack; - } - - @Override - public int getUseDuration(ItemStack stack, LivingEntity entity) { - return 32; - } - - @Override - public UseAnim getUseAnimation(ItemStack stack) { - return UseAnim.DRINK; - } - - @Override - public InteractionResultHolder use(Level level, Player player, InteractionHand usedHand) { - return ItemUtils.startUsingInstantly(level, player, usedHand); - } - - @Override - public void appendHoverText(ItemStack stack, Item.TooltipContext context, List tooltipComponents, TooltipFlag tooltipFlag) { - super.appendHoverText(stack, context, tooltipComponents, tooltipFlag); - Integer integer = stack.getOrDefault(DataComponents.OMINOUS_BOTTLE_AMPLIFIER, 0); - List list = List.of(new MobEffectInstance(MobEffects.BAD_OMEN, 120000, integer, false, false, true)); - PotionContents.addPotionTooltip(list, tooltipComponents::add, 1.0F, context.tickRate()); - } -} diff --git a/net/minecraft/world/item/PickaxeItem.java b/net/minecraft/world/item/PickaxeItem.java index 872505fe..5995f2f6 100644 --- a/net/minecraft/world/item/PickaxeItem.java +++ b/net/minecraft/world/item/PickaxeItem.java @@ -3,7 +3,7 @@ package net.minecraft.world.item; import net.minecraft.tags.BlockTags; public class PickaxeItem extends DiggerItem { - public PickaxeItem(Tier tier, Item.Properties properties) { - super(tier, BlockTags.MINEABLE_WITH_PICKAXE, properties); + public PickaxeItem(ToolMaterial toolMaterial, float f, float g, Item.Properties properties) { + super(toolMaterial, BlockTags.MINEABLE_WITH_PICKAXE, f, g, properties); } } diff --git a/net/minecraft/world/item/PlaceOnWaterBlockItem.java b/net/minecraft/world/item/PlaceOnWaterBlockItem.java index 3e601850..55c1543b 100644 --- a/net/minecraft/world/item/PlaceOnWaterBlockItem.java +++ b/net/minecraft/world/item/PlaceOnWaterBlockItem.java @@ -2,11 +2,10 @@ package net.minecraft.world.item; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; -import net.minecraft.world.InteractionResultHolder; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.context.UseOnContext; -import net.minecraft.world.level.ClipContext; import net.minecraft.world.level.Level; +import net.minecraft.world.level.ClipContext.Fluid; import net.minecraft.world.level.block.Block; import net.minecraft.world.phys.BlockHitResult; @@ -21,10 +20,9 @@ public class PlaceOnWaterBlockItem extends BlockItem { } @Override - public InteractionResultHolder use(Level level, Player player, InteractionHand usedHand) { - BlockHitResult blockHitResult = getPlayerPOVHitResult(level, player, ClipContext.Fluid.SOURCE_ONLY); + public InteractionResult use(Level level, Player player, InteractionHand interactionHand) { + BlockHitResult blockHitResult = getPlayerPOVHitResult(level, player, Fluid.SOURCE_ONLY); BlockHitResult blockHitResult2 = blockHitResult.withPosition(blockHitResult.getBlockPos().above()); - InteractionResult interactionResult = super.useOn(new UseOnContext(player, usedHand, blockHitResult2)); - return new InteractionResultHolder<>(interactionResult, player.getItemInHand(usedHand)); + return super.useOn(new UseOnContext(player, interactionHand, blockHitResult2)); } } diff --git a/net/minecraft/world/item/PlayerHeadItem.java b/net/minecraft/world/item/PlayerHeadItem.java index 473de227..ab902a0c 100644 --- a/net/minecraft/world/item/PlayerHeadItem.java +++ b/net/minecraft/world/item/PlayerHeadItem.java @@ -9,14 +9,14 @@ import net.minecraft.world.level.block.entity.SkullBlockEntity; public class PlayerHeadItem extends StandingAndWallBlockItem { public PlayerHeadItem(Block block, Block wallBlock, Item.Properties properties) { - super(block, wallBlock, properties, Direction.DOWN); + super(block, wallBlock, Direction.DOWN, properties); } @Override public Component getName(ItemStack stack) { ResolvableProfile resolvableProfile = stack.get(DataComponents.PROFILE); return (Component)(resolvableProfile != null && resolvableProfile.name().isPresent() - ? Component.translatable(this.getDescriptionId() + ".named", resolvableProfile.name().get()) + ? Component.translatable(this.descriptionId + ".named", resolvableProfile.name().get()) : super.getName(stack)); } diff --git a/net/minecraft/world/item/PotionItem.java b/net/minecraft/world/item/PotionItem.java index c3ef41c1..f70b9a3e 100644 --- a/net/minecraft/world/item/PotionItem.java +++ b/net/minecraft/world/item/PotionItem.java @@ -1,24 +1,18 @@ package net.minecraft.world.item; import java.util.List; -import net.minecraft.advancements.CriteriaTriggers; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.component.DataComponents; import net.minecraft.core.particles.ParticleTypes; import net.minecraft.network.chat.Component; import net.minecraft.server.level.ServerLevel; -import net.minecraft.server.level.ServerPlayer; import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; import net.minecraft.stats.Stats; import net.minecraft.tags.BlockTags; -import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; -import net.minecraft.world.InteractionResultHolder; -import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.player.Player; -import net.minecraft.world.item.alchemy.Potion; import net.minecraft.world.item.alchemy.PotionContents; import net.minecraft.world.item.alchemy.Potions; import net.minecraft.world.item.context.UseOnContext; @@ -28,8 +22,6 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.gameevent.GameEvent; public class PotionItem extends Item { - private static final int DRINK_DURATION = 32; - public PotionItem(Item.Properties properties) { super(properties); } @@ -41,43 +33,6 @@ public class PotionItem extends Item { return itemStack; } - @Override - public ItemStack finishUsingItem(ItemStack stack, Level level, LivingEntity livingEntity) { - Player player = livingEntity instanceof Player ? (Player)livingEntity : null; - if (player instanceof ServerPlayer) { - CriteriaTriggers.CONSUME_ITEM.trigger((ServerPlayer)player, stack); - } - - if (!level.isClientSide) { - PotionContents potionContents = stack.getOrDefault(DataComponents.POTION_CONTENTS, PotionContents.EMPTY); - potionContents.forEachEffect(mobEffectInstance -> { - if (mobEffectInstance.getEffect().value().isInstantenous()) { - mobEffectInstance.getEffect().value().applyInstantenousEffect(player, player, livingEntity, mobEffectInstance.getAmplifier(), 1.0); - } else { - livingEntity.addEffect(mobEffectInstance); - } - }); - } - - if (player != null) { - player.awardStat(Stats.ITEM_USED.get(this)); - stack.consume(1, player); - } - - if (player == null || !player.hasInfiniteMaterials()) { - if (stack.isEmpty()) { - return new ItemStack(Items.GLASS_BOTTLE); - } - - if (player != null) { - player.getInventory().add(new ItemStack(Items.GLASS_BOTTLE)); - } - } - - livingEntity.gameEvent(GameEvent.DRINK); - return stack; - } - @Override public InteractionResult useOn(UseOnContext context) { Level level = context.getLevel(); @@ -111,30 +66,16 @@ public class PotionItem extends Item { level.playSound(null, blockPos, SoundEvents.BOTTLE_EMPTY, SoundSource.BLOCKS, 1.0F, 1.0F); level.gameEvent(null, GameEvent.FLUID_PLACE, blockPos); level.setBlockAndUpdate(blockPos, Blocks.MUD.defaultBlockState()); - return InteractionResult.sidedSuccess(level.isClientSide); + return InteractionResult.SUCCESS; } else { return InteractionResult.PASS; } } @Override - public int getUseDuration(ItemStack stack, LivingEntity entity) { - return 32; - } - - @Override - public UseAnim getUseAnimation(ItemStack stack) { - return UseAnim.DRINK; - } - - @Override - public InteractionResultHolder use(Level level, Player player, InteractionHand usedHand) { - return ItemUtils.startUsingInstantly(level, player, usedHand); - } - - @Override - public String getDescriptionId(ItemStack stack) { - return Potion.getName(stack.getOrDefault(DataComponents.POTION_CONTENTS, PotionContents.EMPTY).potion(), this.getDescriptionId() + ".effect."); + public Component getName(ItemStack stack) { + PotionContents potionContents = stack.get(DataComponents.POTION_CONTENTS); + return potionContents != null ? potionContents.getName(this.descriptionId + ".effect.") : super.getName(stack); } @Override diff --git a/net/minecraft/world/item/ProjectileWeaponItem.java b/net/minecraft/world/item/ProjectileWeaponItem.java index 806e0f76..35a5d8c0 100644 --- a/net/minecraft/world/item/ProjectileWeaponItem.java +++ b/net/minecraft/world/item/ProjectileWeaponItem.java @@ -41,11 +41,6 @@ public abstract class ProjectileWeaponItem extends Item { } } - @Override - public int getEnchantmentValue() { - return 1; - } - public abstract int getDefaultProjectileRange(); protected void shoot( @@ -69,9 +64,13 @@ public abstract class ProjectileWeaponItem extends Item { if (!itemStack.isEmpty()) { float k = h + i * ((j + 1) / 2) * g; i = -i; - Projectile projectile = this.createProjectile(level, shooter, weapon, itemStack, isCrit); - this.shootProjectile(shooter, projectile, j, velocity, inaccuracy, k, target); - level.addFreshEntity(projectile); + int l = j; + Projectile.spawnProjectile( + this.createProjectile(level, shooter, weapon, itemStack, isCrit), + level, + itemStack, + projectile -> this.shootProjectile(shooter, projectile, l, velocity, inaccuracy, k, target) + ); weapon.hurtAndBreak(this.getDurabilityUse(itemStack), shooter, LivingEntity.getSlotForHand(hand)); if (weapon.isEmpty()) { break; diff --git a/net/minecraft/world/item/Rarity.java b/net/minecraft/world/item/Rarity.java index cccbf36b..d53ffa7f 100644 --- a/net/minecraft/world/item/Rarity.java +++ b/net/minecraft/world/item/Rarity.java @@ -8,6 +8,7 @@ import net.minecraft.network.codec.ByteBufCodecs; import net.minecraft.network.codec.StreamCodec; import net.minecraft.util.ByIdMap; import net.minecraft.util.StringRepresentable; +import net.minecraft.util.ByIdMap.OutOfBoundsStrategy; public enum Rarity implements StringRepresentable { COMMON(0, "common", ChatFormatting.WHITE), @@ -16,7 +17,7 @@ public enum Rarity implements StringRepresentable { EPIC(3, "epic", ChatFormatting.LIGHT_PURPLE); public static final Codec CODEC = StringRepresentable.fromValues(Rarity::values); - public static final IntFunction BY_ID = ByIdMap.continuous(rarity -> rarity.id, values(), ByIdMap.OutOfBoundsStrategy.ZERO); + public static final IntFunction BY_ID = ByIdMap.continuous(rarity -> rarity.id, values(), OutOfBoundsStrategy.ZERO); public static final StreamCodec STREAM_CODEC = ByteBufCodecs.idMapper(BY_ID, rarity -> rarity.id); private final int id; private final String name; diff --git a/net/minecraft/world/item/SaddleItem.java b/net/minecraft/world/item/SaddleItem.java index 52b194f3..cd67888c 100644 --- a/net/minecraft/world/item/SaddleItem.java +++ b/net/minecraft/world/item/SaddleItem.java @@ -21,7 +21,7 @@ public class SaddleItem extends Item { interactionTarget.level().gameEvent(interactionTarget, GameEvent.EQUIP, interactionTarget.position()); } - return InteractionResult.sidedSuccess(player.level().isClientSide); + return InteractionResult.SUCCESS; } else { return InteractionResult.PASS; } diff --git a/net/minecraft/world/item/ScaffoldingBlockItem.java b/net/minecraft/world/item/ScaffoldingBlockItem.java index 06bf1eb5..627a79f4 100644 --- a/net/minecraft/world/item/ScaffoldingBlockItem.java +++ b/net/minecraft/world/item/ScaffoldingBlockItem.java @@ -41,9 +41,9 @@ public class ScaffoldingBlockItem extends BlockItem { while (i < 7) { if (!level.isClientSide && !level.isInWorldBounds(mutableBlockPos)) { Player player = context.getPlayer(); - int j = level.getMaxBuildHeight(); - if (player instanceof ServerPlayer && mutableBlockPos.getY() >= j) { - ((ServerPlayer)player).sendSystemMessage(Component.translatable("build.tooHigh", j - 1).withStyle(ChatFormatting.RED), true); + int j = level.getMaxY(); + if (player instanceof ServerPlayer && mutableBlockPos.getY() > j) { + ((ServerPlayer)player).sendSystemMessage(Component.translatable("build.tooHigh", j).withStyle(ChatFormatting.RED), true); } break; } diff --git a/net/minecraft/world/item/ServerItemCooldowns.java b/net/minecraft/world/item/ServerItemCooldowns.java index ff1d8cd5..01e28fd6 100644 --- a/net/minecraft/world/item/ServerItemCooldowns.java +++ b/net/minecraft/world/item/ServerItemCooldowns.java @@ -1,6 +1,7 @@ package net.minecraft.world.item; import net.minecraft.network.protocol.game.ClientboundCooldownPacket; +import net.minecraft.resources.ResourceLocation; import net.minecraft.server.level.ServerPlayer; public class ServerItemCooldowns extends ItemCooldowns { @@ -11,14 +12,14 @@ public class ServerItemCooldowns extends ItemCooldowns { } @Override - protected void onCooldownStarted(Item item, int ticks) { - super.onCooldownStarted(item, ticks); - this.player.connection.send(new ClientboundCooldownPacket(item, ticks)); + protected void onCooldownStarted(ResourceLocation resourceLocation, int i) { + super.onCooldownStarted(resourceLocation, i); + this.player.connection.send(new ClientboundCooldownPacket(resourceLocation, i)); } @Override - protected void onCooldownEnded(Item item) { - super.onCooldownEnded(item); - this.player.connection.send(new ClientboundCooldownPacket(item, 0)); + protected void onCooldownEnded(ResourceLocation resourceLocation) { + super.onCooldownEnded(resourceLocation); + this.player.connection.send(new ClientboundCooldownPacket(resourceLocation, 0)); } } diff --git a/net/minecraft/world/item/ShearsItem.java b/net/minecraft/world/item/ShearsItem.java index 8dc7be47..cbcec1d7 100644 --- a/net/minecraft/world/item/ShearsItem.java +++ b/net/minecraft/world/item/ShearsItem.java @@ -3,6 +3,9 @@ package net.minecraft.world.item; import java.util.List; import net.minecraft.advancements.CriteriaTriggers; import net.minecraft.core.BlockPos; +import net.minecraft.core.HolderGetter; +import net.minecraft.core.HolderSet; +import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.server.level.ServerPlayer; import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; @@ -14,10 +17,12 @@ import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.component.Tool; import net.minecraft.world.item.context.UseOnContext; import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.GrowingPlantHeadBlock; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.level.gameevent.GameEvent.Context; public class ShearsItem extends Item { public ShearsItem(Item.Properties properties) { @@ -25,12 +30,13 @@ public class ShearsItem extends Item { } public static Tool createToolProperties() { + HolderGetter holderGetter = BuiltInRegistries.acquireBootstrapRegistrationLookup(BuiltInRegistries.BLOCK); return new Tool( List.of( - Tool.Rule.minesAndDrops(List.of(Blocks.COBWEB), 15.0F), - Tool.Rule.overrideSpeed(BlockTags.LEAVES, 15.0F), - Tool.Rule.overrideSpeed(BlockTags.WOOL, 5.0F), - Tool.Rule.overrideSpeed(List.of(Blocks.VINE, Blocks.GLOW_LICHEN), 2.0F) + Tool.Rule.minesAndDrops(HolderSet.direct(Blocks.COBWEB.builtInRegistryHolder()), 15.0F), + Tool.Rule.overrideSpeed(holderGetter.getOrThrow(BlockTags.LEAVES), 15.0F), + Tool.Rule.overrideSpeed(holderGetter.getOrThrow(BlockTags.WOOL), 5.0F), + Tool.Rule.overrideSpeed(HolderSet.direct(Blocks.VINE.builtInRegistryHolder(), Blocks.GLOW_LICHEN.builtInRegistryHolder()), 2.0F) ), 1.0F, 1 @@ -69,12 +75,12 @@ public class ShearsItem extends Item { level.playSound(player, blockPos, SoundEvents.GROWING_PLANT_CROP, SoundSource.BLOCKS, 1.0F, 1.0F); BlockState blockState2 = growingPlantHeadBlock.getMaxAgeState(blockState); level.setBlockAndUpdate(blockPos, blockState2); - level.gameEvent(GameEvent.BLOCK_CHANGE, blockPos, GameEvent.Context.of(context.getPlayer(), blockState2)); + level.gameEvent(GameEvent.BLOCK_CHANGE, blockPos, Context.of(context.getPlayer(), blockState2)); if (player != null) { itemStack.hurtAndBreak(1, player, LivingEntity.getSlotForHand(context.getHand())); } - return InteractionResult.sidedSuccess(level.isClientSide); + return InteractionResult.SUCCESS; } else { return super.useOn(context); } diff --git a/net/minecraft/world/item/ShieldItem.java b/net/minecraft/world/item/ShieldItem.java index aea88305..9b2536f6 100644 --- a/net/minecraft/world/item/ShieldItem.java +++ b/net/minecraft/world/item/ShieldItem.java @@ -3,28 +3,24 @@ package net.minecraft.world.item; import java.util.List; import net.minecraft.core.component.DataComponents; import net.minecraft.network.chat.Component; -import net.minecraft.tags.ItemTags; import net.minecraft.world.InteractionHand; -import net.minecraft.world.InteractionResultHolder; -import net.minecraft.world.entity.EquipmentSlot; +import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.player.Player; import net.minecraft.world.level.Level; -import net.minecraft.world.level.block.DispenserBlock; -public class ShieldItem extends Item implements Equipable { +public class ShieldItem extends Item { public static final int EFFECTIVE_BLOCK_DELAY = 5; public static final float MINIMUM_DURABILITY_DAMAGE = 3.0F; public ShieldItem(Item.Properties properties) { super(properties); - DispenserBlock.registerBehavior(this, ArmorItem.DISPENSE_ITEM_BEHAVIOR); } @Override - public String getDescriptionId(ItemStack stack) { + public Component getName(ItemStack stack) { DyeColor dyeColor = stack.get(DataComponents.BASE_COLOR); - return dyeColor != null ? this.getDescriptionId() + "." + dyeColor.getName() : super.getDescriptionId(stack); + return (Component)(dyeColor != null ? Component.translatable(this.descriptionId + "." + dyeColor.getName()) : super.getName(stack)); } @Override @@ -33,8 +29,8 @@ public class ShieldItem extends Item implements Equipable { } @Override - public UseAnim getUseAnimation(ItemStack stack) { - return UseAnim.BLOCK; + public ItemUseAnimation getUseAnimation(ItemStack itemStack) { + return ItemUseAnimation.BLOCK; } @Override @@ -43,19 +39,8 @@ public class ShieldItem extends Item implements Equipable { } @Override - public InteractionResultHolder use(Level level, Player player, InteractionHand usedHand) { - ItemStack itemStack = player.getItemInHand(usedHand); - player.startUsingItem(usedHand); - return InteractionResultHolder.consume(itemStack); - } - - @Override - public boolean isValidRepairItem(ItemStack stack, ItemStack repairCandidate) { - return repairCandidate.is(ItemTags.PLANKS) || super.isValidRepairItem(stack, repairCandidate); - } - - @Override - public EquipmentSlot getEquipmentSlot() { - return EquipmentSlot.OFFHAND; + public InteractionResult use(Level level, Player player, InteractionHand interactionHand) { + player.startUsingItem(interactionHand); + return InteractionResult.CONSUME; } } diff --git a/net/minecraft/world/item/ShovelItem.java b/net/minecraft/world/item/ShovelItem.java index bb235854..d4e26813 100644 --- a/net/minecraft/world/item/ShovelItem.java +++ b/net/minecraft/world/item/ShovelItem.java @@ -18,6 +18,7 @@ import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.CampfireBlock; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.level.gameevent.GameEvent.Context; public class ShovelItem extends DiggerItem { /** @@ -34,8 +35,8 @@ public class ShovelItem extends DiggerItem { .build() ); - public ShovelItem(Tier tier, Item.Properties properties) { - super(tier, BlockTags.MINEABLE_WITH_SHOVEL, properties); + public ShovelItem(ToolMaterial toolMaterial, float f, float g, Item.Properties properties) { + super(toolMaterial, BlockTags.MINEABLE_WITH_SHOVEL, f, g, properties); } @Override @@ -64,13 +65,13 @@ public class ShovelItem extends DiggerItem { if (blockState3 != null) { if (!level.isClientSide) { level.setBlock(blockPos, blockState3, 11); - level.gameEvent(GameEvent.BLOCK_CHANGE, blockPos, GameEvent.Context.of(player, blockState3)); + level.gameEvent(GameEvent.BLOCK_CHANGE, blockPos, Context.of(player, blockState3)); if (player != null) { context.getItemInHand().hurtAndBreak(1, player, LivingEntity.getSlotForHand(context.getHand())); } } - return InteractionResult.sidedSuccess(level.isClientSide); + return InteractionResult.SUCCESS; } else { return InteractionResult.PASS; } diff --git a/net/minecraft/world/item/SignItem.java b/net/minecraft/world/item/SignItem.java index a86991b8..56f7721d 100644 --- a/net/minecraft/world/item/SignItem.java +++ b/net/minecraft/world/item/SignItem.java @@ -11,12 +11,12 @@ import net.minecraft.world.level.block.state.BlockState; import org.jetbrains.annotations.Nullable; public class SignItem extends StandingAndWallBlockItem { - public SignItem(Item.Properties properties, Block standingBlock, Block wallBlock) { - super(standingBlock, wallBlock, properties, Direction.DOWN); + public SignItem(Block block, Block block2, Item.Properties properties) { + super(block, block2, Direction.DOWN, properties); } public SignItem(Item.Properties properties, Block standingBlock, Block wallBlock, Direction attachmentDirection) { - super(standingBlock, wallBlock, properties, attachmentDirection); + super(standingBlock, wallBlock, attachmentDirection, properties); } @Override diff --git a/net/minecraft/world/item/SmithingTemplateItem.java b/net/minecraft/world/item/SmithingTemplateItem.java index 1474f2ae..1a48c2f0 100644 --- a/net/minecraft/world/item/SmithingTemplateItem.java +++ b/net/minecraft/world/item/SmithingTemplateItem.java @@ -5,10 +5,7 @@ import net.minecraft.ChatFormatting; import net.minecraft.Util; import net.minecraft.network.chat.CommonComponents; import net.minecraft.network.chat.Component; -import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.flag.FeatureFlag; -import net.minecraft.world.item.armortrim.TrimPattern; public class SmithingTemplateItem extends Item { private static final ChatFormatting TITLE_FORMAT = ChatFormatting.GRAY; @@ -21,8 +18,8 @@ public class SmithingTemplateItem extends Item { Util.makeDescriptionId("item", ResourceLocation.withDefaultNamespace("smithing_template.applies_to")) ) .withStyle(TITLE_FORMAT); - private static final Component NETHERITE_UPGRADE = Component.translatable( - Util.makeDescriptionId("upgrade", ResourceLocation.withDefaultNamespace("netherite_upgrade")) + private static final Component SMITHING_TEMPLATE_SUFFIX = Component.translatable( + Util.makeDescriptionId("item", ResourceLocation.withDefaultNamespace("smithing_template")) ) .withStyle(TITLE_FORMAT); private static final Component ARMOR_TRIM_APPLIES_TO = Component.translatable( @@ -71,58 +68,50 @@ public class SmithingTemplateItem extends Item { private static final ResourceLocation EMPTY_SLOT_AMETHYST_SHARD = ResourceLocation.withDefaultNamespace("item/empty_slot_amethyst_shard"); private final Component appliesTo; private final Component ingredients; - private final Component upgradeDescription; private final Component baseSlotDescription; private final Component additionsSlotDescription; private final List baseSlotEmptyIcons; private final List additionalSlotEmptyIcons; public SmithingTemplateItem( - Component appliesTo, - Component ingredients, - Component upgradeDescription, - Component baseSlotDescription, - Component additionsSlotDescription, - List baseSlotEmptyIcons, - List additionalSlotEmptyIcons, - FeatureFlag... requiredFeatures + Component component, + Component component2, + Component component3, + Component component4, + List list, + List list2, + Item.Properties properties ) { - super(new Item.Properties().requiredFeatures(requiredFeatures)); - this.appliesTo = appliesTo; - this.ingredients = ingredients; - this.upgradeDescription = upgradeDescription; - this.baseSlotDescription = baseSlotDescription; - this.additionsSlotDescription = additionsSlotDescription; - this.baseSlotEmptyIcons = baseSlotEmptyIcons; - this.additionalSlotEmptyIcons = additionalSlotEmptyIcons; + super(properties); + this.appliesTo = component; + this.ingredients = component2; + this.baseSlotDescription = component3; + this.additionsSlotDescription = component4; + this.baseSlotEmptyIcons = list; + this.additionalSlotEmptyIcons = list2; } - public static SmithingTemplateItem createArmorTrimTemplate(ResourceKey key, FeatureFlag... requiredFeatures) { - return createArmorTrimTemplate(key.location(), requiredFeatures); - } - - public static SmithingTemplateItem createArmorTrimTemplate(ResourceLocation name, FeatureFlag... requiredFeatures) { + public static SmithingTemplateItem createArmorTrimTemplate(Item.Properties properties) { return new SmithingTemplateItem( ARMOR_TRIM_APPLIES_TO, ARMOR_TRIM_INGREDIENTS, - Component.translatable(Util.makeDescriptionId("trim_pattern", name)).withStyle(TITLE_FORMAT), ARMOR_TRIM_BASE_SLOT_DESCRIPTION, ARMOR_TRIM_ADDITIONS_SLOT_DESCRIPTION, createTrimmableArmorIconList(), createTrimmableMaterialIconList(), - requiredFeatures + properties ); } - public static SmithingTemplateItem createNetheriteUpgradeTemplate() { + public static SmithingTemplateItem createNetheriteUpgradeTemplate(Item.Properties properties) { return new SmithingTemplateItem( NETHERITE_UPGRADE_APPLIES_TO, NETHERITE_UPGRADE_INGREDIENTS, - NETHERITE_UPGRADE, NETHERITE_UPGRADE_BASE_SLOT_DESCRIPTION, NETHERITE_UPGRADE_ADDITIONS_SLOT_DESCRIPTION, createNetheriteUpgradeIconList(), - createNetheriteUpgradeMaterialList() + createNetheriteUpgradeMaterialList(), + properties ); } @@ -157,7 +146,7 @@ public class SmithingTemplateItem extends Item { @Override public void appendHoverText(ItemStack stack, Item.TooltipContext context, List tooltipComponents, TooltipFlag tooltipFlag) { super.appendHoverText(stack, context, tooltipComponents, tooltipFlag); - tooltipComponents.add(this.upgradeDescription); + tooltipComponents.add(SMITHING_TEMPLATE_SUFFIX); tooltipComponents.add(CommonComponents.EMPTY); tooltipComponents.add(APPLIES_TO_TITLE); tooltipComponents.add(CommonComponents.space().append(this.appliesTo)); diff --git a/net/minecraft/world/item/SnowballItem.java b/net/minecraft/world/item/SnowballItem.java index 19cac38a..e8e4704b 100644 --- a/net/minecraft/world/item/SnowballItem.java +++ b/net/minecraft/world/item/SnowballItem.java @@ -2,11 +2,12 @@ package net.minecraft.world.item; import net.minecraft.core.Direction; import net.minecraft.core.Position; +import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; import net.minecraft.stats.Stats; import net.minecraft.world.InteractionHand; -import net.minecraft.world.InteractionResultHolder; +import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.projectile.Projectile; import net.minecraft.world.entity.projectile.Snowball; @@ -18,8 +19,8 @@ public class SnowballItem extends Item implements ProjectileItem { } @Override - public InteractionResultHolder use(Level level, Player player, InteractionHand usedHand) { - ItemStack itemStack = player.getItemInHand(usedHand); + public InteractionResult use(Level level, Player player, InteractionHand interactionHand) { + ItemStack itemStack = player.getItemInHand(interactionHand); level.playSound( null, player.getX(), @@ -30,22 +31,17 @@ public class SnowballItem extends Item implements ProjectileItem { 0.5F, 0.4F / (level.getRandom().nextFloat() * 0.4F + 0.8F) ); - if (!level.isClientSide) { - Snowball snowball = new Snowball(level, player); - snowball.setItem(itemStack); - snowball.shootFromRotation(player, player.getXRot(), player.getYRot(), 0.0F, 1.5F, 1.0F); - level.addFreshEntity(snowball); + if (level instanceof ServerLevel serverLevel) { + Projectile.spawnProjectileFromRotation(Snowball::new, serverLevel, itemStack, player, 0.0F, 1.5F, 1.0F); } player.awardStat(Stats.ITEM_USED.get(this)); itemStack.consume(1, player); - return InteractionResultHolder.sidedSuccess(itemStack, level.isClientSide()); + return InteractionResult.SUCCESS; } @Override public Projectile asProjectile(Level level, Position pos, ItemStack stack, Direction direction) { - Snowball snowball = new Snowball(level, pos.x(), pos.y(), pos.z()); - snowball.setItem(stack); - return snowball; + return new Snowball(level, pos.x(), pos.y(), pos.z(), stack); } } diff --git a/net/minecraft/world/item/SolidBucketItem.java b/net/minecraft/world/item/SolidBucketItem.java index 48768afd..f726a5fb 100644 --- a/net/minecraft/world/item/SolidBucketItem.java +++ b/net/minecraft/world/item/SolidBucketItem.java @@ -32,11 +32,6 @@ public class SolidBucketItem extends BlockItem implements DispensibleContainerIt return interactionResult; } - @Override - public String getDescriptionId() { - return this.getOrCreateDescriptionId(); - } - @Override protected SoundEvent getPlaceSound(BlockState state) { return this.placeSound; diff --git a/net/minecraft/world/item/SpawnEggItem.java b/net/minecraft/world/item/SpawnEggItem.java index f594454f..d6440dbb 100644 --- a/net/minecraft/world/item/SpawnEggItem.java +++ b/net/minecraft/world/item/SpawnEggItem.java @@ -14,25 +14,24 @@ import net.minecraft.server.level.ServerLevel; import net.minecraft.stats.Stats; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; -import net.minecraft.world.InteractionResultHolder; import net.minecraft.world.entity.AgeableMob; import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.Mob; -import net.minecraft.world.entity.MobSpawnType; import net.minecraft.world.entity.player.Player; import net.minecraft.world.flag.FeatureFlagSet; import net.minecraft.world.item.component.CustomData; import net.minecraft.world.item.context.UseOnContext; -import net.minecraft.world.level.ClipContext; import net.minecraft.world.level.Level; import net.minecraft.world.level.Spawner; +import net.minecraft.world.level.ClipContext.Fluid; import net.minecraft.world.level.block.LiquidBlock; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.gameevent.GameEvent; import net.minecraft.world.phys.BlockHitResult; -import net.minecraft.world.phys.HitResult; import net.minecraft.world.phys.Vec3; +import net.minecraft.world.phys.HitResult.Type; import org.jetbrains.annotations.Nullable; public class SpawnEggItem extends Item { @@ -53,7 +52,7 @@ public class SpawnEggItem extends Item { @Override public InteractionResult useOn(UseOnContext context) { Level level = context.getLevel(); - if (!(level instanceof ServerLevel)) { + if (level.isClientSide) { return InteractionResult.SUCCESS; } else { ItemStack itemStack = context.getItemInHand(); @@ -66,7 +65,7 @@ public class SpawnEggItem extends Item { level.sendBlockUpdated(blockPos, blockState, blockState, 3); level.gameEvent(context.getPlayer(), GameEvent.BLOCK_CHANGE, blockPos); itemStack.shrink(1); - return InteractionResult.CONSUME; + return InteractionResult.SUCCESS; } else { BlockPos blockPos2; if (blockState.getCollisionShape(level, blockPos).isEmpty()) { @@ -81,7 +80,7 @@ public class SpawnEggItem extends Item { itemStack, context.getPlayer(), blockPos2, - MobSpawnType.SPAWN_EGG, + EntitySpawnReason.SPAWN_ITEM_USE, true, !Objects.equals(blockPos, blockPos2) && direction == Direction.UP ) @@ -90,36 +89,36 @@ public class SpawnEggItem extends Item { level.gameEvent(context.getPlayer(), GameEvent.ENTITY_PLACE, blockPos); } - return InteractionResult.CONSUME; + return InteractionResult.SUCCESS; } } } @Override - public InteractionResultHolder use(Level level, Player player, InteractionHand usedHand) { - ItemStack itemStack = player.getItemInHand(usedHand); - BlockHitResult blockHitResult = getPlayerPOVHitResult(level, player, ClipContext.Fluid.SOURCE_ONLY); - if (blockHitResult.getType() != HitResult.Type.BLOCK) { - return InteractionResultHolder.pass(itemStack); - } else if (!(level instanceof ServerLevel)) { - return InteractionResultHolder.success(itemStack); + public InteractionResult use(Level level, Player player, InteractionHand interactionHand) { + ItemStack itemStack = player.getItemInHand(interactionHand); + BlockHitResult blockHitResult = getPlayerPOVHitResult(level, player, Fluid.SOURCE_ONLY); + if (blockHitResult.getType() != Type.BLOCK) { + return InteractionResult.PASS; + } else if (level.isClientSide) { + return InteractionResult.SUCCESS; } else { BlockPos blockPos = blockHitResult.getBlockPos(); if (!(level.getBlockState(blockPos).getBlock() instanceof LiquidBlock)) { - return InteractionResultHolder.pass(itemStack); + return InteractionResult.PASS; } else if (level.mayInteract(player, blockPos) && player.mayUseItemAt(blockPos, blockHitResult.getDirection(), itemStack)) { EntityType entityType = this.getType(itemStack); - Entity entity = entityType.spawn((ServerLevel)level, itemStack, player, blockPos, MobSpawnType.SPAWN_EGG, false, false); + Entity entity = entityType.spawn((ServerLevel)level, itemStack, player, blockPos, EntitySpawnReason.SPAWN_ITEM_USE, false, false); if (entity == null) { - return InteractionResultHolder.pass(itemStack); + return InteractionResult.PASS; } else { itemStack.consume(1, player); player.awardStat(Stats.ITEM_USED.get(this)); level.gameEvent(player, GameEvent.ENTITY_PLACE, entity.position()); - return InteractionResultHolder.consume(itemStack); + return InteractionResult.SUCCESS; } } else { - return InteractionResultHolder.fail(itemStack); + return InteractionResult.FAIL; } } } @@ -161,7 +160,7 @@ public class SpawnEggItem extends Item { if (mob instanceof AgeableMob) { mob2 = ((AgeableMob)mob).getBreedOffspring(serverLevel, (AgeableMob)mob); } else { - mob2 = entityType.create(serverLevel); + mob2 = entityType.create(serverLevel, EntitySpawnReason.SPAWN_ITEM_USE); } if (mob2 == null) { diff --git a/net/minecraft/world/item/SplashPotionItem.java b/net/minecraft/world/item/SplashPotionItem.java index ceb25968..b79ed084 100644 --- a/net/minecraft/world/item/SplashPotionItem.java +++ b/net/minecraft/world/item/SplashPotionItem.java @@ -3,7 +3,7 @@ package net.minecraft.world.item; import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; import net.minecraft.world.InteractionHand; -import net.minecraft.world.InteractionResultHolder; +import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.player.Player; import net.minecraft.world.level.Level; @@ -13,7 +13,7 @@ public class SplashPotionItem extends ThrowablePotionItem { } @Override - public InteractionResultHolder use(Level level, Player player, InteractionHand usedHand) { + public InteractionResult use(Level level, Player player, InteractionHand interactionHand) { level.playSound( null, player.getX(), @@ -24,6 +24,6 @@ public class SplashPotionItem extends ThrowablePotionItem { 0.5F, 0.4F / (level.getRandom().nextFloat() * 0.4F + 0.8F) ); - return super.use(level, player, usedHand); + return super.use(level, player, interactionHand); } } diff --git a/net/minecraft/world/item/SpyglassItem.java b/net/minecraft/world/item/SpyglassItem.java index 01967605..169772fc 100644 --- a/net/minecraft/world/item/SpyglassItem.java +++ b/net/minecraft/world/item/SpyglassItem.java @@ -3,7 +3,7 @@ package net.minecraft.world.item; import net.minecraft.sounds.SoundEvents; import net.minecraft.stats.Stats; import net.minecraft.world.InteractionHand; -import net.minecraft.world.InteractionResultHolder; +import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.player.Player; import net.minecraft.world.level.Level; @@ -22,15 +22,15 @@ public class SpyglassItem extends Item { } @Override - public UseAnim getUseAnimation(ItemStack stack) { - return UseAnim.SPYGLASS; + public ItemUseAnimation getUseAnimation(ItemStack itemStack) { + return ItemUseAnimation.SPYGLASS; } @Override - public InteractionResultHolder use(Level level, Player player, InteractionHand usedHand) { + public InteractionResult use(Level level, Player player, InteractionHand interactionHand) { player.playSound(SoundEvents.SPYGLASS_USE, 1.0F, 1.0F); player.awardStat(Stats.ITEM_USED.get(this)); - return ItemUtils.startUsingInstantly(level, player, usedHand); + return ItemUtils.startUsingInstantly(level, player, interactionHand); } @Override @@ -40,8 +40,9 @@ public class SpyglassItem extends Item { } @Override - public void releaseUsing(ItemStack stack, Level level, LivingEntity livingEntity, int timeCharged) { + public boolean releaseUsing(ItemStack itemStack, Level level, LivingEntity livingEntity, int i) { this.stopUsing(livingEntity); + return true; } private void stopUsing(LivingEntity user) { diff --git a/net/minecraft/world/item/StandingAndWallBlockItem.java b/net/minecraft/world/item/StandingAndWallBlockItem.java index e7e741a2..f5375913 100644 --- a/net/minecraft/world/item/StandingAndWallBlockItem.java +++ b/net/minecraft/world/item/StandingAndWallBlockItem.java @@ -14,10 +14,10 @@ public class StandingAndWallBlockItem extends BlockItem { protected final Block wallBlock; private final Direction attachmentDirection; - public StandingAndWallBlockItem(Block block, Block wallBlock, Item.Properties properties, Direction attachmentDirection) { + public StandingAndWallBlockItem(Block block, Block block2, Direction direction, Item.Properties properties) { super(block, properties); - this.wallBlock = wallBlock; - this.attachmentDirection = attachmentDirection; + this.wallBlock = block2; + this.attachmentDirection = direction; } protected boolean canPlace(LevelReader level, BlockState state, BlockPos pos) { diff --git a/net/minecraft/world/item/SuspiciousStewItem.java b/net/minecraft/world/item/SuspiciousStewItem.java deleted file mode 100644 index dcae6ec9..00000000 --- a/net/minecraft/world/item/SuspiciousStewItem.java +++ /dev/null @@ -1,45 +0,0 @@ -package net.minecraft.world.item; - -import java.util.ArrayList; -import java.util.List; -import net.minecraft.core.component.DataComponents; -import net.minecraft.network.chat.Component; -import net.minecraft.world.effect.MobEffectInstance; -import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.item.alchemy.PotionContents; -import net.minecraft.world.item.component.SuspiciousStewEffects; -import net.minecraft.world.level.Level; - -public class SuspiciousStewItem extends Item { - public static final int DEFAULT_DURATION = 160; - - public SuspiciousStewItem(Item.Properties properties) { - super(properties); - } - - @Override - public void appendHoverText(ItemStack stack, Item.TooltipContext context, List tooltipComponents, TooltipFlag tooltipFlag) { - super.appendHoverText(stack, context, tooltipComponents, tooltipFlag); - if (tooltipFlag.isCreative()) { - List list = new ArrayList(); - SuspiciousStewEffects suspiciousStewEffects = stack.getOrDefault(DataComponents.SUSPICIOUS_STEW_EFFECTS, SuspiciousStewEffects.EMPTY); - - for (SuspiciousStewEffects.Entry entry : suspiciousStewEffects.effects()) { - list.add(entry.createEffectInstance()); - } - - PotionContents.addPotionTooltip(list, tooltipComponents::add, 1.0F, context.tickRate()); - } - } - - @Override - public ItemStack finishUsingItem(ItemStack stack, Level level, LivingEntity livingEntity) { - SuspiciousStewEffects suspiciousStewEffects = stack.getOrDefault(DataComponents.SUSPICIOUS_STEW_EFFECTS, SuspiciousStewEffects.EMPTY); - - for (SuspiciousStewEffects.Entry entry : suspiciousStewEffects.effects()) { - livingEntity.addEffect(entry.createEffectInstance()); - } - - return super.finishUsingItem(stack, level, livingEntity); - } -} diff --git a/net/minecraft/world/item/SwordItem.java b/net/minecraft/world/item/SwordItem.java index fa1ddc17..952dda50 100644 --- a/net/minecraft/world/item/SwordItem.java +++ b/net/minecraft/world/item/SwordItem.java @@ -1,39 +1,15 @@ package net.minecraft.world.item; -import java.util.List; import net.minecraft.core.BlockPos; -import net.minecraft.core.component.DataComponents; -import net.minecraft.tags.BlockTags; import net.minecraft.world.entity.EquipmentSlot; -import net.minecraft.world.entity.EquipmentSlotGroup; import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.entity.ai.attributes.AttributeModifier; -import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.entity.player.Player; -import net.minecraft.world.item.component.ItemAttributeModifiers; -import net.minecraft.world.item.component.Tool; import net.minecraft.world.level.Level; -import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.state.BlockState; -public class SwordItem extends TieredItem { - public SwordItem(Tier tier, Item.Properties properties) { - super(tier, properties.component(DataComponents.TOOL, createToolProperties())); - } - - private static Tool createToolProperties() { - return new Tool(List.of(Tool.Rule.minesAndDrops(List.of(Blocks.COBWEB), 15.0F), Tool.Rule.overrideSpeed(BlockTags.SWORD_EFFICIENT, 1.5F)), 1.0F, 2); - } - - public static ItemAttributeModifiers createAttributes(Tier tier, int attackDamage, float attackSpeed) { - return ItemAttributeModifiers.builder() - .add( - Attributes.ATTACK_DAMAGE, - new AttributeModifier(BASE_ATTACK_DAMAGE_ID, attackDamage + tier.getAttackDamageBonus(), AttributeModifier.Operation.ADD_VALUE), - EquipmentSlotGroup.MAINHAND - ) - .add(Attributes.ATTACK_SPEED, new AttributeModifier(BASE_ATTACK_SPEED_ID, attackSpeed, AttributeModifier.Operation.ADD_VALUE), EquipmentSlotGroup.MAINHAND) - .build(); +public class SwordItem extends Item { + public SwordItem(ToolMaterial toolMaterial, float f, float g, Item.Properties properties) { + super(toolMaterial.applySwordProperties(properties, f, g)); } @Override diff --git a/net/minecraft/world/item/ThrowablePotionItem.java b/net/minecraft/world/item/ThrowablePotionItem.java index a3b8c865..afad4975 100644 --- a/net/minecraft/world/item/ThrowablePotionItem.java +++ b/net/minecraft/world/item/ThrowablePotionItem.java @@ -2,12 +2,14 @@ package net.minecraft.world.item; import net.minecraft.core.Direction; import net.minecraft.core.Position; +import net.minecraft.server.level.ServerLevel; import net.minecraft.stats.Stats; import net.minecraft.world.InteractionHand; -import net.minecraft.world.InteractionResultHolder; +import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.projectile.Projectile; import net.minecraft.world.entity.projectile.ThrownPotion; +import net.minecraft.world.item.ProjectileItem.DispenseConfig; import net.minecraft.world.level.Level; public class ThrowablePotionItem extends PotionItem implements ProjectileItem { @@ -16,32 +18,24 @@ public class ThrowablePotionItem extends PotionItem implements ProjectileItem { } @Override - public InteractionResultHolder use(Level level, Player player, InteractionHand usedHand) { - ItemStack itemStack = player.getItemInHand(usedHand); - if (!level.isClientSide) { - ThrownPotion thrownPotion = new ThrownPotion(level, player); - thrownPotion.setItem(itemStack); - thrownPotion.shootFromRotation(player, player.getXRot(), player.getYRot(), -20.0F, 0.5F, 1.0F); - level.addFreshEntity(thrownPotion); + public InteractionResult use(Level level, Player player, InteractionHand interactionHand) { + ItemStack itemStack = player.getItemInHand(interactionHand); + if (level instanceof ServerLevel serverLevel) { + Projectile.spawnProjectileFromRotation(ThrownPotion::new, serverLevel, itemStack, player, -20.0F, 0.5F, 1.0F); } player.awardStat(Stats.ITEM_USED.get(this)); itemStack.consume(1, player); - return InteractionResultHolder.sidedSuccess(itemStack, level.isClientSide()); + return InteractionResult.SUCCESS; } @Override public Projectile asProjectile(Level level, Position pos, ItemStack stack, Direction direction) { - ThrownPotion thrownPotion = new ThrownPotion(level, pos.x(), pos.y(), pos.z()); - thrownPotion.setItem(stack); - return thrownPotion; + return new ThrownPotion(level, pos.x(), pos.y(), pos.z(), stack); } @Override - public ProjectileItem.DispenseConfig createDispenseConfig() { - return ProjectileItem.DispenseConfig.builder() - .uncertainty(ProjectileItem.DispenseConfig.DEFAULT.uncertainty() * 0.5F) - .power(ProjectileItem.DispenseConfig.DEFAULT.power() * 1.25F) - .build(); + public DispenseConfig createDispenseConfig() { + return DispenseConfig.builder().uncertainty(DispenseConfig.DEFAULT.uncertainty() * 0.5F).power(DispenseConfig.DEFAULT.power() * 1.25F).build(); } } diff --git a/net/minecraft/world/item/Tier.java b/net/minecraft/world/item/Tier.java deleted file mode 100644 index df166f80..00000000 --- a/net/minecraft/world/item/Tier.java +++ /dev/null @@ -1,25 +0,0 @@ -package net.minecraft.world.item; - -import java.util.List; -import net.minecraft.tags.TagKey; -import net.minecraft.world.item.component.Tool; -import net.minecraft.world.item.crafting.Ingredient; -import net.minecraft.world.level.block.Block; - -public interface Tier { - int getUses(); - - float getSpeed(); - - float getAttackDamageBonus(); - - TagKey getIncorrectBlocksForDrops(); - - int getEnchantmentValue(); - - Ingredient getRepairIngredient(); - - default Tool createToolProperties(TagKey block) { - return new Tool(List.of(Tool.Rule.deniesDrops(this.getIncorrectBlocksForDrops()), Tool.Rule.minesAndDrops(block, this.getSpeed())), 1.0F, 1); - } -} diff --git a/net/minecraft/world/item/TieredItem.java b/net/minecraft/world/item/TieredItem.java deleted file mode 100644 index 4df6425b..00000000 --- a/net/minecraft/world/item/TieredItem.java +++ /dev/null @@ -1,24 +0,0 @@ -package net.minecraft.world.item; - -public class TieredItem extends Item { - private final Tier tier; - - public TieredItem(Tier tier, Item.Properties properties) { - super(properties.durability(tier.getUses())); - this.tier = tier; - } - - public Tier getTier() { - return this.tier; - } - - @Override - public int getEnchantmentValue() { - return this.tier.getEnchantmentValue(); - } - - @Override - public boolean isValidRepairItem(ItemStack stack, ItemStack repairCandidate) { - return this.tier.getRepairIngredient().test(repairCandidate) || super.isValidRepairItem(stack, repairCandidate); - } -} diff --git a/net/minecraft/world/item/Tiers.java b/net/minecraft/world/item/Tiers.java deleted file mode 100644 index f4473f20..00000000 --- a/net/minecraft/world/item/Tiers.java +++ /dev/null @@ -1,71 +0,0 @@ -package net.minecraft.world.item; - -import com.google.common.base.Suppliers; -import java.util.function.Supplier; -import net.minecraft.tags.BlockTags; -import net.minecraft.tags.ItemTags; -import net.minecraft.tags.TagKey; -import net.minecraft.world.item.crafting.Ingredient; -import net.minecraft.world.level.block.Block; - -public enum Tiers implements Tier { - WOOD(BlockTags.INCORRECT_FOR_WOODEN_TOOL, 59, 2.0F, 0.0F, 15, () -> Ingredient.of(ItemTags.PLANKS)), - STONE(BlockTags.INCORRECT_FOR_STONE_TOOL, 131, 4.0F, 1.0F, 5, () -> Ingredient.of(ItemTags.STONE_TOOL_MATERIALS)), - IRON(BlockTags.INCORRECT_FOR_IRON_TOOL, 250, 6.0F, 2.0F, 14, () -> Ingredient.of(Items.IRON_INGOT)), - DIAMOND(BlockTags.INCORRECT_FOR_DIAMOND_TOOL, 1561, 8.0F, 3.0F, 10, () -> Ingredient.of(Items.DIAMOND)), - GOLD(BlockTags.INCORRECT_FOR_GOLD_TOOL, 32, 12.0F, 0.0F, 22, () -> Ingredient.of(Items.GOLD_INGOT)), - NETHERITE(BlockTags.INCORRECT_FOR_NETHERITE_TOOL, 2031, 9.0F, 4.0F, 15, () -> Ingredient.of(Items.NETHERITE_INGOT)); - - private final TagKey incorrectBlocksForDrops; - private final int uses; - private final float speed; - private final float damage; - private final int enchantmentValue; - private final Supplier repairIngredient; - - private Tiers( - final TagKey incorrectBlockForDrops, - final int uses, - final float speed, - final float damage, - final int enchantmentValue, - final Supplier repairIngredient - ) { - this.incorrectBlocksForDrops = incorrectBlockForDrops; - this.uses = uses; - this.speed = speed; - this.damage = damage; - this.enchantmentValue = enchantmentValue; - this.repairIngredient = Suppliers.memoize(repairIngredient::get); - } - - @Override - public int getUses() { - return this.uses; - } - - @Override - public float getSpeed() { - return this.speed; - } - - @Override - public float getAttackDamageBonus() { - return this.damage; - } - - @Override - public TagKey getIncorrectBlocksForDrops() { - return this.incorrectBlocksForDrops; - } - - @Override - public int getEnchantmentValue() { - return this.enchantmentValue; - } - - @Override - public Ingredient getRepairIngredient() { - return (Ingredient)this.repairIngredient.get(); - } -} diff --git a/net/minecraft/world/item/TippedArrowItem.java b/net/minecraft/world/item/TippedArrowItem.java index d8bbc608..d4423732 100644 --- a/net/minecraft/world/item/TippedArrowItem.java +++ b/net/minecraft/world/item/TippedArrowItem.java @@ -3,7 +3,6 @@ package net.minecraft.world.item; import java.util.List; import net.minecraft.core.component.DataComponents; import net.minecraft.network.chat.Component; -import net.minecraft.world.item.alchemy.Potion; import net.minecraft.world.item.alchemy.PotionContents; import net.minecraft.world.item.alchemy.Potions; @@ -28,7 +27,8 @@ public class TippedArrowItem extends ArrowItem { } @Override - public String getDescriptionId(ItemStack stack) { - return Potion.getName(stack.getOrDefault(DataComponents.POTION_CONTENTS, PotionContents.EMPTY).potion(), this.getDescriptionId() + ".effect."); + public Component getName(ItemStack stack) { + PotionContents potionContents = stack.get(DataComponents.POTION_CONTENTS); + return potionContents != null ? potionContents.getName(this.descriptionId + ".effect.") : super.getName(stack); } } diff --git a/net/minecraft/world/item/ToolMaterial.java b/net/minecraft/world/item/ToolMaterial.java new file mode 100644 index 00000000..12a6dd92 --- /dev/null +++ b/net/minecraft/world/item/ToolMaterial.java @@ -0,0 +1,85 @@ +package net.minecraft.world.item; + +import java.util.List; +import net.minecraft.core.HolderGetter; +import net.minecraft.core.HolderSet; +import net.minecraft.core.component.DataComponents; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.tags.BlockTags; +import net.minecraft.tags.ItemTags; +import net.minecraft.tags.TagKey; +import net.minecraft.world.entity.EquipmentSlotGroup; +import net.minecraft.world.entity.ai.attributes.AttributeModifier; +import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.item.component.ItemAttributeModifiers; +import net.minecraft.world.item.component.Tool; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; + +public record ToolMaterial( + TagKey incorrectBlocksForDrops, int durability, float speed, float attackDamageBonus, int enchantmentValue, TagKey repairItems +) { + public static final ToolMaterial WOOD = new ToolMaterial(BlockTags.INCORRECT_FOR_WOODEN_TOOL, 59, 2.0F, 0.0F, 15, ItemTags.WOODEN_TOOL_MATERIALS); + public static final ToolMaterial STONE = new ToolMaterial(BlockTags.INCORRECT_FOR_STONE_TOOL, 131, 4.0F, 1.0F, 5, ItemTags.STONE_TOOL_MATERIALS); + public static final ToolMaterial IRON = new ToolMaterial(BlockTags.INCORRECT_FOR_IRON_TOOL, 250, 6.0F, 2.0F, 14, ItemTags.IRON_TOOL_MATERIALS); + public static final ToolMaterial DIAMOND = new ToolMaterial(BlockTags.INCORRECT_FOR_DIAMOND_TOOL, 1561, 8.0F, 3.0F, 10, ItemTags.DIAMOND_TOOL_MATERIALS); + public static final ToolMaterial GOLD = new ToolMaterial(BlockTags.INCORRECT_FOR_GOLD_TOOL, 32, 12.0F, 0.0F, 22, ItemTags.GOLD_TOOL_MATERIALS); + public static final ToolMaterial NETHERITE = new ToolMaterial(BlockTags.INCORRECT_FOR_NETHERITE_TOOL, 2031, 9.0F, 4.0F, 15, ItemTags.NETHERITE_TOOL_MATERIALS); + + private Item.Properties applyCommonProperties(Item.Properties properties) { + return properties.durability(this.durability).repairable(this.repairItems).enchantable(this.enchantmentValue); + } + + public Item.Properties applyToolProperties(Item.Properties properties, TagKey tagKey, float f, float g) { + HolderGetter holderGetter = BuiltInRegistries.acquireBootstrapRegistrationLookup(BuiltInRegistries.BLOCK); + return this.applyCommonProperties(properties) + .component( + DataComponents.TOOL, + new Tool( + List.of(Tool.Rule.deniesDrops(holderGetter.getOrThrow(this.incorrectBlocksForDrops)), Tool.Rule.minesAndDrops(holderGetter.getOrThrow(tagKey), this.speed)), + 1.0F, + 1 + ) + ) + .attributes(this.createToolAttributes(f, g)); + } + + private ItemAttributeModifiers createToolAttributes(float f, float g) { + return ItemAttributeModifiers.builder() + .add( + Attributes.ATTACK_DAMAGE, + new AttributeModifier(Item.BASE_ATTACK_DAMAGE_ID, f + this.attackDamageBonus, AttributeModifier.Operation.ADD_VALUE), + EquipmentSlotGroup.MAINHAND + ) + .add(Attributes.ATTACK_SPEED, new AttributeModifier(Item.BASE_ATTACK_SPEED_ID, g, AttributeModifier.Operation.ADD_VALUE), EquipmentSlotGroup.MAINHAND) + .build(); + } + + public Item.Properties applySwordProperties(Item.Properties properties, float f, float g) { + HolderGetter holderGetter = BuiltInRegistries.acquireBootstrapRegistrationLookup(BuiltInRegistries.BLOCK); + return this.applyCommonProperties(properties) + .component( + DataComponents.TOOL, + new Tool( + List.of( + Tool.Rule.minesAndDrops(HolderSet.direct(Blocks.COBWEB.builtInRegistryHolder()), 15.0F), + Tool.Rule.overrideSpeed(holderGetter.getOrThrow(BlockTags.SWORD_EFFICIENT), 1.5F) + ), + 1.0F, + 2 + ) + ) + .attributes(this.createSwordAttributes(f, g)); + } + + private ItemAttributeModifiers createSwordAttributes(float f, float g) { + return ItemAttributeModifiers.builder() + .add( + Attributes.ATTACK_DAMAGE, + new AttributeModifier(Item.BASE_ATTACK_DAMAGE_ID, f + this.attackDamageBonus, AttributeModifier.Operation.ADD_VALUE), + EquipmentSlotGroup.MAINHAND + ) + .add(Attributes.ATTACK_SPEED, new AttributeModifier(Item.BASE_ATTACK_SPEED_ID, g, AttributeModifier.Operation.ADD_VALUE), EquipmentSlotGroup.MAINHAND) + .build(); + } +} diff --git a/net/minecraft/world/item/TridentItem.java b/net/minecraft/world/item/TridentItem.java index e4743b24..89ec7f7c 100644 --- a/net/minecraft/world/item/TridentItem.java +++ b/net/minecraft/world/item/TridentItem.java @@ -5,13 +5,14 @@ import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.Holder; import net.minecraft.core.Position; +import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; import net.minecraft.stats.Stats; import net.minecraft.util.Mth; import net.minecraft.world.InteractionHand; -import net.minecraft.world.InteractionResultHolder; +import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.EquipmentSlotGroup; import net.minecraft.world.entity.LivingEntity; @@ -56,8 +57,8 @@ public class TridentItem extends Item implements ProjectileItem { } @Override - public UseAnim getUseAnimation(ItemStack stack) { - return UseAnim.SPEAR; + public ItemUseAnimation getUseAnimation(ItemStack itemStack) { + return ItemUseAnimation.SPEAR; } @Override @@ -66,75 +67,78 @@ public class TridentItem extends Item implements ProjectileItem { } @Override - public void releaseUsing(ItemStack stack, Level level, LivingEntity livingEntity, int timeCharged) { + public boolean releaseUsing(ItemStack itemStack, Level level, LivingEntity livingEntity, int i) { if (livingEntity instanceof Player player) { - int i = this.getUseDuration(stack, livingEntity) - timeCharged; - if (i >= 10) { - float f = EnchantmentHelper.getTridentSpinAttackStrength(stack, player); - if (!(f > 0.0F) || player.isInWaterOrRain()) { - if (!isTooDamagedToUse(stack)) { - Holder holder = (Holder)EnchantmentHelper.pickHighestLevel(stack, EnchantmentEffectComponents.TRIDENT_SOUND) - .orElse(SoundEvents.TRIDENT_THROW); - if (!level.isClientSide) { - stack.hurtAndBreak(1, player, LivingEntity.getSlotForHand(livingEntity.getUsedItemHand())); - if (f == 0.0F) { - ThrownTrident thrownTrident = new ThrownTrident(level, player, stack); - thrownTrident.shootFromRotation(player, player.getXRot(), player.getYRot(), 0.0F, 2.5F, 1.0F); - if (player.hasInfiniteMaterials()) { - thrownTrident.pickup = AbstractArrow.Pickup.CREATIVE_ONLY; - } - - level.addFreshEntity(thrownTrident); - level.playSound(null, thrownTrident, holder.value(), SoundSource.PLAYERS, 1.0F, 1.0F); - if (!player.hasInfiniteMaterials()) { - player.getInventory().removeItem(stack); - } - } - } - - player.awardStat(Stats.ITEM_USED.get(this)); - if (f > 0.0F) { - float g = player.getYRot(); - float h = player.getXRot(); - float j = -Mth.sin(g * (float) (Math.PI / 180.0)) * Mth.cos(h * (float) (Math.PI / 180.0)); - float k = -Mth.sin(h * (float) (Math.PI / 180.0)); - float l = Mth.cos(g * (float) (Math.PI / 180.0)) * Mth.cos(h * (float) (Math.PI / 180.0)); - float m = Mth.sqrt(j * j + k * k + l * l); - j *= f / m; - k *= f / m; - l *= f / m; - player.push(j, k, l); - player.startAutoSpinAttack(20, 8.0F, stack); - if (player.onGround()) { - float n = 1.1999999F; - player.move(MoverType.SELF, new Vec3(0.0, 1.1999999F, 0.0)); + int j = this.getUseDuration(itemStack, livingEntity) - i; + if (j < 10) { + return false; + } else { + float f = EnchantmentHelper.getTridentSpinAttackStrength(itemStack, player); + if (f > 0.0F && !player.isInWaterOrRain()) { + return false; + } else if (itemStack.nextDamageWillBreak()) { + return false; + } else { + Holder holder = (Holder)EnchantmentHelper.pickHighestLevel(itemStack, EnchantmentEffectComponents.TRIDENT_SOUND) + .orElse(SoundEvents.TRIDENT_THROW); + if (level instanceof ServerLevel serverLevel) { + itemStack.hurtWithoutBreaking(1, player); + if (f == 0.0F) { + ThrownTrident thrownTrident = Projectile.spawnProjectileFromRotation(ThrownTrident::new, serverLevel, itemStack, player, 0.0F, 2.5F, 1.0F); + if (player.hasInfiniteMaterials()) { + thrownTrident.pickup = AbstractArrow.Pickup.CREATIVE_ONLY; + } else { + player.getInventory().removeItem(itemStack); } - level.playSound(null, player, holder.value(), SoundSource.PLAYERS, 1.0F, 1.0F); + level.playSound(null, thrownTrident, holder.value(), SoundSource.PLAYERS, 1.0F, 1.0F); + return true; } } + + player.awardStat(Stats.ITEM_USED.get(this)); + if (f > 0.0F) { + float g = player.getYRot(); + float h = player.getXRot(); + float k = -Mth.sin(g * (float) (Math.PI / 180.0)) * Mth.cos(h * (float) (Math.PI / 180.0)); + float l = -Mth.sin(h * (float) (Math.PI / 180.0)); + float m = Mth.cos(g * (float) (Math.PI / 180.0)) * Mth.cos(h * (float) (Math.PI / 180.0)); + float n = Mth.sqrt(k * k + l * l + m * m); + k *= f / n; + l *= f / n; + m *= f / n; + player.push(k, l, m); + player.startAutoSpinAttack(20, 8.0F, itemStack); + if (player.onGround()) { + float o = 1.1999999F; + player.move(MoverType.SELF, new Vec3(0.0, 1.1999999F, 0.0)); + } + + level.playSound(null, player, holder.value(), SoundSource.PLAYERS, 1.0F, 1.0F); + return true; + } else { + return false; + } } } + } else { + return false; } } @Override - public InteractionResultHolder use(Level level, Player player, InteractionHand usedHand) { - ItemStack itemStack = player.getItemInHand(usedHand); - if (isTooDamagedToUse(itemStack)) { - return InteractionResultHolder.fail(itemStack); + public InteractionResult use(Level level, Player player, InteractionHand interactionHand) { + ItemStack itemStack = player.getItemInHand(interactionHand); + if (itemStack.nextDamageWillBreak()) { + return InteractionResult.FAIL; } else if (EnchantmentHelper.getTridentSpinAttackStrength(itemStack, player) > 0.0F && !player.isInWaterOrRain()) { - return InteractionResultHolder.fail(itemStack); + return InteractionResult.FAIL; } else { - player.startUsingItem(usedHand); - return InteractionResultHolder.consume(itemStack); + player.startUsingItem(interactionHand); + return InteractionResult.CONSUME; } } - private static boolean isTooDamagedToUse(ItemStack stack) { - return stack.getDamageValue() >= stack.getMaxDamage() - 1; - } - @Override public boolean hurtEnemy(ItemStack stack, LivingEntity target, LivingEntity attacker) { return true; @@ -145,11 +149,6 @@ public class TridentItem extends Item implements ProjectileItem { stack.hurtAndBreak(1, attacker, EquipmentSlot.MAINHAND); } - @Override - public int getEnchantmentValue() { - return 1; - } - @Override public Projectile asProjectile(Level level, Position pos, ItemStack stack, Direction direction) { ThrownTrident thrownTrident = new ThrownTrident(level, pos.x(), pos.y(), pos.z(), stack.copyWithCount(1)); diff --git a/net/minecraft/world/item/UseAnim.java b/net/minecraft/world/item/UseAnim.java deleted file mode 100644 index e2031d58..00000000 --- a/net/minecraft/world/item/UseAnim.java +++ /dev/null @@ -1,14 +0,0 @@ -package net.minecraft.world.item; - -public enum UseAnim { - NONE, - EAT, - DRINK, - BLOCK, - BOW, - SPEAR, - CROSSBOW, - SPYGLASS, - TOOT_HORN, - BRUSH; -} diff --git a/net/minecraft/world/item/WindChargeItem.java b/net/minecraft/world/item/WindChargeItem.java index 18e977a6..ce5e3f74 100644 --- a/net/minecraft/world/item/WindChargeItem.java +++ b/net/minecraft/world/item/WindChargeItem.java @@ -2,32 +2,39 @@ package net.minecraft.world.item; import net.minecraft.core.Direction; import net.minecraft.core.Position; +import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; import net.minecraft.stats.Stats; import net.minecraft.util.RandomSource; import net.minecraft.world.InteractionHand; -import net.minecraft.world.InteractionResultHolder; +import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.projectile.Projectile; import net.minecraft.world.entity.projectile.windcharge.WindCharge; +import net.minecraft.world.item.ProjectileItem.DispenseConfig; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.DispenserBlock; import net.minecraft.world.phys.Vec3; public class WindChargeItem extends Item implements ProjectileItem { - private static final int COOLDOWN = 10; - public WindChargeItem(Item.Properties properties) { super(properties); } @Override - public InteractionResultHolder use(Level level, Player player, InteractionHand usedHand) { - if (!level.isClientSide()) { - WindCharge windCharge = new WindCharge(player, level, player.position().x(), player.getEyePosition().y(), player.position().z()); - windCharge.shootFromRotation(player, player.getXRot(), player.getYRot(), 0.0F, 1.5F, 1.0F); - level.addFreshEntity(windCharge); + public InteractionResult use(Level level, Player player, InteractionHand interactionHand) { + ItemStack itemStack = player.getItemInHand(interactionHand); + if (level instanceof ServerLevel serverLevel) { + Projectile.spawnProjectileFromRotation( + (serverLevelx, livingEntity, itemStackx) -> new WindCharge(player, level, player.position().x(), player.getEyePosition().y(), player.position().z()), + serverLevel, + itemStack, + player, + 0.0F, + 1.5F, + 1.0F + ); } level.playSound( @@ -40,19 +47,17 @@ public class WindChargeItem extends Item implements ProjectileItem { 0.5F, 0.4F / (level.getRandom().nextFloat() * 0.4F + 0.8F) ); - ItemStack itemStack = player.getItemInHand(usedHand); - player.getCooldowns().addCooldown(this, 10); player.awardStat(Stats.ITEM_USED.get(this)); itemStack.consume(1, player); - return InteractionResultHolder.sidedSuccess(itemStack, level.isClientSide()); + return InteractionResult.SUCCESS; } @Override public Projectile asProjectile(Level level, Position pos, ItemStack stack, Direction direction) { RandomSource randomSource = level.getRandom(); - double d = randomSource.triangle(direction.getStepX(), 0.11485000000000001); - double e = randomSource.triangle(direction.getStepY(), 0.11485000000000001); - double f = randomSource.triangle(direction.getStepZ(), 0.11485000000000001); + double d = randomSource.triangle((double)direction.getStepX(), 0.11485000000000001); + double e = randomSource.triangle((double)direction.getStepY(), 0.11485000000000001); + double f = randomSource.triangle((double)direction.getStepZ(), 0.11485000000000001); Vec3 vec3 = new Vec3(d, e, f); WindCharge windCharge = new WindCharge(level, pos.x(), pos.y(), pos.z(), vec3); windCharge.setDeltaMovement(vec3); @@ -64,8 +69,8 @@ public class WindChargeItem extends Item implements ProjectileItem { } @Override - public ProjectileItem.DispenseConfig createDispenseConfig() { - return ProjectileItem.DispenseConfig.builder() + public DispenseConfig createDispenseConfig() { + return DispenseConfig.builder() .positionFunction((blockSource, direction) -> DispenserBlock.getDispensePosition(blockSource, 1.0, Vec3.ZERO)) .uncertainty(6.6666665F) .power(1.0F) diff --git a/net/minecraft/world/item/WritableBookItem.java b/net/minecraft/world/item/WritableBookItem.java index bd6bf186..975a8b9f 100644 --- a/net/minecraft/world/item/WritableBookItem.java +++ b/net/minecraft/world/item/WritableBookItem.java @@ -2,7 +2,7 @@ package net.minecraft.world.item; import net.minecraft.stats.Stats; import net.minecraft.world.InteractionHand; -import net.minecraft.world.InteractionResultHolder; +import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.player.Player; import net.minecraft.world.level.Level; @@ -12,10 +12,10 @@ public class WritableBookItem extends Item { } @Override - public InteractionResultHolder use(Level level, Player player, InteractionHand usedHand) { - ItemStack itemStack = player.getItemInHand(usedHand); - player.openItemGui(itemStack, usedHand); + public InteractionResult use(Level level, Player player, InteractionHand interactionHand) { + ItemStack itemStack = player.getItemInHand(interactionHand); + player.openItemGui(itemStack, interactionHand); player.awardStat(Stats.ITEM_USED.get(this)); - return InteractionResultHolder.sidedSuccess(itemStack, level.isClientSide()); + return InteractionResult.SUCCESS; } } diff --git a/net/minecraft/world/item/WrittenBookItem.java b/net/minecraft/world/item/WrittenBookItem.java index 2e2e997d..7aedc9a4 100644 --- a/net/minecraft/world/item/WrittenBookItem.java +++ b/net/minecraft/world/item/WrittenBookItem.java @@ -8,7 +8,7 @@ import net.minecraft.network.chat.Component; import net.minecraft.stats.Stats; import net.minecraft.util.StringUtil; import net.minecraft.world.InteractionHand; -import net.minecraft.world.InteractionResultHolder; +import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.component.WrittenBookContent; import net.minecraft.world.level.Level; @@ -19,19 +19,6 @@ public class WrittenBookItem extends Item { super(properties); } - @Override - public Component getName(ItemStack stack) { - WrittenBookContent writtenBookContent = stack.get(DataComponents.WRITTEN_BOOK_CONTENT); - if (writtenBookContent != null) { - String string = writtenBookContent.title().raw(); - if (!StringUtil.isBlank(string)) { - return Component.literal(string); - } - } - - return super.getName(stack); - } - @Override public void appendHoverText(ItemStack stack, Item.TooltipContext context, List tooltipComponents, TooltipFlag tooltipFlag) { WrittenBookContent writtenBookContent = stack.get(DataComponents.WRITTEN_BOOK_CONTENT); @@ -45,11 +32,11 @@ public class WrittenBookItem extends Item { } @Override - public InteractionResultHolder use(Level level, Player player, InteractionHand usedHand) { - ItemStack itemStack = player.getItemInHand(usedHand); - player.openItemGui(itemStack, usedHand); + public InteractionResult use(Level level, Player player, InteractionHand interactionHand) { + ItemStack itemStack = player.getItemInHand(interactionHand); + player.openItemGui(itemStack, interactionHand); player.awardStat(Stats.ITEM_USED.get(this)); - return InteractionResultHolder.sidedSuccess(itemStack, level.isClientSide()); + return InteractionResult.SUCCESS; } public static boolean resolveBookComponents(ItemStack bookStack, CommandSourceStack resolvingSource, @Nullable Player resolvingPlayer) { diff --git a/net/minecraft/world/item/alchemy/Potion.java b/net/minecraft/world/item/alchemy/Potion.java index 6bffe448..e2ce5770 100644 --- a/net/minecraft/world/item/alchemy/Potion.java +++ b/net/minecraft/world/item/alchemy/Potion.java @@ -2,7 +2,6 @@ package net.minecraft.world.item.alchemy; import com.mojang.serialization.Codec; import java.util.List; -import java.util.Optional; import net.minecraft.core.Holder; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.core.registries.Registries; @@ -14,7 +13,6 @@ import net.minecraft.world.flag.FeatureElement; import net.minecraft.world.flag.FeatureFlag; import net.minecraft.world.flag.FeatureFlagSet; import net.minecraft.world.flag.FeatureFlags; -import org.jetbrains.annotations.Nullable; /** * Defines a type of potion in the game. These are used to associate one or more effects with items such as the bottled potion or the tipped arrows. @@ -25,16 +23,11 @@ public class Potion implements FeatureElement { /** * The base name for the potion type. */ - @Nullable private final String name; private final List effects; private FeatureFlagSet requiredFeatures = FeatureFlags.VANILLA_SET; - public Potion(MobEffectInstance... effects) { - this(null, effects); - } - - public Potion(@Nullable String name, MobEffectInstance... effects) { + public Potion(String name, MobEffectInstance... effects) { this.name = name; this.effects = List.of(effects); } @@ -49,18 +42,6 @@ public class Potion implements FeatureElement { return this.requiredFeatures; } - public static String getName(Optional> potion, String descriptionId) { - if (potion.isPresent()) { - String string = ((Potion)((Holder)potion.get()).value()).name; - if (string != null) { - return descriptionId + string; - } - } - - String string = (String)potion.flatMap(Holder::unwrapKey).map(resourceKey -> resourceKey.location().getPath()).orElse("empty"); - return descriptionId + string; - } - /** * Gets the base effects applied by the potion. * @return The effects applied by the potion. @@ -69,16 +50,18 @@ public class Potion implements FeatureElement { return this.effects; } + public String name() { + return this.name; + } + /** * Checks if the potion contains any instant effects such as instant health or instant damage. * @return Whether the potion contained an instant effect. */ public boolean hasInstantEffects() { - if (!this.effects.isEmpty()) { - for (MobEffectInstance mobEffectInstance : this.effects) { - if (mobEffectInstance.getEffect().value().isInstantenous()) { - return true; - } + for (MobEffectInstance mobEffectInstance : this.effects) { + if (mobEffectInstance.getEffect().value().isInstantenous()) { + return true; } } diff --git a/net/minecraft/world/item/alchemy/PotionContents.java b/net/minecraft/world/item/alchemy/PotionContents.java index 8f16a24d..81e336cd 100644 --- a/net/minecraft/world/item/alchemy/PotionContents.java +++ b/net/minecraft/world/item/alchemy/PotionContents.java @@ -19,25 +19,33 @@ import net.minecraft.network.chat.Component; import net.minecraft.network.chat.MutableComponent; import net.minecraft.network.codec.ByteBufCodecs; import net.minecraft.network.codec.StreamCodec; -import net.minecraft.util.FastColor; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.util.ARGB; import net.minecraft.world.effect.MobEffect; import net.minecraft.world.effect.MobEffectInstance; import net.minecraft.world.effect.MobEffectUtil; +import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.ai.attributes.Attribute; import net.minecraft.world.entity.ai.attributes.AttributeModifier; +import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.component.Consumable; +import net.minecraft.world.item.component.ConsumableListener; import net.minecraft.world.item.component.ItemAttributeModifiers; +import net.minecraft.world.level.Level; -public record PotionContents(Optional> potion, Optional customColor, List customEffects) { - public static final PotionContents EMPTY = new PotionContents(Optional.empty(), Optional.empty(), List.of()); +public record PotionContents(Optional> potion, Optional customColor, List customEffects, Optional customName) + implements ConsumableListener { + public static final PotionContents EMPTY = new PotionContents(Optional.empty(), Optional.empty(), List.of(), Optional.empty()); private static final Component NO_EFFECT = Component.translatable("effect.none").withStyle(ChatFormatting.GRAY); private static final int BASE_POTION_COLOR = -13083194; private static final Codec FULL_CODEC = RecordCodecBuilder.create( instance -> instance.group( Potion.CODEC.optionalFieldOf("potion").forGetter(PotionContents::potion), Codec.INT.optionalFieldOf("custom_color").forGetter(PotionContents::customColor), - MobEffectInstance.CODEC.listOf().optionalFieldOf("custom_effects", List.of()).forGetter(PotionContents::customEffects) + MobEffectInstance.CODEC.listOf().optionalFieldOf("custom_effects", List.of()).forGetter(PotionContents::customEffects), + Codec.STRING.optionalFieldOf("custom_name").forGetter(PotionContents::customName) ) .apply(instance, PotionContents::new) ); @@ -49,11 +57,13 @@ public record PotionContents(Optional> potion, Optional PotionContents::customColor, MobEffectInstance.STREAM_CODEC.apply(ByteBufCodecs.list()), PotionContents::customEffects, + ByteBufCodecs.STRING_UTF8.apply(ByteBufCodecs::optional), + PotionContents::customName, PotionContents::new ); public PotionContents(Holder potion) { - this(Optional.of(potion), Optional.empty(), List.of()); + this(Optional.of(potion), Optional.empty(), List.of(), Optional.empty()); } public static ItemStack createItemStack(Item item, Holder potion) { @@ -89,11 +99,11 @@ public record PotionContents(Optional> potion, Optional } public PotionContents withPotion(Holder potion) { - return new PotionContents(Optional.of(potion), this.customColor, this.customEffects); + return new PotionContents(Optional.of(potion), this.customColor, this.customEffects, this.customName); } public PotionContents withEffectAdded(MobEffectInstance effect) { - return new PotionContents(this.potion, this.customColor, Util.copyAndAdd(this.customEffects, effect)); + return new PotionContents(this.potion, this.customColor, Util.copyAndAdd(this.customEffects, effect), this.customName); } public int getColor() { @@ -108,6 +118,11 @@ public record PotionContents(Optional> potion, Optional return getColorOptional(effects).orElse(-13083194); } + public Component getName(String string) { + String string2 = (String)this.customName.or(() -> this.potion.map(holder -> ((Potion)holder.value()).name())).orElse("empty"); + return Component.translatable(string + string2); + } + public static OptionalInt getColorOptional(Iterable effects) { int i = 0; int j = 0; @@ -118,14 +133,14 @@ public record PotionContents(Optional> potion, Optional if (mobEffectInstance.isVisible()) { int m = mobEffectInstance.getEffect().value().getColor(); int n = mobEffectInstance.getAmplifier() + 1; - i += n * FastColor.ARGB32.red(m); - j += n * FastColor.ARGB32.green(m); - k += n * FastColor.ARGB32.blue(m); + i += n * ARGB.red(m); + j += n * ARGB.green(m); + k += n * ARGB.blue(m); l += n; } } - return l == 0 ? OptionalInt.empty() : OptionalInt.of(FastColor.ARGB32.color(i / l, j / l, k / l)); + return l == 0 ? OptionalInt.empty() : OptionalInt.of(ARGB.color(i / l, j / l, k / l)); } public boolean hasEffects() { @@ -140,6 +155,19 @@ public record PotionContents(Optional> potion, Optional addPotionTooltip(this.getAllEffects(), tooltipAdder, durationFactor, ticksPerSecond); } + public void applyToLivingEntity(LivingEntity livingEntity) { + if (livingEntity.level() instanceof ServerLevel serverLevel) { + Player player2 = livingEntity instanceof Player player ? player : null; + this.forEachEffect(mobEffectInstance -> { + if (mobEffectInstance.getEffect().value().isInstantenous()) { + mobEffectInstance.getEffect().value().applyInstantenousEffect(serverLevel, player2, player2, livingEntity, mobEffectInstance.getAmplifier(), 1.0); + } else { + livingEntity.addEffect(mobEffectInstance); + } + }); + } + } + public static void addPotionTooltip(Iterable effects, Consumer tooltipAdder, float durationFactor, float ticksPerSecond) { List, AttributeModifier>> list = Lists., AttributeModifier>>newArrayList(); boolean bl = true; @@ -206,4 +234,9 @@ public record PotionContents(Optional> potion, Optional } } } + + @Override + public void onConsume(Level level, LivingEntity livingEntity, ItemStack itemStack, Consumable consumable) { + this.applyToLivingEntity(livingEntity); + } } diff --git a/net/minecraft/world/item/alchemy/Potions.java b/net/minecraft/world/item/alchemy/Potions.java index a10213a9..3a527ae8 100644 --- a/net/minecraft/world/item/alchemy/Potions.java +++ b/net/minecraft/world/item/alchemy/Potions.java @@ -12,31 +12,33 @@ import net.minecraft.world.effect.MobEffects; * @see net.minecraft.core.Registry#POTION */ public class Potions { - public static final Holder WATER = register("water", new Potion()); - public static final Holder MUNDANE = register("mundane", new Potion()); - public static final Holder THICK = register("thick", new Potion()); - public static final Holder AWKWARD = register("awkward", new Potion()); - public static final Holder NIGHT_VISION = register("night_vision", new Potion(new MobEffectInstance(MobEffects.NIGHT_VISION, 3600))); + public static final Holder WATER = register("water", new Potion("water")); + public static final Holder MUNDANE = register("mundane", new Potion("mundane")); + public static final Holder THICK = register("thick", new Potion("thick")); + public static final Holder AWKWARD = register("awkward", new Potion("awkward")); + public static final Holder NIGHT_VISION = register("night_vision", new Potion("night_vision", new MobEffectInstance(MobEffects.NIGHT_VISION, 3600))); public static final Holder LONG_NIGHT_VISION = register( "long_night_vision", new Potion("night_vision", new MobEffectInstance(MobEffects.NIGHT_VISION, 9600)) ); - public static final Holder INVISIBILITY = register("invisibility", new Potion(new MobEffectInstance(MobEffects.INVISIBILITY, 3600))); + public static final Holder INVISIBILITY = register("invisibility", new Potion("invisibility", new MobEffectInstance(MobEffects.INVISIBILITY, 3600))); public static final Holder LONG_INVISIBILITY = register( "long_invisibility", new Potion("invisibility", new MobEffectInstance(MobEffects.INVISIBILITY, 9600)) ); - public static final Holder LEAPING = register("leaping", new Potion(new MobEffectInstance(MobEffects.JUMP, 3600))); + public static final Holder LEAPING = register("leaping", new Potion("leaping", new MobEffectInstance(MobEffects.JUMP, 3600))); public static final Holder LONG_LEAPING = register("long_leaping", new Potion("leaping", new MobEffectInstance(MobEffects.JUMP, 9600))); public static final Holder STRONG_LEAPING = register("strong_leaping", new Potion("leaping", new MobEffectInstance(MobEffects.JUMP, 1800, 1))); - public static final Holder FIRE_RESISTANCE = register("fire_resistance", new Potion(new MobEffectInstance(MobEffects.FIRE_RESISTANCE, 3600))); + public static final Holder FIRE_RESISTANCE = register( + "fire_resistance", new Potion("fire_resistance", new MobEffectInstance(MobEffects.FIRE_RESISTANCE, 3600)) + ); public static final Holder LONG_FIRE_RESISTANCE = register( "long_fire_resistance", new Potion("fire_resistance", new MobEffectInstance(MobEffects.FIRE_RESISTANCE, 9600)) ); - public static final Holder SWIFTNESS = register("swiftness", new Potion(new MobEffectInstance(MobEffects.MOVEMENT_SPEED, 3600))); + public static final Holder SWIFTNESS = register("swiftness", new Potion("swiftness", new MobEffectInstance(MobEffects.MOVEMENT_SPEED, 3600))); public static final Holder LONG_SWIFTNESS = register("long_swiftness", new Potion("swiftness", new MobEffectInstance(MobEffects.MOVEMENT_SPEED, 9600))); public static final Holder STRONG_SWIFTNESS = register( "strong_swiftness", new Potion("swiftness", new MobEffectInstance(MobEffects.MOVEMENT_SPEED, 1800, 1)) ); - public static final Holder SLOWNESS = register("slowness", new Potion(new MobEffectInstance(MobEffects.MOVEMENT_SLOWDOWN, 1800))); + public static final Holder SLOWNESS = register("slowness", new Potion("slowness", new MobEffectInstance(MobEffects.MOVEMENT_SLOWDOWN, 1800))); public static final Holder LONG_SLOWNESS = register("long_slowness", new Potion("slowness", new MobEffectInstance(MobEffects.MOVEMENT_SLOWDOWN, 4800))); public static final Holder STRONG_SLOWNESS = register( "strong_slowness", new Potion("slowness", new MobEffectInstance(MobEffects.MOVEMENT_SLOWDOWN, 400, 3)) @@ -53,33 +55,35 @@ public class Potions { "strong_turtle_master", new Potion("turtle_master", new MobEffectInstance(MobEffects.MOVEMENT_SLOWDOWN, 400, 5), new MobEffectInstance(MobEffects.DAMAGE_RESISTANCE, 400, 3)) ); - public static final Holder WATER_BREATHING = register("water_breathing", new Potion(new MobEffectInstance(MobEffects.WATER_BREATHING, 3600))); + public static final Holder WATER_BREATHING = register( + "water_breathing", new Potion("water_breathing", new MobEffectInstance(MobEffects.WATER_BREATHING, 3600)) + ); public static final Holder LONG_WATER_BREATHING = register( "long_water_breathing", new Potion("water_breathing", new MobEffectInstance(MobEffects.WATER_BREATHING, 9600)) ); - public static final Holder HEALING = register("healing", new Potion(new MobEffectInstance(MobEffects.HEAL, 1))); + public static final Holder HEALING = register("healing", new Potion("healing", new MobEffectInstance(MobEffects.HEAL, 1))); public static final Holder STRONG_HEALING = register("strong_healing", new Potion("healing", new MobEffectInstance(MobEffects.HEAL, 1, 1))); - public static final Holder HARMING = register("harming", new Potion(new MobEffectInstance(MobEffects.HARM, 1))); + public static final Holder HARMING = register("harming", new Potion("harming", new MobEffectInstance(MobEffects.HARM, 1))); public static final Holder STRONG_HARMING = register("strong_harming", new Potion("harming", new MobEffectInstance(MobEffects.HARM, 1, 1))); - public static final Holder POISON = register("poison", new Potion(new MobEffectInstance(MobEffects.POISON, 900))); + public static final Holder POISON = register("poison", new Potion("poison", new MobEffectInstance(MobEffects.POISON, 900))); public static final Holder LONG_POISON = register("long_poison", new Potion("poison", new MobEffectInstance(MobEffects.POISON, 1800))); public static final Holder STRONG_POISON = register("strong_poison", new Potion("poison", new MobEffectInstance(MobEffects.POISON, 432, 1))); - public static final Holder REGENERATION = register("regeneration", new Potion(new MobEffectInstance(MobEffects.REGENERATION, 900))); + public static final Holder REGENERATION = register("regeneration", new Potion("regeneration", new MobEffectInstance(MobEffects.REGENERATION, 900))); public static final Holder LONG_REGENERATION = register( "long_regeneration", new Potion("regeneration", new MobEffectInstance(MobEffects.REGENERATION, 1800)) ); public static final Holder STRONG_REGENERATION = register( "strong_regeneration", new Potion("regeneration", new MobEffectInstance(MobEffects.REGENERATION, 450, 1)) ); - public static final Holder STRENGTH = register("strength", new Potion(new MobEffectInstance(MobEffects.DAMAGE_BOOST, 3600))); + public static final Holder STRENGTH = register("strength", new Potion("strength", new MobEffectInstance(MobEffects.DAMAGE_BOOST, 3600))); public static final Holder LONG_STRENGTH = register("long_strength", new Potion("strength", new MobEffectInstance(MobEffects.DAMAGE_BOOST, 9600))); public static final Holder STRONG_STRENGTH = register( "strong_strength", new Potion("strength", new MobEffectInstance(MobEffects.DAMAGE_BOOST, 1800, 1)) ); - public static final Holder WEAKNESS = register("weakness", new Potion(new MobEffectInstance(MobEffects.WEAKNESS, 1800))); + public static final Holder WEAKNESS = register("weakness", new Potion("weakness", new MobEffectInstance(MobEffects.WEAKNESS, 1800))); public static final Holder LONG_WEAKNESS = register("long_weakness", new Potion("weakness", new MobEffectInstance(MobEffects.WEAKNESS, 4800))); public static final Holder LUCK = register("luck", new Potion("luck", new MobEffectInstance(MobEffects.LUCK, 6000))); - public static final Holder SLOW_FALLING = register("slow_falling", new Potion(new MobEffectInstance(MobEffects.SLOW_FALLING, 1800))); + public static final Holder SLOW_FALLING = register("slow_falling", new Potion("slow_falling", new MobEffectInstance(MobEffects.SLOW_FALLING, 1800))); public static final Holder LONG_SLOW_FALLING = register( "long_slow_falling", new Potion("slow_falling", new MobEffectInstance(MobEffects.SLOW_FALLING, 4800)) ); diff --git a/net/minecraft/world/item/armortrim/ArmorTrim.java b/net/minecraft/world/item/armortrim/ArmorTrim.java deleted file mode 100644 index 98ba35db..00000000 --- a/net/minecraft/world/item/armortrim/ArmorTrim.java +++ /dev/null @@ -1,135 +0,0 @@ -package net.minecraft.world.item.armortrim; - -import com.mojang.serialization.Codec; -import com.mojang.serialization.codecs.RecordCodecBuilder; -import java.util.Map; -import java.util.function.Consumer; -import java.util.function.Function; -import java.util.function.UnaryOperator; -import net.minecraft.ChatFormatting; -import net.minecraft.Util; -import net.minecraft.core.Holder; -import net.minecraft.network.RegistryFriendlyByteBuf; -import net.minecraft.network.chat.CommonComponents; -import net.minecraft.network.chat.Component; -import net.minecraft.network.codec.ByteBufCodecs; -import net.minecraft.network.codec.StreamCodec; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.item.ArmorMaterial; -import net.minecraft.world.item.Item; -import net.minecraft.world.item.TooltipFlag; -import net.minecraft.world.item.component.TooltipProvider; - -public class ArmorTrim implements TooltipProvider { - public static final Codec CODEC = RecordCodecBuilder.create( - instance -> instance.group( - TrimMaterial.CODEC.fieldOf("material").forGetter(ArmorTrim::material), - TrimPattern.CODEC.fieldOf("pattern").forGetter(ArmorTrim::pattern), - Codec.BOOL.optionalFieldOf("show_in_tooltip", true).forGetter(armorTrim -> armorTrim.showInTooltip) - ) - .apply(instance, ArmorTrim::new) - ); - public static final StreamCodec STREAM_CODEC = StreamCodec.composite( - TrimMaterial.STREAM_CODEC, - ArmorTrim::material, - TrimPattern.STREAM_CODEC, - ArmorTrim::pattern, - ByteBufCodecs.BOOL, - armorTrim -> armorTrim.showInTooltip, - ArmorTrim::new - ); - private static final Component UPGRADE_TITLE = Component.translatable( - Util.makeDescriptionId("item", ResourceLocation.withDefaultNamespace("smithing_template.upgrade")) - ) - .withStyle(ChatFormatting.GRAY); - private final Holder material; - private final Holder pattern; - private final boolean showInTooltip; - private final Function, ResourceLocation> innerTexture; - private final Function, ResourceLocation> outerTexture; - - private ArmorTrim( - Holder material, - Holder pattern, - boolean showInTooltip, - Function, ResourceLocation> innerTexture, - Function, ResourceLocation> outerTexture - ) { - this.material = material; - this.pattern = pattern; - this.showInTooltip = showInTooltip; - this.innerTexture = innerTexture; - this.outerTexture = outerTexture; - } - - public ArmorTrim(Holder material, Holder pattern, boolean showInTooltip) { - this.material = material; - this.pattern = pattern; - this.innerTexture = Util.memoize((Function, ResourceLocation>)(holder3 -> { - ResourceLocation resourceLocation = pattern.value().assetId(); - String string = getColorPaletteSuffix(material, holder3); - return resourceLocation.withPath((UnaryOperator)(string2 -> "trims/models/armor/" + string2 + "_leggings_" + string)); - })); - this.outerTexture = Util.memoize((Function, ResourceLocation>)(holder3 -> { - ResourceLocation resourceLocation = pattern.value().assetId(); - String string = getColorPaletteSuffix(material, holder3); - return resourceLocation.withPath((UnaryOperator)(string2 -> "trims/models/armor/" + string2 + "_" + string)); - })); - this.showInTooltip = showInTooltip; - } - - public ArmorTrim(Holder material, Holder pattern) { - this(material, pattern, true); - } - - private static String getColorPaletteSuffix(Holder trimMaterial, Holder armorMaterial) { - Map, String> map = trimMaterial.value().overrideArmorMaterials(); - String string = (String)map.get(armorMaterial); - return string != null ? string : trimMaterial.value().assetName(); - } - - public boolean hasPatternAndMaterial(Holder pattern, Holder material) { - return pattern.equals(this.pattern) && material.equals(this.material); - } - - public Holder pattern() { - return this.pattern; - } - - public Holder material() { - return this.material; - } - - public ResourceLocation innerTexture(Holder armorMaterial) { - return (ResourceLocation)this.innerTexture.apply(armorMaterial); - } - - public ResourceLocation outerTexture(Holder armorMaterial) { - return (ResourceLocation)this.outerTexture.apply(armorMaterial); - } - - public boolean equals(Object object) { - return !(object instanceof ArmorTrim armorTrim) - ? false - : this.showInTooltip == armorTrim.showInTooltip && this.pattern.equals(armorTrim.pattern) && this.material.equals(armorTrim.material); - } - - public int hashCode() { - int i = this.material.hashCode(); - i = 31 * i + this.pattern.hashCode(); - return 31 * i + (this.showInTooltip ? 1 : 0); - } - - @Override - public void addToTooltip(Item.TooltipContext context, Consumer tooltipAdder, TooltipFlag tooltipFlag) { - if (this.showInTooltip) { - tooltipAdder.accept(UPGRADE_TITLE); - tooltipAdder.accept(CommonComponents.space().append(this.pattern.value().copyWithStyle(this.material))); - tooltipAdder.accept(CommonComponents.space().append(this.material.value().description())); - } - } - - public ArmorTrim withTooltip(boolean showInTooltip) { - return new ArmorTrim(this.material, this.pattern, showInTooltip, this.innerTexture, this.outerTexture); - } -} diff --git a/net/minecraft/world/item/armortrim/TrimMaterials.java b/net/minecraft/world/item/armortrim/TrimMaterials.java deleted file mode 100644 index bab63f71..00000000 --- a/net/minecraft/world/item/armortrim/TrimMaterials.java +++ /dev/null @@ -1,77 +0,0 @@ -package net.minecraft.world.item.armortrim; - -import java.util.Map; -import java.util.Optional; -import net.minecraft.Util; -import net.minecraft.core.Holder; -import net.minecraft.core.HolderLookup; -import net.minecraft.core.registries.Registries; -import net.minecraft.data.worldgen.BootstrapContext; -import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.Style; -import net.minecraft.resources.ResourceKey; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.item.ArmorMaterial; -import net.minecraft.world.item.ArmorMaterials; -import net.minecraft.world.item.Item; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.Items; - -public class TrimMaterials { - public static final ResourceKey QUARTZ = registryKey("quartz"); - public static final ResourceKey IRON = registryKey("iron"); - public static final ResourceKey NETHERITE = registryKey("netherite"); - public static final ResourceKey REDSTONE = registryKey("redstone"); - public static final ResourceKey COPPER = registryKey("copper"); - public static final ResourceKey GOLD = registryKey("gold"); - public static final ResourceKey EMERALD = registryKey("emerald"); - public static final ResourceKey DIAMOND = registryKey("diamond"); - public static final ResourceKey LAPIS = registryKey("lapis"); - public static final ResourceKey AMETHYST = registryKey("amethyst"); - - public static void bootstrap(BootstrapContext context) { - register(context, QUARTZ, Items.QUARTZ, Style.EMPTY.withColor(14931140), 0.1F); - register(context, IRON, Items.IRON_INGOT, Style.EMPTY.withColor(15527148), 0.2F, Map.of(ArmorMaterials.IRON, "iron_darker")); - register(context, NETHERITE, Items.NETHERITE_INGOT, Style.EMPTY.withColor(6445145), 0.3F, Map.of(ArmorMaterials.NETHERITE, "netherite_darker")); - register(context, REDSTONE, Items.REDSTONE, Style.EMPTY.withColor(9901575), 0.4F); - register(context, COPPER, Items.COPPER_INGOT, Style.EMPTY.withColor(11823181), 0.5F); - register(context, GOLD, Items.GOLD_INGOT, Style.EMPTY.withColor(14594349), 0.6F, Map.of(ArmorMaterials.GOLD, "gold_darker")); - register(context, EMERALD, Items.EMERALD, Style.EMPTY.withColor(1155126), 0.7F); - register(context, DIAMOND, Items.DIAMOND, Style.EMPTY.withColor(7269586), 0.8F, Map.of(ArmorMaterials.DIAMOND, "diamond_darker")); - register(context, LAPIS, Items.LAPIS_LAZULI, Style.EMPTY.withColor(4288151), 0.9F); - register(context, AMETHYST, Items.AMETHYST_SHARD, Style.EMPTY.withColor(10116294), 1.0F); - } - - public static Optional> getFromIngredient(HolderLookup.Provider regustries, ItemStack ingredient) { - return regustries.lookupOrThrow(Registries.TRIM_MATERIAL) - .listElements() - .filter(reference -> ingredient.is(((TrimMaterial)reference.value()).ingredient())) - .findFirst(); - } - - private static void register(BootstrapContext context, ResourceKey materialKey, Item ingredient, Style style, float itemModelIndex) { - register(context, materialKey, ingredient, style, itemModelIndex, Map.of()); - } - - private static void register( - BootstrapContext context, - ResourceKey materialKey, - Item ingredient, - Style style, - float itemModelIndex, - Map, String> overrideArmorMaterials - ) { - TrimMaterial trimMaterial = TrimMaterial.create( - materialKey.location().getPath(), - ingredient, - itemModelIndex, - Component.translatable(Util.makeDescriptionId("trim_material", materialKey.location())).withStyle(style), - overrideArmorMaterials - ); - context.register(materialKey, trimMaterial); - } - - private static ResourceKey registryKey(String key) { - return ResourceKey.create(Registries.TRIM_MATERIAL, ResourceLocation.withDefaultNamespace(key)); - } -} diff --git a/net/minecraft/world/item/component/BundleContents.java b/net/minecraft/world/item/component/BundleContents.java index 42ca781a..5605a704 100644 --- a/net/minecraft/world/item/component/BundleContents.java +++ b/net/minecraft/world/item/component/BundleContents.java @@ -2,6 +2,7 @@ package net.minecraft.world.item.component; import com.google.common.collect.Lists; import com.mojang.serialization.Codec; +import com.mojang.serialization.DataResult; import java.util.ArrayList; import java.util.List; import java.util.stream.Stream; @@ -19,22 +20,36 @@ import org.jetbrains.annotations.Nullable; public final class BundleContents implements TooltipComponent { public static final BundleContents EMPTY = new BundleContents(List.of()); - public static final Codec CODEC = ItemStack.CODEC.listOf().xmap(BundleContents::new, bundleContents -> bundleContents.items); + public static final Codec CODEC = ItemStack.CODEC + .listOf() + .flatXmap(BundleContents::checkAndCreate, bundleContents -> DataResult.success(bundleContents.items)); public static final StreamCodec STREAM_CODEC = ItemStack.STREAM_CODEC .apply(ByteBufCodecs.list()) .map(BundleContents::new, bundleContents -> bundleContents.items); private static final Fraction BUNDLE_IN_BUNDLE_WEIGHT = Fraction.getFraction(1, 16); private static final int NO_STACK_INDEX = -1; + public static final int NO_SELECTED_ITEM_INDEX = -1; final List items; final Fraction weight; + final int selectedItem; - BundleContents(List items, Fraction weight) { - this.items = items; - this.weight = weight; + BundleContents(List list, Fraction fraction, int i) { + this.items = list; + this.weight = fraction; + this.selectedItem = i; + } + + private static DataResult checkAndCreate(List list) { + try { + Fraction fraction = computeContentWeight(list); + return DataResult.success(new BundleContents(list, fraction, -1)); + } catch (ArithmeticException var2) { + return DataResult.error(() -> "Excessive total bundle weight"); + } } public BundleContents(List items) { - this(items, computeContentWeight(items)); + this(items, computeContentWeight(items), -1); } private static Fraction computeContentWeight(List content) { @@ -57,6 +72,18 @@ public final class BundleContents implements TooltipComponent { } } + public static boolean canItemBeInBundle(ItemStack itemStack) { + return !itemStack.isEmpty() && itemStack.getItem().canFitInsideContainerItems(); + } + + public int getNumberOfItemsToShow() { + int i = this.size(); + int j = i > 12 ? 11 : 12; + int k = i % 4; + int l = k == 0 ? 0 : 4 - k; + return Math.min(i, j - l); + } + public ItemStack getItemUnsafe(int index) { return (ItemStack)this.items.get(index); } @@ -85,6 +112,14 @@ public final class BundleContents implements TooltipComponent { return this.items.isEmpty(); } + public int getSelectedItem() { + return this.selectedItem; + } + + public boolean hasSelectedItem() { + return this.selectedItem != -1; + } + public boolean equals(Object object) { if (this == object) { return true; @@ -106,15 +141,18 @@ public final class BundleContents implements TooltipComponent { public static class Mutable { private final List items; private Fraction weight; + private int selectedItem; public Mutable(BundleContents contents) { this.items = new ArrayList(contents.items); this.weight = contents.weight; + this.selectedItem = contents.selectedItem; } public BundleContents.Mutable clearItems() { this.items.clear(); this.weight = Fraction.ZERO; + this.selectedItem = -1; return this; } @@ -138,7 +176,9 @@ public final class BundleContents implements TooltipComponent { } public int tryInsert(ItemStack stack) { - if (!stack.isEmpty() && stack.getItem().canFitInsideContainerItems()) { + if (!BundleContents.canItemBeInBundle(stack)) { + return 0; + } else { int i = Math.min(stack.getCount(), this.getMaxAmountToAdd(stack)); if (i == 0) { return 0; @@ -156,15 +196,17 @@ public final class BundleContents implements TooltipComponent { return i; } - } else { - return 0; } } public int tryTransfer(Slot slot, Player player) { ItemStack itemStack = slot.getItem(); int i = this.getMaxAmountToAdd(itemStack); - return this.tryInsert(slot.safeTake(itemStack.getCount(), i, player)); + return BundleContents.canItemBeInBundle(itemStack) ? this.tryInsert(slot.safeTake(itemStack.getCount(), i, player)) : 0; + } + + public void toggleSelectedItem(int i) { + this.selectedItem = this.selectedItem != i && i < this.items.size() ? i : -1; } @Nullable @@ -172,8 +214,10 @@ public final class BundleContents implements TooltipComponent { if (this.items.isEmpty()) { return null; } else { - ItemStack itemStack = ((ItemStack)this.items.remove(0)).copy(); + int i = this.selectedItem != -1 && this.selectedItem < this.items.size() ? this.selectedItem : 0; + ItemStack itemStack = ((ItemStack)this.items.remove(i)).copy(); this.weight = this.weight.subtract(BundleContents.getWeight(itemStack).multiplyBy(Fraction.getFraction(itemStack.getCount(), 1))); + this.toggleSelectedItem(-1); return itemStack; } } @@ -183,7 +227,7 @@ public final class BundleContents implements TooltipComponent { } public BundleContents toImmutable() { - return new BundleContents(List.copyOf(this.items), this.weight); + return new BundleContents(List.copyOf(this.items), this.weight, this.selectedItem); } } } diff --git a/net/minecraft/world/item/component/Consumable.java b/net/minecraft/world/item/component/Consumable.java new file mode 100644 index 00000000..b17e9607 --- /dev/null +++ b/net/minecraft/world/item/component/Consumable.java @@ -0,0 +1,179 @@ +package net.minecraft.world.item.component; + +import com.mojang.serialization.Codec; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import java.util.ArrayList; +import java.util.List; +import net.minecraft.advancements.CriteriaTriggers; +import net.minecraft.core.Holder; +import net.minecraft.core.component.DataComponents; +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.sounds.SoundEvent; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.stats.Stats; +import net.minecraft.util.ExtraCodecs; +import net.minecraft.util.Mth; +import net.minecraft.util.RandomSource; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.food.FoodProperties; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.ItemUseAnimation; +import net.minecraft.world.item.consume_effects.ConsumeEffect; +import net.minecraft.world.item.consume_effects.PlaySoundConsumeEffect; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.gameevent.GameEvent; + +public record Consumable( + float consumeSeconds, ItemUseAnimation animation, Holder sound, boolean hasConsumeParticles, List onConsumeEffects +) { + public static final float DEFAULT_CONSUME_SECONDS = 1.6F; + private static final int CONSUME_EFFECTS_INTERVAL = 4; + private static final float CONSUME_EFFECTS_START_FRACTION = 0.21875F; + public static final Codec CODEC = RecordCodecBuilder.create( + instance -> instance.group( + ExtraCodecs.NON_NEGATIVE_FLOAT.optionalFieldOf("consume_seconds", 1.6F).forGetter(Consumable::consumeSeconds), + ItemUseAnimation.CODEC.optionalFieldOf("animation", ItemUseAnimation.EAT).forGetter(Consumable::animation), + SoundEvent.CODEC.optionalFieldOf("sound", SoundEvents.GENERIC_EAT).forGetter(Consumable::sound), + Codec.BOOL.optionalFieldOf("has_consume_particles", true).forGetter(Consumable::hasConsumeParticles), + ConsumeEffect.CODEC.listOf().optionalFieldOf("on_consume_effects", List.of()).forGetter(Consumable::onConsumeEffects) + ) + .apply(instance, Consumable::new) + ); + public static final StreamCodec STREAM_CODEC = StreamCodec.composite( + ByteBufCodecs.FLOAT, + Consumable::consumeSeconds, + ItemUseAnimation.STREAM_CODEC, + Consumable::animation, + SoundEvent.STREAM_CODEC, + Consumable::sound, + ByteBufCodecs.BOOL, + Consumable::hasConsumeParticles, + ConsumeEffect.STREAM_CODEC.apply(ByteBufCodecs.list()), + Consumable::onConsumeEffects, + Consumable::new + ); + + public InteractionResult startConsuming(LivingEntity livingEntity, ItemStack itemStack, InteractionHand interactionHand) { + if (!this.canConsume(livingEntity, itemStack)) { + return InteractionResult.FAIL; + } else { + boolean bl = this.consumeTicks() > 0; + if (bl) { + livingEntity.startUsingItem(interactionHand); + return InteractionResult.CONSUME; + } else { + ItemStack itemStack2 = this.onConsume(livingEntity.level(), livingEntity, itemStack); + return InteractionResult.CONSUME.heldItemTransformedTo(itemStack2); + } + } + } + + public ItemStack onConsume(Level level, LivingEntity livingEntity, ItemStack itemStack) { + RandomSource randomSource = livingEntity.getRandom(); + this.emitParticlesAndSounds(randomSource, livingEntity, itemStack, 16); + if (livingEntity instanceof ServerPlayer serverPlayer) { + serverPlayer.awardStat(Stats.ITEM_USED.get(itemStack.getItem())); + CriteriaTriggers.CONSUME_ITEM.trigger(serverPlayer, itemStack); + } + + itemStack.getAllOfType(ConsumableListener.class).forEach(consumableListener -> consumableListener.onConsume(level, livingEntity, itemStack, this)); + if (!level.isClientSide) { + this.onConsumeEffects.forEach(consumeEffect -> consumeEffect.apply(level, itemStack, livingEntity)); + } + + livingEntity.gameEvent(this.animation == ItemUseAnimation.DRINK ? GameEvent.DRINK : GameEvent.EAT); + itemStack.consume(1, livingEntity); + return itemStack; + } + + public boolean canConsume(LivingEntity livingEntity, ItemStack itemStack) { + FoodProperties foodProperties = itemStack.get(DataComponents.FOOD); + return foodProperties != null && livingEntity instanceof Player player ? player.canEat(foodProperties.canAlwaysEat()) : true; + } + + public int consumeTicks() { + return (int)(this.consumeSeconds * 20.0F); + } + + public void emitParticlesAndSounds(RandomSource randomSource, LivingEntity livingEntity, ItemStack itemStack, int i) { + float f = randomSource.nextBoolean() ? 0.5F : 1.0F; + float g = randomSource.triangle(1.0F, 0.2F); + float h = 0.5F; + float j = Mth.randomBetween(randomSource, 0.9F, 1.0F); + float k = this.animation == ItemUseAnimation.DRINK ? 0.5F : f; + float l = this.animation == ItemUseAnimation.DRINK ? j : g; + if (this.hasConsumeParticles) { + livingEntity.spawnItemParticles(itemStack, i); + } + + SoundEvent soundEvent = livingEntity instanceof Consumable.OverrideConsumeSound overrideConsumeSound + ? overrideConsumeSound.getConsumeSound(itemStack) + : this.sound.value(); + livingEntity.playSound(soundEvent, k, l); + } + + public boolean shouldEmitParticlesAndSounds(int i) { + int j = this.consumeTicks() - i; + int k = (int)(this.consumeTicks() * 0.21875F); + boolean bl = j > k; + return bl && i % 4 == 0; + } + + public static Consumable.Builder builder() { + return new Consumable.Builder(); + } + + public static class Builder { + private float consumeSeconds = 1.6F; + private ItemUseAnimation animation = ItemUseAnimation.EAT; + private Holder sound = SoundEvents.GENERIC_EAT; + private boolean hasConsumeParticles = true; + private final List onConsumeEffects = new ArrayList(); + + Builder() { + } + + public Consumable.Builder consumeSeconds(float f) { + this.consumeSeconds = f; + return this; + } + + public Consumable.Builder animation(ItemUseAnimation itemUseAnimation) { + this.animation = itemUseAnimation; + return this; + } + + public Consumable.Builder sound(Holder holder) { + this.sound = holder; + return this; + } + + public Consumable.Builder soundAfterConsume(Holder holder) { + return this.onConsume(new PlaySoundConsumeEffect(holder)); + } + + public Consumable.Builder hasConsumeParticles(boolean bl) { + this.hasConsumeParticles = bl; + return this; + } + + public Consumable.Builder onConsume(ConsumeEffect consumeEffect) { + this.onConsumeEffects.add(consumeEffect); + return this; + } + + public Consumable build() { + return new Consumable(this.consumeSeconds, this.animation, this.sound, this.hasConsumeParticles, this.onConsumeEffects); + } + } + + public interface OverrideConsumeSound { + SoundEvent getConsumeSound(ItemStack itemStack); + } +} diff --git a/net/minecraft/world/item/component/ConsumableListener.java b/net/minecraft/world/item/component/ConsumableListener.java new file mode 100644 index 00000000..16f5914a --- /dev/null +++ b/net/minecraft/world/item/component/ConsumableListener.java @@ -0,0 +1,9 @@ +package net.minecraft.world.item.component; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; + +public interface ConsumableListener { + void onConsume(Level level, LivingEntity livingEntity, ItemStack itemStack, Consumable consumable); +} diff --git a/net/minecraft/world/item/component/Consumables.java b/net/minecraft/world/item/component/Consumables.java new file mode 100644 index 00000000..0740018a --- /dev/null +++ b/net/minecraft/world/item/component/Consumables.java @@ -0,0 +1,71 @@ +package net.minecraft.world.item.component; + +import java.util.List; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.world.effect.MobEffectInstance; +import net.minecraft.world.effect.MobEffects; +import net.minecraft.world.item.ItemUseAnimation; +import net.minecraft.world.item.consume_effects.ApplyStatusEffectsConsumeEffect; +import net.minecraft.world.item.consume_effects.ClearAllStatusEffectsConsumeEffect; +import net.minecraft.world.item.consume_effects.RemoveStatusEffectsConsumeEffect; +import net.minecraft.world.item.consume_effects.TeleportRandomlyConsumeEffect; + +public class Consumables { + public static final Consumable DEFAULT_FOOD = defaultFood().build(); + public static final Consumable DEFAULT_DRINK = defaultDrink().build(); + public static final Consumable HONEY_BOTTLE = defaultDrink() + .consumeSeconds(2.0F) + .sound(SoundEvents.HONEY_DRINK) + .onConsume(new RemoveStatusEffectsConsumeEffect(MobEffects.POISON)) + .build(); + public static final Consumable OMINOUS_BOTTLE = defaultDrink().soundAfterConsume(SoundEvents.OMINOUS_BOTTLE_DISPOSE).build(); + public static final Consumable DRIED_KELP = defaultFood().consumeSeconds(0.8F).build(); + public static final Consumable CHICKEN = defaultFood() + .onConsume(new ApplyStatusEffectsConsumeEffect(new MobEffectInstance(MobEffects.HUNGER, 600, 0), 0.3F)) + .build(); + public static final Consumable ENCHANTED_GOLDEN_APPLE = defaultFood() + .onConsume( + new ApplyStatusEffectsConsumeEffect( + List.of( + new MobEffectInstance(MobEffects.REGENERATION, 400, 1), + new MobEffectInstance(MobEffects.DAMAGE_RESISTANCE, 6000, 0), + new MobEffectInstance(MobEffects.FIRE_RESISTANCE, 6000, 0), + new MobEffectInstance(MobEffects.ABSORPTION, 2400, 3) + ) + ) + ) + .build(); + public static final Consumable GOLDEN_APPLE = defaultFood() + .onConsume( + new ApplyStatusEffectsConsumeEffect(List.of(new MobEffectInstance(MobEffects.REGENERATION, 100, 1), new MobEffectInstance(MobEffects.ABSORPTION, 2400, 0))) + ) + .build(); + public static final Consumable POISONOUS_POTATO = defaultFood() + .onConsume(new ApplyStatusEffectsConsumeEffect(new MobEffectInstance(MobEffects.POISON, 100, 0), 0.6F)) + .build(); + public static final Consumable PUFFERFISH = defaultFood() + .onConsume( + new ApplyStatusEffectsConsumeEffect( + List.of( + new MobEffectInstance(MobEffects.POISON, 1200, 1), new MobEffectInstance(MobEffects.HUNGER, 300, 2), new MobEffectInstance(MobEffects.CONFUSION, 300, 0) + ) + ) + ) + .build(); + public static final Consumable ROTTEN_FLESH = defaultFood() + .onConsume(new ApplyStatusEffectsConsumeEffect(new MobEffectInstance(MobEffects.HUNGER, 600, 0), 0.8F)) + .build(); + public static final Consumable SPIDER_EYE = defaultFood() + .onConsume(new ApplyStatusEffectsConsumeEffect(new MobEffectInstance(MobEffects.POISON, 100, 0))) + .build(); + public static final Consumable MILK_BUCKET = defaultDrink().onConsume(ClearAllStatusEffectsConsumeEffect.INSTANCE).build(); + public static final Consumable CHORUS_FRUIT = defaultFood().onConsume(new TeleportRandomlyConsumeEffect()).build(); + + public static Consumable.Builder defaultFood() { + return Consumable.builder().consumeSeconds(1.6F).animation(ItemUseAnimation.EAT).sound(SoundEvents.GENERIC_EAT).hasConsumeParticles(true); + } + + public static Consumable.Builder defaultDrink() { + return Consumable.builder().consumeSeconds(1.6F).animation(ItemUseAnimation.DRINK).sound(SoundEvents.GENERIC_DRINK).hasConsumeParticles(false); + } +} diff --git a/net/minecraft/world/item/component/DamageResistant.java b/net/minecraft/world/item/component/DamageResistant.java new file mode 100644 index 00000000..e5eb390f --- /dev/null +++ b/net/minecraft/world/item/component/DamageResistant.java @@ -0,0 +1,24 @@ +package net.minecraft.world.item.component; + +import com.mojang.serialization.Codec; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import net.minecraft.core.registries.Registries; +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.tags.TagKey; +import net.minecraft.world.damagesource.DamageSource; +import net.minecraft.world.damagesource.DamageType; + +public record DamageResistant(TagKey types) { + public static final Codec CODEC = RecordCodecBuilder.create( + instance -> instance.group(TagKey.hashedCodec(Registries.DAMAGE_TYPE).fieldOf("types").forGetter(DamageResistant::types)) + .apply(instance, DamageResistant::new) + ); + public static final StreamCodec STREAM_CODEC = StreamCodec.composite( + TagKey.streamCodec(Registries.DAMAGE_TYPE), DamageResistant::types, DamageResistant::new + ); + + public boolean isResistantTo(DamageSource damageSource) { + return damageSource.is(this.types); + } +} diff --git a/net/minecraft/world/item/component/DeathProtection.java b/net/minecraft/world/item/component/DeathProtection.java new file mode 100644 index 00000000..9bf6d260 --- /dev/null +++ b/net/minecraft/world/item/component/DeathProtection.java @@ -0,0 +1,43 @@ +package net.minecraft.world.item.component; + +import com.mojang.serialization.Codec; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import java.util.List; +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.world.effect.MobEffectInstance; +import net.minecraft.world.effect.MobEffects; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.consume_effects.ApplyStatusEffectsConsumeEffect; +import net.minecraft.world.item.consume_effects.ClearAllStatusEffectsConsumeEffect; +import net.minecraft.world.item.consume_effects.ConsumeEffect; + +public record DeathProtection(List deathEffects) { + public static final Codec CODEC = RecordCodecBuilder.create( + instance -> instance.group(ConsumeEffect.CODEC.listOf().optionalFieldOf("death_effects", List.of()).forGetter(DeathProtection::deathEffects)) + .apply(instance, DeathProtection::new) + ); + public static final StreamCodec STREAM_CODEC = StreamCodec.composite( + ConsumeEffect.STREAM_CODEC.apply(ByteBufCodecs.list()), DeathProtection::deathEffects, DeathProtection::new + ); + public static final DeathProtection TOTEM_OF_UNDYING = new DeathProtection( + List.of( + new ClearAllStatusEffectsConsumeEffect(), + new ApplyStatusEffectsConsumeEffect( + List.of( + new MobEffectInstance(MobEffects.REGENERATION, 900, 1), + new MobEffectInstance(MobEffects.ABSORPTION, 100, 1), + new MobEffectInstance(MobEffects.FIRE_RESISTANCE, 800, 0) + ) + ) + ) + ); + + public void applyEffects(ItemStack itemStack, LivingEntity livingEntity) { + for (ConsumeEffect consumeEffect : this.deathEffects) { + consumeEffect.apply(livingEntity.level(), itemStack, livingEntity); + } + } +} diff --git a/net/minecraft/world/item/component/DyedItemColor.java b/net/minecraft/world/item/component/DyedItemColor.java index 7a2509b1..1fc66642 100644 --- a/net/minecraft/world/item/component/DyedItemColor.java +++ b/net/minecraft/world/item/component/DyedItemColor.java @@ -12,7 +12,7 @@ import net.minecraft.network.chat.Component; import net.minecraft.network.codec.ByteBufCodecs; import net.minecraft.network.codec.StreamCodec; import net.minecraft.tags.ItemTags; -import net.minecraft.util.FastColor; +import net.minecraft.util.ARGB; import net.minecraft.world.item.DyeItem; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; @@ -33,7 +33,7 @@ public record DyedItemColor(int rgb, boolean showInTooltip) implements TooltipPr public static int getOrDefault(ItemStack stack, int defaultValue) { DyedItemColor dyedItemColor = stack.get(DataComponents.DYED_COLOR); - return dyedItemColor != null ? FastColor.ARGB32.opaque(dyedItemColor.rgb()) : defaultValue; + return dyedItemColor != null ? ARGB.opaque(dyedItemColor.rgb()) : defaultValue; } public static ItemStack applyDyes(ItemStack stack, List dyes) { @@ -48,9 +48,9 @@ public record DyedItemColor(int rgb, boolean showInTooltip) implements TooltipPr int m = 0; DyedItemColor dyedItemColor = itemStack.get(DataComponents.DYED_COLOR); if (dyedItemColor != null) { - int n = FastColor.ARGB32.red(dyedItemColor.rgb()); - int o = FastColor.ARGB32.green(dyedItemColor.rgb()); - int p = FastColor.ARGB32.blue(dyedItemColor.rgb()); + int n = ARGB.red(dyedItemColor.rgb()); + int o = ARGB.green(dyedItemColor.rgb()); + int p = ARGB.blue(dyedItemColor.rgb()); l += Math.max(n, Math.max(o, p)); i += n; j += o; @@ -60,9 +60,9 @@ public record DyedItemColor(int rgb, boolean showInTooltip) implements TooltipPr for (DyeItem dyeItem : dyes) { int p = dyeItem.getDyeColor().getTextureDiffuseColor(); - int q = FastColor.ARGB32.red(p); - int r = FastColor.ARGB32.green(p); - int s = FastColor.ARGB32.blue(p); + int q = ARGB.red(p); + int r = ARGB.green(p); + int s = ARGB.blue(p); l += Math.max(q, Math.max(r, s)); i += q; j += r; @@ -78,7 +78,7 @@ public record DyedItemColor(int rgb, boolean showInTooltip) implements TooltipPr n = (int)(n * f / g); o = (int)(o * f / g); p = (int)(p * f / g); - int s = FastColor.ARGB32.color(0, n, o, p); + int s = ARGB.color(0, n, o, p); boolean bl = dyedItemColor == null || dyedItemColor.showInTooltip(); itemStack.set(DataComponents.DYED_COLOR, new DyedItemColor(s, bl)); return itemStack; diff --git a/net/minecraft/world/item/component/FireworkExplosion.java b/net/minecraft/world/item/component/FireworkExplosion.java index b01f0d44..7db543d2 100644 --- a/net/minecraft/world/item/component/FireworkExplosion.java +++ b/net/minecraft/world/item/component/FireworkExplosion.java @@ -16,6 +16,7 @@ import net.minecraft.network.codec.ByteBufCodecs; import net.minecraft.network.codec.StreamCodec; import net.minecraft.util.ByIdMap; import net.minecraft.util.StringRepresentable; +import net.minecraft.util.ByIdMap.OutOfBoundsStrategy; import net.minecraft.world.item.DyeColor; import net.minecraft.world.item.Item; import net.minecraft.world.item.TooltipFlag; @@ -110,9 +111,7 @@ public record FireworkExplosion(FireworkExplosion.Shape shape, IntList colors, I CREEPER(3, "creeper"), BURST(4, "burst"); - private static final IntFunction BY_ID = ByIdMap.continuous( - FireworkExplosion.Shape::getId, values(), ByIdMap.OutOfBoundsStrategy.ZERO - ); + private static final IntFunction BY_ID = ByIdMap.continuous(FireworkExplosion.Shape::getId, values(), OutOfBoundsStrategy.ZERO); public static final StreamCodec STREAM_CODEC = ByteBufCodecs.idMapper(BY_ID, FireworkExplosion.Shape::getId); public static final Codec CODEC = StringRepresentable.fromValues(FireworkExplosion.Shape::values); private final int id; diff --git a/net/minecraft/world/item/component/OminousBottleAmplifier.java b/net/minecraft/world/item/component/OminousBottleAmplifier.java new file mode 100644 index 00000000..bc1dc99b --- /dev/null +++ b/net/minecraft/world/item/component/OminousBottleAmplifier.java @@ -0,0 +1,39 @@ +package net.minecraft.world.item.component; + +import com.mojang.serialization.Codec; +import java.util.List; +import java.util.function.Consumer; +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.chat.Component; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.util.ExtraCodecs; +import net.minecraft.world.effect.MobEffectInstance; +import net.minecraft.world.effect.MobEffects; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.TooltipFlag; +import net.minecraft.world.item.alchemy.PotionContents; +import net.minecraft.world.level.Level; + +public record OminousBottleAmplifier(int value) implements ConsumableListener, TooltipProvider { + public static final int EFFECT_DURATION = 120000; + public static final int MIN_AMPLIFIER = 0; + public static final int MAX_AMPLIFIER = 4; + public static final Codec CODEC = ExtraCodecs.intRange(0, 4).xmap(OminousBottleAmplifier::new, OminousBottleAmplifier::value); + public static final StreamCodec STREAM_CODEC = StreamCodec.composite( + ByteBufCodecs.VAR_INT, OminousBottleAmplifier::value, OminousBottleAmplifier::new + ); + + @Override + public void onConsume(Level level, LivingEntity livingEntity, ItemStack itemStack, Consumable consumable) { + livingEntity.addEffect(new MobEffectInstance(MobEffects.BAD_OMEN, 120000, this.value, false, false, true)); + } + + @Override + public void addToTooltip(Item.TooltipContext context, Consumer tooltipAdder, TooltipFlag tooltipFlag) { + List list = List.of(new MobEffectInstance(MobEffects.BAD_OMEN, 120000, this.value, false, false, true)); + PotionContents.addPotionTooltip(list, tooltipAdder, 1.0F, context.tickRate()); + } +} diff --git a/net/minecraft/world/item/component/SuspiciousStewEffects.java b/net/minecraft/world/item/component/SuspiciousStewEffects.java index 7db9b8fe..6a89a5f4 100644 --- a/net/minecraft/world/item/component/SuspiciousStewEffects.java +++ b/net/minecraft/world/item/component/SuspiciousStewEffects.java @@ -2,17 +2,27 @@ package net.minecraft.world.item.component; import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; +import java.util.ArrayList; import java.util.List; +import java.util.function.Consumer; import net.minecraft.Util; import net.minecraft.core.Holder; import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.chat.Component; import net.minecraft.network.codec.ByteBufCodecs; import net.minecraft.network.codec.StreamCodec; import net.minecraft.world.effect.MobEffect; import net.minecraft.world.effect.MobEffectInstance; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.TooltipFlag; +import net.minecraft.world.item.alchemy.PotionContents; +import net.minecraft.world.level.Level; -public record SuspiciousStewEffects(List effects) { +public record SuspiciousStewEffects(List effects) implements ConsumableListener, TooltipProvider { public static final SuspiciousStewEffects EMPTY = new SuspiciousStewEffects(List.of()); + public static final int DEFAULT_DURATION = 160; public static final Codec CODEC = SuspiciousStewEffects.Entry.CODEC .listOf() .xmap(SuspiciousStewEffects::new, SuspiciousStewEffects::effects); @@ -24,6 +34,26 @@ public record SuspiciousStewEffects(List effects) { return new SuspiciousStewEffects(Util.copyAndAdd(this.effects, entry)); } + @Override + public void onConsume(Level level, LivingEntity livingEntity, ItemStack itemStack, Consumable consumable) { + for (SuspiciousStewEffects.Entry entry : this.effects) { + livingEntity.addEffect(entry.createEffectInstance()); + } + } + + @Override + public void addToTooltip(Item.TooltipContext context, Consumer tooltipAdder, TooltipFlag tooltipFlag) { + if (tooltipFlag.isCreative()) { + List list = new ArrayList(); + + for (SuspiciousStewEffects.Entry entry : this.effects) { + list.add(entry.createEffectInstance()); + } + + PotionContents.addPotionTooltip(list, tooltipAdder, 1.0F, context.tickRate()); + } + } + public record Entry(Holder effect, int duration) { public static final Codec CODEC = RecordCodecBuilder.create( instance -> instance.group( diff --git a/net/minecraft/world/item/component/Tool.java b/net/minecraft/world/item/component/Tool.java index 2dc8f583..9a8be8fd 100644 --- a/net/minecraft/world/item/component/Tool.java +++ b/net/minecraft/world/item/component/Tool.java @@ -4,16 +4,12 @@ import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; import java.util.List; import java.util.Optional; -import java.util.stream.Collectors; -import net.minecraft.core.Holder; import net.minecraft.core.HolderSet; import net.minecraft.core.RegistryCodecs; -import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.core.registries.Registries; import net.minecraft.network.RegistryFriendlyByteBuf; import net.minecraft.network.codec.ByteBufCodecs; import net.minecraft.network.codec.StreamCodec; -import net.minecraft.tags.TagKey; import net.minecraft.util.ExtraCodecs; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.state.BlockState; @@ -76,34 +72,16 @@ public record Tool(List rules, float defaultMiningSpeed, int damagePe Tool.Rule::new ); - public static Tool.Rule minesAndDrops(List blocks, float speed) { - return forBlocks(blocks, Optional.of(speed), Optional.of(true)); + public static Tool.Rule minesAndDrops(HolderSet holderSet, float f) { + return new Tool.Rule(holderSet, Optional.of(f), Optional.of(true)); } - public static Tool.Rule minesAndDrops(TagKey blocks, float speed) { - return forTag(blocks, Optional.of(speed), Optional.of(true)); + public static Tool.Rule deniesDrops(HolderSet holderSet) { + return new Tool.Rule(holderSet, Optional.empty(), Optional.of(false)); } - public static Tool.Rule deniesDrops(TagKey blocks) { - return forTag(blocks, Optional.empty(), Optional.of(false)); - } - - public static Tool.Rule overrideSpeed(TagKey blocks, float speed) { - return forTag(blocks, Optional.of(speed), Optional.empty()); - } - - public static Tool.Rule overrideSpeed(List blocks, float speed) { - return forBlocks(blocks, Optional.of(speed), Optional.empty()); - } - - private static Tool.Rule forTag(TagKey tag, Optional speed, Optional correctForDrops) { - return new Tool.Rule(BuiltInRegistries.BLOCK.getOrCreateTag(tag), speed, correctForDrops); - } - - private static Tool.Rule forBlocks(List blocks, Optional speed, Optional correctForDrops) { - return new Tool.Rule( - HolderSet.direct((List>)blocks.stream().map(Block::builtInRegistryHolder).collect(Collectors.toList())), speed, correctForDrops - ); + public static Tool.Rule overrideSpeed(HolderSet holderSet, float f) { + return new Tool.Rule(holderSet, Optional.of(f), Optional.empty()); } } } diff --git a/net/minecraft/world/item/component/UseCooldown.java b/net/minecraft/world/item/component/UseCooldown.java new file mode 100644 index 00000000..44a45419 --- /dev/null +++ b/net/minecraft/world/item/component/UseCooldown.java @@ -0,0 +1,40 @@ +package net.minecraft.world.item.component; + +import com.mojang.serialization.Codec; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import java.util.Optional; +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.ExtraCodecs; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; + +public record UseCooldown(float seconds, Optional cooldownGroup) { + public static final Codec CODEC = RecordCodecBuilder.create( + instance -> instance.group( + ExtraCodecs.POSITIVE_FLOAT.fieldOf("seconds").forGetter(UseCooldown::seconds), + ResourceLocation.CODEC.optionalFieldOf("cooldown_group").forGetter(UseCooldown::cooldownGroup) + ) + .apply(instance, UseCooldown::new) + ); + public static final StreamCodec STREAM_CODEC = StreamCodec.composite( + ByteBufCodecs.FLOAT, UseCooldown::seconds, ResourceLocation.STREAM_CODEC.apply(ByteBufCodecs::optional), UseCooldown::cooldownGroup, UseCooldown::new + ); + + public UseCooldown(float f) { + this(f, Optional.empty()); + } + + public int ticks() { + return (int)(this.seconds * 20.0F); + } + + public void apply(ItemStack itemStack, LivingEntity livingEntity) { + if (livingEntity instanceof Player player) { + player.getCooldowns().addCooldown(itemStack, this.ticks()); + } + } +} diff --git a/net/minecraft/world/item/component/UseRemainder.java b/net/minecraft/world/item/component/UseRemainder.java new file mode 100644 index 00000000..cea75fdc --- /dev/null +++ b/net/minecraft/world/item/component/UseRemainder.java @@ -0,0 +1,49 @@ +package net.minecraft.world.item.component; + +import com.mojang.serialization.Codec; +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.world.item.ItemStack; + +public record UseRemainder(ItemStack convertInto) { + public static final Codec CODEC = ItemStack.CODEC.xmap(UseRemainder::new, UseRemainder::convertInto); + public static final StreamCodec STREAM_CODEC = StreamCodec.composite( + ItemStack.STREAM_CODEC, UseRemainder::convertInto, UseRemainder::new + ); + + public ItemStack convertIntoRemainder(ItemStack itemStack, int i, boolean bl, UseRemainder.OnExtraCreatedRemainder onExtraCreatedRemainder) { + if (bl) { + return itemStack; + } else if (itemStack.getCount() >= i) { + return itemStack; + } else { + ItemStack itemStack2 = this.convertInto.copy(); + if (itemStack.isEmpty()) { + return itemStack2; + } else { + onExtraCreatedRemainder.apply(itemStack2); + return itemStack; + } + } + } + + public boolean equals(Object object) { + if (this == object) { + return true; + } else if (object != null && this.getClass() == object.getClass()) { + UseRemainder useRemainder = (UseRemainder)object; + return ItemStack.matches(this.convertInto, useRemainder.convertInto); + } else { + return false; + } + } + + public int hashCode() { + return ItemStack.hashItemAndComponents(this.convertInto); + } + + @FunctionalInterface + public interface OnExtraCreatedRemainder { + void apply(ItemStack itemStack); + } +} diff --git a/net/minecraft/world/item/consume_effects/ApplyStatusEffectsConsumeEffect.java b/net/minecraft/world/item/consume_effects/ApplyStatusEffectsConsumeEffect.java new file mode 100644 index 00000000..4fde662b --- /dev/null +++ b/net/minecraft/world/item/consume_effects/ApplyStatusEffectsConsumeEffect.java @@ -0,0 +1,64 @@ +package net.minecraft.world.item.consume_effects; + +import com.mojang.serialization.Codec; +import com.mojang.serialization.MapCodec; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import java.util.List; +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.world.effect.MobEffectInstance; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; + +public record ApplyStatusEffectsConsumeEffect(List effects, float probability) implements ConsumeEffect { + public static final MapCodec CODEC = RecordCodecBuilder.mapCodec( + instance -> instance.group( + MobEffectInstance.CODEC.listOf().fieldOf("effects").forGetter(ApplyStatusEffectsConsumeEffect::effects), + Codec.floatRange(0.0F, 1.0F).optionalFieldOf("probability", 1.0F).forGetter(ApplyStatusEffectsConsumeEffect::probability) + ) + .apply(instance, ApplyStatusEffectsConsumeEffect::new) + ); + public static final StreamCodec STREAM_CODEC = StreamCodec.composite( + MobEffectInstance.STREAM_CODEC.apply(ByteBufCodecs.list()), + ApplyStatusEffectsConsumeEffect::effects, + ByteBufCodecs.FLOAT, + ApplyStatusEffectsConsumeEffect::probability, + ApplyStatusEffectsConsumeEffect::new + ); + + public ApplyStatusEffectsConsumeEffect(MobEffectInstance mobEffectInstance, float f) { + this(List.of(mobEffectInstance), f); + } + + public ApplyStatusEffectsConsumeEffect(List list) { + this(list, 1.0F); + } + + public ApplyStatusEffectsConsumeEffect(MobEffectInstance mobEffectInstance) { + this(mobEffectInstance, 1.0F); + } + + @Override + public ConsumeEffect.Type getType() { + return ConsumeEffect.Type.APPLY_EFFECTS; + } + + @Override + public boolean apply(Level level, ItemStack itemStack, LivingEntity livingEntity) { + if (livingEntity.getRandom().nextFloat() >= this.probability) { + return false; + } else { + boolean bl = false; + + for (MobEffectInstance mobEffectInstance : this.effects) { + if (livingEntity.addEffect(new MobEffectInstance(mobEffectInstance))) { + bl = true; + } + } + + return bl; + } + } +} diff --git a/net/minecraft/world/item/consume_effects/ClearAllStatusEffectsConsumeEffect.java b/net/minecraft/world/item/consume_effects/ClearAllStatusEffectsConsumeEffect.java new file mode 100644 index 00000000..bd421ad8 --- /dev/null +++ b/net/minecraft/world/item/consume_effects/ClearAllStatusEffectsConsumeEffect.java @@ -0,0 +1,24 @@ +package net.minecraft.world.item.consume_effects; + +import com.mojang.serialization.MapCodec; +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; + +public record ClearAllStatusEffectsConsumeEffect() implements ConsumeEffect { + public static final ClearAllStatusEffectsConsumeEffect INSTANCE = new ClearAllStatusEffectsConsumeEffect(); + public static final MapCodec CODEC = MapCodec.unit(INSTANCE); + public static final StreamCodec STREAM_CODEC = StreamCodec.unit(INSTANCE); + + @Override + public ConsumeEffect.Type getType() { + return ConsumeEffect.Type.CLEAR_ALL_EFFECTS; + } + + @Override + public boolean apply(Level level, ItemStack itemStack, LivingEntity livingEntity) { + return livingEntity.removeAllEffects(); + } +} diff --git a/net/minecraft/world/item/consume_effects/ConsumeEffect.java b/net/minecraft/world/item/consume_effects/ConsumeEffect.java new file mode 100644 index 00000000..77d1970e --- /dev/null +++ b/net/minecraft/world/item/consume_effects/ConsumeEffect.java @@ -0,0 +1,47 @@ +package net.minecraft.world.item.consume_effects; + +import com.mojang.serialization.Codec; +import com.mojang.serialization.MapCodec; +import net.minecraft.core.Registry; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.core.registries.Registries; +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; + +public interface ConsumeEffect { + Codec CODEC = BuiltInRegistries.CONSUME_EFFECT_TYPE.byNameCodec().dispatch(ConsumeEffect::getType, ConsumeEffect.Type::codec); + StreamCodec STREAM_CODEC = ByteBufCodecs.registry(Registries.CONSUME_EFFECT_TYPE) + .dispatch(ConsumeEffect::getType, ConsumeEffect.Type::streamCodec); + + ConsumeEffect.Type getType(); + + boolean apply(Level level, ItemStack itemStack, LivingEntity livingEntity); + + public record Type(MapCodec codec, StreamCodec streamCodec) { + public static final ConsumeEffect.Type APPLY_EFFECTS = register( + "apply_effects", ApplyStatusEffectsConsumeEffect.CODEC, ApplyStatusEffectsConsumeEffect.STREAM_CODEC + ); + public static final ConsumeEffect.Type REMOVE_EFFECTS = register( + "remove_effects", RemoveStatusEffectsConsumeEffect.CODEC, RemoveStatusEffectsConsumeEffect.STREAM_CODEC + ); + public static final ConsumeEffect.Type CLEAR_ALL_EFFECTS = register( + "clear_all_effects", ClearAllStatusEffectsConsumeEffect.CODEC, ClearAllStatusEffectsConsumeEffect.STREAM_CODEC + ); + public static final ConsumeEffect.Type TELEPORT_RANDOMLY = register( + "teleport_randomly", TeleportRandomlyConsumeEffect.CODEC, TeleportRandomlyConsumeEffect.STREAM_CODEC + ); + public static final ConsumeEffect.Type PLAY_SOUND = register( + "play_sound", PlaySoundConsumeEffect.CODEC, PlaySoundConsumeEffect.STREAM_CODEC + ); + + private static ConsumeEffect.Type register( + String string, MapCodec mapCodec, StreamCodec streamCodec + ) { + return Registry.register(BuiltInRegistries.CONSUME_EFFECT_TYPE, string, new ConsumeEffect.Type<>(mapCodec, streamCodec)); + } + } +} diff --git a/net/minecraft/world/item/consume_effects/PlaySoundConsumeEffect.java b/net/minecraft/world/item/consume_effects/PlaySoundConsumeEffect.java new file mode 100644 index 00000000..dd1bdc4d --- /dev/null +++ b/net/minecraft/world/item/consume_effects/PlaySoundConsumeEffect.java @@ -0,0 +1,31 @@ +package net.minecraft.world.item.consume_effects; + +import com.mojang.serialization.MapCodec; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import net.minecraft.core.Holder; +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.sounds.SoundEvent; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; + +public record PlaySoundConsumeEffect(Holder sound) implements ConsumeEffect { + public static final MapCodec CODEC = RecordCodecBuilder.mapCodec( + instance -> instance.group(SoundEvent.CODEC.fieldOf("sound").forGetter(PlaySoundConsumeEffect::sound)).apply(instance, PlaySoundConsumeEffect::new) + ); + public static final StreamCodec STREAM_CODEC = StreamCodec.composite( + SoundEvent.STREAM_CODEC, PlaySoundConsumeEffect::sound, PlaySoundConsumeEffect::new + ); + + @Override + public ConsumeEffect.Type getType() { + return ConsumeEffect.Type.PLAY_SOUND; + } + + @Override + public boolean apply(Level level, ItemStack itemStack, LivingEntity livingEntity) { + level.playSound(null, livingEntity.blockPosition(), this.sound.value(), livingEntity.getSoundSource(), 1.0F, 1.0F); + return true; + } +} diff --git a/net/minecraft/world/item/consume_effects/RemoveStatusEffectsConsumeEffect.java b/net/minecraft/world/item/consume_effects/RemoveStatusEffectsConsumeEffect.java new file mode 100644 index 00000000..c7fe9c9a --- /dev/null +++ b/net/minecraft/world/item/consume_effects/RemoveStatusEffectsConsumeEffect.java @@ -0,0 +1,47 @@ +package net.minecraft.world.item.consume_effects; + +import com.mojang.serialization.MapCodec; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import net.minecraft.core.Holder; +import net.minecraft.core.HolderSet; +import net.minecraft.core.RegistryCodecs; +import net.minecraft.core.registries.Registries; +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.world.effect.MobEffect; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; + +public record RemoveStatusEffectsConsumeEffect(HolderSet effects) implements ConsumeEffect { + public static final MapCodec CODEC = RecordCodecBuilder.mapCodec( + instance -> instance.group(RegistryCodecs.homogeneousList(Registries.MOB_EFFECT).fieldOf("effects").forGetter(RemoveStatusEffectsConsumeEffect::effects)) + .apply(instance, RemoveStatusEffectsConsumeEffect::new) + ); + public static final StreamCodec STREAM_CODEC = StreamCodec.composite( + ByteBufCodecs.holderSet(Registries.MOB_EFFECT), RemoveStatusEffectsConsumeEffect::effects, RemoveStatusEffectsConsumeEffect::new + ); + + public RemoveStatusEffectsConsumeEffect(Holder holder) { + this(HolderSet.direct(holder)); + } + + @Override + public ConsumeEffect.Type getType() { + return ConsumeEffect.Type.REMOVE_EFFECTS; + } + + @Override + public boolean apply(Level level, ItemStack itemStack, LivingEntity livingEntity) { + boolean bl = false; + + for (Holder holder : this.effects) { + if (livingEntity.removeEffect(holder)) { + bl = true; + } + } + + return bl; + } +} diff --git a/net/minecraft/world/item/consume_effects/TeleportRandomlyConsumeEffect.java b/net/minecraft/world/item/consume_effects/TeleportRandomlyConsumeEffect.java new file mode 100644 index 00000000..ba5acfbb --- /dev/null +++ b/net/minecraft/world/item/consume_effects/TeleportRandomlyConsumeEffect.java @@ -0,0 +1,84 @@ +package net.minecraft.world.item.consume_effects; + +import com.mojang.serialization.MapCodec; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.sounds.SoundEvent; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.sounds.SoundSource; +import net.minecraft.util.ExtraCodecs; +import net.minecraft.util.Mth; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.animal.Fox; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.level.gameevent.GameEvent.Context; +import net.minecraft.world.phys.Vec3; + +public record TeleportRandomlyConsumeEffect(float diameter) implements ConsumeEffect { + private static final float DEFAULT_DIAMETER = 16.0F; + public static final MapCodec CODEC = RecordCodecBuilder.mapCodec( + instance -> instance.group(ExtraCodecs.POSITIVE_FLOAT.optionalFieldOf("diameter", 16.0F).forGetter(TeleportRandomlyConsumeEffect::diameter)) + .apply(instance, TeleportRandomlyConsumeEffect::new) + ); + public static final StreamCodec STREAM_CODEC = StreamCodec.composite( + ByteBufCodecs.FLOAT, TeleportRandomlyConsumeEffect::diameter, TeleportRandomlyConsumeEffect::new + ); + + public TeleportRandomlyConsumeEffect() { + this(16.0F); + } + + @Override + public ConsumeEffect.Type getType() { + return ConsumeEffect.Type.TELEPORT_RANDOMLY; + } + + @Override + public boolean apply(Level level, ItemStack itemStack, LivingEntity livingEntity) { + boolean bl = false; + + for (int i = 0; i < 16; i++) { + double d = livingEntity.getX() + (livingEntity.getRandom().nextDouble() - 0.5) * this.diameter; + double e = Mth.clamp( + livingEntity.getY() + (livingEntity.getRandom().nextDouble() - 0.5) * this.diameter, + (double)level.getMinY(), + (double)(level.getMinY() + ((ServerLevel)level).getLogicalHeight() - 1) + ); + double f = livingEntity.getZ() + (livingEntity.getRandom().nextDouble() - 0.5) * this.diameter; + if (livingEntity.isPassenger()) { + livingEntity.stopRiding(); + } + + Vec3 vec3 = livingEntity.position(); + if (livingEntity.randomTeleport(d, e, f, true)) { + level.gameEvent(GameEvent.TELEPORT, vec3, Context.of(livingEntity)); + SoundSource soundSource; + SoundEvent soundEvent; + if (livingEntity instanceof Fox) { + soundEvent = SoundEvents.FOX_TELEPORT; + soundSource = SoundSource.NEUTRAL; + } else { + soundEvent = SoundEvents.CHORUS_FRUIT_TELEPORT; + soundSource = SoundSource.PLAYERS; + } + + level.playSound(null, livingEntity.getX(), livingEntity.getY(), livingEntity.getZ(), soundEvent, soundSource); + livingEntity.resetFallDistance(); + bl = true; + break; + } + } + + if (bl && livingEntity instanceof Player player) { + player.resetCurrentImpulseContext(); + } + + return bl; + } +} diff --git a/net/minecraft/world/item/consume_effects/package-info.java b/net/minecraft/world/item/consume_effects/package-info.java new file mode 100644 index 00000000..1c10fa75 --- /dev/null +++ b/net/minecraft/world/item/consume_effects/package-info.java @@ -0,0 +1,8 @@ +@ParametersAreNonnullByDefault +@MethodsReturnNonnullByDefault +@FieldsAreNonnullByDefault +package net.minecraft.world.item.consume_effects; + +import javax.annotation.ParametersAreNonnullByDefault; +import net.minecraft.FieldsAreNonnullByDefault; +import net.minecraft.MethodsReturnNonnullByDefault; diff --git a/net/minecraft/world/item/crafting/AbstractCookingRecipe.java b/net/minecraft/world/item/crafting/AbstractCookingRecipe.java index a28d3c84..12eb9818 100644 --- a/net/minecraft/world/item/crafting/AbstractCookingRecipe.java +++ b/net/minecraft/world/item/crafting/AbstractCookingRecipe.java @@ -1,85 +1,110 @@ package net.minecraft.world.item.crafting; -import net.minecraft.core.HolderLookup; -import net.minecraft.core.NonNullList; +import com.mojang.serialization.Codec; +import com.mojang.serialization.MapCodec; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import java.util.List; +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; -import net.minecraft.world.level.Level; +import net.minecraft.world.item.crafting.display.FurnaceRecipeDisplay; +import net.minecraft.world.item.crafting.display.RecipeDisplay; +import net.minecraft.world.item.crafting.display.SlotDisplay; -public abstract class AbstractCookingRecipe implements Recipe { - protected final RecipeType type; - protected final CookingBookCategory category; - protected final String group; - protected final Ingredient ingredient; - protected final ItemStack result; - protected final float experience; - protected final int cookingTime; +public abstract class AbstractCookingRecipe extends SingleItemRecipe { + private final CookingBookCategory category; + private final float experience; + private final int cookingTime; - public AbstractCookingRecipe( - RecipeType type, String group, CookingBookCategory category, Ingredient ingredient, ItemStack result, float experience, int cookingTime - ) { - this.type = type; - this.category = category; - this.group = group; - this.ingredient = ingredient; - this.result = result; - this.experience = experience; - this.cookingTime = cookingTime; - } - - public boolean matches(SingleRecipeInput input, Level level) { - return this.ingredient.test(input.item()); - } - - public ItemStack assemble(SingleRecipeInput input, HolderLookup.Provider registries) { - return this.result.copy(); + public AbstractCookingRecipe(String string, CookingBookCategory cookingBookCategory, Ingredient ingredient, ItemStack itemStack, float f, int i) { + super(string, ingredient, itemStack); + this.category = cookingBookCategory; + this.experience = f; + this.cookingTime = i; } @Override - public boolean canCraftInDimensions(int width, int height) { - return true; - } + public abstract RecipeSerializer getSerializer(); @Override - public NonNullList getIngredients() { - NonNullList nonNullList = NonNullList.create(); - nonNullList.add(this.ingredient); - return nonNullList; - } + public abstract RecipeType getType(); - /** - * Gets the experience of this recipe - */ - public float getExperience() { + public float experience() { return this.experience; } - @Override - public ItemStack getResultItem(HolderLookup.Provider registries) { - return this.result; - } - - @Override - public String getGroup() { - return this.group; - } - - /** - * Gets the cook time in ticks - */ - public int getCookingTime() { + public int cookingTime() { return this.cookingTime; } - @Override - public RecipeType getType() { - return this.type; - } - public CookingBookCategory category() { return this.category; } + protected abstract Item furnaceIcon(); + + @Override + public List display() { + return List.of( + new FurnaceRecipeDisplay( + this.input().display(), + SlotDisplay.AnyFuel.INSTANCE, + new SlotDisplay.ItemStackSlotDisplay(this.result()), + new SlotDisplay.ItemSlotDisplay(this.furnaceIcon()), + this.cookingTime, + this.experience + ) + ); + } + + @FunctionalInterface public interface Factory { T create(String string, CookingBookCategory cookingBookCategory, Ingredient ingredient, ItemStack itemStack, float f, int i); } + + public static class Serializer implements RecipeSerializer { + private final MapCodec codec; + private final StreamCodec streamCodec; + + public Serializer(AbstractCookingRecipe.Factory factory, int i) { + this.codec = RecordCodecBuilder.mapCodec( + instance -> instance.group( + Codec.STRING.optionalFieldOf("group", "").forGetter(SingleItemRecipe::group), + CookingBookCategory.CODEC.fieldOf("category").orElse(CookingBookCategory.MISC).forGetter(AbstractCookingRecipe::category), + Ingredient.CODEC.fieldOf("ingredient").forGetter(SingleItemRecipe::input), + ItemStack.STRICT_SINGLE_ITEM_CODEC.fieldOf("result").forGetter(SingleItemRecipe::result), + Codec.FLOAT.fieldOf("experience").orElse(0.0F).forGetter(AbstractCookingRecipe::experience), + Codec.INT.fieldOf("cookingtime").orElse(i).forGetter(AbstractCookingRecipe::cookingTime) + ) + .apply(instance, factory::create) + ); + this.streamCodec = StreamCodec.composite( + ByteBufCodecs.STRING_UTF8, + SingleItemRecipe::group, + CookingBookCategory.STREAM_CODEC, + AbstractCookingRecipe::category, + Ingredient.CONTENTS_STREAM_CODEC, + SingleItemRecipe::input, + ItemStack.STREAM_CODEC, + SingleItemRecipe::result, + ByteBufCodecs.FLOAT, + AbstractCookingRecipe::experience, + ByteBufCodecs.INT, + AbstractCookingRecipe::cookingTime, + factory::create + ); + } + + @Override + public MapCodec codec() { + return this.codec; + } + + @Override + public StreamCodec streamCodec() { + return this.streamCodec; + } + } } diff --git a/net/minecraft/world/item/crafting/ArmorDyeRecipe.java b/net/minecraft/world/item/crafting/ArmorDyeRecipe.java index d556b2fb..c0c3b07f 100644 --- a/net/minecraft/world/item/crafting/ArmorDyeRecipe.java +++ b/net/minecraft/world/item/crafting/ArmorDyeRecipe.java @@ -1,6 +1,6 @@ package net.minecraft.world.item.crafting; -import com.google.common.collect.Lists; +import java.util.ArrayList; import java.util.List; import net.minecraft.core.HolderLookup; import net.minecraft.tags.ItemTags; @@ -15,33 +15,37 @@ public class ArmorDyeRecipe extends CustomRecipe { } public boolean matches(CraftingInput input, Level level) { - ItemStack itemStack = ItemStack.EMPTY; - List list = Lists.newArrayList(); + if (input.ingredientCount() < 2) { + return false; + } else { + boolean bl = false; + boolean bl2 = false; - for (int i = 0; i < input.size(); i++) { - ItemStack itemStack2 = input.getItem(i); - if (!itemStack2.isEmpty()) { - if (itemStack2.is(ItemTags.DYEABLE)) { - if (!itemStack.isEmpty()) { - return false; + for (int i = 0; i < input.size(); i++) { + ItemStack itemStack = input.getItem(i); + if (!itemStack.isEmpty()) { + if (itemStack.is(ItemTags.DYEABLE)) { + if (bl) { + return false; + } + + bl = true; + } else { + if (!(itemStack.getItem() instanceof DyeItem)) { + return false; + } + + bl2 = true; } - - itemStack = itemStack2; - } else { - if (!(itemStack2.getItem() instanceof DyeItem)) { - return false; - } - - list.add(itemStack2); } } - } - return !itemStack.isEmpty() && !list.isEmpty(); + return bl2 && bl; + } } public ItemStack assemble(CraftingInput input, HolderLookup.Provider registries) { - List list = Lists.newArrayList(); + List list = new ArrayList(); ItemStack itemStack = ItemStack.EMPTY; for (int i = 0; i < input.size(); i++) { @@ -67,12 +71,7 @@ public class ArmorDyeRecipe extends CustomRecipe { } @Override - public boolean canCraftInDimensions(int width, int height) { - return width * height >= 2; - } - - @Override - public RecipeSerializer getSerializer() { + public RecipeSerializer getSerializer() { return RecipeSerializer.ARMOR_DYE; } } diff --git a/net/minecraft/world/item/crafting/BannerDuplicateRecipe.java b/net/minecraft/world/item/crafting/BannerDuplicateRecipe.java index 97f1b5e9..e71401f9 100644 --- a/net/minecraft/world/item/crafting/BannerDuplicateRecipe.java +++ b/net/minecraft/world/item/crafting/BannerDuplicateRecipe.java @@ -15,45 +15,49 @@ public class BannerDuplicateRecipe extends CustomRecipe { } public boolean matches(CraftingInput input, Level level) { - DyeColor dyeColor = null; - ItemStack itemStack = null; - ItemStack itemStack2 = null; + if (input.ingredientCount() != 2) { + return false; + } else { + DyeColor dyeColor = null; + boolean bl = false; + boolean bl2 = false; - for (int i = 0; i < input.size(); i++) { - ItemStack itemStack3 = input.getItem(i); - if (!itemStack3.isEmpty()) { - if (!(itemStack3.getItem() instanceof BannerItem bannerItem)) { - return false; - } - - if (dyeColor == null) { - dyeColor = bannerItem.getColor(); - } else if (dyeColor != bannerItem.getColor()) { - return false; - } - - int j = itemStack3.getOrDefault(DataComponents.BANNER_PATTERNS, BannerPatternLayers.EMPTY).layers().size(); - if (j > 6) { - return false; - } - - if (j > 0) { - if (itemStack != null) { + for (int i = 0; i < input.size(); i++) { + ItemStack itemStack = input.getItem(i); + if (!itemStack.isEmpty()) { + if (!(itemStack.getItem() instanceof BannerItem bannerItem)) { return false; } - itemStack = itemStack3; - } else { - if (itemStack2 != null) { + if (dyeColor == null) { + dyeColor = bannerItem.getColor(); + } else if (dyeColor != bannerItem.getColor()) { return false; } - itemStack2 = itemStack3; + int j = itemStack.getOrDefault(DataComponents.BANNER_PATTERNS, BannerPatternLayers.EMPTY).layers().size(); + if (j > 6) { + return false; + } + + if (j > 0) { + if (bl2) { + return false; + } + + bl2 = true; + } else { + if (bl) { + return false; + } + + bl = true; + } } } - } - return itemStack != null && itemStack2 != null; + return bl2 && bl; + } } public ItemStack assemble(CraftingInput input, HolderLookup.Provider registries) { @@ -70,14 +74,16 @@ public class BannerDuplicateRecipe extends CustomRecipe { return ItemStack.EMPTY; } - public NonNullList getRemainingItems(CraftingInput input) { - NonNullList nonNullList = NonNullList.withSize(input.size(), ItemStack.EMPTY); + @Override + public NonNullList getRemainingItems(CraftingInput craftingInput) { + NonNullList nonNullList = NonNullList.withSize(craftingInput.size(), ItemStack.EMPTY); for (int i = 0; i < nonNullList.size(); i++) { - ItemStack itemStack = input.getItem(i); + ItemStack itemStack = craftingInput.getItem(i); if (!itemStack.isEmpty()) { - if (itemStack.getItem().hasCraftingRemainingItem()) { - nonNullList.set(i, new ItemStack(itemStack.getItem().getCraftingRemainingItem())); + ItemStack itemStack2 = itemStack.getItem().getCraftingRemainder(); + if (!itemStack2.isEmpty()) { + nonNullList.set(i, itemStack2); } else if (!itemStack.getOrDefault(DataComponents.BANNER_PATTERNS, BannerPatternLayers.EMPTY).layers().isEmpty()) { nonNullList.set(i, itemStack.copyWithCount(1)); } @@ -88,12 +94,7 @@ public class BannerDuplicateRecipe extends CustomRecipe { } @Override - public RecipeSerializer getSerializer() { + public RecipeSerializer getSerializer() { return RecipeSerializer.BANNER_DUPLICATE; } - - @Override - public boolean canCraftInDimensions(int width, int height) { - return width * height >= 2; - } } diff --git a/net/minecraft/world/item/crafting/BlastingRecipe.java b/net/minecraft/world/item/crafting/BlastingRecipe.java index dd8a372a..360f2089 100644 --- a/net/minecraft/world/item/crafting/BlastingRecipe.java +++ b/net/minecraft/world/item/crafting/BlastingRecipe.java @@ -1,20 +1,34 @@ package net.minecraft.world.item.crafting; +import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; -import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.item.Items; public class BlastingRecipe extends AbstractCookingRecipe { public BlastingRecipe(String group, CookingBookCategory category, Ingredient ingredient, ItemStack result, float experience, int cookingTime) { - super(RecipeType.BLASTING, group, category, ingredient, result, experience, cookingTime); + super(group, category, ingredient, result, experience, cookingTime); } @Override - public ItemStack getToastSymbol() { - return new ItemStack(Blocks.BLAST_FURNACE); + protected Item furnaceIcon() { + return Items.BLAST_FURNACE; } @Override - public RecipeSerializer getSerializer() { + public RecipeSerializer getSerializer() { return RecipeSerializer.BLASTING_RECIPE; } + + @Override + public RecipeType getType() { + return RecipeType.BLASTING; + } + + @Override + public RecipeBookCategory recipeBookCategory() { + return switch (this.category()) { + case BLOCKS -> RecipeBookCategories.BLAST_FURNACE_BLOCKS; + case FOOD, MISC -> RecipeBookCategories.BLAST_FURNACE_MISC; + }; + } } diff --git a/net/minecraft/world/item/crafting/BookCloningRecipe.java b/net/minecraft/world/item/crafting/BookCloningRecipe.java index fabe3ad0..e15abeb2 100644 --- a/net/minecraft/world/item/crafting/BookCloningRecipe.java +++ b/net/minecraft/world/item/crafting/BookCloningRecipe.java @@ -15,29 +15,33 @@ public class BookCloningRecipe extends CustomRecipe { } public boolean matches(CraftingInput input, Level level) { - int i = 0; - ItemStack itemStack = ItemStack.EMPTY; + if (input.ingredientCount() < 2) { + return false; + } else { + boolean bl = false; + boolean bl2 = false; - for (int j = 0; j < input.size(); j++) { - ItemStack itemStack2 = input.getItem(j); - if (!itemStack2.isEmpty()) { - if (itemStack2.is(Items.WRITTEN_BOOK)) { - if (!itemStack.isEmpty()) { - return false; + for (int i = 0; i < input.size(); i++) { + ItemStack itemStack = input.getItem(i); + if (!itemStack.isEmpty()) { + if (itemStack.is(Items.WRITTEN_BOOK)) { + if (bl2) { + return false; + } + + bl2 = true; + } else { + if (!itemStack.is(Items.WRITABLE_BOOK)) { + return false; + } + + bl = true; } - - itemStack = itemStack2; - } else { - if (!itemStack2.is(Items.WRITABLE_BOOK)) { - return false; - } - - i++; } } - } - return !itemStack.isEmpty() && i > 0; + return bl2 && bl; + } } public ItemStack assemble(CraftingInput input, HolderLookup.Provider registries) { @@ -78,13 +82,15 @@ public class BookCloningRecipe extends CustomRecipe { } } - public NonNullList getRemainingItems(CraftingInput input) { - NonNullList nonNullList = NonNullList.withSize(input.size(), ItemStack.EMPTY); + @Override + public NonNullList getRemainingItems(CraftingInput craftingInput) { + NonNullList nonNullList = NonNullList.withSize(craftingInput.size(), ItemStack.EMPTY); for (int i = 0; i < nonNullList.size(); i++) { - ItemStack itemStack = input.getItem(i); - if (itemStack.getItem().hasCraftingRemainingItem()) { - nonNullList.set(i, new ItemStack(itemStack.getItem().getCraftingRemainingItem())); + ItemStack itemStack = craftingInput.getItem(i); + ItemStack itemStack2 = itemStack.getItem().getCraftingRemainder(); + if (!itemStack2.isEmpty()) { + nonNullList.set(i, itemStack2); } else if (itemStack.getItem() instanceof WrittenBookItem) { nonNullList.set(i, itemStack.copyWithCount(1)); break; @@ -95,12 +101,7 @@ public class BookCloningRecipe extends CustomRecipe { } @Override - public RecipeSerializer getSerializer() { + public RecipeSerializer getSerializer() { return RecipeSerializer.BOOK_CLONING; } - - @Override - public boolean canCraftInDimensions(int width, int height) { - return width >= 3 && height >= 3; - } } diff --git a/net/minecraft/world/item/crafting/CampfireCookingRecipe.java b/net/minecraft/world/item/crafting/CampfireCookingRecipe.java index 89dd109b..81af9cf3 100644 --- a/net/minecraft/world/item/crafting/CampfireCookingRecipe.java +++ b/net/minecraft/world/item/crafting/CampfireCookingRecipe.java @@ -1,20 +1,31 @@ package net.minecraft.world.item.crafting; +import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; -import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.item.Items; public class CampfireCookingRecipe extends AbstractCookingRecipe { public CampfireCookingRecipe(String group, CookingBookCategory category, Ingredient ingredient, ItemStack result, float experience, int cookingTime) { - super(RecipeType.CAMPFIRE_COOKING, group, category, ingredient, result, experience, cookingTime); + super(group, category, ingredient, result, experience, cookingTime); } @Override - public ItemStack getToastSymbol() { - return new ItemStack(Blocks.CAMPFIRE); + protected Item furnaceIcon() { + return Items.CAMPFIRE; } @Override - public RecipeSerializer getSerializer() { + public RecipeSerializer getSerializer() { return RecipeSerializer.CAMPFIRE_COOKING_RECIPE; } + + @Override + public RecipeType getType() { + return RecipeType.CAMPFIRE_COOKING; + } + + @Override + public RecipeBookCategory recipeBookCategory() { + return RecipeBookCategories.CAMPFIRE; + } } diff --git a/net/minecraft/world/item/crafting/CookingBookCategory.java b/net/minecraft/world/item/crafting/CookingBookCategory.java index 2ffc0285..a6e05611 100644 --- a/net/minecraft/world/item/crafting/CookingBookCategory.java +++ b/net/minecraft/world/item/crafting/CookingBookCategory.java @@ -1,17 +1,30 @@ package net.minecraft.world.item.crafting; +import com.mojang.serialization.Codec; +import io.netty.buffer.ByteBuf; +import java.util.function.IntFunction; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.util.ByIdMap; import net.minecraft.util.StringRepresentable; +import net.minecraft.util.ByIdMap.OutOfBoundsStrategy; public enum CookingBookCategory implements StringRepresentable { - FOOD("food"), - BLOCKS("blocks"), - MISC("misc"); + FOOD(0, "food"), + BLOCKS(1, "blocks"), + MISC(2, "misc"); - public static final StringRepresentable.EnumCodec CODEC = StringRepresentable.fromEnum(CookingBookCategory::values); + private static final IntFunction BY_ID = ByIdMap.continuous( + cookingBookCategory -> cookingBookCategory.id, values(), OutOfBoundsStrategy.ZERO + ); + public static final Codec CODEC = StringRepresentable.fromEnum(CookingBookCategory::values); + public static final StreamCodec STREAM_CODEC = ByteBufCodecs.idMapper(BY_ID, cookingBookCategory -> cookingBookCategory.id); + private final int id; private final String name; - private CookingBookCategory(final String name) { - this.name = name; + private CookingBookCategory(final int j, final String string2) { + this.id = j; + this.name = string2; } @Override diff --git a/net/minecraft/world/item/crafting/CraftingBookCategory.java b/net/minecraft/world/item/crafting/CraftingBookCategory.java index 7d1d4ab3..9cbc6055 100644 --- a/net/minecraft/world/item/crafting/CraftingBookCategory.java +++ b/net/minecraft/world/item/crafting/CraftingBookCategory.java @@ -7,6 +7,7 @@ import net.minecraft.network.codec.ByteBufCodecs; import net.minecraft.network.codec.StreamCodec; import net.minecraft.util.ByIdMap; import net.minecraft.util.StringRepresentable; +import net.minecraft.util.ByIdMap.OutOfBoundsStrategy; public enum CraftingBookCategory implements StringRepresentable { BUILDING("building", 0), @@ -15,7 +16,7 @@ public enum CraftingBookCategory implements StringRepresentable { MISC("misc", 3); public static final Codec CODEC = StringRepresentable.fromEnum(CraftingBookCategory::values); - public static final IntFunction BY_ID = ByIdMap.continuous(CraftingBookCategory::id, values(), ByIdMap.OutOfBoundsStrategy.ZERO); + public static final IntFunction BY_ID = ByIdMap.continuous(CraftingBookCategory::id, values(), OutOfBoundsStrategy.ZERO); public static final StreamCodec STREAM_CODEC = ByteBufCodecs.idMapper(BY_ID, CraftingBookCategory::id); private final String name; private final int id; diff --git a/net/minecraft/world/item/crafting/CraftingInput.java b/net/minecraft/world/item/crafting/CraftingInput.java index a7e6a938..7f9e8641 100644 --- a/net/minecraft/world/item/crafting/CraftingInput.java +++ b/net/minecraft/world/item/crafting/CraftingInput.java @@ -2,7 +2,7 @@ package net.minecraft.world.item.crafting; import java.util.ArrayList; import java.util.List; -import net.minecraft.world.entity.player.StackedContents; +import net.minecraft.world.entity.player.StackedItemContents; import net.minecraft.world.item.ItemStack; public class CraftingInput implements RecipeInput { @@ -10,7 +10,7 @@ public class CraftingInput implements RecipeInput { private final int width; private final int height; private final List items; - private final StackedContents stackedContents = new StackedContents(); + private final StackedItemContents stackedContents = new StackedItemContents(); private final int ingredientCount; private CraftingInput(int width, int height, List item) { @@ -100,7 +100,7 @@ public class CraftingInput implements RecipeInput { return this.ingredientCount == 0; } - public StackedContents stackedContents() { + public StackedItemContents stackedContents() { return this.stackedContents; } diff --git a/net/minecraft/world/item/crafting/CraftingRecipe.java b/net/minecraft/world/item/crafting/CraftingRecipe.java index b2a8f9ea..7a0e2a47 100644 --- a/net/minecraft/world/item/crafting/CraftingRecipe.java +++ b/net/minecraft/world/item/crafting/CraftingRecipe.java @@ -1,10 +1,42 @@ package net.minecraft.world.item.crafting; +import net.minecraft.core.NonNullList; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; + public interface CraftingRecipe extends Recipe { @Override - default RecipeType getType() { + default RecipeType getType() { return RecipeType.CRAFTING; } + @Override + RecipeSerializer getSerializer(); + CraftingBookCategory category(); + + default NonNullList getRemainingItems(CraftingInput craftingInput) { + return defaultCraftingReminder(craftingInput); + } + + static NonNullList defaultCraftingReminder(CraftingInput craftingInput) { + NonNullList nonNullList = NonNullList.withSize(craftingInput.size(), ItemStack.EMPTY); + + for (int i = 0; i < nonNullList.size(); i++) { + Item item = craftingInput.getItem(i).getItem(); + nonNullList.set(i, item.getCraftingRemainder()); + } + + return nonNullList; + } + + @Override + default RecipeBookCategory recipeBookCategory() { + return switch (this.category()) { + case BUILDING -> RecipeBookCategories.CRAFTING_BUILDING_BLOCKS; + case EQUIPMENT -> RecipeBookCategories.CRAFTING_EQUIPMENT; + case REDSTONE -> RecipeBookCategories.CRAFTING_REDSTONE; + case MISC -> RecipeBookCategories.CRAFTING_MISC; + }; + } } diff --git a/net/minecraft/world/item/crafting/CustomRecipe.java b/net/minecraft/world/item/crafting/CustomRecipe.java index b07ed334..1b72d3a2 100644 --- a/net/minecraft/world/item/crafting/CustomRecipe.java +++ b/net/minecraft/world/item/crafting/CustomRecipe.java @@ -1,7 +1,10 @@ package net.minecraft.world.item.crafting; -import net.minecraft.core.HolderLookup; -import net.minecraft.world.item.ItemStack; +import com.mojang.serialization.MapCodec; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.world.item.crafting.CustomRecipe.Serializer.Factory; public abstract class CustomRecipe implements CraftingRecipe { private final CraftingBookCategory category; @@ -15,13 +18,39 @@ public abstract class CustomRecipe implements CraftingRecipe { return true; } - @Override - public ItemStack getResultItem(HolderLookup.Provider registries) { - return ItemStack.EMPTY; - } - @Override public CraftingBookCategory category() { return this.category; } + + @Override + public PlacementInfo placementInfo() { + return PlacementInfo.NOT_PLACEABLE; + } + + @Override + public abstract RecipeSerializer getSerializer(); + + public static class Serializer implements RecipeSerializer { + private final MapCodec codec; + private final StreamCodec streamCodec; + + public Serializer(Factory factory) { + this.codec = RecordCodecBuilder.mapCodec( + instance -> instance.group(CraftingBookCategory.CODEC.fieldOf("category").orElse(CraftingBookCategory.MISC).forGetter(CraftingRecipe::category)) + .apply(instance, factory::create) + ); + this.streamCodec = StreamCodec.composite(CraftingBookCategory.STREAM_CODEC, CraftingRecipe::category, factory::create); + } + + @Override + public MapCodec codec() { + return this.codec; + } + + @Override + public StreamCodec streamCodec() { + return this.streamCodec; + } + } } diff --git a/net/minecraft/world/item/crafting/DecoratedPotRecipe.java b/net/minecraft/world/item/crafting/DecoratedPotRecipe.java index 2ef38889..67371a83 100644 --- a/net/minecraft/world/item/crafting/DecoratedPotRecipe.java +++ b/net/minecraft/world/item/crafting/DecoratedPotRecipe.java @@ -3,7 +3,6 @@ package net.minecraft.world.item.crafting; import net.minecraft.core.HolderLookup; import net.minecraft.tags.ItemTags; import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.Items; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.entity.DecoratedPotBlockEntity; import net.minecraft.world.level.block.entity.PotDecorations; @@ -13,49 +12,40 @@ public class DecoratedPotRecipe extends CustomRecipe { super(craftingBookCategory); } - public boolean matches(CraftingInput craftingInput, Level level) { - if (!this.canCraftInDimensions(craftingInput.width(), craftingInput.height())) { - return false; - } else { - for (int i = 0; i < craftingInput.size(); i++) { - ItemStack itemStack = craftingInput.getItem(i); - switch (i) { - case 1: - case 3: - case 5: - case 7: - if (!itemStack.is(ItemTags.DECORATED_POT_INGREDIENTS)) { - return false; - } - break; - case 2: - case 4: - case 6: - default: - if (!itemStack.is(Items.AIR)) { - return false; - } - } - } + private static ItemStack back(CraftingInput craftingInput) { + return craftingInput.getItem(1, 0); + } - return true; - } + private static ItemStack left(CraftingInput craftingInput) { + return craftingInput.getItem(0, 1); + } + + private static ItemStack right(CraftingInput craftingInput) { + return craftingInput.getItem(2, 1); + } + + private static ItemStack front(CraftingInput craftingInput) { + return craftingInput.getItem(1, 2); + } + + public boolean matches(CraftingInput craftingInput, Level level) { + return craftingInput.width() == 3 && craftingInput.height() == 3 && craftingInput.ingredientCount() == 4 + ? back(craftingInput).is(ItemTags.DECORATED_POT_INGREDIENTS) + && left(craftingInput).is(ItemTags.DECORATED_POT_INGREDIENTS) + && right(craftingInput).is(ItemTags.DECORATED_POT_INGREDIENTS) + && front(craftingInput).is(ItemTags.DECORATED_POT_INGREDIENTS) + : false; } public ItemStack assemble(CraftingInput craftingInput, HolderLookup.Provider provider) { PotDecorations potDecorations = new PotDecorations( - craftingInput.getItem(1).getItem(), craftingInput.getItem(3).getItem(), craftingInput.getItem(5).getItem(), craftingInput.getItem(7).getItem() + back(craftingInput).getItem(), left(craftingInput).getItem(), right(craftingInput).getItem(), front(craftingInput).getItem() ); return DecoratedPotBlockEntity.createDecoratedPotItem(potDecorations); } @Override - public boolean canCraftInDimensions(int width, int height) { - return width == 3 && height == 3; - } - - @Override - public RecipeSerializer getSerializer() { + public RecipeSerializer getSerializer() { return RecipeSerializer.DECORATED_POT_RECIPE; } } diff --git a/net/minecraft/world/item/crafting/ExtendedRecipeBookCategory.java b/net/minecraft/world/item/crafting/ExtendedRecipeBookCategory.java new file mode 100644 index 00000000..3b699eb1 --- /dev/null +++ b/net/minecraft/world/item/crafting/ExtendedRecipeBookCategory.java @@ -0,0 +1,4 @@ +package net.minecraft.world.item.crafting; + +public interface ExtendedRecipeBookCategory { +} diff --git a/net/minecraft/world/item/crafting/FireworkRocketRecipe.java b/net/minecraft/world/item/crafting/FireworkRocketRecipe.java index 3883ba68..77d48e64 100644 --- a/net/minecraft/world/item/crafting/FireworkRocketRecipe.java +++ b/net/minecraft/world/item/crafting/FireworkRocketRecipe.java @@ -20,29 +20,33 @@ public class FireworkRocketRecipe extends CustomRecipe { } public boolean matches(CraftingInput input, Level level) { - boolean bl = false; - int i = 0; + if (input.ingredientCount() < 2) { + return false; + } else { + boolean bl = false; + int i = 0; - for (int j = 0; j < input.size(); j++) { - ItemStack itemStack = input.getItem(j); - if (!itemStack.isEmpty()) { - if (PAPER_INGREDIENT.test(itemStack)) { - if (bl) { + for (int j = 0; j < input.size(); j++) { + ItemStack itemStack = input.getItem(j); + if (!itemStack.isEmpty()) { + if (PAPER_INGREDIENT.test(itemStack)) { + if (bl) { + return false; + } + + bl = true; + } else if (GUNPOWDER_INGREDIENT.test(itemStack)) { + if (++i > 3) { + return false; + } + } else if (!STAR_INGREDIENT.test(itemStack)) { return false; } - - bl = true; - } else if (GUNPOWDER_INGREDIENT.test(itemStack)) { - if (++i > 3) { - return false; - } - } else if (!STAR_INGREDIENT.test(itemStack)) { - return false; } } - } - return bl && i >= 1; + return bl && i >= 1; + } } public ItemStack assemble(CraftingInput input, HolderLookup.Provider registries) { @@ -69,17 +73,7 @@ public class FireworkRocketRecipe extends CustomRecipe { } @Override - public boolean canCraftInDimensions(int width, int height) { - return width * height >= 2; - } - - @Override - public ItemStack getResultItem(HolderLookup.Provider registries) { - return new ItemStack(Items.FIREWORK_ROCKET); - } - - @Override - public RecipeSerializer getSerializer() { + public RecipeSerializer getSerializer() { return RecipeSerializer.FIREWORK_ROCKET; } } diff --git a/net/minecraft/world/item/crafting/FireworkStarFadeRecipe.java b/net/minecraft/world/item/crafting/FireworkStarFadeRecipe.java index 1c699f12..0bdffdb5 100644 --- a/net/minecraft/world/item/crafting/FireworkStarFadeRecipe.java +++ b/net/minecraft/world/item/crafting/FireworkStarFadeRecipe.java @@ -5,7 +5,6 @@ import it.unimi.dsi.fastutil.ints.IntList; import net.minecraft.core.HolderLookup; import net.minecraft.core.component.DataComponents; import net.minecraft.world.item.DyeItem; -import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.item.component.FireworkExplosion; @@ -19,29 +18,33 @@ public class FireworkStarFadeRecipe extends CustomRecipe { } public boolean matches(CraftingInput input, Level level) { - boolean bl = false; - boolean bl2 = false; + if (input.ingredientCount() < 2) { + return false; + } else { + boolean bl = false; + boolean bl2 = false; - for (int i = 0; i < input.size(); i++) { - ItemStack itemStack = input.getItem(i); - if (!itemStack.isEmpty()) { - if (itemStack.getItem() instanceof DyeItem) { - bl = true; - } else { - if (!STAR_INGREDIENT.test(itemStack)) { - return false; + for (int i = 0; i < input.size(); i++) { + ItemStack itemStack = input.getItem(i); + if (!itemStack.isEmpty()) { + if (itemStack.getItem() instanceof DyeItem) { + bl = true; + } else { + if (!STAR_INGREDIENT.test(itemStack)) { + return false; + } + + if (bl2) { + return false; + } + + bl2 = true; } - - if (bl2) { - return false; - } - - bl2 = true; } } - } - return bl2 && bl; + return bl2 && bl; + } } public ItemStack assemble(CraftingInput input, HolderLookup.Provider registries) { @@ -50,9 +53,8 @@ public class FireworkStarFadeRecipe extends CustomRecipe { for (int i = 0; i < input.size(); i++) { ItemStack itemStack2 = input.getItem(i); - Item item = itemStack2.getItem(); - if (item instanceof DyeItem) { - intList.add(((DyeItem)item).getDyeColor().getFireworkColor()); + if (itemStack2.getItem() instanceof DyeItem dyeItem) { + intList.add(dyeItem.getDyeColor().getFireworkColor()); } else if (STAR_INGREDIENT.test(itemStack2)) { itemStack = itemStack2.copyWithCount(1); } @@ -67,12 +69,7 @@ public class FireworkStarFadeRecipe extends CustomRecipe { } @Override - public boolean canCraftInDimensions(int width, int height) { - return width * height >= 2; - } - - @Override - public RecipeSerializer getSerializer() { + public RecipeSerializer getSerializer() { return RecipeSerializer.FIREWORK_STAR_FADE; } } diff --git a/net/minecraft/world/item/crafting/FireworkStarRecipe.java b/net/minecraft/world/item/crafting/FireworkStarRecipe.java index 847166ca..bb04cb81 100644 --- a/net/minecraft/world/item/crafting/FireworkStarRecipe.java +++ b/net/minecraft/world/item/crafting/FireworkStarRecipe.java @@ -1,10 +1,8 @@ package net.minecraft.world.item.crafting; -import com.google.common.collect.Maps; import it.unimi.dsi.fastutil.ints.IntArrayList; import it.unimi.dsi.fastutil.ints.IntList; import java.util.Map; -import net.minecraft.Util; import net.minecraft.core.HolderLookup; import net.minecraft.core.component.DataComponents; import net.minecraft.world.item.DyeItem; @@ -15,32 +13,30 @@ import net.minecraft.world.item.component.FireworkExplosion; import net.minecraft.world.level.Level; public class FireworkStarRecipe extends CustomRecipe { - private static final Ingredient SHAPE_INGREDIENT = Ingredient.of( + private static final Map SHAPE_BY_ITEM = Map.of( Items.FIRE_CHARGE, + FireworkExplosion.Shape.LARGE_BALL, Items.FEATHER, + FireworkExplosion.Shape.BURST, Items.GOLD_NUGGET, + FireworkExplosion.Shape.STAR, Items.SKELETON_SKULL, + FireworkExplosion.Shape.CREEPER, Items.WITHER_SKELETON_SKULL, + FireworkExplosion.Shape.CREEPER, Items.CREEPER_HEAD, + FireworkExplosion.Shape.CREEPER, Items.PLAYER_HEAD, + FireworkExplosion.Shape.CREEPER, Items.DRAGON_HEAD, + FireworkExplosion.Shape.CREEPER, Items.ZOMBIE_HEAD, - Items.PIGLIN_HEAD + FireworkExplosion.Shape.CREEPER, + Items.PIGLIN_HEAD, + FireworkExplosion.Shape.CREEPER ); private static final Ingredient TRAIL_INGREDIENT = Ingredient.of(Items.DIAMOND); private static final Ingredient TWINKLE_INGREDIENT = Ingredient.of(Items.GLOWSTONE_DUST); - private static final Map SHAPE_BY_ITEM = Util.make(Maps.newHashMap(), hashMap -> { - hashMap.put(Items.FIRE_CHARGE, FireworkExplosion.Shape.LARGE_BALL); - hashMap.put(Items.FEATHER, FireworkExplosion.Shape.BURST); - hashMap.put(Items.GOLD_NUGGET, FireworkExplosion.Shape.STAR); - hashMap.put(Items.SKELETON_SKULL, FireworkExplosion.Shape.CREEPER); - hashMap.put(Items.WITHER_SKELETON_SKULL, FireworkExplosion.Shape.CREEPER); - hashMap.put(Items.CREEPER_HEAD, FireworkExplosion.Shape.CREEPER); - hashMap.put(Items.PLAYER_HEAD, FireworkExplosion.Shape.CREEPER); - hashMap.put(Items.DRAGON_HEAD, FireworkExplosion.Shape.CREEPER); - hashMap.put(Items.ZOMBIE_HEAD, FireworkExplosion.Shape.CREEPER); - hashMap.put(Items.PIGLIN_HEAD, FireworkExplosion.Shape.CREEPER); - }); private static final Ingredient GUNPOWDER_INGREDIENT = Ingredient.of(Items.GUNPOWDER); public FireworkStarRecipe(CraftingBookCategory category) { @@ -48,50 +44,54 @@ public class FireworkStarRecipe extends CustomRecipe { } public boolean matches(CraftingInput input, Level level) { - boolean bl = false; - boolean bl2 = false; - boolean bl3 = false; - boolean bl4 = false; - boolean bl5 = false; + if (input.ingredientCount() < 2) { + return false; + } else { + boolean bl = false; + boolean bl2 = false; + boolean bl3 = false; + boolean bl4 = false; + boolean bl5 = false; - for (int i = 0; i < input.size(); i++) { - ItemStack itemStack = input.getItem(i); - if (!itemStack.isEmpty()) { - if (SHAPE_INGREDIENT.test(itemStack)) { - if (bl3) { - return false; + for (int i = 0; i < input.size(); i++) { + ItemStack itemStack = input.getItem(i); + if (!itemStack.isEmpty()) { + if (SHAPE_BY_ITEM.containsKey(itemStack.getItem())) { + if (bl3) { + return false; + } + + bl3 = true; + } else if (TWINKLE_INGREDIENT.test(itemStack)) { + if (bl5) { + return false; + } + + bl5 = true; + } else if (TRAIL_INGREDIENT.test(itemStack)) { + if (bl4) { + return false; + } + + bl4 = true; + } else if (GUNPOWDER_INGREDIENT.test(itemStack)) { + if (bl) { + return false; + } + + bl = true; + } else { + if (!(itemStack.getItem() instanceof DyeItem)) { + return false; + } + + bl2 = true; } - - bl3 = true; - } else if (TWINKLE_INGREDIENT.test(itemStack)) { - if (bl5) { - return false; - } - - bl5 = true; - } else if (TRAIL_INGREDIENT.test(itemStack)) { - if (bl4) { - return false; - } - - bl4 = true; - } else if (GUNPOWDER_INGREDIENT.test(itemStack)) { - if (bl) { - return false; - } - - bl = true; - } else { - if (!(itemStack.getItem() instanceof DyeItem)) { - return false; - } - - bl2 = true; } } - } - return bl && bl2; + return bl && bl2; + } } public ItemStack assemble(CraftingInput input, HolderLookup.Provider registries) { @@ -103,14 +103,15 @@ public class FireworkStarRecipe extends CustomRecipe { for (int i = 0; i < input.size(); i++) { ItemStack itemStack = input.getItem(i); if (!itemStack.isEmpty()) { - if (SHAPE_INGREDIENT.test(itemStack)) { - shape = (FireworkExplosion.Shape)SHAPE_BY_ITEM.get(itemStack.getItem()); + FireworkExplosion.Shape shape2 = (FireworkExplosion.Shape)SHAPE_BY_ITEM.get(itemStack.getItem()); + if (shape2 != null) { + shape = shape2; } else if (TWINKLE_INGREDIENT.test(itemStack)) { bl = true; } else if (TRAIL_INGREDIENT.test(itemStack)) { bl2 = true; - } else if (itemStack.getItem() instanceof DyeItem) { - intList.add(((DyeItem)itemStack.getItem()).getDyeColor().getFireworkColor()); + } else if (itemStack.getItem() instanceof DyeItem dyeItem) { + intList.add(dyeItem.getDyeColor().getFireworkColor()); } } } @@ -121,17 +122,7 @@ public class FireworkStarRecipe extends CustomRecipe { } @Override - public boolean canCraftInDimensions(int width, int height) { - return width * height >= 2; - } - - @Override - public ItemStack getResultItem(HolderLookup.Provider registries) { - return new ItemStack(Items.FIREWORK_STAR); - } - - @Override - public RecipeSerializer getSerializer() { + public RecipeSerializer getSerializer() { return RecipeSerializer.FIREWORK_STAR; } } diff --git a/net/minecraft/world/item/crafting/Ingredient.java b/net/minecraft/world/item/crafting/Ingredient.java index 03e4033d..caadb6fd 100644 --- a/net/minecraft/world/item/crafting/Ingredient.java +++ b/net/minecraft/world/item/crafting/Ingredient.java @@ -1,196 +1,115 @@ package net.minecraft.world.item.crafting; -import com.google.common.collect.Lists; -import com.mojang.datafixers.util.Either; +import com.google.common.collect.ImmutableList; import com.mojang.serialization.Codec; -import com.mojang.serialization.DataResult; -import com.mojang.serialization.codecs.RecordCodecBuilder; -import it.unimi.dsi.fastutil.ints.IntArrayList; -import it.unimi.dsi.fastutil.ints.IntComparators; -import it.unimi.dsi.fastutil.ints.IntList; import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; import java.util.List; +import java.util.Objects; +import java.util.Optional; import java.util.function.Predicate; import java.util.stream.Stream; import net.minecraft.core.Holder; -import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.core.HolderSet; import net.minecraft.core.registries.Registries; import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.codec.ByteBufCodecs; import net.minecraft.network.codec.StreamCodec; -import net.minecraft.tags.TagKey; -import net.minecraft.world.entity.player.StackedContents; +import net.minecraft.resources.HolderSetCodec; +import net.minecraft.util.ExtraCodecs; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.world.item.crafting.display.SlotDisplay; import net.minecraft.world.level.ItemLike; import org.jetbrains.annotations.Nullable; public final class Ingredient implements Predicate { - public static final Ingredient EMPTY = new Ingredient(Stream.empty()); - public static final StreamCodec CONTENTS_STREAM_CODEC = ItemStack.LIST_STREAM_CODEC - .map(list -> fromValues(list.stream().map(Ingredient.ItemValue::new)), ingredient -> Arrays.asList(ingredient.getItems())); - private final Ingredient.Value[] values; + public static final StreamCodec CONTENTS_STREAM_CODEC = ByteBufCodecs.holderSet(Registries.ITEM) + .map(Ingredient::new, ingredient -> ingredient.values); + public static final StreamCodec> OPTIONAL_CONTENTS_STREAM_CODEC = ByteBufCodecs.holderSet(Registries.ITEM) + .map( + holderSet -> holderSet.size() == 0 ? Optional.empty() : Optional.of(new Ingredient(holderSet)), + optional -> (HolderSet)optional.map(ingredient -> ingredient.values).orElse(HolderSet.direct()) + ); + public static final Codec> NON_AIR_HOLDER_SET_CODEC = HolderSetCodec.create(Registries.ITEM, Item.CODEC, false); + public static final Codec CODEC = ExtraCodecs.nonEmptyHolderSet(NON_AIR_HOLDER_SET_CODEC).xmap(Ingredient::new, ingredient -> ingredient.values); + private final HolderSet values; @Nullable - private ItemStack[] itemStacks; - @Nullable - private IntList stackingIds; - public static final Codec CODEC = codec(true); - public static final Codec CODEC_NONEMPTY = codec(false); + private List> items; - private Ingredient(Stream values) { - this.values = (Ingredient.Value[])values.toArray(Ingredient.Value[]::new); - } - - private Ingredient(Ingredient.Value[] values) { - this.values = values; - } - - public ItemStack[] getItems() { - if (this.itemStacks == null) { - this.itemStacks = (ItemStack[])Arrays.stream(this.values).flatMap(value -> value.getItems().stream()).distinct().toArray(ItemStack[]::new); - } - - return this.itemStacks; - } - - public boolean test(@Nullable ItemStack stack) { - if (stack == null) { - return false; - } else if (this.isEmpty()) { - return stack.isEmpty(); - } else { - for (ItemStack itemStack : this.getItems()) { - if (itemStack.is(stack.getItem())) { - return true; - } + private Ingredient(HolderSet holderSet) { + holderSet.unwrap().ifRight(list -> { + if (list.isEmpty()) { + throw new UnsupportedOperationException("Ingredients can't be empty"); + } else if (list.contains(Items.AIR.builtInRegistryHolder())) { + throw new UnsupportedOperationException("Ingredient can't contain air"); } - - return false; - } + }); + this.values = holderSet; } - public IntList getStackingIds() { - if (this.stackingIds == null) { - ItemStack[] itemStacks = this.getItems(); - this.stackingIds = new IntArrayList(itemStacks.length); + public static boolean testOptionalIngredient(Optional optional, ItemStack itemStack) { + return (Boolean)optional.map(ingredient -> ingredient.test(itemStack)).orElseGet(itemStack::isEmpty); + } - for (ItemStack itemStack : itemStacks) { - this.stackingIds.add(StackedContents.getStackingIndex(itemStack)); + public List> items() { + if (this.items == null) { + this.items = ImmutableList.copyOf(this.values); + } + + return this.items; + } + + public boolean test(ItemStack stack) { + List> list = this.items(); + + for (int i = 0; i < list.size(); i++) { + if (stack.is((Holder)list.get(i))) { + return true; } - - this.stackingIds.sort(IntComparators.NATURAL_COMPARATOR); } - return this.stackingIds; - } - - public boolean isEmpty() { - return this.values.length == 0; + return false; } public boolean equals(Object object) { - return object instanceof Ingredient ingredient ? Arrays.equals(this.values, ingredient.values) : false; + return object instanceof Ingredient ingredient ? Objects.equals(this.values, ingredient.values) : false; } - private static Ingredient fromValues(Stream stream) { - Ingredient ingredient = new Ingredient(stream); - return ingredient.isEmpty() ? EMPTY : ingredient; - } - - public static Ingredient of() { - return EMPTY; + public static Ingredient of(ItemLike itemLike) { + return new Ingredient(HolderSet.direct(itemLike.asItem().builtInRegistryHolder())); } public static Ingredient of(ItemLike... items) { - return of(Arrays.stream(items).map(ItemStack::new)); + return of(Arrays.stream(items)); } - public static Ingredient of(ItemStack... stacks) { - return of(Arrays.stream(stacks)); + public static Ingredient of(Stream stacks) { + return new Ingredient(HolderSet.direct(stacks.map(itemLike -> itemLike.asItem().builtInRegistryHolder()).toList())); } - public static Ingredient of(Stream stacks) { - return fromValues(stacks.filter(itemStack -> !itemStack.isEmpty()).map(Ingredient.ItemValue::new)); + public static Ingredient of(HolderSet holderSet) { + return new Ingredient(holderSet); } - public static Ingredient of(TagKey tag) { - return fromValues(Stream.of(new Ingredient.TagValue(tag))); + public SlotDisplay display() { + return this.values + .unwrap() + .map(SlotDisplay.TagSlotDisplay::new, list -> new SlotDisplay.Composite(list.stream().map(Ingredient::displayForSingleItem).toList())); } - private static Codec codec(boolean allowEmpty) { - Codec codec = Codec.list(Ingredient.Value.CODEC) - .comapFlatMap( - list -> !allowEmpty && list.size() < 1 - ? DataResult.error(() -> "Item array cannot be empty, at least one item must be defined") - : DataResult.success((Ingredient.Value[])list.toArray(new Ingredient.Value[0])), - List::of - ); - return Codec.either(codec, Ingredient.Value.CODEC) - .flatComapMap( - either -> either.map(Ingredient::new, value -> new Ingredient(new Ingredient.Value[]{value})), - ingredient -> { - if (ingredient.values.length == 1) { - return DataResult.success(Either.right(ingredient.values[0])); - } else { - return ingredient.values.length == 0 && !allowEmpty - ? DataResult.error(() -> "Item array cannot be empty, at least one item must be defined") - : DataResult.success(Either.left(ingredient.values)); - } - } - ); + public static SlotDisplay optionalIngredientToDisplay(Optional optional) { + return (SlotDisplay)optional.map(Ingredient::display).orElse(SlotDisplay.Empty.INSTANCE); } - record ItemValue(ItemStack item) implements Ingredient.Value { - static final Codec CODEC = RecordCodecBuilder.create( - instance -> instance.group(ItemStack.SIMPLE_ITEM_CODEC.fieldOf("item").forGetter(itemValue -> itemValue.item)).apply(instance, Ingredient.ItemValue::new) - ); - - public boolean equals(Object object) { - return !(object instanceof Ingredient.ItemValue itemValue) - ? false - : itemValue.item.getItem().equals(this.item.getItem()) && itemValue.item.getCount() == this.item.getCount(); + private static SlotDisplay displayForSingleItem(Holder holder) { + SlotDisplay slotDisplay = new SlotDisplay.ItemSlotDisplay(holder); + ItemStack itemStack = holder.value().getCraftingRemainder(); + if (!itemStack.isEmpty()) { + SlotDisplay slotDisplay2 = new SlotDisplay.ItemStackSlotDisplay(itemStack); + return new SlotDisplay.WithRemainder(slotDisplay, slotDisplay2); + } else { + return slotDisplay; } - - @Override - public Collection getItems() { - return Collections.singleton(this.item); - } - } - - record TagValue(TagKey tag) implements Ingredient.Value { - static final Codec CODEC = RecordCodecBuilder.create( - instance -> instance.group(TagKey.codec(Registries.ITEM).fieldOf("tag").forGetter(tagValue -> tagValue.tag)).apply(instance, Ingredient.TagValue::new) - ); - - public boolean equals(Object object) { - return object instanceof Ingredient.TagValue tagValue ? tagValue.tag.location().equals(this.tag.location()) : false; - } - - @Override - public Collection getItems() { - List list = Lists.newArrayList(); - - for (Holder holder : BuiltInRegistries.ITEM.getTagOrEmpty(this.tag)) { - list.add(new ItemStack(holder)); - } - - return list; - } - } - - interface Value { - Codec CODEC = Codec.xor(Ingredient.ItemValue.CODEC, Ingredient.TagValue.CODEC) - .xmap(either -> either.map(itemValue -> itemValue, tagValue -> tagValue), value -> { - if (value instanceof Ingredient.TagValue tagValue) { - return Either.right(tagValue); - } else if (value instanceof Ingredient.ItemValue itemValue) { - return Either.left(itemValue); - } else { - throw new UnsupportedOperationException("This is neither an item value nor a tag value."); - } - }); - - Collection getItems(); } } diff --git a/net/minecraft/world/item/crafting/MapCloningRecipe.java b/net/minecraft/world/item/crafting/MapCloningRecipe.java index 0cb03baf..b99ad54b 100644 --- a/net/minecraft/world/item/crafting/MapCloningRecipe.java +++ b/net/minecraft/world/item/crafting/MapCloningRecipe.java @@ -1,6 +1,7 @@ package net.minecraft.world.item.crafting; import net.minecraft.core.HolderLookup; +import net.minecraft.core.component.DataComponents; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.level.Level; @@ -11,29 +12,33 @@ public class MapCloningRecipe extends CustomRecipe { } public boolean matches(CraftingInput input, Level level) { - int i = 0; - ItemStack itemStack = ItemStack.EMPTY; + if (input.ingredientCount() < 2) { + return false; + } else { + boolean bl = false; + boolean bl2 = false; - for (int j = 0; j < input.size(); j++) { - ItemStack itemStack2 = input.getItem(j); - if (!itemStack2.isEmpty()) { - if (itemStack2.is(Items.FILLED_MAP)) { - if (!itemStack.isEmpty()) { - return false; + for (int i = 0; i < input.size(); i++) { + ItemStack itemStack = input.getItem(i); + if (!itemStack.isEmpty()) { + if (itemStack.has(DataComponents.MAP_ID)) { + if (bl2) { + return false; + } + + bl2 = true; + } else { + if (!itemStack.is(Items.MAP)) { + return false; + } + + bl = true; } - - itemStack = itemStack2; - } else { - if (!itemStack2.is(Items.MAP)) { - return false; - } - - i++; } } - } - return !itemStack.isEmpty() && i > 0; + return bl2 && bl; + } } public ItemStack assemble(CraftingInput input, HolderLookup.Provider registries) { @@ -43,7 +48,7 @@ public class MapCloningRecipe extends CustomRecipe { for (int j = 0; j < input.size(); j++) { ItemStack itemStack2 = input.getItem(j); if (!itemStack2.isEmpty()) { - if (itemStack2.is(Items.FILLED_MAP)) { + if (itemStack2.has(DataComponents.MAP_ID)) { if (!itemStack.isEmpty()) { return ItemStack.EMPTY; } @@ -63,12 +68,7 @@ public class MapCloningRecipe extends CustomRecipe { } @Override - public boolean canCraftInDimensions(int width, int height) { - return width >= 3 && height >= 3; - } - - @Override - public RecipeSerializer getSerializer() { + public RecipeSerializer getSerializer() { return RecipeSerializer.MAP_CLONING; } } diff --git a/net/minecraft/world/item/crafting/MapExtendingRecipe.java b/net/minecraft/world/item/crafting/MapExtendingRecipe.java index bcd9cd24..4defe6c6 100644 --- a/net/minecraft/world/item/crafting/MapExtendingRecipe.java +++ b/net/minecraft/world/item/crafting/MapExtendingRecipe.java @@ -49,7 +49,7 @@ public class MapExtendingRecipe extends ShapedRecipe { private static ItemStack findFilledMap(CraftingInput input) { for (int i = 0; i < input.size(); i++) { ItemStack itemStack = input.getItem(i); - if (itemStack.is(Items.FILLED_MAP)) { + if (itemStack.has(DataComponents.MAP_ID)) { return itemStack; } } @@ -63,7 +63,7 @@ public class MapExtendingRecipe extends ShapedRecipe { } @Override - public RecipeSerializer getSerializer() { + public RecipeSerializer getSerializer() { return RecipeSerializer.MAP_EXTENDING; } } diff --git a/net/minecraft/world/item/crafting/PlacementInfo.java b/net/minecraft/world/item/crafting/PlacementInfo.java new file mode 100644 index 00000000..0ae5e17d --- /dev/null +++ b/net/minecraft/world/item/crafting/PlacementInfo.java @@ -0,0 +1,98 @@ +package net.minecraft.world.item.crafting; + +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; +import net.minecraft.core.Holder; +import net.minecraft.world.entity.player.StackedContents; +import net.minecraft.world.entity.player.StackedItemContents; +import net.minecraft.world.item.Item; + +public class PlacementInfo { + public static final PlacementInfo NOT_PLACEABLE = new PlacementInfo(List.of(), List.of(), List.of()); + private final List ingredients; + private final List>> unpackedIngredients; + private final List> slotInfo; + + private PlacementInfo(List list, List>> list2, List> list3) { + this.ingredients = list; + this.unpackedIngredients = list2; + this.slotInfo = list3; + } + + public static StackedContents.IngredientInfo> ingredientToContents(Ingredient ingredient) { + return StackedItemContents.convertIngredientContents(ingredient.items().stream()); + } + + public static PlacementInfo create(Ingredient ingredient) { + if (ingredient.items().isEmpty()) { + return NOT_PLACEABLE; + } else { + StackedContents.IngredientInfo> ingredientInfo = ingredientToContents(ingredient); + PlacementInfo.SlotInfo slotInfo = new PlacementInfo.SlotInfo(0); + return new PlacementInfo(List.of(ingredient), List.of(ingredientInfo), List.of(Optional.of(slotInfo))); + } + } + + public static PlacementInfo createFromOptionals(List> list) { + int i = list.size(); + List list2 = new ArrayList(i); + List>> list3 = new ArrayList(i); + List> list4 = new ArrayList(i); + int j = 0; + + for (Optional optional : list) { + if (optional.isPresent()) { + Ingredient ingredient = (Ingredient)optional.get(); + if (ingredient.items().isEmpty()) { + return NOT_PLACEABLE; + } + + list2.add(ingredient); + list3.add(ingredientToContents(ingredient)); + list4.add(Optional.of(new PlacementInfo.SlotInfo(j++))); + } else { + list4.add(Optional.empty()); + } + } + + return new PlacementInfo(list2, list3, list4); + } + + public static PlacementInfo create(List list) { + int i = list.size(); + List>> list2 = new ArrayList(i); + List> list3 = new ArrayList(i); + + for (int j = 0; j < i; j++) { + Ingredient ingredient = (Ingredient)list.get(j); + if (ingredient.items().isEmpty()) { + return NOT_PLACEABLE; + } + + list2.add(ingredientToContents(ingredient)); + list3.add(Optional.of(new PlacementInfo.SlotInfo(j))); + } + + return new PlacementInfo(list, list2, list3); + } + + public List> slotInfo() { + return this.slotInfo; + } + + public List ingredients() { + return this.ingredients; + } + + public List>> unpackedIngredients() { + return this.unpackedIngredients; + } + + public boolean isImpossibleToPlace() { + return this.slotInfo.isEmpty(); + } + + public record SlotInfo(int placerOutputPosition) { + } +} diff --git a/net/minecraft/world/item/crafting/Recipe.java b/net/minecraft/world/item/crafting/Recipe.java index aa8b8f5c..2e5a5f42 100644 --- a/net/minecraft/world/item/crafting/Recipe.java +++ b/net/minecraft/world/item/crafting/Recipe.java @@ -1,17 +1,16 @@ package net.minecraft.world.item.crafting; import com.mojang.serialization.Codec; +import java.util.List; import net.minecraft.core.HolderLookup; -import net.minecraft.core.NonNullList; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.core.registries.Registries; import net.minecraft.network.RegistryFriendlyByteBuf; import net.minecraft.network.codec.ByteBufCodecs; import net.minecraft.network.codec.StreamCodec; -import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.display.RecipeDisplay; import net.minecraft.world.level.Level; -import net.minecraft.world.level.block.Blocks; public interface Recipe { Codec> CODEC = BuiltInRegistries.RECIPE_SERIALIZER.byNameCodec().dispatch(Recipe::getSerializer, RecipeSerializer::codec); @@ -22,30 +21,6 @@ public interface Recipe { ItemStack assemble(T input, HolderLookup.Provider registries); - /** - * Used to determine if this recipe can fit in a grid of the given width/height - */ - boolean canCraftInDimensions(int width, int height); - - ItemStack getResultItem(HolderLookup.Provider registries); - - default NonNullList getRemainingItems(T input) { - NonNullList nonNullList = NonNullList.withSize(input.size(), ItemStack.EMPTY); - - for (int i = 0; i < nonNullList.size(); i++) { - Item item = input.getItem(i).getItem(); - if (item.hasCraftingRemainingItem()) { - nonNullList.set(i, new ItemStack(item.getCraftingRemainingItem())); - } - } - - return nonNullList; - } - - default NonNullList getIngredients() { - return NonNullList.create(); - } - /** * If true, this recipe does not appear in the recipe book and does not respect recipe unlocking (and the doLimitedCrafting gamerule) */ @@ -57,23 +32,19 @@ public interface Recipe { return true; } - /** - * Recipes with equal group are combined into one button in the recipe book - */ - default String getGroup() { + default String group() { return ""; } - default ItemStack getToastSymbol() { - return new ItemStack(Blocks.CRAFTING_TABLE); + RecipeSerializer> getSerializer(); + + RecipeType> getType(); + + PlacementInfo placementInfo(); + + default List display() { + return List.of(); } - RecipeSerializer getSerializer(); - - RecipeType getType(); - - default boolean isIncomplete() { - NonNullList nonNullList = this.getIngredients(); - return nonNullList.isEmpty() || nonNullList.stream().anyMatch(ingredient -> ingredient.getItems().length == 0); - } + RecipeBookCategory recipeBookCategory(); } diff --git a/net/minecraft/world/item/crafting/RecipeAccess.java b/net/minecraft/world/item/crafting/RecipeAccess.java new file mode 100644 index 00000000..6ad48366 --- /dev/null +++ b/net/minecraft/world/item/crafting/RecipeAccess.java @@ -0,0 +1,9 @@ +package net.minecraft.world.item.crafting; + +import net.minecraft.resources.ResourceKey; + +public interface RecipeAccess { + RecipePropertySet propertySet(ResourceKey resourceKey); + + SelectableRecipe.SingleInputSet stonecutterRecipes(); +} diff --git a/net/minecraft/world/item/crafting/RecipeBookCategories.java b/net/minecraft/world/item/crafting/RecipeBookCategories.java new file mode 100644 index 00000000..2954b7b1 --- /dev/null +++ b/net/minecraft/world/item/crafting/RecipeBookCategories.java @@ -0,0 +1,28 @@ +package net.minecraft.world.item.crafting; + +import net.minecraft.core.Registry; +import net.minecraft.core.registries.BuiltInRegistries; + +public class RecipeBookCategories { + public static final RecipeBookCategory CRAFTING_BUILDING_BLOCKS = register("crafting_building_blocks"); + public static final RecipeBookCategory CRAFTING_REDSTONE = register("crafting_redstone"); + public static final RecipeBookCategory CRAFTING_EQUIPMENT = register("crafting_equipment"); + public static final RecipeBookCategory CRAFTING_MISC = register("crafting_misc"); + public static final RecipeBookCategory FURNACE_FOOD = register("furnace_food"); + public static final RecipeBookCategory FURNACE_BLOCKS = register("furnace_blocks"); + public static final RecipeBookCategory FURNACE_MISC = register("furnace_misc"); + public static final RecipeBookCategory BLAST_FURNACE_BLOCKS = register("blast_furnace_blocks"); + public static final RecipeBookCategory BLAST_FURNACE_MISC = register("blast_furnace_misc"); + public static final RecipeBookCategory SMOKER_FOOD = register("smoker_food"); + public static final RecipeBookCategory STONECUTTER = register("stonecutter"); + public static final RecipeBookCategory SMITHING = register("smithing"); + public static final RecipeBookCategory CAMPFIRE = register("campfire"); + + private static RecipeBookCategory register(String string) { + return Registry.register(BuiltInRegistries.RECIPE_BOOK_CATEGORY, string, new RecipeBookCategory()); + } + + public static RecipeBookCategory bootstrap(Registry registry) { + return CAMPFIRE; + } +} diff --git a/net/minecraft/world/item/crafting/RecipeBookCategory.java b/net/minecraft/world/item/crafting/RecipeBookCategory.java new file mode 100644 index 00000000..56ef492c --- /dev/null +++ b/net/minecraft/world/item/crafting/RecipeBookCategory.java @@ -0,0 +1,4 @@ +package net.minecraft.world.item.crafting; + +public class RecipeBookCategory implements ExtendedRecipeBookCategory { +} diff --git a/net/minecraft/world/item/crafting/RecipeCache.java b/net/minecraft/world/item/crafting/RecipeCache.java index 3e50993e..24ba5e20 100644 --- a/net/minecraft/world/item/crafting/RecipeCache.java +++ b/net/minecraft/world/item/crafting/RecipeCache.java @@ -4,8 +4,8 @@ import java.lang.ref.WeakReference; import java.util.Arrays; import java.util.Optional; import net.minecraft.core.NonNullList; +import net.minecraft.server.level.ServerLevel; import net.minecraft.world.item.ItemStack; -import net.minecraft.world.level.Level; import org.jetbrains.annotations.Nullable; public class RecipeCache { @@ -16,35 +16,35 @@ public class RecipeCache { this.entries = new RecipeCache.Entry[size]; } - public Optional> get(Level level, CraftingInput input) { - if (input.isEmpty()) { + public Optional> get(ServerLevel serverLevel, CraftingInput craftingInput) { + if (craftingInput.isEmpty()) { return Optional.empty(); } else { - this.validateRecipeManager(level); + this.validateRecipeManager(serverLevel); for (int i = 0; i < this.entries.length; i++) { RecipeCache.Entry entry = this.entries[i]; - if (entry != null && entry.matches(input)) { + if (entry != null && entry.matches(craftingInput)) { this.moveEntryToFront(i); return Optional.ofNullable(entry.value()); } } - return this.compute(input, level); + return this.compute(craftingInput, serverLevel); } } - private void validateRecipeManager(Level level) { - RecipeManager recipeManager = level.getRecipeManager(); + private void validateRecipeManager(ServerLevel serverLevel) { + RecipeManager recipeManager = serverLevel.recipeAccess(); if (recipeManager != this.cachedRecipeManager.get()) { this.cachedRecipeManager = new WeakReference(recipeManager); Arrays.fill(this.entries, null); } } - private Optional> compute(CraftingInput input, Level level) { - Optional> optional = level.getRecipeManager().getRecipeFor(RecipeType.CRAFTING, input, level); - this.insert(input, (RecipeHolder)optional.orElse(null)); + private Optional> compute(CraftingInput craftingInput, ServerLevel serverLevel) { + Optional> optional = serverLevel.recipeAccess().getRecipeFor(RecipeType.CRAFTING, craftingInput, serverLevel); + this.insert(craftingInput, (RecipeHolder)optional.orElse(null)); return optional; } diff --git a/net/minecraft/world/item/crafting/RecipeHolder.java b/net/minecraft/world/item/crafting/RecipeHolder.java index 516551a8..340f8557 100644 --- a/net/minecraft/world/item/crafting/RecipeHolder.java +++ b/net/minecraft/world/item/crafting/RecipeHolder.java @@ -1,16 +1,17 @@ package net.minecraft.world.item.crafting; +import net.minecraft.core.registries.Registries; import net.minecraft.network.RegistryFriendlyByteBuf; import net.minecraft.network.codec.StreamCodec; -import net.minecraft.resources.ResourceLocation; +import net.minecraft.resources.ResourceKey; -public record RecipeHolder>(ResourceLocation id, T value) { +public record RecipeHolder>(ResourceKey> id, T value) { public static final StreamCodec> STREAM_CODEC = StreamCodec.composite( - ResourceLocation.STREAM_CODEC, RecipeHolder::id, Recipe.STREAM_CODEC, RecipeHolder::value, RecipeHolder::new + ResourceKey.streamCodec(Registries.RECIPE), RecipeHolder::id, Recipe.STREAM_CODEC, RecipeHolder::value, RecipeHolder::new ); public boolean equals(Object object) { - return this == object ? true : object instanceof RecipeHolder recipeHolder && this.id.equals(recipeHolder.id); + return this == object ? true : object instanceof RecipeHolder recipeHolder && this.id == recipeHolder.id; } public int hashCode() { diff --git a/net/minecraft/world/item/crafting/RecipeManager.java b/net/minecraft/world/item/crafting/RecipeManager.java index e9e1d5fe..f959be6e 100644 --- a/net/minecraft/world/item/crafting/RecipeManager.java +++ b/net/minecraft/world/item/crafting/RecipeManager.java @@ -1,185 +1,210 @@ package net.minecraft.world.item.crafting; import com.google.common.annotations.VisibleForTesting; -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.ImmutableMultimap; -import com.google.common.collect.Multimap; -import com.google.common.collect.ImmutableMultimap.Builder; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonParseException; import com.mojang.logging.LogUtils; import com.mojang.serialization.JsonOps; +import it.unimi.dsi.fastutil.objects.Object2IntMap; +import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; +import java.util.ArrayList; import java.util.Collection; -import java.util.Comparator; +import java.util.IdentityHashMap; import java.util.List; import java.util.Map; import java.util.Optional; -import java.util.Map.Entry; +import java.util.OptionalInt; +import java.util.SortedMap; +import java.util.TreeMap; +import java.util.function.Consumer; import java.util.stream.Collectors; -import java.util.stream.Stream; import net.minecraft.core.HolderLookup; -import net.minecraft.core.NonNullList; import net.minecraft.core.registries.Registries; -import net.minecraft.resources.RegistryOps; +import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.level.ServerLevel; import net.minecraft.server.packs.resources.ResourceManager; import net.minecraft.server.packs.resources.SimpleJsonResourceReloadListener; +import net.minecraft.server.packs.resources.SimplePreparableReloadListener; import net.minecraft.util.profiling.ProfilerFiller; -import net.minecraft.world.item.ItemStack; +import net.minecraft.world.flag.FeatureFlagSet; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.crafting.display.RecipeDisplay; +import net.minecraft.world.item.crafting.display.RecipeDisplayEntry; +import net.minecraft.world.item.crafting.display.RecipeDisplayId; import net.minecraft.world.level.Level; import org.jetbrains.annotations.Nullable; import org.slf4j.Logger; -public class RecipeManager extends SimpleJsonResourceReloadListener { - private static final Gson GSON = new GsonBuilder().setPrettyPrinting().disableHtmlEscaping().create(); +public class RecipeManager extends SimplePreparableReloadListener implements RecipeAccess { private static final Logger LOGGER = LogUtils.getLogger(); + private static final Map, RecipeManager.IngredientExtractor> RECIPE_PROPERTY_SETS = Map.of( + RecipePropertySet.SMITHING_ADDITION, + (RecipeManager.IngredientExtractor)recipe -> recipe instanceof SmithingRecipe smithingRecipe ? smithingRecipe.additionIngredient() : Optional.empty(), + RecipePropertySet.SMITHING_BASE, + (RecipeManager.IngredientExtractor)recipe -> recipe instanceof SmithingRecipe smithingRecipe ? smithingRecipe.baseIngredient() : Optional.empty(), + RecipePropertySet.SMITHING_TEMPLATE, + (RecipeManager.IngredientExtractor)recipe -> recipe instanceof SmithingRecipe smithingRecipe ? smithingRecipe.templateIngredient() : Optional.empty(), + RecipePropertySet.FURNACE_INPUT, + forSingleInput(RecipeType.SMELTING), + RecipePropertySet.BLAST_FURNACE_INPUT, + forSingleInput(RecipeType.BLASTING), + RecipePropertySet.SMOKER_INPUT, + forSingleInput(RecipeType.SMOKING), + RecipePropertySet.CAMPFIRE_INPUT, + forSingleInput(RecipeType.CAMPFIRE_COOKING) + ); private final HolderLookup.Provider registries; - private Multimap, RecipeHolder> byType = ImmutableMultimap.of(); - private Map> byName = ImmutableMap.of(); - private boolean hasErrors; + private RecipeMap recipes = RecipeMap.EMPTY; + private Map, RecipePropertySet> propertySets = Map.of(); + private SelectableRecipe.SingleInputSet stonecutterRecipes = SelectableRecipe.SingleInputSet.empty(); + private List allDisplays = List.of(); + private Map>, List> recipeToDisplay = Map.of(); public RecipeManager(HolderLookup.Provider registries) { - super(GSON, Registries.elementsDirPath(Registries.RECIPE)); this.registries = registries; } - protected void apply(Map object, ResourceManager resourceManager, ProfilerFiller profiler) { - this.hasErrors = false; - Builder, RecipeHolder> builder = ImmutableMultimap.builder(); - com.google.common.collect.ImmutableMap.Builder> builder2 = ImmutableMap.builder(); - RegistryOps registryOps = this.registries.createSerializationContext(JsonOps.INSTANCE); - - for (Entry entry : object.entrySet()) { - ResourceLocation resourceLocation = (ResourceLocation)entry.getKey(); - - try { - Recipe recipe = Recipe.CODEC.parse(registryOps, (JsonElement)entry.getValue()).getOrThrow(JsonParseException::new); - RecipeHolder recipeHolder = new RecipeHolder<>(resourceLocation, recipe); - builder.put(recipe.getType(), recipeHolder); - builder2.put(resourceLocation, recipeHolder); - } catch (IllegalArgumentException | JsonParseException var12) { - LOGGER.error("Parsing error loading recipe {}", resourceLocation, var12); - } - } - - this.byType = builder.build(); - this.byName = builder2.build(); - LOGGER.info("Loaded {} recipes", this.byType.size()); + protected RecipeMap prepare(ResourceManager resourceManager, ProfilerFiller profilerFiller) { + SortedMap> sortedMap = new TreeMap(); + SimpleJsonResourceReloadListener.scanDirectory( + resourceManager, Registries.elementsDirPath(Registries.RECIPE), this.registries.createSerializationContext(JsonOps.INSTANCE), Recipe.CODEC, sortedMap + ); + List> list = new ArrayList(sortedMap.size()); + sortedMap.forEach((resourceLocation, recipe) -> { + ResourceKey> resourceKey = ResourceKey.create(Registries.RECIPE, resourceLocation); + RecipeHolder recipeHolder = new RecipeHolder(resourceKey, recipe); + list.add(recipeHolder); + }); + return RecipeMap.create(list); } - public boolean hadErrorsLoading() { - return this.hasErrors; + protected void apply(RecipeMap recipeMap, ResourceManager resourceManager, ProfilerFiller profilerFiller) { + this.recipes = recipeMap; + LOGGER.info("Loaded {} recipes", recipeMap.values().size()); } - public > Optional> getRecipeFor(RecipeType recipeType, I input, Level level) { - return this.getRecipeFor(recipeType, input, level, (RecipeHolder)null); + public void finalizeRecipeLoading(FeatureFlagSet featureFlagSet) { + List> list = new ArrayList(); + List list2 = RECIPE_PROPERTY_SETS.entrySet() + .stream() + .map(entry -> new RecipeManager.IngredientCollector((ResourceKey)entry.getKey(), (RecipeManager.IngredientExtractor)entry.getValue())) + .toList(); + this.recipes + .values() + .forEach( + recipeHolder -> { + Recipe recipe = recipeHolder.value(); + if (!recipe.isSpecial() && recipe.placementInfo().isImpossibleToPlace()) { + LOGGER.warn("Recipe {} can't be placed due to empty ingredients and will be ignored", recipeHolder.id().location()); + } else { + list2.forEach(ingredientCollector -> ingredientCollector.accept(recipe)); + if (recipe instanceof StonecutterRecipe stonecutterRecipe + && isIngredientEnabled(featureFlagSet, stonecutterRecipe.input()) + && stonecutterRecipe.resultDisplay().isEnabled(featureFlagSet)) { + list.add( + new SelectableRecipe.SingleInputEntry(stonecutterRecipe.input(), new SelectableRecipe(stonecutterRecipe.resultDisplay(), Optional.of(recipeHolder))) + ); + } + } + } + ); + this.propertySets = (Map, RecipePropertySet>)list2.stream() + .collect( + Collectors.toUnmodifiableMap(ingredientCollector -> ingredientCollector.key, ingredientCollector -> ingredientCollector.asPropertySet(featureFlagSet)) + ); + this.stonecutterRecipes = new SelectableRecipe.SingleInputSet<>(list); + this.allDisplays = unpackRecipeInfo(this.recipes.values(), featureFlagSet); + this.recipeToDisplay = (Map>, List>)this.allDisplays + .stream() + .collect(Collectors.groupingBy(serverDisplayInfo -> serverDisplayInfo.parent.id(), IdentityHashMap::new, Collectors.toList())); + } + + static List filterDisabled(FeatureFlagSet featureFlagSet, List list) { + list.removeIf(ingredient -> !isIngredientEnabled(featureFlagSet, ingredient)); + return list; + } + + private static boolean isIngredientEnabled(FeatureFlagSet featureFlagSet, Ingredient ingredient) { + return ingredient.items().stream().allMatch(holder -> ((Item)holder.value()).isEnabled(featureFlagSet)); } public > Optional> getRecipeFor( - RecipeType recipeType, I input, Level level, @Nullable ResourceLocation lastRecipe + RecipeType recipeType, I recipeInput, Level level, @Nullable ResourceKey> resourceKey ) { - RecipeHolder recipeHolder = lastRecipe != null ? this.byKeyTyped(recipeType, lastRecipe) : null; - return this.getRecipeFor(recipeType, input, level, recipeHolder); + RecipeHolder recipeHolder = resourceKey != null ? this.byKeyTyped(recipeType, resourceKey) : null; + return this.getRecipeFor(recipeType, recipeInput, level, recipeHolder); } public > Optional> getRecipeFor( RecipeType recipeType, I input, Level level, @Nullable RecipeHolder lastRecipe ) { - if (input.isEmpty()) { - return Optional.empty(); - } else { - return lastRecipe != null && lastRecipe.value().matches(input, level) - ? Optional.of(lastRecipe) - : this.byType(recipeType).stream().filter(recipeHolder -> recipeHolder.value().matches(input, level)).findFirst(); - } + return lastRecipe != null && lastRecipe.value().matches(input, level) ? Optional.of(lastRecipe) : this.getRecipeFor(recipeType, input, level); } - public > List> getAllRecipesFor(RecipeType recipeType) { - return List.copyOf(this.byType(recipeType)); + public > Optional> getRecipeFor(RecipeType recipeType, I input, Level level) { + return this.recipes.getRecipesFor(recipeType, input, level).findFirst(); } - public > List> getRecipesFor(RecipeType recipeType, I input, Level level) { - return (List>)this.byType(recipeType) - .stream() - .filter(recipeHolder -> recipeHolder.value().matches(input, level)) - .sorted(Comparator.comparing(recipeHolder -> recipeHolder.value().getResultItem(level.registryAccess()).getDescriptionId())) - .collect(Collectors.toList()); - } - - private > Collection> byType(RecipeType type) { - return (Collection>)this.byType.get(type); - } - - public > NonNullList getRemainingItemsFor(RecipeType recipeType, I input, Level lvel) { - Optional> optional = this.getRecipeFor(recipeType, input, lvel); - if (optional.isPresent()) { - return ((RecipeHolder)optional.get()).value().getRemainingItems(input); - } else { - NonNullList nonNullList = NonNullList.withSize(input.size(), ItemStack.EMPTY); - - for (int i = 0; i < nonNullList.size(); i++) { - nonNullList.set(i, input.getItem(i)); - } - - return nonNullList; - } - } - - public Optional> byKey(ResourceLocation recipeId) { - return Optional.ofNullable((RecipeHolder)this.byName.get(recipeId)); + public Optional> byKey(ResourceKey> resourceKey) { + return Optional.ofNullable(this.recipes.byKey(resourceKey)); } @Nullable - private > RecipeHolder byKeyTyped(RecipeType type, ResourceLocation name) { - RecipeHolder recipeHolder = (RecipeHolder)this.byName.get(name); - return (RecipeHolder)(recipeHolder != null && recipeHolder.value().getType().equals(type) ? recipeHolder : null); + private > RecipeHolder byKeyTyped(RecipeType recipeType, ResourceKey> resourceKey) { + RecipeHolder recipeHolder = this.recipes.byKey(resourceKey); + return (RecipeHolder)(recipeHolder != null && recipeHolder.value().getType().equals(recipeType) ? recipeHolder : null); } - public Collection> getOrderedRecipes() { - return this.byType.values(); + public Map, RecipePropertySet> getSynchronizedItemProperties() { + return this.propertySets; + } + + public SelectableRecipe.SingleInputSet getSynchronizedStonecutterRecipes() { + return this.stonecutterRecipes; + } + + @Override + public RecipePropertySet propertySet(ResourceKey resourceKey) { + return (RecipePropertySet)this.propertySets.getOrDefault(resourceKey, RecipePropertySet.EMPTY); + } + + @Override + public SelectableRecipe.SingleInputSet stonecutterRecipes() { + return this.stonecutterRecipes; } public Collection> getRecipes() { - return this.byName.values(); + return this.recipes.values(); } - public Stream getRecipeIds() { - return this.byName.keySet().stream(); + @Nullable + public RecipeManager.ServerDisplayInfo getRecipeFromDisplay(RecipeDisplayId recipeDisplayId) { + return (RecipeManager.ServerDisplayInfo)this.allDisplays.get(recipeDisplayId.index()); + } + + public void listDisplaysForRecipe(ResourceKey> resourceKey, Consumer consumer) { + List list = (List)this.recipeToDisplay.get(resourceKey); + if (list != null) { + list.forEach(serverDisplayInfo -> consumer.accept(serverDisplayInfo.display)); + } } @VisibleForTesting - protected static RecipeHolder fromJson(ResourceLocation recipeId, JsonObject json, HolderLookup.Provider registries) { - Recipe recipe = Recipe.CODEC.parse(registries.createSerializationContext(JsonOps.INSTANCE), json).getOrThrow(JsonParseException::new); - return new RecipeHolder<>(recipeId, recipe); - } - - public void replaceRecipes(Iterable> recipes) { - this.hasErrors = false; - Builder, RecipeHolder> builder = ImmutableMultimap.builder(); - com.google.common.collect.ImmutableMap.Builder> builder2 = ImmutableMap.builder(); - - for (RecipeHolder recipeHolder : recipes) { - RecipeType recipeType = recipeHolder.value().getType(); - builder.put(recipeType, recipeHolder); - builder2.put(recipeHolder.id(), recipeHolder); - } - - this.byType = builder.build(); - this.byName = builder2.build(); + protected static RecipeHolder fromJson(ResourceKey> resourceKey, JsonObject jsonObject, HolderLookup.Provider provider) { + Recipe recipe = Recipe.CODEC.parse(provider.createSerializationContext(JsonOps.INSTANCE), jsonObject).getOrThrow(JsonParseException::new); + return new RecipeHolder<>(resourceKey, recipe); } public static > RecipeManager.CachedCheck createCheck(RecipeType recipeType) { return new RecipeManager.CachedCheck() { @Nullable - private ResourceLocation lastRecipe; + private ResourceKey> lastRecipe; @Override - public Optional> getRecipeFor(I input, Level level) { - RecipeManager recipeManager = level.getRecipeManager(); - Optional> optional = recipeManager.getRecipeFor(recipeType, input, level, this.lastRecipe); + public Optional> getRecipeFor(I recipeInput, ServerLevel serverLevel) { + RecipeManager recipeManager = serverLevel.recipeAccess(); + Optional> optional = recipeManager.getRecipeFor(recipeType, recipeInput, serverLevel, this.lastRecipe); if (optional.isPresent()) { RecipeHolder recipeHolder = (RecipeHolder)optional.get(); this.lastRecipe = recipeHolder.id(); @@ -191,7 +216,73 @@ public class RecipeManager extends SimpleJsonResourceReloadListener { }; } + private static List unpackRecipeInfo(Iterable> iterable, FeatureFlagSet featureFlagSet) { + List list = new ArrayList(); + Object2IntMap object2IntMap = new Object2IntOpenHashMap<>(); + + for (RecipeHolder recipeHolder : iterable) { + Recipe recipe = recipeHolder.value(); + OptionalInt optionalInt; + if (recipe.group().isEmpty()) { + optionalInt = OptionalInt.empty(); + } else { + optionalInt = OptionalInt.of(object2IntMap.computeIfAbsent(recipe.group(), object -> object2IntMap.size())); + } + + Optional> optional; + if (recipe.isSpecial()) { + optional = Optional.empty(); + } else { + optional = Optional.of(recipe.placementInfo().ingredients()); + } + + for (RecipeDisplay recipeDisplay : recipe.display()) { + if (recipeDisplay.isEnabled(featureFlagSet)) { + int i = list.size(); + RecipeDisplayId recipeDisplayId = new RecipeDisplayId(i); + RecipeDisplayEntry recipeDisplayEntry = new RecipeDisplayEntry(recipeDisplayId, recipeDisplay, optionalInt, recipe.recipeBookCategory(), optional); + list.add(new RecipeManager.ServerDisplayInfo(recipeDisplayEntry, recipeHolder)); + } + } + } + + return list; + } + + private static RecipeManager.IngredientExtractor forSingleInput(RecipeType recipeType) { + return recipe -> recipe.getType() == recipeType && recipe instanceof SingleItemRecipe singleItemRecipe + ? Optional.of(singleItemRecipe.input()) + : Optional.empty(); + } + public interface CachedCheck> { - Optional> getRecipeFor(I input, Level level); + Optional> getRecipeFor(I recipeInput, ServerLevel serverLevel); + } + + public static class IngredientCollector implements Consumer> { + final ResourceKey key; + private final RecipeManager.IngredientExtractor extractor; + private final List ingredients = new ArrayList(); + + protected IngredientCollector(ResourceKey resourceKey, RecipeManager.IngredientExtractor ingredientExtractor) { + this.key = resourceKey; + this.extractor = ingredientExtractor; + } + + public void accept(Recipe recipe) { + this.extractor.apply(recipe).ifPresent(this.ingredients::add); + } + + public RecipePropertySet asPropertySet(FeatureFlagSet featureFlagSet) { + return RecipePropertySet.create(RecipeManager.filterDisabled(featureFlagSet, this.ingredients)); + } + } + + @FunctionalInterface + public interface IngredientExtractor { + Optional apply(Recipe recipe); + } + + public record ServerDisplayInfo(RecipeDisplayEntry display, RecipeHolder parent) { } } diff --git a/net/minecraft/world/item/crafting/RecipeMap.java b/net/minecraft/world/item/crafting/RecipeMap.java new file mode 100644 index 00000000..d5925d61 --- /dev/null +++ b/net/minecraft/world/item/crafting/RecipeMap.java @@ -0,0 +1,52 @@ +package net.minecraft.world.item.crafting; + +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableMultimap; +import com.google.common.collect.Multimap; +import com.google.common.collect.ImmutableMultimap.Builder; +import java.util.Collection; +import java.util.Map; +import java.util.stream.Stream; +import net.minecraft.resources.ResourceKey; +import net.minecraft.world.level.Level; +import org.jetbrains.annotations.Nullable; + +public class RecipeMap { + public static final RecipeMap EMPTY = new RecipeMap(ImmutableMultimap.of(), Map.of()); + private final Multimap, RecipeHolder> byType; + private final Map>, RecipeHolder> byKey; + + private RecipeMap(Multimap, RecipeHolder> multimap, Map>, RecipeHolder> map) { + this.byType = multimap; + this.byKey = map; + } + + public static RecipeMap create(Iterable> iterable) { + Builder, RecipeHolder> builder = ImmutableMultimap.builder(); + com.google.common.collect.ImmutableMap.Builder>, RecipeHolder> builder2 = ImmutableMap.builder(); + + for (RecipeHolder recipeHolder : iterable) { + builder.put(recipeHolder.value().getType(), recipeHolder); + builder2.put(recipeHolder.id(), recipeHolder); + } + + return new RecipeMap(builder.build(), builder2.build()); + } + + public > Collection> byType(RecipeType recipeType) { + return (Collection>)this.byType.get(recipeType); + } + + public Collection> values() { + return this.byKey.values(); + } + + @Nullable + public RecipeHolder byKey(ResourceKey> resourceKey) { + return (RecipeHolder)this.byKey.get(resourceKey); + } + + public > Stream> getRecipesFor(RecipeType recipeType, I recipeInput, Level level) { + return recipeInput.isEmpty() ? Stream.empty() : this.byType(recipeType).stream().filter(recipeHolder -> recipeHolder.value().matches(recipeInput, level)); + } +} diff --git a/net/minecraft/world/item/crafting/RecipePropertySet.java b/net/minecraft/world/item/crafting/RecipePropertySet.java new file mode 100644 index 00000000..12cfb556 --- /dev/null +++ b/net/minecraft/world/item/crafting/RecipePropertySet.java @@ -0,0 +1,51 @@ +package net.minecraft.world.item.crafting; + +import java.util.Collection; +import java.util.List; +import java.util.Set; +import java.util.stream.Collectors; +import net.minecraft.core.Holder; +import net.minecraft.core.Registry; +import net.minecraft.core.registries.Registries; +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.resources.ResourceKey; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; + +public class RecipePropertySet { + public static final ResourceKey> TYPE_KEY = ResourceKey.createRegistryKey( + ResourceLocation.withDefaultNamespace("recipe_property_set") + ); + public static final ResourceKey SMITHING_BASE = registerVanilla("smithing_base"); + public static final ResourceKey SMITHING_TEMPLATE = registerVanilla("smithing_template"); + public static final ResourceKey SMITHING_ADDITION = registerVanilla("smithing_addition"); + public static final ResourceKey FURNACE_INPUT = registerVanilla("furnace_input"); + public static final ResourceKey BLAST_FURNACE_INPUT = registerVanilla("blast_furnace_input"); + public static final ResourceKey SMOKER_INPUT = registerVanilla("smoker_input"); + public static final ResourceKey CAMPFIRE_INPUT = registerVanilla("campfire_input"); + public static final StreamCodec STREAM_CODEC = ByteBufCodecs.holderRegistry(Registries.ITEM) + .apply(ByteBufCodecs.list()) + .map(list -> new RecipePropertySet(Set.copyOf(list)), recipePropertySet -> List.copyOf(recipePropertySet.items)); + public static final RecipePropertySet EMPTY = new RecipePropertySet(Set.of()); + private final Set> items; + + private RecipePropertySet(Set> set) { + this.items = set; + } + + private static ResourceKey registerVanilla(String string) { + return ResourceKey.create(TYPE_KEY, ResourceLocation.withDefaultNamespace(string)); + } + + public boolean test(ItemStack itemStack) { + return this.items.contains(itemStack.getItemHolder()); + } + + static RecipePropertySet create(Collection collection) { + Set> set = (Set>)collection.stream().flatMap(ingredient -> ingredient.items().stream()).collect(Collectors.toUnmodifiableSet()); + return new RecipePropertySet(set); + } +} diff --git a/net/minecraft/world/item/crafting/RecipeSerializer.java b/net/minecraft/world/item/crafting/RecipeSerializer.java index 6b201b42..cf5a78a0 100644 --- a/net/minecraft/world/item/crafting/RecipeSerializer.java +++ b/net/minecraft/world/item/crafting/RecipeSerializer.java @@ -9,42 +9,38 @@ import net.minecraft.network.codec.StreamCodec; public interface RecipeSerializer> { RecipeSerializer SHAPED_RECIPE = register("crafting_shaped", new ShapedRecipe.Serializer()); RecipeSerializer SHAPELESS_RECIPE = register("crafting_shapeless", new ShapelessRecipe.Serializer()); - RecipeSerializer ARMOR_DYE = register("crafting_special_armordye", new SimpleCraftingRecipeSerializer<>(ArmorDyeRecipe::new)); - RecipeSerializer BOOK_CLONING = register("crafting_special_bookcloning", new SimpleCraftingRecipeSerializer<>(BookCloningRecipe::new)); - RecipeSerializer MAP_CLONING = register("crafting_special_mapcloning", new SimpleCraftingRecipeSerializer<>(MapCloningRecipe::new)); - RecipeSerializer MAP_EXTENDING = register("crafting_special_mapextending", new SimpleCraftingRecipeSerializer<>(MapExtendingRecipe::new)); - RecipeSerializer FIREWORK_ROCKET = register( - "crafting_special_firework_rocket", new SimpleCraftingRecipeSerializer<>(FireworkRocketRecipe::new) - ); - RecipeSerializer FIREWORK_STAR = register("crafting_special_firework_star", new SimpleCraftingRecipeSerializer<>(FireworkStarRecipe::new)); + RecipeSerializer ARMOR_DYE = register("crafting_special_armordye", new CustomRecipe.Serializer<>(ArmorDyeRecipe::new)); + RecipeSerializer BOOK_CLONING = register("crafting_special_bookcloning", new CustomRecipe.Serializer<>(BookCloningRecipe::new)); + RecipeSerializer MAP_CLONING = register("crafting_special_mapcloning", new CustomRecipe.Serializer<>(MapCloningRecipe::new)); + RecipeSerializer MAP_EXTENDING = register("crafting_special_mapextending", new CustomRecipe.Serializer<>(MapExtendingRecipe::new)); + RecipeSerializer FIREWORK_ROCKET = register("crafting_special_firework_rocket", new CustomRecipe.Serializer<>(FireworkRocketRecipe::new)); + RecipeSerializer FIREWORK_STAR = register("crafting_special_firework_star", new CustomRecipe.Serializer<>(FireworkStarRecipe::new)); RecipeSerializer FIREWORK_STAR_FADE = register( - "crafting_special_firework_star_fade", new SimpleCraftingRecipeSerializer<>(FireworkStarFadeRecipe::new) + "crafting_special_firework_star_fade", new CustomRecipe.Serializer<>(FireworkStarFadeRecipe::new) ); - RecipeSerializer TIPPED_ARROW = register("crafting_special_tippedarrow", new SimpleCraftingRecipeSerializer<>(TippedArrowRecipe::new)); + RecipeSerializer TIPPED_ARROW = register("crafting_special_tippedarrow", new CustomRecipe.Serializer<>(TippedArrowRecipe::new)); RecipeSerializer BANNER_DUPLICATE = register( - "crafting_special_bannerduplicate", new SimpleCraftingRecipeSerializer<>(BannerDuplicateRecipe::new) + "crafting_special_bannerduplicate", new CustomRecipe.Serializer<>(BannerDuplicateRecipe::new) ); RecipeSerializer SHIELD_DECORATION = register( - "crafting_special_shielddecoration", new SimpleCraftingRecipeSerializer<>(ShieldDecorationRecipe::new) + "crafting_special_shielddecoration", new CustomRecipe.Serializer<>(ShieldDecorationRecipe::new) ); - RecipeSerializer SHULKER_BOX_COLORING = register( - "crafting_special_shulkerboxcoloring", new SimpleCraftingRecipeSerializer<>(ShulkerBoxColoring::new) + RecipeSerializer TRANSMUTE = register("crafting_transmute", new TransmuteRecipe.Serializer()); + RecipeSerializer REPAIR_ITEM = register("crafting_special_repairitem", new CustomRecipe.Serializer<>(RepairItemRecipe::new)); + RecipeSerializer SMELTING_RECIPE = register("smelting", new AbstractCookingRecipe.Serializer<>(SmeltingRecipe::new, 200)); + RecipeSerializer BLASTING_RECIPE = register("blasting", new AbstractCookingRecipe.Serializer<>(BlastingRecipe::new, 100)); + RecipeSerializer SMOKING_RECIPE = register("smoking", new AbstractCookingRecipe.Serializer<>(SmokingRecipe::new, 100)); + RecipeSerializer CAMPFIRE_COOKING_RECIPE = register( + "campfire_cooking", new AbstractCookingRecipe.Serializer<>(CampfireCookingRecipe::new, 100) ); - RecipeSerializer SUSPICIOUS_STEW = register( - "crafting_special_suspiciousstew", new SimpleCraftingRecipeSerializer<>(SuspiciousStewRecipe::new) - ); - RecipeSerializer REPAIR_ITEM = register("crafting_special_repairitem", new SimpleCraftingRecipeSerializer<>(RepairItemRecipe::new)); - RecipeSerializer SMELTING_RECIPE = register("smelting", new SimpleCookingSerializer<>(SmeltingRecipe::new, 200)); - RecipeSerializer BLASTING_RECIPE = register("blasting", new SimpleCookingSerializer<>(BlastingRecipe::new, 100)); - RecipeSerializer SMOKING_RECIPE = register("smoking", new SimpleCookingSerializer<>(SmokingRecipe::new, 100)); - RecipeSerializer CAMPFIRE_COOKING_RECIPE = register("campfire_cooking", new SimpleCookingSerializer<>(CampfireCookingRecipe::new, 100)); RecipeSerializer STONECUTTER = register("stonecutting", new SingleItemRecipe.Serializer<>(StonecutterRecipe::new)); RecipeSerializer SMITHING_TRANSFORM = register("smithing_transform", new SmithingTransformRecipe.Serializer()); RecipeSerializer SMITHING_TRIM = register("smithing_trim", new SmithingTrimRecipe.Serializer()); - RecipeSerializer DECORATED_POT_RECIPE = register("crafting_decorated_pot", new SimpleCraftingRecipeSerializer<>(DecoratedPotRecipe::new)); + RecipeSerializer DECORATED_POT_RECIPE = register("crafting_decorated_pot", new CustomRecipe.Serializer<>(DecoratedPotRecipe::new)); MapCodec codec(); + @Deprecated StreamCodec streamCodec(); static , T extends Recipe> S register(String key, S recipeSerializer) { diff --git a/net/minecraft/world/item/crafting/RepairItemRecipe.java b/net/minecraft/world/item/crafting/RepairItemRecipe.java index 14457fd6..53858d10 100644 --- a/net/minecraft/world/item/crafting/RepairItemRecipe.java +++ b/net/minecraft/world/item/crafting/RepairItemRecipe.java @@ -17,26 +17,25 @@ public class RepairItemRecipe extends CustomRecipe { } @Nullable - private Pair getItemsToCombine(CraftingInput input) { - ItemStack itemStack = null; - ItemStack itemStack2 = null; + private static Pair getItemsToCombine(CraftingInput craftingInput) { + if (craftingInput.ingredientCount() != 2) { + return null; + } else { + ItemStack itemStack = null; - for (int i = 0; i < input.size(); i++) { - ItemStack itemStack3 = input.getItem(i); - if (!itemStack3.isEmpty()) { - if (itemStack == null) { - itemStack = itemStack3; - } else { - if (itemStack2 != null) { - return null; + for (int i = 0; i < craftingInput.size(); i++) { + ItemStack itemStack2 = craftingInput.getItem(i); + if (!itemStack2.isEmpty()) { + if (itemStack != null) { + return canCombine(itemStack, itemStack2) ? Pair.of(itemStack, itemStack2) : null; } - itemStack2 = itemStack3; + itemStack = itemStack2; } } - } - return itemStack != null && itemStack2 != null && canCombine(itemStack, itemStack2) ? Pair.of(itemStack, itemStack2) : null; + return null; + } } private static boolean canCombine(ItemStack stack1, ItemStack stack2) { @@ -50,11 +49,11 @@ public class RepairItemRecipe extends CustomRecipe { } public boolean matches(CraftingInput input, Level level) { - return this.getItemsToCombine(input) != null; + return getItemsToCombine(input) != null; } public ItemStack assemble(CraftingInput input, HolderLookup.Provider registries) { - Pair pair = this.getItemsToCombine(input); + Pair pair = getItemsToCombine(input); if (pair == null) { return ItemStack.EMPTY; } else { @@ -83,12 +82,7 @@ public class RepairItemRecipe extends CustomRecipe { } @Override - public boolean canCraftInDimensions(int width, int height) { - return width * height >= 2; - } - - @Override - public RecipeSerializer getSerializer() { + public RecipeSerializer getSerializer() { return RecipeSerializer.REPAIR_ITEM; } } diff --git a/net/minecraft/world/item/crafting/SelectableRecipe.java b/net/minecraft/world/item/crafting/SelectableRecipe.java new file mode 100644 index 00000000..653cb019 --- /dev/null +++ b/net/minecraft/world/item/crafting/SelectableRecipe.java @@ -0,0 +1,58 @@ +package net.minecraft.world.item.crafting; + +import java.util.List; +import java.util.Optional; +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.display.SlotDisplay; + +public record SelectableRecipe>(SlotDisplay optionDisplay, Optional> recipe) { + public static > StreamCodec> noRecipeCodec() { + return StreamCodec.composite(SlotDisplay.STREAM_CODEC, SelectableRecipe::optionDisplay, slotDisplay -> new SelectableRecipe(slotDisplay, Optional.empty())); + } + + public record SingleInputEntry>(Ingredient input, SelectableRecipe recipe) { + + public static > StreamCodec> noRecipeCodec() { + return StreamCodec.composite( + Ingredient.CONTENTS_STREAM_CODEC, + SelectableRecipe.SingleInputEntry::input, + SelectableRecipe.noRecipeCodec(), + SelectableRecipe.SingleInputEntry::recipe, + SelectableRecipe.SingleInputEntry::new + ); + } + } + + public record SingleInputSet>(List> entries) { + public static > SelectableRecipe.SingleInputSet empty() { + return new SelectableRecipe.SingleInputSet<>(List.of()); + } + + public static > StreamCodec> noRecipeCodec() { + return StreamCodec.composite( + SelectableRecipe.SingleInputEntry.noRecipeCodec().apply(ByteBufCodecs.list()), + SelectableRecipe.SingleInputSet::entries, + SelectableRecipe.SingleInputSet::new + ); + } + + public boolean acceptsInput(ItemStack itemStack) { + return this.entries.stream().anyMatch(singleInputEntry -> singleInputEntry.input.test(itemStack)); + } + + public SelectableRecipe.SingleInputSet selectByInput(ItemStack itemStack) { + return new SelectableRecipe.SingleInputSet<>(this.entries.stream().filter(singleInputEntry -> singleInputEntry.input.test(itemStack)).toList()); + } + + public boolean isEmpty() { + return this.entries.isEmpty(); + } + + public int size() { + return this.entries.size(); + } + } +} diff --git a/net/minecraft/world/item/crafting/ShapedRecipe.java b/net/minecraft/world/item/crafting/ShapedRecipe.java index 1f2f9b48..2655f2f5 100644 --- a/net/minecraft/world/item/crafting/ShapedRecipe.java +++ b/net/minecraft/world/item/crafting/ShapedRecipe.java @@ -1,14 +1,21 @@ package net.minecraft.world.item.crafting; +import com.google.common.annotations.VisibleForTesting; import com.mojang.serialization.Codec; import com.mojang.serialization.MapCodec; import com.mojang.serialization.codecs.RecordCodecBuilder; +import java.util.List; +import java.util.Optional; import net.minecraft.core.HolderLookup; -import net.minecraft.core.NonNullList; import net.minecraft.network.RegistryFriendlyByteBuf; import net.minecraft.network.codec.StreamCodec; import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.world.item.crafting.display.RecipeDisplay; +import net.minecraft.world.item.crafting.display.ShapedCraftingRecipeDisplay; +import net.minecraft.world.item.crafting.display.SlotDisplay; import net.minecraft.world.level.Level; +import org.jetbrains.annotations.Nullable; public class ShapedRecipe implements CraftingRecipe { final ShapedRecipePattern pattern; @@ -16,6 +23,8 @@ public class ShapedRecipe implements CraftingRecipe { final String group; final CraftingBookCategory category; final boolean showNotification; + @Nullable + private PlacementInfo placementInfo; public ShapedRecipe(String group, CraftingBookCategory category, ShapedRecipePattern pattern, ItemStack result, boolean showNotification) { this.group = group; @@ -30,12 +39,12 @@ public class ShapedRecipe implements CraftingRecipe { } @Override - public RecipeSerializer getSerializer() { + public RecipeSerializer getSerializer() { return RecipeSerializer.SHAPED_RECIPE; } @Override - public String getGroup() { + public String group() { return this.group; } @@ -44,14 +53,18 @@ public class ShapedRecipe implements CraftingRecipe { return this.category; } - @Override - public ItemStack getResultItem(HolderLookup.Provider registries) { - return this.result; + @VisibleForTesting + public List> getIngredients() { + return this.pattern.ingredients(); } @Override - public NonNullList getIngredients() { - return this.pattern.ingredients(); + public PlacementInfo placementInfo() { + if (this.placementInfo == null) { + this.placementInfo = PlacementInfo.createFromOptionals(this.pattern.ingredients()); + } + + return this.placementInfo; } @Override @@ -59,17 +72,12 @@ public class ShapedRecipe implements CraftingRecipe { return this.showNotification; } - @Override - public boolean canCraftInDimensions(int width, int height) { - return width >= this.pattern.width() && height >= this.pattern.height(); - } - public boolean matches(CraftingInput input, Level level) { return this.pattern.matches(input); } public ItemStack assemble(CraftingInput input, HolderLookup.Provider registries) { - return this.getResultItem(registries).copy(); + return this.result.copy(); } public int getWidth() { @@ -81,9 +89,16 @@ public class ShapedRecipe implements CraftingRecipe { } @Override - public boolean isIncomplete() { - NonNullList nonNullList = this.getIngredients(); - return nonNullList.isEmpty() || nonNullList.stream().filter(ingredient -> !ingredient.isEmpty()).anyMatch(ingredient -> ingredient.getItems().length == 0); + public List display() { + return List.of( + new ShapedCraftingRecipeDisplay( + this.pattern.width(), + this.pattern.height(), + this.pattern.ingredients().stream().map(optional -> (SlotDisplay)optional.map(Ingredient::display).orElse(SlotDisplay.Empty.INSTANCE)).toList(), + new SlotDisplay.ItemStackSlotDisplay(this.result), + new SlotDisplay.ItemSlotDisplay(Items.CRAFTING_TABLE) + ) + ); } public static class Serializer implements RecipeSerializer { diff --git a/net/minecraft/world/item/crafting/ShapedRecipePattern.java b/net/minecraft/world/item/crafting/ShapedRecipePattern.java index e5bac772..399dcf89 100644 --- a/net/minecraft/world/item/crafting/ShapedRecipePattern.java +++ b/net/minecraft/world/item/crafting/ShapedRecipePattern.java @@ -7,19 +7,21 @@ import com.mojang.serialization.MapCodec; import com.mojang.serialization.codecs.RecordCodecBuilder; import it.unimi.dsi.fastutil.chars.CharArraySet; import it.unimi.dsi.fastutil.chars.CharSet; +import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Optional; import java.util.function.Function; import net.minecraft.Util; -import net.minecraft.core.NonNullList; import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.codec.ByteBufCodecs; import net.minecraft.network.codec.StreamCodec; import net.minecraft.util.ExtraCodecs; import net.minecraft.world.item.ItemStack; public final class ShapedRecipePattern { private static final int MAX_SIZE = 3; + public static final char EMPTY_SLOT = ' '; public static final MapCodec MAP_CODEC = ShapedRecipePattern.Data.MAP_CODEC .flatXmap( ShapedRecipePattern::unpack, @@ -27,31 +29,33 @@ public final class ShapedRecipePattern { .map(DataResult::success) .orElseGet(() -> DataResult.error(() -> "Cannot encode unpacked recipe")) ); - public static final StreamCodec STREAM_CODEC = StreamCodec.ofMember( - ShapedRecipePattern::toNetwork, ShapedRecipePattern::fromNetwork + public static final StreamCodec STREAM_CODEC = StreamCodec.composite( + ByteBufCodecs.VAR_INT, + shapedRecipePattern -> shapedRecipePattern.width, + ByteBufCodecs.VAR_INT, + shapedRecipePattern -> shapedRecipePattern.height, + Ingredient.OPTIONAL_CONTENTS_STREAM_CODEC.apply(ByteBufCodecs.list()), + shapedRecipePattern -> shapedRecipePattern.ingredients, + ShapedRecipePattern::createFromNetwork ); private final int width; private final int height; - private final NonNullList ingredients; + private final List> ingredients; private final Optional data; private final int ingredientCount; private final boolean symmetrical; - public ShapedRecipePattern(int width, int height, NonNullList ingredients, Optional data) { - this.width = width; - this.height = height; - this.ingredients = ingredients; - this.data = data; - int i = 0; + public ShapedRecipePattern(int i, int j, List> list, Optional optional) { + this.width = i; + this.height = j; + this.ingredients = list; + this.data = optional; + this.ingredientCount = (int)list.stream().flatMap(Optional::stream).count(); + this.symmetrical = Util.isSymmetrical(i, j, list); + } - for (Ingredient ingredient : ingredients) { - if (!ingredient.isEmpty()) { - i++; - } - } - - this.ingredientCount = i; - this.symmetrical = Util.isSymmetrical(width, height, ingredients); + private static ShapedRecipePattern createFromNetwork(Integer integer, Integer integer2, List> list) { + return new ShapedRecipePattern(integer, integer2, list, Optional.empty()); } public static ShapedRecipePattern of(Map key, String... pattern) { @@ -67,27 +71,32 @@ public final class ShapedRecipePattern { String[] strings = shrink(data.pattern); int i = strings[0].length(); int j = strings.length; - NonNullList nonNullList = NonNullList.withSize(i * j, Ingredient.EMPTY); + List> list = new ArrayList(i * j); CharSet charSet = new CharArraySet(data.key.keySet()); - for (int k = 0; k < strings.length; k++) { - String string = strings[k]; + for (String string : strings) { + for (int k = 0; k < string.length(); k++) { + char c = string.charAt(k); + Optional optional; + if (c == ' ') { + optional = Optional.empty(); + } else { + Ingredient ingredient = (Ingredient)data.key.get(c); + if (ingredient == null) { + return DataResult.error(() -> "Pattern references symbol '" + c + "' but it's not defined in the key"); + } - for (int l = 0; l < string.length(); l++) { - char c = string.charAt(l); - Ingredient ingredient = c == ' ' ? Ingredient.EMPTY : (Ingredient)data.key.get(c); - if (ingredient == null) { - return DataResult.error(() -> "Pattern references symbol '" + c + "' but it's not defined in the key"); + optional = Optional.of(ingredient); } charSet.remove(c); - nonNullList.set(l + i * k, ingredient); + list.add(optional); } } return !charSet.isEmpty() ? DataResult.error(() -> "Key defines symbols that aren't used in pattern: " + charSet) - : DataResult.success(new ShapedRecipePattern(i, j, nonNullList, Optional.of(data))); + : DataResult.success(new ShapedRecipePattern(i, j, list, Optional.of(data))); } @VisibleForTesting @@ -99,8 +108,8 @@ public final class ShapedRecipePattern { for (int m = 0; m < pattern.size(); m++) { String string = (String)pattern.get(m); - i = Math.min(i, firstNonSpace(string)); - int n = lastNonSpace(string); + i = Math.min(i, firstNonEmpty(string)); + int n = lastNonEmpty(string); j = Math.max(j, n); if (n < 0) { if (k == m) { @@ -126,20 +135,20 @@ public final class ShapedRecipePattern { } } - private static int firstNonSpace(String row) { + private static int firstNonEmpty(String string) { int i = 0; - while (i < row.length() && row.charAt(i) == ' ') { + while (i < string.length() && string.charAt(i) == ' ') { i++; } return i; } - private static int lastNonSpace(String row) { - int i = row.length() - 1; + private static int lastNonEmpty(String string) { + int i = string.length() - 1; - while (i >= 0 && row.charAt(i) == ' ') { + while (i >= 0 && string.charAt(i) == ' ') { i--; } @@ -167,15 +176,15 @@ public final class ShapedRecipePattern { private boolean matches(CraftingInput input, boolean symmetrical) { for (int i = 0; i < this.height; i++) { for (int j = 0; j < this.width; j++) { - Ingredient ingredient; + Optional optional; if (symmetrical) { - ingredient = this.ingredients.get(this.width - j - 1 + i * this.width); + optional = (Optional)this.ingredients.get(this.width - j - 1 + i * this.width); } else { - ingredient = this.ingredients.get(j + i * this.width); + optional = (Optional)this.ingredients.get(j + i * this.width); } ItemStack itemStack = input.getItem(j, i); - if (!ingredient.test(itemStack)) { + if (!Ingredient.testOptionalIngredient(optional, itemStack)) { return false; } } @@ -184,23 +193,6 @@ public final class ShapedRecipePattern { return true; } - private void toNetwork(RegistryFriendlyByteBuf buffer) { - buffer.writeVarInt(this.width); - buffer.writeVarInt(this.height); - - for (Ingredient ingredient : this.ingredients) { - Ingredient.CONTENTS_STREAM_CODEC.encode(buffer, ingredient); - } - } - - private static ShapedRecipePattern fromNetwork(RegistryFriendlyByteBuf buffer) { - int i = buffer.readVarInt(); - int j = buffer.readVarInt(); - NonNullList nonNullList = NonNullList.withSize(i * j, Ingredient.EMPTY); - nonNullList.replaceAll(ingredient -> Ingredient.CONTENTS_STREAM_CODEC.decode(buffer)); - return new ShapedRecipePattern(i, j, nonNullList, Optional.empty()); - } - public int width() { return this.width; } @@ -209,7 +201,7 @@ public final class ShapedRecipePattern { return this.height; } - public NonNullList ingredients() { + public List> ingredients() { return this.ingredients; } @@ -244,7 +236,7 @@ public final class ShapedRecipePattern { }, String::valueOf); public static final MapCodec MAP_CODEC = RecordCodecBuilder.mapCodec( instance -> instance.group( - ExtraCodecs.strictUnboundedMap(SYMBOL_CODEC, Ingredient.CODEC_NONEMPTY).fieldOf("key").forGetter(data -> data.key), + ExtraCodecs.strictUnboundedMap(SYMBOL_CODEC, Ingredient.CODEC).fieldOf("key").forGetter(data -> data.key), PATTERN_CODEC.fieldOf("pattern").forGetter(data -> data.pattern) ) .apply(instance, ShapedRecipePattern.Data::new) diff --git a/net/minecraft/world/item/crafting/ShapelessRecipe.java b/net/minecraft/world/item/crafting/ShapelessRecipe.java index 902ce4c8..d2f71f2b 100644 --- a/net/minecraft/world/item/crafting/ShapelessRecipe.java +++ b/net/minecraft/world/item/crafting/ShapelessRecipe.java @@ -1,36 +1,43 @@ package net.minecraft.world.item.crafting; import com.mojang.serialization.Codec; -import com.mojang.serialization.DataResult; import com.mojang.serialization.MapCodec; import com.mojang.serialization.codecs.RecordCodecBuilder; +import java.util.List; import net.minecraft.core.HolderLookup; -import net.minecraft.core.NonNullList; import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.codec.ByteBufCodecs; import net.minecraft.network.codec.StreamCodec; import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.world.item.crafting.display.RecipeDisplay; +import net.minecraft.world.item.crafting.display.ShapelessCraftingRecipeDisplay; +import net.minecraft.world.item.crafting.display.SlotDisplay; import net.minecraft.world.level.Level; +import org.jetbrains.annotations.Nullable; public class ShapelessRecipe implements CraftingRecipe { final String group; final CraftingBookCategory category; final ItemStack result; - final NonNullList ingredients; + final List ingredients; + @Nullable + private PlacementInfo placementInfo; - public ShapelessRecipe(String group, CraftingBookCategory category, ItemStack result, NonNullList ingredients) { - this.group = group; - this.category = category; - this.result = result; - this.ingredients = ingredients; + public ShapelessRecipe(String string, CraftingBookCategory craftingBookCategory, ItemStack itemStack, List list) { + this.group = string; + this.category = craftingBookCategory; + this.result = itemStack; + this.ingredients = list; } @Override - public RecipeSerializer getSerializer() { + public RecipeSerializer getSerializer() { return RecipeSerializer.SHAPELESS_RECIPE; } @Override - public String getGroup() { + public String group() { return this.group; } @@ -40,13 +47,12 @@ public class ShapelessRecipe implements CraftingRecipe { } @Override - public ItemStack getResultItem(HolderLookup.Provider registries) { - return this.result; - } + public PlacementInfo placementInfo() { + if (this.placementInfo == null) { + this.placementInfo = PlacementInfo.create(this.ingredients); + } - @Override - public NonNullList getIngredients() { - return this.ingredients; + return this.placementInfo; } public boolean matches(CraftingInput input, Level level) { @@ -64,8 +70,14 @@ public class ShapelessRecipe implements CraftingRecipe { } @Override - public boolean canCraftInDimensions(int width, int height) { - return width * height >= this.ingredients.size(); + public List display() { + return List.of( + new ShapelessCraftingRecipeDisplay( + this.ingredients.stream().map(Ingredient::display).toList(), + new SlotDisplay.ItemStackSlotDisplay(this.result), + new SlotDisplay.ItemSlotDisplay(Items.CRAFTING_TABLE) + ) + ); } public static class Serializer implements RecipeSerializer { @@ -74,28 +86,20 @@ public class ShapelessRecipe implements CraftingRecipe { Codec.STRING.optionalFieldOf("group", "").forGetter(shapelessRecipe -> shapelessRecipe.group), CraftingBookCategory.CODEC.fieldOf("category").orElse(CraftingBookCategory.MISC).forGetter(shapelessRecipe -> shapelessRecipe.category), ItemStack.STRICT_CODEC.fieldOf("result").forGetter(shapelessRecipe -> shapelessRecipe.result), - Ingredient.CODEC_NONEMPTY - .listOf() - .fieldOf("ingredients") - .flatXmap( - list -> { - Ingredient[] ingredients = (Ingredient[])list.stream().filter(ingredient -> !ingredient.isEmpty()).toArray(Ingredient[]::new); - if (ingredients.length == 0) { - return DataResult.error(() -> "No ingredients for shapeless recipe"); - } else { - return ingredients.length > 9 - ? DataResult.error(() -> "Too many ingredients for shapeless recipe") - : DataResult.success(NonNullList.of(Ingredient.EMPTY, ingredients)); - } - }, - DataResult::success - ) - .forGetter(shapelessRecipe -> shapelessRecipe.ingredients) + Ingredient.CODEC.listOf(1, 9).fieldOf("ingredients").forGetter(shapelessRecipe -> shapelessRecipe.ingredients) ) .apply(instance, ShapelessRecipe::new) ); - public static final StreamCodec STREAM_CODEC = StreamCodec.of( - ShapelessRecipe.Serializer::toNetwork, ShapelessRecipe.Serializer::fromNetwork + public static final StreamCodec STREAM_CODEC = StreamCodec.composite( + ByteBufCodecs.STRING_UTF8, + shapelessRecipe -> shapelessRecipe.group, + CraftingBookCategory.STREAM_CODEC, + shapelessRecipe -> shapelessRecipe.category, + ItemStack.STREAM_CODEC, + shapelessRecipe -> shapelessRecipe.result, + Ingredient.CONTENTS_STREAM_CODEC.apply(ByteBufCodecs.list()), + shapelessRecipe -> shapelessRecipe.ingredients, + ShapelessRecipe::new ); @Override @@ -107,27 +111,5 @@ public class ShapelessRecipe implements CraftingRecipe { public StreamCodec streamCodec() { return STREAM_CODEC; } - - private static ShapelessRecipe fromNetwork(RegistryFriendlyByteBuf buffer) { - String string = buffer.readUtf(); - CraftingBookCategory craftingBookCategory = buffer.readEnum(CraftingBookCategory.class); - int i = buffer.readVarInt(); - NonNullList nonNullList = NonNullList.withSize(i, Ingredient.EMPTY); - nonNullList.replaceAll(ingredient -> Ingredient.CONTENTS_STREAM_CODEC.decode(buffer)); - ItemStack itemStack = ItemStack.STREAM_CODEC.decode(buffer); - return new ShapelessRecipe(string, craftingBookCategory, itemStack, nonNullList); - } - - private static void toNetwork(RegistryFriendlyByteBuf buffer, ShapelessRecipe recipe) { - buffer.writeUtf(recipe.group); - buffer.writeEnum(recipe.category); - buffer.writeVarInt(recipe.ingredients.size()); - - for (Ingredient ingredient : recipe.ingredients) { - Ingredient.CONTENTS_STREAM_CODEC.encode(buffer, ingredient); - } - - ItemStack.STREAM_CODEC.encode(buffer, recipe.result); - } } } diff --git a/net/minecraft/world/item/crafting/ShieldDecorationRecipe.java b/net/minecraft/world/item/crafting/ShieldDecorationRecipe.java index 99f9a5d8..9c1ec643 100644 --- a/net/minecraft/world/item/crafting/ShieldDecorationRecipe.java +++ b/net/minecraft/world/item/crafting/ShieldDecorationRecipe.java @@ -14,38 +14,42 @@ public class ShieldDecorationRecipe extends CustomRecipe { } public boolean matches(CraftingInput input, Level level) { - ItemStack itemStack = ItemStack.EMPTY; - ItemStack itemStack2 = ItemStack.EMPTY; + if (input.ingredientCount() != 2) { + return false; + } else { + boolean bl = false; + boolean bl2 = false; - for (int i = 0; i < input.size(); i++) { - ItemStack itemStack3 = input.getItem(i); - if (!itemStack3.isEmpty()) { - if (itemStack3.getItem() instanceof BannerItem) { - if (!itemStack2.isEmpty()) { - return false; + for (int i = 0; i < input.size(); i++) { + ItemStack itemStack = input.getItem(i); + if (!itemStack.isEmpty()) { + if (itemStack.getItem() instanceof BannerItem) { + if (bl2) { + return false; + } + + bl2 = true; + } else { + if (!itemStack.is(Items.SHIELD)) { + return false; + } + + if (bl) { + return false; + } + + BannerPatternLayers bannerPatternLayers = itemStack.getOrDefault(DataComponents.BANNER_PATTERNS, BannerPatternLayers.EMPTY); + if (!bannerPatternLayers.layers().isEmpty()) { + return false; + } + + bl = true; } - - itemStack2 = itemStack3; - } else { - if (!itemStack3.is(Items.SHIELD)) { - return false; - } - - if (!itemStack.isEmpty()) { - return false; - } - - BannerPatternLayers bannerPatternLayers = itemStack3.getOrDefault(DataComponents.BANNER_PATTERNS, BannerPatternLayers.EMPTY); - if (!bannerPatternLayers.layers().isEmpty()) { - return false; - } - - itemStack = itemStack3; } } - } - return !itemStack.isEmpty() && !itemStack2.isEmpty(); + return bl && bl2; + } } public ItemStack assemble(CraftingInput input, HolderLookup.Provider registries) { @@ -73,12 +77,7 @@ public class ShieldDecorationRecipe extends CustomRecipe { } @Override - public boolean canCraftInDimensions(int width, int height) { - return width * height >= 2; - } - - @Override - public RecipeSerializer getSerializer() { + public RecipeSerializer getSerializer() { return RecipeSerializer.SHIELD_DECORATION; } } diff --git a/net/minecraft/world/item/crafting/ShulkerBoxColoring.java b/net/minecraft/world/item/crafting/ShulkerBoxColoring.java deleted file mode 100644 index edb88525..00000000 --- a/net/minecraft/world/item/crafting/ShulkerBoxColoring.java +++ /dev/null @@ -1,72 +0,0 @@ -package net.minecraft.world.item.crafting; - -import net.minecraft.core.HolderLookup; -import net.minecraft.world.item.DyeItem; -import net.minecraft.world.item.Item; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.Items; -import net.minecraft.world.level.Level; -import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.block.ShulkerBoxBlock; - -public class ShulkerBoxColoring extends CustomRecipe { - public ShulkerBoxColoring(CraftingBookCategory category) { - super(category); - } - - public boolean matches(CraftingInput input, Level level) { - int i = 0; - int j = 0; - - for (int k = 0; k < input.size(); k++) { - ItemStack itemStack = input.getItem(k); - if (!itemStack.isEmpty()) { - if (Block.byItem(itemStack.getItem()) instanceof ShulkerBoxBlock) { - i++; - } else { - if (!(itemStack.getItem() instanceof DyeItem)) { - return false; - } - - j++; - } - - if (j > 1 || i > 1) { - return false; - } - } - } - - return i == 1 && j == 1; - } - - public ItemStack assemble(CraftingInput input, HolderLookup.Provider registries) { - ItemStack itemStack = ItemStack.EMPTY; - DyeItem dyeItem = (DyeItem)Items.WHITE_DYE; - - for (int i = 0; i < input.size(); i++) { - ItemStack itemStack2 = input.getItem(i); - if (!itemStack2.isEmpty()) { - Item item = itemStack2.getItem(); - if (Block.byItem(item) instanceof ShulkerBoxBlock) { - itemStack = itemStack2; - } else if (item instanceof DyeItem) { - dyeItem = (DyeItem)item; - } - } - } - - Block block = ShulkerBoxBlock.getBlockByColor(dyeItem.getDyeColor()); - return itemStack.transmuteCopy(block, 1); - } - - @Override - public boolean canCraftInDimensions(int width, int height) { - return width * height >= 2; - } - - @Override - public RecipeSerializer getSerializer() { - return RecipeSerializer.SHULKER_BOX_COLORING; - } -} diff --git a/net/minecraft/world/item/crafting/SimpleCookingSerializer.java b/net/minecraft/world/item/crafting/SimpleCookingSerializer.java deleted file mode 100644 index c97a7ac6..00000000 --- a/net/minecraft/world/item/crafting/SimpleCookingSerializer.java +++ /dev/null @@ -1,63 +0,0 @@ -package net.minecraft.world.item.crafting; - -import com.mojang.serialization.Codec; -import com.mojang.serialization.MapCodec; -import com.mojang.serialization.codecs.RecordCodecBuilder; -import net.minecraft.network.RegistryFriendlyByteBuf; -import net.minecraft.network.codec.StreamCodec; -import net.minecraft.world.item.ItemStack; - -public class SimpleCookingSerializer implements RecipeSerializer { - private final AbstractCookingRecipe.Factory factory; - private final MapCodec codec; - private final StreamCodec streamCodec; - - public SimpleCookingSerializer(AbstractCookingRecipe.Factory factory, int cookingTime) { - this.factory = factory; - this.codec = RecordCodecBuilder.mapCodec( - instance -> instance.group( - Codec.STRING.optionalFieldOf("group", "").forGetter(abstractCookingRecipe -> abstractCookingRecipe.group), - CookingBookCategory.CODEC.fieldOf("category").orElse(CookingBookCategory.MISC).forGetter(abstractCookingRecipe -> abstractCookingRecipe.category), - Ingredient.CODEC_NONEMPTY.fieldOf("ingredient").forGetter(abstractCookingRecipe -> abstractCookingRecipe.ingredient), - ItemStack.STRICT_SINGLE_ITEM_CODEC.fieldOf("result").forGetter(abstractCookingRecipe -> abstractCookingRecipe.result), - Codec.FLOAT.fieldOf("experience").orElse(0.0F).forGetter(abstractCookingRecipe -> abstractCookingRecipe.experience), - Codec.INT.fieldOf("cookingtime").orElse(cookingTime).forGetter(abstractCookingRecipe -> abstractCookingRecipe.cookingTime) - ) - .apply(instance, factory::create) - ); - this.streamCodec = StreamCodec.of(this::toNetwork, this::fromNetwork); - } - - @Override - public MapCodec codec() { - return this.codec; - } - - @Override - public StreamCodec streamCodec() { - return this.streamCodec; - } - - private T fromNetwork(RegistryFriendlyByteBuf buffer) { - String string = buffer.readUtf(); - CookingBookCategory cookingBookCategory = buffer.readEnum(CookingBookCategory.class); - Ingredient ingredient = Ingredient.CONTENTS_STREAM_CODEC.decode(buffer); - ItemStack itemStack = ItemStack.STREAM_CODEC.decode(buffer); - float f = buffer.readFloat(); - int i = buffer.readVarInt(); - return this.factory.create(string, cookingBookCategory, ingredient, itemStack, f, i); - } - - private void toNetwork(RegistryFriendlyByteBuf buffer, T recipe) { - buffer.writeUtf(recipe.group); - buffer.writeEnum(recipe.category()); - Ingredient.CONTENTS_STREAM_CODEC.encode(buffer, recipe.ingredient); - ItemStack.STREAM_CODEC.encode(buffer, recipe.result); - buffer.writeFloat(recipe.experience); - buffer.writeVarInt(recipe.cookingTime); - } - - public AbstractCookingRecipe create(String group, CookingBookCategory category, Ingredient ingredient, ItemStack result, float experience, int cookingTime) { - return this.factory.create(group, category, ingredient, result, experience, cookingTime); - } -} diff --git a/net/minecraft/world/item/crafting/SimpleCraftingRecipeSerializer.java b/net/minecraft/world/item/crafting/SimpleCraftingRecipeSerializer.java deleted file mode 100644 index 499ef996..00000000 --- a/net/minecraft/world/item/crafting/SimpleCraftingRecipeSerializer.java +++ /dev/null @@ -1,34 +0,0 @@ -package net.minecraft.world.item.crafting; - -import com.mojang.serialization.MapCodec; -import com.mojang.serialization.codecs.RecordCodecBuilder; -import net.minecraft.network.RegistryFriendlyByteBuf; -import net.minecraft.network.codec.StreamCodec; - -public class SimpleCraftingRecipeSerializer implements RecipeSerializer { - private final MapCodec codec; - private final StreamCodec streamCodec; - - public SimpleCraftingRecipeSerializer(SimpleCraftingRecipeSerializer.Factory constructor) { - this.codec = RecordCodecBuilder.mapCodec( - instance -> instance.group(CraftingBookCategory.CODEC.fieldOf("category").orElse(CraftingBookCategory.MISC).forGetter(CraftingRecipe::category)) - .apply(instance, constructor::create) - ); - this.streamCodec = StreamCodec.composite(CraftingBookCategory.STREAM_CODEC, CraftingRecipe::category, constructor::create); - } - - @Override - public MapCodec codec() { - return this.codec; - } - - @Override - public StreamCodec streamCodec() { - return this.streamCodec; - } - - @FunctionalInterface - public interface Factory { - T create(CraftingBookCategory craftingBookCategory); - } -} diff --git a/net/minecraft/world/item/crafting/SingleItemRecipe.java b/net/minecraft/world/item/crafting/SingleItemRecipe.java index eaf13596..72502a57 100644 --- a/net/minecraft/world/item/crafting/SingleItemRecipe.java +++ b/net/minecraft/world/item/crafting/SingleItemRecipe.java @@ -4,89 +4,87 @@ import com.mojang.serialization.Codec; import com.mojang.serialization.MapCodec; import com.mojang.serialization.codecs.RecordCodecBuilder; import net.minecraft.core.HolderLookup; -import net.minecraft.core.NonNullList; import net.minecraft.network.RegistryFriendlyByteBuf; import net.minecraft.network.codec.ByteBufCodecs; import net.minecraft.network.codec.StreamCodec; import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; +import org.jetbrains.annotations.Nullable; public abstract class SingleItemRecipe implements Recipe { - protected final Ingredient ingredient; - protected final ItemStack result; - private final RecipeType type; - private final RecipeSerializer serializer; - protected final String group; + private final Ingredient input; + private final ItemStack result; + private final String group; + @Nullable + private PlacementInfo placementInfo; - public SingleItemRecipe(RecipeType type, RecipeSerializer serializer, String group, Ingredient ingredient, ItemStack result) { - this.type = type; - this.serializer = serializer; - this.group = group; - this.ingredient = ingredient; - this.result = result; + public SingleItemRecipe(String string, Ingredient ingredient, ItemStack itemStack) { + this.group = string; + this.input = ingredient; + this.result = itemStack; } @Override - public RecipeType getType() { - return this.type; + public abstract RecipeSerializer getSerializer(); + + @Override + public abstract RecipeType getType(); + + public boolean matches(SingleRecipeInput singleRecipeInput, Level level) { + return this.input.test(singleRecipeInput.item()); } @Override - public RecipeSerializer getSerializer() { - return this.serializer; - } - - @Override - public String getGroup() { + public String group() { return this.group; } - @Override - public ItemStack getResultItem(HolderLookup.Provider registries) { + public Ingredient input() { + return this.input; + } + + protected ItemStack result() { return this.result; } @Override - public NonNullList getIngredients() { - NonNullList nonNullList = NonNullList.create(); - nonNullList.add(this.ingredient); - return nonNullList; - } + public PlacementInfo placementInfo() { + if (this.placementInfo == null) { + this.placementInfo = PlacementInfo.create(this.input); + } - @Override - public boolean canCraftInDimensions(int width, int height) { - return true; + return this.placementInfo; } public ItemStack assemble(SingleRecipeInput input, HolderLookup.Provider registries) { return this.result.copy(); } + @FunctionalInterface public interface Factory { T create(String string, Ingredient ingredient, ItemStack itemStack); } public static class Serializer implements RecipeSerializer { - final SingleItemRecipe.Factory factory; private final MapCodec codec; private final StreamCodec streamCodec; protected Serializer(SingleItemRecipe.Factory factory) { - this.factory = factory; this.codec = RecordCodecBuilder.mapCodec( instance -> instance.group( - Codec.STRING.optionalFieldOf("group", "").forGetter(singleItemRecipe -> singleItemRecipe.group), - Ingredient.CODEC_NONEMPTY.fieldOf("ingredient").forGetter(singleItemRecipe -> singleItemRecipe.ingredient), - ItemStack.STRICT_CODEC.fieldOf("result").forGetter(singleItemRecipe -> singleItemRecipe.result) + Codec.STRING.optionalFieldOf("group", "").forGetter(SingleItemRecipe::group), + Ingredient.CODEC.fieldOf("ingredient").forGetter(SingleItemRecipe::input), + ItemStack.STRICT_CODEC.fieldOf("result").forGetter(SingleItemRecipe::result) ) .apply(instance, factory::create) ); this.streamCodec = StreamCodec.composite( ByteBufCodecs.STRING_UTF8, - singleItemRecipe -> singleItemRecipe.group, + SingleItemRecipe::group, Ingredient.CONTENTS_STREAM_CODEC, - singleItemRecipe -> singleItemRecipe.ingredient, + SingleItemRecipe::input, ItemStack.STREAM_CODEC, - singleItemRecipe -> singleItemRecipe.result, + SingleItemRecipe::result, factory::create ); } diff --git a/net/minecraft/world/item/crafting/SmeltingRecipe.java b/net/minecraft/world/item/crafting/SmeltingRecipe.java index d2aa8c6f..4c61d848 100644 --- a/net/minecraft/world/item/crafting/SmeltingRecipe.java +++ b/net/minecraft/world/item/crafting/SmeltingRecipe.java @@ -1,20 +1,35 @@ package net.minecraft.world.item.crafting; +import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; -import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.item.Items; public class SmeltingRecipe extends AbstractCookingRecipe { public SmeltingRecipe(String group, CookingBookCategory category, Ingredient ingredient, ItemStack result, float experience, int cookingTime) { - super(RecipeType.SMELTING, group, category, ingredient, result, experience, cookingTime); + super(group, category, ingredient, result, experience, cookingTime); } @Override - public ItemStack getToastSymbol() { - return new ItemStack(Blocks.FURNACE); + protected Item furnaceIcon() { + return Items.FURNACE; } @Override - public RecipeSerializer getSerializer() { + public RecipeSerializer getSerializer() { return RecipeSerializer.SMELTING_RECIPE; } + + @Override + public RecipeType getType() { + return RecipeType.SMELTING; + } + + @Override + public RecipeBookCategory recipeBookCategory() { + return switch (this.category()) { + case BLOCKS -> RecipeBookCategories.FURNACE_BLOCKS; + case FOOD -> RecipeBookCategories.FURNACE_FOOD; + case MISC -> RecipeBookCategories.FURNACE_MISC; + }; + } } diff --git a/net/minecraft/world/item/crafting/SmithingRecipe.java b/net/minecraft/world/item/crafting/SmithingRecipe.java index d20145aa..c31d474c 100644 --- a/net/minecraft/world/item/crafting/SmithingRecipe.java +++ b/net/minecraft/world/item/crafting/SmithingRecipe.java @@ -1,27 +1,31 @@ package net.minecraft.world.item.crafting; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.level.block.Blocks; +import java.util.Optional; +import net.minecraft.world.level.Level; public interface SmithingRecipe extends Recipe { @Override - default RecipeType getType() { + default RecipeType getType() { return RecipeType.SMITHING; } @Override - default boolean canCraftInDimensions(int width, int height) { - return width >= 3 && height >= 1; + RecipeSerializer getSerializer(); + + default boolean matches(SmithingRecipeInput smithingRecipeInput, Level level) { + return Ingredient.testOptionalIngredient(this.templateIngredient(), smithingRecipeInput.template()) + && Ingredient.testOptionalIngredient(this.baseIngredient(), smithingRecipeInput.base()) + && Ingredient.testOptionalIngredient(this.additionIngredient(), smithingRecipeInput.addition()); } + Optional templateIngredient(); + + Optional baseIngredient(); + + Optional additionIngredient(); + @Override - default ItemStack getToastSymbol() { - return new ItemStack(Blocks.SMITHING_TABLE); + default RecipeBookCategory recipeBookCategory() { + return RecipeBookCategories.SMITHING; } - - boolean isTemplateIngredient(ItemStack stack); - - boolean isBaseIngredient(ItemStack stack); - - boolean isAdditionIngredient(ItemStack stack); } diff --git a/net/minecraft/world/item/crafting/SmithingTransformRecipe.java b/net/minecraft/world/item/crafting/SmithingTransformRecipe.java index ba976b27..53edc4d8 100644 --- a/net/minecraft/world/item/crafting/SmithingTransformRecipe.java +++ b/net/minecraft/world/item/crafting/SmithingTransformRecipe.java @@ -2,28 +2,31 @@ package net.minecraft.world.item.crafting; import com.mojang.serialization.MapCodec; import com.mojang.serialization.codecs.RecordCodecBuilder; -import java.util.stream.Stream; +import java.util.List; +import java.util.Optional; import net.minecraft.core.HolderLookup; import net.minecraft.network.RegistryFriendlyByteBuf; import net.minecraft.network.codec.StreamCodec; import net.minecraft.world.item.ItemStack; -import net.minecraft.world.level.Level; +import net.minecraft.world.item.Items; +import net.minecraft.world.item.crafting.display.RecipeDisplay; +import net.minecraft.world.item.crafting.display.SlotDisplay; +import net.minecraft.world.item.crafting.display.SmithingRecipeDisplay; +import org.jetbrains.annotations.Nullable; public class SmithingTransformRecipe implements SmithingRecipe { - final Ingredient template; - final Ingredient base; - final Ingredient addition; + final Optional template; + final Optional base; + final Optional addition; final ItemStack result; + @Nullable + private PlacementInfo placementInfo; - public SmithingTransformRecipe(Ingredient template, Ingredient base, Ingredient addition, ItemStack result) { - this.template = template; - this.base = base; - this.addition = addition; - this.result = result; - } - - public boolean matches(SmithingRecipeInput input, Level level) { - return this.template.test(input.template()) && this.base.test(input.base()) && this.addition.test(input.addition()); + public SmithingTransformRecipe(Optional optional, Optional optional2, Optional optional3, ItemStack itemStack) { + this.template = optional; + this.base = optional2; + this.addition = optional3; + this.result = itemStack; } public ItemStack assemble(SmithingRecipeInput input, HolderLookup.Provider registries) { @@ -33,47 +36,67 @@ public class SmithingTransformRecipe implements SmithingRecipe { } @Override - public ItemStack getResultItem(HolderLookup.Provider registries) { - return this.result; + public Optional templateIngredient() { + return this.template; } @Override - public boolean isTemplateIngredient(ItemStack stack) { - return this.template.test(stack); + public Optional baseIngredient() { + return this.base; } @Override - public boolean isBaseIngredient(ItemStack stack) { - return this.base.test(stack); + public Optional additionIngredient() { + return this.addition; } @Override - public boolean isAdditionIngredient(ItemStack stack) { - return this.addition.test(stack); - } - - @Override - public RecipeSerializer getSerializer() { + public RecipeSerializer getSerializer() { return RecipeSerializer.SMITHING_TRANSFORM; } @Override - public boolean isIncomplete() { - return Stream.of(this.template, this.base, this.addition).anyMatch(Ingredient::isEmpty); + public PlacementInfo placementInfo() { + if (this.placementInfo == null) { + this.placementInfo = PlacementInfo.createFromOptionals(List.of(this.template, this.base, this.addition)); + } + + return this.placementInfo; + } + + @Override + public List display() { + return List.of( + new SmithingRecipeDisplay( + Ingredient.optionalIngredientToDisplay(this.template), + Ingredient.optionalIngredientToDisplay(this.base), + Ingredient.optionalIngredientToDisplay(this.addition), + new SlotDisplay.ItemStackSlotDisplay(this.result), + new SlotDisplay.ItemSlotDisplay(Items.SMITHING_TABLE) + ) + ); } public static class Serializer implements RecipeSerializer { private static final MapCodec CODEC = RecordCodecBuilder.mapCodec( instance -> instance.group( - Ingredient.CODEC.fieldOf("template").forGetter(smithingTransformRecipe -> smithingTransformRecipe.template), - Ingredient.CODEC.fieldOf("base").forGetter(smithingTransformRecipe -> smithingTransformRecipe.base), - Ingredient.CODEC.fieldOf("addition").forGetter(smithingTransformRecipe -> smithingTransformRecipe.addition), + Ingredient.CODEC.optionalFieldOf("template").forGetter(smithingTransformRecipe -> smithingTransformRecipe.template), + Ingredient.CODEC.optionalFieldOf("base").forGetter(smithingTransformRecipe -> smithingTransformRecipe.base), + Ingredient.CODEC.optionalFieldOf("addition").forGetter(smithingTransformRecipe -> smithingTransformRecipe.addition), ItemStack.STRICT_CODEC.fieldOf("result").forGetter(smithingTransformRecipe -> smithingTransformRecipe.result) ) .apply(instance, SmithingTransformRecipe::new) ); - public static final StreamCodec STREAM_CODEC = StreamCodec.of( - SmithingTransformRecipe.Serializer::toNetwork, SmithingTransformRecipe.Serializer::fromNetwork + public static final StreamCodec STREAM_CODEC = StreamCodec.composite( + Ingredient.OPTIONAL_CONTENTS_STREAM_CODEC, + smithingTransformRecipe -> smithingTransformRecipe.template, + Ingredient.OPTIONAL_CONTENTS_STREAM_CODEC, + smithingTransformRecipe -> smithingTransformRecipe.base, + Ingredient.OPTIONAL_CONTENTS_STREAM_CODEC, + smithingTransformRecipe -> smithingTransformRecipe.addition, + ItemStack.STREAM_CODEC, + smithingTransformRecipe -> smithingTransformRecipe.result, + SmithingTransformRecipe::new ); @Override @@ -85,20 +108,5 @@ public class SmithingTransformRecipe implements SmithingRecipe { public StreamCodec streamCodec() { return STREAM_CODEC; } - - private static SmithingTransformRecipe fromNetwork(RegistryFriendlyByteBuf buffer) { - Ingredient ingredient = Ingredient.CONTENTS_STREAM_CODEC.decode(buffer); - Ingredient ingredient2 = Ingredient.CONTENTS_STREAM_CODEC.decode(buffer); - Ingredient ingredient3 = Ingredient.CONTENTS_STREAM_CODEC.decode(buffer); - ItemStack itemStack = ItemStack.STREAM_CODEC.decode(buffer); - return new SmithingTransformRecipe(ingredient, ingredient2, ingredient3, itemStack); - } - - private static void toNetwork(RegistryFriendlyByteBuf buffer, SmithingTransformRecipe recipe) { - Ingredient.CONTENTS_STREAM_CODEC.encode(buffer, recipe.template); - Ingredient.CONTENTS_STREAM_CODEC.encode(buffer, recipe.base); - Ingredient.CONTENTS_STREAM_CODEC.encode(buffer, recipe.addition); - ItemStack.STREAM_CODEC.encode(buffer, recipe.result); - } } } diff --git a/net/minecraft/world/item/crafting/SmithingTrimRecipe.java b/net/minecraft/world/item/crafting/SmithingTrimRecipe.java index cccf93c9..85cf6ff6 100644 --- a/net/minecraft/world/item/crafting/SmithingTrimRecipe.java +++ b/net/minecraft/world/item/crafting/SmithingTrimRecipe.java @@ -2,106 +2,121 @@ package net.minecraft.world.item.crafting; import com.mojang.serialization.MapCodec; import com.mojang.serialization.codecs.RecordCodecBuilder; +import java.util.List; import java.util.Optional; -import java.util.stream.Stream; import net.minecraft.core.Holder; import net.minecraft.core.HolderLookup; import net.minecraft.core.component.DataComponents; -import net.minecraft.core.registries.Registries; import net.minecraft.network.RegistryFriendlyByteBuf; import net.minecraft.network.codec.StreamCodec; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; -import net.minecraft.world.item.armortrim.ArmorTrim; -import net.minecraft.world.item.armortrim.TrimMaterial; -import net.minecraft.world.item.armortrim.TrimMaterials; -import net.minecraft.world.item.armortrim.TrimPattern; -import net.minecraft.world.item.armortrim.TrimPatterns; -import net.minecraft.world.level.Level; +import net.minecraft.world.item.crafting.display.RecipeDisplay; +import net.minecraft.world.item.crafting.display.SlotDisplay; +import net.minecraft.world.item.crafting.display.SmithingRecipeDisplay; +import net.minecraft.world.item.equipment.trim.ArmorTrim; +import net.minecraft.world.item.equipment.trim.TrimMaterial; +import net.minecraft.world.item.equipment.trim.TrimMaterials; +import net.minecraft.world.item.equipment.trim.TrimPattern; +import net.minecraft.world.item.equipment.trim.TrimPatterns; +import org.jetbrains.annotations.Nullable; public class SmithingTrimRecipe implements SmithingRecipe { - final Ingredient template; - final Ingredient base; - final Ingredient addition; + final Optional template; + final Optional base; + final Optional addition; + @Nullable + private PlacementInfo placementInfo; - public SmithingTrimRecipe(Ingredient template, Ingredient base, Ingredient addition) { - this.template = template; - this.base = base; - this.addition = addition; - } - - public boolean matches(SmithingRecipeInput input, Level level) { - return this.template.test(input.template()) && this.base.test(input.base()) && this.addition.test(input.addition()); + public SmithingTrimRecipe(Optional optional, Optional optional2, Optional optional3) { + this.template = optional; + this.base = optional2; + this.addition = optional3; } public ItemStack assemble(SmithingRecipeInput input, HolderLookup.Provider registries) { - ItemStack itemStack = input.base(); - if (this.base.test(itemStack)) { - Optional> optional = TrimMaterials.getFromIngredient(registries, input.addition()); - Optional> optional2 = TrimPatterns.getFromTemplate(registries, input.template()); - if (optional.isPresent() && optional2.isPresent()) { - ArmorTrim armorTrim = itemStack.get(DataComponents.TRIM); - if (armorTrim != null && armorTrim.hasPatternAndMaterial((Holder)optional2.get(), (Holder)optional.get())) { - return ItemStack.EMPTY; - } - - ItemStack itemStack2 = itemStack.copyWithCount(1); - itemStack2.set(DataComponents.TRIM, new ArmorTrim((Holder)optional.get(), (Holder)optional2.get())); - return itemStack2; - } - } - - return ItemStack.EMPTY; + return applyTrim(registries, input.base(), input.addition(), input.template()); } - @Override - public ItemStack getResultItem(HolderLookup.Provider registries) { - ItemStack itemStack = new ItemStack(Items.IRON_CHESTPLATE); - Optional> optional = registries.lookupOrThrow(Registries.TRIM_PATTERN).listElements().findFirst(); - Optional> optional2 = registries.lookupOrThrow(Registries.TRIM_MATERIAL).get(TrimMaterials.REDSTONE); + public static ItemStack applyTrim(HolderLookup.Provider provider, ItemStack itemStack, ItemStack itemStack2, ItemStack itemStack3) { + Optional> optional = TrimMaterials.getFromIngredient(provider, itemStack2); + Optional> optional2 = TrimPatterns.getFromTemplate(provider, itemStack3); if (optional.isPresent() && optional2.isPresent()) { - itemStack.set(DataComponents.TRIM, new ArmorTrim((Holder)optional2.get(), (Holder)optional.get())); + ArmorTrim armorTrim = itemStack.get(DataComponents.TRIM); + if (armorTrim != null && armorTrim.hasPatternAndMaterial((Holder)optional2.get(), (Holder)optional.get())) { + return ItemStack.EMPTY; + } else { + ItemStack itemStack4 = itemStack.copyWithCount(1); + itemStack4.set(DataComponents.TRIM, new ArmorTrim((Holder)optional.get(), (Holder)optional2.get())); + return itemStack4; + } + } else { + return ItemStack.EMPTY; } - - return itemStack; } @Override - public boolean isTemplateIngredient(ItemStack stack) { - return this.template.test(stack); + public Optional templateIngredient() { + return this.template; } @Override - public boolean isBaseIngredient(ItemStack stack) { - return this.base.test(stack); + public Optional baseIngredient() { + return this.base; } @Override - public boolean isAdditionIngredient(ItemStack stack) { - return this.addition.test(stack); + public Optional additionIngredient() { + return this.addition; } @Override - public RecipeSerializer getSerializer() { + public RecipeSerializer getSerializer() { return RecipeSerializer.SMITHING_TRIM; } @Override - public boolean isIncomplete() { - return Stream.of(this.template, this.base, this.addition).anyMatch(Ingredient::isEmpty); + public PlacementInfo placementInfo() { + if (this.placementInfo == null) { + this.placementInfo = PlacementInfo.createFromOptionals(List.of(this.template, this.base, this.addition)); + } + + return this.placementInfo; + } + + @Override + public List display() { + SlotDisplay slotDisplay = Ingredient.optionalIngredientToDisplay(this.base); + SlotDisplay slotDisplay2 = Ingredient.optionalIngredientToDisplay(this.addition); + SlotDisplay slotDisplay3 = Ingredient.optionalIngredientToDisplay(this.template); + return List.of( + new SmithingRecipeDisplay( + slotDisplay3, + slotDisplay, + slotDisplay2, + new SlotDisplay.SmithingTrimDemoSlotDisplay(slotDisplay, slotDisplay2, slotDisplay3), + new SlotDisplay.ItemSlotDisplay(Items.SMITHING_TABLE) + ) + ); } public static class Serializer implements RecipeSerializer { private static final MapCodec CODEC = RecordCodecBuilder.mapCodec( instance -> instance.group( - Ingredient.CODEC.fieldOf("template").forGetter(smithingTrimRecipe -> smithingTrimRecipe.template), - Ingredient.CODEC.fieldOf("base").forGetter(smithingTrimRecipe -> smithingTrimRecipe.base), - Ingredient.CODEC.fieldOf("addition").forGetter(smithingTrimRecipe -> smithingTrimRecipe.addition) + Ingredient.CODEC.optionalFieldOf("template").forGetter(smithingTrimRecipe -> smithingTrimRecipe.template), + Ingredient.CODEC.optionalFieldOf("base").forGetter(smithingTrimRecipe -> smithingTrimRecipe.base), + Ingredient.CODEC.optionalFieldOf("addition").forGetter(smithingTrimRecipe -> smithingTrimRecipe.addition) ) .apply(instance, SmithingTrimRecipe::new) ); - public static final StreamCodec STREAM_CODEC = StreamCodec.of( - SmithingTrimRecipe.Serializer::toNetwork, SmithingTrimRecipe.Serializer::fromNetwork + public static final StreamCodec STREAM_CODEC = StreamCodec.composite( + Ingredient.OPTIONAL_CONTENTS_STREAM_CODEC, + smithingTrimRecipe -> smithingTrimRecipe.template, + Ingredient.OPTIONAL_CONTENTS_STREAM_CODEC, + smithingTrimRecipe -> smithingTrimRecipe.base, + Ingredient.OPTIONAL_CONTENTS_STREAM_CODEC, + smithingTrimRecipe -> smithingTrimRecipe.addition, + SmithingTrimRecipe::new ); @Override @@ -113,18 +128,5 @@ public class SmithingTrimRecipe implements SmithingRecipe { public StreamCodec streamCodec() { return STREAM_CODEC; } - - private static SmithingTrimRecipe fromNetwork(RegistryFriendlyByteBuf buffer) { - Ingredient ingredient = Ingredient.CONTENTS_STREAM_CODEC.decode(buffer); - Ingredient ingredient2 = Ingredient.CONTENTS_STREAM_CODEC.decode(buffer); - Ingredient ingredient3 = Ingredient.CONTENTS_STREAM_CODEC.decode(buffer); - return new SmithingTrimRecipe(ingredient, ingredient2, ingredient3); - } - - private static void toNetwork(RegistryFriendlyByteBuf buffer, SmithingTrimRecipe recipe) { - Ingredient.CONTENTS_STREAM_CODEC.encode(buffer, recipe.template); - Ingredient.CONTENTS_STREAM_CODEC.encode(buffer, recipe.base); - Ingredient.CONTENTS_STREAM_CODEC.encode(buffer, recipe.addition); - } } } diff --git a/net/minecraft/world/item/crafting/SmokingRecipe.java b/net/minecraft/world/item/crafting/SmokingRecipe.java index fe074ad9..7119922e 100644 --- a/net/minecraft/world/item/crafting/SmokingRecipe.java +++ b/net/minecraft/world/item/crafting/SmokingRecipe.java @@ -1,20 +1,31 @@ package net.minecraft.world.item.crafting; +import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; -import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.item.Items; public class SmokingRecipe extends AbstractCookingRecipe { public SmokingRecipe(String group, CookingBookCategory category, Ingredient ingredient, ItemStack result, float experience, int cookingTime) { - super(RecipeType.SMOKING, group, category, ingredient, result, experience, cookingTime); + super(group, category, ingredient, result, experience, cookingTime); } @Override - public ItemStack getToastSymbol() { - return new ItemStack(Blocks.SMOKER); + protected Item furnaceIcon() { + return Items.SMOKER; } @Override - public RecipeSerializer getSerializer() { + public RecipeType getType() { + return RecipeType.SMOKING; + } + + @Override + public RecipeSerializer getSerializer() { return RecipeSerializer.SMOKING_RECIPE; } + + @Override + public RecipeBookCategory recipeBookCategory() { + return RecipeBookCategories.SMOKER_FOOD; + } } diff --git a/net/minecraft/world/item/crafting/StonecutterRecipe.java b/net/minecraft/world/item/crafting/StonecutterRecipe.java index 78e180bc..93b18812 100644 --- a/net/minecraft/world/item/crafting/StonecutterRecipe.java +++ b/net/minecraft/world/item/crafting/StonecutterRecipe.java @@ -1,20 +1,38 @@ package net.minecraft.world.item.crafting; +import java.util.List; import net.minecraft.world.item.ItemStack; -import net.minecraft.world.level.Level; -import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.item.Items; +import net.minecraft.world.item.crafting.display.RecipeDisplay; +import net.minecraft.world.item.crafting.display.SlotDisplay; +import net.minecraft.world.item.crafting.display.StonecutterRecipeDisplay; public class StonecutterRecipe extends SingleItemRecipe { public StonecutterRecipe(String group, Ingredient ingredient, ItemStack result) { - super(RecipeType.STONECUTTING, RecipeSerializer.STONECUTTER, group, ingredient, result); - } - - public boolean matches(SingleRecipeInput input, Level level) { - return this.ingredient.test(input.item()); + super(group, ingredient, result); } @Override - public ItemStack getToastSymbol() { - return new ItemStack(Blocks.STONECUTTER); + public RecipeType getType() { + return RecipeType.STONECUTTING; + } + + @Override + public RecipeSerializer getSerializer() { + return RecipeSerializer.STONECUTTER; + } + + @Override + public List display() { + return List.of(new StonecutterRecipeDisplay(this.input().display(), this.resultDisplay(), new SlotDisplay.ItemSlotDisplay(Items.STONECUTTER))); + } + + public SlotDisplay resultDisplay() { + return new SlotDisplay.ItemStackSlotDisplay(this.result()); + } + + @Override + public RecipeBookCategory recipeBookCategory() { + return RecipeBookCategories.STONECUTTER; } } diff --git a/net/minecraft/world/item/crafting/SuspiciousStewRecipe.java b/net/minecraft/world/item/crafting/SuspiciousStewRecipe.java deleted file mode 100644 index 47ef2eaf..00000000 --- a/net/minecraft/world/item/crafting/SuspiciousStewRecipe.java +++ /dev/null @@ -1,71 +0,0 @@ -package net.minecraft.world.item.crafting; - -import net.minecraft.core.HolderLookup; -import net.minecraft.core.component.DataComponents; -import net.minecraft.tags.ItemTags; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.Items; -import net.minecraft.world.level.Level; -import net.minecraft.world.level.block.Blocks; -import net.minecraft.world.level.block.SuspiciousEffectHolder; - -public class SuspiciousStewRecipe extends CustomRecipe { - public SuspiciousStewRecipe(CraftingBookCategory category) { - super(category); - } - - public boolean matches(CraftingInput input, Level level) { - boolean bl = false; - boolean bl2 = false; - boolean bl3 = false; - boolean bl4 = false; - - for (int i = 0; i < input.size(); i++) { - ItemStack itemStack = input.getItem(i); - if (!itemStack.isEmpty()) { - if (itemStack.is(Blocks.BROWN_MUSHROOM.asItem()) && !bl3) { - bl3 = true; - } else if (itemStack.is(Blocks.RED_MUSHROOM.asItem()) && !bl2) { - bl2 = true; - } else if (itemStack.is(ItemTags.SMALL_FLOWERS) && !bl) { - bl = true; - } else { - if (!itemStack.is(Items.BOWL) || bl4) { - return false; - } - - bl4 = true; - } - } - } - - return bl && bl3 && bl2 && bl4; - } - - public ItemStack assemble(CraftingInput input, HolderLookup.Provider registries) { - ItemStack itemStack = new ItemStack(Items.SUSPICIOUS_STEW, 1); - - for (int i = 0; i < input.size(); i++) { - ItemStack itemStack2 = input.getItem(i); - if (!itemStack2.isEmpty()) { - SuspiciousEffectHolder suspiciousEffectHolder = SuspiciousEffectHolder.tryGet(itemStack2.getItem()); - if (suspiciousEffectHolder != null) { - itemStack.set(DataComponents.SUSPICIOUS_STEW_EFFECTS, suspiciousEffectHolder.getSuspiciousEffects()); - break; - } - } - } - - return itemStack; - } - - @Override - public boolean canCraftInDimensions(int width, int height) { - return width >= 2 && height >= 2; - } - - @Override - public RecipeSerializer getSerializer() { - return RecipeSerializer.SUSPICIOUS_STEW; - } -} diff --git a/net/minecraft/world/item/crafting/TippedArrowRecipe.java b/net/minecraft/world/item/crafting/TippedArrowRecipe.java index 345b230b..0edeb5d4 100644 --- a/net/minecraft/world/item/crafting/TippedArrowRecipe.java +++ b/net/minecraft/world/item/crafting/TippedArrowRecipe.java @@ -12,7 +12,7 @@ public class TippedArrowRecipe extends CustomRecipe { } public boolean matches(CraftingInput input, Level level) { - if (input.width() == 3 && input.height() == 3) { + if (input.width() == 3 && input.height() == 3 && input.ingredientCount() == 9) { for (int i = 0; i < input.height(); i++) { for (int j = 0; j < input.width(); j++) { ItemStack itemStack = input.getItem(j, i); @@ -48,12 +48,7 @@ public class TippedArrowRecipe extends CustomRecipe { } @Override - public boolean canCraftInDimensions(int width, int height) { - return width >= 3 && height >= 3; - } - - @Override - public RecipeSerializer getSerializer() { + public RecipeSerializer getSerializer() { return RecipeSerializer.TIPPED_ARROW; } } diff --git a/net/minecraft/world/item/crafting/TransmuteRecipe.java b/net/minecraft/world/item/crafting/TransmuteRecipe.java new file mode 100644 index 00000000..a7b01d5e --- /dev/null +++ b/net/minecraft/world/item/crafting/TransmuteRecipe.java @@ -0,0 +1,146 @@ +package net.minecraft.world.item.crafting; + +import com.mojang.serialization.Codec; +import com.mojang.serialization.MapCodec; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import java.util.List; +import net.minecraft.core.Holder; +import net.minecraft.core.HolderLookup; +import net.minecraft.core.registries.Registries; +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.world.item.crafting.display.RecipeDisplay; +import net.minecraft.world.item.crafting.display.ShapelessCraftingRecipeDisplay; +import net.minecraft.world.item.crafting.display.SlotDisplay; +import net.minecraft.world.level.Level; +import org.jetbrains.annotations.Nullable; + +public class TransmuteRecipe implements CraftingRecipe { + final String group; + final CraftingBookCategory category; + final Ingredient input; + final Ingredient material; + final Holder result; + @Nullable + private PlacementInfo placementInfo; + + public TransmuteRecipe(String string, CraftingBookCategory craftingBookCategory, Ingredient ingredient, Ingredient ingredient2, Holder holder) { + this.group = string; + this.category = craftingBookCategory; + this.input = ingredient; + this.material = ingredient2; + this.result = holder; + } + + public boolean matches(CraftingInput craftingInput, Level level) { + if (craftingInput.ingredientCount() != 2) { + return false; + } else { + boolean bl = false; + boolean bl2 = false; + + for (int i = 0; i < craftingInput.size(); i++) { + ItemStack itemStack = craftingInput.getItem(i); + if (!itemStack.isEmpty()) { + if (!bl && this.input.test(itemStack) && itemStack.getItem() != this.result.value()) { + bl = true; + } else { + if (bl2 || !this.material.test(itemStack)) { + return false; + } + + bl2 = true; + } + } + } + + return bl && bl2; + } + } + + public ItemStack assemble(CraftingInput craftingInput, HolderLookup.Provider provider) { + ItemStack itemStack = ItemStack.EMPTY; + + for (int i = 0; i < craftingInput.size(); i++) { + ItemStack itemStack2 = craftingInput.getItem(i); + if (!itemStack2.isEmpty() && this.input.test(itemStack2) && itemStack2.getItem() != this.result.value()) { + itemStack = itemStack2; + } + } + + return itemStack.transmuteCopy(this.result.value(), 1); + } + + @Override + public List display() { + return List.of( + new ShapelessCraftingRecipeDisplay( + List.of(this.input.display(), this.material.display()), new SlotDisplay.ItemSlotDisplay(this.result), new SlotDisplay.ItemSlotDisplay(Items.CRAFTING_TABLE) + ) + ); + } + + @Override + public RecipeSerializer getSerializer() { + return RecipeSerializer.TRANSMUTE; + } + + @Override + public String group() { + return this.group; + } + + @Override + public PlacementInfo placementInfo() { + if (this.placementInfo == null) { + this.placementInfo = PlacementInfo.create(List.of(this.input, this.material)); + } + + return this.placementInfo; + } + + @Override + public CraftingBookCategory category() { + return this.category; + } + + public static class Serializer implements RecipeSerializer { + private static final MapCodec CODEC = RecordCodecBuilder.mapCodec( + instance -> instance.group( + Codec.STRING.optionalFieldOf("group", "").forGetter(transmuteRecipe -> transmuteRecipe.group), + CraftingBookCategory.CODEC.fieldOf("category").orElse(CraftingBookCategory.MISC).forGetter(transmuteRecipe -> transmuteRecipe.category), + Ingredient.CODEC.fieldOf("input").forGetter(transmuteRecipe -> transmuteRecipe.input), + Ingredient.CODEC.fieldOf("material").forGetter(transmuteRecipe -> transmuteRecipe.material), + Item.CODEC.fieldOf("result").forGetter(transmuteRecipe -> transmuteRecipe.result) + ) + .apply(instance, TransmuteRecipe::new) + ); + public static final StreamCodec STREAM_CODEC = StreamCodec.composite( + ByteBufCodecs.STRING_UTF8, + transmuteRecipe -> transmuteRecipe.group, + CraftingBookCategory.STREAM_CODEC, + transmuteRecipe -> transmuteRecipe.category, + Ingredient.CONTENTS_STREAM_CODEC, + transmuteRecipe -> transmuteRecipe.input, + Ingredient.CONTENTS_STREAM_CODEC, + transmuteRecipe -> transmuteRecipe.material, + ByteBufCodecs.holderRegistry(Registries.ITEM), + transmuteRecipe -> transmuteRecipe.result, + TransmuteRecipe::new + ); + + @Override + public MapCodec codec() { + return CODEC; + } + + @Override + public StreamCodec streamCodec() { + return STREAM_CODEC; + } + } +} diff --git a/net/minecraft/world/item/crafting/display/DisplayContentsFactory.java b/net/minecraft/world/item/crafting/display/DisplayContentsFactory.java new file mode 100644 index 00000000..99339910 --- /dev/null +++ b/net/minecraft/world/item/crafting/display/DisplayContentsFactory.java @@ -0,0 +1,24 @@ +package net.minecraft.world.item.crafting.display; + +import java.util.List; +import net.minecraft.core.Holder; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; + +public interface DisplayContentsFactory { + public interface ForRemainders extends DisplayContentsFactory { + T addRemainder(T object, List list); + } + + public interface ForStacks extends DisplayContentsFactory { + default T forStack(Holder holder) { + return this.forStack(new ItemStack(holder)); + } + + default T forStack(Item item) { + return this.forStack(new ItemStack(item)); + } + + T forStack(ItemStack itemStack); + } +} diff --git a/net/minecraft/world/item/crafting/display/FurnaceRecipeDisplay.java b/net/minecraft/world/item/crafting/display/FurnaceRecipeDisplay.java new file mode 100644 index 00000000..ccee9fae --- /dev/null +++ b/net/minecraft/world/item/crafting/display/FurnaceRecipeDisplay.java @@ -0,0 +1,50 @@ +package net.minecraft.world.item.crafting.display; + +import com.mojang.serialization.Codec; +import com.mojang.serialization.MapCodec; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.world.flag.FeatureFlagSet; + +public record FurnaceRecipeDisplay(SlotDisplay ingredient, SlotDisplay fuel, SlotDisplay result, SlotDisplay craftingStation, int duration, float experience) + implements RecipeDisplay { + public static final MapCodec MAP_CODEC = RecordCodecBuilder.mapCodec( + instance -> instance.group( + SlotDisplay.CODEC.fieldOf("ingredient").forGetter(FurnaceRecipeDisplay::ingredient), + SlotDisplay.CODEC.fieldOf("fuel").forGetter(FurnaceRecipeDisplay::fuel), + SlotDisplay.CODEC.fieldOf("result").forGetter(FurnaceRecipeDisplay::result), + SlotDisplay.CODEC.fieldOf("crafting_station").forGetter(FurnaceRecipeDisplay::craftingStation), + Codec.INT.fieldOf("duration").forGetter(FurnaceRecipeDisplay::duration), + Codec.FLOAT.fieldOf("experience").forGetter(FurnaceRecipeDisplay::experience) + ) + .apply(instance, FurnaceRecipeDisplay::new) + ); + public static final StreamCodec STREAM_CODEC = StreamCodec.composite( + SlotDisplay.STREAM_CODEC, + FurnaceRecipeDisplay::ingredient, + SlotDisplay.STREAM_CODEC, + FurnaceRecipeDisplay::fuel, + SlotDisplay.STREAM_CODEC, + FurnaceRecipeDisplay::result, + SlotDisplay.STREAM_CODEC, + FurnaceRecipeDisplay::craftingStation, + ByteBufCodecs.VAR_INT, + FurnaceRecipeDisplay::duration, + ByteBufCodecs.FLOAT, + FurnaceRecipeDisplay::experience, + FurnaceRecipeDisplay::new + ); + public static final RecipeDisplay.Type TYPE = new RecipeDisplay.Type<>(MAP_CODEC, STREAM_CODEC); + + @Override + public RecipeDisplay.Type type() { + return TYPE; + } + + @Override + public boolean isEnabled(FeatureFlagSet featureFlagSet) { + return this.ingredient.isEnabled(featureFlagSet) && this.fuel().isEnabled(featureFlagSet) && RecipeDisplay.super.isEnabled(featureFlagSet); + } +} diff --git a/net/minecraft/world/item/crafting/display/RecipeDisplay.java b/net/minecraft/world/item/crafting/display/RecipeDisplay.java new file mode 100644 index 00000000..59c63d22 --- /dev/null +++ b/net/minecraft/world/item/crafting/display/RecipeDisplay.java @@ -0,0 +1,29 @@ +package net.minecraft.world.item.crafting.display; + +import com.mojang.serialization.Codec; +import com.mojang.serialization.MapCodec; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.core.registries.Registries; +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.world.flag.FeatureFlagSet; + +public interface RecipeDisplay { + Codec CODEC = BuiltInRegistries.RECIPE_DISPLAY.byNameCodec().dispatch(RecipeDisplay::type, RecipeDisplay.Type::codec); + StreamCodec STREAM_CODEC = ByteBufCodecs.registry(Registries.RECIPE_DISPLAY) + .dispatch(RecipeDisplay::type, RecipeDisplay.Type::streamCodec); + + SlotDisplay result(); + + SlotDisplay craftingStation(); + + RecipeDisplay.Type type(); + + default boolean isEnabled(FeatureFlagSet featureFlagSet) { + return this.result().isEnabled(featureFlagSet) && this.craftingStation().isEnabled(featureFlagSet); + } + + public record Type(MapCodec codec, StreamCodec streamCodec) { + } +} diff --git a/net/minecraft/world/item/crafting/display/RecipeDisplayEntry.java b/net/minecraft/world/item/crafting/display/RecipeDisplayEntry.java new file mode 100644 index 00000000..6370e859 --- /dev/null +++ b/net/minecraft/world/item/crafting/display/RecipeDisplayEntry.java @@ -0,0 +1,49 @@ +package net.minecraft.world.item.crafting.display; + +import java.util.List; +import java.util.Optional; +import java.util.OptionalInt; +import net.minecraft.core.Holder; +import net.minecraft.core.registries.Registries; +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.util.context.ContextMap; +import net.minecraft.world.entity.player.StackedContents; +import net.minecraft.world.entity.player.StackedItemContents; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.Ingredient; +import net.minecraft.world.item.crafting.PlacementInfo; +import net.minecraft.world.item.crafting.RecipeBookCategory; + +public record RecipeDisplayEntry( + RecipeDisplayId id, RecipeDisplay display, OptionalInt group, RecipeBookCategory category, Optional> craftingRequirements +) { + public static final StreamCodec STREAM_CODEC = StreamCodec.composite( + RecipeDisplayId.STREAM_CODEC, + RecipeDisplayEntry::id, + RecipeDisplay.STREAM_CODEC, + RecipeDisplayEntry::display, + ByteBufCodecs.OPTIONAL_VAR_INT, + RecipeDisplayEntry::group, + ByteBufCodecs.registry(Registries.RECIPE_BOOK_CATEGORY), + RecipeDisplayEntry::category, + Ingredient.CONTENTS_STREAM_CODEC.apply(ByteBufCodecs.list()).apply(ByteBufCodecs::optional), + RecipeDisplayEntry::craftingRequirements, + RecipeDisplayEntry::new + ); + + public List resultItems(ContextMap contextMap) { + return this.display.result().resolveForStacks(contextMap); + } + + public boolean canCraft(StackedItemContents stackedItemContents) { + if (this.craftingRequirements.isEmpty()) { + return false; + } else { + List>> list = ((List)this.craftingRequirements.get()).stream().map(PlacementInfo::ingredientToContents).toList(); + return stackedItemContents.canCraft(list, null); + } + } +} diff --git a/net/minecraft/world/item/crafting/display/RecipeDisplayId.java b/net/minecraft/world/item/crafting/display/RecipeDisplayId.java new file mode 100644 index 00000000..d16fe894 --- /dev/null +++ b/net/minecraft/world/item/crafting/display/RecipeDisplayId.java @@ -0,0 +1,11 @@ +package net.minecraft.world.item.crafting.display; + +import io.netty.buffer.ByteBuf; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.network.codec.StreamCodec; + +public record RecipeDisplayId(int index) { + public static final StreamCodec STREAM_CODEC = StreamCodec.composite( + ByteBufCodecs.VAR_INT, RecipeDisplayId::index, RecipeDisplayId::new + ); +} diff --git a/net/minecraft/world/item/crafting/display/RecipeDisplays.java b/net/minecraft/world/item/crafting/display/RecipeDisplays.java new file mode 100644 index 00000000..b3bcadb3 --- /dev/null +++ b/net/minecraft/world/item/crafting/display/RecipeDisplays.java @@ -0,0 +1,13 @@ +package net.minecraft.world.item.crafting.display; + +import net.minecraft.core.Registry; + +public class RecipeDisplays { + public static RecipeDisplay.Type bootstrap(Registry> registry) { + Registry.register(registry, "crafting_shapeless", ShapelessCraftingRecipeDisplay.TYPE); + Registry.register(registry, "crafting_shaped", ShapedCraftingRecipeDisplay.TYPE); + Registry.register(registry, "furnace", FurnaceRecipeDisplay.TYPE); + Registry.register(registry, "stonecutter", StonecutterRecipeDisplay.TYPE); + return Registry.register(registry, "smithing", SmithingRecipeDisplay.TYPE); + } +} diff --git a/net/minecraft/world/item/crafting/display/ShapedCraftingRecipeDisplay.java b/net/minecraft/world/item/crafting/display/ShapedCraftingRecipeDisplay.java new file mode 100644 index 00000000..0e0f4a40 --- /dev/null +++ b/net/minecraft/world/item/crafting/display/ShapedCraftingRecipeDisplay.java @@ -0,0 +1,60 @@ +package net.minecraft.world.item.crafting.display; + +import com.mojang.serialization.Codec; +import com.mojang.serialization.MapCodec; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import java.util.List; +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.world.flag.FeatureFlagSet; + +public record ShapedCraftingRecipeDisplay(int width, int height, List ingredients, SlotDisplay result, SlotDisplay craftingStation) + implements RecipeDisplay { + public static final MapCodec MAP_CODEC = RecordCodecBuilder.mapCodec( + instance -> instance.group( + Codec.INT.fieldOf("width").forGetter(ShapedCraftingRecipeDisplay::width), + Codec.INT.fieldOf("height").forGetter(ShapedCraftingRecipeDisplay::height), + SlotDisplay.CODEC.listOf().fieldOf("ingredients").forGetter(ShapedCraftingRecipeDisplay::ingredients), + SlotDisplay.CODEC.fieldOf("result").forGetter(ShapedCraftingRecipeDisplay::result), + SlotDisplay.CODEC.fieldOf("crafting_station").forGetter(ShapedCraftingRecipeDisplay::craftingStation) + ) + .apply(instance, ShapedCraftingRecipeDisplay::new) + ); + public static final StreamCodec STREAM_CODEC = StreamCodec.composite( + ByteBufCodecs.VAR_INT, + ShapedCraftingRecipeDisplay::width, + ByteBufCodecs.VAR_INT, + ShapedCraftingRecipeDisplay::height, + SlotDisplay.STREAM_CODEC.apply(ByteBufCodecs.list()), + ShapedCraftingRecipeDisplay::ingredients, + SlotDisplay.STREAM_CODEC, + ShapedCraftingRecipeDisplay::result, + SlotDisplay.STREAM_CODEC, + ShapedCraftingRecipeDisplay::craftingStation, + ShapedCraftingRecipeDisplay::new + ); + public static final RecipeDisplay.Type TYPE = new RecipeDisplay.Type<>(MAP_CODEC, STREAM_CODEC); + + public ShapedCraftingRecipeDisplay(int width, int height, List ingredients, SlotDisplay result, SlotDisplay craftingStation) { + if (ingredients.size() != width * height) { + throw new IllegalArgumentException("Invalid shaped recipe display contents"); + } else { + this.width = width; + this.height = height; + this.ingredients = ingredients; + this.result = result; + this.craftingStation = craftingStation; + } + } + + @Override + public RecipeDisplay.Type type() { + return TYPE; + } + + @Override + public boolean isEnabled(FeatureFlagSet featureFlagSet) { + return this.ingredients.stream().allMatch(slotDisplay -> slotDisplay.isEnabled(featureFlagSet)) && RecipeDisplay.super.isEnabled(featureFlagSet); + } +} diff --git a/net/minecraft/world/item/crafting/display/ShapelessCraftingRecipeDisplay.java b/net/minecraft/world/item/crafting/display/ShapelessCraftingRecipeDisplay.java new file mode 100644 index 00000000..7a0f0e89 --- /dev/null +++ b/net/minecraft/world/item/crafting/display/ShapelessCraftingRecipeDisplay.java @@ -0,0 +1,40 @@ +package net.minecraft.world.item.crafting.display; + +import com.mojang.serialization.MapCodec; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import java.util.List; +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.world.flag.FeatureFlagSet; + +public record ShapelessCraftingRecipeDisplay(List ingredients, SlotDisplay result, SlotDisplay craftingStation) implements RecipeDisplay { + public static final MapCodec MAP_CODEC = RecordCodecBuilder.mapCodec( + instance -> instance.group( + SlotDisplay.CODEC.listOf().fieldOf("ingredients").forGetter(ShapelessCraftingRecipeDisplay::ingredients), + SlotDisplay.CODEC.fieldOf("result").forGetter(ShapelessCraftingRecipeDisplay::result), + SlotDisplay.CODEC.fieldOf("crafting_station").forGetter(ShapelessCraftingRecipeDisplay::craftingStation) + ) + .apply(instance, ShapelessCraftingRecipeDisplay::new) + ); + public static final StreamCodec STREAM_CODEC = StreamCodec.composite( + SlotDisplay.STREAM_CODEC.apply(ByteBufCodecs.list()), + ShapelessCraftingRecipeDisplay::ingredients, + SlotDisplay.STREAM_CODEC, + ShapelessCraftingRecipeDisplay::result, + SlotDisplay.STREAM_CODEC, + ShapelessCraftingRecipeDisplay::craftingStation, + ShapelessCraftingRecipeDisplay::new + ); + public static final RecipeDisplay.Type TYPE = new RecipeDisplay.Type<>(MAP_CODEC, STREAM_CODEC); + + @Override + public RecipeDisplay.Type type() { + return TYPE; + } + + @Override + public boolean isEnabled(FeatureFlagSet featureFlagSet) { + return this.ingredients.stream().allMatch(slotDisplay -> slotDisplay.isEnabled(featureFlagSet)) && RecipeDisplay.super.isEnabled(featureFlagSet); + } +} diff --git a/net/minecraft/world/item/crafting/display/SlotDisplay.java b/net/minecraft/world/item/crafting/display/SlotDisplay.java new file mode 100644 index 00000000..d8fa7269 --- /dev/null +++ b/net/minecraft/world/item/crafting/display/SlotDisplay.java @@ -0,0 +1,318 @@ +package net.minecraft.world.item.crafting.display; + +import com.mojang.serialization.Codec; +import com.mojang.serialization.MapCodec; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import java.util.List; +import java.util.stream.Stream; +import net.minecraft.Util; +import net.minecraft.core.Holder; +import net.minecraft.core.HolderLookup; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.core.registries.Registries; +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.tags.TagKey; +import net.minecraft.util.RandomSource; +import net.minecraft.util.context.ContextMap; +import net.minecraft.world.flag.FeatureFlagSet; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.SmithingTrimRecipe; +import net.minecraft.world.level.block.entity.FuelValues; + +public interface SlotDisplay { + Codec CODEC = BuiltInRegistries.SLOT_DISPLAY.byNameCodec().dispatch(SlotDisplay::type, SlotDisplay.Type::codec); + StreamCodec STREAM_CODEC = ByteBufCodecs.registry(Registries.SLOT_DISPLAY) + .dispatch(SlotDisplay::type, SlotDisplay.Type::streamCodec); + + Stream resolve(ContextMap contextMap, DisplayContentsFactory displayContentsFactory); + + SlotDisplay.Type type(); + + default boolean isEnabled(FeatureFlagSet featureFlagSet) { + return true; + } + + default List resolveForStacks(ContextMap contextMap) { + return this.resolve(contextMap, SlotDisplay.ItemStackContentsFactory.INSTANCE).toList(); + } + + default ItemStack resolveForFirstStack(ContextMap contextMap) { + return (ItemStack)this.resolve(contextMap, SlotDisplay.ItemStackContentsFactory.INSTANCE).findFirst().orElse(ItemStack.EMPTY); + } + + public static class AnyFuel implements SlotDisplay { + public static final SlotDisplay.AnyFuel INSTANCE = new SlotDisplay.AnyFuel(); + public static final MapCodec MAP_CODEC = MapCodec.unit(INSTANCE); + public static final StreamCodec STREAM_CODEC = StreamCodec.unit(INSTANCE); + public static final SlotDisplay.Type TYPE = new SlotDisplay.Type<>(MAP_CODEC, STREAM_CODEC); + + private AnyFuel() { + } + + @Override + public SlotDisplay.Type type() { + return TYPE; + } + + public String toString() { + return ""; + } + + @Override + public Stream resolve(ContextMap contextMap, DisplayContentsFactory displayContentsFactory) { + if (displayContentsFactory instanceof DisplayContentsFactory.ForStacks forStacks) { + FuelValues fuelValues = contextMap.getOptional(SlotDisplayContext.FUEL_VALUES); + if (fuelValues != null) { + return fuelValues.fuelItems().stream().map(forStacks::forStack); + } + } + + return Stream.empty(); + } + } + + public record Composite(List contents) implements SlotDisplay { + public static final MapCodec MAP_CODEC = RecordCodecBuilder.mapCodec( + instance -> instance.group(SlotDisplay.CODEC.listOf().fieldOf("contents").forGetter(SlotDisplay.Composite::contents)) + .apply(instance, SlotDisplay.Composite::new) + ); + public static final StreamCodec STREAM_CODEC = StreamCodec.composite( + SlotDisplay.STREAM_CODEC.apply(ByteBufCodecs.list()), SlotDisplay.Composite::contents, SlotDisplay.Composite::new + ); + public static final SlotDisplay.Type TYPE = new SlotDisplay.Type<>(MAP_CODEC, STREAM_CODEC); + + @Override + public SlotDisplay.Type type() { + return TYPE; + } + + @Override + public Stream resolve(ContextMap contextMap, DisplayContentsFactory displayContentsFactory) { + return this.contents.stream().flatMap(slotDisplay -> slotDisplay.resolve(contextMap, displayContentsFactory)); + } + + @Override + public boolean isEnabled(FeatureFlagSet featureFlagSet) { + return this.contents.stream().allMatch(slotDisplay -> slotDisplay.isEnabled(featureFlagSet)); + } + } + + public static class Empty implements SlotDisplay { + public static final SlotDisplay.Empty INSTANCE = new SlotDisplay.Empty(); + public static final MapCodec MAP_CODEC = MapCodec.unit(INSTANCE); + public static final StreamCodec STREAM_CODEC = StreamCodec.unit(INSTANCE); + public static final SlotDisplay.Type TYPE = new SlotDisplay.Type<>(MAP_CODEC, STREAM_CODEC); + + private Empty() { + } + + @Override + public SlotDisplay.Type type() { + return TYPE; + } + + public String toString() { + return ""; + } + + @Override + public Stream resolve(ContextMap contextMap, DisplayContentsFactory displayContentsFactory) { + return Stream.empty(); + } + } + + public record ItemSlotDisplay(Holder item) implements SlotDisplay { + public static final MapCodec MAP_CODEC = RecordCodecBuilder.mapCodec( + instance -> instance.group(Item.CODEC.fieldOf("item").forGetter(SlotDisplay.ItemSlotDisplay::item)).apply(instance, SlotDisplay.ItemSlotDisplay::new) + ); + public static final StreamCodec STREAM_CODEC = StreamCodec.composite( + ByteBufCodecs.holderRegistry(Registries.ITEM), SlotDisplay.ItemSlotDisplay::item, SlotDisplay.ItemSlotDisplay::new + ); + public static final SlotDisplay.Type TYPE = new SlotDisplay.Type<>(MAP_CODEC, STREAM_CODEC); + + public ItemSlotDisplay(Item item) { + this(item.builtInRegistryHolder()); + } + + @Override + public SlotDisplay.Type type() { + return TYPE; + } + + @Override + public Stream resolve(ContextMap contextMap, DisplayContentsFactory displayContentsFactory) { + return displayContentsFactory instanceof DisplayContentsFactory.ForStacks forStacks ? Stream.of(forStacks.forStack(this.item)) : Stream.empty(); + } + + @Override + public boolean isEnabled(FeatureFlagSet featureFlagSet) { + return this.item.value().isEnabled(featureFlagSet); + } + } + + public static class ItemStackContentsFactory implements DisplayContentsFactory.ForStacks { + public static final SlotDisplay.ItemStackContentsFactory INSTANCE = new SlotDisplay.ItemStackContentsFactory(); + + public ItemStack forStack(ItemStack itemStack) { + return itemStack; + } + } + + public record ItemStackSlotDisplay(ItemStack stack) implements SlotDisplay { + public static final MapCodec MAP_CODEC = RecordCodecBuilder.mapCodec( + instance -> instance.group(ItemStack.STRICT_CODEC.fieldOf("item").forGetter(SlotDisplay.ItemStackSlotDisplay::stack)) + .apply(instance, SlotDisplay.ItemStackSlotDisplay::new) + ); + public static final StreamCodec STREAM_CODEC = StreamCodec.composite( + ItemStack.STREAM_CODEC, SlotDisplay.ItemStackSlotDisplay::stack, SlotDisplay.ItemStackSlotDisplay::new + ); + public static final SlotDisplay.Type TYPE = new SlotDisplay.Type<>(MAP_CODEC, STREAM_CODEC); + + @Override + public SlotDisplay.Type type() { + return TYPE; + } + + @Override + public Stream resolve(ContextMap contextMap, DisplayContentsFactory displayContentsFactory) { + return displayContentsFactory instanceof DisplayContentsFactory.ForStacks forStacks ? Stream.of(forStacks.forStack(this.stack)) : Stream.empty(); + } + + public boolean equals(Object object) { + return this == object + || object instanceof SlotDisplay.ItemStackSlotDisplay itemStackSlotDisplay && ItemStack.matches(this.stack, itemStackSlotDisplay.stack); + } + + @Override + public boolean isEnabled(FeatureFlagSet featureFlagSet) { + return this.stack.getItem().isEnabled(featureFlagSet); + } + } + + public record SmithingTrimDemoSlotDisplay(SlotDisplay base, SlotDisplay material, SlotDisplay pattern) implements SlotDisplay { + public static final MapCodec MAP_CODEC = RecordCodecBuilder.mapCodec( + instance -> instance.group( + SlotDisplay.CODEC.fieldOf("base").forGetter(SlotDisplay.SmithingTrimDemoSlotDisplay::base), + SlotDisplay.CODEC.fieldOf("material").forGetter(SlotDisplay.SmithingTrimDemoSlotDisplay::material), + SlotDisplay.CODEC.fieldOf("pattern").forGetter(SlotDisplay.SmithingTrimDemoSlotDisplay::pattern) + ) + .apply(instance, SlotDisplay.SmithingTrimDemoSlotDisplay::new) + ); + public static final StreamCodec STREAM_CODEC = StreamCodec.composite( + SlotDisplay.STREAM_CODEC, + SlotDisplay.SmithingTrimDemoSlotDisplay::base, + SlotDisplay.STREAM_CODEC, + SlotDisplay.SmithingTrimDemoSlotDisplay::material, + SlotDisplay.STREAM_CODEC, + SlotDisplay.SmithingTrimDemoSlotDisplay::pattern, + SlotDisplay.SmithingTrimDemoSlotDisplay::new + ); + public static final SlotDisplay.Type TYPE = new SlotDisplay.Type<>(MAP_CODEC, STREAM_CODEC); + + @Override + public SlotDisplay.Type type() { + return TYPE; + } + + @Override + public Stream resolve(ContextMap contextMap, DisplayContentsFactory displayContentsFactory) { + if (displayContentsFactory instanceof DisplayContentsFactory.ForStacks forStacks) { + HolderLookup.Provider provider = contextMap.getOptional(SlotDisplayContext.REGISTRIES); + if (provider != null) { + RandomSource randomSource = RandomSource.create(System.identityHashCode(this)); + List list = this.base.resolveForStacks(contextMap); + if (list.isEmpty()) { + return Stream.empty(); + } + + List list2 = this.material.resolveForStacks(contextMap); + if (list2.isEmpty()) { + return Stream.empty(); + } + + List list3 = this.pattern.resolveForStacks(contextMap); + if (list3.isEmpty()) { + return Stream.empty(); + } + + return Stream.generate(() -> { + ItemStack itemStack = Util.getRandom(list, randomSource); + ItemStack itemStack2 = Util.getRandom(list2, randomSource); + ItemStack itemStack3 = Util.getRandom(list3, randomSource); + return SmithingTrimRecipe.applyTrim(provider, itemStack, itemStack2, itemStack3); + }).limit(256L).filter(itemStack -> !itemStack.isEmpty()).limit(16L).map(forStacks::forStack); + } + } + + return Stream.empty(); + } + } + + public record TagSlotDisplay(TagKey tag) implements SlotDisplay { + public static final MapCodec MAP_CODEC = RecordCodecBuilder.mapCodec( + instance -> instance.group(TagKey.codec(Registries.ITEM).fieldOf("tag").forGetter(SlotDisplay.TagSlotDisplay::tag)) + .apply(instance, SlotDisplay.TagSlotDisplay::new) + ); + public static final StreamCodec STREAM_CODEC = StreamCodec.composite( + TagKey.streamCodec(Registries.ITEM), SlotDisplay.TagSlotDisplay::tag, SlotDisplay.TagSlotDisplay::new + ); + public static final SlotDisplay.Type TYPE = new SlotDisplay.Type<>(MAP_CODEC, STREAM_CODEC); + + @Override + public SlotDisplay.Type type() { + return TYPE; + } + + @Override + public Stream resolve(ContextMap contextMap, DisplayContentsFactory displayContentsFactory) { + if (displayContentsFactory instanceof DisplayContentsFactory.ForStacks forStacks) { + HolderLookup.Provider provider = contextMap.getOptional(SlotDisplayContext.REGISTRIES); + if (provider != null) { + return provider.lookupOrThrow(Registries.ITEM).get(this.tag).map(named -> named.stream().map(forStacks::forStack)).stream().flatMap(stream -> stream); + } + } + + return Stream.empty(); + } + } + + public record Type(MapCodec codec, StreamCodec streamCodec) { + } + + public record WithRemainder(SlotDisplay input, SlotDisplay remainder) implements SlotDisplay { + public static final MapCodec MAP_CODEC = RecordCodecBuilder.mapCodec( + instance -> instance.group( + SlotDisplay.CODEC.fieldOf("input").forGetter(SlotDisplay.WithRemainder::input), + SlotDisplay.CODEC.fieldOf("remainder").forGetter(SlotDisplay.WithRemainder::remainder) + ) + .apply(instance, SlotDisplay.WithRemainder::new) + ); + public static final StreamCodec STREAM_CODEC = StreamCodec.composite( + SlotDisplay.STREAM_CODEC, SlotDisplay.WithRemainder::input, SlotDisplay.STREAM_CODEC, SlotDisplay.WithRemainder::remainder, SlotDisplay.WithRemainder::new + ); + public static final SlotDisplay.Type TYPE = new SlotDisplay.Type<>(MAP_CODEC, STREAM_CODEC); + + @Override + public SlotDisplay.Type type() { + return TYPE; + } + + @Override + public Stream resolve(ContextMap contextMap, DisplayContentsFactory displayContentsFactory) { + if (displayContentsFactory instanceof DisplayContentsFactory.ForRemainders forRemainders) { + List list = this.remainder.resolve(contextMap, displayContentsFactory).toList(); + return this.input.resolve(contextMap, displayContentsFactory).map(object -> forRemainders.addRemainder((T)object, list)); + } else { + return this.input.resolve(contextMap, displayContentsFactory); + } + } + + @Override + public boolean isEnabled(FeatureFlagSet featureFlagSet) { + return this.input.isEnabled(featureFlagSet) && this.remainder.isEnabled(featureFlagSet); + } + } +} diff --git a/net/minecraft/world/item/crafting/display/SlotDisplayContext.java b/net/minecraft/world/item/crafting/display/SlotDisplayContext.java new file mode 100644 index 00000000..c316d6cb --- /dev/null +++ b/net/minecraft/world/item/crafting/display/SlotDisplayContext.java @@ -0,0 +1,18 @@ +package net.minecraft.world.item.crafting.display; + +import net.minecraft.core.HolderLookup; +import net.minecraft.util.context.ContextKey; +import net.minecraft.util.context.ContextKeySet; +import net.minecraft.util.context.ContextMap; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.entity.FuelValues; + +public class SlotDisplayContext { + public static final ContextKey FUEL_VALUES = ContextKey.vanilla("fuel_values"); + public static final ContextKey REGISTRIES = ContextKey.vanilla("registries"); + public static final ContextKeySet CONTEXT = new ContextKeySet.Builder().optional(FUEL_VALUES).optional(REGISTRIES).build(); + + public static ContextMap fromLevel(Level level) { + return new ContextMap.Builder().withParameter(FUEL_VALUES, level.fuelValues()).withParameter(REGISTRIES, level.registryAccess()).create(CONTEXT); + } +} diff --git a/net/minecraft/world/item/crafting/display/SlotDisplays.java b/net/minecraft/world/item/crafting/display/SlotDisplays.java new file mode 100644 index 00000000..b42d6853 --- /dev/null +++ b/net/minecraft/world/item/crafting/display/SlotDisplays.java @@ -0,0 +1,16 @@ +package net.minecraft.world.item.crafting.display; + +import net.minecraft.core.Registry; + +public class SlotDisplays { + public static SlotDisplay.Type bootstrap(Registry> registry) { + Registry.register(registry, "empty", SlotDisplay.Empty.TYPE); + Registry.register(registry, "any_fuel", SlotDisplay.AnyFuel.TYPE); + Registry.register(registry, "item", SlotDisplay.ItemSlotDisplay.TYPE); + Registry.register(registry, "item_stack", SlotDisplay.ItemStackSlotDisplay.TYPE); + Registry.register(registry, "tag", SlotDisplay.TagSlotDisplay.TYPE); + Registry.register(registry, "smithing_trim", SlotDisplay.SmithingTrimDemoSlotDisplay.TYPE); + Registry.register(registry, "with_remainder", SlotDisplay.WithRemainder.TYPE); + return Registry.register(registry, "composite", SlotDisplay.Composite.TYPE); + } +} diff --git a/net/minecraft/world/item/crafting/display/SmithingRecipeDisplay.java b/net/minecraft/world/item/crafting/display/SmithingRecipeDisplay.java new file mode 100644 index 00000000..ec3a65c7 --- /dev/null +++ b/net/minecraft/world/item/crafting/display/SmithingRecipeDisplay.java @@ -0,0 +1,39 @@ +package net.minecraft.world.item.crafting.display; + +import com.mojang.serialization.MapCodec; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.codec.StreamCodec; + +public record SmithingRecipeDisplay(SlotDisplay template, SlotDisplay base, SlotDisplay addition, SlotDisplay result, SlotDisplay craftingStation) + implements RecipeDisplay { + public static final MapCodec MAP_CODEC = RecordCodecBuilder.mapCodec( + instance -> instance.group( + SlotDisplay.CODEC.fieldOf("template").forGetter(SmithingRecipeDisplay::template), + SlotDisplay.CODEC.fieldOf("base").forGetter(SmithingRecipeDisplay::base), + SlotDisplay.CODEC.fieldOf("addition").forGetter(SmithingRecipeDisplay::addition), + SlotDisplay.CODEC.fieldOf("result").forGetter(SmithingRecipeDisplay::result), + SlotDisplay.CODEC.fieldOf("crafting_station").forGetter(SmithingRecipeDisplay::craftingStation) + ) + .apply(instance, SmithingRecipeDisplay::new) + ); + public static final StreamCodec STREAM_CODEC = StreamCodec.composite( + SlotDisplay.STREAM_CODEC, + SmithingRecipeDisplay::template, + SlotDisplay.STREAM_CODEC, + SmithingRecipeDisplay::base, + SlotDisplay.STREAM_CODEC, + SmithingRecipeDisplay::addition, + SlotDisplay.STREAM_CODEC, + SmithingRecipeDisplay::result, + SlotDisplay.STREAM_CODEC, + SmithingRecipeDisplay::craftingStation, + SmithingRecipeDisplay::new + ); + public static final RecipeDisplay.Type TYPE = new RecipeDisplay.Type<>(MAP_CODEC, STREAM_CODEC); + + @Override + public RecipeDisplay.Type type() { + return TYPE; + } +} diff --git a/net/minecraft/world/item/crafting/display/StonecutterRecipeDisplay.java b/net/minecraft/world/item/crafting/display/StonecutterRecipeDisplay.java new file mode 100644 index 00000000..8f477e77 --- /dev/null +++ b/net/minecraft/world/item/crafting/display/StonecutterRecipeDisplay.java @@ -0,0 +1,32 @@ +package net.minecraft.world.item.crafting.display; + +import com.mojang.serialization.MapCodec; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.codec.StreamCodec; + +public record StonecutterRecipeDisplay(SlotDisplay input, SlotDisplay result, SlotDisplay craftingStation) implements RecipeDisplay { + public static final MapCodec MAP_CODEC = RecordCodecBuilder.mapCodec( + instance -> instance.group( + SlotDisplay.CODEC.fieldOf("input").forGetter(StonecutterRecipeDisplay::input), + SlotDisplay.CODEC.fieldOf("result").forGetter(StonecutterRecipeDisplay::result), + SlotDisplay.CODEC.fieldOf("crafting_station").forGetter(StonecutterRecipeDisplay::craftingStation) + ) + .apply(instance, StonecutterRecipeDisplay::new) + ); + public static final StreamCodec STREAM_CODEC = StreamCodec.composite( + SlotDisplay.STREAM_CODEC, + StonecutterRecipeDisplay::input, + SlotDisplay.STREAM_CODEC, + StonecutterRecipeDisplay::result, + SlotDisplay.STREAM_CODEC, + StonecutterRecipeDisplay::craftingStation, + StonecutterRecipeDisplay::new + ); + public static final RecipeDisplay.Type TYPE = new RecipeDisplay.Type<>(MAP_CODEC, STREAM_CODEC); + + @Override + public RecipeDisplay.Type type() { + return TYPE; + } +} diff --git a/net/minecraft/world/item/crafting/display/package-info.java b/net/minecraft/world/item/crafting/display/package-info.java new file mode 100644 index 00000000..26dd3b60 --- /dev/null +++ b/net/minecraft/world/item/crafting/display/package-info.java @@ -0,0 +1,8 @@ +@ParametersAreNonnullByDefault +@MethodsReturnNonnullByDefault +@FieldsAreNonnullByDefault +package net.minecraft.world.item.crafting.display; + +import javax.annotation.ParametersAreNonnullByDefault; +import net.minecraft.FieldsAreNonnullByDefault; +import net.minecraft.MethodsReturnNonnullByDefault; diff --git a/net/minecraft/world/item/enchantment/ConditionalEffect.java b/net/minecraft/world/item/enchantment/ConditionalEffect.java index 8b9d8ad5..ce6b1e81 100644 --- a/net/minecraft/world/item/enchantment/ConditionalEffect.java +++ b/net/minecraft/world/item/enchantment/ConditionalEffect.java @@ -4,19 +4,19 @@ import com.mojang.serialization.Codec; import com.mojang.serialization.DataResult; import com.mojang.serialization.codecs.RecordCodecBuilder; import java.util.Optional; -import net.minecraft.util.ProblemReporter; +import net.minecraft.util.ProblemReporter.Collector; +import net.minecraft.util.context.ContextKeySet; import net.minecraft.world.level.storage.loot.LootContext; import net.minecraft.world.level.storage.loot.ValidationContext; -import net.minecraft.world.level.storage.loot.parameters.LootContextParamSet; import net.minecraft.world.level.storage.loot.predicates.LootItemCondition; public record ConditionalEffect(T effect, Optional requirements) { - public static Codec conditionCodec(LootContextParamSet params) { + public static Codec conditionCodec(ContextKeySet contextKeySet) { return LootItemCondition.DIRECT_CODEC .validate( lootItemCondition -> { - ProblemReporter.Collector collector = new ProblemReporter.Collector(); - ValidationContext validationContext = new ValidationContext(collector, params); + Collector collector = new Collector(); + ValidationContext validationContext = new ValidationContext(collector, contextKeySet); lootItemCondition.validate(validationContext); return (DataResult)collector.getReport() .map(string -> DataResult.error(() -> "Validation error in enchantment effect condition: " + string)) @@ -25,11 +25,11 @@ public record ConditionalEffect(T effect, Optional require ); } - public static Codec> codec(Codec codec, LootContextParamSet params) { + public static Codec> codec(Codec codec, ContextKeySet contextKeySet) { return RecordCodecBuilder.create( instance -> instance.group( codec.fieldOf("effect").forGetter(ConditionalEffect::effect), - conditionCodec(params).optionalFieldOf("requirements").forGetter(ConditionalEffect::requirements) + conditionCodec(contextKeySet).optionalFieldOf("requirements").forGetter(ConditionalEffect::requirements) ) .apply(instance, ConditionalEffect::new) ); diff --git a/net/minecraft/world/item/enchantment/Enchantable.java b/net/minecraft/world/item/enchantment/Enchantable.java new file mode 100644 index 00000000..6ee2d802 --- /dev/null +++ b/net/minecraft/world/item/enchantment/Enchantable.java @@ -0,0 +1,23 @@ +package net.minecraft.world.item.enchantment; + +import com.mojang.serialization.Codec; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import io.netty.buffer.ByteBuf; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.util.ExtraCodecs; + +public record Enchantable(int value) { + public static final Codec CODEC = RecordCodecBuilder.create( + instance -> instance.group(ExtraCodecs.POSITIVE_INT.fieldOf("value").forGetter(Enchantable::value)).apply(instance, Enchantable::new) + ); + public static final StreamCodec STREAM_CODEC = StreamCodec.composite(ByteBufCodecs.VAR_INT, Enchantable::value, Enchantable::new); + + public Enchantable(int value) { + if (value <= 0) { + throw new IllegalArgumentException("Enchantment value must be positive, but was " + value); + } else { + this.value = value; + } + } +} diff --git a/net/minecraft/world/item/enchantment/Enchantment.java b/net/minecraft/world/item/enchantment/Enchantment.java index ff34cc4c..2eca988e 100644 --- a/net/minecraft/world/item/enchantment/Enchantment.java +++ b/net/minecraft/world/item/enchantment/Enchantment.java @@ -106,7 +106,7 @@ public record Enchantment(Component description, Enchantment.EnchantmentDefiniti public Map getSlotItems(LivingEntity entity) { Map map = Maps.newEnumMap(EquipmentSlot.class); - for (EquipmentSlot equipmentSlot : EquipmentSlot.values()) { + for (EquipmentSlot equipmentSlot : EquipmentSlot.VALUES) { if (this.matchingSlot(equipmentSlot)) { ItemStack itemStack = entity.getItemBySlot(equipmentSlot); if (!itemStack.isEmpty()) { @@ -293,6 +293,14 @@ public record Enchantment(Component description, Enchantment.EnchantmentDefiniti this.modifyDamageFilteredValue(EnchantmentEffectComponents.ARMOR_EFFECTIVENESS, level, enchantmentLevel, tool, entity, damageSource, armorEffectiveness); } + public void doPostAttack(ServerLevel level, int enchantmentLevel, EnchantedItemInUse item, EnchantmentTarget target, Entity entity, DamageSource damageSource) { + for (TargetedConditionalEffect targetedConditionalEffect : this.getEffects(EnchantmentEffectComponents.POST_ATTACK)) { + if (target == targetedConditionalEffect.enchanted()) { + doPostAttack(targetedConditionalEffect, level, enchantmentLevel, item, entity, damageSource); + } + } + } + public static void doPostAttack( TargetedConditionalEffect effect, ServerLevel level, @@ -313,14 +321,6 @@ public record Enchantment(Component description, Enchantment.EnchantmentDefiniti } } - public void doPostAttack(ServerLevel level, int enchantmentLevel, EnchantedItemInUse item, EnchantmentTarget target, Entity entity, DamageSource damageSource) { - for (TargetedConditionalEffect targetedConditionalEffect : this.getEffects(EnchantmentEffectComponents.POST_ATTACK)) { - if (target == targetedConditionalEffect.enchanted()) { - doPostAttack(targetedConditionalEffect, level, enchantmentLevel, item, entity, damageSource); - } - } - } - public void modifyProjectileCount(ServerLevel level, int enchantmentLevel, ItemStack tool, Entity entity, MutableFloat projectileCount) { this.modifyEntityFilteredValue(EnchantmentEffectComponents.PROJECTILE_COUNT, level, enchantmentLevel, tool, entity, projectileCount); } @@ -463,44 +463,51 @@ public record Enchantment(Component description, Enchantment.EnchantmentDefiniti } public void runLocationChangedEffects(ServerLevel level, int enchantmentLevel, EnchantedItemInUse item, LivingEntity entity) { - if (item.inSlot() != null && !this.matchingSlot(item.inSlot())) { - Set set = (Set)entity.activeLocationDependentEnchantments().remove(this); - if (set != null) { - set.forEach(enchantmentLocationBasedEffectx -> enchantmentLocationBasedEffectx.onDeactivated(item, entity, entity.position(), enchantmentLevel)); - } - } else { - Set set = (Set)entity.activeLocationDependentEnchantments().get(this); + EquipmentSlot equipmentSlot = item.inSlot(); + if (equipmentSlot != null) { + Map> map = entity.activeLocationDependentEnchantments(equipmentSlot); + if (!this.matchingSlot(equipmentSlot)) { + Set set = (Set)map.remove(this); + if (set != null) { + set.forEach(enchantmentLocationBasedEffectx -> enchantmentLocationBasedEffectx.onDeactivated(item, entity, entity.position(), enchantmentLevel)); + } + } else { + Set set = (Set)map.get(this); - for (ConditionalEffect conditionalEffect : this.getEffects(EnchantmentEffectComponents.LOCATION_CHANGED)) { - EnchantmentLocationBasedEffect enchantmentLocationBasedEffect = conditionalEffect.effect(); - boolean bl = set != null && set.contains(enchantmentLocationBasedEffect); - if (conditionalEffect.matches(locationContext(level, enchantmentLevel, entity, bl))) { - if (!bl) { - if (set == null) { - set = new ObjectArraySet<>(); - entity.activeLocationDependentEnchantments().put(this, set); + for (ConditionalEffect conditionalEffect : this.getEffects(EnchantmentEffectComponents.LOCATION_CHANGED)) { + EnchantmentLocationBasedEffect enchantmentLocationBasedEffect = conditionalEffect.effect(); + boolean bl = set != null && set.contains(enchantmentLocationBasedEffect); + if (conditionalEffect.matches(locationContext(level, enchantmentLevel, entity, bl))) { + if (!bl) { + if (set == null) { + set = new ObjectArraySet<>(); + map.put(this, set); + } + + set.add(enchantmentLocationBasedEffect); } - set.add(enchantmentLocationBasedEffect); + enchantmentLocationBasedEffect.onChangedBlock(level, enchantmentLevel, item, entity, entity.position(), !bl); + } else if (set != null && set.remove(enchantmentLocationBasedEffect)) { + enchantmentLocationBasedEffect.onDeactivated(item, entity, entity.position(), enchantmentLevel); } - - enchantmentLocationBasedEffect.onChangedBlock(level, enchantmentLevel, item, entity, entity.position(), !bl); - } else if (set != null && set.remove(enchantmentLocationBasedEffect)) { - enchantmentLocationBasedEffect.onDeactivated(item, entity, entity.position(), enchantmentLevel); } - } - if (set != null && set.isEmpty()) { - entity.activeLocationDependentEnchantments().remove(this); + if (set != null && set.isEmpty()) { + map.remove(this); + } } } } public void stopLocationBasedEffects(int enchantmentLevel, EnchantedItemInUse item, LivingEntity entity) { - Set set = (Set)entity.activeLocationDependentEnchantments().remove(this); - if (set != null) { - for (EnchantmentLocationBasedEffect enchantmentLocationBasedEffect : set) { - enchantmentLocationBasedEffect.onDeactivated(item, entity, entity.position(), enchantmentLevel); + EquipmentSlot equipmentSlot = item.inSlot(); + if (equipmentSlot != null) { + Set set = (Set)entity.activeLocationDependentEnchantments(equipmentSlot).remove(this); + if (set != null) { + for (EnchantmentLocationBasedEffect enchantmentLocationBasedEffect : set) { + enchantmentLocationBasedEffect.onDeactivated(item, entity, entity.position(), enchantmentLevel); + } } } } diff --git a/net/minecraft/world/item/enchantment/EnchantmentEffectComponents.java b/net/minecraft/world/item/enchantment/EnchantmentEffectComponents.java index a342d205..01be36a4 100644 --- a/net/minecraft/world/item/enchantment/EnchantmentEffectComponents.java +++ b/net/minecraft/world/item/enchantment/EnchantmentEffectComponents.java @@ -7,6 +7,7 @@ import net.minecraft.core.Holder; import net.minecraft.core.Registry; import net.minecraft.core.component.DataComponentMap; import net.minecraft.core.component.DataComponentType; +import net.minecraft.core.component.DataComponentType.Builder; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.sounds.SoundEvent; import net.minecraft.util.Unit; @@ -113,9 +114,7 @@ public interface EnchantmentEffectComponents { return DAMAGE_PROTECTION; } - private static DataComponentType register(String name, UnaryOperator> operator) { - return Registry.register( - BuiltInRegistries.ENCHANTMENT_EFFECT_COMPONENT_TYPE, name, ((DataComponentType.Builder)operator.apply(DataComponentType.builder())).build() - ); + private static DataComponentType register(String name, UnaryOperator> operator) { + return Registry.register(BuiltInRegistries.ENCHANTMENT_EFFECT_COMPONENT_TYPE, name, ((Builder)operator.apply(DataComponentType.builder())).build()); } } diff --git a/net/minecraft/world/item/enchantment/EnchantmentHelper.java b/net/minecraft/world/item/enchantment/EnchantmentHelper.java index 9febb1fc..02472f2e 100644 --- a/net/minecraft/world/item/enchantment/EnchantmentHelper.java +++ b/net/minecraft/world/item/enchantment/EnchantmentHelper.java @@ -32,7 +32,7 @@ import net.minecraft.world.entity.EquipmentSlotGroup; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.ai.attributes.Attribute; import net.minecraft.world.entity.ai.attributes.AttributeModifier; -import net.minecraft.world.entity.projectile.AbstractArrow; +import net.minecraft.world.entity.projectile.Projectile; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; @@ -117,6 +117,12 @@ public class EnchantmentHelper { } } + public static ItemStack createBook(EnchantmentInstance enchantmentInstance) { + ItemStack itemStack = new ItemStack(Items.ENCHANTED_BOOK); + itemStack.enchant(enchantmentInstance.enchantment, enchantmentInstance.level); + return itemStack; + } + private static void runIterationOnItem(ItemStack stack, EnchantmentHelper.EnchantmentVisitor visitor) { ItemEnchantments itemEnchantments = stack.getOrDefault(DataComponents.ENCHANTMENTS, ItemEnchantments.EMPTY); @@ -142,7 +148,7 @@ public class EnchantmentHelper { } private static void runIterationOnEquipment(LivingEntity entity, EnchantmentHelper.EnchantmentInSlotVisitor visitor) { - for (EquipmentSlot equipmentSlot : EquipmentSlot.values()) { + for (EquipmentSlot equipmentSlot : EquipmentSlot.VALUES) { runIterationOnItem(entity.getItemBySlot(equipmentSlot), equipmentSlot, entity, visitor); } } @@ -198,19 +204,33 @@ public class EnchantmentHelper { } public static void doPostAttackEffectsWithItemSource(ServerLevel level, Entity entity, DamageSource damageSource, @Nullable ItemStack itemSource) { + doPostAttackEffectsWithItemSourceOnBreak(level, entity, damageSource, itemSource, null); + } + + public static void doPostAttackEffectsWithItemSourceOnBreak( + ServerLevel serverLevel, Entity entity, DamageSource damageSource, @Nullable ItemStack itemStack, @Nullable Consumer consumer + ) { if (entity instanceof LivingEntity livingEntity) { runIterationOnEquipment( - livingEntity, (holder, i, enchantedItemInUse) -> holder.value().doPostAttack(level, i, enchantedItemInUse, EnchantmentTarget.VICTIM, entity, damageSource) + livingEntity, + (holder, i, enchantedItemInUse) -> holder.value().doPostAttack(serverLevel, i, enchantedItemInUse, EnchantmentTarget.VICTIM, entity, damageSource) ); } - if (itemSource != null && damageSource.getEntity() instanceof LivingEntity livingEntity) { - runIterationOnItem( - itemSource, - EquipmentSlot.MAINHAND, - livingEntity, - (holder, i, enchantedItemInUse) -> holder.value().doPostAttack(level, i, enchantedItemInUse, EnchantmentTarget.ATTACKER, entity, damageSource) - ); + if (itemStack != null) { + if (damageSource.getEntity() instanceof LivingEntity livingEntity) { + runIterationOnItem( + itemStack, + EquipmentSlot.MAINHAND, + livingEntity, + (holder, i, enchantedItemInUse) -> holder.value().doPostAttack(serverLevel, i, enchantedItemInUse, EnchantmentTarget.ATTACKER, entity, damageSource) + ); + } else if (consumer != null) { + EnchantedItemInUse enchantedItemInUse = new EnchantedItemInUse(itemStack, null, null, consumer); + runIterationOnItem( + itemStack, (holder, i) -> holder.value().doPostAttack(serverLevel, i, enchantedItemInUse, EnchantmentTarget.ATTACKER, entity, damageSource) + ); + } } } @@ -266,10 +286,10 @@ public class EnchantmentHelper { return Math.max(0, mutableFloat.intValue()); } - public static void onProjectileSpawned(ServerLevel level, ItemStack firedFromWeapon, AbstractArrow arrow, Consumer onBreak) { - LivingEntity livingEntity2 = arrow.getOwner() instanceof LivingEntity livingEntity ? livingEntity : null; - EnchantedItemInUse enchantedItemInUse = new EnchantedItemInUse(firedFromWeapon, null, livingEntity2, onBreak); - runIterationOnItem(firedFromWeapon, (holder, i) -> holder.value().onProjectileSpawned(level, i, enchantedItemInUse, arrow)); + public static void onProjectileSpawned(ServerLevel serverLevel, ItemStack itemStack, Projectile projectile, Consumer consumer) { + LivingEntity livingEntity2 = projectile.getOwner() instanceof LivingEntity livingEntity ? livingEntity : null; + EnchantedItemInUse enchantedItemInUse = new EnchantedItemInUse(itemStack, null, livingEntity2, consumer); + runIterationOnItem(itemStack, (holder, i) -> holder.value().onProjectileSpawned(serverLevel, i, enchantedItemInUse, projectile)); } public static void onHitBlock( @@ -432,7 +452,7 @@ public class EnchantmentHelper { public static Optional getRandomItemWith(DataComponentType componentType, LivingEntity entity, Predicate filter) { List list = new ArrayList(); - for (EquipmentSlot equipmentSlot : EquipmentSlot.values()) { + for (EquipmentSlot equipmentSlot : EquipmentSlot.VALUES) { ItemStack itemStack = entity.getItemBySlot(equipmentSlot); if (filter.test(itemStack)) { ItemEnchantments itemEnchantments = itemStack.getOrDefault(DataComponents.ENCHANTMENTS, ItemEnchantments.EMPTY); @@ -453,20 +473,19 @@ public class EnchantmentHelper { * Returns the enchantability of itemstack, using a separate calculation for each enchantNum (0, 1 or 2), cutting to the max enchantability power of the table, which is locked to a max of 15. */ public static int getEnchantmentCost(RandomSource random, int enchantNum, int power, ItemStack stack) { - Item item = stack.getItem(); - int i = item.getEnchantmentValue(); - if (i <= 0) { + Enchantable enchantable = stack.get(DataComponents.ENCHANTABLE); + if (enchantable == null) { return 0; } else { if (power > 15) { power = 15; } - int j = random.nextInt(8) + 1 + (power >> 1) + random.nextInt(power + 1); + int i = random.nextInt(8) + 1 + (power >> 1) + random.nextInt(power + 1); if (enchantNum == 0) { - return Math.max(j / 3, 1); + return Math.max(i / 3, 1); } else { - return enchantNum == 1 ? j * 2 / 3 + 1 : Math.max(j, power * 2); + return enchantNum == 1 ? i * 2 / 3 + 1 : Math.max(i, power * 2); } } } @@ -479,7 +498,7 @@ public class EnchantmentHelper { stack, level, (Stream>)possibleEnchantments.map(HolderSet::stream) - .orElseGet(() -> registryAccess.registryOrThrow(Registries.ENCHANTMENT).holders().map(reference -> reference)) + .orElseGet(() -> registryAccess.lookupOrThrow(Registries.ENCHANTMENT).listElements().map(reference -> reference)) ); } @@ -498,12 +517,11 @@ public class EnchantmentHelper { public static List selectEnchantment(RandomSource random, ItemStack stack, int level, Stream> possibleEnchantments) { List list = Lists.newArrayList(); - Item item = stack.getItem(); - int i = item.getEnchantmentValue(); - if (i <= 0) { + Enchantable enchantable = stack.get(DataComponents.ENCHANTABLE); + if (enchantable == null) { return list; } else { - level += 1 + random.nextInt(i / 4 + 1) + random.nextInt(i / 4 + 1); + level += 1 + random.nextInt(enchantable.value() / 4 + 1) + random.nextInt(enchantable.value() / 4 + 1); float f = (random.nextFloat() + random.nextFloat() - 1.0F) * 0.15F; level = Mth.clamp(Math.round(level + level * f), 1, Integer.MAX_VALUE); List list2 = getAvailableEnchantmentResults(level, stack, possibleEnchantments); @@ -561,7 +579,7 @@ public class EnchantmentHelper { public static void enchantItemFromProvider( ItemStack stack, RegistryAccess registries, ResourceKey key, DifficultyInstance difficulty, RandomSource random ) { - EnchantmentProvider enchantmentProvider = registries.registryOrThrow(Registries.ENCHANTMENT_PROVIDER).get(key); + EnchantmentProvider enchantmentProvider = registries.lookupOrThrow(Registries.ENCHANTMENT_PROVIDER).getValue(key); if (enchantmentProvider != null) { updateEnchantments(stack, mutable -> enchantmentProvider.enchant(stack, mutable, random, difficulty)); } diff --git a/net/minecraft/world/item/enchantment/Enchantments.java b/net/minecraft/world/item/enchantment/Enchantments.java index 4c016f0d..29bf8f7d 100644 --- a/net/minecraft/world/item/enchantment/Enchantments.java +++ b/net/minecraft/world/item/enchantment/Enchantments.java @@ -3,15 +3,13 @@ package net.minecraft.world.item.enchantment; import java.util.List; import java.util.Optional; import java.util.function.Function; -import net.minecraft.advancements.critereon.DamageSourcePredicate; -import net.minecraft.advancements.critereon.EntityFlagsPredicate; import net.minecraft.advancements.critereon.EntityPredicate; import net.minecraft.advancements.critereon.EntityTypePredicate; import net.minecraft.advancements.critereon.ItemPredicate; -import net.minecraft.advancements.critereon.LocationPredicate; -import net.minecraft.advancements.critereon.MinMaxBounds; import net.minecraft.advancements.critereon.MovementPredicate; import net.minecraft.advancements.critereon.TagPredicate; +import net.minecraft.advancements.critereon.DamageSourcePredicate.Builder; +import net.minecraft.advancements.critereon.MinMaxBounds.Doubles; import net.minecraft.core.HolderGetter; import net.minecraft.core.HolderSet; import net.minecraft.core.Vec3i; @@ -38,12 +36,15 @@ import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.item.CrossbowItem; import net.minecraft.world.item.Item; import net.minecraft.world.item.Items; +import net.minecraft.world.item.enchantment.LevelBasedValue.Clamped; +import net.minecraft.world.item.enchantment.LevelBasedValue.Fraction; +import net.minecraft.world.item.enchantment.LevelBasedValue.LevelsSquared; import net.minecraft.world.item.enchantment.effects.AddValue; import net.minecraft.world.item.enchantment.effects.AllOf; import net.minecraft.world.item.enchantment.effects.ApplyMobEffect; +import net.minecraft.world.item.enchantment.effects.ChangeItemDamage; import net.minecraft.world.item.enchantment.effects.DamageEntity; import net.minecraft.world.item.enchantment.effects.DamageImmunity; -import net.minecraft.world.item.enchantment.effects.DamageItem; import net.minecraft.world.item.enchantment.effects.EnchantmentAttributeEffect; import net.minecraft.world.item.enchantment.effects.ExplodeEffect; import net.minecraft.world.item.enchantment.effects.Ignite; @@ -125,6 +126,7 @@ public class Enchantments { HolderGetter holderGetter2 = context.lookup(Registries.ENCHANTMENT); HolderGetter holderGetter3 = context.lookup(Registries.ITEM); HolderGetter holderGetter4 = context.lookup(Registries.BLOCK); + HolderGetter> holderGetter5 = context.lookup(Registries.ENTITY_TYPE); register( context, PROTECTION, @@ -137,7 +139,7 @@ public class Enchantments { .withEffect( EnchantmentEffectComponents.DAMAGE_PROTECTION, new AddValue(LevelBasedValue.perLevel(1.0F)), - DamageSourceCondition.hasDamageSource(DamageSourcePredicate.Builder.damageType().tag(TagPredicate.isNot(DamageTypeTags.BYPASSES_INVULNERABILITY))) + DamageSourceCondition.hasDamageSource(Builder.damageType().tag(TagPredicate.isNot(DamageTypeTags.BYPASSES_INVULNERABILITY))) ) ); register( @@ -154,7 +156,7 @@ public class Enchantments { new AddValue(LevelBasedValue.perLevel(2.0F)), AllOfCondition.allOf( DamageSourceCondition.hasDamageSource( - DamageSourcePredicate.Builder.damageType().tag(TagPredicate.is(DamageTypeTags.IS_FIRE)).tag(TagPredicate.isNot(DamageTypeTags.BYPASSES_INVULNERABILITY)) + Builder.damageType().tag(TagPredicate.is(DamageTypeTags.IS_FIRE)).tag(TagPredicate.isNot(DamageTypeTags.BYPASSES_INVULNERABILITY)) ) ) ) @@ -186,7 +188,7 @@ public class Enchantments { EnchantmentEffectComponents.DAMAGE_PROTECTION, new AddValue(LevelBasedValue.perLevel(3.0F)), DamageSourceCondition.hasDamageSource( - DamageSourcePredicate.Builder.damageType().tag(TagPredicate.is(DamageTypeTags.IS_FALL)).tag(TagPredicate.isNot(DamageTypeTags.BYPASSES_INVULNERABILITY)) + Builder.damageType().tag(TagPredicate.is(DamageTypeTags.IS_FALL)).tag(TagPredicate.isNot(DamageTypeTags.BYPASSES_INVULNERABILITY)) ) ) ); @@ -203,9 +205,7 @@ public class Enchantments { EnchantmentEffectComponents.DAMAGE_PROTECTION, new AddValue(LevelBasedValue.perLevel(2.0F)), DamageSourceCondition.hasDamageSource( - DamageSourcePredicate.Builder.damageType() - .tag(TagPredicate.is(DamageTypeTags.IS_EXPLOSION)) - .tag(TagPredicate.isNot(DamageTypeTags.BYPASSES_INVULNERABILITY)) + Builder.damageType().tag(TagPredicate.is(DamageTypeTags.IS_EXPLOSION)).tag(TagPredicate.isNot(DamageTypeTags.BYPASSES_INVULNERABILITY)) ) ) .withEffect( @@ -231,9 +231,7 @@ public class Enchantments { EnchantmentEffectComponents.DAMAGE_PROTECTION, new AddValue(LevelBasedValue.perLevel(2.0F)), DamageSourceCondition.hasDamageSource( - DamageSourcePredicate.Builder.damageType() - .tag(TagPredicate.is(DamageTypeTags.IS_PROJECTILE)) - .tag(TagPredicate.isNot(DamageTypeTags.BYPASSES_INVULNERABILITY)) + Builder.damageType().tag(TagPredicate.is(DamageTypeTags.IS_PROJECTILE)).tag(TagPredicate.isNot(DamageTypeTags.BYPASSES_INVULNERABILITY)) ) ) ); @@ -300,7 +298,7 @@ public class Enchantments { EnchantmentTarget.ATTACKER, AllOf.entityEffects( new DamageEntity(LevelBasedValue.constant(1.0F), LevelBasedValue.constant(5.0F), holderGetter.getOrThrow(DamageTypes.THORNS)), - new DamageItem(LevelBasedValue.constant(2.0F)) + new ChangeItemDamage(LevelBasedValue.constant(2.0F)) ), LootItemRandomChanceCondition.randomChance(EnchantmentLevelProvider.forEnchantmentLevel(LevelBasedValue.perLevel(0.15F))) ) @@ -349,15 +347,13 @@ public class Enchantments { EnchantmentEffectComponents.DAMAGE_IMMUNITY, DamageImmunity.INSTANCE, DamageSourceCondition.hasDamageSource( - DamageSourcePredicate.Builder.damageType() - .tag(TagPredicate.is(DamageTypeTags.BURN_FROM_STEPPING)) - .tag(TagPredicate.isNot(DamageTypeTags.BYPASSES_INVULNERABILITY)) + Builder.damageType().tag(TagPredicate.is(DamageTypeTags.BURN_FROM_STEPPING)).tag(TagPredicate.isNot(DamageTypeTags.BYPASSES_INVULNERABILITY)) ) ) .withEffect( EnchantmentEffectComponents.LOCATION_CHANGED, new ReplaceDisk( - new LevelBasedValue.Clamped(LevelBasedValue.perLevel(3.0F, 1.0F), 0.0F, 16.0F), + new Clamped(LevelBasedValue.perLevel(3.0F, 1.0F), 0.0F, 16.0F), LevelBasedValue.constant(1.0F), new Vec3i(0, -1, 0), Optional.of( @@ -372,7 +368,8 @@ public class Enchantments { Optional.of(GameEvent.BLOCK_PLACE) ), LootItemEntityPropertyCondition.hasProperties( - LootContext.EntityTarget.THIS, EntityPredicate.Builder.entity().flags(EntityFlagsPredicate.Builder.flags().setOnGround(true)) + LootContext.EntityTarget.THIS, + EntityPredicate.Builder.entity().flags(net.minecraft.advancements.critereon.EntityFlagsPredicate.Builder.flags().setOnGround(true)) ) ) ); @@ -388,11 +385,52 @@ public class Enchantments { ); EntityPredicate.Builder builder = EntityPredicate.Builder.entity() .periodicTick(5) - .flags(EntityFlagsPredicate.Builder.flags().setIsFlying(false).setOnGround(true)) - .moving(MovementPredicate.horizontalSpeed(MinMaxBounds.Doubles.atLeast(1.0E-5F))) + .flags(net.minecraft.advancements.critereon.EntityFlagsPredicate.Builder.flags().setIsFlying(false).setOnGround(true)) + .moving(MovementPredicate.horizontalSpeed(Doubles.atLeast(1.0E-5F))) .movementAffectedBy( - LocationPredicate.Builder.location().setBlock(net.minecraft.advancements.critereon.BlockPredicate.Builder.block().of(BlockTags.SOUL_SPEED_BLOCKS)) + net.minecraft.advancements.critereon.LocationPredicate.Builder.location() + .setBlock(net.minecraft.advancements.critereon.BlockPredicate.Builder.block().of(holderGetter4, BlockTags.SOUL_SPEED_BLOCKS)) ); + net.minecraft.world.level.storage.loot.predicates.AllOfCondition.Builder builder2 = AllOfCondition.allOf( + InvertedLootItemCondition.invert( + LootItemEntityPropertyCondition.hasProperties(LootContext.EntityTarget.THIS, EntityPredicate.Builder.entity().vehicle(EntityPredicate.Builder.entity())) + ), + AnyOfCondition.anyOf( + AllOfCondition.allOf( + EnchantmentActiveCheck.enchantmentActiveCheck(), + LootItemEntityPropertyCondition.hasProperties( + LootContext.EntityTarget.THIS, + EntityPredicate.Builder.entity().flags(net.minecraft.advancements.critereon.EntityFlagsPredicate.Builder.flags().setIsFlying(false)) + ), + AnyOfCondition.anyOf( + LootItemEntityPropertyCondition.hasProperties( + LootContext.EntityTarget.THIS, + EntityPredicate.Builder.entity() + .movementAffectedBy( + net.minecraft.advancements.critereon.LocationPredicate.Builder.location() + .setBlock(net.minecraft.advancements.critereon.BlockPredicate.Builder.block().of(holderGetter4, BlockTags.SOUL_SPEED_BLOCKS)) + ) + ), + LootItemEntityPropertyCondition.hasProperties( + LootContext.EntityTarget.THIS, + EntityPredicate.Builder.entity().flags(net.minecraft.advancements.critereon.EntityFlagsPredicate.Builder.flags().setOnGround(false)).build() + ) + ) + ), + AllOfCondition.allOf( + EnchantmentActiveCheck.enchantmentInactiveCheck(), + LootItemEntityPropertyCondition.hasProperties( + LootContext.EntityTarget.THIS, + EntityPredicate.Builder.entity() + .movementAffectedBy( + net.minecraft.advancements.critereon.LocationPredicate.Builder.location() + .setBlock(net.minecraft.advancements.critereon.BlockPredicate.Builder.block().of(holderGetter4, BlockTags.SOUL_SPEED_BLOCKS)) + ) + .flags(net.minecraft.advancements.critereon.EntityFlagsPredicate.Builder.flags().setIsFlying(false)) + ) + ) + ) + ); register( context, SOUL_SPEED, @@ -409,76 +447,34 @@ public class Enchantments { ) .withEffect( EnchantmentEffectComponents.LOCATION_CHANGED, - new EnchantmentAttributeEffect( - ResourceLocation.withDefaultNamespace("enchantment.soul_speed"), - Attributes.MOVEMENT_SPEED, - LevelBasedValue.perLevel(0.0405F, 0.0105F), - AttributeModifier.Operation.ADD_VALUE - ), - AllOfCondition.allOf( - InvertedLootItemCondition.invert( - LootItemEntityPropertyCondition.hasProperties(LootContext.EntityTarget.THIS, EntityPredicate.Builder.entity().vehicle(EntityPredicate.Builder.entity())) + AllOf.locationBasedEffects( + new EnchantmentAttributeEffect( + ResourceLocation.withDefaultNamespace("enchantment.soul_speed"), + Attributes.MOVEMENT_SPEED, + LevelBasedValue.perLevel(0.0405F, 0.0105F), + AttributeModifier.Operation.ADD_VALUE ), - AnyOfCondition.anyOf( - AllOfCondition.allOf( - EnchantmentActiveCheck.enchantmentActiveCheck(), - LootItemEntityPropertyCondition.hasProperties( - LootContext.EntityTarget.THIS, EntityPredicate.Builder.entity().flags(EntityFlagsPredicate.Builder.flags().setIsFlying(false)) - ), - AnyOfCondition.anyOf( - LootItemEntityPropertyCondition.hasProperties( - LootContext.EntityTarget.THIS, - EntityPredicate.Builder.entity() - .movementAffectedBy( - LocationPredicate.Builder.location().setBlock(net.minecraft.advancements.critereon.BlockPredicate.Builder.block().of(BlockTags.SOUL_SPEED_BLOCKS)) - ) - ), - LootItemEntityPropertyCondition.hasProperties( - LootContext.EntityTarget.THIS, EntityPredicate.Builder.entity().flags(EntityFlagsPredicate.Builder.flags().setOnGround(false)).build() - ) - ) - ), - AllOfCondition.allOf( - EnchantmentActiveCheck.enchantmentInactiveCheck(), - LootItemEntityPropertyCondition.hasProperties( - LootContext.EntityTarget.THIS, - EntityPredicate.Builder.entity() - .movementAffectedBy( - LocationPredicate.Builder.location().setBlock(net.minecraft.advancements.critereon.BlockPredicate.Builder.block().of(BlockTags.SOUL_SPEED_BLOCKS)) - ) - .flags(EntityFlagsPredicate.Builder.flags().setIsFlying(false)) - ) - ) + new EnchantmentAttributeEffect( + ResourceLocation.withDefaultNamespace("enchantment.soul_speed"), + Attributes.MOVEMENT_EFFICIENCY, + LevelBasedValue.constant(1.0F), + AttributeModifier.Operation.ADD_VALUE ) - ) - ) - .withEffect( - EnchantmentEffectComponents.LOCATION_CHANGED, - new EnchantmentAttributeEffect( - ResourceLocation.withDefaultNamespace("enchantment.soul_speed"), - Attributes.MOVEMENT_EFFICIENCY, - LevelBasedValue.constant(1.0F), - AttributeModifier.Operation.ADD_VALUE ), - LootItemEntityPropertyCondition.hasProperties( - LootContext.EntityTarget.THIS, - EntityPredicate.Builder.entity() - .movementAffectedBy( - LocationPredicate.Builder.location().setBlock(net.minecraft.advancements.critereon.BlockPredicate.Builder.block().of(BlockTags.SOUL_SPEED_BLOCKS)) - ) - ) + builder2 ) .withEffect( EnchantmentEffectComponents.LOCATION_CHANGED, - new DamageItem(LevelBasedValue.constant(1.0F)), + new ChangeItemDamage(LevelBasedValue.constant(1.0F)), AllOfCondition.allOf( LootItemRandomChanceCondition.randomChance(EnchantmentLevelProvider.forEnchantmentLevel(LevelBasedValue.constant(0.04F))), LootItemEntityPropertyCondition.hasProperties( LootContext.EntityTarget.THIS, EntityPredicate.Builder.entity() - .flags(EntityFlagsPredicate.Builder.flags().setOnGround(true)) + .flags(net.minecraft.advancements.critereon.EntityFlagsPredicate.Builder.flags().setOnGround(true)) .movementAffectedBy( - LocationPredicate.Builder.location().setBlock(net.minecraft.advancements.critereon.BlockPredicate.Builder.block().of(BlockTags.SOUL_SPEED_BLOCKS)) + net.minecraft.advancements.critereon.LocationPredicate.Builder.location() + .setBlock(net.minecraft.advancements.critereon.BlockPredicate.Builder.block().of(holderGetter4, BlockTags.SOUL_SPEED_BLOCKS)) ) ) ) @@ -565,7 +561,7 @@ public class Enchantments { EnchantmentEffectComponents.DAMAGE, new AddValue(LevelBasedValue.perLevel(2.5F)), LootItemEntityPropertyCondition.hasProperties( - LootContext.EntityTarget.THIS, EntityPredicate.Builder.entity().entityType(EntityTypePredicate.of(EntityTypeTags.SENSITIVE_TO_SMITE)) + LootContext.EntityTarget.THIS, EntityPredicate.Builder.entity().entityType(EntityTypePredicate.of(holderGetter5, EntityTypeTags.SENSITIVE_TO_SMITE)) ) ) ); @@ -589,7 +585,8 @@ public class Enchantments { EnchantmentEffectComponents.DAMAGE, new AddValue(LevelBasedValue.perLevel(2.5F)), LootItemEntityPropertyCondition.hasProperties( - LootContext.EntityTarget.THIS, EntityPredicate.Builder.entity().entityType(EntityTypePredicate.of(EntityTypeTags.SENSITIVE_TO_BANE_OF_ARTHROPODS)) + LootContext.EntityTarget.THIS, + EntityPredicate.Builder.entity().entityType(EntityTypePredicate.of(holderGetter5, EntityTypeTags.SENSITIVE_TO_BANE_OF_ARTHROPODS)) ) ) .withEffect( @@ -604,9 +601,10 @@ public class Enchantments { LevelBasedValue.constant(3.0F) ), LootItemEntityPropertyCondition.hasProperties( - LootContext.EntityTarget.THIS, EntityPredicate.Builder.entity().entityType(EntityTypePredicate.of(EntityTypeTags.SENSITIVE_TO_BANE_OF_ARTHROPODS)) + LootContext.EntityTarget.THIS, + EntityPredicate.Builder.entity().entityType(EntityTypePredicate.of(holderGetter5, EntityTypeTags.SENSITIVE_TO_BANE_OF_ARTHROPODS)) ) - .and(DamageSourceCondition.hasDamageSource(DamageSourcePredicate.Builder.damageType().isDirect(true))) + .and(DamageSourceCondition.hasDamageSource(Builder.damageType().isDirect(true))) ) ); register( @@ -645,7 +643,7 @@ public class Enchantments { EnchantmentTarget.ATTACKER, EnchantmentTarget.VICTIM, new Ignite(LevelBasedValue.perLevel(4.0F)), - DamageSourceCondition.hasDamageSource(DamageSourcePredicate.Builder.damageType().isDirect(true)) + DamageSourceCondition.hasDamageSource(Builder.damageType().isDirect(true)) ) ); register( @@ -668,7 +666,7 @@ public class Enchantments { EnchantmentTarget.VICTIM, new AddValue(LevelBasedValue.perLevel(0.01F)), LootItemEntityPropertyCondition.hasProperties( - LootContext.EntityTarget.ATTACKER, EntityPredicate.Builder.entity().entityType(EntityTypePredicate.of(EntityType.PLAYER)) + LootContext.EntityTarget.ATTACKER, EntityPredicate.Builder.entity().entityType(EntityTypePredicate.of(holderGetter5, EntityType.PLAYER)) ) ) ); @@ -685,7 +683,7 @@ public class Enchantments { new EnchantmentAttributeEffect( ResourceLocation.withDefaultNamespace("enchantment.sweeping_edge"), Attributes.SWEEPING_DAMAGE_RATIO, - new LevelBasedValue.Fraction(LevelBasedValue.perLevel(1.0F), LevelBasedValue.perLevel(2.0F, 1.0F)), + new Fraction(LevelBasedValue.perLevel(1.0F), LevelBasedValue.perLevel(2.0F, 1.0F)), AttributeModifier.Operation.ADD_VALUE ) ) @@ -709,7 +707,7 @@ public class Enchantments { new EnchantmentAttributeEffect( ResourceLocation.withDefaultNamespace("enchantment.efficiency"), Attributes.MINING_EFFICIENCY, - new LevelBasedValue.LevelsSquared(1.0F), + new LevelsSquared(1.0F), AttributeModifier.Operation.ADD_VALUE ) ) @@ -741,13 +739,13 @@ public class Enchantments { ) .withEffect( EnchantmentEffectComponents.ITEM_DAMAGE, - new RemoveBinomial(new LevelBasedValue.Fraction(LevelBasedValue.perLevel(2.0F), LevelBasedValue.perLevel(10.0F, 5.0F))), - MatchTool.toolMatches(ItemPredicate.Builder.item().of(ItemTags.ARMOR_ENCHANTABLE)) + new RemoveBinomial(new Fraction(LevelBasedValue.perLevel(2.0F), LevelBasedValue.perLevel(10.0F, 5.0F))), + MatchTool.toolMatches(ItemPredicate.Builder.item().of(holderGetter3, ItemTags.ARMOR_ENCHANTABLE)) ) .withEffect( EnchantmentEffectComponents.ITEM_DAMAGE, - new RemoveBinomial(new LevelBasedValue.Fraction(LevelBasedValue.perLevel(1.0F), LevelBasedValue.perLevel(2.0F, 1.0F))), - InvertedLootItemCondition.invert(MatchTool.toolMatches(ItemPredicate.Builder.item().of(ItemTags.ARMOR_ENCHANTABLE))) + new RemoveBinomial(new Fraction(LevelBasedValue.perLevel(1.0F), LevelBasedValue.perLevel(2.0F, 1.0F))), + InvertedLootItemCondition.invert(MatchTool.toolMatches(ItemPredicate.Builder.item().of(holderGetter3, ItemTags.ARMOR_ENCHANTABLE))) ) ); register( @@ -783,7 +781,9 @@ public class Enchantments { .withEffect( EnchantmentEffectComponents.DAMAGE, new AddValue(LevelBasedValue.perLevel(0.5F)), - LootItemEntityPropertyCondition.hasProperties(LootContext.EntityTarget.DIRECT_ATTACKER, EntityPredicate.Builder.entity().of(EntityTypeTags.ARROWS).build()) + LootItemEntityPropertyCondition.hasProperties( + LootContext.EntityTarget.DIRECT_ATTACKER, EntityPredicate.Builder.entity().of(holderGetter5, EntityTypeTags.ARROWS).build() + ) ) ); register( @@ -803,7 +803,9 @@ public class Enchantments { .withEffect( EnchantmentEffectComponents.KNOCKBACK, new AddValue(LevelBasedValue.perLevel(1.0F)), - LootItemEntityPropertyCondition.hasProperties(LootContext.EntityTarget.DIRECT_ATTACKER, EntityPredicate.Builder.entity().of(EntityTypeTags.ARROWS).build()) + LootItemEntityPropertyCondition.hasProperties( + LootContext.EntityTarget.DIRECT_ATTACKER, EntityPredicate.Builder.entity().of(holderGetter5, EntityTypeTags.ARROWS).build() + ) ) ); register( @@ -826,7 +828,9 @@ public class Enchantments { ) .exclusiveWith(holderGetter2.getOrThrow(EnchantmentTags.BOW_EXCLUSIVE)) .withEffect( - EnchantmentEffectComponents.AMMO_USE, new SetValue(LevelBasedValue.constant(0.0F)), MatchTool.toolMatches(ItemPredicate.Builder.item().of(Items.ARROW)) + EnchantmentEffectComponents.AMMO_USE, + new SetValue(LevelBasedValue.constant(0.0F)), + MatchTool.toolMatches(ItemPredicate.Builder.item().of(holderGetter3, Items.ARROW)) ) ); register( @@ -896,7 +900,8 @@ public class Enchantments { EnchantmentEffectComponents.DAMAGE, new AddValue(LevelBasedValue.perLevel(2.5F)), LootItemEntityPropertyCondition.hasProperties( - LootContext.EntityTarget.THIS, EntityPredicate.Builder.entity().entityType(EntityTypePredicate.of(EntityTypeTags.SENSITIVE_TO_IMPALING)).build() + LootContext.EntityTarget.THIS, + EntityPredicate.Builder.entity().entityType(EntityTypePredicate.of(holderGetter5, EntityTypeTags.SENSITIVE_TO_IMPALING)).build() ) ) ); @@ -933,9 +938,12 @@ public class Enchantments { AllOfCondition.allOf( WeatherCheck.weather().setThundering(true), LootItemEntityPropertyCondition.hasProperties( - LootContext.EntityTarget.THIS, EntityPredicate.Builder.entity().located(LocationPredicate.Builder.location().setCanSeeSky(true)) + LootContext.EntityTarget.THIS, + EntityPredicate.Builder.entity().located(net.minecraft.advancements.critereon.LocationPredicate.Builder.location().setCanSeeSky(true)) ), - LootItemEntityPropertyCondition.hasProperties(LootContext.EntityTarget.DIRECT_ATTACKER, EntityPredicate.Builder.entity().of(EntityType.TRIDENT)) + LootItemEntityPropertyCondition.hasProperties( + LootContext.EntityTarget.DIRECT_ATTACKER, EntityPredicate.Builder.entity().of(holderGetter5, EntityType.TRIDENT) + ) ) ) .withEffect( @@ -946,8 +954,8 @@ public class Enchantments { ), AllOfCondition.allOf( WeatherCheck.weather().setThundering(true), - LootItemEntityPropertyCondition.hasProperties(LootContext.EntityTarget.THIS, EntityPredicate.Builder.entity().of(EntityType.TRIDENT)), - LocationCheck.checkLocation(LocationPredicate.Builder.location().setCanSeeSky(true)), + LootItemEntityPropertyCondition.hasProperties(LootContext.EntityTarget.THIS, EntityPredicate.Builder.entity().of(holderGetter5, EntityType.TRIDENT)), + LocationCheck.checkLocation(net.minecraft.advancements.critereon.LocationPredicate.Builder.location().setCanSeeSky(true)), LootItemBlockStatePropertyCondition.hasBlockStateProperties(Blocks.LIGHTNING_ROD) ) ) @@ -1056,8 +1064,8 @@ public class Enchantments { LootItemEntityPropertyCondition.hasProperties( LootContext.EntityTarget.DIRECT_ATTACKER, EntityPredicate.Builder.entity() - .flags(EntityFlagsPredicate.Builder.flags().setIsFlying(false)) - .moving(MovementPredicate.fallDistance(MinMaxBounds.Doubles.atLeast(1.5))) + .flags(net.minecraft.advancements.critereon.EntityFlagsPredicate.Builder.flags().setIsFlying(false)) + .moving(MovementPredicate.fallDistance(Doubles.atLeast(1.5))) ) ) ); diff --git a/net/minecraft/world/item/enchantment/ItemEnchantments.java b/net/minecraft/world/item/enchantment/ItemEnchantments.java index 08812f42..f1fdecd1 100644 --- a/net/minecraft/world/item/enchantment/ItemEnchantments.java +++ b/net/minecraft/world/item/enchantment/ItemEnchantments.java @@ -29,7 +29,7 @@ import org.jetbrains.annotations.Nullable; public class ItemEnchantments implements TooltipProvider { public static final ItemEnchantments EMPTY = new ItemEnchantments(new Object2IntOpenHashMap<>(), true); - private static final Codec LEVEL_CODEC = Codec.intRange(0, 255); + private static final Codec LEVEL_CODEC = Codec.intRange(1, 255); private static final Codec>> LEVELS_CODEC = Codec.unboundedMap(Enchantment.CODEC, LEVEL_CODEC) .xmap(Object2IntOpenHashMap::new, Function.identity()); private static final Codec FULL_CODEC = RecordCodecBuilder.create( diff --git a/net/minecraft/world/item/enchantment/Repairable.java b/net/minecraft/world/item/enchantment/Repairable.java new file mode 100644 index 00000000..46bfec7f --- /dev/null +++ b/net/minecraft/world/item/enchantment/Repairable.java @@ -0,0 +1,25 @@ +package net.minecraft.world.item.enchantment; + +import com.mojang.serialization.Codec; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import net.minecraft.core.HolderSet; +import net.minecraft.core.RegistryCodecs; +import net.minecraft.core.registries.Registries; +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; + +public record Repairable(HolderSet items) { + public static final Codec CODEC = RecordCodecBuilder.create( + instance -> instance.group(RegistryCodecs.homogeneousList(Registries.ITEM).fieldOf("items").forGetter(Repairable::items)).apply(instance, Repairable::new) + ); + public static final StreamCodec STREAM_CODEC = StreamCodec.composite( + ByteBufCodecs.holderSet(Registries.ITEM), Repairable::items, Repairable::new + ); + + public boolean isValidRepairItem(ItemStack itemStack) { + return itemStack.is(this.items); + } +} diff --git a/net/minecraft/world/item/enchantment/TargetedConditionalEffect.java b/net/minecraft/world/item/enchantment/TargetedConditionalEffect.java index 2deb541a..cf9ea9d8 100644 --- a/net/minecraft/world/item/enchantment/TargetedConditionalEffect.java +++ b/net/minecraft/world/item/enchantment/TargetedConditionalEffect.java @@ -4,24 +4,24 @@ import com.mojang.serialization.Codec; import com.mojang.serialization.DataResult; import com.mojang.serialization.codecs.RecordCodecBuilder; import java.util.Optional; +import net.minecraft.util.context.ContextKeySet; import net.minecraft.world.level.storage.loot.LootContext; -import net.minecraft.world.level.storage.loot.parameters.LootContextParamSet; import net.minecraft.world.level.storage.loot.predicates.LootItemCondition; public record TargetedConditionalEffect(EnchantmentTarget enchanted, EnchantmentTarget affected, T effect, Optional requirements) { - public static Codec> codec(Codec codec, LootContextParamSet params) { + public static Codec> codec(Codec codec, ContextKeySet contextKeySet) { return RecordCodecBuilder.create( instance -> instance.group( EnchantmentTarget.CODEC.fieldOf("enchanted").forGetter(TargetedConditionalEffect::enchanted), EnchantmentTarget.CODEC.fieldOf("affected").forGetter(TargetedConditionalEffect::affected), codec.fieldOf("effect").forGetter(TargetedConditionalEffect::effect), - ConditionalEffect.conditionCodec(params).optionalFieldOf("requirements").forGetter(TargetedConditionalEffect::requirements) + ConditionalEffect.conditionCodec(contextKeySet).optionalFieldOf("requirements").forGetter(TargetedConditionalEffect::requirements) ) .apply(instance, TargetedConditionalEffect::new) ); } - public static Codec> equipmentDropsCodec(Codec codec, LootContextParamSet params) { + public static Codec> equipmentDropsCodec(Codec codec, ContextKeySet contextKeySet) { return RecordCodecBuilder.create( instance -> instance.group( EnchantmentTarget.CODEC @@ -33,7 +33,7 @@ public record TargetedConditionalEffect(EnchantmentTarget enchanted, Enchantm .fieldOf("enchanted") .forGetter(TargetedConditionalEffect::enchanted), codec.fieldOf("effect").forGetter(TargetedConditionalEffect::effect), - ConditionalEffect.conditionCodec(params).optionalFieldOf("requirements").forGetter(TargetedConditionalEffect::requirements) + ConditionalEffect.conditionCodec(contextKeySet).optionalFieldOf("requirements").forGetter(TargetedConditionalEffect::requirements) ) .apply(instance, (enchantmentTarget, object, optional) -> new TargetedConditionalEffect<>(enchantmentTarget, EnchantmentTarget.VICTIM, object, optional)) ); diff --git a/net/minecraft/world/item/enchantment/effects/ChangeItemDamage.java b/net/minecraft/world/item/enchantment/effects/ChangeItemDamage.java new file mode 100644 index 00000000..91a2397c --- /dev/null +++ b/net/minecraft/world/item/enchantment/effects/ChangeItemDamage.java @@ -0,0 +1,34 @@ +package net.minecraft.world.item.enchantment.effects; + +import com.mojang.serialization.MapCodec; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import net.minecraft.core.component.DataComponents; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.enchantment.EnchantedItemInUse; +import net.minecraft.world.item.enchantment.LevelBasedValue; +import net.minecraft.world.phys.Vec3; + +public record ChangeItemDamage(LevelBasedValue amount) implements EnchantmentEntityEffect { + public static final MapCodec CODEC = RecordCodecBuilder.mapCodec( + instance -> instance.group(LevelBasedValue.CODEC.fieldOf("amount").forGetter(changeItemDamage -> changeItemDamage.amount)) + .apply(instance, ChangeItemDamage::new) + ); + + @Override + public void apply(ServerLevel level, int enchantmentLevel, EnchantedItemInUse item, Entity entity, Vec3 origin) { + ItemStack itemStack = item.itemStack(); + if (itemStack.has(DataComponents.MAX_DAMAGE) && itemStack.has(DataComponents.DAMAGE)) { + ServerPlayer serverPlayer2 = item.owner() instanceof ServerPlayer serverPlayer ? serverPlayer : null; + int i = (int)this.amount.calculate(enchantmentLevel); + itemStack.hurtAndBreak(i, level, serverPlayer2, item.onBreak()); + } + } + + @Override + public MapCodec codec() { + return CODEC; + } +} diff --git a/net/minecraft/world/item/enchantment/effects/DamageEntity.java b/net/minecraft/world/item/enchantment/effects/DamageEntity.java index fb997ce7..2785eedb 100644 --- a/net/minecraft/world/item/enchantment/effects/DamageEntity.java +++ b/net/minecraft/world/item/enchantment/effects/DamageEntity.java @@ -25,7 +25,7 @@ public record DamageEntity(LevelBasedValue minDamage, LevelBasedValue maxDamage, @Override public void apply(ServerLevel level, int enchantmentLevel, EnchantedItemInUse item, Entity entity, Vec3 origin) { float f = Mth.randomBetween(entity.getRandom(), this.minDamage.calculate(enchantmentLevel), this.maxDamage.calculate(enchantmentLevel)); - entity.hurt(new DamageSource(this.damageType, item.owner()), f); + entity.hurtServer(level, new DamageSource(this.damageType, item.owner()), f); } @Override diff --git a/net/minecraft/world/item/enchantment/effects/DamageItem.java b/net/minecraft/world/item/enchantment/effects/DamageItem.java deleted file mode 100644 index 00d624f8..00000000 --- a/net/minecraft/world/item/enchantment/effects/DamageItem.java +++ /dev/null @@ -1,27 +0,0 @@ -package net.minecraft.world.item.enchantment.effects; - -import com.mojang.serialization.MapCodec; -import com.mojang.serialization.codecs.RecordCodecBuilder; -import net.minecraft.server.level.ServerLevel; -import net.minecraft.server.level.ServerPlayer; -import net.minecraft.world.entity.Entity; -import net.minecraft.world.item.enchantment.EnchantedItemInUse; -import net.minecraft.world.item.enchantment.LevelBasedValue; -import net.minecraft.world.phys.Vec3; - -public record DamageItem(LevelBasedValue amount) implements EnchantmentEntityEffect { - public static final MapCodec CODEC = RecordCodecBuilder.mapCodec( - instance -> instance.group(LevelBasedValue.CODEC.fieldOf("amount").forGetter(damageItem -> damageItem.amount)).apply(instance, DamageItem::new) - ); - - @Override - public void apply(ServerLevel level, int enchantmentLevel, EnchantedItemInUse item, Entity entity, Vec3 origin) { - ServerPlayer serverPlayer2 = item.owner() instanceof ServerPlayer serverPlayer ? serverPlayer : null; - item.itemStack().hurtAndBreak((int)this.amount.calculate(enchantmentLevel), level, serverPlayer2, item.onBreak()); - } - - @Override - public MapCodec codec() { - return CODEC; - } -} diff --git a/net/minecraft/world/item/enchantment/effects/EnchantmentEntityEffect.java b/net/minecraft/world/item/enchantment/effects/EnchantmentEntityEffect.java index 10b18ecb..f851bdae 100644 --- a/net/minecraft/world/item/enchantment/effects/EnchantmentEntityEffect.java +++ b/net/minecraft/world/item/enchantment/effects/EnchantmentEntityEffect.java @@ -18,8 +18,8 @@ public interface EnchantmentEntityEffect extends EnchantmentLocationBasedEffect static MapCodec bootstrap(Registry> registry) { Registry.register(registry, "all_of", AllOf.EntityEffects.CODEC); Registry.register(registry, "apply_mob_effect", ApplyMobEffect.CODEC); + Registry.register(registry, "change_item_damage", ChangeItemDamage.CODEC); Registry.register(registry, "damage_entity", DamageEntity.CODEC); - Registry.register(registry, "damage_item", DamageItem.CODEC); Registry.register(registry, "explode", ExplodeEffect.CODEC); Registry.register(registry, "ignite", Ignite.CODEC); Registry.register(registry, "play_sound", PlaySoundEffect.CODEC); diff --git a/net/minecraft/world/item/enchantment/effects/EnchantmentLocationBasedEffect.java b/net/minecraft/world/item/enchantment/effects/EnchantmentLocationBasedEffect.java index 947a849c..e6ec733a 100644 --- a/net/minecraft/world/item/enchantment/effects/EnchantmentLocationBasedEffect.java +++ b/net/minecraft/world/item/enchantment/effects/EnchantmentLocationBasedEffect.java @@ -19,8 +19,8 @@ public interface EnchantmentLocationBasedEffect { Registry.register(registry, "all_of", AllOf.LocationBasedEffects.CODEC); Registry.register(registry, "apply_mob_effect", ApplyMobEffect.CODEC); Registry.register(registry, "attribute", EnchantmentAttributeEffect.CODEC); + Registry.register(registry, "change_item_damage", ChangeItemDamage.CODEC); Registry.register(registry, "damage_entity", DamageEntity.CODEC); - Registry.register(registry, "damage_item", DamageItem.CODEC); Registry.register(registry, "explode", ExplodeEffect.CODEC); Registry.register(registry, "ignite", Ignite.CODEC); Registry.register(registry, "play_sound", PlaySoundEffect.CODEC); diff --git a/net/minecraft/world/item/enchantment/effects/SpawnParticlesEffect.java b/net/minecraft/world/item/enchantment/effects/SpawnParticlesEffect.java index 864cc949..0a3ce02b 100644 --- a/net/minecraft/world/item/enchantment/effects/SpawnParticlesEffect.java +++ b/net/minecraft/world/item/enchantment/effects/SpawnParticlesEffect.java @@ -14,6 +14,7 @@ import net.minecraft.util.valueproviders.ConstantFloat; import net.minecraft.util.valueproviders.FloatProvider; import net.minecraft.world.entity.Entity; import net.minecraft.world.item.enchantment.EnchantedItemInUse; +import net.minecraft.world.item.enchantment.effects.SpawnParticlesEffect.PositionSourceType.CoordinateSource; import net.minecraft.world.phys.Vec3; public record SpawnParticlesEffect( @@ -102,9 +103,9 @@ public record SpawnParticlesEffect( public static final Codec CODEC = StringRepresentable.fromEnum(SpawnParticlesEffect.PositionSourceType::values); private final String id; - private final SpawnParticlesEffect.PositionSourceType.CoordinateSource source; + private final CoordinateSource source; - private PositionSourceType(final String id, final SpawnParticlesEffect.PositionSourceType.CoordinateSource source) { + private PositionSourceType(final String id, final CoordinateSource source) { this.id = id; this.source = source; } @@ -117,11 +118,6 @@ public record SpawnParticlesEffect( public String getSerializedName() { return this.id; } - - @FunctionalInterface - interface CoordinateSource { - double getCoordinate(double d, double e, float f, RandomSource randomSource); - } } public record VelocitySource(float movementScale, FloatProvider base) { diff --git a/net/minecraft/world/item/enchantment/effects/SummonEntityEffect.java b/net/minecraft/world/item/enchantment/effects/SummonEntityEffect.java index 5388ddca..ddd106d2 100644 --- a/net/minecraft/world/item/enchantment/effects/SummonEntityEffect.java +++ b/net/minecraft/world/item/enchantment/effects/SummonEntityEffect.java @@ -12,9 +12,9 @@ import net.minecraft.core.registries.Registries; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LightningBolt; -import net.minecraft.world.entity.MobSpawnType; import net.minecraft.world.item.enchantment.EnchantedItemInUse; import net.minecraft.world.level.Level; import net.minecraft.world.phys.Vec3; @@ -34,7 +34,7 @@ public record SummonEntityEffect(HolderSet> entityTypes, boolean j if (Level.isInSpawnableBounds(blockPos)) { Optional>> optional = this.entityTypes().getRandomElement(level.getRandom()); if (!optional.isEmpty()) { - Entity entity2 = ((EntityType)((Holder)optional.get()).value()).spawn(level, blockPos, MobSpawnType.TRIGGERED); + Entity entity2 = ((EntityType)((Holder)optional.get()).value()).spawn(level, blockPos, EntitySpawnReason.TRIGGERED); if (entity2 != null) { if (entity2 instanceof LightningBolt lightningBolt && item.owner() instanceof ServerPlayer serverPlayer) { lightningBolt.setCause(serverPlayer); diff --git a/net/minecraft/world/item/equipment/ArmorMaterial.java b/net/minecraft/world/item/equipment/ArmorMaterial.java new file mode 100644 index 00000000..af42908f --- /dev/null +++ b/net/minecraft/world/item/equipment/ArmorMaterial.java @@ -0,0 +1,76 @@ +package net.minecraft.world.item.equipment; + +import java.util.Map; +import net.minecraft.core.Holder; +import net.minecraft.core.HolderSet; +import net.minecraft.core.component.DataComponents; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.sounds.SoundEvent; +import net.minecraft.tags.TagKey; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.EquipmentSlot; +import net.minecraft.world.entity.EquipmentSlotGroup; +import net.minecraft.world.entity.ai.attributes.AttributeModifier; +import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.component.ItemAttributeModifiers; +import net.minecraft.world.item.component.ItemAttributeModifiers.Builder; + +public record ArmorMaterial( + int durability, + Map defense, + int enchantmentValue, + Holder equipSound, + float toughness, + float knockbackResistance, + TagKey repairIngredient, + ResourceLocation modelId +) { + public Item.Properties humanoidProperties(Item.Properties properties, ArmorType armorType) { + return properties.durability(armorType.getDurability(this.durability)) + .attributes(this.createAttributes(armorType)) + .enchantable(this.enchantmentValue) + .component(DataComponents.EQUIPPABLE, Equippable.builder(armorType.getSlot()).setEquipSound(this.equipSound).setModel(this.modelId).build()) + .repairable(this.repairIngredient); + } + + public Item.Properties animalProperties(Item.Properties properties, HolderSet> holderSet) { + return properties.durability(ArmorType.BODY.getDurability(this.durability)) + .attributes(this.createAttributes(ArmorType.BODY)) + .repairable(this.repairIngredient) + .component( + DataComponents.EQUIPPABLE, + Equippable.builder(EquipmentSlot.BODY).setEquipSound(this.equipSound).setModel(this.modelId).setAllowedEntities(holderSet).build() + ); + } + + public Item.Properties animalProperties(Item.Properties properties, Holder holder, boolean bl, HolderSet> holderSet) { + if (bl) { + properties = properties.durability(ArmorType.BODY.getDurability(this.durability)).repairable(this.repairIngredient); + } + + return properties.attributes(this.createAttributes(ArmorType.BODY)) + .component( + DataComponents.EQUIPPABLE, + Equippable.builder(EquipmentSlot.BODY).setEquipSound(holder).setModel(this.modelId).setAllowedEntities(holderSet).setDamageOnHurt(bl).build() + ); + } + + private ItemAttributeModifiers createAttributes(ArmorType armorType) { + int i = (Integer)this.defense.getOrDefault(armorType, 0); + Builder builder = ItemAttributeModifiers.builder(); + EquipmentSlotGroup equipmentSlotGroup = EquipmentSlotGroup.bySlot(armorType.getSlot()); + ResourceLocation resourceLocation = ResourceLocation.withDefaultNamespace("armor." + armorType.getName()); + builder.add(Attributes.ARMOR, new AttributeModifier(resourceLocation, i, AttributeModifier.Operation.ADD_VALUE), equipmentSlotGroup); + builder.add(Attributes.ARMOR_TOUGHNESS, new AttributeModifier(resourceLocation, this.toughness, AttributeModifier.Operation.ADD_VALUE), equipmentSlotGroup); + if (this.knockbackResistance > 0.0F) { + builder.add( + Attributes.KNOCKBACK_RESISTANCE, + new AttributeModifier(resourceLocation, this.knockbackResistance, AttributeModifier.Operation.ADD_VALUE), + equipmentSlotGroup + ); + } + + return builder.build(); + } +} diff --git a/net/minecraft/world/item/equipment/ArmorMaterials.java b/net/minecraft/world/item/equipment/ArmorMaterials.java new file mode 100644 index 00000000..406b290a --- /dev/null +++ b/net/minecraft/world/item/equipment/ArmorMaterials.java @@ -0,0 +1,65 @@ +package net.minecraft.world.item.equipment; + +import java.util.EnumMap; +import net.minecraft.Util; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.tags.ItemTags; + +public interface ArmorMaterials { + ArmorMaterial LEATHER = new ArmorMaterial(5, Util.make(new EnumMap(ArmorType.class), enumMap -> { + enumMap.put(ArmorType.BOOTS, 1); + enumMap.put(ArmorType.LEGGINGS, 2); + enumMap.put(ArmorType.CHESTPLATE, 3); + enumMap.put(ArmorType.HELMET, 1); + enumMap.put(ArmorType.BODY, 3); + }), 15, SoundEvents.ARMOR_EQUIP_LEATHER, 0.0F, 0.0F, ItemTags.REPAIRS_LEATHER_ARMOR, EquipmentModels.LEATHER); + ArmorMaterial CHAINMAIL = new ArmorMaterial(15, Util.make(new EnumMap(ArmorType.class), enumMap -> { + enumMap.put(ArmorType.BOOTS, 1); + enumMap.put(ArmorType.LEGGINGS, 4); + enumMap.put(ArmorType.CHESTPLATE, 5); + enumMap.put(ArmorType.HELMET, 2); + enumMap.put(ArmorType.BODY, 4); + }), 12, SoundEvents.ARMOR_EQUIP_CHAIN, 0.0F, 0.0F, ItemTags.REPAIRS_CHAIN_ARMOR, EquipmentModels.CHAINMAIL); + ArmorMaterial IRON = new ArmorMaterial(15, Util.make(new EnumMap(ArmorType.class), enumMap -> { + enumMap.put(ArmorType.BOOTS, 2); + enumMap.put(ArmorType.LEGGINGS, 5); + enumMap.put(ArmorType.CHESTPLATE, 6); + enumMap.put(ArmorType.HELMET, 2); + enumMap.put(ArmorType.BODY, 5); + }), 9, SoundEvents.ARMOR_EQUIP_IRON, 0.0F, 0.0F, ItemTags.REPAIRS_IRON_ARMOR, EquipmentModels.IRON); + ArmorMaterial GOLD = new ArmorMaterial(7, Util.make(new EnumMap(ArmorType.class), enumMap -> { + enumMap.put(ArmorType.BOOTS, 1); + enumMap.put(ArmorType.LEGGINGS, 3); + enumMap.put(ArmorType.CHESTPLATE, 5); + enumMap.put(ArmorType.HELMET, 2); + enumMap.put(ArmorType.BODY, 7); + }), 25, SoundEvents.ARMOR_EQUIP_GOLD, 0.0F, 0.0F, ItemTags.REPAIRS_GOLD_ARMOR, EquipmentModels.GOLD); + ArmorMaterial DIAMOND = new ArmorMaterial(33, Util.make(new EnumMap(ArmorType.class), enumMap -> { + enumMap.put(ArmorType.BOOTS, 3); + enumMap.put(ArmorType.LEGGINGS, 6); + enumMap.put(ArmorType.CHESTPLATE, 8); + enumMap.put(ArmorType.HELMET, 3); + enumMap.put(ArmorType.BODY, 11); + }), 10, SoundEvents.ARMOR_EQUIP_DIAMOND, 2.0F, 0.0F, ItemTags.REPAIRS_DIAMOND_ARMOR, EquipmentModels.DIAMOND); + ArmorMaterial TURTLE_SCUTE = new ArmorMaterial(25, Util.make(new EnumMap(ArmorType.class), enumMap -> { + enumMap.put(ArmorType.BOOTS, 2); + enumMap.put(ArmorType.LEGGINGS, 5); + enumMap.put(ArmorType.CHESTPLATE, 6); + enumMap.put(ArmorType.HELMET, 2); + enumMap.put(ArmorType.BODY, 5); + }), 9, SoundEvents.ARMOR_EQUIP_TURTLE, 0.0F, 0.0F, ItemTags.REPAIRS_TURTLE_HELMET, EquipmentModels.TURTLE_SCUTE); + ArmorMaterial NETHERITE = new ArmorMaterial(37, Util.make(new EnumMap(ArmorType.class), enumMap -> { + enumMap.put(ArmorType.BOOTS, 3); + enumMap.put(ArmorType.LEGGINGS, 6); + enumMap.put(ArmorType.CHESTPLATE, 8); + enumMap.put(ArmorType.HELMET, 3); + enumMap.put(ArmorType.BODY, 11); + }), 15, SoundEvents.ARMOR_EQUIP_NETHERITE, 3.0F, 0.1F, ItemTags.REPAIRS_NETHERITE_ARMOR, EquipmentModels.NETHERITE); + ArmorMaterial ARMADILLO_SCUTE = new ArmorMaterial(4, Util.make(new EnumMap(ArmorType.class), enumMap -> { + enumMap.put(ArmorType.BOOTS, 3); + enumMap.put(ArmorType.LEGGINGS, 6); + enumMap.put(ArmorType.CHESTPLATE, 8); + enumMap.put(ArmorType.HELMET, 3); + enumMap.put(ArmorType.BODY, 11); + }), 10, SoundEvents.ARMOR_EQUIP_WOLF, 0.0F, 0.0F, ItemTags.REPAIRS_WOLF_ARMOR, EquipmentModels.ARMADILLO_SCUTE); +} diff --git a/net/minecraft/world/item/equipment/ArmorType.java b/net/minecraft/world/item/equipment/ArmorType.java new file mode 100644 index 00000000..81c6c980 --- /dev/null +++ b/net/minecraft/world/item/equipment/ArmorType.java @@ -0,0 +1,41 @@ +package net.minecraft.world.item.equipment; + +import com.mojang.serialization.Codec; +import net.minecraft.util.StringRepresentable; +import net.minecraft.world.entity.EquipmentSlot; + +public enum ArmorType implements StringRepresentable { + HELMET(EquipmentSlot.HEAD, 11, "helmet"), + CHESTPLATE(EquipmentSlot.CHEST, 16, "chestplate"), + LEGGINGS(EquipmentSlot.LEGS, 15, "leggings"), + BOOTS(EquipmentSlot.FEET, 13, "boots"), + BODY(EquipmentSlot.BODY, 16, "body"); + + public static final Codec CODEC = StringRepresentable.fromValues(ArmorType::values); + private final EquipmentSlot slot; + private final String name; + private final int unitDurability; + + private ArmorType(final EquipmentSlot equipmentSlot, final int j, final String string2) { + this.slot = equipmentSlot; + this.name = string2; + this.unitDurability = j; + } + + public int getDurability(int i) { + return this.unitDurability * i; + } + + public EquipmentSlot getSlot() { + return this.slot; + } + + public String getName() { + return this.name; + } + + @Override + public String getSerializedName() { + return this.name; + } +} diff --git a/net/minecraft/world/item/equipment/EquipmentModel.java b/net/minecraft/world/item/equipment/EquipmentModel.java new file mode 100644 index 00000000..c4576629 --- /dev/null +++ b/net/minecraft/world/item/equipment/EquipmentModel.java @@ -0,0 +1,125 @@ +package net.minecraft.world.item.equipment; + +import com.google.common.collect.ImmutableMap; +import com.mojang.serialization.Codec; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.EnumMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Map.Entry; +import java.util.function.UnaryOperator; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.ExtraCodecs; +import net.minecraft.util.StringRepresentable; + +public record EquipmentModel(Map> layers) { + private static final Codec> LAYER_LIST_CODEC = ExtraCodecs.nonEmptyList(EquipmentModel.Layer.CODEC.listOf()); + public static final Codec CODEC = RecordCodecBuilder.create( + instance -> instance.group( + ExtraCodecs.nonEmptyMap(Codec.unboundedMap(EquipmentModel.LayerType.CODEC, LAYER_LIST_CODEC)).fieldOf("layers").forGetter(EquipmentModel::layers) + ) + .apply(instance, EquipmentModel::new) + ); + + public static EquipmentModel.Builder builder() { + return new EquipmentModel.Builder(); + } + + public List getLayers(EquipmentModel.LayerType layerType) { + return (List)this.layers.getOrDefault(layerType, List.of()); + } + + public static class Builder { + private final Map> layersByType = new EnumMap(EquipmentModel.LayerType.class); + + Builder() { + } + + public EquipmentModel.Builder addHumanoidLayers(ResourceLocation resourceLocation) { + return this.addHumanoidLayers(resourceLocation, false); + } + + public EquipmentModel.Builder addHumanoidLayers(ResourceLocation resourceLocation, boolean bl) { + this.addLayers(EquipmentModel.LayerType.HUMANOID_LEGGINGS, EquipmentModel.Layer.leatherDyeable(resourceLocation, bl)); + this.addMainHumanoidLayer(resourceLocation, bl); + return this; + } + + public EquipmentModel.Builder addMainHumanoidLayer(ResourceLocation resourceLocation, boolean bl) { + return this.addLayers(EquipmentModel.LayerType.HUMANOID, EquipmentModel.Layer.leatherDyeable(resourceLocation, bl)); + } + + public EquipmentModel.Builder addLayers(EquipmentModel.LayerType layerType, EquipmentModel.Layer... layers) { + Collections.addAll((Collection)this.layersByType.computeIfAbsent(layerType, layerTypex -> new ArrayList()), layers); + return this; + } + + public EquipmentModel build() { + return new EquipmentModel( + (Map>)this.layersByType + .entrySet() + .stream() + .collect(ImmutableMap.toImmutableMap(Entry::getKey, entry -> List.copyOf((Collection)entry.getValue()))) + ); + } + } + + public record Dyeable(Optional colorWhenUndyed) { + public static final Codec CODEC = RecordCodecBuilder.create( + instance -> instance.group(ExtraCodecs.RGB_COLOR_CODEC.optionalFieldOf("color_when_undyed").forGetter(EquipmentModel.Dyeable::colorWhenUndyed)) + .apply(instance, EquipmentModel.Dyeable::new) + ); + } + + public record Layer(ResourceLocation textureId, Optional dyeable, boolean usePlayerTexture) { + public static final Codec CODEC = RecordCodecBuilder.create( + instance -> instance.group( + ResourceLocation.CODEC.fieldOf("texture").forGetter(EquipmentModel.Layer::textureId), + EquipmentModel.Dyeable.CODEC.optionalFieldOf("dyeable").forGetter(EquipmentModel.Layer::dyeable), + Codec.BOOL.optionalFieldOf("use_player_texture", false).forGetter(EquipmentModel.Layer::usePlayerTexture) + ) + .apply(instance, EquipmentModel.Layer::new) + ); + + public Layer(ResourceLocation resourceLocation) { + this(resourceLocation, Optional.empty(), false); + } + + public static EquipmentModel.Layer leatherDyeable(ResourceLocation resourceLocation, boolean bl) { + return new EquipmentModel.Layer(resourceLocation, bl ? Optional.of(new EquipmentModel.Dyeable(Optional.of(-6265536))) : Optional.empty(), false); + } + + public static EquipmentModel.Layer onlyIfDyed(ResourceLocation resourceLocation, boolean bl) { + return new EquipmentModel.Layer(resourceLocation, bl ? Optional.of(new EquipmentModel.Dyeable(Optional.empty())) : Optional.empty(), false); + } + + public ResourceLocation getTextureLocation(EquipmentModel.LayerType layerType) { + return this.textureId.withPath((UnaryOperator)(string -> "textures/entity/equipment/" + layerType.getSerializedName() + "/" + string + ".png")); + } + } + + public static enum LayerType implements StringRepresentable { + HUMANOID("humanoid"), + HUMANOID_LEGGINGS("humanoid_leggings"), + WINGS("wings"), + WOLF_BODY("wolf_body"), + HORSE_BODY("horse_body"), + LLAMA_BODY("llama_body"); + + public static final Codec CODEC = StringRepresentable.fromEnum(EquipmentModel.LayerType::values); + private final String id; + + private LayerType(final String string2) { + this.id = string2; + } + + @Override + public String getSerializedName() { + return this.id; + } + } +} diff --git a/net/minecraft/world/item/equipment/EquipmentModels.java b/net/minecraft/world/item/equipment/EquipmentModels.java new file mode 100644 index 00000000..3a47a681 --- /dev/null +++ b/net/minecraft/world/item/equipment/EquipmentModels.java @@ -0,0 +1,84 @@ +package net.minecraft.world.item.equipment; + +import java.util.Map; +import java.util.Optional; +import java.util.Map.Entry; +import java.util.function.BiConsumer; +import net.minecraft.Util; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.DyeColor; + +public interface EquipmentModels { + ResourceLocation LEATHER = ResourceLocation.withDefaultNamespace("leather"); + ResourceLocation CHAINMAIL = ResourceLocation.withDefaultNamespace("chainmail"); + ResourceLocation IRON = ResourceLocation.withDefaultNamespace("iron"); + ResourceLocation GOLD = ResourceLocation.withDefaultNamespace("gold"); + ResourceLocation DIAMOND = ResourceLocation.withDefaultNamespace("diamond"); + ResourceLocation TURTLE_SCUTE = ResourceLocation.withDefaultNamespace("turtle_scute"); + ResourceLocation NETHERITE = ResourceLocation.withDefaultNamespace("netherite"); + ResourceLocation ARMADILLO_SCUTE = ResourceLocation.withDefaultNamespace("armadillo_scute"); + ResourceLocation ELYTRA = ResourceLocation.withDefaultNamespace("elytra"); + Map CARPETS = Util.makeEnumMap( + DyeColor.class, dyeColor -> ResourceLocation.withDefaultNamespace(dyeColor.getSerializedName() + "_carpet") + ); + ResourceLocation TRADER_LLAMA = ResourceLocation.withDefaultNamespace("trader_llama"); + + static void bootstrap(BiConsumer biConsumer) { + biConsumer.accept( + LEATHER, + EquipmentModel.builder() + .addHumanoidLayers(ResourceLocation.withDefaultNamespace("leather"), true) + .addHumanoidLayers(ResourceLocation.withDefaultNamespace("leather_overlay"), false) + .addLayers(EquipmentModel.LayerType.HORSE_BODY, EquipmentModel.Layer.leatherDyeable(ResourceLocation.withDefaultNamespace("leather"), true)) + .build() + ); + biConsumer.accept(CHAINMAIL, onlyHumanoid("chainmail")); + biConsumer.accept(IRON, humanoidAndHorse("iron")); + biConsumer.accept(GOLD, humanoidAndHorse("gold")); + biConsumer.accept(DIAMOND, humanoidAndHorse("diamond")); + biConsumer.accept(TURTLE_SCUTE, EquipmentModel.builder().addMainHumanoidLayer(ResourceLocation.withDefaultNamespace("turtle_scute"), false).build()); + biConsumer.accept(NETHERITE, onlyHumanoid("netherite")); + biConsumer.accept( + ARMADILLO_SCUTE, + EquipmentModel.builder() + .addLayers(EquipmentModel.LayerType.WOLF_BODY, EquipmentModel.Layer.onlyIfDyed(ResourceLocation.withDefaultNamespace("armadillo_scute"), false)) + .addLayers(EquipmentModel.LayerType.WOLF_BODY, EquipmentModel.Layer.onlyIfDyed(ResourceLocation.withDefaultNamespace("armadillo_scute_overlay"), true)) + .build() + ); + biConsumer.accept( + ELYTRA, + EquipmentModel.builder() + .addLayers(EquipmentModel.LayerType.WINGS, new EquipmentModel.Layer(ResourceLocation.withDefaultNamespace("elytra"), Optional.empty(), true)) + .build() + ); + + for (Entry entry : CARPETS.entrySet()) { + DyeColor dyeColor = (DyeColor)entry.getKey(); + ResourceLocation resourceLocation = (ResourceLocation)entry.getValue(); + biConsumer.accept( + resourceLocation, + EquipmentModel.builder() + .addLayers(EquipmentModel.LayerType.LLAMA_BODY, new EquipmentModel.Layer(ResourceLocation.withDefaultNamespace(dyeColor.getSerializedName()))) + .build() + ); + } + + biConsumer.accept( + TRADER_LLAMA, + EquipmentModel.builder() + .addLayers(EquipmentModel.LayerType.LLAMA_BODY, new EquipmentModel.Layer(ResourceLocation.withDefaultNamespace("trader_llama"))) + .build() + ); + } + + private static EquipmentModel onlyHumanoid(String string) { + return EquipmentModel.builder().addHumanoidLayers(ResourceLocation.withDefaultNamespace(string)).build(); + } + + private static EquipmentModel humanoidAndHorse(String string) { + return EquipmentModel.builder() + .addHumanoidLayers(ResourceLocation.withDefaultNamespace(string)) + .addLayers(EquipmentModel.LayerType.HORSE_BODY, EquipmentModel.Layer.leatherDyeable(ResourceLocation.withDefaultNamespace(string), false)) + .build(); + } +} diff --git a/net/minecraft/world/item/equipment/Equippable.java b/net/minecraft/world/item/equipment/Equippable.java new file mode 100644 index 00000000..059cdf64 --- /dev/null +++ b/net/minecraft/world/item/equipment/Equippable.java @@ -0,0 +1,174 @@ +package net.minecraft.world.item.equipment; + +import com.mojang.serialization.Codec; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import java.util.Optional; +import net.minecraft.core.Holder; +import net.minecraft.core.HolderSet; +import net.minecraft.core.RegistryCodecs; +import net.minecraft.core.registries.Registries; +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.sounds.SoundEvent; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.stats.Stats; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.EquipmentSlot; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.DyeColor; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.enchantment.EnchantmentEffectComponents; +import net.minecraft.world.item.enchantment.EnchantmentHelper; + +public record Equippable( + EquipmentSlot slot, + Holder equipSound, + Optional model, + Optional cameraOverlay, + Optional>> allowedEntities, + boolean dispensable, + boolean swappable, + boolean damageOnHurt +) { + public static final Codec CODEC = RecordCodecBuilder.create( + instance -> instance.group( + EquipmentSlot.CODEC.fieldOf("slot").forGetter(Equippable::slot), + SoundEvent.CODEC.optionalFieldOf("equip_sound", SoundEvents.ARMOR_EQUIP_GENERIC).forGetter(Equippable::equipSound), + ResourceLocation.CODEC.optionalFieldOf("model").forGetter(Equippable::model), + ResourceLocation.CODEC.optionalFieldOf("camera_overlay").forGetter(Equippable::cameraOverlay), + RegistryCodecs.homogeneousList(Registries.ENTITY_TYPE).optionalFieldOf("allowed_entities").forGetter(Equippable::allowedEntities), + Codec.BOOL.optionalFieldOf("dispensable", true).forGetter(Equippable::dispensable), + Codec.BOOL.optionalFieldOf("swappable", true).forGetter(Equippable::swappable), + Codec.BOOL.optionalFieldOf("damage_on_hurt", true).forGetter(Equippable::damageOnHurt) + ) + .apply(instance, Equippable::new) + ); + public static final StreamCodec STREAM_CODEC = StreamCodec.composite( + EquipmentSlot.STREAM_CODEC, + Equippable::slot, + SoundEvent.STREAM_CODEC, + Equippable::equipSound, + ResourceLocation.STREAM_CODEC.apply(ByteBufCodecs::optional), + Equippable::model, + ResourceLocation.STREAM_CODEC.apply(ByteBufCodecs::optional), + Equippable::cameraOverlay, + ByteBufCodecs.holderSet(Registries.ENTITY_TYPE).apply(ByteBufCodecs::optional), + Equippable::allowedEntities, + ByteBufCodecs.BOOL, + Equippable::dispensable, + ByteBufCodecs.BOOL, + Equippable::swappable, + ByteBufCodecs.BOOL, + Equippable::damageOnHurt, + Equippable::new + ); + + public static Equippable llamaSwag(DyeColor dyeColor) { + return builder(EquipmentSlot.BODY) + .setEquipSound(SoundEvents.LLAMA_SWAG) + .setModel((ResourceLocation)EquipmentModels.CARPETS.get(dyeColor)) + .setAllowedEntities(EntityType.LLAMA, EntityType.TRADER_LLAMA) + .build(); + } + + public static Equippable.Builder builder(EquipmentSlot equipmentSlot) { + return new Equippable.Builder(equipmentSlot); + } + + public InteractionResult swapWithEquipmentSlot(ItemStack itemStack, Player player) { + if (!player.canUseSlot(this.slot)) { + return InteractionResult.PASS; + } else { + ItemStack itemStack2 = player.getItemBySlot(this.slot); + if ((!EnchantmentHelper.has(itemStack2, EnchantmentEffectComponents.PREVENT_ARMOR_CHANGE) || player.isCreative()) + && !ItemStack.isSameItemSameComponents(itemStack, itemStack2)) { + if (!player.level().isClientSide()) { + player.awardStat(Stats.ITEM_USED.get(itemStack.getItem())); + } + + if (itemStack.getCount() <= 1) { + ItemStack itemStack3 = itemStack2.isEmpty() ? itemStack : itemStack2.copyAndClear(); + ItemStack itemStack4 = player.isCreative() ? itemStack.copy() : itemStack.copyAndClear(); + player.setItemSlot(this.slot, itemStack4); + return InteractionResult.SUCCESS.heldItemTransformedTo(itemStack3); + } else { + ItemStack itemStack3 = itemStack2.copyAndClear(); + ItemStack itemStack4 = itemStack.consumeAndReturn(1, player); + player.setItemSlot(this.slot, itemStack4); + if (!player.getInventory().add(itemStack3)) { + player.drop(itemStack3, false); + } + + return InteractionResult.SUCCESS.heldItemTransformedTo(itemStack); + } + } else { + return InteractionResult.FAIL; + } + } + } + + public boolean canBeEquippedBy(EntityType entityType) { + return this.allowedEntities.isEmpty() || ((HolderSet)this.allowedEntities.get()).contains(entityType.builtInRegistryHolder()); + } + + public static class Builder { + private final EquipmentSlot slot; + private Holder equipSound = SoundEvents.ARMOR_EQUIP_GENERIC; + private Optional model = Optional.empty(); + private Optional cameraOverlay = Optional.empty(); + private Optional>> allowedEntities = Optional.empty(); + private boolean dispensable = true; + private boolean swappable = true; + private boolean damageOnHurt = true; + + Builder(EquipmentSlot equipmentSlot) { + this.slot = equipmentSlot; + } + + public Equippable.Builder setEquipSound(Holder holder) { + this.equipSound = holder; + return this; + } + + public Equippable.Builder setModel(ResourceLocation resourceLocation) { + this.model = Optional.of(resourceLocation); + return this; + } + + public Equippable.Builder setCameraOverlay(ResourceLocation resourceLocation) { + this.cameraOverlay = Optional.of(resourceLocation); + return this; + } + + public Equippable.Builder setAllowedEntities(EntityType... entityTypes) { + return this.setAllowedEntities(HolderSet.direct(EntityType::builtInRegistryHolder, entityTypes)); + } + + public Equippable.Builder setAllowedEntities(HolderSet> holderSet) { + this.allowedEntities = Optional.of(holderSet); + return this; + } + + public Equippable.Builder setDispensable(boolean bl) { + this.dispensable = bl; + return this; + } + + public Equippable.Builder setSwappable(boolean bl) { + this.swappable = bl; + return this; + } + + public Equippable.Builder setDamageOnHurt(boolean bl) { + this.damageOnHurt = bl; + return this; + } + + public Equippable build() { + return new Equippable(this.slot, this.equipSound, this.model, this.cameraOverlay, this.allowedEntities, this.dispensable, this.swappable, this.damageOnHurt); + } + } +} diff --git a/net/minecraft/world/item/equipment/package-info.java b/net/minecraft/world/item/equipment/package-info.java new file mode 100644 index 00000000..30ce6b47 --- /dev/null +++ b/net/minecraft/world/item/equipment/package-info.java @@ -0,0 +1,8 @@ +@ParametersAreNonnullByDefault +@MethodsReturnNonnullByDefault +@FieldsAreNonnullByDefault +package net.minecraft.world.item.equipment; + +import javax.annotation.ParametersAreNonnullByDefault; +import net.minecraft.FieldsAreNonnullByDefault; +import net.minecraft.MethodsReturnNonnullByDefault; diff --git a/net/minecraft/world/item/equipment/trim/ArmorTrim.java b/net/minecraft/world/item/equipment/trim/ArmorTrim.java new file mode 100644 index 00000000..f6a0094a --- /dev/null +++ b/net/minecraft/world/item/equipment/trim/ArmorTrim.java @@ -0,0 +1,75 @@ +package net.minecraft.world.item.equipment.trim; + +import com.mojang.serialization.Codec; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import java.util.function.Consumer; +import java.util.function.UnaryOperator; +import net.minecraft.ChatFormatting; +import net.minecraft.Util; +import net.minecraft.core.Holder; +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.chat.CommonComponents; +import net.minecraft.network.chat.Component; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.TooltipFlag; +import net.minecraft.world.item.component.TooltipProvider; +import net.minecraft.world.item.equipment.EquipmentModel; + +public record ArmorTrim(Holder material, Holder pattern, boolean showInTooltip) implements TooltipProvider { + public static final Codec CODEC = RecordCodecBuilder.create( + instance -> instance.group( + TrimMaterial.CODEC.fieldOf("material").forGetter(ArmorTrim::material), + TrimPattern.CODEC.fieldOf("pattern").forGetter(ArmorTrim::pattern), + Codec.BOOL.optionalFieldOf("show_in_tooltip", true).forGetter(armorTrim -> armorTrim.showInTooltip) + ) + .apply(instance, ArmorTrim::new) + ); + public static final StreamCodec STREAM_CODEC = StreamCodec.composite( + TrimMaterial.STREAM_CODEC, + ArmorTrim::material, + TrimPattern.STREAM_CODEC, + ArmorTrim::pattern, + ByteBufCodecs.BOOL, + armorTrim -> armorTrim.showInTooltip, + ArmorTrim::new + ); + private static final Component UPGRADE_TITLE = Component.translatable( + Util.makeDescriptionId("item", ResourceLocation.withDefaultNamespace("smithing_template.upgrade")) + ) + .withStyle(ChatFormatting.GRAY); + + public ArmorTrim(Holder holder, Holder holder2) { + this(holder, holder2, true); + } + + private static String getColorPaletteSuffix(Holder holder, ResourceLocation resourceLocation) { + String string = (String)holder.value().overrideArmorMaterials().get(resourceLocation); + return string != null ? string : holder.value().assetName(); + } + + public boolean hasPatternAndMaterial(Holder holder, Holder holder2) { + return holder.equals(this.pattern) && holder2.equals(this.material); + } + + public ResourceLocation getTexture(EquipmentModel.LayerType layerType, ResourceLocation resourceLocation) { + ResourceLocation resourceLocation2 = this.pattern.value().assetId(); + String string = getColorPaletteSuffix(this.material, resourceLocation); + return resourceLocation2.withPath((UnaryOperator)(string2 -> "trims/entity/" + layerType.getSerializedName() + "/" + string2 + "_" + string)); + } + + @Override + public void addToTooltip(Item.TooltipContext context, Consumer tooltipAdder, TooltipFlag tooltipFlag) { + if (this.showInTooltip) { + tooltipAdder.accept(UPGRADE_TITLE); + tooltipAdder.accept(CommonComponents.space().append(this.pattern.value().copyWithStyle(this.material))); + tooltipAdder.accept(CommonComponents.space().append(this.material.value().description())); + } + } + + public ArmorTrim withTooltip(boolean bl) { + return new ArmorTrim(this.material, this.pattern, bl); + } +} diff --git a/net/minecraft/world/item/armortrim/TrimMaterial.java b/net/minecraft/world/item/equipment/trim/TrimMaterial.java similarity index 67% rename from net/minecraft/world/item/armortrim/TrimMaterial.java rename to net/minecraft/world/item/equipment/trim/TrimMaterial.java index 1c9b330a..0ae5b35d 100644 --- a/net/minecraft/world/item/armortrim/TrimMaterial.java +++ b/net/minecraft/world/item/equipment/trim/TrimMaterial.java @@ -1,4 +1,4 @@ -package net.minecraft.world.item.armortrim; +package net.minecraft.world.item.equipment.trim; import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; @@ -13,20 +13,21 @@ import net.minecraft.network.chat.ComponentSerialization; import net.minecraft.network.codec.ByteBufCodecs; import net.minecraft.network.codec.StreamCodec; import net.minecraft.resources.RegistryFileCodec; -import net.minecraft.resources.RegistryFixedCodec; +import net.minecraft.resources.ResourceLocation; import net.minecraft.util.ExtraCodecs; -import net.minecraft.world.item.ArmorMaterial; import net.minecraft.world.item.Item; public record TrimMaterial( - String assetName, Holder ingredient, float itemModelIndex, Map, String> overrideArmorMaterials, Component description + String assetName, Holder ingredient, float itemModelIndex, Map overrideArmorMaterials, Component description ) { public static final Codec DIRECT_CODEC = RecordCodecBuilder.create( instance -> instance.group( ExtraCodecs.RESOURCE_PATH_CODEC.fieldOf("asset_name").forGetter(TrimMaterial::assetName), - RegistryFixedCodec.create(Registries.ITEM).fieldOf("ingredient").forGetter(TrimMaterial::ingredient), + Item.CODEC.fieldOf("ingredient").forGetter(TrimMaterial::ingredient), Codec.FLOAT.fieldOf("item_model_index").forGetter(TrimMaterial::itemModelIndex), - Codec.unboundedMap(ArmorMaterial.CODEC, Codec.STRING).optionalFieldOf("override_armor_materials", Map.of()).forGetter(TrimMaterial::overrideArmorMaterials), + Codec.unboundedMap(ResourceLocation.CODEC, Codec.STRING) + .optionalFieldOf("override_armor_materials", Map.of()) + .forGetter(TrimMaterial::overrideArmorMaterials), ComponentSerialization.CODEC.fieldOf("description").forGetter(TrimMaterial::description) ) .apply(instance, TrimMaterial::new) @@ -38,7 +39,7 @@ public record TrimMaterial( TrimMaterial::ingredient, ByteBufCodecs.FLOAT, TrimMaterial::itemModelIndex, - ByteBufCodecs.map(Object2ObjectOpenHashMap::new, ByteBufCodecs.holderRegistry(Registries.ARMOR_MATERIAL), ByteBufCodecs.STRING_UTF8), + ByteBufCodecs.map(Object2ObjectOpenHashMap::new, ResourceLocation.STREAM_CODEC, ByteBufCodecs.STRING_UTF8), TrimMaterial::overrideArmorMaterials, ComponentSerialization.STREAM_CODEC, TrimMaterial::description, @@ -49,9 +50,7 @@ public record TrimMaterial( Registries.TRIM_MATERIAL, DIRECT_STREAM_CODEC ); - public static TrimMaterial create( - String assetName, Item ingredient, float itemModelIndex, Component description, Map, String> overrideArmorMaterials - ) { - return new TrimMaterial(assetName, BuiltInRegistries.ITEM.wrapAsHolder(ingredient), itemModelIndex, overrideArmorMaterials, description); + public static TrimMaterial create(String string, Item item, float f, Component component, Map map) { + return new TrimMaterial(string, BuiltInRegistries.ITEM.wrapAsHolder(item), f, map, component); } } diff --git a/net/minecraft/world/item/equipment/trim/TrimMaterials.java b/net/minecraft/world/item/equipment/trim/TrimMaterials.java new file mode 100644 index 00000000..fde38fda --- /dev/null +++ b/net/minecraft/world/item/equipment/trim/TrimMaterials.java @@ -0,0 +1,67 @@ +package net.minecraft.world.item.equipment.trim; + +import java.util.Map; +import java.util.Optional; +import net.minecraft.Util; +import net.minecraft.core.Holder; +import net.minecraft.core.HolderLookup; +import net.minecraft.core.registries.Registries; +import net.minecraft.data.worldgen.BootstrapContext; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.Style; +import net.minecraft.resources.ResourceKey; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.world.item.equipment.EquipmentModels; + +public class TrimMaterials { + public static final ResourceKey QUARTZ = registryKey("quartz"); + public static final ResourceKey IRON = registryKey("iron"); + public static final ResourceKey NETHERITE = registryKey("netherite"); + public static final ResourceKey REDSTONE = registryKey("redstone"); + public static final ResourceKey COPPER = registryKey("copper"); + public static final ResourceKey GOLD = registryKey("gold"); + public static final ResourceKey EMERALD = registryKey("emerald"); + public static final ResourceKey DIAMOND = registryKey("diamond"); + public static final ResourceKey LAPIS = registryKey("lapis"); + public static final ResourceKey AMETHYST = registryKey("amethyst"); + + public static void bootstrap(BootstrapContext bootstrapContext) { + register(bootstrapContext, QUARTZ, Items.QUARTZ, Style.EMPTY.withColor(14931140), 0.1F); + register(bootstrapContext, IRON, Items.IRON_INGOT, Style.EMPTY.withColor(15527148), 0.2F, Map.of(EquipmentModels.IRON, "iron_darker")); + register(bootstrapContext, NETHERITE, Items.NETHERITE_INGOT, Style.EMPTY.withColor(6445145), 0.3F, Map.of(EquipmentModels.NETHERITE, "netherite_darker")); + register(bootstrapContext, REDSTONE, Items.REDSTONE, Style.EMPTY.withColor(9901575), 0.4F); + register(bootstrapContext, COPPER, Items.COPPER_INGOT, Style.EMPTY.withColor(11823181), 0.5F); + register(bootstrapContext, GOLD, Items.GOLD_INGOT, Style.EMPTY.withColor(14594349), 0.6F, Map.of(EquipmentModels.GOLD, "gold_darker")); + register(bootstrapContext, EMERALD, Items.EMERALD, Style.EMPTY.withColor(1155126), 0.7F); + register(bootstrapContext, DIAMOND, Items.DIAMOND, Style.EMPTY.withColor(7269586), 0.8F, Map.of(EquipmentModels.DIAMOND, "diamond_darker")); + register(bootstrapContext, LAPIS, Items.LAPIS_LAZULI, Style.EMPTY.withColor(4288151), 0.9F); + register(bootstrapContext, AMETHYST, Items.AMETHYST_SHARD, Style.EMPTY.withColor(10116294), 1.0F); + } + + public static Optional> getFromIngredient(HolderLookup.Provider provider, ItemStack itemStack) { + return provider.lookupOrThrow(Registries.TRIM_MATERIAL) + .listElements() + .filter(reference -> itemStack.is(((TrimMaterial)reference.value()).ingredient())) + .findFirst(); + } + + private static void register(BootstrapContext bootstrapContext, ResourceKey resourceKey, Item item, Style style, float f) { + register(bootstrapContext, resourceKey, item, style, f, Map.of()); + } + + private static void register( + BootstrapContext bootstrapContext, ResourceKey resourceKey, Item item, Style style, float f, Map map + ) { + TrimMaterial trimMaterial = TrimMaterial.create( + resourceKey.location().getPath(), item, f, Component.translatable(Util.makeDescriptionId("trim_material", resourceKey.location())).withStyle(style), map + ); + bootstrapContext.register(resourceKey, trimMaterial); + } + + private static ResourceKey registryKey(String string) { + return ResourceKey.create(Registries.TRIM_MATERIAL, ResourceLocation.withDefaultNamespace(string)); + } +} diff --git a/net/minecraft/world/item/armortrim/TrimPattern.java b/net/minecraft/world/item/equipment/trim/TrimPattern.java similarity index 82% rename from net/minecraft/world/item/armortrim/TrimPattern.java rename to net/minecraft/world/item/equipment/trim/TrimPattern.java index 8a464f9f..ccb30930 100644 --- a/net/minecraft/world/item/armortrim/TrimPattern.java +++ b/net/minecraft/world/item/equipment/trim/TrimPattern.java @@ -1,4 +1,4 @@ -package net.minecraft.world.item.armortrim; +package net.minecraft.world.item.equipment.trim; import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; @@ -10,7 +10,6 @@ import net.minecraft.network.chat.ComponentSerialization; import net.minecraft.network.codec.ByteBufCodecs; import net.minecraft.network.codec.StreamCodec; import net.minecraft.resources.RegistryFileCodec; -import net.minecraft.resources.RegistryFixedCodec; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.Item; @@ -18,7 +17,7 @@ public record TrimPattern(ResourceLocation assetId, Holder templateItem, C public static final Codec DIRECT_CODEC = RecordCodecBuilder.create( instance -> instance.group( ResourceLocation.CODEC.fieldOf("asset_id").forGetter(TrimPattern::assetId), - RegistryFixedCodec.create(Registries.ITEM).fieldOf("template_item").forGetter(TrimPattern::templateItem), + Item.CODEC.fieldOf("template_item").forGetter(TrimPattern::templateItem), ComponentSerialization.CODEC.fieldOf("description").forGetter(TrimPattern::description), Codec.BOOL.fieldOf("decal").orElse(false).forGetter(TrimPattern::decal) ) @@ -38,7 +37,7 @@ public record TrimPattern(ResourceLocation assetId, Holder templateItem, C public static final Codec> CODEC = RegistryFileCodec.create(Registries.TRIM_PATTERN, DIRECT_CODEC); public static final StreamCodec> STREAM_CODEC = ByteBufCodecs.holder(Registries.TRIM_PATTERN, DIRECT_STREAM_CODEC); - public Component copyWithStyle(Holder trimMaterial) { - return this.description.copy().withStyle(trimMaterial.value().description().getStyle()); + public Component copyWithStyle(Holder holder) { + return this.description.copy().withStyle(holder.value().description().getStyle()); } } diff --git a/net/minecraft/world/item/armortrim/TrimPatterns.java b/net/minecraft/world/item/equipment/trim/TrimPatterns.java similarity index 51% rename from net/minecraft/world/item/armortrim/TrimPatterns.java rename to net/minecraft/world/item/equipment/trim/TrimPatterns.java index 7890d03e..8ed2b3ff 100644 --- a/net/minecraft/world/item/armortrim/TrimPatterns.java +++ b/net/minecraft/world/item/equipment/trim/TrimPatterns.java @@ -1,4 +1,4 @@ -package net.minecraft.world.item.armortrim; +package net.minecraft.world.item.equipment.trim; import java.util.Optional; import net.minecraft.Util; @@ -34,45 +34,45 @@ public class TrimPatterns { public static final ResourceKey FLOW = registryKey("flow"); public static final ResourceKey BOLT = registryKey("bolt"); - public static void bootstrap(BootstrapContext context) { - register(context, Items.SENTRY_ARMOR_TRIM_SMITHING_TEMPLATE, SENTRY); - register(context, Items.DUNE_ARMOR_TRIM_SMITHING_TEMPLATE, DUNE); - register(context, Items.COAST_ARMOR_TRIM_SMITHING_TEMPLATE, COAST); - register(context, Items.WILD_ARMOR_TRIM_SMITHING_TEMPLATE, WILD); - register(context, Items.WARD_ARMOR_TRIM_SMITHING_TEMPLATE, WARD); - register(context, Items.EYE_ARMOR_TRIM_SMITHING_TEMPLATE, EYE); - register(context, Items.VEX_ARMOR_TRIM_SMITHING_TEMPLATE, VEX); - register(context, Items.TIDE_ARMOR_TRIM_SMITHING_TEMPLATE, TIDE); - register(context, Items.SNOUT_ARMOR_TRIM_SMITHING_TEMPLATE, SNOUT); - register(context, Items.RIB_ARMOR_TRIM_SMITHING_TEMPLATE, RIB); - register(context, Items.SPIRE_ARMOR_TRIM_SMITHING_TEMPLATE, SPIRE); - register(context, Items.WAYFINDER_ARMOR_TRIM_SMITHING_TEMPLATE, WAYFINDER); - register(context, Items.SHAPER_ARMOR_TRIM_SMITHING_TEMPLATE, SHAPER); - register(context, Items.SILENCE_ARMOR_TRIM_SMITHING_TEMPLATE, SILENCE); - register(context, Items.RAISER_ARMOR_TRIM_SMITHING_TEMPLATE, RAISER); - register(context, Items.HOST_ARMOR_TRIM_SMITHING_TEMPLATE, HOST); - register(context, Items.FLOW_ARMOR_TRIM_SMITHING_TEMPLATE, FLOW); - register(context, Items.BOLT_ARMOR_TRIM_SMITHING_TEMPLATE, BOLT); + public static void bootstrap(BootstrapContext bootstrapContext) { + register(bootstrapContext, Items.SENTRY_ARMOR_TRIM_SMITHING_TEMPLATE, SENTRY); + register(bootstrapContext, Items.DUNE_ARMOR_TRIM_SMITHING_TEMPLATE, DUNE); + register(bootstrapContext, Items.COAST_ARMOR_TRIM_SMITHING_TEMPLATE, COAST); + register(bootstrapContext, Items.WILD_ARMOR_TRIM_SMITHING_TEMPLATE, WILD); + register(bootstrapContext, Items.WARD_ARMOR_TRIM_SMITHING_TEMPLATE, WARD); + register(bootstrapContext, Items.EYE_ARMOR_TRIM_SMITHING_TEMPLATE, EYE); + register(bootstrapContext, Items.VEX_ARMOR_TRIM_SMITHING_TEMPLATE, VEX); + register(bootstrapContext, Items.TIDE_ARMOR_TRIM_SMITHING_TEMPLATE, TIDE); + register(bootstrapContext, Items.SNOUT_ARMOR_TRIM_SMITHING_TEMPLATE, SNOUT); + register(bootstrapContext, Items.RIB_ARMOR_TRIM_SMITHING_TEMPLATE, RIB); + register(bootstrapContext, Items.SPIRE_ARMOR_TRIM_SMITHING_TEMPLATE, SPIRE); + register(bootstrapContext, Items.WAYFINDER_ARMOR_TRIM_SMITHING_TEMPLATE, WAYFINDER); + register(bootstrapContext, Items.SHAPER_ARMOR_TRIM_SMITHING_TEMPLATE, SHAPER); + register(bootstrapContext, Items.SILENCE_ARMOR_TRIM_SMITHING_TEMPLATE, SILENCE); + register(bootstrapContext, Items.RAISER_ARMOR_TRIM_SMITHING_TEMPLATE, RAISER); + register(bootstrapContext, Items.HOST_ARMOR_TRIM_SMITHING_TEMPLATE, HOST); + register(bootstrapContext, Items.FLOW_ARMOR_TRIM_SMITHING_TEMPLATE, FLOW); + register(bootstrapContext, Items.BOLT_ARMOR_TRIM_SMITHING_TEMPLATE, BOLT); } - public static Optional> getFromTemplate(HolderLookup.Provider registries, ItemStack template) { - return registries.lookupOrThrow(Registries.TRIM_PATTERN) + public static Optional> getFromTemplate(HolderLookup.Provider provider, ItemStack itemStack) { + return provider.lookupOrThrow(Registries.TRIM_PATTERN) .listElements() - .filter(reference -> template.is(((TrimPattern)reference.value()).templateItem())) + .filter(reference -> itemStack.is(((TrimPattern)reference.value()).templateItem())) .findFirst(); } - public static void register(BootstrapContext context, Item templateItem, ResourceKey trimPatternKey) { + public static void register(BootstrapContext bootstrapContext, Item item, ResourceKey resourceKey) { TrimPattern trimPattern = new TrimPattern( - trimPatternKey.location(), - BuiltInRegistries.ITEM.wrapAsHolder(templateItem), - Component.translatable(Util.makeDescriptionId("trim_pattern", trimPatternKey.location())), + resourceKey.location(), + BuiltInRegistries.ITEM.wrapAsHolder(item), + Component.translatable(Util.makeDescriptionId("trim_pattern", resourceKey.location())), false ); - context.register(trimPatternKey, trimPattern); + bootstrapContext.register(resourceKey, trimPattern); } - private static ResourceKey registryKey(String key) { - return ResourceKey.create(Registries.TRIM_PATTERN, ResourceLocation.withDefaultNamespace(key)); + private static ResourceKey registryKey(String string) { + return ResourceKey.create(Registries.TRIM_PATTERN, ResourceLocation.withDefaultNamespace(string)); } } diff --git a/net/minecraft/world/item/equipment/trim/package-info.java b/net/minecraft/world/item/equipment/trim/package-info.java new file mode 100644 index 00000000..0a695cc7 --- /dev/null +++ b/net/minecraft/world/item/equipment/trim/package-info.java @@ -0,0 +1,8 @@ +@ParametersAreNonnullByDefault +@MethodsReturnNonnullByDefault +@FieldsAreNonnullByDefault +package net.minecraft.world.item.equipment.trim; + +import javax.annotation.ParametersAreNonnullByDefault; +import net.minecraft.FieldsAreNonnullByDefault; +import net.minecraft.MethodsReturnNonnullByDefault; diff --git a/net/minecraft/world/item/trading/ItemCost.java b/net/minecraft/world/item/trading/ItemCost.java index cdd1e239..828508e7 100644 --- a/net/minecraft/world/item/trading/ItemCost.java +++ b/net/minecraft/world/item/trading/ItemCost.java @@ -19,7 +19,7 @@ import net.minecraft.world.level.ItemLike; public record ItemCost(Holder item, int count, DataComponentPredicate components, ItemStack itemStack) { public static final Codec CODEC = RecordCodecBuilder.create( instance -> instance.group( - ItemStack.ITEM_NON_AIR_CODEC.fieldOf("id").forGetter(ItemCost::item), + Item.CODEC.fieldOf("id").forGetter(ItemCost::item), ExtraCodecs.POSITIVE_INT.fieldOf("count").orElse(1).forGetter(ItemCost::count), DataComponentPredicate.CODEC.optionalFieldOf("components", DataComponentPredicate.EMPTY).forGetter(ItemCost::components) ) diff --git a/net/minecraft/world/level/BaseCommandBlock.java b/net/minecraft/world/level/BaseCommandBlock.java index 13140269..c38c383d 100644 --- a/net/minecraft/world/level/BaseCommandBlock.java +++ b/net/minecraft/world/level/BaseCommandBlock.java @@ -216,7 +216,7 @@ public abstract class BaseCommandBlock implements CommandSource { player.openMinecartCommandBlock(this); } - return InteractionResult.sidedSuccess(player.level().isClientSide); + return InteractionResult.SUCCESS; } } diff --git a/net/minecraft/world/level/BaseSpawner.java b/net/minecraft/world/level/BaseSpawner.java index 62127a6b..008efb50 100644 --- a/net/minecraft/world/level/BaseSpawner.java +++ b/net/minecraft/world/level/BaseSpawner.java @@ -12,14 +12,15 @@ import net.minecraft.nbt.NbtOps; import net.minecraft.server.level.ServerLevel; import net.minecraft.util.RandomSource; import net.minecraft.util.random.SimpleWeightedRandomList; -import net.minecraft.util.random.WeightedEntry; +import net.minecraft.util.random.WeightedEntry.Wrapper; import net.minecraft.world.Difficulty; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntitySelector; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.Mob; -import net.minecraft.world.entity.MobSpawnType; import net.minecraft.world.entity.SpawnPlacements; +import net.minecraft.world.level.SpawnData.CustomSpawnRules; import net.minecraft.world.level.entity.EntityTypeTest; import net.minecraft.world.level.gameevent.GameEvent; import net.minecraft.world.phys.AABB; @@ -108,15 +109,15 @@ public abstract class BaseSpawner { continue; } - SpawnData.CustomSpawnRules customSpawnRules = (SpawnData.CustomSpawnRules)spawnData.getCustomSpawnRules().get(); + CustomSpawnRules customSpawnRules = (CustomSpawnRules)spawnData.getCustomSpawnRules().get(); if (!customSpawnRules.isValidPosition(blockPos, serverLevel)) { continue; } - } else if (!SpawnPlacements.checkSpawnRules((EntityType)optional.get(), serverLevel, MobSpawnType.SPAWNER, blockPos, serverLevel.getRandom())) { + } else if (!SpawnPlacements.checkSpawnRules((EntityType)optional.get(), serverLevel, EntitySpawnReason.SPAWNER, blockPos, serverLevel.getRandom())) { continue; } - Entity entity = EntityType.loadEntityRecursive(compoundTag, serverLevel, entityx -> { + Entity entity = EntityType.loadEntityRecursive(compoundTag, serverLevel, EntitySpawnReason.SPAWNER, entityx -> { entityx.moveTo(d, e, f, entityx.getYRot(), entityx.getXRot()); return entityx; }); @@ -138,13 +139,15 @@ public abstract class BaseSpawner { entity.moveTo(entity.getX(), entity.getY(), entity.getZ(), randomSource.nextFloat() * 360.0F, 0.0F); if (entity instanceof Mob mob) { - if (spawnData.getCustomSpawnRules().isEmpty() && !mob.checkSpawnRules(serverLevel, MobSpawnType.SPAWNER) || !mob.checkSpawnObstruction(serverLevel)) { + if (spawnData.getCustomSpawnRules().isEmpty() && !mob.checkSpawnRules(serverLevel, EntitySpawnReason.SPAWNER) || !mob.checkSpawnObstruction(serverLevel) + ) + { continue; } boolean bl2 = spawnData.getEntityToSpawn().size() == 1 && spawnData.getEntityToSpawn().contains("id", 8); if (bl2) { - ((Mob)entity).finalizeSpawn(serverLevel, serverLevel.getCurrentDifficultyAt(entity.blockPosition()), MobSpawnType.SPAWNER, null); + ((Mob)entity).finalizeSpawn(serverLevel, serverLevel.getCurrentDifficultyAt(entity.blockPosition()), EntitySpawnReason.SPAWNER, null); } spawnData.getEquipment().ifPresent(mob::equip); @@ -251,7 +254,7 @@ public abstract class BaseSpawner { return null; } - this.displayEntity = EntityType.loadEntityRecursive(compoundTag, level, Function.identity()); + this.displayEntity = EntityType.loadEntityRecursive(compoundTag, level, EntitySpawnReason.SPAWNER, Function.identity()); if (compoundTag.size() == 1 && this.displayEntity instanceof Mob) { } } @@ -279,7 +282,7 @@ public abstract class BaseSpawner { if (this.nextSpawnData != null) { return this.nextSpawnData; } else { - this.setNextSpawnData(level, pos, (SpawnData)this.spawnPotentials.getRandom(random).map(WeightedEntry.Wrapper::data).orElseGet(SpawnData::new)); + this.setNextSpawnData(level, pos, (SpawnData)this.spawnPotentials.getRandom(random).map(Wrapper::data).orElseGet(SpawnData::new)); return this.nextSpawnData; } } diff --git a/net/minecraft/world/level/BlockAndTintGetter.java b/net/minecraft/world/level/BlockAndTintGetter.java index 8540cd88..3b08f5fe 100644 --- a/net/minecraft/world/level/BlockAndTintGetter.java +++ b/net/minecraft/world/level/BlockAndTintGetter.java @@ -20,6 +20,6 @@ public interface BlockAndTintGetter extends BlockGetter { } default boolean canSeeSky(BlockPos blockPos) { - return this.getBrightness(LightLayer.SKY, blockPos) >= this.getMaxLightLevel(); + return this.getBrightness(LightLayer.SKY, blockPos) >= 15; } } diff --git a/net/minecraft/world/level/BlockCollisions.java b/net/minecraft/world/level/BlockCollisions.java index 56cbaf95..75803fc9 100644 --- a/net/minecraft/world/level/BlockCollisions.java +++ b/net/minecraft/world/level/BlockCollisions.java @@ -36,19 +36,25 @@ public class BlockCollisions extends AbstractIterator { boolean onlySuffocatingBlocks, BiFunction resultProvider ) { - this.context = entity == null ? CollisionContext.empty() : CollisionContext.of(entity); + this(collisionGetter, entity == null ? CollisionContext.empty() : CollisionContext.of(entity), box, onlySuffocatingBlocks, resultProvider); + } + + public BlockCollisions( + CollisionGetter collisionGetter, CollisionContext collisionContext, AABB aABB, boolean bl, BiFunction biFunction + ) { + this.context = collisionContext; this.pos = new BlockPos.MutableBlockPos(); - this.entityShape = Shapes.create(box); + this.entityShape = Shapes.create(aABB); this.collisionGetter = collisionGetter; - this.box = box; - this.onlySuffocatingBlocks = onlySuffocatingBlocks; - this.resultProvider = resultProvider; - int i = Mth.floor(box.minX - 1.0E-7) - 1; - int j = Mth.floor(box.maxX + 1.0E-7) + 1; - int k = Mth.floor(box.minY - 1.0E-7) - 1; - int l = Mth.floor(box.maxY + 1.0E-7) + 1; - int m = Mth.floor(box.minZ - 1.0E-7) - 1; - int n = Mth.floor(box.maxZ + 1.0E-7) + 1; + this.box = aABB; + this.onlySuffocatingBlocks = bl; + this.resultProvider = biFunction; + int i = Mth.floor(aABB.minX - 1.0E-7) - 1; + int j = Mth.floor(aABB.maxX + 1.0E-7) + 1; + int k = Mth.floor(aABB.minY - 1.0E-7) - 1; + int l = Mth.floor(aABB.maxY + 1.0E-7) + 1; + int m = Mth.floor(aABB.minZ - 1.0E-7) - 1; + int n = Mth.floor(aABB.maxZ + 1.0E-7) + 1; this.cursor = new Cursor3D(i, k, m, j, l, n); } @@ -82,7 +88,7 @@ public class BlockCollisions extends AbstractIterator { if ((!this.onlySuffocatingBlocks || blockState.isSuffocating(blockGetter, this.pos)) && (l != 1 || blockState.hasLargeCollisionShape()) && (l != 2 || blockState.is(Blocks.MOVING_PISTON))) { - VoxelShape voxelShape = blockState.getCollisionShape(this.collisionGetter, this.pos, this.context); + VoxelShape voxelShape = this.context.getCollisionShape(blockState, this.collisionGetter, this.pos); if (voxelShape == Shapes.block()) { if (this.box.intersects(i, j, k, i + 1.0, j + 1.0, k + 1.0)) { return (T)this.resultProvider.apply(this.pos, voxelShape.move(i, j, k)); diff --git a/net/minecraft/world/level/BlockGetter.java b/net/minecraft/world/level/BlockGetter.java index 5a4e0cca..c7d45880 100644 --- a/net/minecraft/world/level/BlockGetter.java +++ b/net/minecraft/world/level/BlockGetter.java @@ -1,6 +1,8 @@ package net.minecraft.world.level; +import it.unimi.dsi.fastutil.objects.ObjectLinkedOpenHashSet; import java.util.Optional; +import java.util.Set; import java.util.function.BiFunction; import java.util.function.Function; import java.util.function.Supplier; @@ -19,6 +21,8 @@ import net.minecraft.world.phys.shapes.VoxelShape; import org.jetbrains.annotations.Nullable; public interface BlockGetter extends LevelHeightAccessor { + int MAX_BLOCK_ITERATIONS_ALONG_TRAVEL = 16; + @Nullable BlockEntity getBlockEntity(BlockPos pos); @@ -35,10 +39,6 @@ public interface BlockGetter extends LevelHeightAccessor { return this.getBlockState(pos).getLightEmission(); } - default int getMaxLightLevel() { - return 15; - } - default Stream getBlockStates(AABB area) { return BlockPos.betweenClosedStream(area).map(this::getBlockState); } @@ -53,13 +53,15 @@ public interface BlockGetter extends LevelHeightAccessor { Vec3 vec3 = clipBlockStateContext.getFrom().subtract(clipBlockStateContext.getTo()); return clipBlockStateContext.isTargetBlock().test(blockState) ? new BlockHitResult( - clipBlockStateContext.getTo(), Direction.getNearest(vec3.x, vec3.y, vec3.z), BlockPos.containing(clipBlockStateContext.getTo()), false + clipBlockStateContext.getTo(), Direction.getApproximateNearest(vec3.x, vec3.y, vec3.z), BlockPos.containing(clipBlockStateContext.getTo()), false ) : null; }, clipBlockStateContext -> { Vec3 vec3 = clipBlockStateContext.getFrom().subtract(clipBlockStateContext.getTo()); - return BlockHitResult.miss(clipBlockStateContext.getTo(), Direction.getNearest(vec3.x, vec3.y, vec3.z), BlockPos.containing(clipBlockStateContext.getTo())); + return BlockHitResult.miss( + clipBlockStateContext.getTo(), Direction.getApproximateNearest(vec3.x, vec3.y, vec3.z), BlockPos.containing(clipBlockStateContext.getTo()) + ); } ); } @@ -83,7 +85,7 @@ public interface BlockGetter extends LevelHeightAccessor { return d <= e ? blockHitResult : blockHitResult2; }, clipContext -> { Vec3 vec3 = clipContext.getFrom().subtract(clipContext.getTo()); - return BlockHitResult.miss(clipContext.getTo(), Direction.getNearest(vec3.x, vec3.y, vec3.z), BlockPos.containing(clipContext.getTo())); + return BlockHitResult.miss(clipContext.getTo(), Direction.getApproximateNearest(vec3.x, vec3.y, vec3.z), BlockPos.containing(clipContext.getTo())); }); } @@ -174,4 +176,82 @@ public interface BlockGetter extends LevelHeightAccessor { } } } + + static Iterable boxTraverseBlocks(Vec3 vec3, Vec3 vec32, AABB aABB) { + Vec3 vec33 = vec32.subtract(vec3); + Iterable iterable = BlockPos.betweenClosed(aABB); + if (vec33.lengthSqr() < Mth.square(0.99999F)) { + return iterable; + } else { + Set set = new ObjectLinkedOpenHashSet<>(); + Vec3 vec34 = vec33.normalize().scale(1.0E-7); + Vec3 vec35 = aABB.getMinPosition().add(vec34); + Vec3 vec36 = aABB.getMinPosition().subtract(vec33).subtract(vec34); + addCollisionsAlongTravel(set, vec36, vec35, aABB); + + for (BlockPos blockPos : iterable) { + set.add(blockPos.immutable()); + } + + return set; + } + } + + private static void addCollisionsAlongTravel(Set set, Vec3 vec3, Vec3 vec32, AABB aABB) { + Vec3 vec33 = vec32.subtract(vec3); + int i = Mth.floor(vec3.x); + int j = Mth.floor(vec3.y); + int k = Mth.floor(vec3.z); + int l = Mth.sign(vec33.x); + int m = Mth.sign(vec33.y); + int n = Mth.sign(vec33.z); + double d = l == 0 ? Double.MAX_VALUE : l / vec33.x; + double e = m == 0 ? Double.MAX_VALUE : m / vec33.y; + double f = n == 0 ? Double.MAX_VALUE : n / vec33.z; + double g = d * (l > 0 ? 1.0 - Mth.frac(vec3.x) : Mth.frac(vec3.x)); + double h = e * (m > 0 ? 1.0 - Mth.frac(vec3.y) : Mth.frac(vec3.y)); + double o = f * (n > 0 ? 1.0 - Mth.frac(vec3.z) : Mth.frac(vec3.z)); + int p = 0; + + while (g <= 1.0 || h <= 1.0 || o <= 1.0) { + if (g < h) { + if (g < o) { + i += l; + g += d; + } else { + k += n; + o += f; + } + } else if (h < o) { + j += m; + h += e; + } else { + k += n; + o += f; + } + + if (p++ > 16) { + break; + } + + Optional optional = AABB.clip(i, j, k, i + 1, j + 1, k + 1, vec3, vec32); + if (!optional.isEmpty()) { + Vec3 vec34 = (Vec3)optional.get(); + double q = Mth.clamp(vec34.x, i + 1.0E-5F, i + 1.0 - 1.0E-5F); + double r = Mth.clamp(vec34.y, j + 1.0E-5F, j + 1.0 - 1.0E-5F); + double s = Mth.clamp(vec34.z, k + 1.0E-5F, k + 1.0 - 1.0E-5F); + int t = Mth.floor(q + aABB.getXsize()); + int u = Mth.floor(r + aABB.getYsize()); + int v = Mth.floor(s + aABB.getZsize()); + + for (int w = i; w <= t; w++) { + for (int x = j; x <= u; x++) { + for (int y = k; y <= v; y++) { + set.add(new BlockPos(w, x, y)); + } + } + } + } + } + } } diff --git a/net/minecraft/world/level/ChunkPos.java b/net/minecraft/world/level/ChunkPos.java index 6780dc56..1d525011 100644 --- a/net/minecraft/world/level/ChunkPos.java +++ b/net/minecraft/world/level/ChunkPos.java @@ -1,19 +1,43 @@ package net.minecraft.world.level; +import com.mojang.serialization.Codec; +import io.netty.buffer.ByteBuf; import java.util.Spliterators.AbstractSpliterator; import java.util.function.Consumer; +import java.util.stream.IntStream; import java.util.stream.Stream; import java.util.stream.StreamSupport; +import net.minecraft.Util; import net.minecraft.core.BlockPos; import net.minecraft.core.SectionPos; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.world.level.chunk.status.ChunkPyramid; +import net.minecraft.world.level.chunk.status.ChunkStatus; import org.jetbrains.annotations.Nullable; public class ChunkPos { + public static final Codec CODEC = Codec.INT_STREAM + .comapFlatMap( + intStream -> Util.fixedSize(intStream, 2).map(is -> new ChunkPos(is[0], is[1])), chunkPos -> IntStream.of(new int[]{chunkPos.x, chunkPos.z}) + ) + .stable(); + public static final StreamCodec STREAM_CODEC = new StreamCodec() { + public ChunkPos decode(ByteBuf byteBuf) { + return FriendlyByteBuf.readChunkPos(byteBuf); + } + + public void encode(ByteBuf byteBuf, ChunkPos chunkPos) { + FriendlyByteBuf.writeChunkPos(byteBuf, chunkPos); + } + }; private static final int SAFETY_MARGIN = 1056; /** * Value representing an absent or invalid chunkpos */ public static final long INVALID_CHUNK_POS = asLong(1875066, 1875066); + private static final int SAFETY_MARGIN_CHUNKS = (32 + ChunkPyramid.GENERATION_PYRAMID.getStepTo(ChunkStatus.FULL).accumulatedDependencies().size() + 1) * 2; + public static final int MAX_COORDINATE_VALUE = SectionPos.blockToSectionCoord(BlockPos.MAX_HORIZONTAL_COORDINATE) - SAFETY_MARGIN_CHUNKS; public static final ChunkPos ZERO = new ChunkPos(0, 0); private static final long COORD_BITS = 32L; private static final long COORD_MASK = 4294967295L; diff --git a/net/minecraft/world/level/CollisionGetter.java b/net/minecraft/world/level/CollisionGetter.java index 474dbea3..88d26124 100644 --- a/net/minecraft/world/level/CollisionGetter.java +++ b/net/minecraft/world/level/CollisionGetter.java @@ -5,10 +5,12 @@ import java.util.List; import java.util.Optional; import java.util.stream.StreamSupport; import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; import net.minecraft.world.entity.Entity; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.border.WorldBorder; import net.minecraft.world.phys.AABB; +import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.shapes.BooleanOp; import net.minecraft.world.phys.shapes.CollisionContext; @@ -44,19 +46,23 @@ public interface CollisionGetter extends BlockGetter { } default boolean noCollision(@Nullable Entity entity, AABB collisionBox) { - for (VoxelShape voxelShape : this.getBlockCollisions(entity, collisionBox)) { + return this.noCollision(entity, collisionBox, false); + } + + default boolean noCollision(@Nullable Entity entity, AABB aABB, boolean bl) { + for (VoxelShape voxelShape : bl ? this.getBlockAndLiquidCollisions(entity, aABB) : this.getBlockCollisions(entity, aABB)) { if (!voxelShape.isEmpty()) { return false; } } - if (!this.getEntityCollisions(entity, collisionBox).isEmpty()) { + if (!this.getEntityCollisions(entity, aABB).isEmpty()) { return false; } else if (entity == null) { return true; } else { - VoxelShape voxelShape2 = this.borderCollision(entity, collisionBox); - return voxelShape2 == null || !Shapes.joinIsNotEmpty(voxelShape2, Shapes.create(collisionBox), BooleanOp.AND); + VoxelShape voxelShape2 = this.borderCollision(entity, aABB); + return voxelShape2 == null || !Shapes.joinIsNotEmpty(voxelShape2, Shapes.create(aABB), BooleanOp.AND); } } @@ -82,12 +88,29 @@ public interface CollisionGetter extends BlockGetter { return () -> new BlockCollisions(this, entity, collisionBox, false, (mutableBlockPos, voxelShape) -> voxelShape); } + default Iterable getBlockAndLiquidCollisions(@Nullable Entity entity, AABB aABB) { + return () -> new BlockCollisions(this, CollisionContext.of(entity, true), aABB, false, (mutableBlockPos, voxelShape) -> voxelShape); + } + @Nullable private VoxelShape borderCollision(Entity entity, AABB box) { WorldBorder worldBorder = this.getWorldBorder(); return worldBorder.isInsideCloseToBorder(entity, box) ? worldBorder.getCollisionShape() : null; } + default BlockHitResult clipIncludingBorder(ClipContext clipContext) { + BlockHitResult blockHitResult = this.clip(clipContext); + WorldBorder worldBorder = this.getWorldBorder(); + if (worldBorder.isWithinBounds(clipContext.getFrom()) && !worldBorder.isWithinBounds(blockHitResult.getLocation())) { + Vec3 vec3 = blockHitResult.getLocation().subtract(clipContext.getFrom()); + Direction direction = Direction.getApproximateNearest(vec3.x, vec3.y, vec3.z); + Vec3 vec32 = worldBorder.clampVec3ToBound(blockHitResult.getLocation()); + return new BlockHitResult(vec32, direction, BlockPos.containing(vec32), false, true); + } else { + return blockHitResult; + } + } + default boolean collidesWithSuffocatingBlock(@Nullable Entity entity, AABB box) { BlockCollisions blockCollisions = new BlockCollisions<>(this, entity, box, true, (mutableBlockPos, voxelShape) -> voxelShape); diff --git a/net/minecraft/world/level/CommonLevelAccessor.java b/net/minecraft/world/level/CommonLevelAccessor.java index c9a4478f..67c3f848 100644 --- a/net/minecraft/world/level/CommonLevelAccessor.java +++ b/net/minecraft/world/level/CommonLevelAccessor.java @@ -13,8 +13,8 @@ import org.jetbrains.annotations.Nullable; public interface CommonLevelAccessor extends EntityGetter, LevelReader, LevelSimulatedRW { @Override - default Optional getBlockEntity(BlockPos pos, BlockEntityType type) { - return LevelReader.super.getBlockEntity(pos, type); + default Optional getBlockEntity(BlockPos pos, BlockEntityType blockEntityType) { + return LevelReader.super.getBlockEntity(pos, blockEntityType); } @Override diff --git a/net/minecraft/world/level/EmptyBlockAndTintGetter.java b/net/minecraft/world/level/EmptyBlockAndTintGetter.java new file mode 100644 index 00000000..a9eac7c8 --- /dev/null +++ b/net/minecraft/world/level/EmptyBlockAndTintGetter.java @@ -0,0 +1,56 @@ +package net.minecraft.world.level; + +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.lighting.LevelLightEngine; +import net.minecraft.world.level.material.FluidState; +import net.minecraft.world.level.material.Fluids; +import org.jetbrains.annotations.Nullable; + +public enum EmptyBlockAndTintGetter implements BlockAndTintGetter { + INSTANCE; + + @Override + public float getShade(Direction direction, boolean shade) { + return 1.0F; + } + + @Override + public LevelLightEngine getLightEngine() { + return LevelLightEngine.EMPTY; + } + + @Override + public int getBlockTint(BlockPos blockPos, ColorResolver colorResolver) { + return -1; + } + + @Nullable + @Override + public BlockEntity getBlockEntity(BlockPos pos) { + return null; + } + + @Override + public BlockState getBlockState(BlockPos pos) { + return Blocks.AIR.defaultBlockState(); + } + + @Override + public FluidState getFluidState(BlockPos pos) { + return Fluids.EMPTY.defaultFluidState(); + } + + @Override + public int getHeight() { + return 0; + } + + @Override + public int getMinY() { + return 0; + } +} diff --git a/net/minecraft/world/level/EmptyBlockGetter.java b/net/minecraft/world/level/EmptyBlockGetter.java index d0b45311..48834bfe 100644 --- a/net/minecraft/world/level/EmptyBlockGetter.java +++ b/net/minecraft/world/level/EmptyBlockGetter.java @@ -28,7 +28,7 @@ public enum EmptyBlockGetter implements BlockGetter { } @Override - public int getMinBuildHeight() { + public int getMinY() { return 0; } diff --git a/net/minecraft/world/level/EntityGetter.java b/net/minecraft/world/level/EntityGetter.java index 3524b00f..a67b6b54 100644 --- a/net/minecraft/world/level/EntityGetter.java +++ b/net/minecraft/world/level/EntityGetter.java @@ -1,15 +1,12 @@ package net.minecraft.world.level; import com.google.common.collect.ImmutableList; -import com.google.common.collect.Lists; import com.google.common.collect.ImmutableList.Builder; import java.util.List; import java.util.UUID; import java.util.function.Predicate; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntitySelector; -import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.entity.ai.targeting.TargetingConditions; import net.minecraft.world.entity.player.Player; import net.minecraft.world.level.entity.EntityTypeTest; import net.minecraft.world.phys.AABB; @@ -122,73 +119,6 @@ public interface EntityGetter { return false; } - @Nullable - default Player getNearestPlayer(TargetingConditions predicate, LivingEntity target) { - return this.getNearestEntity(this.players(), predicate, target, target.getX(), target.getY(), target.getZ()); - } - - @Nullable - default Player getNearestPlayer(TargetingConditions predicate, LivingEntity target, double x, double y, double z) { - return this.getNearestEntity(this.players(), predicate, target, x, y, z); - } - - @Nullable - default Player getNearestPlayer(TargetingConditions predicate, double x, double y, double z) { - return this.getNearestEntity(this.players(), predicate, null, x, y, z); - } - - @Nullable - default T getNearestEntity( - Class entityClazz, TargetingConditions conditions, @Nullable LivingEntity target, double x, double y, double z, AABB boundingBox - ) { - return this.getNearestEntity(this.getEntitiesOfClass(entityClazz, boundingBox, livingEntity -> true), conditions, target, x, y, z); - } - - @Nullable - default T getNearestEntity( - List entities, TargetingConditions predicate, @Nullable LivingEntity target, double x, double y, double z - ) { - double d = -1.0; - T livingEntity = null; - - for (T livingEntity2 : entities) { - if (predicate.test(target, livingEntity2)) { - double e = livingEntity2.distanceToSqr(x, y, z); - if (d == -1.0 || e < d) { - d = e; - livingEntity = livingEntity2; - } - } - } - - return livingEntity; - } - - default List getNearbyPlayers(TargetingConditions predicate, LivingEntity target, AABB area) { - List list = Lists.newArrayList(); - - for (Player player : this.players()) { - if (area.contains(player.getX(), player.getY(), player.getZ()) && predicate.test(target, player)) { - list.add(player); - } - } - - return list; - } - - default List getNearbyEntities(Class entityClazz, TargetingConditions entityPredicate, LivingEntity entity, AABB area) { - List list = this.getEntitiesOfClass(entityClazz, area, livingEntityx -> true); - List list2 = Lists.newArrayList(); - - for (T livingEntity : list) { - if (entityPredicate.test(entity, livingEntity)) { - list2.add(livingEntity); - } - } - - return list2; - } - @Nullable default Player getPlayerByUUID(UUID uniqueId) { for (int i = 0; i < this.players().size(); i++) { diff --git a/net/minecraft/world/level/Explosion.java b/net/minecraft/world/level/Explosion.java index 099a777c..6fb957bd 100644 --- a/net/minecraft/world/level/Explosion.java +++ b/net/minecraft/world/level/Explosion.java @@ -1,454 +1,64 @@ package net.minecraft.world.level; -import com.google.common.collect.Maps; -import com.google.common.collect.Sets; -import com.mojang.datafixers.util.Pair; -import it.unimi.dsi.fastutil.objects.ObjectArrayList; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Optional; -import java.util.Set; -import net.minecraft.Util; -import net.minecraft.core.BlockPos; -import net.minecraft.core.Holder; -import net.minecraft.core.particles.ParticleOptions; -import net.minecraft.core.particles.ParticleTypes; -import net.minecraft.sounds.SoundEvent; -import net.minecraft.sounds.SoundEvents; -import net.minecraft.sounds.SoundSource; -import net.minecraft.util.Mth; -import net.minecraft.util.RandomSource; +import net.minecraft.server.level.ServerLevel; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.Entity; -import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.entity.ai.attributes.Attributes; -import net.minecraft.world.entity.item.ItemEntity; import net.minecraft.world.entity.item.PrimedTnt; -import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.projectile.Projectile; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.level.block.BaseFireBlock; -import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.world.level.gameevent.GameEvent; -import net.minecraft.world.level.material.FluidState; -import net.minecraft.world.phys.AABB; -import net.minecraft.world.phys.HitResult; import net.minecraft.world.phys.Vec3; import org.jetbrains.annotations.Nullable; -public class Explosion { - private static final ExplosionDamageCalculator EXPLOSION_DAMAGE_CALCULATOR = new ExplosionDamageCalculator(); - private static final int MAX_DROPS_PER_COMBINED_STACK = 16; - private final boolean fire; - private final Explosion.BlockInteraction blockInteraction; - private final RandomSource random = RandomSource.create(); - private final Level level; - private final double x; - private final double y; - private final double z; - @Nullable - private final Entity source; - private final float radius; - private final DamageSource damageSource; - private final ExplosionDamageCalculator damageCalculator; - private final ParticleOptions smallExplosionParticles; - private final ParticleOptions largeExplosionParticles; - private final Holder explosionSound; - private final ObjectArrayList toBlow = new ObjectArrayList<>(); - private final Map hitPlayers = Maps.newHashMap(); - - public static DamageSource getDefaultDamageSource(Level level, @Nullable Entity source) { - return level.damageSources().explosion(source, getIndirectSourceEntityInternal(source)); - } - - public Explosion( - Level level, - @Nullable Entity source, - double x, - double y, - double z, - float radius, - List toBlow, - Explosion.BlockInteraction blockInteraction, - ParticleOptions smallExplosionParticles, - ParticleOptions largeExplosionParticles, - Holder explosionSound - ) { - this( - level, - source, - getDefaultDamageSource(level, source), - null, - x, - y, - z, - radius, - false, - blockInteraction, - smallExplosionParticles, - largeExplosionParticles, - explosionSound - ); - this.toBlow.addAll(toBlow); - } - - public Explosion( - Level level, - @Nullable Entity source, - double x, - double y, - double z, - float radius, - boolean fire, - Explosion.BlockInteraction blockInteraction, - List positions - ) { - this(level, source, x, y, z, radius, fire, blockInteraction); - this.toBlow.addAll(positions); - } - - public Explosion(Level level, @Nullable Entity source, double x, double y, double z, float radius, boolean fire, Explosion.BlockInteraction blockInteraction) { - this( - level, - source, - getDefaultDamageSource(level, source), - null, - x, - y, - z, - radius, - fire, - blockInteraction, - ParticleTypes.EXPLOSION, - ParticleTypes.EXPLOSION_EMITTER, - SoundEvents.GENERIC_EXPLODE - ); - } - - public Explosion( - Level level, - @Nullable Entity source, - @Nullable DamageSource damageSource, - @Nullable ExplosionDamageCalculator damageCalculator, - double x, - double y, - double z, - float radius, - boolean fire, - Explosion.BlockInteraction blockInteraction, - ParticleOptions smallExplosionParticles, - ParticleOptions largeExplosionParticles, - Holder explosionSound - ) { - this.level = level; - this.source = source; - this.radius = radius; - this.x = x; - this.y = y; - this.z = z; - this.fire = fire; - this.blockInteraction = blockInteraction; - this.damageSource = damageSource == null ? level.damageSources().explosion(this) : damageSource; - this.damageCalculator = damageCalculator == null ? this.makeDamageCalculator(source) : damageCalculator; - this.smallExplosionParticles = smallExplosionParticles; - this.largeExplosionParticles = largeExplosionParticles; - this.explosionSound = explosionSound; - } - - private ExplosionDamageCalculator makeDamageCalculator(@Nullable Entity entity) { - return (ExplosionDamageCalculator)(entity == null ? EXPLOSION_DAMAGE_CALCULATOR : new EntityBasedExplosionDamageCalculator(entity)); - } - - public static float getSeenPercent(Vec3 explosionVector, Entity entity) { - AABB aABB = entity.getBoundingBox(); - double d = 1.0 / ((aABB.maxX - aABB.minX) * 2.0 + 1.0); - double e = 1.0 / ((aABB.maxY - aABB.minY) * 2.0 + 1.0); - double f = 1.0 / ((aABB.maxZ - aABB.minZ) * 2.0 + 1.0); - double g = (1.0 - Math.floor(1.0 / d) * d) / 2.0; - double h = (1.0 - Math.floor(1.0 / f) * f) / 2.0; - if (!(d < 0.0) && !(e < 0.0) && !(f < 0.0)) { - int i = 0; - int j = 0; - - for (double k = 0.0; k <= 1.0; k += d) { - for (double l = 0.0; l <= 1.0; l += e) { - for (double m = 0.0; m <= 1.0; m += f) { - double n = Mth.lerp(k, aABB.minX, aABB.maxX); - double o = Mth.lerp(l, aABB.minY, aABB.maxY); - double p = Mth.lerp(m, aABB.minZ, aABB.maxZ); - Vec3 vec3 = new Vec3(n + g, o, p + h); - if (entity.level().clip(new ClipContext(vec3, explosionVector, ClipContext.Block.COLLIDER, ClipContext.Fluid.NONE, entity)).getType() - == HitResult.Type.MISS) { - i++; - } - - j++; - } - } - } - - return (float)i / j; - } else { - return 0.0F; - } - } - - public float radius() { - return this.radius; - } - - public Vec3 center() { - return new Vec3(this.x, this.y, this.z); - } - - /** - * Does the first part of the explosion (destroy blocks) - */ - public void explode() { - this.level.gameEvent(this.source, GameEvent.EXPLODE, new Vec3(this.x, this.y, this.z)); - Set set = Sets.newHashSet(); - int i = 16; - - for (int j = 0; j < 16; j++) { - for (int k = 0; k < 16; k++) { - for (int l = 0; l < 16; l++) { - if (j == 0 || j == 15 || k == 0 || k == 15 || l == 0 || l == 15) { - double d = j / 15.0F * 2.0F - 1.0F; - double e = k / 15.0F * 2.0F - 1.0F; - double f = l / 15.0F * 2.0F - 1.0F; - double g = Math.sqrt(d * d + e * e + f * f); - d /= g; - e /= g; - f /= g; - float h = this.radius * (0.7F + this.level.random.nextFloat() * 0.6F); - double m = this.x; - double n = this.y; - double o = this.z; - - for (float p = 0.3F; h > 0.0F; h -= 0.22500001F) { - BlockPos blockPos = BlockPos.containing(m, n, o); - BlockState blockState = this.level.getBlockState(blockPos); - FluidState fluidState = this.level.getFluidState(blockPos); - if (!this.level.isInWorldBounds(blockPos)) { - break; - } - - Optional optional = this.damageCalculator.getBlockExplosionResistance(this, this.level, blockPos, blockState, fluidState); - if (optional.isPresent()) { - h -= (optional.get() + 0.3F) * 0.3F; - } - - if (h > 0.0F && this.damageCalculator.shouldBlockExplode(this, this.level, blockPos, blockState, h)) { - set.add(blockPos); - } - - m += d * 0.3F; - n += e * 0.3F; - o += f * 0.3F; - } - } - } - } - } - - this.toBlow.addAll(set); - float q = this.radius * 2.0F; - int k = Mth.floor(this.x - q - 1.0); - int lx = Mth.floor(this.x + q + 1.0); - int r = Mth.floor(this.y - q - 1.0); - int s = Mth.floor(this.y + q + 1.0); - int t = Mth.floor(this.z - q - 1.0); - int u = Mth.floor(this.z + q + 1.0); - List list = this.level.getEntities(this.source, new AABB(k, r, t, lx, s, u)); - Vec3 vec3 = new Vec3(this.x, this.y, this.z); - - for (Entity entity : list) { - if (!entity.ignoreExplosion(this)) { - double v = Math.sqrt(entity.distanceToSqr(vec3)) / q; - if (v <= 1.0) { - double w = entity.getX() - this.x; - double x = (entity instanceof PrimedTnt ? entity.getY() : entity.getEyeY()) - this.y; - double y = entity.getZ() - this.z; - double z = Math.sqrt(w * w + x * x + y * y); - if (z != 0.0) { - w /= z; - x /= z; - y /= z; - if (this.damageCalculator.shouldDamageEntity(this, entity)) { - entity.hurt(this.damageSource, this.damageCalculator.getEntityDamageAmount(this, entity)); - } - - double aa = (1.0 - v) * getSeenPercent(vec3, entity) * this.damageCalculator.getKnockbackMultiplier(entity); - double ab; - if (entity instanceof LivingEntity livingEntity) { - ab = aa * (1.0 - livingEntity.getAttributeValue(Attributes.EXPLOSION_KNOCKBACK_RESISTANCE)); - } else { - ab = aa; - } - - w *= ab; - x *= ab; - y *= ab; - Vec3 vec32 = new Vec3(w, x, y); - entity.setDeltaMovement(entity.getDeltaMovement().add(vec32)); - if (entity instanceof Player player && !player.isSpectator() && (!player.isCreative() || !player.getAbilities().flying)) { - this.hitPlayers.put(player, vec32); - } - - entity.onExplosionHit(this.source); - } - } - } - } - } - - /** - * Does the second part of the explosion (sound, particles, drop spawn) - */ - public void finalizeExplosion(boolean spawnParticles) { - if (this.level.isClientSide) { - this.level - .playLocalSound( - this.x, - this.y, - this.z, - this.explosionSound.value(), - SoundSource.BLOCKS, - 4.0F, - (1.0F + (this.level.random.nextFloat() - this.level.random.nextFloat()) * 0.2F) * 0.7F, - false - ); - } - - boolean bl = this.interactsWithBlocks(); - if (spawnParticles) { - ParticleOptions particleOptions; - if (!(this.radius < 2.0F) && bl) { - particleOptions = this.largeExplosionParticles; - } else { - particleOptions = this.smallExplosionParticles; - } - - this.level.addParticle(particleOptions, this.x, this.y, this.z, 1.0, 0.0, 0.0); - } - - if (bl) { - this.level.getProfiler().push("explosion_blocks"); - List> list = new ArrayList(); - Util.shuffle(this.toBlow, this.level.random); - - for (BlockPos blockPos : this.toBlow) { - this.level.getBlockState(blockPos).onExplosionHit(this.level, blockPos, this, (itemStack, blockPosx) -> addOrAppendStack(list, itemStack, blockPosx)); - } - - for (Pair pair : list) { - Block.popResource(this.level, pair.getSecond(), pair.getFirst()); - } - - this.level.getProfiler().pop(); - } - - if (this.fire) { - for (BlockPos blockPos2 : this.toBlow) { - if (this.random.nextInt(3) == 0 - && this.level.getBlockState(blockPos2).isAir() - && this.level.getBlockState(blockPos2.below()).isSolidRender(this.level, blockPos2.below())) { - this.level.setBlockAndUpdate(blockPos2, BaseFireBlock.getState(this.level, blockPos2)); - } - } - } - } - - private static void addOrAppendStack(List> drops, ItemStack stack, BlockPos pos) { - for (int i = 0; i < drops.size(); i++) { - Pair pair = (Pair)drops.get(i); - ItemStack itemStack = pair.getFirst(); - if (ItemEntity.areMergable(itemStack, stack)) { - drops.set(i, Pair.of(ItemEntity.merge(itemStack, stack, 16), pair.getSecond())); - if (stack.isEmpty()) { - return; - } - } - } - - drops.add(Pair.of(stack, pos)); - } - - public boolean interactsWithBlocks() { - return this.blockInteraction != Explosion.BlockInteraction.KEEP; - } - - public Map getHitPlayers() { - return this.hitPlayers; +public interface Explosion { + static DamageSource getDefaultDamageSource(Level level, @Nullable Entity source) { + return level.damageSources().explosion(source, getIndirectSourceEntity(source)); } @Nullable - private static LivingEntity getIndirectSourceEntityInternal(@Nullable Entity source) { - if (source == null) { - return null; - } else if (source instanceof PrimedTnt primedTnt) { - return primedTnt.getOwner(); - } else if (source instanceof LivingEntity livingEntity) { - return livingEntity; - } else { - return source instanceof Projectile projectile && projectile.getOwner() instanceof LivingEntity livingEntity2 ? livingEntity2 : null; - } + static LivingEntity getIndirectSourceEntity(@Nullable Entity entity) { + return switch (entity) { + case PrimedTnt primedTnt -> primedTnt.getOwner(); + case LivingEntity livingEntity -> livingEntity; + case Projectile projectile when projectile.getOwner() instanceof LivingEntity livingEntity2 -> livingEntity2; + case null, default -> null; + }; } + ServerLevel level(); + + Explosion.BlockInteraction getBlockInteraction(); + @Nullable - public LivingEntity getIndirectSourceEntity() { - return getIndirectSourceEntityInternal(this.source); - } + LivingEntity getIndirectSourceEntity(); /** * Returns either the entity that placed the explosive block, the entity that caused the explosion or null. */ @Nullable - public Entity getDirectSourceEntity() { - return this.source; - } + Entity getDirectSourceEntity(); - public void clearToBlow() { - this.toBlow.clear(); - } + float radius(); - public List getToBlow() { - return this.toBlow; - } + Vec3 center(); - public Explosion.BlockInteraction getBlockInteraction() { - return this.blockInteraction; - } + boolean canTriggerBlocks(); - public ParticleOptions getSmallExplosionParticles() { - return this.smallExplosionParticles; - } - - public ParticleOptions getLargeExplosionParticles() { - return this.largeExplosionParticles; - } - - public Holder getExplosionSound() { - return this.explosionSound; - } - - public boolean canTriggerBlocks() { - if (this.blockInteraction == Explosion.BlockInteraction.TRIGGER_BLOCK && !this.level.isClientSide()) { - return this.source != null && this.source.getType() == EntityType.BREEZE_WIND_CHARGE - ? this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) - : true; - } else { - return false; - } - } + boolean shouldAffectBlocklikeEntities(); public static enum BlockInteraction { - KEEP, - DESTROY, - DESTROY_WITH_DECAY, - TRIGGER_BLOCK; + KEEP(false), + DESTROY(true), + DESTROY_WITH_DECAY(true), + TRIGGER_BLOCK(false); + + private final boolean shouldAffectBlocklikeEntities; + + private BlockInteraction(final boolean bl) { + this.shouldAffectBlocklikeEntities = bl; + } + + public boolean shouldAffectBlocklikeEntities() { + return this.shouldAffectBlocklikeEntities; + } } } diff --git a/net/minecraft/world/level/ExplosionDamageCalculator.java b/net/minecraft/world/level/ExplosionDamageCalculator.java index 8629e11d..3218d1d8 100644 --- a/net/minecraft/world/level/ExplosionDamageCalculator.java +++ b/net/minecraft/world/level/ExplosionDamageCalculator.java @@ -24,11 +24,11 @@ public class ExplosionDamageCalculator { return 1.0F; } - public float getEntityDamageAmount(Explosion explosion, Entity entity) { - float f = explosion.radius() * 2.0F; + public float getEntityDamageAmount(Explosion explosion, Entity entity, float f) { + float g = explosion.radius() * 2.0F; Vec3 vec3 = explosion.center(); - double d = Math.sqrt(entity.distanceToSqr(vec3)) / f; - double e = (1.0 - d) * Explosion.getSeenPercent(vec3, entity); - return (float)((e * e + e) / 2.0 * 7.0 * f + 1.0); + double d = Math.sqrt(entity.distanceToSqr(vec3)) / g; + double e = (1.0 - d) * f; + return (float)((e * e + e) / 2.0 * 7.0 * g + 1.0); } } diff --git a/net/minecraft/world/level/GameRules.java b/net/minecraft/world/level/GameRules.java index d6585dae..74d428c2 100644 --- a/net/minecraft/world/level/GameRules.java +++ b/net/minecraft/world/level/GameRules.java @@ -17,6 +17,7 @@ import java.util.Map.Entry; import java.util.function.BiConsumer; import java.util.function.Function; import java.util.function.Supplier; +import java.util.stream.Stream; import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.Commands; import net.minecraft.nbt.CompoundTag; @@ -25,6 +26,8 @@ import net.minecraft.network.protocol.game.ClientboundGameEventPacket; import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.flag.FeatureFlagSet; +import net.minecraft.world.flag.FeatureFlags; import org.jetbrains.annotations.Nullable; import org.slf4j.Logger; @@ -90,6 +93,9 @@ public class GameRules { public static final GameRules.Key RULE_SPAWN_RADIUS = register( "spawnRadius", GameRules.Category.PLAYER, GameRules.IntegerValue.create(10) ); + public static final GameRules.Key RULE_DISABLE_PLAYER_MOVEMENT_CHECK = register( + "disablePlayerMovementCheck", GameRules.Category.PLAYER, GameRules.BooleanValue.create(false) + ); public static final GameRules.Key RULE_DISABLE_ELYTRA_MOVEMENT_CHECK = register( "disableElytraMovementCheck", GameRules.Category.PLAYER, GameRules.BooleanValue.create(false) ); @@ -135,7 +141,7 @@ public class GameRules { "playersNetherPortalDefaultDelay", GameRules.Category.PLAYER, GameRules.IntegerValue.create(80) ); public static final GameRules.Key RULE_PLAYERS_NETHER_PORTAL_CREATIVE_DELAY = register( - "playersNetherPortalCreativeDelay", GameRules.Category.PLAYER, GameRules.IntegerValue.create(1) + "playersNetherPortalCreativeDelay", GameRules.Category.PLAYER, GameRules.IntegerValue.create(0) ); public static final GameRules.Key RULE_DROWNING_DAMAGE = register( "drowningDamage", GameRules.Category.PLAYER, GameRules.BooleanValue.create(true) @@ -194,13 +200,19 @@ public class GameRules { public static final GameRules.Key RULE_ENDER_PEARLS_VANISH_ON_DEATH = register( "enderPearlsVanishOnDeath", GameRules.Category.PLAYER, GameRules.BooleanValue.create(true) ); + public static final GameRules.Key RULE_MINECART_MAX_SPEED = register( + "minecartMaxSpeed", + GameRules.Category.MISC, + GameRules.IntegerValue.create(8, 1, 1000, FeatureFlagSet.of(FeatureFlags.MINECART_IMPROVEMENTS), (minecraftServer, integerValue) -> {}) + ); public static final GameRules.Key RULE_SPAWN_CHUNK_RADIUS = register( - "spawnChunkRadius", GameRules.Category.MISC, GameRules.IntegerValue.create(2, 0, 32, (minecraftServer, integerValue) -> { + "spawnChunkRadius", GameRules.Category.MISC, GameRules.IntegerValue.create(2, 0, 32, FeatureFlagSet.of(), (minecraftServer, integerValue) -> { ServerLevel serverLevel = minecraftServer.overworld(); serverLevel.setDefaultSpawnPos(serverLevel.getSharedSpawnPos(), serverLevel.getSharedSpawnAngle()); }) ); private final Map, GameRules.Value> rules; + private final FeatureFlagSet enabledFeatures; private static > GameRules.Key register(String name, GameRules.Category category, GameRules.Type type) { GameRules.Key key = new GameRules.Key<>(name, category); @@ -212,23 +224,35 @@ public class GameRules { } } - public GameRules(DynamicLike tag) { - this(); - this.loadFromTag(tag); + public GameRules(FeatureFlagSet featureFlagSet, DynamicLike dynamicLike) { + this(featureFlagSet); + this.loadFromTag(dynamicLike); } - public GameRules() { - this.rules = (Map, GameRules.Value>)GAME_RULE_TYPES.entrySet() - .stream() - .collect(ImmutableMap.toImmutableMap(Entry::getKey, entry -> ((GameRules.Type)entry.getValue()).createRule())); + public GameRules(FeatureFlagSet featureFlagSet) { + this( + (Map, GameRules.Value>)availableRules(featureFlagSet) + .collect(ImmutableMap.toImmutableMap(Entry::getKey, entry -> ((GameRules.Type)entry.getValue()).createRule())), + featureFlagSet + ); } - private GameRules(Map, GameRules.Value> rules) { - this.rules = rules; + private static Stream, GameRules.Type>> availableRules(FeatureFlagSet featureFlagSet) { + return GAME_RULE_TYPES.entrySet().stream().filter(entry -> ((GameRules.Type)entry.getValue()).requiredFeatures.isSubsetOf(featureFlagSet)); + } + + private GameRules(Map, GameRules.Value> map, FeatureFlagSet featureFlagSet) { + this.rules = map; + this.enabledFeatures = featureFlagSet; } public > T getRule(GameRules.Key key) { - return (T)this.rules.get(key); + T value = (T)this.rules.get(key); + if (value == null) { + throw new IllegalArgumentException("Tried to access invalid game rule"); + } else { + return value; + } } /** @@ -244,22 +268,28 @@ public class GameRules { this.rules.forEach((key, value) -> dynamic.get(key.id).asString().ifSuccess(value::deserialize)); } - public GameRules copy() { + public GameRules copy(FeatureFlagSet featureFlagSet) { return new GameRules( - (Map, GameRules.Value>)this.rules - .entrySet() - .stream() - .collect(ImmutableMap.toImmutableMap(Entry::getKey, entry -> ((GameRules.Value)entry.getValue()).copy())) + (Map, GameRules.Value>)availableRules(featureFlagSet) + .collect( + ImmutableMap.toImmutableMap( + Entry::getKey, + entry -> this.rules.containsKey(entry.getKey()) ? (GameRules.Value)this.rules.get(entry.getKey()) : ((GameRules.Type)entry.getValue()).createRule() + ) + ), + featureFlagSet ); } - public static void visitGameRuleTypes(GameRules.GameRuleTypeVisitor visitor) { - GAME_RULE_TYPES.forEach((key, type) -> callVisitorCap(visitor, key, type)); + public void visitGameRuleTypes(GameRules.GameRuleTypeVisitor gameRuleTypeVisitor) { + GAME_RULE_TYPES.forEach((key, type) -> this.callVisitorCap(gameRuleTypeVisitor, key, type)); } - private static > void callVisitorCap(GameRules.GameRuleTypeVisitor visitor, GameRules.Key key, GameRules.Type type) { - visitor.visit(key, type); - type.callVisitor(visitor, key); + private > void callVisitorCap(GameRules.GameRuleTypeVisitor key, GameRules.Key type, GameRules.Type type2) { + if (type2.requiredFeatures.isSubsetOf(this.enabledFeatures)) { + key.visit(type, type2); + type2.callVisitor(key, type); + } } public void assignFrom(GameRules rules, @Nullable MinecraftServer server) { @@ -284,7 +314,11 @@ public class GameRules { static GameRules.Type create(boolean defaultValue, BiConsumer changeListener) { return new GameRules.Type<>( - BoolArgumentType::bool, type -> new GameRules.BooleanValue(type, defaultValue), changeListener, GameRules.GameRuleTypeVisitor::visitBoolean + BoolArgumentType::bool, + type -> new GameRules.BooleanValue(type, defaultValue), + changeListener, + GameRules.GameRuleTypeVisitor::visitBoolean, + FeatureFlagSet.of() ); } @@ -376,16 +410,23 @@ public class GameRules { private static GameRules.Type create(int defaultValue, BiConsumer changeListener) { return new GameRules.Type<>( - IntegerArgumentType::integer, type -> new GameRules.IntegerValue(type, defaultValue), changeListener, GameRules.GameRuleTypeVisitor::visitInteger + IntegerArgumentType::integer, + type -> new GameRules.IntegerValue(type, defaultValue), + changeListener, + GameRules.GameRuleTypeVisitor::visitInteger, + FeatureFlagSet.of() ); } - static GameRules.Type create(int defaultValue, int min, int max, BiConsumer changeListener) { + static GameRules.Type create( + int i, int j, int k, FeatureFlagSet featureFlagSet, BiConsumer biConsumer + ) { return new GameRules.Type<>( - () -> IntegerArgumentType.integer(min, max), - type -> new GameRules.IntegerValue(type, defaultValue), - changeListener, - GameRules.GameRuleTypeVisitor::visitInteger + () -> IntegerArgumentType.integer(j, k), + type -> new GameRules.IntegerValue(type, i), + biConsumer, + GameRules.GameRuleTypeVisitor::visitInteger, + featureFlagSet ); } @@ -502,17 +543,20 @@ public class GameRules { private final Function, T> constructor; final BiConsumer callback; private final GameRules.VisitorCaller visitorCaller; + final FeatureFlagSet requiredFeatures; Type( - Supplier> argument, - Function, T> constructor, - BiConsumer callback, - GameRules.VisitorCaller visitorCaller + Supplier> supplier, + Function, T> function, + BiConsumer biConsumer, + GameRules.VisitorCaller visitorCaller, + FeatureFlagSet featureFlagSet ) { - this.argument = argument; - this.constructor = constructor; - this.callback = callback; + this.argument = supplier; + this.constructor = function; + this.callback = biConsumer; this.visitorCaller = visitorCaller; + this.requiredFeatures = featureFlagSet; } public RequiredArgumentBuilder createArgument(String name) { @@ -526,6 +570,10 @@ public class GameRules { public void callVisitor(GameRules.GameRuleTypeVisitor visitor, GameRules.Key key) { this.visitorCaller.call(visitor, key, this); } + + public FeatureFlagSet requiredFeatures() { + return this.requiredFeatures; + } } public abstract static class Value> { diff --git a/net/minecraft/world/level/GameType.java b/net/minecraft/world/level/GameType.java index bc1b0f1b..9fe2686f 100644 --- a/net/minecraft/world/level/GameType.java +++ b/net/minecraft/world/level/GameType.java @@ -1,9 +1,11 @@ package net.minecraft.world.level; +import java.util.Arrays; import java.util.function.IntFunction; import net.minecraft.network.chat.Component; import net.minecraft.util.ByIdMap; import net.minecraft.util.StringRepresentable; +import net.minecraft.util.ByIdMap.OutOfBoundsStrategy; import net.minecraft.world.entity.player.Abilities; import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.Nullable; @@ -16,7 +18,7 @@ public enum GameType implements StringRepresentable { public static final GameType DEFAULT_MODE = SURVIVAL; public static final StringRepresentable.EnumCodec CODEC = StringRepresentable.fromEnum(GameType::values); - private static final IntFunction BY_ID = ByIdMap.continuous(GameType::getId, values(), ByIdMap.OutOfBoundsStrategy.ZERO); + private static final IntFunction BY_ID = ByIdMap.continuous(GameType::getId, values(), OutOfBoundsStrategy.ZERO); private static final int NOT_SET = -1; private final int id; private final String name; @@ -130,4 +132,8 @@ public enum GameType implements StringRepresentable { public static GameType byNullableId(int id) { return id == -1 ? null : byId(id); } + + public static boolean isValidId(int i) { + return Arrays.stream(values()).anyMatch(gameType -> gameType.id == i); + } } diff --git a/net/minecraft/world/level/Level.java b/net/minecraft/world/level/Level.java index 5669e375..e01c4ec2 100644 --- a/net/minecraft/world/level/Level.java +++ b/net/minecraft/world/level/Level.java @@ -7,7 +7,6 @@ import java.util.Iterator; import java.util.List; import java.util.function.Consumer; import java.util.function.Predicate; -import java.util.function.Supplier; import net.minecraft.CrashReport; import net.minecraft.CrashReportCategory; import net.minecraft.CrashReportDetail; @@ -29,10 +28,11 @@ import net.minecraft.server.level.FullChunkStatus; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; -import net.minecraft.util.AbortableIterationConsumer; import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; import net.minecraft.util.StringRepresentable; +import net.minecraft.util.AbortableIterationConsumer.Continuation; +import net.minecraft.util.profiling.Profiler; import net.minecraft.util.profiling.ProfilerFiller; import net.minecraft.world.DifficultyInstance; import net.minecraft.world.TickRateManager; @@ -45,13 +45,14 @@ import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.alchemy.PotionBrewing; import net.minecraft.world.item.component.FireworkExplosion; -import net.minecraft.world.item.crafting.RecipeManager; +import net.minecraft.world.item.crafting.RecipeAccess; import net.minecraft.world.level.biome.Biome; import net.minecraft.world.level.biome.BiomeManager; import net.minecraft.world.level.block.BaseFireBlock; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.FuelValues; import net.minecraft.world.level.block.entity.TickingBlockEntity; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.border.WorldBorder; @@ -62,12 +63,14 @@ import net.minecraft.world.level.dimension.DimensionType; import net.minecraft.world.level.entity.EntityTypeTest; import net.minecraft.world.level.entity.LevelEntityGetter; import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.level.gameevent.GameEvent.Context; import net.minecraft.world.level.levelgen.Heightmap; import net.minecraft.world.level.lighting.LevelLightEngine; import net.minecraft.world.level.material.FluidState; import net.minecraft.world.level.material.Fluids; import net.minecraft.world.level.redstone.CollectingNeighborUpdater; import net.minecraft.world.level.redstone.NeighborUpdater; +import net.minecraft.world.level.redstone.Orientation; import net.minecraft.world.level.saveddata.maps.MapId; import net.minecraft.world.level.saveddata.maps.MapItemSavedData; import net.minecraft.world.level.storage.LevelData; @@ -110,7 +113,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable { private final RandomSource threadSafeRandom = RandomSource.createThreadSafe(); private final Holder dimensionTypeRegistration; protected final WritableLevelData levelData; - private final Supplier profiler; public final boolean isClientSide; private final WorldBorder worldBorder; private final BiomeManager biomeManager; @@ -120,22 +122,20 @@ public abstract class Level implements LevelAccessor, AutoCloseable { private long subTickCount; protected Level( - WritableLevelData levelData, - ResourceKey dimension, + WritableLevelData writableLevelData, + ResourceKey resourceKey, RegistryAccess registryAccess, - Holder dimensionTypeRegistration, - Supplier profiler, - boolean isClientSide, - boolean isDebug, - long biomeZoomSeed, - int maxChainedNeighborUpdates + Holder holder, + boolean bl, + boolean bl2, + long l, + int i ) { - this.profiler = profiler; - this.levelData = levelData; - this.dimensionTypeRegistration = dimensionTypeRegistration; - final DimensionType dimensionType = dimensionTypeRegistration.value(); - this.dimension = dimension; - this.isClientSide = isClientSide; + this.levelData = writableLevelData; + this.dimensionTypeRegistration = holder; + final DimensionType dimensionType = holder.value(); + this.dimension = resourceKey; + this.isClientSide = bl; if (dimensionType.coordinateScale() != 1.0) { this.worldBorder = new WorldBorder() { @Override @@ -153,9 +153,9 @@ public abstract class Level implements LevelAccessor, AutoCloseable { } this.thread = Thread.currentThread(); - this.biomeManager = new BiomeManager(this, biomeZoomSeed); - this.isDebug = isDebug; - this.neighborUpdater = new CollectingNeighborUpdater(this, maxChainedNeighborUpdates); + this.biomeManager = new BiomeManager(this, l); + this.isDebug = bl2; + this.neighborUpdater = new CollectingNeighborUpdater(this, i); this.registryAccess = registryAccess; this.damageSources = new DamageSources(registryAccess); } @@ -288,7 +288,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { boolean bl = this.setBlock(pos, fluidState.createLegacyBlock(), 3, recursionLeft); if (bl) { - this.gameEvent(GameEvent.BLOCK_DESTROY, pos, GameEvent.Context.of(entity, blockState)); + this.gameEvent(GameEvent.BLOCK_DESTROY, pos, Context.of(entity, blockState)); } return bl; @@ -316,18 +316,21 @@ public abstract class Level implements LevelAccessor, AutoCloseable { public void updateNeighborsAt(BlockPos pos, Block block) { } - public void updateNeighborsAtExceptFromFacing(BlockPos pos, Block blockType, Direction skipSide) { + public void updateNeighborsAt(BlockPos blockPos, Block block, @Nullable Orientation orientation) { } - public void neighborChanged(BlockPos pos, Block block, BlockPos fromPos) { + public void updateNeighborsAtExceptFromFacing(BlockPos blockPos, Block block, Direction direction, @Nullable Orientation orientation) { } - public void neighborChanged(BlockState state, BlockPos pos, Block block, BlockPos fromPos, boolean isMoving) { + public void neighborChanged(BlockPos blockPos, Block block, @Nullable Orientation orientation) { + } + + public void neighborChanged(BlockState blockState, BlockPos blockPos, Block block, @Nullable Orientation orientation, boolean bl) { } @Override - public void neighborShapeChanged(Direction direction, BlockState queried, BlockPos pos, BlockPos offsetPos, int flags, int recursionLevel) { - this.neighborUpdater.shapeUpdate(direction, queried, pos, offsetPos, flags, recursionLevel); + public void neighborShapeChanged(Direction direction, BlockPos blockPos, BlockPos blockPos2, BlockState blockState, int i, int j) { + this.neighborUpdater.shapeUpdate(direction, blockState, blockPos, blockPos2, i, j); } @Override @@ -337,7 +340,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { if (this.hasChunk(SectionPos.blockToSectionCoord(x), SectionPos.blockToSectionCoord(z))) { i = this.getChunk(SectionPos.blockToSectionCoord(x), SectionPos.blockToSectionCoord(z)).getHeight(heightmapType, x & 15, z & 15) + 1; } else { - i = this.getMinBuildHeight(); + i = this.getMinY(); } } else { i = this.getSeaLevel() + 1; @@ -459,7 +462,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { } protected void tickBlockEntities() { - ProfilerFiller profilerFiller = this.getProfiler(); + ProfilerFiller profilerFiller = Profiler.get(); profilerFiller.push("blockEntities"); this.tickingBlockEntities = true; if (!this.pendingBlockEntityTickers.isEmpty()) { @@ -506,15 +509,15 @@ public abstract class Level implements LevelAccessor, AutoCloseable { return this.shouldTickBlocksAt(ChunkPos.asLong(pos)); } - public Explosion explode(@Nullable Entity source, double x, double y, double z, float radius, Level.ExplosionInteraction explosionInteraction) { - return this.explode( - source, - Explosion.getDefaultDamageSource(this, source), + public void explode(@Nullable Entity entity, double d, double e, double f, float g, Level.ExplosionInteraction explosionInteraction) { + this.explode( + entity, + Explosion.getDefaultDamageSource(this, entity), null, - x, - y, - z, - radius, + d, + e, + f, + g, false, explosionInteraction, ParticleTypes.EXPLOSION, @@ -523,16 +526,16 @@ public abstract class Level implements LevelAccessor, AutoCloseable { ); } - public Explosion explode(@Nullable Entity source, double x, double y, double z, float radius, boolean fire, Level.ExplosionInteraction explosionInteraction) { - return this.explode( - source, - Explosion.getDefaultDamageSource(this, source), + public void explode(@Nullable Entity entity, double d, double e, double f, float g, boolean bl, Level.ExplosionInteraction explosionInteraction) { + this.explode( + entity, + Explosion.getDefaultDamageSource(this, entity), null, - x, - y, - z, - radius, - fire, + d, + e, + f, + g, + bl, explosionInteraction, ParticleTypes.EXPLOSION, ParticleTypes.EXPLOSION_EMITTER, @@ -540,24 +543,24 @@ public abstract class Level implements LevelAccessor, AutoCloseable { ); } - public Explosion explode( - @Nullable Entity source, + public void explode( + @Nullable Entity entity, @Nullable DamageSource damageSource, - @Nullable ExplosionDamageCalculator damageCalculator, - Vec3 pos, - float radius, - boolean fire, + @Nullable ExplosionDamageCalculator explosionDamageCalculator, + Vec3 vec3, + float f, + boolean bl, Level.ExplosionInteraction explosionInteraction ) { - return this.explode( - source, + this.explode( + entity, damageSource, - damageCalculator, - pos.x(), - pos.y(), - pos.z(), - radius, - fire, + explosionDamageCalculator, + vec3.x(), + vec3.y(), + vec3.z(), + f, + bl, explosionInteraction, ParticleTypes.EXPLOSION, ParticleTypes.EXPLOSION_EMITTER, @@ -565,26 +568,26 @@ public abstract class Level implements LevelAccessor, AutoCloseable { ); } - public Explosion explode( - @Nullable Entity source, + public void explode( + @Nullable Entity entity, @Nullable DamageSource damageSource, - @Nullable ExplosionDamageCalculator damageCalculator, - double x, - double y, - double z, - float radius, - boolean fire, + @Nullable ExplosionDamageCalculator explosionDamageCalculator, + double d, + double e, + double f, + float g, + boolean bl, Level.ExplosionInteraction explosionInteraction ) { - return this.explode( - source, + this.explode( + entity, damageSource, - damageCalculator, - x, - y, - z, - radius, - fire, + explosionDamageCalculator, + d, + e, + f, + g, + bl, explosionInteraction, ParticleTypes.EXPLOSION, ParticleTypes.EXPLOSION_EMITTER, @@ -592,60 +595,20 @@ public abstract class Level implements LevelAccessor, AutoCloseable { ); } - public Explosion explode( - @Nullable Entity source, + public abstract void explode( + @Nullable Entity entity, @Nullable DamageSource damageSource, - @Nullable ExplosionDamageCalculator damageCalculator, - double x, - double y, - double z, - float radius, - boolean fire, + @Nullable ExplosionDamageCalculator explosionDamageCalculator, + double d, + double e, + double f, + float g, + boolean bl, Level.ExplosionInteraction explosionInteraction, - ParticleOptions smallExplosionParticles, - ParticleOptions largeExplosionParticles, - Holder explosionSound - ) { - return this.explode( - source, damageSource, damageCalculator, x, y, z, radius, fire, explosionInteraction, true, smallExplosionParticles, largeExplosionParticles, explosionSound - ); - } - - public Explosion explode( - @Nullable Entity source, - @Nullable DamageSource damageSource, - @Nullable ExplosionDamageCalculator damageCalculator, - double x, - double y, - double z, - float radius, - boolean fire, - Level.ExplosionInteraction explosionInteraction, - boolean spawnParticles, - ParticleOptions smallExplosionParticles, - ParticleOptions largeExplosionParticles, - Holder explosionSound - ) { - Explosion.BlockInteraction blockInteraction = switch (explosionInteraction) { - case NONE -> Explosion.BlockInteraction.KEEP; - case BLOCK -> this.getDestroyType(GameRules.RULE_BLOCK_EXPLOSION_DROP_DECAY); - case MOB -> this.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) - ? this.getDestroyType(GameRules.RULE_MOB_EXPLOSION_DROP_DECAY) - : Explosion.BlockInteraction.KEEP; - case TNT -> this.getDestroyType(GameRules.RULE_TNT_EXPLOSION_DROP_DECAY); - case TRIGGER -> Explosion.BlockInteraction.TRIGGER_BLOCK; - }; - Explosion explosion = new Explosion( - this, source, damageSource, damageCalculator, x, y, z, radius, fire, blockInteraction, smallExplosionParticles, largeExplosionParticles, explosionSound - ); - explosion.explode(); - explosion.finalizeExplosion(spawnParticles); - return explosion; - } - - private Explosion.BlockInteraction getDestroyType(GameRules.Key gameRule) { - return this.getGameRules().getBoolean(gameRule) ? Explosion.BlockInteraction.DESTROY_WITH_DECAY : Explosion.BlockInteraction.DESTROY; - } + ParticleOptions particleOptions, + ParticleOptions particleOptions2, + Holder holder + ); /** * Returns the name of the current chunk provider, by calling chunkprovider.makeString() @@ -706,11 +669,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable { this.skyDarken = (int)((1.0 - f * d * e) * 11.0); } - /** - * First boolean for hostile mobs and second for peaceful mobs - */ - public void setSpawnSettings(boolean hostile, boolean peaceful) { - this.getChunkSource().setSpawnSettings(hostile, peaceful); + public void setSpawnSettings(boolean bl) { + this.getChunkSource().setSpawnSettings(bl); } public BlockPos getSharedSpawnPos() { @@ -752,7 +712,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @Override public List getEntities(@Nullable Entity entity, AABB area, Predicate predicate) { - this.getProfiler().incrementCounter("getEntities"); + Profiler.get().incrementCounter("getEntities"); List list = Lists.newArrayList(); this.getEntities().get(area, entity2 -> { if (entity2 != entity && predicate.test(entity2)) { @@ -784,12 +744,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable { public void getEntities( EntityTypeTest entityTypeTest, AABB bounds, Predicate predicate, List output, int maxResults ) { - this.getProfiler().incrementCounter("getEntities"); + Profiler.get().incrementCounter("getEntities"); this.getEntities().get(entityTypeTest, bounds, entity -> { if (predicate.test(entity)) { output.add(entity); if (output.size() >= maxResults) { - return AbortableIterationConsumer.Continuation.ABORT; + return Continuation.ABORT; } } @@ -799,13 +759,13 @@ public abstract class Level implements LevelAccessor, AutoCloseable { if (entity2 != null && predicate.test(entity2)) { output.add(entity2); if (output.size() >= maxResults) { - return AbortableIterationConsumer.Continuation.ABORT; + return Continuation.ABORT; } } } } - return AbortableIterationConsumer.Continuation.CONTINUE; + return Continuation.CONTINUE; }); } @@ -817,15 +777,10 @@ public abstract class Level implements LevelAccessor, AutoCloseable { public void blockEntityChanged(BlockPos pos) { if (this.hasChunkAt(pos)) { - this.getChunkAt(pos).setUnsaved(true); + this.getChunkAt(pos).markUnsaved(); } } - @Override - public int getSeaLevel() { - return 63; - } - /** * If on MP, sends a quitting packet. */ @@ -862,13 +817,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable { return this.levelData; } - /** - * Gets the GameRules instance. - */ - public GameRules getGameRules() { - return this.levelData.getGameRules(); - } - public abstract TickRateManager tickRateManager(); public float getThunderLevel(float delta) { @@ -900,18 +848,22 @@ public abstract class Level implements LevelAccessor, AutoCloseable { this.rainLevel = f; } + private boolean canHaveWeather() { + return this.dimensionType().hasSkyLight() && !this.dimensionType().hasCeiling(); + } + /** * Returns {@code true} if the current thunder strength (weighted with the rain strength) is greater than 0.9 */ public boolean isThundering() { - return this.dimensionType().hasSkyLight() && !this.dimensionType().hasCeiling() ? this.getThunderLevel(1.0F) > 0.9 : false; + return this.canHaveWeather() && this.getThunderLevel(1.0F) > 0.9; } /** * Returns {@code true} if the current rain strength is greater than 0.2 */ public boolean isRaining() { - return this.getRainLevel(1.0F) > 0.2; + return this.canHaveWeather() && this.getRainLevel(1.0F) > 0.2; } /** @@ -926,7 +878,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { return false; } else { Biome biome = this.getBiome(pos).value(); - return biome.getPrecipitationAt(pos) == Biome.Precipitation.RAIN; + return biome.getPrecipitationAt(pos, this.getSeaLevel()) == Biome.Precipitation.RAIN; } } @@ -971,12 +923,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable { if (this.hasChunkAt(blockPos)) { BlockState blockState = this.getBlockState(blockPos); if (blockState.is(Blocks.COMPARATOR)) { - this.neighborChanged(blockState, blockPos, block, pos, false); + this.neighborChanged(blockState, blockPos, block, null, false); } else if (blockState.isRedstoneConductor(this, blockPos)) { blockPos = blockPos.relative(direction); blockState = this.getBlockState(blockPos); if (blockState.is(Blocks.COMPARATOR)) { - this.neighborChanged(blockState, blockPos, block, pos, false); + this.neighborChanged(blockState, blockPos, block, null, false); } } } @@ -1040,7 +992,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { return predicate.test(this.getFluidState(pos)); } - public abstract RecipeManager getRecipeManager(); + public abstract RecipeAccess recipeAccess(); public BlockPos getBlockRandomPos(int x, int y, int z, int yMask) { this.randValue = this.randValue * 3 + 1013904223; @@ -1052,14 +1004,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable { return false; } - public ProfilerFiller getProfiler() { - return (ProfilerFiller)this.profiler.get(); - } - - public Supplier getProfilerSupplier() { - return this.profiler; - } - @Override public BiomeManager getBiomeManager() { return this.biomeManager; @@ -1087,6 +1031,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable { public abstract PotionBrewing potionBrewing(); + public abstract FuelValues fuelValues(); + public static enum ExplosionInteraction implements StringRepresentable { NONE("none"), BLOCK("block"), @@ -1097,7 +1043,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { public static final Codec CODEC = StringRepresentable.fromEnum(Level.ExplosionInteraction::values); private final String id; - private ExplosionInteraction(String id) { + private ExplosionInteraction(final String id) { this.id = id; } diff --git a/net/minecraft/world/level/LevelAccessor.java b/net/minecraft/world/level/LevelAccessor.java index c1d160ed..3967a7c2 100644 --- a/net/minecraft/world/level/LevelAccessor.java +++ b/net/minecraft/world/level/LevelAccessor.java @@ -18,16 +18,15 @@ import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.chunk.ChunkSource; import net.minecraft.world.level.gameevent.GameEvent; -import net.minecraft.world.level.material.Fluid; +import net.minecraft.world.level.gameevent.GameEvent.Context; import net.minecraft.world.level.redstone.NeighborUpdater; import net.minecraft.world.level.storage.LevelData; import net.minecraft.world.phys.Vec3; -import net.minecraft.world.ticks.LevelTickAccess; import net.minecraft.world.ticks.ScheduledTick; import net.minecraft.world.ticks.TickPriority; import org.jetbrains.annotations.Nullable; -public interface LevelAccessor extends CommonLevelAccessor, LevelTimeAccess { +public interface LevelAccessor extends CommonLevelAccessor, LevelTimeAccess, ScheduledTickAccess { @Override default long dayTime() { return this.getLevelData().getDayTime(); @@ -35,32 +34,14 @@ public interface LevelAccessor extends CommonLevelAccessor, LevelTimeAccess { long nextSubTickCount(); - LevelTickAccess getBlockTicks(); - - private ScheduledTick createTick(BlockPos pos, T type, int delay, TickPriority priority) { - return new ScheduledTick<>(type, pos, this.getLevelData().getGameTime() + delay, priority, this.nextSubTickCount()); + @Override + default ScheduledTick createTick(BlockPos blockPos, T object, int i, TickPriority tickPriority) { + return new ScheduledTick<>(object, blockPos, this.getLevelData().getGameTime() + i, tickPriority, this.nextSubTickCount()); } - private ScheduledTick createTick(BlockPos pos, T type, int delay) { - return new ScheduledTick<>(type, pos, this.getLevelData().getGameTime() + delay, this.nextSubTickCount()); - } - - default void scheduleTick(BlockPos pos, Block block, int delay, TickPriority priority) { - this.getBlockTicks().schedule(this.createTick(pos, block, delay, priority)); - } - - default void scheduleTick(BlockPos pos, Block block, int delay) { - this.getBlockTicks().schedule(this.createTick(pos, block, delay)); - } - - LevelTickAccess getFluidTicks(); - - default void scheduleTick(BlockPos pos, Fluid fluid, int delay, TickPriority priority) { - this.getFluidTicks().schedule(this.createTick(pos, fluid, delay, priority)); - } - - default void scheduleTick(BlockPos pos, Fluid fluid, int delay) { - this.getFluidTicks().schedule(this.createTick(pos, fluid, delay)); + @Override + default ScheduledTick createTick(BlockPos blockPos, T object, int i) { + return new ScheduledTick<>(object, blockPos, this.getLevelData().getGameTime() + i, this.nextSubTickCount()); } /** @@ -92,13 +73,8 @@ public interface LevelAccessor extends CommonLevelAccessor, LevelTimeAccess { default void blockUpdated(BlockPos pos, Block block) { } - /** - * @param queried The block state of the current block - * @param pos The position of the neighbor block - * @param offsetPos The position of the current block - */ - default void neighborShapeChanged(Direction direction, BlockState queried, BlockPos pos, BlockPos offsetPos, int flags, int recursionLevel) { - NeighborUpdater.executeShapeUpdate(this, direction, queried, pos, offsetPos, flags, recursionLevel - 1); + default void neighborShapeChanged(Direction direction, BlockPos blockPos, BlockPos blockPos2, BlockState blockState, int i, int j) { + NeighborUpdater.executeShapeUpdate(this, direction, blockPos, blockPos2, blockState, i, j - 1); } default void playSound(@Nullable Player player, BlockPos pos, SoundEvent sound, SoundSource source) { @@ -118,21 +94,21 @@ public interface LevelAccessor extends CommonLevelAccessor, LevelTimeAccess { this.levelEvent(null, type, pos, data); } - void gameEvent(Holder gameEvent, Vec3 pos, GameEvent.Context context); + void gameEvent(Holder gameEvent, Vec3 pos, Context context); default void gameEvent(@Nullable Entity entity, Holder gameEvent, Vec3 pos) { - this.gameEvent(gameEvent, pos, new GameEvent.Context(entity, null)); + this.gameEvent(gameEvent, pos, new Context(entity, null)); } default void gameEvent(@Nullable Entity entity, Holder gameEvent, BlockPos pos) { - this.gameEvent(gameEvent, pos, new GameEvent.Context(entity, null)); + this.gameEvent(gameEvent, pos, new Context(entity, null)); } - default void gameEvent(Holder gameEvent, BlockPos pos, GameEvent.Context context) { + default void gameEvent(Holder gameEvent, BlockPos pos, Context context) { this.gameEvent(gameEvent, Vec3.atCenterOf(pos), context); } - default void gameEvent(ResourceKey gameEvent, BlockPos pos, GameEvent.Context context) { - this.gameEvent(this.registryAccess().registryOrThrow(Registries.GAME_EVENT).getHolderOrThrow(gameEvent), pos, context); + default void gameEvent(ResourceKey gameEvent, BlockPos pos, Context context) { + this.gameEvent(this.registryAccess().lookupOrThrow(Registries.GAME_EVENT).getOrThrow(gameEvent), pos, context); } } diff --git a/net/minecraft/world/level/LevelHeightAccessor.java b/net/minecraft/world/level/LevelHeightAccessor.java index 2a4e82aa..4e863412 100644 --- a/net/minecraft/world/level/LevelHeightAccessor.java +++ b/net/minecraft/world/level/LevelHeightAccessor.java @@ -6,22 +6,26 @@ import net.minecraft.core.SectionPos; public interface LevelHeightAccessor { int getHeight(); - int getMinBuildHeight(); + int getMinY(); - default int getMaxBuildHeight() { - return this.getMinBuildHeight() + this.getHeight(); + default int getMaxY() { + return this.getMinY() + this.getHeight() - 1; } default int getSectionsCount() { - return this.getMaxSection() - this.getMinSection(); + return this.getMaxSectionY() - this.getMinSectionY() + 1; } - default int getMinSection() { - return SectionPos.blockToSectionCoord(this.getMinBuildHeight()); + default int getMinSectionY() { + return SectionPos.blockToSectionCoord(this.getMinY()); } - default int getMaxSection() { - return SectionPos.blockToSectionCoord(this.getMaxBuildHeight() - 1) + 1; + default int getMaxSectionY() { + return SectionPos.blockToSectionCoord(this.getMaxY()); + } + + default boolean isInsideBuildHeight(int i) { + return i >= this.getMinY() && i <= this.getMaxY(); } default boolean isOutsideBuildHeight(BlockPos pos) { @@ -29,7 +33,7 @@ public interface LevelHeightAccessor { } default boolean isOutsideBuildHeight(int y) { - return y < this.getMinBuildHeight() || y >= this.getMaxBuildHeight(); + return y < this.getMinY() || y > this.getMaxY(); } default int getSectionIndex(int y) { @@ -37,11 +41,11 @@ public interface LevelHeightAccessor { } default int getSectionIndexFromSectionY(int sectionIndex) { - return sectionIndex - this.getMinSection(); + return sectionIndex - this.getMinSectionY(); } default int getSectionYFromSectionIndex(int sectionIndex) { - return sectionIndex + this.getMinSection(); + return sectionIndex + this.getMinSectionY(); } static LevelHeightAccessor create(int minBuildHeight, int height) { @@ -52,7 +56,7 @@ public interface LevelHeightAccessor { } @Override - public int getMinBuildHeight() { + public int getMinY() { return minBuildHeight; } }; diff --git a/net/minecraft/world/level/LevelReader.java b/net/minecraft/world/level/LevelReader.java index a5a2d24e..7bb8fc4e 100644 --- a/net/minecraft/world/level/LevelReader.java +++ b/net/minecraft/world/level/LevelReader.java @@ -14,6 +14,7 @@ import net.minecraft.util.Mth; import net.minecraft.world.flag.FeatureFlagSet; import net.minecraft.world.level.biome.Biome; import net.minecraft.world.level.biome.BiomeManager; +import net.minecraft.world.level.biome.BiomeManager.NoiseBiomeSource; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.chunk.ChunkAccess; import net.minecraft.world.level.chunk.status.ChunkStatus; @@ -22,7 +23,7 @@ import net.minecraft.world.level.levelgen.Heightmap; import net.minecraft.world.phys.AABB; import org.jetbrains.annotations.Nullable; -public interface LevelReader extends BlockAndTintGetter, CollisionGetter, SignalGetter, BiomeManager.NoiseBiomeSource { +public interface LevelReader extends BlockAndTintGetter, CollisionGetter, SignalGetter, NoiseBiomeSource { @Nullable ChunkAccess getChunk(int x, int z, ChunkStatus chunkStatus, boolean requireChunk); @@ -64,13 +65,12 @@ public interface LevelReader extends BlockAndTintGetter, CollisionGetter, Signal boolean isClientSide(); - @Deprecated int getSeaLevel(); DimensionType dimensionType(); @Override - default int getMinBuildHeight() { + default int getMinY() { return this.dimensionType().minY(); } @@ -100,7 +100,7 @@ public interface LevelReader extends BlockAndTintGetter, CollisionGetter, Signal } else { for (BlockPos var4 = blockPos.below(); var4.getY() > pos.getY(); var4 = var4.below()) { BlockState blockState = this.getBlockState(var4); - if (blockState.getLightBlock(this, var4) > 0 && !blockState.liquid()) { + if (blockState.getLightBlock() > 0 && !blockState.liquid()) { return false; } } @@ -194,7 +194,7 @@ public interface LevelReader extends BlockAndTintGetter, CollisionGetter, Signal @Deprecated default boolean hasChunksAt(int fromX, int fromY, int fromZ, int toX, int toY, int toZ) { - return toY >= this.getMinBuildHeight() && fromY < this.getMaxBuildHeight() ? this.hasChunksAt(fromX, fromZ, toX, toZ) : false; + return toY >= this.getMinY() && fromY <= this.getMaxY() ? this.hasChunksAt(fromX, fromZ, toX, toZ) : false; } @Deprecated @@ -220,7 +220,7 @@ public interface LevelReader extends BlockAndTintGetter, CollisionGetter, Signal FeatureFlagSet enabledFeatures(); default HolderLookup holderLookup(ResourceKey> registryKey) { - Registry registry = this.registryAccess().registryOrThrow(registryKey); - return registry.asLookup().filterFeatures(this.enabledFeatures()); + Registry registry = this.registryAccess().lookupOrThrow(registryKey); + return registry.filterFeatures(this.enabledFeatures()); } } diff --git a/net/minecraft/world/level/LevelSettings.java b/net/minecraft/world/level/LevelSettings.java index 9e09db09..e81a4166 100644 --- a/net/minecraft/world/level/LevelSettings.java +++ b/net/minecraft/world/level/LevelSettings.java @@ -38,7 +38,7 @@ public final class LevelSettings { levelData.get("hardcore").asBoolean(false), (Difficulty)levelData.get("Difficulty").asNumber().map(number -> Difficulty.byId(number.byteValue())).result().orElse(Difficulty.NORMAL), levelData.get("allowCommands").asBoolean(gameType == GameType.CREATIVE), - new GameRules(levelData.get("GameRules")), + new GameRules(dataConfiguration.enabledFeatures(), levelData.get("GameRules")), dataConfiguration ); } @@ -84,6 +84,14 @@ public final class LevelSettings { } public LevelSettings copy() { - return new LevelSettings(this.levelName, this.gameType, this.hardcore, this.difficulty, this.allowCommands, this.gameRules.copy(), this.dataConfiguration); + return new LevelSettings( + this.levelName, + this.gameType, + this.hardcore, + this.difficulty, + this.allowCommands, + this.gameRules.copy(this.dataConfiguration.enabledFeatures()), + this.dataConfiguration + ); } } diff --git a/net/minecraft/world/level/NaturalSpawner.java b/net/minecraft/world/level/NaturalSpawner.java index 72559603..593864ba 100644 --- a/net/minecraft/world/level/NaturalSpawner.java +++ b/net/minecraft/world/level/NaturalSpawner.java @@ -4,6 +4,8 @@ import com.mojang.logging.LogUtils; import it.unimi.dsi.fastutil.objects.Object2IntMap; import it.unimi.dsi.fastutil.objects.Object2IntMaps; import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; +import java.util.ArrayList; +import java.util.List; import java.util.Objects; import java.util.Optional; import java.util.function.Consumer; @@ -20,17 +22,21 @@ import net.minecraft.tags.BlockTags; import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; import net.minecraft.util.VisibleForDebug; +import net.minecraft.util.profiling.Profiler; +import net.minecraft.util.profiling.ProfilerFiller; import net.minecraft.util.random.WeightedRandomList; import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.Mob; import net.minecraft.world.entity.MobCategory; -import net.minecraft.world.entity.MobSpawnType; import net.minecraft.world.entity.SpawnGroupData; import net.minecraft.world.entity.SpawnPlacements; import net.minecraft.world.entity.player.Player; import net.minecraft.world.level.biome.Biome; import net.minecraft.world.level.biome.MobSpawnSettings; +import net.minecraft.world.level.biome.MobSpawnSettings.MobSpawnCost; +import net.minecraft.world.level.biome.MobSpawnSettings.SpawnerData; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.chunk.ChunkAccess; @@ -70,7 +76,7 @@ public final class NaturalSpawner { if (mobCategory != MobCategory.MISC) { BlockPos blockPos = entity.blockPosition(); chunkGetter.query(ChunkPos.asLong(blockPos), levelChunk -> { - MobSpawnSettings.MobSpawnCost mobSpawnCost = getRoughBiome(blockPos, levelChunk).getMobSettings().getMobSpawnCost(entity.getType()); + MobSpawnCost mobSpawnCost = getRoughBiome(blockPos, levelChunk).getMobSettings().getMobSpawnCost(entity.getType()); if (mobSpawnCost != null) { potentialCalculator.addCharge(entity.blockPosition(), mobSpawnCost.charge()); } @@ -92,28 +98,39 @@ public final class NaturalSpawner { return chunk.getNoiseBiome(QuartPos.fromBlock(pos.getX()), QuartPos.fromBlock(pos.getY()), QuartPos.fromBlock(pos.getZ())).value(); } - public static void spawnForChunk( - ServerLevel level, LevelChunk chunk, NaturalSpawner.SpawnState spawnState, boolean spawnFriendlies, boolean spawnMonsters, boolean forcedDespawn - ) { - level.getProfiler().push("spawner"); + public static List getFilteredSpawningCategories(NaturalSpawner.SpawnState spawnState, boolean bl, boolean bl2, boolean bl3) { + List list = new ArrayList(SPAWNING_CATEGORIES.length); for (MobCategory mobCategory : SPAWNING_CATEGORIES) { - if ((spawnFriendlies || !mobCategory.isFriendly()) - && (spawnMonsters || mobCategory.isFriendly()) - && (forcedDespawn || !mobCategory.isPersistent()) - && spawnState.canSpawnForCategory(mobCategory, chunk.getPos())) { - spawnCategoryForChunk(mobCategory, level, chunk, spawnState::canSpawn, spawnState::afterSpawn); + if ((bl || !mobCategory.isFriendly()) + && (bl2 || mobCategory.isFriendly()) + && (bl3 || !mobCategory.isPersistent()) + && spawnState.canSpawnForCategoryGlobal(mobCategory)) { + list.add(mobCategory); } } - level.getProfiler().pop(); + return list; + } + + public static void spawnForChunk(ServerLevel serverLevel, LevelChunk levelChunk, NaturalSpawner.SpawnState spawnState, List list) { + ProfilerFiller profilerFiller = Profiler.get(); + profilerFiller.push("spawner"); + + for (MobCategory mobCategory : list) { + if (spawnState.canSpawnForCategoryLocal(mobCategory, levelChunk.getPos())) { + spawnCategoryForChunk(mobCategory, serverLevel, levelChunk, spawnState::canSpawn, spawnState::afterSpawn); + } + } + + profilerFiller.pop(); } public static void spawnCategoryForChunk( MobCategory category, ServerLevel level, LevelChunk chunk, NaturalSpawner.SpawnPredicate filter, NaturalSpawner.AfterSpawnCallback callback ) { BlockPos blockPos = getRandomPosWithin(level, chunk); - if (blockPos.getY() >= level.getMinBuildHeight() + 1) { + if (blockPos.getY() >= level.getMinY() + 1) { spawnCategoryForPosition(category, level, chunk, blockPos, filter, callback); } } @@ -138,7 +155,7 @@ public final class NaturalSpawner { int l = pos.getX(); int m = pos.getZ(); int n = 6; - MobSpawnSettings.SpawnerData spawnerData = null; + SpawnerData spawnerData = null; SpawnGroupData spawnGroupData = null; int o = Mth.ceil(level.random.nextFloat() * 4.0F); int p = 0; @@ -154,12 +171,12 @@ public final class NaturalSpawner { double f = player.distanceToSqr(d, i, e); if (isRightDistanceToPlayerAndSpawnPoint(level, chunk, mutableBlockPos, f)) { if (spawnerData == null) { - Optional optional = getRandomSpawnMobAt(level, structureManager, chunkGenerator, category, level.random, mutableBlockPos); + Optional optional = getRandomSpawnMobAt(level, structureManager, chunkGenerator, category, level.random, mutableBlockPos); if (optional.isEmpty()) { break; } - spawnerData = (MobSpawnSettings.SpawnerData)optional.get(); + spawnerData = (SpawnerData)optional.get(); o = spawnerData.minCount + level.random.nextInt(1 + spawnerData.maxCount - spawnerData.minCount); } @@ -172,7 +189,7 @@ public final class NaturalSpawner { mob.moveTo(d, i, e, level.random.nextFloat() * 360.0F, 0.0F); if (isValidPositionForMob(level, mob, f)) { - spawnGroupData = mob.finalizeSpawn(level, level.getCurrentDifficultyAt(mob.blockPosition()), MobSpawnType.NATURAL, spawnGroupData); + spawnGroupData = mob.finalizeSpawn(level, level.getCurrentDifficultyAt(mob.blockPosition()), EntitySpawnReason.NATURAL, spawnGroupData); j++; p++; level.addFreshEntityWithPassengers(mob); @@ -208,7 +225,7 @@ public final class NaturalSpawner { MobCategory category, StructureManager structureManager, ChunkGenerator generator, - MobSpawnSettings.SpawnerData data, + SpawnerData data, BlockPos.MutableBlockPos pos, double distance ) { @@ -222,7 +239,7 @@ public final class NaturalSpawner { } else if (!SpawnPlacements.isSpawnPositionOk(entityType, level, pos)) { return false; } else { - return !SpawnPlacements.checkSpawnRules(entityType, level, MobSpawnType.NATURAL, pos, level.random) + return !SpawnPlacements.checkSpawnRules(entityType, level, EntitySpawnReason.NATURAL, pos, level.random) ? false : level.noCollision(entityType.getSpawnAABB(pos.getX() + 0.5, pos.getY(), pos.getZ() + 0.5)); } @@ -231,7 +248,7 @@ public final class NaturalSpawner { @Nullable private static Mob getMobForSpawn(ServerLevel level, EntityType entityType) { try { - if (entityType.create(level) instanceof Mob mob) { + if (entityType.create(level, EntitySpawnReason.NATURAL) instanceof Mob mob) { return mob; } @@ -246,10 +263,10 @@ public final class NaturalSpawner { private static boolean isValidPositionForMob(ServerLevel level, Mob mob, double distance) { return distance > mob.getType().getCategory().getDespawnDistance() * mob.getType().getCategory().getDespawnDistance() && mob.removeWhenFarAway(distance) ? false - : mob.checkSpawnRules(level, MobSpawnType.NATURAL) && mob.checkSpawnObstruction(level); + : mob.checkSpawnRules(level, EntitySpawnReason.NATURAL) && mob.checkSpawnObstruction(level); } - private static Optional getRandomSpawnMobAt( + private static Optional getRandomSpawnMobAt( ServerLevel level, StructureManager structureManager, ChunkGenerator generator, MobCategory category, RandomSource random, BlockPos pos ) { Holder holder = level.getBiome(pos); @@ -259,12 +276,12 @@ public final class NaturalSpawner { } private static boolean canSpawnMobAt( - ServerLevel level, StructureManager structureManager, ChunkGenerator generator, MobCategory category, MobSpawnSettings.SpawnerData data, BlockPos pos + ServerLevel level, StructureManager structureManager, ChunkGenerator generator, MobCategory category, SpawnerData data, BlockPos pos ) { return mobsAt(level, structureManager, generator, category, pos, null).unwrap().contains(data); } - private static WeightedRandomList mobsAt( + private static WeightedRandomList mobsAt( ServerLevel level, StructureManager structureManager, ChunkGenerator generator, MobCategory category, BlockPos pos, @Nullable Holder biome ) { return isInNetherFortressBounds(pos, level, category, structureManager) @@ -274,7 +291,7 @@ public final class NaturalSpawner { public static boolean isInNetherFortressBounds(BlockPos pos, ServerLevel level, MobCategory category, StructureManager structureManager) { if (category == MobCategory.MONSTER && level.getBlockState(pos.below()).is(Blocks.NETHER_BRICKS)) { - Structure structure = structureManager.registryAccess().registryOrThrow(Registries.STRUCTURE).get(BuiltinStructures.FORTRESS); + Structure structure = structureManager.registryAccess().lookupOrThrow(Registries.STRUCTURE).getValue(BuiltinStructures.FORTRESS); return structure == null ? false : structureManager.getStructureAt(pos, structure).isValid(); } else { return false; @@ -286,7 +303,7 @@ public final class NaturalSpawner { int i = chunkPos.getMinBlockX() + level.random.nextInt(16); int j = chunkPos.getMinBlockZ() + level.random.nextInt(16); int k = chunk.getHeight(Heightmap.Types.WORLD_SURFACE, i, j) + 1; - int l = Mth.randomBetweenInclusive(level.random, level.getMinBuildHeight(), k); + int l = Mth.randomBetweenInclusive(level.random, level.getMinY(), k); return new BlockPos(i, l, j); } @@ -304,15 +321,15 @@ public final class NaturalSpawner { public static void spawnMobsForChunkGeneration(ServerLevelAccessor levelAccessor, Holder biome, ChunkPos chunkPos, RandomSource random) { MobSpawnSettings mobSpawnSettings = biome.value().getMobSettings(); - WeightedRandomList weightedRandomList = mobSpawnSettings.getMobs(MobCategory.CREATURE); + WeightedRandomList weightedRandomList = mobSpawnSettings.getMobs(MobCategory.CREATURE); if (!weightedRandomList.isEmpty()) { int i = chunkPos.getMinBlockX(); int j = chunkPos.getMinBlockZ(); while (random.nextFloat() < mobSpawnSettings.getCreatureProbability()) { - Optional optional = weightedRandomList.getRandom(random); + Optional optional = weightedRandomList.getRandom(random); if (!optional.isEmpty()) { - MobSpawnSettings.SpawnerData spawnerData = (MobSpawnSettings.SpawnerData)optional.get(); + SpawnerData spawnerData = (SpawnerData)optional.get(); int k = spawnerData.minCount + random.nextInt(1 + spawnerData.maxCount - spawnerData.minCount); SpawnGroupData spawnGroupData = null; int l = i + random.nextInt(16); @@ -331,14 +348,14 @@ public final class NaturalSpawner { double e = Mth.clamp((double)m, (double)j + f, j + 16.0 - f); if (!levelAccessor.noCollision(spawnerData.type.getSpawnAABB(d, blockPos.getY(), e)) || !SpawnPlacements.checkSpawnRules( - spawnerData.type, levelAccessor, MobSpawnType.CHUNK_GENERATION, BlockPos.containing(d, blockPos.getY(), e), levelAccessor.getRandom() + spawnerData.type, levelAccessor, EntitySpawnReason.CHUNK_GENERATION, BlockPos.containing(d, blockPos.getY(), e), levelAccessor.getRandom() )) { continue; } Entity entity; try { - entity = spawnerData.type.create(levelAccessor.getLevel()); + entity = spawnerData.type.create(levelAccessor.getLevel(), EntitySpawnReason.NATURAL); } catch (Exception var27) { LOGGER.warn("Failed to create mob", (Throwable)var27); continue; @@ -349,9 +366,9 @@ public final class NaturalSpawner { } entity.moveTo(d, blockPos.getY(), e, random.nextFloat() * 360.0F, 0.0F); - if (entity instanceof Mob mob && mob.checkSpawnRules(levelAccessor, MobSpawnType.CHUNK_GENERATION) && mob.checkSpawnObstruction(levelAccessor)) { + if (entity instanceof Mob mob && mob.checkSpawnRules(levelAccessor, EntitySpawnReason.CHUNK_GENERATION) && mob.checkSpawnObstruction(levelAccessor)) { spawnGroupData = mob.finalizeSpawn( - levelAccessor, levelAccessor.getCurrentDifficultyAt(mob.blockPosition()), MobSpawnType.CHUNK_GENERATION, spawnGroupData + levelAccessor, levelAccessor.getCurrentDifficultyAt(mob.blockPosition()), EntitySpawnReason.CHUNK_GENERATION, spawnGroupData ); levelAccessor.addFreshEntityWithPassengers(mob); bl = true; @@ -380,7 +397,7 @@ public final class NaturalSpawner { do { mutableBlockPos.move(Direction.DOWN); - } while (level.getBlockState(mutableBlockPos).isAir() && mutableBlockPos.getY() > level.getMinBuildHeight()); + } while (level.getBlockState(mutableBlockPos).isAir() && mutableBlockPos.getY() > level.getMinY()); } return SpawnPlacements.getPlacementType(entityType).adjustSpawnPosition(level, mutableBlockPos.immutable()); @@ -429,7 +446,7 @@ public final class NaturalSpawner { private boolean canSpawn(EntityType entityType, BlockPos pos, ChunkAccess chunk) { this.lastCheckedPos = pos; this.lastCheckedType = entityType; - MobSpawnSettings.MobSpawnCost mobSpawnCost = NaturalSpawner.getRoughBiome(pos, chunk).getMobSettings().getMobSpawnCost(entityType); + MobSpawnCost mobSpawnCost = NaturalSpawner.getRoughBiome(pos, chunk).getMobSettings().getMobSpawnCost(entityType); if (mobSpawnCost == null) { this.lastCharge = 0.0; return true; @@ -448,7 +465,7 @@ public final class NaturalSpawner { if (blockPos.equals(this.lastCheckedPos) && entityType == this.lastCheckedType) { d = this.lastCharge; } else { - MobSpawnSettings.MobSpawnCost mobSpawnCost = NaturalSpawner.getRoughBiome(blockPos, chunk).getMobSettings().getMobSpawnCost(entityType); + MobSpawnCost mobSpawnCost = NaturalSpawner.getRoughBiome(blockPos, chunk).getMobSettings().getMobSpawnCost(entityType); if (mobSpawnCost != null) { d = mobSpawnCost.charge(); } else { @@ -470,9 +487,13 @@ public final class NaturalSpawner { return this.unmodifiableMobCategoryCounts; } - boolean canSpawnForCategory(MobCategory category, ChunkPos pos) { - int i = category.getMaxInstancesPerChunk() * this.spawnableChunkCount / NaturalSpawner.MAGIC_NUMBER; - return this.mobCategoryCounts.getInt(category) >= i ? false : this.localMobCapCalculator.canSpawn(category, pos); + boolean canSpawnForCategoryGlobal(MobCategory mobCategory) { + int i = mobCategory.getMaxInstancesPerChunk() * this.spawnableChunkCount / NaturalSpawner.MAGIC_NUMBER; + return this.mobCategoryCounts.getInt(mobCategory) < i; + } + + boolean canSpawnForCategoryLocal(MobCategory mobCategory, ChunkPos chunkPos) { + return this.localMobCapCalculator.canSpawn(mobCategory, chunkPos); } } } diff --git a/net/minecraft/world/level/PathNavigationRegion.java b/net/minecraft/world/level/PathNavigationRegion.java index 6a7fd6d9..f19fd12c 100644 --- a/net/minecraft/world/level/PathNavigationRegion.java +++ b/net/minecraft/world/level/PathNavigationRegion.java @@ -7,7 +7,6 @@ import net.minecraft.core.BlockPos; import net.minecraft.core.Holder; import net.minecraft.core.SectionPos; import net.minecraft.core.registries.Registries; -import net.minecraft.util.profiling.ProfilerFiller; import net.minecraft.world.entity.Entity; import net.minecraft.world.level.biome.Biome; import net.minecraft.world.level.biome.Biomes; @@ -24,7 +23,7 @@ import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.shapes.VoxelShape; import org.jetbrains.annotations.Nullable; -public class PathNavigationRegion implements BlockGetter, CollisionGetter { +public class PathNavigationRegion implements CollisionGetter { protected final int centerX; protected final int centerZ; protected final ChunkAccess[][] chunks; @@ -34,7 +33,7 @@ public class PathNavigationRegion implements BlockGetter, CollisionGetter { public PathNavigationRegion(Level level, BlockPos centerPos, BlockPos offsetPos) { this.level = level; - this.plains = Suppliers.memoize(() -> level.registryAccess().registryOrThrow(Registries.BIOME).getHolderOrThrow(Biomes.PLAINS)); + this.plains = Suppliers.memoize(() -> level.registryAccess().lookupOrThrow(Registries.BIOME).getOrThrow(Biomes.PLAINS)); this.centerX = SectionPos.blockToSectionCoord(centerPos.getX()); this.centerZ = SectionPos.blockToSectionCoord(centerPos.getZ()); int i = SectionPos.blockToSectionCoord(offsetPos.getX()); @@ -118,16 +117,12 @@ public class PathNavigationRegion implements BlockGetter, CollisionGetter { } @Override - public int getMinBuildHeight() { - return this.level.getMinBuildHeight(); + public int getMinY() { + return this.level.getMinY(); } @Override public int getHeight() { return this.level.getHeight(); } - - public ProfilerFiller getProfiler() { - return this.level.getProfiler(); - } } diff --git a/net/minecraft/world/level/ScheduledTickAccess.java b/net/minecraft/world/level/ScheduledTickAccess.java new file mode 100644 index 00000000..d1affb63 --- /dev/null +++ b/net/minecraft/world/level/ScheduledTickAccess.java @@ -0,0 +1,34 @@ +package net.minecraft.world.level; + +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.material.Fluid; +import net.minecraft.world.ticks.LevelTickAccess; +import net.minecraft.world.ticks.ScheduledTick; +import net.minecraft.world.ticks.TickPriority; + +public interface ScheduledTickAccess { + ScheduledTick createTick(BlockPos blockPos, T object, int i, TickPriority tickPriority); + + ScheduledTick createTick(BlockPos blockPos, T object, int i); + + LevelTickAccess getBlockTicks(); + + default void scheduleTick(BlockPos blockPos, Block block, int i, TickPriority tickPriority) { + this.getBlockTicks().schedule(this.createTick(blockPos, block, i, tickPriority)); + } + + default void scheduleTick(BlockPos blockPos, Block block, int i) { + this.getBlockTicks().schedule(this.createTick(blockPos, block, i)); + } + + LevelTickAccess getFluidTicks(); + + default void scheduleTick(BlockPos blockPos, Fluid fluid, int i, TickPriority tickPriority) { + this.getFluidTicks().schedule(this.createTick(blockPos, fluid, i, tickPriority)); + } + + default void scheduleTick(BlockPos blockPos, Fluid fluid, int i) { + this.getFluidTicks().schedule(this.createTick(blockPos, fluid, i)); + } +} diff --git a/net/minecraft/world/level/ServerExplosion.java b/net/minecraft/world/level/ServerExplosion.java new file mode 100644 index 00000000..7fbbbf5a --- /dev/null +++ b/net/minecraft/world/level/ServerExplosion.java @@ -0,0 +1,336 @@ +package net.minecraft.world.level; + +import it.unimi.dsi.fastutil.objects.ObjectArrayList; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import net.minecraft.Util; +import net.minecraft.core.BlockPos; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.util.Mth; +import net.minecraft.util.profiling.Profiler; +import net.minecraft.util.profiling.ProfilerFiller; +import net.minecraft.world.damagesource.DamageSource; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.entity.item.ItemEntity; +import net.minecraft.world.entity.item.PrimedTnt; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.ClipContext.Block; +import net.minecraft.world.level.ClipContext.Fluid; +import net.minecraft.world.level.block.BaseFireBlock; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.level.material.FluidState; +import net.minecraft.world.phys.AABB; +import net.minecraft.world.phys.Vec3; +import net.minecraft.world.phys.HitResult.Type; +import org.jetbrains.annotations.Nullable; + +public class ServerExplosion implements Explosion { + private static final ExplosionDamageCalculator EXPLOSION_DAMAGE_CALCULATOR = new ExplosionDamageCalculator(); + private static final int MAX_DROPS_PER_COMBINED_STACK = 16; + private static final float LARGE_EXPLOSION_RADIUS = 2.0F; + private final boolean fire; + private final Explosion.BlockInteraction blockInteraction; + private final ServerLevel level; + private final Vec3 center; + @Nullable + private final Entity source; + private final float radius; + private final DamageSource damageSource; + private final ExplosionDamageCalculator damageCalculator; + private final Map hitPlayers = new HashMap(); + + public ServerExplosion( + ServerLevel serverLevel, + @Nullable Entity entity, + @Nullable DamageSource damageSource, + @Nullable ExplosionDamageCalculator explosionDamageCalculator, + Vec3 vec3, + float f, + boolean bl, + Explosion.BlockInteraction blockInteraction + ) { + this.level = serverLevel; + this.source = entity; + this.radius = f; + this.center = vec3; + this.fire = bl; + this.blockInteraction = blockInteraction; + this.damageSource = damageSource == null ? serverLevel.damageSources().explosion(this) : damageSource; + this.damageCalculator = explosionDamageCalculator == null ? this.makeDamageCalculator(entity) : explosionDamageCalculator; + } + + private ExplosionDamageCalculator makeDamageCalculator(@Nullable Entity entity) { + return (ExplosionDamageCalculator)(entity == null ? EXPLOSION_DAMAGE_CALCULATOR : new EntityBasedExplosionDamageCalculator(entity)); + } + + public static float getSeenPercent(Vec3 vec3, Entity entity) { + AABB aABB = entity.getBoundingBox(); + double d = 1.0 / ((aABB.maxX - aABB.minX) * 2.0 + 1.0); + double e = 1.0 / ((aABB.maxY - aABB.minY) * 2.0 + 1.0); + double f = 1.0 / ((aABB.maxZ - aABB.minZ) * 2.0 + 1.0); + double g = (1.0 - Math.floor(1.0 / d) * d) / 2.0; + double h = (1.0 - Math.floor(1.0 / f) * f) / 2.0; + if (!(d < 0.0) && !(e < 0.0) && !(f < 0.0)) { + int i = 0; + int j = 0; + + for (double k = 0.0; k <= 1.0; k += d) { + for (double l = 0.0; l <= 1.0; l += e) { + for (double m = 0.0; m <= 1.0; m += f) { + double n = Mth.lerp(k, aABB.minX, aABB.maxX); + double o = Mth.lerp(l, aABB.minY, aABB.maxY); + double p = Mth.lerp(m, aABB.minZ, aABB.maxZ); + Vec3 vec32 = new Vec3(n + g, o, p + h); + if (entity.level().clip(new ClipContext(vec32, vec3, Block.COLLIDER, Fluid.NONE, entity)).getType() == Type.MISS) { + i++; + } + + j++; + } + } + } + + return (float)i / j; + } else { + return 0.0F; + } + } + + @Override + public float radius() { + return this.radius; + } + + @Override + public Vec3 center() { + return this.center; + } + + private List calculateExplodedPositions() { + Set set = new HashSet(); + int i = 16; + + for (int j = 0; j < 16; j++) { + for (int k = 0; k < 16; k++) { + for (int l = 0; l < 16; l++) { + if (j == 0 || j == 15 || k == 0 || k == 15 || l == 0 || l == 15) { + double d = j / 15.0F * 2.0F - 1.0F; + double e = k / 15.0F * 2.0F - 1.0F; + double f = l / 15.0F * 2.0F - 1.0F; + double g = Math.sqrt(d * d + e * e + f * f); + d /= g; + e /= g; + f /= g; + float h = this.radius * (0.7F + this.level.random.nextFloat() * 0.6F); + double m = this.center.x; + double n = this.center.y; + double o = this.center.z; + + for (float p = 0.3F; h > 0.0F; h -= 0.22500001F) { + BlockPos blockPos = BlockPos.containing(m, n, o); + BlockState blockState = this.level.getBlockState(blockPos); + FluidState fluidState = this.level.getFluidState(blockPos); + if (!this.level.isInWorldBounds(blockPos)) { + break; + } + + Optional optional = this.damageCalculator.getBlockExplosionResistance(this, this.level, blockPos, blockState, fluidState); + if (optional.isPresent()) { + h -= (optional.get() + 0.3F) * 0.3F; + } + + if (h > 0.0F && this.damageCalculator.shouldBlockExplode(this, this.level, blockPos, blockState, h)) { + set.add(blockPos); + } + + m += d * 0.3F; + n += e * 0.3F; + o += f * 0.3F; + } + } + } + } + } + + return new ObjectArrayList<>(set); + } + + private void hurtEntities() { + float f = this.radius * 2.0F; + int i = Mth.floor(this.center.x - f - 1.0); + int j = Mth.floor(this.center.x + f + 1.0); + int k = Mth.floor(this.center.y - f - 1.0); + int l = Mth.floor(this.center.y + f + 1.0); + int m = Mth.floor(this.center.z - f - 1.0); + int n = Mth.floor(this.center.z + f + 1.0); + + for (Entity entity : this.level.getEntities(this.source, new AABB(i, k, m, j, l, n))) { + if (!entity.ignoreExplosion(this)) { + double d = Math.sqrt(entity.distanceToSqr(this.center)) / f; + if (d <= 1.0) { + double e = entity.getX() - this.center.x; + double g = (entity instanceof PrimedTnt ? entity.getY() : entity.getEyeY()) - this.center.y; + double h = entity.getZ() - this.center.z; + double o = Math.sqrt(e * e + g * g + h * h); + if (o != 0.0) { + e /= o; + g /= o; + h /= o; + boolean bl = this.damageCalculator.shouldDamageEntity(this, entity); + float p = this.damageCalculator.getKnockbackMultiplier(entity); + float q = !bl && p == 0.0F ? 0.0F : getSeenPercent(this.center, entity); + if (bl) { + entity.hurtServer(this.level, this.damageSource, this.damageCalculator.getEntityDamageAmount(this, entity, q)); + } + + double r = (1.0 - d) * q * p; + double s; + if (entity instanceof LivingEntity livingEntity) { + s = r * (1.0 - livingEntity.getAttributeValue(Attributes.EXPLOSION_KNOCKBACK_RESISTANCE)); + } else { + s = r; + } + + e *= s; + g *= s; + h *= s; + Vec3 vec3 = new Vec3(e, g, h); + entity.setDeltaMovement(entity.getDeltaMovement().add(vec3)); + if (entity instanceof Player player && !player.isSpectator() && (!player.isCreative() || !player.getAbilities().flying)) { + this.hitPlayers.put(player, vec3); + } + + entity.onExplosionHit(this.source); + } + } + } + } + } + + private void interactWithBlocks(List list) { + List list2 = new ArrayList(); + Util.shuffle(list, this.level.random); + + for (BlockPos blockPos : list) { + this.level.getBlockState(blockPos).onExplosionHit(this.level, blockPos, this, (itemStack, blockPosx) -> addOrAppendStack(list2, itemStack, blockPosx)); + } + + for (ServerExplosion.StackCollector stackCollector : list2) { + net.minecraft.world.level.block.Block.popResource(this.level, stackCollector.pos, stackCollector.stack); + } + } + + private void createFire(List list) { + for (BlockPos blockPos : list) { + if (this.level.random.nextInt(3) == 0 && this.level.getBlockState(blockPos).isAir() && this.level.getBlockState(blockPos.below()).isSolidRender()) { + this.level.setBlockAndUpdate(blockPos, BaseFireBlock.getState(this.level, blockPos)); + } + } + } + + public void explode() { + this.level.gameEvent(this.source, GameEvent.EXPLODE, this.center); + List list = this.calculateExplodedPositions(); + this.hurtEntities(); + if (this.interactsWithBlocks()) { + ProfilerFiller profilerFiller = Profiler.get(); + profilerFiller.push("explosion_blocks"); + this.interactWithBlocks(list); + profilerFiller.pop(); + } + + if (this.fire) { + this.createFire(list); + } + } + + private static void addOrAppendStack(List list, ItemStack itemStack, BlockPos blockPos) { + for (ServerExplosion.StackCollector stackCollector : list) { + stackCollector.tryMerge(itemStack); + if (itemStack.isEmpty()) { + return; + } + } + + list.add(new ServerExplosion.StackCollector(blockPos, itemStack)); + } + + private boolean interactsWithBlocks() { + return this.blockInteraction != Explosion.BlockInteraction.KEEP; + } + + public Map getHitPlayers() { + return this.hitPlayers; + } + + @Override + public ServerLevel level() { + return this.level; + } + + @Nullable + @Override + public LivingEntity getIndirectSourceEntity() { + return Explosion.getIndirectSourceEntity(this.source); + } + + @Nullable + @Override + public Entity getDirectSourceEntity() { + return this.source; + } + + @Override + public Explosion.BlockInteraction getBlockInteraction() { + return this.blockInteraction; + } + + @Override + public boolean canTriggerBlocks() { + if (this.blockInteraction != Explosion.BlockInteraction.TRIGGER_BLOCK) { + return false; + } else { + return this.source != null && this.source.getType() == EntityType.BREEZE_WIND_CHARGE + ? this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) + : true; + } + } + + @Override + public boolean shouldAffectBlocklikeEntities() { + boolean bl = this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING); + boolean bl2 = this.source == null || !this.source.isInWater(); + boolean bl3 = this.source == null || this.source.getType() != EntityType.BREEZE_WIND_CHARGE && this.source.getType() != EntityType.WIND_CHARGE; + return bl ? bl2 && bl3 : this.blockInteraction.shouldAffectBlocklikeEntities() && bl2 && bl3; + } + + public boolean isSmall() { + return this.radius < 2.0F || !this.interactsWithBlocks(); + } + + static class StackCollector { + final BlockPos pos; + ItemStack stack; + + StackCollector(BlockPos blockPos, ItemStack itemStack) { + this.pos = blockPos; + this.stack = itemStack; + } + + public void tryMerge(ItemStack itemStack) { + if (ItemEntity.areMergable(this.stack, itemStack)) { + this.stack = ItemEntity.merge(this.stack, itemStack, 16); + } + } + } +} diff --git a/net/minecraft/world/level/StructureManager.java b/net/minecraft/world/level/StructureManager.java index 5a609667..bdb6db5d 100644 --- a/net/minecraft/world/level/StructureManager.java +++ b/net/minecraft/world/level/StructureManager.java @@ -74,7 +74,7 @@ public class StructureManager { while (var4.hasNext()) { long l = (Long)var4.next(); - SectionPos sectionPos = SectionPos.of(new ChunkPos(l), this.level.getMinSection()); + SectionPos sectionPos = SectionPos.of(new ChunkPos(l), this.level.getMinSectionY()); StructureStart structureStart = this.getStartForStructure( sectionPos, structure, this.level.getChunk(sectionPos.x(), sectionPos.z(), ChunkStatus.STRUCTURE_STARTS) ); @@ -120,10 +120,10 @@ public class StructureManager { } public StructureStart getStructureWithPieceAt(BlockPos pos, Predicate> predicate) { - Registry registry = this.registryAccess().registryOrThrow(Registries.STRUCTURE); + Registry registry = this.registryAccess().lookupOrThrow(Registries.STRUCTURE); for (StructureStart structureStart : this.startsForStructure( - new ChunkPos(pos), structure -> (Boolean)registry.getHolder(registry.getId(structure)).map(predicate::test).orElse(false) + new ChunkPos(pos), structure -> (Boolean)registry.get(registry.getId(structure)).map(predicate::test).orElse(false) )) { if (this.structureHasPieceAt(pos, structureStart)) { return structureStart; diff --git a/net/minecraft/world/level/biome/Biome.java b/net/minecraft/world/level/biome/Biome.java index fbf2c9dd..a1b8401e 100644 --- a/net/minecraft/world/level/biome/Biome.java +++ b/net/minecraft/world/level/biome/Biome.java @@ -94,33 +94,34 @@ public final class Biome { return this.climateSettings.hasPrecipitation(); } - public Biome.Precipitation getPrecipitationAt(BlockPos pos) { + public Biome.Precipitation getPrecipitationAt(BlockPos blockPos, int i) { if (!this.hasPrecipitation()) { return Biome.Precipitation.NONE; } else { - return this.coldEnoughToSnow(pos) ? Biome.Precipitation.SNOW : Biome.Precipitation.RAIN; + return this.coldEnoughToSnow(blockPos, i) ? Biome.Precipitation.SNOW : Biome.Precipitation.RAIN; } } - private float getHeightAdjustedTemperature(BlockPos pos) { - float f = this.climateSettings.temperatureModifier.modifyTemperature(pos, this.getBaseTemperature()); - if (pos.getY() > 80) { - float g = (float)(TEMPERATURE_NOISE.getValue(pos.getX() / 8.0F, pos.getZ() / 8.0F, false) * 8.0); - return f - (g + pos.getY() - 80.0F) * 0.05F / 40.0F; + private float getHeightAdjustedTemperature(BlockPos blockPos, int i) { + float f = this.climateSettings.temperatureModifier.modifyTemperature(blockPos, this.getBaseTemperature()); + int j = i + 17; + if (blockPos.getY() > j) { + float g = (float)(TEMPERATURE_NOISE.getValue(blockPos.getX() / 8.0F, blockPos.getZ() / 8.0F, false) * 8.0); + return f - (g + blockPos.getY() - j) * 0.05F / 40.0F; } else { return f; } } @Deprecated - private float getTemperature(BlockPos pos) { - long l = pos.asLong(); + private float getTemperature(BlockPos blockPos, int i) { + long l = blockPos.asLong(); Long2FloatLinkedOpenHashMap long2FloatLinkedOpenHashMap = (Long2FloatLinkedOpenHashMap)this.temperatureCache.get(); float f = long2FloatLinkedOpenHashMap.get(l); if (!Float.isNaN(f)) { return f; } else { - float g = this.getHeightAdjustedTemperature(pos); + float g = this.getHeightAdjustedTemperature(blockPos, i); if (long2FloatLinkedOpenHashMap.size() == 1024) { long2FloatLinkedOpenHashMap.removeFirstFloat(); } @@ -135,10 +136,10 @@ public final class Biome { } public boolean shouldFreeze(LevelReader level, BlockPos water, boolean mustBeAtEdge) { - if (this.warmEnoughToRain(water)) { + if (this.warmEnoughToRain(water, level.getSeaLevel())) { return false; } else { - if (water.getY() >= level.getMinBuildHeight() && water.getY() < level.getMaxBuildHeight() && level.getBrightness(LightLayer.BLOCK, water) < 10) { + if (level.isInsideBuildHeight(water.getY()) && level.getBrightness(LightLayer.BLOCK, water) < 10) { BlockState blockState = level.getBlockState(water); FluidState fluidState = level.getFluidState(water); if (fluidState.getType() == Fluids.WATER && blockState.getBlock() instanceof LiquidBlock) { @@ -157,23 +158,23 @@ public final class Biome { } } - public boolean coldEnoughToSnow(BlockPos pos) { - return !this.warmEnoughToRain(pos); + public boolean coldEnoughToSnow(BlockPos blockPos, int i) { + return !this.warmEnoughToRain(blockPos, i); } - public boolean warmEnoughToRain(BlockPos pos) { - return this.getTemperature(pos) >= 0.15F; + public boolean warmEnoughToRain(BlockPos blockPos, int i) { + return this.getTemperature(blockPos, i) >= 0.15F; } - public boolean shouldMeltFrozenOceanIcebergSlightly(BlockPos pos) { - return this.getTemperature(pos) > 0.1F; + public boolean shouldMeltFrozenOceanIcebergSlightly(BlockPos blockPos, int i) { + return this.getTemperature(blockPos, i) > 0.1F; } public boolean shouldSnow(LevelReader level, BlockPos pos) { - if (this.warmEnoughToRain(pos)) { + if (this.warmEnoughToRain(pos, level.getSeaLevel())) { return false; } else { - if (pos.getY() >= level.getMinBuildHeight() && pos.getY() < level.getMaxBuildHeight() && level.getBrightness(LightLayer.BLOCK, pos) < 10) { + if (level.isInsideBuildHeight(pos.getY()) && level.getBrightness(LightLayer.BLOCK, pos) < 10) { BlockState blockState = level.getBlockState(pos); if ((blockState.isAir() || blockState.is(Blocks.SNOW)) && Blocks.SNOW.defaultBlockState().canSurvive(level, pos)) { return true; @@ -363,28 +364,8 @@ public final class Biome { } public static enum TemperatureModifier implements StringRepresentable { - NONE("none") { - @Override - public float modifyTemperature(BlockPos pos, float temperature) { - return temperature; - } - }, - FROZEN("frozen") { - @Override - public float modifyTemperature(BlockPos pos, float temperature) { - double d = Biome.FROZEN_TEMPERATURE_NOISE.getValue(pos.getX() * 0.05, pos.getZ() * 0.05, false) * 7.0; - double e = Biome.BIOME_INFO_NOISE.getValue(pos.getX() * 0.2, pos.getZ() * 0.2, false); - double f = d + e; - if (f < 0.3) { - double g = Biome.BIOME_INFO_NOISE.getValue(pos.getX() * 0.09, pos.getZ() * 0.09, false); - if (g < 0.8) { - return 0.2F; - } - } - - return temperature; - } - }; + NONE("NONE", 0, "none"), + FROZEN("FROZEN", 1, "frozen"); private final String name; public static final Codec CODEC = StringRepresentable.fromEnum(Biome.TemperatureModifier::values); diff --git a/net/minecraft/world/level/biome/BiomeGenerationSettings.java b/net/minecraft/world/level/biome/BiomeGenerationSettings.java index af41f29e..89b37d4e 100644 --- a/net/minecraft/world/level/biome/BiomeGenerationSettings.java +++ b/net/minecraft/world/level/biome/BiomeGenerationSettings.java @@ -2,18 +2,13 @@ package net.minecraft.world.level.biome; import com.google.common.base.Suppliers; import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableMap; import com.google.common.collect.Lists; -import com.google.common.collect.Maps; import com.mojang.logging.LogUtils; -import com.mojang.serialization.Codec; import com.mojang.serialization.MapCodec; import com.mojang.serialization.codecs.RecordCodecBuilder; +import java.util.ArrayList; import java.util.List; -import java.util.Map; -import java.util.Objects; import java.util.Set; -import java.util.Map.Entry; import java.util.function.Supplier; import java.util.stream.Collectors; import net.minecraft.Util; @@ -21,7 +16,6 @@ import net.minecraft.core.Holder; import net.minecraft.core.HolderGetter; import net.minecraft.core.HolderSet; import net.minecraft.resources.ResourceKey; -import net.minecraft.util.StringRepresentable; import net.minecraft.world.level.levelgen.GenerationStep; import net.minecraft.world.level.levelgen.carver.ConfiguredWorldCarver; import net.minecraft.world.level.levelgen.feature.ConfiguredFeature; @@ -31,14 +25,11 @@ import org.slf4j.Logger; public class BiomeGenerationSettings { private static final Logger LOGGER = LogUtils.getLogger(); - public static final BiomeGenerationSettings EMPTY = new BiomeGenerationSettings(ImmutableMap.of(), ImmutableList.of()); + public static final BiomeGenerationSettings EMPTY = new BiomeGenerationSettings(HolderSet.direct(), List.of()); public static final MapCodec CODEC = RecordCodecBuilder.mapCodec( instance -> instance.group( - Codec.simpleMap( - GenerationStep.Carving.CODEC, - ConfiguredWorldCarver.LIST_CODEC.promotePartial(Util.prefix("Carver: ", LOGGER::error)), - StringRepresentable.keys(GenerationStep.Carving.values()) - ) + ConfiguredWorldCarver.LIST_CODEC + .promotePartial(Util.prefix("Carver: ", LOGGER::error)) .fieldOf("carvers") .forGetter(biomeGenerationSettings -> biomeGenerationSettings.carvers), PlacedFeature.LIST_OF_LISTS_CODEC @@ -48,27 +39,27 @@ public class BiomeGenerationSettings { ) .apply(instance, BiomeGenerationSettings::new) ); - private final Map>> carvers; + private final HolderSet> carvers; private final List> features; private final Supplier>> flowerFeatures; private final Supplier> featureSet; - BiomeGenerationSettings(Map>> carvers, List> features) { - this.carvers = carvers; - this.features = features; + BiomeGenerationSettings(HolderSet> holderSet, List> list) { + this.carvers = holderSet; + this.features = list; this.flowerFeatures = Suppliers.memoize( - () -> (List>)features.stream() + () -> (List>)list.stream() .flatMap(HolderSet::stream) .map(Holder::value) .flatMap(PlacedFeature::getFeatures) .filter(configuredFeature -> configuredFeature.feature() == Feature.FLOWER) .collect(ImmutableList.toImmutableList()) ); - this.featureSet = Suppliers.memoize(() -> (Set)features.stream().flatMap(HolderSet::stream).map(Holder::value).collect(Collectors.toSet())); + this.featureSet = Suppliers.memoize(() -> (Set)list.stream().flatMap(HolderSet::stream).map(Holder::value).collect(Collectors.toSet())); } - public Iterable>> getCarvers(GenerationStep.Carving step) { - return (Iterable>>)Objects.requireNonNullElseGet((Iterable)this.carvers.get(step), List::of); + public Iterable>> getCarvers() { + return this.carvers; } public List> getFlowerFeatures() { @@ -97,15 +88,15 @@ public class BiomeGenerationSettings { return this; } - public BiomeGenerationSettings.Builder addCarver(GenerationStep.Carving carving, ResourceKey> carver) { - this.addCarver(carving, this.worldCarvers.getOrThrow(carver)); + public BiomeGenerationSettings.Builder addCarver(ResourceKey> resourceKey) { + this.addCarver(this.worldCarvers.getOrThrow(resourceKey)); return this; } } public static class PlainBuilder { - private final Map>>> carvers = Maps.>>>newLinkedHashMap(); - private final List>> features = Lists.>>newArrayList(); + private final List>> carvers = new ArrayList(); + private final List>> features = new ArrayList(); public BiomeGenerationSettings.PlainBuilder addFeature(GenerationStep.Decoration decoration, Holder feature) { return this.addFeature(decoration.ordinal(), feature); @@ -117,8 +108,8 @@ public class BiomeGenerationSettings { return this; } - public BiomeGenerationSettings.PlainBuilder addCarver(GenerationStep.Carving carving, Holder> carver) { - ((List)this.carvers.computeIfAbsent(carving, carvingx -> Lists.newArrayList())).add(carver); + public BiomeGenerationSettings.PlainBuilder addCarver(Holder> holder) { + this.carvers.add(holder); return this; } @@ -130,11 +121,7 @@ public class BiomeGenerationSettings { public BiomeGenerationSettings build() { return new BiomeGenerationSettings( - (Map>>)this.carvers - .entrySet() - .stream() - .collect(ImmutableMap.toImmutableMap(Entry::getKey, entry -> HolderSet.direct((List)entry.getValue()))), - (List>)this.features.stream().map(HolderSet::direct).collect(ImmutableList.toImmutableList()) + HolderSet.direct(this.carvers), (List>)this.features.stream().map(HolderSet::direct).collect(ImmutableList.toImmutableList()) ); } } diff --git a/net/minecraft/world/level/biome/BiomeSource.java b/net/minecraft/world/level/biome/BiomeSource.java index f384cc20..040487be 100644 --- a/net/minecraft/world/level/biome/BiomeSource.java +++ b/net/minecraft/world/level/biome/BiomeSource.java @@ -83,7 +83,7 @@ public abstract class BiomeSource implements BiomeResolver { return null; } else { int i = Math.floorDiv(radius, horizontalStep); - int[] is = Mth.outFromOrigin(pos.getY(), level.getMinBuildHeight() + 1, level.getMaxBuildHeight(), verticalStep).toArray(); + int[] is = Mth.outFromOrigin(pos.getY(), level.getMinY() + 1, level.getMaxY() + 1, verticalStep).toArray(); for (BlockPos.MutableBlockPos mutableBlockPos : BlockPos.spiralAround(BlockPos.ZERO, i, Direction.EAST, Direction.SOUTH)) { int j = pos.getX() + mutableBlockPos.getX() * horizontalStep; diff --git a/net/minecraft/world/level/biome/BiomeSpecialEffects.java b/net/minecraft/world/level/biome/BiomeSpecialEffects.java index 3fb621c4..fb62f5bd 100644 --- a/net/minecraft/world/level/biome/BiomeSpecialEffects.java +++ b/net/minecraft/world/level/biome/BiomeSpecialEffects.java @@ -212,25 +212,9 @@ public class BiomeSpecialEffects { } public static enum GrassColorModifier implements StringRepresentable { - NONE("none") { - @Override - public int modifyColor(double x, double z, int grassColor) { - return grassColor; - } - }, - DARK_FOREST("dark_forest") { - @Override - public int modifyColor(double x, double z, int grassColor) { - return (grassColor & 16711422) + 2634762 >> 1; - } - }, - SWAMP("swamp") { - @Override - public int modifyColor(double x, double z, int grassColor) { - double d = Biome.BIOME_INFO_NOISE.getValue(x * 0.0225, z * 0.0225, false); - return d < -0.1 ? 5011004 : 6975545; - } - }; + NONE("NONE", 0, "none"), + DARK_FOREST("DARK_FOREST", 1, "dark_forest"), + SWAMP("SWAMP", 2, "swamp"); private final String name; public static final Codec CODEC = StringRepresentable.fromEnum(BiomeSpecialEffects.GrassColorModifier::values); diff --git a/net/minecraft/world/level/biome/Climate.java b/net/minecraft/world/level/biome/Climate.java index 79c6c440..35cf519f 100644 --- a/net/minecraft/world/level/biome/Climate.java +++ b/net/minecraft/world/level/biome/Climate.java @@ -19,8 +19,13 @@ import net.minecraft.core.BlockPos; import net.minecraft.core.QuartPos; import net.minecraft.util.ExtraCodecs; import net.minecraft.util.Mth; +import net.minecraft.world.level.biome.Climate.RTree.Leaf; +import net.minecraft.world.level.biome.Climate.RTree.Node; +import net.minecraft.world.level.biome.Climate.RTree.SubTree; +import net.minecraft.world.level.biome.Climate.SpawnFinder.Result; import net.minecraft.world.level.levelgen.DensityFunction; import net.minecraft.world.level.levelgen.DensityFunctions; +import net.minecraft.world.level.levelgen.DensityFunction.SinglePointContext; import org.jetbrains.annotations.Nullable; public class Climate { @@ -79,7 +84,7 @@ public class Climate { } interface DistanceMetric { - long distance(Climate.RTree.Node node, long[] ls); + long distance(Node node, long[] ls); } public record Parameter(long min, long max) { @@ -183,7 +188,7 @@ public class Climate { } public T findValueIndex(Climate.TargetPoint targetPoint) { - return this.findValueIndex(targetPoint, Climate.RTree.Node::distance); + return this.findValueIndex(targetPoint, Node::distance); } protected T findValueIndex(Climate.TargetPoint targetPoint, Climate.DistanceMetric distanceMetric) { @@ -232,10 +237,10 @@ public class Climate { protected static final class RTree { private static final int CHILDREN_PER_NODE = 6; - private final Climate.RTree.Node root; - private final ThreadLocal> lastResult = new ThreadLocal(); + private final Node root; + private final ThreadLocal> lastResult = new ThreadLocal(); - private RTree(Climate.RTree.Node root) { + private RTree(Node root) { this.root = root; } @@ -247,19 +252,19 @@ public class Climate { if (i != 7) { throw new IllegalStateException("Expecting parameter space to be 7, got " + i); } else { - List> list = (List>)nodes.stream() - .map(pair -> new Climate.RTree.Leaf<>((Climate.ParameterPoint)pair.getFirst(), pair.getSecond())) + List> list = (List>)nodes.stream() + .map(pair -> new Leaf((Climate.ParameterPoint)pair.getFirst(), pair.getSecond())) .collect(Collectors.toCollection(ArrayList::new)); return new Climate.RTree<>(build(i, list)); } } } - private static Climate.RTree.Node build(int paramSpaceSize, List> children) { + private static Node build(int paramSpaceSize, List> children) { if (children.isEmpty()) { throw new IllegalStateException("Need at least one child to build a node"); } else if (children.size() == 1) { - return (Climate.RTree.Node)children.get(0); + return (Node)children.get(0); } else if (children.size() <= 6) { children.sort(Comparator.comparingLong(node -> { long lx = 0L; @@ -271,18 +276,18 @@ public class Climate { return lx; })); - return new Climate.RTree.SubTree<>(children); + return new SubTree(children); } else { long l = Long.MAX_VALUE; int i = -1; - List> list = null; + List> list = null; for (int j = 0; j < paramSpaceSize; j++) { sort(children, paramSpaceSize, j, false); - List> list2 = bucketize(children); + List> list2 = bucketize(children); long m = 0L; - for (Climate.RTree.SubTree subTree : list2) { + for (SubTree subTree : list2) { m += cost(subTree.parameterSpace); } @@ -294,14 +299,12 @@ public class Climate { } sort(list, paramSpaceSize, i, true); - return new Climate.RTree.SubTree<>( - (List>)list.stream().map(subTreex -> build(paramSpaceSize, Arrays.asList(subTreex.children))).collect(Collectors.toList()) - ); + return new SubTree((List)list.stream().map(subTreex -> build(paramSpaceSize, Arrays.asList(subTreex.children))).collect(Collectors.toList())); } } - private static void sort(List> children, int paramSpaceSize, int size, boolean absolute) { - Comparator> comparator = comparator(size, absolute); + private static void sort(List> children, int paramSpaceSize, int size, boolean absolute) { + Comparator> comparator = comparator(size, absolute); for (int i = 1; i < paramSpaceSize; i++) { comparator = comparator.thenComparing(comparator((size + i) % paramSpaceSize, absolute)); @@ -310,7 +313,7 @@ public class Climate { children.sort(comparator); } - private static Comparator> comparator(int size, boolean absolute) { + private static Comparator> comparator(int size, boolean absolute) { return Comparator.comparingLong(node -> { Climate.Parameter parameter = node.parameterSpace[size]; long l = (parameter.min() + parameter.max()) / 2L; @@ -318,21 +321,21 @@ public class Climate { }); } - private static List> bucketize(List> nodes) { - List> list = Lists.>newArrayList(); - List> list2 = Lists.>newArrayList(); + private static List> bucketize(List> nodes) { + List> list = Lists.>newArrayList(); + List> list2 = Lists.>newArrayList(); int i = (int)Math.pow(6.0, Math.floor(Math.log(nodes.size() - 0.01) / Math.log(6.0))); - for (Climate.RTree.Node node : nodes) { + for (Node node : nodes) { list2.add(node); if (list2.size() >= i) { - list.add(new Climate.RTree.SubTree(list2)); - list2 = Lists.>newArrayList(); + list.add(new SubTree(list2)); + list2 = Lists.>newArrayList(); } } if (!list2.isEmpty()) { - list.add(new Climate.RTree.SubTree(list2)); + list.add(new SubTree(list2)); } return list; @@ -348,7 +351,7 @@ public class Climate { return l; } - static List buildParameterSpace(List> children) { + static List buildParameterSpace(List> children) { if (children.isEmpty()) { throw new IllegalArgumentException("SubTree needs at least one child"); } else { @@ -359,7 +362,7 @@ public class Climate { list.add(null); } - for (Climate.RTree.Node node : children) { + for (Node node : children) { for (int k = 0; k < 7; k++) { list.set(k, node.parameterSpace[k].span((Climate.Parameter)list.get(k))); } @@ -371,80 +374,9 @@ public class Climate { public T search(Climate.TargetPoint targetPoint, Climate.DistanceMetric distanceMetric) { long[] ls = targetPoint.toParameterArray(); - Climate.RTree.Leaf leaf = this.root.search(ls, (Climate.RTree.Leaf)this.lastResult.get(), distanceMetric); + Leaf leaf = this.root.search(ls, (Leaf)this.lastResult.get(), distanceMetric); this.lastResult.set(leaf); - return leaf.value; - } - - static final class Leaf extends Climate.RTree.Node { - final T value; - - Leaf(Climate.ParameterPoint point, T value) { - super(point.parameterSpace()); - this.value = value; - } - - @Override - protected Climate.RTree.Leaf search(long[] searchedValues, @Nullable Climate.RTree.Leaf leaf, Climate.DistanceMetric metric) { - return this; - } - } - - abstract static class Node { - protected final Climate.Parameter[] parameterSpace; - - protected Node(List parameters) { - this.parameterSpace = (Climate.Parameter[])parameters.toArray(new Climate.Parameter[0]); - } - - protected abstract Climate.RTree.Leaf search(long[] searchedValues, @Nullable Climate.RTree.Leaf leaf, Climate.DistanceMetric metric); - - protected long distance(long[] values) { - long l = 0L; - - for (int i = 0; i < 7; i++) { - l += Mth.square(this.parameterSpace[i].distance(values[i])); - } - - return l; - } - - public String toString() { - return Arrays.toString(this.parameterSpace); - } - } - - static final class SubTree extends Climate.RTree.Node { - final Climate.RTree.Node[] children; - - protected SubTree(List> parameters) { - this(Climate.RTree.buildParameterSpace(parameters), parameters); - } - - protected SubTree(List parameters, List> children) { - super(parameters); - this.children = (Climate.RTree.Node[])children.toArray(new Climate.RTree.Node[0]); - } - - @Override - protected Climate.RTree.Leaf search(long[] searchedValues, @Nullable Climate.RTree.Leaf leaf, Climate.DistanceMetric metric) { - long l = leaf == null ? Long.MAX_VALUE : metric.distance(leaf, searchedValues); - Climate.RTree.Leaf leaf2 = leaf; - - for (Climate.RTree.Node node : this.children) { - long m = metric.distance(node, searchedValues); - if (l > m) { - Climate.RTree.Leaf leaf3 = node.search(searchedValues, leaf2, metric); - long n = node == leaf3 ? m : metric.distance(leaf3, searchedValues); - if (l > n) { - l = n; - leaf2 = leaf3; - } - } - } - - return leaf2; - } + return (T)leaf.value; } } @@ -461,7 +393,7 @@ public class Climate { int i = QuartPos.toBlock(x); int j = QuartPos.toBlock(y); int k = QuartPos.toBlock(z); - DensityFunction.SinglePointContext singlePointContext = new DensityFunction.SinglePointContext(i, j, k); + SinglePointContext singlePointContext = new SinglePointContext(i, j, k); return Climate.target( (float)this.temperature.compute(singlePointContext), (float)this.humidity.compute(singlePointContext), @@ -478,7 +410,8 @@ public class Climate { } static class SpawnFinder { - Climate.SpawnFinder.Result result; + private static final long MAX_RADIUS = 2048L; + Result result; SpawnFinder(List points, Climate.Sampler sampler) { this.result = getSpawnPositionAndFitness(points, sampler, 0, 0); @@ -494,7 +427,7 @@ public class Climate { while (g <= max) { int i = blockPos.getX() + (int)(Math.sin(f) * g); int j = blockPos.getZ() + (int)(Math.cos(f) * g); - Climate.SpawnFinder.Result result = getSpawnPositionAndFitness(point, sampler, i, j); + Result result = getSpawnPositionAndFitness(point, sampler, i, j); if (result.fitness() < this.result.fitness()) { this.result = result; } @@ -507,24 +440,20 @@ public class Climate { } } - private static Climate.SpawnFinder.Result getSpawnPositionAndFitness(List points, Climate.Sampler sampler, int x, int z) { - double d = Mth.square(2500.0); - int i = 2; - long l = (long)(Mth.square(10000.0F) * Math.pow((Mth.square((long)x) + Mth.square((long)z)) / d, 2.0)); + private static Result getSpawnPositionAndFitness(List points, Climate.Sampler sampler, int x, int z) { Climate.TargetPoint targetPoint = sampler.sample(QuartPos.fromBlock(x), 0, QuartPos.fromBlock(z)); Climate.TargetPoint targetPoint2 = new Climate.TargetPoint( targetPoint.temperature(), targetPoint.humidity(), targetPoint.continentalness(), targetPoint.erosion(), 0L, targetPoint.weirdness() ); - long m = Long.MAX_VALUE; + long l = Long.MAX_VALUE; for (Climate.ParameterPoint parameterPoint : points) { - m = Math.min(m, parameterPoint.fitness(targetPoint2)); + l = Math.min(l, parameterPoint.fitness(targetPoint2)); } - return new Climate.SpawnFinder.Result(new BlockPos(x, 0, z), l + m); - } - - record Result(BlockPos location, long fitness) { + long m = Mth.square((long)x) + Mth.square((long)z); + long n = l * Mth.square(2048L) + m; + return new Result(new BlockPos(x, 0, z), n); } } diff --git a/net/minecraft/world/level/biome/FixedBiomeSource.java b/net/minecraft/world/level/biome/FixedBiomeSource.java index 42f50fda..07da7c8b 100644 --- a/net/minecraft/world/level/biome/FixedBiomeSource.java +++ b/net/minecraft/world/level/biome/FixedBiomeSource.java @@ -10,9 +10,10 @@ import net.minecraft.core.BlockPos; import net.minecraft.core.Holder; import net.minecraft.util.RandomSource; import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.biome.BiomeManager.NoiseBiomeSource; import org.jetbrains.annotations.Nullable; -public class FixedBiomeSource extends BiomeSource implements BiomeManager.NoiseBiomeSource { +public class FixedBiomeSource extends BiomeSource implements NoiseBiomeSource { public static final MapCodec CODEC = Biome.CODEC .fieldOf("biome") .xmap(FixedBiomeSource::new, fixedBiomeSource -> fixedBiomeSource.biome) diff --git a/net/minecraft/world/level/biome/MultiNoiseBiomeSourceParameterList.java b/net/minecraft/world/level/biome/MultiNoiseBiomeSourceParameterList.java index fe90ea95..a8db3e40 100644 --- a/net/minecraft/world/level/biome/MultiNoiseBiomeSourceParameterList.java +++ b/net/minecraft/world/level/biome/MultiNoiseBiomeSourceParameterList.java @@ -6,7 +6,6 @@ import com.mojang.datafixers.util.Pair; import com.mojang.serialization.Codec; import com.mojang.serialization.DataResult; import com.mojang.serialization.codecs.RecordCodecBuilder; -import java.util.List; import java.util.Map; import java.util.Optional; import java.util.function.Function; @@ -19,6 +18,10 @@ import net.minecraft.resources.RegistryFileCodec; import net.minecraft.resources.RegistryOps; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.level.biome.MultiNoiseBiomeSourceParameterList.Preset.1; +import net.minecraft.world.level.biome.MultiNoiseBiomeSourceParameterList.Preset.2; +import net.minecraft.world.level.biome.MultiNoiseBiomeSourceParameterList.Preset.3; +import net.minecraft.world.level.biome.MultiNoiseBiomeSourceParameterList.Preset.SourceProvider; public class MultiNoiseBiomeSourceParameterList { public static final Codec DIRECT_CODEC = RecordCodecBuilder.create( @@ -52,34 +55,18 @@ public class MultiNoiseBiomeSourceParameterList { .collect(Collectors.toMap(preset -> preset, preset -> preset.provider().apply(resourceKey -> resourceKey))); } - public record Preset(ResourceLocation id, MultiNoiseBiomeSourceParameterList.Preset.SourceProvider provider) { + public record Preset(ResourceLocation id, SourceProvider provider) { public static final MultiNoiseBiomeSourceParameterList.Preset NETHER = new MultiNoiseBiomeSourceParameterList.Preset( - ResourceLocation.withDefaultNamespace("nether"), - new MultiNoiseBiomeSourceParameterList.Preset.SourceProvider() { - @Override - public Climate.ParameterList apply(Function, T> function) { - return new Climate.ParameterList<>( - List.of( - Pair.of(Climate.parameters(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F), function.apply(Biomes.NETHER_WASTES)), - Pair.of(Climate.parameters(0.0F, -0.5F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F), function.apply(Biomes.SOUL_SAND_VALLEY)), - Pair.of(Climate.parameters(0.4F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F), function.apply(Biomes.CRIMSON_FOREST)), - Pair.of(Climate.parameters(0.0F, 0.5F, 0.0F, 0.0F, 0.0F, 0.0F, 0.375F), function.apply(Biomes.WARPED_FOREST)), - Pair.of(Climate.parameters(-0.5F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.175F), function.apply(Biomes.BASALT_DELTAS)) - ) - ); - } - } + ResourceLocation.withDefaultNamespace("nether"), new 1() ); public static final MultiNoiseBiomeSourceParameterList.Preset OVERWORLD = new MultiNoiseBiomeSourceParameterList.Preset( - ResourceLocation.withDefaultNamespace("overworld"), new MultiNoiseBiomeSourceParameterList.Preset.SourceProvider() { - @Override - public Climate.ParameterList apply(Function, T> function) { - return MultiNoiseBiomeSourceParameterList.Preset.generateOverworldBiomes(function); - } - } + ResourceLocation.withDefaultNamespace("overworld"), new 2() + ); + public static final MultiNoiseBiomeSourceParameterList.Preset OVERWORLD_WINTER_DROP = new MultiNoiseBiomeSourceParameterList.Preset( + ResourceLocation.withDefaultNamespace("overworld_winter_drop"), new 3() ); static final Map BY_NAME = (Map)Stream.of( - NETHER, OVERWORLD + NETHER, OVERWORLD, OVERWORLD_WINTER_DROP ) .collect(Collectors.toMap(MultiNoiseBiomeSourceParameterList.Preset::id, preset -> preset)); public static final Codec CODEC = ResourceLocation.CODEC @@ -90,19 +77,14 @@ public class MultiNoiseBiomeSourceParameterList { preset -> DataResult.success(preset.id) ); - static Climate.ParameterList generateOverworldBiomes(Function, T> valueGetter) { + static Climate.ParameterList generateOverworldBiomes(Function, T> function, OverworldBiomeBuilder.Modifier modifier) { Builder> builder = ImmutableList.builder(); - new OverworldBiomeBuilder().addBiomes(pair -> builder.add(pair.mapSecond(valueGetter))); + new OverworldBiomeBuilder(modifier).addBiomes(pair -> builder.add(pair.mapSecond(function))); return new Climate.ParameterList<>(builder.build()); } public Stream> usedBiomes() { return this.provider.apply(resourceKey -> resourceKey).values().stream().map(Pair::getSecond).distinct(); } - - @FunctionalInterface - interface SourceProvider { - Climate.ParameterList apply(Function, T> function); - } } } diff --git a/net/minecraft/world/level/biome/MultiNoiseBiomeSourceParameterLists.java b/net/minecraft/world/level/biome/MultiNoiseBiomeSourceParameterLists.java index a3128ff6..3fd1f635 100644 --- a/net/minecraft/world/level/biome/MultiNoiseBiomeSourceParameterLists.java +++ b/net/minecraft/world/level/biome/MultiNoiseBiomeSourceParameterLists.java @@ -16,6 +16,11 @@ public class MultiNoiseBiomeSourceParameterLists { context.register(OVERWORLD, new MultiNoiseBiomeSourceParameterList(MultiNoiseBiomeSourceParameterList.Preset.OVERWORLD, holderGetter)); } + public static void winterDrop(BootstrapContext bootstrapContext) { + HolderGetter holderGetter = bootstrapContext.lookup(Registries.BIOME); + bootstrapContext.register(OVERWORLD, new MultiNoiseBiomeSourceParameterList(MultiNoiseBiomeSourceParameterList.Preset.OVERWORLD_WINTER_DROP, holderGetter)); + } + private static ResourceKey register(String name) { return ResourceKey.create(Registries.MULTI_NOISE_BIOME_SOURCE_PARAMETER_LIST, ResourceLocation.withDefaultNamespace(name)); } diff --git a/net/minecraft/world/level/biome/OverworldBiomeBuilder.java b/net/minecraft/world/level/biome/OverworldBiomeBuilder.java index 97f11ecf..e039cbd3 100644 --- a/net/minecraft/world/level/biome/OverworldBiomeBuilder.java +++ b/net/minecraft/world/level/biome/OverworldBiomeBuilder.java @@ -9,13 +9,15 @@ import net.minecraft.core.HolderLookup; import net.minecraft.core.registries.Registries; import net.minecraft.data.registries.VanillaRegistries; import net.minecraft.data.worldgen.TerrainProvider; +import net.minecraft.data.worldgen.WinterDropBiomes; import net.minecraft.resources.ResourceKey; -import net.minecraft.util.CubicSpline; import net.minecraft.util.ToFloatFunction; import net.minecraft.util.VisibleForDebug; +import net.minecraft.util.CubicSpline.Multipoint; import net.minecraft.world.level.levelgen.DensityFunction; -import net.minecraft.world.level.levelgen.DensityFunctions; import net.minecraft.world.level.levelgen.NoiseRouterData; +import net.minecraft.world.level.levelgen.DensityFunction.FunctionContext; +import net.minecraft.world.level.levelgen.DensityFunctions.Spline.Coordinate; public final class OverworldBiomeBuilder { private static final float VALLEY_SIZE = 0.05F; @@ -32,6 +34,7 @@ public final class OverworldBiomeBuilder { public static final float EROSION_INDEX_2_START = -0.375F; private static final float EROSION_DEEP_DARK_DRYNESS_THRESHOLD = -0.225F; private static final float DEPTH_DEEP_DARK_DRYNESS_THRESHOLD = 0.9F; + private final OverworldBiomeBuilder.Modifier modifier; private final Climate.Parameter FULL_RANGE = Climate.Parameter.span(-1.0F, 1.0F); private final Climate.Parameter[] temperatures = new Climate.Parameter[]{ Climate.Parameter.span(-1.0F, -0.45F), @@ -98,6 +101,13 @@ public final class OverworldBiomeBuilder { {null, null, null, null, null}, {Biomes.ERODED_BADLANDS, Biomes.ERODED_BADLANDS, null, null, null} }; + private final ResourceKey[][] PLATEAU_BIOMES_VARIANT_WINTER_DROP = new ResourceKey[][]{ + {Biomes.ICE_SPIKES, null, null, null, null}, + {Biomes.CHERRY_GROVE, null, Biomes.MEADOW, Biomes.MEADOW, Biomes.OLD_GROWTH_PINE_TAIGA}, + {Biomes.CHERRY_GROVE, Biomes.CHERRY_GROVE, Biomes.FOREST, Biomes.BIRCH_FOREST, WinterDropBiomes.PALE_GARDEN}, + {null, null, null, null, null}, + {Biomes.ERODED_BADLANDS, Biomes.ERODED_BADLANDS, null, null, null} + }; private final ResourceKey[][] SHATTERED_BIOMES = new ResourceKey[][]{ {Biomes.WINDSWEPT_GRAVELLY_HILLS, Biomes.WINDSWEPT_GRAVELLY_HILLS, Biomes.WINDSWEPT_HILLS, Biomes.WINDSWEPT_FOREST, Biomes.WINDSWEPT_FOREST}, {Biomes.WINDSWEPT_GRAVELLY_HILLS, Biomes.WINDSWEPT_GRAVELLY_HILLS, Biomes.WINDSWEPT_HILLS, Biomes.WINDSWEPT_FOREST, Biomes.WINDSWEPT_FOREST}, @@ -106,6 +116,14 @@ public final class OverworldBiomeBuilder { {null, null, null, null, null} }; + public OverworldBiomeBuilder() { + this(OverworldBiomeBuilder.Modifier.NONE); + } + + public OverworldBiomeBuilder(OverworldBiomeBuilder.Modifier modifier) { + this.modifier = modifier; + } + public List spawnTarget() { Climate.Parameter parameter = Climate.Parameter.point(0.0F); float f = 0.16F; @@ -144,16 +162,16 @@ public final class OverworldBiomeBuilder { private void addDebugBiomes(Consumer>> key) { HolderLookup.Provider provider = VanillaRegistries.createLookup(); HolderGetter holderGetter = provider.lookupOrThrow(Registries.DENSITY_FUNCTION); - DensityFunctions.Spline.Coordinate coordinate = new DensityFunctions.Spline.Coordinate(holderGetter.getOrThrow(NoiseRouterData.CONTINENTS)); - DensityFunctions.Spline.Coordinate coordinate2 = new DensityFunctions.Spline.Coordinate(holderGetter.getOrThrow(NoiseRouterData.EROSION)); - DensityFunctions.Spline.Coordinate coordinate3 = new DensityFunctions.Spline.Coordinate(holderGetter.getOrThrow(NoiseRouterData.RIDGES_FOLDED)); + Coordinate coordinate = new Coordinate(holderGetter.getOrThrow(NoiseRouterData.CONTINENTS)); + Coordinate coordinate2 = new Coordinate(holderGetter.getOrThrow(NoiseRouterData.EROSION)); + Coordinate coordinate3 = new Coordinate(holderGetter.getOrThrow(NoiseRouterData.RIDGES_FOLDED)); key.accept( Pair.of( Climate.parameters(this.FULL_RANGE, this.FULL_RANGE, this.FULL_RANGE, this.FULL_RANGE, Climate.Parameter.point(0.0F), this.FULL_RANGE, 0.01F), Biomes.PLAINS ) ); - if (TerrainProvider.buildErosionOffsetSpline(coordinate2, coordinate3, -0.15F, 0.0F, 0.0F, 0.1F, 0.0F, -0.03F, false, false, ToFloatFunction.IDENTITY) instanceof CubicSpline.Multipoint multipoint + if (TerrainProvider.buildErosionOffsetSpline(coordinate2, coordinate3, -0.15F, 0.0F, 0.0F, 0.1F, 0.0F, -0.03F, false, false, ToFloatFunction.IDENTITY) instanceof Multipoint multipoint ) { ResourceKey resourceKey = Biomes.DESERT; @@ -169,7 +187,7 @@ public final class OverworldBiomeBuilder { } } - if (TerrainProvider.overworldOffset(coordinate, coordinate2, coordinate3, false) instanceof CubicSpline.Multipoint multipoint2) { + if (TerrainProvider.overworldOffset(coordinate, coordinate2, coordinate3, false) instanceof Multipoint multipoint2) { for (float f : multipoint2.locations()) { key.accept( Pair.of( @@ -860,7 +878,9 @@ public final class OverworldBiomeBuilder { private ResourceKey pickPlateauBiome(int temperature, int humidity, Climate.Parameter param) { if (param.max() >= 0L) { - ResourceKey resourceKey = this.PLATEAU_BIOMES_VARIANT[temperature][humidity]; + ResourceKey resourceKey = (this.modifier == OverworldBiomeBuilder.Modifier.WINTER_DROP + ? this.PLATEAU_BIOMES_VARIANT_WINTER_DROP + : this.PLATEAU_BIOMES_VARIANT)[temperature][humidity]; if (resourceKey != null) { return resourceKey; } @@ -930,7 +950,7 @@ public final class OverworldBiomeBuilder { consumer.accept(Pair.of(Climate.parameters(temerature, humidity, continentalness, erosion, Climate.Parameter.point(1.1F), depth, weirdness), key)); } - public static boolean isDeepDarkRegion(DensityFunction erosionFunction, DensityFunction depthFunction, DensityFunction.FunctionContext functionContext) { + public static boolean isDeepDarkRegion(DensityFunction erosionFunction, DensityFunction depthFunction, FunctionContext functionContext) { return erosionFunction.compute(functionContext) < -0.225F && depthFunction.compute(functionContext) > 0.9F; } @@ -1030,4 +1050,9 @@ public final class OverworldBiomeBuilder { public Climate.Parameter[] getWeirdnessThresholds() { return new Climate.Parameter[]{Climate.Parameter.span(-2.0F, 0.0F), Climate.Parameter.span(0.0F, 2.0F)}; } + + public static enum Modifier { + NONE, + WINTER_DROP; + } } diff --git a/net/minecraft/world/level/biome/TheEndBiomeSource.java b/net/minecraft/world/level/biome/TheEndBiomeSource.java index 67da1f61..39c3e7bb 100644 --- a/net/minecraft/world/level/biome/TheEndBiomeSource.java +++ b/net/minecraft/world/level/biome/TheEndBiomeSource.java @@ -8,7 +8,7 @@ import net.minecraft.core.HolderGetter; import net.minecraft.core.QuartPos; import net.minecraft.core.SectionPos; import net.minecraft.resources.RegistryOps; -import net.minecraft.world.level.levelgen.DensityFunction; +import net.minecraft.world.level.levelgen.DensityFunction.SinglePointContext; public class TheEndBiomeSource extends BiomeSource { public static final MapCodec CODEC = RecordCodecBuilder.mapCodec( @@ -67,7 +67,7 @@ public class TheEndBiomeSource extends BiomeSource { } else { int q = (SectionPos.blockToSectionCoord(l) * 2 + 1) * 8; int r = (SectionPos.blockToSectionCoord(n) * 2 + 1) * 8; - double d = sampler.erosion().compute(new DensityFunction.SinglePointContext(q, m, r)); + double d = sampler.erosion().compute(new SinglePointContext(q, m, r)); if (d > 0.25) { return this.highlands; } else if (d >= -0.0625) { diff --git a/net/minecraft/world/level/block/AbstractCandleBlock.java b/net/minecraft/world/level/block/AbstractCandleBlock.java index 74621443..6e731fb9 100644 --- a/net/minecraft/world/level/block/AbstractCandleBlock.java +++ b/net/minecraft/world/level/block/AbstractCandleBlock.java @@ -4,6 +4,7 @@ import com.mojang.serialization.MapCodec; import java.util.function.BiConsumer; import net.minecraft.core.BlockPos; import net.minecraft.core.particles.ParticleTypes; +import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; import net.minecraft.tags.BlockTags; @@ -96,11 +97,13 @@ public abstract class AbstractCandleBlock extends Block { } @Override - protected void onExplosionHit(BlockState state, Level level, BlockPos pos, Explosion explosion, BiConsumer dropConsumer) { - if (explosion.canTriggerBlocks() && (Boolean)state.getValue(LIT)) { - extinguish(null, state, level, pos); + protected void onExplosionHit( + BlockState blockState, ServerLevel serverLevel, BlockPos blockPos, Explosion explosion, BiConsumer biConsumer + ) { + if (explosion.canTriggerBlocks() && (Boolean)blockState.getValue(LIT)) { + extinguish(null, blockState, serverLevel, blockPos); } - super.onExplosionHit(state, level, pos, explosion, dropConsumer); + super.onExplosionHit(blockState, serverLevel, blockPos, explosion, biConsumer); } } diff --git a/net/minecraft/world/level/block/AbstractCauldronBlock.java b/net/minecraft/world/level/block/AbstractCauldronBlock.java index 3087dc2e..e5844c01 100644 --- a/net/minecraft/world/level/block/AbstractCauldronBlock.java +++ b/net/minecraft/world/level/block/AbstractCauldronBlock.java @@ -6,7 +6,7 @@ import net.minecraft.core.cauldron.CauldronInteraction; import net.minecraft.server.level.ServerLevel; import net.minecraft.util.RandomSource; import net.minecraft.world.InteractionHand; -import net.minecraft.world.ItemInteractionResult; +import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; @@ -54,11 +54,11 @@ public abstract class AbstractCauldronBlock extends Block { } @Override - protected ItemInteractionResult useItemOn( - ItemStack stack, BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hitResult + protected InteractionResult useItemOn( + ItemStack itemStack, BlockState blockState, Level level, BlockPos blockPos, Player player, InteractionHand interactionHand, BlockHitResult blockHitResult ) { - CauldronInteraction cauldronInteraction = (CauldronInteraction)this.interactions.map().get(stack.getItem()); - return cauldronInteraction.interact(state, level, pos, player, hand, stack); + CauldronInteraction cauldronInteraction = (CauldronInteraction)this.interactions.map().get(itemStack.getItem()); + return cauldronInteraction.interact(blockState, level, blockPos, player, interactionHand, itemStack); } @Override diff --git a/net/minecraft/world/level/block/AbstractFurnaceBlock.java b/net/minecraft/world/level/block/AbstractFurnaceBlock.java index 069c5a93..5c0803c1 100644 --- a/net/minecraft/world/level/block/AbstractFurnaceBlock.java +++ b/net/minecraft/world/level/block/AbstractFurnaceBlock.java @@ -19,13 +19,13 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.block.state.properties.BooleanProperty; -import net.minecraft.world.level.block.state.properties.DirectionProperty; +import net.minecraft.world.level.block.state.properties.EnumProperty; import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.Vec3; import org.jetbrains.annotations.Nullable; public abstract class AbstractFurnaceBlock extends BaseEntityBlock { - public static final DirectionProperty FACING = HorizontalDirectionalBlock.FACING; + public static final EnumProperty FACING = HorizontalDirectionalBlock.FACING; public static final BooleanProperty LIT = BlockStateProperties.LIT; protected AbstractFurnaceBlock(BlockBehaviour.Properties properties) { @@ -38,12 +38,11 @@ public abstract class AbstractFurnaceBlock extends BaseEntityBlock { @Override protected InteractionResult useWithoutItem(BlockState state, Level level, BlockPos pos, Player player, BlockHitResult hitResult) { - if (level.isClientSide) { - return InteractionResult.SUCCESS; - } else { + if (!level.isClientSide) { this.openContainer(level, pos, player); - return InteractionResult.CONSUME; } + + return InteractionResult.SUCCESS; } /** @@ -110,6 +109,14 @@ public abstract class AbstractFurnaceBlock extends BaseEntityBlock { protected static BlockEntityTicker createFurnaceTicker( Level level, BlockEntityType serverType, BlockEntityType clientType ) { - return level.isClientSide ? null : createTickerHelper(serverType, clientType, AbstractFurnaceBlockEntity::serverTick); + return level instanceof ServerLevel serverLevel + ? createTickerHelper( + serverType, + clientType, + (levelx, blockPos, blockState, abstractFurnaceBlockEntity) -> AbstractFurnaceBlockEntity.serverTick( + serverLevel, blockPos, blockState, abstractFurnaceBlockEntity + ) + ) + : null; } } diff --git a/net/minecraft/world/level/block/AbstractSkullBlock.java b/net/minecraft/world/level/block/AbstractSkullBlock.java index 828b0178..7d116408 100644 --- a/net/minecraft/world/level/block/AbstractSkullBlock.java +++ b/net/minecraft/world/level/block/AbstractSkullBlock.java @@ -2,8 +2,6 @@ package net.minecraft.world.level.block; import com.mojang.serialization.MapCodec; import net.minecraft.core.BlockPos; -import net.minecraft.world.entity.EquipmentSlot; -import net.minecraft.world.item.Equipable; import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.entity.BlockEntity; @@ -16,9 +14,10 @@ import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.block.state.properties.BooleanProperty; import net.minecraft.world.level.pathfinder.PathComputationType; +import net.minecraft.world.level.redstone.Orientation; import org.jetbrains.annotations.Nullable; -public abstract class AbstractSkullBlock extends BaseEntityBlock implements Equipable { +public abstract class AbstractSkullBlock extends BaseEntityBlock { public static final BooleanProperty POWERED = BlockStateProperties.POWERED; private final SkullBlock.Type type; @@ -58,11 +57,6 @@ public abstract class AbstractSkullBlock extends BaseEntityBlock implements Equi return false; } - @Override - public EquipmentSlot getEquipmentSlot() { - return EquipmentSlot.HEAD; - } - @Override protected void createBlockStateDefinition(StateDefinition.Builder builder) { builder.add(POWERED); @@ -74,11 +68,11 @@ public abstract class AbstractSkullBlock extends BaseEntityBlock implements Equi } @Override - protected void neighborChanged(BlockState state, Level level, BlockPos pos, Block neighborBlock, BlockPos neighborPos, boolean movedByPiston) { + protected void neighborChanged(BlockState blockState, Level level, BlockPos blockPos, Block block, @Nullable Orientation orientation, boolean bl) { if (!level.isClientSide) { - boolean bl = level.hasNeighborSignal(pos); - if (bl != (Boolean)state.getValue(POWERED)) { - level.setBlock(pos, state.setValue(POWERED, bl), 2); + boolean bl2 = level.hasNeighborSignal(blockPos); + if (bl2 != (Boolean)blockState.getValue(POWERED)) { + level.setBlock(blockPos, blockState.setValue(POWERED, bl2), 2); } } } diff --git a/net/minecraft/world/level/block/AmethystBlock.java b/net/minecraft/world/level/block/AmethystBlock.java index e5a3ccf6..04df8952 100644 --- a/net/minecraft/world/level/block/AmethystBlock.java +++ b/net/minecraft/world/level/block/AmethystBlock.java @@ -26,7 +26,6 @@ public class AmethystBlock extends Block { protected void onProjectileHit(Level level, BlockState state, BlockHitResult hit, Projectile projectile) { if (!level.isClientSide) { BlockPos blockPos = hit.getBlockPos(); - level.playSound(null, blockPos, SoundEvents.AMETHYST_BLOCK_HIT, SoundSource.BLOCKS, 1.0F, 0.5F + level.random.nextFloat() * 1.2F); level.playSound(null, blockPos, SoundEvents.AMETHYST_BLOCK_CHIME, SoundSource.BLOCKS, 1.0F, 0.5F + level.random.nextFloat() * 1.2F); } } diff --git a/net/minecraft/world/level/block/AmethystClusterBlock.java b/net/minecraft/world/level/block/AmethystClusterBlock.java index b88f509a..a89a0796 100644 --- a/net/minecraft/world/level/block/AmethystClusterBlock.java +++ b/net/minecraft/world/level/block/AmethystClusterBlock.java @@ -5,16 +5,18 @@ import com.mojang.serialization.MapCodec; import com.mojang.serialization.codecs.RecordCodecBuilder; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; +import net.minecraft.util.RandomSource; import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.block.state.properties.BooleanProperty; -import net.minecraft.world.level.block.state.properties.DirectionProperty; +import net.minecraft.world.level.block.state.properties.EnumProperty; import net.minecraft.world.level.material.FluidState; import net.minecraft.world.level.material.Fluids; import net.minecraft.world.phys.shapes.CollisionContext; @@ -31,7 +33,7 @@ public class AmethystClusterBlock extends AmethystBlock implements SimpleWaterlo .apply(instance, AmethystClusterBlock::new) ); public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED; - public static final DirectionProperty FACING = BlockStateProperties.FACING; + public static final EnumProperty FACING = BlockStateProperties.FACING; private final float height; private final float aabbOffset; protected final VoxelShape northAabb; @@ -87,14 +89,23 @@ public class AmethystClusterBlock extends AmethystBlock implements SimpleWaterlo } @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { - if ((Boolean)state.getValue(WATERLOGGED)) { - level.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(level)); + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { + if ((Boolean)blockState.getValue(WATERLOGGED)) { + scheduledTickAccess.scheduleTick(blockPos, Fluids.WATER, Fluids.WATER.getTickDelay(levelReader)); } - return direction == ((Direction)state.getValue(FACING)).getOpposite() && !state.canSurvive(level, pos) + return direction == ((Direction)blockState.getValue(FACING)).getOpposite() && !blockState.canSurvive(levelReader, blockPos) ? Blocks.AIR.defaultBlockState() - : super.updateShape(state, direction, neighborState, level, pos, neighborPos); + : super.updateShape(blockState, levelReader, scheduledTickAccess, blockPos, direction, blockPos2, blockState2, randomSource); } @Nullable diff --git a/net/minecraft/world/level/block/AnvilBlock.java b/net/minecraft/world/level/block/AnvilBlock.java index 5e799d92..d4cf1119 100644 --- a/net/minecraft/world/level/block/AnvilBlock.java +++ b/net/minecraft/world/level/block/AnvilBlock.java @@ -20,7 +20,7 @@ import net.minecraft.world.level.Level; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; -import net.minecraft.world.level.block.state.properties.DirectionProperty; +import net.minecraft.world.level.block.state.properties.EnumProperty; import net.minecraft.world.level.pathfinder.PathComputationType; import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.shapes.CollisionContext; @@ -30,7 +30,7 @@ import org.jetbrains.annotations.Nullable; public class AnvilBlock extends FallingBlock { public static final MapCodec CODEC = simpleCodec(AnvilBlock::new); - public static final DirectionProperty FACING = HorizontalDirectionalBlock.FACING; + public static final EnumProperty FACING = HorizontalDirectionalBlock.FACING; private static final VoxelShape BASE = Block.box(2.0, 0.0, 2.0, 14.0, 4.0, 14.0); private static final VoxelShape X_LEG1 = Block.box(3.0, 4.0, 4.0, 13.0, 5.0, 12.0); private static final VoxelShape X_LEG2 = Block.box(4.0, 5.0, 6.0, 12.0, 10.0, 10.0); @@ -61,13 +61,12 @@ public class AnvilBlock extends FallingBlock { @Override protected InteractionResult useWithoutItem(BlockState state, Level level, BlockPos pos, Player player, BlockHitResult hitResult) { - if (level.isClientSide) { - return InteractionResult.SUCCESS; - } else { + if (!level.isClientSide) { player.openMenu(state.getMenuProvider(level, pos)); player.awardStat(Stats.INTERACT_WITH_ANVIL); - return InteractionResult.CONSUME; } + + return InteractionResult.SUCCESS; } @Nullable diff --git a/net/minecraft/world/level/block/AttachedStemBlock.java b/net/minecraft/world/level/block/AttachedStemBlock.java index 079bb1dd..c657292f 100644 --- a/net/minecraft/world/level/block/AttachedStemBlock.java +++ b/net/minecraft/world/level/block/AttachedStemBlock.java @@ -11,15 +11,16 @@ import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.registries.Registries; import net.minecraft.resources.ResourceKey; +import net.minecraft.util.RandomSource; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.BlockGetter; -import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; -import net.minecraft.world.level.block.state.properties.DirectionProperty; +import net.minecraft.world.level.block.state.properties.EnumProperty; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.VoxelShape; @@ -33,7 +34,7 @@ public class AttachedStemBlock extends BushBlock { ) .apply(instance, AttachedStemBlock::new) ); - public static final DirectionProperty FACING = HorizontalDirectionalBlock.FACING; + public static final EnumProperty FACING = HorizontalDirectionalBlock.FACING; protected static final float AABB_OFFSET = 2.0F; private static final Map AABBS = Maps.newEnumMap( ImmutableMap.of( @@ -70,15 +71,24 @@ public class AttachedStemBlock extends BushBlock { } @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { - if (!neighborState.is(this.fruit) && direction == state.getValue(FACING)) { - Optional optional = level.registryAccess().registryOrThrow(Registries.BLOCK).getOptional(this.stem); + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { + if (!blockState2.is(this.fruit) && direction == blockState.getValue(FACING)) { + Optional optional = levelReader.registryAccess().lookupOrThrow(Registries.BLOCK).getOptional(this.stem); if (optional.isPresent()) { return ((Block)optional.get()).defaultBlockState().trySetValue(StemBlock.AGE, 7); } } - return super.updateShape(state, direction, neighborState, level, pos, neighborPos); + return super.updateShape(blockState, levelReader, scheduledTickAccess, blockPos, direction, blockPos2, blockState2, randomSource); } @Override @@ -88,7 +98,7 @@ public class AttachedStemBlock extends BushBlock { @Override public ItemStack getCloneItemStack(LevelReader level, BlockPos pos, BlockState state) { - return new ItemStack(DataFixUtils.orElse(level.registryAccess().registryOrThrow(Registries.ITEM).getOptional(this.seed), this)); + return new ItemStack(DataFixUtils.orElse(level.registryAccess().lookupOrThrow(Registries.ITEM).getOptional(this.seed), this)); } @Override diff --git a/net/minecraft/world/level/block/AzaleaBlock.java b/net/minecraft/world/level/block/AzaleaBlock.java index 7b58beed..fc99ce6d 100644 --- a/net/minecraft/world/level/block/AzaleaBlock.java +++ b/net/minecraft/world/level/block/AzaleaBlock.java @@ -10,6 +10,7 @@ import net.minecraft.world.level.LevelReader; import net.minecraft.world.level.block.grower.TreeGrower; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.pathfinder.PathComputationType; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.Shapes; import net.minecraft.world.phys.shapes.VoxelShape; @@ -51,4 +52,9 @@ public class AzaleaBlock extends BushBlock implements BonemealableBlock { public void performBonemeal(ServerLevel level, RandomSource random, BlockPos pos, BlockState state) { TreeGrower.AZALEA.growTree(level, level.getChunkSource().getGenerator(), pos, state, random); } + + @Override + protected boolean isPathfindable(BlockState state, PathComputationType pathComputationType) { + return false; + } } diff --git a/net/minecraft/world/level/block/BambooSaplingBlock.java b/net/minecraft/world/level/block/BambooSaplingBlock.java index b492423e..c1633963 100644 --- a/net/minecraft/world/level/block/BambooSaplingBlock.java +++ b/net/minecraft/world/level/block/BambooSaplingBlock.java @@ -12,8 +12,8 @@ import net.minecraft.world.item.Items; import net.minecraft.world.item.SwordItem; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; -import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.properties.BambooLeaves; @@ -37,7 +37,7 @@ public class BambooSaplingBlock extends Block implements BonemealableBlock { @Override protected VoxelShape getShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext context) { - Vec3 vec3 = state.getOffset(level, pos); + Vec3 vec3 = state.getOffset(pos); return SAPLING_SHAPE.move(vec3.x, vec3.y, vec3.z); } @@ -54,15 +54,22 @@ public class BambooSaplingBlock extends Block implements BonemealableBlock { } @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { - if (!state.canSurvive(level, pos)) { + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { + if (!blockState.canSurvive(levelReader, blockPos)) { return Blocks.AIR.defaultBlockState(); } else { - if (direction == Direction.UP && neighborState.is(Blocks.BAMBOO)) { - level.setBlock(pos, Blocks.BAMBOO.defaultBlockState(), 2); - } - - return super.updateShape(state, direction, neighborState, level, pos, neighborPos); + return direction == Direction.UP && blockState2.is(Blocks.BAMBOO) + ? Blocks.BAMBOO.defaultBlockState() + : super.updateShape(blockState, levelReader, scheduledTickAccess, blockPos, direction, blockPos2, blockState2, randomSource); } } diff --git a/net/minecraft/world/level/block/BambooStalkBlock.java b/net/minecraft/world/level/block/BambooStalkBlock.java index a4c78187..85edde56 100644 --- a/net/minecraft/world/level/block/BambooStalkBlock.java +++ b/net/minecraft/world/level/block/BambooStalkBlock.java @@ -11,8 +11,8 @@ import net.minecraft.world.item.SwordItem; import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; -import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; @@ -60,14 +60,14 @@ public class BambooStalkBlock extends Block implements BonemealableBlock { } @Override - protected boolean propagatesSkylightDown(BlockState state, BlockGetter level, BlockPos pos) { + protected boolean propagatesSkylightDown(BlockState blockState) { return true; } @Override protected VoxelShape getShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext context) { VoxelShape voxelShape = state.getValue(LEAVES) == BambooLeaves.LARGE ? LARGE_SHAPE : SMALL_SHAPE; - Vec3 vec3 = state.getOffset(level, pos); + Vec3 vec3 = state.getOffset(pos); return voxelShape.move(vec3.x, vec3.y, vec3.z); } @@ -78,7 +78,7 @@ public class BambooStalkBlock extends Block implements BonemealableBlock { @Override protected VoxelShape getCollisionShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext context) { - Vec3 vec3 = state.getOffset(level, pos); + Vec3 vec3 = state.getOffset(pos); return COLLISION_SHAPE.move(vec3.x, vec3.y, vec3.z); } @@ -143,16 +143,23 @@ public class BambooStalkBlock extends Block implements BonemealableBlock { } @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { - if (!state.canSurvive(level, pos)) { - level.scheduleTick(pos, this, 1); + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { + if (!blockState.canSurvive(levelReader, blockPos)) { + scheduledTickAccess.scheduleTick(blockPos, this, 1); } - if (direction == Direction.UP && neighborState.is(Blocks.BAMBOO) && (Integer)neighborState.getValue(AGE) > (Integer)state.getValue(AGE)) { - level.setBlock(pos, state.cycle(AGE), 2); - } - - return super.updateShape(state, direction, neighborState, level, pos, neighborPos); + return direction == Direction.UP && blockState2.is(Blocks.BAMBOO) && blockState2.getValue(AGE) > blockState.getValue(AGE) + ? blockState.cycle(AGE) + : super.updateShape(blockState, levelReader, scheduledTickAccess, blockPos, direction, blockPos2, blockState2, randomSource); } @Override diff --git a/net/minecraft/world/level/block/BannerBlock.java b/net/minecraft/world/level/block/BannerBlock.java index 5c34fabe..c71f71e8 100644 --- a/net/minecraft/world/level/block/BannerBlock.java +++ b/net/minecraft/world/level/block/BannerBlock.java @@ -6,11 +6,12 @@ import com.mojang.serialization.codecs.RecordCodecBuilder; import java.util.Map; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; +import net.minecraft.util.RandomSource; import net.minecraft.world.item.DyeColor; import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.level.BlockGetter; -import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; @@ -55,10 +56,19 @@ public class BannerBlock extends AbstractBannerBlock { } @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { - return direction == Direction.DOWN && !state.canSurvive(level, pos) + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { + return direction == Direction.DOWN && !blockState.canSurvive(levelReader, blockPos) ? Blocks.AIR.defaultBlockState() - : super.updateShape(state, direction, neighborState, level, pos, neighborPos); + : super.updateShape(blockState, levelReader, scheduledTickAccess, blockPos, direction, blockPos2, blockState2, randomSource); } @Override diff --git a/net/minecraft/world/level/block/BarrelBlock.java b/net/minecraft/world/level/block/BarrelBlock.java index 5acbd228..cc988d58 100644 --- a/net/minecraft/world/level/block/BarrelBlock.java +++ b/net/minecraft/world/level/block/BarrelBlock.java @@ -20,13 +20,13 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.block.state.properties.BooleanProperty; -import net.minecraft.world.level.block.state.properties.DirectionProperty; +import net.minecraft.world.level.block.state.properties.EnumProperty; import net.minecraft.world.phys.BlockHitResult; import org.jetbrains.annotations.Nullable; public class BarrelBlock extends BaseEntityBlock { public static final MapCodec CODEC = simpleCodec(BarrelBlock::new); - public static final DirectionProperty FACING = BlockStateProperties.FACING; + public static final EnumProperty FACING = BlockStateProperties.FACING; public static final BooleanProperty OPEN = BlockStateProperties.OPEN; @Override @@ -41,18 +41,13 @@ public class BarrelBlock extends BaseEntityBlock { @Override protected InteractionResult useWithoutItem(BlockState state, Level level, BlockPos pos, Player player, BlockHitResult hitResult) { - if (level.isClientSide) { - return InteractionResult.SUCCESS; - } else { - BlockEntity blockEntity = level.getBlockEntity(pos); - if (blockEntity instanceof BarrelBlockEntity) { - player.openMenu((BarrelBlockEntity)blockEntity); - player.awardStat(Stats.OPEN_BARREL); - PiglinAi.angerNearbyPiglins(player, true); - } - - return InteractionResult.CONSUME; + if (level instanceof ServerLevel serverLevel && level.getBlockEntity(pos) instanceof BarrelBlockEntity barrelBlockEntity) { + player.openMenu(barrelBlockEntity); + player.awardStat(Stats.OPEN_BARREL); + PiglinAi.angerNearbyPiglins(serverLevel, player, true); } + + return InteractionResult.SUCCESS; } @Override diff --git a/net/minecraft/world/level/block/BarrierBlock.java b/net/minecraft/world/level/block/BarrierBlock.java index 18b4c97d..e7a1dc6d 100644 --- a/net/minecraft/world/level/block/BarrierBlock.java +++ b/net/minecraft/world/level/block/BarrierBlock.java @@ -3,11 +3,14 @@ package net.minecraft.world.level.block; import com.mojang.serialization.MapCodec; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; +import net.minecraft.util.RandomSource; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; @@ -33,8 +36,8 @@ public class BarrierBlock extends Block implements SimpleWaterloggedBlock { } @Override - protected boolean propagatesSkylightDown(BlockState state, BlockGetter level, BlockPos pos) { - return state.getFluidState().isEmpty(); + protected boolean propagatesSkylightDown(BlockState blockState) { + return blockState.getFluidState().isEmpty(); } @Override @@ -48,12 +51,21 @@ public class BarrierBlock extends Block implements SimpleWaterloggedBlock { } @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { - if ((Boolean)state.getValue(WATERLOGGED)) { - level.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(level)); + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { + if ((Boolean)blockState.getValue(WATERLOGGED)) { + scheduledTickAccess.scheduleTick(blockPos, Fluids.WATER, Fluids.WATER.getTickDelay(levelReader)); } - return super.updateShape(state, direction, neighborState, level, pos, neighborPos); + return super.updateShape(blockState, levelReader, scheduledTickAccess, blockPos, direction, blockPos2, blockState2, randomSource); } @Override diff --git a/net/minecraft/world/level/block/BaseCoralPlantTypeBlock.java b/net/minecraft/world/level/block/BaseCoralPlantTypeBlock.java index 7e4c5398..8c541883 100644 --- a/net/minecraft/world/level/block/BaseCoralPlantTypeBlock.java +++ b/net/minecraft/world/level/block/BaseCoralPlantTypeBlock.java @@ -4,10 +4,11 @@ import com.mojang.serialization.MapCodec; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.tags.FluidTags; +import net.minecraft.util.RandomSource; import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.level.BlockGetter; -import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; @@ -31,9 +32,11 @@ public abstract class BaseCoralPlantTypeBlock extends Block implements SimpleWat @Override protected abstract MapCodec codec(); - protected void tryScheduleDieTick(BlockState state, LevelAccessor level, BlockPos pos) { - if (!scanForWater(state, level, pos)) { - level.scheduleTick(pos, this, 60 + level.getRandom().nextInt(40)); + protected void tryScheduleDieTick( + BlockState blockState, BlockGetter blockGetter, ScheduledTickAccess scheduledTickAccess, RandomSource randomSource, BlockPos blockPos + ) { + if (!scanForWater(blockState, blockGetter, blockPos)) { + scheduledTickAccess.scheduleTick(blockPos, this, 60 + randomSource.nextInt(40)); } } @@ -64,14 +67,23 @@ public abstract class BaseCoralPlantTypeBlock extends Block implements SimpleWat } @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { - if ((Boolean)state.getValue(WATERLOGGED)) { - level.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(level)); + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { + if ((Boolean)blockState.getValue(WATERLOGGED)) { + scheduledTickAccess.scheduleTick(blockPos, Fluids.WATER, Fluids.WATER.getTickDelay(levelReader)); } - return direction == Direction.DOWN && !this.canSurvive(state, level, pos) + return direction == Direction.DOWN && !this.canSurvive(blockState, levelReader, blockPos) ? Blocks.AIR.defaultBlockState() - : super.updateShape(state, direction, neighborState, level, pos, neighborPos); + : super.updateShape(blockState, levelReader, scheduledTickAccess, blockPos, direction, blockPos2, blockState2, randomSource); } @Override diff --git a/net/minecraft/world/level/block/BaseCoralWallFanBlock.java b/net/minecraft/world/level/block/BaseCoralWallFanBlock.java index 247f89d8..78e3f540 100644 --- a/net/minecraft/world/level/block/BaseCoralWallFanBlock.java +++ b/net/minecraft/world/level/block/BaseCoralWallFanBlock.java @@ -6,14 +6,15 @@ import com.mojang.serialization.MapCodec; import java.util.Map; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; +import net.minecraft.util.RandomSource; import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.level.BlockGetter; -import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; -import net.minecraft.world.level.block.state.properties.DirectionProperty; +import net.minecraft.world.level.block.state.properties.EnumProperty; import net.minecraft.world.level.material.Fluids; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.VoxelShape; @@ -21,7 +22,7 @@ import org.jetbrains.annotations.Nullable; public class BaseCoralWallFanBlock extends BaseCoralFanBlock { public static final MapCodec CODEC = simpleCodec(BaseCoralWallFanBlock::new); - public static final DirectionProperty FACING = HorizontalDirectionalBlock.FACING; + public static final EnumProperty FACING = HorizontalDirectionalBlock.FACING; private static final Map SHAPES = Maps.newEnumMap( ImmutableMap.of( Direction.NORTH, @@ -66,12 +67,21 @@ public class BaseCoralWallFanBlock extends BaseCoralFanBlock { } @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { - if ((Boolean)state.getValue(WATERLOGGED)) { - level.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(level)); + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { + if ((Boolean)blockState.getValue(WATERLOGGED)) { + scheduledTickAccess.scheduleTick(blockPos, Fluids.WATER, Fluids.WATER.getTickDelay(levelReader)); } - return direction.getOpposite() == state.getValue(FACING) && !state.canSurvive(level, pos) ? Blocks.AIR.defaultBlockState() : state; + return direction.getOpposite() == blockState.getValue(FACING) && !blockState.canSurvive(levelReader, blockPos) ? Blocks.AIR.defaultBlockState() : blockState; } @Override diff --git a/net/minecraft/world/level/block/BaseFireBlock.java b/net/minecraft/world/level/block/BaseFireBlock.java index e2716f0d..dbf8318a 100644 --- a/net/minecraft/world/level/block/BaseFireBlock.java +++ b/net/minecraft/world/level/block/BaseFireBlock.java @@ -5,6 +5,7 @@ import java.util.Optional; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.particles.ParticleTypes; +import net.minecraft.server.level.ServerPlayer; import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; import net.minecraft.util.RandomSource; @@ -21,6 +22,8 @@ import net.minecraft.world.phys.shapes.VoxelShape; public abstract class BaseFireBlock extends Block { private static final int SECONDS_ON_FIRE = 8; + private static final int MIN_FIRE_TICKS_TO_ADD = 1; + private static final int MAX_FIRE_TICKS_TO_ADD = 3; private final float fireDamage; protected static final float AABB_OFFSET = 1.0F; protected static final VoxelShape DOWN_AABB = Block.box(0.0, 0.0, 0.0, 16.0, 1.0, 16.0); @@ -126,8 +129,14 @@ public abstract class BaseFireBlock extends Block { @Override protected void entityInside(BlockState state, Level level, BlockPos pos, Entity entity) { if (!entity.fireImmune()) { - entity.setRemainingFireTicks(entity.getRemainingFireTicks() + 1); - if (entity.getRemainingFireTicks() == 0) { + if (entity.getRemainingFireTicks() < 0) { + entity.setRemainingFireTicks(entity.getRemainingFireTicks() + 1); + } else if (entity instanceof ServerPlayer) { + int i = level.getRandom().nextInt(1, 3); + entity.setRemainingFireTicks(entity.getRemainingFireTicks() + i); + } + + if (entity.getRemainingFireTicks() >= 0) { entity.igniteForSeconds(8.0F); } } @@ -142,7 +151,7 @@ public abstract class BaseFireBlock extends Block { if (inPortalDimension(level)) { Optional optional = PortalShape.findEmptyPortalShape(level, pos, Direction.Axis.X); if (optional.isPresent()) { - ((PortalShape)optional.get()).createPortalBlocks(); + ((PortalShape)optional.get()).createPortalBlocks(level); return; } } diff --git a/net/minecraft/world/level/block/BasePressurePlateBlock.java b/net/minecraft/world/level/block/BasePressurePlateBlock.java index f479db1d..302beb74 100644 --- a/net/minecraft/world/level/block/BasePressurePlateBlock.java +++ b/net/minecraft/world/level/block/BasePressurePlateBlock.java @@ -10,8 +10,8 @@ import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntitySelector; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; -import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.properties.BlockSetType; @@ -50,10 +50,19 @@ public abstract class BasePressurePlateBlock extends Block { } @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { - return direction == Direction.DOWN && !state.canSurvive(level, pos) + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { + return direction == Direction.DOWN && !blockState.canSurvive(levelReader, blockPos) ? Blocks.AIR.defaultBlockState() - : super.updateShape(state, direction, neighborState, level, pos, neighborPos); + : super.updateShape(blockState, levelReader, scheduledTickAccess, blockPos, direction, blockPos2, blockState2, randomSource); } @Override diff --git a/net/minecraft/world/level/block/BaseRailBlock.java b/net/minecraft/world/level/block/BaseRailBlock.java index b74d53dc..e576f24d 100644 --- a/net/minecraft/world/level/block/BaseRailBlock.java +++ b/net/minecraft/world/level/block/BaseRailBlock.java @@ -4,11 +4,12 @@ import com.mojang.serialization.MapCodec; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.tags.BlockTags; +import net.minecraft.util.RandomSource; import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; -import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.properties.BlockStateProperties; @@ -17,8 +18,10 @@ import net.minecraft.world.level.block.state.properties.Property; import net.minecraft.world.level.block.state.properties.RailShape; import net.minecraft.world.level.material.FluidState; import net.minecraft.world.level.material.Fluids; +import net.minecraft.world.level.redstone.Orientation; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.VoxelShape; +import org.jetbrains.annotations.Nullable; public abstract class BaseRailBlock extends Block implements SimpleWaterloggedBlock { protected static final VoxelShape FLAT_AABB = Block.box(0.0, 0.0, 0.0, 16.0, 2.0, 16.0); @@ -49,7 +52,7 @@ public abstract class BaseRailBlock extends Block implements SimpleWaterloggedBl @Override protected VoxelShape getShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext context) { RailShape railShape = state.is(this) ? state.getValue(this.getShapeProperty()) : null; - return railShape != null && railShape.isAscending() ? HALF_BLOCK_AABB : FLAT_AABB; + return railShape != null && railShape.isSlope() ? HALF_BLOCK_AABB : FLAT_AABB; } @Override @@ -67,21 +70,21 @@ public abstract class BaseRailBlock extends Block implements SimpleWaterloggedBl protected BlockState updateState(BlockState state, Level level, BlockPos pos, boolean movedByPiston) { state = this.updateDir(level, pos, state, true); if (this.isStraight) { - level.neighborChanged(state, pos, this, pos, movedByPiston); + level.neighborChanged(state, pos, this, null, movedByPiston); } return state; } @Override - protected void neighborChanged(BlockState state, Level level, BlockPos pos, Block neighborBlock, BlockPos neighborPos, boolean movedByPiston) { - if (!level.isClientSide && level.getBlockState(pos).is(this)) { - RailShape railShape = state.getValue(this.getShapeProperty()); - if (shouldBeRemoved(pos, level, railShape)) { - dropResources(state, level, pos); - level.removeBlock(pos, movedByPiston); + protected void neighborChanged(BlockState blockState, Level level, BlockPos blockPos, Block block, @Nullable Orientation orientation, boolean bl) { + if (!level.isClientSide && level.getBlockState(blockPos).is(this)) { + RailShape railShape = blockState.getValue(this.getShapeProperty()); + if (shouldBeRemoved(blockPos, level, railShape)) { + dropResources(blockState, level, blockPos); + level.removeBlock(blockPos, bl); } else { - this.updateState(state, level, pos, neighborBlock); + this.updateState(blockState, level, blockPos, block); } } } @@ -121,7 +124,7 @@ public abstract class BaseRailBlock extends Block implements SimpleWaterloggedBl protected void onRemove(BlockState state, Level level, BlockPos pos, BlockState newState, boolean movedByPiston) { if (!movedByPiston) { super.onRemove(state, level, pos, newState, movedByPiston); - if (((RailShape)state.getValue(this.getShapeProperty())).isAscending()) { + if (((RailShape)state.getValue(this.getShapeProperty())).isSlope()) { level.updateNeighborsAt(pos.above(), this); } @@ -145,12 +148,21 @@ public abstract class BaseRailBlock extends Block implements SimpleWaterloggedBl public abstract Property getShapeProperty(); @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { - if ((Boolean)state.getValue(WATERLOGGED)) { - level.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(level)); + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { + if ((Boolean)blockState.getValue(WATERLOGGED)) { + scheduledTickAccess.scheduleTick(blockPos, Fluids.WATER, Fluids.WATER.getTickDelay(levelReader)); } - return super.updateShape(state, direction, neighborState, level, pos, neighborPos); + return super.updateShape(blockState, levelReader, scheduledTickAccess, blockPos, direction, blockPos2, blockState2, randomSource); } @Override diff --git a/net/minecraft/world/level/block/BaseTorchBlock.java b/net/minecraft/world/level/block/BaseTorchBlock.java index b5ad1a3a..1b7cd74f 100644 --- a/net/minecraft/world/level/block/BaseTorchBlock.java +++ b/net/minecraft/world/level/block/BaseTorchBlock.java @@ -3,9 +3,10 @@ package net.minecraft.world.level.block; import com.mojang.serialization.MapCodec; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; +import net.minecraft.util.RandomSource; import net.minecraft.world.level.BlockGetter; -import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.shapes.CollisionContext; @@ -28,10 +29,19 @@ public abstract class BaseTorchBlock extends Block { } @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { - return direction == Direction.DOWN && !this.canSurvive(state, level, pos) + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { + return direction == Direction.DOWN && !this.canSurvive(blockState, levelReader, blockPos) ? Blocks.AIR.defaultBlockState() - : super.updateShape(state, direction, neighborState, level, pos, neighborPos); + : super.updateShape(blockState, levelReader, scheduledTickAccess, blockPos, direction, blockPos2, blockState2, randomSource); } @Override diff --git a/net/minecraft/world/level/block/BeaconBlock.java b/net/minecraft/world/level/block/BeaconBlock.java index eabed44b..45186bc0 100644 --- a/net/minecraft/world/level/block/BeaconBlock.java +++ b/net/minecraft/world/level/block/BeaconBlock.java @@ -46,16 +46,12 @@ public class BeaconBlock extends BaseEntityBlock implements BeaconBeamBlock { @Override protected InteractionResult useWithoutItem(BlockState state, Level level, BlockPos pos, Player player, BlockHitResult hitResult) { - if (level.isClientSide) { - return InteractionResult.SUCCESS; - } else { - if (level.getBlockEntity(pos) instanceof BeaconBlockEntity beaconBlockEntity) { - player.openMenu(beaconBlockEntity); - player.awardStat(Stats.INTERACT_WITH_BEACON); - } - - return InteractionResult.CONSUME; + if (!level.isClientSide && level.getBlockEntity(pos) instanceof BeaconBlockEntity beaconBlockEntity) { + player.openMenu(beaconBlockEntity); + player.awardStat(Stats.INTERACT_WITH_BEACON); } + + return InteractionResult.SUCCESS; } @Override diff --git a/net/minecraft/world/level/block/BedBlock.java b/net/minecraft/world/level/block/BedBlock.java index 546a5ebb..66bbec14 100644 --- a/net/minecraft/world/level/block/BedBlock.java +++ b/net/minecraft/world/level/block/BedBlock.java @@ -8,6 +8,7 @@ import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.network.chat.Component; import net.minecraft.util.Mth; +import net.minecraft.util.RandomSource; import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; @@ -21,7 +22,8 @@ import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.CollisionGetter; import net.minecraft.world.level.Level; -import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.entity.BedBlockEntity; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.state.BlockBehaviour; @@ -80,7 +82,7 @@ public class BedBlock extends HorizontalDirectionalBlock implements EntityBlock @Override protected InteractionResult useWithoutItem(BlockState state, Level level, BlockPos pos, Player player, BlockHitResult hitResult) { if (level.isClientSide) { - return InteractionResult.CONSUME; + return InteractionResult.SUCCESS_SERVER; } else { if (state.getValue(PART) != BedPart.HEAD) { pos = pos.relative(state.getValue(FACING)); @@ -99,20 +101,20 @@ public class BedBlock extends HorizontalDirectionalBlock implements EntityBlock Vec3 vec3 = pos.getCenter(); level.explode(null, level.damageSources().badRespawnPointExplosion(vec3), null, vec3, 5.0F, true, Level.ExplosionInteraction.BLOCK); - return InteractionResult.SUCCESS; + return InteractionResult.SUCCESS_SERVER; } else if ((Boolean)state.getValue(OCCUPIED)) { if (!this.kickVillagerOutOfBed(level, pos)) { player.displayClientMessage(Component.translatable("block.minecraft.bed.occupied"), true); } - return InteractionResult.SUCCESS; + return InteractionResult.SUCCESS_SERVER; } else { player.startSleepInBed(pos).ifLeft(bedSleepingProblem -> { if (bedSleepingProblem.getMessage() != null) { player.displayClientMessage(bedSleepingProblem.getMessage(), true); } }); - return InteractionResult.SUCCESS; + return InteractionResult.SUCCESS_SERVER; } } } @@ -137,9 +139,9 @@ public class BedBlock extends HorizontalDirectionalBlock implements EntityBlock } @Override - public void updateEntityAfterFallOn(BlockGetter level, Entity entity) { + public void updateEntityMovementAfterFallOn(BlockGetter blockGetter, Entity entity) { if (entity.isSuppressingBounce()) { - super.updateEntityAfterFallOn(level, entity); + super.updateEntityMovementAfterFallOn(blockGetter, entity); } else { this.bounceUp(entity); } @@ -154,13 +156,22 @@ public class BedBlock extends HorizontalDirectionalBlock implements EntityBlock } @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { - if (direction == getNeighbourDirection(state.getValue(PART), state.getValue(FACING))) { - return neighborState.is(this) && neighborState.getValue(PART) != state.getValue(PART) - ? state.setValue(OCCUPIED, (Boolean)neighborState.getValue(OCCUPIED)) + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { + if (direction == getNeighbourDirection(blockState.getValue(PART), blockState.getValue(FACING))) { + return blockState2.is(this) && blockState2.getValue(PART) != blockState.getValue(PART) + ? blockState.setValue(OCCUPIED, (Boolean)blockState2.getValue(OCCUPIED)) : Blocks.AIR.defaultBlockState(); } else { - return super.updateShape(state, direction, neighborState, level, pos, neighborPos); + return super.updateShape(blockState, levelReader, scheduledTickAccess, blockPos, direction, blockPos2, blockState2, randomSource); } } diff --git a/net/minecraft/world/level/block/BeehiveBlock.java b/net/minecraft/world/level/block/BeehiveBlock.java index 0c5cd741..d576c251 100644 --- a/net/minecraft/world/level/block/BeehiveBlock.java +++ b/net/minecraft/world/level/block/BeehiveBlock.java @@ -2,12 +2,17 @@ package net.minecraft.world.level.block; import com.mojang.serialization.MapCodec; import java.util.List; +import java.util.Objects; +import java.util.function.BiConsumer; +import net.minecraft.ChatFormatting; import net.minecraft.Util; import net.minecraft.advancements.CriteriaTriggers; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.component.DataComponents; import net.minecraft.core.particles.ParticleTypes; +import net.minecraft.network.chat.Component; +import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; @@ -17,7 +22,7 @@ import net.minecraft.tags.EnchantmentTags; import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; import net.minecraft.world.InteractionHand; -import net.minecraft.world.ItemInteractionResult; +import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.animal.Bee; @@ -31,12 +36,15 @@ import net.minecraft.world.entity.vehicle.MinecartTNT; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; +import net.minecraft.world.item.TooltipFlag; import net.minecraft.world.item.component.BlockItemStateProperties; import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.item.enchantment.EnchantmentHelper; +import net.minecraft.world.level.Explosion; import net.minecraft.world.level.GameRules; import net.minecraft.world.level.Level; -import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.entity.BeehiveBlockEntity; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntityTicker; @@ -45,7 +53,7 @@ import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.block.state.properties.BlockStateProperties; -import net.minecraft.world.level.block.state.properties.DirectionProperty; +import net.minecraft.world.level.block.state.properties.EnumProperty; import net.minecraft.world.level.block.state.properties.IntegerProperty; import net.minecraft.world.level.gameevent.GameEvent; import net.minecraft.world.level.storage.loot.LootParams; @@ -57,7 +65,7 @@ import org.jetbrains.annotations.Nullable; public class BeehiveBlock extends BaseEntityBlock { public static final MapCodec CODEC = simpleCodec(BeehiveBlock::new); - public static final DirectionProperty FACING = HorizontalDirectionalBlock.FACING; + public static final EnumProperty FACING = HorizontalDirectionalBlock.FACING; public static final IntegerProperty HONEY_LEVEL = BlockStateProperties.LEVEL_HONEY; public static final int MAX_HONEY_LEVELS = 5; private static final int SHEARED_HONEYCOMB_COUNT = 3; @@ -96,6 +104,14 @@ public class BeehiveBlock extends BaseEntityBlock { } } + @Override + protected void onExplosionHit( + BlockState blockState, ServerLevel serverLevel, BlockPos blockPos, Explosion explosion, BiConsumer biConsumer + ) { + super.onExplosionHit(blockState, serverLevel, blockPos, explosion, biConsumer); + this.angerNearbyBees(serverLevel, blockPos); + } + private void angerNearbyBees(Level level, BlockPos pos) { AABB aABB = new AABB(pos).inflate(8.0, 6.0, 8.0); List list = level.getEntitiesOfClass(Bee.class, aABB); @@ -119,30 +135,30 @@ public class BeehiveBlock extends BaseEntityBlock { } @Override - protected ItemInteractionResult useItemOn( - ItemStack stack, BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hitResult + protected InteractionResult useItemOn( + ItemStack itemStack, BlockState blockState, Level level, BlockPos blockPos, Player player, InteractionHand interactionHand, BlockHitResult blockHitResult ) { - int i = (Integer)state.getValue(HONEY_LEVEL); + int i = (Integer)blockState.getValue(HONEY_LEVEL); boolean bl = false; if (i >= 5) { - Item item = stack.getItem(); - if (stack.is(Items.SHEARS)) { + Item item = itemStack.getItem(); + if (itemStack.is(Items.SHEARS)) { level.playSound(player, player.getX(), player.getY(), player.getZ(), SoundEvents.BEEHIVE_SHEAR, SoundSource.BLOCKS, 1.0F, 1.0F); - dropHoneycomb(level, pos); - stack.hurtAndBreak(1, player, LivingEntity.getSlotForHand(hand)); + dropHoneycomb(level, blockPos); + itemStack.hurtAndBreak(1, player, LivingEntity.getSlotForHand(interactionHand)); bl = true; - level.gameEvent(player, GameEvent.SHEAR, pos); - } else if (stack.is(Items.GLASS_BOTTLE)) { - stack.shrink(1); + level.gameEvent(player, GameEvent.SHEAR, blockPos); + } else if (itemStack.is(Items.GLASS_BOTTLE)) { + itemStack.shrink(1); level.playSound(player, player.getX(), player.getY(), player.getZ(), SoundEvents.BOTTLE_FILL, SoundSource.BLOCKS, 1.0F, 1.0F); - if (stack.isEmpty()) { - player.setItemInHand(hand, new ItemStack(Items.HONEY_BOTTLE)); + if (itemStack.isEmpty()) { + player.setItemInHand(interactionHand, new ItemStack(Items.HONEY_BOTTLE)); } else if (!player.getInventory().add(new ItemStack(Items.HONEY_BOTTLE))) { player.drop(new ItemStack(Items.HONEY_BOTTLE), false); } bl = true; - level.gameEvent(player, GameEvent.FLUID_PICKUP, pos); + level.gameEvent(player, GameEvent.FLUID_PICKUP, blockPos); } if (!level.isClientSide() && bl) { @@ -151,19 +167,19 @@ public class BeehiveBlock extends BaseEntityBlock { } if (bl) { - if (!CampfireBlock.isSmokeyPos(level, pos)) { - if (this.hiveContainsBees(level, pos)) { - this.angerNearbyBees(level, pos); + if (!CampfireBlock.isSmokeyPos(level, blockPos)) { + if (this.hiveContainsBees(level, blockPos)) { + this.angerNearbyBees(level, blockPos); } - this.releaseBeesAndResetHoneyLevel(level, state, pos, player, BeehiveBlockEntity.BeeReleaseStatus.EMERGENCY); + this.releaseBeesAndResetHoneyLevel(level, blockState, blockPos, player, BeehiveBlockEntity.BeeReleaseStatus.EMERGENCY); } else { - this.resetHoneyLevel(level, state, pos); + this.resetHoneyLevel(level, blockState, blockPos); } - return ItemInteractionResult.sidedSuccess(level.isClientSide); + return InteractionResult.SUCCESS; } else { - return super.useItemOn(stack, state, level, pos, player, hand, hitResult); + return super.useItemOn(itemStack, blockState, level, blockPos, player, interactionHand, blockHitResult); } } @@ -260,9 +276,9 @@ public class BeehiveBlock extends BaseEntityBlock { @Override public BlockState playerWillDestroy(Level level, BlockPos pos, BlockState state, Player player) { - if (!level.isClientSide + if (level instanceof ServerLevel serverLevel && player.isCreative() - && level.getGameRules().getBoolean(GameRules.RULE_DOBLOCKDROPS) + && serverLevel.getGameRules().getBoolean(GameRules.RULE_DOBLOCKDROPS) && level.getBlockEntity(pos) instanceof BeehiveBlockEntity beehiveBlockEntity) { int i = (Integer)state.getValue(HONEY_LEVEL); boolean bl = !beehiveBlockEntity.isEmpty(); @@ -297,12 +313,22 @@ public class BeehiveBlock extends BaseEntityBlock { } @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { - if (level.getBlockState(neighborPos).getBlock() instanceof FireBlock && level.getBlockEntity(pos) instanceof BeehiveBlockEntity beehiveBlockEntity) { - beehiveBlockEntity.emptyAllLivingFromHive(null, state, BeehiveBlockEntity.BeeReleaseStatus.EMERGENCY); + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { + if (levelReader.getBlockState(blockPos2).getBlock() instanceof FireBlock + && levelReader.getBlockEntity(blockPos) instanceof BeehiveBlockEntity beehiveBlockEntity) { + beehiveBlockEntity.emptyAllLivingFromHive(null, blockState, BeehiveBlockEntity.BeeReleaseStatus.EMERGENCY); } - return super.updateShape(state, direction, neighborState, level, pos, neighborPos); + return super.updateShape(blockState, levelReader, scheduledTickAccess, blockPos, direction, blockPos2, blockState2, randomSource); } @Override @@ -314,4 +340,14 @@ public class BeehiveBlock extends BaseEntityBlock { public BlockState mirror(BlockState state, Mirror mirror) { return state.rotate(mirror.getRotation(state.getValue(FACING))); } + + @Override + public void appendHoverText(ItemStack stack, Item.TooltipContext context, List tooltipComponents, TooltipFlag tooltipFlag) { + super.appendHoverText(stack, context, tooltipComponents, tooltipFlag); + BlockItemStateProperties blockItemStateProperties = stack.getOrDefault(DataComponents.BLOCK_STATE, BlockItemStateProperties.EMPTY); + int i = (Integer)Objects.requireNonNullElse((Integer)blockItemStateProperties.get(HONEY_LEVEL), 0); + int j = stack.getOrDefault(DataComponents.BEES, List.of()).size(); + tooltipComponents.add(Component.translatable("container.beehive.bees", j, 3).withStyle(ChatFormatting.GRAY)); + tooltipComponents.add(Component.translatable("container.beehive.honey", i, 5).withStyle(ChatFormatting.GRAY)); + } } diff --git a/net/minecraft/world/level/block/BellBlock.java b/net/minecraft/world/level/block/BellBlock.java index 49003565..88832db7 100644 --- a/net/minecraft/world/level/block/BellBlock.java +++ b/net/minecraft/world/level/block/BellBlock.java @@ -4,9 +4,11 @@ import com.mojang.serialization.MapCodec; import java.util.function.BiConsumer; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; +import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; import net.minecraft.stats.Stats; +import net.minecraft.util.RandomSource; import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.player.Player; @@ -16,8 +18,8 @@ import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Explosion; import net.minecraft.world.level.Level; -import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.entity.BellBlockEntity; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntityTicker; @@ -28,10 +30,10 @@ import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.block.state.properties.BellAttachType; import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.block.state.properties.BooleanProperty; -import net.minecraft.world.level.block.state.properties.DirectionProperty; import net.minecraft.world.level.block.state.properties.EnumProperty; import net.minecraft.world.level.gameevent.GameEvent; import net.minecraft.world.level.pathfinder.PathComputationType; +import net.minecraft.world.level.redstone.Orientation; import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.Shapes; @@ -40,7 +42,7 @@ import org.jetbrains.annotations.Nullable; public class BellBlock extends BaseEntityBlock { public static final MapCodec CODEC = simpleCodec(BellBlock::new); - public static final DirectionProperty FACING = HorizontalDirectionalBlock.FACING; + public static final EnumProperty FACING = HorizontalDirectionalBlock.FACING; public static final EnumProperty ATTACHMENT = BlockStateProperties.BELL_ATTACHMENT; public static final BooleanProperty POWERED = BlockStateProperties.POWERED; private static final VoxelShape NORTH_SOUTH_FLOOR_SHAPE = Block.box(0.0, 0.0, 4.0, 16.0, 16.0, 12.0); @@ -68,14 +70,14 @@ public class BellBlock extends BaseEntityBlock { } @Override - protected void neighborChanged(BlockState state, Level level, BlockPos pos, Block neighborBlock, BlockPos neighborPos, boolean movedByPiston) { - boolean bl = level.hasNeighborSignal(pos); - if (bl != (Boolean)state.getValue(POWERED)) { - if (bl) { - this.attemptToRing(level, pos, null); + protected void neighborChanged(BlockState blockState, Level level, BlockPos blockPos, Block block, @Nullable Orientation orientation, boolean bl) { + boolean bl2 = level.hasNeighborSignal(blockPos); + if (bl2 != (Boolean)blockState.getValue(POWERED)) { + if (bl2) { + this.attemptToRing(level, blockPos, null); } - level.setBlock(pos, state.setValue(POWERED, bl), 3); + level.setBlock(blockPos, blockState.setValue(POWERED, bl2), 3); } } @@ -88,7 +90,7 @@ public class BellBlock extends BaseEntityBlock { @Override protected InteractionResult useWithoutItem(BlockState state, Level level, BlockPos pos, Player player, BlockHitResult hitResult) { - return this.onHit(level, state, hitResult, player, true) ? InteractionResult.sidedSuccess(level.isClientSide) : InteractionResult.PASS; + return (InteractionResult)(this.onHit(level, state, hitResult, player, true) ? InteractionResult.SUCCESS : InteractionResult.PASS); } public boolean onHit(Level level, BlockState state, BlockHitResult result, @Nullable Player player, boolean canRingBell) { @@ -222,34 +224,45 @@ public class BellBlock extends BaseEntityBlock { } @Override - protected void onExplosionHit(BlockState state, Level level, BlockPos pos, Explosion explosion, BiConsumer dropConsumer) { + protected void onExplosionHit( + BlockState blockState, ServerLevel serverLevel, BlockPos blockPos, Explosion explosion, BiConsumer biConsumer + ) { if (explosion.canTriggerBlocks()) { - this.attemptToRing(level, pos, null); + this.attemptToRing(serverLevel, blockPos, null); } - super.onExplosionHit(state, level, pos, explosion, dropConsumer); + super.onExplosionHit(blockState, serverLevel, blockPos, explosion, biConsumer); } @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { - BellAttachType bellAttachType = state.getValue(ATTACHMENT); - Direction direction2 = getConnectedDirection(state).getOpposite(); - if (direction2 == direction && !state.canSurvive(level, pos) && bellAttachType != BellAttachType.DOUBLE_WALL) { + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { + BellAttachType bellAttachType = blockState.getValue(ATTACHMENT); + Direction direction2 = getConnectedDirection(blockState).getOpposite(); + if (direction2 == direction && !blockState.canSurvive(levelReader, blockPos) && bellAttachType != BellAttachType.DOUBLE_WALL) { return Blocks.AIR.defaultBlockState(); } else { - if (direction.getAxis() == ((Direction)state.getValue(FACING)).getAxis()) { - if (bellAttachType == BellAttachType.DOUBLE_WALL && !neighborState.isFaceSturdy(level, neighborPos, direction)) { - return state.setValue(ATTACHMENT, BellAttachType.SINGLE_WALL).setValue(FACING, direction.getOpposite()); + if (direction.getAxis() == ((Direction)blockState.getValue(FACING)).getAxis()) { + if (bellAttachType == BellAttachType.DOUBLE_WALL && !blockState2.isFaceSturdy(levelReader, blockPos2, direction)) { + return blockState.setValue(ATTACHMENT, BellAttachType.SINGLE_WALL).setValue(FACING, direction.getOpposite()); } if (bellAttachType == BellAttachType.SINGLE_WALL && direction2.getOpposite() == direction - && neighborState.isFaceSturdy(level, neighborPos, state.getValue(FACING))) { - return state.setValue(ATTACHMENT, BellAttachType.DOUBLE_WALL); + && blockState2.isFaceSturdy(levelReader, blockPos2, blockState.getValue(FACING))) { + return blockState.setValue(ATTACHMENT, BellAttachType.DOUBLE_WALL); } } - return super.updateShape(state, direction, neighborState, level, pos, neighborPos); + return super.updateShape(blockState, levelReader, scheduledTickAccess, blockPos, direction, blockPos2, blockState2, randomSource); } } diff --git a/net/minecraft/world/level/block/BigDripleafBlock.java b/net/minecraft/world/level/block/BigDripleafBlock.java index 944e2101..25a4f143 100644 --- a/net/minecraft/world/level/block/BigDripleafBlock.java +++ b/net/minecraft/world/level/block/BigDripleafBlock.java @@ -23,6 +23,7 @@ import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.LevelHeightAccessor; import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; @@ -33,6 +34,7 @@ import net.minecraft.world.level.block.state.properties.Tilt; import net.minecraft.world.level.gameevent.GameEvent; import net.minecraft.world.level.material.FluidState; import net.minecraft.world.level.material.Fluids; +import net.minecraft.world.level.redstone.Orientation; import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.shapes.BooleanOp; import net.minecraft.world.phys.shapes.CollisionContext; @@ -145,17 +147,26 @@ public class BigDripleafBlock extends HorizontalDirectionalBlock implements Bone } @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { - if (direction == Direction.DOWN && !state.canSurvive(level, pos)) { + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { + if (direction == Direction.DOWN && !blockState.canSurvive(levelReader, blockPos)) { return Blocks.AIR.defaultBlockState(); } else { - if ((Boolean)state.getValue(WATERLOGGED)) { - level.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(level)); + if ((Boolean)blockState.getValue(WATERLOGGED)) { + scheduledTickAccess.scheduleTick(blockPos, Fluids.WATER, Fluids.WATER.getTickDelay(levelReader)); } - return direction == Direction.UP && neighborState.is(this) - ? Blocks.BIG_DRIPLEAF_STEM.withPropertiesOf(state) - : super.updateShape(state, direction, neighborState, level, pos, neighborPos); + return direction == Direction.UP && blockState2.is(this) + ? Blocks.BIG_DRIPLEAF_STEM.withPropertiesOf(blockState) + : super.updateShape(blockState, levelReader, scheduledTickAccess, blockPos, direction, blockPos2, blockState2, randomSource); } } @@ -207,9 +218,9 @@ public class BigDripleafBlock extends HorizontalDirectionalBlock implements Bone } @Override - protected void neighborChanged(BlockState state, Level level, BlockPos pos, Block neighborBlock, BlockPos neighborPos, boolean movedByPiston) { - if (level.hasNeighborSignal(pos)) { - resetTilt(state, level, pos); + protected void neighborChanged(BlockState blockState, Level level, BlockPos blockPos, Block block, @Nullable Orientation orientation, boolean bl) { + if (level.hasNeighborSignal(blockPos)) { + resetTilt(blockState, level, blockPos); } } diff --git a/net/minecraft/world/level/block/BigDripleafStemBlock.java b/net/minecraft/world/level/block/BigDripleafStemBlock.java index 3c67b7c7..003765a8 100644 --- a/net/minecraft/world/level/block/BigDripleafStemBlock.java +++ b/net/minecraft/world/level/block/BigDripleafStemBlock.java @@ -13,6 +13,7 @@ import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; @@ -84,16 +85,25 @@ public class BigDripleafStemBlock extends HorizontalDirectionalBlock implements } @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { - if ((direction == Direction.DOWN || direction == Direction.UP) && !state.canSurvive(level, pos)) { - level.scheduleTick(pos, this, 1); + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { + if ((direction == Direction.DOWN || direction == Direction.UP) && !blockState.canSurvive(levelReader, blockPos)) { + scheduledTickAccess.scheduleTick(blockPos, this, 1); } - if ((Boolean)state.getValue(WATERLOGGED)) { - level.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(level)); + if ((Boolean)blockState.getValue(WATERLOGGED)) { + scheduledTickAccess.scheduleTick(blockPos, Fluids.WATER, Fluids.WATER.getTickDelay(levelReader)); } - return super.updateShape(state, direction, neighborState, level, pos, neighborPos); + return super.updateShape(blockState, levelReader, scheduledTickAccess, blockPos, direction, blockPos2, blockState2, randomSource); } @Override diff --git a/net/minecraft/world/level/block/Block.java b/net/minecraft/world/level/block/Block.java index f03ceeb5..5a25e77e 100644 --- a/net/minecraft/world/level/block/Block.java +++ b/net/minecraft/world/level/block/Block.java @@ -11,7 +11,6 @@ import java.util.List; import java.util.function.Function; import java.util.function.Supplier; import net.minecraft.SharedConstants; -import net.minecraft.Util; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.Holder; @@ -52,6 +51,7 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.block.state.properties.Property; import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.level.gameevent.GameEvent.Context; import net.minecraft.world.level.storage.loot.LootParams; import net.minecraft.world.level.storage.loot.parameters.LootContextParams; import net.minecraft.world.phys.Vec3; @@ -81,6 +81,7 @@ public class Block extends BlockBehaviour implements ItemLike { public static final int UPDATE_KNOWN_SHAPE = 16; public static final int UPDATE_SUPPRESS_DROPS = 32; public static final int UPDATE_MOVE_BY_PISTON = 64; + public static final int UPDATE_SKIP_SHAPE_UPDATE_ON_WIRE = 128; public static final int UPDATE_NONE = 4; public static final int UPDATE_ALL = 3; public static final int UPDATE_ALL_IMMEDIATE = 11; @@ -90,12 +91,10 @@ public class Block extends BlockBehaviour implements ItemLike { protected final StateDefinition stateDefinition; private BlockState defaultBlockState; @Nullable - private String descriptionId; - @Nullable private Item item; - private static final int CACHE_SIZE = 2048; - private static final ThreadLocal> OCCLUSION_CACHE = ThreadLocal.withInitial(() -> { - Object2ByteLinkedOpenHashMap object2ByteLinkedOpenHashMap = new Object2ByteLinkedOpenHashMap(2048, 0.25F) { + private static final int CACHE_SIZE = 256; + private static final ThreadLocal> OCCLUSION_CACHE = ThreadLocal.withInitial(() -> { + Object2ByteLinkedOpenHashMap object2ByteLinkedOpenHashMap = new Object2ByteLinkedOpenHashMap(256, 0.25F) { @Override protected void rehash(int i) { } @@ -155,7 +154,7 @@ public class Block extends BlockBehaviour implements ItemLike { for (Direction direction : UPDATE_SHAPE_ORDER) { mutableBlockPos.setWithOffset(pos, direction); - blockState = blockState.updateShape(direction, level.getBlockState(mutableBlockPos), level, pos, mutableBlockPos); + blockState = blockState.updateShape(level, level, pos, direction, mutableBlockPos, level.getBlockState(mutableBlockPos), level.getRandom()); } return blockState; @@ -204,33 +203,34 @@ public class Block extends BlockBehaviour implements ItemLike { || state.is(BlockTags.SHULKER_BOXES); } - public static boolean shouldRenderFace(BlockState state, BlockGetter level, BlockPos offset, Direction face, BlockPos pos) { - BlockState blockState = level.getBlockState(pos); - if (state.skipRendering(blockState, face)) { + public static boolean shouldRenderFace(BlockState blockState, BlockState blockState2, Direction direction) { + VoxelShape voxelShape = blockState2.getFaceOcclusionShape(direction.getOpposite()); + if (voxelShape == Shapes.block()) { return false; - } else if (blockState.canOcclude()) { - Block.BlockStatePairKey blockStatePairKey = new Block.BlockStatePairKey(state, blockState, face); - Object2ByteLinkedOpenHashMap object2ByteLinkedOpenHashMap = (Object2ByteLinkedOpenHashMap)OCCLUSION_CACHE.get(); - byte b = object2ByteLinkedOpenHashMap.getAndMoveToFirst(blockStatePairKey); - if (b != 127) { - return b != 0; + } else if (blockState.skipRendering(blockState2, direction)) { + return false; + } else if (voxelShape == Shapes.empty()) { + return true; + } else { + VoxelShape voxelShape2 = blockState.getFaceOcclusionShape(direction); + if (voxelShape2 == Shapes.empty()) { + return true; } else { - VoxelShape voxelShape = state.getFaceOcclusionShape(level, offset, face); - if (voxelShape.isEmpty()) { - return true; + Block.ShapePairKey shapePairKey = new Block.ShapePairKey(voxelShape2, voxelShape); + Object2ByteLinkedOpenHashMap object2ByteLinkedOpenHashMap = (Object2ByteLinkedOpenHashMap)OCCLUSION_CACHE.get(); + byte b = object2ByteLinkedOpenHashMap.getAndMoveToFirst(shapePairKey); + if (b != 127) { + return b != 0; } else { - VoxelShape voxelShape2 = blockState.getFaceOcclusionShape(level, pos, face.getOpposite()); - boolean bl = Shapes.joinIsNotEmpty(voxelShape, voxelShape2, BooleanOp.ONLY_FIRST); - if (object2ByteLinkedOpenHashMap.size() == 2048) { + boolean bl = Shapes.joinIsNotEmpty(voxelShape2, voxelShape, BooleanOp.ONLY_FIRST); + if (object2ByteLinkedOpenHashMap.size() == 256) { object2ByteLinkedOpenHashMap.removeLastByte(); } - object2ByteLinkedOpenHashMap.putAndMoveToFirst(blockStatePairKey, (byte)(bl ? 1 : 0)); + object2ByteLinkedOpenHashMap.putAndMoveToFirst(shapePairKey, (byte)(bl ? 1 : 0)); return bl; } } - } else { - return true; } } @@ -342,7 +342,7 @@ public class Block extends BlockBehaviour implements ItemLike { } private static void popResource(Level level, Supplier itemEntitySupplier, ItemStack stack) { - if (!level.isClientSide && !stack.isEmpty() && level.getGameRules().getBoolean(GameRules.RULE_DOBLOCKDROPS)) { + if (level instanceof ServerLevel serverLevel && !stack.isEmpty() && serverLevel.getGameRules().getBoolean(GameRules.RULE_DOBLOCKDROPS)) { ItemEntity itemEntity = (ItemEntity)itemEntitySupplier.get(); itemEntity.setDefaultPickUpDelay(); level.addFreshEntity(itemEntity); @@ -365,10 +365,7 @@ public class Block extends BlockBehaviour implements ItemLike { return this.explosionResistance; } - /** - * Called when this Block is destroyed by an Explosion - */ - public void wasExploded(Level level, BlockPos pos, Explosion explosion) { + public void wasExploded(ServerLevel serverLevel, BlockPos blockPos, Explosion explosion) { } public void stepOn(Level level, BlockPos pos, BlockState state, Entity entity) { @@ -402,26 +399,11 @@ public class Block extends BlockBehaviour implements ItemLike { return Component.translatable(this.getDescriptionId()); } - /** - * @return the description ID of this block, for use with language files. - */ - public String getDescriptionId() { - if (this.descriptionId == null) { - this.descriptionId = Util.makeDescriptionId("block", BuiltInRegistries.BLOCK.getKey(this)); - } - - return this.descriptionId; - } - public void fallOn(Level level, BlockState state, BlockPos pos, Entity entity, float fallDistance) { entity.causeFallDamage(fallDistance, 1.0F, entity.damageSources().fall()); } - /** - * Called when an Entity lands on this Block. - * This method is responsible for doing any modification on the motion of the entity that should result from the landing. - */ - public void updateEntityAfterFallOn(BlockGetter level, Entity entity) { + public void updateEntityMovementAfterFallOn(BlockGetter blockGetter, Entity entity) { entity.setDeltaMovement(entity.getDeltaMovement().multiply(1.0, 0.0, 1.0)); } @@ -447,11 +429,11 @@ public class Block extends BlockBehaviour implements ItemLike { public BlockState playerWillDestroy(Level level, BlockPos pos, BlockState state, Player player) { this.spawnDestroyParticles(level, player, pos, state); - if (state.is(BlockTags.GUARDED_BY_PIGLINS)) { - PiglinAi.angerNearbyPiglins(player, false); + if (state.is(BlockTags.GUARDED_BY_PIGLINS) && level instanceof ServerLevel serverLevel) { + PiglinAi.angerNearbyPiglins(serverLevel, player, false); } - level.gameEvent(GameEvent.BLOCK_DESTROY, pos, GameEvent.Context.of(player, state)); + level.gameEvent(GameEvent.BLOCK_DESTROY, pos, Context.of(player, state)); return state; } @@ -543,31 +525,13 @@ public class Block extends BlockBehaviour implements ItemLike { } } - public static final class BlockStatePairKey { - private final BlockState first; - private final BlockState second; - private final Direction direction; - - public BlockStatePairKey(BlockState first, BlockState second, Direction direction) { - this.first = first; - this.second = second; - this.direction = direction; - } - + record ShapePairKey(VoxelShape first, VoxelShape second) { public boolean equals(Object object) { - if (this == object) { - return true; - } else { - return !(object instanceof Block.BlockStatePairKey blockStatePairKey) - ? false - : this.first == blockStatePairKey.first && this.second == blockStatePairKey.second && this.direction == blockStatePairKey.direction; - } + return object instanceof Block.ShapePairKey shapePairKey && this.first == shapePairKey.first && this.second == shapePairKey.second; } public int hashCode() { - int i = this.first.hashCode(); - i = 31 * i + this.second.hashCode(); - return 31 * i + this.direction.hashCode(); + return System.identityHashCode(this.first) * 31 + System.identityHashCode(this.second); } } } diff --git a/net/minecraft/world/level/block/BlockTypes.java b/net/minecraft/world/level/block/BlockTypes.java index a8e3d9bc..592b17b0 100644 --- a/net/minecraft/world/level/block/BlockTypes.java +++ b/net/minecraft/world/level/block/BlockTypes.java @@ -49,7 +49,6 @@ public class BlockTypes { Registry.register(registry, "carpet", CarpetBlock.CODEC); Registry.register(registry, "carrot", CarrotBlock.CODEC); Registry.register(registry, "cartography_table", CartographyTableBlock.CODEC); - Registry.register(registry, "carved_pumpkin", EquipableCarvedPumpkinBlock.CODEC); Registry.register(registry, "cauldron", CauldronBlock.CODEC); Registry.register(registry, "cave_vines", CaveVinesBlock.CODEC); Registry.register(registry, "cave_vines_plant", CaveVinesPlantBlock.CODEC); @@ -94,6 +93,7 @@ public class BlockTypes { Registry.register(registry, "end_portal_frame", EndPortalFrameBlock.CODEC); Registry.register(registry, "end_rod", EndRodBlock.CODEC); Registry.register(registry, "farm", FarmBlock.CODEC); + Registry.register(registry, "bonemealable_feature_placer", BonemealableFeaturePlacerBlock.CODEC); Registry.register(registry, "fence", FenceBlock.CODEC); Registry.register(registry, "fence_gate", FenceGateBlock.CODEC); Registry.register(registry, "fire", FireBlock.CODEC); @@ -109,6 +109,7 @@ public class BlockTypes { Registry.register(registry, "grass", GrassBlock.CODEC); Registry.register(registry, "grindstone", GrindstoneBlock.CODEC); Registry.register(registry, "half_transparent", HalfTransparentBlock.CODEC); + Registry.register(registry, "hanging_moss", HangingMossBlock.CODEC); Registry.register(registry, "hanging_roots", HangingRootsBlock.CODEC); Registry.register(registry, "hay", HayBlock.CODEC); Registry.register(registry, "heavy_core", HeavyCoreBlock.CODEC); @@ -139,7 +140,7 @@ public class BlockTypes { Registry.register(registry, "mangrove_leaves", MangroveLeavesBlock.CODEC); Registry.register(registry, "mangrove_propagule", MangrovePropaguleBlock.CODEC); Registry.register(registry, "mangrove_roots", MangroveRootsBlock.CODEC); - Registry.register(registry, "moss", MossBlock.CODEC); + Registry.register(registry, "mossy_carpet", MossyCarpetBlock.CODEC); Registry.register(registry, "moving_piston", MovingPistonBlock.CODEC); Registry.register(registry, "mud", MudBlock.CODEC); Registry.register(registry, "mushroom", MushroomBlock.CODEC); @@ -198,6 +199,7 @@ public class BlockTypes { Registry.register(registry, "soul_fire", SoulFireBlock.CODEC); Registry.register(registry, "soul_sand", SoulSandBlock.CODEC); Registry.register(registry, "spawner", SpawnerBlock.CODEC); + Registry.register(registry, "creaking_heart", CreakingHeartBlock.CODEC); Registry.register(registry, "sponge", SpongeBlock.CODEC); Registry.register(registry, "spore_blossom", SporeBlossomBlock.CODEC); Registry.register(registry, "stained_glass_pane", StainedGlassPaneBlock.CODEC); diff --git a/net/minecraft/world/level/block/Blocks.java b/net/minecraft/world/level/block/Blocks.java index 43c375c5..c58e6008 100644 --- a/net/minecraft/world/level/block/Blocks.java +++ b/net/minecraft/world/level/block/Blocks.java @@ -8,15 +8,20 @@ import net.minecraft.core.Registry; import net.minecraft.core.cauldron.CauldronInteraction; import net.minecraft.core.particles.ParticleTypes; import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.core.registries.Registries; +import net.minecraft.data.worldgen.features.CaveFeatures; import net.minecraft.data.worldgen.features.TreeFeatures; +import net.minecraft.data.worldgen.features.VegetationFeatures; import net.minecraft.references.Items; import net.minecraft.resources.ResourceKey; +import net.minecraft.resources.ResourceLocation; import net.minecraft.sounds.SoundEvents; import net.minecraft.util.ColorRGBA; import net.minecraft.util.valueproviders.ConstantInt; import net.minecraft.util.valueproviders.UniformInt; import net.minecraft.world.effect.MobEffects; import net.minecraft.world.entity.EntityType; +import net.minecraft.world.flag.FeatureFlags; import net.minecraft.world.item.DyeColor; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.biome.Biome; @@ -39,6960 +44,6316 @@ import net.minecraft.world.level.block.state.properties.WoodType; import net.minecraft.world.level.material.Fluids; import net.minecraft.world.level.material.MapColor; import net.minecraft.world.level.material.PushReaction; -import org.jetbrains.annotations.Nullable; public class Blocks { private static final BlockBehaviour.StatePredicate NOT_CLOSED_SHULKER = (blockStatex, blockGetter, blockPos) -> blockGetter.getBlockEntity(blockPos) instanceof ShulkerBoxBlockEntity shulkerBoxBlockEntity ? shulkerBoxBlockEntity.isClosed() : true; - public static final Block AIR = register("air", new AirBlock(BlockBehaviour.Properties.of().replaceable().noCollission().noLootTable().air())); + private static final BlockBehaviour.StatePredicate NOT_EXTENDED_PISTON = (blockStatex, blockGetter, blockPos) -> !(Boolean)blockStatex.getValue( + PistonBaseBlock.EXTENDED + ); + public static final Block AIR = register("air", AirBlock::new, BlockBehaviour.Properties.of().replaceable().noCollission().noLootTable().air()); public static final Block STONE = register( - "stone", - new Block(BlockBehaviour.Properties.of().mapColor(MapColor.STONE).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(1.5F, 6.0F)) + "stone", BlockBehaviour.Properties.of().mapColor(MapColor.STONE).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(1.5F, 6.0F) ); public static final Block GRANITE = register( - "granite", - new Block(BlockBehaviour.Properties.of().mapColor(MapColor.DIRT).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(1.5F, 6.0F)) + "granite", BlockBehaviour.Properties.of().mapColor(MapColor.DIRT).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(1.5F, 6.0F) ); public static final Block POLISHED_GRANITE = register( "polished_granite", - new Block(BlockBehaviour.Properties.of().mapColor(MapColor.DIRT).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(1.5F, 6.0F)) + BlockBehaviour.Properties.of().mapColor(MapColor.DIRT).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(1.5F, 6.0F) ); public static final Block DIORITE = register( "diorite", - new Block( - BlockBehaviour.Properties.of().mapColor(MapColor.QUARTZ).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(1.5F, 6.0F) - ) + BlockBehaviour.Properties.of().mapColor(MapColor.QUARTZ).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(1.5F, 6.0F) ); public static final Block POLISHED_DIORITE = register( "polished_diorite", - new Block( - BlockBehaviour.Properties.of().mapColor(MapColor.QUARTZ).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(1.5F, 6.0F) - ) + BlockBehaviour.Properties.of().mapColor(MapColor.QUARTZ).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(1.5F, 6.0F) ); public static final Block ANDESITE = register( "andesite", - new Block(BlockBehaviour.Properties.of().mapColor(MapColor.STONE).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(1.5F, 6.0F)) + BlockBehaviour.Properties.of().mapColor(MapColor.STONE).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(1.5F, 6.0F) ); public static final Block POLISHED_ANDESITE = register( "polished_andesite", - new Block(BlockBehaviour.Properties.of().mapColor(MapColor.STONE).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(1.5F, 6.0F)) + BlockBehaviour.Properties.of().mapColor(MapColor.STONE).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(1.5F, 6.0F) ); public static final Block GRASS_BLOCK = register( - "grass_block", new GrassBlock(BlockBehaviour.Properties.of().mapColor(MapColor.GRASS).randomTicks().strength(0.6F).sound(SoundType.GRASS)) - ); - public static final Block DIRT = register("dirt", new Block(BlockBehaviour.Properties.of().mapColor(MapColor.DIRT).strength(0.5F).sound(SoundType.GRAVEL))); - public static final Block COARSE_DIRT = register( - "coarse_dirt", new Block(BlockBehaviour.Properties.of().mapColor(MapColor.DIRT).strength(0.5F).sound(SoundType.GRAVEL)) + "grass_block", GrassBlock::new, BlockBehaviour.Properties.of().mapColor(MapColor.GRASS).randomTicks().strength(0.6F).sound(SoundType.GRASS) ); + public static final Block DIRT = register("dirt", BlockBehaviour.Properties.of().mapColor(MapColor.DIRT).strength(0.5F).sound(SoundType.GRAVEL)); + public static final Block COARSE_DIRT = register("coarse_dirt", BlockBehaviour.Properties.of().mapColor(MapColor.DIRT).strength(0.5F).sound(SoundType.GRAVEL)); public static final Block PODZOL = register( - "podzol", new SnowyDirtBlock(BlockBehaviour.Properties.of().mapColor(MapColor.PODZOL).strength(0.5F).sound(SoundType.GRAVEL)) + "podzol", SnowyDirtBlock::new, BlockBehaviour.Properties.of().mapColor(MapColor.PODZOL).strength(0.5F).sound(SoundType.GRAVEL) ); public static final Block COBBLESTONE = register( "cobblestone", - new Block(BlockBehaviour.Properties.of().mapColor(MapColor.STONE).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(2.0F, 6.0F)) + BlockBehaviour.Properties.of().mapColor(MapColor.STONE).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(2.0F, 6.0F) ); public static final Block OAK_PLANKS = register( "oak_planks", - new Block( - BlockBehaviour.Properties.of().mapColor(MapColor.WOOD).instrument(NoteBlockInstrument.BASS).strength(2.0F, 3.0F).sound(SoundType.WOOD).ignitedByLava() - ) + BlockBehaviour.Properties.of().mapColor(MapColor.WOOD).instrument(NoteBlockInstrument.BASS).strength(2.0F, 3.0F).sound(SoundType.WOOD).ignitedByLava() ); public static final Block SPRUCE_PLANKS = register( "spruce_planks", - new Block( - BlockBehaviour.Properties.of().mapColor(MapColor.PODZOL).instrument(NoteBlockInstrument.BASS).strength(2.0F, 3.0F).sound(SoundType.WOOD).ignitedByLava() - ) + BlockBehaviour.Properties.of().mapColor(MapColor.PODZOL).instrument(NoteBlockInstrument.BASS).strength(2.0F, 3.0F).sound(SoundType.WOOD).ignitedByLava() ); public static final Block BIRCH_PLANKS = register( "birch_planks", - new Block( - BlockBehaviour.Properties.of().mapColor(MapColor.SAND).instrument(NoteBlockInstrument.BASS).strength(2.0F, 3.0F).sound(SoundType.WOOD).ignitedByLava() - ) + BlockBehaviour.Properties.of().mapColor(MapColor.SAND).instrument(NoteBlockInstrument.BASS).strength(2.0F, 3.0F).sound(SoundType.WOOD).ignitedByLava() ); public static final Block JUNGLE_PLANKS = register( "jungle_planks", - new Block( - BlockBehaviour.Properties.of().mapColor(MapColor.DIRT).instrument(NoteBlockInstrument.BASS).strength(2.0F, 3.0F).sound(SoundType.WOOD).ignitedByLava() - ) + BlockBehaviour.Properties.of().mapColor(MapColor.DIRT).instrument(NoteBlockInstrument.BASS).strength(2.0F, 3.0F).sound(SoundType.WOOD).ignitedByLava() ); public static final Block ACACIA_PLANKS = register( "acacia_planks", - new Block( - BlockBehaviour.Properties.of() - .mapColor(MapColor.COLOR_ORANGE) - .instrument(NoteBlockInstrument.BASS) - .strength(2.0F, 3.0F) - .sound(SoundType.WOOD) - .ignitedByLava() - ) + BlockBehaviour.Properties.of() + .mapColor(MapColor.COLOR_ORANGE) + .instrument(NoteBlockInstrument.BASS) + .strength(2.0F, 3.0F) + .sound(SoundType.WOOD) + .ignitedByLava() ); public static final Block CHERRY_PLANKS = register( "cherry_planks", - new Block( - BlockBehaviour.Properties.of() - .mapColor(MapColor.TERRACOTTA_WHITE) - .instrument(NoteBlockInstrument.BASS) - .strength(2.0F, 3.0F) - .sound(SoundType.CHERRY_WOOD) - .ignitedByLava() - ) + BlockBehaviour.Properties.of() + .mapColor(MapColor.TERRACOTTA_WHITE) + .instrument(NoteBlockInstrument.BASS) + .strength(2.0F, 3.0F) + .sound(SoundType.CHERRY_WOOD) + .ignitedByLava() ); public static final Block DARK_OAK_PLANKS = register( "dark_oak_planks", - new Block( - BlockBehaviour.Properties.of() - .mapColor(MapColor.COLOR_BROWN) - .instrument(NoteBlockInstrument.BASS) - .strength(2.0F, 3.0F) - .sound(SoundType.WOOD) - .ignitedByLava() - ) + BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_BROWN).instrument(NoteBlockInstrument.BASS).strength(2.0F, 3.0F).sound(SoundType.WOOD).ignitedByLava() + ); + public static final Block PALE_OAK_WOOD = register( + "pale_oak_wood", + RotatedPillarBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.STONE) + .instrument(NoteBlockInstrument.BASS) + .strength(2.0F) + .sound(SoundType.WOOD) + .ignitedByLava() + .requiredFeatures(FeatureFlags.WINTER_DROP) + ); + public static final Block PALE_OAK_PLANKS = register( + "pale_oak_planks", + BlockBehaviour.Properties.of() + .mapColor(MapColor.QUARTZ) + .instrument(NoteBlockInstrument.BASS) + .strength(2.0F, 3.0F) + .sound(SoundType.WOOD) + .ignitedByLava() + .requiredFeatures(FeatureFlags.WINTER_DROP) ); public static final Block MANGROVE_PLANKS = register( "mangrove_planks", - new Block( - BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_RED).instrument(NoteBlockInstrument.BASS).strength(2.0F, 3.0F).sound(SoundType.WOOD).ignitedByLava() - ) + BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_RED).instrument(NoteBlockInstrument.BASS).strength(2.0F, 3.0F).sound(SoundType.WOOD).ignitedByLava() ); public static final Block BAMBOO_PLANKS = register( "bamboo_planks", - new Block( - BlockBehaviour.Properties.of() - .mapColor(MapColor.COLOR_YELLOW) - .instrument(NoteBlockInstrument.BASS) - .strength(2.0F, 3.0F) - .sound(SoundType.BAMBOO_WOOD) - .ignitedByLava() - ) + BlockBehaviour.Properties.of() + .mapColor(MapColor.COLOR_YELLOW) + .instrument(NoteBlockInstrument.BASS) + .strength(2.0F, 3.0F) + .sound(SoundType.BAMBOO_WOOD) + .ignitedByLava() ); public static final Block BAMBOO_MOSAIC = register( "bamboo_mosaic", - new Block( - BlockBehaviour.Properties.of() - .mapColor(MapColor.COLOR_YELLOW) - .instrument(NoteBlockInstrument.BASS) - .strength(2.0F, 3.0F) - .sound(SoundType.BAMBOO_WOOD) - .ignitedByLava() - ) + BlockBehaviour.Properties.of() + .mapColor(MapColor.COLOR_YELLOW) + .instrument(NoteBlockInstrument.BASS) + .strength(2.0F, 3.0F) + .sound(SoundType.BAMBOO_WOOD) + .ignitedByLava() ); public static final Block OAK_SAPLING = register( "oak_sapling", - new SaplingBlock( - TreeGrower.OAK, - BlockBehaviour.Properties.of().mapColor(MapColor.PLANT).noCollission().randomTicks().instabreak().sound(SoundType.GRASS).pushReaction(PushReaction.DESTROY) - ) + properties -> new SaplingBlock(TreeGrower.OAK, properties), + BlockBehaviour.Properties.of().mapColor(MapColor.PLANT).noCollission().randomTicks().instabreak().sound(SoundType.GRASS).pushReaction(PushReaction.DESTROY) ); public static final Block SPRUCE_SAPLING = register( "spruce_sapling", - new SaplingBlock( - TreeGrower.SPRUCE, - BlockBehaviour.Properties.of().mapColor(MapColor.PLANT).noCollission().randomTicks().instabreak().sound(SoundType.GRASS).pushReaction(PushReaction.DESTROY) - ) + properties -> new SaplingBlock(TreeGrower.SPRUCE, properties), + BlockBehaviour.Properties.of().mapColor(MapColor.PLANT).noCollission().randomTicks().instabreak().sound(SoundType.GRASS).pushReaction(PushReaction.DESTROY) ); public static final Block BIRCH_SAPLING = register( "birch_sapling", - new SaplingBlock( - TreeGrower.BIRCH, - BlockBehaviour.Properties.of().mapColor(MapColor.PLANT).noCollission().randomTicks().instabreak().sound(SoundType.GRASS).pushReaction(PushReaction.DESTROY) - ) + properties -> new SaplingBlock(TreeGrower.BIRCH, properties), + BlockBehaviour.Properties.of().mapColor(MapColor.PLANT).noCollission().randomTicks().instabreak().sound(SoundType.GRASS).pushReaction(PushReaction.DESTROY) ); public static final Block JUNGLE_SAPLING = register( "jungle_sapling", - new SaplingBlock( - TreeGrower.JUNGLE, - BlockBehaviour.Properties.of().mapColor(MapColor.PLANT).noCollission().randomTicks().instabreak().sound(SoundType.GRASS).pushReaction(PushReaction.DESTROY) - ) + properties -> new SaplingBlock(TreeGrower.JUNGLE, properties), + BlockBehaviour.Properties.of().mapColor(MapColor.PLANT).noCollission().randomTicks().instabreak().sound(SoundType.GRASS).pushReaction(PushReaction.DESTROY) ); public static final Block ACACIA_SAPLING = register( "acacia_sapling", - new SaplingBlock( - TreeGrower.ACACIA, - BlockBehaviour.Properties.of().mapColor(MapColor.PLANT).noCollission().randomTicks().instabreak().sound(SoundType.GRASS).pushReaction(PushReaction.DESTROY) - ) + properties -> new SaplingBlock(TreeGrower.ACACIA, properties), + BlockBehaviour.Properties.of().mapColor(MapColor.PLANT).noCollission().randomTicks().instabreak().sound(SoundType.GRASS).pushReaction(PushReaction.DESTROY) ); public static final Block CHERRY_SAPLING = register( "cherry_sapling", - new SaplingBlock( - TreeGrower.CHERRY, - BlockBehaviour.Properties.of() - .mapColor(MapColor.COLOR_PINK) - .noCollission() - .randomTicks() - .instabreak() - .sound(SoundType.CHERRY_SAPLING) - .pushReaction(PushReaction.DESTROY) - ) + properties -> new SaplingBlock(TreeGrower.CHERRY, properties), + BlockBehaviour.Properties.of() + .mapColor(MapColor.COLOR_PINK) + .noCollission() + .randomTicks() + .instabreak() + .sound(SoundType.CHERRY_SAPLING) + .pushReaction(PushReaction.DESTROY) ); public static final Block DARK_OAK_SAPLING = register( "dark_oak_sapling", - new SaplingBlock( - TreeGrower.DARK_OAK, - BlockBehaviour.Properties.of().mapColor(MapColor.PLANT).noCollission().randomTicks().instabreak().sound(SoundType.GRASS).pushReaction(PushReaction.DESTROY) - ) + properties -> new SaplingBlock(TreeGrower.DARK_OAK, properties), + BlockBehaviour.Properties.of().mapColor(MapColor.PLANT).noCollission().randomTicks().instabreak().sound(SoundType.GRASS).pushReaction(PushReaction.DESTROY) + ); + public static final Block PALE_OAK_SAPLING = register( + "pale_oak_sapling", + properties -> new SaplingBlock(TreeGrower.PALE_OAK, properties), + BlockBehaviour.Properties.of() + .mapColor(MapColor.QUARTZ) + .noCollission() + .randomTicks() + .instabreak() + .sound(SoundType.GRASS) + .pushReaction(PushReaction.DESTROY) + .requiredFeatures(FeatureFlags.WINTER_DROP) ); public static final Block MANGROVE_PROPAGULE = register( "mangrove_propagule", - new MangrovePropaguleBlock( - TreeGrower.MANGROVE, - BlockBehaviour.Properties.of() - .mapColor(MapColor.PLANT) - .noCollission() - .randomTicks() - .instabreak() - .sound(SoundType.GRASS) - .offsetType(BlockBehaviour.OffsetType.XZ) - .pushReaction(PushReaction.DESTROY) - ) + properties -> new MangrovePropaguleBlock(TreeGrower.MANGROVE, properties), + BlockBehaviour.Properties.of() + .mapColor(MapColor.PLANT) + .noCollission() + .randomTicks() + .instabreak() + .sound(SoundType.GRASS) + .offsetType(BlockBehaviour.OffsetType.XZ) + .pushReaction(PushReaction.DESTROY) ); public static final Block BEDROCK = register( "bedrock", - new Block( - BlockBehaviour.Properties.of() - .mapColor(MapColor.STONE) - .instrument(NoteBlockInstrument.BASEDRUM) - .strength(-1.0F, 3600000.0F) - .noLootTable() - .isValidSpawn(Blocks::never) - ) + BlockBehaviour.Properties.of() + .mapColor(MapColor.STONE) + .instrument(NoteBlockInstrument.BASEDRUM) + .strength(-1.0F, 3600000.0F) + .noLootTable() + .isValidSpawn(Blocks::never) ); public static final Block WATER = register( "water", - new LiquidBlock( - Fluids.WATER, - BlockBehaviour.Properties.of() - .mapColor(MapColor.WATER) - .replaceable() - .noCollission() - .strength(100.0F) - .pushReaction(PushReaction.DESTROY) - .noLootTable() - .liquid() - .sound(SoundType.EMPTY) - ) + properties -> new LiquidBlock(Fluids.WATER, properties), + BlockBehaviour.Properties.of() + .mapColor(MapColor.WATER) + .replaceable() + .noCollission() + .strength(100.0F) + .pushReaction(PushReaction.DESTROY) + .noLootTable() + .liquid() + .sound(SoundType.EMPTY) ); public static final Block LAVA = register( "lava", - new LiquidBlock( - Fluids.LAVA, - BlockBehaviour.Properties.of() - .mapColor(MapColor.FIRE) - .replaceable() - .noCollission() - .randomTicks() - .strength(100.0F) - .lightLevel(blockStatex -> 15) - .pushReaction(PushReaction.DESTROY) - .noLootTable() - .liquid() - .sound(SoundType.EMPTY) - ) + properties -> new LiquidBlock(Fluids.LAVA, properties), + BlockBehaviour.Properties.of() + .mapColor(MapColor.FIRE) + .replaceable() + .noCollission() + .randomTicks() + .strength(100.0F) + .lightLevel(blockStatex -> 15) + .pushReaction(PushReaction.DESTROY) + .noLootTable() + .liquid() + .sound(SoundType.EMPTY) ); public static final Block SAND = register( "sand", - new ColoredFallingBlock( - new ColorRGBA(14406560), BlockBehaviour.Properties.of().mapColor(MapColor.SAND).instrument(NoteBlockInstrument.SNARE).strength(0.5F).sound(SoundType.SAND) - ) + properties -> new ColoredFallingBlock(new ColorRGBA(14406560), properties), + BlockBehaviour.Properties.of().mapColor(MapColor.SAND).instrument(NoteBlockInstrument.SNARE).strength(0.5F).sound(SoundType.SAND) ); public static final Block SUSPICIOUS_SAND = register( "suspicious_sand", - new BrushableBlock( - SAND, - SoundEvents.BRUSH_SAND, - SoundEvents.BRUSH_SAND_COMPLETED, - BlockBehaviour.Properties.of() - .mapColor(MapColor.SAND) - .instrument(NoteBlockInstrument.SNARE) - .strength(0.25F) - .sound(SoundType.SUSPICIOUS_SAND) - .pushReaction(PushReaction.DESTROY) - ) + properties -> new BrushableBlock(SAND, SoundEvents.BRUSH_SAND, SoundEvents.BRUSH_SAND, properties), + BlockBehaviour.Properties.of() + .mapColor(MapColor.SAND) + .instrument(NoteBlockInstrument.SNARE) + .strength(0.25F) + .sound(SoundType.SUSPICIOUS_SAND) + .pushReaction(PushReaction.DESTROY) ); public static final Block RED_SAND = register( "red_sand", - new ColoredFallingBlock( - new ColorRGBA(11098145), - BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_ORANGE).instrument(NoteBlockInstrument.SNARE).strength(0.5F).sound(SoundType.SAND) - ) + properties -> new ColoredFallingBlock(new ColorRGBA(11098145), properties), + BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_ORANGE).instrument(NoteBlockInstrument.SNARE).strength(0.5F).sound(SoundType.SAND) ); public static final Block GRAVEL = register( "gravel", - new ColoredFallingBlock( - new ColorRGBA(-8356741), - BlockBehaviour.Properties.of().mapColor(MapColor.STONE).instrument(NoteBlockInstrument.SNARE).strength(0.6F).sound(SoundType.GRAVEL) - ) + properties -> new ColoredFallingBlock(new ColorRGBA(-8356741), properties), + BlockBehaviour.Properties.of().mapColor(MapColor.STONE).instrument(NoteBlockInstrument.SNARE).strength(0.6F).sound(SoundType.GRAVEL) ); public static final Block SUSPICIOUS_GRAVEL = register( "suspicious_gravel", - new BrushableBlock( - GRAVEL, - SoundEvents.BRUSH_GRAVEL, - SoundEvents.BRUSH_GRAVEL_COMPLETED, - BlockBehaviour.Properties.of() - .mapColor(MapColor.STONE) - .instrument(NoteBlockInstrument.SNARE) - .strength(0.25F) - .sound(SoundType.SUSPICIOUS_GRAVEL) - .pushReaction(PushReaction.DESTROY) - ) + properties -> new BrushableBlock(GRAVEL, SoundEvents.BRUSH_GRAVEL, SoundEvents.BRUSH_GRAVEL, properties), + BlockBehaviour.Properties.of() + .mapColor(MapColor.STONE) + .instrument(NoteBlockInstrument.SNARE) + .strength(0.25F) + .sound(SoundType.SUSPICIOUS_GRAVEL) + .pushReaction(PushReaction.DESTROY) ); public static final Block GOLD_ORE = register( "gold_ore", - new DropExperienceBlock( - ConstantInt.of(0), - BlockBehaviour.Properties.of().mapColor(MapColor.STONE).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(3.0F, 3.0F) - ) + properties -> new DropExperienceBlock(ConstantInt.of(0), properties), + BlockBehaviour.Properties.of().mapColor(MapColor.STONE).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(3.0F, 3.0F) ); public static final Block DEEPSLATE_GOLD_ORE = register( "deepslate_gold_ore", - new DropExperienceBlock( - ConstantInt.of(0), BlockBehaviour.Properties.ofLegacyCopy(GOLD_ORE).mapColor(MapColor.DEEPSLATE).strength(4.5F, 3.0F).sound(SoundType.DEEPSLATE) - ) + properties -> new DropExperienceBlock(ConstantInt.of(0), properties), + BlockBehaviour.Properties.ofLegacyCopy(GOLD_ORE).mapColor(MapColor.DEEPSLATE).strength(4.5F, 3.0F).sound(SoundType.DEEPSLATE) ); public static final Block IRON_ORE = register( "iron_ore", - new DropExperienceBlock( - ConstantInt.of(0), - BlockBehaviour.Properties.of().mapColor(MapColor.STONE).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(3.0F, 3.0F) - ) + properties -> new DropExperienceBlock(ConstantInt.of(0), properties), + BlockBehaviour.Properties.of().mapColor(MapColor.STONE).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(3.0F, 3.0F) ); public static final Block DEEPSLATE_IRON_ORE = register( "deepslate_iron_ore", - new DropExperienceBlock( - ConstantInt.of(0), BlockBehaviour.Properties.ofLegacyCopy(IRON_ORE).mapColor(MapColor.DEEPSLATE).strength(4.5F, 3.0F).sound(SoundType.DEEPSLATE) - ) + properties -> new DropExperienceBlock(ConstantInt.of(0), properties), + BlockBehaviour.Properties.ofLegacyCopy(IRON_ORE).mapColor(MapColor.DEEPSLATE).strength(4.5F, 3.0F).sound(SoundType.DEEPSLATE) ); public static final Block COAL_ORE = register( "coal_ore", - new DropExperienceBlock( - UniformInt.of(0, 2), - BlockBehaviour.Properties.of().mapColor(MapColor.STONE).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(3.0F, 3.0F) - ) + properties -> new DropExperienceBlock(UniformInt.of(0, 2), properties), + BlockBehaviour.Properties.of().mapColor(MapColor.STONE).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(3.0F, 3.0F) ); public static final Block DEEPSLATE_COAL_ORE = register( "deepslate_coal_ore", - new DropExperienceBlock( - UniformInt.of(0, 2), BlockBehaviour.Properties.ofLegacyCopy(COAL_ORE).mapColor(MapColor.DEEPSLATE).strength(4.5F, 3.0F).sound(SoundType.DEEPSLATE) - ) + properties -> new DropExperienceBlock(UniformInt.of(0, 2), properties), + BlockBehaviour.Properties.ofLegacyCopy(COAL_ORE).mapColor(MapColor.DEEPSLATE).strength(4.5F, 3.0F).sound(SoundType.DEEPSLATE) ); public static final Block NETHER_GOLD_ORE = register( "nether_gold_ore", - new DropExperienceBlock( - UniformInt.of(0, 1), - BlockBehaviour.Properties.of() - .mapColor(MapColor.NETHER) - .instrument(NoteBlockInstrument.BASEDRUM) - .requiresCorrectToolForDrops() - .strength(3.0F, 3.0F) - .sound(SoundType.NETHER_GOLD_ORE) - ) + properties -> new DropExperienceBlock(UniformInt.of(0, 1), properties), + BlockBehaviour.Properties.of() + .mapColor(MapColor.NETHER) + .instrument(NoteBlockInstrument.BASEDRUM) + .requiresCorrectToolForDrops() + .strength(3.0F, 3.0F) + .sound(SoundType.NETHER_GOLD_ORE) ); - public static final Block OAK_LOG = register("oak_log", log(MapColor.WOOD, MapColor.PODZOL)); - public static final Block SPRUCE_LOG = register("spruce_log", log(MapColor.PODZOL, MapColor.COLOR_BROWN)); - public static final Block BIRCH_LOG = register("birch_log", log(MapColor.SAND, MapColor.QUARTZ)); - public static final Block JUNGLE_LOG = register("jungle_log", log(MapColor.DIRT, MapColor.PODZOL)); - public static final Block ACACIA_LOG = register("acacia_log", log(MapColor.COLOR_ORANGE, MapColor.STONE)); - public static final Block CHERRY_LOG = register("cherry_log", log(MapColor.TERRACOTTA_WHITE, MapColor.TERRACOTTA_GRAY, SoundType.CHERRY_WOOD)); - public static final Block DARK_OAK_LOG = register("dark_oak_log", log(MapColor.COLOR_BROWN, MapColor.COLOR_BROWN)); - public static final Block MANGROVE_LOG = register("mangrove_log", log(MapColor.COLOR_RED, MapColor.PODZOL)); + public static final Block OAK_LOG = register("oak_log", RotatedPillarBlock::new, logProperties(MapColor.WOOD, MapColor.PODZOL, SoundType.WOOD)); + public static final Block SPRUCE_LOG = register("spruce_log", RotatedPillarBlock::new, logProperties(MapColor.PODZOL, MapColor.COLOR_BROWN, SoundType.WOOD)); + public static final Block BIRCH_LOG = register("birch_log", RotatedPillarBlock::new, logProperties(MapColor.SAND, MapColor.QUARTZ, SoundType.WOOD)); + public static final Block JUNGLE_LOG = register("jungle_log", RotatedPillarBlock::new, logProperties(MapColor.DIRT, MapColor.PODZOL, SoundType.WOOD)); + public static final Block ACACIA_LOG = register("acacia_log", RotatedPillarBlock::new, logProperties(MapColor.COLOR_ORANGE, MapColor.STONE, SoundType.WOOD)); + public static final Block CHERRY_LOG = register( + "cherry_log", RotatedPillarBlock::new, logProperties(MapColor.TERRACOTTA_WHITE, MapColor.TERRACOTTA_GRAY, SoundType.CHERRY_WOOD) + ); + public static final Block DARK_OAK_LOG = register( + "dark_oak_log", RotatedPillarBlock::new, logProperties(MapColor.COLOR_BROWN, MapColor.COLOR_BROWN, SoundType.WOOD) + ); + public static final Block PALE_OAK_LOG = register( + "pale_oak_log", + RotatedPillarBlock::new, + logProperties(PALE_OAK_PLANKS.defaultMapColor(), PALE_OAK_WOOD.defaultMapColor(), SoundType.WOOD).requiredFeatures(FeatureFlags.WINTER_DROP) + ); + public static final Block MANGROVE_LOG = register("mangrove_log", RotatedPillarBlock::new, logProperties(MapColor.COLOR_RED, MapColor.PODZOL, SoundType.WOOD)); public static final Block MANGROVE_ROOTS = register( "mangrove_roots", - new MangroveRootsBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.PODZOL) - .instrument(NoteBlockInstrument.BASS) - .strength(0.7F) - .sound(SoundType.MANGROVE_ROOTS) - .noOcclusion() - .isSuffocating(Blocks::never) - .isViewBlocking(Blocks::never) - .noOcclusion() - .ignitedByLava() - ) + MangroveRootsBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.PODZOL) + .instrument(NoteBlockInstrument.BASS) + .strength(0.7F) + .sound(SoundType.MANGROVE_ROOTS) + .noOcclusion() + .isSuffocating(Blocks::never) + .isViewBlocking(Blocks::never) + .noOcclusion() + .ignitedByLava() ); public static final Block MUDDY_MANGROVE_ROOTS = register( - "muddy_mangrove_roots", new RotatedPillarBlock(BlockBehaviour.Properties.of().mapColor(MapColor.PODZOL).strength(0.7F).sound(SoundType.MUDDY_MANGROVE_ROOTS)) + "muddy_mangrove_roots", + RotatedPillarBlock::new, + BlockBehaviour.Properties.of().mapColor(MapColor.PODZOL).strength(0.7F).sound(SoundType.MUDDY_MANGROVE_ROOTS) + ); + public static final Block BAMBOO_BLOCK = register( + "bamboo_block", RotatedPillarBlock::new, logProperties(MapColor.COLOR_YELLOW, MapColor.PLANT, SoundType.BAMBOO_WOOD) + ); + public static final Block STRIPPED_SPRUCE_LOG = register( + "stripped_spruce_log", RotatedPillarBlock::new, logProperties(MapColor.PODZOL, MapColor.PODZOL, SoundType.WOOD) + ); + public static final Block STRIPPED_BIRCH_LOG = register( + "stripped_birch_log", RotatedPillarBlock::new, logProperties(MapColor.SAND, MapColor.SAND, SoundType.WOOD) + ); + public static final Block STRIPPED_JUNGLE_LOG = register( + "stripped_jungle_log", RotatedPillarBlock::new, logProperties(MapColor.DIRT, MapColor.DIRT, SoundType.WOOD) + ); + public static final Block STRIPPED_ACACIA_LOG = register( + "stripped_acacia_log", RotatedPillarBlock::new, logProperties(MapColor.COLOR_ORANGE, MapColor.COLOR_ORANGE, SoundType.WOOD) ); - public static final Block BAMBOO_BLOCK = register("bamboo_block", log(MapColor.COLOR_YELLOW, MapColor.PLANT, SoundType.BAMBOO_WOOD)); - public static final Block STRIPPED_SPRUCE_LOG = register("stripped_spruce_log", log(MapColor.PODZOL, MapColor.PODZOL)); - public static final Block STRIPPED_BIRCH_LOG = register("stripped_birch_log", log(MapColor.SAND, MapColor.SAND)); - public static final Block STRIPPED_JUNGLE_LOG = register("stripped_jungle_log", log(MapColor.DIRT, MapColor.DIRT)); - public static final Block STRIPPED_ACACIA_LOG = register("stripped_acacia_log", log(MapColor.COLOR_ORANGE, MapColor.COLOR_ORANGE)); public static final Block STRIPPED_CHERRY_LOG = register( - "stripped_cherry_log", log(MapColor.TERRACOTTA_WHITE, MapColor.TERRACOTTA_PINK, SoundType.CHERRY_WOOD) + "stripped_cherry_log", RotatedPillarBlock::new, logProperties(MapColor.TERRACOTTA_WHITE, MapColor.TERRACOTTA_PINK, SoundType.CHERRY_WOOD) + ); + public static final Block STRIPPED_DARK_OAK_LOG = register( + "stripped_dark_oak_log", RotatedPillarBlock::new, logProperties(MapColor.COLOR_BROWN, MapColor.COLOR_BROWN, SoundType.WOOD) + ); + public static final Block STRIPPED_PALE_OAK_LOG = register( + "stripped_pale_oak_log", + RotatedPillarBlock::new, + logProperties(PALE_OAK_PLANKS.defaultMapColor(), PALE_OAK_PLANKS.defaultMapColor(), SoundType.WOOD).requiredFeatures(FeatureFlags.WINTER_DROP) + ); + public static final Block STRIPPED_OAK_LOG = register("stripped_oak_log", RotatedPillarBlock::new, logProperties(MapColor.WOOD, MapColor.WOOD, SoundType.WOOD)); + public static final Block STRIPPED_MANGROVE_LOG = register( + "stripped_mangrove_log", RotatedPillarBlock::new, logProperties(MapColor.COLOR_RED, MapColor.COLOR_RED, SoundType.WOOD) + ); + public static final Block STRIPPED_BAMBOO_BLOCK = register( + "stripped_bamboo_block", RotatedPillarBlock::new, logProperties(MapColor.COLOR_YELLOW, MapColor.COLOR_YELLOW, SoundType.BAMBOO_WOOD) ); - public static final Block STRIPPED_DARK_OAK_LOG = register("stripped_dark_oak_log", log(MapColor.COLOR_BROWN, MapColor.COLOR_BROWN)); - public static final Block STRIPPED_OAK_LOG = register("stripped_oak_log", log(MapColor.WOOD, MapColor.WOOD)); - public static final Block STRIPPED_MANGROVE_LOG = register("stripped_mangrove_log", log(MapColor.COLOR_RED, MapColor.COLOR_RED)); - public static final Block STRIPPED_BAMBOO_BLOCK = register("stripped_bamboo_block", log(MapColor.COLOR_YELLOW, MapColor.COLOR_YELLOW, SoundType.BAMBOO_WOOD)); public static final Block OAK_WOOD = register( "oak_wood", - new RotatedPillarBlock( - BlockBehaviour.Properties.of().mapColor(MapColor.WOOD).instrument(NoteBlockInstrument.BASS).strength(2.0F).sound(SoundType.WOOD).ignitedByLava() - ) + RotatedPillarBlock::new, + BlockBehaviour.Properties.of().mapColor(MapColor.WOOD).instrument(NoteBlockInstrument.BASS).strength(2.0F).sound(SoundType.WOOD).ignitedByLava() ); public static final Block SPRUCE_WOOD = register( "spruce_wood", - new RotatedPillarBlock( - BlockBehaviour.Properties.of().mapColor(MapColor.PODZOL).instrument(NoteBlockInstrument.BASS).strength(2.0F).sound(SoundType.WOOD).ignitedByLava() - ) + RotatedPillarBlock::new, + BlockBehaviour.Properties.of().mapColor(MapColor.PODZOL).instrument(NoteBlockInstrument.BASS).strength(2.0F).sound(SoundType.WOOD).ignitedByLava() ); public static final Block BIRCH_WOOD = register( "birch_wood", - new RotatedPillarBlock( - BlockBehaviour.Properties.of().mapColor(MapColor.SAND).instrument(NoteBlockInstrument.BASS).strength(2.0F).sound(SoundType.WOOD).ignitedByLava() - ) + RotatedPillarBlock::new, + BlockBehaviour.Properties.of().mapColor(MapColor.SAND).instrument(NoteBlockInstrument.BASS).strength(2.0F).sound(SoundType.WOOD).ignitedByLava() ); public static final Block JUNGLE_WOOD = register( "jungle_wood", - new RotatedPillarBlock( - BlockBehaviour.Properties.of().mapColor(MapColor.DIRT).instrument(NoteBlockInstrument.BASS).strength(2.0F).sound(SoundType.WOOD).ignitedByLava() - ) + RotatedPillarBlock::new, + BlockBehaviour.Properties.of().mapColor(MapColor.DIRT).instrument(NoteBlockInstrument.BASS).strength(2.0F).sound(SoundType.WOOD).ignitedByLava() ); public static final Block ACACIA_WOOD = register( "acacia_wood", - new RotatedPillarBlock( - BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_GRAY).instrument(NoteBlockInstrument.BASS).strength(2.0F).sound(SoundType.WOOD).ignitedByLava() - ) + RotatedPillarBlock::new, + BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_GRAY).instrument(NoteBlockInstrument.BASS).strength(2.0F).sound(SoundType.WOOD).ignitedByLava() ); public static final Block CHERRY_WOOD = register( "cherry_wood", - new RotatedPillarBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.TERRACOTTA_GRAY) - .instrument(NoteBlockInstrument.BASS) - .strength(2.0F) - .sound(SoundType.CHERRY_WOOD) - .ignitedByLava() - ) + RotatedPillarBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.TERRACOTTA_GRAY) + .instrument(NoteBlockInstrument.BASS) + .strength(2.0F) + .sound(SoundType.CHERRY_WOOD) + .ignitedByLava() ); public static final Block DARK_OAK_WOOD = register( "dark_oak_wood", - new RotatedPillarBlock( - BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_BROWN).instrument(NoteBlockInstrument.BASS).strength(2.0F).sound(SoundType.WOOD).ignitedByLava() - ) + RotatedPillarBlock::new, + BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_BROWN).instrument(NoteBlockInstrument.BASS).strength(2.0F).sound(SoundType.WOOD).ignitedByLava() ); public static final Block MANGROVE_WOOD = register( "mangrove_wood", - new RotatedPillarBlock( - BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_RED).instrument(NoteBlockInstrument.BASS).strength(2.0F).sound(SoundType.WOOD).ignitedByLava() - ) + RotatedPillarBlock::new, + BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_RED).instrument(NoteBlockInstrument.BASS).strength(2.0F).sound(SoundType.WOOD).ignitedByLava() ); public static final Block STRIPPED_OAK_WOOD = register( "stripped_oak_wood", - new RotatedPillarBlock( - BlockBehaviour.Properties.of().mapColor(MapColor.WOOD).instrument(NoteBlockInstrument.BASS).strength(2.0F).sound(SoundType.WOOD).ignitedByLava() - ) + RotatedPillarBlock::new, + BlockBehaviour.Properties.of().mapColor(MapColor.WOOD).instrument(NoteBlockInstrument.BASS).strength(2.0F).sound(SoundType.WOOD).ignitedByLava() ); public static final Block STRIPPED_SPRUCE_WOOD = register( "stripped_spruce_wood", - new RotatedPillarBlock( - BlockBehaviour.Properties.of().mapColor(MapColor.PODZOL).instrument(NoteBlockInstrument.BASS).strength(2.0F).sound(SoundType.WOOD).ignitedByLava() - ) + RotatedPillarBlock::new, + BlockBehaviour.Properties.of().mapColor(MapColor.PODZOL).instrument(NoteBlockInstrument.BASS).strength(2.0F).sound(SoundType.WOOD).ignitedByLava() ); public static final Block STRIPPED_BIRCH_WOOD = register( "stripped_birch_wood", - new RotatedPillarBlock( - BlockBehaviour.Properties.of().mapColor(MapColor.SAND).instrument(NoteBlockInstrument.BASS).strength(2.0F).sound(SoundType.WOOD).ignitedByLava() - ) + RotatedPillarBlock::new, + BlockBehaviour.Properties.of().mapColor(MapColor.SAND).instrument(NoteBlockInstrument.BASS).strength(2.0F).sound(SoundType.WOOD).ignitedByLava() ); public static final Block STRIPPED_JUNGLE_WOOD = register( "stripped_jungle_wood", - new RotatedPillarBlock( - BlockBehaviour.Properties.of().mapColor(MapColor.DIRT).instrument(NoteBlockInstrument.BASS).strength(2.0F).sound(SoundType.WOOD).ignitedByLava() - ) + RotatedPillarBlock::new, + BlockBehaviour.Properties.of().mapColor(MapColor.DIRT).instrument(NoteBlockInstrument.BASS).strength(2.0F).sound(SoundType.WOOD).ignitedByLava() ); public static final Block STRIPPED_ACACIA_WOOD = register( "stripped_acacia_wood", - new RotatedPillarBlock( - BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_ORANGE).instrument(NoteBlockInstrument.BASS).strength(2.0F).sound(SoundType.WOOD).ignitedByLava() - ) + RotatedPillarBlock::new, + BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_ORANGE).instrument(NoteBlockInstrument.BASS).strength(2.0F).sound(SoundType.WOOD).ignitedByLava() ); public static final Block STRIPPED_CHERRY_WOOD = register( "stripped_cherry_wood", - new RotatedPillarBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.TERRACOTTA_PINK) - .instrument(NoteBlockInstrument.BASS) - .strength(2.0F) - .sound(SoundType.CHERRY_WOOD) - .ignitedByLava() - ) + RotatedPillarBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.TERRACOTTA_PINK) + .instrument(NoteBlockInstrument.BASS) + .strength(2.0F) + .sound(SoundType.CHERRY_WOOD) + .ignitedByLava() ); public static final Block STRIPPED_DARK_OAK_WOOD = register( "stripped_dark_oak_wood", - new RotatedPillarBlock( - BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_BROWN).instrument(NoteBlockInstrument.BASS).strength(2.0F).sound(SoundType.WOOD).ignitedByLava() - ) + RotatedPillarBlock::new, + BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_BROWN).instrument(NoteBlockInstrument.BASS).strength(2.0F).sound(SoundType.WOOD).ignitedByLava() ); - public static final Block STRIPPED_MANGROVE_WOOD = register("stripped_mangrove_wood", log(MapColor.COLOR_RED, MapColor.COLOR_RED)); - public static final Block OAK_LEAVES = register("oak_leaves", leaves(SoundType.GRASS)); - public static final Block SPRUCE_LEAVES = register("spruce_leaves", leaves(SoundType.GRASS)); - public static final Block BIRCH_LEAVES = register("birch_leaves", leaves(SoundType.GRASS)); - public static final Block JUNGLE_LEAVES = register("jungle_leaves", leaves(SoundType.GRASS)); - public static final Block ACACIA_LEAVES = register("acacia_leaves", leaves(SoundType.GRASS)); + public static final Block STRIPPED_PALE_OAK_WOOD = register( + "stripped_pale_oak_wood", + RotatedPillarBlock::new, + BlockBehaviour.Properties.of() + .mapColor(PALE_OAK_PLANKS.defaultMapColor()) + .instrument(NoteBlockInstrument.BASS) + .strength(2.0F) + .sound(SoundType.WOOD) + .ignitedByLava() + .requiredFeatures(FeatureFlags.WINTER_DROP) + ); + public static final Block STRIPPED_MANGROVE_WOOD = register( + "stripped_mangrove_wood", RotatedPillarBlock::new, logProperties(MapColor.COLOR_RED, MapColor.COLOR_RED, SoundType.WOOD) + ); + public static final Block OAK_LEAVES = register("oak_leaves", LeavesBlock::new, leavesProperties(SoundType.GRASS)); + public static final Block SPRUCE_LEAVES = register("spruce_leaves", LeavesBlock::new, leavesProperties(SoundType.GRASS)); + public static final Block BIRCH_LEAVES = register("birch_leaves", LeavesBlock::new, leavesProperties(SoundType.GRASS)); + public static final Block JUNGLE_LEAVES = register("jungle_leaves", LeavesBlock::new, leavesProperties(SoundType.GRASS)); + public static final Block ACACIA_LEAVES = register("acacia_leaves", LeavesBlock::new, leavesProperties(SoundType.GRASS)); public static final Block CHERRY_LEAVES = register( "cherry_leaves", - new CherryLeavesBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.COLOR_PINK) - .strength(0.2F) - .randomTicks() - .sound(SoundType.CHERRY_LEAVES) - .noOcclusion() - .isValidSpawn(Blocks::ocelotOrParrot) - .isSuffocating(Blocks::never) - .isViewBlocking(Blocks::never) - .ignitedByLava() - .pushReaction(PushReaction.DESTROY) - .isRedstoneConductor(Blocks::never) - ) + CherryLeavesBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.COLOR_PINK) + .strength(0.2F) + .randomTicks() + .sound(SoundType.CHERRY_LEAVES) + .noOcclusion() + .isValidSpawn(Blocks::ocelotOrParrot) + .isSuffocating(Blocks::never) + .isViewBlocking(Blocks::never) + .ignitedByLava() + .pushReaction(PushReaction.DESTROY) + .isRedstoneConductor(Blocks::never) ); - public static final Block DARK_OAK_LEAVES = register("dark_oak_leaves", leaves(SoundType.GRASS)); - public static final Block MANGROVE_LEAVES = register( - "mangrove_leaves", - new MangroveLeavesBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.PLANT) - .strength(0.2F) - .randomTicks() - .sound(SoundType.GRASS) - .noOcclusion() - .isValidSpawn(Blocks::ocelotOrParrot) - .isSuffocating(Blocks::never) - .isViewBlocking(Blocks::never) - .ignitedByLava() - .pushReaction(PushReaction.DESTROY) - .isRedstoneConductor(Blocks::never) - ) + public static final Block DARK_OAK_LEAVES = register("dark_oak_leaves", LeavesBlock::new, leavesProperties(SoundType.GRASS)); + public static final Block PALE_OAK_LEAVES = register( + "pale_oak_leaves", + LeavesBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.TERRACOTTA_GREEN) + .strength(0.2F) + .randomTicks() + .sound(SoundType.GRASS) + .noOcclusion() + .isValidSpawn(Blocks::ocelotOrParrot) + .isSuffocating(Blocks::never) + .isViewBlocking(Blocks::never) + .ignitedByLava() + .pushReaction(PushReaction.DESTROY) + .isRedstoneConductor(Blocks::never) + .requiredFeatures(FeatureFlags.WINTER_DROP) ); - public static final Block AZALEA_LEAVES = register("azalea_leaves", leaves(SoundType.AZALEA_LEAVES)); - public static final Block FLOWERING_AZALEA_LEAVES = register("flowering_azalea_leaves", leaves(SoundType.AZALEA_LEAVES)); + public static final Block MANGROVE_LEAVES = register("mangrove_leaves", MangroveLeavesBlock::new, leavesProperties(SoundType.GRASS)); + public static final Block AZALEA_LEAVES = register("azalea_leaves", LeavesBlock::new, leavesProperties(SoundType.AZALEA_LEAVES)); + public static final Block FLOWERING_AZALEA_LEAVES = register("flowering_azalea_leaves", LeavesBlock::new, leavesProperties(SoundType.AZALEA_LEAVES)); public static final Block SPONGE = register( - "sponge", new SpongeBlock(BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_YELLOW).strength(0.6F).sound(SoundType.SPONGE)) + "sponge", SpongeBlock::new, BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_YELLOW).strength(0.6F).sound(SoundType.SPONGE) ); public static final Block WET_SPONGE = register( - "wet_sponge", new WetSpongeBlock(BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_YELLOW).strength(0.6F).sound(SoundType.WET_SPONGE)) + "wet_sponge", WetSpongeBlock::new, BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_YELLOW).strength(0.6F).sound(SoundType.WET_SPONGE) ); public static final Block GLASS = register( "glass", - new TransparentBlock( - BlockBehaviour.Properties.of() - .instrument(NoteBlockInstrument.HAT) - .strength(0.3F) - .sound(SoundType.GLASS) - .noOcclusion() - .isValidSpawn(Blocks::never) - .isRedstoneConductor(Blocks::never) - .isSuffocating(Blocks::never) - .isViewBlocking(Blocks::never) - ) + TransparentBlock::new, + BlockBehaviour.Properties.of() + .instrument(NoteBlockInstrument.HAT) + .strength(0.3F) + .sound(SoundType.GLASS) + .noOcclusion() + .isValidSpawn(Blocks::never) + .isRedstoneConductor(Blocks::never) + .isSuffocating(Blocks::never) + .isViewBlocking(Blocks::never) ); public static final Block LAPIS_ORE = register( "lapis_ore", - new DropExperienceBlock( - UniformInt.of(2, 5), - BlockBehaviour.Properties.of().mapColor(MapColor.STONE).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(3.0F, 3.0F) - ) + properties -> new DropExperienceBlock(UniformInt.of(2, 5), properties), + BlockBehaviour.Properties.of().mapColor(MapColor.STONE).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(3.0F, 3.0F) ); public static final Block DEEPSLATE_LAPIS_ORE = register( "deepslate_lapis_ore", - new DropExperienceBlock( - UniformInt.of(2, 5), BlockBehaviour.Properties.ofLegacyCopy(LAPIS_ORE).mapColor(MapColor.DEEPSLATE).strength(4.5F, 3.0F).sound(SoundType.DEEPSLATE) - ) + properties -> new DropExperienceBlock(UniformInt.of(2, 5), properties), + BlockBehaviour.Properties.ofLegacyCopy(LAPIS_ORE).mapColor(MapColor.DEEPSLATE).strength(4.5F, 3.0F).sound(SoundType.DEEPSLATE) ); public static final Block LAPIS_BLOCK = register( - "lapis_block", new Block(BlockBehaviour.Properties.of().mapColor(MapColor.LAPIS).requiresCorrectToolForDrops().strength(3.0F, 3.0F)) + "lapis_block", BlockBehaviour.Properties.of().mapColor(MapColor.LAPIS).requiresCorrectToolForDrops().strength(3.0F, 3.0F) ); public static final Block DISPENSER = register( "dispenser", - new DispenserBlock( - BlockBehaviour.Properties.of().mapColor(MapColor.STONE).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(3.5F) - ) + DispenserBlock::new, + BlockBehaviour.Properties.of().mapColor(MapColor.STONE).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(3.5F) ); public static final Block SANDSTONE = register( - "sandstone", - new Block(BlockBehaviour.Properties.of().mapColor(MapColor.SAND).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(0.8F)) + "sandstone", BlockBehaviour.Properties.of().mapColor(MapColor.SAND).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(0.8F) ); public static final Block CHISELED_SANDSTONE = register( "chiseled_sandstone", - new Block(BlockBehaviour.Properties.of().mapColor(MapColor.SAND).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(0.8F)) + BlockBehaviour.Properties.of().mapColor(MapColor.SAND).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(0.8F) ); public static final Block CUT_SANDSTONE = register( - "cut_sandstone", - new Block(BlockBehaviour.Properties.of().mapColor(MapColor.SAND).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(0.8F)) + "cut_sandstone", BlockBehaviour.Properties.of().mapColor(MapColor.SAND).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(0.8F) ); public static final Block NOTE_BLOCK = register( "note_block", - new NoteBlock( - BlockBehaviour.Properties.of().mapColor(MapColor.WOOD).instrument(NoteBlockInstrument.BASS).sound(SoundType.WOOD).strength(0.8F).ignitedByLava() - ) + NoteBlock::new, + BlockBehaviour.Properties.of().mapColor(MapColor.WOOD).instrument(NoteBlockInstrument.BASS).sound(SoundType.WOOD).strength(0.8F).ignitedByLava() ); - public static final Block WHITE_BED = register("white_bed", bed(DyeColor.WHITE)); - public static final Block ORANGE_BED = register("orange_bed", bed(DyeColor.ORANGE)); - public static final Block MAGENTA_BED = register("magenta_bed", bed(DyeColor.MAGENTA)); - public static final Block LIGHT_BLUE_BED = register("light_blue_bed", bed(DyeColor.LIGHT_BLUE)); - public static final Block YELLOW_BED = register("yellow_bed", bed(DyeColor.YELLOW)); - public static final Block LIME_BED = register("lime_bed", bed(DyeColor.LIME)); - public static final Block PINK_BED = register("pink_bed", bed(DyeColor.PINK)); - public static final Block GRAY_BED = register("gray_bed", bed(DyeColor.GRAY)); - public static final Block LIGHT_GRAY_BED = register("light_gray_bed", bed(DyeColor.LIGHT_GRAY)); - public static final Block CYAN_BED = register("cyan_bed", bed(DyeColor.CYAN)); - public static final Block PURPLE_BED = register("purple_bed", bed(DyeColor.PURPLE)); - public static final Block BLUE_BED = register("blue_bed", bed(DyeColor.BLUE)); - public static final Block BROWN_BED = register("brown_bed", bed(DyeColor.BROWN)); - public static final Block GREEN_BED = register("green_bed", bed(DyeColor.GREEN)); - public static final Block RED_BED = register("red_bed", bed(DyeColor.RED)); - public static final Block BLACK_BED = register("black_bed", bed(DyeColor.BLACK)); + public static final Block WHITE_BED = registerBed("white_bed", DyeColor.WHITE); + public static final Block ORANGE_BED = registerBed("orange_bed", DyeColor.ORANGE); + public static final Block MAGENTA_BED = registerBed("magenta_bed", DyeColor.MAGENTA); + public static final Block LIGHT_BLUE_BED = registerBed("light_blue_bed", DyeColor.LIGHT_BLUE); + public static final Block YELLOW_BED = registerBed("yellow_bed", DyeColor.YELLOW); + public static final Block LIME_BED = registerBed("lime_bed", DyeColor.LIME); + public static final Block PINK_BED = registerBed("pink_bed", DyeColor.PINK); + public static final Block GRAY_BED = registerBed("gray_bed", DyeColor.GRAY); + public static final Block LIGHT_GRAY_BED = registerBed("light_gray_bed", DyeColor.LIGHT_GRAY); + public static final Block CYAN_BED = registerBed("cyan_bed", DyeColor.CYAN); + public static final Block PURPLE_BED = registerBed("purple_bed", DyeColor.PURPLE); + public static final Block BLUE_BED = registerBed("blue_bed", DyeColor.BLUE); + public static final Block BROWN_BED = registerBed("brown_bed", DyeColor.BROWN); + public static final Block GREEN_BED = registerBed("green_bed", DyeColor.GREEN); + public static final Block RED_BED = registerBed("red_bed", DyeColor.RED); + public static final Block BLACK_BED = registerBed("black_bed", DyeColor.BLACK); public static final Block POWERED_RAIL = register( - "powered_rail", new PoweredRailBlock(BlockBehaviour.Properties.of().noCollission().strength(0.7F).sound(SoundType.METAL)) + "powered_rail", PoweredRailBlock::new, BlockBehaviour.Properties.of().noCollission().strength(0.7F).sound(SoundType.METAL) ); public static final Block DETECTOR_RAIL = register( - "detector_rail", new DetectorRailBlock(BlockBehaviour.Properties.of().noCollission().strength(0.7F).sound(SoundType.METAL)) + "detector_rail", DetectorRailBlock::new, BlockBehaviour.Properties.of().noCollission().strength(0.7F).sound(SoundType.METAL) ); - public static final Block STICKY_PISTON = register("sticky_piston", pistonBase(true)); + public static final Block STICKY_PISTON = register("sticky_piston", properties -> new PistonBaseBlock(true, properties), pistonProperties()); public static final Block COBWEB = register( "cobweb", - new WebBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.WOOL) - .sound(SoundType.COBWEB) - .forceSolidOn() - .noCollission() - .requiresCorrectToolForDrops() - .strength(4.0F) - .pushReaction(PushReaction.DESTROY) - ) + WebBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.WOOL) + .sound(SoundType.COBWEB) + .forceSolidOn() + .noCollission() + .requiresCorrectToolForDrops() + .strength(4.0F) + .pushReaction(PushReaction.DESTROY) ); public static final Block SHORT_GRASS = register( "short_grass", - new TallGrassBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.PLANT) - .replaceable() - .noCollission() - .instabreak() - .sound(SoundType.GRASS) - .offsetType(BlockBehaviour.OffsetType.XYZ) - .ignitedByLava() - .pushReaction(PushReaction.DESTROY) - ) + TallGrassBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.PLANT) + .replaceable() + .noCollission() + .instabreak() + .sound(SoundType.GRASS) + .offsetType(BlockBehaviour.OffsetType.XYZ) + .ignitedByLava() + .pushReaction(PushReaction.DESTROY) ); public static final Block FERN = register( "fern", - new TallGrassBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.PLANT) - .replaceable() - .noCollission() - .instabreak() - .sound(SoundType.GRASS) - .offsetType(BlockBehaviour.OffsetType.XYZ) - .ignitedByLava() - .pushReaction(PushReaction.DESTROY) - ) + TallGrassBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.PLANT) + .replaceable() + .noCollission() + .instabreak() + .sound(SoundType.GRASS) + .offsetType(BlockBehaviour.OffsetType.XYZ) + .ignitedByLava() + .pushReaction(PushReaction.DESTROY) ); public static final Block DEAD_BUSH = register( "dead_bush", - new DeadBushBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.WOOD) - .replaceable() - .noCollission() - .instabreak() - .sound(SoundType.GRASS) - .ignitedByLava() - .pushReaction(PushReaction.DESTROY) - ) + DeadBushBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.WOOD) + .replaceable() + .noCollission() + .instabreak() + .sound(SoundType.GRASS) + .ignitedByLava() + .pushReaction(PushReaction.DESTROY) ); public static final Block SEAGRASS = register( "seagrass", - new SeagrassBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.WATER) - .replaceable() - .noCollission() - .instabreak() - .sound(SoundType.WET_GRASS) - .pushReaction(PushReaction.DESTROY) - ) + SeagrassBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.WATER) + .replaceable() + .noCollission() + .instabreak() + .sound(SoundType.WET_GRASS) + .pushReaction(PushReaction.DESTROY) ); public static final Block TALL_SEAGRASS = register( "tall_seagrass", - new TallSeagrassBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.WATER) - .replaceable() - .noCollission() - .instabreak() - .sound(SoundType.WET_GRASS) - .offsetType(BlockBehaviour.OffsetType.XZ) - .pushReaction(PushReaction.DESTROY) - ) + TallSeagrassBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.WATER) + .replaceable() + .noCollission() + .instabreak() + .sound(SoundType.WET_GRASS) + .offsetType(BlockBehaviour.OffsetType.XZ) + .pushReaction(PushReaction.DESTROY) ); - public static final Block PISTON = register("piston", pistonBase(false)); + public static final Block PISTON = register("piston", properties -> new PistonBaseBlock(false, properties), pistonProperties()); public static final Block PISTON_HEAD = register( - "piston_head", new PistonHeadBlock(BlockBehaviour.Properties.of().mapColor(MapColor.STONE).strength(1.5F).noLootTable().pushReaction(PushReaction.BLOCK)) + "piston_head", PistonHeadBlock::new, BlockBehaviour.Properties.of().mapColor(MapColor.STONE).strength(1.5F).noLootTable().pushReaction(PushReaction.BLOCK) ); public static final Block WHITE_WOOL = register( "white_wool", - new Block(BlockBehaviour.Properties.of().mapColor(MapColor.SNOW).instrument(NoteBlockInstrument.GUITAR).strength(0.8F).sound(SoundType.WOOL).ignitedByLava()) + BlockBehaviour.Properties.of().mapColor(MapColor.SNOW).instrument(NoteBlockInstrument.GUITAR).strength(0.8F).sound(SoundType.WOOL).ignitedByLava() ); public static final Block ORANGE_WOOL = register( "orange_wool", - new Block( - BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_ORANGE).instrument(NoteBlockInstrument.GUITAR).strength(0.8F).sound(SoundType.WOOL).ignitedByLava() - ) + BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_ORANGE).instrument(NoteBlockInstrument.GUITAR).strength(0.8F).sound(SoundType.WOOL).ignitedByLava() ); public static final Block MAGENTA_WOOL = register( "magenta_wool", - new Block( - BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_MAGENTA).instrument(NoteBlockInstrument.GUITAR).strength(0.8F).sound(SoundType.WOOL).ignitedByLava() - ) + BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_MAGENTA).instrument(NoteBlockInstrument.GUITAR).strength(0.8F).sound(SoundType.WOOL).ignitedByLava() ); public static final Block LIGHT_BLUE_WOOL = register( "light_blue_wool", - new Block( - BlockBehaviour.Properties.of() - .mapColor(MapColor.COLOR_LIGHT_BLUE) - .instrument(NoteBlockInstrument.GUITAR) - .strength(0.8F) - .sound(SoundType.WOOL) - .ignitedByLava() - ) + BlockBehaviour.Properties.of() + .mapColor(MapColor.COLOR_LIGHT_BLUE) + .instrument(NoteBlockInstrument.GUITAR) + .strength(0.8F) + .sound(SoundType.WOOL) + .ignitedByLava() ); public static final Block YELLOW_WOOL = register( "yellow_wool", - new Block( - BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_YELLOW).instrument(NoteBlockInstrument.GUITAR).strength(0.8F).sound(SoundType.WOOL).ignitedByLava() - ) + BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_YELLOW).instrument(NoteBlockInstrument.GUITAR).strength(0.8F).sound(SoundType.WOOL).ignitedByLava() ); public static final Block LIME_WOOL = register( "lime_wool", - new Block( - BlockBehaviour.Properties.of() - .mapColor(MapColor.COLOR_LIGHT_GREEN) - .instrument(NoteBlockInstrument.GUITAR) - .strength(0.8F) - .sound(SoundType.WOOL) - .ignitedByLava() - ) + BlockBehaviour.Properties.of() + .mapColor(MapColor.COLOR_LIGHT_GREEN) + .instrument(NoteBlockInstrument.GUITAR) + .strength(0.8F) + .sound(SoundType.WOOL) + .ignitedByLava() ); public static final Block PINK_WOOL = register( "pink_wool", - new Block( - BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_PINK).instrument(NoteBlockInstrument.GUITAR).strength(0.8F).sound(SoundType.WOOL).ignitedByLava() - ) + BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_PINK).instrument(NoteBlockInstrument.GUITAR).strength(0.8F).sound(SoundType.WOOL).ignitedByLava() ); public static final Block GRAY_WOOL = register( "gray_wool", - new Block( - BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_GRAY).instrument(NoteBlockInstrument.GUITAR).strength(0.8F).sound(SoundType.WOOL).ignitedByLava() - ) + BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_GRAY).instrument(NoteBlockInstrument.GUITAR).strength(0.8F).sound(SoundType.WOOL).ignitedByLava() ); public static final Block LIGHT_GRAY_WOOL = register( "light_gray_wool", - new Block( - BlockBehaviour.Properties.of() - .mapColor(MapColor.COLOR_LIGHT_GRAY) - .instrument(NoteBlockInstrument.GUITAR) - .strength(0.8F) - .sound(SoundType.WOOL) - .ignitedByLava() - ) + BlockBehaviour.Properties.of() + .mapColor(MapColor.COLOR_LIGHT_GRAY) + .instrument(NoteBlockInstrument.GUITAR) + .strength(0.8F) + .sound(SoundType.WOOL) + .ignitedByLava() ); public static final Block CYAN_WOOL = register( "cyan_wool", - new Block( - BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_CYAN).instrument(NoteBlockInstrument.GUITAR).strength(0.8F).sound(SoundType.WOOL).ignitedByLava() - ) + BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_CYAN).instrument(NoteBlockInstrument.GUITAR).strength(0.8F).sound(SoundType.WOOL).ignitedByLava() ); public static final Block PURPLE_WOOL = register( "purple_wool", - new Block( - BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_PURPLE).instrument(NoteBlockInstrument.GUITAR).strength(0.8F).sound(SoundType.WOOL).ignitedByLava() - ) + BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_PURPLE).instrument(NoteBlockInstrument.GUITAR).strength(0.8F).sound(SoundType.WOOL).ignitedByLava() ); public static final Block BLUE_WOOL = register( "blue_wool", - new Block( - BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_BLUE).instrument(NoteBlockInstrument.GUITAR).strength(0.8F).sound(SoundType.WOOL).ignitedByLava() - ) + BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_BLUE).instrument(NoteBlockInstrument.GUITAR).strength(0.8F).sound(SoundType.WOOL).ignitedByLava() ); public static final Block BROWN_WOOL = register( "brown_wool", - new Block( - BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_BROWN).instrument(NoteBlockInstrument.GUITAR).strength(0.8F).sound(SoundType.WOOL).ignitedByLava() - ) + BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_BROWN).instrument(NoteBlockInstrument.GUITAR).strength(0.8F).sound(SoundType.WOOL).ignitedByLava() ); public static final Block GREEN_WOOL = register( "green_wool", - new Block( - BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_GREEN).instrument(NoteBlockInstrument.GUITAR).strength(0.8F).sound(SoundType.WOOL).ignitedByLava() - ) + BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_GREEN).instrument(NoteBlockInstrument.GUITAR).strength(0.8F).sound(SoundType.WOOL).ignitedByLava() ); public static final Block RED_WOOL = register( "red_wool", - new Block( - BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_RED).instrument(NoteBlockInstrument.GUITAR).strength(0.8F).sound(SoundType.WOOL).ignitedByLava() - ) + BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_RED).instrument(NoteBlockInstrument.GUITAR).strength(0.8F).sound(SoundType.WOOL).ignitedByLava() ); public static final Block BLACK_WOOL = register( "black_wool", - new Block( - BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_BLACK).instrument(NoteBlockInstrument.GUITAR).strength(0.8F).sound(SoundType.WOOL).ignitedByLava() - ) + BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_BLACK).instrument(NoteBlockInstrument.GUITAR).strength(0.8F).sound(SoundType.WOOL).ignitedByLava() ); public static final Block MOVING_PISTON = register( "moving_piston", - new MovingPistonBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.STONE) - .forceSolidOn() - .strength(-1.0F) - .dynamicShape() - .noLootTable() - .noOcclusion() - .isRedstoneConductor(Blocks::never) - .isSuffocating(Blocks::never) - .isViewBlocking(Blocks::never) - .pushReaction(PushReaction.BLOCK) - ) + MovingPistonBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.STONE) + .forceSolidOn() + .strength(-1.0F) + .dynamicShape() + .noLootTable() + .noOcclusion() + .isRedstoneConductor(Blocks::never) + .isSuffocating(Blocks::never) + .isViewBlocking(Blocks::never) + .pushReaction(PushReaction.BLOCK) ); public static final Block DANDELION = register( "dandelion", - new FlowerBlock( - MobEffects.SATURATION, - 0.35F, - BlockBehaviour.Properties.of() - .mapColor(MapColor.PLANT) - .noCollission() - .instabreak() - .sound(SoundType.GRASS) - .offsetType(BlockBehaviour.OffsetType.XZ) - .pushReaction(PushReaction.DESTROY) - ) + properties -> new FlowerBlock(MobEffects.SATURATION, 0.35F, properties), + BlockBehaviour.Properties.of() + .mapColor(MapColor.PLANT) + .noCollission() + .instabreak() + .sound(SoundType.GRASS) + .offsetType(BlockBehaviour.OffsetType.XZ) + .pushReaction(PushReaction.DESTROY) ); public static final Block TORCHFLOWER = register( "torchflower", - new FlowerBlock( - MobEffects.NIGHT_VISION, - 5.0F, - BlockBehaviour.Properties.of() - .mapColor(MapColor.PLANT) - .noCollission() - .instabreak() - .sound(SoundType.GRASS) - .offsetType(BlockBehaviour.OffsetType.XZ) - .pushReaction(PushReaction.DESTROY) - ) + properties -> new FlowerBlock(MobEffects.NIGHT_VISION, 5.0F, properties), + BlockBehaviour.Properties.of() + .mapColor(MapColor.PLANT) + .noCollission() + .instabreak() + .sound(SoundType.GRASS) + .offsetType(BlockBehaviour.OffsetType.XZ) + .pushReaction(PushReaction.DESTROY) ); public static final Block POPPY = register( "poppy", - new FlowerBlock( - MobEffects.NIGHT_VISION, - 5.0F, - BlockBehaviour.Properties.of() - .mapColor(MapColor.PLANT) - .noCollission() - .instabreak() - .sound(SoundType.GRASS) - .offsetType(BlockBehaviour.OffsetType.XZ) - .pushReaction(PushReaction.DESTROY) - ) + properties -> new FlowerBlock(MobEffects.NIGHT_VISION, 5.0F, properties), + BlockBehaviour.Properties.of() + .mapColor(MapColor.PLANT) + .noCollission() + .instabreak() + .sound(SoundType.GRASS) + .offsetType(BlockBehaviour.OffsetType.XZ) + .pushReaction(PushReaction.DESTROY) ); public static final Block BLUE_ORCHID = register( "blue_orchid", - new FlowerBlock( - MobEffects.SATURATION, - 0.35F, - BlockBehaviour.Properties.of() - .mapColor(MapColor.PLANT) - .noCollission() - .instabreak() - .sound(SoundType.GRASS) - .offsetType(BlockBehaviour.OffsetType.XZ) - .pushReaction(PushReaction.DESTROY) - ) + properties -> new FlowerBlock(MobEffects.SATURATION, 0.35F, properties), + BlockBehaviour.Properties.of() + .mapColor(MapColor.PLANT) + .noCollission() + .instabreak() + .sound(SoundType.GRASS) + .offsetType(BlockBehaviour.OffsetType.XZ) + .pushReaction(PushReaction.DESTROY) ); public static final Block ALLIUM = register( "allium", - new FlowerBlock( - MobEffects.FIRE_RESISTANCE, - 4.0F, - BlockBehaviour.Properties.of() - .mapColor(MapColor.PLANT) - .noCollission() - .instabreak() - .sound(SoundType.GRASS) - .offsetType(BlockBehaviour.OffsetType.XZ) - .pushReaction(PushReaction.DESTROY) - ) + properties -> new FlowerBlock(MobEffects.FIRE_RESISTANCE, 4.0F, properties), + BlockBehaviour.Properties.of() + .mapColor(MapColor.PLANT) + .noCollission() + .instabreak() + .sound(SoundType.GRASS) + .offsetType(BlockBehaviour.OffsetType.XZ) + .pushReaction(PushReaction.DESTROY) ); public static final Block AZURE_BLUET = register( "azure_bluet", - new FlowerBlock( - MobEffects.BLINDNESS, - 8.0F, - BlockBehaviour.Properties.of() - .mapColor(MapColor.PLANT) - .noCollission() - .instabreak() - .sound(SoundType.GRASS) - .offsetType(BlockBehaviour.OffsetType.XZ) - .pushReaction(PushReaction.DESTROY) - ) + properties -> new FlowerBlock(MobEffects.BLINDNESS, 8.0F, properties), + BlockBehaviour.Properties.of() + .mapColor(MapColor.PLANT) + .noCollission() + .instabreak() + .sound(SoundType.GRASS) + .offsetType(BlockBehaviour.OffsetType.XZ) + .pushReaction(PushReaction.DESTROY) ); public static final Block RED_TULIP = register( "red_tulip", - new FlowerBlock( - MobEffects.WEAKNESS, - 9.0F, - BlockBehaviour.Properties.of() - .mapColor(MapColor.PLANT) - .noCollission() - .instabreak() - .sound(SoundType.GRASS) - .offsetType(BlockBehaviour.OffsetType.XZ) - .pushReaction(PushReaction.DESTROY) - ) + properties -> new FlowerBlock(MobEffects.WEAKNESS, 9.0F, properties), + BlockBehaviour.Properties.of() + .mapColor(MapColor.PLANT) + .noCollission() + .instabreak() + .sound(SoundType.GRASS) + .offsetType(BlockBehaviour.OffsetType.XZ) + .pushReaction(PushReaction.DESTROY) ); public static final Block ORANGE_TULIP = register( "orange_tulip", - new FlowerBlock( - MobEffects.WEAKNESS, - 9.0F, - BlockBehaviour.Properties.of() - .mapColor(MapColor.PLANT) - .noCollission() - .instabreak() - .sound(SoundType.GRASS) - .offsetType(BlockBehaviour.OffsetType.XZ) - .pushReaction(PushReaction.DESTROY) - ) + properties -> new FlowerBlock(MobEffects.WEAKNESS, 9.0F, properties), + BlockBehaviour.Properties.of() + .mapColor(MapColor.PLANT) + .noCollission() + .instabreak() + .sound(SoundType.GRASS) + .offsetType(BlockBehaviour.OffsetType.XZ) + .pushReaction(PushReaction.DESTROY) ); public static final Block WHITE_TULIP = register( "white_tulip", - new FlowerBlock( - MobEffects.WEAKNESS, - 9.0F, - BlockBehaviour.Properties.of() - .mapColor(MapColor.PLANT) - .noCollission() - .instabreak() - .sound(SoundType.GRASS) - .offsetType(BlockBehaviour.OffsetType.XZ) - .pushReaction(PushReaction.DESTROY) - ) + properties -> new FlowerBlock(MobEffects.WEAKNESS, 9.0F, properties), + BlockBehaviour.Properties.of() + .mapColor(MapColor.PLANT) + .noCollission() + .instabreak() + .sound(SoundType.GRASS) + .offsetType(BlockBehaviour.OffsetType.XZ) + .pushReaction(PushReaction.DESTROY) ); public static final Block PINK_TULIP = register( "pink_tulip", - new FlowerBlock( - MobEffects.WEAKNESS, - 9.0F, - BlockBehaviour.Properties.of() - .mapColor(MapColor.PLANT) - .noCollission() - .instabreak() - .sound(SoundType.GRASS) - .offsetType(BlockBehaviour.OffsetType.XZ) - .pushReaction(PushReaction.DESTROY) - ) + properties -> new FlowerBlock(MobEffects.WEAKNESS, 9.0F, properties), + BlockBehaviour.Properties.of() + .mapColor(MapColor.PLANT) + .noCollission() + .instabreak() + .sound(SoundType.GRASS) + .offsetType(BlockBehaviour.OffsetType.XZ) + .pushReaction(PushReaction.DESTROY) ); public static final Block OXEYE_DAISY = register( "oxeye_daisy", - new FlowerBlock( - MobEffects.REGENERATION, - 8.0F, - BlockBehaviour.Properties.of() - .mapColor(MapColor.PLANT) - .noCollission() - .instabreak() - .sound(SoundType.GRASS) - .offsetType(BlockBehaviour.OffsetType.XZ) - .pushReaction(PushReaction.DESTROY) - ) + properties -> new FlowerBlock(MobEffects.REGENERATION, 8.0F, properties), + BlockBehaviour.Properties.of() + .mapColor(MapColor.PLANT) + .noCollission() + .instabreak() + .sound(SoundType.GRASS) + .offsetType(BlockBehaviour.OffsetType.XZ) + .pushReaction(PushReaction.DESTROY) ); public static final Block CORNFLOWER = register( "cornflower", - new FlowerBlock( - MobEffects.JUMP, - 6.0F, - BlockBehaviour.Properties.of() - .mapColor(MapColor.PLANT) - .noCollission() - .instabreak() - .sound(SoundType.GRASS) - .offsetType(BlockBehaviour.OffsetType.XZ) - .pushReaction(PushReaction.DESTROY) - ) + properties -> new FlowerBlock(MobEffects.JUMP, 6.0F, properties), + BlockBehaviour.Properties.of() + .mapColor(MapColor.PLANT) + .noCollission() + .instabreak() + .sound(SoundType.GRASS) + .offsetType(BlockBehaviour.OffsetType.XZ) + .pushReaction(PushReaction.DESTROY) ); public static final Block WITHER_ROSE = register( "wither_rose", - new WitherRoseBlock( - MobEffects.WITHER, - 8.0F, - BlockBehaviour.Properties.of() - .mapColor(MapColor.PLANT) - .noCollission() - .instabreak() - .sound(SoundType.GRASS) - .offsetType(BlockBehaviour.OffsetType.XZ) - .pushReaction(PushReaction.DESTROY) - ) + properties -> new WitherRoseBlock(MobEffects.WITHER, 8.0F, properties), + BlockBehaviour.Properties.of() + .mapColor(MapColor.PLANT) + .noCollission() + .instabreak() + .sound(SoundType.GRASS) + .offsetType(BlockBehaviour.OffsetType.XZ) + .pushReaction(PushReaction.DESTROY) ); public static final Block LILY_OF_THE_VALLEY = register( "lily_of_the_valley", - new FlowerBlock( - MobEffects.POISON, - 12.0F, - BlockBehaviour.Properties.of() - .mapColor(MapColor.PLANT) - .noCollission() - .instabreak() - .sound(SoundType.GRASS) - .offsetType(BlockBehaviour.OffsetType.XZ) - .pushReaction(PushReaction.DESTROY) - ) + properties -> new FlowerBlock(MobEffects.POISON, 12.0F, properties), + BlockBehaviour.Properties.of() + .mapColor(MapColor.PLANT) + .noCollission() + .instabreak() + .sound(SoundType.GRASS) + .offsetType(BlockBehaviour.OffsetType.XZ) + .pushReaction(PushReaction.DESTROY) ); public static final Block BROWN_MUSHROOM = register( "brown_mushroom", - new MushroomBlock( - TreeFeatures.HUGE_BROWN_MUSHROOM, - BlockBehaviour.Properties.of() - .mapColor(MapColor.COLOR_BROWN) - .noCollission() - .randomTicks() - .instabreak() - .sound(SoundType.GRASS) - .lightLevel(blockStatex -> 1) - .hasPostProcess(Blocks::always) - .pushReaction(PushReaction.DESTROY) - ) + properties -> new MushroomBlock(TreeFeatures.HUGE_BROWN_MUSHROOM, properties), + BlockBehaviour.Properties.of() + .mapColor(MapColor.COLOR_BROWN) + .noCollission() + .randomTicks() + .instabreak() + .sound(SoundType.GRASS) + .lightLevel(blockStatex -> 1) + .hasPostProcess(Blocks::always) + .pushReaction(PushReaction.DESTROY) ); public static final Block RED_MUSHROOM = register( "red_mushroom", - new MushroomBlock( - TreeFeatures.HUGE_RED_MUSHROOM, - BlockBehaviour.Properties.of() - .mapColor(MapColor.COLOR_RED) - .noCollission() - .randomTicks() - .instabreak() - .sound(SoundType.GRASS) - .hasPostProcess(Blocks::always) - .pushReaction(PushReaction.DESTROY) - ) + properties -> new MushroomBlock(TreeFeatures.HUGE_RED_MUSHROOM, properties), + BlockBehaviour.Properties.of() + .mapColor(MapColor.COLOR_RED) + .noCollission() + .randomTicks() + .instabreak() + .sound(SoundType.GRASS) + .hasPostProcess(Blocks::always) + .pushReaction(PushReaction.DESTROY) ); public static final Block GOLD_BLOCK = register( "gold_block", - new Block( - BlockBehaviour.Properties.of() - .mapColor(MapColor.GOLD) - .instrument(NoteBlockInstrument.BELL) - .requiresCorrectToolForDrops() - .strength(3.0F, 6.0F) - .sound(SoundType.METAL) - ) + BlockBehaviour.Properties.of() + .mapColor(MapColor.GOLD) + .instrument(NoteBlockInstrument.BELL) + .requiresCorrectToolForDrops() + .strength(3.0F, 6.0F) + .sound(SoundType.METAL) ); public static final Block IRON_BLOCK = register( "iron_block", - new Block( - BlockBehaviour.Properties.of() - .mapColor(MapColor.METAL) - .instrument(NoteBlockInstrument.IRON_XYLOPHONE) - .requiresCorrectToolForDrops() - .strength(5.0F, 6.0F) - .sound(SoundType.METAL) - ) + BlockBehaviour.Properties.of() + .mapColor(MapColor.METAL) + .instrument(NoteBlockInstrument.IRON_XYLOPHONE) + .requiresCorrectToolForDrops() + .strength(5.0F, 6.0F) + .sound(SoundType.METAL) ); public static final Block BRICKS = register( "bricks", - new Block( - BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_RED).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(2.0F, 6.0F) - ) + BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_RED).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(2.0F, 6.0F) ); public static final Block TNT = register( "tnt", - new TntBlock(BlockBehaviour.Properties.of().mapColor(MapColor.FIRE).instabreak().sound(SoundType.GRASS).ignitedByLava().isRedstoneConductor(Blocks::never)) + TntBlock::new, + BlockBehaviour.Properties.of().mapColor(MapColor.FIRE).instabreak().sound(SoundType.GRASS).ignitedByLava().isRedstoneConductor(Blocks::never) ); public static final Block BOOKSHELF = register( - "bookshelf", - new Block(BlockBehaviour.Properties.of().mapColor(MapColor.WOOD).instrument(NoteBlockInstrument.BASS).strength(1.5F).sound(SoundType.WOOD).ignitedByLava()) + "bookshelf", BlockBehaviour.Properties.of().mapColor(MapColor.WOOD).instrument(NoteBlockInstrument.BASS).strength(1.5F).sound(SoundType.WOOD).ignitedByLava() ); public static final Block CHISELED_BOOKSHELF = register( "chiseled_bookshelf", - new ChiseledBookShelfBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.WOOD) - .instrument(NoteBlockInstrument.BASS) - .strength(1.5F) - .sound(SoundType.CHISELED_BOOKSHELF) - .ignitedByLava() - ) + ChiseledBookShelfBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.WOOD) + .instrument(NoteBlockInstrument.BASS) + .strength(1.5F) + .sound(SoundType.CHISELED_BOOKSHELF) + .ignitedByLava() ); public static final Block MOSSY_COBBLESTONE = register( "mossy_cobblestone", - new Block(BlockBehaviour.Properties.of().mapColor(MapColor.STONE).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(2.0F, 6.0F)) + BlockBehaviour.Properties.of().mapColor(MapColor.STONE).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(2.0F, 6.0F) ); public static final Block OBSIDIAN = register( "obsidian", - new Block( - BlockBehaviour.Properties.of() - .mapColor(MapColor.COLOR_BLACK) - .instrument(NoteBlockInstrument.BASEDRUM) - .requiresCorrectToolForDrops() - .strength(50.0F, 1200.0F) - ) + BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_BLACK).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(50.0F, 1200.0F) ); public static final Block TORCH = register( "torch", - new TorchBlock( - ParticleTypes.FLAME, - BlockBehaviour.Properties.of().noCollission().instabreak().lightLevel(blockStatex -> 14).sound(SoundType.WOOD).pushReaction(PushReaction.DESTROY) - ) + properties -> new TorchBlock(ParticleTypes.FLAME, properties), + BlockBehaviour.Properties.of().noCollission().instabreak().lightLevel(blockStatex -> 14).sound(SoundType.WOOD).pushReaction(PushReaction.DESTROY) ); public static final Block WALL_TORCH = register( "wall_torch", - new WallTorchBlock( - ParticleTypes.FLAME, - BlockBehaviour.Properties.of() - .noCollission() - .instabreak() - .lightLevel(blockStatex -> 14) - .sound(SoundType.WOOD) - .dropsLike(TORCH) - .pushReaction(PushReaction.DESTROY) - ) + properties -> new WallTorchBlock(ParticleTypes.FLAME, properties), + wallVariant(TORCH, true).noCollission().instabreak().lightLevel(blockStatex -> 14).sound(SoundType.WOOD).pushReaction(PushReaction.DESTROY) ); public static final Block FIRE = register( "fire", - new FireBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.FIRE) - .replaceable() - .noCollission() - .instabreak() - .lightLevel(blockStatex -> 15) - .sound(SoundType.WOOL) - .pushReaction(PushReaction.DESTROY) - ) + FireBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.FIRE) + .replaceable() + .noCollission() + .instabreak() + .lightLevel(blockStatex -> 15) + .sound(SoundType.WOOL) + .pushReaction(PushReaction.DESTROY) ); public static final Block SOUL_FIRE = register( "soul_fire", - new SoulFireBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.COLOR_LIGHT_BLUE) - .replaceable() - .noCollission() - .instabreak() - .lightLevel(blockStatex -> 10) - .sound(SoundType.WOOL) - .pushReaction(PushReaction.DESTROY) - ) + SoulFireBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.COLOR_LIGHT_BLUE) + .replaceable() + .noCollission() + .instabreak() + .lightLevel(blockStatex -> 10) + .sound(SoundType.WOOL) + .pushReaction(PushReaction.DESTROY) ); public static final Block SPAWNER = register( "spawner", - new SpawnerBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.STONE) - .instrument(NoteBlockInstrument.BASEDRUM) - .requiresCorrectToolForDrops() - .strength(5.0F) - .sound(SoundType.METAL) - .noOcclusion() - ) + SpawnerBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.STONE) + .instrument(NoteBlockInstrument.BASEDRUM) + .requiresCorrectToolForDrops() + .strength(5.0F) + .sound(SoundType.SPAWNER) + .noOcclusion() ); - public static final Block OAK_STAIRS = register("oak_stairs", legacyStair(OAK_PLANKS)); + public static final Block CREAKING_HEART = register( + "creaking_heart", + CreakingHeartBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.COLOR_ORANGE) + .instrument(NoteBlockInstrument.BASEDRUM) + .strength(5.0F) + .sound(SoundType.CREAKING_HEART) + .requiredFeatures(FeatureFlags.WINTER_DROP) + ); + public static final Block OAK_STAIRS = registerLegacyStair("oak_stairs", OAK_PLANKS); public static final Block CHEST = register( "chest", - new ChestBlock( - BlockBehaviour.Properties.of().mapColor(MapColor.WOOD).instrument(NoteBlockInstrument.BASS).strength(2.5F).sound(SoundType.WOOD).ignitedByLava(), - () -> BlockEntityType.CHEST - ) + properties -> new ChestBlock(() -> BlockEntityType.CHEST, properties), + BlockBehaviour.Properties.of().mapColor(MapColor.WOOD).instrument(NoteBlockInstrument.BASS).strength(2.5F).sound(SoundType.WOOD).ignitedByLava() ); public static final Block REDSTONE_WIRE = register( - "redstone_wire", new RedStoneWireBlock(BlockBehaviour.Properties.of().noCollission().instabreak().pushReaction(PushReaction.DESTROY)) + "redstone_wire", RedStoneWireBlock::new, BlockBehaviour.Properties.of().noCollission().instabreak().pushReaction(PushReaction.DESTROY) ); public static final Block DIAMOND_ORE = register( "diamond_ore", - new DropExperienceBlock( - UniformInt.of(3, 7), - BlockBehaviour.Properties.of().mapColor(MapColor.STONE).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(3.0F, 3.0F) - ) + properties -> new DropExperienceBlock(UniformInt.of(3, 7), properties), + BlockBehaviour.Properties.of().mapColor(MapColor.STONE).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(3.0F, 3.0F) ); public static final Block DEEPSLATE_DIAMOND_ORE = register( "deepslate_diamond_ore", - new DropExperienceBlock( - UniformInt.of(3, 7), BlockBehaviour.Properties.ofLegacyCopy(DIAMOND_ORE).mapColor(MapColor.DEEPSLATE).strength(4.5F, 3.0F).sound(SoundType.DEEPSLATE) - ) + properties -> new DropExperienceBlock(UniformInt.of(3, 7), properties), + BlockBehaviour.Properties.ofLegacyCopy(DIAMOND_ORE).mapColor(MapColor.DEEPSLATE).strength(4.5F, 3.0F).sound(SoundType.DEEPSLATE) ); public static final Block DIAMOND_BLOCK = register( - "diamond_block", - new Block(BlockBehaviour.Properties.of().mapColor(MapColor.DIAMOND).requiresCorrectToolForDrops().strength(5.0F, 6.0F).sound(SoundType.METAL)) + "diamond_block", BlockBehaviour.Properties.of().mapColor(MapColor.DIAMOND).requiresCorrectToolForDrops().strength(5.0F, 6.0F).sound(SoundType.METAL) ); public static final Block CRAFTING_TABLE = register( "crafting_table", - new CraftingTableBlock( - BlockBehaviour.Properties.of().mapColor(MapColor.WOOD).instrument(NoteBlockInstrument.BASS).strength(2.5F).sound(SoundType.WOOD).ignitedByLava() - ) + CraftingTableBlock::new, + BlockBehaviour.Properties.of().mapColor(MapColor.WOOD).instrument(NoteBlockInstrument.BASS).strength(2.5F).sound(SoundType.WOOD).ignitedByLava() ); public static final Block WHEAT = register( "wheat", - new CropBlock( - BlockBehaviour.Properties.of().mapColor(MapColor.PLANT).noCollission().randomTicks().instabreak().sound(SoundType.CROP).pushReaction(PushReaction.DESTROY) - ) + CropBlock::new, + BlockBehaviour.Properties.of() + .mapColor(blockStatex -> blockStatex.getValue(CropBlock.AGE) >= 6 ? MapColor.COLOR_YELLOW : MapColor.PLANT) + .noCollission() + .randomTicks() + .instabreak() + .sound(SoundType.CROP) + .pushReaction(PushReaction.DESTROY) ); public static final Block FARMLAND = register( "farmland", - new FarmBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.DIRT) - .randomTicks() - .strength(0.6F) - .sound(SoundType.GRAVEL) - .isViewBlocking(Blocks::always) - .isSuffocating(Blocks::always) - ) + FarmBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.DIRT) + .randomTicks() + .strength(0.6F) + .sound(SoundType.GRAVEL) + .isViewBlocking(Blocks::always) + .isSuffocating(Blocks::always) ); public static final Block FURNACE = register( "furnace", - new FurnaceBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.STONE) - .instrument(NoteBlockInstrument.BASEDRUM) - .requiresCorrectToolForDrops() - .strength(3.5F) - .lightLevel(litBlockEmission(13)) - ) + FurnaceBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.STONE) + .instrument(NoteBlockInstrument.BASEDRUM) + .requiresCorrectToolForDrops() + .strength(3.5F) + .lightLevel(litBlockEmission(13)) ); public static final Block OAK_SIGN = register( "oak_sign", - new StandingSignBlock( - WoodType.OAK, - BlockBehaviour.Properties.of().mapColor(MapColor.WOOD).forceSolidOn().instrument(NoteBlockInstrument.BASS).noCollission().strength(1.0F).ignitedByLava() - ) + properties -> new StandingSignBlock(WoodType.OAK, properties), + BlockBehaviour.Properties.of().mapColor(MapColor.WOOD).forceSolidOn().instrument(NoteBlockInstrument.BASS).noCollission().strength(1.0F).ignitedByLava() ); public static final Block SPRUCE_SIGN = register( "spruce_sign", - new StandingSignBlock( - WoodType.SPRUCE, - BlockBehaviour.Properties.of() - .mapColor(SPRUCE_LOG.defaultMapColor()) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASS) - .noCollission() - .strength(1.0F) - .ignitedByLava() - ) + properties -> new StandingSignBlock(WoodType.SPRUCE, properties), + BlockBehaviour.Properties.of() + .mapColor(SPRUCE_LOG.defaultMapColor()) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASS) + .noCollission() + .strength(1.0F) + .ignitedByLava() ); public static final Block BIRCH_SIGN = register( "birch_sign", - new StandingSignBlock( - WoodType.BIRCH, - BlockBehaviour.Properties.of().mapColor(MapColor.SAND).forceSolidOn().instrument(NoteBlockInstrument.BASS).noCollission().strength(1.0F).ignitedByLava() - ) + properties -> new StandingSignBlock(WoodType.BIRCH, properties), + BlockBehaviour.Properties.of().mapColor(MapColor.SAND).forceSolidOn().instrument(NoteBlockInstrument.BASS).noCollission().strength(1.0F).ignitedByLava() ); public static final Block ACACIA_SIGN = register( "acacia_sign", - new StandingSignBlock( - WoodType.ACACIA, - BlockBehaviour.Properties.of() - .mapColor(MapColor.COLOR_ORANGE) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASS) - .noCollission() - .strength(1.0F) - .ignitedByLava() - ) + properties -> new StandingSignBlock(WoodType.ACACIA, properties), + BlockBehaviour.Properties.of() + .mapColor(MapColor.COLOR_ORANGE) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASS) + .noCollission() + .strength(1.0F) + .ignitedByLava() ); public static final Block CHERRY_SIGN = register( "cherry_sign", - new StandingSignBlock( - WoodType.CHERRY, - BlockBehaviour.Properties.of() - .mapColor(CHERRY_PLANKS.defaultMapColor()) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASS) - .noCollission() - .strength(1.0F) - .ignitedByLava() - ) + properties -> new StandingSignBlock(WoodType.CHERRY, properties), + BlockBehaviour.Properties.of() + .mapColor(CHERRY_PLANKS.defaultMapColor()) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASS) + .noCollission() + .strength(1.0F) + .ignitedByLava() ); public static final Block JUNGLE_SIGN = register( "jungle_sign", - new StandingSignBlock( - WoodType.JUNGLE, - BlockBehaviour.Properties.of() - .mapColor(JUNGLE_LOG.defaultMapColor()) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASS) - .noCollission() - .strength(1.0F) - .ignitedByLava() - ) + properties -> new StandingSignBlock(WoodType.JUNGLE, properties), + BlockBehaviour.Properties.of() + .mapColor(JUNGLE_LOG.defaultMapColor()) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASS) + .noCollission() + .strength(1.0F) + .ignitedByLava() ); public static final Block DARK_OAK_SIGN = register( "dark_oak_sign", - new StandingSignBlock( - WoodType.DARK_OAK, - BlockBehaviour.Properties.of() - .mapColor(DARK_OAK_LOG.defaultMapColor()) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASS) - .noCollission() - .strength(1.0F) - .ignitedByLava() - ) + properties -> new StandingSignBlock(WoodType.DARK_OAK, properties), + BlockBehaviour.Properties.of() + .mapColor(DARK_OAK_LOG.defaultMapColor()) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASS) + .noCollission() + .strength(1.0F) + .ignitedByLava() + ); + public static final Block PALE_OAK_SIGN = register( + "pale_oak_sign", + properties -> new StandingSignBlock(WoodType.PALE_OAK, properties), + BlockBehaviour.Properties.of() + .mapColor(PALE_OAK_PLANKS.defaultMapColor()) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASS) + .noCollission() + .strength(1.0F) + .ignitedByLava() + .requiredFeatures(FeatureFlags.WINTER_DROP) ); public static final Block MANGROVE_SIGN = register( "mangrove_sign", - new StandingSignBlock( - WoodType.MANGROVE, - BlockBehaviour.Properties.of() - .mapColor(MANGROVE_LOG.defaultMapColor()) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASS) - .noCollission() - .strength(1.0F) - .ignitedByLava() - ) + properties -> new StandingSignBlock(WoodType.MANGROVE, properties), + BlockBehaviour.Properties.of() + .mapColor(MANGROVE_LOG.defaultMapColor()) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASS) + .noCollission() + .strength(1.0F) + .ignitedByLava() ); public static final Block BAMBOO_SIGN = register( "bamboo_sign", - new StandingSignBlock( - WoodType.BAMBOO, - BlockBehaviour.Properties.of() - .mapColor(BAMBOO_PLANKS.defaultMapColor()) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASS) - .noCollission() - .strength(1.0F) - .ignitedByLava() - ) + properties -> new StandingSignBlock(WoodType.BAMBOO, properties), + BlockBehaviour.Properties.of() + .mapColor(BAMBOO_PLANKS.defaultMapColor()) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASS) + .noCollission() + .strength(1.0F) + .ignitedByLava() ); public static final Block OAK_DOOR = register( "oak_door", - new DoorBlock( - BlockSetType.OAK, - BlockBehaviour.Properties.of() - .mapColor(OAK_PLANKS.defaultMapColor()) - .instrument(NoteBlockInstrument.BASS) - .strength(3.0F) - .noOcclusion() - .ignitedByLava() - .pushReaction(PushReaction.DESTROY) - ) + properties -> new DoorBlock(BlockSetType.OAK, properties), + BlockBehaviour.Properties.of() + .mapColor(OAK_PLANKS.defaultMapColor()) + .instrument(NoteBlockInstrument.BASS) + .strength(3.0F) + .noOcclusion() + .ignitedByLava() + .pushReaction(PushReaction.DESTROY) ); public static final Block LADDER = register( "ladder", - new LadderBlock(BlockBehaviour.Properties.of().forceSolidOff().strength(0.4F).sound(SoundType.LADDER).noOcclusion().pushReaction(PushReaction.DESTROY)) + LadderBlock::new, + BlockBehaviour.Properties.of().forceSolidOff().strength(0.4F).sound(SoundType.LADDER).noOcclusion().pushReaction(PushReaction.DESTROY) ); - public static final Block RAIL = register("rail", new RailBlock(BlockBehaviour.Properties.of().noCollission().strength(0.7F).sound(SoundType.METAL))); - public static final Block COBBLESTONE_STAIRS = register("cobblestone_stairs", legacyStair(COBBLESTONE)); + public static final Block RAIL = register("rail", RailBlock::new, BlockBehaviour.Properties.of().noCollission().strength(0.7F).sound(SoundType.METAL)); + public static final Block COBBLESTONE_STAIRS = registerLegacyStair("cobblestone_stairs", COBBLESTONE); public static final Block OAK_WALL_SIGN = register( "oak_wall_sign", - new WallSignBlock( - WoodType.OAK, - BlockBehaviour.Properties.of() - .mapColor(MapColor.WOOD) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASS) - .noCollission() - .strength(1.0F) - .dropsLike(OAK_SIGN) - .ignitedByLava() - ) + properties -> new WallSignBlock(WoodType.OAK, properties), + wallVariant(OAK_SIGN, true).mapColor(MapColor.WOOD).forceSolidOn().instrument(NoteBlockInstrument.BASS).noCollission().strength(1.0F).ignitedByLava() ); public static final Block SPRUCE_WALL_SIGN = register( "spruce_wall_sign", - new WallSignBlock( - WoodType.SPRUCE, - BlockBehaviour.Properties.of() - .mapColor(SPRUCE_LOG.defaultMapColor()) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASS) - .noCollission() - .strength(1.0F) - .dropsLike(SPRUCE_SIGN) - .ignitedByLava() - ) + properties -> new WallSignBlock(WoodType.SPRUCE, properties), + wallVariant(SPRUCE_SIGN, true) + .mapColor(SPRUCE_LOG.defaultMapColor()) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASS) + .noCollission() + .strength(1.0F) + .ignitedByLava() ); public static final Block BIRCH_WALL_SIGN = register( "birch_wall_sign", - new WallSignBlock( - WoodType.BIRCH, - BlockBehaviour.Properties.of() - .mapColor(MapColor.SAND) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASS) - .noCollission() - .strength(1.0F) - .dropsLike(BIRCH_SIGN) - .ignitedByLava() - ) + properties -> new WallSignBlock(WoodType.BIRCH, properties), + wallVariant(BIRCH_SIGN, true).mapColor(MapColor.SAND).forceSolidOn().instrument(NoteBlockInstrument.BASS).noCollission().strength(1.0F).ignitedByLava() ); public static final Block ACACIA_WALL_SIGN = register( "acacia_wall_sign", - new WallSignBlock( - WoodType.ACACIA, - BlockBehaviour.Properties.of() - .mapColor(MapColor.COLOR_ORANGE) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASS) - .noCollission() - .strength(1.0F) - .dropsLike(ACACIA_SIGN) - .ignitedByLava() - ) + properties -> new WallSignBlock(WoodType.ACACIA, properties), + wallVariant(ACACIA_SIGN, true) + .mapColor(MapColor.COLOR_ORANGE) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASS) + .noCollission() + .strength(1.0F) + .ignitedByLava() ); public static final Block CHERRY_WALL_SIGN = register( "cherry_wall_sign", - new WallSignBlock( - WoodType.CHERRY, - BlockBehaviour.Properties.of() - .mapColor(CHERRY_LOG.defaultMapColor()) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASS) - .noCollission() - .strength(1.0F) - .dropsLike(CHERRY_SIGN) - .ignitedByLava() - ) + properties -> new WallSignBlock(WoodType.CHERRY, properties), + wallVariant(CHERRY_SIGN, true) + .mapColor(CHERRY_LOG.defaultMapColor()) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASS) + .noCollission() + .strength(1.0F) + .ignitedByLava() ); public static final Block JUNGLE_WALL_SIGN = register( "jungle_wall_sign", - new WallSignBlock( - WoodType.JUNGLE, - BlockBehaviour.Properties.of() - .mapColor(JUNGLE_LOG.defaultMapColor()) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASS) - .noCollission() - .strength(1.0F) - .dropsLike(JUNGLE_SIGN) - .ignitedByLava() - ) + properties -> new WallSignBlock(WoodType.JUNGLE, properties), + wallVariant(JUNGLE_SIGN, true) + .mapColor(JUNGLE_LOG.defaultMapColor()) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASS) + .noCollission() + .strength(1.0F) + .ignitedByLava() ); public static final Block DARK_OAK_WALL_SIGN = register( "dark_oak_wall_sign", - new WallSignBlock( - WoodType.DARK_OAK, - BlockBehaviour.Properties.of() - .mapColor(DARK_OAK_LOG.defaultMapColor()) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASS) - .noCollission() - .strength(1.0F) - .dropsLike(DARK_OAK_SIGN) - .ignitedByLava() - ) + properties -> new WallSignBlock(WoodType.DARK_OAK, properties), + wallVariant(DARK_OAK_SIGN, true) + .mapColor(DARK_OAK_LOG.defaultMapColor()) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASS) + .noCollission() + .strength(1.0F) + .ignitedByLava() + ); + public static final Block PALE_OAK_WALL_SIGN = register( + "pale_oak_wall_sign", + properties -> new WallSignBlock(WoodType.PALE_OAK, properties), + wallVariant(PALE_OAK_SIGN, true) + .mapColor(PALE_OAK_PLANKS.defaultMapColor()) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASS) + .noCollission() + .strength(1.0F) + .ignitedByLava() + .requiredFeatures(FeatureFlags.WINTER_DROP) ); public static final Block MANGROVE_WALL_SIGN = register( "mangrove_wall_sign", - new WallSignBlock( - WoodType.MANGROVE, - BlockBehaviour.Properties.of() - .mapColor(MANGROVE_LOG.defaultMapColor()) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASS) - .noCollission() - .strength(1.0F) - .dropsLike(MANGROVE_SIGN) - .ignitedByLava() - ) + properties -> new WallSignBlock(WoodType.MANGROVE, properties), + wallVariant(MANGROVE_SIGN, true) + .mapColor(MANGROVE_LOG.defaultMapColor()) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASS) + .noCollission() + .strength(1.0F) + .ignitedByLava() ); public static final Block BAMBOO_WALL_SIGN = register( "bamboo_wall_sign", - new WallSignBlock( - WoodType.BAMBOO, - BlockBehaviour.Properties.of() - .mapColor(BAMBOO_PLANKS.defaultMapColor()) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASS) - .noCollission() - .strength(1.0F) - .ignitedByLava() - .dropsLike(BAMBOO_SIGN) - ) + properties -> new WallSignBlock(WoodType.BAMBOO, properties), + wallVariant(BAMBOO_SIGN, true) + .mapColor(BAMBOO_PLANKS.defaultMapColor()) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASS) + .noCollission() + .strength(1.0F) + .ignitedByLava() ); public static final Block OAK_HANGING_SIGN = register( "oak_hanging_sign", - new CeilingHangingSignBlock( - WoodType.OAK, - BlockBehaviour.Properties.of() - .mapColor(OAK_LOG.defaultMapColor()) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASS) - .noCollission() - .strength(1.0F) - .ignitedByLava() - ) + properties -> new CeilingHangingSignBlock(WoodType.OAK, properties), + BlockBehaviour.Properties.of() + .mapColor(OAK_LOG.defaultMapColor()) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASS) + .noCollission() + .strength(1.0F) + .ignitedByLava() ); public static final Block SPRUCE_HANGING_SIGN = register( "spruce_hanging_sign", - new CeilingHangingSignBlock( - WoodType.SPRUCE, - BlockBehaviour.Properties.of() - .mapColor(SPRUCE_LOG.defaultMapColor()) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASS) - .noCollission() - .strength(1.0F) - .ignitedByLava() - ) + properties -> new CeilingHangingSignBlock(WoodType.SPRUCE, properties), + BlockBehaviour.Properties.of() + .mapColor(SPRUCE_LOG.defaultMapColor()) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASS) + .noCollission() + .strength(1.0F) + .ignitedByLava() ); public static final Block BIRCH_HANGING_SIGN = register( "birch_hanging_sign", - new CeilingHangingSignBlock( - WoodType.BIRCH, - BlockBehaviour.Properties.of().mapColor(MapColor.SAND).forceSolidOn().instrument(NoteBlockInstrument.BASS).noCollission().strength(1.0F).ignitedByLava() - ) + properties -> new CeilingHangingSignBlock(WoodType.BIRCH, properties), + BlockBehaviour.Properties.of().mapColor(MapColor.SAND).forceSolidOn().instrument(NoteBlockInstrument.BASS).noCollission().strength(1.0F).ignitedByLava() ); public static final Block ACACIA_HANGING_SIGN = register( "acacia_hanging_sign", - new CeilingHangingSignBlock( - WoodType.ACACIA, - BlockBehaviour.Properties.of() - .mapColor(MapColor.COLOR_ORANGE) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASS) - .noCollission() - .strength(1.0F) - .ignitedByLava() - ) + properties -> new CeilingHangingSignBlock(WoodType.ACACIA, properties), + BlockBehaviour.Properties.of() + .mapColor(MapColor.COLOR_ORANGE) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASS) + .noCollission() + .strength(1.0F) + .ignitedByLava() ); public static final Block CHERRY_HANGING_SIGN = register( "cherry_hanging_sign", - new CeilingHangingSignBlock( - WoodType.CHERRY, - BlockBehaviour.Properties.of() - .mapColor(MapColor.TERRACOTTA_PINK) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASS) - .noCollission() - .strength(1.0F) - .ignitedByLava() - ) + properties -> new CeilingHangingSignBlock(WoodType.CHERRY, properties), + BlockBehaviour.Properties.of() + .mapColor(MapColor.TERRACOTTA_PINK) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASS) + .noCollission() + .strength(1.0F) + .ignitedByLava() ); public static final Block JUNGLE_HANGING_SIGN = register( "jungle_hanging_sign", - new CeilingHangingSignBlock( - WoodType.JUNGLE, - BlockBehaviour.Properties.of() - .mapColor(JUNGLE_LOG.defaultMapColor()) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASS) - .noCollission() - .strength(1.0F) - .ignitedByLava() - ) + properties -> new CeilingHangingSignBlock(WoodType.JUNGLE, properties), + BlockBehaviour.Properties.of() + .mapColor(JUNGLE_LOG.defaultMapColor()) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASS) + .noCollission() + .strength(1.0F) + .ignitedByLava() ); public static final Block DARK_OAK_HANGING_SIGN = register( "dark_oak_hanging_sign", - new CeilingHangingSignBlock( - WoodType.DARK_OAK, - BlockBehaviour.Properties.of() - .mapColor(DARK_OAK_LOG.defaultMapColor()) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASS) - .noCollission() - .strength(1.0F) - .ignitedByLava() - ) + properties -> new CeilingHangingSignBlock(WoodType.DARK_OAK, properties), + BlockBehaviour.Properties.of() + .mapColor(DARK_OAK_LOG.defaultMapColor()) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASS) + .noCollission() + .strength(1.0F) + .ignitedByLava() + ); + public static final Block PALE_OAK_HANGING_SIGN = register( + "pale_oak_hanging_sign", + properties -> new CeilingHangingSignBlock(WoodType.PALE_OAK, properties), + BlockBehaviour.Properties.of() + .mapColor(PALE_OAK_PLANKS.defaultMapColor()) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASS) + .noCollission() + .strength(1.0F) + .ignitedByLava() + .requiredFeatures(FeatureFlags.WINTER_DROP) ); public static final Block CRIMSON_HANGING_SIGN = register( "crimson_hanging_sign", - new CeilingHangingSignBlock( - WoodType.CRIMSON, - BlockBehaviour.Properties.of().mapColor(MapColor.CRIMSON_STEM).forceSolidOn().instrument(NoteBlockInstrument.BASS).noCollission().strength(1.0F) - ) + properties -> new CeilingHangingSignBlock(WoodType.CRIMSON, properties), + BlockBehaviour.Properties.of().mapColor(MapColor.CRIMSON_STEM).forceSolidOn().instrument(NoteBlockInstrument.BASS).noCollission().strength(1.0F) ); public static final Block WARPED_HANGING_SIGN = register( "warped_hanging_sign", - new CeilingHangingSignBlock( - WoodType.WARPED, - BlockBehaviour.Properties.of().mapColor(MapColor.WARPED_STEM).forceSolidOn().instrument(NoteBlockInstrument.BASS).noCollission().strength(1.0F) - ) + properties -> new CeilingHangingSignBlock(WoodType.WARPED, properties), + BlockBehaviour.Properties.of().mapColor(MapColor.WARPED_STEM).forceSolidOn().instrument(NoteBlockInstrument.BASS).noCollission().strength(1.0F) ); public static final Block MANGROVE_HANGING_SIGN = register( "mangrove_hanging_sign", - new CeilingHangingSignBlock( - WoodType.MANGROVE, - BlockBehaviour.Properties.of() - .mapColor(MANGROVE_LOG.defaultMapColor()) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASS) - .noCollission() - .strength(1.0F) - .ignitedByLava() - ) + properties -> new CeilingHangingSignBlock(WoodType.MANGROVE, properties), + BlockBehaviour.Properties.of() + .mapColor(MANGROVE_LOG.defaultMapColor()) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASS) + .noCollission() + .strength(1.0F) + .ignitedByLava() ); public static final Block BAMBOO_HANGING_SIGN = register( "bamboo_hanging_sign", - new CeilingHangingSignBlock( - WoodType.BAMBOO, - BlockBehaviour.Properties.of() - .mapColor(MapColor.COLOR_YELLOW) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASS) - .noCollission() - .strength(1.0F) - .ignitedByLava() - ) + properties -> new CeilingHangingSignBlock(WoodType.BAMBOO, properties), + BlockBehaviour.Properties.of() + .mapColor(MapColor.COLOR_YELLOW) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASS) + .noCollission() + .strength(1.0F) + .ignitedByLava() ); public static final Block OAK_WALL_HANGING_SIGN = register( "oak_wall_hanging_sign", - new WallHangingSignBlock( - WoodType.OAK, - BlockBehaviour.Properties.of() - .mapColor(OAK_LOG.defaultMapColor()) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASS) - .noCollission() - .strength(1.0F) - .ignitedByLava() - .dropsLike(OAK_HANGING_SIGN) - ) + properties -> new WallHangingSignBlock(WoodType.OAK, properties), + wallVariant(OAK_HANGING_SIGN, true) + .mapColor(OAK_LOG.defaultMapColor()) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASS) + .noCollission() + .strength(1.0F) + .ignitedByLava() ); public static final Block SPRUCE_WALL_HANGING_SIGN = register( "spruce_wall_hanging_sign", - new WallHangingSignBlock( - WoodType.SPRUCE, - BlockBehaviour.Properties.of() - .mapColor(MapColor.WOOD) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASS) - .noCollission() - .strength(1.0F) - .dropsLike(SPRUCE_HANGING_SIGN) - .ignitedByLava() - ) + properties -> new WallHangingSignBlock(WoodType.SPRUCE, properties), + wallVariant(SPRUCE_HANGING_SIGN, true) + .mapColor(MapColor.WOOD) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASS) + .noCollission() + .strength(1.0F) + .ignitedByLava() ); public static final Block BIRCH_WALL_HANGING_SIGN = register( "birch_wall_hanging_sign", - new WallHangingSignBlock( - WoodType.BIRCH, - BlockBehaviour.Properties.of() - .mapColor(MapColor.SAND) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASS) - .noCollission() - .strength(1.0F) - .dropsLike(BIRCH_HANGING_SIGN) - .ignitedByLava() - ) + properties -> new WallHangingSignBlock(WoodType.BIRCH, properties), + wallVariant(BIRCH_HANGING_SIGN, true) + .mapColor(MapColor.SAND) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASS) + .noCollission() + .strength(1.0F) + .ignitedByLava() ); public static final Block ACACIA_WALL_HANGING_SIGN = register( "acacia_wall_hanging_sign", - new WallHangingSignBlock( - WoodType.ACACIA, - BlockBehaviour.Properties.of() - .mapColor(MapColor.COLOR_ORANGE) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASS) - .noCollission() - .strength(1.0F) - .ignitedByLava() - .dropsLike(ACACIA_HANGING_SIGN) - ) + properties -> new WallHangingSignBlock(WoodType.ACACIA, properties), + wallVariant(ACACIA_HANGING_SIGN, true) + .mapColor(MapColor.COLOR_ORANGE) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASS) + .noCollission() + .strength(1.0F) + .ignitedByLava() ); public static final Block CHERRY_WALL_HANGING_SIGN = register( "cherry_wall_hanging_sign", - new WallHangingSignBlock( - WoodType.CHERRY, - BlockBehaviour.Properties.of() - .mapColor(MapColor.TERRACOTTA_PINK) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASS) - .noCollission() - .strength(1.0F) - .ignitedByLava() - .dropsLike(CHERRY_HANGING_SIGN) - ) + properties -> new WallHangingSignBlock(WoodType.CHERRY, properties), + wallVariant(CHERRY_HANGING_SIGN, true) + .mapColor(MapColor.TERRACOTTA_PINK) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASS) + .noCollission() + .strength(1.0F) + .ignitedByLava() ); public static final Block JUNGLE_WALL_HANGING_SIGN = register( "jungle_wall_hanging_sign", - new WallHangingSignBlock( - WoodType.JUNGLE, - BlockBehaviour.Properties.of() - .mapColor(JUNGLE_LOG.defaultMapColor()) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASS) - .noCollission() - .strength(1.0F) - .ignitedByLava() - .dropsLike(JUNGLE_HANGING_SIGN) - ) + properties -> new WallHangingSignBlock(WoodType.JUNGLE, properties), + wallVariant(JUNGLE_HANGING_SIGN, true) + .mapColor(JUNGLE_LOG.defaultMapColor()) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASS) + .noCollission() + .strength(1.0F) + .ignitedByLava() ); public static final Block DARK_OAK_WALL_HANGING_SIGN = register( "dark_oak_wall_hanging_sign", - new WallHangingSignBlock( - WoodType.DARK_OAK, - BlockBehaviour.Properties.of() - .mapColor(DARK_OAK_LOG.defaultMapColor()) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASS) - .noCollission() - .strength(1.0F) - .ignitedByLava() - .dropsLike(DARK_OAK_HANGING_SIGN) - ) + properties -> new WallHangingSignBlock(WoodType.DARK_OAK, properties), + wallVariant(DARK_OAK_HANGING_SIGN, true) + .mapColor(DARK_OAK_LOG.defaultMapColor()) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASS) + .noCollission() + .strength(1.0F) + .ignitedByLava() + ); + public static final Block PALE_OAK_WALL_HANGING_SIGN = register( + "pale_oak_wall_hanging_sign", + properties -> new WallHangingSignBlock(WoodType.PALE_OAK, properties), + wallVariant(PALE_OAK_HANGING_SIGN, true) + .mapColor(PALE_OAK_PLANKS.defaultMapColor()) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASS) + .noCollission() + .strength(1.0F) + .ignitedByLava() + .requiredFeatures(FeatureFlags.WINTER_DROP) ); public static final Block MANGROVE_WALL_HANGING_SIGN = register( "mangrove_wall_hanging_sign", - new WallHangingSignBlock( - WoodType.MANGROVE, - BlockBehaviour.Properties.of() - .mapColor(MANGROVE_LOG.defaultMapColor()) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASS) - .noCollission() - .strength(1.0F) - .ignitedByLava() - .dropsLike(MANGROVE_HANGING_SIGN) - ) + properties -> new WallHangingSignBlock(WoodType.MANGROVE, properties), + wallVariant(MANGROVE_HANGING_SIGN, true) + .mapColor(MANGROVE_LOG.defaultMapColor()) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASS) + .noCollission() + .strength(1.0F) + .ignitedByLava() ); public static final Block CRIMSON_WALL_HANGING_SIGN = register( "crimson_wall_hanging_sign", - new WallHangingSignBlock( - WoodType.CRIMSON, - BlockBehaviour.Properties.of() - .mapColor(MapColor.CRIMSON_STEM) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASS) - .noCollission() - .strength(1.0F) - .dropsLike(CRIMSON_HANGING_SIGN) - ) + properties -> new WallHangingSignBlock(WoodType.CRIMSON, properties), + wallVariant(CRIMSON_HANGING_SIGN, true).mapColor(MapColor.CRIMSON_STEM).forceSolidOn().instrument(NoteBlockInstrument.BASS).noCollission().strength(1.0F) ); public static final Block WARPED_WALL_HANGING_SIGN = register( "warped_wall_hanging_sign", - new WallHangingSignBlock( - WoodType.WARPED, - BlockBehaviour.Properties.of() - .mapColor(MapColor.WARPED_STEM) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASS) - .noCollission() - .strength(1.0F) - .dropsLike(WARPED_HANGING_SIGN) - ) + properties -> new WallHangingSignBlock(WoodType.WARPED, properties), + wallVariant(WARPED_HANGING_SIGN, true).mapColor(MapColor.WARPED_STEM).forceSolidOn().instrument(NoteBlockInstrument.BASS).noCollission().strength(1.0F) ); public static final Block BAMBOO_WALL_HANGING_SIGN = register( "bamboo_wall_hanging_sign", - new WallHangingSignBlock( - WoodType.BAMBOO, - BlockBehaviour.Properties.of() - .mapColor(MapColor.COLOR_YELLOW) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASS) - .noCollission() - .strength(1.0F) - .ignitedByLava() - .dropsLike(BAMBOO_HANGING_SIGN) - ) + properties -> new WallHangingSignBlock(WoodType.BAMBOO, properties), + wallVariant(BAMBOO_HANGING_SIGN, true) + .mapColor(MapColor.COLOR_YELLOW) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASS) + .noCollission() + .strength(1.0F) + .ignitedByLava() ); public static final Block LEVER = register( - "lever", new LeverBlock(BlockBehaviour.Properties.of().noCollission().strength(0.5F).sound(SoundType.STONE).pushReaction(PushReaction.DESTROY)) + "lever", LeverBlock::new, BlockBehaviour.Properties.of().noCollission().strength(0.5F).sound(SoundType.STONE).pushReaction(PushReaction.DESTROY) ); public static final Block STONE_PRESSURE_PLATE = register( "stone_pressure_plate", - new PressurePlateBlock( - BlockSetType.STONE, - BlockBehaviour.Properties.of() - .mapColor(MapColor.STONE) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASEDRUM) - .requiresCorrectToolForDrops() - .noCollission() - .strength(0.5F) - .pushReaction(PushReaction.DESTROY) - ) + properties -> new PressurePlateBlock(BlockSetType.STONE, properties), + BlockBehaviour.Properties.of() + .mapColor(MapColor.STONE) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASEDRUM) + .requiresCorrectToolForDrops() + .noCollission() + .strength(0.5F) + .pushReaction(PushReaction.DESTROY) ); public static final Block IRON_DOOR = register( "iron_door", - new DoorBlock( - BlockSetType.IRON, - BlockBehaviour.Properties.of().mapColor(MapColor.METAL).requiresCorrectToolForDrops().strength(5.0F).noOcclusion().pushReaction(PushReaction.DESTROY) - ) + properties -> new DoorBlock(BlockSetType.IRON, properties), + BlockBehaviour.Properties.of().mapColor(MapColor.METAL).requiresCorrectToolForDrops().strength(5.0F).noOcclusion().pushReaction(PushReaction.DESTROY) ); public static final Block OAK_PRESSURE_PLATE = register( "oak_pressure_plate", - new PressurePlateBlock( - BlockSetType.OAK, - BlockBehaviour.Properties.of() - .mapColor(OAK_PLANKS.defaultMapColor()) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASS) - .noCollission() - .strength(0.5F) - .ignitedByLava() - .pushReaction(PushReaction.DESTROY) - ) + properties -> new PressurePlateBlock(BlockSetType.OAK, properties), + BlockBehaviour.Properties.of() + .mapColor(OAK_PLANKS.defaultMapColor()) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASS) + .noCollission() + .strength(0.5F) + .ignitedByLava() + .pushReaction(PushReaction.DESTROY) ); public static final Block SPRUCE_PRESSURE_PLATE = register( "spruce_pressure_plate", - new PressurePlateBlock( - BlockSetType.SPRUCE, - BlockBehaviour.Properties.of() - .mapColor(SPRUCE_PLANKS.defaultMapColor()) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASS) - .noCollission() - .strength(0.5F) - .ignitedByLava() - .pushReaction(PushReaction.DESTROY) - ) + properties -> new PressurePlateBlock(BlockSetType.SPRUCE, properties), + BlockBehaviour.Properties.of() + .mapColor(SPRUCE_PLANKS.defaultMapColor()) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASS) + .noCollission() + .strength(0.5F) + .ignitedByLava() + .pushReaction(PushReaction.DESTROY) ); public static final Block BIRCH_PRESSURE_PLATE = register( "birch_pressure_plate", - new PressurePlateBlock( - BlockSetType.BIRCH, - BlockBehaviour.Properties.of() - .mapColor(BIRCH_PLANKS.defaultMapColor()) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASS) - .noCollission() - .strength(0.5F) - .ignitedByLava() - .pushReaction(PushReaction.DESTROY) - ) + properties -> new PressurePlateBlock(BlockSetType.BIRCH, properties), + BlockBehaviour.Properties.of() + .mapColor(BIRCH_PLANKS.defaultMapColor()) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASS) + .noCollission() + .strength(0.5F) + .ignitedByLava() + .pushReaction(PushReaction.DESTROY) ); public static final Block JUNGLE_PRESSURE_PLATE = register( "jungle_pressure_plate", - new PressurePlateBlock( - BlockSetType.JUNGLE, - BlockBehaviour.Properties.of() - .mapColor(JUNGLE_PLANKS.defaultMapColor()) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASS) - .noCollission() - .strength(0.5F) - .ignitedByLava() - .pushReaction(PushReaction.DESTROY) - ) + properties -> new PressurePlateBlock(BlockSetType.JUNGLE, properties), + BlockBehaviour.Properties.of() + .mapColor(JUNGLE_PLANKS.defaultMapColor()) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASS) + .noCollission() + .strength(0.5F) + .ignitedByLava() + .pushReaction(PushReaction.DESTROY) ); public static final Block ACACIA_PRESSURE_PLATE = register( "acacia_pressure_plate", - new PressurePlateBlock( - BlockSetType.ACACIA, - BlockBehaviour.Properties.of() - .mapColor(ACACIA_PLANKS.defaultMapColor()) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASS) - .noCollission() - .strength(0.5F) - .ignitedByLava() - .pushReaction(PushReaction.DESTROY) - ) + properties -> new PressurePlateBlock(BlockSetType.ACACIA, properties), + BlockBehaviour.Properties.of() + .mapColor(ACACIA_PLANKS.defaultMapColor()) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASS) + .noCollission() + .strength(0.5F) + .ignitedByLava() + .pushReaction(PushReaction.DESTROY) ); public static final Block CHERRY_PRESSURE_PLATE = register( "cherry_pressure_plate", - new PressurePlateBlock( - BlockSetType.CHERRY, - BlockBehaviour.Properties.of() - .mapColor(CHERRY_PLANKS.defaultMapColor()) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASS) - .noCollission() - .strength(0.5F) - .ignitedByLava() - .pushReaction(PushReaction.DESTROY) - ) + properties -> new PressurePlateBlock(BlockSetType.CHERRY, properties), + BlockBehaviour.Properties.of() + .mapColor(CHERRY_PLANKS.defaultMapColor()) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASS) + .noCollission() + .strength(0.5F) + .ignitedByLava() + .pushReaction(PushReaction.DESTROY) ); public static final Block DARK_OAK_PRESSURE_PLATE = register( "dark_oak_pressure_plate", - new PressurePlateBlock( - BlockSetType.DARK_OAK, - BlockBehaviour.Properties.of() - .mapColor(DARK_OAK_PLANKS.defaultMapColor()) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASS) - .noCollission() - .strength(0.5F) - .ignitedByLava() - .pushReaction(PushReaction.DESTROY) - ) + properties -> new PressurePlateBlock(BlockSetType.DARK_OAK, properties), + BlockBehaviour.Properties.of() + .mapColor(DARK_OAK_PLANKS.defaultMapColor()) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASS) + .noCollission() + .strength(0.5F) + .ignitedByLava() + .pushReaction(PushReaction.DESTROY) + ); + public static final Block PALE_OAK_PRESSURE_PLATE = register( + "pale_oak_pressure_plate", + properties -> new PressurePlateBlock(BlockSetType.PALE_OAK, properties), + BlockBehaviour.Properties.of() + .mapColor(PALE_OAK_PLANKS.defaultMapColor()) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASS) + .noCollission() + .strength(0.5F) + .ignitedByLava() + .pushReaction(PushReaction.DESTROY) + .requiredFeatures(FeatureFlags.WINTER_DROP) ); public static final Block MANGROVE_PRESSURE_PLATE = register( "mangrove_pressure_plate", - new PressurePlateBlock( - BlockSetType.MANGROVE, - BlockBehaviour.Properties.of() - .mapColor(MANGROVE_PLANKS.defaultMapColor()) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASS) - .noCollission() - .strength(0.5F) - .ignitedByLava() - .pushReaction(PushReaction.DESTROY) - ) + properties -> new PressurePlateBlock(BlockSetType.MANGROVE, properties), + BlockBehaviour.Properties.of() + .mapColor(MANGROVE_PLANKS.defaultMapColor()) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASS) + .noCollission() + .strength(0.5F) + .ignitedByLava() + .pushReaction(PushReaction.DESTROY) ); public static final Block BAMBOO_PRESSURE_PLATE = register( "bamboo_pressure_plate", - new PressurePlateBlock( - BlockSetType.BAMBOO, - BlockBehaviour.Properties.of() - .mapColor(BAMBOO_PLANKS.defaultMapColor()) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASS) - .noCollission() - .strength(0.5F) - .ignitedByLava() - .pushReaction(PushReaction.DESTROY) - ) + properties -> new PressurePlateBlock(BlockSetType.BAMBOO, properties), + BlockBehaviour.Properties.of() + .mapColor(BAMBOO_PLANKS.defaultMapColor()) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASS) + .noCollission() + .strength(0.5F) + .ignitedByLava() + .pushReaction(PushReaction.DESTROY) ); public static final Block REDSTONE_ORE = register( "redstone_ore", - new RedStoneOreBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.STONE) - .instrument(NoteBlockInstrument.BASEDRUM) - .requiresCorrectToolForDrops() - .randomTicks() - .lightLevel(litBlockEmission(9)) - .strength(3.0F, 3.0F) - ) + RedStoneOreBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.STONE) + .instrument(NoteBlockInstrument.BASEDRUM) + .requiresCorrectToolForDrops() + .randomTicks() + .lightLevel(litBlockEmission(9)) + .strength(3.0F, 3.0F) ); public static final Block DEEPSLATE_REDSTONE_ORE = register( "deepslate_redstone_ore", - new RedStoneOreBlock(BlockBehaviour.Properties.ofLegacyCopy(REDSTONE_ORE).mapColor(MapColor.DEEPSLATE).strength(4.5F, 3.0F).sound(SoundType.DEEPSLATE)) + RedStoneOreBlock::new, + BlockBehaviour.Properties.ofLegacyCopy(REDSTONE_ORE).mapColor(MapColor.DEEPSLATE).strength(4.5F, 3.0F).sound(SoundType.DEEPSLATE) ); public static final Block REDSTONE_TORCH = register( "redstone_torch", - new RedstoneTorchBlock( - BlockBehaviour.Properties.of().noCollission().instabreak().lightLevel(litBlockEmission(7)).sound(SoundType.WOOD).pushReaction(PushReaction.DESTROY) - ) + RedstoneTorchBlock::new, + BlockBehaviour.Properties.of().noCollission().instabreak().lightLevel(litBlockEmission(7)).sound(SoundType.WOOD).pushReaction(PushReaction.DESTROY) ); public static final Block REDSTONE_WALL_TORCH = register( "redstone_wall_torch", - new RedstoneWallTorchBlock( - BlockBehaviour.Properties.of() - .noCollission() - .instabreak() - .lightLevel(litBlockEmission(7)) - .sound(SoundType.WOOD) - .dropsLike(REDSTONE_TORCH) - .pushReaction(PushReaction.DESTROY) - ) + RedstoneWallTorchBlock::new, + wallVariant(REDSTONE_TORCH, true).noCollission().instabreak().lightLevel(litBlockEmission(7)).sound(SoundType.WOOD).pushReaction(PushReaction.DESTROY) ); - public static final Block STONE_BUTTON = register("stone_button", stoneButton()); + public static final Block STONE_BUTTON = register("stone_button", properties -> new ButtonBlock(BlockSetType.STONE, 20, properties), buttonProperties()); public static final Block SNOW = register( "snow", - new SnowLayerBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.SNOW) - .replaceable() - .forceSolidOff() - .randomTicks() - .strength(0.1F) - .requiresCorrectToolForDrops() - .sound(SoundType.SNOW) - .isViewBlocking((blockStatex, blockGetter, blockPos) -> (Integer)blockStatex.getValue(SnowLayerBlock.LAYERS) >= 8) - .pushReaction(PushReaction.DESTROY) - ) + SnowLayerBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.SNOW) + .replaceable() + .forceSolidOff() + .randomTicks() + .strength(0.1F) + .requiresCorrectToolForDrops() + .sound(SoundType.SNOW) + .isViewBlocking((blockStatex, blockGetter, blockPos) -> (Integer)blockStatex.getValue(SnowLayerBlock.LAYERS) >= 8) + .pushReaction(PushReaction.DESTROY) ); public static final Block ICE = register( "ice", - new IceBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.ICE) - .friction(0.98F) - .randomTicks() - .strength(0.5F) - .sound(SoundType.GLASS) - .noOcclusion() - .isValidSpawn((blockStatex, blockGetter, blockPos, entityType) -> entityType == EntityType.POLAR_BEAR) - .isRedstoneConductor(Blocks::never) - ) + IceBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.ICE) + .friction(0.98F) + .randomTicks() + .strength(0.5F) + .sound(SoundType.GLASS) + .noOcclusion() + .isValidSpawn((blockStatex, blockGetter, blockPos, entityType) -> entityType == EntityType.POLAR_BEAR) + .isRedstoneConductor(Blocks::never) ); public static final Block SNOW_BLOCK = register( - "snow_block", new Block(BlockBehaviour.Properties.of().mapColor(MapColor.SNOW).requiresCorrectToolForDrops().strength(0.2F).sound(SoundType.SNOW)) + "snow_block", BlockBehaviour.Properties.of().mapColor(MapColor.SNOW).requiresCorrectToolForDrops().strength(0.2F).sound(SoundType.SNOW) ); public static final Block CACTUS = register( "cactus", - new CactusBlock(BlockBehaviour.Properties.of().mapColor(MapColor.PLANT).randomTicks().strength(0.4F).sound(SoundType.WOOL).pushReaction(PushReaction.DESTROY)) + CactusBlock::new, + BlockBehaviour.Properties.of().mapColor(MapColor.PLANT).randomTicks().strength(0.4F).sound(SoundType.WOOL).pushReaction(PushReaction.DESTROY) ); public static final Block CLAY = register( - "clay", new Block(BlockBehaviour.Properties.of().mapColor(MapColor.CLAY).instrument(NoteBlockInstrument.FLUTE).strength(0.6F).sound(SoundType.GRAVEL)) + "clay", BlockBehaviour.Properties.of().mapColor(MapColor.CLAY).instrument(NoteBlockInstrument.FLUTE).strength(0.6F).sound(SoundType.GRAVEL) ); public static final Block SUGAR_CANE = register( "sugar_cane", - new SugarCaneBlock( - BlockBehaviour.Properties.of().mapColor(MapColor.PLANT).noCollission().randomTicks().instabreak().sound(SoundType.GRASS).pushReaction(PushReaction.DESTROY) - ) + SugarCaneBlock::new, + BlockBehaviour.Properties.of().mapColor(MapColor.PLANT).noCollission().randomTicks().instabreak().sound(SoundType.GRASS).pushReaction(PushReaction.DESTROY) ); public static final Block JUKEBOX = register( "jukebox", - new JukeboxBlock( - BlockBehaviour.Properties.of().mapColor(MapColor.DIRT).instrument(NoteBlockInstrument.BASS).strength(2.0F, 6.0F).sound(SoundType.WOOD).ignitedByLava() - ) + JukeboxBlock::new, + BlockBehaviour.Properties.of().mapColor(MapColor.DIRT).instrument(NoteBlockInstrument.BASS).strength(2.0F, 6.0F).sound(SoundType.WOOD).ignitedByLava() ); public static final Block OAK_FENCE = register( "oak_fence", - new FenceBlock( - BlockBehaviour.Properties.of() - .mapColor(OAK_PLANKS.defaultMapColor()) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASS) - .strength(2.0F, 3.0F) - .sound(SoundType.WOOD) - .ignitedByLava() - ) + FenceBlock::new, + BlockBehaviour.Properties.of() + .mapColor(OAK_PLANKS.defaultMapColor()) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASS) + .strength(2.0F, 3.0F) + .sound(SoundType.WOOD) + .ignitedByLava() ); public static final Block NETHERRACK = register( "netherrack", - new NetherrackBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.NETHER) - .instrument(NoteBlockInstrument.BASEDRUM) - .requiresCorrectToolForDrops() - .strength(0.4F) - .sound(SoundType.NETHERRACK) - ) + NetherrackBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.NETHER) + .instrument(NoteBlockInstrument.BASEDRUM) + .requiresCorrectToolForDrops() + .strength(0.4F) + .sound(SoundType.NETHERRACK) ); public static final Block SOUL_SAND = register( "soul_sand", - new SoulSandBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.COLOR_BROWN) - .instrument(NoteBlockInstrument.COW_BELL) - .strength(0.5F) - .speedFactor(0.4F) - .sound(SoundType.SOUL_SAND) - .isValidSpawn(Blocks::always) - .isRedstoneConductor(Blocks::always) - .isViewBlocking(Blocks::always) - .isSuffocating(Blocks::always) - ) + SoulSandBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.COLOR_BROWN) + .instrument(NoteBlockInstrument.COW_BELL) + .strength(0.5F) + .speedFactor(0.4F) + .sound(SoundType.SOUL_SAND) + .isValidSpawn(Blocks::always) + .isRedstoneConductor(Blocks::always) + .isViewBlocking(Blocks::always) + .isSuffocating(Blocks::always) ); public static final Block SOUL_SOIL = register( - "soul_soil", new Block(BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_BROWN).strength(0.5F).sound(SoundType.SOUL_SOIL)) + "soul_soil", BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_BROWN).strength(0.5F).sound(SoundType.SOUL_SOIL) ); public static final Block BASALT = register( "basalt", - new RotatedPillarBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.COLOR_BLACK) - .instrument(NoteBlockInstrument.BASEDRUM) - .requiresCorrectToolForDrops() - .strength(1.25F, 4.2F) - .sound(SoundType.BASALT) - ) + RotatedPillarBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.COLOR_BLACK) + .instrument(NoteBlockInstrument.BASEDRUM) + .requiresCorrectToolForDrops() + .strength(1.25F, 4.2F) + .sound(SoundType.BASALT) ); public static final Block POLISHED_BASALT = register( "polished_basalt", - new RotatedPillarBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.COLOR_BLACK) - .instrument(NoteBlockInstrument.BASEDRUM) - .requiresCorrectToolForDrops() - .strength(1.25F, 4.2F) - .sound(SoundType.BASALT) - ) + RotatedPillarBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.COLOR_BLACK) + .instrument(NoteBlockInstrument.BASEDRUM) + .requiresCorrectToolForDrops() + .strength(1.25F, 4.2F) + .sound(SoundType.BASALT) ); public static final Block SOUL_TORCH = register( "soul_torch", - new TorchBlock( - ParticleTypes.SOUL_FIRE_FLAME, - BlockBehaviour.Properties.of().noCollission().instabreak().lightLevel(blockStatex -> 10).sound(SoundType.WOOD).pushReaction(PushReaction.DESTROY) - ) + properties -> new TorchBlock(ParticleTypes.SOUL_FIRE_FLAME, properties), + BlockBehaviour.Properties.of().noCollission().instabreak().lightLevel(blockStatex -> 10).sound(SoundType.WOOD).pushReaction(PushReaction.DESTROY) ); public static final Block SOUL_WALL_TORCH = register( "soul_wall_torch", - new WallTorchBlock( - ParticleTypes.SOUL_FIRE_FLAME, - BlockBehaviour.Properties.of() - .noCollission() - .instabreak() - .lightLevel(blockStatex -> 10) - .sound(SoundType.WOOD) - .dropsLike(SOUL_TORCH) - .pushReaction(PushReaction.DESTROY) - ) + properties -> new WallTorchBlock(ParticleTypes.SOUL_FIRE_FLAME, properties), + wallVariant(SOUL_TORCH, true).noCollission().instabreak().lightLevel(blockStatex -> 10).sound(SoundType.WOOD).pushReaction(PushReaction.DESTROY) ); public static final Block GLOWSTONE = register( "glowstone", - new Block( - BlockBehaviour.Properties.of() - .mapColor(MapColor.SAND) - .instrument(NoteBlockInstrument.PLING) - .strength(0.3F) - .sound(SoundType.GLASS) - .lightLevel(blockStatex -> 15) - .isRedstoneConductor(Blocks::never) - ) + BlockBehaviour.Properties.of() + .mapColor(MapColor.SAND) + .instrument(NoteBlockInstrument.PLING) + .strength(0.3F) + .sound(SoundType.GLASS) + .lightLevel(blockStatex -> 15) + .isRedstoneConductor(Blocks::never) ); public static final Block NETHER_PORTAL = register( "nether_portal", - new NetherPortalBlock( - BlockBehaviour.Properties.of() - .noCollission() - .randomTicks() - .strength(-1.0F) - .sound(SoundType.GLASS) - .lightLevel(blockStatex -> 11) - .pushReaction(PushReaction.BLOCK) - ) + NetherPortalBlock::new, + BlockBehaviour.Properties.of() + .noCollission() + .randomTicks() + .strength(-1.0F) + .sound(SoundType.GLASS) + .lightLevel(blockStatex -> 11) + .pushReaction(PushReaction.BLOCK) ); public static final Block CARVED_PUMPKIN = register( "carved_pumpkin", - new EquipableCarvedPumpkinBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.COLOR_ORANGE) - .strength(1.0F) - .sound(SoundType.WOOD) - .isValidSpawn(Blocks::always) - .pushReaction(PushReaction.DESTROY) - ) + CarvedPumpkinBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.COLOR_ORANGE) + .strength(1.0F) + .sound(SoundType.WOOD) + .isValidSpawn(Blocks::always) + .pushReaction(PushReaction.DESTROY) ); public static final Block JACK_O_LANTERN = register( "jack_o_lantern", - new CarvedPumpkinBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.COLOR_ORANGE) - .strength(1.0F) - .sound(SoundType.WOOD) - .lightLevel(blockStatex -> 15) - .isValidSpawn(Blocks::always) - .pushReaction(PushReaction.DESTROY) - ) + CarvedPumpkinBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.COLOR_ORANGE) + .strength(1.0F) + .sound(SoundType.WOOD) + .lightLevel(blockStatex -> 15) + .isValidSpawn(Blocks::always) + .pushReaction(PushReaction.DESTROY) ); public static final Block CAKE = register( - "cake", new CakeBlock(BlockBehaviour.Properties.of().forceSolidOn().strength(0.5F).sound(SoundType.WOOL).pushReaction(PushReaction.DESTROY)) + "cake", CakeBlock::new, BlockBehaviour.Properties.of().forceSolidOn().strength(0.5F).sound(SoundType.WOOL).pushReaction(PushReaction.DESTROY) ); public static final Block REPEATER = register( - "repeater", new RepeaterBlock(BlockBehaviour.Properties.of().instabreak().sound(SoundType.STONE).pushReaction(PushReaction.DESTROY)) + "repeater", RepeaterBlock::new, BlockBehaviour.Properties.of().instabreak().sound(SoundType.STONE).pushReaction(PushReaction.DESTROY) ); - public static final Block WHITE_STAINED_GLASS = register("white_stained_glass", stainedGlass(DyeColor.WHITE)); - public static final Block ORANGE_STAINED_GLASS = register("orange_stained_glass", stainedGlass(DyeColor.ORANGE)); - public static final Block MAGENTA_STAINED_GLASS = register("magenta_stained_glass", stainedGlass(DyeColor.MAGENTA)); - public static final Block LIGHT_BLUE_STAINED_GLASS = register("light_blue_stained_glass", stainedGlass(DyeColor.LIGHT_BLUE)); - public static final Block YELLOW_STAINED_GLASS = register("yellow_stained_glass", stainedGlass(DyeColor.YELLOW)); - public static final Block LIME_STAINED_GLASS = register("lime_stained_glass", stainedGlass(DyeColor.LIME)); - public static final Block PINK_STAINED_GLASS = register("pink_stained_glass", stainedGlass(DyeColor.PINK)); - public static final Block GRAY_STAINED_GLASS = register("gray_stained_glass", stainedGlass(DyeColor.GRAY)); - public static final Block LIGHT_GRAY_STAINED_GLASS = register("light_gray_stained_glass", stainedGlass(DyeColor.LIGHT_GRAY)); - public static final Block CYAN_STAINED_GLASS = register("cyan_stained_glass", stainedGlass(DyeColor.CYAN)); - public static final Block PURPLE_STAINED_GLASS = register("purple_stained_glass", stainedGlass(DyeColor.PURPLE)); - public static final Block BLUE_STAINED_GLASS = register("blue_stained_glass", stainedGlass(DyeColor.BLUE)); - public static final Block BROWN_STAINED_GLASS = register("brown_stained_glass", stainedGlass(DyeColor.BROWN)); - public static final Block GREEN_STAINED_GLASS = register("green_stained_glass", stainedGlass(DyeColor.GREEN)); - public static final Block RED_STAINED_GLASS = register("red_stained_glass", stainedGlass(DyeColor.RED)); - public static final Block BLACK_STAINED_GLASS = register("black_stained_glass", stainedGlass(DyeColor.BLACK)); + public static final Block WHITE_STAINED_GLASS = registerStainedGlass("white_stained_glass", DyeColor.WHITE); + public static final Block ORANGE_STAINED_GLASS = registerStainedGlass("orange_stained_glass", DyeColor.ORANGE); + public static final Block MAGENTA_STAINED_GLASS = registerStainedGlass("magenta_stained_glass", DyeColor.MAGENTA); + public static final Block LIGHT_BLUE_STAINED_GLASS = registerStainedGlass("light_blue_stained_glass", DyeColor.LIGHT_BLUE); + public static final Block YELLOW_STAINED_GLASS = registerStainedGlass("yellow_stained_glass", DyeColor.YELLOW); + public static final Block LIME_STAINED_GLASS = registerStainedGlass("lime_stained_glass", DyeColor.LIME); + public static final Block PINK_STAINED_GLASS = registerStainedGlass("pink_stained_glass", DyeColor.PINK); + public static final Block GRAY_STAINED_GLASS = registerStainedGlass("gray_stained_glass", DyeColor.GRAY); + public static final Block LIGHT_GRAY_STAINED_GLASS = registerStainedGlass("light_gray_stained_glass", DyeColor.LIGHT_GRAY); + public static final Block CYAN_STAINED_GLASS = registerStainedGlass("cyan_stained_glass", DyeColor.CYAN); + public static final Block PURPLE_STAINED_GLASS = registerStainedGlass("purple_stained_glass", DyeColor.PURPLE); + public static final Block BLUE_STAINED_GLASS = registerStainedGlass("blue_stained_glass", DyeColor.BLUE); + public static final Block BROWN_STAINED_GLASS = registerStainedGlass("brown_stained_glass", DyeColor.BROWN); + public static final Block GREEN_STAINED_GLASS = registerStainedGlass("green_stained_glass", DyeColor.GREEN); + public static final Block RED_STAINED_GLASS = registerStainedGlass("red_stained_glass", DyeColor.RED); + public static final Block BLACK_STAINED_GLASS = registerStainedGlass("black_stained_glass", DyeColor.BLACK); public static final Block OAK_TRAPDOOR = register( "oak_trapdoor", - new TrapDoorBlock( - BlockSetType.OAK, - BlockBehaviour.Properties.of() - .mapColor(MapColor.WOOD) - .instrument(NoteBlockInstrument.BASS) - .strength(3.0F) - .noOcclusion() - .isValidSpawn(Blocks::never) - .ignitedByLava() - ) + properties -> new TrapDoorBlock(BlockSetType.OAK, properties), + BlockBehaviour.Properties.of() + .mapColor(MapColor.WOOD) + .instrument(NoteBlockInstrument.BASS) + .strength(3.0F) + .noOcclusion() + .isValidSpawn(Blocks::never) + .ignitedByLava() ); public static final Block SPRUCE_TRAPDOOR = register( "spruce_trapdoor", - new TrapDoorBlock( - BlockSetType.SPRUCE, - BlockBehaviour.Properties.of() - .mapColor(MapColor.PODZOL) - .instrument(NoteBlockInstrument.BASS) - .strength(3.0F) - .noOcclusion() - .isValidSpawn(Blocks::never) - .ignitedByLava() - ) + properties -> new TrapDoorBlock(BlockSetType.SPRUCE, properties), + BlockBehaviour.Properties.of() + .mapColor(MapColor.PODZOL) + .instrument(NoteBlockInstrument.BASS) + .strength(3.0F) + .noOcclusion() + .isValidSpawn(Blocks::never) + .ignitedByLava() ); public static final Block BIRCH_TRAPDOOR = register( "birch_trapdoor", - new TrapDoorBlock( - BlockSetType.BIRCH, - BlockBehaviour.Properties.of() - .mapColor(MapColor.SAND) - .instrument(NoteBlockInstrument.BASS) - .strength(3.0F) - .noOcclusion() - .isValidSpawn(Blocks::never) - .ignitedByLava() - ) + properties -> new TrapDoorBlock(BlockSetType.BIRCH, properties), + BlockBehaviour.Properties.of() + .mapColor(MapColor.SAND) + .instrument(NoteBlockInstrument.BASS) + .strength(3.0F) + .noOcclusion() + .isValidSpawn(Blocks::never) + .ignitedByLava() ); public static final Block JUNGLE_TRAPDOOR = register( "jungle_trapdoor", - new TrapDoorBlock( - BlockSetType.JUNGLE, - BlockBehaviour.Properties.of() - .mapColor(MapColor.DIRT) - .instrument(NoteBlockInstrument.BASS) - .strength(3.0F) - .noOcclusion() - .isValidSpawn(Blocks::never) - .ignitedByLava() - ) + properties -> new TrapDoorBlock(BlockSetType.JUNGLE, properties), + BlockBehaviour.Properties.of() + .mapColor(MapColor.DIRT) + .instrument(NoteBlockInstrument.BASS) + .strength(3.0F) + .noOcclusion() + .isValidSpawn(Blocks::never) + .ignitedByLava() ); public static final Block ACACIA_TRAPDOOR = register( "acacia_trapdoor", - new TrapDoorBlock( - BlockSetType.ACACIA, - BlockBehaviour.Properties.of() - .mapColor(MapColor.COLOR_ORANGE) - .instrument(NoteBlockInstrument.BASS) - .strength(3.0F) - .noOcclusion() - .isValidSpawn(Blocks::never) - .ignitedByLava() - ) + properties -> new TrapDoorBlock(BlockSetType.ACACIA, properties), + BlockBehaviour.Properties.of() + .mapColor(MapColor.COLOR_ORANGE) + .instrument(NoteBlockInstrument.BASS) + .strength(3.0F) + .noOcclusion() + .isValidSpawn(Blocks::never) + .ignitedByLava() ); public static final Block CHERRY_TRAPDOOR = register( "cherry_trapdoor", - new TrapDoorBlock( - BlockSetType.CHERRY, - BlockBehaviour.Properties.of() - .mapColor(MapColor.TERRACOTTA_WHITE) - .instrument(NoteBlockInstrument.BASS) - .strength(3.0F) - .noOcclusion() - .isValidSpawn(Blocks::never) - .ignitedByLava() - ) + properties -> new TrapDoorBlock(BlockSetType.CHERRY, properties), + BlockBehaviour.Properties.of() + .mapColor(MapColor.TERRACOTTA_WHITE) + .instrument(NoteBlockInstrument.BASS) + .strength(3.0F) + .noOcclusion() + .isValidSpawn(Blocks::never) + .ignitedByLava() ); public static final Block DARK_OAK_TRAPDOOR = register( "dark_oak_trapdoor", - new TrapDoorBlock( - BlockSetType.DARK_OAK, - BlockBehaviour.Properties.of() - .mapColor(MapColor.COLOR_BROWN) - .instrument(NoteBlockInstrument.BASS) - .strength(3.0F) - .noOcclusion() - .isValidSpawn(Blocks::never) - .ignitedByLava() - ) + properties -> new TrapDoorBlock(BlockSetType.DARK_OAK, properties), + BlockBehaviour.Properties.of() + .mapColor(MapColor.COLOR_BROWN) + .instrument(NoteBlockInstrument.BASS) + .strength(3.0F) + .noOcclusion() + .isValidSpawn(Blocks::never) + .ignitedByLava() + ); + public static final Block PALE_OAK_TRAPDOOR = register( + "pale_oak_trapdoor", + properties -> new TrapDoorBlock(BlockSetType.PALE_OAK, properties), + BlockBehaviour.Properties.of() + .mapColor(PALE_OAK_PLANKS.defaultMapColor()) + .instrument(NoteBlockInstrument.BASS) + .strength(3.0F) + .noOcclusion() + .isValidSpawn(Blocks::never) + .ignitedByLava() + .requiredFeatures(FeatureFlags.WINTER_DROP) ); public static final Block MANGROVE_TRAPDOOR = register( "mangrove_trapdoor", - new TrapDoorBlock( - BlockSetType.MANGROVE, - BlockBehaviour.Properties.of() - .mapColor(MapColor.COLOR_RED) - .instrument(NoteBlockInstrument.BASS) - .strength(3.0F) - .noOcclusion() - .isValidSpawn(Blocks::never) - .ignitedByLava() - ) + properties -> new TrapDoorBlock(BlockSetType.MANGROVE, properties), + BlockBehaviour.Properties.of() + .mapColor(MapColor.COLOR_RED) + .instrument(NoteBlockInstrument.BASS) + .strength(3.0F) + .noOcclusion() + .isValidSpawn(Blocks::never) + .ignitedByLava() ); public static final Block BAMBOO_TRAPDOOR = register( "bamboo_trapdoor", - new TrapDoorBlock( - BlockSetType.BAMBOO, - BlockBehaviour.Properties.of() - .mapColor(MapColor.COLOR_YELLOW) - .instrument(NoteBlockInstrument.BASS) - .strength(3.0F) - .noOcclusion() - .isValidSpawn(Blocks::never) - .ignitedByLava() - ) + properties -> new TrapDoorBlock(BlockSetType.BAMBOO, properties), + BlockBehaviour.Properties.of() + .mapColor(MapColor.COLOR_YELLOW) + .instrument(NoteBlockInstrument.BASS) + .strength(3.0F) + .noOcclusion() + .isValidSpawn(Blocks::never) + .ignitedByLava() ); public static final Block STONE_BRICKS = register( "stone_bricks", - new Block(BlockBehaviour.Properties.of().mapColor(MapColor.STONE).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(1.5F, 6.0F)) + BlockBehaviour.Properties.of().mapColor(MapColor.STONE).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(1.5F, 6.0F) ); public static final Block MOSSY_STONE_BRICKS = register( "mossy_stone_bricks", - new Block(BlockBehaviour.Properties.of().mapColor(MapColor.STONE).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(1.5F, 6.0F)) + BlockBehaviour.Properties.of().mapColor(MapColor.STONE).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(1.5F, 6.0F) ); public static final Block CRACKED_STONE_BRICKS = register( "cracked_stone_bricks", - new Block(BlockBehaviour.Properties.of().mapColor(MapColor.STONE).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(1.5F, 6.0F)) + BlockBehaviour.Properties.of().mapColor(MapColor.STONE).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(1.5F, 6.0F) ); public static final Block CHISELED_STONE_BRICKS = register( "chiseled_stone_bricks", - new Block(BlockBehaviour.Properties.of().mapColor(MapColor.STONE).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(1.5F, 6.0F)) - ); - public static final Block PACKED_MUD = register( - "packed_mud", new Block(BlockBehaviour.Properties.ofLegacyCopy(DIRT).strength(1.0F, 3.0F).sound(SoundType.PACKED_MUD)) + BlockBehaviour.Properties.of().mapColor(MapColor.STONE).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(1.5F, 6.0F) ); + public static final Block PACKED_MUD = register("packed_mud", BlockBehaviour.Properties.ofLegacyCopy(DIRT).strength(1.0F, 3.0F).sound(SoundType.PACKED_MUD)); public static final Block MUD_BRICKS = register( "mud_bricks", - new Block( - BlockBehaviour.Properties.of() - .mapColor(MapColor.TERRACOTTA_LIGHT_GRAY) - .instrument(NoteBlockInstrument.BASEDRUM) - .requiresCorrectToolForDrops() - .strength(1.5F, 3.0F) - .sound(SoundType.MUD_BRICKS) - ) + BlockBehaviour.Properties.of() + .mapColor(MapColor.TERRACOTTA_LIGHT_GRAY) + .instrument(NoteBlockInstrument.BASEDRUM) + .requiresCorrectToolForDrops() + .strength(1.5F, 3.0F) + .sound(SoundType.MUD_BRICKS) + ); + public static final Block INFESTED_STONE = register( + "infested_stone", properties -> new InfestedBlock(STONE, properties), BlockBehaviour.Properties.of().mapColor(MapColor.CLAY) ); - public static final Block INFESTED_STONE = register("infested_stone", new InfestedBlock(STONE, BlockBehaviour.Properties.of().mapColor(MapColor.CLAY))); public static final Block INFESTED_COBBLESTONE = register( - "infested_cobblestone", new InfestedBlock(COBBLESTONE, BlockBehaviour.Properties.of().mapColor(MapColor.CLAY)) + "infested_cobblestone", properties -> new InfestedBlock(COBBLESTONE, properties), BlockBehaviour.Properties.of().mapColor(MapColor.CLAY) ); public static final Block INFESTED_STONE_BRICKS = register( - "infested_stone_bricks", new InfestedBlock(STONE_BRICKS, BlockBehaviour.Properties.of().mapColor(MapColor.CLAY)) + "infested_stone_bricks", properties -> new InfestedBlock(STONE_BRICKS, properties), BlockBehaviour.Properties.of().mapColor(MapColor.CLAY) ); public static final Block INFESTED_MOSSY_STONE_BRICKS = register( - "infested_mossy_stone_bricks", new InfestedBlock(MOSSY_STONE_BRICKS, BlockBehaviour.Properties.of().mapColor(MapColor.CLAY)) + "infested_mossy_stone_bricks", properties -> new InfestedBlock(MOSSY_STONE_BRICKS, properties), BlockBehaviour.Properties.of().mapColor(MapColor.CLAY) ); public static final Block INFESTED_CRACKED_STONE_BRICKS = register( - "infested_cracked_stone_bricks", new InfestedBlock(CRACKED_STONE_BRICKS, BlockBehaviour.Properties.of().mapColor(MapColor.CLAY)) + "infested_cracked_stone_bricks", properties -> new InfestedBlock(CRACKED_STONE_BRICKS, properties), BlockBehaviour.Properties.of().mapColor(MapColor.CLAY) ); public static final Block INFESTED_CHISELED_STONE_BRICKS = register( - "infested_chiseled_stone_bricks", new InfestedBlock(CHISELED_STONE_BRICKS, BlockBehaviour.Properties.of().mapColor(MapColor.CLAY)) + "infested_chiseled_stone_bricks", properties -> new InfestedBlock(CHISELED_STONE_BRICKS, properties), BlockBehaviour.Properties.of().mapColor(MapColor.CLAY) ); public static final Block BROWN_MUSHROOM_BLOCK = register( "brown_mushroom_block", - new HugeMushroomBlock( - BlockBehaviour.Properties.of().mapColor(MapColor.DIRT).instrument(NoteBlockInstrument.BASS).strength(0.2F).sound(SoundType.WOOD).ignitedByLava() - ) + HugeMushroomBlock::new, + BlockBehaviour.Properties.of().mapColor(MapColor.DIRT).instrument(NoteBlockInstrument.BASS).strength(0.2F).sound(SoundType.WOOD).ignitedByLava() ); public static final Block RED_MUSHROOM_BLOCK = register( "red_mushroom_block", - new HugeMushroomBlock( - BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_RED).instrument(NoteBlockInstrument.BASS).strength(0.2F).sound(SoundType.WOOD).ignitedByLava() - ) + HugeMushroomBlock::new, + BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_RED).instrument(NoteBlockInstrument.BASS).strength(0.2F).sound(SoundType.WOOD).ignitedByLava() ); public static final Block MUSHROOM_STEM = register( "mushroom_stem", - new HugeMushroomBlock( - BlockBehaviour.Properties.of().mapColor(MapColor.WOOL).instrument(NoteBlockInstrument.BASS).strength(0.2F).sound(SoundType.WOOD).ignitedByLava() - ) + HugeMushroomBlock::new, + BlockBehaviour.Properties.of().mapColor(MapColor.WOOL).instrument(NoteBlockInstrument.BASS).strength(0.2F).sound(SoundType.WOOD).ignitedByLava() ); public static final Block IRON_BARS = register( - "iron_bars", new IronBarsBlock(BlockBehaviour.Properties.of().requiresCorrectToolForDrops().strength(5.0F, 6.0F).sound(SoundType.METAL).noOcclusion()) + "iron_bars", IronBarsBlock::new, BlockBehaviour.Properties.of().requiresCorrectToolForDrops().strength(5.0F, 6.0F).sound(SoundType.METAL).noOcclusion() ); public static final Block CHAIN = register( "chain", - new ChainBlock(BlockBehaviour.Properties.of().forceSolidOn().requiresCorrectToolForDrops().strength(5.0F, 6.0F).sound(SoundType.CHAIN).noOcclusion()) + ChainBlock::new, + BlockBehaviour.Properties.of().forceSolidOn().requiresCorrectToolForDrops().strength(5.0F, 6.0F).sound(SoundType.CHAIN).noOcclusion() ); public static final Block GLASS_PANE = register( - "glass_pane", new IronBarsBlock(BlockBehaviour.Properties.of().instrument(NoteBlockInstrument.HAT).strength(0.3F).sound(SoundType.GLASS).noOcclusion()) + "glass_pane", IronBarsBlock::new, BlockBehaviour.Properties.of().instrument(NoteBlockInstrument.HAT).strength(0.3F).sound(SoundType.GLASS).noOcclusion() ); public static final Block PUMPKIN = register( net.minecraft.references.Blocks.PUMPKIN, - new PumpkinBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.COLOR_ORANGE) - .instrument(NoteBlockInstrument.DIDGERIDOO) - .strength(1.0F) - .sound(SoundType.WOOD) - .pushReaction(PushReaction.DESTROY) - ) + PumpkinBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.COLOR_ORANGE) + .instrument(NoteBlockInstrument.DIDGERIDOO) + .strength(1.0F) + .sound(SoundType.WOOD) + .pushReaction(PushReaction.DESTROY) ); public static final Block MELON = register( net.minecraft.references.Blocks.MELON, - new Block(BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_LIGHT_GREEN).strength(1.0F).sound(SoundType.WOOD).pushReaction(PushReaction.DESTROY)) + BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_LIGHT_GREEN).strength(1.0F).sound(SoundType.WOOD).pushReaction(PushReaction.DESTROY) ); public static final Block ATTACHED_PUMPKIN_STEM = register( net.minecraft.references.Blocks.ATTACHED_PUMPKIN_STEM, - new AttachedStemBlock( - net.minecraft.references.Blocks.PUMPKIN_STEM, - net.minecraft.references.Blocks.PUMPKIN, - Items.PUMPKIN_SEEDS, - BlockBehaviour.Properties.of().mapColor(MapColor.PLANT).noCollission().instabreak().sound(SoundType.WOOD).pushReaction(PushReaction.DESTROY) - ) + properties -> new AttachedStemBlock(net.minecraft.references.Blocks.PUMPKIN_STEM, net.minecraft.references.Blocks.PUMPKIN, Items.PUMPKIN_SEEDS, properties), + BlockBehaviour.Properties.of().mapColor(MapColor.PLANT).noCollission().instabreak().sound(SoundType.WOOD).pushReaction(PushReaction.DESTROY) ); public static final Block ATTACHED_MELON_STEM = register( net.minecraft.references.Blocks.ATTACHED_MELON_STEM, - new AttachedStemBlock( - net.minecraft.references.Blocks.MELON_STEM, - net.minecraft.references.Blocks.MELON, - Items.MELON_SEEDS, - BlockBehaviour.Properties.of().mapColor(MapColor.PLANT).noCollission().instabreak().sound(SoundType.WOOD).pushReaction(PushReaction.DESTROY) - ) + properties -> new AttachedStemBlock(net.minecraft.references.Blocks.MELON_STEM, net.minecraft.references.Blocks.MELON, Items.MELON_SEEDS, properties), + BlockBehaviour.Properties.of().mapColor(MapColor.PLANT).noCollission().instabreak().sound(SoundType.WOOD).pushReaction(PushReaction.DESTROY) ); public static final Block PUMPKIN_STEM = register( net.minecraft.references.Blocks.PUMPKIN_STEM, - new StemBlock( - net.minecraft.references.Blocks.PUMPKIN, - net.minecraft.references.Blocks.ATTACHED_PUMPKIN_STEM, - Items.PUMPKIN_SEEDS, - BlockBehaviour.Properties.of() - .mapColor(MapColor.PLANT) - .noCollission() - .randomTicks() - .instabreak() - .sound(SoundType.HARD_CROP) - .pushReaction(PushReaction.DESTROY) - ) + properties -> new StemBlock(net.minecraft.references.Blocks.PUMPKIN, net.minecraft.references.Blocks.ATTACHED_PUMPKIN_STEM, Items.PUMPKIN_SEEDS, properties), + BlockBehaviour.Properties.of() + .mapColor(MapColor.PLANT) + .noCollission() + .randomTicks() + .instabreak() + .sound(SoundType.HARD_CROP) + .pushReaction(PushReaction.DESTROY) ); public static final Block MELON_STEM = register( net.minecraft.references.Blocks.MELON_STEM, - new StemBlock( - net.minecraft.references.Blocks.MELON, - net.minecraft.references.Blocks.ATTACHED_MELON_STEM, - Items.MELON_SEEDS, - BlockBehaviour.Properties.of() - .mapColor(MapColor.PLANT) - .noCollission() - .randomTicks() - .instabreak() - .sound(SoundType.HARD_CROP) - .pushReaction(PushReaction.DESTROY) - ) + properties -> new StemBlock(net.minecraft.references.Blocks.MELON, net.minecraft.references.Blocks.ATTACHED_MELON_STEM, Items.MELON_SEEDS, properties), + BlockBehaviour.Properties.of() + .mapColor(MapColor.PLANT) + .noCollission() + .randomTicks() + .instabreak() + .sound(SoundType.HARD_CROP) + .pushReaction(PushReaction.DESTROY) ); public static final Block VINE = register( "vine", - new VineBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.PLANT) - .replaceable() - .noCollission() - .randomTicks() - .strength(0.2F) - .sound(SoundType.VINE) - .ignitedByLava() - .pushReaction(PushReaction.DESTROY) - ) + VineBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.PLANT) + .replaceable() + .noCollission() + .randomTicks() + .strength(0.2F) + .sound(SoundType.VINE) + .ignitedByLava() + .pushReaction(PushReaction.DESTROY) ); public static final Block GLOW_LICHEN = register( "glow_lichen", - new GlowLichenBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.GLOW_LICHEN) - .replaceable() - .noCollission() - .strength(0.2F) - .sound(SoundType.GLOW_LICHEN) - .lightLevel(GlowLichenBlock.emission(7)) - .ignitedByLava() - .pushReaction(PushReaction.DESTROY) - ) + GlowLichenBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.GLOW_LICHEN) + .replaceable() + .noCollission() + .strength(0.2F) + .sound(SoundType.GLOW_LICHEN) + .lightLevel(GlowLichenBlock.emission(7)) + .ignitedByLava() + .pushReaction(PushReaction.DESTROY) ); public static final Block OAK_FENCE_GATE = register( "oak_fence_gate", - new FenceGateBlock( - WoodType.OAK, - BlockBehaviour.Properties.of() - .mapColor(OAK_PLANKS.defaultMapColor()) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASS) - .strength(2.0F, 3.0F) - .ignitedByLava() - ) + properties -> new FenceGateBlock(WoodType.OAK, properties), + BlockBehaviour.Properties.of() + .mapColor(OAK_PLANKS.defaultMapColor()) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASS) + .strength(2.0F, 3.0F) + .ignitedByLava() ); - public static final Block BRICK_STAIRS = register("brick_stairs", legacyStair(BRICKS)); - public static final Block STONE_BRICK_STAIRS = register("stone_brick_stairs", legacyStair(STONE_BRICKS)); - public static final Block MUD_BRICK_STAIRS = register("mud_brick_stairs", legacyStair(MUD_BRICKS)); + public static final Block BRICK_STAIRS = registerLegacyStair("brick_stairs", BRICKS); + public static final Block STONE_BRICK_STAIRS = registerLegacyStair("stone_brick_stairs", STONE_BRICKS); + public static final Block MUD_BRICK_STAIRS = registerLegacyStair("mud_brick_stairs", MUD_BRICKS); public static final Block MYCELIUM = register( - "mycelium", new MyceliumBlock(BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_PURPLE).randomTicks().strength(0.6F).sound(SoundType.GRASS)) + "mycelium", MyceliumBlock::new, BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_PURPLE).randomTicks().strength(0.6F).sound(SoundType.GRASS) ); public static final Block LILY_PAD = register( "lily_pad", - new WaterlilyBlock( - BlockBehaviour.Properties.of().mapColor(MapColor.PLANT).instabreak().sound(SoundType.LILY_PAD).noOcclusion().pushReaction(PushReaction.DESTROY) - ) + WaterlilyBlock::new, + BlockBehaviour.Properties.of().mapColor(MapColor.PLANT).instabreak().sound(SoundType.LILY_PAD).noOcclusion().pushReaction(PushReaction.DESTROY) ); public static final Block NETHER_BRICKS = register( "nether_bricks", - new Block( - BlockBehaviour.Properties.of() - .mapColor(MapColor.NETHER) - .instrument(NoteBlockInstrument.BASEDRUM) - .requiresCorrectToolForDrops() - .strength(2.0F, 6.0F) - .sound(SoundType.NETHER_BRICKS) - ) + BlockBehaviour.Properties.of() + .mapColor(MapColor.NETHER) + .instrument(NoteBlockInstrument.BASEDRUM) + .requiresCorrectToolForDrops() + .strength(2.0F, 6.0F) + .sound(SoundType.NETHER_BRICKS) ); public static final Block NETHER_BRICK_FENCE = register( "nether_brick_fence", - new FenceBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.NETHER) - .instrument(NoteBlockInstrument.BASEDRUM) - .requiresCorrectToolForDrops() - .strength(2.0F, 6.0F) - .sound(SoundType.NETHER_BRICKS) - ) + FenceBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.NETHER) + .instrument(NoteBlockInstrument.BASEDRUM) + .requiresCorrectToolForDrops() + .strength(2.0F, 6.0F) + .sound(SoundType.NETHER_BRICKS) ); - public static final Block NETHER_BRICK_STAIRS = register("nether_brick_stairs", legacyStair(NETHER_BRICKS)); + public static final Block NETHER_BRICK_STAIRS = registerLegacyStair("nether_brick_stairs", NETHER_BRICKS); public static final Block NETHER_WART = register( "nether_wart", - new NetherWartBlock( - BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_RED).noCollission().randomTicks().sound(SoundType.NETHER_WART).pushReaction(PushReaction.DESTROY) - ) + NetherWartBlock::new, + BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_RED).noCollission().randomTicks().sound(SoundType.NETHER_WART).pushReaction(PushReaction.DESTROY) ); public static final Block ENCHANTING_TABLE = register( "enchanting_table", - new EnchantingTableBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.COLOR_RED) - .instrument(NoteBlockInstrument.BASEDRUM) - .requiresCorrectToolForDrops() - .lightLevel(blockStatex -> 7) - .strength(5.0F, 1200.0F) - ) + EnchantingTableBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.COLOR_RED) + .instrument(NoteBlockInstrument.BASEDRUM) + .requiresCorrectToolForDrops() + .lightLevel(blockStatex -> 7) + .strength(5.0F, 1200.0F) ); public static final Block BREWING_STAND = register( "brewing_stand", - new BrewingStandBlock( - BlockBehaviour.Properties.of().mapColor(MapColor.METAL).requiresCorrectToolForDrops().strength(0.5F).lightLevel(blockStatex -> 1).noOcclusion() - ) + BrewingStandBlock::new, + BlockBehaviour.Properties.of().mapColor(MapColor.METAL).requiresCorrectToolForDrops().strength(0.5F).lightLevel(blockStatex -> 1).noOcclusion() ); public static final Block CAULDRON = register( - "cauldron", new CauldronBlock(BlockBehaviour.Properties.of().mapColor(MapColor.STONE).requiresCorrectToolForDrops().strength(2.0F).noOcclusion()) + "cauldron", CauldronBlock::new, BlockBehaviour.Properties.of().mapColor(MapColor.STONE).requiresCorrectToolForDrops().strength(2.0F).noOcclusion() ); public static final Block WATER_CAULDRON = register( - "water_cauldron", new LayeredCauldronBlock(Biome.Precipitation.RAIN, CauldronInteraction.WATER, BlockBehaviour.Properties.ofLegacyCopy(CAULDRON)) + "water_cauldron", + properties -> new LayeredCauldronBlock(Biome.Precipitation.RAIN, CauldronInteraction.WATER, properties), + BlockBehaviour.Properties.ofLegacyCopy(CAULDRON) ); public static final Block LAVA_CAULDRON = register( - "lava_cauldron", new LavaCauldronBlock(BlockBehaviour.Properties.ofLegacyCopy(CAULDRON).lightLevel(blockStatex -> 15)) + "lava_cauldron", LavaCauldronBlock::new, BlockBehaviour.Properties.ofLegacyCopy(CAULDRON).lightLevel(blockStatex -> 15) ); public static final Block POWDER_SNOW_CAULDRON = register( - "powder_snow_cauldron", new LayeredCauldronBlock(Biome.Precipitation.SNOW, CauldronInteraction.POWDER_SNOW, BlockBehaviour.Properties.ofLegacyCopy(CAULDRON)) + "powder_snow_cauldron", + properties -> new LayeredCauldronBlock(Biome.Precipitation.SNOW, CauldronInteraction.POWDER_SNOW, properties), + BlockBehaviour.Properties.ofLegacyCopy(CAULDRON) ); public static final Block END_PORTAL = register( "end_portal", - new EndPortalBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.COLOR_BLACK) - .noCollission() - .lightLevel(blockStatex -> 15) - .strength(-1.0F, 3600000.0F) - .noLootTable() - .pushReaction(PushReaction.BLOCK) - ) + EndPortalBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.COLOR_BLACK) + .noCollission() + .lightLevel(blockStatex -> 15) + .strength(-1.0F, 3600000.0F) + .noLootTable() + .pushReaction(PushReaction.BLOCK) ); public static final Block END_PORTAL_FRAME = register( "end_portal_frame", - new EndPortalFrameBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.COLOR_GREEN) - .instrument(NoteBlockInstrument.BASEDRUM) - .sound(SoundType.GLASS) - .lightLevel(blockStatex -> 1) - .strength(-1.0F, 3600000.0F) - .noLootTable() - ) + EndPortalFrameBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.COLOR_GREEN) + .instrument(NoteBlockInstrument.BASEDRUM) + .sound(SoundType.GLASS) + .lightLevel(blockStatex -> 1) + .strength(-1.0F, 3600000.0F) + .noLootTable() ); public static final Block END_STONE = register( "end_stone", - new Block(BlockBehaviour.Properties.of().mapColor(MapColor.SAND).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(3.0F, 9.0F)) + BlockBehaviour.Properties.of().mapColor(MapColor.SAND).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(3.0F, 9.0F) ); public static final Block DRAGON_EGG = register( "dragon_egg", - new DragonEggBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.COLOR_BLACK) - .strength(3.0F, 9.0F) - .lightLevel(blockStatex -> 1) - .noOcclusion() - .pushReaction(PushReaction.DESTROY) - ) + DragonEggBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.COLOR_BLACK) + .strength(3.0F, 9.0F) + .lightLevel(blockStatex -> 1) + .noOcclusion() + .pushReaction(PushReaction.DESTROY) ); public static final Block REDSTONE_LAMP = register( "redstone_lamp", - new RedstoneLampBlock(BlockBehaviour.Properties.of().lightLevel(litBlockEmission(15)).strength(0.3F).sound(SoundType.GLASS).isValidSpawn(Blocks::always)) + RedstoneLampBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.TERRACOTTA_ORANGE) + .lightLevel(litBlockEmission(15)) + .strength(0.3F) + .sound(SoundType.GLASS) + .isValidSpawn(Blocks::always) ); public static final Block COCOA = register( "cocoa", - new CocoaBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.PLANT) - .randomTicks() - .strength(0.2F, 3.0F) - .sound(SoundType.WOOD) - .noOcclusion() - .pushReaction(PushReaction.DESTROY) - ) + CocoaBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.PLANT) + .randomTicks() + .strength(0.2F, 3.0F) + .sound(SoundType.WOOD) + .noOcclusion() + .pushReaction(PushReaction.DESTROY) ); - public static final Block SANDSTONE_STAIRS = register("sandstone_stairs", legacyStair(SANDSTONE)); + public static final Block SANDSTONE_STAIRS = registerLegacyStair("sandstone_stairs", SANDSTONE); public static final Block EMERALD_ORE = register( "emerald_ore", - new DropExperienceBlock( - UniformInt.of(3, 7), - BlockBehaviour.Properties.of().mapColor(MapColor.STONE).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(3.0F, 3.0F) - ) + properties -> new DropExperienceBlock(UniformInt.of(3, 7), properties), + BlockBehaviour.Properties.of().mapColor(MapColor.STONE).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(3.0F, 3.0F) ); public static final Block DEEPSLATE_EMERALD_ORE = register( "deepslate_emerald_ore", - new DropExperienceBlock( - UniformInt.of(3, 7), BlockBehaviour.Properties.ofLegacyCopy(EMERALD_ORE).mapColor(MapColor.DEEPSLATE).strength(4.5F, 3.0F).sound(SoundType.DEEPSLATE) - ) + properties -> new DropExperienceBlock(UniformInt.of(3, 7), properties), + BlockBehaviour.Properties.ofLegacyCopy(EMERALD_ORE).mapColor(MapColor.DEEPSLATE).strength(4.5F, 3.0F).sound(SoundType.DEEPSLATE) ); public static final Block ENDER_CHEST = register( "ender_chest", - new EnderChestBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.STONE) - .instrument(NoteBlockInstrument.BASEDRUM) - .requiresCorrectToolForDrops() - .strength(22.5F, 600.0F) - .lightLevel(blockStatex -> 7) - ) + EnderChestBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.STONE) + .instrument(NoteBlockInstrument.BASEDRUM) + .requiresCorrectToolForDrops() + .strength(22.5F, 600.0F) + .lightLevel(blockStatex -> 7) ); public static final Block TRIPWIRE_HOOK = register( - "tripwire_hook", new TripWireHookBlock(BlockBehaviour.Properties.of().noCollission().sound(SoundType.WOOD).pushReaction(PushReaction.DESTROY)) + "tripwire_hook", TripWireHookBlock::new, BlockBehaviour.Properties.of().noCollission().sound(SoundType.WOOD).pushReaction(PushReaction.DESTROY) ); public static final Block TRIPWIRE = register( - "tripwire", new TripWireBlock(TRIPWIRE_HOOK, BlockBehaviour.Properties.of().noCollission().pushReaction(PushReaction.DESTROY)) + "tripwire", properties -> new TripWireBlock(TRIPWIRE_HOOK, properties), BlockBehaviour.Properties.of().noCollission().pushReaction(PushReaction.DESTROY) ); public static final Block EMERALD_BLOCK = register( "emerald_block", - new Block( - BlockBehaviour.Properties.of() - .mapColor(MapColor.EMERALD) - .instrument(NoteBlockInstrument.BIT) - .requiresCorrectToolForDrops() - .strength(5.0F, 6.0F) - .sound(SoundType.METAL) - ) + BlockBehaviour.Properties.of() + .mapColor(MapColor.EMERALD) + .instrument(NoteBlockInstrument.BIT) + .requiresCorrectToolForDrops() + .strength(5.0F, 6.0F) + .sound(SoundType.METAL) ); - public static final Block SPRUCE_STAIRS = register("spruce_stairs", legacyStair(SPRUCE_PLANKS)); - public static final Block BIRCH_STAIRS = register("birch_stairs", legacyStair(BIRCH_PLANKS)); - public static final Block JUNGLE_STAIRS = register("jungle_stairs", legacyStair(JUNGLE_PLANKS)); + public static final Block SPRUCE_STAIRS = registerLegacyStair("spruce_stairs", SPRUCE_PLANKS); + public static final Block BIRCH_STAIRS = registerLegacyStair("birch_stairs", BIRCH_PLANKS); + public static final Block JUNGLE_STAIRS = registerLegacyStair("jungle_stairs", JUNGLE_PLANKS); public static final Block COMMAND_BLOCK = register( "command_block", - new CommandBlock(false, BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_BROWN).requiresCorrectToolForDrops().strength(-1.0F, 3600000.0F).noLootTable()) + properties -> new CommandBlock(false, properties), + BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_BROWN).requiresCorrectToolForDrops().strength(-1.0F, 3600000.0F).noLootTable() ); public static final Block BEACON = register( "beacon", - new BeaconBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.DIAMOND) - .instrument(NoteBlockInstrument.HAT) - .strength(3.0F) - .lightLevel(blockStatex -> 15) - .noOcclusion() - .isRedstoneConductor(Blocks::never) - ) + BeaconBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.DIAMOND) + .instrument(NoteBlockInstrument.HAT) + .strength(3.0F) + .lightLevel(blockStatex -> 15) + .noOcclusion() + .isRedstoneConductor(Blocks::never) ); - public static final Block COBBLESTONE_WALL = register("cobblestone_wall", new WallBlock(BlockBehaviour.Properties.ofLegacyCopy(COBBLESTONE).forceSolidOn())); + public static final Block COBBLESTONE_WALL = register("cobblestone_wall", WallBlock::new, BlockBehaviour.Properties.ofLegacyCopy(COBBLESTONE).forceSolidOn()); public static final Block MOSSY_COBBLESTONE_WALL = register( - "mossy_cobblestone_wall", new WallBlock(BlockBehaviour.Properties.ofLegacyCopy(COBBLESTONE).forceSolidOn()) + "mossy_cobblestone_wall", WallBlock::new, BlockBehaviour.Properties.ofLegacyCopy(COBBLESTONE).forceSolidOn() ); - public static final Block FLOWER_POT = register("flower_pot", flowerPot(AIR)); - public static final Block POTTED_TORCHFLOWER = register("potted_torchflower", flowerPot(TORCHFLOWER)); - public static final Block POTTED_OAK_SAPLING = register("potted_oak_sapling", flowerPot(OAK_SAPLING)); - public static final Block POTTED_SPRUCE_SAPLING = register("potted_spruce_sapling", flowerPot(SPRUCE_SAPLING)); - public static final Block POTTED_BIRCH_SAPLING = register("potted_birch_sapling", flowerPot(BIRCH_SAPLING)); - public static final Block POTTED_JUNGLE_SAPLING = register("potted_jungle_sapling", flowerPot(JUNGLE_SAPLING)); - public static final Block POTTED_ACACIA_SAPLING = register("potted_acacia_sapling", flowerPot(ACACIA_SAPLING)); - public static final Block POTTED_CHERRY_SAPLING = register("potted_cherry_sapling", flowerPot(CHERRY_SAPLING)); - public static final Block POTTED_DARK_OAK_SAPLING = register("potted_dark_oak_sapling", flowerPot(DARK_OAK_SAPLING)); - public static final Block POTTED_MANGROVE_PROPAGULE = register("potted_mangrove_propagule", flowerPot(MANGROVE_PROPAGULE)); - public static final Block POTTED_FERN = register("potted_fern", flowerPot(FERN)); - public static final Block POTTED_DANDELION = register("potted_dandelion", flowerPot(DANDELION)); - public static final Block POTTED_POPPY = register("potted_poppy", flowerPot(POPPY)); - public static final Block POTTED_BLUE_ORCHID = register("potted_blue_orchid", flowerPot(BLUE_ORCHID)); - public static final Block POTTED_ALLIUM = register("potted_allium", flowerPot(ALLIUM)); - public static final Block POTTED_AZURE_BLUET = register("potted_azure_bluet", flowerPot(AZURE_BLUET)); - public static final Block POTTED_RED_TULIP = register("potted_red_tulip", flowerPot(RED_TULIP)); - public static final Block POTTED_ORANGE_TULIP = register("potted_orange_tulip", flowerPot(ORANGE_TULIP)); - public static final Block POTTED_WHITE_TULIP = register("potted_white_tulip", flowerPot(WHITE_TULIP)); - public static final Block POTTED_PINK_TULIP = register("potted_pink_tulip", flowerPot(PINK_TULIP)); - public static final Block POTTED_OXEYE_DAISY = register("potted_oxeye_daisy", flowerPot(OXEYE_DAISY)); - public static final Block POTTED_CORNFLOWER = register("potted_cornflower", flowerPot(CORNFLOWER)); - public static final Block POTTED_LILY_OF_THE_VALLEY = register("potted_lily_of_the_valley", flowerPot(LILY_OF_THE_VALLEY)); - public static final Block POTTED_WITHER_ROSE = register("potted_wither_rose", flowerPot(WITHER_ROSE)); - public static final Block POTTED_RED_MUSHROOM = register("potted_red_mushroom", flowerPot(RED_MUSHROOM)); - public static final Block POTTED_BROWN_MUSHROOM = register("potted_brown_mushroom", flowerPot(BROWN_MUSHROOM)); - public static final Block POTTED_DEAD_BUSH = register("potted_dead_bush", flowerPot(DEAD_BUSH)); - public static final Block POTTED_CACTUS = register("potted_cactus", flowerPot(CACTUS)); + public static final Block FLOWER_POT = register("flower_pot", properties -> new FlowerPotBlock(AIR, properties), flowerPotProperties()); + public static final Block POTTED_TORCHFLOWER = register("potted_torchflower", properties -> new FlowerPotBlock(TORCHFLOWER, properties), flowerPotProperties()); + public static final Block POTTED_OAK_SAPLING = register("potted_oak_sapling", properties -> new FlowerPotBlock(OAK_SAPLING, properties), flowerPotProperties()); + public static final Block POTTED_SPRUCE_SAPLING = register( + "potted_spruce_sapling", properties -> new FlowerPotBlock(SPRUCE_SAPLING, properties), flowerPotProperties() + ); + public static final Block POTTED_BIRCH_SAPLING = register( + "potted_birch_sapling", properties -> new FlowerPotBlock(BIRCH_SAPLING, properties), flowerPotProperties() + ); + public static final Block POTTED_JUNGLE_SAPLING = register( + "potted_jungle_sapling", properties -> new FlowerPotBlock(JUNGLE_SAPLING, properties), flowerPotProperties() + ); + public static final Block POTTED_ACACIA_SAPLING = register( + "potted_acacia_sapling", properties -> new FlowerPotBlock(ACACIA_SAPLING, properties), flowerPotProperties() + ); + public static final Block POTTED_CHERRY_SAPLING = register( + "potted_cherry_sapling", properties -> new FlowerPotBlock(CHERRY_SAPLING, properties), flowerPotProperties() + ); + public static final Block POTTED_DARK_OAK_SAPLING = register( + "potted_dark_oak_sapling", properties -> new FlowerPotBlock(DARK_OAK_SAPLING, properties), flowerPotProperties() + ); + public static final Block POTTED_PALE_OAK_SAPLING = register( + "potted_pale_oak_sapling", properties -> new FlowerPotBlock(PALE_OAK_SAPLING, properties), flowerPotProperties().requiredFeatures(FeatureFlags.WINTER_DROP) + ); + public static final Block POTTED_MANGROVE_PROPAGULE = register( + "potted_mangrove_propagule", properties -> new FlowerPotBlock(MANGROVE_PROPAGULE, properties), flowerPotProperties() + ); + public static final Block POTTED_FERN = register("potted_fern", properties -> new FlowerPotBlock(FERN, properties), flowerPotProperties()); + public static final Block POTTED_DANDELION = register("potted_dandelion", properties -> new FlowerPotBlock(DANDELION, properties), flowerPotProperties()); + public static final Block POTTED_POPPY = register("potted_poppy", properties -> new FlowerPotBlock(POPPY, properties), flowerPotProperties()); + public static final Block POTTED_BLUE_ORCHID = register("potted_blue_orchid", properties -> new FlowerPotBlock(BLUE_ORCHID, properties), flowerPotProperties()); + public static final Block POTTED_ALLIUM = register("potted_allium", properties -> new FlowerPotBlock(ALLIUM, properties), flowerPotProperties()); + public static final Block POTTED_AZURE_BLUET = register("potted_azure_bluet", properties -> new FlowerPotBlock(AZURE_BLUET, properties), flowerPotProperties()); + public static final Block POTTED_RED_TULIP = register("potted_red_tulip", properties -> new FlowerPotBlock(RED_TULIP, properties), flowerPotProperties()); + public static final Block POTTED_ORANGE_TULIP = register( + "potted_orange_tulip", properties -> new FlowerPotBlock(ORANGE_TULIP, properties), flowerPotProperties() + ); + public static final Block POTTED_WHITE_TULIP = register("potted_white_tulip", properties -> new FlowerPotBlock(WHITE_TULIP, properties), flowerPotProperties()); + public static final Block POTTED_PINK_TULIP = register("potted_pink_tulip", properties -> new FlowerPotBlock(PINK_TULIP, properties), flowerPotProperties()); + public static final Block POTTED_OXEYE_DAISY = register("potted_oxeye_daisy", properties -> new FlowerPotBlock(OXEYE_DAISY, properties), flowerPotProperties()); + public static final Block POTTED_CORNFLOWER = register("potted_cornflower", properties -> new FlowerPotBlock(CORNFLOWER, properties), flowerPotProperties()); + public static final Block POTTED_LILY_OF_THE_VALLEY = register( + "potted_lily_of_the_valley", properties -> new FlowerPotBlock(LILY_OF_THE_VALLEY, properties), flowerPotProperties() + ); + public static final Block POTTED_WITHER_ROSE = register("potted_wither_rose", properties -> new FlowerPotBlock(WITHER_ROSE, properties), flowerPotProperties()); + public static final Block POTTED_RED_MUSHROOM = register( + "potted_red_mushroom", properties -> new FlowerPotBlock(RED_MUSHROOM, properties), flowerPotProperties() + ); + public static final Block POTTED_BROWN_MUSHROOM = register( + "potted_brown_mushroom", properties -> new FlowerPotBlock(BROWN_MUSHROOM, properties), flowerPotProperties() + ); + public static final Block POTTED_DEAD_BUSH = register("potted_dead_bush", properties -> new FlowerPotBlock(DEAD_BUSH, properties), flowerPotProperties()); + public static final Block POTTED_CACTUS = register("potted_cactus", properties -> new FlowerPotBlock(CACTUS, properties), flowerPotProperties()); public static final Block CARROTS = register( "carrots", - new CarrotBlock( - BlockBehaviour.Properties.of().mapColor(MapColor.PLANT).noCollission().randomTicks().instabreak().sound(SoundType.CROP).pushReaction(PushReaction.DESTROY) - ) + CarrotBlock::new, + BlockBehaviour.Properties.of().mapColor(MapColor.PLANT).noCollission().randomTicks().instabreak().sound(SoundType.CROP).pushReaction(PushReaction.DESTROY) ); public static final Block POTATOES = register( "potatoes", - new PotatoBlock( - BlockBehaviour.Properties.of().mapColor(MapColor.PLANT).noCollission().randomTicks().instabreak().sound(SoundType.CROP).pushReaction(PushReaction.DESTROY) - ) + PotatoBlock::new, + BlockBehaviour.Properties.of().mapColor(MapColor.PLANT).noCollission().randomTicks().instabreak().sound(SoundType.CROP).pushReaction(PushReaction.DESTROY) ); - public static final Block OAK_BUTTON = register("oak_button", woodenButton(BlockSetType.OAK)); - public static final Block SPRUCE_BUTTON = register("spruce_button", woodenButton(BlockSetType.SPRUCE)); - public static final Block BIRCH_BUTTON = register("birch_button", woodenButton(BlockSetType.BIRCH)); - public static final Block JUNGLE_BUTTON = register("jungle_button", woodenButton(BlockSetType.JUNGLE)); - public static final Block ACACIA_BUTTON = register("acacia_button", woodenButton(BlockSetType.ACACIA)); - public static final Block CHERRY_BUTTON = register("cherry_button", woodenButton(BlockSetType.CHERRY)); - public static final Block DARK_OAK_BUTTON = register("dark_oak_button", woodenButton(BlockSetType.DARK_OAK)); - public static final Block MANGROVE_BUTTON = register("mangrove_button", woodenButton(BlockSetType.MANGROVE)); - public static final Block BAMBOO_BUTTON = register("bamboo_button", woodenButton(BlockSetType.BAMBOO)); + public static final Block OAK_BUTTON = register("oak_button", properties -> new ButtonBlock(BlockSetType.OAK, 30, properties), buttonProperties()); + public static final Block SPRUCE_BUTTON = register("spruce_button", properties -> new ButtonBlock(BlockSetType.SPRUCE, 30, properties), buttonProperties()); + public static final Block BIRCH_BUTTON = register("birch_button", properties -> new ButtonBlock(BlockSetType.BIRCH, 30, properties), buttonProperties()); + public static final Block JUNGLE_BUTTON = register("jungle_button", properties -> new ButtonBlock(BlockSetType.JUNGLE, 30, properties), buttonProperties()); + public static final Block ACACIA_BUTTON = register("acacia_button", properties -> new ButtonBlock(BlockSetType.ACACIA, 30, properties), buttonProperties()); + public static final Block CHERRY_BUTTON = register("cherry_button", properties -> new ButtonBlock(BlockSetType.CHERRY, 30, properties), buttonProperties()); + public static final Block DARK_OAK_BUTTON = register( + "dark_oak_button", properties -> new ButtonBlock(BlockSetType.DARK_OAK, 30, properties), buttonProperties() + ); + public static final Block PALE_OAK_BUTTON = register( + "pale_oak_button", properties -> new ButtonBlock(BlockSetType.PALE_OAK, 30, properties), buttonProperties().requiredFeatures(FeatureFlags.WINTER_DROP) + ); + public static final Block MANGROVE_BUTTON = register( + "mangrove_button", properties -> new ButtonBlock(BlockSetType.MANGROVE, 30, properties), buttonProperties() + ); + public static final Block BAMBOO_BUTTON = register("bamboo_button", properties -> new ButtonBlock(BlockSetType.BAMBOO, 30, properties), buttonProperties()); public static final Block SKELETON_SKULL = register( "skeleton_skull", - new SkullBlock( - SkullBlock.Types.SKELETON, BlockBehaviour.Properties.of().instrument(NoteBlockInstrument.SKELETON).strength(1.0F).pushReaction(PushReaction.DESTROY) - ) + properties -> new SkullBlock(SkullBlock.Types.SKELETON, properties), + BlockBehaviour.Properties.of().instrument(NoteBlockInstrument.SKELETON).strength(1.0F).pushReaction(PushReaction.DESTROY) ); public static final Block SKELETON_WALL_SKULL = register( "skeleton_wall_skull", - new WallSkullBlock(SkullBlock.Types.SKELETON, BlockBehaviour.Properties.of().strength(1.0F).dropsLike(SKELETON_SKULL).pushReaction(PushReaction.DESTROY)) + properties -> new WallSkullBlock(SkullBlock.Types.SKELETON, properties), + wallVariant(SKELETON_SKULL, true).strength(1.0F).pushReaction(PushReaction.DESTROY) ); public static final Block WITHER_SKELETON_SKULL = register( "wither_skeleton_skull", - new WitherSkullBlock(BlockBehaviour.Properties.of().instrument(NoteBlockInstrument.WITHER_SKELETON).strength(1.0F).pushReaction(PushReaction.DESTROY)) + WitherSkullBlock::new, + BlockBehaviour.Properties.of().instrument(NoteBlockInstrument.WITHER_SKELETON).strength(1.0F).pushReaction(PushReaction.DESTROY) ); public static final Block WITHER_SKELETON_WALL_SKULL = register( - "wither_skeleton_wall_skull", - new WitherWallSkullBlock(BlockBehaviour.Properties.of().strength(1.0F).dropsLike(WITHER_SKELETON_SKULL).pushReaction(PushReaction.DESTROY)) + "wither_skeleton_wall_skull", WitherWallSkullBlock::new, wallVariant(WITHER_SKELETON_SKULL, true).strength(1.0F).pushReaction(PushReaction.DESTROY) ); public static final Block ZOMBIE_HEAD = register( "zombie_head", - new SkullBlock( - SkullBlock.Types.ZOMBIE, BlockBehaviour.Properties.of().instrument(NoteBlockInstrument.ZOMBIE).strength(1.0F).pushReaction(PushReaction.DESTROY) - ) + properties -> new SkullBlock(SkullBlock.Types.ZOMBIE, properties), + BlockBehaviour.Properties.of().instrument(NoteBlockInstrument.ZOMBIE).strength(1.0F).pushReaction(PushReaction.DESTROY) ); public static final Block ZOMBIE_WALL_HEAD = register( "zombie_wall_head", - new WallSkullBlock(SkullBlock.Types.ZOMBIE, BlockBehaviour.Properties.of().strength(1.0F).dropsLike(ZOMBIE_HEAD).pushReaction(PushReaction.DESTROY)) + properties -> new WallSkullBlock(SkullBlock.Types.ZOMBIE, properties), + wallVariant(ZOMBIE_HEAD, true).strength(1.0F).pushReaction(PushReaction.DESTROY) ); public static final Block PLAYER_HEAD = register( "player_head", - new PlayerHeadBlock(BlockBehaviour.Properties.of().instrument(NoteBlockInstrument.CUSTOM_HEAD).strength(1.0F).pushReaction(PushReaction.DESTROY)) + PlayerHeadBlock::new, + BlockBehaviour.Properties.of().instrument(NoteBlockInstrument.CUSTOM_HEAD).strength(1.0F).pushReaction(PushReaction.DESTROY) ); public static final Block PLAYER_WALL_HEAD = register( - "player_wall_head", new PlayerWallHeadBlock(BlockBehaviour.Properties.of().strength(1.0F).dropsLike(PLAYER_HEAD).pushReaction(PushReaction.DESTROY)) + "player_wall_head", PlayerWallHeadBlock::new, wallVariant(PLAYER_HEAD, true).strength(1.0F).pushReaction(PushReaction.DESTROY) ); public static final Block CREEPER_HEAD = register( "creeper_head", - new SkullBlock( - SkullBlock.Types.CREEPER, BlockBehaviour.Properties.of().instrument(NoteBlockInstrument.CREEPER).strength(1.0F).pushReaction(PushReaction.DESTROY) - ) + properties -> new SkullBlock(SkullBlock.Types.CREEPER, properties), + BlockBehaviour.Properties.of().instrument(NoteBlockInstrument.CREEPER).strength(1.0F).pushReaction(PushReaction.DESTROY) ); public static final Block CREEPER_WALL_HEAD = register( "creeper_wall_head", - new WallSkullBlock(SkullBlock.Types.CREEPER, BlockBehaviour.Properties.of().strength(1.0F).dropsLike(CREEPER_HEAD).pushReaction(PushReaction.DESTROY)) + properties -> new WallSkullBlock(SkullBlock.Types.CREEPER, properties), + wallVariant(CREEPER_HEAD, true).strength(1.0F).pushReaction(PushReaction.DESTROY) ); public static final Block DRAGON_HEAD = register( "dragon_head", - new SkullBlock( - SkullBlock.Types.DRAGON, BlockBehaviour.Properties.of().instrument(NoteBlockInstrument.DRAGON).strength(1.0F).pushReaction(PushReaction.DESTROY) - ) + properties -> new SkullBlock(SkullBlock.Types.DRAGON, properties), + BlockBehaviour.Properties.of().instrument(NoteBlockInstrument.DRAGON).strength(1.0F).pushReaction(PushReaction.DESTROY) ); public static final Block DRAGON_WALL_HEAD = register( "dragon_wall_head", - new WallSkullBlock(SkullBlock.Types.DRAGON, BlockBehaviour.Properties.of().strength(1.0F).dropsLike(DRAGON_HEAD).pushReaction(PushReaction.DESTROY)) + properties -> new WallSkullBlock(SkullBlock.Types.DRAGON, properties), + wallVariant(DRAGON_HEAD, true).strength(1.0F).pushReaction(PushReaction.DESTROY) ); public static final Block PIGLIN_HEAD = register( "piglin_head", - new SkullBlock( - SkullBlock.Types.PIGLIN, BlockBehaviour.Properties.of().instrument(NoteBlockInstrument.PIGLIN).strength(1.0F).pushReaction(PushReaction.DESTROY) - ) + properties -> new SkullBlock(SkullBlock.Types.PIGLIN, properties), + BlockBehaviour.Properties.of().instrument(NoteBlockInstrument.PIGLIN).strength(1.0F).pushReaction(PushReaction.DESTROY) ); public static final Block PIGLIN_WALL_HEAD = register( - "piglin_wall_head", new PiglinWallSkullBlock(BlockBehaviour.Properties.of().strength(1.0F).dropsLike(PIGLIN_HEAD).pushReaction(PushReaction.DESTROY)) + "piglin_wall_head", PiglinWallSkullBlock::new, wallVariant(PIGLIN_HEAD, true).strength(1.0F).pushReaction(PushReaction.DESTROY) ); public static final Block ANVIL = register( "anvil", - new AnvilBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.METAL) - .requiresCorrectToolForDrops() - .strength(5.0F, 1200.0F) - .sound(SoundType.ANVIL) - .pushReaction(PushReaction.BLOCK) - ) + AnvilBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.METAL) + .requiresCorrectToolForDrops() + .strength(5.0F, 1200.0F) + .sound(SoundType.ANVIL) + .pushReaction(PushReaction.BLOCK) ); public static final Block CHIPPED_ANVIL = register( "chipped_anvil", - new AnvilBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.METAL) - .requiresCorrectToolForDrops() - .strength(5.0F, 1200.0F) - .sound(SoundType.ANVIL) - .pushReaction(PushReaction.BLOCK) - ) + AnvilBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.METAL) + .requiresCorrectToolForDrops() + .strength(5.0F, 1200.0F) + .sound(SoundType.ANVIL) + .pushReaction(PushReaction.BLOCK) ); public static final Block DAMAGED_ANVIL = register( "damaged_anvil", - new AnvilBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.METAL) - .requiresCorrectToolForDrops() - .strength(5.0F, 1200.0F) - .sound(SoundType.ANVIL) - .pushReaction(PushReaction.BLOCK) - ) + AnvilBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.METAL) + .requiresCorrectToolForDrops() + .strength(5.0F, 1200.0F) + .sound(SoundType.ANVIL) + .pushReaction(PushReaction.BLOCK) ); public static final Block TRAPPED_CHEST = register( "trapped_chest", - new TrappedChestBlock( - BlockBehaviour.Properties.of().mapColor(MapColor.WOOD).instrument(NoteBlockInstrument.BASS).strength(2.5F).sound(SoundType.WOOD).ignitedByLava() - ) + TrappedChestBlock::new, + BlockBehaviour.Properties.of().mapColor(MapColor.WOOD).instrument(NoteBlockInstrument.BASS).strength(2.5F).sound(SoundType.WOOD).ignitedByLava() ); public static final Block LIGHT_WEIGHTED_PRESSURE_PLATE = register( "light_weighted_pressure_plate", - new WeightedPressurePlateBlock( - 15, - BlockSetType.GOLD, - BlockBehaviour.Properties.of() - .mapColor(MapColor.GOLD) - .forceSolidOn() - .requiresCorrectToolForDrops() - .noCollission() - .strength(0.5F) - .pushReaction(PushReaction.DESTROY) - ) + properties -> new WeightedPressurePlateBlock(15, BlockSetType.GOLD, properties), + BlockBehaviour.Properties.of() + .mapColor(MapColor.GOLD) + .forceSolidOn() + .requiresCorrectToolForDrops() + .noCollission() + .strength(0.5F) + .pushReaction(PushReaction.DESTROY) ); public static final Block HEAVY_WEIGHTED_PRESSURE_PLATE = register( "heavy_weighted_pressure_plate", - new WeightedPressurePlateBlock( - 150, - BlockSetType.IRON, - BlockBehaviour.Properties.of() - .mapColor(MapColor.METAL) - .forceSolidOn() - .requiresCorrectToolForDrops() - .noCollission() - .strength(0.5F) - .pushReaction(PushReaction.DESTROY) - ) + properties -> new WeightedPressurePlateBlock(150, BlockSetType.IRON, properties), + BlockBehaviour.Properties.of() + .mapColor(MapColor.METAL) + .forceSolidOn() + .requiresCorrectToolForDrops() + .noCollission() + .strength(0.5F) + .pushReaction(PushReaction.DESTROY) ); public static final Block COMPARATOR = register( - "comparator", new ComparatorBlock(BlockBehaviour.Properties.of().instabreak().sound(SoundType.STONE).pushReaction(PushReaction.DESTROY)) + "comparator", ComparatorBlock::new, BlockBehaviour.Properties.of().instabreak().sound(SoundType.STONE).pushReaction(PushReaction.DESTROY) ); public static final Block DAYLIGHT_DETECTOR = register( "daylight_detector", - new DaylightDetectorBlock( - BlockBehaviour.Properties.of().mapColor(MapColor.WOOD).instrument(NoteBlockInstrument.BASS).strength(0.2F).sound(SoundType.WOOD).ignitedByLava() - ) + DaylightDetectorBlock::new, + BlockBehaviour.Properties.of().mapColor(MapColor.WOOD).instrument(NoteBlockInstrument.BASS).strength(0.2F).sound(SoundType.WOOD).ignitedByLava() ); public static final Block REDSTONE_BLOCK = register( "redstone_block", - new PoweredBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.FIRE) - .requiresCorrectToolForDrops() - .strength(5.0F, 6.0F) - .sound(SoundType.METAL) - .isRedstoneConductor(Blocks::never) - ) + PoweredBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.FIRE) + .requiresCorrectToolForDrops() + .strength(5.0F, 6.0F) + .sound(SoundType.METAL) + .isRedstoneConductor(Blocks::never) ); public static final Block NETHER_QUARTZ_ORE = register( "nether_quartz_ore", - new DropExperienceBlock( - UniformInt.of(2, 5), - BlockBehaviour.Properties.of() - .mapColor(MapColor.NETHER) - .instrument(NoteBlockInstrument.BASEDRUM) - .requiresCorrectToolForDrops() - .strength(3.0F, 3.0F) - .sound(SoundType.NETHER_ORE) - ) + properties -> new DropExperienceBlock(UniformInt.of(2, 5), properties), + BlockBehaviour.Properties.of() + .mapColor(MapColor.NETHER) + .instrument(NoteBlockInstrument.BASEDRUM) + .requiresCorrectToolForDrops() + .strength(3.0F, 3.0F) + .sound(SoundType.NETHER_ORE) ); public static final Block HOPPER = register( "hopper", - new HopperBlock( - BlockBehaviour.Properties.of().mapColor(MapColor.STONE).requiresCorrectToolForDrops().strength(3.0F, 4.8F).sound(SoundType.METAL).noOcclusion() - ) + HopperBlock::new, + BlockBehaviour.Properties.of().mapColor(MapColor.STONE).requiresCorrectToolForDrops().strength(3.0F, 4.8F).sound(SoundType.METAL).noOcclusion() ); public static final Block QUARTZ_BLOCK = register( "quartz_block", - new Block(BlockBehaviour.Properties.of().mapColor(MapColor.QUARTZ).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(0.8F)) + BlockBehaviour.Properties.of().mapColor(MapColor.QUARTZ).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(0.8F) ); public static final Block CHISELED_QUARTZ_BLOCK = register( "chiseled_quartz_block", - new Block(BlockBehaviour.Properties.of().mapColor(MapColor.QUARTZ).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(0.8F)) + BlockBehaviour.Properties.of().mapColor(MapColor.QUARTZ).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(0.8F) ); public static final Block QUARTZ_PILLAR = register( "quartz_pillar", - new RotatedPillarBlock( - BlockBehaviour.Properties.of().mapColor(MapColor.QUARTZ).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(0.8F) - ) + RotatedPillarBlock::new, + BlockBehaviour.Properties.of().mapColor(MapColor.QUARTZ).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(0.8F) ); - public static final Block QUARTZ_STAIRS = register("quartz_stairs", legacyStair(QUARTZ_BLOCK)); + public static final Block QUARTZ_STAIRS = registerLegacyStair("quartz_stairs", QUARTZ_BLOCK); public static final Block ACTIVATOR_RAIL = register( - "activator_rail", new PoweredRailBlock(BlockBehaviour.Properties.of().noCollission().strength(0.7F).sound(SoundType.METAL)) + "activator_rail", PoweredRailBlock::new, BlockBehaviour.Properties.of().noCollission().strength(0.7F).sound(SoundType.METAL) ); public static final Block DROPPER = register( "dropper", - new DropperBlock( - BlockBehaviour.Properties.of().mapColor(MapColor.STONE).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(3.5F) - ) + DropperBlock::new, + BlockBehaviour.Properties.of().mapColor(MapColor.STONE).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(3.5F) ); public static final Block WHITE_TERRACOTTA = register( "white_terracotta", - new Block( - BlockBehaviour.Properties.of() - .mapColor(MapColor.TERRACOTTA_WHITE) - .instrument(NoteBlockInstrument.BASEDRUM) - .requiresCorrectToolForDrops() - .strength(1.25F, 4.2F) - ) + BlockBehaviour.Properties.of() + .mapColor(MapColor.TERRACOTTA_WHITE) + .instrument(NoteBlockInstrument.BASEDRUM) + .requiresCorrectToolForDrops() + .strength(1.25F, 4.2F) ); public static final Block ORANGE_TERRACOTTA = register( "orange_terracotta", - new Block( - BlockBehaviour.Properties.of() - .mapColor(MapColor.TERRACOTTA_ORANGE) - .instrument(NoteBlockInstrument.BASEDRUM) - .requiresCorrectToolForDrops() - .strength(1.25F, 4.2F) - ) + BlockBehaviour.Properties.of() + .mapColor(MapColor.TERRACOTTA_ORANGE) + .instrument(NoteBlockInstrument.BASEDRUM) + .requiresCorrectToolForDrops() + .strength(1.25F, 4.2F) ); public static final Block MAGENTA_TERRACOTTA = register( "magenta_terracotta", - new Block( - BlockBehaviour.Properties.of() - .mapColor(MapColor.TERRACOTTA_MAGENTA) - .instrument(NoteBlockInstrument.BASEDRUM) - .requiresCorrectToolForDrops() - .strength(1.25F, 4.2F) - ) + BlockBehaviour.Properties.of() + .mapColor(MapColor.TERRACOTTA_MAGENTA) + .instrument(NoteBlockInstrument.BASEDRUM) + .requiresCorrectToolForDrops() + .strength(1.25F, 4.2F) ); public static final Block LIGHT_BLUE_TERRACOTTA = register( "light_blue_terracotta", - new Block( - BlockBehaviour.Properties.of() - .mapColor(MapColor.TERRACOTTA_LIGHT_BLUE) - .instrument(NoteBlockInstrument.BASEDRUM) - .requiresCorrectToolForDrops() - .strength(1.25F, 4.2F) - ) + BlockBehaviour.Properties.of() + .mapColor(MapColor.TERRACOTTA_LIGHT_BLUE) + .instrument(NoteBlockInstrument.BASEDRUM) + .requiresCorrectToolForDrops() + .strength(1.25F, 4.2F) ); public static final Block YELLOW_TERRACOTTA = register( "yellow_terracotta", - new Block( - BlockBehaviour.Properties.of() - .mapColor(MapColor.TERRACOTTA_YELLOW) - .instrument(NoteBlockInstrument.BASEDRUM) - .requiresCorrectToolForDrops() - .strength(1.25F, 4.2F) - ) + BlockBehaviour.Properties.of() + .mapColor(MapColor.TERRACOTTA_YELLOW) + .instrument(NoteBlockInstrument.BASEDRUM) + .requiresCorrectToolForDrops() + .strength(1.25F, 4.2F) ); public static final Block LIME_TERRACOTTA = register( "lime_terracotta", - new Block( - BlockBehaviour.Properties.of() - .mapColor(MapColor.TERRACOTTA_LIGHT_GREEN) - .instrument(NoteBlockInstrument.BASEDRUM) - .requiresCorrectToolForDrops() - .strength(1.25F, 4.2F) - ) + BlockBehaviour.Properties.of() + .mapColor(MapColor.TERRACOTTA_LIGHT_GREEN) + .instrument(NoteBlockInstrument.BASEDRUM) + .requiresCorrectToolForDrops() + .strength(1.25F, 4.2F) ); public static final Block PINK_TERRACOTTA = register( "pink_terracotta", - new Block( - BlockBehaviour.Properties.of() - .mapColor(MapColor.TERRACOTTA_PINK) - .instrument(NoteBlockInstrument.BASEDRUM) - .requiresCorrectToolForDrops() - .strength(1.25F, 4.2F) - ) + BlockBehaviour.Properties.of() + .mapColor(MapColor.TERRACOTTA_PINK) + .instrument(NoteBlockInstrument.BASEDRUM) + .requiresCorrectToolForDrops() + .strength(1.25F, 4.2F) ); public static final Block GRAY_TERRACOTTA = register( "gray_terracotta", - new Block( - BlockBehaviour.Properties.of() - .mapColor(MapColor.TERRACOTTA_GRAY) - .instrument(NoteBlockInstrument.BASEDRUM) - .requiresCorrectToolForDrops() - .strength(1.25F, 4.2F) - ) + BlockBehaviour.Properties.of() + .mapColor(MapColor.TERRACOTTA_GRAY) + .instrument(NoteBlockInstrument.BASEDRUM) + .requiresCorrectToolForDrops() + .strength(1.25F, 4.2F) ); public static final Block LIGHT_GRAY_TERRACOTTA = register( "light_gray_terracotta", - new Block( - BlockBehaviour.Properties.of() - .mapColor(MapColor.TERRACOTTA_LIGHT_GRAY) - .instrument(NoteBlockInstrument.BASEDRUM) - .requiresCorrectToolForDrops() - .strength(1.25F, 4.2F) - ) + BlockBehaviour.Properties.of() + .mapColor(MapColor.TERRACOTTA_LIGHT_GRAY) + .instrument(NoteBlockInstrument.BASEDRUM) + .requiresCorrectToolForDrops() + .strength(1.25F, 4.2F) ); public static final Block CYAN_TERRACOTTA = register( "cyan_terracotta", - new Block( - BlockBehaviour.Properties.of() - .mapColor(MapColor.TERRACOTTA_CYAN) - .instrument(NoteBlockInstrument.BASEDRUM) - .requiresCorrectToolForDrops() - .strength(1.25F, 4.2F) - ) + BlockBehaviour.Properties.of() + .mapColor(MapColor.TERRACOTTA_CYAN) + .instrument(NoteBlockInstrument.BASEDRUM) + .requiresCorrectToolForDrops() + .strength(1.25F, 4.2F) ); public static final Block PURPLE_TERRACOTTA = register( "purple_terracotta", - new Block( - BlockBehaviour.Properties.of() - .mapColor(MapColor.TERRACOTTA_PURPLE) - .instrument(NoteBlockInstrument.BASEDRUM) - .requiresCorrectToolForDrops() - .strength(1.25F, 4.2F) - ) + BlockBehaviour.Properties.of() + .mapColor(MapColor.TERRACOTTA_PURPLE) + .instrument(NoteBlockInstrument.BASEDRUM) + .requiresCorrectToolForDrops() + .strength(1.25F, 4.2F) ); public static final Block BLUE_TERRACOTTA = register( "blue_terracotta", - new Block( - BlockBehaviour.Properties.of() - .mapColor(MapColor.TERRACOTTA_BLUE) - .instrument(NoteBlockInstrument.BASEDRUM) - .requiresCorrectToolForDrops() - .strength(1.25F, 4.2F) - ) + BlockBehaviour.Properties.of() + .mapColor(MapColor.TERRACOTTA_BLUE) + .instrument(NoteBlockInstrument.BASEDRUM) + .requiresCorrectToolForDrops() + .strength(1.25F, 4.2F) ); public static final Block BROWN_TERRACOTTA = register( "brown_terracotta", - new Block( - BlockBehaviour.Properties.of() - .mapColor(MapColor.TERRACOTTA_BROWN) - .instrument(NoteBlockInstrument.BASEDRUM) - .requiresCorrectToolForDrops() - .strength(1.25F, 4.2F) - ) + BlockBehaviour.Properties.of() + .mapColor(MapColor.TERRACOTTA_BROWN) + .instrument(NoteBlockInstrument.BASEDRUM) + .requiresCorrectToolForDrops() + .strength(1.25F, 4.2F) ); public static final Block GREEN_TERRACOTTA = register( "green_terracotta", - new Block( - BlockBehaviour.Properties.of() - .mapColor(MapColor.TERRACOTTA_GREEN) - .instrument(NoteBlockInstrument.BASEDRUM) - .requiresCorrectToolForDrops() - .strength(1.25F, 4.2F) - ) + BlockBehaviour.Properties.of() + .mapColor(MapColor.TERRACOTTA_GREEN) + .instrument(NoteBlockInstrument.BASEDRUM) + .requiresCorrectToolForDrops() + .strength(1.25F, 4.2F) ); public static final Block RED_TERRACOTTA = register( "red_terracotta", - new Block( - BlockBehaviour.Properties.of() - .mapColor(MapColor.TERRACOTTA_RED) - .instrument(NoteBlockInstrument.BASEDRUM) - .requiresCorrectToolForDrops() - .strength(1.25F, 4.2F) - ) + BlockBehaviour.Properties.of().mapColor(MapColor.TERRACOTTA_RED).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(1.25F, 4.2F) ); public static final Block BLACK_TERRACOTTA = register( "black_terracotta", - new Block( - BlockBehaviour.Properties.of() - .mapColor(MapColor.TERRACOTTA_BLACK) - .instrument(NoteBlockInstrument.BASEDRUM) - .requiresCorrectToolForDrops() - .strength(1.25F, 4.2F) - ) + BlockBehaviour.Properties.of() + .mapColor(MapColor.TERRACOTTA_BLACK) + .instrument(NoteBlockInstrument.BASEDRUM) + .requiresCorrectToolForDrops() + .strength(1.25F, 4.2F) ); public static final Block WHITE_STAINED_GLASS_PANE = register( "white_stained_glass_pane", - new StainedGlassPaneBlock( - DyeColor.WHITE, BlockBehaviour.Properties.of().instrument(NoteBlockInstrument.HAT).strength(0.3F).sound(SoundType.GLASS).noOcclusion() - ) + properties -> new StainedGlassPaneBlock(DyeColor.WHITE, properties), + BlockBehaviour.Properties.of().instrument(NoteBlockInstrument.HAT).strength(0.3F).sound(SoundType.GLASS).noOcclusion() ); public static final Block ORANGE_STAINED_GLASS_PANE = register( "orange_stained_glass_pane", - new StainedGlassPaneBlock( - DyeColor.ORANGE, BlockBehaviour.Properties.of().instrument(NoteBlockInstrument.HAT).strength(0.3F).sound(SoundType.GLASS).noOcclusion() - ) + properties -> new StainedGlassPaneBlock(DyeColor.ORANGE, properties), + BlockBehaviour.Properties.of().instrument(NoteBlockInstrument.HAT).strength(0.3F).sound(SoundType.GLASS).noOcclusion() ); public static final Block MAGENTA_STAINED_GLASS_PANE = register( "magenta_stained_glass_pane", - new StainedGlassPaneBlock( - DyeColor.MAGENTA, BlockBehaviour.Properties.of().instrument(NoteBlockInstrument.HAT).strength(0.3F).sound(SoundType.GLASS).noOcclusion() - ) + properties -> new StainedGlassPaneBlock(DyeColor.MAGENTA, properties), + BlockBehaviour.Properties.of().instrument(NoteBlockInstrument.HAT).strength(0.3F).sound(SoundType.GLASS).noOcclusion() ); public static final Block LIGHT_BLUE_STAINED_GLASS_PANE = register( "light_blue_stained_glass_pane", - new StainedGlassPaneBlock( - DyeColor.LIGHT_BLUE, BlockBehaviour.Properties.of().instrument(NoteBlockInstrument.HAT).strength(0.3F).sound(SoundType.GLASS).noOcclusion() - ) + properties -> new StainedGlassPaneBlock(DyeColor.LIGHT_BLUE, properties), + BlockBehaviour.Properties.of().instrument(NoteBlockInstrument.HAT).strength(0.3F).sound(SoundType.GLASS).noOcclusion() ); public static final Block YELLOW_STAINED_GLASS_PANE = register( "yellow_stained_glass_pane", - new StainedGlassPaneBlock( - DyeColor.YELLOW, BlockBehaviour.Properties.of().instrument(NoteBlockInstrument.HAT).strength(0.3F).sound(SoundType.GLASS).noOcclusion() - ) + properties -> new StainedGlassPaneBlock(DyeColor.YELLOW, properties), + BlockBehaviour.Properties.of().instrument(NoteBlockInstrument.HAT).strength(0.3F).sound(SoundType.GLASS).noOcclusion() ); public static final Block LIME_STAINED_GLASS_PANE = register( "lime_stained_glass_pane", - new StainedGlassPaneBlock( - DyeColor.LIME, BlockBehaviour.Properties.of().instrument(NoteBlockInstrument.HAT).strength(0.3F).sound(SoundType.GLASS).noOcclusion() - ) + properties -> new StainedGlassPaneBlock(DyeColor.LIME, properties), + BlockBehaviour.Properties.of().instrument(NoteBlockInstrument.HAT).strength(0.3F).sound(SoundType.GLASS).noOcclusion() ); public static final Block PINK_STAINED_GLASS_PANE = register( "pink_stained_glass_pane", - new StainedGlassPaneBlock( - DyeColor.PINK, BlockBehaviour.Properties.of().instrument(NoteBlockInstrument.HAT).strength(0.3F).sound(SoundType.GLASS).noOcclusion() - ) + properties -> new StainedGlassPaneBlock(DyeColor.PINK, properties), + BlockBehaviour.Properties.of().instrument(NoteBlockInstrument.HAT).strength(0.3F).sound(SoundType.GLASS).noOcclusion() ); public static final Block GRAY_STAINED_GLASS_PANE = register( "gray_stained_glass_pane", - new StainedGlassPaneBlock( - DyeColor.GRAY, BlockBehaviour.Properties.of().instrument(NoteBlockInstrument.HAT).strength(0.3F).sound(SoundType.GLASS).noOcclusion() - ) + properties -> new StainedGlassPaneBlock(DyeColor.GRAY, properties), + BlockBehaviour.Properties.of().instrument(NoteBlockInstrument.HAT).strength(0.3F).sound(SoundType.GLASS).noOcclusion() ); public static final Block LIGHT_GRAY_STAINED_GLASS_PANE = register( "light_gray_stained_glass_pane", - new StainedGlassPaneBlock( - DyeColor.LIGHT_GRAY, BlockBehaviour.Properties.of().instrument(NoteBlockInstrument.HAT).strength(0.3F).sound(SoundType.GLASS).noOcclusion() - ) + properties -> new StainedGlassPaneBlock(DyeColor.LIGHT_GRAY, properties), + BlockBehaviour.Properties.of().instrument(NoteBlockInstrument.HAT).strength(0.3F).sound(SoundType.GLASS).noOcclusion() ); public static final Block CYAN_STAINED_GLASS_PANE = register( "cyan_stained_glass_pane", - new StainedGlassPaneBlock( - DyeColor.CYAN, BlockBehaviour.Properties.of().instrument(NoteBlockInstrument.HAT).strength(0.3F).sound(SoundType.GLASS).noOcclusion() - ) + properties -> new StainedGlassPaneBlock(DyeColor.CYAN, properties), + BlockBehaviour.Properties.of().instrument(NoteBlockInstrument.HAT).strength(0.3F).sound(SoundType.GLASS).noOcclusion() ); public static final Block PURPLE_STAINED_GLASS_PANE = register( "purple_stained_glass_pane", - new StainedGlassPaneBlock( - DyeColor.PURPLE, BlockBehaviour.Properties.of().instrument(NoteBlockInstrument.HAT).strength(0.3F).sound(SoundType.GLASS).noOcclusion() - ) + properties -> new StainedGlassPaneBlock(DyeColor.PURPLE, properties), + BlockBehaviour.Properties.of().instrument(NoteBlockInstrument.HAT).strength(0.3F).sound(SoundType.GLASS).noOcclusion() ); public static final Block BLUE_STAINED_GLASS_PANE = register( "blue_stained_glass_pane", - new StainedGlassPaneBlock( - DyeColor.BLUE, BlockBehaviour.Properties.of().instrument(NoteBlockInstrument.HAT).strength(0.3F).sound(SoundType.GLASS).noOcclusion() - ) + properties -> new StainedGlassPaneBlock(DyeColor.BLUE, properties), + BlockBehaviour.Properties.of().instrument(NoteBlockInstrument.HAT).strength(0.3F).sound(SoundType.GLASS).noOcclusion() ); public static final Block BROWN_STAINED_GLASS_PANE = register( "brown_stained_glass_pane", - new StainedGlassPaneBlock( - DyeColor.BROWN, BlockBehaviour.Properties.of().instrument(NoteBlockInstrument.HAT).strength(0.3F).sound(SoundType.GLASS).noOcclusion() - ) + properties -> new StainedGlassPaneBlock(DyeColor.BROWN, properties), + BlockBehaviour.Properties.of().instrument(NoteBlockInstrument.HAT).strength(0.3F).sound(SoundType.GLASS).noOcclusion() ); public static final Block GREEN_STAINED_GLASS_PANE = register( "green_stained_glass_pane", - new StainedGlassPaneBlock( - DyeColor.GREEN, BlockBehaviour.Properties.of().instrument(NoteBlockInstrument.HAT).strength(0.3F).sound(SoundType.GLASS).noOcclusion() - ) + properties -> new StainedGlassPaneBlock(DyeColor.GREEN, properties), + BlockBehaviour.Properties.of().instrument(NoteBlockInstrument.HAT).strength(0.3F).sound(SoundType.GLASS).noOcclusion() ); public static final Block RED_STAINED_GLASS_PANE = register( "red_stained_glass_pane", - new StainedGlassPaneBlock( - DyeColor.RED, BlockBehaviour.Properties.of().instrument(NoteBlockInstrument.HAT).strength(0.3F).sound(SoundType.GLASS).noOcclusion() - ) + properties -> new StainedGlassPaneBlock(DyeColor.RED, properties), + BlockBehaviour.Properties.of().instrument(NoteBlockInstrument.HAT).strength(0.3F).sound(SoundType.GLASS).noOcclusion() ); public static final Block BLACK_STAINED_GLASS_PANE = register( "black_stained_glass_pane", - new StainedGlassPaneBlock( - DyeColor.BLACK, BlockBehaviour.Properties.of().instrument(NoteBlockInstrument.HAT).strength(0.3F).sound(SoundType.GLASS).noOcclusion() - ) + properties -> new StainedGlassPaneBlock(DyeColor.BLACK, properties), + BlockBehaviour.Properties.of().instrument(NoteBlockInstrument.HAT).strength(0.3F).sound(SoundType.GLASS).noOcclusion() ); - public static final Block ACACIA_STAIRS = register("acacia_stairs", legacyStair(ACACIA_PLANKS)); - public static final Block CHERRY_STAIRS = register("cherry_stairs", legacyStair(CHERRY_PLANKS)); - public static final Block DARK_OAK_STAIRS = register("dark_oak_stairs", legacyStair(DARK_OAK_PLANKS)); - public static final Block MANGROVE_STAIRS = register("mangrove_stairs", legacyStair(MANGROVE_PLANKS)); - public static final Block BAMBOO_STAIRS = register("bamboo_stairs", legacyStair(BAMBOO_PLANKS)); - public static final Block BAMBOO_MOSAIC_STAIRS = register("bamboo_mosaic_stairs", legacyStair(BAMBOO_MOSAIC)); + public static final Block ACACIA_STAIRS = registerLegacyStair("acacia_stairs", ACACIA_PLANKS); + public static final Block CHERRY_STAIRS = registerLegacyStair("cherry_stairs", CHERRY_PLANKS); + public static final Block DARK_OAK_STAIRS = registerLegacyStair("dark_oak_stairs", DARK_OAK_PLANKS); + public static final Block PALE_OAK_STAIRS = registerLegacyStair("pale_oak_stairs", PALE_OAK_PLANKS); + public static final Block MANGROVE_STAIRS = registerLegacyStair("mangrove_stairs", MANGROVE_PLANKS); + public static final Block BAMBOO_STAIRS = registerLegacyStair("bamboo_stairs", BAMBOO_PLANKS); + public static final Block BAMBOO_MOSAIC_STAIRS = registerLegacyStair("bamboo_mosaic_stairs", BAMBOO_MOSAIC); public static final Block SLIME_BLOCK = register( - "slime_block", new SlimeBlock(BlockBehaviour.Properties.of().mapColor(MapColor.GRASS).friction(0.8F).sound(SoundType.SLIME_BLOCK).noOcclusion()) + "slime_block", SlimeBlock::new, BlockBehaviour.Properties.of().mapColor(MapColor.GRASS).friction(0.8F).sound(SoundType.SLIME_BLOCK).noOcclusion() ); public static final Block BARRIER = register( "barrier", - new BarrierBlock( - BlockBehaviour.Properties.of() - .strength(-1.0F, 3600000.8F) - .mapColor(waterloggedMapColor(MapColor.NONE)) - .noLootTable() - .noOcclusion() - .isValidSpawn(Blocks::never) - .noTerrainParticles() - .pushReaction(PushReaction.BLOCK) - ) + BarrierBlock::new, + BlockBehaviour.Properties.of() + .strength(-1.0F, 3600000.8F) + .mapColor(waterloggedMapColor(MapColor.NONE)) + .noLootTable() + .noOcclusion() + .isValidSpawn(Blocks::never) + .noTerrainParticles() + .pushReaction(PushReaction.BLOCK) ); public static final Block LIGHT = register( "light", - new LightBlock( - BlockBehaviour.Properties.of() - .replaceable() - .strength(-1.0F, 3600000.8F) - .mapColor(waterloggedMapColor(MapColor.NONE)) - .noLootTable() - .noOcclusion() - .lightLevel(LightBlock.LIGHT_EMISSION) - ) + LightBlock::new, + BlockBehaviour.Properties.of() + .replaceable() + .strength(-1.0F, 3600000.8F) + .mapColor(waterloggedMapColor(MapColor.NONE)) + .noLootTable() + .noOcclusion() + .lightLevel(LightBlock.LIGHT_EMISSION) ); public static final Block IRON_TRAPDOOR = register( "iron_trapdoor", - new TrapDoorBlock( - BlockSetType.IRON, - BlockBehaviour.Properties.of().mapColor(MapColor.METAL).requiresCorrectToolForDrops().strength(5.0F).noOcclusion().isValidSpawn(Blocks::never) - ) + properties -> new TrapDoorBlock(BlockSetType.IRON, properties), + BlockBehaviour.Properties.of().mapColor(MapColor.METAL).requiresCorrectToolForDrops().strength(5.0F).noOcclusion().isValidSpawn(Blocks::never) ); public static final Block PRISMARINE = register( "prismarine", - new Block( - BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_CYAN).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(1.5F, 6.0F) - ) + BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_CYAN).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(1.5F, 6.0F) ); public static final Block PRISMARINE_BRICKS = register( "prismarine_bricks", - new Block( - BlockBehaviour.Properties.of().mapColor(MapColor.DIAMOND).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(1.5F, 6.0F) - ) + BlockBehaviour.Properties.of().mapColor(MapColor.DIAMOND).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(1.5F, 6.0F) ); public static final Block DARK_PRISMARINE = register( "dark_prismarine", - new Block( - BlockBehaviour.Properties.of().mapColor(MapColor.DIAMOND).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(1.5F, 6.0F) - ) + BlockBehaviour.Properties.of().mapColor(MapColor.DIAMOND).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(1.5F, 6.0F) ); - public static final Block PRISMARINE_STAIRS = register("prismarine_stairs", legacyStair(PRISMARINE)); - public static final Block PRISMARINE_BRICK_STAIRS = register("prismarine_brick_stairs", legacyStair(PRISMARINE_BRICKS)); - public static final Block DARK_PRISMARINE_STAIRS = register("dark_prismarine_stairs", legacyStair(DARK_PRISMARINE)); + public static final Block PRISMARINE_STAIRS = registerLegacyStair("prismarine_stairs", PRISMARINE); + public static final Block PRISMARINE_BRICK_STAIRS = registerLegacyStair("prismarine_brick_stairs", PRISMARINE_BRICKS); + public static final Block DARK_PRISMARINE_STAIRS = registerLegacyStair("dark_prismarine_stairs", DARK_PRISMARINE); public static final Block PRISMARINE_SLAB = register( "prismarine_slab", - new SlabBlock( - BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_CYAN).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(1.5F, 6.0F) - ) + SlabBlock::new, + BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_CYAN).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(1.5F, 6.0F) ); public static final Block PRISMARINE_BRICK_SLAB = register( "prismarine_brick_slab", - new SlabBlock( - BlockBehaviour.Properties.of().mapColor(MapColor.DIAMOND).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(1.5F, 6.0F) - ) + SlabBlock::new, + BlockBehaviour.Properties.of().mapColor(MapColor.DIAMOND).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(1.5F, 6.0F) ); public static final Block DARK_PRISMARINE_SLAB = register( "dark_prismarine_slab", - new SlabBlock( - BlockBehaviour.Properties.of().mapColor(MapColor.DIAMOND).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(1.5F, 6.0F) - ) + SlabBlock::new, + BlockBehaviour.Properties.of().mapColor(MapColor.DIAMOND).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(1.5F, 6.0F) ); public static final Block SEA_LANTERN = register( "sea_lantern", - new Block( - BlockBehaviour.Properties.of() - .mapColor(MapColor.QUARTZ) - .instrument(NoteBlockInstrument.HAT) - .strength(0.3F) - .sound(SoundType.GLASS) - .lightLevel(blockStatex -> 15) - .isRedstoneConductor(Blocks::never) - ) + BlockBehaviour.Properties.of() + .mapColor(MapColor.QUARTZ) + .instrument(NoteBlockInstrument.HAT) + .strength(0.3F) + .sound(SoundType.GLASS) + .lightLevel(blockStatex -> 15) + .isRedstoneConductor(Blocks::never) ); public static final Block HAY_BLOCK = register( "hay_block", - new HayBlock(BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_YELLOW).instrument(NoteBlockInstrument.BANJO).strength(0.5F).sound(SoundType.GRASS)) + HayBlock::new, + BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_YELLOW).instrument(NoteBlockInstrument.BANJO).strength(0.5F).sound(SoundType.GRASS) ); public static final Block WHITE_CARPET = register( "white_carpet", - new WoolCarpetBlock(DyeColor.WHITE, BlockBehaviour.Properties.of().mapColor(MapColor.SNOW).strength(0.1F).sound(SoundType.WOOL).ignitedByLava()) + properties -> new WoolCarpetBlock(DyeColor.WHITE, properties), + BlockBehaviour.Properties.of().mapColor(MapColor.SNOW).strength(0.1F).sound(SoundType.WOOL).ignitedByLava() ); public static final Block ORANGE_CARPET = register( "orange_carpet", - new WoolCarpetBlock(DyeColor.ORANGE, BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_ORANGE).strength(0.1F).sound(SoundType.WOOL).ignitedByLava()) + properties -> new WoolCarpetBlock(DyeColor.ORANGE, properties), + BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_ORANGE).strength(0.1F).sound(SoundType.WOOL).ignitedByLava() ); public static final Block MAGENTA_CARPET = register( "magenta_carpet", - new WoolCarpetBlock(DyeColor.MAGENTA, BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_MAGENTA).strength(0.1F).sound(SoundType.WOOL).ignitedByLava()) + properties -> new WoolCarpetBlock(DyeColor.MAGENTA, properties), + BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_MAGENTA).strength(0.1F).sound(SoundType.WOOL).ignitedByLava() ); public static final Block LIGHT_BLUE_CARPET = register( "light_blue_carpet", - new WoolCarpetBlock( - DyeColor.LIGHT_BLUE, BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_LIGHT_BLUE).strength(0.1F).sound(SoundType.WOOL).ignitedByLava() - ) + properties -> new WoolCarpetBlock(DyeColor.LIGHT_BLUE, properties), + BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_LIGHT_BLUE).strength(0.1F).sound(SoundType.WOOL).ignitedByLava() ); public static final Block YELLOW_CARPET = register( "yellow_carpet", - new WoolCarpetBlock(DyeColor.YELLOW, BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_YELLOW).strength(0.1F).sound(SoundType.WOOL).ignitedByLava()) + properties -> new WoolCarpetBlock(DyeColor.YELLOW, properties), + BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_YELLOW).strength(0.1F).sound(SoundType.WOOL).ignitedByLava() ); public static final Block LIME_CARPET = register( "lime_carpet", - new WoolCarpetBlock(DyeColor.LIME, BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_LIGHT_GREEN).strength(0.1F).sound(SoundType.WOOL).ignitedByLava()) + properties -> new WoolCarpetBlock(DyeColor.LIME, properties), + BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_LIGHT_GREEN).strength(0.1F).sound(SoundType.WOOL).ignitedByLava() ); public static final Block PINK_CARPET = register( "pink_carpet", - new WoolCarpetBlock(DyeColor.PINK, BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_PINK).strength(0.1F).sound(SoundType.WOOL).ignitedByLava()) + properties -> new WoolCarpetBlock(DyeColor.PINK, properties), + BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_PINK).strength(0.1F).sound(SoundType.WOOL).ignitedByLava() ); public static final Block GRAY_CARPET = register( "gray_carpet", - new WoolCarpetBlock(DyeColor.GRAY, BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_GRAY).strength(0.1F).sound(SoundType.WOOL).ignitedByLava()) + properties -> new WoolCarpetBlock(DyeColor.GRAY, properties), + BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_GRAY).strength(0.1F).sound(SoundType.WOOL).ignitedByLava() ); public static final Block LIGHT_GRAY_CARPET = register( "light_gray_carpet", - new WoolCarpetBlock( - DyeColor.LIGHT_GRAY, BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_LIGHT_GRAY).strength(0.1F).sound(SoundType.WOOL).ignitedByLava() - ) + properties -> new WoolCarpetBlock(DyeColor.LIGHT_GRAY, properties), + BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_LIGHT_GRAY).strength(0.1F).sound(SoundType.WOOL).ignitedByLava() ); public static final Block CYAN_CARPET = register( "cyan_carpet", - new WoolCarpetBlock(DyeColor.CYAN, BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_CYAN).strength(0.1F).sound(SoundType.WOOL).ignitedByLava()) + properties -> new WoolCarpetBlock(DyeColor.CYAN, properties), + BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_CYAN).strength(0.1F).sound(SoundType.WOOL).ignitedByLava() ); public static final Block PURPLE_CARPET = register( "purple_carpet", - new WoolCarpetBlock(DyeColor.PURPLE, BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_PURPLE).strength(0.1F).sound(SoundType.WOOL).ignitedByLava()) + properties -> new WoolCarpetBlock(DyeColor.PURPLE, properties), + BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_PURPLE).strength(0.1F).sound(SoundType.WOOL).ignitedByLava() ); public static final Block BLUE_CARPET = register( "blue_carpet", - new WoolCarpetBlock(DyeColor.BLUE, BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_BLUE).strength(0.1F).sound(SoundType.WOOL).ignitedByLava()) + properties -> new WoolCarpetBlock(DyeColor.BLUE, properties), + BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_BLUE).strength(0.1F).sound(SoundType.WOOL).ignitedByLava() ); public static final Block BROWN_CARPET = register( "brown_carpet", - new WoolCarpetBlock(DyeColor.BROWN, BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_BROWN).strength(0.1F).sound(SoundType.WOOL).ignitedByLava()) + properties -> new WoolCarpetBlock(DyeColor.BROWN, properties), + BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_BROWN).strength(0.1F).sound(SoundType.WOOL).ignitedByLava() ); public static final Block GREEN_CARPET = register( "green_carpet", - new WoolCarpetBlock(DyeColor.GREEN, BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_GREEN).strength(0.1F).sound(SoundType.WOOL).ignitedByLava()) + properties -> new WoolCarpetBlock(DyeColor.GREEN, properties), + BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_GREEN).strength(0.1F).sound(SoundType.WOOL).ignitedByLava() ); public static final Block RED_CARPET = register( "red_carpet", - new WoolCarpetBlock(DyeColor.RED, BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_RED).strength(0.1F).sound(SoundType.WOOL).ignitedByLava()) + properties -> new WoolCarpetBlock(DyeColor.RED, properties), + BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_RED).strength(0.1F).sound(SoundType.WOOL).ignitedByLava() ); public static final Block BLACK_CARPET = register( "black_carpet", - new WoolCarpetBlock(DyeColor.BLACK, BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_BLACK).strength(0.1F).sound(SoundType.WOOL).ignitedByLava()) + properties -> new WoolCarpetBlock(DyeColor.BLACK, properties), + BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_BLACK).strength(0.1F).sound(SoundType.WOOL).ignitedByLava() ); public static final Block TERRACOTTA = register( "terracotta", - new Block( - BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_ORANGE).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(1.25F, 4.2F) - ) + BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_ORANGE).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(1.25F, 4.2F) ); public static final Block COAL_BLOCK = register( "coal_block", - new Block( - BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_BLACK).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(5.0F, 6.0F) - ) + BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_BLACK).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(5.0F, 6.0F) ); public static final Block PACKED_ICE = register( "packed_ice", - new Block(BlockBehaviour.Properties.of().mapColor(MapColor.ICE).instrument(NoteBlockInstrument.CHIME).friction(0.98F).strength(0.5F).sound(SoundType.GLASS)) + BlockBehaviour.Properties.of().mapColor(MapColor.ICE).instrument(NoteBlockInstrument.CHIME).friction(0.98F).strength(0.5F).sound(SoundType.GLASS) ); public static final Block SUNFLOWER = register( "sunflower", - new TallFlowerBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.PLANT) - .noCollission() - .instabreak() - .sound(SoundType.GRASS) - .offsetType(BlockBehaviour.OffsetType.XZ) - .ignitedByLava() - .pushReaction(PushReaction.DESTROY) - ) + TallFlowerBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.PLANT) + .noCollission() + .instabreak() + .sound(SoundType.GRASS) + .offsetType(BlockBehaviour.OffsetType.XZ) + .ignitedByLava() + .pushReaction(PushReaction.DESTROY) ); public static final Block LILAC = register( "lilac", - new TallFlowerBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.PLANT) - .noCollission() - .instabreak() - .sound(SoundType.GRASS) - .offsetType(BlockBehaviour.OffsetType.XZ) - .ignitedByLava() - .pushReaction(PushReaction.DESTROY) - ) + TallFlowerBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.PLANT) + .noCollission() + .instabreak() + .sound(SoundType.GRASS) + .offsetType(BlockBehaviour.OffsetType.XZ) + .ignitedByLava() + .pushReaction(PushReaction.DESTROY) ); public static final Block ROSE_BUSH = register( "rose_bush", - new TallFlowerBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.PLANT) - .noCollission() - .instabreak() - .sound(SoundType.GRASS) - .offsetType(BlockBehaviour.OffsetType.XZ) - .ignitedByLava() - .pushReaction(PushReaction.DESTROY) - ) + TallFlowerBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.PLANT) + .noCollission() + .instabreak() + .sound(SoundType.GRASS) + .offsetType(BlockBehaviour.OffsetType.XZ) + .ignitedByLava() + .pushReaction(PushReaction.DESTROY) ); public static final Block PEONY = register( "peony", - new TallFlowerBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.PLANT) - .noCollission() - .instabreak() - .sound(SoundType.GRASS) - .offsetType(BlockBehaviour.OffsetType.XZ) - .ignitedByLava() - .pushReaction(PushReaction.DESTROY) - ) + TallFlowerBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.PLANT) + .noCollission() + .instabreak() + .sound(SoundType.GRASS) + .offsetType(BlockBehaviour.OffsetType.XZ) + .ignitedByLava() + .pushReaction(PushReaction.DESTROY) ); public static final Block TALL_GRASS = register( "tall_grass", - new DoublePlantBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.PLANT) - .replaceable() - .noCollission() - .instabreak() - .sound(SoundType.GRASS) - .offsetType(BlockBehaviour.OffsetType.XZ) - .ignitedByLava() - .pushReaction(PushReaction.DESTROY) - ) + DoublePlantBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.PLANT) + .replaceable() + .noCollission() + .instabreak() + .sound(SoundType.GRASS) + .offsetType(BlockBehaviour.OffsetType.XZ) + .ignitedByLava() + .pushReaction(PushReaction.DESTROY) ); public static final Block LARGE_FERN = register( "large_fern", - new DoublePlantBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.PLANT) - .replaceable() - .noCollission() - .instabreak() - .sound(SoundType.GRASS) - .offsetType(BlockBehaviour.OffsetType.XZ) - .ignitedByLava() - .pushReaction(PushReaction.DESTROY) - ) + DoublePlantBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.PLANT) + .replaceable() + .noCollission() + .instabreak() + .sound(SoundType.GRASS) + .offsetType(BlockBehaviour.OffsetType.XZ) + .ignitedByLava() + .pushReaction(PushReaction.DESTROY) ); public static final Block WHITE_BANNER = register( "white_banner", - new BannerBlock( - DyeColor.WHITE, - BlockBehaviour.Properties.of() - .mapColor(MapColor.WOOD) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASS) - .noCollission() - .strength(1.0F) - .sound(SoundType.WOOD) - .ignitedByLava() - ) + properties -> new BannerBlock(DyeColor.WHITE, properties), + BlockBehaviour.Properties.of() + .mapColor(MapColor.WOOD) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASS) + .noCollission() + .strength(1.0F) + .sound(SoundType.WOOD) + .ignitedByLava() ); public static final Block ORANGE_BANNER = register( "orange_banner", - new BannerBlock( - DyeColor.ORANGE, - BlockBehaviour.Properties.of() - .mapColor(MapColor.WOOD) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASS) - .noCollission() - .strength(1.0F) - .sound(SoundType.WOOD) - .ignitedByLava() - ) + properties -> new BannerBlock(DyeColor.ORANGE, properties), + BlockBehaviour.Properties.of() + .mapColor(MapColor.WOOD) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASS) + .noCollission() + .strength(1.0F) + .sound(SoundType.WOOD) + .ignitedByLava() ); public static final Block MAGENTA_BANNER = register( "magenta_banner", - new BannerBlock( - DyeColor.MAGENTA, - BlockBehaviour.Properties.of() - .mapColor(MapColor.WOOD) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASS) - .noCollission() - .strength(1.0F) - .sound(SoundType.WOOD) - .ignitedByLava() - ) + properties -> new BannerBlock(DyeColor.MAGENTA, properties), + BlockBehaviour.Properties.of() + .mapColor(MapColor.WOOD) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASS) + .noCollission() + .strength(1.0F) + .sound(SoundType.WOOD) + .ignitedByLava() ); public static final Block LIGHT_BLUE_BANNER = register( "light_blue_banner", - new BannerBlock( - DyeColor.LIGHT_BLUE, - BlockBehaviour.Properties.of() - .mapColor(MapColor.WOOD) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASS) - .noCollission() - .strength(1.0F) - .sound(SoundType.WOOD) - .ignitedByLava() - ) + properties -> new BannerBlock(DyeColor.LIGHT_BLUE, properties), + BlockBehaviour.Properties.of() + .mapColor(MapColor.WOOD) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASS) + .noCollission() + .strength(1.0F) + .sound(SoundType.WOOD) + .ignitedByLava() ); public static final Block YELLOW_BANNER = register( "yellow_banner", - new BannerBlock( - DyeColor.YELLOW, - BlockBehaviour.Properties.of() - .mapColor(MapColor.WOOD) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASS) - .noCollission() - .strength(1.0F) - .sound(SoundType.WOOD) - .ignitedByLava() - ) + properties -> new BannerBlock(DyeColor.YELLOW, properties), + BlockBehaviour.Properties.of() + .mapColor(MapColor.WOOD) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASS) + .noCollission() + .strength(1.0F) + .sound(SoundType.WOOD) + .ignitedByLava() ); public static final Block LIME_BANNER = register( "lime_banner", - new BannerBlock( - DyeColor.LIME, - BlockBehaviour.Properties.of() - .mapColor(MapColor.WOOD) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASS) - .noCollission() - .strength(1.0F) - .sound(SoundType.WOOD) - .ignitedByLava() - ) + properties -> new BannerBlock(DyeColor.LIME, properties), + BlockBehaviour.Properties.of() + .mapColor(MapColor.WOOD) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASS) + .noCollission() + .strength(1.0F) + .sound(SoundType.WOOD) + .ignitedByLava() ); public static final Block PINK_BANNER = register( "pink_banner", - new BannerBlock( - DyeColor.PINK, - BlockBehaviour.Properties.of() - .mapColor(MapColor.WOOD) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASS) - .noCollission() - .strength(1.0F) - .sound(SoundType.WOOD) - .ignitedByLava() - ) + properties -> new BannerBlock(DyeColor.PINK, properties), + BlockBehaviour.Properties.of() + .mapColor(MapColor.WOOD) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASS) + .noCollission() + .strength(1.0F) + .sound(SoundType.WOOD) + .ignitedByLava() ); public static final Block GRAY_BANNER = register( "gray_banner", - new BannerBlock( - DyeColor.GRAY, - BlockBehaviour.Properties.of() - .mapColor(MapColor.WOOD) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASS) - .noCollission() - .strength(1.0F) - .sound(SoundType.WOOD) - .ignitedByLava() - ) + properties -> new BannerBlock(DyeColor.GRAY, properties), + BlockBehaviour.Properties.of() + .mapColor(MapColor.WOOD) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASS) + .noCollission() + .strength(1.0F) + .sound(SoundType.WOOD) + .ignitedByLava() ); public static final Block LIGHT_GRAY_BANNER = register( "light_gray_banner", - new BannerBlock( - DyeColor.LIGHT_GRAY, - BlockBehaviour.Properties.of() - .mapColor(MapColor.WOOD) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASS) - .noCollission() - .strength(1.0F) - .sound(SoundType.WOOD) - .ignitedByLava() - ) + properties -> new BannerBlock(DyeColor.LIGHT_GRAY, properties), + BlockBehaviour.Properties.of() + .mapColor(MapColor.WOOD) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASS) + .noCollission() + .strength(1.0F) + .sound(SoundType.WOOD) + .ignitedByLava() ); public static final Block CYAN_BANNER = register( "cyan_banner", - new BannerBlock( - DyeColor.CYAN, - BlockBehaviour.Properties.of() - .mapColor(MapColor.WOOD) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASS) - .noCollission() - .strength(1.0F) - .sound(SoundType.WOOD) - .ignitedByLava() - ) + properties -> new BannerBlock(DyeColor.CYAN, properties), + BlockBehaviour.Properties.of() + .mapColor(MapColor.WOOD) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASS) + .noCollission() + .strength(1.0F) + .sound(SoundType.WOOD) + .ignitedByLava() ); public static final Block PURPLE_BANNER = register( "purple_banner", - new BannerBlock( - DyeColor.PURPLE, - BlockBehaviour.Properties.of() - .mapColor(MapColor.WOOD) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASS) - .noCollission() - .strength(1.0F) - .sound(SoundType.WOOD) - .ignitedByLava() - ) + properties -> new BannerBlock(DyeColor.PURPLE, properties), + BlockBehaviour.Properties.of() + .mapColor(MapColor.WOOD) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASS) + .noCollission() + .strength(1.0F) + .sound(SoundType.WOOD) + .ignitedByLava() ); public static final Block BLUE_BANNER = register( "blue_banner", - new BannerBlock( - DyeColor.BLUE, - BlockBehaviour.Properties.of() - .mapColor(MapColor.WOOD) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASS) - .noCollission() - .strength(1.0F) - .sound(SoundType.WOOD) - .ignitedByLava() - ) + properties -> new BannerBlock(DyeColor.BLUE, properties), + BlockBehaviour.Properties.of() + .mapColor(MapColor.WOOD) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASS) + .noCollission() + .strength(1.0F) + .sound(SoundType.WOOD) + .ignitedByLava() ); public static final Block BROWN_BANNER = register( "brown_banner", - new BannerBlock( - DyeColor.BROWN, - BlockBehaviour.Properties.of() - .mapColor(MapColor.WOOD) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASS) - .noCollission() - .strength(1.0F) - .sound(SoundType.WOOD) - .ignitedByLava() - ) + properties -> new BannerBlock(DyeColor.BROWN, properties), + BlockBehaviour.Properties.of() + .mapColor(MapColor.WOOD) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASS) + .noCollission() + .strength(1.0F) + .sound(SoundType.WOOD) + .ignitedByLava() ); public static final Block GREEN_BANNER = register( "green_banner", - new BannerBlock( - DyeColor.GREEN, - BlockBehaviour.Properties.of() - .mapColor(MapColor.WOOD) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASS) - .noCollission() - .strength(1.0F) - .sound(SoundType.WOOD) - .ignitedByLava() - ) + properties -> new BannerBlock(DyeColor.GREEN, properties), + BlockBehaviour.Properties.of() + .mapColor(MapColor.WOOD) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASS) + .noCollission() + .strength(1.0F) + .sound(SoundType.WOOD) + .ignitedByLava() ); public static final Block RED_BANNER = register( "red_banner", - new BannerBlock( - DyeColor.RED, - BlockBehaviour.Properties.of() - .mapColor(MapColor.WOOD) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASS) - .noCollission() - .strength(1.0F) - .sound(SoundType.WOOD) - .ignitedByLava() - ) + properties -> new BannerBlock(DyeColor.RED, properties), + BlockBehaviour.Properties.of() + .mapColor(MapColor.WOOD) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASS) + .noCollission() + .strength(1.0F) + .sound(SoundType.WOOD) + .ignitedByLava() ); public static final Block BLACK_BANNER = register( "black_banner", - new BannerBlock( - DyeColor.BLACK, - BlockBehaviour.Properties.of() - .mapColor(MapColor.WOOD) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASS) - .noCollission() - .strength(1.0F) - .sound(SoundType.WOOD) - .ignitedByLava() - ) + properties -> new BannerBlock(DyeColor.BLACK, properties), + BlockBehaviour.Properties.of() + .mapColor(MapColor.WOOD) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASS) + .noCollission() + .strength(1.0F) + .sound(SoundType.WOOD) + .ignitedByLava() ); public static final Block WHITE_WALL_BANNER = register( "white_wall_banner", - new WallBannerBlock( - DyeColor.WHITE, - BlockBehaviour.Properties.of() - .mapColor(MapColor.WOOD) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASS) - .noCollission() - .strength(1.0F) - .sound(SoundType.WOOD) - .dropsLike(WHITE_BANNER) - .ignitedByLava() - ) + properties -> new WallBannerBlock(DyeColor.WHITE, properties), + wallVariant(WHITE_BANNER, true) + .mapColor(MapColor.WOOD) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASS) + .noCollission() + .strength(1.0F) + .sound(SoundType.WOOD) + .ignitedByLava() ); public static final Block ORANGE_WALL_BANNER = register( "orange_wall_banner", - new WallBannerBlock( - DyeColor.ORANGE, - BlockBehaviour.Properties.of() - .mapColor(MapColor.WOOD) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASS) - .noCollission() - .strength(1.0F) - .sound(SoundType.WOOD) - .dropsLike(ORANGE_BANNER) - .ignitedByLava() - ) + properties -> new WallBannerBlock(DyeColor.ORANGE, properties), + wallVariant(ORANGE_BANNER, true) + .mapColor(MapColor.WOOD) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASS) + .noCollission() + .strength(1.0F) + .sound(SoundType.WOOD) + .ignitedByLava() ); public static final Block MAGENTA_WALL_BANNER = register( "magenta_wall_banner", - new WallBannerBlock( - DyeColor.MAGENTA, - BlockBehaviour.Properties.of() - .mapColor(MapColor.WOOD) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASS) - .noCollission() - .strength(1.0F) - .sound(SoundType.WOOD) - .dropsLike(MAGENTA_BANNER) - .ignitedByLava() - ) + properties -> new WallBannerBlock(DyeColor.MAGENTA, properties), + wallVariant(MAGENTA_BANNER, true) + .mapColor(MapColor.WOOD) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASS) + .noCollission() + .strength(1.0F) + .sound(SoundType.WOOD) + .ignitedByLava() ); public static final Block LIGHT_BLUE_WALL_BANNER = register( "light_blue_wall_banner", - new WallBannerBlock( - DyeColor.LIGHT_BLUE, - BlockBehaviour.Properties.of() - .mapColor(MapColor.WOOD) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASS) - .noCollission() - .strength(1.0F) - .sound(SoundType.WOOD) - .dropsLike(LIGHT_BLUE_BANNER) - .ignitedByLava() - ) + properties -> new WallBannerBlock(DyeColor.LIGHT_BLUE, properties), + wallVariant(LIGHT_BLUE_BANNER, true) + .mapColor(MapColor.WOOD) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASS) + .noCollission() + .strength(1.0F) + .sound(SoundType.WOOD) + .ignitedByLava() ); public static final Block YELLOW_WALL_BANNER = register( "yellow_wall_banner", - new WallBannerBlock( - DyeColor.YELLOW, - BlockBehaviour.Properties.of() - .mapColor(MapColor.WOOD) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASS) - .noCollission() - .strength(1.0F) - .sound(SoundType.WOOD) - .dropsLike(YELLOW_BANNER) - .ignitedByLava() - ) + properties -> new WallBannerBlock(DyeColor.YELLOW, properties), + wallVariant(YELLOW_BANNER, true) + .mapColor(MapColor.WOOD) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASS) + .noCollission() + .strength(1.0F) + .sound(SoundType.WOOD) + .ignitedByLava() ); public static final Block LIME_WALL_BANNER = register( "lime_wall_banner", - new WallBannerBlock( - DyeColor.LIME, - BlockBehaviour.Properties.of() - .mapColor(MapColor.WOOD) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASS) - .noCollission() - .strength(1.0F) - .sound(SoundType.WOOD) - .dropsLike(LIME_BANNER) - .ignitedByLava() - ) + properties -> new WallBannerBlock(DyeColor.LIME, properties), + wallVariant(LIME_BANNER, true) + .mapColor(MapColor.WOOD) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASS) + .noCollission() + .strength(1.0F) + .sound(SoundType.WOOD) + .ignitedByLava() ); public static final Block PINK_WALL_BANNER = register( "pink_wall_banner", - new WallBannerBlock( - DyeColor.PINK, - BlockBehaviour.Properties.of() - .mapColor(MapColor.WOOD) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASS) - .noCollission() - .strength(1.0F) - .sound(SoundType.WOOD) - .dropsLike(PINK_BANNER) - .ignitedByLava() - ) + properties -> new WallBannerBlock(DyeColor.PINK, properties), + wallVariant(PINK_BANNER, true) + .mapColor(MapColor.WOOD) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASS) + .noCollission() + .strength(1.0F) + .sound(SoundType.WOOD) + .ignitedByLava() ); public static final Block GRAY_WALL_BANNER = register( "gray_wall_banner", - new WallBannerBlock( - DyeColor.GRAY, - BlockBehaviour.Properties.of() - .mapColor(MapColor.WOOD) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASS) - .noCollission() - .strength(1.0F) - .sound(SoundType.WOOD) - .dropsLike(GRAY_BANNER) - .ignitedByLava() - ) + properties -> new WallBannerBlock(DyeColor.GRAY, properties), + wallVariant(GRAY_BANNER, true) + .mapColor(MapColor.WOOD) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASS) + .noCollission() + .strength(1.0F) + .sound(SoundType.WOOD) + .ignitedByLava() ); public static final Block LIGHT_GRAY_WALL_BANNER = register( "light_gray_wall_banner", - new WallBannerBlock( - DyeColor.LIGHT_GRAY, - BlockBehaviour.Properties.of() - .mapColor(MapColor.WOOD) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASS) - .noCollission() - .strength(1.0F) - .sound(SoundType.WOOD) - .dropsLike(LIGHT_GRAY_BANNER) - .ignitedByLava() - ) + properties -> new WallBannerBlock(DyeColor.LIGHT_GRAY, properties), + wallVariant(LIGHT_GRAY_BANNER, true) + .mapColor(MapColor.WOOD) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASS) + .noCollission() + .strength(1.0F) + .sound(SoundType.WOOD) + .ignitedByLava() ); public static final Block CYAN_WALL_BANNER = register( "cyan_wall_banner", - new WallBannerBlock( - DyeColor.CYAN, - BlockBehaviour.Properties.of() - .mapColor(MapColor.WOOD) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASS) - .noCollission() - .strength(1.0F) - .sound(SoundType.WOOD) - .dropsLike(CYAN_BANNER) - .ignitedByLava() - ) + properties -> new WallBannerBlock(DyeColor.CYAN, properties), + wallVariant(CYAN_BANNER, true) + .mapColor(MapColor.WOOD) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASS) + .noCollission() + .strength(1.0F) + .sound(SoundType.WOOD) + .ignitedByLava() ); public static final Block PURPLE_WALL_BANNER = register( "purple_wall_banner", - new WallBannerBlock( - DyeColor.PURPLE, - BlockBehaviour.Properties.of() - .mapColor(MapColor.WOOD) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASS) - .noCollission() - .strength(1.0F) - .sound(SoundType.WOOD) - .dropsLike(PURPLE_BANNER) - .ignitedByLava() - ) + properties -> new WallBannerBlock(DyeColor.PURPLE, properties), + wallVariant(PURPLE_BANNER, true) + .mapColor(MapColor.WOOD) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASS) + .noCollission() + .strength(1.0F) + .sound(SoundType.WOOD) + .ignitedByLava() ); public static final Block BLUE_WALL_BANNER = register( "blue_wall_banner", - new WallBannerBlock( - DyeColor.BLUE, - BlockBehaviour.Properties.of() - .mapColor(MapColor.WOOD) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASS) - .noCollission() - .strength(1.0F) - .sound(SoundType.WOOD) - .dropsLike(BLUE_BANNER) - .ignitedByLava() - ) + properties -> new WallBannerBlock(DyeColor.BLUE, properties), + wallVariant(BLUE_BANNER, true) + .mapColor(MapColor.WOOD) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASS) + .noCollission() + .strength(1.0F) + .sound(SoundType.WOOD) + .ignitedByLava() ); public static final Block BROWN_WALL_BANNER = register( "brown_wall_banner", - new WallBannerBlock( - DyeColor.BROWN, - BlockBehaviour.Properties.of() - .mapColor(MapColor.WOOD) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASS) - .noCollission() - .strength(1.0F) - .sound(SoundType.WOOD) - .dropsLike(BROWN_BANNER) - .ignitedByLava() - ) + properties -> new WallBannerBlock(DyeColor.BROWN, properties), + wallVariant(BROWN_BANNER, true) + .mapColor(MapColor.WOOD) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASS) + .noCollission() + .strength(1.0F) + .sound(SoundType.WOOD) + .ignitedByLava() ); public static final Block GREEN_WALL_BANNER = register( "green_wall_banner", - new WallBannerBlock( - DyeColor.GREEN, - BlockBehaviour.Properties.of() - .mapColor(MapColor.WOOD) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASS) - .noCollission() - .strength(1.0F) - .sound(SoundType.WOOD) - .dropsLike(GREEN_BANNER) - .ignitedByLava() - ) + properties -> new WallBannerBlock(DyeColor.GREEN, properties), + wallVariant(GREEN_BANNER, true) + .mapColor(MapColor.WOOD) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASS) + .noCollission() + .strength(1.0F) + .sound(SoundType.WOOD) + .ignitedByLava() ); public static final Block RED_WALL_BANNER = register( "red_wall_banner", - new WallBannerBlock( - DyeColor.RED, - BlockBehaviour.Properties.of() - .mapColor(MapColor.WOOD) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASS) - .noCollission() - .strength(1.0F) - .sound(SoundType.WOOD) - .dropsLike(RED_BANNER) - .ignitedByLava() - ) + properties -> new WallBannerBlock(DyeColor.RED, properties), + wallVariant(RED_BANNER, true) + .mapColor(MapColor.WOOD) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASS) + .noCollission() + .strength(1.0F) + .sound(SoundType.WOOD) + .ignitedByLava() ); public static final Block BLACK_WALL_BANNER = register( "black_wall_banner", - new WallBannerBlock( - DyeColor.BLACK, - BlockBehaviour.Properties.of() - .mapColor(MapColor.WOOD) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASS) - .noCollission() - .strength(1.0F) - .sound(SoundType.WOOD) - .dropsLike(BLACK_BANNER) - .ignitedByLava() - ) + properties -> new WallBannerBlock(DyeColor.BLACK, properties), + wallVariant(BLACK_BANNER, true) + .mapColor(MapColor.WOOD) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASS) + .noCollission() + .strength(1.0F) + .sound(SoundType.WOOD) + .ignitedByLava() ); public static final Block RED_SANDSTONE = register( "red_sandstone", - new Block( - BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_ORANGE).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(0.8F) - ) + BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_ORANGE).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(0.8F) ); public static final Block CHISELED_RED_SANDSTONE = register( "chiseled_red_sandstone", - new Block( - BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_ORANGE).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(0.8F) - ) + BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_ORANGE).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(0.8F) ); public static final Block CUT_RED_SANDSTONE = register( "cut_red_sandstone", - new Block( - BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_ORANGE).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(0.8F) - ) + BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_ORANGE).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(0.8F) ); - public static final Block RED_SANDSTONE_STAIRS = register("red_sandstone_stairs", legacyStair(RED_SANDSTONE)); + public static final Block RED_SANDSTONE_STAIRS = registerLegacyStair("red_sandstone_stairs", RED_SANDSTONE); public static final Block OAK_SLAB = register( "oak_slab", - new SlabBlock( - BlockBehaviour.Properties.of().mapColor(MapColor.WOOD).instrument(NoteBlockInstrument.BASS).strength(2.0F, 3.0F).sound(SoundType.WOOD).ignitedByLava() - ) + SlabBlock::new, + BlockBehaviour.Properties.of().mapColor(MapColor.WOOD).instrument(NoteBlockInstrument.BASS).strength(2.0F, 3.0F).sound(SoundType.WOOD).ignitedByLava() ); public static final Block SPRUCE_SLAB = register( "spruce_slab", - new SlabBlock( - BlockBehaviour.Properties.of().mapColor(MapColor.PODZOL).instrument(NoteBlockInstrument.BASS).strength(2.0F, 3.0F).sound(SoundType.WOOD).ignitedByLava() - ) + SlabBlock::new, + BlockBehaviour.Properties.of().mapColor(MapColor.PODZOL).instrument(NoteBlockInstrument.BASS).strength(2.0F, 3.0F).sound(SoundType.WOOD).ignitedByLava() ); public static final Block BIRCH_SLAB = register( "birch_slab", - new SlabBlock( - BlockBehaviour.Properties.of().mapColor(MapColor.SAND).instrument(NoteBlockInstrument.BASS).strength(2.0F, 3.0F).sound(SoundType.WOOD).ignitedByLava() - ) + SlabBlock::new, + BlockBehaviour.Properties.of().mapColor(MapColor.SAND).instrument(NoteBlockInstrument.BASS).strength(2.0F, 3.0F).sound(SoundType.WOOD).ignitedByLava() ); public static final Block JUNGLE_SLAB = register( "jungle_slab", - new SlabBlock( - BlockBehaviour.Properties.of().mapColor(MapColor.DIRT).instrument(NoteBlockInstrument.BASS).strength(2.0F, 3.0F).sound(SoundType.WOOD).ignitedByLava() - ) + SlabBlock::new, + BlockBehaviour.Properties.of().mapColor(MapColor.DIRT).instrument(NoteBlockInstrument.BASS).strength(2.0F, 3.0F).sound(SoundType.WOOD).ignitedByLava() ); public static final Block ACACIA_SLAB = register( "acacia_slab", - new SlabBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.COLOR_ORANGE) - .instrument(NoteBlockInstrument.BASS) - .strength(2.0F, 3.0F) - .sound(SoundType.WOOD) - .ignitedByLava() - ) + SlabBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.COLOR_ORANGE) + .instrument(NoteBlockInstrument.BASS) + .strength(2.0F, 3.0F) + .sound(SoundType.WOOD) + .ignitedByLava() ); public static final Block CHERRY_SLAB = register( "cherry_slab", - new SlabBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.TERRACOTTA_WHITE) - .instrument(NoteBlockInstrument.BASS) - .strength(2.0F, 3.0F) - .sound(SoundType.CHERRY_WOOD) - .ignitedByLava() - ) + SlabBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.TERRACOTTA_WHITE) + .instrument(NoteBlockInstrument.BASS) + .strength(2.0F, 3.0F) + .sound(SoundType.CHERRY_WOOD) + .ignitedByLava() ); public static final Block DARK_OAK_SLAB = register( "dark_oak_slab", - new SlabBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.COLOR_BROWN) - .instrument(NoteBlockInstrument.BASS) - .strength(2.0F, 3.0F) - .sound(SoundType.WOOD) - .ignitedByLava() - ) + SlabBlock::new, + BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_BROWN).instrument(NoteBlockInstrument.BASS).strength(2.0F, 3.0F).sound(SoundType.WOOD).ignitedByLava() + ); + public static final Block PALE_OAK_SLAB = register( + "pale_oak_slab", + SlabBlock::new, + BlockBehaviour.Properties.of() + .mapColor(PALE_OAK_PLANKS.defaultMapColor()) + .instrument(NoteBlockInstrument.BASS) + .strength(2.0F, 3.0F) + .sound(SoundType.WOOD) + .ignitedByLava() + .requiredFeatures(FeatureFlags.WINTER_DROP) ); public static final Block MANGROVE_SLAB = register( "mangrove_slab", - new SlabBlock( - BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_RED).instrument(NoteBlockInstrument.BASS).strength(2.0F, 3.0F).sound(SoundType.WOOD).ignitedByLava() - ) + SlabBlock::new, + BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_RED).instrument(NoteBlockInstrument.BASS).strength(2.0F, 3.0F).sound(SoundType.WOOD).ignitedByLava() ); public static final Block BAMBOO_SLAB = register( "bamboo_slab", - new SlabBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.COLOR_YELLOW) - .instrument(NoteBlockInstrument.BASS) - .strength(2.0F, 3.0F) - .sound(SoundType.BAMBOO_WOOD) - .ignitedByLava() - ) + SlabBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.COLOR_YELLOW) + .instrument(NoteBlockInstrument.BASS) + .strength(2.0F, 3.0F) + .sound(SoundType.BAMBOO_WOOD) + .ignitedByLava() ); public static final Block BAMBOO_MOSAIC_SLAB = register( "bamboo_mosaic_slab", - new SlabBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.COLOR_YELLOW) - .instrument(NoteBlockInstrument.BASS) - .strength(2.0F, 3.0F) - .sound(SoundType.BAMBOO_WOOD) - .ignitedByLava() - ) + SlabBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.COLOR_YELLOW) + .instrument(NoteBlockInstrument.BASS) + .strength(2.0F, 3.0F) + .sound(SoundType.BAMBOO_WOOD) + .ignitedByLava() ); public static final Block STONE_SLAB = register( "stone_slab", - new SlabBlock( - BlockBehaviour.Properties.of().mapColor(MapColor.STONE).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(2.0F, 6.0F) - ) + SlabBlock::new, + BlockBehaviour.Properties.of().mapColor(MapColor.STONE).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(2.0F, 6.0F) ); public static final Block SMOOTH_STONE_SLAB = register( "smooth_stone_slab", - new SlabBlock( - BlockBehaviour.Properties.of().mapColor(MapColor.STONE).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(2.0F, 6.0F) - ) + SlabBlock::new, + BlockBehaviour.Properties.of().mapColor(MapColor.STONE).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(2.0F, 6.0F) ); public static final Block SANDSTONE_SLAB = register( "sandstone_slab", - new SlabBlock( - BlockBehaviour.Properties.of().mapColor(MapColor.SAND).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(2.0F, 6.0F) - ) + SlabBlock::new, + BlockBehaviour.Properties.of().mapColor(MapColor.SAND).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(2.0F, 6.0F) ); public static final Block CUT_SANDSTONE_SLAB = register( "cut_sandstone_slab", - new SlabBlock( - BlockBehaviour.Properties.of().mapColor(MapColor.SAND).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(2.0F, 6.0F) - ) + SlabBlock::new, + BlockBehaviour.Properties.of().mapColor(MapColor.SAND).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(2.0F, 6.0F) ); public static final Block PETRIFIED_OAK_SLAB = register( "petrified_oak_slab", - new SlabBlock( - BlockBehaviour.Properties.of().mapColor(MapColor.WOOD).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(2.0F, 6.0F) - ) + SlabBlock::new, + BlockBehaviour.Properties.of().mapColor(MapColor.WOOD).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(2.0F, 6.0F) ); public static final Block COBBLESTONE_SLAB = register( "cobblestone_slab", - new SlabBlock( - BlockBehaviour.Properties.of().mapColor(MapColor.STONE).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(2.0F, 6.0F) - ) + SlabBlock::new, + BlockBehaviour.Properties.of().mapColor(MapColor.STONE).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(2.0F, 6.0F) ); public static final Block BRICK_SLAB = register( "brick_slab", - new SlabBlock( - BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_RED).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(2.0F, 6.0F) - ) + SlabBlock::new, + BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_RED).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(2.0F, 6.0F) ); public static final Block STONE_BRICK_SLAB = register( "stone_brick_slab", - new SlabBlock( - BlockBehaviour.Properties.of().mapColor(MapColor.STONE).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(2.0F, 6.0F) - ) + SlabBlock::new, + BlockBehaviour.Properties.of().mapColor(MapColor.STONE).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(2.0F, 6.0F) ); public static final Block MUD_BRICK_SLAB = register( "mud_brick_slab", - new SlabBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.TERRACOTTA_LIGHT_GRAY) - .instrument(NoteBlockInstrument.BASEDRUM) - .requiresCorrectToolForDrops() - .strength(1.5F, 3.0F) - .sound(SoundType.MUD_BRICKS) - ) + SlabBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.TERRACOTTA_LIGHT_GRAY) + .instrument(NoteBlockInstrument.BASEDRUM) + .requiresCorrectToolForDrops() + .strength(1.5F, 3.0F) + .sound(SoundType.MUD_BRICKS) ); public static final Block NETHER_BRICK_SLAB = register( "nether_brick_slab", - new SlabBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.NETHER) - .instrument(NoteBlockInstrument.BASEDRUM) - .requiresCorrectToolForDrops() - .strength(2.0F, 6.0F) - .sound(SoundType.NETHER_BRICKS) - ) + SlabBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.NETHER) + .instrument(NoteBlockInstrument.BASEDRUM) + .requiresCorrectToolForDrops() + .strength(2.0F, 6.0F) + .sound(SoundType.NETHER_BRICKS) ); public static final Block QUARTZ_SLAB = register( "quartz_slab", - new SlabBlock( - BlockBehaviour.Properties.of().mapColor(MapColor.QUARTZ).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(2.0F, 6.0F) - ) + SlabBlock::new, + BlockBehaviour.Properties.of().mapColor(MapColor.QUARTZ).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(2.0F, 6.0F) ); public static final Block RED_SANDSTONE_SLAB = register( "red_sandstone_slab", - new SlabBlock( - BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_ORANGE).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(2.0F, 6.0F) - ) + SlabBlock::new, + BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_ORANGE).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(2.0F, 6.0F) ); public static final Block CUT_RED_SANDSTONE_SLAB = register( "cut_red_sandstone_slab", - new SlabBlock( - BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_ORANGE).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(2.0F, 6.0F) - ) + SlabBlock::new, + BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_ORANGE).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(2.0F, 6.0F) ); public static final Block PURPUR_SLAB = register( "purpur_slab", - new SlabBlock( - BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_MAGENTA).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(2.0F, 6.0F) - ) + SlabBlock::new, + BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_MAGENTA).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(2.0F, 6.0F) ); public static final Block SMOOTH_STONE = register( "smooth_stone", - new Block(BlockBehaviour.Properties.of().mapColor(MapColor.STONE).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(2.0F, 6.0F)) + BlockBehaviour.Properties.of().mapColor(MapColor.STONE).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(2.0F, 6.0F) ); public static final Block SMOOTH_SANDSTONE = register( "smooth_sandstone", - new Block(BlockBehaviour.Properties.of().mapColor(MapColor.SAND).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(2.0F, 6.0F)) + BlockBehaviour.Properties.of().mapColor(MapColor.SAND).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(2.0F, 6.0F) ); public static final Block SMOOTH_QUARTZ = register( "smooth_quartz", - new Block( - BlockBehaviour.Properties.of().mapColor(MapColor.QUARTZ).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(2.0F, 6.0F) - ) + BlockBehaviour.Properties.of().mapColor(MapColor.QUARTZ).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(2.0F, 6.0F) ); public static final Block SMOOTH_RED_SANDSTONE = register( "smooth_red_sandstone", - new Block( - BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_ORANGE).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(2.0F, 6.0F) - ) + BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_ORANGE).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(2.0F, 6.0F) ); public static final Block SPRUCE_FENCE_GATE = register( "spruce_fence_gate", - new FenceGateBlock( - WoodType.SPRUCE, - BlockBehaviour.Properties.of() - .mapColor(SPRUCE_PLANKS.defaultMapColor()) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASS) - .strength(2.0F, 3.0F) - .ignitedByLava() - ) + properties -> new FenceGateBlock(WoodType.SPRUCE, properties), + BlockBehaviour.Properties.of() + .mapColor(SPRUCE_PLANKS.defaultMapColor()) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASS) + .strength(2.0F, 3.0F) + .ignitedByLava() ); public static final Block BIRCH_FENCE_GATE = register( "birch_fence_gate", - new FenceGateBlock( - WoodType.BIRCH, - BlockBehaviour.Properties.of() - .mapColor(BIRCH_PLANKS.defaultMapColor()) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASS) - .strength(2.0F, 3.0F) - .ignitedByLava() - ) + properties -> new FenceGateBlock(WoodType.BIRCH, properties), + BlockBehaviour.Properties.of() + .mapColor(BIRCH_PLANKS.defaultMapColor()) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASS) + .strength(2.0F, 3.0F) + .ignitedByLava() ); public static final Block JUNGLE_FENCE_GATE = register( "jungle_fence_gate", - new FenceGateBlock( - WoodType.JUNGLE, - BlockBehaviour.Properties.of() - .mapColor(JUNGLE_PLANKS.defaultMapColor()) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASS) - .strength(2.0F, 3.0F) - .ignitedByLava() - ) + properties -> new FenceGateBlock(WoodType.JUNGLE, properties), + BlockBehaviour.Properties.of() + .mapColor(JUNGLE_PLANKS.defaultMapColor()) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASS) + .strength(2.0F, 3.0F) + .ignitedByLava() ); public static final Block ACACIA_FENCE_GATE = register( "acacia_fence_gate", - new FenceGateBlock( - WoodType.ACACIA, - BlockBehaviour.Properties.of() - .mapColor(ACACIA_PLANKS.defaultMapColor()) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASS) - .strength(2.0F, 3.0F) - .ignitedByLava() - ) + properties -> new FenceGateBlock(WoodType.ACACIA, properties), + BlockBehaviour.Properties.of() + .mapColor(ACACIA_PLANKS.defaultMapColor()) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASS) + .strength(2.0F, 3.0F) + .ignitedByLava() ); public static final Block CHERRY_FENCE_GATE = register( "cherry_fence_gate", - new FenceGateBlock( - WoodType.CHERRY, - BlockBehaviour.Properties.of() - .mapColor(CHERRY_PLANKS.defaultMapColor()) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASS) - .strength(2.0F, 3.0F) - .ignitedByLava() - ) + properties -> new FenceGateBlock(WoodType.CHERRY, properties), + BlockBehaviour.Properties.of() + .mapColor(CHERRY_PLANKS.defaultMapColor()) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASS) + .strength(2.0F, 3.0F) + .ignitedByLava() ); public static final Block DARK_OAK_FENCE_GATE = register( "dark_oak_fence_gate", - new FenceGateBlock( - WoodType.DARK_OAK, - BlockBehaviour.Properties.of() - .mapColor(DARK_OAK_PLANKS.defaultMapColor()) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASS) - .strength(2.0F, 3.0F) - .ignitedByLava() - ) + properties -> new FenceGateBlock(WoodType.DARK_OAK, properties), + BlockBehaviour.Properties.of() + .mapColor(DARK_OAK_PLANKS.defaultMapColor()) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASS) + .strength(2.0F, 3.0F) + .ignitedByLava() + ); + public static final Block PALE_OAK_FENCE_GATE = register( + "pale_oak_fence_gate", + properties -> new FenceGateBlock(WoodType.PALE_OAK, properties), + BlockBehaviour.Properties.of() + .mapColor(PALE_OAK_PLANKS.defaultMapColor()) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASS) + .strength(2.0F, 3.0F) + .ignitedByLava() + .requiredFeatures(FeatureFlags.WINTER_DROP) ); public static final Block MANGROVE_FENCE_GATE = register( "mangrove_fence_gate", - new FenceGateBlock( - WoodType.MANGROVE, - BlockBehaviour.Properties.of() - .mapColor(MANGROVE_PLANKS.defaultMapColor()) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASS) - .strength(2.0F, 3.0F) - .ignitedByLava() - ) + properties -> new FenceGateBlock(WoodType.MANGROVE, properties), + BlockBehaviour.Properties.of() + .mapColor(MANGROVE_PLANKS.defaultMapColor()) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASS) + .strength(2.0F, 3.0F) + .ignitedByLava() ); public static final Block BAMBOO_FENCE_GATE = register( "bamboo_fence_gate", - new FenceGateBlock( - WoodType.BAMBOO, - BlockBehaviour.Properties.of() - .mapColor(BAMBOO_PLANKS.defaultMapColor()) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASS) - .strength(2.0F, 3.0F) - .ignitedByLava() - ) + properties -> new FenceGateBlock(WoodType.BAMBOO, properties), + BlockBehaviour.Properties.of() + .mapColor(BAMBOO_PLANKS.defaultMapColor()) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASS) + .strength(2.0F, 3.0F) + .ignitedByLava() ); public static final Block SPRUCE_FENCE = register( "spruce_fence", - new FenceBlock( - BlockBehaviour.Properties.of() - .mapColor(SPRUCE_PLANKS.defaultMapColor()) - .instrument(NoteBlockInstrument.BASS) - .strength(2.0F, 3.0F) - .ignitedByLava() - .sound(SoundType.WOOD) - ) + FenceBlock::new, + BlockBehaviour.Properties.of() + .mapColor(SPRUCE_PLANKS.defaultMapColor()) + .instrument(NoteBlockInstrument.BASS) + .strength(2.0F, 3.0F) + .ignitedByLava() + .sound(SoundType.WOOD) ); public static final Block BIRCH_FENCE = register( "birch_fence", - new FenceBlock( - BlockBehaviour.Properties.of() - .mapColor(BIRCH_PLANKS.defaultMapColor()) - .instrument(NoteBlockInstrument.BASS) - .strength(2.0F, 3.0F) - .ignitedByLava() - .sound(SoundType.WOOD) - ) + FenceBlock::new, + BlockBehaviour.Properties.of() + .mapColor(BIRCH_PLANKS.defaultMapColor()) + .instrument(NoteBlockInstrument.BASS) + .strength(2.0F, 3.0F) + .ignitedByLava() + .sound(SoundType.WOOD) ); public static final Block JUNGLE_FENCE = register( "jungle_fence", - new FenceBlock( - BlockBehaviour.Properties.of() - .mapColor(JUNGLE_PLANKS.defaultMapColor()) - .instrument(NoteBlockInstrument.BASS) - .strength(2.0F, 3.0F) - .ignitedByLava() - .sound(SoundType.WOOD) - ) + FenceBlock::new, + BlockBehaviour.Properties.of() + .mapColor(JUNGLE_PLANKS.defaultMapColor()) + .instrument(NoteBlockInstrument.BASS) + .strength(2.0F, 3.0F) + .ignitedByLava() + .sound(SoundType.WOOD) ); public static final Block ACACIA_FENCE = register( "acacia_fence", - new FenceBlock( - BlockBehaviour.Properties.of() - .mapColor(ACACIA_PLANKS.defaultMapColor()) - .instrument(NoteBlockInstrument.BASS) - .strength(2.0F, 3.0F) - .ignitedByLava() - .sound(SoundType.WOOD) - ) + FenceBlock::new, + BlockBehaviour.Properties.of() + .mapColor(ACACIA_PLANKS.defaultMapColor()) + .instrument(NoteBlockInstrument.BASS) + .strength(2.0F, 3.0F) + .ignitedByLava() + .sound(SoundType.WOOD) ); public static final Block CHERRY_FENCE = register( "cherry_fence", - new FenceBlock( - BlockBehaviour.Properties.of() - .mapColor(CHERRY_PLANKS.defaultMapColor()) - .instrument(NoteBlockInstrument.BASS) - .strength(2.0F, 3.0F) - .ignitedByLava() - .sound(SoundType.CHERRY_WOOD) - ) + FenceBlock::new, + BlockBehaviour.Properties.of() + .mapColor(CHERRY_PLANKS.defaultMapColor()) + .instrument(NoteBlockInstrument.BASS) + .strength(2.0F, 3.0F) + .ignitedByLava() + .sound(SoundType.CHERRY_WOOD) ); public static final Block DARK_OAK_FENCE = register( "dark_oak_fence", - new FenceBlock( - BlockBehaviour.Properties.of() - .mapColor(DARK_OAK_PLANKS.defaultMapColor()) - .instrument(NoteBlockInstrument.BASS) - .strength(2.0F, 3.0F) - .ignitedByLava() - .sound(SoundType.WOOD) - ) + FenceBlock::new, + BlockBehaviour.Properties.of() + .mapColor(DARK_OAK_PLANKS.defaultMapColor()) + .instrument(NoteBlockInstrument.BASS) + .strength(2.0F, 3.0F) + .ignitedByLava() + .sound(SoundType.WOOD) + ); + public static final Block PALE_OAK_FENCE = register( + "pale_oak_fence", + FenceBlock::new, + BlockBehaviour.Properties.of() + .mapColor(PALE_OAK_PLANKS.defaultMapColor()) + .instrument(NoteBlockInstrument.BASS) + .strength(2.0F, 3.0F) + .ignitedByLava() + .sound(SoundType.WOOD) + .requiredFeatures(FeatureFlags.WINTER_DROP) ); public static final Block MANGROVE_FENCE = register( "mangrove_fence", - new FenceBlock( - BlockBehaviour.Properties.of() - .mapColor(MANGROVE_PLANKS.defaultMapColor()) - .instrument(NoteBlockInstrument.BASS) - .strength(2.0F, 3.0F) - .ignitedByLava() - .sound(SoundType.WOOD) - ) + FenceBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MANGROVE_PLANKS.defaultMapColor()) + .instrument(NoteBlockInstrument.BASS) + .strength(2.0F, 3.0F) + .ignitedByLava() + .sound(SoundType.WOOD) ); public static final Block BAMBOO_FENCE = register( "bamboo_fence", - new FenceBlock( - BlockBehaviour.Properties.of() - .mapColor(BAMBOO_PLANKS.defaultMapColor()) - .instrument(NoteBlockInstrument.BASS) - .strength(2.0F, 3.0F) - .sound(SoundType.BAMBOO_WOOD) - .ignitedByLava() - ) + FenceBlock::new, + BlockBehaviour.Properties.of() + .mapColor(BAMBOO_PLANKS.defaultMapColor()) + .instrument(NoteBlockInstrument.BASS) + .strength(2.0F, 3.0F) + .sound(SoundType.BAMBOO_WOOD) + .ignitedByLava() ); public static final Block SPRUCE_DOOR = register( "spruce_door", - new DoorBlock( - BlockSetType.SPRUCE, - BlockBehaviour.Properties.of() - .mapColor(SPRUCE_PLANKS.defaultMapColor()) - .instrument(NoteBlockInstrument.BASS) - .strength(3.0F) - .noOcclusion() - .ignitedByLava() - .pushReaction(PushReaction.DESTROY) - ) + properties -> new DoorBlock(BlockSetType.SPRUCE, properties), + BlockBehaviour.Properties.of() + .mapColor(SPRUCE_PLANKS.defaultMapColor()) + .instrument(NoteBlockInstrument.BASS) + .strength(3.0F) + .noOcclusion() + .ignitedByLava() + .pushReaction(PushReaction.DESTROY) ); public static final Block BIRCH_DOOR = register( "birch_door", - new DoorBlock( - BlockSetType.BIRCH, - BlockBehaviour.Properties.of() - .mapColor(BIRCH_PLANKS.defaultMapColor()) - .instrument(NoteBlockInstrument.BASS) - .strength(3.0F) - .noOcclusion() - .ignitedByLava() - .pushReaction(PushReaction.DESTROY) - ) + properties -> new DoorBlock(BlockSetType.BIRCH, properties), + BlockBehaviour.Properties.of() + .mapColor(BIRCH_PLANKS.defaultMapColor()) + .instrument(NoteBlockInstrument.BASS) + .strength(3.0F) + .noOcclusion() + .ignitedByLava() + .pushReaction(PushReaction.DESTROY) ); public static final Block JUNGLE_DOOR = register( "jungle_door", - new DoorBlock( - BlockSetType.JUNGLE, - BlockBehaviour.Properties.of() - .mapColor(JUNGLE_PLANKS.defaultMapColor()) - .instrument(NoteBlockInstrument.BASS) - .strength(3.0F) - .noOcclusion() - .ignitedByLava() - .pushReaction(PushReaction.DESTROY) - ) + properties -> new DoorBlock(BlockSetType.JUNGLE, properties), + BlockBehaviour.Properties.of() + .mapColor(JUNGLE_PLANKS.defaultMapColor()) + .instrument(NoteBlockInstrument.BASS) + .strength(3.0F) + .noOcclusion() + .ignitedByLava() + .pushReaction(PushReaction.DESTROY) ); public static final Block ACACIA_DOOR = register( "acacia_door", - new DoorBlock( - BlockSetType.ACACIA, - BlockBehaviour.Properties.of() - .mapColor(ACACIA_PLANKS.defaultMapColor()) - .instrument(NoteBlockInstrument.BASS) - .strength(3.0F) - .noOcclusion() - .ignitedByLava() - .pushReaction(PushReaction.DESTROY) - ) + properties -> new DoorBlock(BlockSetType.ACACIA, properties), + BlockBehaviour.Properties.of() + .mapColor(ACACIA_PLANKS.defaultMapColor()) + .instrument(NoteBlockInstrument.BASS) + .strength(3.0F) + .noOcclusion() + .ignitedByLava() + .pushReaction(PushReaction.DESTROY) ); public static final Block CHERRY_DOOR = register( "cherry_door", - new DoorBlock( - BlockSetType.CHERRY, - BlockBehaviour.Properties.of() - .mapColor(CHERRY_PLANKS.defaultMapColor()) - .instrument(NoteBlockInstrument.BASS) - .strength(3.0F) - .noOcclusion() - .ignitedByLava() - .pushReaction(PushReaction.DESTROY) - ) + properties -> new DoorBlock(BlockSetType.CHERRY, properties), + BlockBehaviour.Properties.of() + .mapColor(CHERRY_PLANKS.defaultMapColor()) + .instrument(NoteBlockInstrument.BASS) + .strength(3.0F) + .noOcclusion() + .ignitedByLava() + .pushReaction(PushReaction.DESTROY) ); public static final Block DARK_OAK_DOOR = register( "dark_oak_door", - new DoorBlock( - BlockSetType.DARK_OAK, - BlockBehaviour.Properties.of() - .mapColor(DARK_OAK_PLANKS.defaultMapColor()) - .instrument(NoteBlockInstrument.BASS) - .strength(3.0F) - .noOcclusion() - .ignitedByLava() - .pushReaction(PushReaction.DESTROY) - ) + properties -> new DoorBlock(BlockSetType.DARK_OAK, properties), + BlockBehaviour.Properties.of() + .mapColor(DARK_OAK_PLANKS.defaultMapColor()) + .instrument(NoteBlockInstrument.BASS) + .strength(3.0F) + .noOcclusion() + .ignitedByLava() + .pushReaction(PushReaction.DESTROY) + ); + public static final Block PALE_OAK_DOOR = register( + "pale_oak_door", + properties -> new DoorBlock(BlockSetType.PALE_OAK, properties), + BlockBehaviour.Properties.of() + .mapColor(PALE_OAK_PLANKS.defaultMapColor()) + .instrument(NoteBlockInstrument.BASS) + .strength(3.0F) + .noOcclusion() + .ignitedByLava() + .pushReaction(PushReaction.DESTROY) + .requiredFeatures(FeatureFlags.WINTER_DROP) ); public static final Block MANGROVE_DOOR = register( "mangrove_door", - new DoorBlock( - BlockSetType.MANGROVE, - BlockBehaviour.Properties.of() - .mapColor(MANGROVE_PLANKS.defaultMapColor()) - .instrument(NoteBlockInstrument.BASS) - .strength(3.0F) - .noOcclusion() - .ignitedByLava() - .pushReaction(PushReaction.DESTROY) - ) + properties -> new DoorBlock(BlockSetType.MANGROVE, properties), + BlockBehaviour.Properties.of() + .mapColor(MANGROVE_PLANKS.defaultMapColor()) + .instrument(NoteBlockInstrument.BASS) + .strength(3.0F) + .noOcclusion() + .ignitedByLava() + .pushReaction(PushReaction.DESTROY) ); public static final Block BAMBOO_DOOR = register( "bamboo_door", - new DoorBlock( - BlockSetType.BAMBOO, - BlockBehaviour.Properties.of() - .mapColor(BAMBOO_PLANKS.defaultMapColor()) - .instrument(NoteBlockInstrument.BASS) - .strength(3.0F) - .noOcclusion() - .ignitedByLava() - .pushReaction(PushReaction.DESTROY) - ) + properties -> new DoorBlock(BlockSetType.BAMBOO, properties), + BlockBehaviour.Properties.of() + .mapColor(BAMBOO_PLANKS.defaultMapColor()) + .instrument(NoteBlockInstrument.BASS) + .strength(3.0F) + .noOcclusion() + .ignitedByLava() + .pushReaction(PushReaction.DESTROY) ); public static final Block END_ROD = register( - "end_rod", new EndRodBlock(BlockBehaviour.Properties.of().forceSolidOff().instabreak().lightLevel(blockStatex -> 14).sound(SoundType.WOOD).noOcclusion()) + "end_rod", EndRodBlock::new, BlockBehaviour.Properties.of().forceSolidOff().instabreak().lightLevel(blockStatex -> 14).sound(SoundType.WOOD).noOcclusion() ); public static final Block CHORUS_PLANT = register( "chorus_plant", - new ChorusPlantBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.COLOR_PURPLE) - .forceSolidOff() - .strength(0.4F) - .sound(SoundType.WOOD) - .noOcclusion() - .pushReaction(PushReaction.DESTROY) - ) + ChorusPlantBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.COLOR_PURPLE) + .forceSolidOff() + .strength(0.4F) + .sound(SoundType.WOOD) + .noOcclusion() + .pushReaction(PushReaction.DESTROY) ); public static final Block CHORUS_FLOWER = register( "chorus_flower", - new ChorusFlowerBlock( - CHORUS_PLANT, - BlockBehaviour.Properties.of() - .mapColor(MapColor.COLOR_PURPLE) - .forceSolidOff() - .randomTicks() - .strength(0.4F) - .sound(SoundType.WOOD) - .noOcclusion() - .isValidSpawn(Blocks::never) - .pushReaction(PushReaction.DESTROY) - .isRedstoneConductor(Blocks::never) - ) + properties -> new ChorusFlowerBlock(CHORUS_PLANT, properties), + BlockBehaviour.Properties.of() + .mapColor(MapColor.COLOR_PURPLE) + .forceSolidOff() + .randomTicks() + .strength(0.4F) + .sound(SoundType.WOOD) + .noOcclusion() + .isValidSpawn(Blocks::never) + .pushReaction(PushReaction.DESTROY) + .isRedstoneConductor(Blocks::never) ); public static final Block PURPUR_BLOCK = register( "purpur_block", - new Block( - BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_MAGENTA).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(1.5F, 6.0F) - ) + BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_MAGENTA).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(1.5F, 6.0F) ); public static final Block PURPUR_PILLAR = register( "purpur_pillar", - new RotatedPillarBlock( - BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_MAGENTA).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(1.5F, 6.0F) - ) + RotatedPillarBlock::new, + BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_MAGENTA).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(1.5F, 6.0F) ); - public static final Block PURPUR_STAIRS = register("purpur_stairs", legacyStair(PURPUR_BLOCK)); + public static final Block PURPUR_STAIRS = registerLegacyStair("purpur_stairs", PURPUR_BLOCK); public static final Block END_STONE_BRICKS = register( "end_stone_bricks", - new Block(BlockBehaviour.Properties.of().mapColor(MapColor.SAND).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(3.0F, 9.0F)) + BlockBehaviour.Properties.of().mapColor(MapColor.SAND).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(3.0F, 9.0F) ); public static final Block TORCHFLOWER_CROP = register( "torchflower_crop", - new TorchflowerCropBlock( - BlockBehaviour.Properties.of().mapColor(MapColor.PLANT).noCollission().randomTicks().instabreak().sound(SoundType.CROP).pushReaction(PushReaction.DESTROY) - ) + TorchflowerCropBlock::new, + BlockBehaviour.Properties.of().mapColor(MapColor.PLANT).noCollission().randomTicks().instabreak().sound(SoundType.CROP).pushReaction(PushReaction.DESTROY) ); public static final Block PITCHER_CROP = register( "pitcher_crop", - new PitcherCropBlock( - BlockBehaviour.Properties.of().mapColor(MapColor.PLANT).noCollission().randomTicks().instabreak().sound(SoundType.CROP).pushReaction(PushReaction.DESTROY) - ) + PitcherCropBlock::new, + BlockBehaviour.Properties.of().mapColor(MapColor.PLANT).noCollission().randomTicks().instabreak().sound(SoundType.CROP).pushReaction(PushReaction.DESTROY) ); public static final Block PITCHER_PLANT = register( "pitcher_plant", - new DoublePlantBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.PLANT) - .noCollission() - .instabreak() - .sound(SoundType.CROP) - .offsetType(BlockBehaviour.OffsetType.XZ) - .ignitedByLava() - .pushReaction(PushReaction.DESTROY) - ) + DoublePlantBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.PLANT) + .noCollission() + .instabreak() + .sound(SoundType.CROP) + .offsetType(BlockBehaviour.OffsetType.XZ) + .ignitedByLava() + .pushReaction(PushReaction.DESTROY) ); public static final Block BEETROOTS = register( "beetroots", - new BeetrootBlock( - BlockBehaviour.Properties.of().mapColor(MapColor.PLANT).noCollission().randomTicks().instabreak().sound(SoundType.CROP).pushReaction(PushReaction.DESTROY) - ) + BeetrootBlock::new, + BlockBehaviour.Properties.of().mapColor(MapColor.PLANT).noCollission().randomTicks().instabreak().sound(SoundType.CROP).pushReaction(PushReaction.DESTROY) ); public static final Block DIRT_PATH = register( "dirt_path", - new DirtPathBlock( - BlockBehaviour.Properties.of().mapColor(MapColor.DIRT).strength(0.65F).sound(SoundType.GRASS).isViewBlocking(Blocks::always).isSuffocating(Blocks::always) - ) + DirtPathBlock::new, + BlockBehaviour.Properties.of().mapColor(MapColor.DIRT).strength(0.65F).sound(SoundType.GRASS).isViewBlocking(Blocks::always).isSuffocating(Blocks::always) ); public static final Block END_GATEWAY = register( "end_gateway", - new EndGatewayBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.COLOR_BLACK) - .noCollission() - .lightLevel(blockStatex -> 15) - .strength(-1.0F, 3600000.0F) - .noLootTable() - .pushReaction(PushReaction.BLOCK) - ) + EndGatewayBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.COLOR_BLACK) + .noCollission() + .lightLevel(blockStatex -> 15) + .strength(-1.0F, 3600000.0F) + .noLootTable() + .pushReaction(PushReaction.BLOCK) ); public static final Block REPEATING_COMMAND_BLOCK = register( "repeating_command_block", - new CommandBlock( - false, BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_PURPLE).requiresCorrectToolForDrops().strength(-1.0F, 3600000.0F).noLootTable() - ) + properties -> new CommandBlock(false, properties), + BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_PURPLE).requiresCorrectToolForDrops().strength(-1.0F, 3600000.0F).noLootTable() ); public static final Block CHAIN_COMMAND_BLOCK = register( "chain_command_block", - new CommandBlock(true, BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_GREEN).requiresCorrectToolForDrops().strength(-1.0F, 3600000.0F).noLootTable()) + properties -> new CommandBlock(true, properties), + BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_GREEN).requiresCorrectToolForDrops().strength(-1.0F, 3600000.0F).noLootTable() ); public static final Block FROSTED_ICE = register( "frosted_ice", - new FrostedIceBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.ICE) - .friction(0.98F) - .strength(0.5F) - .sound(SoundType.GLASS) - .noOcclusion() - .isValidSpawn((blockStatex, blockGetter, blockPos, entityType) -> entityType == EntityType.POLAR_BEAR) - .isRedstoneConductor(Blocks::never) - ) + FrostedIceBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.ICE) + .friction(0.98F) + .strength(0.5F) + .sound(SoundType.GLASS) + .noOcclusion() + .isValidSpawn((blockStatex, blockGetter, blockPos, entityType) -> entityType == EntityType.POLAR_BEAR) + .isRedstoneConductor(Blocks::never) ); public static final Block MAGMA_BLOCK = register( "magma_block", - new MagmaBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.NETHER) - .instrument(NoteBlockInstrument.BASEDRUM) - .requiresCorrectToolForDrops() - .lightLevel(blockStatex -> 3) - .strength(0.5F) - .isValidSpawn((blockStatex, blockGetter, blockPos, entityType) -> entityType.fireImmune()) - .hasPostProcess(Blocks::always) - .emissiveRendering(Blocks::always) - ) + MagmaBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.NETHER) + .instrument(NoteBlockInstrument.BASEDRUM) + .requiresCorrectToolForDrops() + .lightLevel(blockStatex -> 3) + .strength(0.5F) + .isValidSpawn((blockStatex, blockGetter, blockPos, entityType) -> entityType.fireImmune()) + .hasPostProcess(Blocks::always) + .emissiveRendering(Blocks::always) ); public static final Block NETHER_WART_BLOCK = register( - "nether_wart_block", new Block(BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_RED).strength(1.0F).sound(SoundType.WART_BLOCK)) + "nether_wart_block", BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_RED).strength(1.0F).sound(SoundType.WART_BLOCK) ); public static final Block RED_NETHER_BRICKS = register( "red_nether_bricks", - new Block( - BlockBehaviour.Properties.of() - .mapColor(MapColor.NETHER) - .instrument(NoteBlockInstrument.BASEDRUM) - .requiresCorrectToolForDrops() - .strength(2.0F, 6.0F) - .sound(SoundType.NETHER_BRICKS) - ) + BlockBehaviour.Properties.of() + .mapColor(MapColor.NETHER) + .instrument(NoteBlockInstrument.BASEDRUM) + .requiresCorrectToolForDrops() + .strength(2.0F, 6.0F) + .sound(SoundType.NETHER_BRICKS) ); public static final Block BONE_BLOCK = register( "bone_block", - new RotatedPillarBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.SAND) - .instrument(NoteBlockInstrument.XYLOPHONE) - .requiresCorrectToolForDrops() - .strength(2.0F) - .sound(SoundType.BONE_BLOCK) - ) + RotatedPillarBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.SAND) + .instrument(NoteBlockInstrument.XYLOPHONE) + .requiresCorrectToolForDrops() + .strength(2.0F) + .sound(SoundType.BONE_BLOCK) ); public static final Block STRUCTURE_VOID = register( "structure_void", - new StructureVoidBlock(BlockBehaviour.Properties.of().replaceable().noCollission().noLootTable().noTerrainParticles().pushReaction(PushReaction.DESTROY)) + StructureVoidBlock::new, + BlockBehaviour.Properties.of().replaceable().noCollission().noLootTable().noTerrainParticles().pushReaction(PushReaction.DESTROY) ); public static final Block OBSERVER = register( "observer", - new ObserverBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.STONE) - .instrument(NoteBlockInstrument.BASEDRUM) - .strength(3.0F) - .requiresCorrectToolForDrops() - .isRedstoneConductor(Blocks::never) - ) + ObserverBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.STONE) + .instrument(NoteBlockInstrument.BASEDRUM) + .strength(3.0F) + .requiresCorrectToolForDrops() + .isRedstoneConductor(Blocks::never) + ); + public static final Block SHULKER_BOX = register( + "shulker_box", properties -> new ShulkerBoxBlock(null, properties), shulkerBoxProperties(MapColor.COLOR_PURPLE) + ); + public static final Block WHITE_SHULKER_BOX = register( + "white_shulker_box", properties -> new ShulkerBoxBlock(DyeColor.WHITE, properties), shulkerBoxProperties(MapColor.SNOW) + ); + public static final Block ORANGE_SHULKER_BOX = register( + "orange_shulker_box", properties -> new ShulkerBoxBlock(DyeColor.ORANGE, properties), shulkerBoxProperties(MapColor.COLOR_ORANGE) + ); + public static final Block MAGENTA_SHULKER_BOX = register( + "magenta_shulker_box", properties -> new ShulkerBoxBlock(DyeColor.MAGENTA, properties), shulkerBoxProperties(MapColor.COLOR_MAGENTA) + ); + public static final Block LIGHT_BLUE_SHULKER_BOX = register( + "light_blue_shulker_box", properties -> new ShulkerBoxBlock(DyeColor.LIGHT_BLUE, properties), shulkerBoxProperties(MapColor.COLOR_LIGHT_BLUE) + ); + public static final Block YELLOW_SHULKER_BOX = register( + "yellow_shulker_box", properties -> new ShulkerBoxBlock(DyeColor.YELLOW, properties), shulkerBoxProperties(MapColor.COLOR_YELLOW) + ); + public static final Block LIME_SHULKER_BOX = register( + "lime_shulker_box", properties -> new ShulkerBoxBlock(DyeColor.LIME, properties), shulkerBoxProperties(MapColor.COLOR_LIGHT_GREEN) + ); + public static final Block PINK_SHULKER_BOX = register( + "pink_shulker_box", properties -> new ShulkerBoxBlock(DyeColor.PINK, properties), shulkerBoxProperties(MapColor.COLOR_PINK) + ); + public static final Block GRAY_SHULKER_BOX = register( + "gray_shulker_box", properties -> new ShulkerBoxBlock(DyeColor.GRAY, properties), shulkerBoxProperties(MapColor.COLOR_GRAY) + ); + public static final Block LIGHT_GRAY_SHULKER_BOX = register( + "light_gray_shulker_box", properties -> new ShulkerBoxBlock(DyeColor.LIGHT_GRAY, properties), shulkerBoxProperties(MapColor.COLOR_LIGHT_GRAY) + ); + public static final Block CYAN_SHULKER_BOX = register( + "cyan_shulker_box", properties -> new ShulkerBoxBlock(DyeColor.CYAN, properties), shulkerBoxProperties(MapColor.COLOR_CYAN) + ); + public static final Block PURPLE_SHULKER_BOX = register( + "purple_shulker_box", properties -> new ShulkerBoxBlock(DyeColor.PURPLE, properties), shulkerBoxProperties(MapColor.TERRACOTTA_PURPLE) + ); + public static final Block BLUE_SHULKER_BOX = register( + "blue_shulker_box", properties -> new ShulkerBoxBlock(DyeColor.BLUE, properties), shulkerBoxProperties(MapColor.COLOR_BLUE) + ); + public static final Block BROWN_SHULKER_BOX = register( + "brown_shulker_box", properties -> new ShulkerBoxBlock(DyeColor.BROWN, properties), shulkerBoxProperties(MapColor.COLOR_BROWN) + ); + public static final Block GREEN_SHULKER_BOX = register( + "green_shulker_box", properties -> new ShulkerBoxBlock(DyeColor.GREEN, properties), shulkerBoxProperties(MapColor.COLOR_GREEN) + ); + public static final Block RED_SHULKER_BOX = register( + "red_shulker_box", properties -> new ShulkerBoxBlock(DyeColor.RED, properties), shulkerBoxProperties(MapColor.COLOR_RED) + ); + public static final Block BLACK_SHULKER_BOX = register( + "black_shulker_box", properties -> new ShulkerBoxBlock(DyeColor.BLACK, properties), shulkerBoxProperties(MapColor.COLOR_BLACK) ); - public static final Block SHULKER_BOX = register("shulker_box", shulkerBox(null, MapColor.COLOR_PURPLE)); - public static final Block WHITE_SHULKER_BOX = register("white_shulker_box", shulkerBox(DyeColor.WHITE, MapColor.SNOW)); - public static final Block ORANGE_SHULKER_BOX = register("orange_shulker_box", shulkerBox(DyeColor.ORANGE, MapColor.COLOR_ORANGE)); - public static final Block MAGENTA_SHULKER_BOX = register("magenta_shulker_box", shulkerBox(DyeColor.MAGENTA, MapColor.COLOR_MAGENTA)); - public static final Block LIGHT_BLUE_SHULKER_BOX = register("light_blue_shulker_box", shulkerBox(DyeColor.LIGHT_BLUE, MapColor.COLOR_LIGHT_BLUE)); - public static final Block YELLOW_SHULKER_BOX = register("yellow_shulker_box", shulkerBox(DyeColor.YELLOW, MapColor.COLOR_YELLOW)); - public static final Block LIME_SHULKER_BOX = register("lime_shulker_box", shulkerBox(DyeColor.LIME, MapColor.COLOR_LIGHT_GREEN)); - public static final Block PINK_SHULKER_BOX = register("pink_shulker_box", shulkerBox(DyeColor.PINK, MapColor.COLOR_PINK)); - public static final Block GRAY_SHULKER_BOX = register("gray_shulker_box", shulkerBox(DyeColor.GRAY, MapColor.COLOR_GRAY)); - public static final Block LIGHT_GRAY_SHULKER_BOX = register("light_gray_shulker_box", shulkerBox(DyeColor.LIGHT_GRAY, MapColor.COLOR_LIGHT_GRAY)); - public static final Block CYAN_SHULKER_BOX = register("cyan_shulker_box", shulkerBox(DyeColor.CYAN, MapColor.COLOR_CYAN)); - public static final Block PURPLE_SHULKER_BOX = register("purple_shulker_box", shulkerBox(DyeColor.PURPLE, MapColor.TERRACOTTA_PURPLE)); - public static final Block BLUE_SHULKER_BOX = register("blue_shulker_box", shulkerBox(DyeColor.BLUE, MapColor.COLOR_BLUE)); - public static final Block BROWN_SHULKER_BOX = register("brown_shulker_box", shulkerBox(DyeColor.BROWN, MapColor.COLOR_BROWN)); - public static final Block GREEN_SHULKER_BOX = register("green_shulker_box", shulkerBox(DyeColor.GREEN, MapColor.COLOR_GREEN)); - public static final Block RED_SHULKER_BOX = register("red_shulker_box", shulkerBox(DyeColor.RED, MapColor.COLOR_RED)); - public static final Block BLACK_SHULKER_BOX = register("black_shulker_box", shulkerBox(DyeColor.BLACK, MapColor.COLOR_BLACK)); public static final Block WHITE_GLAZED_TERRACOTTA = register( "white_glazed_terracotta", - new GlazedTerracottaBlock( - BlockBehaviour.Properties.of() - .mapColor(DyeColor.WHITE) - .instrument(NoteBlockInstrument.BASEDRUM) - .requiresCorrectToolForDrops() - .strength(1.4F) - .pushReaction(PushReaction.PUSH_ONLY) - ) + GlazedTerracottaBlock::new, + BlockBehaviour.Properties.of() + .mapColor(DyeColor.WHITE) + .instrument(NoteBlockInstrument.BASEDRUM) + .requiresCorrectToolForDrops() + .strength(1.4F) + .pushReaction(PushReaction.PUSH_ONLY) ); public static final Block ORANGE_GLAZED_TERRACOTTA = register( "orange_glazed_terracotta", - new GlazedTerracottaBlock( - BlockBehaviour.Properties.of() - .mapColor(DyeColor.ORANGE) - .instrument(NoteBlockInstrument.BASEDRUM) - .requiresCorrectToolForDrops() - .strength(1.4F) - .pushReaction(PushReaction.PUSH_ONLY) - ) + GlazedTerracottaBlock::new, + BlockBehaviour.Properties.of() + .mapColor(DyeColor.ORANGE) + .instrument(NoteBlockInstrument.BASEDRUM) + .requiresCorrectToolForDrops() + .strength(1.4F) + .pushReaction(PushReaction.PUSH_ONLY) ); public static final Block MAGENTA_GLAZED_TERRACOTTA = register( "magenta_glazed_terracotta", - new GlazedTerracottaBlock( - BlockBehaviour.Properties.of() - .mapColor(DyeColor.MAGENTA) - .instrument(NoteBlockInstrument.BASEDRUM) - .requiresCorrectToolForDrops() - .strength(1.4F) - .pushReaction(PushReaction.PUSH_ONLY) - ) + GlazedTerracottaBlock::new, + BlockBehaviour.Properties.of() + .mapColor(DyeColor.MAGENTA) + .instrument(NoteBlockInstrument.BASEDRUM) + .requiresCorrectToolForDrops() + .strength(1.4F) + .pushReaction(PushReaction.PUSH_ONLY) ); public static final Block LIGHT_BLUE_GLAZED_TERRACOTTA = register( "light_blue_glazed_terracotta", - new GlazedTerracottaBlock( - BlockBehaviour.Properties.of() - .mapColor(DyeColor.LIGHT_BLUE) - .instrument(NoteBlockInstrument.BASEDRUM) - .requiresCorrectToolForDrops() - .strength(1.4F) - .pushReaction(PushReaction.PUSH_ONLY) - ) + GlazedTerracottaBlock::new, + BlockBehaviour.Properties.of() + .mapColor(DyeColor.LIGHT_BLUE) + .instrument(NoteBlockInstrument.BASEDRUM) + .requiresCorrectToolForDrops() + .strength(1.4F) + .pushReaction(PushReaction.PUSH_ONLY) ); public static final Block YELLOW_GLAZED_TERRACOTTA = register( "yellow_glazed_terracotta", - new GlazedTerracottaBlock( - BlockBehaviour.Properties.of() - .mapColor(DyeColor.YELLOW) - .instrument(NoteBlockInstrument.BASEDRUM) - .requiresCorrectToolForDrops() - .strength(1.4F) - .pushReaction(PushReaction.PUSH_ONLY) - ) + GlazedTerracottaBlock::new, + BlockBehaviour.Properties.of() + .mapColor(DyeColor.YELLOW) + .instrument(NoteBlockInstrument.BASEDRUM) + .requiresCorrectToolForDrops() + .strength(1.4F) + .pushReaction(PushReaction.PUSH_ONLY) ); public static final Block LIME_GLAZED_TERRACOTTA = register( "lime_glazed_terracotta", - new GlazedTerracottaBlock( - BlockBehaviour.Properties.of() - .mapColor(DyeColor.LIME) - .instrument(NoteBlockInstrument.BASEDRUM) - .requiresCorrectToolForDrops() - .strength(1.4F) - .pushReaction(PushReaction.PUSH_ONLY) - ) + GlazedTerracottaBlock::new, + BlockBehaviour.Properties.of() + .mapColor(DyeColor.LIME) + .instrument(NoteBlockInstrument.BASEDRUM) + .requiresCorrectToolForDrops() + .strength(1.4F) + .pushReaction(PushReaction.PUSH_ONLY) ); public static final Block PINK_GLAZED_TERRACOTTA = register( "pink_glazed_terracotta", - new GlazedTerracottaBlock( - BlockBehaviour.Properties.of() - .mapColor(DyeColor.PINK) - .instrument(NoteBlockInstrument.BASEDRUM) - .requiresCorrectToolForDrops() - .strength(1.4F) - .pushReaction(PushReaction.PUSH_ONLY) - ) + GlazedTerracottaBlock::new, + BlockBehaviour.Properties.of() + .mapColor(DyeColor.PINK) + .instrument(NoteBlockInstrument.BASEDRUM) + .requiresCorrectToolForDrops() + .strength(1.4F) + .pushReaction(PushReaction.PUSH_ONLY) ); public static final Block GRAY_GLAZED_TERRACOTTA = register( "gray_glazed_terracotta", - new GlazedTerracottaBlock( - BlockBehaviour.Properties.of() - .mapColor(DyeColor.GRAY) - .instrument(NoteBlockInstrument.BASEDRUM) - .requiresCorrectToolForDrops() - .strength(1.4F) - .pushReaction(PushReaction.PUSH_ONLY) - ) + GlazedTerracottaBlock::new, + BlockBehaviour.Properties.of() + .mapColor(DyeColor.GRAY) + .instrument(NoteBlockInstrument.BASEDRUM) + .requiresCorrectToolForDrops() + .strength(1.4F) + .pushReaction(PushReaction.PUSH_ONLY) ); public static final Block LIGHT_GRAY_GLAZED_TERRACOTTA = register( "light_gray_glazed_terracotta", - new GlazedTerracottaBlock( - BlockBehaviour.Properties.of() - .mapColor(DyeColor.LIGHT_GRAY) - .instrument(NoteBlockInstrument.BASEDRUM) - .requiresCorrectToolForDrops() - .strength(1.4F) - .pushReaction(PushReaction.PUSH_ONLY) - ) + GlazedTerracottaBlock::new, + BlockBehaviour.Properties.of() + .mapColor(DyeColor.LIGHT_GRAY) + .instrument(NoteBlockInstrument.BASEDRUM) + .requiresCorrectToolForDrops() + .strength(1.4F) + .pushReaction(PushReaction.PUSH_ONLY) ); public static final Block CYAN_GLAZED_TERRACOTTA = register( "cyan_glazed_terracotta", - new GlazedTerracottaBlock( - BlockBehaviour.Properties.of() - .mapColor(DyeColor.CYAN) - .instrument(NoteBlockInstrument.BASEDRUM) - .requiresCorrectToolForDrops() - .strength(1.4F) - .pushReaction(PushReaction.PUSH_ONLY) - ) + GlazedTerracottaBlock::new, + BlockBehaviour.Properties.of() + .mapColor(DyeColor.CYAN) + .instrument(NoteBlockInstrument.BASEDRUM) + .requiresCorrectToolForDrops() + .strength(1.4F) + .pushReaction(PushReaction.PUSH_ONLY) ); public static final Block PURPLE_GLAZED_TERRACOTTA = register( "purple_glazed_terracotta", - new GlazedTerracottaBlock( - BlockBehaviour.Properties.of() - .mapColor(DyeColor.PURPLE) - .instrument(NoteBlockInstrument.BASEDRUM) - .requiresCorrectToolForDrops() - .strength(1.4F) - .pushReaction(PushReaction.PUSH_ONLY) - ) + GlazedTerracottaBlock::new, + BlockBehaviour.Properties.of() + .mapColor(DyeColor.PURPLE) + .instrument(NoteBlockInstrument.BASEDRUM) + .requiresCorrectToolForDrops() + .strength(1.4F) + .pushReaction(PushReaction.PUSH_ONLY) ); public static final Block BLUE_GLAZED_TERRACOTTA = register( "blue_glazed_terracotta", - new GlazedTerracottaBlock( - BlockBehaviour.Properties.of() - .mapColor(DyeColor.BLUE) - .instrument(NoteBlockInstrument.BASEDRUM) - .requiresCorrectToolForDrops() - .strength(1.4F) - .pushReaction(PushReaction.PUSH_ONLY) - ) + GlazedTerracottaBlock::new, + BlockBehaviour.Properties.of() + .mapColor(DyeColor.BLUE) + .instrument(NoteBlockInstrument.BASEDRUM) + .requiresCorrectToolForDrops() + .strength(1.4F) + .pushReaction(PushReaction.PUSH_ONLY) ); public static final Block BROWN_GLAZED_TERRACOTTA = register( "brown_glazed_terracotta", - new GlazedTerracottaBlock( - BlockBehaviour.Properties.of() - .mapColor(DyeColor.BROWN) - .instrument(NoteBlockInstrument.BASEDRUM) - .requiresCorrectToolForDrops() - .strength(1.4F) - .pushReaction(PushReaction.PUSH_ONLY) - ) + GlazedTerracottaBlock::new, + BlockBehaviour.Properties.of() + .mapColor(DyeColor.BROWN) + .instrument(NoteBlockInstrument.BASEDRUM) + .requiresCorrectToolForDrops() + .strength(1.4F) + .pushReaction(PushReaction.PUSH_ONLY) ); public static final Block GREEN_GLAZED_TERRACOTTA = register( "green_glazed_terracotta", - new GlazedTerracottaBlock( - BlockBehaviour.Properties.of() - .mapColor(DyeColor.GREEN) - .instrument(NoteBlockInstrument.BASEDRUM) - .requiresCorrectToolForDrops() - .strength(1.4F) - .pushReaction(PushReaction.PUSH_ONLY) - ) + GlazedTerracottaBlock::new, + BlockBehaviour.Properties.of() + .mapColor(DyeColor.GREEN) + .instrument(NoteBlockInstrument.BASEDRUM) + .requiresCorrectToolForDrops() + .strength(1.4F) + .pushReaction(PushReaction.PUSH_ONLY) ); public static final Block RED_GLAZED_TERRACOTTA = register( "red_glazed_terracotta", - new GlazedTerracottaBlock( - BlockBehaviour.Properties.of() - .mapColor(DyeColor.RED) - .instrument(NoteBlockInstrument.BASEDRUM) - .requiresCorrectToolForDrops() - .strength(1.4F) - .pushReaction(PushReaction.PUSH_ONLY) - ) + GlazedTerracottaBlock::new, + BlockBehaviour.Properties.of() + .mapColor(DyeColor.RED) + .instrument(NoteBlockInstrument.BASEDRUM) + .requiresCorrectToolForDrops() + .strength(1.4F) + .pushReaction(PushReaction.PUSH_ONLY) ); public static final Block BLACK_GLAZED_TERRACOTTA = register( "black_glazed_terracotta", - new GlazedTerracottaBlock( - BlockBehaviour.Properties.of() - .mapColor(DyeColor.BLACK) - .instrument(NoteBlockInstrument.BASEDRUM) - .requiresCorrectToolForDrops() - .strength(1.4F) - .pushReaction(PushReaction.PUSH_ONLY) - ) + GlazedTerracottaBlock::new, + BlockBehaviour.Properties.of() + .mapColor(DyeColor.BLACK) + .instrument(NoteBlockInstrument.BASEDRUM) + .requiresCorrectToolForDrops() + .strength(1.4F) + .pushReaction(PushReaction.PUSH_ONLY) ); public static final Block WHITE_CONCRETE = register( "white_concrete", - new Block(BlockBehaviour.Properties.of().mapColor(DyeColor.WHITE).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(1.8F)) + BlockBehaviour.Properties.of().mapColor(DyeColor.WHITE).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(1.8F) ); public static final Block ORANGE_CONCRETE = register( "orange_concrete", - new Block(BlockBehaviour.Properties.of().mapColor(DyeColor.ORANGE).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(1.8F)) + BlockBehaviour.Properties.of().mapColor(DyeColor.ORANGE).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(1.8F) ); public static final Block MAGENTA_CONCRETE = register( "magenta_concrete", - new Block(BlockBehaviour.Properties.of().mapColor(DyeColor.MAGENTA).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(1.8F)) + BlockBehaviour.Properties.of().mapColor(DyeColor.MAGENTA).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(1.8F) ); public static final Block LIGHT_BLUE_CONCRETE = register( "light_blue_concrete", - new Block(BlockBehaviour.Properties.of().mapColor(DyeColor.LIGHT_BLUE).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(1.8F)) + BlockBehaviour.Properties.of().mapColor(DyeColor.LIGHT_BLUE).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(1.8F) ); public static final Block YELLOW_CONCRETE = register( "yellow_concrete", - new Block(BlockBehaviour.Properties.of().mapColor(DyeColor.YELLOW).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(1.8F)) + BlockBehaviour.Properties.of().mapColor(DyeColor.YELLOW).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(1.8F) ); public static final Block LIME_CONCRETE = register( - "lime_concrete", - new Block(BlockBehaviour.Properties.of().mapColor(DyeColor.LIME).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(1.8F)) + "lime_concrete", BlockBehaviour.Properties.of().mapColor(DyeColor.LIME).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(1.8F) ); public static final Block PINK_CONCRETE = register( - "pink_concrete", - new Block(BlockBehaviour.Properties.of().mapColor(DyeColor.PINK).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(1.8F)) + "pink_concrete", BlockBehaviour.Properties.of().mapColor(DyeColor.PINK).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(1.8F) ); public static final Block GRAY_CONCRETE = register( - "gray_concrete", - new Block(BlockBehaviour.Properties.of().mapColor(DyeColor.GRAY).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(1.8F)) + "gray_concrete", BlockBehaviour.Properties.of().mapColor(DyeColor.GRAY).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(1.8F) ); public static final Block LIGHT_GRAY_CONCRETE = register( "light_gray_concrete", - new Block(BlockBehaviour.Properties.of().mapColor(DyeColor.LIGHT_GRAY).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(1.8F)) + BlockBehaviour.Properties.of().mapColor(DyeColor.LIGHT_GRAY).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(1.8F) ); public static final Block CYAN_CONCRETE = register( - "cyan_concrete", - new Block(BlockBehaviour.Properties.of().mapColor(DyeColor.CYAN).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(1.8F)) + "cyan_concrete", BlockBehaviour.Properties.of().mapColor(DyeColor.CYAN).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(1.8F) ); public static final Block PURPLE_CONCRETE = register( "purple_concrete", - new Block(BlockBehaviour.Properties.of().mapColor(DyeColor.PURPLE).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(1.8F)) + BlockBehaviour.Properties.of().mapColor(DyeColor.PURPLE).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(1.8F) ); public static final Block BLUE_CONCRETE = register( - "blue_concrete", - new Block(BlockBehaviour.Properties.of().mapColor(DyeColor.BLUE).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(1.8F)) + "blue_concrete", BlockBehaviour.Properties.of().mapColor(DyeColor.BLUE).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(1.8F) ); public static final Block BROWN_CONCRETE = register( "brown_concrete", - new Block(BlockBehaviour.Properties.of().mapColor(DyeColor.BROWN).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(1.8F)) + BlockBehaviour.Properties.of().mapColor(DyeColor.BROWN).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(1.8F) ); public static final Block GREEN_CONCRETE = register( "green_concrete", - new Block(BlockBehaviour.Properties.of().mapColor(DyeColor.GREEN).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(1.8F)) + BlockBehaviour.Properties.of().mapColor(DyeColor.GREEN).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(1.8F) ); public static final Block RED_CONCRETE = register( - "red_concrete", - new Block(BlockBehaviour.Properties.of().mapColor(DyeColor.RED).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(1.8F)) + "red_concrete", BlockBehaviour.Properties.of().mapColor(DyeColor.RED).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(1.8F) ); public static final Block BLACK_CONCRETE = register( "black_concrete", - new Block(BlockBehaviour.Properties.of().mapColor(DyeColor.BLACK).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(1.8F)) + BlockBehaviour.Properties.of().mapColor(DyeColor.BLACK).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(1.8F) ); public static final Block WHITE_CONCRETE_POWDER = register( "white_concrete_powder", - new ConcretePowderBlock( - WHITE_CONCRETE, BlockBehaviour.Properties.of().mapColor(DyeColor.WHITE).instrument(NoteBlockInstrument.SNARE).strength(0.5F).sound(SoundType.SAND) - ) + properties -> new ConcretePowderBlock(WHITE_CONCRETE, properties), + BlockBehaviour.Properties.of().mapColor(DyeColor.WHITE).instrument(NoteBlockInstrument.SNARE).strength(0.5F).sound(SoundType.SAND) ); public static final Block ORANGE_CONCRETE_POWDER = register( "orange_concrete_powder", - new ConcretePowderBlock( - ORANGE_CONCRETE, BlockBehaviour.Properties.of().mapColor(DyeColor.ORANGE).instrument(NoteBlockInstrument.SNARE).strength(0.5F).sound(SoundType.SAND) - ) + properties -> new ConcretePowderBlock(ORANGE_CONCRETE, properties), + BlockBehaviour.Properties.of().mapColor(DyeColor.ORANGE).instrument(NoteBlockInstrument.SNARE).strength(0.5F).sound(SoundType.SAND) ); public static final Block MAGENTA_CONCRETE_POWDER = register( "magenta_concrete_powder", - new ConcretePowderBlock( - MAGENTA_CONCRETE, BlockBehaviour.Properties.of().mapColor(DyeColor.MAGENTA).instrument(NoteBlockInstrument.SNARE).strength(0.5F).sound(SoundType.SAND) - ) + properties -> new ConcretePowderBlock(MAGENTA_CONCRETE, properties), + BlockBehaviour.Properties.of().mapColor(DyeColor.MAGENTA).instrument(NoteBlockInstrument.SNARE).strength(0.5F).sound(SoundType.SAND) ); public static final Block LIGHT_BLUE_CONCRETE_POWDER = register( "light_blue_concrete_powder", - new ConcretePowderBlock( - LIGHT_BLUE_CONCRETE, BlockBehaviour.Properties.of().mapColor(DyeColor.LIGHT_BLUE).instrument(NoteBlockInstrument.SNARE).strength(0.5F).sound(SoundType.SAND) - ) + properties -> new ConcretePowderBlock(LIGHT_BLUE_CONCRETE, properties), + BlockBehaviour.Properties.of().mapColor(DyeColor.LIGHT_BLUE).instrument(NoteBlockInstrument.SNARE).strength(0.5F).sound(SoundType.SAND) ); public static final Block YELLOW_CONCRETE_POWDER = register( "yellow_concrete_powder", - new ConcretePowderBlock( - YELLOW_CONCRETE, BlockBehaviour.Properties.of().mapColor(DyeColor.YELLOW).instrument(NoteBlockInstrument.SNARE).strength(0.5F).sound(SoundType.SAND) - ) + properties -> new ConcretePowderBlock(YELLOW_CONCRETE, properties), + BlockBehaviour.Properties.of().mapColor(DyeColor.YELLOW).instrument(NoteBlockInstrument.SNARE).strength(0.5F).sound(SoundType.SAND) ); public static final Block LIME_CONCRETE_POWDER = register( "lime_concrete_powder", - new ConcretePowderBlock( - LIME_CONCRETE, BlockBehaviour.Properties.of().mapColor(DyeColor.LIME).instrument(NoteBlockInstrument.SNARE).strength(0.5F).sound(SoundType.SAND) - ) + properties -> new ConcretePowderBlock(LIME_CONCRETE, properties), + BlockBehaviour.Properties.of().mapColor(DyeColor.LIME).instrument(NoteBlockInstrument.SNARE).strength(0.5F).sound(SoundType.SAND) ); public static final Block PINK_CONCRETE_POWDER = register( "pink_concrete_powder", - new ConcretePowderBlock( - PINK_CONCRETE, BlockBehaviour.Properties.of().mapColor(DyeColor.PINK).instrument(NoteBlockInstrument.SNARE).strength(0.5F).sound(SoundType.SAND) - ) + properties -> new ConcretePowderBlock(PINK_CONCRETE, properties), + BlockBehaviour.Properties.of().mapColor(DyeColor.PINK).instrument(NoteBlockInstrument.SNARE).strength(0.5F).sound(SoundType.SAND) ); public static final Block GRAY_CONCRETE_POWDER = register( "gray_concrete_powder", - new ConcretePowderBlock( - GRAY_CONCRETE, BlockBehaviour.Properties.of().mapColor(DyeColor.GRAY).instrument(NoteBlockInstrument.SNARE).strength(0.5F).sound(SoundType.SAND) - ) + properties -> new ConcretePowderBlock(GRAY_CONCRETE, properties), + BlockBehaviour.Properties.of().mapColor(DyeColor.GRAY).instrument(NoteBlockInstrument.SNARE).strength(0.5F).sound(SoundType.SAND) ); public static final Block LIGHT_GRAY_CONCRETE_POWDER = register( "light_gray_concrete_powder", - new ConcretePowderBlock( - LIGHT_GRAY_CONCRETE, BlockBehaviour.Properties.of().mapColor(DyeColor.LIGHT_GRAY).instrument(NoteBlockInstrument.SNARE).strength(0.5F).sound(SoundType.SAND) - ) + properties -> new ConcretePowderBlock(LIGHT_GRAY_CONCRETE, properties), + BlockBehaviour.Properties.of().mapColor(DyeColor.LIGHT_GRAY).instrument(NoteBlockInstrument.SNARE).strength(0.5F).sound(SoundType.SAND) ); public static final Block CYAN_CONCRETE_POWDER = register( "cyan_concrete_powder", - new ConcretePowderBlock( - CYAN_CONCRETE, BlockBehaviour.Properties.of().mapColor(DyeColor.CYAN).instrument(NoteBlockInstrument.SNARE).strength(0.5F).sound(SoundType.SAND) - ) + properties -> new ConcretePowderBlock(CYAN_CONCRETE, properties), + BlockBehaviour.Properties.of().mapColor(DyeColor.CYAN).instrument(NoteBlockInstrument.SNARE).strength(0.5F).sound(SoundType.SAND) ); public static final Block PURPLE_CONCRETE_POWDER = register( "purple_concrete_powder", - new ConcretePowderBlock( - PURPLE_CONCRETE, BlockBehaviour.Properties.of().mapColor(DyeColor.PURPLE).instrument(NoteBlockInstrument.SNARE).strength(0.5F).sound(SoundType.SAND) - ) + properties -> new ConcretePowderBlock(PURPLE_CONCRETE, properties), + BlockBehaviour.Properties.of().mapColor(DyeColor.PURPLE).instrument(NoteBlockInstrument.SNARE).strength(0.5F).sound(SoundType.SAND) ); public static final Block BLUE_CONCRETE_POWDER = register( "blue_concrete_powder", - new ConcretePowderBlock( - BLUE_CONCRETE, BlockBehaviour.Properties.of().mapColor(DyeColor.BLUE).instrument(NoteBlockInstrument.SNARE).strength(0.5F).sound(SoundType.SAND) - ) + properties -> new ConcretePowderBlock(BLUE_CONCRETE, properties), + BlockBehaviour.Properties.of().mapColor(DyeColor.BLUE).instrument(NoteBlockInstrument.SNARE).strength(0.5F).sound(SoundType.SAND) ); public static final Block BROWN_CONCRETE_POWDER = register( "brown_concrete_powder", - new ConcretePowderBlock( - BROWN_CONCRETE, BlockBehaviour.Properties.of().mapColor(DyeColor.BROWN).instrument(NoteBlockInstrument.SNARE).strength(0.5F).sound(SoundType.SAND) - ) + properties -> new ConcretePowderBlock(BROWN_CONCRETE, properties), + BlockBehaviour.Properties.of().mapColor(DyeColor.BROWN).instrument(NoteBlockInstrument.SNARE).strength(0.5F).sound(SoundType.SAND) ); public static final Block GREEN_CONCRETE_POWDER = register( "green_concrete_powder", - new ConcretePowderBlock( - GREEN_CONCRETE, BlockBehaviour.Properties.of().mapColor(DyeColor.GREEN).instrument(NoteBlockInstrument.SNARE).strength(0.5F).sound(SoundType.SAND) - ) + properties -> new ConcretePowderBlock(GREEN_CONCRETE, properties), + BlockBehaviour.Properties.of().mapColor(DyeColor.GREEN).instrument(NoteBlockInstrument.SNARE).strength(0.5F).sound(SoundType.SAND) ); public static final Block RED_CONCRETE_POWDER = register( "red_concrete_powder", - new ConcretePowderBlock( - RED_CONCRETE, BlockBehaviour.Properties.of().mapColor(DyeColor.RED).instrument(NoteBlockInstrument.SNARE).strength(0.5F).sound(SoundType.SAND) - ) + properties -> new ConcretePowderBlock(RED_CONCRETE, properties), + BlockBehaviour.Properties.of().mapColor(DyeColor.RED).instrument(NoteBlockInstrument.SNARE).strength(0.5F).sound(SoundType.SAND) ); public static final Block BLACK_CONCRETE_POWDER = register( "black_concrete_powder", - new ConcretePowderBlock( - BLACK_CONCRETE, BlockBehaviour.Properties.of().mapColor(DyeColor.BLACK).instrument(NoteBlockInstrument.SNARE).strength(0.5F).sound(SoundType.SAND) - ) + properties -> new ConcretePowderBlock(BLACK_CONCRETE, properties), + BlockBehaviour.Properties.of().mapColor(DyeColor.BLACK).instrument(NoteBlockInstrument.SNARE).strength(0.5F).sound(SoundType.SAND) ); public static final Block KELP = register( "kelp", - new KelpBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.WATER) - .noCollission() - .randomTicks() - .instabreak() - .sound(SoundType.WET_GRASS) - .pushReaction(PushReaction.DESTROY) - ) + KelpBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.WATER) + .noCollission() + .randomTicks() + .instabreak() + .sound(SoundType.WET_GRASS) + .pushReaction(PushReaction.DESTROY) ); public static final Block KELP_PLANT = register( "kelp_plant", - new KelpPlantBlock( - BlockBehaviour.Properties.of().mapColor(MapColor.WATER).noCollission().instabreak().sound(SoundType.WET_GRASS).pushReaction(PushReaction.DESTROY) - ) + KelpPlantBlock::new, + BlockBehaviour.Properties.of().mapColor(MapColor.WATER).noCollission().instabreak().sound(SoundType.WET_GRASS).pushReaction(PushReaction.DESTROY) ); public static final Block DRIED_KELP_BLOCK = register( - "dried_kelp_block", new Block(BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_GREEN).strength(0.5F, 2.5F).sound(SoundType.GRASS)) + "dried_kelp_block", BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_GREEN).strength(0.5F, 2.5F).sound(SoundType.GRASS) ); public static final Block TURTLE_EGG = register( "turtle_egg", - new TurtleEggBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.SAND) - .forceSolidOn() - .strength(0.5F) - .sound(SoundType.METAL) - .randomTicks() - .noOcclusion() - .pushReaction(PushReaction.DESTROY) - ) + TurtleEggBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.SAND) + .forceSolidOn() + .strength(0.5F) + .sound(SoundType.METAL) + .randomTicks() + .noOcclusion() + .pushReaction(PushReaction.DESTROY) ); public static final Block SNIFFER_EGG = register( - "sniffer_egg", new SnifferEggBlock(BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_RED).strength(0.5F).sound(SoundType.METAL).noOcclusion()) + "sniffer_egg", SnifferEggBlock::new, BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_RED).strength(0.5F).sound(SoundType.METAL).noOcclusion() ); public static final Block DEAD_TUBE_CORAL_BLOCK = register( "dead_tube_coral_block", - new Block( - BlockBehaviour.Properties.of() - .mapColor(MapColor.COLOR_GRAY) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASEDRUM) - .requiresCorrectToolForDrops() - .strength(1.5F, 6.0F) - ) + BlockBehaviour.Properties.of() + .mapColor(MapColor.COLOR_GRAY) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASEDRUM) + .requiresCorrectToolForDrops() + .strength(1.5F, 6.0F) ); public static final Block DEAD_BRAIN_CORAL_BLOCK = register( "dead_brain_coral_block", - new Block( - BlockBehaviour.Properties.of() - .mapColor(MapColor.COLOR_GRAY) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASEDRUM) - .requiresCorrectToolForDrops() - .strength(1.5F, 6.0F) - ) + BlockBehaviour.Properties.of() + .mapColor(MapColor.COLOR_GRAY) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASEDRUM) + .requiresCorrectToolForDrops() + .strength(1.5F, 6.0F) ); public static final Block DEAD_BUBBLE_CORAL_BLOCK = register( "dead_bubble_coral_block", - new Block( - BlockBehaviour.Properties.of() - .mapColor(MapColor.COLOR_GRAY) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASEDRUM) - .requiresCorrectToolForDrops() - .strength(1.5F, 6.0F) - ) + BlockBehaviour.Properties.of() + .mapColor(MapColor.COLOR_GRAY) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASEDRUM) + .requiresCorrectToolForDrops() + .strength(1.5F, 6.0F) ); public static final Block DEAD_FIRE_CORAL_BLOCK = register( "dead_fire_coral_block", - new Block( - BlockBehaviour.Properties.of() - .mapColor(MapColor.COLOR_GRAY) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASEDRUM) - .requiresCorrectToolForDrops() - .strength(1.5F, 6.0F) - ) + BlockBehaviour.Properties.of() + .mapColor(MapColor.COLOR_GRAY) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASEDRUM) + .requiresCorrectToolForDrops() + .strength(1.5F, 6.0F) ); public static final Block DEAD_HORN_CORAL_BLOCK = register( "dead_horn_coral_block", - new Block( - BlockBehaviour.Properties.of() - .mapColor(MapColor.COLOR_GRAY) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASEDRUM) - .requiresCorrectToolForDrops() - .strength(1.5F, 6.0F) - ) + BlockBehaviour.Properties.of() + .mapColor(MapColor.COLOR_GRAY) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASEDRUM) + .requiresCorrectToolForDrops() + .strength(1.5F, 6.0F) ); public static final Block TUBE_CORAL_BLOCK = register( "tube_coral_block", - new CoralBlock( - DEAD_TUBE_CORAL_BLOCK, - BlockBehaviour.Properties.of() - .mapColor(MapColor.COLOR_BLUE) - .instrument(NoteBlockInstrument.BASEDRUM) - .requiresCorrectToolForDrops() - .strength(1.5F, 6.0F) - .sound(SoundType.CORAL_BLOCK) - ) + properties -> new CoralBlock(DEAD_TUBE_CORAL_BLOCK, properties), + BlockBehaviour.Properties.of() + .mapColor(MapColor.COLOR_BLUE) + .instrument(NoteBlockInstrument.BASEDRUM) + .requiresCorrectToolForDrops() + .strength(1.5F, 6.0F) + .sound(SoundType.CORAL_BLOCK) ); public static final Block BRAIN_CORAL_BLOCK = register( "brain_coral_block", - new CoralBlock( - DEAD_BRAIN_CORAL_BLOCK, - BlockBehaviour.Properties.of() - .mapColor(MapColor.COLOR_PINK) - .instrument(NoteBlockInstrument.BASEDRUM) - .requiresCorrectToolForDrops() - .strength(1.5F, 6.0F) - .sound(SoundType.CORAL_BLOCK) - ) + properties -> new CoralBlock(DEAD_BRAIN_CORAL_BLOCK, properties), + BlockBehaviour.Properties.of() + .mapColor(MapColor.COLOR_PINK) + .instrument(NoteBlockInstrument.BASEDRUM) + .requiresCorrectToolForDrops() + .strength(1.5F, 6.0F) + .sound(SoundType.CORAL_BLOCK) ); public static final Block BUBBLE_CORAL_BLOCK = register( "bubble_coral_block", - new CoralBlock( - DEAD_BUBBLE_CORAL_BLOCK, - BlockBehaviour.Properties.of() - .mapColor(MapColor.COLOR_PURPLE) - .instrument(NoteBlockInstrument.BASEDRUM) - .requiresCorrectToolForDrops() - .strength(1.5F, 6.0F) - .sound(SoundType.CORAL_BLOCK) - ) + properties -> new CoralBlock(DEAD_BUBBLE_CORAL_BLOCK, properties), + BlockBehaviour.Properties.of() + .mapColor(MapColor.COLOR_PURPLE) + .instrument(NoteBlockInstrument.BASEDRUM) + .requiresCorrectToolForDrops() + .strength(1.5F, 6.0F) + .sound(SoundType.CORAL_BLOCK) ); public static final Block FIRE_CORAL_BLOCK = register( "fire_coral_block", - new CoralBlock( - DEAD_FIRE_CORAL_BLOCK, - BlockBehaviour.Properties.of() - .mapColor(MapColor.COLOR_RED) - .instrument(NoteBlockInstrument.BASEDRUM) - .requiresCorrectToolForDrops() - .strength(1.5F, 6.0F) - .sound(SoundType.CORAL_BLOCK) - ) + properties -> new CoralBlock(DEAD_FIRE_CORAL_BLOCK, properties), + BlockBehaviour.Properties.of() + .mapColor(MapColor.COLOR_RED) + .instrument(NoteBlockInstrument.BASEDRUM) + .requiresCorrectToolForDrops() + .strength(1.5F, 6.0F) + .sound(SoundType.CORAL_BLOCK) ); public static final Block HORN_CORAL_BLOCK = register( "horn_coral_block", - new CoralBlock( - DEAD_HORN_CORAL_BLOCK, - BlockBehaviour.Properties.of() - .mapColor(MapColor.COLOR_YELLOW) - .instrument(NoteBlockInstrument.BASEDRUM) - .requiresCorrectToolForDrops() - .strength(1.5F, 6.0F) - .sound(SoundType.CORAL_BLOCK) - ) + properties -> new CoralBlock(DEAD_HORN_CORAL_BLOCK, properties), + BlockBehaviour.Properties.of() + .mapColor(MapColor.COLOR_YELLOW) + .instrument(NoteBlockInstrument.BASEDRUM) + .requiresCorrectToolForDrops() + .strength(1.5F, 6.0F) + .sound(SoundType.CORAL_BLOCK) ); public static final Block DEAD_TUBE_CORAL = register( "dead_tube_coral", - new BaseCoralPlantBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.COLOR_GRAY) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASEDRUM) - .requiresCorrectToolForDrops() - .noCollission() - .instabreak() - ) + BaseCoralPlantBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.COLOR_GRAY) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASEDRUM) + .requiresCorrectToolForDrops() + .noCollission() + .instabreak() ); public static final Block DEAD_BRAIN_CORAL = register( "dead_brain_coral", - new BaseCoralPlantBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.COLOR_GRAY) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASEDRUM) - .requiresCorrectToolForDrops() - .noCollission() - .instabreak() - ) + BaseCoralPlantBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.COLOR_GRAY) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASEDRUM) + .requiresCorrectToolForDrops() + .noCollission() + .instabreak() ); public static final Block DEAD_BUBBLE_CORAL = register( "dead_bubble_coral", - new BaseCoralPlantBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.COLOR_GRAY) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASEDRUM) - .requiresCorrectToolForDrops() - .noCollission() - .instabreak() - ) + BaseCoralPlantBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.COLOR_GRAY) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASEDRUM) + .requiresCorrectToolForDrops() + .noCollission() + .instabreak() ); public static final Block DEAD_FIRE_CORAL = register( "dead_fire_coral", - new BaseCoralPlantBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.COLOR_GRAY) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASEDRUM) - .requiresCorrectToolForDrops() - .noCollission() - .instabreak() - ) + BaseCoralPlantBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.COLOR_GRAY) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASEDRUM) + .requiresCorrectToolForDrops() + .noCollission() + .instabreak() ); public static final Block DEAD_HORN_CORAL = register( "dead_horn_coral", - new BaseCoralPlantBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.COLOR_GRAY) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASEDRUM) - .requiresCorrectToolForDrops() - .noCollission() - .instabreak() - ) + BaseCoralPlantBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.COLOR_GRAY) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASEDRUM) + .requiresCorrectToolForDrops() + .noCollission() + .instabreak() ); public static final Block TUBE_CORAL = register( "tube_coral", - new CoralPlantBlock( - DEAD_TUBE_CORAL, - BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_BLUE).noCollission().instabreak().sound(SoundType.WET_GRASS).pushReaction(PushReaction.DESTROY) - ) + properties -> new CoralPlantBlock(DEAD_TUBE_CORAL, properties), + BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_BLUE).noCollission().instabreak().sound(SoundType.WET_GRASS).pushReaction(PushReaction.DESTROY) ); public static final Block BRAIN_CORAL = register( "brain_coral", - new CoralPlantBlock( - DEAD_BRAIN_CORAL, - BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_PINK).noCollission().instabreak().sound(SoundType.WET_GRASS).pushReaction(PushReaction.DESTROY) - ) + properties -> new CoralPlantBlock(DEAD_BRAIN_CORAL, properties), + BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_PINK).noCollission().instabreak().sound(SoundType.WET_GRASS).pushReaction(PushReaction.DESTROY) ); public static final Block BUBBLE_CORAL = register( "bubble_coral", - new CoralPlantBlock( - DEAD_BUBBLE_CORAL, - BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_PURPLE).noCollission().instabreak().sound(SoundType.WET_GRASS).pushReaction(PushReaction.DESTROY) - ) + properties -> new CoralPlantBlock(DEAD_BUBBLE_CORAL, properties), + BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_PURPLE).noCollission().instabreak().sound(SoundType.WET_GRASS).pushReaction(PushReaction.DESTROY) ); public static final Block FIRE_CORAL = register( "fire_coral", - new CoralPlantBlock( - DEAD_FIRE_CORAL, - BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_RED).noCollission().instabreak().sound(SoundType.WET_GRASS).pushReaction(PushReaction.DESTROY) - ) + properties -> new CoralPlantBlock(DEAD_FIRE_CORAL, properties), + BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_RED).noCollission().instabreak().sound(SoundType.WET_GRASS).pushReaction(PushReaction.DESTROY) ); public static final Block HORN_CORAL = register( "horn_coral", - new CoralPlantBlock( - DEAD_HORN_CORAL, - BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_YELLOW).noCollission().instabreak().sound(SoundType.WET_GRASS).pushReaction(PushReaction.DESTROY) - ) + properties -> new CoralPlantBlock(DEAD_HORN_CORAL, properties), + BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_YELLOW).noCollission().instabreak().sound(SoundType.WET_GRASS).pushReaction(PushReaction.DESTROY) ); public static final Block DEAD_TUBE_CORAL_FAN = register( "dead_tube_coral_fan", - new BaseCoralFanBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.COLOR_GRAY) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASEDRUM) - .requiresCorrectToolForDrops() - .noCollission() - .instabreak() - ) + BaseCoralFanBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.COLOR_GRAY) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASEDRUM) + .requiresCorrectToolForDrops() + .noCollission() + .instabreak() ); public static final Block DEAD_BRAIN_CORAL_FAN = register( "dead_brain_coral_fan", - new BaseCoralFanBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.COLOR_GRAY) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASEDRUM) - .requiresCorrectToolForDrops() - .noCollission() - .instabreak() - ) + BaseCoralFanBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.COLOR_GRAY) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASEDRUM) + .requiresCorrectToolForDrops() + .noCollission() + .instabreak() ); public static final Block DEAD_BUBBLE_CORAL_FAN = register( "dead_bubble_coral_fan", - new BaseCoralFanBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.COLOR_GRAY) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASEDRUM) - .requiresCorrectToolForDrops() - .noCollission() - .instabreak() - ) + BaseCoralFanBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.COLOR_GRAY) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASEDRUM) + .requiresCorrectToolForDrops() + .noCollission() + .instabreak() ); public static final Block DEAD_FIRE_CORAL_FAN = register( "dead_fire_coral_fan", - new BaseCoralFanBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.COLOR_GRAY) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASEDRUM) - .requiresCorrectToolForDrops() - .noCollission() - .instabreak() - ) + BaseCoralFanBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.COLOR_GRAY) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASEDRUM) + .requiresCorrectToolForDrops() + .noCollission() + .instabreak() ); public static final Block DEAD_HORN_CORAL_FAN = register( "dead_horn_coral_fan", - new BaseCoralFanBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.COLOR_GRAY) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASEDRUM) - .requiresCorrectToolForDrops() - .noCollission() - .instabreak() - ) + BaseCoralFanBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.COLOR_GRAY) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASEDRUM) + .requiresCorrectToolForDrops() + .noCollission() + .instabreak() ); public static final Block TUBE_CORAL_FAN = register( "tube_coral_fan", - new CoralFanBlock( - DEAD_TUBE_CORAL_FAN, - BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_BLUE).noCollission().instabreak().sound(SoundType.WET_GRASS).pushReaction(PushReaction.DESTROY) - ) + properties -> new CoralFanBlock(DEAD_TUBE_CORAL_FAN, properties), + BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_BLUE).noCollission().instabreak().sound(SoundType.WET_GRASS).pushReaction(PushReaction.DESTROY) ); public static final Block BRAIN_CORAL_FAN = register( "brain_coral_fan", - new CoralFanBlock( - DEAD_BRAIN_CORAL_FAN, - BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_PINK).noCollission().instabreak().sound(SoundType.WET_GRASS).pushReaction(PushReaction.DESTROY) - ) + properties -> new CoralFanBlock(DEAD_BRAIN_CORAL_FAN, properties), + BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_PINK).noCollission().instabreak().sound(SoundType.WET_GRASS).pushReaction(PushReaction.DESTROY) ); public static final Block BUBBLE_CORAL_FAN = register( "bubble_coral_fan", - new CoralFanBlock( - DEAD_BUBBLE_CORAL_FAN, - BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_PURPLE).noCollission().instabreak().sound(SoundType.WET_GRASS).pushReaction(PushReaction.DESTROY) - ) + properties -> new CoralFanBlock(DEAD_BUBBLE_CORAL_FAN, properties), + BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_PURPLE).noCollission().instabreak().sound(SoundType.WET_GRASS).pushReaction(PushReaction.DESTROY) ); public static final Block FIRE_CORAL_FAN = register( "fire_coral_fan", - new CoralFanBlock( - DEAD_FIRE_CORAL_FAN, - BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_RED).noCollission().instabreak().sound(SoundType.WET_GRASS).pushReaction(PushReaction.DESTROY) - ) + properties -> new CoralFanBlock(DEAD_FIRE_CORAL_FAN, properties), + BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_RED).noCollission().instabreak().sound(SoundType.WET_GRASS).pushReaction(PushReaction.DESTROY) ); public static final Block HORN_CORAL_FAN = register( "horn_coral_fan", - new CoralFanBlock( - DEAD_HORN_CORAL_FAN, - BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_YELLOW).noCollission().instabreak().sound(SoundType.WET_GRASS).pushReaction(PushReaction.DESTROY) - ) + properties -> new CoralFanBlock(DEAD_HORN_CORAL_FAN, properties), + BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_YELLOW).noCollission().instabreak().sound(SoundType.WET_GRASS).pushReaction(PushReaction.DESTROY) ); public static final Block DEAD_TUBE_CORAL_WALL_FAN = register( "dead_tube_coral_wall_fan", - new BaseCoralWallFanBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.COLOR_GRAY) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASEDRUM) - .requiresCorrectToolForDrops() - .noCollission() - .instabreak() - .dropsLike(DEAD_TUBE_CORAL_FAN) - ) + BaseCoralWallFanBlock::new, + wallVariant(DEAD_TUBE_CORAL_FAN, false) + .mapColor(MapColor.COLOR_GRAY) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASEDRUM) + .requiresCorrectToolForDrops() + .noCollission() + .instabreak() ); public static final Block DEAD_BRAIN_CORAL_WALL_FAN = register( "dead_brain_coral_wall_fan", - new BaseCoralWallFanBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.COLOR_GRAY) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASEDRUM) - .requiresCorrectToolForDrops() - .noCollission() - .instabreak() - .dropsLike(DEAD_BRAIN_CORAL_FAN) - ) + BaseCoralWallFanBlock::new, + wallVariant(DEAD_BRAIN_CORAL_FAN, false) + .mapColor(MapColor.COLOR_GRAY) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASEDRUM) + .requiresCorrectToolForDrops() + .noCollission() + .instabreak() ); public static final Block DEAD_BUBBLE_CORAL_WALL_FAN = register( "dead_bubble_coral_wall_fan", - new BaseCoralWallFanBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.COLOR_GRAY) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASEDRUM) - .requiresCorrectToolForDrops() - .noCollission() - .instabreak() - .dropsLike(DEAD_BUBBLE_CORAL_FAN) - ) + BaseCoralWallFanBlock::new, + wallVariant(DEAD_BUBBLE_CORAL_FAN, false) + .mapColor(MapColor.COLOR_GRAY) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASEDRUM) + .requiresCorrectToolForDrops() + .noCollission() + .instabreak() ); public static final Block DEAD_FIRE_CORAL_WALL_FAN = register( "dead_fire_coral_wall_fan", - new BaseCoralWallFanBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.COLOR_GRAY) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASEDRUM) - .requiresCorrectToolForDrops() - .noCollission() - .instabreak() - .dropsLike(DEAD_FIRE_CORAL_FAN) - ) + BaseCoralWallFanBlock::new, + wallVariant(DEAD_FIRE_CORAL_FAN, false) + .mapColor(MapColor.COLOR_GRAY) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASEDRUM) + .requiresCorrectToolForDrops() + .noCollission() + .instabreak() ); public static final Block DEAD_HORN_CORAL_WALL_FAN = register( "dead_horn_coral_wall_fan", - new BaseCoralWallFanBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.COLOR_GRAY) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASEDRUM) - .requiresCorrectToolForDrops() - .noCollission() - .instabreak() - .dropsLike(DEAD_HORN_CORAL_FAN) - ) + BaseCoralWallFanBlock::new, + wallVariant(DEAD_HORN_CORAL_FAN, false) + .mapColor(MapColor.COLOR_GRAY) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASEDRUM) + .requiresCorrectToolForDrops() + .noCollission() + .instabreak() ); public static final Block TUBE_CORAL_WALL_FAN = register( "tube_coral_wall_fan", - new CoralWallFanBlock( - DEAD_TUBE_CORAL_WALL_FAN, - BlockBehaviour.Properties.of() - .mapColor(MapColor.COLOR_BLUE) - .noCollission() - .instabreak() - .sound(SoundType.WET_GRASS) - .dropsLike(TUBE_CORAL_FAN) - .pushReaction(PushReaction.DESTROY) - ) + properties -> new CoralWallFanBlock(DEAD_TUBE_CORAL_WALL_FAN, properties), + wallVariant(TUBE_CORAL_FAN, false).mapColor(MapColor.COLOR_BLUE).noCollission().instabreak().sound(SoundType.WET_GRASS).pushReaction(PushReaction.DESTROY) ); public static final Block BRAIN_CORAL_WALL_FAN = register( "brain_coral_wall_fan", - new CoralWallFanBlock( - DEAD_BRAIN_CORAL_WALL_FAN, - BlockBehaviour.Properties.of() - .mapColor(MapColor.COLOR_PINK) - .noCollission() - .instabreak() - .sound(SoundType.WET_GRASS) - .dropsLike(BRAIN_CORAL_FAN) - .pushReaction(PushReaction.DESTROY) - ) + properties -> new CoralWallFanBlock(DEAD_BRAIN_CORAL_WALL_FAN, properties), + wallVariant(BRAIN_CORAL_FAN, false).mapColor(MapColor.COLOR_PINK).noCollission().instabreak().sound(SoundType.WET_GRASS).pushReaction(PushReaction.DESTROY) ); public static final Block BUBBLE_CORAL_WALL_FAN = register( "bubble_coral_wall_fan", - new CoralWallFanBlock( - DEAD_BUBBLE_CORAL_WALL_FAN, - BlockBehaviour.Properties.of() - .mapColor(MapColor.COLOR_PURPLE) - .noCollission() - .instabreak() - .sound(SoundType.WET_GRASS) - .dropsLike(BUBBLE_CORAL_FAN) - .pushReaction(PushReaction.DESTROY) - ) + properties -> new CoralWallFanBlock(DEAD_BUBBLE_CORAL_WALL_FAN, properties), + wallVariant(BUBBLE_CORAL_FAN, false) + .mapColor(MapColor.COLOR_PURPLE) + .noCollission() + .instabreak() + .sound(SoundType.WET_GRASS) + .pushReaction(PushReaction.DESTROY) ); public static final Block FIRE_CORAL_WALL_FAN = register( "fire_coral_wall_fan", - new CoralWallFanBlock( - DEAD_FIRE_CORAL_WALL_FAN, - BlockBehaviour.Properties.of() - .mapColor(MapColor.COLOR_RED) - .noCollission() - .instabreak() - .sound(SoundType.WET_GRASS) - .dropsLike(FIRE_CORAL_FAN) - .pushReaction(PushReaction.DESTROY) - ) + properties -> new CoralWallFanBlock(DEAD_FIRE_CORAL_WALL_FAN, properties), + wallVariant(FIRE_CORAL_FAN, false).mapColor(MapColor.COLOR_RED).noCollission().instabreak().sound(SoundType.WET_GRASS).pushReaction(PushReaction.DESTROY) ); public static final Block HORN_CORAL_WALL_FAN = register( "horn_coral_wall_fan", - new CoralWallFanBlock( - DEAD_HORN_CORAL_WALL_FAN, - BlockBehaviour.Properties.of() - .mapColor(MapColor.COLOR_YELLOW) - .noCollission() - .instabreak() - .sound(SoundType.WET_GRASS) - .dropsLike(HORN_CORAL_FAN) - .pushReaction(PushReaction.DESTROY) - ) + properties -> new CoralWallFanBlock(DEAD_HORN_CORAL_WALL_FAN, properties), + wallVariant(HORN_CORAL_FAN, false).mapColor(MapColor.COLOR_YELLOW).noCollission().instabreak().sound(SoundType.WET_GRASS).pushReaction(PushReaction.DESTROY) ); public static final Block SEA_PICKLE = register( "sea_pickle", - new SeaPickleBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.COLOR_GREEN) - .lightLevel(blockStatex -> SeaPickleBlock.isDead(blockStatex) ? 0 : 3 + 3 * (Integer)blockStatex.getValue(SeaPickleBlock.PICKLES)) - .sound(SoundType.SLIME_BLOCK) - .noOcclusion() - .pushReaction(PushReaction.DESTROY) - ) + SeaPickleBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.COLOR_GREEN) + .lightLevel(blockStatex -> SeaPickleBlock.isDead(blockStatex) ? 0 : 3 + 3 * (Integer)blockStatex.getValue(SeaPickleBlock.PICKLES)) + .sound(SoundType.SLIME_BLOCK) + .noOcclusion() + .pushReaction(PushReaction.DESTROY) ); public static final Block BLUE_ICE = register( - "blue_ice", new HalfTransparentBlock(BlockBehaviour.Properties.of().mapColor(MapColor.ICE).strength(2.8F).friction(0.989F).sound(SoundType.GLASS)) + "blue_ice", HalfTransparentBlock::new, BlockBehaviour.Properties.of().mapColor(MapColor.ICE).strength(2.8F).friction(0.989F).sound(SoundType.GLASS) ); public static final Block CONDUIT = register( "conduit", - new ConduitBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.DIAMOND) - .forceSolidOn() - .instrument(NoteBlockInstrument.HAT) - .strength(3.0F) - .lightLevel(blockStatex -> 15) - .noOcclusion() - ) + ConduitBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.DIAMOND) + .forceSolidOn() + .instrument(NoteBlockInstrument.HAT) + .strength(3.0F) + .lightLevel(blockStatex -> 15) + .noOcclusion() ); public static final Block BAMBOO_SAPLING = register( "bamboo_sapling", - new BambooSaplingBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.WOOD) - .forceSolidOn() - .randomTicks() - .instabreak() - .noCollission() - .strength(1.0F) - .sound(SoundType.BAMBOO_SAPLING) - .offsetType(BlockBehaviour.OffsetType.XZ) - .ignitedByLava() - .pushReaction(PushReaction.DESTROY) - ) + BambooSaplingBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.WOOD) + .forceSolidOn() + .randomTicks() + .instabreak() + .noCollission() + .strength(1.0F) + .sound(SoundType.BAMBOO_SAPLING) + .offsetType(BlockBehaviour.OffsetType.XZ) + .ignitedByLava() + .pushReaction(PushReaction.DESTROY) ); public static final Block BAMBOO = register( "bamboo", - new BambooStalkBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.PLANT) - .forceSolidOn() - .randomTicks() - .instabreak() - .strength(1.0F) - .sound(SoundType.BAMBOO) - .noOcclusion() - .dynamicShape() - .offsetType(BlockBehaviour.OffsetType.XZ) - .ignitedByLava() - .pushReaction(PushReaction.DESTROY) - .isRedstoneConductor(Blocks::never) - ) + BambooStalkBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.PLANT) + .forceSolidOn() + .randomTicks() + .instabreak() + .strength(1.0F) + .sound(SoundType.BAMBOO) + .noOcclusion() + .dynamicShape() + .offsetType(BlockBehaviour.OffsetType.XZ) + .ignitedByLava() + .pushReaction(PushReaction.DESTROY) + .isRedstoneConductor(Blocks::never) ); - public static final Block POTTED_BAMBOO = register("potted_bamboo", flowerPot(BAMBOO)); - public static final Block VOID_AIR = register("void_air", new AirBlock(BlockBehaviour.Properties.of().replaceable().noCollission().noLootTable().air())); - public static final Block CAVE_AIR = register("cave_air", new AirBlock(BlockBehaviour.Properties.of().replaceable().noCollission().noLootTable().air())); + public static final Block POTTED_BAMBOO = register("potted_bamboo", properties -> new FlowerPotBlock(BAMBOO, properties), flowerPotProperties()); + public static final Block VOID_AIR = register("void_air", AirBlock::new, BlockBehaviour.Properties.of().replaceable().noCollission().noLootTable().air()); + public static final Block CAVE_AIR = register("cave_air", AirBlock::new, BlockBehaviour.Properties.of().replaceable().noCollission().noLootTable().air()); public static final Block BUBBLE_COLUMN = register( "bubble_column", - new BubbleColumnBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.WATER) - .replaceable() - .noCollission() - .noLootTable() - .pushReaction(PushReaction.DESTROY) - .liquid() - .sound(SoundType.EMPTY) - ) + BubbleColumnBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.WATER) + .replaceable() + .noCollission() + .noLootTable() + .pushReaction(PushReaction.DESTROY) + .liquid() + .sound(SoundType.EMPTY) ); - public static final Block POLISHED_GRANITE_STAIRS = register("polished_granite_stairs", legacyStair(POLISHED_GRANITE)); - public static final Block SMOOTH_RED_SANDSTONE_STAIRS = register("smooth_red_sandstone_stairs", legacyStair(SMOOTH_RED_SANDSTONE)); - public static final Block MOSSY_STONE_BRICK_STAIRS = register("mossy_stone_brick_stairs", legacyStair(MOSSY_STONE_BRICKS)); - public static final Block POLISHED_DIORITE_STAIRS = register("polished_diorite_stairs", legacyStair(POLISHED_DIORITE)); - public static final Block MOSSY_COBBLESTONE_STAIRS = register("mossy_cobblestone_stairs", legacyStair(MOSSY_COBBLESTONE)); - public static final Block END_STONE_BRICK_STAIRS = register("end_stone_brick_stairs", legacyStair(END_STONE_BRICKS)); - public static final Block STONE_STAIRS = register("stone_stairs", legacyStair(STONE)); - public static final Block SMOOTH_SANDSTONE_STAIRS = register("smooth_sandstone_stairs", legacyStair(SMOOTH_SANDSTONE)); - public static final Block SMOOTH_QUARTZ_STAIRS = register("smooth_quartz_stairs", legacyStair(SMOOTH_QUARTZ)); - public static final Block GRANITE_STAIRS = register("granite_stairs", legacyStair(GRANITE)); - public static final Block ANDESITE_STAIRS = register("andesite_stairs", legacyStair(ANDESITE)); - public static final Block RED_NETHER_BRICK_STAIRS = register("red_nether_brick_stairs", legacyStair(RED_NETHER_BRICKS)); - public static final Block POLISHED_ANDESITE_STAIRS = register("polished_andesite_stairs", legacyStair(POLISHED_ANDESITE)); - public static final Block DIORITE_STAIRS = register("diorite_stairs", legacyStair(DIORITE)); - public static final Block POLISHED_GRANITE_SLAB = register("polished_granite_slab", new SlabBlock(BlockBehaviour.Properties.ofLegacyCopy(POLISHED_GRANITE))); + public static final Block POLISHED_GRANITE_STAIRS = registerLegacyStair("polished_granite_stairs", POLISHED_GRANITE); + public static final Block SMOOTH_RED_SANDSTONE_STAIRS = registerLegacyStair("smooth_red_sandstone_stairs", SMOOTH_RED_SANDSTONE); + public static final Block MOSSY_STONE_BRICK_STAIRS = registerLegacyStair("mossy_stone_brick_stairs", MOSSY_STONE_BRICKS); + public static final Block POLISHED_DIORITE_STAIRS = registerLegacyStair("polished_diorite_stairs", POLISHED_DIORITE); + public static final Block MOSSY_COBBLESTONE_STAIRS = registerLegacyStair("mossy_cobblestone_stairs", MOSSY_COBBLESTONE); + public static final Block END_STONE_BRICK_STAIRS = registerLegacyStair("end_stone_brick_stairs", END_STONE_BRICKS); + public static final Block STONE_STAIRS = registerLegacyStair("stone_stairs", STONE); + public static final Block SMOOTH_SANDSTONE_STAIRS = registerLegacyStair("smooth_sandstone_stairs", SMOOTH_SANDSTONE); + public static final Block SMOOTH_QUARTZ_STAIRS = registerLegacyStair("smooth_quartz_stairs", SMOOTH_QUARTZ); + public static final Block GRANITE_STAIRS = registerLegacyStair("granite_stairs", GRANITE); + public static final Block ANDESITE_STAIRS = registerLegacyStair("andesite_stairs", ANDESITE); + public static final Block RED_NETHER_BRICK_STAIRS = registerLegacyStair("red_nether_brick_stairs", RED_NETHER_BRICKS); + public static final Block POLISHED_ANDESITE_STAIRS = registerLegacyStair("polished_andesite_stairs", POLISHED_ANDESITE); + public static final Block DIORITE_STAIRS = registerLegacyStair("diorite_stairs", DIORITE); + public static final Block POLISHED_GRANITE_SLAB = register("polished_granite_slab", SlabBlock::new, BlockBehaviour.Properties.ofLegacyCopy(POLISHED_GRANITE)); public static final Block SMOOTH_RED_SANDSTONE_SLAB = register( - "smooth_red_sandstone_slab", new SlabBlock(BlockBehaviour.Properties.ofLegacyCopy(SMOOTH_RED_SANDSTONE)) + "smooth_red_sandstone_slab", SlabBlock::new, BlockBehaviour.Properties.ofLegacyCopy(SMOOTH_RED_SANDSTONE) ); public static final Block MOSSY_STONE_BRICK_SLAB = register( - "mossy_stone_brick_slab", new SlabBlock(BlockBehaviour.Properties.ofLegacyCopy(MOSSY_STONE_BRICKS)) + "mossy_stone_brick_slab", SlabBlock::new, BlockBehaviour.Properties.ofLegacyCopy(MOSSY_STONE_BRICKS) ); - public static final Block POLISHED_DIORITE_SLAB = register("polished_diorite_slab", new SlabBlock(BlockBehaviour.Properties.ofLegacyCopy(POLISHED_DIORITE))); - public static final Block MOSSY_COBBLESTONE_SLAB = register("mossy_cobblestone_slab", new SlabBlock(BlockBehaviour.Properties.ofLegacyCopy(MOSSY_COBBLESTONE))); - public static final Block END_STONE_BRICK_SLAB = register("end_stone_brick_slab", new SlabBlock(BlockBehaviour.Properties.ofLegacyCopy(END_STONE_BRICKS))); - public static final Block SMOOTH_SANDSTONE_SLAB = register("smooth_sandstone_slab", new SlabBlock(BlockBehaviour.Properties.ofLegacyCopy(SMOOTH_SANDSTONE))); - public static final Block SMOOTH_QUARTZ_SLAB = register("smooth_quartz_slab", new SlabBlock(BlockBehaviour.Properties.ofLegacyCopy(SMOOTH_QUARTZ))); - public static final Block GRANITE_SLAB = register("granite_slab", new SlabBlock(BlockBehaviour.Properties.ofLegacyCopy(GRANITE))); - public static final Block ANDESITE_SLAB = register("andesite_slab", new SlabBlock(BlockBehaviour.Properties.ofLegacyCopy(ANDESITE))); - public static final Block RED_NETHER_BRICK_SLAB = register("red_nether_brick_slab", new SlabBlock(BlockBehaviour.Properties.ofLegacyCopy(RED_NETHER_BRICKS))); - public static final Block POLISHED_ANDESITE_SLAB = register("polished_andesite_slab", new SlabBlock(BlockBehaviour.Properties.ofLegacyCopy(POLISHED_ANDESITE))); - public static final Block DIORITE_SLAB = register("diorite_slab", new SlabBlock(BlockBehaviour.Properties.ofLegacyCopy(DIORITE))); - public static final Block BRICK_WALL = register("brick_wall", new WallBlock(BlockBehaviour.Properties.ofLegacyCopy(BRICKS).forceSolidOn())); - public static final Block PRISMARINE_WALL = register("prismarine_wall", new WallBlock(BlockBehaviour.Properties.ofLegacyCopy(PRISMARINE).forceSolidOn())); + public static final Block POLISHED_DIORITE_SLAB = register("polished_diorite_slab", SlabBlock::new, BlockBehaviour.Properties.ofLegacyCopy(POLISHED_DIORITE)); + public static final Block MOSSY_COBBLESTONE_SLAB = register( + "mossy_cobblestone_slab", SlabBlock::new, BlockBehaviour.Properties.ofLegacyCopy(MOSSY_COBBLESTONE) + ); + public static final Block END_STONE_BRICK_SLAB = register("end_stone_brick_slab", SlabBlock::new, BlockBehaviour.Properties.ofLegacyCopy(END_STONE_BRICKS)); + public static final Block SMOOTH_SANDSTONE_SLAB = register("smooth_sandstone_slab", SlabBlock::new, BlockBehaviour.Properties.ofLegacyCopy(SMOOTH_SANDSTONE)); + public static final Block SMOOTH_QUARTZ_SLAB = register("smooth_quartz_slab", SlabBlock::new, BlockBehaviour.Properties.ofLegacyCopy(SMOOTH_QUARTZ)); + public static final Block GRANITE_SLAB = register("granite_slab", SlabBlock::new, BlockBehaviour.Properties.ofLegacyCopy(GRANITE)); + public static final Block ANDESITE_SLAB = register("andesite_slab", SlabBlock::new, BlockBehaviour.Properties.ofLegacyCopy(ANDESITE)); + public static final Block RED_NETHER_BRICK_SLAB = register("red_nether_brick_slab", SlabBlock::new, BlockBehaviour.Properties.ofLegacyCopy(RED_NETHER_BRICKS)); + public static final Block POLISHED_ANDESITE_SLAB = register( + "polished_andesite_slab", SlabBlock::new, BlockBehaviour.Properties.ofLegacyCopy(POLISHED_ANDESITE) + ); + public static final Block DIORITE_SLAB = register("diorite_slab", SlabBlock::new, BlockBehaviour.Properties.ofLegacyCopy(DIORITE)); + public static final Block BRICK_WALL = register("brick_wall", WallBlock::new, BlockBehaviour.Properties.ofLegacyCopy(BRICKS).forceSolidOn()); + public static final Block PRISMARINE_WALL = register("prismarine_wall", WallBlock::new, BlockBehaviour.Properties.ofLegacyCopy(PRISMARINE).forceSolidOn()); public static final Block RED_SANDSTONE_WALL = register( - "red_sandstone_wall", new WallBlock(BlockBehaviour.Properties.ofLegacyCopy(RED_SANDSTONE).forceSolidOn()) + "red_sandstone_wall", WallBlock::new, BlockBehaviour.Properties.ofLegacyCopy(RED_SANDSTONE).forceSolidOn() ); public static final Block MOSSY_STONE_BRICK_WALL = register( - "mossy_stone_brick_wall", new WallBlock(BlockBehaviour.Properties.ofLegacyCopy(MOSSY_STONE_BRICKS).forceSolidOn()) + "mossy_stone_brick_wall", WallBlock::new, BlockBehaviour.Properties.ofLegacyCopy(MOSSY_STONE_BRICKS).forceSolidOn() ); - public static final Block GRANITE_WALL = register("granite_wall", new WallBlock(BlockBehaviour.Properties.ofLegacyCopy(GRANITE).forceSolidOn())); - public static final Block STONE_BRICK_WALL = register("stone_brick_wall", new WallBlock(BlockBehaviour.Properties.ofLegacyCopy(STONE_BRICKS).forceSolidOn())); - public static final Block MUD_BRICK_WALL = register("mud_brick_wall", new WallBlock(BlockBehaviour.Properties.ofLegacyCopy(MUD_BRICKS).forceSolidOn())); + public static final Block GRANITE_WALL = register("granite_wall", WallBlock::new, BlockBehaviour.Properties.ofLegacyCopy(GRANITE).forceSolidOn()); + public static final Block STONE_BRICK_WALL = register("stone_brick_wall", WallBlock::new, BlockBehaviour.Properties.ofLegacyCopy(STONE_BRICKS).forceSolidOn()); + public static final Block MUD_BRICK_WALL = register("mud_brick_wall", WallBlock::new, BlockBehaviour.Properties.ofLegacyCopy(MUD_BRICKS).forceSolidOn()); public static final Block NETHER_BRICK_WALL = register( - "nether_brick_wall", new WallBlock(BlockBehaviour.Properties.ofLegacyCopy(NETHER_BRICKS).forceSolidOn()) + "nether_brick_wall", WallBlock::new, BlockBehaviour.Properties.ofLegacyCopy(NETHER_BRICKS).forceSolidOn() ); - public static final Block ANDESITE_WALL = register("andesite_wall", new WallBlock(BlockBehaviour.Properties.ofLegacyCopy(ANDESITE).forceSolidOn())); + public static final Block ANDESITE_WALL = register("andesite_wall", WallBlock::new, BlockBehaviour.Properties.ofLegacyCopy(ANDESITE).forceSolidOn()); public static final Block RED_NETHER_BRICK_WALL = register( - "red_nether_brick_wall", new WallBlock(BlockBehaviour.Properties.ofLegacyCopy(RED_NETHER_BRICKS).forceSolidOn()) + "red_nether_brick_wall", WallBlock::new, BlockBehaviour.Properties.ofLegacyCopy(RED_NETHER_BRICKS).forceSolidOn() ); - public static final Block SANDSTONE_WALL = register("sandstone_wall", new WallBlock(BlockBehaviour.Properties.ofLegacyCopy(SANDSTONE).forceSolidOn())); + public static final Block SANDSTONE_WALL = register("sandstone_wall", WallBlock::new, BlockBehaviour.Properties.ofLegacyCopy(SANDSTONE).forceSolidOn()); public static final Block END_STONE_BRICK_WALL = register( - "end_stone_brick_wall", new WallBlock(BlockBehaviour.Properties.ofLegacyCopy(END_STONE_BRICKS).forceSolidOn()) + "end_stone_brick_wall", WallBlock::new, BlockBehaviour.Properties.ofLegacyCopy(END_STONE_BRICKS).forceSolidOn() ); - public static final Block DIORITE_WALL = register("diorite_wall", new WallBlock(BlockBehaviour.Properties.ofLegacyCopy(DIORITE).forceSolidOn())); + public static final Block DIORITE_WALL = register("diorite_wall", WallBlock::new, BlockBehaviour.Properties.ofLegacyCopy(DIORITE).forceSolidOn()); public static final Block SCAFFOLDING = register( "scaffolding", - new ScaffoldingBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.SAND) - .noCollission() - .sound(SoundType.SCAFFOLDING) - .dynamicShape() - .isValidSpawn(Blocks::never) - .pushReaction(PushReaction.DESTROY) - .isRedstoneConductor(Blocks::never) - ) + ScaffoldingBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.SAND) + .noCollission() + .sound(SoundType.SCAFFOLDING) + .dynamicShape() + .isValidSpawn(Blocks::never) + .pushReaction(PushReaction.DESTROY) + .isRedstoneConductor(Blocks::never) ); public static final Block LOOM = register( "loom", - new LoomBlock( - BlockBehaviour.Properties.of().mapColor(MapColor.WOOD).instrument(NoteBlockInstrument.BASS).strength(2.5F).sound(SoundType.WOOD).ignitedByLava() - ) + LoomBlock::new, + BlockBehaviour.Properties.of().mapColor(MapColor.WOOD).instrument(NoteBlockInstrument.BASS).strength(2.5F).sound(SoundType.WOOD).ignitedByLava() ); public static final Block BARREL = register( "barrel", - new BarrelBlock( - BlockBehaviour.Properties.of().mapColor(MapColor.WOOD).instrument(NoteBlockInstrument.BASS).strength(2.5F).sound(SoundType.WOOD).ignitedByLava() - ) + BarrelBlock::new, + BlockBehaviour.Properties.of().mapColor(MapColor.WOOD).instrument(NoteBlockInstrument.BASS).strength(2.5F).sound(SoundType.WOOD).ignitedByLava() ); public static final Block SMOKER = register( "smoker", - new SmokerBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.STONE) - .instrument(NoteBlockInstrument.BASEDRUM) - .requiresCorrectToolForDrops() - .strength(3.5F) - .lightLevel(litBlockEmission(13)) - ) + SmokerBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.STONE) + .instrument(NoteBlockInstrument.BASEDRUM) + .requiresCorrectToolForDrops() + .strength(3.5F) + .lightLevel(litBlockEmission(13)) ); public static final Block BLAST_FURNACE = register( "blast_furnace", - new BlastFurnaceBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.STONE) - .instrument(NoteBlockInstrument.BASEDRUM) - .requiresCorrectToolForDrops() - .strength(3.5F) - .lightLevel(litBlockEmission(13)) - ) + BlastFurnaceBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.STONE) + .instrument(NoteBlockInstrument.BASEDRUM) + .requiresCorrectToolForDrops() + .strength(3.5F) + .lightLevel(litBlockEmission(13)) ); public static final Block CARTOGRAPHY_TABLE = register( "cartography_table", - new CartographyTableBlock( - BlockBehaviour.Properties.of().mapColor(MapColor.WOOD).instrument(NoteBlockInstrument.BASS).strength(2.5F).sound(SoundType.WOOD).ignitedByLava() - ) + CartographyTableBlock::new, + BlockBehaviour.Properties.of().mapColor(MapColor.WOOD).instrument(NoteBlockInstrument.BASS).strength(2.5F).sound(SoundType.WOOD).ignitedByLava() ); public static final Block FLETCHING_TABLE = register( "fletching_table", - new FletchingTableBlock( - BlockBehaviour.Properties.of().mapColor(MapColor.WOOD).instrument(NoteBlockInstrument.BASS).strength(2.5F).sound(SoundType.WOOD).ignitedByLava() - ) + FletchingTableBlock::new, + BlockBehaviour.Properties.of().mapColor(MapColor.WOOD).instrument(NoteBlockInstrument.BASS).strength(2.5F).sound(SoundType.WOOD).ignitedByLava() ); public static final Block GRINDSTONE = register( "grindstone", - new GrindstoneBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.METAL) - .requiresCorrectToolForDrops() - .strength(2.0F, 6.0F) - .sound(SoundType.STONE) - .pushReaction(PushReaction.BLOCK) - ) + GrindstoneBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.METAL) + .requiresCorrectToolForDrops() + .strength(2.0F, 6.0F) + .sound(SoundType.STONE) + .pushReaction(PushReaction.BLOCK) ); public static final Block LECTERN = register( "lectern", - new LecternBlock( - BlockBehaviour.Properties.of().mapColor(MapColor.WOOD).instrument(NoteBlockInstrument.BASS).strength(2.5F).sound(SoundType.WOOD).ignitedByLava() - ) + LecternBlock::new, + BlockBehaviour.Properties.of().mapColor(MapColor.WOOD).instrument(NoteBlockInstrument.BASS).strength(2.5F).sound(SoundType.WOOD).ignitedByLava() ); public static final Block SMITHING_TABLE = register( "smithing_table", - new SmithingTableBlock( - BlockBehaviour.Properties.of().mapColor(MapColor.WOOD).instrument(NoteBlockInstrument.BASS).strength(2.5F).sound(SoundType.WOOD).ignitedByLava() - ) + SmithingTableBlock::new, + BlockBehaviour.Properties.of().mapColor(MapColor.WOOD).instrument(NoteBlockInstrument.BASS).strength(2.5F).sound(SoundType.WOOD).ignitedByLava() ); public static final Block STONECUTTER = register( "stonecutter", - new StonecutterBlock( - BlockBehaviour.Properties.of().mapColor(MapColor.STONE).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(3.5F) - ) + StonecutterBlock::new, + BlockBehaviour.Properties.of().mapColor(MapColor.STONE).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(3.5F) ); public static final Block BELL = register( "bell", - new BellBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.GOLD) - .forceSolidOn() - .requiresCorrectToolForDrops() - .strength(5.0F) - .sound(SoundType.ANVIL) - .pushReaction(PushReaction.DESTROY) - ) + BellBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.GOLD) + .forceSolidOn() + .requiresCorrectToolForDrops() + .strength(5.0F) + .sound(SoundType.ANVIL) + .pushReaction(PushReaction.DESTROY) ); public static final Block LANTERN = register( "lantern", - new LanternBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.METAL) - .forceSolidOn() - .requiresCorrectToolForDrops() - .strength(3.5F) - .sound(SoundType.LANTERN) - .lightLevel(blockStatex -> 15) - .noOcclusion() - .pushReaction(PushReaction.DESTROY) - ) + LanternBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.METAL) + .forceSolidOn() + .requiresCorrectToolForDrops() + .strength(3.5F) + .sound(SoundType.LANTERN) + .lightLevel(blockStatex -> 15) + .noOcclusion() + .pushReaction(PushReaction.DESTROY) ); public static final Block SOUL_LANTERN = register( "soul_lantern", - new LanternBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.METAL) - .forceSolidOn() - .requiresCorrectToolForDrops() - .strength(3.5F) - .sound(SoundType.LANTERN) - .lightLevel(blockStatex -> 10) - .noOcclusion() - .pushReaction(PushReaction.DESTROY) - ) + LanternBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.METAL) + .forceSolidOn() + .requiresCorrectToolForDrops() + .strength(3.5F) + .sound(SoundType.LANTERN) + .lightLevel(blockStatex -> 10) + .noOcclusion() + .pushReaction(PushReaction.DESTROY) ); public static final Block CAMPFIRE = register( "campfire", - new CampfireBlock( - true, - 1, - BlockBehaviour.Properties.of() - .mapColor(MapColor.PODZOL) - .instrument(NoteBlockInstrument.BASS) - .strength(2.0F) - .sound(SoundType.WOOD) - .lightLevel(litBlockEmission(15)) - .noOcclusion() - .ignitedByLava() - ) + properties -> new CampfireBlock(true, 1, properties), + BlockBehaviour.Properties.of() + .mapColor(MapColor.PODZOL) + .instrument(NoteBlockInstrument.BASS) + .strength(2.0F) + .sound(SoundType.WOOD) + .lightLevel(litBlockEmission(15)) + .noOcclusion() + .ignitedByLava() ); public static final Block SOUL_CAMPFIRE = register( "soul_campfire", - new CampfireBlock( - false, - 2, - BlockBehaviour.Properties.of() - .mapColor(MapColor.PODZOL) - .instrument(NoteBlockInstrument.BASS) - .strength(2.0F) - .sound(SoundType.WOOD) - .lightLevel(litBlockEmission(10)) - .noOcclusion() - .ignitedByLava() - ) + properties -> new CampfireBlock(false, 2, properties), + BlockBehaviour.Properties.of() + .mapColor(MapColor.PODZOL) + .instrument(NoteBlockInstrument.BASS) + .strength(2.0F) + .sound(SoundType.WOOD) + .lightLevel(litBlockEmission(10)) + .noOcclusion() + .ignitedByLava() ); public static final Block SWEET_BERRY_BUSH = register( "sweet_berry_bush", - new SweetBerryBushBlock( - BlockBehaviour.Properties.of().mapColor(MapColor.PLANT).randomTicks().noCollission().sound(SoundType.SWEET_BERRY_BUSH).pushReaction(PushReaction.DESTROY) - ) + SweetBerryBushBlock::new, + BlockBehaviour.Properties.of().mapColor(MapColor.PLANT).randomTicks().noCollission().sound(SoundType.SWEET_BERRY_BUSH).pushReaction(PushReaction.DESTROY) ); - public static final Block WARPED_STEM = register("warped_stem", netherStem(MapColor.WARPED_STEM)); - public static final Block STRIPPED_WARPED_STEM = register("stripped_warped_stem", netherStem(MapColor.WARPED_STEM)); + public static final Block WARPED_STEM = register("warped_stem", RotatedPillarBlock::new, netherStemProperties(MapColor.WARPED_STEM)); + public static final Block STRIPPED_WARPED_STEM = register("stripped_warped_stem", RotatedPillarBlock::new, netherStemProperties(MapColor.WARPED_STEM)); public static final Block WARPED_HYPHAE = register( "warped_hyphae", - new RotatedPillarBlock( - BlockBehaviour.Properties.of().mapColor(MapColor.WARPED_HYPHAE).instrument(NoteBlockInstrument.BASS).strength(2.0F).sound(SoundType.STEM) - ) + RotatedPillarBlock::new, + BlockBehaviour.Properties.of().mapColor(MapColor.WARPED_HYPHAE).instrument(NoteBlockInstrument.BASS).strength(2.0F).sound(SoundType.STEM) ); public static final Block STRIPPED_WARPED_HYPHAE = register( "stripped_warped_hyphae", - new RotatedPillarBlock( - BlockBehaviour.Properties.of().mapColor(MapColor.WARPED_HYPHAE).instrument(NoteBlockInstrument.BASS).strength(2.0F).sound(SoundType.STEM) - ) + RotatedPillarBlock::new, + BlockBehaviour.Properties.of().mapColor(MapColor.WARPED_HYPHAE).instrument(NoteBlockInstrument.BASS).strength(2.0F).sound(SoundType.STEM) ); public static final Block WARPED_NYLIUM = register( "warped_nylium", - new NyliumBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.WARPED_NYLIUM) - .instrument(NoteBlockInstrument.BASEDRUM) - .requiresCorrectToolForDrops() - .strength(0.4F) - .sound(SoundType.NYLIUM) - .randomTicks() - ) + NyliumBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.WARPED_NYLIUM) + .instrument(NoteBlockInstrument.BASEDRUM) + .requiresCorrectToolForDrops() + .strength(0.4F) + .sound(SoundType.NYLIUM) + .randomTicks() ); public static final Block WARPED_FUNGUS = register( "warped_fungus", - new FungusBlock( - TreeFeatures.WARPED_FUNGUS_PLANTED, - WARPED_NYLIUM, - BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_CYAN).instabreak().noCollission().sound(SoundType.FUNGUS).pushReaction(PushReaction.DESTROY) - ) + properties -> new FungusBlock(TreeFeatures.WARPED_FUNGUS_PLANTED, WARPED_NYLIUM, properties), + BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_CYAN).instabreak().noCollission().sound(SoundType.FUNGUS).pushReaction(PushReaction.DESTROY) ); public static final Block WARPED_WART_BLOCK = register( - "warped_wart_block", new Block(BlockBehaviour.Properties.of().mapColor(MapColor.WARPED_WART_BLOCK).strength(1.0F).sound(SoundType.WART_BLOCK)) + "warped_wart_block", BlockBehaviour.Properties.of().mapColor(MapColor.WARPED_WART_BLOCK).strength(1.0F).sound(SoundType.WART_BLOCK) ); public static final Block WARPED_ROOTS = register( "warped_roots", - new RootsBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.COLOR_CYAN) - .replaceable() - .noCollission() - .instabreak() - .sound(SoundType.ROOTS) - .offsetType(BlockBehaviour.OffsetType.XZ) - .pushReaction(PushReaction.DESTROY) - ) + RootsBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.COLOR_CYAN) + .replaceable() + .noCollission() + .instabreak() + .sound(SoundType.ROOTS) + .offsetType(BlockBehaviour.OffsetType.XZ) + .pushReaction(PushReaction.DESTROY) ); public static final Block NETHER_SPROUTS = register( "nether_sprouts", - new NetherSproutsBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.COLOR_CYAN) - .replaceable() - .noCollission() - .instabreak() - .sound(SoundType.NETHER_SPROUTS) - .offsetType(BlockBehaviour.OffsetType.XZ) - .pushReaction(PushReaction.DESTROY) - ) + NetherSproutsBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.COLOR_CYAN) + .replaceable() + .noCollission() + .instabreak() + .sound(SoundType.NETHER_SPROUTS) + .offsetType(BlockBehaviour.OffsetType.XZ) + .pushReaction(PushReaction.DESTROY) ); - public static final Block CRIMSON_STEM = register("crimson_stem", netherStem(MapColor.CRIMSON_STEM)); - public static final Block STRIPPED_CRIMSON_STEM = register("stripped_crimson_stem", netherStem(MapColor.CRIMSON_STEM)); + public static final Block CRIMSON_STEM = register("crimson_stem", RotatedPillarBlock::new, netherStemProperties(MapColor.CRIMSON_STEM)); + public static final Block STRIPPED_CRIMSON_STEM = register("stripped_crimson_stem", RotatedPillarBlock::new, netherStemProperties(MapColor.CRIMSON_STEM)); public static final Block CRIMSON_HYPHAE = register( "crimson_hyphae", - new RotatedPillarBlock( - BlockBehaviour.Properties.of().mapColor(MapColor.CRIMSON_HYPHAE).instrument(NoteBlockInstrument.BASS).strength(2.0F).sound(SoundType.STEM) - ) + RotatedPillarBlock::new, + BlockBehaviour.Properties.of().mapColor(MapColor.CRIMSON_HYPHAE).instrument(NoteBlockInstrument.BASS).strength(2.0F).sound(SoundType.STEM) ); public static final Block STRIPPED_CRIMSON_HYPHAE = register( "stripped_crimson_hyphae", - new RotatedPillarBlock( - BlockBehaviour.Properties.of().mapColor(MapColor.CRIMSON_HYPHAE).instrument(NoteBlockInstrument.BASS).strength(2.0F).sound(SoundType.STEM) - ) + RotatedPillarBlock::new, + BlockBehaviour.Properties.of().mapColor(MapColor.CRIMSON_HYPHAE).instrument(NoteBlockInstrument.BASS).strength(2.0F).sound(SoundType.STEM) ); public static final Block CRIMSON_NYLIUM = register( "crimson_nylium", - new NyliumBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.CRIMSON_NYLIUM) - .instrument(NoteBlockInstrument.BASEDRUM) - .requiresCorrectToolForDrops() - .strength(0.4F) - .sound(SoundType.NYLIUM) - .randomTicks() - ) + NyliumBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.CRIMSON_NYLIUM) + .instrument(NoteBlockInstrument.BASEDRUM) + .requiresCorrectToolForDrops() + .strength(0.4F) + .sound(SoundType.NYLIUM) + .randomTicks() ); public static final Block CRIMSON_FUNGUS = register( "crimson_fungus", - new FungusBlock( - TreeFeatures.CRIMSON_FUNGUS_PLANTED, - CRIMSON_NYLIUM, - BlockBehaviour.Properties.of().mapColor(MapColor.NETHER).instabreak().noCollission().sound(SoundType.FUNGUS).pushReaction(PushReaction.DESTROY) - ) + properties -> new FungusBlock(TreeFeatures.CRIMSON_FUNGUS_PLANTED, CRIMSON_NYLIUM, properties), + BlockBehaviour.Properties.of().mapColor(MapColor.NETHER).instabreak().noCollission().sound(SoundType.FUNGUS).pushReaction(PushReaction.DESTROY) ); public static final Block SHROOMLIGHT = register( - "shroomlight", - new Block(BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_RED).strength(1.0F).sound(SoundType.SHROOMLIGHT).lightLevel(blockStatex -> 15)) + "shroomlight", BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_RED).strength(1.0F).sound(SoundType.SHROOMLIGHT).lightLevel(blockStatex -> 15) ); public static final Block WEEPING_VINES = register( "weeping_vines", - new WeepingVinesBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.NETHER) - .randomTicks() - .noCollission() - .instabreak() - .sound(SoundType.WEEPING_VINES) - .pushReaction(PushReaction.DESTROY) - ) + WeepingVinesBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.NETHER) + .randomTicks() + .noCollission() + .instabreak() + .sound(SoundType.WEEPING_VINES) + .pushReaction(PushReaction.DESTROY) ); public static final Block WEEPING_VINES_PLANT = register( "weeping_vines_plant", - new WeepingVinesPlantBlock( - BlockBehaviour.Properties.of().mapColor(MapColor.NETHER).noCollission().instabreak().sound(SoundType.WEEPING_VINES).pushReaction(PushReaction.DESTROY) - ) + WeepingVinesPlantBlock::new, + BlockBehaviour.Properties.of().mapColor(MapColor.NETHER).noCollission().instabreak().sound(SoundType.WEEPING_VINES).pushReaction(PushReaction.DESTROY) ); public static final Block TWISTING_VINES = register( "twisting_vines", - new TwistingVinesBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.COLOR_CYAN) - .randomTicks() - .noCollission() - .instabreak() - .sound(SoundType.WEEPING_VINES) - .pushReaction(PushReaction.DESTROY) - ) + TwistingVinesBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.COLOR_CYAN) + .randomTicks() + .noCollission() + .instabreak() + .sound(SoundType.WEEPING_VINES) + .pushReaction(PushReaction.DESTROY) ); public static final Block TWISTING_VINES_PLANT = register( "twisting_vines_plant", - new TwistingVinesPlantBlock( - BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_CYAN).noCollission().instabreak().sound(SoundType.WEEPING_VINES).pushReaction(PushReaction.DESTROY) - ) + TwistingVinesPlantBlock::new, + BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_CYAN).noCollission().instabreak().sound(SoundType.WEEPING_VINES).pushReaction(PushReaction.DESTROY) ); public static final Block CRIMSON_ROOTS = register( "crimson_roots", - new RootsBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.NETHER) - .replaceable() - .noCollission() - .instabreak() - .sound(SoundType.ROOTS) - .offsetType(BlockBehaviour.OffsetType.XZ) - .pushReaction(PushReaction.DESTROY) - ) + RootsBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.NETHER) + .replaceable() + .noCollission() + .instabreak() + .sound(SoundType.ROOTS) + .offsetType(BlockBehaviour.OffsetType.XZ) + .pushReaction(PushReaction.DESTROY) ); public static final Block CRIMSON_PLANKS = register( "crimson_planks", - new Block( - BlockBehaviour.Properties.of().mapColor(MapColor.CRIMSON_STEM).instrument(NoteBlockInstrument.BASS).strength(2.0F, 3.0F).sound(SoundType.NETHER_WOOD) - ) + BlockBehaviour.Properties.of().mapColor(MapColor.CRIMSON_STEM).instrument(NoteBlockInstrument.BASS).strength(2.0F, 3.0F).sound(SoundType.NETHER_WOOD) ); public static final Block WARPED_PLANKS = register( "warped_planks", - new Block( - BlockBehaviour.Properties.of().mapColor(MapColor.WARPED_STEM).instrument(NoteBlockInstrument.BASS).strength(2.0F, 3.0F).sound(SoundType.NETHER_WOOD) - ) + BlockBehaviour.Properties.of().mapColor(MapColor.WARPED_STEM).instrument(NoteBlockInstrument.BASS).strength(2.0F, 3.0F).sound(SoundType.NETHER_WOOD) ); public static final Block CRIMSON_SLAB = register( "crimson_slab", - new SlabBlock( - BlockBehaviour.Properties.of() - .mapColor(CRIMSON_PLANKS.defaultMapColor()) - .instrument(NoteBlockInstrument.BASS) - .strength(2.0F, 3.0F) - .sound(SoundType.NETHER_WOOD) - ) + SlabBlock::new, + BlockBehaviour.Properties.of() + .mapColor(CRIMSON_PLANKS.defaultMapColor()) + .instrument(NoteBlockInstrument.BASS) + .strength(2.0F, 3.0F) + .sound(SoundType.NETHER_WOOD) ); public static final Block WARPED_SLAB = register( "warped_slab", - new SlabBlock( - BlockBehaviour.Properties.of() - .mapColor(WARPED_PLANKS.defaultMapColor()) - .instrument(NoteBlockInstrument.BASS) - .strength(2.0F, 3.0F) - .sound(SoundType.NETHER_WOOD) - ) + SlabBlock::new, + BlockBehaviour.Properties.of() + .mapColor(WARPED_PLANKS.defaultMapColor()) + .instrument(NoteBlockInstrument.BASS) + .strength(2.0F, 3.0F) + .sound(SoundType.NETHER_WOOD) ); public static final Block CRIMSON_PRESSURE_PLATE = register( "crimson_pressure_plate", - new PressurePlateBlock( - BlockSetType.CRIMSON, - BlockBehaviour.Properties.of() - .mapColor(CRIMSON_PLANKS.defaultMapColor()) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASS) - .noCollission() - .strength(0.5F) - .pushReaction(PushReaction.DESTROY) - ) + properties -> new PressurePlateBlock(BlockSetType.CRIMSON, properties), + BlockBehaviour.Properties.of() + .mapColor(CRIMSON_PLANKS.defaultMapColor()) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASS) + .noCollission() + .strength(0.5F) + .pushReaction(PushReaction.DESTROY) ); public static final Block WARPED_PRESSURE_PLATE = register( "warped_pressure_plate", - new PressurePlateBlock( - BlockSetType.WARPED, - BlockBehaviour.Properties.of() - .mapColor(WARPED_PLANKS.defaultMapColor()) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASS) - .noCollission() - .strength(0.5F) - .pushReaction(PushReaction.DESTROY) - ) + properties -> new PressurePlateBlock(BlockSetType.WARPED, properties), + BlockBehaviour.Properties.of() + .mapColor(WARPED_PLANKS.defaultMapColor()) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASS) + .noCollission() + .strength(0.5F) + .pushReaction(PushReaction.DESTROY) ); public static final Block CRIMSON_FENCE = register( "crimson_fence", - new FenceBlock( - BlockBehaviour.Properties.of() - .mapColor(CRIMSON_PLANKS.defaultMapColor()) - .instrument(NoteBlockInstrument.BASS) - .strength(2.0F, 3.0F) - .sound(SoundType.NETHER_WOOD) - ) + FenceBlock::new, + BlockBehaviour.Properties.of() + .mapColor(CRIMSON_PLANKS.defaultMapColor()) + .instrument(NoteBlockInstrument.BASS) + .strength(2.0F, 3.0F) + .sound(SoundType.NETHER_WOOD) ); public static final Block WARPED_FENCE = register( "warped_fence", - new FenceBlock( - BlockBehaviour.Properties.of() - .mapColor(WARPED_PLANKS.defaultMapColor()) - .instrument(NoteBlockInstrument.BASS) - .strength(2.0F, 3.0F) - .sound(SoundType.NETHER_WOOD) - ) + FenceBlock::new, + BlockBehaviour.Properties.of() + .mapColor(WARPED_PLANKS.defaultMapColor()) + .instrument(NoteBlockInstrument.BASS) + .strength(2.0F, 3.0F) + .sound(SoundType.NETHER_WOOD) ); public static final Block CRIMSON_TRAPDOOR = register( "crimson_trapdoor", - new TrapDoorBlock( - BlockSetType.CRIMSON, - BlockBehaviour.Properties.of() - .mapColor(CRIMSON_PLANKS.defaultMapColor()) - .instrument(NoteBlockInstrument.BASS) - .strength(3.0F) - .noOcclusion() - .isValidSpawn(Blocks::never) - ) + properties -> new TrapDoorBlock(BlockSetType.CRIMSON, properties), + BlockBehaviour.Properties.of() + .mapColor(CRIMSON_PLANKS.defaultMapColor()) + .instrument(NoteBlockInstrument.BASS) + .strength(3.0F) + .noOcclusion() + .isValidSpawn(Blocks::never) ); public static final Block WARPED_TRAPDOOR = register( "warped_trapdoor", - new TrapDoorBlock( - BlockSetType.WARPED, - BlockBehaviour.Properties.of() - .mapColor(WARPED_PLANKS.defaultMapColor()) - .instrument(NoteBlockInstrument.BASS) - .strength(3.0F) - .noOcclusion() - .isValidSpawn(Blocks::never) - ) + properties -> new TrapDoorBlock(BlockSetType.WARPED, properties), + BlockBehaviour.Properties.of() + .mapColor(WARPED_PLANKS.defaultMapColor()) + .instrument(NoteBlockInstrument.BASS) + .strength(3.0F) + .noOcclusion() + .isValidSpawn(Blocks::never) ); public static final Block CRIMSON_FENCE_GATE = register( "crimson_fence_gate", - new FenceGateBlock( - WoodType.CRIMSON, - BlockBehaviour.Properties.of().mapColor(CRIMSON_PLANKS.defaultMapColor()).forceSolidOn().instrument(NoteBlockInstrument.BASS).strength(2.0F, 3.0F) - ) + properties -> new FenceGateBlock(WoodType.CRIMSON, properties), + BlockBehaviour.Properties.of().mapColor(CRIMSON_PLANKS.defaultMapColor()).forceSolidOn().instrument(NoteBlockInstrument.BASS).strength(2.0F, 3.0F) ); public static final Block WARPED_FENCE_GATE = register( "warped_fence_gate", - new FenceGateBlock( - WoodType.WARPED, - BlockBehaviour.Properties.of().mapColor(WARPED_PLANKS.defaultMapColor()).forceSolidOn().instrument(NoteBlockInstrument.BASS).strength(2.0F, 3.0F) - ) + properties -> new FenceGateBlock(WoodType.WARPED, properties), + BlockBehaviour.Properties.of().mapColor(WARPED_PLANKS.defaultMapColor()).forceSolidOn().instrument(NoteBlockInstrument.BASS).strength(2.0F, 3.0F) ); - public static final Block CRIMSON_STAIRS = register("crimson_stairs", legacyStair(CRIMSON_PLANKS)); - public static final Block WARPED_STAIRS = register("warped_stairs", legacyStair(WARPED_PLANKS)); - public static final Block CRIMSON_BUTTON = register("crimson_button", woodenButton(BlockSetType.CRIMSON)); - public static final Block WARPED_BUTTON = register("warped_button", woodenButton(BlockSetType.WARPED)); + public static final Block CRIMSON_STAIRS = registerLegacyStair("crimson_stairs", CRIMSON_PLANKS); + public static final Block WARPED_STAIRS = registerLegacyStair("warped_stairs", WARPED_PLANKS); + public static final Block CRIMSON_BUTTON = register("crimson_button", properties -> new ButtonBlock(BlockSetType.CRIMSON, 30, properties), buttonProperties()); + public static final Block WARPED_BUTTON = register("warped_button", properties -> new ButtonBlock(BlockSetType.WARPED, 30, properties), buttonProperties()); public static final Block CRIMSON_DOOR = register( "crimson_door", - new DoorBlock( - BlockSetType.CRIMSON, - BlockBehaviour.Properties.of() - .mapColor(CRIMSON_PLANKS.defaultMapColor()) - .instrument(NoteBlockInstrument.BASS) - .strength(3.0F) - .noOcclusion() - .pushReaction(PushReaction.DESTROY) - ) + properties -> new DoorBlock(BlockSetType.CRIMSON, properties), + BlockBehaviour.Properties.of() + .mapColor(CRIMSON_PLANKS.defaultMapColor()) + .instrument(NoteBlockInstrument.BASS) + .strength(3.0F) + .noOcclusion() + .pushReaction(PushReaction.DESTROY) ); public static final Block WARPED_DOOR = register( "warped_door", - new DoorBlock( - BlockSetType.WARPED, - BlockBehaviour.Properties.of() - .mapColor(WARPED_PLANKS.defaultMapColor()) - .instrument(NoteBlockInstrument.BASS) - .strength(3.0F) - .noOcclusion() - .pushReaction(PushReaction.DESTROY) - ) + properties -> new DoorBlock(BlockSetType.WARPED, properties), + BlockBehaviour.Properties.of() + .mapColor(WARPED_PLANKS.defaultMapColor()) + .instrument(NoteBlockInstrument.BASS) + .strength(3.0F) + .noOcclusion() + .pushReaction(PushReaction.DESTROY) ); public static final Block CRIMSON_SIGN = register( "crimson_sign", - new StandingSignBlock( - WoodType.CRIMSON, - BlockBehaviour.Properties.of().mapColor(CRIMSON_PLANKS.defaultMapColor()).instrument(NoteBlockInstrument.BASS).forceSolidOn().noCollission().strength(1.0F) - ) + properties -> new StandingSignBlock(WoodType.CRIMSON, properties), + BlockBehaviour.Properties.of().mapColor(CRIMSON_PLANKS.defaultMapColor()).instrument(NoteBlockInstrument.BASS).forceSolidOn().noCollission().strength(1.0F) ); public static final Block WARPED_SIGN = register( "warped_sign", - new StandingSignBlock( - WoodType.WARPED, - BlockBehaviour.Properties.of().mapColor(WARPED_PLANKS.defaultMapColor()).instrument(NoteBlockInstrument.BASS).forceSolidOn().noCollission().strength(1.0F) - ) + properties -> new StandingSignBlock(WoodType.WARPED, properties), + BlockBehaviour.Properties.of().mapColor(WARPED_PLANKS.defaultMapColor()).instrument(NoteBlockInstrument.BASS).forceSolidOn().noCollission().strength(1.0F) ); public static final Block CRIMSON_WALL_SIGN = register( "crimson_wall_sign", - new WallSignBlock( - WoodType.CRIMSON, - BlockBehaviour.Properties.of() - .mapColor(CRIMSON_PLANKS.defaultMapColor()) - .instrument(NoteBlockInstrument.BASS) - .forceSolidOn() - .noCollission() - .strength(1.0F) - .dropsLike(CRIMSON_SIGN) - ) + properties -> new WallSignBlock(WoodType.CRIMSON, properties), + wallVariant(CRIMSON_SIGN, true).mapColor(CRIMSON_PLANKS.defaultMapColor()).instrument(NoteBlockInstrument.BASS).forceSolidOn().noCollission().strength(1.0F) ); public static final Block WARPED_WALL_SIGN = register( "warped_wall_sign", - new WallSignBlock( - WoodType.WARPED, - BlockBehaviour.Properties.of() - .mapColor(WARPED_PLANKS.defaultMapColor()) - .instrument(NoteBlockInstrument.BASS) - .forceSolidOn() - .noCollission() - .strength(1.0F) - .dropsLike(WARPED_SIGN) - ) + properties -> new WallSignBlock(WoodType.WARPED, properties), + wallVariant(WARPED_SIGN, true).mapColor(WARPED_PLANKS.defaultMapColor()).instrument(NoteBlockInstrument.BASS).forceSolidOn().noCollission().strength(1.0F) ); public static final Block STRUCTURE_BLOCK = register( "structure_block", - new StructureBlock(BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_LIGHT_GRAY).requiresCorrectToolForDrops().strength(-1.0F, 3600000.0F).noLootTable()) + StructureBlock::new, + BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_LIGHT_GRAY).requiresCorrectToolForDrops().strength(-1.0F, 3600000.0F).noLootTable() ); public static final Block JIGSAW = register( "jigsaw", - new JigsawBlock(BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_LIGHT_GRAY).requiresCorrectToolForDrops().strength(-1.0F, 3600000.0F).noLootTable()) + JigsawBlock::new, + BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_LIGHT_GRAY).requiresCorrectToolForDrops().strength(-1.0F, 3600000.0F).noLootTable() ); public static final Block COMPOSTER = register( "composter", - new ComposterBlock( - BlockBehaviour.Properties.of().mapColor(MapColor.WOOD).instrument(NoteBlockInstrument.BASS).strength(0.6F).sound(SoundType.WOOD).ignitedByLava() - ) + ComposterBlock::new, + BlockBehaviour.Properties.of().mapColor(MapColor.WOOD).instrument(NoteBlockInstrument.BASS).strength(0.6F).sound(SoundType.WOOD).ignitedByLava() ); public static final Block TARGET = register( - "target", new TargetBlock(BlockBehaviour.Properties.of().mapColor(MapColor.QUARTZ).strength(0.5F).sound(SoundType.GRASS)) + "target", TargetBlock::new, BlockBehaviour.Properties.of().mapColor(MapColor.QUARTZ).strength(0.5F).sound(SoundType.GRASS) ); public static final Block BEE_NEST = register( "bee_nest", - new BeehiveBlock( - BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_YELLOW).instrument(NoteBlockInstrument.BASS).strength(0.3F).sound(SoundType.WOOD).ignitedByLava() - ) + BeehiveBlock::new, + BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_YELLOW).instrument(NoteBlockInstrument.BASS).strength(0.3F).sound(SoundType.WOOD).ignitedByLava() ); public static final Block BEEHIVE = register( "beehive", - new BeehiveBlock( - BlockBehaviour.Properties.of().mapColor(MapColor.WOOD).instrument(NoteBlockInstrument.BASS).strength(0.6F).sound(SoundType.WOOD).ignitedByLava() - ) + BeehiveBlock::new, + BlockBehaviour.Properties.of().mapColor(MapColor.WOOD).instrument(NoteBlockInstrument.BASS).strength(0.6F).sound(SoundType.WOOD).ignitedByLava() ); public static final Block HONEY_BLOCK = register( "honey_block", - new HoneyBlock(BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_ORANGE).speedFactor(0.4F).jumpFactor(0.5F).noOcclusion().sound(SoundType.HONEY_BLOCK)) + HoneyBlock::new, + BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_ORANGE).speedFactor(0.4F).jumpFactor(0.5F).noOcclusion().sound(SoundType.HONEY_BLOCK) ); public static final Block HONEYCOMB_BLOCK = register( - "honeycomb_block", new Block(BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_ORANGE).strength(0.6F).sound(SoundType.CORAL_BLOCK)) + "honeycomb_block", BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_ORANGE).strength(0.6F).sound(SoundType.CORAL_BLOCK) ); public static final Block NETHERITE_BLOCK = register( "netherite_block", - new Block( - BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_BLACK).requiresCorrectToolForDrops().strength(50.0F, 1200.0F).sound(SoundType.NETHERITE_BLOCK) - ) + BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_BLACK).requiresCorrectToolForDrops().strength(50.0F, 1200.0F).sound(SoundType.NETHERITE_BLOCK) ); public static final Block ANCIENT_DEBRIS = register( "ancient_debris", - new Block( - BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_BLACK).requiresCorrectToolForDrops().strength(30.0F, 1200.0F).sound(SoundType.ANCIENT_DEBRIS) - ) + BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_BLACK).requiresCorrectToolForDrops().strength(30.0F, 1200.0F).sound(SoundType.ANCIENT_DEBRIS) ); public static final Block CRYING_OBSIDIAN = register( "crying_obsidian", - new CryingObsidianBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.COLOR_BLACK) - .instrument(NoteBlockInstrument.BASEDRUM) - .requiresCorrectToolForDrops() - .strength(50.0F, 1200.0F) - .lightLevel(blockStatex -> 10) - ) + CryingObsidianBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.COLOR_BLACK) + .instrument(NoteBlockInstrument.BASEDRUM) + .requiresCorrectToolForDrops() + .strength(50.0F, 1200.0F) + .lightLevel(blockStatex -> 10) ); public static final Block RESPAWN_ANCHOR = register( "respawn_anchor", - new RespawnAnchorBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.COLOR_BLACK) - .instrument(NoteBlockInstrument.BASEDRUM) - .requiresCorrectToolForDrops() - .strength(50.0F, 1200.0F) - .lightLevel(blockStatex -> RespawnAnchorBlock.getScaledChargeLevel(blockStatex, 15)) - ) + RespawnAnchorBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.COLOR_BLACK) + .instrument(NoteBlockInstrument.BASEDRUM) + .requiresCorrectToolForDrops() + .strength(50.0F, 1200.0F) + .lightLevel(blockStatex -> RespawnAnchorBlock.getScaledChargeLevel(blockStatex, 15)) + ); + public static final Block POTTED_CRIMSON_FUNGUS = register( + "potted_crimson_fungus", properties -> new FlowerPotBlock(CRIMSON_FUNGUS, properties), flowerPotProperties() + ); + public static final Block POTTED_WARPED_FUNGUS = register( + "potted_warped_fungus", properties -> new FlowerPotBlock(WARPED_FUNGUS, properties), flowerPotProperties() + ); + public static final Block POTTED_CRIMSON_ROOTS = register( + "potted_crimson_roots", properties -> new FlowerPotBlock(CRIMSON_ROOTS, properties), flowerPotProperties() + ); + public static final Block POTTED_WARPED_ROOTS = register( + "potted_warped_roots", properties -> new FlowerPotBlock(WARPED_ROOTS, properties), flowerPotProperties() ); - public static final Block POTTED_CRIMSON_FUNGUS = register("potted_crimson_fungus", flowerPot(CRIMSON_FUNGUS)); - public static final Block POTTED_WARPED_FUNGUS = register("potted_warped_fungus", flowerPot(WARPED_FUNGUS)); - public static final Block POTTED_CRIMSON_ROOTS = register("potted_crimson_roots", flowerPot(CRIMSON_ROOTS)); - public static final Block POTTED_WARPED_ROOTS = register("potted_warped_roots", flowerPot(WARPED_ROOTS)); public static final Block LODESTONE = register( "lodestone", - new Block( - BlockBehaviour.Properties.of() - .mapColor(MapColor.METAL) - .requiresCorrectToolForDrops() - .strength(3.5F) - .sound(SoundType.LODESTONE) - .pushReaction(PushReaction.BLOCK) - ) + BlockBehaviour.Properties.of() + .mapColor(MapColor.METAL) + .requiresCorrectToolForDrops() + .strength(3.5F) + .sound(SoundType.LODESTONE) + .pushReaction(PushReaction.BLOCK) ); public static final Block BLACKSTONE = register( "blackstone", - new Block( - BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_BLACK).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(1.5F, 6.0F) - ) + BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_BLACK).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(1.5F, 6.0F) ); - public static final Block BLACKSTONE_STAIRS = register("blackstone_stairs", legacyStair(BLACKSTONE)); - public static final Block BLACKSTONE_WALL = register("blackstone_wall", new WallBlock(BlockBehaviour.Properties.ofLegacyCopy(BLACKSTONE).forceSolidOn())); - public static final Block BLACKSTONE_SLAB = register("blackstone_slab", new SlabBlock(BlockBehaviour.Properties.ofLegacyCopy(BLACKSTONE).strength(2.0F, 6.0F))); - public static final Block POLISHED_BLACKSTONE = register( - "polished_blackstone", new Block(BlockBehaviour.Properties.ofLegacyCopy(BLACKSTONE).strength(2.0F, 6.0F)) + public static final Block BLACKSTONE_STAIRS = registerLegacyStair("blackstone_stairs", BLACKSTONE); + public static final Block BLACKSTONE_WALL = register("blackstone_wall", WallBlock::new, BlockBehaviour.Properties.ofLegacyCopy(BLACKSTONE).forceSolidOn()); + public static final Block BLACKSTONE_SLAB = register( + "blackstone_slab", SlabBlock::new, BlockBehaviour.Properties.ofLegacyCopy(BLACKSTONE).strength(2.0F, 6.0F) ); + public static final Block POLISHED_BLACKSTONE = register("polished_blackstone", BlockBehaviour.Properties.ofLegacyCopy(BLACKSTONE).strength(2.0F, 6.0F)); public static final Block POLISHED_BLACKSTONE_BRICKS = register( - "polished_blackstone_bricks", new Block(BlockBehaviour.Properties.ofLegacyCopy(POLISHED_BLACKSTONE).strength(1.5F, 6.0F)) + "polished_blackstone_bricks", BlockBehaviour.Properties.ofLegacyCopy(POLISHED_BLACKSTONE).strength(1.5F, 6.0F) ); public static final Block CRACKED_POLISHED_BLACKSTONE_BRICKS = register( - "cracked_polished_blackstone_bricks", new Block(BlockBehaviour.Properties.ofLegacyCopy(POLISHED_BLACKSTONE_BRICKS)) + "cracked_polished_blackstone_bricks", BlockBehaviour.Properties.ofLegacyCopy(POLISHED_BLACKSTONE_BRICKS) ); public static final Block CHISELED_POLISHED_BLACKSTONE = register( - "chiseled_polished_blackstone", new Block(BlockBehaviour.Properties.ofLegacyCopy(POLISHED_BLACKSTONE).strength(1.5F, 6.0F)) + "chiseled_polished_blackstone", BlockBehaviour.Properties.ofLegacyCopy(POLISHED_BLACKSTONE).strength(1.5F, 6.0F) ); public static final Block POLISHED_BLACKSTONE_BRICK_SLAB = register( - "polished_blackstone_brick_slab", new SlabBlock(BlockBehaviour.Properties.ofLegacyCopy(POLISHED_BLACKSTONE_BRICKS).strength(2.0F, 6.0F)) + "polished_blackstone_brick_slab", SlabBlock::new, BlockBehaviour.Properties.ofLegacyCopy(POLISHED_BLACKSTONE_BRICKS).strength(2.0F, 6.0F) ); - public static final Block POLISHED_BLACKSTONE_BRICK_STAIRS = register("polished_blackstone_brick_stairs", legacyStair(POLISHED_BLACKSTONE_BRICKS)); + public static final Block POLISHED_BLACKSTONE_BRICK_STAIRS = registerLegacyStair("polished_blackstone_brick_stairs", POLISHED_BLACKSTONE_BRICKS); public static final Block POLISHED_BLACKSTONE_BRICK_WALL = register( - "polished_blackstone_brick_wall", new WallBlock(BlockBehaviour.Properties.ofLegacyCopy(POLISHED_BLACKSTONE_BRICKS).forceSolidOn()) + "polished_blackstone_brick_wall", WallBlock::new, BlockBehaviour.Properties.ofLegacyCopy(POLISHED_BLACKSTONE_BRICKS).forceSolidOn() ); public static final Block GILDED_BLACKSTONE = register( - "gilded_blackstone", new Block(BlockBehaviour.Properties.ofLegacyCopy(BLACKSTONE).sound(SoundType.GILDED_BLACKSTONE)) + "gilded_blackstone", BlockBehaviour.Properties.ofLegacyCopy(BLACKSTONE).sound(SoundType.GILDED_BLACKSTONE) ); - public static final Block POLISHED_BLACKSTONE_STAIRS = register("polished_blackstone_stairs", legacyStair(POLISHED_BLACKSTONE)); + public static final Block POLISHED_BLACKSTONE_STAIRS = registerLegacyStair("polished_blackstone_stairs", POLISHED_BLACKSTONE); public static final Block POLISHED_BLACKSTONE_SLAB = register( - "polished_blackstone_slab", new SlabBlock(BlockBehaviour.Properties.ofLegacyCopy(POLISHED_BLACKSTONE)) + "polished_blackstone_slab", SlabBlock::new, BlockBehaviour.Properties.ofLegacyCopy(POLISHED_BLACKSTONE) ); public static final Block POLISHED_BLACKSTONE_PRESSURE_PLATE = register( "polished_blackstone_pressure_plate", - new PressurePlateBlock( - BlockSetType.POLISHED_BLACKSTONE, - BlockBehaviour.Properties.of() - .mapColor(MapColor.COLOR_BLACK) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASEDRUM) - .requiresCorrectToolForDrops() - .noCollission() - .strength(0.5F) - .pushReaction(PushReaction.DESTROY) - ) + properties -> new PressurePlateBlock(BlockSetType.POLISHED_BLACKSTONE, properties), + BlockBehaviour.Properties.of() + .mapColor(MapColor.COLOR_BLACK) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASEDRUM) + .requiresCorrectToolForDrops() + .noCollission() + .strength(0.5F) + .pushReaction(PushReaction.DESTROY) + ); + public static final Block POLISHED_BLACKSTONE_BUTTON = register( + "polished_blackstone_button", properties -> new ButtonBlock(BlockSetType.STONE, 20, properties), buttonProperties() ); - public static final Block POLISHED_BLACKSTONE_BUTTON = register("polished_blackstone_button", stoneButton()); public static final Block POLISHED_BLACKSTONE_WALL = register( - "polished_blackstone_wall", new WallBlock(BlockBehaviour.Properties.ofLegacyCopy(POLISHED_BLACKSTONE).forceSolidOn()) + "polished_blackstone_wall", WallBlock::new, BlockBehaviour.Properties.ofLegacyCopy(POLISHED_BLACKSTONE).forceSolidOn() ); public static final Block CHISELED_NETHER_BRICKS = register( "chiseled_nether_bricks", - new Block( - BlockBehaviour.Properties.of() - .mapColor(MapColor.NETHER) - .instrument(NoteBlockInstrument.BASEDRUM) - .requiresCorrectToolForDrops() - .strength(2.0F, 6.0F) - .sound(SoundType.NETHER_BRICKS) - ) + BlockBehaviour.Properties.of() + .mapColor(MapColor.NETHER) + .instrument(NoteBlockInstrument.BASEDRUM) + .requiresCorrectToolForDrops() + .strength(2.0F, 6.0F) + .sound(SoundType.NETHER_BRICKS) ); public static final Block CRACKED_NETHER_BRICKS = register( "cracked_nether_bricks", - new Block( - BlockBehaviour.Properties.of() - .mapColor(MapColor.NETHER) - .instrument(NoteBlockInstrument.BASEDRUM) - .requiresCorrectToolForDrops() - .strength(2.0F, 6.0F) - .sound(SoundType.NETHER_BRICKS) - ) + BlockBehaviour.Properties.of() + .mapColor(MapColor.NETHER) + .instrument(NoteBlockInstrument.BASEDRUM) + .requiresCorrectToolForDrops() + .strength(2.0F, 6.0F) + .sound(SoundType.NETHER_BRICKS) ); - public static final Block QUARTZ_BRICKS = register("quartz_bricks", new Block(BlockBehaviour.Properties.ofLegacyCopy(QUARTZ_BLOCK))); - public static final Block CANDLE = register("candle", candle(MapColor.SAND)); - public static final Block WHITE_CANDLE = register("white_candle", candle(MapColor.WOOL)); - public static final Block ORANGE_CANDLE = register("orange_candle", candle(MapColor.COLOR_ORANGE)); - public static final Block MAGENTA_CANDLE = register("magenta_candle", candle(MapColor.COLOR_MAGENTA)); - public static final Block LIGHT_BLUE_CANDLE = register("light_blue_candle", candle(MapColor.COLOR_LIGHT_BLUE)); - public static final Block YELLOW_CANDLE = register("yellow_candle", candle(MapColor.COLOR_YELLOW)); - public static final Block LIME_CANDLE = register("lime_candle", candle(MapColor.COLOR_LIGHT_GREEN)); - public static final Block PINK_CANDLE = register("pink_candle", candle(MapColor.COLOR_PINK)); - public static final Block GRAY_CANDLE = register("gray_candle", candle(MapColor.COLOR_GRAY)); - public static final Block LIGHT_GRAY_CANDLE = register("light_gray_candle", candle(MapColor.COLOR_LIGHT_GRAY)); - public static final Block CYAN_CANDLE = register("cyan_candle", candle(MapColor.COLOR_CYAN)); - public static final Block PURPLE_CANDLE = register("purple_candle", candle(MapColor.COLOR_PURPLE)); - public static final Block BLUE_CANDLE = register("blue_candle", candle(MapColor.COLOR_BLUE)); - public static final Block BROWN_CANDLE = register("brown_candle", candle(MapColor.COLOR_BROWN)); - public static final Block GREEN_CANDLE = register("green_candle", candle(MapColor.COLOR_GREEN)); - public static final Block RED_CANDLE = register("red_candle", candle(MapColor.COLOR_RED)); - public static final Block BLACK_CANDLE = register("black_candle", candle(MapColor.COLOR_BLACK)); + public static final Block QUARTZ_BRICKS = register("quartz_bricks", BlockBehaviour.Properties.ofLegacyCopy(QUARTZ_BLOCK)); + public static final Block CANDLE = register("candle", CandleBlock::new, candleProperties(MapColor.SAND)); + public static final Block WHITE_CANDLE = register("white_candle", CandleBlock::new, candleProperties(MapColor.WOOL)); + public static final Block ORANGE_CANDLE = register("orange_candle", CandleBlock::new, candleProperties(MapColor.COLOR_ORANGE)); + public static final Block MAGENTA_CANDLE = register("magenta_candle", CandleBlock::new, candleProperties(MapColor.COLOR_MAGENTA)); + public static final Block LIGHT_BLUE_CANDLE = register("light_blue_candle", CandleBlock::new, candleProperties(MapColor.COLOR_LIGHT_BLUE)); + public static final Block YELLOW_CANDLE = register("yellow_candle", CandleBlock::new, candleProperties(MapColor.COLOR_YELLOW)); + public static final Block LIME_CANDLE = register("lime_candle", CandleBlock::new, candleProperties(MapColor.COLOR_LIGHT_GREEN)); + public static final Block PINK_CANDLE = register("pink_candle", CandleBlock::new, candleProperties(MapColor.COLOR_PINK)); + public static final Block GRAY_CANDLE = register("gray_candle", CandleBlock::new, candleProperties(MapColor.COLOR_GRAY)); + public static final Block LIGHT_GRAY_CANDLE = register("light_gray_candle", CandleBlock::new, candleProperties(MapColor.COLOR_LIGHT_GRAY)); + public static final Block CYAN_CANDLE = register("cyan_candle", CandleBlock::new, candleProperties(MapColor.COLOR_CYAN)); + public static final Block PURPLE_CANDLE = register("purple_candle", CandleBlock::new, candleProperties(MapColor.COLOR_PURPLE)); + public static final Block BLUE_CANDLE = register("blue_candle", CandleBlock::new, candleProperties(MapColor.COLOR_BLUE)); + public static final Block BROWN_CANDLE = register("brown_candle", CandleBlock::new, candleProperties(MapColor.COLOR_BROWN)); + public static final Block GREEN_CANDLE = register("green_candle", CandleBlock::new, candleProperties(MapColor.COLOR_GREEN)); + public static final Block RED_CANDLE = register("red_candle", CandleBlock::new, candleProperties(MapColor.COLOR_RED)); + public static final Block BLACK_CANDLE = register("black_candle", CandleBlock::new, candleProperties(MapColor.COLOR_BLACK)); public static final Block CANDLE_CAKE = register( - "candle_cake", new CandleCakeBlock(CANDLE, BlockBehaviour.Properties.ofLegacyCopy(CAKE).lightLevel(litBlockEmission(3))) + "candle_cake", properties -> new CandleCakeBlock(CANDLE, properties), BlockBehaviour.Properties.ofLegacyCopy(CAKE).lightLevel(litBlockEmission(3)) ); public static final Block WHITE_CANDLE_CAKE = register( - "white_candle_cake", new CandleCakeBlock(WHITE_CANDLE, BlockBehaviour.Properties.ofLegacyCopy(CANDLE_CAKE)) + "white_candle_cake", properties -> new CandleCakeBlock(WHITE_CANDLE, properties), BlockBehaviour.Properties.ofLegacyCopy(CANDLE_CAKE) ); public static final Block ORANGE_CANDLE_CAKE = register( - "orange_candle_cake", new CandleCakeBlock(ORANGE_CANDLE, BlockBehaviour.Properties.ofLegacyCopy(CANDLE_CAKE)) + "orange_candle_cake", properties -> new CandleCakeBlock(ORANGE_CANDLE, properties), BlockBehaviour.Properties.ofLegacyCopy(CANDLE_CAKE) ); public static final Block MAGENTA_CANDLE_CAKE = register( - "magenta_candle_cake", new CandleCakeBlock(MAGENTA_CANDLE, BlockBehaviour.Properties.ofLegacyCopy(CANDLE_CAKE)) + "magenta_candle_cake", properties -> new CandleCakeBlock(MAGENTA_CANDLE, properties), BlockBehaviour.Properties.ofLegacyCopy(CANDLE_CAKE) ); public static final Block LIGHT_BLUE_CANDLE_CAKE = register( - "light_blue_candle_cake", new CandleCakeBlock(LIGHT_BLUE_CANDLE, BlockBehaviour.Properties.ofLegacyCopy(CANDLE_CAKE)) + "light_blue_candle_cake", properties -> new CandleCakeBlock(LIGHT_BLUE_CANDLE, properties), BlockBehaviour.Properties.ofLegacyCopy(CANDLE_CAKE) ); public static final Block YELLOW_CANDLE_CAKE = register( - "yellow_candle_cake", new CandleCakeBlock(YELLOW_CANDLE, BlockBehaviour.Properties.ofLegacyCopy(CANDLE_CAKE)) + "yellow_candle_cake", properties -> new CandleCakeBlock(YELLOW_CANDLE, properties), BlockBehaviour.Properties.ofLegacyCopy(CANDLE_CAKE) ); public static final Block LIME_CANDLE_CAKE = register( - "lime_candle_cake", new CandleCakeBlock(LIME_CANDLE, BlockBehaviour.Properties.ofLegacyCopy(CANDLE_CAKE)) + "lime_candle_cake", properties -> new CandleCakeBlock(LIME_CANDLE, properties), BlockBehaviour.Properties.ofLegacyCopy(CANDLE_CAKE) ); public static final Block PINK_CANDLE_CAKE = register( - "pink_candle_cake", new CandleCakeBlock(PINK_CANDLE, BlockBehaviour.Properties.ofLegacyCopy(CANDLE_CAKE)) + "pink_candle_cake", properties -> new CandleCakeBlock(PINK_CANDLE, properties), BlockBehaviour.Properties.ofLegacyCopy(CANDLE_CAKE) ); public static final Block GRAY_CANDLE_CAKE = register( - "gray_candle_cake", new CandleCakeBlock(GRAY_CANDLE, BlockBehaviour.Properties.ofLegacyCopy(CANDLE_CAKE)) + "gray_candle_cake", properties -> new CandleCakeBlock(GRAY_CANDLE, properties), BlockBehaviour.Properties.ofLegacyCopy(CANDLE_CAKE) ); public static final Block LIGHT_GRAY_CANDLE_CAKE = register( - "light_gray_candle_cake", new CandleCakeBlock(LIGHT_GRAY_CANDLE, BlockBehaviour.Properties.ofLegacyCopy(CANDLE_CAKE)) + "light_gray_candle_cake", properties -> new CandleCakeBlock(LIGHT_GRAY_CANDLE, properties), BlockBehaviour.Properties.ofLegacyCopy(CANDLE_CAKE) ); public static final Block CYAN_CANDLE_CAKE = register( - "cyan_candle_cake", new CandleCakeBlock(CYAN_CANDLE, BlockBehaviour.Properties.ofLegacyCopy(CANDLE_CAKE)) + "cyan_candle_cake", properties -> new CandleCakeBlock(CYAN_CANDLE, properties), BlockBehaviour.Properties.ofLegacyCopy(CANDLE_CAKE) ); public static final Block PURPLE_CANDLE_CAKE = register( - "purple_candle_cake", new CandleCakeBlock(PURPLE_CANDLE, BlockBehaviour.Properties.ofLegacyCopy(CANDLE_CAKE)) + "purple_candle_cake", properties -> new CandleCakeBlock(PURPLE_CANDLE, properties), BlockBehaviour.Properties.ofLegacyCopy(CANDLE_CAKE) ); public static final Block BLUE_CANDLE_CAKE = register( - "blue_candle_cake", new CandleCakeBlock(BLUE_CANDLE, BlockBehaviour.Properties.ofLegacyCopy(CANDLE_CAKE)) + "blue_candle_cake", properties -> new CandleCakeBlock(BLUE_CANDLE, properties), BlockBehaviour.Properties.ofLegacyCopy(CANDLE_CAKE) ); public static final Block BROWN_CANDLE_CAKE = register( - "brown_candle_cake", new CandleCakeBlock(BROWN_CANDLE, BlockBehaviour.Properties.ofLegacyCopy(CANDLE_CAKE)) + "brown_candle_cake", properties -> new CandleCakeBlock(BROWN_CANDLE, properties), BlockBehaviour.Properties.ofLegacyCopy(CANDLE_CAKE) ); public static final Block GREEN_CANDLE_CAKE = register( - "green_candle_cake", new CandleCakeBlock(GREEN_CANDLE, BlockBehaviour.Properties.ofLegacyCopy(CANDLE_CAKE)) + "green_candle_cake", properties -> new CandleCakeBlock(GREEN_CANDLE, properties), BlockBehaviour.Properties.ofLegacyCopy(CANDLE_CAKE) + ); + public static final Block RED_CANDLE_CAKE = register( + "red_candle_cake", properties -> new CandleCakeBlock(RED_CANDLE, properties), BlockBehaviour.Properties.ofLegacyCopy(CANDLE_CAKE) ); - public static final Block RED_CANDLE_CAKE = register("red_candle_cake", new CandleCakeBlock(RED_CANDLE, BlockBehaviour.Properties.ofLegacyCopy(CANDLE_CAKE))); public static final Block BLACK_CANDLE_CAKE = register( - "black_candle_cake", new CandleCakeBlock(BLACK_CANDLE, BlockBehaviour.Properties.ofLegacyCopy(CANDLE_CAKE)) + "black_candle_cake", properties -> new CandleCakeBlock(BLACK_CANDLE, properties), BlockBehaviour.Properties.ofLegacyCopy(CANDLE_CAKE) ); public static final Block AMETHYST_BLOCK = register( "amethyst_block", - new AmethystBlock(BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_PURPLE).strength(1.5F).sound(SoundType.AMETHYST).requiresCorrectToolForDrops()) + AmethystBlock::new, + BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_PURPLE).strength(1.5F).sound(SoundType.AMETHYST).requiresCorrectToolForDrops() ); public static final Block BUDDING_AMETHYST = register( "budding_amethyst", - new BuddingAmethystBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.COLOR_PURPLE) - .randomTicks() - .strength(1.5F) - .sound(SoundType.AMETHYST) - .requiresCorrectToolForDrops() - .pushReaction(PushReaction.DESTROY) - ) + BuddingAmethystBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.COLOR_PURPLE) + .randomTicks() + .strength(1.5F) + .sound(SoundType.AMETHYST) + .requiresCorrectToolForDrops() + .pushReaction(PushReaction.DESTROY) ); public static final Block AMETHYST_CLUSTER = register( "amethyst_cluster", - new AmethystClusterBlock( - 7.0F, - 3.0F, - BlockBehaviour.Properties.of() - .mapColor(MapColor.COLOR_PURPLE) - .forceSolidOn() - .noOcclusion() - .sound(SoundType.AMETHYST_CLUSTER) - .strength(1.5F) - .lightLevel(blockStatex -> 5) - .pushReaction(PushReaction.DESTROY) - ) + properties -> new AmethystClusterBlock(7.0F, 3.0F, properties), + BlockBehaviour.Properties.of() + .mapColor(MapColor.COLOR_PURPLE) + .forceSolidOn() + .noOcclusion() + .sound(SoundType.AMETHYST_CLUSTER) + .strength(1.5F) + .lightLevel(blockStatex -> 5) + .pushReaction(PushReaction.DESTROY) ); public static final Block LARGE_AMETHYST_BUD = register( "large_amethyst_bud", - new AmethystClusterBlock( - 5.0F, 3.0F, BlockBehaviour.Properties.ofLegacyCopy(AMETHYST_CLUSTER).sound(SoundType.MEDIUM_AMETHYST_BUD).lightLevel(blockStatex -> 4) - ) + properties -> new AmethystClusterBlock(5.0F, 3.0F, properties), + BlockBehaviour.Properties.ofLegacyCopy(AMETHYST_CLUSTER).sound(SoundType.MEDIUM_AMETHYST_BUD).lightLevel(blockStatex -> 4) ); public static final Block MEDIUM_AMETHYST_BUD = register( "medium_amethyst_bud", - new AmethystClusterBlock( - 4.0F, 3.0F, BlockBehaviour.Properties.ofLegacyCopy(AMETHYST_CLUSTER).sound(SoundType.LARGE_AMETHYST_BUD).lightLevel(blockStatex -> 2) - ) + properties -> new AmethystClusterBlock(4.0F, 3.0F, properties), + BlockBehaviour.Properties.ofLegacyCopy(AMETHYST_CLUSTER).sound(SoundType.LARGE_AMETHYST_BUD).lightLevel(blockStatex -> 2) ); public static final Block SMALL_AMETHYST_BUD = register( "small_amethyst_bud", - new AmethystClusterBlock( - 3.0F, 4.0F, BlockBehaviour.Properties.ofLegacyCopy(AMETHYST_CLUSTER).sound(SoundType.SMALL_AMETHYST_BUD).lightLevel(blockStatex -> 1) - ) + properties -> new AmethystClusterBlock(3.0F, 4.0F, properties), + BlockBehaviour.Properties.ofLegacyCopy(AMETHYST_CLUSTER).sound(SoundType.SMALL_AMETHYST_BUD).lightLevel(blockStatex -> 1) ); public static final Block TUFF = register( "tuff", - new Block( - BlockBehaviour.Properties.of() - .mapColor(MapColor.TERRACOTTA_GRAY) - .instrument(NoteBlockInstrument.BASEDRUM) - .sound(SoundType.TUFF) - .requiresCorrectToolForDrops() - .strength(1.5F, 6.0F) - ) + BlockBehaviour.Properties.of() + .mapColor(MapColor.TERRACOTTA_GRAY) + .instrument(NoteBlockInstrument.BASEDRUM) + .sound(SoundType.TUFF) + .requiresCorrectToolForDrops() + .strength(1.5F, 6.0F) ); - public static final Block TUFF_SLAB = register("tuff_slab", new SlabBlock(BlockBehaviour.Properties.ofLegacyCopy(TUFF))); - public static final Block TUFF_STAIRS = register("tuff_stairs", new StairBlock(TUFF.defaultBlockState(), BlockBehaviour.Properties.ofLegacyCopy(TUFF))); - public static final Block TUFF_WALL = register("tuff_wall", new WallBlock(BlockBehaviour.Properties.ofLegacyCopy(TUFF).forceSolidOn())); - public static final Block POLISHED_TUFF = register("polished_tuff", new Block(BlockBehaviour.Properties.ofLegacyCopy(TUFF).sound(SoundType.POLISHED_TUFF))); - public static final Block POLISHED_TUFF_SLAB = register("polished_tuff_slab", new SlabBlock(BlockBehaviour.Properties.ofLegacyCopy(POLISHED_TUFF))); + public static final Block TUFF_SLAB = register("tuff_slab", SlabBlock::new, BlockBehaviour.Properties.ofLegacyCopy(TUFF)); + public static final Block TUFF_STAIRS = register( + "tuff_stairs", properties -> new StairBlock(TUFF.defaultBlockState(), properties), BlockBehaviour.Properties.ofLegacyCopy(TUFF) + ); + public static final Block TUFF_WALL = register("tuff_wall", WallBlock::new, BlockBehaviour.Properties.ofLegacyCopy(TUFF).forceSolidOn()); + public static final Block POLISHED_TUFF = register("polished_tuff", BlockBehaviour.Properties.ofLegacyCopy(TUFF).sound(SoundType.POLISHED_TUFF)); + public static final Block POLISHED_TUFF_SLAB = register("polished_tuff_slab", SlabBlock::new, BlockBehaviour.Properties.ofLegacyCopy(POLISHED_TUFF)); public static final Block POLISHED_TUFF_STAIRS = register( - "polished_tuff_stairs", new StairBlock(POLISHED_TUFF.defaultBlockState(), BlockBehaviour.Properties.ofLegacyCopy(POLISHED_TUFF)) + "polished_tuff_stairs", properties -> new StairBlock(POLISHED_TUFF.defaultBlockState(), properties), BlockBehaviour.Properties.ofLegacyCopy(POLISHED_TUFF) ); public static final Block POLISHED_TUFF_WALL = register( - "polished_tuff_wall", new WallBlock(BlockBehaviour.Properties.ofLegacyCopy(POLISHED_TUFF).forceSolidOn()) + "polished_tuff_wall", WallBlock::new, BlockBehaviour.Properties.ofLegacyCopy(POLISHED_TUFF).forceSolidOn() ); - public static final Block CHISELED_TUFF = register("chiseled_tuff", new Block(BlockBehaviour.Properties.ofLegacyCopy(TUFF))); - public static final Block TUFF_BRICKS = register("tuff_bricks", new Block(BlockBehaviour.Properties.ofLegacyCopy(TUFF).sound(SoundType.TUFF_BRICKS))); - public static final Block TUFF_BRICK_SLAB = register("tuff_brick_slab", new SlabBlock(BlockBehaviour.Properties.ofLegacyCopy(TUFF_BRICKS))); + public static final Block CHISELED_TUFF = register("chiseled_tuff", BlockBehaviour.Properties.ofLegacyCopy(TUFF)); + public static final Block TUFF_BRICKS = register("tuff_bricks", BlockBehaviour.Properties.ofLegacyCopy(TUFF).sound(SoundType.TUFF_BRICKS)); + public static final Block TUFF_BRICK_SLAB = register("tuff_brick_slab", SlabBlock::new, BlockBehaviour.Properties.ofLegacyCopy(TUFF_BRICKS)); public static final Block TUFF_BRICK_STAIRS = register( - "tuff_brick_stairs", new StairBlock(TUFF_BRICKS.defaultBlockState(), BlockBehaviour.Properties.ofLegacyCopy(TUFF_BRICKS)) + "tuff_brick_stairs", properties -> new StairBlock(TUFF_BRICKS.defaultBlockState(), properties), BlockBehaviour.Properties.ofLegacyCopy(TUFF_BRICKS) ); - public static final Block TUFF_BRICK_WALL = register("tuff_brick_wall", new WallBlock(BlockBehaviour.Properties.ofLegacyCopy(TUFF_BRICKS).forceSolidOn())); - public static final Block CHISELED_TUFF_BRICKS = register("chiseled_tuff_bricks", new Block(BlockBehaviour.Properties.ofLegacyCopy(TUFF_BRICKS))); + public static final Block TUFF_BRICK_WALL = register("tuff_brick_wall", WallBlock::new, BlockBehaviour.Properties.ofLegacyCopy(TUFF_BRICKS).forceSolidOn()); + public static final Block CHISELED_TUFF_BRICKS = register("chiseled_tuff_bricks", BlockBehaviour.Properties.ofLegacyCopy(TUFF_BRICKS)); public static final Block CALCITE = register( "calcite", - new Block( - BlockBehaviour.Properties.of() - .mapColor(MapColor.TERRACOTTA_WHITE) - .instrument(NoteBlockInstrument.BASEDRUM) - .sound(SoundType.CALCITE) - .requiresCorrectToolForDrops() - .strength(0.75F) - ) + BlockBehaviour.Properties.of() + .mapColor(MapColor.TERRACOTTA_WHITE) + .instrument(NoteBlockInstrument.BASEDRUM) + .sound(SoundType.CALCITE) + .requiresCorrectToolForDrops() + .strength(0.75F) ); public static final Block TINTED_GLASS = register( "tinted_glass", - new TintedGlassBlock( - BlockBehaviour.Properties.ofLegacyCopy(GLASS) - .mapColor(MapColor.COLOR_GRAY) - .noOcclusion() - .isValidSpawn(Blocks::never) - .isRedstoneConductor(Blocks::never) - .isSuffocating(Blocks::never) - .isViewBlocking(Blocks::never) - ) + TintedGlassBlock::new, + BlockBehaviour.Properties.ofLegacyCopy(GLASS) + .mapColor(MapColor.COLOR_GRAY) + .noOcclusion() + .isValidSpawn(Blocks::never) + .isRedstoneConductor(Blocks::never) + .isSuffocating(Blocks::never) + .isViewBlocking(Blocks::never) ); public static final Block POWDER_SNOW = register( "powder_snow", - new PowderSnowBlock( - BlockBehaviour.Properties.of().mapColor(MapColor.SNOW).strength(0.25F).sound(SoundType.POWDER_SNOW).dynamicShape().isRedstoneConductor(Blocks::never) - ) + PowderSnowBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.SNOW) + .strength(0.25F) + .sound(SoundType.POWDER_SNOW) + .dynamicShape() + .noOcclusion() + .isRedstoneConductor(Blocks::never) ); public static final Block SCULK_SENSOR = register( "sculk_sensor", - new SculkSensorBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.COLOR_CYAN) - .strength(1.5F) - .sound(SoundType.SCULK_SENSOR) - .lightLevel(blockStatex -> 1) - .emissiveRendering((blockStatex, blockGetter, blockPos) -> SculkSensorBlock.getPhase(blockStatex) == SculkSensorPhase.ACTIVE) - ) + SculkSensorBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.COLOR_CYAN) + .strength(1.5F) + .sound(SoundType.SCULK_SENSOR) + .lightLevel(blockStatex -> 1) + .emissiveRendering((blockStatex, blockGetter, blockPos) -> SculkSensorBlock.getPhase(blockStatex) == SculkSensorPhase.ACTIVE) ); public static final Block CALIBRATED_SCULK_SENSOR = register( - "calibrated_sculk_sensor", new CalibratedSculkSensorBlock(BlockBehaviour.Properties.ofLegacyCopy(SCULK_SENSOR)) + "calibrated_sculk_sensor", CalibratedSculkSensorBlock::new, BlockBehaviour.Properties.ofLegacyCopy(SCULK_SENSOR) ); public static final Block SCULK = register( - "sculk", new SculkBlock(BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_BLACK).strength(0.2F).sound(SoundType.SCULK)) + "sculk", SculkBlock::new, BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_BLACK).strength(0.2F).sound(SoundType.SCULK) ); public static final Block SCULK_VEIN = register( "sculk_vein", - new SculkVeinBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.COLOR_BLACK) - .forceSolidOn() - .noCollission() - .strength(0.2F) - .sound(SoundType.SCULK_VEIN) - .pushReaction(PushReaction.DESTROY) - ) + SculkVeinBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.COLOR_BLACK) + .forceSolidOn() + .noCollission() + .strength(0.2F) + .sound(SoundType.SCULK_VEIN) + .pushReaction(PushReaction.DESTROY) ); public static final Block SCULK_CATALYST = register( "sculk_catalyst", - new SculkCatalystBlock( - BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_BLACK).strength(3.0F, 3.0F).sound(SoundType.SCULK_CATALYST).lightLevel(blockStatex -> 6) - ) + SculkCatalystBlock::new, + BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_BLACK).strength(3.0F, 3.0F).sound(SoundType.SCULK_CATALYST).lightLevel(blockStatex -> 6) ); public static final Block SCULK_SHRIEKER = register( - "sculk_shrieker", new SculkShriekerBlock(BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_BLACK).strength(3.0F, 3.0F).sound(SoundType.SCULK_SHRIEKER)) + "sculk_shrieker", SculkShriekerBlock::new, BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_BLACK).strength(3.0F, 3.0F).sound(SoundType.SCULK_SHRIEKER) ); public static final Block COPPER_BLOCK = register( "copper_block", - new WeatheringCopperFullBlock( - WeatheringCopper.WeatherState.UNAFFECTED, - BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_ORANGE).requiresCorrectToolForDrops().strength(3.0F, 6.0F).sound(SoundType.COPPER) - ) + properties -> new WeatheringCopperFullBlock(WeatheringCopper.WeatherState.UNAFFECTED, properties), + BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_ORANGE).requiresCorrectToolForDrops().strength(3.0F, 6.0F).sound(SoundType.COPPER) ); public static final Block EXPOSED_COPPER = register( "exposed_copper", - new WeatheringCopperFullBlock( - WeatheringCopper.WeatherState.EXPOSED, BlockBehaviour.Properties.ofFullCopy(COPPER_BLOCK).mapColor(MapColor.TERRACOTTA_LIGHT_GRAY) - ) + properties -> new WeatheringCopperFullBlock(WeatheringCopper.WeatherState.EXPOSED, properties), + BlockBehaviour.Properties.ofFullCopy(COPPER_BLOCK).mapColor(MapColor.TERRACOTTA_LIGHT_GRAY) ); public static final Block WEATHERED_COPPER = register( "weathered_copper", - new WeatheringCopperFullBlock(WeatheringCopper.WeatherState.WEATHERED, BlockBehaviour.Properties.ofFullCopy(COPPER_BLOCK).mapColor(MapColor.WARPED_STEM)) + properties -> new WeatheringCopperFullBlock(WeatheringCopper.WeatherState.WEATHERED, properties), + BlockBehaviour.Properties.ofFullCopy(COPPER_BLOCK).mapColor(MapColor.WARPED_STEM) ); public static final Block OXIDIZED_COPPER = register( "oxidized_copper", - new WeatheringCopperFullBlock(WeatheringCopper.WeatherState.OXIDIZED, BlockBehaviour.Properties.ofFullCopy(COPPER_BLOCK).mapColor(MapColor.WARPED_NYLIUM)) + properties -> new WeatheringCopperFullBlock(WeatheringCopper.WeatherState.OXIDIZED, properties), + BlockBehaviour.Properties.ofFullCopy(COPPER_BLOCK).mapColor(MapColor.WARPED_NYLIUM) + ); + public static final Block COPPER_ORE = register( + "copper_ore", properties -> new DropExperienceBlock(ConstantInt.of(0), properties), BlockBehaviour.Properties.ofLegacyCopy(IRON_ORE) ); - public static final Block COPPER_ORE = register("copper_ore", new DropExperienceBlock(ConstantInt.of(0), BlockBehaviour.Properties.ofLegacyCopy(IRON_ORE))); public static final Block DEEPSLATE_COPPER_ORE = register( "deepslate_copper_ore", - new DropExperienceBlock( - ConstantInt.of(0), BlockBehaviour.Properties.ofLegacyCopy(COPPER_ORE).mapColor(MapColor.DEEPSLATE).strength(4.5F, 3.0F).sound(SoundType.DEEPSLATE) - ) + properties -> new DropExperienceBlock(ConstantInt.of(0), properties), + BlockBehaviour.Properties.ofLegacyCopy(COPPER_ORE).mapColor(MapColor.DEEPSLATE).strength(4.5F, 3.0F).sound(SoundType.DEEPSLATE) ); public static final Block OXIDIZED_CUT_COPPER = register( - "oxidized_cut_copper", new WeatheringCopperFullBlock(WeatheringCopper.WeatherState.OXIDIZED, BlockBehaviour.Properties.ofFullCopy(OXIDIZED_COPPER)) + "oxidized_cut_copper", + properties -> new WeatheringCopperFullBlock(WeatheringCopper.WeatherState.OXIDIZED, properties), + BlockBehaviour.Properties.ofFullCopy(OXIDIZED_COPPER) ); public static final Block WEATHERED_CUT_COPPER = register( - "weathered_cut_copper", new WeatheringCopperFullBlock(WeatheringCopper.WeatherState.WEATHERED, BlockBehaviour.Properties.ofFullCopy(WEATHERED_COPPER)) + "weathered_cut_copper", + properties -> new WeatheringCopperFullBlock(WeatheringCopper.WeatherState.WEATHERED, properties), + BlockBehaviour.Properties.ofFullCopy(WEATHERED_COPPER) ); public static final Block EXPOSED_CUT_COPPER = register( - "exposed_cut_copper", new WeatheringCopperFullBlock(WeatheringCopper.WeatherState.EXPOSED, BlockBehaviour.Properties.ofFullCopy(EXPOSED_COPPER)) + "exposed_cut_copper", + properties -> new WeatheringCopperFullBlock(WeatheringCopper.WeatherState.EXPOSED, properties), + BlockBehaviour.Properties.ofFullCopy(EXPOSED_COPPER) ); public static final Block CUT_COPPER = register( - "cut_copper", new WeatheringCopperFullBlock(WeatheringCopper.WeatherState.UNAFFECTED, BlockBehaviour.Properties.ofFullCopy(COPPER_BLOCK)) + "cut_copper", + properties -> new WeatheringCopperFullBlock(WeatheringCopper.WeatherState.UNAFFECTED, properties), + BlockBehaviour.Properties.ofFullCopy(COPPER_BLOCK) ); public static final Block OXIDIZED_CHISELED_COPPER = register( - "oxidized_chiseled_copper", new WeatheringCopperFullBlock(WeatheringCopper.WeatherState.OXIDIZED, BlockBehaviour.Properties.ofFullCopy(OXIDIZED_COPPER)) + "oxidized_chiseled_copper", + properties -> new WeatheringCopperFullBlock(WeatheringCopper.WeatherState.OXIDIZED, properties), + BlockBehaviour.Properties.ofFullCopy(OXIDIZED_COPPER) ); public static final Block WEATHERED_CHISELED_COPPER = register( - "weathered_chiseled_copper", new WeatheringCopperFullBlock(WeatheringCopper.WeatherState.WEATHERED, BlockBehaviour.Properties.ofFullCopy(WEATHERED_COPPER)) + "weathered_chiseled_copper", + properties -> new WeatheringCopperFullBlock(WeatheringCopper.WeatherState.WEATHERED, properties), + BlockBehaviour.Properties.ofFullCopy(WEATHERED_COPPER) ); public static final Block EXPOSED_CHISELED_COPPER = register( - "exposed_chiseled_copper", new WeatheringCopperFullBlock(WeatheringCopper.WeatherState.EXPOSED, BlockBehaviour.Properties.ofFullCopy(EXPOSED_COPPER)) + "exposed_chiseled_copper", + properties -> new WeatheringCopperFullBlock(WeatheringCopper.WeatherState.EXPOSED, properties), + BlockBehaviour.Properties.ofFullCopy(EXPOSED_COPPER) ); public static final Block CHISELED_COPPER = register( - "chiseled_copper", new WeatheringCopperFullBlock(WeatheringCopper.WeatherState.UNAFFECTED, BlockBehaviour.Properties.ofFullCopy(COPPER_BLOCK)) + "chiseled_copper", + properties -> new WeatheringCopperFullBlock(WeatheringCopper.WeatherState.UNAFFECTED, properties), + BlockBehaviour.Properties.ofFullCopy(COPPER_BLOCK) ); public static final Block WAXED_OXIDIZED_CHISELED_COPPER = register( - "waxed_oxidized_chiseled_copper", new Block(BlockBehaviour.Properties.ofFullCopy(OXIDIZED_CHISELED_COPPER)) + "waxed_oxidized_chiseled_copper", BlockBehaviour.Properties.ofFullCopy(OXIDIZED_CHISELED_COPPER) ); public static final Block WAXED_WEATHERED_CHISELED_COPPER = register( - "waxed_weathered_chiseled_copper", new Block(BlockBehaviour.Properties.ofFullCopy(WEATHERED_CHISELED_COPPER)) + "waxed_weathered_chiseled_copper", BlockBehaviour.Properties.ofFullCopy(WEATHERED_CHISELED_COPPER) ); public static final Block WAXED_EXPOSED_CHISELED_COPPER = register( - "waxed_exposed_chiseled_copper", new Block(BlockBehaviour.Properties.ofFullCopy(EXPOSED_CHISELED_COPPER)) + "waxed_exposed_chiseled_copper", BlockBehaviour.Properties.ofFullCopy(EXPOSED_CHISELED_COPPER) ); - public static final Block WAXED_CHISELED_COPPER = register("waxed_chiseled_copper", new Block(BlockBehaviour.Properties.ofFullCopy(CHISELED_COPPER))); + public static final Block WAXED_CHISELED_COPPER = register("waxed_chiseled_copper", BlockBehaviour.Properties.ofFullCopy(CHISELED_COPPER)); public static final Block OXIDIZED_CUT_COPPER_STAIRS = register( "oxidized_cut_copper_stairs", - new WeatheringCopperStairBlock( - WeatheringCopper.WeatherState.OXIDIZED, OXIDIZED_CUT_COPPER.defaultBlockState(), BlockBehaviour.Properties.ofFullCopy(OXIDIZED_CUT_COPPER) - ) + properties -> new WeatheringCopperStairBlock(WeatheringCopper.WeatherState.OXIDIZED, OXIDIZED_CUT_COPPER.defaultBlockState(), properties), + BlockBehaviour.Properties.ofFullCopy(OXIDIZED_CUT_COPPER) ); public static final Block WEATHERED_CUT_COPPER_STAIRS = register( "weathered_cut_copper_stairs", - new WeatheringCopperStairBlock( - WeatheringCopper.WeatherState.WEATHERED, WEATHERED_CUT_COPPER.defaultBlockState(), BlockBehaviour.Properties.ofFullCopy(WEATHERED_COPPER) - ) + properties -> new WeatheringCopperStairBlock(WeatheringCopper.WeatherState.WEATHERED, WEATHERED_CUT_COPPER.defaultBlockState(), properties), + BlockBehaviour.Properties.ofFullCopy(WEATHERED_COPPER) ); public static final Block EXPOSED_CUT_COPPER_STAIRS = register( "exposed_cut_copper_stairs", - new WeatheringCopperStairBlock( - WeatheringCopper.WeatherState.EXPOSED, EXPOSED_CUT_COPPER.defaultBlockState(), BlockBehaviour.Properties.ofFullCopy(EXPOSED_COPPER) - ) + properties -> new WeatheringCopperStairBlock(WeatheringCopper.WeatherState.EXPOSED, EXPOSED_CUT_COPPER.defaultBlockState(), properties), + BlockBehaviour.Properties.ofFullCopy(EXPOSED_COPPER) ); public static final Block CUT_COPPER_STAIRS = register( "cut_copper_stairs", - new WeatheringCopperStairBlock(WeatheringCopper.WeatherState.UNAFFECTED, CUT_COPPER.defaultBlockState(), BlockBehaviour.Properties.ofFullCopy(COPPER_BLOCK)) + properties -> new WeatheringCopperStairBlock(WeatheringCopper.WeatherState.UNAFFECTED, CUT_COPPER.defaultBlockState(), properties), + BlockBehaviour.Properties.ofFullCopy(COPPER_BLOCK) ); public static final Block OXIDIZED_CUT_COPPER_SLAB = register( - "oxidized_cut_copper_slab", new WeatheringCopperSlabBlock(WeatheringCopper.WeatherState.OXIDIZED, BlockBehaviour.Properties.ofFullCopy(OXIDIZED_CUT_COPPER)) + "oxidized_cut_copper_slab", + properties -> new WeatheringCopperSlabBlock(WeatheringCopper.WeatherState.OXIDIZED, properties), + BlockBehaviour.Properties.ofFullCopy(OXIDIZED_CUT_COPPER) ); public static final Block WEATHERED_CUT_COPPER_SLAB = register( "weathered_cut_copper_slab", - new WeatheringCopperSlabBlock(WeatheringCopper.WeatherState.WEATHERED, BlockBehaviour.Properties.ofFullCopy(WEATHERED_CUT_COPPER)) + properties -> new WeatheringCopperSlabBlock(WeatheringCopper.WeatherState.WEATHERED, properties), + BlockBehaviour.Properties.ofFullCopy(WEATHERED_CUT_COPPER) ); public static final Block EXPOSED_CUT_COPPER_SLAB = register( - "exposed_cut_copper_slab", new WeatheringCopperSlabBlock(WeatheringCopper.WeatherState.EXPOSED, BlockBehaviour.Properties.ofFullCopy(EXPOSED_CUT_COPPER)) + "exposed_cut_copper_slab", + properties -> new WeatheringCopperSlabBlock(WeatheringCopper.WeatherState.EXPOSED, properties), + BlockBehaviour.Properties.ofFullCopy(EXPOSED_CUT_COPPER) ); public static final Block CUT_COPPER_SLAB = register( - "cut_copper_slab", new WeatheringCopperSlabBlock(WeatheringCopper.WeatherState.UNAFFECTED, BlockBehaviour.Properties.ofFullCopy(CUT_COPPER)) + "cut_copper_slab", + properties -> new WeatheringCopperSlabBlock(WeatheringCopper.WeatherState.UNAFFECTED, properties), + BlockBehaviour.Properties.ofFullCopy(CUT_COPPER) ); - public static final Block WAXED_COPPER_BLOCK = register("waxed_copper_block", new Block(BlockBehaviour.Properties.ofFullCopy(COPPER_BLOCK))); - public static final Block WAXED_WEATHERED_COPPER = register("waxed_weathered_copper", new Block(BlockBehaviour.Properties.ofFullCopy(WEATHERED_COPPER))); - public static final Block WAXED_EXPOSED_COPPER = register("waxed_exposed_copper", new Block(BlockBehaviour.Properties.ofFullCopy(EXPOSED_COPPER))); - public static final Block WAXED_OXIDIZED_COPPER = register("waxed_oxidized_copper", new Block(BlockBehaviour.Properties.ofFullCopy(OXIDIZED_COPPER))); - public static final Block WAXED_OXIDIZED_CUT_COPPER = register("waxed_oxidized_cut_copper", new Block(BlockBehaviour.Properties.ofFullCopy(OXIDIZED_COPPER))); - public static final Block WAXED_WEATHERED_CUT_COPPER = register( - "waxed_weathered_cut_copper", new Block(BlockBehaviour.Properties.ofFullCopy(WEATHERED_COPPER)) - ); - public static final Block WAXED_EXPOSED_CUT_COPPER = register("waxed_exposed_cut_copper", new Block(BlockBehaviour.Properties.ofFullCopy(EXPOSED_COPPER))); - public static final Block WAXED_CUT_COPPER = register("waxed_cut_copper", new Block(BlockBehaviour.Properties.ofFullCopy(COPPER_BLOCK))); - public static final Block WAXED_OXIDIZED_CUT_COPPER_STAIRS = register("waxed_oxidized_cut_copper_stairs", stair(WAXED_OXIDIZED_CUT_COPPER)); - public static final Block WAXED_WEATHERED_CUT_COPPER_STAIRS = register("waxed_weathered_cut_copper_stairs", stair(WAXED_WEATHERED_CUT_COPPER)); - public static final Block WAXED_EXPOSED_CUT_COPPER_STAIRS = register("waxed_exposed_cut_copper_stairs", stair(WAXED_EXPOSED_CUT_COPPER)); - public static final Block WAXED_CUT_COPPER_STAIRS = register("waxed_cut_copper_stairs", stair(WAXED_CUT_COPPER)); + public static final Block WAXED_COPPER_BLOCK = register("waxed_copper_block", BlockBehaviour.Properties.ofFullCopy(COPPER_BLOCK)); + public static final Block WAXED_WEATHERED_COPPER = register("waxed_weathered_copper", BlockBehaviour.Properties.ofFullCopy(WEATHERED_COPPER)); + public static final Block WAXED_EXPOSED_COPPER = register("waxed_exposed_copper", BlockBehaviour.Properties.ofFullCopy(EXPOSED_COPPER)); + public static final Block WAXED_OXIDIZED_COPPER = register("waxed_oxidized_copper", BlockBehaviour.Properties.ofFullCopy(OXIDIZED_COPPER)); + public static final Block WAXED_OXIDIZED_CUT_COPPER = register("waxed_oxidized_cut_copper", BlockBehaviour.Properties.ofFullCopy(OXIDIZED_COPPER)); + public static final Block WAXED_WEATHERED_CUT_COPPER = register("waxed_weathered_cut_copper", BlockBehaviour.Properties.ofFullCopy(WEATHERED_COPPER)); + public static final Block WAXED_EXPOSED_CUT_COPPER = register("waxed_exposed_cut_copper", BlockBehaviour.Properties.ofFullCopy(EXPOSED_COPPER)); + public static final Block WAXED_CUT_COPPER = register("waxed_cut_copper", BlockBehaviour.Properties.ofFullCopy(COPPER_BLOCK)); + public static final Block WAXED_OXIDIZED_CUT_COPPER_STAIRS = registerStair("waxed_oxidized_cut_copper_stairs", WAXED_OXIDIZED_CUT_COPPER); + public static final Block WAXED_WEATHERED_CUT_COPPER_STAIRS = registerStair("waxed_weathered_cut_copper_stairs", WAXED_WEATHERED_CUT_COPPER); + public static final Block WAXED_EXPOSED_CUT_COPPER_STAIRS = registerStair("waxed_exposed_cut_copper_stairs", WAXED_EXPOSED_CUT_COPPER); + public static final Block WAXED_CUT_COPPER_STAIRS = registerStair("waxed_cut_copper_stairs", WAXED_CUT_COPPER); public static final Block WAXED_OXIDIZED_CUT_COPPER_SLAB = register( - "waxed_oxidized_cut_copper_slab", new SlabBlock(BlockBehaviour.Properties.ofFullCopy(WAXED_OXIDIZED_CUT_COPPER).requiresCorrectToolForDrops()) + "waxed_oxidized_cut_copper_slab", SlabBlock::new, BlockBehaviour.Properties.ofFullCopy(WAXED_OXIDIZED_CUT_COPPER).requiresCorrectToolForDrops() ); public static final Block WAXED_WEATHERED_CUT_COPPER_SLAB = register( - "waxed_weathered_cut_copper_slab", new SlabBlock(BlockBehaviour.Properties.ofFullCopy(WAXED_WEATHERED_CUT_COPPER).requiresCorrectToolForDrops()) + "waxed_weathered_cut_copper_slab", SlabBlock::new, BlockBehaviour.Properties.ofFullCopy(WAXED_WEATHERED_CUT_COPPER).requiresCorrectToolForDrops() ); public static final Block WAXED_EXPOSED_CUT_COPPER_SLAB = register( - "waxed_exposed_cut_copper_slab", new SlabBlock(BlockBehaviour.Properties.ofFullCopy(WAXED_EXPOSED_CUT_COPPER).requiresCorrectToolForDrops()) + "waxed_exposed_cut_copper_slab", SlabBlock::new, BlockBehaviour.Properties.ofFullCopy(WAXED_EXPOSED_CUT_COPPER).requiresCorrectToolForDrops() ); public static final Block WAXED_CUT_COPPER_SLAB = register( - "waxed_cut_copper_slab", new SlabBlock(BlockBehaviour.Properties.ofFullCopy(WAXED_CUT_COPPER).requiresCorrectToolForDrops()) + "waxed_cut_copper_slab", SlabBlock::new, BlockBehaviour.Properties.ofFullCopy(WAXED_CUT_COPPER).requiresCorrectToolForDrops() ); public static final Block COPPER_DOOR = register( "copper_door", - new WeatheringCopperDoorBlock( - BlockSetType.COPPER, - WeatheringCopper.WeatherState.UNAFFECTED, - BlockBehaviour.Properties.of() - .mapColor(COPPER_BLOCK.defaultMapColor()) - .strength(3.0F, 6.0F) - .noOcclusion() - .requiresCorrectToolForDrops() - .pushReaction(PushReaction.DESTROY) - ) + properties -> new WeatheringCopperDoorBlock(BlockSetType.COPPER, WeatheringCopper.WeatherState.UNAFFECTED, properties), + BlockBehaviour.Properties.of() + .mapColor(COPPER_BLOCK.defaultMapColor()) + .strength(3.0F, 6.0F) + .noOcclusion() + .requiresCorrectToolForDrops() + .pushReaction(PushReaction.DESTROY) ); public static final Block EXPOSED_COPPER_DOOR = register( "exposed_copper_door", - new WeatheringCopperDoorBlock( - BlockSetType.COPPER, WeatheringCopper.WeatherState.EXPOSED, BlockBehaviour.Properties.ofFullCopy(COPPER_DOOR).mapColor(EXPOSED_COPPER.defaultMapColor()) - ) + properties -> new WeatheringCopperDoorBlock(BlockSetType.COPPER, WeatheringCopper.WeatherState.EXPOSED, properties), + BlockBehaviour.Properties.ofFullCopy(COPPER_DOOR).mapColor(EXPOSED_COPPER.defaultMapColor()) ); public static final Block OXIDIZED_COPPER_DOOR = register( "oxidized_copper_door", - new WeatheringCopperDoorBlock( - BlockSetType.COPPER, WeatheringCopper.WeatherState.OXIDIZED, BlockBehaviour.Properties.ofFullCopy(COPPER_DOOR).mapColor(OXIDIZED_COPPER.defaultMapColor()) - ) + properties -> new WeatheringCopperDoorBlock(BlockSetType.COPPER, WeatheringCopper.WeatherState.OXIDIZED, properties), + BlockBehaviour.Properties.ofFullCopy(COPPER_DOOR).mapColor(OXIDIZED_COPPER.defaultMapColor()) ); public static final Block WEATHERED_COPPER_DOOR = register( "weathered_copper_door", - new WeatheringCopperDoorBlock( - BlockSetType.COPPER, WeatheringCopper.WeatherState.WEATHERED, BlockBehaviour.Properties.ofFullCopy(COPPER_DOOR).mapColor(WEATHERED_COPPER.defaultMapColor()) - ) + properties -> new WeatheringCopperDoorBlock(BlockSetType.COPPER, WeatheringCopper.WeatherState.WEATHERED, properties), + BlockBehaviour.Properties.ofFullCopy(COPPER_DOOR).mapColor(WEATHERED_COPPER.defaultMapColor()) ); public static final Block WAXED_COPPER_DOOR = register( - "waxed_copper_door", new DoorBlock(BlockSetType.COPPER, BlockBehaviour.Properties.ofFullCopy(COPPER_DOOR)) + "waxed_copper_door", properties -> new DoorBlock(BlockSetType.COPPER, properties), BlockBehaviour.Properties.ofFullCopy(COPPER_DOOR) ); public static final Block WAXED_EXPOSED_COPPER_DOOR = register( - "waxed_exposed_copper_door", new DoorBlock(BlockSetType.COPPER, BlockBehaviour.Properties.ofFullCopy(EXPOSED_COPPER_DOOR)) + "waxed_exposed_copper_door", properties -> new DoorBlock(BlockSetType.COPPER, properties), BlockBehaviour.Properties.ofFullCopy(EXPOSED_COPPER_DOOR) ); public static final Block WAXED_OXIDIZED_COPPER_DOOR = register( - "waxed_oxidized_copper_door", new DoorBlock(BlockSetType.COPPER, BlockBehaviour.Properties.ofFullCopy(OXIDIZED_COPPER_DOOR)) + "waxed_oxidized_copper_door", properties -> new DoorBlock(BlockSetType.COPPER, properties), BlockBehaviour.Properties.ofFullCopy(OXIDIZED_COPPER_DOOR) ); public static final Block WAXED_WEATHERED_COPPER_DOOR = register( - "waxed_weathered_copper_door", new DoorBlock(BlockSetType.COPPER, BlockBehaviour.Properties.ofFullCopy(WEATHERED_COPPER_DOOR)) + "waxed_weathered_copper_door", properties -> new DoorBlock(BlockSetType.COPPER, properties), BlockBehaviour.Properties.ofFullCopy(WEATHERED_COPPER_DOOR) ); public static final Block COPPER_TRAPDOOR = register( "copper_trapdoor", - new WeatheringCopperTrapDoorBlock( - BlockSetType.COPPER, - WeatheringCopper.WeatherState.UNAFFECTED, - BlockBehaviour.Properties.of() - .mapColor(COPPER_BLOCK.defaultMapColor()) - .strength(3.0F, 6.0F) - .requiresCorrectToolForDrops() - .noOcclusion() - .isValidSpawn(Blocks::never) - ) + properties -> new WeatheringCopperTrapDoorBlock(BlockSetType.COPPER, WeatheringCopper.WeatherState.UNAFFECTED, properties), + BlockBehaviour.Properties.of() + .mapColor(COPPER_BLOCK.defaultMapColor()) + .strength(3.0F, 6.0F) + .requiresCorrectToolForDrops() + .noOcclusion() + .isValidSpawn(Blocks::never) ); public static final Block EXPOSED_COPPER_TRAPDOOR = register( "exposed_copper_trapdoor", - new WeatheringCopperTrapDoorBlock( - BlockSetType.COPPER, WeatheringCopper.WeatherState.EXPOSED, BlockBehaviour.Properties.ofFullCopy(COPPER_TRAPDOOR).mapColor(EXPOSED_COPPER.defaultMapColor()) - ) + properties -> new WeatheringCopperTrapDoorBlock(BlockSetType.COPPER, WeatheringCopper.WeatherState.EXPOSED, properties), + BlockBehaviour.Properties.ofFullCopy(COPPER_TRAPDOOR).mapColor(EXPOSED_COPPER.defaultMapColor()) ); public static final Block OXIDIZED_COPPER_TRAPDOOR = register( "oxidized_copper_trapdoor", - new WeatheringCopperTrapDoorBlock( - BlockSetType.COPPER, - WeatheringCopper.WeatherState.OXIDIZED, - BlockBehaviour.Properties.ofFullCopy(COPPER_TRAPDOOR).mapColor(OXIDIZED_COPPER.defaultMapColor()) - ) + properties -> new WeatheringCopperTrapDoorBlock(BlockSetType.COPPER, WeatheringCopper.WeatherState.OXIDIZED, properties), + BlockBehaviour.Properties.ofFullCopy(COPPER_TRAPDOOR).mapColor(OXIDIZED_COPPER.defaultMapColor()) ); public static final Block WEATHERED_COPPER_TRAPDOOR = register( "weathered_copper_trapdoor", - new WeatheringCopperTrapDoorBlock( - BlockSetType.COPPER, - WeatheringCopper.WeatherState.WEATHERED, - BlockBehaviour.Properties.ofFullCopy(COPPER_TRAPDOOR).mapColor(WEATHERED_COPPER.defaultMapColor()) - ) + properties -> new WeatheringCopperTrapDoorBlock(BlockSetType.COPPER, WeatheringCopper.WeatherState.WEATHERED, properties), + BlockBehaviour.Properties.ofFullCopy(COPPER_TRAPDOOR).mapColor(WEATHERED_COPPER.defaultMapColor()) ); public static final Block WAXED_COPPER_TRAPDOOR = register( - "waxed_copper_trapdoor", new TrapDoorBlock(BlockSetType.COPPER, BlockBehaviour.Properties.ofFullCopy(COPPER_TRAPDOOR)) + "waxed_copper_trapdoor", properties -> new TrapDoorBlock(BlockSetType.COPPER, properties), BlockBehaviour.Properties.ofFullCopy(COPPER_TRAPDOOR) ); public static final Block WAXED_EXPOSED_COPPER_TRAPDOOR = register( - "waxed_exposed_copper_trapdoor", new TrapDoorBlock(BlockSetType.COPPER, BlockBehaviour.Properties.ofFullCopy(EXPOSED_COPPER_TRAPDOOR)) + "waxed_exposed_copper_trapdoor", + properties -> new TrapDoorBlock(BlockSetType.COPPER, properties), + BlockBehaviour.Properties.ofFullCopy(EXPOSED_COPPER_TRAPDOOR) ); public static final Block WAXED_OXIDIZED_COPPER_TRAPDOOR = register( - "waxed_oxidized_copper_trapdoor", new TrapDoorBlock(BlockSetType.COPPER, BlockBehaviour.Properties.ofFullCopy(OXIDIZED_COPPER_TRAPDOOR)) + "waxed_oxidized_copper_trapdoor", + properties -> new TrapDoorBlock(BlockSetType.COPPER, properties), + BlockBehaviour.Properties.ofFullCopy(OXIDIZED_COPPER_TRAPDOOR) ); public static final Block WAXED_WEATHERED_COPPER_TRAPDOOR = register( - "waxed_weathered_copper_trapdoor", new TrapDoorBlock(BlockSetType.COPPER, BlockBehaviour.Properties.ofFullCopy(WEATHERED_COPPER_TRAPDOOR)) + "waxed_weathered_copper_trapdoor", + properties -> new TrapDoorBlock(BlockSetType.COPPER, properties), + BlockBehaviour.Properties.ofFullCopy(WEATHERED_COPPER_TRAPDOOR) ); public static final Block COPPER_GRATE = register( "copper_grate", - new WeatheringCopperGrateBlock( - WeatheringCopper.WeatherState.UNAFFECTED, - BlockBehaviour.Properties.of() - .strength(3.0F, 6.0F) - .sound(SoundType.COPPER_GRATE) - .mapColor(MapColor.COLOR_ORANGE) - .noOcclusion() - .requiresCorrectToolForDrops() - .isValidSpawn(Blocks::never) - .isRedstoneConductor(Blocks::never) - .isSuffocating(Blocks::never) - .isViewBlocking(Blocks::never) - ) + properties -> new WeatheringCopperGrateBlock(WeatheringCopper.WeatherState.UNAFFECTED, properties), + BlockBehaviour.Properties.of() + .strength(3.0F, 6.0F) + .sound(SoundType.COPPER_GRATE) + .mapColor(MapColor.COLOR_ORANGE) + .noOcclusion() + .requiresCorrectToolForDrops() + .isValidSpawn(Blocks::never) + .isRedstoneConductor(Blocks::never) + .isSuffocating(Blocks::never) + .isViewBlocking(Blocks::never) ); public static final Block EXPOSED_COPPER_GRATE = register( "exposed_copper_grate", - new WeatheringCopperGrateBlock( - WeatheringCopper.WeatherState.EXPOSED, BlockBehaviour.Properties.ofFullCopy(COPPER_GRATE).mapColor(MapColor.TERRACOTTA_LIGHT_GRAY) - ) + properties -> new WeatheringCopperGrateBlock(WeatheringCopper.WeatherState.EXPOSED, properties), + BlockBehaviour.Properties.ofFullCopy(COPPER_GRATE).mapColor(MapColor.TERRACOTTA_LIGHT_GRAY) ); public static final Block WEATHERED_COPPER_GRATE = register( "weathered_copper_grate", - new WeatheringCopperGrateBlock(WeatheringCopper.WeatherState.WEATHERED, BlockBehaviour.Properties.ofFullCopy(COPPER_GRATE).mapColor(MapColor.WARPED_STEM)) + properties -> new WeatheringCopperGrateBlock(WeatheringCopper.WeatherState.WEATHERED, properties), + BlockBehaviour.Properties.ofFullCopy(COPPER_GRATE).mapColor(MapColor.WARPED_STEM) ); public static final Block OXIDIZED_COPPER_GRATE = register( "oxidized_copper_grate", - new WeatheringCopperGrateBlock(WeatheringCopper.WeatherState.OXIDIZED, BlockBehaviour.Properties.ofFullCopy(COPPER_GRATE).mapColor(MapColor.WARPED_NYLIUM)) + properties -> new WeatheringCopperGrateBlock(WeatheringCopper.WeatherState.OXIDIZED, properties), + BlockBehaviour.Properties.ofFullCopy(COPPER_GRATE).mapColor(MapColor.WARPED_NYLIUM) ); public static final Block WAXED_COPPER_GRATE = register( - "waxed_copper_grate", new WaterloggedTransparentBlock(BlockBehaviour.Properties.ofFullCopy(COPPER_GRATE)) + "waxed_copper_grate", WaterloggedTransparentBlock::new, BlockBehaviour.Properties.ofFullCopy(COPPER_GRATE) ); public static final Block WAXED_EXPOSED_COPPER_GRATE = register( - "waxed_exposed_copper_grate", new WaterloggedTransparentBlock(BlockBehaviour.Properties.ofFullCopy(EXPOSED_COPPER_GRATE)) + "waxed_exposed_copper_grate", WaterloggedTransparentBlock::new, BlockBehaviour.Properties.ofFullCopy(EXPOSED_COPPER_GRATE) ); public static final Block WAXED_WEATHERED_COPPER_GRATE = register( - "waxed_weathered_copper_grate", new WaterloggedTransparentBlock(BlockBehaviour.Properties.ofFullCopy(WEATHERED_COPPER_GRATE)) + "waxed_weathered_copper_grate", WaterloggedTransparentBlock::new, BlockBehaviour.Properties.ofFullCopy(WEATHERED_COPPER_GRATE) ); public static final Block WAXED_OXIDIZED_COPPER_GRATE = register( - "waxed_oxidized_copper_grate", new WaterloggedTransparentBlock(BlockBehaviour.Properties.ofFullCopy(OXIDIZED_COPPER_GRATE)) + "waxed_oxidized_copper_grate", WaterloggedTransparentBlock::new, BlockBehaviour.Properties.ofFullCopy(OXIDIZED_COPPER_GRATE) ); public static final Block COPPER_BULB = register( "copper_bulb", - new WeatheringCopperBulbBlock( - WeatheringCopper.WeatherState.UNAFFECTED, - BlockBehaviour.Properties.of() - .mapColor(COPPER_BLOCK.defaultMapColor()) - .strength(3.0F, 6.0F) - .sound(SoundType.COPPER_BULB) - .requiresCorrectToolForDrops() - .isRedstoneConductor(Blocks::never) - .lightLevel(litBlockEmission(15)) - ) + properties -> new WeatheringCopperBulbBlock(WeatheringCopper.WeatherState.UNAFFECTED, properties), + BlockBehaviour.Properties.of() + .mapColor(COPPER_BLOCK.defaultMapColor()) + .strength(3.0F, 6.0F) + .sound(SoundType.COPPER_BULB) + .requiresCorrectToolForDrops() + .isRedstoneConductor(Blocks::never) + .lightLevel(litBlockEmission(15)) ); public static final Block EXPOSED_COPPER_BULB = register( "exposed_copper_bulb", - new WeatheringCopperBulbBlock( - WeatheringCopper.WeatherState.EXPOSED, - BlockBehaviour.Properties.ofFullCopy(COPPER_BULB).mapColor(MapColor.TERRACOTTA_LIGHT_GRAY).lightLevel(litBlockEmission(12)) - ) + properties -> new WeatheringCopperBulbBlock(WeatheringCopper.WeatherState.EXPOSED, properties), + BlockBehaviour.Properties.ofFullCopy(COPPER_BULB).mapColor(MapColor.TERRACOTTA_LIGHT_GRAY).lightLevel(litBlockEmission(12)) ); public static final Block WEATHERED_COPPER_BULB = register( "weathered_copper_bulb", - new WeatheringCopperBulbBlock( - WeatheringCopper.WeatherState.WEATHERED, BlockBehaviour.Properties.ofFullCopy(COPPER_BULB).mapColor(MapColor.WARPED_STEM).lightLevel(litBlockEmission(8)) - ) + properties -> new WeatheringCopperBulbBlock(WeatheringCopper.WeatherState.WEATHERED, properties), + BlockBehaviour.Properties.ofFullCopy(COPPER_BULB).mapColor(MapColor.WARPED_STEM).lightLevel(litBlockEmission(8)) ); public static final Block OXIDIZED_COPPER_BULB = register( "oxidized_copper_bulb", - new WeatheringCopperBulbBlock( - WeatheringCopper.WeatherState.OXIDIZED, BlockBehaviour.Properties.ofFullCopy(COPPER_BULB).mapColor(MapColor.WARPED_NYLIUM).lightLevel(litBlockEmission(4)) - ) + properties -> new WeatheringCopperBulbBlock(WeatheringCopper.WeatherState.OXIDIZED, properties), + BlockBehaviour.Properties.ofFullCopy(COPPER_BULB).mapColor(MapColor.WARPED_NYLIUM).lightLevel(litBlockEmission(4)) ); - public static final Block WAXED_COPPER_BULB = register("waxed_copper_bulb", new CopperBulbBlock(BlockBehaviour.Properties.ofFullCopy(COPPER_BULB))); + public static final Block WAXED_COPPER_BULB = register("waxed_copper_bulb", CopperBulbBlock::new, BlockBehaviour.Properties.ofFullCopy(COPPER_BULB)); public static final Block WAXED_EXPOSED_COPPER_BULB = register( - "waxed_exposed_copper_bulb", new CopperBulbBlock(BlockBehaviour.Properties.ofFullCopy(EXPOSED_COPPER_BULB)) + "waxed_exposed_copper_bulb", CopperBulbBlock::new, BlockBehaviour.Properties.ofFullCopy(EXPOSED_COPPER_BULB) ); public static final Block WAXED_WEATHERED_COPPER_BULB = register( - "waxed_weathered_copper_bulb", new CopperBulbBlock(BlockBehaviour.Properties.ofFullCopy(WEATHERED_COPPER_BULB)) + "waxed_weathered_copper_bulb", CopperBulbBlock::new, BlockBehaviour.Properties.ofFullCopy(WEATHERED_COPPER_BULB) ); public static final Block WAXED_OXIDIZED_COPPER_BULB = register( - "waxed_oxidized_copper_bulb", new CopperBulbBlock(BlockBehaviour.Properties.ofFullCopy(OXIDIZED_COPPER_BULB)) + "waxed_oxidized_copper_bulb", CopperBulbBlock::new, BlockBehaviour.Properties.ofFullCopy(OXIDIZED_COPPER_BULB) ); public static final Block LIGHTNING_ROD = register( "lightning_rod", - new LightningRodBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.COLOR_ORANGE) - .forceSolidOn() - .requiresCorrectToolForDrops() - .strength(3.0F, 6.0F) - .sound(SoundType.COPPER) - .noOcclusion() - ) + LightningRodBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.COLOR_ORANGE) + .forceSolidOn() + .requiresCorrectToolForDrops() + .strength(3.0F, 6.0F) + .sound(SoundType.COPPER) + .noOcclusion() ); public static final Block POINTED_DRIPSTONE = register( "pointed_dripstone", - new PointedDripstoneBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.TERRACOTTA_BROWN) - .forceSolidOn() - .instrument(NoteBlockInstrument.BASEDRUM) - .noOcclusion() - .sound(SoundType.POINTED_DRIPSTONE) - .randomTicks() - .strength(1.5F, 3.0F) - .dynamicShape() - .offsetType(BlockBehaviour.OffsetType.XZ) - .pushReaction(PushReaction.DESTROY) - .isRedstoneConductor(Blocks::never) - ) + PointedDripstoneBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.TERRACOTTA_BROWN) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASEDRUM) + .noOcclusion() + .sound(SoundType.POINTED_DRIPSTONE) + .randomTicks() + .strength(1.5F, 3.0F) + .dynamicShape() + .offsetType(BlockBehaviour.OffsetType.XZ) + .pushReaction(PushReaction.DESTROY) + .isRedstoneConductor(Blocks::never) ); public static final Block DRIPSTONE_BLOCK = register( "dripstone_block", - new Block( - BlockBehaviour.Properties.of() - .mapColor(MapColor.TERRACOTTA_BROWN) - .instrument(NoteBlockInstrument.BASEDRUM) - .sound(SoundType.DRIPSTONE_BLOCK) - .requiresCorrectToolForDrops() - .strength(1.5F, 1.0F) - ) + BlockBehaviour.Properties.of() + .mapColor(MapColor.TERRACOTTA_BROWN) + .instrument(NoteBlockInstrument.BASEDRUM) + .sound(SoundType.DRIPSTONE_BLOCK) + .requiresCorrectToolForDrops() + .strength(1.5F, 1.0F) ); public static final Block CAVE_VINES = register( "cave_vines", - new CaveVinesBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.PLANT) - .randomTicks() - .noCollission() - .lightLevel(CaveVines.emission(14)) - .instabreak() - .sound(SoundType.CAVE_VINES) - .pushReaction(PushReaction.DESTROY) - ) + CaveVinesBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.PLANT) + .randomTicks() + .noCollission() + .lightLevel(CaveVines.emission(14)) + .instabreak() + .sound(SoundType.CAVE_VINES) + .pushReaction(PushReaction.DESTROY) ); public static final Block CAVE_VINES_PLANT = register( "cave_vines_plant", - new CaveVinesPlantBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.PLANT) - .noCollission() - .lightLevel(CaveVines.emission(14)) - .instabreak() - .sound(SoundType.CAVE_VINES) - .pushReaction(PushReaction.DESTROY) - ) + CaveVinesPlantBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.PLANT) + .noCollission() + .lightLevel(CaveVines.emission(14)) + .instabreak() + .sound(SoundType.CAVE_VINES) + .pushReaction(PushReaction.DESTROY) ); public static final Block SPORE_BLOSSOM = register( "spore_blossom", - new SporeBlossomBlock( - BlockBehaviour.Properties.of().mapColor(MapColor.PLANT).instabreak().noCollission().sound(SoundType.SPORE_BLOSSOM).pushReaction(PushReaction.DESTROY) - ) + SporeBlossomBlock::new, + BlockBehaviour.Properties.of().mapColor(MapColor.PLANT).instabreak().noCollission().sound(SoundType.SPORE_BLOSSOM).pushReaction(PushReaction.DESTROY) ); public static final Block AZALEA = register( "azalea", - new AzaleaBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.PLANT) - .forceSolidOff() - .instabreak() - .sound(SoundType.AZALEA) - .noOcclusion() - .pushReaction(PushReaction.DESTROY) - ) + AzaleaBlock::new, + BlockBehaviour.Properties.of().mapColor(MapColor.PLANT).forceSolidOff().instabreak().sound(SoundType.AZALEA).noOcclusion().pushReaction(PushReaction.DESTROY) ); public static final Block FLOWERING_AZALEA = register( "flowering_azalea", - new AzaleaBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.PLANT) - .forceSolidOff() - .instabreak() - .sound(SoundType.FLOWERING_AZALEA) - .noOcclusion() - .pushReaction(PushReaction.DESTROY) - ) + AzaleaBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.PLANT) + .forceSolidOff() + .instabreak() + .sound(SoundType.FLOWERING_AZALEA) + .noOcclusion() + .pushReaction(PushReaction.DESTROY) ); public static final Block MOSS_CARPET = register( "moss_carpet", - new CarpetBlock(BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_GREEN).strength(0.1F).sound(SoundType.MOSS_CARPET).pushReaction(PushReaction.DESTROY)) + CarpetBlock::new, + BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_GREEN).strength(0.1F).sound(SoundType.MOSS_CARPET).pushReaction(PushReaction.DESTROY) ); public static final Block PINK_PETALS = register( "pink_petals", - new PinkPetalsBlock(BlockBehaviour.Properties.of().mapColor(MapColor.PLANT).noCollission().sound(SoundType.PINK_PETALS).pushReaction(PushReaction.DESTROY)) + PinkPetalsBlock::new, + BlockBehaviour.Properties.of().mapColor(MapColor.PLANT).noCollission().sound(SoundType.PINK_PETALS).pushReaction(PushReaction.DESTROY) ); public static final Block MOSS_BLOCK = register( "moss_block", - new MossBlock(BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_GREEN).strength(0.1F).sound(SoundType.MOSS).pushReaction(PushReaction.DESTROY)) + properties -> new BonemealableFeaturePlacerBlock(CaveFeatures.MOSS_PATCH_BONEMEAL, properties), + BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_GREEN).strength(0.1F).sound(SoundType.MOSS).pushReaction(PushReaction.DESTROY) ); public static final Block BIG_DRIPLEAF = register( "big_dripleaf", - new BigDripleafBlock( - BlockBehaviour.Properties.of().mapColor(MapColor.PLANT).forceSolidOff().strength(0.1F).sound(SoundType.BIG_DRIPLEAF).pushReaction(PushReaction.DESTROY) - ) + BigDripleafBlock::new, + BlockBehaviour.Properties.of().mapColor(MapColor.PLANT).forceSolidOff().strength(0.1F).sound(SoundType.BIG_DRIPLEAF).pushReaction(PushReaction.DESTROY) ); public static final Block BIG_DRIPLEAF_STEM = register( "big_dripleaf_stem", - new BigDripleafStemBlock( - BlockBehaviour.Properties.of().mapColor(MapColor.PLANT).noCollission().strength(0.1F).sound(SoundType.BIG_DRIPLEAF).pushReaction(PushReaction.DESTROY) - ) + BigDripleafStemBlock::new, + BlockBehaviour.Properties.of().mapColor(MapColor.PLANT).noCollission().strength(0.1F).sound(SoundType.BIG_DRIPLEAF).pushReaction(PushReaction.DESTROY) ); public static final Block SMALL_DRIPLEAF = register( "small_dripleaf", - new SmallDripleafBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.PLANT) - .noCollission() - .instabreak() - .sound(SoundType.SMALL_DRIPLEAF) - .offsetType(BlockBehaviour.OffsetType.XYZ) - .pushReaction(PushReaction.DESTROY) - ) + SmallDripleafBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.PLANT) + .noCollission() + .instabreak() + .sound(SoundType.SMALL_DRIPLEAF) + .offsetType(BlockBehaviour.OffsetType.XYZ) + .pushReaction(PushReaction.DESTROY) ); public static final Block HANGING_ROOTS = register( "hanging_roots", - new HangingRootsBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.DIRT) - .replaceable() - .noCollission() - .instabreak() - .sound(SoundType.HANGING_ROOTS) - .offsetType(BlockBehaviour.OffsetType.XZ) - .ignitedByLava() - .pushReaction(PushReaction.DESTROY) - ) + HangingRootsBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.DIRT) + .replaceable() + .noCollission() + .instabreak() + .sound(SoundType.HANGING_ROOTS) + .offsetType(BlockBehaviour.OffsetType.XZ) + .ignitedByLava() + .pushReaction(PushReaction.DESTROY) ); public static final Block ROOTED_DIRT = register( - "rooted_dirt", new RootedDirtBlock(BlockBehaviour.Properties.of().mapColor(MapColor.DIRT).strength(0.5F).sound(SoundType.ROOTED_DIRT)) + "rooted_dirt", RootedDirtBlock::new, BlockBehaviour.Properties.of().mapColor(MapColor.DIRT).strength(0.5F).sound(SoundType.ROOTED_DIRT) ); public static final Block MUD = register( "mud", - new MudBlock( - BlockBehaviour.Properties.ofLegacyCopy(DIRT) - .mapColor(MapColor.TERRACOTTA_CYAN) - .isValidSpawn(Blocks::always) - .isRedstoneConductor(Blocks::always) - .isViewBlocking(Blocks::always) - .isSuffocating(Blocks::always) - .sound(SoundType.MUD) - ) + MudBlock::new, + BlockBehaviour.Properties.ofLegacyCopy(DIRT) + .mapColor(MapColor.TERRACOTTA_CYAN) + .isValidSpawn(Blocks::always) + .isRedstoneConductor(Blocks::always) + .isViewBlocking(Blocks::always) + .isSuffocating(Blocks::always) + .sound(SoundType.MUD) ); public static final Block DEEPSLATE = register( "deepslate", - new RotatedPillarBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.DEEPSLATE) - .instrument(NoteBlockInstrument.BASEDRUM) - .requiresCorrectToolForDrops() - .strength(3.0F, 6.0F) - .sound(SoundType.DEEPSLATE) - ) + RotatedPillarBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.DEEPSLATE) + .instrument(NoteBlockInstrument.BASEDRUM) + .requiresCorrectToolForDrops() + .strength(3.0F, 6.0F) + .sound(SoundType.DEEPSLATE) + ); + public static final Block COBBLED_DEEPSLATE = register("cobbled_deepslate", BlockBehaviour.Properties.ofLegacyCopy(DEEPSLATE).strength(3.5F, 6.0F)); + public static final Block COBBLED_DEEPSLATE_STAIRS = registerLegacyStair("cobbled_deepslate_stairs", COBBLED_DEEPSLATE); + public static final Block COBBLED_DEEPSLATE_SLAB = register( + "cobbled_deepslate_slab", SlabBlock::new, BlockBehaviour.Properties.ofLegacyCopy(COBBLED_DEEPSLATE) ); - public static final Block COBBLED_DEEPSLATE = register("cobbled_deepslate", new Block(BlockBehaviour.Properties.ofLegacyCopy(DEEPSLATE).strength(3.5F, 6.0F))); - public static final Block COBBLED_DEEPSLATE_STAIRS = register("cobbled_deepslate_stairs", legacyStair(COBBLED_DEEPSLATE)); - public static final Block COBBLED_DEEPSLATE_SLAB = register("cobbled_deepslate_slab", new SlabBlock(BlockBehaviour.Properties.ofLegacyCopy(COBBLED_DEEPSLATE))); public static final Block COBBLED_DEEPSLATE_WALL = register( - "cobbled_deepslate_wall", new WallBlock(BlockBehaviour.Properties.ofLegacyCopy(COBBLED_DEEPSLATE).forceSolidOn()) + "cobbled_deepslate_wall", WallBlock::new, BlockBehaviour.Properties.ofLegacyCopy(COBBLED_DEEPSLATE).forceSolidOn() ); public static final Block POLISHED_DEEPSLATE = register( - "polished_deepslate", new Block(BlockBehaviour.Properties.ofLegacyCopy(COBBLED_DEEPSLATE).sound(SoundType.POLISHED_DEEPSLATE)) + "polished_deepslate", BlockBehaviour.Properties.ofLegacyCopy(COBBLED_DEEPSLATE).sound(SoundType.POLISHED_DEEPSLATE) ); - public static final Block POLISHED_DEEPSLATE_STAIRS = register("polished_deepslate_stairs", legacyStair(POLISHED_DEEPSLATE)); + public static final Block POLISHED_DEEPSLATE_STAIRS = registerLegacyStair("polished_deepslate_stairs", POLISHED_DEEPSLATE); public static final Block POLISHED_DEEPSLATE_SLAB = register( - "polished_deepslate_slab", new SlabBlock(BlockBehaviour.Properties.ofLegacyCopy(POLISHED_DEEPSLATE)) + "polished_deepslate_slab", SlabBlock::new, BlockBehaviour.Properties.ofLegacyCopy(POLISHED_DEEPSLATE) ); public static final Block POLISHED_DEEPSLATE_WALL = register( - "polished_deepslate_wall", new WallBlock(BlockBehaviour.Properties.ofLegacyCopy(POLISHED_DEEPSLATE).forceSolidOn()) + "polished_deepslate_wall", WallBlock::new, BlockBehaviour.Properties.ofLegacyCopy(POLISHED_DEEPSLATE).forceSolidOn() ); public static final Block DEEPSLATE_TILES = register( - "deepslate_tiles", new Block(BlockBehaviour.Properties.ofLegacyCopy(COBBLED_DEEPSLATE).sound(SoundType.DEEPSLATE_TILES)) + "deepslate_tiles", BlockBehaviour.Properties.ofLegacyCopy(COBBLED_DEEPSLATE).sound(SoundType.DEEPSLATE_TILES) ); - public static final Block DEEPSLATE_TILE_STAIRS = register("deepslate_tile_stairs", legacyStair(DEEPSLATE_TILES)); - public static final Block DEEPSLATE_TILE_SLAB = register("deepslate_tile_slab", new SlabBlock(BlockBehaviour.Properties.ofLegacyCopy(DEEPSLATE_TILES))); + public static final Block DEEPSLATE_TILE_STAIRS = registerLegacyStair("deepslate_tile_stairs", DEEPSLATE_TILES); + public static final Block DEEPSLATE_TILE_SLAB = register("deepslate_tile_slab", SlabBlock::new, BlockBehaviour.Properties.ofLegacyCopy(DEEPSLATE_TILES)); public static final Block DEEPSLATE_TILE_WALL = register( - "deepslate_tile_wall", new WallBlock(BlockBehaviour.Properties.ofLegacyCopy(DEEPSLATE_TILES).forceSolidOn()) + "deepslate_tile_wall", WallBlock::new, BlockBehaviour.Properties.ofLegacyCopy(DEEPSLATE_TILES).forceSolidOn() ); public static final Block DEEPSLATE_BRICKS = register( - "deepslate_bricks", new Block(BlockBehaviour.Properties.ofLegacyCopy(COBBLED_DEEPSLATE).sound(SoundType.DEEPSLATE_BRICKS)) + "deepslate_bricks", BlockBehaviour.Properties.ofLegacyCopy(COBBLED_DEEPSLATE).sound(SoundType.DEEPSLATE_BRICKS) ); - public static final Block DEEPSLATE_BRICK_STAIRS = register("deepslate_brick_stairs", legacyStair(DEEPSLATE_BRICKS)); - public static final Block DEEPSLATE_BRICK_SLAB = register("deepslate_brick_slab", new SlabBlock(BlockBehaviour.Properties.ofLegacyCopy(DEEPSLATE_BRICKS))); + public static final Block DEEPSLATE_BRICK_STAIRS = registerLegacyStair("deepslate_brick_stairs", DEEPSLATE_BRICKS); + public static final Block DEEPSLATE_BRICK_SLAB = register("deepslate_brick_slab", SlabBlock::new, BlockBehaviour.Properties.ofLegacyCopy(DEEPSLATE_BRICKS)); public static final Block DEEPSLATE_BRICK_WALL = register( - "deepslate_brick_wall", new WallBlock(BlockBehaviour.Properties.ofLegacyCopy(DEEPSLATE_BRICKS).forceSolidOn()) + "deepslate_brick_wall", WallBlock::new, BlockBehaviour.Properties.ofLegacyCopy(DEEPSLATE_BRICKS).forceSolidOn() ); public static final Block CHISELED_DEEPSLATE = register( - "chiseled_deepslate", new Block(BlockBehaviour.Properties.ofLegacyCopy(COBBLED_DEEPSLATE).sound(SoundType.DEEPSLATE_BRICKS)) + "chiseled_deepslate", BlockBehaviour.Properties.ofLegacyCopy(COBBLED_DEEPSLATE).sound(SoundType.DEEPSLATE_BRICKS) ); - public static final Block CRACKED_DEEPSLATE_BRICKS = register("cracked_deepslate_bricks", new Block(BlockBehaviour.Properties.ofLegacyCopy(DEEPSLATE_BRICKS))); - public static final Block CRACKED_DEEPSLATE_TILES = register("cracked_deepslate_tiles", new Block(BlockBehaviour.Properties.ofLegacyCopy(DEEPSLATE_TILES))); + public static final Block CRACKED_DEEPSLATE_BRICKS = register("cracked_deepslate_bricks", BlockBehaviour.Properties.ofLegacyCopy(DEEPSLATE_BRICKS)); + public static final Block CRACKED_DEEPSLATE_TILES = register("cracked_deepslate_tiles", BlockBehaviour.Properties.ofLegacyCopy(DEEPSLATE_TILES)); public static final Block INFESTED_DEEPSLATE = register( - "infested_deepslate", new InfestedRotatedPillarBlock(DEEPSLATE, BlockBehaviour.Properties.of().mapColor(MapColor.DEEPSLATE).sound(SoundType.DEEPSLATE)) + "infested_deepslate", + properties -> new InfestedRotatedPillarBlock(DEEPSLATE, properties), + BlockBehaviour.Properties.of().mapColor(MapColor.DEEPSLATE).sound(SoundType.DEEPSLATE) ); - public static final Block SMOOTH_BASALT = register("smooth_basalt", new Block(BlockBehaviour.Properties.ofLegacyCopy(BASALT))); + public static final Block SMOOTH_BASALT = register("smooth_basalt", BlockBehaviour.Properties.ofLegacyCopy(BASALT)); public static final Block RAW_IRON_BLOCK = register( "raw_iron_block", - new Block( - BlockBehaviour.Properties.of().mapColor(MapColor.RAW_IRON).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(5.0F, 6.0F) - ) + BlockBehaviour.Properties.of().mapColor(MapColor.RAW_IRON).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(5.0F, 6.0F) ); public static final Block RAW_COPPER_BLOCK = register( "raw_copper_block", - new Block( - BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_ORANGE).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(5.0F, 6.0F) - ) + BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_ORANGE).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(5.0F, 6.0F) ); public static final Block RAW_GOLD_BLOCK = register( "raw_gold_block", - new Block(BlockBehaviour.Properties.of().mapColor(MapColor.GOLD).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(5.0F, 6.0F)) + BlockBehaviour.Properties.of().mapColor(MapColor.GOLD).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(5.0F, 6.0F) + ); + public static final Block POTTED_AZALEA = register("potted_azalea_bush", properties -> new FlowerPotBlock(AZALEA, properties), flowerPotProperties()); + public static final Block POTTED_FLOWERING_AZALEA = register( + "potted_flowering_azalea_bush", properties -> new FlowerPotBlock(FLOWERING_AZALEA, properties), flowerPotProperties() ); - public static final Block POTTED_AZALEA = register("potted_azalea_bush", flowerPot(AZALEA)); - public static final Block POTTED_FLOWERING_AZALEA = register("potted_flowering_azalea_bush", flowerPot(FLOWERING_AZALEA)); public static final Block OCHRE_FROGLIGHT = register( "ochre_froglight", - new RotatedPillarBlock(BlockBehaviour.Properties.of().mapColor(MapColor.SAND).strength(0.3F).lightLevel(blockStatex -> 15).sound(SoundType.FROGLIGHT)) + RotatedPillarBlock::new, + BlockBehaviour.Properties.of().mapColor(MapColor.SAND).strength(0.3F).lightLevel(blockStatex -> 15).sound(SoundType.FROGLIGHT) ); public static final Block VERDANT_FROGLIGHT = register( "verdant_froglight", - new RotatedPillarBlock(BlockBehaviour.Properties.of().mapColor(MapColor.GLOW_LICHEN).strength(0.3F).lightLevel(blockStatex -> 15).sound(SoundType.FROGLIGHT)) + RotatedPillarBlock::new, + BlockBehaviour.Properties.of().mapColor(MapColor.GLOW_LICHEN).strength(0.3F).lightLevel(blockStatex -> 15).sound(SoundType.FROGLIGHT) ); public static final Block PEARLESCENT_FROGLIGHT = register( "pearlescent_froglight", - new RotatedPillarBlock(BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_PINK).strength(0.3F).lightLevel(blockStatex -> 15).sound(SoundType.FROGLIGHT)) + RotatedPillarBlock::new, + BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_PINK).strength(0.3F).lightLevel(blockStatex -> 15).sound(SoundType.FROGLIGHT) ); public static final Block FROGSPAWN = register( "frogspawn", - new FrogspawnBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.WATER) - .instabreak() - .noOcclusion() - .noCollission() - .sound(SoundType.FROGSPAWN) - .pushReaction(PushReaction.DESTROY) - ) + FrogspawnBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.WATER) + .instabreak() + .noOcclusion() + .noCollission() + .sound(SoundType.FROGSPAWN) + .pushReaction(PushReaction.DESTROY) ); public static final Block REINFORCED_DEEPSLATE = register( "reinforced_deepslate", - new Block( - BlockBehaviour.Properties.of().mapColor(MapColor.DEEPSLATE).instrument(NoteBlockInstrument.BASEDRUM).sound(SoundType.DEEPSLATE).strength(55.0F, 1200.0F) - ) + BlockBehaviour.Properties.of().mapColor(MapColor.DEEPSLATE).instrument(NoteBlockInstrument.BASEDRUM).sound(SoundType.DEEPSLATE).strength(55.0F, 1200.0F) ); public static final Block DECORATED_POT = register( "decorated_pot", - new DecoratedPotBlock(BlockBehaviour.Properties.of().mapColor(MapColor.TERRACOTTA_RED).strength(0.0F, 0.0F).pushReaction(PushReaction.DESTROY).noOcclusion()) + DecoratedPotBlock::new, + BlockBehaviour.Properties.of().mapColor(MapColor.TERRACOTTA_RED).strength(0.0F, 0.0F).pushReaction(PushReaction.DESTROY).noOcclusion() ); - public static final Block CRAFTER = register("crafter", new CrafterBlock(BlockBehaviour.Properties.of().mapColor(MapColor.STONE).strength(1.5F, 3.5F))); + public static final Block CRAFTER = register("crafter", CrafterBlock::new, BlockBehaviour.Properties.of().mapColor(MapColor.STONE).strength(1.5F, 3.5F)); public static final Block TRIAL_SPAWNER = register( "trial_spawner", - new TrialSpawnerBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.STONE) - .instrument(NoteBlockInstrument.BASEDRUM) - .lightLevel(blockStatex -> ((TrialSpawnerState)blockStatex.getValue(TrialSpawnerBlock.STATE)).lightLevel()) - .strength(50.0F) - .sound(SoundType.TRIAL_SPAWNER) - .isViewBlocking(Blocks::never) - .noOcclusion() - ) + TrialSpawnerBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.STONE) + .instrument(NoteBlockInstrument.BASEDRUM) + .lightLevel(blockStatex -> ((TrialSpawnerState)blockStatex.getValue(TrialSpawnerBlock.STATE)).lightLevel()) + .strength(50.0F) + .sound(SoundType.TRIAL_SPAWNER) + .isViewBlocking(Blocks::never) + .noOcclusion() ); public static final Block VAULT = register( "vault", - new VaultBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.STONE) - .instrument(NoteBlockInstrument.BASEDRUM) - .noOcclusion() - .sound(SoundType.VAULT) - .lightLevel(blockStatex -> ((VaultState)blockStatex.getValue(VaultBlock.STATE)).lightLevel()) - .strength(50.0F) - .isViewBlocking(Blocks::never) - ) + VaultBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.STONE) + .instrument(NoteBlockInstrument.BASEDRUM) + .noOcclusion() + .sound(SoundType.VAULT) + .lightLevel(blockStatex -> ((VaultState)blockStatex.getValue(VaultBlock.STATE)).lightLevel()) + .strength(50.0F) + .isViewBlocking(Blocks::never) ); public static final Block HEAVY_CORE = register( "heavy_core", - new HeavyCoreBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.METAL) - .instrument(NoteBlockInstrument.SNARE) - .sound(SoundType.HEAVY_CORE) - .strength(10.0F) - .pushReaction(PushReaction.NORMAL) - .explosionResistance(1200.0F) - ) + HeavyCoreBlock::new, + BlockBehaviour.Properties.of() + .mapColor(MapColor.METAL) + .instrument(NoteBlockInstrument.SNARE) + .sound(SoundType.HEAVY_CORE) + .strength(10.0F) + .pushReaction(PushReaction.NORMAL) + .explosionResistance(1200.0F) + ); + public static final Block PALE_MOSS_BLOCK = register( + "pale_moss_block", + properties -> new BonemealableFeaturePlacerBlock(VegetationFeatures.PALE_MOSS_PATCH_BONEMEAL, properties), + BlockBehaviour.Properties.of() + .mapColor(MapColor.COLOR_LIGHT_GRAY) + .strength(0.1F) + .sound(SoundType.MOSS) + .pushReaction(PushReaction.DESTROY) + .requiredFeatures(FeatureFlags.WINTER_DROP) + ); + public static final Block PALE_MOSS_CARPET = register( + "pale_moss_carpet", + MossyCarpetBlock::new, + BlockBehaviour.Properties.of() + .mapColor(PALE_MOSS_BLOCK.defaultMapColor()) + .strength(0.1F) + .sound(SoundType.MOSS_CARPET) + .pushReaction(PushReaction.DESTROY) + .requiredFeatures(FeatureFlags.WINTER_DROP) + ); + public static final Block PALE_HANGING_MOSS = register( + "pale_hanging_moss", + HangingMossBlock::new, + BlockBehaviour.Properties.of() + .mapColor(PALE_MOSS_BLOCK.defaultMapColor()) + .strength(0.1F) + .noCollission() + .sound(SoundType.MOSS_CARPET) + .pushReaction(PushReaction.DESTROY) + .requiredFeatures(FeatureFlags.WINTER_DROP) ); private static ToIntFunction litBlockEmission(int lightValue) { @@ -7015,11 +6376,12 @@ public class Blocks { return entity == EntityType.OCELOT || entity == EntityType.PARROT; } - private static Block bed(DyeColor color) { - return new BedBlock( - color, + private static Block registerBed(String string, DyeColor dyeColor) { + return register( + string, + properties -> new BedBlock(dyeColor, properties), BlockBehaviour.Properties.of() - .mapColor(blockState -> blockState.getValue(BedBlock.PART) == BedPart.FOOT ? color.getMapColor() : MapColor.WOOL) + .mapColor(blockState -> blockState.getValue(BedBlock.PART) == BedPart.FOOT ? dyeColor.getMapColor() : MapColor.WOOL) .sound(SoundType.WOOD) .strength(0.2F) .noOcclusion() @@ -7028,32 +6390,17 @@ public class Blocks { ); } - private static Block log(MapColor topMapColor, MapColor sideMapColor) { - return new RotatedPillarBlock( - BlockBehaviour.Properties.of() - .mapColor(blockState -> blockState.getValue(RotatedPillarBlock.AXIS) == Direction.Axis.Y ? topMapColor : sideMapColor) - .instrument(NoteBlockInstrument.BASS) - .strength(2.0F) - .sound(SoundType.WOOD) - .ignitedByLava() - ); + private static BlockBehaviour.Properties logProperties(MapColor mapColor, MapColor mapColor2, SoundType soundType) { + return BlockBehaviour.Properties.of() + .mapColor(blockState -> blockState.getValue(RotatedPillarBlock.AXIS) == Direction.Axis.Y ? mapColor : mapColor2) + .instrument(NoteBlockInstrument.BASS) + .strength(2.0F) + .sound(soundType) + .ignitedByLava(); } - private static Block log(MapColor topMapColor, MapColor sideMapColor, SoundType soundType) { - return new RotatedPillarBlock( - BlockBehaviour.Properties.of() - .mapColor(blockState -> blockState.getValue(RotatedPillarBlock.AXIS) == Direction.Axis.Y ? topMapColor : sideMapColor) - .instrument(NoteBlockInstrument.BASS) - .strength(2.0F) - .sound(soundType) - .ignitedByLava() - ); - } - - private static Block netherStem(MapColor mapColor) { - return new RotatedPillarBlock( - BlockBehaviour.Properties.of().mapColor(blockState -> mapColor).instrument(NoteBlockInstrument.BASS).strength(2.0F).sound(SoundType.STEM) - ); + private static BlockBehaviour.Properties netherStemProperties(MapColor mapColor) { + return BlockBehaviour.Properties.of().mapColor(blockState -> mapColor).instrument(NoteBlockInstrument.BASS).strength(2.0F).sound(SoundType.STEM); } private static boolean always(BlockState state, BlockGetter blockGetter, BlockPos pos) { @@ -7064,11 +6411,12 @@ public class Blocks { return false; } - private static Block stainedGlass(DyeColor color) { - return new StainedGlassBlock( - color, + private static Block registerStainedGlass(String string, DyeColor dyeColor) { + return register( + string, + properties -> new StainedGlassBlock(dyeColor, properties), BlockBehaviour.Properties.of() - .mapColor(color) + .mapColor(dyeColor) .instrument(NoteBlockInstrument.HAT) .strength(0.3F) .sound(SoundType.GLASS) @@ -7080,95 +6428,99 @@ public class Blocks { ); } - private static Block leaves(SoundType soundType) { - return new LeavesBlock( - BlockBehaviour.Properties.of() - .mapColor(MapColor.PLANT) - .strength(0.2F) - .randomTicks() - .sound(soundType) - .noOcclusion() - .isValidSpawn(Blocks::ocelotOrParrot) - .isSuffocating(Blocks::never) - .isViewBlocking(Blocks::never) - .ignitedByLava() - .pushReaction(PushReaction.DESTROY) - .isRedstoneConductor(Blocks::never) - ); + private static BlockBehaviour.Properties leavesProperties(SoundType soundType) { + return BlockBehaviour.Properties.of() + .mapColor(MapColor.PLANT) + .strength(0.2F) + .randomTicks() + .sound(soundType) + .noOcclusion() + .isValidSpawn(Blocks::ocelotOrParrot) + .isSuffocating(Blocks::never) + .isViewBlocking(Blocks::never) + .ignitedByLava() + .pushReaction(PushReaction.DESTROY) + .isRedstoneConductor(Blocks::never); } - private static Block shulkerBox(@Nullable DyeColor color, MapColor mapColor) { - return new ShulkerBoxBlock( - color, - BlockBehaviour.Properties.of() - .mapColor(mapColor) - .forceSolidOn() - .strength(2.0F) - .dynamicShape() - .noOcclusion() - .isSuffocating(NOT_CLOSED_SHULKER) - .isViewBlocking(NOT_CLOSED_SHULKER) - .pushReaction(PushReaction.DESTROY) - ); + private static BlockBehaviour.Properties shulkerBoxProperties(MapColor mapColor) { + return BlockBehaviour.Properties.of() + .mapColor(mapColor) + .forceSolidOn() + .strength(2.0F) + .dynamicShape() + .noOcclusion() + .isSuffocating(NOT_CLOSED_SHULKER) + .isViewBlocking(NOT_CLOSED_SHULKER) + .pushReaction(PushReaction.DESTROY); } - private static Block pistonBase(boolean isSticky) { - BlockBehaviour.StatePredicate statePredicate = (blockState, blockGetter, blockPos) -> !(Boolean)blockState.getValue(PistonBaseBlock.EXTENDED); - return new PistonBaseBlock( - isSticky, - BlockBehaviour.Properties.of() - .mapColor(MapColor.STONE) - .strength(1.5F) - .isRedstoneConductor(Blocks::never) - .isSuffocating(statePredicate) - .isViewBlocking(statePredicate) - .pushReaction(PushReaction.BLOCK) - ); + private static BlockBehaviour.Properties pistonProperties() { + return BlockBehaviour.Properties.of() + .mapColor(MapColor.STONE) + .strength(1.5F) + .isRedstoneConductor(Blocks::never) + .isSuffocating(NOT_EXTENDED_PISTON) + .isViewBlocking(NOT_EXTENDED_PISTON) + .pushReaction(PushReaction.BLOCK); } - private static Block woodenButton(BlockSetType type) { - return new ButtonBlock(type, 30, BlockBehaviour.Properties.of().noCollission().strength(0.5F).pushReaction(PushReaction.DESTROY)); + private static BlockBehaviour.Properties buttonProperties() { + return BlockBehaviour.Properties.of().noCollission().strength(0.5F).pushReaction(PushReaction.DESTROY); } - private static Block stoneButton() { - return new ButtonBlock(BlockSetType.STONE, 20, BlockBehaviour.Properties.of().noCollission().strength(0.5F).pushReaction(PushReaction.DESTROY)); + private static BlockBehaviour.Properties flowerPotProperties() { + return BlockBehaviour.Properties.of().instabreak().noOcclusion().pushReaction(PushReaction.DESTROY); } - private static Block flowerPot(Block potted) { - return new FlowerPotBlock(potted, BlockBehaviour.Properties.of().instabreak().noOcclusion().pushReaction(PushReaction.DESTROY)); - } - - private static Block candle(MapColor mapColor) { - return new CandleBlock( - BlockBehaviour.Properties.of() - .mapColor(mapColor) - .noOcclusion() - .strength(0.1F) - .sound(SoundType.CANDLE) - .lightLevel(CandleBlock.LIGHT_EMISSION) - .pushReaction(PushReaction.DESTROY) - ); + private static BlockBehaviour.Properties candleProperties(MapColor mapColor) { + return BlockBehaviour.Properties.of() + .mapColor(mapColor) + .noOcclusion() + .strength(0.1F) + .sound(SoundType.CANDLE) + .lightLevel(CandleBlock.LIGHT_EMISSION) + .pushReaction(PushReaction.DESTROY); } @Deprecated - private static Block legacyStair(Block baseBlock) { - return new StairBlock(baseBlock.defaultBlockState(), BlockBehaviour.Properties.ofLegacyCopy(baseBlock)); + private static Block registerLegacyStair(String string, Block block) { + return register(string, properties -> new StairBlock(block.defaultBlockState(), properties), BlockBehaviour.Properties.ofLegacyCopy(block)); } - private static Block stair(Block baseBlock) { - return new StairBlock(baseBlock.defaultBlockState(), BlockBehaviour.Properties.ofFullCopy(baseBlock)); + private static Block registerStair(String string, Block block) { + return register(string, properties -> new StairBlock(block.defaultBlockState(), properties), BlockBehaviour.Properties.ofFullCopy(block)); } - public static Block register(String key, Block block) { - return Registry.register(BuiltInRegistries.BLOCK, key, block); + private static BlockBehaviour.Properties wallVariant(Block block, boolean bl) { + BlockBehaviour.Properties properties = block.properties(); + BlockBehaviour.Properties properties2 = BlockBehaviour.Properties.of().overrideLootTable(block.getLootTable()); + if (bl) { + properties2 = properties2.overrideDescription(block.getDescriptionId()); + } + + return properties2; } - public static Block register(ResourceKey resourceKey, Block block) { + private static Block register(ResourceKey resourceKey, Function function, BlockBehaviour.Properties properties) { + Block block = (Block)function.apply(properties.setId(resourceKey)); return Registry.register(BuiltInRegistries.BLOCK, resourceKey, block); } - public static void rebuildCache() { - Block.BLOCK_STATE_REGISTRY.forEach(BlockBehaviour.BlockStateBase::initCache); + private static Block register(ResourceKey resourceKey, BlockBehaviour.Properties properties) { + return register(resourceKey, Block::new, properties); + } + + private static ResourceKey vanillaBlockId(String string) { + return ResourceKey.create(Registries.BLOCK, ResourceLocation.withDefaultNamespace(string)); + } + + private static Block register(String string, Function function, BlockBehaviour.Properties properties) { + return register(vanillaBlockId(string), function, properties); + } + + private static Block register(String string, BlockBehaviour.Properties properties) { + return register(string, Block::new, properties); } static { @@ -7177,8 +6529,6 @@ public class Blocks { Block.BLOCK_STATE_REGISTRY.add(blockState); blockState.initCache(); } - - block.getLootTable(); } } } diff --git a/net/minecraft/world/level/block/MossBlock.java b/net/minecraft/world/level/block/BonemealableFeaturePlacerBlock.java similarity index 52% rename from net/minecraft/world/level/block/MossBlock.java rename to net/minecraft/world/level/block/BonemealableFeaturePlacerBlock.java index 9e7f6ebd..4ae62c81 100644 --- a/net/minecraft/world/level/block/MossBlock.java +++ b/net/minecraft/world/level/block/BonemealableFeaturePlacerBlock.java @@ -1,27 +1,37 @@ package net.minecraft.world.level.block; import com.mojang.serialization.MapCodec; +import com.mojang.serialization.codecs.RecordCodecBuilder; import net.minecraft.core.BlockPos; import net.minecraft.core.registries.Registries; -import net.minecraft.data.worldgen.features.CaveFeatures; +import net.minecraft.resources.ResourceKey; import net.minecraft.server.level.ServerLevel; import net.minecraft.util.RandomSource; import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.block.BonemealableBlock.Type; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.levelgen.feature.ConfiguredFeature; -public class MossBlock extends Block implements BonemealableBlock { - public static final MapCodec CODEC = simpleCodec(MossBlock::new); +public class BonemealableFeaturePlacerBlock extends Block implements BonemealableBlock { + public static final MapCodec CODEC = RecordCodecBuilder.mapCodec( + instance -> instance.group( + ResourceKey.codec(Registries.CONFIGURED_FEATURE).fieldOf("feature").forGetter(bonemealableFeaturePlacerBlock -> bonemealableFeaturePlacerBlock.feature), + propertiesCodec() + ) + .apply(instance, BonemealableFeaturePlacerBlock::new) + ); + private final ResourceKey> feature; @Override - public MapCodec codec() { + public MapCodec codec() { return CODEC; } - public MossBlock(BlockBehaviour.Properties properties) { + public BonemealableFeaturePlacerBlock(ResourceKey> resourceKey, BlockBehaviour.Properties properties) { super(properties); + this.feature = resourceKey; } @Override @@ -37,13 +47,13 @@ public class MossBlock extends Block implements BonemealableBlock { @Override public void performBonemeal(ServerLevel level, RandomSource random, BlockPos pos, BlockState state) { level.registryAccess() - .registry(Registries.CONFIGURED_FEATURE) - .flatMap(registry -> registry.getHolder(CaveFeatures.MOSS_PATCH_BONEMEAL)) + .lookup(Registries.CONFIGURED_FEATURE) + .flatMap(registry -> registry.get(this.feature)) .ifPresent(reference -> ((ConfiguredFeature)reference.value()).place(level, level.getChunkSource().getGenerator(), random, pos.above())); } @Override - public BonemealableBlock.Type getType() { - return BonemealableBlock.Type.NEIGHBOR_SPREADER; + public Type getType() { + return Type.NEIGHBOR_SPREADER; } } diff --git a/net/minecraft/world/level/block/BrewingStandBlock.java b/net/minecraft/world/level/block/BrewingStandBlock.java index 8635bdc0..3e8df624 100644 --- a/net/minecraft/world/level/block/BrewingStandBlock.java +++ b/net/minecraft/world/level/block/BrewingStandBlock.java @@ -67,17 +67,12 @@ public class BrewingStandBlock extends BaseEntityBlock { @Override protected InteractionResult useWithoutItem(BlockState state, Level level, BlockPos pos, Player player, BlockHitResult hitResult) { - if (level.isClientSide) { - return InteractionResult.SUCCESS; - } else { - BlockEntity blockEntity = level.getBlockEntity(pos); - if (blockEntity instanceof BrewingStandBlockEntity) { - player.openMenu((BrewingStandBlockEntity)blockEntity); - player.awardStat(Stats.INTERACT_WITH_BREWINGSTAND); - } - - return InteractionResult.CONSUME; + if (!level.isClientSide && level.getBlockEntity(pos) instanceof BrewingStandBlockEntity brewingStandBlockEntity) { + player.openMenu(brewingStandBlockEntity); + player.awardStat(Stats.INTERACT_WITH_BREWINGSTAND); } + + return InteractionResult.SUCCESS; } @Override diff --git a/net/minecraft/world/level/block/BrushableBlock.java b/net/minecraft/world/level/block/BrushableBlock.java index 4407bcbe..c9859bdd 100644 --- a/net/minecraft/world/level/block/BrushableBlock.java +++ b/net/minecraft/world/level/block/BrushableBlock.java @@ -12,7 +12,8 @@ import net.minecraft.sounds.SoundEvent; import net.minecraft.util.RandomSource; import net.minecraft.world.entity.item.FallingBlockEntity; import net.minecraft.world.level.Level; -import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BrushableBlockEntity; import net.minecraft.world.level.block.state.BlockBehaviour; @@ -29,7 +30,7 @@ public class BrushableBlock extends BaseEntityBlock implements Fallable { instance -> instance.group( BuiltInRegistries.BLOCK.byNameCodec().fieldOf("turns_into").forGetter(BrushableBlock::getTurnsInto), BuiltInRegistries.SOUND_EVENT.byNameCodec().fieldOf("brush_sound").forGetter(BrushableBlock::getBrushSound), - BuiltInRegistries.SOUND_EVENT.byNameCodec().fieldOf("brush_comleted_sound").forGetter(BrushableBlock::getBrushCompletedSound), + BuiltInRegistries.SOUND_EVENT.byNameCodec().fieldOf("brush_completed_sound").forGetter(BrushableBlock::getBrushCompletedSound), propertiesCodec() ) .apply(instance, BrushableBlock::new) @@ -69,18 +70,27 @@ public class BrushableBlock extends BaseEntityBlock implements Fallable { } @Override - public BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { - level.scheduleTick(pos, this, 2); - return super.updateShape(state, direction, neighborState, level, pos, neighborPos); + public BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { + scheduledTickAccess.scheduleTick(blockPos, this, 2); + return super.updateShape(blockState, levelReader, scheduledTickAccess, blockPos, direction, blockPos2, blockState2, randomSource); } @Override public void tick(BlockState state, ServerLevel level, BlockPos pos, RandomSource random) { if (level.getBlockEntity(pos) instanceof BrushableBlockEntity brushableBlockEntity) { - brushableBlockEntity.checkReset(); + brushableBlockEntity.checkReset(level); } - if (FallingBlock.isFree(level.getBlockState(pos.below())) && pos.getY() >= level.getMinBuildHeight()) { + if (FallingBlock.isFree(level.getBlockState(pos.below())) && pos.getY() >= level.getMinY()) { FallingBlockEntity fallingBlockEntity = FallingBlockEntity.fall(level, pos, state); fallingBlockEntity.disableDrop(); } diff --git a/net/minecraft/world/level/block/BubbleColumnBlock.java b/net/minecraft/world/level/block/BubbleColumnBlock.java index f642e2b9..6fbc52ff 100644 --- a/net/minecraft/world/level/block/BubbleColumnBlock.java +++ b/net/minecraft/world/level/block/BubbleColumnBlock.java @@ -18,6 +18,7 @@ import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; @@ -136,15 +137,24 @@ public class BubbleColumnBlock extends Block implements BucketPickup { } @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { - level.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(level)); - if (!state.canSurvive(level, pos) + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { + scheduledTickAccess.scheduleTick(blockPos, Fluids.WATER, Fluids.WATER.getTickDelay(levelReader)); + if (!blockState.canSurvive(levelReader, blockPos) || direction == Direction.DOWN - || direction == Direction.UP && !neighborState.is(Blocks.BUBBLE_COLUMN) && canExistIn(neighborState)) { - level.scheduleTick(pos, this, 5); + || direction == Direction.UP && !blockState2.is(Blocks.BUBBLE_COLUMN) && canExistIn(blockState2)) { + scheduledTickAccess.scheduleTick(blockPos, this, 5); } - return super.updateShape(state, direction, neighborState, level, pos, neighborPos); + return super.updateShape(blockState, levelReader, scheduledTickAccess, blockPos, direction, blockPos2, blockState2, randomSource); } @Override diff --git a/net/minecraft/world/level/block/BushBlock.java b/net/minecraft/world/level/block/BushBlock.java index 240c580c..940c4af0 100644 --- a/net/minecraft/world/level/block/BushBlock.java +++ b/net/minecraft/world/level/block/BushBlock.java @@ -4,9 +4,10 @@ import com.mojang.serialization.MapCodec; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.tags.BlockTags; +import net.minecraft.util.RandomSource; import net.minecraft.world.level.BlockGetter; -import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.pathfinder.PathComputationType; @@ -24,8 +25,19 @@ public abstract class BushBlock extends Block { } @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { - return !state.canSurvive(level, pos) ? Blocks.AIR.defaultBlockState() : super.updateShape(state, direction, neighborState, level, pos, neighborPos); + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { + return !blockState.canSurvive(levelReader, blockPos) + ? Blocks.AIR.defaultBlockState() + : super.updateShape(blockState, levelReader, scheduledTickAccess, blockPos, direction, blockPos2, blockState2, randomSource); } @Override @@ -35,8 +47,8 @@ public abstract class BushBlock extends Block { } @Override - protected boolean propagatesSkylightDown(BlockState state, BlockGetter level, BlockPos pos) { - return state.getFluidState().isEmpty(); + protected boolean propagatesSkylightDown(BlockState blockState) { + return blockState.getFluidState().isEmpty(); } @Override diff --git a/net/minecraft/world/level/block/ButtonBlock.java b/net/minecraft/world/level/block/ButtonBlock.java index ad2f822d..03a8806a 100644 --- a/net/minecraft/world/level/block/ButtonBlock.java +++ b/net/minecraft/world/level/block/ButtonBlock.java @@ -27,6 +27,8 @@ import net.minecraft.world.level.block.state.properties.BlockSetType; import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.block.state.properties.BooleanProperty; import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.level.redstone.ExperimentalRedstoneUtils; +import net.minecraft.world.level.redstone.Orientation; import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.VoxelShape; @@ -111,17 +113,19 @@ public class ButtonBlock extends FaceAttachedHorizontalDirectionalBlock { return InteractionResult.CONSUME; } else { this.press(state, level, pos, player); - return InteractionResult.sidedSuccess(level.isClientSide); + return InteractionResult.SUCCESS; } } @Override - protected void onExplosionHit(BlockState state, Level level, BlockPos pos, Explosion explosion, BiConsumer dropConsumer) { - if (explosion.canTriggerBlocks() && !(Boolean)state.getValue(POWERED)) { - this.press(state, level, pos, null); + protected void onExplosionHit( + BlockState blockState, ServerLevel serverLevel, BlockPos blockPos, Explosion explosion, BiConsumer biConsumer + ) { + if (explosion.canTriggerBlocks() && !(Boolean)blockState.getValue(POWERED)) { + this.press(blockState, serverLevel, blockPos, null); } - super.onExplosionHit(state, level, pos, explosion, dropConsumer); + super.onExplosionHit(blockState, serverLevel, blockPos, explosion, biConsumer); } public void press(BlockState state, Level level, BlockPos pos, @Nullable Player player) { @@ -199,8 +203,12 @@ public class ButtonBlock extends FaceAttachedHorizontalDirectionalBlock { } private void updateNeighbours(BlockState state, Level level, BlockPos pos) { - level.updateNeighborsAt(pos, this); - level.updateNeighborsAt(pos.relative(getConnectedDirection(state).getOpposite()), this); + Direction direction = getConnectedDirection(state).getOpposite(); + Orientation orientation = ExperimentalRedstoneUtils.initialOrientation( + level, direction, direction.getAxis().isHorizontal() ? Direction.UP : state.getValue(FACING) + ); + level.updateNeighborsAt(pos, this, orientation); + level.updateNeighborsAt(pos.relative(direction), this, orientation); } @Override diff --git a/net/minecraft/world/level/block/CactusBlock.java b/net/minecraft/world/level/block/CactusBlock.java index a2eb29cc..a6f993b5 100644 --- a/net/minecraft/world/level/block/CactusBlock.java +++ b/net/minecraft/world/level/block/CactusBlock.java @@ -10,8 +10,8 @@ import net.minecraft.util.RandomSource; import net.minecraft.world.entity.Entity; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; -import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; @@ -62,7 +62,7 @@ public class CactusBlock extends Block { level.setBlockAndUpdate(blockPos, this.defaultBlockState()); BlockState blockState = state.setValue(AGE, 0); level.setBlock(pos, blockState, 4); - level.neighborChanged(blockState, blockPos, this, pos, false); + level.neighborChanged(blockState, blockPos, this, null, false); } else { level.setBlock(pos, state.setValue(AGE, j + 1), 4); } @@ -81,12 +81,21 @@ public class CactusBlock extends Block { } @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { - if (!state.canSurvive(level, pos)) { - level.scheduleTick(pos, this, 1); + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { + if (!blockState.canSurvive(levelReader, blockPos)) { + scheduledTickAccess.scheduleTick(blockPos, this, 1); } - return super.updateShape(state, direction, neighborState, level, pos, neighborPos); + return super.updateShape(blockState, levelReader, scheduledTickAccess, blockPos, direction, blockPos2, blockState2, randomSource); } @Override diff --git a/net/minecraft/world/level/block/CakeBlock.java b/net/minecraft/world/level/block/CakeBlock.java index 90e7f1ee..ed01ef44 100644 --- a/net/minecraft/world/level/block/CakeBlock.java +++ b/net/minecraft/world/level/block/CakeBlock.java @@ -7,9 +7,9 @@ import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; import net.minecraft.stats.Stats; import net.minecraft.tags.ItemTags; +import net.minecraft.util.RandomSource; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; -import net.minecraft.world.ItemInteractionResult; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; @@ -17,6 +17,7 @@ import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; @@ -61,19 +62,19 @@ public class CakeBlock extends Block { } @Override - protected ItemInteractionResult useItemOn( - ItemStack stack, BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hitResult + protected InteractionResult useItemOn( + ItemStack itemStack, BlockState blockState, Level level, BlockPos blockPos, Player player, InteractionHand interactionHand, BlockHitResult blockHitResult ) { - Item item = stack.getItem(); - if (stack.is(ItemTags.CANDLES) && (Integer)state.getValue(BITES) == 0 && Block.byItem(item) instanceof CandleBlock candleBlock) { - stack.consume(1, player); - level.playSound(null, pos, SoundEvents.CAKE_ADD_CANDLE, SoundSource.BLOCKS, 1.0F, 1.0F); - level.setBlockAndUpdate(pos, CandleCakeBlock.byCandle(candleBlock)); - level.gameEvent(player, GameEvent.BLOCK_CHANGE, pos); + Item item = itemStack.getItem(); + if (itemStack.is(ItemTags.CANDLES) && (Integer)blockState.getValue(BITES) == 0 && Block.byItem(item) instanceof CandleBlock candleBlock) { + itemStack.consume(1, player); + level.playSound(null, blockPos, SoundEvents.CAKE_ADD_CANDLE, SoundSource.BLOCKS, 1.0F, 1.0F); + level.setBlockAndUpdate(blockPos, CandleCakeBlock.byCandle(candleBlock)); + level.gameEvent(player, GameEvent.BLOCK_CHANGE, blockPos); player.awardStat(Stats.ITEM_USED.get(item)); - return ItemInteractionResult.SUCCESS; + return InteractionResult.SUCCESS; } else { - return ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION; + return InteractionResult.TRY_WITH_EMPTY_HAND; } } @@ -112,10 +113,19 @@ public class CakeBlock extends Block { } @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { - return direction == Direction.DOWN && !state.canSurvive(level, pos) + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { + return direction == Direction.DOWN && !blockState.canSurvive(levelReader, blockPos) ? Blocks.AIR.defaultBlockState() - : super.updateShape(state, direction, neighborState, level, pos, neighborPos); + : super.updateShape(blockState, levelReader, scheduledTickAccess, blockPos, direction, blockPos2, blockState2, randomSource); } @Override diff --git a/net/minecraft/world/level/block/CalibratedSculkSensorBlock.java b/net/minecraft/world/level/block/CalibratedSculkSensorBlock.java index c142364f..eef13fc8 100644 --- a/net/minecraft/world/level/block/CalibratedSculkSensorBlock.java +++ b/net/minecraft/world/level/block/CalibratedSculkSensorBlock.java @@ -14,13 +14,13 @@ import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.block.state.properties.BlockStateProperties; -import net.minecraft.world.level.block.state.properties.DirectionProperty; -import net.minecraft.world.level.gameevent.vibrations.VibrationSystem; +import net.minecraft.world.level.block.state.properties.EnumProperty; +import net.minecraft.world.level.gameevent.vibrations.VibrationSystem.Ticker; import org.jetbrains.annotations.Nullable; public class CalibratedSculkSensorBlock extends SculkSensorBlock { public static final MapCodec CODEC = simpleCodec(CalibratedSculkSensorBlock::new); - public static final DirectionProperty FACING = BlockStateProperties.HORIZONTAL_FACING; + public static final EnumProperty FACING = BlockStateProperties.HORIZONTAL_FACING; @Override public MapCodec codec() { @@ -45,7 +45,7 @@ public class CalibratedSculkSensorBlock extends SculkSensorBlock { ? createTickerHelper( blockEntityType, BlockEntityType.CALIBRATED_SCULK_SENSOR, - (levelx, blockPos, blockState, calibratedSculkSensorBlockEntity) -> VibrationSystem.Ticker.tick( + (levelx, blockPos, blockState, calibratedSculkSensorBlockEntity) -> Ticker.tick( levelx, calibratedSculkSensorBlockEntity.getVibrationData(), calibratedSculkSensorBlockEntity.getVibrationUser() ) ) diff --git a/net/minecraft/world/level/block/CampfireBlock.java b/net/minecraft/world/level/block/CampfireBlock.java index 3a5d460e..da73d3f6 100644 --- a/net/minecraft/world/level/block/CampfireBlock.java +++ b/net/minecraft/world/level/block/CampfireBlock.java @@ -3,11 +3,11 @@ package net.minecraft.world.level.block; import com.mojang.serialization.Codec; import com.mojang.serialization.MapCodec; import com.mojang.serialization.codecs.RecordCodecBuilder; -import java.util.Optional; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.particles.ParticleTypes; import net.minecraft.core.particles.SimpleParticleType; +import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; import net.minecraft.stats.Stats; @@ -15,7 +15,7 @@ import net.minecraft.tags.BlockTags; import net.minecraft.util.RandomSource; import net.minecraft.world.Containers; import net.minecraft.world.InteractionHand; -import net.minecraft.world.ItemInteractionResult; +import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.player.Player; @@ -23,10 +23,15 @@ import net.minecraft.world.entity.projectile.Projectile; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.item.crafting.CampfireCookingRecipe; -import net.minecraft.world.item.crafting.RecipeHolder; +import net.minecraft.world.item.crafting.RecipeManager; +import net.minecraft.world.item.crafting.RecipePropertySet; +import net.minecraft.world.item.crafting.RecipeType; +import net.minecraft.world.item.crafting.SingleRecipeInput; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntityTicker; import net.minecraft.world.level.block.entity.BlockEntityType; @@ -36,7 +41,7 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.block.state.properties.BooleanProperty; -import net.minecraft.world.level.block.state.properties.DirectionProperty; +import net.minecraft.world.level.block.state.properties.EnumProperty; import net.minecraft.world.level.gameevent.GameEvent; import net.minecraft.world.level.material.FluidState; import net.minecraft.world.level.material.Fluids; @@ -61,7 +66,7 @@ public class CampfireBlock extends BaseEntityBlock implements SimpleWaterloggedB public static final BooleanProperty LIT = BlockStateProperties.LIT; public static final BooleanProperty SIGNAL_FIRE = BlockStateProperties.SIGNAL_FIRE; public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED; - public static final DirectionProperty FACING = BlockStateProperties.HORIZONTAL_FACING; + public static final EnumProperty FACING = BlockStateProperties.HORIZONTAL_FACING; private static final VoxelShape VIRTUAL_FENCE_POST = Block.box(6.0, 0.0, 6.0, 10.0, 16.0, 10.0); private static final int SMOKE_DISTANCE = 5; private final boolean spawnParticles; @@ -82,24 +87,22 @@ public class CampfireBlock extends BaseEntityBlock implements SimpleWaterloggedB } @Override - protected ItemInteractionResult useItemOn( - ItemStack stack, BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hitResult + protected InteractionResult useItemOn( + ItemStack itemStack, BlockState blockState, Level level, BlockPos blockPos, Player player, InteractionHand interactionHand, BlockHitResult blockHitResult ) { - if (level.getBlockEntity(pos) instanceof CampfireBlockEntity campfireBlockEntity) { - ItemStack itemStack = player.getItemInHand(hand); - Optional> optional = campfireBlockEntity.getCookableRecipe(itemStack); - if (optional.isPresent()) { - if (!level.isClientSide - && campfireBlockEntity.placeFood(player, itemStack, ((CampfireCookingRecipe)((RecipeHolder)optional.get()).value()).getCookingTime())) { + if (level.getBlockEntity(blockPos) instanceof CampfireBlockEntity campfireBlockEntity) { + ItemStack itemStack2 = player.getItemInHand(interactionHand); + if (level.recipeAccess().propertySet(RecipePropertySet.CAMPFIRE_INPUT).test(itemStack2)) { + if (level instanceof ServerLevel serverLevel && campfireBlockEntity.placeFood(serverLevel, player, itemStack2)) { player.awardStat(Stats.INTERACT_WITH_CAMPFIRE); - return ItemInteractionResult.SUCCESS; + return InteractionResult.SUCCESS_SERVER; } - return ItemInteractionResult.CONSUME; + return InteractionResult.CONSUME; } } - return ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION; + return InteractionResult.TRY_WITH_EMPTY_HAND; } @Override @@ -137,14 +140,23 @@ public class CampfireBlock extends BaseEntityBlock implements SimpleWaterloggedB } @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { - if ((Boolean)state.getValue(WATERLOGGED)) { - level.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(level)); + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { + if ((Boolean)blockState.getValue(WATERLOGGED)) { + scheduledTickAccess.scheduleTick(blockPos, Fluids.WATER, Fluids.WATER.getTickDelay(levelReader)); } return direction == Direction.DOWN - ? state.setValue(SIGNAL_FIRE, this.isSmokeSource(neighborState)) - : super.updateShape(state, direction, neighborState, level, pos, neighborPos); + ? blockState.setValue(SIGNAL_FIRE, this.isSmokeSource(blockState2)) + : super.updateShape(blockState, levelReader, scheduledTickAccess, blockPos, direction, blockPos2, blockState2, randomSource); } /** @@ -226,9 +238,9 @@ public class CampfireBlock extends BaseEntityBlock implements SimpleWaterloggedB @Override protected void onProjectileHit(Level level, BlockState state, BlockHitResult hit, Projectile projectile) { BlockPos blockPos = hit.getBlockPos(); - if (!level.isClientSide + if (level instanceof ServerLevel serverLevel && projectile.isOnFire() - && projectile.mayInteract(level, blockPos) + && projectile.mayInteract(serverLevel, blockPos) && !(Boolean)state.getValue(LIT) && !(Boolean)state.getValue(WATERLOGGED)) { level.setBlock(blockPos, state.setValue(BlockStateProperties.LIT, true), 11); @@ -311,12 +323,19 @@ public class CampfireBlock extends BaseEntityBlock implements SimpleWaterloggedB @Nullable @Override public BlockEntityTicker getTicker(Level level, BlockState state, BlockEntityType blockEntityType) { - if (level.isClientSide) { - return state.getValue(LIT) ? createTickerHelper(blockEntityType, BlockEntityType.CAMPFIRE, CampfireBlockEntity::particleTick) : null; + if (level instanceof ServerLevel serverLevel) { + if ((Boolean)state.getValue(LIT)) { + RecipeManager.CachedCheck cachedCheck = RecipeManager.createCheck(RecipeType.CAMPFIRE_COOKING); + return createTickerHelper( + blockEntityType, + BlockEntityType.CAMPFIRE, + (levelx, blockPos, blockState, campfireBlockEntity) -> CampfireBlockEntity.cookTick(serverLevel, blockPos, blockState, campfireBlockEntity, cachedCheck) + ); + } else { + return createTickerHelper(blockEntityType, BlockEntityType.CAMPFIRE, CampfireBlockEntity::cooldownTick); + } } else { - return state.getValue(LIT) - ? createTickerHelper(blockEntityType, BlockEntityType.CAMPFIRE, CampfireBlockEntity::cookTick) - : createTickerHelper(blockEntityType, BlockEntityType.CAMPFIRE, CampfireBlockEntity::cooldownTick); + return state.getValue(LIT) ? createTickerHelper(blockEntityType, BlockEntityType.CAMPFIRE, CampfireBlockEntity::particleTick) : null; } } diff --git a/net/minecraft/world/level/block/CandleBlock.java b/net/minecraft/world/level/block/CandleBlock.java index 46d60935..f626e16e 100644 --- a/net/minecraft/world/level/block/CandleBlock.java +++ b/net/minecraft/world/level/block/CandleBlock.java @@ -11,8 +11,9 @@ import net.minecraft.Util; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.tags.BlockTags; +import net.minecraft.util.RandomSource; import net.minecraft.world.InteractionHand; -import net.minecraft.world.ItemInteractionResult; +import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.context.BlockPlaceContext; @@ -20,6 +21,7 @@ import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; @@ -66,14 +68,14 @@ public class CandleBlock extends AbstractCandleBlock implements SimpleWaterlogge } @Override - protected ItemInteractionResult useItemOn( - ItemStack stack, BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hitResult + protected InteractionResult useItemOn( + ItemStack itemStack, BlockState blockState, Level level, BlockPos blockPos, Player player, InteractionHand interactionHand, BlockHitResult blockHitResult ) { - if (stack.isEmpty() && player.getAbilities().mayBuild && (Boolean)state.getValue(LIT)) { - extinguish(player, state, level, pos); - return ItemInteractionResult.sidedSuccess(level.isClientSide); + if (itemStack.isEmpty() && player.getAbilities().mayBuild && (Boolean)blockState.getValue(LIT)) { + extinguish(player, blockState, level, blockPos); + return InteractionResult.SUCCESS; } else { - return super.useItemOn(stack, state, level, pos, player, hand, hitResult); + return super.useItemOn(itemStack, blockState, level, blockPos, player, interactionHand, blockHitResult); } } @@ -97,12 +99,21 @@ public class CandleBlock extends AbstractCandleBlock implements SimpleWaterlogge } @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { - if ((Boolean)state.getValue(WATERLOGGED)) { - level.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(level)); + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { + if ((Boolean)blockState.getValue(WATERLOGGED)) { + scheduledTickAccess.scheduleTick(blockPos, Fluids.WATER, Fluids.WATER.getTickDelay(levelReader)); } - return super.updateShape(state, direction, neighborState, level, pos, neighborPos); + return super.updateShape(blockState, levelReader, scheduledTickAccess, blockPos, direction, blockPos2, blockState2, randomSource); } @Override diff --git a/net/minecraft/world/level/block/CandleCakeBlock.java b/net/minecraft/world/level/block/CandleCakeBlock.java index f23f7657..dad0950a 100644 --- a/net/minecraft/world/level/block/CandleCakeBlock.java +++ b/net/minecraft/world/level/block/CandleCakeBlock.java @@ -9,16 +9,16 @@ import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.tags.BlockTags; +import net.minecraft.util.RandomSource; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; -import net.minecraft.world.ItemInteractionResult; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; -import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; @@ -73,16 +73,16 @@ public class CandleCakeBlock extends AbstractCandleBlock { } @Override - protected ItemInteractionResult useItemOn( - ItemStack stack, BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hitResult + protected InteractionResult useItemOn( + ItemStack itemStack, BlockState blockState, Level level, BlockPos blockPos, Player player, InteractionHand interactionHand, BlockHitResult blockHitResult ) { - if (stack.is(Items.FLINT_AND_STEEL) || stack.is(Items.FIRE_CHARGE)) { - return ItemInteractionResult.SKIP_DEFAULT_BLOCK_INTERACTION; - } else if (candleHit(hitResult) && stack.isEmpty() && (Boolean)state.getValue(LIT)) { - extinguish(player, state, level, pos); - return ItemInteractionResult.sidedSuccess(level.isClientSide); + if (itemStack.is(Items.FLINT_AND_STEEL) || itemStack.is(Items.FIRE_CHARGE)) { + return InteractionResult.PASS; + } else if (candleHit(blockHitResult) && itemStack.isEmpty() && (Boolean)blockState.getValue(LIT)) { + extinguish(player, blockState, level, blockPos); + return InteractionResult.SUCCESS; } else { - return super.useItemOn(stack, state, level, pos, player, hand, hitResult); + return super.useItemOn(itemStack, blockState, level, blockPos, player, interactionHand, blockHitResult); } } @@ -111,10 +111,19 @@ public class CandleCakeBlock extends AbstractCandleBlock { } @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { - return direction == Direction.DOWN && !state.canSurvive(level, pos) + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { + return direction == Direction.DOWN && !blockState.canSurvive(levelReader, blockPos) ? Blocks.AIR.defaultBlockState() - : super.updateShape(state, direction, neighborState, level, pos, neighborPos); + : super.updateShape(blockState, levelReader, scheduledTickAccess, blockPos, direction, blockPos2, blockState2, randomSource); } @Override diff --git a/net/minecraft/world/level/block/CarpetBlock.java b/net/minecraft/world/level/block/CarpetBlock.java index c5843ecd..f81272a0 100644 --- a/net/minecraft/world/level/block/CarpetBlock.java +++ b/net/minecraft/world/level/block/CarpetBlock.java @@ -3,9 +3,10 @@ package net.minecraft.world.level.block; import com.mojang.serialization.MapCodec; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; +import net.minecraft.util.RandomSource; import net.minecraft.world.level.BlockGetter; -import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.shapes.CollisionContext; @@ -30,8 +31,19 @@ public class CarpetBlock extends Block { } @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { - return !state.canSurvive(level, pos) ? Blocks.AIR.defaultBlockState() : super.updateShape(state, direction, neighborState, level, pos, neighborPos); + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { + return !blockState.canSurvive(levelReader, blockPos) + ? Blocks.AIR.defaultBlockState() + : super.updateShape(blockState, levelReader, scheduledTickAccess, blockPos, direction, blockPos2, blockState2, randomSource); } @Override diff --git a/net/minecraft/world/level/block/CartographyTableBlock.java b/net/minecraft/world/level/block/CartographyTableBlock.java index c072eb3a..5a5914fc 100644 --- a/net/minecraft/world/level/block/CartographyTableBlock.java +++ b/net/minecraft/world/level/block/CartographyTableBlock.java @@ -31,13 +31,12 @@ public class CartographyTableBlock extends Block { @Override protected InteractionResult useWithoutItem(BlockState state, Level level, BlockPos pos, Player player, BlockHitResult hitResult) { - if (level.isClientSide) { - return InteractionResult.SUCCESS; - } else { + if (!level.isClientSide) { player.openMenu(state.getMenuProvider(level, pos)); player.awardStat(Stats.INTERACT_WITH_CARTOGRAPHY_TABLE); - return InteractionResult.CONSUME; } + + return InteractionResult.SUCCESS; } @Nullable diff --git a/net/minecraft/world/level/block/CarvedPumpkinBlock.java b/net/minecraft/world/level/block/CarvedPumpkinBlock.java index 9ae2c7f0..04130cbd 100644 --- a/net/minecraft/world/level/block/CarvedPumpkinBlock.java +++ b/net/minecraft/world/level/block/CarvedPumpkinBlock.java @@ -7,6 +7,7 @@ import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.animal.IronGolem; import net.minecraft.world.entity.animal.SnowGolem; @@ -19,13 +20,14 @@ import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.block.state.pattern.BlockInWorld; import net.minecraft.world.level.block.state.pattern.BlockPattern; import net.minecraft.world.level.block.state.pattern.BlockPatternBuilder; +import net.minecraft.world.level.block.state.pattern.BlockPattern.BlockPatternMatch; import net.minecraft.world.level.block.state.predicate.BlockStatePredicate; -import net.minecraft.world.level.block.state.properties.DirectionProperty; +import net.minecraft.world.level.block.state.properties.EnumProperty; import org.jetbrains.annotations.Nullable; public class CarvedPumpkinBlock extends HorizontalDirectionalBlock { public static final MapCodec CODEC = simpleCodec(CarvedPumpkinBlock::new); - public static final DirectionProperty FACING = HorizontalDirectionalBlock.FACING; + public static final EnumProperty FACING = HorizontalDirectionalBlock.FACING; @Nullable private BlockPattern snowGolemBase; @Nullable @@ -59,16 +61,16 @@ public class CarvedPumpkinBlock extends HorizontalDirectionalBlock { } private void trySpawnGolem(Level level, BlockPos pos) { - BlockPattern.BlockPatternMatch blockPatternMatch = this.getOrCreateSnowGolemFull().find(level, pos); + BlockPatternMatch blockPatternMatch = this.getOrCreateSnowGolemFull().find(level, pos); if (blockPatternMatch != null) { - SnowGolem snowGolem = EntityType.SNOW_GOLEM.create(level); + SnowGolem snowGolem = EntityType.SNOW_GOLEM.create(level, EntitySpawnReason.TRIGGERED); if (snowGolem != null) { spawnGolemInWorld(level, blockPatternMatch, snowGolem, blockPatternMatch.getBlock(0, 2, 0).getPos()); } } else { - BlockPattern.BlockPatternMatch blockPatternMatch2 = this.getOrCreateIronGolemFull().find(level, pos); + BlockPatternMatch blockPatternMatch2 = this.getOrCreateIronGolemFull().find(level, pos); if (blockPatternMatch2 != null) { - IronGolem ironGolem = EntityType.IRON_GOLEM.create(level); + IronGolem ironGolem = EntityType.IRON_GOLEM.create(level, EntitySpawnReason.TRIGGERED); if (ironGolem != null) { ironGolem.setPlayerCreated(true); spawnGolemInWorld(level, blockPatternMatch2, ironGolem, blockPatternMatch2.getBlock(1, 2, 0).getPos()); @@ -77,7 +79,7 @@ public class CarvedPumpkinBlock extends HorizontalDirectionalBlock { } } - private static void spawnGolemInWorld(Level level, BlockPattern.BlockPatternMatch patternMatch, Entity golem, BlockPos pos) { + private static void spawnGolemInWorld(Level level, BlockPatternMatch patternMatch, Entity golem, BlockPos pos) { clearPatternBlocks(level, patternMatch); golem.moveTo(pos.getX() + 0.5, pos.getY() + 0.05, pos.getZ() + 0.5, 0.0F, 0.0F); level.addFreshEntity(golem); @@ -89,7 +91,7 @@ public class CarvedPumpkinBlock extends HorizontalDirectionalBlock { updatePatternBlocks(level, patternMatch); } - public static void clearPatternBlocks(Level level, BlockPattern.BlockPatternMatch patternMatch) { + public static void clearPatternBlocks(Level level, BlockPatternMatch patternMatch) { for (int i = 0; i < patternMatch.getWidth(); i++) { for (int j = 0; j < patternMatch.getHeight(); j++) { BlockInWorld blockInWorld = patternMatch.getBlock(i, j, 0); @@ -99,7 +101,7 @@ public class CarvedPumpkinBlock extends HorizontalDirectionalBlock { } } - public static void updatePatternBlocks(Level level, BlockPattern.BlockPatternMatch patternMatch) { + public static void updatePatternBlocks(Level level, BlockPatternMatch patternMatch) { for (int i = 0; i < patternMatch.getWidth(); i++) { for (int j = 0; j < patternMatch.getHeight(); j++) { BlockInWorld blockInWorld = patternMatch.getBlock(i, j, 0); diff --git a/net/minecraft/world/level/block/CauldronBlock.java b/net/minecraft/world/level/block/CauldronBlock.java index 8475ef6e..154744e4 100644 --- a/net/minecraft/world/level/block/CauldronBlock.java +++ b/net/minecraft/world/level/block/CauldronBlock.java @@ -8,6 +8,7 @@ import net.minecraft.world.level.biome.Biome; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.level.gameevent.GameEvent.Context; import net.minecraft.world.level.material.Fluid; import net.minecraft.world.level.material.Fluids; @@ -61,12 +62,12 @@ public class CauldronBlock extends AbstractCauldronBlock { if (fluid == Fluids.WATER) { BlockState blockState = Blocks.WATER_CAULDRON.defaultBlockState(); level.setBlockAndUpdate(pos, blockState); - level.gameEvent(GameEvent.BLOCK_CHANGE, pos, GameEvent.Context.of(blockState)); + level.gameEvent(GameEvent.BLOCK_CHANGE, pos, Context.of(blockState)); level.levelEvent(1047, pos, 0); } else if (fluid == Fluids.LAVA) { BlockState blockState = Blocks.LAVA_CAULDRON.defaultBlockState(); level.setBlockAndUpdate(pos, blockState); - level.gameEvent(GameEvent.BLOCK_CHANGE, pos, GameEvent.Context.of(blockState)); + level.gameEvent(GameEvent.BLOCK_CHANGE, pos, Context.of(blockState)); level.levelEvent(1046, pos, 0); } } diff --git a/net/minecraft/world/level/block/CaveVines.java b/net/minecraft/world/level/block/CaveVines.java index 09969c56..5b7683cb 100644 --- a/net/minecraft/world/level/block/CaveVines.java +++ b/net/minecraft/world/level/block/CaveVines.java @@ -14,6 +14,7 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.block.state.properties.BooleanProperty; import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.level.gameevent.GameEvent.Context; import net.minecraft.world.phys.shapes.VoxelShape; import org.jetbrains.annotations.Nullable; @@ -28,8 +29,8 @@ public interface CaveVines { level.playSound(null, pos, SoundEvents.CAVE_VINES_PICK_BERRIES, SoundSource.BLOCKS, 1.0F, f); BlockState blockState = state.setValue(BERRIES, false); level.setBlock(pos, blockState, 2); - level.gameEvent(GameEvent.BLOCK_CHANGE, pos, GameEvent.Context.of(entity, blockState)); - return InteractionResult.sidedSuccess(level.isClientSide); + level.gameEvent(GameEvent.BLOCK_CHANGE, pos, Context.of(entity, blockState)); + return InteractionResult.SUCCESS; } else { return InteractionResult.PASS; } diff --git a/net/minecraft/world/level/block/CaveVinesBlock.java b/net/minecraft/world/level/block/CaveVinesBlock.java index b5564aa1..576e37a1 100644 --- a/net/minecraft/world/level/block/CaveVinesBlock.java +++ b/net/minecraft/world/level/block/CaveVinesBlock.java @@ -16,7 +16,7 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.phys.BlockHitResult; -public class CaveVinesBlock extends GrowingPlantHeadBlock implements BonemealableBlock, CaveVines { +public class CaveVinesBlock extends GrowingPlantHeadBlock implements CaveVines { public static final MapCodec CODEC = simpleCodec(CaveVinesBlock::new); private static final float CHANCE_OF_BERRIES_ON_GROWTH = 0.11F; diff --git a/net/minecraft/world/level/block/CaveVinesPlantBlock.java b/net/minecraft/world/level/block/CaveVinesPlantBlock.java index 9e227faf..a5a6ac23 100644 --- a/net/minecraft/world/level/block/CaveVinesPlantBlock.java +++ b/net/minecraft/world/level/block/CaveVinesPlantBlock.java @@ -16,7 +16,7 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.phys.BlockHitResult; -public class CaveVinesPlantBlock extends GrowingPlantBodyBlock implements BonemealableBlock, CaveVines { +public class CaveVinesPlantBlock extends GrowingPlantBodyBlock implements CaveVines { public static final MapCodec CODEC = simpleCodec(CaveVinesPlantBlock::new); @Override diff --git a/net/minecraft/world/level/block/CeilingHangingSignBlock.java b/net/minecraft/world/level/block/CeilingHangingSignBlock.java index 4941ec69..917ca894 100644 --- a/net/minecraft/world/level/block/CeilingHangingSignBlock.java +++ b/net/minecraft/world/level/block/CeilingHangingSignBlock.java @@ -9,16 +9,17 @@ import java.util.Optional; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.tags.BlockTags; +import net.minecraft.util.RandomSource; import net.minecraft.world.InteractionHand; -import net.minecraft.world.ItemInteractionResult; +import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.HangingSignItem; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; -import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntityTicker; import net.minecraft.world.level.block.entity.BlockEntityType; @@ -71,13 +72,13 @@ public class CeilingHangingSignBlock extends SignBlock { } @Override - protected ItemInteractionResult useItemOn( - ItemStack stack, BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hitResult + protected InteractionResult useItemOn( + ItemStack itemStack, BlockState blockState, Level level, BlockPos blockPos, Player player, InteractionHand interactionHand, BlockHitResult blockHitResult ) { - return level.getBlockEntity(pos) instanceof SignBlockEntity signBlockEntity - && this.shouldTryToChainAnotherHangingSign(player, hitResult, signBlockEntity, stack) - ? ItemInteractionResult.SKIP_DEFAULT_BLOCK_INTERACTION - : super.useItemOn(stack, state, level, pos, player, hand, hitResult); + return (InteractionResult)(level.getBlockEntity(blockPos) instanceof SignBlockEntity signBlockEntity + && this.shouldTryToChainAnotherHangingSign(player, blockHitResult, signBlockEntity, itemStack) + ? InteractionResult.PASS + : super.useItemOn(itemStack, blockState, level, blockPos, player, interactionHand, blockHitResult)); } private boolean shouldTryToChainAnotherHangingSign(Player player, BlockHitResult hitResult, SignBlockEntity sign, ItemStack stack) { @@ -130,10 +131,19 @@ public class CeilingHangingSignBlock extends SignBlock { } @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { - return direction == Direction.UP && !this.canSurvive(state, level, pos) + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { + return direction == Direction.UP && !this.canSurvive(blockState, levelReader, blockPos) ? Blocks.AIR.defaultBlockState() - : super.updateShape(state, direction, neighborState, level, pos, neighborPos); + : super.updateShape(blockState, levelReader, scheduledTickAccess, blockPos, direction, blockPos2, blockState2, randomSource); } @Override diff --git a/net/minecraft/world/level/block/ChainBlock.java b/net/minecraft/world/level/block/ChainBlock.java index 4c15179a..dcb5cb00 100644 --- a/net/minecraft/world/level/block/ChainBlock.java +++ b/net/minecraft/world/level/block/ChainBlock.java @@ -3,9 +3,11 @@ package net.minecraft.world.level.block; import com.mojang.serialization.MapCodec; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; +import net.minecraft.util.RandomSource; import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.level.BlockGetter; -import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; @@ -59,12 +61,21 @@ public class ChainBlock extends RotatedPillarBlock implements SimpleWaterloggedB } @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { - if ((Boolean)state.getValue(WATERLOGGED)) { - level.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(level)); + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { + if ((Boolean)blockState.getValue(WATERLOGGED)) { + scheduledTickAccess.scheduleTick(blockPos, Fluids.WATER, Fluids.WATER.getTickDelay(levelReader)); } - return super.updateShape(state, direction, neighborState, level, pos, neighborPos); + return super.updateShape(blockState, levelReader, scheduledTickAccess, blockPos, direction, blockPos2, blockState2, randomSource); } @Override diff --git a/net/minecraft/world/level/block/ChestBlock.java b/net/minecraft/world/level/block/ChestBlock.java index 705a11dd..2641f555 100644 --- a/net/minecraft/world/level/block/ChestBlock.java +++ b/net/minecraft/world/level/block/ChestBlock.java @@ -8,7 +8,6 @@ import java.util.function.BiPredicate; import java.util.function.Supplier; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; -import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.level.ServerLevel; import net.minecraft.stats.Stat; @@ -21,14 +20,15 @@ import net.minecraft.world.InteractionResult; import net.minecraft.world.MenuProvider; import net.minecraft.world.entity.animal.Cat; import net.minecraft.world.entity.monster.piglin.PiglinAi; -import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.entity.player.Player; import net.minecraft.world.inventory.AbstractContainerMenu; -import net.minecraft.world.inventory.ChestMenu; import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; +import net.minecraft.world.level.block.ChestBlock.2.1; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntityTicker; import net.minecraft.world.level.block.entity.BlockEntityType; @@ -40,7 +40,6 @@ import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.block.state.properties.BooleanProperty; import net.minecraft.world.level.block.state.properties.ChestType; -import net.minecraft.world.level.block.state.properties.DirectionProperty; import net.minecraft.world.level.block.state.properties.EnumProperty; import net.minecraft.world.level.material.FluidState; import net.minecraft.world.level.material.Fluids; @@ -52,8 +51,8 @@ import net.minecraft.world.phys.shapes.VoxelShape; import org.jetbrains.annotations.Nullable; public class ChestBlock extends AbstractChestBlock implements SimpleWaterloggedBlock { - public static final MapCodec CODEC = simpleCodec(properties -> new ChestBlock(properties, () -> BlockEntityType.CHEST)); - public static final DirectionProperty FACING = HorizontalDirectionalBlock.FACING; + public static final MapCodec CODEC = simpleCodec(properties -> new ChestBlock(() -> BlockEntityType.CHEST, properties)); + public static final EnumProperty FACING = HorizontalDirectionalBlock.FACING; public static final EnumProperty TYPE = BlockStateProperties.CHEST_TYPE; public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED; public static final int EVENT_SET_OPEN_COUNT = 1; @@ -79,29 +78,8 @@ public class ChestBlock extends AbstractChestBlock implements }; private static final DoubleBlockCombiner.Combiner> MENU_PROVIDER_COMBINER = new DoubleBlockCombiner.Combiner>() { public Optional acceptDouble(ChestBlockEntity chestBlockEntity, ChestBlockEntity chestBlockEntity2) { - final Container container = new CompoundContainer(chestBlockEntity, chestBlockEntity2); - return Optional.of(new MenuProvider() { - @Nullable - @Override - public AbstractContainerMenu createMenu(int i, Inventory inventory, Player player) { - if (chestBlockEntity.canOpen(player) && chestBlockEntity2.canOpen(player)) { - chestBlockEntity.unpackLootTable(inventory.player); - chestBlockEntity2.unpackLootTable(inventory.player); - return ChestMenu.sixRows(i, inventory, container); - } else { - return null; - } - } - - @Override - public Component getDisplayName() { - if (chestBlockEntity.hasCustomName()) { - return chestBlockEntity.getDisplayName(); - } else { - return (Component)(chestBlockEntity2.hasCustomName() ? chestBlockEntity2.getDisplayName() : Component.translatable("container.chestDouble")); - } - } - }); + Container container = new CompoundContainer(chestBlockEntity, chestBlockEntity2); + return Optional.of(new 1(this, chestBlockEntity, chestBlockEntity2, container)); } public Optional acceptSingle(ChestBlockEntity chestBlockEntity) { @@ -118,8 +96,8 @@ public class ChestBlock extends AbstractChestBlock implements return CODEC; } - protected ChestBlock(BlockBehaviour.Properties properties, Supplier> blockEntityType) { - super(properties, blockEntityType); + protected ChestBlock(Supplier> supplier, BlockBehaviour.Properties properties) { + super(properties, supplier); this.registerDefaultState(this.stateDefinition.any().setValue(FACING, Direction.NORTH).setValue(TYPE, ChestType.SINGLE).setValue(WATERLOGGED, false)); } @@ -138,24 +116,33 @@ public class ChestBlock extends AbstractChestBlock implements } @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { - if ((Boolean)state.getValue(WATERLOGGED)) { - level.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(level)); + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { + if ((Boolean)blockState.getValue(WATERLOGGED)) { + scheduledTickAccess.scheduleTick(blockPos, Fluids.WATER, Fluids.WATER.getTickDelay(levelReader)); } - if (neighborState.is(this) && direction.getAxis().isHorizontal()) { - ChestType chestType = neighborState.getValue(TYPE); - if (state.getValue(TYPE) == ChestType.SINGLE + if (blockState2.is(this) && direction.getAxis().isHorizontal()) { + ChestType chestType = blockState2.getValue(TYPE); + if (blockState.getValue(TYPE) == ChestType.SINGLE && chestType != ChestType.SINGLE - && state.getValue(FACING) == neighborState.getValue(FACING) - && getConnectedDirection(neighborState) == direction.getOpposite()) { - return state.setValue(TYPE, chestType.getOpposite()); + && blockState.getValue(FACING) == blockState2.getValue(FACING) + && getConnectedDirection(blockState2) == direction.getOpposite()) { + return blockState.setValue(TYPE, chestType.getOpposite()); } - } else if (getConnectedDirection(state) == direction) { - return state.setValue(TYPE, ChestType.SINGLE); + } else if (getConnectedDirection(blockState) == direction) { + return blockState.setValue(TYPE, ChestType.SINGLE); } - return super.updateShape(state, direction, neighborState, level, pos, neighborPos); + return super.updateShape(blockState, levelReader, scheduledTickAccess, blockPos, direction, blockPos2, blockState2, randomSource); } @Override @@ -230,18 +217,16 @@ public class ChestBlock extends AbstractChestBlock implements @Override protected InteractionResult useWithoutItem(BlockState state, Level level, BlockPos pos, Player player, BlockHitResult hitResult) { - if (level.isClientSide) { - return InteractionResult.SUCCESS; - } else { + if (level instanceof ServerLevel serverLevel) { MenuProvider menuProvider = this.getMenuProvider(state, level, pos); if (menuProvider != null) { player.openMenu(menuProvider); player.awardStat(this.getOpenChestStat()); - PiglinAi.angerNearbyPiglins(player, true); + PiglinAi.angerNearbyPiglins(serverLevel, player, true); } - - return InteractionResult.CONSUME; } + + return InteractionResult.SUCCESS; } protected Stat getOpenChestStat() { diff --git a/net/minecraft/world/level/block/ChiseledBookShelfBlock.java b/net/minecraft/world/level/block/ChiseledBookShelfBlock.java index 6cd08ceb..2b1ffa3b 100644 --- a/net/minecraft/world/level/block/ChiseledBookShelfBlock.java +++ b/net/minecraft/world/level/block/ChiseledBookShelfBlock.java @@ -14,7 +14,6 @@ import net.minecraft.tags.ItemTags; import net.minecraft.world.Containers; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; -import net.minecraft.world.ItemInteractionResult; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; @@ -69,25 +68,25 @@ public class ChiseledBookShelfBlock extends BaseEntityBlock { } @Override - protected ItemInteractionResult useItemOn( - ItemStack stack, BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hitResult + protected InteractionResult useItemOn( + ItemStack itemStack, BlockState blockState, Level level, BlockPos blockPos, Player player, InteractionHand interactionHand, BlockHitResult blockHitResult ) { - if (level.getBlockEntity(pos) instanceof ChiseledBookShelfBlockEntity chiseledBookShelfBlockEntity) { - if (!stack.is(ItemTags.BOOKSHELF_BOOKS)) { - return ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION; + if (level.getBlockEntity(blockPos) instanceof ChiseledBookShelfBlockEntity chiseledBookShelfBlockEntity) { + if (!itemStack.is(ItemTags.BOOKSHELF_BOOKS)) { + return InteractionResult.TRY_WITH_EMPTY_HAND; } else { - OptionalInt optionalInt = this.getHitSlot(hitResult, state); + OptionalInt optionalInt = this.getHitSlot(blockHitResult, blockState); if (optionalInt.isEmpty()) { - return ItemInteractionResult.SKIP_DEFAULT_BLOCK_INTERACTION; - } else if ((Boolean)state.getValue((Property)SLOT_OCCUPIED_PROPERTIES.get(optionalInt.getAsInt()))) { - return ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION; + return InteractionResult.PASS; + } else if ((Boolean)blockState.getValue((Property)SLOT_OCCUPIED_PROPERTIES.get(optionalInt.getAsInt()))) { + return InteractionResult.TRY_WITH_EMPTY_HAND; } else { - addBook(level, pos, player, chiseledBookShelfBlockEntity, stack, optionalInt.getAsInt()); - return ItemInteractionResult.sidedSuccess(level.isClientSide); + addBook(level, blockPos, player, chiseledBookShelfBlockEntity, itemStack, optionalInt.getAsInt()); + return InteractionResult.SUCCESS; } } } else { - return ItemInteractionResult.SKIP_DEFAULT_BLOCK_INTERACTION; + return InteractionResult.PASS; } } @@ -101,7 +100,7 @@ public class ChiseledBookShelfBlock extends BaseEntityBlock { return InteractionResult.CONSUME; } else { removeBook(level, pos, player, chiseledBookShelfBlockEntity, optionalInt.getAsInt()); - return InteractionResult.sidedSuccess(level.isClientSide); + return InteractionResult.SUCCESS; } } else { return InteractionResult.PASS; diff --git a/net/minecraft/world/level/block/ChorusFlowerBlock.java b/net/minecraft/world/level/block/ChorusFlowerBlock.java index e4689098..97986a6e 100644 --- a/net/minecraft/world/level/block/ChorusFlowerBlock.java +++ b/net/minecraft/world/level/block/ChorusFlowerBlock.java @@ -12,6 +12,7 @@ import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; @@ -62,7 +63,7 @@ public class ChorusFlowerBlock extends Block { @Override protected void randomTick(BlockState state, ServerLevel level, BlockPos pos, RandomSource random) { BlockPos blockPos = pos.above(); - if (level.isEmptyBlock(blockPos) && blockPos.getY() < level.getMaxBuildHeight()) { + if (level.isEmptyBlock(blockPos) && blockPos.getY() <= level.getMaxY()) { int i = (Integer)state.getValue(AGE); if (i < 5) { boolean bl = false; @@ -145,12 +146,21 @@ public class ChorusFlowerBlock extends Block { } @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { - if (direction != Direction.UP && !state.canSurvive(level, pos)) { - level.scheduleTick(pos, this, 1); + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { + if (direction != Direction.UP && !blockState.canSurvive(levelReader, blockPos)) { + scheduledTickAccess.scheduleTick(blockPos, this, 1); } - return super.updateShape(state, direction, neighborState, level, pos, neighborPos); + return super.updateShape(blockState, levelReader, scheduledTickAccess, blockPos, direction, blockPos2, blockState2, randomSource); } @Override @@ -246,7 +256,7 @@ public class ChorusFlowerBlock extends Block { @Override protected void onProjectileHit(Level level, BlockState state, BlockHitResult hit, Projectile projectile) { BlockPos blockPos = hit.getBlockPos(); - if (!level.isClientSide && projectile.mayInteract(level, blockPos) && projectile.mayBreak(level)) { + if (level instanceof ServerLevel serverLevel && projectile.mayInteract(serverLevel, blockPos) && projectile.mayBreak(serverLevel)) { level.destroyBlock(blockPos, true, projectile); } } diff --git a/net/minecraft/world/level/block/ChorusPlantBlock.java b/net/minecraft/world/level/block/ChorusPlantBlock.java index 1ab547d1..3ab3f7c1 100644 --- a/net/minecraft/world/level/block/ChorusPlantBlock.java +++ b/net/minecraft/world/level/block/ChorusPlantBlock.java @@ -7,8 +7,8 @@ import net.minecraft.server.level.ServerLevel; import net.minecraft.util.RandomSource; import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.level.BlockGetter; -import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; @@ -59,13 +59,22 @@ public class ChorusPlantBlock extends PipeBlock { } @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { - if (!state.canSurvive(level, pos)) { - level.scheduleTick(pos, this, 1); - return super.updateShape(state, direction, neighborState, level, pos, neighborPos); + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { + if (!blockState.canSurvive(levelReader, blockPos)) { + scheduledTickAccess.scheduleTick(blockPos, this, 1); + return super.updateShape(blockState, levelReader, scheduledTickAccess, blockPos, direction, blockPos2, blockState2, randomSource); } else { - boolean bl = neighborState.is(this) || neighborState.is(Blocks.CHORUS_FLOWER) || direction == Direction.DOWN && neighborState.is(Blocks.END_STONE); - return state.setValue((Property)PROPERTY_BY_DIRECTION.get(direction), bl); + boolean bl = blockState2.is(this) || blockState2.is(Blocks.CHORUS_FLOWER) || direction == Direction.DOWN && blockState2.is(Blocks.END_STONE); + return blockState.setValue((Property)PROPERTY_BY_DIRECTION.get(direction), bl); } } diff --git a/net/minecraft/world/level/block/CocoaBlock.java b/net/minecraft/world/level/block/CocoaBlock.java index daacac9a..e43f9dd1 100644 --- a/net/minecraft/world/level/block/CocoaBlock.java +++ b/net/minecraft/world/level/block/CocoaBlock.java @@ -9,8 +9,8 @@ import net.minecraft.util.RandomSource; import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; -import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; @@ -114,10 +114,19 @@ public class CocoaBlock extends HorizontalDirectionalBlock implements Bonemealab } @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { - return direction == state.getValue(FACING) && !state.canSurvive(level, pos) + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { + return direction == blockState.getValue(FACING) && !blockState.canSurvive(levelReader, blockPos) ? Blocks.AIR.defaultBlockState() - : super.updateShape(state, direction, neighborState, level, pos, neighborPos); + : super.updateShape(blockState, levelReader, scheduledTickAccess, blockPos, direction, blockPos2, blockState2, randomSource); } @Override diff --git a/net/minecraft/world/level/block/CommandBlock.java b/net/minecraft/world/level/block/CommandBlock.java index e2025b0d..7879f554 100644 --- a/net/minecraft/world/level/block/CommandBlock.java +++ b/net/minecraft/world/level/block/CommandBlock.java @@ -25,8 +25,10 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.block.state.properties.BooleanProperty; -import net.minecraft.world.level.block.state.properties.DirectionProperty; +import net.minecraft.world.level.block.state.properties.EnumProperty; +import net.minecraft.world.level.redstone.Orientation; import net.minecraft.world.phys.BlockHitResult; +import org.jetbrains.annotations.Nullable; import org.slf4j.Logger; public class CommandBlock extends BaseEntityBlock implements GameMasterBlock { @@ -35,7 +37,7 @@ public class CommandBlock extends BaseEntityBlock implements GameMasterBlock { .apply(instance, CommandBlock::new) ); private static final Logger LOGGER = LogUtils.getLogger(); - public static final DirectionProperty FACING = DirectionalBlock.FACING; + public static final EnumProperty FACING = DirectionalBlock.FACING; public static final BooleanProperty CONDITIONAL = BlockStateProperties.CONDITIONAL; private final boolean automatic; @@ -58,18 +60,25 @@ public class CommandBlock extends BaseEntityBlock implements GameMasterBlock { } @Override - protected void neighborChanged(BlockState state, Level level, BlockPos pos, Block neighborBlock, BlockPos neighborPos, boolean movedByPiston) { + protected void neighborChanged(BlockState blockState, Level level, BlockPos blockPos, Block block, @Nullable Orientation orientation, boolean bl) { if (!level.isClientSide) { - if (level.getBlockEntity(pos) instanceof CommandBlockEntity commandBlockEntity) { - boolean bl = level.hasNeighborSignal(pos); - boolean bl2 = commandBlockEntity.isPowered(); - commandBlockEntity.setPowered(bl); - if (!bl2 && !commandBlockEntity.isAutomatic() && commandBlockEntity.getMode() != CommandBlockEntity.Mode.SEQUENCE) { - if (bl) { - commandBlockEntity.markConditionMet(); - level.scheduleTick(pos, this, 1); - } + if (level.getBlockEntity(blockPos) instanceof CommandBlockEntity commandBlockEntity) { + this.setPoweredAndUpdate(level, blockPos, commandBlockEntity, level.hasNeighborSignal(blockPos)); + } + } + } + + private void setPoweredAndUpdate(Level level, BlockPos blockPos, CommandBlockEntity commandBlockEntity, boolean bl) { + boolean bl2 = commandBlockEntity.isPowered(); + if (bl != bl2) { + commandBlockEntity.setPowered(bl); + if (bl) { + if (commandBlockEntity.isAutomatic() || commandBlockEntity.getMode() == CommandBlockEntity.Mode.SEQUENCE) { + return; } + + commandBlockEntity.markConditionMet(); + level.scheduleTick(blockPos, this, 1); } } } @@ -104,14 +113,14 @@ public class CommandBlock extends BaseEntityBlock implements GameMasterBlock { } } - private void execute(BlockState state, Level level, BlockPos pos, BaseCommandBlock logic, boolean canTrigger) { - if (canTrigger) { - logic.performCommand(level); + private void execute(BlockState blockState, ServerLevel serverLevel, BlockPos blockPos, BaseCommandBlock baseCommandBlock, boolean bl) { + if (bl) { + baseCommandBlock.performCommand(serverLevel); } else { - logic.setSuccessCount(0); + baseCommandBlock.setSuccessCount(0); } - executeChain(level, pos, state.getValue(FACING)); + executeChain(serverLevel, blockPos, blockState.getValue(FACING)); } @Override @@ -119,7 +128,7 @@ public class CommandBlock extends BaseEntityBlock implements GameMasterBlock { BlockEntity blockEntity = level.getBlockEntity(pos); if (blockEntity instanceof CommandBlockEntity && player.canUseGameMasterBlocks()) { player.openCommandBlock((CommandBlockEntity)blockEntity); - return InteractionResult.sidedSuccess(level.isClientSide); + return InteractionResult.SUCCESS; } else { return InteractionResult.PASS; } @@ -140,14 +149,14 @@ public class CommandBlock extends BaseEntityBlock implements GameMasterBlock { public void setPlacedBy(Level level, BlockPos pos, BlockState state, LivingEntity placer, ItemStack stack) { if (level.getBlockEntity(pos) instanceof CommandBlockEntity commandBlockEntity) { BaseCommandBlock baseCommandBlock = commandBlockEntity.getCommandBlock(); - if (!level.isClientSide) { + if (level instanceof ServerLevel serverLevel) { if (!stack.has(DataComponents.BLOCK_ENTITY_DATA)) { - baseCommandBlock.setTrackOutput(level.getGameRules().getBoolean(GameRules.RULE_SENDCOMMANDFEEDBACK)); + baseCommandBlock.setTrackOutput(serverLevel.getGameRules().getBoolean(GameRules.RULE_SENDCOMMANDFEEDBACK)); commandBlockEntity.setAutomatic(this.automatic); } boolean bl = level.hasNeighborSignal(pos); - commandBlockEntity.setPowered(bl); + this.setPoweredAndUpdate(level, pos, commandBlockEntity, bl); } } } @@ -177,17 +186,17 @@ public class CommandBlock extends BaseEntityBlock implements GameMasterBlock { return this.defaultBlockState().setValue(FACING, context.getNearestLookingDirection().getOpposite()); } - private static void executeChain(Level level, BlockPos pos, Direction direction) { - BlockPos.MutableBlockPos mutableBlockPos = pos.mutable(); - GameRules gameRules = level.getGameRules(); + private static void executeChain(ServerLevel serverLevel, BlockPos blockPos, Direction direction) { + BlockPos.MutableBlockPos mutableBlockPos = blockPos.mutable(); + GameRules gameRules = serverLevel.getGameRules(); int i = gameRules.getInt(GameRules.RULE_MAX_COMMAND_CHAIN_LENGTH); while (i-- > 0) { mutableBlockPos.move(direction); - BlockState blockState = level.getBlockState(mutableBlockPos); + BlockState blockState = serverLevel.getBlockState(mutableBlockPos); Block block = blockState.getBlock(); if (!blockState.is(Blocks.CHAIN_COMMAND_BLOCK) - || !(level.getBlockEntity(mutableBlockPos) instanceof CommandBlockEntity commandBlockEntity) + || !(serverLevel.getBlockEntity(mutableBlockPos) instanceof CommandBlockEntity commandBlockEntity) || commandBlockEntity.getMode() != CommandBlockEntity.Mode.SEQUENCE) { break; } @@ -195,11 +204,11 @@ public class CommandBlock extends BaseEntityBlock implements GameMasterBlock { if (commandBlockEntity.isPowered() || commandBlockEntity.isAutomatic()) { BaseCommandBlock baseCommandBlock = commandBlockEntity.getCommandBlock(); if (commandBlockEntity.markConditionMet()) { - if (!baseCommandBlock.performCommand(level)) { + if (!baseCommandBlock.performCommand(serverLevel)) { break; } - level.updateNeighbourForOutputSignal(mutableBlockPos, block); + serverLevel.updateNeighbourForOutputSignal(mutableBlockPos, block); } else if (commandBlockEntity.isConditional()) { baseCommandBlock.setSuccessCount(0); } diff --git a/net/minecraft/world/level/block/ComparatorBlock.java b/net/minecraft/world/level/block/ComparatorBlock.java index 3cf42d04..ff47aefb 100644 --- a/net/minecraft/world/level/block/ComparatorBlock.java +++ b/net/minecraft/world/level/block/ComparatorBlock.java @@ -13,7 +13,8 @@ import net.minecraft.world.entity.decoration.ItemFrame; import net.minecraft.world.entity.player.Player; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; -import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.ComparatorBlockEntity; import net.minecraft.world.level.block.state.BlockBehaviour; @@ -47,10 +48,19 @@ public class ComparatorBlock extends DiodeBlock implements EntityBlock { } @Override - public BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { - return direction == Direction.DOWN && !this.canSurviveOn(level, neighborPos, neighborState) + public BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { + return direction == Direction.DOWN && !this.canSurviveOn(levelReader, blockPos2, blockState2) ? Blocks.AIR.defaultBlockState() - : super.updateShape(state, direction, neighborState, level, pos, neighborPos); + : super.updateShape(blockState, levelReader, scheduledTickAccess, blockPos, direction, blockPos2, blockState2, randomSource); } @Override @@ -128,7 +138,7 @@ public class ComparatorBlock extends DiodeBlock implements EntityBlock { level.playSound(player, pos, SoundEvents.COMPARATOR_CLICK, SoundSource.BLOCKS, 0.3F, f); level.setBlock(pos, state, 2); this.refreshOutputState(level, pos, state); - return InteractionResult.sidedSuccess(level.isClientSide); + return InteractionResult.SUCCESS; } } diff --git a/net/minecraft/world/level/block/ComposterBlock.java b/net/minecraft/world/level/block/ComposterBlock.java index 7174d4ef..91084313 100644 --- a/net/minecraft/world/level/block/ComposterBlock.java +++ b/net/minecraft/world/level/block/ComposterBlock.java @@ -14,7 +14,6 @@ import net.minecraft.stats.Stats; import net.minecraft.util.RandomSource; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; -import net.minecraft.world.ItemInteractionResult; import net.minecraft.world.SimpleContainer; import net.minecraft.world.WorldlyContainer; import net.minecraft.world.WorldlyContainerHolder; @@ -33,6 +32,7 @@ import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.block.state.properties.IntegerProperty; import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.level.gameevent.GameEvent.Context; import net.minecraft.world.level.pathfinder.PathComputationType; import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.Vec3; @@ -75,6 +75,7 @@ public class ComposterBlock extends Block implements WorldlyContainerHolder { add(0.3F, Items.OAK_LEAVES); add(0.3F, Items.SPRUCE_LEAVES); add(0.3F, Items.DARK_OAK_LEAVES); + add(0.3F, Items.PALE_OAK_LEAVES); add(0.3F, Items.ACACIA_LEAVES); add(0.3F, Items.CHERRY_LEAVES); add(0.3F, Items.BIRCH_LEAVES); @@ -87,6 +88,7 @@ public class ComposterBlock extends Block implements WorldlyContainerHolder { add(0.3F, Items.ACACIA_SAPLING); add(0.3F, Items.CHERRY_SAPLING); add(0.3F, Items.DARK_OAK_SAPLING); + add(0.3F, Items.PALE_OAK_SAPLING); add(0.3F, Items.MANGROVE_PROPAGULE); add(0.3F, Items.BEETROOT_SEEDS); add(0.3F, Items.DRIED_KELP); @@ -99,6 +101,8 @@ public class ComposterBlock extends Block implements WorldlyContainerHolder { add(0.3F, Items.GLOW_BERRIES); add(0.3F, Items.WHEAT_SEEDS); add(0.3F, Items.MOSS_CARPET); + add(0.3F, Items.PALE_MOSS_CARPET); + add(0.3F, Items.PALE_HANGING_MOSS); add(0.3F, Items.PINK_PETALS); add(0.3F, Items.SMALL_DRIPLEAF); add(0.3F, Items.HANGING_ROOTS); @@ -158,6 +162,7 @@ public class ComposterBlock extends Block implements WorldlyContainerHolder { add(0.65F, Items.SPORE_BLOSSOM); add(0.65F, Items.AZALEA); add(0.65F, Items.MOSS_BLOCK); + add(0.65F, Items.PALE_MOSS_BLOCK); add(0.65F, Items.BIG_DRIPLEAF); add(0.85F, Items.HAY_BLOCK); add(0.85F, Items.BROWN_MUSHROOM_BLOCK); @@ -230,21 +235,21 @@ public class ComposterBlock extends Block implements WorldlyContainerHolder { } @Override - protected ItemInteractionResult useItemOn( - ItemStack stack, BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hitResult + protected InteractionResult useItemOn( + ItemStack itemStack, BlockState blockState, Level level, BlockPos blockPos, Player player, InteractionHand interactionHand, BlockHitResult blockHitResult ) { - int i = (Integer)state.getValue(LEVEL); - if (i < 8 && COMPOSTABLES.containsKey(stack.getItem())) { + int i = (Integer)blockState.getValue(LEVEL); + if (i < 8 && COMPOSTABLES.containsKey(itemStack.getItem())) { if (i < 7 && !level.isClientSide) { - BlockState blockState = addItem(player, state, level, pos, stack); - level.levelEvent(1500, pos, state != blockState ? 1 : 0); - player.awardStat(Stats.ITEM_USED.get(stack.getItem())); - stack.consume(1, player); + BlockState blockState2 = addItem(player, blockState, level, blockPos, itemStack); + level.levelEvent(1500, blockPos, blockState != blockState2 ? 1 : 0); + player.awardStat(Stats.ITEM_USED.get(itemStack.getItem())); + itemStack.consume(1, player); } - return ItemInteractionResult.sidedSuccess(level.isClientSide); + return InteractionResult.SUCCESS; } else { - return super.useItemOn(stack, state, level, pos, player, hand, hitResult); + return super.useItemOn(itemStack, blockState, level, blockPos, player, interactionHand, blockHitResult); } } @@ -253,7 +258,7 @@ public class ComposterBlock extends Block implements WorldlyContainerHolder { int i = (Integer)state.getValue(LEVEL); if (i == 8) { extractProduce(player, state, level, pos); - return InteractionResult.sidedSuccess(level.isClientSide); + return InteractionResult.SUCCESS; } else { return InteractionResult.PASS; } @@ -286,7 +291,7 @@ public class ComposterBlock extends Block implements WorldlyContainerHolder { static BlockState empty(@Nullable Entity entity, BlockState state, LevelAccessor level, BlockPos pos) { BlockState blockState = state.setValue(LEVEL, 0); level.setBlock(pos, blockState, 3); - level.gameEvent(GameEvent.BLOCK_CHANGE, pos, GameEvent.Context.of(entity, blockState)); + level.gameEvent(GameEvent.BLOCK_CHANGE, pos, Context.of(entity, blockState)); return blockState; } @@ -299,7 +304,7 @@ public class ComposterBlock extends Block implements WorldlyContainerHolder { int j = i + 1; BlockState blockState = state.setValue(LEVEL, j); level.setBlock(pos, blockState, 3); - level.gameEvent(GameEvent.BLOCK_CHANGE, pos, GameEvent.Context.of(entity, blockState)); + level.gameEvent(GameEvent.BLOCK_CHANGE, pos, Context.of(entity, blockState)); if (j == 7) { level.scheduleTick(pos, state.getBlock(), 20); } diff --git a/net/minecraft/world/level/block/ConcretePowderBlock.java b/net/minecraft/world/level/block/ConcretePowderBlock.java index f8fb7043..6812816a 100644 --- a/net/minecraft/world/level/block/ConcretePowderBlock.java +++ b/net/minecraft/world/level/block/ConcretePowderBlock.java @@ -6,11 +6,13 @@ import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.tags.FluidTags; +import net.minecraft.util.RandomSource; import net.minecraft.world.entity.item.FallingBlockEntity; import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; -import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; @@ -76,8 +78,19 @@ public class ConcretePowderBlock extends FallingBlock { } @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { - return touchesLiquid(level, pos) ? this.concrete.defaultBlockState() : super.updateShape(state, direction, neighborState, level, pos, neighborPos); + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { + return touchesLiquid(levelReader, blockPos) + ? this.concrete.defaultBlockState() + : super.updateShape(blockState, levelReader, scheduledTickAccess, blockPos, direction, blockPos2, blockState2, randomSource); } @Override diff --git a/net/minecraft/world/level/block/ConduitBlock.java b/net/minecraft/world/level/block/ConduitBlock.java index 99b855df..300d075e 100644 --- a/net/minecraft/world/level/block/ConduitBlock.java +++ b/net/minecraft/world/level/block/ConduitBlock.java @@ -4,10 +4,12 @@ import com.mojang.serialization.MapCodec; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.tags.FluidTags; +import net.minecraft.util.RandomSource; import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; -import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntityTicker; import net.minecraft.world.level.block.entity.BlockEntityType; @@ -67,12 +69,21 @@ public class ConduitBlock extends BaseEntityBlock implements SimpleWaterloggedBl } @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { - if ((Boolean)state.getValue(WATERLOGGED)) { - level.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(level)); + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { + if ((Boolean)blockState.getValue(WATERLOGGED)) { + scheduledTickAccess.scheduleTick(blockPos, Fluids.WATER, Fluids.WATER.getTickDelay(levelReader)); } - return super.updateShape(state, direction, neighborState, level, pos, neighborPos); + return super.updateShape(blockState, levelReader, scheduledTickAccess, blockPos, direction, blockPos2, blockState2, randomSource); } @Override diff --git a/net/minecraft/world/level/block/CopperBulbBlock.java b/net/minecraft/world/level/block/CopperBulbBlock.java index fc3b7349..d8319e2e 100644 --- a/net/minecraft/world/level/block/CopperBulbBlock.java +++ b/net/minecraft/world/level/block/CopperBulbBlock.java @@ -11,6 +11,8 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.block.state.properties.BooleanProperty; +import net.minecraft.world.level.redstone.Orientation; +import org.jetbrains.annotations.Nullable; public class CopperBulbBlock extends Block { public static final MapCodec CODEC = simpleCodec(CopperBulbBlock::new); @@ -35,9 +37,9 @@ public class CopperBulbBlock extends Block { } @Override - protected void neighborChanged(BlockState state, Level level, BlockPos pos, Block neighborBlock, BlockPos neighborPos, boolean movedByPiston) { + protected void neighborChanged(BlockState blockState, Level level, BlockPos blockPos, Block block, @Nullable Orientation orientation, boolean bl) { if (level instanceof ServerLevel serverLevel) { - this.checkAndFlip(state, serverLevel, pos); + this.checkAndFlip(blockState, serverLevel, blockPos); } } diff --git a/net/minecraft/world/level/block/CoralBlock.java b/net/minecraft/world/level/block/CoralBlock.java index 39250faf..40cee6d4 100644 --- a/net/minecraft/world/level/block/CoralBlock.java +++ b/net/minecraft/world/level/block/CoralBlock.java @@ -10,7 +10,8 @@ import net.minecraft.tags.FluidTags; import net.minecraft.util.RandomSource; import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.level.BlockGetter; -import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.material.FluidState; @@ -41,12 +42,21 @@ public class CoralBlock extends Block { } @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { - if (!this.scanForWater(level, pos)) { - level.scheduleTick(pos, this, 60 + level.getRandom().nextInt(40)); + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { + if (!this.scanForWater(levelReader, blockPos)) { + scheduledTickAccess.scheduleTick(blockPos, this, 60 + randomSource.nextInt(40)); } - return super.updateShape(state, direction, neighborState, level, pos, neighborPos); + return super.updateShape(blockState, levelReader, scheduledTickAccess, blockPos, direction, blockPos2, blockState2, randomSource); } protected boolean scanForWater(BlockGetter level, BlockPos pos) { diff --git a/net/minecraft/world/level/block/CoralFanBlock.java b/net/minecraft/world/level/block/CoralFanBlock.java index a2050a4c..0f77c973 100644 --- a/net/minecraft/world/level/block/CoralFanBlock.java +++ b/net/minecraft/world/level/block/CoralFanBlock.java @@ -7,7 +7,8 @@ import net.minecraft.core.Direction; import net.minecraft.server.level.ServerLevel; import net.minecraft.util.RandomSource; import net.minecraft.world.level.Level; -import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.material.Fluids; @@ -31,7 +32,7 @@ public class CoralFanBlock extends BaseCoralFanBlock { @Override protected void onPlace(BlockState state, Level level, BlockPos pos, BlockState oldState, boolean movedByPiston) { - this.tryScheduleDieTick(state, level, pos); + this.tryScheduleDieTick(state, level, level, level.random, pos); } @Override @@ -42,16 +43,25 @@ public class CoralFanBlock extends BaseCoralFanBlock { } @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { - if (direction == Direction.DOWN && !state.canSurvive(level, pos)) { + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { + if (direction == Direction.DOWN && !blockState.canSurvive(levelReader, blockPos)) { return Blocks.AIR.defaultBlockState(); } else { - this.tryScheduleDieTick(state, level, pos); - if ((Boolean)state.getValue(WATERLOGGED)) { - level.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(level)); + this.tryScheduleDieTick(blockState, levelReader, scheduledTickAccess, randomSource, blockPos); + if ((Boolean)blockState.getValue(WATERLOGGED)) { + scheduledTickAccess.scheduleTick(blockPos, Fluids.WATER, Fluids.WATER.getTickDelay(levelReader)); } - return super.updateShape(state, direction, neighborState, level, pos, neighborPos); + return super.updateShape(blockState, levelReader, scheduledTickAccess, blockPos, direction, blockPos2, blockState2, randomSource); } } } diff --git a/net/minecraft/world/level/block/CoralPlantBlock.java b/net/minecraft/world/level/block/CoralPlantBlock.java index 7a122f75..0f6d747b 100644 --- a/net/minecraft/world/level/block/CoralPlantBlock.java +++ b/net/minecraft/world/level/block/CoralPlantBlock.java @@ -8,7 +8,8 @@ import net.minecraft.server.level.ServerLevel; import net.minecraft.util.RandomSource; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; -import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.material.Fluids; @@ -36,7 +37,7 @@ public class CoralPlantBlock extends BaseCoralPlantTypeBlock { @Override protected void onPlace(BlockState state, Level level, BlockPos pos, BlockState oldState, boolean movedByPiston) { - this.tryScheduleDieTick(state, level, pos); + this.tryScheduleDieTick(state, level, level, level.random, pos); } @Override @@ -47,16 +48,25 @@ public class CoralPlantBlock extends BaseCoralPlantTypeBlock { } @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { - if (direction == Direction.DOWN && !state.canSurvive(level, pos)) { + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { + if (direction == Direction.DOWN && !blockState.canSurvive(levelReader, blockPos)) { return Blocks.AIR.defaultBlockState(); } else { - this.tryScheduleDieTick(state, level, pos); - if ((Boolean)state.getValue(WATERLOGGED)) { - level.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(level)); + this.tryScheduleDieTick(blockState, levelReader, scheduledTickAccess, randomSource, blockPos); + if ((Boolean)blockState.getValue(WATERLOGGED)) { + scheduledTickAccess.scheduleTick(blockPos, Fluids.WATER, Fluids.WATER.getTickDelay(levelReader)); } - return super.updateShape(state, direction, neighborState, level, pos, neighborPos); + return super.updateShape(blockState, levelReader, scheduledTickAccess, blockPos, direction, blockPos2, blockState2, randomSource); } } diff --git a/net/minecraft/world/level/block/CoralWallFanBlock.java b/net/minecraft/world/level/block/CoralWallFanBlock.java index 190281fe..8d03d490 100644 --- a/net/minecraft/world/level/block/CoralWallFanBlock.java +++ b/net/minecraft/world/level/block/CoralWallFanBlock.java @@ -7,7 +7,8 @@ import net.minecraft.core.Direction; import net.minecraft.server.level.ServerLevel; import net.minecraft.util.RandomSource; import net.minecraft.world.level.Level; -import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.material.Fluids; @@ -31,7 +32,7 @@ public class CoralWallFanBlock extends BaseCoralWallFanBlock { @Override protected void onPlace(BlockState state, Level level, BlockPos pos, BlockState oldState, boolean movedByPiston) { - this.tryScheduleDieTick(state, level, pos); + this.tryScheduleDieTick(state, level, level, level.random, pos); } @Override @@ -42,16 +43,25 @@ public class CoralWallFanBlock extends BaseCoralWallFanBlock { } @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { - if (direction.getOpposite() == state.getValue(FACING) && !state.canSurvive(level, pos)) { + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { + if (direction.getOpposite() == blockState.getValue(FACING) && !blockState.canSurvive(levelReader, blockPos)) { return Blocks.AIR.defaultBlockState(); } else { - if ((Boolean)state.getValue(WATERLOGGED)) { - level.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(level)); + if ((Boolean)blockState.getValue(WATERLOGGED)) { + scheduledTickAccess.scheduleTick(blockPos, Fluids.WATER, Fluids.WATER.getTickDelay(levelReader)); } - this.tryScheduleDieTick(state, level, pos); - return super.updateShape(state, direction, neighborState, level, pos, neighborPos); + this.tryScheduleDieTick(blockState, levelReader, scheduledTickAccess, randomSource, blockPos); + return super.updateShape(blockState, levelReader, scheduledTickAccess, blockPos, direction, blockPos2, blockState2, randomSource); } } } diff --git a/net/minecraft/world/level/block/CrafterBlock.java b/net/minecraft/world/level/block/CrafterBlock.java index b1c444ed..3094895f 100644 --- a/net/minecraft/world/level/block/CrafterBlock.java +++ b/net/minecraft/world/level/block/CrafterBlock.java @@ -33,6 +33,7 @@ import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.block.state.properties.BooleanProperty; import net.minecraft.world.level.block.state.properties.EnumProperty; +import net.minecraft.world.level.redstone.Orientation; import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.Vec3; @@ -69,16 +70,16 @@ public class CrafterBlock extends BaseEntityBlock { } @Override - protected void neighborChanged(BlockState state, Level level, BlockPos pos, Block neighborBlock, BlockPos neighborPos, boolean movedByPiston) { - boolean bl = level.hasNeighborSignal(pos); - boolean bl2 = (Boolean)state.getValue(TRIGGERED); - BlockEntity blockEntity = level.getBlockEntity(pos); - if (bl && !bl2) { - level.scheduleTick(pos, this, 4); - level.setBlock(pos, state.setValue(TRIGGERED, true), 2); + protected void neighborChanged(BlockState blockState, Level level, BlockPos blockPos, Block block, @Nullable Orientation orientation, boolean bl) { + boolean bl2 = level.hasNeighborSignal(blockPos); + boolean bl3 = (Boolean)blockState.getValue(TRIGGERED); + BlockEntity blockEntity = level.getBlockEntity(blockPos); + if (bl2 && !bl3) { + level.scheduleTick(blockPos, this, 4); + level.setBlock(blockPos, blockState.setValue(TRIGGERED, true), 2); this.setBlockEntityTriggered(blockEntity, true); - } else if (!bl && bl2) { - level.setBlock(pos, state.setValue(TRIGGERED, false).setValue(CRAFTING, false), 2); + } else if (!bl2 && bl3) { + level.setBlock(blockPos, blockState.setValue(TRIGGERED, false).setValue(CRAFTING, false), 2); this.setBlockEntityTriggered(blockEntity, false); } } @@ -136,16 +137,11 @@ public class CrafterBlock extends BaseEntityBlock { @Override protected InteractionResult useWithoutItem(BlockState state, Level level, BlockPos pos, Player player, BlockHitResult hitResult) { - if (level.isClientSide) { - return InteractionResult.SUCCESS; - } else { - BlockEntity blockEntity = level.getBlockEntity(pos); - if (blockEntity instanceof CrafterBlockEntity) { - player.openMenu((CrafterBlockEntity)blockEntity); - } - - return InteractionResult.CONSUME; + if (!level.isClientSide && level.getBlockEntity(pos) instanceof CrafterBlockEntity crafterBlockEntity) { + player.openMenu(crafterBlockEntity); } + + return InteractionResult.SUCCESS; } protected void dispenseFrom(BlockState state, ServerLevel level, BlockPos pos) { @@ -182,11 +178,11 @@ public class CrafterBlock extends BaseEntityBlock { } } - public static Optional> getPotentialResults(Level level, CraftingInput input) { - return RECIPE_CACHE.get(level, input); + public static Optional> getPotentialResults(ServerLevel serverLevel, CraftingInput craftingInput) { + return RECIPE_CACHE.get(serverLevel, craftingInput); } - private void dispenseItem(ServerLevel level, BlockPos pos, CrafterBlockEntity crafter, ItemStack stack, BlockState state, RecipeHolder recipe) { + private void dispenseItem(ServerLevel level, BlockPos pos, CrafterBlockEntity crafter, ItemStack stack, BlockState state, RecipeHolder recipe) { Direction direction = ((FrontAndTop)state.getValue(ORIENTATION)).front(); Container container = HopperBlockEntity.getContainerAt(level, pos.relative(direction)); ItemStack itemStack = stack.copy(); diff --git a/net/minecraft/world/level/block/CraftingTableBlock.java b/net/minecraft/world/level/block/CraftingTableBlock.java index 9ef42a32..7dcdae26 100644 --- a/net/minecraft/world/level/block/CraftingTableBlock.java +++ b/net/minecraft/world/level/block/CraftingTableBlock.java @@ -30,13 +30,12 @@ public class CraftingTableBlock extends Block { @Override protected InteractionResult useWithoutItem(BlockState state, Level level, BlockPos pos, Player player, BlockHitResult hitResult) { - if (level.isClientSide) { - return InteractionResult.SUCCESS; - } else { + if (!level.isClientSide) { player.openMenu(state.getMenuProvider(level, pos)); player.awardStat(Stats.INTERACT_WITH_CRAFTING_TABLE); - return InteractionResult.CONSUME; } + + return InteractionResult.SUCCESS; } @Override diff --git a/net/minecraft/world/level/block/CreakingHeartBlock.java b/net/minecraft/world/level/block/CreakingHeartBlock.java new file mode 100644 index 00000000..e19ace71 --- /dev/null +++ b/net/minecraft/world/level/block/CreakingHeartBlock.java @@ -0,0 +1,193 @@ +package net.minecraft.world.level.block; + +import com.mojang.serialization.MapCodec; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.sounds.SoundSource; +import net.minecraft.tags.BlockTags; +import net.minecraft.util.RandomSource; +import net.minecraft.util.StringRepresentable; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityTicker; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.block.entity.CreakingHeartBlockEntity; +import net.minecraft.world.level.block.state.BlockBehaviour; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.EnumProperty; +import net.minecraft.world.level.block.state.properties.Property; +import org.jetbrains.annotations.Nullable; + +public class CreakingHeartBlock extends BaseEntityBlock { + public static final MapCodec CODEC = simpleCodec(CreakingHeartBlock::new); + public static final EnumProperty AXIS = BlockStateProperties.AXIS; + public static final EnumProperty CREAKING = BlockStateProperties.CREAKING; + + @Override + public MapCodec codec() { + return CODEC; + } + + protected CreakingHeartBlock(BlockBehaviour.Properties properties) { + super(properties); + this.registerDefaultState(this.defaultBlockState().setValue(AXIS, Direction.Axis.Y).setValue(CREAKING, CreakingHeartBlock.CreakingHeartState.DISABLED)); + } + + @Override + public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { + return new CreakingHeartBlockEntity(pos, state); + } + + @Nullable + @Override + public BlockEntityTicker getTicker(Level level, BlockState state, BlockEntityType blockEntityType) { + if (level.isClientSide) { + return null; + } else { + return state.getValue((Property)CREAKING) != CreakingHeartBlock.CreakingHeartState.DISABLED + ? createTickerHelper(blockEntityType, BlockEntityType.CREAKING_HEART, CreakingHeartBlockEntity::serverTick) + : null; + } + } + + public static boolean canSummonCreaking(Level level) { + return level.dimensionType().natural() && level.isNight(); + } + + @Override + public void animateTick(BlockState state, Level level, BlockPos pos, RandomSource random) { + if (canSummonCreaking(level)) { + if (state.getValue(CREAKING) != CreakingHeartBlock.CreakingHeartState.DISABLED) { + if (random.nextInt(16) == 0 && isSurroundedByLogs(level, pos)) { + level.playLocalSound(pos.getX(), pos.getY(), pos.getZ(), SoundEvents.CREAKING_HEART_IDLE, SoundSource.BLOCKS, 1.0F, 1.0F, false); + } + } + } + } + + @Override + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { + BlockState blockState3 = super.updateShape(blockState, levelReader, scheduledTickAccess, blockPos, direction, blockPos2, blockState2, randomSource); + return updateState(blockState3, levelReader, blockPos); + } + + private static BlockState updateState(BlockState blockState, LevelReader levelReader, BlockPos blockPos) { + boolean bl = hasRequiredLogs(blockState, levelReader, blockPos); + CreakingHeartBlock.CreakingHeartState creakingHeartState = blockState.getValue(CREAKING); + return bl && creakingHeartState == CreakingHeartBlock.CreakingHeartState.DISABLED + ? blockState.setValue(CREAKING, CreakingHeartBlock.CreakingHeartState.DORMANT) + : blockState; + } + + public static boolean hasRequiredLogs(BlockState blockState, LevelReader levelReader, BlockPos blockPos) { + Direction.Axis axis = blockState.getValue(AXIS); + + for (Direction direction : axis.getDirections()) { + BlockState blockState2 = levelReader.getBlockState(blockPos.relative(direction)); + if (!blockState2.is(BlockTags.PALE_OAK_LOGS) || blockState2.getValue(AXIS) != axis) { + return false; + } + } + + return true; + } + + private static boolean isSurroundedByLogs(LevelAccessor levelAccessor, BlockPos blockPos) { + for (Direction direction : Direction.values()) { + BlockPos blockPos2 = blockPos.relative(direction); + BlockState blockState = levelAccessor.getBlockState(blockPos2); + if (!blockState.is(BlockTags.PALE_OAK_LOGS)) { + return false; + } + } + + return true; + } + + @Nullable + @Override + public BlockState getStateForPlacement(BlockPlaceContext context) { + return updateState(this.defaultBlockState().setValue(AXIS, context.getClickedFace().getAxis()), context.getLevel(), context.getClickedPos()); + } + + @Override + protected RenderShape getRenderShape(BlockState state) { + return RenderShape.MODEL; + } + + @Override + protected BlockState rotate(BlockState state, Rotation rotation) { + return RotatedPillarBlock.rotatePillar(state, rotation); + } + + @Override + protected void createBlockStateDefinition(StateDefinition.Builder builder) { + builder.add(AXIS, CREAKING); + } + + @Override + protected void onRemove(BlockState state, Level level, BlockPos pos, BlockState newState, boolean movedByPiston) { + if (level.getBlockEntity(pos) instanceof CreakingHeartBlockEntity creakingHeartBlockEntity) { + creakingHeartBlockEntity.removeProtector(null); + } + + super.onRemove(state, level, pos, newState, movedByPiston); + } + + @Override + public BlockState playerWillDestroy(Level level, BlockPos pos, BlockState state, Player player) { + if (level.getBlockEntity(pos) instanceof CreakingHeartBlockEntity creakingHeartBlockEntity) { + creakingHeartBlockEntity.removeProtector(player.damageSources().playerAttack(player)); + } + + return super.playerWillDestroy(level, pos, state, player); + } + + @Override + protected boolean hasAnalogOutputSignal(BlockState state) { + return true; + } + + @Override + protected int getAnalogOutputSignal(BlockState state, Level level, BlockPos pos) { + if (state.getValue(CREAKING) != CreakingHeartBlock.CreakingHeartState.ACTIVE) { + return 0; + } else { + return level.getBlockEntity(pos) instanceof CreakingHeartBlockEntity creakingHeartBlockEntity ? creakingHeartBlockEntity.getAnalogOutputSignal() : 0; + } + } + + public static enum CreakingHeartState implements StringRepresentable { + DISABLED("disabled"), + DORMANT("dormant"), + ACTIVE("active"); + + private final String name; + + private CreakingHeartState(final String string2) { + this.name = string2; + } + + @Override + public String getSerializedName() { + return this.name; + } + } +} diff --git a/net/minecraft/world/level/block/CropBlock.java b/net/minecraft/world/level/block/CropBlock.java index f328be23..3a6ccaa8 100644 --- a/net/minecraft/world/level/block/CropBlock.java +++ b/net/minecraft/world/level/block/CropBlock.java @@ -164,8 +164,8 @@ public class CropBlock extends BushBlock implements BonemealableBlock { @Override protected void entityInside(BlockState state, Level level, BlockPos pos, Entity entity) { - if (entity instanceof Ravager && level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { - level.destroyBlock(pos, true, entity); + if (level instanceof ServerLevel serverLevel && entity instanceof Ravager && serverLevel.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { + serverLevel.destroyBlock(pos, true, entity); } super.entityInside(state, level, pos, entity); diff --git a/net/minecraft/world/level/block/CrossCollisionBlock.java b/net/minecraft/world/level/block/CrossCollisionBlock.java index 410b1125..04801200 100644 --- a/net/minecraft/world/level/block/CrossCollisionBlock.java +++ b/net/minecraft/world/level/block/CrossCollisionBlock.java @@ -88,8 +88,8 @@ public abstract class CrossCollisionBlock extends Block implements SimpleWaterlo } @Override - protected boolean propagatesSkylightDown(BlockState state, BlockGetter level, BlockPos pos) { - return !(Boolean)state.getValue(WATERLOGGED); + protected boolean propagatesSkylightDown(BlockState blockState) { + return !(Boolean)blockState.getValue(WATERLOGGED); } @Override diff --git a/net/minecraft/world/level/block/DaylightDetectorBlock.java b/net/minecraft/world/level/block/DaylightDetectorBlock.java index 73e773df..c7f45d8e 100644 --- a/net/minecraft/world/level/block/DaylightDetectorBlock.java +++ b/net/minecraft/world/level/block/DaylightDetectorBlock.java @@ -20,6 +20,7 @@ import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.block.state.properties.BooleanProperty; import net.minecraft.world.level.block.state.properties.IntegerProperty; import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.level.gameevent.GameEvent.Context; import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.VoxelShape; @@ -76,18 +77,17 @@ public class DaylightDetectorBlock extends BaseEntityBlock { @Override protected InteractionResult useWithoutItem(BlockState state, Level level, BlockPos pos, Player player, BlockHitResult hitResult) { - if (player.mayBuild()) { - if (level.isClientSide) { - return InteractionResult.SUCCESS; - } else { + if (!player.mayBuild()) { + return super.useWithoutItem(state, level, pos, player, hitResult); + } else { + if (!level.isClientSide) { BlockState blockState = state.cycle(INVERTED); level.setBlock(pos, blockState, 2); - level.gameEvent(GameEvent.BLOCK_CHANGE, pos, GameEvent.Context.of(player, blockState)); + level.gameEvent(GameEvent.BLOCK_CHANGE, pos, Context.of(player, blockState)); updateSignalStrength(blockState, level, pos); - return InteractionResult.CONSUME; } - } else { - return super.useWithoutItem(state, level, pos, player, hitResult); + + return InteractionResult.SUCCESS; } } diff --git a/net/minecraft/world/level/block/DecoratedPotBlock.java b/net/minecraft/world/level/block/DecoratedPotBlock.java index 9dd2b1c7..3c10ea99 100644 --- a/net/minecraft/world/level/block/DecoratedPotBlock.java +++ b/net/minecraft/world/level/block/DecoratedPotBlock.java @@ -17,10 +17,10 @@ import net.minecraft.sounds.SoundSource; import net.minecraft.stats.Stats; import net.minecraft.tags.EnchantmentTags; import net.minecraft.tags.ItemTags; +import net.minecraft.util.RandomSource; import net.minecraft.world.Containers; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; -import net.minecraft.world.ItemInteractionResult; import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.projectile.Projectile; import net.minecraft.world.inventory.AbstractContainerMenu; @@ -33,8 +33,8 @@ import net.minecraft.world.item.enchantment.EnchantmentHelper; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.ItemLike; import net.minecraft.world.level.Level; -import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.DecoratedPotBlockEntity; import net.minecraft.world.level.block.entity.PotDecorations; @@ -43,7 +43,7 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.block.state.properties.BooleanProperty; -import net.minecraft.world.level.block.state.properties.DirectionProperty; +import net.minecraft.world.level.block.state.properties.EnumProperty; import net.minecraft.world.level.gameevent.GameEvent; import net.minecraft.world.level.material.FluidState; import net.minecraft.world.level.material.Fluids; @@ -59,7 +59,7 @@ public class DecoratedPotBlock extends BaseEntityBlock implements SimpleWaterlog public static final MapCodec CODEC = simpleCodec(DecoratedPotBlock::new); public static final ResourceLocation SHERDS_DYNAMIC_DROP_ID = ResourceLocation.withDefaultNamespace("sherds"); private static final VoxelShape BOUNDING_BOX = Block.box(1.0, 0.0, 1.0, 15.0, 16.0, 15.0); - private static final DirectionProperty HORIZONTAL_FACING = BlockStateProperties.HORIZONTAL_FACING; + private static final EnumProperty HORIZONTAL_FACING = BlockStateProperties.HORIZONTAL_FACING; public static final BooleanProperty CRACKED = BlockStateProperties.CRACKED; private static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED; @@ -74,12 +74,21 @@ public class DecoratedPotBlock extends BaseEntityBlock implements SimpleWaterlog } @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { - if ((Boolean)state.getValue(WATERLOGGED)) { - level.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(level)); + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { + if ((Boolean)blockState.getValue(WATERLOGGED)) { + scheduledTickAccess.scheduleTick(blockPos, Fluids.WATER, Fluids.WATER.getTickDelay(levelReader)); } - return super.updateShape(state, direction, neighborState, level, pos, neighborPos); + return super.updateShape(blockState, levelReader, scheduledTickAccess, blockPos, direction, blockPos2, blockState2, randomSource); } @Override @@ -92,43 +101,42 @@ public class DecoratedPotBlock extends BaseEntityBlock implements SimpleWaterlog } @Override - protected ItemInteractionResult useItemOn( - ItemStack stack, BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hitResult + protected InteractionResult useItemOn( + ItemStack itemStack, BlockState blockState, Level level, BlockPos blockPos, Player player, InteractionHand interactionHand, BlockHitResult blockHitResult ) { - if (level.getBlockEntity(pos) instanceof DecoratedPotBlockEntity decoratedPotBlockEntity) { + if (level.getBlockEntity(blockPos) instanceof DecoratedPotBlockEntity decoratedPotBlockEntity) { if (level.isClientSide) { - return ItemInteractionResult.CONSUME; + return InteractionResult.SUCCESS; } else { - ItemStack itemStack = decoratedPotBlockEntity.getTheItem(); - if (!stack.isEmpty() && (itemStack.isEmpty() || ItemStack.isSameItemSameComponents(itemStack, stack) && itemStack.getCount() < itemStack.getMaxStackSize()) - ) - { + ItemStack itemStack2 = decoratedPotBlockEntity.getTheItem(); + if (!itemStack.isEmpty() + && (itemStack2.isEmpty() || ItemStack.isSameItemSameComponents(itemStack2, itemStack) && itemStack2.getCount() < itemStack2.getMaxStackSize())) { decoratedPotBlockEntity.wobble(DecoratedPotBlockEntity.WobbleStyle.POSITIVE); - player.awardStat(Stats.ITEM_USED.get(stack.getItem())); - ItemStack itemStack2 = stack.consumeAndReturn(1, player); + player.awardStat(Stats.ITEM_USED.get(itemStack.getItem())); + ItemStack itemStack3 = itemStack.consumeAndReturn(1, player); float f; if (decoratedPotBlockEntity.isEmpty()) { - decoratedPotBlockEntity.setTheItem(itemStack2); - f = (float)itemStack2.getCount() / itemStack2.getMaxStackSize(); + decoratedPotBlockEntity.setTheItem(itemStack3); + f = (float)itemStack3.getCount() / itemStack3.getMaxStackSize(); } else { - itemStack.grow(1); - f = (float)itemStack.getCount() / itemStack.getMaxStackSize(); + itemStack2.grow(1); + f = (float)itemStack2.getCount() / itemStack2.getMaxStackSize(); } - level.playSound(null, pos, SoundEvents.DECORATED_POT_INSERT, SoundSource.BLOCKS, 1.0F, 0.7F + 0.5F * f); + level.playSound(null, blockPos, SoundEvents.DECORATED_POT_INSERT, SoundSource.BLOCKS, 1.0F, 0.7F + 0.5F * f); if (level instanceof ServerLevel serverLevel) { - serverLevel.sendParticles(ParticleTypes.DUST_PLUME, pos.getX() + 0.5, pos.getY() + 1.2, pos.getZ() + 0.5, 7, 0.0, 0.0, 0.0, 0.0); + serverLevel.sendParticles(ParticleTypes.DUST_PLUME, blockPos.getX() + 0.5, blockPos.getY() + 1.2, blockPos.getZ() + 0.5, 7, 0.0, 0.0, 0.0, 0.0); } decoratedPotBlockEntity.setChanged(); - level.gameEvent(player, GameEvent.BLOCK_CHANGE, pos); - return ItemInteractionResult.SUCCESS; + level.gameEvent(player, GameEvent.BLOCK_CHANGE, blockPos); + return InteractionResult.SUCCESS; } else { - return ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION; + return InteractionResult.TRY_WITH_EMPTY_HAND; } } } else { - return ItemInteractionResult.SKIP_DEFAULT_BLOCK_INTERACTION; + return InteractionResult.PASS; } } @@ -223,7 +231,7 @@ public class DecoratedPotBlock extends BaseEntityBlock implements SimpleWaterlog @Override protected void onProjectileHit(Level level, BlockState state, BlockHitResult hit, Projectile projectile) { BlockPos blockPos = hit.getBlockPos(); - if (!level.isClientSide && projectile.mayInteract(level, blockPos) && projectile.mayBreak(level)) { + if (level instanceof ServerLevel serverLevel && projectile.mayInteract(serverLevel, blockPos) && projectile.mayBreak(serverLevel)) { level.setBlock(blockPos, state.setValue(CRACKED, true), 4); level.destroyBlock(blockPos, true, projectile); } diff --git a/net/minecraft/world/level/block/DetectorRailBlock.java b/net/minecraft/world/level/block/DetectorRailBlock.java index b052faef..84133ad3 100644 --- a/net/minecraft/world/level/block/DetectorRailBlock.java +++ b/net/minecraft/world/level/block/DetectorRailBlock.java @@ -116,7 +116,7 @@ public class DetectorRailBlock extends BaseRailBlock { for (BlockPos blockPos : railState.getConnections()) { BlockState blockState = level.getBlockState(blockPos); - level.neighborChanged(blockState, blockPos, blockState.getBlock(), pos, false); + level.neighborChanged(blockState, blockPos, blockState.getBlock(), null, false); } } diff --git a/net/minecraft/world/level/block/DiodeBlock.java b/net/minecraft/world/level/block/DiodeBlock.java index ea822272..06c7a548 100644 --- a/net/minecraft/world/level/block/DiodeBlock.java +++ b/net/minecraft/world/level/block/DiodeBlock.java @@ -17,9 +17,12 @@ import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.block.state.properties.BooleanProperty; +import net.minecraft.world.level.redstone.ExperimentalRedstoneUtils; +import net.minecraft.world.level.redstone.Orientation; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.VoxelShape; import net.minecraft.world.ticks.TickPriority; +import org.jetbrains.annotations.Nullable; public abstract class DiodeBlock extends HorizontalDirectionalBlock { protected static final VoxelShape SHAPE = Block.box(0.0, 0.0, 0.0, 16.0, 2.0, 16.0); @@ -78,16 +81,16 @@ public abstract class DiodeBlock extends HorizontalDirectionalBlock { } @Override - protected void neighborChanged(BlockState state, Level level, BlockPos pos, Block neighborBlock, BlockPos neighborPos, boolean movedByPiston) { - if (state.canSurvive(level, pos)) { - this.checkTickOnNeighbor(level, pos, state); + protected void neighborChanged(BlockState blockState, Level level, BlockPos blockPos, Block block, @Nullable Orientation orientation, boolean bl) { + if (blockState.canSurvive(level, blockPos)) { + this.checkTickOnNeighbor(level, blockPos, blockState); } else { - BlockEntity blockEntity = state.hasBlockEntity() ? level.getBlockEntity(pos) : null; - dropResources(state, level, pos, blockEntity); - level.removeBlock(pos, false); + BlockEntity blockEntity = blockState.hasBlockEntity() ? level.getBlockEntity(blockPos) : null; + dropResources(blockState, level, blockPos, blockEntity); + level.removeBlock(blockPos, false); for (Direction direction : Direction.values()) { - level.updateNeighborsAt(pos.relative(direction), this); + level.updateNeighborsAt(blockPos.relative(direction), this); } } } @@ -176,8 +179,9 @@ public abstract class DiodeBlock extends HorizontalDirectionalBlock { protected void updateNeighborsInFront(Level level, BlockPos pos, BlockState state) { Direction direction = state.getValue(FACING); BlockPos blockPos = pos.relative(direction.getOpposite()); - level.neighborChanged(blockPos, this, pos); - level.updateNeighborsAtExceptFromFacing(blockPos, this, direction); + Orientation orientation = ExperimentalRedstoneUtils.initialOrientation(level, direction.getOpposite(), Direction.UP); + level.neighborChanged(blockPos, this, orientation); + level.updateNeighborsAtExceptFromFacing(blockPos, this, direction, orientation); } protected boolean sideInputDiodesOnly() { diff --git a/net/minecraft/world/level/block/DirectionalBlock.java b/net/minecraft/world/level/block/DirectionalBlock.java index f0d64b34..38f6c530 100644 --- a/net/minecraft/world/level/block/DirectionalBlock.java +++ b/net/minecraft/world/level/block/DirectionalBlock.java @@ -1,12 +1,13 @@ package net.minecraft.world.level.block; import com.mojang.serialization.MapCodec; +import net.minecraft.core.Direction; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.properties.BlockStateProperties; -import net.minecraft.world.level.block.state.properties.DirectionProperty; +import net.minecraft.world.level.block.state.properties.EnumProperty; public abstract class DirectionalBlock extends Block { - public static final DirectionProperty FACING = BlockStateProperties.FACING; + public static final EnumProperty FACING = BlockStateProperties.FACING; protected DirectionalBlock(BlockBehaviour.Properties properties) { super(properties); diff --git a/net/minecraft/world/level/block/DirtPathBlock.java b/net/minecraft/world/level/block/DirtPathBlock.java index 429637b0..35d37921 100644 --- a/net/minecraft/world/level/block/DirtPathBlock.java +++ b/net/minecraft/world/level/block/DirtPathBlock.java @@ -7,8 +7,8 @@ import net.minecraft.server.level.ServerLevel; import net.minecraft.util.RandomSource; import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.level.BlockGetter; -import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.pathfinder.PathComputationType; @@ -41,12 +41,21 @@ public class DirtPathBlock extends Block { } @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { - if (direction == Direction.UP && !state.canSurvive(level, pos)) { - level.scheduleTick(pos, this, 1); + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { + if (direction == Direction.UP && !blockState.canSurvive(levelReader, blockPos)) { + scheduledTickAccess.scheduleTick(blockPos, this, 1); } - return super.updateShape(state, direction, neighborState, level, pos, neighborPos); + return super.updateShape(blockState, levelReader, scheduledTickAccess, blockPos, direction, blockPos2, blockState2, randomSource); } @Override diff --git a/net/minecraft/world/level/block/DispenserBlock.java b/net/minecraft/world/level/block/DispenserBlock.java index a58a067b..8eff399d 100644 --- a/net/minecraft/world/level/block/DispenserBlock.java +++ b/net/minecraft/world/level/block/DispenserBlock.java @@ -2,15 +2,16 @@ package net.minecraft.world.level.block; import com.mojang.logging.LogUtils; import com.mojang.serialization.MapCodec; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; +import java.util.IdentityHashMap; import java.util.Map; -import net.minecraft.Util; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.Position; +import net.minecraft.core.component.DataComponents; import net.minecraft.core.dispenser.BlockSource; import net.minecraft.core.dispenser.DefaultDispenseItemBehavior; import net.minecraft.core.dispenser.DispenseItemBehavior; +import net.minecraft.core.dispenser.EquipmentDispenseItemBehavior; import net.minecraft.core.dispenser.ProjectileDispenseBehavior; import net.minecraft.server.level.ServerLevel; import net.minecraft.stats.Stats; @@ -33,24 +34,25 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.block.state.properties.BooleanProperty; -import net.minecraft.world.level.block.state.properties.DirectionProperty; +import net.minecraft.world.level.block.state.properties.EnumProperty; import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.level.gameevent.GameEvent.Context; +import net.minecraft.world.level.redstone.Orientation; import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.Vec3; +import org.jetbrains.annotations.Nullable; import org.slf4j.Logger; public class DispenserBlock extends BaseEntityBlock { private static final Logger LOGGER = LogUtils.getLogger(); public static final MapCodec CODEC = simpleCodec(DispenserBlock::new); - public static final DirectionProperty FACING = DirectionalBlock.FACING; + public static final EnumProperty FACING = DirectionalBlock.FACING; public static final BooleanProperty TRIGGERED = BlockStateProperties.TRIGGERED; private static final DefaultDispenseItemBehavior DEFAULT_BEHAVIOR = new DefaultDispenseItemBehavior(); /** * Registry for all dispense behaviors. */ - public static final Map DISPENSER_REGISTRY = Util.make( - new Object2ObjectOpenHashMap<>(), object2ObjectOpenHashMap -> object2ObjectOpenHashMap.defaultReturnValue(DEFAULT_BEHAVIOR) - ); + public static final Map DISPENSER_REGISTRY = new IdentityHashMap(); private static final int TRIGGER_DURATION = 4; @Override @@ -73,21 +75,12 @@ public class DispenserBlock extends BaseEntityBlock { @Override protected InteractionResult useWithoutItem(BlockState state, Level level, BlockPos pos, Player player, BlockHitResult hitResult) { - if (level.isClientSide) { - return InteractionResult.SUCCESS; - } else { - BlockEntity blockEntity = level.getBlockEntity(pos); - if (blockEntity instanceof DispenserBlockEntity) { - player.openMenu((DispenserBlockEntity)blockEntity); - if (blockEntity instanceof DropperBlockEntity) { - player.awardStat(Stats.INSPECT_DROPPER); - } else { - player.awardStat(Stats.INSPECT_DISPENSER); - } - } - - return InteractionResult.CONSUME; + if (!level.isClientSide && level.getBlockEntity(pos) instanceof DispenserBlockEntity dispenserBlockEntity) { + player.openMenu(dispenserBlockEntity); + player.awardStat(dispenserBlockEntity instanceof DropperBlockEntity ? Stats.INSPECT_DROPPER : Stats.INSPECT_DISPENSER); } + + return InteractionResult.SUCCESS; } protected void dispenseFrom(ServerLevel level, BlockState state, BlockPos pos) { @@ -99,7 +92,7 @@ public class DispenserBlock extends BaseEntityBlock { int i = dispenserBlockEntity.getRandomSlot(level.random); if (i < 0) { level.levelEvent(1001, pos, 0); - level.gameEvent(GameEvent.BLOCK_ACTIVATE, pos, GameEvent.Context.of(dispenserBlockEntity.getBlockState())); + level.gameEvent(GameEvent.BLOCK_ACTIVATE, pos, Context.of(dispenserBlockEntity.getBlockState())); } else { ItemStack itemStack = dispenserBlockEntity.getItem(i); DispenseItemBehavior dispenseItemBehavior = this.getDispenseMethod(level, itemStack); @@ -111,18 +104,27 @@ public class DispenserBlock extends BaseEntityBlock { } protected DispenseItemBehavior getDispenseMethod(Level level, ItemStack item) { - return (DispenseItemBehavior)(!item.isItemEnabled(level.enabledFeatures()) ? DEFAULT_BEHAVIOR : (DispenseItemBehavior)DISPENSER_REGISTRY.get(item.getItem())); + if (!item.isItemEnabled(level.enabledFeatures())) { + return DEFAULT_BEHAVIOR; + } else { + DispenseItemBehavior dispenseItemBehavior = (DispenseItemBehavior)DISPENSER_REGISTRY.get(item.getItem()); + return dispenseItemBehavior != null ? dispenseItemBehavior : getDefaultDispenseMethod(item); + } + } + + private static DispenseItemBehavior getDefaultDispenseMethod(ItemStack itemStack) { + return (DispenseItemBehavior)(itemStack.has(DataComponents.EQUIPPABLE) ? EquipmentDispenseItemBehavior.INSTANCE : DEFAULT_BEHAVIOR); } @Override - protected void neighborChanged(BlockState state, Level level, BlockPos pos, Block neighborBlock, BlockPos neighborPos, boolean movedByPiston) { - boolean bl = level.hasNeighborSignal(pos) || level.hasNeighborSignal(pos.above()); - boolean bl2 = (Boolean)state.getValue(TRIGGERED); - if (bl && !bl2) { - level.scheduleTick(pos, this, 4); - level.setBlock(pos, state.setValue(TRIGGERED, true), 2); - } else if (!bl && bl2) { - level.setBlock(pos, state.setValue(TRIGGERED, false), 2); + protected void neighborChanged(BlockState blockState, Level level, BlockPos blockPos, Block block, @Nullable Orientation orientation, boolean bl) { + boolean bl2 = level.hasNeighborSignal(blockPos) || level.hasNeighborSignal(blockPos.above()); + boolean bl3 = (Boolean)blockState.getValue(TRIGGERED); + if (bl2 && !bl3) { + level.scheduleTick(blockPos, this, 4); + level.setBlock(blockPos, blockState.setValue(TRIGGERED, true), 2); + } else if (!bl2 && bl3) { + level.setBlock(blockPos, blockState.setValue(TRIGGERED, false), 2); } } diff --git a/net/minecraft/world/level/block/DoorBlock.java b/net/minecraft/world/level/block/DoorBlock.java index 8c8bec99..a516757c 100644 --- a/net/minecraft/world/level/block/DoorBlock.java +++ b/net/minecraft/world/level/block/DoorBlock.java @@ -5,8 +5,10 @@ import com.mojang.serialization.codecs.RecordCodecBuilder; import java.util.function.BiConsumer; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; +import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundSource; import net.minecraft.util.Mth; +import net.minecraft.util.RandomSource; import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.LivingEntity; @@ -16,20 +18,20 @@ import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Explosion; import net.minecraft.world.level.Level; -import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.block.state.properties.BlockSetType; import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.block.state.properties.BooleanProperty; -import net.minecraft.world.level.block.state.properties.DirectionProperty; import net.minecraft.world.level.block.state.properties.DoorHingeSide; import net.minecraft.world.level.block.state.properties.DoubleBlockHalf; import net.minecraft.world.level.block.state.properties.EnumProperty; import net.minecraft.world.level.gameevent.GameEvent; import net.minecraft.world.level.pathfinder.PathComputationType; +import net.minecraft.world.level.redstone.Orientation; import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.shapes.CollisionContext; @@ -40,7 +42,7 @@ public class DoorBlock extends Block { public static final MapCodec CODEC = RecordCodecBuilder.mapCodec( instance -> instance.group(BlockSetType.CODEC.fieldOf("block_set_type").forGetter(DoorBlock::type), propertiesCodec()).apply(instance, DoorBlock::new) ); - public static final DirectionProperty FACING = HorizontalDirectionalBlock.FACING; + public static final EnumProperty FACING = HorizontalDirectionalBlock.FACING; public static final BooleanProperty OPEN = BlockStateProperties.OPEN; public static final EnumProperty HINGE = BlockStateProperties.DOOR_HINGE; public static final BooleanProperty POWERED = BlockStateProperties.POWERED; @@ -90,26 +92,40 @@ public class DoorBlock extends Block { } @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { - DoubleBlockHalf doubleBlockHalf = state.getValue(HALF); + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { + DoubleBlockHalf doubleBlockHalf = blockState.getValue(HALF); if (direction.getAxis() != Direction.Axis.Y || doubleBlockHalf == DoubleBlockHalf.LOWER != (direction == Direction.UP)) { - return doubleBlockHalf == DoubleBlockHalf.LOWER && direction == Direction.DOWN && !state.canSurvive(level, pos) + return doubleBlockHalf == DoubleBlockHalf.LOWER && direction == Direction.DOWN && !blockState.canSurvive(levelReader, blockPos) ? Blocks.AIR.defaultBlockState() - : super.updateShape(state, direction, neighborState, level, pos, neighborPos); + : super.updateShape(blockState, levelReader, scheduledTickAccess, blockPos, direction, blockPos2, blockState2, randomSource); } else { - return neighborState.getBlock() instanceof DoorBlock && neighborState.getValue(HALF) != doubleBlockHalf - ? neighborState.setValue(HALF, doubleBlockHalf) + return blockState2.getBlock() instanceof DoorBlock && blockState2.getValue(HALF) != doubleBlockHalf + ? blockState2.setValue(HALF, doubleBlockHalf) : Blocks.AIR.defaultBlockState(); } } @Override - protected void onExplosionHit(BlockState state, Level level, BlockPos pos, Explosion explosion, BiConsumer dropConsumer) { - if (explosion.canTriggerBlocks() && state.getValue(HALF) == DoubleBlockHalf.LOWER && this.type.canOpenByWindCharge() && !(Boolean)state.getValue(POWERED)) { - this.setOpen(null, level, state, pos, !this.isOpen(state)); + protected void onExplosionHit( + BlockState blockState, ServerLevel serverLevel, BlockPos blockPos, Explosion explosion, BiConsumer biConsumer + ) { + if (explosion.canTriggerBlocks() + && blockState.getValue(HALF) == DoubleBlockHalf.LOWER + && this.type.canOpenByWindCharge() + && !(Boolean)blockState.getValue(POWERED)) { + this.setOpen(null, serverLevel, blockState, blockPos, !this.isOpen(blockState)); } - super.onExplosionHit(state, level, pos, explosion, dropConsumer); + super.onExplosionHit(blockState, serverLevel, blockPos, explosion, biConsumer); } @Override @@ -134,7 +150,7 @@ public class DoorBlock extends Block { public BlockState getStateForPlacement(BlockPlaceContext context) { BlockPos blockPos = context.getClickedPos(); Level level = context.getLevel(); - if (blockPos.getY() < level.getMaxBuildHeight() - 1 && level.getBlockState(blockPos.above()).canBeReplaced(context)) { + if (blockPos.getY() < level.getMaxY() && level.getBlockState(blockPos.above()).canBeReplaced(context)) { boolean bl = level.hasNeighborSignal(blockPos) || level.hasNeighborSignal(blockPos.above()); return this.defaultBlockState() .setValue(FACING, context.getHorizontalDirection()) @@ -198,7 +214,7 @@ public class DoorBlock extends Block { level.setBlock(pos, state, 10); this.playSound(player, level, pos, (Boolean)state.getValue(OPEN)); level.gameEvent(player, this.isOpen(state) ? GameEvent.BLOCK_OPEN : GameEvent.BLOCK_CLOSE, pos); - return InteractionResult.sidedSuccess(level.isClientSide); + return InteractionResult.SUCCESS; } } @@ -215,16 +231,16 @@ public class DoorBlock extends Block { } @Override - protected void neighborChanged(BlockState state, Level level, BlockPos pos, Block neighborBlock, BlockPos neighborPos, boolean movedByPiston) { - boolean bl = level.hasNeighborSignal(pos) - || level.hasNeighborSignal(pos.relative(state.getValue(HALF) == DoubleBlockHalf.LOWER ? Direction.UP : Direction.DOWN)); - if (!this.defaultBlockState().is(neighborBlock) && bl != (Boolean)state.getValue(POWERED)) { - if (bl != (Boolean)state.getValue(OPEN)) { - this.playSound(null, level, pos, bl); - level.gameEvent(null, bl ? GameEvent.BLOCK_OPEN : GameEvent.BLOCK_CLOSE, pos); + protected void neighborChanged(BlockState blockState, Level level, BlockPos blockPos, Block block, @Nullable Orientation orientation, boolean bl) { + boolean bl2 = level.hasNeighborSignal(blockPos) + || level.hasNeighborSignal(blockPos.relative(blockState.getValue(HALF) == DoubleBlockHalf.LOWER ? Direction.UP : Direction.DOWN)); + if (!this.defaultBlockState().is(block) && bl2 != (Boolean)blockState.getValue(POWERED)) { + if (bl2 != (Boolean)blockState.getValue(OPEN)) { + this.playSound(null, level, blockPos, bl2); + level.gameEvent(null, bl2 ? GameEvent.BLOCK_OPEN : GameEvent.BLOCK_CLOSE, blockPos); } - level.setBlock(pos, state.setValue(POWERED, bl).setValue(OPEN, bl), 2); + level.setBlock(blockPos, blockState.setValue(POWERED, bl2).setValue(OPEN, bl2), 2); } } diff --git a/net/minecraft/world/level/block/DoubleBlockCombiner.java b/net/minecraft/world/level/block/DoubleBlockCombiner.java index f629540a..6a695567 100644 --- a/net/minecraft/world/level/block/DoubleBlockCombiner.java +++ b/net/minecraft/world/level/block/DoubleBlockCombiner.java @@ -5,55 +5,55 @@ import java.util.function.Function; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.block.DoubleBlockCombiner.NeighborCombineResult.Double; +import net.minecraft.world.level.block.DoubleBlockCombiner.NeighborCombineResult.Single; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.world.level.block.state.properties.DirectionProperty; +import net.minecraft.world.level.block.state.properties.Property; public class DoubleBlockCombiner { public static DoubleBlockCombiner.NeighborCombineResult combineWithNeigbour( BlockEntityType blockEntityType, - Function doubleBlockTypeGetter, - Function directionGetter, - DirectionProperty directionProperty, - BlockState state, - LevelAccessor level, - BlockPos pos, - BiPredicate blockedChestTest + Function function, + Function function2, + Property property, + BlockState blockState, + LevelAccessor levelAccessor, + BlockPos blockPos, + BiPredicate biPredicate ) { - S blockEntity = blockEntityType.getBlockEntity(level, pos); + S blockEntity = blockEntityType.getBlockEntity(levelAccessor, blockPos); if (blockEntity == null) { return DoubleBlockCombiner.Combiner::acceptNone; - } else if (blockedChestTest.test(level, pos)) { + } else if (biPredicate.test(levelAccessor, blockPos)) { return DoubleBlockCombiner.Combiner::acceptNone; } else { - DoubleBlockCombiner.BlockType blockType = (DoubleBlockCombiner.BlockType)doubleBlockTypeGetter.apply(state); + DoubleBlockCombiner.BlockType blockType = (DoubleBlockCombiner.BlockType)function.apply(blockState); boolean bl = blockType == DoubleBlockCombiner.BlockType.SINGLE; boolean bl2 = blockType == DoubleBlockCombiner.BlockType.FIRST; if (bl) { - return new DoubleBlockCombiner.NeighborCombineResult.Single<>(blockEntity); + return new Single(blockEntity); } else { - BlockPos blockPos = pos.relative((Direction)directionGetter.apply(state)); - BlockState blockState = level.getBlockState(blockPos); - if (blockState.is(state.getBlock())) { - DoubleBlockCombiner.BlockType blockType2 = (DoubleBlockCombiner.BlockType)doubleBlockTypeGetter.apply(blockState); - if (blockType2 != DoubleBlockCombiner.BlockType.SINGLE - && blockType != blockType2 - && blockState.getValue(directionProperty) == state.getValue(directionProperty)) { - if (blockedChestTest.test(level, blockPos)) { + BlockPos blockPos2 = blockPos.relative((Direction)function2.apply(blockState)); + BlockState blockState2 = levelAccessor.getBlockState(blockPos2); + if (blockState2.is(blockState.getBlock())) { + DoubleBlockCombiner.BlockType blockType2 = (DoubleBlockCombiner.BlockType)function.apply(blockState2); + if (blockType2 != DoubleBlockCombiner.BlockType.SINGLE && blockType != blockType2 && blockState2.getValue(property) == blockState.getValue(property)) { + if (biPredicate.test(levelAccessor, blockPos2)) { return DoubleBlockCombiner.Combiner::acceptNone; } - S blockEntity2 = blockEntityType.getBlockEntity(level, blockPos); + S blockEntity2 = blockEntityType.getBlockEntity(levelAccessor, blockPos2); if (blockEntity2 != null) { S blockEntity3 = bl2 ? blockEntity : blockEntity2; S blockEntity4 = bl2 ? blockEntity2 : blockEntity; - return new DoubleBlockCombiner.NeighborCombineResult.Double<>(blockEntity3, blockEntity4); + return new Double(blockEntity3, blockEntity4); } } } - return new DoubleBlockCombiner.NeighborCombineResult.Single<>(blockEntity); + return new Single(blockEntity); } } } @@ -74,33 +74,5 @@ public class DoubleBlockCombiner { public interface NeighborCombineResult { T apply(DoubleBlockCombiner.Combiner combiner); - - public static final class Double implements DoubleBlockCombiner.NeighborCombineResult { - private final S first; - private final S second; - - public Double(S first, S second) { - this.first = first; - this.second = second; - } - - @Override - public T apply(DoubleBlockCombiner.Combiner combiner) { - return combiner.acceptDouble(this.first, this.second); - } - } - - public static final class Single implements DoubleBlockCombiner.NeighborCombineResult { - private final S single; - - public Single(S single) { - this.single = single; - } - - @Override - public T apply(DoubleBlockCombiner.Combiner combiner) { - return combiner.acceptSingle(this.single); - } - } } } diff --git a/net/minecraft/world/level/block/DoublePlantBlock.java b/net/minecraft/world/level/block/DoublePlantBlock.java index ba50ba8e..0ac685d0 100644 --- a/net/minecraft/world/level/block/DoublePlantBlock.java +++ b/net/minecraft/world/level/block/DoublePlantBlock.java @@ -4,6 +4,7 @@ import com.mojang.serialization.MapCodec; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.util.Mth; +import net.minecraft.util.RandomSource; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; @@ -11,6 +12,7 @@ import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; @@ -36,14 +38,23 @@ public class DoublePlantBlock extends BushBlock { } @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { - DoubleBlockHalf doubleBlockHalf = state.getValue(HALF); + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { + DoubleBlockHalf doubleBlockHalf = blockState.getValue(HALF); if (direction.getAxis() != Direction.Axis.Y || doubleBlockHalf == DoubleBlockHalf.LOWER != (direction == Direction.UP) - || neighborState.is(this) && neighborState.getValue(HALF) != doubleBlockHalf) { - return doubleBlockHalf == DoubleBlockHalf.LOWER && direction == Direction.DOWN && !state.canSurvive(level, pos) + || blockState2.is(this) && blockState2.getValue(HALF) != doubleBlockHalf) { + return doubleBlockHalf == DoubleBlockHalf.LOWER && direction == Direction.DOWN && !blockState.canSurvive(levelReader, blockPos) ? Blocks.AIR.defaultBlockState() - : super.updateShape(state, direction, neighborState, level, pos, neighborPos); + : super.updateShape(blockState, levelReader, scheduledTickAccess, blockPos, direction, blockPos2, blockState2, randomSource); } else { return Blocks.AIR.defaultBlockState(); } @@ -54,9 +65,7 @@ public class DoublePlantBlock extends BushBlock { public BlockState getStateForPlacement(BlockPlaceContext context) { BlockPos blockPos = context.getClickedPos(); Level level = context.getLevel(); - return blockPos.getY() < level.getMaxBuildHeight() - 1 && level.getBlockState(blockPos.above()).canBeReplaced(context) - ? super.getStateForPlacement(context) - : null; + return blockPos.getY() < level.getMaxY() && level.getBlockState(blockPos.above()).canBeReplaced(context) ? super.getStateForPlacement(context) : null; } @Override diff --git a/net/minecraft/world/level/block/DragonEggBlock.java b/net/minecraft/world/level/block/DragonEggBlock.java index f1add508..fd90f153 100644 --- a/net/minecraft/world/level/block/DragonEggBlock.java +++ b/net/minecraft/world/level/block/DragonEggBlock.java @@ -37,7 +37,7 @@ public class DragonEggBlock extends FallingBlock { @Override protected InteractionResult useWithoutItem(BlockState state, Level level, BlockPos pos, Player player, BlockHitResult hitResult) { this.teleport(state, level, pos); - return InteractionResult.sidedSuccess(level.isClientSide); + return InteractionResult.SUCCESS; } @Override diff --git a/net/minecraft/world/level/block/EnchantingTableBlock.java b/net/minecraft/world/level/block/EnchantingTableBlock.java index de010cfe..eac47250 100644 --- a/net/minecraft/world/level/block/EnchantingTableBlock.java +++ b/net/minecraft/world/level/block/EnchantingTableBlock.java @@ -98,12 +98,11 @@ public class EnchantingTableBlock extends BaseEntityBlock { @Override protected InteractionResult useWithoutItem(BlockState state, Level level, BlockPos pos, Player player, BlockHitResult hitResult) { - if (level.isClientSide) { - return InteractionResult.SUCCESS; - } else { + if (!level.isClientSide) { player.openMenu(state.getMenuProvider(level, pos)); - return InteractionResult.CONSUME; } + + return InteractionResult.SUCCESS; } @Nullable diff --git a/net/minecraft/world/level/block/EndGatewayBlock.java b/net/minecraft/world/level/block/EndGatewayBlock.java index 22fffefe..98340a32 100644 --- a/net/minecraft/world/level/block/EndGatewayBlock.java +++ b/net/minecraft/world/level/block/EndGatewayBlock.java @@ -1,11 +1,13 @@ package net.minecraft.world.level.block; import com.mojang.serialization.MapCodec; +import java.util.Set; import net.minecraft.core.BlockPos; import net.minecraft.core.particles.ParticleTypes; import net.minecraft.server.level.ServerLevel; import net.minecraft.util.RandomSource; import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.Relative; import net.minecraft.world.entity.projectile.ThrownEnderpearl; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; @@ -17,7 +19,7 @@ import net.minecraft.world.level.block.entity.TheEndGatewayBlockEntity; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.material.Fluid; -import net.minecraft.world.level.portal.DimensionTransition; +import net.minecraft.world.level.portal.TeleportTransition; import net.minecraft.world.phys.Vec3; import org.jetbrains.annotations.Nullable; @@ -96,18 +98,20 @@ public class EndGatewayBlock extends BaseEntityBlock implements Portal { @Nullable @Override - public DimensionTransition getPortalDestination(ServerLevel level, Entity entity, BlockPos pos) { - if (level.getBlockEntity(pos) instanceof TheEndGatewayBlockEntity theEndGatewayBlockEntity) { - Vec3 vec3 = theEndGatewayBlockEntity.getPortalPosition(level, pos); - return vec3 != null - ? new DimensionTransition(level, vec3, calculateExitMovement(entity), entity.getYRot(), entity.getXRot(), DimensionTransition.PLACE_PORTAL_TICKET) - : null; + public TeleportTransition getPortalDestination(ServerLevel serverLevel, Entity entity, BlockPos blockPos) { + if (serverLevel.getBlockEntity(blockPos) instanceof TheEndGatewayBlockEntity theEndGatewayBlockEntity) { + Vec3 vec3 = theEndGatewayBlockEntity.getPortalPosition(serverLevel, blockPos); + if (vec3 == null) { + return null; + } else { + return entity instanceof ThrownEnderpearl + ? new TeleportTransition(serverLevel, vec3, Vec3.ZERO, 0.0F, 0.0F, Set.of(), TeleportTransition.PLACE_PORTAL_TICKET) + : new TeleportTransition( + serverLevel, vec3, Vec3.ZERO, 0.0F, 0.0F, Relative.union(Relative.DELTA, Relative.ROTATION), TeleportTransition.PLACE_PORTAL_TICKET + ); + } } else { return null; } } - - private static Vec3 calculateExitMovement(Entity entity) { - return entity instanceof ThrownEnderpearl ? new Vec3(0.0, -1.0, 0.0) : entity.getDeltaMovement(); - } } diff --git a/net/minecraft/world/level/block/EndPortalBlock.java b/net/minecraft/world/level/block/EndPortalBlock.java index b5d2185a..1b8796ed 100644 --- a/net/minecraft/world/level/block/EndPortalBlock.java +++ b/net/minecraft/world/level/block/EndPortalBlock.java @@ -1,6 +1,7 @@ package net.minecraft.world.level.block; import com.mojang.serialization.MapCodec; +import java.util.Set; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.particles.ParticleTypes; @@ -9,6 +10,7 @@ import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.util.RandomSource; import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.Relative; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; @@ -19,11 +21,9 @@ import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.levelgen.feature.EndPlatformFeature; import net.minecraft.world.level.material.Fluid; -import net.minecraft.world.level.portal.DimensionTransition; +import net.minecraft.world.level.portal.TeleportTransition; import net.minecraft.world.phys.Vec3; -import net.minecraft.world.phys.shapes.BooleanOp; import net.minecraft.world.phys.shapes.CollisionContext; -import net.minecraft.world.phys.shapes.Shapes; import net.minecraft.world.phys.shapes.VoxelShape; public class EndPortalBlock extends BaseEntityBlock implements Portal { @@ -49,10 +49,14 @@ public class EndPortalBlock extends BaseEntityBlock implements Portal { return SHAPE; } + @Override + protected VoxelShape getEntityInsideCollisionShape(BlockState blockState, Level level, BlockPos blockPos) { + return blockState.getShape(level, blockPos); + } + @Override protected void entityInside(BlockState state, Level level, BlockPos pos, Entity entity) { - if (entity.canUsePortal(false) - && Shapes.joinIsNotEmpty(Shapes.create(entity.getBoundingBox().move(-pos.getX(), -pos.getY(), -pos.getZ())), state.getShape(level, pos), BooleanOp.AND)) { + if (entity.canUsePortal(false)) { if (!level.isClientSide && level.dimension() == Level.END && entity instanceof ServerPlayer serverPlayer && !serverPlayer.seenCredits) { serverPlayer.showEndCredits(); } else { @@ -62,33 +66,35 @@ public class EndPortalBlock extends BaseEntityBlock implements Portal { } @Override - public DimensionTransition getPortalDestination(ServerLevel level, Entity entity, BlockPos pos) { - ResourceKey resourceKey = level.dimension() == Level.END ? Level.OVERWORLD : Level.END; - ServerLevel serverLevel = level.getServer().getLevel(resourceKey); - if (serverLevel == null) { + public TeleportTransition getPortalDestination(ServerLevel serverLevel, Entity entity, BlockPos blockPos) { + ResourceKey resourceKey = serverLevel.dimension() == Level.END ? Level.OVERWORLD : Level.END; + ServerLevel serverLevel2 = serverLevel.getServer().getLevel(resourceKey); + if (serverLevel2 == null) { return null; } else { boolean bl = resourceKey == Level.END; - BlockPos blockPos = bl ? ServerLevel.END_SPAWN_POINT : serverLevel.getSharedSpawnPos(); - Vec3 vec3 = blockPos.getBottomCenter(); - float f = entity.getYRot(); + BlockPos blockPos2 = bl ? ServerLevel.END_SPAWN_POINT : serverLevel2.getSharedSpawnPos(); + Vec3 vec3 = blockPos2.getBottomCenter(); + float f; + Set set; if (bl) { - EndPlatformFeature.createEndPlatform(serverLevel, BlockPos.containing(vec3).below(), true); + EndPlatformFeature.createEndPlatform(serverLevel2, BlockPos.containing(vec3).below(), true); f = Direction.WEST.toYRot(); + set = Relative.union(Relative.DELTA, Set.of(Relative.X_ROT)); if (entity instanceof ServerPlayer) { vec3 = vec3.subtract(0.0, 1.0, 0.0); } } else { + f = 0.0F; + set = Relative.union(Relative.DELTA, Relative.ROTATION); if (entity instanceof ServerPlayer serverPlayer) { - return serverPlayer.findRespawnPositionAndUseSpawnBlock(false, DimensionTransition.DO_NOTHING); + return serverPlayer.findRespawnPositionAndUseSpawnBlock(false, TeleportTransition.DO_NOTHING); } - vec3 = entity.adjustSpawnLocation(serverLevel, blockPos).getBottomCenter(); + vec3 = entity.adjustSpawnLocation(serverLevel2, blockPos2).getBottomCenter(); } - return new DimensionTransition( - serverLevel, vec3, entity.getDeltaMovement(), f, entity.getXRot(), DimensionTransition.PLAY_PORTAL_SOUND.then(DimensionTransition.PLACE_PORTAL_TICKET) - ); + return new TeleportTransition(serverLevel2, vec3, Vec3.ZERO, f, 0.0F, set, TeleportTransition.PLAY_PORTAL_SOUND.then(TeleportTransition.PLACE_PORTAL_TICKET)); } } diff --git a/net/minecraft/world/level/block/EndPortalFrameBlock.java b/net/minecraft/world/level/block/EndPortalFrameBlock.java index 7b84244e..d335b91c 100644 --- a/net/minecraft/world/level/block/EndPortalFrameBlock.java +++ b/net/minecraft/world/level/block/EndPortalFrameBlock.java @@ -16,7 +16,7 @@ import net.minecraft.world.level.block.state.pattern.BlockPatternBuilder; import net.minecraft.world.level.block.state.predicate.BlockStatePredicate; import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.block.state.properties.BooleanProperty; -import net.minecraft.world.level.block.state.properties.DirectionProperty; +import net.minecraft.world.level.block.state.properties.EnumProperty; import net.minecraft.world.level.pathfinder.PathComputationType; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.Shapes; @@ -24,7 +24,7 @@ import net.minecraft.world.phys.shapes.VoxelShape; public class EndPortalFrameBlock extends Block { public static final MapCodec CODEC = simpleCodec(EndPortalFrameBlock::new); - public static final DirectionProperty FACING = HorizontalDirectionalBlock.FACING; + public static final EnumProperty FACING = HorizontalDirectionalBlock.FACING; public static final BooleanProperty HAS_EYE = BlockStateProperties.EYE; protected static final VoxelShape BASE_SHAPE = Block.box(0.0, 0.0, 0.0, 16.0, 13.0, 16.0); protected static final VoxelShape EYE_SHAPE = Block.box(4.0, 13.0, 4.0, 12.0, 16.0, 12.0); diff --git a/net/minecraft/world/level/block/EnderChestBlock.java b/net/minecraft/world/level/block/EnderChestBlock.java index da7a5efa..efbea59b 100644 --- a/net/minecraft/world/level/block/EnderChestBlock.java +++ b/net/minecraft/world/level/block/EnderChestBlock.java @@ -17,7 +17,8 @@ import net.minecraft.world.inventory.PlayerEnderChestContainer; import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; -import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntityTicker; import net.minecraft.world.level.block.entity.BlockEntityType; @@ -28,7 +29,7 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.block.state.properties.BooleanProperty; -import net.minecraft.world.level.block.state.properties.DirectionProperty; +import net.minecraft.world.level.block.state.properties.EnumProperty; import net.minecraft.world.level.material.FluidState; import net.minecraft.world.level.material.Fluids; import net.minecraft.world.level.pathfinder.PathComputationType; @@ -39,7 +40,7 @@ import org.jetbrains.annotations.Nullable; public class EnderChestBlock extends AbstractChestBlock implements SimpleWaterloggedBlock { public static final MapCodec CODEC = simpleCodec(EnderChestBlock::new); - public static final DirectionProperty FACING = HorizontalDirectionalBlock.FACING; + public static final EnumProperty FACING = HorizontalDirectionalBlock.FACING; public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED; protected static final VoxelShape SHAPE = Block.box(1.0, 0.0, 1.0, 15.0, 14.0, 15.0); private static final Component CONTAINER_TITLE = Component.translatable("container.enderchest"); @@ -78,23 +79,22 @@ public class EnderChestBlock extends AbstractChestBlock i @Override protected InteractionResult useWithoutItem(BlockState state, Level level, BlockPos pos, Player player, BlockHitResult hitResult) { PlayerEnderChestContainer playerEnderChestContainer = player.getEnderChestInventory(); - BlockEntity blockEntity = level.getBlockEntity(pos); - if (playerEnderChestContainer != null && blockEntity instanceof EnderChestBlockEntity) { + if (playerEnderChestContainer != null && level.getBlockEntity(pos) instanceof EnderChestBlockEntity enderChestBlockEntity) { BlockPos blockPos = pos.above(); if (level.getBlockState(blockPos).isRedstoneConductor(level, blockPos)) { - return InteractionResult.sidedSuccess(level.isClientSide); - } else if (level.isClientSide) { return InteractionResult.SUCCESS; } else { - EnderChestBlockEntity enderChestBlockEntity = (EnderChestBlockEntity)blockEntity; - playerEnderChestContainer.setActiveChest(enderChestBlockEntity); - player.openMenu(new SimpleMenuProvider((i, inventory, playerx) -> ChestMenu.threeRows(i, inventory, playerEnderChestContainer), CONTAINER_TITLE)); - player.awardStat(Stats.OPEN_ENDERCHEST); - PiglinAi.angerNearbyPiglins(player, true); - return InteractionResult.CONSUME; + if (level instanceof ServerLevel serverLevel) { + playerEnderChestContainer.setActiveChest(enderChestBlockEntity); + player.openMenu(new SimpleMenuProvider((i, inventory, playerx) -> ChestMenu.threeRows(i, inventory, playerEnderChestContainer), CONTAINER_TITLE)); + player.awardStat(Stats.OPEN_ENDERCHEST); + PiglinAi.angerNearbyPiglins(serverLevel, player, true); + } + + return InteractionResult.SUCCESS; } } else { - return InteractionResult.sidedSuccess(level.isClientSide); + return InteractionResult.SUCCESS; } } @@ -145,12 +145,21 @@ public class EnderChestBlock extends AbstractChestBlock i } @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { - if ((Boolean)state.getValue(WATERLOGGED)) { - level.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(level)); + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { + if ((Boolean)blockState.getValue(WATERLOGGED)) { + scheduledTickAccess.scheduleTick(blockPos, Fluids.WATER, Fluids.WATER.getTickDelay(levelReader)); } - return super.updateShape(state, direction, neighborState, level, pos, neighborPos); + return super.updateShape(blockState, levelReader, scheduledTickAccess, blockPos, direction, blockPos2, blockState2, randomSource); } @Override diff --git a/net/minecraft/world/level/block/EquipableCarvedPumpkinBlock.java b/net/minecraft/world/level/block/EquipableCarvedPumpkinBlock.java deleted file mode 100644 index 8918d1eb..00000000 --- a/net/minecraft/world/level/block/EquipableCarvedPumpkinBlock.java +++ /dev/null @@ -1,24 +0,0 @@ -package net.minecraft.world.level.block; - -import com.mojang.serialization.MapCodec; -import net.minecraft.world.entity.EquipmentSlot; -import net.minecraft.world.item.Equipable; -import net.minecraft.world.level.block.state.BlockBehaviour; - -public class EquipableCarvedPumpkinBlock extends CarvedPumpkinBlock implements Equipable { - public static final MapCodec CODEC = simpleCodec(EquipableCarvedPumpkinBlock::new); - - @Override - public MapCodec codec() { - return CODEC; - } - - protected EquipableCarvedPumpkinBlock(BlockBehaviour.Properties properties) { - super(properties); - } - - @Override - public EquipmentSlot getEquipmentSlot() { - return EquipmentSlot.HEAD; - } -} diff --git a/net/minecraft/world/level/block/FaceAttachedHorizontalDirectionalBlock.java b/net/minecraft/world/level/block/FaceAttachedHorizontalDirectionalBlock.java index f45ce9e6..1b2e2dce 100644 --- a/net/minecraft/world/level/block/FaceAttachedHorizontalDirectionalBlock.java +++ b/net/minecraft/world/level/block/FaceAttachedHorizontalDirectionalBlock.java @@ -3,9 +3,10 @@ package net.minecraft.world.level.block; import com.mojang.serialization.MapCodec; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; +import net.minecraft.util.RandomSource; import net.minecraft.world.item.context.BlockPlaceContext; -import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.properties.AttachFace; @@ -55,10 +56,19 @@ public abstract class FaceAttachedHorizontalDirectionalBlock extends HorizontalD } @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { - return getConnectedDirection(state).getOpposite() == direction && !state.canSurvive(level, pos) + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { + return getConnectedDirection(blockState).getOpposite() == direction && !blockState.canSurvive(levelReader, blockPos) ? Blocks.AIR.defaultBlockState() - : super.updateShape(state, direction, neighborState, level, pos, neighborPos); + : super.updateShape(blockState, levelReader, scheduledTickAccess, blockPos, direction, blockPos2, blockState2, randomSource); } protected static Direction getConnectedDirection(BlockState state) { diff --git a/net/minecraft/world/level/block/FallingBlock.java b/net/minecraft/world/level/block/FallingBlock.java index 3f311790..8d2a1cf8 100644 --- a/net/minecraft/world/level/block/FallingBlock.java +++ b/net/minecraft/world/level/block/FallingBlock.java @@ -12,7 +12,8 @@ import net.minecraft.util.RandomSource; import net.minecraft.world.entity.item.FallingBlockEntity; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; -import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; @@ -30,14 +31,23 @@ public abstract class FallingBlock extends Block implements Fallable { } @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { - level.scheduleTick(pos, this, this.getDelayAfterPlace()); - return super.updateShape(state, direction, neighborState, level, pos, neighborPos); + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { + scheduledTickAccess.scheduleTick(blockPos, this, this.getDelayAfterPlace()); + return super.updateShape(blockState, levelReader, scheduledTickAccess, blockPos, direction, blockPos2, blockState2, randomSource); } @Override protected void tick(BlockState state, ServerLevel level, BlockPos pos, RandomSource random) { - if (isFree(level.getBlockState(pos.below())) && pos.getY() >= level.getMinBuildHeight()) { + if (isFree(level.getBlockState(pos.below())) && pos.getY() >= level.getMinY()) { FallingBlockEntity fallingBlockEntity = FallingBlockEntity.fall(level, pos, state); this.falling(fallingBlockEntity); } diff --git a/net/minecraft/world/level/block/FarmBlock.java b/net/minecraft/world/level/block/FarmBlock.java index 6e738647..c8a44543 100644 --- a/net/minecraft/world/level/block/FarmBlock.java +++ b/net/minecraft/world/level/block/FarmBlock.java @@ -14,8 +14,8 @@ import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.GameRules; import net.minecraft.world.level.Level; -import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.piston.MovingPistonBlock; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; @@ -23,6 +23,7 @@ import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.block.state.properties.IntegerProperty; import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.level.gameevent.GameEvent.Context; import net.minecraft.world.level.pathfinder.PathComputationType; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.VoxelShape; @@ -45,12 +46,21 @@ public class FarmBlock extends Block { } @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { - if (direction == Direction.UP && !state.canSurvive(level, pos)) { - level.scheduleTick(pos, this, 1); + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { + if (direction == Direction.UP && !blockState.canSurvive(levelReader, blockPos)) { + scheduledTickAccess.scheduleTick(blockPos, this, 1); } - return super.updateShape(state, direction, neighborState, level, pos, neighborPos); + return super.updateShape(blockState, levelReader, scheduledTickAccess, blockPos, direction, blockPos2, blockState2, randomSource); } @Override @@ -99,10 +109,10 @@ public class FarmBlock extends Block { @Override public void fallOn(Level level, BlockState state, BlockPos pos, Entity entity, float fallDistance) { - if (!level.isClientSide + if (level instanceof ServerLevel serverLevel && level.random.nextFloat() < fallDistance - 0.5F && entity instanceof LivingEntity - && (entity instanceof Player || level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) + && (entity instanceof Player || serverLevel.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) && entity.getBbWidth() * entity.getBbWidth() * entity.getBbHeight() > 0.512F) { turnToDirt(entity, state, level, pos); } @@ -113,7 +123,7 @@ public class FarmBlock extends Block { public static void turnToDirt(@Nullable Entity entity, BlockState state, Level level, BlockPos pos) { BlockState blockState = pushEntitiesUp(state, Blocks.DIRT.defaultBlockState(), level, pos); level.setBlockAndUpdate(pos, blockState); - level.gameEvent(GameEvent.BLOCK_CHANGE, pos, GameEvent.Context.of(entity, blockState)); + level.gameEvent(GameEvent.BLOCK_CHANGE, pos, Context.of(entity, blockState)); } private static boolean shouldMaintainFarmland(BlockGetter level, BlockPos pos) { diff --git a/net/minecraft/world/level/block/FenceBlock.java b/net/minecraft/world/level/block/FenceBlock.java index 130e90d0..fc420701 100644 --- a/net/minecraft/world/level/block/FenceBlock.java +++ b/net/minecraft/world/level/block/FenceBlock.java @@ -4,17 +4,15 @@ import com.mojang.serialization.MapCodec; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.tags.BlockTags; -import net.minecraft.world.InteractionHand; +import net.minecraft.util.RandomSource; import net.minecraft.world.InteractionResult; -import net.minecraft.world.ItemInteractionResult; import net.minecraft.world.entity.player.Player; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.Items; import net.minecraft.world.item.LeadItem; import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; -import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; @@ -44,8 +42,8 @@ public class FenceBlock extends CrossCollisionBlock { } @Override - protected VoxelShape getOcclusionShape(BlockState state, BlockGetter level, BlockPos pos) { - return this.occlusionByIndex[this.getAABBIndex(state)]; + protected VoxelShape getOcclusionShape(BlockState blockState) { + return this.occlusionByIndex[this.getAABBIndex(blockState)]; } @Override @@ -69,20 +67,9 @@ public class FenceBlock extends CrossCollisionBlock { return state.is(BlockTags.FENCES) && state.is(BlockTags.WOODEN_FENCES) == this.defaultBlockState().is(BlockTags.WOODEN_FENCES); } - @Override - protected ItemInteractionResult useItemOn( - ItemStack stack, BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hitResult - ) { - if (level.isClientSide) { - return stack.is(Items.LEAD) ? ItemInteractionResult.SUCCESS : ItemInteractionResult.SKIP_DEFAULT_BLOCK_INTERACTION; - } else { - return super.useItemOn(stack, state, level, pos, player, hand, hitResult); - } - } - @Override protected InteractionResult useWithoutItem(BlockState state, Level level, BlockPos pos, Player player, BlockHitResult hitResult) { - return !level.isClientSide() ? LeadItem.bindPlayerMobs(player, level, pos) : InteractionResult.PASS; + return (InteractionResult)(!level.isClientSide() ? LeadItem.bindPlayerMobs(player, level, pos) : InteractionResult.PASS); } @Override @@ -107,17 +94,26 @@ public class FenceBlock extends CrossCollisionBlock { } @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { - if ((Boolean)state.getValue(WATERLOGGED)) { - level.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(level)); + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { + if ((Boolean)blockState.getValue(WATERLOGGED)) { + scheduledTickAccess.scheduleTick(blockPos, Fluids.WATER, Fluids.WATER.getTickDelay(levelReader)); } - return direction.getAxis().getPlane() == Direction.Plane.HORIZONTAL - ? state.setValue( + return direction.getAxis().isHorizontal() + ? blockState.setValue( (Property)PROPERTY_BY_DIRECTION.get(direction), - this.connectsTo(neighborState, neighborState.isFaceSturdy(level, neighborPos, direction.getOpposite()), direction.getOpposite()) + this.connectsTo(blockState2, blockState2.isFaceSturdy(levelReader, blockPos2, direction.getOpposite()), direction.getOpposite()) ) - : super.updateShape(state, direction, neighborState, level, pos, neighborPos); + : super.updateShape(blockState, levelReader, scheduledTickAccess, blockPos, direction, blockPos2, blockState2, randomSource); } @Override diff --git a/net/minecraft/world/level/block/FenceGateBlock.java b/net/minecraft/world/level/block/FenceGateBlock.java index 391e4ff9..db255029 100644 --- a/net/minecraft/world/level/block/FenceGateBlock.java +++ b/net/minecraft/world/level/block/FenceGateBlock.java @@ -5,8 +5,10 @@ import com.mojang.serialization.codecs.RecordCodecBuilder; import java.util.function.BiConsumer; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; +import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundSource; import net.minecraft.tags.BlockTags; +import net.minecraft.util.RandomSource; import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; @@ -14,7 +16,8 @@ import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Explosion; import net.minecraft.world.level.Level; -import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; @@ -22,11 +25,14 @@ import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.block.state.properties.BooleanProperty; import net.minecraft.world.level.block.state.properties.WoodType; import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.level.gameevent.GameEvent.Context; import net.minecraft.world.level.pathfinder.PathComputationType; +import net.minecraft.world.level.redstone.Orientation; import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.Shapes; import net.minecraft.world.phys.shapes.VoxelShape; +import org.jetbrains.annotations.Nullable; public class FenceGateBlock extends HorizontalDirectionalBlock { public static final MapCodec CODEC = RecordCodecBuilder.mapCodec( @@ -71,13 +77,22 @@ public class FenceGateBlock extends HorizontalDirectionalBlock { } @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { Direction.Axis axis = direction.getAxis(); - if (((Direction)state.getValue(FACING)).getClockWise().getAxis() != axis) { - return super.updateShape(state, direction, neighborState, level, pos, neighborPos); + if (((Direction)blockState.getValue(FACING)).getClockWise().getAxis() != axis) { + return super.updateShape(blockState, levelReader, scheduledTickAccess, blockPos, direction, blockPos2, blockState2, randomSource); } else { - boolean bl = this.isWall(neighborState) || this.isWall(level.getBlockState(pos.relative(direction.getOpposite()))); - return state.setValue(IN_WALL, bl); + boolean bl = this.isWall(blockState2) || this.isWall(levelReader.getBlockState(blockPos.relative(direction.getOpposite()))); + return blockState.setValue(IN_WALL, bl); } } @@ -100,11 +115,11 @@ public class FenceGateBlock extends HorizontalDirectionalBlock { } @Override - protected VoxelShape getOcclusionShape(BlockState state, BlockGetter level, BlockPos pos) { - if ((Boolean)state.getValue(IN_WALL)) { - return ((Direction)state.getValue(FACING)).getAxis() == Direction.Axis.X ? X_OCCLUSION_SHAPE_LOW : Z_OCCLUSION_SHAPE_LOW; + protected VoxelShape getOcclusionShape(BlockState blockState) { + if ((Boolean)blockState.getValue(IN_WALL)) { + return ((Direction)blockState.getValue(FACING)).getAxis() == Direction.Axis.X ? X_OCCLUSION_SHAPE_LOW : Z_OCCLUSION_SHAPE_LOW; } else { - return ((Direction)state.getValue(FACING)).getAxis() == Direction.Axis.X ? X_OCCLUSION_SHAPE : Z_OCCLUSION_SHAPE; + return ((Direction)blockState.getValue(FACING)).getAxis() == Direction.Axis.X ? X_OCCLUSION_SHAPE : Z_OCCLUSION_SHAPE; } } @@ -158,34 +173,36 @@ public class FenceGateBlock extends HorizontalDirectionalBlock { player, pos, bl ? this.type.fenceGateOpen() : this.type.fenceGateClose(), SoundSource.BLOCKS, 1.0F, level.getRandom().nextFloat() * 0.1F + 0.9F ); level.gameEvent(player, bl ? GameEvent.BLOCK_OPEN : GameEvent.BLOCK_CLOSE, pos); - return InteractionResult.sidedSuccess(level.isClientSide); + return InteractionResult.SUCCESS; } @Override - protected void onExplosionHit(BlockState state, Level level, BlockPos pos, Explosion explosion, BiConsumer dropConsumer) { - if (explosion.canTriggerBlocks() && !(Boolean)state.getValue(POWERED)) { - boolean bl = (Boolean)state.getValue(OPEN); - level.setBlockAndUpdate(pos, state.setValue(OPEN, !bl)); - level.playSound( - null, pos, bl ? this.type.fenceGateClose() : this.type.fenceGateOpen(), SoundSource.BLOCKS, 1.0F, level.getRandom().nextFloat() * 0.1F + 0.9F + protected void onExplosionHit( + BlockState blockState, ServerLevel serverLevel, BlockPos blockPos, Explosion explosion, BiConsumer biConsumer + ) { + if (explosion.canTriggerBlocks() && !(Boolean)blockState.getValue(POWERED)) { + boolean bl = (Boolean)blockState.getValue(OPEN); + serverLevel.setBlockAndUpdate(blockPos, blockState.setValue(OPEN, !bl)); + serverLevel.playSound( + null, blockPos, bl ? this.type.fenceGateClose() : this.type.fenceGateOpen(), SoundSource.BLOCKS, 1.0F, serverLevel.getRandom().nextFloat() * 0.1F + 0.9F ); - level.gameEvent(bl ? GameEvent.BLOCK_CLOSE : GameEvent.BLOCK_OPEN, pos, GameEvent.Context.of(state)); + serverLevel.gameEvent(bl ? GameEvent.BLOCK_CLOSE : GameEvent.BLOCK_OPEN, blockPos, Context.of(blockState)); } - super.onExplosionHit(state, level, pos, explosion, dropConsumer); + super.onExplosionHit(blockState, serverLevel, blockPos, explosion, biConsumer); } @Override - protected void neighborChanged(BlockState state, Level level, BlockPos pos, Block neighborBlock, BlockPos neighborPos, boolean movedByPiston) { + protected void neighborChanged(BlockState blockState, Level level, BlockPos blockPos, Block block, @Nullable Orientation orientation, boolean bl) { if (!level.isClientSide) { - boolean bl = level.hasNeighborSignal(pos); - if ((Boolean)state.getValue(POWERED) != bl) { - level.setBlock(pos, state.setValue(POWERED, bl).setValue(OPEN, bl), 2); - if ((Boolean)state.getValue(OPEN) != bl) { + boolean bl2 = level.hasNeighborSignal(blockPos); + if ((Boolean)blockState.getValue(POWERED) != bl2) { + level.setBlock(blockPos, blockState.setValue(POWERED, bl2).setValue(OPEN, bl2), 2); + if ((Boolean)blockState.getValue(OPEN) != bl2) { level.playSound( - null, pos, bl ? this.type.fenceGateOpen() : this.type.fenceGateClose(), SoundSource.BLOCKS, 1.0F, level.getRandom().nextFloat() * 0.1F + 0.9F + null, blockPos, bl2 ? this.type.fenceGateOpen() : this.type.fenceGateClose(), SoundSource.BLOCKS, 1.0F, level.getRandom().nextFloat() * 0.1F + 0.9F ); - level.gameEvent(null, bl ? GameEvent.BLOCK_OPEN : GameEvent.BLOCK_CLOSE, pos); + level.gameEvent(null, bl2 ? GameEvent.BLOCK_OPEN : GameEvent.BLOCK_CLOSE, blockPos); } } } diff --git a/net/minecraft/world/level/block/FireBlock.java b/net/minecraft/world/level/block/FireBlock.java index 21b053ea..9f16279a 100644 --- a/net/minecraft/world/level/block/FireBlock.java +++ b/net/minecraft/world/level/block/FireBlock.java @@ -17,8 +17,8 @@ import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.GameRules; import net.minecraft.world.level.Level; -import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; @@ -105,8 +105,19 @@ public class FireBlock extends BaseFireBlock { } @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { - return this.canSurvive(state, level, pos) ? this.getStateWithAge(level, pos, (Integer)state.getValue(AGE)) : Blocks.AIR.defaultBlockState(); + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { + return this.canSurvive(blockState, levelReader, blockPos) + ? this.getStateWithAge(levelReader, blockPos, (Integer)blockState.getValue(AGE)) + : Blocks.AIR.defaultBlockState(); } @Override @@ -254,9 +265,9 @@ public class FireBlock extends BaseFireBlock { } } - private BlockState getStateWithAge(LevelAccessor level, BlockPos pos, int age) { - BlockState blockState = getState(level, pos); - return blockState.is(Blocks.FIRE) ? blockState.setValue(AGE, age) : blockState; + private BlockState getStateWithAge(LevelReader levelReader, BlockPos blockPos, int i) { + BlockState blockState = getState(levelReader, blockPos); + return blockState.is(Blocks.FIRE) ? blockState.setValue(AGE, i) : blockState; } private boolean isValidFireLocation(BlockGetter level, BlockPos pos) { @@ -321,6 +332,7 @@ public class FireBlock extends BaseFireBlock { fireBlock.setFlammable(Blocks.ACACIA_PLANKS, 5, 20); fireBlock.setFlammable(Blocks.CHERRY_PLANKS, 5, 20); fireBlock.setFlammable(Blocks.DARK_OAK_PLANKS, 5, 20); + fireBlock.setFlammable(Blocks.PALE_OAK_PLANKS, 5, 20); fireBlock.setFlammable(Blocks.MANGROVE_PLANKS, 5, 20); fireBlock.setFlammable(Blocks.BAMBOO_PLANKS, 5, 20); fireBlock.setFlammable(Blocks.BAMBOO_MOSAIC, 5, 20); @@ -331,6 +343,7 @@ public class FireBlock extends BaseFireBlock { fireBlock.setFlammable(Blocks.ACACIA_SLAB, 5, 20); fireBlock.setFlammable(Blocks.CHERRY_SLAB, 5, 20); fireBlock.setFlammable(Blocks.DARK_OAK_SLAB, 5, 20); + fireBlock.setFlammable(Blocks.PALE_OAK_SLAB, 5, 20); fireBlock.setFlammable(Blocks.MANGROVE_SLAB, 5, 20); fireBlock.setFlammable(Blocks.BAMBOO_SLAB, 5, 20); fireBlock.setFlammable(Blocks.BAMBOO_MOSAIC_SLAB, 5, 20); @@ -341,6 +354,7 @@ public class FireBlock extends BaseFireBlock { fireBlock.setFlammable(Blocks.ACACIA_FENCE_GATE, 5, 20); fireBlock.setFlammable(Blocks.CHERRY_FENCE_GATE, 5, 20); fireBlock.setFlammable(Blocks.DARK_OAK_FENCE_GATE, 5, 20); + fireBlock.setFlammable(Blocks.PALE_OAK_FENCE_GATE, 5, 20); fireBlock.setFlammable(Blocks.MANGROVE_FENCE_GATE, 5, 20); fireBlock.setFlammable(Blocks.BAMBOO_FENCE_GATE, 5, 20); fireBlock.setFlammable(Blocks.OAK_FENCE, 5, 20); @@ -350,6 +364,7 @@ public class FireBlock extends BaseFireBlock { fireBlock.setFlammable(Blocks.ACACIA_FENCE, 5, 20); fireBlock.setFlammable(Blocks.CHERRY_FENCE, 5, 20); fireBlock.setFlammable(Blocks.DARK_OAK_FENCE, 5, 20); + fireBlock.setFlammable(Blocks.PALE_OAK_FENCE, 5, 20); fireBlock.setFlammable(Blocks.MANGROVE_FENCE, 5, 20); fireBlock.setFlammable(Blocks.BAMBOO_FENCE, 5, 20); fireBlock.setFlammable(Blocks.OAK_STAIRS, 5, 20); @@ -359,6 +374,7 @@ public class FireBlock extends BaseFireBlock { fireBlock.setFlammable(Blocks.ACACIA_STAIRS, 5, 20); fireBlock.setFlammable(Blocks.CHERRY_STAIRS, 5, 20); fireBlock.setFlammable(Blocks.DARK_OAK_STAIRS, 5, 20); + fireBlock.setFlammable(Blocks.PALE_OAK_STAIRS, 5, 20); fireBlock.setFlammable(Blocks.MANGROVE_STAIRS, 5, 20); fireBlock.setFlammable(Blocks.BAMBOO_STAIRS, 5, 20); fireBlock.setFlammable(Blocks.BAMBOO_MOSAIC_STAIRS, 5, 20); @@ -368,6 +384,7 @@ public class FireBlock extends BaseFireBlock { fireBlock.setFlammable(Blocks.JUNGLE_LOG, 5, 5); fireBlock.setFlammable(Blocks.ACACIA_LOG, 5, 5); fireBlock.setFlammable(Blocks.CHERRY_LOG, 5, 5); + fireBlock.setFlammable(Blocks.PALE_OAK_LOG, 5, 5); fireBlock.setFlammable(Blocks.DARK_OAK_LOG, 5, 5); fireBlock.setFlammable(Blocks.MANGROVE_LOG, 5, 5); fireBlock.setFlammable(Blocks.BAMBOO_BLOCK, 5, 5); @@ -378,6 +395,7 @@ public class FireBlock extends BaseFireBlock { fireBlock.setFlammable(Blocks.STRIPPED_ACACIA_LOG, 5, 5); fireBlock.setFlammable(Blocks.STRIPPED_CHERRY_LOG, 5, 5); fireBlock.setFlammable(Blocks.STRIPPED_DARK_OAK_LOG, 5, 5); + fireBlock.setFlammable(Blocks.STRIPPED_PALE_OAK_LOG, 5, 5); fireBlock.setFlammable(Blocks.STRIPPED_MANGROVE_LOG, 5, 5); fireBlock.setFlammable(Blocks.STRIPPED_BAMBOO_BLOCK, 5, 5); fireBlock.setFlammable(Blocks.STRIPPED_OAK_WOOD, 5, 5); @@ -387,6 +405,7 @@ public class FireBlock extends BaseFireBlock { fireBlock.setFlammable(Blocks.STRIPPED_ACACIA_WOOD, 5, 5); fireBlock.setFlammable(Blocks.STRIPPED_CHERRY_WOOD, 5, 5); fireBlock.setFlammable(Blocks.STRIPPED_DARK_OAK_WOOD, 5, 5); + fireBlock.setFlammable(Blocks.STRIPPED_PALE_OAK_WOOD, 5, 5); fireBlock.setFlammable(Blocks.STRIPPED_MANGROVE_WOOD, 5, 5); fireBlock.setFlammable(Blocks.OAK_WOOD, 5, 5); fireBlock.setFlammable(Blocks.SPRUCE_WOOD, 5, 5); @@ -394,6 +413,7 @@ public class FireBlock extends BaseFireBlock { fireBlock.setFlammable(Blocks.JUNGLE_WOOD, 5, 5); fireBlock.setFlammable(Blocks.ACACIA_WOOD, 5, 5); fireBlock.setFlammable(Blocks.CHERRY_WOOD, 5, 5); + fireBlock.setFlammable(Blocks.PALE_OAK_WOOD, 5, 5); fireBlock.setFlammable(Blocks.DARK_OAK_WOOD, 5, 5); fireBlock.setFlammable(Blocks.MANGROVE_WOOD, 5, 5); fireBlock.setFlammable(Blocks.MANGROVE_ROOTS, 5, 20); @@ -404,6 +424,7 @@ public class FireBlock extends BaseFireBlock { fireBlock.setFlammable(Blocks.ACACIA_LEAVES, 30, 60); fireBlock.setFlammable(Blocks.CHERRY_LEAVES, 30, 60); fireBlock.setFlammable(Blocks.DARK_OAK_LEAVES, 30, 60); + fireBlock.setFlammable(Blocks.PALE_OAK_LEAVES, 30, 60); fireBlock.setFlammable(Blocks.MANGROVE_LEAVES, 30, 60); fireBlock.setFlammable(Blocks.BOOKSHELF, 30, 20); fireBlock.setFlammable(Blocks.TNT, 15, 100); @@ -468,6 +489,9 @@ public class FireBlock extends BaseFireBlock { fireBlock.setFlammable(Blocks.GREEN_CARPET, 60, 20); fireBlock.setFlammable(Blocks.RED_CARPET, 60, 20); fireBlock.setFlammable(Blocks.BLACK_CARPET, 60, 20); + fireBlock.setFlammable(Blocks.PALE_MOSS_BLOCK, 60, 20); + fireBlock.setFlammable(Blocks.PALE_MOSS_CARPET, 60, 20); + fireBlock.setFlammable(Blocks.PALE_HANGING_MOSS, 60, 100); fireBlock.setFlammable(Blocks.DRIED_KELP_BLOCK, 30, 60); fireBlock.setFlammable(Blocks.BAMBOO, 60, 60); fireBlock.setFlammable(Blocks.SCAFFOLDING, 60, 60); diff --git a/net/minecraft/world/level/block/FlowerBlock.java b/net/minecraft/world/level/block/FlowerBlock.java index fd77331a..980aa3b2 100644 --- a/net/minecraft/world/level/block/FlowerBlock.java +++ b/net/minecraft/world/level/block/FlowerBlock.java @@ -44,7 +44,7 @@ public class FlowerBlock extends BushBlock implements SuspiciousEffectHolder { @Override protected VoxelShape getShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext context) { - Vec3 vec3 = state.getOffset(level, pos); + Vec3 vec3 = state.getOffset(pos); return SHAPE.move(vec3.x, vec3.y, vec3.z); } diff --git a/net/minecraft/world/level/block/FlowerPotBlock.java b/net/minecraft/world/level/block/FlowerPotBlock.java index a2111a3c..ac9ef206 100644 --- a/net/minecraft/world/level/block/FlowerPotBlock.java +++ b/net/minecraft/world/level/block/FlowerPotBlock.java @@ -8,16 +8,16 @@ import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.stats.Stats; +import net.minecraft.util.RandomSource; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; -import net.minecraft.world.ItemInteractionResult; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; -import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.gameevent.GameEvent; @@ -53,23 +53,23 @@ public class FlowerPotBlock extends Block { } @Override - protected ItemInteractionResult useItemOn( - ItemStack stack, BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hitResult + protected InteractionResult useItemOn( + ItemStack itemStack, BlockState blockState, Level level, BlockPos blockPos, Player player, InteractionHand interactionHand, BlockHitResult blockHitResult ) { - BlockState blockState = (stack.getItem() instanceof BlockItem blockItem + BlockState blockState2 = (itemStack.getItem() instanceof BlockItem blockItem ? (Block)POTTED_BY_CONTENT.getOrDefault(blockItem.getBlock(), Blocks.AIR) : Blocks.AIR) .defaultBlockState(); - if (blockState.isAir()) { - return ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION; + if (blockState2.isAir()) { + return InteractionResult.TRY_WITH_EMPTY_HAND; } else if (!this.isEmpty()) { - return ItemInteractionResult.CONSUME; + return InteractionResult.CONSUME; } else { - level.setBlock(pos, blockState, 3); - level.gameEvent(player, GameEvent.BLOCK_CHANGE, pos); + level.setBlock(blockPos, blockState2, 3); + level.gameEvent(player, GameEvent.BLOCK_CHANGE, blockPos); player.awardStat(Stats.POT_FLOWER); - stack.consume(1, player); - return ItemInteractionResult.sidedSuccess(level.isClientSide); + itemStack.consume(1, player); + return InteractionResult.SUCCESS; } } @@ -85,7 +85,7 @@ public class FlowerPotBlock extends Block { level.setBlock(pos, Blocks.FLOWER_POT.defaultBlockState(), 3); level.gameEvent(player, GameEvent.BLOCK_CHANGE, pos); - return InteractionResult.sidedSuccess(level.isClientSide); + return InteractionResult.SUCCESS; } } @@ -99,10 +99,19 @@ public class FlowerPotBlock extends Block { } @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { - return direction == Direction.DOWN && !state.canSurvive(level, pos) + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { + return direction == Direction.DOWN && !blockState.canSurvive(levelReader, blockPos) ? Blocks.AIR.defaultBlockState() - : super.updateShape(state, direction, neighborState, level, pos, neighborPos); + : super.updateShape(blockState, levelReader, scheduledTickAccess, blockPos, direction, blockPos2, blockState2, randomSource); } public Block getPotted() { diff --git a/net/minecraft/world/level/block/FrogspawnBlock.java b/net/minecraft/world/level/block/FrogspawnBlock.java index 24e9fc4f..8db5dc09 100644 --- a/net/minecraft/world/level/block/FrogspawnBlock.java +++ b/net/minecraft/world/level/block/FrogspawnBlock.java @@ -10,12 +10,13 @@ import net.minecraft.sounds.SoundSource; import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.animal.frog.Tadpole; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; -import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.material.FluidState; @@ -62,8 +63,19 @@ public class FrogspawnBlock extends Block { } @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { - return !this.canSurvive(state, level, pos) ? Blocks.AIR.defaultBlockState() : super.updateShape(state, direction, neighborState, level, pos, neighborPos); + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { + return !this.canSurvive(blockState, levelReader, blockPos) + ? Blocks.AIR.defaultBlockState() + : super.updateShape(blockState, levelReader, scheduledTickAccess, blockPos, direction, blockPos2, blockState2, randomSource); } @Override @@ -102,7 +114,7 @@ public class FrogspawnBlock extends Block { int i = random.nextInt(2, 6); for (int j = 1; j <= i; j++) { - Tadpole tadpole = EntityType.TADPOLE.create(level); + Tadpole tadpole = EntityType.TADPOLE.create(level, EntitySpawnReason.BREEDING); if (tadpole != null) { double d = pos.getX() + this.getRandomTadpolePositionOffset(random); double e = pos.getZ() + this.getRandomTadpolePositionOffset(random); diff --git a/net/minecraft/world/level/block/FrostedIceBlock.java b/net/minecraft/world/level/block/FrostedIceBlock.java index 6916ae09..2b191179 100644 --- a/net/minecraft/world/level/block/FrostedIceBlock.java +++ b/net/minecraft/world/level/block/FrostedIceBlock.java @@ -15,6 +15,8 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.block.state.properties.IntegerProperty; +import net.minecraft.world.level.redstone.Orientation; +import org.jetbrains.annotations.Nullable; public class FrostedIceBlock extends IceBlock { public static final MapCodec CODEC = simpleCodec(FrostedIceBlock::new); @@ -41,7 +43,7 @@ public class FrostedIceBlock extends IceBlock { @Override protected void tick(BlockState state, ServerLevel level, BlockPos pos, RandomSource random) { if ((random.nextInt(3) == 0 || this.fewerNeigboursThan(level, pos, 4)) - && level.getMaxLocalRawBrightness(pos) > 11 - (Integer)state.getValue(AGE) - state.getLightBlock(level, pos) + && level.getMaxLocalRawBrightness(pos) > 11 - (Integer)state.getValue(AGE) - state.getLightBlock() && this.slightlyMelt(state, level, pos)) { BlockPos.MutableBlockPos mutableBlockPos = new BlockPos.MutableBlockPos(); @@ -69,12 +71,12 @@ public class FrostedIceBlock extends IceBlock { } @Override - protected void neighborChanged(BlockState state, Level level, BlockPos pos, Block neighborBlock, BlockPos neighborPos, boolean movedByPiston) { - if (neighborBlock.defaultBlockState().is(this) && this.fewerNeigboursThan(level, pos, 2)) { - this.melt(state, level, pos); + protected void neighborChanged(BlockState blockState, Level level, BlockPos blockPos, Block block, @Nullable Orientation orientation, boolean bl) { + if (block.defaultBlockState().is(this) && this.fewerNeigboursThan(level, blockPos, 2)) { + this.melt(blockState, level, blockPos); } - super.neighborChanged(state, level, pos, neighborBlock, neighborPos, movedByPiston); + super.neighborChanged(blockState, level, blockPos, block, orientation, bl); } private boolean fewerNeigboursThan(BlockGetter level, BlockPos pos, int neighborsRequired) { diff --git a/net/minecraft/world/level/block/FungusBlock.java b/net/minecraft/world/level/block/FungusBlock.java index 670a04ec..5be0e851 100644 --- a/net/minecraft/world/level/block/FungusBlock.java +++ b/net/minecraft/world/level/block/FungusBlock.java @@ -56,7 +56,7 @@ public class FungusBlock extends BushBlock implements BonemealableBlock { } private Optional>> getFeature(LevelReader level) { - return level.registryAccess().registryOrThrow(Registries.CONFIGURED_FEATURE).getHolder(this.feature); + return level.registryAccess().lookupOrThrow(Registries.CONFIGURED_FEATURE).get(this.feature); } @Override diff --git a/net/minecraft/world/level/block/GlowLichenBlock.java b/net/minecraft/world/level/block/GlowLichenBlock.java index 12237f8e..35de51fa 100644 --- a/net/minecraft/world/level/block/GlowLichenBlock.java +++ b/net/minecraft/world/level/block/GlowLichenBlock.java @@ -8,10 +8,9 @@ import net.minecraft.server.level.ServerLevel; import net.minecraft.util.RandomSource; import net.minecraft.world.item.Items; import net.minecraft.world.item.context.BlockPlaceContext; -import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; -import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; @@ -46,12 +45,21 @@ public class GlowLichenBlock extends MultifaceBlock implements BonemealableBlock } @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { - if ((Boolean)state.getValue(WATERLOGGED)) { - level.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(level)); + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { + if ((Boolean)blockState.getValue(WATERLOGGED)) { + scheduledTickAccess.scheduleTick(blockPos, Fluids.WATER, Fluids.WATER.getTickDelay(levelReader)); } - return super.updateShape(state, direction, neighborState, level, pos, neighborPos); + return super.updateShape(blockState, levelReader, scheduledTickAccess, blockPos, direction, blockPos2, blockState2, randomSource); } @Override @@ -80,8 +88,8 @@ public class GlowLichenBlock extends MultifaceBlock implements BonemealableBlock } @Override - protected boolean propagatesSkylightDown(BlockState state, BlockGetter level, BlockPos pos) { - return state.getFluidState().isEmpty(); + protected boolean propagatesSkylightDown(BlockState blockState) { + return blockState.getFluidState().isEmpty(); } @Override diff --git a/net/minecraft/world/level/block/GrassBlock.java b/net/minecraft/world/level/block/GrassBlock.java index dad96706..c408426b 100644 --- a/net/minecraft/world/level/block/GrassBlock.java +++ b/net/minecraft/world/level/block/GrassBlock.java @@ -11,6 +11,7 @@ import net.minecraft.server.level.ServerLevel; import net.minecraft.util.RandomSource; import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.block.BonemealableBlock.Type; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.levelgen.feature.ConfiguredFeature; @@ -43,24 +44,25 @@ public class GrassBlock extends SpreadingSnowyDirtBlock implements BonemealableB public void performBonemeal(ServerLevel level, RandomSource random, BlockPos pos, BlockState state) { BlockPos blockPos = pos.above(); BlockState blockState = Blocks.SHORT_GRASS.defaultBlockState(); - Optional> optional = level.registryAccess() - .registryOrThrow(Registries.PLACED_FEATURE) - .getHolder(VegetationPlacements.GRASS_BONEMEAL); + Optional> optional = level.registryAccess().lookupOrThrow(Registries.PLACED_FEATURE).get(VegetationPlacements.GRASS_BONEMEAL); - label49: + label51: for (int i = 0; i < 128; i++) { BlockPos blockPos2 = blockPos; for (int j = 0; j < i / 16; j++) { blockPos2 = blockPos2.offset(random.nextInt(3) - 1, (random.nextInt(3) - 1) * random.nextInt(3) / 2, random.nextInt(3) - 1); if (!level.getBlockState(blockPos2.below()).is(this) || level.getBlockState(blockPos2).isCollisionShapeFullBlock(level, blockPos2)) { - continue label49; + continue label51; } } BlockState blockState2 = level.getBlockState(blockPos2); if (blockState2.is(blockState.getBlock()) && random.nextInt(10) == 0) { - ((BonemealableBlock)blockState.getBlock()).performBonemeal(level, random, blockPos2, blockState2); + BonemealableBlock bonemealableBlock = (BonemealableBlock)blockState.getBlock(); + if (bonemealableBlock.isValidBonemealTarget(level, blockPos2, blockState2)) { + bonemealableBlock.performBonemeal(level, random, blockPos2, blockState2); + } } if (blockState2.isAir()) { @@ -86,7 +88,7 @@ public class GrassBlock extends SpreadingSnowyDirtBlock implements BonemealableB } @Override - public BonemealableBlock.Type getType() { - return BonemealableBlock.Type.NEIGHBOR_SPREADER; + public Type getType() { + return Type.NEIGHBOR_SPREADER; } } diff --git a/net/minecraft/world/level/block/GrindstoneBlock.java b/net/minecraft/world/level/block/GrindstoneBlock.java index d19493f7..eeb6a014 100644 --- a/net/minecraft/world/level/block/GrindstoneBlock.java +++ b/net/minecraft/world/level/block/GrindstoneBlock.java @@ -156,13 +156,12 @@ public class GrindstoneBlock extends FaceAttachedHorizontalDirectionalBlock { @Override protected InteractionResult useWithoutItem(BlockState state, Level level, BlockPos pos, Player player, BlockHitResult hitResult) { - if (level.isClientSide) { - return InteractionResult.SUCCESS; - } else { + if (!level.isClientSide) { player.openMenu(state.getMenuProvider(level, pos)); player.awardStat(Stats.INTERACT_WITH_GRINDSTONE); - return InteractionResult.CONSUME; } + + return InteractionResult.SUCCESS; } @Override diff --git a/net/minecraft/world/level/block/GrowingPlantBlock.java b/net/minecraft/world/level/block/GrowingPlantBlock.java index dd641c1e..5c9a3c48 100644 --- a/net/minecraft/world/level/block/GrowingPlantBlock.java +++ b/net/minecraft/world/level/block/GrowingPlantBlock.java @@ -7,7 +7,6 @@ import net.minecraft.server.level.ServerLevel; import net.minecraft.util.RandomSource; import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.level.BlockGetter; -import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.LevelReader; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; @@ -35,11 +34,11 @@ public abstract class GrowingPlantBlock extends Block { public BlockState getStateForPlacement(BlockPlaceContext context) { BlockState blockState = context.getLevel().getBlockState(context.getClickedPos().relative(this.growthDirection)); return !blockState.is(this.getHeadBlock()) && !blockState.is(this.getBodyBlock()) - ? this.getStateForPlacement(context.getLevel()) + ? this.getStateForPlacement(context.getLevel().random) : this.getBodyBlock().defaultBlockState(); } - public BlockState getStateForPlacement(LevelAccessor level) { + public BlockState getStateForPlacement(RandomSource randomSource) { return this.defaultBlockState(); } diff --git a/net/minecraft/world/level/block/GrowingPlantBodyBlock.java b/net/minecraft/world/level/block/GrowingPlantBodyBlock.java index 42064856..1e74bafc 100644 --- a/net/minecraft/world/level/block/GrowingPlantBodyBlock.java +++ b/net/minecraft/world/level/block/GrowingPlantBodyBlock.java @@ -11,8 +11,8 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; -import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.material.Fluids; @@ -31,20 +31,29 @@ public abstract class GrowingPlantBodyBlock extends GrowingPlantBlock implements } @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { - if (direction == this.growthDirection.getOpposite() && !state.canSurvive(level, pos)) { - level.scheduleTick(pos, this, 1); + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { + if (direction == this.growthDirection.getOpposite() && !blockState.canSurvive(levelReader, blockPos)) { + scheduledTickAccess.scheduleTick(blockPos, this, 1); } GrowingPlantHeadBlock growingPlantHeadBlock = this.getHeadBlock(); - if (direction == this.growthDirection && !neighborState.is(this) && !neighborState.is(growingPlantHeadBlock)) { - return this.updateHeadAfterConvertedFromBody(state, growingPlantHeadBlock.getStateForPlacement(level)); + if (direction == this.growthDirection && !blockState2.is(this) && !blockState2.is(growingPlantHeadBlock)) { + return this.updateHeadAfterConvertedFromBody(blockState, growingPlantHeadBlock.getStateForPlacement(randomSource)); } else { if (this.scheduleFluidTicks) { - level.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(level)); + scheduledTickAccess.scheduleTick(blockPos, Fluids.WATER, Fluids.WATER.getTickDelay(levelReader)); } - return super.updateShape(state, direction, neighborState, level, pos, neighborPos); + return super.updateShape(blockState, levelReader, scheduledTickAccess, blockPos, direction, blockPos2, blockState2, randomSource); } } diff --git a/net/minecraft/world/level/block/GrowingPlantHeadBlock.java b/net/minecraft/world/level/block/GrowingPlantHeadBlock.java index 9821ec1f..71b3f339 100644 --- a/net/minecraft/world/level/block/GrowingPlantHeadBlock.java +++ b/net/minecraft/world/level/block/GrowingPlantHeadBlock.java @@ -6,8 +6,8 @@ import net.minecraft.core.Direction; import net.minecraft.server.level.ServerLevel; import net.minecraft.util.RandomSource; import net.minecraft.world.level.Level; -import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; @@ -33,8 +33,8 @@ public abstract class GrowingPlantHeadBlock extends GrowingPlantBlock implements protected abstract MapCodec codec(); @Override - public BlockState getStateForPlacement(LevelAccessor level) { - return this.defaultBlockState().setValue(AGE, level.getRandom().nextInt(25)); + public BlockState getStateForPlacement(RandomSource randomSource) { + return this.defaultBlockState().setValue(AGE, randomSource.nextInt(25)); } @Override @@ -69,19 +69,28 @@ public abstract class GrowingPlantHeadBlock extends GrowingPlantBlock implements } @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { - if (direction == this.growthDirection.getOpposite() && !state.canSurvive(level, pos)) { - level.scheduleTick(pos, this, 1); + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { + if (direction == this.growthDirection.getOpposite() && !blockState.canSurvive(levelReader, blockPos)) { + scheduledTickAccess.scheduleTick(blockPos, this, 1); } - if (direction != this.growthDirection || !neighborState.is(this) && !neighborState.is(this.getBodyBlock())) { + if (direction != this.growthDirection || !blockState2.is(this) && !blockState2.is(this.getBodyBlock())) { if (this.scheduleFluidTicks) { - level.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(level)); + scheduledTickAccess.scheduleTick(blockPos, Fluids.WATER, Fluids.WATER.getTickDelay(levelReader)); } - return super.updateShape(state, direction, neighborState, level, pos, neighborPos); + return super.updateShape(blockState, levelReader, scheduledTickAccess, blockPos, direction, blockPos2, blockState2, randomSource); } else { - return this.updateBodyAfterConvertedFromHead(state, this.getBodyBlock().defaultBlockState()); + return this.updateBodyAfterConvertedFromHead(blockState, this.getBodyBlock().defaultBlockState()); } } diff --git a/net/minecraft/world/level/block/HangingMossBlock.java b/net/minecraft/world/level/block/HangingMossBlock.java new file mode 100644 index 00000000..fb25b00d --- /dev/null +++ b/net/minecraft/world/level/block/HangingMossBlock.java @@ -0,0 +1,133 @@ +package net.minecraft.world.level.block; + +import com.mojang.serialization.MapCodec; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.sounds.SoundSource; +import net.minecraft.util.RandomSource; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; +import net.minecraft.world.level.block.state.BlockBehaviour; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.BooleanProperty; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; + +public class HangingMossBlock extends Block implements BonemealableBlock { + public static final MapCodec CODEC = simpleCodec(HangingMossBlock::new); + private static final int SIDE_PADDING = 1; + private static final VoxelShape TIP_SHAPE = Block.box(1.0, 2.0, 1.0, 15.0, 16.0, 15.0); + private static final VoxelShape BASE_SHAPE = Block.box(1.0, 0.0, 1.0, 15.0, 16.0, 15.0); + public static final BooleanProperty TIP = BlockStateProperties.TIP; + + @Override + public MapCodec codec() { + return CODEC; + } + + public HangingMossBlock(BlockBehaviour.Properties properties) { + super(properties); + this.registerDefaultState(this.stateDefinition.any().setValue(TIP, true)); + } + + @Override + protected VoxelShape getShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext context) { + return state.getValue(TIP) ? TIP_SHAPE : BASE_SHAPE; + } + + @Override + public void animateTick(BlockState state, Level level, BlockPos pos, RandomSource random) { + if (random.nextInt(500) == 0) { + BlockState blockState = level.getBlockState(pos.above()); + if (blockState.is(Blocks.PALE_OAK_LOG) || blockState.is(Blocks.PALE_OAK_LEAVES)) { + level.playLocalSound(pos.getX(), pos.getY(), pos.getZ(), SoundEvents.PALE_HANGING_MOSS_IDLE, SoundSource.BLOCKS, 1.0F, 1.0F, false); + } + } + } + + @Override + protected boolean propagatesSkylightDown(BlockState blockState) { + return true; + } + + @Override + protected boolean canSurvive(BlockState state, LevelReader level, BlockPos pos) { + return this.canStayAtPosition(level, pos); + } + + private boolean canStayAtPosition(BlockGetter blockGetter, BlockPos blockPos) { + BlockPos blockPos2 = blockPos.relative(Direction.UP); + BlockState blockState = blockGetter.getBlockState(blockPos2); + return MultifaceBlock.canAttachTo(blockGetter, Direction.UP, blockPos2, blockState) || blockState.is(Blocks.PALE_HANGING_MOSS); + } + + @Override + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { + if (!this.canStayAtPosition(levelReader, blockPos)) { + scheduledTickAccess.scheduleTick(blockPos, this, 1); + } + + return blockState.setValue(TIP, !levelReader.getBlockState(blockPos.below()).is(this)); + } + + @Override + protected void tick(BlockState state, ServerLevel level, BlockPos pos, RandomSource random) { + if (!this.canStayAtPosition(level, pos)) { + level.destroyBlock(pos, true); + } + } + + @Override + protected void createBlockStateDefinition(StateDefinition.Builder builder) { + builder.add(TIP); + } + + @Override + public boolean isValidBonemealTarget(LevelReader level, BlockPos pos, BlockState state) { + return this.canGrowInto(level.getBlockState(this.getTip(level, pos).below())); + } + + private boolean canGrowInto(BlockState blockState) { + return blockState.isAir(); + } + + public BlockPos getTip(BlockGetter blockGetter, BlockPos blockPos) { + BlockPos.MutableBlockPos mutableBlockPos = blockPos.mutable(); + + BlockState blockState; + do { + mutableBlockPos.move(Direction.DOWN); + blockState = blockGetter.getBlockState(mutableBlockPos); + } while (blockState.is(this)); + + return mutableBlockPos.relative(Direction.UP).immutable(); + } + + @Override + public boolean isBonemealSuccess(Level level, RandomSource random, BlockPos pos, BlockState state) { + return true; + } + + @Override + public void performBonemeal(ServerLevel level, RandomSource random, BlockPos pos, BlockState state) { + BlockPos blockPos = this.getTip(level, pos).below(); + if (this.canGrowInto(level.getBlockState(blockPos))) { + level.setBlockAndUpdate(blockPos, state.setValue(TIP, true)); + } + } +} diff --git a/net/minecraft/world/level/block/HangingRootsBlock.java b/net/minecraft/world/level/block/HangingRootsBlock.java index 26b0f39a..da90fe3e 100644 --- a/net/minecraft/world/level/block/HangingRootsBlock.java +++ b/net/minecraft/world/level/block/HangingRootsBlock.java @@ -3,10 +3,11 @@ package net.minecraft.world.level.block; import com.mojang.serialization.MapCodec; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; +import net.minecraft.util.RandomSource; import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.level.BlockGetter; -import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; @@ -68,15 +69,24 @@ public class HangingRootsBlock extends Block implements SimpleWaterloggedBlock { } @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { - if (direction == Direction.UP && !this.canSurvive(state, level, pos)) { + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { + if (direction == Direction.UP && !this.canSurvive(blockState, levelReader, blockPos)) { return Blocks.AIR.defaultBlockState(); } else { - if ((Boolean)state.getValue(WATERLOGGED)) { - level.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(level)); + if ((Boolean)blockState.getValue(WATERLOGGED)) { + scheduledTickAccess.scheduleTick(blockPos, Fluids.WATER, Fluids.WATER.getTickDelay(levelReader)); } - return super.updateShape(state, direction, neighborState, level, pos, neighborPos); + return super.updateShape(blockState, levelReader, scheduledTickAccess, blockPos, direction, blockPos2, blockState2, randomSource); } } } diff --git a/net/minecraft/world/level/block/HeavyCoreBlock.java b/net/minecraft/world/level/block/HeavyCoreBlock.java index f18bbc8d..8c1dec2c 100644 --- a/net/minecraft/world/level/block/HeavyCoreBlock.java +++ b/net/minecraft/world/level/block/HeavyCoreBlock.java @@ -3,13 +3,16 @@ package net.minecraft.world.level.block; import com.mojang.serialization.MapCodec; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; +import net.minecraft.util.RandomSource; import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.level.BlockGetter; -import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.BooleanProperty; import net.minecraft.world.level.material.FluidState; import net.minecraft.world.level.material.Fluids; import net.minecraft.world.level.pathfinder.PathComputationType; @@ -19,10 +22,11 @@ import net.minecraft.world.phys.shapes.VoxelShape; public class HeavyCoreBlock extends Block implements SimpleWaterloggedBlock { public static final MapCodec CODEC = simpleCodec(HeavyCoreBlock::new); private static final VoxelShape SHAPE = Block.box(4.0, 0.0, 4.0, 12.0, 8.0, 12.0); + public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED; public HeavyCoreBlock(BlockBehaviour.Properties properties) { super(properties); - this.registerDefaultState(this.stateDefinition.any().setValue(BlockStateProperties.WATERLOGGED, false)); + this.registerDefaultState(this.stateDefinition.any().setValue(WATERLOGGED, false)); } @Override @@ -32,27 +36,36 @@ public class HeavyCoreBlock extends Block implements SimpleWaterloggedBlock { @Override protected void createBlockStateDefinition(StateDefinition.Builder builder) { - builder.add(BlockStateProperties.WATERLOGGED); + builder.add(WATERLOGGED); } @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { - if ((Boolean)state.getValue(BlockStateProperties.WATERLOGGED)) { - level.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(level)); + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { + if ((Boolean)blockState.getValue(WATERLOGGED)) { + scheduledTickAccess.scheduleTick(blockPos, Fluids.WATER, Fluids.WATER.getTickDelay(levelReader)); } - return super.updateShape(state, direction, neighborState, level, pos, neighborPos); + return super.updateShape(blockState, levelReader, scheduledTickAccess, blockPos, direction, blockPos2, blockState2, randomSource); } @Override protected FluidState getFluidState(BlockState state) { - return state.getValue(BlockStateProperties.WATERLOGGED) ? Fluids.WATER.getSource(false) : super.getFluidState(state); + return state.getValue(WATERLOGGED) ? Fluids.WATER.getSource(false) : super.getFluidState(state); } @Override public BlockState getStateForPlacement(BlockPlaceContext context) { FluidState fluidState = context.getLevel().getFluidState(context.getClickedPos()); - return this.defaultBlockState().setValue(BlockStateProperties.WATERLOGGED, fluidState.is(Fluids.WATER)); + return this.defaultBlockState().setValue(WATERLOGGED, fluidState.is(Fluids.WATER)); } @Override diff --git a/net/minecraft/world/level/block/HoneyBlock.java b/net/minecraft/world/level/block/HoneyBlock.java index 4a511ce6..3047bf42 100644 --- a/net/minecraft/world/level/block/HoneyBlock.java +++ b/net/minecraft/world/level/block/HoneyBlock.java @@ -10,8 +10,8 @@ import net.minecraft.sounds.SoundEvents; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.item.PrimedTnt; +import net.minecraft.world.entity.vehicle.AbstractBoat; import net.minecraft.world.entity.vehicle.AbstractMinecart; -import net.minecraft.world.entity.vehicle.Boat; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.state.BlockBehaviour; @@ -38,7 +38,7 @@ public class HoneyBlock extends HalfTransparentBlock { } private static boolean doesEntityDoHoneyBlockSlideEffects(Entity entity) { - return entity instanceof LivingEntity || entity instanceof AbstractMinecart || entity instanceof PrimedTnt || entity instanceof Boat; + return entity instanceof LivingEntity || entity instanceof AbstractMinecart || entity instanceof PrimedTnt || entity instanceof AbstractBoat; } @Override @@ -69,12 +69,20 @@ public class HoneyBlock extends HalfTransparentBlock { super.entityInside(state, level, pos, entity); } + private static double getOldDeltaY(double d) { + return d / 0.98F + 0.08; + } + + private static double getNewDeltaY(double d) { + return (d - 0.08) * 0.98F; + } + private boolean isSlidingDown(BlockPos pos, Entity entity) { if (entity.onGround()) { return false; } else if (entity.getY() > pos.getY() + 0.9375 - 1.0E-7) { return false; - } else if (entity.getDeltaMovement().y >= -0.08) { + } else if (getOldDeltaY(entity.getDeltaMovement().y) >= -0.08) { return false; } else { double d = Math.abs(pos.getX() + 0.5 - entity.getX()); @@ -92,11 +100,11 @@ public class HoneyBlock extends HalfTransparentBlock { private void doSlideMovement(Entity entity) { Vec3 vec3 = entity.getDeltaMovement(); - if (vec3.y < -0.13) { - double d = -0.05 / vec3.y; - entity.setDeltaMovement(new Vec3(vec3.x * d, -0.05, vec3.z * d)); + if (getOldDeltaY(entity.getDeltaMovement().y) < -0.13) { + double d = -0.05 / getOldDeltaY(entity.getDeltaMovement().y); + entity.setDeltaMovement(new Vec3(vec3.x * d, getNewDeltaY(-0.05), vec3.z * d)); } else { - entity.setDeltaMovement(new Vec3(vec3.x, -0.05, vec3.z)); + entity.setDeltaMovement(new Vec3(vec3.x, getNewDeltaY(-0.05), vec3.z)); } entity.resetFallDistance(); diff --git a/net/minecraft/world/level/block/HopperBlock.java b/net/minecraft/world/level/block/HopperBlock.java index a57ce71e..4154d74f 100644 --- a/net/minecraft/world/level/block/HopperBlock.java +++ b/net/minecraft/world/level/block/HopperBlock.java @@ -21,8 +21,9 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.block.state.properties.BooleanProperty; -import net.minecraft.world.level.block.state.properties.DirectionProperty; +import net.minecraft.world.level.block.state.properties.EnumProperty; import net.minecraft.world.level.pathfinder.PathComputationType; +import net.minecraft.world.level.redstone.Orientation; import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.shapes.BooleanOp; import net.minecraft.world.phys.shapes.CollisionContext; @@ -32,7 +33,7 @@ import org.jetbrains.annotations.Nullable; public class HopperBlock extends BaseEntityBlock { public static final MapCodec CODEC = simpleCodec(HopperBlock::new); - public static final DirectionProperty FACING = BlockStateProperties.FACING_HOPPER; + public static final EnumProperty FACING = BlockStateProperties.FACING_HOPPER; public static final BooleanProperty ENABLED = BlockStateProperties.ENABLED; private static final VoxelShape TOP = Block.box(0.0, 10.0, 0.0, 16.0, 16.0, 16.0); private static final VoxelShape FUNNEL = Block.box(4.0, 4.0, 4.0, 12.0, 10.0, 12.0); @@ -122,22 +123,17 @@ public class HopperBlock extends BaseEntityBlock { @Override protected InteractionResult useWithoutItem(BlockState state, Level level, BlockPos pos, Player player, BlockHitResult hitResult) { - if (level.isClientSide) { - return InteractionResult.SUCCESS; - } else { - BlockEntity blockEntity = level.getBlockEntity(pos); - if (blockEntity instanceof HopperBlockEntity) { - player.openMenu((HopperBlockEntity)blockEntity); - player.awardStat(Stats.INSPECT_HOPPER); - } - - return InteractionResult.CONSUME; + if (!level.isClientSide && level.getBlockEntity(pos) instanceof HopperBlockEntity hopperBlockEntity) { + player.openMenu(hopperBlockEntity); + player.awardStat(Stats.INSPECT_HOPPER); } + + return InteractionResult.SUCCESS; } @Override - protected void neighborChanged(BlockState state, Level level, BlockPos pos, Block neighborBlock, BlockPos neighborPos, boolean movedByPiston) { - this.checkPoweredState(level, pos, state); + protected void neighborChanged(BlockState blockState, Level level, BlockPos blockPos, Block block, @Nullable Orientation orientation, boolean bl) { + this.checkPoweredState(level, blockPos, blockState); } private void checkPoweredState(Level level, BlockPos pos, BlockState state) { diff --git a/net/minecraft/world/level/block/HorizontalDirectionalBlock.java b/net/minecraft/world/level/block/HorizontalDirectionalBlock.java index 8c77a213..dd2ab308 100644 --- a/net/minecraft/world/level/block/HorizontalDirectionalBlock.java +++ b/net/minecraft/world/level/block/HorizontalDirectionalBlock.java @@ -1,13 +1,14 @@ package net.minecraft.world.level.block; import com.mojang.serialization.MapCodec; +import net.minecraft.core.Direction; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.properties.BlockStateProperties; -import net.minecraft.world.level.block.state.properties.DirectionProperty; +import net.minecraft.world.level.block.state.properties.EnumProperty; public abstract class HorizontalDirectionalBlock extends Block { - public static final DirectionProperty FACING = BlockStateProperties.HORIZONTAL_FACING; + public static final EnumProperty FACING = BlockStateProperties.HORIZONTAL_FACING; protected HorizontalDirectionalBlock(BlockBehaviour.Properties properties) { super(properties); diff --git a/net/minecraft/world/level/block/HugeMushroomBlock.java b/net/minecraft/world/level/block/HugeMushroomBlock.java index 2f0eae9b..eb452650 100644 --- a/net/minecraft/world/level/block/HugeMushroomBlock.java +++ b/net/minecraft/world/level/block/HugeMushroomBlock.java @@ -4,9 +4,11 @@ import com.mojang.serialization.MapCodec; import java.util.Map; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; +import net.minecraft.util.RandomSource; import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.level.BlockGetter; -import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; @@ -49,10 +51,19 @@ public class HugeMushroomBlock extends Block { } @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { - return neighborState.is(this) - ? state.setValue((Property)PROPERTY_BY_DIRECTION.get(direction), false) - : super.updateShape(state, direction, neighborState, level, pos, neighborPos); + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { + return blockState2.is(this) + ? blockState.setValue((Property)PROPERTY_BY_DIRECTION.get(direction), false) + : super.updateShape(blockState, levelReader, scheduledTickAccess, blockPos, direction, blockPos2, blockState2, randomSource); } @Override diff --git a/net/minecraft/world/level/block/IceBlock.java b/net/minecraft/world/level/block/IceBlock.java index 90b4b8e5..1aec91ef 100644 --- a/net/minecraft/world/level/block/IceBlock.java +++ b/net/minecraft/world/level/block/IceBlock.java @@ -49,7 +49,7 @@ public class IceBlock extends HalfTransparentBlock { @Override protected void randomTick(BlockState state, ServerLevel level, BlockPos pos, RandomSource random) { - if (level.getBrightness(LightLayer.BLOCK, pos) > 11 - state.getLightBlock(level, pos)) { + if (level.getBrightness(LightLayer.BLOCK, pos) > 11 - state.getLightBlock()) { this.melt(state, level, pos); } } @@ -59,7 +59,7 @@ public class IceBlock extends HalfTransparentBlock { level.removeBlock(pos, false); } else { level.setBlockAndUpdate(pos, meltsInto()); - level.neighborChanged(pos, meltsInto().getBlock(), pos); + level.neighborChanged(pos, meltsInto().getBlock(), null); } } } diff --git a/net/minecraft/world/level/block/InfestedBlock.java b/net/minecraft/world/level/block/InfestedBlock.java index 860f2d8a..e7eecf15 100644 --- a/net/minecraft/world/level/block/InfestedBlock.java +++ b/net/minecraft/world/level/block/InfestedBlock.java @@ -9,6 +9,7 @@ import net.minecraft.core.BlockPos; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.server.level.ServerLevel; import net.minecraft.tags.EnchantmentTags; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.monster.Silverfish; import net.minecraft.world.item.ItemStack; @@ -48,7 +49,7 @@ public class InfestedBlock extends Block { } private void spawnInfestation(ServerLevel level, BlockPos pos) { - Silverfish silverfish = EntityType.SILVERFISH.create(level); + Silverfish silverfish = EntityType.SILVERFISH.create(level, EntitySpawnReason.TRIGGERED); if (silverfish != null) { silverfish.moveTo(pos.getX() + 0.5, pos.getY(), pos.getZ() + 0.5, 0.0F, 0.0F); level.addFreshEntity(silverfish); diff --git a/net/minecraft/world/level/block/IronBarsBlock.java b/net/minecraft/world/level/block/IronBarsBlock.java index ce3d6fea..4ab075b7 100644 --- a/net/minecraft/world/level/block/IronBarsBlock.java +++ b/net/minecraft/world/level/block/IronBarsBlock.java @@ -4,9 +4,11 @@ import com.mojang.serialization.MapCodec; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.tags.BlockTags; +import net.minecraft.util.RandomSource; import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.level.BlockGetter; -import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; @@ -54,16 +56,25 @@ public class IronBarsBlock extends CrossCollisionBlock { } @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { - if ((Boolean)state.getValue(WATERLOGGED)) { - level.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(level)); + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { + if ((Boolean)blockState.getValue(WATERLOGGED)) { + scheduledTickAccess.scheduleTick(blockPos, Fluids.WATER, Fluids.WATER.getTickDelay(levelReader)); } return direction.getAxis().isHorizontal() - ? state.setValue( - (Property)PROPERTY_BY_DIRECTION.get(direction), this.attachsTo(neighborState, neighborState.isFaceSturdy(level, neighborPos, direction.getOpposite())) + ? blockState.setValue( + (Property)PROPERTY_BY_DIRECTION.get(direction), this.attachsTo(blockState2, blockState2.isFaceSturdy(levelReader, blockPos2, direction.getOpposite())) ) - : super.updateShape(state, direction, neighborState, level, pos, neighborPos); + : super.updateShape(blockState, levelReader, scheduledTickAccess, blockPos, direction, blockPos2, blockState2, randomSource); } @Override diff --git a/net/minecraft/world/level/block/JigsawBlock.java b/net/minecraft/world/level/block/JigsawBlock.java index fc25da13..c90cfb3c 100644 --- a/net/minecraft/world/level/block/JigsawBlock.java +++ b/net/minecraft/world/level/block/JigsawBlock.java @@ -70,21 +70,20 @@ public class JigsawBlock extends Block implements EntityBlock, GameMasterBlock { BlockEntity blockEntity = level.getBlockEntity(pos); if (blockEntity instanceof JigsawBlockEntity && player.canUseGameMasterBlocks()) { player.openJigsawBlock((JigsawBlockEntity)blockEntity); - return InteractionResult.sidedSuccess(level.isClientSide); + return InteractionResult.SUCCESS; } else { return InteractionResult.PASS; } } - public static boolean canAttach(StructureTemplate.StructureBlockInfo info, StructureTemplate.StructureBlockInfo info2) { - Direction direction = getFrontFacing(info.state()); - Direction direction2 = getFrontFacing(info2.state()); - Direction direction3 = getTopFacing(info.state()); - Direction direction4 = getTopFacing(info2.state()); - JigsawBlockEntity.JointType jointType = (JigsawBlockEntity.JointType)JigsawBlockEntity.JointType.byName(info.nbt().getString("joint")) - .orElseGet(() -> direction.getAxis().isHorizontal() ? JigsawBlockEntity.JointType.ALIGNED : JigsawBlockEntity.JointType.ROLLABLE); + public static boolean canAttach(StructureTemplate.JigsawBlockInfo jigsawBlockInfo, StructureTemplate.JigsawBlockInfo jigsawBlockInfo2) { + Direction direction = getFrontFacing(jigsawBlockInfo.info().state()); + Direction direction2 = getFrontFacing(jigsawBlockInfo2.info().state()); + Direction direction3 = getTopFacing(jigsawBlockInfo.info().state()); + Direction direction4 = getTopFacing(jigsawBlockInfo2.info().state()); + JigsawBlockEntity.JointType jointType = jigsawBlockInfo.jointType(); boolean bl = jointType == JigsawBlockEntity.JointType.ROLLABLE; - return direction == direction2.getOpposite() && (bl || direction3 == direction4) && info.nbt().getString("target").equals(info2.nbt().getString("name")); + return direction == direction2.getOpposite() && (bl || direction3 == direction4) && jigsawBlockInfo.target().equals(jigsawBlockInfo2.name()); } /** diff --git a/net/minecraft/world/level/block/JukeboxBlock.java b/net/minecraft/world/level/block/JukeboxBlock.java index 0c35c649..8f1e0286 100644 --- a/net/minecraft/world/level/block/JukeboxBlock.java +++ b/net/minecraft/world/level/block/JukeboxBlock.java @@ -6,7 +6,6 @@ import net.minecraft.core.Direction; import net.minecraft.core.component.DataComponents; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; -import net.minecraft.world.ItemInteractionResult; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; @@ -53,22 +52,22 @@ public class JukeboxBlock extends BaseEntityBlock { protected InteractionResult useWithoutItem(BlockState state, Level level, BlockPos pos, Player player, BlockHitResult hitResult) { if ((Boolean)state.getValue(HAS_RECORD) && level.getBlockEntity(pos) instanceof JukeboxBlockEntity jukeboxBlockEntity) { jukeboxBlockEntity.popOutTheItem(); - return InteractionResult.sidedSuccess(level.isClientSide); + return InteractionResult.SUCCESS; } else { return InteractionResult.PASS; } } @Override - protected ItemInteractionResult useItemOn( - ItemStack stack, BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hitResult + protected InteractionResult useItemOn( + ItemStack itemStack, BlockState blockState, Level level, BlockPos blockPos, Player player, InteractionHand interactionHand, BlockHitResult blockHitResult ) { - if ((Boolean)state.getValue(HAS_RECORD)) { - return ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION; + if ((Boolean)blockState.getValue(HAS_RECORD)) { + return InteractionResult.TRY_WITH_EMPTY_HAND; } else { - ItemStack itemStack = player.getItemInHand(hand); - ItemInteractionResult itemInteractionResult = JukeboxPlayable.tryInsertIntoJukebox(level, pos, itemStack, player); - return !itemInteractionResult.consumesAction() ? ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION : itemInteractionResult; + ItemStack itemStack2 = player.getItemInHand(interactionHand); + InteractionResult interactionResult = JukeboxPlayable.tryInsertIntoJukebox(level, blockPos, itemStack2, player); + return (InteractionResult)(!interactionResult.consumesAction() ? InteractionResult.TRY_WITH_EMPTY_HAND : interactionResult); } } diff --git a/net/minecraft/world/level/block/LadderBlock.java b/net/minecraft/world/level/block/LadderBlock.java index f7028800..4d7fd474 100644 --- a/net/minecraft/world/level/block/LadderBlock.java +++ b/net/minecraft/world/level/block/LadderBlock.java @@ -3,16 +3,17 @@ package net.minecraft.world.level.block; import com.mojang.serialization.MapCodec; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; +import net.minecraft.util.RandomSource; import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.level.BlockGetter; -import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.block.state.properties.BooleanProperty; -import net.minecraft.world.level.block.state.properties.DirectionProperty; +import net.minecraft.world.level.block.state.properties.EnumProperty; import net.minecraft.world.level.material.FluidState; import net.minecraft.world.level.material.Fluids; import net.minecraft.world.phys.shapes.CollisionContext; @@ -21,7 +22,7 @@ import org.jetbrains.annotations.Nullable; public class LadderBlock extends Block implements SimpleWaterloggedBlock { public static final MapCodec CODEC = simpleCodec(LadderBlock::new); - public static final DirectionProperty FACING = HorizontalDirectionalBlock.FACING; + public static final EnumProperty FACING = HorizontalDirectionalBlock.FACING; public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED; protected static final float AABB_OFFSET = 3.0F; protected static final VoxelShape EAST_AABB = Block.box(0.0, 0.0, 0.0, 3.0, 16.0, 16.0); @@ -66,15 +67,24 @@ public class LadderBlock extends Block implements SimpleWaterloggedBlock { } @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { - if (direction.getOpposite() == state.getValue(FACING) && !state.canSurvive(level, pos)) { + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { + if (direction.getOpposite() == blockState.getValue(FACING) && !blockState.canSurvive(levelReader, blockPos)) { return Blocks.AIR.defaultBlockState(); } else { - if ((Boolean)state.getValue(WATERLOGGED)) { - level.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(level)); + if ((Boolean)blockState.getValue(WATERLOGGED)) { + scheduledTickAccess.scheduleTick(blockPos, Fluids.WATER, Fluids.WATER.getTickDelay(levelReader)); } - return super.updateShape(state, direction, neighborState, level, pos, neighborPos); + return super.updateShape(blockState, levelReader, scheduledTickAccess, blockPos, direction, blockPos2, blockState2, randomSource); } } diff --git a/net/minecraft/world/level/block/LanternBlock.java b/net/minecraft/world/level/block/LanternBlock.java index a96a442b..e09c54cb 100644 --- a/net/minecraft/world/level/block/LanternBlock.java +++ b/net/minecraft/world/level/block/LanternBlock.java @@ -3,10 +3,11 @@ package net.minecraft.world.level.block; import com.mojang.serialization.MapCodec; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; +import net.minecraft.util.RandomSource; import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.level.BlockGetter; -import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; @@ -75,14 +76,23 @@ public class LanternBlock extends Block implements SimpleWaterloggedBlock { } @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { - if ((Boolean)state.getValue(WATERLOGGED)) { - level.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(level)); + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { + if ((Boolean)blockState.getValue(WATERLOGGED)) { + scheduledTickAccess.scheduleTick(blockPos, Fluids.WATER, Fluids.WATER.getTickDelay(levelReader)); } - return getConnectedDirection(state).getOpposite() == direction && !state.canSurvive(level, pos) + return getConnectedDirection(blockState).getOpposite() == direction && !blockState.canSurvive(levelReader, blockPos) ? Blocks.AIR.defaultBlockState() - : super.updateShape(state, direction, neighborState, level, pos, neighborPos); + : super.updateShape(blockState, levelReader, scheduledTickAccess, blockPos, direction, blockPos2, blockState2, randomSource); } @Override diff --git a/net/minecraft/world/level/block/LayeredCauldronBlock.java b/net/minecraft/world/level/block/LayeredCauldronBlock.java index 99e51e4a..e0d74cc0 100644 --- a/net/minecraft/world/level/block/LayeredCauldronBlock.java +++ b/net/minecraft/world/level/block/LayeredCauldronBlock.java @@ -4,6 +4,7 @@ import com.mojang.serialization.MapCodec; import com.mojang.serialization.codecs.RecordCodecBuilder; import net.minecraft.core.BlockPos; import net.minecraft.core.cauldron.CauldronInteraction; +import net.minecraft.server.level.ServerLevel; import net.minecraft.world.entity.Entity; import net.minecraft.world.level.Level; import net.minecraft.world.level.biome.Biome; @@ -13,6 +14,7 @@ import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.block.state.properties.IntegerProperty; import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.level.gameevent.GameEvent.Context; import net.minecraft.world.level.material.Fluid; import net.minecraft.world.level.material.Fluids; @@ -60,9 +62,9 @@ public class LayeredCauldronBlock extends AbstractCauldronBlock { @Override protected void entityInside(BlockState state, Level level, BlockPos pos, Entity entity) { - if (!level.isClientSide && entity.isOnFire() && this.isEntityInsideContent(state, pos, entity)) { + if (level instanceof ServerLevel serverLevel && entity.isOnFire() && this.isEntityInsideContent(state, pos, entity)) { entity.clearFire(); - if (entity.mayInteract(level, pos)) { + if (entity.mayInteract(serverLevel, pos)) { this.handleEntityOnFireInside(state, level, pos); } } @@ -80,7 +82,7 @@ public class LayeredCauldronBlock extends AbstractCauldronBlock { int i = (Integer)state.getValue(LEVEL) - 1; BlockState blockState = i == 0 ? Blocks.CAULDRON.defaultBlockState() : state.setValue(LEVEL, i); level.setBlockAndUpdate(pos, blockState); - level.gameEvent(GameEvent.BLOCK_CHANGE, pos, GameEvent.Context.of(blockState)); + level.gameEvent(GameEvent.BLOCK_CHANGE, pos, Context.of(blockState)); } @Override @@ -88,7 +90,7 @@ public class LayeredCauldronBlock extends AbstractCauldronBlock { if (CauldronBlock.shouldHandlePrecipitation(level, precipitation) && (Integer)state.getValue(LEVEL) != 3 && precipitation == this.precipitationType) { BlockState blockState = state.cycle(LEVEL); level.setBlockAndUpdate(pos, blockState); - level.gameEvent(GameEvent.BLOCK_CHANGE, pos, GameEvent.Context.of(blockState)); + level.gameEvent(GameEvent.BLOCK_CHANGE, pos, Context.of(blockState)); } } @@ -107,7 +109,7 @@ public class LayeredCauldronBlock extends AbstractCauldronBlock { if (!this.isFull(state)) { BlockState blockState = state.setValue(LEVEL, (Integer)state.getValue(LEVEL) + 1); level.setBlockAndUpdate(pos, blockState); - level.gameEvent(GameEvent.BLOCK_CHANGE, pos, GameEvent.Context.of(blockState)); + level.gameEvent(GameEvent.BLOCK_CHANGE, pos, Context.of(blockState)); level.levelEvent(1047, pos, 0); } } diff --git a/net/minecraft/world/level/block/LeavesBlock.java b/net/minecraft/world/level/block/LeavesBlock.java index f9e60fef..ae91fb7e 100644 --- a/net/minecraft/world/level/block/LeavesBlock.java +++ b/net/minecraft/world/level/block/LeavesBlock.java @@ -13,6 +13,8 @@ import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; @@ -70,22 +72,31 @@ public class LeavesBlock extends Block implements SimpleWaterloggedBlock { } @Override - protected int getLightBlock(BlockState state, BlockGetter level, BlockPos pos) { + protected int getLightBlock(BlockState blockState) { return 1; } @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { - if ((Boolean)state.getValue(WATERLOGGED)) { - level.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(level)); + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { + if ((Boolean)blockState.getValue(WATERLOGGED)) { + scheduledTickAccess.scheduleTick(blockPos, Fluids.WATER, Fluids.WATER.getTickDelay(levelReader)); } - int i = getDistanceAt(neighborState) + 1; - if (i != 1 || (Integer)state.getValue(DISTANCE) != i) { - level.scheduleTick(pos, this, 1); + int i = getDistanceAt(blockState2) + 1; + if (i != 1 || (Integer)blockState.getValue(DISTANCE) != i) { + scheduledTickAccess.scheduleTick(blockPos, this, 1); } - return state; + return blockState; } private static BlockState updateDistance(BlockState state, LevelAccessor level, BlockPos pos) { diff --git a/net/minecraft/world/level/block/LecternBlock.java b/net/minecraft/world/level/block/LecternBlock.java index a788b857..ec923398 100644 --- a/net/minecraft/world/level/block/LecternBlock.java +++ b/net/minecraft/world/level/block/LecternBlock.java @@ -12,7 +12,6 @@ import net.minecraft.tags.ItemTags; import net.minecraft.util.RandomSource; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; -import net.minecraft.world.ItemInteractionResult; import net.minecraft.world.MenuProvider; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.LivingEntity; @@ -30,9 +29,12 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.block.state.properties.BooleanProperty; -import net.minecraft.world.level.block.state.properties.DirectionProperty; +import net.minecraft.world.level.block.state.properties.EnumProperty; import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.level.gameevent.GameEvent.Context; import net.minecraft.world.level.pathfinder.PathComputationType; +import net.minecraft.world.level.redstone.ExperimentalRedstoneUtils; +import net.minecraft.world.level.redstone.Orientation; import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.Shapes; @@ -41,7 +43,7 @@ import org.jetbrains.annotations.Nullable; public class LecternBlock extends BaseEntityBlock { public static final MapCodec CODEC = simpleCodec(LecternBlock::new); - public static final DirectionProperty FACING = HorizontalDirectionalBlock.FACING; + public static final EnumProperty FACING = HorizontalDirectionalBlock.FACING; public static final BooleanProperty POWERED = BlockStateProperties.POWERED; public static final BooleanProperty HAS_BOOK = BlockStateProperties.HAS_BOOK; public static final VoxelShape SHAPE_BASE = Block.box(0.0, 0.0, 0.0, 16.0, 2.0, 16.0); @@ -91,7 +93,7 @@ public class LecternBlock extends BaseEntityBlock { } @Override - protected VoxelShape getOcclusionShape(BlockState state, BlockGetter level, BlockPos pos) { + protected VoxelShape getOcclusionShape(BlockState blockState) { return SHAPE_COMMON; } @@ -180,7 +182,7 @@ public class LecternBlock extends BaseEntityBlock { public static void resetBookState(@Nullable Entity entity, Level level, BlockPos pos, BlockState state, boolean hasBook) { BlockState blockState = state.setValue(POWERED, false).setValue(HAS_BOOK, hasBook); level.setBlock(pos, blockState, 3); - level.gameEvent(GameEvent.BLOCK_CHANGE, pos, GameEvent.Context.of(entity, blockState)); + level.gameEvent(GameEvent.BLOCK_CHANGE, pos, Context.of(entity, blockState)); updateBelow(level, pos, state); } @@ -196,7 +198,8 @@ public class LecternBlock extends BaseEntityBlock { } private static void updateBelow(Level level, BlockPos pos, BlockState state) { - level.updateNeighborsAt(pos.below(), state.getBlock()); + Orientation orientation = ExperimentalRedstoneUtils.initialOrientation(level, ((Direction)state.getValue(FACING)).getOpposite(), Direction.UP); + level.updateNeighborsAt(pos.below(), state.getBlock(), orientation); } @Override @@ -213,7 +216,7 @@ public class LecternBlock extends BaseEntityBlock { super.onRemove(state, level, pos, newState, movedByPiston); if ((Boolean)state.getValue(POWERED)) { - level.updateNeighborsAt(pos.below(), this); + updateBelow(level, pos, state); } } } @@ -264,19 +267,17 @@ public class LecternBlock extends BaseEntityBlock { } @Override - protected ItemInteractionResult useItemOn( - ItemStack stack, BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hitResult + protected InteractionResult useItemOn( + ItemStack itemStack, BlockState blockState, Level level, BlockPos blockPos, Player player, InteractionHand interactionHand, BlockHitResult blockHitResult ) { - if ((Boolean)state.getValue(HAS_BOOK)) { - return ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION; - } else if (stack.is(ItemTags.LECTERN_BOOKS)) { - return tryPlaceBook(player, level, pos, state, stack) - ? ItemInteractionResult.sidedSuccess(level.isClientSide) - : ItemInteractionResult.SKIP_DEFAULT_BLOCK_INTERACTION; + if ((Boolean)blockState.getValue(HAS_BOOK)) { + return InteractionResult.TRY_WITH_EMPTY_HAND; + } else if (itemStack.is(ItemTags.LECTERN_BOOKS)) { + return (InteractionResult)(tryPlaceBook(player, level, blockPos, blockState, itemStack) ? InteractionResult.SUCCESS : InteractionResult.PASS); } else { - return stack.isEmpty() && hand == InteractionHand.MAIN_HAND - ? ItemInteractionResult.SKIP_DEFAULT_BLOCK_INTERACTION - : ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION; + return (InteractionResult)(itemStack.isEmpty() && interactionHand == InteractionHand.MAIN_HAND + ? InteractionResult.PASS + : InteractionResult.TRY_WITH_EMPTY_HAND); } } @@ -287,7 +288,7 @@ public class LecternBlock extends BaseEntityBlock { this.openScreen(level, pos, player); } - return InteractionResult.sidedSuccess(level.isClientSide); + return InteractionResult.SUCCESS; } else { return InteractionResult.CONSUME; } diff --git a/net/minecraft/world/level/block/LeverBlock.java b/net/minecraft/world/level/block/LeverBlock.java index 42159856..e67f5a1d 100644 --- a/net/minecraft/world/level/block/LeverBlock.java +++ b/net/minecraft/world/level/block/LeverBlock.java @@ -5,6 +5,7 @@ import java.util.function.BiConsumer; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.particles.DustParticleOptions; +import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; import net.minecraft.util.RandomSource; @@ -22,6 +23,8 @@ import net.minecraft.world.level.block.state.properties.AttachFace; import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.block.state.properties.BooleanProperty; import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.level.redstone.ExperimentalRedstoneUtils; +import net.minecraft.world.level.redstone.Orientation; import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.VoxelShape; @@ -94,21 +97,22 @@ public class LeverBlock extends FaceAttachedHorizontalDirectionalBlock { if ((Boolean)blockState.getValue(POWERED)) { makeParticle(blockState, level, pos, 1.0F); } - - return InteractionResult.SUCCESS; } else { this.pull(state, level, pos, null); - return InteractionResult.CONSUME; } + + return InteractionResult.SUCCESS; } @Override - protected void onExplosionHit(BlockState state, Level level, BlockPos pos, Explosion explosion, BiConsumer dropConsumer) { + protected void onExplosionHit( + BlockState blockState, ServerLevel serverLevel, BlockPos blockPos, Explosion explosion, BiConsumer biConsumer + ) { if (explosion.canTriggerBlocks()) { - this.pull(state, level, pos, null); + this.pull(blockState, serverLevel, blockPos, null); } - super.onExplosionHit(state, level, pos, explosion, dropConsumer); + super.onExplosionHit(blockState, serverLevel, blockPos, explosion, biConsumer); } public void pull(BlockState state, Level level, BlockPos pos, @Nullable Player player) { @@ -130,7 +134,7 @@ public class LeverBlock extends FaceAttachedHorizontalDirectionalBlock { double d = pos.getX() + 0.5 + 0.1 * direction.getStepX() + 0.2 * direction2.getStepX(); double e = pos.getY() + 0.5 + 0.1 * direction.getStepY() + 0.2 * direction2.getStepY(); double f = pos.getZ() + 0.5 + 0.1 * direction.getStepZ() + 0.2 * direction2.getStepZ(); - level.addParticle(new DustParticleOptions(DustParticleOptions.REDSTONE_PARTICLE_COLOR, alpha), d, e, f, 0.0, 0.0, 0.0); + level.addParticle(new DustParticleOptions(16711680, alpha), d, e, f, 0.0, 0.0, 0.0); } @Override @@ -167,8 +171,12 @@ public class LeverBlock extends FaceAttachedHorizontalDirectionalBlock { } private void updateNeighbours(BlockState state, Level level, BlockPos pos) { - level.updateNeighborsAt(pos, this); - level.updateNeighborsAt(pos.relative(getConnectedDirection(state).getOpposite()), this); + Direction direction = getConnectedDirection(state).getOpposite(); + Orientation orientation = ExperimentalRedstoneUtils.initialOrientation( + level, direction, direction.getAxis().isHorizontal() ? Direction.UP : state.getValue(FACING) + ); + level.updateNeighborsAt(pos, this, orientation); + level.updateNeighborsAt(pos.relative(direction), this, orientation); } @Override diff --git a/net/minecraft/world/level/block/LightBlock.java b/net/minecraft/world/level/block/LightBlock.java index 761395ae..5b233185 100644 --- a/net/minecraft/world/level/block/LightBlock.java +++ b/net/minecraft/world/level/block/LightBlock.java @@ -5,6 +5,7 @@ import java.util.function.ToIntFunction; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.component.DataComponents; +import net.minecraft.util.RandomSource; import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; @@ -12,8 +13,8 @@ import net.minecraft.world.item.Items; import net.minecraft.world.item.component.BlockItemStateProperties; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; -import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; @@ -53,7 +54,7 @@ public class LightBlock extends Block implements SimpleWaterloggedBlock { protected InteractionResult useWithoutItem(BlockState state, Level level, BlockPos pos, Player player, BlockHitResult hitResult) { if (!level.isClientSide && player.canUseGameMasterBlocks()) { level.setBlock(pos, state.cycle(LEVEL), 2); - return InteractionResult.SUCCESS; + return InteractionResult.SUCCESS_SERVER; } else { return InteractionResult.CONSUME; } @@ -65,8 +66,8 @@ public class LightBlock extends Block implements SimpleWaterloggedBlock { } @Override - protected boolean propagatesSkylightDown(BlockState state, BlockGetter level, BlockPos pos) { - return state.getFluidState().isEmpty(); + protected boolean propagatesSkylightDown(BlockState blockState) { + return blockState.getFluidState().isEmpty(); } @Override @@ -80,12 +81,21 @@ public class LightBlock extends Block implements SimpleWaterloggedBlock { } @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { - if ((Boolean)state.getValue(WATERLOGGED)) { - level.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(level)); + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { + if ((Boolean)blockState.getValue(WATERLOGGED)) { + scheduledTickAccess.scheduleTick(blockPos, Fluids.WATER, Fluids.WATER.getTickDelay(levelReader)); } - return super.updateShape(state, direction, neighborState, level, pos, neighborPos); + return super.updateShape(blockState, levelReader, scheduledTickAccess, blockPos, direction, blockPos2, blockState2, randomSource); } @Override diff --git a/net/minecraft/world/level/block/LightningRodBlock.java b/net/minecraft/world/level/block/LightningRodBlock.java index 097f30db..7d0f21f5 100644 --- a/net/minecraft/world/level/block/LightningRodBlock.java +++ b/net/minecraft/world/level/block/LightningRodBlock.java @@ -11,7 +11,8 @@ import net.minecraft.util.valueproviders.UniformInt; import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; -import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; @@ -20,6 +21,7 @@ import net.minecraft.world.level.block.state.properties.BooleanProperty; import net.minecraft.world.level.levelgen.Heightmap; import net.minecraft.world.level.material.FluidState; import net.minecraft.world.level.material.Fluids; +import net.minecraft.world.level.redstone.ExperimentalRedstoneUtils; public class LightningRodBlock extends RodBlock implements SimpleWaterloggedBlock { public static final MapCodec CODEC = simpleCodec(LightningRodBlock::new); @@ -47,12 +49,21 @@ public class LightningRodBlock extends RodBlock implements SimpleWaterloggedBloc } @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { - if ((Boolean)state.getValue(WATERLOGGED)) { - level.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(level)); + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { + if ((Boolean)blockState.getValue(WATERLOGGED)) { + scheduledTickAccess.scheduleTick(blockPos, Fluids.WATER, Fluids.WATER.getTickDelay(levelReader)); } - return super.updateShape(state, direction, neighborState, level, pos, neighborPos); + return super.updateShape(blockState, levelReader, scheduledTickAccess, blockPos, direction, blockPos2, blockState2, randomSource); } @Override @@ -78,7 +89,8 @@ public class LightningRodBlock extends RodBlock implements SimpleWaterloggedBloc } private void updateNeighbours(BlockState state, Level level, BlockPos pos) { - level.updateNeighborsAt(pos.relative(((Direction)state.getValue(FACING)).getOpposite()), this); + Direction direction = ((Direction)state.getValue(FACING)).getOpposite(); + level.updateNeighborsAt(pos.relative(direction), this, ExperimentalRedstoneUtils.initialOrientation(level, direction, null)); } @Override diff --git a/net/minecraft/world/level/block/LiquidBlock.java b/net/minecraft/world/level/block/LiquidBlock.java index 50f7561a..97dabf79 100644 --- a/net/minecraft/world/level/block/LiquidBlock.java +++ b/net/minecraft/world/level/block/LiquidBlock.java @@ -21,6 +21,8 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; @@ -29,6 +31,7 @@ import net.minecraft.world.level.block.state.properties.IntegerProperty; import net.minecraft.world.level.material.FlowingFluid; import net.minecraft.world.level.material.FluidState; import net.minecraft.world.level.pathfinder.PathComputationType; +import net.minecraft.world.level.redstone.Orientation; import net.minecraft.world.level.storage.loot.LootParams; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.Shapes; @@ -92,7 +95,7 @@ public class LiquidBlock extends Block implements BucketPickup { } @Override - protected boolean propagatesSkylightDown(BlockState state, BlockGetter level, BlockPos pos) { + protected boolean propagatesSkylightDown(BlockState blockState) { return false; } @@ -135,18 +138,27 @@ public class LiquidBlock extends Block implements BucketPickup { } @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { - if (state.getFluidState().isSource() || neighborState.getFluidState().isSource()) { - level.scheduleTick(pos, state.getFluidState().getType(), this.fluid.getTickDelay(level)); + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { + if (blockState.getFluidState().isSource() || blockState2.getFluidState().isSource()) { + scheduledTickAccess.scheduleTick(blockPos, blockState.getFluidState().getType(), this.fluid.getTickDelay(levelReader)); } - return super.updateShape(state, direction, neighborState, level, pos, neighborPos); + return super.updateShape(blockState, levelReader, scheduledTickAccess, blockPos, direction, blockPos2, blockState2, randomSource); } @Override - protected void neighborChanged(BlockState state, Level level, BlockPos pos, Block neighborBlock, BlockPos neighborPos, boolean movedByPiston) { - if (this.shouldSpreadLiquid(level, pos, state)) { - level.scheduleTick(pos, state.getFluidState().getType(), this.fluid.getTickDelay(level)); + protected void neighborChanged(BlockState blockState, Level level, BlockPos blockPos, Block block, @Nullable Orientation orientation, boolean bl) { + if (this.shouldSpreadLiquid(level, blockPos, blockState)) { + level.scheduleTick(blockPos, blockState.getFluidState().getType(), this.fluid.getTickDelay(level)); } } diff --git a/net/minecraft/world/level/block/LoomBlock.java b/net/minecraft/world/level/block/LoomBlock.java index 5b8004f2..d729c35b 100644 --- a/net/minecraft/world/level/block/LoomBlock.java +++ b/net/minecraft/world/level/block/LoomBlock.java @@ -32,13 +32,12 @@ public class LoomBlock extends HorizontalDirectionalBlock { @Override protected InteractionResult useWithoutItem(BlockState state, Level level, BlockPos pos, Player player, BlockHitResult hitResult) { - if (level.isClientSide) { - return InteractionResult.SUCCESS; - } else { + if (!level.isClientSide) { player.openMenu(state.getMenuProvider(level, pos)); player.awardStat(Stats.INTERACT_WITH_LOOM); - return InteractionResult.CONSUME; } + + return InteractionResult.SUCCESS; } @Override diff --git a/net/minecraft/world/level/block/MagmaBlock.java b/net/minecraft/world/level/block/MagmaBlock.java index 257b16d5..316269c5 100644 --- a/net/minecraft/world/level/block/MagmaBlock.java +++ b/net/minecraft/world/level/block/MagmaBlock.java @@ -8,7 +8,8 @@ import net.minecraft.util.RandomSource; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.level.Level; -import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; @@ -40,12 +41,21 @@ public class MagmaBlock extends Block { } @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { - if (direction == Direction.UP && neighborState.is(Blocks.WATER)) { - level.scheduleTick(pos, this, 20); + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { + if (direction == Direction.UP && blockState2.is(Blocks.WATER)) { + scheduledTickAccess.scheduleTick(blockPos, this, 20); } - return super.updateShape(state, direction, neighborState, level, pos, neighborPos); + return super.updateShape(blockState, levelReader, scheduledTickAccess, blockPos, direction, blockPos2, blockState2, randomSource); } @Override diff --git a/net/minecraft/world/level/block/MangrovePropaguleBlock.java b/net/minecraft/world/level/block/MangrovePropaguleBlock.java index 3c16b6c8..f29da892 100644 --- a/net/minecraft/world/level/block/MangrovePropaguleBlock.java +++ b/net/minecraft/world/level/block/MangrovePropaguleBlock.java @@ -9,8 +9,8 @@ import net.minecraft.util.RandomSource; import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; -import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.grower.TreeGrower; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; @@ -72,7 +72,7 @@ public class MangrovePropaguleBlock extends SaplingBlock implements SimpleWaterl @Override protected VoxelShape getShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext context) { - Vec3 vec3 = state.getOffset(level, pos); + Vec3 vec3 = state.getOffset(pos); VoxelShape voxelShape; if (!(Boolean)state.getValue(HANGING)) { voxelShape = SHAPE_PER_AGE[4]; @@ -89,14 +89,23 @@ public class MangrovePropaguleBlock extends SaplingBlock implements SimpleWaterl } @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { - if ((Boolean)state.getValue(WATERLOGGED)) { - level.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(level)); + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { + if ((Boolean)blockState.getValue(WATERLOGGED)) { + scheduledTickAccess.scheduleTick(blockPos, Fluids.WATER, Fluids.WATER.getTickDelay(levelReader)); } - return direction == Direction.UP && !state.canSurvive(level, pos) + return direction == Direction.UP && !blockState.canSurvive(levelReader, blockPos) ? Blocks.AIR.defaultBlockState() - : super.updateShape(state, direction, neighborState, level, pos, neighborPos); + : super.updateShape(blockState, levelReader, scheduledTickAccess, blockPos, direction, blockPos2, blockState2, randomSource); } @Override diff --git a/net/minecraft/world/level/block/MangroveRootsBlock.java b/net/minecraft/world/level/block/MangroveRootsBlock.java index 9b97fad5..62a905ff 100644 --- a/net/minecraft/world/level/block/MangroveRootsBlock.java +++ b/net/minecraft/world/level/block/MangroveRootsBlock.java @@ -3,8 +3,10 @@ package net.minecraft.world.level.block; import com.mojang.serialization.MapCodec; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; +import net.minecraft.util.RandomSource; import net.minecraft.world.item.context.BlockPlaceContext; -import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; @@ -42,12 +44,21 @@ public class MangroveRootsBlock extends Block implements SimpleWaterloggedBlock } @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { - if ((Boolean)state.getValue(WATERLOGGED)) { - level.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(level)); + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { + if ((Boolean)blockState.getValue(WATERLOGGED)) { + scheduledTickAccess.scheduleTick(blockPos, Fluids.WATER, Fluids.WATER.getTickDelay(levelReader)); } - return super.updateShape(state, direction, neighborState, level, pos, neighborPos); + return super.updateShape(blockState, levelReader, scheduledTickAccess, blockPos, direction, blockPos2, blockState2, randomSource); } @Override diff --git a/net/minecraft/world/level/block/MossyCarpetBlock.java b/net/minecraft/world/level/block/MossyCarpetBlock.java new file mode 100644 index 00000000..73bf52b5 --- /dev/null +++ b/net/minecraft/world/level/block/MossyCarpetBlock.java @@ -0,0 +1,323 @@ +package net.minecraft.world.level.block; + +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.Maps; +import com.mojang.serialization.MapCodec; +import java.util.Map; +import java.util.function.BooleanSupplier; +import java.util.function.Function; +import java.util.stream.Collectors; +import net.minecraft.Util; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.util.RandomSource; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; +import net.minecraft.world.level.block.state.BlockBehaviour; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.BooleanProperty; +import net.minecraft.world.level.block.state.properties.EnumProperty; +import net.minecraft.world.level.block.state.properties.WallSide; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.Shapes; +import net.minecraft.world.phys.shapes.VoxelShape; +import org.jetbrains.annotations.Nullable; + +public class MossyCarpetBlock extends Block implements BonemealableBlock { + public static final MapCodec CODEC = simpleCodec(MossyCarpetBlock::new); + public static final BooleanProperty BASE = BlockStateProperties.BOTTOM; + private static final EnumProperty NORTH = BlockStateProperties.NORTH_WALL; + private static final EnumProperty EAST = BlockStateProperties.EAST_WALL; + private static final EnumProperty SOUTH = BlockStateProperties.SOUTH_WALL; + private static final EnumProperty WEST = BlockStateProperties.WEST_WALL; + private static final Map> PROPERTY_BY_DIRECTION = ImmutableMap.copyOf( + Util.make(Maps.newEnumMap(Direction.class), enumMap -> { + enumMap.put(Direction.NORTH, NORTH); + enumMap.put(Direction.EAST, EAST); + enumMap.put(Direction.SOUTH, SOUTH); + enumMap.put(Direction.WEST, WEST); + }) + ); + private static final float AABB_OFFSET = 1.0F; + private static final VoxelShape DOWN_AABB = Block.box(0.0, 0.0, 0.0, 16.0, 1.0, 16.0); + private static final VoxelShape WEST_AABB = Block.box(0.0, 0.0, 0.0, 1.0, 16.0, 16.0); + private static final VoxelShape EAST_AABB = Block.box(15.0, 0.0, 0.0, 16.0, 16.0, 16.0); + private static final VoxelShape NORTH_AABB = Block.box(0.0, 0.0, 0.0, 16.0, 16.0, 1.0); + private static final VoxelShape SOUTH_AABB = Block.box(0.0, 0.0, 15.0, 16.0, 16.0, 16.0); + private static final int SHORT_HEIGHT = 10; + private static final VoxelShape WEST_SHORT_AABB = Block.box(0.0, 0.0, 0.0, 1.0, 10.0, 16.0); + private static final VoxelShape EAST_SHORT_AABB = Block.box(15.0, 0.0, 0.0, 16.0, 10.0, 16.0); + private static final VoxelShape NORTH_SHORT_AABB = Block.box(0.0, 0.0, 0.0, 16.0, 10.0, 1.0); + private static final VoxelShape SOUTH_SHORT_AABB = Block.box(0.0, 0.0, 15.0, 16.0, 10.0, 16.0); + private final Map shapesCache; + + @Override + public MapCodec codec() { + return CODEC; + } + + public MossyCarpetBlock(BlockBehaviour.Properties properties) { + super(properties); + this.registerDefaultState( + this.stateDefinition + .any() + .setValue(BASE, true) + .setValue(NORTH, WallSide.NONE) + .setValue(EAST, WallSide.NONE) + .setValue(SOUTH, WallSide.NONE) + .setValue(WEST, WallSide.NONE) + ); + this.shapesCache = ImmutableMap.copyOf( + (Map)this.stateDefinition + .getPossibleStates() + .stream() + .collect(Collectors.toMap(Function.identity(), MossyCarpetBlock::calculateShape)) + ); + } + + @Override + protected VoxelShape getOcclusionShape(BlockState blockState) { + return Shapes.empty(); + } + + private static VoxelShape calculateShape(BlockState blockState) { + VoxelShape voxelShape = Shapes.empty(); + if ((Boolean)blockState.getValue(BASE)) { + voxelShape = DOWN_AABB; + } + voxelShape = switch ((WallSide)blockState.getValue(NORTH)) { + case NONE -> voxelShape; + case LOW -> Shapes.or(voxelShape, NORTH_SHORT_AABB); + case TALL -> Shapes.or(voxelShape, NORTH_AABB); + }; + + voxelShape = switch ((WallSide)blockState.getValue(SOUTH)) { + case NONE -> voxelShape; + case LOW -> Shapes.or(voxelShape, SOUTH_SHORT_AABB); + case TALL -> Shapes.or(voxelShape, SOUTH_AABB); + }; + + voxelShape = switch ((WallSide)blockState.getValue(EAST)) { + case NONE -> voxelShape; + case LOW -> Shapes.or(voxelShape, EAST_SHORT_AABB); + case TALL -> Shapes.or(voxelShape, EAST_AABB); + }; + + voxelShape = switch ((WallSide)blockState.getValue(WEST)) { + case NONE -> voxelShape; + case LOW -> Shapes.or(voxelShape, WEST_SHORT_AABB); + case TALL -> Shapes.or(voxelShape, WEST_AABB); + }; + return voxelShape.isEmpty() ? Shapes.block() : voxelShape; + } + + @Override + protected VoxelShape getShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext context) { + return (VoxelShape)this.shapesCache.get(state); + } + + @Override + protected VoxelShape getCollisionShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext context) { + return state.getValue(BASE) ? DOWN_AABB : Shapes.empty(); + } + + @Override + protected boolean propagatesSkylightDown(BlockState blockState) { + return true; + } + + @Override + protected boolean canSurvive(BlockState state, LevelReader level, BlockPos pos) { + BlockState blockState = level.getBlockState(pos.below()); + return state.getValue(BASE) ? !blockState.isAir() : blockState.is(this) && (Boolean)blockState.getValue(BASE); + } + + private static boolean hasFaces(BlockState blockState) { + if ((Boolean)blockState.getValue(BASE)) { + return true; + } else { + for (EnumProperty enumProperty : PROPERTY_BY_DIRECTION.values()) { + if (blockState.getValue(enumProperty) != WallSide.NONE) { + return true; + } + } + + return false; + } + } + + private static boolean canSupportAtFace(BlockGetter blockGetter, BlockPos blockPos, Direction direction) { + if (direction == Direction.UP) { + return false; + } else { + BlockPos blockPos2 = blockPos.relative(direction); + return MultifaceBlock.canAttachTo(blockGetter, direction, blockPos2, blockGetter.getBlockState(blockPos2)); + } + } + + private static BlockState getUpdatedState(BlockState blockState, BlockGetter blockGetter, BlockPos blockPos, boolean bl) { + BlockState blockState2 = null; + BlockState blockState3 = null; + bl |= blockState.getValue(BASE); + + for (Direction direction : Direction.Plane.HORIZONTAL) { + EnumProperty enumProperty = getPropertyForFace(direction); + WallSide wallSide = canSupportAtFace(blockGetter, blockPos, direction) ? (bl ? WallSide.LOW : blockState.getValue(enumProperty)) : WallSide.NONE; + if (wallSide == WallSide.LOW) { + if (blockState2 == null) { + blockState2 = blockGetter.getBlockState(blockPos.above()); + } + + if (blockState2.is(Blocks.PALE_MOSS_CARPET) && blockState2.getValue(enumProperty) != WallSide.NONE && !(Boolean)blockState2.getValue(BASE)) { + wallSide = WallSide.TALL; + } + + if (!(Boolean)blockState.getValue(BASE)) { + if (blockState3 == null) { + blockState3 = blockGetter.getBlockState(blockPos.below()); + } + + if (blockState3.is(Blocks.PALE_MOSS_CARPET) && blockState3.getValue(enumProperty) == WallSide.NONE) { + wallSide = WallSide.NONE; + } + } + } + + blockState = blockState.setValue(enumProperty, wallSide); + } + + return blockState; + } + + @Nullable + @Override + public BlockState getStateForPlacement(BlockPlaceContext context) { + return getUpdatedState(this.defaultBlockState(), context.getLevel(), context.getClickedPos(), true); + } + + public static void placeAt(LevelAccessor levelAccessor, BlockPos blockPos, RandomSource randomSource, int i) { + BlockState blockState = Blocks.PALE_MOSS_CARPET.defaultBlockState(); + BlockState blockState2 = getUpdatedState(blockState, levelAccessor, blockPos, true); + levelAccessor.setBlock(blockPos, blockState2, 3); + BlockState blockState3 = createTopperWithSideChance(levelAccessor, blockPos, randomSource::nextBoolean); + if (!blockState3.isAir()) { + levelAccessor.setBlock(blockPos.above(), blockState3, i); + } + } + + @Override + public void setPlacedBy(Level level, BlockPos pos, BlockState state, @Nullable LivingEntity placer, ItemStack stack) { + if (!level.isClientSide) { + RandomSource randomSource = level.getRandom(); + BlockState blockState = createTopperWithSideChance(level, pos, randomSource::nextBoolean); + if (!blockState.isAir()) { + level.setBlock(pos.above(), blockState, 3); + } + } + } + + private static BlockState createTopperWithSideChance(BlockGetter blockGetter, BlockPos blockPos, BooleanSupplier booleanSupplier) { + BlockPos blockPos2 = blockPos.above(); + BlockState blockState = blockGetter.getBlockState(blockPos2); + boolean bl = blockState.is(Blocks.PALE_MOSS_CARPET); + if ((!bl || !(Boolean)blockState.getValue(BASE)) && (bl || blockState.canBeReplaced())) { + BlockState blockState2 = Blocks.PALE_MOSS_CARPET.defaultBlockState().setValue(BASE, false); + BlockState blockState3 = getUpdatedState(blockState2, blockGetter, blockPos.above(), true); + + for (Direction direction : Direction.Plane.HORIZONTAL) { + EnumProperty enumProperty = getPropertyForFace(direction); + if (blockState3.getValue(enumProperty) != WallSide.NONE && !booleanSupplier.getAsBoolean()) { + blockState3 = blockState3.setValue(enumProperty, WallSide.NONE); + } + } + + return hasFaces(blockState3) && blockState3 != blockState ? blockState3 : Blocks.AIR.defaultBlockState(); + } else { + return Blocks.AIR.defaultBlockState(); + } + } + + @Override + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { + if (!blockState.canSurvive(levelReader, blockPos)) { + return Blocks.AIR.defaultBlockState(); + } else { + BlockState blockState3 = getUpdatedState(blockState, levelReader, blockPos, false); + return !hasFaces(blockState3) ? Blocks.AIR.defaultBlockState() : blockState3; + } + } + + @Override + protected void createBlockStateDefinition(StateDefinition.Builder builder) { + builder.add(BASE, NORTH, EAST, SOUTH, WEST); + } + + @Override + protected BlockState rotate(BlockState state, Rotation rotation) { + return switch (rotation) { + case CLOCKWISE_180 -> (BlockState)state.setValue(NORTH, (WallSide)state.getValue(SOUTH)) + .setValue(EAST, (WallSide)state.getValue(WEST)) + .setValue(SOUTH, (WallSide)state.getValue(NORTH)) + .setValue(WEST, (WallSide)state.getValue(EAST)); + case COUNTERCLOCKWISE_90 -> (BlockState)state.setValue(NORTH, (WallSide)state.getValue(EAST)) + .setValue(EAST, (WallSide)state.getValue(SOUTH)) + .setValue(SOUTH, (WallSide)state.getValue(WEST)) + .setValue(WEST, (WallSide)state.getValue(NORTH)); + case CLOCKWISE_90 -> (BlockState)state.setValue(NORTH, (WallSide)state.getValue(WEST)) + .setValue(EAST, (WallSide)state.getValue(NORTH)) + .setValue(SOUTH, (WallSide)state.getValue(EAST)) + .setValue(WEST, (WallSide)state.getValue(SOUTH)); + default -> state; + }; + } + + @Override + protected BlockState mirror(BlockState state, Mirror mirror) { + return switch (mirror) { + case LEFT_RIGHT -> (BlockState)state.setValue(NORTH, (WallSide)state.getValue(SOUTH)).setValue(SOUTH, (WallSide)state.getValue(NORTH)); + case FRONT_BACK -> (BlockState)state.setValue(EAST, (WallSide)state.getValue(WEST)).setValue(WEST, (WallSide)state.getValue(EAST)); + default -> super.mirror(state, mirror); + }; + } + + @Nullable + public static EnumProperty getPropertyForFace(Direction direction) { + return (EnumProperty)PROPERTY_BY_DIRECTION.get(direction); + } + + @Override + public boolean isValidBonemealTarget(LevelReader level, BlockPos pos, BlockState state) { + return (Boolean)state.getValue(BASE); + } + + @Override + public boolean isBonemealSuccess(Level level, RandomSource random, BlockPos pos, BlockState state) { + return !createTopperWithSideChance(level, pos, () -> true).isAir(); + } + + @Override + public void performBonemeal(ServerLevel level, RandomSource random, BlockPos pos, BlockState state) { + BlockState blockState = createTopperWithSideChance(level, pos, () -> true); + if (!blockState.isAir()) { + level.setBlock(pos.above(), blockState, 3); + } + } +} diff --git a/net/minecraft/world/level/block/MultifaceBlock.java b/net/minecraft/world/level/block/MultifaceBlock.java index 0878d37f..99fca4a0 100644 --- a/net/minecraft/world/level/block/MultifaceBlock.java +++ b/net/minecraft/world/level/block/MultifaceBlock.java @@ -13,11 +13,12 @@ import java.util.function.Function; import net.minecraft.Util; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; +import net.minecraft.util.RandomSource; import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; -import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; @@ -116,11 +117,22 @@ public abstract class MultifaceBlock extends Block { } @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { - if (!hasAnyFace(state)) { + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { + if (!hasAnyFace(blockState)) { return Blocks.AIR.defaultBlockState(); } else { - return hasFace(state, direction) && !canAttachTo(level, direction, neighborPos, neighborState) ? removeFace(state, getFaceProperty(direction)) : state; + return hasFace(blockState, direction) && !canAttachTo(levelReader, direction, blockPos2, blockState2) + ? removeFace(blockState, getFaceProperty(direction)) + : blockState; } } @@ -220,7 +232,7 @@ public abstract class MultifaceBlock extends Block { public static boolean hasFace(BlockState state, Direction direction) { BooleanProperty booleanProperty = getFaceProperty(direction); - return state.hasProperty(booleanProperty) && (Boolean)state.getValue(booleanProperty); + return (Boolean)state.getValueOrElse(booleanProperty, false); } public static boolean canAttachTo(BlockGetter level, Direction direction, BlockPos pos, BlockState state) { @@ -245,9 +257,7 @@ public abstract class MultifaceBlock extends Block { BlockState blockState = stateDefinition.any(); for (BooleanProperty booleanProperty : PROPERTY_BY_DIRECTION.values()) { - if (blockState.hasProperty(booleanProperty)) { - blockState = blockState.setValue(booleanProperty, false); - } + blockState = blockState.trySetValue(booleanProperty, false); } return blockState; @@ -266,11 +276,23 @@ public abstract class MultifaceBlock extends Block { } protected static boolean hasAnyFace(BlockState state) { - return Arrays.stream(DIRECTIONS).anyMatch(direction -> hasFace(state, direction)); + for (Direction direction : DIRECTIONS) { + if (hasFace(state, direction)) { + return true; + } + } + + return false; } private static boolean hasAnyVacantFace(BlockState state) { - return Arrays.stream(DIRECTIONS).anyMatch(direction -> !hasFace(state, direction)); + for (Direction direction : DIRECTIONS) { + if (!hasFace(state, direction)) { + return true; + } + } + + return false; } public abstract MultifaceSpreader getSpreader(); diff --git a/net/minecraft/world/level/block/MushroomBlock.java b/net/minecraft/world/level/block/MushroomBlock.java index cdb8af08..b0447984 100644 --- a/net/minecraft/world/level/block/MushroomBlock.java +++ b/net/minecraft/world/level/block/MushroomBlock.java @@ -77,7 +77,7 @@ public class MushroomBlock extends BushBlock implements BonemealableBlock { @Override protected boolean mayPlaceOn(BlockState state, BlockGetter level, BlockPos pos) { - return state.isSolidRender(level, pos); + return state.isSolidRender(); } @Override @@ -88,7 +88,7 @@ public class MushroomBlock extends BushBlock implements BonemealableBlock { } public boolean growMushroom(ServerLevel level, BlockPos pos, BlockState state, RandomSource random) { - Optional>> optional = level.registryAccess().registryOrThrow(Registries.CONFIGURED_FEATURE).getHolder(this.feature); + Optional>> optional = level.registryAccess().lookupOrThrow(Registries.CONFIGURED_FEATURE).get(this.feature); if (optional.isEmpty()) { return false; } else { diff --git a/net/minecraft/world/level/block/NetherPortalBlock.java b/net/minecraft/world/level/block/NetherPortalBlock.java index a16982fb..801f249a 100644 --- a/net/minecraft/world/level/block/NetherPortalBlock.java +++ b/net/minecraft/world/level/block/NetherPortalBlock.java @@ -4,6 +4,7 @@ import com.mojang.logging.LogUtils; import com.mojang.serialization.MapCodec; import java.util.Optional; import net.minecraft.BlockUtil; +import net.minecraft.BlockUtil.FoundRectangle; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.particles.ParticleTypes; @@ -14,15 +15,16 @@ import net.minecraft.sounds.SoundSource; import net.minecraft.util.RandomSource; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityDimensions; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; -import net.minecraft.world.entity.MobSpawnType; +import net.minecraft.world.entity.Relative; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.GameRules; import net.minecraft.world.level.Level; -import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; @@ -30,8 +32,8 @@ import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.block.state.properties.EnumProperty; import net.minecraft.world.level.border.WorldBorder; import net.minecraft.world.level.dimension.DimensionType; -import net.minecraft.world.level.portal.DimensionTransition; import net.minecraft.world.level.portal.PortalShape; +import net.minecraft.world.level.portal.TeleportTransition; import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.VoxelShape; @@ -75,22 +77,35 @@ public class NetherPortalBlock extends Block implements Portal { } if (level.getBlockState(pos).isValidSpawn(level, pos, EntityType.ZOMBIFIED_PIGLIN)) { - Entity entity = EntityType.ZOMBIFIED_PIGLIN.spawn(level, pos.above(), MobSpawnType.STRUCTURE); + Entity entity = EntityType.ZOMBIFIED_PIGLIN.spawn(level, pos.above(), EntitySpawnReason.STRUCTURE); if (entity != null) { entity.setPortalCooldown(); + Entity entity2 = entity.getVehicle(); + if (entity2 != null) { + entity2.setPortalCooldown(); + } } } } } @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { Direction.Axis axis = direction.getAxis(); - Direction.Axis axis2 = state.getValue(AXIS); + Direction.Axis axis2 = blockState.getValue(AXIS); boolean bl = axis2 != axis && axis.isHorizontal(); - return !bl && !neighborState.is(this) && !new PortalShape(level, pos, axis2).isComplete() + return !bl && !blockState2.is(this) && !PortalShape.findAnyShape(levelReader, blockPos, axis2).isComplete() ? Blocks.AIR.defaultBlockState() - : super.updateShape(state, direction, neighborState, level, pos, neighborPos); + : super.updateShape(blockState, levelReader, scheduledTickAccess, blockPos, direction, blockPos2, blockState2, randomSource); } @Override @@ -104,7 +119,7 @@ public class NetherPortalBlock extends Block implements Portal { public int getPortalTransitionTime(ServerLevel level, Entity entity) { return entity instanceof Player player ? Math.max( - 1, + 0, level.getGameRules() .getInt(player.getAbilities().invulnerable ? GameRules.RULE_PLAYERS_NETHER_PORTAL_CREATIVE_DELAY : GameRules.RULE_PLAYERS_NETHER_PORTAL_DEFAULT_DELAY) ) @@ -113,93 +128,94 @@ public class NetherPortalBlock extends Block implements Portal { @Nullable @Override - public DimensionTransition getPortalDestination(ServerLevel level, Entity entity, BlockPos pos) { - ResourceKey resourceKey = level.dimension() == Level.NETHER ? Level.OVERWORLD : Level.NETHER; - ServerLevel serverLevel = level.getServer().getLevel(resourceKey); - if (serverLevel == null) { + public TeleportTransition getPortalDestination(ServerLevel serverLevel, Entity entity, BlockPos blockPos) { + ResourceKey resourceKey = serverLevel.dimension() == Level.NETHER ? Level.OVERWORLD : Level.NETHER; + ServerLevel serverLevel2 = serverLevel.getServer().getLevel(resourceKey); + if (serverLevel2 == null) { return null; } else { - boolean bl = serverLevel.dimension() == Level.NETHER; - WorldBorder worldBorder = serverLevel.getWorldBorder(); - double d = DimensionType.getTeleportationScale(level.dimensionType(), serverLevel.dimensionType()); - BlockPos blockPos = worldBorder.clampToBounds(entity.getX() * d, entity.getY(), entity.getZ() * d); - return this.getExitPortal(serverLevel, entity, pos, blockPos, bl, worldBorder); + boolean bl = serverLevel2.dimension() == Level.NETHER; + WorldBorder worldBorder = serverLevel2.getWorldBorder(); + double d = DimensionType.getTeleportationScale(serverLevel.dimensionType(), serverLevel2.dimensionType()); + BlockPos blockPos2 = worldBorder.clampToBounds(entity.getX() * d, entity.getY(), entity.getZ() * d); + return this.getExitPortal(serverLevel2, entity, blockPos, blockPos2, bl, worldBorder); } } @Nullable - private DimensionTransition getExitPortal(ServerLevel level, Entity entity, BlockPos pos, BlockPos exitPos, boolean isNether, WorldBorder worldBorder) { - Optional optional = level.getPortalForcer().findClosestPortalPosition(exitPos, isNether, worldBorder); - BlockUtil.FoundRectangle foundRectangle; - DimensionTransition.PostDimensionTransition postDimensionTransition; + private TeleportTransition getExitPortal(ServerLevel serverLevel, Entity entity, BlockPos blockPos, BlockPos blockPos2, boolean bl, WorldBorder worldBorder) { + Optional optional = serverLevel.getPortalForcer().findClosestPortalPosition(blockPos2, bl, worldBorder); + FoundRectangle foundRectangle; + TeleportTransition.PostTeleportTransition postTeleportTransition; if (optional.isPresent()) { - BlockPos blockPos = (BlockPos)optional.get(); - BlockState blockState = level.getBlockState(blockPos); + BlockPos blockPos3 = (BlockPos)optional.get(); + BlockState blockState = serverLevel.getBlockState(blockPos3); foundRectangle = BlockUtil.getLargestRectangleAround( - blockPos, blockState.getValue(BlockStateProperties.HORIZONTAL_AXIS), 21, Direction.Axis.Y, 21, blockPosx -> level.getBlockState(blockPosx) == blockState + blockPos3, + blockState.getValue(BlockStateProperties.HORIZONTAL_AXIS), + 21, + Direction.Axis.Y, + 21, + blockPosx -> serverLevel.getBlockState(blockPosx) == blockState ); - postDimensionTransition = DimensionTransition.PLAY_PORTAL_SOUND.then(entityx -> entityx.placePortalTicket(blockPos)); + postTeleportTransition = TeleportTransition.PLAY_PORTAL_SOUND.then(entityx -> entityx.placePortalTicket(blockPos3)); } else { - Direction.Axis axis = (Direction.Axis)entity.level().getBlockState(pos).getOptionalValue(AXIS).orElse(Direction.Axis.X); - Optional optional2 = level.getPortalForcer().createPortal(exitPos, axis); + Direction.Axis axis = (Direction.Axis)entity.level().getBlockState(blockPos).getOptionalValue(AXIS).orElse(Direction.Axis.X); + Optional optional2 = serverLevel.getPortalForcer().createPortal(blockPos2, axis); if (optional2.isEmpty()) { LOGGER.error("Unable to create a portal, likely target out of worldborder"); return null; } - foundRectangle = (BlockUtil.FoundRectangle)optional2.get(); - postDimensionTransition = DimensionTransition.PLAY_PORTAL_SOUND.then(DimensionTransition.PLACE_PORTAL_TICKET); + foundRectangle = (FoundRectangle)optional2.get(); + postTeleportTransition = TeleportTransition.PLAY_PORTAL_SOUND.then(TeleportTransition.PLACE_PORTAL_TICKET); } - return getDimensionTransitionFromExit(entity, pos, foundRectangle, level, postDimensionTransition); + return getDimensionTransitionFromExit(entity, blockPos, foundRectangle, serverLevel, postTeleportTransition); } - private static DimensionTransition getDimensionTransitionFromExit( - Entity entity, BlockPos pos, BlockUtil.FoundRectangle rectangle, ServerLevel level, DimensionTransition.PostDimensionTransition postDimensionTransition + private static TeleportTransition getDimensionTransitionFromExit( + Entity entity, BlockPos blockPos, FoundRectangle foundRectangle, ServerLevel serverLevel, TeleportTransition.PostTeleportTransition postTeleportTransition ) { - BlockState blockState = entity.level().getBlockState(pos); + BlockState blockState = entity.level().getBlockState(blockPos); Direction.Axis axis; Vec3 vec3; if (blockState.hasProperty(BlockStateProperties.HORIZONTAL_AXIS)) { axis = blockState.getValue(BlockStateProperties.HORIZONTAL_AXIS); - BlockUtil.FoundRectangle foundRectangle = BlockUtil.getLargestRectangleAround( - pos, axis, 21, Direction.Axis.Y, 21, blockPos -> entity.level().getBlockState(blockPos) == blockState + FoundRectangle foundRectangle2 = BlockUtil.getLargestRectangleAround( + blockPos, axis, 21, Direction.Axis.Y, 21, blockPosx -> entity.level().getBlockState(blockPosx) == blockState ); - vec3 = entity.getRelativePortalPosition(axis, foundRectangle); + vec3 = entity.getRelativePortalPosition(axis, foundRectangle2); } else { axis = Direction.Axis.X; vec3 = new Vec3(0.5, 0.0, 0.0); } - return createDimensionTransition(level, rectangle, axis, vec3, entity, entity.getDeltaMovement(), entity.getYRot(), entity.getXRot(), postDimensionTransition); + return createDimensionTransition(serverLevel, foundRectangle, axis, vec3, entity, postTeleportTransition); } - private static DimensionTransition createDimensionTransition( - ServerLevel level, - BlockUtil.FoundRectangle rectangle, + private static TeleportTransition createDimensionTransition( + ServerLevel serverLevel, + FoundRectangle foundRectangle, Direction.Axis axis, - Vec3 offset, + Vec3 vec3, Entity entity, - Vec3 speed, - float yRot, - float xRot, - DimensionTransition.PostDimensionTransition postDimensionTransition + TeleportTransition.PostTeleportTransition postTeleportTransition ) { - BlockPos blockPos = rectangle.minCorner; - BlockState blockState = level.getBlockState(blockPos); + BlockPos blockPos = foundRectangle.minCorner; + BlockState blockState = serverLevel.getBlockState(blockPos); Direction.Axis axis2 = (Direction.Axis)blockState.getOptionalValue(BlockStateProperties.HORIZONTAL_AXIS).orElse(Direction.Axis.X); - double d = rectangle.axis1Size; - double e = rectangle.axis2Size; + double d = foundRectangle.axis1Size; + double e = foundRectangle.axis2Size; EntityDimensions entityDimensions = entity.getDimensions(entity.getPose()); int i = axis == axis2 ? 0 : 90; - Vec3 vec3 = axis == axis2 ? speed : new Vec3(speed.z, speed.y, -speed.x); - double f = entityDimensions.width() / 2.0 + (d - entityDimensions.width()) * offset.x(); - double g = (e - entityDimensions.height()) * offset.y(); - double h = 0.5 + offset.z(); + double f = entityDimensions.width() / 2.0 + (d - entityDimensions.width()) * vec3.x(); + double g = (e - entityDimensions.height()) * vec3.y(); + double h = 0.5 + vec3.z(); boolean bl = axis2 == Direction.Axis.X; Vec3 vec32 = new Vec3(blockPos.getX() + (bl ? f : h), blockPos.getY() + g, blockPos.getZ() + (bl ? h : f)); - Vec3 vec33 = PortalShape.findCollisionFreePosition(vec32, level, entity, entityDimensions); - return new DimensionTransition(level, vec33, vec3, yRot + i, xRot, postDimensionTransition); + Vec3 vec33 = PortalShape.findCollisionFreePosition(vec32, serverLevel, entity, entityDimensions); + return new TeleportTransition(serverLevel, vec33, Vec3.ZERO, i, 0.0F, Relative.union(Relative.DELTA, Relative.ROTATION), postTeleportTransition); } @Override diff --git a/net/minecraft/world/level/block/NetherrackBlock.java b/net/minecraft/world/level/block/NetherrackBlock.java index a751b55f..4bf8fe79 100644 --- a/net/minecraft/world/level/block/NetherrackBlock.java +++ b/net/minecraft/world/level/block/NetherrackBlock.java @@ -7,6 +7,7 @@ import net.minecraft.tags.BlockTags; import net.minecraft.util.RandomSource; import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.block.BonemealableBlock.Type; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; @@ -24,7 +25,7 @@ public class NetherrackBlock extends Block implements BonemealableBlock { @Override public boolean isValidBonemealTarget(LevelReader level, BlockPos pos, BlockState state) { - if (!level.getBlockState(pos.above()).propagatesSkylightDown(level, pos)) { + if (!level.getBlockState(pos.above()).propagatesSkylightDown()) { return false; } else { for (BlockPos blockPos : BlockPos.betweenClosed(pos.offset(-1, -1, -1), pos.offset(1, 1, 1))) { @@ -72,7 +73,7 @@ public class NetherrackBlock extends Block implements BonemealableBlock { } @Override - public BonemealableBlock.Type getType() { - return BonemealableBlock.Type.NEIGHBOR_SPREADER; + public Type getType() { + return Type.NEIGHBOR_SPREADER; } } diff --git a/net/minecraft/world/level/block/NoteBlock.java b/net/minecraft/world/level/block/NoteBlock.java index f876e16a..606a5e8b 100644 --- a/net/minecraft/world/level/block/NoteBlock.java +++ b/net/minecraft/world/level/block/NoteBlock.java @@ -10,15 +10,16 @@ import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundSource; import net.minecraft.stats.Stats; import net.minecraft.tags.ItemTags; +import net.minecraft.util.RandomSource; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; -import net.minecraft.world.ItemInteractionResult; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.level.Level; -import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.entity.SkullBlockEntity; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; @@ -29,6 +30,7 @@ import net.minecraft.world.level.block.state.properties.EnumProperty; import net.minecraft.world.level.block.state.properties.IntegerProperty; import net.minecraft.world.level.block.state.properties.NoteBlockInstrument; import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.level.redstone.Orientation; import net.minecraft.world.phys.BlockHitResult; import org.jetbrains.annotations.Nullable; @@ -49,14 +51,14 @@ public class NoteBlock extends Block { this.registerDefaultState(this.stateDefinition.any().setValue(INSTRUMENT, NoteBlockInstrument.HARP).setValue(NOTE, 0).setValue(POWERED, false)); } - private BlockState setInstrument(LevelAccessor level, BlockPos pos, BlockState state) { - NoteBlockInstrument noteBlockInstrument = level.getBlockState(pos.above()).instrument(); + private BlockState setInstrument(LevelReader levelReader, BlockPos blockPos, BlockState blockState) { + NoteBlockInstrument noteBlockInstrument = levelReader.getBlockState(blockPos.above()).instrument(); if (noteBlockInstrument.worksAboveNoteBlock()) { - return state.setValue(INSTRUMENT, noteBlockInstrument); + return blockState.setValue(INSTRUMENT, noteBlockInstrument); } else { - NoteBlockInstrument noteBlockInstrument2 = level.getBlockState(pos.below()).instrument(); + NoteBlockInstrument noteBlockInstrument2 = levelReader.getBlockState(blockPos.below()).instrument(); NoteBlockInstrument noteBlockInstrument3 = noteBlockInstrument2.worksAboveNoteBlock() ? NoteBlockInstrument.HARP : noteBlockInstrument2; - return state.setValue(INSTRUMENT, noteBlockInstrument3); + return blockState.setValue(INSTRUMENT, noteBlockInstrument3); } } @@ -66,20 +68,31 @@ public class NoteBlock extends Block { } @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { boolean bl = direction.getAxis() == Direction.Axis.Y; - return bl ? this.setInstrument(level, pos, state) : super.updateShape(state, direction, neighborState, level, pos, neighborPos); + return bl + ? this.setInstrument(levelReader, blockPos, blockState) + : super.updateShape(blockState, levelReader, scheduledTickAccess, blockPos, direction, blockPos2, blockState2, randomSource); } @Override - protected void neighborChanged(BlockState state, Level level, BlockPos pos, Block neighborBlock, BlockPos neighborPos, boolean movedByPiston) { - boolean bl = level.hasNeighborSignal(pos); - if (bl != (Boolean)state.getValue(POWERED)) { - if (bl) { - this.playNote(null, state, level, pos); + protected void neighborChanged(BlockState blockState, Level level, BlockPos blockPos, Block block, @Nullable Orientation orientation, boolean bl) { + boolean bl2 = level.hasNeighborSignal(blockPos); + if (bl2 != (Boolean)blockState.getValue(POWERED)) { + if (bl2) { + this.playNote(null, blockState, level, blockPos); } - level.setBlock(pos, state.setValue(POWERED, bl), 3); + level.setBlock(blockPos, blockState.setValue(POWERED, bl2), 3); } } @@ -91,25 +104,24 @@ public class NoteBlock extends Block { } @Override - protected ItemInteractionResult useItemOn( - ItemStack stack, BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hitResult + protected InteractionResult useItemOn( + ItemStack itemStack, BlockState blockState, Level level, BlockPos blockPos, Player player, InteractionHand interactionHand, BlockHitResult blockHitResult ) { - return stack.is(ItemTags.NOTE_BLOCK_TOP_INSTRUMENTS) && hitResult.getDirection() == Direction.UP - ? ItemInteractionResult.SKIP_DEFAULT_BLOCK_INTERACTION - : super.useItemOn(stack, state, level, pos, player, hand, hitResult); + return (InteractionResult)(itemStack.is(ItemTags.NOTE_BLOCK_TOP_INSTRUMENTS) && blockHitResult.getDirection() == Direction.UP + ? InteractionResult.PASS + : super.useItemOn(itemStack, blockState, level, blockPos, player, interactionHand, blockHitResult)); } @Override protected InteractionResult useWithoutItem(BlockState state, Level level, BlockPos pos, Player player, BlockHitResult hitResult) { - if (level.isClientSide) { - return InteractionResult.SUCCESS; - } else { + if (!level.isClientSide) { state = state.cycle(NOTE); level.setBlock(pos, state, 3); this.playNote(player, state, level, pos); player.awardStat(Stats.TUNE_NOTEBLOCK); - return InteractionResult.CONSUME; } + + return InteractionResult.SUCCESS; } @Override diff --git a/net/minecraft/world/level/block/NyliumBlock.java b/net/minecraft/world/level/block/NyliumBlock.java index 71a3c0df..c5ffb0ac 100644 --- a/net/minecraft/world/level/block/NyliumBlock.java +++ b/net/minecraft/world/level/block/NyliumBlock.java @@ -11,6 +11,7 @@ import net.minecraft.server.level.ServerLevel; import net.minecraft.util.RandomSource; import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.block.BonemealableBlock.Type; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.chunk.ChunkGenerator; @@ -32,8 +33,8 @@ public class NyliumBlock extends Block implements BonemealableBlock { private static boolean canBeNylium(BlockState state, LevelReader reader, BlockPos pos) { BlockPos blockPos = pos.above(); BlockState blockState = reader.getBlockState(blockPos); - int i = LightEngine.getLightBlockInto(reader, state, pos, blockState, blockPos, Direction.UP, blockState.getLightBlock(reader, blockPos)); - return i < reader.getMaxLightLevel(); + int i = LightEngine.getLightBlockInto(state, blockState, Direction.UP, blockState.getLightBlock()); + return i < 15; } @Override @@ -58,7 +59,7 @@ public class NyliumBlock extends Block implements BonemealableBlock { BlockState blockState = level.getBlockState(pos); BlockPos blockPos = pos.above(); ChunkGenerator chunkGenerator = level.getChunkSource().getGenerator(); - Registry> registry = level.registryAccess().registryOrThrow(Registries.CONFIGURED_FEATURE); + Registry> registry = level.registryAccess().lookupOrThrow(Registries.CONFIGURED_FEATURE); if (blockState.is(Blocks.CRIMSON_NYLIUM)) { this.place(registry, NetherFeatures.CRIMSON_FOREST_VEGETATION_BONEMEAL, level, chunkGenerator, random, blockPos); } else if (blockState.is(Blocks.WARPED_NYLIUM)) { @@ -78,11 +79,11 @@ public class NyliumBlock extends Block implements BonemealableBlock { RandomSource random, BlockPos pos ) { - featureRegistry.getHolder(featureKey).ifPresent(reference -> ((ConfiguredFeature)reference.value()).place(level, chunkGenerator, random, pos)); + featureRegistry.get(featureKey).ifPresent(reference -> ((ConfiguredFeature)reference.value()).place(level, chunkGenerator, random, pos)); } @Override - public BonemealableBlock.Type getType() { - return BonemealableBlock.Type.NEIGHBOR_SPREADER; + public Type getType() { + return Type.NEIGHBOR_SPREADER; } } diff --git a/net/minecraft/world/level/block/ObserverBlock.java b/net/minecraft/world/level/block/ObserverBlock.java index a7f74b6c..b8649aca 100644 --- a/net/minecraft/world/level/block/ObserverBlock.java +++ b/net/minecraft/world/level/block/ObserverBlock.java @@ -8,12 +8,15 @@ import net.minecraft.util.RandomSource; import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; -import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.block.state.properties.BooleanProperty; +import net.minecraft.world.level.redstone.ExperimentalRedstoneUtils; +import net.minecraft.world.level.redstone.Orientation; public class ObserverBlock extends DirectionalBlock { public static final MapCodec CODEC = simpleCodec(ObserverBlock::new); @@ -57,25 +60,35 @@ public class ObserverBlock extends DirectionalBlock { } @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { - if (state.getValue(FACING) == direction && !(Boolean)state.getValue(POWERED)) { - this.startSignal(level, pos); + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { + if (blockState.getValue(FACING) == direction && !(Boolean)blockState.getValue(POWERED)) { + this.startSignal(levelReader, scheduledTickAccess, blockPos); } - return super.updateShape(state, direction, neighborState, level, pos, neighborPos); + return super.updateShape(blockState, levelReader, scheduledTickAccess, blockPos, direction, blockPos2, blockState2, randomSource); } - private void startSignal(LevelAccessor level, BlockPos pos) { - if (!level.isClientSide() && !level.getBlockTicks().hasScheduledTick(pos, this)) { - level.scheduleTick(pos, this, 2); + private void startSignal(LevelReader levelReader, ScheduledTickAccess scheduledTickAccess, BlockPos blockPos) { + if (!levelReader.isClientSide() && !scheduledTickAccess.getBlockTicks().hasScheduledTick(blockPos, this)) { + scheduledTickAccess.scheduleTick(blockPos, this, 2); } } protected void updateNeighborsInFront(Level level, BlockPos pos, BlockState state) { Direction direction = state.getValue(FACING); BlockPos blockPos = pos.relative(direction.getOpposite()); - level.neighborChanged(blockPos, this, pos); - level.updateNeighborsAtExceptFromFacing(blockPos, this, direction); + Orientation orientation = ExperimentalRedstoneUtils.initialOrientation(level, direction.getOpposite(), null); + level.neighborChanged(blockPos, this, orientation); + level.updateNeighborsAtExceptFromFacing(blockPos, this, direction, orientation); } @Override diff --git a/net/minecraft/world/level/block/PinkPetalsBlock.java b/net/minecraft/world/level/block/PinkPetalsBlock.java index 00eae10f..c2cac83f 100644 --- a/net/minecraft/world/level/block/PinkPetalsBlock.java +++ b/net/minecraft/world/level/block/PinkPetalsBlock.java @@ -16,7 +16,7 @@ import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.block.state.properties.BlockStateProperties; -import net.minecraft.world.level.block.state.properties.DirectionProperty; +import net.minecraft.world.level.block.state.properties.EnumProperty; import net.minecraft.world.level.block.state.properties.IntegerProperty; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.Shapes; @@ -26,7 +26,7 @@ public class PinkPetalsBlock extends BushBlock implements BonemealableBlock { public static final MapCodec CODEC = simpleCodec(PinkPetalsBlock::new); public static final int MIN_FLOWERS = 1; public static final int MAX_FLOWERS = 4; - public static final DirectionProperty FACING = BlockStateProperties.HORIZONTAL_FACING; + public static final EnumProperty FACING = BlockStateProperties.HORIZONTAL_FACING; public static final IntegerProperty AMOUNT = BlockStateProperties.FLOWER_AMOUNT; private static final BiFunction SHAPE_BY_PROPERTIES = Util.memoize( (BiFunction)((direction, integer) -> { diff --git a/net/minecraft/world/level/block/PipeBlock.java b/net/minecraft/world/level/block/PipeBlock.java index 0a7c0323..6d6b0462 100644 --- a/net/minecraft/world/level/block/PipeBlock.java +++ b/net/minecraft/world/level/block/PipeBlock.java @@ -79,7 +79,7 @@ public abstract class PipeBlock extends Block { } @Override - protected boolean propagatesSkylightDown(BlockState state, BlockGetter level, BlockPos pos) { + protected boolean propagatesSkylightDown(BlockState blockState) { return false; } diff --git a/net/minecraft/world/level/block/PitcherCropBlock.java b/net/minecraft/world/level/block/PitcherCropBlock.java index dfb1a549..d554575f 100644 --- a/net/minecraft/world/level/block/PitcherCropBlock.java +++ b/net/minecraft/world/level/block/PitcherCropBlock.java @@ -13,8 +13,8 @@ import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.GameRules; import net.minecraft.world.level.Level; -import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; @@ -72,11 +72,20 @@ public class PitcherCropBlock extends DoublePlantBlock implements BonemealableBl } @Override - public BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { - if (isDouble((Integer)state.getValue(AGE))) { - return super.updateShape(state, direction, neighborState, level, pos, neighborPos); + public BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { + if (isDouble((Integer)blockState.getValue(AGE))) { + return super.updateShape(blockState, levelReader, scheduledTickAccess, blockPos, direction, blockPos2, blockState2, randomSource); } else { - return state.canSurvive(level, pos) ? state : Blocks.AIR.defaultBlockState(); + return blockState.canSurvive(levelReader, blockPos) ? blockState : Blocks.AIR.defaultBlockState(); } } @@ -98,8 +107,8 @@ public class PitcherCropBlock extends DoublePlantBlock implements BonemealableBl @Override public void entityInside(BlockState state, Level level, BlockPos pos, Entity entity) { - if (entity instanceof Ravager && level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { - level.destroyBlock(pos, true, entity); + if (level instanceof ServerLevel serverLevel && entity instanceof Ravager && serverLevel.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { + serverLevel.destroyBlock(pos, true, entity); } super.entityInside(state, level, pos, entity); diff --git a/net/minecraft/world/level/block/PointedDripstoneBlock.java b/net/minecraft/world/level/block/PointedDripstoneBlock.java index fe33789e..95dfa2e6 100644 --- a/net/minecraft/world/level/block/PointedDripstoneBlock.java +++ b/net/minecraft/world/level/block/PointedDripstoneBlock.java @@ -22,15 +22,16 @@ import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.block.state.properties.BooleanProperty; -import net.minecraft.world.level.block.state.properties.DirectionProperty; import net.minecraft.world.level.block.state.properties.DripstoneThickness; import net.minecraft.world.level.block.state.properties.EnumProperty; import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.level.gameevent.GameEvent.Context; import net.minecraft.world.level.material.Fluid; import net.minecraft.world.level.material.FluidState; import net.minecraft.world.level.material.Fluids; @@ -45,7 +46,7 @@ import org.jetbrains.annotations.Nullable; public class PointedDripstoneBlock extends Block implements Fallable, SimpleWaterloggedBlock { public static final MapCodec CODEC = simpleCodec(PointedDripstoneBlock::new); - public static final DirectionProperty TIP_DIRECTION = BlockStateProperties.VERTICAL_DIRECTION; + public static final EnumProperty TIP_DIRECTION = BlockStateProperties.VERTICAL_DIRECTION; public static final EnumProperty THICKNESS = BlockStateProperties.DRIPSTONE_THICKNESS; public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED; private static final int MAX_SEARCH_LENGTH_WHEN_CHECKING_DRIP_TYPE = 11; @@ -98,29 +99,38 @@ public class PointedDripstoneBlock extends Block implements Fallable, SimpleWate } @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { - if ((Boolean)state.getValue(WATERLOGGED)) { - level.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(level)); + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { + if ((Boolean)blockState.getValue(WATERLOGGED)) { + scheduledTickAccess.scheduleTick(blockPos, Fluids.WATER, Fluids.WATER.getTickDelay(levelReader)); } if (direction != Direction.UP && direction != Direction.DOWN) { - return state; + return blockState; } else { - Direction direction2 = state.getValue(TIP_DIRECTION); - if (direction2 == Direction.DOWN && level.getBlockTicks().hasScheduledTick(pos, this)) { - return state; - } else if (direction == direction2.getOpposite() && !this.canSurvive(state, level, pos)) { + Direction direction2 = blockState.getValue(TIP_DIRECTION); + if (direction2 == Direction.DOWN && scheduledTickAccess.getBlockTicks().hasScheduledTick(blockPos, this)) { + return blockState; + } else if (direction == direction2.getOpposite() && !this.canSurvive(blockState, levelReader, blockPos)) { if (direction2 == Direction.DOWN) { - level.scheduleTick(pos, this, 2); + scheduledTickAccess.scheduleTick(blockPos, this, 2); } else { - level.scheduleTick(pos, this, 1); + scheduledTickAccess.scheduleTick(blockPos, this, 1); } - return state; + return blockState; } else { - boolean bl = state.getValue(THICKNESS) == DripstoneThickness.TIP_MERGE; - DripstoneThickness dripstoneThickness = calculateDripstoneThickness(level, pos, direction2, bl); - return state.setValue(THICKNESS, dripstoneThickness); + boolean bl = blockState.getValue(THICKNESS) == DripstoneThickness.TIP_MERGE; + DripstoneThickness dripstoneThickness = calculateDripstoneThickness(levelReader, blockPos, direction2, bl); + return blockState.setValue(THICKNESS, dripstoneThickness); } } } @@ -129,8 +139,9 @@ public class PointedDripstoneBlock extends Block implements Fallable, SimpleWate protected void onProjectileHit(Level level, BlockState state, BlockHitResult hit, Projectile projectile) { if (!level.isClientSide) { BlockPos blockPos = hit.getBlockPos(); - if (projectile.mayInteract(level, blockPos) - && projectile.mayBreak(level) + if (level instanceof ServerLevel serverLevel + && projectile.mayInteract(serverLevel, blockPos) + && projectile.mayBreak(serverLevel) && projectile instanceof ThrownTrident && projectile.getDeltaMovement().length() > 0.6) { level.destroyBlock(blockPos, true); @@ -203,7 +214,7 @@ public class PointedDripstoneBlock extends Block implements Fallable, SimpleWate Block.pushEntitiesUp( ((PointedDripstoneBlock.FluidInfo)optional.get()).sourceState, blockState, level, ((PointedDripstoneBlock.FluidInfo)optional.get()).pos ); - level.gameEvent(GameEvent.BLOCK_CHANGE, ((PointedDripstoneBlock.FluidInfo)optional.get()).pos, GameEvent.Context.of(blockState)); + level.gameEvent(GameEvent.BLOCK_CHANGE, ((PointedDripstoneBlock.FluidInfo)optional.get()).pos, Context.of(blockState)); level.levelEvent(1504, blockPos, 0); } else { BlockPos blockPos2 = findFillableCauldronBelowStalactiteTip(level, blockPos, fluid); @@ -249,7 +260,7 @@ public class PointedDripstoneBlock extends Block implements Fallable, SimpleWate } @Override - protected VoxelShape getOcclusionShape(BlockState state, BlockGetter level, BlockPos pos) { + protected VoxelShape getOcclusionShape(BlockState blockState) { return Shapes.empty(); } @@ -273,7 +284,7 @@ public class PointedDripstoneBlock extends Block implements Fallable, SimpleWate voxelShape = BASE_SHAPE; } - Vec3 vec3 = state.getOffset(level, pos); + Vec3 vec3 = state.getOffset(pos); return voxelShape.move(vec3.x, 0.0, vec3.z); } @@ -401,7 +412,7 @@ public class PointedDripstoneBlock extends Block implements Fallable, SimpleWate } private static void spawnDripParticle(Level level, BlockPos pos, BlockState state, Fluid fluid) { - Vec3 vec3 = state.getOffset(level, pos); + Vec3 vec3 = state.getOffset(pos); double d = 0.0625; double e = pos.getX() + 0.5 + vec3.x; double f = pos.getY() + 1 - 0.6875F - 0.0625; @@ -603,7 +614,7 @@ public class PointedDripstoneBlock extends Block implements Fallable, SimpleWate private static boolean canDripThrough(BlockGetter level, BlockPos pos, BlockState state) { if (state.isAir()) { return true; - } else if (state.isSolidRender(level, pos)) { + } else if (state.isSolidRender()) { return false; } else if (!state.getFluidState().isEmpty()) { return false; diff --git a/net/minecraft/world/level/block/Portal.java b/net/minecraft/world/level/block/Portal.java index 9afdec55..d173df53 100644 --- a/net/minecraft/world/level/block/Portal.java +++ b/net/minecraft/world/level/block/Portal.java @@ -3,7 +3,7 @@ package net.minecraft.world.level.block; import net.minecraft.core.BlockPos; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.entity.Entity; -import net.minecraft.world.level.portal.DimensionTransition; +import net.minecraft.world.level.portal.TeleportTransition; import org.jetbrains.annotations.Nullable; public interface Portal { @@ -12,7 +12,7 @@ public interface Portal { } @Nullable - DimensionTransition getPortalDestination(ServerLevel level, Entity entity, BlockPos pos); + TeleportTransition getPortalDestination(ServerLevel serverLevel, Entity entity, BlockPos blockPos); default Portal.Transition getLocalTransition() { return Portal.Transition.NONE; diff --git a/net/minecraft/world/level/block/PowderSnowBlock.java b/net/minecraft/world/level/block/PowderSnowBlock.java index 35cd67c6..e073f756 100644 --- a/net/minecraft/world/level/block/PowderSnowBlock.java +++ b/net/minecraft/world/level/block/PowderSnowBlock.java @@ -5,6 +5,7 @@ import java.util.Optional; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.particles.ParticleTypes; +import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; import net.minecraft.tags.EntityTypeTags; @@ -55,11 +56,6 @@ public class PowderSnowBlock extends Block implements BucketPickup { return adjacentState.is(this) ? true : super.skipRendering(state, adjacentState, direction); } - @Override - protected VoxelShape getOcclusionShape(BlockState state, BlockGetter level, BlockPos pos) { - return Shapes.empty(); - } - @Override protected void entityInside(BlockState state, Level level, BlockPos pos, Entity entity) { if (!(entity instanceof LivingEntity) || entity.getInBlockState().is(this)) { @@ -82,8 +78,10 @@ public class PowderSnowBlock extends Block implements BucketPickup { } entity.setIsInPowderSnow(true); - if (!level.isClientSide) { - if (entity.isOnFire() && (level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) || entity instanceof Player) && entity.mayInteract(level, pos)) { + if (level instanceof ServerLevel serverLevel) { + if (entity.isOnFire() + && (serverLevel.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) || entity instanceof Player) + && entity.mayInteract(serverLevel, pos)) { level.destroyBlock(pos, false); } diff --git a/net/minecraft/world/level/block/PoweredRailBlock.java b/net/minecraft/world/level/block/PoweredRailBlock.java index 09458a1d..51d9f207 100644 --- a/net/minecraft/world/level/block/PoweredRailBlock.java +++ b/net/minecraft/world/level/block/PoweredRailBlock.java @@ -133,7 +133,7 @@ public class PoweredRailBlock extends BaseRailBlock { if (bl2 != bl) { level.setBlock(pos, state.setValue(POWERED, bl2), 3); level.updateNeighborsAt(pos.below(), this); - if (((RailShape)state.getValue(SHAPE)).isAscending()) { + if (((RailShape)state.getValue(SHAPE)).isSlope()) { level.updateNeighborsAt(pos.above(), this); } } diff --git a/net/minecraft/world/level/block/PumpkinBlock.java b/net/minecraft/world/level/block/PumpkinBlock.java index cf831134..81a7c569 100644 --- a/net/minecraft/world/level/block/PumpkinBlock.java +++ b/net/minecraft/world/level/block/PumpkinBlock.java @@ -7,7 +7,7 @@ import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; import net.minecraft.stats.Stats; import net.minecraft.world.InteractionHand; -import net.minecraft.world.ItemInteractionResult; +import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.item.ItemEntity; import net.minecraft.world.entity.player.Player; @@ -32,33 +32,33 @@ public class PumpkinBlock extends Block { } @Override - protected ItemInteractionResult useItemOn( - ItemStack stack, BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hitResult + protected InteractionResult useItemOn( + ItemStack itemStack, BlockState blockState, Level level, BlockPos blockPos, Player player, InteractionHand interactionHand, BlockHitResult blockHitResult ) { - if (!stack.is(Items.SHEARS)) { - return super.useItemOn(stack, state, level, pos, player, hand, hitResult); + if (!itemStack.is(Items.SHEARS)) { + return super.useItemOn(itemStack, blockState, level, blockPos, player, interactionHand, blockHitResult); } else if (level.isClientSide) { - return ItemInteractionResult.sidedSuccess(level.isClientSide); + return InteractionResult.SUCCESS; } else { - Direction direction = hitResult.getDirection(); + Direction direction = blockHitResult.getDirection(); Direction direction2 = direction.getAxis() == Direction.Axis.Y ? player.getDirection().getOpposite() : direction; - level.playSound(null, pos, SoundEvents.PUMPKIN_CARVE, SoundSource.BLOCKS, 1.0F, 1.0F); - level.setBlock(pos, Blocks.CARVED_PUMPKIN.defaultBlockState().setValue(CarvedPumpkinBlock.FACING, direction2), 11); + level.playSound(null, blockPos, SoundEvents.PUMPKIN_CARVE, SoundSource.BLOCKS, 1.0F, 1.0F); + level.setBlock(blockPos, Blocks.CARVED_PUMPKIN.defaultBlockState().setValue(CarvedPumpkinBlock.FACING, direction2), 11); ItemEntity itemEntity = new ItemEntity( level, - pos.getX() + 0.5 + direction2.getStepX() * 0.65, - pos.getY() + 0.1, - pos.getZ() + 0.5 + direction2.getStepZ() * 0.65, + blockPos.getX() + 0.5 + direction2.getStepX() * 0.65, + blockPos.getY() + 0.1, + blockPos.getZ() + 0.5 + direction2.getStepZ() * 0.65, new ItemStack(Items.PUMPKIN_SEEDS, 4) ); itemEntity.setDeltaMovement( 0.05 * direction2.getStepX() + level.random.nextDouble() * 0.02, 0.05, 0.05 * direction2.getStepZ() + level.random.nextDouble() * 0.02 ); level.addFreshEntity(itemEntity); - stack.hurtAndBreak(1, player, LivingEntity.getSlotForHand(hand)); - level.gameEvent(player, GameEvent.SHEAR, pos); + itemStack.hurtAndBreak(1, player, LivingEntity.getSlotForHand(interactionHand)); + level.gameEvent(player, GameEvent.SHEAR, blockPos); player.awardStat(Stats.ITEM_USED.get(Items.SHEARS)); - return ItemInteractionResult.sidedSuccess(level.isClientSide); + return InteractionResult.SUCCESS; } } } diff --git a/net/minecraft/world/level/block/RedStoneOreBlock.java b/net/minecraft/world/level/block/RedStoneOreBlock.java index eb99eed3..1cdf519c 100644 --- a/net/minecraft/world/level/block/RedStoneOreBlock.java +++ b/net/minecraft/world/level/block/RedStoneOreBlock.java @@ -8,7 +8,7 @@ import net.minecraft.server.level.ServerLevel; import net.minecraft.util.RandomSource; import net.minecraft.util.valueproviders.UniformInt; import net.minecraft.world.InteractionHand; -import net.minecraft.world.ItemInteractionResult; +import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.BlockItem; @@ -51,18 +51,18 @@ public class RedStoneOreBlock extends Block { } @Override - protected ItemInteractionResult useItemOn( - ItemStack stack, BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hitResult + protected InteractionResult useItemOn( + ItemStack itemStack, BlockState blockState, Level level, BlockPos blockPos, Player player, InteractionHand interactionHand, BlockHitResult blockHitResult ) { if (level.isClientSide) { - spawnParticles(level, pos); + spawnParticles(level, blockPos); } else { - interact(state, level, pos); + interact(blockState, level, blockPos); } - return stack.getItem() instanceof BlockItem && new BlockPlaceContext(player, hand, stack, hitResult).canPlace() - ? ItemInteractionResult.SKIP_DEFAULT_BLOCK_INTERACTION - : ItemInteractionResult.SUCCESS; + return (InteractionResult)(itemStack.getItem() instanceof BlockItem && new BlockPlaceContext(player, interactionHand, itemStack, blockHitResult).canPlace() + ? InteractionResult.PASS + : InteractionResult.SUCCESS); } private static void interact(BlockState state, Level level, BlockPos pos) { @@ -105,7 +105,7 @@ public class RedStoneOreBlock extends Block { for (Direction direction : Direction.values()) { BlockPos blockPos = pos.relative(direction); - if (!level.getBlockState(blockPos).isSolidRender(level, blockPos)) { + if (!level.getBlockState(blockPos).isSolidRender()) { Direction.Axis axis = direction.getAxis(); double e = axis == Direction.Axis.X ? 0.5 + 0.5625 * direction.getStepX() : randomSource.nextFloat(); double f = axis == Direction.Axis.Y ? 0.5 + 0.5625 * direction.getStepY() : randomSource.nextFloat(); diff --git a/net/minecraft/world/level/block/RedStoneWireBlock.java b/net/minecraft/world/level/block/RedStoneWireBlock.java index d13a4c21..ea2904f6 100644 --- a/net/minecraft/world/level/block/RedStoneWireBlock.java +++ b/net/minecraft/world/level/block/RedStoneWireBlock.java @@ -2,23 +2,24 @@ package net.minecraft.world.level.block; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Maps; -import com.google.common.collect.Sets; import com.mojang.serialization.MapCodec; import java.util.Map; -import java.util.Set; import net.minecraft.Util; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.particles.DustParticleOptions; +import net.minecraft.util.ARGB; import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.player.Player; +import net.minecraft.world.flag.FeatureFlags; import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; @@ -27,8 +28,12 @@ import net.minecraft.world.level.block.state.properties.EnumProperty; import net.minecraft.world.level.block.state.properties.IntegerProperty; import net.minecraft.world.level.block.state.properties.Property; import net.minecraft.world.level.block.state.properties.RedstoneSide; +import net.minecraft.world.level.redstone.DefaultRedstoneWireEvaluator; +import net.minecraft.world.level.redstone.ExperimentalRedstoneUtils; +import net.minecraft.world.level.redstone.ExperimentalRedstoneWireEvaluator; +import net.minecraft.world.level.redstone.Orientation; +import net.minecraft.world.level.redstone.RedstoneWireEvaluator; import net.minecraft.world.phys.BlockHitResult; -import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.Shapes; import net.minecraft.world.phys.shapes.VoxelShape; @@ -75,17 +80,18 @@ public class RedStoneWireBlock extends Block { ) ); private static final Map SHAPES_CACHE = Maps.newHashMap(); - private static final Vec3[] COLORS = Util.make(new Vec3[16], vec3s -> { + private static final int[] COLORS = Util.make(new int[16], is -> { for (int i = 0; i <= 15; i++) { float f = i / 15.0F; float g = f * 0.6F + (f > 0.0F ? 0.4F : 0.3F); float h = Mth.clamp(f * f * 0.7F - 0.5F, 0.0F, 1.0F); float j = Mth.clamp(f * f * 0.6F - 0.7F, 0.0F, 1.0F); - vec3s[i] = new Vec3(g, h, j); + is[i] = ARGB.colorFromFloat(1.0F, g, h, j); } }); private static final float PARTICLE_DENSITY = 0.2F; private final BlockState crossState; + private final RedstoneWireEvaluator evaluator = new DefaultRedstoneWireEvaluator(this); private boolean shouldSignal = true; @Override @@ -188,17 +194,29 @@ public class RedStoneWireBlock extends Block { } @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { if (direction == Direction.DOWN) { - return !this.canSurviveOn(level, neighborPos, neighborState) ? Blocks.AIR.defaultBlockState() : state; + return !this.canSurviveOn(levelReader, blockPos2, blockState2) ? Blocks.AIR.defaultBlockState() : blockState; } else if (direction == Direction.UP) { - return this.getConnectionState(level, state, pos); + return this.getConnectionState(levelReader, blockState, blockPos); } else { - RedstoneSide redstoneSide = this.getConnectingSide(level, pos, direction); - return redstoneSide.isConnected() == ((RedstoneSide)state.getValue((Property)PROPERTY_BY_DIRECTION.get(direction))).isConnected() && !isCross(state) - ? state.setValue((Property)PROPERTY_BY_DIRECTION.get(direction), redstoneSide) + RedstoneSide redstoneSide = this.getConnectingSide(levelReader, blockPos, direction); + return redstoneSide.isConnected() == ((RedstoneSide)blockState.getValue((Property)PROPERTY_BY_DIRECTION.get(direction))).isConnected() + && !isCross(blockState) + ? blockState.setValue((Property)PROPERTY_BY_DIRECTION.get(direction), redstoneSide) : this.getConnectionState( - level, this.crossState.setValue(POWER, (Integer)state.getValue(POWER)).setValue((Property)PROPERTY_BY_DIRECTION.get(direction), redstoneSide), pos + levelReader, + this.crossState.setValue(POWER, (Integer)blockState.getValue(POWER)).setValue((Property)PROPERTY_BY_DIRECTION.get(direction), redstoneSide), + blockPos ); } } @@ -228,14 +246,14 @@ public class RedStoneWireBlock extends Block { BlockState blockState = level.getBlockState(mutableBlockPos); if (blockState.is(this)) { BlockPos blockPos = mutableBlockPos.relative(direction.getOpposite()); - level.neighborShapeChanged(direction.getOpposite(), level.getBlockState(blockPos), mutableBlockPos, blockPos, flags, recursionLeft); + level.neighborShapeChanged(direction.getOpposite(), mutableBlockPos, blockPos, level.getBlockState(blockPos), flags, recursionLeft); } mutableBlockPos.setWithOffset(pos, direction).move(Direction.UP); BlockState blockState2 = level.getBlockState(mutableBlockPos); if (blockState2.is(this)) { BlockPos blockPos2 = mutableBlockPos.relative(direction.getOpposite()); - level.neighborShapeChanged(direction.getOpposite(), level.getBlockState(blockPos2), mutableBlockPos, blockPos2, flags, recursionLeft); + level.neighborShapeChanged(direction.getOpposite(), mutableBlockPos, blockPos2, level.getBlockState(blockPos2), flags, recursionLeft); } } } @@ -276,50 +294,19 @@ public class RedStoneWireBlock extends Block { return state.isFaceSturdy(level, pos, Direction.UP) || state.is(Blocks.HOPPER); } - private void updatePowerStrength(Level level, BlockPos pos, BlockState state) { - int i = this.calculateTargetStrength(level, pos); - if ((Integer)state.getValue(POWER) != i) { - if (level.getBlockState(pos) == state) { - level.setBlock(pos, state.setValue(POWER, i), 2); - } - - Set set = Sets.newHashSet(); - set.add(pos); - - for (Direction direction : Direction.values()) { - set.add(pos.relative(direction)); - } - - for (BlockPos blockPos : set) { - level.updateNeighborsAt(blockPos, this); - } + private void updatePowerStrength(Level level, BlockPos blockPos, BlockState blockState, @Nullable Orientation orientation, boolean bl) { + if (useExperimentalEvaluator(level)) { + new ExperimentalRedstoneWireEvaluator(this).updatePowerStrength(level, blockPos, blockState, orientation, bl); + } else { + this.evaluator.updatePowerStrength(level, blockPos, blockState, orientation, bl); } } - private int calculateTargetStrength(Level level, BlockPos pos) { + public int getBlockSignal(Level level, BlockPos blockPos) { this.shouldSignal = false; - int i = level.getBestNeighborSignal(pos); + int i = level.getBestNeighborSignal(blockPos); this.shouldSignal = true; - int j = 0; - if (i < 15) { - for (Direction direction : Direction.Plane.HORIZONTAL) { - BlockPos blockPos = pos.relative(direction); - BlockState blockState = level.getBlockState(blockPos); - j = Math.max(j, this.getWireSignal(blockState)); - BlockPos blockPos2 = pos.above(); - if (blockState.isRedstoneConductor(level, blockPos) && !level.getBlockState(blockPos2).isRedstoneConductor(level, blockPos2)) { - j = Math.max(j, this.getWireSignal(level.getBlockState(blockPos.above()))); - } else if (!blockState.isRedstoneConductor(level, blockPos)) { - j = Math.max(j, this.getWireSignal(level.getBlockState(blockPos.below()))); - } - } - } - - return Math.max(i, j - 1); - } - - private int getWireSignal(BlockState state) { - return state.is(this) ? (Integer)state.getValue(POWER) : 0; + return i; } /** @@ -338,7 +325,7 @@ public class RedStoneWireBlock extends Block { @Override protected void onPlace(BlockState state, Level level, BlockPos pos, BlockState oldState, boolean movedByPiston) { if (!oldState.is(state.getBlock()) && !level.isClientSide) { - this.updatePowerStrength(level, pos, state); + this.updatePowerStrength(level, pos, state, null, true); for (Direction direction : Direction.Plane.VERTICAL) { level.updateNeighborsAt(pos.relative(direction), this); @@ -357,7 +344,7 @@ public class RedStoneWireBlock extends Block { level.updateNeighborsAt(pos.relative(direction), this); } - this.updatePowerStrength(level, pos, state); + this.updatePowerStrength(level, pos, state, null, false); this.updateNeighborsOfNeighboringWires(level, pos); } } @@ -379,17 +366,23 @@ public class RedStoneWireBlock extends Block { } @Override - protected void neighborChanged(BlockState state, Level level, BlockPos pos, Block neighborBlock, BlockPos neighborPos, boolean movedByPiston) { + protected void neighborChanged(BlockState blockState, Level level, BlockPos blockPos, Block block, @Nullable Orientation orientation, boolean bl) { if (!level.isClientSide) { - if (state.canSurvive(level, pos)) { - this.updatePowerStrength(level, pos, state); - } else { - dropResources(state, level, pos); - level.removeBlock(pos, false); + if (block != this || !useExperimentalEvaluator(level)) { + if (blockState.canSurvive(level, blockPos)) { + this.updatePowerStrength(level, blockPos, blockState, orientation, false); + } else { + dropResources(blockState, level, blockPos); + level.removeBlock(blockPos, false); + } } } } + private static boolean useExperimentalEvaluator(Level level) { + return level.enabledFeatures().contains(FeatureFlags.REDSTONE_EXPERIMENTS); + } + @Override protected int getDirectSignal(BlockState state, BlockGetter level, BlockPos pos, Direction direction) { return !this.shouldSignal ? 0 : state.getSignal(level, pos, direction); @@ -433,21 +426,20 @@ public class RedStoneWireBlock extends Block { } public static int getColorForPower(int power) { - Vec3 vec3 = COLORS[power]; - return Mth.color((float)vec3.x(), (float)vec3.y(), (float)vec3.z()); + return COLORS[power]; } - private void spawnParticlesAlongLine( - Level level, RandomSource random, BlockPos pos, Vec3 particleVec, Direction xDirection, Direction zDirection, float min, float max + private static void spawnParticlesAlongLine( + Level level, RandomSource randomSource, BlockPos blockPos, int i, Direction direction, Direction direction2, float f, float g ) { - float f = max - min; - if (!(random.nextFloat() >= 0.2F * f)) { - float g = 0.4375F; - float h = min + f * random.nextFloat(); - double d = 0.5 + 0.4375F * xDirection.getStepX() + h * zDirection.getStepX(); - double e = 0.5 + 0.4375F * xDirection.getStepY() + h * zDirection.getStepY(); - double i = 0.5 + 0.4375F * xDirection.getStepZ() + h * zDirection.getStepZ(); - level.addParticle(new DustParticleOptions(particleVec.toVector3f(), 1.0F), pos.getX() + d, pos.getY() + e, pos.getZ() + i, 0.0, 0.0, 0.0); + float h = g - f; + if (!(randomSource.nextFloat() >= 0.2F * h)) { + float j = 0.4375F; + float k = f + h * randomSource.nextFloat(); + double d = 0.5 + 0.4375F * direction.getStepX() + k * direction2.getStepX(); + double e = 0.5 + 0.4375F * direction.getStepY() + k * direction2.getStepY(); + double l = 0.5 + 0.4375F * direction.getStepZ() + k * direction2.getStepZ(); + level.addParticle(new DustParticleOptions(i, 1.0F), blockPos.getX() + d, blockPos.getY() + e, blockPos.getZ() + l, 0.0, 0.0, 0.0); } } @@ -459,13 +451,13 @@ public class RedStoneWireBlock extends Block { RedstoneSide redstoneSide = state.getValue((Property)PROPERTY_BY_DIRECTION.get(direction)); switch (redstoneSide) { case UP: - this.spawnParticlesAlongLine(level, random, pos, COLORS[i], direction, Direction.UP, -0.5F, 0.5F); + spawnParticlesAlongLine(level, random, pos, COLORS[i], direction, Direction.UP, -0.5F, 0.5F); case SIDE: - this.spawnParticlesAlongLine(level, random, pos, COLORS[i], Direction.DOWN, direction, 0.0F, 0.5F); + spawnParticlesAlongLine(level, random, pos, COLORS[i], Direction.DOWN, direction, 0.0F, 0.5F); break; case NONE: default: - this.spawnParticlesAlongLine(level, random, pos, COLORS[i], Direction.DOWN, direction, 0.0F, 0.3F); + spawnParticlesAlongLine(level, random, pos, COLORS[i], Direction.DOWN, direction, 0.0F, 0.3F); } } } @@ -532,12 +524,14 @@ public class RedStoneWireBlock extends Block { } private void updatesOnShapeChange(Level level, BlockPos pos, BlockState oldState, BlockState newState) { + Orientation orientation = ExperimentalRedstoneUtils.initialOrientation(level, null, Direction.UP); + for (Direction direction : Direction.Plane.HORIZONTAL) { BlockPos blockPos = pos.relative(direction); if (((RedstoneSide)oldState.getValue((Property)PROPERTY_BY_DIRECTION.get(direction))).isConnected() != ((RedstoneSide)newState.getValue((Property)PROPERTY_BY_DIRECTION.get(direction))).isConnected() && level.getBlockState(blockPos).isRedstoneConductor(level, blockPos)) { - level.updateNeighborsAtExceptFromFacing(blockPos, newState.getBlock(), direction.getOpposite()); + level.updateNeighborsAtExceptFromFacing(blockPos, newState.getBlock(), direction.getOpposite(), ExperimentalRedstoneUtils.withFront(orientation, direction)); } } } diff --git a/net/minecraft/world/level/block/RedstoneLampBlock.java b/net/minecraft/world/level/block/RedstoneLampBlock.java index e114a538..9e5b2d3c 100644 --- a/net/minecraft/world/level/block/RedstoneLampBlock.java +++ b/net/minecraft/world/level/block/RedstoneLampBlock.java @@ -10,6 +10,7 @@ import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.block.state.properties.BooleanProperty; +import net.minecraft.world.level.redstone.Orientation; import org.jetbrains.annotations.Nullable; public class RedstoneLampBlock extends Block { @@ -33,14 +34,14 @@ public class RedstoneLampBlock extends Block { } @Override - protected void neighborChanged(BlockState state, Level level, BlockPos pos, Block neighborBlock, BlockPos neighborPos, boolean movedByPiston) { + protected void neighborChanged(BlockState blockState, Level level, BlockPos blockPos, Block block, @Nullable Orientation orientation, boolean bl) { if (!level.isClientSide) { - boolean bl = (Boolean)state.getValue(LIT); - if (bl != level.hasNeighborSignal(pos)) { - if (bl) { - level.scheduleTick(pos, this, 4); + boolean bl2 = (Boolean)blockState.getValue(LIT); + if (bl2 != level.hasNeighborSignal(blockPos)) { + if (bl2) { + level.scheduleTick(blockPos, this, 4); } else { - level.setBlock(pos, state.cycle(LIT), 2); + level.setBlock(blockPos, blockState.cycle(LIT), 2); } } } diff --git a/net/minecraft/world/level/block/RedstoneTorchBlock.java b/net/minecraft/world/level/block/RedstoneTorchBlock.java index 15e34d4a..73b90e23 100644 --- a/net/minecraft/world/level/block/RedstoneTorchBlock.java +++ b/net/minecraft/world/level/block/RedstoneTorchBlock.java @@ -17,6 +17,9 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.block.state.properties.BooleanProperty; +import net.minecraft.world.level.redstone.ExperimentalRedstoneUtils; +import net.minecraft.world.level.redstone.Orientation; +import org.jetbrains.annotations.Nullable; public class RedstoneTorchBlock extends BaseTorchBlock { public static final MapCodec CODEC = simpleCodec(RedstoneTorchBlock::new); @@ -39,17 +42,21 @@ public class RedstoneTorchBlock extends BaseTorchBlock { @Override protected void onPlace(BlockState state, Level level, BlockPos pos, BlockState oldState, boolean movedByPiston) { + this.notifyNeighbors(level, pos, state); + } + + private void notifyNeighbors(Level level, BlockPos blockPos, BlockState blockState) { + Orientation orientation = this.randomOrientation(level, blockState); + for (Direction direction : Direction.values()) { - level.updateNeighborsAt(pos.relative(direction), this); + level.updateNeighborsAt(blockPos.relative(direction), this, ExperimentalRedstoneUtils.withFront(orientation, direction)); } } @Override protected void onRemove(BlockState state, Level level, BlockPos pos, BlockState newState, boolean movedByPiston) { if (!movedByPiston) { - for (Direction direction : Direction.values()) { - level.updateNeighborsAt(pos.relative(direction), this); - } + this.notifyNeighbors(level, pos, state); } } @@ -85,9 +92,9 @@ public class RedstoneTorchBlock extends BaseTorchBlock { } @Override - protected void neighborChanged(BlockState state, Level level, BlockPos pos, Block neighborBlock, BlockPos neighborPos, boolean movedByPiston) { - if ((Boolean)state.getValue(LIT) == this.hasNeighborSignal(level, pos, state) && !level.getBlockTicks().willTickThisTick(pos, this)) { - level.scheduleTick(pos, this, 2); + protected void neighborChanged(BlockState blockState, Level level, BlockPos blockPos, Block block, @Nullable Orientation orientation, boolean bl) { + if ((Boolean)blockState.getValue(LIT) == this.hasNeighborSignal(level, blockPos, blockState) && !level.getBlockTicks().willTickThisTick(blockPos, this)) { + level.scheduleTick(blockPos, this, 2); } } @@ -135,6 +142,11 @@ public class RedstoneTorchBlock extends BaseTorchBlock { return false; } + @Nullable + protected Orientation randomOrientation(Level level, BlockState blockState) { + return ExperimentalRedstoneUtils.initialOrientation(level, null, Direction.UP); + } + public static class Toggle { final BlockPos pos; final long when; diff --git a/net/minecraft/world/level/block/RedstoneWallTorchBlock.java b/net/minecraft/world/level/block/RedstoneWallTorchBlock.java index 303efdcb..70ddde3c 100644 --- a/net/minecraft/world/level/block/RedstoneWallTorchBlock.java +++ b/net/minecraft/world/level/block/RedstoneWallTorchBlock.java @@ -8,20 +8,22 @@ import net.minecraft.util.RandomSource; import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; -import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.block.state.properties.BooleanProperty; -import net.minecraft.world.level.block.state.properties.DirectionProperty; +import net.minecraft.world.level.block.state.properties.EnumProperty; +import net.minecraft.world.level.redstone.ExperimentalRedstoneUtils; +import net.minecraft.world.level.redstone.Orientation; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.VoxelShape; import org.jetbrains.annotations.Nullable; public class RedstoneWallTorchBlock extends RedstoneTorchBlock { public static final MapCodec CODEC = simpleCodec(RedstoneWallTorchBlock::new); - public static final DirectionProperty FACING = HorizontalDirectionalBlock.FACING; + public static final EnumProperty FACING = HorizontalDirectionalBlock.FACING; public static final BooleanProperty LIT = RedstoneTorchBlock.LIT; @Override @@ -34,11 +36,6 @@ public class RedstoneWallTorchBlock extends RedstoneTorchBlock { this.registerDefaultState(this.stateDefinition.any().setValue(FACING, Direction.NORTH).setValue(LIT, true)); } - @Override - public String getDescriptionId() { - return this.asItem().getDescriptionId(); - } - @Override protected VoxelShape getShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext context) { return WallTorchBlock.getShape(state); @@ -50,8 +47,17 @@ public class RedstoneWallTorchBlock extends RedstoneTorchBlock { } @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { - return direction.getOpposite() == state.getValue(FACING) && !state.canSurvive(level, pos) ? Blocks.AIR.defaultBlockState() : state; + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { + return direction.getOpposite() == blockState.getValue(FACING) && !blockState.canSurvive(levelReader, blockPos) ? Blocks.AIR.defaultBlockState() : blockState; } @Nullable @@ -98,4 +104,10 @@ public class RedstoneWallTorchBlock extends RedstoneTorchBlock { protected void createBlockStateDefinition(StateDefinition.Builder builder) { builder.add(FACING, LIT); } + + @Nullable + @Override + protected Orientation randomOrientation(Level level, BlockState blockState) { + return ExperimentalRedstoneUtils.initialOrientation(level, ((Direction)blockState.getValue(FACING)).getOpposite(), Direction.UP); + } } diff --git a/net/minecraft/world/level/block/RepeaterBlock.java b/net/minecraft/world/level/block/RepeaterBlock.java index f835e9d2..c9e46336 100644 --- a/net/minecraft/world/level/block/RepeaterBlock.java +++ b/net/minecraft/world/level/block/RepeaterBlock.java @@ -9,8 +9,8 @@ import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.level.Level; -import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; @@ -40,7 +40,7 @@ public class RepeaterBlock extends DiodeBlock { return InteractionResult.PASS; } else { level.setBlock(pos, state.cycle(DELAY), 3); - return InteractionResult.sidedSuccess(level.isClientSide); + return InteractionResult.SUCCESS; } } @@ -56,13 +56,22 @@ public class RepeaterBlock extends DiodeBlock { } @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { - if (direction == Direction.DOWN && !this.canSurviveOn(level, neighborPos, neighborState)) { + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { + if (direction == Direction.DOWN && !this.canSurviveOn(levelReader, blockPos2, blockState2)) { return Blocks.AIR.defaultBlockState(); } else { - return !level.isClientSide() && direction.getAxis() != ((Direction)state.getValue(FACING)).getAxis() - ? state.setValue(LOCKED, this.isLocked(level, pos, state)) - : super.updateShape(state, direction, neighborState, level, pos, neighborPos); + return !levelReader.isClientSide() && direction.getAxis() != ((Direction)blockState.getValue(FACING)).getAxis() + ? blockState.setValue(LOCKED, this.isLocked(levelReader, blockPos, blockState)) + : super.updateShape(blockState, levelReader, scheduledTickAccess, blockPos, direction, blockPos2, blockState2, randomSource); } } diff --git a/net/minecraft/world/level/block/RespawnAnchorBlock.java b/net/minecraft/world/level/block/RespawnAnchorBlock.java index 68b0c393..7bf2b426 100644 --- a/net/minecraft/world/level/block/RespawnAnchorBlock.java +++ b/net/minecraft/world/level/block/RespawnAnchorBlock.java @@ -16,7 +16,6 @@ import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; -import net.minecraft.world.ItemInteractionResult; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.player.Player; @@ -34,6 +33,7 @@ import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.block.state.properties.IntegerProperty; import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.level.gameevent.GameEvent.Context; import net.minecraft.world.level.material.FluidState; import net.minecraft.world.level.pathfinder.PathComputationType; import net.minecraft.world.phys.BlockHitResult; @@ -73,17 +73,19 @@ public class RespawnAnchorBlock extends Block { } @Override - protected ItemInteractionResult useItemOn( - ItemStack stack, BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hitResult + protected InteractionResult useItemOn( + ItemStack itemStack, BlockState blockState, Level level, BlockPos blockPos, Player player, InteractionHand interactionHand, BlockHitResult blockHitResult ) { - if (isRespawnFuel(stack) && canBeCharged(state)) { - charge(player, level, pos, state); - stack.consume(1, player); - return ItemInteractionResult.sidedSuccess(level.isClientSide); + if (isRespawnFuel(itemStack) && canBeCharged(blockState)) { + charge(player, level, blockPos, blockState); + itemStack.consume(1, player); + return InteractionResult.SUCCESS; } else { - return hand == InteractionHand.MAIN_HAND && isRespawnFuel(player.getItemInHand(InteractionHand.OFF_HAND)) && canBeCharged(state) - ? ItemInteractionResult.SKIP_DEFAULT_BLOCK_INTERACTION - : ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION; + return (InteractionResult)(interactionHand == InteractionHand.MAIN_HAND + && isRespawnFuel(player.getItemInHand(InteractionHand.OFF_HAND)) + && canBeCharged(blockState) + ? InteractionResult.PASS + : InteractionResult.TRY_WITH_EMPTY_HAND); } } @@ -96,14 +98,14 @@ public class RespawnAnchorBlock extends Block { this.explode(state, level, pos); } - return InteractionResult.sidedSuccess(level.isClientSide); + return InteractionResult.SUCCESS; } else { if (!level.isClientSide) { ServerPlayer serverPlayer = (ServerPlayer)player; if (serverPlayer.getRespawnDimension() != level.dimension() || !pos.equals(serverPlayer.getRespawnPosition())) { serverPlayer.setRespawnPosition(level.dimension(), pos, 0.0F, false, true); level.playSound(null, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, SoundEvents.RESPAWN_ANCHOR_SET_SPAWN, SoundSource.BLOCKS, 1.0F, 1.0F); - return InteractionResult.SUCCESS; + return InteractionResult.SUCCESS_SERVER; } } @@ -159,7 +161,7 @@ public class RespawnAnchorBlock extends Block { public static void charge(@Nullable Entity entity, Level level, BlockPos pos, BlockState state) { BlockState blockState = state.setValue(CHARGE, (Integer)state.getValue(CHARGE) + 1); level.setBlock(pos, blockState, 3); - level.gameEvent(GameEvent.BLOCK_CHANGE, pos, GameEvent.Context.of(entity, blockState)); + level.gameEvent(GameEvent.BLOCK_CHANGE, pos, Context.of(entity, blockState)); level.playSound(null, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, SoundEvents.RESPAWN_ANCHOR_CHARGE, SoundSource.BLOCKS, 1.0F, 1.0F); } diff --git a/net/minecraft/world/level/block/ScaffoldingBlock.java b/net/minecraft/world/level/block/ScaffoldingBlock.java index 2da9bb82..16a45ae3 100644 --- a/net/minecraft/world/level/block/ScaffoldingBlock.java +++ b/net/minecraft/world/level/block/ScaffoldingBlock.java @@ -9,8 +9,8 @@ import net.minecraft.world.entity.item.FallingBlockEntity; import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; -import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; @@ -88,16 +88,25 @@ public class ScaffoldingBlock extends Block implements SimpleWaterloggedBlock { } @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { - if ((Boolean)state.getValue(WATERLOGGED)) { - level.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(level)); + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { + if ((Boolean)blockState.getValue(WATERLOGGED)) { + scheduledTickAccess.scheduleTick(blockPos, Fluids.WATER, Fluids.WATER.getTickDelay(levelReader)); } - if (!level.isClientSide()) { - level.scheduleTick(pos, this, 1); + if (!levelReader.isClientSide()) { + scheduledTickAccess.scheduleTick(blockPos, this, 1); } - return state; + return blockState; } @Override diff --git a/net/minecraft/world/level/block/SculkSensorBlock.java b/net/minecraft/world/level/block/SculkSensorBlock.java index 91b62c4c..cede5a56 100644 --- a/net/minecraft/world/level/block/SculkSensorBlock.java +++ b/net/minecraft/world/level/block/SculkSensorBlock.java @@ -18,7 +18,8 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; -import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntityTicker; import net.minecraft.world.level.block.entity.BlockEntityType; @@ -32,7 +33,9 @@ import net.minecraft.world.level.block.state.properties.EnumProperty; import net.minecraft.world.level.block.state.properties.IntegerProperty; import net.minecraft.world.level.block.state.properties.SculkSensorPhase; import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.level.gameevent.GameEvent.Context; import net.minecraft.world.level.gameevent.vibrations.VibrationSystem; +import net.minecraft.world.level.gameevent.vibrations.VibrationSystem.Ticker; import net.minecraft.world.level.material.FluidState; import net.minecraft.world.level.material.Fluids; import net.minecraft.world.level.pathfinder.PathComputationType; @@ -100,8 +103,8 @@ public class SculkSensorBlock extends BaseEntityBlock implements SimpleWaterlogg && entity.getType() != EntityType.WARDEN && level.getBlockEntity(pos) instanceof SculkSensorBlockEntity sculkSensorBlockEntity && level instanceof ServerLevel serverLevel - && sculkSensorBlockEntity.getVibrationUser().canReceiveVibration(serverLevel, pos, GameEvent.STEP, GameEvent.Context.of(state))) { - sculkSensorBlockEntity.getListener().forceScheduleVibration(serverLevel, GameEvent.STEP, GameEvent.Context.of(entity), entity.position()); + && sculkSensorBlockEntity.getVibrationUser().canReceiveVibration(serverLevel, pos, GameEvent.STEP, Context.of(state))) { + sculkSensorBlockEntity.getListener().forceScheduleVibration(serverLevel, GameEvent.STEP, Context.of(entity), entity.position()); } super.stepOn(level, pos, state, entity); @@ -127,12 +130,21 @@ public class SculkSensorBlock extends BaseEntityBlock implements SimpleWaterlogg } @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { - if ((Boolean)state.getValue(WATERLOGGED)) { - level.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(level)); + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { + if ((Boolean)blockState.getValue(WATERLOGGED)) { + scheduledTickAccess.scheduleTick(blockPos, Fluids.WATER, Fluids.WATER.getTickDelay(levelReader)); } - return super.updateShape(state, direction, neighborState, level, pos, neighborPos); + return super.updateShape(blockState, levelReader, scheduledTickAccess, blockPos, direction, blockPos2, blockState2, randomSource); } private static void updateNeighbours(Level level, BlockPos pos, BlockState state) { @@ -154,7 +166,7 @@ public class SculkSensorBlock extends BaseEntityBlock implements SimpleWaterlogg ? createTickerHelper( blockEntityType, BlockEntityType.SCULK_SENSOR, - (levelx, blockPos, blockState, sculkSensorBlockEntity) -> VibrationSystem.Ticker.tick( + (levelx, blockPos, blockState, sculkSensorBlockEntity) -> Ticker.tick( levelx, sculkSensorBlockEntity.getVibrationData(), sculkSensorBlockEntity.getVibrationUser() ) ) @@ -223,7 +235,7 @@ public class SculkSensorBlock extends BaseEntityBlock implements SimpleWaterlogg BlockPos blockPos = pos.relative(direction); BlockState blockState = level.getBlockState(blockPos); if (blockState.is(BlockTags.VIBRATION_RESONATORS)) { - level.gameEvent(VibrationSystem.getResonanceEventByFrequency(frequency), blockPos, GameEvent.Context.of(entity, blockState)); + level.gameEvent(VibrationSystem.getResonanceEventByFrequency(frequency), blockPos, Context.of(entity, blockState)); float f = RESONANCE_PITCH_BEND[frequency]; level.playSound(null, blockPos, SoundEvents.AMETHYST_BLOCK_RESONATE, SoundSource.BLOCKS, 1.0F, f); } diff --git a/net/minecraft/world/level/block/SculkShriekerBlock.java b/net/minecraft/world/level/block/SculkShriekerBlock.java index 2dd04256..e032b29c 100644 --- a/net/minecraft/world/level/block/SculkShriekerBlock.java +++ b/net/minecraft/world/level/block/SculkShriekerBlock.java @@ -12,7 +12,8 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; -import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntityTicker; import net.minecraft.world.level.block.entity.BlockEntityType; @@ -22,7 +23,7 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.block.state.properties.BooleanProperty; -import net.minecraft.world.level.gameevent.vibrations.VibrationSystem; +import net.minecraft.world.level.gameevent.vibrations.VibrationSystem.Ticker; import net.minecraft.world.level.material.FluidState; import net.minecraft.world.level.material.Fluids; import net.minecraft.world.phys.shapes.CollisionContext; @@ -95,7 +96,7 @@ public class SculkShriekerBlock extends BaseEntityBlock implements SimpleWaterlo } @Override - protected VoxelShape getOcclusionShape(BlockState state, BlockGetter level, BlockPos pos) { + protected VoxelShape getOcclusionShape(BlockState blockState) { return COLLIDER; } @@ -111,12 +112,21 @@ public class SculkShriekerBlock extends BaseEntityBlock implements SimpleWaterlo } @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { - if ((Boolean)state.getValue(WATERLOGGED)) { - level.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(level)); + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { + if ((Boolean)blockState.getValue(WATERLOGGED)) { + scheduledTickAccess.scheduleTick(blockPos, Fluids.WATER, Fluids.WATER.getTickDelay(levelReader)); } - return super.updateShape(state, direction, neighborState, level, pos, neighborPos); + return super.updateShape(blockState, levelReader, scheduledTickAccess, blockPos, direction, blockPos2, blockState2, randomSource); } @Nullable @@ -145,7 +155,7 @@ public class SculkShriekerBlock extends BaseEntityBlock implements SimpleWaterlo ? BaseEntityBlock.createTickerHelper( blockEntityType, BlockEntityType.SCULK_SHRIEKER, - (levelx, blockPos, blockState, sculkShriekerBlockEntity) -> VibrationSystem.Ticker.tick( + (levelx, blockPos, blockState, sculkShriekerBlockEntity) -> Ticker.tick( levelx, sculkShriekerBlockEntity.getVibrationData(), sculkShriekerBlockEntity.getVibrationUser() ) ) diff --git a/net/minecraft/world/level/block/SculkSpreader.java b/net/minecraft/world/level/block/SculkSpreader.java index 345cd909..14578e54 100644 --- a/net/minecraft/world/level/block/SculkSpreader.java +++ b/net/minecraft/world/level/block/SculkSpreader.java @@ -41,6 +41,7 @@ public class SculkSpreader { public static final float MAX_DECAY_FACTOR = 0.5F; private static final int MAX_CURSORS = 32; public static final int SHRIEKER_PLACEMENT_RATE = 11; + public static final int MAX_CURSOR_DISTANCE = 1024; final boolean isWorldGeneration; private final TagKey replaceableBlocks; private final int growthSpawnCost; @@ -147,22 +148,24 @@ public class SculkSpreader { Object2IntMap object2IntMap = new Object2IntOpenHashMap<>(); for (SculkSpreader.ChargeCursor chargeCursor : this.cursors) { - chargeCursor.update(level, pos, random, this, shouldConvertBlocks); - if (chargeCursor.charge <= 0) { - level.levelEvent(3006, chargeCursor.getPos(), 0); - } else { - BlockPos blockPos = chargeCursor.getPos(); - object2IntMap.computeInt(blockPos, (blockPosx, integer) -> (integer == null ? 0 : integer) + chargeCursor.charge); - SculkSpreader.ChargeCursor chargeCursor2 = (SculkSpreader.ChargeCursor)map.get(blockPos); - if (chargeCursor2 == null) { - map.put(blockPos, chargeCursor); - list.add(chargeCursor); - } else if (!this.isWorldGeneration() && chargeCursor.charge + chargeCursor2.charge <= 1000) { - chargeCursor2.mergeWith(chargeCursor); + if (!chargeCursor.isPosUnreasonable(pos)) { + chargeCursor.update(level, pos, random, this, shouldConvertBlocks); + if (chargeCursor.charge <= 0) { + level.levelEvent(3006, chargeCursor.getPos(), 0); } else { - list.add(chargeCursor); - if (chargeCursor.charge < chargeCursor2.charge) { + BlockPos blockPos = chargeCursor.getPos(); + object2IntMap.computeInt(blockPos, (blockPosx, integer) -> (integer == null ? 0 : integer) + chargeCursor.charge); + SculkSpreader.ChargeCursor chargeCursor2 = (SculkSpreader.ChargeCursor)map.get(blockPos); + if (chargeCursor2 == null) { map.put(blockPos, chargeCursor); + list.add(chargeCursor); + } else if (!this.isWorldGeneration() && chargeCursor.charge + chargeCursor2.charge <= 1000) { + chargeCursor2.mergeWith(chargeCursor); + } else { + list.add(chargeCursor); + if (chargeCursor.charge < chargeCursor2.charge) { + map.put(blockPos, chargeCursor); + } } } } @@ -227,6 +230,10 @@ public class SculkSpreader { return this.pos; } + boolean isPosUnreasonable(BlockPos blockPos) { + return this.pos.distChessboard(blockPos) > 1024; + } + public int getCharge() { return this.charge; } diff --git a/net/minecraft/world/level/block/SculkVeinBlock.java b/net/minecraft/world/level/block/SculkVeinBlock.java index c41403c4..701b7a63 100644 --- a/net/minecraft/world/level/block/SculkVeinBlock.java +++ b/net/minecraft/world/level/block/SculkVeinBlock.java @@ -14,6 +14,10 @@ import net.minecraft.world.item.Items; import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; +import net.minecraft.world.level.block.MultifaceSpreader.DefaultSpreaderConfig; +import net.minecraft.world.level.block.MultifaceSpreader.SpreadType; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; @@ -26,9 +30,7 @@ public class SculkVeinBlock extends MultifaceBlock implements SculkBehaviour, Si public static final MapCodec CODEC = simpleCodec(SculkVeinBlock::new); private static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED; private final MultifaceSpreader veinSpreader = new MultifaceSpreader(new SculkVeinBlock.SculkVeinSpreaderConfig(MultifaceSpreader.DEFAULT_SPREAD_ORDER)); - private final MultifaceSpreader sameSpaceSpreader = new MultifaceSpreader( - new SculkVeinBlock.SculkVeinSpreaderConfig(MultifaceSpreader.SpreadType.SAME_POSITION) - ); + private final MultifaceSpreader sameSpaceSpreader = new MultifaceSpreader(new SculkVeinBlock.SculkVeinSpreaderConfig(SpreadType.SAME_POSITION)); @Override public MapCodec codec() { @@ -153,12 +155,21 @@ public class SculkVeinBlock extends MultifaceBlock implements SculkBehaviour, Si } @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { - if ((Boolean)state.getValue(WATERLOGGED)) { - level.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(level)); + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { + if ((Boolean)blockState.getValue(WATERLOGGED)) { + scheduledTickAccess.scheduleTick(blockPos, Fluids.WATER, Fluids.WATER.getTickDelay(levelReader)); } - return super.updateShape(state, direction, neighborState, level, pos, neighborPos); + return super.updateShape(blockState, levelReader, scheduledTickAccess, blockPos, direction, blockPos2, blockState2, randomSource); } @Override @@ -177,10 +188,10 @@ public class SculkVeinBlock extends MultifaceBlock implements SculkBehaviour, Si return state.getValue(WATERLOGGED) ? Fluids.WATER.getSource(false) : super.getFluidState(state); } - class SculkVeinSpreaderConfig extends MultifaceSpreader.DefaultSpreaderConfig { - private final MultifaceSpreader.SpreadType[] spreadTypes; + class SculkVeinSpreaderConfig extends DefaultSpreaderConfig { + private final SpreadType[] spreadTypes; - public SculkVeinSpreaderConfig(final MultifaceSpreader.SpreadType... spreadTypes) { + public SculkVeinSpreaderConfig(final SpreadType... spreadTypes) { super(SculkVeinBlock.this); this.spreadTypes = spreadTypes; } @@ -208,7 +219,7 @@ public class SculkVeinBlock extends MultifaceBlock implements SculkBehaviour, Si } @Override - public MultifaceSpreader.SpreadType[] getSpreadTypes() { + public SpreadType[] getSpreadTypes() { return this.spreadTypes; } diff --git a/net/minecraft/world/level/block/SeaPickleBlock.java b/net/minecraft/world/level/block/SeaPickleBlock.java index 4afd33bd..8e1f1359 100644 --- a/net/minecraft/world/level/block/SeaPickleBlock.java +++ b/net/minecraft/world/level/block/SeaPickleBlock.java @@ -9,8 +9,8 @@ import net.minecraft.util.RandomSource; import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; -import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; @@ -73,15 +73,24 @@ public class SeaPickleBlock extends BushBlock implements BonemealableBlock, Simp } @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { - if (!state.canSurvive(level, pos)) { + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { + if (!blockState.canSurvive(levelReader, blockPos)) { return Blocks.AIR.defaultBlockState(); } else { - if ((Boolean)state.getValue(WATERLOGGED)) { - level.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(level)); + if ((Boolean)blockState.getValue(WATERLOGGED)) { + scheduledTickAccess.scheduleTick(blockPos, Fluids.WATER, Fluids.WATER.getTickDelay(levelReader)); } - return super.updateShape(state, direction, neighborState, level, pos, neighborPos); + return super.updateShape(blockState, levelReader, scheduledTickAccess, blockPos, direction, blockPos2, blockState2, randomSource); } } @@ -119,7 +128,7 @@ public class SeaPickleBlock extends BushBlock implements BonemealableBlock, Simp @Override public boolean isValidBonemealTarget(LevelReader level, BlockPos pos, BlockState state) { - return true; + return !isDead(state) && level.getBlockState(pos.below()).is(BlockTags.CORAL_BLOCKS); } @Override @@ -129,42 +138,40 @@ public class SeaPickleBlock extends BushBlock implements BonemealableBlock, Simp @Override public void performBonemeal(ServerLevel level, RandomSource random, BlockPos pos, BlockState state) { - if (!isDead(state) && level.getBlockState(pos.below()).is(BlockTags.CORAL_BLOCKS)) { - int i = 5; - int j = 1; - int k = 2; - int l = 0; - int m = pos.getX() - 2; - int n = 0; + int i = 5; + int j = 1; + int k = 2; + int l = 0; + int m = pos.getX() - 2; + int n = 0; - for (int o = 0; o < 5; o++) { - for (int p = 0; p < j; p++) { - int q = 2 + pos.getY() - 1; + for (int o = 0; o < 5; o++) { + for (int p = 0; p < j; p++) { + int q = 2 + pos.getY() - 1; - for (int r = q - 2; r < q; r++) { - BlockPos blockPos = new BlockPos(m + o, r, pos.getZ() - n + p); - if (blockPos != pos && random.nextInt(6) == 0 && level.getBlockState(blockPos).is(Blocks.WATER)) { - BlockState blockState = level.getBlockState(blockPos.below()); - if (blockState.is(BlockTags.CORAL_BLOCKS)) { - level.setBlock(blockPos, Blocks.SEA_PICKLE.defaultBlockState().setValue(PICKLES, random.nextInt(4) + 1), 3); - } + for (int r = q - 2; r < q; r++) { + BlockPos blockPos = new BlockPos(m + o, r, pos.getZ() - n + p); + if (blockPos != pos && random.nextInt(6) == 0 && level.getBlockState(blockPos).is(Blocks.WATER)) { + BlockState blockState = level.getBlockState(blockPos.below()); + if (blockState.is(BlockTags.CORAL_BLOCKS)) { + level.setBlock(blockPos, Blocks.SEA_PICKLE.defaultBlockState().setValue(PICKLES, random.nextInt(4) + 1), 3); } } } - - if (l < 2) { - j += 2; - n++; - } else { - j -= 2; - n--; - } - - l++; } - level.setBlock(pos, state.setValue(PICKLES, 4), 2); + if (l < 2) { + j += 2; + n++; + } else { + j -= 2; + n--; + } + + l++; } + + level.setBlock(pos, state.setValue(PICKLES, 4), 2); } @Override diff --git a/net/minecraft/world/level/block/SeagrassBlock.java b/net/minecraft/world/level/block/SeagrassBlock.java index 52679ee1..ee9f42dd 100644 --- a/net/minecraft/world/level/block/SeagrassBlock.java +++ b/net/minecraft/world/level/block/SeagrassBlock.java @@ -12,6 +12,7 @@ import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.properties.DoubleBlockHalf; @@ -54,18 +55,27 @@ public class SeagrassBlock extends BushBlock implements BonemealableBlock, Liqui } @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { - BlockState blockState = super.updateShape(state, direction, neighborState, level, pos, neighborPos); - if (!blockState.isAir()) { - level.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(level)); + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { + BlockState blockState3 = super.updateShape(blockState, levelReader, scheduledTickAccess, blockPos, direction, blockPos2, blockState2, randomSource); + if (!blockState3.isAir()) { + scheduledTickAccess.scheduleTick(blockPos, Fluids.WATER, Fluids.WATER.getTickDelay(levelReader)); } - return blockState; + return blockState3; } @Override public boolean isValidBonemealTarget(LevelReader level, BlockPos pos, BlockState state) { - return true; + return level.getBlockState(pos.above()).is(Blocks.WATER); } @Override @@ -83,10 +93,8 @@ public class SeagrassBlock extends BushBlock implements BonemealableBlock, Liqui BlockState blockState = Blocks.TALL_SEAGRASS.defaultBlockState(); BlockState blockState2 = blockState.setValue(TallSeagrassBlock.HALF, DoubleBlockHalf.UPPER); BlockPos blockPos = pos.above(); - if (level.getBlockState(blockPos).is(Blocks.WATER)) { - level.setBlock(pos, blockState, 2); - level.setBlock(blockPos, blockState2, 2); - } + level.setBlock(pos, blockState, 2); + level.setBlock(blockPos, blockState2, 2); } @Override diff --git a/net/minecraft/world/level/block/ShulkerBoxBlock.java b/net/minecraft/world/level/block/ShulkerBoxBlock.java index 4a9acf6a..e7558098 100644 --- a/net/minecraft/world/level/block/ShulkerBoxBlock.java +++ b/net/minecraft/world/level/block/ShulkerBoxBlock.java @@ -13,6 +13,7 @@ import net.minecraft.core.Direction; import net.minecraft.core.component.DataComponents; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.level.ServerLevel; import net.minecraft.stats.Stats; import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.item.ItemEntity; @@ -33,6 +34,7 @@ import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntityTicker; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.entity.ShulkerBoxBlockEntity; +import net.minecraft.world.level.block.entity.ShulkerBoxBlockEntity.AnimationStatus; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; @@ -103,25 +105,19 @@ public class ShulkerBoxBlock extends BaseEntityBlock { @Override protected InteractionResult useWithoutItem(BlockState state, Level level, BlockPos pos, Player player, BlockHitResult hitResult) { - if (level.isClientSide) { - return InteractionResult.SUCCESS; - } else if (player.isSpectator()) { - return InteractionResult.CONSUME; - } else if (level.getBlockEntity(pos) instanceof ShulkerBoxBlockEntity shulkerBoxBlockEntity) { - if (canOpen(state, level, pos, shulkerBoxBlockEntity)) { - player.openMenu(shulkerBoxBlockEntity); - player.awardStat(Stats.OPEN_SHULKER_BOX); - PiglinAi.angerNearbyPiglins(player, true); - } - - return InteractionResult.CONSUME; - } else { - return InteractionResult.PASS; + if (level instanceof ServerLevel serverLevel + && level.getBlockEntity(pos) instanceof ShulkerBoxBlockEntity shulkerBoxBlockEntity + && canOpen(state, level, pos, shulkerBoxBlockEntity)) { + player.openMenu(shulkerBoxBlockEntity); + player.awardStat(Stats.OPEN_SHULKER_BOX); + PiglinAi.angerNearbyPiglins(serverLevel, player, true); } + + return InteractionResult.SUCCESS; } private static boolean canOpen(BlockState state, Level level, BlockPos pos, ShulkerBoxBlockEntity blockEntity) { - if (blockEntity.getAnimationStatus() != ShulkerBoxBlockEntity.AnimationStatus.CLOSED) { + if (blockEntity.getAnimationStatus() != AnimationStatus.CLOSED) { return true; } else { AABB aABB = Shulker.getProgressDeltaAabb(1.0F, state.getValue(FACING), 0.0F, 0.5F).move(pos).deflate(1.0E-6); @@ -219,7 +215,7 @@ public class ShulkerBoxBlock extends BaseEntityBlock { } @Override - protected boolean propagatesSkylightDown(BlockState state, BlockGetter level, BlockPos pos) { + protected boolean propagatesSkylightDown(BlockState blockState) { return false; } diff --git a/net/minecraft/world/level/block/SignBlock.java b/net/minecraft/world/level/block/SignBlock.java index 6ceaf329..3a6e88e6 100644 --- a/net/minecraft/world/level/block/SignBlock.java +++ b/net/minecraft/world/level/block/SignBlock.java @@ -10,15 +10,16 @@ import net.minecraft.network.chat.CommonComponents; import net.minecraft.network.chat.contents.PlainTextContents; import net.minecraft.sounds.SoundSource; import net.minecraft.stats.Stats; +import net.minecraft.util.RandomSource; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; -import net.minecraft.world.ItemInteractionResult; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.SignApplicator; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; -import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntityTicker; import net.minecraft.world.level.block.entity.BlockEntityType; @@ -30,6 +31,7 @@ import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.block.state.properties.BooleanProperty; import net.minecraft.world.level.block.state.properties.WoodType; import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.level.gameevent.GameEvent.Context; import net.minecraft.world.level.material.FluidState; import net.minecraft.world.level.material.Fluids; import net.minecraft.world.phys.BlockHitResult; @@ -53,12 +55,21 @@ public abstract class SignBlock extends BaseEntityBlock implements SimpleWaterlo protected abstract MapCodec codec(); @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { - if ((Boolean)state.getValue(WATERLOGGED)) { - level.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(level)); + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { + if ((Boolean)blockState.getValue(WATERLOGGED)) { + scheduledTickAccess.scheduleTick(blockPos, Fluids.WATER, Fluids.WATER.getTickDelay(levelReader)); } - return super.updateShape(state, direction, neighborState, level, pos, neighborPos); + return super.updateShape(blockState, levelReader, scheduledTickAccess, blockPos, direction, blockPos2, blockState2, randomSource); } @Override @@ -77,32 +88,32 @@ public abstract class SignBlock extends BaseEntityBlock implements SimpleWaterlo } @Override - protected ItemInteractionResult useItemOn( - ItemStack stack, BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hitResult + protected InteractionResult useItemOn( + ItemStack itemStack, BlockState blockState, Level level, BlockPos blockPos, Player player, InteractionHand interactionHand, BlockHitResult blockHitResult ) { - if (level.getBlockEntity(pos) instanceof SignBlockEntity signBlockEntity) { - SignApplicator signApplicator2 = stack.getItem() instanceof SignApplicator signApplicator ? signApplicator : null; + if (level.getBlockEntity(blockPos) instanceof SignBlockEntity signBlockEntity) { + SignApplicator signApplicator2 = itemStack.getItem() instanceof SignApplicator signApplicator ? signApplicator : null; boolean bl = signApplicator2 != null && player.mayBuild(); if (!level.isClientSide) { if (bl && !signBlockEntity.isWaxed() && !this.otherPlayerIsEditingSign(player, signBlockEntity)) { boolean bl2 = signBlockEntity.isFacingFrontText(player); if (signApplicator2.canApplyToSign(signBlockEntity.getText(bl2), player) && signApplicator2.tryApplyToSign(level, signBlockEntity, bl2, player)) { - signBlockEntity.executeClickCommandsIfPresent(player, level, pos, bl2); - player.awardStat(Stats.ITEM_USED.get(stack.getItem())); - level.gameEvent(GameEvent.BLOCK_CHANGE, signBlockEntity.getBlockPos(), GameEvent.Context.of(player, signBlockEntity.getBlockState())); - stack.consume(1, player); - return ItemInteractionResult.SUCCESS; + signBlockEntity.executeClickCommandsIfPresent(player, level, blockPos, bl2); + player.awardStat(Stats.ITEM_USED.get(itemStack.getItem())); + level.gameEvent(GameEvent.BLOCK_CHANGE, signBlockEntity.getBlockPos(), Context.of(player, signBlockEntity.getBlockState())); + itemStack.consume(1, player); + return InteractionResult.SUCCESS; } else { - return ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION; + return InteractionResult.TRY_WITH_EMPTY_HAND; } } else { - return ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION; + return InteractionResult.TRY_WITH_EMPTY_HAND; } } else { - return !bl && !signBlockEntity.isWaxed() ? ItemInteractionResult.CONSUME : ItemInteractionResult.SUCCESS; + return !bl && !signBlockEntity.isWaxed() ? InteractionResult.CONSUME : InteractionResult.SUCCESS; } } else { - return ItemInteractionResult.SKIP_DEFAULT_BLOCK_INTERACTION; + return InteractionResult.PASS; } } @@ -117,12 +128,12 @@ public abstract class SignBlock extends BaseEntityBlock implements SimpleWaterlo boolean bl2 = signBlockEntity.executeClickCommandsIfPresent(player, level, pos, bl); if (signBlockEntity.isWaxed()) { level.playSound(null, signBlockEntity.getBlockPos(), signBlockEntity.getSignInteractionFailedSoundEvent(), SoundSource.BLOCKS); - return InteractionResult.SUCCESS; + return InteractionResult.SUCCESS_SERVER; } else if (bl2) { - return InteractionResult.SUCCESS; + return InteractionResult.SUCCESS_SERVER; } else if (!this.otherPlayerIsEditingSign(player, signBlockEntity) && player.mayBuild() && this.hasEditableText(player, signBlockEntity, bl)) { this.openTextEdit(player, signBlockEntity, bl); - return InteractionResult.SUCCESS; + return InteractionResult.SUCCESS_SERVER; } else { return InteractionResult.PASS; } diff --git a/net/minecraft/world/level/block/SkullBlock.java b/net/minecraft/world/level/block/SkullBlock.java index 41ad5236..944e7ba5 100644 --- a/net/minecraft/world/level/block/SkullBlock.java +++ b/net/minecraft/world/level/block/SkullBlock.java @@ -45,7 +45,7 @@ public class SkullBlock extends AbstractSkullBlock { } @Override - protected VoxelShape getOcclusionShape(BlockState state, BlockGetter level, BlockPos pos) { + protected VoxelShape getOcclusionShape(BlockState blockState) { return Shapes.empty(); } diff --git a/net/minecraft/world/level/block/SlabBlock.java b/net/minecraft/world/level/block/SlabBlock.java index 05fcff26..d3f4eb7f 100644 --- a/net/minecraft/world/level/block/SlabBlock.java +++ b/net/minecraft/world/level/block/SlabBlock.java @@ -4,11 +4,14 @@ import com.mojang.serialization.MapCodec; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.tags.FluidTags; +import net.minecraft.util.RandomSource; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; @@ -115,12 +118,21 @@ public class SlabBlock extends Block implements SimpleWaterloggedBlock { } @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { - if ((Boolean)state.getValue(WATERLOGGED)) { - level.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(level)); + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { + if ((Boolean)blockState.getValue(WATERLOGGED)) { + scheduledTickAccess.scheduleTick(blockPos, Fluids.WATER, Fluids.WATER.getTickDelay(levelReader)); } - return super.updateShape(state, direction, neighborState, level, pos, neighborPos); + return super.updateShape(blockState, levelReader, scheduledTickAccess, blockPos, direction, blockPos2, blockState2, randomSource); } @Override diff --git a/net/minecraft/world/level/block/SlimeBlock.java b/net/minecraft/world/level/block/SlimeBlock.java index 1fb83196..8450ed26 100644 --- a/net/minecraft/world/level/block/SlimeBlock.java +++ b/net/minecraft/world/level/block/SlimeBlock.java @@ -24,17 +24,15 @@ public class SlimeBlock extends HalfTransparentBlock { @Override public void fallOn(Level level, BlockState state, BlockPos pos, Entity entity, float fallDistance) { - if (entity.isSuppressingBounce()) { - super.fallOn(level, state, pos, entity, fallDistance); - } else { + if (!entity.isSuppressingBounce()) { entity.causeFallDamage(fallDistance, 0.0F, level.damageSources().fall()); } } @Override - public void updateEntityAfterFallOn(BlockGetter level, Entity entity) { + public void updateEntityMovementAfterFallOn(BlockGetter blockGetter, Entity entity) { if (entity.isSuppressingBounce()) { - super.updateEntityAfterFallOn(level, entity); + super.updateEntityMovementAfterFallOn(blockGetter, entity); } else { this.bounceUp(entity); } diff --git a/net/minecraft/world/level/block/SmallDripleafBlock.java b/net/minecraft/world/level/block/SmallDripleafBlock.java index f4cb1947..86aad6c8 100644 --- a/net/minecraft/world/level/block/SmallDripleafBlock.java +++ b/net/minecraft/world/level/block/SmallDripleafBlock.java @@ -11,15 +11,15 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; -import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.block.state.properties.BooleanProperty; -import net.minecraft.world.level.block.state.properties.DirectionProperty; import net.minecraft.world.level.block.state.properties.DoubleBlockHalf; +import net.minecraft.world.level.block.state.properties.EnumProperty; import net.minecraft.world.level.material.FluidState; import net.minecraft.world.level.material.Fluids; import net.minecraft.world.phys.shapes.CollisionContext; @@ -29,7 +29,7 @@ import org.jetbrains.annotations.Nullable; public class SmallDripleafBlock extends DoublePlantBlock implements BonemealableBlock, SimpleWaterloggedBlock { public static final MapCodec CODEC = simpleCodec(SmallDripleafBlock::new); private static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED; - public static final DirectionProperty FACING = BlockStateProperties.HORIZONTAL_FACING; + public static final EnumProperty FACING = BlockStateProperties.HORIZONTAL_FACING; protected static final float AABB_OFFSET = 6.0F; protected static final VoxelShape SHAPE = Block.box(2.0, 0.0, 2.0, 14.0, 13.0, 14.0); @@ -90,12 +90,21 @@ public class SmallDripleafBlock extends DoublePlantBlock implements Bonemealable } @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { - if ((Boolean)state.getValue(WATERLOGGED)) { - level.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(level)); + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { + if ((Boolean)blockState.getValue(WATERLOGGED)) { + scheduledTickAccess.scheduleTick(blockPos, Fluids.WATER, Fluids.WATER.getTickDelay(levelReader)); } - return super.updateShape(state, direction, neighborState, level, pos, neighborPos); + return super.updateShape(blockState, levelReader, scheduledTickAccess, blockPos, direction, blockPos2, blockState2, randomSource); } @Override diff --git a/net/minecraft/world/level/block/SmithingTableBlock.java b/net/minecraft/world/level/block/SmithingTableBlock.java index ce02a9a9..5ea81dbc 100644 --- a/net/minecraft/world/level/block/SmithingTableBlock.java +++ b/net/minecraft/world/level/block/SmithingTableBlock.java @@ -35,12 +35,11 @@ public class SmithingTableBlock extends CraftingTableBlock { @Override protected InteractionResult useWithoutItem(BlockState state, Level level, BlockPos pos, Player player, BlockHitResult hitResult) { - if (level.isClientSide) { - return InteractionResult.SUCCESS; - } else { + if (!level.isClientSide) { player.openMenu(state.getMenuProvider(level, pos)); player.awardStat(Stats.INTERACT_WITH_SMITHING_TABLE); - return InteractionResult.CONSUME; } + + return InteractionResult.SUCCESS; } } diff --git a/net/minecraft/world/level/block/SnifferEggBlock.java b/net/minecraft/world/level/block/SnifferEggBlock.java index 73e11f43..d59a943c 100644 --- a/net/minecraft/world/level/block/SnifferEggBlock.java +++ b/net/minecraft/world/level/block/SnifferEggBlock.java @@ -8,6 +8,7 @@ import net.minecraft.sounds.SoundSource; import net.minecraft.tags.BlockTags; import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.animal.sniffer.Sniffer; import net.minecraft.world.level.BlockGetter; @@ -18,6 +19,7 @@ import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.block.state.properties.IntegerProperty; import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.level.gameevent.GameEvent.Context; import net.minecraft.world.level.pathfinder.PathComputationType; import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.shapes.CollisionContext; @@ -68,7 +70,7 @@ public class SnifferEggBlock extends Block { } else { level.playSound(null, pos, SoundEvents.SNIFFER_EGG_HATCH, SoundSource.BLOCKS, 0.7F, 0.9F + random.nextFloat() * 0.2F); level.destroyBlock(pos, false); - Sniffer sniffer = EntityType.SNIFFER.create(level); + Sniffer sniffer = EntityType.SNIFFER.create(level, EntitySpawnReason.BREEDING); if (sniffer != null) { Vec3 vec3 = pos.getCenter(); sniffer.setBaby(true); @@ -87,7 +89,7 @@ public class SnifferEggBlock extends Block { int i = bl ? 12000 : 24000; int j = i / 3; - level.gameEvent(GameEvent.BLOCK_PLACE, pos, GameEvent.Context.of(state)); + level.gameEvent(GameEvent.BLOCK_PLACE, pos, Context.of(state)); level.scheduleTick(pos, this, j + level.random.nextInt(300)); } diff --git a/net/minecraft/world/level/block/SnowLayerBlock.java b/net/minecraft/world/level/block/SnowLayerBlock.java index f3636454..97a3b8c1 100644 --- a/net/minecraft/world/level/block/SnowLayerBlock.java +++ b/net/minecraft/world/level/block/SnowLayerBlock.java @@ -8,9 +8,9 @@ import net.minecraft.tags.BlockTags; import net.minecraft.util.RandomSource; import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.level.BlockGetter; -import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.LevelReader; import net.minecraft.world.level.LightLayer; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; @@ -106,8 +106,19 @@ public class SnowLayerBlock extends Block { } @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { - return !state.canSurvive(level, pos) ? Blocks.AIR.defaultBlockState() : super.updateShape(state, direction, neighborState, level, pos, neighborPos); + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { + return !blockState.canSurvive(levelReader, blockPos) + ? Blocks.AIR.defaultBlockState() + : super.updateShape(blockState, levelReader, scheduledTickAccess, blockPos, direction, blockPos2, blockState2, randomSource); } @Override diff --git a/net/minecraft/world/level/block/SnowyDirtBlock.java b/net/minecraft/world/level/block/SnowyDirtBlock.java index 6ae53e2d..13d7dfa2 100644 --- a/net/minecraft/world/level/block/SnowyDirtBlock.java +++ b/net/minecraft/world/level/block/SnowyDirtBlock.java @@ -4,8 +4,10 @@ import com.mojang.serialization.MapCodec; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.tags.BlockTags; +import net.minecraft.util.RandomSource; import net.minecraft.world.item.context.BlockPlaceContext; -import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; @@ -27,10 +29,19 @@ public class SnowyDirtBlock extends Block { } @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { return direction == Direction.UP - ? state.setValue(SNOWY, isSnowySetting(neighborState)) - : super.updateShape(state, direction, neighborState, level, pos, neighborPos); + ? blockState.setValue(SNOWY, isSnowySetting(blockState2)) + : super.updateShape(blockState, levelReader, scheduledTickAccess, blockPos, direction, blockPos2, blockState2, randomSource); } @Override diff --git a/net/minecraft/world/level/block/SoulFireBlock.java b/net/minecraft/world/level/block/SoulFireBlock.java index f394dc18..d20c34e6 100644 --- a/net/minecraft/world/level/block/SoulFireBlock.java +++ b/net/minecraft/world/level/block/SoulFireBlock.java @@ -4,8 +4,9 @@ import com.mojang.serialization.MapCodec; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.tags.BlockTags; -import net.minecraft.world.level.LevelAccessor; +import net.minecraft.util.RandomSource; import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; @@ -22,8 +23,17 @@ public class SoulFireBlock extends BaseFireBlock { } @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { - return this.canSurvive(state, level, pos) ? this.defaultBlockState() : Blocks.AIR.defaultBlockState(); + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { + return this.canSurvive(blockState, levelReader, blockPos) ? this.defaultBlockState() : Blocks.AIR.defaultBlockState(); } @Override diff --git a/net/minecraft/world/level/block/SoulSandBlock.java b/net/minecraft/world/level/block/SoulSandBlock.java index 5f30ce31..bf4ad3ea 100644 --- a/net/minecraft/world/level/block/SoulSandBlock.java +++ b/net/minecraft/world/level/block/SoulSandBlock.java @@ -7,7 +7,8 @@ import net.minecraft.server.level.ServerLevel; import net.minecraft.util.RandomSource; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; -import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.pathfinder.PathComputationType; @@ -50,12 +51,21 @@ public class SoulSandBlock extends Block { } @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { - if (direction == Direction.UP && neighborState.is(Blocks.WATER)) { - level.scheduleTick(pos, this, 20); + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { + if (direction == Direction.UP && blockState2.is(Blocks.WATER)) { + scheduledTickAccess.scheduleTick(blockPos, this, 20); } - return super.updateShape(state, direction, neighborState, level, pos, neighborPos); + return super.updateShape(blockState, levelReader, scheduledTickAccess, blockPos, direction, blockPos2, blockState2, randomSource); } @Override diff --git a/net/minecraft/world/level/block/SoundType.java b/net/minecraft/world/level/block/SoundType.java index 68bf6b49..9c4aeff9 100644 --- a/net/minecraft/world/level/block/SoundType.java +++ b/net/minecraft/world/level/block/SoundType.java @@ -695,12 +695,24 @@ public class SoundType { public static final SoundType VAULT = new SoundType( 1.0F, 1.0F, SoundEvents.VAULT_BREAK, SoundEvents.VAULT_STEP, SoundEvents.VAULT_PLACE, SoundEvents.VAULT_HIT, SoundEvents.VAULT_FALL ); + public static final SoundType CREAKING_HEART = new SoundType( + 1.0F, + 1.0F, + SoundEvents.CREAKING_HEART_BREAK, + SoundEvents.CREAKING_HEART_STEP, + SoundEvents.CREAKING_HEART_PLACE, + SoundEvents.CREAKING_HEART_HIT, + SoundEvents.CREAKING_HEART_FALL + ); public static final SoundType HEAVY_CORE = new SoundType( 1.0F, 1.0F, SoundEvents.HEAVY_CORE_BREAK, SoundEvents.HEAVY_CORE_STEP, SoundEvents.HEAVY_CORE_PLACE, SoundEvents.HEAVY_CORE_HIT, SoundEvents.HEAVY_CORE_FALL ); public static final SoundType COBWEB = new SoundType( 1.0F, 1.0F, SoundEvents.COBWEB_BREAK, SoundEvents.COBWEB_STEP, SoundEvents.COBWEB_PLACE, SoundEvents.COBWEB_HIT, SoundEvents.COBWEB_FALL ); + public static final SoundType SPAWNER = new SoundType( + 1.0F, 1.0F, SoundEvents.SPAWNER_BREAK, SoundEvents.SPAWNER_STEP, SoundEvents.SPAWNER_PLACE, SoundEvents.SPAWNER_HIT, SoundEvents.SPAWNER_FALL + ); public final float volume; public final float pitch; private final SoundEvent breakSound; diff --git a/net/minecraft/world/level/block/SpongeBlock.java b/net/minecraft/world/level/block/SpongeBlock.java index 0ed24503..538999f5 100644 --- a/net/minecraft/world/level/block/SpongeBlock.java +++ b/net/minecraft/world/level/block/SpongeBlock.java @@ -11,6 +11,8 @@ import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.material.FluidState; +import net.minecraft.world.level.redstone.Orientation; +import org.jetbrains.annotations.Nullable; public class SpongeBlock extends Block { public static final MapCodec CODEC = simpleCodec(SpongeBlock::new); @@ -35,9 +37,9 @@ public class SpongeBlock extends Block { } @Override - protected void neighborChanged(BlockState state, Level level, BlockPos pos, Block neighborBlock, BlockPos neighborPos, boolean movedByPiston) { - this.tryAbsorbWater(level, pos); - super.neighborChanged(state, level, pos, neighborBlock, neighborPos, movedByPiston); + protected void neighborChanged(BlockState blockState, Level level, BlockPos blockPos, Block block, @Nullable Orientation orientation, boolean bl) { + this.tryAbsorbWater(level, blockPos); + super.neighborChanged(blockState, level, blockPos, block, orientation, bl); } protected void tryAbsorbWater(Level level, BlockPos pos) { diff --git a/net/minecraft/world/level/block/SporeBlossomBlock.java b/net/minecraft/world/level/block/SporeBlossomBlock.java index 73a98ab7..fe3dd429 100644 --- a/net/minecraft/world/level/block/SporeBlossomBlock.java +++ b/net/minecraft/world/level/block/SporeBlossomBlock.java @@ -8,8 +8,8 @@ import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; -import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.shapes.CollisionContext; @@ -37,10 +37,19 @@ public class SporeBlossomBlock extends Block { } @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { - return direction == Direction.UP && !this.canSurvive(state, level, pos) + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { + return direction == Direction.UP && !this.canSurvive(blockState, levelReader, blockPos) ? Blocks.AIR.defaultBlockState() - : super.updateShape(state, direction, neighborState, level, pos, neighborPos); + : super.updateShape(blockState, levelReader, scheduledTickAccess, blockPos, direction, blockPos2, blockState2, randomSource); } @Override diff --git a/net/minecraft/world/level/block/SpreadingSnowyDirtBlock.java b/net/minecraft/world/level/block/SpreadingSnowyDirtBlock.java index a891c46c..a74554e6 100644 --- a/net/minecraft/world/level/block/SpreadingSnowyDirtBlock.java +++ b/net/minecraft/world/level/block/SpreadingSnowyDirtBlock.java @@ -24,8 +24,8 @@ public abstract class SpreadingSnowyDirtBlock extends SnowyDirtBlock { } else if (blockState.getFluidState().getAmount() == 8) { return false; } else { - int i = LightEngine.getLightBlockInto(levelReader, state, pos, blockState, blockPos, Direction.UP, blockState.getLightBlock(levelReader, blockPos)); - return i < levelReader.getMaxLightLevel(); + int i = LightEngine.getLightBlockInto(state, blockState, Direction.UP, blockState.getLightBlock()); + return i < 15; } } diff --git a/net/minecraft/world/level/block/StairBlock.java b/net/minecraft/world/level/block/StairBlock.java index 6cef3c3c..301071fc 100644 --- a/net/minecraft/world/level/block/StairBlock.java +++ b/net/minecraft/world/level/block/StairBlock.java @@ -5,15 +5,16 @@ import com.mojang.serialization.codecs.RecordCodecBuilder; import java.util.stream.IntStream; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; +import net.minecraft.util.RandomSource; import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.level.BlockGetter; -import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.block.state.properties.BooleanProperty; -import net.minecraft.world.level.block.state.properties.DirectionProperty; import net.minecraft.world.level.block.state.properties.EnumProperty; import net.minecraft.world.level.block.state.properties.Half; import net.minecraft.world.level.block.state.properties.StairsShape; @@ -29,7 +30,7 @@ public class StairBlock extends Block implements SimpleWaterloggedBlock { instance -> instance.group(BlockState.CODEC.fieldOf("base_state").forGetter(stairBlock -> stairBlock.baseState), propertiesCodec()) .apply(instance, StairBlock::new) ); - public static final DirectionProperty FACING = HorizontalDirectionalBlock.FACING; + public static final EnumProperty FACING = HorizontalDirectionalBlock.FACING; public static final EnumProperty HALF = BlockStateProperties.HALF; public static final EnumProperty SHAPE = BlockStateProperties.STAIRS_SHAPE; public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED; @@ -127,14 +128,23 @@ public class StairBlock extends Block implements SimpleWaterloggedBlock { } @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { - if ((Boolean)state.getValue(WATERLOGGED)) { - level.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(level)); + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { + if ((Boolean)blockState.getValue(WATERLOGGED)) { + scheduledTickAccess.scheduleTick(blockPos, Fluids.WATER, Fluids.WATER.getTickDelay(levelReader)); } return direction.getAxis().isHorizontal() - ? state.setValue(SHAPE, getStairsShape(state, level, pos)) - : super.updateShape(state, direction, neighborState, level, pos, neighborPos); + ? blockState.setValue(SHAPE, getStairsShape(blockState, levelReader, blockPos)) + : super.updateShape(blockState, levelReader, scheduledTickAccess, blockPos, direction, blockPos2, blockState2, randomSource); } /** diff --git a/net/minecraft/world/level/block/StandingSignBlock.java b/net/minecraft/world/level/block/StandingSignBlock.java index d87746cc..1b94a934 100644 --- a/net/minecraft/world/level/block/StandingSignBlock.java +++ b/net/minecraft/world/level/block/StandingSignBlock.java @@ -4,9 +4,10 @@ import com.mojang.serialization.MapCodec; import com.mojang.serialization.codecs.RecordCodecBuilder; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; +import net.minecraft.util.RandomSource; import net.minecraft.world.item.context.BlockPlaceContext; -import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; @@ -47,10 +48,19 @@ public class StandingSignBlock extends SignBlock { } @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { - return direction == Direction.DOWN && !this.canSurvive(state, level, pos) + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { + return direction == Direction.DOWN && !this.canSurvive(blockState, levelReader, blockPos) ? Blocks.AIR.defaultBlockState() - : super.updateShape(state, direction, neighborState, level, pos, neighborPos); + : super.updateShape(blockState, levelReader, scheduledTickAccess, blockPos, direction, blockPos2, blockState2, randomSource); } @Override diff --git a/net/minecraft/world/level/block/StemBlock.java b/net/minecraft/world/level/block/StemBlock.java index 9060eb27..379364f1 100644 --- a/net/minecraft/world/level/block/StemBlock.java +++ b/net/minecraft/world/level/block/StemBlock.java @@ -90,7 +90,7 @@ public class StemBlock extends BushBlock implements BonemealableBlock { BlockPos blockPos = pos.relative(direction); BlockState blockState = level.getBlockState(blockPos.below()); if (level.getBlockState(blockPos).isAir() && (blockState.is(Blocks.FARMLAND) || blockState.is(BlockTags.DIRT))) { - Registry registry = level.registryAccess().registryOrThrow(Registries.BLOCK); + Registry registry = level.registryAccess().lookupOrThrow(Registries.BLOCK); Optional optional = registry.getOptional(this.fruit); Optional optional2 = registry.getOptional(this.attachedStem); if (optional.isPresent() && optional2.isPresent()) { @@ -105,7 +105,7 @@ public class StemBlock extends BushBlock implements BonemealableBlock { @Override public ItemStack getCloneItemStack(LevelReader level, BlockPos pos, BlockState state) { - return new ItemStack(DataFixUtils.orElse(level.registryAccess().registryOrThrow(Registries.ITEM).getOptional(this.seed), this)); + return new ItemStack(DataFixUtils.orElse(level.registryAccess().lookupOrThrow(Registries.ITEM).getOptional(this.seed), this)); } @Override diff --git a/net/minecraft/world/level/block/StonecutterBlock.java b/net/minecraft/world/level/block/StonecutterBlock.java index 6497e354..506dc994 100644 --- a/net/minecraft/world/level/block/StonecutterBlock.java +++ b/net/minecraft/world/level/block/StonecutterBlock.java @@ -17,7 +17,7 @@ import net.minecraft.world.level.Level; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; -import net.minecraft.world.level.block.state.properties.DirectionProperty; +import net.minecraft.world.level.block.state.properties.EnumProperty; import net.minecraft.world.level.pathfinder.PathComputationType; import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.shapes.CollisionContext; @@ -27,7 +27,7 @@ import org.jetbrains.annotations.Nullable; public class StonecutterBlock extends Block { public static final MapCodec CODEC = simpleCodec(StonecutterBlock::new); private static final Component CONTAINER_TITLE = Component.translatable("container.stonecutter"); - public static final DirectionProperty FACING = HorizontalDirectionalBlock.FACING; + public static final EnumProperty FACING = HorizontalDirectionalBlock.FACING; protected static final VoxelShape SHAPE = Block.box(0.0, 0.0, 0.0, 16.0, 9.0, 16.0); @Override @@ -47,13 +47,12 @@ public class StonecutterBlock extends Block { @Override protected InteractionResult useWithoutItem(BlockState state, Level level, BlockPos pos, Player player, BlockHitResult hitResult) { - if (level.isClientSide) { - return InteractionResult.SUCCESS; - } else { + if (!level.isClientSide) { player.openMenu(state.getMenuProvider(level, pos)); player.awardStat(Stats.INTERACT_WITH_STONECUTTER); - return InteractionResult.CONSUME; } + + return InteractionResult.SUCCESS; } @Nullable diff --git a/net/minecraft/world/level/block/StructureBlock.java b/net/minecraft/world/level/block/StructureBlock.java index c6cef8ec..241520c9 100644 --- a/net/minecraft/world/level/block/StructureBlock.java +++ b/net/minecraft/world/level/block/StructureBlock.java @@ -16,6 +16,7 @@ import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.block.state.properties.EnumProperty; import net.minecraft.world.level.block.state.properties.StructureMode; +import net.minecraft.world.level.redstone.Orientation; import net.minecraft.world.phys.BlockHitResult; import org.jetbrains.annotations.Nullable; @@ -42,7 +43,7 @@ public class StructureBlock extends BaseEntityBlock implements GameMasterBlock { protected InteractionResult useWithoutItem(BlockState state, Level level, BlockPos pos, Player player, BlockHitResult hitResult) { BlockEntity blockEntity = level.getBlockEntity(pos); if (blockEntity instanceof StructureBlockEntity) { - return ((StructureBlockEntity)blockEntity).usedBy(player) ? InteractionResult.sidedSuccess(level.isClientSide) : InteractionResult.PASS; + return (InteractionResult)(((StructureBlockEntity)blockEntity).usedBy(player) ? InteractionResult.SUCCESS : InteractionResult.PASS); } else { return InteractionResult.PASS; } @@ -71,15 +72,15 @@ public class StructureBlock extends BaseEntityBlock implements GameMasterBlock { } @Override - protected void neighborChanged(BlockState state, Level level, BlockPos pos, Block neighborBlock, BlockPos neighborPos, boolean movedByPiston) { + protected void neighborChanged(BlockState blockState, Level level, BlockPos blockPos, Block block, @Nullable Orientation orientation, boolean bl) { if (level instanceof ServerLevel) { - if (level.getBlockEntity(pos) instanceof StructureBlockEntity structureBlockEntity) { - boolean bl = level.hasNeighborSignal(pos); - boolean bl2 = structureBlockEntity.isPowered(); - if (bl && !bl2) { + if (level.getBlockEntity(blockPos) instanceof StructureBlockEntity structureBlockEntity) { + boolean bl2 = level.hasNeighborSignal(blockPos); + boolean bl3 = structureBlockEntity.isPowered(); + if (bl2 && !bl3) { structureBlockEntity.setPowered(true); this.trigger((ServerLevel)level, structureBlockEntity); - } else if (!bl && bl2) { + } else if (!bl2 && bl3) { structureBlockEntity.setPowered(false); } } diff --git a/net/minecraft/world/level/block/SugarCaneBlock.java b/net/minecraft/world/level/block/SugarCaneBlock.java index 9fbd075c..20c82406 100644 --- a/net/minecraft/world/level/block/SugarCaneBlock.java +++ b/net/minecraft/world/level/block/SugarCaneBlock.java @@ -8,8 +8,8 @@ import net.minecraft.tags.BlockTags; import net.minecraft.tags.FluidTags; import net.minecraft.util.RandomSource; import net.minecraft.world.level.BlockGetter; -import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; @@ -69,12 +69,21 @@ public class SugarCaneBlock extends Block { } @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { - if (!state.canSurvive(level, pos)) { - level.scheduleTick(pos, this, 1); + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { + if (!blockState.canSurvive(levelReader, blockPos)) { + scheduledTickAccess.scheduleTick(blockPos, this, 1); } - return super.updateShape(state, direction, neighborState, level, pos, neighborPos); + return super.updateShape(blockState, levelReader, scheduledTickAccess, blockPos, direction, blockPos2, blockState2, randomSource); } @Override diff --git a/net/minecraft/world/level/block/SweetBerryBushBlock.java b/net/minecraft/world/level/block/SweetBerryBushBlock.java index 45c34180..fcc688cc 100644 --- a/net/minecraft/world/level/block/SweetBerryBushBlock.java +++ b/net/minecraft/world/level/block/SweetBerryBushBlock.java @@ -8,7 +8,6 @@ import net.minecraft.sounds.SoundSource; import net.minecraft.util.RandomSource; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; -import net.minecraft.world.ItemInteractionResult; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LivingEntity; @@ -24,6 +23,7 @@ import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.block.state.properties.IntegerProperty; import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.level.gameevent.GameEvent.Context; import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.shapes.CollisionContext; @@ -72,7 +72,7 @@ public class SweetBerryBushBlock extends BushBlock implements BonemealableBlock if (i < 3 && random.nextInt(5) == 0 && level.getRawBrightness(pos.above(), 0) >= 9) { BlockState blockState = state.setValue(AGE, i + 1); level.setBlock(pos, blockState, 2); - level.gameEvent(GameEvent.BLOCK_CHANGE, pos, GameEvent.Context.of(blockState)); + level.gameEvent(GameEvent.BLOCK_CHANGE, pos, Context.of(blockState)); } } @@ -80,25 +80,28 @@ public class SweetBerryBushBlock extends BushBlock implements BonemealableBlock protected void entityInside(BlockState state, Level level, BlockPos pos, Entity entity) { if (entity instanceof LivingEntity && entity.getType() != EntityType.FOX && entity.getType() != EntityType.BEE) { entity.makeStuckInBlock(state, new Vec3(0.8F, 0.75, 0.8F)); - if (!level.isClientSide && (Integer)state.getValue(AGE) > 0 && (entity.xOld != entity.getX() || entity.zOld != entity.getZ())) { - double d = Math.abs(entity.getX() - entity.xOld); - double e = Math.abs(entity.getZ() - entity.zOld); - if (d >= 0.003F || e >= 0.003F) { - entity.hurt(level.damageSources().sweetBerryBush(), 1.0F); + if (level instanceof ServerLevel serverLevel && (Integer)state.getValue(AGE) != 0) { + Vec3 vec3 = entity.isControlledByClient() ? entity.getKnownMovement() : entity.oldPosition().subtract(entity.position()); + if (vec3.horizontalDistanceSqr() > 0.0) { + double d = Math.abs(vec3.x()); + double e = Math.abs(vec3.z()); + if (d >= 0.003F || e >= 0.003F) { + entity.hurtServer(serverLevel, level.damageSources().sweetBerryBush(), 1.0F); + } } } } } @Override - protected ItemInteractionResult useItemOn( - ItemStack stack, BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hitResult + protected InteractionResult useItemOn( + ItemStack itemStack, BlockState blockState, Level level, BlockPos blockPos, Player player, InteractionHand interactionHand, BlockHitResult blockHitResult ) { - int i = (Integer)state.getValue(AGE); + int i = (Integer)blockState.getValue(AGE); boolean bl = i == 3; - return !bl && stack.is(Items.BONE_MEAL) - ? ItemInteractionResult.SKIP_DEFAULT_BLOCK_INTERACTION - : super.useItemOn(stack, state, level, pos, player, hand, hitResult); + return (InteractionResult)(!bl && itemStack.is(Items.BONE_MEAL) + ? InteractionResult.PASS + : super.useItemOn(itemStack, blockState, level, blockPos, player, interactionHand, blockHitResult)); } @Override @@ -111,8 +114,8 @@ public class SweetBerryBushBlock extends BushBlock implements BonemealableBlock level.playSound(null, pos, SoundEvents.SWEET_BERRY_BUSH_PICK_BERRIES, SoundSource.BLOCKS, 1.0F, 0.8F + level.random.nextFloat() * 0.4F); BlockState blockState = state.setValue(AGE, 1); level.setBlock(pos, blockState, 2); - level.gameEvent(GameEvent.BLOCK_CHANGE, pos, GameEvent.Context.of(player, blockState)); - return InteractionResult.sidedSuccess(level.isClientSide); + level.gameEvent(GameEvent.BLOCK_CHANGE, pos, Context.of(player, blockState)); + return InteractionResult.SUCCESS; } else { return super.useWithoutItem(state, level, pos, player, hitResult); } diff --git a/net/minecraft/world/level/block/TallGrassBlock.java b/net/minecraft/world/level/block/TallGrassBlock.java index c096c8d2..fb95991c 100644 --- a/net/minecraft/world/level/block/TallGrassBlock.java +++ b/net/minecraft/world/level/block/TallGrassBlock.java @@ -33,7 +33,7 @@ public class TallGrassBlock extends BushBlock implements BonemealableBlock { @Override public boolean isValidBonemealTarget(LevelReader level, BlockPos pos, BlockState state) { - return true; + return getGrownBlock(state).defaultBlockState().canSurvive(level, pos) && level.isEmptyBlock(pos.above()); } @Override @@ -43,9 +43,10 @@ public class TallGrassBlock extends BushBlock implements BonemealableBlock { @Override public void performBonemeal(ServerLevel level, RandomSource random, BlockPos pos, BlockState state) { - DoublePlantBlock doublePlantBlock = (DoublePlantBlock)(state.is(Blocks.FERN) ? Blocks.LARGE_FERN : Blocks.TALL_GRASS); - if (doublePlantBlock.defaultBlockState().canSurvive(level, pos) && level.isEmptyBlock(pos.above())) { - DoublePlantBlock.placeAt(level, doublePlantBlock.defaultBlockState(), pos, 2); - } + DoublePlantBlock.placeAt(level, getGrownBlock(state).defaultBlockState(), pos, 2); + } + + private static DoublePlantBlock getGrownBlock(BlockState blockState) { + return (DoublePlantBlock)(blockState.is(Blocks.FERN) ? Blocks.LARGE_FERN : Blocks.TALL_GRASS); } } diff --git a/net/minecraft/world/level/block/TintedGlassBlock.java b/net/minecraft/world/level/block/TintedGlassBlock.java index 2970d88f..8721a10d 100644 --- a/net/minecraft/world/level/block/TintedGlassBlock.java +++ b/net/minecraft/world/level/block/TintedGlassBlock.java @@ -1,8 +1,6 @@ package net.minecraft.world.level.block; import com.mojang.serialization.MapCodec; -import net.minecraft.core.BlockPos; -import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; @@ -19,12 +17,12 @@ public class TintedGlassBlock extends TransparentBlock { } @Override - protected boolean propagatesSkylightDown(BlockState state, BlockGetter level, BlockPos pos) { + protected boolean propagatesSkylightDown(BlockState blockState) { return false; } @Override - protected int getLightBlock(BlockState state, BlockGetter level, BlockPos pos) { - return level.getMaxLightLevel(); + protected int getLightBlock(BlockState blockState) { + return 15; } } diff --git a/net/minecraft/world/level/block/TntBlock.java b/net/minecraft/world/level/block/TntBlock.java index 3974e9ab..8c2d8d3c 100644 --- a/net/minecraft/world/level/block/TntBlock.java +++ b/net/minecraft/world/level/block/TntBlock.java @@ -2,11 +2,12 @@ package net.minecraft.world.level.block; import com.mojang.serialization.MapCodec; import net.minecraft.core.BlockPos; +import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; import net.minecraft.stats.Stats; import net.minecraft.world.InteractionHand; -import net.minecraft.world.ItemInteractionResult; +import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.item.PrimedTnt; @@ -23,6 +24,7 @@ import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.block.state.properties.BooleanProperty; import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.level.redstone.Orientation; import net.minecraft.world.phys.BlockHitResult; import org.jetbrains.annotations.Nullable; @@ -51,10 +53,10 @@ public class TntBlock extends Block { } @Override - protected void neighborChanged(BlockState state, Level level, BlockPos pos, Block neighborBlock, BlockPos neighborPos, boolean movedByPiston) { - if (level.hasNeighborSignal(pos)) { - explode(level, pos); - level.removeBlock(pos, false); + protected void neighborChanged(BlockState blockState, Level level, BlockPos blockPos, Block block, @Nullable Orientation orientation, boolean bl) { + if (level.hasNeighborSignal(blockPos)) { + explode(level, blockPos); + level.removeBlock(blockPos, false); } } @@ -68,13 +70,11 @@ public class TntBlock extends Block { } @Override - public void wasExploded(Level level, BlockPos pos, Explosion explosion) { - if (!level.isClientSide) { - PrimedTnt primedTnt = new PrimedTnt(level, pos.getX() + 0.5, pos.getY(), pos.getZ() + 0.5, explosion.getIndirectSourceEntity()); - int i = primedTnt.getFuse(); - primedTnt.setFuse((short)(level.random.nextInt(i / 4) + i / 8)); - level.addFreshEntity(primedTnt); - } + public void wasExploded(ServerLevel serverLevel, BlockPos blockPos, Explosion explosion) { + PrimedTnt primedTnt = new PrimedTnt(serverLevel, blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5, explosion.getIndirectSourceEntity()); + int i = primedTnt.getFuse(); + primedTnt.setFuse((short)(serverLevel.random.nextInt(i / 4) + i / 8)); + serverLevel.addFreshEntity(primedTnt); } public static void explode(Level level, BlockPos pos) { @@ -91,32 +91,32 @@ public class TntBlock extends Block { } @Override - protected ItemInteractionResult useItemOn( - ItemStack stack, BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hitResult + protected InteractionResult useItemOn( + ItemStack itemStack, BlockState blockState, Level level, BlockPos blockPos, Player player, InteractionHand interactionHand, BlockHitResult blockHitResult ) { - if (!stack.is(Items.FLINT_AND_STEEL) && !stack.is(Items.FIRE_CHARGE)) { - return super.useItemOn(stack, state, level, pos, player, hand, hitResult); + if (!itemStack.is(Items.FLINT_AND_STEEL) && !itemStack.is(Items.FIRE_CHARGE)) { + return super.useItemOn(itemStack, blockState, level, blockPos, player, interactionHand, blockHitResult); } else { - explode(level, pos, player); - level.setBlock(pos, Blocks.AIR.defaultBlockState(), 11); - Item item = stack.getItem(); - if (stack.is(Items.FLINT_AND_STEEL)) { - stack.hurtAndBreak(1, player, LivingEntity.getSlotForHand(hand)); + explode(level, blockPos, player); + level.setBlock(blockPos, Blocks.AIR.defaultBlockState(), 11); + Item item = itemStack.getItem(); + if (itemStack.is(Items.FLINT_AND_STEEL)) { + itemStack.hurtAndBreak(1, player, LivingEntity.getSlotForHand(interactionHand)); } else { - stack.consume(1, player); + itemStack.consume(1, player); } player.awardStat(Stats.ITEM_USED.get(item)); - return ItemInteractionResult.sidedSuccess(level.isClientSide); + return InteractionResult.SUCCESS; } } @Override protected void onProjectileHit(Level level, BlockState state, BlockHitResult hit, Projectile projectile) { - if (!level.isClientSide) { + if (level instanceof ServerLevel serverLevel) { BlockPos blockPos = hit.getBlockPos(); Entity entity = projectile.getOwner(); - if (projectile.isOnFire() && projectile.mayInteract(level, blockPos)) { + if (projectile.isOnFire() && projectile.mayInteract(serverLevel, blockPos)) { explode(level, blockPos, entity instanceof LivingEntity ? (LivingEntity)entity : null); level.removeBlock(blockPos, false); } diff --git a/net/minecraft/world/level/block/TransparentBlock.java b/net/minecraft/world/level/block/TransparentBlock.java index 1d379e87..969687c1 100644 --- a/net/minecraft/world/level/block/TransparentBlock.java +++ b/net/minecraft/world/level/block/TransparentBlock.java @@ -32,7 +32,7 @@ public class TransparentBlock extends HalfTransparentBlock { } @Override - protected boolean propagatesSkylightDown(BlockState state, BlockGetter level, BlockPos pos) { + protected boolean propagatesSkylightDown(BlockState blockState) { return true; } } diff --git a/net/minecraft/world/level/block/TrapDoorBlock.java b/net/minecraft/world/level/block/TrapDoorBlock.java index 6c852dd5..7d138986 100644 --- a/net/minecraft/world/level/block/TrapDoorBlock.java +++ b/net/minecraft/world/level/block/TrapDoorBlock.java @@ -5,7 +5,9 @@ import com.mojang.serialization.codecs.RecordCodecBuilder; import java.util.function.BiConsumer; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; +import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundSource; +import net.minecraft.util.RandomSource; import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; @@ -13,7 +15,8 @@ import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Explosion; import net.minecraft.world.level.Level; -import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; @@ -26,6 +29,7 @@ import net.minecraft.world.level.gameevent.GameEvent; import net.minecraft.world.level.material.FluidState; import net.minecraft.world.level.material.Fluids; import net.minecraft.world.level.pathfinder.PathComputationType; +import net.minecraft.world.level.redstone.Orientation; import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.VoxelShape; @@ -107,17 +111,19 @@ public class TrapDoorBlock extends HorizontalDirectionalBlock implements SimpleW return InteractionResult.PASS; } else { this.toggle(state, level, pos, player); - return InteractionResult.sidedSuccess(level.isClientSide); + return InteractionResult.SUCCESS; } } @Override - protected void onExplosionHit(BlockState state, Level level, BlockPos pos, Explosion explosion, BiConsumer dropConsumer) { - if (explosion.canTriggerBlocks() && this.type.canOpenByWindCharge() && !(Boolean)state.getValue(POWERED)) { - this.toggle(state, level, pos, null); + protected void onExplosionHit( + BlockState blockState, ServerLevel serverLevel, BlockPos blockPos, Explosion explosion, BiConsumer biConsumer + ) { + if (explosion.canTriggerBlocks() && this.type.canOpenByWindCharge() && !(Boolean)blockState.getValue(POWERED)) { + this.toggle(blockState, serverLevel, blockPos, null); } - super.onExplosionHit(state, level, pos, explosion, dropConsumer); + super.onExplosionHit(blockState, serverLevel, blockPos, explosion, biConsumer); } private void toggle(BlockState state, Level level, BlockPos pos, @Nullable Player player) { @@ -138,18 +144,18 @@ public class TrapDoorBlock extends HorizontalDirectionalBlock implements SimpleW } @Override - protected void neighborChanged(BlockState state, Level level, BlockPos pos, Block neighborBlock, BlockPos neighborPos, boolean movedByPiston) { + protected void neighborChanged(BlockState blockState, Level level, BlockPos blockPos, Block block, @Nullable Orientation orientation, boolean bl) { if (!level.isClientSide) { - boolean bl = level.hasNeighborSignal(pos); - if (bl != (Boolean)state.getValue(POWERED)) { - if ((Boolean)state.getValue(OPEN) != bl) { - state = state.setValue(OPEN, bl); - this.playSound(null, level, pos, bl); + boolean bl2 = level.hasNeighborSignal(blockPos); + if (bl2 != (Boolean)blockState.getValue(POWERED)) { + if ((Boolean)blockState.getValue(OPEN) != bl2) { + blockState = blockState.setValue(OPEN, bl2); + this.playSound(null, level, blockPos, bl2); } - level.setBlock(pos, state.setValue(POWERED, bl), 2); - if ((Boolean)state.getValue(WATERLOGGED)) { - level.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(level)); + level.setBlock(blockPos, blockState.setValue(POWERED, bl2), 2); + if ((Boolean)blockState.getValue(WATERLOGGED)) { + level.scheduleTick(blockPos, Fluids.WATER, Fluids.WATER.getTickDelay(level)); } } } @@ -185,12 +191,21 @@ public class TrapDoorBlock extends HorizontalDirectionalBlock implements SimpleW } @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { - if ((Boolean)state.getValue(WATERLOGGED)) { - level.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(level)); + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { + if ((Boolean)blockState.getValue(WATERLOGGED)) { + scheduledTickAccess.scheduleTick(blockPos, Fluids.WATER, Fluids.WATER.getTickDelay(levelReader)); } - return super.updateShape(state, direction, neighborState, level, pos, neighborPos); + return super.updateShape(blockState, levelReader, scheduledTickAccess, blockPos, direction, blockPos2, blockState2, randomSource); } protected BlockSetType getType() { diff --git a/net/minecraft/world/level/block/TrappedChestBlock.java b/net/minecraft/world/level/block/TrappedChestBlock.java index a9f9b0eb..f881a725 100644 --- a/net/minecraft/world/level/block/TrappedChestBlock.java +++ b/net/minecraft/world/level/block/TrappedChestBlock.java @@ -24,7 +24,7 @@ public class TrappedChestBlock extends ChestBlock { } public TrappedChestBlock(BlockBehaviour.Properties properties) { - super(properties, () -> BlockEntityType.TRAPPED_CHEST); + super(() -> BlockEntityType.TRAPPED_CHEST, properties); } @Override diff --git a/net/minecraft/world/level/block/TripWireBlock.java b/net/minecraft/world/level/block/TripWireBlock.java index 95888466..919eb05c 100644 --- a/net/minecraft/world/level/block/TripWireBlock.java +++ b/net/minecraft/world/level/block/TripWireBlock.java @@ -15,7 +15,8 @@ import net.minecraft.world.item.Items; import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; -import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; @@ -82,10 +83,19 @@ public class TripWireBlock extends Block { } @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { return direction.getAxis().isHorizontal() - ? state.setValue((Property)PROPERTY_BY_DIRECTION.get(direction), this.shouldConnectTo(neighborState, direction)) - : super.updateShape(state, direction, neighborState, level, pos, neighborPos); + ? blockState.setValue((Property)PROPERTY_BY_DIRECTION.get(direction), this.shouldConnectTo(blockState2, direction)) + : super.updateShape(blockState, levelReader, scheduledTickAccess, blockPos, direction, blockPos2, blockState2, randomSource); } @Override @@ -131,11 +141,16 @@ public class TripWireBlock extends Block { } } + @Override + protected VoxelShape getEntityInsideCollisionShape(BlockState blockState, Level level, BlockPos blockPos) { + return blockState.getShape(level, blockPos); + } + @Override protected void entityInside(BlockState state, Level level, BlockPos pos, Entity entity) { if (!level.isClientSide) { if (!(Boolean)state.getValue(POWERED)) { - this.checkPressed(level, pos); + this.checkPressed(level, pos, List.of(entity)); } } } @@ -149,9 +164,14 @@ public class TripWireBlock extends Block { private void checkPressed(Level level, BlockPos pos) { BlockState blockState = level.getBlockState(pos); + List list = level.getEntities(null, blockState.getShape(level, pos).bounds().move(pos)); + this.checkPressed(level, pos, list); + } + + private void checkPressed(Level level, BlockPos blockPos, List list) { + BlockState blockState = level.getBlockState(blockPos); boolean bl = (Boolean)blockState.getValue(POWERED); boolean bl2 = false; - List list = level.getEntities(null, blockState.getShape(level, pos).bounds().move(pos)); if (!list.isEmpty()) { for (Entity entity : list) { if (!entity.isIgnoringBlockTriggers()) { @@ -163,12 +183,12 @@ public class TripWireBlock extends Block { if (bl2 != bl) { blockState = blockState.setValue(POWERED, bl2); - level.setBlock(pos, blockState, 3); - this.updateSource(level, pos, blockState); + level.setBlock(blockPos, blockState, 3); + this.updateSource(level, blockPos, blockState); } if (bl2) { - level.scheduleTick(new BlockPos(pos), this, 10); + level.scheduleTick(new BlockPos(blockPos), this, 10); } } diff --git a/net/minecraft/world/level/block/TripWireHookBlock.java b/net/minecraft/world/level/block/TripWireHookBlock.java index f2231297..9f6ba43e 100644 --- a/net/minecraft/world/level/block/TripWireHookBlock.java +++ b/net/minecraft/world/level/block/TripWireHookBlock.java @@ -14,22 +14,24 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; -import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.block.state.properties.BooleanProperty; -import net.minecraft.world.level.block.state.properties.DirectionProperty; +import net.minecraft.world.level.block.state.properties.EnumProperty; import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.level.redstone.ExperimentalRedstoneUtils; +import net.minecraft.world.level.redstone.Orientation; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.VoxelShape; import org.jetbrains.annotations.Nullable; public class TripWireHookBlock extends Block { public static final MapCodec CODEC = simpleCodec(TripWireHookBlock::new); - public static final DirectionProperty FACING = HorizontalDirectionalBlock.FACING; + public static final EnumProperty FACING = HorizontalDirectionalBlock.FACING; public static final BooleanProperty POWERED = BlockStateProperties.POWERED; public static final BooleanProperty ATTACHED = BlockStateProperties.ATTACHED; protected static final int WIRE_DIST_MIN = 1; @@ -75,10 +77,19 @@ public class TripWireHookBlock extends Block { } @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { - return direction.getOpposite() == state.getValue(FACING) && !state.canSurvive(level, pos) + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { + return direction.getOpposite() == blockState.getValue(FACING) && !blockState.canSurvive(levelReader, blockPos) ? Blocks.AIR.defaultBlockState() - : super.updateShape(state, direction, neighborState, level, pos, neighborPos); + : super.updateShape(blockState, levelReader, scheduledTickAccess, blockPos, direction, blockPos2, blockState2, randomSource); } @Nullable @@ -174,8 +185,9 @@ public class TripWireHookBlock extends Block { BlockPos blockPos2 = pos.relative(direction, k); BlockState blockState3 = blockStates[k]; if (blockState3 != null) { - level.setBlock(blockPos2, blockState3.trySetValue(ATTACHED, bl3), 3); - if (!level.getBlockState(blockPos2).isAir()) { + BlockState blockState4 = level.getBlockState(blockPos2); + if (blockState4.is(Blocks.TRIPWIRE) || blockState4.is(Blocks.TRIPWIRE_HOOK)) { + level.setBlock(blockPos2, blockState3.trySetValue(ATTACHED, bl3), 3); } } } @@ -205,8 +217,10 @@ public class TripWireHookBlock extends Block { } private static void notifyNeighbors(Block block, Level level, BlockPos pos, Direction direction) { - level.updateNeighborsAt(pos, block); - level.updateNeighborsAt(pos.relative(direction.getOpposite()), block); + Direction direction2 = direction.getOpposite(); + Orientation orientation = ExperimentalRedstoneUtils.initialOrientation(level, direction2, Direction.UP); + level.updateNeighborsAt(pos, block, orientation); + level.updateNeighborsAt(pos.relative(direction2), block, orientation); } @Override @@ -219,8 +233,7 @@ public class TripWireHookBlock extends Block { } if (bl2) { - level.updateNeighborsAt(pos, this); - level.updateNeighborsAt(pos.relative(((Direction)state.getValue(FACING)).getOpposite()), this); + notifyNeighbors(this, level, pos, state.getValue(FACING)); } super.onRemove(state, level, pos, newState, movedByPiston); diff --git a/net/minecraft/world/level/block/TurtleEggBlock.java b/net/minecraft/world/level/block/TurtleEggBlock.java index 0e908e95..5ee95159 100644 --- a/net/minecraft/world/level/block/TurtleEggBlock.java +++ b/net/minecraft/world/level/block/TurtleEggBlock.java @@ -8,6 +8,7 @@ import net.minecraft.sounds.SoundSource; import net.minecraft.tags.BlockTags; import net.minecraft.util.RandomSource; import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.ambient.Bat; @@ -26,6 +27,7 @@ import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.block.state.properties.IntegerProperty; import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.level.gameevent.GameEvent.Context; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.VoxelShape; import org.jetbrains.annotations.Nullable; @@ -69,10 +71,8 @@ public class TurtleEggBlock extends Block { } private void destroyEgg(Level level, BlockState state, BlockPos pos, Entity entity, int chance) { - if (this.canDestroyEgg(level, entity)) { - if (!level.isClientSide && level.random.nextInt(chance) == 0 && state.is(Blocks.TURTLE_EGG)) { - this.decreaseEggs(level, pos, state); - } + if (state.is(Blocks.TURTLE_EGG) && level instanceof ServerLevel serverLevel && this.canDestroyEgg(serverLevel, entity) && level.random.nextInt(chance) == 0) { + this.decreaseEggs(serverLevel, pos, state); } } @@ -83,7 +83,7 @@ public class TurtleEggBlock extends Block { level.destroyBlock(pos, false); } else { level.setBlock(pos, state.setValue(EGGS, i - 1), 2); - level.gameEvent(GameEvent.BLOCK_DESTROY, pos, GameEvent.Context.of(state)); + level.gameEvent(GameEvent.BLOCK_DESTROY, pos, Context.of(state)); level.levelEvent(2001, pos, Block.getId(state)); } } @@ -95,15 +95,15 @@ public class TurtleEggBlock extends Block { if (i < 2) { level.playSound(null, pos, SoundEvents.TURTLE_EGG_CRACK, SoundSource.BLOCKS, 0.7F, 0.9F + random.nextFloat() * 0.2F); level.setBlock(pos, state.setValue(HATCH, i + 1), 2); - level.gameEvent(GameEvent.BLOCK_CHANGE, pos, GameEvent.Context.of(state)); + level.gameEvent(GameEvent.BLOCK_CHANGE, pos, Context.of(state)); } else { level.playSound(null, pos, SoundEvents.TURTLE_EGG_HATCH, SoundSource.BLOCKS, 0.7F, 0.9F + random.nextFloat() * 0.2F); level.removeBlock(pos, false); - level.gameEvent(GameEvent.BLOCK_DESTROY, pos, GameEvent.Context.of(state)); + level.gameEvent(GameEvent.BLOCK_DESTROY, pos, Context.of(state)); for (int j = 0; j < state.getValue(EGGS); j++) { level.levelEvent(2001, pos, Block.getId(state)); - Turtle turtle = EntityType.TURTLE.create(level); + Turtle turtle = EntityType.TURTLE.create(level, EntitySpawnReason.BREEDING); if (turtle != null) { turtle.setAge(-24000); turtle.setHomePos(pos); @@ -165,11 +165,11 @@ public class TurtleEggBlock extends Block { builder.add(HATCH, EGGS); } - private boolean canDestroyEgg(Level level, Entity entity) { + private boolean canDestroyEgg(ServerLevel serverLevel, Entity entity) { if (entity instanceof Turtle || entity instanceof Bat) { return false; } else { - return !(entity instanceof LivingEntity) ? false : entity instanceof Player || level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING); + return !(entity instanceof LivingEntity) ? false : entity instanceof Player || serverLevel.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING); } } } diff --git a/net/minecraft/world/level/block/VaultBlock.java b/net/minecraft/world/level/block/VaultBlock.java index 4beecb40..371c1366 100644 --- a/net/minecraft/world/level/block/VaultBlock.java +++ b/net/minecraft/world/level/block/VaultBlock.java @@ -5,7 +5,7 @@ import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.InteractionHand; -import net.minecraft.world.ItemInteractionResult; +import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.context.BlockPlaceContext; @@ -20,7 +20,7 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.block.state.properties.BooleanProperty; -import net.minecraft.world.level.block.state.properties.DirectionProperty; +import net.minecraft.world.level.block.state.properties.EnumProperty; import net.minecraft.world.level.block.state.properties.Property; import net.minecraft.world.phys.BlockHitResult; import org.jetbrains.annotations.Nullable; @@ -28,7 +28,7 @@ import org.jetbrains.annotations.Nullable; public class VaultBlock extends BaseEntityBlock { public static final MapCodec CODEC = simpleCodec(VaultBlock::new); public static final Property STATE = BlockStateProperties.VAULT_STATE; - public static final DirectionProperty FACING = HorizontalDirectionalBlock.FACING; + public static final EnumProperty FACING = HorizontalDirectionalBlock.FACING; public static final BooleanProperty OMINOUS = BlockStateProperties.OMINOUS; @Override @@ -42,22 +42,23 @@ public class VaultBlock extends BaseEntityBlock { } @Override - public ItemInteractionResult useItemOn( - ItemStack stack, BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hitResult + public InteractionResult useItemOn( + ItemStack itemStack, BlockState blockState, Level level, BlockPos blockPos, Player player, InteractionHand interactionHand, BlockHitResult blockHitResult ) { - if (stack.isEmpty() || state.getValue(STATE) != VaultState.ACTIVE) { - return ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION; - } else if (level instanceof ServerLevel serverLevel) { - if (serverLevel.getBlockEntity(pos) instanceof VaultBlockEntity vaultBlockEntity) { + if (!itemStack.isEmpty() && blockState.getValue(STATE) == VaultState.ACTIVE) { + if (level instanceof ServerLevel serverLevel) { + if (!(serverLevel.getBlockEntity(blockPos) instanceof VaultBlockEntity vaultBlockEntity)) { + return InteractionResult.TRY_WITH_EMPTY_HAND; + } + VaultBlockEntity.Server.tryInsertKey( - serverLevel, pos, state, vaultBlockEntity.getConfig(), vaultBlockEntity.getServerData(), vaultBlockEntity.getSharedData(), player, stack + serverLevel, blockPos, blockState, vaultBlockEntity.getConfig(), vaultBlockEntity.getServerData(), vaultBlockEntity.getSharedData(), player, itemStack ); - return ItemInteractionResult.SUCCESS; - } else { - return ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION; } + + return InteractionResult.SUCCESS_SERVER; } else { - return ItemInteractionResult.CONSUME; + return InteractionResult.TRY_WITH_EMPTY_HAND; } } diff --git a/net/minecraft/world/level/block/VineBlock.java b/net/minecraft/world/level/block/VineBlock.java index e91c1d32..9dced45b 100644 --- a/net/minecraft/world/level/block/VineBlock.java +++ b/net/minecraft/world/level/block/VineBlock.java @@ -13,8 +13,8 @@ import net.minecraft.util.RandomSource; import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.GameRules; -import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; @@ -93,7 +93,7 @@ public class VineBlock extends Block { } @Override - protected boolean propagatesSkylightDown(BlockState state, BlockGetter level, BlockPos pos) { + protected boolean propagatesSkylightDown(BlockState blockState) { return true; } @@ -167,12 +167,21 @@ public class VineBlock extends Block { } @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { if (direction == Direction.DOWN) { - return super.updateShape(state, direction, neighborState, level, pos, neighborPos); + return super.updateShape(blockState, levelReader, scheduledTickAccess, blockPos, direction, blockPos2, blockState2, randomSource); } else { - BlockState blockState = this.getUpdatedState(state, level, pos); - return !this.hasFaces(blockState) ? Blocks.AIR.defaultBlockState() : blockState; + BlockState blockState3 = this.getUpdatedState(blockState, levelReader, blockPos); + return !this.hasFaces(blockState3) ? Blocks.AIR.defaultBlockState() : blockState3; } } @@ -212,7 +221,7 @@ public class VineBlock extends Block { } } } else { - if (direction == Direction.UP && pos.getY() < level.getMaxBuildHeight() - 1) { + if (direction == Direction.UP && pos.getY() < level.getMaxY()) { if (this.canSupportAtFace(level, pos, direction)) { level.setBlock(pos, state.setValue(UP, true), 2); return; @@ -239,7 +248,7 @@ public class VineBlock extends Block { } } - if (pos.getY() > level.getMinBuildHeight()) { + if (pos.getY() > level.getMinY()) { BlockPos blockPos2 = pos.below(); BlockState blockState = level.getBlockState(blockPos2); if (blockState.isAir() || blockState.is(this)) { diff --git a/net/minecraft/world/level/block/WallBannerBlock.java b/net/minecraft/world/level/block/WallBannerBlock.java index 028b64b8..d4073ce9 100644 --- a/net/minecraft/world/level/block/WallBannerBlock.java +++ b/net/minecraft/world/level/block/WallBannerBlock.java @@ -7,15 +7,16 @@ import com.mojang.serialization.codecs.RecordCodecBuilder; import java.util.Map; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; +import net.minecraft.util.RandomSource; import net.minecraft.world.item.DyeColor; import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.level.BlockGetter; -import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; -import net.minecraft.world.level.block.state.properties.DirectionProperty; +import net.minecraft.world.level.block.state.properties.EnumProperty; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.VoxelShape; @@ -23,7 +24,7 @@ public class WallBannerBlock extends AbstractBannerBlock { public static final MapCodec CODEC = RecordCodecBuilder.mapCodec( instance -> instance.group(DyeColor.CODEC.fieldOf("color").forGetter(AbstractBannerBlock::getColor), propertiesCodec()).apply(instance, WallBannerBlock::new) ); - public static final DirectionProperty FACING = HorizontalDirectionalBlock.FACING; + public static final EnumProperty FACING = HorizontalDirectionalBlock.FACING; private static final Map SHAPES = Maps.newEnumMap( ImmutableMap.of( Direction.NORTH, @@ -47,21 +48,25 @@ public class WallBannerBlock extends AbstractBannerBlock { this.registerDefaultState(this.stateDefinition.any().setValue(FACING, Direction.NORTH)); } - @Override - public String getDescriptionId() { - return this.asItem().getDescriptionId(); - } - @Override protected boolean canSurvive(BlockState state, LevelReader level, BlockPos pos) { return level.getBlockState(pos.relative(((Direction)state.getValue(FACING)).getOpposite())).isSolid(); } @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { - return direction == ((Direction)state.getValue(FACING)).getOpposite() && !state.canSurvive(level, pos) + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { + return direction == ((Direction)blockState.getValue(FACING)).getOpposite() && !blockState.canSurvive(levelReader, blockPos) ? Blocks.AIR.defaultBlockState() - : super.updateShape(state, direction, neighborState, level, pos, neighborPos); + : super.updateShape(blockState, levelReader, scheduledTickAccess, blockPos, direction, blockPos2, blockState2, randomSource); } @Override diff --git a/net/minecraft/world/level/block/WallBlock.java b/net/minecraft/world/level/block/WallBlock.java index f194ae78..25b6d727 100644 --- a/net/minecraft/world/level/block/WallBlock.java +++ b/net/minecraft/world/level/block/WallBlock.java @@ -7,10 +7,11 @@ import java.util.Map; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.tags.BlockTags; +import net.minecraft.util.RandomSource; import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.level.BlockGetter; -import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; @@ -170,17 +171,26 @@ public class WallBlock extends Block implements SimpleWaterloggedBlock { } @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { - if ((Boolean)state.getValue(WATERLOGGED)) { - level.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(level)); + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { + if ((Boolean)blockState.getValue(WATERLOGGED)) { + scheduledTickAccess.scheduleTick(blockPos, Fluids.WATER, Fluids.WATER.getTickDelay(levelReader)); } if (direction == Direction.DOWN) { - return super.updateShape(state, direction, neighborState, level, pos, neighborPos); + return super.updateShape(blockState, levelReader, scheduledTickAccess, blockPos, direction, blockPos2, blockState2, randomSource); } else { return direction == Direction.UP - ? this.topUpdate(level, state, neighborPos, neighborState) - : this.sideUpdate(level, pos, state, neighborPos, neighborState, direction); + ? this.topUpdate(levelReader, blockState, blockPos2, blockState2) + : this.sideUpdate(levelReader, blockPos, blockState, blockPos2, blockState2, direction); } } @@ -280,8 +290,8 @@ public class WallBlock extends Block implements SimpleWaterloggedBlock { } @Override - protected boolean propagatesSkylightDown(BlockState state, BlockGetter level, BlockPos pos) { - return !(Boolean)state.getValue(WATERLOGGED); + protected boolean propagatesSkylightDown(BlockState blockState) { + return !(Boolean)blockState.getValue(WATERLOGGED); } @Override diff --git a/net/minecraft/world/level/block/WallHangingSignBlock.java b/net/minecraft/world/level/block/WallHangingSignBlock.java index 6fad25a1..bd1e0caf 100644 --- a/net/minecraft/world/level/block/WallHangingSignBlock.java +++ b/net/minecraft/world/level/block/WallHangingSignBlock.java @@ -8,16 +8,17 @@ import java.util.Map; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.tags.BlockTags; +import net.minecraft.util.RandomSource; import net.minecraft.world.InteractionHand; -import net.minecraft.world.ItemInteractionResult; +import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.HangingSignItem; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; -import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntityTicker; import net.minecraft.world.level.block.entity.BlockEntityType; @@ -26,7 +27,7 @@ import net.minecraft.world.level.block.entity.SignBlockEntity; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; -import net.minecraft.world.level.block.state.properties.DirectionProperty; +import net.minecraft.world.level.block.state.properties.EnumProperty; import net.minecraft.world.level.block.state.properties.WoodType; import net.minecraft.world.level.material.FluidState; import net.minecraft.world.level.material.Fluids; @@ -41,7 +42,7 @@ public class WallHangingSignBlock extends SignBlock { public static final MapCodec CODEC = RecordCodecBuilder.mapCodec( instance -> instance.group(WoodType.CODEC.fieldOf("wood_type").forGetter(SignBlock::type), propertiesCodec()).apply(instance, WallHangingSignBlock::new) ); - public static final DirectionProperty FACING = HorizontalDirectionalBlock.FACING; + public static final EnumProperty FACING = HorizontalDirectionalBlock.FACING; public static final VoxelShape PLANK_NORTHSOUTH = Block.box(0.0, 14.0, 6.0, 16.0, 16.0, 10.0); public static final VoxelShape PLANK_EASTWEST = Block.box(6.0, 14.0, 0.0, 10.0, 16.0, 16.0); public static final VoxelShape SHAPE_NORTHSOUTH = Shapes.or(PLANK_NORTHSOUTH, Block.box(1.0, 0.0, 7.0, 15.0, 10.0, 9.0)); @@ -61,13 +62,13 @@ public class WallHangingSignBlock extends SignBlock { } @Override - protected ItemInteractionResult useItemOn( - ItemStack stack, BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hitResult + protected InteractionResult useItemOn( + ItemStack itemStack, BlockState blockState, Level level, BlockPos blockPos, Player player, InteractionHand interactionHand, BlockHitResult blockHitResult ) { - return level.getBlockEntity(pos) instanceof SignBlockEntity signBlockEntity - && this.shouldTryToChainAnotherHangingSign(state, player, hitResult, signBlockEntity, stack) - ? ItemInteractionResult.SKIP_DEFAULT_BLOCK_INTERACTION - : super.useItemOn(stack, state, level, pos, player, hand, hitResult); + return (InteractionResult)(level.getBlockEntity(blockPos) instanceof SignBlockEntity signBlockEntity + && this.shouldTryToChainAnotherHangingSign(blockState, player, blockHitResult, signBlockEntity, itemStack) + ? InteractionResult.PASS + : super.useItemOn(itemStack, blockState, level, blockPos, player, interactionHand, blockHitResult)); } private boolean shouldTryToChainAnotherHangingSign(BlockState state, Player player, BlockHitResult hitResult, SignBlockEntity sign, ItemStack stack) { @@ -80,11 +81,6 @@ public class WallHangingSignBlock extends SignBlock { return hitResult.getDirection().getAxis() == ((Direction)state.getValue(FACING)).getAxis(); } - @Override - public String getDescriptionId() { - return this.asItem().getDescriptionId(); - } - @Override protected VoxelShape getShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext context) { return (VoxelShape)AABBS.get(state.getValue(FACING)); @@ -141,10 +137,19 @@ public class WallHangingSignBlock extends SignBlock { } @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { - return direction.getAxis() == ((Direction)state.getValue(FACING)).getClockWise().getAxis() && !state.canSurvive(level, pos) + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { + return direction.getAxis() == ((Direction)blockState.getValue(FACING)).getClockWise().getAxis() && !blockState.canSurvive(levelReader, blockPos) ? Blocks.AIR.defaultBlockState() - : super.updateShape(state, direction, neighborState, level, pos, neighborPos); + : super.updateShape(blockState, levelReader, scheduledTickAccess, blockPos, direction, blockPos2, blockState2, randomSource); } @Override diff --git a/net/minecraft/world/level/block/WallSignBlock.java b/net/minecraft/world/level/block/WallSignBlock.java index 6f77ea5d..a5bc93eb 100644 --- a/net/minecraft/world/level/block/WallSignBlock.java +++ b/net/minecraft/world/level/block/WallSignBlock.java @@ -7,14 +7,15 @@ import com.mojang.serialization.codecs.RecordCodecBuilder; import java.util.Map; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; +import net.minecraft.util.RandomSource; import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.level.BlockGetter; -import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; -import net.minecraft.world.level.block.state.properties.DirectionProperty; +import net.minecraft.world.level.block.state.properties.EnumProperty; import net.minecraft.world.level.block.state.properties.WoodType; import net.minecraft.world.level.material.FluidState; import net.minecraft.world.level.material.Fluids; @@ -27,7 +28,7 @@ public class WallSignBlock extends SignBlock { public static final MapCodec CODEC = RecordCodecBuilder.mapCodec( instance -> instance.group(WoodType.CODEC.fieldOf("wood_type").forGetter(SignBlock::type), propertiesCodec()).apply(instance, WallSignBlock::new) ); - public static final DirectionProperty FACING = HorizontalDirectionalBlock.FACING; + public static final EnumProperty FACING = HorizontalDirectionalBlock.FACING; protected static final float AABB_THICKNESS = 2.0F; protected static final float AABB_BOTTOM = 4.5F; protected static final float AABB_TOP = 12.5F; @@ -54,11 +55,6 @@ public class WallSignBlock extends SignBlock { this.registerDefaultState(this.stateDefinition.any().setValue(FACING, Direction.NORTH).setValue(WATERLOGGED, false)); } - @Override - public String getDescriptionId() { - return this.asItem().getDescriptionId(); - } - @Override protected VoxelShape getShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext context) { return (VoxelShape)AABBS.get(state.getValue(FACING)); @@ -92,10 +88,19 @@ public class WallSignBlock extends SignBlock { } @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { - return direction.getOpposite() == state.getValue(FACING) && !state.canSurvive(level, pos) + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { + return direction.getOpposite() == blockState.getValue(FACING) && !blockState.canSurvive(levelReader, blockPos) ? Blocks.AIR.defaultBlockState() - : super.updateShape(state, direction, neighborState, level, pos, neighborPos); + : super.updateShape(blockState, levelReader, scheduledTickAccess, blockPos, direction, blockPos2, blockState2, randomSource); } @Override diff --git a/net/minecraft/world/level/block/WallSkullBlock.java b/net/minecraft/world/level/block/WallSkullBlock.java index a5392d37..9785d8f3 100644 --- a/net/minecraft/world/level/block/WallSkullBlock.java +++ b/net/minecraft/world/level/block/WallSkullBlock.java @@ -12,7 +12,7 @@ import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; -import net.minecraft.world.level.block.state.properties.DirectionProperty; +import net.minecraft.world.level.block.state.properties.EnumProperty; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.VoxelShape; @@ -21,7 +21,7 @@ public class WallSkullBlock extends AbstractSkullBlock { instance -> instance.group(SkullBlock.Type.CODEC.fieldOf("kind").forGetter(AbstractSkullBlock::getType), propertiesCodec()) .apply(instance, WallSkullBlock::new) ); - public static final DirectionProperty FACING = HorizontalDirectionalBlock.FACING; + public static final EnumProperty FACING = HorizontalDirectionalBlock.FACING; private static final Map AABBS = Maps.newEnumMap( ImmutableMap.of( Direction.NORTH, @@ -45,11 +45,6 @@ public class WallSkullBlock extends AbstractSkullBlock { this.registerDefaultState(this.defaultBlockState().setValue(FACING, Direction.NORTH)); } - @Override - public String getDescriptionId() { - return this.asItem().getDescriptionId(); - } - @Override protected VoxelShape getShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext context) { return (VoxelShape)AABBS.get(state.getValue(FACING)); diff --git a/net/minecraft/world/level/block/WallTorchBlock.java b/net/minecraft/world/level/block/WallTorchBlock.java index 139155ce..a5d3d0fe 100644 --- a/net/minecraft/world/level/block/WallTorchBlock.java +++ b/net/minecraft/world/level/block/WallTorchBlock.java @@ -13,12 +13,12 @@ import net.minecraft.util.RandomSource; import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; -import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; -import net.minecraft.world.level.block.state.properties.DirectionProperty; +import net.minecraft.world.level.block.state.properties.EnumProperty; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.VoxelShape; import org.jetbrains.annotations.Nullable; @@ -28,7 +28,7 @@ public class WallTorchBlock extends TorchBlock { instance -> instance.group(PARTICLE_OPTIONS_FIELD.forGetter(wallTorchBlock -> wallTorchBlock.flameParticle), propertiesCodec()) .apply(instance, WallTorchBlock::new) ); - public static final DirectionProperty FACING = HorizontalDirectionalBlock.FACING; + public static final EnumProperty FACING = HorizontalDirectionalBlock.FACING; protected static final float AABB_OFFSET = 2.5F; private static final Map AABBS = Maps.newEnumMap( ImmutableMap.of( @@ -53,11 +53,6 @@ public class WallTorchBlock extends TorchBlock { this.registerDefaultState(this.stateDefinition.any().setValue(FACING, Direction.NORTH)); } - @Override - public String getDescriptionId() { - return this.asItem().getDescriptionId(); - } - @Override protected VoxelShape getShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext context) { return getShape(state); @@ -100,8 +95,17 @@ public class WallTorchBlock extends TorchBlock { } @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { - return direction.getOpposite() == state.getValue(FACING) && !state.canSurvive(level, pos) ? Blocks.AIR.defaultBlockState() : state; + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { + return direction.getOpposite() == blockState.getValue(FACING) && !blockState.canSurvive(levelReader, blockPos) ? Blocks.AIR.defaultBlockState() : blockState; } @Override diff --git a/net/minecraft/world/level/block/WaterlilyBlock.java b/net/minecraft/world/level/block/WaterlilyBlock.java index 6b94ec9b..3ed459b5 100644 --- a/net/minecraft/world/level/block/WaterlilyBlock.java +++ b/net/minecraft/world/level/block/WaterlilyBlock.java @@ -4,7 +4,7 @@ import com.mojang.serialization.MapCodec; import net.minecraft.core.BlockPos; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.entity.Entity; -import net.minecraft.world.entity.vehicle.Boat; +import net.minecraft.world.entity.vehicle.AbstractBoat; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.state.BlockBehaviour; @@ -30,7 +30,7 @@ public class WaterlilyBlock extends BushBlock { @Override protected void entityInside(BlockState state, Level level, BlockPos pos, Entity entity) { super.entityInside(state, level, pos, entity); - if (level instanceof ServerLevel && entity instanceof Boat) { + if (level instanceof ServerLevel && entity instanceof AbstractBoat) { level.destroyBlock(new BlockPos(pos), true, entity); } } diff --git a/net/minecraft/world/level/block/WaterloggedTransparentBlock.java b/net/minecraft/world/level/block/WaterloggedTransparentBlock.java index a90134db..d0c6928f 100644 --- a/net/minecraft/world/level/block/WaterloggedTransparentBlock.java +++ b/net/minecraft/world/level/block/WaterloggedTransparentBlock.java @@ -3,8 +3,10 @@ package net.minecraft.world.level.block; import com.mojang.serialization.MapCodec; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; +import net.minecraft.util.RandomSource; import net.minecraft.world.item.context.BlockPlaceContext; -import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; @@ -36,12 +38,21 @@ public class WaterloggedTransparentBlock extends TransparentBlock implements Sim } @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { - if ((Boolean)state.getValue(WATERLOGGED)) { - level.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(level)); + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { + if ((Boolean)blockState.getValue(WATERLOGGED)) { + scheduledTickAccess.scheduleTick(blockPos, Fluids.WATER, Fluids.WATER.getTickDelay(levelReader)); } - return super.updateShape(state, direction, neighborState, level, pos, neighborPos); + return super.updateShape(blockState, levelReader, scheduledTickAccess, blockPos, direction, blockPos2, blockState2, randomSource); } @Override diff --git a/net/minecraft/world/level/block/WitherRoseBlock.java b/net/minecraft/world/level/block/WitherRoseBlock.java index a3aa9e74..9d648747 100644 --- a/net/minecraft/world/level/block/WitherRoseBlock.java +++ b/net/minecraft/world/level/block/WitherRoseBlock.java @@ -5,6 +5,7 @@ import com.mojang.serialization.codecs.RecordCodecBuilder; import net.minecraft.core.BlockPos; import net.minecraft.core.Holder; import net.minecraft.core.particles.ParticleTypes; +import net.minecraft.server.level.ServerLevel; import net.minecraft.util.RandomSource; import net.minecraft.world.Difficulty; import net.minecraft.world.effect.MobEffect; @@ -62,10 +63,11 @@ public class WitherRoseBlock extends FlowerBlock { @Override protected void entityInside(BlockState state, Level level, BlockPos pos, Entity entity) { - if (!level.isClientSide && level.getDifficulty() != Difficulty.PEACEFUL) { - if (entity instanceof LivingEntity livingEntity && !livingEntity.isInvulnerableTo(level.damageSources().wither())) { - livingEntity.addEffect(new MobEffectInstance(MobEffects.WITHER, 40)); - } + if (level instanceof ServerLevel serverLevel + && level.getDifficulty() != Difficulty.PEACEFUL + && entity instanceof LivingEntity livingEntity + && !livingEntity.isInvulnerableTo(serverLevel, level.damageSources().wither())) { + livingEntity.addEffect(new MobEffectInstance(MobEffects.WITHER, 40)); } } } diff --git a/net/minecraft/world/level/block/WitherSkullBlock.java b/net/minecraft/world/level/block/WitherSkullBlock.java index 6d9be36b..1552c07c 100644 --- a/net/minecraft/world/level/block/WitherSkullBlock.java +++ b/net/minecraft/world/level/block/WitherSkullBlock.java @@ -7,6 +7,7 @@ import net.minecraft.core.Direction; import net.minecraft.server.level.ServerPlayer; import net.minecraft.tags.BlockTags; import net.minecraft.world.Difficulty; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.boss.wither.WitherBoss; @@ -19,6 +20,7 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.pattern.BlockInWorld; import net.minecraft.world.level.block.state.pattern.BlockPattern; import net.minecraft.world.level.block.state.pattern.BlockPatternBuilder; +import net.minecraft.world.level.block.state.pattern.BlockPattern.BlockPatternMatch; import net.minecraft.world.level.block.state.predicate.BlockStatePredicate; import org.jetbrains.annotations.Nullable; @@ -53,10 +55,10 @@ public class WitherSkullBlock extends SkullBlock { if (!level.isClientSide) { BlockState blockState = blockEntity.getBlockState(); boolean bl = blockState.is(Blocks.WITHER_SKELETON_SKULL) || blockState.is(Blocks.WITHER_SKELETON_WALL_SKULL); - if (bl && pos.getY() >= level.getMinBuildHeight() && level.getDifficulty() != Difficulty.PEACEFUL) { - BlockPattern.BlockPatternMatch blockPatternMatch = getOrCreateWitherFull().find(level, pos); + if (bl && pos.getY() >= level.getMinY() && level.getDifficulty() != Difficulty.PEACEFUL) { + BlockPatternMatch blockPatternMatch = getOrCreateWitherFull().find(level, pos); if (blockPatternMatch != null) { - WitherBoss witherBoss = EntityType.WITHER.create(level); + WitherBoss witherBoss = EntityType.WITHER.create(level, EntitySpawnReason.TRIGGERED); if (witherBoss != null) { CarvedPumpkinBlock.clearPatternBlocks(level, blockPatternMatch); BlockPos blockPos = blockPatternMatch.getBlock(1, 2, 0).getPos(); @@ -79,10 +81,7 @@ public class WitherSkullBlock extends SkullBlock { } public static boolean canSpawnMob(Level level, BlockPos pos, ItemStack stack) { - return stack.is(Items.WITHER_SKELETON_SKULL) - && pos.getY() >= level.getMinBuildHeight() + 2 - && level.getDifficulty() != Difficulty.PEACEFUL - && !level.isClientSide + return stack.is(Items.WITHER_SKELETON_SKULL) && pos.getY() >= level.getMinY() + 2 && level.getDifficulty() != Difficulty.PEACEFUL && !level.isClientSide ? getOrCreateWitherBase().find(level, pos) != null : false; } diff --git a/net/minecraft/world/level/block/WoolCarpetBlock.java b/net/minecraft/world/level/block/WoolCarpetBlock.java index 9e51ae7d..057d3b27 100644 --- a/net/minecraft/world/level/block/WoolCarpetBlock.java +++ b/net/minecraft/world/level/block/WoolCarpetBlock.java @@ -2,15 +2,10 @@ package net.minecraft.world.level.block; import com.mojang.serialization.MapCodec; import com.mojang.serialization.codecs.RecordCodecBuilder; -import net.minecraft.core.Holder; -import net.minecraft.sounds.SoundEvent; -import net.minecraft.sounds.SoundEvents; -import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.item.DyeColor; -import net.minecraft.world.item.Equipable; import net.minecraft.world.level.block.state.BlockBehaviour; -public class WoolCarpetBlock extends CarpetBlock implements Equipable { +public class WoolCarpetBlock extends CarpetBlock { public static final MapCodec CODEC = RecordCodecBuilder.mapCodec( instance -> instance.group(DyeColor.CODEC.fieldOf("color").forGetter(WoolCarpetBlock::getColor), propertiesCodec()).apply(instance, WoolCarpetBlock::new) ); @@ -29,14 +24,4 @@ public class WoolCarpetBlock extends CarpetBlock implements Equipable { public DyeColor getColor() { return this.color; } - - @Override - public EquipmentSlot getEquipmentSlot() { - return EquipmentSlot.BODY; - } - - @Override - public Holder getEquipSound() { - return SoundEvents.LLAMA_SWAG; - } } diff --git a/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java b/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java index ffbb8e30..e3954e33 100644 --- a/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java +++ b/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java @@ -1,32 +1,26 @@ package net.minecraft.world.level.block.entity; import com.google.common.collect.Lists; -import com.google.common.collect.Maps; -import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; -import it.unimi.dsi.fastutil.objects.Object2IntMap.Entry; +import it.unimi.dsi.fastutil.objects.Reference2IntOpenHashMap; +import it.unimi.dsi.fastutil.objects.Reference2IntMap.Entry; import java.util.List; -import java.util.Map; -import net.minecraft.SharedConstants; -import net.minecraft.Util; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; -import net.minecraft.core.Holder; import net.minecraft.core.HolderLookup; import net.minecraft.core.NonNullList; import net.minecraft.core.RegistryAccess; -import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.core.registries.Registries; import net.minecraft.nbt.CompoundTag; +import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; -import net.minecraft.tags.ItemTags; -import net.minecraft.tags.TagKey; import net.minecraft.util.Mth; import net.minecraft.world.ContainerHelper; import net.minecraft.world.WorldlyContainer; import net.minecraft.world.entity.ExperienceOrb; import net.minecraft.world.entity.player.Player; -import net.minecraft.world.entity.player.StackedContents; +import net.minecraft.world.entity.player.StackedItemContents; import net.minecraft.world.inventory.ContainerData; import net.minecraft.world.inventory.RecipeCraftingHolder; import net.minecraft.world.inventory.StackedContentsCompatible; @@ -34,12 +28,11 @@ import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.item.crafting.AbstractCookingRecipe; +import net.minecraft.world.item.crafting.Recipe; import net.minecraft.world.item.crafting.RecipeHolder; import net.minecraft.world.item.crafting.RecipeManager; import net.minecraft.world.item.crafting.RecipeType; import net.minecraft.world.item.crafting.SingleRecipeInput; -import net.minecraft.world.level.ItemLike; -import net.minecraft.world.level.Level; import net.minecraft.world.level.block.AbstractFurnaceBlock; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.state.BlockState; @@ -60,13 +53,12 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit public static final int NUM_DATA_VALUES = 4; public static final int BURN_TIME_STANDARD = 200; public static final int BURN_COOL_SPEED = 2; + public static final int UNKNOWN_LIT_DURATION = 0; protected NonNullList items = NonNullList.withSize(3, ItemStack.EMPTY); int litTime; - int litDuration; + int litDuration = 0; int cookingProgress; int cookingTotalTime; - @Nullable - private static volatile Map fuelCache; protected final ContainerData dataAccess = new ContainerData() { @Override public int get(int index) { @@ -106,7 +98,7 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit return 4; } }; - private final Object2IntOpenHashMap recipesUsed = new Object2IntOpenHashMap<>(); + private final Reference2IntOpenHashMap>> recipesUsed = new Reference2IntOpenHashMap<>(); private final RecipeManager.CachedCheck quickCheck; protected AbstractFurnaceBlockEntity(BlockEntityType type, BlockPos pos, BlockState blockState, RecipeType recipeType) { @@ -114,107 +106,6 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit this.quickCheck = RecipeManager.createCheck(recipeType); } - public static void invalidateCache() { - fuelCache = null; - } - - public static Map getFuel() { - Map map = fuelCache; - if (map != null) { - return map; - } else { - Map map2 = Maps.newLinkedHashMap(); - add(map2, Items.LAVA_BUCKET, 20000); - add(map2, Blocks.COAL_BLOCK, 16000); - add(map2, Items.BLAZE_ROD, 2400); - add(map2, Items.COAL, 1600); - add(map2, Items.CHARCOAL, 1600); - add(map2, ItemTags.LOGS, 300); - add(map2, ItemTags.BAMBOO_BLOCKS, 300); - add(map2, ItemTags.PLANKS, 300); - add(map2, Blocks.BAMBOO_MOSAIC, 300); - add(map2, ItemTags.WOODEN_STAIRS, 300); - add(map2, Blocks.BAMBOO_MOSAIC_STAIRS, 300); - add(map2, ItemTags.WOODEN_SLABS, 150); - add(map2, Blocks.BAMBOO_MOSAIC_SLAB, 150); - add(map2, ItemTags.WOODEN_TRAPDOORS, 300); - add(map2, ItemTags.WOODEN_PRESSURE_PLATES, 300); - add(map2, ItemTags.WOODEN_FENCES, 300); - add(map2, ItemTags.FENCE_GATES, 300); - add(map2, Blocks.NOTE_BLOCK, 300); - add(map2, Blocks.BOOKSHELF, 300); - add(map2, Blocks.CHISELED_BOOKSHELF, 300); - add(map2, Blocks.LECTERN, 300); - add(map2, Blocks.JUKEBOX, 300); - add(map2, Blocks.CHEST, 300); - add(map2, Blocks.TRAPPED_CHEST, 300); - add(map2, Blocks.CRAFTING_TABLE, 300); - add(map2, Blocks.DAYLIGHT_DETECTOR, 300); - add(map2, ItemTags.BANNERS, 300); - add(map2, Items.BOW, 300); - add(map2, Items.FISHING_ROD, 300); - add(map2, Blocks.LADDER, 300); - add(map2, ItemTags.SIGNS, 200); - add(map2, ItemTags.HANGING_SIGNS, 800); - add(map2, Items.WOODEN_SHOVEL, 200); - add(map2, Items.WOODEN_SWORD, 200); - add(map2, Items.WOODEN_HOE, 200); - add(map2, Items.WOODEN_AXE, 200); - add(map2, Items.WOODEN_PICKAXE, 200); - add(map2, ItemTags.WOODEN_DOORS, 200); - add(map2, ItemTags.BOATS, 1200); - add(map2, ItemTags.WOOL, 100); - add(map2, ItemTags.WOODEN_BUTTONS, 100); - add(map2, Items.STICK, 100); - add(map2, ItemTags.SAPLINGS, 100); - add(map2, Items.BOWL, 100); - add(map2, ItemTags.WOOL_CARPETS, 67); - add(map2, Blocks.DRIED_KELP_BLOCK, 4001); - add(map2, Items.CROSSBOW, 300); - add(map2, Blocks.BAMBOO, 50); - add(map2, Blocks.DEAD_BUSH, 100); - add(map2, Blocks.SCAFFOLDING, 50); - add(map2, Blocks.LOOM, 300); - add(map2, Blocks.BARREL, 300); - add(map2, Blocks.CARTOGRAPHY_TABLE, 300); - add(map2, Blocks.FLETCHING_TABLE, 300); - add(map2, Blocks.SMITHING_TABLE, 300); - add(map2, Blocks.COMPOSTER, 300); - add(map2, Blocks.AZALEA, 100); - add(map2, Blocks.FLOWERING_AZALEA, 100); - add(map2, Blocks.MANGROVE_ROOTS, 300); - fuelCache = map2; - return map2; - } - } - - private static boolean isNeverAFurnaceFuel(Item item) { - return item.builtInRegistryHolder().is(ItemTags.NON_FLAMMABLE_WOOD); - } - - private static void add(Map map, TagKey itemTag, int burnTime) { - for (Holder holder : BuiltInRegistries.ITEM.getTagOrEmpty(itemTag)) { - if (!isNeverAFurnaceFuel(holder.value())) { - map.put(holder.value(), burnTime); - } - } - } - - private static void add(Map map, ItemLike item, int burnTime) { - Item item2 = item.asItem(); - if (isNeverAFurnaceFuel(item2)) { - if (SharedConstants.IS_RUNNING_IN_IDE) { - throw (IllegalStateException)Util.pauseInIde( - new IllegalStateException( - "A developer tried to explicitly make fire resistant item " + item2.getName(null).getString() + " a furnace fuel. That will not work!" - ) - ); - } - } else { - map.put(item2, burnTime); - } - } - private boolean isLit() { return this.litTime > 0; } @@ -227,11 +118,11 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit this.litTime = tag.getShort("BurnTime"); this.cookingProgress = tag.getShort("CookTime"); this.cookingTotalTime = tag.getShort("CookTimeTotal"); - this.litDuration = this.getBurnDuration(this.items.get(1)); + this.litDuration = 0; CompoundTag compoundTag = tag.getCompound("RecipesUsed"); for (String string : compoundTag.getAllKeys()) { - this.recipesUsed.put(ResourceLocation.parse(string), compoundTag.getInt(string)); + this.recipesUsed.put(ResourceKey.create(Registries.RECIPE, ResourceLocation.parse(string)), compoundTag.getInt(string)); } } @@ -243,90 +134,100 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit tag.putShort("CookTimeTotal", (short)this.cookingTotalTime); ContainerHelper.saveAllItems(tag, this.items, registries); CompoundTag compoundTag = new CompoundTag(); - this.recipesUsed.forEach((resourceLocation, integer) -> compoundTag.putInt(resourceLocation.toString(), integer)); + this.recipesUsed.forEach((resourceKey, integer) -> compoundTag.putInt(resourceKey.location().toString(), integer)); tag.put("RecipesUsed", compoundTag); } - public static void serverTick(Level level, BlockPos pos, BlockState state, AbstractFurnaceBlockEntity blockEntity) { - boolean bl = blockEntity.isLit(); + public static void serverTick(ServerLevel serverLevel, BlockPos blockPos, BlockState blockState, AbstractFurnaceBlockEntity abstractFurnaceBlockEntity) { + boolean bl = abstractFurnaceBlockEntity.isLit(); boolean bl2 = false; - if (blockEntity.isLit()) { - blockEntity.litTime--; + if (abstractFurnaceBlockEntity.isLit()) { + abstractFurnaceBlockEntity.litTime--; } - ItemStack itemStack = blockEntity.items.get(1); - ItemStack itemStack2 = blockEntity.items.get(0); + ItemStack itemStack = abstractFurnaceBlockEntity.items.get(1); + ItemStack itemStack2 = abstractFurnaceBlockEntity.items.get(0); boolean bl3 = !itemStack2.isEmpty(); boolean bl4 = !itemStack.isEmpty(); - if (blockEntity.isLit() || bl4 && bl3) { - RecipeHolder recipeHolder; + if (abstractFurnaceBlockEntity.litDuration == 0) { + abstractFurnaceBlockEntity.litDuration = abstractFurnaceBlockEntity.getBurnDuration(serverLevel.fuelValues(), itemStack); + } + + if (abstractFurnaceBlockEntity.isLit() || bl4 && bl3) { + SingleRecipeInput singleRecipeInput = new SingleRecipeInput(itemStack2); + RecipeHolder recipeHolder; if (bl3) { - recipeHolder = (RecipeHolder)blockEntity.quickCheck.getRecipeFor(new SingleRecipeInput(itemStack2), level).orElse(null); + recipeHolder = (RecipeHolder)abstractFurnaceBlockEntity.quickCheck + .getRecipeFor(singleRecipeInput, serverLevel) + .orElse(null); } else { recipeHolder = null; } - int i = blockEntity.getMaxStackSize(); - if (!blockEntity.isLit() && canBurn(level.registryAccess(), recipeHolder, blockEntity.items, i)) { - blockEntity.litTime = blockEntity.getBurnDuration(itemStack); - blockEntity.litDuration = blockEntity.litTime; - if (blockEntity.isLit()) { + int i = abstractFurnaceBlockEntity.getMaxStackSize(); + if (!abstractFurnaceBlockEntity.isLit() && canBurn(serverLevel.registryAccess(), recipeHolder, singleRecipeInput, abstractFurnaceBlockEntity.items, i)) { + abstractFurnaceBlockEntity.litTime = abstractFurnaceBlockEntity.getBurnDuration(serverLevel.fuelValues(), itemStack); + abstractFurnaceBlockEntity.litDuration = abstractFurnaceBlockEntity.litTime; + if (abstractFurnaceBlockEntity.isLit()) { bl2 = true; if (bl4) { Item item = itemStack.getItem(); itemStack.shrink(1); if (itemStack.isEmpty()) { - Item item2 = item.getCraftingRemainingItem(); - blockEntity.items.set(1, item2 == null ? ItemStack.EMPTY : new ItemStack(item2)); + abstractFurnaceBlockEntity.items.set(1, item.getCraftingRemainder()); } } } } - if (blockEntity.isLit() && canBurn(level.registryAccess(), recipeHolder, blockEntity.items, i)) { - blockEntity.cookingProgress++; - if (blockEntity.cookingProgress == blockEntity.cookingTotalTime) { - blockEntity.cookingProgress = 0; - blockEntity.cookingTotalTime = getTotalCookTime(level, blockEntity); - if (burn(level.registryAccess(), recipeHolder, blockEntity.items, i)) { - blockEntity.setRecipeUsed(recipeHolder); + if (abstractFurnaceBlockEntity.isLit() && canBurn(serverLevel.registryAccess(), recipeHolder, singleRecipeInput, abstractFurnaceBlockEntity.items, i)) { + abstractFurnaceBlockEntity.cookingProgress++; + if (abstractFurnaceBlockEntity.cookingProgress == abstractFurnaceBlockEntity.cookingTotalTime) { + abstractFurnaceBlockEntity.cookingProgress = 0; + abstractFurnaceBlockEntity.cookingTotalTime = getTotalCookTime(serverLevel, abstractFurnaceBlockEntity); + if (burn(serverLevel.registryAccess(), recipeHolder, singleRecipeInput, abstractFurnaceBlockEntity.items, i)) { + abstractFurnaceBlockEntity.setRecipeUsed(recipeHolder); } bl2 = true; } } else { - blockEntity.cookingProgress = 0; + abstractFurnaceBlockEntity.cookingProgress = 0; } - } else if (!blockEntity.isLit() && blockEntity.cookingProgress > 0) { - blockEntity.cookingProgress = Mth.clamp(blockEntity.cookingProgress - 2, 0, blockEntity.cookingTotalTime); + } else if (!abstractFurnaceBlockEntity.isLit() && abstractFurnaceBlockEntity.cookingProgress > 0) { + abstractFurnaceBlockEntity.cookingProgress = Mth.clamp(abstractFurnaceBlockEntity.cookingProgress - 2, 0, abstractFurnaceBlockEntity.cookingTotalTime); } - if (bl != blockEntity.isLit()) { + if (bl != abstractFurnaceBlockEntity.isLit()) { bl2 = true; - state = state.setValue(AbstractFurnaceBlock.LIT, blockEntity.isLit()); - level.setBlock(pos, state, 3); + blockState = blockState.setValue(AbstractFurnaceBlock.LIT, abstractFurnaceBlockEntity.isLit()); + serverLevel.setBlock(blockPos, blockState, 3); } if (bl2) { - setChanged(level, pos, state); + setChanged(serverLevel, blockPos, blockState); } } - private static boolean canBurn(RegistryAccess registryAccess, @Nullable RecipeHolder recipe, NonNullList inventory, int maxStackSize) { - if (!inventory.get(0).isEmpty() && recipe != null) { - ItemStack itemStack = recipe.value().getResultItem(registryAccess); + private static boolean canBurn( + RegistryAccess registryAccess, + @Nullable RecipeHolder recipeHolder, + SingleRecipeInput singleRecipeInput, + NonNullList nonNullList, + int i + ) { + if (!nonNullList.get(0).isEmpty() && recipeHolder != null) { + ItemStack itemStack = recipeHolder.value().assemble(singleRecipeInput, registryAccess); if (itemStack.isEmpty()) { return false; } else { - ItemStack itemStack2 = inventory.get(2); + ItemStack itemStack2 = nonNullList.get(2); if (itemStack2.isEmpty()) { return true; } else if (!ItemStack.isSameItemSameComponents(itemStack2, itemStack)) { return false; } else { - return itemStack2.getCount() < maxStackSize && itemStack2.getCount() < itemStack2.getMaxStackSize() - ? true - : itemStack2.getCount() < itemStack.getMaxStackSize(); + return itemStack2.getCount() < i && itemStack2.getCount() < itemStack2.getMaxStackSize() ? true : itemStack2.getCount() < itemStack.getMaxStackSize(); } } } else { @@ -334,19 +235,25 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit } } - private static boolean burn(RegistryAccess registryAccess, @Nullable RecipeHolder recipe, NonNullList inventory, int maxStackSize) { - if (recipe != null && canBurn(registryAccess, recipe, inventory, maxStackSize)) { - ItemStack itemStack = inventory.get(0); - ItemStack itemStack2 = recipe.value().getResultItem(registryAccess); - ItemStack itemStack3 = inventory.get(2); + private static boolean burn( + RegistryAccess registryAccess, + @Nullable RecipeHolder recipeHolder, + SingleRecipeInput singleRecipeInput, + NonNullList nonNullList, + int i + ) { + if (recipeHolder != null && canBurn(registryAccess, recipeHolder, singleRecipeInput, nonNullList, i)) { + ItemStack itemStack = nonNullList.get(0); + ItemStack itemStack2 = recipeHolder.value().assemble(singleRecipeInput, registryAccess); + ItemStack itemStack3 = nonNullList.get(2); if (itemStack3.isEmpty()) { - inventory.set(2, itemStack2.copy()); + nonNullList.set(2, itemStack2.copy()); } else if (ItemStack.isSameItemSameComponents(itemStack3, itemStack2)) { itemStack3.grow(1); } - if (itemStack.is(Blocks.WET_SPONGE.asItem()) && !inventory.get(1).isEmpty() && inventory.get(1).is(Items.BUCKET)) { - inventory.set(1, new ItemStack(Items.WATER_BUCKET)); + if (itemStack.is(Blocks.WET_SPONGE.asItem()) && !nonNullList.get(1).isEmpty() && nonNullList.get(1).is(Items.BUCKET)) { + nonNullList.set(1, new ItemStack(Items.WATER_BUCKET)); } itemStack.shrink(1); @@ -356,27 +263,18 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit } } - protected int getBurnDuration(ItemStack fuel) { - if (fuel.isEmpty()) { - return 0; - } else { - Item item = fuel.getItem(); - return (Integer)getFuel().getOrDefault(item, 0); - } + protected int getBurnDuration(FuelValues fuelValues, ItemStack itemStack) { + return fuelValues.burnDuration(itemStack); } - private static int getTotalCookTime(Level level, AbstractFurnaceBlockEntity blockEntity) { - SingleRecipeInput singleRecipeInput = new SingleRecipeInput(blockEntity.getItem(0)); - return (Integer)blockEntity.quickCheck - .getRecipeFor(singleRecipeInput, level) - .map(recipeHolder -> ((AbstractCookingRecipe)recipeHolder.value()).getCookingTime()) + private static int getTotalCookTime(ServerLevel serverLevel, AbstractFurnaceBlockEntity abstractFurnaceBlockEntity) { + SingleRecipeInput singleRecipeInput = new SingleRecipeInput(abstractFurnaceBlockEntity.getItem(0)); + return (Integer)abstractFurnaceBlockEntity.quickCheck + .getRecipeFor(singleRecipeInput, serverLevel) + .map(recipeHolder -> ((AbstractCookingRecipe)recipeHolder.value()).cookingTime()) .orElse(200); } - public static boolean isFuel(ItemStack stack) { - return getFuel().containsKey(stack.getItem()); - } - @Override public int[] getSlotsForFace(Direction side) { if (side == Direction.DOWN) { @@ -417,8 +315,8 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit boolean bl = !stack.isEmpty() && ItemStack.isSameItemSameComponents(itemStack, stack); this.items.set(slot, stack); stack.limitSize(this.getMaxStackSize(stack)); - if (slot == 0 && !bl) { - this.cookingTotalTime = getTotalCookTime(this.level, this); + if (slot == 0 && !bl && this.level instanceof ServerLevel serverLevel) { + this.cookingTotalTime = getTotalCookTime(serverLevel, this); this.cookingProgress = 0; this.setChanged(); } @@ -432,15 +330,15 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit return true; } else { ItemStack itemStack = this.items.get(1); - return isFuel(stack) || stack.is(Items.BUCKET) && !itemStack.is(Items.BUCKET); + return this.level.fuelValues().isFuel(stack) || stack.is(Items.BUCKET) && !itemStack.is(Items.BUCKET); } } @Override public void setRecipeUsed(@Nullable RecipeHolder recipe) { if (recipe != null) { - ResourceLocation resourceLocation = recipe.id(); - this.recipesUsed.addTo(resourceLocation, 1); + ResourceKey> resourceKey = recipe.id(); + this.recipesUsed.addTo(resourceKey, 1); } } @@ -470,10 +368,10 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit public List> getRecipesToAwardAndPopExperience(ServerLevel level, Vec3 popVec) { List> list = Lists.>newArrayList(); - for (Entry entry : this.recipesUsed.object2IntEntrySet()) { - level.getRecipeManager().byKey((ResourceLocation)entry.getKey()).ifPresent(recipeHolder -> { + for (Entry>> entry : this.recipesUsed.reference2IntEntrySet()) { + level.recipeAccess().byKey((ResourceKey>)entry.getKey()).ifPresent(recipeHolder -> { list.add(recipeHolder); - createExperience(level, popVec, entry.getIntValue(), ((AbstractCookingRecipe)recipeHolder.value()).getExperience()); + createExperience(level, popVec, entry.getIntValue(), ((AbstractCookingRecipe)recipeHolder.value()).experience()); }); } @@ -491,9 +389,9 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit } @Override - public void fillStackedContents(StackedContents contents) { + public void fillStackedContents(StackedItemContents stackedItemContents) { for (ItemStack itemStack : this.items) { - contents.accountStack(itemStack); + stackedItemContents.accountStack(itemStack); } } } diff --git a/net/minecraft/world/level/block/entity/BannerBlockEntity.java b/net/minecraft/world/level/block/entity/BannerBlockEntity.java index ad44aa19..9189e62b 100644 --- a/net/minecraft/world/level/block/entity/BannerBlockEntity.java +++ b/net/minecraft/world/level/block/entity/BannerBlockEntity.java @@ -3,8 +3,8 @@ package net.minecraft.world.level.block.entity; import com.mojang.logging.LogUtils; import net.minecraft.core.BlockPos; import net.minecraft.core.HolderLookup; -import net.minecraft.core.component.DataComponentMap; import net.minecraft.core.component.DataComponents; +import net.minecraft.core.component.DataComponentMap.Builder; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.NbtOps; import net.minecraft.network.chat.Component; @@ -114,7 +114,7 @@ public class BannerBlockEntity extends BlockEntity implements Nameable { } @Override - protected void collectImplicitComponents(DataComponentMap.Builder components) { + protected void collectImplicitComponents(Builder components) { super.collectImplicitComponents(components); components.set(DataComponents.BANNER_PATTERNS, this.patterns); components.set(DataComponents.CUSTOM_NAME, this.name); diff --git a/net/minecraft/world/level/block/entity/BannerPatterns.java b/net/minecraft/world/level/block/entity/BannerPatterns.java index 881a6a4b..f82d5f38 100644 --- a/net/minecraft/world/level/block/entity/BannerPatterns.java +++ b/net/minecraft/world/level/block/entity/BannerPatterns.java @@ -86,10 +86,10 @@ public class BannerPatterns { register(context, HALF_VERTICAL_MIRROR); register(context, HALF_HORIZONTAL_MIRROR); register(context, BORDER); - register(context, CURLY_BORDER); register(context, GRADIENT); register(context, GRADIENT_UP); register(context, BRICKS); + register(context, CURLY_BORDER); register(context, GLOBE); register(context, CREEPER); register(context, SKULL); diff --git a/net/minecraft/world/level/block/entity/BarrelBlockEntity.java b/net/minecraft/world/level/block/entity/BarrelBlockEntity.java index 932efb98..d196497a 100644 --- a/net/minecraft/world/level/block/entity/BarrelBlockEntity.java +++ b/net/minecraft/world/level/block/entity/BarrelBlockEntity.java @@ -122,7 +122,7 @@ public class BarrelBlockEntity extends RandomizableContainerBlockEntity { } void playSound(BlockState state, SoundEvent sound) { - Vec3i vec3i = ((Direction)state.getValue(BarrelBlock.FACING)).getNormal(); + Vec3i vec3i = ((Direction)state.getValue(BarrelBlock.FACING)).getUnitVec3i(); double d = this.worldPosition.getX() + 0.5 + vec3i.getX() / 2.0; double e = this.worldPosition.getY() + 0.5 + vec3i.getY() / 2.0; double f = this.worldPosition.getZ() + 0.5 + vec3i.getZ() / 2.0; diff --git a/net/minecraft/world/level/block/entity/BaseContainerBlockEntity.java b/net/minecraft/world/level/block/entity/BaseContainerBlockEntity.java index 1a344a87..1033e829 100644 --- a/net/minecraft/world/level/block/entity/BaseContainerBlockEntity.java +++ b/net/minecraft/world/level/block/entity/BaseContainerBlockEntity.java @@ -3,8 +3,8 @@ package net.minecraft.world.level.block.entity; import net.minecraft.core.BlockPos; import net.minecraft.core.HolderLookup; import net.minecraft.core.NonNullList; -import net.minecraft.core.component.DataComponentMap; import net.minecraft.core.component.DataComponents; +import net.minecraft.core.component.DataComponentMap.Builder; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.chat.Component; import net.minecraft.sounds.SoundEvents; @@ -34,7 +34,7 @@ public abstract class BaseContainerBlockEntity extends BlockEntity implements Co @Override protected void loadAdditional(CompoundTag tag, HolderLookup.Provider registries) { super.loadAdditional(tag, registries); - this.lockKey = LockCode.fromTag(tag); + this.lockKey = LockCode.fromTag(tag, registries); if (tag.contains("CustomName", 8)) { this.name = parseCustomNameSafe(tag.getString("CustomName"), registries); } @@ -43,7 +43,7 @@ public abstract class BaseContainerBlockEntity extends BlockEntity implements Co @Override protected void saveAdditional(CompoundTag tag, HolderLookup.Provider registries) { super.saveAdditional(tag, registries); - this.lockKey.addToTag(tag); + this.lockKey.addToTag(tag, registries); if (this.name != null) { tag.putString("CustomName", Component.Serializer.toJson(this.name, registries)); } @@ -150,7 +150,7 @@ public abstract class BaseContainerBlockEntity extends BlockEntity implements Co } @Override - protected void collectImplicitComponents(DataComponentMap.Builder components) { + protected void collectImplicitComponents(Builder components) { super.collectImplicitComponents(components); components.set(DataComponents.CUSTOM_NAME, this.name); if (!this.lockKey.equals(LockCode.NO_LOCK)) { @@ -163,7 +163,7 @@ public abstract class BaseContainerBlockEntity extends BlockEntity implements Co @Override public void removeComponentsFromTag(CompoundTag tag) { tag.remove("CustomName"); - tag.remove("Lock"); + tag.remove("lock"); tag.remove("Items"); } } diff --git a/net/minecraft/world/level/block/entity/BeaconBlockEntity.java b/net/minecraft/world/level/block/entity/BeaconBlockEntity.java index f0409080..2559689c 100644 --- a/net/minecraft/world/level/block/entity/BeaconBlockEntity.java +++ b/net/minecraft/world/level/block/entity/BeaconBlockEntity.java @@ -11,8 +11,8 @@ import net.minecraft.advancements.CriteriaTriggers; import net.minecraft.core.BlockPos; import net.minecraft.core.Holder; import net.minecraft.core.HolderLookup; -import net.minecraft.core.component.DataComponentMap; import net.minecraft.core.component.DataComponents; +import net.minecraft.core.component.DataComponentMap.Builder; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.chat.Component; @@ -23,7 +23,7 @@ import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; import net.minecraft.tags.BlockTags; -import net.minecraft.util.FastColor; +import net.minecraft.util.ARGB; import net.minecraft.world.LockCode; import net.minecraft.world.MenuProvider; import net.minecraft.world.Nameable; @@ -165,12 +165,12 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider, Name if (n == beaconBeamSection.color) { beaconBeamSection.increaseHeight(); } else { - beaconBeamSection = new BeaconBlockEntity.BeaconBeamSection(FastColor.ARGB32.average(beaconBeamSection.color, n)); + beaconBeamSection = new BeaconBlockEntity.BeaconBeamSection(ARGB.average(beaconBeamSection.color, n)); blockEntity.checkingBeamSections.add(beaconBeamSection); } } } else { - if (beaconBeamSection == null || blockState.getLightBlock(level, blockPos) >= 15 && !blockState.is(Blocks.BEDROCK)) { + if (beaconBeamSection == null || blockState.getLightBlock() >= 15 && !blockState.is(Blocks.BEDROCK)) { blockEntity.checkingBeamSections.clear(); blockEntity.lastCheckY = l; break; @@ -196,7 +196,7 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider, Name } if (blockEntity.lastCheckY >= l) { - blockEntity.lastCheckY = level.getMinBuildHeight() - 1; + blockEntity.lastCheckY = level.getMinY() - 1; boolean bl = m > 0; blockEntity.beamSections = blockEntity.checkingBeamSections; if (!level.isClientSide) { @@ -219,7 +219,7 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider, Name for (int j = 1; j <= 4; i = j++) { int k = y - j; - if (k < level.getMinBuildHeight()) { + if (k < level.getMinY()) { break; } @@ -301,7 +301,7 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider, Name private static Holder loadEffect(CompoundTag tag, String key) { if (tag.contains(key, 8)) { ResourceLocation resourceLocation = ResourceLocation.tryParse(tag.getString(key)); - return resourceLocation == null ? null : (Holder)BuiltInRegistries.MOB_EFFECT.getHolder(resourceLocation).map(BeaconBlockEntity::filterEffect).orElse(null); + return resourceLocation == null ? null : (Holder)BuiltInRegistries.MOB_EFFECT.get(resourceLocation).map(BeaconBlockEntity::filterEffect).orElse(null); } else { return null; } @@ -316,7 +316,7 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider, Name this.name = parseCustomNameSafe(tag.getString("CustomName"), registries); } - this.lockKey = LockCode.fromTag(tag); + this.lockKey = LockCode.fromTag(tag, registries); } @Override @@ -329,7 +329,7 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider, Name tag.putString("CustomName", Component.Serializer.toJson(this.name, registries)); } - this.lockKey.addToTag(tag); + this.lockKey.addToTag(tag, registries); } /** @@ -371,7 +371,7 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider, Name } @Override - protected void collectImplicitComponents(DataComponentMap.Builder components) { + protected void collectImplicitComponents(Builder components) { super.collectImplicitComponents(components); components.set(DataComponents.CUSTOM_NAME, this.name); if (!this.lockKey.equals(LockCode.NO_LOCK)) { @@ -382,13 +382,13 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider, Name @Override public void removeComponentsFromTag(CompoundTag tag) { tag.remove("CustomName"); - tag.remove("Lock"); + tag.remove("lock"); } @Override public void setLevel(Level level) { super.setLevel(level); - this.lastCheckY = level.getMinBuildHeight() - 1; + this.lastCheckY = level.getMinY() - 1; } public static class BeaconBeamSection { diff --git a/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java b/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java index 7b0007a9..2dde9916 100644 --- a/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java +++ b/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java @@ -11,8 +11,8 @@ import java.util.List; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.HolderLookup; -import net.minecraft.core.component.DataComponentMap; import net.minecraft.core.component.DataComponents; +import net.minecraft.core.component.DataComponentMap.Builder; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.NbtOps; @@ -26,6 +26,7 @@ import net.minecraft.tags.BlockTags; import net.minecraft.tags.EntityTypeTags; import net.minecraft.util.VisibleForDebug; import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.animal.Bee; import net.minecraft.world.entity.player.Player; @@ -36,6 +37,7 @@ import net.minecraft.world.level.block.CampfireBlock; import net.minecraft.world.level.block.FireBlock; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.level.gameevent.GameEvent.Context; import org.jetbrains.annotations.Nullable; import org.slf4j.Logger; @@ -170,7 +172,7 @@ public class BeehiveBlockEntity extends BlockEntity { BlockPos blockPos = this.getBlockPos(); this.level .playSound(null, (double)blockPos.getX(), (double)blockPos.getY(), (double)blockPos.getZ(), SoundEvents.BEEHIVE_ENTER, SoundSource.BLOCKS, 1.0F, 1.0F); - this.level.gameEvent(GameEvent.BLOCK_CHANGE, blockPos, GameEvent.Context.of(occupant, this.getBlockState())); + this.level.gameEvent(GameEvent.BLOCK_CHANGE, blockPos, Context.of(occupant, this.getBlockState())); } occupant.discard(); @@ -191,7 +193,7 @@ public class BeehiveBlockEntity extends BlockEntity { BeehiveBlockEntity.BeeReleaseStatus releaseStatus, @Nullable BlockPos storedFlowerPos ) { - if ((level.isNight() || level.isRaining()) && releaseStatus != BeehiveBlockEntity.BeeReleaseStatus.EMERGENCY) { + if (Bee.isNightOrRaining(level) && releaseStatus != BeehiveBlockEntity.BeeReleaseStatus.EMERGENCY) { return false; } else { Direction direction = state.getValue(BeehiveBlock.FACING); @@ -235,7 +237,7 @@ public class BeehiveBlockEntity extends BlockEntity { } level.playSound(null, pos, SoundEvents.BEEHIVE_EXIT, SoundSource.BLOCKS, 1.0F, 1.0F); - level.gameEvent(GameEvent.BLOCK_CHANGE, pos, GameEvent.Context.of(entity, level.getBlockState(pos))); + level.gameEvent(GameEvent.BLOCK_CHANGE, pos, Context.of(entity, level.getBlockState(pos))); return level.addFreshEntity(entity); } else { return false; @@ -314,7 +316,7 @@ public class BeehiveBlockEntity extends BlockEntity { } @Override - protected void collectImplicitComponents(DataComponentMap.Builder components) { + protected void collectImplicitComponents(Builder components) { super.collectImplicitComponents(components); components.set(DataComponents.BEES, this.getBees()); } @@ -395,7 +397,7 @@ public class BeehiveBlockEntity extends BlockEntity { public Entity createEntity(Level level, BlockPos pos) { CompoundTag compoundTag = this.entityData.copyTag(); BeehiveBlockEntity.IGNORED_BEE_TAGS.forEach(compoundTag::remove); - Entity entity = EntityType.loadEntityRecursive(compoundTag, level, entityx -> entityx); + Entity entity = EntityType.loadEntityRecursive(compoundTag, level, EntitySpawnReason.LOAD, entityx -> entityx); if (entity != null && entity.getType().is(EntityTypeTags.BEEHIVE_INHABITORS)) { entity.setNoGravity(true); if (entity instanceof Bee bee) { diff --git a/net/minecraft/world/level/block/entity/BlastFurnaceBlockEntity.java b/net/minecraft/world/level/block/entity/BlastFurnaceBlockEntity.java index f2afd53e..08d3e970 100644 --- a/net/minecraft/world/level/block/entity/BlastFurnaceBlockEntity.java +++ b/net/minecraft/world/level/block/entity/BlastFurnaceBlockEntity.java @@ -20,8 +20,8 @@ public class BlastFurnaceBlockEntity extends AbstractFurnaceBlockEntity { } @Override - protected int getBurnDuration(ItemStack fuel) { - return super.getBurnDuration(fuel) / 2; + protected int getBurnDuration(FuelValues fuelValues, ItemStack itemStack) { + return super.getBurnDuration(fuelValues, itemStack) / 2; } @Override diff --git a/net/minecraft/world/level/block/entity/BlockEntity.java b/net/minecraft/world/level/block/entity/BlockEntity.java index f768bbd1..167d5384 100644 --- a/net/minecraft/world/level/block/entity/BlockEntity.java +++ b/net/minecraft/world/level/block/entity/BlockEntity.java @@ -12,6 +12,7 @@ import net.minecraft.core.component.DataComponentPatch; import net.minecraft.core.component.DataComponentType; import net.minecraft.core.component.DataComponents; import net.minecraft.core.component.PatchedDataComponentMap; +import net.minecraft.core.component.DataComponentMap.Builder; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.NbtOps; @@ -141,6 +142,7 @@ public abstract class BlockEntity { public void saveToItem(ItemStack stack, HolderLookup.Provider registries) { CompoundTag compoundTag = this.saveCustomOnly(registries); this.removeComponentsFromTag(compoundTag); + stack.clearComponents(); BlockItem.setBlockEntityData(stack, this.getType(), compoundTag); stack.applyComponents(this.collectComponents()); } @@ -289,7 +291,7 @@ public abstract class BlockEntity { this.components = dataComponentPatch.split().added(); } - protected void collectImplicitComponents(DataComponentMap.Builder components) { + protected void collectImplicitComponents(Builder components) { } @Deprecated @@ -297,7 +299,7 @@ public abstract class BlockEntity { } public final DataComponentMap collectComponents() { - DataComponentMap.Builder builder = DataComponentMap.builder(); + Builder builder = DataComponentMap.builder(); builder.addAll(this.components); this.collectImplicitComponents(builder); return builder.build(); diff --git a/net/minecraft/world/level/block/entity/BlockEntityType.java b/net/minecraft/world/level/block/entity/BlockEntityType.java index 05307962..22e40ff6 100644 --- a/net/minecraft/world/level/block/entity/BlockEntityType.java +++ b/net/minecraft/world/level/block/entity/BlockEntityType.java @@ -1,7 +1,5 @@ package net.minecraft.world.level.block.entity; -import com.google.common.collect.ImmutableSet; -import com.mojang.datafixers.types.Type; import com.mojang.logging.LogUtils; import java.util.Set; import net.minecraft.Util; @@ -22,254 +20,210 @@ import org.slf4j.Logger; public class BlockEntityType { private static final Logger LOGGER = LogUtils.getLogger(); - public static final BlockEntityType FURNACE = register("furnace", BlockEntityType.Builder.of(FurnaceBlockEntity::new, Blocks.FURNACE)); - public static final BlockEntityType CHEST = register("chest", BlockEntityType.Builder.of(ChestBlockEntity::new, Blocks.CHEST)); - public static final BlockEntityType TRAPPED_CHEST = register( - "trapped_chest", BlockEntityType.Builder.of(TrappedChestBlockEntity::new, Blocks.TRAPPED_CHEST) - ); - public static final BlockEntityType ENDER_CHEST = register( - "ender_chest", BlockEntityType.Builder.of(EnderChestBlockEntity::new, Blocks.ENDER_CHEST) - ); - public static final BlockEntityType JUKEBOX = register("jukebox", BlockEntityType.Builder.of(JukeboxBlockEntity::new, Blocks.JUKEBOX)); - public static final BlockEntityType DISPENSER = register( - "dispenser", BlockEntityType.Builder.of(DispenserBlockEntity::new, Blocks.DISPENSER) - ); - public static final BlockEntityType DROPPER = register("dropper", BlockEntityType.Builder.of(DropperBlockEntity::new, Blocks.DROPPER)); + public static final BlockEntityType FURNACE = register("furnace", FurnaceBlockEntity::new, Blocks.FURNACE); + public static final BlockEntityType CHEST = register("chest", ChestBlockEntity::new, Blocks.CHEST); + public static final BlockEntityType TRAPPED_CHEST = register("trapped_chest", TrappedChestBlockEntity::new, Blocks.TRAPPED_CHEST); + public static final BlockEntityType ENDER_CHEST = register("ender_chest", EnderChestBlockEntity::new, Blocks.ENDER_CHEST); + public static final BlockEntityType JUKEBOX = register("jukebox", JukeboxBlockEntity::new, Blocks.JUKEBOX); + public static final BlockEntityType DISPENSER = register("dispenser", DispenserBlockEntity::new, Blocks.DISPENSER); + public static final BlockEntityType DROPPER = register("dropper", DropperBlockEntity::new, Blocks.DROPPER); public static final BlockEntityType SIGN = register( "sign", - BlockEntityType.Builder.of( - SignBlockEntity::new, - Blocks.OAK_SIGN, - Blocks.SPRUCE_SIGN, - Blocks.BIRCH_SIGN, - Blocks.ACACIA_SIGN, - Blocks.CHERRY_SIGN, - Blocks.JUNGLE_SIGN, - Blocks.DARK_OAK_SIGN, - Blocks.OAK_WALL_SIGN, - Blocks.SPRUCE_WALL_SIGN, - Blocks.BIRCH_WALL_SIGN, - Blocks.ACACIA_WALL_SIGN, - Blocks.CHERRY_WALL_SIGN, - Blocks.JUNGLE_WALL_SIGN, - Blocks.DARK_OAK_WALL_SIGN, - Blocks.CRIMSON_SIGN, - Blocks.CRIMSON_WALL_SIGN, - Blocks.WARPED_SIGN, - Blocks.WARPED_WALL_SIGN, - Blocks.MANGROVE_SIGN, - Blocks.MANGROVE_WALL_SIGN, - Blocks.BAMBOO_SIGN, - Blocks.BAMBOO_WALL_SIGN - ) + SignBlockEntity::new, + Blocks.OAK_SIGN, + Blocks.SPRUCE_SIGN, + Blocks.BIRCH_SIGN, + Blocks.ACACIA_SIGN, + Blocks.CHERRY_SIGN, + Blocks.JUNGLE_SIGN, + Blocks.DARK_OAK_SIGN, + Blocks.PALE_OAK_SIGN, + Blocks.OAK_WALL_SIGN, + Blocks.SPRUCE_WALL_SIGN, + Blocks.BIRCH_WALL_SIGN, + Blocks.ACACIA_WALL_SIGN, + Blocks.CHERRY_WALL_SIGN, + Blocks.JUNGLE_WALL_SIGN, + Blocks.DARK_OAK_WALL_SIGN, + Blocks.PALE_OAK_WALL_SIGN, + Blocks.CRIMSON_SIGN, + Blocks.CRIMSON_WALL_SIGN, + Blocks.WARPED_SIGN, + Blocks.WARPED_WALL_SIGN, + Blocks.MANGROVE_SIGN, + Blocks.MANGROVE_WALL_SIGN, + Blocks.BAMBOO_SIGN, + Blocks.BAMBOO_WALL_SIGN ); public static final BlockEntityType HANGING_SIGN = register( "hanging_sign", - BlockEntityType.Builder.of( - HangingSignBlockEntity::new, - Blocks.OAK_HANGING_SIGN, - Blocks.SPRUCE_HANGING_SIGN, - Blocks.BIRCH_HANGING_SIGN, - Blocks.ACACIA_HANGING_SIGN, - Blocks.CHERRY_HANGING_SIGN, - Blocks.JUNGLE_HANGING_SIGN, - Blocks.DARK_OAK_HANGING_SIGN, - Blocks.CRIMSON_HANGING_SIGN, - Blocks.WARPED_HANGING_SIGN, - Blocks.MANGROVE_HANGING_SIGN, - Blocks.BAMBOO_HANGING_SIGN, - Blocks.OAK_WALL_HANGING_SIGN, - Blocks.SPRUCE_WALL_HANGING_SIGN, - Blocks.BIRCH_WALL_HANGING_SIGN, - Blocks.ACACIA_WALL_HANGING_SIGN, - Blocks.CHERRY_WALL_HANGING_SIGN, - Blocks.JUNGLE_WALL_HANGING_SIGN, - Blocks.DARK_OAK_WALL_HANGING_SIGN, - Blocks.CRIMSON_WALL_HANGING_SIGN, - Blocks.WARPED_WALL_HANGING_SIGN, - Blocks.MANGROVE_WALL_HANGING_SIGN, - Blocks.BAMBOO_WALL_HANGING_SIGN - ) - ); - public static final BlockEntityType MOB_SPAWNER = register( - "mob_spawner", BlockEntityType.Builder.of(SpawnerBlockEntity::new, Blocks.SPAWNER) - ); - public static final BlockEntityType PISTON = register( - "piston", BlockEntityType.Builder.of(PistonMovingBlockEntity::new, Blocks.MOVING_PISTON) - ); - public static final BlockEntityType BREWING_STAND = register( - "brewing_stand", BlockEntityType.Builder.of(BrewingStandBlockEntity::new, Blocks.BREWING_STAND) + HangingSignBlockEntity::new, + Blocks.OAK_HANGING_SIGN, + Blocks.SPRUCE_HANGING_SIGN, + Blocks.BIRCH_HANGING_SIGN, + Blocks.ACACIA_HANGING_SIGN, + Blocks.CHERRY_HANGING_SIGN, + Blocks.JUNGLE_HANGING_SIGN, + Blocks.DARK_OAK_HANGING_SIGN, + Blocks.PALE_OAK_HANGING_SIGN, + Blocks.CRIMSON_HANGING_SIGN, + Blocks.WARPED_HANGING_SIGN, + Blocks.MANGROVE_HANGING_SIGN, + Blocks.BAMBOO_HANGING_SIGN, + Blocks.OAK_WALL_HANGING_SIGN, + Blocks.SPRUCE_WALL_HANGING_SIGN, + Blocks.BIRCH_WALL_HANGING_SIGN, + Blocks.ACACIA_WALL_HANGING_SIGN, + Blocks.CHERRY_WALL_HANGING_SIGN, + Blocks.JUNGLE_WALL_HANGING_SIGN, + Blocks.DARK_OAK_WALL_HANGING_SIGN, + Blocks.PALE_OAK_WALL_HANGING_SIGN, + Blocks.CRIMSON_WALL_HANGING_SIGN, + Blocks.WARPED_WALL_HANGING_SIGN, + Blocks.MANGROVE_WALL_HANGING_SIGN, + Blocks.BAMBOO_WALL_HANGING_SIGN ); + public static final BlockEntityType MOB_SPAWNER = register("mob_spawner", SpawnerBlockEntity::new, Blocks.SPAWNER); + public static final BlockEntityType CREAKING_HEART = register("creaking_heart", CreakingHeartBlockEntity::new, Blocks.CREAKING_HEART); + public static final BlockEntityType PISTON = register("piston", PistonMovingBlockEntity::new, Blocks.MOVING_PISTON); + public static final BlockEntityType BREWING_STAND = register("brewing_stand", BrewingStandBlockEntity::new, Blocks.BREWING_STAND); public static final BlockEntityType ENCHANTING_TABLE = register( - "enchanting_table", BlockEntityType.Builder.of(EnchantingTableBlockEntity::new, Blocks.ENCHANTING_TABLE) + "enchanting_table", EnchantingTableBlockEntity::new, Blocks.ENCHANTING_TABLE ); - public static final BlockEntityType END_PORTAL = register( - "end_portal", BlockEntityType.Builder.of(TheEndPortalBlockEntity::new, Blocks.END_PORTAL) - ); - public static final BlockEntityType BEACON = register("beacon", BlockEntityType.Builder.of(BeaconBlockEntity::new, Blocks.BEACON)); + public static final BlockEntityType END_PORTAL = register("end_portal", TheEndPortalBlockEntity::new, Blocks.END_PORTAL); + public static final BlockEntityType BEACON = register("beacon", BeaconBlockEntity::new, Blocks.BEACON); public static final BlockEntityType SKULL = register( "skull", - BlockEntityType.Builder.of( - SkullBlockEntity::new, - Blocks.SKELETON_SKULL, - Blocks.SKELETON_WALL_SKULL, - Blocks.CREEPER_HEAD, - Blocks.CREEPER_WALL_HEAD, - Blocks.DRAGON_HEAD, - Blocks.DRAGON_WALL_HEAD, - Blocks.ZOMBIE_HEAD, - Blocks.ZOMBIE_WALL_HEAD, - Blocks.WITHER_SKELETON_SKULL, - Blocks.WITHER_SKELETON_WALL_SKULL, - Blocks.PLAYER_HEAD, - Blocks.PLAYER_WALL_HEAD, - Blocks.PIGLIN_HEAD, - Blocks.PIGLIN_WALL_HEAD - ) + SkullBlockEntity::new, + Blocks.SKELETON_SKULL, + Blocks.SKELETON_WALL_SKULL, + Blocks.CREEPER_HEAD, + Blocks.CREEPER_WALL_HEAD, + Blocks.DRAGON_HEAD, + Blocks.DRAGON_WALL_HEAD, + Blocks.ZOMBIE_HEAD, + Blocks.ZOMBIE_WALL_HEAD, + Blocks.WITHER_SKELETON_SKULL, + Blocks.WITHER_SKELETON_WALL_SKULL, + Blocks.PLAYER_HEAD, + Blocks.PLAYER_WALL_HEAD, + Blocks.PIGLIN_HEAD, + Blocks.PIGLIN_WALL_HEAD ); public static final BlockEntityType DAYLIGHT_DETECTOR = register( - "daylight_detector", BlockEntityType.Builder.of(DaylightDetectorBlockEntity::new, Blocks.DAYLIGHT_DETECTOR) - ); - public static final BlockEntityType HOPPER = register("hopper", BlockEntityType.Builder.of(HopperBlockEntity::new, Blocks.HOPPER)); - public static final BlockEntityType COMPARATOR = register( - "comparator", BlockEntityType.Builder.of(ComparatorBlockEntity::new, Blocks.COMPARATOR) + "daylight_detector", DaylightDetectorBlockEntity::new, Blocks.DAYLIGHT_DETECTOR ); + public static final BlockEntityType HOPPER = register("hopper", HopperBlockEntity::new, Blocks.HOPPER); + public static final BlockEntityType COMPARATOR = register("comparator", ComparatorBlockEntity::new, Blocks.COMPARATOR); public static final BlockEntityType BANNER = register( "banner", - BlockEntityType.Builder.of( - BannerBlockEntity::new, - Blocks.WHITE_BANNER, - Blocks.ORANGE_BANNER, - Blocks.MAGENTA_BANNER, - Blocks.LIGHT_BLUE_BANNER, - Blocks.YELLOW_BANNER, - Blocks.LIME_BANNER, - Blocks.PINK_BANNER, - Blocks.GRAY_BANNER, - Blocks.LIGHT_GRAY_BANNER, - Blocks.CYAN_BANNER, - Blocks.PURPLE_BANNER, - Blocks.BLUE_BANNER, - Blocks.BROWN_BANNER, - Blocks.GREEN_BANNER, - Blocks.RED_BANNER, - Blocks.BLACK_BANNER, - Blocks.WHITE_WALL_BANNER, - Blocks.ORANGE_WALL_BANNER, - Blocks.MAGENTA_WALL_BANNER, - Blocks.LIGHT_BLUE_WALL_BANNER, - Blocks.YELLOW_WALL_BANNER, - Blocks.LIME_WALL_BANNER, - Blocks.PINK_WALL_BANNER, - Blocks.GRAY_WALL_BANNER, - Blocks.LIGHT_GRAY_WALL_BANNER, - Blocks.CYAN_WALL_BANNER, - Blocks.PURPLE_WALL_BANNER, - Blocks.BLUE_WALL_BANNER, - Blocks.BROWN_WALL_BANNER, - Blocks.GREEN_WALL_BANNER, - Blocks.RED_WALL_BANNER, - Blocks.BLACK_WALL_BANNER - ) - ); - public static final BlockEntityType STRUCTURE_BLOCK = register( - "structure_block", BlockEntityType.Builder.of(StructureBlockEntity::new, Blocks.STRUCTURE_BLOCK) - ); - public static final BlockEntityType END_GATEWAY = register( - "end_gateway", BlockEntityType.Builder.of(TheEndGatewayBlockEntity::new, Blocks.END_GATEWAY) + BannerBlockEntity::new, + Blocks.WHITE_BANNER, + Blocks.ORANGE_BANNER, + Blocks.MAGENTA_BANNER, + Blocks.LIGHT_BLUE_BANNER, + Blocks.YELLOW_BANNER, + Blocks.LIME_BANNER, + Blocks.PINK_BANNER, + Blocks.GRAY_BANNER, + Blocks.LIGHT_GRAY_BANNER, + Blocks.CYAN_BANNER, + Blocks.PURPLE_BANNER, + Blocks.BLUE_BANNER, + Blocks.BROWN_BANNER, + Blocks.GREEN_BANNER, + Blocks.RED_BANNER, + Blocks.BLACK_BANNER, + Blocks.WHITE_WALL_BANNER, + Blocks.ORANGE_WALL_BANNER, + Blocks.MAGENTA_WALL_BANNER, + Blocks.LIGHT_BLUE_WALL_BANNER, + Blocks.YELLOW_WALL_BANNER, + Blocks.LIME_WALL_BANNER, + Blocks.PINK_WALL_BANNER, + Blocks.GRAY_WALL_BANNER, + Blocks.LIGHT_GRAY_WALL_BANNER, + Blocks.CYAN_WALL_BANNER, + Blocks.PURPLE_WALL_BANNER, + Blocks.BLUE_WALL_BANNER, + Blocks.BROWN_WALL_BANNER, + Blocks.GREEN_WALL_BANNER, + Blocks.RED_WALL_BANNER, + Blocks.BLACK_WALL_BANNER ); + public static final BlockEntityType STRUCTURE_BLOCK = register("structure_block", StructureBlockEntity::new, Blocks.STRUCTURE_BLOCK); + public static final BlockEntityType END_GATEWAY = register("end_gateway", TheEndGatewayBlockEntity::new, Blocks.END_GATEWAY); public static final BlockEntityType COMMAND_BLOCK = register( - "command_block", BlockEntityType.Builder.of(CommandBlockEntity::new, Blocks.COMMAND_BLOCK, Blocks.CHAIN_COMMAND_BLOCK, Blocks.REPEATING_COMMAND_BLOCK) + "command_block", CommandBlockEntity::new, Blocks.COMMAND_BLOCK, Blocks.CHAIN_COMMAND_BLOCK, Blocks.REPEATING_COMMAND_BLOCK ); public static final BlockEntityType SHULKER_BOX = register( "shulker_box", - BlockEntityType.Builder.of( - ShulkerBoxBlockEntity::new, - Blocks.SHULKER_BOX, - Blocks.BLACK_SHULKER_BOX, - Blocks.BLUE_SHULKER_BOX, - Blocks.BROWN_SHULKER_BOX, - Blocks.CYAN_SHULKER_BOX, - Blocks.GRAY_SHULKER_BOX, - Blocks.GREEN_SHULKER_BOX, - Blocks.LIGHT_BLUE_SHULKER_BOX, - Blocks.LIGHT_GRAY_SHULKER_BOX, - Blocks.LIME_SHULKER_BOX, - Blocks.MAGENTA_SHULKER_BOX, - Blocks.ORANGE_SHULKER_BOX, - Blocks.PINK_SHULKER_BOX, - Blocks.PURPLE_SHULKER_BOX, - Blocks.RED_SHULKER_BOX, - Blocks.WHITE_SHULKER_BOX, - Blocks.YELLOW_SHULKER_BOX - ) + ShulkerBoxBlockEntity::new, + Blocks.SHULKER_BOX, + Blocks.BLACK_SHULKER_BOX, + Blocks.BLUE_SHULKER_BOX, + Blocks.BROWN_SHULKER_BOX, + Blocks.CYAN_SHULKER_BOX, + Blocks.GRAY_SHULKER_BOX, + Blocks.GREEN_SHULKER_BOX, + Blocks.LIGHT_BLUE_SHULKER_BOX, + Blocks.LIGHT_GRAY_SHULKER_BOX, + Blocks.LIME_SHULKER_BOX, + Blocks.MAGENTA_SHULKER_BOX, + Blocks.ORANGE_SHULKER_BOX, + Blocks.PINK_SHULKER_BOX, + Blocks.PURPLE_SHULKER_BOX, + Blocks.RED_SHULKER_BOX, + Blocks.WHITE_SHULKER_BOX, + Blocks.YELLOW_SHULKER_BOX ); public static final BlockEntityType BED = register( "bed", - BlockEntityType.Builder.of( - BedBlockEntity::new, - Blocks.RED_BED, - Blocks.BLACK_BED, - Blocks.BLUE_BED, - Blocks.BROWN_BED, - Blocks.CYAN_BED, - Blocks.GRAY_BED, - Blocks.GREEN_BED, - Blocks.LIGHT_BLUE_BED, - Blocks.LIGHT_GRAY_BED, - Blocks.LIME_BED, - Blocks.MAGENTA_BED, - Blocks.ORANGE_BED, - Blocks.PINK_BED, - Blocks.PURPLE_BED, - Blocks.WHITE_BED, - Blocks.YELLOW_BED - ) - ); - public static final BlockEntityType CONDUIT = register("conduit", BlockEntityType.Builder.of(ConduitBlockEntity::new, Blocks.CONDUIT)); - public static final BlockEntityType BARREL = register("barrel", BlockEntityType.Builder.of(BarrelBlockEntity::new, Blocks.BARREL)); - public static final BlockEntityType SMOKER = register("smoker", BlockEntityType.Builder.of(SmokerBlockEntity::new, Blocks.SMOKER)); - public static final BlockEntityType BLAST_FURNACE = register( - "blast_furnace", BlockEntityType.Builder.of(BlastFurnaceBlockEntity::new, Blocks.BLAST_FURNACE) - ); - public static final BlockEntityType LECTERN = register("lectern", BlockEntityType.Builder.of(LecternBlockEntity::new, Blocks.LECTERN)); - public static final BlockEntityType BELL = register("bell", BlockEntityType.Builder.of(BellBlockEntity::new, Blocks.BELL)); - public static final BlockEntityType JIGSAW = register("jigsaw", BlockEntityType.Builder.of(JigsawBlockEntity::new, Blocks.JIGSAW)); - public static final BlockEntityType CAMPFIRE = register( - "campfire", BlockEntityType.Builder.of(CampfireBlockEntity::new, Blocks.CAMPFIRE, Blocks.SOUL_CAMPFIRE) - ); - public static final BlockEntityType BEEHIVE = register( - "beehive", BlockEntityType.Builder.of(BeehiveBlockEntity::new, Blocks.BEE_NEST, Blocks.BEEHIVE) - ); - public static final BlockEntityType SCULK_SENSOR = register( - "sculk_sensor", BlockEntityType.Builder.of(SculkSensorBlockEntity::new, Blocks.SCULK_SENSOR) + BedBlockEntity::new, + Blocks.RED_BED, + Blocks.BLACK_BED, + Blocks.BLUE_BED, + Blocks.BROWN_BED, + Blocks.CYAN_BED, + Blocks.GRAY_BED, + Blocks.GREEN_BED, + Blocks.LIGHT_BLUE_BED, + Blocks.LIGHT_GRAY_BED, + Blocks.LIME_BED, + Blocks.MAGENTA_BED, + Blocks.ORANGE_BED, + Blocks.PINK_BED, + Blocks.PURPLE_BED, + Blocks.WHITE_BED, + Blocks.YELLOW_BED ); + public static final BlockEntityType CONDUIT = register("conduit", ConduitBlockEntity::new, Blocks.CONDUIT); + public static final BlockEntityType BARREL = register("barrel", BarrelBlockEntity::new, Blocks.BARREL); + public static final BlockEntityType SMOKER = register("smoker", SmokerBlockEntity::new, Blocks.SMOKER); + public static final BlockEntityType BLAST_FURNACE = register("blast_furnace", BlastFurnaceBlockEntity::new, Blocks.BLAST_FURNACE); + public static final BlockEntityType LECTERN = register("lectern", LecternBlockEntity::new, Blocks.LECTERN); + public static final BlockEntityType BELL = register("bell", BellBlockEntity::new, Blocks.BELL); + public static final BlockEntityType JIGSAW = register("jigsaw", JigsawBlockEntity::new, Blocks.JIGSAW); + public static final BlockEntityType CAMPFIRE = register("campfire", CampfireBlockEntity::new, Blocks.CAMPFIRE, Blocks.SOUL_CAMPFIRE); + public static final BlockEntityType BEEHIVE = register("beehive", BeehiveBlockEntity::new, Blocks.BEE_NEST, Blocks.BEEHIVE); + public static final BlockEntityType SCULK_SENSOR = register("sculk_sensor", SculkSensorBlockEntity::new, Blocks.SCULK_SENSOR); public static final BlockEntityType CALIBRATED_SCULK_SENSOR = register( - "calibrated_sculk_sensor", BlockEntityType.Builder.of(CalibratedSculkSensorBlockEntity::new, Blocks.CALIBRATED_SCULK_SENSOR) - ); - public static final BlockEntityType SCULK_CATALYST = register( - "sculk_catalyst", BlockEntityType.Builder.of(SculkCatalystBlockEntity::new, Blocks.SCULK_CATALYST) - ); - public static final BlockEntityType SCULK_SHRIEKER = register( - "sculk_shrieker", BlockEntityType.Builder.of(SculkShriekerBlockEntity::new, Blocks.SCULK_SHRIEKER) + "calibrated_sculk_sensor", CalibratedSculkSensorBlockEntity::new, Blocks.CALIBRATED_SCULK_SENSOR ); + public static final BlockEntityType SCULK_CATALYST = register("sculk_catalyst", SculkCatalystBlockEntity::new, Blocks.SCULK_CATALYST); + public static final BlockEntityType SCULK_SHRIEKER = register("sculk_shrieker", SculkShriekerBlockEntity::new, Blocks.SCULK_SHRIEKER); public static final BlockEntityType CHISELED_BOOKSHELF = register( - "chiseled_bookshelf", BlockEntityType.Builder.of(ChiseledBookShelfBlockEntity::new, Blocks.CHISELED_BOOKSHELF) + "chiseled_bookshelf", ChiseledBookShelfBlockEntity::new, Blocks.CHISELED_BOOKSHELF ); public static final BlockEntityType BRUSHABLE_BLOCK = register( - "brushable_block", BlockEntityType.Builder.of(BrushableBlockEntity::new, Blocks.SUSPICIOUS_SAND, Blocks.SUSPICIOUS_GRAVEL) + "brushable_block", BrushableBlockEntity::new, Blocks.SUSPICIOUS_SAND, Blocks.SUSPICIOUS_GRAVEL ); - public static final BlockEntityType DECORATED_POT = register( - "decorated_pot", BlockEntityType.Builder.of(DecoratedPotBlockEntity::new, Blocks.DECORATED_POT) - ); - public static final BlockEntityType CRAFTER = register("crafter", BlockEntityType.Builder.of(CrafterBlockEntity::new, Blocks.CRAFTER)); - public static final BlockEntityType TRIAL_SPAWNER = register( - "trial_spawner", BlockEntityType.Builder.of(TrialSpawnerBlockEntity::new, Blocks.TRIAL_SPAWNER) - ); - public static final BlockEntityType VAULT = register("vault", BlockEntityType.Builder.of(VaultBlockEntity::new, Blocks.VAULT)); + public static final BlockEntityType DECORATED_POT = register("decorated_pot", DecoratedPotBlockEntity::new, Blocks.DECORATED_POT); + public static final BlockEntityType CRAFTER = register("crafter", CrafterBlockEntity::new, Blocks.CRAFTER); + public static final BlockEntityType TRIAL_SPAWNER = register("trial_spawner", TrialSpawnerBlockEntity::new, Blocks.TRIAL_SPAWNER); + public static final BlockEntityType VAULT = register("vault", VaultBlockEntity::new, Blocks.VAULT); private final BlockEntityType.BlockEntitySupplier factory; private final Set validBlocks; - private final Type dataType; private final Holder.Reference> builtInRegistryHolder = BuiltInRegistries.BLOCK_ENTITY_TYPE.createIntrusiveHolder(this); @Nullable @@ -277,19 +231,20 @@ public class BlockEntityType { return BuiltInRegistries.BLOCK_ENTITY_TYPE.getKey(blockEntityType); } - private static BlockEntityType register(String key, BlockEntityType.Builder builder) { - if (builder.validBlocks.isEmpty()) { - LOGGER.warn("Block entity type {} requires at least one valid block to be defined!", key); + private static BlockEntityType register( + String string, BlockEntityType.BlockEntitySupplier blockEntitySupplier, Block... blocks + ) { + if (blocks.length == 0) { + LOGGER.warn("Block entity type {} requires at least one valid block to be defined!", string); } - Type type = Util.fetchChoiceType(References.BLOCK_ENTITY, key); - return Registry.register(BuiltInRegistries.BLOCK_ENTITY_TYPE, key, builder.build(type)); + Util.fetchChoiceType(References.BLOCK_ENTITY, string); + return Registry.register(BuiltInRegistries.BLOCK_ENTITY_TYPE, string, new BlockEntityType<>(blockEntitySupplier, Set.of(blocks))); } - public BlockEntityType(BlockEntityType.BlockEntitySupplier factory, Set validBlocks, Type dataType) { - this.factory = factory; - this.validBlocks = validBlocks; - this.dataType = dataType; + private BlockEntityType(BlockEntityType.BlockEntitySupplier blockEntitySupplier, Set set) { + this.factory = blockEntitySupplier; + this.validBlocks = set; } @Nullable @@ -301,7 +256,7 @@ public class BlockEntityType { return this.validBlocks.contains(state.getBlock()); } - @Nullable + @Deprecated public Holder.Reference> builtInRegistryHolder() { return this.builtInRegistryHolder; } @@ -316,22 +271,4 @@ public class BlockEntityType { interface BlockEntitySupplier { T create(BlockPos blockPos, BlockState blockState); } - - public static final class Builder { - private final BlockEntityType.BlockEntitySupplier factory; - final Set validBlocks; - - private Builder(BlockEntityType.BlockEntitySupplier factory, Set validBlocks) { - this.factory = factory; - this.validBlocks = validBlocks; - } - - public static BlockEntityType.Builder of(BlockEntityType.BlockEntitySupplier factory, Block... validBlocks) { - return new BlockEntityType.Builder<>(factory, ImmutableSet.copyOf(validBlocks)); - } - - public BlockEntityType build(Type dataType) { - return new BlockEntityType<>(this.factory, this.validBlocks, dataType); - } - } } diff --git a/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java b/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java index 4f4d6883..0782e036 100644 --- a/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java +++ b/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java @@ -7,6 +7,7 @@ import net.minecraft.core.HolderLookup; import net.minecraft.core.NonNullList; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.chat.Component; +import net.minecraft.tags.ItemTags; import net.minecraft.world.ContainerHelper; import net.minecraft.world.Containers; import net.minecraft.world.WorldlyContainer; @@ -94,7 +95,7 @@ public class BrewingStandBlockEntity extends BaseContainerBlockEntity implements public static void serverTick(Level level, BlockPos pos, BlockState state, BrewingStandBlockEntity blockEntity) { ItemStack itemStack = blockEntity.items.get(4); - if (blockEntity.fuel <= 0 && itemStack.is(Items.BLAZE_POWDER)) { + if (blockEntity.fuel <= 0 && itemStack.is(ItemTags.BREWING_FUEL)) { blockEntity.fuel = 20; itemStack.shrink(1); setChanged(level, pos, state); @@ -178,8 +179,8 @@ public class BrewingStandBlockEntity extends BaseContainerBlockEntity implements } itemStack.shrink(1); - if (itemStack.getItem().hasCraftingRemainingItem()) { - ItemStack itemStack2 = new ItemStack(itemStack.getItem().getCraftingRemainingItem()); + ItemStack itemStack2 = itemStack.getItem().getCraftingRemainder(); + if (!itemStack2.isEmpty()) { if (itemStack.isEmpty()) { itemStack = itemStack2; } else { @@ -219,7 +220,7 @@ public class BrewingStandBlockEntity extends BaseContainerBlockEntity implements return potionBrewing.isIngredient(stack); } else { return slot == 4 - ? stack.is(Items.BLAZE_POWDER) + ? stack.is(ItemTags.BREWING_FUEL) : (stack.is(Items.POTION) || stack.is(Items.SPLASH_POTION) || stack.is(Items.LINGERING_POTION) || stack.is(Items.GLASS_BOTTLE)) && this.getItem(slot).isEmpty(); } diff --git a/net/minecraft/world/level/block/entity/BrushableBlockEntity.java b/net/minecraft/world/level/block/entity/BrushableBlockEntity.java index 0960a09b..edfbc856 100644 --- a/net/minecraft/world/level/block/entity/BrushableBlockEntity.java +++ b/net/minecraft/world/level/block/entity/BrushableBlockEntity.java @@ -54,55 +54,56 @@ public class BrushableBlockEntity extends BlockEntity { super(BlockEntityType.BRUSHABLE_BLOCK, pos, blockState); } - public boolean brush(long startTick, Player player, Direction hitDirection) { + public boolean brush(long l, ServerLevel serverLevel, Player player, Direction direction, ItemStack itemStack) { if (this.hitDirection == null) { - this.hitDirection = hitDirection; + this.hitDirection = direction; } - this.brushCountResetsAtTick = startTick + 40L; - if (startTick >= this.coolDownEndsAtTick && this.level instanceof ServerLevel) { - this.coolDownEndsAtTick = startTick + 10L; - this.unpackLootTable(player); + this.brushCountResetsAtTick = l + 40L; + if (l < this.coolDownEndsAtTick) { + return false; + } else { + this.coolDownEndsAtTick = l + 10L; + this.unpackLootTable(serverLevel, player, itemStack); int i = this.getCompletionState(); if (++this.brushCount >= 10) { - this.brushingCompleted(player); + this.brushingCompleted(serverLevel, player, itemStack); return true; } else { - this.level.scheduleTick(this.getBlockPos(), this.getBlockState().getBlock(), 2); + serverLevel.scheduleTick(this.getBlockPos(), this.getBlockState().getBlock(), 2); int j = this.getCompletionState(); if (i != j) { BlockState blockState = this.getBlockState(); BlockState blockState2 = blockState.setValue(BlockStateProperties.DUSTED, j); - this.level.setBlock(this.getBlockPos(), blockState2, 3); + serverLevel.setBlock(this.getBlockPos(), blockState2, 3); } return false; } - } else { - return false; } } - public void unpackLootTable(Player player) { - if (this.lootTable != null && this.level != null && !this.level.isClientSide() && this.level.getServer() != null) { - LootTable lootTable = this.level.getServer().reloadableRegistries().getLootTable(this.lootTable); + private void unpackLootTable(ServerLevel serverLevel, Player player, ItemStack itemStack) { + if (this.lootTable != null) { + LootTable lootTable = serverLevel.getServer().reloadableRegistries().getLootTable(this.lootTable); if (player instanceof ServerPlayer serverPlayer) { CriteriaTriggers.GENERATE_LOOT.trigger(serverPlayer, this.lootTable); } - LootParams lootParams = new LootParams.Builder((ServerLevel)this.level) + LootParams lootParams = new LootParams.Builder(serverLevel) .withParameter(LootContextParams.ORIGIN, Vec3.atCenterOf(this.worldPosition)) .withLuck(player.getLuck()) .withParameter(LootContextParams.THIS_ENTITY, player) - .create(LootContextParamSets.CHEST); + .withParameter(LootContextParams.TOOL, itemStack) + .create(LootContextParamSets.ARCHAEOLOGY); ObjectArrayList objectArrayList = lootTable.getRandomItems(lootParams, this.lootTableSeed); this.item = switch (objectArrayList.size()) { case 0 -> ItemStack.EMPTY; - case 1 -> (ItemStack)objectArrayList.get(0); + case 1 -> (ItemStack)objectArrayList.getFirst(); default -> { LOGGER.warn("Expected max 1 loot from loot table {}, but got {}", this.lootTable.location(), objectArrayList.size()); - yield objectArrayList.get(0); + yield (ItemStack)objectArrayList.getFirst(); } }; this.lootTable = null; @@ -110,63 +111,57 @@ public class BrushableBlockEntity extends BlockEntity { } } - private void brushingCompleted(Player player) { - if (this.level != null && this.level.getServer() != null) { - this.dropContent(player); - BlockState blockState = this.getBlockState(); - this.level.levelEvent(3008, this.getBlockPos(), Block.getId(blockState)); - Block block2; - if (this.getBlockState().getBlock() instanceof BrushableBlock brushableBlock) { - block2 = brushableBlock.getTurnsInto(); - } else { - block2 = Blocks.AIR; - } + private void brushingCompleted(ServerLevel serverLevel, Player player, ItemStack itemStack) { + this.dropContent(serverLevel, player, itemStack); + BlockState blockState = this.getBlockState(); + serverLevel.levelEvent(3008, this.getBlockPos(), Block.getId(blockState)); + Block block2; + if (this.getBlockState().getBlock() instanceof BrushableBlock brushableBlock) { + block2 = brushableBlock.getTurnsInto(); + } else { + block2 = Blocks.AIR; + } - this.level.setBlock(this.worldPosition, block2.defaultBlockState(), 3); + serverLevel.setBlock(this.worldPosition, block2.defaultBlockState(), 3); + } + + private void dropContent(ServerLevel serverLevel, Player player, ItemStack itemStack) { + this.unpackLootTable(serverLevel, player, itemStack); + if (!this.item.isEmpty()) { + double d = EntityType.ITEM.getWidth(); + double e = 1.0 - d; + double f = d / 2.0; + Direction direction = (Direction)Objects.requireNonNullElse(this.hitDirection, Direction.UP); + BlockPos blockPos = this.worldPosition.relative(direction, 1); + double g = blockPos.getX() + 0.5 * e + f; + double h = blockPos.getY() + 0.5 + EntityType.ITEM.getHeight() / 2.0F; + double i = blockPos.getZ() + 0.5 * e + f; + ItemEntity itemEntity = new ItemEntity(serverLevel, g, h, i, this.item.split(serverLevel.random.nextInt(21) + 10)); + itemEntity.setDeltaMovement(Vec3.ZERO); + serverLevel.addFreshEntity(itemEntity); + this.item = ItemStack.EMPTY; } } - private void dropContent(Player player) { - if (this.level != null && this.level.getServer() != null) { - this.unpackLootTable(player); - if (!this.item.isEmpty()) { - double d = EntityType.ITEM.getWidth(); - double e = 1.0 - d; - double f = d / 2.0; - Direction direction = (Direction)Objects.requireNonNullElse(this.hitDirection, Direction.UP); - BlockPos blockPos = this.worldPosition.relative(direction, 1); - double g = blockPos.getX() + 0.5 * e + f; - double h = blockPos.getY() + 0.5 + EntityType.ITEM.getHeight() / 2.0F; - double i = blockPos.getZ() + 0.5 * e + f; - ItemEntity itemEntity = new ItemEntity(this.level, g, h, i, this.item.split(this.level.random.nextInt(21) + 10)); - itemEntity.setDeltaMovement(Vec3.ZERO); - this.level.addFreshEntity(itemEntity); - this.item = ItemStack.EMPTY; + public void checkReset(ServerLevel serverLevel) { + if (this.brushCount != 0 && serverLevel.getGameTime() >= this.brushCountResetsAtTick) { + int i = this.getCompletionState(); + this.brushCount = Math.max(0, this.brushCount - 2); + int j = this.getCompletionState(); + if (i != j) { + serverLevel.setBlock(this.getBlockPos(), this.getBlockState().setValue(BlockStateProperties.DUSTED, j), 3); } + + int k = 4; + this.brushCountResetsAtTick = serverLevel.getGameTime() + 4L; } - } - public void checkReset() { - if (this.level != null) { - if (this.brushCount != 0 && this.level.getGameTime() >= this.brushCountResetsAtTick) { - int i = this.getCompletionState(); - this.brushCount = Math.max(0, this.brushCount - 2); - int j = this.getCompletionState(); - if (i != j) { - this.level.setBlock(this.getBlockPos(), this.getBlockState().setValue(BlockStateProperties.DUSTED, j), 3); - } - - int k = 4; - this.brushCountResetsAtTick = this.level.getGameTime() + 4L; - } - - if (this.brushCount == 0) { - this.hitDirection = null; - this.brushCountResetsAtTick = 0L; - this.coolDownEndsAtTick = 0L; - } else { - this.level.scheduleTick(this.getBlockPos(), this.getBlockState().getBlock(), 2); - } + if (this.brushCount == 0) { + this.hitDirection = null; + this.brushCountResetsAtTick = 0L; + this.coolDownEndsAtTick = 0L; + } else { + serverLevel.scheduleTick(this.getBlockPos(), this.getBlockState().getBlock(), 2); } } diff --git a/net/minecraft/world/level/block/entity/CalibratedSculkSensorBlockEntity.java b/net/minecraft/world/level/block/entity/CalibratedSculkSensorBlockEntity.java index f6856b5d..ca366355 100644 --- a/net/minecraft/world/level/block/entity/CalibratedSculkSensorBlockEntity.java +++ b/net/minecraft/world/level/block/entity/CalibratedSculkSensorBlockEntity.java @@ -8,7 +8,9 @@ import net.minecraft.world.level.Level; import net.minecraft.world.level.block.CalibratedSculkSensorBlock; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.level.gameevent.GameEvent.Context; import net.minecraft.world.level.gameevent.vibrations.VibrationSystem; +import net.minecraft.world.level.gameevent.vibrations.VibrationSystem.User; import org.jetbrains.annotations.Nullable; public class CalibratedSculkSensorBlockEntity extends SculkSensorBlockEntity { @@ -17,7 +19,7 @@ public class CalibratedSculkSensorBlockEntity extends SculkSensorBlockEntity { } @Override - public VibrationSystem.User createVibrationUser() { + public User createVibrationUser() { return new CalibratedSculkSensorBlockEntity.VibrationUser(this.getBlockPos()); } @@ -32,7 +34,7 @@ public class CalibratedSculkSensorBlockEntity extends SculkSensorBlockEntity { } @Override - public boolean canReceiveVibration(ServerLevel level, BlockPos pos, Holder gameEvent, @Nullable GameEvent.Context context) { + public boolean canReceiveVibration(ServerLevel level, BlockPos pos, Holder gameEvent, @Nullable Context context) { int i = this.getBackSignal(level, this.blockPos, CalibratedSculkSensorBlockEntity.this.getBlockState()); return i != 0 && VibrationSystem.getGameEventFrequency(gameEvent) != i ? false : super.canReceiveVibration(level, pos, gameEvent, context); } diff --git a/net/minecraft/world/level/block/entity/CampfireBlockEntity.java b/net/minecraft/world/level/block/entity/CampfireBlockEntity.java index dbd8c732..ac4a91bc 100644 --- a/net/minecraft/world/level/block/entity/CampfireBlockEntity.java +++ b/net/minecraft/world/level/block/entity/CampfireBlockEntity.java @@ -5,11 +5,12 @@ import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.HolderLookup; import net.minecraft.core.NonNullList; -import net.minecraft.core.component.DataComponentMap; import net.minecraft.core.component.DataComponents; +import net.minecraft.core.component.DataComponentMap.Builder; import net.minecraft.core.particles.ParticleTypes; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket; +import net.minecraft.server.level.ServerLevel; import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; import net.minecraft.world.Clearable; @@ -27,6 +28,7 @@ import net.minecraft.world.level.Level; import net.minecraft.world.level.block.CampfireBlock; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.level.gameevent.GameEvent.Context; import org.jetbrains.annotations.Nullable; public class CampfireBlockEntity extends BlockEntity implements Clearable { @@ -35,38 +37,42 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable { private final NonNullList items = NonNullList.withSize(4, ItemStack.EMPTY); private final int[] cookingProgress = new int[4]; private final int[] cookingTime = new int[4]; - private final RecipeManager.CachedCheck quickCheck = RecipeManager.createCheck(RecipeType.CAMPFIRE_COOKING); public CampfireBlockEntity(BlockPos pos, BlockState blockState) { super(BlockEntityType.CAMPFIRE, pos, blockState); } - public static void cookTick(Level level, BlockPos pos, BlockState state, CampfireBlockEntity blockEntity) { + public static void cookTick( + ServerLevel serverLevel, + BlockPos blockPos, + BlockState blockState, + CampfireBlockEntity campfireBlockEntity, + RecipeManager.CachedCheck cachedCheck + ) { boolean bl = false; - for (int i = 0; i < blockEntity.items.size(); i++) { - ItemStack itemStack = blockEntity.items.get(i); + for (int i = 0; i < campfireBlockEntity.items.size(); i++) { + ItemStack itemStack = campfireBlockEntity.items.get(i); if (!itemStack.isEmpty()) { bl = true; - blockEntity.cookingProgress[i]++; - if (blockEntity.cookingProgress[i] >= blockEntity.cookingTime[i]) { + campfireBlockEntity.cookingProgress[i]++; + if (campfireBlockEntity.cookingProgress[i] >= campfireBlockEntity.cookingTime[i]) { SingleRecipeInput singleRecipeInput = new SingleRecipeInput(itemStack); - ItemStack itemStack2 = (ItemStack)blockEntity.quickCheck - .getRecipeFor(singleRecipeInput, level) - .map(recipeHolder -> ((CampfireCookingRecipe)recipeHolder.value()).assemble(singleRecipeInput, level.registryAccess())) + ItemStack itemStack2 = (ItemStack)cachedCheck.getRecipeFor(singleRecipeInput, serverLevel) + .map(recipeHolder -> ((CampfireCookingRecipe)recipeHolder.value()).assemble(singleRecipeInput, serverLevel.registryAccess())) .orElse(itemStack); - if (itemStack2.isItemEnabled(level.enabledFeatures())) { - Containers.dropItemStack(level, pos.getX(), pos.getY(), pos.getZ(), itemStack2); - blockEntity.items.set(i, ItemStack.EMPTY); - level.sendBlockUpdated(pos, state, state, 3); - level.gameEvent(GameEvent.BLOCK_CHANGE, pos, GameEvent.Context.of(state)); + if (itemStack2.isItemEnabled(serverLevel.enabledFeatures())) { + Containers.dropItemStack(serverLevel, blockPos.getX(), blockPos.getY(), blockPos.getZ(), itemStack2); + campfireBlockEntity.items.set(i, ItemStack.EMPTY); + serverLevel.sendBlockUpdated(blockPos, blockState, blockState, 3); + serverLevel.gameEvent(GameEvent.BLOCK_CHANGE, blockPos, Context.of(blockState)); } } } } if (bl) { - setChanged(level, pos, state); + setChanged(serverLevel, blockPos, blockState); } } @@ -152,18 +158,20 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable { return compoundTag; } - public Optional> getCookableRecipe(ItemStack stack) { - return this.items.stream().noneMatch(ItemStack::isEmpty) ? Optional.empty() : this.quickCheck.getRecipeFor(new SingleRecipeInput(stack), this.level); - } - - public boolean placeFood(@Nullable LivingEntity entity, ItemStack food, int cookTime) { + public boolean placeFood(ServerLevel serverLevel, @Nullable LivingEntity livingEntity, ItemStack itemStack) { for (int i = 0; i < this.items.size(); i++) { - ItemStack itemStack = this.items.get(i); - if (itemStack.isEmpty()) { - this.cookingTime[i] = cookTime; + ItemStack itemStack2 = this.items.get(i); + if (itemStack2.isEmpty()) { + Optional> optional = serverLevel.recipeAccess() + .getRecipeFor(RecipeType.CAMPFIRE_COOKING, new SingleRecipeInput(itemStack), serverLevel); + if (optional.isEmpty()) { + return false; + } + + this.cookingTime[i] = ((CampfireCookingRecipe)((RecipeHolder)optional.get()).value()).cookingTime(); this.cookingProgress[i] = 0; - this.items.set(i, food.consumeAndReturn(1, entity)); - this.level.gameEvent(GameEvent.BLOCK_CHANGE, this.getBlockPos(), GameEvent.Context.of(entity, this.getBlockState())); + this.items.set(i, itemStack.consumeAndReturn(1, livingEntity)); + serverLevel.gameEvent(GameEvent.BLOCK_CHANGE, this.getBlockPos(), Context.of(livingEntity, this.getBlockState())); this.markUpdated(); return true; } @@ -195,7 +203,7 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable { } @Override - protected void collectImplicitComponents(DataComponentMap.Builder components) { + protected void collectImplicitComponents(Builder components) { super.collectImplicitComponents(components); components.set(DataComponents.CONTAINER, ItemContainerContents.fromItems(this.getItems())); } diff --git a/net/minecraft/world/level/block/entity/ChiseledBookShelfBlockEntity.java b/net/minecraft/world/level/block/entity/ChiseledBookShelfBlockEntity.java index 659f232e..c69373ed 100644 --- a/net/minecraft/world/level/block/entity/ChiseledBookShelfBlockEntity.java +++ b/net/minecraft/world/level/block/entity/ChiseledBookShelfBlockEntity.java @@ -6,8 +6,8 @@ import java.util.function.Predicate; import net.minecraft.core.BlockPos; import net.minecraft.core.HolderLookup; import net.minecraft.core.NonNullList; -import net.minecraft.core.component.DataComponentMap; import net.minecraft.core.component.DataComponents; +import net.minecraft.core.component.DataComponentMap.Builder; import net.minecraft.nbt.CompoundTag; import net.minecraft.tags.ItemTags; import net.minecraft.world.Container; @@ -20,6 +20,7 @@ import net.minecraft.world.level.block.ChiseledBookShelfBlock; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.properties.BooleanProperty; import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.level.gameevent.GameEvent.Context; import org.slf4j.Logger; public class ChiseledBookShelfBlockEntity extends BlockEntity implements Container { @@ -44,7 +45,7 @@ public class ChiseledBookShelfBlockEntity extends BlockEntity implements Contain } ((Level)Objects.requireNonNull(this.level)).setBlock(this.worldPosition, blockState, 3); - this.level.gameEvent(GameEvent.BLOCK_CHANGE, this.worldPosition, GameEvent.Context.of(blockState)); + this.level.gameEvent(GameEvent.BLOCK_CHANGE, this.worldPosition, Context.of(blockState)); } else { LOGGER.error("Expected slot 0-5, got {}", slot); } @@ -150,7 +151,7 @@ public class ChiseledBookShelfBlockEntity extends BlockEntity implements Contain } @Override - protected void collectImplicitComponents(DataComponentMap.Builder components) { + protected void collectImplicitComponents(Builder components) { super.collectImplicitComponents(components); components.set(DataComponents.CONTAINER, ItemContainerContents.fromItems(this.items)); } diff --git a/net/minecraft/world/level/block/entity/CommandBlockEntity.java b/net/minecraft/world/level/block/entity/CommandBlockEntity.java index 7c183fb7..08be8ac6 100644 --- a/net/minecraft/world/level/block/entity/CommandBlockEntity.java +++ b/net/minecraft/world/level/block/entity/CommandBlockEntity.java @@ -4,8 +4,8 @@ import net.minecraft.commands.CommandSourceStack; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.HolderLookup; -import net.minecraft.core.component.DataComponentMap; import net.minecraft.core.component.DataComponents; +import net.minecraft.core.component.DataComponentMap.Builder; import net.minecraft.nbt.CompoundTag; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.level.BaseCommandBlock; @@ -173,7 +173,7 @@ public class CommandBlockEntity extends BlockEntity { } @Override - protected void collectImplicitComponents(DataComponentMap.Builder components) { + protected void collectImplicitComponents(Builder components) { super.collectImplicitComponents(components); components.set(DataComponents.CUSTOM_NAME, this.commandBlock.getCustomName()); } @@ -182,6 +182,8 @@ public class CommandBlockEntity extends BlockEntity { public void removeComponentsFromTag(CompoundTag tag) { super.removeComponentsFromTag(tag); tag.remove("CustomName"); + tag.remove("conditionMet"); + tag.remove("powered"); } public static enum Mode { diff --git a/net/minecraft/world/level/block/entity/CrafterBlockEntity.java b/net/minecraft/world/level/block/entity/CrafterBlockEntity.java index 76dacc5a..5b361b25 100644 --- a/net/minecraft/world/level/block/entity/CrafterBlockEntity.java +++ b/net/minecraft/world/level/block/entity/CrafterBlockEntity.java @@ -12,7 +12,7 @@ import net.minecraft.world.Container; import net.minecraft.world.ContainerHelper; import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.entity.player.Player; -import net.minecraft.world.entity.player.StackedContents; +import net.minecraft.world.entity.player.StackedItemContents; import net.minecraft.world.inventory.AbstractContainerMenu; import net.minecraft.world.inventory.ContainerData; import net.minecraft.world.inventory.CrafterMenu; @@ -201,9 +201,9 @@ public class CrafterBlockEntity extends RandomizableContainerBlockEntity impleme } @Override - public void fillStackedContents(StackedContents contents) { + public void fillStackedContents(StackedItemContents stackedItemContents) { for (ItemStack itemStack : this.items) { - contents.accountSimpleStack(itemStack); + stackedItemContents.accountSimpleStack(itemStack); } } diff --git a/net/minecraft/world/level/block/entity/CreakingHeartBlockEntity.java b/net/minecraft/world/level/block/entity/CreakingHeartBlockEntity.java new file mode 100644 index 00000000..6cd381e0 --- /dev/null +++ b/net/minecraft/world/level/block/entity/CreakingHeartBlockEntity.java @@ -0,0 +1,219 @@ +package net.minecraft.world.level.block.entity; + +import java.util.Optional; +import net.minecraft.core.BlockPos; +import net.minecraft.core.HolderLookup; +import net.minecraft.core.particles.TargetColorParticleOption; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.sounds.SoundSource; +import net.minecraft.util.RandomSource; +import net.minecraft.util.SpawnUtil; +import net.minecraft.world.Difficulty; +import net.minecraft.world.damagesource.DamageSource; +import net.minecraft.world.entity.EntitySpawnReason; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.monster.creaking.Creaking; +import net.minecraft.world.entity.monster.creaking.CreakingTransient; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.level.GameRules; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.CreakingHeartBlock; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.phys.Vec3; +import org.jetbrains.annotations.Nullable; + +public class CreakingHeartBlockEntity extends BlockEntity { + private static final int PLAYER_DETECTION_RANGE = 32; + public static final int CREAKING_ROAMING_RADIUS = 32; + private static final int DISTANCE_CREAKING_TOO_FAR = 34; + private static final int SPAWN_RANGE_XZ = 16; + private static final int SPAWN_RANGE_Y = 8; + private static final int ATTEMPTS_PER_SPAWN = 5; + private static final int UPDATE_TICKS = 20; + private static final int HURT_CALL_TOTAL_TICKS = 100; + private static final int NUMBER_OF_HURT_CALLS = 10; + private static final int HURT_CALL_INTERVAL = 10; + private static final int HURT_CALL_PARTICLE_TICKS = 50; + @Nullable + private CreakingTransient creaking; + private int ticker; + private int emitter; + @Nullable + private Vec3 emitterTarget; + private int outputSignal; + + public CreakingHeartBlockEntity(BlockPos blockPos, BlockState blockState) { + super(BlockEntityType.CREAKING_HEART, blockPos, blockState); + } + + public static void serverTick(Level level, BlockPos blockPos, BlockState blockState, CreakingHeartBlockEntity creakingHeartBlockEntity) { + int i = creakingHeartBlockEntity.computeAnalogOutputSignal(); + if (creakingHeartBlockEntity.outputSignal != i) { + creakingHeartBlockEntity.outputSignal = i; + level.updateNeighbourForOutputSignal(blockPos, Blocks.CREAKING_HEART); + } + + if (creakingHeartBlockEntity.emitter > 0) { + if (creakingHeartBlockEntity.emitter > 50) { + creakingHeartBlockEntity.emitParticles((ServerLevel)level, 1, true); + creakingHeartBlockEntity.emitParticles((ServerLevel)level, 1, false); + } + + if (creakingHeartBlockEntity.emitter % 10 == 0 && level instanceof ServerLevel serverLevel && creakingHeartBlockEntity.emitterTarget != null) { + if (creakingHeartBlockEntity.creaking != null) { + creakingHeartBlockEntity.emitterTarget = creakingHeartBlockEntity.creaking.getBoundingBox().getCenter(); + } + + Vec3 vec3 = Vec3.atCenterOf(blockPos); + float f = 0.2F + 0.8F * (100 - creakingHeartBlockEntity.emitter) / 100.0F; + Vec3 vec32 = vec3.subtract(creakingHeartBlockEntity.emitterTarget).scale(f).add(creakingHeartBlockEntity.emitterTarget); + BlockPos blockPos2 = BlockPos.containing(vec32); + float g = creakingHeartBlockEntity.emitter / 2.0F / 100.0F + 0.5F; + serverLevel.playSound(null, blockPos2, SoundEvents.CREAKING_HEART_HURT, SoundSource.BLOCKS, g, 1.0F); + } + + creakingHeartBlockEntity.emitter--; + } + + if (creakingHeartBlockEntity.ticker-- < 0) { + creakingHeartBlockEntity.ticker = 20; + if (creakingHeartBlockEntity.creaking != null) { + if (CreakingHeartBlock.canSummonCreaking(level) && !(creakingHeartBlockEntity.distanceToCreaking() > 34.0)) { + if (creakingHeartBlockEntity.creaking.isRemoved()) { + creakingHeartBlockEntity.creaking = null; + } + + if (!CreakingHeartBlock.hasRequiredLogs(blockState, level, blockPos) && creakingHeartBlockEntity.creaking == null) { + level.setBlock(blockPos, blockState.setValue(CreakingHeartBlock.CREAKING, CreakingHeartBlock.CreakingHeartState.DISABLED), 3); + } + } else { + creakingHeartBlockEntity.removeProtector(null); + } + } else if (!CreakingHeartBlock.hasRequiredLogs(blockState, level, blockPos)) { + level.setBlock(blockPos, blockState.setValue(CreakingHeartBlock.CREAKING, CreakingHeartBlock.CreakingHeartState.DISABLED), 3); + } else { + if (!CreakingHeartBlock.canSummonCreaking(level)) { + if (blockState.getValue(CreakingHeartBlock.CREAKING) == CreakingHeartBlock.CreakingHeartState.ACTIVE) { + level.setBlock(blockPos, blockState.setValue(CreakingHeartBlock.CREAKING, CreakingHeartBlock.CreakingHeartState.DORMANT), 3); + return; + } + } else if (blockState.getValue(CreakingHeartBlock.CREAKING) == CreakingHeartBlock.CreakingHeartState.DORMANT) { + level.setBlock(blockPos, blockState.setValue(CreakingHeartBlock.CREAKING, CreakingHeartBlock.CreakingHeartState.ACTIVE), 3); + return; + } + + if (blockState.getValue(CreakingHeartBlock.CREAKING) == CreakingHeartBlock.CreakingHeartState.ACTIVE) { + if (level.getDifficulty() != Difficulty.PEACEFUL) { + if (!(level instanceof ServerLevel serverLevel && !serverLevel.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING))) { + Player player = level.getNearestPlayer(blockPos.getX(), blockPos.getY(), blockPos.getZ(), 32.0, false); + if (player != null) { + creakingHeartBlockEntity.creaking = spawnProtector((ServerLevel)level, creakingHeartBlockEntity); + if (creakingHeartBlockEntity.creaking != null) { + creakingHeartBlockEntity.creaking.makeSound(SoundEvents.CREAKING_SPAWN); + level.playSound(null, creakingHeartBlockEntity.getBlockPos(), SoundEvents.CREAKING_HEART_SPAWN, SoundSource.BLOCKS, 1.0F, 1.0F); + } + } + } + } + } + } + } + } + + private double distanceToCreaking() { + return this.creaking == null ? 0.0 : Math.sqrt(this.creaking.distanceToSqr(Vec3.atBottomCenterOf(this.getBlockPos()))); + } + + @Nullable + private static CreakingTransient spawnProtector(ServerLevel serverLevel, CreakingHeartBlockEntity creakingHeartBlockEntity) { + BlockPos blockPos = creakingHeartBlockEntity.getBlockPos(); + Optional optional = SpawnUtil.trySpawnMob( + EntityType.CREAKING_TRANSIENT, EntitySpawnReason.SPAWNER, serverLevel, blockPos, 5, 16, 8, SpawnUtil.Strategy.ON_TOP_OF_COLLIDER_NO_LEAVES + ); + if (optional.isEmpty()) { + return null; + } else { + CreakingTransient creakingTransient = (CreakingTransient)optional.get(); + serverLevel.gameEvent(creakingTransient, GameEvent.ENTITY_PLACE, creakingTransient.position()); + serverLevel.broadcastEntityEvent(creakingTransient, (byte)60); + creakingTransient.bindToCreakingHeart(blockPos); + return creakingTransient; + } + } + + public ClientboundBlockEntityDataPacket getUpdatePacket() { + return ClientboundBlockEntityDataPacket.create(this); + } + + @Override + public CompoundTag getUpdateTag(HolderLookup.Provider registries) { + return this.saveCustomOnly(registries); + } + + public void creakingHurt() { + if (this.creaking != null) { + if (this.level instanceof ServerLevel serverLevel) { + this.emitParticles(serverLevel, 20, false); + this.emitter = 100; + this.emitterTarget = this.creaking.getBoundingBox().getCenter(); + } + } + } + + private void emitParticles(ServerLevel serverLevel, int i, boolean bl) { + if (this.creaking != null) { + int j = bl ? 16545810 : 6250335; + RandomSource randomSource = serverLevel.random; + + for (double d = 0.0; d < i; d++) { + Vec3 vec3 = this.creaking + .getBoundingBox() + .getMinPosition() + .add( + randomSource.nextDouble() * this.creaking.getBoundingBox().getXsize(), + randomSource.nextDouble() * this.creaking.getBoundingBox().getYsize(), + randomSource.nextDouble() * this.creaking.getBoundingBox().getZsize() + ); + Vec3 vec32 = Vec3.atLowerCornerOf(this.getBlockPos()).add(randomSource.nextDouble(), randomSource.nextDouble(), randomSource.nextDouble()); + if (bl) { + Vec3 vec33 = vec3; + vec3 = vec32; + vec32 = vec33; + } + + TargetColorParticleOption targetColorParticleOption = new TargetColorParticleOption(vec32, j); + serverLevel.sendParticles(targetColorParticleOption, vec3.x, vec3.y, vec3.z, 1, 0.0, 0.0, 0.0, 0.0); + } + } + } + + public void removeProtector(@Nullable DamageSource damageSource) { + if (this.creaking != null) { + this.creaking.tearDown(damageSource); + this.creaking = null; + } + } + + public boolean isProtector(Creaking creaking) { + return this.creaking == creaking; + } + + public int getAnalogOutputSignal() { + return this.outputSignal; + } + + public int computeAnalogOutputSignal() { + if (this.creaking == null) { + return 0; + } else { + double d = this.distanceToCreaking(); + double e = Math.clamp(d, 0.0, 32.0) / 32.0; + return 15 - (int)Math.floor(e * 15.0); + } + } +} diff --git a/net/minecraft/world/level/block/entity/DecoratedPotBlockEntity.java b/net/minecraft/world/level/block/entity/DecoratedPotBlockEntity.java index 26a75b26..418aba43 100644 --- a/net/minecraft/world/level/block/entity/DecoratedPotBlockEntity.java +++ b/net/minecraft/world/level/block/entity/DecoratedPotBlockEntity.java @@ -4,8 +4,8 @@ import java.util.List; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.HolderLookup; -import net.minecraft.core.component.DataComponentMap; import net.minecraft.core.component.DataComponents; +import net.minecraft.core.component.DataComponentMap.Builder; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket; import net.minecraft.resources.ResourceKey; @@ -16,10 +16,10 @@ import net.minecraft.world.item.component.ItemContainerContents; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.storage.loot.LootTable; -import net.minecraft.world.ticks.ContainerSingleItem; +import net.minecraft.world.ticks.ContainerSingleItem.BlockContainerSingleItem; import org.jetbrains.annotations.Nullable; -public class DecoratedPotBlockEntity extends BlockEntity implements RandomizableContainer, ContainerSingleItem.BlockContainerSingleItem { +public class DecoratedPotBlockEntity extends BlockEntity implements RandomizableContainer, BlockContainerSingleItem { public static final String TAG_SHERDS = "sherds"; public static final String TAG_ITEM = "item"; public static final int EVENT_POT_WOBBLES = 1; @@ -114,7 +114,7 @@ public class DecoratedPotBlockEntity extends BlockEntity implements Randomizable } @Override - protected void collectImplicitComponents(DataComponentMap.Builder components) { + protected void collectImplicitComponents(Builder components) { super.collectImplicitComponents(components); components.set(DataComponents.POT_DECORATIONS, this.decorations); components.set(DataComponents.CONTAINER, ItemContainerContents.fromItems(List.of(this.item))); diff --git a/net/minecraft/world/level/block/entity/EnchantingTableBlockEntity.java b/net/minecraft/world/level/block/entity/EnchantingTableBlockEntity.java index 35341562..c3b00471 100644 --- a/net/minecraft/world/level/block/entity/EnchantingTableBlockEntity.java +++ b/net/minecraft/world/level/block/entity/EnchantingTableBlockEntity.java @@ -2,8 +2,8 @@ package net.minecraft.world.level.block.entity; import net.minecraft.core.BlockPos; import net.minecraft.core.HolderLookup; -import net.minecraft.core.component.DataComponentMap; import net.minecraft.core.component.DataComponents; +import net.minecraft.core.component.DataComponentMap.Builder; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.chat.Component; import net.minecraft.util.Mth; @@ -129,7 +129,7 @@ public class EnchantingTableBlockEntity extends BlockEntity implements Nameable } @Override - protected void collectImplicitComponents(DataComponentMap.Builder components) { + protected void collectImplicitComponents(Builder components) { super.collectImplicitComponents(components); components.set(DataComponents.CUSTOM_NAME, this.name); } diff --git a/net/minecraft/world/level/block/entity/FuelValues.java b/net/minecraft/world/level/block/entity/FuelValues.java new file mode 100644 index 00000000..6441b648 --- /dev/null +++ b/net/minecraft/world/level/block/entity/FuelValues.java @@ -0,0 +1,147 @@ +package net.minecraft.world.level.block.entity; + +import it.unimi.dsi.fastutil.objects.Object2IntLinkedOpenHashMap; +import it.unimi.dsi.fastutil.objects.Object2IntSortedMap; +import java.util.Collections; +import java.util.SequencedSet; +import net.minecraft.core.Holder; +import net.minecraft.core.HolderLookup; +import net.minecraft.core.registries.Registries; +import net.minecraft.tags.ItemTags; +import net.minecraft.tags.TagKey; +import net.minecraft.world.flag.FeatureFlagSet; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.world.level.ItemLike; +import net.minecraft.world.level.block.Blocks; + +public class FuelValues { + private final Object2IntSortedMap values; + + FuelValues(Object2IntSortedMap object2IntSortedMap) { + this.values = object2IntSortedMap; + } + + public boolean isFuel(ItemStack itemStack) { + return this.values.containsKey(itemStack.getItem()); + } + + public SequencedSet fuelItems() { + return Collections.unmodifiableSequencedSet(this.values.keySet()); + } + + public int burnDuration(ItemStack itemStack) { + return itemStack.isEmpty() ? 0 : this.values.getInt(itemStack.getItem()); + } + + public static FuelValues vanillaBurnTimes(HolderLookup.Provider provider, FeatureFlagSet featureFlagSet) { + return vanillaBurnTimes(provider, featureFlagSet, 200); + } + + public static FuelValues vanillaBurnTimes(HolderLookup.Provider provider, FeatureFlagSet featureFlagSet, int i) { + return new FuelValues.Builder(provider, featureFlagSet) + .add(Items.LAVA_BUCKET, i * 100) + .add(Blocks.COAL_BLOCK, i * 8 * 10) + .add(Items.BLAZE_ROD, i * 12) + .add(Items.COAL, i * 8) + .add(Items.CHARCOAL, i * 8) + .add(ItemTags.LOGS, i * 3 / 2) + .add(ItemTags.BAMBOO_BLOCKS, i * 3 / 2) + .add(ItemTags.PLANKS, i * 3 / 2) + .add(Blocks.BAMBOO_MOSAIC, i * 3 / 2) + .add(ItemTags.WOODEN_STAIRS, i * 3 / 2) + .add(Blocks.BAMBOO_MOSAIC_STAIRS, i * 3 / 2) + .add(ItemTags.WOODEN_SLABS, i * 3 / 4) + .add(Blocks.BAMBOO_MOSAIC_SLAB, i * 3 / 4) + .add(ItemTags.WOODEN_TRAPDOORS, i * 3 / 2) + .add(ItemTags.WOODEN_PRESSURE_PLATES, i * 3 / 2) + .add(ItemTags.WOODEN_FENCES, i * 3 / 2) + .add(ItemTags.FENCE_GATES, i * 3 / 2) + .add(Blocks.NOTE_BLOCK, i * 3 / 2) + .add(Blocks.BOOKSHELF, i * 3 / 2) + .add(Blocks.CHISELED_BOOKSHELF, i * 3 / 2) + .add(Blocks.LECTERN, i * 3 / 2) + .add(Blocks.JUKEBOX, i * 3 / 2) + .add(Blocks.CHEST, i * 3 / 2) + .add(Blocks.TRAPPED_CHEST, i * 3 / 2) + .add(Blocks.CRAFTING_TABLE, i * 3 / 2) + .add(Blocks.DAYLIGHT_DETECTOR, i * 3 / 2) + .add(ItemTags.BANNERS, i * 3 / 2) + .add(Items.BOW, i * 3 / 2) + .add(Items.FISHING_ROD, i * 3 / 2) + .add(Blocks.LADDER, i * 3 / 2) + .add(ItemTags.SIGNS, i) + .add(ItemTags.HANGING_SIGNS, i * 4) + .add(Items.WOODEN_SHOVEL, i) + .add(Items.WOODEN_SWORD, i) + .add(Items.WOODEN_HOE, i) + .add(Items.WOODEN_AXE, i) + .add(Items.WOODEN_PICKAXE, i) + .add(ItemTags.WOODEN_DOORS, i) + .add(ItemTags.BOATS, i * 6) + .add(ItemTags.WOOL, i / 2) + .add(ItemTags.WOODEN_BUTTONS, i / 2) + .add(Items.STICK, i / 2) + .add(ItemTags.SAPLINGS, i / 2) + .add(Items.BOWL, i / 2) + .add(ItemTags.WOOL_CARPETS, 1 + i / 3) + .add(Blocks.DRIED_KELP_BLOCK, 1 + i * 20) + .add(Items.CROSSBOW, i * 3 / 2) + .add(Blocks.BAMBOO, i / 4) + .add(Blocks.DEAD_BUSH, i / 2) + .add(Blocks.SCAFFOLDING, i / 4) + .add(Blocks.LOOM, i * 3 / 2) + .add(Blocks.BARREL, i * 3 / 2) + .add(Blocks.CARTOGRAPHY_TABLE, i * 3 / 2) + .add(Blocks.FLETCHING_TABLE, i * 3 / 2) + .add(Blocks.SMITHING_TABLE, i * 3 / 2) + .add(Blocks.COMPOSTER, i * 3 / 2) + .add(Blocks.AZALEA, i / 2) + .add(Blocks.FLOWERING_AZALEA, i / 2) + .add(Blocks.MANGROVE_ROOTS, i * 3 / 2) + .remove(ItemTags.NON_FLAMMABLE_WOOD) + .build(); + } + + public static class Builder { + private final HolderLookup items; + private final FeatureFlagSet enabledFeatures; + private final Object2IntSortedMap values = new Object2IntLinkedOpenHashMap<>(); + + public Builder(HolderLookup.Provider provider, FeatureFlagSet featureFlagSet) { + this.items = provider.lookupOrThrow(Registries.ITEM); + this.enabledFeatures = featureFlagSet; + } + + public FuelValues build() { + return new FuelValues(this.values); + } + + public FuelValues.Builder remove(TagKey tagKey) { + this.values.keySet().removeIf(item -> item.builtInRegistryHolder().is(tagKey)); + return this; + } + + public FuelValues.Builder add(TagKey tagKey, int i) { + this.items.get(tagKey).ifPresent(named -> { + for (Holder holder : named) { + this.putInternal(i, holder.value()); + } + }); + return this; + } + + public FuelValues.Builder add(ItemLike itemLike, int i) { + Item item = itemLike.asItem(); + this.putInternal(i, item); + return this; + } + + private void putInternal(int i, Item item) { + if (item.isEnabled(this.enabledFeatures)) { + this.values.put(item, i); + } + } + } +} diff --git a/net/minecraft/world/level/block/entity/JigsawBlockEntity.java b/net/minecraft/world/level/block/entity/JigsawBlockEntity.java index 5bd256ee..f9cf4021 100644 --- a/net/minecraft/world/level/block/entity/JigsawBlockEntity.java +++ b/net/minecraft/world/level/block/entity/JigsawBlockEntity.java @@ -1,7 +1,5 @@ package net.minecraft.world.level.block.entity; -import java.util.Arrays; -import java.util.Optional; import net.minecraft.core.BlockPos; import net.minecraft.core.FrontAndTop; import net.minecraft.core.Holder; @@ -19,6 +17,7 @@ import net.minecraft.world.level.block.JigsawBlock; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.levelgen.structure.pools.JigsawPlacement; import net.minecraft.world.level.levelgen.structure.pools.StructureTemplatePool; +import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate; public class JigsawBlockEntity extends BlockEntity { public static final String TARGET = "target"; @@ -115,12 +114,7 @@ public class JigsawBlockEntity extends BlockEntity { this.target = ResourceLocation.parse(tag.getString("target")); this.pool = ResourceKey.create(Registries.TEMPLATE_POOL, ResourceLocation.parse(tag.getString("pool"))); this.finalState = tag.getString("final_state"); - this.joint = (JigsawBlockEntity.JointType)JigsawBlockEntity.JointType.byName(tag.getString("joint")) - .orElseGet( - () -> JigsawBlock.getFrontFacing(this.getBlockState()).getAxis().isHorizontal() - ? JigsawBlockEntity.JointType.ALIGNED - : JigsawBlockEntity.JointType.ROLLABLE - ); + this.joint = StructureTemplate.getJointType(tag, this.getBlockState()); this.placementPriority = tag.getInt("placement_priority"); this.selectionPriority = tag.getInt("selection_priority"); } @@ -136,8 +130,8 @@ public class JigsawBlockEntity extends BlockEntity { public void generate(ServerLevel level, int maxDepth, boolean keepJigsaws) { BlockPos blockPos = this.getBlockPos().relative(((FrontAndTop)this.getBlockState().getValue(JigsawBlock.ORIENTATION)).front()); - Registry registry = level.registryAccess().registryOrThrow(Registries.TEMPLATE_POOL); - Holder holder = registry.getHolderOrThrow(this.pool); + Registry registry = level.registryAccess().lookupOrThrow(Registries.TEMPLATE_POOL); + Holder holder = registry.getOrThrow(this.pool); JigsawPlacement.generateJigsaw(level, holder, this.target, maxDepth, blockPos, keepJigsaws); } @@ -145,6 +139,7 @@ public class JigsawBlockEntity extends BlockEntity { ROLLABLE("rollable"), ALIGNED("aligned"); + public static final StringRepresentable.EnumCodec CODEC = StringRepresentable.fromEnum(JigsawBlockEntity.JointType::values); private final String name; private JointType(final String name) { @@ -156,10 +151,6 @@ public class JigsawBlockEntity extends BlockEntity { return this.name; } - public static Optional byName(String name) { - return Arrays.stream(values()).filter(jointType -> jointType.getSerializedName().equals(name)).findFirst(); - } - public Component getTranslatedName() { return Component.translatable("jigsaw_block.joint." + this.name); } diff --git a/net/minecraft/world/level/block/entity/JukeboxBlockEntity.java b/net/minecraft/world/level/block/entity/JukeboxBlockEntity.java index fded141f..85c23eb7 100644 --- a/net/minecraft/world/level/block/entity/JukeboxBlockEntity.java +++ b/net/minecraft/world/level/block/entity/JukeboxBlockEntity.java @@ -7,7 +7,6 @@ import net.minecraft.core.Holder; import net.minecraft.core.HolderLookup; import net.minecraft.core.component.DataComponents; import net.minecraft.nbt.CompoundTag; -import net.minecraft.world.Clearable; import net.minecraft.world.Container; import net.minecraft.world.entity.item.ItemEntity; import net.minecraft.world.item.ItemStack; @@ -17,10 +16,11 @@ import net.minecraft.world.level.Level; import net.minecraft.world.level.block.JukeboxBlock; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.level.gameevent.GameEvent.Context; import net.minecraft.world.phys.Vec3; -import net.minecraft.world.ticks.ContainerSingleItem; +import net.minecraft.world.ticks.ContainerSingleItem.BlockContainerSingleItem; -public class JukeboxBlockEntity extends BlockEntity implements Clearable, ContainerSingleItem.BlockContainerSingleItem { +public class JukeboxBlockEntity extends BlockEntity implements BlockContainerSingleItem { public static final String SONG_ITEM_TAG_ID = "RecordItem"; public static final String TICKS_SINCE_SONG_STARTED_TAG_ID = "ticks_since_song_started"; private ItemStack item = ItemStack.EMPTY; @@ -42,7 +42,7 @@ public class JukeboxBlockEntity extends BlockEntity implements Clearable, Contai private void notifyItemChangedInJukebox(boolean hasRecord) { if (this.level != null && this.level.getBlockState(this.getBlockPos()) == this.getBlockState()) { this.level.setBlock(this.getBlockPos(), this.getBlockState().setValue(JukeboxBlock.HAS_RECORD, hasRecord), 2); - this.level.gameEvent(GameEvent.BLOCK_CHANGE, this.getBlockPos(), GameEvent.Context.of(this.getBlockState())); + this.level.gameEvent(GameEvent.BLOCK_CHANGE, this.getBlockPos(), Context.of(this.getBlockState())); } } diff --git a/net/minecraft/world/level/block/entity/LecternBlockEntity.java b/net/minecraft/world/level/block/entity/LecternBlockEntity.java index 205772b0..d55b7d6e 100644 --- a/net/minecraft/world/level/block/entity/LecternBlockEntity.java +++ b/net/minecraft/world/level/block/entity/LecternBlockEntity.java @@ -18,7 +18,6 @@ import net.minecraft.world.inventory.AbstractContainerMenu; import net.minecraft.world.inventory.ContainerData; import net.minecraft.world.inventory.LecternMenu; import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.Items; import net.minecraft.world.item.WrittenBookItem; import net.minecraft.world.item.component.WritableBookContent; import net.minecraft.world.item.component.WrittenBookContent; @@ -137,7 +136,7 @@ public class LecternBlockEntity extends BlockEntity implements Clearable, MenuPr * @return whether the ItemStack in this lectern is a book or written book */ public boolean hasBook() { - return this.book.is(Items.WRITABLE_BOOK) || this.book.is(Items.WRITTEN_BOOK); + return this.book.has(DataComponents.WRITABLE_BOOK_CONTENT) || this.book.has(DataComponents.WRITTEN_BOOK_CONTENT); } /** @@ -187,17 +186,14 @@ public class LecternBlockEntity extends BlockEntity implements Clearable, MenuPr * Resolves the contents of the passed ItemStack, if it is a book */ private ItemStack resolveBook(ItemStack stack, @Nullable Player player) { - if (this.level instanceof ServerLevel && stack.is(Items.WRITTEN_BOOK)) { - WrittenBookItem.resolveBookComponents(stack, this.createCommandSourceStack(player), player); + if (this.level instanceof ServerLevel serverLevel) { + WrittenBookItem.resolveBookComponents(stack, this.createCommandSourceStack(player, serverLevel), player); } return stack; } - /** - * Creates a CommandSourceStack for resolving the contents of a book. If the player is null, a CommandSourceStack with the generic name {@code "Lectern"} is used. - */ - private CommandSourceStack createCommandSourceStack(@Nullable Player player) { + private CommandSourceStack createCommandSourceStack(@Nullable Player player, ServerLevel serverLevel) { String string; Component component; if (player == null) { @@ -209,7 +205,7 @@ public class LecternBlockEntity extends BlockEntity implements Clearable, MenuPr } Vec3 vec3 = Vec3.atCenterOf(this.worldPosition); - return new CommandSourceStack(CommandSource.NULL, vec3, Vec2.ZERO, (ServerLevel)this.level, 2, string, component, this.level.getServer(), player); + return new CommandSourceStack(CommandSource.NULL, vec3, Vec2.ZERO, serverLevel, 2, string, component, serverLevel.getServer(), player); } @Override diff --git a/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java b/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java index c292f50e..4811b0cc 100644 --- a/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java +++ b/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java @@ -1,8 +1,8 @@ package net.minecraft.world.level.block.entity; import net.minecraft.core.BlockPos; -import net.minecraft.core.component.DataComponentMap; import net.minecraft.core.component.DataComponents; +import net.minecraft.core.component.DataComponentMap.Builder; import net.minecraft.nbt.CompoundTag; import net.minecraft.resources.ResourceKey; import net.minecraft.world.RandomizableContainer; @@ -102,7 +102,7 @@ public abstract class RandomizableContainerBlockEntity extends BaseContainerBloc } @Override - protected void collectImplicitComponents(DataComponentMap.Builder components) { + protected void collectImplicitComponents(Builder components) { super.collectImplicitComponents(components); if (this.lootTable != null) { components.set(DataComponents.CONTAINER_LOOT, new SeededContainerLoot(this.lootTable, this.lootTableSeed)); diff --git a/net/minecraft/world/level/block/entity/SculkCatalystBlockEntity.java b/net/minecraft/world/level/block/entity/SculkCatalystBlockEntity.java index 1a8933fb..9bfaada3 100644 --- a/net/minecraft/world/level/block/entity/SculkCatalystBlockEntity.java +++ b/net/minecraft/world/level/block/entity/SculkCatalystBlockEntity.java @@ -24,9 +24,12 @@ import net.minecraft.world.level.gameevent.BlockPositionSource; import net.minecraft.world.level.gameevent.GameEvent; import net.minecraft.world.level.gameevent.GameEventListener; import net.minecraft.world.level.gameevent.PositionSource; +import net.minecraft.world.level.gameevent.GameEvent.Context; +import net.minecraft.world.level.gameevent.GameEventListener.DeliveryMode; +import net.minecraft.world.level.gameevent.GameEventListener.Provider; import net.minecraft.world.phys.Vec3; -public class SculkCatalystBlockEntity extends BlockEntity implements GameEventListener.Provider { +public class SculkCatalystBlockEntity extends BlockEntity implements Provider { private final SculkCatalystBlockEntity.CatalystListener catalystListener; public SculkCatalystBlockEntity(BlockPos pos, BlockState blockState) { @@ -77,12 +80,12 @@ public class SculkCatalystBlockEntity extends BlockEntity implements GameEventLi } @Override - public GameEventListener.DeliveryMode getDeliveryMode() { - return GameEventListener.DeliveryMode.BY_DISTANCE; + public DeliveryMode getDeliveryMode() { + return DeliveryMode.BY_DISTANCE; } @Override - public boolean handleGameEvent(ServerLevel level, Holder gameEvent, GameEvent.Context context, Vec3 pos) { + public boolean handleGameEvent(ServerLevel level, Holder gameEvent, Context context, Vec3 pos) { if (gameEvent.is(GameEvent.ENTITY_DIE) && context.sourceEntity() instanceof LivingEntity livingEntity) { if (!livingEntity.wasExperienceConsumed()) { DamageSource damageSource = livingEntity.getLastDamageSource(); diff --git a/net/minecraft/world/level/block/entity/SculkSensorBlockEntity.java b/net/minecraft/world/level/block/entity/SculkSensorBlockEntity.java index 0c8a9cb9..09cd4428 100644 --- a/net/minecraft/world/level/block/entity/SculkSensorBlockEntity.java +++ b/net/minecraft/world/level/block/entity/SculkSensorBlockEntity.java @@ -14,30 +14,34 @@ import net.minecraft.world.level.block.SculkSensorBlock; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.gameevent.BlockPositionSource; import net.minecraft.world.level.gameevent.GameEvent; -import net.minecraft.world.level.gameevent.GameEventListener; import net.minecraft.world.level.gameevent.PositionSource; +import net.minecraft.world.level.gameevent.GameEvent.Context; +import net.minecraft.world.level.gameevent.GameEventListener.Provider; import net.minecraft.world.level.gameevent.vibrations.VibrationSystem; +import net.minecraft.world.level.gameevent.vibrations.VibrationSystem.Data; +import net.minecraft.world.level.gameevent.vibrations.VibrationSystem.Listener; +import net.minecraft.world.level.gameevent.vibrations.VibrationSystem.User; import org.jetbrains.annotations.Nullable; import org.slf4j.Logger; -public class SculkSensorBlockEntity extends BlockEntity implements GameEventListener.Provider, VibrationSystem { +public class SculkSensorBlockEntity extends BlockEntity implements Provider, VibrationSystem { private static final Logger LOGGER = LogUtils.getLogger(); - private VibrationSystem.Data vibrationData; - private final VibrationSystem.Listener vibrationListener; - private final VibrationSystem.User vibrationUser = this.createVibrationUser(); + private Data vibrationData; + private final Listener vibrationListener; + private final User vibrationUser = this.createVibrationUser(); private int lastVibrationFrequency; protected SculkSensorBlockEntity(BlockEntityType type, BlockPos pos, BlockState blockState) { super(type, pos, blockState); - this.vibrationData = new VibrationSystem.Data(); - this.vibrationListener = new VibrationSystem.Listener(this); + this.vibrationData = new Data(); + this.vibrationListener = new Listener(this); } public SculkSensorBlockEntity(BlockPos pos, BlockState blockState) { this(BlockEntityType.SCULK_SENSOR, pos, blockState); } - public VibrationSystem.User createVibrationUser() { + public User createVibrationUser() { return new SculkSensorBlockEntity.VibrationUser(this.getBlockPos()); } @@ -47,7 +51,7 @@ public class SculkSensorBlockEntity extends BlockEntity implements GameEventList this.lastVibrationFrequency = tag.getInt("last_vibration_frequency"); RegistryOps registryOps = registries.createSerializationContext(NbtOps.INSTANCE); if (tag.contains("listener", 10)) { - VibrationSystem.Data.CODEC + Data.CODEC .parse(registryOps, tag.getCompound("listener")) .resultOrPartial(string -> LOGGER.error("Failed to parse vibration listener for Sculk Sensor: '{}'", string)) .ifPresent(data -> this.vibrationData = data); @@ -59,19 +63,19 @@ public class SculkSensorBlockEntity extends BlockEntity implements GameEventList super.saveAdditional(tag, registries); tag.putInt("last_vibration_frequency", this.lastVibrationFrequency); RegistryOps registryOps = registries.createSerializationContext(NbtOps.INSTANCE); - VibrationSystem.Data.CODEC + Data.CODEC .encodeStart(registryOps, this.vibrationData) .resultOrPartial(string -> LOGGER.error("Failed to encode vibration listener for Sculk Sensor: '{}'", string)) .ifPresent(tagx -> tag.put("listener", tagx)); } @Override - public VibrationSystem.Data getVibrationData() { + public Data getVibrationData() { return this.vibrationData; } @Override - public VibrationSystem.User getVibrationUser() { + public User getVibrationUser() { return this.vibrationUser; } @@ -83,11 +87,11 @@ public class SculkSensorBlockEntity extends BlockEntity implements GameEventList this.lastVibrationFrequency = lastVibrationFrequency; } - public VibrationSystem.Listener getListener() { + public Listener getListener() { return this.vibrationListener; } - protected class VibrationUser implements VibrationSystem.User { + protected class VibrationUser implements User { public static final int LISTENER_RANGE = 8; protected final BlockPos blockPos; private final PositionSource positionSource; @@ -113,7 +117,7 @@ public class SculkSensorBlockEntity extends BlockEntity implements GameEventList } @Override - public boolean canReceiveVibration(ServerLevel level, BlockPos pos, Holder gameEvent, @Nullable GameEvent.Context context) { + public boolean canReceiveVibration(ServerLevel level, BlockPos pos, Holder gameEvent, @Nullable Context context) { return !pos.equals(this.blockPos) || !gameEvent.is(GameEvent.BLOCK_DESTROY) && !gameEvent.is(GameEvent.BLOCK_PLACE) ? SculkSensorBlock.canActivate(SculkSensorBlockEntity.this.getBlockState()) : false; diff --git a/net/minecraft/world/level/block/entity/SculkShriekerBlockEntity.java b/net/minecraft/world/level/block/entity/SculkShriekerBlockEntity.java index f6fc5377..acb40cb4 100644 --- a/net/minecraft/world/level/block/entity/SculkShriekerBlockEntity.java +++ b/net/minecraft/world/level/block/entity/SculkShriekerBlockEntity.java @@ -23,8 +23,8 @@ import net.minecraft.util.Mth; import net.minecraft.util.SpawnUtil; import net.minecraft.world.Difficulty; import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; -import net.minecraft.world.entity.MobSpawnType; import net.minecraft.world.entity.item.ItemEntity; import net.minecraft.world.entity.monster.warden.Warden; import net.minecraft.world.entity.monster.warden.WardenSpawnTracker; @@ -35,14 +35,18 @@ import net.minecraft.world.level.block.SculkShriekerBlock; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.gameevent.BlockPositionSource; import net.minecraft.world.level.gameevent.GameEvent; -import net.minecraft.world.level.gameevent.GameEventListener; import net.minecraft.world.level.gameevent.PositionSource; +import net.minecraft.world.level.gameevent.GameEvent.Context; +import net.minecraft.world.level.gameevent.GameEventListener.Provider; import net.minecraft.world.level.gameevent.vibrations.VibrationSystem; +import net.minecraft.world.level.gameevent.vibrations.VibrationSystem.Data; +import net.minecraft.world.level.gameevent.vibrations.VibrationSystem.Listener; +import net.minecraft.world.level.gameevent.vibrations.VibrationSystem.User; import net.minecraft.world.phys.Vec3; import org.jetbrains.annotations.Nullable; import org.slf4j.Logger; -public class SculkShriekerBlockEntity extends BlockEntity implements GameEventListener.Provider, VibrationSystem { +public class SculkShriekerBlockEntity extends BlockEntity implements Provider, VibrationSystem { private static final Logger LOGGER = LogUtils.getLogger(); private static final int WARNING_SOUND_RADIUS = 10; private static final int WARDEN_SPAWN_ATTEMPTS = 20; @@ -57,21 +61,21 @@ public class SculkShriekerBlockEntity extends BlockEntity implements GameEventLi int2ObjectOpenHashMap.put(4, SoundEvents.WARDEN_LISTENING_ANGRY); }); private int warningLevel; - private final VibrationSystem.User vibrationUser = new SculkShriekerBlockEntity.VibrationUser(); - private VibrationSystem.Data vibrationData = new VibrationSystem.Data(); - private final VibrationSystem.Listener vibrationListener = new VibrationSystem.Listener(this); + private final User vibrationUser = new SculkShriekerBlockEntity.VibrationUser(); + private Data vibrationData = new Data(); + private final Listener vibrationListener = new Listener(this); public SculkShriekerBlockEntity(BlockPos pos, BlockState blockState) { super(BlockEntityType.SCULK_SHRIEKER, pos, blockState); } @Override - public VibrationSystem.Data getVibrationData() { + public Data getVibrationData() { return this.vibrationData; } @Override - public VibrationSystem.User getVibrationUser() { + public User getVibrationUser() { return this.vibrationUser; } @@ -84,7 +88,7 @@ public class SculkShriekerBlockEntity extends BlockEntity implements GameEventLi RegistryOps registryOps = registries.createSerializationContext(NbtOps.INSTANCE); if (tag.contains("listener", 10)) { - VibrationSystem.Data.CODEC + Data.CODEC .parse(registryOps, tag.getCompound("listener")) .resultOrPartial(string -> LOGGER.error("Failed to parse vibration listener for Sculk Shrieker: '{}'", string)) .ifPresent(data -> this.vibrationData = data); @@ -96,7 +100,7 @@ public class SculkShriekerBlockEntity extends BlockEntity implements GameEventLi super.saveAdditional(tag, registries); tag.putInt("warning_level", this.warningLevel); RegistryOps registryOps = registries.createSerializationContext(NbtOps.INSTANCE); - VibrationSystem.Data.CODEC + Data.CODEC .encodeStart(registryOps, this.vibrationData) .resultOrPartial(string -> LOGGER.error("Failed to encode vibration listener for Sculk Shrieker: '{}'", string)) .ifPresent(tagx -> tag.put("listener", tagx)); @@ -139,7 +143,7 @@ public class SculkShriekerBlockEntity extends BlockEntity implements GameEventLi level.setBlock(blockPos, blockState.setValue(SculkShriekerBlock.SHRIEKING, true), 2); level.scheduleTick(blockPos, blockState.getBlock(), 90); level.levelEvent(3007, blockPos, 0); - level.gameEvent(GameEvent.SHRIEK, blockPos, GameEvent.Context.of(sourceEntity)); + level.gameEvent(GameEvent.SHRIEK, blockPos, Context.of(sourceEntity)); } private boolean canRespond(ServerLevel level) { @@ -172,14 +176,15 @@ public class SculkShriekerBlockEntity extends BlockEntity implements GameEventLi private boolean trySummonWarden(ServerLevel level) { return this.warningLevel < 4 ? false - : SpawnUtil.trySpawnMob(EntityType.WARDEN, MobSpawnType.TRIGGERED, level, this.getBlockPos(), 20, 5, 6, SpawnUtil.Strategy.ON_TOP_OF_COLLIDER).isPresent(); + : SpawnUtil.trySpawnMob(EntityType.WARDEN, EntitySpawnReason.TRIGGERED, level, this.getBlockPos(), 20, 5, 6, SpawnUtil.Strategy.ON_TOP_OF_COLLIDER) + .isPresent(); } - public VibrationSystem.Listener getListener() { + public Listener getListener() { return this.vibrationListener; } - class VibrationUser implements VibrationSystem.User { + class VibrationUser implements User { private static final int LISTENER_RADIUS = 8; private final PositionSource positionSource = new BlockPositionSource(SculkShriekerBlockEntity.this.worldPosition); @@ -202,7 +207,7 @@ public class SculkShriekerBlockEntity extends BlockEntity implements GameEventLi } @Override - public boolean canReceiveVibration(ServerLevel level, BlockPos pos, Holder gameEvent, GameEvent.Context context) { + public boolean canReceiveVibration(ServerLevel level, BlockPos pos, Holder gameEvent, Context context) { return !(Boolean)SculkShriekerBlockEntity.this.getBlockState().getValue(SculkShriekerBlock.SHRIEKING) && SculkShriekerBlockEntity.tryGetPlayer(context.sourceEntity()) != null; } diff --git a/net/minecraft/world/level/block/entity/SkullBlockEntity.java b/net/minecraft/world/level/block/entity/SkullBlockEntity.java index a96c7f08..13add280 100644 --- a/net/minecraft/world/level/block/entity/SkullBlockEntity.java +++ b/net/minecraft/world/level/block/entity/SkullBlockEntity.java @@ -15,8 +15,8 @@ import java.util.function.BooleanSupplier; import net.minecraft.Util; import net.minecraft.core.BlockPos; import net.minecraft.core.HolderLookup; -import net.minecraft.core.component.DataComponentMap; import net.minecraft.core.component.DataComponents; +import net.minecraft.core.component.DataComponentMap.Builder; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.NbtOps; import net.minecraft.network.chat.Component; @@ -103,7 +103,7 @@ public class SkullBlockEntity extends BlockEntity { ProfileResult profileResult = services.sessionService().fetchProfile(id, true); return Optional.ofNullable(profileResult).map(ProfileResult::profile); } - }, Util.backgroundExecutor()); + }, Util.backgroundExecutor().forName("fetchProfile")); } public static void clear() { @@ -221,7 +221,7 @@ public class SkullBlockEntity extends BlockEntity { } @Override - protected void collectImplicitComponents(DataComponentMap.Builder components) { + protected void collectImplicitComponents(Builder components) { super.collectImplicitComponents(components); components.set(DataComponents.PROFILE, this.owner); components.set(DataComponents.NOTE_BLOCK_SOUND, this.noteBlockSound); diff --git a/net/minecraft/world/level/block/entity/SmokerBlockEntity.java b/net/minecraft/world/level/block/entity/SmokerBlockEntity.java index 45e61820..8fa785e3 100644 --- a/net/minecraft/world/level/block/entity/SmokerBlockEntity.java +++ b/net/minecraft/world/level/block/entity/SmokerBlockEntity.java @@ -20,8 +20,8 @@ public class SmokerBlockEntity extends AbstractFurnaceBlockEntity { } @Override - protected int getBurnDuration(ItemStack fuel) { - return super.getBurnDuration(fuel) / 2; + protected int getBurnDuration(FuelValues fuelValues, ItemStack itemStack) { + return super.getBurnDuration(fuelValues, itemStack) / 2; } @Override diff --git a/net/minecraft/world/level/block/entity/StructureBlockEntity.java b/net/minecraft/world/level/block/entity/StructureBlockEntity.java index 56e583b7..964d94bc 100644 --- a/net/minecraft/world/level/block/entity/StructureBlockEntity.java +++ b/net/minecraft/world/level/block/entity/StructureBlockEntity.java @@ -260,8 +260,8 @@ public class StructureBlockEntity extends BlockEntity { } else { BlockPos blockPos = this.getBlockPos(); int i = 80; - BlockPos blockPos2 = new BlockPos(blockPos.getX() - 80, this.level.getMinBuildHeight(), blockPos.getZ() - 80); - BlockPos blockPos3 = new BlockPos(blockPos.getX() + 80, this.level.getMaxBuildHeight() - 1, blockPos.getZ() + 80); + BlockPos blockPos2 = new BlockPos(blockPos.getX() - 80, this.level.getMinY(), blockPos.getZ() - 80); + BlockPos blockPos3 = new BlockPos(blockPos.getX() + 80, this.level.getMaxY(), blockPos.getZ() + 80); Stream stream = this.getRelatedCorners(blockPos2, blockPos3); return calculateEnclosingBoundingBox(blockPos, stream) .filter( diff --git a/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java b/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java index 7eb9aa62..692a96af 100644 --- a/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java +++ b/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java @@ -161,8 +161,8 @@ public class TheEndGatewayBlockEntity extends TheEndPortalBlockEntity { BlockPos blockPos2 = BlockPos.containing(vec3.x + 0.5, 75.0, vec3.z + 0.5); LOGGER.debug("Failed to find a suitable block to teleport to, spawning an island on {}", blockPos2); level.registryAccess() - .registry(Registries.CONFIGURED_FEATURE) - .flatMap(registry -> registry.getHolder(EndFeatures.END_ISLAND)) + .lookup(Registries.CONFIGURED_FEATURE) + .flatMap(registry -> registry.get(EndFeatures.END_ISLAND)) .ifPresent( reference -> ((ConfiguredFeature)reference.value()) .place(level, level.getChunkSource().getGenerator(), RandomSource.create(blockPos2.asLong()), blockPos2) @@ -202,7 +202,7 @@ public class TheEndGatewayBlockEntity extends TheEndPortalBlockEntity { for (int i = -radius; i <= radius; i++) { for (int j = -radius; j <= radius; j++) { if (i != 0 || j != 0 || allowBedrock) { - for (int k = level.getMaxBuildHeight() - 1; k > (blockPos == null ? level.getMinBuildHeight() : blockPos.getY()); k--) { + for (int k = level.getMaxY(); k > (blockPos == null ? level.getMinY() : blockPos.getY()); k--) { BlockPos blockPos2 = new BlockPos(pos.getX() + i, k, pos.getZ() + j); BlockState blockState = level.getBlockState(blockPos2); if (blockState.isCollisionShapeFullBlock(level, blockPos2) && (allowBedrock || !blockState.is(Blocks.BEDROCK))) { @@ -254,7 +254,7 @@ public class TheEndGatewayBlockEntity extends TheEndPortalBlockEntity { @Override public boolean shouldRenderFace(Direction face) { - return Block.shouldRenderFace(this.getBlockState(), this.level, this.getBlockPos(), face, this.getBlockPos().relative(face)); + return Block.shouldRenderFace(this.getBlockState(), this.level.getBlockState(this.getBlockPos().relative(face)), face); } public int getParticleAmount() { diff --git a/net/minecraft/world/level/block/entity/TrappedChestBlockEntity.java b/net/minecraft/world/level/block/entity/TrappedChestBlockEntity.java index 8591c81c..a7a70609 100644 --- a/net/minecraft/world/level/block/entity/TrappedChestBlockEntity.java +++ b/net/minecraft/world/level/block/entity/TrappedChestBlockEntity.java @@ -1,9 +1,13 @@ package net.minecraft.world.level.block.entity; import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.TrappedChestBlock; import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.redstone.ExperimentalRedstoneUtils; +import net.minecraft.world.level.redstone.Orientation; public class TrappedChestBlockEntity extends ChestBlockEntity { public TrappedChestBlockEntity(BlockPos blockPos, BlockState blockState) { @@ -14,9 +18,12 @@ public class TrappedChestBlockEntity extends ChestBlockEntity { protected void signalOpenCount(Level level, BlockPos pos, BlockState state, int eventId, int eventParam) { super.signalOpenCount(level, pos, state, eventId, eventParam); if (eventId != eventParam) { + Orientation orientation = ExperimentalRedstoneUtils.initialOrientation( + level, ((Direction)state.getValue(TrappedChestBlock.FACING)).getOpposite(), Direction.UP + ); Block block = state.getBlock(); - level.updateNeighborsAt(pos, block); - level.updateNeighborsAt(pos.below(), block); + level.updateNeighborsAt(pos, block, orientation); + level.updateNeighborsAt(pos.below(), block, orientation); } } } diff --git a/net/minecraft/world/level/block/entity/TrialSpawnerBlockEntity.java b/net/minecraft/world/level/block/entity/TrialSpawnerBlockEntity.java index f063775f..12706249 100644 --- a/net/minecraft/world/level/block/entity/TrialSpawnerBlockEntity.java +++ b/net/minecraft/world/level/block/entity/TrialSpawnerBlockEntity.java @@ -14,6 +14,7 @@ import net.minecraft.world.level.block.TrialSpawnerBlock; import net.minecraft.world.level.block.entity.trialspawner.PlayerDetector; import net.minecraft.world.level.block.entity.trialspawner.TrialSpawner; import net.minecraft.world.level.block.entity.trialspawner.TrialSpawnerState; +import net.minecraft.world.level.block.entity.trialspawner.PlayerDetector.EntitySelector; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.properties.BlockStateProperties; import org.slf4j.Logger; @@ -25,19 +26,18 @@ public class TrialSpawnerBlockEntity extends BlockEntity implements Spawner, Tri public TrialSpawnerBlockEntity(BlockPos pos, BlockState state) { super(BlockEntityType.TRIAL_SPAWNER, pos, state); PlayerDetector playerDetector = PlayerDetector.NO_CREATIVE_PLAYERS; - PlayerDetector.EntitySelector entitySelector = PlayerDetector.EntitySelector.SELECT_FROM_LEVEL; + EntitySelector entitySelector = EntitySelector.SELECT_FROM_LEVEL; this.trialSpawner = new TrialSpawner(this, playerDetector, entitySelector); } @Override protected void loadAdditional(CompoundTag tag, HolderLookup.Provider registries) { super.loadAdditional(tag, registries); - if (tag.contains("normal_config")) { - CompoundTag compoundTag = tag.getCompound("normal_config").copy(); - tag.put("ominous_config", compoundTag.merge(tag.getCompound("ominous_config"))); - } - - this.trialSpawner.codec().parse(NbtOps.INSTANCE, tag).resultOrPartial(LOGGER::error).ifPresent(trialSpawner -> this.trialSpawner = trialSpawner); + this.trialSpawner + .codec() + .parse(registries.createSerializationContext(NbtOps.INSTANCE), tag) + .resultOrPartial(LOGGER::error) + .ifPresent(trialSpawner -> this.trialSpawner = trialSpawner); if (this.level != null) { this.markUpdated(); } @@ -48,7 +48,7 @@ public class TrialSpawnerBlockEntity extends BlockEntity implements Spawner, Tri super.saveAdditional(tag, registries); this.trialSpawner .codec() - .encodeStart(NbtOps.INSTANCE, this.trialSpawner) + .encodeStart(registries.createSerializationContext(NbtOps.INSTANCE), this.trialSpawner) .ifSuccess(tagx -> tag.merge((CompoundTag)tagx)) .ifError(error -> LOGGER.warn("Failed to encode TrialSpawner {}", error.message())); } diff --git a/net/minecraft/world/level/block/entity/trialspawner/TrialSpawner.java b/net/minecraft/world/level/block/entity/trialspawner/TrialSpawner.java index 78eb15d9..4af43839 100644 --- a/net/minecraft/world/level/block/entity/trialspawner/TrialSpawner.java +++ b/net/minecraft/world/level/block/entity/trialspawner/TrialSpawner.java @@ -8,6 +8,7 @@ import java.util.Optional; import java.util.UUID; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; +import net.minecraft.core.Holder; import net.minecraft.core.dispenser.DefaultDispenseItemBehavior; import net.minecraft.core.particles.ParticleOptions; import net.minecraft.core.particles.ParticleTypes; @@ -23,23 +24,27 @@ import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; import net.minecraft.world.Difficulty; import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.Mob; -import net.minecraft.world.entity.MobSpawnType; import net.minecraft.world.entity.SpawnPlacements; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.ClipContext; import net.minecraft.world.level.GameRules; import net.minecraft.world.level.Level; import net.minecraft.world.level.SpawnData; +import net.minecraft.world.level.ClipContext.Block; +import net.minecraft.world.level.ClipContext.Fluid; +import net.minecraft.world.level.SpawnData.CustomSpawnRules; import net.minecraft.world.level.block.TrialSpawnerBlock; +import net.minecraft.world.level.block.entity.trialspawner.PlayerDetector.EntitySelector; import net.minecraft.world.level.gameevent.GameEvent; import net.minecraft.world.level.storage.loot.LootParams; import net.minecraft.world.level.storage.loot.LootTable; import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets; import net.minecraft.world.phys.BlockHitResult; -import net.minecraft.world.phys.HitResult; import net.minecraft.world.phys.Vec3; +import net.minecraft.world.phys.HitResult.Type; import net.minecraft.world.phys.shapes.CollisionContext; public final class TrialSpawner { @@ -51,75 +56,82 @@ public final class TrialSpawner { private static final int MAX_MOB_TRACKING_DISTANCE = 47; private static final int MAX_MOB_TRACKING_DISTANCE_SQR = Mth.square(47); private static final float SPAWNING_AMBIENT_SOUND_CHANCE = 0.02F; - private final TrialSpawnerConfig normalConfig; - private final TrialSpawnerConfig ominousConfig; + private final Holder normalConfig; + private final Holder ominousConfig; private final TrialSpawnerData data; private final int requiredPlayerRange; private final int targetCooldownLength; private final TrialSpawner.StateAccessor stateAccessor; private PlayerDetector playerDetector; - private final PlayerDetector.EntitySelector entitySelector; + private final EntitySelector entitySelector; private boolean overridePeacefulAndMobSpawnRule; private boolean isOminous; public Codec codec() { return RecordCodecBuilder.create( instance -> instance.group( - TrialSpawnerConfig.CODEC.optionalFieldOf("normal_config", TrialSpawnerConfig.DEFAULT).forGetter(TrialSpawner::getNormalConfig), - TrialSpawnerConfig.CODEC.optionalFieldOf("ominous_config", TrialSpawnerConfig.DEFAULT).forGetter(TrialSpawner::getOminousConfigForSerialization), + TrialSpawnerConfig.CODEC.optionalFieldOf("normal_config", Holder.direct(TrialSpawnerConfig.DEFAULT)).forGetter(trialSpawner -> trialSpawner.normalConfig), + TrialSpawnerConfig.CODEC + .optionalFieldOf("ominous_config", Holder.direct(TrialSpawnerConfig.DEFAULT)) + .forGetter(trialSpawner -> trialSpawner.ominousConfig), TrialSpawnerData.MAP_CODEC.forGetter(TrialSpawner::getData), Codec.intRange(0, Integer.MAX_VALUE).optionalFieldOf("target_cooldown_length", 36000).forGetter(TrialSpawner::getTargetCooldownLength), Codec.intRange(1, 128).optionalFieldOf("required_player_range", 14).forGetter(TrialSpawner::getRequiredPlayerRange) ) .apply( instance, - (trialSpawnerConfig, trialSpawnerConfig2, trialSpawnerData, integer, integer2) -> new TrialSpawner( - trialSpawnerConfig, trialSpawnerConfig2, trialSpawnerData, integer, integer2, this.stateAccessor, this.playerDetector, this.entitySelector + (holder, holder2, trialSpawnerData, integer, integer2) -> new TrialSpawner( + holder, holder2, trialSpawnerData, integer, integer2, this.stateAccessor, this.playerDetector, this.entitySelector ) ) ); } - public TrialSpawner(TrialSpawner.StateAccessor stateAccessor, PlayerDetector playerDetector, PlayerDetector.EntitySelector entitySelector) { - this(TrialSpawnerConfig.DEFAULT, TrialSpawnerConfig.DEFAULT, new TrialSpawnerData(), 36000, 14, stateAccessor, playerDetector, entitySelector); + public TrialSpawner(TrialSpawner.StateAccessor stateAccessor, PlayerDetector playerDetector, EntitySelector entitySelector) { + this( + Holder.direct(TrialSpawnerConfig.DEFAULT), + Holder.direct(TrialSpawnerConfig.DEFAULT), + new TrialSpawnerData(), + 36000, + 14, + stateAccessor, + playerDetector, + entitySelector + ); } public TrialSpawner( - TrialSpawnerConfig normalConfig, - TrialSpawnerConfig ominousConfig, - TrialSpawnerData data, - int targetCooldownLength, - int requiredPlayerRange, + Holder holder, + Holder holder2, + TrialSpawnerData trialSpawnerData, + int i, + int j, TrialSpawner.StateAccessor stateAccessor, PlayerDetector playerDetector, - PlayerDetector.EntitySelector entitySelector + EntitySelector entitySelector ) { - this.normalConfig = normalConfig; - this.ominousConfig = ominousConfig; - this.data = data; - this.targetCooldownLength = targetCooldownLength; - this.requiredPlayerRange = requiredPlayerRange; + this.normalConfig = holder; + this.ominousConfig = holder2; + this.data = trialSpawnerData; + this.targetCooldownLength = i; + this.requiredPlayerRange = j; this.stateAccessor = stateAccessor; this.playerDetector = playerDetector; this.entitySelector = entitySelector; } public TrialSpawnerConfig getConfig() { - return this.isOminous ? this.ominousConfig : this.normalConfig; + return this.isOminous ? this.getOminousConfig() : this.getNormalConfig(); } @VisibleForTesting public TrialSpawnerConfig getNormalConfig() { - return this.normalConfig; + return this.normalConfig.value(); } @VisibleForTesting public TrialSpawnerConfig getOminousConfig() { - return this.ominousConfig; - } - - private TrialSpawnerConfig getOminousConfigForSerialization() { - return !this.ominousConfig.equals(this.normalConfig) ? this.ominousConfig : TrialSpawnerConfig.DEFAULT; + return this.ominousConfig.value(); } public void applyOminous(ServerLevel level, BlockPos pos) { @@ -166,15 +178,15 @@ public final class TrialSpawner { return this.playerDetector; } - public PlayerDetector.EntitySelector getEntitySelector() { + public EntitySelector getEntitySelector() { return this.entitySelector; } - public boolean canSpawnInLevel(Level level) { + public boolean canSpawnInLevel(ServerLevel serverLevel) { if (this.overridePeacefulAndMobSpawnRule) { return true; } else { - return level.getDifficulty() == Difficulty.PEACEFUL ? false : level.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING); + return serverLevel.getDifficulty() == Difficulty.PEACEFUL ? false : serverLevel.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING); } } @@ -199,17 +211,17 @@ public final class TrialSpawner { return Optional.empty(); } else { BlockPos blockPos = BlockPos.containing(vec3); - if (!SpawnPlacements.checkSpawnRules((EntityType)optional.get(), level, MobSpawnType.TRIAL_SPAWNER, blockPos, level.getRandom())) { + if (!SpawnPlacements.checkSpawnRules((EntityType)optional.get(), level, EntitySpawnReason.TRIAL_SPAWNER, blockPos, level.getRandom())) { return Optional.empty(); } else { if (spawnData.getCustomSpawnRules().isPresent()) { - SpawnData.CustomSpawnRules customSpawnRules = (SpawnData.CustomSpawnRules)spawnData.getCustomSpawnRules().get(); + CustomSpawnRules customSpawnRules = (CustomSpawnRules)spawnData.getCustomSpawnRules().get(); if (!customSpawnRules.isValidPosition(blockPos, level)) { return Optional.empty(); } } - Entity entity = EntityType.loadEntityRecursive(compoundTag, level, entityx -> { + Entity entity = EntityType.loadEntityRecursive(compoundTag, level, EntitySpawnReason.TRIAL_SPAWNER, entityx -> { entityx.moveTo(d, e, f, randomSource.nextFloat() * 360.0F, 0.0F); return entityx; }); @@ -223,7 +235,7 @@ public final class TrialSpawner { boolean bl = spawnData.getEntityToSpawn().size() == 1 && spawnData.getEntityToSpawn().contains("id", 8); if (bl) { - mob.finalizeSpawn(level, level.getCurrentDifficultyAt(mob.blockPosition()), MobSpawnType.TRIAL_SPAWNER, null); + mob.finalizeSpawn(level, level.getCurrentDifficultyAt(mob.blockPosition()), EntitySpawnReason.TRIAL_SPAWNER, null); } mob.setPersistenceRequired(); @@ -299,8 +311,8 @@ public final class TrialSpawner { } private static boolean inLineOfSight(Level level, Vec3 spawnerPos, Vec3 mobPos) { - BlockHitResult blockHitResult = level.clip(new ClipContext(mobPos, spawnerPos, ClipContext.Block.VISUAL, ClipContext.Fluid.NONE, CollisionContext.empty())); - return blockHitResult.getBlockPos().equals(BlockPos.containing(spawnerPos)) || blockHitResult.getType() == HitResult.Type.MISS; + BlockHitResult blockHitResult = level.clip(new ClipContext(mobPos, spawnerPos, Block.VISUAL, Fluid.NONE, CollisionContext.empty())); + return blockHitResult.getBlockPos().equals(BlockPos.containing(spawnerPos)) || blockHitResult.getType() == Type.MISS; } public static void addSpawnParticles(Level level, BlockPos pos, RandomSource random, SimpleParticleType particleType) { diff --git a/net/minecraft/world/level/block/entity/trialspawner/TrialSpawnerConfig.java b/net/minecraft/world/level/block/entity/trialspawner/TrialSpawnerConfig.java index c55ccef7..4773bba6 100644 --- a/net/minecraft/world/level/block/entity/trialspawner/TrialSpawnerConfig.java +++ b/net/minecraft/world/level/block/entity/trialspawner/TrialSpawnerConfig.java @@ -2,7 +2,9 @@ package net.minecraft.world.level.block.entity.trialspawner; import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; +import net.minecraft.core.Holder; import net.minecraft.core.registries.Registries; +import net.minecraft.resources.RegistryFileCodec; import net.minecraft.resources.ResourceKey; import net.minecraft.util.random.SimpleWeightedRandomList; import net.minecraft.world.level.SpawnData; @@ -20,46 +22,30 @@ public record TrialSpawnerConfig( SimpleWeightedRandomList> lootTablesToEject, ResourceKey itemsToDropWhenOminous ) { - public static final TrialSpawnerConfig DEFAULT = new TrialSpawnerConfig( - 4, - 6.0F, - 2.0F, - 2.0F, - 1.0F, - 40, - SimpleWeightedRandomList.empty(), - SimpleWeightedRandomList.>builder() - .add(BuiltInLootTables.SPAWNER_TRIAL_CHAMBER_CONSUMABLES) - .add(BuiltInLootTables.SPAWNER_TRIAL_CHAMBER_KEY) - .build(), - BuiltInLootTables.SPAWNER_TRIAL_ITEMS_TO_DROP_WHEN_OMINOUS - ); - public static final Codec CODEC = RecordCodecBuilder.create( + public static final TrialSpawnerConfig DEFAULT = builder().build(); + public static final Codec DIRECT_CODEC = RecordCodecBuilder.create( instance -> instance.group( - Codec.intRange(1, 128).lenientOptionalFieldOf("spawn_range", DEFAULT.spawnRange).forGetter(TrialSpawnerConfig::spawnRange), - Codec.floatRange(0.0F, Float.MAX_VALUE).lenientOptionalFieldOf("total_mobs", DEFAULT.totalMobs).forGetter(TrialSpawnerConfig::totalMobs), + Codec.intRange(1, 128).optionalFieldOf("spawn_range", DEFAULT.spawnRange).forGetter(TrialSpawnerConfig::spawnRange), + Codec.floatRange(0.0F, Float.MAX_VALUE).optionalFieldOf("total_mobs", DEFAULT.totalMobs).forGetter(TrialSpawnerConfig::totalMobs), + Codec.floatRange(0.0F, Float.MAX_VALUE).optionalFieldOf("simultaneous_mobs", DEFAULT.simultaneousMobs).forGetter(TrialSpawnerConfig::simultaneousMobs), Codec.floatRange(0.0F, Float.MAX_VALUE) - .lenientOptionalFieldOf("simultaneous_mobs", DEFAULT.simultaneousMobs) - .forGetter(TrialSpawnerConfig::simultaneousMobs), - Codec.floatRange(0.0F, Float.MAX_VALUE) - .lenientOptionalFieldOf("total_mobs_added_per_player", DEFAULT.totalMobsAddedPerPlayer) + .optionalFieldOf("total_mobs_added_per_player", DEFAULT.totalMobsAddedPerPlayer) .forGetter(TrialSpawnerConfig::totalMobsAddedPerPlayer), Codec.floatRange(0.0F, Float.MAX_VALUE) - .lenientOptionalFieldOf("simultaneous_mobs_added_per_player", DEFAULT.simultaneousMobsAddedPerPlayer) + .optionalFieldOf("simultaneous_mobs_added_per_player", DEFAULT.simultaneousMobsAddedPerPlayer) .forGetter(TrialSpawnerConfig::simultaneousMobsAddedPerPlayer), - Codec.intRange(0, Integer.MAX_VALUE) - .lenientOptionalFieldOf("ticks_between_spawn", DEFAULT.ticksBetweenSpawn) - .forGetter(TrialSpawnerConfig::ticksBetweenSpawn), - SpawnData.LIST_CODEC.lenientOptionalFieldOf("spawn_potentials", SimpleWeightedRandomList.empty()).forGetter(TrialSpawnerConfig::spawnPotentialsDefinition), + Codec.intRange(0, Integer.MAX_VALUE).optionalFieldOf("ticks_between_spawn", DEFAULT.ticksBetweenSpawn).forGetter(TrialSpawnerConfig::ticksBetweenSpawn), + SpawnData.LIST_CODEC.optionalFieldOf("spawn_potentials", SimpleWeightedRandomList.empty()).forGetter(TrialSpawnerConfig::spawnPotentialsDefinition), SimpleWeightedRandomList.wrappedCodecAllowingEmpty(ResourceKey.codec(Registries.LOOT_TABLE)) - .lenientOptionalFieldOf("loot_tables_to_eject", DEFAULT.lootTablesToEject) + .optionalFieldOf("loot_tables_to_eject", DEFAULT.lootTablesToEject) .forGetter(TrialSpawnerConfig::lootTablesToEject), ResourceKey.codec(Registries.LOOT_TABLE) - .lenientOptionalFieldOf("items_to_drop_when_ominous", DEFAULT.itemsToDropWhenOminous) + .optionalFieldOf("items_to_drop_when_ominous", DEFAULT.itemsToDropWhenOminous) .forGetter(TrialSpawnerConfig::itemsToDropWhenOminous) ) .apply(instance, TrialSpawnerConfig::new) ); + public static final Codec> CODEC = RegistryFileCodec.create(Registries.TRIAL_SPAWNER_CONFIG, DIRECT_CODEC); public int calculateTargetTotalMobs(int players) { return (int)Math.floor(this.totalMobs + this.totalMobsAddedPerPlayer * players); @@ -72,4 +58,82 @@ public record TrialSpawnerConfig( public long ticksBetweenItemSpawners() { return 160L; } + + public static TrialSpawnerConfig.Builder builder() { + return new TrialSpawnerConfig.Builder(); + } + + public static class Builder { + private int spawnRange = 4; + private float totalMobs = 6.0F; + private float simultaneousMobs = 2.0F; + private float totalMobsAddedPerPlayer = 2.0F; + private float simultaneousMobsAddedPerPlayer = 1.0F; + private int ticksBetweenSpawn = 40; + private SimpleWeightedRandomList spawnPotentialsDefinition = SimpleWeightedRandomList.empty(); + private SimpleWeightedRandomList> lootTablesToEject = SimpleWeightedRandomList.>builder() + .add(BuiltInLootTables.SPAWNER_TRIAL_CHAMBER_CONSUMABLES) + .add(BuiltInLootTables.SPAWNER_TRIAL_CHAMBER_KEY) + .build(); + private ResourceKey itemsToDropWhenOminous = BuiltInLootTables.SPAWNER_TRIAL_ITEMS_TO_DROP_WHEN_OMINOUS; + + public TrialSpawnerConfig.Builder spawnRange(int i) { + this.spawnRange = i; + return this; + } + + public TrialSpawnerConfig.Builder totalMobs(float f) { + this.totalMobs = f; + return this; + } + + public TrialSpawnerConfig.Builder simultaneousMobs(float f) { + this.simultaneousMobs = f; + return this; + } + + public TrialSpawnerConfig.Builder totalMobsAddedPerPlayer(float f) { + this.totalMobsAddedPerPlayer = f; + return this; + } + + public TrialSpawnerConfig.Builder simultaneousMobsAddedPerPlayer(float f) { + this.simultaneousMobsAddedPerPlayer = f; + return this; + } + + public TrialSpawnerConfig.Builder ticksBetweenSpawn(int i) { + this.ticksBetweenSpawn = i; + return this; + } + + public TrialSpawnerConfig.Builder spawnPotentialsDefinition(SimpleWeightedRandomList simpleWeightedRandomList) { + this.spawnPotentialsDefinition = simpleWeightedRandomList; + return this; + } + + public TrialSpawnerConfig.Builder lootTablesToEject(SimpleWeightedRandomList> simpleWeightedRandomList) { + this.lootTablesToEject = simpleWeightedRandomList; + return this; + } + + public TrialSpawnerConfig.Builder itemsToDropWhenOminous(ResourceKey resourceKey) { + this.itemsToDropWhenOminous = resourceKey; + return this; + } + + public TrialSpawnerConfig build() { + return new TrialSpawnerConfig( + this.spawnRange, + this.totalMobs, + this.simultaneousMobs, + this.totalMobsAddedPerPlayer, + this.simultaneousMobsAddedPerPlayer, + this.ticksBetweenSpawn, + this.spawnPotentialsDefinition, + this.lootTablesToEject, + this.itemsToDropWhenOminous + ); + } + } } diff --git a/net/minecraft/world/level/block/entity/trialspawner/TrialSpawnerConfigs.java b/net/minecraft/world/level/block/entity/trialspawner/TrialSpawnerConfigs.java new file mode 100644 index 00000000..9af9eb4c --- /dev/null +++ b/net/minecraft/world/level/block/entity/trialspawner/TrialSpawnerConfigs.java @@ -0,0 +1,326 @@ +package net.minecraft.world.level.block.entity.trialspawner; + +import java.util.Optional; +import java.util.function.Consumer; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.core.registries.Registries; +import net.minecraft.data.worldgen.BootstrapContext; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.resources.ResourceKey; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.random.SimpleWeightedRandomList; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.EquipmentTable; +import net.minecraft.world.level.SpawnData; +import net.minecraft.world.level.storage.loot.BuiltInLootTables; +import net.minecraft.world.level.storage.loot.LootTable; +import org.jetbrains.annotations.Nullable; + +public class TrialSpawnerConfigs { + private static final TrialSpawnerConfigs.Keys TRIAL_CHAMBER_BREEZE = TrialSpawnerConfigs.Keys.of("trial_chamber/breeze"); + private static final TrialSpawnerConfigs.Keys TRIAL_CHAMBER_MELEE_HUSK = TrialSpawnerConfigs.Keys.of("trial_chamber/melee/husk"); + private static final TrialSpawnerConfigs.Keys TRIAL_CHAMBER_MELEE_SPIDER = TrialSpawnerConfigs.Keys.of("trial_chamber/melee/spider"); + private static final TrialSpawnerConfigs.Keys TRIAL_CHAMBER_MELEE_ZOMBIE = TrialSpawnerConfigs.Keys.of("trial_chamber/melee/zombie"); + private static final TrialSpawnerConfigs.Keys TRIAL_CHAMBER_RANGED_POISON_SKELETON = TrialSpawnerConfigs.Keys.of("trial_chamber/ranged/poison_skeleton"); + private static final TrialSpawnerConfigs.Keys TRIAL_CHAMBER_RANGED_SKELETON = TrialSpawnerConfigs.Keys.of("trial_chamber/ranged/skeleton"); + private static final TrialSpawnerConfigs.Keys TRIAL_CHAMBER_RANGED_STRAY = TrialSpawnerConfigs.Keys.of("trial_chamber/ranged/stray"); + private static final TrialSpawnerConfigs.Keys TRIAL_CHAMBER_SLOW_RANGED_POISON_SKELETON = TrialSpawnerConfigs.Keys.of( + "trial_chamber/slow_ranged/poison_skeleton" + ); + private static final TrialSpawnerConfigs.Keys TRIAL_CHAMBER_SLOW_RANGED_SKELETON = TrialSpawnerConfigs.Keys.of("trial_chamber/slow_ranged/skeleton"); + private static final TrialSpawnerConfigs.Keys TRIAL_CHAMBER_SLOW_RANGED_STRAY = TrialSpawnerConfigs.Keys.of("trial_chamber/slow_ranged/stray"); + private static final TrialSpawnerConfigs.Keys TRIAL_CHAMBER_SMALL_MELEE_BABY_ZOMBIE = TrialSpawnerConfigs.Keys.of("trial_chamber/small_melee/baby_zombie"); + private static final TrialSpawnerConfigs.Keys TRIAL_CHAMBER_SMALL_MELEE_CAVE_SPIDER = TrialSpawnerConfigs.Keys.of("trial_chamber/small_melee/cave_spider"); + private static final TrialSpawnerConfigs.Keys TRIAL_CHAMBER_SMALL_MELEE_SILVERFISH = TrialSpawnerConfigs.Keys.of("trial_chamber/small_melee/silverfish"); + private static final TrialSpawnerConfigs.Keys TRIAL_CHAMBER_SMALL_MELEE_SLIME = TrialSpawnerConfigs.Keys.of("trial_chamber/small_melee/slime"); + + public static void bootstrap(BootstrapContext bootstrapContext) { + register( + bootstrapContext, + TRIAL_CHAMBER_BREEZE, + TrialSpawnerConfig.builder() + .simultaneousMobs(1.0F) + .simultaneousMobsAddedPerPlayer(0.5F) + .ticksBetweenSpawn(20) + .totalMobs(2.0F) + .totalMobsAddedPerPlayer(1.0F) + .spawnPotentialsDefinition(SimpleWeightedRandomList.single(spawnData(EntityType.BREEZE))) + .build(), + TrialSpawnerConfig.builder() + .simultaneousMobsAddedPerPlayer(0.5F) + .ticksBetweenSpawn(20) + .totalMobs(4.0F) + .totalMobsAddedPerPlayer(1.0F) + .spawnPotentialsDefinition(SimpleWeightedRandomList.single(spawnData(EntityType.BREEZE))) + .lootTablesToEject( + SimpleWeightedRandomList.>builder() + .add(BuiltInLootTables.SPAWNER_OMINOUS_TRIAL_CHAMBER_KEY, 3) + .add(BuiltInLootTables.SPAWNER_OMINOUS_TRIAL_CHAMBER_CONSUMABLES, 7) + .build() + ) + .build() + ); + register( + bootstrapContext, + TRIAL_CHAMBER_MELEE_HUSK, + trialChamberBase().spawnPotentialsDefinition(SimpleWeightedRandomList.single(spawnData(EntityType.HUSK))).build(), + trialChamberBase() + .spawnPotentialsDefinition(SimpleWeightedRandomList.single(spawnDataWithEquipment(EntityType.HUSK, BuiltInLootTables.EQUIPMENT_TRIAL_CHAMBER_MELEE))) + .lootTablesToEject( + SimpleWeightedRandomList.>builder() + .add(BuiltInLootTables.SPAWNER_OMINOUS_TRIAL_CHAMBER_KEY, 3) + .add(BuiltInLootTables.SPAWNER_OMINOUS_TRIAL_CHAMBER_CONSUMABLES, 7) + .build() + ) + .build() + ); + register( + bootstrapContext, + TRIAL_CHAMBER_MELEE_SPIDER, + trialChamberBase().spawnPotentialsDefinition(SimpleWeightedRandomList.single(spawnData(EntityType.SPIDER))).build(), + trialChamberMeleeOminous() + .spawnPotentialsDefinition(SimpleWeightedRandomList.single(spawnData(EntityType.SPIDER))) + .lootTablesToEject( + SimpleWeightedRandomList.>builder() + .add(BuiltInLootTables.SPAWNER_OMINOUS_TRIAL_CHAMBER_KEY, 3) + .add(BuiltInLootTables.SPAWNER_OMINOUS_TRIAL_CHAMBER_CONSUMABLES, 7) + .build() + ) + .build() + ); + register( + bootstrapContext, + TRIAL_CHAMBER_MELEE_ZOMBIE, + trialChamberBase().spawnPotentialsDefinition(SimpleWeightedRandomList.single(spawnData(EntityType.ZOMBIE))).build(), + trialChamberBase() + .lootTablesToEject( + SimpleWeightedRandomList.>builder() + .add(BuiltInLootTables.SPAWNER_OMINOUS_TRIAL_CHAMBER_KEY, 3) + .add(BuiltInLootTables.SPAWNER_OMINOUS_TRIAL_CHAMBER_CONSUMABLES, 7) + .build() + ) + .spawnPotentialsDefinition(SimpleWeightedRandomList.single(spawnDataWithEquipment(EntityType.ZOMBIE, BuiltInLootTables.EQUIPMENT_TRIAL_CHAMBER_MELEE))) + .build() + ); + register( + bootstrapContext, + TRIAL_CHAMBER_RANGED_POISON_SKELETON, + trialChamberBase().spawnPotentialsDefinition(SimpleWeightedRandomList.single(spawnData(EntityType.BOGGED))).build(), + trialChamberBase() + .lootTablesToEject( + SimpleWeightedRandomList.>builder() + .add(BuiltInLootTables.SPAWNER_OMINOUS_TRIAL_CHAMBER_KEY, 3) + .add(BuiltInLootTables.SPAWNER_OMINOUS_TRIAL_CHAMBER_CONSUMABLES, 7) + .build() + ) + .spawnPotentialsDefinition(SimpleWeightedRandomList.single(spawnDataWithEquipment(EntityType.BOGGED, BuiltInLootTables.EQUIPMENT_TRIAL_CHAMBER_RANGED))) + .build() + ); + register( + bootstrapContext, + TRIAL_CHAMBER_RANGED_SKELETON, + trialChamberBase().spawnPotentialsDefinition(SimpleWeightedRandomList.single(spawnData(EntityType.SKELETON))).build(), + trialChamberBase() + .lootTablesToEject( + SimpleWeightedRandomList.>builder() + .add(BuiltInLootTables.SPAWNER_OMINOUS_TRIAL_CHAMBER_KEY, 3) + .add(BuiltInLootTables.SPAWNER_OMINOUS_TRIAL_CHAMBER_CONSUMABLES, 7) + .build() + ) + .spawnPotentialsDefinition(SimpleWeightedRandomList.single(spawnDataWithEquipment(EntityType.SKELETON, BuiltInLootTables.EQUIPMENT_TRIAL_CHAMBER_RANGED))) + .build() + ); + register( + bootstrapContext, + TRIAL_CHAMBER_RANGED_STRAY, + trialChamberBase().spawnPotentialsDefinition(SimpleWeightedRandomList.single(spawnData(EntityType.STRAY))).build(), + trialChamberBase() + .lootTablesToEject( + SimpleWeightedRandomList.>builder() + .add(BuiltInLootTables.SPAWNER_OMINOUS_TRIAL_CHAMBER_KEY, 3) + .add(BuiltInLootTables.SPAWNER_OMINOUS_TRIAL_CHAMBER_CONSUMABLES, 7) + .build() + ) + .spawnPotentialsDefinition(SimpleWeightedRandomList.single(spawnDataWithEquipment(EntityType.STRAY, BuiltInLootTables.EQUIPMENT_TRIAL_CHAMBER_RANGED))) + .build() + ); + register( + bootstrapContext, + TRIAL_CHAMBER_SLOW_RANGED_POISON_SKELETON, + trialChamberSlowRanged().spawnPotentialsDefinition(SimpleWeightedRandomList.single(spawnData(EntityType.BOGGED))).build(), + trialChamberSlowRanged() + .lootTablesToEject( + SimpleWeightedRandomList.>builder() + .add(BuiltInLootTables.SPAWNER_OMINOUS_TRIAL_CHAMBER_KEY, 3) + .add(BuiltInLootTables.SPAWNER_OMINOUS_TRIAL_CHAMBER_CONSUMABLES, 7) + .build() + ) + .spawnPotentialsDefinition(SimpleWeightedRandomList.single(spawnDataWithEquipment(EntityType.BOGGED, BuiltInLootTables.EQUIPMENT_TRIAL_CHAMBER_RANGED))) + .build() + ); + register( + bootstrapContext, + TRIAL_CHAMBER_SLOW_RANGED_SKELETON, + trialChamberSlowRanged().spawnPotentialsDefinition(SimpleWeightedRandomList.single(spawnData(EntityType.SKELETON))).build(), + trialChamberSlowRanged() + .lootTablesToEject( + SimpleWeightedRandomList.>builder() + .add(BuiltInLootTables.SPAWNER_OMINOUS_TRIAL_CHAMBER_KEY, 3) + .add(BuiltInLootTables.SPAWNER_OMINOUS_TRIAL_CHAMBER_CONSUMABLES, 7) + .build() + ) + .spawnPotentialsDefinition(SimpleWeightedRandomList.single(spawnDataWithEquipment(EntityType.SKELETON, BuiltInLootTables.EQUIPMENT_TRIAL_CHAMBER_RANGED))) + .build() + ); + register( + bootstrapContext, + TRIAL_CHAMBER_SLOW_RANGED_STRAY, + trialChamberSlowRanged().spawnPotentialsDefinition(SimpleWeightedRandomList.single(spawnData(EntityType.STRAY))).build(), + trialChamberSlowRanged() + .lootTablesToEject( + SimpleWeightedRandomList.>builder() + .add(BuiltInLootTables.SPAWNER_OMINOUS_TRIAL_CHAMBER_KEY, 3) + .add(BuiltInLootTables.SPAWNER_OMINOUS_TRIAL_CHAMBER_CONSUMABLES, 7) + .build() + ) + .spawnPotentialsDefinition(SimpleWeightedRandomList.single(spawnDataWithEquipment(EntityType.STRAY, BuiltInLootTables.EQUIPMENT_TRIAL_CHAMBER_RANGED))) + .build() + ); + register( + bootstrapContext, + TRIAL_CHAMBER_SMALL_MELEE_BABY_ZOMBIE, + TrialSpawnerConfig.builder() + .simultaneousMobsAddedPerPlayer(0.5F) + .ticksBetweenSpawn(20) + .spawnPotentialsDefinition( + SimpleWeightedRandomList.single(customSpawnDataWithEquipment(EntityType.ZOMBIE, compoundTag -> compoundTag.putBoolean("IsBaby", true), null)) + ) + .build(), + TrialSpawnerConfig.builder() + .simultaneousMobsAddedPerPlayer(0.5F) + .ticksBetweenSpawn(20) + .lootTablesToEject( + SimpleWeightedRandomList.>builder() + .add(BuiltInLootTables.SPAWNER_OMINOUS_TRIAL_CHAMBER_KEY, 3) + .add(BuiltInLootTables.SPAWNER_OMINOUS_TRIAL_CHAMBER_CONSUMABLES, 7) + .build() + ) + .spawnPotentialsDefinition( + SimpleWeightedRandomList.single( + customSpawnDataWithEquipment(EntityType.ZOMBIE, compoundTag -> compoundTag.putBoolean("IsBaby", true), BuiltInLootTables.EQUIPMENT_TRIAL_CHAMBER_MELEE) + ) + ) + .build() + ); + register( + bootstrapContext, + TRIAL_CHAMBER_SMALL_MELEE_CAVE_SPIDER, + trialChamberBase().spawnPotentialsDefinition(SimpleWeightedRandomList.single(spawnData(EntityType.CAVE_SPIDER))).build(), + trialChamberMeleeOminous() + .lootTablesToEject( + SimpleWeightedRandomList.>builder() + .add(BuiltInLootTables.SPAWNER_OMINOUS_TRIAL_CHAMBER_KEY, 3) + .add(BuiltInLootTables.SPAWNER_OMINOUS_TRIAL_CHAMBER_CONSUMABLES, 7) + .build() + ) + .spawnPotentialsDefinition(SimpleWeightedRandomList.single(spawnData(EntityType.CAVE_SPIDER))) + .build() + ); + register( + bootstrapContext, + TRIAL_CHAMBER_SMALL_MELEE_SILVERFISH, + trialChamberBase().spawnPotentialsDefinition(SimpleWeightedRandomList.single(spawnData(EntityType.SILVERFISH))).build(), + trialChamberMeleeOminous() + .lootTablesToEject( + SimpleWeightedRandomList.>builder() + .add(BuiltInLootTables.SPAWNER_OMINOUS_TRIAL_CHAMBER_KEY, 3) + .add(BuiltInLootTables.SPAWNER_OMINOUS_TRIAL_CHAMBER_CONSUMABLES, 7) + .build() + ) + .spawnPotentialsDefinition(SimpleWeightedRandomList.single(spawnData(EntityType.SILVERFISH))) + .build() + ); + register( + bootstrapContext, + TRIAL_CHAMBER_SMALL_MELEE_SLIME, + trialChamberBase() + .spawnPotentialsDefinition( + SimpleWeightedRandomList.builder() + .add(customSpawnData(EntityType.SLIME, compoundTag -> compoundTag.putByte("Size", (byte)1)), 3) + .add(customSpawnData(EntityType.SLIME, compoundTag -> compoundTag.putByte("Size", (byte)2)), 1) + .build() + ) + .build(), + trialChamberMeleeOminous() + .lootTablesToEject( + SimpleWeightedRandomList.>builder() + .add(BuiltInLootTables.SPAWNER_OMINOUS_TRIAL_CHAMBER_KEY, 3) + .add(BuiltInLootTables.SPAWNER_OMINOUS_TRIAL_CHAMBER_CONSUMABLES, 7) + .build() + ) + .spawnPotentialsDefinition( + SimpleWeightedRandomList.builder() + .add(customSpawnData(EntityType.SLIME, compoundTag -> compoundTag.putByte("Size", (byte)1)), 3) + .add(customSpawnData(EntityType.SLIME, compoundTag -> compoundTag.putByte("Size", (byte)2)), 1) + .build() + ) + .build() + ); + } + + private static SpawnData spawnData(EntityType entityType) { + return customSpawnDataWithEquipment(entityType, compoundTag -> {}, null); + } + + private static SpawnData customSpawnData(EntityType entityType, Consumer consumer) { + return customSpawnDataWithEquipment(entityType, consumer, null); + } + + private static SpawnData spawnDataWithEquipment(EntityType entityType, ResourceKey resourceKey) { + return customSpawnDataWithEquipment(entityType, compoundTag -> {}, resourceKey); + } + + private static SpawnData customSpawnDataWithEquipment( + EntityType entityType, Consumer consumer, @Nullable ResourceKey resourceKey + ) { + CompoundTag compoundTag = new CompoundTag(); + compoundTag.putString("id", BuiltInRegistries.ENTITY_TYPE.getKey(entityType).toString()); + consumer.accept(compoundTag); + Optional optional = Optional.ofNullable(resourceKey).map(resourceKeyx -> new EquipmentTable(resourceKeyx, 0.0F)); + return new SpawnData(compoundTag, Optional.empty(), optional); + } + + private static void register( + BootstrapContext bootstrapContext, + TrialSpawnerConfigs.Keys keys, + TrialSpawnerConfig trialSpawnerConfig, + TrialSpawnerConfig trialSpawnerConfig2 + ) { + bootstrapContext.register(keys.normal, trialSpawnerConfig); + bootstrapContext.register(keys.ominous, trialSpawnerConfig2); + } + + static ResourceKey registryKey(String string) { + return ResourceKey.create(Registries.TRIAL_SPAWNER_CONFIG, ResourceLocation.withDefaultNamespace(string)); + } + + private static TrialSpawnerConfig.Builder trialChamberMeleeOminous() { + return TrialSpawnerConfig.builder().simultaneousMobs(4.0F).simultaneousMobsAddedPerPlayer(0.5F).ticksBetweenSpawn(20).totalMobs(12.0F); + } + + private static TrialSpawnerConfig.Builder trialChamberSlowRanged() { + return TrialSpawnerConfig.builder().simultaneousMobs(4.0F).simultaneousMobsAddedPerPlayer(2.0F).ticksBetweenSpawn(160); + } + + private static TrialSpawnerConfig.Builder trialChamberBase() { + return TrialSpawnerConfig.builder().simultaneousMobs(3.0F).simultaneousMobsAddedPerPlayer(0.5F).ticksBetweenSpawn(20); + } + + record Keys(ResourceKey normal, ResourceKey ominous) { + + public static TrialSpawnerConfigs.Keys of(String string) { + return new TrialSpawnerConfigs.Keys(TrialSpawnerConfigs.registryKey(string + "/normal"), TrialSpawnerConfigs.registryKey(string + "/ominous")); + } + } +} diff --git a/net/minecraft/world/level/block/entity/trialspawner/TrialSpawnerData.java b/net/minecraft/world/level/block/entity/trialspawner/TrialSpawnerData.java index 4562deed..f1d50b81 100644 --- a/net/minecraft/world/level/block/entity/trialspawner/TrialSpawnerData.java +++ b/net/minecraft/world/level/block/entity/trialspawner/TrialSpawnerData.java @@ -27,11 +27,13 @@ import net.minecraft.server.level.ServerLevel; import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; import net.minecraft.util.random.SimpleWeightedRandomList; -import net.minecraft.util.random.WeightedEntry; +import net.minecraft.util.random.SimpleWeightedRandomList.Builder; +import net.minecraft.util.random.WeightedEntry.Wrapper; import net.minecraft.world.effect.MobEffect; import net.minecraft.world.effect.MobEffectInstance; import net.minecraft.world.effect.MobEffects; import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.Mob; import net.minecraft.world.entity.player.Player; @@ -97,12 +99,16 @@ public class TrialSpawnerData { } public void reset() { + this.currentMobs.clear(); + this.nextSpawnData = Optional.empty(); + this.resetStatistics(); + } + + public void resetStatistics() { this.detectedPlayers.clear(); this.totalMobsSpawned = 0; this.nextMobSpawnsAt = 0L; this.cooldownEndsAt = 0L; - this.currentMobs.clear(); - this.nextSpawnData = Optional.empty(); } public boolean hasMobToSpawn(TrialSpawner trialSpawner, RandomSource random) { @@ -192,7 +198,7 @@ public class TrialSpawnerData { if (entity != null) { level.levelEvent(3012, entity.blockPosition(), TrialSpawner.FlameParticle.NORMAL.encode()); if (entity instanceof Mob mob) { - mob.dropPreservedEquipment(); + mob.dropPreservedEquipment(level); } entity.remove(Entity.RemovalReason.DISCARDED); @@ -242,9 +248,7 @@ public class TrialSpawnerData { return (SpawnData)this.nextSpawnData.get(); } else { SimpleWeightedRandomList simpleWeightedRandomList = spawner.getConfig().spawnPotentialsDefinition(); - Optional optional = simpleWeightedRandomList.isEmpty() - ? this.nextSpawnData - : simpleWeightedRandomList.getRandom(random).map(WeightedEntry.Wrapper::data); + Optional optional = simpleWeightedRandomList.isEmpty() ? this.nextSpawnData : simpleWeightedRandomList.getRandom(random).map(Wrapper::data); this.nextSpawnData = Optional.of((SpawnData)optional.orElseGet(SpawnData::new)); spawner.markUpdated(); return (SpawnData)this.nextSpawnData.get(); @@ -259,7 +263,7 @@ public class TrialSpawnerData { if (this.displayEntity == null) { CompoundTag compoundTag = this.getOrCreateNextSpawnData(spawner, level.getRandom()).getEntityToSpawn(); if (compoundTag.contains("id", 8)) { - this.displayEntity = EntityType.loadEntityRecursive(compoundTag, level, Function.identity()); + this.displayEntity = EntityType.loadEntityRecursive(compoundTag, level, EntitySpawnReason.TRIAL_SPAWNER, Function.identity()); } } @@ -301,7 +305,7 @@ public class TrialSpawnerData { if (objectArrayList.isEmpty()) { return SimpleWeightedRandomList.empty(); } else { - SimpleWeightedRandomList.Builder builder = new SimpleWeightedRandomList.Builder<>(); + Builder builder = new Builder<>(); for (ItemStack itemStack : objectArrayList) { builder.add(itemStack.copyWithCount(1), itemStack.getCount()); diff --git a/net/minecraft/world/level/block/entity/trialspawner/TrialSpawnerState.java b/net/minecraft/world/level/block/entity/trialspawner/TrialSpawnerState.java index 717593eb..3ee3f34f 100644 --- a/net/minecraft/world/level/block/entity/trialspawner/TrialSpawnerState.java +++ b/net/minecraft/world/level/block/entity/trialspawner/TrialSpawnerState.java @@ -24,6 +24,8 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.ClipContext; import net.minecraft.world.level.Level; import net.minecraft.world.level.SpawnData; +import net.minecraft.world.level.ClipContext.Block; +import net.minecraft.world.level.ClipContext.Fluid; import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.shapes.CollisionContext; @@ -67,7 +69,7 @@ public enum TrialSpawnerState implements StringRepresentable { case INACTIVE -> trialSpawnerData.getOrCreateDisplayEntity(spawner, level, WAITING_FOR_PLAYERS) == null ? this : WAITING_FOR_PLAYERS; case WAITING_FOR_PLAYERS -> { if (!spawner.canSpawnInLevel(level)) { - trialSpawnerData.reset(); + trialSpawnerData.resetStatistics(); yield this; } else if (!trialSpawnerData.hasMobToSpawn(spawner, level.random)) { yield INACTIVE; @@ -78,7 +80,7 @@ public enum TrialSpawnerState implements StringRepresentable { } case ACTIVE -> { if (!spawner.canSpawnInLevel(level)) { - trialSpawnerData.reset(); + trialSpawnerData.resetStatistics(); yield WAITING_FOR_PLAYERS; } else if (!trialSpawnerData.hasMobToSpawn(spawner, level.random)) { yield INACTIVE; @@ -194,7 +196,7 @@ public enum TrialSpawnerState implements StringRepresentable { private static Optional calculatePositionAbove(Entity entity, ServerLevel level) { Vec3 vec3 = entity.position(); Vec3 vec32 = vec3.relative(Direction.UP, entity.getBbHeight() + 2.0F + level.random.nextInt(4)); - BlockHitResult blockHitResult = level.clip(new ClipContext(vec3, vec32, ClipContext.Block.VISUAL, ClipContext.Fluid.NONE, CollisionContext.empty())); + BlockHitResult blockHitResult = level.clip(new ClipContext(vec3, vec32, Block.VISUAL, Fluid.NONE, CollisionContext.empty())); Vec3 vec33 = blockHitResult.getBlockPos().getCenter().relative(Direction.DOWN, 1.0); BlockPos blockPos = BlockPos.containing(vec33); return !level.getBlockState(blockPos).getCollisionShape(level, blockPos).isEmpty() ? Optional.empty() : Optional.of(vec33); diff --git a/net/minecraft/world/level/block/entity/vault/VaultBlockEntity.java b/net/minecraft/world/level/block/entity/vault/VaultBlockEntity.java index f679130d..42aeed7e 100644 --- a/net/minecraft/world/level/block/entity/vault/VaultBlockEntity.java +++ b/net/minecraft/world/level/block/entity/vault/VaultBlockEntity.java @@ -34,7 +34,6 @@ import net.minecraft.world.level.block.VaultBlock; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.world.level.storage.loot.BuiltInLootTables; import net.minecraft.world.level.storage.loot.LootParams; import net.minecraft.world.level.storage.loot.LootTable; import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets; @@ -267,7 +266,7 @@ public class VaultBlockEntity extends BlockEntity { } else if (serverData.hasRewardedPlayer(player)) { playInsertFailSound(level, serverData, pos, SoundEvents.VAULT_REJECT_REWARDED_PLAYER); } else { - List list = resolveItemsToEject(level, config, pos, player); + List list = resolveItemsToEject(level, config, pos, player, stack); if (!list.isEmpty()) { player.awardStat(Stats.ITEM_USED.get(stack.getItem())); stack.consume(config.keyItem().getCount(), player); @@ -311,18 +310,19 @@ public class VaultBlockEntity extends BlockEntity { setVaultState(level, pos, state, state.setValue(VaultBlock.STATE, VaultState.UNLOCKING), config, sharedData); } - private static List resolveItemsToEject(ServerLevel level, VaultConfig config, BlockPos pos, Player player) { - LootTable lootTable = level.getServer().reloadableRegistries().getLootTable(config.lootTable()); - LootParams lootParams = new LootParams.Builder(level) - .withParameter(LootContextParams.ORIGIN, Vec3.atCenterOf(pos)) + private static List resolveItemsToEject(ServerLevel serverLevel, VaultConfig vaultConfig, BlockPos blockPos, Player player, ItemStack itemStack) { + LootTable lootTable = serverLevel.getServer().reloadableRegistries().getLootTable(vaultConfig.lootTable()); + LootParams lootParams = new LootParams.Builder(serverLevel) + .withParameter(LootContextParams.ORIGIN, Vec3.atCenterOf(blockPos)) .withLuck(player.getLuck()) .withParameter(LootContextParams.THIS_ENTITY, player) + .withParameter(LootContextParams.TOOL, itemStack) .create(LootContextParamSets.VAULT); return lootTable.getRandomItems(lootParams); } private static boolean canEjectReward(VaultConfig config, VaultState state) { - return config.lootTable() != BuiltInLootTables.EMPTY && !config.keyItem().isEmpty() && state != VaultState.INACTIVE; + return !config.keyItem().isEmpty() && state != VaultState.INACTIVE; } private static boolean isValidToInsert(VaultConfig config, ItemStack stack) { diff --git a/net/minecraft/world/level/block/grower/TreeGrower.java b/net/minecraft/world/level/block/grower/TreeGrower.java index 9e55027d..526b9aba 100644 --- a/net/minecraft/world/level/block/grower/TreeGrower.java +++ b/net/minecraft/world/level/block/grower/TreeGrower.java @@ -62,6 +62,7 @@ public final class TreeGrower { public static final TreeGrower ACACIA = new TreeGrower("acacia", Optional.empty(), Optional.of(TreeFeatures.ACACIA), Optional.empty()); public static final TreeGrower CHERRY = new TreeGrower("cherry", Optional.empty(), Optional.of(TreeFeatures.CHERRY), Optional.of(TreeFeatures.CHERRY_BEES_005)); public static final TreeGrower DARK_OAK = new TreeGrower("dark_oak", Optional.of(TreeFeatures.DARK_OAK), Optional.empty(), Optional.empty()); + public static final TreeGrower PALE_OAK = new TreeGrower("pale_oak", Optional.of(TreeFeatures.PALE_OAK), Optional.empty(), Optional.empty()); private final String name; private final float secondaryChance; private final Optional>> megaTree; @@ -127,8 +128,8 @@ public final class TreeGrower { ResourceKey> resourceKey = this.getConfiguredMegaFeature(random); if (resourceKey != null) { Holder> holder = (Holder>)level.registryAccess() - .registryOrThrow(Registries.CONFIGURED_FEATURE) - .getHolder(resourceKey) + .lookupOrThrow(Registries.CONFIGURED_FEATURE) + .get(resourceKey) .orElse(null); if (holder != null) { for (int i = 0; i >= -1; i--) { @@ -160,8 +161,8 @@ public final class TreeGrower { return false; } else { Holder> holder2 = (Holder>)level.registryAccess() - .registryOrThrow(Registries.CONFIGURED_FEATURE) - .getHolder(resourceKey2) + .lookupOrThrow(Registries.CONFIGURED_FEATURE) + .get(resourceKey2) .orElse(null); if (holder2 == null) { return false; diff --git a/net/minecraft/world/level/block/piston/MovingPistonBlock.java b/net/minecraft/world/level/block/piston/MovingPistonBlock.java index 61a1d454..85e2be2e 100644 --- a/net/minecraft/world/level/block/piston/MovingPistonBlock.java +++ b/net/minecraft/world/level/block/piston/MovingPistonBlock.java @@ -22,7 +22,6 @@ import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; -import net.minecraft.world.level.block.state.properties.DirectionProperty; import net.minecraft.world.level.block.state.properties.EnumProperty; import net.minecraft.world.level.block.state.properties.PistonType; import net.minecraft.world.level.pathfinder.PathComputationType; @@ -36,7 +35,7 @@ import org.jetbrains.annotations.Nullable; public class MovingPistonBlock extends BaseEntityBlock { public static final MapCodec CODEC = simpleCodec(MovingPistonBlock::new); - public static final DirectionProperty FACING = PistonHeadBlock.FACING; + public static final EnumProperty FACING = PistonHeadBlock.FACING; public static final EnumProperty TYPE = PistonHeadBlock.TYPE; @Override diff --git a/net/minecraft/world/level/block/piston/PistonBaseBlock.java b/net/minecraft/world/level/block/piston/PistonBaseBlock.java index 9a51c764..a25eeedc 100644 --- a/net/minecraft/world/level/block/piston/PistonBaseBlock.java +++ b/net/minecraft/world/level/block/piston/PistonBaseBlock.java @@ -33,11 +33,15 @@ import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.block.state.properties.BooleanProperty; import net.minecraft.world.level.block.state.properties.PistonType; import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.level.gameevent.GameEvent.Context; import net.minecraft.world.level.material.PushReaction; import net.minecraft.world.level.pathfinder.PathComputationType; +import net.minecraft.world.level.redstone.ExperimentalRedstoneUtils; +import net.minecraft.world.level.redstone.Orientation; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.Shapes; import net.minecraft.world.phys.shapes.VoxelShape; +import org.jetbrains.annotations.Nullable; public class PistonBaseBlock extends DirectionalBlock { public static final MapCodec CODEC = RecordCodecBuilder.mapCodec( @@ -102,9 +106,9 @@ public class PistonBaseBlock extends DirectionalBlock { } @Override - protected void neighborChanged(BlockState state, Level level, BlockPos pos, Block neighborBlock, BlockPos neighborPos, boolean movedByPiston) { + protected void neighborChanged(BlockState blockState, Level level, BlockPos blockPos, Block block, @Nullable Orientation orientation, boolean bl) { if (!level.isClientSide) { - this.checkIfExtend(level, pos, state); + this.checkIfExtend(level, blockPos, blockState); } } @@ -194,7 +198,7 @@ public class PistonBaseBlock extends DirectionalBlock { level.setBlock(pos, blockState, 67); level.playSound(null, pos, SoundEvents.PISTON_EXTEND, SoundSource.BLOCKS, 0.5F, level.random.nextFloat() * 0.25F + 0.6F); - level.gameEvent(GameEvent.BLOCK_ACTIVATE, pos, GameEvent.Context.of(blockState)); + level.gameEvent(GameEvent.BLOCK_ACTIVATE, pos, Context.of(blockState)); } else if (id == 1 || id == 2) { BlockEntity blockEntity = level.getBlockEntity(pos.relative(direction)); if (blockEntity instanceof PistonMovingBlockEntity) { @@ -240,7 +244,7 @@ public class PistonBaseBlock extends DirectionalBlock { } level.playSound(null, pos, SoundEvents.PISTON_CONTRACT, SoundSource.BLOCKS, 0.5F, level.random.nextFloat() * 0.15F + 0.6F); - level.gameEvent(GameEvent.BLOCK_DEACTIVATE, pos, GameEvent.Context.of(blockState2)); + level.gameEvent(GameEvent.BLOCK_DEACTIVATE, pos, Context.of(blockState2)); } return true; @@ -250,15 +254,15 @@ public class PistonBaseBlock extends DirectionalBlock { * Checks if the piston can push the given BlockState. */ public static boolean isPushable(BlockState state, Level level, BlockPos pos, Direction movementDirection, boolean allowDestroy, Direction pistonFacing) { - if (pos.getY() < level.getMinBuildHeight() || pos.getY() > level.getMaxBuildHeight() - 1 || !level.getWorldBorder().isWithinBounds(pos)) { + if (pos.getY() < level.getMinY() || pos.getY() > level.getMaxY() || !level.getWorldBorder().isWithinBounds(pos)) { return false; } else if (state.isAir()) { return true; } else if (state.is(Blocks.OBSIDIAN) || state.is(Blocks.CRYING_OBSIDIAN) || state.is(Blocks.RESPAWN_ANCHOR) || state.is(Blocks.REINFORCED_DEEPSLATE)) { return false; - } else if (movementDirection == Direction.DOWN && pos.getY() == level.getMinBuildHeight()) { + } else if (movementDirection == Direction.DOWN && pos.getY() == level.getMinY()) { return false; - } else if (movementDirection == Direction.UP && pos.getY() == level.getMaxBuildHeight() - 1) { + } else if (movementDirection == Direction.UP && pos.getY() == level.getMaxY()) { return false; } else { if (!state.is(Blocks.PISTON) && !state.is(Blocks.STICKY_PISTON)) { @@ -313,7 +317,7 @@ public class PistonBaseBlock extends DirectionalBlock { BlockEntity blockEntity = blockState2.hasBlockEntity() ? level.getBlockEntity(blockPos3) : null; dropResources(blockState2, level, blockPos3, blockEntity); level.setBlock(blockPos3, Blocks.AIR.defaultBlockState(), 18); - level.gameEvent(GameEvent.BLOCK_DESTROY, blockPos3, GameEvent.Context.of(blockState2)); + level.gameEvent(GameEvent.BLOCK_DESTROY, blockPos3, Context.of(blockState2)); if (!blockState2.is(BlockTags.FIRE)) { level.addDestroyBlockEffect(blockPos3, blockState2); } @@ -358,21 +362,22 @@ public class PistonBaseBlock extends DirectionalBlock { blockState5.updateIndirectNeighbourShapes(level, blockPos5, 2); } + Orientation orientation = ExperimentalRedstoneUtils.initialOrientation(level, pistonStructureResolver.getPushDirection(), null); i = 0; for (int k = list3.size() - 1; k >= 0; k--) { - BlockState blockState2 = blockStates[i++]; - BlockPos blockPos5 = (BlockPos)list3.get(k); - blockState2.updateIndirectNeighbourShapes(level, blockPos5, 2); - level.updateNeighborsAt(blockPos5, blockState2.getBlock()); + BlockState blockState3 = blockStates[i++]; + BlockPos blockPos6 = (BlockPos)list3.get(k); + blockState3.updateIndirectNeighbourShapes(level, blockPos6, 2); + level.updateNeighborsAt(blockPos6, blockState3.getBlock(), orientation); } for (int k = list.size() - 1; k >= 0; k--) { - level.updateNeighborsAt((BlockPos)list.get(k), blockStates[i++].getBlock()); + level.updateNeighborsAt((BlockPos)list.get(k), blockStates[i++].getBlock(), orientation); } if (extending) { - level.updateNeighborsAt(blockPos, Blocks.PISTON_HEAD); + level.updateNeighborsAt(blockPos, Blocks.PISTON_HEAD, orientation); } return true; diff --git a/net/minecraft/world/level/block/piston/PistonHeadBlock.java b/net/minecraft/world/level/block/piston/PistonHeadBlock.java index 2a88295e..f76cb103 100644 --- a/net/minecraft/world/level/block/piston/PistonHeadBlock.java +++ b/net/minecraft/world/level/block/piston/PistonHeadBlock.java @@ -4,12 +4,13 @@ import com.mojang.serialization.MapCodec; import java.util.Arrays; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; +import net.minecraft.util.RandomSource; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; -import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.DirectionalBlock; @@ -23,9 +24,12 @@ import net.minecraft.world.level.block.state.properties.BooleanProperty; import net.minecraft.world.level.block.state.properties.EnumProperty; import net.minecraft.world.level.block.state.properties.PistonType; import net.minecraft.world.level.pathfinder.PathComputationType; +import net.minecraft.world.level.redstone.ExperimentalRedstoneUtils; +import net.minecraft.world.level.redstone.Orientation; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.Shapes; import net.minecraft.world.phys.shapes.VoxelShape; +import org.jetbrains.annotations.Nullable; public class PistonHeadBlock extends DirectionalBlock { public static final MapCodec CODEC = simpleCodec(PistonHeadBlock::new); @@ -127,10 +131,19 @@ public class PistonHeadBlock extends DirectionalBlock { } @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { - return direction.getOpposite() == state.getValue(FACING) && !state.canSurvive(level, pos) + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { + return direction.getOpposite() == blockState.getValue(FACING) && !blockState.canSurvive(levelReader, blockPos) ? Blocks.AIR.defaultBlockState() - : super.updateShape(state, direction, neighborState, level, pos, neighborPos); + : super.updateShape(blockState, levelReader, scheduledTickAccess, blockPos, direction, blockPos2, blockState2, randomSource); } @Override @@ -140,9 +153,13 @@ public class PistonHeadBlock extends DirectionalBlock { } @Override - protected void neighborChanged(BlockState state, Level level, BlockPos pos, Block neighborBlock, BlockPos neighborPos, boolean movedByPiston) { - if (state.canSurvive(level, pos)) { - level.neighborChanged(pos.relative(((Direction)state.getValue(FACING)).getOpposite()), neighborBlock, neighborPos); + protected void neighborChanged(BlockState blockState, Level level, BlockPos blockPos, Block block, @Nullable Orientation orientation, boolean bl) { + if (blockState.canSurvive(level, blockPos)) { + level.neighborChanged( + blockPos.relative(((Direction)blockState.getValue(FACING)).getOpposite()), + block, + ExperimentalRedstoneUtils.withFront(orientation, ((Direction)blockState.getValue(FACING)).getOpposite()) + ); } } diff --git a/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java b/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java index 70672164..0758ee39 100644 --- a/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java +++ b/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java @@ -24,6 +24,7 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.block.state.properties.PistonType; import net.minecraft.world.level.material.PushReaction; +import net.minecraft.world.level.redstone.ExperimentalRedstoneUtils; import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.shapes.Shapes; @@ -193,6 +194,7 @@ public class PistonMovingBlockEntity extends BlockEntity { private static void moveEntityByPiston(Direction noClipDirection, Entity entity, double progress, Direction direction) { NOCLIP.set(noClipDirection); entity.move(MoverType.PISTON, new Vec3(progress * direction.getStepX(), progress * direction.getStepY(), progress * direction.getStepZ())); + entity.applyEffectsFromBlocks(); NOCLIP.set(null); } @@ -288,11 +290,16 @@ public class PistonMovingBlockEntity extends BlockEntity { } this.level.setBlock(this.worldPosition, blockState, 3); - this.level.neighborChanged(this.worldPosition, blockState.getBlock(), this.worldPosition); + this.level + .neighborChanged(this.worldPosition, blockState.getBlock(), ExperimentalRedstoneUtils.initialOrientation(this.level, this.getPushDirection(), null)); } } } + public Direction getPushDirection() { + return this.extending ? this.direction : this.direction.getOpposite(); + } + public static void tick(Level level, BlockPos pos, BlockState state, PistonMovingBlockEntity blockEntity) { blockEntity.lastTicked = level.getGameTime(); blockEntity.progressO = blockEntity.progress; @@ -313,7 +320,7 @@ public class PistonMovingBlockEntity extends BlockEntity { } level.setBlock(pos, blockState, 67); - level.neighborChanged(pos, blockState.getBlock(), pos); + level.neighborChanged(pos, blockState.getBlock(), ExperimentalRedstoneUtils.initialOrientation(level, blockEntity.getPushDirection(), null)); } } } @@ -331,7 +338,7 @@ public class PistonMovingBlockEntity extends BlockEntity { @Override protected void loadAdditional(CompoundTag tag, HolderLookup.Provider registries) { super.loadAdditional(tag, registries); - HolderGetter holderGetter = (HolderGetter)(this.level != null ? this.level.holderLookup(Registries.BLOCK) : BuiltInRegistries.BLOCK.asLookup()); + HolderGetter holderGetter = (HolderGetter)(this.level != null ? this.level.holderLookup(Registries.BLOCK) : BuiltInRegistries.BLOCK); this.movedState = NbtUtils.readBlockState(holderGetter, tag.getCompound("blockState")); this.direction = Direction.from3DDataValue(tag.getInt("facing")); this.progress = tag.getFloat("progress"); diff --git a/net/minecraft/world/level/block/state/BlockBehaviour.java b/net/minecraft/world/level/block/state/BlockBehaviour.java index 1a000202..0a85ee45 100644 --- a/net/minecraft/world/level/block/state/BlockBehaviour.java +++ b/net/minecraft/world/level/block/state/BlockBehaviour.java @@ -7,22 +7,23 @@ import it.unimi.dsi.fastutil.objects.Reference2ObjectArrayMap; import java.util.Arrays; import java.util.Collections; import java.util.List; -import java.util.Locale; +import java.util.Objects; +import java.util.Optional; import java.util.function.BiConsumer; import java.util.function.Function; import java.util.function.Predicate; import java.util.function.Supplier; import java.util.function.ToIntFunction; import java.util.stream.Stream; +import net.minecraft.Util; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.Holder; import net.minecraft.core.HolderSet; -import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.core.registries.Registries; import net.minecraft.network.protocol.game.DebugPackets; +import net.minecraft.resources.DependantName; import net.minecraft.resources.ResourceKey; -import net.minecraft.resources.ResourceLocation; import net.minecraft.server.level.ServerLevel; import net.minecraft.tags.FluidTags; import net.minecraft.tags.TagKey; @@ -30,7 +31,6 @@ import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; -import net.minecraft.world.ItemInteractionResult; import net.minecraft.world.MenuProvider; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; @@ -50,6 +50,7 @@ import net.minecraft.world.level.Explosion; import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.EntityBlock; @@ -61,6 +62,7 @@ import net.minecraft.world.level.block.SupportType; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntityTicker; import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.block.state.BlockBehaviour.BlockStateBase.Cache; import net.minecraft.world.level.block.state.properties.NoteBlockInstrument; import net.minecraft.world.level.block.state.properties.Property; import net.minecraft.world.level.material.Fluid; @@ -69,7 +71,7 @@ import net.minecraft.world.level.material.Fluids; import net.minecraft.world.level.material.MapColor; import net.minecraft.world.level.material.PushReaction; import net.minecraft.world.level.pathfinder.PathComputationType; -import net.minecraft.world.level.storage.loot.BuiltInLootTables; +import net.minecraft.world.level.redstone.Orientation; import net.minecraft.world.level.storage.loot.LootParams; import net.minecraft.world.level.storage.loot.LootTable; import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets; @@ -102,12 +104,13 @@ public abstract class BlockBehaviour implements FeatureElement { protected final boolean dynamicShape; protected final FeatureFlagSet requiredFeatures; protected final BlockBehaviour.Properties properties; - @Nullable - protected ResourceKey drops; + protected final Optional> drops; + protected final String descriptionId; public BlockBehaviour(BlockBehaviour.Properties properties) { this.hasCollision = properties.hasCollision; - this.drops = properties.drops; + this.drops = properties.effectiveDrops(); + this.descriptionId = properties.effectiveDescriptionId(); this.explosionResistance = properties.explosionResistance; this.isRandomlyTicking = properties.isRandomlyTicking; this.soundType = properties.soundType; @@ -159,21 +162,24 @@ public abstract class BlockBehaviour implements FeatureElement { } } - /** - * Update the provided state given the provided neighbor direction and neighbor state, returning a new state. - * For example, fences make their connections to the passed in state if possible, and wet concrete powder immediately returns its solidified counterpart. - * Note that this method should ideally consider only the specific direction passed in. - */ - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { - return state; + protected BlockState updateShape( + BlockState blockState, + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState2, + RandomSource randomSource + ) { + return blockState; } protected boolean skipRendering(BlockState state, BlockState adjacentState, Direction direction) { return false; } - protected void neighborChanged(BlockState state, Level level, BlockPos pos, Block neighborBlock, BlockPos neighborPos, boolean movedByPiston) { - DebugPackets.sendNeighborsUpdatePacket(level, pos); + protected void neighborChanged(BlockState blockState, Level level, BlockPos blockPos, Block block, @Nullable Orientation orientation, boolean bl) { } protected void onPlace(BlockState state, Level level, BlockPos pos, BlockState oldState, boolean movedByPiston) { @@ -185,14 +191,16 @@ public abstract class BlockBehaviour implements FeatureElement { } } - protected void onExplosionHit(BlockState state, Level level, BlockPos pos, Explosion explosion, BiConsumer dropConsumer) { - if (!state.isAir() && explosion.getBlockInteraction() != Explosion.BlockInteraction.TRIGGER_BLOCK) { - Block block = state.getBlock(); + protected void onExplosionHit( + BlockState blockState, ServerLevel serverLevel, BlockPos blockPos, Explosion explosion, BiConsumer biConsumer + ) { + if (!blockState.isAir() && explosion.getBlockInteraction() != Explosion.BlockInteraction.TRIGGER_BLOCK) { + Block block = blockState.getBlock(); boolean bl = explosion.getIndirectSourceEntity() instanceof Player; - if (block.dropFromExplosion(explosion) && level instanceof ServerLevel serverLevel) { - BlockEntity blockEntity = state.hasBlockEntity() ? level.getBlockEntity(pos) : null; + if (block.dropFromExplosion(explosion)) { + BlockEntity blockEntity = blockState.hasBlockEntity() ? serverLevel.getBlockEntity(blockPos) : null; LootParams.Builder builder = new LootParams.Builder(serverLevel) - .withParameter(LootContextParams.ORIGIN, Vec3.atCenterOf(pos)) + .withParameter(LootContextParams.ORIGIN, Vec3.atCenterOf(blockPos)) .withParameter(LootContextParams.TOOL, ItemStack.EMPTY) .withOptionalParameter(LootContextParams.BLOCK_ENTITY, blockEntity) .withOptionalParameter(LootContextParams.THIS_ENTITY, explosion.getDirectSourceEntity()); @@ -200,12 +208,12 @@ public abstract class BlockBehaviour implements FeatureElement { builder.withParameter(LootContextParams.EXPLOSION_RADIUS, explosion.radius()); } - state.spawnAfterBreak(serverLevel, pos, ItemStack.EMPTY, bl); - state.getDrops(builder).forEach(itemStack -> dropConsumer.accept(itemStack, pos)); + blockState.spawnAfterBreak(serverLevel, blockPos, ItemStack.EMPTY, bl); + blockState.getDrops(builder).forEach(itemStack -> biConsumer.accept(itemStack, blockPos)); } - level.setBlock(pos, Blocks.AIR.defaultBlockState(), 3); - block.wasExploded(level, pos, explosion); + serverLevel.setBlock(blockPos, Blocks.AIR.defaultBlockState(), 3); + block.wasExploded(serverLevel, blockPos, explosion); } } @@ -213,10 +221,10 @@ public abstract class BlockBehaviour implements FeatureElement { return InteractionResult.PASS; } - protected ItemInteractionResult useItemOn( - ItemStack stack, BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hitResult + protected InteractionResult useItemOn( + ItemStack itemStack, BlockState blockState, Level level, BlockPos blockPos, Player player, InteractionHand interactionHand, BlockHitResult blockHitResult ) { - return ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION; + return InteractionResult.TRY_WITH_EMPTY_HAND; } /** @@ -288,13 +296,12 @@ public abstract class BlockBehaviour implements FeatureElement { } protected List getDrops(BlockState state, LootParams.Builder params) { - ResourceKey resourceKey = this.getLootTable(); - if (resourceKey == BuiltInLootTables.EMPTY) { + if (this.drops.isEmpty()) { return Collections.emptyList(); } else { LootParams lootParams = params.withParameter(LootContextParams.BLOCK_STATE, state).create(LootContextParamSets.BLOCK); ServerLevel serverLevel = lootParams.getLevel(); - LootTable lootTable = serverLevel.getServer().reloadableRegistries().getLootTable(resourceKey); + LootTable lootTable = serverLevel.getServer().reloadableRegistries().getLootTable((ResourceKey)this.drops.get()); return lootTable.getRandomItems(lootParams); } } @@ -306,8 +313,8 @@ public abstract class BlockBehaviour implements FeatureElement { return Mth.getSeed(pos); } - protected VoxelShape getOcclusionShape(BlockState state, BlockGetter level, BlockPos pos) { - return state.getShape(level, pos); + protected VoxelShape getOcclusionShape(BlockState blockState) { + return blockState.getShape(EmptyBlockGetter.INSTANCE, BlockPos.ZERO); } protected VoxelShape getBlockSupportShape(BlockState state, BlockGetter level, BlockPos pos) { @@ -318,11 +325,11 @@ public abstract class BlockBehaviour implements FeatureElement { return Shapes.empty(); } - protected int getLightBlock(BlockState state, BlockGetter level, BlockPos pos) { - if (state.isSolidRender(level, pos)) { - return level.getMaxLightLevel(); + protected int getLightBlock(BlockState blockState) { + if (blockState.isSolidRender()) { + return 15; } else { - return state.propagatesSkylightDown(level, pos) ? 0 : 1; + return blockState.propagatesSkylightDown() ? 0 : 1; } } @@ -358,10 +365,6 @@ public abstract class BlockBehaviour implements FeatureElement { return Block.isShapeFullBlock(state.getCollisionShape(level, pos)); } - protected boolean isOcclusionShapeFullBlock(BlockState state, BlockGetter level, BlockPos pos) { - return Block.isShapeFullBlock(state.getOcclusionShape(level, pos)); - } - protected VoxelShape getVisualShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext context) { return this.getCollisionShape(state, level, pos, context); } @@ -411,6 +414,10 @@ public abstract class BlockBehaviour implements FeatureElement { protected void entityInside(BlockState state, Level level, BlockPos pos, Entity entity) { } + protected VoxelShape getEntityInsideCollisionShape(BlockState blockState, Level level, BlockPos blockPos) { + return Shapes.block(); + } + /** * Returns the direct signal this block emits in the given direction. * @@ -422,20 +429,19 @@ public abstract class BlockBehaviour implements FeatureElement { return 0; } - public final ResourceKey getLootTable() { - if (this.drops == null) { - ResourceLocation resourceLocation = BuiltInRegistries.BLOCK.getKey(this.asBlock()); - this.drops = ResourceKey.create(Registries.LOOT_TABLE, resourceLocation.withPrefix("blocks/")); - } - + public final Optional> getLootTable() { return this.drops; } + public final String getDescriptionId() { + return this.descriptionId; + } + protected void onProjectileHit(Level level, BlockState state, BlockHitResult hit, Projectile projectile) { } - protected boolean propagatesSkylightDown(BlockState state, BlockGetter level, BlockPos pos) { - return !Block.isShapeFullBlock(state.getShape(level, pos)) && state.getFluidState().isEmpty(); + protected boolean propagatesSkylightDown(BlockState blockState) { + return !Block.isShapeFullBlock(blockState.getShape(EmptyBlockGetter.INSTANCE, BlockPos.ZERO)) && blockState.getFluidState().isEmpty(); } protected boolean isRandomlyTicking(BlockState state) { @@ -459,6 +465,13 @@ public abstract class BlockBehaviour implements FeatureElement { } public abstract static class BlockStateBase extends StateHolder { + private static final Direction[] DIRECTIONS = Direction.values(); + private static final VoxelShape[] EMPTY_OCCLUSION_SHAPES = Util.make( + new VoxelShape[DIRECTIONS.length], voxelShapes -> Arrays.fill(voxelShapes, Shapes.empty()) + ); + private static final VoxelShape[] FULL_BLOCK_OCCLUSION_SHAPES = Util.make( + new VoxelShape[DIRECTIONS.length], voxelShapes -> Arrays.fill(voxelShapes, Shapes.block()) + ); private final int lightEmission; private final boolean useShapeForLightOcclusion; private final boolean isAir; @@ -483,9 +496,14 @@ public abstract class BlockBehaviour implements FeatureElement { private final NoteBlockInstrument instrument; private final boolean replaceable; @Nullable - protected BlockBehaviour.BlockStateBase.Cache cache; + private Cache cache; private FluidState fluidState = Fluids.EMPTY.defaultFluidState(); private boolean isRandomlyTicking; + private boolean solidRender; + private VoxelShape occlusionShape; + private VoxelShape[] occlusionShapesByFace; + private boolean propagatesSkylightDown; + private int lightBlock; protected BlockStateBase(Block owner, Reference2ObjectArrayMap, Comparable> values, MapCodec propertiesCodec) { super(owner, values, propertiesCodec); @@ -533,10 +551,26 @@ public abstract class BlockBehaviour implements FeatureElement { this.fluidState = this.owner.getFluidState(this.asState()); this.isRandomlyTicking = this.owner.isRandomlyTicking(this.asState()); if (!this.getBlock().hasDynamicShape()) { - this.cache = new BlockBehaviour.BlockStateBase.Cache(this.asState()); + this.cache = new Cache(this.asState()); } this.legacySolid = this.calculateSolid(); + this.occlusionShape = this.canOcclude ? this.owner.getOcclusionShape(this.asState()) : Shapes.empty(); + this.solidRender = Block.isShapeFullBlock(this.occlusionShape); + if (this.occlusionShape.isEmpty()) { + this.occlusionShapesByFace = EMPTY_OCCLUSION_SHAPES; + } else if (this.solidRender) { + this.occlusionShapesByFace = FULL_BLOCK_OCCLUSION_SHAPES; + } else { + this.occlusionShapesByFace = new VoxelShape[DIRECTIONS.length]; + + for (Direction direction : DIRECTIONS) { + this.occlusionShapesByFace[direction.ordinal()] = this.occlusionShape.getFaceShape(direction); + } + } + + this.propagatesSkylightDown = this.owner.propagatesSkylightDown(this.asState()); + this.lightBlock = this.owner.getLightBlock(this.asState()); } public Block getBlock() { @@ -562,22 +596,20 @@ public abstract class BlockBehaviour implements FeatureElement { return this.getBlock().properties.isValidSpawn.test(this.asState(), level, pos, entityType); } - public boolean propagatesSkylightDown(BlockGetter level, BlockPos pos) { - return this.cache != null ? this.cache.propagatesSkylightDown : this.getBlock().propagatesSkylightDown(this.asState(), level, pos); + public boolean propagatesSkylightDown() { + return this.propagatesSkylightDown; } - public int getLightBlock(BlockGetter level, BlockPos pos) { - return this.cache != null ? this.cache.lightBlock : this.getBlock().getLightBlock(this.asState(), level, pos); + public int getLightBlock() { + return this.lightBlock; } - public VoxelShape getFaceOcclusionShape(BlockGetter level, BlockPos pos, Direction direction) { - return this.cache != null && this.cache.occlusionShapes != null - ? this.cache.occlusionShapes[direction.ordinal()] - : Shapes.getFaceShape(this.getOcclusionShape(level, pos), direction); + public VoxelShape getFaceOcclusionShape(Direction direction) { + return this.occlusionShapesByFace[direction.ordinal()]; } - public VoxelShape getOcclusionShape(BlockGetter level, BlockPos pos) { - return this.getBlock().getOcclusionShape(this.asState(), level, pos); + public VoxelShape getOcclusionShape() { + return this.occlusionShape; } public boolean hasLargeCollisionShape() { @@ -671,13 +703,8 @@ public abstract class BlockBehaviour implements FeatureElement { return this.pushReaction; } - public boolean isSolidRender(BlockGetter level, BlockPos pos) { - if (this.cache != null) { - return this.cache.solidRender; - } else { - BlockState blockState = this.asState(); - return blockState.canOcclude() ? Block.isShapeFullBlock(blockState.getOcclusionShape(level, pos)) : false; - } + public boolean isSolidRender() { + return this.solidRender; } public boolean canOcclude() { @@ -727,9 +754,9 @@ public abstract class BlockBehaviour implements FeatureElement { return Block.isFaceFull(this.getCollisionShape(level, pos, CollisionContext.of(entity)), face); } - public Vec3 getOffset(BlockGetter level, BlockPos pos) { + public Vec3 getOffset(BlockPos blockPos) { BlockBehaviour.OffsetFunction offsetFunction = this.offsetFunction; - return offsetFunction != null ? offsetFunction.evaluate(this.asState(), level, pos) : Vec3.ZERO; + return offsetFunction != null ? offsetFunction.evaluate(this.asState(), blockPos) : Vec3.ZERO; } public boolean hasOffsetFunction() { @@ -740,8 +767,9 @@ public abstract class BlockBehaviour implements FeatureElement { return this.getBlock().triggerEvent(this.asState(), level, pos, id, param); } - public void handleNeighborChanged(Level level, BlockPos pos, Block block, BlockPos fromPos, boolean isMoving) { - this.getBlock().neighborChanged(this.asState(), level, pos, block, fromPos, isMoving); + public void handleNeighborChanged(Level level, BlockPos blockPos, Block block, @Nullable Orientation orientation, boolean bl) { + DebugPackets.sendNeighborsUpdatePacket(level, blockPos); + this.getBlock().neighborChanged(this.asState(), level, blockPos, block, orientation, bl); } public final void updateNeighbourShapes(LevelAccessor level, BlockPos pos, int flags) { @@ -753,7 +781,7 @@ public abstract class BlockBehaviour implements FeatureElement { for (Direction direction : BlockBehaviour.UPDATE_SHAPE_ORDER) { mutableBlockPos.setWithOffset(pos, direction); - level.neighborShapeChanged(direction.getOpposite(), this.asState(), mutableBlockPos, pos, flags, recursionLeft); + level.neighborShapeChanged(direction.getOpposite(), mutableBlockPos, pos, this.asState(), flags, recursionLeft); } } @@ -773,8 +801,8 @@ public abstract class BlockBehaviour implements FeatureElement { this.getBlock().onRemove(this.asState(), level, pos, newState, movedByPiston); } - public void onExplosionHit(Level level, BlockPos pos, Explosion explosion, BiConsumer dropConsumer) { - this.getBlock().onExplosionHit(this.asState(), level, pos, explosion, dropConsumer); + public void onExplosionHit(ServerLevel serverLevel, BlockPos blockPos, Explosion explosion, BiConsumer biConsumer) { + this.getBlock().onExplosionHit(this.asState(), serverLevel, blockPos, explosion, biConsumer); } public void tick(ServerLevel level, BlockPos pos, RandomSource random) { @@ -789,6 +817,10 @@ public abstract class BlockBehaviour implements FeatureElement { this.getBlock().entityInside(this.asState(), level, pos, entity); } + public VoxelShape getEntityInsideCollisionShape(Level level, BlockPos blockPos) { + return this.getBlock().getEntityInsideCollisionShape(this.asState(), level, blockPos); + } + public void spawnAfterBreak(ServerLevel level, BlockPos pos, ItemStack stack, boolean dropExperience) { this.getBlock().spawnAfterBreak(this.asState(), level, pos, stack, dropExperience); } @@ -797,8 +829,8 @@ public abstract class BlockBehaviour implements FeatureElement { return this.getBlock().getDrops(this.asState(), lootParams); } - public ItemInteractionResult useItemOn(ItemStack stack, Level level, Player player, InteractionHand hand, BlockHitResult hitResult) { - return this.getBlock().useItemOn(stack, this.asState(), level, hitResult.getBlockPos(), player, hand, hitResult); + public InteractionResult useItemOn(ItemStack itemStack, Level level, Player player, InteractionHand interactionHand, BlockHitResult blockHitResult) { + return this.getBlock().useItemOn(itemStack, this.asState(), level, blockHitResult.getBlockPos(), player, interactionHand, blockHitResult); } public InteractionResult useWithoutItem(Level level, Player player, BlockHitResult hitResult) { @@ -817,8 +849,16 @@ public abstract class BlockBehaviour implements FeatureElement { return this.isViewBlocking.test(this.asState(), level, pos); } - public BlockState updateShape(Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { - return this.getBlock().updateShape(this.asState(), direction, neighborState, level, pos, neighborPos); + public BlockState updateShape( + LevelReader levelReader, + ScheduledTickAccess scheduledTickAccess, + BlockPos blockPos, + Direction direction, + BlockPos blockPos2, + BlockState blockState, + RandomSource randomSource + ) { + return this.getBlock().updateShape(this.asState(), levelReader, scheduledTickAccess, blockPos, direction, blockPos2, blockState, randomSource); } public boolean isPathfindable(PathComputationType pathComputationType) { @@ -932,70 +972,11 @@ public abstract class BlockBehaviour implements FeatureElement { public NoteBlockInstrument instrument() { return this.instrument; } - - static final class Cache { - private static final Direction[] DIRECTIONS = Direction.values(); - private static final int SUPPORT_TYPE_COUNT = SupportType.values().length; - protected final boolean solidRender; - final boolean propagatesSkylightDown; - final int lightBlock; - @Nullable - final VoxelShape[] occlusionShapes; - protected final VoxelShape collisionShape; - protected final boolean largeCollisionShape; - private final boolean[] faceSturdy; - protected final boolean isCollisionShapeFullBlock; - - Cache(BlockState state) { - Block block = state.getBlock(); - this.solidRender = state.isSolidRender(EmptyBlockGetter.INSTANCE, BlockPos.ZERO); - this.propagatesSkylightDown = block.propagatesSkylightDown(state, EmptyBlockGetter.INSTANCE, BlockPos.ZERO); - this.lightBlock = block.getLightBlock(state, EmptyBlockGetter.INSTANCE, BlockPos.ZERO); - if (!state.canOcclude()) { - this.occlusionShapes = null; - } else { - this.occlusionShapes = new VoxelShape[DIRECTIONS.length]; - VoxelShape voxelShape = block.getOcclusionShape(state, EmptyBlockGetter.INSTANCE, BlockPos.ZERO); - - for (Direction direction : DIRECTIONS) { - this.occlusionShapes[direction.ordinal()] = Shapes.getFaceShape(voxelShape, direction); - } - } - - this.collisionShape = block.getCollisionShape(state, EmptyBlockGetter.INSTANCE, BlockPos.ZERO, CollisionContext.empty()); - if (!this.collisionShape.isEmpty() && state.hasOffsetFunction()) { - throw new IllegalStateException( - String.format( - Locale.ROOT, "%s has a collision shape and an offset type, but is not marked as dynamicShape in its properties.", BuiltInRegistries.BLOCK.getKey(block) - ) - ); - } else { - this.largeCollisionShape = Arrays.stream(Direction.Axis.values()) - .anyMatch(axis -> this.collisionShape.min(axis) < 0.0 || this.collisionShape.max(axis) > 1.0); - this.faceSturdy = new boolean[DIRECTIONS.length * SUPPORT_TYPE_COUNT]; - - for (Direction direction2 : DIRECTIONS) { - for (SupportType supportType : SupportType.values()) { - this.faceSturdy[getFaceSupportIndex(direction2, supportType)] = supportType.isSupporting(state, EmptyBlockGetter.INSTANCE, BlockPos.ZERO, direction2); - } - } - - this.isCollisionShapeFullBlock = Block.isShapeFullBlock(state.getCollisionShape(EmptyBlockGetter.INSTANCE, BlockPos.ZERO)); - } - } - - public boolean isFaceSturdy(Direction direction, SupportType supportType) { - return this.faceSturdy[getFaceSupportIndex(direction, supportType)]; - } - - private static int getFaceSupportIndex(Direction direction, SupportType supportType) { - return direction.ordinal() * SUPPORT_TYPE_COUNT + supportType.ordinal(); - } - } } + @FunctionalInterface public interface OffsetFunction { - Vec3 evaluate(BlockState blockState, BlockGetter blockGetter, BlockPos blockPos); + Vec3 evaluate(BlockState blockState, BlockPos blockPos); } public static enum OffsetType { @@ -1017,10 +998,12 @@ public abstract class BlockBehaviour implements FeatureElement { float friction = 0.6F; float speedFactor = 1.0F; float jumpFactor = 1.0F; - /** - * Sets loot table information - */ - ResourceKey drops; + @Nullable + private ResourceKey id; + private DependantName>> drops = resourceKey -> Optional.of( + ResourceKey.create(Registries.LOOT_TABLE, resourceKey.location().withPrefix("blocks/")) + ); + private DependantName descriptionId = resourceKey -> Util.makeDescriptionId("block", resourceKey.location()); boolean canOcclude = true; boolean isAir; boolean ignitedByLava; @@ -1068,6 +1051,7 @@ public abstract class BlockBehaviour implements FeatureElement { properties.isSuffocating = properties2.isSuffocating; properties.isViewBlocking = properties2.isViewBlocking; properties.drops = properties2.drops; + properties.descriptionId = properties2.descriptionId; return properties; } @@ -1177,15 +1161,19 @@ public abstract class BlockBehaviour implements FeatureElement { } public BlockBehaviour.Properties noLootTable() { - this.drops = BuiltInLootTables.EMPTY; + this.drops = DependantName.fixed(Optional.empty()); return this; } - public BlockBehaviour.Properties dropsLike(Block block) { - this.drops = block.getLootTable(); + public BlockBehaviour.Properties overrideLootTable(Optional> optional) { + this.drops = DependantName.fixed(optional); return this; } + protected Optional> effectiveDrops() { + return this.drops.get((ResourceKey)Objects.requireNonNull(this.id, "Block id not set")); + } + public BlockBehaviour.Properties ignitedByLava() { this.ignitedByLava = true; return this; @@ -1268,7 +1256,7 @@ public abstract class BlockBehaviour implements FeatureElement { public BlockBehaviour.Properties offsetType(BlockBehaviour.OffsetType offsetType) { this.offsetFunction = switch (offsetType) { case NONE -> null; - case XZ -> (blockState, blockGetter, blockPos) -> { + case XZ -> (blockState, blockPos) -> { Block block = blockState.getBlock(); long l = Mth.getSeed(blockPos.getX(), 0, blockPos.getZ()); float f = block.getMaxHorizontalOffset(); @@ -1276,7 +1264,7 @@ public abstract class BlockBehaviour implements FeatureElement { double e = Mth.clamp(((float)(l >> 8 & 15L) / 15.0F - 0.5) * 0.5, (double)(-f), (double)f); return new Vec3(d, 0.0, e); }; - case XYZ -> (blockState, blockGetter, blockPos) -> { + case XYZ -> (blockState, blockPos) -> { Block block = blockState.getBlock(); long l = Mth.getSeed(blockPos.getX(), 0, blockPos.getZ()); double d = ((float)(l >> 4 & 15L) / 15.0F - 1.0) * block.getMaxVerticalOffset(); @@ -1308,12 +1296,28 @@ public abstract class BlockBehaviour implements FeatureElement { this.replaceable = true; return this; } + + public BlockBehaviour.Properties setId(ResourceKey resourceKey) { + this.id = resourceKey; + return this; + } + + public BlockBehaviour.Properties overrideDescription(String string) { + this.descriptionId = DependantName.fixed(string); + return this; + } + + protected String effectiveDescriptionId() { + return this.descriptionId.get((ResourceKey)Objects.requireNonNull(this.id, "Block id not set")); + } } + @FunctionalInterface public interface StateArgumentPredicate { boolean test(BlockState blockState, BlockGetter blockGetter, BlockPos blockPos, A object); } + @FunctionalInterface public interface StatePredicate { boolean test(BlockState blockState, BlockGetter blockGetter, BlockPos blockPos); } diff --git a/net/minecraft/world/level/block/state/StateHolder.java b/net/minecraft/world/level/block/state/StateHolder.java index c1689c59..8168d474 100644 --- a/net/minecraft/world/level/block/state/StateHolder.java +++ b/net/minecraft/world/level/block/state/StateHolder.java @@ -1,15 +1,13 @@ package net.minecraft.world.level.block.state; -import com.google.common.collect.ArrayTable; -import com.google.common.collect.HashBasedTable; -import com.google.common.collect.Table; import com.mojang.serialization.Codec; import com.mojang.serialization.MapCodec; import it.unimi.dsi.fastutil.objects.Reference2ObjectArrayMap; import java.util.Collection; import java.util.Collections; -import java.util.Iterator; +import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.Optional; import java.util.Map.Entry; import java.util.function.Function; @@ -36,7 +34,7 @@ public abstract class StateHolder { }; protected final O owner; private final Reference2ObjectArrayMap, Comparable> values; - private Table, Comparable, S> neighbours; + private Map, S[]> neighbours; protected final MapCodec propertiesCodec; protected StateHolder(O owner, Reference2ObjectArrayMap, Comparable> values, MapCodec propertiesCodec) { @@ -49,20 +47,9 @@ public abstract class StateHolder { return this.setValue(property, findNextInCollection(property.getPossibleValues(), this.getValue(property))); } - protected static T findNextInCollection(Collection collection, T value) { - Iterator iterator = collection.iterator(); - - while (iterator.hasNext()) { - if (iterator.next().equals(value)) { - if (iterator.hasNext()) { - return (T)iterator.next(); - } - - return (T)collection.iterator().next(); - } - } - - return (T)iterator.next(); + protected static T findNextInCollection(List list, T object) { + int i = list.indexOf(object) + 1; + return (T)(i == list.size() ? list.getFirst() : list.get(i)); } public String toString() { @@ -101,37 +88,43 @@ public abstract class StateHolder { } public > Optional getOptionalValue(Property property) { + return Optional.ofNullable(this.getNullableValue(property)); + } + + public > T getValueOrElse(Property property, T comparable) { + return (T)Objects.requireNonNullElse(this.getNullableValue(property), comparable); + } + + @Nullable + public > T getNullableValue(Property property) { Comparable comparable = this.values.get(property); - return comparable == null ? Optional.empty() : Optional.of((Comparable)property.getValueClass().cast(comparable)); + return (T)(comparable == null ? null : property.getValueClass().cast(comparable)); } public , V extends T> S setValue(Property property, V value) { Comparable comparable = this.values.get(property); if (comparable == null) { throw new IllegalArgumentException("Cannot set property " + property + " as it does not exist in " + this.owner); - } else if (comparable.equals(value)) { - return (S)this; } else { - S object = this.neighbours.get(property, value); - if (object == null) { - throw new IllegalArgumentException("Cannot set property " + property + " to " + value + " on " + this.owner + ", it is not an allowed value"); - } else { - return object; - } + return this.setValueInternal(property, value, comparable); } } public , V extends T> S trySetValue(Property property, V value) { Comparable comparable = this.values.get(property); - if (comparable != null && !comparable.equals(value)) { - S object = this.neighbours.get(property, value); - if (object == null) { - throw new IllegalArgumentException("Cannot set property " + property + " to " + value + " on " + this.owner + ", it is not an allowed value"); - } else { - return object; - } - } else { + return (S)(comparable == null ? this : this.setValueInternal(property, value, comparable)); + } + + private , V extends T> S setValueInternal(Property property, V comparable, Comparable comparable2) { + if (comparable2.equals(comparable)) { return (S)this; + } else { + int i = property.getInternalIndex((T)comparable); + if (i < 0) { + throw new IllegalArgumentException("Cannot set property " + property + " to " + comparable + " on " + this.owner + ", it is not an allowed value"); + } else { + return (S)this.neighbours.get(property)[i]; + } } } @@ -139,19 +132,14 @@ public abstract class StateHolder { if (this.neighbours != null) { throw new IllegalStateException(); } else { - Table, Comparable, S> table = HashBasedTable.create(); + Map, S[]> map = new Reference2ObjectArrayMap<>(this.values.size()); for (Entry, Comparable> entry : this.values.entrySet()) { Property property = (Property)entry.getKey(); - - for (Comparable comparable : property.getPossibleValues()) { - if (!comparable.equals(entry.getValue())) { - table.put(property, comparable, (S)possibleStateMap.get(this.makeNeighbourValues(property, comparable))); - } - } + map.put(property, property.getPossibleValues().stream().map(comparable -> possibleStateMap.get(this.makeNeighbourValues(property, comparable))).toArray()); } - this.neighbours = (Table, Comparable, S>)(table.isEmpty() ? table : ArrayTable.create(table)); + this.neighbours = map; } } diff --git a/net/minecraft/world/level/block/state/properties/BlockSetType.java b/net/minecraft/world/level/block/state/properties/BlockSetType.java index 41d47b7c..cca8b1d7 100644 --- a/net/minecraft/world/level/block/state/properties/BlockSetType.java +++ b/net/minecraft/world/level/block/state/properties/BlockSetType.java @@ -140,6 +140,7 @@ public record BlockSetType( ); public static final BlockSetType JUNGLE = register(new BlockSetType("jungle")); public static final BlockSetType DARK_OAK = register(new BlockSetType("dark_oak")); + public static final BlockSetType PALE_OAK = register(new BlockSetType("pale_oak")); public static final BlockSetType CRIMSON = register( new BlockSetType( "crimson", diff --git a/net/minecraft/world/level/block/state/properties/BlockStateProperties.java b/net/minecraft/world/level/block/state/properties/BlockStateProperties.java index 717669af..747ea976 100644 --- a/net/minecraft/world/level/block/state/properties/BlockStateProperties.java +++ b/net/minecraft/world/level/block/state/properties/BlockStateProperties.java @@ -3,6 +3,7 @@ package net.minecraft.world.level.block.state.properties; import java.util.function.Predicate; import net.minecraft.core.Direction; import net.minecraft.core.FrontAndTop; +import net.minecraft.world.level.block.CreakingHeartBlock; import net.minecraft.world.level.block.entity.trialspawner.TrialSpawnerState; import net.minecraft.world.level.block.entity.vault.VaultState; @@ -25,6 +26,7 @@ public class BlockStateProperties { public static final BooleanProperty INVERTED = BooleanProperty.create("inverted"); public static final BooleanProperty IN_WALL = BooleanProperty.create("in_wall"); public static final BooleanProperty LIT = BooleanProperty.create("lit"); + public static final BooleanProperty TIP = BooleanProperty.create("tip"); public static final BooleanProperty LOCKED = BooleanProperty.create("locked"); public static final BooleanProperty OCCUPIED = BooleanProperty.create("occupied"); public static final BooleanProperty OPEN = BooleanProperty.create("open"); @@ -48,11 +50,11 @@ public class BlockStateProperties { public static final BooleanProperty EAST = BooleanProperty.create("east"); public static final BooleanProperty SOUTH = BooleanProperty.create("south"); public static final BooleanProperty WEST = BooleanProperty.create("west"); - public static final DirectionProperty FACING = DirectionProperty.create( - "facing", Direction.NORTH, Direction.EAST, Direction.SOUTH, Direction.WEST, Direction.UP, Direction.DOWN + public static final EnumProperty FACING = EnumProperty.create( + "facing", Direction.class, Direction.NORTH, Direction.EAST, Direction.SOUTH, Direction.WEST, Direction.UP, Direction.DOWN ); - public static final DirectionProperty FACING_HOPPER = DirectionProperty.create("facing", (Predicate)(direction -> direction != Direction.UP)); - public static final DirectionProperty HORIZONTAL_FACING = DirectionProperty.create("facing", Direction.Plane.HORIZONTAL); + public static final EnumProperty FACING_HOPPER = EnumProperty.create("facing", Direction.class, (Predicate)(direction -> direction != Direction.UP)); + public static final EnumProperty HORIZONTAL_FACING = EnumProperty.create("facing", Direction.class, Direction.Plane.HORIZONTAL); public static final IntegerProperty FLOWER_AMOUNT = IntegerProperty.create("flower_amount", 1, 4); public static final EnumProperty ORIENTATION = EnumProperty.create("orientation", FrontAndTop.class); public static final EnumProperty ATTACH_FACE = EnumProperty.create("face", AttachFace.class); @@ -132,7 +134,7 @@ public class BlockStateProperties { public static final EnumProperty STRUCTUREBLOCK_MODE = EnumProperty.create("mode", StructureMode.class); public static final EnumProperty BAMBOO_LEAVES = EnumProperty.create("leaves", BambooLeaves.class); public static final EnumProperty TILT = EnumProperty.create("tilt", Tilt.class); - public static final DirectionProperty VERTICAL_DIRECTION = DirectionProperty.create("vertical_direction", Direction.UP, Direction.DOWN); + public static final EnumProperty VERTICAL_DIRECTION = EnumProperty.create("vertical_direction", Direction.class, Direction.UP, Direction.DOWN); public static final EnumProperty DRIPSTONE_THICKNESS = EnumProperty.create("thickness", DripstoneThickness.class); public static final EnumProperty SCULK_SENSOR_PHASE = EnumProperty.create("sculk_sensor_phase", SculkSensorPhase.class); public static final BooleanProperty CHISELED_BOOKSHELF_SLOT_0_OCCUPIED = BooleanProperty.create("slot_0_occupied"); @@ -146,5 +148,6 @@ public class BlockStateProperties { public static final BooleanProperty CRAFTING = BooleanProperty.create("crafting"); public static final EnumProperty TRIAL_SPAWNER_STATE = EnumProperty.create("trial_spawner_state", TrialSpawnerState.class); public static final EnumProperty VAULT_STATE = EnumProperty.create("vault_state", VaultState.class); + public static final EnumProperty CREAKING = EnumProperty.create("creaking", CreakingHeartBlock.CreakingHeartState.class); public static final BooleanProperty OMINOUS = BooleanProperty.create("ominous"); } diff --git a/net/minecraft/world/level/block/state/properties/BooleanProperty.java b/net/minecraft/world/level/block/state/properties/BooleanProperty.java index 7fb75151..ec9e94d5 100644 --- a/net/minecraft/world/level/block/state/properties/BooleanProperty.java +++ b/net/minecraft/world/level/block/state/properties/BooleanProperty.java @@ -1,19 +1,20 @@ package net.minecraft.world.level.block.state.properties; -import com.google.common.collect.ImmutableSet; -import java.util.Collection; +import java.util.List; import java.util.Optional; -public class BooleanProperty extends Property { - private final ImmutableSet values = ImmutableSet.of(true, false); +public final class BooleanProperty extends Property { + private static final List VALUES = List.of(true, false); + private static final int TRUE_INDEX = 0; + private static final int FALSE_INDEX = 1; - protected BooleanProperty(String name) { + private BooleanProperty(String name) { super(name, Boolean.class); } @Override - public Collection getPossibleValues() { - return this.values; + public List getPossibleValues() { + return VALUES; } public static BooleanProperty create(String name) { @@ -22,7 +23,11 @@ public class BooleanProperty extends Property { @Override public Optional getValue(String value) { - return !"true".equals(value) && !"false".equals(value) ? Optional.empty() : Optional.of(Boolean.valueOf(value)); + return switch (value) { + case "true" -> Optional.of(true); + case "false" -> Optional.of(false); + default -> Optional.empty(); + }; } /** @@ -32,17 +37,7 @@ public class BooleanProperty extends Property { return value.toString(); } - @Override - public boolean equals(Object object) { - if (this == object) { - return true; - } else { - return object instanceof BooleanProperty booleanProperty && super.equals(object) ? this.values.equals(booleanProperty.values) : false; - } - } - - @Override - public int generateHashCode() { - return 31 * super.generateHashCode() + this.values.hashCode(); + public int getInternalIndex(Boolean boolean_) { + return boolean_ ? 0 : 1; } } diff --git a/net/minecraft/world/level/block/state/properties/DirectionProperty.java b/net/minecraft/world/level/block/state/properties/DirectionProperty.java deleted file mode 100644 index 41f453f3..00000000 --- a/net/minecraft/world/level/block/state/properties/DirectionProperty.java +++ /dev/null @@ -1,36 +0,0 @@ -package net.minecraft.world.level.block.state.properties; - -import com.google.common.collect.Lists; -import java.util.Arrays; -import java.util.Collection; -import java.util.function.Predicate; -import java.util.stream.Collectors; -import net.minecraft.core.Direction; - -public class DirectionProperty extends EnumProperty { - protected DirectionProperty(String name, Collection values) { - super(name, Direction.class, values); - } - - public static DirectionProperty create(String name) { - return create(name, (Predicate)(direction -> true)); - } - - /** - * Create a new DirectionProperty with all directions that match the given Predicate - */ - public static DirectionProperty create(String name, Predicate filter) { - return create(name, (Collection)Arrays.stream(Direction.values()).filter(filter).collect(Collectors.toList())); - } - - public static DirectionProperty create(String name, Direction... values) { - return create(name, Lists.newArrayList(values)); - } - - /** - * Create a new DirectionProperty for the given direction values - */ - public static DirectionProperty create(String name, Collection values) { - return new DirectionProperty(name, values); - } -} diff --git a/net/minecraft/world/level/block/state/properties/EnumProperty.java b/net/minecraft/world/level/block/state/properties/EnumProperty.java index 2cfce3b4..eecadbd7 100644 --- a/net/minecraft/world/level/block/state/properties/EnumProperty.java +++ b/net/minecraft/world/level/block/state/properties/EnumProperty.java @@ -1,39 +1,49 @@ package net.minecraft.world.level.block.state.properties; -import com.google.common.collect.ImmutableSet; -import com.google.common.collect.Lists; -import com.google.common.collect.Maps; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableMap.Builder; import java.util.Arrays; -import java.util.Collection; +import java.util.List; import java.util.Map; import java.util.Optional; import java.util.function.Predicate; import java.util.stream.Collectors; import net.minecraft.util.StringRepresentable; -public class EnumProperty & StringRepresentable> extends Property { - private final ImmutableSet values; +public final class EnumProperty & StringRepresentable> extends Property { + private final List values; /** * Map of names to Enum values */ - private final Map names = Maps.newHashMap(); + private final Map names; + private final int[] ordinalToIndex; - protected EnumProperty(String name, Class clazz, Collection values) { - super(name, clazz); - this.values = ImmutableSet.copyOf(values); + private EnumProperty(String string, Class class_, List list) { + super(string, class_); + if (list.isEmpty()) { + throw new IllegalArgumentException("Trying to make empty EnumProperty '" + string + "'"); + } else { + this.values = List.copyOf(list); + T[] enums = (T[])class_.getEnumConstants(); + this.ordinalToIndex = new int[enums.length]; - for (T enum_ : values) { - String string = enum_.getSerializedName(); - if (this.names.containsKey(string)) { - throw new IllegalArgumentException("Multiple values have the same name '" + string + "'"); + for (T enum_ : enums) { + this.ordinalToIndex[enum_.ordinal()] = list.indexOf(enum_); } - this.names.put(string, enum_); + Builder builder = ImmutableMap.builder(); + + for (T enum2 : list) { + String string2 = enum2.getSerializedName(); + builder.put(string2, enum2); + } + + this.names = builder.buildOrThrow(); } } @Override - public Collection getPossibleValues() { + public List getPossibleValues() { return this.values; } @@ -49,22 +59,23 @@ public class EnumProperty & StringRepresentable> extends Prope return value.getSerializedName(); } + public int getInternalIndex(T enum_) { + return this.ordinalToIndex[enum_.ordinal()]; + } + @Override public boolean equals(Object object) { if (this == object) { return true; } else { - return object instanceof EnumProperty enumProperty && super.equals(object) - ? this.values.equals(enumProperty.values) && this.names.equals(enumProperty.names) - : false; + return object instanceof EnumProperty enumProperty && super.equals(object) ? this.values.equals(enumProperty.values) : false; } } @Override public int generateHashCode() { int i = super.generateHashCode(); - i = 31 * i + this.values.hashCode(); - return 31 * i + this.names.hashCode(); + return 31 * i + this.values.hashCode(); } /** @@ -78,20 +89,18 @@ public class EnumProperty & StringRepresentable> extends Prope * Create a new EnumProperty with all Enum constants of the given class that match the given Predicate. */ public static & StringRepresentable> EnumProperty create(String name, Class clazz, Predicate filter) { - return create(name, clazz, (Collection)Arrays.stream((Enum[])clazz.getEnumConstants()).filter(filter).collect(Collectors.toList())); + return create(name, clazz, (List)Arrays.stream((Enum[])clazz.getEnumConstants()).filter(filter).collect(Collectors.toList())); } /** * Create a new EnumProperty with the specified values */ + @SafeVarargs public static & StringRepresentable> EnumProperty create(String name, Class clazz, T... values) { - return create(name, clazz, Lists.newArrayList(values)); + return create(name, clazz, List.of(values)); } - /** - * Create a new EnumProperty with the specified values - */ - public static & StringRepresentable> EnumProperty create(String name, Class clazz, Collection values) { - return new EnumProperty<>(name, clazz, values); + public static & StringRepresentable> EnumProperty create(String string, Class class_, List list) { + return new EnumProperty<>(string, class_, list); } } diff --git a/net/minecraft/world/level/block/state/properties/IntegerProperty.java b/net/minecraft/world/level/block/state/properties/IntegerProperty.java index efd5fed3..a5825a96 100644 --- a/net/minecraft/world/level/block/state/properties/IntegerProperty.java +++ b/net/minecraft/world/level/block/state/properties/IntegerProperty.java @@ -1,17 +1,16 @@ package net.minecraft.world.level.block.state.properties; -import com.google.common.collect.ImmutableSet; -import com.google.common.collect.Sets; -import java.util.Collection; +import it.unimi.dsi.fastutil.ints.IntImmutableList; +import java.util.List; import java.util.Optional; -import java.util.Set; +import java.util.stream.IntStream; -public class IntegerProperty extends Property { - private final ImmutableSet values; +public final class IntegerProperty extends Property { + private final IntImmutableList values; private final int min; private final int max; - protected IntegerProperty(String name, int min, int max) { + private IntegerProperty(String name, int min, int max) { super(name, Integer.class); if (min < 0) { throw new IllegalArgumentException("Min value of " + name + " must be 0 or greater"); @@ -20,18 +19,12 @@ public class IntegerProperty extends Property { } else { this.min = min; this.max = max; - Set set = Sets.newHashSet(); - - for (int i = min; i <= max; i++) { - set.add(i); - } - - this.values = ImmutableSet.copyOf(set); + this.values = IntImmutableList.toList(IntStream.range(min, max + 1)); } } @Override - public Collection getPossibleValues() { + public List getPossibleValues() { return this.values; } @@ -56,8 +49,8 @@ public class IntegerProperty extends Property { @Override public Optional getValue(String value) { try { - Integer integer = Integer.valueOf(value); - return integer >= this.min && integer <= this.max ? Optional.of(integer) : Optional.empty(); + int i = Integer.parseInt(value); + return i >= this.min && i <= this.max ? Optional.of(i) : Optional.empty(); } catch (NumberFormatException var3) { return Optional.empty(); } @@ -69,4 +62,8 @@ public class IntegerProperty extends Property { public String getName(Integer value) { return value.toString(); } + + public int getInternalIndex(Integer integer) { + return integer <= this.max ? integer - this.min : -1; + } } diff --git a/net/minecraft/world/level/block/state/properties/Property.java b/net/minecraft/world/level/block/state/properties/Property.java index d3b013fe..d903b2ce 100644 --- a/net/minecraft/world/level/block/state/properties/Property.java +++ b/net/minecraft/world/level/block/state/properties/Property.java @@ -4,7 +4,7 @@ import com.google.common.base.MoreObjects; import com.mojang.serialization.Codec; import com.mojang.serialization.DataResult; import com.mojang.serialization.DynamicOps; -import java.util.Collection; +import java.util.List; import java.util.Optional; import java.util.stream.Stream; import net.minecraft.world.level.block.state.StateHolder; @@ -60,7 +60,7 @@ public abstract class Property> { return this.clazz; } - public abstract Collection getPossibleValues(); + public abstract List getPossibleValues(); /** * @return the name for the given value. @@ -69,6 +69,8 @@ public abstract class Property> { public abstract Optional getValue(String value); + public abstract int getInternalIndex(T comparable); + public String toString() { return MoreObjects.toStringHelper(this).add("name", this.name).add("clazz", this.clazz).add("values", this.getPossibleValues()).toString(); } diff --git a/net/minecraft/world/level/block/state/properties/RailShape.java b/net/minecraft/world/level/block/state/properties/RailShape.java index 44203490..818b0083 100644 --- a/net/minecraft/world/level/block/state/properties/RailShape.java +++ b/net/minecraft/world/level/block/state/properties/RailShape.java @@ -28,7 +28,7 @@ public enum RailShape implements StringRepresentable { return this.name; } - public boolean isAscending() { + public boolean isSlope() { return this == ASCENDING_NORTH || this == ASCENDING_EAST || this == ASCENDING_SOUTH || this == ASCENDING_WEST; } diff --git a/net/minecraft/world/level/block/state/properties/WoodType.java b/net/minecraft/world/level/block/state/properties/WoodType.java index 11a53e69..0dd9eef6 100644 --- a/net/minecraft/world/level/block/state/properties/WoodType.java +++ b/net/minecraft/world/level/block/state/properties/WoodType.java @@ -29,6 +29,7 @@ public record WoodType( ); public static final WoodType JUNGLE = register(new WoodType("jungle", BlockSetType.JUNGLE)); public static final WoodType DARK_OAK = register(new WoodType("dark_oak", BlockSetType.DARK_OAK)); + public static final WoodType PALE_OAK = register(new WoodType("pale_oak", BlockSetType.PALE_OAK)); public static final WoodType CRIMSON = register( new WoodType( "crimson", diff --git a/net/minecraft/world/level/border/WorldBorder.java b/net/minecraft/world/level/border/WorldBorder.java index 7e51be49..ea9cf75c 100644 --- a/net/minecraft/world/level/border/WorldBorder.java +++ b/net/minecraft/world/level/border/WorldBorder.java @@ -66,7 +66,15 @@ public class WorldBorder { } public BlockPos clampToBounds(double x, double y, double z) { - return BlockPos.containing(Mth.clamp(x, this.getMinX(), this.getMaxX() - 1.0), y, Mth.clamp(z, this.getMinZ(), this.getMaxZ() - 1.0)); + return BlockPos.containing(this.clampVec3ToBound(x, y, z)); + } + + public Vec3 clampVec3ToBound(Vec3 vec3) { + return this.clampVec3ToBound(vec3.x, vec3.y, vec3.z); + } + + public Vec3 clampVec3ToBound(double d, double e, double f) { + return new Vec3(Mth.clamp(d, this.getMinX(), this.getMaxX() - 1.0E-5F), e, Mth.clamp(f, this.getMinZ(), this.getMaxZ() - 1.0E-5F)); } public double getDistanceToBorder(Entity entity) { diff --git a/net/minecraft/world/level/chunk/ChunkAccess.java b/net/minecraft/world/level/chunk/ChunkAccess.java index 163a18e1..302f98b6 100644 --- a/net/minecraft/world/level/chunk/ChunkAccess.java +++ b/net/minecraft/world/level/chunk/ChunkAccess.java @@ -11,6 +11,7 @@ import it.unimi.dsi.fastutil.shorts.ShortList; import java.util.Collection; import java.util.Collections; import java.util.EnumSet; +import java.util.List; import java.util.Map; import java.util.Set; import java.util.Map.Entry; @@ -32,14 +33,13 @@ import net.minecraft.core.SectionPos; import net.minecraft.nbt.CompoundTag; import net.minecraft.util.Mth; import net.minecraft.world.entity.Entity; -import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.ChunkPos; import net.minecraft.world.level.LevelHeightAccessor; import net.minecraft.world.level.biome.Biome; import net.minecraft.world.level.biome.BiomeGenerationSettings; -import net.minecraft.world.level.biome.BiomeManager; import net.minecraft.world.level.biome.BiomeResolver; import net.minecraft.world.level.biome.Climate; +import net.minecraft.world.level.biome.BiomeManager.NoiseBiomeSource; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.state.BlockState; @@ -53,17 +53,17 @@ import net.minecraft.world.level.levelgen.structure.Structure; import net.minecraft.world.level.levelgen.structure.StructureStart; import net.minecraft.world.level.lighting.ChunkSkyLightSources; import net.minecraft.world.level.material.Fluid; -import net.minecraft.world.ticks.SerializableTickContainer; +import net.minecraft.world.ticks.SavedTick; import net.minecraft.world.ticks.TickContainerAccess; import org.jetbrains.annotations.Nullable; import org.slf4j.Logger; -public abstract class ChunkAccess implements BlockGetter, BiomeManager.NoiseBiomeSource, LightChunk, StructureAccess { +public abstract class ChunkAccess implements NoiseBiomeSource, LightChunk, StructureAccess { public static final int NO_FILLED_SECTION = -1; private static final Logger LOGGER = LogUtils.getLogger(); private static final LongSet EMPTY_REFERENCE_SET = new LongOpenHashSet(); protected final ShortList[] postProcessing; - protected volatile boolean unsaved; + private volatile boolean unsaved; private volatile boolean isLightCorrect; protected final ChunkPos chunkPos; private long inhabitedTime; @@ -149,7 +149,7 @@ public abstract class ChunkAccess implements BlockGetter, BiomeManager.NoiseBiom ) public int getHighestSectionPosition() { int i = this.getHighestFilledSectionIndex(); - return i == -1 ? this.getMinBuildHeight() : SectionPos.sectionToBlockCoord(this.getSectionYFromSectionIndex(i)); + return i == -1 ? this.getMinY() : SectionPos.sectionToBlockCoord(this.getSectionYFromSectionIndex(i)); } public Set getBlockEntitiesPos() { @@ -209,7 +209,7 @@ public abstract class ChunkAccess implements BlockGetter, BiomeManager.NoiseBiom @Override public void setStartForStructure(Structure structure, StructureStart structureStart) { this.structureStarts.put(structure, structureStart); - this.unsaved = true; + this.markUnsaved(); } public Map getAllStarts() { @@ -219,7 +219,7 @@ public abstract class ChunkAccess implements BlockGetter, BiomeManager.NoiseBiom public void setAllStarts(Map structureStarts) { this.structureStarts.clear(); this.structureStarts.putAll(structureStarts); - this.unsaved = true; + this.markUnsaved(); } @Override @@ -230,7 +230,7 @@ public abstract class ChunkAccess implements BlockGetter, BiomeManager.NoiseBiom @Override public void addReferenceForStructure(Structure structure, long reference) { ((LongSet)this.structuresRefences.computeIfAbsent(structure, structurex -> new LongOpenHashSet())).add(reference); - this.unsaved = true; + this.markUnsaved(); } @Override @@ -242,16 +242,16 @@ public abstract class ChunkAccess implements BlockGetter, BiomeManager.NoiseBiom public void setAllReferences(Map structureReferencesMap) { this.structuresRefences.clear(); this.structuresRefences.putAll(structureReferencesMap); - this.unsaved = true; + this.markUnsaved(); } public boolean isYSpaceEmpty(int startY, int endY) { - if (startY < this.getMinBuildHeight()) { - startY = this.getMinBuildHeight(); + if (startY < this.getMinY()) { + startY = this.getMinY(); } - if (endY >= this.getMaxBuildHeight()) { - endY = this.getMaxBuildHeight() - 1; + if (endY > this.getMaxY()) { + endY = this.getMaxY(); } for (int i = startY; i <= endY; i += 16) { @@ -267,8 +267,17 @@ public abstract class ChunkAccess implements BlockGetter, BiomeManager.NoiseBiom return this.getSection(this.getSectionIndexFromSectionY(y)).hasOnlyAir(); } - public void setUnsaved(boolean unsaved) { - this.unsaved = unsaved; + public void markUnsaved() { + this.unsaved = true; + } + + public boolean tryMarkSaved() { + if (this.unsaved) { + this.unsaved = false; + return true; + } else { + return false; + } } public boolean isUnsaved() { @@ -298,8 +307,8 @@ public abstract class ChunkAccess implements BlockGetter, BiomeManager.NoiseBiom return this.postProcessing; } - public void addPackedPostProcess(short packedPosition, int index) { - getOrCreateOffsetList(this.getPostProcessing(), index).add(packedPosition); + public void addPackedPostProcess(ShortList shortList, int i) { + getOrCreateOffsetList(this.getPostProcessing(), i).addAll(shortList); } public void setBlockEntityNbt(CompoundTag tag) { @@ -322,7 +331,7 @@ public abstract class ChunkAccess implements BlockGetter, BiomeManager.NoiseBiom public void findBlocks(Predicate predicate, BiConsumer output) { BlockPos.MutableBlockPos mutableBlockPos = new BlockPos.MutableBlockPos(); - for (int i = this.getMinSection(); i < this.getMaxSection(); i++) { + for (int i = this.getMinSectionY(); i <= this.getMaxSectionY(); i++) { LevelChunkSection levelChunkSection = this.getSection(this.getSectionIndexFromSectionY(i)); if (levelChunkSection.maybeHas(predicate)) { BlockPos blockPos = SectionPos.of(this.chunkPos, i).origin(); @@ -345,7 +354,11 @@ public abstract class ChunkAccess implements BlockGetter, BiomeManager.NoiseBiom public abstract TickContainerAccess getFluidTicks(); - public abstract ChunkAccess.TicksToSave getTicksForSerialization(); + public boolean canBeSerialized() { + return true; + } + + public abstract ChunkAccess.PackedTicks getTicksForSerialization(long l); public UpgradeData getUpgradeData() { return this.upgradeData; @@ -360,10 +373,6 @@ public abstract class ChunkAccess implements BlockGetter, BiomeManager.NoiseBiom return this.blendingData; } - public void setBlendingData(BlendingData blendingData) { - this.blendingData = blendingData; - } - public long getInhabitedTime() { return this.inhabitedTime; } @@ -390,12 +399,12 @@ public abstract class ChunkAccess implements BlockGetter, BiomeManager.NoiseBiom public void setLightCorrect(boolean lightCorrect) { this.isLightCorrect = lightCorrect; - this.setUnsaved(true); + this.markUnsaved(); } @Override - public int getMinBuildHeight() { - return this.levelHeightAccessor.getMinBuildHeight(); + public int getMinY() { + return this.levelHeightAccessor.getMinY(); } @Override @@ -423,7 +432,7 @@ public abstract class ChunkAccess implements BlockGetter, BiomeManager.NoiseBiom @Override public Holder getNoiseBiome(int i, int j, int k) { try { - int l = QuartPos.fromBlock(this.getMinBuildHeight()); + int l = QuartPos.fromBlock(this.getMinY()); int m = l + QuartPos.fromBlock(this.getHeight()) - 1; int n = Mth.clamp(j, l, m); int o = this.getSectionIndex(QuartPos.toBlock(n)); @@ -442,7 +451,7 @@ public abstract class ChunkAccess implements BlockGetter, BiomeManager.NoiseBiom int j = QuartPos.fromBlock(chunkPos.getMinBlockZ()); LevelHeightAccessor levelHeightAccessor = this.getHeightAccessorForGeneration(); - for (int k = levelHeightAccessor.getMinSection(); k < levelHeightAccessor.getMaxSection(); k++) { + for (int k = levelHeightAccessor.getMinSectionY(); k <= levelHeightAccessor.getMaxSectionY(); k++) { LevelChunkSection levelChunkSection = this.getSection(this.getSectionIndexFromSectionY(k)); int l = QuartPos.fromSection(k); levelChunkSection.fillBiomesFromNoise(resolver, sampler, i, l, j); @@ -475,6 +484,6 @@ public abstract class ChunkAccess implements BlockGetter, BiomeManager.NoiseBiom return this.skyLightSources; } - public record TicksToSave(SerializableTickContainer blocks, SerializableTickContainer fluids) { + public record PackedTicks(List> blocks, List> fluids) { } } diff --git a/net/minecraft/world/level/chunk/ChunkGenerator.java b/net/minecraft/world/level/chunk/ChunkGenerator.java index 808231b8..b80697bc 100644 --- a/net/minecraft/world/level/chunk/ChunkGenerator.java +++ b/net/minecraft/world/level/chunk/ChunkGenerator.java @@ -54,7 +54,8 @@ import net.minecraft.world.level.biome.BiomeGenerationSettings; import net.minecraft.world.level.biome.BiomeManager; import net.minecraft.world.level.biome.BiomeSource; import net.minecraft.world.level.biome.FeatureSorter; -import net.minecraft.world.level.biome.MobSpawnSettings; +import net.minecraft.world.level.biome.FeatureSorter.StepFeatureData; +import net.minecraft.world.level.biome.MobSpawnSettings.SpawnerData; import net.minecraft.world.level.chunk.status.ChunkStatus; import net.minecraft.world.level.levelgen.GenerationStep; import net.minecraft.world.level.levelgen.Heightmap; @@ -71,6 +72,7 @@ import net.minecraft.world.level.levelgen.structure.StructureCheckResult; import net.minecraft.world.level.levelgen.structure.StructureSet; import net.minecraft.world.level.levelgen.structure.StructureSpawnOverride; import net.minecraft.world.level.levelgen.structure.StructureStart; +import net.minecraft.world.level.levelgen.structure.StructureSet.StructureSelectionEntry; import net.minecraft.world.level.levelgen.structure.placement.ConcentricRingsStructurePlacement; import net.minecraft.world.level.levelgen.structure.placement.RandomSpreadStructurePlacement; import net.minecraft.world.level.levelgen.structure.placement.StructurePlacement; @@ -81,7 +83,7 @@ import org.jetbrains.annotations.Nullable; public abstract class ChunkGenerator { public static final Codec CODEC = BuiltInRegistries.CHUNK_GENERATOR.byNameCodec().dispatchStable(ChunkGenerator::codec, Function.identity()); protected final BiomeSource biomeSource; - private final Supplier> featuresPerStep; + private final Supplier> featuresPerStep; private final Function, BiomeGenerationSettings> generationSettingsGetter; public ChunkGenerator(BiomeSource biomeSource) { @@ -113,20 +115,14 @@ public abstract class ChunkGenerator { } public CompletableFuture createBiomes(RandomState randomState, Blender blender, StructureManager structureManager, ChunkAccess chunk) { - return CompletableFuture.supplyAsync(Util.wrapThreadWithTaskName("init_biomes", (Supplier)(() -> { + return CompletableFuture.supplyAsync(() -> { chunk.fillBiomesFromNoise(this.biomeSource, randomState.sampler()); return chunk; - })), Util.backgroundExecutor()); + }, Util.backgroundExecutor().forName("init_biomes")); } public abstract void applyCarvers( - WorldGenRegion level, - long seed, - RandomState random, - BiomeManager biomeManager, - StructureManager structureManager, - ChunkAccess chunk, - GenerationStep.Carving step + WorldGenRegion worldGenRegion, long l, RandomState randomState, BiomeManager biomeManager, StructureManager structureManager, ChunkAccess chunkAccess ); @Nullable @@ -318,11 +314,11 @@ public abstract class ChunkGenerator { public void applyBiomeDecoration(WorldGenLevel level, ChunkAccess chunk, StructureManager structureManager) { ChunkPos chunkPos = chunk.getPos(); if (!SharedConstants.debugVoidTerrain(chunkPos)) { - SectionPos sectionPos = SectionPos.of(chunkPos, level.getMinSection()); + SectionPos sectionPos = SectionPos.of(chunkPos, level.getMinSectionY()); BlockPos blockPos = sectionPos.origin(); - Registry registry = level.registryAccess().registryOrThrow(Registries.STRUCTURE); + Registry registry = level.registryAccess().lookupOrThrow(Registries.STRUCTURE); Map> map = (Map>)registry.stream().collect(Collectors.groupingBy(structure -> structure.step().ordinal())); - List list = (List)this.featuresPerStep.get(); + List list = (List)this.featuresPerStep.get(); WorldgenRandom worldgenRandom = new WorldgenRandom(new XoroshiroRandomSource(RandomSupport.generateUniqueSeed())); long l = worldgenRandom.setDecorationSeed(level.getSeed(), blockPos.getX(), blockPos.getZ()); Set> set = new ObjectArraySet<>(); @@ -337,7 +333,7 @@ public abstract class ChunkGenerator { int i = list.size(); try { - Registry registry2 = level.registryAccess().registryOrThrow(Registries.PLACED_FEATURE); + Registry registry2 = level.registryAccess().lookupOrThrow(Registries.PLACED_FEATURE); int j = Math.max(GenerationStep.Decoration.values().length, i); for (int k = 0; k < j; k++) { @@ -368,7 +364,7 @@ public abstract class ChunkGenerator { List> list3 = ((BiomeGenerationSettings)this.generationSettingsGetter.apply(holder)).features(); if (k < list3.size()) { HolderSet holderSet = (HolderSet)list3.get(k); - FeatureSorter.StepFeatureData stepFeatureData = (FeatureSorter.StepFeatureData)list.get(k); + StepFeatureData stepFeatureData = (StepFeatureData)list.get(k); holderSet.stream().map(Holder::value).forEach(placedFeaturex -> intSet.add(stepFeatureData.indexMapping().applyAsInt(placedFeaturex))); } } @@ -376,7 +372,7 @@ public abstract class ChunkGenerator { int n = intSet.size(); int[] is = intSet.toIntArray(); Arrays.sort(is); - FeatureSorter.StepFeatureData stepFeatureData2 = (FeatureSorter.StepFeatureData)list.get(k); + StepFeatureData stepFeatureData2 = (StepFeatureData)list.get(k); for (int o = 0; o < n; o++) { int p = is[o]; @@ -410,8 +406,8 @@ public abstract class ChunkGenerator { int i = chunkPos.getMinBlockX(); int j = chunkPos.getMinBlockZ(); LevelHeightAccessor levelHeightAccessor = chunk.getHeightAccessorForGeneration(); - int k = levelHeightAccessor.getMinBuildHeight() + 1; - int l = levelHeightAccessor.getMaxBuildHeight() - 1; + int k = levelHeightAccessor.getMinY() + 1; + int l = levelHeightAccessor.getMaxY(); return new BoundingBox(i, k, j, i + 15, l, j + 15); } @@ -429,7 +425,7 @@ public abstract class ChunkGenerator { public abstract int getGenDepth(); - public WeightedRandomList getMobsAt(Holder biome, StructureManager structureManager, MobCategory category, BlockPos pos) { + public WeightedRandomList getMobsAt(Holder biome, StructureManager structureManager, MobCategory category, BlockPos pos) { Map map = structureManager.getAllStructuresAt(pos); for (Entry entry : map.entrySet()) { @@ -468,9 +464,9 @@ public abstract class ChunkGenerator { .forEach( holder -> { StructurePlacement structurePlacement = ((StructureSet)holder.value()).placement(); - List list = ((StructureSet)holder.value()).structures(); + List list = ((StructureSet)holder.value()).structures(); - for (StructureSet.StructureSelectionEntry structureSelectionEntry : list) { + for (StructureSelectionEntry structureSelectionEntry : list) { StructureStart structureStart = structureManager.getStartForStructure(sectionPos, structureSelectionEntry.structure().value(), chunk); if (structureStart != null && structureStart.isValid()) { return; @@ -480,7 +476,7 @@ public abstract class ChunkGenerator { if (structurePlacement.isStructureChunk(structureState, chunkPos.x, chunkPos.z)) { if (list.size() == 1) { this.tryGenerateStructure( - (StructureSet.StructureSelectionEntry)list.get(0), + (StructureSelectionEntry)list.get(0), structureManager, registryAccess, randomState, @@ -491,13 +487,13 @@ public abstract class ChunkGenerator { sectionPos ); } else { - ArrayList arrayList = new ArrayList(list.size()); + ArrayList arrayList = new ArrayList(list.size()); arrayList.addAll(list); WorldgenRandom worldgenRandom = new WorldgenRandom(new LegacyRandomSource(0L)); worldgenRandom.setLargeFeatureSeed(structureState.getLevelSeed(), chunkPos.x, chunkPos.z); int i = 0; - for (StructureSet.StructureSelectionEntry structureSelectionEntry2 : arrayList) { + for (StructureSelectionEntry structureSelectionEntry2 : arrayList) { i += structureSelectionEntry2.weight(); } @@ -505,7 +501,7 @@ public abstract class ChunkGenerator { int j = worldgenRandom.nextInt(i); int k = 0; - for (StructureSet.StructureSelectionEntry structureSelectionEntry3 : arrayList) { + for (StructureSelectionEntry structureSelectionEntry3 : arrayList) { j -= structureSelectionEntry3.weight(); if (j < 0) { break; @@ -514,7 +510,7 @@ public abstract class ChunkGenerator { k++; } - StructureSet.StructureSelectionEntry structureSelectionEntry4 = (StructureSet.StructureSelectionEntry)arrayList.get(k); + StructureSelectionEntry structureSelectionEntry4 = (StructureSelectionEntry)arrayList.get(k); if (this.tryGenerateStructure( structureSelectionEntry4, structureManager, @@ -539,7 +535,7 @@ public abstract class ChunkGenerator { } private boolean tryGenerateStructure( - StructureSet.StructureSelectionEntry structureSelectionEntry, + StructureSelectionEntry structureSelectionEntry, StructureManager structureManager, RegistryAccess registryAccess, RandomState random, @@ -591,7 +587,7 @@ public abstract class ChunkGenerator { } catch (Exception var21) { CrashReport crashReport = CrashReport.forThrowable(var21, "Generating structure reference"); CrashReportCategory crashReportCategory = crashReport.addCategory("Structure"); - Optional> optional = level.registryAccess().registry(Registries.STRUCTURE); + Optional> optional = level.registryAccess().lookup(Registries.STRUCTURE); crashReportCategory.setDetail( "Id", (CrashReportDetail)(() -> (String)optional.map(registry -> registry.getKey(structureStart.getStructure()).toString()).orElse("UNKNOWN")) ); diff --git a/net/minecraft/world/level/chunk/ChunkGeneratorStructureState.java b/net/minecraft/world/level/chunk/ChunkGeneratorStructureState.java index 4537d11e..cc4f3959 100644 --- a/net/minecraft/world/level/chunk/ChunkGeneratorStructureState.java +++ b/net/minecraft/world/level/chunk/ChunkGeneratorStructureState.java @@ -26,6 +26,7 @@ import net.minecraft.world.level.biome.BiomeSource; import net.minecraft.world.level.levelgen.RandomState; import net.minecraft.world.level.levelgen.structure.Structure; import net.minecraft.world.level.levelgen.structure.StructureSet; +import net.minecraft.world.level.levelgen.structure.StructureSet.StructureSelectionEntry; import net.minecraft.world.level.levelgen.structure.placement.ConcentricRingsStructurePlacement; import net.minecraft.world.level.levelgen.structure.placement.StructurePlacement; import org.jetbrains.annotations.Nullable; @@ -86,7 +87,7 @@ public class ChunkGeneratorStructureState { StructureSet structureSet = (StructureSet)holder.value(); boolean bl = false; - for (StructureSet.StructureSelectionEntry structureSelectionEntry : structureSet.structures()) { + for (StructureSelectionEntry structureSelectionEntry : structureSet.structures()) { Structure structure = structureSelectionEntry.structure().value(); if (structure.biomes().stream().anyMatch(set::contains)) { ((List)this.placementsForStructure.computeIfAbsent(structure, structurex -> new ArrayList())).add(structureSet.placement()); @@ -135,7 +136,7 @@ public class ChunkGeneratorStructureState { return new ChunkPos(o, p); } }, - Util.backgroundExecutor() + Util.backgroundExecutor().forName("structureRings") ) ); d += (Math.PI * 2) / k; diff --git a/net/minecraft/world/level/chunk/ChunkSource.java b/net/minecraft/world/level/chunk/ChunkSource.java index d86cd632..35d0cea2 100644 --- a/net/minecraft/world/level/chunk/ChunkSource.java +++ b/net/minecraft/world/level/chunk/ChunkSource.java @@ -36,6 +36,9 @@ public abstract class ChunkSource implements LightChunkGetter, AutoCloseable { public abstract void tick(BooleanSupplier hasTimeLeft, boolean tickChunks); + public void onSectionEmptinessChanged(int i, int j, int k, boolean bl) { + } + /** * @return A human-readable string representing data about this chunk source. */ @@ -48,7 +51,7 @@ public abstract class ChunkSource implements LightChunkGetter, AutoCloseable { public abstract LevelLightEngine getLightEngine(); - public void setSpawnSettings(boolean hostile, boolean peaceful) { + public void setSpawnSettings(boolean bl) { } public void updateChunkForced(ChunkPos pos, boolean add) { diff --git a/net/minecraft/world/level/chunk/GlobalPalette.java b/net/minecraft/world/level/chunk/GlobalPalette.java index d587236b..74a6a1f8 100644 --- a/net/minecraft/world/level/chunk/GlobalPalette.java +++ b/net/minecraft/world/level/chunk/GlobalPalette.java @@ -56,7 +56,7 @@ public class GlobalPalette implements Palette { } @Override - public Palette copy() { + public Palette copy(PaletteResize paletteResize) { return this; } } diff --git a/net/minecraft/world/level/chunk/HashMapPalette.java b/net/minecraft/world/level/chunk/HashMapPalette.java index 7f549b05..5d2173c8 100644 --- a/net/minecraft/world/level/chunk/HashMapPalette.java +++ b/net/minecraft/world/level/chunk/HashMapPalette.java @@ -111,7 +111,7 @@ public class HashMapPalette implements Palette { } @Override - public Palette copy() { - return new HashMapPalette<>(this.registry, this.bits, this.resizeHandler, this.values.copy()); + public Palette copy(PaletteResize paletteResize) { + return new HashMapPalette<>(this.registry, this.bits, paletteResize, this.values.copy()); } } diff --git a/net/minecraft/world/level/chunk/ImposterProtoChunk.java b/net/minecraft/world/level/chunk/ImposterProtoChunk.java index 8373e663..003015ff 100644 --- a/net/minecraft/world/level/chunk/ImposterProtoChunk.java +++ b/net/minecraft/world/level/chunk/ImposterProtoChunk.java @@ -19,7 +19,6 @@ import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.chunk.status.ChunkStatus; -import net.minecraft.world.level.levelgen.GenerationStep; import net.minecraft.world.level.levelgen.Heightmap; import net.minecraft.world.level.levelgen.blending.BlendingData; import net.minecraft.world.level.levelgen.structure.Structure; @@ -43,7 +42,7 @@ public class ImposterProtoChunk extends ProtoChunk { wrapped.getPos(), UpgradeData.EMPTY, wrapped.levelHeightAccessor, - wrapped.getLevel().registryAccess().registryOrThrow(Registries.BIOME), + wrapped.getLevel().registryAccess().lookupOrThrow(Registries.BIOME), wrapped.getBlendingData() ); this.wrapped = wrapped; @@ -66,11 +65,6 @@ public class ImposterProtoChunk extends ProtoChunk { return this.wrapped.getFluidState(pos); } - @Override - public int getMaxLightLevel() { - return this.wrapped.getMaxLightLevel(); - } - @Override public LevelChunkSection getSection(int index) { return this.allowWrites ? this.wrapped.getSection(index) : super.getSection(index); @@ -178,8 +172,18 @@ public class ImposterProtoChunk extends ProtoChunk { } @Override - public void setUnsaved(boolean unsaved) { - this.wrapped.setUnsaved(unsaved); + public void markUnsaved() { + this.wrapped.markUnsaved(); + } + + @Override + public boolean canBeSerialized() { + return false; + } + + @Override + public boolean tryMarkSaved() { + return false; } @Override @@ -232,8 +236,8 @@ public class ImposterProtoChunk extends ProtoChunk { } @Override - public ChunkAccess.TicksToSave getTicksForSerialization() { - return this.wrapped.getTicksForSerialization(); + public ChunkAccess.PackedTicks getTicksForSerialization(long l) { + return this.wrapped.getTicksForSerialization(l); } @Nullable @@ -243,23 +247,18 @@ public class ImposterProtoChunk extends ProtoChunk { } @Override - public void setBlendingData(BlendingData blendingData) { - this.wrapped.setBlendingData(blendingData); - } - - @Override - public CarvingMask getCarvingMask(GenerationStep.Carving step) { + public CarvingMask getCarvingMask() { if (this.allowWrites) { - return super.getCarvingMask(step); + return super.getCarvingMask(); } else { throw (UnsupportedOperationException)Util.pauseInIde(new UnsupportedOperationException("Meaningless in this context")); } } @Override - public CarvingMask getOrCreateCarvingMask(GenerationStep.Carving step) { + public CarvingMask getOrCreateCarvingMask() { if (this.allowWrites) { - return super.getOrCreateCarvingMask(step); + return super.getOrCreateCarvingMask(); } else { throw (UnsupportedOperationException)Util.pauseInIde(new UnsupportedOperationException("Meaningless in this context")); } diff --git a/net/minecraft/world/level/chunk/LevelChunk.java b/net/minecraft/world/level/chunk/LevelChunk.java index 38260030..643937bd 100644 --- a/net/minecraft/world/level/chunk/LevelChunk.java +++ b/net/minecraft/world/level/chunk/LevelChunk.java @@ -20,9 +20,10 @@ import net.minecraft.core.SectionPos; import net.minecraft.core.registries.Registries; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.FriendlyByteBuf; -import net.minecraft.network.protocol.game.ClientboundLevelChunkPacketData; +import net.minecraft.network.protocol.game.ClientboundLevelChunkPacketData.BlockEntityTagOutput; import net.minecraft.server.level.FullChunkStatus; import net.minecraft.server.level.ServerLevel; +import net.minecraft.util.profiling.Profiler; import net.minecraft.util.profiling.ProfilerFiller; import net.minecraft.world.entity.Entity; import net.minecraft.world.level.ChunkPos; @@ -84,6 +85,7 @@ public class LevelChunk extends ChunkAccess { private final Int2ObjectMap gameEventListenerRegistrySections; private final LevelChunkTicks blockTicks; private final LevelChunkTicks fluidTicks; + private LevelChunk.UnsavedListener unsavedListener = chunkPos -> {}; public LevelChunk(Level level, ChunkPos pos) { this(level, pos, UpgradeData.EMPTY, new LevelChunkTicks<>(), new LevelChunkTicks<>(), 0L, null, null, null); @@ -100,7 +102,7 @@ public class LevelChunk extends ChunkAccess { @Nullable LevelChunk.PostLoadProcessor postLoad, @Nullable BlendingData blendingData ) { - super(pos, data, level, level.registryAccess().registryOrThrow(Registries.BIOME), inhabitedTime, sections, blendingData); + super(pos, data, level, level.registryAccess().lookupOrThrow(Registries.BIOME), inhabitedTime, sections, blendingData); this.level = level; this.gameEventListenerRegistrySections = new Int2ObjectOpenHashMap<>(); @@ -149,7 +151,23 @@ public class LevelChunk extends ChunkAccess { this.skyLightSources = chunk.skyLightSources; this.setLightCorrect(chunk.isLightCorrect()); - this.unsaved = true; + this.markUnsaved(); + } + + public void setUnsavedListener(LevelChunk.UnsavedListener unsavedListener) { + this.unsavedListener = unsavedListener; + if (this.isUnsaved()) { + unsavedListener.setUnsaved(this.chunkPos); + } + } + + @Override + public void markUnsaved() { + boolean bl = this.isUnsaved(); + super.markUnsaved(); + if (!bl) { + this.unsavedListener.setUnsaved(this.chunkPos); + } } @Override @@ -163,8 +181,8 @@ public class LevelChunk extends ChunkAccess { } @Override - public ChunkAccess.TicksToSave getTicksForSerialization() { - return new ChunkAccess.TicksToSave(this.blockTicks, this.fluidTicks); + public ChunkAccess.PackedTicks getTicksForSerialization(long l) { + return new ChunkAccess.PackedTicks(this.blockTicks.pack(l), this.fluidTicks.pack(l)); } @Override @@ -264,10 +282,11 @@ public class LevelChunk extends ChunkAccess { boolean bl2 = levelChunkSection.hasOnlyAir(); if (bl != bl2) { this.level.getChunkSource().getLightEngine().updateSectionStatus(pos, bl2); + this.level.getChunkSource().onSectionEmptinessChanged(this.chunkPos.x, SectionPos.blockToSectionCoord(i), this.chunkPos.z, bl2); } - if (LightEngine.hasDifferentLightProperties(this, pos, blockState, state)) { - ProfilerFiller profilerFiller = this.level.getProfiler(); + if (LightEngine.hasDifferentLightProperties(blockState, state)) { + ProfilerFiller profilerFiller = Profiler.get(); profilerFiller.push("updateSkyLightSources"); this.skyLightSources.update(this, j, i, l); profilerFiller.popPush("queueCheckLight"); @@ -292,6 +311,7 @@ public class LevelChunk extends ChunkAccess { if (state.hasBlockEntity()) { BlockEntity blockEntity = this.getBlockEntity(pos, LevelChunk.EntityCreationType.CHECK); if (blockEntity != null && !blockEntity.isValidBlockState(state)) { + LOGGER.warn("Found mismatched block entity @ {}: type = {}, state = {}", pos, blockEntity.getType().builtInRegistryHolder().key().location(), state); this.removeBlockEntity(pos); blockEntity = null; } @@ -307,7 +327,7 @@ public class LevelChunk extends ChunkAccess { } } - this.unsaved = true; + this.markUnsaved(); return blockState; } } @@ -484,7 +504,7 @@ public class LevelChunk extends ChunkAccess { return false; } - public void replaceWithPacketData(FriendlyByteBuf buffer, CompoundTag tag, Consumer outputTagConsumer) { + public void replaceWithPacketData(FriendlyByteBuf buffer, CompoundTag tag, Consumer outputTagConsumer) { this.clearAllBlockEntities(); for (LevelChunkSection levelChunkSection : this.sections) { @@ -499,7 +519,7 @@ public class LevelChunk extends ChunkAccess { } this.initializeLightSources(); - outputTagConsumer.accept((ClientboundLevelChunkPacketData.BlockEntityTagOutput)(blockPos, blockEntityType, compoundTag) -> { + outputTagConsumer.accept((BlockEntityTagOutput)(blockPos, blockEntityType, compoundTag) -> { BlockEntity blockEntity = this.getBlockEntity(blockPos, LevelChunk.EntityCreationType.IMMEDIATE); if (blockEntity != null && compoundTag != null && blockEntity.getType() == blockEntityType) { blockEntity.loadWithComponents(compoundTag, this.level.registryAccess()); @@ -525,7 +545,7 @@ public class LevelChunk extends ChunkAccess { return this.blockEntities; } - public void postProcessGeneration() { + public void postProcessGeneration(ServerLevel serverLevel) { ChunkPos chunkPos = this.getPos(); for (int i = 0; i < this.postProcessing.length; i++) { @@ -535,12 +555,14 @@ public class LevelChunk extends ChunkAccess { BlockState blockState = this.getBlockState(blockPos); FluidState fluidState = blockState.getFluidState(); if (!fluidState.isEmpty()) { - fluidState.tick(this.level, blockPos); + fluidState.tick(serverLevel, blockPos, blockState); } if (!(blockState.getBlock() instanceof LiquidBlock)) { - BlockState blockState2 = Block.updateFromNeighbourShapes(blockState, this.level, blockPos); - this.level.setBlock(blockPos, blockState2, 20); + BlockState blockState2 = Block.updateFromNeighbourShapes(blockState, serverLevel, blockPos); + if (blockState2 != blockState) { + serverLevel.setBlock(blockPos, blockState2, 20); + } } } @@ -684,7 +706,7 @@ public class LevelChunk extends ChunkAccess { BlockPos blockPos = this.blockEntity.getBlockPos(); if (LevelChunk.this.isTicking(blockPos)) { try { - ProfilerFiller profilerFiller = LevelChunk.this.level.getProfiler(); + ProfilerFiller profilerFiller = Profiler.get(); profilerFiller.push(this::getType); BlockState blockState = LevelChunk.this.getBlockState(blockPos); if (this.blockEntity.getType().isValid(blockState)) { @@ -772,4 +794,9 @@ public class LevelChunk extends ChunkAccess { return this.ticker + " "; } } + + @FunctionalInterface + public interface UnsavedListener { + void setUnsaved(ChunkPos chunkPos); + } } diff --git a/net/minecraft/world/level/chunk/LevelChunkSection.java b/net/minecraft/world/level/chunk/LevelChunkSection.java index 07cd229c..67463630 100644 --- a/net/minecraft/world/level/chunk/LevelChunkSection.java +++ b/net/minecraft/world/level/chunk/LevelChunkSection.java @@ -24,6 +24,14 @@ public class LevelChunkSection { private final PalettedContainer states; private PalettedContainerRO> biomes; + private LevelChunkSection(LevelChunkSection levelChunkSection) { + this.nonEmptyBlockCount = levelChunkSection.nonEmptyBlockCount; + this.tickingBlockCount = levelChunkSection.tickingBlockCount; + this.tickingFluidCount = levelChunkSection.tickingFluidCount; + this.states = levelChunkSection.states.copy(); + this.biomes = levelChunkSection.biomes.copy(); + } + public LevelChunkSection(PalettedContainer states, PalettedContainerRO> biomes) { this.states = states; this.biomes = biomes; @@ -32,7 +40,7 @@ public class LevelChunkSection { public LevelChunkSection(Registry biomeRegistry) { this.states = new PalettedContainer<>(Block.BLOCK_STATE_REGISTRY, Blocks.AIR.defaultBlockState(), PalettedContainer.Strategy.SECTION_STATES); - this.biomes = new PalettedContainer<>(biomeRegistry.asHolderIdMap(), biomeRegistry.getHolderOrThrow(Biomes.PLAINS), PalettedContainer.Strategy.SECTION_BIOMES); + this.biomes = new PalettedContainer<>(biomeRegistry.asHolderIdMap(), biomeRegistry.getOrThrow(Biomes.PLAINS), PalettedContainer.Strategy.SECTION_BIOMES); } public BlockState getBlockState(int x, int y, int z) { @@ -203,4 +211,8 @@ public class LevelChunkSection { this.biomes = palettedContainer; } + + public LevelChunkSection copy() { + return new LevelChunkSection(this); + } } diff --git a/net/minecraft/world/level/chunk/LinearPalette.java b/net/minecraft/world/level/chunk/LinearPalette.java index 27891aa3..eed86b9e 100644 --- a/net/minecraft/world/level/chunk/LinearPalette.java +++ b/net/minecraft/world/level/chunk/LinearPalette.java @@ -113,7 +113,7 @@ public class LinearPalette implements Palette { } @Override - public Palette copy() { - return new LinearPalette<>(this.registry, (T[])((Object[])this.values.clone()), this.resizeHandler, this.bits, this.size); + public Palette copy(PaletteResize paletteResize) { + return new LinearPalette<>(this.registry, (T[])((Object[])this.values.clone()), paletteResize, this.bits, this.size); } } diff --git a/net/minecraft/world/level/chunk/Palette.java b/net/minecraft/world/level/chunk/Palette.java index 51613269..b33ba747 100644 --- a/net/minecraft/world/level/chunk/Palette.java +++ b/net/minecraft/world/level/chunk/Palette.java @@ -20,7 +20,7 @@ public interface Palette { int getSize(); - Palette copy(); + Palette copy(PaletteResize paletteResize); public interface Factory { Palette create(int i, IdMap idMap, PaletteResize paletteResize, List list); diff --git a/net/minecraft/world/level/chunk/PalettedContainer.java b/net/minecraft/world/level/chunk/PalettedContainer.java index c9894b2b..2fc97bc4 100644 --- a/net/minecraft/world/level/chunk/PalettedContainer.java +++ b/net/minecraft/world/level/chunk/PalettedContainer.java @@ -22,6 +22,9 @@ import net.minecraft.util.Mth; import net.minecraft.util.SimpleBitStorage; import net.minecraft.util.ThreadingDetector; import net.minecraft.util.ZeroBitStorage; +import net.minecraft.util.SimpleBitStorage.InitializationException; +import net.minecraft.world.level.chunk.PalettedContainer.Strategy.1; +import net.minecraft.world.level.chunk.PalettedContainer.Strategy.2; import org.jetbrains.annotations.Nullable; public class PalettedContainer implements PaletteResize, PalettedContainerRO { @@ -78,6 +81,12 @@ public class PalettedContainer implements PaletteResize, PalettedContainer this.data = data; } + private PalettedContainer(PalettedContainer palettedContainer) { + this.registry = palettedContainer.registry; + this.strategy = palettedContainer.strategy; + this.data = palettedContainer.data.copy(this); + } + public PalettedContainer(IdMap registry, T palette, PalettedContainer.Strategy strategy) { this.strategy = strategy; this.registry = registry; @@ -209,7 +218,7 @@ public class PalettedContainer implements PaletteResize, PalettedContainer } else { bitStorage = new SimpleBitStorage(configuration.bits(), i, ls); } - } catch (SimpleBitStorage.InitializationException var13) { + } catch (InitializationException var13) { return DataResult.error(() -> "Failed to read PalettedContainer: " + var13.getMessage()); } } @@ -270,8 +279,9 @@ public class PalettedContainer implements PaletteResize, PalettedContainer return this.data.palette.maybeHas(filter); } + @Override public PalettedContainer copy() { - return new PalettedContainer<>(this.registry, this.strategy, this.data.copy()); + return new PalettedContainer<>(this); } @Override @@ -322,8 +332,8 @@ public class PalettedContainer implements PaletteResize, PalettedContainer buffer.writeLongArray(this.storage.getRaw()); } - public PalettedContainer.Data copy() { - return new PalettedContainer.Data<>(this.configuration, this.storage.copy(), this.palette.copy()); + public PalettedContainer.Data copy(PaletteResize paletteResize) { + return new PalettedContainer.Data<>(this.configuration, this.storage.copy(), this.palette.copy(paletteResize)); } } @@ -332,27 +342,8 @@ public class PalettedContainer implements PaletteResize, PalettedContainer public static final Palette.Factory LINEAR_PALETTE_FACTORY = LinearPalette::create; public static final Palette.Factory HASHMAP_PALETTE_FACTORY = HashMapPalette::create; static final Palette.Factory GLOBAL_PALETTE_FACTORY = GlobalPalette::create; - public static final PalettedContainer.Strategy SECTION_STATES = new PalettedContainer.Strategy(4) { - @Override - public PalettedContainer.Configuration getConfiguration(IdMap registry, int size) { - return switch (size) { - case 0 -> new PalettedContainer.Configuration(SINGLE_VALUE_PALETTE_FACTORY, size); - case 1, 2, 3, 4 -> new PalettedContainer.Configuration(LINEAR_PALETTE_FACTORY, 4); - case 5, 6, 7, 8 -> new PalettedContainer.Configuration(HASHMAP_PALETTE_FACTORY, size); - default -> new PalettedContainer.Configuration(PalettedContainer.Strategy.GLOBAL_PALETTE_FACTORY, Mth.ceillog2(registry.size())); - }; - } - }; - public static final PalettedContainer.Strategy SECTION_BIOMES = new PalettedContainer.Strategy(2) { - @Override - public PalettedContainer.Configuration getConfiguration(IdMap registry, int size) { - return switch (size) { - case 0 -> new PalettedContainer.Configuration(SINGLE_VALUE_PALETTE_FACTORY, size); - case 1, 2, 3 -> new PalettedContainer.Configuration(LINEAR_PALETTE_FACTORY, size); - default -> new PalettedContainer.Configuration(PalettedContainer.Strategy.GLOBAL_PALETTE_FACTORY, Mth.ceillog2(registry.size())); - }; - } - }; + public static final PalettedContainer.Strategy SECTION_STATES = new 1(4); + public static final PalettedContainer.Strategy SECTION_BIOMES = new 2(2); private final int sizeBits; Strategy(int sizeBits) { diff --git a/net/minecraft/world/level/chunk/PalettedContainerRO.java b/net/minecraft/world/level/chunk/PalettedContainerRO.java index eb96dc8e..901e589a 100644 --- a/net/minecraft/world/level/chunk/PalettedContainerRO.java +++ b/net/minecraft/world/level/chunk/PalettedContainerRO.java @@ -22,6 +22,8 @@ public interface PalettedContainerRO { void count(PalettedContainer.CountConsumer countConsumer); + PalettedContainer copy(); + PalettedContainer recreate(); PalettedContainerRO.PackedData pack(IdMap registry, PalettedContainer.Strategy strategy); diff --git a/net/minecraft/world/level/chunk/ProtoChunk.java b/net/minecraft/world/level/chunk/ProtoChunk.java index 93104e30..97eb8395 100644 --- a/net/minecraft/world/level/chunk/ProtoChunk.java +++ b/net/minecraft/world/level/chunk/ProtoChunk.java @@ -1,7 +1,7 @@ package net.minecraft.world.level.chunk; import com.google.common.collect.Lists; -import it.unimi.dsi.fastutil.objects.Object2ObjectArrayMap; +import it.unimi.dsi.fastutil.shorts.ShortList; import java.util.Collections; import java.util.EnumSet; import java.util.List; @@ -22,7 +22,6 @@ import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.chunk.status.ChunkStatus; import net.minecraft.world.level.levelgen.BelowZeroRetrogen; -import net.minecraft.world.level.levelgen.GenerationStep; import net.minecraft.world.level.levelgen.Heightmap; import net.minecraft.world.level.levelgen.blending.BlendingData; import net.minecraft.world.level.levelgen.structure.BoundingBox; @@ -43,7 +42,8 @@ public class ProtoChunk extends ChunkAccess { private volatile LevelLightEngine lightEngine; private volatile ChunkStatus status = ChunkStatus.EMPTY; private final List entities = Lists.newArrayList(); - private final Map carvingMasks = new Object2ObjectArrayMap<>(); + @Nullable + private CarvingMask carvingMask; @Nullable private BelowZeroRetrogen belowZeroRetrogen; private final ProtoChunkTicks blockTicks; @@ -81,8 +81,8 @@ public class ProtoChunk extends ChunkAccess { } @Override - public ChunkAccess.TicksToSave getTicksForSerialization() { - return new ChunkAccess.TicksToSave(this.blockTicks, this.fluidTicks); + public ChunkAccess.PackedTicks getTicksForSerialization(long l) { + return new ChunkAccess.PackedTicks(this.blockTicks.pack(l), this.fluidTicks.pack(l)); } @Override @@ -113,7 +113,9 @@ public class ProtoChunk extends ChunkAccess { int i = pos.getX(); int j = pos.getY(); int k = pos.getZ(); - if (j >= this.getMinBuildHeight() && j < this.getMaxBuildHeight()) { + if (this.isOutsideBuildHeight(j)) { + return Blocks.VOID_AIR.defaultBlockState(); + } else { int l = this.getSectionIndex(j); LevelChunkSection levelChunkSection = this.getSection(l); boolean bl = levelChunkSection.hasOnlyAir(); @@ -130,7 +132,7 @@ public class ProtoChunk extends ChunkAccess { this.lightEngine.updateSectionStatus(pos, bl2); } - if (LightEngine.hasDifferentLightProperties(this, pos, blockState, state)) { + if (LightEngine.hasDifferentLightProperties(blockState, state)) { this.skyLightSources.update(this, m, j, o); this.lightEngine.checkBlock(pos); } @@ -160,8 +162,6 @@ public class ProtoChunk extends ChunkAccess { return blockState; } - } else { - return Blocks.VOID_AIR.defaultBlockState(); } } @@ -199,7 +199,7 @@ public class ProtoChunk extends ChunkAccess { if (belowZeroRetrogen != null && structureStart.isValid()) { BoundingBox boundingBox = structureStart.getBoundingBox(); LevelHeightAccessor levelHeightAccessor = this.getHeightAccessorForGeneration(); - if (boundingBox.minY() < levelHeightAccessor.getMinBuildHeight() || boundingBox.maxY() >= levelHeightAccessor.getMaxBuildHeight()) { + if (boundingBox.minY() < levelHeightAccessor.getMinY() || boundingBox.maxY() > levelHeightAccessor.getMaxY()) { return; } } @@ -222,7 +222,7 @@ public class ProtoChunk extends ChunkAccess { this.setBelowZeroRetrogen(null); } - this.setUnsaved(true); + this.markUnsaved(); } @Override @@ -259,8 +259,8 @@ public class ProtoChunk extends ChunkAccess { } @Override - public void addPackedPostProcess(short packedPosition, int index) { - ChunkAccess.getOrCreateOffsetList(this.postProcessing, index).add(packedPosition); + public void addPackedPostProcess(ShortList shortList, int i) { + ChunkAccess.getOrCreateOffsetList(this.postProcessing, i).addAll(shortList); } public Map getBlockEntityNbts() { @@ -281,16 +281,20 @@ public class ProtoChunk extends ChunkAccess { } @Nullable - public CarvingMask getCarvingMask(GenerationStep.Carving step) { - return (CarvingMask)this.carvingMasks.get(step); + public CarvingMask getCarvingMask() { + return this.carvingMask; } - public CarvingMask getOrCreateCarvingMask(GenerationStep.Carving step) { - return (CarvingMask)this.carvingMasks.computeIfAbsent(step, carving -> new CarvingMask(this.getHeight(), this.getMinBuildHeight())); + public CarvingMask getOrCreateCarvingMask() { + if (this.carvingMask == null) { + this.carvingMask = new CarvingMask(this.getHeight(), this.getMinY()); + } + + return this.carvingMask; } - public void setCarvingMask(GenerationStep.Carving step, CarvingMask carvingMask) { - this.carvingMasks.put(step, carvingMask); + public void setCarvingMask(CarvingMask carvingMask) { + this.carvingMask = carvingMask; } public void setLightEngine(LevelLightEngine lightEngine) { diff --git a/net/minecraft/world/level/chunk/SingleValuePalette.java b/net/minecraft/world/level/chunk/SingleValuePalette.java index e5b3eba6..31dcb570 100644 --- a/net/minecraft/world/level/chunk/SingleValuePalette.java +++ b/net/minecraft/world/level/chunk/SingleValuePalette.java @@ -84,7 +84,7 @@ public class SingleValuePalette implements Palette { } @Override - public Palette copy() { + public Palette copy(PaletteResize paletteResize) { if (this.value == null) { throw new IllegalStateException("Use of an uninitialized palette"); } else { diff --git a/net/minecraft/world/level/chunk/UpgradeData.java b/net/minecraft/world/level/chunk/UpgradeData.java index fc9827ff..53831465 100644 --- a/net/minecraft/world/level/chunk/UpgradeData.java +++ b/net/minecraft/world/level/chunk/UpgradeData.java @@ -3,8 +3,7 @@ package net.minecraft.world.level.chunk; import com.google.common.collect.Lists; import com.google.common.collect.Sets; import com.mojang.logging.LogUtils; -import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; -import it.unimi.dsi.fastutil.objects.ObjectSet; +import it.unimi.dsi.fastutil.ints.IntArrays; import java.util.EnumSet; import java.util.IdentityHashMap; import java.util.List; @@ -28,14 +27,7 @@ import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.LevelHeightAccessor; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; -import net.minecraft.world.level.block.ChestBlock; -import net.minecraft.world.level.block.HorizontalDirectionalBlock; -import net.minecraft.world.level.block.StemBlock; -import net.minecraft.world.level.block.entity.BlockEntity; -import net.minecraft.world.level.block.entity.ChestBlockEntity; import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.world.level.block.state.properties.BlockStateProperties; -import net.minecraft.world.level.block.state.properties.ChestType; import net.minecraft.world.level.material.Fluid; import net.minecraft.world.level.material.Fluids; import net.minecraft.world.ticks.SavedTick; @@ -92,6 +84,18 @@ public class UpgradeData { ); } + private UpgradeData(UpgradeData upgradeData) { + this.sides.addAll(upgradeData.sides); + this.neighborBlockTicks.addAll(upgradeData.neighborBlockTicks); + this.neighborFluidTicks.addAll(upgradeData.neighborFluidTicks); + this.index = new int[upgradeData.index.length][]; + + for (int i = 0; i < upgradeData.index.length; i++) { + int[] is = upgradeData.index[i]; + this.index[i] = is != null ? IntArrays.copy(is) : null; + } + } + private static void loadTicks(CompoundTag tag, String identifier, Function> valueFunction, List> ticks) { if (tag.contains(identifier, 9)) { for (Tag tag2 : tag.getList(identifier, 10)) { @@ -138,7 +142,7 @@ public class UpgradeData { Direction[] directions = Direction.values(); BlockPos.MutableBlockPos mutableBlockPos = new BlockPos.MutableBlockPos(); - for (BlockPos blockPos : BlockPos.betweenClosed(k, level.getMinBuildHeight(), m, l, level.getMaxBuildHeight() - 1, n)) { + for (BlockPos blockPos : BlockPos.betweenClosed(k, level.getMinY(), m, l, level.getMaxY(), n)) { BlockState blockState = level.getBlockState(blockPos); BlockState blockState2 = blockState; @@ -249,6 +253,10 @@ public class UpgradeData { return compoundTag; } + public UpgradeData copy() { + return this == EMPTY ? EMPTY : new UpgradeData(this); + } + public interface BlockFixer { BlockState updateShape(BlockState state, Direction direction, BlockState offsetState, LevelAccessor level, BlockPos pos, BlockPos offsetPos); @@ -258,162 +266,83 @@ public class UpgradeData { static enum BlockFixers implements UpgradeData.BlockFixer { BLACKLIST( - Blocks.OBSERVER, - Blocks.NETHER_PORTAL, - Blocks.WHITE_CONCRETE_POWDER, - Blocks.ORANGE_CONCRETE_POWDER, - Blocks.MAGENTA_CONCRETE_POWDER, - Blocks.LIGHT_BLUE_CONCRETE_POWDER, - Blocks.YELLOW_CONCRETE_POWDER, - Blocks.LIME_CONCRETE_POWDER, - Blocks.PINK_CONCRETE_POWDER, - Blocks.GRAY_CONCRETE_POWDER, - Blocks.LIGHT_GRAY_CONCRETE_POWDER, - Blocks.CYAN_CONCRETE_POWDER, - Blocks.PURPLE_CONCRETE_POWDER, - Blocks.BLUE_CONCRETE_POWDER, - Blocks.BROWN_CONCRETE_POWDER, - Blocks.GREEN_CONCRETE_POWDER, - Blocks.RED_CONCRETE_POWDER, - Blocks.BLACK_CONCRETE_POWDER, - Blocks.ANVIL, - Blocks.CHIPPED_ANVIL, - Blocks.DAMAGED_ANVIL, - Blocks.DRAGON_EGG, - Blocks.GRAVEL, - Blocks.SAND, - Blocks.RED_SAND, - Blocks.OAK_SIGN, - Blocks.SPRUCE_SIGN, - Blocks.BIRCH_SIGN, - Blocks.ACACIA_SIGN, - Blocks.CHERRY_SIGN, - Blocks.JUNGLE_SIGN, - Blocks.DARK_OAK_SIGN, - Blocks.OAK_WALL_SIGN, - Blocks.SPRUCE_WALL_SIGN, - Blocks.BIRCH_WALL_SIGN, - Blocks.ACACIA_WALL_SIGN, - Blocks.JUNGLE_WALL_SIGN, - Blocks.DARK_OAK_WALL_SIGN, - Blocks.OAK_HANGING_SIGN, - Blocks.SPRUCE_HANGING_SIGN, - Blocks.BIRCH_HANGING_SIGN, - Blocks.ACACIA_HANGING_SIGN, - Blocks.JUNGLE_HANGING_SIGN, - Blocks.DARK_OAK_HANGING_SIGN, - Blocks.OAK_WALL_HANGING_SIGN, - Blocks.SPRUCE_WALL_HANGING_SIGN, - Blocks.BIRCH_WALL_HANGING_SIGN, - Blocks.ACACIA_WALL_HANGING_SIGN, - Blocks.JUNGLE_WALL_HANGING_SIGN, - Blocks.DARK_OAK_WALL_HANGING_SIGN - ) { - @Override - public BlockState updateShape(BlockState state, Direction direction, BlockState offsetState, LevelAccessor level, BlockPos pos, BlockPos offsetPos) { - return state; + "BLACKLIST", + 0, + new Block[]{ + Blocks.OBSERVER, + Blocks.NETHER_PORTAL, + Blocks.WHITE_CONCRETE_POWDER, + Blocks.ORANGE_CONCRETE_POWDER, + Blocks.MAGENTA_CONCRETE_POWDER, + Blocks.LIGHT_BLUE_CONCRETE_POWDER, + Blocks.YELLOW_CONCRETE_POWDER, + Blocks.LIME_CONCRETE_POWDER, + Blocks.PINK_CONCRETE_POWDER, + Blocks.GRAY_CONCRETE_POWDER, + Blocks.LIGHT_GRAY_CONCRETE_POWDER, + Blocks.CYAN_CONCRETE_POWDER, + Blocks.PURPLE_CONCRETE_POWDER, + Blocks.BLUE_CONCRETE_POWDER, + Blocks.BROWN_CONCRETE_POWDER, + Blocks.GREEN_CONCRETE_POWDER, + Blocks.RED_CONCRETE_POWDER, + Blocks.BLACK_CONCRETE_POWDER, + Blocks.ANVIL, + Blocks.CHIPPED_ANVIL, + Blocks.DAMAGED_ANVIL, + Blocks.DRAGON_EGG, + Blocks.GRAVEL, + Blocks.SAND, + Blocks.RED_SAND, + Blocks.OAK_SIGN, + Blocks.SPRUCE_SIGN, + Blocks.BIRCH_SIGN, + Blocks.ACACIA_SIGN, + Blocks.CHERRY_SIGN, + Blocks.JUNGLE_SIGN, + Blocks.DARK_OAK_SIGN, + Blocks.PALE_OAK_SIGN, + Blocks.OAK_WALL_SIGN, + Blocks.SPRUCE_WALL_SIGN, + Blocks.BIRCH_WALL_SIGN, + Blocks.ACACIA_WALL_SIGN, + Blocks.JUNGLE_WALL_SIGN, + Blocks.DARK_OAK_WALL_SIGN, + Blocks.PALE_OAK_WALL_SIGN, + Blocks.OAK_HANGING_SIGN, + Blocks.SPRUCE_HANGING_SIGN, + Blocks.BIRCH_HANGING_SIGN, + Blocks.ACACIA_HANGING_SIGN, + Blocks.JUNGLE_HANGING_SIGN, + Blocks.DARK_OAK_HANGING_SIGN, + Blocks.PALE_OAK_HANGING_SIGN, + Blocks.OAK_WALL_HANGING_SIGN, + Blocks.SPRUCE_WALL_HANGING_SIGN, + Blocks.BIRCH_WALL_HANGING_SIGN, + Blocks.ACACIA_WALL_HANGING_SIGN, + Blocks.JUNGLE_WALL_HANGING_SIGN, + Blocks.DARK_OAK_WALL_HANGING_SIGN, + Blocks.PALE_OAK_WALL_HANGING_SIGN } - }, - DEFAULT { - @Override - public BlockState updateShape(BlockState state, Direction direction, BlockState offsetState, LevelAccessor level, BlockPos pos, BlockPos offsetPos) { - return state.updateShape(direction, level.getBlockState(offsetPos), level, pos, offsetPos); - } - }, - CHEST(Blocks.CHEST, Blocks.TRAPPED_CHEST) { - @Override - public BlockState updateShape(BlockState state, Direction direction, BlockState offsetState, LevelAccessor level, BlockPos pos, BlockPos offsetPos) { - if (offsetState.is(state.getBlock()) - && direction.getAxis().isHorizontal() - && state.getValue(ChestBlock.TYPE) == ChestType.SINGLE - && offsetState.getValue(ChestBlock.TYPE) == ChestType.SINGLE) { - Direction direction2 = state.getValue(ChestBlock.FACING); - if (direction.getAxis() != direction2.getAxis() && direction2 == offsetState.getValue(ChestBlock.FACING)) { - ChestType chestType = direction == direction2.getClockWise() ? ChestType.LEFT : ChestType.RIGHT; - level.setBlock(offsetPos, offsetState.setValue(ChestBlock.TYPE, chestType.getOpposite()), 18); - if (direction2 == Direction.NORTH || direction2 == Direction.EAST) { - BlockEntity blockEntity = level.getBlockEntity(pos); - BlockEntity blockEntity2 = level.getBlockEntity(offsetPos); - if (blockEntity instanceof ChestBlockEntity && blockEntity2 instanceof ChestBlockEntity) { - ChestBlockEntity.swapContents((ChestBlockEntity)blockEntity, (ChestBlockEntity)blockEntity2); - } - } - - return state.setValue(ChestBlock.TYPE, chestType); - } - } - - return state; - } - }, + ), + DEFAULT("DEFAULT", 1, new Block[0]), + CHEST("CHEST", 2, new Block[]{Blocks.CHEST, Blocks.TRAPPED_CHEST}), LEAVES( - true, Blocks.ACACIA_LEAVES, Blocks.CHERRY_LEAVES, Blocks.BIRCH_LEAVES, Blocks.DARK_OAK_LEAVES, Blocks.JUNGLE_LEAVES, Blocks.OAK_LEAVES, Blocks.SPRUCE_LEAVES - ) { - private final ThreadLocal>> queue = ThreadLocal.withInitial(() -> Lists.newArrayListWithCapacity(7)); - - @Override - public BlockState updateShape(BlockState state, Direction direction, BlockState offsetState, LevelAccessor level, BlockPos pos, BlockPos offsetPos) { - BlockState blockState = state.updateShape(direction, level.getBlockState(offsetPos), level, pos, offsetPos); - if (state != blockState) { - int i = (Integer)blockState.getValue(BlockStateProperties.DISTANCE); - List> list = (List>)this.queue.get(); - if (list.isEmpty()) { - for (int j = 0; j < 7; j++) { - list.add(new ObjectOpenHashSet()); - } - } - - ((ObjectSet)list.get(i)).add(pos.immutable()); - } - - return state; + "LEAVES", + 3, + true, + new Block[]{ + Blocks.ACACIA_LEAVES, + Blocks.CHERRY_LEAVES, + Blocks.BIRCH_LEAVES, + Blocks.PALE_OAK_LEAVES, + Blocks.DARK_OAK_LEAVES, + Blocks.JUNGLE_LEAVES, + Blocks.OAK_LEAVES, + Blocks.SPRUCE_LEAVES } - - @Override - public void processChunk(LevelAccessor level) { - BlockPos.MutableBlockPos mutableBlockPos = new BlockPos.MutableBlockPos(); - List> list = (List>)this.queue.get(); - - for (int i = 2; i < list.size(); i++) { - int j = i - 1; - ObjectSet objectSet = (ObjectSet)list.get(j); - ObjectSet objectSet2 = (ObjectSet)list.get(i); - - for (BlockPos blockPos : objectSet) { - BlockState blockState = level.getBlockState(blockPos); - if ((Integer)blockState.getValue(BlockStateProperties.DISTANCE) >= j) { - level.setBlock(blockPos, blockState.setValue(BlockStateProperties.DISTANCE, j), 18); - if (i != 7) { - for (Direction direction : DIRECTIONS) { - mutableBlockPos.setWithOffset(blockPos, direction); - BlockState blockState2 = level.getBlockState(mutableBlockPos); - if (blockState2.hasProperty(BlockStateProperties.DISTANCE) && (Integer)blockState.getValue(BlockStateProperties.DISTANCE) > i) { - objectSet2.add(mutableBlockPos.immutable()); - } - } - } - } - } - } - - list.clear(); - } - }, - STEM_BLOCK(Blocks.MELON_STEM, Blocks.PUMPKIN_STEM) { - @Override - public BlockState updateShape(BlockState state, Direction direction, BlockState offsetState, LevelAccessor level, BlockPos pos, BlockPos offsetPos) { - if ((Integer)state.getValue(StemBlock.AGE) == 7) { - Block block = state.is(Blocks.PUMPKIN_STEM) ? Blocks.PUMPKIN : Blocks.MELON; - if (offsetState.is(block)) { - return (state.is(Blocks.PUMPKIN_STEM) ? Blocks.ATTACHED_PUMPKIN_STEM : Blocks.ATTACHED_MELON_STEM) - .defaultBlockState() - .setValue(HorizontalDirectionalBlock.FACING, direction); - } - } - - return state; - } - }; + ), + STEM_BLOCK("STEM_BLOCK", 4, new Block[]{Blocks.MELON_STEM, Blocks.PUMPKIN_STEM}); public static final Direction[] DIRECTIONS = Direction.values(); diff --git a/net/minecraft/world/level/chunk/status/ChunkStatus.java b/net/minecraft/world/level/chunk/status/ChunkStatus.java index 82724ca1..53f97756 100644 --- a/net/minecraft/world/level/chunk/status/ChunkStatus.java +++ b/net/minecraft/world/level/chunk/status/ChunkStatus.java @@ -72,7 +72,7 @@ public class ChunkStatus { } public static ChunkStatus byName(String name) { - return BuiltInRegistries.CHUNK_STATUS.get(ResourceLocation.tryParse(name)); + return BuiltInRegistries.CHUNK_STATUS.getValue(ResourceLocation.tryParse(name)); } public EnumSet heightmapsAfter() { diff --git a/net/minecraft/world/level/chunk/status/ChunkStatusTasks.java b/net/minecraft/world/level/chunk/status/ChunkStatusTasks.java index 8c2b86b4..c8abf3c6 100644 --- a/net/minecraft/world/level/chunk/status/ChunkStatusTasks.java +++ b/net/minecraft/world/level/chunk/status/ChunkStatusTasks.java @@ -4,12 +4,12 @@ import java.util.EnumSet; import java.util.List; import java.util.concurrent.CompletableFuture; import net.minecraft.nbt.CompoundTag; -import net.minecraft.server.level.ChunkTaskPriorityQueueSorter; import net.minecraft.server.level.GenerationChunkHolder; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ThreadedLevelLightEngine; import net.minecraft.server.level.WorldGenRegion; import net.minecraft.util.StaticCache2D; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; import net.minecraft.world.level.ChunkPos; import net.minecraft.world.level.chunk.ChunkAccess; @@ -17,7 +17,6 @@ import net.minecraft.world.level.chunk.ImposterProtoChunk; import net.minecraft.world.level.chunk.LevelChunk; import net.minecraft.world.level.chunk.ProtoChunk; import net.minecraft.world.level.levelgen.BelowZeroRetrogen; -import net.minecraft.world.level.levelgen.GenerationStep; import net.minecraft.world.level.levelgen.Heightmap; import net.minecraft.world.level.levelgen.blending.Blender; @@ -124,8 +123,7 @@ public class ChunkStatusTasks { serverLevel.getChunkSource().randomState(), serverLevel.getBiomeManager(), serverLevel.structureManager().forWorldGenRegion(worldGenRegion), - chunk, - GenerationStep.Carving.AIR + chunk ); return CompletableFuture.completedFuture(chunk); } @@ -171,33 +169,30 @@ public class ChunkStatusTasks { static CompletableFuture full(WorldGenContext worldGenContext, ChunkStep step, StaticCache2D cache, ChunkAccess chunk) { ChunkPos chunkPos = chunk.getPos(); GenerationChunkHolder generationChunkHolder = cache.get(chunkPos.x, chunkPos.z); - return CompletableFuture.supplyAsync( - () -> { - ProtoChunk protoChunk = (ProtoChunk)chunk; - ServerLevel serverLevel = worldGenContext.level(); - LevelChunk levelChunk; - if (protoChunk instanceof ImposterProtoChunk) { - levelChunk = ((ImposterProtoChunk)protoChunk).getWrapped(); - } else { - levelChunk = new LevelChunk(serverLevel, protoChunk, levelChunkx -> postLoadProtoChunk(serverLevel, protoChunk.getEntities())); - generationChunkHolder.replaceProtoChunk(new ImposterProtoChunk(levelChunk, false)); - } + return CompletableFuture.supplyAsync(() -> { + ProtoChunk protoChunk = (ProtoChunk)chunk; + ServerLevel serverLevel = worldGenContext.level(); + LevelChunk levelChunk; + if (protoChunk instanceof ImposterProtoChunk imposterProtoChunk) { + levelChunk = imposterProtoChunk.getWrapped(); + } else { + levelChunk = new LevelChunk(serverLevel, protoChunk, levelChunkx -> postLoadProtoChunk(serverLevel, protoChunk.getEntities())); + generationChunkHolder.replaceProtoChunk(new ImposterProtoChunk(levelChunk, false)); + } - levelChunk.setFullStatus(generationChunkHolder::getFullStatus); - levelChunk.runPostLoad(); - levelChunk.setLoaded(true); - levelChunk.registerAllBlockEntitiesAfterLevelLoad(); - levelChunk.registerTickContainerInLevel(serverLevel); - return levelChunk; - }, - runnable -> worldGenContext.mainThreadMailBox() - .tell(ChunkTaskPriorityQueueSorter.message(runnable, chunkPos.toLong(), generationChunkHolder::getTicketLevel)) - ); + levelChunk.setFullStatus(generationChunkHolder::getFullStatus); + levelChunk.runPostLoad(); + levelChunk.setLoaded(true); + levelChunk.registerAllBlockEntitiesAfterLevelLoad(); + levelChunk.registerTickContainerInLevel(serverLevel); + levelChunk.setUnsavedListener(worldGenContext.unsavedListener()); + return levelChunk; + }, worldGenContext.mainThreadExecutor()); } private static void postLoadProtoChunk(ServerLevel level, List entityTags) { if (!entityTags.isEmpty()) { - level.addWorldGenChunkEntities(EntityType.loadEntitiesRecursive(entityTags, level)); + level.addWorldGenChunkEntities(EntityType.loadEntitiesRecursive(entityTags, level, EntitySpawnReason.LOAD)); } } } diff --git a/net/minecraft/world/level/chunk/status/WorldGenContext.java b/net/minecraft/world/level/chunk/status/WorldGenContext.java index edc382d0..e04822a7 100644 --- a/net/minecraft/world/level/chunk/status/WorldGenContext.java +++ b/net/minecraft/world/level/chunk/status/WorldGenContext.java @@ -1,10 +1,10 @@ package net.minecraft.world.level.chunk.status; -import net.minecraft.server.level.ChunkTaskPriorityQueueSorter; +import java.util.concurrent.Executor; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ThreadedLevelLightEngine; -import net.minecraft.util.thread.ProcessorHandle; import net.minecraft.world.level.chunk.ChunkGenerator; +import net.minecraft.world.level.chunk.LevelChunk; import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplateManager; public record WorldGenContext( @@ -12,6 +12,7 @@ public record WorldGenContext( ChunkGenerator generator, StructureTemplateManager structureManager, ThreadedLevelLightEngine lightEngine, - ProcessorHandle> mainThreadMailBox + Executor mainThreadExecutor, + LevelChunk.UnsavedListener unsavedListener ) { } diff --git a/net/minecraft/world/level/chunk/storage/ChunkSerializer.java b/net/minecraft/world/level/chunk/storage/ChunkSerializer.java deleted file mode 100644 index df873421..00000000 --- a/net/minecraft/world/level/chunk/storage/ChunkSerializer.java +++ /dev/null @@ -1,520 +0,0 @@ -package net.minecraft.world.level.chunk.storage; - -import com.google.common.collect.Maps; -import com.mojang.logging.LogUtils; -import com.mojang.serialization.Codec; -import com.mojang.serialization.Dynamic; -import it.unimi.dsi.fastutil.longs.LongOpenHashSet; -import it.unimi.dsi.fastutil.longs.LongSet; -import it.unimi.dsi.fastutil.shorts.ShortList; -import java.util.Arrays; -import java.util.EnumSet; -import java.util.Map; -import java.util.Objects; -import java.util.Map.Entry; -import net.minecraft.core.BlockPos; -import net.minecraft.core.Holder; -import net.minecraft.core.Registry; -import net.minecraft.core.RegistryAccess; -import net.minecraft.core.SectionPos; -import net.minecraft.core.registries.BuiltInRegistries; -import net.minecraft.core.registries.Registries; -import net.minecraft.nbt.CompoundTag; -import net.minecraft.nbt.ListTag; -import net.minecraft.nbt.LongArrayTag; -import net.minecraft.nbt.NbtException; -import net.minecraft.nbt.NbtOps; -import net.minecraft.nbt.NbtUtils; -import net.minecraft.nbt.ShortTag; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.server.level.ServerLevel; -import net.minecraft.world.entity.EntityType; -import net.minecraft.world.entity.ai.village.poi.PoiManager; -import net.minecraft.world.level.ChunkPos; -import net.minecraft.world.level.LightLayer; -import net.minecraft.world.level.biome.Biome; -import net.minecraft.world.level.biome.Biomes; -import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.block.Blocks; -import net.minecraft.world.level.block.entity.BlockEntity; -import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.world.level.chunk.CarvingMask; -import net.minecraft.world.level.chunk.ChunkAccess; -import net.minecraft.world.level.chunk.ChunkSource; -import net.minecraft.world.level.chunk.DataLayer; -import net.minecraft.world.level.chunk.ImposterProtoChunk; -import net.minecraft.world.level.chunk.LevelChunk; -import net.minecraft.world.level.chunk.LevelChunkSection; -import net.minecraft.world.level.chunk.PalettedContainer; -import net.minecraft.world.level.chunk.PalettedContainerRO; -import net.minecraft.world.level.chunk.ProtoChunk; -import net.minecraft.world.level.chunk.UpgradeData; -import net.minecraft.world.level.chunk.status.ChunkStatus; -import net.minecraft.world.level.chunk.status.ChunkType; -import net.minecraft.world.level.levelgen.BelowZeroRetrogen; -import net.minecraft.world.level.levelgen.GenerationStep; -import net.minecraft.world.level.levelgen.Heightmap; -import net.minecraft.world.level.levelgen.blending.BlendingData; -import net.minecraft.world.level.levelgen.structure.Structure; -import net.minecraft.world.level.levelgen.structure.StructureStart; -import net.minecraft.world.level.levelgen.structure.pieces.StructurePieceSerializationContext; -import net.minecraft.world.level.lighting.LevelLightEngine; -import net.minecraft.world.level.material.Fluid; -import net.minecraft.world.ticks.LevelChunkTicks; -import net.minecraft.world.ticks.ProtoChunkTicks; -import org.jetbrains.annotations.Nullable; -import org.slf4j.Logger; - -public class ChunkSerializer { - private static final Codec> BLOCK_STATE_CODEC = PalettedContainer.codecRW( - Block.BLOCK_STATE_REGISTRY, BlockState.CODEC, PalettedContainer.Strategy.SECTION_STATES, Blocks.AIR.defaultBlockState() - ); - private static final Logger LOGGER = LogUtils.getLogger(); - private static final String TAG_UPGRADE_DATA = "UpgradeData"; - private static final String BLOCK_TICKS_TAG = "block_ticks"; - private static final String FLUID_TICKS_TAG = "fluid_ticks"; - public static final String X_POS_TAG = "xPos"; - public static final String Z_POS_TAG = "zPos"; - public static final String HEIGHTMAPS_TAG = "Heightmaps"; - public static final String IS_LIGHT_ON_TAG = "isLightOn"; - public static final String SECTIONS_TAG = "sections"; - public static final String BLOCK_LIGHT_TAG = "BlockLight"; - public static final String SKY_LIGHT_TAG = "SkyLight"; - - public static ProtoChunk read(ServerLevel level, PoiManager poiManager, RegionStorageInfo regionStorageInfo, ChunkPos pos, CompoundTag tag) { - ChunkPos chunkPos = new ChunkPos(tag.getInt("xPos"), tag.getInt("zPos")); - if (!Objects.equals(pos, chunkPos)) { - LOGGER.error("Chunk file at {} is in the wrong location; relocating. (Expected {}, got {})", pos, pos, chunkPos); - level.getServer().reportMisplacedChunk(chunkPos, pos, regionStorageInfo); - } - - UpgradeData upgradeData = tag.contains("UpgradeData", 10) ? new UpgradeData(tag.getCompound("UpgradeData"), level) : UpgradeData.EMPTY; - boolean bl = tag.getBoolean("isLightOn"); - ListTag listTag = tag.getList("sections", 10); - int i = level.getSectionsCount(); - LevelChunkSection[] levelChunkSections = new LevelChunkSection[i]; - boolean bl2 = level.dimensionType().hasSkyLight(); - ChunkSource chunkSource = level.getChunkSource(); - LevelLightEngine levelLightEngine = chunkSource.getLightEngine(); - Registry registry = level.registryAccess().registryOrThrow(Registries.BIOME); - Codec>> codec = makeBiomeCodec(registry); - boolean bl3 = false; - - for (int j = 0; j < listTag.size(); j++) { - CompoundTag compoundTag = listTag.getCompound(j); - int k = compoundTag.getByte("Y"); - int l = level.getSectionIndexFromSectionY(k); - if (l >= 0 && l < levelChunkSections.length) { - PalettedContainer palettedContainer; - if (compoundTag.contains("block_states", 10)) { - palettedContainer = BLOCK_STATE_CODEC.parse(NbtOps.INSTANCE, compoundTag.getCompound("block_states")) - .promotePartial(string -> logErrors(pos, k, string)) - .getOrThrow(ChunkSerializer.ChunkReadException::new); - } else { - palettedContainer = new PalettedContainer<>(Block.BLOCK_STATE_REGISTRY, Blocks.AIR.defaultBlockState(), PalettedContainer.Strategy.SECTION_STATES); - } - - PalettedContainerRO> palettedContainerRO; - if (compoundTag.contains("biomes", 10)) { - palettedContainerRO = codec.parse(NbtOps.INSTANCE, compoundTag.getCompound("biomes")) - .promotePartial(string -> logErrors(pos, k, string)) - .getOrThrow(ChunkSerializer.ChunkReadException::new); - } else { - palettedContainerRO = new PalettedContainer<>( - registry.asHolderIdMap(), registry.getHolderOrThrow(Biomes.PLAINS), PalettedContainer.Strategy.SECTION_BIOMES - ); - } - - LevelChunkSection levelChunkSection = new LevelChunkSection(palettedContainer, palettedContainerRO); - levelChunkSections[l] = levelChunkSection; - SectionPos sectionPos = SectionPos.of(pos, k); - poiManager.checkConsistencyWithBlocks(sectionPos, levelChunkSection); - } - - boolean bl4 = compoundTag.contains("BlockLight", 7); - boolean bl5 = bl2 && compoundTag.contains("SkyLight", 7); - if (bl4 || bl5) { - if (!bl3) { - levelLightEngine.retainData(pos, true); - bl3 = true; - } - - if (bl4) { - levelLightEngine.queueSectionData(LightLayer.BLOCK, SectionPos.of(pos, k), new DataLayer(compoundTag.getByteArray("BlockLight"))); - } - - if (bl5) { - levelLightEngine.queueSectionData(LightLayer.SKY, SectionPos.of(pos, k), new DataLayer(compoundTag.getByteArray("SkyLight"))); - } - } - } - - long m = tag.getLong("InhabitedTime"); - ChunkType chunkType = getChunkTypeFromTag(tag); - BlendingData blendingData; - if (tag.contains("blending_data", 10)) { - blendingData = (BlendingData)BlendingData.CODEC - .parse(new Dynamic<>(NbtOps.INSTANCE, tag.getCompound("blending_data"))) - .resultOrPartial(LOGGER::error) - .orElse(null); - } else { - blendingData = null; - } - - ChunkAccess chunkAccess; - if (chunkType == ChunkType.LEVELCHUNK) { - LevelChunkTicks levelChunkTicks = LevelChunkTicks.load( - tag.getList("block_ticks", 10), string -> BuiltInRegistries.BLOCK.getOptional(ResourceLocation.tryParse(string)), pos - ); - LevelChunkTicks levelChunkTicks2 = LevelChunkTicks.load( - tag.getList("fluid_ticks", 10), string -> BuiltInRegistries.FLUID.getOptional(ResourceLocation.tryParse(string)), pos - ); - chunkAccess = new LevelChunk( - level.getLevel(), pos, upgradeData, levelChunkTicks, levelChunkTicks2, m, levelChunkSections, postLoadChunk(level, tag), blendingData - ); - } else { - ProtoChunkTicks protoChunkTicks = ProtoChunkTicks.load( - tag.getList("block_ticks", 10), string -> BuiltInRegistries.BLOCK.getOptional(ResourceLocation.tryParse(string)), pos - ); - ProtoChunkTicks protoChunkTicks2 = ProtoChunkTicks.load( - tag.getList("fluid_ticks", 10), string -> BuiltInRegistries.FLUID.getOptional(ResourceLocation.tryParse(string)), pos - ); - ProtoChunk protoChunk = new ProtoChunk(pos, upgradeData, levelChunkSections, protoChunkTicks, protoChunkTicks2, level, registry, blendingData); - chunkAccess = protoChunk; - protoChunk.setInhabitedTime(m); - if (tag.contains("below_zero_retrogen", 10)) { - BelowZeroRetrogen.CODEC - .parse(new Dynamic<>(NbtOps.INSTANCE, tag.getCompound("below_zero_retrogen"))) - .resultOrPartial(LOGGER::error) - .ifPresent(protoChunk::setBelowZeroRetrogen); - } - - ChunkStatus chunkStatus = ChunkStatus.byName(tag.getString("Status")); - protoChunk.setPersistedStatus(chunkStatus); - if (chunkStatus.isOrAfter(ChunkStatus.INITIALIZE_LIGHT)) { - protoChunk.setLightEngine(levelLightEngine); - } - } - - chunkAccess.setLightCorrect(bl); - CompoundTag compoundTag2 = tag.getCompound("Heightmaps"); - EnumSet enumSet = EnumSet.noneOf(Heightmap.Types.class); - - for (Heightmap.Types types : chunkAccess.getPersistedStatus().heightmapsAfter()) { - String string = types.getSerializationKey(); - if (compoundTag2.contains(string, 12)) { - chunkAccess.setHeightmap(types, compoundTag2.getLongArray(string)); - } else { - enumSet.add(types); - } - } - - Heightmap.primeHeightmaps(chunkAccess, enumSet); - CompoundTag compoundTag3 = tag.getCompound("structures"); - chunkAccess.setAllStarts(unpackStructureStart(StructurePieceSerializationContext.fromLevel(level), compoundTag3, level.getSeed())); - chunkAccess.setAllReferences(unpackStructureReferences(level.registryAccess(), pos, compoundTag3)); - if (tag.getBoolean("shouldSave")) { - chunkAccess.setUnsaved(true); - } - - ListTag listTag2 = tag.getList("PostProcessing", 9); - - for (int n = 0; n < listTag2.size(); n++) { - ListTag listTag3 = listTag2.getList(n); - - for (int o = 0; o < listTag3.size(); o++) { - chunkAccess.addPackedPostProcess(listTag3.getShort(o), n); - } - } - - if (chunkType == ChunkType.LEVELCHUNK) { - return new ImposterProtoChunk((LevelChunk)chunkAccess, false); - } else { - ProtoChunk protoChunk2 = (ProtoChunk)chunkAccess; - ListTag listTag3 = tag.getList("entities", 10); - - for (int o = 0; o < listTag3.size(); o++) { - protoChunk2.addEntity(listTag3.getCompound(o)); - } - - ListTag listTag4 = tag.getList("block_entities", 10); - - for (int p = 0; p < listTag4.size(); p++) { - CompoundTag compoundTag4 = listTag4.getCompound(p); - chunkAccess.setBlockEntityNbt(compoundTag4); - } - - CompoundTag compoundTag5 = tag.getCompound("CarvingMasks"); - - for (String string2 : compoundTag5.getAllKeys()) { - GenerationStep.Carving carving = GenerationStep.Carving.valueOf(string2); - protoChunk2.setCarvingMask(carving, new CarvingMask(compoundTag5.getLongArray(string2), chunkAccess.getMinBuildHeight())); - } - - return protoChunk2; - } - } - - private static void logErrors(ChunkPos chunkPos, int chunkSectionY, String errorMessage) { - LOGGER.error("Recoverable errors when loading section [{}, {}, {}]: {}", chunkPos.x, chunkSectionY, chunkPos.z, errorMessage); - } - - private static Codec>> makeBiomeCodec(Registry biomeRegistry) { - return PalettedContainer.codecRO( - biomeRegistry.asHolderIdMap(), biomeRegistry.holderByNameCodec(), PalettedContainer.Strategy.SECTION_BIOMES, biomeRegistry.getHolderOrThrow(Biomes.PLAINS) - ); - } - - public static CompoundTag write(ServerLevel level, ChunkAccess chunk) { - ChunkPos chunkPos = chunk.getPos(); - CompoundTag compoundTag = NbtUtils.addCurrentDataVersion(new CompoundTag()); - compoundTag.putInt("xPos", chunkPos.x); - compoundTag.putInt("yPos", chunk.getMinSection()); - compoundTag.putInt("zPos", chunkPos.z); - compoundTag.putLong("LastUpdate", level.getGameTime()); - compoundTag.putLong("InhabitedTime", chunk.getInhabitedTime()); - compoundTag.putString("Status", BuiltInRegistries.CHUNK_STATUS.getKey(chunk.getPersistedStatus()).toString()); - BlendingData blendingData = chunk.getBlendingData(); - if (blendingData != null) { - BlendingData.CODEC.encodeStart(NbtOps.INSTANCE, blendingData).resultOrPartial(LOGGER::error).ifPresent(tag -> compoundTag.put("blending_data", tag)); - } - - BelowZeroRetrogen belowZeroRetrogen = chunk.getBelowZeroRetrogen(); - if (belowZeroRetrogen != null) { - BelowZeroRetrogen.CODEC - .encodeStart(NbtOps.INSTANCE, belowZeroRetrogen) - .resultOrPartial(LOGGER::error) - .ifPresent(tag -> compoundTag.put("below_zero_retrogen", tag)); - } - - UpgradeData upgradeData = chunk.getUpgradeData(); - if (!upgradeData.isEmpty()) { - compoundTag.put("UpgradeData", upgradeData.write()); - } - - LevelChunkSection[] levelChunkSections = chunk.getSections(); - ListTag listTag = new ListTag(); - LevelLightEngine levelLightEngine = level.getChunkSource().getLightEngine(); - Registry registry = level.registryAccess().registryOrThrow(Registries.BIOME); - Codec>> codec = makeBiomeCodec(registry); - boolean bl = chunk.isLightCorrect(); - - for (int i = levelLightEngine.getMinLightSection(); i < levelLightEngine.getMaxLightSection(); i++) { - int j = chunk.getSectionIndexFromSectionY(i); - boolean bl2 = j >= 0 && j < levelChunkSections.length; - DataLayer dataLayer = levelLightEngine.getLayerListener(LightLayer.BLOCK).getDataLayerData(SectionPos.of(chunkPos, i)); - DataLayer dataLayer2 = levelLightEngine.getLayerListener(LightLayer.SKY).getDataLayerData(SectionPos.of(chunkPos, i)); - if (bl2 || dataLayer != null || dataLayer2 != null) { - CompoundTag compoundTag2 = new CompoundTag(); - if (bl2) { - LevelChunkSection levelChunkSection = levelChunkSections[j]; - compoundTag2.put("block_states", BLOCK_STATE_CODEC.encodeStart(NbtOps.INSTANCE, levelChunkSection.getStates()).getOrThrow()); - compoundTag2.put("biomes", codec.encodeStart(NbtOps.INSTANCE, levelChunkSection.getBiomes()).getOrThrow()); - } - - if (dataLayer != null && !dataLayer.isEmpty()) { - compoundTag2.putByteArray("BlockLight", dataLayer.getData()); - } - - if (dataLayer2 != null && !dataLayer2.isEmpty()) { - compoundTag2.putByteArray("SkyLight", dataLayer2.getData()); - } - - if (!compoundTag2.isEmpty()) { - compoundTag2.putByte("Y", (byte)i); - listTag.add(compoundTag2); - } - } - } - - compoundTag.put("sections", listTag); - if (bl) { - compoundTag.putBoolean("isLightOn", true); - } - - ListTag listTag2 = new ListTag(); - - for (BlockPos blockPos : chunk.getBlockEntitiesPos()) { - CompoundTag compoundTag3 = chunk.getBlockEntityNbtForSaving(blockPos, level.registryAccess()); - if (compoundTag3 != null) { - listTag2.add(compoundTag3); - } - } - - compoundTag.put("block_entities", listTag2); - if (chunk.getPersistedStatus().getChunkType() == ChunkType.PROTOCHUNK) { - ProtoChunk protoChunk = (ProtoChunk)chunk; - ListTag listTag3 = new ListTag(); - listTag3.addAll(protoChunk.getEntities()); - compoundTag.put("entities", listTag3); - CompoundTag compoundTag3 = new CompoundTag(); - - for (GenerationStep.Carving carving : GenerationStep.Carving.values()) { - CarvingMask carvingMask = protoChunk.getCarvingMask(carving); - if (carvingMask != null) { - compoundTag3.putLongArray(carving.toString(), carvingMask.toArray()); - } - } - - compoundTag.put("CarvingMasks", compoundTag3); - } - - saveTicks(level, compoundTag, chunk.getTicksForSerialization()); - compoundTag.put("PostProcessing", packOffsets(chunk.getPostProcessing())); - CompoundTag compoundTag4 = new CompoundTag(); - - for (Entry entry : chunk.getHeightmaps()) { - if (chunk.getPersistedStatus().heightmapsAfter().contains(entry.getKey())) { - compoundTag4.put(((Heightmap.Types)entry.getKey()).getSerializationKey(), new LongArrayTag(((Heightmap)entry.getValue()).getRawData())); - } - } - - compoundTag.put("Heightmaps", compoundTag4); - compoundTag.put( - "structures", packStructureData(StructurePieceSerializationContext.fromLevel(level), chunkPos, chunk.getAllStarts(), chunk.getAllReferences()) - ); - return compoundTag; - } - - private static void saveTicks(ServerLevel level, CompoundTag tag, ChunkAccess.TicksToSave ticksToSave) { - long l = level.getLevelData().getGameTime(); - tag.put("block_ticks", ticksToSave.blocks().save(l, block -> BuiltInRegistries.BLOCK.getKey(block).toString())); - tag.put("fluid_ticks", ticksToSave.fluids().save(l, fluid -> BuiltInRegistries.FLUID.getKey(fluid).toString())); - } - - public static ChunkType getChunkTypeFromTag(@Nullable CompoundTag tag) { - return tag != null ? ChunkStatus.byName(tag.getString("Status")).getChunkType() : ChunkType.PROTOCHUNK; - } - - @Nullable - private static LevelChunk.PostLoadProcessor postLoadChunk(ServerLevel level, CompoundTag tag) { - ListTag listTag = getListOfCompoundsOrNull(tag, "entities"); - ListTag listTag2 = getListOfCompoundsOrNull(tag, "block_entities"); - return listTag == null && listTag2 == null ? null : levelChunk -> { - if (listTag != null) { - level.addLegacyChunkEntities(EntityType.loadEntitiesRecursive(listTag, level)); - } - - if (listTag2 != null) { - for (int i = 0; i < listTag2.size(); i++) { - CompoundTag compoundTag = listTag2.getCompound(i); - boolean bl = compoundTag.getBoolean("keepPacked"); - if (bl) { - levelChunk.setBlockEntityNbt(compoundTag); - } else { - BlockPos blockPos = BlockEntity.getPosFromTag(compoundTag); - BlockEntity blockEntity = BlockEntity.loadStatic(blockPos, levelChunk.getBlockState(blockPos), compoundTag, level.registryAccess()); - if (blockEntity != null) { - levelChunk.setBlockEntity(blockEntity); - } - } - } - } - }; - } - - @Nullable - private static ListTag getListOfCompoundsOrNull(CompoundTag tag, String key) { - ListTag listTag = tag.getList(key, 10); - return listTag.isEmpty() ? null : listTag; - } - - private static CompoundTag packStructureData( - StructurePieceSerializationContext context, ChunkPos pos, Map structureMap, Map referenceMap - ) { - CompoundTag compoundTag = new CompoundTag(); - CompoundTag compoundTag2 = new CompoundTag(); - Registry registry = context.registryAccess().registryOrThrow(Registries.STRUCTURE); - - for (Entry entry : structureMap.entrySet()) { - ResourceLocation resourceLocation = registry.getKey((Structure)entry.getKey()); - compoundTag2.put(resourceLocation.toString(), ((StructureStart)entry.getValue()).createTag(context, pos)); - } - - compoundTag.put("starts", compoundTag2); - CompoundTag compoundTag3 = new CompoundTag(); - - for (Entry entry2 : referenceMap.entrySet()) { - if (!((LongSet)entry2.getValue()).isEmpty()) { - ResourceLocation resourceLocation2 = registry.getKey((Structure)entry2.getKey()); - compoundTag3.put(resourceLocation2.toString(), new LongArrayTag((LongSet)entry2.getValue())); - } - } - - compoundTag.put("References", compoundTag3); - return compoundTag; - } - - private static Map unpackStructureStart(StructurePieceSerializationContext context, CompoundTag tag, long seed) { - Map map = Maps.newHashMap(); - Registry registry = context.registryAccess().registryOrThrow(Registries.STRUCTURE); - CompoundTag compoundTag = tag.getCompound("starts"); - - for (String string : compoundTag.getAllKeys()) { - ResourceLocation resourceLocation = ResourceLocation.tryParse(string); - Structure structure = registry.get(resourceLocation); - if (structure == null) { - LOGGER.error("Unknown structure start: {}", resourceLocation); - } else { - StructureStart structureStart = StructureStart.loadStaticStart(context, compoundTag.getCompound(string), seed); - if (structureStart != null) { - map.put(structure, structureStart); - } - } - } - - return map; - } - - private static Map unpackStructureReferences(RegistryAccess registryAccess, ChunkPos pos, CompoundTag tag) { - Map map = Maps.newHashMap(); - Registry registry = registryAccess.registryOrThrow(Registries.STRUCTURE); - CompoundTag compoundTag = tag.getCompound("References"); - - for (String string : compoundTag.getAllKeys()) { - ResourceLocation resourceLocation = ResourceLocation.tryParse(string); - Structure structure = registry.get(resourceLocation); - if (structure == null) { - LOGGER.warn("Found reference to unknown structure '{}' in chunk {}, discarding", resourceLocation, pos); - } else { - long[] ls = compoundTag.getLongArray(string); - if (ls.length != 0) { - map.put(structure, new LongOpenHashSet(Arrays.stream(ls).filter(l -> { - ChunkPos chunkPos2 = new ChunkPos(l); - if (chunkPos2.getChessboardDistance(pos) > 8) { - LOGGER.warn("Found invalid structure reference [ {} @ {} ] for chunk {}.", resourceLocation, chunkPos2, pos); - return false; - } else { - return true; - } - }).toArray())); - } - } - } - - return map; - } - - public static ListTag packOffsets(ShortList[] list) { - ListTag listTag = new ListTag(); - - for (ShortList shortList : list) { - ListTag listTag2 = new ListTag(); - if (shortList != null) { - for (Short short_ : shortList) { - listTag2.add(ShortTag.valueOf(short_)); - } - } - - listTag.add(listTag2); - } - - return listTag; - } - - public static class ChunkReadException extends NbtException { - public ChunkReadException(String message) { - super(message); - } - } -} diff --git a/net/minecraft/world/level/chunk/storage/ChunkStorage.java b/net/minecraft/world/level/chunk/storage/ChunkStorage.java index ad3ebd96..c1118263 100644 --- a/net/minecraft/world/level/chunk/storage/ChunkStorage.java +++ b/net/minecraft/world/level/chunk/storage/ChunkStorage.java @@ -106,9 +106,9 @@ public class ChunkStorage implements AutoCloseable { return this.worker.loadAsync(chunkPos); } - public CompletableFuture write(ChunkPos chunkPos, CompoundTag data) { + public CompletableFuture write(ChunkPos chunkPos, Supplier supplier) { this.handleLegacyStructureIndex(chunkPos); - return this.worker.store(chunkPos, data); + return this.worker.store(chunkPos, supplier); } protected void handleLegacyStructureIndex(ChunkPos chunkPos) { diff --git a/net/minecraft/world/level/chunk/storage/EntityStorage.java b/net/minecraft/world/level/chunk/storage/EntityStorage.java index ced3210c..12bea75d 100644 --- a/net/minecraft/world/level/chunk/storage/EntityStorage.java +++ b/net/minecraft/world/level/chunk/storage/EntityStorage.java @@ -15,8 +15,9 @@ import net.minecraft.nbt.IntArrayTag; import net.minecraft.nbt.ListTag; import net.minecraft.nbt.NbtUtils; import net.minecraft.server.level.ServerLevel; -import net.minecraft.util.thread.ProcessorMailbox; +import net.minecraft.util.thread.ConsecutiveExecutor; import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; import net.minecraft.world.level.ChunkPos; import net.minecraft.world.level.entity.ChunkEntities; @@ -30,12 +31,12 @@ public class EntityStorage implements EntityPersistentStorage { private final ServerLevel level; private final SimpleRegionStorage simpleRegionStorage; private final LongSet emptyChunks = new LongOpenHashSet(); - private final ProcessorMailbox entityDeserializerQueue; + private final ConsecutiveExecutor entityDeserializerQueue; public EntityStorage(SimpleRegionStorage simpleRegionStorage, ServerLevel level, Executor executor) { this.simpleRegionStorage = simpleRegionStorage; this.level = level; - this.entityDeserializerQueue = ProcessorMailbox.create(executor, "entity-deserializer"); + this.entityDeserializerQueue = new ConsecutiveExecutor(executor, "entity-deserializer"); } @Override @@ -63,10 +64,10 @@ public class EntityStorage implements EntityPersistentStorage { CompoundTag compoundTag = this.simpleRegionStorage.upgradeChunkTag((CompoundTag)optional.get(), -1); ListTag listTag = compoundTag.getList("Entities", 10); - List list = (List)EntityType.loadEntitiesRecursive(listTag, this.level).collect(ImmutableList.toImmutableList()); + List list = (List)EntityType.loadEntitiesRecursive(listTag, this.level, EntitySpawnReason.LOAD).collect(ImmutableList.toImmutableList()); return new ChunkEntities(pos, list); } - }, this.entityDeserializerQueue::tell); + }, this.entityDeserializerQueue::schedule); } } diff --git a/net/minecraft/world/level/chunk/storage/IOWorker.java b/net/minecraft/world/level/chunk/storage/IOWorker.java index 26f7c113..89d60803 100644 --- a/net/minecraft/world/level/chunk/storage/IOWorker.java +++ b/net/minecraft/world/level/chunk/storage/IOWorker.java @@ -1,15 +1,13 @@ package net.minecraft.world.level.chunk.storage; -import com.google.common.collect.Maps; -import com.mojang.datafixers.util.Either; import com.mojang.logging.LogUtils; import it.unimi.dsi.fastutil.longs.Long2ObjectLinkedOpenHashMap; import java.io.IOException; import java.nio.file.Path; import java.util.BitSet; -import java.util.Iterator; -import java.util.Map; +import java.util.LinkedHashMap; import java.util.Optional; +import java.util.SequencedMap; import java.util.Map.Entry; import java.util.concurrent.CompletableFuture; import java.util.concurrent.atomic.AtomicBoolean; @@ -22,7 +20,7 @@ import net.minecraft.nbt.StreamTagVisitor; import net.minecraft.nbt.visitors.CollectFields; import net.minecraft.nbt.visitors.FieldSelector; import net.minecraft.util.Unit; -import net.minecraft.util.thread.ProcessorMailbox; +import net.minecraft.util.thread.PriorityConsecutiveExecutor; import net.minecraft.util.thread.StrictQueue; import net.minecraft.world.level.ChunkPos; import org.jetbrains.annotations.Nullable; @@ -31,15 +29,15 @@ import org.slf4j.Logger; public class IOWorker implements ChunkScanAccess, AutoCloseable { private static final Logger LOGGER = LogUtils.getLogger(); private final AtomicBoolean shutdownRequested = new AtomicBoolean(); - private final ProcessorMailbox mailbox; + private final PriorityConsecutiveExecutor consecutiveExecutor; private final RegionFileStorage storage; - private final Map pendingWrites = Maps.newLinkedHashMap(); + private final SequencedMap pendingWrites = new LinkedHashMap(); private final Long2ObjectLinkedOpenHashMap> regionCacheForBlender = new Long2ObjectLinkedOpenHashMap<>(); private static final int REGION_CACHE_SIZE = 1024; protected IOWorker(RegionStorageInfo info, Path folder, boolean sync) { this.storage = new RegionFileStorage(info, folder, sync); - this.mailbox = new ProcessorMailbox<>(new StrictQueue.FixedPriorityQueue(IOWorker.Priority.values().length), Util.ioPool(), "IOWorker-" + info.type()); + this.consecutiveExecutor = new PriorityConsecutiveExecutor(IOWorker.Priority.values().length, Util.ioPool(), "IOWorker-" + info.type()); } public boolean isOldChunkAround(ChunkPos chunkPos, int radius) { @@ -116,25 +114,34 @@ public class IOWorker implements ChunkScanAccess, AutoCloseable { } public CompletableFuture store(ChunkPos chunkPos, @Nullable CompoundTag chunkData) { - return this.submitTask(() -> { - IOWorker.PendingStore pendingStore = (IOWorker.PendingStore)this.pendingWrites.computeIfAbsent(chunkPos, chunkPosxx -> new IOWorker.PendingStore(chunkData)); - pendingStore.data = chunkData; - return Either.left(pendingStore.result); - }).thenCompose(Function.identity()); + return this.store(chunkPos, () -> chunkData); + } + + public CompletableFuture store(ChunkPos chunkPos, Supplier supplier) { + return this.submitTask( + () -> { + CompoundTag compoundTag = (CompoundTag)supplier.get(); + IOWorker.PendingStore pendingStore = (IOWorker.PendingStore)this.pendingWrites + .computeIfAbsent(chunkPos, chunkPosxx -> new IOWorker.PendingStore(compoundTag)); + pendingStore.data = compoundTag; + return pendingStore.result; + } + ) + .thenCompose(Function.identity()); } public CompletableFuture> loadAsync(ChunkPos chunkPos) { - return this.submitTask(() -> { + return this.submitThrowingTask(() -> { IOWorker.PendingStore pendingStore = (IOWorker.PendingStore)this.pendingWrites.get(chunkPos); if (pendingStore != null) { - return Either.left(Optional.ofNullable(pendingStore.copyData())); + return Optional.ofNullable(pendingStore.copyData()); } else { try { CompoundTag compoundTag = this.storage.read(chunkPos); - return Either.left(Optional.ofNullable(compoundTag)); + return Optional.ofNullable(compoundTag); } catch (Exception var4) { LOGGER.warn("Failed to read chunk {}", chunkPos, var4); - return Either.right(var4); + throw var4; } } }); @@ -142,27 +149,25 @@ public class IOWorker implements ChunkScanAccess, AutoCloseable { public CompletableFuture synchronize(boolean flushStorage) { CompletableFuture completableFuture = this.submitTask( - () -> Either.left( - CompletableFuture.allOf( - (CompletableFuture[])this.pendingWrites.values().stream().map(pendingStore -> pendingStore.result).toArray(CompletableFuture[]::new) - ) + () -> CompletableFuture.allOf( + (CompletableFuture[])this.pendingWrites.values().stream().map(pendingStore -> pendingStore.result).toArray(CompletableFuture[]::new) ) ) .thenCompose(Function.identity()); - return flushStorage ? completableFuture.thenCompose(void_ -> this.submitTask(() -> { + return flushStorage ? completableFuture.thenCompose(void_ -> this.submitThrowingTask(() -> { try { this.storage.flush(); - return Either.left(null); + return null; } catch (Exception var2x) { LOGGER.warn("Failed to synchronize chunks", (Throwable)var2x); - return Either.right(var2x); + throw var2x; } - })) : completableFuture.thenCompose(void_ -> this.submitTask(() -> Either.left(null))); + })) : completableFuture.thenCompose(void_ -> this.submitTask(() -> null)); } @Override public CompletableFuture scanChunk(ChunkPos chunkPos, StreamTagVisitor visitor) { - return this.submitTask(() -> { + return this.submitThrowingTask(() -> { try { IOWorker.PendingStore pendingStore = (IOWorker.PendingStore)this.pendingWrites.get(chunkPos); if (pendingStore != null) { @@ -173,36 +178,48 @@ public class IOWorker implements ChunkScanAccess, AutoCloseable { this.storage.scanChunk(chunkPos, visitor); } - return Either.left(null); + return null; } catch (Exception var4) { LOGGER.warn("Failed to bulk scan chunk {}", chunkPos, var4); - return Either.right(var4); + throw var4; } }); } - private CompletableFuture submitTask(Supplier> task) { - return this.mailbox.askEither(processorHandle -> new StrictQueue.IntRunnable(IOWorker.Priority.FOREGROUND.ordinal(), () -> { + private CompletableFuture submitThrowingTask(IOWorker.ThrowingSupplier throwingSupplier) { + return this.consecutiveExecutor.scheduleWithResult(IOWorker.Priority.FOREGROUND.ordinal(), completableFuture -> { if (!this.shutdownRequested.get()) { - processorHandle.tell((Either)task.get()); + try { + completableFuture.complete(throwingSupplier.get()); + } catch (Exception var4) { + completableFuture.completeExceptionally(var4); + } } this.tellStorePending(); - })); + }); + } + + private CompletableFuture submitTask(Supplier task) { + return this.consecutiveExecutor.scheduleWithResult(IOWorker.Priority.FOREGROUND.ordinal(), completableFuture -> { + if (!this.shutdownRequested.get()) { + completableFuture.complete(task.get()); + } + + this.tellStorePending(); + }); } private void storePendingChunk() { - if (!this.pendingWrites.isEmpty()) { - Iterator> iterator = this.pendingWrites.entrySet().iterator(); - Entry entry = (Entry)iterator.next(); - iterator.remove(); + Entry entry = this.pendingWrites.pollFirstEntry(); + if (entry != null) { this.runStore((ChunkPos)entry.getKey(), (IOWorker.PendingStore)entry.getValue()); this.tellStorePending(); } } private void tellStorePending() { - this.mailbox.tell(new StrictQueue.IntRunnable(IOWorker.Priority.BACKGROUND.ordinal(), this::storePendingChunk)); + this.consecutiveExecutor.schedule(new StrictQueue.RunnableWithPriority(IOWorker.Priority.BACKGROUND.ordinal(), this::storePendingChunk)); } private void runStore(ChunkPos chunkPos, IOWorker.PendingStore pendingStore) { @@ -217,8 +234,8 @@ public class IOWorker implements ChunkScanAccess, AutoCloseable { public void close() throws IOException { if (this.shutdownRequested.compareAndSet(false, true)) { - this.mailbox.ask(processorHandle -> new StrictQueue.IntRunnable(IOWorker.Priority.SHUTDOWN.ordinal(), () -> processorHandle.tell(Unit.INSTANCE))).join(); - this.mailbox.close(); + this.waitForShutdown(); + this.consecutiveExecutor.close(); try { this.storage.close(); @@ -228,6 +245,10 @@ public class IOWorker implements ChunkScanAccess, AutoCloseable { } } + private void waitForShutdown() { + this.consecutiveExecutor.scheduleWithResult(IOWorker.Priority.SHUTDOWN.ordinal(), completableFuture -> completableFuture.complete(Unit.INSTANCE)).join(); + } + public RegionStorageInfo storageInfo() { return this.storage.info(); } @@ -253,4 +274,10 @@ public class IOWorker implements ChunkScanAccess, AutoCloseable { BACKGROUND, SHUTDOWN; } + + @FunctionalInterface + interface ThrowingSupplier { + @Nullable + T get() throws Exception; + } } diff --git a/net/minecraft/world/level/chunk/storage/RecreatingChunkStorage.java b/net/minecraft/world/level/chunk/storage/RecreatingChunkStorage.java index 87fc685f..15afa3ae 100644 --- a/net/minecraft/world/level/chunk/storage/RecreatingChunkStorage.java +++ b/net/minecraft/world/level/chunk/storage/RecreatingChunkStorage.java @@ -4,6 +4,7 @@ import com.mojang.datafixers.DataFixer; import java.io.IOException; import java.nio.file.Path; import java.util.concurrent.CompletableFuture; +import java.util.function.Supplier; import net.minecraft.nbt.CompoundTag; import net.minecraft.world.level.ChunkPos; import org.apache.commons.io.FileUtils; @@ -19,9 +20,9 @@ public class RecreatingChunkStorage extends ChunkStorage { } @Override - public CompletableFuture write(ChunkPos chunkPos, CompoundTag data) { + public CompletableFuture write(ChunkPos chunkPos, Supplier supplier) { this.handleLegacyStructureIndex(chunkPos); - return this.writeWorker.store(chunkPos, data); + return this.writeWorker.store(chunkPos, supplier); } @Override diff --git a/net/minecraft/world/level/chunk/storage/SectionStorage.java b/net/minecraft/world/level/chunk/storage/SectionStorage.java index da0bc687..968fdb66 100644 --- a/net/minecraft/world/level/chunk/storage/SectionStorage.java +++ b/net/minecraft/world/level/chunk/storage/SectionStorage.java @@ -8,14 +8,24 @@ import com.mojang.serialization.DataResult; import com.mojang.serialization.Dynamic; import com.mojang.serialization.DynamicOps; import com.mojang.serialization.OptionalDynamic; +import it.unimi.dsi.fastutil.ints.Int2ObjectMap; +import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; +import it.unimi.dsi.fastutil.longs.Long2ObjectFunction; import it.unimi.dsi.fastutil.longs.Long2ObjectMap; +import it.unimi.dsi.fastutil.longs.Long2ObjectMaps; import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; +import it.unimi.dsi.fastutil.longs.LongIterator; import it.unimi.dsi.fastutil.longs.LongLinkedOpenHashSet; +import it.unimi.dsi.fastutil.longs.LongOpenHashSet; +import it.unimi.dsi.fastutil.longs.LongSet; +import it.unimi.dsi.fastutil.longs.Long2ObjectMap.Entry; import java.io.IOException; +import java.util.Iterator; import java.util.Map; import java.util.Optional; import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletionException; +import java.util.function.BiFunction; import java.util.function.BooleanSupplier; import java.util.function.Function; import net.minecraft.SharedConstants; @@ -31,43 +41,81 @@ import net.minecraft.world.level.LevelHeightAccessor; import org.jetbrains.annotations.Nullable; import org.slf4j.Logger; -public class SectionStorage implements AutoCloseable { - private static final Logger LOGGER = LogUtils.getLogger(); +public class SectionStorage implements AutoCloseable { + static final Logger LOGGER = LogUtils.getLogger(); private static final String SECTIONS_TAG = "Sections"; private final SimpleRegionStorage simpleRegionStorage; private final Long2ObjectMap> storage = new Long2ObjectOpenHashMap<>(); - private final LongLinkedOpenHashSet dirty = new LongLinkedOpenHashSet(); - private final Function> codec; + private final LongLinkedOpenHashSet dirtyChunks = new LongLinkedOpenHashSet(); + private final Codec

codec; + private final Function packer; + private final BiFunction unpacker; private final Function factory; private final RegistryAccess registryAccess; private final ChunkIOErrorReporter errorReporter; protected final LevelHeightAccessor levelHeightAccessor; + private final LongSet loadedChunks = new LongOpenHashSet(); + private final Long2ObjectMap>>> pendingLoads = new Long2ObjectOpenHashMap<>(); + private final Object loadLock = new Object(); public SectionStorage( SimpleRegionStorage simpleRegionStorage, - Function> codec, - Function factory, + Codec

codec, + Function function, + BiFunction biFunction, + Function function2, RegistryAccess registryAccess, - ChunkIOErrorReporter errorReporter, + ChunkIOErrorReporter chunkIOErrorReporter, LevelHeightAccessor levelHeightAccessor ) { this.simpleRegionStorage = simpleRegionStorage; this.codec = codec; - this.factory = factory; + this.packer = function; + this.unpacker = biFunction; + this.factory = function2; this.registryAccess = registryAccess; - this.errorReporter = errorReporter; + this.errorReporter = chunkIOErrorReporter; this.levelHeightAccessor = levelHeightAccessor; } protected void tick(BooleanSupplier aheadOfTime) { - while (this.hasWork() && aheadOfTime.getAsBoolean()) { - ChunkPos chunkPos = SectionPos.of(this.dirty.firstLong()).chunk(); - this.writeColumn(chunkPos); + LongIterator longIterator = this.dirtyChunks.iterator(); + + while (longIterator.hasNext() && aheadOfTime.getAsBoolean()) { + ChunkPos chunkPos = new ChunkPos(longIterator.nextLong()); + longIterator.remove(); + this.writeChunk(chunkPos); + } + + this.unpackPendingLoads(); + } + + private void unpackPendingLoads() { + synchronized (this.loadLock) { + Iterator>>>> iterator = Long2ObjectMaps.fastIterator(this.pendingLoads); + + while (iterator.hasNext()) { + Entry>>> entry = (Entry>>>)iterator.next(); + Optional> optional = (Optional>)((CompletableFuture)entry.getValue()).getNow(null); + if (optional != null) { + long l = entry.getLongKey(); + this.unpackChunk(new ChunkPos(l), (SectionStorage.PackedChunk

)optional.orElse(null)); + iterator.remove(); + this.loadedChunks.add(l); + } + } + } + } + + public void flushAll() { + if (!this.dirtyChunks.isEmpty()) { + this.dirtyChunks.forEach(l -> this.writeChunk(new ChunkPos(l))); + this.dirtyChunks.clear(); } } public boolean hasWork() { - return !this.dirty.isEmpty(); + return !this.dirtyChunks.isEmpty(); } @Nullable @@ -83,7 +131,7 @@ public class SectionStorage implements AutoCloseable { if (optional != null) { return optional; } else { - this.readColumn(SectionPos.of(sectionKey).chunk()); + this.unpackChunk(SectionPos.of(sectionKey).chunk()); optional = this.get(sectionKey); if (optional == null) { throw (IllegalStateException)Util.pauseInIde(new IllegalStateException()); @@ -114,56 +162,80 @@ public class SectionStorage implements AutoCloseable { } } - private void readColumn(ChunkPos chunkPos) { - Optional optional = (Optional)this.tryRead(chunkPos).join(); - RegistryOps registryOps = this.registryAccess.createSerializationContext(NbtOps.INSTANCE); - this.readColumn(chunkPos, registryOps, (CompoundTag)optional.orElse(null)); + public CompletableFuture prefetch(ChunkPos chunkPos) { + synchronized (this.loadLock) { + long l = chunkPos.toLong(); + return this.loadedChunks.contains(l) + ? CompletableFuture.completedFuture(null) + : this.pendingLoads + .computeIfAbsent(l, (Long2ObjectFunction>>>)(lx -> this.tryRead(chunkPos))); + } } - private CompletableFuture> tryRead(ChunkPos chunkPos) { - return this.simpleRegionStorage.read(chunkPos).exceptionally(throwable -> { - if (throwable instanceof IOException iOException) { - LOGGER.error("Error reading chunk {} data from disk", chunkPos, iOException); - this.errorReporter.reportChunkLoadFailure(iOException, this.simpleRegionStorage.storageInfo(), chunkPos); - return Optional.empty(); - } else { - throw new CompletionException(throwable); + private void unpackChunk(ChunkPos chunkPos) { + long l = chunkPos.toLong(); + CompletableFuture>> completableFuture; + synchronized (this.loadLock) { + if (!this.loadedChunks.add(l)) { + return; } - }); + + completableFuture = this.pendingLoads + .computeIfAbsent(l, (Long2ObjectFunction>>>)(lx -> this.tryRead(chunkPos))); + } + + this.unpackChunk(chunkPos, (SectionStorage.PackedChunk

)((Optional)completableFuture.join()).orElse(null)); + synchronized (this.loadLock) { + this.pendingLoads.remove(l); + } } - private void readColumn(ChunkPos chunkPos, RegistryOps ops, @Nullable CompoundTag tag) { - if (tag == null) { - for (int i = this.levelHeightAccessor.getMinSection(); i < this.levelHeightAccessor.getMaxSection(); i++) { + private CompletableFuture>> tryRead(ChunkPos chunkPos) { + RegistryOps registryOps = this.registryAccess.createSerializationContext(NbtOps.INSTANCE); + return this.simpleRegionStorage + .read(chunkPos) + .thenApplyAsync( + optional -> optional.map( + compoundTag -> SectionStorage.PackedChunk.parse(this.codec, registryOps, compoundTag, this.simpleRegionStorage, this.levelHeightAccessor) + ), + Util.backgroundExecutor().forName("parseSection") + ) + .exceptionally(throwable -> { + if (throwable instanceof IOException iOException) { + LOGGER.error("Error reading chunk {} data from disk", chunkPos, iOException); + this.errorReporter.reportChunkLoadFailure(iOException, this.simpleRegionStorage.storageInfo(), chunkPos); + return Optional.empty(); + } else { + throw new CompletionException(throwable); + } + }); + } + + private void unpackChunk(ChunkPos chunkPos, @Nullable SectionStorage.PackedChunk

packedChunk) { + if (packedChunk == null) { + for (int i = this.levelHeightAccessor.getMinSectionY(); i <= this.levelHeightAccessor.getMaxSectionY(); i++) { this.storage.put(getKey(chunkPos, i), Optional.empty()); } } else { - Dynamic dynamic = new Dynamic<>(ops, tag); - int j = getVersion(dynamic); - int k = SharedConstants.getCurrentVersion().getDataVersion().getVersion(); - boolean bl = j != k; - Dynamic dynamic2 = this.simpleRegionStorage.upgradeChunkTag(dynamic, j); - OptionalDynamic optionalDynamic = dynamic2.get("Sections"); + boolean bl = packedChunk.versionChanged(); - for (int l = this.levelHeightAccessor.getMinSection(); l < this.levelHeightAccessor.getMaxSection(); l++) { - long m = getKey(chunkPos, l); - Optional optional = optionalDynamic.get(Integer.toString(l)) - .result() - .flatMap(dynamicx -> ((Codec)this.codec.apply((Runnable)() -> this.setDirty(m))).parse(dynamicx).resultOrPartial(LOGGER::error)); - this.storage.put(m, optional); + for (int j = this.levelHeightAccessor.getMinSectionY(); j <= this.levelHeightAccessor.getMaxSectionY(); j++) { + long l = getKey(chunkPos, j); + Optional optional = Optional.ofNullable(packedChunk.sectionsByY.get(j)).map(object -> this.unpacker.apply(object, (Runnable)() -> this.setDirty(l))); + this.storage.put(l, optional); optional.ifPresent(object -> { - this.onSectionLoad(m); + this.onSectionLoad(l); if (bl) { - this.setDirty(m); + this.setDirty(l); } }); } } } - private void writeColumn(ChunkPos chunkPos) { + private void writeChunk(ChunkPos chunkPos) { RegistryOps registryOps = this.registryAccess.createSerializationContext(NbtOps.INSTANCE); - Dynamic dynamic = this.writeColumn(chunkPos, registryOps); + Dynamic dynamic = this.writeChunk(chunkPos, registryOps); Tag tag = dynamic.getValue(); if (tag instanceof CompoundTag) { this.simpleRegionStorage.write(chunkPos, (CompoundTag)tag).exceptionally(throwable -> { @@ -175,28 +247,27 @@ public class SectionStorage implements AutoCloseable { } } - private Dynamic writeColumn(ChunkPos chunkPos, DynamicOps ops) { + private Dynamic writeChunk(ChunkPos chunkPos, DynamicOps dynamicOps) { Map map = Maps.newHashMap(); - for (int i = this.levelHeightAccessor.getMinSection(); i < this.levelHeightAccessor.getMaxSection(); i++) { + for (int i = this.levelHeightAccessor.getMinSectionY(); i <= this.levelHeightAccessor.getMaxSectionY(); i++) { long l = getKey(chunkPos, i); - this.dirty.remove(l); Optional optional = this.storage.get(l); if (optional != null && !optional.isEmpty()) { - DataResult dataResult = ((Codec)this.codec.apply((Runnable)() -> this.setDirty(l))).encodeStart(ops, optional.get()); + DataResult dataResult = this.codec.encodeStart(dynamicOps, (P)this.packer.apply(optional.get())); String string = Integer.toString(i); - dataResult.resultOrPartial(LOGGER::error).ifPresent(object -> map.put(ops.createString(string), object)); + dataResult.resultOrPartial(LOGGER::error).ifPresent(object -> map.put(dynamicOps.createString(string), object)); } } return new Dynamic<>( - ops, - ops.createMap( + dynamicOps, + dynamicOps.createMap( ImmutableMap.of( - ops.createString("Sections"), - ops.createMap(map), - ops.createString("DataVersion"), - ops.createInt(SharedConstants.getCurrentVersion().getDataVersion().getVersion()) + dynamicOps.createString("Sections"), + dynamicOps.createMap(map), + dynamicOps.createString("DataVersion"), + dynamicOps.createInt(SharedConstants.getCurrentVersion().getDataVersion().getVersion()) ) ) ); @@ -212,29 +283,49 @@ public class SectionStorage implements AutoCloseable { protected void setDirty(long sectionPos) { Optional optional = this.storage.get(sectionPos); if (optional != null && !optional.isEmpty()) { - this.dirty.add(sectionPos); + this.dirtyChunks.add(ChunkPos.asLong(SectionPos.x(sectionPos), SectionPos.z(sectionPos))); } else { LOGGER.warn("No data for position: {}", SectionPos.of(sectionPos)); } } - private static int getVersion(Dynamic columnData) { + static int getVersion(Dynamic columnData) { return columnData.get("DataVersion").asInt(1945); } public void flush(ChunkPos chunkPos) { - if (this.hasWork()) { - for (int i = this.levelHeightAccessor.getMinSection(); i < this.levelHeightAccessor.getMaxSection(); i++) { - long l = getKey(chunkPos, i); - if (this.dirty.contains(l)) { - this.writeColumn(chunkPos); - return; - } - } + if (this.dirtyChunks.remove(chunkPos.toLong())) { + this.writeChunk(chunkPos); } } public void close() throws IOException { this.simpleRegionStorage.close(); } + + record PackedChunk(Int2ObjectMap sectionsByY, boolean versionChanged) { + + public static SectionStorage.PackedChunk parse( + Codec codec, DynamicOps dynamicOps, Tag tag, SimpleRegionStorage simpleRegionStorage, LevelHeightAccessor levelHeightAccessor + ) { + Dynamic dynamic = new Dynamic<>(dynamicOps, tag); + int i = SectionStorage.getVersion(dynamic); + int j = SharedConstants.getCurrentVersion().getDataVersion().getVersion(); + boolean bl = i != j; + Dynamic dynamic2 = simpleRegionStorage.upgradeChunkTag(dynamic, i); + OptionalDynamic optionalDynamic = dynamic2.get("Sections"); + Int2ObjectMap int2ObjectMap = new Int2ObjectOpenHashMap<>(); + + for (int k = levelHeightAccessor.getMinSectionY(); k <= levelHeightAccessor.getMaxSectionY(); k++) { + Optional optional = optionalDynamic.get(Integer.toString(k)) + .result() + .flatMap(dynamicx -> codec.parse(dynamicx).resultOrPartial(SectionStorage.LOGGER::error)); + if (optional.isPresent()) { + int2ObjectMap.put(k, (T)optional.get()); + } + } + + return new SectionStorage.PackedChunk<>(int2ObjectMap, bl); + } + } } diff --git a/net/minecraft/world/level/chunk/storage/SerializableChunkData.java b/net/minecraft/world/level/chunk/storage/SerializableChunkData.java new file mode 100644 index 00000000..aaac50eb --- /dev/null +++ b/net/minecraft/world/level/chunk/storage/SerializableChunkData.java @@ -0,0 +1,673 @@ +package net.minecraft.world.level.chunk.storage; + +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import com.mojang.logging.LogUtils; +import com.mojang.serialization.Codec; +import it.unimi.dsi.fastutil.longs.LongOpenHashSet; +import it.unimi.dsi.fastutil.longs.LongSet; +import it.unimi.dsi.fastutil.shorts.ShortArrayList; +import it.unimi.dsi.fastutil.shorts.ShortList; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.EnumMap; +import java.util.EnumSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Map.Entry; +import net.minecraft.Optionull; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Holder; +import net.minecraft.core.Registry; +import net.minecraft.core.RegistryAccess; +import net.minecraft.core.SectionPos; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.core.registries.Registries; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.ListTag; +import net.minecraft.nbt.LongArrayTag; +import net.minecraft.nbt.NbtException; +import net.minecraft.nbt.NbtOps; +import net.minecraft.nbt.NbtUtils; +import net.minecraft.nbt.ShortTag; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.entity.EntitySpawnReason; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.ai.village.poi.PoiManager; +import net.minecraft.world.level.ChunkPos; +import net.minecraft.world.level.LevelHeightAccessor; +import net.minecraft.world.level.LightLayer; +import net.minecraft.world.level.biome.Biome; +import net.minecraft.world.level.biome.Biomes; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.chunk.CarvingMask; +import net.minecraft.world.level.chunk.ChunkAccess; +import net.minecraft.world.level.chunk.ChunkSource; +import net.minecraft.world.level.chunk.DataLayer; +import net.minecraft.world.level.chunk.ImposterProtoChunk; +import net.minecraft.world.level.chunk.LevelChunk; +import net.minecraft.world.level.chunk.LevelChunkSection; +import net.minecraft.world.level.chunk.PalettedContainer; +import net.minecraft.world.level.chunk.PalettedContainerRO; +import net.minecraft.world.level.chunk.ProtoChunk; +import net.minecraft.world.level.chunk.UpgradeData; +import net.minecraft.world.level.chunk.status.ChunkStatus; +import net.minecraft.world.level.chunk.status.ChunkType; +import net.minecraft.world.level.levelgen.BelowZeroRetrogen; +import net.minecraft.world.level.levelgen.Heightmap; +import net.minecraft.world.level.levelgen.blending.BlendingData; +import net.minecraft.world.level.levelgen.structure.Structure; +import net.minecraft.world.level.levelgen.structure.StructureStart; +import net.minecraft.world.level.levelgen.structure.pieces.StructurePieceSerializationContext; +import net.minecraft.world.level.lighting.LevelLightEngine; +import net.minecraft.world.level.material.Fluid; +import net.minecraft.world.ticks.LevelChunkTicks; +import net.minecraft.world.ticks.ProtoChunkTicks; +import net.minecraft.world.ticks.SavedTick; +import org.jetbrains.annotations.Nullable; +import org.slf4j.Logger; + +public record SerializableChunkData( + Registry biomeRegistry, + ChunkPos chunkPos, + int minSectionY, + long lastUpdateTime, + long inhabitedTime, + ChunkStatus chunkStatus, + @Nullable BlendingData.Packed blendingData, + @Nullable BelowZeroRetrogen belowZeroRetrogen, + UpgradeData upgradeData, + @Nullable long[] carvingMask, + Map heightmaps, + ChunkAccess.PackedTicks packedTicks, + ShortList[] postProcessingSections, + boolean lightCorrect, + List sectionData, + List entities, + List blockEntities, + CompoundTag structureData +) { + private static final Codec> BLOCK_STATE_CODEC = PalettedContainer.codecRW( + Block.BLOCK_STATE_REGISTRY, BlockState.CODEC, PalettedContainer.Strategy.SECTION_STATES, Blocks.AIR.defaultBlockState() + ); + private static final Logger LOGGER = LogUtils.getLogger(); + private static final String TAG_UPGRADE_DATA = "UpgradeData"; + private static final String BLOCK_TICKS_TAG = "block_ticks"; + private static final String FLUID_TICKS_TAG = "fluid_ticks"; + public static final String X_POS_TAG = "xPos"; + public static final String Z_POS_TAG = "zPos"; + public static final String HEIGHTMAPS_TAG = "Heightmaps"; + public static final String IS_LIGHT_ON_TAG = "isLightOn"; + public static final String SECTIONS_TAG = "sections"; + public static final String BLOCK_LIGHT_TAG = "BlockLight"; + public static final String SKY_LIGHT_TAG = "SkyLight"; + + @Nullable + public static SerializableChunkData parse(LevelHeightAccessor levelHeightAccessor, RegistryAccess registryAccess, CompoundTag compoundTag) { + if (!compoundTag.contains("Status", 8)) { + return null; + } else { + ChunkPos chunkPos = new ChunkPos(compoundTag.getInt("xPos"), compoundTag.getInt("zPos")); + long l = compoundTag.getLong("LastUpdate"); + long m = compoundTag.getLong("InhabitedTime"); + ChunkStatus chunkStatus = ChunkStatus.byName(compoundTag.getString("Status")); + UpgradeData upgradeData = compoundTag.contains("UpgradeData", 10) + ? new UpgradeData(compoundTag.getCompound("UpgradeData"), levelHeightAccessor) + : UpgradeData.EMPTY; + boolean bl = compoundTag.getBoolean("isLightOn"); + BlendingData.Packed packed; + if (compoundTag.contains("blending_data", 10)) { + packed = (BlendingData.Packed)BlendingData.Packed.CODEC + .parse(NbtOps.INSTANCE, compoundTag.getCompound("blending_data")) + .resultOrPartial(LOGGER::error) + .orElse(null); + } else { + packed = null; + } + + BelowZeroRetrogen belowZeroRetrogen; + if (compoundTag.contains("below_zero_retrogen", 10)) { + belowZeroRetrogen = (BelowZeroRetrogen)BelowZeroRetrogen.CODEC + .parse(NbtOps.INSTANCE, compoundTag.getCompound("below_zero_retrogen")) + .resultOrPartial(LOGGER::error) + .orElse(null); + } else { + belowZeroRetrogen = null; + } + + long[] ls; + if (compoundTag.contains("carving_mask", 12)) { + ls = compoundTag.getLongArray("carving_mask"); + } else { + ls = null; + } + + CompoundTag compoundTag2 = compoundTag.getCompound("Heightmaps"); + Map map = new EnumMap(Heightmap.Types.class); + + for (Heightmap.Types types : chunkStatus.heightmapsAfter()) { + String string = types.getSerializationKey(); + if (compoundTag2.contains(string, 12)) { + map.put(types, compoundTag2.getLongArray(string)); + } + } + + List> list = SavedTick.loadTickList( + compoundTag.getList("block_ticks", 10), string -> BuiltInRegistries.BLOCK.getOptional(ResourceLocation.tryParse(string)), chunkPos + ); + List> list2 = SavedTick.loadTickList( + compoundTag.getList("fluid_ticks", 10), string -> BuiltInRegistries.FLUID.getOptional(ResourceLocation.tryParse(string)), chunkPos + ); + ChunkAccess.PackedTicks packedTicks = new ChunkAccess.PackedTicks(list, list2); + ListTag listTag = compoundTag.getList("PostProcessing", 9); + ShortList[] shortLists = new ShortList[listTag.size()]; + + for (int i = 0; i < listTag.size(); i++) { + ListTag listTag2 = listTag.getList(i); + ShortList shortList = new ShortArrayList(listTag2.size()); + + for (int j = 0; j < listTag2.size(); j++) { + shortList.add(listTag2.getShort(j)); + } + + shortLists[i] = shortList; + } + + List list3 = Lists.transform(compoundTag.getList("entities", 10), tag -> (CompoundTag)tag); + List list4 = Lists.transform(compoundTag.getList("block_entities", 10), tag -> (CompoundTag)tag); + CompoundTag compoundTag3 = compoundTag.getCompound("structures"); + ListTag listTag3 = compoundTag.getList("sections", 10); + List list5 = new ArrayList(listTag3.size()); + Registry registry = registryAccess.lookupOrThrow(Registries.BIOME); + Codec>> codec = makeBiomeCodec(registry); + + for (int k = 0; k < listTag3.size(); k++) { + CompoundTag compoundTag4 = listTag3.getCompound(k); + int n = compoundTag4.getByte("Y"); + LevelChunkSection levelChunkSection; + if (n >= levelHeightAccessor.getMinSectionY() && n <= levelHeightAccessor.getMaxSectionY()) { + PalettedContainer palettedContainer; + if (compoundTag4.contains("block_states", 10)) { + palettedContainer = BLOCK_STATE_CODEC.parse(NbtOps.INSTANCE, compoundTag4.getCompound("block_states")) + .promotePartial(string -> logErrors(chunkPos, n, string)) + .getOrThrow(SerializableChunkData.ChunkReadException::new); + } else { + palettedContainer = new PalettedContainer<>(Block.BLOCK_STATE_REGISTRY, Blocks.AIR.defaultBlockState(), PalettedContainer.Strategy.SECTION_STATES); + } + + PalettedContainerRO> palettedContainerRO; + if (compoundTag4.contains("biomes", 10)) { + palettedContainerRO = codec.parse(NbtOps.INSTANCE, compoundTag4.getCompound("biomes")) + .promotePartial(string -> logErrors(chunkPos, n, string)) + .getOrThrow(SerializableChunkData.ChunkReadException::new); + } else { + palettedContainerRO = new PalettedContainer<>(registry.asHolderIdMap(), registry.getOrThrow(Biomes.PLAINS), PalettedContainer.Strategy.SECTION_BIOMES); + } + + levelChunkSection = new LevelChunkSection(palettedContainer, palettedContainerRO); + } else { + levelChunkSection = null; + } + + DataLayer dataLayer = compoundTag4.contains("BlockLight", 7) ? new DataLayer(compoundTag4.getByteArray("BlockLight")) : null; + DataLayer dataLayer2 = compoundTag4.contains("SkyLight", 7) ? new DataLayer(compoundTag4.getByteArray("SkyLight")) : null; + list5.add(new SerializableChunkData.SectionData(n, levelChunkSection, dataLayer, dataLayer2)); + } + + return new SerializableChunkData( + registry, + chunkPos, + levelHeightAccessor.getMinSectionY(), + l, + m, + chunkStatus, + packed, + belowZeroRetrogen, + upgradeData, + ls, + map, + packedTicks, + shortLists, + bl, + list5, + list3, + list4, + compoundTag3 + ); + } + } + + public ProtoChunk read(ServerLevel serverLevel, PoiManager poiManager, RegionStorageInfo regionStorageInfo, ChunkPos chunkPos) { + if (!Objects.equals(chunkPos, this.chunkPos)) { + LOGGER.error("Chunk file at {} is in the wrong location; relocating. (Expected {}, got {})", chunkPos, chunkPos, this.chunkPos); + serverLevel.getServer().reportMisplacedChunk(this.chunkPos, chunkPos, regionStorageInfo); + } + + int i = serverLevel.getSectionsCount(); + LevelChunkSection[] levelChunkSections = new LevelChunkSection[i]; + boolean bl = serverLevel.dimensionType().hasSkyLight(); + ChunkSource chunkSource = serverLevel.getChunkSource(); + LevelLightEngine levelLightEngine = chunkSource.getLightEngine(); + Registry registry = serverLevel.registryAccess().lookupOrThrow(Registries.BIOME); + boolean bl2 = false; + + for (SerializableChunkData.SectionData sectionData : this.sectionData) { + SectionPos sectionPos = SectionPos.of(chunkPos, sectionData.y); + if (sectionData.chunkSection != null) { + levelChunkSections[serverLevel.getSectionIndexFromSectionY(sectionData.y)] = sectionData.chunkSection; + poiManager.checkConsistencyWithBlocks(sectionPos, sectionData.chunkSection); + } + + boolean bl3 = sectionData.blockLight != null; + boolean bl4 = bl && sectionData.skyLight != null; + if (bl3 || bl4) { + if (!bl2) { + levelLightEngine.retainData(chunkPos, true); + bl2 = true; + } + + if (bl3) { + levelLightEngine.queueSectionData(LightLayer.BLOCK, sectionPos, sectionData.blockLight); + } + + if (bl4) { + levelLightEngine.queueSectionData(LightLayer.SKY, sectionPos, sectionData.skyLight); + } + } + } + + ChunkType chunkType = this.chunkStatus.getChunkType(); + ChunkAccess chunkAccess; + if (chunkType == ChunkType.LEVELCHUNK) { + LevelChunkTicks levelChunkTicks = new LevelChunkTicks<>(this.packedTicks.blocks()); + LevelChunkTicks levelChunkTicks2 = new LevelChunkTicks<>(this.packedTicks.fluids()); + chunkAccess = new LevelChunk( + serverLevel.getLevel(), + chunkPos, + this.upgradeData, + levelChunkTicks, + levelChunkTicks2, + this.inhabitedTime, + levelChunkSections, + postLoadChunk(serverLevel, this.entities, this.blockEntities), + BlendingData.unpack(this.blendingData) + ); + } else { + ProtoChunkTicks protoChunkTicks = ProtoChunkTicks.load(this.packedTicks.blocks()); + ProtoChunkTicks protoChunkTicks2 = ProtoChunkTicks.load(this.packedTicks.fluids()); + ProtoChunk protoChunk = new ProtoChunk( + chunkPos, this.upgradeData, levelChunkSections, protoChunkTicks, protoChunkTicks2, serverLevel, registry, BlendingData.unpack(this.blendingData) + ); + chunkAccess = protoChunk; + protoChunk.setInhabitedTime(this.inhabitedTime); + if (this.belowZeroRetrogen != null) { + protoChunk.setBelowZeroRetrogen(this.belowZeroRetrogen); + } + + protoChunk.setPersistedStatus(this.chunkStatus); + if (this.chunkStatus.isOrAfter(ChunkStatus.INITIALIZE_LIGHT)) { + protoChunk.setLightEngine(levelLightEngine); + } + } + + chunkAccess.setLightCorrect(this.lightCorrect); + EnumSet enumSet = EnumSet.noneOf(Heightmap.Types.class); + + for (Heightmap.Types types : chunkAccess.getPersistedStatus().heightmapsAfter()) { + long[] ls = (long[])this.heightmaps.get(types); + if (ls != null) { + chunkAccess.setHeightmap(types, ls); + } else { + enumSet.add(types); + } + } + + Heightmap.primeHeightmaps(chunkAccess, enumSet); + chunkAccess.setAllStarts(unpackStructureStart(StructurePieceSerializationContext.fromLevel(serverLevel), this.structureData, serverLevel.getSeed())); + chunkAccess.setAllReferences(unpackStructureReferences(serverLevel.registryAccess(), chunkPos, this.structureData)); + + for (int j = 0; j < this.postProcessingSections.length; j++) { + chunkAccess.addPackedPostProcess(this.postProcessingSections[j], j); + } + + if (chunkType == ChunkType.LEVELCHUNK) { + return new ImposterProtoChunk((LevelChunk)chunkAccess, false); + } else { + ProtoChunk protoChunk2 = (ProtoChunk)chunkAccess; + + for (CompoundTag compoundTag : this.entities) { + protoChunk2.addEntity(compoundTag); + } + + for (CompoundTag compoundTag : this.blockEntities) { + protoChunk2.setBlockEntityNbt(compoundTag); + } + + if (this.carvingMask != null) { + protoChunk2.setCarvingMask(new CarvingMask(this.carvingMask, chunkAccess.getMinY())); + } + + return protoChunk2; + } + } + + private static void logErrors(ChunkPos chunkPos, int i, String string) { + LOGGER.error("Recoverable errors when loading section [{}, {}, {}]: {}", chunkPos.x, i, chunkPos.z, string); + } + + private static Codec>> makeBiomeCodec(Registry registry) { + return PalettedContainer.codecRO( + registry.asHolderIdMap(), registry.holderByNameCodec(), PalettedContainer.Strategy.SECTION_BIOMES, registry.getOrThrow(Biomes.PLAINS) + ); + } + + public static SerializableChunkData copyOf(ServerLevel serverLevel, ChunkAccess chunkAccess) { + if (!chunkAccess.canBeSerialized()) { + throw new IllegalArgumentException("Chunk can't be serialized: " + chunkAccess); + } else { + ChunkPos chunkPos = chunkAccess.getPos(); + List list = new ArrayList(); + LevelChunkSection[] levelChunkSections = chunkAccess.getSections(); + LevelLightEngine levelLightEngine = serverLevel.getChunkSource().getLightEngine(); + + for (int i = levelLightEngine.getMinLightSection(); i < levelLightEngine.getMaxLightSection(); i++) { + int j = chunkAccess.getSectionIndexFromSectionY(i); + boolean bl = j >= 0 && j < levelChunkSections.length; + DataLayer dataLayer = levelLightEngine.getLayerListener(LightLayer.BLOCK).getDataLayerData(SectionPos.of(chunkPos, i)); + DataLayer dataLayer2 = levelLightEngine.getLayerListener(LightLayer.SKY).getDataLayerData(SectionPos.of(chunkPos, i)); + DataLayer dataLayer3 = dataLayer != null && !dataLayer.isEmpty() ? dataLayer.copy() : null; + DataLayer dataLayer4 = dataLayer2 != null && !dataLayer2.isEmpty() ? dataLayer2.copy() : null; + if (bl || dataLayer3 != null || dataLayer4 != null) { + LevelChunkSection levelChunkSection = bl ? levelChunkSections[j].copy() : null; + list.add(new SerializableChunkData.SectionData(i, levelChunkSection, dataLayer3, dataLayer4)); + } + } + + List list2 = new ArrayList(chunkAccess.getBlockEntitiesPos().size()); + + for (BlockPos blockPos : chunkAccess.getBlockEntitiesPos()) { + CompoundTag compoundTag = chunkAccess.getBlockEntityNbtForSaving(blockPos, serverLevel.registryAccess()); + if (compoundTag != null) { + list2.add(compoundTag); + } + } + + List list3 = new ArrayList(); + long[] ls = null; + if (chunkAccess.getPersistedStatus().getChunkType() == ChunkType.PROTOCHUNK) { + ProtoChunk protoChunk = (ProtoChunk)chunkAccess; + list3.addAll(protoChunk.getEntities()); + CarvingMask carvingMask = protoChunk.getCarvingMask(); + if (carvingMask != null) { + ls = carvingMask.toArray(); + } + } + + Map map = new EnumMap(Heightmap.Types.class); + + for (Entry entry : chunkAccess.getHeightmaps()) { + if (chunkAccess.getPersistedStatus().heightmapsAfter().contains(entry.getKey())) { + long[] ms = ((Heightmap)entry.getValue()).getRawData(); + map.put((Heightmap.Types)entry.getKey(), (long[])ms.clone()); + } + } + + ChunkAccess.PackedTicks packedTicks = chunkAccess.getTicksForSerialization(serverLevel.getGameTime()); + ShortList[] shortLists = (ShortList[])Arrays.stream(chunkAccess.getPostProcessing()) + .map(shortList -> shortList != null ? new ShortArrayList(shortList) : null) + .toArray(ShortList[]::new); + CompoundTag compoundTag2 = packStructureData( + StructurePieceSerializationContext.fromLevel(serverLevel), chunkPos, chunkAccess.getAllStarts(), chunkAccess.getAllReferences() + ); + return new SerializableChunkData( + serverLevel.registryAccess().lookupOrThrow(Registries.BIOME), + chunkPos, + chunkAccess.getMinSectionY(), + serverLevel.getGameTime(), + chunkAccess.getInhabitedTime(), + chunkAccess.getPersistedStatus(), + Optionull.map(chunkAccess.getBlendingData(), BlendingData::pack), + chunkAccess.getBelowZeroRetrogen(), + chunkAccess.getUpgradeData().copy(), + ls, + map, + packedTicks, + shortLists, + chunkAccess.isLightCorrect(), + list, + list3, + list2, + compoundTag2 + ); + } + } + + public CompoundTag write() { + CompoundTag compoundTag = NbtUtils.addCurrentDataVersion(new CompoundTag()); + compoundTag.putInt("xPos", this.chunkPos.x); + compoundTag.putInt("yPos", this.minSectionY); + compoundTag.putInt("zPos", this.chunkPos.z); + compoundTag.putLong("LastUpdate", this.lastUpdateTime); + compoundTag.putLong("InhabitedTime", this.inhabitedTime); + compoundTag.putString("Status", BuiltInRegistries.CHUNK_STATUS.getKey(this.chunkStatus).toString()); + if (this.blendingData != null) { + BlendingData.Packed.CODEC + .encodeStart(NbtOps.INSTANCE, this.blendingData) + .resultOrPartial(LOGGER::error) + .ifPresent(tag -> compoundTag.put("blending_data", tag)); + } + + if (this.belowZeroRetrogen != null) { + BelowZeroRetrogen.CODEC + .encodeStart(NbtOps.INSTANCE, this.belowZeroRetrogen) + .resultOrPartial(LOGGER::error) + .ifPresent(tag -> compoundTag.put("below_zero_retrogen", tag)); + } + + if (!this.upgradeData.isEmpty()) { + compoundTag.put("UpgradeData", this.upgradeData.write()); + } + + ListTag listTag = new ListTag(); + Codec>> codec = makeBiomeCodec(this.biomeRegistry); + + for (SerializableChunkData.SectionData sectionData : this.sectionData) { + CompoundTag compoundTag2 = new CompoundTag(); + LevelChunkSection levelChunkSection = sectionData.chunkSection; + if (levelChunkSection != null) { + compoundTag2.put("block_states", BLOCK_STATE_CODEC.encodeStart(NbtOps.INSTANCE, levelChunkSection.getStates()).getOrThrow()); + compoundTag2.put("biomes", codec.encodeStart(NbtOps.INSTANCE, levelChunkSection.getBiomes()).getOrThrow()); + } + + if (sectionData.blockLight != null) { + compoundTag2.putByteArray("BlockLight", sectionData.blockLight.getData()); + } + + if (sectionData.skyLight != null) { + compoundTag2.putByteArray("SkyLight", sectionData.skyLight.getData()); + } + + if (!compoundTag2.isEmpty()) { + compoundTag2.putByte("Y", (byte)sectionData.y); + listTag.add(compoundTag2); + } + } + + compoundTag.put("sections", listTag); + if (this.lightCorrect) { + compoundTag.putBoolean("isLightOn", true); + } + + ListTag listTag2 = new ListTag(); + listTag2.addAll(this.blockEntities); + compoundTag.put("block_entities", listTag2); + if (this.chunkStatus.getChunkType() == ChunkType.PROTOCHUNK) { + ListTag listTag3 = new ListTag(); + listTag3.addAll(this.entities); + compoundTag.put("entities", listTag3); + if (this.carvingMask != null) { + compoundTag.putLongArray("carving_mask", this.carvingMask); + } + } + + saveTicks(compoundTag, this.packedTicks); + compoundTag.put("PostProcessing", packOffsets(this.postProcessingSections)); + CompoundTag compoundTag3 = new CompoundTag(); + this.heightmaps.forEach((types, ls) -> compoundTag3.put(types.getSerializationKey(), new LongArrayTag(ls))); + compoundTag.put("Heightmaps", compoundTag3); + compoundTag.put("structures", this.structureData); + return compoundTag; + } + + private static void saveTicks(CompoundTag compoundTag, ChunkAccess.PackedTicks packedTicks) { + ListTag listTag = new ListTag(); + + for (SavedTick savedTick : packedTicks.blocks()) { + listTag.add(savedTick.save(block -> BuiltInRegistries.BLOCK.getKey(block).toString())); + } + + compoundTag.put("block_ticks", listTag); + ListTag listTag2 = new ListTag(); + + for (SavedTick savedTick2 : packedTicks.fluids()) { + listTag2.add(savedTick2.save(fluid -> BuiltInRegistries.FLUID.getKey(fluid).toString())); + } + + compoundTag.put("fluid_ticks", listTag2); + } + + public static ChunkType getChunkTypeFromTag(@Nullable CompoundTag compoundTag) { + return compoundTag != null ? ChunkStatus.byName(compoundTag.getString("Status")).getChunkType() : ChunkType.PROTOCHUNK; + } + + @Nullable + private static LevelChunk.PostLoadProcessor postLoadChunk(ServerLevel serverLevel, List list, List list2) { + return list.isEmpty() && list2.isEmpty() ? null : levelChunk -> { + if (!list.isEmpty()) { + serverLevel.addLegacyChunkEntities(EntityType.loadEntitiesRecursive(list, serverLevel, EntitySpawnReason.LOAD)); + } + + for (CompoundTag compoundTag : list2) { + boolean bl = compoundTag.getBoolean("keepPacked"); + if (bl) { + levelChunk.setBlockEntityNbt(compoundTag); + } else { + BlockPos blockPos = BlockEntity.getPosFromTag(compoundTag); + BlockEntity blockEntity = BlockEntity.loadStatic(blockPos, levelChunk.getBlockState(blockPos), compoundTag, serverLevel.registryAccess()); + if (blockEntity != null) { + levelChunk.setBlockEntity(blockEntity); + } + } + } + }; + } + + private static CompoundTag packStructureData( + StructurePieceSerializationContext structurePieceSerializationContext, ChunkPos chunkPos, Map map, Map map2 + ) { + CompoundTag compoundTag = new CompoundTag(); + CompoundTag compoundTag2 = new CompoundTag(); + Registry registry = structurePieceSerializationContext.registryAccess().lookupOrThrow(Registries.STRUCTURE); + + for (Entry entry : map.entrySet()) { + ResourceLocation resourceLocation = registry.getKey((Structure)entry.getKey()); + compoundTag2.put(resourceLocation.toString(), ((StructureStart)entry.getValue()).createTag(structurePieceSerializationContext, chunkPos)); + } + + compoundTag.put("starts", compoundTag2); + CompoundTag compoundTag3 = new CompoundTag(); + + for (Entry entry2 : map2.entrySet()) { + if (!((LongSet)entry2.getValue()).isEmpty()) { + ResourceLocation resourceLocation2 = registry.getKey((Structure)entry2.getKey()); + compoundTag3.put(resourceLocation2.toString(), new LongArrayTag((LongSet)entry2.getValue())); + } + } + + compoundTag.put("References", compoundTag3); + return compoundTag; + } + + private static Map unpackStructureStart( + StructurePieceSerializationContext structurePieceSerializationContext, CompoundTag compoundTag, long l + ) { + Map map = Maps.newHashMap(); + Registry registry = structurePieceSerializationContext.registryAccess().lookupOrThrow(Registries.STRUCTURE); + CompoundTag compoundTag2 = compoundTag.getCompound("starts"); + + for (String string : compoundTag2.getAllKeys()) { + ResourceLocation resourceLocation = ResourceLocation.tryParse(string); + Structure structure = registry.getValue(resourceLocation); + if (structure == null) { + LOGGER.error("Unknown structure start: {}", resourceLocation); + } else { + StructureStart structureStart = StructureStart.loadStaticStart(structurePieceSerializationContext, compoundTag2.getCompound(string), l); + if (structureStart != null) { + map.put(structure, structureStart); + } + } + } + + return map; + } + + private static Map unpackStructureReferences(RegistryAccess registryAccess, ChunkPos chunkPos, CompoundTag compoundTag) { + Map map = Maps.newHashMap(); + Registry registry = registryAccess.lookupOrThrow(Registries.STRUCTURE); + CompoundTag compoundTag2 = compoundTag.getCompound("References"); + + for (String string : compoundTag2.getAllKeys()) { + ResourceLocation resourceLocation = ResourceLocation.tryParse(string); + Structure structure = registry.getValue(resourceLocation); + if (structure == null) { + LOGGER.warn("Found reference to unknown structure '{}' in chunk {}, discarding", resourceLocation, chunkPos); + } else { + long[] ls = compoundTag2.getLongArray(string); + if (ls.length != 0) { + map.put(structure, new LongOpenHashSet(Arrays.stream(ls).filter(l -> { + ChunkPos chunkPos2 = new ChunkPos(l); + if (chunkPos2.getChessboardDistance(chunkPos) > 8) { + LOGGER.warn("Found invalid structure reference [ {} @ {} ] for chunk {}.", resourceLocation, chunkPos2, chunkPos); + return false; + } else { + return true; + } + }).toArray())); + } + } + } + + return map; + } + + private static ListTag packOffsets(ShortList[] shortLists) { + ListTag listTag = new ListTag(); + + for (ShortList shortList : shortLists) { + ListTag listTag2 = new ListTag(); + if (shortList != null) { + for (int i = 0; i < shortList.size(); i++) { + listTag2.add(ShortTag.valueOf(shortList.getShort(i))); + } + } + + listTag.add(listTag2); + } + + return listTag; + } + + public static class ChunkReadException extends NbtException { + public ChunkReadException(String string) { + super(string); + } + } + + public record SectionData(int y, @Nullable LevelChunkSection chunkSection, @Nullable DataLayer blockLight, @Nullable DataLayer skyLight) { + } +} diff --git a/net/minecraft/world/level/dimension/DimensionDefaults.java b/net/minecraft/world/level/dimension/DimensionDefaults.java index 17212a7a..812c16c0 100644 --- a/net/minecraft/world/level/dimension/DimensionDefaults.java +++ b/net/minecraft/world/level/dimension/DimensionDefaults.java @@ -13,4 +13,5 @@ public class DimensionDefaults { public static final int END_LEVEL_HEIGHT = 256; public static final int END_GENERATION_HEIGHT = 128; public static final int END_LOGICAL_HEIGHT = 256; + public static final int END_ISLAND_BASE_Y = 63; } diff --git a/net/minecraft/world/level/dimension/end/EndDragonFight.java b/net/minecraft/world/level/dimension/end/EndDragonFight.java index 8ab0e3f1..ac28de2b 100644 --- a/net/minecraft/world/level/dimension/end/EndDragonFight.java +++ b/net/minecraft/world/level/dimension/end/EndDragonFight.java @@ -32,10 +32,12 @@ import net.minecraft.server.level.TicketType; import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; import net.minecraft.util.Unit; -import net.minecraft.world.BossEvent; +import net.minecraft.world.BossEvent.BossBarColor; +import net.minecraft.world.BossEvent.BossBarOverlay; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntitySelector; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.boss.enderdragon.EndCrystal; import net.minecraft.world.entity.boss.enderdragon.EnderDragon; @@ -47,6 +49,7 @@ import net.minecraft.world.level.block.entity.TheEndPortalBlockEntity; import net.minecraft.world.level.block.state.pattern.BlockInWorld; import net.minecraft.world.level.block.state.pattern.BlockPattern; import net.minecraft.world.level.block.state.pattern.BlockPatternBuilder; +import net.minecraft.world.level.block.state.pattern.BlockPattern.BlockPatternMatch; import net.minecraft.world.level.block.state.predicate.BlockPredicate; import net.minecraft.world.level.chunk.ChunkAccess; import net.minecraft.world.level.chunk.LevelChunk; @@ -72,7 +75,7 @@ public class EndDragonFight { public static final int DRAGON_SPAWN_Y = 128; private final Predicate validPlayer; private final ServerBossEvent dragonEvent = (ServerBossEvent)new ServerBossEvent( - Component.translatable("entity.minecraft.ender_dragon"), BossEvent.BossBarColor.PINK, BossEvent.BossBarOverlay.PROGRESS + Component.translatable("entity.minecraft.ender_dragon"), BossBarColor.PINK, BossBarOverlay.PROGRESS ) .setPlayBossMusic(true) .setCreateWorldFog(true); @@ -270,7 +273,7 @@ public class EndDragonFight { } @Nullable - private BlockPattern.BlockPatternMatch findExitPortal() { + private BlockPatternMatch findExitPortal() { ChunkPos chunkPos = new ChunkPos(this.origin); for (int i = -8 + chunkPos.x; i <= 8 + chunkPos.x; i++) { @@ -279,7 +282,7 @@ public class EndDragonFight { for (BlockEntity blockEntity : levelChunk.getBlockEntities().values()) { if (blockEntity instanceof TheEndPortalBlockEntity) { - BlockPattern.BlockPatternMatch blockPatternMatch = this.exitPortalPattern.find(this.level, blockEntity.getBlockPos()); + BlockPatternMatch blockPatternMatch = this.exitPortalPattern.find(this.level, blockEntity.getBlockPos()); if (blockPatternMatch != null) { BlockPos blockPos = blockPatternMatch.getBlock(3, 3, 3).getPos(); if (this.portalLocation == null) { @@ -296,8 +299,8 @@ public class EndDragonFight { BlockPos blockPos2 = EndPodiumFeature.getLocation(this.origin); int j = this.level.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, blockPos2).getY(); - for (int k = j; k >= this.level.getMinBuildHeight(); k--) { - BlockPattern.BlockPatternMatch blockPatternMatch2 = this.exitPortalPattern.find(this.level, new BlockPos(blockPos2.getX(), k, blockPos2.getZ())); + for (int k = j; k >= this.level.getMinY(); k--) { + BlockPatternMatch blockPatternMatch2 = this.exitPortalPattern.find(this.level, new BlockPos(blockPos2.getX(), k, blockPos2.getZ())); if (blockPatternMatch2 != null) { if (this.portalLocation == null) { this.portalLocation = blockPatternMatch2.getBlock(3, 3, 3).getPos(); @@ -398,8 +401,8 @@ public class EndDragonFight { this.level.levelEvent(3000, pos, 0); this.level .registryAccess() - .registry(Registries.CONFIGURED_FEATURE) - .flatMap(registry -> registry.getHolder(EndFeatures.END_GATEWAY_DELAYED)) + .lookup(Registries.CONFIGURED_FEATURE) + .flatMap(registry -> registry.get(EndFeatures.END_GATEWAY_DELAYED)) .ifPresent(reference -> ((ConfiguredFeature)reference.value()).place(this.level, this.level.getChunkSource().getGenerator(), RandomSource.create(), pos)); } @@ -408,7 +411,7 @@ public class EndDragonFight { if (this.portalLocation == null) { this.portalLocation = this.level.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, EndPodiumFeature.getLocation(this.origin)).below(); - while (this.level.getBlockState(this.portalLocation).is(Blocks.BEDROCK) && this.portalLocation.getY() > this.level.getSeaLevel()) { + while (this.level.getBlockState(this.portalLocation).is(Blocks.BEDROCK) && this.portalLocation.getY() > 63) { this.portalLocation = this.portalLocation.below(); } } @@ -422,7 +425,7 @@ public class EndDragonFight { @Nullable private EnderDragon createNewDragon() { this.level.getChunkAt(new BlockPos(this.origin.getX(), 128 + this.origin.getY(), this.origin.getZ())); - EnderDragon enderDragon = EntityType.ENDER_DRAGON.create(this.level); + EnderDragon enderDragon = EntityType.ENDER_DRAGON.create(this.level, EntitySpawnReason.EVENT); if (enderDragon != null) { enderDragon.setDragonFight(this); enderDragon.setFightOrigin(this.origin); @@ -458,9 +461,8 @@ public class EndDragonFight { this.spawnExitPortal(true); } else { this.updateCrystalCount(); - Entity entity = this.level.getEntity(this.dragonUUID); - if (entity instanceof EnderDragon) { - ((EnderDragon)entity).onCrystalDestroyed(crystal, crystal.blockPosition(), dmgSrc); + if (this.level.getEntity(this.dragonUUID) instanceof EnderDragon enderDragon) { + enderDragon.onCrystalDestroyed(this.level, crystal, crystal.blockPosition(), dmgSrc); } } } @@ -474,7 +476,7 @@ public class EndDragonFight { BlockPos blockPos = this.portalLocation; if (blockPos == null) { LOGGER.debug("Tried to respawn, but need to find the portal first."); - BlockPattern.BlockPatternMatch blockPatternMatch = this.findExitPortal(); + BlockPatternMatch blockPatternMatch = this.findExitPortal(); if (blockPatternMatch == null) { LOGGER.debug("Couldn't find a portal, so we made one."); this.spawnExitPortal(true); @@ -504,7 +506,7 @@ public class EndDragonFight { private void respawnDragon(List crystals) { if (this.dragonKilled && this.respawnStage == null) { - for (BlockPattern.BlockPatternMatch blockPatternMatch = this.findExitPortal(); blockPatternMatch != null; blockPatternMatch = this.findExitPortal()) { + for (BlockPatternMatch blockPatternMatch = this.findExitPortal(); blockPatternMatch != null; blockPatternMatch = this.findExitPortal()) { for (int i = 0; i < this.exitPortalPattern.getWidth(); i++) { for (int j = 0; j < this.exitPortalPattern.getHeight(); j++) { for (int k = 0; k < this.exitPortalPattern.getDepth(); k++) { diff --git a/net/minecraft/world/level/entity/EntitySectionStorage.java b/net/minecraft/world/level/entity/EntitySectionStorage.java index aed752d6..ab1a9e23 100644 --- a/net/minecraft/world/level/entity/EntitySectionStorage.java +++ b/net/minecraft/world/level/entity/EntitySectionStorage.java @@ -22,6 +22,8 @@ import net.minecraft.world.phys.AABB; import org.jetbrains.annotations.Nullable; public class EntitySectionStorage { + public static final int CHONKY_ENTITY_SEARCH_GRACE = 2; + public static final int MAX_NON_CHONKY_ENTITY_SIZE = 4; private final Class entityClass; private final Long2ObjectFunction intialSectionVisibility; private final Long2ObjectMap> sections = new Long2ObjectOpenHashMap<>(); @@ -33,25 +35,24 @@ public class EntitySectionStorage { } public void forEachAccessibleNonEmptySection(AABB boundingBox, AbortableIterationConsumer> consumer) { - int i = 2; - int j = SectionPos.posToSectionCoord(boundingBox.minX - 2.0); - int k = SectionPos.posToSectionCoord(boundingBox.minY - 4.0); - int l = SectionPos.posToSectionCoord(boundingBox.minZ - 2.0); - int m = SectionPos.posToSectionCoord(boundingBox.maxX + 2.0); - int n = SectionPos.posToSectionCoord(boundingBox.maxY + 0.0); - int o = SectionPos.posToSectionCoord(boundingBox.maxZ + 2.0); + int i = SectionPos.posToSectionCoord(boundingBox.minX - 2.0); + int j = SectionPos.posToSectionCoord(boundingBox.minY - 4.0); + int k = SectionPos.posToSectionCoord(boundingBox.minZ - 2.0); + int l = SectionPos.posToSectionCoord(boundingBox.maxX + 2.0); + int m = SectionPos.posToSectionCoord(boundingBox.maxY + 0.0); + int n = SectionPos.posToSectionCoord(boundingBox.maxZ + 2.0); - for (int p = j; p <= m; p++) { - long q = SectionPos.asLong(p, 0, 0); - long r = SectionPos.asLong(p, -1, -1); - LongIterator longIterator = this.sectionIds.subSet(q, r + 1L).iterator(); + for (int o = i; o <= l; o++) { + long p = SectionPos.asLong(o, 0, 0); + long q = SectionPos.asLong(o, -1, -1); + LongIterator longIterator = this.sectionIds.subSet(p, q + 1L).iterator(); while (longIterator.hasNext()) { - long s = longIterator.nextLong(); - int t = SectionPos.y(s); - int u = SectionPos.z(s); - if (t >= k && t <= n && u >= l && u <= o) { - EntitySection entitySection = this.sections.get(s); + long r = longIterator.nextLong(); + int s = SectionPos.y(r); + int t = SectionPos.z(r); + if (s >= j && s <= m && t >= k && t <= n) { + EntitySection entitySection = this.sections.get(r); if (entitySection != null && !entitySection.isEmpty() && entitySection.getStatus().isAccessible() && consumer.accept(entitySection).shouldAbort()) { return; } diff --git a/net/minecraft/world/level/levelgen/Aquifer.java b/net/minecraft/world/level/levelgen/Aquifer.java index d4cdfa89..6a44a7ce 100644 --- a/net/minecraft/world/level/levelgen/Aquifer.java +++ b/net/minecraft/world/level/levelgen/Aquifer.java @@ -10,6 +10,8 @@ import net.minecraft.world.level.biome.OverworldBiomeBuilder; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.dimension.DimensionType; +import net.minecraft.world.level.levelgen.DensityFunction.FunctionContext; +import net.minecraft.world.level.levelgen.DensityFunction.SinglePointContext; import org.apache.commons.lang3.mutable.MutableDouble; import org.jetbrains.annotations.Nullable; @@ -44,7 +46,7 @@ public interface Aquifer { return new Aquifer() { @Nullable @Override - public BlockState computeSubstance(DensityFunction.FunctionContext context, double substance) { + public BlockState computeSubstance(FunctionContext context, double substance) { return substance > 0.0 ? null : defaultFluid.computeFluid(context.blockX(), context.blockY(), context.blockZ()).at(context.blockY()); } @@ -56,7 +58,7 @@ public interface Aquifer { } @Nullable - BlockState computeSubstance(DensityFunction.FunctionContext context, double substance); + BlockState computeSubstance(FunctionContext context, double substance); /** * Returns {@code true} if there should be a fluid update scheduled - due to a fluid block being placed in a possibly unsteady position - at the last position passed into {@link #computeState}. @@ -68,20 +70,7 @@ public interface Aquifer { Aquifer.FluidStatus computeFluid(int i, int j, int k); } - public static final class FluidStatus { - /** - * The y height of the aquifer. - */ - final int fluidLevel; - /** - * The fluid state the aquifer is filled with. - */ - final BlockState fluidType; - - public FluidStatus(int fluidLevel, BlockState fluidType) { - this.fluidLevel = fluidLevel; - this.fluidType = fluidType; - } + public record FluidStatus(int fluidLevel, BlockState fluidType) { public BlockState at(int y) { return y < this.fluidLevel ? this.fluidType : Blocks.AIR.defaultBlockState(); @@ -166,7 +155,7 @@ public interface Aquifer { @Nullable @Override - public BlockState computeSubstance(DensityFunction.FunctionContext context, double substance) { + public BlockState computeSubstance(FunctionContext context, double substance) { int i = context.blockX(); int j = context.blockY(); int k = context.blockZ(); @@ -185,72 +174,89 @@ public interface Aquifer { int o = Integer.MAX_VALUE; int p = Integer.MAX_VALUE; int q = Integer.MAX_VALUE; - long r = 0L; + int r = Integer.MAX_VALUE; long s = 0L; long t = 0L; + long u = 0L; + long v = 0L; - for (int u = 0; u <= 1; u++) { - for (int v = -1; v <= 1; v++) { - for (int w = 0; w <= 1; w++) { - int x = l + u; - int y = m + v; - int z = n + w; - int aa = this.getIndex(x, y, z); - long ab = this.aquiferLocationCache[aa]; - long ac; - if (ab != Long.MAX_VALUE) { - ac = ab; + for (int w = 0; w <= 1; w++) { + for (int x = -1; x <= 1; x++) { + for (int y = 0; y <= 1; y++) { + int z = l + w; + int aa = m + x; + int ab = n + y; + int ac = this.getIndex(z, aa, ab); + long ad = this.aquiferLocationCache[ac]; + long ae; + if (ad != Long.MAX_VALUE) { + ae = ad; } else { - RandomSource randomSource = this.positionalRandomFactory.at(x, y, z); - ac = BlockPos.asLong(x * 16 + randomSource.nextInt(10), y * 12 + randomSource.nextInt(9), z * 16 + randomSource.nextInt(10)); - this.aquiferLocationCache[aa] = ac; + RandomSource randomSource = this.positionalRandomFactory.at(z, aa, ab); + ae = BlockPos.asLong(z * 16 + randomSource.nextInt(10), aa * 12 + randomSource.nextInt(9), ab * 16 + randomSource.nextInt(10)); + this.aquiferLocationCache[ac] = ae; } - int ad = BlockPos.getX(ac) - i; - int ae = BlockPos.getY(ac) - j; - int af = BlockPos.getZ(ac) - k; - int ag = ad * ad + ae * ae + af * af; - if (o >= ag) { + int af = BlockPos.getX(ae) - i; + int ag = BlockPos.getY(ae) - j; + int ah = BlockPos.getZ(ae) - k; + int ai = af * af + ag * ag + ah * ah; + if (o >= ai) { + v = u; + u = t; t = s; - s = r; - r = ac; + s = ae; + r = q; q = p; p = o; - o = ag; - } else if (p >= ag) { - t = s; - s = ac; + o = ai; + } else if (p >= ai) { + v = u; + u = t; + t = ae; + r = q; q = p; - p = ag; - } else if (q >= ag) { - t = ac; - q = ag; + p = ai; + } else if (q >= ai) { + v = u; + u = ae; + r = q; + q = ai; + } else if (r >= ai) { + v = ae; + r = ai; } } } } - Aquifer.FluidStatus fluidStatus2 = this.getAquiferStatus(r); + Aquifer.FluidStatus fluidStatus2 = this.getAquiferStatus(s); double d = similarity(o, p); BlockState blockState = fluidStatus2.at(j); if (d <= 0.0) { - this.shouldScheduleFluidUpdate = d >= FLOWING_UPDATE_SIMULARITY; + if (d >= FLOWING_UPDATE_SIMULARITY) { + Aquifer.FluidStatus fluidStatus3 = this.getAquiferStatus(t); + this.shouldScheduleFluidUpdate = !fluidStatus2.equals(fluidStatus3); + } else { + this.shouldScheduleFluidUpdate = false; + } + return blockState; } else if (blockState.is(Blocks.WATER) && this.globalFluidPicker.computeFluid(i, j - 1, k).at(j - 1).is(Blocks.LAVA)) { this.shouldScheduleFluidUpdate = true; return blockState; } else { MutableDouble mutableDouble = new MutableDouble(Double.NaN); - Aquifer.FluidStatus fluidStatus3 = this.getAquiferStatus(s); - double e = d * this.calculatePressure(context, mutableDouble, fluidStatus2, fluidStatus3); + Aquifer.FluidStatus fluidStatus4 = this.getAquiferStatus(t); + double e = d * this.calculatePressure(context, mutableDouble, fluidStatus2, fluidStatus4); if (substance + e > 0.0) { this.shouldScheduleFluidUpdate = false; return null; } else { - Aquifer.FluidStatus fluidStatus4 = this.getAquiferStatus(t); + Aquifer.FluidStatus fluidStatus5 = this.getAquiferStatus(u); double f = similarity(o, q); if (f > 0.0) { - double g = d * f * this.calculatePressure(context, mutableDouble, fluidStatus2, fluidStatus4); + double g = d * f * this.calculatePressure(context, mutableDouble, fluidStatus2, fluidStatus5); if (substance + g > 0.0) { this.shouldScheduleFluidUpdate = false; return null; @@ -259,14 +265,24 @@ public interface Aquifer { double g = similarity(p, q); if (g > 0.0) { - double h = d * g * this.calculatePressure(context, mutableDouble, fluidStatus3, fluidStatus4); + double h = d * g * this.calculatePressure(context, mutableDouble, fluidStatus4, fluidStatus5); if (substance + h > 0.0) { this.shouldScheduleFluidUpdate = false; return null; } } - this.shouldScheduleFluidUpdate = true; + boolean bl = !fluidStatus2.equals(fluidStatus4); + boolean bl2 = g >= FLOWING_UPDATE_SIMULARITY && !fluidStatus4.equals(fluidStatus5); + boolean bl3 = f >= FLOWING_UPDATE_SIMULARITY && !fluidStatus2.equals(fluidStatus5); + if (!bl && !bl2 && !bl3) { + this.shouldScheduleFluidUpdate = f >= FLOWING_UPDATE_SIMULARITY + && similarity(o, r) >= FLOWING_UPDATE_SIMULARITY + && !fluidStatus2.equals(this.getAquiferStatus(v)); + } else { + this.shouldScheduleFluidUpdate = true; + } + return blockState; } } @@ -288,9 +304,7 @@ public interface Aquifer { return 1.0 - Math.abs(secondDistance - firstDistance) / 25.0; } - private double calculatePressure( - DensityFunction.FunctionContext context, MutableDouble substance, Aquifer.FluidStatus firstFluid, Aquifer.FluidStatus secondFluid - ) { + private double calculatePressure(FunctionContext context, MutableDouble substance, Aquifer.FluidStatus firstFluid, Aquifer.FluidStatus secondFluid) { int i = context.blockY(); BlockState blockState = firstFluid.at(i); BlockState blockState2 = secondFluid.at(i); @@ -422,7 +436,7 @@ public interface Aquifer { } private int computeSurfaceLevel(int x, int y, int z, Aquifer.FluidStatus fluidStatus, int maxSurfaceLevel, boolean fluidPresent) { - DensityFunction.SinglePointContext singlePointContext = new DensityFunction.SinglePointContext(x, y, z); + SinglePointContext singlePointContext = new SinglePointContext(x, y, z); double d; double e; if (OverworldBiomeBuilder.isDeepDarkRegion(this.erosion, this.depth, singlePointContext)) { @@ -459,7 +473,7 @@ public interface Aquifer { int m = Math.floorDiv(z, 16); int n = l * 40 + 20; int o = 10; - double d = this.fluidLevelSpreadNoise.compute(new DensityFunction.SinglePointContext(k, l, m)) * 10.0; + double d = this.fluidLevelSpreadNoise.compute(new SinglePointContext(k, l, m)) * 10.0; int p = Mth.quantize(d, 3); int q = n + p; return Math.min(maxSurfaceLevel, q); @@ -473,7 +487,7 @@ public interface Aquifer { int k = Math.floorDiv(x, 64); int l = Math.floorDiv(y, 40); int m = Math.floorDiv(z, 64); - double d = this.lavaNoise.compute(new DensityFunction.SinglePointContext(k, l, m)); + double d = this.lavaNoise.compute(new SinglePointContext(k, l, m)); if (Math.abs(d) > 0.3) { blockState = Blocks.LAVA.defaultBlockState(); } diff --git a/net/minecraft/world/level/levelgen/BelowZeroRetrogen.java b/net/minecraft/world/level/levelgen/BelowZeroRetrogen.java index 9c1a38a8..296fe042 100644 --- a/net/minecraft/world/level/levelgen/BelowZeroRetrogen.java +++ b/net/minecraft/world/level/levelgen/BelowZeroRetrogen.java @@ -50,7 +50,7 @@ public final class BelowZeroRetrogen { } @Override - public int getMinBuildHeight() { + public int getMinY() { return -64; } }; @@ -79,8 +79,8 @@ public final class BelowZeroRetrogen { public void applyBedrockMask(ProtoChunk chunk) { LevelHeightAccessor levelHeightAccessor = chunk.getHeightAccessorForGeneration(); - int i = levelHeightAccessor.getMinBuildHeight(); - int j = levelHeightAccessor.getMaxBuildHeight() - 1; + int i = levelHeightAccessor.getMinY(); + int j = levelHeightAccessor.getMaxY(); for (int k = 0; k < 16; k++) { for (int l = 0; l < 16; l++) { diff --git a/net/minecraft/world/level/levelgen/DebugLevelSource.java b/net/minecraft/world/level/levelgen/DebugLevelSource.java index a7068f98..e8481201 100644 --- a/net/minecraft/world/level/levelgen/DebugLevelSource.java +++ b/net/minecraft/world/level/levelgen/DebugLevelSource.java @@ -114,13 +114,7 @@ public class DebugLevelSource extends ChunkGenerator { @Override public void applyCarvers( - WorldGenRegion level, - long seed, - RandomState random, - BiomeManager biomeManager, - StructureManager structureManager, - ChunkAccess chunk, - GenerationStep.Carving step + WorldGenRegion worldGenRegion, long l, RandomState randomState, BiomeManager biomeManager, StructureManager structureManager, ChunkAccess chunkAccess ) { } diff --git a/net/minecraft/world/level/levelgen/FlatLevelSource.java b/net/minecraft/world/level/levelgen/FlatLevelSource.java index bb1729ae..ddeac4c7 100644 --- a/net/minecraft/world/level/levelgen/FlatLevelSource.java +++ b/net/minecraft/world/level/levelgen/FlatLevelSource.java @@ -61,7 +61,7 @@ public class FlatLevelSource extends ChunkGenerator { @Override public int getSpawnHeight(LevelHeightAccessor level) { - return level.getMinBuildHeight() + Math.min(level.getHeight(), this.settings.getLayers().size()); + return level.getMinY() + Math.min(level.getHeight(), this.settings.getLayers().size()); } @Override @@ -74,7 +74,7 @@ public class FlatLevelSource extends ChunkGenerator { for (int i = 0; i < Math.min(chunk.getHeight(), list.size()); i++) { BlockState blockState = (BlockState)list.get(i); if (blockState != null) { - int j = chunk.getMinBuildHeight() + i; + int j = chunk.getMinY() + i; for (int k = 0; k < 16; k++) { for (int l = 0; l < 16; l++) { @@ -93,20 +93,20 @@ public class FlatLevelSource extends ChunkGenerator { public int getBaseHeight(int x, int z, Heightmap.Types type, LevelHeightAccessor level, RandomState random) { List list = this.settings.getLayers(); - for (int i = Math.min(list.size(), level.getMaxBuildHeight()) - 1; i >= 0; i--) { + for (int i = Math.min(list.size() - 1, level.getMaxY()); i >= 0; i--) { BlockState blockState = (BlockState)list.get(i); if (blockState != null && type.isOpaque().test(blockState)) { - return level.getMinBuildHeight() + i + 1; + return level.getMinY() + i + 1; } } - return level.getMinBuildHeight(); + return level.getMinY(); } @Override public NoiseColumn getBaseColumn(int x, int z, LevelHeightAccessor height, RandomState random) { return new NoiseColumn( - height.getMinBuildHeight(), + height.getMinY(), (BlockState[])this.settings .getLayers() .stream() @@ -122,13 +122,7 @@ public class FlatLevelSource extends ChunkGenerator { @Override public void applyCarvers( - WorldGenRegion level, - long seed, - RandomState random, - BiomeManager biomeManager, - StructureManager structureManager, - ChunkAccess chunk, - GenerationStep.Carving step + WorldGenRegion worldGenRegion, long l, RandomState randomState, BiomeManager biomeManager, StructureManager structureManager, ChunkAccess chunkAccess ) { } diff --git a/net/minecraft/world/level/levelgen/GenerationStep.java b/net/minecraft/world/level/levelgen/GenerationStep.java index 730c8998..33410d00 100644 --- a/net/minecraft/world/level/levelgen/GenerationStep.java +++ b/net/minecraft/world/level/levelgen/GenerationStep.java @@ -7,27 +7,6 @@ import net.minecraft.util.StringRepresentable; * Represents individual steps that the features and carvers chunk status go through, respectively. */ public class GenerationStep { - public static enum Carving implements StringRepresentable { - AIR("air"), - LIQUID("liquid"); - - public static final Codec CODEC = StringRepresentable.fromEnum(GenerationStep.Carving::values); - private final String name; - - private Carving(final String name) { - this.name = name; - } - - public String getName() { - return this.name; - } - - @Override - public String getSerializedName() { - return this.name; - } - } - public static enum Decoration implements StringRepresentable { RAW_GENERATION("raw_generation"), LAKES("lakes"), diff --git a/net/minecraft/world/level/levelgen/Heightmap.java b/net/minecraft/world/level/levelgen/Heightmap.java index 52832096..d07da7ad 100644 --- a/net/minecraft/world/level/levelgen/Heightmap.java +++ b/net/minecraft/world/level/levelgen/Heightmap.java @@ -36,35 +36,37 @@ public class Heightmap { } public static void primeHeightmaps(ChunkAccess chunk, Set types) { - int i = types.size(); - ObjectList objectList = new ObjectArrayList<>(i); - ObjectListIterator objectListIterator = objectList.iterator(); - int j = chunk.getHighestSectionPosition() + 16; - BlockPos.MutableBlockPos mutableBlockPos = new BlockPos.MutableBlockPos(); + if (!types.isEmpty()) { + int i = types.size(); + ObjectList objectList = new ObjectArrayList<>(i); + ObjectListIterator objectListIterator = objectList.iterator(); + int j = chunk.getHighestSectionPosition() + 16; + BlockPos.MutableBlockPos mutableBlockPos = new BlockPos.MutableBlockPos(); - for (int k = 0; k < 16; k++) { - for (int l = 0; l < 16; l++) { - for (Heightmap.Types types2 : types) { - objectList.add(chunk.getOrCreateHeightmapUnprimed(types2)); - } + for (int k = 0; k < 16; k++) { + for (int l = 0; l < 16; l++) { + for (Heightmap.Types types2 : types) { + objectList.add(chunk.getOrCreateHeightmapUnprimed(types2)); + } - for (int m = j - 1; m >= chunk.getMinBuildHeight(); m--) { - mutableBlockPos.set(k, m, l); - BlockState blockState = chunk.getBlockState(mutableBlockPos); - if (!blockState.is(Blocks.AIR)) { - while (objectListIterator.hasNext()) { - Heightmap heightmap = (Heightmap)objectListIterator.next(); - if (heightmap.isOpaque.test(blockState)) { - heightmap.setHeight(k, l, m + 1); - objectListIterator.remove(); + for (int m = j - 1; m >= chunk.getMinY(); m--) { + mutableBlockPos.set(k, m, l); + BlockState blockState = chunk.getBlockState(mutableBlockPos); + if (!blockState.is(Blocks.AIR)) { + while (objectListIterator.hasNext()) { + Heightmap heightmap = (Heightmap)objectListIterator.next(); + if (heightmap.isOpaque.test(blockState)) { + heightmap.setHeight(k, l, m + 1); + objectListIterator.remove(); + } } - } - if (objectList.isEmpty()) { - break; - } + if (objectList.isEmpty()) { + break; + } - objectListIterator.back(i); + objectListIterator.back(i); + } } } } @@ -84,7 +86,7 @@ public class Heightmap { } else if (i - 1 == y) { BlockPos.MutableBlockPos mutableBlockPos = new BlockPos.MutableBlockPos(); - for (int j = y - 1; j >= this.chunk.getMinBuildHeight(); j--) { + for (int j = y - 1; j >= this.chunk.getMinY(); j--) { mutableBlockPos.set(x, j, z); if (this.isOpaque.test(this.chunk.getBlockState(mutableBlockPos))) { this.setHeight(x, z, j + 1); @@ -92,7 +94,7 @@ public class Heightmap { } } - this.setHeight(x, z, this.chunk.getMinBuildHeight()); + this.setHeight(x, z, this.chunk.getMinY()); return true; } @@ -109,11 +111,11 @@ public class Heightmap { } private int getFirstAvailable(int index) { - return this.data.get(index) + this.chunk.getMinBuildHeight(); + return this.data.get(index) + this.chunk.getMinY(); } private void setHeight(int x, int z, int value) { - this.data.set(getIndex(x, z), value - this.chunk.getMinBuildHeight()); + this.data.set(getIndex(x, z), value - this.chunk.getMinY()); } public void setRawData(ChunkAccess chunk, Heightmap.Types type, long[] data) { diff --git a/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java b/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java index 3a54b8dc..6718562b 100644 --- a/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java +++ b/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java @@ -40,6 +40,8 @@ import net.minecraft.world.level.chunk.ChunkGenerator; import net.minecraft.world.level.chunk.LevelChunkSection; import net.minecraft.world.level.chunk.ProtoChunk; import net.minecraft.world.level.dimension.DimensionType; +import net.minecraft.world.level.levelgen.DensityFunction.SinglePointContext; +import net.minecraft.world.level.levelgen.DensityFunctions.BeardifierMarker; import net.minecraft.world.level.levelgen.blending.Blender; import net.minecraft.world.level.levelgen.carver.CarvingContext; import net.minecraft.world.level.levelgen.carver.ConfiguredWorldCarver; @@ -74,10 +76,10 @@ public final class NoiseBasedChunkGenerator extends ChunkGenerator { @Override public CompletableFuture createBiomes(RandomState randomState, Blender blender, StructureManager structureManager, ChunkAccess chunk) { - return CompletableFuture.supplyAsync(Util.wrapThreadWithTaskName("init_biomes", (Supplier)(() -> { + return CompletableFuture.supplyAsync(() -> { this.doCreateBiomes(blender, randomState, structureManager, chunk); return chunk; - })), Util.backgroundExecutor()); + }, Util.backgroundExecutor().forName("init_biomes")); } private void doCreateBiomes(Blender blender, RandomState random, StructureManager structureManager, ChunkAccess chunk) { @@ -112,7 +114,7 @@ public final class NoiseBasedChunkGenerator extends ChunkGenerator { @Override public int getBaseHeight(int x, int z, Heightmap.Types type, LevelHeightAccessor level, RandomState random) { - return this.iterateNoiseColumn(level, random, x, z, null, type.isOpaque()).orElse(level.getMinBuildHeight()); + return this.iterateNoiseColumn(level, random, x, z, null, type.isOpaque()).orElse(level.getMinY()); } @Override @@ -126,7 +128,7 @@ public final class NoiseBasedChunkGenerator extends ChunkGenerator { public void addDebugScreenInfo(List info, RandomState random, BlockPos pos) { DecimalFormat decimalFormat = new DecimalFormat("0.000"); NoiseRouter noiseRouter = random.router(); - DensityFunction.SinglePointContext singlePointContext = new DensityFunction.SinglePointContext(pos.getX(), pos.getY(), pos.getZ()); + SinglePointContext singlePointContext = new SinglePointContext(pos.getX(), pos.getY(), pos.getZ()); double d = noiseRouter.ridges().compute(singlePointContext); info.add( "NoiseRouter T: " @@ -179,15 +181,7 @@ public final class NoiseBasedChunkGenerator extends ChunkGenerator { double d = (double)p / m; double e = (double)q / m; NoiseChunk noiseChunk = new NoiseChunk( - 1, - random, - r, - s, - noiseSettings, - DensityFunctions.BeardifierMarker.INSTANCE, - this.settings.value(), - (Aquifer.FluidPicker)this.globalFluidPicker.get(), - Blender.empty() + 1, random, r, s, noiseSettings, BeardifierMarker.INSTANCE, this.settings.value(), (Aquifer.FluidPicker)this.globalFluidPicker.get(), Blender.empty() ); noiseChunk.initializeForFirstCellX(); noiseChunk.advanceCellX(0); @@ -225,13 +219,7 @@ public final class NoiseBasedChunkGenerator extends ChunkGenerator { if (!SharedConstants.debugVoidTerrain(chunk.getPos())) { WorldGenerationContext worldGenerationContext = new WorldGenerationContext(this, level); this.buildSurface( - chunk, - worldGenerationContext, - random, - structureManager, - level.getBiomeManager(), - level.registryAccess().registryOrThrow(Registries.BIOME), - Blender.of(level) + chunk, worldGenerationContext, random, structureManager, level.getBiomeManager(), level.registryAccess().lookupOrThrow(Registries.BIOME), Blender.of(level) ); } } @@ -254,45 +242,41 @@ public final class NoiseBasedChunkGenerator extends ChunkGenerator { @Override public void applyCarvers( - WorldGenRegion level, - long seed, - RandomState random, - BiomeManager biomeManager, - StructureManager structureManager, - ChunkAccess chunk, - GenerationStep.Carving step + WorldGenRegion worldGenRegion, long l, RandomState randomState, BiomeManager biomeManager, StructureManager structureManager, ChunkAccess chunkAccess ) { - BiomeManager biomeManager2 = biomeManager.withDifferentSource((ix, jx, kx) -> this.biomeSource.getNoiseBiome(ix, jx, kx, random.sampler())); + BiomeManager biomeManager2 = biomeManager.withDifferentSource((ix, jx, kx) -> this.biomeSource.getNoiseBiome(ix, jx, kx, randomState.sampler())); WorldgenRandom worldgenRandom = new WorldgenRandom(new LegacyRandomSource(RandomSupport.generateUniqueSeed())); int i = 8; - ChunkPos chunkPos = chunk.getPos(); - NoiseChunk noiseChunk = chunk.getOrCreateNoiseChunk(chunkAccessx -> this.createNoiseChunk(chunkAccessx, structureManager, Blender.of(level), random)); + ChunkPos chunkPos = chunkAccess.getPos(); + NoiseChunk noiseChunk = chunkAccess.getOrCreateNoiseChunk( + chunkAccessx -> this.createNoiseChunk(chunkAccessx, structureManager, Blender.of(worldGenRegion), randomState) + ); Aquifer aquifer = noiseChunk.aquifer(); CarvingContext carvingContext = new CarvingContext( - this, level.registryAccess(), chunk.getHeightAccessorForGeneration(), noiseChunk, random, this.settings.value().surfaceRule() + this, worldGenRegion.registryAccess(), chunkAccess.getHeightAccessorForGeneration(), noiseChunk, randomState, this.settings.value().surfaceRule() ); - CarvingMask carvingMask = ((ProtoChunk)chunk).getOrCreateCarvingMask(step); + CarvingMask carvingMask = ((ProtoChunk)chunkAccess).getOrCreateCarvingMask(); for (int j = -8; j <= 8; j++) { for (int k = -8; k <= 8; k++) { ChunkPos chunkPos2 = new ChunkPos(chunkPos.x + j, chunkPos.z + k); - ChunkAccess chunkAccess = level.getChunk(chunkPos2.x, chunkPos2.z); - BiomeGenerationSettings biomeGenerationSettings = chunkAccess.carverBiome( + ChunkAccess chunkAccess2 = worldGenRegion.getChunk(chunkPos2.x, chunkPos2.z); + BiomeGenerationSettings biomeGenerationSettings = chunkAccess2.carverBiome( () -> this.getBiomeGenerationSettings( - this.biomeSource.getNoiseBiome(QuartPos.fromBlock(chunkPos2.getMinBlockX()), 0, QuartPos.fromBlock(chunkPos2.getMinBlockZ()), random.sampler()) + this.biomeSource.getNoiseBiome(QuartPos.fromBlock(chunkPos2.getMinBlockX()), 0, QuartPos.fromBlock(chunkPos2.getMinBlockZ()), randomState.sampler()) ) ); - Iterable>> iterable = biomeGenerationSettings.getCarvers(step); - int l = 0; + Iterable>> iterable = biomeGenerationSettings.getCarvers(); + int m = 0; for (Holder> holder : iterable) { ConfiguredWorldCarver configuredWorldCarver = holder.value(); - worldgenRandom.setLargeFeatureSeed(seed + l, chunkPos2.x, chunkPos2.z); + worldgenRandom.setLargeFeatureSeed(l + m, chunkPos2.x, chunkPos2.z); if (configuredWorldCarver.isStartChunk(worldgenRandom)) { - configuredWorldCarver.carve(carvingContext, chunk, biomeManager2::getBiome, worldgenRandom, aquifer, chunkPos2, carvingMask); + configuredWorldCarver.carve(carvingContext, chunkAccess, biomeManager2::getBiome, worldgenRandom, aquifer, chunkPos2, carvingMask); } - l++; + m++; } } } @@ -304,7 +288,7 @@ public final class NoiseBasedChunkGenerator extends ChunkGenerator { int i = noiseSettings.minY(); int j = Mth.floorDiv(i, noiseSettings.getCellHeight()); int k = Mth.floorDiv(noiseSettings.height(), noiseSettings.getCellHeight()); - return k <= 0 ? CompletableFuture.completedFuture(chunk) : CompletableFuture.supplyAsync(Util.wrapThreadWithTaskName("wgen_fill_noise", (Supplier)(() -> { + return k <= 0 ? CompletableFuture.completedFuture(chunk) : CompletableFuture.supplyAsync(() -> { int l = chunk.getSectionIndex(k * noiseSettings.getCellHeight() - 1 + i); int m = chunk.getSectionIndex(i); Set set = Sets.newHashSet(); @@ -325,7 +309,7 @@ public final class NoiseBasedChunkGenerator extends ChunkGenerator { } return var20; - })), Util.backgroundExecutor()); + }, Util.backgroundExecutor().forName("wgen_fill_noise")); } private ChunkAccess doFill(Blender blender, StructureManager structureManager, RandomState random, ChunkAccess chunk, int minCellY, int cellCountY) { @@ -427,7 +411,7 @@ public final class NoiseBasedChunkGenerator extends ChunkGenerator { public void spawnOriginalMobs(WorldGenRegion level) { if (!this.settings.value().disableMobGeneration()) { ChunkPos chunkPos = level.getCenter(); - Holder holder = level.getBiome(chunkPos.getWorldPosition().atY(level.getMaxBuildHeight() - 1)); + Holder holder = level.getBiome(chunkPos.getWorldPosition().atY(level.getMaxY())); WorldgenRandom worldgenRandom = new WorldgenRandom(new LegacyRandomSource(RandomSupport.generateUniqueSeed())); worldgenRandom.setDecorationSeed(level.getSeed(), chunkPos.getMinBlockX(), chunkPos.getMinBlockZ()); NaturalSpawner.spawnMobsForChunkGeneration(level, holder, chunkPos, worldgenRandom); diff --git a/net/minecraft/world/level/levelgen/NoiseChunk.java b/net/minecraft/world/level/levelgen/NoiseChunk.java index a2b98ac7..2d3c493e 100644 --- a/net/minecraft/world/level/levelgen/NoiseChunk.java +++ b/net/minecraft/world/level/levelgen/NoiseChunk.java @@ -1,10 +1,9 @@ package net.minecraft.world.level.levelgen; -import com.google.common.collect.ImmutableList; import com.google.common.collect.Lists; -import com.google.common.collect.ImmutableList.Builder; import it.unimi.dsi.fastutil.longs.Long2IntMap; import it.unimi.dsi.fastutil.longs.Long2IntOpenHashMap; +import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -17,11 +16,21 @@ import net.minecraft.world.level.ChunkPos; import net.minecraft.world.level.biome.Climate; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.chunk.ChunkAccess; +import net.minecraft.world.level.levelgen.DensityFunction.ContextProvider; +import net.minecraft.world.level.levelgen.DensityFunction.FunctionContext; +import net.minecraft.world.level.levelgen.DensityFunction.SinglePointContext; +import net.minecraft.world.level.levelgen.DensityFunction.Visitor; +import net.minecraft.world.level.levelgen.DensityFunctions.BeardifierMarker; +import net.minecraft.world.level.levelgen.DensityFunctions.BeardifierOrMarker; +import net.minecraft.world.level.levelgen.DensityFunctions.HolderHolder; +import net.minecraft.world.level.levelgen.DensityFunctions.Marker; +import net.minecraft.world.level.levelgen.DensityFunctions.MarkerOrMarked; +import net.minecraft.world.level.levelgen.DensityFunctions.Marker.Type; import net.minecraft.world.level.levelgen.blending.Blender; import net.minecraft.world.level.levelgen.material.MaterialRuleList; import org.jetbrains.annotations.Nullable; -public class NoiseChunk implements DensityFunction.ContextProvider, DensityFunction.FunctionContext { +public class NoiseChunk implements ContextProvider, FunctionContext { private final NoiseSettings noiseSettings; final int cellCountXZ; final int cellCountY; @@ -40,7 +49,7 @@ public class NoiseChunk implements DensityFunction.ContextProvider, DensityFunct private final Blender blender; private final NoiseChunk.FlatCache blendAlpha; private final NoiseChunk.FlatCache blendOffset; - private final DensityFunctions.BeardifierOrMarker beardifier; + private final BeardifierOrMarker beardifier; private long lastBlendingDataPos = ChunkPos.INVALID_CHUNK_POS; private Blender.BlendingOutput lastBlendingOutput = new Blender.BlendingOutput(1.0, 0.0); final int noiseSizeXZ; @@ -57,9 +66,9 @@ public class NoiseChunk implements DensityFunction.ContextProvider, DensityFunct long interpolationCounter; long arrayInterpolationCounter; int arrayIndex; - private final DensityFunction.ContextProvider sliceFillingContextProvider = new DensityFunction.ContextProvider() { + private final ContextProvider sliceFillingContextProvider = new ContextProvider() { @Override - public DensityFunction.FunctionContext forIndex(int arrayIndex) { + public FunctionContext forIndex(int arrayIndex) { NoiseChunk.this.cellStartBlockY = (arrayIndex + NoiseChunk.this.cellNoiseMinY) * NoiseChunk.this.cellHeight; NoiseChunk.this.interpolationCounter++; NoiseChunk.this.inCellY = 0; @@ -82,7 +91,7 @@ public class NoiseChunk implements DensityFunction.ContextProvider, DensityFunct public static NoiseChunk forChunk( ChunkAccess chunk, RandomState state, - DensityFunctions.BeardifierOrMarker beardifierOrMarker, + BeardifierOrMarker beardifierOrMarker, NoiseGeneratorSettings noiseGeneratorSettings, Aquifer.FluidPicker fluidPicke, Blender blender @@ -101,7 +110,7 @@ public class NoiseChunk implements DensityFunction.ContextProvider, DensityFunct int firstNoiseX, int firstNoiseZ, NoiseSettings noiseSettings, - DensityFunctions.BeardifierOrMarker beardifier, + BeardifierOrMarker beardifier, NoiseGeneratorSettings noiseGeneratorSettings, Aquifer.FluidPicker fluidPicker, Blender blendifier @@ -147,17 +156,15 @@ public class NoiseChunk implements DensityFunction.ContextProvider, DensityFunct this.aquifer = Aquifer.create(this, new ChunkPos(k, l), noiseRouter2, random.aquiferRandom(), noiseSettings.minY(), noiseSettings.height(), fluidPicker); } - Builder builder = ImmutableList.builder(); - DensityFunction densityFunction = DensityFunctions.cacheAllInCell( - DensityFunctions.add(noiseRouter2.finalDensity(), DensityFunctions.BeardifierMarker.INSTANCE) - ) + List list = new ArrayList(); + DensityFunction densityFunction = DensityFunctions.cacheAllInCell(DensityFunctions.add(noiseRouter2.finalDensity(), BeardifierMarker.INSTANCE)) .mapAll(this::wrap); - builder.add(functionContext -> this.aquifer.computeSubstance(functionContext, densityFunction.compute(functionContext))); + list.add((NoiseChunk.BlockStateFiller)functionContext -> this.aquifer.computeSubstance(functionContext, densityFunction.compute(functionContext))); if (noiseGeneratorSettings.oreVeinsEnabled()) { - builder.add(OreVeinifier.create(noiseRouter2.veinToggle(), noiseRouter2.veinRidged(), noiseRouter2.veinGap(), random.oreRandom())); + list.add(OreVeinifier.create(noiseRouter2.veinToggle(), noiseRouter2.veinRidged(), noiseRouter2.veinGap(), random.oreRandom())); } - this.blockStateRule = new MaterialRuleList(builder.build()); + this.blockStateRule = new MaterialRuleList((NoiseChunk.BlockStateFiller[])list.toArray(new NoiseChunk.BlockStateFiller[0])); this.initialDensityNoJaggedness = noiseRouter2.initialDensityWithoutJaggedness(); } @@ -205,7 +212,7 @@ public class NoiseChunk implements DensityFunction.ContextProvider, DensityFunct int k = this.noiseSettings.minY(); for (int l = k + this.noiseSettings.height(); l >= k; l -= this.cellHeight) { - if (this.initialDensityNoJaggedness.compute(new DensityFunction.SinglePointContext(i, l, j)) > 0.390625) { + if (this.initialDensityNoJaggedness.compute(new SinglePointContext(i, l, j)) > 0.390625) { return l; } } @@ -283,7 +290,10 @@ public class NoiseChunk implements DensityFunction.ContextProvider, DensityFunct } public void selectCellYZ(int y, int z) { - this.interpolators.forEach(noiseInterpolator -> noiseInterpolator.selectCellYZ(y, z)); + for (NoiseChunk.NoiseInterpolator noiseInterpolator : this.interpolators) { + noiseInterpolator.selectCellYZ(y, z); + } + this.fillingCell = true; this.cellStartBlockY = (y + this.cellNoiseMinY) * this.cellHeight; this.cellStartBlockZ = (this.firstCellZ + z) * this.cellWidth; @@ -299,18 +309,27 @@ public class NoiseChunk implements DensityFunction.ContextProvider, DensityFunct public void updateForY(int cellEndBlockY, double y) { this.inCellY = cellEndBlockY - this.cellStartBlockY; - this.interpolators.forEach(noiseInterpolator -> noiseInterpolator.updateForY(y)); + + for (NoiseChunk.NoiseInterpolator noiseInterpolator : this.interpolators) { + noiseInterpolator.updateForY(y); + } } public void updateForX(int cellEndBlockX, double x) { this.inCellX = cellEndBlockX - this.cellStartBlockX; - this.interpolators.forEach(noiseInterpolator -> noiseInterpolator.updateForX(x)); + + for (NoiseChunk.NoiseInterpolator noiseInterpolator : this.interpolators) { + noiseInterpolator.updateForX(x); + } } public void updateForZ(int cellEndBlockZ, double z) { this.inCellZ = cellEndBlockZ - this.cellStartBlockZ; this.interpolationCounter++; - this.interpolators.forEach(noiseInterpolator -> noiseInterpolator.updateForZ(z)); + + for (NoiseChunk.NoiseInterpolator noiseInterpolator : this.interpolators) { + noiseInterpolator.updateForZ(z); + } } public void stopInterpolation() { @@ -354,13 +373,14 @@ public class NoiseChunk implements DensityFunction.ContextProvider, DensityFunct } private DensityFunction wrapNew(DensityFunction densityFunction) { - if (densityFunction instanceof DensityFunctions.Marker marker) { + if (densityFunction instanceof Marker marker) { return (DensityFunction)(switch (marker.type()) { case Interpolated -> new NoiseChunk.NoiseInterpolator(marker.wrapped()); case FlatCache -> new NoiseChunk.FlatCache(marker.wrapped(), true); case Cache2D -> new NoiseChunk.Cache2D(marker.wrapped()); case CacheOnce -> new NoiseChunk.CacheOnce(marker.wrapped()); case CacheAllInCell -> new NoiseChunk.CacheAllInCell(marker.wrapped()); + default -> throw new MatchException(null, null); }); } else { if (this.blender != Blender.empty()) { @@ -373,10 +393,10 @@ public class NoiseChunk implements DensityFunction.ContextProvider, DensityFunct } } - if (densityFunction == DensityFunctions.BeardifierMarker.INSTANCE) { + if (densityFunction == BeardifierMarker.INSTANCE) { return this.beardifier; } else { - return densityFunction instanceof DensityFunctions.HolderHolder holderHolder ? holderHolder.function().value() : densityFunction; + return densityFunction instanceof HolderHolder holderHolder ? holderHolder.function().value() : densityFunction; } } } @@ -388,17 +408,17 @@ public class NoiseChunk implements DensityFunction.ContextProvider, DensityFunct } @Override - public DensityFunction mapAll(DensityFunction.Visitor visitor) { + public DensityFunction mapAll(Visitor visitor) { return this.wrapped().mapAll(visitor); } @Override - public double compute(DensityFunction.FunctionContext context) { + public double compute(FunctionContext context) { return NoiseChunk.this.getOrComputeBlendingOutput(context.blockX(), context.blockZ()).alpha(); } @Override - public void fillArray(double[] array, DensityFunction.ContextProvider contextProvider) { + public void fillArray(double[] array, ContextProvider contextProvider) { contextProvider.fillAllDirectly(array, this); } @@ -425,17 +445,17 @@ public class NoiseChunk implements DensityFunction.ContextProvider, DensityFunct } @Override - public DensityFunction mapAll(DensityFunction.Visitor visitor) { + public DensityFunction mapAll(Visitor visitor) { return this.wrapped().mapAll(visitor); } @Override - public double compute(DensityFunction.FunctionContext context) { + public double compute(FunctionContext context) { return NoiseChunk.this.getOrComputeBlendingOutput(context.blockX(), context.blockZ()).blendingOffset(); } @Override - public void fillArray(double[] array, DensityFunction.ContextProvider contextProvider) { + public void fillArray(double[] array, ContextProvider contextProvider) { contextProvider.fillAllDirectly(array, this); } @@ -458,10 +478,10 @@ public class NoiseChunk implements DensityFunction.ContextProvider, DensityFunct @FunctionalInterface public interface BlockStateFiller { @Nullable - BlockState calculate(DensityFunction.FunctionContext functionContext); + BlockState calculate(FunctionContext functionContext); } - static class Cache2D implements DensityFunctions.MarkerOrMarked, NoiseChunk.NoiseChunkDensityFunction { + static class Cache2D implements MarkerOrMarked, NoiseChunk.NoiseChunkDensityFunction { private final DensityFunction function; private long lastPos2D = ChunkPos.INVALID_CHUNK_POS; private double lastValue; @@ -471,7 +491,7 @@ public class NoiseChunk implements DensityFunction.ContextProvider, DensityFunct } @Override - public double compute(DensityFunction.FunctionContext context) { + public double compute(FunctionContext context) { int i = context.blockX(); int j = context.blockZ(); long l = ChunkPos.asLong(i, j); @@ -486,7 +506,7 @@ public class NoiseChunk implements DensityFunction.ContextProvider, DensityFunct } @Override - public void fillArray(double[] array, DensityFunction.ContextProvider contextProvider) { + public void fillArray(double[] array, ContextProvider contextProvider) { this.function.fillArray(array, contextProvider); } @@ -496,12 +516,12 @@ public class NoiseChunk implements DensityFunction.ContextProvider, DensityFunct } @Override - public DensityFunctions.Marker.Type type() { - return DensityFunctions.Marker.Type.Cache2D; + public Type type() { + return Type.Cache2D; } } - class CacheAllInCell implements DensityFunctions.MarkerOrMarked, NoiseChunk.NoiseChunkDensityFunction { + class CacheAllInCell implements MarkerOrMarked, NoiseChunk.NoiseChunkDensityFunction { final DensityFunction noiseFiller; final double[] values; @@ -512,7 +532,7 @@ public class NoiseChunk implements DensityFunction.ContextProvider, DensityFunct } @Override - public double compute(DensityFunction.FunctionContext context) { + public double compute(FunctionContext context) { if (context != NoiseChunk.this) { return this.noiseFiller.compute(context); } else if (!NoiseChunk.this.interpolating) { @@ -528,7 +548,7 @@ public class NoiseChunk implements DensityFunction.ContextProvider, DensityFunct } @Override - public void fillArray(double[] array, DensityFunction.ContextProvider contextProvider) { + public void fillArray(double[] array, ContextProvider contextProvider) { contextProvider.fillAllDirectly(array, this); } @@ -538,12 +558,12 @@ public class NoiseChunk implements DensityFunction.ContextProvider, DensityFunct } @Override - public DensityFunctions.Marker.Type type() { - return DensityFunctions.Marker.Type.CacheAllInCell; + public Type type() { + return Type.CacheAllInCell; } } - class CacheOnce implements DensityFunctions.MarkerOrMarked, NoiseChunk.NoiseChunkDensityFunction { + class CacheOnce implements MarkerOrMarked, NoiseChunk.NoiseChunkDensityFunction { private final DensityFunction function; private long lastCounter; private long lastArrayCounter; @@ -556,7 +576,7 @@ public class NoiseChunk implements DensityFunction.ContextProvider, DensityFunct } @Override - public double compute(DensityFunction.FunctionContext context) { + public double compute(FunctionContext context) { if (context != NoiseChunk.this) { return this.function.compute(context); } else if (this.lastArray != null && this.lastArrayCounter == NoiseChunk.this.arrayInterpolationCounter) { @@ -572,7 +592,7 @@ public class NoiseChunk implements DensityFunction.ContextProvider, DensityFunct } @Override - public void fillArray(double[] array, DensityFunction.ContextProvider contextProvider) { + public void fillArray(double[] array, ContextProvider contextProvider) { if (this.lastArray != null && this.lastArrayCounter == NoiseChunk.this.arrayInterpolationCounter) { System.arraycopy(this.lastArray, 0, array, 0, array.length); } else { @@ -593,12 +613,12 @@ public class NoiseChunk implements DensityFunction.ContextProvider, DensityFunct } @Override - public DensityFunctions.Marker.Type type() { - return DensityFunctions.Marker.Type.CacheOnce; + public Type type() { + return Type.CacheOnce; } } - class FlatCache implements DensityFunctions.MarkerOrMarked, NoiseChunk.NoiseChunkDensityFunction { + class FlatCache implements MarkerOrMarked, NoiseChunk.NoiseChunkDensityFunction { private final DensityFunction noiseFiller; final double[][] values; @@ -613,14 +633,14 @@ public class NoiseChunk implements DensityFunction.ContextProvider, DensityFunct for (int l = 0; l <= NoiseChunk.this.noiseSizeXZ; l++) { int m = NoiseChunk.this.firstNoiseZ + l; int n = QuartPos.toBlock(m); - this.values[i][l] = noiseFiller.compute(new DensityFunction.SinglePointContext(k, 0, n)); + this.values[i][l] = noiseFiller.compute(new SinglePointContext(k, 0, n)); } } } } @Override - public double compute(DensityFunction.FunctionContext context) { + public double compute(FunctionContext context) { int i = QuartPos.fromBlock(context.blockX()); int j = QuartPos.fromBlock(context.blockZ()); int k = i - NoiseChunk.this.firstNoiseX; @@ -630,7 +650,7 @@ public class NoiseChunk implements DensityFunction.ContextProvider, DensityFunct } @Override - public void fillArray(double[] array, DensityFunction.ContextProvider contextProvider) { + public void fillArray(double[] array, ContextProvider contextProvider) { contextProvider.fillAllDirectly(array, this); } @@ -640,8 +660,8 @@ public class NoiseChunk implements DensityFunction.ContextProvider, DensityFunct } @Override - public DensityFunctions.Marker.Type type() { - return DensityFunctions.Marker.Type.FlatCache; + public Type type() { + return Type.FlatCache; } } @@ -659,7 +679,7 @@ public class NoiseChunk implements DensityFunction.ContextProvider, DensityFunct } } - public class NoiseInterpolator implements DensityFunctions.MarkerOrMarked, NoiseChunk.NoiseChunkDensityFunction { + public class NoiseInterpolator implements MarkerOrMarked, NoiseChunk.NoiseChunkDensityFunction { double[][] slice0; double[][] slice1; private final DensityFunction noiseFiller; @@ -726,7 +746,7 @@ public class NoiseChunk implements DensityFunction.ContextProvider, DensityFunct } @Override - public double compute(DensityFunction.FunctionContext context) { + public double compute(FunctionContext context) { if (context != NoiseChunk.this) { return this.noiseFiller.compute(context); } else if (!NoiseChunk.this.interpolating) { @@ -751,7 +771,7 @@ public class NoiseChunk implements DensityFunction.ContextProvider, DensityFunct } @Override - public void fillArray(double[] array, DensityFunction.ContextProvider contextProvider) { + public void fillArray(double[] array, ContextProvider contextProvider) { if (NoiseChunk.this.fillingCell) { contextProvider.fillAllDirectly(array, this); } else { @@ -771,8 +791,8 @@ public class NoiseChunk implements DensityFunction.ContextProvider, DensityFunct } @Override - public DensityFunctions.Marker.Type type() { - return DensityFunctions.Marker.Type.Interpolated; + public Type type() { + return Type.Interpolated; } } } diff --git a/net/minecraft/world/level/levelgen/NoiseSettings.java b/net/minecraft/world/level/levelgen/NoiseSettings.java index 5c941e94..cdc7603e 100644 --- a/net/minecraft/world/level/levelgen/NoiseSettings.java +++ b/net/minecraft/world/level/levelgen/NoiseSettings.java @@ -52,8 +52,8 @@ public record NoiseSettings(int minY, int height, int noiseSizeHorizontal, int n } public NoiseSettings clampToHeightAccessor(LevelHeightAccessor heightAccessor) { - int i = Math.max(this.minY, heightAccessor.getMinBuildHeight()); - int j = Math.min(this.minY + this.height, heightAccessor.getMaxBuildHeight()) - i; + int i = Math.max(this.minY, heightAccessor.getMinY()); + int j = Math.min(this.minY + this.height, heightAccessor.getMaxY() + 1) - i; return new NoiseSettings(i, j, this.noiseSizeHorizontal, this.noiseSizeVertical); } } diff --git a/net/minecraft/world/level/levelgen/PatrolSpawner.java b/net/minecraft/world/level/levelgen/PatrolSpawner.java index 8409250c..6d782305 100644 --- a/net/minecraft/world/level/levelgen/PatrolSpawner.java +++ b/net/minecraft/world/level/levelgen/PatrolSpawner.java @@ -5,8 +5,8 @@ import net.minecraft.core.Holder; import net.minecraft.server.level.ServerLevel; import net.minecraft.tags.BiomeTags; import net.minecraft.util.RandomSource; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; -import net.minecraft.world.entity.MobSpawnType; import net.minecraft.world.entity.monster.PatrollingMonster; import net.minecraft.world.entity.player.Player; import net.minecraft.world.level.CustomSpawner; @@ -90,10 +90,10 @@ public class PatrolSpawner implements CustomSpawner { BlockState blockState = level.getBlockState(pos); if (!NaturalSpawner.isValidEmptySpawnBlock(level, pos, blockState, blockState.getFluidState(), EntityType.PILLAGER)) { return false; - } else if (!PatrollingMonster.checkPatrollingMonsterSpawnRules(EntityType.PILLAGER, level, MobSpawnType.PATROL, pos, random)) { + } else if (!PatrollingMonster.checkPatrollingMonsterSpawnRules(EntityType.PILLAGER, level, EntitySpawnReason.PATROL, pos, random)) { return false; } else { - PatrollingMonster patrollingMonster = EntityType.PILLAGER.create(level); + PatrollingMonster patrollingMonster = EntityType.PILLAGER.create(level, EntitySpawnReason.PATROL); if (patrollingMonster != null) { if (leader) { patrollingMonster.setPatrolLeader(true); @@ -101,7 +101,7 @@ public class PatrolSpawner implements CustomSpawner { } patrollingMonster.setPos(pos.getX(), pos.getY(), pos.getZ()); - patrollingMonster.finalizeSpawn(level, level.getCurrentDifficultyAt(pos), MobSpawnType.PATROL, null); + patrollingMonster.finalizeSpawn(level, level.getCurrentDifficultyAt(pos), EntitySpawnReason.PATROL, null); level.addFreshEntityWithPassengers(patrollingMonster); return true; } else { diff --git a/net/minecraft/world/level/levelgen/PhantomSpawner.java b/net/minecraft/world/level/levelgen/PhantomSpawner.java index ad80cf05..a2385e6c 100644 --- a/net/minecraft/world/level/levelgen/PhantomSpawner.java +++ b/net/minecraft/world/level/levelgen/PhantomSpawner.java @@ -8,8 +8,8 @@ import net.minecraft.stats.Stats; import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; import net.minecraft.world.DifficultyInstance; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; -import net.minecraft.world.entity.MobSpawnType; import net.minecraft.world.entity.SpawnGroupData; import net.minecraft.world.entity.monster.Phantom; import net.minecraft.world.level.CustomSpawner; @@ -57,10 +57,10 @@ public class PhantomSpawner implements CustomSpawner { int l = 1 + randomSource.nextInt(difficultyInstance.getDifficulty().getId() + 1); for (int m = 0; m < l; m++) { - Phantom phantom = EntityType.PHANTOM.create(level); + Phantom phantom = EntityType.PHANTOM.create(level, EntitySpawnReason.NATURAL); if (phantom != null) { phantom.moveTo(blockPos2, 0.0F, 0.0F); - spawnGroupData = phantom.finalizeSpawn(level, difficultyInstance, MobSpawnType.NATURAL, spawnGroupData); + spawnGroupData = phantom.finalizeSpawn(level, difficultyInstance, EntitySpawnReason.NATURAL, spawnGroupData); level.addFreshEntityWithPassengers(phantom); i++; } diff --git a/net/minecraft/world/level/levelgen/SurfaceRules.java b/net/minecraft/world/level/levelgen/SurfaceRules.java index 976e321c..ecc26697 100644 --- a/net/minecraft/world/level/levelgen/SurfaceRules.java +++ b/net/minecraft/world/level/levelgen/SurfaceRules.java @@ -21,13 +21,23 @@ import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; import net.minecraft.util.KeyDispatchDataCodec; import net.minecraft.util.Mth; -import net.minecraft.util.RandomSource; import net.minecraft.world.level.ChunkPos; import net.minecraft.world.level.biome.Biome; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.chunk.ChunkAccess; +import net.minecraft.world.level.levelgen.SurfaceRules.BiomeConditionSource.1BiomeCondition; +import net.minecraft.world.level.levelgen.SurfaceRules.Context.AbovePreliminarySurfaceCondition; +import net.minecraft.world.level.levelgen.SurfaceRules.Context.HoleCondition; +import net.minecraft.world.level.levelgen.SurfaceRules.Context.SteepMaterialCondition; +import net.minecraft.world.level.levelgen.SurfaceRules.Context.TemperatureHelperCondition; +import net.minecraft.world.level.levelgen.SurfaceRules.NoiseThresholdConditionSource.1NoiseThresholdCondition; +import net.minecraft.world.level.levelgen.SurfaceRules.StoneDepthCheck.1StoneDepthCondition; +import net.minecraft.world.level.levelgen.SurfaceRules.VerticalGradientConditionSource.1VerticalGradientCondition; +import net.minecraft.world.level.levelgen.SurfaceRules.WaterConditionSource.1WaterCondition; +import net.minecraft.world.level.levelgen.SurfaceRules.YConditionSource.1YCondition; import net.minecraft.world.level.levelgen.placement.CaveSurface; import net.minecraft.world.level.levelgen.synth.NormalNoise; +import net.minecraft.world.level.levelgen.synth.NormalNoise.NoiseParameters; import org.jetbrains.annotations.Nullable; public class SurfaceRules { @@ -75,11 +85,11 @@ public class SurfaceRules { return new SurfaceRules.BiomeConditionSource(biomes); } - public static SurfaceRules.ConditionSource noiseCondition(ResourceKey noise, double minThreshold) { + public static SurfaceRules.ConditionSource noiseCondition(ResourceKey noise, double minThreshold) { return noiseCondition(noise, minThreshold, Double.MAX_VALUE); } - public static SurfaceRules.ConditionSource noiseCondition(ResourceKey noise, double minThreshold, double maxThreshold) { + public static SurfaceRules.ConditionSource noiseCondition(ResourceKey noise, double minThreshold, double maxThreshold) { return new SurfaceRules.NoiseThresholdConditionSource(noise, minThreshold, maxThreshold); } @@ -175,18 +185,7 @@ public class SurfaceRules { } public SurfaceRules.Condition apply(SurfaceRules.Context context) { - class BiomeCondition extends SurfaceRules.LazyYCondition { - BiomeCondition() { - super(context); - } - - @Override - protected boolean compute() { - return ((Holder)this.context.biome.get()).is(BiomeConditionSource.this.biomeNameTest); - } - } - - return new BiomeCondition(); + return new 1BiomeCondition(this, context); } public boolean equals(Object object) { @@ -257,10 +256,10 @@ public class SurfaceRules { private static final int SURFACE_CELL_SIZE = 16; private static final int SURFACE_CELL_MASK = 15; final SurfaceSystem system; - final SurfaceRules.Condition temperature = new SurfaceRules.Context.TemperatureHelperCondition(this); - final SurfaceRules.Condition steep = new SurfaceRules.Context.SteepMaterialCondition(this); - final SurfaceRules.Condition hole = new SurfaceRules.Context.HoleCondition(this); - final SurfaceRules.Condition abovePreliminarySurface = new SurfaceRules.Context.AbovePreliminarySurfaceCondition(); + final SurfaceRules.Condition temperature = new TemperatureHelperCondition(this); + final SurfaceRules.Condition steep = new SteepMaterialCondition(this); + final SurfaceRules.Condition hole = new HoleCondition(this); + final SurfaceRules.Condition abovePreliminarySurface = new AbovePreliminarySurfaceCondition(this); final RandomState randomState; final ChunkAccess chunk; private final NoiseChunk noiseChunk; @@ -327,6 +326,10 @@ public class SurfaceRules { return this.surfaceSecondary; } + public int getSeaLevel() { + return this.system.getSeaLevel(); + } + private static int blockCoordToSurfaceCell(int blockCoord) { return blockCoord >> 4; } @@ -364,62 +367,6 @@ public class SurfaceRules { return this.minSurfaceLevel; } - - final class AbovePreliminarySurfaceCondition implements SurfaceRules.Condition { - @Override - public boolean test() { - return Context.this.blockY >= Context.this.getMinSurfaceLevel(); - } - } - - static final class HoleCondition extends SurfaceRules.LazyXZCondition { - HoleCondition(SurfaceRules.Context context) { - super(context); - } - - @Override - protected boolean compute() { - return this.context.surfaceDepth <= 0; - } - } - - static class SteepMaterialCondition extends SurfaceRules.LazyXZCondition { - SteepMaterialCondition(SurfaceRules.Context context) { - super(context); - } - - @Override - protected boolean compute() { - int i = this.context.blockX & 15; - int j = this.context.blockZ & 15; - int k = Math.max(j - 1, 0); - int l = Math.min(j + 1, 15); - ChunkAccess chunkAccess = this.context.chunk; - int m = chunkAccess.getHeight(Heightmap.Types.WORLD_SURFACE_WG, i, k); - int n = chunkAccess.getHeight(Heightmap.Types.WORLD_SURFACE_WG, i, l); - if (n >= m + 4) { - return true; - } else { - int o = Math.max(i - 1, 0); - int p = Math.min(i + 1, 15); - int q = chunkAccess.getHeight(Heightmap.Types.WORLD_SURFACE_WG, o, j); - int r = chunkAccess.getHeight(Heightmap.Types.WORLD_SURFACE_WG, p, j); - return q >= r + 4; - } - } - } - - static class TemperatureHelperCondition extends SurfaceRules.LazyYCondition { - TemperatureHelperCondition(SurfaceRules.Context context) { - super(context); - } - - @Override - protected boolean compute() { - return ((Biome)((Holder)this.context.biome.get()).value()) - .coldEnoughToSnow(this.context.pos.set(this.context.blockX, this.context.blockY, this.context.blockZ)); - } - } } static enum Hole implements SurfaceRules.ConditionSource { @@ -491,8 +438,7 @@ public class SurfaceRules { } } - record NoiseThresholdConditionSource(ResourceKey noise, double minThreshold, double maxThreshold) - implements SurfaceRules.ConditionSource { + record NoiseThresholdConditionSource(ResourceKey noise, double minThreshold, double maxThreshold) implements SurfaceRules.ConditionSource { static final KeyDispatchDataCodec CODEC = KeyDispatchDataCodec.of( RecordCodecBuilder.mapCodec( instance -> instance.group( @@ -510,21 +456,8 @@ public class SurfaceRules { } public SurfaceRules.Condition apply(SurfaceRules.Context context) { - final NormalNoise normalNoise = context.randomState.getOrCreateNoise(this.noise); - - class NoiseThresholdCondition extends SurfaceRules.LazyXZCondition { - NoiseThresholdCondition() { - super(context); - } - - @Override - protected boolean compute() { - double d = normalNoise.getValue(this.context.blockX, 0.0, this.context.blockZ); - return d >= NoiseThresholdConditionSource.this.minThreshold && d <= NoiseThresholdConditionSource.this.maxThreshold; - } - } - - return new NoiseThresholdCondition(); + NormalNoise normalNoise = context.randomState.getOrCreateNoise(this.noise); + return new 1NoiseThresholdCondition(this, context, normalNoise); } } @@ -649,25 +582,8 @@ public class SurfaceRules { } public SurfaceRules.Condition apply(SurfaceRules.Context context) { - final boolean bl = this.surfaceType == CaveSurface.CEILING; - - class StoneDepthCondition extends SurfaceRules.LazyYCondition { - StoneDepthCondition() { - super(context); - } - - @Override - protected boolean compute() { - int i = bl ? this.context.stoneDepthBelow : this.context.stoneDepthAbove; - int j = StoneDepthCheck.this.addSurfaceDepth ? this.context.surfaceDepth : 0; - int k = StoneDepthCheck.this.secondaryDepthRange == 0 - ? 0 - : (int)Mth.map(this.context.getSurfaceSecondary(), -1.0, 1.0, 0.0, (double)StoneDepthCheck.this.secondaryDepthRange); - return i <= 1 + StoneDepthCheck.this.offset + j + k; - } - } - - return new StoneDepthCondition(); + boolean bl = this.surfaceType == CaveSurface.CEILING; + return new 1StoneDepthCondition(this, context, bl); } } @@ -739,31 +655,10 @@ public class SurfaceRules { } public SurfaceRules.Condition apply(SurfaceRules.Context context) { - final int i = this.trueAtAndBelow().resolveY(context.context); - final int j = this.falseAtAndAbove().resolveY(context.context); - final PositionalRandomFactory positionalRandomFactory = context.randomState.getOrCreateRandomFactory(this.randomName()); - - class VerticalGradientCondition extends SurfaceRules.LazyYCondition { - VerticalGradientCondition() { - super(context); - } - - @Override - protected boolean compute() { - int i = this.context.blockY; - if (i <= i) { - return true; - } else if (i >= j) { - return false; - } else { - double d = Mth.map((double)i, (double)i, (double)j, 1.0, 0.0); - RandomSource randomSource = positionalRandomFactory.at(this.context.blockX, i, this.context.blockZ); - return randomSource.nextFloat() < d; - } - } - } - - return new VerticalGradientCondition(); + int i = this.trueAtAndBelow().resolveY(context.context); + int j = this.falseAtAndAbove().resolveY(context.context); + PositionalRandomFactory positionalRandomFactory = context.randomState.getOrCreateRandomFactory(this.randomName()); + return new 1VerticalGradientCondition(this, context, i, j, positionalRandomFactory); } } @@ -785,20 +680,7 @@ public class SurfaceRules { } public SurfaceRules.Condition apply(SurfaceRules.Context context) { - class WaterCondition extends SurfaceRules.LazyYCondition { - WaterCondition() { - super(context); - } - - @Override - protected boolean compute() { - return this.context.waterHeight == Integer.MIN_VALUE - || this.context.blockY + (WaterConditionSource.this.addStoneDepth ? this.context.stoneDepthAbove : 0) - >= this.context.waterHeight + WaterConditionSource.this.offset + this.context.surfaceDepth * WaterConditionSource.this.surfaceDepthMultiplier; - } - } - - return new WaterCondition(); + return new 1WaterCondition(this, context); } } @@ -820,19 +702,7 @@ public class SurfaceRules { } public SurfaceRules.Condition apply(SurfaceRules.Context context) { - class YCondition extends SurfaceRules.LazyYCondition { - YCondition() { - super(context); - } - - @Override - protected boolean compute() { - return this.context.blockY + (YConditionSource.this.addStoneDepth ? this.context.stoneDepthAbove : 0) - >= YConditionSource.this.anchor.resolveY(this.context.context) + this.context.surfaceDepth * YConditionSource.this.surfaceDepthMultiplier; - } - } - - return new YCondition(); + return new 1YCondition(this, context); } } } diff --git a/net/minecraft/world/level/levelgen/SurfaceSystem.java b/net/minecraft/world/level/levelgen/SurfaceSystem.java index 1d3f8eee..40f0a555 100644 --- a/net/minecraft/world/level/levelgen/SurfaceSystem.java +++ b/net/minecraft/world/level/levelgen/SurfaceSystem.java @@ -86,7 +86,7 @@ public class SurfaceSystem { @Override public void setBlock(int pos, BlockState state) { LevelHeightAccessor levelHeightAccessor = chunk.getHeightAccessorForGeneration(); - if (pos >= levelHeightAccessor.getMinBuildHeight() && pos < levelHeightAccessor.getMaxBuildHeight()) { + if (levelHeightAccessor.isInsideBuildHeight(pos)) { chunk.setBlockState(mutableBlockPos.setY(pos), state, false); if (!state.getFluidState().isEmpty()) { chunk.markPosForPostprocessing(mutableBlockPos); @@ -118,7 +118,7 @@ public class SurfaceSystem { int q = 0; int r = Integer.MIN_VALUE; int s = Integer.MAX_VALUE; - int t = chunk.getMinBuildHeight(); + int t = chunk.getMinY(); for (int u = p; u >= t; u--) { BlockState blockState = blockColumn.getBlock(u); @@ -174,6 +174,10 @@ public class SurfaceSystem { return !state.isAir() && state.getFluidState().isEmpty(); } + public int getSeaLevel() { + return this.seaLevel; + } + @Deprecated public Optional topMaterial( SurfaceRules.RuleSource rule, @@ -185,7 +189,7 @@ public class SurfaceSystem { boolean hasFluid ) { SurfaceRules.Context context2 = new SurfaceRules.Context( - this, context.randomState(), chunk, noiseChunk, biomeGetter, context.registryAccess().registryOrThrow(Registries.BIOME), context + this, context.randomState(), chunk, noiseChunk, biomeGetter, context.registryAccess().lookupOrThrow(Registries.BIOME), context ); SurfaceRules.SurfaceRule surfaceRule = (SurfaceRules.SurfaceRule)rule.apply(context2); int i = pos.getX(); @@ -207,7 +211,7 @@ public class SurfaceSystem { double i = 64.0 + Math.min(e * e * 2.5, Math.ceil(h * 50.0) + 24.0); int j = Mth.floor(i); if (height <= j) { - for (int k = j; k >= level.getMinBuildHeight(); k--) { + for (int k = j; k >= level.getMinY(); k--) { BlockState blockState = blockColumn.getBlock(k); if (blockState.is(this.defaultBlock.getBlock())) { break; @@ -218,7 +222,7 @@ public class SurfaceSystem { } } - for (int k = j; k >= level.getMinBuildHeight() && blockColumn.getBlock(k).isAir(); k--) { + for (int k = j; k >= level.getMinY() && blockColumn.getBlock(k).isAir(); k--) { blockColumn.setBlock(k, this.defaultBlock); } } @@ -233,7 +237,7 @@ public class SurfaceSystem { double g = 1.5; double h = Math.abs(this.icebergPillarRoofNoise.getValue(x * 1.17, 0.0, z * 1.17) * 1.5); double i = Math.min(e * e * 1.2, Math.ceil(h * 40.0) + 14.0); - if (biome.shouldMeltFrozenOceanIcebergSlightly(topWaterPos.set(x, 63, z))) { + if (biome.shouldMeltFrozenOceanIcebergSlightly(topWaterPos.set(x, this.seaLevel, z), this.seaLevel)) { i -= 2.0; } diff --git a/net/minecraft/world/level/levelgen/WorldDimensions.java b/net/minecraft/world/level/levelgen/WorldDimensions.java index 1be51d14..8df44658 100644 --- a/net/minecraft/world/level/levelgen/WorldDimensions.java +++ b/net/minecraft/world/level/levelgen/WorldDimensions.java @@ -15,6 +15,7 @@ import java.util.Set; import java.util.stream.Collectors; import java.util.stream.Stream; import net.minecraft.core.Holder; +import net.minecraft.core.HolderLookup; import net.minecraft.core.MappedRegistry; import net.minecraft.core.RegistrationInfo; import net.minecraft.core.Registry; @@ -52,27 +53,25 @@ public record WorldDimensions(Map, LevelStem> dimensions) } public WorldDimensions(Registry stemRegistry) { - this((Map, LevelStem>)stemRegistry.holders().collect(Collectors.toMap(Holder.Reference::key, Holder.Reference::value))); + this((Map, LevelStem>)stemRegistry.listElements().collect(Collectors.toMap(Holder.Reference::key, Holder.Reference::value))); } public static Stream> keysInOrder(Stream> stemKeys) { return Stream.concat(BUILTIN_ORDER.stream(), stemKeys.filter(resourceKey -> !BUILTIN_ORDER.contains(resourceKey))); } - public WorldDimensions replaceOverworldGenerator(RegistryAccess registryAccess, ChunkGenerator chunkGenerator) { - Registry registry = registryAccess.registryOrThrow(Registries.DIMENSION_TYPE); - Map, LevelStem> map = withOverworld(registry, this.dimensions, chunkGenerator); + public WorldDimensions replaceOverworldGenerator(HolderLookup.Provider provider, ChunkGenerator chunkGenerator) { + HolderLookup holderLookup = provider.lookupOrThrow(Registries.DIMENSION_TYPE); + Map, LevelStem> map = withOverworld(holderLookup, this.dimensions, chunkGenerator); return new WorldDimensions(map); } public static Map, LevelStem> withOverworld( - Registry dimensionTypeRegistry, Map, LevelStem> stemMap, ChunkGenerator chunkGenerator + HolderLookup holderLookup, Map, LevelStem> map, ChunkGenerator chunkGenerator ) { - LevelStem levelStem = (LevelStem)stemMap.get(LevelStem.OVERWORLD); - Holder holder = (Holder)(levelStem == null - ? dimensionTypeRegistry.getHolderOrThrow(BuiltinDimensionTypes.OVERWORLD) - : levelStem.type()); - return withOverworld(stemMap, holder, chunkGenerator); + LevelStem levelStem = (LevelStem)map.get(LevelStem.OVERWORLD); + Holder holder = (Holder)(levelStem == null ? holderLookup.getOrThrow(BuiltinDimensionTypes.OVERWORLD) : levelStem.type()); + return withOverworld(map, holder, chunkGenerator); } public static Map, LevelStem> withOverworld( diff --git a/net/minecraft/world/level/levelgen/WorldGenSettings.java b/net/minecraft/world/level/levelgen/WorldGenSettings.java index a7accedc..da99b9d4 100644 --- a/net/minecraft/world/level/levelgen/WorldGenSettings.java +++ b/net/minecraft/world/level/levelgen/WorldGenSettings.java @@ -18,6 +18,6 @@ public record WorldGenSettings(WorldOptions options, WorldDimensions dimensions) } public static DataResult encode(DynamicOps ops, WorldOptions options, RegistryAccess access) { - return encode(ops, options, new WorldDimensions(access.registryOrThrow(Registries.LEVEL_STEM))); + return encode(ops, options, new WorldDimensions(access.lookupOrThrow(Registries.LEVEL_STEM))); } } diff --git a/net/minecraft/world/level/levelgen/WorldGenerationContext.java b/net/minecraft/world/level/levelgen/WorldGenerationContext.java index 049ab818..34d2d908 100644 --- a/net/minecraft/world/level/levelgen/WorldGenerationContext.java +++ b/net/minecraft/world/level/levelgen/WorldGenerationContext.java @@ -8,7 +8,7 @@ public class WorldGenerationContext { private final int height; public WorldGenerationContext(ChunkGenerator generator, LevelHeightAccessor level) { - this.minY = Math.max(level.getMinBuildHeight(), generator.getMinY()); + this.minY = Math.max(level.getMinY(), generator.getMinY()); this.height = Math.min(level.getHeight(), generator.getGenDepth()); } diff --git a/net/minecraft/world/level/levelgen/WorldOptions.java b/net/minecraft/world/level/levelgen/WorldOptions.java index 995ac64f..b2c00fe7 100644 --- a/net/minecraft/world/level/levelgen/WorldOptions.java +++ b/net/minecraft/world/level/levelgen/WorldOptions.java @@ -32,6 +32,10 @@ public class WorldOptions { return new WorldOptions(randomSeed(), true, false); } + public static WorldOptions testWorldWithRandomSeed() { + return new WorldOptions(randomSeed(), false, false); + } + private WorldOptions(long seed, boolean generateStructures, boolean generateBonusChest, Optional legacyCustomOptions) { this.seed = seed; this.generateStructures = generateStructures; diff --git a/net/minecraft/world/level/levelgen/XoroshiroRandomSource.java b/net/minecraft/world/level/levelgen/XoroshiroRandomSource.java index cac92c09..2e0c80b5 100644 --- a/net/minecraft/world/level/levelgen/XoroshiroRandomSource.java +++ b/net/minecraft/world/level/levelgen/XoroshiroRandomSource.java @@ -4,6 +4,7 @@ import com.google.common.annotations.VisibleForTesting; import com.mojang.serialization.Codec; import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; +import net.minecraft.world.level.levelgen.RandomSupport.Seed128bit; public class XoroshiroRandomSource implements RandomSource { private static final float FLOAT_UNIT = 5.9604645E-8F; @@ -17,7 +18,7 @@ public class XoroshiroRandomSource implements RandomSource { this.randomNumberGenerator = new Xoroshiro128PlusPlus(RandomSupport.upgradeSeedTo128bit(seed)); } - public XoroshiroRandomSource(RandomSupport.Seed128bit seed) { + public XoroshiroRandomSource(Seed128bit seed) { this.randomNumberGenerator = new Xoroshiro128PlusPlus(seed); } @@ -124,7 +125,7 @@ public class XoroshiroRandomSource implements RandomSource { @Override public RandomSource fromHashOf(String name) { - RandomSupport.Seed128bit seed128bit = RandomSupport.seedFromHashOf(name); + Seed128bit seed128bit = RandomSupport.seedFromHashOf(name); return new XoroshiroRandomSource(seed128bit.xor(this.seedLo, this.seedHi)); } diff --git a/net/minecraft/world/level/levelgen/blending/Blender.java b/net/minecraft/world/level/levelgen/blending/Blender.java index 2dfcb268..ea67568c 100644 --- a/net/minecraft/world/level/levelgen/blending/Blender.java +++ b/net/minecraft/world/level/levelgen/blending/Blender.java @@ -6,7 +6,6 @@ import com.google.common.collect.ImmutableMap.Builder; import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; import java.util.List; import java.util.Map; -import java.util.stream.Stream; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.Direction8; @@ -21,13 +20,12 @@ import net.minecraft.world.level.WorldGenLevel; import net.minecraft.world.level.biome.Biome; import net.minecraft.world.level.biome.BiomeResolver; import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.world.level.chunk.CarvingMask; import net.minecraft.world.level.chunk.ChunkAccess; import net.minecraft.world.level.chunk.ProtoChunk; -import net.minecraft.world.level.levelgen.DensityFunction; -import net.minecraft.world.level.levelgen.GenerationStep; +import net.minecraft.world.level.chunk.CarvingMask.Mask; import net.minecraft.world.level.levelgen.Heightmap; import net.minecraft.world.level.levelgen.XoroshiroRandomSource; +import net.minecraft.world.level.levelgen.DensityFunction.FunctionContext; import net.minecraft.world.level.levelgen.synth.NormalNoise; import net.minecraft.world.level.material.FluidState; import org.apache.commons.lang3.mutable.MutableDouble; @@ -42,7 +40,7 @@ public class Blender { } @Override - public double blendDensity(DensityFunction.FunctionContext context, double density) { + public double blendDensity(FunctionContext context, double density) { return density; } @@ -119,7 +117,7 @@ public class Blender { .forEach( (long_, blendingData) -> blendingData.iterateHeights( QuartPos.fromSection(ChunkPos.getX(long_)), QuartPos.fromSection(ChunkPos.getZ(long_)), (k, l, dx) -> { - double ex = Mth.length(i - k, j - l); + double ex = Mth.length((float)(i - k), (float)(j - l)); if (!(ex > HEIGHT_BLENDING_RANGE_CELLS)) { if (ex < mutableDouble3.doubleValue()) { mutableDouble3.setValue(ex); @@ -150,7 +148,7 @@ public class Blender { return 1.0 * (32.0 * (e - 128.0) - 3.0 * (e - 120.0) * f + 3.0 * f * f) / (128.0 * (32.0 - 3.0 * f)); } - public double blendDensity(DensityFunction.FunctionContext context, double density) { + public double blendDensity(FunctionContext context, double density) { int i = QuartPos.fromBlock(context.blockX()); int j = context.blockY() / 8; int k = QuartPos.fromBlock(context.blockZ()); @@ -233,7 +231,7 @@ public class Blender { .forEach( (long_, blendingData) -> blendingData.iterateBiomes( QuartPos.fromSection(ChunkPos.getX(long_)), y, QuartPos.fromSection(ChunkPos.getZ(long_)), (kx, l, holder) -> { - double dx = Mth.length(x - kx, z - l); + double dx = Mth.length((float)(x - kx), (float)(z - l)); if (!(dx > HEIGHT_BLENDING_RANGE_CELLS)) { if (dx < mutableDouble.doubleValue()) { mutableObject.setValue(holder); @@ -259,8 +257,8 @@ public class Blender { BlockPos blockPos = new BlockPos(chunkPos.getMinBlockX(), 0, chunkPos.getMinBlockZ()); BlendingData blendingData = chunk.getBlendingData(); if (blendingData != null) { - int i = blendingData.getAreaWithOldGeneration().getMinBuildHeight(); - int j = blendingData.getAreaWithOldGeneration().getMaxBuildHeight() - 1; + int i = blendingData.getAreaWithOldGeneration().getMinY(); + int j = blendingData.getAreaWithOldGeneration().getMaxY(); if (bl) { for (int k = 0; k < 16; k++) { for (int l = 0; l < 16; l++) { @@ -321,13 +319,13 @@ public class Blender { ImmutableMap immutableMap = builder.build(); if (chunk.isOldNoiseGeneration() || !immutableMap.isEmpty()) { Blender.DistanceGetter distanceGetter = makeOldChunkDistanceGetter(chunk.getBlendingData(), immutableMap); - CarvingMask.Mask mask = (ix, jx, k) -> { + Mask mask = (ix, jx, k) -> { double d = ix + 0.5 + SHIFT_NOISE.getValue(ix, jx, k) * 4.0; double e = jx + 0.5 + SHIFT_NOISE.getValue(jx, k, ix) * 4.0; double f = k + 0.5 + SHIFT_NOISE.getValue(k, ix, jx) * 4.0; return distanceGetter.getDistance(d, e, f) < 4.0; }; - Stream.of(GenerationStep.Carving.values()).map(chunk::getOrCreateCarvingMask).forEach(carvingMask -> carvingMask.setAdditionalMask(mask)); + chunk.getOrCreateCarvingMask().setAdditionalMask(mask); } } @@ -365,7 +363,7 @@ public class Blender { double f = d; double g = e; double h = blendingData.getAreaWithOldGeneration().getHeight() / 2.0; - double i = blendingData.getAreaWithOldGeneration().getMinBuildHeight() + h; + double i = blendingData.getAreaWithOldGeneration().getMinY() + h; return (hx, ix, j) -> distanceToCube(hx - 8.0 - f, ix - i, j - 8.0 - g, 8.0, h, 8.0); } diff --git a/net/minecraft/world/level/levelgen/blending/BlendingData.java b/net/minecraft/world/level/levelgen/blending/BlendingData.java index 6e290a4a..1be63528 100644 --- a/net/minecraft/world/level/levelgen/blending/BlendingData.java +++ b/net/minecraft/world/level/levelgen/blending/BlendingData.java @@ -4,14 +4,13 @@ import com.google.common.primitives.Doubles; import com.mojang.serialization.Codec; import com.mojang.serialization.DataResult; import com.mojang.serialization.codecs.RecordCodecBuilder; +import it.unimi.dsi.fastutil.doubles.DoubleArrays; import it.unimi.dsi.fastutil.objects.ObjectArrayList; import java.util.Arrays; import java.util.EnumSet; import java.util.List; import java.util.Optional; import java.util.Set; -import java.util.function.Function; -import java.util.stream.DoubleStream; import net.minecraft.Util; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -46,7 +45,7 @@ public class BlendingData { private static final int CELL_HORIZONTAL_MAX_INDEX_OUTSIDE = QUARTS_PER_SECTION; private static final int CELL_COLUMN_INSIDE_COUNT = 2 * CELL_HORIZONTAL_MAX_INDEX_INSIDE + 1; private static final int CELL_COLUMN_OUTSIDE_COUNT = 2 * CELL_HORIZONTAL_MAX_INDEX_OUTSIDE + 1; - private static final int CELL_COLUMN_COUNT = CELL_COLUMN_INSIDE_COUNT + CELL_COLUMN_OUTSIDE_COUNT; + static final int CELL_COLUMN_COUNT = CELL_COLUMN_INSIDE_COUNT + CELL_COLUMN_OUTSIDE_COUNT; private final LevelHeightAccessor areaWithOldGeneration; private static final List SURFACE_BLOCKS = List.of( Blocks.PODZOL, @@ -66,28 +65,9 @@ public class BlendingData { private final double[] heights; private final List>> biomes; private final transient double[][] densities; - private static final Codec DOUBLE_ARRAY_CODEC = Codec.DOUBLE.listOf().xmap(Doubles::toArray, Doubles::asList); - public static final Codec CODEC = RecordCodecBuilder.create( - instance -> instance.group( - Codec.INT.fieldOf("min_section").forGetter(blendingData -> blendingData.areaWithOldGeneration.getMinSection()), - Codec.INT.fieldOf("max_section").forGetter(blendingData -> blendingData.areaWithOldGeneration.getMaxSection()), - DOUBLE_ARRAY_CODEC.lenientOptionalFieldOf("heights") - .forGetter( - blendingData -> DoubleStream.of(blendingData.heights).anyMatch(d -> d != Double.MAX_VALUE) ? Optional.of(blendingData.heights) : Optional.empty() - ) - ) - .apply(instance, BlendingData::new) - ) - .comapFlatMap(BlendingData::validateArraySize, Function.identity()); - - private static DataResult validateArraySize(BlendingData blendingData) { - return blendingData.heights.length != CELL_COLUMN_COUNT - ? DataResult.error(() -> "heights has to be of length " + CELL_COLUMN_COUNT) - : DataResult.success(blendingData); - } private BlendingData(int sectionX, int sectionZ, Optional heights) { - this.heights = (double[])heights.orElse(Util.make(new double[CELL_COLUMN_COUNT], ds -> Arrays.fill(ds, Double.MAX_VALUE))); + this.heights = (double[])heights.orElseGet(() -> Util.make(new double[CELL_COLUMN_COUNT], ds -> Arrays.fill(ds, Double.MAX_VALUE))); this.densities = new double[CELL_COLUMN_COUNT][]; ObjectArrayList>> objectArrayList = new ObjectArrayList<>(CELL_COLUMN_COUNT); objectArrayList.size(CELL_COLUMN_COUNT); @@ -97,6 +77,28 @@ public class BlendingData { this.areaWithOldGeneration = LevelHeightAccessor.create(i, j); } + @Nullable + public static BlendingData unpack(@Nullable BlendingData.Packed packed) { + return packed == null ? null : new BlendingData(packed.minSection(), packed.maxSection(), packed.heights()); + } + + public BlendingData.Packed pack() { + boolean bl = false; + + for (double d : this.heights) { + if (d != Double.MAX_VALUE) { + bl = true; + break; + } + } + + return new BlendingData.Packed( + this.areaWithOldGeneration.getMinSectionY(), + this.areaWithOldGeneration.getMaxSectionY() + 1, + bl ? Optional.of(DoubleArrays.copy(this.heights)) : Optional.empty() + ); + } + @Nullable public static BlendingData getOrUpdateBlendingData(WorldGenRegion region, int chunkX, int chunkZ) { ChunkAccess chunkAccess = region.getChunk(chunkX, chunkZ); @@ -177,19 +179,20 @@ public class BlendingData { private int getHeightAtXZ(ChunkAccess chunk, int x, int z) { int i; if (chunk.hasPrimedHeightmap(Heightmap.Types.WORLD_SURFACE_WG)) { - i = Math.min(chunk.getHeight(Heightmap.Types.WORLD_SURFACE_WG, x, z) + 1, this.areaWithOldGeneration.getMaxBuildHeight()); + i = Math.min(chunk.getHeight(Heightmap.Types.WORLD_SURFACE_WG, x, z), this.areaWithOldGeneration.getMaxY()); } else { - i = this.areaWithOldGeneration.getMaxBuildHeight(); + i = this.areaWithOldGeneration.getMaxY(); } - int j = this.areaWithOldGeneration.getMinBuildHeight(); + int j = this.areaWithOldGeneration.getMinY(); BlockPos.MutableBlockPos mutableBlockPos = new BlockPos.MutableBlockPos(x, i, z); while (mutableBlockPos.getY() > j) { - mutableBlockPos.move(Direction.DOWN); if (SURFACE_BLOCKS.contains(chunk.getBlockState(mutableBlockPos).getBlock())) { return mutableBlockPos.getY(); } + + mutableBlockPos.move(Direction.DOWN); } return j; @@ -212,7 +215,7 @@ public class BlendingData { private double[] getDensityColumn(ChunkAccess chunk, int x, int z, int height) { double[] ds = new double[this.cellCountPerColumn()]; Arrays.fill(ds, -1.0); - BlockPos.MutableBlockPos mutableBlockPos = new BlockPos.MutableBlockPos(x, this.areaWithOldGeneration.getMaxBuildHeight(), z); + BlockPos.MutableBlockPos mutableBlockPos = new BlockPos.MutableBlockPos(x, this.areaWithOldGeneration.getMaxY() + 1, z); double d = read7(chunk, mutableBlockPos); for (int i = ds.length - 2; i >= 0; i--) { @@ -239,7 +242,7 @@ public class BlendingData { objectArrayList.size(this.quartCountPerColumn()); for (int i = 0; i < objectArrayList.size(); i++) { - int j = i + QuartPos.fromBlock(this.areaWithOldGeneration.getMinBuildHeight()); + int j = i + QuartPos.fromBlock(this.areaWithOldGeneration.getMinY()); objectArrayList.set(i, chunk.getNoiseBiome(QuartPos.fromBlock(x), j, QuartPos.fromBlock(z))); } @@ -287,8 +290,8 @@ public class BlendingData { } protected void iterateBiomes(int x, int y, int z, BlendingData.BiomeConsumer consumer) { - if (y >= QuartPos.fromBlock(this.areaWithOldGeneration.getMinBuildHeight()) && y < QuartPos.fromBlock(this.areaWithOldGeneration.getMaxBuildHeight())) { - int i = y - QuartPos.fromBlock(this.areaWithOldGeneration.getMinBuildHeight()); + if (y >= QuartPos.fromBlock(this.areaWithOldGeneration.getMinY()) && y <= QuartPos.fromBlock(this.areaWithOldGeneration.getMaxY())) { + int i = y - QuartPos.fromBlock(this.areaWithOldGeneration.getMinY()); for (int j = 0; j < this.biomes.size(); j++) { if (this.biomes.get(j) != null) { @@ -341,7 +344,7 @@ public class BlendingData { } private int getMinY() { - return this.areaWithOldGeneration.getMinSection() * 2; + return this.areaWithOldGeneration.getMinSectionY() * 2; } private int getCellYIndex(int y) { @@ -393,4 +396,23 @@ public class BlendingData { protected interface HeightConsumer { void consume(int i, int j, double d); } + + public record Packed(int minSection, int maxSection, Optional heights) { + private static final Codec DOUBLE_ARRAY_CODEC = Codec.DOUBLE.listOf().xmap(Doubles::toArray, Doubles::asList); + public static final Codec CODEC = RecordCodecBuilder.create( + instance -> instance.group( + Codec.INT.fieldOf("min_section").forGetter(BlendingData.Packed::minSection), + Codec.INT.fieldOf("max_section").forGetter(BlendingData.Packed::maxSection), + DOUBLE_ARRAY_CODEC.lenientOptionalFieldOf("heights").forGetter(BlendingData.Packed::heights) + ) + .apply(instance, BlendingData.Packed::new) + ) + .validate(BlendingData.Packed::validateArraySize); + + private static DataResult validateArraySize(BlendingData.Packed packed) { + return packed.heights.isPresent() && ((double[])packed.heights.get()).length != BlendingData.CELL_COLUMN_COUNT + ? DataResult.error(() -> "heights has to be of length " + BlendingData.CELL_COLUMN_COUNT) + : DataResult.success(packed); + } + } } diff --git a/net/minecraft/world/level/levelgen/feature/AbstractHugeMushroomFeature.java b/net/minecraft/world/level/levelgen/feature/AbstractHugeMushroomFeature.java index ece18181..9e280b0f 100644 --- a/net/minecraft/world/level/levelgen/feature/AbstractHugeMushroomFeature.java +++ b/net/minecraft/world/level/levelgen/feature/AbstractHugeMushroomFeature.java @@ -20,7 +20,7 @@ public abstract class AbstractHugeMushroomFeature extends Feature= level.getMinBuildHeight() + 1 && i + maxHeight + 1 < level.getMaxBuildHeight()) { + if (i >= level.getMinY() + 1 && i + maxHeight + 1 <= level.getMaxY()) { BlockState blockState = level.getBlockState(pos.below()); if (!isDirt(blockState) && !blockState.is(BlockTags.MUSHROOM_GROW_BLOCK)) { return false; diff --git a/net/minecraft/world/level/levelgen/feature/BasaltColumnsFeature.java b/net/minecraft/world/level/levelgen/feature/BasaltColumnsFeature.java index 350c7613..e84de52c 100644 --- a/net/minecraft/world/level/levelgen/feature/BasaltColumnsFeature.java +++ b/net/minecraft/world/level/levelgen/feature/BasaltColumnsFeature.java @@ -96,7 +96,7 @@ public class BasaltColumnsFeature extends Feature { @Nullable private static BlockPos findSurface(LevelAccessor level, int seaLevel, BlockPos.MutableBlockPos pos, int distance) { - while (pos.getY() > level.getMinBuildHeight() + 1 && distance > 0) { + while (pos.getY() > level.getMinY() + 1 && distance > 0) { distance--; if (canPlaceAt(level, seaLevel, pos)) { return pos; @@ -120,7 +120,7 @@ public class BasaltColumnsFeature extends Feature { @Nullable private static BlockPos findAir(LevelAccessor level, BlockPos.MutableBlockPos pos, int distance) { - while (pos.getY() < level.getMaxBuildHeight() && distance > 0) { + while (pos.getY() <= level.getMaxY() && distance > 0) { distance--; BlockState blockState = level.getBlockState(pos); if (CANNOT_PLACE_ON.contains(blockState.getBlock())) { diff --git a/net/minecraft/world/level/levelgen/feature/BlockBlobFeature.java b/net/minecraft/world/level/levelgen/feature/BlockBlobFeature.java index b186c48b..4b15f3d8 100644 --- a/net/minecraft/world/level/levelgen/feature/BlockBlobFeature.java +++ b/net/minecraft/world/level/levelgen/feature/BlockBlobFeature.java @@ -19,7 +19,7 @@ public class BlockBlobFeature extends Feature { RandomSource randomSource = context.random(); BlockStateConfiguration blockStateConfiguration; - for (blockStateConfiguration = context.config(); blockPos.getY() > worldGenLevel.getMinBuildHeight() + 3; blockPos = blockPos.below()) { + for (blockStateConfiguration = context.config(); blockPos.getY() > worldGenLevel.getMinY() + 3; blockPos = blockPos.below()) { if (!worldGenLevel.isEmptyBlock(blockPos.below())) { BlockState blockState = worldGenLevel.getBlockState(blockPos.below()); if (isDirt(blockState) || isStone(blockState)) { @@ -28,7 +28,7 @@ public class BlockBlobFeature extends Feature { } } - if (blockPos.getY() <= worldGenLevel.getMinBuildHeight() + 3) { + if (blockPos.getY() <= worldGenLevel.getMinY() + 3) { return false; } else { for (int i = 0; i < 3; i++) { diff --git a/net/minecraft/world/level/levelgen/feature/BlockPileFeature.java b/net/minecraft/world/level/levelgen/feature/BlockPileFeature.java index c7983891..a0383bcd 100644 --- a/net/minecraft/world/level/levelgen/feature/BlockPileFeature.java +++ b/net/minecraft/world/level/levelgen/feature/BlockPileFeature.java @@ -21,7 +21,7 @@ public class BlockPileFeature extends Feature { WorldGenLevel worldGenLevel = context.level(); RandomSource randomSource = context.random(); BlockPileConfiguration blockPileConfiguration = context.config(); - if (blockPos.getY() < worldGenLevel.getMinBuildHeight() + 5) { + if (blockPos.getY() < worldGenLevel.getMinY() + 5) { return false; } else { int i = 2 + randomSource.nextInt(2); diff --git a/net/minecraft/world/level/levelgen/feature/DesertWellFeature.java b/net/minecraft/world/level/levelgen/feature/DesertWellFeature.java index a587741a..7a02ed65 100644 --- a/net/minecraft/world/level/levelgen/feature/DesertWellFeature.java +++ b/net/minecraft/world/level/levelgen/feature/DesertWellFeature.java @@ -31,7 +31,7 @@ public class DesertWellFeature extends Feature { BlockPos blockPos = context.origin(); blockPos = blockPos.above(); - while (worldGenLevel.isEmptyBlock(blockPos) && blockPos.getY() > worldGenLevel.getMinBuildHeight() + 2) { + while (worldGenLevel.isEmptyBlock(blockPos) && blockPos.getY() > worldGenLevel.getMinY() + 2) { blockPos = blockPos.below(); } diff --git a/net/minecraft/world/level/levelgen/feature/DiskFeature.java b/net/minecraft/world/level/levelgen/feature/DiskFeature.java index 6ad932dc..77f97aaf 100644 --- a/net/minecraft/world/level/levelgen/feature/DiskFeature.java +++ b/net/minecraft/world/level/levelgen/feature/DiskFeature.java @@ -38,14 +38,21 @@ public class DiskFeature extends Feature { protected boolean placeColumn(DiskConfiguration config, WorldGenLevel level, RandomSource random, int maxY, int minY, BlockPos.MutableBlockPos pos) { boolean bl = false; + boolean bl2 = false; for (int i = maxY; i > minY; i--) { pos.setY(i); if (config.target().test(level, pos)) { BlockState blockState = config.stateProvider().getState(level, random, pos); level.setBlock(pos, blockState, 2); - this.markAboveForPostProcessing(level, pos); + if (!bl2) { + this.markAboveForPostProcessing(level, pos); + } + bl = true; + bl2 = true; + } else { + bl2 = false; } } diff --git a/net/minecraft/world/level/levelgen/feature/FeatureCountTracker.java b/net/minecraft/world/level/levelgen/feature/FeatureCountTracker.java index ee125a54..45410587 100644 --- a/net/minecraft/world/level/levelgen/feature/FeatureCountTracker.java +++ b/net/minecraft/world/level/levelgen/feature/FeatureCountTracker.java @@ -59,7 +59,7 @@ public class FeatureCountTracker { (serverLevel, levelData) -> { String string = serverLevel.dimension().location().toString(); boolean bl = serverLevel.getServer().isRunning(); - Registry registry = serverLevel.registryAccess().registryOrThrow(Registries.PLACED_FEATURE); + Registry registry = serverLevel.registryAccess().lookupOrThrow(Registries.PLACED_FEATURE); String string2 = (bl ? "running" : "dead") + " " + string; Integer integer = levelData.chunksWithFeatures().getValue(); LOGGER.debug(string2 + " total_chunks: " + integer); diff --git a/net/minecraft/world/level/levelgen/feature/FillLayerFeature.java b/net/minecraft/world/level/levelgen/feature/FillLayerFeature.java index 3e548b5a..81f2e35f 100644 --- a/net/minecraft/world/level/levelgen/feature/FillLayerFeature.java +++ b/net/minecraft/world/level/levelgen/feature/FillLayerFeature.java @@ -21,7 +21,7 @@ public class FillLayerFeature extends Feature { for (int j = 0; j < 16; j++) { int k = blockPos.getX() + i; int l = blockPos.getZ() + j; - int m = worldGenLevel.getMinBuildHeight() + layerConfiguration.height; + int m = worldGenLevel.getMinY() + layerConfiguration.height; mutableBlockPos.set(k, m, l); if (worldGenLevel.getBlockState(mutableBlockPos).isAir()) { worldGenLevel.setBlock(mutableBlockPos, layerConfiguration.state, 2); diff --git a/net/minecraft/world/level/levelgen/feature/FossilFeature.java b/net/minecraft/world/level/levelgen/feature/FossilFeature.java index b8aa8aba..aabd3210 100644 --- a/net/minecraft/world/level/levelgen/feature/FossilFeature.java +++ b/net/minecraft/world/level/levelgen/feature/FossilFeature.java @@ -37,10 +37,10 @@ public class FossilFeature extends Feature { ChunkPos chunkPos = new ChunkPos(blockPos); BoundingBox boundingBox = new BoundingBox( chunkPos.getMinBlockX() - 16, - worldGenLevel.getMinBuildHeight(), + worldGenLevel.getMinY(), chunkPos.getMinBlockZ() - 16, chunkPos.getMaxBlockX() + 16, - worldGenLevel.getMaxBuildHeight(), + worldGenLevel.getMaxY(), chunkPos.getMaxBlockZ() + 16 ); StructurePlaceSettings structurePlaceSettings = new StructurePlaceSettings().setRotation(rotation).setBoundingBox(boundingBox).setRandom(randomSource); @@ -54,7 +54,7 @@ public class FossilFeature extends Feature { } } - int k = Math.max(j - 15 - randomSource.nextInt(10), worldGenLevel.getMinBuildHeight() + 10); + int k = Math.max(j - 15 - randomSource.nextInt(10), worldGenLevel.getMinY() + 10); BlockPos blockPos3 = structureTemplate.getZeroPositionWithTransform(blockPos2.atY(k), Mirror.NONE, rotation); if (countEmptyCorners(worldGenLevel, structureTemplate.getBoundingBox(structurePlaceSettings, blockPos3)) > fossilFeatureConfiguration.maxEmptyCornersAllowed ) diff --git a/net/minecraft/world/level/levelgen/feature/GeodeFeature.java b/net/minecraft/world/level/levelgen/feature/GeodeFeature.java index 2105a3ba..0274eabe 100644 --- a/net/minecraft/world/level/levelgen/feature/GeodeFeature.java +++ b/net/minecraft/world/level/levelgen/feature/GeodeFeature.java @@ -8,7 +8,6 @@ import java.util.function.Predicate; import net.minecraft.Util; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; -import net.minecraft.tags.BlockTags; import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; import net.minecraft.world.level.WorldGenLevel; @@ -63,7 +62,7 @@ public class GeodeFeature extends Feature { int q = geodeConfiguration.outerWallDistance.sample(randomSource); BlockPos blockPos2 = blockPos.offset(o, p, q); BlockState blockState = worldGenLevel.getBlockState(blockPos2); - if (blockState.isAir() || blockState.is(BlockTags.GEODE_INVALID_BLOCKS)) { + if (blockState.isAir() || blockState.is(geodeBlockSettings.invalidBlocks)) { if (++m > geodeConfiguration.invalidBlocksThreshold) { return false; } diff --git a/net/minecraft/world/level/levelgen/feature/HugeBrownMushroomFeature.java b/net/minecraft/world/level/levelgen/feature/HugeBrownMushroomFeature.java index 2b3e7ee4..c9d2d53b 100644 --- a/net/minecraft/world/level/levelgen/feature/HugeBrownMushroomFeature.java +++ b/net/minecraft/world/level/levelgen/feature/HugeBrownMushroomFeature.java @@ -29,7 +29,7 @@ public class HugeBrownMushroomFeature extends AbstractHugeMushroomFeature { boolean bl6 = bl3 || bl4; if (!bl5 || !bl6) { mutablePos.setWithOffset(pos, j, treeHeight, k); - if (!level.getBlockState(mutablePos).isSolidRender(level, mutablePos)) { + if (!level.getBlockState(mutablePos).isSolidRender()) { boolean bl7 = bl || bl6 && j == 1 - i; boolean bl8 = bl2 || bl6 && j == i - 1; boolean bl9 = bl3 || bl5 && k == 1 - i; diff --git a/net/minecraft/world/level/levelgen/feature/HugeRedMushroomFeature.java b/net/minecraft/world/level/levelgen/feature/HugeRedMushroomFeature.java index 06d706e4..69095e5e 100644 --- a/net/minecraft/world/level/levelgen/feature/HugeRedMushroomFeature.java +++ b/net/minecraft/world/level/levelgen/feature/HugeRedMushroomFeature.java @@ -31,7 +31,7 @@ public class HugeRedMushroomFeature extends AbstractHugeMushroomFeature { boolean bl6 = bl3 || bl4; if (i >= treeHeight || bl5 != bl6) { mutablePos.setWithOffset(pos, l, i, m); - if (!level.getBlockState(mutablePos).isSolidRender(level, mutablePos)) { + if (!level.getBlockState(mutablePos).isSolidRender()) { BlockState blockState = config.capProvider.getState(random, pos); if (blockState.hasProperty(HugeMushroomBlock.WEST) && blockState.hasProperty(HugeMushroomBlock.EAST) diff --git a/net/minecraft/world/level/levelgen/feature/IceSpikeFeature.java b/net/minecraft/world/level/levelgen/feature/IceSpikeFeature.java index b6755690..0870cc68 100644 --- a/net/minecraft/world/level/levelgen/feature/IceSpikeFeature.java +++ b/net/minecraft/world/level/levelgen/feature/IceSpikeFeature.java @@ -20,7 +20,7 @@ public class IceSpikeFeature extends Feature { RandomSource randomSource = context.random(); WorldGenLevel worldGenLevel = context.level(); - while (worldGenLevel.isEmptyBlock(blockPos) && blockPos.getY() > worldGenLevel.getMinBuildHeight() + 2) { + while (worldGenLevel.isEmptyBlock(blockPos) && blockPos.getY() > worldGenLevel.getMinY() + 2) { blockPos = blockPos.below(); } diff --git a/net/minecraft/world/level/levelgen/feature/LakeFeature.java b/net/minecraft/world/level/levelgen/feature/LakeFeature.java index 4ef4ed1e..e095d4ca 100644 --- a/net/minecraft/world/level/levelgen/feature/LakeFeature.java +++ b/net/minecraft/world/level/levelgen/feature/LakeFeature.java @@ -26,7 +26,7 @@ public class LakeFeature extends Feature { WorldGenLevel worldGenLevel = context.level(); RandomSource randomSource = context.random(); LakeFeature.Configuration configuration = context.config(); - if (blockPos.getY() <= worldGenLevel.getMinBuildHeight() + 4) { + if (blockPos.getY() <= worldGenLevel.getMinY() + 4) { return false; } else { blockPos = blockPos.below(4); diff --git a/net/minecraft/world/level/levelgen/feature/MonsterRoomFeature.java b/net/minecraft/world/level/levelgen/feature/MonsterRoomFeature.java index 999c3d78..7565723e 100644 --- a/net/minecraft/world/level/levelgen/feature/MonsterRoomFeature.java +++ b/net/minecraft/world/level/levelgen/feature/MonsterRoomFeature.java @@ -72,7 +72,7 @@ public class MonsterRoomFeature extends Feature { BlockPos blockPos2x = blockPos.offset(s, t, u); BlockState blockState = worldGenLevel.getBlockState(blockPos2x); if (s == k || t == -1 || u == p || s == l || t == 4 || u == q) { - if (blockPos2x.getY() >= worldGenLevel.getMinBuildHeight() && !worldGenLevel.getBlockState(blockPos2x.below()).isSolid()) { + if (blockPos2x.getY() >= worldGenLevel.getMinY() && !worldGenLevel.getBlockState(blockPos2x.below()).isSolid()) { worldGenLevel.setBlock(blockPos2x, AIR, 2); } else if (blockState.isSolid() && !blockState.is(Blocks.CHEST)) { if (t == -1 && randomSource.nextInt(4) != 0) { diff --git a/net/minecraft/world/level/levelgen/feature/NetherForestVegetationFeature.java b/net/minecraft/world/level/levelgen/feature/NetherForestVegetationFeature.java index 4a43e5a2..97fe7cc3 100644 --- a/net/minecraft/world/level/levelgen/feature/NetherForestVegetationFeature.java +++ b/net/minecraft/world/level/levelgen/feature/NetherForestVegetationFeature.java @@ -24,7 +24,7 @@ public class NetherForestVegetationFeature extends Feature= worldGenLevel.getMinBuildHeight() + 1 && i + 1 < worldGenLevel.getMaxBuildHeight()) { + if (i >= worldGenLevel.getMinY() + 1 && i + 1 <= worldGenLevel.getMaxY()) { int j = 0; for (int k = 0; k < netherForestVegetationConfig.spreadWidth * netherForestVegetationConfig.spreadWidth; k++) { @@ -34,7 +34,7 @@ public class NetherForestVegetationFeature extends Feature worldGenLevel.getMinBuildHeight() && blockState2.canSurvive(worldGenLevel, blockPos2)) { + if (worldGenLevel.isEmptyBlock(blockPos2) && blockPos2.getY() > worldGenLevel.getMinY() && blockState2.canSurvive(worldGenLevel, blockPos2)) { worldGenLevel.setBlock(blockPos2, blockState2, 2); j++; } diff --git a/net/minecraft/world/level/levelgen/feature/ReplaceBlobsFeature.java b/net/minecraft/world/level/levelgen/feature/ReplaceBlobsFeature.java index 42782094..9d7f79d2 100644 --- a/net/minecraft/world/level/levelgen/feature/ReplaceBlobsFeature.java +++ b/net/minecraft/world/level/levelgen/feature/ReplaceBlobsFeature.java @@ -22,9 +22,7 @@ public class ReplaceBlobsFeature extends Feature { WorldGenLevel worldGenLevel = context.level(); RandomSource randomSource = context.random(); Block block = replaceSphereConfiguration.targetState.getBlock(); - BlockPos blockPos = findTarget( - worldGenLevel, context.origin().mutable().clamp(Direction.Axis.Y, worldGenLevel.getMinBuildHeight() + 1, worldGenLevel.getMaxBuildHeight() - 1), block - ); + BlockPos blockPos = findTarget(worldGenLevel, context.origin().mutable().clamp(Direction.Axis.Y, worldGenLevel.getMinY() + 1, worldGenLevel.getMaxY()), block); if (blockPos == null) { return false; } else { @@ -52,7 +50,7 @@ public class ReplaceBlobsFeature extends Feature { @Nullable private static BlockPos findTarget(LevelAccessor level, BlockPos.MutableBlockPos topPos, Block block) { - while (topPos.getY() > level.getMinBuildHeight() + 1) { + while (topPos.getY() > level.getMinY() + 1) { BlockState blockState = level.getBlockState(topPos); if (blockState.is(block)) { return topPos; diff --git a/net/minecraft/world/level/levelgen/feature/SimpleBlockFeature.java b/net/minecraft/world/level/levelgen/feature/SimpleBlockFeature.java index 59c52ec7..be145071 100644 --- a/net/minecraft/world/level/levelgen/feature/SimpleBlockFeature.java +++ b/net/minecraft/world/level/levelgen/feature/SimpleBlockFeature.java @@ -4,6 +4,7 @@ import com.mojang.serialization.Codec; import net.minecraft.core.BlockPos; import net.minecraft.world.level.WorldGenLevel; import net.minecraft.world.level.block.DoublePlantBlock; +import net.minecraft.world.level.block.MossyCarpetBlock; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.levelgen.feature.configurations.SimpleBlockConfiguration; @@ -25,6 +26,8 @@ public class SimpleBlockFeature extends Feature { } DoublePlantBlock.placeAt(worldGenLevel, blockState, blockPos, 2); + } else if (blockState.getBlock() instanceof MossyCarpetBlock) { + MossyCarpetBlock.placeAt(worldGenLevel, blockPos, worldGenLevel.getRandom(), 2); } else { worldGenLevel.setBlock(blockPos, blockState, 2); } diff --git a/net/minecraft/world/level/levelgen/feature/SpikeFeature.java b/net/minecraft/world/level/levelgen/feature/SpikeFeature.java index 56dd0eb0..1c1a3384 100644 --- a/net/minecraft/world/level/levelgen/feature/SpikeFeature.java +++ b/net/minecraft/world/level/levelgen/feature/SpikeFeature.java @@ -15,6 +15,7 @@ import net.minecraft.core.BlockPos; import net.minecraft.core.SectionPos; import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.boss.enderdragon.EndCrystal; import net.minecraft.world.level.ServerLevelAccessor; @@ -71,7 +72,7 @@ public class SpikeFeature extends Feature { int i = spike.getRadius(); for (BlockPos blockPos : BlockPos.betweenClosed( - new BlockPos(spike.getCenterX() - i, level.getMinBuildHeight(), spike.getCenterZ() - i), + new BlockPos(spike.getCenterX() - i, level.getMinY(), spike.getCenterZ() - i), new BlockPos(spike.getCenterX() + i, spike.getHeight() + 10, spike.getCenterZ() + i) )) { if (blockPos.distToLowCornerSqr(spike.getCenterX(), blockPos.getY(), spike.getCenterZ()) <= i * i + 1 && blockPos.getY() < spike.getHeight()) { @@ -109,7 +110,7 @@ public class SpikeFeature extends Feature { } } - EndCrystal endCrystal = EntityType.END_CRYSTAL.create(level.getLevel()); + EndCrystal endCrystal = EntityType.END_CRYSTAL.create(level.getLevel(), EntitySpawnReason.STRUCTURE); if (endCrystal != null) { endCrystal.setBeamTarget(config.getCrystalBeamTarget()); endCrystal.setInvulnerable(config.isCrystalInvulnerable()); diff --git a/net/minecraft/world/level/levelgen/feature/TreeFeature.java b/net/minecraft/world/level/levelgen/feature/TreeFeature.java index 45b9e77e..c0174241 100644 --- a/net/minecraft/world/level/levelgen/feature/TreeFeature.java +++ b/net/minecraft/world/level/levelgen/feature/TreeFeature.java @@ -69,7 +69,7 @@ public class TreeFeature extends Feature { BlockPos blockPos = (BlockPos)config.rootPlacer.map(rootPlacer -> rootPlacer.getTrunkOrigin(pos, random)).orElse(pos); int m = Math.min(pos.getY(), blockPos.getY()); int n = Math.max(pos.getY(), blockPos.getY()) + i + 1; - if (m >= level.getMinBuildHeight() + 1 && n <= level.getMaxBuildHeight()) { + if (m >= level.getMinY() + 1 && n <= level.getMaxY() + 1) { OptionalInt optionalInt = config.minimumSize.minClippedHeight(); int o = this.getMaxFreeTreeHeight(level, i, blockPos, config); if (o >= i || !optionalInt.isEmpty() && o >= optionalInt.getAsInt()) { diff --git a/net/minecraft/world/level/levelgen/feature/foliageplacers/FoliagePlacer.java b/net/minecraft/world/level/levelgen/feature/foliageplacers/FoliagePlacer.java index b49a15f5..bdae6d30 100644 --- a/net/minecraft/world/level/levelgen/feature/foliageplacers/FoliagePlacer.java +++ b/net/minecraft/world/level/levelgen/feature/foliageplacers/FoliagePlacer.java @@ -170,9 +170,8 @@ public abstract class FoliagePlacer { protected static boolean tryPlaceLeaf( LevelSimulatedReader level, FoliagePlacer.FoliageSetter foliageSetter, RandomSource random, TreeConfiguration treeConfiguration, BlockPos pos ) { - if (!TreeFeature.validTreePos(level, pos)) { - return false; - } else { + boolean bl = level.isStateAtPosition(pos, blockStatex -> (Boolean)blockStatex.getValueOrElse(BlockStateProperties.PERSISTENT, false)); + if (!bl && TreeFeature.validTreePos(level, pos)) { BlockState blockState = treeConfiguration.foliageProvider.getState(random, pos); if (blockState.hasProperty(BlockStateProperties.WATERLOGGED)) { blockState = blockState.setValue(BlockStateProperties.WATERLOGGED, level.isFluidAtPosition(pos, fluidState -> fluidState.isSourceOfType(Fluids.WATER))); @@ -180,6 +179,8 @@ public abstract class FoliagePlacer { foliageSetter.set(pos, blockState); return true; + } else { + return false; } } diff --git a/net/minecraft/world/level/levelgen/feature/treedecorators/BeehiveDecorator.java b/net/minecraft/world/level/levelgen/feature/treedecorators/BeehiveDecorator.java index ee04a994..0c5cd0e5 100644 --- a/net/minecraft/world/level/levelgen/feature/treedecorators/BeehiveDecorator.java +++ b/net/minecraft/world/level/levelgen/feature/treedecorators/BeehiveDecorator.java @@ -2,11 +2,11 @@ package net.minecraft.world.level.levelgen.feature.treedecorators; import com.mojang.serialization.Codec; import com.mojang.serialization.MapCodec; -import java.util.Collections; import java.util.List; import java.util.Optional; import java.util.stream.Collectors; import java.util.stream.Stream; +import net.minecraft.Util; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.util.RandomSource; @@ -52,7 +52,7 @@ public class BeehiveDecorator extends TreeDecorator { .flatMap(blockPos -> Stream.of(SPAWN_DIRECTIONS).map(blockPos::relative)) .collect(Collectors.toList()); if (!list3.isEmpty()) { - Collections.shuffle(list3); + Util.shuffle(list3, randomSource); Optional optional = list3.stream().filter(blockPos -> context.isAir(blockPos) && context.isAir(blockPos.relative(WORLDGEN_FACING))).findFirst(); if (!optional.isEmpty()) { context.setBlock((BlockPos)optional.get(), Blocks.BEE_NEST.defaultBlockState().setValue(BeehiveBlock.FACING, WORLDGEN_FACING)); diff --git a/net/minecraft/world/level/levelgen/feature/treedecorators/CreakingHeartDecorator.java b/net/minecraft/world/level/levelgen/feature/treedecorators/CreakingHeartDecorator.java new file mode 100644 index 00000000..00ef26f4 --- /dev/null +++ b/net/minecraft/world/level/levelgen/feature/treedecorators/CreakingHeartDecorator.java @@ -0,0 +1,56 @@ +package net.minecraft.world.level.levelgen.feature.treedecorators; + +import com.mojang.serialization.Codec; +import com.mojang.serialization.MapCodec; +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; +import net.minecraft.Util; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.tags.BlockTags; +import net.minecraft.util.RandomSource; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.CreakingHeartBlock; + +public class CreakingHeartDecorator extends TreeDecorator { + public static final MapCodec CODEC = Codec.floatRange(0.0F, 1.0F) + .fieldOf("probability") + .xmap(CreakingHeartDecorator::new, creakingHeartDecorator -> creakingHeartDecorator.probability); + private final float probability; + + public CreakingHeartDecorator(float f) { + this.probability = f; + } + + @Override + protected TreeDecoratorType type() { + return TreeDecoratorType.CREAKING_HEART; + } + + @Override + public void place(TreeDecorator.Context context) { + RandomSource randomSource = context.random(); + List list = context.logs(); + if (!list.isEmpty()) { + if (!(randomSource.nextFloat() >= this.probability)) { + List list2 = new ArrayList(list); + Util.shuffle(list2, randomSource); + Optional optional = list2.stream().filter(blockPos -> { + for (Direction direction : Direction.values()) { + if (!context.checkBlock(blockPos.relative(direction), blockState -> blockState.is(BlockTags.LOGS))) { + return false; + } + } + + return true; + }).findFirst(); + if (!optional.isEmpty()) { + context.setBlock( + (BlockPos)optional.get(), Blocks.CREAKING_HEART.defaultBlockState().setValue(CreakingHeartBlock.CREAKING, CreakingHeartBlock.CreakingHeartState.DORMANT) + ); + } + } + } + } +} diff --git a/net/minecraft/world/level/levelgen/feature/treedecorators/PaleMossDecorator.java b/net/minecraft/world/level/levelgen/feature/treedecorators/PaleMossDecorator.java new file mode 100644 index 00000000..652959b1 --- /dev/null +++ b/net/minecraft/world/level/levelgen/feature/treedecorators/PaleMossDecorator.java @@ -0,0 +1,101 @@ +package net.minecraft.world.level.levelgen.feature.treedecorators; + +import com.mojang.serialization.Codec; +import com.mojang.serialization.MapCodec; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import java.util.List; +import net.minecraft.Util; +import net.minecraft.core.BlockPos; +import net.minecraft.core.registries.Registries; +import net.minecraft.data.worldgen.features.VegetationFeatures; +import net.minecraft.util.RandomSource; +import net.minecraft.world.level.WorldGenLevel; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.HangingMossBlock; +import net.minecraft.world.level.block.MossyCarpetBlock; +import net.minecraft.world.level.levelgen.feature.ConfiguredFeature; +import org.apache.commons.lang3.mutable.Mutable; +import org.apache.commons.lang3.mutable.MutableObject; + +public class PaleMossDecorator extends TreeDecorator { + public static final MapCodec CODEC = RecordCodecBuilder.mapCodec( + instance -> instance.group( + Codec.floatRange(0.0F, 1.0F).fieldOf("leaves_probability").forGetter(paleMossDecorator -> paleMossDecorator.leavesProbability), + Codec.floatRange(0.0F, 1.0F).fieldOf("trunk_probability").forGetter(paleMossDecorator -> paleMossDecorator.trunkProbability), + Codec.floatRange(0.0F, 1.0F).fieldOf("ground_probability").forGetter(paleMossDecorator -> paleMossDecorator.groundProbability) + ) + .apply(instance, PaleMossDecorator::new) + ); + private final float leavesProbability; + private final float trunkProbability; + private final float groundProbability; + + @Override + protected TreeDecoratorType type() { + return TreeDecoratorType.PALE_MOSS; + } + + public PaleMossDecorator(float f, float g, float h) { + this.leavesProbability = f; + this.trunkProbability = g; + this.groundProbability = h; + } + + @Override + public void place(TreeDecorator.Context context) { + RandomSource randomSource = context.random(); + WorldGenLevel worldGenLevel = (WorldGenLevel)context.level(); + List list = Util.shuffledCopy(context.logs(), randomSource); + if (!list.isEmpty()) { + Mutable mutable = new MutableObject<>((BlockPos)list.getFirst()); + list.forEach(blockPosx -> { + if (blockPosx.getY() < mutable.getValue().getY()) { + mutable.setValue(blockPosx); + } + }); + BlockPos blockPos = mutable.getValue(); + if (randomSource.nextFloat() < this.groundProbability) { + worldGenLevel.registryAccess() + .lookup(Registries.CONFIGURED_FEATURE) + .flatMap(registry -> registry.get(VegetationFeatures.PALE_MOSS_PATCH_BONEMEAL)) + .ifPresent( + reference -> ((ConfiguredFeature)reference.value()) + .place(worldGenLevel, worldGenLevel.getLevel().getChunkSource().getGenerator(), randomSource, blockPos.above()) + ); + } + + context.logs().forEach(blockPosx -> { + if (randomSource.nextFloat() < this.trunkProbability) { + BlockPos blockPos2 = blockPosx.below(); + if (context.isAir(blockPos2)) { + addMossHanger(blockPos2, context); + } + } + + if (randomSource.nextFloat() < this.trunkProbability) { + BlockPos blockPos2 = blockPosx.above(); + if (context.isAir(blockPos2)) { + MossyCarpetBlock.placeAt((WorldGenLevel)context.level(), blockPos2, context.random(), 3); + } + } + }); + context.leaves().forEach(blockPosx -> { + if (randomSource.nextFloat() < this.leavesProbability) { + BlockPos blockPos2 = blockPosx.below(); + if (context.isAir(blockPos2)) { + addMossHanger(blockPos2, context); + } + } + }); + } + } + + private static void addMossHanger(BlockPos blockPos, TreeDecorator.Context context) { + while (context.isAir(blockPos.below()) && !(context.random().nextFloat() < 0.5)) { + context.setBlock(blockPos, Blocks.PALE_HANGING_MOSS.defaultBlockState().setValue(HangingMossBlock.TIP, false)); + blockPos = blockPos.below(); + } + + context.setBlock(blockPos, Blocks.PALE_HANGING_MOSS.defaultBlockState().setValue(HangingMossBlock.TIP, true)); + } +} diff --git a/net/minecraft/world/level/levelgen/feature/treedecorators/TreeDecorator.java b/net/minecraft/world/level/levelgen/feature/treedecorators/TreeDecorator.java index 88ecd4b8..cc9bec22 100644 --- a/net/minecraft/world/level/levelgen/feature/treedecorators/TreeDecorator.java +++ b/net/minecraft/world/level/levelgen/feature/treedecorators/TreeDecorator.java @@ -5,6 +5,7 @@ import it.unimi.dsi.fastutil.objects.ObjectArrayList; import java.util.Comparator; import java.util.Set; import java.util.function.BiConsumer; +import java.util.function.Predicate; import net.minecraft.core.BlockPos; import net.minecraft.core.Vec3i; import net.minecraft.core.registries.BuiltInRegistries; @@ -61,6 +62,10 @@ public abstract class TreeDecorator { return this.level.isStateAtPosition(pos, BlockBehaviour.BlockStateBase::isAir); } + public boolean checkBlock(BlockPos blockPos, Predicate predicate) { + return this.level.isStateAtPosition(blockPos, predicate); + } + public LevelSimulatedReader level() { return this.level; } diff --git a/net/minecraft/world/level/levelgen/feature/treedecorators/TreeDecoratorType.java b/net/minecraft/world/level/levelgen/feature/treedecorators/TreeDecoratorType.java index f444656c..dbdc0c42 100644 --- a/net/minecraft/world/level/levelgen/feature/treedecorators/TreeDecoratorType.java +++ b/net/minecraft/world/level/levelgen/feature/treedecorators/TreeDecoratorType.java @@ -7,6 +7,8 @@ import net.minecraft.core.registries.BuiltInRegistries; public class TreeDecoratorType

{ public static final TreeDecoratorType TRUNK_VINE = register("trunk_vine", TrunkVineDecorator.CODEC); public static final TreeDecoratorType LEAVE_VINE = register("leave_vine", LeaveVineDecorator.CODEC); + public static final TreeDecoratorType PALE_MOSS = register("pale_moss", PaleMossDecorator.CODEC); + public static final TreeDecoratorType CREAKING_HEART = register("creaking_heart", CreakingHeartDecorator.CODEC); public static final TreeDecoratorType COCOA = register("cocoa", CocoaDecorator.CODEC); public static final TreeDecoratorType BEEHIVE = register("beehive", BeehiveDecorator.CODEC); public static final TreeDecoratorType ALTER_GROUND = register("alter_ground", AlterGroundDecorator.CODEC); diff --git a/net/minecraft/world/level/levelgen/flat/FlatLevelGeneratorPreset.java b/net/minecraft/world/level/levelgen/flat/FlatLevelGeneratorPreset.java index f18f6093..8cf9cde5 100644 --- a/net/minecraft/world/level/levelgen/flat/FlatLevelGeneratorPreset.java +++ b/net/minecraft/world/level/levelgen/flat/FlatLevelGeneratorPreset.java @@ -5,13 +5,12 @@ import com.mojang.serialization.codecs.RecordCodecBuilder; import net.minecraft.core.Holder; import net.minecraft.core.registries.Registries; import net.minecraft.resources.RegistryFileCodec; -import net.minecraft.resources.RegistryFixedCodec; import net.minecraft.world.item.Item; public record FlatLevelGeneratorPreset(Holder displayItem, FlatLevelGeneratorSettings settings) { public static final Codec DIRECT_CODEC = RecordCodecBuilder.create( instance -> instance.group( - RegistryFixedCodec.create(Registries.ITEM).fieldOf("display").forGetter(flatLevelGeneratorPreset -> flatLevelGeneratorPreset.displayItem), + Item.CODEC.fieldOf("display").forGetter(flatLevelGeneratorPreset -> flatLevelGeneratorPreset.displayItem), FlatLevelGeneratorSettings.CODEC.fieldOf("settings").forGetter(flatLevelGeneratorPreset -> flatLevelGeneratorPreset.settings) ) .apply(instance, FlatLevelGeneratorPreset::new) diff --git a/net/minecraft/world/level/levelgen/material/MaterialRuleList.java b/net/minecraft/world/level/levelgen/material/MaterialRuleList.java index 53320860..056c5020 100644 --- a/net/minecraft/world/level/levelgen/material/MaterialRuleList.java +++ b/net/minecraft/world/level/levelgen/material/MaterialRuleList.java @@ -1,15 +1,14 @@ package net.minecraft.world.level.levelgen.material; -import java.util.List; import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.world.level.levelgen.DensityFunction; import net.minecraft.world.level.levelgen.NoiseChunk; +import net.minecraft.world.level.levelgen.DensityFunction.FunctionContext; import org.jetbrains.annotations.Nullable; -public record MaterialRuleList(List materialRuleList) implements NoiseChunk.BlockStateFiller { +public record MaterialRuleList(NoiseChunk.BlockStateFiller[] materialRuleList) implements NoiseChunk.BlockStateFiller { @Nullable @Override - public BlockState calculate(DensityFunction.FunctionContext functionContext) { + public BlockState calculate(FunctionContext functionContext) { for (NoiseChunk.BlockStateFiller blockStateFiller : this.materialRuleList) { BlockState blockState = blockStateFiller.calculate(functionContext); if (blockState != null) { diff --git a/net/minecraft/world/level/levelgen/placement/CarvingMaskPlacement.java b/net/minecraft/world/level/levelgen/placement/CarvingMaskPlacement.java deleted file mode 100644 index 0c5d740e..00000000 --- a/net/minecraft/world/level/levelgen/placement/CarvingMaskPlacement.java +++ /dev/null @@ -1,34 +0,0 @@ -package net.minecraft.world.level.levelgen.placement; - -import com.mojang.serialization.MapCodec; -import java.util.stream.Stream; -import net.minecraft.core.BlockPos; -import net.minecraft.util.RandomSource; -import net.minecraft.world.level.ChunkPos; -import net.minecraft.world.level.levelgen.GenerationStep; - -public class CarvingMaskPlacement extends PlacementModifier { - public static final MapCodec CODEC = GenerationStep.Carving.CODEC - .fieldOf("step") - .xmap(CarvingMaskPlacement::new, carvingMaskPlacement -> carvingMaskPlacement.step); - private final GenerationStep.Carving step; - - private CarvingMaskPlacement(GenerationStep.Carving step) { - this.step = step; - } - - public static CarvingMaskPlacement forStep(GenerationStep.Carving step) { - return new CarvingMaskPlacement(step); - } - - @Override - public Stream getPositions(PlacementContext context, RandomSource random, BlockPos pos) { - ChunkPos chunkPos = new ChunkPos(pos); - return context.getCarvingMask(chunkPos, this.step).stream(chunkPos); - } - - @Override - public PlacementModifierType type() { - return PlacementModifierType.CARVING_MASK_PLACEMENT; - } -} diff --git a/net/minecraft/world/level/levelgen/placement/CountOnEveryLayerPlacement.java b/net/minecraft/world/level/levelgen/placement/CountOnEveryLayerPlacement.java index 76bcf9c8..b551b03c 100644 --- a/net/minecraft/world/level/levelgen/placement/CountOnEveryLayerPlacement.java +++ b/net/minecraft/world/level/levelgen/placement/CountOnEveryLayerPlacement.java @@ -66,7 +66,7 @@ public class CountOnEveryLayerPlacement extends PlacementModifier { int i = 0; BlockState blockState = context.getBlockState(mutableBlockPos); - for (int j = y; j >= context.getMinBuildHeight() + 1; j--) { + for (int j = y; j >= context.getMinY() + 1; j--) { mutableBlockPos.setY(j - 1); BlockState blockState2 = context.getBlockState(mutableBlockPos); if (!isEmpty(blockState2) && isEmpty(blockState) && !blockState2.is(Blocks.BEDROCK)) { diff --git a/net/minecraft/world/level/levelgen/placement/HeightmapPlacement.java b/net/minecraft/world/level/levelgen/placement/HeightmapPlacement.java index 40fe5cd4..4d1089e0 100644 --- a/net/minecraft/world/level/levelgen/placement/HeightmapPlacement.java +++ b/net/minecraft/world/level/levelgen/placement/HeightmapPlacement.java @@ -27,7 +27,7 @@ public class HeightmapPlacement extends PlacementModifier { int i = pos.getX(); int j = pos.getZ(); int k = context.getHeight(this.heightmap, i, j); - return k > context.getMinBuildHeight() ? Stream.of(new BlockPos(i, k, j)) : Stream.of(); + return k > context.getMinY() ? Stream.of(new BlockPos(i, k, j)) : Stream.of(); } @Override diff --git a/net/minecraft/world/level/levelgen/placement/PlacementContext.java b/net/minecraft/world/level/levelgen/placement/PlacementContext.java index 96950518..0f898de2 100644 --- a/net/minecraft/world/level/levelgen/placement/PlacementContext.java +++ b/net/minecraft/world/level/levelgen/placement/PlacementContext.java @@ -8,7 +8,6 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.chunk.CarvingMask; import net.minecraft.world.level.chunk.ChunkGenerator; import net.minecraft.world.level.chunk.ProtoChunk; -import net.minecraft.world.level.levelgen.GenerationStep; import net.minecraft.world.level.levelgen.Heightmap; import net.minecraft.world.level.levelgen.WorldGenerationContext; @@ -28,16 +27,16 @@ public class PlacementContext extends WorldGenerationContext { return this.level.getHeight(heightmapType, x, z); } - public CarvingMask getCarvingMask(ChunkPos chunkPos, GenerationStep.Carving step) { - return ((ProtoChunk)this.level.getChunk(chunkPos.x, chunkPos.z)).getOrCreateCarvingMask(step); + public CarvingMask getCarvingMask(ChunkPos chunkPos) { + return ((ProtoChunk)this.level.getChunk(chunkPos.x, chunkPos.z)).getOrCreateCarvingMask(); } public BlockState getBlockState(BlockPos pos) { return this.level.getBlockState(pos); } - public int getMinBuildHeight() { - return this.level.getMinBuildHeight(); + public int getMinY() { + return this.level.getMinY(); } public WorldGenLevel getLevel() { diff --git a/net/minecraft/world/level/levelgen/placement/PlacementModifierType.java b/net/minecraft/world/level/levelgen/placement/PlacementModifierType.java index 296495eb..8e06f995 100644 --- a/net/minecraft/world/level/levelgen/placement/PlacementModifierType.java +++ b/net/minecraft/world/level/levelgen/placement/PlacementModifierType.java @@ -21,7 +21,6 @@ public interface PlacementModifierType

{ PlacementModifierType HEIGHT_RANGE = register("height_range", HeightRangePlacement.CODEC); PlacementModifierType IN_SQUARE = register("in_square", InSquarePlacement.CODEC); PlacementModifierType RANDOM_OFFSET = register("random_offset", RandomOffsetPlacement.CODEC); - PlacementModifierType CARVING_MASK_PLACEMENT = register("carving_mask", CarvingMaskPlacement.CODEC); PlacementModifierType FIXED_PLACEMENT = register("fixed_placement", FixedPlacement.CODEC); MapCodec

codec(); diff --git a/net/minecraft/world/level/levelgen/presets/WorldPresets.java b/net/minecraft/world/level/levelgen/presets/WorldPresets.java index 0ea0f744..c84e7ad1 100644 --- a/net/minecraft/world/level/levelgen/presets/WorldPresets.java +++ b/net/minecraft/world/level/levelgen/presets/WorldPresets.java @@ -4,7 +4,7 @@ import java.util.Map; import java.util.Optional; import net.minecraft.core.Holder; import net.minecraft.core.HolderGetter; -import net.minecraft.core.RegistryAccess; +import net.minecraft.core.HolderLookup; import net.minecraft.core.registries.Registries; import net.minecraft.data.worldgen.BootstrapContext; import net.minecraft.resources.ResourceKey; @@ -57,12 +57,16 @@ public class WorldPresets { }); } - public static WorldDimensions createNormalWorldDimensions(RegistryAccess registry) { - return registry.registryOrThrow(Registries.WORLD_PRESET).getHolderOrThrow(NORMAL).value().createWorldDimensions(); + public static WorldDimensions createNormalWorldDimensions(HolderLookup.Provider provider) { + return provider.lookupOrThrow(Registries.WORLD_PRESET).getOrThrow(NORMAL).value().createWorldDimensions(); } - public static LevelStem getNormalOverworld(RegistryAccess registry) { - return (LevelStem)registry.registryOrThrow(Registries.WORLD_PRESET).getHolderOrThrow(NORMAL).value().overworld().orElseThrow(); + public static LevelStem getNormalOverworld(HolderLookup.Provider provider) { + return (LevelStem)provider.lookupOrThrow(Registries.WORLD_PRESET).getOrThrow(NORMAL).value().overworld().orElseThrow(); + } + + public static WorldDimensions createFlatWorldDimensions(HolderLookup.Provider provider) { + return provider.lookupOrThrow(Registries.WORLD_PRESET).getOrThrow(FLAT).value().createWorldDimensions(); } static class Bootstrap { diff --git a/net/minecraft/world/level/levelgen/structure/LegacyStructureDataHandler.java b/net/minecraft/world/level/levelgen/structure/LegacyStructureDataHandler.java index 8a7a861d..03c4faaf 100644 --- a/net/minecraft/world/level/levelgen/structure/LegacyStructureDataHandler.java +++ b/net/minecraft/world/level/levelgen/structure/LegacyStructureDataHandler.java @@ -85,7 +85,6 @@ public class LegacyStructureDataHandler { StructureFeatureIndexSavedData structureFeatureIndexSavedData = (StructureFeatureIndexSavedData)this.indexMap.get(string); if (structureFeatureIndexSavedData != null && structureFeatureIndexSavedData.hasUnhandledIndex(packedChunkPos)) { structureFeatureIndexSavedData.removeIndex(packedChunkPos); - structureFeatureIndexSavedData.setDirty(); } } } @@ -201,9 +200,7 @@ public class LegacyStructureDataHandler { String string5 = string + "_index"; StructureFeatureIndexSavedData structureFeatureIndexSavedData = storage.computeIfAbsent(StructureFeatureIndexSavedData.factory(), string5); - if (!structureFeatureIndexSavedData.getAll().isEmpty()) { - this.indexMap.put(string, structureFeatureIndexSavedData); - } else { + if (structureFeatureIndexSavedData.getAll().isEmpty()) { StructureFeatureIndexSavedData structureFeatureIndexSavedData2 = new StructureFeatureIndexSavedData(); this.indexMap.put(string, structureFeatureIndexSavedData2); @@ -211,8 +208,8 @@ public class LegacyStructureDataHandler { CompoundTag compoundTag3 = compoundTag.getCompound(string6); structureFeatureIndexSavedData2.addIndex(ChunkPos.asLong(compoundTag3.getInt("ChunkX"), compoundTag3.getInt("ChunkZ"))); } - - structureFeatureIndexSavedData2.setDirty(); + } else { + this.indexMap.put(string, structureFeatureIndexSavedData); } } } diff --git a/net/minecraft/world/level/levelgen/structure/ScatteredFeaturePiece.java b/net/minecraft/world/level/levelgen/structure/ScatteredFeaturePiece.java index c0fb0ab3..23517dcc 100644 --- a/net/minecraft/world/level/levelgen/structure/ScatteredFeaturePiece.java +++ b/net/minecraft/world/level/levelgen/structure/ScatteredFeaturePiece.java @@ -70,7 +70,7 @@ public abstract class ScatteredFeaturePiece extends StructurePiece { if (this.heightPosition >= 0) { return true; } else { - int i = level.getMaxBuildHeight(); + int i = level.getMaxY() + 1; boolean bl = false; BlockPos.MutableBlockPos mutableBlockPos = new BlockPos.MutableBlockPos(); diff --git a/net/minecraft/world/level/levelgen/structure/StructureCheck.java b/net/minecraft/world/level/levelgen/structure/StructureCheck.java index a381f02d..0fc3fa1c 100644 --- a/net/minecraft/world/level/levelgen/structure/StructureCheck.java +++ b/net/minecraft/world/level/levelgen/structure/StructureCheck.java @@ -30,6 +30,7 @@ import net.minecraft.world.level.chunk.ChunkGenerator; import net.minecraft.world.level.chunk.storage.ChunkScanAccess; import net.minecraft.world.level.chunk.storage.ChunkStorage; import net.minecraft.world.level.levelgen.RandomState; +import net.minecraft.world.level.levelgen.structure.Structure.GenerationContext; import net.minecraft.world.level.levelgen.structure.placement.StructurePlacement; import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplateManager; import org.jetbrains.annotations.Nullable; @@ -96,7 +97,7 @@ public class StructureCheck { private boolean canCreateStructure(ChunkPos chunkPos, Structure structure) { return structure.findValidGenerationPoint( - new Structure.GenerationContext( + new GenerationContext( this.registryAccess, this.chunkGenerator, this.biomeSource, @@ -168,12 +169,12 @@ public class StructureCheck { return Object2IntMaps.emptyMap(); } else { Object2IntMap object2IntMap = new Object2IntOpenHashMap<>(); - Registry registry = this.registryAccess.registryOrThrow(Registries.STRUCTURE); + Registry registry = this.registryAccess.lookupOrThrow(Registries.STRUCTURE); for (String string : compoundTag2.getAllKeys()) { ResourceLocation resourceLocation = ResourceLocation.tryParse(string); if (resourceLocation != null) { - Structure structure = registry.get(resourceLocation); + Structure structure = registry.getValue(resourceLocation); if (structure != null) { CompoundTag compoundTag3 = compoundTag2.getCompound(string); if (!compoundTag3.isEmpty()) { diff --git a/net/minecraft/world/level/levelgen/structure/StructureFeatureIndexSavedData.java b/net/minecraft/world/level/levelgen/structure/StructureFeatureIndexSavedData.java index 102cbdbf..06c91de6 100644 --- a/net/minecraft/world/level/levelgen/structure/StructureFeatureIndexSavedData.java +++ b/net/minecraft/world/level/levelgen/structure/StructureFeatureIndexSavedData.java @@ -40,6 +40,7 @@ public class StructureFeatureIndexSavedData extends SavedData { public void addIndex(long index) { this.all.add(index); this.remaining.add(index); + this.setDirty(); } public boolean hasStartIndex(long index) { @@ -51,7 +52,9 @@ public class StructureFeatureIndexSavedData extends SavedData { } public void removeIndex(long index) { - this.remaining.remove(index); + if (this.remaining.remove(index)) { + this.setDirty(); + } } public LongSet getAll() { diff --git a/net/minecraft/world/level/levelgen/structure/StructurePiece.java b/net/minecraft/world/level/levelgen/structure/StructurePiece.java index 9e560d69..2798dbef 100644 --- a/net/minecraft/world/level/levelgen/structure/StructurePiece.java +++ b/net/minecraft/world/level/levelgen/structure/StructurePiece.java @@ -54,6 +54,7 @@ public abstract class StructurePiece { .add(Blocks.OAK_FENCE) .add(Blocks.SPRUCE_FENCE) .add(Blocks.DARK_OAK_FENCE) + .add(Blocks.PALE_OAK_FENCE) .add(Blocks.ACACIA_FENCE) .add(Blocks.BIRCH_FENCE) .add(Blocks.JUNGLE_FENCE) @@ -364,7 +365,7 @@ public abstract class StructurePiece { protected void fillColumnDown(WorldGenLevel level, BlockState state, int x, int y, int z, BoundingBox box) { BlockPos.MutableBlockPos mutableBlockPos = this.getWorldPos(x, y, z); if (box.isInside(mutableBlockPos)) { - while (this.isReplaceableByStructures(level.getBlockState(mutableBlockPos)) && mutableBlockPos.getY() > level.getMinBuildHeight() + 1) { + while (this.isReplaceableByStructures(level.getBlockState(mutableBlockPos)) && mutableBlockPos.getY() > level.getMinY() + 1) { level.setBlock(mutableBlockPos, state, 2); mutableBlockPos.move(Direction.DOWN); } @@ -389,7 +390,7 @@ public abstract class StructurePiece { return state; } - if (blockState.isSolidRender(level, blockPos)) { + if (blockState.isSolidRender()) { if (direction != null) { direction = null; break; @@ -404,17 +405,17 @@ public abstract class StructurePiece { } else { Direction direction3 = state.getValue(HorizontalDirectionalBlock.FACING); BlockPos blockPos2 = pos.relative(direction3); - if (level.getBlockState(blockPos2).isSolidRender(level, blockPos2)) { + if (level.getBlockState(blockPos2).isSolidRender()) { direction3 = direction3.getOpposite(); blockPos2 = pos.relative(direction3); } - if (level.getBlockState(blockPos2).isSolidRender(level, blockPos2)) { + if (level.getBlockState(blockPos2).isSolidRender()) { direction3 = direction3.getClockWise(); blockPos2 = pos.relative(direction3); } - if (level.getBlockState(blockPos2).isSolidRender(level, blockPos2)) { + if (level.getBlockState(blockPos2).isSolidRender()) { direction3 = direction3.getOpposite(); blockPos2 = pos.relative(direction3); } diff --git a/net/minecraft/world/level/levelgen/structure/StructureSpawnOverride.java b/net/minecraft/world/level/levelgen/structure/StructureSpawnOverride.java index 911335ec..2ed15f8d 100644 --- a/net/minecraft/world/level/levelgen/structure/StructureSpawnOverride.java +++ b/net/minecraft/world/level/levelgen/structure/StructureSpawnOverride.java @@ -4,13 +4,13 @@ import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; import net.minecraft.util.StringRepresentable; import net.minecraft.util.random.WeightedRandomList; -import net.minecraft.world.level.biome.MobSpawnSettings; +import net.minecraft.world.level.biome.MobSpawnSettings.SpawnerData; -public record StructureSpawnOverride(StructureSpawnOverride.BoundingBoxType boundingBox, WeightedRandomList spawns) { +public record StructureSpawnOverride(StructureSpawnOverride.BoundingBoxType boundingBox, WeightedRandomList spawns) { public static final Codec CODEC = RecordCodecBuilder.create( instance -> instance.group( StructureSpawnOverride.BoundingBoxType.CODEC.fieldOf("bounding_box").forGetter(StructureSpawnOverride::boundingBox), - WeightedRandomList.codec(MobSpawnSettings.SpawnerData.CODEC).fieldOf("spawns").forGetter(StructureSpawnOverride::spawns) + WeightedRandomList.codec(SpawnerData.CODEC).fieldOf("spawns").forGetter(StructureSpawnOverride::spawns) ) .apply(instance, StructureSpawnOverride::new) ); diff --git a/net/minecraft/world/level/levelgen/structure/StructureStart.java b/net/minecraft/world/level/levelgen/structure/StructureStart.java index 8ee2b496..7437ed7f 100644 --- a/net/minecraft/world/level/levelgen/structure/StructureStart.java +++ b/net/minecraft/world/level/levelgen/structure/StructureStart.java @@ -43,8 +43,8 @@ public final class StructureStart { if ("INVALID".equals(string)) { return INVALID_START; } else { - Registry registry = context.registryAccess().registryOrThrow(Registries.STRUCTURE); - Structure structure = registry.get(ResourceLocation.parse(string)); + Registry registry = context.registryAccess().lookupOrThrow(Registries.STRUCTURE); + Structure structure = registry.getValue(ResourceLocation.parse(string)); if (structure == null) { LOGGER.error("Unknown stucture id: {}", string); return null; @@ -100,7 +100,7 @@ public final class StructureStart { public CompoundTag createTag(StructurePieceSerializationContext context, ChunkPos chunkPos) { CompoundTag compoundTag = new CompoundTag(); if (this.isValid()) { - compoundTag.putString("id", context.registryAccess().registryOrThrow(Registries.STRUCTURE).getKey(this.structure).toString()); + compoundTag.putString("id", context.registryAccess().lookupOrThrow(Registries.STRUCTURE).getKey(this.structure).toString()); compoundTag.putInt("ChunkX", chunkPos.x); compoundTag.putInt("ChunkZ", chunkPos.z); compoundTag.putInt("references", this.references); diff --git a/net/minecraft/world/level/levelgen/structure/pieces/PiecesContainer.java b/net/minecraft/world/level/levelgen/structure/pieces/PiecesContainer.java index 472bd8f2..c866e7e2 100644 --- a/net/minecraft/world/level/levelgen/structure/pieces/PiecesContainer.java +++ b/net/minecraft/world/level/levelgen/structure/pieces/PiecesContainer.java @@ -62,7 +62,7 @@ public record PiecesContainer(List pieces) { String string = compoundTag.getString("id").toLowerCase(Locale.ROOT); ResourceLocation resourceLocation = ResourceLocation.parse(string); ResourceLocation resourceLocation2 = (ResourceLocation)RENAMES.getOrDefault(resourceLocation, resourceLocation); - StructurePieceType structurePieceType = BuiltInRegistries.STRUCTURE_PIECE.get(resourceLocation2); + StructurePieceType structurePieceType = BuiltInRegistries.STRUCTURE_PIECE.getValue(resourceLocation2); if (structurePieceType == null) { LOGGER.error("Unknown structure piece id: {}", resourceLocation2); } else { diff --git a/net/minecraft/world/level/levelgen/structure/pools/EmptyPoolElement.java b/net/minecraft/world/level/levelgen/structure/pools/EmptyPoolElement.java index b5eca1d8..573418de 100644 --- a/net/minecraft/world/level/levelgen/structure/pools/EmptyPoolElement.java +++ b/net/minecraft/world/level/levelgen/structure/pools/EmptyPoolElement.java @@ -30,7 +30,7 @@ public class EmptyPoolElement extends StructurePoolElement { } @Override - public List getShuffledJigsawBlocks( + public List getShuffledJigsawBlocks( StructureTemplateManager structureTemplateManager, BlockPos pos, Rotation rotation, RandomSource random ) { return Collections.emptyList(); diff --git a/net/minecraft/world/level/levelgen/structure/pools/FeaturePoolElement.java b/net/minecraft/world/level/levelgen/structure/pools/FeaturePoolElement.java index 85470916..454eac0e 100644 --- a/net/minecraft/world/level/levelgen/structure/pools/FeaturePoolElement.java +++ b/net/minecraft/world/level/levelgen/structure/pools/FeaturePoolElement.java @@ -1,6 +1,5 @@ package net.minecraft.world.level.levelgen.structure.pools; -import com.google.common.collect.Lists; import com.mojang.serialization.MapCodec; import com.mojang.serialization.codecs.RecordCodecBuilder; import java.util.List; @@ -54,18 +53,18 @@ public class FeaturePoolElement extends StructurePoolElement { } @Override - public List getShuffledJigsawBlocks( + public List getShuffledJigsawBlocks( StructureTemplateManager structureTemplateManager, BlockPos pos, Rotation rotation, RandomSource random ) { - List list = Lists.newArrayList(); - list.add( - new StructureTemplate.StructureBlockInfo( - pos, - Blocks.JIGSAW.defaultBlockState().setValue(JigsawBlock.ORIENTATION, FrontAndTop.fromFrontAndTop(Direction.DOWN, Direction.SOUTH)), - this.defaultJigsawNBT + return List.of( + StructureTemplate.JigsawBlockInfo.of( + new StructureTemplate.StructureBlockInfo( + pos, + Blocks.JIGSAW.defaultBlockState().setValue(JigsawBlock.ORIENTATION, FrontAndTop.fromFrontAndTop(Direction.DOWN, Direction.SOUTH)), + this.defaultJigsawNBT + ) ) ); - return list; } @Override diff --git a/net/minecraft/world/level/levelgen/structure/pools/JigsawPlacement.java b/net/minecraft/world/level/levelgen/structure/pools/JigsawPlacement.java index 397ddf1d..3064e56d 100644 --- a/net/minecraft/world/level/levelgen/structure/pools/JigsawPlacement.java +++ b/net/minecraft/world/level/levelgen/structure/pools/JigsawPlacement.java @@ -3,7 +3,6 @@ package net.minecraft.world.level.levelgen.structure.pools; import com.google.common.collect.Lists; import com.mojang.logging.LogUtils; import java.util.List; -import java.util.Objects; import java.util.Optional; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -13,7 +12,6 @@ import net.minecraft.core.RegistryAccess; import net.minecraft.core.Vec3i; import net.minecraft.core.registries.Registries; import net.minecraft.data.worldgen.Pools; -import net.minecraft.nbt.CompoundTag; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.level.ServerLevel; @@ -30,8 +28,9 @@ import net.minecraft.world.level.levelgen.RandomState; import net.minecraft.world.level.levelgen.WorldgenRandom; import net.minecraft.world.level.levelgen.structure.BoundingBox; import net.minecraft.world.level.levelgen.structure.PoolElementStructurePiece; -import net.minecraft.world.level.levelgen.structure.Structure; import net.minecraft.world.level.levelgen.structure.StructurePiece; +import net.minecraft.world.level.levelgen.structure.Structure.GenerationContext; +import net.minecraft.world.level.levelgen.structure.Structure.GenerationStub; import net.minecraft.world.level.levelgen.structure.pieces.StructurePiecesBuilder; import net.minecraft.world.level.levelgen.structure.pools.alias.PoolAliasLookup; import net.minecraft.world.level.levelgen.structure.structures.JigsawStructure; @@ -47,9 +46,10 @@ import org.slf4j.Logger; public class JigsawPlacement { static final Logger LOGGER = LogUtils.getLogger(); + private static final int UNSET_HEIGHT = Integer.MIN_VALUE; - public static Optional addPieces( - Structure.GenerationContext context, + public static Optional addPieces( + GenerationContext context, Holder startPool, Optional startJigsawName, int maxDepth, @@ -66,7 +66,7 @@ public class JigsawPlacement { StructureTemplateManager structureTemplateManager = context.structureTemplateManager(); LevelHeightAccessor levelHeightAccessor = context.heightAccessor(); WorldgenRandom worldgenRandom = context.random(); - Registry registry = registryAccess.registryOrThrow(Registries.TEMPLATE_POOL); + Registry registry = registryAccess.lookupOrThrow(Registries.TEMPLATE_POOL); Rotation rotation = Rotation.getRandom(worldgenRandom); StructureTemplatePool structureTemplatePool = (StructureTemplatePool)startPool.unwrapKey() .flatMap(resourceKey -> registry.getOptional(aliasLookup.lookup(resourceKey))) @@ -118,7 +118,7 @@ public class JigsawPlacement { poolElementStructurePiece.move(0, k - l, 0); int m = k + vec3i.getY(); return Optional.of( - new Structure.GenerationStub( + new GenerationStub( new BlockPos(i, m, j), structurePiecesBuilder -> { List list = Lists.newArrayList(); @@ -126,10 +126,10 @@ public class JigsawPlacement { if (maxDepth > 0) { AABB aABB = new AABB( i - maxDistanceFromCenter, - Math.max(m - maxDistanceFromCenter, levelHeightAccessor.getMinBuildHeight() + dimensionPadding.bottom()), + Math.max(m - maxDistanceFromCenter, levelHeightAccessor.getMinY() + dimensionPadding.bottom()), j - maxDistanceFromCenter, i + maxDistanceFromCenter + 1, - Math.min(m + maxDistanceFromCenter + 1, levelHeightAccessor.getMaxBuildHeight() - dimensionPadding.top()), + Math.min(m + maxDistanceFromCenter + 1, levelHeightAccessor.getMaxY() + 1 - dimensionPadding.top()), j + maxDistanceFromCenter + 1 ); VoxelShape voxelShape = Shapes.join(Shapes.create(aABB), Shapes.create(AABB.of(boundingBox)), BooleanOp.ONLY_FIRST); @@ -164,20 +164,13 @@ public class JigsawPlacement { StructureTemplateManager structureTemplateManager, WorldgenRandom random ) { - List list = element.getShuffledJigsawBlocks(structureTemplateManager, pos, rotation, random); - Optional optional = Optional.empty(); - - for (StructureTemplate.StructureBlockInfo structureBlockInfo : list) { - ResourceLocation resourceLocation = ResourceLocation.tryParse( - ((CompoundTag)Objects.requireNonNull(structureBlockInfo.nbt(), () -> structureBlockInfo + " nbt was null")).getString("name") - ); - if (startJigsawName.equals(resourceLocation)) { - optional = Optional.of(structureBlockInfo.pos()); - break; + for (StructureTemplate.JigsawBlockInfo jigsawBlockInfo : element.getShuffledJigsawBlocks(structureTemplateManager, pos, rotation, random)) { + if (startJigsawName.equals(jigsawBlockInfo.name())) { + return Optional.of(jigsawBlockInfo.info().pos()); } } - return optional; + return Optional.empty(); } private static void addPieces( @@ -211,7 +204,7 @@ public class JigsawPlacement { StructureTemplateManager structureTemplateManager = level.getStructureManager(); StructureManager structureManager = level.structureManager(); RandomSource randomSource = level.getRandom(); - Structure.GenerationContext generationContext = new Structure.GenerationContext( + GenerationContext generationContext = new GenerationContext( level.registryAccess(), chunkGenerator, chunkGenerator.getBiomeSource(), @@ -222,7 +215,7 @@ public class JigsawPlacement { level, holder -> true ); - Optional optional = addPieces( + Optional optional = addPieces( generationContext, startPool, Optional.of(startJigsawName), @@ -236,7 +229,7 @@ public class JigsawPlacement { JigsawStructure.DEFAULT_LIQUID_SETTINGS ); if (optional.isPresent()) { - StructurePiecesBuilder structurePiecesBuilder = ((Structure.GenerationStub)optional.get()).getPiecesBuilder(); + StructurePiecesBuilder structurePiecesBuilder = ((GenerationStub)optional.get()).getPiecesBuilder(); for (StructurePiece structurePiece : structurePiecesBuilder.build().pieces()) { if (structurePiece instanceof PoolElementStructurePiece poolElementStructurePiece) { @@ -297,17 +290,18 @@ public class JigsawPlacement { BoundingBox boundingBox = piece.getBoundingBox(); int i = boundingBox.minY(); - label134: - for (StructureTemplate.StructureBlockInfo structureBlockInfo : structurePoolElement.getShuffledJigsawBlocks( + label129: + for (StructureTemplate.JigsawBlockInfo jigsawBlockInfo : structurePoolElement.getShuffledJigsawBlocks( this.structureTemplateManager, blockPos, rotation, this.random )) { + StructureTemplate.StructureBlockInfo structureBlockInfo = jigsawBlockInfo.info(); Direction direction = JigsawBlock.getFrontFacing(structureBlockInfo.state()); BlockPos blockPos2 = structureBlockInfo.pos(); BlockPos blockPos3 = blockPos2.relative(direction); int j = blockPos2.getY() - i; - int k = -1; - ResourceKey resourceKey = readPoolKey(structureBlockInfo, poolAliasLookup); - Optional> optional = this.pools.getHolder(resourceKey); + int k = Integer.MIN_VALUE; + ResourceKey resourceKey = readPoolKey(jigsawBlockInfo, poolAliasLookup); + Optional> optional = this.pools.get(resourceKey); if (optional.isEmpty()) { JigsawPlacement.LOGGER.warn("Empty or non-existent pool: {}", resourceKey.location()); } else { @@ -337,7 +331,7 @@ public class JigsawPlacement { } list.addAll(holder2.value().getShuffledTemplates(this.random)); - int l = structureBlockInfo.nbt() != null ? structureBlockInfo.nbt().getInt("placement_priority") : 0; + int l = jigsawBlockInfo.placementPriority(); for (StructurePoolElement structurePoolElement2 : list) { if (structurePoolElement2 == EmptyPoolElement.INSTANCE) { @@ -345,18 +339,19 @@ public class JigsawPlacement { } for (Rotation rotation2 : Rotation.getShuffled(this.random)) { - List list2 = structurePoolElement2.getShuffledJigsawBlocks( + List list2 = structurePoolElement2.getShuffledJigsawBlocks( this.structureTemplateManager, BlockPos.ZERO, rotation2, this.random ); BoundingBox boundingBox2 = structurePoolElement2.getBoundingBox(this.structureTemplateManager, BlockPos.ZERO, rotation2); int m; if (useExpansionHack && boundingBox2.getYSpan() <= 16) { - m = list2.stream().mapToInt(structureBlockInfox -> { + m = list2.stream().mapToInt(jigsawBlockInfox -> { + StructureTemplate.StructureBlockInfo structureBlockInfox = jigsawBlockInfox.info(); if (!boundingBox2.isInside(structureBlockInfox.pos().relative(JigsawBlock.getFrontFacing(structureBlockInfox.state())))) { return 0; } else { - ResourceKey resourceKeyx = readPoolKey(structureBlockInfox, poolAliasLookup); - Optional> optionalx = this.pools.getHolder(resourceKeyx); + ResourceKey resourceKeyx = readPoolKey(jigsawBlockInfox, poolAliasLookup); + Optional> optionalx = this.pools.get(resourceKeyx); Optional> optional2 = optionalx.map(holderx -> ((StructureTemplatePool)holderx.value()).getFallback()); int ix = (Integer)optionalx.map(holderx -> ((StructureTemplatePool)holderx.value()).getMaxSize(this.structureTemplateManager)).orElse(0); int jx = (Integer)optional2.map(holderx -> ((StructureTemplatePool)holderx.value()).getMaxSize(this.structureTemplateManager)).orElse(0); @@ -367,9 +362,9 @@ public class JigsawPlacement { m = 0; } - for (StructureTemplate.StructureBlockInfo structureBlockInfo2 : list2) { - if (JigsawBlock.canAttach(structureBlockInfo, structureBlockInfo2)) { - BlockPos blockPos4 = structureBlockInfo2.pos(); + for (StructureTemplate.JigsawBlockInfo jigsawBlockInfo2 : list2) { + if (JigsawBlock.canAttach(jigsawBlockInfo, jigsawBlockInfo2)) { + BlockPos blockPos4 = jigsawBlockInfo2.info().pos(); BlockPos blockPos5 = blockPos3.subtract(blockPos4); BoundingBox boundingBox3 = structurePoolElement2.getBoundingBox(this.structureTemplateManager, blockPos5, rotation2); int n = boundingBox3.minY(); @@ -381,7 +376,7 @@ public class JigsawPlacement { if (bl && bl3) { q = i + p; } else { - if (k == -1) { + if (k == Integer.MIN_VALUE) { k = this.chunkGenerator.getFirstFreeHeight(blockPos2.getX(), blockPos2.getZ(), Heightmap.Types.WORLD_SURFACE_WG, level, random); } @@ -415,7 +410,7 @@ public class JigsawPlacement { } else if (bl3) { u = q + o; } else { - if (k == -1) { + if (k == Integer.MIN_VALUE) { k = this.chunkGenerator.getFirstFreeHeight(blockPos2.getX(), blockPos2.getZ(), Heightmap.Types.WORLD_SURFACE_WG, level, random); } @@ -429,7 +424,7 @@ public class JigsawPlacement { JigsawPlacement.PieceState pieceState = new JigsawPlacement.PieceState(poolElementStructurePiece, mutableObject2, depth + 1); this.placing.add(pieceState, l); } - continue label134; + continue label129; } } } @@ -441,10 +436,8 @@ public class JigsawPlacement { } } - private static ResourceKey readPoolKey(StructureTemplate.StructureBlockInfo blockInfo, PoolAliasLookup aliasLookup) { - CompoundTag compoundTag = (CompoundTag)Objects.requireNonNull(blockInfo.nbt(), () -> blockInfo + " nbt was null"); - ResourceKey resourceKey = Pools.parseKey(compoundTag.getString("pool")); - return aliasLookup.lookup(resourceKey); + private static ResourceKey readPoolKey(StructureTemplate.JigsawBlockInfo jigsawBlockInfo, PoolAliasLookup poolAliasLookup) { + return poolAliasLookup.lookup(Pools.createKey(jigsawBlockInfo.pool())); } } } diff --git a/net/minecraft/world/level/levelgen/structure/pools/ListPoolElement.java b/net/minecraft/world/level/levelgen/structure/pools/ListPoolElement.java index 6f93dbc1..0bde976b 100644 --- a/net/minecraft/world/level/levelgen/structure/pools/ListPoolElement.java +++ b/net/minecraft/world/level/levelgen/structure/pools/ListPoolElement.java @@ -51,7 +51,7 @@ public class ListPoolElement extends StructurePoolElement { } @Override - public List getShuffledJigsawBlocks( + public List getShuffledJigsawBlocks( StructureTemplateManager structureTemplateManager, BlockPos pos, Rotation rotation, RandomSource random ) { return ((StructurePoolElement)this.elements.get(0)).getShuffledJigsawBlocks(structureTemplateManager, pos, rotation, random); diff --git a/net/minecraft/world/level/levelgen/structure/pools/SinglePoolElement.java b/net/minecraft/world/level/levelgen/structure/pools/SinglePoolElement.java index 363903df..9fd866b7 100644 --- a/net/minecraft/world/level/levelgen/structure/pools/SinglePoolElement.java +++ b/net/minecraft/world/level/levelgen/structure/pools/SinglePoolElement.java @@ -8,12 +8,10 @@ import com.mojang.serialization.DataResult; import com.mojang.serialization.DynamicOps; import com.mojang.serialization.MapCodec; import com.mojang.serialization.codecs.RecordCodecBuilder; -import it.unimi.dsi.fastutil.objects.ObjectArrayList; import java.util.Comparator; import java.util.List; import java.util.Optional; import java.util.function.Function; -import net.minecraft.Optionull; import net.minecraft.Util; import net.minecraft.core.BlockPos; import net.minecraft.core.Holder; @@ -38,6 +36,10 @@ import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemp import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplateManager; public class SinglePoolElement extends StructurePoolElement { + private static final Comparator HIGHEST_SELECTION_PRIORITY_FIRST = Comparator.comparingInt( + StructureTemplate.JigsawBlockInfo::selectionPriority + ) + .reversed(); private static final Codec> TEMPLATE_CODEC = Codec.of( SinglePoolElement::encodeTemplate, ResourceLocation.CODEC.map(Either::left) ); @@ -112,24 +114,18 @@ public class SinglePoolElement extends StructurePoolElement { } @Override - public List getShuffledJigsawBlocks( + public List getShuffledJigsawBlocks( StructureTemplateManager structureTemplateManager, BlockPos pos, Rotation rotation, RandomSource random ) { - StructureTemplate structureTemplate = this.getTemplate(structureTemplateManager); - ObjectArrayList objectArrayList = structureTemplate.filterBlocks( - pos, new StructurePlaceSettings().setRotation(rotation), Blocks.JIGSAW, true - ); - Util.shuffle(objectArrayList, random); - sortBySelectionPriority(objectArrayList); - return objectArrayList; + List list = this.getTemplate(structureTemplateManager).getJigsaws(pos, rotation); + Util.shuffle(list, random); + sortBySelectionPriority(list); + return list; } @VisibleForTesting - static void sortBySelectionPriority(List structureBlockInfos) { - structureBlockInfos.sort( - Comparator.comparingInt(structureBlockInfo -> Optionull.mapOrDefault(structureBlockInfo.nbt(), compoundTag -> compoundTag.getInt("selection_priority"), 0)) - .reversed() - ); + static void sortBySelectionPriority(List structureBlockInfos) { + structureBlockInfos.sort(HIGHEST_SELECTION_PRIORITY_FIRST); } @Override diff --git a/net/minecraft/world/level/levelgen/structure/pools/StructurePoolElement.java b/net/minecraft/world/level/levelgen/structure/pools/StructurePoolElement.java index 5468f7f0..f650b13c 100644 --- a/net/minecraft/world/level/levelgen/structure/pools/StructurePoolElement.java +++ b/net/minecraft/world/level/levelgen/structure/pools/StructurePoolElement.java @@ -44,7 +44,7 @@ public abstract class StructurePoolElement { public abstract Vec3i getSize(StructureTemplateManager structureTemplateManager, Rotation rotation); - public abstract List getShuffledJigsawBlocks( + public abstract List getShuffledJigsawBlocks( StructureTemplateManager structureTemplateManager, BlockPos pos, Rotation rotation, RandomSource random ); diff --git a/net/minecraft/world/level/levelgen/structure/pools/alias/PoolAliasLookup.java b/net/minecraft/world/level/levelgen/structure/pools/alias/PoolAliasLookup.java index 65dd36aa..65fb1e0f 100644 --- a/net/minecraft/world/level/levelgen/structure/pools/alias/PoolAliasLookup.java +++ b/net/minecraft/world/level/levelgen/structure/pools/alias/PoolAliasLookup.java @@ -25,7 +25,7 @@ public interface PoolAliasLookup { list.forEach(poolAliasBinding -> poolAliasBinding.forEachResolved(randomSource, builder::put)); Map, ResourceKey> map = builder.build(); return resourceKey -> (ResourceKey)Objects.requireNonNull( - (ResourceKey)map.getOrDefault(resourceKey, resourceKey), () -> "alias " + resourceKey + " was mapped to null value" + (ResourceKey)map.getOrDefault(resourceKey, resourceKey), () -> "alias " + resourceKey.location() + " was mapped to null value" ); } } diff --git a/net/minecraft/world/level/levelgen/structure/structures/BuriedTreasurePieces.java b/net/minecraft/world/level/levelgen/structure/structures/BuriedTreasurePieces.java index e5802402..205f59a4 100644 --- a/net/minecraft/world/level/levelgen/structure/structures/BuriedTreasurePieces.java +++ b/net/minecraft/world/level/levelgen/structure/structures/BuriedTreasurePieces.java @@ -38,7 +38,7 @@ public class BuriedTreasurePieces { int i = level.getHeight(Heightmap.Types.OCEAN_FLOOR_WG, this.boundingBox.minX(), this.boundingBox.minZ()); BlockPos.MutableBlockPos mutableBlockPos = new BlockPos.MutableBlockPos(this.boundingBox.minX(), i, this.boundingBox.minZ()); - while (mutableBlockPos.getY() > level.getMinBuildHeight()) { + while (mutableBlockPos.getY() > level.getMinY()) { BlockState blockState = level.getBlockState(mutableBlockPos); BlockState blockState2 = level.getBlockState(mutableBlockPos.below()); if (blockState2 == Blocks.SANDSTONE.defaultBlockState() diff --git a/net/minecraft/world/level/levelgen/structure/structures/EndCityPieces.java b/net/minecraft/world/level/levelgen/structure/structures/EndCityPieces.java index 1eac2271..24db14bd 100644 --- a/net/minecraft/world/level/levelgen/structure/structures/EndCityPieces.java +++ b/net/minecraft/world/level/levelgen/structure/structures/EndCityPieces.java @@ -9,6 +9,7 @@ import net.minecraft.resources.ResourceLocation; import net.minecraft.util.RandomSource; import net.minecraft.util.Tuple; import net.minecraft.world.RandomizableContainer; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.decoration.ItemFrame; import net.minecraft.world.entity.monster.Shulker; @@ -370,7 +371,7 @@ public class EndCityPieces { } } else if (box.isInside(pos) && Level.isInSpawnableBounds(pos)) { if (name.startsWith("Sentry")) { - Shulker shulker = EntityType.SHULKER.create(level.getLevel()); + Shulker shulker = EntityType.SHULKER.create(level.getLevel(), EntitySpawnReason.STRUCTURE); if (shulker != null) { shulker.setPos(pos.getX() + 0.5, pos.getY(), pos.getZ() + 0.5); level.addFreshEntity(shulker); diff --git a/net/minecraft/world/level/levelgen/structure/structures/MineshaftPieces.java b/net/minecraft/world/level/levelgen/structure/structures/MineshaftPieces.java index 1a037955..62ecb4c9 100644 --- a/net/minecraft/world/level/levelgen/structure/structures/MineshaftPieces.java +++ b/net/minecraft/world/level/levelgen/structure/structures/MineshaftPieces.java @@ -10,6 +10,7 @@ import net.minecraft.nbt.NbtOps; import net.minecraft.resources.ResourceKey; import net.minecraft.tags.BiomeTags; import net.minecraft.util.RandomSource; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.vehicle.MinecartChest; import net.minecraft.world.level.BlockGetter; @@ -245,9 +246,13 @@ public class MineshaftPieces { if (box.isInside(blockPos) && level.getBlockState(blockPos).isAir() && !level.getBlockState(blockPos.below()).isAir()) { BlockState blockState = Blocks.RAIL.defaultBlockState().setValue(RailBlock.SHAPE, random.nextBoolean() ? RailShape.NORTH_SOUTH : RailShape.EAST_WEST); this.placeBlock(level, blockState, x, y, z, box); - MinecartChest minecartChest = new MinecartChest(level.getLevel(), blockPos.getX() + 0.5, blockPos.getY() + 0.5, blockPos.getZ() + 0.5); - minecartChest.setLootTable(lootTable, random.nextLong()); - level.addFreshEntity(minecartChest); + MinecartChest minecartChest = EntityType.CHEST_MINECART.create(level.getLevel(), EntitySpawnReason.CHUNK_GENERATION); + if (minecartChest != null) { + minecartChest.setInitialPos(blockPos.getX() + 0.5, blockPos.getY() + 0.5, blockPos.getZ() + 0.5); + minecartChest.setLootTable(lootTable, random.nextLong()); + level.addFreshEntity(minecartChest); + } + return true; } else { return false; @@ -322,7 +327,7 @@ public class MineshaftPieces { for (int p = 0; p <= m; p++) { BlockState blockState3 = this.getBlock(level, 1, -1, p, box); - if (!blockState3.isAir() && blockState3.isSolidRender(level, this.getWorldPos(1, -1, p))) { + if (!blockState3.isAir() && blockState3.isSolidRender()) { float f = this.isInterior(level, 1, 0, p, box) ? 0.7F : 0.9F; this.maybeGenerateBlock(level, box, random, f, 1, 0, p, blockState2); } @@ -349,7 +354,7 @@ public class MineshaftPieces { if (box.isInside(mutableBlockPos)) { int i = mutableBlockPos.getY(); - while (this.isReplaceableByStructures(level.getBlockState(mutableBlockPos)) && mutableBlockPos.getY() > level.getMinBuildHeight() + 1) { + while (this.isReplaceableByStructures(level.getBlockState(mutableBlockPos)) && mutableBlockPos.getY() > level.getMinY() + 1) { mutableBlockPos.move(Direction.DOWN); } @@ -379,7 +384,7 @@ public class MineshaftPieces { return; } - bl = j <= 20 && bl3 && mutableBlockPos.getY() > level.getMinBuildHeight() + 1; + bl = j <= 20 && bl3 && mutableBlockPos.getY() > level.getMinY() + 1; } if (bl2) { @@ -392,7 +397,7 @@ public class MineshaftPieces { return; } - bl2 = j <= 50 && bl3 && mutableBlockPos.getY() < level.getMaxBuildHeight() - 1; + bl2 = j <= 50 && bl3 && mutableBlockPos.getY() < level.getMaxY(); } } } diff --git a/net/minecraft/world/level/levelgen/structure/structures/MineshaftStructure.java b/net/minecraft/world/level/levelgen/structure/structures/MineshaftStructure.java index e06076cc..85fdeaea 100644 --- a/net/minecraft/world/level/levelgen/structure/structures/MineshaftStructure.java +++ b/net/minecraft/world/level/levelgen/structure/structures/MineshaftStructure.java @@ -10,6 +10,7 @@ import net.minecraft.core.BlockPos; import net.minecraft.util.ByIdMap; import net.minecraft.util.Mth; import net.minecraft.util.StringRepresentable; +import net.minecraft.util.ByIdMap.OutOfBoundsStrategy; import net.minecraft.world.level.ChunkPos; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; @@ -19,6 +20,9 @@ import net.minecraft.world.level.levelgen.Heightmap; import net.minecraft.world.level.levelgen.WorldgenRandom; import net.minecraft.world.level.levelgen.structure.Structure; import net.minecraft.world.level.levelgen.structure.StructureType; +import net.minecraft.world.level.levelgen.structure.Structure.GenerationContext; +import net.minecraft.world.level.levelgen.structure.Structure.GenerationStub; +import net.minecraft.world.level.levelgen.structure.Structure.StructureSettings; import net.minecraft.world.level.levelgen.structure.pieces.StructurePiecesBuilder; public class MineshaftStructure extends Structure { @@ -30,22 +34,22 @@ public class MineshaftStructure extends Structure { ); private final MineshaftStructure.Type type; - public MineshaftStructure(Structure.StructureSettings settings, MineshaftStructure.Type type) { + public MineshaftStructure(StructureSettings settings, MineshaftStructure.Type type) { super(settings); this.type = type; } @Override - public Optional findGenerationPoint(Structure.GenerationContext context) { + public Optional findGenerationPoint(GenerationContext context) { context.random().nextDouble(); ChunkPos chunkPos = context.chunkPos(); BlockPos blockPos = new BlockPos(chunkPos.getMiddleBlockX(), 50, chunkPos.getMinBlockZ()); StructurePiecesBuilder structurePiecesBuilder = new StructurePiecesBuilder(); int i = this.generatePiecesAndAdjust(structurePiecesBuilder, context); - return Optional.of(new Structure.GenerationStub(blockPos.offset(0, i, 0), Either.right(structurePiecesBuilder))); + return Optional.of(new GenerationStub(blockPos.offset(0, i, 0), Either.right(structurePiecesBuilder))); } - private int generatePiecesAndAdjust(StructurePiecesBuilder builder, Structure.GenerationContext context) { + private int generatePiecesAndAdjust(StructurePiecesBuilder builder, GenerationContext context) { ChunkPos chunkPos = context.chunkPos(); WorldgenRandom worldgenRandom = context.random(); ChunkGenerator chunkGenerator = context.chunkGenerator(); @@ -75,7 +79,7 @@ public class MineshaftStructure extends Structure { MESA("mesa", Blocks.DARK_OAK_LOG, Blocks.DARK_OAK_PLANKS, Blocks.DARK_OAK_FENCE); public static final Codec CODEC = StringRepresentable.fromEnum(MineshaftStructure.Type::values); - private static final IntFunction BY_ID = ByIdMap.continuous(Enum::ordinal, values(), ByIdMap.OutOfBoundsStrategy.ZERO); + private static final IntFunction BY_ID = ByIdMap.continuous(Enum::ordinal, values(), OutOfBoundsStrategy.ZERO); private final String name; private final BlockState woodState; private final BlockState planksState; diff --git a/net/minecraft/world/level/levelgen/structure/structures/OceanMonumentPieces.java b/net/minecraft/world/level/levelgen/structure/structures/OceanMonumentPieces.java index 592ed22b..a363fa15 100644 --- a/net/minecraft/world/level/levelgen/structure/structures/OceanMonumentPieces.java +++ b/net/minecraft/world/level/levelgen/structure/structures/OceanMonumentPieces.java @@ -10,8 +10,8 @@ import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.nbt.CompoundTag; import net.minecraft.util.RandomSource; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; -import net.minecraft.world.entity.MobSpawnType; import net.minecraft.world.entity.monster.ElderGuardian; import net.minecraft.world.level.ChunkPos; import net.minecraft.world.level.StructureManager; @@ -1480,11 +1480,11 @@ public class OceanMonumentPieces { protected void spawnElder(WorldGenLevel level, BoundingBox box, int x, int y, int z) { BlockPos blockPos = this.getWorldPos(x, y, z); if (box.isInside(blockPos)) { - ElderGuardian elderGuardian = EntityType.ELDER_GUARDIAN.create(level.getLevel()); + ElderGuardian elderGuardian = EntityType.ELDER_GUARDIAN.create(level.getLevel(), EntitySpawnReason.STRUCTURE); if (elderGuardian != null) { elderGuardian.heal(elderGuardian.getMaxHealth()); elderGuardian.moveTo(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5, 0.0F, 0.0F); - elderGuardian.finalizeSpawn(level, level.getCurrentDifficultyAt(elderGuardian.blockPosition()), MobSpawnType.STRUCTURE, null); + elderGuardian.finalizeSpawn(level, level.getCurrentDifficultyAt(elderGuardian.blockPosition()), EntitySpawnReason.STRUCTURE, null); level.addFreshEntityWithPassengers(elderGuardian); } } diff --git a/net/minecraft/world/level/levelgen/structure/structures/OceanRuinPieces.java b/net/minecraft/world/level/levelgen/structure/structures/OceanRuinPieces.java index 6a38abbd..5fd832bf 100644 --- a/net/minecraft/world/level/levelgen/structure/structures/OceanRuinPieces.java +++ b/net/minecraft/world/level/levelgen/structure/structures/OceanRuinPieces.java @@ -12,8 +12,8 @@ import net.minecraft.tags.FluidTags; import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; import net.minecraft.util.valueproviders.ConstantInt; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; -import net.minecraft.world.entity.MobSpawnType; import net.minecraft.world.entity.monster.Drowned; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.ChunkPos; @@ -311,11 +311,11 @@ public class OceanRuinPieces { .setLootTable(this.isLarge ? BuiltInLootTables.UNDERWATER_RUIN_BIG : BuiltInLootTables.UNDERWATER_RUIN_SMALL, random.nextLong()); } } else if ("drowned".equals(name)) { - Drowned drowned = EntityType.DROWNED.create(level.getLevel()); + Drowned drowned = EntityType.DROWNED.create(level.getLevel(), EntitySpawnReason.STRUCTURE); if (drowned != null) { drowned.setPersistenceRequired(); drowned.moveTo(pos, 0.0F, 0.0F); - drowned.finalizeSpawn(level, level.getCurrentDifficultyAt(pos), MobSpawnType.STRUCTURE, null); + drowned.finalizeSpawn(level, level.getCurrentDifficultyAt(pos), EntitySpawnReason.STRUCTURE, null); level.addFreshEntityWithPassengers(drowned); if (pos.getY() > level.getSeaLevel()) { level.setBlock(pos, Blocks.AIR.defaultBlockState(), 2); @@ -354,7 +354,7 @@ public class OceanRuinPieces { BlockState blockState = level.getBlockState(mutableBlockPos); for (FluidState fluidState = level.getFluidState(mutableBlockPos); - (blockState.isAir() || fluidState.is(FluidTags.WATER) || blockState.is(BlockTags.ICE)) && o > level.getMinBuildHeight() + 1; + (blockState.isAir() || fluidState.is(FluidTags.WATER) || blockState.is(BlockTags.ICE)) && o > level.getMinY() + 1; fluidState = level.getFluidState(mutableBlockPos) ) { mutableBlockPos.set(m, --o, n); diff --git a/net/minecraft/world/level/levelgen/structure/structures/OceanRuinStructure.java b/net/minecraft/world/level/levelgen/structure/structures/OceanRuinStructure.java index 6a3da196..f924e39b 100644 --- a/net/minecraft/world/level/levelgen/structure/structures/OceanRuinStructure.java +++ b/net/minecraft/world/level/levelgen/structure/structures/OceanRuinStructure.java @@ -10,6 +10,9 @@ import net.minecraft.world.level.block.Rotation; import net.minecraft.world.level.levelgen.Heightmap; import net.minecraft.world.level.levelgen.structure.Structure; import net.minecraft.world.level.levelgen.structure.StructureType; +import net.minecraft.world.level.levelgen.structure.Structure.GenerationContext; +import net.minecraft.world.level.levelgen.structure.Structure.GenerationStub; +import net.minecraft.world.level.levelgen.structure.Structure.StructureSettings; import net.minecraft.world.level.levelgen.structure.pieces.StructurePiecesBuilder; public class OceanRuinStructure extends Structure { @@ -26,7 +29,7 @@ public class OceanRuinStructure extends Structure { public final float largeProbability; public final float clusterProbability; - public OceanRuinStructure(Structure.StructureSettings settings, OceanRuinStructure.Type biomeTemp, float largeProbability, float clusterProbability) { + public OceanRuinStructure(StructureSettings settings, OceanRuinStructure.Type biomeTemp, float largeProbability, float clusterProbability) { super(settings); this.biomeTemp = biomeTemp; this.largeProbability = largeProbability; @@ -34,11 +37,11 @@ public class OceanRuinStructure extends Structure { } @Override - public Optional findGenerationPoint(Structure.GenerationContext context) { + public Optional findGenerationPoint(GenerationContext context) { return onTopOfChunkCenter(context, Heightmap.Types.OCEAN_FLOOR_WG, structurePiecesBuilder -> this.generatePieces(structurePiecesBuilder, context)); } - private void generatePieces(StructurePiecesBuilder builder, Structure.GenerationContext context) { + private void generatePieces(StructurePiecesBuilder builder, GenerationContext context) { BlockPos blockPos = new BlockPos(context.chunkPos().getMinBlockX(), 90, context.chunkPos().getMinBlockZ()); Rotation rotation = Rotation.getRandom(context.random()); OceanRuinPieces.addPieces(context.structureTemplateManager(), blockPos, rotation, builder, context.random(), this); diff --git a/net/minecraft/world/level/levelgen/structure/structures/RuinedPortalStructure.java b/net/minecraft/world/level/levelgen/structure/structures/RuinedPortalStructure.java index 3220d543..08b079e4 100644 --- a/net/minecraft/world/level/levelgen/structure/structures/RuinedPortalStructure.java +++ b/net/minecraft/world/level/levelgen/structure/structures/RuinedPortalStructure.java @@ -28,6 +28,9 @@ import net.minecraft.world.level.levelgen.WorldgenRandom; import net.minecraft.world.level.levelgen.structure.BoundingBox; import net.minecraft.world.level.levelgen.structure.Structure; import net.minecraft.world.level.levelgen.structure.StructureType; +import net.minecraft.world.level.levelgen.structure.Structure.GenerationContext; +import net.minecraft.world.level.levelgen.structure.Structure.GenerationStub; +import net.minecraft.world.level.levelgen.structure.Structure.StructureSettings; import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate; public class RuinedPortalStructure extends Structure { @@ -57,17 +60,17 @@ public class RuinedPortalStructure extends Structure { .apply(instance, RuinedPortalStructure::new) ); - public RuinedPortalStructure(Structure.StructureSettings settings, List setups) { + public RuinedPortalStructure(StructureSettings settings, List setups) { super(settings); this.setups = setups; } - public RuinedPortalStructure(Structure.StructureSettings settings, RuinedPortalStructure.Setup setup) { + public RuinedPortalStructure(StructureSettings settings, RuinedPortalStructure.Setup setup) { this(settings, List.of(setup)); } @Override - public Optional findGenerationPoint(Structure.GenerationContext context) { + public Optional findGenerationPoint(GenerationContext context) { RuinedPortalPiece.Properties properties = new RuinedPortalPiece.Properties(); WorldgenRandom worldgenRandom = context.random(); RuinedPortalStructure.Setup setup = null; @@ -126,7 +129,7 @@ public class RuinedPortalStructure extends Structure { ); BlockPos blockPos4 = new BlockPos(blockPos2.getX(), j, blockPos2.getZ()); return Optional.of( - new Structure.GenerationStub( + new GenerationStub( blockPos4, structurePiecesBuilder -> { if (setup4.canBeCold()) { @@ -134,7 +137,8 @@ public class RuinedPortalStructure extends Structure { blockPos4, context.chunkGenerator() .getBiomeSource() - .getNoiseBiome(QuartPos.fromBlock(blockPos4.getX()), QuartPos.fromBlock(blockPos4.getY()), QuartPos.fromBlock(blockPos4.getZ()), randomState.sampler()) + .getNoiseBiome(QuartPos.fromBlock(blockPos4.getX()), QuartPos.fromBlock(blockPos4.getY()), QuartPos.fromBlock(blockPos4.getZ()), randomState.sampler()), + chunkGenerator.getSeaLevel() ); } @@ -157,8 +161,8 @@ public class RuinedPortalStructure extends Structure { } } - private static boolean isCold(BlockPos pos, Holder biome) { - return biome.value().coldEnoughToSnow(pos); + private static boolean isCold(BlockPos blockPos, Holder holder, int i) { + return holder.value().coldEnoughToSnow(blockPos, i); } private static int findSuitableY( @@ -172,7 +176,7 @@ public class RuinedPortalStructure extends Structure { LevelHeightAccessor level, RandomState randomState ) { - int i = level.getMinBuildHeight() + 15; + int i = level.getMinY() + 15; int j; if (verticalPlacement == RuinedPortalPiece.VerticalPlacement.IN_NETHER) { if (airPocket) { diff --git a/net/minecraft/world/level/levelgen/structure/structures/ShipwreckPieces.java b/net/minecraft/world/level/levelgen/structure/structures/ShipwreckPieces.java index 313c500f..cd643b42 100644 --- a/net/minecraft/world/level/levelgen/structure/structures/ShipwreckPieces.java +++ b/net/minecraft/world/level/levelgen/structure/structures/ShipwreckPieces.java @@ -122,7 +122,7 @@ public class ShipwreckPieces { if (this.isTooBigToFitInWorldGenRegion()) { super.postProcess(level, structureManager, generator, random, box, chunkPos, pos); } else { - int i = level.getMaxBuildHeight(); + int i = level.getMaxY() + 1; int j = 0; Vec3i vec3i = this.template.getSize(); Heightmap.Types types = this.isBeached ? Heightmap.Types.WORLD_SURFACE_WG : Heightmap.Types.OCEAN_FLOOR_WG; diff --git a/net/minecraft/world/level/levelgen/structure/structures/StrongholdPieces.java b/net/minecraft/world/level/levelgen/structure/structures/StrongholdPieces.java index 5a825149..9add4bfb 100644 --- a/net/minecraft/world/level/levelgen/structure/structures/StrongholdPieces.java +++ b/net/minecraft/world/level/levelgen/structure/structures/StrongholdPieces.java @@ -30,6 +30,7 @@ import net.minecraft.world.level.levelgen.structure.StructurePiece; import net.minecraft.world.level.levelgen.structure.StructurePieceAccessor; import net.minecraft.world.level.levelgen.structure.pieces.StructurePieceSerializationContext; import net.minecraft.world.level.levelgen.structure.pieces.StructurePieceType; +import net.minecraft.world.level.levelgen.structure.structures.StrongholdPieces.StrongholdPiece.SmallDoorType; import net.minecraft.world.level.storage.loot.BuiltInLootTables; import org.jetbrains.annotations.Nullable; @@ -239,7 +240,7 @@ public class StrongholdPieces { ) { this.generateBox(level, box, 0, 0, 0, 4, 4, 6, true, random, StrongholdPieces.SMOOTH_STONE_SELECTOR); this.generateSmallDoor(level, random, box, this.entryDoor, 1, 1, 0); - this.generateSmallDoor(level, random, box, StrongholdPieces.StrongholdPiece.SmallDoorType.OPENING, 1, 1, 6); + this.generateSmallDoor(level, random, box, SmallDoorType.OPENING, 1, 1, 6); this.generateBox(level, box, 3, 1, 2, 3, 1, 4, Blocks.STONE_BRICKS.defaultBlockState(), Blocks.STONE_BRICKS.defaultBlockState(), false); this.placeBlock(level, Blocks.STONE_BRICK_SLAB.defaultBlockState(), 3, 1, 1, box); this.placeBlock(level, Blocks.STONE_BRICK_SLAB.defaultBlockState(), 3, 1, 5, box); @@ -702,7 +703,7 @@ public class StrongholdPieces { WorldGenLevel level, StructureManager structureManager, ChunkGenerator generator, RandomSource random, BoundingBox box, ChunkPos chunkPos, BlockPos pos ) { this.generateBox(level, box, 0, 0, 0, 10, 7, 15, false, random, StrongholdPieces.SMOOTH_STONE_SELECTOR); - this.generateSmallDoor(level, random, box, StrongholdPieces.StrongholdPiece.SmallDoorType.GRATES, 4, 1, 0); + this.generateSmallDoor(level, random, box, SmallDoorType.GRATES, 4, 1, 0); int i = 6; this.generateBox(level, box, 1, 6, 1, 1, 6, 14, false, random, StrongholdPieces.SMOOTH_STONE_SELECTOR); this.generateBox(level, box, 9, 6, 1, 9, 6, 14, false, random, StrongholdPieces.SMOOTH_STONE_SELECTOR); @@ -1061,7 +1062,7 @@ public class StrongholdPieces { super(type, genDepth, makeBoundingBox(x, 64, z, orientation, 5, 11, 5)); this.isSource = true; this.setOrientation(orientation); - this.entryDoor = StrongholdPieces.StrongholdPiece.SmallDoorType.OPENING; + this.entryDoor = SmallDoorType.OPENING; } public StairsDown(int genDepth, RandomSource random, BoundingBox box, Direction orientation) { @@ -1110,7 +1111,7 @@ public class StrongholdPieces { ) { this.generateBox(level, box, 0, 0, 0, 4, 10, 4, true, random, StrongholdPieces.SMOOTH_STONE_SELECTOR); this.generateSmallDoor(level, random, box, this.entryDoor, 1, 7, 0); - this.generateSmallDoor(level, random, box, StrongholdPieces.StrongholdPiece.SmallDoorType.OPENING, 1, 1, 4); + this.generateSmallDoor(level, random, box, SmallDoorType.OPENING, 1, 1, 4); this.placeBlock(level, Blocks.STONE_BRICKS.defaultBlockState(), 2, 6, 1, box); this.placeBlock(level, Blocks.STONE_BRICKS.defaultBlockState(), 1, 5, 1, box); this.placeBlock(level, Blocks.SMOOTH_STONE_SLAB.defaultBlockState(), 1, 6, 1, box); @@ -1206,7 +1207,7 @@ public class StrongholdPieces { ) { this.generateBox(level, box, 0, 0, 0, 4, 4, 6, true, random, StrongholdPieces.SMOOTH_STONE_SELECTOR); this.generateSmallDoor(level, random, box, this.entryDoor, 1, 1, 0); - this.generateSmallDoor(level, random, box, StrongholdPieces.StrongholdPiece.SmallDoorType.OPENING, 1, 1, 6); + this.generateSmallDoor(level, random, box, SmallDoorType.OPENING, 1, 1, 6); BlockState blockState = Blocks.WALL_TORCH.defaultBlockState().setValue(WallTorchBlock.FACING, Direction.EAST); BlockState blockState2 = Blocks.WALL_TORCH.defaultBlockState().setValue(WallTorchBlock.FACING, Direction.WEST); this.maybeGenerateBlock(level, box, random, 0.1F, 1, 2, 1, blockState); @@ -1258,7 +1259,7 @@ public class StrongholdPieces { ) { this.generateBox(level, box, 0, 0, 0, 4, 10, 7, true, random, StrongholdPieces.SMOOTH_STONE_SELECTOR); this.generateSmallDoor(level, random, box, this.entryDoor, 1, 7, 0); - this.generateSmallDoor(level, random, box, StrongholdPieces.StrongholdPiece.SmallDoorType.OPENING, 1, 1, 7); + this.generateSmallDoor(level, random, box, SmallDoorType.OPENING, 1, 1, 7); BlockState blockState = Blocks.COBBLESTONE_STAIRS.defaultBlockState().setValue(StairBlock.FACING, Direction.SOUTH); for (int i = 0; i < 6; i++) { @@ -1275,7 +1276,7 @@ public class StrongholdPieces { } abstract static class StrongholdPiece extends StructurePiece { - protected StrongholdPieces.StrongholdPiece.SmallDoorType entryDoor = StrongholdPieces.StrongholdPiece.SmallDoorType.OPENING; + protected SmallDoorType entryDoor = SmallDoorType.OPENING; protected StrongholdPiece(StructurePieceType type, int genDepth, BoundingBox boundingBox) { super(type, genDepth, boundingBox); @@ -1283,7 +1284,7 @@ public class StrongholdPieces { public StrongholdPiece(StructurePieceType type, CompoundTag tag) { super(type, tag); - this.entryDoor = StrongholdPieces.StrongholdPiece.SmallDoorType.valueOf(tag.getString("EntryDoor")); + this.entryDoor = SmallDoorType.valueOf(tag.getString("EntryDoor")); } @Override @@ -1291,14 +1292,14 @@ public class StrongholdPieces { tag.putString("EntryDoor", this.entryDoor.name()); } - protected void generateSmallDoor( - WorldGenLevel level, RandomSource random, BoundingBox box, StrongholdPieces.StrongholdPiece.SmallDoorType type, int x, int y, int z - ) { - switch (type) { - case OPENING: + // $VF: Unable to simplify switch-on-enum, as the enum class was not able to be found. + // Please report this to the Vineflower issue tracker, at https://github.com/Vineflower/vineflower/issues with a copy of the class file (if you have the rights to distribute it!) + protected void generateSmallDoor(WorldGenLevel level, RandomSource random, BoundingBox box, SmallDoorType type, int x, int y, int z) { + switch (type.ordinal()) { + case 0: this.generateBox(level, box, x, y, z, x + 3 - 1, y + 3 - 1, z, CAVE_AIR, CAVE_AIR, false); break; - case WOOD_DOOR: + case 1: this.placeBlock(level, Blocks.STONE_BRICKS.defaultBlockState(), x, y, z, box); this.placeBlock(level, Blocks.STONE_BRICKS.defaultBlockState(), x, y + 1, z, box); this.placeBlock(level, Blocks.STONE_BRICKS.defaultBlockState(), x, y + 2, z, box); @@ -1309,7 +1310,7 @@ public class StrongholdPieces { this.placeBlock(level, Blocks.OAK_DOOR.defaultBlockState(), x + 1, y, z, box); this.placeBlock(level, Blocks.OAK_DOOR.defaultBlockState().setValue(DoorBlock.HALF, DoubleBlockHalf.UPPER), x + 1, y + 1, z, box); break; - case GRATES: + case 2: this.placeBlock(level, Blocks.CAVE_AIR.defaultBlockState(), x + 1, y, z, box); this.placeBlock(level, Blocks.CAVE_AIR.defaultBlockState(), x + 1, y + 1, z, box); this.placeBlock(level, Blocks.IRON_BARS.defaultBlockState().setValue(IronBarsBlock.WEST, true), x, y, z, box); @@ -1320,7 +1321,7 @@ public class StrongholdPieces { this.placeBlock(level, Blocks.IRON_BARS.defaultBlockState().setValue(IronBarsBlock.EAST, true), x + 2, y + 1, z, box); this.placeBlock(level, Blocks.IRON_BARS.defaultBlockState().setValue(IronBarsBlock.EAST, true), x + 2, y, z, box); break; - case IRON_DOOR: + case 3: this.placeBlock(level, Blocks.STONE_BRICKS.defaultBlockState(), x, y, z, box); this.placeBlock(level, Blocks.STONE_BRICKS.defaultBlockState(), x, y + 1, z, box); this.placeBlock(level, Blocks.STONE_BRICKS.defaultBlockState(), x, y + 2, z, box); @@ -1335,19 +1336,19 @@ public class StrongholdPieces { } } - protected StrongholdPieces.StrongholdPiece.SmallDoorType randomSmallDoor(RandomSource random) { + protected SmallDoorType randomSmallDoor(RandomSource random) { int i = random.nextInt(5); switch (i) { case 0: case 1: default: - return StrongholdPieces.StrongholdPiece.SmallDoorType.OPENING; + return SmallDoorType.OPENING; case 2: - return StrongholdPieces.StrongholdPiece.SmallDoorType.WOOD_DOOR; + return SmallDoorType.WOOD_DOOR; case 3: - return StrongholdPieces.StrongholdPiece.SmallDoorType.GRATES; + return SmallDoorType.GRATES; case 4: - return StrongholdPieces.StrongholdPiece.SmallDoorType.IRON_DOOR; + return SmallDoorType.IRON_DOOR; } } @@ -1525,13 +1526,6 @@ public class StrongholdPieces { protected static boolean isOkBox(BoundingBox box) { return box != null && box.minY() > 10; } - - protected static enum SmallDoorType { - OPENING, - WOOD_DOOR, - GRATES, - IRON_DOOR; - } } public abstract static class Turn extends StrongholdPieces.StrongholdPiece { diff --git a/net/minecraft/world/level/levelgen/structure/structures/SwampHutPiece.java b/net/minecraft/world/level/levelgen/structure/structures/SwampHutPiece.java index da66cb2b..77a64a60 100644 --- a/net/minecraft/world/level/levelgen/structure/structures/SwampHutPiece.java +++ b/net/minecraft/world/level/levelgen/structure/structures/SwampHutPiece.java @@ -4,8 +4,8 @@ import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.nbt.CompoundTag; import net.minecraft.util.RandomSource; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; -import net.minecraft.world.entity.MobSpawnType; import net.minecraft.world.entity.animal.Cat; import net.minecraft.world.entity.monster.Witch; import net.minecraft.world.level.ChunkPos; @@ -92,11 +92,11 @@ public class SwampHutPiece extends ScatteredFeaturePiece { BlockPos blockPos = this.getWorldPos(2, 2, 5); if (box.isInside(blockPos)) { this.spawnedWitch = true; - Witch witch = EntityType.WITCH.create(level.getLevel()); + Witch witch = EntityType.WITCH.create(level.getLevel(), EntitySpawnReason.STRUCTURE); if (witch != null) { witch.setPersistenceRequired(); witch.moveTo(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5, 0.0F, 0.0F); - witch.finalizeSpawn(level, level.getCurrentDifficultyAt(blockPos), MobSpawnType.STRUCTURE, null); + witch.finalizeSpawn(level, level.getCurrentDifficultyAt(blockPos), EntitySpawnReason.STRUCTURE, null); level.addFreshEntityWithPassengers(witch); } } @@ -111,11 +111,11 @@ public class SwampHutPiece extends ScatteredFeaturePiece { BlockPos blockPos = this.getWorldPos(2, 2, 5); if (box.isInside(blockPos)) { this.spawnedCat = true; - Cat cat = EntityType.CAT.create(level.getLevel()); + Cat cat = EntityType.CAT.create(level.getLevel(), EntitySpawnReason.STRUCTURE); if (cat != null) { cat.setPersistenceRequired(); cat.moveTo(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5, 0.0F, 0.0F); - cat.finalizeSpawn(level, level.getCurrentDifficultyAt(blockPos), MobSpawnType.STRUCTURE, null); + cat.finalizeSpawn(level, level.getCurrentDifficultyAt(blockPos), EntitySpawnReason.STRUCTURE, null); level.addFreshEntityWithPassengers(cat); } } diff --git a/net/minecraft/world/level/levelgen/structure/structures/WoodlandMansionPieces.java b/net/minecraft/world/level/levelgen/structure/structures/WoodlandMansionPieces.java index 714c3c51..12837ffa 100644 --- a/net/minecraft/world/level/levelgen/structure/structures/WoodlandMansionPieces.java +++ b/net/minecraft/world/level/levelgen/structure/structures/WoodlandMansionPieces.java @@ -11,9 +11,9 @@ import net.minecraft.nbt.CompoundTag; import net.minecraft.resources.ResourceLocation; import net.minecraft.util.RandomSource; import net.minecraft.util.Tuple; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.Mob; -import net.minecraft.world.entity.MobSpawnType; import net.minecraft.world.level.ServerLevelAccessor; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.ChestBlock; @@ -1230,16 +1230,16 @@ public class WoodlandMansionPieces { List list = new ArrayList(); switch (name) { case "Mage": - list.add(EntityType.EVOKER.create(level.getLevel())); + list.add(EntityType.EVOKER.create(level.getLevel(), EntitySpawnReason.STRUCTURE)); break; case "Warrior": - list.add(EntityType.VINDICATOR.create(level.getLevel())); + list.add(EntityType.VINDICATOR.create(level.getLevel(), EntitySpawnReason.STRUCTURE)); break; case "Group of Allays": int i = level.getRandom().nextInt(3) + 1; for (int j = 0; j < i; j++) { - list.add(EntityType.ALLAY.create(level.getLevel())); + list.add(EntityType.ALLAY.create(level.getLevel(), EntitySpawnReason.STRUCTURE)); } break; default: @@ -1250,7 +1250,7 @@ public class WoodlandMansionPieces { if (mob != null) { mob.setPersistenceRequired(); mob.moveTo(pos, 0.0F, 0.0F); - mob.finalizeSpawn(level, level.getCurrentDifficultyAt(mob.blockPosition()), MobSpawnType.STRUCTURE, null); + mob.finalizeSpawn(level, level.getCurrentDifficultyAt(mob.blockPosition()), EntitySpawnReason.STRUCTURE, null); level.addFreshEntityWithPassengers(mob); level.setBlock(pos, Blocks.AIR.defaultBlockState(), 2); } diff --git a/net/minecraft/world/level/levelgen/structure/structures/WoodlandMansionStructure.java b/net/minecraft/world/level/levelgen/structure/structures/WoodlandMansionStructure.java index 5460dee7..d82ebe46 100644 --- a/net/minecraft/world/level/levelgen/structure/structures/WoodlandMansionStructure.java +++ b/net/minecraft/world/level/levelgen/structure/structures/WoodlandMansionStructure.java @@ -15,26 +15,29 @@ import net.minecraft.world.level.chunk.ChunkGenerator; import net.minecraft.world.level.levelgen.structure.BoundingBox; import net.minecraft.world.level.levelgen.structure.Structure; import net.minecraft.world.level.levelgen.structure.StructureType; +import net.minecraft.world.level.levelgen.structure.Structure.GenerationContext; +import net.minecraft.world.level.levelgen.structure.Structure.GenerationStub; +import net.minecraft.world.level.levelgen.structure.Structure.StructureSettings; import net.minecraft.world.level.levelgen.structure.pieces.PiecesContainer; import net.minecraft.world.level.levelgen.structure.pieces.StructurePiecesBuilder; public class WoodlandMansionStructure extends Structure { public static final MapCodec CODEC = simpleCodec(WoodlandMansionStructure::new); - public WoodlandMansionStructure(Structure.StructureSettings settings) { + public WoodlandMansionStructure(StructureSettings settings) { super(settings); } @Override - public Optional findGenerationPoint(Structure.GenerationContext context) { + public Optional findGenerationPoint(GenerationContext context) { Rotation rotation = Rotation.getRandom(context.random()); BlockPos blockPos = this.getLowestYIn5by5BoxOffset7Blocks(context, rotation); return blockPos.getY() < 60 ? Optional.empty() - : Optional.of(new Structure.GenerationStub(blockPos, structurePiecesBuilder -> this.generatePieces(structurePiecesBuilder, context, blockPos, rotation))); + : Optional.of(new GenerationStub(blockPos, structurePiecesBuilder -> this.generatePieces(structurePiecesBuilder, context, blockPos, rotation))); } - private void generatePieces(StructurePiecesBuilder builder, Structure.GenerationContext context, BlockPos pos, Rotation rotation) { + private void generatePieces(StructurePiecesBuilder builder, GenerationContext context, BlockPos pos, Rotation rotation) { List list = Lists.newLinkedList(); WoodlandMansionPieces.generateMansion(context.structureTemplateManager(), pos, rotation, list, context.random()); list.forEach(builder::addPiece); @@ -51,7 +54,7 @@ public class WoodlandMansionStructure extends Structure { PiecesContainer pieces ) { BlockPos.MutableBlockPos mutableBlockPos = new BlockPos.MutableBlockPos(); - int i = level.getMinBuildHeight(); + int i = level.getMinY(); BoundingBox boundingBox2 = pieces.calculateBoundingBox(); int j = boundingBox2.minY(); diff --git a/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java b/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java index 7a7f2c1b..f8107f8d 100644 --- a/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java +++ b/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java @@ -11,7 +11,9 @@ import java.util.Iterator; import java.util.List; import java.util.Locale; import java.util.Map; +import java.util.Objects; import java.util.Optional; +import java.util.function.Supplier; import java.util.stream.Collectors; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -23,13 +25,14 @@ import net.minecraft.nbt.DoubleTag; import net.minecraft.nbt.IntTag; import net.minecraft.nbt.ListTag; import net.minecraft.nbt.NbtUtils; +import net.minecraft.resources.ResourceLocation; import net.minecraft.util.RandomSource; import net.minecraft.world.Clearable; import net.minecraft.world.RandomizableContainer; import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.Mob; -import net.minecraft.world.entity.MobSpawnType; import net.minecraft.world.entity.decoration.Painting; import net.minecraft.world.entity.player.Player; import net.minecraft.world.level.EmptyBlockGetter; @@ -38,10 +41,12 @@ import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.ServerLevelAccessor; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.JigsawBlock; import net.minecraft.world.level.block.LiquidBlockContainer; import net.minecraft.world.level.block.Mirror; import net.minecraft.world.level.block.Rotation; import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.JigsawBlockEntity; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.levelgen.structure.BoundingBox; import net.minecraft.world.level.material.FluidState; @@ -173,6 +178,31 @@ public class StructureTemplate { return this.filterBlocks(pos, settings, block, true); } + public List getJigsaws(BlockPos blockPos, Rotation rotation) { + if (this.palettes.isEmpty()) { + return new ArrayList(); + } else { + StructurePlaceSettings structurePlaceSettings = new StructurePlaceSettings().setRotation(rotation); + List list = structurePlaceSettings.getRandomPalette(this.palettes, blockPos).jigsaws(); + List list2 = new ArrayList(list.size()); + + for (StructureTemplate.JigsawBlockInfo jigsawBlockInfo : list) { + StructureTemplate.StructureBlockInfo structureBlockInfo = jigsawBlockInfo.info; + list2.add( + jigsawBlockInfo.withInfo( + new StructureTemplate.StructureBlockInfo( + calculateRelativePosition(structurePlaceSettings, structureBlockInfo.pos()).offset(blockPos), + structureBlockInfo.state.rotate(structurePlaceSettings.getRotation()), + structureBlockInfo.nbt + ) + ) + ); + } + + return list2; + } + } + public ObjectArrayList filterBlocks(BlockPos pos, StructurePlaceSettings settings, Block block, boolean relativePosition) { ObjectArrayList objectArrayList = new ObjectArrayList<>(); BoundingBox boundingBox = settings.getBoundingBox(); @@ -356,12 +386,12 @@ public class StructureTemplate { mutableBlockPos2.setWithOffset(mutableBlockPos, direction); BlockState blockState = level.getBlockState(mutableBlockPos); BlockState blockState2 = level.getBlockState(mutableBlockPos2); - BlockState blockState3 = blockState.updateShape(direction, blockState2, level, mutableBlockPos, mutableBlockPos2); + BlockState blockState3 = blockState.updateShape(level, level, mutableBlockPos, direction, mutableBlockPos2, blockState2, level.getRandom()); if (blockState != blockState3) { level.setBlock(mutableBlockPos, blockState3, flags & -2); } - BlockState blockState4 = blockState2.updateShape(direction.getOpposite(), blockState3, level, mutableBlockPos2, mutableBlockPos); + BlockState blockState4 = blockState2.updateShape(level, level, mutableBlockPos2, direction.getOpposite(), mutableBlockPos, blockState3, level.getRandom()); if (blockState2 != blockState4) { level.setBlock(mutableBlockPos2, blockState4, flags & -2); } @@ -418,7 +448,7 @@ public class StructureTemplate { f += entity.mirror(mirror) - entity.getYRot(); entity.moveTo(vec32.x, vec32.y, vec32.z, f, entity.getXRot()); if (withEntities && entity instanceof Mob) { - ((Mob)entity).finalizeSpawn(serverLevel, serverLevel.getCurrentDifficultyAt(BlockPos.containing(vec32)), MobSpawnType.STRUCTURE, null); + ((Mob)entity).finalizeSpawn(serverLevel, serverLevel.getCurrentDifficultyAt(BlockPos.containing(vec32)), EntitySpawnReason.STRUCTURE, null); } serverLevel.addFreshEntityWithPassengers(entity); @@ -429,7 +459,7 @@ public class StructureTemplate { private static Optional createEntityIgnoreException(ServerLevelAccessor level, CompoundTag tag) { try { - return EntityType.create(tag, level.getLevel()); + return EntityType.create(tag, level.getLevel(), EntitySpawnReason.STRUCTURE); } catch (Exception var3) { return Optional.empty(); } @@ -710,14 +740,79 @@ public class StructureTemplate { return listTag; } + public static JigsawBlockEntity.JointType getJointType(CompoundTag compoundTag, BlockState blockState) { + return (JigsawBlockEntity.JointType)JigsawBlockEntity.JointType.CODEC + .byName( + compoundTag.getString("joint"), + (Supplier)(() -> JigsawBlock.getFrontFacing(blockState).getAxis().isHorizontal() + ? JigsawBlockEntity.JointType.ALIGNED + : JigsawBlockEntity.JointType.ROLLABLE) + ); + } + + public record JigsawBlockInfo( + StructureTemplate.StructureBlockInfo info, + JigsawBlockEntity.JointType jointType, + ResourceLocation name, + ResourceLocation pool, + ResourceLocation target, + int placementPriority, + int selectionPriority + ) { + + public static StructureTemplate.JigsawBlockInfo of(StructureTemplate.StructureBlockInfo structureBlockInfo) { + CompoundTag compoundTag = (CompoundTag)Objects.requireNonNull(structureBlockInfo.nbt(), () -> structureBlockInfo + " nbt was null"); + return new StructureTemplate.JigsawBlockInfo( + structureBlockInfo, + StructureTemplate.getJointType(compoundTag, structureBlockInfo.state()), + ResourceLocation.parse(compoundTag.getString("name")), + ResourceLocation.parse(compoundTag.getString("pool")), + ResourceLocation.parse(compoundTag.getString("target")), + compoundTag.getInt("placement_priority"), + compoundTag.getInt("selection_priority") + ); + } + + public String toString() { + return String.format( + Locale.ROOT, + "", + this.info.pos, + this.info.state, + this.name, + this.pool, + this.target, + this.placementPriority, + this.selectionPriority, + this.info.nbt + ); + } + + public StructureTemplate.JigsawBlockInfo withInfo(StructureTemplate.StructureBlockInfo structureBlockInfo) { + return new StructureTemplate.JigsawBlockInfo( + structureBlockInfo, this.jointType, this.name, this.pool, this.target, this.placementPriority, this.selectionPriority + ); + } + } + public static final class Palette { private final List blocks; private final Map> cache = Maps.>newHashMap(); + @Nullable + private List cachedJigsaws; Palette(List blocks) { this.blocks = blocks; } + public List jigsaws() { + if (this.cachedJigsaws == null) { + this.cachedJigsaws = this.blocks(Blocks.JIGSAW).stream().map(StructureTemplate.JigsawBlockInfo::of).toList(); + } + + return this.cachedJigsaws; + } + public List blocks() { return this.blocks; } diff --git a/net/minecraft/world/level/lighting/BlockLightEngine.java b/net/minecraft/world/level/lighting/BlockLightEngine.java index 4ef60bb9..1cd3e191 100644 --- a/net/minecraft/world/level/lighting/BlockLightEngine.java +++ b/net/minecraft/world/level/lighting/BlockLightEngine.java @@ -55,13 +55,13 @@ public final class BlockLightEngine extends LightEngine i) { this.mutablePos.set(l); BlockState blockState2 = this.getState(this.mutablePos); - int k = lightLevel - this.getOpacity(blockState2, this.mutablePos); + int k = lightLevel - this.getOpacity(blockState2); if (k > i) { if (blockState == null) { blockState = LightEngine.QueueEntry.isFromEmptyShape(queueEntry) ? Blocks.AIR.defaultBlockState() : this.getState(this.mutablePos.set(packedPos)); } - if (!this.shapeOccludes(packedPos, blockState, l, blockState2, direction)) { + if (!this.shapeOccludes(blockState, blockState2, direction)) { this.storage.setStoredLevel(l, k); if (k > 1) { this.enqueueIncrease(l, LightEngine.QueueEntry.increaseSkipOneDirection(k, isEmptyShape(blockState2), direction.getOpposite())); diff --git a/net/minecraft/world/level/lighting/ChunkSkyLightSources.java b/net/minecraft/world/level/lighting/ChunkSkyLightSources.java index a9acebd1..c1c735b3 100644 --- a/net/minecraft/world/level/lighting/ChunkSkyLightSources.java +++ b/net/minecraft/world/level/lighting/ChunkSkyLightSources.java @@ -24,8 +24,8 @@ public class ChunkSkyLightSources { private final BlockPos.MutableBlockPos mutablePos2 = new BlockPos.MutableBlockPos(); public ChunkSkyLightSources(LevelHeightAccessor level) { - this.minY = level.getMinBuildHeight() - 1; - int i = level.getMaxBuildHeight(); + this.minY = level.getMinY() - 1; + int i = level.getMaxY() + 1; int j = Mth.ceillog2(i - this.minY + 1); this.heightmap = new SimpleBitStorage(j, 256); } @@ -60,7 +60,7 @@ public class ChunkSkyLightSources { } else { for (int k = 15; k >= 0; k--) { BlockState blockState2 = levelChunkSection.getBlockState(x, k, z); - if (isEdgeOccluded(chunk, mutableBlockPos, blockState, mutableBlockPos2, blockState2)) { + if (isEdgeOccluded(blockState, blockState2)) { return mutableBlockPos.getY(); } @@ -97,7 +97,7 @@ public class ChunkSkyLightSources { private boolean updateEdge(BlockGetter level, int index, int minY, BlockPos pos1, BlockState state1, BlockPos pos2, BlockState state2) { int i = pos1.getY(); - if (isEdgeOccluded(level, pos1, state1, pos2, state2)) { + if (isEdgeOccluded(state1, state2)) { if (i > minY) { this.set(index, i); return true; @@ -117,7 +117,7 @@ public class ChunkSkyLightSources { while (mutableBlockPos2.getY() >= this.minY) { BlockState blockState2 = level.getBlockState(mutableBlockPos2); - if (isEdgeOccluded(level, mutableBlockPos, blockState, mutableBlockPos2, blockState2)) { + if (isEdgeOccluded(blockState, blockState2)) { return mutableBlockPos.getY(); } @@ -129,12 +129,12 @@ public class ChunkSkyLightSources { return this.minY; } - private static boolean isEdgeOccluded(BlockGetter level, BlockPos pos1, BlockState state1, BlockPos pos2, BlockState state2) { - if (state2.getLightBlock(level, pos2) != 0) { + private static boolean isEdgeOccluded(BlockState blockState, BlockState blockState2) { + if (blockState2.getLightBlock() != 0) { return true; } else { - VoxelShape voxelShape = LightEngine.getOcclusionShape(level, pos1, state1, Direction.DOWN); - VoxelShape voxelShape2 = LightEngine.getOcclusionShape(level, pos2, state2, Direction.UP); + VoxelShape voxelShape = LightEngine.getOcclusionShape(blockState, Direction.DOWN); + VoxelShape voxelShape2 = LightEngine.getOcclusionShape(blockState2, Direction.UP); return Shapes.faceShapeOccludes(voxelShape, voxelShape2); } } diff --git a/net/minecraft/world/level/lighting/LayerLightSectionStorage.java b/net/minecraft/world/level/lighting/LayerLightSectionStorage.java index 2ab8122d..b778fc79 100644 --- a/net/minecraft/world/level/lighting/LayerLightSectionStorage.java +++ b/net/minecraft/world/level/lighting/LayerLightSectionStorage.java @@ -202,6 +202,10 @@ public abstract class LayerLightSectionStorage> return this.columnsWithSources.contains(l); } + protected boolean lightOnInColumn(long l) { + return this.columnsWithSources.contains(l); + } + public void retainData(long sectionColumnPos, boolean retain) { if (retain) { this.columnsToRetainQueuedDataFor.add(sectionColumnPos); diff --git a/net/minecraft/world/level/lighting/LevelLightEngine.java b/net/minecraft/world/level/lighting/LevelLightEngine.java index 360065dc..78c44eee 100644 --- a/net/minecraft/world/level/lighting/LevelLightEngine.java +++ b/net/minecraft/world/level/lighting/LevelLightEngine.java @@ -7,10 +7,12 @@ import net.minecraft.world.level.LevelHeightAccessor; import net.minecraft.world.level.LightLayer; import net.minecraft.world.level.chunk.DataLayer; import net.minecraft.world.level.chunk.LightChunkGetter; +import net.minecraft.world.level.lighting.LayerLightEventListener.DummyLightLayerEventListener; import org.jetbrains.annotations.Nullable; public class LevelLightEngine implements LightEventListener { public static final int LIGHT_SECTION_PADDING = 1; + public static final LevelLightEngine EMPTY = new LevelLightEngine(); protected final LevelHeightAccessor levelHeightAccessor; @Nullable private final LightEngine blockEngine; @@ -23,6 +25,12 @@ public class LevelLightEngine implements LightEventListener { this.skyEngine = skyLight ? new SkyLightEngine(lightChunkGetter) : null; } + private LevelLightEngine() { + this.levelHeightAccessor = LevelHeightAccessor.create(0, 0); + this.blockEngine = null; + this.skyEngine = null; + } + @Override public void checkBlock(BlockPos pos) { if (this.blockEngine != null) { @@ -88,9 +96,9 @@ public class LevelLightEngine implements LightEventListener { public LayerLightEventListener getLayerListener(LightLayer type) { if (type == LightLayer.BLOCK) { - return (LayerLightEventListener)(this.blockEngine == null ? LayerLightEventListener.DummyLightLayerEventListener.INSTANCE : this.blockEngine); + return (LayerLightEventListener)(this.blockEngine == null ? DummyLightLayerEventListener.INSTANCE : this.blockEngine); } else { - return (LayerLightEventListener)(this.skyEngine == null ? LayerLightEventListener.DummyLightLayerEventListener.INSTANCE : this.skyEngine); + return (LayerLightEventListener)(this.skyEngine == null ? DummyLightLayerEventListener.INSTANCE : this.skyEngine); } } @@ -144,9 +152,8 @@ public class LevelLightEngine implements LightEventListener { return Math.max(j, i); } - public boolean lightOnInSection(SectionPos sectionPos) { - long l = sectionPos.asLong(); - return this.blockEngine == null || this.blockEngine.storage.lightOnInSection(l) && (this.skyEngine == null || this.skyEngine.storage.lightOnInSection(l)); + public boolean lightOnInColumn(long l) { + return this.blockEngine == null || this.blockEngine.storage.lightOnInColumn(l) && (this.skyEngine == null || this.skyEngine.storage.lightOnInColumn(l)); } public int getLightSectionCount() { @@ -154,7 +161,7 @@ public class LevelLightEngine implements LightEventListener { } public int getMinLightSection() { - return this.levelHeightAccessor.getMinSection() - 1; + return this.levelHeightAccessor.getMinSectionY() - 1; } public int getMaxLightSection() { diff --git a/net/minecraft/world/level/lighting/LightEngine.java b/net/minecraft/world/level/lighting/LightEngine.java index ab3f72c9..b04ecccf 100644 --- a/net/minecraft/world/level/lighting/LightEngine.java +++ b/net/minecraft/world/level/lighting/LightEngine.java @@ -7,7 +7,6 @@ import java.util.Arrays; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.SectionPos; -import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.ChunkPos; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.state.BlockState; @@ -29,7 +28,6 @@ public abstract class LightEngine, S extends La private final LongOpenHashSet blockNodesToCheck = new LongOpenHashSet(512, 0.5F); private final LongArrayFIFOQueue decreaseQueue = new LongArrayFIFOQueue(); private final LongArrayFIFOQueue increaseQueue = new LongArrayFIFOQueue(); - private final BlockPos.MutableBlockPos mutablePos = new BlockPos.MutableBlockPos(); private static final int CACHE_SIZE = 2; private final long[] lastChunkPos = new long[2]; private final LightChunk[] lastChunk = new LightChunk[2]; @@ -40,31 +38,29 @@ public abstract class LightEngine, S extends La this.clearChunkCache(); } - public static boolean hasDifferentLightProperties(BlockGetter level, BlockPos pos, BlockState state1, BlockState state2) { - return state2 == state1 + public static boolean hasDifferentLightProperties(BlockState blockState, BlockState blockState2) { + return blockState2 == blockState ? false - : state2.getLightBlock(level, pos) != state1.getLightBlock(level, pos) - || state2.getLightEmission() != state1.getLightEmission() - || state2.useShapeForLightOcclusion() - || state1.useShapeForLightOcclusion(); + : blockState2.getLightBlock() != blockState.getLightBlock() + || blockState2.getLightEmission() != blockState.getLightEmission() + || blockState2.useShapeForLightOcclusion() + || blockState.useShapeForLightOcclusion(); } - public static int getLightBlockInto( - BlockGetter level, BlockState state1, BlockPos pos1, BlockState state2, BlockPos pos2, Direction direction, int defaultReturnValue - ) { - boolean bl = isEmptyShape(state1); - boolean bl2 = isEmptyShape(state2); + public static int getLightBlockInto(BlockState blockState, BlockState blockState2, Direction direction, int i) { + boolean bl = isEmptyShape(blockState); + boolean bl2 = isEmptyShape(blockState2); if (bl && bl2) { - return defaultReturnValue; + return i; } else { - VoxelShape voxelShape = bl ? Shapes.empty() : state1.getOcclusionShape(level, pos1); - VoxelShape voxelShape2 = bl2 ? Shapes.empty() : state2.getOcclusionShape(level, pos2); - return Shapes.mergedFaceOccludes(voxelShape, voxelShape2, direction) ? 16 : defaultReturnValue; + VoxelShape voxelShape = bl ? Shapes.empty() : blockState.getOcclusionShape(); + VoxelShape voxelShape2 = bl2 ? Shapes.empty() : blockState2.getOcclusionShape(); + return Shapes.mergedFaceOccludes(voxelShape, voxelShape2, direction) ? 16 : i; } } - public static VoxelShape getOcclusionShape(BlockGetter level, BlockPos pos, BlockState state, Direction direction) { - return isEmptyShape(state) ? Shapes.empty() : state.getFaceOcclusionShape(level, pos, direction); + public static VoxelShape getOcclusionShape(BlockState blockState, Direction direction) { + return isEmptyShape(blockState) ? Shapes.empty() : blockState.getFaceOcclusionShape(direction); } protected static boolean isEmptyShape(BlockState state) { @@ -78,20 +74,16 @@ public abstract class LightEngine, S extends La return lightChunk == null ? Blocks.BEDROCK.defaultBlockState() : lightChunk.getBlockState(pos); } - protected int getOpacity(BlockState state, BlockPos pos) { - return Math.max(1, state.getLightBlock(this.chunkSource.getLevel(), pos)); + protected int getOpacity(BlockState blockState) { + return Math.max(1, blockState.getLightBlock()); } - protected boolean shapeOccludes(long packedPos1, BlockState state1, long packedPos2, BlockState state2, Direction direction) { - VoxelShape voxelShape = this.getOcclusionShape(state1, packedPos1, direction); - VoxelShape voxelShape2 = this.getOcclusionShape(state2, packedPos2, direction.getOpposite()); + protected boolean shapeOccludes(BlockState blockState, BlockState blockState2, Direction direction) { + VoxelShape voxelShape = getOcclusionShape(blockState, direction); + VoxelShape voxelShape2 = getOcclusionShape(blockState2, direction.getOpposite()); return Shapes.faceShapeOccludes(voxelShape, voxelShape2); } - protected VoxelShape getOcclusionShape(BlockState state, long pos, Direction direction) { - return getOcclusionShape(this.chunkSource.getLevel(), this.mutablePos.set(pos), state, direction); - } - @Nullable protected LightChunk getChunk(int x, int z) { long l = ChunkPos.asLong(x, z); diff --git a/net/minecraft/world/level/lighting/SkyLightEngine.java b/net/minecraft/world/level/lighting/SkyLightEngine.java index 82cfb0a4..6e44d003 100644 --- a/net/minecraft/world/level/lighting/SkyLightEngine.java +++ b/net/minecraft/world/level/lighting/SkyLightEngine.java @@ -149,13 +149,13 @@ public final class SkyLightEngine extends LightEngine j) { this.mutablePos.set(l); BlockState blockState2 = this.getState(this.mutablePos); - int m = lightLevel - this.getOpacity(blockState2, this.mutablePos); + int m = lightLevel - this.getOpacity(blockState2); if (m > j) { if (blockState == null) { blockState = LightEngine.QueueEntry.isFromEmptyShape(queueEntry) ? Blocks.AIR.defaultBlockState() : this.getState(this.mutablePos.set(packedPos)); } - if (!this.shapeOccludes(packedPos, blockState, l, blockState2, direction)) { + if (!this.shapeOccludes(blockState, blockState2, direction)) { this.storage.setStoredLevel(l, m); if (m > 1) { this.enqueueIncrease(l, LightEngine.QueueEntry.increaseSkipOneDirection(m, isEmptyShape(blockState2), direction.getOpposite())); diff --git a/net/minecraft/world/level/material/FlowingFluid.java b/net/minecraft/world/level/material/FlowingFluid.java index 33eabb08..ad02e4d1 100644 --- a/net/minecraft/world/level/material/FlowingFluid.java +++ b/net/minecraft/world/level/material/FlowingFluid.java @@ -1,7 +1,6 @@ package net.minecraft.world.level.material; import com.google.common.collect.Maps; -import com.mojang.datafixers.util.Pair; import it.unimi.dsi.fastutil.objects.Object2ByteLinkedOpenHashMap; import it.unimi.dsi.fastutil.shorts.Short2BooleanFunction; import it.unimi.dsi.fastutil.shorts.Short2BooleanMap; @@ -13,6 +12,7 @@ import java.util.Map; import java.util.Map.Entry; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; +import net.minecraft.server.level.ServerLevel; import net.minecraft.tags.BlockTags; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; @@ -36,15 +36,19 @@ public abstract class FlowingFluid extends Fluid { public static final BooleanProperty FALLING = BlockStateProperties.FALLING; public static final IntegerProperty LEVEL = BlockStateProperties.LEVEL_FLOWING; private static final int CACHE_SIZE = 200; - private static final ThreadLocal> OCCLUSION_CACHE = ThreadLocal.withInitial(() -> { - Object2ByteLinkedOpenHashMap object2ByteLinkedOpenHashMap = new Object2ByteLinkedOpenHashMap(200) { - @Override - protected void rehash(int i) { - } - }; - object2ByteLinkedOpenHashMap.defaultReturnValue((byte)127); - return object2ByteLinkedOpenHashMap; - }); + private static final ThreadLocal> OCCLUSION_CACHE = ThreadLocal.withInitial( + () -> { + Object2ByteLinkedOpenHashMap object2ByteLinkedOpenHashMap = new Object2ByteLinkedOpenHashMap( + 200 + ) { + @Override + protected void rehash(int i) { + } + }; + object2ByteLinkedOpenHashMap.defaultReturnValue((byte)127); + return object2ByteLinkedOpenHashMap; + } + ); private final Map shapes = Maps.newIdentityHashMap(); @Override @@ -116,53 +120,58 @@ public abstract class FlowingFluid extends Fluid { } } - protected void spread(Level level, BlockPos pos, FluidState state) { - if (!state.isEmpty()) { - BlockState blockState = level.getBlockState(pos); - BlockPos blockPos = pos.below(); - BlockState blockState2 = level.getBlockState(blockPos); - FluidState fluidState = this.getNewLiquid(level, blockPos, blockState2); - if (this.canSpreadTo(level, pos, blockState, Direction.DOWN, blockPos, blockState2, level.getFluidState(blockPos), fluidState.getType())) { - this.spreadTo(level, blockPos, blockState2, Direction.DOWN, fluidState); - if (this.sourceNeighborCount(level, pos) >= 3) { - this.spreadToSides(level, pos, state, blockState); + protected void spread(ServerLevel serverLevel, BlockPos blockPos, BlockState blockState, FluidState fluidState) { + if (!fluidState.isEmpty()) { + BlockPos blockPos2 = blockPos.below(); + BlockState blockState2 = serverLevel.getBlockState(blockPos2); + FluidState fluidState2 = blockState2.getFluidState(); + if (this.canMaybePassThrough(serverLevel, blockPos, blockState, Direction.DOWN, blockPos2, blockState2, fluidState2)) { + FluidState fluidState3 = this.getNewLiquid(serverLevel, blockPos2, blockState2); + Fluid fluid = fluidState3.getType(); + if (fluidState2.canBeReplacedWith(serverLevel, blockPos2, fluid, Direction.DOWN) && canHoldSpecificFluid(serverLevel, blockPos2, blockState2, fluid)) { + this.spreadTo(serverLevel, blockPos2, blockState2, Direction.DOWN, fluidState3); + if (this.sourceNeighborCount(serverLevel, blockPos) >= 3) { + this.spreadToSides(serverLevel, blockPos, fluidState, blockState); + } + + return; } - } else if (state.isSource() || !this.isWaterHole(level, fluidState.getType(), pos, blockState, blockPos, blockState2)) { - this.spreadToSides(level, pos, state, blockState); + } + + if (fluidState.isSource() || !this.isWaterHole(serverLevel, blockPos, blockState, blockPos2, blockState2)) { + this.spreadToSides(serverLevel, blockPos, fluidState, blockState); } } } - private void spreadToSides(Level level, BlockPos pos, FluidState fluidState, BlockState blockState) { - int i = fluidState.getAmount() - this.getDropOff(level); + private void spreadToSides(ServerLevel serverLevel, BlockPos blockPos, FluidState fluidState, BlockState blockState) { + int i = fluidState.getAmount() - this.getDropOff(serverLevel); if ((Boolean)fluidState.getValue(FALLING)) { i = 7; } if (i > 0) { - Map map = this.getSpread(level, pos, blockState); + Map map = this.getSpread(serverLevel, blockPos, blockState); for (Entry entry : map.entrySet()) { Direction direction = (Direction)entry.getKey(); FluidState fluidState2 = (FluidState)entry.getValue(); - BlockPos blockPos = pos.relative(direction); - BlockState blockState2 = level.getBlockState(blockPos); - if (this.canSpreadTo(level, pos, blockState, direction, blockPos, blockState2, level.getFluidState(blockPos), fluidState2.getType())) { - this.spreadTo(level, blockPos, blockState2, direction, fluidState2); - } + BlockPos blockPos2 = blockPos.relative(direction); + this.spreadTo(serverLevel, blockPos2, serverLevel.getBlockState(blockPos2), direction, fluidState2); } } } - protected FluidState getNewLiquid(Level level, BlockPos pos, BlockState blockState) { + protected FluidState getNewLiquid(ServerLevel serverLevel, BlockPos blockPos, BlockState blockState) { int i = 0; int j = 0; + BlockPos.MutableBlockPos mutableBlockPos = new BlockPos.MutableBlockPos(); for (Direction direction : Direction.Plane.HORIZONTAL) { - BlockPos blockPos = pos.relative(direction); - BlockState blockState2 = level.getBlockState(blockPos); + BlockPos blockPos2 = mutableBlockPos.setWithOffset(blockPos, direction); + BlockState blockState2 = serverLevel.getBlockState(blockPos2); FluidState fluidState = blockState2.getFluidState(); - if (fluidState.getType().isSame(this) && this.canPassThroughWall(direction, level, pos, blockState, blockPos, blockState2)) { + if (fluidState.getType().isSame(this) && canPassThroughWall(direction, serverLevel, blockPos, blockState, blockPos2, blockState2)) { if (fluidState.isSource()) { j++; } @@ -171,56 +180,68 @@ public abstract class FlowingFluid extends Fluid { } } - if (this.canConvertToSource(level) && j >= 2) { - BlockState blockState3 = level.getBlockState(pos.below()); + if (j >= 2 && this.canConvertToSource(serverLevel)) { + BlockState blockState3 = serverLevel.getBlockState(mutableBlockPos.setWithOffset(blockPos, Direction.DOWN)); FluidState fluidState2 = blockState3.getFluidState(); if (blockState3.isSolid() || this.isSourceBlockOfThisType(fluidState2)) { return this.getSource(false); } } - BlockPos blockPos2 = pos.above(); - BlockState blockState4 = level.getBlockState(blockPos2); + BlockPos blockPos3 = mutableBlockPos.setWithOffset(blockPos, Direction.UP); + BlockState blockState4 = serverLevel.getBlockState(blockPos3); FluidState fluidState3 = blockState4.getFluidState(); - if (!fluidState3.isEmpty() && fluidState3.getType().isSame(this) && this.canPassThroughWall(Direction.UP, level, pos, blockState, blockPos2, blockState4)) { + if (!fluidState3.isEmpty() + && fluidState3.getType().isSame(this) + && canPassThroughWall(Direction.UP, serverLevel, blockPos, blockState, blockPos3, blockState4)) { return this.getFlowing(8, true); } else { - int k = i - this.getDropOff(level); + int k = i - this.getDropOff(serverLevel); return k <= 0 ? Fluids.EMPTY.defaultFluidState() : this.getFlowing(k, false); } } - private boolean canPassThroughWall(Direction direction, BlockGetter level, BlockPos pos, BlockState state, BlockPos spreadPos, BlockState spreadState) { - Object2ByteLinkedOpenHashMap object2ByteLinkedOpenHashMap; - if (!state.getBlock().hasDynamicShape() && !spreadState.getBlock().hasDynamicShape()) { - object2ByteLinkedOpenHashMap = (Object2ByteLinkedOpenHashMap)OCCLUSION_CACHE.get(); + private static boolean canPassThroughWall(Direction direction2, BlockGetter direction, BlockPos level, BlockState pos, BlockPos state, BlockState spreadPos) { + VoxelShape voxelShape = spreadPos.getCollisionShape(direction, state); + if (voxelShape == Shapes.block()) { + return false; } else { - object2ByteLinkedOpenHashMap = null; - } + VoxelShape voxelShape2 = pos.getCollisionShape(direction, level); + if (voxelShape2 == Shapes.block()) { + return false; + } else if (voxelShape2 == Shapes.empty() && voxelShape == Shapes.empty()) { + return true; + } else { + Object2ByteLinkedOpenHashMap object2ByteLinkedOpenHashMap; + if (!pos.getBlock().hasDynamicShape() && !spreadPos.getBlock().hasDynamicShape()) { + object2ByteLinkedOpenHashMap = (Object2ByteLinkedOpenHashMap)OCCLUSION_CACHE.get(); + } else { + object2ByteLinkedOpenHashMap = null; + } - Block.BlockStatePairKey blockStatePairKey; - if (object2ByteLinkedOpenHashMap != null) { - blockStatePairKey = new Block.BlockStatePairKey(state, spreadState, direction); - byte b = object2ByteLinkedOpenHashMap.getAndMoveToFirst(blockStatePairKey); - if (b != 127) { - return b != 0; + FlowingFluid.BlockStatePairKey blockStatePairKey; + if (object2ByteLinkedOpenHashMap != null) { + blockStatePairKey = new FlowingFluid.BlockStatePairKey(pos, spreadPos, direction2); + byte b = object2ByteLinkedOpenHashMap.getAndMoveToFirst(blockStatePairKey); + if (b != 127) { + return b != 0; + } + } else { + blockStatePairKey = null; + } + + boolean bl = !Shapes.mergedFaceOccludes(voxelShape2, voxelShape, direction2); + if (object2ByteLinkedOpenHashMap != null) { + if (object2ByteLinkedOpenHashMap.size() == 200) { + object2ByteLinkedOpenHashMap.removeLastByte(); + } + + object2ByteLinkedOpenHashMap.putAndMoveToFirst(blockStatePairKey, (byte)(bl ? 1 : 0)); + } + + return bl; } - } else { - blockStatePairKey = null; } - - VoxelShape voxelShape = state.getCollisionShape(level, pos); - VoxelShape voxelShape2 = spreadState.getCollisionShape(level, spreadPos); - boolean bl = !Shapes.mergedFaceOccludes(voxelShape, voxelShape2, direction); - if (object2ByteLinkedOpenHashMap != null) { - if (object2ByteLinkedOpenHashMap.size() == 200) { - object2ByteLinkedOpenHashMap.removeLastByte(); - } - - object2ByteLinkedOpenHashMap.putAndMoveToFirst(blockStatePairKey, (byte)(bl ? 1 : 0)); - } - - return bl; } public abstract Fluid getFlowing(); @@ -235,11 +256,11 @@ public abstract class FlowingFluid extends Fluid { return this.getSource().defaultFluidState().setValue(FALLING, falling); } - protected abstract boolean canConvertToSource(Level level); + protected abstract boolean canConvertToSource(ServerLevel serverLevel); protected void spreadTo(LevelAccessor level, BlockPos pos, BlockState blockState, Direction direction, FluidState fluidState) { - if (blockState.getBlock() instanceof LiquidBlockContainer) { - ((LiquidBlockContainer)blockState.getBlock()).placeLiquid(level, pos, blockState, fluidState); + if (blockState.getBlock() instanceof LiquidBlockContainer liquidBlockContainer) { + liquidBlockContainer.placeLiquid(level, pos, blockState, fluidState); } else { if (!blockState.isAir()) { this.beforeDestroyingBlock(level, pos, blockState); @@ -251,71 +272,55 @@ public abstract class FlowingFluid extends Fluid { protected abstract void beforeDestroyingBlock(LevelAccessor level, BlockPos pos, BlockState state); - private static short getCacheKey(BlockPos sourcePos, BlockPos spreadPos) { - int i = spreadPos.getX() - sourcePos.getX(); - int j = spreadPos.getZ() - sourcePos.getZ(); - return (short)((i + 128 & 0xFF) << 8 | j + 128 & 0xFF); - } - protected int getSlopeDistance( - LevelReader level, - BlockPos spreadPos, - int distance, - Direction direction, - BlockState currentSpreadState, - BlockPos sourcePos, - Short2ObjectMap> stateCache, - Short2BooleanMap waterHoleCache + LevelReader levelReader, BlockPos blockPos, int i, Direction direction, BlockState blockState, FlowingFluid.SpreadContext spreadContext ) { - int i = 1000; + int j = 1000; for (Direction direction2 : Direction.Plane.HORIZONTAL) { if (direction2 != direction) { - BlockPos blockPos = spreadPos.relative(direction2); - short s = getCacheKey(sourcePos, blockPos); - Pair pair = stateCache.computeIfAbsent(s, (Short2ObjectFunction>)(sx -> { - BlockState blockStatex = level.getBlockState(blockPos); - return Pair.of(blockStatex, blockStatex.getFluidState()); - })); - BlockState blockState = pair.getFirst(); - FluidState fluidState = pair.getSecond(); - if (this.canPassThrough(level, this.getFlowing(), spreadPos, currentSpreadState, direction2, blockPos, blockState, fluidState)) { - boolean bl = waterHoleCache.computeIfAbsent(s, (Short2BooleanFunction)(sx -> { - BlockPos blockPos2 = blockPos.below(); - BlockState blockState2 = level.getBlockState(blockPos2); - return this.isWaterHole(level, this.getFlowing(), blockPos, blockState, blockPos2, blockState2); - })); - if (bl) { - return distance; + BlockPos blockPos2 = blockPos.relative(direction2); + BlockState blockState2 = spreadContext.getBlockState(blockPos2); + FluidState fluidState = blockState2.getFluidState(); + if (this.canPassThrough(levelReader, this.getFlowing(), blockPos, blockState, direction2, blockPos2, blockState2, fluidState)) { + if (spreadContext.isHole(blockPos2)) { + return i; } - if (distance < this.getSlopeFindDistance(level)) { - int j = this.getSlopeDistance(level, blockPos, distance + 1, direction2.getOpposite(), blockState, sourcePos, stateCache, waterHoleCache); - if (j < i) { - i = j; + if (i < this.getSlopeFindDistance(levelReader)) { + int k = this.getSlopeDistance(levelReader, blockPos2, i + 1, direction2.getOpposite(), blockState2, spreadContext); + if (k < j) { + j = k; } } } } } - return i; + return j; } - private boolean isWaterHole(BlockGetter level, Fluid fluid, BlockPos pos, BlockState state, BlockPos spreadPos, BlockState spreadState) { - if (!this.canPassThroughWall(Direction.DOWN, level, pos, state, spreadPos, spreadState)) { + boolean isWaterHole(BlockGetter blockGetter, BlockPos blockPos, BlockState blockState, BlockPos blockPos2, BlockState blockState2) { + if (!canPassThroughWall(Direction.DOWN, blockGetter, blockPos, blockState, blockPos2, blockState2)) { return false; } else { - return spreadState.getFluidState().getType().isSame(this) ? true : this.canHoldFluid(level, spreadPos, spreadState, fluid); + return blockState2.getFluidState().getType().isSame(this) ? true : canHoldFluid(blockGetter, blockPos2, blockState2, this.getFlowing()); } } private boolean canPassThrough( BlockGetter level, Fluid fluid, BlockPos pos, BlockState state, Direction direction, BlockPos spreadPos, BlockState spreadState, FluidState fluidState + ) { + return this.canMaybePassThrough(level, pos, state, direction, spreadPos, spreadState, fluidState) + && canHoldSpecificFluid(level, spreadPos, spreadState, fluid); + } + + private boolean canMaybePassThrough( + BlockGetter blockGetter, BlockPos blockPos, BlockState blockState, Direction direction, BlockPos blockPos2, BlockState blockState2, FluidState fluidState ) { return !this.isSourceBlockOfThisType(fluidState) - && this.canPassThroughWall(direction, level, pos, state, spreadPos, spreadState) - && this.canHoldFluid(level, spreadPos, spreadState, fluid); + && canHoldAnyFluid(blockState2) + && canPassThroughWall(direction, blockGetter, blockPos, blockState, blockPos2, blockState2); } private boolean isSourceBlockOfThisType(FluidState state) { @@ -341,42 +346,40 @@ public abstract class FlowingFluid extends Fluid { return i; } - protected Map getSpread(Level level, BlockPos pos, BlockState state) { + protected Map getSpread(ServerLevel serverLevel, BlockPos blockPos, BlockState blockState) { int i = 1000; Map map = Maps.newEnumMap(Direction.class); - Short2ObjectMap> short2ObjectMap = new Short2ObjectOpenHashMap<>(); - Short2BooleanMap short2BooleanMap = new Short2BooleanOpenHashMap(); + FlowingFluid.SpreadContext spreadContext = null; for (Direction direction : Direction.Plane.HORIZONTAL) { - BlockPos blockPos = pos.relative(direction); - short s = getCacheKey(pos, blockPos); - Pair pair = short2ObjectMap.computeIfAbsent(s, (Short2ObjectFunction>)(sx -> { - BlockState blockStatex = level.getBlockState(blockPos); - return Pair.of(blockStatex, blockStatex.getFluidState()); - })); - BlockState blockState = pair.getFirst(); - FluidState fluidState = pair.getSecond(); - FluidState fluidState2 = this.getNewLiquid(level, blockPos, blockState); - if (this.canPassThrough(level, fluidState2.getType(), pos, state, direction, blockPos, blockState, fluidState)) { - BlockPos blockPos2 = blockPos.below(); - boolean bl = short2BooleanMap.computeIfAbsent(s, (Short2BooleanFunction)(sx -> { - BlockState blockState2 = level.getBlockState(blockPos2); - return this.isWaterHole(level, this.getFlowing(), blockPos, blockState, blockPos2, blockState2); - })); - int j; - if (bl) { - j = 0; - } else { - j = this.getSlopeDistance(level, blockPos, 1, direction.getOpposite(), blockState, pos, short2ObjectMap, short2BooleanMap); - } + BlockPos blockPos2 = blockPos.relative(direction); + BlockState blockState2 = serverLevel.getBlockState(blockPos2); + FluidState fluidState = blockState2.getFluidState(); + if (this.canMaybePassThrough(serverLevel, blockPos, blockState, direction, blockPos2, blockState2, fluidState)) { + FluidState fluidState2 = this.getNewLiquid(serverLevel, blockPos2, blockState2); + if (canHoldSpecificFluid(serverLevel, blockPos2, blockState2, fluidState2.getType())) { + if (spreadContext == null) { + spreadContext = new FlowingFluid.SpreadContext(serverLevel, blockPos); + } - if (j < i) { - map.clear(); - } + int j; + if (spreadContext.isHole(blockPos2)) { + j = 0; + } else { + j = this.getSlopeDistance(serverLevel, blockPos2, 1, direction.getOpposite(), blockState2, spreadContext); + } - if (j <= i) { - map.put(direction, fluidState2); - i = j; + if (j < i) { + map.clear(); + } + + if (j <= i) { + if (fluidState.canBeReplacedWith(serverLevel, blockPos2, fluidState2.getType(), direction)) { + map.put(direction, fluidState2); + } + + i = j; + } } } } @@ -384,36 +387,33 @@ public abstract class FlowingFluid extends Fluid { return map; } - private boolean canHoldFluid(BlockGetter level, BlockPos pos, BlockState state, Fluid fluid) { - Block block = state.getBlock(); - if (block instanceof LiquidBlockContainer liquidBlockContainer) { - return liquidBlockContainer.canPlaceLiquid(null, level, pos, state, fluid); - } else if (block instanceof DoorBlock - || state.is(BlockTags.SIGNS) - || state.is(Blocks.LADDER) - || state.is(Blocks.SUGAR_CANE) - || state.is(Blocks.BUBBLE_COLUMN)) { - return false; + private static boolean canHoldAnyFluid(BlockState blockState) { + Block block = blockState.getBlock(); + if (block instanceof LiquidBlockContainer) { + return true; } else { - return !state.is(Blocks.NETHER_PORTAL) && !state.is(Blocks.END_PORTAL) && !state.is(Blocks.END_GATEWAY) && !state.is(Blocks.STRUCTURE_VOID) - ? !state.blocksMotion() - : false; + return blockState.blocksMotion() + ? false + : !(block instanceof DoorBlock) + && !blockState.is(BlockTags.SIGNS) + && !blockState.is(Blocks.LADDER) + && !blockState.is(Blocks.SUGAR_CANE) + && !blockState.is(Blocks.BUBBLE_COLUMN) + && !blockState.is(Blocks.NETHER_PORTAL) + && !blockState.is(Blocks.END_PORTAL) + && !blockState.is(Blocks.END_GATEWAY) + && !blockState.is(Blocks.STRUCTURE_VOID); } } - protected boolean canSpreadTo( - BlockGetter level, - BlockPos fromPos, - BlockState fromBlockState, - Direction direction, - BlockPos toPos, - BlockState toBlockState, - FluidState toFluidState, - Fluid fluid - ) { - return toFluidState.canBeReplacedWith(level, toPos, fluid, direction) - && this.canPassThroughWall(direction, level, fromPos, fromBlockState, toPos, toBlockState) - && this.canHoldFluid(level, toPos, toBlockState, fluid); + private static boolean canHoldFluid(BlockGetter blockGetter, BlockPos level, BlockState pos, Fluid state) { + return canHoldAnyFluid(pos) && canHoldSpecificFluid(blockGetter, level, pos, state); + } + + private static boolean canHoldSpecificFluid(BlockGetter blockGetter, BlockPos blockPos, BlockState blockState, Fluid fluid) { + return blockState.getBlock() instanceof LiquidBlockContainer liquidBlockContainer + ? liquidBlockContainer.canPlaceLiquid(null, blockGetter, blockPos, blockState, fluid) + : true; } protected abstract int getDropOff(LevelReader level); @@ -423,23 +423,23 @@ public abstract class FlowingFluid extends Fluid { } @Override - public void tick(Level level, BlockPos pos, FluidState state) { - if (!state.isSource()) { - FluidState fluidState = this.getNewLiquid(level, pos, level.getBlockState(pos)); - int i = this.getSpreadDelay(level, pos, state, fluidState); - if (fluidState.isEmpty()) { - state = fluidState; - level.setBlock(pos, Blocks.AIR.defaultBlockState(), 3); - } else if (!fluidState.equals(state)) { - state = fluidState; - BlockState blockState = fluidState.createLegacyBlock(); - level.setBlock(pos, blockState, 2); - level.scheduleTick(pos, fluidState.getType(), i); - level.updateNeighborsAt(pos, blockState.getBlock()); + public void tick(ServerLevel serverLevel, BlockPos blockPos, BlockState blockState, FluidState fluidState) { + if (!fluidState.isSource()) { + FluidState fluidState2 = this.getNewLiquid(serverLevel, blockPos, serverLevel.getBlockState(blockPos)); + int i = this.getSpreadDelay(serverLevel, blockPos, fluidState, fluidState2); + if (fluidState2.isEmpty()) { + fluidState = fluidState2; + blockState = Blocks.AIR.defaultBlockState(); + serverLevel.setBlock(blockPos, blockState, 3); + } else if (!fluidState2.equals(fluidState)) { + fluidState = fluidState2; + blockState = fluidState2.createLegacyBlock(); + serverLevel.setBlock(blockPos, blockState, 3); + serverLevel.scheduleTick(blockPos, fluidState2.getType(), i); } } - this.spread(level, pos, state); + this.spread(serverLevel, blockPos, blockState, fluidState); } protected static int getLegacyLevel(FluidState state) { @@ -469,4 +469,54 @@ public abstract class FlowingFluid extends Fluid { ? Shapes.block() : (VoxelShape)this.shapes.computeIfAbsent(state, fluidState -> Shapes.box(0.0, 0.0, 0.0, 1.0, fluidState.getHeight(level, pos), 1.0)); } + + record BlockStatePairKey(BlockState first, BlockState second, Direction direction) { + public boolean equals(Object object) { + return object instanceof FlowingFluid.BlockStatePairKey blockStatePairKey + && this.first == blockStatePairKey.first + && this.second == blockStatePairKey.second + && this.direction == blockStatePairKey.direction; + } + + public int hashCode() { + int i = System.identityHashCode(this.first); + i = 31 * i + System.identityHashCode(this.second); + return 31 * i + this.direction.hashCode(); + } + } + + protected class SpreadContext { + private final BlockGetter level; + private final BlockPos origin; + private final Short2ObjectMap stateCache = new Short2ObjectOpenHashMap<>(); + private final Short2BooleanMap holeCache = new Short2BooleanOpenHashMap(); + + SpreadContext(final BlockGetter blockGetter, final BlockPos blockPos) { + this.level = blockGetter; + this.origin = blockPos; + } + + public BlockState getBlockState(BlockPos blockPos) { + return this.getBlockState(blockPos, this.getCacheKey(blockPos)); + } + + private BlockState getBlockState(BlockPos blockPos, short s) { + return this.stateCache.computeIfAbsent(s, (Short2ObjectFunction)(sx -> this.level.getBlockState(blockPos))); + } + + public boolean isHole(BlockPos blockPos) { + return this.holeCache.computeIfAbsent(this.getCacheKey(blockPos), (Short2BooleanFunction)(s -> { + BlockState blockState = this.getBlockState(blockPos, s); + BlockPos blockPos2 = blockPos.below(); + BlockState blockState2 = this.level.getBlockState(blockPos2); + return FlowingFluid.this.isWaterHole(this.level, blockPos, blockState, blockPos2, blockState2); + })); + } + + private short getCacheKey(BlockPos blockPos) { + int i = blockPos.getX() - this.origin.getX(); + int j = blockPos.getZ() - this.origin.getZ(); + return (short)((i + 128 & 0xFF) << 8 | j + 128 & 0xFF); + } + } } diff --git a/net/minecraft/world/level/material/Fluid.java b/net/minecraft/world/level/material/Fluid.java index bdaeb173..1d6ed35f 100644 --- a/net/minecraft/world/level/material/Fluid.java +++ b/net/minecraft/world/level/material/Fluid.java @@ -7,6 +7,7 @@ import net.minecraft.core.Holder; import net.minecraft.core.IdMapper; import net.minecraft.core.particles.ParticleOptions; import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundEvent; import net.minecraft.tags.TagKey; import net.minecraft.util.RandomSource; @@ -53,10 +54,10 @@ public abstract class Fluid { protected void animateTick(Level level, BlockPos pos, FluidState state, RandomSource random) { } - protected void tick(Level level, BlockPos pos, FluidState state) { + protected void tick(ServerLevel serverLevel, BlockPos blockPos, BlockState blockState, FluidState fluidState) { } - protected void randomTick(Level level, BlockPos pos, FluidState state, RandomSource random) { + protected void randomTick(ServerLevel serverLevel, BlockPos blockPos, FluidState fluidState, RandomSource randomSource) { } @Nullable diff --git a/net/minecraft/world/level/material/FluidState.java b/net/minecraft/world/level/material/FluidState.java index 51cc2eab..1872d885 100644 --- a/net/minecraft/world/level/material/FluidState.java +++ b/net/minecraft/world/level/material/FluidState.java @@ -10,6 +10,7 @@ import net.minecraft.core.Holder; import net.minecraft.core.HolderSet; import net.minecraft.core.particles.ParticleOptions; import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.server.level.ServerLevel; import net.minecraft.tags.TagKey; import net.minecraft.util.RandomSource; import net.minecraft.world.level.BlockGetter; @@ -63,7 +64,7 @@ public final class FluidState extends StateHolder { for (int j = -1; j <= 1; j++) { BlockPos blockPos = pos.offset(i, 0, j); FluidState fluidState = level.getFluidState(blockPos); - if (!fluidState.getType().isSame(this.getType()) && !level.getBlockState(blockPos).isSolidRender(level, blockPos)) { + if (!fluidState.getType().isSame(this.getType()) && !level.getBlockState(blockPos).isSolidRender()) { return true; } } @@ -72,8 +73,8 @@ public final class FluidState extends StateHolder { return false; } - public void tick(Level level, BlockPos pos) { - this.getType().tick(level, pos, this); + public void tick(ServerLevel serverLevel, BlockPos blockPos, BlockState blockState) { + this.getType().tick(serverLevel, blockPos, blockState, this); } public void animateTick(Level level, BlockPos pos, RandomSource random) { @@ -84,8 +85,8 @@ public final class FluidState extends StateHolder { return this.getType().isRandomlyTicking(); } - public void randomTick(Level level, BlockPos pos, RandomSource random) { - this.getType().randomTick(level, pos, this, random); + public void randomTick(ServerLevel serverLevel, BlockPos blockPos, RandomSource randomSource) { + this.getType().randomTick(serverLevel, blockPos, this, randomSource); } public Vec3 getFlow(BlockGetter level, BlockPos pos) { diff --git a/net/minecraft/world/level/material/LavaFluid.java b/net/minecraft/world/level/material/LavaFluid.java index 32315466..90fdabbe 100644 --- a/net/minecraft/world/level/material/LavaFluid.java +++ b/net/minecraft/world/level/material/LavaFluid.java @@ -5,6 +5,7 @@ import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.particles.ParticleOptions; import net.minecraft.core.particles.ParticleTypes; +import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; @@ -45,7 +46,7 @@ public abstract class LavaFluid extends FlowingFluid { @Override public void animateTick(Level level, BlockPos pos, FluidState state, RandomSource random) { BlockPos blockPos = pos.above(); - if (level.getBlockState(blockPos).isAir() && !level.getBlockState(blockPos).isSolidRender(level, blockPos)) { + if (level.getBlockState(blockPos).isAir() && !level.getBlockState(blockPos).isSolidRender()) { if (random.nextInt(100) == 0) { double d = pos.getX() + random.nextDouble(); double e = pos.getY() + 1.0; @@ -70,22 +71,22 @@ public abstract class LavaFluid extends FlowingFluid { } @Override - public void randomTick(Level level, BlockPos pos, FluidState state, RandomSource random) { - if (level.getGameRules().getBoolean(GameRules.RULE_DOFIRETICK)) { - int i = random.nextInt(3); + public void randomTick(ServerLevel serverLevel, BlockPos blockPos, FluidState fluidState, RandomSource randomSource) { + if (serverLevel.getGameRules().getBoolean(GameRules.RULE_DOFIRETICK)) { + int i = randomSource.nextInt(3); if (i > 0) { - BlockPos blockPos = pos; + BlockPos blockPos2 = blockPos; for (int j = 0; j < i; j++) { - blockPos = blockPos.offset(random.nextInt(3) - 1, 1, random.nextInt(3) - 1); - if (!level.isLoaded(blockPos)) { + blockPos2 = blockPos2.offset(randomSource.nextInt(3) - 1, 1, randomSource.nextInt(3) - 1); + if (!serverLevel.isLoaded(blockPos2)) { return; } - BlockState blockState = level.getBlockState(blockPos); + BlockState blockState = serverLevel.getBlockState(blockPos2); if (blockState.isAir()) { - if (this.hasFlammableNeighbours(level, blockPos)) { - level.setBlockAndUpdate(blockPos, BaseFireBlock.getState(level, blockPos)); + if (this.hasFlammableNeighbours(serverLevel, blockPos2)) { + serverLevel.setBlockAndUpdate(blockPos2, BaseFireBlock.getState(serverLevel, blockPos2)); return; } } else if (blockState.blocksMotion()) { @@ -94,13 +95,13 @@ public abstract class LavaFluid extends FlowingFluid { } } else { for (int k = 0; k < 3; k++) { - BlockPos blockPos2 = pos.offset(random.nextInt(3) - 1, 0, random.nextInt(3) - 1); - if (!level.isLoaded(blockPos2)) { + BlockPos blockPos3 = blockPos.offset(randomSource.nextInt(3) - 1, 0, randomSource.nextInt(3) - 1); + if (!serverLevel.isLoaded(blockPos3)) { return; } - if (level.isEmptyBlock(blockPos2.above()) && this.isFlammable(level, blockPos2)) { - level.setBlockAndUpdate(blockPos2.above(), BaseFireBlock.getState(level, blockPos2)); + if (serverLevel.isEmptyBlock(blockPos3.above()) && this.isFlammable(serverLevel, blockPos3)) { + serverLevel.setBlockAndUpdate(blockPos3.above(), BaseFireBlock.getState(serverLevel, blockPos3)); } } } @@ -118,9 +119,7 @@ public abstract class LavaFluid extends FlowingFluid { } private boolean isFlammable(LevelReader level, BlockPos pos) { - return pos.getY() >= level.getMinBuildHeight() && pos.getY() < level.getMaxBuildHeight() && !level.hasChunkAt(pos) - ? false - : level.getBlockState(pos).ignitedByLava(); + return level.isInsideBuildHeight(pos.getY()) && !level.hasChunkAt(pos) ? false : level.getBlockState(pos).ignitedByLava(); } @Nullable @@ -184,8 +183,8 @@ public abstract class LavaFluid extends FlowingFluid { } @Override - protected boolean canConvertToSource(Level level) { - return level.getGameRules().getBoolean(GameRules.RULE_LAVA_SOURCE_CONVERSION); + protected boolean canConvertToSource(ServerLevel serverLevel) { + return serverLevel.getGameRules().getBoolean(GameRules.RULE_LAVA_SOURCE_CONVERSION); } @Override diff --git a/net/minecraft/world/level/material/MapColor.java b/net/minecraft/world/level/material/MapColor.java index bb17e70b..3ea815f7 100644 --- a/net/minecraft/world/level/material/MapColor.java +++ b/net/minecraft/world/level/material/MapColor.java @@ -1,6 +1,7 @@ package net.minecraft.world.level.material; import com.google.common.base.Preconditions; +import net.minecraft.util.ARGB; public class MapColor { private static final MapColor[] MATERIAL_COLORS = new MapColor[64]; @@ -79,16 +80,8 @@ public class MapColor { } } - public int calculateRGBColor(MapColor.Brightness brightness) { - if (this == NONE) { - return 0; - } else { - int i = brightness.modifier; - int j = (this.col >> 16 & 0xFF) * i / 255; - int k = (this.col >> 8 & 0xFF) * i / 255; - int l = (this.col & 0xFF) * i / 255; - return 0xFF000000 | l << 16 | k << 8 | j; - } + public int calculateARGBColor(MapColor.Brightness brightness) { + return this == NONE ? 0 : ARGB.scaleRGB(ARGB.opaque(this.col), brightness.modifier); } public static MapColor byId(int id) { @@ -103,7 +96,7 @@ public class MapColor { public static int getColorFromPackedId(int packedId) { int i = packedId & 0xFF; - return byIdUnsafe(i >> 2).calculateRGBColor(MapColor.Brightness.byIdUnsafe(i & 3)); + return byIdUnsafe(i >> 2).calculateARGBColor(MapColor.Brightness.byIdUnsafe(i & 3)); } public byte getPackedId(MapColor.Brightness brightness) { diff --git a/net/minecraft/world/level/material/WaterFluid.java b/net/minecraft/world/level/material/WaterFluid.java index 63848439..21c19700 100644 --- a/net/minecraft/world/level/material/WaterFluid.java +++ b/net/minecraft/world/level/material/WaterFluid.java @@ -5,6 +5,7 @@ import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.particles.ParticleOptions; import net.minecraft.core.particles.ParticleTypes; +import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; @@ -70,8 +71,8 @@ public abstract class WaterFluid extends FlowingFluid { } @Override - protected boolean canConvertToSource(Level level) { - return level.getGameRules().getBoolean(GameRules.RULE_WATER_SOURCE_CONVERSION); + protected boolean canConvertToSource(ServerLevel serverLevel) { + return serverLevel.getGameRules().getBoolean(GameRules.RULE_WATER_SOURCE_CONVERSION); } @Override diff --git a/net/minecraft/world/level/pathfinder/FlyNodeEvaluator.java b/net/minecraft/world/level/pathfinder/FlyNodeEvaluator.java index 6c41b08e..08ee17a9 100644 --- a/net/minecraft/world/level/pathfinder/FlyNodeEvaluator.java +++ b/net/minecraft/world/level/pathfinder/FlyNodeEvaluator.java @@ -291,7 +291,7 @@ public class FlyNodeEvaluator extends WalkNodeEvaluator { @Override public PathType getPathType(PathfindingContext context, int x, int y, int z) { PathType pathType = context.getPathTypeFromState(x, y, z); - if (pathType == PathType.OPEN && y >= context.level().getMinBuildHeight() + 1) { + if (pathType == PathType.OPEN && y >= context.level().getMinY() + 1) { BlockPos blockPos = new BlockPos(x, y - 1, z); PathType pathType2 = context.getPathTypeFromState(blockPos.getX(), blockPos.getY(), blockPos.getZ()); if (pathType2 == PathType.DAMAGE_FIRE || pathType2 == PathType.LAVA) { diff --git a/net/minecraft/world/level/pathfinder/PathFinder.java b/net/minecraft/world/level/pathfinder/PathFinder.java index 94987a8f..5731fe70 100644 --- a/net/minecraft/world/level/pathfinder/PathFinder.java +++ b/net/minecraft/world/level/pathfinder/PathFinder.java @@ -11,6 +11,7 @@ import java.util.Set; import java.util.function.Function; import java.util.stream.Collectors; import net.minecraft.core.BlockPos; +import net.minecraft.util.profiling.Profiler; import net.minecraft.util.profiling.ProfilerFiller; import net.minecraft.util.profiling.metrics.MetricCategory; import net.minecraft.world.entity.Mob; @@ -20,7 +21,7 @@ import org.jetbrains.annotations.Nullable; public class PathFinder { private static final float FUDGING = 1.5F; private final Node[] neighbors = new Node[32]; - private final int maxVisitedNodes; + private int maxVisitedNodes; private final NodeEvaluator nodeEvaluator; private static final boolean DEBUG = false; private final BinaryHeap openSet = new BinaryHeap(); @@ -30,6 +31,10 @@ public class PathFinder { this.maxVisitedNodes = maxVisitedNodes; } + public void setMaxVisitedNodes(int i) { + this.maxVisitedNodes = i; + } + /** * Finds a path to one of the specified positions and post-processes it or returns null if no path could be found within given accuracy */ @@ -43,29 +48,30 @@ public class PathFinder { } else { Map map = (Map)targetPositions.stream() .collect(Collectors.toMap(blockPos -> this.nodeEvaluator.getTarget(blockPos.getX(), blockPos.getY(), blockPos.getZ()), Function.identity())); - Path path = this.findPath(region.getProfiler(), node, map, maxRange, accuracy, searchDepthMultiplier); + Path path = this.findPath(node, map, maxRange, accuracy, searchDepthMultiplier); this.nodeEvaluator.done(); return path; } } @Nullable - private Path findPath(ProfilerFiller profiler, Node node, Map targetPos, float maxRange, int accuracy, float searchDepthMultiplier) { - profiler.push("find_path"); - profiler.markForCharting(MetricCategory.PATH_FINDING); - Set set = targetPos.keySet(); + private Path findPath(Node node, Map map, float f, int i, float g) { + ProfilerFiller profilerFiller = Profiler.get(); + profilerFiller.push("find_path"); + profilerFiller.markForCharting(MetricCategory.PATH_FINDING); + Set set = map.keySet(); node.g = 0.0F; node.h = this.getBestH(node, set); node.f = node.h; this.openSet.clear(); this.openSet.insert(node); Set set2 = ImmutableSet.of(); - int i = 0; + int j = 0; Set set3 = Sets.newHashSetWithExpectedSize(set.size()); - int j = (int)(this.maxVisitedNodes * searchDepthMultiplier); + int k = (int)(this.maxVisitedNodes * g); while (!this.openSet.isEmpty()) { - if (++i >= j) { + if (++j >= k) { break; } @@ -73,7 +79,7 @@ public class PathFinder { node2.closed = true; for (Target target : set) { - if (node2.distanceManhattan(target) <= accuracy) { + if (node2.distanceManhattan(target) <= i) { target.setReached(); set3.add(target); } @@ -83,17 +89,17 @@ public class PathFinder { break; } - if (!(node2.distanceTo(node) >= maxRange)) { - int k = this.nodeEvaluator.getNeighbors(this.neighbors, node2); + if (!(node2.distanceTo(node) >= f)) { + int l = this.nodeEvaluator.getNeighbors(this.neighbors, node2); - for (int l = 0; l < k; l++) { - Node node3 = this.neighbors[l]; - float f = this.distance(node2, node3); - node3.walkedDistance = node2.walkedDistance + f; - float g = node2.g + f + node3.costMalus; - if (node3.walkedDistance < maxRange && (!node3.inOpenSet() || g < node3.g)) { + for (int m = 0; m < l; m++) { + Node node3 = this.neighbors[m]; + float h = this.distance(node2, node3); + node3.walkedDistance = node2.walkedDistance + h; + float n = node2.g + h + node3.costMalus; + if (node3.walkedDistance < f && (!node3.inOpenSet() || n < node3.g)) { node3.cameFrom = node2; - node3.g = g; + node3.g = n; node3.h = this.getBestH(node3, set) * 1.5F; if (node3.inOpenSet()) { this.openSet.changeCost(node3, node3.g + node3.h); @@ -108,12 +114,12 @@ public class PathFinder { Optional optional = !set3.isEmpty() ? set3.stream() - .map(targetx -> this.reconstructPath(targetx.getBestNode(), (BlockPos)targetPos.get(targetx), true)) + .map(targetx -> this.reconstructPath(targetx.getBestNode(), (BlockPos)map.get(targetx), true)) .min(Comparator.comparingInt(Path::getNodeCount)) : set.stream() - .map(targetx -> this.reconstructPath(targetx.getBestNode(), (BlockPos)targetPos.get(targetx), false)) + .map(targetx -> this.reconstructPath(targetx.getBestNode(), (BlockPos)map.get(targetx), false)) .min(Comparator.comparingDouble(Path::getDistToTarget).thenComparingInt(Path::getNodeCount)); - profiler.pop(); + profilerFiller.pop(); return optional.isEmpty() ? null : (Path)optional.get(); } diff --git a/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java b/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java index ed0e4e9c..330354ba 100644 --- a/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java +++ b/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java @@ -71,7 +71,7 @@ public class WalkNodeEvaluator extends NodeEvaluator { } else { mutableBlockPos.set(this.mob.getX(), this.mob.getY() + 1.0, this.mob.getZ()); - while (mutableBlockPos.getY() > this.currentContext.level().getMinBuildHeight()) { + while (mutableBlockPos.getY() > this.currentContext.level().getMinY()) { i = mutableBlockPos.getY(); mutableBlockPos.setY(mutableBlockPos.getY() - 1); BlockState blockState2 = this.currentContext.getBlockState(mutableBlockPos); @@ -312,7 +312,7 @@ public class WalkNodeEvaluator extends NodeEvaluator { private Node tryFindFirstNonWaterBelow(int x, int y, int z, @Nullable Node node) { y--; - while (y > this.mob.level().getMinBuildHeight()) { + while (y > this.mob.level().getMinY()) { PathType pathType = this.getCachedPathType(x, y, z); if (pathType != PathType.WATER) { return node; @@ -326,7 +326,7 @@ public class WalkNodeEvaluator extends NodeEvaluator { } private Node tryFindFirstGroundNodeBelow(int x, int y, int z) { - for (int i = y - 1; i >= this.mob.level().getMinBuildHeight(); i--) { + for (int i = y - 1; i >= this.mob.level().getMinY(); i--) { if (y - i > this.mob.getMaxFallDistance()) { return this.getBlockedNode(x, i, z); } @@ -432,7 +432,7 @@ public class WalkNodeEvaluator extends NodeEvaluator { int j = pos.getY(); int k = pos.getZ(); PathType pathType = context.getPathTypeFromState(i, j, k); - if (pathType == PathType.OPEN && j >= context.level().getMinBuildHeight() + 1) { + if (pathType == PathType.OPEN && j >= context.level().getMinY() + 1) { return switch (context.getPathTypeFromState(i, j - 1, k)) { case OPEN, WATER, LAVA, WALKABLE -> PathType.OPEN; case DAMAGE_FIRE -> PathType.DAMAGE_FIRE; diff --git a/net/minecraft/world/level/portal/DimensionTransition.java b/net/minecraft/world/level/portal/DimensionTransition.java deleted file mode 100644 index e10333fa..00000000 --- a/net/minecraft/world/level/portal/DimensionTransition.java +++ /dev/null @@ -1,62 +0,0 @@ -package net.minecraft.world.level.portal; - -import net.minecraft.core.BlockPos; -import net.minecraft.network.protocol.game.ClientboundLevelEventPacket; -import net.minecraft.server.level.ServerLevel; -import net.minecraft.server.level.ServerPlayer; -import net.minecraft.world.entity.Entity; -import net.minecraft.world.phys.Vec3; - -public record DimensionTransition( - ServerLevel newLevel, - Vec3 pos, - Vec3 speed, - float yRot, - float xRot, - boolean missingRespawnBlock, - DimensionTransition.PostDimensionTransition postDimensionTransition -) { - public static final DimensionTransition.PostDimensionTransition DO_NOTHING = entity -> {}; - public static final DimensionTransition.PostDimensionTransition PLAY_PORTAL_SOUND = DimensionTransition::playPortalSound; - public static final DimensionTransition.PostDimensionTransition PLACE_PORTAL_TICKET = DimensionTransition::placePortalTicket; - - public DimensionTransition( - ServerLevel newLevel, Vec3 pos, Vec3 speed, float yRot, float xRot, DimensionTransition.PostDimensionTransition postDimensionTransition - ) { - this(newLevel, pos, speed, yRot, xRot, false, postDimensionTransition); - } - - public DimensionTransition(ServerLevel newLevel, Entity entity, DimensionTransition.PostDimensionTransition postDimensionTransition) { - this(newLevel, findAdjustedSharedSpawnPos(newLevel, entity), Vec3.ZERO, 0.0F, 0.0F, false, postDimensionTransition); - } - - private static void playPortalSound(Entity entity) { - if (entity instanceof ServerPlayer serverPlayer) { - serverPlayer.connection.send(new ClientboundLevelEventPacket(1032, BlockPos.ZERO, 0, false)); - } - } - - private static void placePortalTicket(Entity entity) { - entity.placePortalTicket(BlockPos.containing(entity.position())); - } - - public static DimensionTransition missingRespawnBlock(ServerLevel level, Entity entity, DimensionTransition.PostDimensionTransition postDimensionTransition) { - return new DimensionTransition(level, findAdjustedSharedSpawnPos(level, entity), Vec3.ZERO, 0.0F, 0.0F, true, postDimensionTransition); - } - - private static Vec3 findAdjustedSharedSpawnPos(ServerLevel newLevel, Entity entity) { - return entity.adjustSpawnLocation(newLevel, newLevel.getSharedSpawnPos()).getBottomCenter(); - } - - @FunctionalInterface - public interface PostDimensionTransition { - void onTransition(Entity entity); - - default DimensionTransition.PostDimensionTransition then(DimensionTransition.PostDimensionTransition postDimensionTransition) { - return entity -> { - this.onTransition(entity); - postDimensionTransition.onTransition(entity); - }; - } - } -} diff --git a/net/minecraft/world/level/portal/PortalForcer.java b/net/minecraft/world/level/portal/PortalForcer.java index 9e93a774..bf486a4b 100644 --- a/net/minecraft/world/level/portal/PortalForcer.java +++ b/net/minecraft/world/level/portal/PortalForcer.java @@ -2,7 +2,7 @@ package net.minecraft.world.level.portal; import java.util.Comparator; import java.util.Optional; -import net.minecraft.BlockUtil; +import net.minecraft.BlockUtil.FoundRectangle; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.Vec3i; @@ -49,14 +49,14 @@ public class PortalForcer { .min(Comparator.comparingDouble(blockPos2 -> blockPos2.distSqr(exitPos)).thenComparingInt(Vec3i::getY)); } - public Optional createPortal(BlockPos pos, Direction.Axis axis) { + public Optional createPortal(BlockPos pos, Direction.Axis axis) { Direction direction = Direction.get(Direction.AxisDirection.POSITIVE, axis); double d = -1.0; BlockPos blockPos = null; double e = -1.0; BlockPos blockPos2 = null; WorldBorder worldBorder = this.level.getWorldBorder(); - int i = Math.min(this.level.getMaxBuildHeight(), this.level.getMinBuildHeight() + this.level.getLogicalHeight()) - 1; + int i = Math.min(this.level.getMaxY(), this.level.getMinY() + this.level.getLogicalHeight() - 1); int j = 1; BlockPos.MutableBlockPos mutableBlockPos = pos.mutable(); @@ -65,12 +65,12 @@ public class PortalForcer { if (worldBorder.isWithinBounds(mutableBlockPos2) && worldBorder.isWithinBounds(mutableBlockPos2.move(direction, 1))) { mutableBlockPos2.move(direction.getOpposite(), 1); - for (int l = k; l >= this.level.getMinBuildHeight(); l--) { + for (int l = k; l >= this.level.getMinY(); l--) { mutableBlockPos2.setY(l); if (this.canPortalReplaceBlock(mutableBlockPos2)) { int m = l; - while (l > this.level.getMinBuildHeight() && this.canPortalReplaceBlock(mutableBlockPos2.move(Direction.DOWN))) { + while (l > this.level.getMinY() && this.canPortalReplaceBlock(mutableBlockPos2.move(Direction.DOWN))) { l--; } @@ -105,7 +105,7 @@ public class PortalForcer { } if (d == -1.0) { - int o = Math.max(this.level.getMinBuildHeight() - -1, 70); + int o = Math.max(this.level.getMinY() - -1, 70); int p = i - 9; if (p < o) { return Optional.empty(); @@ -144,7 +144,7 @@ public class PortalForcer { } } - return Optional.of(new BlockUtil.FoundRectangle(blockPos.immutable(), 2, 3)); + return Optional.of(new FoundRectangle(blockPos.immutable(), 2, 3)); } private boolean canPortalReplaceBlock(BlockPos.MutableBlockPos pos) { diff --git a/net/minecraft/world/level/portal/PortalShape.java b/net/minecraft/world/level/portal/PortalShape.java index a5f4d17f..91711a64 100644 --- a/net/minecraft/world/level/portal/PortalShape.java +++ b/net/minecraft/world/level/portal/PortalShape.java @@ -2,7 +2,7 @@ package net.minecraft.world.level.portal; import java.util.Optional; import java.util.function.Predicate; -import net.minecraft.BlockUtil; +import net.minecraft.BlockUtil.FoundRectangle; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.server.level.ServerLevel; @@ -10,6 +10,7 @@ import net.minecraft.tags.BlockTags; import net.minecraft.util.Mth; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityDimensions; +import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.NetherPortalBlock; @@ -19,6 +20,7 @@ import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.shapes.Shapes; import net.minecraft.world.phys.shapes.VoxelShape; +import org.apache.commons.lang3.mutable.MutableInt; import org.jetbrains.annotations.Nullable; public class PortalShape { @@ -29,79 +31,86 @@ public class PortalShape { private static final BlockBehaviour.StatePredicate FRAME = (blockState, blockGetter, blockPos) -> blockState.is(Blocks.OBSIDIAN); private static final float SAFE_TRAVEL_MAX_ENTITY_XY = 4.0F; private static final double SAFE_TRAVEL_MAX_VERTICAL_DELTA = 1.0; - private final LevelAccessor level; private final Direction.Axis axis; private final Direction rightDir; - private int numPortalBlocks; - @Nullable - private BlockPos bottomLeft; - private int height; + private final int numPortalBlocks; + private final BlockPos bottomLeft; + private final int height; private final int width; + private PortalShape(Direction.Axis axis, int i, Direction direction, BlockPos blockPos, int j, int k) { + this.axis = axis; + this.numPortalBlocks = i; + this.rightDir = direction; + this.bottomLeft = blockPos; + this.width = j; + this.height = k; + } + public static Optional findEmptyPortalShape(LevelAccessor level, BlockPos bottomLeft, Direction.Axis axis) { return findPortalShape(level, bottomLeft, portalShape -> portalShape.isValid() && portalShape.numPortalBlocks == 0, axis); } public static Optional findPortalShape(LevelAccessor level, BlockPos bottomLeft, Predicate predicate, Direction.Axis axis) { - Optional optional = Optional.of(new PortalShape(level, bottomLeft, axis)).filter(predicate); + Optional optional = Optional.of(findAnyShape(level, bottomLeft, axis)).filter(predicate); if (optional.isPresent()) { return optional; } else { Direction.Axis axis2 = axis == Direction.Axis.X ? Direction.Axis.Z : Direction.Axis.X; - return Optional.of(new PortalShape(level, bottomLeft, axis2)).filter(predicate); + return Optional.of(findAnyShape(level, bottomLeft, axis2)).filter(predicate); } } - public PortalShape(LevelAccessor level, BlockPos bottomLeft, Direction.Axis axis) { - this.level = level; - this.axis = axis; - this.rightDir = axis == Direction.Axis.X ? Direction.WEST : Direction.SOUTH; - this.bottomLeft = this.calculateBottomLeft(bottomLeft); - if (this.bottomLeft == null) { - this.bottomLeft = bottomLeft; - this.width = 1; - this.height = 1; + public static PortalShape findAnyShape(BlockGetter blockGetter, BlockPos blockPos, Direction.Axis axis) { + Direction direction = axis == Direction.Axis.X ? Direction.WEST : Direction.SOUTH; + BlockPos blockPos2 = calculateBottomLeft(blockGetter, direction, blockPos); + if (blockPos2 == null) { + return new PortalShape(axis, 0, direction, blockPos, 0, 0); } else { - this.width = this.calculateWidth(); - if (this.width > 0) { - this.height = this.calculateHeight(); + int i = calculateWidth(blockGetter, blockPos2, direction); + if (i == 0) { + return new PortalShape(axis, 0, direction, blockPos2, 0, 0); + } else { + MutableInt mutableInt = new MutableInt(); + int j = calculateHeight(blockGetter, blockPos2, direction, i, mutableInt); + return new PortalShape(axis, mutableInt.getValue(), direction, blockPos2, i, j); } } } @Nullable - private BlockPos calculateBottomLeft(BlockPos pos) { - int i = Math.max(this.level.getMinBuildHeight(), pos.getY() - 21); + private static BlockPos calculateBottomLeft(BlockGetter blockGetter, Direction direction, BlockPos blockPos) { + int i = Math.max(blockGetter.getMinY(), blockPos.getY() - 21); - while (pos.getY() > i && isEmpty(this.level.getBlockState(pos.below()))) { - pos = pos.below(); + while (blockPos.getY() > i && isEmpty(blockGetter.getBlockState(blockPos.below()))) { + blockPos = blockPos.below(); } - Direction direction = this.rightDir.getOpposite(); - int j = this.getDistanceUntilEdgeAboveFrame(pos, direction) - 1; - return j < 0 ? null : pos.relative(direction, j); + Direction direction2 = direction.getOpposite(); + int j = getDistanceUntilEdgeAboveFrame(blockGetter, blockPos, direction2) - 1; + return j < 0 ? null : blockPos.relative(direction2, j); } - private int calculateWidth() { - int i = this.getDistanceUntilEdgeAboveFrame(this.bottomLeft, this.rightDir); + private static int calculateWidth(BlockGetter blockGetter, BlockPos blockPos, Direction direction) { + int i = getDistanceUntilEdgeAboveFrame(blockGetter, blockPos, direction); return i >= 2 && i <= 21 ? i : 0; } - private int getDistanceUntilEdgeAboveFrame(BlockPos pos, Direction direction) { + private static int getDistanceUntilEdgeAboveFrame(BlockGetter blockGetter, BlockPos blockPos, Direction direction) { BlockPos.MutableBlockPos mutableBlockPos = new BlockPos.MutableBlockPos(); for (int i = 0; i <= 21; i++) { - mutableBlockPos.set(pos).move(direction, i); - BlockState blockState = this.level.getBlockState(mutableBlockPos); + mutableBlockPos.set(blockPos).move(direction, i); + BlockState blockState = blockGetter.getBlockState(mutableBlockPos); if (!isEmpty(blockState)) { - if (FRAME.test(blockState, this.level, mutableBlockPos)) { + if (FRAME.test(blockState, blockGetter, mutableBlockPos)) { return i; } break; } - BlockState blockState2 = this.level.getBlockState(mutableBlockPos.move(Direction.DOWN)); - if (!FRAME.test(blockState2, this.level, mutableBlockPos)) { + BlockState blockState2 = blockGetter.getBlockState(mutableBlockPos.move(Direction.DOWN)); + if (!FRAME.test(blockState2, blockGetter, mutableBlockPos)) { break; } } @@ -109,16 +118,16 @@ public class PortalShape { return 0; } - private int calculateHeight() { + private static int calculateHeight(BlockGetter blockGetter, BlockPos blockPos, Direction direction, int i, MutableInt mutableInt) { BlockPos.MutableBlockPos mutableBlockPos = new BlockPos.MutableBlockPos(); - int i = this.getDistanceUntilTop(mutableBlockPos); - return i >= 3 && i <= 21 && this.hasTopFrame(mutableBlockPos, i) ? i : 0; + int j = getDistanceUntilTop(blockGetter, blockPos, direction, mutableBlockPos, i, mutableInt); + return j >= 3 && j <= 21 && hasTopFrame(blockGetter, blockPos, direction, mutableBlockPos, i, j) ? j : 0; } - private boolean hasTopFrame(BlockPos.MutableBlockPos pos, int distanceToTop) { - for (int i = 0; i < this.width; i++) { - BlockPos.MutableBlockPos mutableBlockPos = pos.set(this.bottomLeft).move(Direction.UP, distanceToTop).move(this.rightDir, i); - if (!FRAME.test(this.level.getBlockState(mutableBlockPos), this.level, mutableBlockPos)) { + private static boolean hasTopFrame(BlockGetter blockGetter, BlockPos blockPos, Direction direction, BlockPos.MutableBlockPos mutableBlockPos, int i, int j) { + for (int k = 0; k < i; k++) { + BlockPos.MutableBlockPos mutableBlockPos2 = mutableBlockPos.set(blockPos).move(Direction.UP, j).move(direction, k); + if (!FRAME.test(blockGetter.getBlockState(mutableBlockPos2), blockGetter, mutableBlockPos2)) { return false; } } @@ -126,27 +135,29 @@ public class PortalShape { return true; } - private int getDistanceUntilTop(BlockPos.MutableBlockPos pos) { - for (int i = 0; i < 21; i++) { - pos.set(this.bottomLeft).move(Direction.UP, i).move(this.rightDir, -1); - if (!FRAME.test(this.level.getBlockState(pos), this.level, pos)) { - return i; + private static int getDistanceUntilTop( + BlockGetter blockGetter, BlockPos blockPos, Direction direction, BlockPos.MutableBlockPos mutableBlockPos, int i, MutableInt mutableInt + ) { + for (int j = 0; j < 21; j++) { + mutableBlockPos.set(blockPos).move(Direction.UP, j).move(direction, -1); + if (!FRAME.test(blockGetter.getBlockState(mutableBlockPos), blockGetter, mutableBlockPos)) { + return j; } - pos.set(this.bottomLeft).move(Direction.UP, i).move(this.rightDir, this.width); - if (!FRAME.test(this.level.getBlockState(pos), this.level, pos)) { - return i; + mutableBlockPos.set(blockPos).move(Direction.UP, j).move(direction, i); + if (!FRAME.test(blockGetter.getBlockState(mutableBlockPos), blockGetter, mutableBlockPos)) { + return j; } - for (int j = 0; j < this.width; j++) { - pos.set(this.bottomLeft).move(Direction.UP, i).move(this.rightDir, j); - BlockState blockState = this.level.getBlockState(pos); + for (int k = 0; k < i; k++) { + mutableBlockPos.set(blockPos).move(Direction.UP, j).move(direction, k); + BlockState blockState = blockGetter.getBlockState(mutableBlockPos); if (!isEmpty(blockState)) { - return i; + return j; } if (blockState.is(Blocks.NETHER_PORTAL)) { - this.numPortalBlocks++; + mutableInt.increment(); } } } @@ -159,20 +170,20 @@ public class PortalShape { } public boolean isValid() { - return this.bottomLeft != null && this.width >= 2 && this.width <= 21 && this.height >= 3 && this.height <= 21; + return this.width >= 2 && this.width <= 21 && this.height >= 3 && this.height <= 21; } - public void createPortalBlocks() { + public void createPortalBlocks(LevelAccessor levelAccessor) { BlockState blockState = Blocks.NETHER_PORTAL.defaultBlockState().setValue(NetherPortalBlock.AXIS, this.axis); BlockPos.betweenClosed(this.bottomLeft, this.bottomLeft.relative(Direction.UP, this.height - 1).relative(this.rightDir, this.width - 1)) - .forEach(blockPos -> this.level.setBlock(blockPos, blockState, 18)); + .forEach(blockPos -> levelAccessor.setBlock(blockPos, blockState, 18)); } public boolean isComplete() { return this.isValid() && this.numPortalBlocks == this.width * this.height; } - public static Vec3 getRelativePosition(BlockUtil.FoundRectangle foundRectangle, Direction.Axis axis, Vec3 pos, EntityDimensions entityDimensions) { + public static Vec3 getRelativePosition(FoundRectangle foundRectangle, Direction.Axis axis, Vec3 pos, EntityDimensions entityDimensions) { double d = (double)foundRectangle.axis1Size - entityDimensions.width(); double e = (double)foundRectangle.axis2Size - entityDimensions.height(); BlockPos blockPos = foundRectangle.minCorner; diff --git a/net/minecraft/world/level/portal/TeleportTransition.java b/net/minecraft/world/level/portal/TeleportTransition.java new file mode 100644 index 00000000..5884aae3 --- /dev/null +++ b/net/minecraft/world/level/portal/TeleportTransition.java @@ -0,0 +1,114 @@ +package net.minecraft.world.level.portal; + +import java.util.Set; +import net.minecraft.core.BlockPos; +import net.minecraft.network.protocol.game.ClientboundLevelEventPacket; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.Relative; +import net.minecraft.world.phys.Vec3; + +public record TeleportTransition( + ServerLevel newLevel, + Vec3 position, + Vec3 deltaMovement, + float yRot, + float xRot, + boolean missingRespawnBlock, + boolean asPassenger, + Set relatives, + TeleportTransition.PostTeleportTransition postTeleportTransition +) { + public static final TeleportTransition.PostTeleportTransition DO_NOTHING = entity -> {}; + public static final TeleportTransition.PostTeleportTransition PLAY_PORTAL_SOUND = TeleportTransition::playPortalSound; + public static final TeleportTransition.PostTeleportTransition PLACE_PORTAL_TICKET = TeleportTransition::placePortalTicket; + + public TeleportTransition(ServerLevel serverLevel, Vec3 vec3, Vec3 vec32, float f, float g, TeleportTransition.PostTeleportTransition postTeleportTransition) { + this(serverLevel, vec3, vec32, f, g, Set.of(), postTeleportTransition); + } + + public TeleportTransition( + ServerLevel serverLevel, Vec3 vec3, Vec3 vec32, float f, float g, Set set, TeleportTransition.PostTeleportTransition postTeleportTransition + ) { + this(serverLevel, vec3, vec32, f, g, false, false, set, postTeleportTransition); + } + + public TeleportTransition(ServerLevel serverLevel, Entity entity, TeleportTransition.PostTeleportTransition postTeleportTransition) { + this(serverLevel, findAdjustedSharedSpawnPos(serverLevel, entity), Vec3.ZERO, 0.0F, 0.0F, false, false, Set.of(), postTeleportTransition); + } + + private static void playPortalSound(Entity entity) { + if (entity instanceof ServerPlayer serverPlayer) { + serverPlayer.connection.send(new ClientboundLevelEventPacket(1032, BlockPos.ZERO, 0, false)); + } + } + + private static void placePortalTicket(Entity entity) { + entity.placePortalTicket(BlockPos.containing(entity.position())); + } + + public static TeleportTransition missingRespawnBlock(ServerLevel serverLevel, Entity entity, TeleportTransition.PostTeleportTransition postTeleportTransition) { + return new TeleportTransition( + serverLevel, findAdjustedSharedSpawnPos(serverLevel, entity), Vec3.ZERO, 0.0F, 0.0F, true, false, Set.of(), postTeleportTransition + ); + } + + private static Vec3 findAdjustedSharedSpawnPos(ServerLevel serverLevel, Entity entity) { + return entity.adjustSpawnLocation(serverLevel, serverLevel.getSharedSpawnPos()).getBottomCenter(); + } + + public TeleportTransition withRotation(float f, float g) { + return new TeleportTransition( + this.newLevel(), + this.position(), + this.deltaMovement(), + f, + g, + this.missingRespawnBlock(), + this.asPassenger(), + this.relatives(), + this.postTeleportTransition() + ); + } + + public TeleportTransition withPosition(Vec3 vec3) { + return new TeleportTransition( + this.newLevel(), + vec3, + this.deltaMovement(), + this.yRot(), + this.xRot(), + this.missingRespawnBlock(), + this.asPassenger(), + this.relatives(), + this.postTeleportTransition() + ); + } + + public TeleportTransition transitionAsPassenger() { + return new TeleportTransition( + this.newLevel(), + this.position(), + this.deltaMovement(), + this.yRot(), + this.xRot(), + this.missingRespawnBlock(), + true, + this.relatives(), + this.postTeleportTransition() + ); + } + + @FunctionalInterface + public interface PostTeleportTransition { + void onTransition(Entity entity); + + default TeleportTransition.PostTeleportTransition then(TeleportTransition.PostTeleportTransition postTeleportTransition) { + return entity -> { + this.onTransition(entity); + postTeleportTransition.onTransition(entity); + }; + } + } +} diff --git a/net/minecraft/world/level/redstone/CollectingNeighborUpdater.java b/net/minecraft/world/level/redstone/CollectingNeighborUpdater.java index 3bc8ca9c..186af9ac 100644 --- a/net/minecraft/world/level/redstone/CollectingNeighborUpdater.java +++ b/net/minecraft/world/level/redstone/CollectingNeighborUpdater.java @@ -6,6 +6,7 @@ import java.util.ArrayList; import java.util.List; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; +import net.minecraft.world.flag.FeatureFlags; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.state.BlockState; @@ -31,18 +32,18 @@ public class CollectingNeighborUpdater implements NeighborUpdater { } @Override - public void neighborChanged(BlockPos pos, Block neighborBlock, BlockPos neighborPos) { - this.addAndRun(pos, new CollectingNeighborUpdater.SimpleNeighborUpdate(pos, neighborBlock, neighborPos.immutable())); + public void neighborChanged(BlockPos blockPos, Block block, @Nullable Orientation orientation) { + this.addAndRun(blockPos, new CollectingNeighborUpdater.SimpleNeighborUpdate(blockPos, block, orientation)); } @Override - public void neighborChanged(BlockState state, BlockPos pos, Block neighborBlock, BlockPos neighborPos, boolean movedByPiston) { - this.addAndRun(pos, new CollectingNeighborUpdater.FullNeighborUpdate(state, pos.immutable(), neighborBlock, neighborPos.immutable(), movedByPiston)); + public void neighborChanged(BlockState blockState, BlockPos blockPos, Block block, @Nullable Orientation orientation, boolean bl) { + this.addAndRun(blockPos, new CollectingNeighborUpdater.FullNeighborUpdate(blockState, blockPos.immutable(), block, orientation, bl)); } @Override - public void updateNeighborsAtExceptFromFacing(BlockPos pos, Block block, @Nullable Direction facing) { - this.addAndRun(pos, new CollectingNeighborUpdater.MultiNeighborUpdate(pos.immutable(), block, facing)); + public void updateNeighborsAtExceptFromFacing(BlockPos blockPos, Block block, @Nullable Direction direction, @Nullable Orientation orientation) { + this.addAndRun(blockPos, new CollectingNeighborUpdater.MultiNeighborUpdate(blockPos.immutable(), block, orientation, direction)); } private void addAndRun(BlockPos pos, CollectingNeighborUpdater.NeighborUpdates updates) { @@ -88,11 +89,11 @@ public class CollectingNeighborUpdater implements NeighborUpdater { } } - record FullNeighborUpdate(BlockState state, BlockPos pos, Block block, BlockPos neighborPos, boolean movedByPiston) + record FullNeighborUpdate(BlockState state, BlockPos pos, Block block, @Nullable Orientation orientation, boolean movedByPiston) implements CollectingNeighborUpdater.NeighborUpdates { @Override public boolean runNext(Level level) { - NeighborUpdater.executeUpdate(level, this.state, this.pos, this.block, this.neighborPos, this.movedByPiston); + NeighborUpdater.executeUpdate(level, this.state, this.pos, this.block, this.orientation, this.movedByPiston); return false; } } @@ -101,23 +102,36 @@ public class CollectingNeighborUpdater implements NeighborUpdater { private final BlockPos sourcePos; private final Block sourceBlock; @Nullable + private Orientation orientation; + @Nullable private final Direction skipDirection; private int idx = 0; - MultiNeighborUpdate(BlockPos sourcePos, Block sourceBlock, @Nullable Direction skipDirection) { - this.sourcePos = sourcePos; - this.sourceBlock = sourceBlock; - this.skipDirection = skipDirection; - if (NeighborUpdater.UPDATE_ORDER[this.idx] == skipDirection) { + MultiNeighborUpdate(BlockPos blockPos, Block block, @Nullable Orientation orientation, @Nullable Direction direction) { + this.sourcePos = blockPos; + this.sourceBlock = block; + this.orientation = orientation; + this.skipDirection = direction; + if (NeighborUpdater.UPDATE_ORDER[this.idx] == direction) { this.idx++; } } @Override public boolean runNext(Level level) { - BlockPos blockPos = this.sourcePos.relative(NeighborUpdater.UPDATE_ORDER[this.idx++]); + Direction direction = NeighborUpdater.UPDATE_ORDER[this.idx++]; + BlockPos blockPos = this.sourcePos.relative(direction); BlockState blockState = level.getBlockState(blockPos); - NeighborUpdater.executeUpdate(level, blockState, blockPos, this.sourceBlock, this.sourcePos, false); + Orientation orientation = null; + if (level.enabledFeatures().contains(FeatureFlags.REDSTONE_EXPERIMENTS)) { + if (this.orientation == null) { + this.orientation = ExperimentalRedstoneUtils.initialOrientation(level, this.skipDirection == null ? null : this.skipDirection.getOpposite(), null); + } + + orientation = this.orientation.withFront(direction); + } + + NeighborUpdater.executeUpdate(level, blockState, blockPos, this.sourceBlock, orientation, false); if (this.idx < NeighborUpdater.UPDATE_ORDER.length && NeighborUpdater.UPDATE_ORDER[this.idx] == this.skipDirection) { this.idx++; } @@ -130,20 +144,20 @@ public class CollectingNeighborUpdater implements NeighborUpdater { boolean runNext(Level level); } - record ShapeUpdate(Direction direction, BlockState state, BlockPos pos, BlockPos neighborPos, int updateFlags, int updateLimit) + record ShapeUpdate(Direction direction, BlockState neighborState, BlockPos pos, BlockPos neighborPos, int updateFlags, int updateLimit) implements CollectingNeighborUpdater.NeighborUpdates { @Override public boolean runNext(Level level) { - NeighborUpdater.executeShapeUpdate(level, this.direction, this.state, this.pos, this.neighborPos, this.updateFlags, this.updateLimit); + NeighborUpdater.executeShapeUpdate(level, this.direction, this.pos, this.neighborPos, this.neighborState, this.updateFlags, this.updateLimit); return false; } } - record SimpleNeighborUpdate(BlockPos pos, Block block, BlockPos neighborPos) implements CollectingNeighborUpdater.NeighborUpdates { + record SimpleNeighborUpdate(BlockPos pos, Block block, @Nullable Orientation orientation) implements CollectingNeighborUpdater.NeighborUpdates { @Override public boolean runNext(Level level) { BlockState blockState = level.getBlockState(this.pos); - NeighborUpdater.executeUpdate(level, blockState, this.pos, this.block, this.neighborPos, false); + NeighborUpdater.executeUpdate(level, blockState, this.pos, this.block, this.orientation, false); return false; } } diff --git a/net/minecraft/world/level/redstone/DefaultRedstoneWireEvaluator.java b/net/minecraft/world/level/redstone/DefaultRedstoneWireEvaluator.java new file mode 100644 index 00000000..a4ebc495 --- /dev/null +++ b/net/minecraft/world/level/redstone/DefaultRedstoneWireEvaluator.java @@ -0,0 +1,42 @@ +package net.minecraft.world.level.redstone; + +import com.google.common.collect.Sets; +import java.util.Set; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.RedStoneWireBlock; +import net.minecraft.world.level.block.state.BlockState; +import org.jetbrains.annotations.Nullable; + +public class DefaultRedstoneWireEvaluator extends RedstoneWireEvaluator { + public DefaultRedstoneWireEvaluator(RedStoneWireBlock redStoneWireBlock) { + super(redStoneWireBlock); + } + + @Override + public void updatePowerStrength(Level level, BlockPos blockPos, BlockState blockState, @Nullable Orientation orientation, boolean bl) { + int i = this.calculateTargetStrength(level, blockPos); + if ((Integer)blockState.getValue(RedStoneWireBlock.POWER) != i) { + if (level.getBlockState(blockPos) == blockState) { + level.setBlock(blockPos, blockState.setValue(RedStoneWireBlock.POWER, i), 2); + } + + Set set = Sets.newHashSet(); + set.add(blockPos); + + for (Direction direction : Direction.values()) { + set.add(blockPos.relative(direction)); + } + + for (BlockPos blockPos2 : set) { + level.updateNeighborsAt(blockPos2, this.wireBlock); + } + } + } + + private int calculateTargetStrength(Level level, BlockPos blockPos) { + int i = this.getBlockSignal(level, blockPos); + return i == 15 ? i : Math.max(i, this.getIncomingWireSignal(level, blockPos)); + } +} diff --git a/net/minecraft/world/level/redstone/ExperimentalRedstoneUtils.java b/net/minecraft/world/level/redstone/ExperimentalRedstoneUtils.java new file mode 100644 index 00000000..04cfced5 --- /dev/null +++ b/net/minecraft/world/level/redstone/ExperimentalRedstoneUtils.java @@ -0,0 +1,31 @@ +package net.minecraft.world.level.redstone; + +import net.minecraft.core.Direction; +import net.minecraft.world.flag.FeatureFlags; +import net.minecraft.world.level.Level; +import org.jetbrains.annotations.Nullable; + +public class ExperimentalRedstoneUtils { + @Nullable + public static Orientation initialOrientation(Level level, @Nullable Direction direction, @Nullable Direction direction2) { + if (level.enabledFeatures().contains(FeatureFlags.REDSTONE_EXPERIMENTS)) { + Orientation orientation = Orientation.random(level.random).withSideBias(Orientation.SideBias.LEFT); + if (direction2 != null) { + orientation = orientation.withUp(direction2); + } + + if (direction != null) { + orientation = orientation.withFront(direction); + } + + return orientation; + } else { + return null; + } + } + + @Nullable + public static Orientation withFront(@Nullable Orientation orientation, Direction direction) { + return orientation == null ? null : orientation.withFront(direction); + } +} diff --git a/net/minecraft/world/level/redstone/ExperimentalRedstoneWireEvaluator.java b/net/minecraft/world/level/redstone/ExperimentalRedstoneWireEvaluator.java new file mode 100644 index 00000000..91157c10 --- /dev/null +++ b/net/minecraft/world/level/redstone/ExperimentalRedstoneWireEvaluator.java @@ -0,0 +1,209 @@ +package net.minecraft.world.level.redstone; + +import it.unimi.dsi.fastutil.objects.Object2IntLinkedOpenHashMap; +import it.unimi.dsi.fastutil.objects.Object2IntMap; +import it.unimi.dsi.fastutil.objects.ObjectIterator; +import it.unimi.dsi.fastutil.objects.Object2IntMap.Entry; +import java.util.ArrayDeque; +import java.util.Deque; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.RedStoneWireBlock; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.properties.EnumProperty; +import net.minecraft.world.level.block.state.properties.RedstoneSide; +import org.jetbrains.annotations.Nullable; + +public class ExperimentalRedstoneWireEvaluator extends RedstoneWireEvaluator { + private final Deque wiresToTurnOff = new ArrayDeque(); + private final Deque wiresToTurnOn = new ArrayDeque(); + private final Object2IntMap updatedWires = new Object2IntLinkedOpenHashMap<>(); + + public ExperimentalRedstoneWireEvaluator(RedStoneWireBlock redStoneWireBlock) { + super(redStoneWireBlock); + } + + @Override + public void updatePowerStrength(Level level, BlockPos blockPos, BlockState blockState, @Nullable Orientation orientation, boolean bl) { + Orientation orientation2 = getInitialOrientation(level, orientation); + this.calculateCurrentChanges(level, blockPos, orientation2); + ObjectIterator> objectIterator = this.updatedWires.object2IntEntrySet().iterator(); + + for (boolean bl2 = true; objectIterator.hasNext(); bl2 = false) { + Entry entry = (Entry)objectIterator.next(); + BlockPos blockPos2 = (BlockPos)entry.getKey(); + int i = entry.getIntValue(); + int j = unpackPower(i); + BlockState blockState2 = level.getBlockState(blockPos2); + if (blockState2.is(this.wireBlock) && !((Integer)blockState2.getValue(RedStoneWireBlock.POWER)).equals(j)) { + int k = 2; + if (!bl || !bl2) { + k |= 128; + } + + level.setBlock(blockPos2, blockState2.setValue(RedStoneWireBlock.POWER, j), k); + } else { + objectIterator.remove(); + } + } + + this.causeNeighborUpdates(level); + } + + private void causeNeighborUpdates(Level level) { + this.updatedWires.forEach((blockPos, integer) -> { + Orientation orientation = unpackOrientation(integer); + BlockState blockState = level.getBlockState(blockPos); + + for (Direction direction : orientation.getDirections()) { + if (isConnected(blockState, direction)) { + BlockPos blockPos2 = blockPos.relative(direction); + BlockState blockState2 = level.getBlockState(blockPos2); + Orientation orientation2 = orientation.withFrontPreserveUp(direction); + level.neighborChanged(blockState2, blockPos2, this.wireBlock, orientation2, false); + if (blockState2.isRedstoneConductor(level, blockPos2)) { + for (Direction direction2 : orientation2.getDirections()) { + if (direction2 != direction.getOpposite()) { + level.neighborChanged(blockPos2.relative(direction2), this.wireBlock, orientation2.withFrontPreserveUp(direction2)); + } + } + } + } + } + }); + } + + private static boolean isConnected(BlockState blockState, Direction direction) { + EnumProperty enumProperty = (EnumProperty)RedStoneWireBlock.PROPERTY_BY_DIRECTION.get(direction); + return enumProperty == null ? direction == Direction.DOWN : ((RedstoneSide)blockState.getValue(enumProperty)).isConnected(); + } + + private static Orientation getInitialOrientation(Level level, @Nullable Orientation orientation) { + Orientation orientation2; + if (orientation != null) { + orientation2 = orientation; + } else { + orientation2 = Orientation.random(level.random); + } + + return orientation2.withUp(Direction.UP).withSideBias(Orientation.SideBias.LEFT); + } + + private void calculateCurrentChanges(Level level, BlockPos blockPos, Orientation orientation) { + BlockState blockState = level.getBlockState(blockPos); + if (blockState.is(this.wireBlock)) { + this.setPower(blockPos, (Integer)blockState.getValue(RedStoneWireBlock.POWER), orientation); + this.wiresToTurnOff.add(blockPos); + } else { + this.propagateChangeToNeighbors(level, blockPos, 0, orientation, true); + } + + while (!this.wiresToTurnOff.isEmpty()) { + BlockPos blockPos2 = (BlockPos)this.wiresToTurnOff.removeFirst(); + int i = this.updatedWires.getInt(blockPos2); + Orientation orientation2 = unpackOrientation(i); + int j = unpackPower(i); + int k = this.getBlockSignal(level, blockPos2); + int l = this.getIncomingWireSignal(level, blockPos2); + int m = Math.max(k, l); + int n; + if (m < j) { + if (k > 0 && !this.wiresToTurnOn.contains(blockPos2)) { + this.wiresToTurnOn.add(blockPos2); + } + + n = 0; + } else { + n = m; + } + + if (n != j) { + this.setPower(blockPos2, n, orientation2); + } + + this.propagateChangeToNeighbors(level, blockPos2, n, orientation2, j > m); + } + + while (!this.wiresToTurnOn.isEmpty()) { + BlockPos blockPos2x = (BlockPos)this.wiresToTurnOn.removeFirst(); + int ix = this.updatedWires.getInt(blockPos2x); + int o = unpackPower(ix); + int jx = this.getBlockSignal(level, blockPos2x); + int kx = this.getIncomingWireSignal(level, blockPos2x); + int lx = Math.max(jx, kx); + Orientation orientation3 = unpackOrientation(ix); + if (lx > o) { + this.setPower(blockPos2x, lx, orientation3); + } else if (lx < o) { + throw new IllegalStateException("Turning off wire while trying to turn it on. Should not happen."); + } + + this.propagateChangeToNeighbors(level, blockPos2x, lx, orientation3, false); + } + } + + private static int packOrientationAndPower(Orientation orientation, int i) { + return orientation.getIndex() << 4 | i; + } + + private static Orientation unpackOrientation(int i) { + return Orientation.fromIndex(i >> 4); + } + + private static int unpackPower(int i) { + return i & 15; + } + + private void setPower(BlockPos blockPos, int i, Orientation orientation) { + this.updatedWires + .compute( + blockPos, (blockPosx, integer) -> integer == null ? packOrientationAndPower(orientation, i) : packOrientationAndPower(unpackOrientation(integer), i) + ); + } + + private void propagateChangeToNeighbors(Level level, BlockPos blockPos, int i, Orientation orientation, boolean bl) { + for (Direction direction : orientation.getHorizontalDirections()) { + BlockPos blockPos2 = blockPos.relative(direction); + this.enqueueNeighborWire(level, blockPos2, i, orientation.withFront(direction), bl); + } + + for (Direction direction : orientation.getVerticalDirections()) { + BlockPos blockPos2 = blockPos.relative(direction); + boolean bl2 = level.getBlockState(blockPos2).isRedstoneConductor(level, blockPos2); + + for (Direction direction2 : orientation.getHorizontalDirections()) { + BlockPos blockPos3 = blockPos.relative(direction2); + if (direction == Direction.UP && !bl2) { + BlockPos blockPos4 = blockPos2.relative(direction2); + this.enqueueNeighborWire(level, blockPos4, i, orientation.withFront(direction2), bl); + } else if (direction == Direction.DOWN && !level.getBlockState(blockPos3).isRedstoneConductor(level, blockPos3)) { + BlockPos blockPos4 = blockPos2.relative(direction2); + this.enqueueNeighborWire(level, blockPos4, i, orientation.withFront(direction2), bl); + } + } + } + } + + private void enqueueNeighborWire(Level level, BlockPos blockPos, int i, Orientation orientation, boolean bl) { + BlockState blockState = level.getBlockState(blockPos); + if (blockState.is(this.wireBlock)) { + int j = this.getWireSignal(blockPos, blockState); + if (j < i - 1 && !this.wiresToTurnOn.contains(blockPos)) { + this.wiresToTurnOn.add(blockPos); + this.setPower(blockPos, j, orientation); + } + + if (bl && j > i && !this.wiresToTurnOff.contains(blockPos)) { + this.wiresToTurnOff.add(blockPos); + this.setPower(blockPos, j, orientation); + } + } + } + + @Override + protected int getWireSignal(BlockPos blockPos, BlockState blockState) { + int i = this.updatedWires.getOrDefault(blockPos, -1); + return i != -1 ? unpackPower(i) : super.getWireSignal(blockPos, blockState); + } +} diff --git a/net/minecraft/world/level/redstone/InstantNeighborUpdater.java b/net/minecraft/world/level/redstone/InstantNeighborUpdater.java index 4e6e96d2..b88d4bf9 100644 --- a/net/minecraft/world/level/redstone/InstantNeighborUpdater.java +++ b/net/minecraft/world/level/redstone/InstantNeighborUpdater.java @@ -5,6 +5,7 @@ import net.minecraft.core.Direction; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.state.BlockState; +import org.jetbrains.annotations.Nullable; public class InstantNeighborUpdater implements NeighborUpdater { private final Level level; @@ -15,17 +16,17 @@ public class InstantNeighborUpdater implements NeighborUpdater { @Override public void shapeUpdate(Direction direction, BlockState state, BlockPos pos, BlockPos neighborPos, int flags, int recursionLevel) { - NeighborUpdater.executeShapeUpdate(this.level, direction, state, pos, neighborPos, flags, recursionLevel - 1); + NeighborUpdater.executeShapeUpdate(this.level, direction, pos, neighborPos, state, flags, recursionLevel - 1); } @Override - public void neighborChanged(BlockPos pos, Block neighborBlock, BlockPos neighborPos) { - BlockState blockState = this.level.getBlockState(pos); - this.neighborChanged(blockState, pos, neighborBlock, neighborPos, false); + public void neighborChanged(BlockPos blockPos, Block block, @Nullable Orientation orientation) { + BlockState blockState = this.level.getBlockState(blockPos); + this.neighborChanged(blockState, blockPos, block, orientation, false); } @Override - public void neighborChanged(BlockState state, BlockPos pos, Block neighborBlock, BlockPos neighborPos, boolean movedByPiston) { - NeighborUpdater.executeUpdate(this.level, state, pos, neighborBlock, neighborPos, movedByPiston); + public void neighborChanged(BlockState blockState, BlockPos blockPos, Block block, @Nullable Orientation orientation, boolean bl) { + NeighborUpdater.executeUpdate(this.level, blockState, blockPos, block, orientation, bl); } } diff --git a/net/minecraft/world/level/redstone/NeighborUpdater.java b/net/minecraft/world/level/redstone/NeighborUpdater.java index e9786ab7..69858b87 100644 --- a/net/minecraft/world/level/redstone/NeighborUpdater.java +++ b/net/minecraft/world/level/redstone/NeighborUpdater.java @@ -11,6 +11,7 @@ import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.state.BlockState; import org.jetbrains.annotations.Nullable; @@ -19,27 +20,29 @@ public interface NeighborUpdater { void shapeUpdate(Direction direction, BlockState state, BlockPos pos, BlockPos neighborPos, int flags, int recursionLevel); - void neighborChanged(BlockPos pos, Block neighborBlock, BlockPos neighborPos); + void neighborChanged(BlockPos blockPos, Block block, @Nullable Orientation orientation); - void neighborChanged(BlockState state, BlockPos pos, Block neighborBlock, BlockPos neighborPos, boolean movedByPiston); + void neighborChanged(BlockState blockState, BlockPos blockPos, Block block, @Nullable Orientation orientation, boolean bl); - default void updateNeighborsAtExceptFromFacing(BlockPos pos, Block block, @Nullable Direction facing) { - for (Direction direction : UPDATE_ORDER) { - if (direction != facing) { - this.neighborChanged(pos.relative(direction), block, pos); + default void updateNeighborsAtExceptFromFacing(BlockPos blockPos, Block block, @Nullable Direction direction, @Nullable Orientation orientation) { + for (Direction direction2 : UPDATE_ORDER) { + if (direction2 != direction) { + this.neighborChanged(blockPos.relative(direction2), block, null); } } } - static void executeShapeUpdate(LevelAccessor level, Direction direction, BlockState state, BlockPos pos, BlockPos neighborPos, int flags, int recursionLevel) { - BlockState blockState = level.getBlockState(pos); - BlockState blockState2 = blockState.updateShape(direction, state, level, pos, neighborPos); - Block.updateOrDestroy(blockState, blockState2, level, pos, flags, recursionLevel); + static void executeShapeUpdate(LevelAccessor levelAccessor, Direction direction, BlockPos blockPos, BlockPos blockPos2, BlockState blockState, int i, int j) { + BlockState blockState2 = levelAccessor.getBlockState(blockPos); + if ((i & 128) == 0 || !blockState2.is(Blocks.REDSTONE_WIRE)) { + BlockState blockState3 = blockState2.updateShape(levelAccessor, levelAccessor, blockPos, direction, blockPos2, blockState, levelAccessor.getRandom()); + Block.updateOrDestroy(blockState2, blockState3, levelAccessor, blockPos, i, j); + } } - static void executeUpdate(Level level, BlockState state, BlockPos pos, Block neighborBlock, BlockPos neighborPos, boolean movedByPiston) { + static void executeUpdate(Level level, BlockState blockState, BlockPos blockPos, Block block, @Nullable Orientation orientation, boolean bl) { try { - state.handleNeighborChanged(level, pos, neighborBlock, neighborPos, movedByPiston); + blockState.handleNeighborChanged(level, blockPos, block, orientation, bl); } catch (Throwable var9) { CrashReport crashReport = CrashReport.forThrowable(var9, "Exception while updating neighbours"); CrashReportCategory crashReportCategory = crashReport.addCategory("Block being updated"); @@ -48,18 +51,14 @@ public interface NeighborUpdater { (CrashReportDetail)(() -> { try { return String.format( - Locale.ROOT, - "ID #%s (%s // %s)", - BuiltInRegistries.BLOCK.getKey(neighborBlock), - neighborBlock.getDescriptionId(), - neighborBlock.getClass().getCanonicalName() + Locale.ROOT, "ID #%s (%s // %s)", BuiltInRegistries.BLOCK.getKey(block), block.getDescriptionId(), block.getClass().getCanonicalName() ); } catch (Throwable var2) { - return "ID #" + BuiltInRegistries.BLOCK.getKey(neighborBlock); + return "ID #" + BuiltInRegistries.BLOCK.getKey(block); } }) ); - CrashReportCategory.populateBlockDetails(crashReportCategory, level, pos, state); + CrashReportCategory.populateBlockDetails(crashReportCategory, level, blockPos, blockState); throw new ReportedException(crashReport); } } diff --git a/net/minecraft/world/level/redstone/Orientation.java b/net/minecraft/world/level/redstone/Orientation.java new file mode 100644 index 00000000..2e2fbc16 --- /dev/null +++ b/net/minecraft/world/level/redstone/Orientation.java @@ -0,0 +1,202 @@ +package net.minecraft.world.level.redstone; + +import com.google.common.annotations.VisibleForTesting; +import io.netty.buffer.ByteBuf; +import java.util.EnumMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import net.minecraft.Util; +import net.minecraft.core.Direction; +import net.minecraft.core.Vec3i; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.util.RandomSource; + +public class Orientation { + public static final StreamCodec STREAM_CODEC = ByteBufCodecs.idMapper(Orientation::fromIndex, Orientation::getIndex); + private static final Orientation[] ORIENTATIONS = Util.make(() -> { + Orientation[] orientations = new Orientation[48]; + generateContext(new Orientation(Direction.UP, Direction.NORTH, Orientation.SideBias.LEFT), orientations); + return orientations; + }); + private final Direction up; + private final Direction front; + private final Direction side; + private final Orientation.SideBias sideBias; + private final int index; + private final List neighbors; + private final List horizontalNeighbors; + private final List verticalNeighbors; + private final Map withFront = new EnumMap(Direction.class); + private final Map withUp = new EnumMap(Direction.class); + private final Map withSideBias = new EnumMap(Orientation.SideBias.class); + + private Orientation(Direction direction, Direction direction2, Orientation.SideBias sideBias) { + this.up = direction; + this.front = direction2; + this.sideBias = sideBias; + this.index = generateIndex(direction, direction2, sideBias); + Vec3i vec3i = direction2.getUnitVec3i().cross(direction.getUnitVec3i()); + Direction direction3 = Direction.getNearest(vec3i, null); + Objects.requireNonNull(direction3); + if (this.sideBias == Orientation.SideBias.RIGHT) { + this.side = direction3; + } else { + this.side = direction3.getOpposite(); + } + + this.neighbors = List.of(this.front.getOpposite(), this.front, this.side, this.side.getOpposite(), this.up.getOpposite(), this.up); + this.horizontalNeighbors = this.neighbors.stream().filter(directionx -> directionx.getAxis() != this.up.getAxis()).toList(); + this.verticalNeighbors = this.neighbors.stream().filter(directionx -> directionx.getAxis() == this.up.getAxis()).toList(); + } + + public static Orientation of(Direction direction, Direction direction2, Orientation.SideBias sideBias) { + return ORIENTATIONS[generateIndex(direction, direction2, sideBias)]; + } + + public Orientation withUp(Direction direction) { + return (Orientation)this.withUp.get(direction); + } + + public Orientation withFront(Direction direction) { + return (Orientation)this.withFront.get(direction); + } + + public Orientation withFrontPreserveUp(Direction direction) { + return direction.getAxis() == this.up.getAxis() ? this : (Orientation)this.withFront.get(direction); + } + + public Orientation withFrontAdjustSideBias(Direction direction) { + Orientation orientation = this.withFront(direction); + return this.front == orientation.side ? orientation.withMirror() : orientation; + } + + public Orientation withSideBias(Orientation.SideBias sideBias) { + return (Orientation)this.withSideBias.get(sideBias); + } + + public Orientation withMirror() { + return this.withSideBias(this.sideBias.getOpposite()); + } + + public Direction getFront() { + return this.front; + } + + public Direction getUp() { + return this.up; + } + + public Direction getSide() { + return this.side; + } + + public Orientation.SideBias getSideBias() { + return this.sideBias; + } + + public List getDirections() { + return this.neighbors; + } + + public List getHorizontalDirections() { + return this.horizontalNeighbors; + } + + public List getVerticalDirections() { + return this.verticalNeighbors; + } + + public String toString() { + return "[up=" + this.up + ",front=" + this.front + ",sideBias=" + this.sideBias + "]"; + } + + public int getIndex() { + return this.index; + } + + public static Orientation fromIndex(int i) { + return ORIENTATIONS[i]; + } + + public static Orientation random(RandomSource randomSource) { + return Util.getRandom(ORIENTATIONS, randomSource); + } + + private static Orientation generateContext(Orientation orientation, Orientation[] orientations) { + if (orientations[orientation.getIndex()] != null) { + return orientations[orientation.getIndex()]; + } else { + orientations[orientation.getIndex()] = orientation; + + for (Orientation.SideBias sideBias : Orientation.SideBias.values()) { + orientation.withSideBias.put(sideBias, generateContext(new Orientation(orientation.up, orientation.front, sideBias), orientations)); + } + + for (Direction direction : Direction.values()) { + Direction direction2 = orientation.up; + if (direction == orientation.up) { + direction2 = orientation.front.getOpposite(); + } + + if (direction == orientation.up.getOpposite()) { + direction2 = orientation.front; + } + + orientation.withFront.put(direction, generateContext(new Orientation(direction2, direction, orientation.sideBias), orientations)); + } + + for (Direction direction : Direction.values()) { + Direction direction2x = orientation.front; + if (direction == orientation.front) { + direction2x = orientation.up.getOpposite(); + } + + if (direction == orientation.front.getOpposite()) { + direction2x = orientation.up; + } + + orientation.withUp.put(direction, generateContext(new Orientation(direction, direction2x, orientation.sideBias), orientations)); + } + + return orientation; + } + } + + @VisibleForTesting + protected static int generateIndex(Direction direction, Direction direction2, Orientation.SideBias sideBias) { + if (direction.getAxis() == direction2.getAxis()) { + throw new IllegalStateException("Up-vector and front-vector can not be on the same axis"); + } else { + int i; + if (direction.getAxis() == Direction.Axis.Y) { + i = direction2.getAxis() == Direction.Axis.X ? 1 : 0; + } else { + i = direction2.getAxis() == Direction.Axis.Y ? 1 : 0; + } + + int j = i << 1 | direction2.getAxisDirection().ordinal(); + return ((direction.ordinal() << 2) + j << 1) + sideBias.ordinal(); + } + } + + public static enum SideBias { + LEFT("left"), + RIGHT("right"); + + private final String name; + + private SideBias(final String string2) { + this.name = string2; + } + + public Orientation.SideBias getOpposite() { + return this == LEFT ? RIGHT : LEFT; + } + + public String toString() { + return this.name; + } + } +} diff --git a/net/minecraft/world/level/redstone/Redstone.java b/net/minecraft/world/level/redstone/Redstone.java index 452fbca2..8a4d0ca4 100644 --- a/net/minecraft/world/level/redstone/Redstone.java +++ b/net/minecraft/world/level/redstone/Redstone.java @@ -1,6 +1,8 @@ package net.minecraft.world.level.redstone; public class Redstone { + public static final int BITS = 4; + public static final int MASK = 15; public static final int SIGNAL_MIN = 0; public static final int SIGNAL_MAX = 15; public static final int SIGNAL_NONE = 0; diff --git a/net/minecraft/world/level/redstone/RedstoneWireEvaluator.java b/net/minecraft/world/level/redstone/RedstoneWireEvaluator.java new file mode 100644 index 00000000..29c3ac02 --- /dev/null +++ b/net/minecraft/world/level/redstone/RedstoneWireEvaluator.java @@ -0,0 +1,46 @@ +package net.minecraft.world.level.redstone; + +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.RedStoneWireBlock; +import net.minecraft.world.level.block.state.BlockState; +import org.jetbrains.annotations.Nullable; + +public abstract class RedstoneWireEvaluator { + protected final RedStoneWireBlock wireBlock; + + protected RedstoneWireEvaluator(RedStoneWireBlock redStoneWireBlock) { + this.wireBlock = redStoneWireBlock; + } + + public abstract void updatePowerStrength(Level level, BlockPos blockPos, BlockState blockState, @Nullable Orientation orientation, boolean bl); + + protected int getBlockSignal(Level level, BlockPos blockPos) { + return this.wireBlock.getBlockSignal(level, blockPos); + } + + protected int getWireSignal(BlockPos blockPos, BlockState blockState) { + return blockState.is(this.wireBlock) ? (Integer)blockState.getValue(RedStoneWireBlock.POWER) : 0; + } + + protected int getIncomingWireSignal(Level level, BlockPos blockPos) { + int i = 0; + + for (Direction direction : Direction.Plane.HORIZONTAL) { + BlockPos blockPos2 = blockPos.relative(direction); + BlockState blockState = level.getBlockState(blockPos2); + i = Math.max(i, this.getWireSignal(blockPos2, blockState)); + BlockPos blockPos3 = blockPos.above(); + if (blockState.isRedstoneConductor(level, blockPos2) && !level.getBlockState(blockPos3).isRedstoneConductor(level, blockPos3)) { + BlockPos blockPos4 = blockPos2.above(); + i = Math.max(i, this.getWireSignal(blockPos4, level.getBlockState(blockPos4))); + } else if (!blockState.isRedstoneConductor(level, blockPos2)) { + BlockPos blockPos4 = blockPos2.below(); + i = Math.max(i, this.getWireSignal(blockPos4, level.getBlockState(blockPos4))); + } + } + + return Math.max(0, i - 1); + } +} diff --git a/net/minecraft/world/level/saveddata/SavedData.java b/net/minecraft/world/level/saveddata/SavedData.java index 76a4a363..a81c4a53 100644 --- a/net/minecraft/world/level/saveddata/SavedData.java +++ b/net/minecraft/world/level/saveddata/SavedData.java @@ -1,19 +1,13 @@ package net.minecraft.world.level.saveddata; -import com.mojang.logging.LogUtils; -import java.io.File; -import java.io.IOException; import java.util.function.BiFunction; import java.util.function.Supplier; import net.minecraft.core.HolderLookup; import net.minecraft.nbt.CompoundTag; -import net.minecraft.nbt.NbtIo; import net.minecraft.nbt.NbtUtils; import net.minecraft.util.datafix.DataFixTypes; -import org.slf4j.Logger; public abstract class SavedData { - private static final Logger LOGGER = LogUtils.getLogger(); private boolean dirty; public abstract CompoundTag save(CompoundTag tag, HolderLookup.Provider registries); @@ -39,20 +33,12 @@ public abstract class SavedData { return this.dirty; } - public void save(File file, HolderLookup.Provider registries) { - if (this.isDirty()) { - CompoundTag compoundTag = new CompoundTag(); - compoundTag.put("data", this.save(new CompoundTag(), registries)); - NbtUtils.addCurrentDataVersion(compoundTag); - - try { - NbtIo.writeCompressed(compoundTag, file.toPath()); - } catch (IOException var5) { - LOGGER.error("Could not save data {}", this, var5); - } - - this.setDirty(false); - } + public CompoundTag save(HolderLookup.Provider provider) { + CompoundTag compoundTag = new CompoundTag(); + compoundTag.put("data", this.save(new CompoundTag(), provider)); + NbtUtils.addCurrentDataVersion(compoundTag); + this.setDirty(false); + return compoundTag; } public record Factory(Supplier constructor, BiFunction deserializer, DataFixTypes type) { diff --git a/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java b/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java index adfd346a..fa6a80f0 100644 --- a/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java +++ b/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java @@ -2,6 +2,7 @@ package net.minecraft.world.level.saveddata.maps; import com.google.common.collect.Lists; import com.google.common.collect.Maps; +import com.mojang.datafixers.util.Pair; import com.mojang.logging.LogUtils; import com.mojang.serialization.Dynamic; import io.netty.buffer.ByteBuf; @@ -28,13 +29,16 @@ import net.minecraft.network.protocol.game.ClientboundMapItemDataPacket; import net.minecraft.resources.RegistryOps; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; +import net.minecraft.tags.ItemTags; import net.minecraft.util.Mth; import net.minecraft.util.datafix.DataFixTypes; +import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.decoration.ItemFrame; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.component.MapDecorations; import net.minecraft.world.item.component.MapItemColor; +import net.minecraft.world.item.component.MapDecorations.Entry; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelAccessor; @@ -79,7 +83,6 @@ public class MapItemSavedData extends SavedData { this.trackingPosition = trackingPosition; this.unlimitedTracking = unlimitedTracking; this.locked = locked; - this.setDirty(); } public static MapItemSavedData createFresh(double x, double z, byte scale, boolean trackingPosition, boolean unlimitedTracking, ResourceKey dimension) { @@ -168,7 +171,6 @@ public class MapItemSavedData extends SavedData { mapItemSavedData.decorations.putAll(this.decorations); mapItemSavedData.trackedDecorationCount = this.trackedDecorationCount; System.arraycopy(this.colors, 0, mapItemSavedData.colors, 0, this.colors.length); - mapItemSavedData.setDirty(); return mapItemSavedData; } @@ -198,24 +200,21 @@ public class MapItemSavedData extends SavedData { for (int i = 0; i < this.carriedBy.size(); i++) { MapItemSavedData.HoldingPlayer holdingPlayer2 = (MapItemSavedData.HoldingPlayer)this.carriedBy.get(i); - String string = holdingPlayer2.player.getName().getString(); - if (!holdingPlayer2.player.isRemoved() && (holdingPlayer2.player.getInventory().contains(predicate) || mapStack.isFramed())) { - if (!mapStack.isFramed() && holdingPlayer2.player.level().dimension() == this.dimension && this.trackingPosition) { - this.addDecoration( - MapDecorationTypes.PLAYER, - holdingPlayer2.player.level(), - string, - holdingPlayer2.player.getX(), - holdingPlayer2.player.getZ(), - holdingPlayer2.player.getYRot(), - null - ); + Player player2 = holdingPlayer2.player; + String string = player2.getName().getString(); + if (!player2.isRemoved() && (player2.getInventory().contains(predicate) || mapStack.isFramed())) { + if (!mapStack.isFramed() && player2.level().dimension() == this.dimension && this.trackingPosition) { + this.addDecoration(MapDecorationTypes.PLAYER, player2.level(), string, player2.getX(), player2.getZ(), player2.getYRot(), null); } } else { - this.carriedByPlayers.remove(holdingPlayer2.player); + this.carriedByPlayers.remove(player2); this.carriedBy.remove(holdingPlayer2); this.removeDecoration(string); } + + if (!player2.equals(player) && hasMapInvisibilityItemEquipped(player2)) { + this.removeDecoration(string); + } } if (mapStack.isFramed() && this.trackingPosition) { @@ -241,14 +240,26 @@ public class MapItemSavedData extends SavedData { MapDecorations mapDecorations = mapStack.getOrDefault(DataComponents.MAP_DECORATIONS, MapDecorations.EMPTY); if (!this.decorations.keySet().containsAll(mapDecorations.decorations().keySet())) { - mapDecorations.decorations().forEach((string, entry) -> { - if (!this.decorations.containsKey(string)) { - this.addDecoration(entry.type(), player.level(), string, entry.x(), entry.z(), entry.rotation(), null); + mapDecorations.decorations().forEach((stringx, entry) -> { + if (!this.decorations.containsKey(stringx)) { + this.addDecoration(entry.type(), player.level(), stringx, entry.x(), entry.z(), entry.rotation(), null); } }); } } + private static boolean hasMapInvisibilityItemEquipped(Player player) { + for (EquipmentSlot equipmentSlot : EquipmentSlot.values()) { + if (equipmentSlot != EquipmentSlot.MAINHAND + && equipmentSlot != EquipmentSlot.OFFHAND + && player.getItemBySlot(equipmentSlot).is(ItemTags.MAP_INVISIBILITY_EQUIPMENT)) { + return true; + } + } + + return false; + } + private void removeDecoration(String identifier) { MapDecoration mapDecoration = (MapDecoration)this.decorations.remove(identifier); if (mapDecoration != null && mapDecoration.type().value().trackCount()) { @@ -259,7 +270,7 @@ public class MapItemSavedData extends SavedData { } public static void addTargetDecoration(ItemStack stack, BlockPos pos, String type, Holder mapDecorationType) { - MapDecorations.Entry entry = new MapDecorations.Entry(mapDecorationType, pos.getX(), pos.getZ(), 180.0F); + Entry entry = new Entry(mapDecorationType, pos.getX(), pos.getZ(), 180.0F); stack.update(DataComponents.MAP_DECORATIONS, MapDecorations.EMPTY, mapDecorations -> mapDecorations.withDecoration(type, entry)); if (mapDecorationType.value().hasMapColor()) { stack.set(DataComponents.MAP_COLOR, new MapItemColor(mapDecorationType.value().mapColor())); @@ -272,65 +283,88 @@ public class MapItemSavedData extends SavedData { int i = 1 << this.scale; float f = (float)(x - this.centerX) / i; float g = (float)(z - this.centerZ) / i; - byte b = (byte)(f * 2.0F + 0.5); - byte c = (byte)(g * 2.0F + 0.5); - int j = 63; - byte d; - if (f >= -63.0F && g >= -63.0F && f <= 63.0F && g <= 63.0F) { - yRot += yRot < 0.0 ? -8.0 : 8.0; - d = (byte)(yRot * 16.0 / 360.0); - if (this.dimension == Level.NETHER && level != null) { - int k = (int)(level.getLevelData().getDayTime() / 10L); - d = (byte)(k * k * 34187121 + k * 121 >> 15 & 15); - } + MapItemSavedData.MapDecorationLocation mapDecorationLocation = this.calculateDecorationLocationAndType(decorationType, level, yRot, f, g); + if (mapDecorationLocation == null) { + this.removeDecoration(id); } else { - if (!decorationType.is(MapDecorationTypes.PLAYER)) { - this.removeDecoration(id); - return; - } - - int k = 320; - if (Math.abs(f) < 320.0F && Math.abs(g) < 320.0F) { - decorationType = MapDecorationTypes.PLAYER_OFF_MAP; - } else { - if (!this.unlimitedTracking) { - this.removeDecoration(id); - return; + MapDecoration mapDecoration = new MapDecoration( + mapDecorationLocation.type(), mapDecorationLocation.x(), mapDecorationLocation.y(), mapDecorationLocation.rot(), Optional.ofNullable(displayName) + ); + MapDecoration mapDecoration2 = (MapDecoration)this.decorations.put(id, mapDecoration); + if (!mapDecoration.equals(mapDecoration2)) { + if (mapDecoration2 != null && mapDecoration2.type().value().trackCount()) { + this.trackedDecorationCount--; } - decorationType = MapDecorationTypes.PLAYER_OFF_LIMITS; - } + if (mapDecorationLocation.type().value().trackCount()) { + this.trackedDecorationCount++; + } - d = 0; - if (f <= -63.0F) { - b = -128; - } - - if (g <= -63.0F) { - c = -128; - } - - if (f >= 63.0F) { - b = 127; - } - - if (g >= 63.0F) { - c = 127; + this.setDecorationsDirty(); } } + } - MapDecoration mapDecoration = new MapDecoration(decorationType, b, c, d, Optional.ofNullable(displayName)); - MapDecoration mapDecoration2 = (MapDecoration)this.decorations.put(id, mapDecoration); - if (!mapDecoration.equals(mapDecoration2)) { - if (mapDecoration2 != null && mapDecoration2.type().value().trackCount()) { - this.trackedDecorationCount--; - } + @Nullable + private MapItemSavedData.MapDecorationLocation calculateDecorationLocationAndType( + Holder holder, @Nullable LevelAccessor levelAccessor, double d, float f, float g + ) { + byte b = clampMapCoordinate(f); + byte c = clampMapCoordinate(g); + if (holder.is(MapDecorationTypes.PLAYER)) { + Pair, Byte> pair = this.playerDecorationTypeAndRotation(holder, levelAccessor, d, f, g); + return pair == null ? null : new MapItemSavedData.MapDecorationLocation(pair.getFirst(), b, c, pair.getSecond()); + } else { + return !isInsideMap(f, g) && !this.unlimitedTracking + ? null + : new MapItemSavedData.MapDecorationLocation(holder, b, c, this.calculateRotation(levelAccessor, d)); + } + } - if (decorationType.value().trackCount()) { - this.trackedDecorationCount++; - } + @Nullable + private Pair, Byte> playerDecorationTypeAndRotation( + Holder holder, @Nullable LevelAccessor levelAccessor, double d, float f, float g + ) { + if (isInsideMap(f, g)) { + return Pair.of(holder, this.calculateRotation(levelAccessor, d)); + } else { + Holder holder2 = this.decorationTypeForPlayerOutsideMap(f, g); + return holder2 == null ? null : Pair.of(holder2, (byte)0); + } + } - this.setDecorationsDirty(); + private byte calculateRotation(@Nullable LevelAccessor levelAccessor, double d) { + if (this.dimension == Level.NETHER && levelAccessor != null) { + int i = (int)(levelAccessor.getLevelData().getDayTime() / 10L); + return (byte)(i * i * 34187121 + i * 121 >> 15 & 15); + } else { + double e = d < 0.0 ? d - 8.0 : d + 8.0; + return (byte)(e * 16.0 / 360.0); + } + } + + private static boolean isInsideMap(float f, float g) { + int i = 63; + return f >= -63.0F && g >= -63.0F && f <= 63.0F && g <= 63.0F; + } + + @Nullable + private Holder decorationTypeForPlayerOutsideMap(float f, float g) { + int i = 320; + boolean bl = Math.abs(f) < 320.0F && Math.abs(g) < 320.0F; + if (bl) { + return MapDecorationTypes.PLAYER_OFF_MAP; + } else { + return this.unlimitedTracking ? MapDecorationTypes.PLAYER_OFF_LIMITS : null; + } + } + + private static byte clampMapCoordinate(float f) { + int i = 63; + if (f <= -63.0F) { + return -128; + } else { + return f >= 63.0F ? 127 : (byte)(f * 2.0F + 0.5); } } @@ -414,6 +448,7 @@ public class MapItemSavedData extends SavedData { public void removedFromFrame(BlockPos pos, int entityId) { this.removeDecoration(getFrameKey(entityId)); this.frameMarkers.remove(MapFrame.frameId(pos)); + this.setDirty(); } public boolean updateColor(int x, int z, byte color) { @@ -552,6 +587,9 @@ public class MapItemSavedData extends SavedData { } } + record MapDecorationLocation(Holder type, byte x, byte y, byte rot) { + } + public record MapPatch(int startX, int startY, int width, int height, byte[] mapColors) { public static final StreamCodec> STREAM_CODEC = StreamCodec.of( MapItemSavedData.MapPatch::write, MapItemSavedData.MapPatch::read diff --git a/net/minecraft/world/level/storage/DimensionDataStorage.java b/net/minecraft/world/level/storage/DimensionDataStorage.java index f0d41151..d4a5a395 100644 --- a/net/minecraft/world/level/storage/DimensionDataStorage.java +++ b/net/minecraft/world/level/storage/DimensionDataStorage.java @@ -1,17 +1,22 @@ package net.minecraft.world.level.storage; -import com.google.common.collect.Maps; import com.mojang.datafixers.DataFixer; import com.mojang.logging.LogUtils; +import it.unimi.dsi.fastutil.objects.Object2ObjectArrayMap; import java.io.DataInputStream; -import java.io.File; -import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PushbackInputStream; +import java.nio.file.Files; +import java.nio.file.LinkOption; +import java.nio.file.Path; +import java.util.HashMap; import java.util.Map; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; import java.util.function.BiFunction; import net.minecraft.SharedConstants; +import net.minecraft.Util; import net.minecraft.core.HolderLookup; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.NbtAccounter; @@ -23,21 +28,22 @@ import net.minecraft.world.level.saveddata.SavedData; import org.jetbrains.annotations.Nullable; import org.slf4j.Logger; -public class DimensionDataStorage { +public class DimensionDataStorage implements AutoCloseable { private static final Logger LOGGER = LogUtils.getLogger(); - private final Map cache = Maps.newHashMap(); + private final Map> cache = new HashMap(); private final DataFixer fixerUpper; private final HolderLookup.Provider registries; - private final File dataFolder; + private final Path dataFolder; + private CompletableFuture pendingWriteFuture = CompletableFuture.completedFuture(null); - public DimensionDataStorage(File dataFolder, DataFixer fixerUpper, HolderLookup.Provider registries) { - this.fixerUpper = fixerUpper; - this.dataFolder = dataFolder; - this.registries = registries; + public DimensionDataStorage(Path path, DataFixer dataFixer, HolderLookup.Provider provider) { + this.fixerUpper = dataFixer; + this.dataFolder = path; + this.registries = provider; } - private File getDataFile(String name) { - return new File(this.dataFolder, name + ".dat"); + private Path getDataFile(String string) { + return this.dataFolder.resolve(string + ".dat"); } public T computeIfAbsent(SavedData.Factory factory, String name) { @@ -53,20 +59,20 @@ public class DimensionDataStorage { @Nullable public T get(SavedData.Factory factory, String name) { - SavedData savedData = (SavedData)this.cache.get(name); - if (savedData == null && !this.cache.containsKey(name)) { - savedData = this.readSavedData(factory.deserializer(), factory.type(), name); - this.cache.put(name, savedData); + Optional optional = (Optional)this.cache.get(name); + if (optional == null) { + optional = Optional.ofNullable(this.readSavedData(factory.deserializer(), factory.type(), name)); + this.cache.put(name, optional); } - return (T)savedData; + return (T)optional.orElse(null); } @Nullable private T readSavedData(BiFunction reader, DataFixTypes dataFixType, String filename) { try { - File file = this.getDataFile(filename); - if (file.exists()) { + Path path = this.getDataFile(filename); + if (Files.exists(path, new LinkOption[0])) { CompoundTag compoundTag = this.readTagFromDisk(filename, dataFixType, SharedConstants.getCurrentVersion().getDataVersion().getVersion()); return (T)reader.apply(compoundTag.getCompound("data"), this.registries); } @@ -78,14 +84,14 @@ public class DimensionDataStorage { } public void set(String name, SavedData savedData) { - this.cache.put(name, savedData); + this.cache.put(name, Optional.of(savedData)); + savedData.setDirty(); } public CompoundTag readTagFromDisk(String filename, DataFixTypes dataFixType, int version) throws IOException { - File file = this.getDataFile(filename); - InputStream inputStream = new FileInputStream(file); + InputStream inputStream = Files.newInputStream(this.getDataFile(filename)); - CompoundTag var9; + CompoundTag var8; try { PushbackInputStream pushbackInputStream = new PushbackInputStream(new FastBufferedInputStream(inputStream), 2); @@ -98,44 +104,49 @@ public class DimensionDataStorage { try { compoundTag = NbtIo.read(dataInputStream); - } catch (Throwable var14) { + } catch (Throwable var13) { try { dataInputStream.close(); - } catch (Throwable var13) { - var14.addSuppressed(var13); + } catch (Throwable var12) { + var13.addSuppressed(var12); } - throw var14; + throw var13; } dataInputStream.close(); } int i = NbtUtils.getDataVersion(compoundTag, 1343); - var9 = dataFixType.update(this.fixerUpper, compoundTag, i, version); - } catch (Throwable var15) { + var8 = dataFixType.update(this.fixerUpper, compoundTag, i, version); + } catch (Throwable var14) { try { pushbackInputStream.close(); - } catch (Throwable var12) { - var15.addSuppressed(var12); + } catch (Throwable var11) { + var14.addSuppressed(var11); } - throw var15; + throw var14; } pushbackInputStream.close(); - } catch (Throwable var16) { - try { - inputStream.close(); - } catch (Throwable var11) { - var16.addSuppressed(var11); + } catch (Throwable var15) { + if (inputStream != null) { + try { + inputStream.close(); + } catch (Throwable var10) { + var15.addSuppressed(var10); + } } - throw var16; + throw var15; } - inputStream.close(); - return var9; + if (inputStream != null) { + inputStream.close(); + } + + return var8; } private boolean isGzip(PushbackInputStream inputStream) throws IOException { @@ -156,11 +167,48 @@ public class DimensionDataStorage { return bl; } - public void save() { - this.cache.forEach((string, savedData) -> { - if (savedData != null) { - savedData.save(this.getDataFile(string), this.registries); + public CompletableFuture scheduleSave() { + Map map = this.collectDirtyTagsToSave(); + if (map.isEmpty()) { + return CompletableFuture.completedFuture(null); + } else { + this.pendingWriteFuture = this.pendingWriteFuture + .thenCompose( + object -> CompletableFuture.allOf( + (CompletableFuture[])map.entrySet() + .stream() + .map(entry -> tryWriteAsync((Path)entry.getKey(), (CompoundTag)entry.getValue())) + .toArray(CompletableFuture[]::new) + ) + ); + return this.pendingWriteFuture; + } + } + + private Map collectDirtyTagsToSave() { + Map map = new Object2ObjectArrayMap<>(); + this.cache + .forEach( + (string, optional) -> optional.filter(SavedData::isDirty).ifPresent(savedData -> map.put(this.getDataFile(string), savedData.save(this.registries))) + ); + return map; + } + + private static CompletableFuture tryWriteAsync(Path path, CompoundTag compoundTag) { + return CompletableFuture.runAsync(() -> { + try { + NbtIo.writeCompressed(compoundTag, path); + } catch (IOException var3) { + LOGGER.error("Could not save data to {}", path.getFileName(), var3); } - }); + }, Util.ioPool()); + } + + public void saveAndJoin() { + this.scheduleSave().join(); + } + + public void close() { + this.saveAndJoin(); } } diff --git a/net/minecraft/world/level/storage/LevelData.java b/net/minecraft/world/level/storage/LevelData.java index 1c9c3fb6..70e42347 100644 --- a/net/minecraft/world/level/storage/LevelData.java +++ b/net/minecraft/world/level/storage/LevelData.java @@ -5,7 +5,6 @@ import net.minecraft.CrashReportCategory; import net.minecraft.CrashReportDetail; import net.minecraft.core.BlockPos; import net.minecraft.world.Difficulty; -import net.minecraft.world.level.GameRules; import net.minecraft.world.level.LevelHeightAccessor; public interface LevelData { @@ -40,11 +39,6 @@ public interface LevelData { */ boolean isHardcore(); - /** - * Gets the GameRules class Instance. - */ - GameRules getGameRules(); - Difficulty getDifficulty(); boolean isDifficultyLocked(); diff --git a/net/minecraft/world/level/storage/LevelStorageSource.java b/net/minecraft/world/level/storage/LevelStorageSource.java index 537d7104..3f738727 100644 --- a/net/minecraft/world/level/storage/LevelStorageSource.java +++ b/net/minecraft/world/level/storage/LevelStorageSource.java @@ -9,15 +9,12 @@ import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.IOException; import java.io.UncheckedIOException; -import java.nio.file.FileVisitResult; import java.nio.file.Files; import java.nio.file.InvalidPathException; import java.nio.file.LinkOption; import java.nio.file.Path; import java.nio.file.PathMatcher; import java.nio.file.Paths; -import java.nio.file.SimpleFileVisitor; -import java.nio.file.attribute.BasicFileAttributes; import java.time.Instant; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; @@ -32,13 +29,13 @@ import java.util.concurrent.CompletableFuture; import java.util.function.Consumer; import java.util.stream.Collectors; import java.util.stream.Stream; -import java.util.zip.ZipEntry; import java.util.zip.ZipOutputStream; import net.minecraft.CrashReport; import net.minecraft.CrashReportCategory; import net.minecraft.FileUtil; import net.minecraft.ReportedException; import net.minecraft.Util; +import net.minecraft.core.HolderLookup; import net.minecraft.core.Registry; import net.minecraft.core.RegistryAccess; import net.minecraft.nbt.CompoundTag; @@ -69,6 +66,10 @@ import net.minecraft.world.level.dimension.DimensionType; import net.minecraft.world.level.dimension.LevelStem; import net.minecraft.world.level.levelgen.WorldDimensions; import net.minecraft.world.level.levelgen.WorldGenSettings; +import net.minecraft.world.level.storage.LevelStorageSource.LevelStorageAccess.1; +import net.minecraft.world.level.storage.LevelStorageSource.LevelStorageAccess.2; +import net.minecraft.world.level.storage.LevelSummary.CorruptedLevelSummary; +import net.minecraft.world.level.storage.LevelSummary.SymlinkLevelSummary; import net.minecraft.world.level.validation.ContentValidationException; import net.minecraft.world.level.validation.DirectoryValidator; import net.minecraft.world.level.validation.ForbiddenSymlinkInfo; @@ -79,7 +80,7 @@ import org.slf4j.Logger; public class LevelStorageSource { static final Logger LOGGER = LogUtils.getLogger(); static final DateTimeFormatter FORMATTER = FileNameDateFormatter.create(); - private static final String TAG_DATA = "Data"; + public static final String TAG_DATA = "Data"; private static final PathMatcher NO_SYMLINKS_ALLOWED = path -> false; public static final String ALLOWED_SYMLINKS_CONFIG_NAME = "allowed_symlinks.txt"; private static final int UNCOMPRESSED_NBT_QUOTA = 104857600; @@ -150,14 +151,14 @@ public class LevelStorageSource { } public static LevelDataAndDimensions getLevelDataAndDimensions( - Dynamic dynamic, WorldDataConfiguration dataConfiguration, Registry levelStemRegistry, RegistryAccess.Frozen registry + Dynamic dynamic, WorldDataConfiguration worldDataConfiguration, Registry registry, HolderLookup.Provider provider ) { - Dynamic dynamic2 = RegistryOps.injectRegistryContext(dynamic, registry); + Dynamic dynamic2 = RegistryOps.injectRegistryContext(dynamic, provider); Dynamic dynamic3 = dynamic2.get("WorldGenSettings").orElseEmptyMap(); WorldGenSettings worldGenSettings = WorldGenSettings.CODEC.parse(dynamic3).getOrThrow(); - LevelSettings levelSettings = LevelSettings.parse(dynamic2, dataConfiguration); - WorldDimensions.Complete complete = worldGenSettings.dimensions().bake(levelStemRegistry); - Lifecycle lifecycle = complete.lifecycle().add(registry.allRegistriesLifecycle()); + LevelSettings levelSettings = LevelSettings.parse(dynamic2, worldDataConfiguration); + WorldDimensions.Complete complete = worldGenSettings.dimensions().bake(registry); + Lifecycle lifecycle = complete.lifecycle().add(provider.allRegistriesLifecycle()); PrimaryLevelData primaryLevelData = PrimaryLevelData.parse(dynamic2, levelSettings, complete.specialWorldProperty(), worldGenSettings.options(), lifecycle); return new LevelDataAndDimensions(primaryLevelData, complete); } @@ -223,7 +224,6 @@ public class LevelStorageSource { return this.readLevelSummary(levelDirectory, bl); } catch (OutOfMemoryError var12) { MemoryReserve.release(); - System.gc(); String string = "Ran out of memory trying to read summary of world folder \"" + levelDirectory.directoryName() + "\""; LOGGER.error(LogUtils.FATAL_MARKER, string); OutOfMemoryError outOfMemoryError2 = new OutOfMemoryError("Ran out of memory reading level data"); @@ -241,7 +241,7 @@ public class LevelStorageSource { throw new ReportedException(crashReport); } - }, Util.backgroundExecutor())); + }, Util.backgroundExecutor().forName("loadLevelSummaries"))); } return Util.sequenceFailFastAndCancel(list).thenApply(listx -> listx.stream().filter(Objects::nonNull).sorted().toList()); @@ -272,7 +272,7 @@ public class LevelStorageSource { List list = this.worldDirValidator.validateSymlink(path); if (!list.isEmpty()) { LOGGER.warn("{}", ContentValidationException.getMessage(path, list)); - return new LevelSummary.SymlinkLevelSummary(levelDirectory.directoryName(), levelDirectory.iconFile()); + return new SymlinkLevelSummary(levelDirectory.directoryName(), levelDirectory.iconFile()); } } @@ -289,7 +289,7 @@ public class LevelStorageSource { } } - return new LevelSummary.CorruptedLevelSummary(levelDirectory.directoryName(), levelDirectory.iconFile(), getFileModificationTime(levelDirectory)); + return new CorruptedLevelSummary(levelDirectory.directoryName(), levelDirectory.iconFile(), getFileModificationTime(levelDirectory)); } private static long getFileModificationTime(LevelStorageSource.LevelDirectory levelDirectory) { @@ -557,37 +557,14 @@ public class LevelStorageSource { public void deleteLevel() throws IOException { this.checkLock(); - final Path path = this.levelDirectory.lockFile(); + Path path = this.levelDirectory.lockFile(); LevelStorageSource.LOGGER.info("Deleting level {}", this.levelId); for (int i = 1; i <= 5; i++) { LevelStorageSource.LOGGER.info("Attempt {}...", i); try { - Files.walkFileTree(this.levelDirectory.path(), new SimpleFileVisitor() { - public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { - if (!file.equals(path)) { - LevelStorageSource.LOGGER.debug("Deleting {}", file); - Files.delete(file); - } - - return FileVisitResult.CONTINUE; - } - - public FileVisitResult postVisitDirectory(Path dir, @Nullable IOException exception) throws IOException { - if (exception != null) { - throw exception; - } else { - if (dir.equals(LevelStorageAccess.this.levelDirectory.path())) { - LevelStorageAccess.this.lock.close(); - Files.deleteIfExists(path); - } - - Files.delete(dir); - return FileVisitResult.CONTINUE; - } - } - }); + Files.walkFileTree(this.levelDirectory.path(), new 1(this, path)); break; } catch (IOException var6) { if (i >= 5) { @@ -634,24 +611,11 @@ public class LevelStorageSource { } Path path2 = path.resolve(FileUtil.findAvailableName(path, string, ".zip")); - final ZipOutputStream zipOutputStream = new ZipOutputStream(new BufferedOutputStream(Files.newOutputStream(path2))); + ZipOutputStream zipOutputStream = new ZipOutputStream(new BufferedOutputStream(Files.newOutputStream(path2))); try { - final Path path3 = Paths.get(this.levelId); - Files.walkFileTree(this.levelDirectory.path(), new SimpleFileVisitor() { - public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { - if (file.endsWith("session.lock")) { - return FileVisitResult.CONTINUE; - } else { - String stringx = path3.resolve(LevelStorageAccess.this.levelDirectory.path().relativize(file)).toString().replace('\\', '/'); - ZipEntry zipEntry = new ZipEntry(stringx); - zipOutputStream.putNextEntry(zipEntry); - com.google.common.io.Files.asByteSource(file.toFile()).copyTo(zipOutputStream); - zipOutputStream.closeEntry(); - return FileVisitResult.CONTINUE; - } - } - }); + Path path3 = Paths.get(this.levelId); + Files.walkFileTree(this.levelDirectory.path(), new 2(this, path3, zipOutputStream)); } catch (Throwable var8) { try { zipOutputStream.close(); diff --git a/net/minecraft/world/level/storage/ServerLevelData.java b/net/minecraft/world/level/storage/ServerLevelData.java index 7ad030cc..94720bd9 100644 --- a/net/minecraft/world/level/storage/ServerLevelData.java +++ b/net/minecraft/world/level/storage/ServerLevelData.java @@ -5,6 +5,7 @@ import java.util.UUID; import net.minecraft.CrashReportCategory; import net.minecraft.CrashReportDetail; import net.minecraft.server.MinecraftServer; +import net.minecraft.world.level.GameRules; import net.minecraft.world.level.GameType; import net.minecraft.world.level.LevelHeightAccessor; import net.minecraft.world.level.border.WorldBorder; @@ -113,4 +114,6 @@ public interface ServerLevelData extends WritableLevelData { * Set current world time */ void setDayTime(long time); + + GameRules getGameRules(); } diff --git a/net/minecraft/world/level/storage/loot/BuiltInLootTables.java b/net/minecraft/world/level/storage/loot/BuiltInLootTables.java index 60480e0e..914265cf 100644 --- a/net/minecraft/world/level/storage/loot/BuiltInLootTables.java +++ b/net/minecraft/world/level/storage/loot/BuiltInLootTables.java @@ -1,11 +1,15 @@ package net.minecraft.world.level.storage.loot; import java.util.Collections; +import java.util.EnumMap; import java.util.HashSet; +import java.util.Map; import java.util.Set; +import net.minecraft.Util; import net.minecraft.core.registries.Registries; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.DyeColor; /** * Stores IDs for built in loot tables, i.e. loot tables which are not based directly on a block or entity ID. @@ -13,7 +17,6 @@ import net.minecraft.resources.ResourceLocation; public class BuiltInLootTables { private static final Set> LOCATIONS = new HashSet(); private static final Set> IMMUTABLE_LOCATIONS = Collections.unmodifiableSet(LOCATIONS); - public static final ResourceKey EMPTY = ResourceKey.create(Registries.LOOT_TABLE, ResourceLocation.withDefaultNamespace("empty")); public static final ResourceKey SPAWN_BONUS_CHEST = register("chests/spawn_bonus_chest"); public static final ResourceKey END_CITY_TREASURE = register("chests/end_city_treasure"); public static final ResourceKey SIMPLE_DUNGEON = register("chests/simple_dungeon"); @@ -77,22 +80,9 @@ public class BuiltInLootTables { public static final ResourceKey EQUIPMENT_TRIAL_CHAMBER = register("equipment/trial_chamber"); public static final ResourceKey EQUIPMENT_TRIAL_CHAMBER_RANGED = register("equipment/trial_chamber_ranged"); public static final ResourceKey EQUIPMENT_TRIAL_CHAMBER_MELEE = register("equipment/trial_chamber_melee"); - public static final ResourceKey SHEEP_WHITE = register("entities/sheep/white"); - public static final ResourceKey SHEEP_ORANGE = register("entities/sheep/orange"); - public static final ResourceKey SHEEP_MAGENTA = register("entities/sheep/magenta"); - public static final ResourceKey SHEEP_LIGHT_BLUE = register("entities/sheep/light_blue"); - public static final ResourceKey SHEEP_YELLOW = register("entities/sheep/yellow"); - public static final ResourceKey SHEEP_LIME = register("entities/sheep/lime"); - public static final ResourceKey SHEEP_PINK = register("entities/sheep/pink"); - public static final ResourceKey SHEEP_GRAY = register("entities/sheep/gray"); - public static final ResourceKey SHEEP_LIGHT_GRAY = register("entities/sheep/light_gray"); - public static final ResourceKey SHEEP_CYAN = register("entities/sheep/cyan"); - public static final ResourceKey SHEEP_PURPLE = register("entities/sheep/purple"); - public static final ResourceKey SHEEP_BLUE = register("entities/sheep/blue"); - public static final ResourceKey SHEEP_BROWN = register("entities/sheep/brown"); - public static final ResourceKey SHEEP_GREEN = register("entities/sheep/green"); - public static final ResourceKey SHEEP_RED = register("entities/sheep/red"); - public static final ResourceKey SHEEP_BLACK = register("entities/sheep/black"); + public static final Map> SHEEP_BY_DYE = Util.make( + new EnumMap(DyeColor.class), enumMap -> makeDyeKeyMap(enumMap, "entities/sheep") + ); public static final ResourceKey FISHING = register("gameplay/fishing"); public static final ResourceKey FISHING_JUNK = register("gameplay/fishing/junk"); public static final ResourceKey FISHING_TREASURE = register("gameplay/fishing/treasure"); @@ -111,8 +101,12 @@ public class BuiltInLootTables { public static final ResourceKey SHEPHERD_GIFT = register("gameplay/hero_of_the_village/shepherd_gift"); public static final ResourceKey TOOLSMITH_GIFT = register("gameplay/hero_of_the_village/toolsmith_gift"); public static final ResourceKey WEAPONSMITH_GIFT = register("gameplay/hero_of_the_village/weaponsmith_gift"); + public static final ResourceKey UNEMPLOYED_GIFT = register("gameplay/hero_of_the_village/unemployed_gift"); + public static final ResourceKey BABY_VILLAGER_GIFT = register("gameplay/hero_of_the_village/baby_gift"); public static final ResourceKey SNIFFER_DIGGING = register("gameplay/sniffer_digging"); public static final ResourceKey PANDA_SNEEZE = register("gameplay/panda_sneeze"); + public static final ResourceKey CHICKEN_LAY = register("gameplay/chicken_lay"); + public static final ResourceKey ARMADILLO_SHED = register("gameplay/armadillo_shed"); public static final ResourceKey PIGLIN_BARTERING = register("gameplay/piglin_bartering"); public static final ResourceKey SPAWNER_TRIAL_CHAMBER_KEY = register("spawners/trial_chamber/key"); public static final ResourceKey SPAWNER_TRIAL_CHAMBER_CONSUMABLES = register("spawners/trial_chamber/consumables"); @@ -120,6 +114,14 @@ public class BuiltInLootTables { public static final ResourceKey SPAWNER_OMINOUS_TRIAL_CHAMBER_CONSUMABLES = register("spawners/ominous/trial_chamber/consumables"); public static final ResourceKey SPAWNER_TRIAL_ITEMS_TO_DROP_WHEN_OMINOUS = register("spawners/trial_chamber/items_to_drop_when_ominous"); public static final ResourceKey BOGGED_SHEAR = register("shearing/bogged"); + public static final ResourceKey SHEAR_MOOSHROOM = register("shearing/mooshroom"); + public static final ResourceKey SHEAR_RED_MOOSHROOM = register("shearing/mooshroom/red"); + public static final ResourceKey SHEAR_BROWN_MOOSHROOM = register("shearing/mooshroom/brown"); + public static final ResourceKey SHEAR_SNOW_GOLEM = register("shearing/snow_golem"); + public static final ResourceKey SHEAR_SHEEP = register("shearing/sheep"); + public static final Map> SHEAR_SHEEP_BY_DYE = Util.make( + new EnumMap(DyeColor.class), enumMap -> makeDyeKeyMap(enumMap, "shearing/sheep") + ); public static final ResourceKey DESERT_WELL_ARCHAEOLOGY = register("archaeology/desert_well"); public static final ResourceKey DESERT_PYRAMID_ARCHAEOLOGY = register("archaeology/desert_pyramid"); public static final ResourceKey TRAIL_RUINS_ARCHAEOLOGY_COMMON = register("archaeology/trail_ruins_common"); @@ -127,6 +129,12 @@ public class BuiltInLootTables { public static final ResourceKey OCEAN_RUIN_WARM_ARCHAEOLOGY = register("archaeology/ocean_ruin_warm"); public static final ResourceKey OCEAN_RUIN_COLD_ARCHAEOLOGY = register("archaeology/ocean_ruin_cold"); + private static void makeDyeKeyMap(EnumMap> enumMap, String string) { + for (DyeColor dyeColor : DyeColor.values()) { + enumMap.put(dyeColor, register(string + "/" + dyeColor.getName())); + } + } + private static ResourceKey register(String name) { return register(ResourceKey.create(Registries.LOOT_TABLE, ResourceLocation.withDefaultNamespace(name))); } diff --git a/net/minecraft/world/level/storage/loot/IntRange.java b/net/minecraft/world/level/storage/loot/IntRange.java index 74fd952d..104b0eda 100644 --- a/net/minecraft/world/level/storage/loot/IntRange.java +++ b/net/minecraft/world/level/storage/loot/IntRange.java @@ -11,7 +11,7 @@ import java.util.OptionalInt; import java.util.Set; import java.util.function.Function; import net.minecraft.util.Mth; -import net.minecraft.world.level.storage.loot.parameters.LootContextParam; +import net.minecraft.util.context.ContextKey; import net.minecraft.world.level.storage.loot.providers.number.ConstantValue; import net.minecraft.world.level.storage.loot.providers.number.NumberProvider; import net.minecraft.world.level.storage.loot.providers.number.NumberProviders; @@ -44,8 +44,8 @@ public class IntRange { /** * The LootContextParams required for this IntRange. */ - public Set> getReferencedContextParams() { - Builder> builder = ImmutableSet.builder(); + public Set> getReferencedContextParams() { + Builder> builder = ImmutableSet.builder(); if (this.min != null) { builder.addAll(this.min.getReferencedContextParams()); } diff --git a/net/minecraft/world/level/storage/loot/LootContext.java b/net/minecraft/world/level/storage/loot/LootContext.java index d5cb77ef..16809f9b 100644 --- a/net/minecraft/world/level/storage/loot/LootContext.java +++ b/net/minecraft/world/level/storage/loot/LootContext.java @@ -10,10 +10,10 @@ import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ServerLevel; import net.minecraft.util.RandomSource; import net.minecraft.util.StringRepresentable; +import net.minecraft.util.context.ContextKey; import net.minecraft.world.entity.Entity; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.storage.loot.functions.LootItemFunction; -import net.minecraft.world.level.storage.loot.parameters.LootContextParam; import net.minecraft.world.level.storage.loot.parameters.LootContextParams; import net.minecraft.world.level.storage.loot.predicates.LootItemCondition; import org.jetbrains.annotations.Nullable; @@ -34,20 +34,17 @@ public class LootContext { this.lootDataResolver = lootDataResolver; } - /** - * Check whether the given parameter is present in this context. - */ - public boolean hasParam(LootContextParam parameter) { - return this.params.hasParam(parameter); + public boolean hasParameter(ContextKey contextKey) { + return this.params.contextMap().has(contextKey); } - /** - * Get the value of the given parameter. - * - * @throws NoSuchElementException if the parameter is not present in this context - */ - public T getParam(LootContextParam param) { - return this.params.getParameter(param); + public T getParameter(ContextKey contextKey) { + return this.params.contextMap().getOrThrow(contextKey); + } + + @Nullable + public T getOptionalParameter(ContextKey contextKey) { + return this.params.contextMap().getOptional(contextKey); } /** @@ -60,14 +57,6 @@ public class LootContext { this.params.addDynamicDrops(name, consumer); } - /** - * Get the value of the given parameter if it is present in this context, null otherwise. - */ - @Nullable - public T getParamOrNull(LootContextParam parameter) { - return this.params.getParamOrNull(parameter); - } - public boolean hasVisitedElement(LootContext.VisitedEntry element) { return this.visitedElements.contains(element); } @@ -162,14 +151,14 @@ public class LootContext { public static final StringRepresentable.EnumCodec CODEC = StringRepresentable.fromEnum(LootContext.EntityTarget::values); private final String name; - private final LootContextParam param; + private final ContextKey param; - private EntityTarget(final String name, final LootContextParam param) { - this.name = name; - this.param = param; + private EntityTarget(final String string2, final ContextKey contextKey) { + this.name = string2; + this.param = contextKey; } - public LootContextParam getParam() { + public ContextKey getParam() { return this.param; } diff --git a/net/minecraft/world/level/storage/loot/LootContextUser.java b/net/minecraft/world/level/storage/loot/LootContextUser.java index a6855a0c..421abc85 100644 --- a/net/minecraft/world/level/storage/loot/LootContextUser.java +++ b/net/minecraft/world/level/storage/loot/LootContextUser.java @@ -1,7 +1,7 @@ package net.minecraft.world.level.storage.loot; import java.util.Set; -import net.minecraft.world.level.storage.loot.parameters.LootContextParam; +import net.minecraft.util.context.ContextKey; /** * An object that will use some parameters from a LootContext. Used for validation purposes to validate that the correct parameters are present. @@ -10,7 +10,7 @@ public interface LootContextUser { /** * Get the parameters used by this object. */ - default Set> getReferencedContextParams() { + default Set> getReferencedContextParams() { return Set.of(); } @@ -18,6 +18,6 @@ public interface LootContextUser { * Validate that this object is used correctly according to the given ValidationContext. */ default void validate(ValidationContext context) { - context.validateUser(this); + context.validateContextUsage(this); } } diff --git a/net/minecraft/world/level/storage/loot/LootDataType.java b/net/minecraft/world/level/storage/loot/LootDataType.java index 75cb3a2a..f36de6fc 100644 --- a/net/minecraft/world/level/storage/loot/LootDataType.java +++ b/net/minecraft/world/level/storage/loot/LootDataType.java @@ -1,22 +1,15 @@ package net.minecraft.world.level.storage.loot; -import com.mojang.logging.LogUtils; import com.mojang.serialization.Codec; -import com.mojang.serialization.DataResult; -import com.mojang.serialization.DynamicOps; -import java.util.Optional; import java.util.stream.Stream; import net.minecraft.core.Registry; import net.minecraft.core.registries.Registries; import net.minecraft.resources.ResourceKey; -import net.minecraft.resources.ResourceLocation; import net.minecraft.world.level.storage.loot.functions.LootItemFunction; import net.minecraft.world.level.storage.loot.functions.LootItemFunctions; import net.minecraft.world.level.storage.loot.predicates.LootItemCondition; -import org.slf4j.Logger; public record LootDataType(ResourceKey> registryKey, Codec codec, LootDataType.Validator validator) { - private static final Logger LOGGER = LogUtils.getLogger(); public static final LootDataType PREDICATE = new LootDataType<>( Registries.PREDICATE, LootItemCondition.DIRECT_CODEC, createSimpleValidator() ); @@ -29,12 +22,6 @@ public record LootDataType(ResourceKey> registryKey, Codec cod this.validator.run(context, key, value); } - public Optional deserialize(ResourceLocation resourceLocation, DynamicOps ops, V value) { - DataResult dataResult = this.codec.parse(ops, value); - dataResult.error().ifPresent(error -> LOGGER.error("Couldn't parse element {}/{} - {}", this.registryKey.location(), resourceLocation, error.message())); - return dataResult.result(); - } - public static Stream> values() { return Stream.of(PREDICATE, MODIFIER, TABLE); } @@ -47,7 +34,7 @@ public record LootDataType(ResourceKey> registryKey, Codec cod private static LootDataType.Validator createLootTableValidator() { return (validationContext, resourceKey, lootTable) -> lootTable.validate( - validationContext.setParams(lootTable.getParamSet()).enterElement("{" + resourceKey.registry() + "/" + resourceKey.location() + "}", resourceKey) + validationContext.setContextKeySet(lootTable.getParamSet()).enterElement("{" + resourceKey.registry() + "/" + resourceKey.location() + "}", resourceKey) ); } diff --git a/net/minecraft/world/level/storage/loot/LootParams.java b/net/minecraft/world/level/storage/loot/LootParams.java index 6d422c22..d1900ca7 100644 --- a/net/minecraft/world/level/storage/loot/LootParams.java +++ b/net/minecraft/world/level/storage/loot/LootParams.java @@ -1,56 +1,35 @@ package net.minecraft.world.level.storage.loot; import com.google.common.collect.Maps; -import com.google.common.collect.Sets; import java.util.Map; -import java.util.NoSuchElementException; -import java.util.Set; import java.util.function.Consumer; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.level.ServerLevel; +import net.minecraft.util.context.ContextKey; +import net.minecraft.util.context.ContextKeySet; +import net.minecraft.util.context.ContextMap; import net.minecraft.world.item.ItemStack; -import net.minecraft.world.level.storage.loot.parameters.LootContextParam; -import net.minecraft.world.level.storage.loot.parameters.LootContextParamSet; import org.jetbrains.annotations.Nullable; public class LootParams { private final ServerLevel level; - private final Map, Object> params; + private final ContextMap params; private final Map dynamicDrops; private final float luck; - public LootParams(ServerLevel level, Map, Object> params, Map dynamicDrops, float luck) { - this.level = level; - this.params = params; - this.dynamicDrops = dynamicDrops; - this.luck = luck; + public LootParams(ServerLevel serverLevel, ContextMap contextMap, Map map, float f) { + this.level = serverLevel; + this.params = contextMap; + this.dynamicDrops = map; + this.luck = f; } public ServerLevel getLevel() { return this.level; } - public boolean hasParam(LootContextParam param) { - return this.params.containsKey(param); - } - - public T getParameter(LootContextParam param) { - T object = (T)this.params.get(param); - if (object == null) { - throw new NoSuchElementException(param.getName().toString()); - } else { - return object; - } - } - - @Nullable - public T getOptionalParameter(LootContextParam param) { - return (T)this.params.get(param); - } - - @Nullable - public T getParamOrNull(LootContextParam param) { - return (T)this.params.get(param); + public ContextMap contextMap() { + return this.params; } public void addDynamicDrops(ResourceLocation location, Consumer consumer) { @@ -66,7 +45,7 @@ public class LootParams { public static class Builder { private final ServerLevel level; - private final Map, Object> params = Maps., Object>newIdentityHashMap(); + private final ContextMap.Builder params = new ContextMap.Builder(); private final Map dynamicDrops = Maps.newHashMap(); private float luck; @@ -78,33 +57,23 @@ public class LootParams { return this.level; } - public LootParams.Builder withParameter(LootContextParam parameter, T value) { - this.params.put(parameter, value); + public LootParams.Builder withParameter(ContextKey contextKey, T object) { + this.params.withParameter(contextKey, object); return this; } - public LootParams.Builder withOptionalParameter(LootContextParam parameter, @Nullable T value) { - if (value == null) { - this.params.remove(parameter); - } else { - this.params.put(parameter, value); - } - + public LootParams.Builder withOptionalParameter(ContextKey contextKey, @Nullable T object) { + this.params.withOptionalParameter(contextKey, object); return this; } - public T getParameter(LootContextParam parameter) { - T object = (T)this.params.get(parameter); - if (object == null) { - throw new NoSuchElementException(parameter.getName().toString()); - } else { - return object; - } + public T getParameter(ContextKey contextKey) { + return this.params.getParameter(contextKey); } @Nullable - public T getOptionalParameter(LootContextParam parameter) { - return (T)this.params.get(parameter); + public T getOptionalParameter(ContextKey contextKey) { + return this.params.getOptionalParameter(contextKey); } public LootParams.Builder withDynamicDrop(ResourceLocation name, LootParams.DynamicDrop dynamicDrop) { @@ -121,18 +90,9 @@ public class LootParams { return this; } - public LootParams create(LootContextParamSet params) { - Set> set = Sets.>difference(this.params.keySet(), params.getAllowed()); - if (!set.isEmpty()) { - throw new IllegalArgumentException("Parameters not allowed in this parameter set: " + set); - } else { - Set> set2 = Sets.>difference(params.getRequired(), this.params.keySet()); - if (!set2.isEmpty()) { - throw new IllegalArgumentException("Missing required parameters: " + set2); - } else { - return new LootParams(this.level, this.params, this.dynamicDrops, this.luck); - } - } + public LootParams create(ContextKeySet contextKeySet) { + ContextMap contextMap = this.params.create(contextKeySet); + return new LootParams(this.level, contextMap, this.dynamicDrops, this.luck); } } diff --git a/net/minecraft/world/level/storage/loot/LootTable.java b/net/minecraft/world/level/storage/loot/LootTable.java index d4d4394f..19940a84 100644 --- a/net/minecraft/world/level/storage/loot/LootTable.java +++ b/net/minecraft/world/level/storage/loot/LootTable.java @@ -19,19 +19,19 @@ import net.minecraft.resources.ResourceLocation; import net.minecraft.server.level.ServerLevel; import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; +import net.minecraft.util.context.ContextKeySet; import net.minecraft.world.Container; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.storage.loot.functions.FunctionUserBuilder; import net.minecraft.world.level.storage.loot.functions.LootItemFunction; import net.minecraft.world.level.storage.loot.functions.LootItemFunctions; -import net.minecraft.world.level.storage.loot.parameters.LootContextParamSet; import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets; import org.slf4j.Logger; public class LootTable { private static final Logger LOGGER = LogUtils.getLogger(); public static final LootTable EMPTY = new LootTable(LootContextParamSets.EMPTY, Optional.empty(), List.of(), List.of()); - public static final LootContextParamSet DEFAULT_PARAM_SET = LootContextParamSets.ALL_PARAMS; + public static final ContextKeySet DEFAULT_PARAM_SET = LootContextParamSets.ALL_PARAMS; public static final long RANDOMIZE_SEED = 0L; public static final Codec DIRECT_CODEC = RecordCodecBuilder.create( instance -> instance.group( @@ -43,18 +43,18 @@ public class LootTable { .apply(instance, LootTable::new) ); public static final Codec> CODEC = RegistryFileCodec.create(Registries.LOOT_TABLE, DIRECT_CODEC); - private final LootContextParamSet paramSet; + private final ContextKeySet paramSet; private final Optional randomSequence; private final List pools; private final List functions; private final BiFunction compositeFunction; - LootTable(LootContextParamSet paramSet, Optional randomSequence, List pools, List functions) { - this.paramSet = paramSet; - this.randomSequence = randomSequence; - this.pools = pools; - this.functions = functions; - this.compositeFunction = LootItemFunctions.compose(functions); + LootTable(ContextKeySet contextKeySet, Optional optional, List list, List list2) { + this.paramSet = contextKeySet; + this.randomSequence = optional; + this.pools = list; + this.functions = list2; + this.compositeFunction = LootItemFunctions.compose(list2); } public static Consumer createStackSplitter(ServerLevel level, Consumer output) { @@ -135,10 +135,7 @@ public class LootTable { return objectArrayList; } - /** - * Get the parameter set for this LootTable. - */ - public LootContextParamSet getParamSet() { + public ContextKeySet getParamSet() { return this.paramSet; } @@ -234,7 +231,7 @@ public class LootTable { public static class Builder implements FunctionUserBuilder { private final ImmutableList.Builder pools = ImmutableList.builder(); private final ImmutableList.Builder functions = ImmutableList.builder(); - private LootContextParamSet paramSet = LootTable.DEFAULT_PARAM_SET; + private ContextKeySet paramSet = LootTable.DEFAULT_PARAM_SET; private Optional randomSequence = Optional.empty(); public LootTable.Builder withPool(LootPool.Builder lootPool) { @@ -242,8 +239,8 @@ public class LootTable { return this; } - public LootTable.Builder setParamSet(LootContextParamSet parameterSet) { - this.paramSet = parameterSet; + public LootTable.Builder setParamSet(ContextKeySet contextKeySet) { + this.paramSet = contextKeySet; return this; } diff --git a/net/minecraft/world/level/storage/loot/ValidationContext.java b/net/minecraft/world/level/storage/loot/ValidationContext.java index 52f860d0..4ee1c1bb 100644 --- a/net/minecraft/world/level/storage/loot/ValidationContext.java +++ b/net/minecraft/world/level/storage/loot/ValidationContext.java @@ -1,47 +1,49 @@ package net.minecraft.world.level.storage.loot; import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Sets; import java.util.Optional; import java.util.Set; import net.minecraft.core.HolderGetter; import net.minecraft.resources.ResourceKey; import net.minecraft.util.ProblemReporter; -import net.minecraft.world.level.storage.loot.parameters.LootContextParamSet; +import net.minecraft.util.context.ContextKey; +import net.minecraft.util.context.ContextKeySet; /** * Context for validating loot tables. Loot tables are validated recursively by checking that all functions, conditions, etc. (implementing {@link LootContextUser}) are valid according to their LootTable's {@link LootContextParamSet}. */ public class ValidationContext { private final ProblemReporter reporter; - private final LootContextParamSet params; + private final ContextKeySet contextKeySet; private final Optional resolver; private final Set> visitedElements; - public ValidationContext(ProblemReporter reporter, LootContextParamSet params, HolderGetter.Provider resolver) { - this(reporter, params, Optional.of(resolver), Set.of()); + public ValidationContext(ProblemReporter problemReporter, ContextKeySet contextKeySet, HolderGetter.Provider provider) { + this(problemReporter, contextKeySet, Optional.of(provider), Set.of()); } - public ValidationContext(ProblemReporter reporter, LootContextParamSet params) { - this(reporter, params, Optional.empty(), Set.of()); + public ValidationContext(ProblemReporter problemReporter, ContextKeySet contextKeySet) { + this(problemReporter, contextKeySet, Optional.empty(), Set.of()); } - private ValidationContext(ProblemReporter reporter, LootContextParamSet params, Optional resolver, Set> visitedElements) { - this.reporter = reporter; - this.params = params; - this.resolver = resolver; - this.visitedElements = visitedElements; + private ValidationContext(ProblemReporter problemReporter, ContextKeySet contextKeySet, Optional optional, Set> set) { + this.reporter = problemReporter; + this.contextKeySet = contextKeySet; + this.resolver = optional; + this.visitedElements = set; } /** * Create a new ValidationContext with {@code childName} being added to the context. */ public ValidationContext forChild(String childName) { - return new ValidationContext(this.reporter.forChild(childName), this.params, this.resolver, this.visitedElements); + return new ValidationContext(this.reporter.forChild(childName), this.contextKeySet, this.resolver, this.visitedElements); } public ValidationContext enterElement(String name, ResourceKey key) { Set> set = ImmutableSet.>builder().addAll(this.visitedElements).add(key).build(); - return new ValidationContext(this.reporter.forChild(name), this.params, this.resolver, set); + return new ValidationContext(this.reporter.forChild(name), this.contextKeySet, this.resolver, set); } public boolean hasVisitedElement(ResourceKey key) { @@ -55,11 +57,12 @@ public class ValidationContext { this.reporter.report(problem); } - /** - * Validate the given LootContextUser. - */ - public void validateUser(LootContextUser lootContextUser) { - this.params.validateUser(this, lootContextUser); + public void validateContextUsage(LootContextUser lootContextUser) { + Set> set = lootContextUser.getReferencedContextParams(); + Set> set2 = Sets.>difference(set, this.contextKeySet.allowed()); + if (!set2.isEmpty()) { + this.reporter.report("Parameters " + set2 + " are not provided in this context"); + } } public HolderGetter.Provider resolver() { @@ -70,11 +73,8 @@ public class ValidationContext { return this.resolver.isPresent(); } - /** - * Create a new ValidationContext with the given LootContextParamSet. - */ - public ValidationContext setParams(LootContextParamSet params) { - return new ValidationContext(this.reporter, params, this.resolver, this.visitedElements); + public ValidationContext setContextKeySet(ContextKeySet contextKeySet) { + return new ValidationContext(this.reporter, contextKeySet, this.resolver, this.visitedElements); } public ProblemReporter reporter() { diff --git a/net/minecraft/world/level/storage/loot/entries/LootItem.java b/net/minecraft/world/level/storage/loot/entries/LootItem.java index 69381abf..fb0959d6 100644 --- a/net/minecraft/world/level/storage/loot/entries/LootItem.java +++ b/net/minecraft/world/level/storage/loot/entries/LootItem.java @@ -5,7 +5,6 @@ import com.mojang.serialization.codecs.RecordCodecBuilder; import java.util.List; import java.util.function.Consumer; import net.minecraft.core.Holder; -import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.ItemLike; @@ -18,7 +17,7 @@ import net.minecraft.world.level.storage.loot.predicates.LootItemCondition; */ public class LootItem extends LootPoolSingletonContainer { public static final MapCodec CODEC = RecordCodecBuilder.mapCodec( - instance -> instance.group(BuiltInRegistries.ITEM.holderByNameCodec().fieldOf("name").forGetter(lootItem -> lootItem.item)) + instance -> instance.group(Item.CODEC.fieldOf("name").forGetter(lootItem -> lootItem.item)) ., List>and(singletonFields(instance)) .apply(instance, LootItem::new) ); diff --git a/net/minecraft/world/level/storage/loot/entries/NestedLootTable.java b/net/minecraft/world/level/storage/loot/entries/NestedLootTable.java index d99e4618..b1df0a15 100644 --- a/net/minecraft/world/level/storage/loot/entries/NestedLootTable.java +++ b/net/minecraft/world/level/storage/loot/entries/NestedLootTable.java @@ -42,10 +42,7 @@ public class NestedLootTable extends LootPoolSingletonContainer { @Override public void createItemStack(Consumer stackConsumer, LootContext lootContext) { this.contents - .map( - resourceKey -> (LootTable)lootContext.getResolver().get(Registries.LOOT_TABLE, resourceKey).map(Holder::value).orElse(LootTable.EMPTY), - lootTable -> lootTable - ) + .map(resourceKey -> (LootTable)lootContext.getResolver().get(resourceKey).map(Holder::value).orElse(LootTable.EMPTY), lootTable -> lootTable) .getRandomItemsRaw(lootContext, stackConsumer); } @@ -69,7 +66,7 @@ public class NestedLootTable extends LootPoolSingletonContainer { this.contents .ifLeft( resourceKeyx -> validationContext.resolver() - .get(Registries.LOOT_TABLE, resourceKeyx) + .get(resourceKeyx) .ifPresentOrElse( reference -> ((LootTable)reference.value()).validate(validationContext.enterElement("->{" + resourceKeyx.location() + "}", resourceKeyx)), () -> validationContext.reportProblem("Unknown loot table called " + resourceKeyx.location()) diff --git a/net/minecraft/world/level/storage/loot/functions/ApplyBonusCount.java b/net/minecraft/world/level/storage/loot/functions/ApplyBonusCount.java index 3c87b289..82016788 100644 --- a/net/minecraft/world/level/storage/loot/functions/ApplyBonusCount.java +++ b/net/minecraft/world/level/storage/loot/functions/ApplyBonusCount.java @@ -1,6 +1,5 @@ package net.minecraft.world.level.storage.loot.functions; -import com.google.common.collect.ImmutableSet; import com.mojang.serialization.Codec; import com.mojang.serialization.DataResult; import com.mojang.serialization.MapCodec; @@ -15,11 +14,11 @@ import net.minecraft.core.Holder; import net.minecraft.resources.ResourceLocation; import net.minecraft.util.ExtraCodecs; import net.minecraft.util.RandomSource; +import net.minecraft.util.context.ContextKey; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.enchantment.Enchantment; import net.minecraft.world.item.enchantment.EnchantmentHelper; import net.minecraft.world.level.storage.loot.LootContext; -import net.minecraft.world.level.storage.loot.parameters.LootContextParam; import net.minecraft.world.level.storage.loot.parameters.LootContextParams; import net.minecraft.world.level.storage.loot.predicates.LootItemCondition; @@ -63,13 +62,13 @@ public class ApplyBonusCount extends LootItemConditionalFunction { } @Override - public Set> getReferencedContextParams() { - return ImmutableSet.of(LootContextParams.TOOL); + public Set> getReferencedContextParams() { + return Set.of(LootContextParams.TOOL); } @Override public ItemStack run(ItemStack stack, LootContext context) { - ItemStack itemStack = context.getParamOrNull(LootContextParams.TOOL); + ItemStack itemStack = context.getOptionalParameter(LootContextParams.TOOL); if (itemStack != null) { int i = EnchantmentHelper.getItemEnchantmentLevel(this.enchantment, itemStack); int j = this.formula.calculateNewCount(context.getRandom(), stack.getCount(), i); diff --git a/net/minecraft/world/level/storage/loot/functions/ApplyExplosionDecay.java b/net/minecraft/world/level/storage/loot/functions/ApplyExplosionDecay.java index bea8a9a6..4f685eca 100644 --- a/net/minecraft/world/level/storage/loot/functions/ApplyExplosionDecay.java +++ b/net/minecraft/world/level/storage/loot/functions/ApplyExplosionDecay.java @@ -28,7 +28,7 @@ public class ApplyExplosionDecay extends LootItemConditionalFunction { @Override public ItemStack run(ItemStack stack, LootContext context) { - Float float_ = context.getParamOrNull(LootContextParams.EXPLOSION_RADIUS); + Float float_ = context.getOptionalParameter(LootContextParams.EXPLOSION_RADIUS); if (float_ != null) { RandomSource randomSource = context.getRandom(); float f = 1.0F / float_; diff --git a/net/minecraft/world/level/storage/loot/functions/CopyBlockState.java b/net/minecraft/world/level/storage/loot/functions/CopyBlockState.java index a28a721b..19d6d4d4 100644 --- a/net/minecraft/world/level/storage/loot/functions/CopyBlockState.java +++ b/net/minecraft/world/level/storage/loot/functions/CopyBlockState.java @@ -11,13 +11,13 @@ import java.util.stream.Collectors; import net.minecraft.core.Holder; import net.minecraft.core.component.DataComponents; import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.util.context.ContextKey; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.component.BlockItemStateProperties; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.properties.Property; import net.minecraft.world.level.storage.loot.LootContext; -import net.minecraft.world.level.storage.loot.parameters.LootContextParam; import net.minecraft.world.level.storage.loot.parameters.LootContextParams; import net.minecraft.world.level.storage.loot.predicates.LootItemCondition; @@ -59,13 +59,13 @@ public class CopyBlockState extends LootItemConditionalFunction { } @Override - public Set> getReferencedContextParams() { - return ImmutableSet.of(LootContextParams.BLOCK_STATE); + public Set> getReferencedContextParams() { + return Set.of(LootContextParams.BLOCK_STATE); } @Override protected ItemStack run(ItemStack stack, LootContext context) { - BlockState blockState = context.getParamOrNull(LootContextParams.BLOCK_STATE); + BlockState blockState = context.getOptionalParameter(LootContextParams.BLOCK_STATE); if (blockState != null) { stack.update(DataComponents.BLOCK_STATE, BlockItemStateProperties.EMPTY, blockItemStateProperties -> { for (Property property : this.properties) { diff --git a/net/minecraft/world/level/storage/loot/functions/CopyComponentsFunction.java b/net/minecraft/world/level/storage/loot/functions/CopyComponentsFunction.java index 14abbbe0..96bf9f8f 100644 --- a/net/minecraft/world/level/storage/loot/functions/CopyComponentsFunction.java +++ b/net/minecraft/world/level/storage/loot/functions/CopyComponentsFunction.java @@ -13,10 +13,10 @@ import net.minecraft.Util; import net.minecraft.core.component.DataComponentMap; import net.minecraft.core.component.DataComponentType; import net.minecraft.util.StringRepresentable; +import net.minecraft.util.context.ContextKey; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.storage.loot.LootContext; -import net.minecraft.world.level.storage.loot.parameters.LootContextParam; import net.minecraft.world.level.storage.loot.parameters.LootContextParams; import net.minecraft.world.level.storage.loot.predicates.LootItemCondition; @@ -59,7 +59,7 @@ public class CopyComponentsFunction extends LootItemConditionalFunction { } @Override - public Set> getReferencedContextParams() { + public Set> getReferencedContextParams() { return this.source.getReferencedContextParams(); } @@ -126,14 +126,14 @@ public class CopyComponentsFunction extends LootItemConditionalFunction { public DataComponentMap get(LootContext context) { switch (this) { case BLOCK_ENTITY: - BlockEntity blockEntity = context.getParamOrNull(LootContextParams.BLOCK_ENTITY); + BlockEntity blockEntity = context.getOptionalParameter(LootContextParams.BLOCK_ENTITY); return blockEntity != null ? blockEntity.collectComponents() : DataComponentMap.EMPTY; default: throw new MatchException(null, null); } } - public Set> getReferencedContextParams() { + public Set> getReferencedContextParams() { switch (this) { case BLOCK_ENTITY: return Set.of(LootContextParams.BLOCK_ENTITY); diff --git a/net/minecraft/world/level/storage/loot/functions/CopyCustomDataFunction.java b/net/minecraft/world/level/storage/loot/functions/CopyCustomDataFunction.java index af5426dd..7f1b69d0 100644 --- a/net/minecraft/world/level/storage/loot/functions/CopyCustomDataFunction.java +++ b/net/minecraft/world/level/storage/loot/functions/CopyCustomDataFunction.java @@ -1,6 +1,5 @@ package net.minecraft.world.level.storage.loot.functions; -import com.google.common.collect.Iterables; import com.google.common.collect.Lists; import com.mojang.brigadier.exceptions.CommandSyntaxException; import com.mojang.serialization.Codec; @@ -9,16 +8,15 @@ import com.mojang.serialization.codecs.RecordCodecBuilder; import java.util.List; import java.util.Set; import java.util.function.Supplier; -import net.minecraft.commands.arguments.NbtPathArgument; +import net.minecraft.commands.arguments.NbtPathArgument.NbtPath; import net.minecraft.core.component.DataComponents; import net.minecraft.nbt.CompoundTag; -import net.minecraft.nbt.ListTag; import net.minecraft.nbt.Tag; import net.minecraft.util.StringRepresentable; +import net.minecraft.util.context.ContextKey; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.component.CustomData; import net.minecraft.world.level.storage.loot.LootContext; -import net.minecraft.world.level.storage.loot.parameters.LootContextParam; import net.minecraft.world.level.storage.loot.predicates.LootItemCondition; import net.minecraft.world.level.storage.loot.providers.nbt.ContextNbtProvider; import net.minecraft.world.level.storage.loot.providers.nbt.NbtProvider; @@ -51,7 +49,7 @@ public class CopyCustomDataFunction extends LootItemConditionalFunction { } @Override - public Set> getReferencedContextParams() { + public Set> getReferencedContextParams() { return this.source.getReferencedContextParams(); } @@ -98,7 +96,7 @@ public class CopyCustomDataFunction extends LootItemConditionalFunction { public CopyCustomDataFunction.Builder copy(String sourceKey, String destinationKey, CopyCustomDataFunction.MergeStrategy mergeStrategy) { try { - this.ops.add(new CopyCustomDataFunction.CopyOperation(NbtPathArgument.NbtPath.of(sourceKey), NbtPathArgument.NbtPath.of(destinationKey), mergeStrategy)); + this.ops.add(new CopyCustomDataFunction.CopyOperation(NbtPath.of(sourceKey), NbtPath.of(destinationKey), mergeStrategy)); return this; } catch (CommandSyntaxException var5) { throw new IllegalArgumentException(var5); @@ -119,11 +117,11 @@ public class CopyCustomDataFunction extends LootItemConditionalFunction { } } - record CopyOperation(NbtPathArgument.NbtPath sourcePath, NbtPathArgument.NbtPath targetPath, CopyCustomDataFunction.MergeStrategy op) { + record CopyOperation(NbtPath sourcePath, NbtPath targetPath, CopyCustomDataFunction.MergeStrategy op) { public static final Codec CODEC = RecordCodecBuilder.create( instance -> instance.group( - NbtPathArgument.NbtPath.CODEC.fieldOf("source").forGetter(CopyCustomDataFunction.CopyOperation::sourcePath), - NbtPathArgument.NbtPath.CODEC.fieldOf("target").forGetter(CopyCustomDataFunction.CopyOperation::targetPath), + NbtPath.CODEC.fieldOf("source").forGetter(CopyCustomDataFunction.CopyOperation::sourcePath), + NbtPath.CODEC.fieldOf("target").forGetter(CopyCustomDataFunction.CopyOperation::targetPath), CopyCustomDataFunction.MergeStrategy.CODEC.fieldOf("op").forGetter(CopyCustomDataFunction.CopyOperation::op) ) .apply(instance, CopyCustomDataFunction.CopyOperation::new) @@ -141,43 +139,14 @@ public class CopyCustomDataFunction extends LootItemConditionalFunction { } public static enum MergeStrategy implements StringRepresentable { - REPLACE("replace") { - @Override - public void merge(Tag tag, NbtPathArgument.NbtPath path, List currentData) throws CommandSyntaxException { - path.set(tag, Iterables.getLast(currentData)); - } - }, - APPEND("append") { - @Override - public void merge(Tag tag, NbtPathArgument.NbtPath path, List currentData) throws CommandSyntaxException { - List list = path.getOrCreate(tag, ListTag::new); - list.forEach(tagx -> { - if (tagx instanceof ListTag) { - currentData.forEach(tag2 -> ((ListTag)tagx).add(tag2.copy())); - } - }); - } - }, - MERGE("merge") { - @Override - public void merge(Tag tag, NbtPathArgument.NbtPath path, List currentData) throws CommandSyntaxException { - List list = path.getOrCreate(tag, CompoundTag::new); - list.forEach(tagx -> { - if (tagx instanceof CompoundTag) { - currentData.forEach(tag2 -> { - if (tag2 instanceof CompoundTag) { - ((CompoundTag)tagx).merge((CompoundTag)tag2); - } - }); - } - }); - } - }; + REPLACE("REPLACE", 0, "replace"), + APPEND("APPEND", 1, "append"), + MERGE("MERGE", 2, "merge"); public static final Codec CODEC = StringRepresentable.fromEnum(CopyCustomDataFunction.MergeStrategy::values); private final String name; - public abstract void merge(Tag tag, NbtPathArgument.NbtPath path, List currentData) throws CommandSyntaxException; + public abstract void merge(Tag tag, NbtPath path, List currentData) throws CommandSyntaxException; MergeStrategy(final String name) { this.name = name; diff --git a/net/minecraft/world/level/storage/loot/functions/CopyNameFunction.java b/net/minecraft/world/level/storage/loot/functions/CopyNameFunction.java index 748c163b..48e432ae 100644 --- a/net/minecraft/world/level/storage/loot/functions/CopyNameFunction.java +++ b/net/minecraft/world/level/storage/loot/functions/CopyNameFunction.java @@ -1,6 +1,5 @@ package net.minecraft.world.level.storage.loot.functions; -import com.google.common.collect.ImmutableSet; import com.mojang.serialization.Codec; import com.mojang.serialization.MapCodec; import com.mojang.serialization.codecs.RecordCodecBuilder; @@ -8,10 +7,10 @@ import java.util.List; import java.util.Set; import net.minecraft.core.component.DataComponents; import net.minecraft.util.StringRepresentable; +import net.minecraft.util.context.ContextKey; import net.minecraft.world.Nameable; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.storage.loot.LootContext; -import net.minecraft.world.level.storage.loot.parameters.LootContextParam; import net.minecraft.world.level.storage.loot.parameters.LootContextParams; import net.minecraft.world.level.storage.loot.predicates.LootItemCondition; @@ -37,13 +36,13 @@ public class CopyNameFunction extends LootItemConditionalFunction { } @Override - public Set> getReferencedContextParams() { - return ImmutableSet.of(this.source.param); + public Set> getReferencedContextParams() { + return Set.of(this.source.param); } @Override public ItemStack run(ItemStack stack, LootContext context) { - if (context.getParamOrNull(this.source.param) instanceof Nameable nameable) { + if (context.getOptionalParameter(this.source.param) instanceof Nameable nameable) { stack.set(DataComponents.CUSTOM_NAME, nameable.getCustomName()); } @@ -62,11 +61,11 @@ public class CopyNameFunction extends LootItemConditionalFunction { public static final Codec CODEC = StringRepresentable.fromEnum(CopyNameFunction.NameSource::values); private final String name; - final LootContextParam param; + final ContextKey param; - private NameSource(final String name, final LootContextParam param) { - this.name = name; - this.param = param; + private NameSource(final String string2, final ContextKey contextKey) { + this.name = string2; + this.param = contextKey; } @Override diff --git a/net/minecraft/world/level/storage/loot/functions/EnchantRandomlyFunction.java b/net/minecraft/world/level/storage/loot/functions/EnchantRandomlyFunction.java index d4529d6c..dbc17600 100644 --- a/net/minecraft/world/level/storage/loot/functions/EnchantRandomlyFunction.java +++ b/net/minecraft/world/level/storage/loot/functions/EnchantRandomlyFunction.java @@ -60,7 +60,7 @@ public class EnchantRandomlyFunction extends LootItemConditionalFunction { boolean bl2 = !bl && this.onlyCompatible; Stream> stream = ((Stream)this.options .map(HolderSet::stream) - .orElseGet(() -> context.getLevel().registryAccess().registryOrThrow(Registries.ENCHANTMENT).holders().map(Function.identity()))) + .orElseGet(() -> context.getLevel().registryAccess().lookupOrThrow(Registries.ENCHANTMENT).listElements().map(Function.identity()))) .filter(holder -> !bl2 || ((Enchantment)holder.value()).canEnchant(stack)); List> list = stream.toList(); Optional> optional = Util.getRandomSafe(list, randomSource); diff --git a/net/minecraft/world/level/storage/loot/functions/EnchantWithLevelsFunction.java b/net/minecraft/world/level/storage/loot/functions/EnchantWithLevelsFunction.java index b0d49edf..28a7a69c 100644 --- a/net/minecraft/world/level/storage/loot/functions/EnchantWithLevelsFunction.java +++ b/net/minecraft/world/level/storage/loot/functions/EnchantWithLevelsFunction.java @@ -12,11 +12,11 @@ import net.minecraft.core.RegistryCodecs; import net.minecraft.core.registries.Registries; import net.minecraft.tags.EnchantmentTags; import net.minecraft.util.RandomSource; +import net.minecraft.util.context.ContextKey; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.enchantment.Enchantment; import net.minecraft.world.item.enchantment.EnchantmentHelper; import net.minecraft.world.level.storage.loot.LootContext; -import net.minecraft.world.level.storage.loot.parameters.LootContextParam; import net.minecraft.world.level.storage.loot.predicates.LootItemCondition; import net.minecraft.world.level.storage.loot.providers.number.NumberProvider; import net.minecraft.world.level.storage.loot.providers.number.NumberProviders; @@ -54,7 +54,7 @@ public class EnchantWithLevelsFunction extends LootItemConditionalFunction { } @Override - public Set> getReferencedContextParams() { + public Set> getReferencedContextParams() { return this.levels.getReferencedContextParams(); } diff --git a/net/minecraft/world/level/storage/loot/functions/EnchantedCountIncreaseFunction.java b/net/minecraft/world/level/storage/loot/functions/EnchantedCountIncreaseFunction.java index 3d690534..b8379f8b 100644 --- a/net/minecraft/world/level/storage/loot/functions/EnchantedCountIncreaseFunction.java +++ b/net/minecraft/world/level/storage/loot/functions/EnchantedCountIncreaseFunction.java @@ -10,6 +10,7 @@ import java.util.Set; import net.minecraft.core.Holder; import net.minecraft.core.HolderLookup; import net.minecraft.core.registries.Registries; +import net.minecraft.util.context.ContextKey; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.item.ItemStack; @@ -17,7 +18,6 @@ import net.minecraft.world.item.enchantment.Enchantment; import net.minecraft.world.item.enchantment.EnchantmentHelper; import net.minecraft.world.item.enchantment.Enchantments; import net.minecraft.world.level.storage.loot.LootContext; -import net.minecraft.world.level.storage.loot.parameters.LootContextParam; import net.minecraft.world.level.storage.loot.parameters.LootContextParams; import net.minecraft.world.level.storage.loot.predicates.LootItemCondition; import net.minecraft.world.level.storage.loot.providers.number.NumberProvider; @@ -53,8 +53,8 @@ public class EnchantedCountIncreaseFunction extends LootItemConditionalFunction } @Override - public Set> getReferencedContextParams() { - return Sets.>union(ImmutableSet.of(LootContextParams.ATTACKING_ENTITY), this.value.getReferencedContextParams()); + public Set> getReferencedContextParams() { + return Sets.>union(ImmutableSet.of(LootContextParams.ATTACKING_ENTITY), this.value.getReferencedContextParams()); } private boolean hasLimit() { @@ -63,7 +63,7 @@ public class EnchantedCountIncreaseFunction extends LootItemConditionalFunction @Override public ItemStack run(ItemStack stack, LootContext context) { - Entity entity = context.getParamOrNull(LootContextParams.ATTACKING_ENTITY); + Entity entity = context.getOptionalParameter(LootContextParams.ATTACKING_ENTITY); if (entity instanceof LivingEntity livingEntity) { int i = EnchantmentHelper.getEnchantmentLevel(this.enchantment, livingEntity); if (i == 0) { diff --git a/net/minecraft/world/level/storage/loot/functions/ExplorationMapFunction.java b/net/minecraft/world/level/storage/loot/functions/ExplorationMapFunction.java index c070641b..3172528e 100644 --- a/net/minecraft/world/level/storage/loot/functions/ExplorationMapFunction.java +++ b/net/minecraft/world/level/storage/loot/functions/ExplorationMapFunction.java @@ -1,6 +1,5 @@ package net.minecraft.world.level.storage.loot.functions; -import com.google.common.collect.ImmutableSet; import com.mojang.serialization.Codec; import com.mojang.serialization.MapCodec; import com.mojang.serialization.codecs.RecordCodecBuilder; @@ -12,6 +11,7 @@ import net.minecraft.core.registries.Registries; import net.minecraft.server.level.ServerLevel; import net.minecraft.tags.StructureTags; import net.minecraft.tags.TagKey; +import net.minecraft.util.context.ContextKey; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.item.MapItem; @@ -20,7 +20,6 @@ import net.minecraft.world.level.saveddata.maps.MapDecorationType; import net.minecraft.world.level.saveddata.maps.MapDecorationTypes; import net.minecraft.world.level.saveddata.maps.MapItemSavedData; import net.minecraft.world.level.storage.loot.LootContext; -import net.minecraft.world.level.storage.loot.parameters.LootContextParam; import net.minecraft.world.level.storage.loot.parameters.LootContextParams; import net.minecraft.world.level.storage.loot.predicates.LootItemCondition; import net.minecraft.world.phys.Vec3; @@ -77,8 +76,8 @@ public class ExplorationMapFunction extends LootItemConditionalFunction { } @Override - public Set> getReferencedContextParams() { - return ImmutableSet.of(LootContextParams.ORIGIN); + public Set> getReferencedContextParams() { + return Set.of(LootContextParams.ORIGIN); } @Override @@ -86,7 +85,7 @@ public class ExplorationMapFunction extends LootItemConditionalFunction { if (!stack.is(Items.MAP)) { return stack; } else { - Vec3 vec3 = context.getParamOrNull(LootContextParams.ORIGIN); + Vec3 vec3 = context.getOptionalParameter(LootContextParams.ORIGIN); if (vec3 != null) { ServerLevel serverLevel = context.getLevel(); BlockPos blockPos = serverLevel.findNearestMapStructure(this.destination, BlockPos.containing(vec3), this.searchRadius, this.skipKnownStructures); diff --git a/net/minecraft/world/level/storage/loot/functions/FillPlayerHead.java b/net/minecraft/world/level/storage/loot/functions/FillPlayerHead.java index 3f37701c..9b4f4f3c 100644 --- a/net/minecraft/world/level/storage/loot/functions/FillPlayerHead.java +++ b/net/minecraft/world/level/storage/loot/functions/FillPlayerHead.java @@ -1,17 +1,16 @@ package net.minecraft.world.level.storage.loot.functions; -import com.google.common.collect.ImmutableSet; import com.mojang.serialization.MapCodec; import com.mojang.serialization.codecs.RecordCodecBuilder; import java.util.List; import java.util.Set; import net.minecraft.core.component.DataComponents; +import net.minecraft.util.context.ContextKey; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.item.component.ResolvableProfile; import net.minecraft.world.level.storage.loot.LootContext; -import net.minecraft.world.level.storage.loot.parameters.LootContextParam; import net.minecraft.world.level.storage.loot.predicates.LootItemCondition; /** @@ -37,13 +36,13 @@ public class FillPlayerHead extends LootItemConditionalFunction { } @Override - public Set> getReferencedContextParams() { - return ImmutableSet.of(this.entityTarget.getParam()); + public Set> getReferencedContextParams() { + return Set.of(this.entityTarget.getParam()); } @Override public ItemStack run(ItemStack stack, LootContext context) { - if (stack.is(Items.PLAYER_HEAD) && context.getParamOrNull(this.entityTarget.getParam()) instanceof Player player) { + if (stack.is(Items.PLAYER_HEAD) && context.getOptionalParameter(this.entityTarget.getParam()) instanceof Player player) { stack.set(DataComponents.PROFILE, new ResolvableProfile(player.getGameProfile())); } diff --git a/net/minecraft/world/level/storage/loot/functions/FunctionReference.java b/net/minecraft/world/level/storage/loot/functions/FunctionReference.java index 70abce9f..052fc95a 100644 --- a/net/minecraft/world/level/storage/loot/functions/FunctionReference.java +++ b/net/minecraft/world/level/storage/loot/functions/FunctionReference.java @@ -41,7 +41,7 @@ public class FunctionReference extends LootItemConditionalFunction { } else { super.validate(context); context.resolver() - .get(Registries.ITEM_MODIFIER, this.name) + .get(this.name) .ifPresentOrElse( reference -> ((LootItemFunction)reference.value()).validate(context.enterElement(".{" + this.name.location() + "}", this.name)), () -> context.reportProblem("Unknown function table called " + this.name.location()) @@ -51,7 +51,7 @@ public class FunctionReference extends LootItemConditionalFunction { @Override protected ItemStack run(ItemStack stack, LootContext context) { - LootItemFunction lootItemFunction = (LootItemFunction)context.getResolver().get(Registries.ITEM_MODIFIER, this.name).map(Holder::value).orElse(null); + LootItemFunction lootItemFunction = (LootItemFunction)context.getResolver().get(this.name).map(Holder::value).orElse(null); if (lootItemFunction == null) { LOGGER.warn("Unknown function: {}", this.name.location()); return stack; diff --git a/net/minecraft/world/level/storage/loot/functions/LimitCount.java b/net/minecraft/world/level/storage/loot/functions/LimitCount.java index 166727ee..569d73c7 100644 --- a/net/minecraft/world/level/storage/loot/functions/LimitCount.java +++ b/net/minecraft/world/level/storage/loot/functions/LimitCount.java @@ -4,10 +4,10 @@ import com.mojang.serialization.MapCodec; import com.mojang.serialization.codecs.RecordCodecBuilder; import java.util.List; import java.util.Set; +import net.minecraft.util.context.ContextKey; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.storage.loot.IntRange; import net.minecraft.world.level.storage.loot.LootContext; -import net.minecraft.world.level.storage.loot.parameters.LootContextParam; import net.minecraft.world.level.storage.loot.predicates.LootItemCondition; /** @@ -30,7 +30,7 @@ public class LimitCount extends LootItemConditionalFunction { } @Override - public Set> getReferencedContextParams() { + public Set> getReferencedContextParams() { return this.limiter.getReferencedContextParams(); } diff --git a/net/minecraft/world/level/storage/loot/functions/SetAttributesFunction.java b/net/minecraft/world/level/storage/loot/functions/SetAttributesFunction.java index 0d1d71ee..099630b9 100644 --- a/net/minecraft/world/level/storage/loot/functions/SetAttributesFunction.java +++ b/net/minecraft/world/level/storage/loot/functions/SetAttributesFunction.java @@ -16,13 +16,13 @@ import net.minecraft.core.component.DataComponents; import net.minecraft.resources.ResourceLocation; import net.minecraft.util.ExtraCodecs; import net.minecraft.util.RandomSource; +import net.minecraft.util.context.ContextKey; import net.minecraft.world.entity.EquipmentSlotGroup; import net.minecraft.world.entity.ai.attributes.Attribute; import net.minecraft.world.entity.ai.attributes.AttributeModifier; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.component.ItemAttributeModifiers; import net.minecraft.world.level.storage.loot.LootContext; -import net.minecraft.world.level.storage.loot.parameters.LootContextParam; import net.minecraft.world.level.storage.loot.predicates.LootItemCondition; import net.minecraft.world.level.storage.loot.providers.number.NumberProvider; import net.minecraft.world.level.storage.loot.providers.number.NumberProviders; @@ -56,8 +56,8 @@ public class SetAttributesFunction extends LootItemConditionalFunction { } @Override - public Set> getReferencedContextParams() { - return (Set>)this.modifiers + public Set> getReferencedContextParams() { + return (Set>)this.modifiers .stream() .flatMap(modifier -> modifier.amount.getReferencedContextParams().stream()) .collect(ImmutableSet.toImmutableSet()); @@ -69,11 +69,7 @@ public class SetAttributesFunction extends LootItemConditionalFunction { stack.set(DataComponents.ATTRIBUTE_MODIFIERS, this.updateModifiers(context, ItemAttributeModifiers.EMPTY)); } else { stack.update( - DataComponents.ATTRIBUTE_MODIFIERS, - ItemAttributeModifiers.EMPTY, - itemAttributeModifiers -> itemAttributeModifiers.modifiers().isEmpty() - ? this.updateModifiers(context, stack.getItem().getDefaultAttributeModifiers()) - : this.updateModifiers(context, itemAttributeModifiers) + DataComponents.ATTRIBUTE_MODIFIERS, ItemAttributeModifiers.EMPTY, itemAttributeModifiers -> this.updateModifiers(context, itemAttributeModifiers) ); } diff --git a/net/minecraft/world/level/storage/loot/functions/SetContainerLootTable.java b/net/minecraft/world/level/storage/loot/functions/SetContainerLootTable.java index 7cc0bdb2..cb185ca8 100644 --- a/net/minecraft/world/level/storage/loot/functions/SetContainerLootTable.java +++ b/net/minecraft/world/level/storage/loot/functions/SetContainerLootTable.java @@ -64,7 +64,7 @@ public class SetContainerLootTable extends LootItemConditionalFunction { if (!context.allowsReferences()) { context.reportProblem("Uses reference to " + this.name.location() + ", but references are not allowed"); } else { - if (context.resolver().get(Registries.LOOT_TABLE, this.name).isEmpty()) { + if (context.resolver().get(this.name).isEmpty()) { context.reportProblem("Missing loot table used for container: " + this.name.location()); } } diff --git a/net/minecraft/world/level/storage/loot/functions/SetCustomModelDataFunction.java b/net/minecraft/world/level/storage/loot/functions/SetCustomModelDataFunction.java index def522f4..ad14856f 100644 --- a/net/minecraft/world/level/storage/loot/functions/SetCustomModelDataFunction.java +++ b/net/minecraft/world/level/storage/loot/functions/SetCustomModelDataFunction.java @@ -5,10 +5,10 @@ import com.mojang.serialization.codecs.RecordCodecBuilder; import java.util.List; import java.util.Set; import net.minecraft.core.component.DataComponents; +import net.minecraft.util.context.ContextKey; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.component.CustomModelData; import net.minecraft.world.level.storage.loot.LootContext; -import net.minecraft.world.level.storage.loot.parameters.LootContextParam; import net.minecraft.world.level.storage.loot.predicates.LootItemCondition; import net.minecraft.world.level.storage.loot.providers.number.NumberProvider; import net.minecraft.world.level.storage.loot.providers.number.NumberProviders; @@ -27,7 +27,7 @@ public class SetCustomModelDataFunction extends LootItemConditionalFunction { } @Override - public Set> getReferencedContextParams() { + public Set> getReferencedContextParams() { return this.valueProvider.getReferencedContextParams(); } diff --git a/net/minecraft/world/level/storage/loot/functions/SetEnchantmentsFunction.java b/net/minecraft/world/level/storage/loot/functions/SetEnchantmentsFunction.java index d3c7b5ff..7c657322 100644 --- a/net/minecraft/world/level/storage/loot/functions/SetEnchantmentsFunction.java +++ b/net/minecraft/world/level/storage/loot/functions/SetEnchantmentsFunction.java @@ -9,14 +9,13 @@ import java.util.List; import java.util.Map; import java.util.Set; import net.minecraft.core.Holder; -import net.minecraft.core.component.DataComponents; import net.minecraft.util.Mth; +import net.minecraft.util.context.ContextKey; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.item.enchantment.Enchantment; import net.minecraft.world.item.enchantment.EnchantmentHelper; import net.minecraft.world.level.storage.loot.LootContext; -import net.minecraft.world.level.storage.loot.parameters.LootContextParam; import net.minecraft.world.level.storage.loot.predicates.LootItemCondition; import net.minecraft.world.level.storage.loot.providers.number.NumberProvider; import net.minecraft.world.level.storage.loot.providers.number.NumberProviders; @@ -52,8 +51,8 @@ public class SetEnchantmentsFunction extends LootItemConditionalFunction { } @Override - public Set> getReferencedContextParams() { - return (Set>)this.enchantments + public Set> getReferencedContextParams() { + return (Set>)this.enchantments .values() .stream() .flatMap(numberProvider -> numberProvider.getReferencedContextParams().stream()) @@ -64,7 +63,6 @@ public class SetEnchantmentsFunction extends LootItemConditionalFunction { public ItemStack run(ItemStack stack, LootContext context) { if (stack.is(Items.BOOK)) { stack = stack.transmuteCopy(Items.ENCHANTED_BOOK); - stack.set(DataComponents.STORED_ENCHANTMENTS, stack.remove(DataComponents.ENCHANTMENTS)); } EnchantmentHelper.updateEnchantments(stack, mutable -> { diff --git a/net/minecraft/world/level/storage/loot/functions/SetInstrumentFunction.java b/net/minecraft/world/level/storage/loot/functions/SetInstrumentFunction.java index 86302ad9..9a6d8139 100644 --- a/net/minecraft/world/level/storage/loot/functions/SetInstrumentFunction.java +++ b/net/minecraft/world/level/storage/loot/functions/SetInstrumentFunction.java @@ -3,10 +3,13 @@ package net.minecraft.world.level.storage.loot.functions; import com.mojang.serialization.MapCodec; import com.mojang.serialization.codecs.RecordCodecBuilder; import java.util.List; +import java.util.Optional; +import net.minecraft.core.Holder; +import net.minecraft.core.Registry; +import net.minecraft.core.component.DataComponents; import net.minecraft.core.registries.Registries; import net.minecraft.tags.TagKey; import net.minecraft.world.item.Instrument; -import net.minecraft.world.item.InstrumentItem; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.storage.loot.LootContext; import net.minecraft.world.level.storage.loot.predicates.LootItemCondition; @@ -31,7 +34,12 @@ public class SetInstrumentFunction extends LootItemConditionalFunction { @Override public ItemStack run(ItemStack stack, LootContext context) { - InstrumentItem.setRandom(stack, this.options, context.getRandom()); + Registry registry = context.getLevel().registryAccess().lookupOrThrow(Registries.INSTRUMENT); + Optional> optional = registry.getRandomElementOf(this.options, context.getRandom()); + if (optional.isPresent()) { + stack.set(DataComponents.INSTRUMENT, (Holder)optional.get()); + } + return stack; } diff --git a/net/minecraft/world/level/storage/loot/functions/SetItemCountFunction.java b/net/minecraft/world/level/storage/loot/functions/SetItemCountFunction.java index bf88ed8e..68fbbe5d 100644 --- a/net/minecraft/world/level/storage/loot/functions/SetItemCountFunction.java +++ b/net/minecraft/world/level/storage/loot/functions/SetItemCountFunction.java @@ -5,9 +5,9 @@ import com.mojang.serialization.MapCodec; import com.mojang.serialization.codecs.RecordCodecBuilder; import java.util.List; import java.util.Set; +import net.minecraft.util.context.ContextKey; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.storage.loot.LootContext; -import net.minecraft.world.level.storage.loot.parameters.LootContextParam; import net.minecraft.world.level.storage.loot.predicates.LootItemCondition; import net.minecraft.world.level.storage.loot.providers.number.NumberProvider; import net.minecraft.world.level.storage.loot.providers.number.NumberProviders; @@ -41,7 +41,7 @@ public class SetItemCountFunction extends LootItemConditionalFunction { } @Override - public Set> getReferencedContextParams() { + public Set> getReferencedContextParams() { return this.value.getReferencedContextParams(); } diff --git a/net/minecraft/world/level/storage/loot/functions/SetItemDamageFunction.java b/net/minecraft/world/level/storage/loot/functions/SetItemDamageFunction.java index fa0cc707..352c15ff 100644 --- a/net/minecraft/world/level/storage/loot/functions/SetItemDamageFunction.java +++ b/net/minecraft/world/level/storage/loot/functions/SetItemDamageFunction.java @@ -7,9 +7,9 @@ import com.mojang.serialization.codecs.RecordCodecBuilder; import java.util.List; import java.util.Set; import net.minecraft.util.Mth; +import net.minecraft.util.context.ContextKey; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.storage.loot.LootContext; -import net.minecraft.world.level.storage.loot.parameters.LootContextParam; import net.minecraft.world.level.storage.loot.predicates.LootItemCondition; import net.minecraft.world.level.storage.loot.providers.number.NumberProvider; import net.minecraft.world.level.storage.loot.providers.number.NumberProviders; @@ -45,7 +45,7 @@ public class SetItemDamageFunction extends LootItemConditionalFunction { } @Override - public Set> getReferencedContextParams() { + public Set> getReferencedContextParams() { return this.damage.getReferencedContextParams(); } diff --git a/net/minecraft/world/level/storage/loot/functions/SetItemFunction.java b/net/minecraft/world/level/storage/loot/functions/SetItemFunction.java index 4508854f..cb518674 100644 --- a/net/minecraft/world/level/storage/loot/functions/SetItemFunction.java +++ b/net/minecraft/world/level/storage/loot/functions/SetItemFunction.java @@ -4,8 +4,6 @@ import com.mojang.serialization.MapCodec; import com.mojang.serialization.codecs.RecordCodecBuilder; import java.util.List; import net.minecraft.core.Holder; -import net.minecraft.core.registries.Registries; -import net.minecraft.resources.RegistryFixedCodec; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.storage.loot.LootContext; @@ -13,9 +11,7 @@ import net.minecraft.world.level.storage.loot.predicates.LootItemCondition; public class SetItemFunction extends LootItemConditionalFunction { public static final MapCodec CODEC = RecordCodecBuilder.mapCodec( - instance -> commonFields(instance) - .and(RegistryFixedCodec.create(Registries.ITEM).fieldOf("item").forGetter(setItemFunction -> setItemFunction.item)) - .apply(instance, SetItemFunction::new) + instance -> commonFields(instance).and(Item.CODEC.fieldOf("item").forGetter(setItemFunction -> setItemFunction.item)).apply(instance, SetItemFunction::new) ); private final Holder item; diff --git a/net/minecraft/world/level/storage/loot/functions/SetLoreFunction.java b/net/minecraft/world/level/storage/loot/functions/SetLoreFunction.java index f5ef5724..0b1233a4 100644 --- a/net/minecraft/world/level/storage/loot/functions/SetLoreFunction.java +++ b/net/minecraft/world/level/storage/loot/functions/SetLoreFunction.java @@ -10,10 +10,10 @@ import java.util.function.UnaryOperator; import net.minecraft.core.component.DataComponents; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.ComponentSerialization; +import net.minecraft.util.context.ContextKey; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.component.ItemLore; import net.minecraft.world.level.storage.loot.LootContext; -import net.minecraft.world.level.storage.loot.parameters.LootContextParam; import net.minecraft.world.level.storage.loot.predicates.LootItemCondition; import org.jetbrains.annotations.Nullable; @@ -50,8 +50,8 @@ public class SetLoreFunction extends LootItemConditionalFunction { } @Override - public Set> getReferencedContextParams() { - return (Set>)this.resolutionContext.map(entityTarget -> Set.of(entityTarget.getParam())).orElseGet(Set::of); + public Set> getReferencedContextParams() { + return (Set>)this.resolutionContext.map(entityTarget -> Set.of(entityTarget.getParam())).orElseGet(Set::of); } @Override diff --git a/net/minecraft/world/level/storage/loot/functions/SetNameFunction.java b/net/minecraft/world/level/storage/loot/functions/SetNameFunction.java index 0d4f6bf8..bc8a3d64 100644 --- a/net/minecraft/world/level/storage/loot/functions/SetNameFunction.java +++ b/net/minecraft/world/level/storage/loot/functions/SetNameFunction.java @@ -16,10 +16,10 @@ import net.minecraft.network.chat.Component; import net.minecraft.network.chat.ComponentSerialization; import net.minecraft.network.chat.ComponentUtils; import net.minecraft.util.StringRepresentable; +import net.minecraft.util.context.ContextKey; import net.minecraft.world.entity.Entity; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.storage.loot.LootContext; -import net.minecraft.world.level.storage.loot.parameters.LootContextParam; import net.minecraft.world.level.storage.loot.predicates.LootItemCondition; import org.jetbrains.annotations.Nullable; import org.slf4j.Logger; @@ -60,8 +60,8 @@ public class SetNameFunction extends LootItemConditionalFunction { } @Override - public Set> getReferencedContextParams() { - return (Set>)this.resolutionContext.map(entityTarget -> Set.of(entityTarget.getParam())).orElse(Set.of()); + public Set> getReferencedContextParams() { + return (Set>)this.resolutionContext.map(entityTarget -> Set.of(entityTarget.getParam())).orElse(Set.of()); } /** @@ -70,9 +70,9 @@ public class SetNameFunction extends LootItemConditionalFunction { */ public static UnaryOperator createResolver(LootContext lootContext, @Nullable LootContext.EntityTarget resolutionContext) { if (resolutionContext != null) { - Entity entity = lootContext.getParamOrNull(resolutionContext.getParam()); + Entity entity = lootContext.getOptionalParameter(resolutionContext.getParam()); if (entity != null) { - CommandSourceStack commandSourceStack = entity.createCommandSourceStack().withPermission(2); + CommandSourceStack commandSourceStack = entity.createCommandSourceStackForNameResolution(lootContext.getLevel()).withPermission(2); return component -> { try { return ComponentUtils.updateForEntity(commandSourceStack, component, entity, 0); diff --git a/net/minecraft/world/level/storage/loot/functions/SetOminousBottleAmplifierFunction.java b/net/minecraft/world/level/storage/loot/functions/SetOminousBottleAmplifierFunction.java index cb759736..beb01ee5 100644 --- a/net/minecraft/world/level/storage/loot/functions/SetOminousBottleAmplifierFunction.java +++ b/net/minecraft/world/level/storage/loot/functions/SetOminousBottleAmplifierFunction.java @@ -6,9 +6,10 @@ import java.util.List; import java.util.Set; import net.minecraft.core.component.DataComponents; import net.minecraft.util.Mth; +import net.minecraft.util.context.ContextKey; import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.component.OminousBottleAmplifier; import net.minecraft.world.level.storage.loot.LootContext; -import net.minecraft.world.level.storage.loot.parameters.LootContextParam; import net.minecraft.world.level.storage.loot.predicates.LootItemCondition; import net.minecraft.world.level.storage.loot.providers.number.NumberProvider; import net.minecraft.world.level.storage.loot.providers.number.NumberProviders; @@ -27,7 +28,7 @@ public class SetOminousBottleAmplifierFunction extends LootItemConditionalFuncti } @Override - public Set> getReferencedContextParams() { + public Set> getReferencedContextParams() { return this.amplifierGenerator.getReferencedContextParams(); } @@ -39,7 +40,7 @@ public class SetOminousBottleAmplifierFunction extends LootItemConditionalFuncti @Override public ItemStack run(ItemStack stack, LootContext context) { int i = Mth.clamp(this.amplifierGenerator.getInt(context), 0, 4); - stack.set(DataComponents.OMINOUS_BOTTLE_AMPLIFIER, i); + stack.set(DataComponents.OMINOUS_BOTTLE_AMPLIFIER, new OminousBottleAmplifier(i)); return stack; } diff --git a/net/minecraft/world/level/storage/loot/functions/SetStewEffectFunction.java b/net/minecraft/world/level/storage/loot/functions/SetStewEffectFunction.java index 581b82fc..35b4d8c4 100644 --- a/net/minecraft/world/level/storage/loot/functions/SetStewEffectFunction.java +++ b/net/minecraft/world/level/storage/loot/functions/SetStewEffectFunction.java @@ -12,12 +12,12 @@ import java.util.Set; import net.minecraft.Util; import net.minecraft.core.Holder; import net.minecraft.core.component.DataComponents; +import net.minecraft.util.context.ContextKey; import net.minecraft.world.effect.MobEffect; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.item.component.SuspiciousStewEffects; import net.minecraft.world.level.storage.loot.LootContext; -import net.minecraft.world.level.storage.loot.parameters.LootContextParam; import net.minecraft.world.level.storage.loot.predicates.LootItemCondition; import net.minecraft.world.level.storage.loot.providers.number.NumberProvider; import net.minecraft.world.level.storage.loot.providers.number.NumberProviders; @@ -55,8 +55,8 @@ public class SetStewEffectFunction extends LootItemConditionalFunction { } @Override - public Set> getReferencedContextParams() { - return (Set>)this.effects + public Set> getReferencedContextParams() { + return (Set>)this.effects .stream() .flatMap(effectEntry -> effectEntry.duration().getReferencedContextParams().stream()) .collect(ImmutableSet.toImmutableSet()); diff --git a/net/minecraft/world/level/storage/loot/functions/SmeltItemFunction.java b/net/minecraft/world/level/storage/loot/functions/SmeltItemFunction.java index 2f84268f..f74edcd3 100644 --- a/net/minecraft/world/level/storage/loot/functions/SmeltItemFunction.java +++ b/net/minecraft/world/level/storage/loot/functions/SmeltItemFunction.java @@ -35,11 +35,10 @@ public class SmeltItemFunction extends LootItemConditionalFunction { if (stack.isEmpty()) { return stack; } else { - Optional> optional = context.getLevel() - .getRecipeManager() - .getRecipeFor(RecipeType.SMELTING, new SingleRecipeInput(stack), context.getLevel()); + SingleRecipeInput singleRecipeInput = new SingleRecipeInput(stack); + Optional> optional = context.getLevel().recipeAccess().getRecipeFor(RecipeType.SMELTING, singleRecipeInput, context.getLevel()); if (optional.isPresent()) { - ItemStack itemStack = ((SmeltingRecipe)((RecipeHolder)optional.get()).value()).getResultItem(context.getLevel().registryAccess()); + ItemStack itemStack = ((SmeltingRecipe)((RecipeHolder)optional.get()).value()).assemble(singleRecipeInput, context.getLevel().registryAccess()); if (!itemStack.isEmpty()) { return itemStack.copyWithCount(stack.getCount()); } diff --git a/net/minecraft/world/level/storage/loot/functions/ToggleTooltips.java b/net/minecraft/world/level/storage/loot/functions/ToggleTooltips.java index 61281302..f39d3024 100644 --- a/net/minecraft/world/level/storage/loot/functions/ToggleTooltips.java +++ b/net/minecraft/world/level/storage/loot/functions/ToggleTooltips.java @@ -14,11 +14,11 @@ import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.world.item.AdventureModePredicate; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.JukeboxPlayable; -import net.minecraft.world.item.armortrim.ArmorTrim; import net.minecraft.world.item.component.DyedItemColor; import net.minecraft.world.item.component.ItemAttributeModifiers; import net.minecraft.world.item.component.Unbreakable; import net.minecraft.world.item.enchantment.ItemEnchantments; +import net.minecraft.world.item.equipment.trim.ArmorTrim; import net.minecraft.world.level.storage.loot.LootContext; import net.minecraft.world.level.storage.loot.predicates.LootItemCondition; diff --git a/net/minecraft/world/level/storage/loot/parameters/LootContextParam.java b/net/minecraft/world/level/storage/loot/parameters/LootContextParam.java deleted file mode 100644 index db827fe6..00000000 --- a/net/minecraft/world/level/storage/loot/parameters/LootContextParam.java +++ /dev/null @@ -1,24 +0,0 @@ -package net.minecraft.world.level.storage.loot.parameters; - -import net.minecraft.resources.ResourceLocation; - -/** - * A parameter of a {@link LootContext}. - * - * @see LootContextParams - */ -public class LootContextParam { - private final ResourceLocation name; - - public LootContextParam(ResourceLocation name) { - this.name = name; - } - - public ResourceLocation getName() { - return this.name; - } - - public String toString() { - return ""; - } -} diff --git a/net/minecraft/world/level/storage/loot/parameters/LootContextParamSet.java b/net/minecraft/world/level/storage/loot/parameters/LootContextParamSet.java deleted file mode 100644 index 041b2c5a..00000000 --- a/net/minecraft/world/level/storage/loot/parameters/LootContextParamSet.java +++ /dev/null @@ -1,100 +0,0 @@ -package net.minecraft.world.level.storage.loot.parameters; - -import com.google.common.base.Joiner; -import com.google.common.collect.ImmutableSet; -import com.google.common.collect.Sets; -import java.util.Set; -import net.minecraft.util.ProblemReporter; -import net.minecraft.world.level.storage.loot.LootContextUser; -import net.minecraft.world.level.storage.loot.ValidationContext; - -/** - * A LootContextParamSet defines a set of required and optional {@link LootContextParam}s. - * This is used to validate that conditions, functions and other {@link LootContextUser}s only use those parameters that are present for the given loot table. - * - * @see LootContextParamSets - * @see ValidationContext - */ -public class LootContextParamSet { - private final Set> required; - private final Set> all; - - LootContextParamSet(Set> required, Set> optional) { - this.required = ImmutableSet.copyOf(required); - this.all = ImmutableSet.copyOf(Sets.union(required, optional)); - } - - /** - * Whether the given parameter is allowed in this set. - */ - public boolean isAllowed(LootContextParam param) { - return this.all.contains(param); - } - - /** - * Gets only the required parameters - */ - public Set> getRequired() { - return this.required; - } - - /** - * Gets the required and optional parameters - */ - public Set> getAllowed() { - return this.all; - } - - public String toString() { - return "[" - + Joiner.on(", ") - .join(this.all.stream().map(lootContextParam -> (this.required.contains(lootContextParam) ? "!" : "") + lootContextParam.getName()).iterator()) - + "]"; - } - - /** - * Validate that all parameters referenced by the given LootContextUser are present in this set. - */ - public void validateUser(ValidationContext validationContext, LootContextUser lootContextUser) { - this.validateUser(validationContext.reporter(), lootContextUser); - } - - public void validateUser(ProblemReporter problemReporter, LootContextUser lootContextUser) { - Set> set = lootContextUser.getReferencedContextParams(); - Set> set2 = Sets.>difference(set, this.all); - if (!set2.isEmpty()) { - problemReporter.report("Parameters " + set2 + " are not provided in this context"); - } - } - - public static LootContextParamSet.Builder builder() { - return new LootContextParamSet.Builder(); - } - - public static class Builder { - private final Set> required = Sets.newIdentityHashSet(); - private final Set> optional = Sets.newIdentityHashSet(); - - public LootContextParamSet.Builder required(LootContextParam parameter) { - if (this.optional.contains(parameter)) { - throw new IllegalArgumentException("Parameter " + parameter.getName() + " is already optional"); - } else { - this.required.add(parameter); - return this; - } - } - - public LootContextParamSet.Builder optional(LootContextParam parameter) { - if (this.required.contains(parameter)) { - throw new IllegalArgumentException("Parameter " + parameter.getName() + " is already required"); - } else { - this.optional.add(parameter); - return this; - } - } - - public LootContextParamSet build() { - return new LootContextParamSet(this.required, this.optional); - } - } -} diff --git a/net/minecraft/world/level/storage/loot/parameters/LootContextParamSets.java b/net/minecraft/world/level/storage/loot/parameters/LootContextParamSets.java index b79257f9..70815dff 100644 --- a/net/minecraft/world/level/storage/loot/parameters/LootContextParamSets.java +++ b/net/minecraft/world/level/storage/loot/parameters/LootContextParamSets.java @@ -7,33 +7,30 @@ import com.mojang.serialization.DataResult; import java.util.Optional; import java.util.function.Consumer; import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.context.ContextKeySet; /** * Registry for {@link LootContextParamSet}s. */ public class LootContextParamSets { - private static final BiMap REGISTRY = HashBiMap.create(); - public static final Codec CODEC = ResourceLocation.CODEC + private static final BiMap REGISTRY = HashBiMap.create(); + public static final Codec CODEC = ResourceLocation.CODEC .comapFlatMap( - resourceLocation -> (DataResult)Optional.ofNullable((LootContextParamSet)REGISTRY.get(resourceLocation)) + resourceLocation -> (DataResult)Optional.ofNullable((ContextKeySet)REGISTRY.get(resourceLocation)) .map(DataResult::success) .orElseGet(() -> DataResult.error(() -> "No parameter set exists with id: '" + resourceLocation + "'")), REGISTRY.inverse()::get ); - public static final LootContextParamSet EMPTY = register("empty", builder -> {}); - public static final LootContextParamSet CHEST = register( - "chest", builder -> builder.required(LootContextParams.ORIGIN).optional(LootContextParams.THIS_ENTITY) - ); - public static final LootContextParamSet COMMAND = register( - "command", builder -> builder.required(LootContextParams.ORIGIN).optional(LootContextParams.THIS_ENTITY) - ); - public static final LootContextParamSet SELECTOR = register( + public static final ContextKeySet EMPTY = register("empty", builder -> {}); + public static final ContextKeySet CHEST = register("chest", builder -> builder.required(LootContextParams.ORIGIN).optional(LootContextParams.THIS_ENTITY)); + public static final ContextKeySet COMMAND = register("command", builder -> builder.required(LootContextParams.ORIGIN).optional(LootContextParams.THIS_ENTITY)); + public static final ContextKeySet SELECTOR = register( "selector", builder -> builder.required(LootContextParams.ORIGIN).required(LootContextParams.THIS_ENTITY) ); - public static final LootContextParamSet FISHING = register( + public static final ContextKeySet FISHING = register( "fishing", builder -> builder.required(LootContextParams.ORIGIN).required(LootContextParams.TOOL).optional(LootContextParams.THIS_ENTITY) ); - public static final LootContextParamSet ENTITY = register( + public static final ContextKeySet ENTITY = register( "entity", builder -> builder.required(LootContextParams.THIS_ENTITY) .required(LootContextParams.ORIGIN) @@ -42,34 +39,34 @@ public class LootContextParamSets { .optional(LootContextParams.DIRECT_ATTACKING_ENTITY) .optional(LootContextParams.LAST_DAMAGE_PLAYER) ); - public static final LootContextParamSet EQUIPMENT = register( + public static final ContextKeySet EQUIPMENT = register( "equipment", builder -> builder.required(LootContextParams.ORIGIN).required(LootContextParams.THIS_ENTITY) ); - public static final LootContextParamSet ARCHAEOLOGY = register( - "archaeology", builder -> builder.required(LootContextParams.ORIGIN).optional(LootContextParams.THIS_ENTITY) + public static final ContextKeySet ARCHAEOLOGY = register( + "archaeology", builder -> builder.required(LootContextParams.ORIGIN).required(LootContextParams.THIS_ENTITY).required(LootContextParams.TOOL) ); - public static final LootContextParamSet GIFT = register("gift", builder -> builder.required(LootContextParams.ORIGIN).required(LootContextParams.THIS_ENTITY)); - public static final LootContextParamSet PIGLIN_BARTER = register("barter", builder -> builder.required(LootContextParams.THIS_ENTITY)); - public static final LootContextParamSet VAULT = register( - "vault", builder -> builder.required(LootContextParams.ORIGIN).optional(LootContextParams.THIS_ENTITY) + public static final ContextKeySet GIFT = register("gift", builder -> builder.required(LootContextParams.ORIGIN).required(LootContextParams.THIS_ENTITY)); + public static final ContextKeySet PIGLIN_BARTER = register("barter", builder -> builder.required(LootContextParams.THIS_ENTITY)); + public static final ContextKeySet VAULT = register( + "vault", builder -> builder.required(LootContextParams.ORIGIN).optional(LootContextParams.THIS_ENTITY).optional(LootContextParams.TOOL) ); - public static final LootContextParamSet ADVANCEMENT_REWARD = register( + public static final ContextKeySet ADVANCEMENT_REWARD = register( "advancement_reward", builder -> builder.required(LootContextParams.THIS_ENTITY).required(LootContextParams.ORIGIN) ); - public static final LootContextParamSet ADVANCEMENT_ENTITY = register( + public static final ContextKeySet ADVANCEMENT_ENTITY = register( "advancement_entity", builder -> builder.required(LootContextParams.THIS_ENTITY).required(LootContextParams.ORIGIN) ); - public static final LootContextParamSet ADVANCEMENT_LOCATION = register( + public static final ContextKeySet ADVANCEMENT_LOCATION = register( "advancement_location", builder -> builder.required(LootContextParams.THIS_ENTITY) .required(LootContextParams.ORIGIN) .required(LootContextParams.TOOL) .required(LootContextParams.BLOCK_STATE) ); - public static final LootContextParamSet BLOCK_USE = register( + public static final ContextKeySet BLOCK_USE = register( "block_use", builder -> builder.required(LootContextParams.THIS_ENTITY).required(LootContextParams.ORIGIN).required(LootContextParams.BLOCK_STATE) ); - public static final LootContextParamSet ALL_PARAMS = register( + public static final ContextKeySet ALL_PARAMS = register( "generic", builder -> builder.required(LootContextParams.THIS_ENTITY) .required(LootContextParams.LAST_DAMAGE_PLAYER) @@ -82,7 +79,7 @@ public class LootContextParamSets { .required(LootContextParams.TOOL) .required(LootContextParams.EXPLOSION_RADIUS) ); - public static final LootContextParamSet BLOCK = register( + public static final ContextKeySet BLOCK = register( "block", builder -> builder.required(LootContextParams.BLOCK_STATE) .required(LootContextParams.ORIGIN) @@ -91,10 +88,10 @@ public class LootContextParamSets { .optional(LootContextParams.BLOCK_ENTITY) .optional(LootContextParams.EXPLOSION_RADIUS) ); - public static final LootContextParamSet SHEARING = register( - "shearing", builder -> builder.required(LootContextParams.ORIGIN).optional(LootContextParams.THIS_ENTITY) + public static final ContextKeySet SHEARING = register( + "shearing", builder -> builder.required(LootContextParams.ORIGIN).required(LootContextParams.THIS_ENTITY).required(LootContextParams.TOOL) ); - public static final LootContextParamSet ENCHANTED_DAMAGE = register( + public static final ContextKeySet ENCHANTED_DAMAGE = register( "enchanted_damage", builder -> builder.required(LootContextParams.THIS_ENTITY) .required(LootContextParams.ENCHANTMENT_LEVEL) @@ -103,21 +100,21 @@ public class LootContextParamSets { .optional(LootContextParams.DIRECT_ATTACKING_ENTITY) .optional(LootContextParams.ATTACKING_ENTITY) ); - public static final LootContextParamSet ENCHANTED_ITEM = register( + public static final ContextKeySet ENCHANTED_ITEM = register( "enchanted_item", builder -> builder.required(LootContextParams.TOOL).required(LootContextParams.ENCHANTMENT_LEVEL) ); - public static final LootContextParamSet ENCHANTED_LOCATION = register( + public static final ContextKeySet ENCHANTED_LOCATION = register( "enchanted_location", builder -> builder.required(LootContextParams.THIS_ENTITY) .required(LootContextParams.ENCHANTMENT_LEVEL) .required(LootContextParams.ORIGIN) .required(LootContextParams.ENCHANTMENT_ACTIVE) ); - public static final LootContextParamSet ENCHANTED_ENTITY = register( + public static final ContextKeySet ENCHANTED_ENTITY = register( "enchanted_entity", builder -> builder.required(LootContextParams.THIS_ENTITY).required(LootContextParams.ENCHANTMENT_LEVEL).required(LootContextParams.ORIGIN) ); - public static final LootContextParamSet HIT_BLOCK = register( + public static final ContextKeySet HIT_BLOCK = register( "hit_block", builder -> builder.required(LootContextParams.THIS_ENTITY) .required(LootContextParams.ENCHANTMENT_LEVEL) @@ -125,16 +122,16 @@ public class LootContextParamSets { .required(LootContextParams.BLOCK_STATE) ); - private static LootContextParamSet register(String registryName, Consumer builderConsumer) { - LootContextParamSet.Builder builder = new LootContextParamSet.Builder(); - builderConsumer.accept(builder); - LootContextParamSet lootContextParamSet = builder.build(); - ResourceLocation resourceLocation = ResourceLocation.withDefaultNamespace(registryName); - LootContextParamSet lootContextParamSet2 = REGISTRY.put(resourceLocation, lootContextParamSet); - if (lootContextParamSet2 != null) { + private static ContextKeySet register(String string, Consumer consumer) { + ContextKeySet.Builder builder = new ContextKeySet.Builder(); + consumer.accept(builder); + ContextKeySet contextKeySet = builder.build(); + ResourceLocation resourceLocation = ResourceLocation.withDefaultNamespace(string); + ContextKeySet contextKeySet2 = REGISTRY.put(resourceLocation, contextKeySet); + if (contextKeySet2 != null) { throw new IllegalStateException("Loot table parameter set " + resourceLocation + " is already registered"); } else { - return lootContextParamSet; + return contextKeySet; } } } diff --git a/net/minecraft/world/level/storage/loot/parameters/LootContextParams.java b/net/minecraft/world/level/storage/loot/parameters/LootContextParams.java index a90a1b0b..ab8e44fc 100644 --- a/net/minecraft/world/level/storage/loot/parameters/LootContextParams.java +++ b/net/minecraft/world/level/storage/loot/parameters/LootContextParams.java @@ -1,6 +1,6 @@ package net.minecraft.world.level.storage.loot.parameters; -import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.context.ContextKey; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.player.Player; @@ -13,20 +13,16 @@ import net.minecraft.world.phys.Vec3; * Holds all known LootContextParams. */ public class LootContextParams { - public static final LootContextParam THIS_ENTITY = create("this_entity"); - public static final LootContextParam LAST_DAMAGE_PLAYER = create("last_damage_player"); - public static final LootContextParam DAMAGE_SOURCE = create("damage_source"); - public static final LootContextParam ATTACKING_ENTITY = create("attacking_entity"); - public static final LootContextParam DIRECT_ATTACKING_ENTITY = create("direct_attacking_entity"); - public static final LootContextParam ORIGIN = create("origin"); - public static final LootContextParam BLOCK_STATE = create("block_state"); - public static final LootContextParam BLOCK_ENTITY = create("block_entity"); - public static final LootContextParam TOOL = create("tool"); - public static final LootContextParam EXPLOSION_RADIUS = create("explosion_radius"); - public static final LootContextParam ENCHANTMENT_LEVEL = create("enchantment_level"); - public static final LootContextParam ENCHANTMENT_ACTIVE = create("enchantment_active"); - - private static LootContextParam create(String id) { - return new LootContextParam<>(ResourceLocation.withDefaultNamespace(id)); - } + public static final ContextKey THIS_ENTITY = ContextKey.vanilla("this_entity"); + public static final ContextKey LAST_DAMAGE_PLAYER = ContextKey.vanilla("last_damage_player"); + public static final ContextKey DAMAGE_SOURCE = ContextKey.vanilla("damage_source"); + public static final ContextKey ATTACKING_ENTITY = ContextKey.vanilla("attacking_entity"); + public static final ContextKey DIRECT_ATTACKING_ENTITY = ContextKey.vanilla("direct_attacking_entity"); + public static final ContextKey ORIGIN = ContextKey.vanilla("origin"); + public static final ContextKey BLOCK_STATE = ContextKey.vanilla("block_state"); + public static final ContextKey BLOCK_ENTITY = ContextKey.vanilla("block_entity"); + public static final ContextKey TOOL = ContextKey.vanilla("tool"); + public static final ContextKey EXPLOSION_RADIUS = ContextKey.vanilla("explosion_radius"); + public static final ContextKey ENCHANTMENT_LEVEL = ContextKey.vanilla("enchantment_level"); + public static final ContextKey ENCHANTMENT_ACTIVE = ContextKey.vanilla("enchantment_active"); } diff --git a/net/minecraft/world/level/storage/loot/predicates/BonusLevelTableCondition.java b/net/minecraft/world/level/storage/loot/predicates/BonusLevelTableCondition.java index 5299bf77..e3f5fc26 100644 --- a/net/minecraft/world/level/storage/loot/predicates/BonusLevelTableCondition.java +++ b/net/minecraft/world/level/storage/loot/predicates/BonusLevelTableCondition.java @@ -1,6 +1,5 @@ package net.minecraft.world.level.storage.loot.predicates; -import com.google.common.collect.ImmutableSet; import com.mojang.serialization.Codec; import com.mojang.serialization.MapCodec; import com.mojang.serialization.codecs.RecordCodecBuilder; @@ -9,11 +8,11 @@ import java.util.List; import java.util.Set; import net.minecraft.core.Holder; import net.minecraft.util.ExtraCodecs; +import net.minecraft.util.context.ContextKey; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.enchantment.Enchantment; import net.minecraft.world.item.enchantment.EnchantmentHelper; import net.minecraft.world.level.storage.loot.LootContext; -import net.minecraft.world.level.storage.loot.parameters.LootContextParam; import net.minecraft.world.level.storage.loot.parameters.LootContextParams; /** @@ -36,12 +35,12 @@ public record BonusLevelTableCondition(Holder enchantment, List> getReferencedContextParams() { - return ImmutableSet.of(LootContextParams.TOOL); + public Set> getReferencedContextParams() { + return Set.of(LootContextParams.TOOL); } public boolean test(LootContext context) { - ItemStack itemStack = context.getParamOrNull(LootContextParams.TOOL); + ItemStack itemStack = context.getOptionalParameter(LootContextParams.TOOL); int i = itemStack != null ? EnchantmentHelper.getItemEnchantmentLevel(this.enchantment, itemStack) : 0; float f = (Float)this.values.get(Math.min(i, this.values.size() - 1)); return context.getRandom().nextFloat() < f; diff --git a/net/minecraft/world/level/storage/loot/predicates/ConditionReference.java b/net/minecraft/world/level/storage/loot/predicates/ConditionReference.java index 74da69cd..e038deee 100644 --- a/net/minecraft/world/level/storage/loot/predicates/ConditionReference.java +++ b/net/minecraft/world/level/storage/loot/predicates/ConditionReference.java @@ -34,7 +34,7 @@ public record ConditionReference(ResourceKey name) implements } else { LootItemCondition.super.validate(context); context.resolver() - .get(Registries.PREDICATE, this.name) + .get(this.name) .ifPresentOrElse( reference -> ((LootItemCondition)reference.value()).validate(context.enterElement(".{" + this.name.location() + "}", this.name)), () -> context.reportProblem("Unknown condition table called " + this.name.location()) @@ -43,7 +43,7 @@ public record ConditionReference(ResourceKey name) implements } public boolean test(LootContext context) { - LootItemCondition lootItemCondition = (LootItemCondition)context.getResolver().get(Registries.PREDICATE, this.name).map(Holder.Reference::value).orElse(null); + LootItemCondition lootItemCondition = (LootItemCondition)context.getResolver().get(this.name).map(Holder.Reference::value).orElse(null); if (lootItemCondition == null) { LOGGER.warn("Tried using unknown condition table called {}", this.name.location()); return false; diff --git a/net/minecraft/world/level/storage/loot/predicates/DamageSourceCondition.java b/net/minecraft/world/level/storage/loot/predicates/DamageSourceCondition.java index 28b5423a..a53f77cb 100644 --- a/net/minecraft/world/level/storage/loot/predicates/DamageSourceCondition.java +++ b/net/minecraft/world/level/storage/loot/predicates/DamageSourceCondition.java @@ -1,14 +1,13 @@ package net.minecraft.world.level.storage.loot.predicates; -import com.google.common.collect.ImmutableSet; import com.mojang.serialization.MapCodec; import com.mojang.serialization.codecs.RecordCodecBuilder; import java.util.Optional; import java.util.Set; import net.minecraft.advancements.critereon.DamageSourcePredicate; +import net.minecraft.util.context.ContextKey; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.level.storage.loot.LootContext; -import net.minecraft.world.level.storage.loot.parameters.LootContextParam; import net.minecraft.world.level.storage.loot.parameters.LootContextParams; import net.minecraft.world.phys.Vec3; @@ -27,13 +26,13 @@ public record DamageSourceCondition(Optional predicate) i } @Override - public Set> getReferencedContextParams() { - return ImmutableSet.of(LootContextParams.ORIGIN, LootContextParams.DAMAGE_SOURCE); + public Set> getReferencedContextParams() { + return Set.of(LootContextParams.ORIGIN, LootContextParams.DAMAGE_SOURCE); } public boolean test(LootContext context) { - DamageSource damageSource = context.getParamOrNull(LootContextParams.DAMAGE_SOURCE); - Vec3 vec3 = context.getParamOrNull(LootContextParams.ORIGIN); + DamageSource damageSource = context.getOptionalParameter(LootContextParams.DAMAGE_SOURCE); + Vec3 vec3 = context.getOptionalParameter(LootContextParams.ORIGIN); return vec3 != null && damageSource != null ? this.predicate.isEmpty() || ((DamageSourcePredicate)this.predicate.get()).matches(context.getLevel(), vec3, damageSource) : false; diff --git a/net/minecraft/world/level/storage/loot/predicates/EnchantmentActiveCheck.java b/net/minecraft/world/level/storage/loot/predicates/EnchantmentActiveCheck.java index 19f95861..70e14443 100644 --- a/net/minecraft/world/level/storage/loot/predicates/EnchantmentActiveCheck.java +++ b/net/minecraft/world/level/storage/loot/predicates/EnchantmentActiveCheck.java @@ -4,8 +4,8 @@ import com.mojang.serialization.Codec; import com.mojang.serialization.MapCodec; import com.mojang.serialization.codecs.RecordCodecBuilder; import java.util.Set; +import net.minecraft.util.context.ContextKey; import net.minecraft.world.level.storage.loot.LootContext; -import net.minecraft.world.level.storage.loot.parameters.LootContextParam; import net.minecraft.world.level.storage.loot.parameters.LootContextParams; public record EnchantmentActiveCheck(boolean active) implements LootItemCondition { @@ -14,7 +14,7 @@ public record EnchantmentActiveCheck(boolean active) implements LootItemConditio ); public boolean test(LootContext context) { - return context.getParam(LootContextParams.ENCHANTMENT_ACTIVE) == this.active; + return context.getParameter(LootContextParams.ENCHANTMENT_ACTIVE) == this.active; } @Override @@ -23,7 +23,7 @@ public record EnchantmentActiveCheck(boolean active) implements LootItemConditio } @Override - public Set> getReferencedContextParams() { + public Set> getReferencedContextParams() { return Set.of(LootContextParams.ENCHANTMENT_ACTIVE); } diff --git a/net/minecraft/world/level/storage/loot/predicates/EntityHasScoreCondition.java b/net/minecraft/world/level/storage/loot/predicates/EntityHasScoreCondition.java index 73907874..9af02b36 100644 --- a/net/minecraft/world/level/storage/loot/predicates/EntityHasScoreCondition.java +++ b/net/minecraft/world/level/storage/loot/predicates/EntityHasScoreCondition.java @@ -9,10 +9,10 @@ import java.util.Map; import java.util.Set; import java.util.Map.Entry; import java.util.stream.Stream; +import net.minecraft.util.context.ContextKey; import net.minecraft.world.entity.Entity; import net.minecraft.world.level.storage.loot.IntRange; import net.minecraft.world.level.storage.loot.LootContext; -import net.minecraft.world.level.storage.loot.parameters.LootContextParam; import net.minecraft.world.scores.Objective; import net.minecraft.world.scores.ReadOnlyScoreInfo; import net.minecraft.world.scores.Scoreboard; @@ -36,15 +36,15 @@ public record EntityHasScoreCondition(Map scores, LootContext. } @Override - public Set> getReferencedContextParams() { - return (Set>)Stream.concat( + public Set> getReferencedContextParams() { + return (Set>)Stream.concat( Stream.of(this.entityTarget.getParam()), this.scores.values().stream().flatMap(intRange -> intRange.getReferencedContextParams().stream()) ) .collect(ImmutableSet.toImmutableSet()); } public boolean test(LootContext context) { - Entity entity = context.getParamOrNull(this.entityTarget.getParam()); + Entity entity = context.getOptionalParameter(this.entityTarget.getParam()); if (entity == null) { return false; } else { diff --git a/net/minecraft/world/level/storage/loot/predicates/ExplosionCondition.java b/net/minecraft/world/level/storage/loot/predicates/ExplosionCondition.java index 015c7e28..d7eac4e8 100644 --- a/net/minecraft/world/level/storage/loot/predicates/ExplosionCondition.java +++ b/net/minecraft/world/level/storage/loot/predicates/ExplosionCondition.java @@ -1,11 +1,10 @@ package net.minecraft.world.level.storage.loot.predicates; -import com.google.common.collect.ImmutableSet; import com.mojang.serialization.MapCodec; import java.util.Set; import net.minecraft.util.RandomSource; +import net.minecraft.util.context.ContextKey; import net.minecraft.world.level.storage.loot.LootContext; -import net.minecraft.world.level.storage.loot.parameters.LootContextParam; import net.minecraft.world.level.storage.loot.parameters.LootContextParams; /** @@ -25,12 +24,12 @@ public class ExplosionCondition implements LootItemCondition { } @Override - public Set> getReferencedContextParams() { - return ImmutableSet.of(LootContextParams.EXPLOSION_RADIUS); + public Set> getReferencedContextParams() { + return Set.of(LootContextParams.EXPLOSION_RADIUS); } public boolean test(LootContext context) { - Float float_ = context.getParamOrNull(LootContextParams.EXPLOSION_RADIUS); + Float float_ = context.getOptionalParameter(LootContextParams.EXPLOSION_RADIUS); if (float_ != null) { RandomSource randomSource = context.getRandom(); float f = 1.0F / float_; diff --git a/net/minecraft/world/level/storage/loot/predicates/InvertedLootItemCondition.java b/net/minecraft/world/level/storage/loot/predicates/InvertedLootItemCondition.java index 8c76fb89..a0605d74 100644 --- a/net/minecraft/world/level/storage/loot/predicates/InvertedLootItemCondition.java +++ b/net/minecraft/world/level/storage/loot/predicates/InvertedLootItemCondition.java @@ -3,9 +3,9 @@ package net.minecraft.world.level.storage.loot.predicates; import com.mojang.serialization.MapCodec; import com.mojang.serialization.codecs.RecordCodecBuilder; import java.util.Set; +import net.minecraft.util.context.ContextKey; import net.minecraft.world.level.storage.loot.LootContext; import net.minecraft.world.level.storage.loot.ValidationContext; -import net.minecraft.world.level.storage.loot.parameters.LootContextParam; /** * A LootItemCondition that inverts the output of another one. @@ -26,7 +26,7 @@ public record InvertedLootItemCondition(LootItemCondition term) implements LootI } @Override - public Set> getReferencedContextParams() { + public Set> getReferencedContextParams() { return this.term.getReferencedContextParams(); } diff --git a/net/minecraft/world/level/storage/loot/predicates/LocationCheck.java b/net/minecraft/world/level/storage/loot/predicates/LocationCheck.java index be572411..33adac55 100644 --- a/net/minecraft/world/level/storage/loot/predicates/LocationCheck.java +++ b/net/minecraft/world/level/storage/loot/predicates/LocationCheck.java @@ -8,8 +8,8 @@ import java.util.Set; import net.minecraft.advancements.critereon.LocationPredicate; import net.minecraft.core.BlockPos; import net.minecraft.core.Vec3i; +import net.minecraft.util.context.ContextKey; import net.minecraft.world.level.storage.loot.LootContext; -import net.minecraft.world.level.storage.loot.parameters.LootContextParam; import net.minecraft.world.level.storage.loot.parameters.LootContextParams; import net.minecraft.world.phys.Vec3; @@ -38,7 +38,7 @@ public record LocationCheck(Optional predicate, BlockPos offs } public boolean test(LootContext context) { - Vec3 vec3 = context.getParamOrNull(LootContextParams.ORIGIN); + Vec3 vec3 = context.getOptionalParameter(LootContextParams.ORIGIN); return vec3 != null && ( this.predicate.isEmpty() @@ -48,7 +48,7 @@ public record LocationCheck(Optional predicate, BlockPos offs } @Override - public Set> getReferencedContextParams() { + public Set> getReferencedContextParams() { return Set.of(LootContextParams.ORIGIN); } diff --git a/net/minecraft/world/level/storage/loot/predicates/LootItemBlockStatePropertyCondition.java b/net/minecraft/world/level/storage/loot/predicates/LootItemBlockStatePropertyCondition.java index 30c5a278..84be1950 100644 --- a/net/minecraft/world/level/storage/loot/predicates/LootItemBlockStatePropertyCondition.java +++ b/net/minecraft/world/level/storage/loot/predicates/LootItemBlockStatePropertyCondition.java @@ -8,10 +8,10 @@ import java.util.Set; import net.minecraft.advancements.critereon.StatePropertiesPredicate; import net.minecraft.core.Holder; import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.util.context.ContextKey; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.storage.loot.LootContext; -import net.minecraft.world.level.storage.loot.parameters.LootContextParam; import net.minecraft.world.level.storage.loot.parameters.LootContextParams; /** @@ -40,12 +40,12 @@ public record LootItemBlockStatePropertyCondition(Holder block, Optional< } @Override - public Set> getReferencedContextParams() { + public Set> getReferencedContextParams() { return Set.of(LootContextParams.BLOCK_STATE); } public boolean test(LootContext context) { - BlockState blockState = context.getParamOrNull(LootContextParams.BLOCK_STATE); + BlockState blockState = context.getOptionalParameter(LootContextParams.BLOCK_STATE); return blockState != null && blockState.is(this.block) && (this.properties.isEmpty() || ((StatePropertiesPredicate)this.properties.get()).matches(blockState)); diff --git a/net/minecraft/world/level/storage/loot/predicates/LootItemEntityPropertyCondition.java b/net/minecraft/world/level/storage/loot/predicates/LootItemEntityPropertyCondition.java index ce36b1c3..5b05b193 100644 --- a/net/minecraft/world/level/storage/loot/predicates/LootItemEntityPropertyCondition.java +++ b/net/minecraft/world/level/storage/loot/predicates/LootItemEntityPropertyCondition.java @@ -1,14 +1,13 @@ package net.minecraft.world.level.storage.loot.predicates; -import com.google.common.collect.ImmutableSet; import com.mojang.serialization.MapCodec; import com.mojang.serialization.codecs.RecordCodecBuilder; import java.util.Optional; import java.util.Set; import net.minecraft.advancements.critereon.EntityPredicate; +import net.minecraft.util.context.ContextKey; import net.minecraft.world.entity.Entity; import net.minecraft.world.level.storage.loot.LootContext; -import net.minecraft.world.level.storage.loot.parameters.LootContextParam; import net.minecraft.world.level.storage.loot.parameters.LootContextParams; import net.minecraft.world.phys.Vec3; @@ -30,13 +29,13 @@ public record LootItemEntityPropertyCondition(Optional predicat } @Override - public Set> getReferencedContextParams() { - return ImmutableSet.of(LootContextParams.ORIGIN, this.entityTarget.getParam()); + public Set> getReferencedContextParams() { + return Set.of(LootContextParams.ORIGIN, this.entityTarget.getParam()); } public boolean test(LootContext context) { - Entity entity = context.getParamOrNull(this.entityTarget.getParam()); - Vec3 vec3 = context.getParamOrNull(LootContextParams.ORIGIN); + Entity entity = context.getOptionalParameter(this.entityTarget.getParam()); + Vec3 vec3 = context.getOptionalParameter(LootContextParams.ORIGIN); return this.predicate.isEmpty() || ((EntityPredicate)this.predicate.get()).matches(context.getLevel(), vec3, entity); } diff --git a/net/minecraft/world/level/storage/loot/predicates/LootItemKilledByPlayerCondition.java b/net/minecraft/world/level/storage/loot/predicates/LootItemKilledByPlayerCondition.java index 19c628a0..c883d5de 100644 --- a/net/minecraft/world/level/storage/loot/predicates/LootItemKilledByPlayerCondition.java +++ b/net/minecraft/world/level/storage/loot/predicates/LootItemKilledByPlayerCondition.java @@ -1,10 +1,9 @@ package net.minecraft.world.level.storage.loot.predicates; -import com.google.common.collect.ImmutableSet; import com.mojang.serialization.MapCodec; import java.util.Set; +import net.minecraft.util.context.ContextKey; import net.minecraft.world.level.storage.loot.LootContext; -import net.minecraft.world.level.storage.loot.parameters.LootContextParam; import net.minecraft.world.level.storage.loot.parameters.LootContextParams; /** @@ -25,12 +24,12 @@ public class LootItemKilledByPlayerCondition implements LootItemCondition { } @Override - public Set> getReferencedContextParams() { - return ImmutableSet.of(LootContextParams.LAST_DAMAGE_PLAYER); + public Set> getReferencedContextParams() { + return Set.of(LootContextParams.LAST_DAMAGE_PLAYER); } public boolean test(LootContext context) { - return context.hasParam(LootContextParams.LAST_DAMAGE_PLAYER); + return context.hasParameter(LootContextParams.LAST_DAMAGE_PLAYER); } public static LootItemCondition.Builder killedByPlayer() { diff --git a/net/minecraft/world/level/storage/loot/predicates/LootItemRandomChanceWithEnchantedBonusCondition.java b/net/minecraft/world/level/storage/loot/predicates/LootItemRandomChanceWithEnchantedBonusCondition.java index 236049a5..baeb20c1 100644 --- a/net/minecraft/world/level/storage/loot/predicates/LootItemRandomChanceWithEnchantedBonusCondition.java +++ b/net/minecraft/world/level/storage/loot/predicates/LootItemRandomChanceWithEnchantedBonusCondition.java @@ -1,6 +1,5 @@ package net.minecraft.world.level.storage.loot.predicates; -import com.google.common.collect.ImmutableSet; import com.mojang.serialization.Codec; import com.mojang.serialization.MapCodec; import com.mojang.serialization.codecs.RecordCodecBuilder; @@ -8,14 +7,15 @@ import java.util.Set; import net.minecraft.core.Holder; import net.minecraft.core.HolderLookup; import net.minecraft.core.registries.Registries; +import net.minecraft.util.context.ContextKey; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.item.enchantment.Enchantment; import net.minecraft.world.item.enchantment.EnchantmentHelper; import net.minecraft.world.item.enchantment.Enchantments; import net.minecraft.world.item.enchantment.LevelBasedValue; +import net.minecraft.world.item.enchantment.LevelBasedValue.Linear; import net.minecraft.world.level.storage.loot.LootContext; -import net.minecraft.world.level.storage.loot.parameters.LootContextParam; import net.minecraft.world.level.storage.loot.parameters.LootContextParams; public record LootItemRandomChanceWithEnchantedBonusCondition(float unenchantedChance, LevelBasedValue enchantedChance, Holder enchantment) @@ -35,12 +35,12 @@ public record LootItemRandomChanceWithEnchantedBonusCondition(float unenchantedC } @Override - public Set> getReferencedContextParams() { - return ImmutableSet.of(LootContextParams.ATTACKING_ENTITY); + public Set> getReferencedContextParams() { + return Set.of(LootContextParams.ATTACKING_ENTITY); } public boolean test(LootContext context) { - Entity entity = context.getParamOrNull(LootContextParams.ATTACKING_ENTITY); + Entity entity = context.getOptionalParameter(LootContextParams.ATTACKING_ENTITY); int i = entity instanceof LivingEntity livingEntity ? EnchantmentHelper.getEnchantmentLevel(this.enchantment, livingEntity) : 0; float f = i > 0 ? this.enchantedChance.calculate(i) : this.unenchantedChance; return context.getRandom().nextFloat() < f; @@ -49,7 +49,7 @@ public record LootItemRandomChanceWithEnchantedBonusCondition(float unenchantedC public static LootItemCondition.Builder randomChanceAndLootingBoost(HolderLookup.Provider registries, float base, float perLevelAfterFirst) { HolderLookup.RegistryLookup registryLookup = registries.lookupOrThrow(Registries.ENCHANTMENT); return () -> new LootItemRandomChanceWithEnchantedBonusCondition( - base, new LevelBasedValue.Linear(base + perLevelAfterFirst, perLevelAfterFirst), registryLookup.getOrThrow(Enchantments.LOOTING) + base, new Linear(base + perLevelAfterFirst, perLevelAfterFirst), registryLookup.getOrThrow(Enchantments.LOOTING) ); } } diff --git a/net/minecraft/world/level/storage/loot/predicates/MatchTool.java b/net/minecraft/world/level/storage/loot/predicates/MatchTool.java index 81e54c14..6aedbc4e 100644 --- a/net/minecraft/world/level/storage/loot/predicates/MatchTool.java +++ b/net/minecraft/world/level/storage/loot/predicates/MatchTool.java @@ -1,14 +1,13 @@ package net.minecraft.world.level.storage.loot.predicates; -import com.google.common.collect.ImmutableSet; import com.mojang.serialization.MapCodec; import com.mojang.serialization.codecs.RecordCodecBuilder; import java.util.Optional; import java.util.Set; import net.minecraft.advancements.critereon.ItemPredicate; +import net.minecraft.util.context.ContextKey; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.storage.loot.LootContext; -import net.minecraft.world.level.storage.loot.parameters.LootContextParam; import net.minecraft.world.level.storage.loot.parameters.LootContextParams; /** @@ -25,12 +24,12 @@ public record MatchTool(Optional predicate) implements LootItemCo } @Override - public Set> getReferencedContextParams() { - return ImmutableSet.of(LootContextParams.TOOL); + public Set> getReferencedContextParams() { + return Set.of(LootContextParams.TOOL); } public boolean test(LootContext context) { - ItemStack itemStack = context.getParamOrNull(LootContextParams.TOOL); + ItemStack itemStack = context.getOptionalParameter(LootContextParams.TOOL); return itemStack != null && (this.predicate.isEmpty() || ((ItemPredicate)this.predicate.get()).test(itemStack)); } diff --git a/net/minecraft/world/level/storage/loot/predicates/TimeCheck.java b/net/minecraft/world/level/storage/loot/predicates/TimeCheck.java index 2de4f424..3eb1317f 100644 --- a/net/minecraft/world/level/storage/loot/predicates/TimeCheck.java +++ b/net/minecraft/world/level/storage/loot/predicates/TimeCheck.java @@ -6,9 +6,9 @@ import com.mojang.serialization.codecs.RecordCodecBuilder; import java.util.Optional; import java.util.Set; import net.minecraft.server.level.ServerLevel; +import net.minecraft.util.context.ContextKey; import net.minecraft.world.level.storage.loot.IntRange; import net.minecraft.world.level.storage.loot.LootContext; -import net.minecraft.world.level.storage.loot.parameters.LootContextParam; /** * A LootItemCondition that checks the {@linkplain ServerLevel#getDayTime day time} against an {@link IntRange} after applying an optional modulo division. @@ -25,7 +25,7 @@ public record TimeCheck(Optional period, IntRange value) implements LootIt } @Override - public Set> getReferencedContextParams() { + public Set> getReferencedContextParams() { return this.value.getReferencedContextParams(); } diff --git a/net/minecraft/world/level/storage/loot/predicates/ValueCheckCondition.java b/net/minecraft/world/level/storage/loot/predicates/ValueCheckCondition.java index 8305bce3..9aa8e61c 100644 --- a/net/minecraft/world/level/storage/loot/predicates/ValueCheckCondition.java +++ b/net/minecraft/world/level/storage/loot/predicates/ValueCheckCondition.java @@ -4,9 +4,9 @@ import com.google.common.collect.Sets; import com.mojang.serialization.MapCodec; import com.mojang.serialization.codecs.RecordCodecBuilder; import java.util.Set; +import net.minecraft.util.context.ContextKey; import net.minecraft.world.level.storage.loot.IntRange; import net.minecraft.world.level.storage.loot.LootContext; -import net.minecraft.world.level.storage.loot.parameters.LootContextParam; import net.minecraft.world.level.storage.loot.providers.number.NumberProvider; import net.minecraft.world.level.storage.loot.providers.number.NumberProviders; @@ -27,8 +27,8 @@ public record ValueCheckCondition(NumberProvider provider, IntRange range) imple } @Override - public Set> getReferencedContextParams() { - return Sets.>union(this.provider.getReferencedContextParams(), this.range.getReferencedContextParams()); + public Set> getReferencedContextParams() { + return Sets.>union(this.provider.getReferencedContextParams(), this.range.getReferencedContextParams()); } public boolean test(LootContext context) { diff --git a/net/minecraft/world/level/storage/loot/providers/nbt/ContextNbtProvider.java b/net/minecraft/world/level/storage/loot/providers/nbt/ContextNbtProvider.java index 709a3fc5..ad03a178 100644 --- a/net/minecraft/world/level/storage/loot/providers/nbt/ContextNbtProvider.java +++ b/net/minecraft/world/level/storage/loot/providers/nbt/ContextNbtProvider.java @@ -1,16 +1,15 @@ package net.minecraft.world.level.storage.loot.providers.nbt; -import com.google.common.collect.ImmutableSet; import com.mojang.serialization.Codec; import com.mojang.serialization.MapCodec; import com.mojang.serialization.codecs.RecordCodecBuilder; import java.util.Set; import net.minecraft.advancements.critereon.NbtPredicate; import net.minecraft.nbt.Tag; +import net.minecraft.util.context.ContextKey; import net.minecraft.world.entity.Entity; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.storage.loot.LootContext; -import net.minecraft.world.level.storage.loot.parameters.LootContextParam; import net.minecraft.world.level.storage.loot.parameters.LootContextParams; import org.jetbrains.annotations.Nullable; @@ -22,7 +21,7 @@ public class ContextNbtProvider implements NbtProvider { private static final ContextNbtProvider.Getter BLOCK_ENTITY_PROVIDER = new ContextNbtProvider.Getter() { @Override public Tag get(LootContext lootContext) { - BlockEntity blockEntity = lootContext.getParamOrNull(LootContextParams.BLOCK_ENTITY); + BlockEntity blockEntity = lootContext.getOptionalParameter(LootContextParams.BLOCK_ENTITY); return blockEntity != null ? blockEntity.saveWithFullMetadata(blockEntity.getLevel().registryAccess()) : null; } @@ -32,8 +31,8 @@ public class ContextNbtProvider implements NbtProvider { } @Override - public Set> getReferencedContextParams() { - return ImmutableSet.of(LootContextParams.BLOCK_ENTITY); + public Set> getReferencedContextParams() { + return Set.of(LootContextParams.BLOCK_ENTITY); } }; public static final ContextNbtProvider BLOCK_ENTITY = new ContextNbtProvider(BLOCK_ENTITY_PROVIDER); @@ -57,7 +56,7 @@ public class ContextNbtProvider implements NbtProvider { @Nullable @Override public Tag get(LootContext lootContext) { - Entity entity = lootContext.getParamOrNull(entityTarget.getParam()); + Entity entity = lootContext.getOptionalParameter(entityTarget.getParam()); return entity != null ? NbtPredicate.getEntityTagToCompare(entity) : null; } @@ -67,8 +66,8 @@ public class ContextNbtProvider implements NbtProvider { } @Override - public Set> getReferencedContextParams() { - return ImmutableSet.of(entityTarget.getParam()); + public Set> getReferencedContextParams() { + return Set.of(entityTarget.getParam()); } }; } @@ -89,7 +88,7 @@ public class ContextNbtProvider implements NbtProvider { } @Override - public Set> getReferencedContextParams() { + public Set> getReferencedContextParams() { return this.getter.getReferencedContextParams(); } @@ -103,6 +102,6 @@ public class ContextNbtProvider implements NbtProvider { String getId(); - Set> getReferencedContextParams(); + Set> getReferencedContextParams(); } } diff --git a/net/minecraft/world/level/storage/loot/providers/nbt/NbtProvider.java b/net/minecraft/world/level/storage/loot/providers/nbt/NbtProvider.java index be063d6d..87943678 100644 --- a/net/minecraft/world/level/storage/loot/providers/nbt/NbtProvider.java +++ b/net/minecraft/world/level/storage/loot/providers/nbt/NbtProvider.java @@ -2,8 +2,8 @@ package net.minecraft.world.level.storage.loot.providers.nbt; import java.util.Set; import net.minecraft.nbt.Tag; +import net.minecraft.util.context.ContextKey; import net.minecraft.world.level.storage.loot.LootContext; -import net.minecraft.world.level.storage.loot.parameters.LootContextParam; import org.jetbrains.annotations.Nullable; /** @@ -15,7 +15,7 @@ public interface NbtProvider { @Nullable Tag get(LootContext lootContext); - Set> getReferencedContextParams(); + Set> getReferencedContextParams(); LootNbtProviderType getType(); } diff --git a/net/minecraft/world/level/storage/loot/providers/nbt/StorageNbtProvider.java b/net/minecraft/world/level/storage/loot/providers/nbt/StorageNbtProvider.java index 138a4449..35b7c68f 100644 --- a/net/minecraft/world/level/storage/loot/providers/nbt/StorageNbtProvider.java +++ b/net/minecraft/world/level/storage/loot/providers/nbt/StorageNbtProvider.java @@ -1,14 +1,12 @@ package net.minecraft.world.level.storage.loot.providers.nbt; -import com.google.common.collect.ImmutableSet; import com.mojang.serialization.MapCodec; import com.mojang.serialization.codecs.RecordCodecBuilder; import java.util.Set; import net.minecraft.nbt.Tag; import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.context.ContextKey; import net.minecraft.world.level.storage.loot.LootContext; -import net.minecraft.world.level.storage.loot.parameters.LootContextParam; -import org.jetbrains.annotations.Nullable; /** * An NbtProvider that provides NBT data from a named {@link CommandStorage}. @@ -23,14 +21,13 @@ public record StorageNbtProvider(ResourceLocation id) implements NbtProvider { return NbtProviders.STORAGE; } - @Nullable @Override public Tag get(LootContext lootContext) { return lootContext.getLevel().getServer().getCommandStorage().get(this.id); } @Override - public Set> getReferencedContextParams() { - return ImmutableSet.of(); + public Set> getReferencedContextParams() { + return Set.of(); } } diff --git a/net/minecraft/world/level/storage/loot/providers/number/BinomialDistributionGenerator.java b/net/minecraft/world/level/storage/loot/providers/number/BinomialDistributionGenerator.java index ed5f3c2e..186b0a51 100644 --- a/net/minecraft/world/level/storage/loot/providers/number/BinomialDistributionGenerator.java +++ b/net/minecraft/world/level/storage/loot/providers/number/BinomialDistributionGenerator.java @@ -5,8 +5,8 @@ import com.mojang.serialization.MapCodec; import com.mojang.serialization.codecs.RecordCodecBuilder; import java.util.Set; import net.minecraft.util.RandomSource; +import net.minecraft.util.context.ContextKey; import net.minecraft.world.level.storage.loot.LootContext; -import net.minecraft.world.level.storage.loot.parameters.LootContextParam; /** * A number provider which generates a random number based on a binomial distribution. @@ -51,7 +51,7 @@ public record BinomialDistributionGenerator(NumberProvider n, NumberProvider p) } @Override - public Set> getReferencedContextParams() { - return Sets.>union(this.n.getReferencedContextParams(), this.p.getReferencedContextParams()); + public Set> getReferencedContextParams() { + return Sets.>union(this.n.getReferencedContextParams(), this.p.getReferencedContextParams()); } } diff --git a/net/minecraft/world/level/storage/loot/providers/number/EnchantmentLevelProvider.java b/net/minecraft/world/level/storage/loot/providers/number/EnchantmentLevelProvider.java index eba46385..658b20bf 100644 --- a/net/minecraft/world/level/storage/loot/providers/number/EnchantmentLevelProvider.java +++ b/net/minecraft/world/level/storage/loot/providers/number/EnchantmentLevelProvider.java @@ -14,7 +14,7 @@ public record EnchantmentLevelProvider(LevelBasedValue amount) implements Number @Override public float getFloat(LootContext lootContext) { - int i = lootContext.getParam(LootContextParams.ENCHANTMENT_LEVEL); + int i = lootContext.getParameter(LootContextParams.ENCHANTMENT_LEVEL); return this.amount.calculate(i); } diff --git a/net/minecraft/world/level/storage/loot/providers/number/ScoreboardValue.java b/net/minecraft/world/level/storage/loot/providers/number/ScoreboardValue.java index c4dd73c1..4c29509e 100644 --- a/net/minecraft/world/level/storage/loot/providers/number/ScoreboardValue.java +++ b/net/minecraft/world/level/storage/loot/providers/number/ScoreboardValue.java @@ -4,8 +4,8 @@ import com.mojang.serialization.Codec; import com.mojang.serialization.MapCodec; import com.mojang.serialization.codecs.RecordCodecBuilder; import java.util.Set; +import net.minecraft.util.context.ContextKey; import net.minecraft.world.level.storage.loot.LootContext; -import net.minecraft.world.level.storage.loot.parameters.LootContextParam; import net.minecraft.world.level.storage.loot.providers.score.ContextScoreboardNameProvider; import net.minecraft.world.level.storage.loot.providers.score.ScoreboardNameProvider; import net.minecraft.world.level.storage.loot.providers.score.ScoreboardNameProviders; @@ -34,7 +34,7 @@ public record ScoreboardValue(ScoreboardNameProvider target, String score, float } @Override - public Set> getReferencedContextParams() { + public Set> getReferencedContextParams() { return this.target.getReferencedContextParams(); } diff --git a/net/minecraft/world/level/storage/loot/providers/number/UniformGenerator.java b/net/minecraft/world/level/storage/loot/providers/number/UniformGenerator.java index 87c34e30..06a255f4 100644 --- a/net/minecraft/world/level/storage/loot/providers/number/UniformGenerator.java +++ b/net/minecraft/world/level/storage/loot/providers/number/UniformGenerator.java @@ -5,8 +5,8 @@ import com.mojang.serialization.MapCodec; import com.mojang.serialization.codecs.RecordCodecBuilder; import java.util.Set; import net.minecraft.util.Mth; +import net.minecraft.util.context.ContextKey; import net.minecraft.world.level.storage.loot.LootContext; -import net.minecraft.world.level.storage.loot.parameters.LootContextParam; /** * Generates a random number which is uniformly distributed between a minimum and a maximum. @@ -40,7 +40,7 @@ public record UniformGenerator(NumberProvider min, NumberProvider max) implement } @Override - public Set> getReferencedContextParams() { - return Sets.>union(this.min.getReferencedContextParams(), this.max.getReferencedContextParams()); + public Set> getReferencedContextParams() { + return Sets.>union(this.min.getReferencedContextParams(), this.max.getReferencedContextParams()); } } diff --git a/net/minecraft/world/level/storage/loot/providers/score/ContextScoreboardNameProvider.java b/net/minecraft/world/level/storage/loot/providers/score/ContextScoreboardNameProvider.java index f9a7d8b8..7252f0d7 100644 --- a/net/minecraft/world/level/storage/loot/providers/score/ContextScoreboardNameProvider.java +++ b/net/minecraft/world/level/storage/loot/providers/score/ContextScoreboardNameProvider.java @@ -1,12 +1,11 @@ package net.minecraft.world.level.storage.loot.providers.score; -import com.google.common.collect.ImmutableSet; import com.mojang.serialization.Codec; import com.mojang.serialization.MapCodec; import com.mojang.serialization.codecs.RecordCodecBuilder; import java.util.Set; +import net.minecraft.util.context.ContextKey; import net.minecraft.world.level.storage.loot.LootContext; -import net.minecraft.world.level.storage.loot.parameters.LootContextParam; import net.minecraft.world.scores.ScoreHolder; import org.jetbrains.annotations.Nullable; @@ -33,11 +32,11 @@ public record ContextScoreboardNameProvider(LootContext.EntityTarget target) imp @Nullable @Override public ScoreHolder getScoreHolder(LootContext context) { - return context.getParamOrNull(this.target.getParam()); + return context.getOptionalParameter(this.target.getParam()); } @Override - public Set> getReferencedContextParams() { - return ImmutableSet.of(this.target.getParam()); + public Set> getReferencedContextParams() { + return Set.of(this.target.getParam()); } } diff --git a/net/minecraft/world/level/storage/loot/providers/score/FixedScoreboardNameProvider.java b/net/minecraft/world/level/storage/loot/providers/score/FixedScoreboardNameProvider.java index 9cd5b455..e412ea75 100644 --- a/net/minecraft/world/level/storage/loot/providers/score/FixedScoreboardNameProvider.java +++ b/net/minecraft/world/level/storage/loot/providers/score/FixedScoreboardNameProvider.java @@ -1,12 +1,11 @@ package net.minecraft.world.level.storage.loot.providers.score; -import com.google.common.collect.ImmutableSet; import com.mojang.serialization.Codec; import com.mojang.serialization.MapCodec; import com.mojang.serialization.codecs.RecordCodecBuilder; import java.util.Set; +import net.minecraft.util.context.ContextKey; import net.minecraft.world.level.storage.loot.LootContext; -import net.minecraft.world.level.storage.loot.parameters.LootContextParam; import net.minecraft.world.scores.ScoreHolder; /** @@ -32,7 +31,7 @@ public record FixedScoreboardNameProvider(String name) implements ScoreboardName } @Override - public Set> getReferencedContextParams() { - return ImmutableSet.of(); + public Set> getReferencedContextParams() { + return Set.of(); } } diff --git a/net/minecraft/world/level/storage/loot/providers/score/ScoreboardNameProvider.java b/net/minecraft/world/level/storage/loot/providers/score/ScoreboardNameProvider.java index 4fe43b29..a9945480 100644 --- a/net/minecraft/world/level/storage/loot/providers/score/ScoreboardNameProvider.java +++ b/net/minecraft/world/level/storage/loot/providers/score/ScoreboardNameProvider.java @@ -1,8 +1,8 @@ package net.minecraft.world.level.storage.loot.providers.score; import java.util.Set; +import net.minecraft.util.context.ContextKey; import net.minecraft.world.level.storage.loot.LootContext; -import net.minecraft.world.level.storage.loot.parameters.LootContextParam; import net.minecraft.world.scores.ScoreHolder; import org.jetbrains.annotations.Nullable; @@ -15,5 +15,5 @@ public interface ScoreboardNameProvider { LootScoreProviderType getType(); - Set> getReferencedContextParams(); + Set> getReferencedContextParams(); } diff --git a/net/minecraft/world/level/timers/FunctionTagCallback.java b/net/minecraft/world/level/timers/FunctionTagCallback.java index 6d5b5e3a..1bb9a47e 100644 --- a/net/minecraft/world/level/timers/FunctionTagCallback.java +++ b/net/minecraft/world/level/timers/FunctionTagCallback.java @@ -22,7 +22,7 @@ public class FunctionTagCallback implements TimerCallback { } } - public static class Serializer extends TimerCallback.Serializer { + public static class Serializer extends net.minecraft.world.level.timers.TimerCallback.Serializer { public Serializer() { super(ResourceLocation.withDefaultNamespace("function_tag"), FunctionTagCallback.class); } diff --git a/net/minecraft/world/phys/AABB.java b/net/minecraft/world/phys/AABB.java index 4c98acb0..36037a39 100644 --- a/net/minecraft/world/phys/AABB.java +++ b/net/minecraft/world/phys/AABB.java @@ -1,5 +1,6 @@ package net.minecraft.world.phys; +import java.util.List; import java.util.Optional; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -379,16 +380,20 @@ public class AABB { } public Optional clip(Vec3 from, Vec3 to) { + return clip(this.minX, this.minY, this.minZ, this.maxX, this.maxY, this.maxZ, from, to); + } + + public static Optional clip(double d, double e, double f, double g, double h, double i, Vec3 vec3, Vec3 vec32) { double[] ds = new double[]{1.0}; - double d = to.x - from.x; - double e = to.y - from.y; - double f = to.z - from.z; - Direction direction = getDirection(this, from, ds, null, d, e, f); + double j = vec32.x - vec3.x; + double k = vec32.y - vec3.y; + double l = vec32.z - vec3.z; + Direction direction = getDirection(d, e, f, g, h, i, vec3, ds, null, j, k, l); if (direction == null) { return Optional.empty(); } else { - double g = ds[0]; - return Optional.of(from.add(g * d, g * e, g * f)); + double m = ds[0]; + return Optional.of(vec3.add(m * j, m * k, m * l)); } } @@ -414,37 +419,32 @@ public class AABB { @Nullable private static Direction getDirection(AABB aabb, Vec3 start, double[] minDistance, @Nullable Direction facing, double deltaX, double deltaY, double deltaZ) { - if (deltaX > 1.0E-7) { - facing = clipPoint( - minDistance, facing, deltaX, deltaY, deltaZ, aabb.minX, aabb.minY, aabb.maxY, aabb.minZ, aabb.maxZ, Direction.WEST, start.x, start.y, start.z - ); - } else if (deltaX < -1.0E-7) { - facing = clipPoint( - minDistance, facing, deltaX, deltaY, deltaZ, aabb.maxX, aabb.minY, aabb.maxY, aabb.minZ, aabb.maxZ, Direction.EAST, start.x, start.y, start.z - ); + return getDirection(aabb.minX, aabb.minY, aabb.minZ, aabb.maxX, aabb.maxY, aabb.maxZ, start, minDistance, facing, deltaX, deltaY, deltaZ); + } + + @Nullable + private static Direction getDirection( + double d, double e, double f, double g, double h, double i, Vec3 vec3, double[] ds, @Nullable Direction direction, double j, double k, double l + ) { + if (j > 1.0E-7) { + direction = clipPoint(ds, direction, j, k, l, d, e, h, f, i, Direction.WEST, vec3.x, vec3.y, vec3.z); + } else if (j < -1.0E-7) { + direction = clipPoint(ds, direction, j, k, l, g, e, h, f, i, Direction.EAST, vec3.x, vec3.y, vec3.z); } - if (deltaY > 1.0E-7) { - facing = clipPoint( - minDistance, facing, deltaY, deltaZ, deltaX, aabb.minY, aabb.minZ, aabb.maxZ, aabb.minX, aabb.maxX, Direction.DOWN, start.y, start.z, start.x - ); - } else if (deltaY < -1.0E-7) { - facing = clipPoint( - minDistance, facing, deltaY, deltaZ, deltaX, aabb.maxY, aabb.minZ, aabb.maxZ, aabb.minX, aabb.maxX, Direction.UP, start.y, start.z, start.x - ); + if (k > 1.0E-7) { + direction = clipPoint(ds, direction, k, l, j, e, f, i, d, g, Direction.DOWN, vec3.y, vec3.z, vec3.x); + } else if (k < -1.0E-7) { + direction = clipPoint(ds, direction, k, l, j, h, f, i, d, g, Direction.UP, vec3.y, vec3.z, vec3.x); } - if (deltaZ > 1.0E-7) { - facing = clipPoint( - minDistance, facing, deltaZ, deltaX, deltaY, aabb.minZ, aabb.minX, aabb.maxX, aabb.minY, aabb.maxY, Direction.NORTH, start.z, start.x, start.y - ); - } else if (deltaZ < -1.0E-7) { - facing = clipPoint( - minDistance, facing, deltaZ, deltaX, deltaY, aabb.maxZ, aabb.minX, aabb.maxX, aabb.minY, aabb.maxY, Direction.SOUTH, start.z, start.x, start.y - ); + if (l > 1.0E-7) { + direction = clipPoint(ds, direction, l, j, k, f, d, g, e, h, Direction.NORTH, vec3.z, vec3.x, vec3.y); + } else if (l < -1.0E-7) { + direction = clipPoint(ds, direction, l, j, k, i, d, g, e, h, Direction.SOUTH, vec3.z, vec3.x, vec3.y); } - return facing; + return direction; } @Nullable @@ -475,6 +475,24 @@ public class AABB { } } + public boolean collidedAlongVector(Vec3 vec3, List list) { + Vec3 vec32 = this.getCenter(); + Vec3 vec33 = vec32.add(vec3); + + for (AABB aABB : list) { + AABB aABB2 = aABB.inflate(this.getXsize() * 0.5, this.getYsize() * 0.5, this.getZsize() * 0.5); + if (aABB2.contains(vec33) || aABB2.contains(vec32)) { + return true; + } + + if (aABB2.clip(vec32, vec33).isPresent()) { + return true; + } + } + + return false; + } + public double distanceToSqr(Vec3 vec) { double d = Math.max(Math.max(this.minX - vec.x, vec.x - this.maxX), 0.0); double e = Math.max(Math.max(this.minY - vec.y, vec.y - this.maxY), 0.0); diff --git a/net/minecraft/world/phys/BlockHitResult.java b/net/minecraft/world/phys/BlockHitResult.java index b1057d41..29991597 100644 --- a/net/minecraft/world/phys/BlockHitResult.java +++ b/net/minecraft/world/phys/BlockHitResult.java @@ -2,41 +2,52 @@ package net.minecraft.world.phys; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; +import net.minecraft.world.phys.HitResult.Type; public class BlockHitResult extends HitResult { private final Direction direction; private final BlockPos blockPos; private final boolean miss; private final boolean inside; + private final boolean worldBorderHit; /** * Creates a new BlockRayTraceResult marked as a miss. */ public static BlockHitResult miss(Vec3 location, Direction direction, BlockPos pos) { - return new BlockHitResult(true, location, direction, pos, false); + return new BlockHitResult(true, location, direction, pos, false, false); } public BlockHitResult(Vec3 location, Direction direction, BlockPos blockPos, boolean inside) { - this(false, location, direction, blockPos, inside); + this(false, location, direction, blockPos, inside, false); } - private BlockHitResult(boolean miss, Vec3 location, Direction direction, BlockPos blockPos, boolean inside) { - super(location); - this.miss = miss; + public BlockHitResult(Vec3 vec3, Direction direction, BlockPos blockPos, boolean bl, boolean bl2) { + this(false, vec3, direction, blockPos, bl, bl2); + } + + private BlockHitResult(boolean bl, Vec3 vec3, Direction direction, BlockPos blockPos, boolean bl2, boolean bl3) { + super(vec3); + this.miss = bl; this.direction = direction; this.blockPos = blockPos; - this.inside = inside; + this.inside = bl2; + this.worldBorderHit = bl3; } /** * Creates a new BlockRayTraceResult, with the clicked face replaced with the given one */ public BlockHitResult withDirection(Direction newFace) { - return new BlockHitResult(this.miss, this.location, newFace, this.blockPos, this.inside); + return new BlockHitResult(this.miss, this.location, newFace, this.blockPos, this.inside, this.worldBorderHit); } public BlockHitResult withPosition(BlockPos pos) { - return new BlockHitResult(this.miss, this.location, this.direction, pos, this.inside); + return new BlockHitResult(this.miss, this.location, this.direction, pos, this.inside, this.worldBorderHit); + } + + public BlockHitResult hitBorder() { + return new BlockHitResult(this.miss, this.location, this.direction, this.blockPos, this.inside, true); } public BlockPos getBlockPos() { @@ -51,8 +62,8 @@ public class BlockHitResult extends HitResult { } @Override - public HitResult.Type getType() { - return this.miss ? HitResult.Type.MISS : HitResult.Type.BLOCK; + public Type getType() { + return this.miss ? Type.MISS : Type.BLOCK; } /** @@ -61,4 +72,8 @@ public class BlockHitResult extends HitResult { public boolean isInside() { return this.inside; } + + public boolean isWorldBorderHit() { + return this.worldBorderHit; + } } diff --git a/net/minecraft/world/phys/Vec3.java b/net/minecraft/world/phys/Vec3.java index cfc7f962..12269445 100644 --- a/net/minecraft/world/phys/Vec3.java +++ b/net/minecraft/world/phys/Vec3.java @@ -1,12 +1,15 @@ package net.minecraft.world.phys; import com.mojang.serialization.Codec; +import io.netty.buffer.ByteBuf; import java.util.EnumSet; import java.util.List; import net.minecraft.Util; import net.minecraft.core.Direction; import net.minecraft.core.Position; import net.minecraft.core.Vec3i; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.codec.StreamCodec; import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; import org.joml.Vector3f; @@ -18,6 +21,15 @@ public class Vec3 implements Position { list -> Util.fixedSize(list, 3).map(listx -> new Vec3((Double)listx.get(0), (Double)listx.get(1), (Double)listx.get(2))), vec3 -> List.of(vec3.x(), vec3.y(), vec3.z()) ); + public static final StreamCodec STREAM_CODEC = new StreamCodec() { + public Vec3 decode(ByteBuf byteBuf) { + return FriendlyByteBuf.readVec3(byteBuf); + } + + public void encode(ByteBuf byteBuf, Vec3 vec3) { + FriendlyByteBuf.writeVec3(byteBuf, vec3); + } + }; public static final Vec3 ZERO = new Vec3(0.0, 0.0, 0.0); public final double x; public final double y; @@ -72,6 +84,10 @@ public class Vec3 implements Position { this(vector.x(), vector.y(), vector.z()); } + public Vec3(Vec3i vec3i) { + this(vec3i.getX(), vec3i.getY(), vec3i.getZ()); + } + /** * Returns a new vector with the result of the specified vector minus this. */ @@ -84,7 +100,7 @@ public class Vec3 implements Position { */ public Vec3 normalize() { double d = Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z); - return d < 1.0E-4 ? ZERO : new Vec3(this.x / d, this.y / d, this.z / d); + return d < 1.0E-5F ? ZERO : new Vec3(this.x / d, this.y / d, this.z / d); } public double dot(Vec3 vec) { @@ -102,10 +118,18 @@ public class Vec3 implements Position { return this.subtract(vec.x, vec.y, vec.z); } + public Vec3 subtract(double d) { + return this.subtract(d, d, d); + } + public Vec3 subtract(double x, double y, double z) { return this.add(-x, -y, -z); } + public Vec3 add(double d) { + return this.add(d, d, d); + } + public Vec3 add(Vec3 vec) { return this.add(vec.x, vec.y, vec.z); } @@ -174,6 +198,10 @@ public class Vec3 implements Position { return new Vec3(this.x * factorX, this.y * factorY, this.z * factorZ); } + public Vec3 horizontal() { + return new Vec3(this.x, 0.0, this.z); + } + public Vec3 offsetRandom(RandomSource random, float factor) { return this.add((random.nextFloat() - 0.5F) * factor, (random.nextFloat() - 0.5F) * factor, (random.nextFloat() - 0.5F) * factor); } @@ -294,7 +322,7 @@ public class Vec3 implements Position { } public Vec3 relative(Direction direction, double length) { - Vec3i vec3i = direction.getNormal(); + Vec3i vec3i = direction.getUnitVec3i(); return new Vec3(this.x + length * vec3i.getX(), this.y + length * vec3i.getY(), this.z + length * vec3i.getZ()); } @@ -316,4 +344,8 @@ public class Vec3 implements Position { public Vector3f toVector3f() { return new Vector3f((float)this.x, (float)this.y, (float)this.z); } + + public Vec3 projectedOn(Vec3 vec3) { + return vec3.lengthSqr() == 0.0 ? vec3 : vec3.scale(this.dot(vec3)).scale(1.0 / vec3.lengthSqr()); + } } diff --git a/net/minecraft/world/phys/shapes/CollisionContext.java b/net/minecraft/world/phys/shapes/CollisionContext.java index 703b6f44..2036e7c5 100644 --- a/net/minecraft/world/phys/shapes/CollisionContext.java +++ b/net/minecraft/world/phys/shapes/CollisionContext.java @@ -2,7 +2,10 @@ package net.minecraft.world.phys.shapes; import net.minecraft.core.BlockPos; import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.vehicle.AbstractMinecart; import net.minecraft.world.item.Item; +import net.minecraft.world.level.CollisionGetter; +import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.material.FluidState; public interface CollisionContext { @@ -11,7 +14,16 @@ public interface CollisionContext { } static CollisionContext of(Entity entity) { - return new EntityCollisionContext(entity); + return (CollisionContext)(switch (entity) { + case AbstractMinecart abstractMinecart -> AbstractMinecart.useExperimentalMovement(abstractMinecart.level()) + ? new MinecartCollisionContext(abstractMinecart, false) + : new EntityCollisionContext(entity, false); + default -> new EntityCollisionContext(entity, false); + }); + } + + static CollisionContext of(Entity entity, boolean bl) { + return new EntityCollisionContext(entity, bl); } boolean isDescending(); @@ -21,4 +33,6 @@ public interface CollisionContext { boolean isHoldingItem(Item item); boolean canStandOnFluid(FluidState fluid1, FluidState fluid2); + + VoxelShape getCollisionShape(BlockState blockState, CollisionGetter collisionGetter, BlockPos blockPos); } diff --git a/net/minecraft/world/phys/shapes/EntityCollisionContext.java b/net/minecraft/world/phys/shapes/EntityCollisionContext.java index fe02fcbd..d7bb037e 100644 --- a/net/minecraft/world/phys/shapes/EntityCollisionContext.java +++ b/net/minecraft/world/phys/shapes/EntityCollisionContext.java @@ -7,6 +7,8 @@ import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.CollisionGetter; +import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.material.FluidState; import org.jetbrains.annotations.Nullable; @@ -33,12 +35,12 @@ public class EntityCollisionContext implements CollisionContext { } @Deprecated - protected EntityCollisionContext(Entity entity) { + protected EntityCollisionContext(Entity entity, boolean bl) { this( entity.isDescending(), entity.getY(), entity instanceof LivingEntity ? ((LivingEntity)entity).getMainHandItem() : ItemStack.EMPTY, - entity instanceof LivingEntity ? ((LivingEntity)entity)::canStandOnFluid : fluidState -> false, + bl ? fluidState -> true : (entity instanceof LivingEntity ? ((LivingEntity)entity)::canStandOnFluid : fluidState -> false), entity ); } @@ -53,6 +55,11 @@ public class EntityCollisionContext implements CollisionContext { return this.canStandOnFluid.test(fluid2) && !fluid1.getType().isSame(fluid2.getType()); } + @Override + public VoxelShape getCollisionShape(BlockState blockState, CollisionGetter collisionGetter, BlockPos blockPos) { + return blockState.getCollisionShape(collisionGetter, blockPos, this); + } + @Override public boolean isDescending() { return this.descending; diff --git a/net/minecraft/world/phys/shapes/MinecartCollisionContext.java b/net/minecraft/world/phys/shapes/MinecartCollisionContext.java new file mode 100644 index 00000000..4764c830 --- /dev/null +++ b/net/minecraft/world/phys/shapes/MinecartCollisionContext.java @@ -0,0 +1,47 @@ +package net.minecraft.world.phys.shapes; + +import net.minecraft.core.BlockPos; +import net.minecraft.world.entity.vehicle.AbstractMinecart; +import net.minecraft.world.level.CollisionGetter; +import net.minecraft.world.level.block.BaseRailBlock; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.properties.RailShape; +import org.jetbrains.annotations.Nullable; + +public class MinecartCollisionContext extends EntityCollisionContext { + @Nullable + private BlockPos ingoreBelow; + @Nullable + private BlockPos slopeIgnore; + + protected MinecartCollisionContext(AbstractMinecart abstractMinecart, boolean bl) { + super(abstractMinecart, bl); + this.setupContext(abstractMinecart); + } + + private void setupContext(AbstractMinecart abstractMinecart) { + BlockPos blockPos = abstractMinecart.getCurrentBlockPosOrRailBelow(); + BlockState blockState = abstractMinecart.level().getBlockState(blockPos); + boolean bl = BaseRailBlock.isRail(blockState); + if (bl) { + this.ingoreBelow = blockPos.below(); + RailShape railShape = blockState.getValue(((BaseRailBlock)blockState.getBlock()).getShapeProperty()); + if (railShape.isSlope()) { + this.slopeIgnore = switch (railShape) { + case ASCENDING_EAST -> blockPos.east(); + case ASCENDING_WEST -> blockPos.west(); + case ASCENDING_NORTH -> blockPos.north(); + case ASCENDING_SOUTH -> blockPos.south(); + default -> null; + }; + } + } + } + + @Override + public VoxelShape getCollisionShape(BlockState blockState, CollisionGetter collisionGetter, BlockPos blockPos) { + return !blockPos.equals(this.ingoreBelow) && !blockPos.equals(this.slopeIgnore) + ? super.getCollisionShape(blockState, collisionGetter, blockPos) + : Shapes.empty(); + } +} diff --git a/net/minecraft/world/phys/shapes/Shapes.java b/net/minecraft/world/phys/shapes/Shapes.java index d53064f4..7b7af5ab 100644 --- a/net/minecraft/world/phys/shapes/Shapes.java +++ b/net/minecraft/world/phys/shapes/Shapes.java @@ -222,25 +222,6 @@ public final class Shapes { } } - public static VoxelShape getFaceShape(VoxelShape voxelShape, Direction direction) { - if (voxelShape == block()) { - return block(); - } else { - Direction.Axis axis = direction.getAxis(); - boolean bl; - int i; - if (direction.getAxisDirection() == Direction.AxisDirection.POSITIVE) { - bl = DoubleMath.fuzzyEquals(voxelShape.max(axis), 1.0, 1.0E-7); - i = voxelShape.shape.getSize(axis) - 1; - } else { - bl = DoubleMath.fuzzyEquals(voxelShape.min(axis), 0.0, 1.0E-7); - i = 0; - } - - return (VoxelShape)(!bl ? empty() : new SliceShape(voxelShape, axis, i)); - } - } - public static boolean mergedFaceOccludes(VoxelShape shape, VoxelShape adjacentShape, Direction side) { if (shape != block() && adjacentShape != block()) { Direction.Axis axis = side.getAxis(); diff --git a/net/minecraft/world/phys/shapes/VoxelShape.java b/net/minecraft/world/phys/shapes/VoxelShape.java index faa37fd9..1fd59beb 100644 --- a/net/minecraft/world/phys/shapes/VoxelShape.java +++ b/net/minecraft/world/phys/shapes/VoxelShape.java @@ -72,6 +72,10 @@ public abstract class VoxelShape { return this.shape.isEmpty(); } + public VoxelShape move(Vec3 vec3) { + return this.move(vec3.x, vec3.y, vec3.z); + } + public VoxelShape move(double xOffset, double yOffset, double zOffset) { return (VoxelShape)(this.isEmpty() ? Shapes.empty() @@ -161,7 +165,7 @@ public abstract class VoxelShape { this.findIndex(Direction.Axis.Y, vec32.y - pos.getY()), this.findIndex(Direction.Axis.Z, vec32.z - pos.getZ()) ) - ? new BlockHitResult(vec32, Direction.getNearest(vec3.x, vec3.y, vec3.z).getOpposite(), pos, true) + ? new BlockHitResult(vec32, Direction.getApproximateNearest(vec3.x, vec3.y, vec3.z).getOpposite(), pos, true) : AABB.clip(this.toAabbs(), startVec, endVec, pos); } } @@ -208,16 +212,35 @@ public abstract class VoxelShape { private VoxelShape calculateFace(Direction side) { Direction.Axis axis = side.getAxis(); - DoubleList doubleList = this.getCoords(axis); - if (doubleList.size() == 2 && DoubleMath.fuzzyEquals(doubleList.getDouble(0), 0.0, 1.0E-7) && DoubleMath.fuzzyEquals(doubleList.getDouble(1), 1.0, 1.0E-7)) { + if (this.isCubeLikeAlong(axis)) { return this; } else { Direction.AxisDirection axisDirection = side.getAxisDirection(); int i = this.findIndex(axis, axisDirection == Direction.AxisDirection.POSITIVE ? 0.9999999 : 1.0E-7); - return new SliceShape(this, axis, i); + SliceShape sliceShape = new SliceShape(this, axis, i); + if (sliceShape.isEmpty()) { + return Shapes.empty(); + } else { + return (VoxelShape)(sliceShape.isCubeLike() ? Shapes.block() : sliceShape); + } } } + protected boolean isCubeLike() { + for (Direction.Axis axis : Direction.Axis.VALUES) { + if (!this.isCubeLikeAlong(axis)) { + return false; + } + } + + return true; + } + + private boolean isCubeLikeAlong(Direction.Axis axis) { + DoubleList doubleList = this.getCoords(axis); + return doubleList.size() == 2 && DoubleMath.fuzzyEquals(doubleList.getDouble(0), 0.0, 1.0E-7) && DoubleMath.fuzzyEquals(doubleList.getDouble(1), 1.0, 1.0E-7); + } + public double collide(Direction.Axis movementAxis, AABB collisionBox, double desiredOffset) { return this.collideX(AxisCycle.between(movementAxis, Direction.Axis.X), collisionBox, desiredOffset); } diff --git a/net/minecraft/world/scores/DisplaySlot.java b/net/minecraft/world/scores/DisplaySlot.java index 8b9e0158..385afe99 100644 --- a/net/minecraft/world/scores/DisplaySlot.java +++ b/net/minecraft/world/scores/DisplaySlot.java @@ -4,6 +4,7 @@ import java.util.function.IntFunction; import net.minecraft.ChatFormatting; import net.minecraft.util.ByIdMap; import net.minecraft.util.StringRepresentable; +import net.minecraft.util.ByIdMap.OutOfBoundsStrategy; import org.jetbrains.annotations.Nullable; public enum DisplaySlot implements StringRepresentable { @@ -28,7 +29,7 @@ public enum DisplaySlot implements StringRepresentable { TEAM_WHITE(18, "sidebar.team.white"); public static final StringRepresentable.EnumCodec CODEC = StringRepresentable.fromEnum(DisplaySlot::values); - public static final IntFunction BY_ID = ByIdMap.continuous(DisplaySlot::id, values(), ByIdMap.OutOfBoundsStrategy.ZERO); + public static final IntFunction BY_ID = ByIdMap.continuous(DisplaySlot::id, values(), OutOfBoundsStrategy.ZERO); private final int id; private final String name; diff --git a/net/minecraft/world/scores/ScoreboardSaveData.java b/net/minecraft/world/scores/ScoreboardSaveData.java index 8defdf35..a74585d7 100644 --- a/net/minecraft/world/scores/ScoreboardSaveData.java +++ b/net/minecraft/world/scores/ScoreboardSaveData.java @@ -11,6 +11,8 @@ import net.minecraft.network.chat.Component; import net.minecraft.network.chat.numbers.NumberFormat; import net.minecraft.network.chat.numbers.NumberFormatTypes; import net.minecraft.world.level.saveddata.SavedData; +import net.minecraft.world.scores.Team.CollisionRule; +import net.minecraft.world.scores.Team.Visibility; import net.minecraft.world.scores.criteria.ObjectiveCriteria; import org.slf4j.Logger; @@ -74,21 +76,21 @@ public class ScoreboardSaveData extends SavedData { } if (compoundTag.contains("NameTagVisibility", 8)) { - Team.Visibility visibility = Team.Visibility.byName(compoundTag.getString("NameTagVisibility")); + Visibility visibility = Visibility.byName(compoundTag.getString("NameTagVisibility")); if (visibility != null) { playerTeam.setNameTagVisibility(visibility); } } if (compoundTag.contains("DeathMessageVisibility", 8)) { - Team.Visibility visibility = Team.Visibility.byName(compoundTag.getString("DeathMessageVisibility")); + Visibility visibility = Visibility.byName(compoundTag.getString("DeathMessageVisibility")); if (visibility != null) { playerTeam.setDeathMessageVisibility(visibility); } } if (compoundTag.contains("CollisionRule", 8)) { - Team.CollisionRule collisionRule = Team.CollisionRule.byName(compoundTag.getString("CollisionRule")); + CollisionRule collisionRule = CollisionRule.byName(compoundTag.getString("CollisionRule")); if (collisionRule != null) { playerTeam.setCollisionRule(collisionRule); } diff --git a/net/minecraft/world/ticks/LevelChunkTicks.java b/net/minecraft/world/ticks/LevelChunkTicks.java index 8c697f76..e4afc16f 100644 --- a/net/minecraft/world/ticks/LevelChunkTicks.java +++ b/net/minecraft/world/ticks/LevelChunkTicks.java @@ -1,8 +1,7 @@ package net.minecraft.world.ticks; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableList.Builder; import it.unimi.dsi.fastutil.objects.ObjectOpenCustomHashSet; +import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Optional; @@ -96,16 +95,25 @@ public class LevelChunkTicks implements SerializableTickContainer, TickCon return this.tickQueue.size() + (this.pendingTicks != null ? this.pendingTicks.size() : 0); } - public ListTag save(long gameTime, Function idGetter) { - ListTag listTag = new ListTag(); + @Override + public List> pack(long l) { + List> list = new ArrayList(this.tickQueue.size()); if (this.pendingTicks != null) { - for (SavedTick savedTick : this.pendingTicks) { - listTag.add(savedTick.save(idGetter)); - } + list.addAll(this.pendingTicks); } for (ScheduledTick scheduledTick : this.tickQueue) { - listTag.add(SavedTick.saveTick(scheduledTick, idGetter, gameTime)); + list.add(scheduledTick.toSavedTick(l)); + } + + return list; + } + + public ListTag save(long gameTime, Function idGetter) { + ListTag listTag = new ListTag(); + + for (SavedTick savedTick : this.pack(gameTime)) { + listTag.add(savedTick.save(idGetter)); } return listTag; @@ -124,8 +132,6 @@ public class LevelChunkTicks implements SerializableTickContainer, TickCon } public static LevelChunkTicks load(ListTag tag, Function> isParser, ChunkPos pos) { - Builder> builder = ImmutableList.builder(); - SavedTick.loadTickList(tag, isParser, pos, builder::add); - return new LevelChunkTicks<>(builder.build()); + return new LevelChunkTicks<>(SavedTick.loadTickList(tag, isParser, pos)); } } diff --git a/net/minecraft/world/ticks/LevelTicks.java b/net/minecraft/world/ticks/LevelTicks.java index a913c91d..653d784b 100644 --- a/net/minecraft/world/ticks/LevelTicks.java +++ b/net/minecraft/world/ticks/LevelTicks.java @@ -19,11 +19,11 @@ import java.util.Set; import java.util.function.BiConsumer; import java.util.function.LongPredicate; import java.util.function.Predicate; -import java.util.function.Supplier; import net.minecraft.Util; import net.minecraft.core.BlockPos; import net.minecraft.core.SectionPos; import net.minecraft.core.Vec3i; +import net.minecraft.util.profiling.Profiler; import net.minecraft.util.profiling.ProfilerFiller; import net.minecraft.world.level.ChunkPos; import net.minecraft.world.level.levelgen.structure.BoundingBox; @@ -32,7 +32,6 @@ public class LevelTicks implements LevelTickAccess { private static final Comparator> CONTAINER_DRAIN_ORDER = (levelChunkTicks, levelChunkTicks2) -> ScheduledTick.INTRA_TICK_DRAIN_ORDER .compare(levelChunkTicks.peek(), levelChunkTicks2.peek()); private final LongPredicate tickCheck; - private final Supplier profiler; private final Long2ObjectMap> allContainers = new Long2ObjectOpenHashMap<>(); private final Long2LongMap nextTickForContainer = Util.make( new Long2LongOpenHashMap(), long2LongOpenHashMap -> long2LongOpenHashMap.defaultReturnValue(Long.MAX_VALUE) @@ -47,9 +46,8 @@ public class LevelTicks implements LevelTickAccess { } }; - public LevelTicks(LongPredicate tickCheck, Supplier profiler) { - this.tickCheck = tickCheck; - this.profiler = profiler; + public LevelTicks(LongPredicate longPredicate) { + this.tickCheck = longPredicate; } public void addContainer(ChunkPos chunkPos, LevelChunkTicks chunkTicks) { @@ -77,14 +75,14 @@ public class LevelTicks implements LevelTickAccess { long l = ChunkPos.asLong(tick.pos()); LevelChunkTicks levelChunkTicks = this.allContainers.get(l); if (levelChunkTicks == null) { - Util.pauseInIde((T)(new IllegalStateException("Trying to schedule tick in not loaded position " + tick.pos()))); + Util.logAndPauseIfInIde("Trying to schedule tick in not loaded position " + tick.pos()); } else { levelChunkTicks.schedule(tick); } } public void tick(long gameTime, int maxAllowedTicks, BiConsumer ticker) { - ProfilerFiller profilerFiller = (ProfilerFiller)this.profiler.get(); + ProfilerFiller profilerFiller = Profiler.get(); profilerFiller.push("collect"); this.collectTicks(gameTime, maxAllowedTicks, profilerFiller); profilerFiller.popPush("run"); diff --git a/net/minecraft/world/ticks/ProtoChunkTicks.java b/net/minecraft/world/ticks/ProtoChunkTicks.java index 5c21186f..7fa017db 100644 --- a/net/minecraft/world/ticks/ProtoChunkTicks.java +++ b/net/minecraft/world/ticks/ProtoChunkTicks.java @@ -3,13 +3,8 @@ package net.minecraft.world.ticks; import com.google.common.collect.Lists; import it.unimi.dsi.fastutil.objects.ObjectOpenCustomHashSet; import java.util.List; -import java.util.Optional; import java.util.Set; -import java.util.function.Function; import net.minecraft.core.BlockPos; -import net.minecraft.nbt.ListTag; -import net.minecraft.nbt.Tag; -import net.minecraft.world.level.ChunkPos; public class ProtoChunkTicks implements SerializableTickContainer, TickContainerAccess { private final List> ticks = Lists.>newArrayList(); @@ -38,23 +33,17 @@ public class ProtoChunkTicks implements SerializableTickContainer, TickCon } @Override - public Tag save(long gameTime, Function idGetter) { - ListTag listTag = new ListTag(); - - for (SavedTick savedTick : this.ticks) { - listTag.add(savedTick.save(idGetter)); - } - - return listTag; + public List> pack(long l) { + return this.ticks; } public List> scheduledTicks() { return List.copyOf(this.ticks); } - public static ProtoChunkTicks load(ListTag tag, Function> idParser, ChunkPos chunkPos) { + public static ProtoChunkTicks load(List> list) { ProtoChunkTicks protoChunkTicks = new ProtoChunkTicks<>(); - SavedTick.loadTickList(tag, idParser, chunkPos, protoChunkTicks::schedule); + list.forEach(protoChunkTicks::schedule); return protoChunkTicks; } } diff --git a/net/minecraft/world/ticks/SavedTick.java b/net/minecraft/world/ticks/SavedTick.java index 3a26bac7..de22f6d9 100644 --- a/net/minecraft/world/ticks/SavedTick.java +++ b/net/minecraft/world/ticks/SavedTick.java @@ -1,8 +1,9 @@ package net.minecraft.world.ticks; import it.unimi.dsi.fastutil.Hash.Strategy; +import java.util.ArrayList; +import java.util.List; import java.util.Optional; -import java.util.function.Consumer; import java.util.function.Function; import net.minecraft.core.BlockPos; import net.minecraft.nbt.CompoundTag; @@ -31,17 +32,20 @@ public record SavedTick(T type, BlockPos pos, int delay, TickPriority priorit } }; - public static void loadTickList(ListTag tag, Function> idParser, ChunkPos chunkPos, Consumer> output) { + public static List> loadTickList(ListTag listTag, Function> function, ChunkPos chunkPos) { + List> list = new ArrayList(listTag.size()); long l = chunkPos.toLong(); - for (int i = 0; i < tag.size(); i++) { - CompoundTag compoundTag = tag.getCompound(i); - loadTick(compoundTag, idParser).ifPresent(savedTick -> { + for (int i = 0; i < listTag.size(); i++) { + CompoundTag compoundTag = listTag.getCompound(i); + loadTick(compoundTag, function).ifPresent(savedTick -> { if (ChunkPos.asLong(savedTick.pos()) == l) { - output.accept(savedTick); + list.add(savedTick); } }); } + + return list; } public static Optional> loadTick(CompoundTag tag, Function> idParser) { @@ -62,10 +66,6 @@ public record SavedTick(T type, BlockPos pos, int delay, TickPriority priorit return compoundTag; } - public static CompoundTag saveTick(ScheduledTick tick, Function idGetter, long gameTime) { - return saveTick((String)idGetter.apply(tick.type()), tick.pos(), (int)(tick.triggerTick() - gameTime), tick.priority()); - } - public CompoundTag save(Function idGetter) { return saveTick((String)idGetter.apply(this.type), this.pos, this.delay, this.priority); } diff --git a/net/minecraft/world/ticks/ScheduledTick.java b/net/minecraft/world/ticks/ScheduledTick.java index 85574d20..022e0756 100644 --- a/net/minecraft/world/ticks/ScheduledTick.java +++ b/net/minecraft/world/ticks/ScheduledTick.java @@ -49,4 +49,8 @@ public record ScheduledTick(T type, BlockPos pos, long triggerTick, TickPrior public static ScheduledTick probe(T type, BlockPos pos) { return new ScheduledTick<>(type, pos, 0L, TickPriority.NORMAL, 0L); } + + public SavedTick toSavedTick(long l) { + return new SavedTick<>(this.type, this.pos, (int)(this.triggerTick - l), this.priority); + } } diff --git a/net/minecraft/world/ticks/SerializableTickContainer.java b/net/minecraft/world/ticks/SerializableTickContainer.java index 602348c8..e09840a2 100644 --- a/net/minecraft/world/ticks/SerializableTickContainer.java +++ b/net/minecraft/world/ticks/SerializableTickContainer.java @@ -1,8 +1,7 @@ package net.minecraft.world.ticks; -import java.util.function.Function; -import net.minecraft.nbt.Tag; +import java.util.List; public interface SerializableTickContainer { - Tag save(long gameTime, Function idGetter); + List> pack(long l); } diff --git a/version.json b/version.json index 2320c276..8bcde73f 100644 --- a/version.json +++ b/version.json @@ -1,14 +1,14 @@ { - "id": "1.21.1", - "name": "1.21.1", - "world_version": 3955, + "id": "1.21.2", + "name": "1.21.2", + "world_version": 4080, "series_id": "main", - "protocol_version": 767, + "protocol_version": 768, "pack_version": { - "resource": 34, - "data": 48 + "resource": 42, + "data": 57 }, - "build_time": "2024-08-08T12:21:55+00:00", + "build_time": "2024-10-22T09:55:49+00:00", "java_component": "java-runtime-delta", "java_version": 21, "stable": true,